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

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 lr},initializeEditor:function(){return sr},reinitializeEditor:function(){return cr}});var e={};r.r(e),r.d(e,{disableComplementaryArea:function(){return P},enableComplementaryArea:function(){return L},pinItem:function(){return R},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 Ne},moveBlockToWidgetArea:function(){return Be},persistStubPost:function(){return fe},saveEditedWidgetAreas:function(){return Ee},saveWidgetArea:function(){return ve},saveWidgetAreas:function(){return be},setIsInserterOpened:function(){return Ae},setIsListViewOpened:function(){return Ce},setIsWidgetAreaOpen:function(){return Ie},setWidgetAreasOpenState:function(){return Se},setWidgetIdForClientId:function(){return ke}});var a={};r.r(a),r.d(a,{getWidgetAreas:function(){return xe},getWidgets:function(){return We}});var o={};r.r(o),r.d(o,{__experimentalGetInsertionPoint:function(){return ze},canInsertBlockInWidgetArea:function(){return He},getEditedWidgetAreas:function(){return Me},getIsWidgetAreaOpen:function(){return Fe},getParentWidgetAreaBlock:function(){return Oe},getReferenceWidgetBlocks:function(){return De},getWidget:function(){return Le},getWidgetAreaForWidgetId:function(){return Re},getWidgetAreas:function(){return Pe},getWidgets:function(){return Te},isInserterOpened:function(){return Ge},isListViewOpened:function(){return Ue},isSavingWidgetAreas:function(){return Ve}});var s={};r.r(s),r.d(s,{metadata:function(){return Ze},name:function(){return et},settings:function(){return tt}});var l=window.wp.element,c=window.wp.blocks,d=window.wp.data,u=window.wp.deprecated,m=r.n(u),g=window.wp.blockLibrary,p=window.wp.coreData,h=window.wp.widgets,_=window.wp.preferences,w=window.wp.apiFetch,f=r.n(w);var E=(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}}}),b=window.wp.i18n,v=window.wp.notices;function y(){return y=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},y.apply(this,arguments)}var k=r(4403),S=r.n(k),I=window.wp.components,A=window.wp.primitives;var C=(0,l.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(A.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"}));var N=(0,l.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(A.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 B=(0,l.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(A.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"})),x=window.wp.viewport;var W=(0,l.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(A.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"}));const T=(e,t)=>({type:"SET_DEFAULT_COMPLEMENTARY_AREA",scope:e,area:t}),L=(e,t)=>r=>{let{registry:n,dispatch:i}=r;if(!t)return;n.select(_.store).get(e,"isComplementaryAreaVisible")||n.dispatch(_.store).set(e,"isComplementaryAreaVisible",!0),i({type:"ENABLE_COMPLEMENTARY_AREA",scope:e,area:t})},P=e=>t=>{let{registry:r}=t;r.select(_.store).get(e,"isComplementaryAreaVisible")&&r.dispatch(_.store).set(e,"isComplementaryAreaVisible",!1)},R=(e,t)=>r=>{let{registry:n}=r;if(!t)return;const i=n.select(_.store).get(e,"pinnedItems");!0!==(null==i?void 0:i[t])&&n.dispatch(_.store).set(e,"pinnedItems",{...i,[t]:!0})},O=(e,t)=>r=>{let{registry:n}=r;if(!t)return;const i=n.select(_.store).get(e,"pinnedItems");n.dispatch(_.store).set(e,"pinnedItems",{...i,[t]:!1})};function M(e,t){return function(r){let{registry:n}=r;m()("dispatch( 'core/interface' ).toggleFeature",{since:"6.0",alternative:"dispatch( 'core/preferences' ).toggle"}),n.dispatch(_.store).toggle(e,t)}}function D(e,t,r){return function(n){let{registry:i}=n;m()("dispatch( 'core/interface' ).setFeatureValue",{since:"6.0",alternative:"dispatch( 'core/preferences' ).set"}),i.dispatch(_.store).set(e,t,!!r)}}function V(e,t){return function(r){let{registry:n}=r;m()("dispatch( 'core/interface' ).setFeatureDefaults",{since:"6.0",alternative:"dispatch( 'core/preferences' ).setDefaults"}),n.dispatch(_.store).setDefaults(e,t)}}const F=(0,d.createRegistrySelector)((e=>(t,r)=>{var n;const i=e(_.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(_.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)=>(m()("select( 'core/interface' ).isFeatureActive( scope, featureName )",{since:"6.0",alternative:"select( 'core/preferences' ).get( scope, featureName )"}),!!e(_.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=I.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,y({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,y({icon:W},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:S()("components-panel__header","interface-complementary-area-header",n),tabIndex:-1},r,a))};const q=()=>{};function Q(e){let{name:t,as:r=I.Button,onClick:n,...i}=e;return(0,l.createElement)(I.Fill,{name:t},(e=>{let{onClick:t}=e;return(0,l.createElement)(r,y({onClick:n||t?function(){(n||q)(...arguments),(t||q)(...arguments)}:void 0},i))}))}Q.Slot=function(e){let{name:t,as:r=I.ButtonGroup,fillProps:n={},bubblesVirtually:i,...a}=e;return(0,l.createElement)(I.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)(I.MenuItem,n)};function Z(e){let{scope:t,target:r,__unstableExplicitMenuItem:n,...i}=e;return(0,l.createElement)(Y,y({as:e=>(0,l.createElement)(J,y({__unstableExplicitMenuItem:n,__unstableTarget:`${t}/${r}`,as:X,name:`${t}/plugin-more-menu`},e)),role:"menuitemcheckbox",selectedIcon:C,name:r,scope:t},i))}function ee(e){let{scope:t,...r}=e;return(0,l.createElement)(I.Fill,y({name:`PinnedItems/${t}`},r))}ee.Slot=function(e){let{scope:t,className:r,...n}=e;return(0,l.createElement)(I.Slot,y({name:`PinnedItems/${t}`},n),(e=>(null==e?void 0:e.length)>0&&(0,l.createElement)("div",{className:S()(r,"interface-pinned-items")},e)))};var te=ee;function re(e){let{scope:t,children:r,className:n}=e;return(0,l.createElement)(I.Fill,{name:`ComplementaryArea/${t}`},(0,l.createElement)("div",{className:n},r))}const ne=$((function(e){let{children:t,className:r,closeLabel:n=(0,b.__)("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:f=!1}=e;const{isActive:E,isPinned:v,activeArea:y,isSmall:k,isLarge:A}=(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(x.store).isViewportMatch("< medium"),isLarge:e(x.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,y,E,k);const{enableComplementaryArea:W,disableComplementaryArea:T,pinItem:L,unpinItem:P}=(0,d.useDispatch)(U);return(0,l.useEffect)((()=>{w&&void 0===y&&!k&&W(m,i)}),[y,w,m,i,k]),(0,l.createElement)(l.Fragment,null,c&&(0,l.createElement)(te,{scope:m},v&&(0,l.createElement)(Y,{scope:m,identifier:i,isPressed:E&&(!f||A),"aria-expanded":E,label:h,icon:f?C:s,showTooltip:!f,variant:f?"tertiary":void 0})),g&&c&&(0,l.createElement)(Z,{target:g,scope:m,icon:s},h),E&&(0,l.createElement)(re,{className:S()("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)(I.Button,{className:"interface-complementary-area__pin-unpin-item",icon:v?N:B,label:v?(0,b.__)("Unpin from toolbar"):(0,b.__)("Pin to toolbar"),onClick:()=>(v?P:L)(m,i),isPressed:v,"aria-expanded":v}))),(0,l.createElement)(I.Panel,{className:u},t)))}));ne.Slot=function(e){let{scope:t,...r}=e;return(0,l.createElement)(I.Slot,y({name:`ComplementaryArea/${t}`},r))};var ie=ne,ae=window.wp.compose;function oe(e){let{children:t,className:r,ariaLabel:n,as:i="div",...a}=e;return(0,l.createElement)(i,y({className:S()("interface-navigable-region",r),"aria-label":n,role:"region",tabIndex:"-1"},a),t)}var se=(0,l.forwardRef)((function(e,t){let{isDistractionFree:r,footer:n,header:i,editorNotices:a,sidebar:o,secondarySidebar:s,notices:c,content:d,actions:u,labels:m,className:g,enableRegionNavigation:p=!0,shortcuts:h}=e;const _=(0,I.__unstableUseNavigateRegions)(h);!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 w={...{header:(0,b.__)("Header"),body:(0,b.__)("Content"),secondarySidebar:(0,b.__)("Block Library"),sidebar:(0,b.__)("Settings"),actions:(0,b.__)("Publish"),footer:(0,b.__)("Footer")},...m},f={hidden:r?{opacity:0}:{opacity:1},hover:{opacity:1,transition:{type:"tween",delay:.2,delayChildren:.2}}};return(0,l.createElement)("div",y({},p?_:{},{ref:(0,ae.useMergeRefs)([t,p?_.ref:void 0]),className:S()(g,"interface-interface-skeleton",_.className,!!n&&"has-footer")}),(0,l.createElement)("div",{className:"interface-interface-skeleton__editor"},!!i&&r&&(0,l.createElement)(oe,{as:I.__unstableMotion.div,className:"interface-interface-skeleton__header","aria-label":w.header,initial:r?"hidden":"hover",whileHover:"hover",variants:f,transition:{type:"tween",delay:.8}},i),!!i&&!r&&(0,l.createElement)(oe,{className:"interface-interface-skeleton__header",ariaLabel:w.header},i),r&&(0,l.createElement)("div",{className:"interface-interface-skeleton__header"},a),(0,l.createElement)("div",{className:"interface-interface-skeleton__body"},!!s&&(0,l.createElement)(oe,{className:"interface-interface-skeleton__secondary-sidebar",ariaLabel:w.secondarySidebar},s),!!c&&(0,l.createElement)("div",{className:"interface-interface-skeleton__notices"},c),(0,l.createElement)(oe,{className:"interface-interface-skeleton__content",ariaLabel:w.body},d),!!o&&(0,l.createElement)(oe,{className:"interface-interface-skeleton__sidebar",ariaLabel:w.sidebar},o),!!u&&(0,l.createElement)(oe,{className:"interface-interface-skeleton__actions",ariaLabel:w.actions},u))),!!n&&(0,l.createElement)(oe,{className:"interface-interface-skeleton__footer",ariaLabel:w.footer},n))}));var le=(0,l.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(A.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"}));function ce(e){let{as:t=I.DropdownMenu,className:r,label:n=(0,b.__)("Options"),popoverProps:i,toggleProps:a,children:o}=e;return(0,l.createElement)(t,{className:S()("interface-more-menu-dropdown",r),icon:le,label:n,popoverProps:{placement:"bottom-end",...i,className:S()("interface-more-menu-dropdown__content",null==i?void 0:i.className)},toggleProps:{tooltipPosition:"bottom",...a}},(e=>o(e)))}var de=window.wp.blockEditor;function ue(e){if("block"===e.id_base){const t=(0,c.parse)(e.instance.raw.content,{__unstableSkipAutop:!0});return t.length?(0,h.addWidgetIdToBlock)(t[0],e.id):(0,h.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,h.addWidgetIdToBlock)((0,c.createBlock)("core/legacy-widget",t,[]),e.id)}function me(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 ge="root",pe="sidebar",he="postType",_e=e=>`widget-area-${e}`;const we="core/edit-widgets",fe=(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(p.store).receiveEntityRecords(ge,he,i,{id:i.id},!1),i},Ee=()=>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(v.store).createSuccessNotice((0,b.__)("Widgets saved."),{type:"snackbar"})}catch(e){n.dispatch(v.store).createErrorNotice((0,b.sprintf)((0,b.__)("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(p.store).finishResolution("getEntityRecord",ge,pe,{per_page:-1})}},ve=e=>async t=>{let{dispatch:r,select:n,registry:i}=t;const a=n.getWidgets(),o=i.select(p.store).getEditedEntityRecord(ge,he,_e(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=[],m=[],g=[];for(let t=0;t<c.length;t++){const r=c[t],n=(0,h.getWidgetIdFromBlock)(r),o=a[n],s=me(r,o);if(g.push(n),o){i.dispatch(p.store).editEntityRecord("root","widget",n,{...s,sidebar:e},{undoIgnore:!0});if(!i.select(p.store).hasEditsForEntityRecord("root","widget",n))continue;m.push((e=>{let{saveEditedEntityRecord:t}=e;return t("root","widget",n)}))}else m.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)m.push((t=>{let{deleteEntityRecord:r}=t;return r("root","widget",e.id,{force:!0})}));const _=(await i.dispatch(p.store).__experimentalBatch(m)).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 f;if(i.select(p.store).getLastEntitySaveError("root","widget",t.id))w.push((null===(f=r.attributes)||void 0===f?void 0:f.name)||(null==r?void 0:r.name));g[n]||(g[n]=t.id)}if(w.length)throw new Error((0,b.sprintf)((0,b.__)("Could not save the following widgets: %s."),w.join(", ")));i.dispatch(p.store).editEntityRecord(ge,pe,e,{widgets:g},{undoIgnore:!0}),r(ye(e)),i.dispatch(p.store).receiveEntityRecords(ge,he,o,void 0)},ye=e=>t=>{let{registry:r}=t;r.dispatch(p.store).saveEditedEntityRecord(ge,pe,e,{throwOnError:!0})};function ke(e,t){return{type:"SET_WIDGET_ID_FOR_CLIENT_ID",clientId:e,widgetId:t}}function Se(e){return{type:"SET_WIDGET_AREAS_OPEN_STATE",widgetAreasOpenState:e}}function Ie(e,t){return{type:"SET_IS_WIDGET_AREA_OPEN",clientId:e,isOpen:t}}function Ae(e){return{type:"SET_IS_INSERTER_OPENED",value:e}}function Ce(e){return{type:"SET_IS_LIST_VIEW_OPENED",isOpen:e}}const Ne=()=>e=>{let{registry:t}=e;t.dispatch(U).disableComplementaryArea(we)},Be=(e,t)=>async r=>{let{dispatch:n,select:i,registry:a}=r;const o=a.select(de.store).getBlockRootClientId(e),s=a.select(de.store).getBlocks().find((e=>{let{attributes:r}=e;return r.id===t})).clientId,l=a.select(de.store).getBlockOrder(s).length;i.getIsWidgetAreaOpen(s)||n.setIsWidgetAreaOpen(s,!0),a.dispatch(de.store).moveBlocksToPosition([e],o,s,l)},xe=()=>async e=>{let{dispatch:t,registry:r}=e;const n={per_page:-1},i=[],a=(await r.resolveSelect(p.store).getEntityRecords(ge,pe,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(fe(_e(e.id),[]));const o={};i.forEach(((e,t)=>{o[e.clientId]=0===t})),t(Se(o)),t(fe("widget-areas",i))},We=()=>async e=>{let{dispatch:t,registry:r}=e;const n={per_page:-1,_embed:"about"},i=await r.resolveSelect(p.store).getEntityRecords("root","widget",n),a={};for(const e of i){const t=ue(e);a[e.sidebar]=a[e.sidebar]||[],a[e.sidebar].push(t)}for(const e in a)a.hasOwnProperty(e)&&t(fe(_e(e),a[e]))},Te=(0,d.createRegistrySelector)((e=>()=>{const t=e(p.store).getEntityRecords("root","widget",{per_page:-1,_embed:"about"});return(null==t?void 0:t.reduce(((e,t)=>({...e,[t.id]:t})),{}))||{}})),Le=(0,d.createRegistrySelector)((e=>(t,r)=>e(we).getWidgets()[r])),Pe=(0,d.createRegistrySelector)((e=>()=>{const t={per_page:-1};return e(p.store).getEntityRecords(ge,pe,t)})),Re=(0,d.createRegistrySelector)((e=>(t,r)=>e(we).getWidgetAreas().find((t=>e(p.store).getEditedEntityRecord(ge,he,_e(t.id)).blocks.map((e=>(0,h.getWidgetIdFromBlock)(e))).includes(r))))),Oe=(0,d.createRegistrySelector)((e=>(t,r)=>{const{getBlock:n,getBlockName:i,getBlockParents:a}=e(de.store);return n(a(r).find((e=>"core/widget-area"===i(e))))})),Me=(0,d.createRegistrySelector)((e=>(t,r)=>{let n=e(we).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(p.store).hasEditsForEntityRecord(ge,he,_e(r))})).map((t=>{let{id:r}=t;return e(p.store).getEditedEntityRecord(ge,pe,r)}))):[]})),De=(0,d.createRegistrySelector)((e=>function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const n=[],i=e(we).getWidgetAreas();for(const t of i){const i=e(p.store).getEditedEntityRecord(ge,he,_e(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})),Ve=(0,d.createRegistrySelector)((e=>()=>{var t;const r=null===(t=e(we).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(p.store).isSavingEntityRecord(ge,pe,t))return!0}const n=[...Object.keys(e(we).getWidgets()),void 0];for(const t of n){if(e(p.store).isSavingEntityRecord("root","widget",t))return!0}return!1})),Fe=(e,t)=>{const{widgetAreasOpenState:r}=e;return!!r[t]};function Ge(e){return!!e.blockInserterPanel}function ze(e){const{rootClientId:t,insertionIndex:r}=e.blockInserterPanel;return{rootClientId:t,insertionIndex:r}}const He=(0,d.createRegistrySelector)((e=>(t,r)=>{const n=e(de.store).getBlocks(),[i]=n;return e(de.store).canInsertBlockType(r,i.clientId)}));function Ue(e){return e.listViewPanel}const je={reducer:E,selectors:o,resolvers:a,actions:i},$e=(0,d.createReduxStore)(we,je);(0,d.register)($e),f().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 Ye=window.wp.hooks;const Ke=(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($e),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)($e),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)(de.BlockControls,null,(0,l.createElement)(h.MoveToWidgetArea,{widgetAreas:i,currentWidgetAreaId:a,onSelect:e=>{s(t.clientId,e)}})))}),"withMoveToWidgetAreaToolbarItem");(0,Ye.addFilter)("editor.BlockEdit","core/edit-widgets/block-edit",Ke);var qe=window.wp.mediaUtils;(0,Ye.addFilter)("editor.MediaUpload","core/edit-widgets/replace-media-upload",(()=>qe.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 Je(e){let{id:t}=e;const[r,n,i]=(0,p.useEntityBlockEditor)("root","postType"),a=(0,l.useRef)(),o=Qe(a),s=(0,de.useInnerBlocksProps)({ref:a},{value:r,onInput:n,onChange:i,templateLock:!1,renderAppender:de.InnerBlocks.ButtonBlockAppender});return(0,l.createElement)("div",{"data-widget-area-id":t,className:S()("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 Xe=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},Ze={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:et}=Ze,tt={title:(0,b.__)("Widget Area"),description:(0,b.__)("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($e).getIsWidgetAreaOpen(t)),[t]),{setIsWidgetAreaOpen:o}=(0,d.useDispatch)($e),s=(0,l.useRef)(),c=(0,l.useCallback)((e=>o(t,e)),[t]),u=Xe(s),m=Qe(s),[g,h]=(0,l.useState)(!1);return(0,l.useEffect)((()=>{u?m&&!a?(c(!0),h(!0)):!m&&a&&g&&c(!1):h(!1)}),[a,u,m,g]),(0,l.createElement)(I.Panel,{className:r,ref:s},(0,l.createElement)(I.PanelBody,{title:i,opened:a,onToggle:()=>{o(t,!a)},scrollAfterOpen:!u},(e=>{let{opened:t}=e;return(0,l.createElement)(I.__unstableDisclosureContent,{className:"wp-block-widget-area__panel-body-content",visible:t},(0,l.createElement)(p.EntityProvider,{kind:"root",type:"postType",id:`widget-area-${n}`},(0,l.createElement)(Je,{id:n})))})))}};function rt(e){let{text:t,children:r}=e;const n=(0,ae.useCopyToClipboard)(t);return(0,l.createElement)(I.Button,{variant:"secondary",ref:n},r)}function nt(e){let{message:t,error:r}=e;const n=[(0,l.createElement)(rt,{key:"copy-error",text:r.stack},(0,b.__)("Copy Error"))];return(0,l.createElement)(de.Warning,{className:"edit-widgets-error-boundary",actions:n},t)}class it extends l.Component{constructor(){super(...arguments),this.state={error:null}}componentDidCatch(e){(0,Ye.doAction)("editor.ErrorBoundary.errorLogged",e)}static getDerivedStateFromError(e){return{error:e}}render(){return this.state.error?(0,l.createElement)(nt,{message:(0,b.__)("The editor has encountered an unexpected error."),error:this.state.error}):this.props.children}}var at=window.wp.reusableBlocks,ot=window.wp.keyboardShortcuts,st=window.wp.keycodes;function lt(){const{redo:e,undo:t}=(0,d.useDispatch)(p.store),{saveEditedWidgetAreas:r}=(0,d.useDispatch)($e);return(0,ot.useShortcut)("core/edit-widgets/undo",(e=>{t(),e.preventDefault()})),(0,ot.useShortcut)("core/edit-widgets/redo",(t=>{e(),t.preventDefault()})),(0,ot.useShortcut)("core/edit-widgets/save",(e=>{e.preventDefault(),r()})),null}lt.Register=function(){const{registerShortcut:e}=(0,d.useDispatch)(ot.store);return(0,l.useEffect)((()=>{e({name:"core/edit-widgets/undo",category:"global",description:(0,b.__)("Undo your last changes."),keyCombination:{modifier:"primary",character:"z"}}),e({name:"core/edit-widgets/redo",category:"global",description:(0,b.__)("Redo your last undo."),keyCombination:{modifier:"primaryShift",character:"z"},aliases:(0,st.isAppleOS)()?[]:[{modifier:"primary",character:"y"}]}),e({name:"core/edit-widgets/save",category:"global",description:(0,b.__)("Save your changes."),keyCombination:{modifier:"primary",character:"s"}}),e({name:"core/edit-widgets/keyboard-shortcuts",category:"main",description:(0,b.__)("Display these keyboard shortcuts."),keyCombination:{modifier:"access",character:"h"}}),e({name:"core/edit-widgets/next-region",category:"global",description:(0,b.__)("Navigate to the next part of the editor."),keyCombination:{modifier:"ctrl",character:"`"},aliases:[{modifier:"access",character:"n"}]}),e({name:"core/edit-widgets/previous-region",category:"global",description:(0,b.__)("Navigate to the previous part of the editor."),keyCombination:{modifier:"ctrlShift",character:"`"},aliases:[{modifier:"access",character:"p"},{modifier:"ctrlShift",character:"~"}]})}),[e]),null};var ct=lt;var dt=()=>(0,d.useSelect)((e=>{var t;const{getBlockSelectionEnd:r,getBlockName:n}=e(de.store),i=r();if("core/widget-area"===n(i))return i;const{getParentWidgetAreaBlock:a}=e($e),o=a(i),s=null==o?void 0:o.clientId;if(s)return s;const{getEntityRecord:l}=e(p.store),c=l(ge,he,"widget-areas");return null==c||null===(t=c.blocks[0])||void 0===t?void 0:t.clientId}),[]);var ut=window.wp.privateApis;const{lock:mt,unlock:gt}=(0,ut.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.","@wordpress/edit-widgets"),{ExperimentalBlockEditorProvider:pt}=gt(de.privateApis);function ht(e){let{blockEditorSettings:t,children:r,...n}=e;const i=(0,p.useResourcePermissions)("media"),{reusableBlocks:a,isFixedToolbarActive:o,keepCaretInsideBlock:s}=(0,d.useSelect)((e=>({widgetAreas:e($e).getWidgetAreas(),widgets:e($e).getWidgets(),reusableBlocks:[],isFixedToolbarActive:!!e(_.store).get("core/edit-widgets","fixedToolbar"),keepCaretInsideBlock:!!e(_.store).get("core/edit-widgets","keepCaretInsideBlock")})),[]),{setIsInserterOpened:c}=(0,d.useDispatch)($e),u=(0,l.useMemo)((()=>{let e;return i.canCreate&&(e=e=>{let{onError:r,...n}=e;(0,qe.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]),m=dt(),[g,h,w]=(0,p.useEntityBlockEditor)(ge,he,{id:"widget-areas"});return(0,l.createElement)(ot.ShortcutProvider,null,(0,l.createElement)(de.BlockEditorKeyboardShortcuts.Register,null),(0,l.createElement)(ct.Register,null),(0,l.createElement)(I.SlotFillProvider,null,(0,l.createElement)(pt,y({value:g,onInput:h,onChange:w,settings:u,useSubRegistry:!1},n),(0,l.createElement)(de.CopyHandler,null,r),(0,l.createElement)(at.ReusableBlocksMenuItems,{rootClientId:m}))))}var _t=(0,l.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(A.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 wt=(0,l.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(A.Path,{d:"M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z"})),ft=window.wp.url,Et=window.wp.dom;function bt(e){let{selectedWidgetAreaId:t}=e;const r=(0,d.useSelect)((e=>e($e).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,b.__)("Blocks in this Widget Area will not be displayed in your site."):n.description:(0,b.__)("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)(de.BlockIcon,{icon:wt}),(0,l.createElement)("div",null,(0,l.createElement)("p",{dangerouslySetInnerHTML:{__html:(0,Et.safeHTML)(i)}}),0===(null==r?void 0:r.length)&&(0,l.createElement)("p",null,(0,b.__)("Your theme does not contain any Widget Areas.")),!n&&(0,l.createElement)(I.Button,{href:(0,ft.addQueryArgs)("customize.php",{"autofocus[panel]":"widgets",return:window.location.pathname}),variant:"tertiary"},(0,b.__)("Manage with live preview")))))}const vt=l.Platform.select({web:!0,native:!1}),yt="edit-widgets/block-inspector",kt="edit-widgets/block-areas";function St(e){let{identifier:t,label:r,isActive:n}=e;const{enableComplementaryArea:i}=(0,d.useDispatch)(U);return(0,l.createElement)(I.Button,{onClick:()=>i($e.name,t),className:S()("edit-widgets-sidebar__panel-tab",{"is-active":n}),"aria-label":n?(0,b.sprintf)((0,b.__)("%s (selected)"),r):r,"data-label":r},r)}function It(){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(de.store),{getActiveComplementaryArea:i}=e(U),a=t(),o=i($e.name);let s,l=o;return l||(l=a?yt:kt),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===kt&&n&&e("core/edit-widgets",yt),!r&&t===yt&&n&&e("core/edit-widgets",kt)}),[r,e]),(0,l.createElement)(ie,{className:"edit-widgets-sidebar",header:(0,l.createElement)("ul",null,(0,l.createElement)("li",null,(0,l.createElement)(St,{identifier:kt,label:i?i.attributes.name:(0,b.__)("Widget Areas"),isActive:t===kt})),(0,l.createElement)("li",null,(0,l.createElement)(St,{identifier:yt,label:(0,b.__)("Block"),isActive:t===yt}))),headerClassName:"edit-widgets-sidebar__panel-tabs",title:(0,b.__)("Settings"),closeLabel:(0,b.__)("Close settings"),scope:"core/edit-widgets",identifier:t,icon:_t,isActiveByDefault:vt},t===kt&&(0,l.createElement)(bt,{selectedWidgetAreaId:null==i?void 0:i.attributes.id}),t===yt&&(r?(0,l.createElement)(de.BlockInspector,null):(0,l.createElement)("span",{className:"block-editor-block-inspector__no-blocks"},(0,b.__)("No block selected."))))}var At=(0,l.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(A.Path,{d:"M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"}));var Ct=(0,l.createElement)(A.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,l.createElement)(A.Path,{d:"M13.8 5.2H3v1.5h10.8V5.2zm-3.6 12v1.5H21v-1.5H10.2zm7.2-6H6.6v1.5h10.8v-1.5z"}));var Nt=function(){const{hasEditedWidgetAreaIds:e,isSaving:t}=(0,d.useSelect)((e=>{var t;const{getEditedWidgetAreas:r,isSavingWidgetAreas:n}=e($e);return{hasEditedWidgetAreaIds:(null===(t=r())||void 0===t?void 0:t.length)>0,isSaving:n()}}),[]),{saveEditedWidgetAreas:r}=(0,d.useDispatch)($e);return(0,l.createElement)(I.Button,{variant:"primary",isBusy:t,"aria-disabled":t,onClick:t?void 0:r,disabled:!e},t?(0,b.__)("Saving…"):(0,b.__)("Update"))};var Bt=(0,l.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(A.Path,{d:"M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z"}));var xt=(0,l.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(A.Path,{d:"M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z"}));function Wt(){const e=(0,d.useSelect)((e=>e(p.store).hasUndo()),[]),{undo:t}=(0,d.useDispatch)(p.store);return(0,l.createElement)(I.ToolbarButton,{icon:(0,b.isRTL)()?xt:Bt,label:(0,b.__)("Undo"),shortcut:st.displayShortcut.primary("z"),"aria-disabled":!e,onClick:e?t:void 0})}function Tt(){const e=(0,st.isAppleOS)()?st.displayShortcut.primaryShift("z"):st.displayShortcut.primary("y"),t=(0,d.useSelect)((e=>e(p.store).hasRedo()),[]),{redo:r}=(0,d.useDispatch)(p.store);return(0,l.createElement)(I.ToolbarButton,{icon:(0,b.isRTL)()?Bt:xt,label:(0,b.__)("Redo"),shortcut:e,"aria-disabled":!t,onClick:t?r:void 0})}var Lt=(0,l.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(A.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 Pt=[{keyCombination:{modifier:"primary",character:"b"},description:(0,b.__)("Make the selected text bold.")},{keyCombination:{modifier:"primary",character:"i"},description:(0,b.__)("Make the selected text italic.")},{keyCombination:{modifier:"primary",character:"k"},description:(0,b.__)("Convert the selected text into a link.")},{keyCombination:{modifier:"primaryShift",character:"k"},description:(0,b.__)("Remove a link.")},{keyCombination:{character:"[["},description:(0,b.__)("Insert a link to a post or page.")},{keyCombination:{modifier:"primary",character:"u"},description:(0,b.__)("Underline the selected text.")},{keyCombination:{modifier:"access",character:"d"},description:(0,b.__)("Strikethrough the selected text.")},{keyCombination:{modifier:"access",character:"x"},description:(0,b.__)("Make the selected text inline code.")}];function Rt(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 Ot=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)(Rt,{keyCombination:r,forceAriaLabel:i}),n.map(((e,t)=>(0,l.createElement)(Rt,{keyCombination:e,forceAriaLabel:i,key:t})))))};var Mt=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(ot.store);return{keyCombination:r(t),aliases:i(t),description:n(t)}}),[t]);return r?(0,l.createElement)(Ot,{keyCombination:r,description:n,aliases:i}):null};const Dt=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)(Mt,{name:e}):(0,l.createElement)(Ot,e)))))},Vt=e=>{let{title:t,shortcuts:r,className:n}=e;return(0,l.createElement)("section",{className:S()("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)(Dt,{shortcuts:r}))},Ft=e=>{let{title:t,categoryName:r,additionalShortcuts:n=[]}=e;const i=(0,d.useSelect)((e=>e(ot.store).getCategoryShortcuts(r)),[r]);return(0,l.createElement)(Vt,{title:t,shortcuts:i.concat(n)})};function Gt(e){let{isModalActive:t,toggleModal:r}=e;return(0,ot.useShortcut)("core/edit-widgets/keyboard-shortcuts",r,{bindGlobal:!0}),t?(0,l.createElement)(I.Modal,{className:"edit-widgets-keyboard-shortcut-help-modal",title:(0,b.__)("Keyboard shortcuts"),onRequestClose:r},(0,l.createElement)(Vt,{className:"edit-widgets-keyboard-shortcut-help-modal__main-shortcuts",shortcuts:["core/edit-widgets/keyboard-shortcuts"]}),(0,l.createElement)(Ft,{title:(0,b.__)("Global shortcuts"),categoryName:"global"}),(0,l.createElement)(Ft,{title:(0,b.__)("Selection shortcuts"),categoryName:"selection"}),(0,l.createElement)(Ft,{title:(0,b.__)("Block shortcuts"),categoryName:"block",additionalShortcuts:[{keyCombination:{character:"/"},description:(0,b.__)("Change the block type after adding a new paragraph."),ariaLabel:(0,b.__)("Forward-slash")}]}),(0,l.createElement)(Vt,{title:(0,b.__)("Text formatting"),shortcuts:Pt})):null}const{Fill:zt,Slot:Ht}=(0,I.createSlotFill)("EditWidgetsToolsMoreMenuGroup");zt.Slot=e=>{let{fillProps:t}=e;return(0,l.createElement)(Ht,{fillProps:t},(e=>e.length>0&&e))};var Ut=zt;function jt(){const[e,t]=(0,l.useState)(!1),r=()=>t(!e);(0,ot.useShortcut)("core/edit-widgets/keyboard-shortcuts",r);const n=(0,ae.useViewportMatch)("medium");return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(ce,null,(e=>(0,l.createElement)(l.Fragment,null,n&&(0,l.createElement)(I.MenuGroup,{label:(0,b._x)("View","noun")},(0,l.createElement)(_.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"fixedToolbar",label:(0,b.__)("Top toolbar"),info:(0,b.__)("Access all block and document tools in a single place"),messageActivated:(0,b.__)("Top toolbar activated"),messageDeactivated:(0,b.__)("Top toolbar deactivated")})),(0,l.createElement)(I.MenuGroup,{label:(0,b.__)("Tools")},(0,l.createElement)(I.MenuItem,{onClick:()=>{t(!0)},shortcut:st.displayShortcut.access("h")},(0,b.__)("Keyboard shortcuts")),(0,l.createElement)(_.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"welcomeGuide",label:(0,b.__)("Welcome Guide")}),(0,l.createElement)(I.MenuItem,{role:"menuitem",icon:Lt,href:(0,b.__)("https://wordpress.org/support/article/block-based-widgets-editor/"),target:"_blank",rel:"noopener noreferrer"},(0,b.__)("Help"),(0,l.createElement)(I.VisuallyHidden,{as:"span"},(0,b.__)("(opens in a new tab)"))),(0,l.createElement)(Ut.Slot,{fillProps:{onClose:e}})),(0,l.createElement)(I.MenuGroup,{label:(0,b.__)("Preferences")},(0,l.createElement)(_.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"keepCaretInsideBlock",label:(0,b.__)("Contain text cursor inside block"),info:(0,b.__)("Aids screen readers by stopping text caret from leaving blocks."),messageActivated:(0,b.__)("Contain text cursor inside block activated"),messageDeactivated:(0,b.__)("Contain text cursor inside block deactivated")}),(0,l.createElement)(_.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"themeStyles",info:(0,b.__)("Make the editor look like your theme."),label:(0,b.__)("Use theme styles")}),n&&(0,l.createElement)(_.PreferenceToggleMenuItem,{scope:"core/edit-widgets",name:"showBlockBreadcrumbs",label:(0,b.__)("Display block breadcrumbs"),info:(0,b.__)("Shows block breadcrumbs at the bottom of the editor."),messageActivated:(0,b.__)("Display block breadcrumbs activated"),messageDeactivated:(0,b.__)("Display block breadcrumbs deactivated")}))))),(0,l.createElement)(Gt,{isModalActive:e,toggleModal:r}))}var $t=function(){const e=(0,ae.useViewportMatch)("medium"),t=(0,l.useRef)(),r=dt(),n=(0,d.useSelect)((e=>e($e).getIsWidgetAreaOpen(r)),[r]),{isInserterOpen:i,isListViewOpen:a}=(0,d.useSelect)((e=>{const{isInserterOpened:t,isListViewOpened:r}=e($e);return{isInserterOpen:t(),isListViewOpen:r()}}),[]),{setIsWidgetAreaOpen:o,setIsInserterOpened:s,setIsListViewOpened:c}=(0,d.useDispatch)($e),{selectBlock:u}=(0,d.useDispatch)(de.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,b.__)("Widgets")),!e&&(0,l.createElement)(I.VisuallyHidden,{as:"h1",className:"edit-widgets-header__title"},(0,b.__)("Widgets")),(0,l.createElement)(de.NavigableToolbar,{className:"edit-widgets-header-toolbar","aria-label":(0,b.__)("Document tools")},(0,l.createElement)(I.ToolbarItem,{ref:t,as:I.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:At,label:(0,b._x)("Toggle block inserter","Generic label for block inserter button")}),e&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(Wt,null),(0,l.createElement)(Tt,null),(0,l.createElement)(I.ToolbarItem,{as:I.Button,className:"edit-widgets-header-toolbar__list-view-toggle",icon:Ct,isPressed:a,label:(0,b.__)("List View"),onClick:m})))),(0,l.createElement)("div",{className:"edit-widgets-header__actions"},(0,l.createElement)(Nt,null),(0,l.createElement)(te.Slot,{scope:"core/edit-widgets"}),(0,l.createElement)(jt,null))))};var Yt=function(){const{removeNotice:e}=(0,d.useDispatch)(v.store),{notices:t}=(0,d.useSelect)((e=>({notices:e(v.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)(I.NoticeList,{notices:n,className:"edit-widgets-notices__pinned"}),(0,l.createElement)(I.NoticeList,{notices:r,className:"edit-widgets-notices__dismissible",onRemove:e}),(0,l.createElement)(I.SnackbarList,{notices:i,className:"edit-widgets-notices__snackbar",onRemove:e}))};function Kt(e){let{blockEditorSettings:t}=e;const r=(0,d.useSelect)((e=>!!e(_.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)(Yt,null),(0,l.createElement)(de.BlockTools,null,(0,l.createElement)(ct,null),(0,l.createElement)(de.__unstableEditorStyles,{styles:n}),(0,l.createElement)(de.BlockSelectionClearer,null,(0,l.createElement)(de.WritingFlow,null,(0,l.createElement)(de.ObserveTyping,null,(0,l.createElement)(de.BlockList,{className:"edit-widgets-main-block-list"}))))))}var qt=(0,l.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,l.createElement)(A.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"}));var Qt=()=>{const e=(0,d.useSelect)((e=>{var t;const{getEntityRecord:r}=e(p.store),n=r(ge,he,"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(de.store),o=t($e).__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}=Qt(),{setIsInserterOpened:n}=(0,d.useDispatch)($e),i=(0,l.useCallback)((()=>n(!1)),[n]),a=e?"div":I.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",y({ref:o},s,{className:"edit-widgets-layout__inserter-panel"}),(0,l.createElement)(a,{className:"edit-widgets-layout__inserter-panel-header"},(0,l.createElement)(I.Button,{icon:qt,onClick:i,label:(0,b.__)("Close block inserter")})),(0,l.createElement)("div",{className:"edit-widgets-layout__inserter-panel-content"},(0,l.createElement)(de.__experimentalLibrary,{showInserterHelpPanel:!0,shouldFocusBlock:e,rootClientId:t,__experimentalInsertionIndex:r,ref:c})))}function Xt(){const{setIsListViewOpened:e}=(0,d.useDispatch)($e),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)(Xt)}`;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,b.__)("List View")),(0,l.createElement)(I.Button,{icon:W,label:(0,b.__)("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)(de.__experimentalListView,null)))}function Zt(){const{isInserterOpen:e,isListViewOpen:t}=(0,d.useSelect)((e=>{const{isInserterOpened:t,isListViewOpened:r}=e($e);return{isInserterOpen:t(),isListViewOpen:r()}}),[]);return e?(0,l.createElement)(Jt,null):t?(0,l.createElement)(Xt,null):null}const er={header:(0,b.__)("Widgets top bar"),body:(0,b.__)("Widgets and blocks"),sidebar:(0,b.__)("Widgets settings"),footer:(0,b.__)("Widgets footer")};var tr=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)($e),{hasBlockBreadCrumbsEnabled:s,hasSidebarEnabled:c,isInserterOpened:u,isListViewOpened:m,previousShortcut:g,nextShortcut:p}=(0,d.useSelect)((e=>({hasSidebarEnabled:!!e(U).getActiveComplementaryArea($e.name),isInserterOpened:!!e($e).isInserterOpened(),isListViewOpened:!!e($e).isListViewOpened(),hasBlockBreadCrumbsEnabled:!!e(_.store).get("core/edit-widgets","showBlockBreadcrumbs"),previousShortcut:e(ot.store).getAllShortcutKeyCombinations("core/edit-widgets/previous-region"),nextShortcut:e(ot.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 h=m?(0,b.__)("List View"):(0,b.__)("Block Library"),w=m||u;return(0,l.createElement)(se,{labels:{...er,secondarySidebar:h},header:(0,l.createElement)($t,null),secondarySidebar:w&&(0,l.createElement)(Zt,null),sidebar:c&&(0,l.createElement)(ie.Slot,{scope:"core/edit-widgets"}),content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)(Kt,{blockEditorSettings:t})),footer:s&&!r&&(0,l.createElement)("div",{className:"edit-widgets-layout__footer"},(0,l.createElement)(de.BlockBreadcrumb,{rootLabelText:(0,b.__)("Widgets")})),shortcuts:{previous:g,next:p}})};function rr(){const e=(0,d.useSelect)((e=>{const{getEditedWidgetAreas:t}=e($e),r=t();return(null==r?void 0:r.length)>0}),[]);return(0,l.useEffect)((()=>{const t=t=>{if(e)return t.returnValue=(0,b.__)("You have unsaved changes. If you proceed, they will be lost."),t.returnValue};return window.addEventListener("beforeunload",t),()=>{window.removeEventListener("beforeunload",t)}}),[e]),null}function nr(){var e;const t=(0,d.useSelect)((e=>!!e(_.store).get("core/edit-widgets","welcomeGuide")),[]),{toggle:r}=(0,d.useDispatch)(_.store),n=(0,d.useSelect)((e=>e($e).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)(I.Guide,{className:"edit-widgets-welcome-guide",contentLabel:(0,b.__)("Welcome to block Widgets"),finishButtonText:(0,b.__)("Get started"),onFinish:()=>r("core/edit-widgets","welcomeGuide"),pages:[{image:(0,l.createElement)(ir,{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,b.__)("Welcome to block Widgets")),i?(0,l.createElement)(l.Fragment,null,(0,l.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,b.sprintf)((0,b._n)("Your theme provides %s “block” area for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how 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,b.__)("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,b.__)("Want to stick with the old widgets?"))," ",(0,l.createElement)(I.ExternalLink,{href:(0,b.__)("https://wordpress.org/plugins/classic-widgets/")},(0,b.__)("Get the Classic Widgets plugin.")))))},{image:(0,l.createElement)(ir,{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,b.__)("Make each block your own")),(0,l.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,b.__)("Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected.")))},{image:(0,l.createElement)(ir,{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,b.__)("Get to know the block library")),(0,l.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,l.createInterpolateElement)((0,b.__)("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,b.__)("inserter"),src:"data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='2' fill='%231E1E1E'/%3E%3Cpath d='M9.22727 4V14M4 8.77273H14' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E%0A"})})))},{image:(0,l.createElement)(ir,{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,b.__)("Learn how to use the block editor")),(0,l.createElement)("p",{className:"edit-widgets-welcome-guide__text"},(0,b.__)("New to the block editor? Want to learn more about using it? "),(0,l.createElement)(I.ExternalLink,{href:(0,b.__)("https://wordpress.org/support/article/wordpress-editor/")},(0,b.__)("Here's a detailed guide."))))}]})}function ir(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 ar=function(e){let{blockEditorSettings:t}=e;const{createErrorNotice:r}=(0,d.useDispatch)(v.store);return(0,l.createElement)(it,null,(0,l.createElement)(ht,{blockEditorSettings:t},(0,l.createElement)(tr,{blockEditorSettings:t}),(0,l.createElement)(It,null),(0,l.createElement)(I.Popover.Slot,null),(0,l.createElement)(j.PluginArea,{onError:function(e){r((0,b.sprintf)((0,b.__)('The "%s" plugin has encountered an error and cannot be rendered.'),e))}}),(0,l.createElement)(rr,null),(0,l.createElement)(nr,null)))};const or=["core/more","core/freeform","core/template-part","core/block"];function sr(e,t){const r=document.getElementById(e),n=(0,l.createRoot)(r),i=(0,g.__experimentalGetCoreBlocks)().filter((e=>!(or.includes(e.name)||e.name.startsWith("core/post")||e.name.startsWith("core/query")||e.name.startsWith("core/site")||e.name.startsWith("core/navigation"))));return(0,d.dispatch)(_.store).setDefaults("core/edit-widgets",{fixedToolbar:!1,welcomeGuide:!0,showBlockBreadcrumbs:!0,themeStyles:!0}),(0,d.dispatch)(c.store).__experimentalReapplyBlockTypeFilters(),(0,g.registerCoreBlocks)(i),(0,h.registerLegacyWidgetBlock)(),(0,h.registerLegacyWidgetVariations)(t),dr(s),(0,h.registerWidgetGroupBlock)(),t.__experimentalFetchLinkSuggestions=(e,r)=>(0,p.__experimentalFetchLinkSuggestions)(e,r,t),(0,c.setFreeformContentHandlerName)("core/html"),n.render((0,l.createElement)(ar,{blockEditorSettings:t})),n}const lr=sr;function cr(){m()("wp.editWidgets.reinitializeEditor",{since:"6.2",version:"6.3"})}const dr=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}();