From fc0a79914946dac00ccd51b1aacffe267de7210e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 19 Sep 2024 06:51:22 +0200 Subject: Merging upstream version 6.6.1+dfsg1. Signed-off-by: Daniel Baumann --- wp-includes/js/dist/annotations.js | 304 +- wp-includes/js/dist/annotations.min.js | 2 +- wp-includes/js/dist/block-directory.js | 546 +- wp-includes/js/dist/block-directory.min.js | 2 +- wp-includes/js/dist/block-editor.js | 33117 +++++----- wp-includes/js/dist/block-editor.min.js | 24 +- wp-includes/js/dist/block-library.js | 26165 ++++---- wp-includes/js/dist/block-library.min.js | 14 +- wp-includes/js/dist/blocks.js | 759 +- wp-includes/js/dist/blocks.min.js | 4 +- wp-includes/js/dist/commands.js | 579 +- wp-includes/js/dist/commands.min.js | 7 +- wp-includes/js/dist/components.js | 23166 +++---- wp-includes/js/dist/components.min.js | 26 +- wp-includes/js/dist/compose.js | 189 +- wp-includes/js/dist/compose.min.js | 2 +- wp-includes/js/dist/core-commands.js | 447 +- wp-includes/js/dist/core-commands.min.js | 2 +- wp-includes/js/dist/core-data.js | 747 +- wp-includes/js/dist/core-data.min.js | 2 +- wp-includes/js/dist/customize-widgets.js | 1408 +- wp-includes/js/dist/customize-widgets.min.js | 7 +- wp-includes/js/dist/data.js | 96 +- wp-includes/js/dist/data.min.js | 4 +- wp-includes/js/dist/dom.js | 68 +- wp-includes/js/dist/edit-post.js | 8571 +-- wp-includes/js/dist/edit-post.min.js | 7 +- wp-includes/js/dist/edit-site.js | 60916 +++++++++---------- wp-includes/js/dist/edit-site.min.js | 30 +- wp-includes/js/dist/edit-widgets.js | 2138 +- wp-includes/js/dist/edit-widgets.min.js | 7 +- wp-includes/js/dist/editor.js | 30134 ++++++--- wp-includes/js/dist/editor.min.js | 14 +- wp-includes/js/dist/element.js | 4 +- wp-includes/js/dist/format-library.js | 971 +- wp-includes/js/dist/format-library.min.js | 2 +- wp-includes/js/dist/html-entities.js | 2 + wp-includes/js/dist/interactivity-router.asset.php | 2 +- wp-includes/js/dist/interactivity-router.js | 144 +- .../js/dist/interactivity-router.min.asset.php | 2 +- wp-includes/js/dist/interactivity-router.min.js | 2 +- wp-includes/js/dist/interactivity.js | 576 +- wp-includes/js/dist/interactivity.min.js | 2 +- wp-includes/js/dist/keyboard-shortcuts.js | 353 +- wp-includes/js/dist/keyboard-shortcuts.min.js | 2 +- wp-includes/js/dist/list-reusable-blocks.js | 67 +- wp-includes/js/dist/list-reusable-blocks.min.js | 2 +- wp-includes/js/dist/nux.js | 350 +- wp-includes/js/dist/nux.min.js | 2 +- wp-includes/js/dist/patterns.js | 966 +- wp-includes/js/dist/patterns.min.js | 2 +- wp-includes/js/dist/plugins.js | 71 +- wp-includes/js/dist/plugins.min.js | 2 +- wp-includes/js/dist/preferences-persistence.js | 12 +- wp-includes/js/dist/preferences-persistence.min.js | 2 +- wp-includes/js/dist/preferences.js | 254 +- wp-includes/js/dist/preferences.min.js | 2 +- wp-includes/js/dist/primitives.js | 125 +- wp-includes/js/dist/primitives.min.js | 7 +- wp-includes/js/dist/private-apis.js | 2 +- wp-includes/js/dist/private-apis.min.js | 2 +- wp-includes/js/dist/redux-routine.js | 4 +- wp-includes/js/dist/redux-routine.min.js | 2 +- wp-includes/js/dist/reusable-blocks.js | 174 +- wp-includes/js/dist/reusable-blocks.min.js | 2 +- wp-includes/js/dist/rich-text.js | 1255 +- wp-includes/js/dist/rich-text.min.js | 2 +- wp-includes/js/dist/router.js | 84 +- wp-includes/js/dist/router.min.js | 2 +- wp-includes/js/dist/server-side-render.js | 113 +- wp-includes/js/dist/server-side-render.min.js | 2 +- wp-includes/js/dist/style-engine.js | 46 +- wp-includes/js/dist/style-engine.min.js | 2 +- wp-includes/js/dist/url.js | 11 +- wp-includes/js/dist/url.min.js | 2 +- wp-includes/js/dist/vendor/react-dom.js | 29965 +-------- wp-includes/js/dist/vendor/react-dom.min.js | 12 +- .../js/dist/vendor/react-dom.min.js.LICENSE.txt | 19 + wp-includes/js/dist/vendor/react-jsx-runtime.js | 78 + .../js/dist/vendor/react-jsx-runtime.min.js | 2 + .../vendor/react-jsx-runtime.min.js.LICENSE.txt | 9 + wp-includes/js/dist/vendor/react.js | 3421 +- wp-includes/js/dist/vendor/react.min.js | 12 +- .../js/dist/vendor/react.min.js.LICENSE.txt | 9 + wp-includes/js/dist/viewport.js | 8 +- wp-includes/js/dist/viewport.min.js | 2 +- wp-includes/js/dist/warning.js | 3 +- wp-includes/js/dist/widgets.js | 616 +- wp-includes/js/dist/widgets.min.js | 7 +- 89 files changed, 101894 insertions(+), 127404 deletions(-) create mode 100644 wp-includes/js/dist/vendor/react-dom.min.js.LICENSE.txt create mode 100644 wp-includes/js/dist/vendor/react-jsx-runtime.js create mode 100644 wp-includes/js/dist/vendor/react-jsx-runtime.min.js create mode 100644 wp-includes/js/dist/vendor/react-jsx-runtime.min.js.LICENSE.txt create mode 100644 wp-includes/js/dist/vendor/react.min.js.LICENSE.txt (limited to 'wp-includes/js/dist') diff --git a/wp-includes/js/dist/annotations.js b/wp-includes/js/dist/annotations.js index fb2becc..6aaf60e 100644 --- a/wp-includes/js/dist/annotations.js +++ b/wp-includes/js/dist/annotations.js @@ -402,307 +402,9 @@ function annotations(state = {}, action) { } /* harmony default export */ const reducer = (annotations); -;// CONCATENATED MODULE: ./node_modules/rememo/rememo.js - - -/** @typedef {(...args: any[]) => *[]} GetDependants */ - -/** @typedef {() => void} Clear */ - -/** - * @typedef {{ - * getDependants: GetDependants, - * clear: Clear - * }} EnhancedSelector - */ - -/** - * Internal cache entry. - * - * @typedef CacheNode - * - * @property {?CacheNode|undefined} [prev] Previous node. - * @property {?CacheNode|undefined} [next] Next node. - * @property {*[]} args Function arguments for cache entry. - * @property {*} val Function result. - */ - -/** - * @typedef Cache - * - * @property {Clear} clear Function to clear cache. - * @property {boolean} [isUniqueByDependants] Whether dependants are valid in - * considering cache uniqueness. A cache is unique if dependents are all arrays - * or objects. - * @property {CacheNode?} [head] Cache head. - * @property {*[]} [lastDependants] Dependants from previous invocation. - */ - -/** - * Arbitrary value used as key for referencing cache object in WeakMap tree. - * - * @type {{}} - */ -var LEAF_KEY = {}; - -/** - * Returns the first argument as the sole entry in an array. - * - * @template T - * - * @param {T} value Value to return. - * - * @return {[T]} Value returned as entry in array. - */ -function arrayOf(value) { - return [value]; -} - -/** - * Returns true if the value passed is object-like, or false otherwise. A value - * is object-like if it can support property assignment, e.g. object or array. - * - * @param {*} value Value to test. - * - * @return {boolean} Whether value is object-like. - */ -function isObjectLike(value) { - return !!value && 'object' === typeof value; -} - -/** - * Creates and returns a new cache object. - * - * @return {Cache} Cache object. - */ -function createCache() { - /** @type {Cache} */ - var cache = { - clear: function () { - cache.head = null; - }, - }; - - return cache; -} - -/** - * Returns true if entries within the two arrays are strictly equal by - * reference from a starting index. - * - * @param {*[]} a First array. - * @param {*[]} b Second array. - * @param {number} fromIndex Index from which to start comparison. - * - * @return {boolean} Whether arrays are shallowly equal. - */ -function isShallowEqual(a, b, fromIndex) { - var i; - - if (a.length !== b.length) { - return false; - } - - for (i = fromIndex; i < a.length; i++) { - if (a[i] !== b[i]) { - return false; - } - } - - return true; -} - -/** - * Returns a memoized selector function. The getDependants function argument is - * called before the memoized selector and is expected to return an immutable - * reference or array of references on which the selector depends for computing - * its own return value. The memoize cache is preserved only as long as those - * dependant references remain the same. If getDependants returns a different - * reference(s), the cache is cleared and the selector value regenerated. - * - * @template {(...args: *[]) => *} S - * - * @param {S} selector Selector function. - * @param {GetDependants=} getDependants Dependant getter returning an array of - * references used in cache bust consideration. - */ -/* harmony default export */ function rememo(selector, getDependants) { - /** @type {WeakMap<*,*>} */ - var rootCache; - - /** @type {GetDependants} */ - var normalizedGetDependants = getDependants ? getDependants : arrayOf; - - /** - * Returns the cache for a given dependants array. When possible, a WeakMap - * will be used to create a unique cache for each set of dependants. This - * is feasible due to the nature of WeakMap in allowing garbage collection - * to occur on entries where the key object is no longer referenced. Since - * WeakMap requires the key to be an object, this is only possible when the - * dependant is object-like. The root cache is created as a hierarchy where - * each top-level key is the first entry in a dependants set, the value a - * WeakMap where each key is the next dependant, and so on. This continues - * so long as the dependants are object-like. If no dependants are object- - * like, then the cache is shared across all invocations. - * - * @see isObjectLike - * - * @param {*[]} dependants Selector dependants. - * - * @return {Cache} Cache object. - */ - function getCache(dependants) { - var caches = rootCache, - isUniqueByDependants = true, - i, - dependant, - map, - cache; - - for (i = 0; i < dependants.length; i++) { - dependant = dependants[i]; - - // Can only compose WeakMap from object-like key. - if (!isObjectLike(dependant)) { - isUniqueByDependants = false; - break; - } - - // Does current segment of cache already have a WeakMap? - if (caches.has(dependant)) { - // Traverse into nested WeakMap. - caches = caches.get(dependant); - } else { - // Create, set, and traverse into a new one. - map = new WeakMap(); - caches.set(dependant, map); - caches = map; - } - } - - // We use an arbitrary (but consistent) object as key for the last item - // in the WeakMap to serve as our running cache. - if (!caches.has(LEAF_KEY)) { - cache = createCache(); - cache.isUniqueByDependants = isUniqueByDependants; - caches.set(LEAF_KEY, cache); - } - - return caches.get(LEAF_KEY); - } - - /** - * Resets root memoization cache. - */ - function clear() { - rootCache = new WeakMap(); - } - - /* eslint-disable jsdoc/check-param-names */ - /** - * The augmented selector call, considering first whether dependants have - * changed before passing it to underlying memoize function. - * - * @param {*} source Source object for derivation. - * @param {...*} extraArgs Additional arguments to pass to selector. - * - * @return {*} Selector result. - */ - /* eslint-enable jsdoc/check-param-names */ - function callSelector(/* source, ...extraArgs */) { - var len = arguments.length, - cache, - node, - i, - args, - dependants; - - // Create copy of arguments (avoid leaking deoptimization). - args = new Array(len); - for (i = 0; i < len; i++) { - args[i] = arguments[i]; - } - - dependants = normalizedGetDependants.apply(null, args); - cache = getCache(dependants); - - // If not guaranteed uniqueness by dependants (primitive type), shallow - // compare against last dependants and, if references have changed, - // destroy cache to recalculate result. - if (!cache.isUniqueByDependants) { - if ( - cache.lastDependants && - !isShallowEqual(dependants, cache.lastDependants, 0) - ) { - cache.clear(); - } - - cache.lastDependants = dependants; - } - - node = cache.head; - while (node) { - // Check whether node arguments match arguments - if (!isShallowEqual(node.args, args, 1)) { - node = node.next; - continue; - } - - // At this point we can assume we've found a match - - // Surface matched node to head if not already - if (node !== cache.head) { - // Adjust siblings to point to each other. - /** @type {CacheNode} */ (node.prev).next = node.next; - if (node.next) { - node.next.prev = node.prev; - } - - node.next = cache.head; - node.prev = null; - /** @type {CacheNode} */ (cache.head).prev = node; - cache.head = node; - } - - // Return immediately - return node.val; - } - - // No cached value found. Continue to insertion phase: - - node = /** @type {CacheNode} */ ({ - // Generate the result from original function - val: selector.apply(null, args), - }); - - // Avoid including the source object in the cache. - args[0] = null; - node.args = args; - - // Don't need to check whether node is already head, since it would - // have been returned above already if it was - - // Shift existing head down list - if (cache.head) { - cache.head.prev = node; - node.next = cache.head; - } - - cache.head = node; - - return node.val; - } - - callSelector.getDependants = normalizedGetDependants; - callSelector.clear = clear; - clear(); - - return /** @type {S & EnhancedSelector} */ (callSelector); -} - ;// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/store/selectors.js /** - * External dependencies + * WordPress dependencies */ @@ -725,7 +427,7 @@ const EMPTY_ARRAY = []; * * @return {Array} The annotations applicable to this block. */ -const __experimentalGetAnnotationsForBlock = rememo((state, blockClientId) => { +const __experimentalGetAnnotationsForBlock = (0,external_wp_data_namespaceObject.createSelector)((state, blockClientId) => { var _state$blockClientId; return ((_state$blockClientId = state?.[blockClientId]) !== null && _state$blockClientId !== void 0 ? _state$blockClientId : []).filter(annotation => { return annotation.selector === 'block'; @@ -751,7 +453,7 @@ function __experimentalGetAllAnnotationsForBlock(state, blockClientId) { * @param {string} richTextIdentifier Unique identifier that identifies the given RichText. * @return {Array} All the annotations relevant for the `RichText`. */ -const __experimentalGetAnnotationsForRichText = rememo((state, blockClientId, richTextIdentifier) => { +const __experimentalGetAnnotationsForRichText = (0,external_wp_data_namespaceObject.createSelector)((state, blockClientId, richTextIdentifier) => { var _state$blockClientId4; return ((_state$blockClientId4 = state?.[blockClientId]) !== null && _state$blockClientId4 !== void 0 ? _state$blockClientId4 : []).filter(annotation => { return annotation.selector === 'range' && richTextIdentifier === annotation.richTextIdentifier; diff --git a/wp-includes/js/dist/annotations.min.js b/wp-includes/js/dist/annotations.min.js index 8661d7f..8af9556 100644 --- a/wp-includes/js/dist/annotations.min.js +++ b/wp-includes/js/dist/annotations.min.js @@ -1,2 +1,2 @@ /*! This file is auto-generated */ -(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{store:()=>G});var n={};e.r(n),e.d(n,{__experimentalGetAllAnnotationsForBlock:()=>N,__experimentalGetAnnotations:()=>O,__experimentalGetAnnotationsForBlock:()=>T,__experimentalGetAnnotationsForRichText:()=>b});var r={};e.r(r),e.d(r,{__experimentalAddAnnotation:()=>S,__experimentalRemoveAnnotation:()=>C,__experimentalRemoveAnnotationsBySource:()=>F,__experimentalUpdateAnnotationRange:()=>P});const o=window.wp.richText,a=window.wp.i18n,i="core/annotations",l="core/annotation",c="annotation-text-";const s={name:l,title:(0,a.__)("Annotation"),tagName:"mark",className:"annotation-text",attributes:{className:"class",id:"id"},edit:()=>null,__experimentalGetPropsForEditableTreePreparation:(e,{richTextIdentifier:t,blockClientId:n})=>({annotations:e(i).__experimentalGetAnnotationsForRichText(n,t)}),__experimentalCreatePrepareEditableTree:({annotations:e})=>(t,n)=>{if(0===e.length)return t;let r={formats:t,text:n};return r=function(e,t=[]){return t.forEach((t=>{let{start:n,end:r}=t;n>e.text.length&&(n=e.text.length),r>e.text.length&&(r=e.text.length);const a=c+t.source,i=c+t.id;e=(0,o.applyFormat)(e,{type:l,attributes:{className:a,id:i}},n,r)})),e}(r,e),r.formats},__experimentalGetPropsForEditableTreeChangeHandler:e=>({removeAnnotation:e(i).__experimentalRemoveAnnotation,updateAnnotationRange:e(i).__experimentalUpdateAnnotationRange}),__experimentalCreateOnChangeEditableValue:e=>t=>{const n=function(e){const t={};return e.forEach(((e,n)=>{(e=(e=e||[]).filter((e=>e.type===l))).forEach((e=>{let{id:r}=e.attributes;r=r.replace(c,""),t.hasOwnProperty(r)||(t[r]={start:n}),t[r].end=n+1}))})),t}(t),{removeAnnotation:r,updateAnnotationRange:o,annotations:a}=e;!function(e,t,{removeAnnotation:n,updateAnnotationRange:r}){e.forEach((e=>{const o=t[e.id];if(!o)return void n(e.id);const{start:a,end:i}=e;a===o.start&&i===o.end||r(e.id,o.start,o.end)}))}(a,n,{removeAnnotation:r,updateAnnotationRange:o})}},{name:u,...d}=s;(0,o.registerFormatType)(u,d);const p=window.wp.hooks,f=window.wp.data;function m(e,t){const n=e.filter(t);return e.length===n.length?e:n}(0,p.addFilter)("editor.BlockListBlock","core/annotations",(e=>(0,f.withSelect)(((e,{clientId:t,className:n})=>({className:e(i).__experimentalGetAnnotationsForBlock(t).map((e=>"is-annotated-by-"+e.source)).concat(n).filter(Boolean).join(" ")})))(e)));const g=(e,t)=>Object.entries(e).reduce(((e,[n,r])=>({...e,[n]:t(r)})),{});const h=function(e={},t){var n;switch(t.type){case"ANNOTATION_ADD":const r=t.blockClientId,o={id:t.id,blockClientId:r,richTextIdentifier:t.richTextIdentifier,source:t.source,selector:t.selector,range:t.range};if("range"===o.selector&&!function(e){return"number"==typeof e.start&&"number"==typeof e.end&&e.start<=e.end}(o.range))return e;const a=null!==(n=e?.[r])&&void 0!==n?n:[];return{...e,[r]:[...a,o]};case"ANNOTATION_REMOVE":return g(e,(e=>m(e,(e=>e.id!==t.annotationId))));case"ANNOTATION_UPDATE_RANGE":return g(e,(e=>{let n=!1;const r=e.map((e=>e.id===t.annotationId?(n=!0,{...e,range:{start:t.start,end:t.end}}):e));return n?r:e}));case"ANNOTATION_REMOVE_SOURCE":return g(e,(e=>m(e,(e=>e.source!==t.source))))}return e};var _={};function A(e){return[e]}function v(e,t,n){var r;if(e.length!==t.length)return!1;for(r=n;r{var n;return(null!==(n=e?.[t])&&void 0!==n?n:[]).filter((e=>"block"===e.selector))}),((e,t)=>{var n;return[null!==(n=e?.[t])&&void 0!==n?n:x]}));function N(e,t){var n;return null!==(n=e?.[t])&&void 0!==n?n:x}const b=y(((e,t,n)=>{var r;return(null!==(r=e?.[t])&&void 0!==r?r:[]).filter((e=>"range"===e.selector&&n===e.richTextIdentifier)).map((e=>{const{range:t,...n}=e;return{...t,...n}}))}),((e,t)=>{var n;return[null!==(n=e?.[t])&&void 0!==n?n:x]}));function O(e){return Object.values(e).flat()}const I={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let w;const E=new Uint8Array(16);function R(){if(!w&&(w="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!w))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return w(E)}const U=[];for(let e=0;e<256;++e)U.push((e+256).toString(16).slice(1));function D(e,t=0){return U[e[t+0]]+U[e[t+1]]+U[e[t+2]]+U[e[t+3]]+"-"+U[e[t+4]]+U[e[t+5]]+"-"+U[e[t+6]]+U[e[t+7]]+"-"+U[e[t+8]]+U[e[t+9]]+"-"+U[e[t+10]]+U[e[t+11]]+U[e[t+12]]+U[e[t+13]]+U[e[t+14]]+U[e[t+15]]}const k=function(e,t,n){if(I.randomUUID&&!t&&!e)return I.randomUUID();const r=(e=e||{}).random||(e.rng||R)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=r[e];return t}return D(r)};function S({blockClientId:e,richTextIdentifier:t=null,range:n=null,selector:r="range",source:o="default",id:a=k()}){const i={type:"ANNOTATION_ADD",id:a,blockClientId:e,richTextIdentifier:t,source:o,selector:r};return"range"===r&&(i.range=n),i}function C(e){return{type:"ANNOTATION_REMOVE",annotationId:e}}function P(e,t,n){return{type:"ANNOTATION_UPDATE_RANGE",annotationId:e,start:t,end:n}}function F(e){return{type:"ANNOTATION_REMOVE_SOURCE",source:e}}const G=(0,f.createReduxStore)(i,{reducer:h,selectors:n,actions:r});(0,f.register)(G),(window.wp=window.wp||{}).annotations=t})(); \ No newline at end of file +(()=>{"use strict";var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{store:()=>C});var n={};t.r(n),t.d(n,{__experimentalGetAllAnnotationsForBlock:()=>x,__experimentalGetAnnotations:()=>N,__experimentalGetAnnotationsForBlock:()=>y,__experimentalGetAnnotationsForRichText:()=>T});var r={};t.r(r),t.d(r,{__experimentalAddAnnotation:()=>R,__experimentalRemoveAnnotation:()=>U,__experimentalRemoveAnnotationsBySource:()=>k,__experimentalUpdateAnnotationRange:()=>S});const o=window.wp.richText,a=window.wp.i18n,i="core/annotations",c="core/annotation",l="annotation-text-";const s={name:c,title:(0,a.__)("Annotation"),tagName:"mark",className:"annotation-text",attributes:{className:"class",id:"id"},edit:()=>null,__experimentalGetPropsForEditableTreePreparation:(t,{richTextIdentifier:e,blockClientId:n})=>({annotations:t(i).__experimentalGetAnnotationsForRichText(n,e)}),__experimentalCreatePrepareEditableTree:({annotations:t})=>(e,n)=>{if(0===t.length)return e;let r={formats:e,text:n};return r=function(t,e=[]){return e.forEach((e=>{let{start:n,end:r}=e;n>t.text.length&&(n=t.text.length),r>t.text.length&&(r=t.text.length);const a=l+e.source,i=l+e.id;t=(0,o.applyFormat)(t,{type:c,attributes:{className:a,id:i}},n,r)})),t}(r,t),r.formats},__experimentalGetPropsForEditableTreeChangeHandler:t=>({removeAnnotation:t(i).__experimentalRemoveAnnotation,updateAnnotationRange:t(i).__experimentalUpdateAnnotationRange}),__experimentalCreateOnChangeEditableValue:t=>e=>{const n=function(t){const e={};return t.forEach(((t,n)=>{(t=(t=t||[]).filter((t=>t.type===c))).forEach((t=>{let{id:r}=t.attributes;r=r.replace(l,""),e.hasOwnProperty(r)||(e[r]={start:n}),e[r].end=n+1}))})),e}(e),{removeAnnotation:r,updateAnnotationRange:o,annotations:a}=t;!function(t,e,{removeAnnotation:n,updateAnnotationRange:r}){t.forEach((t=>{const o=e[t.id];if(!o)return void n(t.id);const{start:a,end:i}=t;a===o.start&&i===o.end||r(t.id,o.start,o.end)}))}(a,n,{removeAnnotation:r,updateAnnotationRange:o})}},{name:d,...u}=s;(0,o.registerFormatType)(d,u);const p=window.wp.hooks,m=window.wp.data;function f(t,e){const n=t.filter(e);return t.length===n.length?t:n}(0,p.addFilter)("editor.BlockListBlock","core/annotations",(t=>(0,m.withSelect)(((t,{clientId:e,className:n})=>({className:t(i).__experimentalGetAnnotationsForBlock(e).map((t=>"is-annotated-by-"+t.source)).concat(n).filter(Boolean).join(" ")})))(t)));const _=(t,e)=>Object.entries(t).reduce(((t,[n,r])=>({...t,[n]:e(r)})),{});const A=function(t={},e){var n;switch(e.type){case"ANNOTATION_ADD":const r=e.blockClientId,o={id:e.id,blockClientId:r,richTextIdentifier:e.richTextIdentifier,source:e.source,selector:e.selector,range:e.range};if("range"===o.selector&&!function(t){return"number"==typeof t.start&&"number"==typeof t.end&&t.start<=t.end}(o.range))return t;const a=null!==(n=t?.[r])&&void 0!==n?n:[];return{...t,[r]:[...a,o]};case"ANNOTATION_REMOVE":return _(t,(t=>f(t,(t=>t.id!==e.annotationId))));case"ANNOTATION_UPDATE_RANGE":return _(t,(t=>{let n=!1;const r=t.map((t=>t.id===e.annotationId?(n=!0,{...t,range:{start:e.start,end:e.end}}):t));return n?r:t}));case"ANNOTATION_REMOVE_SOURCE":return _(t,(t=>f(t,(t=>t.source!==e.source))))}return t},g=[],y=(0,m.createSelector)(((t,e)=>{var n;return(null!==(n=t?.[e])&&void 0!==n?n:[]).filter((t=>"block"===t.selector))}),((t,e)=>{var n;return[null!==(n=t?.[e])&&void 0!==n?n:g]}));function x(t,e){var n;return null!==(n=t?.[e])&&void 0!==n?n:g}const T=(0,m.createSelector)(((t,e,n)=>{var r;return(null!==(r=t?.[e])&&void 0!==r?r:[]).filter((t=>"range"===t.selector&&n===t.richTextIdentifier)).map((t=>{const{range:e,...n}=t;return{...e,...n}}))}),((t,e)=>{var n;return[null!==(n=t?.[e])&&void 0!==n?n:g]}));function N(t){return Object.values(t).flat()}const h={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let O;const b=new Uint8Array(16);function I(){if(!O&&(O="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!O))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return O(b)}const v=[];for(let t=0;t<256;++t)v.push((t+256).toString(16).slice(1));function w(t,e=0){return v[t[e+0]]+v[t[e+1]]+v[t[e+2]]+v[t[e+3]]+"-"+v[t[e+4]]+v[t[e+5]]+"-"+v[t[e+6]]+v[t[e+7]]+"-"+v[t[e+8]]+v[t[e+9]]+"-"+v[t[e+10]]+v[t[e+11]]+v[t[e+12]]+v[t[e+13]]+v[t[e+14]]+v[t[e+15]]}const E=function(t,e,n){if(h.randomUUID&&!e&&!t)return h.randomUUID();const r=(t=t||{}).random||(t.rng||I)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){n=n||0;for(let t=0;t<16;++t)e[n+t]=r[t];return e}return w(r)};function R({blockClientId:t,richTextIdentifier:e=null,range:n=null,selector:r="range",source:o="default",id:a=E()}){const i={type:"ANNOTATION_ADD",id:a,blockClientId:t,richTextIdentifier:e,source:o,selector:r};return"range"===r&&(i.range=n),i}function U(t){return{type:"ANNOTATION_REMOVE",annotationId:t}}function S(t,e,n){return{type:"ANNOTATION_UPDATE_RANGE",annotationId:t,start:e,end:n}}function k(t){return{type:"ANNOTATION_REMOVE_SOURCE",source:t}}const C=(0,m.createReduxStore)(i,{reducer:A,selectors:n,actions:r});(0,m.register)(C),(window.wp=window.wp||{}).annotations=e})(); \ No newline at end of file diff --git a/wp-includes/js/dist/block-directory.js b/wp-includes/js/dist/block-directory.js index fdac49e..2fa5426 100644 --- a/wp-includes/js/dist/block-directory.js +++ b/wp-includes/js/dist/block-directory.js @@ -90,8 +90,6 @@ __webpack_require__.d(resolvers_namespaceObject, { getDownloadableBlocks: () => (resolvers_getDownloadableBlocks) }); -;// CONCATENATED MODULE: external "React" -const external_React_namespaceObject = window["React"]; ;// CONCATENATED MODULE: external ["wp","plugins"] const external_wp_plugins_namespaceObject = window["wp"]["plugins"]; ;// CONCATENATED MODULE: external ["wp","hooks"] @@ -1349,57 +1347,63 @@ function Icon({ ;// CONCATENATED MODULE: external ["wp","primitives"] const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; +;// CONCATENATED MODULE: external "ReactJSXRuntime" +const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-filled.js - /** * WordPress dependencies */ -const starFilled = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const starFilled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.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" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.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" + }) +}); /* harmony default export */ const star_filled = (starFilled); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-half.js - /** * WordPress dependencies */ -const starHalf = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const starHalf = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M9.518 8.783a.25.25 0 00.188-.137l2.069-4.192a.25.25 0 01.448 0l2.07 4.192a.25.25 0 00.187.137l4.626.672a.25.25 0 01.139.427l-3.347 3.262a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.363.264l-4.137-2.176a.25.25 0 00-.233 0l-4.138 2.175a.25.25 0 01-.362-.263l.79-4.607a.25.25 0 00-.072-.222L4.753 9.882a.25.25 0 01.14-.427l4.625-.672zM12 14.533c.28 0 .559.067.814.2l1.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.39v7.143z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M9.518 8.783a.25.25 0 00.188-.137l2.069-4.192a.25.25 0 01.448 0l2.07 4.192a.25.25 0 00.187.137l4.626.672a.25.25 0 01.139.427l-3.347 3.262a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.363.264l-4.137-2.176a.25.25 0 00-.233 0l-4.138 2.175a.25.25 0 01-.362-.263l.79-4.607a.25.25 0 00-.072-.222L4.753 9.882a.25.25 0 01.14-.427l4.625-.672zM12 14.533c.28 0 .559.067.814.2l1.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.39v7.143z" + }) +}); /* harmony default export */ const star_half = (starHalf); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-empty.js - /** * WordPress dependencies */ -const starEmpty = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const starEmpty = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.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" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.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" + }) +}); /* harmony default export */ const star_empty = (starEmpty); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/block-ratings/stars.js - /** * WordPress dependencies */ + + function Stars({ rating }) { @@ -1407,64 +1411,63 @@ function Stars({ const fullStarCount = Math.floor(rating); const halfStarCount = Math.ceil(rating - fullStarCount); const emptyStarCount = 5 - (fullStarCount + halfStarCount); - return (0,external_React_namespaceObject.createElement)("span", { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: number of stars. */ - (0,external_wp_i18n_namespaceObject.__)('%s out of 5 stars'), stars) - }, Array.from({ - length: fullStarCount - }).map((_, i) => (0,external_React_namespaceObject.createElement)(icon, { - key: `full_stars_${i}`, - className: "block-directory-block-ratings__star-full", - icon: star_filled, - size: 16 - })), Array.from({ - length: halfStarCount - }).map((_, i) => (0,external_React_namespaceObject.createElement)(icon, { - key: `half_stars_${i}`, - className: "block-directory-block-ratings__star-half-full", - icon: star_half, - size: 16 - })), Array.from({ - length: emptyStarCount - }).map((_, i) => (0,external_React_namespaceObject.createElement)(icon, { - key: `empty_stars_${i}`, - className: "block-directory-block-ratings__star-empty", - icon: star_empty, - size: 16 - }))); + (0,external_wp_i18n_namespaceObject.__)('%s out of 5 stars'), stars), + children: [Array.from({ + length: fullStarCount + }).map((_, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icon, { + className: "block-directory-block-ratings__star-full", + icon: star_filled, + size: 16 + }, `full_stars_${i}`)), Array.from({ + length: halfStarCount + }).map((_, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icon, { + className: "block-directory-block-ratings__star-half-full", + icon: star_half, + size: 16 + }, `half_stars_${i}`)), Array.from({ + length: emptyStarCount + }).map((_, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icon, { + className: "block-directory-block-ratings__star-empty", + icon: star_empty, + size: 16 + }, `empty_stars_${i}`))] + }); } /* harmony default export */ const stars = (Stars); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/block-ratings/index.js - /** * Internal dependencies */ + const BlockRatings = ({ rating -}) => (0,external_React_namespaceObject.createElement)("span", { - className: "block-directory-block-ratings" -}, (0,external_React_namespaceObject.createElement)(stars, { - rating: rating -})); +}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + className: "block-directory-block-ratings", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(stars, { + rating: rating + }) +}); /* harmony default export */ const block_ratings = (BlockRatings); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-block-icon/index.js - /** * WordPress dependencies */ + function DownloadableBlockIcon({ icon }) { const className = 'block-directory-downloadable-block-icon'; - return icon.match(/\.(jpeg|jpg|gif|png|svg)(?:\?.*)?$/) !== null ? (0,external_React_namespaceObject.createElement)("img", { + return icon.match(/\.(jpeg|jpg|gif|png|svg)(?:\?.*)?$/) !== null ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { className: className, src: icon, alt: "" - }) : (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, { + }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { className: className, icon: icon, showColors: true @@ -1473,7 +1476,6 @@ function DownloadableBlockIcon({ /* harmony default export */ const downloadable_block_icon = (DownloadableBlockIcon); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-block-notice/index.js - /** * WordPress dependencies */ @@ -1484,6 +1486,8 @@ function DownloadableBlockIcon({ * Internal dependencies */ + + const DownloadableBlockNotice = ({ block }) => { @@ -1491,11 +1495,13 @@ const DownloadableBlockNotice = ({ if (!errorNotice) { return null; } - return (0,external_React_namespaceObject.createElement)("div", { - className: "block-directory-downloadable-block-notice" - }, (0,external_React_namespaceObject.createElement)("div", { - className: "block-directory-downloadable-block-notice__content" - }, errorNotice.message, errorNotice.isFatal ? ' ' + (0,external_wp_i18n_namespaceObject.__)('Try reloading the page.') : null)); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-directory-downloadable-block-notice", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-directory-downloadable-block-notice__content", + children: [errorNotice.message, errorNotice.isFatal ? ' ' + (0,external_wp_i18n_namespaceObject.__)('Try reloading the page.') : null] + }) + }); }; /* harmony default export */ const downloadable_block_notice = (DownloadableBlockNotice); @@ -1509,10 +1515,9 @@ const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; const { lock, unlock -} = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/block-directory'); +} = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/block-directory'); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-block-list-item/index.js - /** * WordPress dependencies */ @@ -1531,6 +1536,9 @@ const { + + + const { CompositeItemV2: CompositeItem } = unlock(external_wp_components_namespaceObject.privateApis); @@ -1604,8 +1612,8 @@ function DownloadableBlockListItem({ } else if (isInstalling) { statusText = (0,external_wp_i18n_namespaceObject.__)('Installing…'); } - return (0,external_React_namespaceObject.createElement)(CompositeItem, { - render: (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(CompositeItem, { + render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __experimentalIsFocusable: true, type: "button", role: "option", @@ -1624,35 +1632,44 @@ function DownloadableBlockListItem({ tooltipPosition: "top center" }), store: composite, - disabled: isInstalling || !isInstallable - }, (0,external_React_namespaceObject.createElement)("div", { - className: "block-directory-downloadable-block-list-item__icon" - }, (0,external_React_namespaceObject.createElement)(downloadable_block_icon, { - icon: icon, - title: title - }), isInstalling ? (0,external_React_namespaceObject.createElement)("span", { - className: "block-directory-downloadable-block-list-item__spinner" - }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null)) : (0,external_React_namespaceObject.createElement)(block_ratings, { - rating: rating - })), (0,external_React_namespaceObject.createElement)("span", { - className: "block-directory-downloadable-block-list-item__details" - }, (0,external_React_namespaceObject.createElement)("span", { - className: "block-directory-downloadable-block-list-item__title" - }, (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %1$s: block title, %2$s: author name. */ - (0,external_wp_i18n_namespaceObject.__)('%1$s by %2$s'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), author), { - span: (0,external_React_namespaceObject.createElement)("span", { - className: "block-directory-downloadable-block-list-item__author" - }) - })), hasNotice ? (0,external_React_namespaceObject.createElement)(downloadable_block_notice, { - block: item - }) : (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("span", { - className: "block-directory-downloadable-block-list-item__desc" - }, !!statusText ? statusText : (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(description)), isInstallable && !(isInstalled || isInstalling) && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, null, (0,external_wp_i18n_namespaceObject.__)('Install block'))))); + disabled: isInstalling || !isInstallable, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-directory-downloadable-block-list-item__icon", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(downloadable_block_icon, { + icon: icon, + title: title + }), isInstalling ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + className: "block-directory-downloadable-block-list-item__spinner", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) + }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_ratings, { + rating: rating + })] + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { + className: "block-directory-downloadable-block-list-item__details", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + className: "block-directory-downloadable-block-list-item__title", + children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %1$s: block title, %2$s: author name. */ + (0,external_wp_i18n_namespaceObject.__)('%1$s by %2$s'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), author), { + span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + className: "block-directory-downloadable-block-list-item__author" + }) + }) + }), hasNotice ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(downloadable_block_notice, { + block: item + }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + className: "block-directory-downloadable-block-list-item__desc", + children: !!statusText ? statusText : (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(description) + }), isInstallable && !(isInstalled || isInstalling) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { + children: (0,external_wp_i18n_namespaceObject.__)('Install block') + })] + })] + })] + }); } /* harmony default export */ const downloadable_block_list_item = (DownloadableBlockListItem); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-list/index.js - /** * WordPress dependencies */ @@ -1667,6 +1684,7 @@ function DownloadableBlockListItem({ + const { CompositeV2: Composite, useCompositeStoreV2: useCompositeStore @@ -1684,47 +1702,49 @@ function DownloadableBlocksList({ if (!items.length) { return null; } - return (0,external_React_namespaceObject.createElement)(Composite, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Composite, { store: composite, role: "listbox", className: "block-directory-downloadable-blocks-list", - "aria-label": (0,external_wp_i18n_namespaceObject.__)('Blocks available for install') - }, items.map(item => { - return (0,external_React_namespaceObject.createElement)(downloadable_block_list_item, { - key: item.id, - composite: composite, - onClick: () => { - // Check if the block is registered (`getBlockType` - // will return an object). If so, insert the block. - // This prevents installing existing plugins. - if ((0,external_wp_blocks_namespaceObject.getBlockType)(item.name)) { - onSelect(item); - } else { - installBlockType(item).then(success => { - if (success) { - onSelect(item); - } - }); - } - onHover(null); - }, - onHover: onHover, - item: item - }); - })); + "aria-label": (0,external_wp_i18n_namespaceObject.__)('Blocks available for install'), + children: items.map(item => { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(downloadable_block_list_item, { + composite: composite, + onClick: () => { + // Check if the block is registered (`getBlockType` + // will return an object). If so, insert the block. + // This prevents installing existing plugins. + if ((0,external_wp_blocks_namespaceObject.getBlockType)(item.name)) { + onSelect(item); + } else { + installBlockType(item).then(success => { + if (success) { + onSelect(item); + } + }); + } + onHover(null); + }, + onHover: onHover, + item: item + }, item.id); + }) + }); } /* harmony default export */ const downloadable_blocks_list = (DownloadableBlocksList); ;// CONCATENATED MODULE: external ["wp","a11y"] const external_wp_a11y_namespaceObject = window["wp"]["a11y"]; ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-panel/inserter-panel.js - /** * WordPress dependencies */ + + + function DownloadableBlocksInserterPanel({ children, downloadableItems, @@ -1735,60 +1755,78 @@ function DownloadableBlocksInserterPanel({ (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of available blocks. */ (0,external_wp_i18n_namespaceObject._n)('%d additional block is available to install.', '%d additional blocks are available to install.', count), count)); }, [count]); - return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, !hasLocalBlocks && (0,external_React_namespaceObject.createElement)("p", { - className: "block-directory-downloadable-blocks-panel__no-local" - }, (0,external_wp_i18n_namespaceObject.__)('No results available from your installed blocks.')), (0,external_React_namespaceObject.createElement)("div", { - className: "block-editor-inserter__quick-inserter-separator" - }), (0,external_React_namespaceObject.createElement)("div", { - className: "block-directory-downloadable-blocks-panel" - }, (0,external_React_namespaceObject.createElement)("div", { - className: "block-directory-downloadable-blocks-panel__header" - }, (0,external_React_namespaceObject.createElement)("h2", { - className: "block-directory-downloadable-blocks-panel__title" - }, (0,external_wp_i18n_namespaceObject.__)('Available to install')), (0,external_React_namespaceObject.createElement)("p", { - className: "block-directory-downloadable-blocks-panel__description" - }, (0,external_wp_i18n_namespaceObject.__)('Select a block to install and add it to your post.'))), children)); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [!hasLocalBlocks && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { + className: "block-directory-downloadable-blocks-panel__no-local", + children: (0,external_wp_i18n_namespaceObject.__)('No results available from your installed blocks.') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-inserter__quick-inserter-separator" + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-directory-downloadable-blocks-panel", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-directory-downloadable-blocks-panel__header", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { + className: "block-directory-downloadable-blocks-panel__title", + children: (0,external_wp_i18n_namespaceObject.__)('Available to install') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { + className: "block-directory-downloadable-blocks-panel__description", + children: (0,external_wp_i18n_namespaceObject.__)('Select a block to install and add it to your post.') + })] + }), children] + })] + }); } /* harmony default export */ const inserter_panel = (DownloadableBlocksInserterPanel); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-default.js - /** * WordPress dependencies */ -const blockDefault = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const blockDefault = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.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" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.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" + }) +}); /* harmony default export */ const block_default = (blockDefault); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-panel/no-results.js - /** * WordPress dependencies */ + + + function DownloadableBlocksNoResults() { - return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("div", { - className: "block-editor-inserter__no-results" - }, (0,external_React_namespaceObject.createElement)(icon, { - className: "block-editor-inserter__no-results-icon", - icon: block_default - }), (0,external_React_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('No results found.'))), (0,external_React_namespaceObject.createElement)("div", { - className: "block-editor-inserter__tips" - }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Tip, null, (0,external_wp_i18n_namespaceObject.__)('Interested in creating your own block?'), (0,external_React_namespaceObject.createElement)("br", null), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, { - href: "https://developer.wordpress.org/block-editor/" - }, (0,external_wp_i18n_namespaceObject.__)('Get started here'), ".")))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-inserter__no-results", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icon, { + className: "block-editor-inserter__no-results-icon", + icon: block_default + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { + children: (0,external_wp_i18n_namespaceObject.__)('No results found.') + })] + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-inserter__tips", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Tip, { + children: [(0,external_wp_i18n_namespaceObject.__)('Interested in creating your own block?'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ExternalLink, { + href: "https://developer.wordpress.org/block-editor/", + children: [(0,external_wp_i18n_namespaceObject.__)('Get started here'), "."] + })] + }) + })] + }); } /* harmony default export */ const no_results = (DownloadableBlocksNoResults); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-panel/index.js - /** * WordPress dependencies */ @@ -1805,6 +1843,9 @@ function DownloadableBlocksNoResults() { + + + const EMPTY_ARRAY = []; const useDownloadableBlocks = filterValue => (0,external_wp_data_namespaceObject.useSelect)(select => { const { @@ -1860,35 +1901,41 @@ function DownloadableBlocksPanel({ isLoading } = useDownloadableBlocks(filterValue); if (hasPermission === undefined || isLoading || isTyping) { - return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, hasPermission && !hasLocalBlocks && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("p", { - className: "block-directory-downloadable-blocks-panel__no-local" - }, (0,external_wp_i18n_namespaceObject.__)('No results available from your installed blocks.')), (0,external_React_namespaceObject.createElement)("div", { - className: "block-editor-inserter__quick-inserter-separator" - })), (0,external_React_namespaceObject.createElement)("div", { - className: "block-directory-downloadable-blocks-panel has-blocks-loading" - }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [hasPermission && !hasLocalBlocks && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { + className: "block-directory-downloadable-blocks-panel__no-local", + children: (0,external_wp_i18n_namespaceObject.__)('No results available from your installed blocks.') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-inserter__quick-inserter-separator" + })] + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-directory-downloadable-blocks-panel has-blocks-loading", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) + })] + }); } if (false === hasPermission) { if (!hasLocalBlocks) { - return (0,external_React_namespaceObject.createElement)(no_results, null); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results, {}); } return null; } if (downloadableBlocks.length === 0) { - return hasLocalBlocks ? null : (0,external_React_namespaceObject.createElement)(no_results, null); + return hasLocalBlocks ? null : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results, {}); } - return (0,external_React_namespaceObject.createElement)(inserter_panel, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_panel, { downloadableItems: downloadableBlocks, - hasLocalBlocks: hasLocalBlocks - }, (0,external_React_namespaceObject.createElement)(downloadable_blocks_list, { - items: downloadableBlocks, - onSelect: onSelect, - onHover: onHover - })); + hasLocalBlocks: hasLocalBlocks, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(downloadable_blocks_list, { + items: downloadableBlocks, + onSelect: onSelect, + onHover: onHover + }) + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.js - /** * WordPress dependencies */ @@ -1900,34 +1947,36 @@ function DownloadableBlocksPanel({ * Internal dependencies */ + function InserterMenuDownloadableBlocksPanel() { const [debouncedFilterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)(''); const debouncedSetFilterValue = (0,external_wp_compose_namespaceObject.debounce)(setFilterValue, 400); - return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableInserterMenuExtension, null, ({ - onSelect, - onHover, - filterValue, - hasItems - }) => { - if (debouncedFilterValue !== filterValue) { - debouncedSetFilterValue(filterValue); - } - if (!debouncedFilterValue) { - return null; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableInserterMenuExtension, { + children: ({ + onSelect, + onHover, + filterValue, + hasItems + }) => { + if (debouncedFilterValue !== filterValue) { + debouncedSetFilterValue(filterValue); + } + if (!debouncedFilterValue) { + return null; + } + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DownloadableBlocksPanel, { + onSelect: onSelect, + onHover: onHover, + filterValue: debouncedFilterValue, + hasLocalBlocks: hasItems, + isTyping: filterValue !== debouncedFilterValue + }); } - return (0,external_React_namespaceObject.createElement)(DownloadableBlocksPanel, { - onSelect: onSelect, - onHover: onHover, - filterValue: debouncedFilterValue, - hasLocalBlocks: hasItems, - isTyping: filterValue !== debouncedFilterValue - }); }); } /* harmony default export */ const inserter_menu_downloadable_blocks_panel = (InserterMenuDownloadableBlocksPanel); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/compact-list/index.js - /** * WordPress dependencies */ @@ -1937,38 +1986,43 @@ function InserterMenuDownloadableBlocksPanel() { * Internal dependencies */ + + function CompactList({ items }) { if (!items.length) { return null; } - return (0,external_React_namespaceObject.createElement)("ul", { - className: "block-directory-compact-list" - }, items.map(({ - icon, - id, - title, - author - }) => (0,external_React_namespaceObject.createElement)("li", { - key: id, - className: "block-directory-compact-list__item" - }, (0,external_React_namespaceObject.createElement)(downloadable_block_icon, { - icon: icon, - title: title - }), (0,external_React_namespaceObject.createElement)("div", { - className: "block-directory-compact-list__item-details" - }, (0,external_React_namespaceObject.createElement)("div", { - className: "block-directory-compact-list__item-title" - }, title), (0,external_React_namespaceObject.createElement)("div", { - className: "block-directory-compact-list__item-author" - }, (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Name of the block author. */ - (0,external_wp_i18n_namespaceObject.__)('By %s'), author)))))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { + className: "block-directory-compact-list", + children: items.map(({ + icon, + id, + title, + author + }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { + className: "block-directory-compact-list__item", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(downloadable_block_icon, { + icon: icon, + title: title + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-directory-compact-list__item-details", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-directory-compact-list__item-title", + children: title + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-directory-compact-list__item-author", + children: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Name of the block author. */ + (0,external_wp_i18n_namespaceObject.__)('By %s'), author) + })] + })] + }, id)) + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/plugins/installed-blocks-pre-publish-panel/index.js -var _window$wp$editPost; - +var _window$wp$editor; /** * WordPress dependencies */ @@ -1982,31 +2036,34 @@ var _window$wp$editPost; -// We shouldn't import the edit-post package directly -// because it would include the wp-edit-post in all pages loading the block-directory script. +// We shouldn't import the editor package directly +// because it would include the wp-editor in all pages loading the block-directory script. + + const { PluginPrePublishPanel -} = (_window$wp$editPost = window?.wp?.editPost) !== null && _window$wp$editPost !== void 0 ? _window$wp$editPost : {}; +} = (_window$wp$editor = window?.wp?.editor) !== null && _window$wp$editor !== void 0 ? _window$wp$editor : {}; function InstalledBlocksPrePublishPanel() { const newBlockTypes = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getNewBlockTypes(), []); if (!newBlockTypes.length) { return null; } - return (0,external_React_namespaceObject.createElement)(PluginPrePublishPanel, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PluginPrePublishPanel, { icon: block_default, title: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %d: number of blocks (number). (0,external_wp_i18n_namespaceObject._n)('Added: %d block', 'Added: %d blocks', newBlockTypes.length), newBlockTypes.length), - initialOpen: true - }, (0,external_React_namespaceObject.createElement)("p", { - className: "installed-blocks-pre-publish-panel__copy" - }, (0,external_wp_i18n_namespaceObject._n)('The following block has been added to your site.', 'The following blocks have been added to your site.', newBlockTypes.length)), (0,external_React_namespaceObject.createElement)(CompactList, { - items: newBlockTypes - })); + initialOpen: true, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { + className: "installed-blocks-pre-publish-panel__copy", + children: (0,external_wp_i18n_namespaceObject._n)('The following block has been added to your site.', 'The following blocks have been added to your site.', newBlockTypes.length) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CompactList, { + items: newBlockTypes + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/plugins/get-install-missing/install-button.js - /** * WordPress dependencies */ @@ -2020,6 +2077,7 @@ function InstalledBlocksPrePublishPanel() { * Internal dependencies */ + function InstallButton({ attributes, block, @@ -2032,7 +2090,7 @@ function InstallButton({ const { replaceBlock } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); - return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { onClick: () => installBlockType(block).then(success => { if (success) { const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(block.name); @@ -2042,15 +2100,16 @@ function InstallButton({ } } }), + __experimentalIsFocusable: true, disabled: isInstallingBlock, isBusy: isInstallingBlock, - variant: "primary" - }, (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block name */ - (0,external_wp_i18n_namespaceObject.__)('Install %s'), block.title)); + variant: "primary", + children: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block name */ + (0,external_wp_i18n_namespaceObject.__)('Install %s'), block.title) + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/plugins/get-install-missing/index.js - /** * WordPress dependencies */ @@ -2067,6 +2126,8 @@ function InstallButton({ */ + + const getInstallMissing = OriginalComponent => props => { const { originalName @@ -2091,11 +2152,11 @@ const getInstallMissing = OriginalComponent => props => { // The user can't install blocks, or the block isn't available for download. if (!hasPermission || !block) { - return (0,external_React_namespaceObject.createElement)(OriginalComponent, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OriginalComponent, { ...props }); } - return (0,external_React_namespaceObject.createElement)(ModifiedWarning, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ModifiedWarning, { ...props, originalBlock: block }); @@ -2127,31 +2188,33 @@ const ModifiedWarning = ({ }, [clientId]); let messageHTML = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block name */ (0,external_wp_i18n_namespaceObject.__)('Your site doesn’t include support for the %s block. You can try installing the block or remove it entirely.'), originalBlock.title || originalName); - const actions = [(0,external_React_namespaceObject.createElement)(InstallButton, { - key: "install", + const actions = [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InstallButton, { block: originalBlock, attributes: props.attributes, clientId: props.clientId - })]; + }, "install")]; if (hasContent && hasHTMLBlock) { messageHTML = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block name */ (0,external_wp_i18n_namespaceObject.__)('Your site doesn’t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely.'), originalBlock.title || originalName); - actions.push((0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { - key: "convert", + actions.push( /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { onClick: convertToHTML, - variant: "tertiary" - }, (0,external_wp_i18n_namespaceObject.__)('Keep as HTML'))); + variant: "tertiary", + children: (0,external_wp_i18n_namespaceObject.__)('Keep as HTML') + }, "convert")); } - return (0,external_React_namespaceObject.createElement)("div", { - ...(0,external_wp_blockEditor_namespaceObject.useBlockProps)() - }, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, { - actions: actions - }, messageHTML), (0,external_React_namespaceObject.createElement)(external_wp_element_namespaceObject.RawHTML, null, originalUndelimitedContent)); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + ...(0,external_wp_blockEditor_namespaceObject.useBlockProps)(), + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.Warning, { + actions: actions, + children: messageHTML + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.RawHTML, { + children: originalUndelimitedContent + })] + }); }; /* harmony default export */ const get_install_missing = (getInstallMissing); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/plugins/index.js - /** * WordPress dependencies */ @@ -2165,9 +2228,14 @@ const ModifiedWarning = ({ + + + (0,external_wp_plugins_namespaceObject.registerPlugin)('block-directory', { render() { - return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(AutoBlockUninstaller, null), (0,external_React_namespaceObject.createElement)(inserter_menu_downloadable_blocks_panel, null), (0,external_React_namespaceObject.createElement)(InstalledBlocksPrePublishPanel, null)); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AutoBlockUninstaller, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_menu_downloadable_blocks_panel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InstalledBlocksPrePublishPanel, {})] + }); } }); (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'block-directory/fallback', (settings, name) => { diff --git a/wp-includes/js/dist/block-directory.min.js b/wp-includes/js/dist/block-directory.min.js index a35abd6..34bd649 100644 --- a/wp-includes/js/dist/block-directory.min.js +++ b/wp-includes/js/dist/block-directory.min.js @@ -1,2 +1,2 @@ /*! This file is auto-generated */ -(()=>{"use strict";var e={n:t=>{var l=t&&t.__esModule?()=>t.default:()=>t;return e.d(l,{a:l}),l},d:(t,l)=>{for(var n in l)e.o(l,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:l[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{store:()=>W});var l={};e.r(l),e.d(l,{getDownloadableBlocks:()=>g,getErrorNoticeForBlock:()=>h,getErrorNotices:()=>f,getInstalledBlockTypes:()=>w,getNewBlockTypes:()=>_,getUnusedBlockTypes:()=>E,isInstalling:()=>y,isRequestingDownloadableBlocks:()=>b});var n={};e.r(n),e.d(n,{addInstalledBlockType:()=>D,clearErrorNotice:()=>F,fetchDownloadableBlocks:()=>O,installBlockType:()=>A,receiveDownloadableBlocks:()=>C,removeInstalledBlockType:()=>P,setErrorNotice:()=>x,setIsInstalling:()=>M,uninstallBlockType:()=>R});var o={};e.r(o),e.d(o,{getDownloadableBlocks:()=>q});const r=window.React,a=window.wp.plugins,s=window.wp.hooks,c=window.wp.blocks,i=window.wp.data,d=window.wp.element,u=window.wp.editor,m=(0,i.combineReducers)({downloadableBlocks:(e={},t)=>{switch(t.type){case"FETCH_DOWNLOADABLE_BLOCKS":return{...e,[t.filterValue]:{isRequesting:!0}};case"RECEIVE_DOWNLOADABLE_BLOCKS":return{...e,[t.filterValue]:{results:t.downloadableBlocks,isRequesting:!1}}}return e},blockManagement:(e={installedBlockTypes:[],isInstalling:{}},t)=>{switch(t.type){case"ADD_INSTALLED_BLOCK_TYPE":return{...e,installedBlockTypes:[...e.installedBlockTypes,t.item]};case"REMOVE_INSTALLED_BLOCK_TYPE":return{...e,installedBlockTypes:e.installedBlockTypes.filter((e=>e.name!==t.item.name))};case"SET_INSTALLING_BLOCK":return{...e,isInstalling:{...e.isInstalling,[t.blockId]:t.isInstalling}}}return e},errorNotices:(e={},t)=>{switch(t.type){case"SET_ERROR_NOTICE":return{...e,[t.blockId]:{message:t.message,isFatal:t.isFatal}};case"CLEAR_ERROR_NOTICE":const{[t.blockId]:l,...n}=e;return n}return e}}),p=window.wp.blockEditor;function k(e,t=[]){if(!t.length)return!1;if(t.some((({name:t})=>t===e.name)))return!0;for(let l=0;lt=>{const l=e(p.store).getBlocks();return w(t).filter((e=>k(e,l)))})),E=(0,i.createRegistrySelector)((e=>t=>{const l=e(p.store).getBlocks();return w(t).filter((e=>!k(e,l)))}));function y(e,t){return e.blockManagement.isInstalling[t]||!1}function f(e){return e.errorNotices}function h(e,t){return e.errorNotices[t]}const v=window.wp.i18n,B=window.wp.apiFetch;var N=e.n(B);const I=window.wp.notices,T=window.wp.url,L=e=>new Promise(((t,l)=>{const n=document.createElement(e.nodeName);["id","rel","src","href","type"].forEach((t=>{e[t]&&(n[t]=e[t])})),e.innerHTML&&n.appendChild(document.createTextNode(e.innerHTML)),n.onload=()=>t(!0),n.onerror=()=>l(new Error("Error loading asset.")),document.body.appendChild(n),("link"===n.nodeName.toLowerCase()||"script"===n.nodeName.toLowerCase()&&!n.src)&&t()}));function S(e){if(!e)return!1;const t=e.links["wp:plugin"]||e.links.self;return!(!t||!t.length)&&t[0].href}function O(e){return{type:"FETCH_DOWNLOADABLE_BLOCKS",filterValue:e}}function C(e,t){return{type:"RECEIVE_DOWNLOADABLE_BLOCKS",downloadableBlocks:e,filterValue:t}}const A=e=>async({registry:t,dispatch:l})=>{const{id:n,name:o}=e;let r=!1;l.clearErrorNotice(n);try{l.setIsInstalling(n,!0);const a=S(e);let s={};if(a)await N()({method:"PUT",url:a,data:{status:"active"}});else{s=(await N()({method:"POST",path:"wp/v2/plugins",data:{slug:n,status:"active"}}))._links}l.addInstalledBlockType({...e,links:{...e.links,...s}});const i=["api_version","title","category","parent","icon","description","keywords","attributes","provides_context","uses_context","supports","styles","example","variations"];await N()({path:(0,T.addQueryArgs)(`/wp/v2/block-types/${o}`,{_fields:i})}).catch((()=>{})).then((e=>{e&&(0,c.unstable__bootstrapServerSideBlockDefinitions)({[o]:Object.fromEntries(Object.entries(e).filter((([e])=>i.includes(e))))})})),await async function(){const e=await N()({url:document.location.href,parse:!1}),t=await e.text(),l=(new window.DOMParser).parseFromString(t,"text/html"),n=Array.from(l.querySelectorAll('link[rel="stylesheet"],script')).filter((e=>e.id&&!document.getElementById(e.id)));for(const e of n)await L(e)}();if(!t.select(c.store).getBlockTypes().some((e=>e.name===o)))throw new Error((0,v.__)("Error registering block. Try reloading the page."));t.dispatch(I.store).createInfoNotice((0,v.sprintf)((0,v.__)("Block %s installed and added."),e.title),{speak:!0,type:"snackbar"}),r=!0}catch(e){let o=e.message||(0,v.__)("An error occurred."),r=e instanceof Error;const a={folder_exists:(0,v.__)("This block is already installed. Try reloading the page."),unable_to_connect_to_filesystem:(0,v.__)("Error installing block. You can reload the page and try again.")};a[e.code]&&(r=!0,o=a[e.code]),l.setErrorNotice(n,o,r),t.dispatch(I.store).createErrorNotice(o,{speak:!0,isDismissible:!0})}return l.setIsInstalling(n,!1),r},R=e=>async({registry:t,dispatch:l})=>{try{const t=S(e);await N()({method:"PUT",url:t,data:{status:"inactive"}}),await N()({method:"DELETE",url:t}),l.removeInstalledBlockType(e)}catch(e){t.dispatch(I.store).createErrorNotice(e.message||(0,v.__)("An error occurred."))}};function D(e){return{type:"ADD_INSTALLED_BLOCK_TYPE",item:e}}function P(e){return{type:"REMOVE_INSTALLED_BLOCK_TYPE",item:e}}function M(e,t){return{type:"SET_INSTALLING_BLOCK",blockId:e,isInstalling:t}}function x(e,t,l=!1){return{type:"SET_ERROR_NOTICE",blockId:e,message:t,isFatal:l}}function F(e){return{type:"CLEAR_ERROR_NOTICE",blockId:e}}var V=function(){return V=Object.assign||function(e){for(var t,l=1,n=arguments.length;l0&&l>="0"&&l<="9"?"_"+l+n:""+l.toUpperCase()+n}function U(e,t){return void 0===t&&(t={}),function(e,t){void 0===t&&(t={});for(var l=t.splitRegexp,n=void 0===l?$:l,o=t.stripRegexp,r=void 0===o?j:o,a=t.transform,s=void 0===a?H:a,c=t.delimiter,i=void 0===c?" ":c,d=z(z(e,n,"$1\0$2"),r,"\0"),u=0,m=d.length;"\0"===d.charAt(u);)u++;for(;"\0"===d.charAt(m-1);)m--;return d.slice(u,m).split("\0").map(s).join(i)}(e,V({delimiter:"",transform:K},t))}function Y(e,t){return 0===t?e.toLowerCase():K(e,t)}const q=e=>async({dispatch:t})=>{if(e)try{t(O(e));const l=await N()({path:`wp/v2/block-directory/search?term=${e}`});t(C(l.map((e=>Object.fromEntries(Object.entries(e).map((([e,t])=>{return[(l=e,void 0===n&&(n={}),U(l,V({transform:Y},n))),t];var l,n}))))),e))}catch{}},G={reducer:m,selectors:l,actions:n,resolvers:o},W=(0,i.createReduxStore)("core/block-directory",G);function Z(){const{uninstallBlockType:e}=(0,i.useDispatch)(W),t=(0,i.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:l}=e(u.store);return l()&&!t()}),[]),l=(0,i.useSelect)((e=>e(W).getUnusedBlockTypes()),[]);return(0,d.useEffect)((()=>{t&&l.length&&l.forEach((t=>{e(t),(0,c.unregisterBlockType)(t.name)}))}),[t]),null}(0,i.register)(W);const Q=window.wp.compose,J=window.wp.components,X=window.wp.coreData,ee=window.wp.htmlEntities;const te=(0,d.forwardRef)((function({icon:e,size:t=24,...l},n){return(0,d.cloneElement)(e,{width:t,height:t,...l,ref:n})})),le=window.wp.primitives,ne=(0,r.createElement)(le.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(le.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"})),oe=(0,r.createElement)(le.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(le.Path,{d:"M9.518 8.783a.25.25 0 00.188-.137l2.069-4.192a.25.25 0 01.448 0l2.07 4.192a.25.25 0 00.187.137l4.626.672a.25.25 0 01.139.427l-3.347 3.262a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.363.264l-4.137-2.176a.25.25 0 00-.233 0l-4.138 2.175a.25.25 0 01-.362-.263l.79-4.607a.25.25 0 00-.072-.222L4.753 9.882a.25.25 0 01.14-.427l4.625-.672zM12 14.533c.28 0 .559.067.814.2l1.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.39v7.143z"})),re=(0,r.createElement)(le.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(le.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"}));const ae=function({rating:e}){const t=.5*Math.round(e/.5),l=Math.floor(e),n=Math.ceil(e-l),o=5-(l+n);return(0,r.createElement)("span",{"aria-label":(0,v.sprintf)((0,v.__)("%s out of 5 stars"),t)},Array.from({length:l}).map(((e,t)=>(0,r.createElement)(te,{key:`full_stars_${t}`,className:"block-directory-block-ratings__star-full",icon:ne,size:16}))),Array.from({length:n}).map(((e,t)=>(0,r.createElement)(te,{key:`half_stars_${t}`,className:"block-directory-block-ratings__star-half-full",icon:oe,size:16}))),Array.from({length:o}).map(((e,t)=>(0,r.createElement)(te,{key:`empty_stars_${t}`,className:"block-directory-block-ratings__star-empty",icon:re,size:16}))))},se=({rating:e})=>(0,r.createElement)("span",{className:"block-directory-block-ratings"},(0,r.createElement)(ae,{rating:e}));const ce=function({icon:e}){const t="block-directory-downloadable-block-icon";return null!==e.match(/\.(jpeg|jpg|gif|png|svg)(?:\?.*)?$/)?(0,r.createElement)("img",{className:t,src:e,alt:""}):(0,r.createElement)(p.BlockIcon,{className:t,icon:e,showColors:!0})},ie=({block:e})=>{const t=(0,i.useSelect)((t=>t(W).getErrorNoticeForBlock(e.id)),[e]);return t?(0,r.createElement)("div",{className:"block-directory-downloadable-block-notice"},(0,r.createElement)("div",{className:"block-directory-downloadable-block-notice__content"},t.message,t.isFatal?" "+(0,v.__)("Try reloading the page."):null)):null},de=window.wp.privateApis,{lock:ue,unlock:me}=(0,de.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.","@wordpress/block-directory"),{CompositeItemV2:pe}=me(J.privateApis);function ke({title:e,rating:t,ratingCount:l},{hasNotice:n,isInstalled:o,isInstalling:r}){const a=.5*Math.round(t/.5);return!o&&n?(0,v.sprintf)("Retry installing %s.",(0,ee.decodeEntities)(e)):o?(0,v.sprintf)("Add %s.",(0,ee.decodeEntities)(e)):r?(0,v.sprintf)("Installing %s.",(0,ee.decodeEntities)(e)):l<1?(0,v.sprintf)("Install %s.",(0,ee.decodeEntities)(e)):(0,v.sprintf)((0,v._n)("Install %1$s. %2$s stars with %3$s review.","Install %1$s. %2$s stars with %3$s reviews.",l),(0,ee.decodeEntities)(e),a,l)}const be=function({composite:e,item:t,onClick:l}){const{author:n,description:o,icon:a,rating:s,title:u}=t,m=!!(0,c.getBlockType)(t.name),{hasNotice:p,isInstalling:k,isInstallable:b}=(0,i.useSelect)((e=>{const{getErrorNoticeForBlock:l,isInstalling:n}=e(W),o=l(t.id),r=o&&o.isFatal;return{hasNotice:!!o,isInstalling:n(t.id),isInstallable:!r}}),[t]);let g="";return m?g=(0,v.__)("Installed!"):k&&(g=(0,v.__)("Installing…")),(0,r.createElement)(pe,{render:(0,r.createElement)(J.Button,{__experimentalIsFocusable:!0,type:"button",role:"option",className:"block-directory-downloadable-block-list-item",isBusy:k,onClick:e=>{e.preventDefault(),l()},label:ke(t,{hasNotice:p,isInstalled:m,isInstalling:k}),showTooltip:!0,tooltipPosition:"top center"}),store:e,disabled:k||!b},(0,r.createElement)("div",{className:"block-directory-downloadable-block-list-item__icon"},(0,r.createElement)(ce,{icon:a,title:u}),k?(0,r.createElement)("span",{className:"block-directory-downloadable-block-list-item__spinner"},(0,r.createElement)(J.Spinner,null)):(0,r.createElement)(se,{rating:s})),(0,r.createElement)("span",{className:"block-directory-downloadable-block-list-item__details"},(0,r.createElement)("span",{className:"block-directory-downloadable-block-list-item__title"},(0,d.createInterpolateElement)((0,v.sprintf)((0,v.__)("%1$s by %2$s"),(0,ee.decodeEntities)(u),n),{span:(0,r.createElement)("span",{className:"block-directory-downloadable-block-list-item__author"})})),p?(0,r.createElement)(ie,{block:t}):(0,r.createElement)(r.Fragment,null,(0,r.createElement)("span",{className:"block-directory-downloadable-block-list-item__desc"},g||(0,ee.decodeEntities)(o)),b&&!(m||k)&&(0,r.createElement)(J.VisuallyHidden,null,(0,v.__)("Install block")))))},{CompositeV2:ge,useCompositeStoreV2:we}=me(J.privateApis),_e=()=>{};const Ee=function({items:e,onHover:t=_e,onSelect:l}){const n=we(),{installBlockType:o}=(0,i.useDispatch)(W);return e.length?(0,r.createElement)(ge,{store:n,role:"listbox",className:"block-directory-downloadable-blocks-list","aria-label":(0,v.__)("Blocks available for install")},e.map((e=>(0,r.createElement)(be,{key:e.id,composite:n,onClick:()=>{(0,c.getBlockType)(e.name)?l(e):o(e).then((t=>{t&&l(e)})),t(null)},onHover:t,item:e})))):null},ye=window.wp.a11y;const fe=function({children:e,downloadableItems:t,hasLocalBlocks:l}){const n=t.length;return(0,d.useEffect)((()=>{(0,ye.speak)((0,v.sprintf)((0,v._n)("%d additional block is available to install.","%d additional blocks are available to install.",n),n))}),[n]),(0,r.createElement)(r.Fragment,null,!l&&(0,r.createElement)("p",{className:"block-directory-downloadable-blocks-panel__no-local"},(0,v.__)("No results available from your installed blocks.")),(0,r.createElement)("div",{className:"block-editor-inserter__quick-inserter-separator"}),(0,r.createElement)("div",{className:"block-directory-downloadable-blocks-panel"},(0,r.createElement)("div",{className:"block-directory-downloadable-blocks-panel__header"},(0,r.createElement)("h2",{className:"block-directory-downloadable-blocks-panel__title"},(0,v.__)("Available to install")),(0,r.createElement)("p",{className:"block-directory-downloadable-blocks-panel__description"},(0,v.__)("Select a block to install and add it to your post."))),e))},he=(0,r.createElement)(le.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(le.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"}));const ve=function(){return(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"block-editor-inserter__no-results"},(0,r.createElement)(te,{className:"block-editor-inserter__no-results-icon",icon:he}),(0,r.createElement)("p",null,(0,v.__)("No results found."))),(0,r.createElement)("div",{className:"block-editor-inserter__tips"},(0,r.createElement)(J.Tip,null,(0,v.__)("Interested in creating your own block?"),(0,r.createElement)("br",null),(0,r.createElement)(J.ExternalLink,{href:"https://developer.wordpress.org/block-editor/"},(0,v.__)("Get started here"),"."))))},Be=[],Ne=e=>(0,i.useSelect)((t=>{const{getDownloadableBlocks:l,isRequestingDownloadableBlocks:n,getInstalledBlockTypes:o}=t(W),r=t(X.store).canUser("read","block-directory/search");let a=Be;if(r){a=l(e);const t=o(),n=a.filter((({name:e})=>{const l=t.some((t=>t.name===e)),n=(0,c.getBlockType)(e);return l||!n}));n.length!==a.length&&(a=n),0===a.length&&(a=Be)}return{hasPermission:r,downloadableBlocks:a,isLoading:n(e)}}),[e]);function Ie({onSelect:e,onHover:t,hasLocalBlocks:l,isTyping:n,filterValue:o}){const{hasPermission:a,downloadableBlocks:s,isLoading:c}=Ne(o);return void 0===a||c||n?(0,r.createElement)(r.Fragment,null,a&&!l&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("p",{className:"block-directory-downloadable-blocks-panel__no-local"},(0,v.__)("No results available from your installed blocks.")),(0,r.createElement)("div",{className:"block-editor-inserter__quick-inserter-separator"})),(0,r.createElement)("div",{className:"block-directory-downloadable-blocks-panel has-blocks-loading"},(0,r.createElement)(J.Spinner,null))):!1===a||0===s.length?l?null:(0,r.createElement)(ve,null):(0,r.createElement)(fe,{downloadableItems:s,hasLocalBlocks:l},(0,r.createElement)(Ee,{items:s,onSelect:e,onHover:t}))}const Te=function(){const[e,t]=(0,d.useState)(""),l=(0,Q.debounce)(t,400);return(0,r.createElement)(p.__unstableInserterMenuExtension,null,(({onSelect:t,onHover:n,filterValue:o,hasItems:a})=>(e!==o&&l(o),e?(0,r.createElement)(Ie,{onSelect:t,onHover:n,filterValue:e,hasLocalBlocks:a,isTyping:o!==e}):null)))};function Le({items:e}){return e.length?(0,r.createElement)("ul",{className:"block-directory-compact-list"},e.map((({icon:e,id:t,title:l,author:n})=>(0,r.createElement)("li",{key:t,className:"block-directory-compact-list__item"},(0,r.createElement)(ce,{icon:e,title:l}),(0,r.createElement)("div",{className:"block-directory-compact-list__item-details"},(0,r.createElement)("div",{className:"block-directory-compact-list__item-title"},l),(0,r.createElement)("div",{className:"block-directory-compact-list__item-author"},(0,v.sprintf)((0,v.__)("By %s"),n))))))):null}var Se;const{PluginPrePublishPanel:Oe}=null!==(Se=window?.wp?.editPost)&&void 0!==Se?Se:{};function Ce(){const e=(0,i.useSelect)((e=>e(W).getNewBlockTypes()),[]);return e.length?(0,r.createElement)(Oe,{icon:he,title:(0,v.sprintf)((0,v._n)("Added: %d block","Added: %d blocks",e.length),e.length),initialOpen:!0},(0,r.createElement)("p",{className:"installed-blocks-pre-publish-panel__copy"},(0,v._n)("The following block has been added to your site.","The following blocks have been added to your site.",e.length)),(0,r.createElement)(Le,{items:e})):null}function Ae({attributes:e,block:t,clientId:l}){const n=(0,i.useSelect)((e=>e(W).isInstalling(t.id)),[t.id]),{installBlockType:o}=(0,i.useDispatch)(W),{replaceBlock:a}=(0,i.useDispatch)(p.store);return(0,r.createElement)(J.Button,{onClick:()=>o(t).then((n=>{if(n){const n=(0,c.getBlockType)(t.name),[o]=(0,c.parse)(e.originalContent);o&&n&&a(l,(0,c.createBlock)(n.name,o.attributes,o.innerBlocks))}})),disabled:n,isBusy:n,variant:"primary"},(0,v.sprintf)((0,v.__)("Install %s"),t.title))}const Re=({originalBlock:e,...t})=>{const{originalName:l,originalUndelimitedContent:n,clientId:o}=t.attributes,{replaceBlock:a}=(0,i.useDispatch)(p.store),s=()=>{a(t.clientId,(0,c.createBlock)("core/html",{content:n}))},u=!!n,m=(0,i.useSelect)((e=>{const{canInsertBlockType:t,getBlockRootClientId:l}=e(p.store);return t("core/html",l(o))}),[o]);let k=(0,v.sprintf)((0,v.__)("Your site doesn’t include support for the %s block. You can try installing the block or remove it entirely."),e.title||l);const b=[(0,r.createElement)(Ae,{key:"install",block:e,attributes:t.attributes,clientId:t.clientId})];return u&&m&&(k=(0,v.sprintf)((0,v.__)("Your site doesn’t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely."),e.title||l),b.push((0,r.createElement)(J.Button,{key:"convert",onClick:s,variant:"tertiary"},(0,v.__)("Keep as HTML")))),(0,r.createElement)("div",{...(0,p.useBlockProps)()},(0,r.createElement)(p.Warning,{actions:b},k),(0,r.createElement)(d.RawHTML,null,n))},De=e=>t=>{const{originalName:l}=t.attributes,{block:n,hasPermission:o}=(0,i.useSelect)((e=>{const{getDownloadableBlocks:t}=e(W),n=t("block:"+l).filter((({name:e})=>l===e));return{hasPermission:e(X.store).canUser("read","block-directory/search"),block:n.length&&n[0]}}),[l]);return o&&n?(0,r.createElement)(Re,{...t,originalBlock:n}):(0,r.createElement)(e,{...t})};(0,a.registerPlugin)("block-directory",{render:()=>(0,r.createElement)(r.Fragment,null,(0,r.createElement)(Z,null),(0,r.createElement)(Te,null),(0,r.createElement)(Ce,null))}),(0,s.addFilter)("blocks.registerBlockType","block-directory/fallback",((e,t)=>("core/missing"!==t||(e.edit=De(e.edit)),e))),(window.wp=window.wp||{}).blockDirectory=t})(); \ No newline at end of file +(()=>{"use strict";var e={n:t=>{var o=t&&t.__esModule?()=>t.default:()=>t;return e.d(o,{a:o}),o},d:(t,o)=>{for(var l in o)e.o(o,l)&&!e.o(t,l)&&Object.defineProperty(t,l,{enumerable:!0,get:o[l]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{store:()=>G});var o={};e.r(o),e.d(o,{getDownloadableBlocks:()=>h,getErrorNoticeForBlock:()=>y,getErrorNotices:()=>f,getInstalledBlockTypes:()=>m,getNewBlockTypes:()=>g,getUnusedBlockTypes:()=>w,isInstalling:()=>_,isRequestingDownloadableBlocks:()=>k});var l={};e.r(l),e.d(l,{addInstalledBlockType:()=>C,clearErrorNotice:()=>P,fetchDownloadableBlocks:()=>T,installBlockType:()=>S,receiveDownloadableBlocks:()=>L,removeInstalledBlockType:()=>A,setErrorNotice:()=>D,setIsInstalling:()=>R,uninstallBlockType:()=>O});var s={};e.r(s),e.d(s,{getDownloadableBlocks:()=>Y});const n=window.wp.plugins,r=window.wp.hooks,i=window.wp.blocks,a=window.wp.data,c=window.wp.element,d=window.wp.editor,u=(0,a.combineReducers)({downloadableBlocks:(e={},t)=>{switch(t.type){case"FETCH_DOWNLOADABLE_BLOCKS":return{...e,[t.filterValue]:{isRequesting:!0}};case"RECEIVE_DOWNLOADABLE_BLOCKS":return{...e,[t.filterValue]:{results:t.downloadableBlocks,isRequesting:!1}}}return e},blockManagement:(e={installedBlockTypes:[],isInstalling:{}},t)=>{switch(t.type){case"ADD_INSTALLED_BLOCK_TYPE":return{...e,installedBlockTypes:[...e.installedBlockTypes,t.item]};case"REMOVE_INSTALLED_BLOCK_TYPE":return{...e,installedBlockTypes:e.installedBlockTypes.filter((e=>e.name!==t.item.name))};case"SET_INSTALLING_BLOCK":return{...e,isInstalling:{...e.isInstalling,[t.blockId]:t.isInstalling}}}return e},errorNotices:(e={},t)=>{switch(t.type){case"SET_ERROR_NOTICE":return{...e,[t.blockId]:{message:t.message,isFatal:t.isFatal}};case"CLEAR_ERROR_NOTICE":const{[t.blockId]:o,...l}=e;return l}return e}}),p=window.wp.blockEditor;function b(e,t=[]){if(!t.length)return!1;if(t.some((({name:t})=>t===e.name)))return!0;for(let o=0;ot=>{const o=e(p.store).getBlocks();return m(t).filter((e=>b(e,o)))})),w=(0,a.createRegistrySelector)((e=>t=>{const o=e(p.store).getBlocks();return m(t).filter((e=>!b(e,o)))}));function _(e,t){return e.blockManagement.isInstalling[t]||!1}function f(e){return e.errorNotices}function y(e,t){return e.errorNotices[t]}const v=window.wp.i18n,x=window.wp.apiFetch;var j=e.n(x);const B=window.wp.notices,E=window.wp.url,I=e=>new Promise(((t,o)=>{const l=document.createElement(e.nodeName);["id","rel","src","href","type"].forEach((t=>{e[t]&&(l[t]=e[t])})),e.innerHTML&&l.appendChild(document.createTextNode(e.innerHTML)),l.onload=()=>t(!0),l.onerror=()=>o(new Error("Error loading asset.")),document.body.appendChild(l),("link"===l.nodeName.toLowerCase()||"script"===l.nodeName.toLowerCase()&&!l.src)&&t()}));function N(e){if(!e)return!1;const t=e.links["wp:plugin"]||e.links.self;return!(!t||!t.length)&&t[0].href}function T(e){return{type:"FETCH_DOWNLOADABLE_BLOCKS",filterValue:e}}function L(e,t){return{type:"RECEIVE_DOWNLOADABLE_BLOCKS",downloadableBlocks:e,filterValue:t}}const S=e=>async({registry:t,dispatch:o})=>{const{id:l,name:s}=e;let n=!1;o.clearErrorNotice(l);try{o.setIsInstalling(l,!0);const r=N(e);let a={};if(r)await j()({method:"PUT",url:r,data:{status:"active"}});else{a=(await j()({method:"POST",path:"wp/v2/plugins",data:{slug:l,status:"active"}}))._links}o.addInstalledBlockType({...e,links:{...e.links,...a}});const c=["api_version","title","category","parent","icon","description","keywords","attributes","provides_context","uses_context","supports","styles","example","variations"];await j()({path:(0,E.addQueryArgs)(`/wp/v2/block-types/${s}`,{_fields:c})}).catch((()=>{})).then((e=>{e&&(0,i.unstable__bootstrapServerSideBlockDefinitions)({[s]:Object.fromEntries(Object.entries(e).filter((([e])=>c.includes(e))))})})),await async function(){const e=await j()({url:document.location.href,parse:!1}),t=await e.text(),o=(new window.DOMParser).parseFromString(t,"text/html"),l=Array.from(o.querySelectorAll('link[rel="stylesheet"],script')).filter((e=>e.id&&!document.getElementById(e.id)));for(const e of l)await I(e)}();if(!t.select(i.store).getBlockTypes().some((e=>e.name===s)))throw new Error((0,v.__)("Error registering block. Try reloading the page."));t.dispatch(B.store).createInfoNotice((0,v.sprintf)((0,v.__)("Block %s installed and added."),e.title),{speak:!0,type:"snackbar"}),n=!0}catch(e){let s=e.message||(0,v.__)("An error occurred."),n=e instanceof Error;const r={folder_exists:(0,v.__)("This block is already installed. Try reloading the page."),unable_to_connect_to_filesystem:(0,v.__)("Error installing block. You can reload the page and try again.")};r[e.code]&&(n=!0,s=r[e.code]),o.setErrorNotice(l,s,n),t.dispatch(B.store).createErrorNotice(s,{speak:!0,isDismissible:!0})}return o.setIsInstalling(l,!1),n},O=e=>async({registry:t,dispatch:o})=>{try{const t=N(e);await j()({method:"PUT",url:t,data:{status:"inactive"}}),await j()({method:"DELETE",url:t}),o.removeInstalledBlockType(e)}catch(e){t.dispatch(B.store).createErrorNotice(e.message||(0,v.__)("An error occurred."))}};function C(e){return{type:"ADD_INSTALLED_BLOCK_TYPE",item:e}}function A(e){return{type:"REMOVE_INSTALLED_BLOCK_TYPE",item:e}}function R(e,t){return{type:"SET_INSTALLING_BLOCK",blockId:e,isInstalling:t}}function D(e,t,o=!1){return{type:"SET_ERROR_NOTICE",blockId:e,message:t,isFatal:o}}function P(e){return{type:"CLEAR_ERROR_NOTICE",blockId:e}}var M=function(){return M=Object.assign||function(e){for(var t,o=1,l=arguments.length;o0&&o>="0"&&o<="9"?"_"+o+l:""+o.toUpperCase()+l}function K(e,t){return void 0===t&&(t={}),function(e,t){void 0===t&&(t={});for(var o=t.splitRegexp,l=void 0===o?V:o,s=t.stripRegexp,n=void 0===s?H:s,r=t.transform,i=void 0===r?F:r,a=t.delimiter,c=void 0===a?" ":a,d=$($(e,l,"$1\0$2"),n,"\0"),u=0,p=d.length;"\0"===d.charAt(u);)u++;for(;"\0"===d.charAt(p-1);)p--;return d.slice(u,p).split("\0").map(i).join(c)}(e,M({delimiter:"",transform:z},t))}function U(e,t){return 0===t?e.toLowerCase():z(e,t)}const Y=e=>async({dispatch:t})=>{if(e)try{t(T(e));const o=await j()({path:`wp/v2/block-directory/search?term=${e}`});t(L(o.map((e=>Object.fromEntries(Object.entries(e).map((([e,t])=>{return[(o=e,void 0===l&&(l={}),K(o,M({transform:U},l))),t];var o,l}))))),e))}catch{}},q={reducer:u,selectors:o,actions:l,resolvers:s},G=(0,a.createReduxStore)("core/block-directory",q);function W(){const{uninstallBlockType:e}=(0,a.useDispatch)(G),t=(0,a.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:o}=e(d.store);return o()&&!t()}),[]),o=(0,a.useSelect)((e=>e(G).getUnusedBlockTypes()),[]);return(0,c.useEffect)((()=>{t&&o.length&&o.forEach((t=>{e(t),(0,i.unregisterBlockType)(t.name)}))}),[t]),null}(0,a.register)(G);const Z=window.wp.compose,J=window.wp.components,Q=window.wp.coreData,X=window.wp.htmlEntities;const ee=(0,c.forwardRef)((function({icon:e,size:t=24,...o},l){return(0,c.cloneElement)(e,{width:t,height:t,...o,ref:l})})),te=window.wp.primitives,oe=window.ReactJSXRuntime,le=(0,oe.jsx)(te.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(te.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"})}),se=(0,oe.jsx)(te.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(te.Path,{d:"M9.518 8.783a.25.25 0 00.188-.137l2.069-4.192a.25.25 0 01.448 0l2.07 4.192a.25.25 0 00.187.137l4.626.672a.25.25 0 01.139.427l-3.347 3.262a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.363.264l-4.137-2.176a.25.25 0 00-.233 0l-4.138 2.175a.25.25 0 01-.362-.263l.79-4.607a.25.25 0 00-.072-.222L4.753 9.882a.25.25 0 01.14-.427l4.625-.672zM12 14.533c.28 0 .559.067.814.2l1.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.39v7.143z"})}),ne=(0,oe.jsx)(te.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(te.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"})});const re=function({rating:e}){const t=.5*Math.round(e/.5),o=Math.floor(e),l=Math.ceil(e-o),s=5-(o+l);return(0,oe.jsxs)("span",{"aria-label":(0,v.sprintf)((0,v.__)("%s out of 5 stars"),t),children:[Array.from({length:o}).map(((e,t)=>(0,oe.jsx)(ee,{className:"block-directory-block-ratings__star-full",icon:le,size:16},`full_stars_${t}`))),Array.from({length:l}).map(((e,t)=>(0,oe.jsx)(ee,{className:"block-directory-block-ratings__star-half-full",icon:se,size:16},`half_stars_${t}`))),Array.from({length:s}).map(((e,t)=>(0,oe.jsx)(ee,{className:"block-directory-block-ratings__star-empty",icon:ne,size:16},`empty_stars_${t}`)))]})},ie=({rating:e})=>(0,oe.jsx)("span",{className:"block-directory-block-ratings",children:(0,oe.jsx)(re,{rating:e})});const ae=function({icon:e}){const t="block-directory-downloadable-block-icon";return null!==e.match(/\.(jpeg|jpg|gif|png|svg)(?:\?.*)?$/)?(0,oe.jsx)("img",{className:t,src:e,alt:""}):(0,oe.jsx)(p.BlockIcon,{className:t,icon:e,showColors:!0})},ce=({block:e})=>{const t=(0,a.useSelect)((t=>t(G).getErrorNoticeForBlock(e.id)),[e]);return t?(0,oe.jsx)("div",{className:"block-directory-downloadable-block-notice",children:(0,oe.jsxs)("div",{className:"block-directory-downloadable-block-notice__content",children:[t.message,t.isFatal?" "+(0,v.__)("Try reloading the page."):null]})}):null},de=window.wp.privateApis,{lock:ue,unlock:pe}=(0,de.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/block-directory"),{CompositeItemV2:be}=pe(J.privateApis);function ke({title:e,rating:t,ratingCount:o},{hasNotice:l,isInstalled:s,isInstalling:n}){const r=.5*Math.round(t/.5);return!s&&l?(0,v.sprintf)("Retry installing %s.",(0,X.decodeEntities)(e)):s?(0,v.sprintf)("Add %s.",(0,X.decodeEntities)(e)):n?(0,v.sprintf)("Installing %s.",(0,X.decodeEntities)(e)):o<1?(0,v.sprintf)("Install %s.",(0,X.decodeEntities)(e)):(0,v.sprintf)((0,v._n)("Install %1$s. %2$s stars with %3$s review.","Install %1$s. %2$s stars with %3$s reviews.",o),(0,X.decodeEntities)(e),r,o)}const he=function({composite:e,item:t,onClick:o}){const{author:l,description:s,icon:n,rating:r,title:d}=t,u=!!(0,i.getBlockType)(t.name),{hasNotice:p,isInstalling:b,isInstallable:k}=(0,a.useSelect)((e=>{const{getErrorNoticeForBlock:o,isInstalling:l}=e(G),s=o(t.id),n=s&&s.isFatal;return{hasNotice:!!s,isInstalling:l(t.id),isInstallable:!n}}),[t]);let h="";return u?h=(0,v.__)("Installed!"):b&&(h=(0,v.__)("Installing…")),(0,oe.jsxs)(be,{render:(0,oe.jsx)(J.Button,{__experimentalIsFocusable:!0,type:"button",role:"option",className:"block-directory-downloadable-block-list-item",isBusy:b,onClick:e=>{e.preventDefault(),o()},label:ke(t,{hasNotice:p,isInstalled:u,isInstalling:b}),showTooltip:!0,tooltipPosition:"top center"}),store:e,disabled:b||!k,children:[(0,oe.jsxs)("div",{className:"block-directory-downloadable-block-list-item__icon",children:[(0,oe.jsx)(ae,{icon:n,title:d}),b?(0,oe.jsx)("span",{className:"block-directory-downloadable-block-list-item__spinner",children:(0,oe.jsx)(J.Spinner,{})}):(0,oe.jsx)(ie,{rating:r})]}),(0,oe.jsxs)("span",{className:"block-directory-downloadable-block-list-item__details",children:[(0,oe.jsx)("span",{className:"block-directory-downloadable-block-list-item__title",children:(0,c.createInterpolateElement)((0,v.sprintf)((0,v.__)("%1$s by %2$s"),(0,X.decodeEntities)(d),l),{span:(0,oe.jsx)("span",{className:"block-directory-downloadable-block-list-item__author"})})}),p?(0,oe.jsx)(ce,{block:t}):(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)("span",{className:"block-directory-downloadable-block-list-item__desc",children:h||(0,X.decodeEntities)(s)}),k&&!(u||b)&&(0,oe.jsx)(J.VisuallyHidden,{children:(0,v.__)("Install block")})]})]})]})},{CompositeV2:me,useCompositeStoreV2:ge}=pe(J.privateApis),we=()=>{};const _e=function({items:e,onHover:t=we,onSelect:o}){const l=ge(),{installBlockType:s}=(0,a.useDispatch)(G);return e.length?(0,oe.jsx)(me,{store:l,role:"listbox",className:"block-directory-downloadable-blocks-list","aria-label":(0,v.__)("Blocks available for install"),children:e.map((e=>(0,oe.jsx)(he,{composite:l,onClick:()=>{(0,i.getBlockType)(e.name)?o(e):s(e).then((t=>{t&&o(e)})),t(null)},onHover:t,item:e},e.id)))}):null},fe=window.wp.a11y;const ye=function({children:e,downloadableItems:t,hasLocalBlocks:o}){const l=t.length;return(0,c.useEffect)((()=>{(0,fe.speak)((0,v.sprintf)((0,v._n)("%d additional block is available to install.","%d additional blocks are available to install.",l),l))}),[l]),(0,oe.jsxs)(oe.Fragment,{children:[!o&&(0,oe.jsx)("p",{className:"block-directory-downloadable-blocks-panel__no-local",children:(0,v.__)("No results available from your installed blocks.")}),(0,oe.jsx)("div",{className:"block-editor-inserter__quick-inserter-separator"}),(0,oe.jsxs)("div",{className:"block-directory-downloadable-blocks-panel",children:[(0,oe.jsxs)("div",{className:"block-directory-downloadable-blocks-panel__header",children:[(0,oe.jsx)("h2",{className:"block-directory-downloadable-blocks-panel__title",children:(0,v.__)("Available to install")}),(0,oe.jsx)("p",{className:"block-directory-downloadable-blocks-panel__description",children:(0,v.__)("Select a block to install and add it to your post.")})]}),e]})]})},ve=(0,oe.jsx)(te.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,oe.jsx)(te.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"})});const xe=function(){return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsxs)("div",{className:"block-editor-inserter__no-results",children:[(0,oe.jsx)(ee,{className:"block-editor-inserter__no-results-icon",icon:ve}),(0,oe.jsx)("p",{children:(0,v.__)("No results found.")})]}),(0,oe.jsx)("div",{className:"block-editor-inserter__tips",children:(0,oe.jsxs)(J.Tip,{children:[(0,v.__)("Interested in creating your own block?"),(0,oe.jsx)("br",{}),(0,oe.jsxs)(J.ExternalLink,{href:"https://developer.wordpress.org/block-editor/",children:[(0,v.__)("Get started here"),"."]})]})})]})},je=[],Be=e=>(0,a.useSelect)((t=>{const{getDownloadableBlocks:o,isRequestingDownloadableBlocks:l,getInstalledBlockTypes:s}=t(G),n=t(Q.store).canUser("read","block-directory/search");let r=je;if(n){r=o(e);const t=s(),l=r.filter((({name:e})=>{const o=t.some((t=>t.name===e)),l=(0,i.getBlockType)(e);return o||!l}));l.length!==r.length&&(r=l),0===r.length&&(r=je)}return{hasPermission:n,downloadableBlocks:r,isLoading:l(e)}}),[e]);function Ee({onSelect:e,onHover:t,hasLocalBlocks:o,isTyping:l,filterValue:s}){const{hasPermission:n,downloadableBlocks:r,isLoading:i}=Be(s);return void 0===n||i||l?(0,oe.jsxs)(oe.Fragment,{children:[n&&!o&&(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)("p",{className:"block-directory-downloadable-blocks-panel__no-local",children:(0,v.__)("No results available from your installed blocks.")}),(0,oe.jsx)("div",{className:"block-editor-inserter__quick-inserter-separator"})]}),(0,oe.jsx)("div",{className:"block-directory-downloadable-blocks-panel has-blocks-loading",children:(0,oe.jsx)(J.Spinner,{})})]}):!1===n||0===r.length?o?null:(0,oe.jsx)(xe,{}):(0,oe.jsx)(ye,{downloadableItems:r,hasLocalBlocks:o,children:(0,oe.jsx)(_e,{items:r,onSelect:e,onHover:t})})}const Ie=function(){const[e,t]=(0,c.useState)(""),o=(0,Z.debounce)(t,400);return(0,oe.jsx)(p.__unstableInserterMenuExtension,{children:({onSelect:t,onHover:l,filterValue:s,hasItems:n})=>(e!==s&&o(s),e?(0,oe.jsx)(Ee,{onSelect:t,onHover:l,filterValue:e,hasLocalBlocks:n,isTyping:s!==e}):null)})};function Ne({items:e}){return e.length?(0,oe.jsx)("ul",{className:"block-directory-compact-list",children:e.map((({icon:e,id:t,title:o,author:l})=>(0,oe.jsxs)("li",{className:"block-directory-compact-list__item",children:[(0,oe.jsx)(ae,{icon:e,title:o}),(0,oe.jsxs)("div",{className:"block-directory-compact-list__item-details",children:[(0,oe.jsx)("div",{className:"block-directory-compact-list__item-title",children:o}),(0,oe.jsx)("div",{className:"block-directory-compact-list__item-author",children:(0,v.sprintf)((0,v.__)("By %s"),l)})]})]},t)))}):null}var Te;const{PluginPrePublishPanel:Le}=null!==(Te=window?.wp?.editor)&&void 0!==Te?Te:{};function Se(){const e=(0,a.useSelect)((e=>e(G).getNewBlockTypes()),[]);return e.length?(0,oe.jsxs)(Le,{icon:ve,title:(0,v.sprintf)((0,v._n)("Added: %d block","Added: %d blocks",e.length),e.length),initialOpen:!0,children:[(0,oe.jsx)("p",{className:"installed-blocks-pre-publish-panel__copy",children:(0,v._n)("The following block has been added to your site.","The following blocks have been added to your site.",e.length)}),(0,oe.jsx)(Ne,{items:e})]}):null}function Oe({attributes:e,block:t,clientId:o}){const l=(0,a.useSelect)((e=>e(G).isInstalling(t.id)),[t.id]),{installBlockType:s}=(0,a.useDispatch)(G),{replaceBlock:n}=(0,a.useDispatch)(p.store);return(0,oe.jsx)(J.Button,{onClick:()=>s(t).then((l=>{if(l){const l=(0,i.getBlockType)(t.name),[s]=(0,i.parse)(e.originalContent);s&&l&&n(o,(0,i.createBlock)(l.name,s.attributes,s.innerBlocks))}})),__experimentalIsFocusable:!0,disabled:l,isBusy:l,variant:"primary",children:(0,v.sprintf)((0,v.__)("Install %s"),t.title)})}const Ce=({originalBlock:e,...t})=>{const{originalName:o,originalUndelimitedContent:l,clientId:s}=t.attributes,{replaceBlock:n}=(0,a.useDispatch)(p.store),r=()=>{n(t.clientId,(0,i.createBlock)("core/html",{content:l}))},d=!!l,u=(0,a.useSelect)((e=>{const{canInsertBlockType:t,getBlockRootClientId:o}=e(p.store);return t("core/html",o(s))}),[s]);let b=(0,v.sprintf)((0,v.__)("Your site doesn’t include support for the %s block. You can try installing the block or remove it entirely."),e.title||o);const k=[(0,oe.jsx)(Oe,{block:e,attributes:t.attributes,clientId:t.clientId},"install")];return d&&u&&(b=(0,v.sprintf)((0,v.__)("Your site doesn’t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely."),e.title||o),k.push((0,oe.jsx)(J.Button,{onClick:r,variant:"tertiary",children:(0,v.__)("Keep as HTML")},"convert"))),(0,oe.jsxs)("div",{...(0,p.useBlockProps)(),children:[(0,oe.jsx)(p.Warning,{actions:k,children:b}),(0,oe.jsx)(c.RawHTML,{children:l})]})},Ae=e=>t=>{const{originalName:o}=t.attributes,{block:l,hasPermission:s}=(0,a.useSelect)((e=>{const{getDownloadableBlocks:t}=e(G),l=t("block:"+o).filter((({name:e})=>o===e));return{hasPermission:e(Q.store).canUser("read","block-directory/search"),block:l.length&&l[0]}}),[o]);return s&&l?(0,oe.jsx)(Ce,{...t,originalBlock:l}):(0,oe.jsx)(e,{...t})};(0,n.registerPlugin)("block-directory",{render:()=>(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(W,{}),(0,oe.jsx)(Ie,{}),(0,oe.jsx)(Se,{})]})}),(0,r.addFilter)("blocks.registerBlockType","block-directory/fallback",((e,t)=>("core/missing"!==t||(e.edit=Ae(e.edit)),e))),(window.wp=window.wp||{}).blockDirectory=t})(); \ No newline at end of file diff --git a/wp-includes/js/dist/block-editor.js b/wp-includes/js/dist/block-editor.js index ab7f119..720b7a1 100644 --- a/wp-includes/js/dist/block-editor.js +++ b/wp-includes/js/dist/block-editor.js @@ -288,72 +288,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ module.exports = exports['default']; }); -/***/ }), - -/***/ 5755: -/***/ ((module, exports) => { - -var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! - Copyright (c) 2018 Jed Watson. - Licensed under the MIT License (MIT), see - http://jedwatson.github.io/classnames -*/ -/* global define */ - -(function () { - 'use strict'; - - var hasOwn = {}.hasOwnProperty; - var nativeCodeString = '[native code]'; - - function classNames() { - var classes = []; - - for (var i = 0; i < arguments.length; i++) { - var arg = arguments[i]; - if (!arg) continue; - - var argType = typeof arg; - - if (argType === 'string' || argType === 'number') { - classes.push(arg); - } else if (Array.isArray(arg)) { - if (arg.length) { - var inner = classNames.apply(null, arg); - if (inner) { - classes.push(inner); - } - } - } else if (argType === 'object') { - if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) { - classes.push(arg.toString()); - continue; - } - - for (var key in arg) { - if (hasOwn.call(arg, key) && arg[key]) { - classes.push(key); - } - } - } - } - - return classes.join(' '); - } - - if ( true && module.exports) { - classNames.default = classNames; - module.exports = classNames; - } else if (true) { - // register as 'classnames', consistent with npm package name - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { - return classNames; - }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else {} -}()); - - /***/ }), /***/ 6109: @@ -744,598 +678,6 @@ function diffChars(oldStr, newStr, options) { } -/***/ }), - -/***/ 1637: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var util = __webpack_require__(3062); - -function scrollIntoView(elem, container, config) { - config = config || {}; - // document 归一化到 window - if (container.nodeType === 9) { - container = util.getWindow(container); - } - - var allowHorizontalScroll = config.allowHorizontalScroll; - var onlyScrollIfNeeded = config.onlyScrollIfNeeded; - var alignWithTop = config.alignWithTop; - var alignWithLeft = config.alignWithLeft; - var offsetTop = config.offsetTop || 0; - var offsetLeft = config.offsetLeft || 0; - var offsetBottom = config.offsetBottom || 0; - var offsetRight = config.offsetRight || 0; - - allowHorizontalScroll = allowHorizontalScroll === undefined ? true : allowHorizontalScroll; - - var isWin = util.isWindow(container); - var elemOffset = util.offset(elem); - var eh = util.outerHeight(elem); - var ew = util.outerWidth(elem); - var containerOffset = undefined; - var ch = undefined; - var cw = undefined; - var containerScroll = undefined; - var diffTop = undefined; - var diffBottom = undefined; - var win = undefined; - var winScroll = undefined; - var ww = undefined; - var wh = undefined; - - if (isWin) { - win = container; - wh = util.height(win); - ww = util.width(win); - winScroll = { - left: util.scrollLeft(win), - top: util.scrollTop(win) - }; - // elem 相对 container 可视视窗的距离 - diffTop = { - left: elemOffset.left - winScroll.left - offsetLeft, - top: elemOffset.top - winScroll.top - offsetTop - }; - diffBottom = { - left: elemOffset.left + ew - (winScroll.left + ww) + offsetRight, - top: elemOffset.top + eh - (winScroll.top + wh) + offsetBottom - }; - containerScroll = winScroll; - } else { - containerOffset = util.offset(container); - ch = container.clientHeight; - cw = container.clientWidth; - containerScroll = { - left: container.scrollLeft, - top: container.scrollTop - }; - // elem 相对 container 可视视窗的距离 - // 注意边框, offset 是边框到根节点 - diffTop = { - left: elemOffset.left - (containerOffset.left + (parseFloat(util.css(container, 'borderLeftWidth')) || 0)) - offsetLeft, - top: elemOffset.top - (containerOffset.top + (parseFloat(util.css(container, 'borderTopWidth')) || 0)) - offsetTop - }; - diffBottom = { - left: elemOffset.left + ew - (containerOffset.left + cw + (parseFloat(util.css(container, 'borderRightWidth')) || 0)) + offsetRight, - top: elemOffset.top + eh - (containerOffset.top + ch + (parseFloat(util.css(container, 'borderBottomWidth')) || 0)) + offsetBottom - }; - } - - if (diffTop.top < 0 || diffBottom.top > 0) { - // 强制向上 - if (alignWithTop === true) { - util.scrollTop(container, containerScroll.top + diffTop.top); - } else if (alignWithTop === false) { - util.scrollTop(container, containerScroll.top + diffBottom.top); - } else { - // 自动调整 - if (diffTop.top < 0) { - util.scrollTop(container, containerScroll.top + diffTop.top); - } else { - util.scrollTop(container, containerScroll.top + diffBottom.top); - } - } - } else { - if (!onlyScrollIfNeeded) { - alignWithTop = alignWithTop === undefined ? true : !!alignWithTop; - if (alignWithTop) { - util.scrollTop(container, containerScroll.top + diffTop.top); - } else { - util.scrollTop(container, containerScroll.top + diffBottom.top); - } - } - } - - if (allowHorizontalScroll) { - if (diffTop.left < 0 || diffBottom.left > 0) { - // 强制向上 - if (alignWithLeft === true) { - util.scrollLeft(container, containerScroll.left + diffTop.left); - } else if (alignWithLeft === false) { - util.scrollLeft(container, containerScroll.left + diffBottom.left); - } else { - // 自动调整 - if (diffTop.left < 0) { - util.scrollLeft(container, containerScroll.left + diffTop.left); - } else { - util.scrollLeft(container, containerScroll.left + diffBottom.left); - } - } - } else { - if (!onlyScrollIfNeeded) { - alignWithLeft = alignWithLeft === undefined ? true : !!alignWithLeft; - if (alignWithLeft) { - util.scrollLeft(container, containerScroll.left + diffTop.left); - } else { - util.scrollLeft(container, containerScroll.left + diffBottom.left); - } - } - } - } -} - -module.exports = scrollIntoView; - -/***/ }), - -/***/ 5428: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = __webpack_require__(1637); - -/***/ }), - -/***/ 3062: -/***/ ((module) => { - -"use strict"; - - -var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; - -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; - -var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source; - -function getClientPosition(elem) { - var box = undefined; - var x = undefined; - var y = undefined; - var doc = elem.ownerDocument; - var body = doc.body; - var docElem = doc && doc.documentElement; - // 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式 - box = elem.getBoundingClientRect(); - - // 注:jQuery 还考虑减去 docElem.clientLeft/clientTop - // 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确 - // 此外,ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin - - x = box.left; - y = box.top; - - // In IE, most of the time, 2 extra pixels are added to the top and left - // due to the implicit 2-pixel inset border. In IE6/7 quirks mode and - // IE6 standards mode, this border can be overridden by setting the - // document element's border to zero -- thus, we cannot rely on the - // offset always being 2 pixels. - - // In quirks mode, the offset can be determined by querying the body's - // clientLeft/clientTop, but in standards mode, it is found by querying - // the document element's clientLeft/clientTop. Since we already called - // getClientBoundingRect we have already forced a reflow, so it is not - // too expensive just to query them all. - - // ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的 - // 窗口边框标准是设 documentElement ,quirks 时设置 body - // 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去 - // 但是非 ie 不可能设置窗口边框,body html 也不是窗口 ,ie 可以通过 html,body 设置 - // 标准 ie 下 docElem.clientTop 就是 border-top - // ie7 html 即窗口边框改变不了。永远为 2 - // 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0 - - x -= docElem.clientLeft || body.clientLeft || 0; - y -= docElem.clientTop || body.clientTop || 0; - - return { - left: x, - top: y - }; -} - -function getScroll(w, top) { - var ret = w['page' + (top ? 'Y' : 'X') + 'Offset']; - var method = 'scroll' + (top ? 'Top' : 'Left'); - if (typeof ret !== 'number') { - var d = w.document; - // ie6,7,8 standard mode - ret = d.documentElement[method]; - if (typeof ret !== 'number') { - // quirks mode - ret = d.body[method]; - } - } - return ret; -} - -function getScrollLeft(w) { - return getScroll(w); -} - -function getScrollTop(w) { - return getScroll(w, true); -} - -function getOffset(el) { - var pos = getClientPosition(el); - var doc = el.ownerDocument; - var w = doc.defaultView || doc.parentWindow; - pos.left += getScrollLeft(w); - pos.top += getScrollTop(w); - return pos; -} -function _getComputedStyle(elem, name, computedStyle_) { - var val = ''; - var d = elem.ownerDocument; - var computedStyle = computedStyle_ || d.defaultView.getComputedStyle(elem, null); - - // https://github.com/kissyteam/kissy/issues/61 - if (computedStyle) { - val = computedStyle.getPropertyValue(name) || computedStyle[name]; - } - - return val; -} - -var _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i'); -var RE_POS = /^(top|right|bottom|left)$/; -var CURRENT_STYLE = 'currentStyle'; -var RUNTIME_STYLE = 'runtimeStyle'; -var LEFT = 'left'; -var PX = 'px'; - -function _getComputedStyleIE(elem, name) { - // currentStyle maybe null - // http://msdn.microsoft.com/en-us/library/ms535231.aspx - var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name]; - - // 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值 - // 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19 - // 在 ie 下不对,需要直接用 offset 方式 - // borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了 - - // From the awesome hack by Dean Edwards - // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 - // If we're not dealing with a regular pixel number - // but a number that has a weird ending, we need to convert it to pixels - // exclude left right for relativity - if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) { - // Remember the original values - var style = elem.style; - var left = style[LEFT]; - var rsLeft = elem[RUNTIME_STYLE][LEFT]; - - // prevent flashing of content - elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT]; - - // Put in the new values to get a computed value out - style[LEFT] = name === 'fontSize' ? '1em' : ret || 0; - ret = style.pixelLeft + PX; - - // Revert the changed values - style[LEFT] = left; - - elem[RUNTIME_STYLE][LEFT] = rsLeft; - } - return ret === '' ? 'auto' : ret; -} - -var getComputedStyleX = undefined; -if (typeof window !== 'undefined') { - getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE; -} - -function each(arr, fn) { - for (var i = 0; i < arr.length; i++) { - fn(arr[i]); - } -} - -function isBorderBoxFn(elem) { - return getComputedStyleX(elem, 'boxSizing') === 'border-box'; -} - -var BOX_MODELS = ['margin', 'border', 'padding']; -var CONTENT_INDEX = -1; -var PADDING_INDEX = 2; -var BORDER_INDEX = 1; -var MARGIN_INDEX = 0; - -function swap(elem, options, callback) { - var old = {}; - var style = elem.style; - var name = undefined; - - // Remember the old values, and insert the new ones - for (name in options) { - if (options.hasOwnProperty(name)) { - old[name] = style[name]; - style[name] = options[name]; - } - } - - callback.call(elem); - - // Revert the old values - for (name in options) { - if (options.hasOwnProperty(name)) { - style[name] = old[name]; - } - } -} - -function getPBMWidth(elem, props, which) { - var value = 0; - var prop = undefined; - var j = undefined; - var i = undefined; - for (j = 0; j < props.length; j++) { - prop = props[j]; - if (prop) { - for (i = 0; i < which.length; i++) { - var cssProp = undefined; - if (prop === 'border') { - cssProp = prop + which[i] + 'Width'; - } else { - cssProp = prop + which[i]; - } - value += parseFloat(getComputedStyleX(elem, cssProp)) || 0; - } - } - } - return value; -} - -/** - * A crude way of determining if an object is a window - * @member util - */ -function isWindow(obj) { - // must use == for ie8 - /* eslint eqeqeq:0 */ - return obj != null && obj == obj.window; -} - -var domUtils = {}; - -each(['Width', 'Height'], function (name) { - domUtils['doc' + name] = function (refWin) { - var d = refWin.document; - return Math.max( - // firefox chrome documentElement.scrollHeight< body.scrollHeight - // ie standard mode : documentElement.scrollHeight> body.scrollHeight - d.documentElement['scroll' + name], - // quirks : documentElement.scrollHeight 最大等于可视窗口多一点? - d.body['scroll' + name], domUtils['viewport' + name](d)); - }; - - domUtils['viewport' + name] = function (win) { - // pc browser includes scrollbar in window.innerWidth - var prop = 'client' + name; - var doc = win.document; - var body = doc.body; - var documentElement = doc.documentElement; - var documentElementProp = documentElement[prop]; - // 标准模式取 documentElement - // backcompat 取 body - return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp; - }; -}); - -/* - 得到元素的大小信息 - @param elem - @param name - @param {String} [extra] 'padding' : (css width) + padding - 'border' : (css width) + padding + border - 'margin' : (css width) + padding + border + margin - */ -function getWH(elem, name, extra) { - if (isWindow(elem)) { - return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem); - } else if (elem.nodeType === 9) { - return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem); - } - var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom']; - var borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight; - var computedStyle = getComputedStyleX(elem); - var isBorderBox = isBorderBoxFn(elem, computedStyle); - var cssBoxValue = 0; - if (borderBoxValue == null || borderBoxValue <= 0) { - borderBoxValue = undefined; - // Fall back to computed then un computed css if necessary - cssBoxValue = getComputedStyleX(elem, name); - if (cssBoxValue == null || Number(cssBoxValue) < 0) { - cssBoxValue = elem.style[name] || 0; - } - // Normalize '', auto, and prepare for extra - cssBoxValue = parseFloat(cssBoxValue) || 0; - } - if (extra === undefined) { - extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX; - } - var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox; - var val = borderBoxValue || cssBoxValue; - if (extra === CONTENT_INDEX) { - if (borderBoxValueOrIsBorderBox) { - return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle); - } - return cssBoxValue; - } - if (borderBoxValueOrIsBorderBox) { - var padding = extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle); - return val + (extra === BORDER_INDEX ? 0 : padding); - } - return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle); -} - -var cssShow = { - position: 'absolute', - visibility: 'hidden', - display: 'block' -}; - -// fix #119 : https://github.com/kissyteam/kissy/issues/119 -function getWHIgnoreDisplay(elem) { - var val = undefined; - var args = arguments; - // in case elem is window - // elem.offsetWidth === undefined - if (elem.offsetWidth !== 0) { - val = getWH.apply(undefined, args); - } else { - swap(elem, cssShow, function () { - val = getWH.apply(undefined, args); - }); - } - return val; -} - -function css(el, name, v) { - var value = v; - if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') { - for (var i in name) { - if (name.hasOwnProperty(i)) { - css(el, i, name[i]); - } - } - return undefined; - } - if (typeof value !== 'undefined') { - if (typeof value === 'number') { - value += 'px'; - } - el.style[name] = value; - return undefined; - } - return getComputedStyleX(el, name); -} - -each(['width', 'height'], function (name) { - var first = name.charAt(0).toUpperCase() + name.slice(1); - domUtils['outer' + first] = function (el, includeMargin) { - return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX); - }; - var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom']; - - domUtils[name] = function (elem, val) { - if (val !== undefined) { - if (elem) { - var computedStyle = getComputedStyleX(elem); - var isBorderBox = isBorderBoxFn(elem); - if (isBorderBox) { - val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle); - } - return css(elem, name, val); - } - return undefined; - } - return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX); - }; -}); - -// 设置 elem 相对 elem.ownerDocument 的坐标 -function setOffset(elem, offset) { - // set position first, in-case top/left are set even on static elem - if (css(elem, 'position') === 'static') { - elem.style.position = 'relative'; - } - - var old = getOffset(elem); - var ret = {}; - var current = undefined; - var key = undefined; - - for (key in offset) { - if (offset.hasOwnProperty(key)) { - current = parseFloat(css(elem, key)) || 0; - ret[key] = current + offset[key] - old[key]; - } - } - css(elem, ret); -} - -module.exports = _extends({ - getWindow: function getWindow(node) { - var doc = node.ownerDocument || node; - return doc.defaultView || doc.parentWindow; - }, - offset: function offset(el, value) { - if (typeof value !== 'undefined') { - setOffset(el, value); - } else { - return getOffset(el); - } - }, - - isWindow: isWindow, - each: each, - css: css, - clone: function clone(obj) { - var ret = {}; - for (var i in obj) { - if (obj.hasOwnProperty(i)) { - ret[i] = obj[i]; - } - } - var overflow = obj.overflow; - if (overflow) { - for (var i in obj) { - if (obj.hasOwnProperty(i)) { - ret.overflow[i] = obj.overflow[i]; - } - } - } - return ret; - }, - scrollLeft: function scrollLeft(w, v) { - if (isWindow(w)) { - if (v === undefined) { - return getScrollLeft(w); - } - window.scrollTo(v, getScrollTop(w)); - } else { - if (v === undefined) { - return w.scrollLeft; - } - w.scrollLeft = v; - } - }, - scrollTop: function scrollTop(w, v) { - if (isWindow(w)) { - if (v === undefined) { - return getScrollTop(w); - } - window.scrollTo(getScrollLeft(w), v); - } else { - if (v === undefined) { - return w.scrollTop; - } - w.scrollTop = v; - } - }, - - viewportWidth: 0, - viewportHeight: 0 -}, domUtils); - /***/ }), /***/ 7734: @@ -4836,9 +4178,14 @@ class MapGenerator { } else if (this.previous().length === 1) { let prev = this.previous()[0].consumer() prev.file = this.outputFile() - this.map = SourceMapGenerator.fromSourceMap(prev) + this.map = SourceMapGenerator.fromSourceMap(prev, { + ignoreInvalidMapping: true + }) } else { - this.map = new SourceMapGenerator({ file: this.outputFile() }) + this.map = new SourceMapGenerator({ + file: this.outputFile(), + ignoreInvalidMapping: true + }) this.map.addMapping({ generated: { column: 0, line: 1 }, original: { column: 0, line: 1 }, @@ -4861,7 +4208,10 @@ class MapGenerator { generateString() { this.css = '' - this.map = new SourceMapGenerator({ file: this.outputFile() }) + this.map = new SourceMapGenerator({ + file: this.outputFile(), + ignoreInvalidMapping: true + }) let line = 1 let column = 1 @@ -5485,7 +4835,7 @@ class Node { column: opts.end.column, line: opts.end.line } - } else if (opts.endIndex) { + } else if (typeof opts.endIndex === 'number') { end = this.positionInside(opts.endIndex) } else if (opts.index) { end = this.positionInside(opts.index + 1) @@ -6547,7 +5897,7 @@ let Root = __webpack_require__(9434) class Processor { constructor(plugins = []) { - this.version = '8.4.35' + this.version = '8.4.38' this.plugins = this.normalize(plugins) } @@ -8404,6 +7754,7 @@ __webpack_require__.d(__webpack_exports__, { BlockList: () => (/* reexport */ BlockList), BlockMover: () => (/* reexport */ block_mover), BlockNavigationDropdown: () => (/* reexport */ dropdown), + BlockPopover: () => (/* reexport */ block_popover), BlockPreview: () => (/* reexport */ block_preview), BlockSelectionClearer: () => (/* reexport */ BlockSelectionClearer), BlockSettingsMenu: () => (/* reexport */ block_settings_menu), @@ -8446,7 +7797,7 @@ __webpack_require__.d(__webpack_exports__, { RichTextShortcut: () => (/* reexport */ RichTextShortcut), RichTextToolbarButton: () => (/* reexport */ RichTextToolbarButton), SETTINGS_DEFAULTS: () => (/* reexport */ SETTINGS_DEFAULTS), - SkipToSelectedBlock: () => (/* reexport */ skip_to_selected_block), + SkipToSelectedBlock: () => (/* reexport */ SkipToSelectedBlock), ToolSelector: () => (/* reexport */ tool_selector), Typewriter: () => (/* reexport */ typewriter), URLInput: () => (/* reexport */ url_input), @@ -8508,7 +7859,7 @@ __webpack_require__.d(__webpack_exports__, { __unstableBlockNameContext: () => (/* reexport */ block_name_context), __unstableBlockSettingsMenuFirstItem: () => (/* reexport */ block_settings_menu_first_item), __unstableBlockToolbarLastItem: () => (/* reexport */ block_toolbar_last_item), - __unstableEditorStyles: () => (/* reexport */ EditorStyles), + __unstableEditorStyles: () => (/* reexport */ editor_styles), __unstableIframe: () => (/* reexport */ iframe), __unstableInserterMenuExtension: () => (/* reexport */ inserter_menu_extension), __unstableRichTextInputEvent: () => (/* reexport */ __unstableRichTextInputEvent), @@ -8546,11 +7897,42 @@ __webpack_require__.d(__webpack_exports__, { useInnerBlocksProps: () => (/* reexport */ useInnerBlocksProps), useSetting: () => (/* reexport */ useSetting), useSettings: () => (/* reexport */ use_settings_useSettings), + useZoomOut: () => (/* reexport */ useZoomOut), withColorContext: () => (/* reexport */ with_color_context), withColors: () => (/* reexport */ withColors), withFontSizes: () => (/* reexport */ with_font_sizes) }); +// NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/private-selectors.js +var private_selectors_namespaceObject = {}; +__webpack_require__.r(private_selectors_namespaceObject); +__webpack_require__.d(private_selectors_namespaceObject, { + getAllPatterns: () => (getAllPatterns), + getBlockRemovalRules: () => (getBlockRemovalRules), + getBlockSettings: () => (getBlockSettings), + getBlockWithoutAttributes: () => (getBlockWithoutAttributes), + getContentLockingParent: () => (getContentLockingParent), + getEnabledBlockParents: () => (getEnabledBlockParents), + getEnabledClientIdsTree: () => (getEnabledClientIdsTree), + getExpandedBlock: () => (getExpandedBlock), + getInserterMediaCategories: () => (getInserterMediaCategories), + getLastFocus: () => (getLastFocus), + getLastInsertedBlocksClientIds: () => (getLastInsertedBlocksClientIds), + getOpenedBlockSettingsMenu: () => (getOpenedBlockSettingsMenu), + getPatternBySlug: () => (getPatternBySlug), + getRegisteredInserterMediaCategories: () => (getRegisteredInserterMediaCategories), + getRemovalPromptData: () => (getRemovalPromptData), + getReusableBlocks: () => (getReusableBlocks), + getStyleOverrides: () => (getStyleOverrides), + getTemporarilyEditingAsBlocks: () => (getTemporarilyEditingAsBlocks), + getTemporarilyEditingFocusModeToRevert: () => (getTemporarilyEditingFocusModeToRevert), + hasAllowedPatterns: () => (hasAllowedPatterns), + isBlockInterfaceHidden: () => (private_selectors_isBlockInterfaceHidden), + isBlockSubtreeDisabled: () => (isBlockSubtreeDisabled), + isDragging: () => (private_selectors_isDragging), + isResolvingPatterns: () => (isResolvingPatterns) +}); + // NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/selectors.js var selectors_namespaceObject = {}; __webpack_require__.r(selectors_namespaceObject); @@ -8679,7 +8061,9 @@ __webpack_require__.d(private_actions_namespaceObject, { clearBlockRemovalPrompt: () => (clearBlockRemovalPrompt), deleteStyleOverride: () => (deleteStyleOverride), ensureDefaultBlock: () => (ensureDefaultBlock), + expandBlock: () => (expandBlock), hideBlockInterface: () => (hideBlockInterface), + modifyContentLockBlock: () => (modifyContentLockBlock), privateRemoveBlocks: () => (privateRemoveBlocks), setBlockRemovalRules: () => (setBlockRemovalRules), setLastFocus: () => (setLastFocus), @@ -8692,29 +8076,6 @@ __webpack_require__.d(private_actions_namespaceObject, { syncDerivedUpdates: () => (syncDerivedUpdates) }); -// NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/private-selectors.js -var private_selectors_namespaceObject = {}; -__webpack_require__.r(private_selectors_namespaceObject); -__webpack_require__.d(private_selectors_namespaceObject, { - getAllPatterns: () => (getAllPatterns), - getBlockRemovalRules: () => (getBlockRemovalRules), - getBlockSettings: () => (getBlockSettings), - getBlockWithoutAttributes: () => (getBlockWithoutAttributes), - getEnabledBlockParents: () => (getEnabledBlockParents), - getEnabledClientIdsTree: () => (getEnabledClientIdsTree), - getInserterMediaCategories: () => (getInserterMediaCategories), - getLastFocus: () => (getLastFocus), - getLastInsertedBlocksClientIds: () => (getLastInsertedBlocksClientIds), - getOpenedBlockSettingsMenu: () => (getOpenedBlockSettingsMenu), - getRegisteredInserterMediaCategories: () => (getRegisteredInserterMediaCategories), - getRemovalPromptData: () => (getRemovalPromptData), - getStyleOverrides: () => (getStyleOverrides), - hasAllowedPatterns: () => (hasAllowedPatterns), - isBlockInterfaceHidden: () => (private_selectors_isBlockInterfaceHidden), - isBlockSubtreeDisabled: () => (isBlockSubtreeDisabled), - isDragging: () => (private_selectors_isDragging) -}); - // NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/actions.js var actions_namespaceObject = {}; __webpack_require__.r(actions_namespaceObject); @@ -8788,6 +8149,7 @@ var global_styles_namespaceObject = {}; __webpack_require__.r(global_styles_namespaceObject); __webpack_require__.d(global_styles_namespaceObject, { AdvancedPanel: () => (AdvancedPanel), + BackgroundPanel: () => (BackgroundPanel), BorderPanel: () => (BorderPanel), ColorPanel: () => (ColorPanel), DimensionsPanel: () => (DimensionsPanel), @@ -8797,13 +8159,17 @@ __webpack_require__.d(global_styles_namespaceObject, { TypographyPanel: () => (TypographyPanel), areGlobalStyleConfigsEqual: () => (areGlobalStyleConfigsEqual), getBlockCSSSelector: () => (getBlockCSSSelector), + getBlockSelectors: () => (getBlockSelectors), getGlobalStylesChanges: () => (getGlobalStylesChanges), getLayoutStyles: () => (getLayoutStyles), + toStyles: () => (toStyles), useGlobalSetting: () => (useGlobalSetting), useGlobalStyle: () => (useGlobalStyle), + useGlobalStyleLinks: () => (useGlobalStyleLinks), useGlobalStylesOutput: () => (useGlobalStylesOutput), useGlobalStylesOutputWithConfig: () => (useGlobalStylesOutputWithConfig), useGlobalStylesReset: () => (useGlobalStylesReset), + useHasBackgroundPanel: () => (useHasBackgroundPanel), useHasBorderPanel: () => (useHasBorderPanel), useHasBorderPanelControls: () => (useHasBorderPanelControls), useHasColorPanel: () => (useHasColorPanel), @@ -8814,9 +8180,6 @@ __webpack_require__.d(global_styles_namespaceObject, { useSettingsForBlockElement: () => (useSettingsForBlockElement) }); -// EXTERNAL MODULE: external "React" -var external_React_ = __webpack_require__(1609); -var external_React_default = /*#__PURE__*/__webpack_require__.n(external_React_); ;// CONCATENATED MODULE: external ["wp","blocks"] const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; ;// CONCATENATED MODULE: external ["wp","element"] @@ -8836,6 +8199,7 @@ const mayDisplayControlsKey = Symbol('mayDisplayControls'); const mayDisplayParentControlsKey = Symbol('mayDisplayParentControls'); const blockEditingModeKey = Symbol('blockEditingMode'); const blockBindingsKey = Symbol('blockBindings'); +const isPreviewModeKey = Symbol('isPreviewMode'); const DEFAULT_BLOCK_EDIT_CONTEXT = { name: '', isSelected: false @@ -9421,12 +8785,14 @@ const withBlockTree = reducer => (state = {}, action) => { { const inserterClientIds = getFlattenedClientIds(action.blocks); newState.tree = new Map(newState.tree); - action.replacedClientIds.concat( - // Controlled inner blocks are only removed - // if the block doesn't move to another position - // otherwise their content will be lost. - action.replacedClientIds.filter(clientId => !inserterClientIds[clientId]).map(clientId => 'controlled||' + clientId)).forEach(key => { - newState.tree.delete(key); + action.replacedClientIds.forEach(clientId => { + newState.tree.delete(clientId); + // Controlled inner blocks are only removed + // if the block doesn't move to another position + // otherwise their content will be lost. + if (!inserterClientIds[clientId]) { + newState.tree.delete('controlled||' + clientId); + } }); updateBlockTreeForBlocks(newState, action.blocks); updateParentInnerBlocksInTree(newState, action.blocks.map(b => b.clientId), false); @@ -9434,8 +8800,9 @@ const withBlockTree = reducer => (state = {}, action) => { // If there are no replaced blocks, it means we're removing blocks so we need to update their parent. const parentsOfRemovedBlocks = []; for (const clientId of action.clientIds) { - if (state.parents.get(clientId) !== undefined && (state.parents.get(clientId) === '' || newState.byClientId.get(state.parents.get(clientId)))) { - parentsOfRemovedBlocks.push(state.parents.get(clientId)); + const parentId = state.parents.get(clientId); + if (parentId !== undefined && (parentId === '' || newState.byClientId.get(parentId))) { + parentsOfRemovedBlocks.push(parentId); } } updateParentInnerBlocksInTree(newState, parentsOfRemovedBlocks, true); @@ -9444,13 +8811,15 @@ const withBlockTree = reducer => (state = {}, action) => { case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN': const parentsOfRemovedBlocks = []; for (const clientId of action.clientIds) { - if (state.parents.get(clientId) !== undefined && (state.parents.get(clientId) === '' || newState.byClientId.get(state.parents.get(clientId)))) { - parentsOfRemovedBlocks.push(state.parents.get(clientId)); + const parentId = state.parents.get(clientId); + if (parentId !== undefined && (parentId === '' || newState.byClientId.get(parentId))) { + parentsOfRemovedBlocks.push(parentId); } } newState.tree = new Map(newState.tree); - action.removedClientIds.concat(action.removedClientIds.map(clientId => 'controlled||' + clientId)).forEach(key => { - newState.tree.delete(key); + action.removedClientIds.forEach(clientId => { + newState.tree.delete(clientId); + newState.tree.delete('controlled||' + clientId); }); updateParentInnerBlocksInTree(newState, parentsOfRemovedBlocks, true); break; @@ -10458,14 +9827,12 @@ function removalPromptData(state = false, action) { const { clientIds, selectPrevious, - blockNamesForPrompt, - messageType + message } = action; return { clientIds, selectPrevious, - blockNamesForPrompt, - messageType + message }; case 'CLEAR_BLOCK_REMOVAL_PROMPT': return false; @@ -10626,32 +9993,35 @@ function preferences(state = PREFERENCES_DEFAULTS, action) { switch (action.type) { case 'INSERT_BLOCKS': case 'REPLACE_BLOCKS': - return action.blocks.reduce((prevState, block) => { - const { - attributes, - name: blockName - } = block; - let id = blockName; - // If a block variation match is found change the name to be the same with the - // one that is used for block variations in the Inserter (`getItemFromVariation`). - const match = (0,external_wp_data_namespaceObject.select)(external_wp_blocks_namespaceObject.store).getActiveBlockVariation(blockName, attributes); - if (match?.name) { - id += '/' + match.name; - } - if (blockName === 'core/block') { - id += '/' + attributes.ref; - } - return { - ...prevState, - insertUsage: { - ...prevState.insertUsage, + { + const nextInsertUsage = action.blocks.reduce((prevUsage, block) => { + const { + attributes, + name: blockName + } = block; + let id = blockName; + // If a block variation match is found change the name to be the same with the + // one that is used for block variations in the Inserter (`getItemFromVariation`). + const match = (0,external_wp_data_namespaceObject.select)(external_wp_blocks_namespaceObject.store).getActiveBlockVariation(blockName, attributes); + if (match?.name) { + id += '/' + match.name; + } + if (blockName === 'core/block') { + id += '/' + attributes.ref; + } + return { + ...prevUsage, [id]: { time: action.time, - count: prevState.insertUsage[id] ? prevState.insertUsage[id].count + 1 : 1 + count: prevUsage[id] ? prevUsage[id].count + 1 : 1 } - } + }; + }, state.insertUsage); + return { + ...state, + insertUsage: nextInsertUsage }; - }, state); + } } return state; } @@ -10676,26 +10046,33 @@ const blockListSettings = (state = {}, action) => { } case 'UPDATE_BLOCK_LIST_SETTINGS': { - const { - clientId - } = action; - if (!action.settings) { - if (state.hasOwnProperty(clientId)) { - const { - [clientId]: removedBlock, - ...restBlocks - } = state; - return restBlocks; + const updates = typeof action.clientId === 'string' ? { + [action.clientId]: action.settings + } : action.clientId; + + // Remove settings that are the same as the current state. + for (const clientId in updates) { + if (!updates[clientId]) { + if (!state[clientId]) { + delete updates[clientId]; + } + } else if (es6_default()(state[clientId], updates[clientId])) { + delete updates[clientId]; } - return state; } - if (es6_default()(state[clientId], action.settings)) { + if (Object.keys(updates).length === 0) { return state; } - return { + const merged = { ...state, - [clientId]: action.settings + ...updates }; + for (const clientId in updates) { + if (!updates[clientId]) { + delete merged[clientId]; + } + } + return merged; } } return state; @@ -10797,6 +10174,26 @@ function highlightedBlock(state, action) { return state; } +/** + * Reducer returning current expanded block in the list view. + * + * @param {string|null} state Current expanded block. + * @param {Object} action Dispatched action. + * + * @return {string|null} Updated state. + */ +function expandedBlock(state = null, action) { + switch (action.type) { + case 'SET_BLOCK_EXPANDED_IN_LIST_VIEW': + return action.clientId; + case 'SELECT_BLOCK': + if (action.clientId !== state) { + return null; + } + } + return state; +} + /** * Reducer returning the block insertion event list state. * @@ -10971,6 +10368,7 @@ const combinedReducers = (0,external_wp_data_namespaceObject.combineReducers)({ lastFocus, editorMode, hasBlockMovingClientId, + expandedBlock, highlightedBlock, lastBlockInserted, temporarilyEditingAsBlocks, @@ -11025,330 +10423,55 @@ function withAutomaticChangeReset(reducer) { } /* harmony default export */ const reducer = (withAutomaticChangeReset(combinedReducers)); -;// CONCATENATED MODULE: ./node_modules/rememo/rememo.js - - -/** @typedef {(...args: any[]) => *[]} GetDependants */ - -/** @typedef {() => void} Clear */ - -/** - * @typedef {{ - * getDependants: GetDependants, - * clear: Clear - * }} EnhancedSelector - */ - -/** - * Internal cache entry. - * - * @typedef CacheNode - * - * @property {?CacheNode|undefined} [prev] Previous node. - * @property {?CacheNode|undefined} [next] Next node. - * @property {*[]} args Function arguments for cache entry. - * @property {*} val Function result. - */ - -/** - * @typedef Cache - * - * @property {Clear} clear Function to clear cache. - * @property {boolean} [isUniqueByDependants] Whether dependants are valid in - * considering cache uniqueness. A cache is unique if dependents are all arrays - * or objects. - * @property {CacheNode?} [head] Cache head. - * @property {*[]} [lastDependants] Dependants from previous invocation. - */ - -/** - * Arbitrary value used as key for referencing cache object in WeakMap tree. - * - * @type {{}} - */ -var LEAF_KEY = {}; - -/** - * Returns the first argument as the sole entry in an array. - * - * @template T - * - * @param {T} value Value to return. - * - * @return {[T]} Value returned as entry in array. - */ -function arrayOf(value) { - return [value]; -} - -/** - * Returns true if the value passed is object-like, or false otherwise. A value - * is object-like if it can support property assignment, e.g. object or array. - * - * @param {*} value Value to test. - * - * @return {boolean} Whether value is object-like. - */ -function isObjectLike(value) { - return !!value && 'object' === typeof value; -} - -/** - * Creates and returns a new cache object. - * - * @return {Cache} Cache object. - */ -function createCache() { - /** @type {Cache} */ - var cache = { - clear: function () { - cache.head = null; - }, - }; - - return cache; -} - -/** - * Returns true if entries within the two arrays are strictly equal by - * reference from a starting index. - * - * @param {*[]} a First array. - * @param {*[]} b Second array. - * @param {number} fromIndex Index from which to start comparison. - * - * @return {boolean} Whether arrays are shallowly equal. - */ -function isShallowEqual(a, b, fromIndex) { - var i; - - if (a.length !== b.length) { - return false; - } - - for (i = fromIndex; i < a.length; i++) { - if (a[i] !== b[i]) { - return false; - } - } - - return true; -} - -/** - * Returns a memoized selector function. The getDependants function argument is - * called before the memoized selector and is expected to return an immutable - * reference or array of references on which the selector depends for computing - * its own return value. The memoize cache is preserved only as long as those - * dependant references remain the same. If getDependants returns a different - * reference(s), the cache is cleared and the selector value regenerated. - * - * @template {(...args: *[]) => *} S - * - * @param {S} selector Selector function. - * @param {GetDependants=} getDependants Dependant getter returning an array of - * references used in cache bust consideration. - */ -/* harmony default export */ function rememo(selector, getDependants) { - /** @type {WeakMap<*,*>} */ - var rootCache; - - /** @type {GetDependants} */ - var normalizedGetDependants = getDependants ? getDependants : arrayOf; - - /** - * Returns the cache for a given dependants array. When possible, a WeakMap - * will be used to create a unique cache for each set of dependants. This - * is feasible due to the nature of WeakMap in allowing garbage collection - * to occur on entries where the key object is no longer referenced. Since - * WeakMap requires the key to be an object, this is only possible when the - * dependant is object-like. The root cache is created as a hierarchy where - * each top-level key is the first entry in a dependants set, the value a - * WeakMap where each key is the next dependant, and so on. This continues - * so long as the dependants are object-like. If no dependants are object- - * like, then the cache is shared across all invocations. - * - * @see isObjectLike - * - * @param {*[]} dependants Selector dependants. - * - * @return {Cache} Cache object. - */ - function getCache(dependants) { - var caches = rootCache, - isUniqueByDependants = true, - i, - dependant, - map, - cache; - - for (i = 0; i < dependants.length; i++) { - dependant = dependants[i]; - - // Can only compose WeakMap from object-like key. - if (!isObjectLike(dependant)) { - isUniqueByDependants = false; - break; - } - - // Does current segment of cache already have a WeakMap? - if (caches.has(dependant)) { - // Traverse into nested WeakMap. - caches = caches.get(dependant); - } else { - // Create, set, and traverse into a new one. - map = new WeakMap(); - caches.set(dependant, map); - caches = map; - } - } - - // We use an arbitrary (but consistent) object as key for the last item - // in the WeakMap to serve as our running cache. - if (!caches.has(LEAF_KEY)) { - cache = createCache(); - cache.isUniqueByDependants = isUniqueByDependants; - caches.set(LEAF_KEY, cache); - } - - return caches.get(LEAF_KEY); - } - - /** - * Resets root memoization cache. - */ - function clear() { - rootCache = new WeakMap(); - } - - /* eslint-disable jsdoc/check-param-names */ - /** - * The augmented selector call, considering first whether dependants have - * changed before passing it to underlying memoize function. - * - * @param {*} source Source object for derivation. - * @param {...*} extraArgs Additional arguments to pass to selector. - * - * @return {*} Selector result. - */ - /* eslint-enable jsdoc/check-param-names */ - function callSelector(/* source, ...extraArgs */) { - var len = arguments.length, - cache, - node, - i, - args, - dependants; - - // Create copy of arguments (avoid leaking deoptimization). - args = new Array(len); - for (i = 0; i < len; i++) { - args[i] = arguments[i]; - } - - dependants = normalizedGetDependants.apply(null, args); - cache = getCache(dependants); - - // If not guaranteed uniqueness by dependants (primitive type), shallow - // compare against last dependants and, if references have changed, - // destroy cache to recalculate result. - if (!cache.isUniqueByDependants) { - if ( - cache.lastDependants && - !isShallowEqual(dependants, cache.lastDependants, 0) - ) { - cache.clear(); - } - - cache.lastDependants = dependants; - } - - node = cache.head; - while (node) { - // Check whether node arguments match arguments - if (!isShallowEqual(node.args, args, 1)) { - node = node.next; - continue; - } - - // At this point we can assume we've found a match - - // Surface matched node to head if not already - if (node !== cache.head) { - // Adjust siblings to point to each other. - /** @type {CacheNode} */ (node.prev).next = node.next; - if (node.next) { - node.next.prev = node.prev; - } - - node.next = cache.head; - node.prev = null; - /** @type {CacheNode} */ (cache.head).prev = node; - cache.head = node; - } - - // Return immediately - return node.val; - } - - // No cached value found. Continue to insertion phase: - - node = /** @type {CacheNode} */ ({ - // Generate the result from original function - val: selector.apply(null, args), - }); - - // Avoid including the source object in the cache. - args[0] = null; - node.args = args; - - // Don't need to check whether node is already head, since it would - // have been returned above already if it was - - // Shift existing head down list - if (cache.head) { - cache.head.prev = node; - node.next = cache.head; - } - - cache.head = node; - - return node.val; - } - - callSelector.getDependants = normalizedGetDependants; - callSelector.clear = clear; - clear(); - - return /** @type {S & EnhancedSelector} */ (callSelector); -} - ;// CONCATENATED MODULE: external ["wp","primitives"] const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; +;// CONCATENATED MODULE: external "ReactJSXRuntime" +const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol.js - /** * WordPress dependencies */ -const symbol = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const symbol = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" + }) +}); /* harmony default export */ const library_symbol = (symbol); ;// CONCATENATED MODULE: external ["wp","richText"] const external_wp_richText_namespaceObject = window["wp"]["richText"]; ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/private-keys.js +const globalStylesDataKey = Symbol('globalStylesDataKey'); const selectBlockPatternsKey = Symbol('selectBlockPatternsKey'); +const reusableBlocksSelectKey = Symbol('reusableBlocksSelect'); + +;// CONCATENATED MODULE: external ["wp","privateApis"] +const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/lock-unlock.js +/** + * WordPress dependencies + */ + +const { + lock, + unlock +} = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/block-editor'); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/constants.js +const STORE_NAME = 'core/block-editor'; ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/utils.js /** * Internal dependencies */ + + +const withRootClientIdOptionKey = Symbol('withRootClientId'); const checkAllowList = (list, item, defaultResult = null) => { if (typeof list === 'boolean') { return list; @@ -11382,8 +10505,11 @@ const checkAllowListRecursive = (blocks, allowedBlockTypes) => { return true; }; const getAllPatternsDependants = select => state => { - return [state.settings.__experimentalBlockPatterns, state.settings.__experimentalUserPatternCategories, state.settings.__experimentalReusableBlocks, state.settings[selectBlockPatternsKey]?.(select), state.blockPatterns]; + return [state.settings.__experimentalBlockPatterns, state.settings.__experimentalUserPatternCategories, state.settings.__experimentalReusableBlocks, state.settings[selectBlockPatternsKey]?.(select), state.blockPatterns, unlock(select(STORE_NAME)).getReusableBlocks()]; }; +function getInsertBlockTypeDependants(state, rootClientId) { + return [state.blockListSettings[rootClientId], state.blocks.byClientId.get(rootClientId), state.settings.allowedBlockTypes, state.settings.templateLock, state.blockEditingModes]; +} ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/sorting.js /** @@ -11437,35 +10563,135 @@ function orderBy(items, field, order = 'asc') { return items.concat().sort(comparator(field, items, order)); } -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/constants.js -const STORE_NAME = 'core/block-editor'; - -;// CONCATENATED MODULE: external ["wp","privateApis"] -const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/lock-unlock.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/utils.js /** * WordPress dependencies */ -const { - lock, - unlock -} = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/block-editor'); -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/selectors.js -/** - * External dependencies - */ +const INSERTER_PATTERN_TYPES = { + user: 'user', + theme: 'theme', + directory: 'directory' +}; +const INSERTER_SYNC_TYPES = { + full: 'fully', + unsynced: 'unsynced' +}; +const allPatternsCategory = { + name: 'allPatterns', + label: (0,external_wp_i18n_namespaceObject._x)('All', 'patterns') +}; +const myPatternsCategory = { + name: 'myPatterns', + label: (0,external_wp_i18n_namespaceObject.__)('My patterns') +}; +function isPatternFiltered(pattern, sourceFilter, syncFilter) { + const isUserPattern = pattern.name.startsWith('core/block'); + const isDirectoryPattern = pattern.source === 'core' || pattern.source?.startsWith('pattern-directory'); + // If theme source selected, filter out user created patterns and those from + // the core patterns directory. + if (sourceFilter === INSERTER_PATTERN_TYPES.theme && (isUserPattern || isDirectoryPattern)) { + return true; + } + + // If the directory source is selected, filter out user created patterns + // and those bundled with the theme. + if (sourceFilter === INSERTER_PATTERN_TYPES.directory && (isUserPattern || !isDirectoryPattern)) { + return true; + } + + // If user source selected, filter out theme patterns. + if (sourceFilter === INSERTER_PATTERN_TYPES.user && pattern.type !== INSERTER_PATTERN_TYPES.user) { + return true; + } + // Filter by sync status. + if (syncFilter === INSERTER_SYNC_TYPES.full && pattern.syncStatus !== '') { + return true; + } + if (syncFilter === INSERTER_SYNC_TYPES.unsynced && pattern.syncStatus !== 'unsynced' && isUserPattern) { + return true; + } + return false; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/object.js /** - * WordPress dependencies + * Immutably sets a value inside an object. Like `lodash#set`, but returning a + * new object. Treats nullish initial values as empty objects. Clones any + * nested objects. Supports arrays, too. + * + * @param {Object} object Object to set a value in. + * @param {number|string|Array} path Path in the object to modify. + * @param {*} value New value to set. + * @return {Object} Cloned object with the new value set. */ +function setImmutably(object, path, value) { + // Normalize path + path = Array.isArray(path) ? [...path] : [path]; + // Shallowly clone the base of the object + object = Array.isArray(object) ? [...object] : { + ...object + }; + const leaf = path.pop(); + // Traverse object from root to leaf, shallowly cloning at each level + let prev = object; + for (const key of path) { + const lvl = prev[key]; + prev = prev[key] = Array.isArray(lvl) ? [...lvl] : { + ...lvl + }; + } + prev[leaf] = value; + return object; +} +/** + * Helper util to return a value from a certain path of the object. + * Path is specified as either: + * - a string of properties, separated by dots, for example: "x.y". + * - an array of properties, for example `[ 'x', 'y' ]`. + * You can also specify a default value in case the result is nullish. + * + * @param {Object} object Input object. + * @param {string|Array} path Path to the object property. + * @param {*} defaultValue Default value if the value at the specified path is nullish. + * @return {*} Value of the object property at the specified path. + */ +const getValueFromObjectPath = (object, path, defaultValue) => { + var _value; + const arrayPath = Array.isArray(path) ? path : path.split('.'); + let value = object; + arrayPath.forEach(fieldName => { + value = value?.[fieldName]; + }); + return (_value = value) !== null && _value !== void 0 ? _value : defaultValue; +}; +/** + * Helper util to filter out objects with duplicate values for a given property. + * + * @param {Object[]} array Array of objects to filter. + * @param {string} property Property to filter unique values by. + * + * @return {Object[]} Array of objects with unique values for the specified property. + */ +function uniqByProperty(array, property) { + const seen = new Set(); + return array.filter(item => { + const value = item[property]; + return seen.has(value) ? false : seen.add(value); + }); +} +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/get-block-settings.js +/** + * WordPress dependencies + */ @@ -11474,104 +10700,634 @@ const { */ - - +const blockedPaths = ['color', 'border', 'dimensions', 'typography', 'spacing']; +const deprecatedFlags = { + 'color.palette': settings => settings.colors, + 'color.gradients': settings => settings.gradients, + 'color.custom': settings => settings.disableCustomColors === undefined ? undefined : !settings.disableCustomColors, + 'color.customGradient': settings => settings.disableCustomGradients === undefined ? undefined : !settings.disableCustomGradients, + 'typography.fontSizes': settings => settings.fontSizes, + 'typography.customFontSize': settings => settings.disableCustomFontSizes === undefined ? undefined : !settings.disableCustomFontSizes, + 'typography.lineHeight': settings => settings.enableCustomLineHeight, + 'spacing.units': settings => { + if (settings.enableCustomUnits === undefined) { + return; + } + if (settings.enableCustomUnits === true) { + return ['px', 'em', 'rem', 'vh', 'vw', '%']; + } + return settings.enableCustomUnits; + }, + 'spacing.padding': settings => settings.enableCustomSpacing +}; +const prefixedFlags = { + /* + * These were only available in the plugin + * and can be removed when the minimum WordPress version + * for the plugin is 5.9. + */ + 'border.customColor': 'border.color', + 'border.customStyle': 'border.style', + 'border.customWidth': 'border.width', + 'typography.customFontStyle': 'typography.fontStyle', + 'typography.customFontWeight': 'typography.fontWeight', + 'typography.customLetterSpacing': 'typography.letterSpacing', + 'typography.customTextDecorations': 'typography.textDecoration', + 'typography.customTextTransforms': 'typography.textTransform', + /* + * These were part of WordPress 5.8 and we need to keep them. + */ + 'border.customRadius': 'border.radius', + 'spacing.customMargin': 'spacing.margin', + 'spacing.customPadding': 'spacing.padding', + 'typography.customLineHeight': 'typography.lineHeight' +}; /** - * A block selection object. + * Remove `custom` prefixes for flags that did not land in 5.8. * - * @typedef {Object} WPBlockSelection + * This provides continued support for `custom` prefixed properties. It will + * be removed once third party devs have had sufficient time to update themes, + * plugins, etc. * - * @property {string} clientId A block client ID. - * @property {string} attributeKey A block attribute key. - * @property {number} offset An attribute value offset, based on the rich - * text value. See `wp.richText.create`. + * @see https://github.com/WordPress/gutenberg/pull/34485 + * + * @param {string} path Path to desired value in settings. + * @return {string} The value for defined setting. */ +const removeCustomPrefixes = path => { + return prefixedFlags[path] || path; +}; +function getBlockSettings(state, clientId, ...paths) { + const blockName = getBlockName(state, clientId); + const candidates = []; + if (clientId) { + let id = clientId; + do { + const name = getBlockName(state, id); + if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, '__experimentalSettings', false)) { + candidates.push(id); + } + } while (id = state.blocks.parents.get(id)); + } + return paths.map(path => { + if (blockedPaths.includes(path)) { + // eslint-disable-next-line no-console + console.warn('Top level useSetting paths are disabled. Please use a subpath to query the information needed.'); + return undefined; + } -// Module constants. -const MILLISECONDS_PER_HOUR = 3600 * 1000; -const MILLISECONDS_PER_DAY = 24 * 3600 * 1000; -const MILLISECONDS_PER_WEEK = 7 * 24 * 3600 * 1000; + // 0. Allow third parties to filter the block's settings at runtime. + let result = (0,external_wp_hooks_namespaceObject.applyFilters)('blockEditor.useSetting.before', undefined, path, clientId, blockName); + if (undefined !== result) { + return result; + } + const normalizedPath = removeCustomPrefixes(path); + + // 1. Take settings from the block instance or its ancestors. + // Start from the current block and work our way up the ancestors. + for (const candidateClientId of candidates) { + var _getValueFromObjectPa; + const candidateAtts = getBlockAttributes(state, candidateClientId); + result = (_getValueFromObjectPa = getValueFromObjectPath(candidateAtts.settings?.blocks?.[blockName], normalizedPath)) !== null && _getValueFromObjectPa !== void 0 ? _getValueFromObjectPa : getValueFromObjectPath(candidateAtts.settings, normalizedPath); + if (result !== undefined) { + // Stop the search for more distant ancestors and move on. + break; + } + } + + // 2. Fall back to the settings from the block editor store (__experimentalFeatures). + const settings = getSettings(state); + if (result === undefined && blockName) { + result = getValueFromObjectPath(settings.__experimentalFeatures?.blocks?.[blockName], normalizedPath); + } + if (result === undefined) { + result = getValueFromObjectPath(settings.__experimentalFeatures, normalizedPath); + } + + // Return if the setting was found in either the block instance or the store. + if (result !== undefined) { + if (external_wp_blocks_namespaceObject.__EXPERIMENTAL_PATHS_WITH_OVERRIDE[normalizedPath]) { + var _ref, _result$custom; + return (_ref = (_result$custom = result.custom) !== null && _result$custom !== void 0 ? _result$custom : result.theme) !== null && _ref !== void 0 ? _ref : result.default; + } + return result; + } + + // 3. Otherwise, use deprecated settings. + const deprecatedSettingsValue = deprecatedFlags[normalizedPath]?.(settings); + if (deprecatedSettingsValue !== undefined) { + return deprecatedSettingsValue; + } + + // 4. Fallback for typography.dropCap: + // This is only necessary to support typography.dropCap. + // when __experimentalFeatures are not present (core without plugin). + // To remove when __experimentalFeatures are ported to core. + return normalizedPath === 'typography.dropCap' ? true : undefined; + }); +} +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/private-selectors.js /** - * Shared reference to an empty array for cases where it is important to avoid - * returning a new array reference on every invocation, as in a connected or - * other pure component which performs `shouldComponentUpdate` check on props. - * This should be used as a last resort, since the normalized data should be - * maintained by the reducer result in state. - * - * @type {Array} + * WordPress dependencies */ -const EMPTY_ARRAY = []; + /** - * Shared reference to an empty Set for cases where it is important to avoid - * returning a new Set reference on every invocation, as in a connected or - * other pure component which performs `shouldComponentUpdate` check on props. - * This should be used as a last resort, since the normalized data should be - * maintained by the reducer result in state. - * - * @type {Set} + * Internal dependencies */ -const EMPTY_SET = new Set(); + + + + + + + /** - * Returns a block's name given its client ID, or null if no block exists with - * the client ID. + * Returns true if the block interface is hidden, or false otherwise. * - * @param {Object} state Editor state. - * @param {string} clientId Block client ID. + * @param {Object} state Global application state. * - * @return {string} Block name. + * @return {boolean} Whether the block toolbar is hidden. */ -function getBlockName(state, clientId) { - const block = state.blocks.byClientId.get(clientId); - const socialLinkName = 'core/social-link'; - if (external_wp_element_namespaceObject.Platform.OS !== 'web' && block?.name === socialLinkName) { - const attributes = state.blocks.attributes.get(clientId); - const { - service - } = attributes !== null && attributes !== void 0 ? attributes : {}; - return service ? `${socialLinkName}-${service}` : socialLinkName; - } - return block ? block.name : null; +function private_selectors_isBlockInterfaceHidden(state) { + return state.isBlockInterfaceHidden; } /** - * Returns whether a block is valid or not. - * - * @param {Object} state Editor state. - * @param {string} clientId Block client ID. + * Gets the client ids of the last inserted blocks. * - * @return {boolean} Is Valid. + * @param {Object} state Global application state. + * @return {Array|undefined} Client Ids of the last inserted block(s). */ -function isBlockValid(state, clientId) { - const block = state.blocks.byClientId.get(clientId); - return !!block && block.isValid; +function getLastInsertedBlocksClientIds(state) { + return state?.lastBlockInserted?.clientIds; +} +function getBlockWithoutAttributes(state, clientId) { + return state.blocks.byClientId.get(clientId); } /** - * Returns a block's attributes given its client ID, or null if no block exists with - * the client ID. + * Returns true if all of the descendants of a block with the given client ID + * have an editing mode of 'disabled', or false otherwise. * - * @param {Object} state Editor state. - * @param {string} clientId Block client ID. + * @param {Object} state Global application state. + * @param {string} clientId The block client ID. * - * @return {Object?} Block attributes. + * @return {boolean} Whether the block descendants are disabled. */ -function getBlockAttributes(state, clientId) { - const block = state.blocks.byClientId.get(clientId); - if (!block) { - return null; +const isBlockSubtreeDisabled = (state, clientId) => { + const isChildSubtreeDisabled = childClientId => { + return getBlockEditingMode(state, childClientId) === 'disabled' && getBlockOrder(state, childClientId).every(isChildSubtreeDisabled); + }; + return getBlockOrder(state, clientId).every(isChildSubtreeDisabled); +}; +function getEnabledClientIdsTreeUnmemoized(state, rootClientId) { + const blockOrder = getBlockOrder(state, rootClientId); + const result = []; + for (const clientId of blockOrder) { + const innerBlocks = getEnabledClientIdsTreeUnmemoized(state, clientId); + if (getBlockEditingMode(state, clientId) !== 'disabled') { + result.push({ + clientId, + innerBlocks + }); + } else { + result.push(...innerBlocks); + } } - return state.blocks.attributes.get(clientId); + return result; } /** - * Returns a block given its client ID. This is a parsed copy of the block, - * containing its `blockName`, `clientId`, and current `attributes` state. This - * is not the block's registration settings, which must be retrieved from the - * blocks module registration store. + * Returns a tree of block objects with only clientID and innerBlocks set. + * Blocks with a 'disabled' editing mode are not included. + * + * @param {Object} state Global application state. + * @param {?string} rootClientId Optional root client ID of block list. + * + * @return {Object[]} Tree of block objects with only clientID and innerBlocks set. + */ +const getEnabledClientIdsTree = (0,external_wp_data_namespaceObject.createSelector)(getEnabledClientIdsTreeUnmemoized, state => [state.blocks.order, state.blockEditingModes, state.settings.templateLock, state.blockListSettings]); + +/** + * Returns a list of a given block's ancestors, from top to bottom. Blocks with + * a 'disabled' editing mode are excluded. + * + * @see getBlockParents + * + * @param {Object} state Global application state. + * @param {string} clientId The block client ID. + * @param {boolean} ascending Order results from bottom to top (true) or top + * to bottom (false). + */ +const getEnabledBlockParents = (0,external_wp_data_namespaceObject.createSelector)((state, clientId, ascending = false) => { + return getBlockParents(state, clientId, ascending).filter(parent => getBlockEditingMode(state, parent) !== 'disabled'); +}, state => [state.blocks.parents, state.blockEditingModes, state.settings.templateLock, state.blockListSettings]); + +/** + * Selector that returns the data needed to display a prompt when certain + * blocks are removed, or `false` if no such prompt is requested. + * + * @param {Object} state Global application state. + * + * @return {Object|false} Data for removal prompt display, if any. + */ +function getRemovalPromptData(state) { + return state.removalPromptData; +} + +/** + * Returns true if removal prompt exists, or false otherwise. + * + * @param {Object} state Global application state. + * + * @return {boolean} Whether removal prompt exists. + */ +function getBlockRemovalRules(state) { + return state.blockRemovalRules; +} + +/** + * Returns the client ID of the block settings menu that is currently open. + * + * @param {Object} state Global application state. + * @return {string|null} The client ID of the block menu that is currently open. + */ +function getOpenedBlockSettingsMenu(state) { + return state.openedBlockSettingsMenu; +} + +/** + * Returns all style overrides, intended to be merged with global editor styles. + * + * Overrides are sorted to match the order of the blocks they relate to. This + * is useful to maintain correct CSS cascade order. + * + * @param {Object} state Global application state. + * + * @return {Array} An array of style ID to style override pairs. + */ +const getStyleOverrides = (0,external_wp_data_namespaceObject.createSelector)(state => { + const clientIds = getClientIdsWithDescendants(state); + const clientIdMap = clientIds.reduce((acc, clientId, index) => { + acc[clientId] = index; + return acc; + }, {}); + return [...state.styleOverrides].sort((overrideA, overrideB) => { + var _clientIdMap$clientId, _clientIdMap$clientId2; + // Once the overrides Map is spread to an array, the first element + // is the key, while the second is the override itself including + // the clientId to sort by. + const [, { + clientId: clientIdA + }] = overrideA; + const [, { + clientId: clientIdB + }] = overrideB; + const aIndex = (_clientIdMap$clientId = clientIdMap[clientIdA]) !== null && _clientIdMap$clientId !== void 0 ? _clientIdMap$clientId : -1; + const bIndex = (_clientIdMap$clientId2 = clientIdMap[clientIdB]) !== null && _clientIdMap$clientId2 !== void 0 ? _clientIdMap$clientId2 : -1; + return aIndex - bIndex; + }); +}, state => [state.blocks.order, state.styleOverrides]); + +/** @typedef {import('./actions').InserterMediaCategory} InserterMediaCategory */ +/** + * Returns the registered inserter media categories through the public API. + * + * @param {Object} state Editor state. + * + * @return {InserterMediaCategory[]} Inserter media categories. + */ +function getRegisteredInserterMediaCategories(state) { + return state.registeredInserterMediaCategories; +} + +/** + * Returns an array containing the allowed inserter media categories. + * It merges the registered media categories from extenders with the + * core ones. It also takes into account the allowed `mime_types`, which + * can be altered by `upload_mimes` filter and restrict some of them. + * + * @param {Object} state Global application state. + * + * @return {InserterMediaCategory[]} Client IDs of descendants. + */ +const getInserterMediaCategories = (0,external_wp_data_namespaceObject.createSelector)(state => { + const { + settings: { + inserterMediaCategories, + allowedMimeTypes, + enableOpenverseMediaCategory + }, + registeredInserterMediaCategories + } = state; + // The allowed `mime_types` can be altered by `upload_mimes` filter and restrict + // some of them. In this case we shouldn't add the category to the available media + // categories list in the inserter. + if (!inserterMediaCategories && !registeredInserterMediaCategories.length || !allowedMimeTypes) { + return; + } + const coreInserterMediaCategoriesNames = inserterMediaCategories?.map(({ + name + }) => name) || []; + const mergedCategories = [...(inserterMediaCategories || []), ...(registeredInserterMediaCategories || []).filter(({ + name + }) => !coreInserterMediaCategoriesNames.includes(name))]; + return mergedCategories.filter(category => { + // Check if Openverse category is enabled. + if (!enableOpenverseMediaCategory && category.name === 'openverse') { + return false; + } + return Object.values(allowedMimeTypes).some(mimeType => mimeType.startsWith(`${category.mediaType}/`)); + }); +}, state => [state.settings.inserterMediaCategories, state.settings.allowedMimeTypes, state.settings.enableOpenverseMediaCategory, state.registeredInserterMediaCategories]); + +/** + * Returns whether there is at least one allowed pattern for inner blocks children. + * This is useful for deferring the parsing of all patterns until needed. + * + * @param {Object} state Editor state. + * @param {string} [rootClientId=null] Target root client ID. + * + * @return {boolean} If there is at least one allowed pattern. + */ +const hasAllowedPatterns = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, rootClientId = null) => { + const { + getAllPatterns, + __experimentalGetParsedPattern + } = unlock(select(STORE_NAME)); + const patterns = getAllPatterns(); + const { + allowedBlockTypes + } = getSettings(state); + return patterns.some(({ + name, + inserter = true + }) => { + if (!inserter) { + return false; + } + const { + blocks + } = __experimentalGetParsedPattern(name); + return checkAllowListRecursive(blocks, allowedBlockTypes) && blocks.every(({ + name: blockName + }) => canInsertBlockType(state, blockName, rootClientId)); + }); +}, (state, rootClientId) => [...getAllPatternsDependants(select)(state), ...getInsertBlockTypeDependants(state, rootClientId)])); +function mapUserPattern(userPattern, __experimentalUserPatternCategories = []) { + return { + name: `core/block/${userPattern.id}`, + id: userPattern.id, + type: INSERTER_PATTERN_TYPES.user, + title: userPattern.title.raw, + categories: userPattern.wp_pattern_category.map(catId => { + const category = __experimentalUserPatternCategories.find(({ + id + }) => id === catId); + return category ? category.slug : catId; + }), + content: userPattern.content.raw, + syncStatus: userPattern.wp_pattern_sync_status + }; +} +const getPatternBySlug = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, patternName) => { + var _state$settings$__exp, _state$settings$selec; + // Only fetch reusable blocks if we know we need them. To do: maybe + // use the entity record API to retrieve the block by slug. + if (patternName?.startsWith('core/block/')) { + const _id = parseInt(patternName.slice('core/block/'.length), 10); + const block = unlock(select(STORE_NAME)).getReusableBlocks().find(({ + id + }) => id === _id); + if (!block) { + return null; + } + return mapUserPattern(block, state.settings.__experimentalUserPatternCategories); + } + return [ + // This setting is left for back compat. + ...((_state$settings$__exp = state.settings.__experimentalBlockPatterns) !== null && _state$settings$__exp !== void 0 ? _state$settings$__exp : []), ...((_state$settings$selec = state.settings[selectBlockPatternsKey]?.(select)) !== null && _state$settings$selec !== void 0 ? _state$settings$selec : [])].find(({ + name + }) => name === patternName); +}, (state, patternName) => patternName?.startsWith('core/block/') ? [unlock(select(STORE_NAME)).getReusableBlocks(), state.settings.__experimentalReusableBlocks] : [state.settings.__experimentalBlockPatterns, state.settings[selectBlockPatternsKey]?.(select)])); +const getAllPatterns = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)(state => { + var _state$settings$__exp2, _state$settings$selec2; + return [...unlock(select(STORE_NAME)).getReusableBlocks().map(userPattern => mapUserPattern(userPattern, state.settings.__experimentalUserPatternCategories)), + // This setting is left for back compat. + ...((_state$settings$__exp2 = state.settings.__experimentalBlockPatterns) !== null && _state$settings$__exp2 !== void 0 ? _state$settings$__exp2 : []), ...((_state$settings$selec2 = state.settings[selectBlockPatternsKey]?.(select)) !== null && _state$settings$selec2 !== void 0 ? _state$settings$selec2 : [])].filter((x, index, arr) => index === arr.findIndex(y => x.name === y.name)); +}, getAllPatternsDependants(select))); +const isResolvingPatterns = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)(state => { + const blockPatternsSelect = state.settings[selectBlockPatternsKey]; + const reusableBlocksSelect = state.settings[reusableBlocksSelectKey]; + return (blockPatternsSelect ? blockPatternsSelect(select) === undefined : false) || (reusableBlocksSelect ? reusableBlocksSelect(select) === undefined : false); +}, getAllPatternsDependants(select))); +const EMPTY_ARRAY = []; +const getReusableBlocks = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { + var _state$settings$__exp3; + const reusableBlocksSelect = state.settings[reusableBlocksSelectKey]; + return reusableBlocksSelect ? reusableBlocksSelect(select) : (_state$settings$__exp3 = state.settings.__experimentalReusableBlocks) !== null && _state$settings$__exp3 !== void 0 ? _state$settings$__exp3 : EMPTY_ARRAY; +}); + +/** + * Returns the element of the last element that had focus when focus left the editor canvas. + * + * @param {Object} state Block editor state. + * + * @return {Object} Element. + */ +function getLastFocus(state) { + return state.lastFocus; +} + +/** + * Returns true if the user is dragging anything, or false otherwise. It is possible for a + * user to be dragging data from outside of the editor, so this selector is separate from + * the `isDraggingBlocks` selector which only returns true if the user is dragging blocks. + * + * @param {Object} state Global application state. + * + * @return {boolean} Whether user is dragging. + */ +function private_selectors_isDragging(state) { + return state.isDragging; +} + +/** + * Retrieves the expanded block from the state. + * + * @param {Object} state Block editor state. + * + * @return {string|null} The client ID of the expanded block, if set. + */ +function getExpandedBlock(state) { + return state.expandedBlock; +} + +/** + * Retrieves the client ID of the ancestor block that is content locking the block + * with the provided client ID. + * + * @param {Object} state Global application state. + * @param {Object} clientId Client Id of the block. + * + * @return {?string} Client ID of the ancestor block that is content locking the block. + */ +const getContentLockingParent = (0,external_wp_data_namespaceObject.createSelector)((state, clientId) => { + let current = clientId; + let result; + while (current = state.blocks.parents.get(current)) { + if (getBlockName(state, current) === 'core/block' || getTemplateLock(state, current) === 'contentOnly') { + result = current; + } + } + return result; +}, state => [state.blocks.parents, state.blockListSettings]); + +/** + * Retrieves the client ID of the block that is content locked but is + * currently being temporarily edited as a non-locked block. + * + * @param {Object} state Global application state. + * + * @return {?string} The client ID of the block being temporarily edited as a non-locked block. + */ +function getTemporarilyEditingAsBlocks(state) { + return state.temporarilyEditingAsBlocks; +} + +/** + * Returns the focus mode that should be reapplied when the user stops editing + * a content locked blocks as a block without locking. + * + * @param {Object} state Global application state. + * + * @return {?string} The focus mode that should be re-set when temporarily editing as blocks stops. + */ +function getTemporarilyEditingFocusModeToRevert(state) { + return state.temporarilyEditingFocusModeRevert; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/selectors.js +/** + * WordPress dependencies + */ + + + + + + + + +/** + * Internal dependencies + */ + + + + + + +/** + * A block selection object. + * + * @typedef {Object} WPBlockSelection + * + * @property {string} clientId A block client ID. + * @property {string} attributeKey A block attribute key. + * @property {number} offset An attribute value offset, based on the rich + * text value. See `wp.richText.create`. + */ + +// Module constants. +const MILLISECONDS_PER_HOUR = 3600 * 1000; +const MILLISECONDS_PER_DAY = 24 * 3600 * 1000; +const MILLISECONDS_PER_WEEK = 7 * 24 * 3600 * 1000; + +/** + * Shared reference to an empty array for cases where it is important to avoid + * returning a new array reference on every invocation, as in a connected or + * other pure component which performs `shouldComponentUpdate` check on props. + * This should be used as a last resort, since the normalized data should be + * maintained by the reducer result in state. + * + * @type {Array} + */ +const selectors_EMPTY_ARRAY = []; + +/** + * Shared reference to an empty Set for cases where it is important to avoid + * returning a new Set reference on every invocation, as in a connected or + * other pure component which performs `shouldComponentUpdate` check on props. + * This should be used as a last resort, since the normalized data should be + * maintained by the reducer result in state. + * + * @type {Set} + */ +const EMPTY_SET = new Set(); +const EMPTY_OBJECT = {}; + +/** + * Returns a block's name given its client ID, or null if no block exists with + * the client ID. + * + * @param {Object} state Editor state. + * @param {string} clientId Block client ID. + * + * @return {string} Block name. + */ +function getBlockName(state, clientId) { + const block = state.blocks.byClientId.get(clientId); + const socialLinkName = 'core/social-link'; + if (external_wp_element_namespaceObject.Platform.OS !== 'web' && block?.name === socialLinkName) { + const attributes = state.blocks.attributes.get(clientId); + const { + service + } = attributes !== null && attributes !== void 0 ? attributes : {}; + return service ? `${socialLinkName}-${service}` : socialLinkName; + } + return block ? block.name : null; +} + +/** + * Returns whether a block is valid or not. + * + * @param {Object} state Editor state. + * @param {string} clientId Block client ID. + * + * @return {boolean} Is Valid. + */ +function isBlockValid(state, clientId) { + const block = state.blocks.byClientId.get(clientId); + return !!block && block.isValid; +} + +/** + * Returns a block's attributes given its client ID, or null if no block exists with + * the client ID. + * + * @param {Object} state Editor state. + * @param {string} clientId Block client ID. + * + * @return {Object?} Block attributes. + */ +function getBlockAttributes(state, clientId) { + const block = state.blocks.byClientId.get(clientId); + if (!block) { + return null; + } + return state.blocks.attributes.get(clientId); +} + +/** + * Returns a block given its client ID. This is a parsed copy of the block, + * containing its `blockName`, `clientId`, and current `attributes` state. This + * is not the block's registration settings, which must be retrieved from the + * blocks module registration store. * * getBlock recurses through its inner blocks until all its children blocks have * been retrieved. Note that getBlock will not return the child inner blocks of @@ -11594,7 +11350,7 @@ function getBlock(state, clientId) { } return state.blocks.tree.get(clientId); } -const __unstableGetBlockWithoutInnerBlocks = rememo((state, clientId) => { +const __unstableGetBlockWithoutInnerBlocks = (0,external_wp_data_namespaceObject.createSelector)((state, clientId) => { const block = state.blocks.byClientId.get(clientId); if (!block) { return null; @@ -11617,7 +11373,7 @@ const __unstableGetBlockWithoutInnerBlocks = rememo((state, clientId) => { */ function getBlocks(state, rootClientId) { const treeKey = !rootClientId || !areInnerBlocksControlled(state, rootClientId) ? rootClientId || '' : 'controlled||' + rootClientId; - return state.blocks.tree.get(treeKey)?.innerBlocks || EMPTY_ARRAY; + return state.blocks.tree.get(treeKey)?.innerBlocks || selectors_EMPTY_ARRAY; } /** @@ -11631,7 +11387,7 @@ function getBlocks(state, rootClientId) { * * @return {Object} Client IDs of the post blocks. */ -const __unstableGetClientIdWithClientIdsTree = rememo((state, clientId) => { +const __unstableGetClientIdWithClientIdsTree = (0,external_wp_data_namespaceObject.createSelector)((state, clientId) => { external_wp_deprecated_default()("wp.data.select( 'core/block-editor' ).__unstableGetClientIdWithClientIdsTree", { since: '6.3', version: '6.5' @@ -11654,7 +11410,7 @@ const __unstableGetClientIdWithClientIdsTree = rememo((state, clientId) => { * * @return {Object[]} Client IDs of the post blocks. */ -const __unstableGetClientIdsTree = rememo((state, rootClientId = '') => { +const __unstableGetClientIdsTree = (0,external_wp_data_namespaceObject.createSelector)((state, rootClientId = '') => { external_wp_deprecated_default()("wp.data.select( 'core/block-editor' ).__unstableGetClientIdsTree", { since: '6.3', version: '6.5' @@ -11672,7 +11428,7 @@ const __unstableGetClientIdsTree = rememo((state, rootClientId = '') => { * * @return {Array} Client IDs of descendants. */ -const getClientIdsOfDescendants = rememo((state, rootIds) => { +const getClientIdsOfDescendants = (0,external_wp_data_namespaceObject.createSelector)((state, rootIds) => { rootIds = Array.isArray(rootIds) ? [...rootIds] : [rootIds]; const ids = []; @@ -11717,7 +11473,7 @@ const getClientIdsWithDescendants = state => getClientIdsOfDescendants(state, '' * * @return {number} Number of blocks in the post, or number of blocks with name equal to blockName. */ -const getGlobalBlockCount = rememo((state, blockName) => { +const getGlobalBlockCount = (0,external_wp_data_namespaceObject.createSelector)((state, blockName) => { const clientIds = getClientIdsWithDescendants(state); if (!blockName) { return clientIds.length; @@ -11740,9 +11496,9 @@ const getGlobalBlockCount = rememo((state, blockName) => { * * @return {Array} Array of clientIds of blocks with name equal to blockName. */ -const getBlocksByName = rememo((state, blockName) => { +const getBlocksByName = (0,external_wp_data_namespaceObject.createSelector)((state, blockName) => { if (!blockName) { - return EMPTY_ARRAY; + return selectors_EMPTY_ARRAY; } const blockNames = Array.isArray(blockName) ? blockName : [blockName]; const clientIds = getClientIdsWithDescendants(state); @@ -11750,7 +11506,7 @@ const getBlocksByName = rememo((state, blockName) => { const block = state.blocks.byClientId.get(clientId); return blockNames.includes(block.name); }); - return foundBlocks.length > 0 ? foundBlocks : EMPTY_ARRAY; + return foundBlocks.length > 0 ? foundBlocks : selectors_EMPTY_ARRAY; }, state => [state.blocks.order, state.blocks.byClientId]); /** @@ -11780,7 +11536,7 @@ function __experimentalGetGlobalBlocksByName(state, blockName) { * * @return {WPBlock[]} Block objects. */ -const getBlocksByClientId = rememo((state, clientIds) => (Array.isArray(clientIds) ? clientIds : [clientIds]).map(clientId => getBlock(state, clientId)), (state, clientIds) => (Array.isArray(clientIds) ? clientIds : [clientIds]).map(clientId => state.blocks.tree.get(clientId))); +const getBlocksByClientId = (0,external_wp_data_namespaceObject.createSelector)((state, clientIds) => (Array.isArray(clientIds) ? clientIds : [clientIds]).map(clientId => getBlock(state, clientId)), (state, clientIds) => (Array.isArray(clientIds) ? clientIds : [clientIds]).map(clientId => state.blocks.tree.get(clientId))); /** * Given an array of block client IDs, returns the corresponding array of block @@ -11791,7 +11547,7 @@ const getBlocksByClientId = rememo((state, clientIds) => (Array.isArray(clientId * * @return {string[]} Block names. */ -const getBlockNamesByClientId = rememo((state, clientIds) => getBlocksByClientId(state, clientIds).filter(Boolean).map(block => block.name), (state, clientIds) => getBlocksByClientId(state, clientIds)); +const getBlockNamesByClientId = (0,external_wp_data_namespaceObject.createSelector)((state, clientIds) => getBlocksByClientId(state, clientIds).filter(Boolean).map(block => block.name), (state, clientIds) => getBlocksByClientId(state, clientIds)); /** * Returns the number of blocks currently present in the post. @@ -11943,14 +11699,14 @@ function getBlockRootClientId(state, clientId) { * * @return {Array} ClientIDs of the parent blocks. */ -const getBlockParents = rememo((state, clientId, ascending = false) => { +const getBlockParents = (0,external_wp_data_namespaceObject.createSelector)((state, clientId, ascending = false) => { const parents = []; let current = clientId; while (current = state.blocks.parents.get(current)) { parents.push(current); } if (!parents.length) { - return EMPTY_ARRAY; + return selectors_EMPTY_ARRAY; } return ascending ? parents : parents.reverse(); }, state => [state.blocks.parents]); @@ -11969,7 +11725,7 @@ const getBlockParents = rememo((state, clientId, ascending = false) => { * * @return {Array} ClientIDs of the parent blocks. */ -const getBlockParentsByBlockName = rememo((state, clientId, blockName, ascending = false) => { +const getBlockParentsByBlockName = (0,external_wp_data_namespaceObject.createSelector)((state, clientId, blockName, ascending = false) => { const parents = getBlockParents(state, clientId, ascending); const hasName = Array.isArray(blockName) ? name => blockName.includes(name) : name => blockName === name; return parents.filter(id => hasName(getBlockName(state, id))); @@ -12129,13 +11885,13 @@ function getSelectedBlocksInitialCaretPosition(state) { * * @return {Array} Multi-selected block client IDs. */ -const getSelectedBlockClientIds = rememo(state => { +const getSelectedBlockClientIds = (0,external_wp_data_namespaceObject.createSelector)(state => { const { selectionStart, selectionEnd } = state.selection; if (!selectionStart.clientId || !selectionEnd.clientId) { - return EMPTY_ARRAY; + return selectors_EMPTY_ARRAY; } if (selectionStart.clientId === selectionEnd.clientId) { return [selectionStart.clientId]; @@ -12146,7 +11902,7 @@ const getSelectedBlockClientIds = rememo(state => { // by explicitly testing against null. const rootClientId = getBlockRootClientId(state, selectionStart.clientId); if (rootClientId === null) { - return EMPTY_ARRAY; + return selectors_EMPTY_ARRAY; } const blockOrder = getBlockOrder(state, rootClientId); const startIndex = blockOrder.indexOf(selectionStart.clientId); @@ -12171,7 +11927,7 @@ function getMultiSelectedBlockClientIds(state) { selectionEnd } = state.selection; if (selectionStart.clientId === selectionEnd.clientId) { - return EMPTY_ARRAY; + return selectors_EMPTY_ARRAY; } return getSelectedBlockClientIds(state); } @@ -12184,10 +11940,10 @@ function getMultiSelectedBlockClientIds(state) { * * @return {Array} Multi-selected block objects. */ -const getMultiSelectedBlocks = rememo(state => { +const getMultiSelectedBlocks = (0,external_wp_data_namespaceObject.createSelector)(state => { const multiSelectedBlockClientIds = getMultiSelectedBlockClientIds(state); if (!multiSelectedBlockClientIds.length) { - return EMPTY_ARRAY; + return selectors_EMPTY_ARRAY; } return multiSelectedBlockClientIds.map(clientId => getBlock(state, clientId)); }, state => [...getSelectedBlockClientIds.getDependants(state), state.blocks.byClientId, state.blocks.order, state.blocks.attributes]); @@ -12254,7 +12010,7 @@ function isBlockMultiSelected(state, clientId) { * @return {boolean} Whether an ancestor of the block is in multi-selection * set. */ -const isAncestorMultiSelected = rememo((state, clientId) => { +const isAncestorMultiSelected = (0,external_wp_data_namespaceObject.createSelector)((state, clientId) => { let ancestorClientId = clientId; let isMultiSelected = false; while (ancestorClientId && !isMultiSelected) { @@ -12356,10 +12112,14 @@ function __unstableIsSelectionMergeable(state, isForward) { const selectionFocus = getSelectionEnd(state); // It's not mergeable if the start and end are within the same block. - if (selectionAnchor.clientId === selectionFocus.clientId) return false; + if (selectionAnchor.clientId === selectionFocus.clientId) { + return false; + } // It's not mergeable if there's no rich text selection. - if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === 'undefined' || typeof selectionFocus.offset === 'undefined') return false; + if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === 'undefined' || typeof selectionFocus.offset === 'undefined') { + return false; + } const anchorRootClientId = getBlockRootClientId(state, selectionAnchor.clientId); const focusRootClientId = getBlockRootClientId(state, selectionFocus.clientId); @@ -12385,11 +12145,15 @@ function __unstableIsSelectionMergeable(state, isForward) { const blockToMergeClientId = isForward ? selectionStart.clientId : selectionEnd.clientId; const targetBlockName = getBlockName(state, targetBlockClientId); const targetBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(targetBlockName); - if (!targetBlockType.merge) return false; + if (!targetBlockType.merge) { + return false; + } const blockToMerge = getBlock(state, blockToMergeClientId); // It's mergeable if the blocks are of the same type. - if (blockToMerge.name === targetBlockName) return true; + if (blockToMerge.name === targetBlockName) { + return true; + } // If the blocks are of a different type, try to transform the block being // merged into the same type of block. @@ -12409,12 +12173,12 @@ const __unstableGetSelectedBlocksWithPartialSelection = state => { const selectionAnchor = getSelectionStart(state); const selectionFocus = getSelectionEnd(state); if (selectionAnchor.clientId === selectionFocus.clientId) { - return EMPTY_ARRAY; + return selectors_EMPTY_ARRAY; } // Can't split if the selection is not set. if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === 'undefined' || typeof selectionFocus.offset === 'undefined') { - return EMPTY_ARRAY; + return selectors_EMPTY_ARRAY; } const anchorRootClientId = getBlockRootClientId(state, selectionAnchor.clientId); const focusRootClientId = getBlockRootClientId(state, selectionFocus.clientId); @@ -12422,7 +12186,7 @@ const __unstableGetSelectedBlocksWithPartialSelection = state => { // It's not splittable if the selection doesn't start and end in the same // block list. Maybe in the future it should be allowed. if (anchorRootClientId !== focusRootClientId) { - return EMPTY_ARRAY; + return selectors_EMPTY_ARRAY; } const blockOrder = getBlockOrder(state, anchorRootClientId); const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId); @@ -12472,7 +12236,7 @@ const __unstableGetSelectedBlocksWithPartialSelection = state => { * @return {Array} Ordered client IDs of editor blocks. */ function getBlockOrder(state, rootClientId) { - return state.blocks.order.get(rootClientId || '') || EMPTY_ARRAY; + return state.blocks.order.get(rootClientId || '') || selectors_EMPTY_ARRAY; } /** @@ -12519,7 +12283,17 @@ function isBlockSelected(state, clientId) { * @return {boolean} Whether the block has an inner block selected */ function hasSelectedInnerBlock(state, clientId, deep = false) { - return getBlockOrder(state, clientId).some(innerClientId => isBlockSelected(state, innerClientId) || isBlockMultiSelected(state, innerClientId) || deep && hasSelectedInnerBlock(state, innerClientId, deep)); + const selectedBlockClientIds = getSelectedBlockClientIds(state); + if (!selectedBlockClientIds.length) { + return false; + } + if (deep) { + return selectedBlockClientIds.some(id => + // Pass true because we don't care about order and it's more + // performant. + getBlockParents(state, id, true).includes(clientId)); + } + return selectedBlockClientIds.some(id => getBlockRootClientId(state, id) === clientId); } /** @@ -12702,7 +12476,7 @@ function isCaretWithinFormattedText() { * * @return {Object} Insertion point object with `rootClientId`, `index`. */ -const getBlockInsertionPoint = rememo(state => { +const getBlockInsertionPoint = (0,external_wp_data_namespaceObject.createSelector)(state => { let rootClientId, index; const { insertionPoint, @@ -12882,7 +12656,7 @@ const canInsertBlockTypeUnmemoized = (state, blockName, rootClientId = null) => * * @return {boolean} Whether the given block type is allowed to be inserted. */ -const canInsertBlockType = rememo(canInsertBlockTypeUnmemoized, (state, blockName, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId.get(rootClientId), state.settings.allowedBlockTypes, state.settings.templateLock, state.blockEditingModes]); +const canInsertBlockType = (0,external_wp_data_namespaceObject.createSelector)(canInsertBlockTypeUnmemoized, (state, blockName, rootClientId) => getInsertBlockTypeDependants(state, rootClientId)); /** * Determines if the given blocks are allowed to be inserted into the block @@ -12901,13 +12675,12 @@ function canInsertBlocks(state, clientIds, rootClientId = null) { /** * Determines if the given block is allowed to be deleted. * - * @param {Object} state Editor state. - * @param {string} clientId The block client Id. - * @param {?string} rootClientId Optional root client ID of block list. + * @param {Object} state Editor state. + * @param {string} clientId The block client Id. * * @return {boolean} Whether the given block is allowed to be removed. */ -function canRemoveBlock(state, clientId, rootClientId = null) { +function canRemoveBlock(state, clientId) { const attributes = getBlockAttributes(state, clientId); if (attributes === null) { return true; @@ -12915,6 +12688,7 @@ function canRemoveBlock(state, clientId, rootClientId = null) { if (attributes.lock?.remove !== undefined) { return !attributes.lock.remove; } + const rootClientId = getBlockRootClientId(state, clientId); if (getTemplateLock(state, rootClientId)) { return false; } @@ -12924,26 +12698,24 @@ function canRemoveBlock(state, clientId, rootClientId = null) { /** * Determines if the given blocks are allowed to be removed. * - * @param {Object} state Editor state. - * @param {string} clientIds The block client IDs to be removed. - * @param {?string} rootClientId Optional root client ID of block list. + * @param {Object} state Editor state. + * @param {string} clientIds The block client IDs to be removed. * * @return {boolean} Whether the given blocks are allowed to be removed. */ -function canRemoveBlocks(state, clientIds, rootClientId = null) { - return clientIds.every(clientId => canRemoveBlock(state, clientId, rootClientId)); +function canRemoveBlocks(state, clientIds) { + return clientIds.every(clientId => canRemoveBlock(state, clientId)); } /** * Determines if the given block is allowed to be moved. * - * @param {Object} state Editor state. - * @param {string} clientId The block client Id. - * @param {?string} rootClientId Optional root client ID of block list. + * @param {Object} state Editor state. + * @param {string} clientId The block client Id. * * @return {boolean | undefined} Whether the given block is allowed to be moved. */ -function canMoveBlock(state, clientId, rootClientId = null) { +function canMoveBlock(state, clientId) { const attributes = getBlockAttributes(state, clientId); if (attributes === null) { return true; @@ -12951,6 +12723,7 @@ function canMoveBlock(state, clientId, rootClientId = null) { if (attributes.lock?.move !== undefined) { return !attributes.lock.move; } + const rootClientId = getBlockRootClientId(state, clientId); if (getTemplateLock(state, rootClientId) === 'all') { return false; } @@ -12960,14 +12733,13 @@ function canMoveBlock(state, clientId, rootClientId = null) { /** * Determines if the given blocks are allowed to be moved. * - * @param {Object} state Editor state. - * @param {string} clientIds The block client IDs to be moved. - * @param {?string} rootClientId Optional root client ID of block list. + * @param {Object} state Editor state. + * @param {string} clientIds The block client IDs to be moved. * * @return {boolean} Whether the given blocks are allowed to be moved. */ -function canMoveBlocks(state, clientIds, rootClientId = null) { - return clientIds.every(clientId => canMoveBlock(state, clientId, rootClientId)); +function canMoveBlocks(state, clientIds) { + return clientIds.every(clientId => canMoveBlock(state, clientId)); } /** @@ -13133,7 +12905,9 @@ const buildBlockTypeItem = (state, { isDisabled, frecency: calculateFrecency(time, count) }; - if (buildScope === 'transform') return blockItemBase; + if (buildScope === 'transform') { + return blockItemBase; + } const inserterVariations = (0,external_wp_blocks_namespaceObject.getBlockVariations)(blockType.name, 'inserter'); return { ...blockItemBase, @@ -13176,7 +12950,7 @@ const buildBlockTypeItem = (state, { * this item. * @property {number} frecency Heuristic that combines frequency and recency. */ -const getInserterItems = rememo((state, rootClientId = null) => { +const getInserterItems = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, rootClientId = null, options = EMPTY_OBJECT) => { const buildReusableBlockInserterItem = reusableBlock => { const icon = !reusableBlock.wp_pattern_sync_status ? { src: library_symbol, @@ -13206,11 +12980,41 @@ const getInserterItems = rememo((state, rootClientId = null) => { syncStatus: reusableBlock.wp_pattern_sync_status }; }; - const syncedPatternInserterItems = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) ? getReusableBlocks(state).map(buildReusableBlockInserterItem) : []; + const syncedPatternInserterItems = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) ? unlock(select(STORE_NAME)).getReusableBlocks().map(buildReusableBlockInserterItem) : []; const buildBlockTypeInserterItem = buildBlockTypeItem(state, { buildScope: 'inserter' }); - const blockTypeInserterItems = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)).map(buildBlockTypeInserterItem); + let blockTypeInserterItems = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter(blockType => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'inserter', true)).map(buildBlockTypeInserterItem); + if (options[withRootClientIdOptionKey]) { + blockTypeInserterItems = blockTypeInserterItems.reduce((accumulator, item) => { + item.rootClientId = rootClientId !== null && rootClientId !== void 0 ? rootClientId : ''; + while (!canInsertBlockTypeUnmemoized(state, item.name, item.rootClientId)) { + if (!item.rootClientId) { + let sectionRootClientId; + try { + sectionRootClientId = unlock(getSettings(state)).sectionRootClientId; + } catch (e) {} + if (sectionRootClientId && canInsertBlockTypeUnmemoized(state, item.name, sectionRootClientId)) { + item.rootClientId = sectionRootClientId; + } else { + delete item.rootClientId; + } + break; + } else { + const parentClientId = getBlockRootClientId(state, item.rootClientId); + item.rootClientId = parentClientId; + } + } + + // We could also add non insertable items and gray them out. + if (item.hasOwnProperty('rootClientId')) { + accumulator.push(item); + } + return accumulator; + }, []); + } else { + blockTypeInserterItems = blockTypeInserterItems.filter(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)); + } const items = blockTypeInserterItems.reduce((accumulator, item) => { const { variations = [] @@ -13251,7 +13055,7 @@ const getInserterItems = rememo((state, rootClientId = null) => { }); const sortedBlockTypes = [...coreItems, ...nonCoreItems]; return [...sortedBlockTypes, ...syncedPatternInserterItems]; -}, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId.get(rootClientId), state.blocks.order, state.preferences.insertUsage, state.settings.allowedBlockTypes, state.settings.templateLock, getReusableBlocks(state), (0,external_wp_blocks_namespaceObject.getBlockTypes)()]); +}, (state, rootClientId) => [(0,external_wp_blocks_namespaceObject.getBlockTypes)(), unlock(select(STORE_NAME)).getReusableBlocks(), state.blocks.order, state.preferences.insertUsage, ...getInsertBlockTypeDependants(state, rootClientId)])); /** * Determines the items that appear in the available block transforms list. @@ -13279,7 +13083,7 @@ const getInserterItems = rememo((state, rootClientId = null) => { * this item. * @property {number} frecency Heuristic that combines frequency and recency. */ -const getBlockTransformItems = rememo((state, blocks, rootClientId = null) => { +const getBlockTransformItems = (0,external_wp_data_namespaceObject.createSelector)((state, blocks, rootClientId = null) => { const normalizedBlocks = Array.isArray(blocks) ? blocks : [blocks]; const buildBlockTypeTransformItem = buildBlockTypeItem(state, { buildScope: 'transform' @@ -13293,7 +13097,7 @@ const getBlockTransformItems = rememo((state, blocks, rootClientId = null) => { return accumulator; }, []); return orderBy(possibleTransforms, block => itemsByName[block.name].frecency, 'desc'); -}, (state, blocks, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId.get(rootClientId), state.preferences.insertUsage, state.settings.allowedBlockTypes, state.settings.templateLock, (0,external_wp_blocks_namespaceObject.getBlockTypes)()]); +}, (state, blocks, rootClientId) => [(0,external_wp_blocks_namespaceObject.getBlockTypes)(), state.preferences.insertUsage, ...getInsertBlockTypeDependants(state, rootClientId)]); /** * Determines whether there are items to show in the inserter. @@ -13303,14 +13107,14 @@ const getBlockTransformItems = rememo((state, blocks, rootClientId = null) => { * * @return {boolean} Items that appear in inserter. */ -const hasInserterItems = rememo((state, rootClientId = null) => { +const hasInserterItems = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, rootClientId = null) => { const hasBlockType = (0,external_wp_blocks_namespaceObject.getBlockTypes)().some(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)); if (hasBlockType) { return true; } - const hasReusableBlock = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) && getReusableBlocks(state).length > 0; + const hasReusableBlock = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) && unlock(select(STORE_NAME)).getReusableBlocks().length > 0; return hasReusableBlock; -}, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId.get(rootClientId), state.settings.allowedBlockTypes, state.settings.templateLock, getReusableBlocks(state), (0,external_wp_blocks_namespaceObject.getBlockTypes)()]); +}); /** * Returns the list of allowed inserter blocks for inner blocks children. @@ -13320,25 +13124,25 @@ const hasInserterItems = rememo((state, rootClientId = null) => { * * @return {Array?} The list of allowed block types. */ -const getAllowedBlocks = rememo((state, rootClientId = null) => { +const getAllowedBlocks = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, rootClientId = null) => { if (!rootClientId) { return; } const blockTypes = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)); - const hasReusableBlock = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) && getReusableBlocks(state).length > 0; + const hasReusableBlock = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) && unlock(select(STORE_NAME)).getReusableBlocks().length > 0; if (hasReusableBlock) { blockTypes.push('core/block'); } return blockTypes; -}, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId.get(rootClientId), state.settings.allowedBlockTypes, state.settings.templateLock, getReusableBlocks(state), (0,external_wp_blocks_namespaceObject.getBlockTypes)()]); -const __experimentalGetAllowedBlocks = rememo((state, rootClientId = null) => { +}, (state, rootClientId) => [(0,external_wp_blocks_namespaceObject.getBlockTypes)(), unlock(select(STORE_NAME)).getReusableBlocks(), ...getInsertBlockTypeDependants(state, rootClientId)])); +const __experimentalGetAllowedBlocks = (0,external_wp_data_namespaceObject.createSelector)((state, rootClientId = null) => { external_wp_deprecated_default()('wp.data.select( "core/block-editor" ).__experimentalGetAllowedBlocks', { alternative: 'wp.data.select( "core/block-editor" ).getAllowedBlocks', since: '6.2', version: '6.4' }); return getAllowedBlocks(state, rootClientId); -}, (state, rootClientId) => [...getAllowedBlocks.getDependants(state, rootClientId)]); +}, (state, rootClientId) => getAllowedBlocks.getDependants(state, rootClientId)); /** * Returns the block to be directly inserted by the block appender. @@ -13346,56 +13150,60 @@ const __experimentalGetAllowedBlocks = rememo((state, rootClientId = null) => { * @param {Object} state Editor state. * @param {?string} rootClientId Optional root client ID of block list. * - * @return {?WPDirectInsertBlock} The block type to be directly inserted. + * @return {WPDirectInsertBlock|undefined} The block type to be directly inserted. * * @typedef {Object} WPDirectInsertBlock * @property {string} name The type of block. * @property {?Object} attributes Attributes to pass to the newly created block. * @property {?Array} attributesToCopy Attributes to be copied from adjecent blocks when inserted. */ -const getDirectInsertBlock = rememo((state, rootClientId = null) => { +function getDirectInsertBlock(state, rootClientId = null) { + var _state$blockListSetti; if (!rootClientId) { return; } - const defaultBlock = state.blockListSettings[rootClientId]?.defaultBlock; - const directInsert = state.blockListSettings[rootClientId]?.directInsert; + const { + defaultBlock, + directInsert + } = (_state$blockListSetti = state.blockListSettings[rootClientId]) !== null && _state$blockListSetti !== void 0 ? _state$blockListSetti : {}; if (!defaultBlock || !directInsert) { return; } - if (typeof directInsert === 'function') { - return directInsert(getBlock(state, rootClientId)) ? defaultBlock : null; - } return defaultBlock; -}, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.tree.get(rootClientId)]); -const __experimentalGetDirectInsertBlock = rememo((state, rootClientId = null) => { +} +function __experimentalGetDirectInsertBlock(state, rootClientId = null) { external_wp_deprecated_default()('wp.data.select( "core/block-editor" ).__experimentalGetDirectInsertBlock', { alternative: 'wp.data.select( "core/block-editor" ).getDirectInsertBlock', since: '6.3', version: '6.4' }); return getDirectInsertBlock(state, rootClientId); -}, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.tree.get(rootClientId)]); -const __experimentalGetParsedPattern = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => rememo((state, patternName) => { - const { - getAllPatterns - } = unlock(select(STORE_NAME)); - const patterns = getAllPatterns(); - const pattern = patterns.find(({ - name - }) => name === patternName); +} +const __experimentalGetParsedPattern = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, patternName) => { + const pattern = unlock(select(STORE_NAME)).getPatternBySlug(patternName); if (!pattern) { return null; } + const blocks = (0,external_wp_blocks_namespaceObject.parse)(pattern.content, { + __unstableSkipMigrationLogs: true + }); + if (blocks.length === 1) { + blocks[0].attributes = { + ...blocks[0].attributes, + metadata: { + ...(blocks[0].attributes.metadata || {}), + categories: pattern.categories, + patternName: pattern.name, + name: blocks[0].attributes.metadata?.name || pattern.title + } + }; + } return { ...pattern, - blocks: (0,external_wp_blocks_namespaceObject.parse)(pattern.content, { - __unstableSkipMigrationLogs: true - }) + blocks }; -}, getAllPatternsDependants(select))); -const getAllowedPatternsDependants = select => (state, rootClientId) => { - return [...getAllPatternsDependants(select)(state), state.settings.allowedBlockTypes, state.settings.templateLock, state.blockListSettings[rootClientId], state.blocks.byClientId.get(rootClientId)]; -}; +}, (state, patternName) => [unlock(select(STORE_NAME)).getPatternBySlug(patternName)])); +const getAllowedPatternsDependants = select => (state, rootClientId) => [...getAllPatternsDependants(select)(state), ...getInsertBlockTypeDependants(state, rootClientId)]; /** * Returns the list of allowed patterns for inner blocks children. @@ -13406,7 +13214,7 @@ const getAllowedPatternsDependants = select => (state, rootClientId) => { * @return {Array?} The list of allowed patterns. */ const __experimentalGetAllowedPatterns = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => { - return rememo((state, rootClientId = null) => { + return (0,external_wp_data_namespaceObject.createSelector)((state, rootClientId = null) => { const { getAllPatterns, __experimentalGetParsedPattern: getParsedPattern @@ -13445,13 +13253,15 @@ const __experimentalGetAllowedPatterns = (0,external_wp_data_namespaceObject.cre * * @return {Array} The list of matched block patterns based on declared `blockTypes` and block name. */ -const getPatternsByBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => rememo((state, blockNames, rootClientId = null) => { - if (!blockNames) return EMPTY_ARRAY; +const getPatternsByBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, blockNames, rootClientId = null) => { + if (!blockNames) { + return selectors_EMPTY_ARRAY; + } const patterns = select(STORE_NAME).__experimentalGetAllowedPatterns(rootClientId); const normalizedBlockNames = Array.isArray(blockNames) ? blockNames : [blockNames]; const filteredPatterns = patterns.filter(pattern => pattern?.blockTypes?.some?.(blockName => normalizedBlockNames.includes(blockName))); if (filteredPatterns.length === 0) { - return EMPTY_ARRAY; + return selectors_EMPTY_ARRAY; } return filteredPatterns; }, (state, blockNames, rootClientId) => getAllowedPatternsDependants(select)(state, rootClientId))); @@ -13481,8 +13291,10 @@ const __experimentalGetPatternsByBlockTypes = (0,external_wp_data_namespaceObjec * * @return {WPBlockPattern[]} Items that are eligible for a pattern transformation. */ -const __experimentalGetPatternTransformItems = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => rememo((state, blocks, rootClientId = null) => { - if (!blocks) return EMPTY_ARRAY; +const __experimentalGetPatternTransformItems = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, blocks, rootClientId = null) => { + if (!blocks) { + return selectors_EMPTY_ARRAY; + } /** * For now we only handle blocks without InnerBlocks and take into account * the `__experimentalRole` property of blocks' attributes for the transformation. @@ -13494,7 +13306,7 @@ const __experimentalGetPatternTransformItems = (0,external_wp_data_namespaceObje clientId, innerBlocks }) => innerBlocks.length || areInnerBlocksControlled(state, clientId))) { - return EMPTY_ARRAY; + return selectors_EMPTY_ARRAY; } // Create a Set of the selected block names that is used in patterns filtering. @@ -13555,7 +13367,7 @@ function isLastBlockChangePersistent(state) { * @return {Object} An object where the keys are client ids and the values are * a block list setting object. */ -const __experimentalGetBlockListSettingsForBlocks = rememo((state, clientIds = []) => { +const __experimentalGetBlockListSettingsForBlocks = (0,external_wp_data_namespaceObject.createSelector)((state, clientIds = []) => { return clientIds.reduce((blockListSettingsForBlocks, clientId) => { if (!state.blockListSettings[clientId]) { return blockListSettingsForBlocks; @@ -13575,13 +13387,17 @@ const __experimentalGetBlockListSettingsForBlocks = rememo((state, clientIds = [ * * @return {string} The reusable block saved title. */ -const __experimentalGetReusableBlockTitle = rememo((state, ref) => { - const reusableBlock = getReusableBlocks(state).find(block => block.id === ref); +const __experimentalGetReusableBlockTitle = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, ref) => { + external_wp_deprecated_default()("wp.data.select( 'core/block-editor' ).__experimentalGetReusableBlockTitle", { + since: '6.6', + version: '6.8' + }); + const reusableBlock = unlock(select(STORE_NAME)).getReusableBlocks().find(block => block.id === ref); if (!reusableBlock) { return null; } return reusableBlock.title?.raw; -}, state => [getReusableBlocks(state)]); +}, () => [unlock(select(STORE_NAME)).getReusableBlocks()])); /** * Returns true if the most recent block change is be considered ignored, or @@ -13614,18 +13430,6 @@ function __experimentalGetLastBlockAttributeChanges(state) { return state.lastBlockAttributesChange; } -/** - * Returns the available reusable blocks - * - * @param {Object} state Global application state. - * - * @return {Array} Reusable blocks - */ -function getReusableBlocks(state) { - var _state$settings$__exp; - return (_state$settings$__exp = state.settings.__experimentalReusableBlocks) !== null && _state$settings$__exp !== void 0 ? _state$settings$__exp : EMPTY_ARRAY; -} - /** * Returns whether the navigation mode is enabled. * @@ -13704,7 +13508,7 @@ function areInnerBlocksControlled(state, clientId) { * * @return {string} The matching block's clientId. */ -const __experimentalGetActiveBlockIdByBlockNames = rememo((state, validBlockNames) => { +const __experimentalGetActiveBlockIdByBlockNames = (0,external_wp_data_namespaceObject.createSelector)((state, validBlockNames) => { if (!validBlockNames.length) { return null; } @@ -13756,51 +13560,13 @@ function isBlockVisible(state, clientId) { * @param {Object} state Global application state. * @return {[string]} List of hidden blocks. */ -const __unstableGetVisibleBlocks = rememo(state => { +const __unstableGetVisibleBlocks = (0,external_wp_data_namespaceObject.createSelector)(state => { const visibleBlocks = new Set(Object.keys(state.blockVisibility).filter(key => state.blockVisibility[key])); if (visibleBlocks.size === 0) { return EMPTY_SET; } return visibleBlocks; }, state => [state.blockVisibility]); - -/** - * DO-NOT-USE in production. - * This selector is created for internal/experimental only usage and may be - * removed anytime without any warning, causing breakage on any plugin or theme invoking it. - */ -const __unstableGetContentLockingParent = rememo((state, clientId) => { - let current = clientId; - let result; - while (current = state.blocks.parents.get(current)) { - if (getBlockName(state, current) === 'core/block' || getTemplateLock(state, current) === 'contentOnly') { - result = current; - } - } - return result; -}, state => [state.blocks.parents, state.blockListSettings]); - -/** - * DO-NOT-USE in production. - * This selector is created for internal/experimental only usage and may be - * removed anytime without any warning, causing breakage on any plugin or theme invoking it. - * - * @param {Object} state Global application state. - */ -function __unstableGetTemporarilyEditingAsBlocks(state) { - return state.temporarilyEditingAsBlocks; -} - -/** - * DO-NOT-USE in production. - * This selector is created for internal/experimental only usage and may be - * removed anytime without any warning, causing breakage on any plugin or theme invoking it. - * - * @param {Object} state Global application state. - */ -function __unstableGetTemporarilyEditingFocusModeToRevert(state) { - return state.temporarilyEditingFocusModeRevert; -} function __unstableHasActiveBlockOverlayActive(state, clientId) { // Prevent overlay on blocks with a non-default editing mode. If the mdoe is // 'disabled' then the overlay is redundant since the block can't be @@ -13816,9 +13582,19 @@ function __unstableHasActiveBlockOverlayActive(state, clientId) { } const editorMode = __unstableGetEditorMode(state); - // In zoom-out mode, the block overlay is always active for top level blocks. - if (editorMode === 'zoom-out' && clientId && !getBlockRootClientId(state, clientId)) { - return true; + // In zoom-out mode, the block overlay is always active for section level blocks. + if (editorMode === 'zoom-out') { + const { + sectionRootClientId + } = unlock(getSettings(state)); + if (sectionRootClientId) { + const sectionClientIds = getBlockOrder(state, sectionRootClientId); + if (sectionClientIds?.includes(clientId)) { + return true; + } + } else if (clientId && !getBlockRootClientId(state, clientId)) { + return true; + } } // In navigation mode, the block overlay is active when the block is not @@ -13874,6 +13650,30 @@ function __unstableIsWithinBlockOverlay(state, clientId) { * `'contentOnly'`, or `'default'`. */ const getBlockEditingMode = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, clientId = '') => { + // Some selectors that call this provide `null` as the default + // rootClientId, but the default rootClientId is actually `''`. + if (clientId === null) { + clientId = ''; + } + // In zoom-out mode, override the behavior set by + // __unstableSetBlockEditingMode to only allow editing the top-level + // sections. + const editorMode = __unstableGetEditorMode(state); + if (editorMode === 'zoom-out') { + const { + sectionRootClientId + } = unlock(getSettings(state)); + if (clientId === '' /* ROOT_CONTAINER_CLIENT_ID */) { + return sectionRootClientId ? 'disabled' : 'contentOnly'; + } + if (clientId === sectionRootClientId) { + return 'contentOnly'; + } + const sectionsClientIds = getBlockOrder(state, sectionRootClientId); + if (!sectionsClientIds?.includes(clientId)) { + return 'disabled'; + } + } const blockEditingMode = state.blockEditingModes.get(clientId); if (blockEditingMode) { return blockEditingMode; @@ -13927,7 +13727,7 @@ const isUngroupable = (0,external_wp_data_namespaceObject.createRegistrySelector * @param {string[]} clientIds Block client ids. If not passed the selected blocks client ids will be used. * @return {boolean} True if the blocks are groupable. */ -const isGroupable = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, clientIds = EMPTY_ARRAY) => { +const isGroupable = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, clientIds = selectors_EMPTY_ARRAY) => { const { getGroupingBlockName } = select(external_wp_blocks_namespaceObject.store); @@ -13936,9 +13736,63 @@ const isGroupable = (0,external_wp_data_namespaceObject.createRegistrySelector)( const rootClientId = _clientIds?.length ? getBlockRootClientId(state, _clientIds[0]) : undefined; const groupingBlockAvailable = canInsertBlockType(state, groupingBlockName, rootClientId); const _isGroupable = groupingBlockAvailable && _clientIds.length; - return _isGroupable && canRemoveBlocks(state, _clientIds, rootClientId); + return _isGroupable && canRemoveBlocks(state, _clientIds); }); +/** + * DO-NOT-USE in production. + * This selector is created for internal/experimental only usage and may be + * removed anytime without any warning, causing breakage on any plugin or theme invoking it. + * + * @deprecated + * + * @param {Object} state Global application state. + * @param {Object} clientId Client Id of the block. + * + * @return {?string} Client ID of the ancestor block that is content locking the block. + */ +const __unstableGetContentLockingParent = (state, clientId) => { + external_wp_deprecated_default()("wp.data.select( 'core/block-editor' ).__unstableGetContentLockingParent", { + since: '6.1', + version: '6.7' + }); + return getContentLockingParent(state, clientId); +}; + +/** + * DO-NOT-USE in production. + * This selector is created for internal/experimental only usage and may be + * removed anytime without any warning, causing breakage on any plugin or theme invoking it. + * + * @deprecated + * + * @param {Object} state Global application state. + */ +function __unstableGetTemporarilyEditingAsBlocks(state) { + external_wp_deprecated_default()("wp.data.select( 'core/block-editor' ).__unstableGetTemporarilyEditingAsBlocks", { + since: '6.1', + version: '6.7' + }); + return getTemporarilyEditingAsBlocks(state); +} + +/** + * DO-NOT-USE in production. + * This selector is created for internal/experimental only usage and may be + * removed anytime without any warning, causing breakage on any plugin or theme invoking it. + * + * @deprecated + * + * @param {Object} state Global application state. + */ +function __unstableGetTemporarilyEditingFocusModeToRevert(state) { + external_wp_deprecated_default()("wp.data.select( 'core/block-editor' ).__unstableGetTemporarilyEditingFocusModeToRevert", { + since: '6.5', + version: '6.7' + }); + return getTemporarilyEditingFocusModeToRevert(state); +} + ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/undo-ignore.js // Keep track of the blocks that should not be pushing an additional // undo stack when editing the entity. @@ -13955,6 +13809,8 @@ const undoIgnoreBlocks = new WeakSet(); * Internal dependencies */ + + const castArray = maybeArray => Array.isArray(maybeArray) ? maybeArray : [maybeArray]; /** @@ -14047,8 +13903,7 @@ const privateRemoveBlocks = (clientIds, selectPrevious = true, forceRemove = fal return; } clientIds = castArray(clientIds); - const rootClientId = select.getBlockRootClientId(clientIds[0]); - const canRemoveBlocks = select.canRemoveBlocks(clientIds, rootClientId); + const canRemoveBlocks = select.canRemoveBlocks(clientIds); if (!canRemoveBlocks) { return; } @@ -14064,41 +13919,30 @@ const privateRemoveBlocks = (clientIds, selectPrevious = true, forceRemove = fal // @see https://github.com/WordPress/gutenberg/pull/51145 const rules = !forceRemove && select.getBlockRemovalRules(); if (rules) { - const blockNamesForPrompt = new Set(); - - // Given a list of client IDs of blocks that the user intended to - // remove, perform a tree search (BFS) to find all block names - // corresponding to "important" blocks, i.e. blocks that require a - // removal prompt. - const queue = [...clientIds]; - let messageType = 'templates'; - while (queue.length) { - const clientId = queue.shift(); - const blockName = select.getBlockName(clientId); - if (rules[blockName]) { - blockNamesForPrompt.add(blockName); - } - if (rules['bindings/core/pattern-overrides']) { - const parentPatternBlocks = select.getBlockParentsByBlockName(clientId, 'core/block'); - // We only need to run this check when editing the original pattern, not pattern instances. - if (parentPatternBlocks?.length > 0) { - continue; - } - const blockAttributes = select.getBlockAttributes(clientId); - if (blockAttributes?.metadata?.bindings && JSON.stringify(blockAttributes.metadata.bindings).includes('core/pattern-overrides')) { - blockNamesForPrompt.add(blockName); - messageType = 'patternOverrides'; - } + function flattenBlocks(blocks) { + const result = []; + const stack = [...blocks]; + while (stack.length) { + const { + innerBlocks, + ...block + } = stack.shift(); + stack.push(...innerBlocks); + result.push(block); } - const innerBlocks = select.getBlockOrder(clientId); - queue.push(...innerBlocks); + return result; } + const blockList = clientIds.map(select.getBlock); + const flattenedBlocks = flattenBlocks(blockList); - // If any such blocks were found, trigger the removal prompt and - // skip any other steps (thus postponing actual removal). - if (blockNamesForPrompt.size) { - dispatch(displayBlockRemovalPrompt(clientIds, selectPrevious, Array.from(blockNamesForPrompt), messageType)); - return; + // Find the first message and use it. + let message; + for (const rule of rules) { + message = rule.callback(flattenedBlocks); + if (message) { + dispatch(displayBlockRemovalPrompt(clientIds, selectPrevious, message)); + return; + } } } if (selectPrevious) { @@ -14153,26 +13997,21 @@ const ensureDefaultBlock = () => ({ * * Contrast with `setBlockRemovalRules`. * - * @param {string|string[]} clientIds Client IDs of blocks to remove. - * @param {boolean} selectPrevious True if the previous block - * or the immediate parent - * (if no previous block exists) - * should be selected - * when a block is removed. - * @param {string[]} blockNamesForPrompt Names of the blocks that - * triggered the need for - * confirmation before removal. - * @param {string} messageType The type of message to display. + * @param {string|string[]} clientIds Client IDs of blocks to remove. + * @param {boolean} selectPrevious True if the previous block or the + * immediate parent (if no previous + * block exists) should be selected + * when a block is removed. + * @param {string} message Message to display in the prompt. * * @return {Object} Action object. */ -function displayBlockRemovalPrompt(clientIds, selectPrevious, blockNamesForPrompt, messageType) { +function displayBlockRemovalPrompt(clientIds, selectPrevious, message) { return { type: 'DISPLAY_BLOCK_REMOVAL_PROMPT', clientIds, selectPrevious, - blockNamesForPrompt, - messageType + message }; } @@ -14298,9 +14137,10 @@ function setLastFocus(lastFocus = null) { function stopEditingAsBlocks(clientId) { return ({ select, - dispatch + dispatch, + registry }) => { - const focusModeToRevert = select.__unstableGetTemporarilyEditingFocusModeToRevert(); + const focusModeToRevert = unlock(registry.select(store)).getTemporarilyEditingFocusModeToRevert(); dispatch.__unstableMarkNextChangeAsNotPersistent(); dispatch.updateBlockAttributes(clientId, { templateLock: 'contentOnly' @@ -14338,694 +14178,165 @@ function stopDragging() { }; } -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/utils.js -/** - * WordPress dependencies - */ - - -const INSERTER_PATTERN_TYPES = { - user: 'user', - theme: 'theme', - directory: 'directory' -}; -const INSERTER_SYNC_TYPES = { - full: 'fully', - unsynced: 'unsynced' -}; -const allPatternsCategory = { - name: 'allPatterns', - label: (0,external_wp_i18n_namespaceObject._x)('All', 'patterns') -}; -const myPatternsCategory = { - name: 'myPatterns', - label: (0,external_wp_i18n_namespaceObject.__)('My patterns') -}; -function isPatternFiltered(pattern, sourceFilter, syncFilter) { - const isUserPattern = pattern.name.startsWith('core/block'); - const isDirectoryPattern = pattern.source === 'core' || pattern.source?.startsWith('pattern-directory'); - - // If theme source selected, filter out user created patterns and those from - // the core patterns directory. - if (sourceFilter === INSERTER_PATTERN_TYPES.theme && (isUserPattern || isDirectoryPattern)) { - return true; - } - - // If the directory source is selected, filter out user created patterns - // and those bundled with the theme. - if (sourceFilter === INSERTER_PATTERN_TYPES.directory && (isUserPattern || !isDirectoryPattern)) { - return true; - } - - // If user source selected, filter out theme patterns. - if (sourceFilter === INSERTER_PATTERN_TYPES.user && pattern.type !== INSERTER_PATTERN_TYPES.user) { - return true; - } - - // Filter by sync status. - if (syncFilter === INSERTER_SYNC_TYPES.full && pattern.syncStatus !== '') { - return true; - } - if (syncFilter === INSERTER_SYNC_TYPES.unsynced && pattern.syncStatus !== 'unsynced' && isUserPattern) { - return true; - } - return false; -} - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/object.js /** - * Immutably sets a value inside an object. Like `lodash#set`, but returning a - * new object. Treats nullish initial values as empty objects. Clones any - * nested objects. Supports arrays, too. + * @param {string|null} clientId The block's clientId, or `null` to clear. * - * @param {Object} object Object to set a value in. - * @param {number|string|Array} path Path in the object to modify. - * @param {*} value New value to set. - * @return {Object} Cloned object with the new value set. + * @return {Object} Action object. */ -function setImmutably(object, path, value) { - // Normalize path - path = Array.isArray(path) ? [...path] : [path]; - - // Shallowly clone the base of the object - object = Array.isArray(object) ? [...object] : { - ...object +function expandBlock(clientId) { + return { + type: 'SET_BLOCK_EXPANDED_IN_LIST_VIEW', + clientId }; - const leaf = path.pop(); - - // Traverse object from root to leaf, shallowly cloning at each level - let prev = object; - for (const key of path) { - const lvl = prev[key]; - prev = prev[key] = Array.isArray(lvl) ? [...lvl] : { - ...lvl - }; - } - prev[leaf] = value; - return object; } /** - * Helper util to return a value from a certain path of the object. - * Path is specified as either: - * - a string of properties, separated by dots, for example: "x.y". - * - an array of properties, for example `[ 'x', 'y' ]`. - * You can also specify a default value in case the result is nullish. + * Temporarily modify/unlock the content-only block for editions. * - * @param {Object} object Input object. - * @param {string|Array} path Path to the object property. - * @param {*} defaultValue Default value if the value at the specified path is nullish. - * @return {*} Value of the object property at the specified path. + * @param {string} clientId The client id of the block. */ -const getValueFromObjectPath = (object, path, defaultValue) => { - var _value; - const arrayPath = Array.isArray(path) ? path : path.split('.'); - let value = object; - arrayPath.forEach(fieldName => { - value = value?.[fieldName]; +const modifyContentLockBlock = clientId => ({ + select, + dispatch +}) => { + dispatch.__unstableMarkNextChangeAsNotPersistent(); + dispatch.updateBlockAttributes(clientId, { + templateLock: undefined }); - return (_value = value) !== null && _value !== void 0 ? _value : defaultValue; + dispatch.updateBlockListSettings(clientId, { + ...select.getBlockListSettings(clientId), + templateLock: false + }); + const focusModeToRevert = select.getSettings().focusMode; + dispatch.updateSettings({ + focusMode: true + }); + dispatch.__unstableSetTemporarilyEditingAsBlocks(clientId, focusModeToRevert); }; -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/get-block-settings.js +;// CONCATENATED MODULE: external ["wp","a11y"] +const external_wp_a11y_namespaceObject = window["wp"]["a11y"]; +;// CONCATENATED MODULE: external ["wp","notices"] +const external_wp_notices_namespaceObject = window["wp"]["notices"]; +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/selection.js /** * WordPress dependencies */ - /** - * Internal dependencies + * A robust way to retain selection position through various + * transforms is to insert a special character at the position and + * then recover it. */ - - -const blockedPaths = ['color', 'border', 'dimensions', 'typography', 'spacing']; -const deprecatedFlags = { - 'color.palette': settings => settings.colors, - 'color.gradients': settings => settings.gradients, - 'color.custom': settings => settings.disableCustomColors === undefined ? undefined : !settings.disableCustomColors, - 'color.customGradient': settings => settings.disableCustomGradients === undefined ? undefined : !settings.disableCustomGradients, - 'typography.fontSizes': settings => settings.fontSizes, - 'typography.customFontSize': settings => settings.disableCustomFontSizes === undefined ? undefined : !settings.disableCustomFontSizes, - 'typography.lineHeight': settings => settings.enableCustomLineHeight, - 'spacing.units': settings => { - if (settings.enableCustomUnits === undefined) { - return; - } - if (settings.enableCustomUnits === true) { - return ['px', 'em', 'rem', 'vh', 'vw', '%']; - } - return settings.enableCustomUnits; - }, - 'spacing.padding': settings => settings.enableCustomSpacing -}; -const prefixedFlags = { - /* - * These were only available in the plugin - * and can be removed when the minimum WordPress version - * for the plugin is 5.9. - */ - 'border.customColor': 'border.color', - 'border.customStyle': 'border.style', - 'border.customWidth': 'border.width', - 'typography.customFontStyle': 'typography.fontStyle', - 'typography.customFontWeight': 'typography.fontWeight', - 'typography.customLetterSpacing': 'typography.letterSpacing', - 'typography.customTextDecorations': 'typography.textDecoration', - 'typography.customTextTransforms': 'typography.textTransform', - /* - * These were part of WordPress 5.8 and we need to keep them. - */ - 'border.customRadius': 'border.radius', - 'spacing.customMargin': 'spacing.margin', - 'spacing.customPadding': 'spacing.padding', - 'typography.customLineHeight': 'typography.lineHeight' -}; +const START_OF_SELECTED_AREA = '\u0086'; /** - * Remove `custom` prefixes for flags that did not land in 5.8. - * - * This provides continued support for `custom` prefixed properties. It will - * be removed once third party devs have had sufficient time to update themes, - * plugins, etc. - * - * @see https://github.com/WordPress/gutenberg/pull/34485 + * Retrieve the block attribute that contains the selection position. * - * @param {string} path Path to desired value in settings. - * @return {string} The value for defined setting. - */ -const removeCustomPrefixes = path => { - return prefixedFlags[path] || path; -}; - -/** - * For settings like `color.palette`, which have a value that is an object - * with `default`, `theme`, `custom`, with field values that are arrays of - * items, merge these three arrays into one and return it. The calculation - * is memoized so that identical input values produce identical output. - * @param {Object} value Object to merge - * @return {Array} Array of merged items + * @param {Object} blockAttributes Block attributes. + * @return {string|void} The name of the block attribute that was previously selected. */ -function mergeOrigins(value) { - let result = mergeCache.get(value); - if (!result) { - result = ['default', 'theme', 'custom'].flatMap(key => { - var _value$key; - return (_value$key = value[key]) !== null && _value$key !== void 0 ? _value$key : []; - }); - mergeCache.set(value, result); +function retrieveSelectedAttribute(blockAttributes) { + if (!blockAttributes) { + return; } - return result; + return Object.keys(blockAttributes).find(name => { + const value = blockAttributes[name]; + return (typeof value === 'string' || value instanceof external_wp_richText_namespaceObject.RichTextData) && + // To do: refactor this to use rich text's selection instead, so we + // no longer have to use on this hack inserting a special character. + value.toString().indexOf(START_OF_SELECTED_AREA) !== -1; + }); } -const mergeCache = new WeakMap(); - -/** - * For settings like `color.palette`, which have a value that is an object - * with `default`, `theme`, `custom`, with field values that are arrays of - * items, returns the one with the highest priority among these three arrays. - * @param {Object} value Object to extract from - * @return {Array} Array of items extracted from the three origins - */ -function overrideOrigins(value) { - var _ref, _value$custom; - return (_ref = (_value$custom = value.custom) !== null && _value$custom !== void 0 ? _value$custom : value.theme) !== null && _ref !== void 0 ? _ref : value.default; +function findRichTextAttributeKey(blockType) { + for (const [key, value] of Object.entries(blockType.attributes)) { + if (value.source === 'rich-text' || value.source === 'html') { + return key; + } + } } +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/actions.js +/* eslint no-console: [ 'error', { allow: [ 'error', 'warn' ] } ] */ /** - * For settings like `color.palette`, which have a value that is an object - * with `default`, `theme`, `custom`, with field values that are arrays of - * items, see if any of the three origins have values. - * - * @param {Object} value Object to check - * @return {boolean} Whether the object has values in any of the three origins + * WordPress dependencies */ -function hasOriginValue(value) { - return ['default', 'theme', 'custom'].some(key => value?.[key]?.length); -} -function getBlockSettings(state, clientId, ...paths) { - const blockName = getBlockName(state, clientId); - const candidates = []; - if (clientId) { - let id = clientId; - do { - const name = getBlockName(state, id); - if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, '__experimentalSettings', false)) { - candidates.push(id); - } - } while (id = state.blocks.parents.get(id)); - } - return paths.map(path => { - if (blockedPaths.includes(path)) { - // eslint-disable-next-line no-console - console.warn('Top level useSetting paths are disabled. Please use a subpath to query the information needed.'); - return undefined; - } - // 0. Allow third parties to filter the block's settings at runtime. - let result = (0,external_wp_hooks_namespaceObject.applyFilters)('blockEditor.useSetting.before', undefined, path, clientId, blockName); - if (undefined !== result) { - return result; - } - const normalizedPath = removeCustomPrefixes(path); - // 1. Take settings from the block instance or its ancestors. - // Start from the current block and work our way up the ancestors. - for (const candidateClientId of candidates) { - var _getValueFromObjectPa; - const candidateAtts = getBlockAttributes(state, candidateClientId); - result = (_getValueFromObjectPa = getValueFromObjectPath(candidateAtts.settings?.blocks?.[blockName], normalizedPath)) !== null && _getValueFromObjectPa !== void 0 ? _getValueFromObjectPa : getValueFromObjectPath(candidateAtts.settings, normalizedPath); - if (result !== undefined) { - // Stop the search for more distant ancestors and move on. - break; - } - } - // 2. Fall back to the settings from the block editor store (__experimentalFeatures). - const settings = getSettings(state); - if (result === undefined && blockName) { - result = getValueFromObjectPath(settings.__experimentalFeatures?.blocks?.[blockName], normalizedPath); - } - if (result === undefined) { - result = getValueFromObjectPath(settings.__experimentalFeatures, normalizedPath); - } - // Return if the setting was found in either the block instance or the store. - if (result !== undefined) { - if (external_wp_blocks_namespaceObject.__EXPERIMENTAL_PATHS_WITH_OVERRIDE[normalizedPath]) { - return overrideOrigins(result); - } - return result; - } - // 3. Otherwise, use deprecated settings. - const deprecatedSettingsValue = deprecatedFlags[normalizedPath]?.(settings); - if (deprecatedSettingsValue !== undefined) { - return deprecatedSettingsValue; - } - // 4. Fallback for typography.dropCap: - // This is only necessary to support typography.dropCap. - // when __experimentalFeatures are not present (core without plugin). - // To remove when __experimentalFeatures are ported to core. - return normalizedPath === 'typography.dropCap' ? true : undefined; - }); -} -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/private-selectors.js /** - * External dependencies + * Internal dependencies */ -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ +/** @typedef {import('../components/use-on-block-drop/types').WPDropOperation} WPDropOperation */ +const actions_castArray = maybeArray => Array.isArray(maybeArray) ? maybeArray : [maybeArray]; +/** + * Action that resets blocks state to the specified array of blocks, taking precedence + * over any other content reflected as an edit in state. + * + * @param {Array} blocks Array of blocks. + */ +const resetBlocks = blocks => ({ + dispatch +}) => { + dispatch({ + type: 'RESET_BLOCKS', + blocks + }); + dispatch(validateBlocksToTemplate(blocks)); +}; +/** + * Block validity is a function of blocks state (at the point of a + * reset) and the template setting. As a compromise to its placement + * across distinct parts of state, it is implemented here as a side + * effect of the block reset action. + * + * @param {Array} blocks Array of blocks. + */ +const validateBlocksToTemplate = blocks => ({ + select, + dispatch +}) => { + const template = select.getTemplate(); + const templateLock = select.getTemplateLock(); + // Unlocked templates are considered always valid because they act + // as default values only. + const isBlocksValidToTemplate = !template || templateLock !== 'all' || (0,external_wp_blocks_namespaceObject.doBlocksMatchTemplate)(blocks, template); + // Update if validity has changed. + const isValidTemplate = select.isValidTemplate(); + if (isBlocksValidToTemplate !== isValidTemplate) { + dispatch.setTemplateValidity(isBlocksValidToTemplate); + return isBlocksValidToTemplate; + } +}; /** - * Returns true if the block interface is hidden, or false otherwise. + * A block selection object. * - * @param {Object} state Global application state. + * @typedef {Object} WPBlockSelection * - * @return {boolean} Whether the block toolbar is hidden. + * @property {string} clientId A block client ID. + * @property {string} attributeKey A block attribute key. + * @property {number} offset An attribute value offset, based on the rich + * text value. See `wp.richText.create`. */ -function private_selectors_isBlockInterfaceHidden(state) { - return state.isBlockInterfaceHidden; -} /** - * Gets the client ids of the last inserted blocks. - * - * @param {Object} state Global application state. - * @return {Array|undefined} Client Ids of the last inserted block(s). - */ -function getLastInsertedBlocksClientIds(state) { - return state?.lastBlockInserted?.clientIds; -} -function getBlockWithoutAttributes(state, clientId) { - return state.blocks.byClientId.get(clientId); -} - -/** - * Returns true if all of the descendants of a block with the given client ID - * have an editing mode of 'disabled', or false otherwise. - * - * @param {Object} state Global application state. - * @param {string} clientId The block client ID. - * - * @return {boolean} Whether the block descendants are disabled. - */ -const isBlockSubtreeDisabled = (state, clientId) => { - const isChildSubtreeDisabled = childClientId => { - return getBlockEditingMode(state, childClientId) === 'disabled' && getBlockOrder(state, childClientId).every(isChildSubtreeDisabled); - }; - return getBlockOrder(state, clientId).every(isChildSubtreeDisabled); -}; -function getEnabledClientIdsTreeUnmemoized(state, rootClientId) { - const blockOrder = getBlockOrder(state, rootClientId); - const result = []; - for (const clientId of blockOrder) { - const innerBlocks = getEnabledClientIdsTreeUnmemoized(state, clientId); - if (getBlockEditingMode(state, clientId) !== 'disabled') { - result.push({ - clientId, - innerBlocks - }); - } else { - result.push(...innerBlocks); - } - } - return result; -} - -/** - * Returns a tree of block objects with only clientID and innerBlocks set. - * Blocks with a 'disabled' editing mode are not included. - * - * @param {Object} state Global application state. - * @param {?string} rootClientId Optional root client ID of block list. - * - * @return {Object[]} Tree of block objects with only clientID and innerBlocks set. - */ -const getEnabledClientIdsTree = rememo(getEnabledClientIdsTreeUnmemoized, state => [state.blocks.order, state.blockEditingModes, state.settings.templateLock, state.blockListSettings]); - -/** - * Returns a list of a given block's ancestors, from top to bottom. Blocks with - * a 'disabled' editing mode are excluded. - * - * @see getBlockParents - * - * @param {Object} state Global application state. - * @param {string} clientId The block client ID. - * @param {boolean} ascending Order results from bottom to top (true) or top - * to bottom (false). - */ -const getEnabledBlockParents = rememo((state, clientId, ascending = false) => { - return getBlockParents(state, clientId, ascending).filter(parent => getBlockEditingMode(state, parent) !== 'disabled'); -}, state => [state.blocks.parents, state.blockEditingModes, state.settings.templateLock, state.blockListSettings]); - -/** - * Selector that returns the data needed to display a prompt when certain - * blocks are removed, or `false` if no such prompt is requested. - * - * @param {Object} state Global application state. - * - * @return {Object|false} Data for removal prompt display, if any. - */ -function getRemovalPromptData(state) { - return state.removalPromptData; -} - -/** - * Returns true if removal prompt exists, or false otherwise. - * - * @param {Object} state Global application state. - * - * @return {boolean} Whether removal prompt exists. - */ -function getBlockRemovalRules(state) { - return state.blockRemovalRules; -} - -/** - * Returns the client ID of the block settings menu that is currently open. - * - * @param {Object} state Global application state. - * @return {string|null} The client ID of the block menu that is currently open. - */ -function getOpenedBlockSettingsMenu(state) { - return state.openedBlockSettingsMenu; -} - -/** - * Returns all style overrides, intended to be merged with global editor styles. - * - * @param {Object} state Global application state. - * - * @return {Map} A map of style IDs to style overrides. - */ -function getStyleOverrides(state) { - return state.styleOverrides; -} - -/** @typedef {import('./actions').InserterMediaCategory} InserterMediaCategory */ -/** - * Returns the registered inserter media categories through the public API. - * - * @param {Object} state Editor state. - * - * @return {InserterMediaCategory[]} Inserter media categories. - */ -function getRegisteredInserterMediaCategories(state) { - return state.registeredInserterMediaCategories; -} - -/** - * Returns an array containing the allowed inserter media categories. - * It merges the registered media categories from extenders with the - * core ones. It also takes into account the allowed `mime_types`, which - * can be altered by `upload_mimes` filter and restrict some of them. - * - * @param {Object} state Global application state. - * - * @return {InserterMediaCategory[]} Client IDs of descendants. - */ -const getInserterMediaCategories = rememo(state => { - const { - settings: { - inserterMediaCategories, - allowedMimeTypes, - enableOpenverseMediaCategory - }, - registeredInserterMediaCategories - } = state; - // The allowed `mime_types` can be altered by `upload_mimes` filter and restrict - // some of them. In this case we shouldn't add the category to the available media - // categories list in the inserter. - if (!inserterMediaCategories && !registeredInserterMediaCategories.length || !allowedMimeTypes) { - return; - } - const coreInserterMediaCategoriesNames = inserterMediaCategories?.map(({ - name - }) => name) || []; - const mergedCategories = [...(inserterMediaCategories || []), ...(registeredInserterMediaCategories || []).filter(({ - name - }) => !coreInserterMediaCategoriesNames.includes(name))]; - return mergedCategories.filter(category => { - // Check if Openverse category is enabled. - if (!enableOpenverseMediaCategory && category.name === 'openverse') { - return false; - } - return Object.values(allowedMimeTypes).some(mimeType => mimeType.startsWith(`${category.mediaType}/`)); - }); -}, state => [state.settings.inserterMediaCategories, state.settings.allowedMimeTypes, state.settings.enableOpenverseMediaCategory, state.registeredInserterMediaCategories]); - -/** - * Returns whether there is at least one allowed pattern for inner blocks children. - * This is useful for deferring the parsing of all patterns until needed. - * - * @param {Object} state Editor state. - * @param {string} [rootClientId=null] Target root client ID. - * - * @return {boolean} If there is at least one allowed pattern. - */ -const hasAllowedPatterns = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => rememo((state, rootClientId = null) => { - const { - getAllPatterns, - __experimentalGetParsedPattern - } = unlock(select(STORE_NAME)); - const patterns = getAllPatterns(); - const { - allowedBlockTypes - } = getSettings(state); - return patterns.some(({ - name, - inserter = true - }) => { - if (!inserter) { - return false; - } - const { - blocks - } = __experimentalGetParsedPattern(name); - return checkAllowListRecursive(blocks, allowedBlockTypes) && blocks.every(({ - name: blockName - }) => canInsertBlockType(state, blockName, rootClientId)); - }); -}, (state, rootClientId) => [getAllPatternsDependants(select)(state), state.settings.allowedBlockTypes, state.settings.templateLock, state.blockListSettings[rootClientId], state.blocks.byClientId.get(rootClientId)])); -const getAllPatterns = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => rememo(state => { - var _state$settings$selec; - // This setting is left for back compat. - const { - __experimentalBlockPatterns = [], - __experimentalUserPatternCategories = [], - __experimentalReusableBlocks = [] - } = state.settings; - const userPatterns = (__experimentalReusableBlocks !== null && __experimentalReusableBlocks !== void 0 ? __experimentalReusableBlocks : []).map(userPattern => { - return { - name: `core/block/${userPattern.id}`, - id: userPattern.id, - type: INSERTER_PATTERN_TYPES.user, - title: userPattern.title.raw, - categories: userPattern.wp_pattern_category.map(catId => { - const category = (__experimentalUserPatternCategories !== null && __experimentalUserPatternCategories !== void 0 ? __experimentalUserPatternCategories : []).find(({ - id - }) => id === catId); - return category ? category.slug : catId; - }), - content: userPattern.content.raw, - syncStatus: userPattern.wp_pattern_sync_status - }; - }); - return [...userPatterns, ...__experimentalBlockPatterns, ...((_state$settings$selec = state.settings[selectBlockPatternsKey]?.(select)) !== null && _state$settings$selec !== void 0 ? _state$settings$selec : [])].filter((x, index, arr) => index === arr.findIndex(y => x.name === y.name)); -}, getAllPatternsDependants(select))); - -/** - * Returns the element of the last element that had focus when focus left the editor canvas. - * - * @param {Object} state Block editor state. - * - * @return {Object} Element. - */ -function getLastFocus(state) { - return state.lastFocus; -} - -/** - * Returns true if the user is dragging anything, or false otherwise. It is possible for a - * user to be dragging data from outside of the editor, so this selector is separate from - * the `isDraggingBlocks` selector which only returns true if the user is dragging blocks. - * - * @param {Object} state Global application state. - * - * @return {boolean} Whether user is dragging. - */ -function private_selectors_isDragging(state) { - return state.isDragging; -} - -;// CONCATENATED MODULE: external ["wp","a11y"] -const external_wp_a11y_namespaceObject = window["wp"]["a11y"]; -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/selection.js -/** - * WordPress dependencies - */ - - -/** - * A robust way to retain selection position through various - * transforms is to insert a special character at the position and - * then recover it. - */ -const START_OF_SELECTED_AREA = '\u0086'; - -/** - * Retrieve the block attribute that contains the selection position. - * - * @param {Object} blockAttributes Block attributes. - * @return {string|void} The name of the block attribute that was previously selected. - */ -function retrieveSelectedAttribute(blockAttributes) { - if (!blockAttributes) { - return; - } - return Object.keys(blockAttributes).find(name => { - const value = blockAttributes[name]; - return (typeof value === 'string' || value instanceof external_wp_richText_namespaceObject.RichTextData) && - // To do: refactor this to use rich text's selection instead, so we - // no longer have to use on this hack inserting a special character. - value.toString().indexOf(START_OF_SELECTED_AREA) !== -1; - }); -} - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/actions.js -/* eslint no-console: [ 'error', { allow: [ 'error', 'warn' ] } ] */ -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - - -/** @typedef {import('../components/use-on-block-drop/types').WPDropOperation} WPDropOperation */ - -const actions_castArray = maybeArray => Array.isArray(maybeArray) ? maybeArray : [maybeArray]; - -/** - * Action that resets blocks state to the specified array of blocks, taking precedence - * over any other content reflected as an edit in state. - * - * @param {Array} blocks Array of blocks. - */ -const resetBlocks = blocks => ({ - dispatch -}) => { - dispatch({ - type: 'RESET_BLOCKS', - blocks - }); - dispatch(validateBlocksToTemplate(blocks)); -}; - -/** - * Block validity is a function of blocks state (at the point of a - * reset) and the template setting. As a compromise to its placement - * across distinct parts of state, it is implemented here as a side - * effect of the block reset action. - * - * @param {Array} blocks Array of blocks. - */ -const validateBlocksToTemplate = blocks => ({ - select, - dispatch -}) => { - const template = select.getTemplate(); - const templateLock = select.getTemplateLock(); - - // Unlocked templates are considered always valid because they act - // as default values only. - const isBlocksValidToTemplate = !template || templateLock !== 'all' || (0,external_wp_blocks_namespaceObject.doBlocksMatchTemplate)(blocks, template); - - // Update if validity has changed. - const isValidTemplate = select.isValidTemplate(); - if (isBlocksValidToTemplate !== isValidTemplate) { - dispatch.setTemplateValidity(isBlocksValidToTemplate); - return isBlocksValidToTemplate; - } -}; - -/** - * A block selection object. - * - * @typedef {Object} WPBlockSelection - * - * @property {string} clientId A block client ID. - * @property {string} attributeKey A block attribute key. - * @property {number} offset An attribute value offset, based on the rich - * text value. See `wp.richText.create`. - */ - -/** - * A selection object. + * A selection object. * * @typedef {Object} WPSelection * @@ -15247,34 +14558,6 @@ function toggleSelection(isSelectionEnabled = true) { isSelectionEnabled }; } -function getBlocksWithDefaultStylesApplied(blocks, blockEditorSettings) { - var _blockEditorSettings$; - const preferredStyleVariations = (_blockEditorSettings$ = blockEditorSettings?.__experimentalPreferredStyleVariations?.value) !== null && _blockEditorSettings$ !== void 0 ? _blockEditorSettings$ : {}; - return blocks.map(block => { - const blockName = block.name; - if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, 'defaultStylePicker', true)) { - return block; - } - if (!preferredStyleVariations[blockName]) { - return block; - } - const className = block.attributes?.className; - if (className?.includes('is-style-')) { - return block; - } - const { - attributes = {} - } = block; - const blockStyle = preferredStyleVariations[blockName]; - return { - ...block, - attributes: { - ...attributes, - className: `${className || ''} is-style-${blockStyle}`.trim() - } - }; - }); -} /* eslint-disable jsdoc/valid-types */ /** @@ -15295,7 +14578,7 @@ const replaceBlocks = (clientIds, blocks, indexToSelect, initialPosition = 0, me }) => { /* eslint-enable jsdoc/valid-types */ clientIds = actions_castArray(clientIds); - blocks = getBlocksWithDefaultStylesApplied(actions_castArray(blocks), select.getSettings()); + blocks = actions_castArray(blocks); const rootClientId = select.getBlockRootClientId(clientIds[0]); // Replace is valid if the new blocks can be inserted in the root block. for (let index = 0; index < blocks.length; index++) { @@ -15348,7 +14631,7 @@ const createOnMove = type => (clientIds, rootClientId) => ({ dispatch }) => { // If one of the blocks is locked or the parent is locked, we cannot move any block. - const canMoveBlocks = select.canMoveBlocks(clientIds, rootClientId); + const canMoveBlocks = select.canMoveBlocks(clientIds); if (!canMoveBlocks) { return; } @@ -15373,7 +14656,7 @@ const moveBlocksToPosition = (clientIds, fromRootClientId = '', toRootClientId = select, dispatch }) => { - const canMoveBlocks = select.canMoveBlocks(clientIds, fromRootClientId); + const canMoveBlocks = select.canMoveBlocks(clientIds); // If one of the blocks is locked or the parent is locked, we cannot move any block. if (!canMoveBlocks) { @@ -15382,7 +14665,7 @@ const moveBlocksToPosition = (clientIds, fromRootClientId = '', toRootClientId = // If moving inside the same root block the move is always possible. if (fromRootClientId !== toRootClientId) { - const canRemoveBlocks = select.canRemoveBlocks(clientIds, fromRootClientId); + const canRemoveBlocks = select.canRemoveBlocks(clientIds); // If we're moving to another block, it means we're deleting blocks from // the original block, so we need to check if removing is possible. @@ -15464,7 +14747,7 @@ const insertBlocks = (blocks, index, rootClientId, updateSelection = true, initi hint: 'The meta argument is now the 6th argument of the function' }); } - blocks = getBlocksWithDefaultStylesApplied(actions_castArray(blocks), select.getSettings()); + blocks = actions_castArray(blocks); const allowedBlocks = []; for (const block of blocks) { const isValid = select.canInsertBlockType(block.name, rootClientId); @@ -15573,10 +14856,14 @@ const __unstableDeleteSelection = isForward => ({ }) => { const selectionAnchor = select.getSelectionStart(); const selectionFocus = select.getSelectionEnd(); - if (selectionAnchor.clientId === selectionFocus.clientId) return; + if (selectionAnchor.clientId === selectionFocus.clientId) { + return; + } // It's not mergeable if there's no rich text selection. - if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === 'undefined' || typeof selectionFocus.offset === 'undefined') return false; + if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === 'undefined' || typeof selectionFocus.offset === 'undefined') { + return false; + } const anchorRootClientId = select.getBlockRootClientId(selectionAnchor.clientId); const focusRootClientId = select.getBlockRootClientId(selectionFocus.clientId); @@ -15678,17 +14965,15 @@ const __unstableDeleteSelection = isForward => ({ /** * Split the current selection. + * @param {?Array} blocks */ -const __unstableSplitSelection = () => ({ +const __unstableSplitSelection = (blocks = []) => ({ + registry, select, dispatch }) => { const selectionAnchor = select.getSelectionStart(); const selectionFocus = select.getSelectionEnd(); - if (selectionAnchor.clientId === selectionFocus.clientId) return; - - // Can't split if the selection is not set. - if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === 'undefined' || typeof selectionFocus.offset === 'undefined') return; const anchorRootClientId = select.getBlockRootClientId(selectionAnchor.clientId); const focusRootClientId = select.getBlockRootClientId(selectionFocus.clientId); @@ -15714,8 +14999,65 @@ const __unstableSplitSelection = () => ({ const selectionB = selectionEnd; const blockA = select.getBlock(selectionA.clientId); const blockB = select.getBlock(selectionB.clientId); - const htmlA = blockA.attributes[selectionA.attributeKey]; - const htmlB = blockB.attributes[selectionB.attributeKey]; + const blockAType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockA.name); + const blockBType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockB.name); + const attributeKeyA = typeof selectionA.attributeKey === 'string' ? selectionA.attributeKey : findRichTextAttributeKey(blockAType); + const attributeKeyB = typeof selectionB.attributeKey === 'string' ? selectionB.attributeKey : findRichTextAttributeKey(blockBType); + const blockAttributes = select.getBlockAttributes(selectionA.clientId); + const bindings = blockAttributes?.metadata?.bindings; + + // If the attribute is bound, don't split the selection and insert a new block instead. + if (bindings?.[attributeKeyA]) { + // Show warning if user tries to insert a block into another block with bindings. + if (blocks.length) { + const { + createWarningNotice + } = registry.dispatch(external_wp_notices_namespaceObject.store); + createWarningNotice((0,external_wp_i18n_namespaceObject.__)("Blocks can't be inserted into other blocks with bindings"), { + type: 'snackbar' + }); + return; + } + dispatch.insertAfterBlock(selectionA.clientId); + return; + } + + // Can't split if the selection is not set. + if (!attributeKeyA || !attributeKeyB || typeof selectionAnchor.offset === 'undefined' || typeof selectionFocus.offset === 'undefined') { + return; + } + + // We can do some short-circuiting if the selection is collapsed. + if (selectionA.clientId === selectionB.clientId && attributeKeyA === attributeKeyB && selectionA.offset === selectionB.offset) { + // If an unmodified default block is selected, replace it. We don't + // want to be converting into a default block. + if (blocks.length) { + if ((0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(blockA)) { + dispatch.replaceBlocks([selectionA.clientId], blocks, blocks.length - 1, -1); + return; + } + } + + // If selection is at the start or end, we can simply insert an + // empty block, provided this block has no inner blocks. + else if (!select.getBlockOrder(selectionA.clientId).length) { + function createEmpty() { + const defaultBlockName = (0,external_wp_blocks_namespaceObject.getDefaultBlockName)(); + return select.canInsertBlockType(defaultBlockName, anchorRootClientId) ? (0,external_wp_blocks_namespaceObject.createBlock)(defaultBlockName) : (0,external_wp_blocks_namespaceObject.createBlock)(select.getBlockName(selectionA.clientId)); + } + const length = blockAttributes[attributeKeyA].length; + if (selectionA.offset === 0 && length) { + dispatch.insertBlocks([createEmpty()], select.getBlockIndex(selectionA.clientId), anchorRootClientId, false); + return; + } + if (selectionA.offset === length) { + dispatch.insertBlocks([createEmpty()], select.getBlockIndex(selectionA.clientId) + 1, anchorRootClientId); + return; + } + } + } + const htmlA = blockA.attributes[attributeKeyA]; + const htmlB = blockB.attributes[attributeKeyB]; let valueA = (0,external_wp_richText_namespaceObject.create)({ html: htmlA }); @@ -15724,25 +15066,119 @@ const __unstableSplitSelection = () => ({ }); valueA = (0,external_wp_richText_namespaceObject.remove)(valueA, selectionA.offset, valueA.text.length); valueB = (0,external_wp_richText_namespaceObject.remove)(valueB, 0, selectionB.offset); - dispatch.replaceBlocks(select.getSelectedBlockClientIds(), [{ + let head = { // Preserve the original client ID. ...blockA, + // If both start and end are the same, should only copy innerBlocks + // once. + innerBlocks: blockA.clientId === blockB.clientId ? [] : blockA.innerBlocks, attributes: { ...blockA.attributes, - [selectionA.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({ + [attributeKeyA]: (0,external_wp_richText_namespaceObject.toHTMLString)({ value: valueA }) } - }, { - // Preserve the original client ID. + }; + let tail = { ...blockB, + // Only preserve the original client ID if the end is different. + clientId: blockA.clientId === blockB.clientId ? (0,external_wp_blocks_namespaceObject.createBlock)(blockB.name).clientId : blockB.clientId, attributes: { ...blockB.attributes, - [selectionB.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({ + [attributeKeyB]: (0,external_wp_richText_namespaceObject.toHTMLString)({ value: valueB }) } - }]); + }; + + // When splitting a block, attempt to convert the tail block to the + // default block type. For example, when splitting a heading block, the + // tail block will be converted to a paragraph block. Note that for + // blocks such as a list item and button, this will be skipped because + // the default block type cannot be inserted. + const defaultBlockName = (0,external_wp_blocks_namespaceObject.getDefaultBlockName)(); + if ( + // A block is only split when the selection is within the same + // block. + blockA.clientId === blockB.clientId && defaultBlockName && tail.name !== defaultBlockName && select.canInsertBlockType(defaultBlockName, anchorRootClientId)) { + const switched = (0,external_wp_blocks_namespaceObject.switchToBlockType)(tail, defaultBlockName); + if (switched?.length === 1) { + tail = switched[0]; + } + } + if (!blocks.length) { + dispatch.replaceBlocks(select.getSelectedBlockClientIds(), [head, tail]); + return; + } + let selection; + const output = []; + const clonedBlocks = [...blocks]; + const firstBlock = clonedBlocks.shift(); + const headType = (0,external_wp_blocks_namespaceObject.getBlockType)(head.name); + const firstBlocks = headType.merge && firstBlock.name === headType.name ? [firstBlock] : (0,external_wp_blocks_namespaceObject.switchToBlockType)(firstBlock, headType.name); + if (firstBlocks?.length) { + const first = firstBlocks.shift(); + head = { + ...head, + attributes: { + ...head.attributes, + ...headType.merge(head.attributes, first.attributes) + } + }; + output.push(head); + selection = { + clientId: head.clientId, + attributeKey: attributeKeyA, + offset: (0,external_wp_richText_namespaceObject.create)({ + html: head.attributes[attributeKeyA] + }).text.length + }; + clonedBlocks.unshift(...firstBlocks); + } else { + if (!(0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(head)) { + output.push(head); + } + output.push(firstBlock); + } + const lastBlock = clonedBlocks.pop(); + const tailType = (0,external_wp_blocks_namespaceObject.getBlockType)(tail.name); + if (clonedBlocks.length) { + output.push(...clonedBlocks); + } + if (lastBlock) { + const lastBlocks = tailType.merge && tailType.name === lastBlock.name ? [lastBlock] : (0,external_wp_blocks_namespaceObject.switchToBlockType)(lastBlock, tailType.name); + if (lastBlocks?.length) { + const last = lastBlocks.pop(); + output.push({ + ...tail, + attributes: { + ...tail.attributes, + ...tailType.merge(last.attributes, tail.attributes) + } + }); + output.push(...lastBlocks); + selection = { + clientId: tail.clientId, + attributeKey: attributeKeyB, + offset: (0,external_wp_richText_namespaceObject.create)({ + html: last.attributes[attributeKeyB] + }).text.length + }; + } else { + output.push(lastBlock); + if (!(0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(tail)) { + output.push(tail); + } + } + } else if (!(0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(tail)) { + output.push(tail); + } + registry.batch(() => { + dispatch.replaceBlocks(select.getSelectedBlockClientIds(), output, output.length - 1, 0); + if (selection) { + dispatch.selectionChange(selection.clientId, selection.attributeKey, selection.offset, selection.offset); + } + }); }; /** @@ -15775,15 +15211,13 @@ const mergeBlocks = (firstBlockClientId, secondBlockClientId) => ({ select, dispatch }) => { - const blocks = [firstBlockClientId, secondBlockClientId]; - dispatch({ - type: 'MERGE_BLOCKS', - blocks - }); - const [clientIdA, clientIdB] = blocks; + const clientIdA = firstBlockClientId; + const clientIdB = secondBlockClientId; const blockA = select.getBlock(clientIdA); const blockAType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockA.name); - if (!blockAType) return; + if (!blockAType) { + return; + } const blockB = select.getBlock(clientIdB); if (!blockAType.merge && (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockA.name, '__experimentalOnMerge')) { // If there's no merge function defined, attempt merging inner @@ -16098,11 +15532,18 @@ const insertDefaultBlock = (attributes, rootClientId, index) => ({ }; /** - * Action that changes the nested settings of a given block. + * @typedef {Object< string, Object >} SettingsByClientId + */ + +/** + * Action that changes the nested settings of the given block(s). * - * @param {string} clientId Client ID of the block whose nested setting are - * being received. - * @param {Object} settings Object with the new settings for the nested block. + * @param {string | SettingsByClientId} clientId Client ID of the block whose + * nested setting are being + * received, or object of settings + * by client ID. + * @param {Object} settings Object with the new settings + * for the nested block. * * @return {Object} Action object */ @@ -16207,13 +15648,28 @@ const setNavigationMode = (isNavigationMode = true) => ({ */ const __unstableSetEditorMode = mode => ({ dispatch, - select + select, + registry }) => { - // When switching to zoom-out mode, we need to select the root block + // When switching to zoom-out mode, we need to select the parent section if (mode === 'zoom-out') { const firstSelectedClientId = select.getBlockSelectionStart(); + const { + sectionRootClientId + } = unlock(registry.select(STORE_NAME).getSettings()); if (firstSelectedClientId) { - dispatch.selectBlock(select.getBlockHierarchyRootClientId(firstSelectedClientId)); + let sectionClientId; + if (sectionRootClientId) { + const sectionClientIds = select.getBlockOrder(sectionRootClientId); + sectionClientId = select.getBlockParents(firstSelectedClientId).find(parent => sectionClientIds.includes(parent)); + } else { + sectionClientId = select.getBlockHierarchyRootClientId(firstSelectedClientId); + } + if (sectionClientId) { + dispatch.selectBlock(sectionClientId); + } else { + dispatch.clearSelectedBlock(); + } } } dispatch({ @@ -16508,7 +15964,7 @@ function __unstableSetTemporarilyEditingAsBlocks(temporarilyEditingAsBlocks, foc * per_page: 'page_size', * search: 'q', * }; - * const url = new URL( 'https://api.openverse.engineering/v1/images/' ); + * const url = new URL( 'https://api.openverse.org/v1/images/' ); * Object.entries( finalQuery ).forEach( ( [ key, value ] ) => { * const queryKey = mapFromInserterMediaRequest[ key ] || key; * url.searchParams.set( queryKey, value ); @@ -17045,16 +16501,17 @@ function roundToPrecision(value, digits = 3) { * Takes into account fluid typography parameters and attempts to return a css formula depending on available, valid values. * * @param {Preset} preset - * @param {Object} typographyOptions - * @param {boolean|TypographySettings} typographyOptions.fluid Whether fluid typography is enabled, and, optionally, fluid font size options. + * @param {Object} settings + * @param {boolean|TypographySettings} settings.typography.fluid Whether fluid typography is enabled, and, optionally, fluid font size options. + * @param {Object?} settings.typography.layout Layout options. * * @return {string|*} A font-size value or the value of preset.size. */ -function getTypographyFontSizeValue(preset, typographyOptions) { +function getTypographyFontSizeValue(preset, settings) { const { size: defaultSize } = preset; - if (!isFluidTypographyEnabled(typographyOptions)) { + if (!isFluidTypographyEnabled(settings?.typography)) { return defaultSize; } /* @@ -17065,7 +16522,8 @@ function getTypographyFontSizeValue(preset, typographyOptions) { if (!defaultSize || '0' === defaultSize || false === preset?.fluid) { return defaultSize; } - const fluidTypographySettings = typeof typographyOptions?.fluid === 'object' ? typographyOptions?.fluid : {}; + let fluidTypographySettings = getFluidTypographyOptionsFromSettings(settings); + fluidTypographySettings = typeof fluidTypographySettings?.fluid === 'object' ? fluidTypographySettings?.fluid : {}; const fluidFontSizeValue = getComputedFluidTypographyValue({ minimumFontSize: preset?.fluid?.min, maximumFontSize: preset?.fluid?.max, @@ -17112,6 +16570,11 @@ function getFluidTypographyOptionsFromSettings(settings) { */ +/** + * WordPress dependencies + */ + + /** * Internal dependencies */ @@ -17119,9 +16582,8 @@ function getFluidTypographyOptionsFromSettings(settings) { /* Supporting data. */ -const ROOT_BLOCK_NAME = 'root'; const ROOT_BLOCK_SELECTOR = 'body'; -const ROOT_BLOCK_SUPPORTS = (/* unused pure expression or super */ null && (['background', 'backgroundColor', 'color', 'linkColor', 'captionColor', 'buttonColor', 'headingColor', 'fontFamily', 'fontSize', 'fontStyle', 'fontWeight', 'lineHeight', 'textDecoration', 'textTransform', 'padding'])); +const ROOT_CSS_PROPERTIES_SELECTOR = ':root'; const PRESET_METADATA = [{ path: ['color', 'palette'], valueKey: 'color', @@ -17159,7 +16621,7 @@ const PRESET_METADATA = [{ classes: [] }, { path: ['typography', 'fontSizes'], - valueFunc: (preset, settings) => getTypographyFontSizeValue(preset, getFluidTypographyOptionsFromSettings(settings)), + valueFunc: (preset, settings) => getTypographyFontSizeValue(preset, settings), valueKey: 'size', cssVarInfix: 'font-size', classes: [{ @@ -17239,12 +16701,16 @@ const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = { 'typography.fontSize': 'fontSize', 'typography.fontFamily': 'fontFamily' }; -const TOOLSPANEL_DROPDOWNMENU_PROPS = { - popoverProps: { - placement: 'left-start', - offset: 259 // Inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px) - } -}; +function useToolsPanelDropdownMenuProps() { + const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); + return !isMobile ? { + popoverProps: { + placement: 'left-start', + // For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px) + offset: 259 + } + } : {}; +} function findInPresetsBy(features, blockName, presetPath, presetProperty, presetValueValue) { // Block presets take priority above root level presets. const orderedPresetsByOrigin = [getValueFromObjectPath(features, ['blocks', blockName, ...presetPath]), getValueFromObjectPath(features, presetPath)]; @@ -17382,6 +16848,9 @@ function getValueFromVariable(features, blockName, variable) { * @return {string} Scoped selector. */ function scopeSelector(scope, selector) { + if (!scope || !selector) { + return selector; + } const scopes = scope.split(','); const selectors = selector.split(','); const selectorsScoped = []; @@ -17393,6 +16862,47 @@ function scopeSelector(scope, selector) { return selectorsScoped.join(', '); } +/** + * Scopes a collection of selectors for features and subfeatures. + * + * @example + * ```js + * const scope = '.custom-scope'; + * const selectors = { + * color: '.wp-my-block p', + * typography: { fontSize: '.wp-my-block caption' }, + * }; + * const result = scopeFeatureSelector( scope, selectors ); + * // result is { + * // color: '.custom-scope .wp-my-block p', + * // typography: { fonSize: '.custom-scope .wp-my-block caption' }, + * // } + * ``` + * + * @param {string} scope Selector to scope collection of selectors with. + * @param {Object} selectors Collection of feature selectors e.g. + * + * @return {Object|undefined} Scoped collection of feature selectors. + */ +function scopeFeatureSelectors(scope, selectors) { + if (!scope || !selectors) { + return; + } + const featureSelectors = {}; + Object.entries(selectors).forEach(([feature, selector]) => { + if (typeof selector === 'string') { + featureSelectors[feature] = scopeSelector(scope, selector); + } + if (typeof selector === 'object') { + featureSelectors[feature] = {}; + Object.entries(selector).forEach(([subfeature, subfeatureSelector]) => { + featureSelectors[feature][subfeature] = scopeSelector(scope, subfeatureSelector); + }); + } + }); + return featureSelectors; +} + /** * Appends a sub-selector to an existing one. * @@ -17505,14 +17015,18 @@ const EMPTY_CONFIG = { settings: {}, styles: {} }; -const VALID_SETTINGS = ['appearanceTools', 'useRootPaddingAwareAlignments', 'background.backgroundImage', 'background.backgroundRepeat', 'background.backgroundSize', 'border.color', 'border.radius', 'border.style', 'border.width', 'shadow.presets', 'shadow.defaultPresets', 'color.background', 'color.button', 'color.caption', 'color.custom', 'color.customDuotone', 'color.customGradient', 'color.defaultDuotone', 'color.defaultGradients', 'color.defaultPalette', 'color.duotone', 'color.gradients', 'color.heading', 'color.link', 'color.palette', 'color.text', 'custom', 'dimensions.aspectRatio', 'dimensions.minHeight', 'layout.contentSize', 'layout.definitions', 'layout.wideSize', 'lightbox.enabled', 'lightbox.allowEditing', 'position.fixed', 'position.sticky', 'spacing.customSpacingSize', 'spacing.spacingSizes', 'spacing.spacingScale', 'spacing.blockGap', 'spacing.margin', 'spacing.padding', 'spacing.units', 'typography.fluid', 'typography.customFontSize', 'typography.dropCap', 'typography.fontFamilies', 'typography.fontSizes', 'typography.fontStyle', 'typography.fontWeight', 'typography.letterSpacing', 'typography.lineHeight', 'typography.textColumns', 'typography.textDecoration', 'typography.textTransform', 'typography.writingMode']; +const VALID_SETTINGS = ['appearanceTools', 'useRootPaddingAwareAlignments', 'background.backgroundImage', 'background.backgroundRepeat', 'background.backgroundSize', 'background.backgroundPosition', 'border.color', 'border.radius', 'border.style', 'border.width', 'shadow.presets', 'shadow.defaultPresets', 'color.background', 'color.button', 'color.caption', 'color.custom', 'color.customDuotone', 'color.customGradient', 'color.defaultDuotone', 'color.defaultGradients', 'color.defaultPalette', 'color.duotone', 'color.gradients', 'color.heading', 'color.link', 'color.palette', 'color.text', 'custom', 'dimensions.aspectRatio', 'dimensions.minHeight', 'layout.contentSize', 'layout.definitions', 'layout.wideSize', 'lightbox.enabled', 'lightbox.allowEditing', 'position.fixed', 'position.sticky', 'spacing.customSpacingSize', 'spacing.defaultSpacingSizes', 'spacing.spacingSizes', 'spacing.spacingScale', 'spacing.blockGap', 'spacing.margin', 'spacing.padding', 'spacing.units', 'typography.fluid', 'typography.customFontSize', 'typography.defaultFontSizes', 'typography.dropCap', 'typography.fontFamilies', 'typography.fontSizes', 'typography.fontStyle', 'typography.fontWeight', 'typography.letterSpacing', 'typography.lineHeight', 'typography.textAlign', 'typography.textColumns', 'typography.textDecoration', 'typography.textTransform', 'typography.writingMode']; const useGlobalStylesReset = () => { const { - user: config, + user, setUserConfig } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); + const config = { + settings: user.settings, + styles: user.styles + }; const canReset = !!config && !es6_default()(config, EMPTY_CONFIG); - return [canReset, (0,external_wp_element_namespaceObject.useCallback)(() => setUserConfig(() => EMPTY_CONFIG), [setUserConfig])]; + return [canReset, (0,external_wp_element_namespaceObject.useCallback)(() => setUserConfig(EMPTY_CONFIG), [setUserConfig])]; }; function useGlobalSetting(propertyPath, blockName, source = 'all') { const { @@ -17581,6 +17095,12 @@ function useGlobalStyle(path, blockName, source = 'all', { } return [result, setStyle]; } +function useGlobalStyleLinks() { + const { + merged: mergedConfig + } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); + return mergedConfig?._links; +} /** * React hook that overrides a global settings object with block and element specific settings. @@ -17609,7 +17129,8 @@ function useSettingsForBlockElement(parentSettings, blockName, element) { updatedSettings.typography = { ...updatedSettings.typography, fontSizes: {}, - customFontSize: false + customFontSize: false, + defaultFontSizes: false }; } if (!supportedStyles.includes('fontFamily')) { @@ -17639,7 +17160,7 @@ function useSettingsForBlockElement(parentSettings, blockName, element) { updatedSettings.color.defaultDuotone = false; updatedSettings.color.customDuotone = false; } - ['lineHeight', 'fontStyle', 'fontWeight', 'letterSpacing', 'textTransform', 'textDecoration', 'writingMode'].forEach(key => { + ['lineHeight', 'fontStyle', 'fontWeight', 'letterSpacing', 'textAlign', 'textTransform', 'textDecoration', 'writingMode'].forEach(key => { if (!supportedStyles.includes(key)) { updatedSettings.typography = { ...updatedSettings.typography, @@ -17701,8 +17222,13 @@ function useSettingsForBlockElement(parentSettings, blockName, element) { } }); updatedSettings.shadow = supportedStyles.includes('shadow') ? updatedSettings.shadow : false; + + // Text alignment is only available for blocks. + if (element) { + updatedSettings.typography.textAlign = false; + } return updatedSettings; - }, [parentSettings, supportedStyles, supports]); + }, [parentSettings, supportedStyles, supports, element]); } function useColorsPerOrigin(settings) { const customColors = settings?.color?.palette?.custom; @@ -17761,11 +17287,9 @@ function useGradientsPerOrigin(settings) { }, [customGradients, themeGradients, defaultGradients, shouldDisplayDefaultGradients]); } -// EXTERNAL MODULE: ./node_modules/classnames/index.js -var classnames = __webpack_require__(5755); -var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); +;// CONCATENATED MODULE: ./node_modules/clsx/dist/clsx.mjs +function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t { if (object === null || typeof object !== 'object' || Array.isArray(object)) { return object; @@ -17862,31 +17387,60 @@ function shouldSkipSerialization(blockNameOrType, featureSet, feature) { } return skipSerialization; } +const pendingStyleOverrides = new WeakMap(); function useStyleOverride({ id, css, assets, - __unstableType + __unstableType, + variation, + clientId } = {}) { const { setStyleOverride, deleteStyleOverride } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); + const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const fallbackId = (0,external_wp_element_namespaceObject.useId)(); (0,external_wp_element_namespaceObject.useEffect)(() => { // Unmount if there is CSS and assets are empty. - if (!css && !assets) return; + if (!css && !assets) { + return; + } const _id = id || fallbackId; - setStyleOverride(_id, { + const override = { id, css, assets, - __unstableType + __unstableType, + variation, + clientId + }; + // Batch updates to style overrides to avoid triggering cascading renders + // for each style override block included in a tree and optimize initial render. + if (!pendingStyleOverrides.get(registry)) { + pendingStyleOverrides.set(registry, []); + } + pendingStyleOverrides.get(registry).push([_id, override]); + window.queueMicrotask(() => { + if (pendingStyleOverrides.get(registry)?.length) { + registry.batch(() => { + pendingStyleOverrides.get(registry).forEach(args => { + setStyleOverride(...args); + }); + pendingStyleOverrides.set(registry, []); + }); + } }); return () => { - deleteStyleOverride(_id); + const isPending = pendingStyleOverrides.get(registry)?.find(([currentId]) => currentId === _id); + if (isPending) { + pendingStyleOverrides.set(registry, pendingStyleOverrides.get(registry).filter(([currentId]) => currentId !== _id)); + } else { + deleteStyleOverride(_id); + } }; - }, [id, css, assets, __unstableType, fallbackId, setStyleOverride, deleteStyleOverride]); + }, [id, css, clientId, assets, __unstableType, fallbackId, setStyleOverride, deleteStyleOverride, registry]); } /** @@ -17900,7 +17454,7 @@ function useStyleOverride({ * @return {Object} Settings object. */ function useBlockSettings(name, parentLayout) { - const [backgroundImage, backgroundSize, customFontFamilies, defaultFontFamilies, themeFontFamilies, customFontSizes, defaultFontSizes, themeFontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textColumns, textDecoration, writingMode, textTransform, letterSpacing, padding, margin, blockGap, spacingSizes, units, aspectRatio, minHeight, layout, borderColor, borderRadius, borderStyle, borderWidth, customColorsEnabled, customColors, customDuotone, themeColors, defaultColors, defaultPalette, defaultDuotone, userDuotonePalette, themeDuotonePalette, defaultDuotonePalette, userGradientPalette, themeGradientPalette, defaultGradientPalette, defaultGradients, areCustomGradientsEnabled, isBackgroundEnabled, isLinkEnabled, isTextEnabled, isHeadingEnabled, isButtonEnabled, shadow] = use_settings_useSettings('background.backgroundImage', 'background.backgroundSize', 'typography.fontFamilies.custom', 'typography.fontFamilies.default', 'typography.fontFamilies.theme', 'typography.fontSizes.custom', 'typography.fontSizes.default', 'typography.fontSizes.theme', 'typography.customFontSize', 'typography.fontStyle', 'typography.fontWeight', 'typography.lineHeight', 'typography.textColumns', 'typography.textDecoration', 'typography.writingMode', 'typography.textTransform', 'typography.letterSpacing', 'spacing.padding', 'spacing.margin', 'spacing.blockGap', 'spacing.spacingSizes', 'spacing.units', 'dimensions.aspectRatio', 'dimensions.minHeight', 'layout', 'border.color', 'border.radius', 'border.style', 'border.width', 'color.custom', 'color.palette.custom', 'color.customDuotone', 'color.palette.theme', 'color.palette.default', 'color.defaultPalette', 'color.defaultDuotone', 'color.duotone.custom', 'color.duotone.theme', 'color.duotone.default', 'color.gradients.custom', 'color.gradients.theme', 'color.gradients.default', 'color.defaultGradients', 'color.customGradient', 'color.background', 'color.link', 'color.text', 'color.heading', 'color.button', 'shadow'); + const [backgroundImage, backgroundSize, customFontFamilies, defaultFontFamilies, themeFontFamilies, defaultFontSizesEnabled, customFontSizes, defaultFontSizes, themeFontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textAlign, textColumns, textDecoration, writingMode, textTransform, letterSpacing, padding, margin, blockGap, defaultSpacingSizesEnabled, customSpacingSize, userSpacingSizes, defaultSpacingSizes, themeSpacingSizes, units, aspectRatio, minHeight, layout, borderColor, borderRadius, borderStyle, borderWidth, customColorsEnabled, customColors, customDuotone, themeColors, defaultColors, defaultPalette, defaultDuotone, userDuotonePalette, themeDuotonePalette, defaultDuotonePalette, userGradientPalette, themeGradientPalette, defaultGradientPalette, defaultGradients, areCustomGradientsEnabled, isBackgroundEnabled, isLinkEnabled, isTextEnabled, isHeadingEnabled, isButtonEnabled, shadow] = use_settings_useSettings('background.backgroundImage', 'background.backgroundSize', 'typography.fontFamilies.custom', 'typography.fontFamilies.default', 'typography.fontFamilies.theme', 'typography.defaultFontSizes', 'typography.fontSizes.custom', 'typography.fontSizes.default', 'typography.fontSizes.theme', 'typography.customFontSize', 'typography.fontStyle', 'typography.fontWeight', 'typography.lineHeight', 'typography.textAlign', 'typography.textColumns', 'typography.textDecoration', 'typography.writingMode', 'typography.textTransform', 'typography.letterSpacing', 'spacing.padding', 'spacing.margin', 'spacing.blockGap', 'spacing.defaultSpacingSizes', 'spacing.customSpacingSize', 'spacing.spacingSizes.custom', 'spacing.spacingSizes.default', 'spacing.spacingSizes.theme', 'spacing.units', 'dimensions.aspectRatio', 'dimensions.minHeight', 'layout', 'border.color', 'border.radius', 'border.style', 'border.width', 'color.custom', 'color.palette.custom', 'color.customDuotone', 'color.palette.theme', 'color.palette.default', 'color.defaultPalette', 'color.defaultDuotone', 'color.duotone.custom', 'color.duotone.theme', 'color.duotone.default', 'color.gradients.custom', 'color.gradients.theme', 'color.gradients.default', 'color.defaultGradients', 'color.customGradient', 'color.background', 'color.link', 'color.text', 'color.heading', 'color.button', 'shadow'); const rawSettings = (0,external_wp_element_namespaceObject.useMemo)(() => { return { background: { @@ -17947,9 +17501,11 @@ function useBlockSettings(name, parentLayout) { theme: themeFontSizes }, customFontSize, + defaultFontSizes: defaultFontSizesEnabled, fontStyle, fontWeight, lineHeight, + textAlign, textColumns, textDecoration, textTransform, @@ -17958,8 +17514,12 @@ function useBlockSettings(name, parentLayout) { }, spacing: { spacingSizes: { - custom: spacingSizes + custom: userSpacingSizes, + default: defaultSpacingSizes, + theme: themeSpacingSizes }, + customSpacingSize, + defaultSpacingSizes: defaultSpacingSizesEnabled, padding, margin, blockGap, @@ -17979,7 +17539,7 @@ function useBlockSettings(name, parentLayout) { parentLayout, shadow }; - }, [backgroundImage, backgroundSize, customFontFamilies, defaultFontFamilies, themeFontFamilies, customFontSizes, defaultFontSizes, themeFontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textColumns, textDecoration, textTransform, letterSpacing, writingMode, padding, margin, blockGap, spacingSizes, units, aspectRatio, minHeight, layout, parentLayout, borderColor, borderRadius, borderStyle, borderWidth, customColorsEnabled, customColors, customDuotone, themeColors, defaultColors, defaultPalette, defaultDuotone, userDuotonePalette, themeDuotonePalette, defaultDuotonePalette, userGradientPalette, themeGradientPalette, defaultGradientPalette, defaultGradients, areCustomGradientsEnabled, isBackgroundEnabled, isLinkEnabled, isTextEnabled, isHeadingEnabled, isButtonEnabled, shadow]); + }, [backgroundImage, backgroundSize, customFontFamilies, defaultFontFamilies, themeFontFamilies, defaultFontSizesEnabled, customFontSizes, defaultFontSizes, themeFontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textAlign, textColumns, textDecoration, textTransform, letterSpacing, writingMode, padding, margin, blockGap, defaultSpacingSizesEnabled, customSpacingSize, userSpacingSizes, defaultSpacingSizes, themeSpacingSizes, units, aspectRatio, minHeight, layout, parentLayout, borderColor, borderRadius, borderStyle, borderWidth, customColorsEnabled, customColors, customDuotone, themeColors, defaultColors, defaultPalette, defaultDuotone, userDuotonePalette, themeDuotonePalette, defaultDuotonePalette, userGradientPalette, themeGradientPalette, defaultGradientPalette, defaultGradients, areCustomGradientsEnabled, isBackgroundEnabled, isLinkEnabled, isTextEnabled, isHeadingEnabled, isButtonEnabled, shadow]); return useSettingsForBlockElement(rawSettings, name); } function createBlockEditFilter(features) { @@ -18015,11 +17575,10 @@ function createBlockEditFilter(features) { neededProps[key] = props.attributes[key]; } } - return (0,external_React_.createElement)(Edit + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Edit // We can use the index because the array length // is fixed per page load right now. , { - key: i, name: props.name, isSelected: props.isSelected, clientId: props.clientId, @@ -18029,11 +17588,10 @@ function createBlockEditFilter(features) { // props!!! , ...neededProps - }); - }), (0,external_React_.createElement)(OriginalBlockEdit, { - key: "edit", + }, i); + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OriginalBlockEdit, { ...props - })]; + }, "edit")]; }, 'withBlockEditHooks'); (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/editor/hooks', withBlockEditHooks); } @@ -18069,7 +17627,8 @@ function createBlockListBlockFilter(features) { const { hasSupport, attributeKeys = [], - useBlockProps + useBlockProps, + isMatch } = feature; const neededProps = {}; for (const key of attributeKeys) { @@ -18080,41 +17639,40 @@ function createBlockListBlockFilter(features) { if ( // Skip rendering if none of the needed attributes are // set. - !Object.keys(neededProps).length || !hasSupport(props.name)) { + !Object.keys(neededProps).length || !hasSupport(props.name) || isMatch && !isMatch(neededProps)) { return null; } - return (0,external_React_.createElement)(BlockPropsPure + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockPropsPure // We can use the index because the array length // is fixed per page load right now. , { - key: i, index: i, useBlockProps: useBlockProps // This component is pure, so we must pass a stable // function reference. , setAllWrapperProps: setAllWrapperProps, - name: props.name + name: props.name, + clientId: props.clientId // This component is pure, so only pass needed // props!!! , ...neededProps - }); - }), (0,external_React_.createElement)(BlockListBlock, { - key: "edit", + }, i); + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockListBlock, { ...props, wrapperProps: allWrapperProps.filter(Boolean).reduce((acc, wrapperProps) => { return { ...acc, ...wrapperProps, - className: classnames_default()(acc.className, wrapperProps.className), + className: dist_clsx(acc.className, wrapperProps.className), style: { ...acc.style, ...wrapperProps.style } }; }, props.wrapperProps || {}) - })]; + }, "edit")]; }, 'withBlockListBlockHooks'); (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockListBlock', 'core/editor/hooks', withBlockListBlockHooks); } @@ -18213,7 +17771,6 @@ function useBlockControlsFill(group, shareWithChildBlocks) { } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-controls/fill.js - /** * WordPress dependencies */ @@ -18223,6 +17780,9 @@ function useBlockControlsFill(group, shareWithChildBlocks) { * Internal dependencies */ + + + function BlockControlsFill({ group = 'default', controls, @@ -18233,28 +17793,33 @@ function BlockControlsFill({ if (!Fill) { return null; } - const innerMarkup = (0,external_React_.createElement)(external_React_.Fragment, null, group === 'default' && (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarGroup, { - controls: controls - }), children); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalStyleProvider, { - document: document - }, (0,external_React_.createElement)(Fill, null, fillProps => { - // `fillProps.forwardedContext` is an array of context provider entries, provided by slot, - // that should wrap the fill markup. - const { - forwardedContext = [] - } = fillProps; - return forwardedContext.reduce((inner, [Provider, props]) => (0,external_React_.createElement)(Provider, { - ...props - }, inner), innerMarkup); - })); + const innerMarkup = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [group === 'default' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { + controls: controls + }), children] + }); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalStyleProvider, { + document: document, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, { + children: fillProps => { + // `fillProps.forwardedContext` is an array of context provider entries, provided by slot, + // that should wrap the fill markup. + const { + forwardedContext = [] + } = fillProps; + return forwardedContext.reduce((inner, [Provider, props]) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, { + ...props, + children: inner + }), innerMarkup); + } + }) + }); } ;// CONCATENATED MODULE: external ["wp","warning"] const external_wp_warning_namespaceObject = window["wp"]["warning"]; var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp_warning_namespaceObject); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-controls/slot.js - /** * WordPress dependencies */ @@ -18267,6 +17832,7 @@ var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp */ + const { ComponentsContext } = unlock(external_wp_components_namespaceObject.privateApis); @@ -18292,7 +17858,7 @@ function BlockControlsSlot({ if (!fills?.length) { return null; } - const slot = (0,external_React_.createElement)(Slot, { + const slot = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Slot, { ...props, bubblesVirtually: true, fillProps: fillProps @@ -18300,28 +17866,30 @@ function BlockControlsSlot({ if (group === 'default') { return slot; } - return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, slot); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { + children: slot + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-controls/index.js - /** * Internal dependencies */ + const BlockControls = BlockControlsFill; BlockControls.Slot = BlockControlsSlot; // This is just here for backward compatibility. const BlockFormatControls = props => { - return (0,external_React_.createElement)(BlockControlsFill, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockControlsFill, { group: "inline", ...props }); }; BlockFormatControls.Slot = props => { - return (0,external_React_.createElement)(BlockControlsSlot, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockControlsSlot, { group: "inline", ...props }); @@ -18329,101 +17897,108 @@ BlockFormatControls.Slot = props => { /* harmony default export */ const block_controls = (BlockControls); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/justify-left.js - /** * WordPress dependencies */ -const justifyLeft = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const justifyLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M9 9v6h11V9H9zM4 20h1.5V4H4v16z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M9 9v6h11V9H9zM4 20h1.5V4H4v16z" + }) +}); /* harmony default export */ const justify_left = (justifyLeft); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/justify-center.js - /** * WordPress dependencies */ -const justifyCenter = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const justifyCenter = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M12.5 15v5H11v-5H4V9h7V4h1.5v5h7v6h-7Z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M12.5 15v5H11v-5H4V9h7V4h1.5v5h7v6h-7Z" + }) +}); /* harmony default export */ const justify_center = (justifyCenter); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/justify-right.js - /** * WordPress dependencies */ -const justifyRight = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const justifyRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M4 15h11V9H4v6zM18.5 4v16H20V4h-1.5z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M4 15h11V9H4v6zM18.5 4v16H20V4h-1.5z" + }) +}); /* harmony default export */ const justify_right = (justifyRight); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/justify-space-between.js - /** * WordPress dependencies */ -const justifySpaceBetween = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const justifySpaceBetween = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M9 15h6V9H9v6zm-5 5h1.5V4H4v16zM18.5 4v16H20V4h-1.5z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M9 15h6V9H9v6zm-5 5h1.5V4H4v16zM18.5 4v16H20V4h-1.5z" + }) +}); /* harmony default export */ const justify_space_between = (justifySpaceBetween); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/justify-stretch.js - /** * WordPress dependencies */ -const justifyStretch = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const justifyStretch = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M4 4H5.5V20H4V4ZM7 10L17 10V14L7 14V10ZM20 4H18.5V20H20V4Z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M4 4H5.5V20H4V4ZM7 10L17 10V14L7 14V10ZM20 4H18.5V20H20V4Z" + }) +}); /* harmony default export */ const justify_stretch = (justifyStretch); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-right.js - /** * WordPress dependencies */ -const arrowRight = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const arrowRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z" + }) +}); /* harmony default export */ const arrow_right = (arrowRight); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-down.js - /** * WordPress dependencies */ -const arrowDown = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const arrowDown = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z" + }) +}); /* harmony default export */ const arrow_down = (arrowDown); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/layouts/definitions.js @@ -18458,12 +18033,12 @@ const LAYOUT_DEFINITIONS = { } }], spacingStyles: [{ - selector: ' > :first-child:first-child', + selector: ' > :first-child', rules: { 'margin-block-start': '0' } }, { - selector: ' > :last-child:last-child', + selector: ' > :last-child', rules: { 'margin-block-end': '0' } @@ -18513,12 +18088,12 @@ const LAYOUT_DEFINITIONS = { } }], spacingStyles: [{ - selector: ' > :first-child:first-child', + selector: ' > :first-child', rules: { 'margin-block-start': '0' } }, { - selector: ' > :last-child:last-child', + selector: ' > :last-child', rules: { 'margin-block-end': '0' } @@ -18542,7 +18117,8 @@ const LAYOUT_DEFINITIONS = { 'align-items': 'center' } }, { - selector: ' > *', + selector: ' > :is(*, div)', + // :is(*, div) instead of just * increases the specificity by 001. rules: { margin: '0' } @@ -18560,7 +18136,8 @@ const LAYOUT_DEFINITIONS = { className: 'is-layout-grid', displayMode: 'grid', baseStyles: [{ - selector: ' > *', + selector: ' > :is(*, div)', + // :is(*, div) instead of just * increases the specificity by 001. rules: { margin: '0' } @@ -18660,138 +18237,151 @@ function getAlignmentsInfo(layout) { } ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/sides-all.js - /** * WordPress dependencies */ -const sidesAll = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const sidesAll = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z" + }) +}); /* harmony default export */ const sides_all = (sidesAll); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/sides-horizontal.js - /** * WordPress dependencies */ -const sidesHorizontal = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + + +const sidesHorizontal = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z", - style: { - opacity: 0.25 - } -}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "m4.5 7.5v9h1.5v-9z" -}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "m18 7.5v9h1.5v-9z" -})); + viewBox: "0 0 24 24", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z", + style: { + opacity: 0.25 + } + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "m4.5 7.5v9h1.5v-9z" + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "m18 7.5v9h1.5v-9z" + })] +}); /* harmony default export */ const sides_horizontal = (sidesHorizontal); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/sides-vertical.js - /** * WordPress dependencies */ -const sidesVertical = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + + +const sidesVertical = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z", - style: { - opacity: 0.25 - } -}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "m7.5 6h9v-1.5h-9z" -}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "m7.5 19.5h9v-1.5h-9z" -})); + viewBox: "0 0 24 24", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z", + style: { + opacity: 0.25 + } + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "m7.5 6h9v-1.5h-9z" + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "m7.5 19.5h9v-1.5h-9z" + })] +}); /* harmony default export */ const sides_vertical = (sidesVertical); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/sides-top.js - /** * WordPress dependencies */ -const sidesTop = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + + +const sidesTop = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z", - style: { - opacity: 0.25 - } -}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "m16.5 6h-9v-1.5h9z" -})); + viewBox: "0 0 24 24", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z", + style: { + opacity: 0.25 + } + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "m16.5 6h-9v-1.5h9z" + })] +}); /* harmony default export */ const sides_top = (sidesTop); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/sides-right.js - /** * WordPress dependencies */ -const sidesRight = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + + +const sidesRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z", - style: { - opacity: 0.25 - } -}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "m18 16.5v-9h1.5v9z" -})); + viewBox: "0 0 24 24", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z", + style: { + opacity: 0.25 + } + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "m18 16.5v-9h1.5v9z" + })] +}); /* harmony default export */ const sides_right = (sidesRight); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/sides-bottom.js - /** * WordPress dependencies */ -const sidesBottom = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + + +const sidesBottom = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z", - style: { - opacity: 0.25 - } -}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "m16.5 19.5h-9v-1.5h9z", - style: { - fill: '#1e1e1e' - } -})); + viewBox: "0 0 24 24", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z", + style: { + opacity: 0.25 + } + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "m16.5 19.5h-9v-1.5h9z", + style: { + fill: '#1e1e1e' + } + })] +}); /* harmony default export */ const sides_bottom = (sidesBottom); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/sides-left.js - /** * WordPress dependencies */ -const sidesLeft = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + + +const sidesLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z", - style: { - opacity: 0.25 - } -}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "m4.5 16.5v-9h1.5v9z" -})); + viewBox: "0 0 24 24", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z", + style: { + opacity: 0.25 + } + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "m4.5 16.5v-9h1.5v9z" + })] +}); /* harmony default export */ const sides_left = (sidesLeft); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/utils.js @@ -18800,6 +18390,7 @@ const sidesLeft = (0,external_React_.createElement)(external_wp_primitives_names */ +const RANGE_CONTROL_MAX_SIZE = 8; const ALL_SIDES = ['top', 'right', 'bottom', 'left']; const DEFAULT_VALUES = { top: undefined, @@ -19187,44 +18778,48 @@ function getGapCSSValue(blockGapValue, defaultValue = '0') { } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-vertical-alignment-control/icons.js - /** * WordPress dependencies */ -const alignBottom = (0,external_React_.createElement)(external_wp_components_namespaceObject.SVG, { + +const alignBottom = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Path, { - d: "M15 4H9v11h6V4zM4 18.5V20h16v-1.5H4z" -})); -const alignCenter = (0,external_React_.createElement)(external_wp_components_namespaceObject.SVG, { + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { + d: "M15 4H9v11h6V4zM4 18.5V20h16v-1.5H4z" + }) +}); +const alignCenter = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Path, { - d: "M20 11h-5V4H9v7H4v1.5h5V20h6v-7.5h5z" -})); -const alignTop = (0,external_React_.createElement)(external_wp_components_namespaceObject.SVG, { + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { + d: "M20 11h-5V4H9v7H4v1.5h5V20h6v-7.5h5z" + }) +}); +const alignTop = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Path, { - d: "M9 20h6V9H9v11zM4 4v1.5h16V4H4z" -})); -const alignStretch = (0,external_React_.createElement)(external_wp_components_namespaceObject.SVG, { + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { + d: "M9 20h6V9H9v11zM4 4v1.5h16V4H4z" + }) +}); +const alignStretch = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Path, { - d: "M4 4L20 4L20 5.5L4 5.5L4 4ZM10 7L14 7L14 17L10 17L10 7ZM20 18.5L4 18.5L4 20L20 20L20 18.5Z" -})); -const spaceBetween = (0,external_React_.createElement)(external_wp_components_namespaceObject.SVG, { + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { + d: "M4 4L20 4L20 5.5L4 5.5L4 4ZM10 7L14 7L14 17L10 17L10 7ZM20 18.5L4 18.5L4 20L20 20L20 18.5Z" + }) +}); +const spaceBetween = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Path, { - d: "M7 4H17V8L7 8V4ZM7 16L17 16V20L7 20V16ZM20 11.25H4V12.75H20V11.25Z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { + d: "M7 4H17V8L7 8V4ZM7 16L17 16V20L7 20V16ZM20 11.25H4V12.75H20V11.25Z" + }) +}); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-vertical-alignment-control/ui.js - /** * WordPress dependencies */ @@ -19235,6 +18830,7 @@ const spaceBetween = (0,external_React_.createElement)(external_wp_components_na * Internal dependencies */ + const BLOCK_ALIGNMENTS_CONTROLS = { top: { icon: alignTop, @@ -19275,7 +18871,7 @@ function BlockVerticalAlignmentUI({ const extraProps = isToolbar ? { isCollapsed } : {}; - return (0,external_React_.createElement)(UIComponent, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(UIComponent, { icon: activeAlignment ? activeAlignment.icon : defaultAlignmentControl.icon, label: (0,external_wp_i18n_namespaceObject._x)('Change vertical alignment', 'Block vertical alignment setting label'), controls: controls.map(control => { @@ -19296,19 +18892,19 @@ function BlockVerticalAlignmentUI({ /* harmony default export */ const ui = (BlockVerticalAlignmentUI); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-vertical-alignment-control/index.js - /** * Internal dependencies */ + const BlockVerticalAlignmentControl = props => { - return (0,external_React_.createElement)(ui, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ui, { ...props, isToolbar: false }); }; const BlockVerticalAlignmentToolbar = props => { - return (0,external_React_.createElement)(ui, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ui, { ...props, isToolbar: true }); @@ -19320,13 +18916,13 @@ const BlockVerticalAlignmentToolbar = props => { ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/justify-content-control/ui.js - /** * WordPress dependencies */ + const icons = { left: justify_left, center: justify_center, @@ -19388,7 +18984,7 @@ function JustifyContentUI({ const extraProps = isToolbar ? { isCollapsed } : {}; - return (0,external_React_.createElement)(UIComponent, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(UIComponent, { icon: icon, popoverProps: popoverProps, label: (0,external_wp_i18n_namespaceObject.__)('Change items justification'), @@ -19399,19 +18995,19 @@ function JustifyContentUI({ /* harmony default export */ const justify_content_control_ui = (JustifyContentUI); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/justify-content-control/index.js - /** * Internal dependencies */ + const JustifyContentControl = props => { - return (0,external_React_.createElement)(justify_content_control_ui, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(justify_content_control_ui, { ...props, isToolbar: false }); }; const JustifyToolbar = props => { - return (0,external_React_.createElement)(justify_content_control_ui, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(justify_content_control_ui, { ...props, isToolbar: true }); @@ -19423,7 +19019,6 @@ const JustifyToolbar = props => { ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/layouts/flex.js - /** * WordPress dependencies */ @@ -19441,6 +19036,9 @@ const JustifyToolbar = props => { // Used with the default, horizontal flex orientation. + + + const justifyContentMap = { left: 'flex-start', right: 'flex-end', @@ -19474,16 +19072,24 @@ const flexWrapOptions = ['wrap', 'nowrap']; const { allowOrientation = true } = layoutBlockSupport; - return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)(FlexLayoutJustifyContentControl, { - layout: layout, - onChange: onChange - })), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, allowOrientation && (0,external_React_.createElement)(OrientationControl, { - layout: layout, - onChange: onChange - }))), (0,external_React_.createElement)(FlexWrapControl, { - layout: layout, - onChange: onChange - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FlexLayoutJustifyContentControl, { + layout: layout, + onChange: onChange + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { + children: allowOrientation && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OrientationControl, { + layout: layout, + onChange: onChange + }) + })] + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FlexWrapControl, { + layout: layout, + onChange: onChange + })] + }); }, toolBarControls: function FlexLayoutToolbarControls({ layout = {}, @@ -19496,18 +19102,19 @@ const flexWrapOptions = ['wrap', 'nowrap']; const { allowVerticalAlignment = true } = layoutBlockSupport; - return (0,external_React_.createElement)(block_controls, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(block_controls, { group: "block", - __experimentalShareWithChildBlocks: true - }, (0,external_React_.createElement)(FlexLayoutJustifyContentControl, { - layout: layout, - onChange: onChange, - isToolbar: true - }), allowVerticalAlignment && (0,external_React_.createElement)(FlexLayoutVerticalAlignmentControl, { - layout: layout, - onChange: onChange, - isToolbar: true - })); + __experimentalShareWithChildBlocks: true, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FlexLayoutJustifyContentControl, { + layout: layout, + onChange: onChange, + isToolbar: true + }), allowVerticalAlignment && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FlexLayoutVerticalAlignmentControl, { + layout: layout, + onChange: onChange, + isToolbar: true + })] + }); }, getLayoutStyle: function getLayoutStyle({ selector, @@ -19588,7 +19195,7 @@ function FlexLayoutVerticalAlignmentControl({ }); }; if (isToolbar) { - return (0,external_React_.createElement)(BlockVerticalAlignmentControl, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockVerticalAlignmentControl, { onChange: onVerticalAlignmentChange, value: verticalAlignment, controls: orientation === 'horizontal' ? ['top', 'center', 'bottom', 'stretch'] : ['top', 'center', 'bottom', 'space-between'] @@ -19604,17 +19211,21 @@ function FlexLayoutVerticalAlignmentControl({ value: 'flex-end', label: (0,external_wp_i18n_namespaceObject.__)('Align items bottom') }]; - return (0,external_React_.createElement)("fieldset", { - className: "block-editor-hooks__flex-layout-vertical-alignment-control" - }, (0,external_React_.createElement)("legend", null, (0,external_wp_i18n_namespaceObject.__)('Vertical alignment')), (0,external_React_.createElement)("div", null, verticalAlignmentOptions.map((value, icon, label) => { - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - key: value, - label: label, - icon: icon, - isPressed: verticalAlignment === value, - onClick: () => onVerticalAlignmentChange(value) - }); - }))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { + className: "block-editor-hooks__flex-layout-vertical-alignment-control", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("legend", { + children: (0,external_wp_i18n_namespaceObject.__)('Vertical alignment') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + children: verticalAlignmentOptions.map((value, icon, label) => { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + label: label, + icon: icon, + isPressed: verticalAlignment === value, + onClick: () => onVerticalAlignmentChange(value) + }, value); + }) + })] + }); } const POPOVER_PROPS = { placement: 'bottom-start' @@ -19641,7 +19252,7 @@ function FlexLayoutJustifyContentControl({ allowedControls.push('stretch'); } if (isToolbar) { - return (0,external_React_.createElement)(JustifyContentControl, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(JustifyContentControl, { allowedControls: allowedControls, value: justifyContent, onChange: onJustificationChange, @@ -19674,24 +19285,24 @@ function FlexLayoutJustifyContentControl({ label: (0,external_wp_i18n_namespaceObject.__)('Stretch items') }); } - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Justification'), value: justifyContent, onChange: onJustificationChange, - className: "block-editor-hooks__flex-layout-justification-controls" - }, justificationOptions.map(({ - value, - icon, - label - }) => { - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { - key: value, - value: value, - icon: icon, - label: label - }); - })); + className: "block-editor-hooks__flex-layout-justification-controls", + children: justificationOptions.map(({ + value, + icon, + label + }) => { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { + value: value, + icon: icon, + label: label + }, value); + }) + }); } function FlexWrapControl({ layout, @@ -19700,7 +19311,7 @@ function FlexWrapControl({ const { flexWrap = 'wrap' } = layout; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToggleControl, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Allow to wrap to multiple lines'), onChange: value => { @@ -19721,7 +19332,7 @@ function OrientationControl({ verticalAlignment, justifyContent } = layout; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { __nextHasNoMarginBottom: true, className: "block-editor-hooks__flex-layout-orientation-controls", label: (0,external_wp_i18n_namespaceObject.__)('Orientation'), @@ -19751,16 +19362,17 @@ function OrientationControl({ verticalAlignment: newVerticalAlignment, justifyContent: newJustification }); - } - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { - icon: arrow_right, - value: 'horizontal', - label: (0,external_wp_i18n_namespaceObject.__)('Horizontal') - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { - icon: arrow_down, - value: 'vertical', - label: (0,external_wp_i18n_namespaceObject.__)('Vertical') - })); + }, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { + icon: arrow_right, + value: "horizontal", + label: (0,external_wp_i18n_namespaceObject.__)('Horizontal') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { + icon: arrow_down, + value: "vertical", + label: (0,external_wp_i18n_namespaceObject.__)('Vertical') + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/layouts/flow.js @@ -19894,37 +19506,38 @@ function Icon({ /* harmony default export */ const build_module_icon = ((0,external_wp_element_namespaceObject.forwardRef)(Icon)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/position-center.js - /** * WordPress dependencies */ -const positionCenter = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const positionCenter = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM7 9h10v6H7V9Z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM7 9h10v6H7V9Z" + }) +}); /* harmony default export */ const position_center = (positionCenter); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/stretch-wide.js - /** * WordPress dependencies */ -const stretchWide = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const stretchWide = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M16 5.5H8V4h8v1.5ZM16 20H8v-1.5h8V20ZM5 9h14v6H5V9Z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M16 5.5H8V4h8v1.5ZM16 20H8v-1.5h8V20ZM5 9h14v6H5V9Z" + }) +}); /* harmony default export */ const stretch_wide = (stretchWide); ;// CONCATENATED MODULE: external ["wp","styleEngine"] const external_wp_styleEngine_namespaceObject = window["wp"]["styleEngine"]; ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/layouts/constrained.js - /** * WordPress dependencies */ @@ -19941,6 +19554,9 @@ const external_wp_styleEngine_namespaceObject = window["wp"]["styleEngine"]; + + + /* harmony default export */ const constrained = ({ name: 'constrained', label: (0,external_wp_i18n_namespaceObject.__)('Constrained'), @@ -19981,63 +19597,71 @@ const external_wp_styleEngine_namespaceObject = window["wp"]["styleEngine"]; const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ availableUnits: availableUnits || ['%', 'px', 'em', 'rem', 'vw'] }); - return (0,external_React_.createElement)(external_React_.Fragment, null, allowCustomContentAndWideSize && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("div", { - className: "block-editor-hooks__layout-controls" - }, (0,external_React_.createElement)("div", { - className: "block-editor-hooks__layout-controls-unit" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, { - className: "block-editor-hooks__layout-controls-unit-input", - label: (0,external_wp_i18n_namespaceObject.__)('Content'), - labelPosition: "top", - __unstableInputWidth: "80px", - value: contentSize || wideSize || '', - onChange: nextWidth => { - nextWidth = 0 > parseFloat(nextWidth) ? '0' : nextWidth; - onChange({ - ...layout, - contentSize: nextWidth - }); - }, - units: units - }), (0,external_React_.createElement)(build_module_icon, { - icon: position_center - })), (0,external_React_.createElement)("div", { - className: "block-editor-hooks__layout-controls-unit" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, { - className: "block-editor-hooks__layout-controls-unit-input", - label: (0,external_wp_i18n_namespaceObject.__)('Wide'), - labelPosition: "top", - __unstableInputWidth: "80px", - value: wideSize || contentSize || '', - onChange: nextWidth => { - nextWidth = 0 > parseFloat(nextWidth) ? '0' : nextWidth; - onChange({ - ...layout, - wideSize: nextWidth - }); - }, - units: units - }), (0,external_React_.createElement)(build_module_icon, { - icon: stretch_wide - }))), (0,external_React_.createElement)("p", { - className: "block-editor-hooks__layout-controls-helptext" - }, (0,external_wp_i18n_namespaceObject.__)('Customize the width for all elements that are assigned to the center or wide columns.'))), allowJustification && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { - __nextHasNoMarginBottom: true, - label: (0,external_wp_i18n_namespaceObject.__)('Justification'), - value: justifyContent, - onChange: onJustificationChange - }, justificationOptions.map(({ - value, - icon, - label - }) => { - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { - key: value, - value: value, - icon: icon, - label: label - }); - }))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [allowCustomContentAndWideSize && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-hooks__layout-controls", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-hooks__layout-controls-unit", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { + className: "block-editor-hooks__layout-controls-unit-input", + label: (0,external_wp_i18n_namespaceObject.__)('Content'), + labelPosition: "top", + __unstableInputWidth: "80px", + value: contentSize || wideSize || '', + onChange: nextWidth => { + nextWidth = 0 > parseFloat(nextWidth) ? '0' : nextWidth; + onChange({ + ...layout, + contentSize: nextWidth + }); + }, + units: units + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { + icon: position_center + })] + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-hooks__layout-controls-unit", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { + className: "block-editor-hooks__layout-controls-unit-input", + label: (0,external_wp_i18n_namespaceObject.__)('Wide'), + labelPosition: "top", + __unstableInputWidth: "80px", + value: wideSize || contentSize || '', + onChange: nextWidth => { + nextWidth = 0 > parseFloat(nextWidth) ? '0' : nextWidth; + onChange({ + ...layout, + wideSize: nextWidth + }); + }, + units: units + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { + icon: stretch_wide + })] + })] + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { + className: "block-editor-hooks__layout-controls-helptext", + children: (0,external_wp_i18n_namespaceObject.__)('Customize the width for all elements that are assigned to the center or wide columns.') + })] + }), allowJustification && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { + __nextHasNoMarginBottom: true, + label: (0,external_wp_i18n_namespaceObject.__)('Justification'), + value: justifyContent, + onChange: onJustificationChange, + children: justificationOptions.map(({ + value, + icon, + label + }) => { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { + value: value, + icon: icon, + label: label + }, value); + }) + })] + }); }, toolBarControls: function DefaultLayoutToolbarControls() { return null; @@ -20097,15 +19721,19 @@ const external_wp_styleEngine_namespaceObject = window["wp"]["styleEngine"]; const paddingValues = (0,external_wp_styleEngine_namespaceObject.getCSSRules)(style); paddingValues.forEach(rule => { if (rule.key === 'paddingRight') { + // Add unit if 0, to avoid calc(0 * -1) which is invalid. + const paddingRightValue = rule.value === '0' ? '0px' : rule.value; output += ` ${appendSelectors(selector, '> .alignfull')} { - margin-right: calc(${rule.value} * -1); + margin-right: calc(${paddingRightValue} * -1); } `; } else if (rule.key === 'paddingLeft') { + // Add unit if 0, to avoid calc(0 * -1) which is invalid. + const paddingLeftValue = rule.value === '0' ? '0px' : rule.value; output += ` ${appendSelectors(selector, '> .alignfull')} { - margin-left: calc(${rule.value} * -1); + margin-left: calc(${paddingLeftValue} * -1); } `; } @@ -20162,8 +19790,29 @@ const external_wp_styleEngine_namespaceObject = window["wp"]["styleEngine"]; } }); -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/layouts/grid.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/provider/block-refs-provider.js +/** + * WordPress dependencies + */ + + +const BlockRefs = (0,external_wp_element_namespaceObject.createContext)({ + refsMap: (0,external_wp_compose_namespaceObject.observableMap)() +}); +function BlockRefsProvider({ + children +}) { + const value = (0,external_wp_element_namespaceObject.useMemo)(() => ({ + refsMap: (0,external_wp_compose_namespaceObject.observableMap)() + }), []); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockRefs.Provider, { + value: value, + children: children + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-block-refs.js /** * WordPress dependencies */ @@ -20175,6 +19824,419 @@ const external_wp_styleEngine_namespaceObject = window["wp"]["styleEngine"]; */ +/** @typedef {import('@wordpress/element').RefCallback} RefCallback */ +/** @typedef {import('@wordpress/element').RefObject} RefObject */ + +/** + * Provides a ref to the BlockRefs context. + * + * @param {string} clientId The client ID of the element ref. + * + * @return {RefCallback} Ref callback. + */ +function useBlockRefProvider(clientId) { + const { + refsMap + } = (0,external_wp_element_namespaceObject.useContext)(BlockRefs); + return (0,external_wp_compose_namespaceObject.useRefEffect)(element => { + refsMap.set(clientId, element); + return () => refsMap.delete(clientId); + }, [clientId]); +} + +/** + * Gets a ref pointing to the current block element. Continues to return the same + * stable ref object even if the `clientId` argument changes. This hook is not + * reactive, i.e., it won't trigger a rerender of the calling component if the + * ref value changes. For reactive use cases there is the `useBlockElement` hook. + * + * @param {string} clientId The client ID to get a ref for. + * + * @return {RefObject} A ref containing the element. + */ +function useBlockRef(clientId) { + const { + refsMap + } = (0,external_wp_element_namespaceObject.useContext)(BlockRefs); + const latestClientId = (0,external_wp_element_namespaceObject.useRef)(); + latestClientId.current = clientId; + + // Always return an object, even if no ref exists for a given client ID, so + // that `current` works at a later point. + return (0,external_wp_element_namespaceObject.useMemo)(() => ({ + get current() { + var _refsMap$get; + return (_refsMap$get = refsMap.get(latestClientId.current)) !== null && _refsMap$get !== void 0 ? _refsMap$get : null; + } + }), [refsMap]); +} + +/** + * Return the element for a given client ID. Updates whenever the element + * changes, becomes available, or disappears. + * + * @param {string} clientId The client ID to an element for. + * + * @return {Element|null} The block's wrapper element. + */ +function useBlockElement(clientId) { + const { + refsMap + } = (0,external_wp_element_namespaceObject.useContext)(BlockRefs); + const [blockElement, setBlockElement] = (0,external_wp_element_namespaceObject.useState)(null); + // Delay setting the resulting `blockElement` until an effect. If the block element + // changes (i.e., the block is unmounted and re-mounted), this allows enough time + // for the ref callbacks to clean up the old element and set the new one. + (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { + setBlockElement(refsMap.get(clientId)); + return refsMap.subscribe(clientId, () => setBlockElement(refsMap.get(clientId))); + }, [refsMap, clientId]); + return blockElement; +} + + + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-popover/use-popover-scroll.js +/** + * WordPress dependencies + */ + + +/** + * Allow scrolling "through" popovers over the canvas. This is only called for + * as long as the pointer is over a popover. Do not use React events because it + * will bubble through portals. + * + * @param {Object} scrollableRef + */ +function usePopoverScroll(scrollableRef) { + return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { + if (!scrollableRef) { + return; + } + function onWheel(event) { + const { + deltaX, + deltaY + } = event; + scrollableRef.current.scrollBy(deltaX, deltaY); + } + // Tell the browser that we do not call event.preventDefault + // See https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#improving_scrolling_performance_with_passive_listeners + const options = { + passive: true + }; + node.addEventListener('wheel', onWheel, options); + return () => { + node.removeEventListener('wheel', onWheel, options); + }; + }, [scrollableRef]); +} +/* harmony default export */ const use_popover_scroll = (usePopoverScroll); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-popover/index.js +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + +const MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER; +function BlockPopover({ + clientId, + bottomClientId, + children, + __unstablePopoverSlot, + __unstableContentRef, + shift = true, + ...props +}, ref) { + const selectedElement = useBlockElement(clientId); + const lastSelectedElement = useBlockElement(bottomClientId !== null && bottomClientId !== void 0 ? bottomClientId : clientId); + const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, use_popover_scroll(__unstableContentRef)]); + const [popoverDimensionsRecomputeCounter, forceRecomputePopoverDimensions] = (0,external_wp_element_namespaceObject.useReducer)( + // Module is there to make sure that the counter doesn't overflow. + s => (s + 1) % MAX_POPOVER_RECOMPUTE_COUNTER, 0); + + // When blocks are moved up/down, they are animated to their new position by + // updating the `transform` property manually (i.e. without using CSS + // transitions or animations). The animation, which can also scroll the block + // editor, can sometimes cause the position of the Popover to get out of sync. + // A MutationObserver is therefore used to make sure that changes to the + // selectedElement's attribute (i.e. `transform`) can be tracked and used to + // trigger the Popover to rerender. + (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { + if (!selectedElement) { + return; + } + const observer = new window.MutationObserver(forceRecomputePopoverDimensions); + observer.observe(selectedElement, { + attributes: true + }); + return () => { + observer.disconnect(); + }; + }, [selectedElement]); + const popoverAnchor = (0,external_wp_element_namespaceObject.useMemo)(() => { + if ( + // popoverDimensionsRecomputeCounter is by definition always equal or greater + // than 0. This check is only there to satisfy the correctness of the + // exhaustive-deps rule for the `useMemo` hook. + popoverDimensionsRecomputeCounter < 0 || !selectedElement || bottomClientId && !lastSelectedElement) { + return undefined; + } + return { + getBoundingClientRect() { + var _lastSelectedBCR$left, _lastSelectedBCR$top, _lastSelectedBCR$righ, _lastSelectedBCR$bott; + const selectedBCR = selectedElement.getBoundingClientRect(); + const lastSelectedBCR = lastSelectedElement?.getBoundingClientRect(); + + // Get the biggest rectangle that encompasses completely the currently + // selected element and the last selected element: + // - for top/left coordinates, use the smaller numbers + // - for the bottom/right coordinates, use the largest numbers + const left = Math.min(selectedBCR.left, (_lastSelectedBCR$left = lastSelectedBCR?.left) !== null && _lastSelectedBCR$left !== void 0 ? _lastSelectedBCR$left : Infinity); + const top = Math.min(selectedBCR.top, (_lastSelectedBCR$top = lastSelectedBCR?.top) !== null && _lastSelectedBCR$top !== void 0 ? _lastSelectedBCR$top : Infinity); + const right = Math.max(selectedBCR.right, (_lastSelectedBCR$righ = lastSelectedBCR.right) !== null && _lastSelectedBCR$righ !== void 0 ? _lastSelectedBCR$righ : -Infinity); + const bottom = Math.max(selectedBCR.bottom, (_lastSelectedBCR$bott = lastSelectedBCR.bottom) !== null && _lastSelectedBCR$bott !== void 0 ? _lastSelectedBCR$bott : -Infinity); + const width = right - left; + const height = bottom - top; + return new window.DOMRect(left, top, width, height); + }, + contextElement: selectedElement + }; + }, [bottomClientId, lastSelectedElement, selectedElement, popoverDimensionsRecomputeCounter]); + if (!selectedElement || bottomClientId && !lastSelectedElement) { + return null; + } + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, { + ref: mergedRefs, + animate: false, + focusOnMount: false, + anchor: popoverAnchor + // Render in the old slot if needed for backward compatibility, + // otherwise render in place (not in the default popover slot). + , + __unstableSlotName: __unstablePopoverSlot, + inline: !__unstablePopoverSlot, + placement: "top-start", + resize: false, + flip: false, + shift: shift, + ...props, + className: dist_clsx('block-editor-block-popover', props.className), + variant: "unstyled", + children: children + }); +} +const PrivateBlockPopover = (0,external_wp_element_namespaceObject.forwardRef)(BlockPopover); +const PublicBlockPopover = ({ + clientId, + bottomClientId, + children, + ...props +}, ref) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateBlockPopover, { + ...props, + bottomClientId: bottomClientId, + clientId: clientId, + __unstableContentRef: undefined, + __unstablePopoverSlot: undefined, + ref: ref, + children: children +}); + +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-popover/README.md + */ +/* harmony default export */ const block_popover = ((0,external_wp_element_namespaceObject.forwardRef)(PublicBlockPopover)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-popover/cover.js +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + + +function BlockPopoverCover({ + clientId, + bottomClientId, + children, + shift = false, + additionalStyles, + ...props +}, ref) { + var _bottomClientId; + (_bottomClientId = bottomClientId) !== null && _bottomClientId !== void 0 ? _bottomClientId : bottomClientId = clientId; + const selectedElement = useBlockElement(clientId); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateBlockPopover, { + ref: ref, + clientId: clientId, + bottomClientId: bottomClientId, + shift: shift, + ...props, + children: selectedElement && clientId === bottomClientId ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CoverContainer, { + selectedElement: selectedElement, + additionalStyles: additionalStyles, + children: children + }) : children + }); +} +function CoverContainer({ + selectedElement, + additionalStyles = {}, + children +}) { + const [width, setWidth] = (0,external_wp_element_namespaceObject.useState)(selectedElement.offsetWidth); + const [height, setHeight] = (0,external_wp_element_namespaceObject.useState)(selectedElement.offsetHeight); + (0,external_wp_element_namespaceObject.useEffect)(() => { + const observer = new window.ResizeObserver(() => { + setWidth(selectedElement.offsetWidth); + setHeight(selectedElement.offsetHeight); + }); + observer.observe(selectedElement, { + box: 'border-box' + }); + return () => observer.disconnect(); + }, [selectedElement]); + const style = (0,external_wp_element_namespaceObject.useMemo)(() => { + return { + position: 'absolute', + width, + height, + ...additionalStyles + }; + }, [width, height, additionalStyles]); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + style: style, + children: children + }); +} +/* harmony default export */ const cover = ((0,external_wp_element_namespaceObject.forwardRef)(BlockPopoverCover)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/grid-visualizer/utils.js +function getComputedCSS(element, property) { + return element.ownerDocument.defaultView.getComputedStyle(element).getPropertyValue(property); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/grid-visualizer/grid-visualizer.js +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + + + +function GridVisualizer({ + clientId, + contentRef +}) { + const isDistractionFree = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings().isDistractionFree, []); + const blockElement = useBlockElement(clientId); + if (isDistractionFree || !blockElement) { + return null; + } + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(cover, { + className: "block-editor-grid-visualizer", + clientId: clientId, + __unstablePopoverSlot: "block-toolbar", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridVisualizerGrid, { + ref: contentRef, + blockElement: blockElement + }) + }); +} +const GridVisualizerGrid = (0,external_wp_element_namespaceObject.forwardRef)(({ + blockElement +}, ref) => { + const [gridInfo, setGridInfo] = (0,external_wp_element_namespaceObject.useState)(() => getGridInfo(blockElement)); + (0,external_wp_element_namespaceObject.useEffect)(() => { + const observers = []; + for (const element of [blockElement, ...blockElement.children]) { + const observer = new window.ResizeObserver(() => { + setGridInfo(getGridInfo(blockElement)); + }); + observer.observe(element); + observers.push(observer); + } + return () => { + for (const observer of observers) { + observer.disconnect(); + } + }; + }, [blockElement]); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + ref: ref, + className: "block-editor-grid-visualizer__grid", + style: gridInfo.style, + children: Array.from({ + length: gridInfo.numItems + }, (_, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-grid-visualizer__item", + style: { + boxShadow: `inset 0 0 0 1px color-mix(in srgb, ${gridInfo.currentColor} 20%, #0000)` + } + }, i)) + }); +}); +function getGridInfo(blockElement) { + const gridTemplateColumns = getComputedCSS(blockElement, 'grid-template-columns'); + const gridTemplateRows = getComputedCSS(blockElement, 'grid-template-rows'); + const numColumns = gridTemplateColumns.split(' ').length; + const numRows = gridTemplateRows.split(' ').length; + const numItems = numColumns * numRows; + return { + numItems, + currentColor: getComputedCSS(blockElement, 'color'), + style: { + gridTemplateColumns, + gridTemplateRows, + gap: getComputedCSS(blockElement, 'gap'), + padding: getComputedCSS(blockElement, 'padding') + } + }; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/layouts/grid.js +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + + + + const RANGE_CONTROL_MAX_VALUES = { @@ -20207,23 +20269,50 @@ const RANGE_CONTROL_MAX_VALUES = { lvmax: 100, dvmax: 100 }; +const units = [{ + value: 'px', + label: 'px', + default: 0 +}, { + value: 'rem', + label: 'rem', + default: 0 +}, { + value: 'em', + label: 'em', + default: 0 +}]; /* harmony default export */ const grid = ({ name: 'grid', label: (0,external_wp_i18n_namespaceObject.__)('Grid'), inspectorControls: function GridLayoutInspectorControls({ layout = {}, - onChange + onChange, + layoutBlockSupport = {} }) { - return layout?.columnCount ? (0,external_React_.createElement)(GridLayoutColumnsControl, { - layout: layout, - onChange: onChange - }) : (0,external_React_.createElement)(GridLayoutMinimumWidthControl, { - layout: layout, - onChange: onChange + const { + allowSizingOnChildren = false + } = layoutBlockSupport; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridLayoutTypeControl, { + layout: layout, + onChange: onChange + }), layout?.columnCount ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridLayoutColumnsAndRowsControl, { + layout: layout, + onChange: onChange, + allowSizingOnChildren: allowSizingOnChildren + }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridLayoutMinimumWidthControl, { + layout: layout, + onChange: onChange + })] }); }, - toolBarControls: function DefaultLayoutToolbarControls() { - return null; + toolBarControls: function GridLayoutToolbarControls({ + clientId + }) { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridVisualizer, { + clientId: clientId + }); }, getLayoutStyle: function getLayoutStyle({ selector, @@ -20235,7 +20324,8 @@ const RANGE_CONTROL_MAX_VALUES = { }) { const { minimumColumnWidth = '12rem', - columnCount = null + columnCount = null, + rowCount = null } = layout; // If a block's block.json skips serialization for spacing or spacing.blockGap, @@ -20245,8 +20335,11 @@ const RANGE_CONTROL_MAX_VALUES = { const rules = []; if (columnCount) { rules.push(`grid-template-columns: repeat(${columnCount}, minmax(0, 1fr))`); + if (rowCount) { + rules.push(`grid-template-rows: repeat(${rowCount}, minmax(0, 1fr))`); + } } else if (minimumColumnWidth) { - rules.push(`grid-template-columns: repeat(auto-fill, minmax(min(${minimumColumnWidth}, 100%), 1fr))`); + rules.push(`grid-template-columns: repeat(auto-fill, minmax(min(${minimumColumnWidth}, 100%), 1fr))`, 'container-type: inline-size'); } if (rules.length) { // Reason to disable: the extra line breaks added by prettier mess with the unit tests. @@ -20295,60 +20388,189 @@ function GridLayoutMinimumWidthControl({ } else if (['em', 'rem'].includes(unit) && newUnit === 'px') { // Convert to pixel value assuming a root size of 16px. newValue = Math.round(quantity * 16) + newUnit; - } else if (['vh', 'vw', '%', 'svw', 'lvw', 'dvw', 'svh', 'lvh', 'dvh', 'vi', 'svi', 'lvi', 'dvi', 'vb', 'svb', 'lvb', 'dvb', 'vmin', 'svmin', 'lvmin', 'dvmin', 'vmax', 'svmax', 'lvmax', 'dvmax'].includes(newUnit) && quantity > 100) { - // When converting to `%` or viewport-relative units, cap the new value at 100. - newValue = 100 + newUnit; } onChange({ ...layout, minimumColumnWidth: newValue }); }; - return (0,external_React_.createElement)("fieldset", null, (0,external_React_.createElement)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { - as: "legend" - }, (0,external_wp_i18n_namespaceObject.__)('Minimum column width')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, { - gap: 4 - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, { - isBlock: true - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, { - size: '__unstable-large', - onChange: newValue => { - onChange({ - ...layout, - minimumColumnWidth: newValue - }); - }, - onUnitChange: handleUnitChange, - value: value, - min: 0 - })), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, { - isBlock: true - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.RangeControl, { - onChange: handleSliderChange, - value: quantity, - min: 0, - max: RANGE_CONTROL_MAX_VALUES[unit] || 600, - withInputField: false - })))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { + as: "legend", + children: (0,external_wp_i18n_namespaceObject.__)('Minimum column width') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { + gap: 4, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { + isBlock: true, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { + size: "__unstable-large", + onChange: newValue => { + onChange({ + ...layout, + minimumColumnWidth: newValue + }); + }, + onUnitChange: handleUnitChange, + value: value, + units: units, + min: 0, + label: (0,external_wp_i18n_namespaceObject.__)('Minimum column width'), + hideLabelFromVision: true + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { + isBlock: true, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, { + onChange: handleSliderChange, + value: quantity, + min: 0, + max: RANGE_CONTROL_MAX_VALUES[unit] || 600, + withInputField: false, + label: (0,external_wp_i18n_namespaceObject.__)('Minimum column width'), + hideLabelFromVision: true + }) + })] + })] + }); } // Enables setting number of grid columns -function GridLayoutColumnsControl({ +function GridLayoutColumnsAndRowsControl({ + layout, + onChange, + allowSizingOnChildren +}) { + const { + columnCount = 3, + rowCount + } = layout; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { + as: "legend", + children: (0,external_wp_i18n_namespaceObject.__)('Columns') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { + gap: 4, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { + isBlock: true, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, { + size: "__unstable-large", + onChange: value => { + /** + * If the input is cleared, avoid switching + * back to "Auto" by setting a value of "1". + */ + const validValue = value !== '' ? value : '1'; + onChange({ + ...layout, + columnCount: validValue + }); + }, + value: columnCount, + min: 1, + label: (0,external_wp_i18n_namespaceObject.__)('Columns'), + hideLabelFromVision: true + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { + isBlock: true, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, { + value: parseInt(columnCount, 10) // RangeControl can't deal with strings. + , + onChange: value => onChange({ + ...layout, + columnCount: value + }), + min: 1, + max: 16, + withInputField: false, + label: (0,external_wp_i18n_namespaceObject.__)('Columns'), + hideLabelFromVision: true + }) + })] + })] + }), allowSizingOnChildren && window.__experimentalEnableGridInteractivity && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { + as: "legend", + children: (0,external_wp_i18n_namespaceObject.__)('Rows') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { + gap: 4, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { + isBlock: true, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, { + size: "__unstable-large", + onChange: value => { + onChange({ + ...layout, + rowCount: value + }); + }, + value: rowCount, + min: 1, + label: (0,external_wp_i18n_namespaceObject.__)('Rows'), + hideLabelFromVision: true + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { + isBlock: true, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, { + value: parseInt(rowCount, 10) // RangeControl can't deal with strings. + , + onChange: value => onChange({ + ...layout, + rowCount: value + }), + min: 1, + max: 16, + withInputField: false, + label: (0,external_wp_i18n_namespaceObject.__)('Rows'), + hideLabelFromVision: true + }) + })] + })] + })] + }); +} + +// Enables switching between grid types +function GridLayoutTypeControl({ layout, onChange }) { const { - columnCount = 3 + columnCount, + minimumColumnWidth } = layout; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.RangeControl, { - label: (0,external_wp_i18n_namespaceObject.__)('Columns'), - value: columnCount, - onChange: value => onChange({ + + /** + * When switching, temporarily save any custom values set on the + * previous type so we can switch back without loss. + */ + const [tempColumnCount, setTempColumnCount] = (0,external_wp_element_namespaceObject.useState)(columnCount || 3); + const [tempMinimumColumnWidth, setTempMinimumColumnWidth] = (0,external_wp_element_namespaceObject.useState)(minimumColumnWidth || '12rem'); + const isManual = !!columnCount ? 'manual' : 'auto'; + const onChangeType = value => { + if (value === 'manual') { + setTempMinimumColumnWidth(minimumColumnWidth || '12rem'); + } else { + setTempColumnCount(columnCount || 3); + } + onChange({ ...layout, - columnCount: value - }), - min: 1, - max: 6 + columnCount: value === 'manual' ? tempColumnCount : null, + minimumColumnWidth: value === 'auto' ? tempMinimumColumnWidth : null + }); + }; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { + __nextHasNoMarginBottom: true, + label: (0,external_wp_i18n_namespaceObject.__)('Type'), + value: isManual, + onChange: onChangeType, + isBlock: true, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { + value: "auto", + label: (0,external_wp_i18n_namespaceObject.__)('Auto') + }, "auto"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { + value: "manual", + label: (0,external_wp_i18n_namespaceObject.__)('Manual') + }, "manual")] }); } @@ -20382,7 +20604,6 @@ function getLayoutTypes() { } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/layout.js - /** * WordPress dependencies */ @@ -20393,6 +20614,7 @@ function getLayoutTypes() { */ + const defaultLayout = { type: 'default' }; @@ -20419,7 +20641,9 @@ function LayoutStyle({ const hasBlockGapSupport = blockGapSupport !== null; if (layoutType) { if (css) { - return (0,external_React_.createElement)("style", null, css); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("style", { + children: css + }); } const layoutStyle = layoutType.getLayoutStyle?.({ hasBlockGapSupport, @@ -20427,7 +20651,9 @@ function LayoutStyle({ ...props }); if (layoutStyle) { - return (0,external_React_.createElement)("style", null, layoutStyle); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("style", { + children: layoutStyle + }); } } return null; @@ -20507,59 +20733,63 @@ function useAvailableAlignments(controls = use_available_alignments_DEFAULT_CONT } ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/align-none.js - /** * WordPress dependencies */ -const alignNone = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const alignNone = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM5 9h14v6H5V9Z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM5 9h14v6H5V9Z" + }) +}); /* harmony default export */ const align_none = (alignNone); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/position-left.js - /** * WordPress dependencies */ -const positionLeft = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const positionLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M5 5.5h8V4H5v1.5ZM5 20h8v-1.5H5V20ZM19 9H5v6h14V9Z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M5 5.5h8V4H5v1.5ZM5 20h8v-1.5H5V20ZM19 9H5v6h14V9Z" + }) +}); /* harmony default export */ const position_left = (positionLeft); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/position-right.js - /** * WordPress dependencies */ -const positionRight = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const positionRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M19 5.5h-8V4h8v1.5ZM19 20h-8v-1.5h8V20ZM5 9h14v6H5V9Z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M19 5.5h-8V4h8v1.5ZM19 20h-8v-1.5h8V20ZM5 9h14v6H5V9Z" + }) +}); /* harmony default export */ const position_right = (positionRight); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/stretch-full-width.js - /** * WordPress dependencies */ -const stretchFullWidth = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const stretchFullWidth = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M5 4h14v11H5V4Zm11 16H8v-1.5h8V20Z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M5 4h14v11H5V4Zm11 16H8v-1.5h8V20Z" + }) +}); /* harmony default export */ const stretch_full_width = (stretchFullWidth); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/constants.js @@ -20597,7 +20827,6 @@ const constants_BLOCK_ALIGNMENTS_CONTROLS = { const constants_DEFAULT_CONTROL = 'none'; ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/ui.js - /** * External dependencies */ @@ -20614,6 +20843,8 @@ const constants_DEFAULT_CONTROL = 'none'; */ + + function BlockAlignmentUI({ value, onChange, @@ -20655,37 +20886,40 @@ function BlockAlignmentUI({ children: ({ onClose }) => { - return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, { - className: "block-editor-block-alignment-control__menu-group" - }, enabledControls.map(({ - name: controlName, - info - }) => { - const { - icon, - title - } = constants_BLOCK_ALIGNMENTS_CONTROLS[controlName]; - // If no value is provided, mark as selected the `none` option. - const isSelected = controlName === value || !value && controlName === 'none'; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { - key: controlName, - icon: icon, - iconPosition: "left", - className: classnames_default()('components-dropdown-menu__menu-item', { - 'is-active': isSelected - }), - isSelected: isSelected, - onClick: () => { - onChangeAlignment(controlName); - onClose(); - }, - role: "menuitemradio", - info: info - }, title); - }))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { + className: "block-editor-block-alignment-control__menu-group", + children: enabledControls.map(({ + name: controlName, + info + }) => { + const { + icon, + title + } = constants_BLOCK_ALIGNMENTS_CONTROLS[controlName]; + // If no value is provided, mark as selected the `none` option. + const isSelected = controlName === value || !value && controlName === 'none'; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { + icon: icon, + iconPosition: "left", + className: dist_clsx('components-dropdown-menu__menu-item', { + 'is-active': isSelected + }), + isSelected: isSelected, + onClick: () => { + onChangeAlignment(controlName); + onClose(); + }, + role: "menuitemradio", + info: info, + children: title + }, controlName); + }) + }) + }); } }; - return (0,external_React_.createElement)(UIComponent, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(UIComponent, { ...commonProps, ...extraProps }); @@ -20693,19 +20927,19 @@ function BlockAlignmentUI({ /* harmony default export */ const block_alignment_control_ui = (BlockAlignmentUI); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/index.js - /** * Internal dependencies */ + const BlockAlignmentControl = props => { - return (0,external_React_.createElement)(block_alignment_control_ui, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_alignment_control_ui, { ...props, isToolbar: false }); }; const BlockAlignmentToolbar = props => { - return (0,external_React_.createElement)(block_alignment_control_ui, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_alignment_control_ui, { ...props, isToolbar: true }); @@ -20789,7 +21023,6 @@ function useBlockEditingMode(mode) { } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/align.js - /** * External dependencies */ @@ -20815,6 +21048,7 @@ function useBlockEditingMode(mode) { * @constant * @type {string[]} */ + const ALL_ALIGNMENTS = ['left', 'center', 'right', 'wide', 'full']; /** @@ -20910,14 +21144,15 @@ function BlockEditAlignmentToolbarControlsPure({ align: nextAlign }); }; - return (0,external_React_.createElement)(block_controls, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls, { group: "block", - __experimentalShareWithChildBlocks: true - }, (0,external_React_.createElement)(BlockAlignmentControl, { - value: align, - onChange: updateAlignment, - controls: validAlignments - })); + __experimentalShareWithChildBlocks: true, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockAlignmentControl, { + value: align, + onChange: updateAlignment, + controls: validAlignments + }) + }); } /* harmony default export */ const align = ({ shareWithChildBlocks: true, @@ -20965,42 +21200,12 @@ function addAssignedAlign(props, blockType, attributes) { // This way changing themes does not impact the block save. const isAlignValid = getValidAlignments(blockAlign, hasWideBlockSupport).includes(align); if (isAlignValid) { - props.className = classnames_default()(`align${align}`, props.className); + props.className = dist_clsx(`align${align}`, props.className); } return props; } (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/editor/align/addAttribute', addAttribute); -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/lock.js -/** - * WordPress dependencies - */ - - -/** - * Filters registered block settings, extending attributes to include `lock`. - * - * @param {Object} settings Original block settings. - * - * @return {Object} Filtered block settings. - */ -function lock_addAttribute(settings) { - var _settings$attributes$; - // Allow blocks to specify their own attribute definition with default values if needed. - if ('type' in ((_settings$attributes$ = settings.attributes?.lock) !== null && _settings$attributes$ !== void 0 ? _settings$attributes$ : {})) { - return settings; - } - // Gracefully handle if settings.attributes is undefined. - settings.attributes = { - ...settings.attributes, - lock: { - type: 'object' - } - }; - return settings; -} -(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/lock/addAttribute', lock_addAttribute); - ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/groups.js /** * WordPress dependencies @@ -21037,7 +21242,6 @@ const groups_groups = { /* harmony default export */ const inspector_controls_groups = (groups_groups); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/fill.js - /** * WordPress dependencies */ @@ -21051,6 +21255,7 @@ const groups_groups = { */ + function InspectorControlsFill({ children, group = 'default', @@ -21074,15 +21279,18 @@ function InspectorControlsFill({ if (!context[mayDisplayControlsKey]) { return null; } - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalStyleProvider, { - document: document - }, (0,external_React_.createElement)(Fill, null, fillProps => { - return (0,external_React_.createElement)(ToolsPanelInspectorControl, { - fillProps: fillProps, - children: children, - resetAllFilter: resetAllFilter - }); - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalStyleProvider, { + document: document, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, { + children: fillProps => { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ToolsPanelInspectorControl, { + fillProps: fillProps, + children: children, + resetAllFilter: resetAllFilter + }); + } + }) + }); } function RegisterResetAll({ resetAllFilter, @@ -21117,16 +21325,17 @@ function ToolsPanelInspectorControl({ // access to any React Context whose Provider is part of // the InspectorControlsSlot tree. So we re-create the // Provider in this subtree. - const innerMarkup = (0,external_React_.createElement)(RegisterResetAll, { - resetAllFilter: resetAllFilter - }, children); - return forwardedContext.reduce((inner, [Provider, props]) => (0,external_React_.createElement)(Provider, { - ...props - }, inner), innerMarkup); + const innerMarkup = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RegisterResetAll, { + resetAllFilter: resetAllFilter, + children: children + }); + return forwardedContext.reduce((inner, [Provider, props]) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, { + ...props, + children: inner + }), innerMarkup); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/block-support-tools-panel.js - /** * WordPress dependencies */ @@ -21140,6 +21349,7 @@ function ToolsPanelInspectorControl({ + function BlockSupportToolsPanel({ children, group, @@ -21154,6 +21364,7 @@ function BlockSupportToolsPanel({ getSelectedBlockClientId, hasMultiSelection } = (0,external_wp_data_namespaceObject.useSelect)(store); + const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const panelId = getSelectedBlockClientId(); const resetAll = (0,external_wp_element_namespaceObject.useCallback)((resetFilters = []) => { const newAttributes = {}; @@ -21181,28 +21392,28 @@ function BlockSupportToolsPanel({ }); updateBlockAttributes(clientIds, newAttributes, true); }, [getBlockAttributes, getMultiSelectedBlockClientIds, hasMultiSelection, panelId, updateBlockAttributes]); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanel, { className: `${group}-block-support-panel`, label: label, resetAll: resetAll, - key: panelId, panelId: panelId, hasInnerWrapper: true, shouldRenderPlaceholderItems: true // Required to maintain fills ordering. , __experimentalFirstVisibleItemClass: "first", __experimentalLastVisibleItemClass: "last", - dropdownMenuProps: TOOLSPANEL_DROPDOWNMENU_PROPS - }, children); + dropdownMenuProps: dropdownMenuProps, + children: children + }, panelId); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/block-support-slot-container.js - /** * WordPress dependencies */ + function BlockSupportSlotContainer({ Slot, fillProps, @@ -21219,7 +21430,7 @@ function BlockSupportSlotContainer({ }]] }; }, [toolsPanelContext, fillProps]); - return (0,external_React_.createElement)(Slot, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Slot, { ...props, fillProps: computedFillProps, bubblesVirtually: true @@ -21227,7 +21438,6 @@ function BlockSupportSlotContainer({ } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/slot.js - /** * WordPress dependencies */ @@ -21242,6 +21452,7 @@ function BlockSupportSlotContainer({ + function InspectorControlsSlot({ __experimentalGroup, group = 'default', @@ -21277,16 +21488,17 @@ function InspectorControlsSlot({ return null; } if (label) { - return (0,external_React_.createElement)(BlockSupportToolsPanel, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockSupportToolsPanel, { group: group, - label: label - }, (0,external_React_.createElement)(BlockSupportSlotContainer, { - ...props, - fillProps: computedFillProps, - Slot: Slot - })); + label: label, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockSupportSlotContainer, { + ...props, + fillProps: computedFillProps, + Slot: Slot + }) + }); } - return (0,external_React_.createElement)(Slot, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Slot, { ...props, fillProps: computedFillProps, bubblesVirtually: true @@ -21294,24 +21506,24 @@ function InspectorControlsSlot({ } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/index.js - /** * Internal dependencies */ + const InspectorControls = InspectorControlsFill; InspectorControls.Slot = InspectorControlsSlot; // This is just here for backward compatibility. const InspectorAdvancedControls = props => { - return (0,external_React_.createElement)(InspectorControlsFill, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InspectorControlsFill, { ...props, group: "advanced" }); }; InspectorAdvancedControls.Slot = props => { - return (0,external_React_.createElement)(InspectorControlsSlot, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InspectorControlsSlot, { ...props, group: "advanced" }); @@ -21323,398 +21535,62 @@ InspectorAdvancedControls.slotName = 'InspectorAdvancedControls'; */ /* harmony default export */ const inspector_controls = (InspectorControls); -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/anchor.js - -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - - -/** - * Regular expression matching invalid anchor characters for replacement. - * - * @type {RegExp} - */ -const ANCHOR_REGEX = /[\s#]/g; -const ANCHOR_SCHEMA = { - type: 'string', - source: 'attribute', - attribute: 'id', - selector: '*' -}; - -/** - * Filters registered block settings, extending attributes with anchor using ID - * of the first node. - * - * @param {Object} settings Original block settings. - * - * @return {Object} Filtered block settings. - */ -function anchor_addAttribute(settings) { - var _settings$attributes$; - // Allow blocks to specify their own attribute definition with default values if needed. - if ('type' in ((_settings$attributes$ = settings.attributes?.anchor) !== null && _settings$attributes$ !== void 0 ? _settings$attributes$ : {})) { - return settings; - } - if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, 'anchor')) { - // Gracefully handle if settings.attributes is undefined. - settings.attributes = { - ...settings.attributes, - anchor: ANCHOR_SCHEMA - }; - } - return settings; -} -function BlockEditAnchorControlPure({ - name: blockName, - anchor, - setAttributes -}) { - const blockEditingMode = useBlockEditingMode(); - const isWeb = external_wp_element_namespaceObject.Platform.OS === 'web'; - const textControl = (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, { - __nextHasNoMarginBottom: true, - __next40pxDefaultSize: true, - className: "html-anchor-control", - label: (0,external_wp_i18n_namespaceObject.__)('HTML anchor'), - help: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_wp_i18n_namespaceObject.__)('Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor.” Then, you’ll be able to link directly to this section of your page.'), isWeb && (0,external_React_.createElement)(external_wp_components_namespaceObject.ExternalLink, { - href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/page-jumps/') - }, (0,external_wp_i18n_namespaceObject.__)('Learn more about anchors'))), - value: anchor || '', - placeholder: !isWeb ? (0,external_wp_i18n_namespaceObject.__)('Add an anchor') : null, - onChange: nextValue => { - nextValue = nextValue.replace(ANCHOR_REGEX, '-'); - setAttributes({ - anchor: nextValue - }); - }, - autoCapitalize: "none", - autoComplete: "off" - }); - return (0,external_React_.createElement)(external_React_.Fragment, null, isWeb && blockEditingMode === 'default' && (0,external_React_.createElement)(inspector_controls, { - group: "advanced" - }, textControl), !isWeb && blockName === 'core/heading' && (0,external_React_.createElement)(inspector_controls, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, { - title: (0,external_wp_i18n_namespaceObject.__)('Heading settings') - }, textControl))); -} -/* harmony default export */ const hooks_anchor = ({ - addSaveProps, - edit: BlockEditAnchorControlPure, - attributeKeys: ['anchor'], - hasSupport(name) { - return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, 'anchor'); - } -}); - -/** - * Override props assigned to save component to inject anchor ID, if block - * supports anchor. This is only applied if the block's save result is an - * element and not a markup string. - * - * @param {Object} extraProps Additional props applied to save element. - * @param {Object} blockType Block type. - * @param {Object} attributes Current block attributes. - * - * @return {Object} Filtered props applied to save element. - */ -function addSaveProps(extraProps, blockType, attributes) { - if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'anchor')) { - extraProps.id = attributes.anchor === '' ? null : attributes.anchor; - } - return extraProps; -} -(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/anchor/attribute', anchor_addAttribute); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/aria-label.js -/** - * WordPress dependencies - */ - - -const ARIA_LABEL_SCHEMA = { - type: 'string', - source: 'attribute', - attribute: 'aria-label', - selector: '*' -}; - -/** - * Filters registered block settings, extending attributes with ariaLabel using aria-label - * of the first node. - * - * @param {Object} settings Original block settings. - * - * @return {Object} Filtered block settings. - */ -function aria_label_addAttribute(settings) { - // Allow blocks to specify their own attribute definition with default values if needed. - if (settings?.attributes?.ariaLabel?.type) { - return settings; - } - if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, 'ariaLabel')) { - // Gracefully handle if settings.attributes is undefined. - settings.attributes = { - ...settings.attributes, - ariaLabel: ARIA_LABEL_SCHEMA - }; - } - return settings; -} - -/** - * Override props assigned to save component to inject aria-label, if block - * supports ariaLabel. This is only applied if the block's save result is an - * element and not a markup string. - * - * @param {Object} extraProps Additional props applied to save element. - * @param {Object} blockType Block type. - * @param {Object} attributes Current block attributes. - * - * @return {Object} Filtered props applied to save element. - */ -function aria_label_addSaveProps(extraProps, blockType, attributes) { - if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'ariaLabel')) { - extraProps['aria-label'] = attributes.ariaLabel === '' ? null : attributes.ariaLabel; - } - return extraProps; -} -/* harmony default export */ const aria_label = ({ - addSaveProps: aria_label_addSaveProps, - attributeKeys: ['ariaLabel'], - hasSupport(name) { - return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, 'ariaLabel'); - } -}); -(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/ariaLabel/attribute', aria_label_addAttribute); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/custom-class-name.js - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - - - -/** - * Internal dependencies - */ - - - -/** - * Filters registered block settings, extending attributes to include `className`. - * - * @param {Object} settings Original block settings. - * - * @return {Object} Filtered block settings. - */ -function custom_class_name_addAttribute(settings) { - if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, 'customClassName', true)) { - // Gracefully handle if settings.attributes is undefined. - settings.attributes = { - ...settings.attributes, - className: { - type: 'string' - } - }; - } - return settings; -} -function CustomClassNameControlsPure({ - className, - setAttributes -}) { - const blockEditingMode = useBlockEditingMode(); - if (blockEditingMode !== 'default') { - return null; - } - return (0,external_React_.createElement)(inspector_controls, { - group: "advanced" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, { - __nextHasNoMarginBottom: true, - __next40pxDefaultSize: true, - autoComplete: "off", - label: (0,external_wp_i18n_namespaceObject.__)('Additional CSS class(es)'), - value: className || '', - onChange: nextValue => { - setAttributes({ - className: nextValue !== '' ? nextValue : undefined - }); - }, - help: (0,external_wp_i18n_namespaceObject.__)('Separate multiple classes with spaces.') - })); -} -/* harmony default export */ const custom_class_name = ({ - edit: CustomClassNameControlsPure, - addSaveProps: custom_class_name_addSaveProps, - attributeKeys: ['className'], - hasSupport(name) { - return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, 'customClassName', true); - } -}); - -/** - * Override props assigned to save component to inject the className, if block - * supports customClassName. This is only applied if the block's save result is an - * element and not a markup string. - * - * @param {Object} extraProps Additional props applied to save element. - * @param {Object} blockType Block type. - * @param {Object} attributes Current block attributes. - * - * @return {Object} Filtered props applied to save element. - */ -function custom_class_name_addSaveProps(extraProps, blockType, attributes) { - if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'customClassName', true) && attributes.className) { - extraProps.className = classnames_default()(extraProps.className, attributes.className); - } - return extraProps; -} -function addTransforms(result, source, index, results) { - if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(result.name, 'customClassName', true)) { - return result; - } - - // If the condition verifies we are probably in the presence of a wrapping transform - // e.g: nesting paragraphs in a group or columns and in that case the class should not be kept. - if (results.length === 1 && result.innerBlocks.length === source.length) { - return result; - } - - // If we are transforming one block to multiple blocks or multiple blocks to one block, - // we ignore the class during the transform. - if (results.length === 1 && source.length > 1 || results.length > 1 && source.length === 1) { - return result; - } - - // If we are in presence of transform between one or more block in the source - // that have one or more blocks in the result - // we apply the class on source N to the result N, - // if source N does not exists we do nothing. - if (source[index]) { - const originClassName = source[index]?.attributes.className; - if (originClassName) { - return { - ...result, - attributes: { - ...result.attributes, - className: originClassName - } - }; - } - } - return result; -} -(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/editor/custom-class-name/attribute', custom_class_name_addAttribute); -(0,external_wp_hooks_namespaceObject.addFilter)('blocks.switchToBlockType.transformedBlock', 'core/color/addTransforms', addTransforms); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/generated-class-name.js -/** - * WordPress dependencies - */ - - - -/** - * Override props assigned to save component to inject generated className if - * block supports it. This is only applied if the block's save result is an - * element and not a markup string. - * - * @param {Object} extraProps Additional props applied to save element. - * @param {Object} blockType Block type. - * - * @return {Object} Filtered props applied to save element. - */ -function addGeneratedClassName(extraProps, blockType) { - // Adding the generated className. - if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'className', true)) { - if (typeof extraProps.className === 'string') { - // We have some extra classes and want to add the default classname - // We use uniq to prevent duplicate classnames. - - extraProps.className = [...new Set([(0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(blockType.name), ...extraProps.className.split(' ')])].join(' ').trim(); - } else { - // There is no string in the className variable, - // so we just dump the default name in there. - extraProps.className = (0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(blockType.name); - } - } - return extraProps; -} -(0,external_wp_hooks_namespaceObject.addFilter)('blocks.getSaveContent.extraProps', 'core/generated-class-name/save-props', addGeneratedClassName); - -;// CONCATENATED MODULE: external ["wp","blob"] -const external_wp_blob_namespaceObject = window["wp"]["blob"]; -;// CONCATENATED MODULE: external ["wp","dom"] -const external_wp_dom_namespaceObject = window["wp"]["dom"]; -;// CONCATENATED MODULE: external ["wp","notices"] -const external_wp_notices_namespaceObject = window["wp"]["notices"]; ;// CONCATENATED MODULE: external ["wp","url"] const external_wp_url_namespaceObject = window["wp"]["url"]; +;// CONCATENATED MODULE: external ["wp","dom"] +const external_wp_dom_namespaceObject = window["wp"]["dom"]; +;// CONCATENATED MODULE: external ["wp","blob"] +const external_wp_blob_namespaceObject = window["wp"]["blob"]; ;// CONCATENATED MODULE: external ["wp","keycodes"] const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/media.js - /** * WordPress dependencies */ -const media = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + + +const media = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "m7 6.5 4 2.5-4 2.5z" -}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - fillRule: "evenodd", - clipRule: "evenodd", - d: "m5 3c-1.10457 0-2 .89543-2 2v14c0 1.1046.89543 2 2 2h14c1.1046 0 2-.8954 2-2v-14c0-1.10457-.8954-2-2-2zm14 1.5h-14c-.27614 0-.5.22386-.5.5v10.7072l3.62953-2.6465c.25108-.1831.58905-.1924.84981-.0234l2.92666 1.8969 3.5712-3.4719c.2911-.2831.7545-.2831 1.0456 0l2.9772 2.8945v-9.3568c0-.27614-.2239-.5-.5-.5zm-14.5 14.5v-1.4364l4.09643-2.987 2.99567 1.9417c.2936.1903.6798.1523.9307-.0917l3.4772-3.3806 3.4772 3.3806.0228-.0234v2.5968c0 .2761-.2239.5-.5.5h-14c-.27614 0-.5-.2239-.5-.5z" -})); + viewBox: "0 0 24 24", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "m7 6.5 4 2.5-4 2.5z" + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + fillRule: "evenodd", + clipRule: "evenodd", + d: "m5 3c-1.10457 0-2 .89543-2 2v14c0 1.1046.89543 2 2 2h14c1.1046 0 2-.8954 2-2v-14c0-1.10457-.8954-2-2-2zm14 1.5h-14c-.27614 0-.5.22386-.5.5v10.7072l3.62953-2.6465c.25108-.1831.58905-.1924.84981-.0234l2.92666 1.8969 3.5712-3.4719c.2911-.2831.7545-.2831 1.0456 0l2.9772 2.8945v-9.3568c0-.27614-.2239-.5-.5-.5zm-14.5 14.5v-1.4364l4.09643-2.987 2.99567 1.9417c.2936.1903.6798.1523.9307-.0917l3.4772-3.3806 3.4772 3.3806.0228-.0234v2.5968c0 .2761-.2239.5-.5.5h-14c-.27614 0-.5-.2239-.5-.5z" + })] +}); /* harmony default export */ const library_media = (media); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/upload.js - /** * WordPress dependencies */ -const upload = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const upload = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z" + }) +}); /* harmony default export */ const library_upload = (upload); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-featured-image.js - /** * WordPress dependencies */ -const postFeaturedImage = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const postFeaturedImage = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M19 3H5c-.6 0-1 .4-1 1v7c0 .5.4 1 1 1h14c.5 0 1-.4 1-1V4c0-.6-.4-1-1-1zM5.5 10.5v-.4l1.8-1.3 1.3.8c.3.2.7.2.9-.1L11 8.1l2.4 2.4H5.5zm13 0h-2.9l-4-4c-.3-.3-.8-.3-1.1 0L8.9 8l-1.2-.8c-.3-.2-.6-.2-.9 0l-1.3 1V4.5h13v6zM4 20h9v-1.5H4V20zm0-4h16v-1.5H4V16z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M19 3H5c-.6 0-1 .4-1 1v7c0 .5.4 1 1 1h14c.5 0 1-.4 1-1V4c0-.6-.4-1-1-1zM5.5 10.5v-.4l1.8-1.3 1.3.8c.3.2.7.2.9-.1L11 8.1l2.4 2.4H5.5zm13 0h-2.9l-4-4c-.3-.3-.8-.3-1.1 0L8.9 8l-1.2-.8c-.3-.2-.6-.2-.9 0l-1.3 1V4.5h13v6zM4 20h9v-1.5H4V20zm0-4h16v-1.5H4V16z" + }) +}); /* harmony default export */ const post_featured_image = (postFeaturedImage); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/media-upload/index.js @@ -21771,49 +21647,50 @@ var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(exte ;// CONCATENATED MODULE: external ["wp","preferences"] const external_wp_preferences_namespaceObject = window["wp"]["preferences"]; ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/keyboard-return.js - /** * WordPress dependencies */ -const keyboardReturn = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const keyboardReturn = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "-2 -2 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M6.734 16.106l2.176-2.38-1.093-1.028-3.846 4.158 3.846 4.157 1.093-1.027-2.176-2.38h2.811c1.125 0 2.25.03 3.374 0 1.428-.001 3.362-.25 4.963-1.277 1.66-1.065 2.868-2.906 2.868-5.859 0-2.479-1.327-4.896-3.65-5.93-1.82-.813-3.044-.8-4.806-.788l-.567.002v1.5c.184 0 .368 0 .553-.002 1.82-.007 2.704-.014 4.21.657 1.854.827 2.76 2.657 2.76 4.561 0 2.472-.973 3.824-2.178 4.596-1.258.807-2.864 1.04-4.163 1.04h-.02c-1.115.03-2.229 0-3.344 0H6.734z" -})); + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "m6.734 16.106 2.176-2.38-1.093-1.028-3.846 4.158 3.846 4.158 1.093-1.028-2.176-2.38h2.811c1.125 0 2.25.03 3.374 0 1.428-.001 3.362-.25 4.963-1.277 1.66-1.065 2.868-2.906 2.868-5.859 0-2.479-1.327-4.896-3.65-5.93-1.82-.813-3.044-.8-4.806-.788l-.567.002v1.5c.184 0 .368 0 .553-.002 1.82-.007 2.704-.014 4.21.657 1.854.827 2.76 2.657 2.76 4.561 0 2.472-.973 3.824-2.178 4.596-1.258.807-2.864 1.04-4.163 1.04h-.02c-1.115.03-2.229 0-3.344 0H6.734Z" + }) +}); /* harmony default export */ const keyboard_return = (keyboardReturn); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left-small.js - /** * WordPress dependencies */ -const chevronLeftSmall = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const chevronLeftSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z" + }) +}); /* harmony default export */ const chevron_left_small = (chevronLeftSmall); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right-small.js - /** * WordPress dependencies */ -const chevronRightSmall = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const chevronRightSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z" + }) +}); /* harmony default export */ const chevron_right_small = (chevronRightSmall); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/settings-drawer.js - /** * WordPress dependencies */ @@ -21822,6 +21699,9 @@ const chevronRightSmall = (0,external_React_.createElement)(external_wp_primitiv + + + function LinkSettingsDrawer({ children, settingsOpen, @@ -21832,49 +21712,53 @@ function LinkSettingsDrawer({ const MaybeMotionDiv = prefersReducedMotion ? 'div' : external_wp_components_namespaceObject.__unstableMotion.div; const id = (0,external_wp_compose_namespaceObject.useInstanceId)(LinkSettingsDrawer); const settingsDrawerId = `link-control-settings-drawer-${id}`; - return (0,external_React_.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - className: "block-editor-link-control__drawer-toggle", - "aria-expanded": settingsOpen, - onClick: () => setSettingsOpen(!settingsOpen), - icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_small : chevron_right_small, - "aria-controls": settingsDrawerId - }, (0,external_wp_i18n_namespaceObject._x)('Advanced', 'Additional link settings')), (0,external_React_.createElement)(MaybeAnimatePresence, null, settingsOpen && (0,external_React_.createElement)(MaybeMotionDiv, { - className: "block-editor-link-control__drawer", - hidden: !settingsOpen, - id: settingsDrawerId, - initial: "collapsed", - animate: "open", - exit: "collapsed", - variants: { - open: { - opacity: 1, - height: 'auto' - }, - collapsed: { - opacity: 0, - height: 0 - } - }, - transition: { - duration: 0.1 - } - }, (0,external_React_.createElement)("div", { - className: "block-editor-link-control__drawer-inner" - }, children)))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + className: "block-editor-link-control__drawer-toggle", + "aria-expanded": settingsOpen, + onClick: () => setSettingsOpen(!settingsOpen), + icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_small : chevron_right_small, + "aria-controls": settingsDrawerId, + children: (0,external_wp_i18n_namespaceObject._x)('Advanced', 'Additional link settings') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MaybeAnimatePresence, { + children: settingsOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MaybeMotionDiv, { + className: "block-editor-link-control__drawer", + hidden: !settingsOpen, + id: settingsDrawerId, + initial: "collapsed", + animate: "open", + exit: "collapsed", + variants: { + open: { + opacity: 1, + height: 'auto' + }, + collapsed: { + opacity: 0, + height: 0 + } + }, + transition: { + duration: 0.1 + }, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-link-control__drawer-inner", + children: children + }) + }) + })] + }); } /* harmony default export */ const settings_drawer = (LinkSettingsDrawer); -// EXTERNAL MODULE: ./node_modules/dom-scroll-into-view/lib/index.js -var lib = __webpack_require__(5428); -var lib_default = /*#__PURE__*/__webpack_require__.n(lib); +// EXTERNAL MODULE: external "React" +var external_React_ = __webpack_require__(1609); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-input/index.js - /** * External dependencies */ - /** * WordPress dependencies */ @@ -21898,6 +21782,10 @@ var lib_default = /*#__PURE__*/__webpack_require__.n(lib); * @param {*} maybeFunc The argument to check. * @return {boolean} True if the argument is a function, false otherwise. */ + + + + function isFunction(maybeFunc) { return typeof maybeFunc === 'function'; } @@ -21936,14 +21824,12 @@ class URLInput extends external_wp_element_namespaceObject.Component { // Only have to worry about scrolling selected suggestion into view // when already expanded. - if (showSuggestions && selectedSuggestion !== null && this.suggestionNodes[selectedSuggestion] && !this.scrollingIntoView) { - this.scrollingIntoView = true; - lib_default()(this.suggestionNodes[selectedSuggestion], this.autocompleteRef.current, { - onlyScrollIfNeeded: true + if (showSuggestions && selectedSuggestion !== null && this.suggestionNodes[selectedSuggestion]) { + this.suggestionNodes[selectedSuggestion].scrollIntoView({ + behavior: 'instant', + block: 'nearest', + inline: 'nearest' }); - this.props.setTimeout(() => { - this.scrollingIntoView = false; - }, 100); } // Update suggestions when the value changes. @@ -22210,7 +22096,9 @@ class URLInput extends external_wp_element_namespaceObject.Component { }; } render() { - return (0,external_React_.createElement)(external_React_.Fragment, null, this.renderControl(), this.renderSuggestions()); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [this.renderControl(), this.renderSuggestions()] + }); } renderControl() { const { @@ -22237,7 +22125,7 @@ class URLInput extends external_wp_element_namespaceObject.Component { id: inputId, // Passes attribute to label for the for attribute label, - className: classnames_default()('block-editor-url-input', className, { + className: dist_clsx('block-editor-url-input', className, { 'is-full-width': isFullWidth }), hideLabelFromVision @@ -22271,12 +22159,13 @@ class URLInput extends external_wp_element_namespaceObject.Component { hint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version' }); } - return (0,external_React_.createElement)(external_wp_components_namespaceObject.BaseControl, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.BaseControl, { __nextHasNoMarginBottom: __nextHasNoMarginBottom, - ...controlProps - }, (0,external_React_.createElement)("input", { - ...inputProps - }), loading && (0,external_React_.createElement)(external_wp_components_namespaceObject.Spinner, null)); + ...controlProps, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("input", { + ...inputProps + }), loading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {})] + }); } renderSuggestions() { const { @@ -22321,20 +22210,22 @@ class URLInput extends external_wp_element_namespaceObject.Component { currentInputValue: suggestionsValue }); } - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Popover, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, { placement: "bottom", - focusOnMount: false - }, (0,external_React_.createElement)("div", { - ...suggestionsListProps, - className: classnames_default()('block-editor-url-input__suggestions', `${className}__suggestions`) - }, suggestions.map((suggestion, index) => (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - ...buildSuggestionItemProps(suggestion, index), - key: suggestion.id, - className: classnames_default()('block-editor-url-input__suggestion', { - 'is-selected': index === selectedSuggestion - }), - onClick: () => this.handleOnClick(suggestion) - }, suggestion.title)))); + focusOnMount: false, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + ...suggestionsListProps, + className: dist_clsx('block-editor-url-input__suggestions', `${className}__suggestions`), + children: suggestions.map((suggestion, index) => /*#__PURE__*/(0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { + ...buildSuggestionItemProps(suggestion, index), + key: suggestion.id, + className: dist_clsx('block-editor-url-input__suggestion', { + 'is-selected': index === selectedSuggestion + }), + onClick: () => this.handleOnClick(suggestion) + }, suggestion.title)) + }) + }); } } @@ -22356,21 +22247,21 @@ class URLInput extends external_wp_element_namespaceObject.Component { }))(URLInput)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js - /** * WordPress dependencies */ -const plus = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const plus = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" + }) +}); /* harmony default export */ const library_plus = (plus); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-create-button.js - /** * WordPress dependencies */ @@ -22378,6 +22269,7 @@ const plus = (0,external_React_.createElement)(external_wp_primitives_namespaceO + const LinkControlSearchCreate = ({ searchTerm, onClick, @@ -22393,139 +22285,148 @@ const LinkControlSearchCreate = ({ } else { text = (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: search term. */ (0,external_wp_i18n_namespaceObject.__)('Create: %s'), searchTerm), { - mark: (0,external_React_.createElement)("mark", null) + mark: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("mark", {}) }); } - return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { ...itemProps, iconPosition: "left", icon: library_plus, className: "block-editor-link-control__search-item", - onClick: onClick - }, text); + onClick: onClick, + children: text + }); }; /* harmony default export */ const search_create_button = (LinkControlSearchCreate); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-list.js - /** * WordPress dependencies */ -const postList = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const postList = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M18 5.5H6a.5.5 0 0 0-.5.5v12a.5.5 0 0 0 .5.5h12a.5.5 0 0 0 .5-.5V6a.5.5 0 0 0-.5-.5ZM6 4h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2Zm1 5h1.5v1.5H7V9Zm1.5 4.5H7V15h1.5v-1.5ZM10 9h7v1.5h-7V9Zm7 4.5h-7V15h7v-1.5Z" -})); + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M18 5.5H6a.5.5 0 0 0-.5.5v12a.5.5 0 0 0 .5.5h12a.5.5 0 0 0 .5-.5V6a.5.5 0 0 0-.5-.5ZM6 4h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2Zm1 5h1.5v1.5H7V9Zm1.5 4.5H7V15h1.5v-1.5ZM10 9h7v1.5h-7V9Zm7 4.5h-7V15h7v-1.5Z" + }) +}); /* harmony default export */ const post_list = (postList); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/page.js - /** * WordPress dependencies */ -const page = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + + +const page = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z" -}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z" -})); + viewBox: "0 0 24 24", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z" + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z" + })] +}); /* harmony default export */ const library_page = (page); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/tag.js - /** * WordPress dependencies */ -const tag = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const tag = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M4.75 4a.75.75 0 0 0-.75.75v7.826c0 .2.08.39.22.53l6.72 6.716a2.313 2.313 0 0 0 3.276-.001l5.61-5.611-.531-.53.532.528a2.315 2.315 0 0 0 0-3.264L13.104 4.22a.75.75 0 0 0-.53-.22H4.75ZM19 12.576a.815.815 0 0 1-.236.574l-5.61 5.611a.814.814 0 0 1-1.153 0L5.5 12.264V5.5h6.763l6.5 6.502a.816.816 0 0 1 .237.574ZM8.75 9.75a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M4.75 4a.75.75 0 0 0-.75.75v7.826c0 .2.08.39.22.53l6.72 6.716a2.313 2.313 0 0 0 3.276-.001l5.61-5.611-.531-.53.532.528a2.315 2.315 0 0 0 0-3.264L13.104 4.22a.75.75 0 0 0-.53-.22H4.75ZM19 12.576a.815.815 0 0 1-.236.574l-5.61 5.611a.814.814 0 0 1-1.153 0L5.5 12.264V5.5h6.763l6.5 6.502a.816.816 0 0 1 .237.574ZM8.75 9.75a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" + }) +}); /* harmony default export */ const library_tag = (tag); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/category.js - /** * WordPress dependencies */ -const category = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const category = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z", - fillRule: "evenodd", - clipRule: "evenodd" -})); + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z", + fillRule: "evenodd", + clipRule: "evenodd" + }) +}); /* harmony default export */ const library_category = (category); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/file.js - /** * WordPress dependencies */ -const file = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const file = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - fillRule: "evenodd", - clipRule: "evenodd", - d: "M12.848 8a1 1 0 0 1-.914-.594l-.723-1.63a.5.5 0 0 0-.447-.276H5a.5.5 0 0 0-.5.5v11.5a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5v-9A.5.5 0 0 0 19 8h-6.152Zm.612-1.5a.5.5 0 0 1-.462-.31l-.445-1.084A2 2 0 0 0 10.763 4H5a2 2 0 0 0-2 2v11.5a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2h-5.54Z" -})); + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M12.848 8a1 1 0 0 1-.914-.594l-.723-1.63a.5.5 0 0 0-.447-.276H5a.5.5 0 0 0-.5.5v11.5a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5v-9A.5.5 0 0 0 19 8h-6.152Zm.612-1.5a.5.5 0 0 1-.462-.31l-.445-1.084A2 2 0 0 0 10.763 4H5a2 2 0 0 0-2 2v11.5a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2h-5.54Z" + }) +}); /* harmony default export */ const library_file = (file); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/globe.js - /** * WordPress dependencies */ -const globe = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const globe = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M12 3.3c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8s-4-8.8-8.8-8.8zm6.5 5.5h-2.6C15.4 7.3 14.8 6 14 5c2 .6 3.6 2 4.5 3.8zm.7 3.2c0 .6-.1 1.2-.2 1.8h-2.9c.1-.6.1-1.2.1-1.8s-.1-1.2-.1-1.8H19c.2.6.2 1.2.2 1.8zM12 18.7c-1-.7-1.8-1.9-2.3-3.5h4.6c-.5 1.6-1.3 2.9-2.3 3.5zm-2.6-4.9c-.1-.6-.1-1.1-.1-1.8 0-.6.1-1.2.1-1.8h5.2c.1.6.1 1.1.1 1.8s-.1 1.2-.1 1.8H9.4zM4.8 12c0-.6.1-1.2.2-1.8h2.9c-.1.6-.1 1.2-.1 1.8 0 .6.1 1.2.1 1.8H5c-.2-.6-.2-1.2-.2-1.8zM12 5.3c1 .7 1.8 1.9 2.3 3.5H9.7c.5-1.6 1.3-2.9 2.3-3.5zM10 5c-.8 1-1.4 2.3-1.8 3.8H5.5C6.4 7 8 5.6 10 5zM5.5 15.3h2.6c.4 1.5 1 2.8 1.8 3.7-1.8-.6-3.5-2-4.4-3.7zM14 19c.8-1 1.4-2.2 1.8-3.7h2.6C17.6 17 16 18.4 14 19z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M12 3.3c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8s-4-8.8-8.8-8.8zm6.5 5.5h-2.6C15.4 7.3 14.8 6 14 5c2 .6 3.6 2 4.5 3.8zm.7 3.2c0 .6-.1 1.2-.2 1.8h-2.9c.1-.6.1-1.2.1-1.8s-.1-1.2-.1-1.8H19c.2.6.2 1.2.2 1.8zM12 18.7c-1-.7-1.8-1.9-2.3-3.5h4.6c-.5 1.6-1.3 2.9-2.3 3.5zm-2.6-4.9c-.1-.6-.1-1.1-.1-1.8 0-.6.1-1.2.1-1.8h5.2c.1.6.1 1.1.1 1.8s-.1 1.2-.1 1.8H9.4zM4.8 12c0-.6.1-1.2.2-1.8h2.9c-.1.6-.1 1.2-.1 1.8 0 .6.1 1.2.1 1.8H5c-.2-.6-.2-1.2-.2-1.8zM12 5.3c1 .7 1.8 1.9 2.3 3.5H9.7c.5-1.6 1.3-2.9 2.3-3.5zM10 5c-.8 1-1.4 2.3-1.8 3.8H5.5C6.4 7 8 5.6 10 5zM5.5 15.3h2.6c.4 1.5 1 2.8 1.8 3.7-1.8-.6-3.5-2-4.4-3.7zM14 19c.8-1 1.4-2.2 1.8-3.7h2.6C17.6 17 16 18.4 14 19z" + }) +}); /* harmony default export */ const library_globe = (globe); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/home.js - /** * WordPress dependencies */ -const home = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const home = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z" + }) +}); /* harmony default export */ const library_home = (home); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/verse.js - /** * WordPress dependencies */ -const verse = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const verse = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M17.8 2l-.9.3c-.1 0-3.6 1-5.2 2.1C10 5.5 9.3 6.5 8.9 7.1c-.6.9-1.7 4.7-1.7 6.3l-.9 2.3c-.2.4 0 .8.4 1 .1 0 .2.1.3.1.3 0 .6-.2.7-.5l.6-1.5c.3 0 .7-.1 1.2-.2.7-.1 1.4-.3 2.2-.5.8-.2 1.6-.5 2.4-.8.7-.3 1.4-.7 1.9-1.2s.8-1.2 1-1.9c.2-.7.3-1.6.4-2.4.1-.8.1-1.7.2-2.5 0-.8.1-1.5.2-2.1V2zm-1.9 5.6c-.1.8-.2 1.5-.3 2.1-.2.6-.4 1-.6 1.3-.3.3-.8.6-1.4.9-.7.3-1.4.5-2.2.8-.6.2-1.3.3-1.8.4L15 7.5c.3-.3.6-.7 1-1.1 0 .4 0 .8-.1 1.2zM6 20h8v-1.5H6V20z" -})); + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M17.8 2l-.9.3c-.1 0-3.6 1-5.2 2.1C10 5.5 9.3 6.5 8.9 7.1c-.6.9-1.7 4.7-1.7 6.3l-.9 2.3c-.2.4 0 .8.4 1 .1 0 .2.1.3.1.3 0 .6-.2.7-.5l.6-1.5c.3 0 .7-.1 1.2-.2.7-.1 1.4-.3 2.2-.5.8-.2 1.6-.5 2.4-.8.7-.3 1.4-.7 1.9-1.2s.8-1.2 1-1.9c.2-.7.3-1.6.4-2.4.1-.8.1-1.7.2-2.5 0-.8.1-1.5.2-2.1V2zm-1.9 5.6c-.1.8-.2 1.5-.3 2.1-.2.6-.4 1-.6 1.3-.3.3-.8.6-1.4.9-.7.3-1.4.5-2.2.8-.6.2-1.3.3-1.8.4L15 7.5c.3-.3.6-.7 1-1.1 0 .4 0 .8-.1 1.2zM6 20h8v-1.5H6V20z" + }) +}); /* harmony default export */ const library_verse = (verse); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-item.js - /** * WordPress dependencies */ @@ -22535,6 +22436,7 @@ const verse = (0,external_React_.createElement)(external_wp_primitives_namespace + const ICONS_MAP = { post: post_list, page: library_page, @@ -22561,7 +22463,7 @@ function SearchItemIcon({ } } if (icon) { - return (0,external_React_.createElement)(build_module_icon, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { className: "block-editor-link-control__search-item-icon", icon: icon }); @@ -22576,12 +22478,16 @@ function SearchItemIcon({ */ function addLeadingSlash(url) { const trimmedURL = url?.trim(); - if (!trimmedURL?.length) return url; + if (!trimmedURL?.length) { + return url; + } return url?.replace(/^\/?/, '/'); } function removeTrailingSlash(url) { const trimmedURL = url?.trim(); - if (!trimmedURL?.length) return url; + if (!trimmedURL?.length) { + return url; + } return url?.replace(/\/$/, ''); } const partialRight = (fn, ...partialArgs) => (...args) => fn(...args, ...partialArgs); @@ -22599,7 +22505,9 @@ const defaultTo = d => v => { * @return {string} the processed url to display. */ function getURLForDisplay(url) { - if (!url) return url; + if (!url) { + return url; + } return (0,external_wp_compose_namespaceObject.pipe)(external_wp_url_namespaceObject.safeDecodeURI, external_wp_url_namespaceObject.getPath, defaultTo(''), partialRight(external_wp_url_namespaceObject.filterURLForDisplay, 24), removeTrailingSlash, addLeadingSlash)(url); } const LinkControlSearchItem = ({ @@ -22611,23 +22519,24 @@ const LinkControlSearchItem = ({ shouldShowType = false }) => { const info = isURL ? (0,external_wp_i18n_namespaceObject.__)('Press ENTER to add this link') : getURLForDisplay(suggestion.url); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { ...itemProps, info: info, iconPosition: "left", - icon: (0,external_React_.createElement)(SearchItemIcon, { + icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SearchItemIcon, { suggestion: suggestion, isURL: isURL }), onClick: onClick, shortcut: shouldShowType && getVisualTypeName(suggestion), - className: "block-editor-link-control__search-item" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.TextHighlight - // The component expects a plain text string. - , { - text: (0,external_wp_dom_namespaceObject.__unstableStripHTML)(suggestion.title), - highlight: searchTerm - })); + className: "block-editor-link-control__search-item", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextHighlight + // The component expects a plain text string. + , { + text: (0,external_wp_dom_namespaceObject.__unstableStripHTML)(suggestion.title), + highlight: searchTerm + }) + }); }; function getVisualTypeName(suggestion) { if (suggestion.isFrontPage) { @@ -22663,7 +22572,6 @@ const DEFAULT_LINK_SETTINGS = [{ }]; ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-results.js - /** * WordPress dependencies */ @@ -22681,6 +22589,8 @@ const DEFAULT_LINK_SETTINGS = [{ + + function LinkControlSearchResults({ instanceId, withCreateSuggestion, @@ -22695,7 +22605,7 @@ function LinkControlSearchResults({ createSuggestionButtonText, suggestionsQuery }) { - const resultsListClasses = classnames_default()('block-editor-link-control__search-results', { + const resultsListClasses = dist_clsx('block-editor-link-control__search-results', { 'is-loading': isLoading }); const isSingleDirectEntryResult = suggestions.length === 1 && LINK_ENTRY_TYPES.includes(suggestions[0].type); @@ -22709,52 +22619,56 @@ function LinkControlSearchResults({ const searchResultsLabelId = `block-editor-link-control-search-results-label-${instanceId}`; const labelText = isInitialSuggestions ? (0,external_wp_i18n_namespaceObject.__)('Suggestions') : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: search term. */ (0,external_wp_i18n_namespaceObject.__)('Search results for "%s"'), currentInputValue); - const searchResultsLabel = (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { - id: searchResultsLabelId - }, labelText); - return (0,external_React_.createElement)("div", { - className: "block-editor-link-control__search-results-wrapper" - }, searchResultsLabel, (0,external_React_.createElement)("div", { - ...suggestionsListProps, - className: resultsListClasses, - "aria-labelledby": searchResultsLabelId - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, suggestions.map((suggestion, index) => { - if (shouldShowCreateSuggestion && CREATE_TYPE === suggestion.type) { - return (0,external_React_.createElement)(search_create_button, { - searchTerm: currentInputValue, - buttonText: createSuggestionButtonText, - onClick: () => handleSuggestionClick(suggestion) - // Intentionally only using `type` here as - // the constant is enough to uniquely - // identify the single "CREATE" suggestion. - , - key: suggestion.type, - itemProps: buildSuggestionItemProps(suggestion, index), - isSelected: index === selectedSuggestion - }); - } + const searchResultsLabel = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { + id: searchResultsLabelId, + children: labelText + }); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-link-control__search-results-wrapper", + children: [searchResultsLabel, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + ...suggestionsListProps, + className: resultsListClasses, + "aria-labelledby": searchResultsLabelId, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { + children: suggestions.map((suggestion, index) => { + if (shouldShowCreateSuggestion && CREATE_TYPE === suggestion.type) { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(search_create_button, { + searchTerm: currentInputValue, + buttonText: createSuggestionButtonText, + onClick: () => handleSuggestionClick(suggestion) + // Intentionally only using `type` here as + // the constant is enough to uniquely + // identify the single "CREATE" suggestion. + , + + itemProps: buildSuggestionItemProps(suggestion, index), + isSelected: index === selectedSuggestion + }, suggestion.type); + } - // If we're not handling "Create" suggestions above then - // we don't want them in the main results so exit early. - if (CREATE_TYPE === suggestion.type) { - return null; - } - return (0,external_React_.createElement)(search_item, { - key: `${suggestion.id}-${suggestion.type}`, - itemProps: buildSuggestionItemProps(suggestion, index), - suggestion: suggestion, - index: index, - onClick: () => { - handleSuggestionClick(suggestion); - }, - isSelected: index === selectedSuggestion, - isURL: LINK_ENTRY_TYPES.includes(suggestion.type), - searchTerm: currentInputValue, - shouldShowType: shouldShowSuggestionsTypes, - isFrontPage: suggestion?.isFrontPage, - isBlogHome: suggestion?.isBlogHome - }); - })))); + // If we're not handling "Create" suggestions above then + // we don't want them in the main results so exit early. + if (CREATE_TYPE === suggestion.type) { + return null; + } + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(search_item, { + itemProps: buildSuggestionItemProps(suggestion, index), + suggestion: suggestion, + index: index, + onClick: () => { + handleSuggestionClick(suggestion); + }, + isSelected: index === selectedSuggestion, + isURL: LINK_ENTRY_TYPES.includes(suggestion.type), + searchTerm: currentInputValue, + shouldShowType: shouldShowSuggestionsTypes, + isFrontPage: suggestion?.isFrontPage, + isBlogHome: suggestion?.isBlogHome + }, `${suggestion.id}-${suggestion.type}`); + }) + }) + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/is-url-like.js @@ -22918,7 +22832,6 @@ function useSearchHandler(suggestionsQuery, allowDirectEntry, withCreateSuggesti } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-input.js - /** * WordPress dependencies */ @@ -22937,6 +22850,8 @@ function useSearchHandler(suggestionsQuery, allowDirectEntry, withCreateSuggesti // Must be a function as otherwise URLInput will default // to the fetchLinkSuggestions passed in block editor settings // which will cause an unintended http request. + + const noopSearchHandler = () => Promise.resolve([]); const noop = () => {}; const LinkControlSearchInput = (0,external_wp_element_namespaceObject.forwardRef)(({ @@ -22950,7 +22865,7 @@ const LinkControlSearchInput = (0,external_wp_element_namespaceObject.forwardRef onChange = noop, onSelect = noop, showSuggestions = true, - renderSuggestions = props => (0,external_React_.createElement)(LinkControlSearchResults, { + renderSuggestions = props => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkControlSearchResults, { ...props }), fetchSuggestions = null, @@ -23016,65 +22931,68 @@ const LinkControlSearchInput = (0,external_wp_element_namespaceObject.forwardRef }, suggestion); } }; - return (0,external_React_.createElement)("div", { - className: "block-editor-link-control__search-input-container" - }, (0,external_React_.createElement)(url_input, { - disableSuggestions: currentLink?.url === value, - __nextHasNoMarginBottom: true, - label: (0,external_wp_i18n_namespaceObject.__)('Link'), - hideLabelFromVision: hideLabelFromVision, - className: className, - value: value, - onChange: onInputChange, - placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : (0,external_wp_i18n_namespaceObject.__)('Search or type url'), - __experimentalRenderSuggestions: showSuggestions ? handleRenderSuggestions : null, - __experimentalFetchLinkSuggestions: searchHandler, - __experimentalHandleURLSuggestions: true, - __experimentalShowInitialSuggestions: showInitialSuggestions, - onSubmit: (suggestion, event) => { - const hasSuggestion = suggestion || focusedSuggestion; - - // If there is no suggestion and the value (ie: any manually entered URL) is empty - // then don't allow submission otherwise we get empty links. - if (!hasSuggestion && !value?.trim()?.length) { - event.preventDefault(); - } else { - onSuggestionSelected(hasSuggestion || { - url: value - }); - } - }, - ref: ref - }), children); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-link-control__search-input-container", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(url_input, { + disableSuggestions: currentLink?.url === value, + __nextHasNoMarginBottom: true, + label: (0,external_wp_i18n_namespaceObject.__)('Link'), + hideLabelFromVision: hideLabelFromVision, + className: className, + value: value, + onChange: onInputChange, + placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : (0,external_wp_i18n_namespaceObject.__)('Search or type URL'), + __experimentalRenderSuggestions: showSuggestions ? handleRenderSuggestions : null, + __experimentalFetchLinkSuggestions: searchHandler, + __experimentalHandleURLSuggestions: true, + __experimentalShowInitialSuggestions: showInitialSuggestions, + onSubmit: (suggestion, event) => { + const hasSuggestion = suggestion || focusedSuggestion; + + // If there is no suggestion and the value (ie: any manually entered URL) is empty + // then don't allow submission otherwise we get empty links. + if (!hasSuggestion && !value?.trim()?.length) { + event.preventDefault(); + } else { + onSuggestionSelected(hasSuggestion || { + url: value + }); + } + }, + ref: ref + }), children] + }); }); /* harmony default export */ const search_input = (LinkControlSearchInput); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/info.js - /** * WordPress dependencies */ -const info = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const info = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z" + }) +}); /* harmony default export */ const library_info = (info); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pencil.js - /** * WordPress dependencies */ -const pencil = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const pencil = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" + }) +}); /* harmony default export */ const library_pencil = (pencil); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/edit.js @@ -23086,33 +23004,35 @@ const pencil = (0,external_React_.createElement)(external_wp_primitives_namespac /* harmony default export */ const edit = (library_pencil); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/link-off.js - /** * WordPress dependencies */ -const linkOff = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const linkOff = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M17.031 4.703 15.576 4l-1.56 3H14v.03l-2.324 4.47H9.5V13h1.396l-1.502 2.889h-.95a3.694 3.694 0 0 1 0-7.389H10V7H8.444a5.194 5.194 0 1 0 0 10.389h.17L7.5 19.53l1.416.719L15.049 8.5h.507a3.694 3.694 0 0 1 0 7.39H14v1.5h1.556a5.194 5.194 0 0 0 .273-10.383l1.202-2.304Z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M17.031 4.703 15.576 4l-1.56 3H14v.03l-2.324 4.47H9.5V13h1.396l-1.502 2.889h-.95a3.694 3.694 0 0 1 0-7.389H10V7H8.444a5.194 5.194 0 1 0 0 10.389h.17L7.5 19.53l1.416.719L15.049 8.5h.507a3.694 3.694 0 0 1 0 7.39H14v1.5h1.556a5.194 5.194 0 0 0 .273-10.383l1.202-2.304Z" + }) +}); /* harmony default export */ const link_off = (linkOff); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/copy-small.js - /** * WordPress dependencies */ -const copySmall = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const copySmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - fillRule: "evenodd", - clipRule: "evenodd", - d: "M5.625 5.5h9.75c.069 0 .125.056.125.125v9.75a.125.125 0 0 1-.125.125h-9.75a.125.125 0 0 1-.125-.125v-9.75c0-.069.056-.125.125-.125ZM4 5.625C4 4.728 4.728 4 5.625 4h9.75C16.273 4 17 4.728 17 5.625v9.75c0 .898-.727 1.625-1.625 1.625h-9.75A1.625 1.625 0 0 1 4 15.375v-9.75Zm14.5 11.656v-9H20v9C20 18.8 18.77 20 17.251 20H6.25v-1.5h11.001c.69 0 1.249-.528 1.249-1.219Z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M5.625 5.5h9.75c.069 0 .125.056.125.125v9.75a.125.125 0 0 1-.125.125h-9.75a.125.125 0 0 1-.125-.125v-9.75c0-.069.056-.125.125-.125ZM4 5.625C4 4.728 4.728 4 5.625 4h9.75C16.273 4 17 4.728 17 5.625v9.75c0 .898-.727 1.625-1.625 1.625h-9.75A1.625 1.625 0 0 1 4 15.375v-9.75Zm14.5 11.656v-9H20v9C20 18.8 18.77 20 17.251 20H6.25v-1.5h11.001c.69 0 1.249-.528 1.249-1.219Z" + }) +}); /* harmony default export */ const copy_small = (copySmall); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/viewer-slot.js @@ -23212,7 +23132,6 @@ function useRemoteUrlData(url) { /* harmony default export */ const use_rich_url_data = (useRemoteUrlData); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/link-preview.js - /** * External dependencies */ @@ -23236,6 +23155,9 @@ function useRemoteUrlData(url) { */ + + + function LinkPreview({ value, onEditClick, @@ -23261,17 +23183,17 @@ function LinkPreview({ const displayTitle = !isEmptyURL && (0,external_wp_dom_namespaceObject.__unstableStripHTML)(richData?.title || value?.title || displayURL); let icon; if (richData?.icon) { - icon = (0,external_React_.createElement)("img", { + icon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: richData?.icon, alt: "" }); } else if (isEmptyURL) { - icon = (0,external_React_.createElement)(build_module_icon, { + icon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: library_info, size: 32 }); } else { - icon = (0,external_React_.createElement)(build_module_icon, { + icon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: library_globe }); } @@ -23284,69 +23206,83 @@ function LinkPreview({ type: 'snackbar' }); }); - return (0,external_React_.createElement)("div", { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { "aria-label": (0,external_wp_i18n_namespaceObject.__)('Currently selected'), - className: classnames_default()('block-editor-link-control__search-item', { + className: dist_clsx('block-editor-link-control__search-item', { 'is-current': true, 'is-rich': hasRichData, 'is-fetching': !!isFetching, 'is-preview': true, 'is-error': isEmptyURL, 'is-url-title': displayTitle === displayURL + }), + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-link-control__search-item-top", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("span", { + className: "block-editor-link-control__search-item-header", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + className: dist_clsx('block-editor-link-control__search-item-icon', { + 'is-image': richData?.icon + }), + children: icon + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + className: "block-editor-link-control__search-item-details", + children: !isEmptyURL ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { + className: "block-editor-link-control__search-item-title", + href: value.url, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { + numberOfLines: 1, + children: displayTitle + }) + }), value?.url && displayTitle !== displayURL && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + className: "block-editor-link-control__search-item-info", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { + numberOfLines: 1, + children: displayURL + }) + })] + }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + className: "block-editor-link-control__search-item-error-notice", + children: (0,external_wp_i18n_namespaceObject.__)('Link is empty') + }) + })] + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + icon: edit, + label: (0,external_wp_i18n_namespaceObject.__)('Edit link'), + onClick: onEditClick, + size: "compact" + }), hasUnlinkControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + icon: link_off, + label: (0,external_wp_i18n_namespaceObject.__)('Remove link'), + onClick: onRemove, + size: "compact" + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + icon: copy_small, + label: (0,external_wp_i18n_namespaceObject.sprintf)( + // Translators: %s is a placeholder for the link URL and an optional colon, (if a Link URL is present). + (0,external_wp_i18n_namespaceObject.__)('Copy link%s'), + // Ends up looking like "Copy link: https://example.com". + isEmptyURL || showIconLabels ? '' : ': ' + value.url), + ref: ref, + __experimentalIsFocusable: true, + disabled: isEmptyURL, + size: "compact" + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ViewerSlot, { + fillProps: value + })] }) - }, (0,external_React_.createElement)("div", { - className: "block-editor-link-control__search-item-top" - }, (0,external_React_.createElement)("span", { - className: "block-editor-link-control__search-item-header" - }, (0,external_React_.createElement)("span", { - className: classnames_default()('block-editor-link-control__search-item-icon', { - 'is-image': richData?.icon - }) - }, icon), (0,external_React_.createElement)("span", { - className: "block-editor-link-control__search-item-details" - }, !isEmptyURL ? (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.ExternalLink, { - className: "block-editor-link-control__search-item-title", - href: value.url - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, { - numberOfLines: 1 - }, displayTitle)), value?.url && displayTitle !== displayURL && (0,external_React_.createElement)("span", { - className: "block-editor-link-control__search-item-info" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, { - numberOfLines: 1 - }, displayURL))) : (0,external_React_.createElement)("span", { - className: "block-editor-link-control__search-item-error-notice" - }, (0,external_wp_i18n_namespaceObject.__)('Link is empty')))), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - icon: edit, - label: (0,external_wp_i18n_namespaceObject.__)('Edit link'), - onClick: onEditClick, - size: "compact" - }), hasUnlinkControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - icon: link_off, - label: (0,external_wp_i18n_namespaceObject.__)('Remove link'), - onClick: onRemove, - size: "compact" - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - icon: copy_small, - label: (0,external_wp_i18n_namespaceObject.sprintf)( - // Translators: %s is a placeholder for the link URL and an optional colon, (if a Link URL is present). - (0,external_wp_i18n_namespaceObject.__)('Copy link%s'), - // Ends up looking like "Copy link: https://example.com". - isEmptyURL || showIconLabels ? '' : ': ' + value.url), - ref: ref, - disabled: isEmptyURL, - size: "compact" - }), (0,external_React_.createElement)(ViewerSlot, { - fillProps: value - }))); + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/settings.js - /** * WordPress dependencies */ + + const settings_noop = () => {}; const LinkControlSettings = ({ value, @@ -23362,20 +23298,21 @@ const LinkControlSettings = ({ [setting.id]: newValue }); }; - const theSettings = settings.map(setting => (0,external_React_.createElement)(external_wp_components_namespaceObject.CheckboxControl, { + const theSettings = settings.map(setting => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { __nextHasNoMarginBottom: true, className: "block-editor-link-control__setting", - key: setting.id, label: setting.title, onChange: handleSettingChange(setting), checked: value ? !!value[setting.id] : false, help: setting?.help - })); - return (0,external_React_.createElement)("fieldset", { - className: "block-editor-link-control__settings" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { - as: "legend" - }, (0,external_wp_i18n_namespaceObject.__)('Currently selected link settings')), theSettings); + }, setting.id)); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { + className: "block-editor-link-control__settings", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { + as: "legend", + children: (0,external_wp_i18n_namespaceObject.__)('Currently selected link settings') + }), theSettings] + }); }; /* harmony default export */ const link_control_settings = (LinkControlSettings); @@ -23507,7 +23444,6 @@ function useInternalValue(value) { } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/index.js - /** * External dependencies */ @@ -23612,6 +23548,8 @@ function useInternalValue(value) { * @property {Function} renderControlBottom Optional controls to be rendered at the bottom of the component. */ + + const link_control_noop = () => {}; const PREFERENCE_SCOPE = 'core/block-editor'; const PREFERENCE_KEY = 'linkControlSettingsDrawer'; @@ -23708,7 +23646,6 @@ function LinkControl({ // because otherwise using the keyboard to select text // *within* the link format is not possible. if (isMounting.current) { - isMounting.current = false; return; } @@ -23721,6 +23658,15 @@ function LinkControl({ nextFocusTarget.focus(); isEndingEditWithFocus.current = false; }, [isEditingLink, isCreatingPage]); + + // The component mounting reference is maintained separately + // to correctly reset values in `StrictMode`. + (0,external_wp_element_namespaceObject.useEffect)(() => { + isMounting.current = false; + return () => { + isMounting.current = true; + }; + }, []); const hasLinkValue = value?.url?.trim()?.length > 0; /** @@ -23803,94 +23749,104 @@ function LinkControl({ const isEditing = (isEditingLink || !value) && !isCreatingPage; const isDisabled = !valueHasChanges || currentInputIsEmpty; const showSettings = !!settings?.length && isEditingLink && hasLinkValue; - return (0,external_React_.createElement)("div", { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { tabIndex: -1, ref: wrapperNode, - className: "block-editor-link-control" - }, isCreatingPage && (0,external_React_.createElement)("div", { - className: "block-editor-link-control__loading" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Spinner, null), " ", (0,external_wp_i18n_namespaceObject.__)('Creating'), "\u2026"), isEditing && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("div", { - className: classnames_default()({ - 'block-editor-link-control__search-input-wrapper': true, - 'has-text-control': showTextControl, - 'has-actions': showActions - }) - }, showTextControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, { - __nextHasNoMarginBottom: true, - ref: textInputRef, - className: "block-editor-link-control__field block-editor-link-control__text-content", - label: (0,external_wp_i18n_namespaceObject.__)('Text'), - value: internalControlValue?.title, - onChange: setInternalTextInputValue, - onKeyDown: handleSubmitWithEnter, - size: "__unstable-large" - }), (0,external_React_.createElement)(search_input, { - currentLink: value, - className: "block-editor-link-control__field block-editor-link-control__search-input", - placeholder: searchInputPlaceholder, - value: currentUrlInputValue, - withCreateSuggestion: withCreateSuggestion, - onCreateSuggestion: createPage, - onChange: setInternalURLInputValue, - onSelect: handleSelectSuggestion, - showInitialSuggestions: showInitialSuggestions, - allowDirectEntry: !noDirectEntry, - showSuggestions: showSuggestions, - suggestionsQuery: suggestionsQuery, - withURLSuggestion: !noURLSuggestion, - createSuggestionButtonText: createSuggestionButtonText, - hideLabelFromVision: !showTextControl - }), !showActions && (0,external_React_.createElement)("div", { - className: "block-editor-link-control__search-enter" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - onClick: isDisabled ? link_control_noop : handleSubmit, - label: (0,external_wp_i18n_namespaceObject.__)('Submit'), - icon: keyboard_return, - className: "block-editor-link-control__search-submit", - "aria-disabled": isDisabled - }))), errorMessage && (0,external_React_.createElement)(external_wp_components_namespaceObject.Notice, { - className: "block-editor-link-control__search-error", - status: "error", - isDismissible: false - }, errorMessage)), value && !isEditingLink && !isCreatingPage && (0,external_React_.createElement)(LinkPreview, { - key: value?.url // force remount when URL changes to avoid race conditions for rich previews - , - value: value, - onEditClick: () => setIsEditingLink(true), - hasRichPreviews: hasRichPreviews, - hasUnlinkControl: shownUnlinkControl, - onRemove: () => { - onRemove(); - setIsEditingLink(true); - } - }), showSettings && (0,external_React_.createElement)("div", { - className: "block-editor-link-control__tools" - }, !currentInputIsEmpty && (0,external_React_.createElement)(settings_drawer, { - settingsOpen: isSettingsOpen, - setSettingsOpen: setSettingsOpenWithPreference - }, (0,external_React_.createElement)(link_control_settings, { - value: internalControlValue, - settings: settings, - onChange: createSetInternalSettingValueHandler(settingsKeys) - }))), showActions && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { - justify: "right", - className: "block-editor-link-control__search-actions" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - variant: "tertiary", - onClick: handleCancel - }, (0,external_wp_i18n_namespaceObject.__)('Cancel')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - variant: "primary", - onClick: isDisabled ? link_control_noop : handleSubmit, - className: "block-editor-link-control__search-submit", - "aria-disabled": isDisabled - }, (0,external_wp_i18n_namespaceObject.__)('Save'))), !isCreatingPage && renderControlBottom && renderControlBottom()); + className: "block-editor-link-control", + children: [isCreatingPage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-link-control__loading", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}), " ", (0,external_wp_i18n_namespaceObject.__)('Creating'), "\u2026"] + }), isEditing && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: dist_clsx({ + 'block-editor-link-control__search-input-wrapper': true, + 'has-text-control': showTextControl, + 'has-actions': showActions + }), + children: [showTextControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { + __nextHasNoMarginBottom: true, + ref: textInputRef, + className: "block-editor-link-control__field block-editor-link-control__text-content", + label: (0,external_wp_i18n_namespaceObject.__)('Text'), + value: internalControlValue?.title, + onChange: setInternalTextInputValue, + onKeyDown: handleSubmitWithEnter, + size: "__unstable-large" + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(search_input, { + currentLink: value, + className: "block-editor-link-control__field block-editor-link-control__search-input", + placeholder: searchInputPlaceholder, + value: currentUrlInputValue, + withCreateSuggestion: withCreateSuggestion, + onCreateSuggestion: createPage, + onChange: setInternalURLInputValue, + onSelect: handleSelectSuggestion, + showInitialSuggestions: showInitialSuggestions, + allowDirectEntry: !noDirectEntry, + showSuggestions: showSuggestions, + suggestionsQuery: suggestionsQuery, + withURLSuggestion: !noURLSuggestion, + createSuggestionButtonText: createSuggestionButtonText, + hideLabelFromVision: !showTextControl + }), !showActions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-link-control__search-enter", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + onClick: isDisabled ? link_control_noop : handleSubmit, + label: (0,external_wp_i18n_namespaceObject.__)('Submit'), + icon: keyboard_return, + className: "block-editor-link-control__search-submit", + "aria-disabled": isDisabled + }) + })] + }), errorMessage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { + className: "block-editor-link-control__search-error", + status: "error", + isDismissible: false, + children: errorMessage + })] + }), value && !isEditingLink && !isCreatingPage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkPreview, { + // force remount when URL changes to avoid race conditions for rich previews + value: value, + onEditClick: () => setIsEditingLink(true), + hasRichPreviews: hasRichPreviews, + hasUnlinkControl: shownUnlinkControl, + onRemove: () => { + onRemove(); + setIsEditingLink(true); + } + }, value?.url), showSettings && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-link-control__tools", + children: !currentInputIsEmpty && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(settings_drawer, { + settingsOpen: isSettingsOpen, + setSettingsOpen: setSettingsOpenWithPreference, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(link_control_settings, { + value: internalControlValue, + settings: settings, + onChange: createSetInternalSettingValueHandler(settingsKeys) + }) + }) + }), showActions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { + justify: "right", + className: "block-editor-link-control__search-actions", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + variant: "tertiary", + onClick: handleCancel, + children: (0,external_wp_i18n_namespaceObject.__)('Cancel') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + variant: "primary", + onClick: isDisabled ? link_control_noop : handleSubmit, + className: "block-editor-link-control__search-submit", + "aria-disabled": isDisabled, + children: (0,external_wp_i18n_namespaceObject.__)('Save') + })] + }), !isCreatingPage && renderControlBottom && renderControlBottom()] + }); } LinkControl.ViewerFill = ViewerFill; LinkControl.DEFAULT_LINK_SETTINGS = DEFAULT_LINK_SETTINGS; /* harmony default export */ const link_control = (LinkControl); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/media-replace-flow/index.js - /** * External dependencies */ @@ -23917,6 +23873,9 @@ LinkControl.DEFAULT_LINK_SETTINGS = DEFAULT_LINK_SETTINGS; + + + const media_replace_flow_noop = () => {}; let uniqueId = 0; const MediaReplaceFlow = ({ @@ -24005,77 +23964,89 @@ const MediaReplaceFlow = ({ return allowedTypes.every(allowedType => allowedType === 'image' || allowedType.startsWith('image/')); }; const gallery = multiple && onlyAllowsImages(); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Dropdown, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: popoverProps, contentClassName: "block-editor-media-replace-flow__options", renderToggle: ({ isOpen, onToggle - }) => (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, { + }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { ref: editMediaButtonRef, "aria-expanded": isOpen, "aria-haspopup": "true", onClick: onToggle, - onKeyDown: openOnArrowDown - }, name), + onKeyDown: openOnArrowDown, + children: name + }), renderContent: ({ onClose - }) => (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.NavigableMenu, { - className: "block-editor-media-replace-flow__media-upload-menu" - }, (0,external_React_.createElement)(check, null, (0,external_React_.createElement)(media_upload, { - gallery: gallery, - addToGallery: addToGallery, - multiple: multiple, - value: multiple ? mediaIds : mediaId, - onSelect: media => selectMedia(media, onClose), - allowedTypes: allowedTypes, - render: ({ - open - }) => (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { - icon: library_media, - onClick: open - }, (0,external_wp_i18n_namespaceObject.__)('Open Media Library')) - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.FormFileUpload, { - onChange: event => { - uploadFiles(event, onClose); - }, - accept: accept, - multiple: !!multiple, - render: ({ - openFileDialog - }) => { - return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { - icon: library_upload, - onClick: () => { - openFileDialog(); + }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.NavigableMenu, { + className: "block-editor-media-replace-flow__media-upload-menu", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(check, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(media_upload, { + gallery: gallery, + addToGallery: addToGallery, + multiple: multiple, + value: multiple ? mediaIds : mediaId, + onSelect: media => selectMedia(media, onClose), + allowedTypes: allowedTypes, + render: ({ + open + }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { + icon: library_media, + onClick: open, + children: (0,external_wp_i18n_namespaceObject.__)('Open Media Library') + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FormFileUpload, { + onChange: event => { + uploadFiles(event, onClose); + }, + accept: accept, + multiple: !!multiple, + render: ({ + openFileDialog + }) => { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { + icon: library_upload, + onClick: () => { + openFileDialog(); + }, + children: (0,external_wp_i18n_namespaceObject.__)('Upload') + }); + } + })] + }), onToggleFeaturedImage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { + icon: post_featured_image, + onClick: onToggleFeaturedImage, + isPressed: useFeaturedImage, + children: (0,external_wp_i18n_namespaceObject.__)('Use featured image') + }), children] + }), onSelectURL && + /*#__PURE__*/ + // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions + (0,external_ReactJSXRuntime_namespaceObject.jsxs)("form", { + className: dist_clsx('block-editor-media-flow__url-input', { + 'has-siblings': canUpload || onToggleFeaturedImage + }), + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + className: "block-editor-media-replace-flow__image-url-label", + children: (0,external_wp_i18n_namespaceObject.__)('Current media URL:') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(link_control, { + value: { + url: mediaURL + }, + settings: [], + showSuggestions: false, + onChange: ({ + url + }) => { + onSelectURL(url); + editMediaButtonRef.current.focus(); } - }, (0,external_wp_i18n_namespaceObject.__)('Upload')); - } - })), onToggleFeaturedImage && (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { - icon: post_featured_image, - onClick: onToggleFeaturedImage, - isPressed: useFeaturedImage - }, (0,external_wp_i18n_namespaceObject.__)('Use featured image')), children), onSelectURL && - // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions - (0,external_React_.createElement)("form", { - className: classnames_default()('block-editor-media-flow__url-input', { - 'has-siblings': canUpload || onToggleFeaturedImage - }) - }, (0,external_React_.createElement)("span", { - className: "block-editor-media-replace-flow__image-url-label" - }, (0,external_wp_i18n_namespaceObject.__)('Current media URL:')), (0,external_React_.createElement)(link_control, { - value: { - url: mediaURL - }, - settings: [], - showSuggestions: false, - onChange: ({ - url - }) => { - onSelectURL(url); - editMediaButtonRef.current.focus(); - } - }))) + })] + })] + }) }); }; @@ -24093,8 +24064,81 @@ const MediaReplaceFlow = ({ }; }), (0,external_wp_components_namespaceObject.withFilters)('editor.MediaReplaceFlow')])(MediaReplaceFlow)); -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/background.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/theme-file-uri-utils.js +/** + * Internal dependencies + */ + + +/** + * Looks up a theme file URI based on a relative path. + * + * @param {string} file A relative path. + * @param {Array} themeFileURIs A collection of absolute theme file URIs and their corresponding file paths. + * @return {string?} A resolved theme file URI, if one is found in the themeFileURIs collection. + */ +function getResolvedThemeFilePath(file, themeFileURIs = []) { + const uri = themeFileURIs.find(themeFileUri => themeFileUri.name === file); + if (!uri?.href) { + return file; + } + return uri?.href; +} + +/** + * Mutates an object by settings a value at the provided path. + * + * @param {Object} object Object to set a value in. + * @param {number|string|Array} path Path in the object to modify. + * @param {*} value New value to set. + * @return {Object} Object with the new value set. + */ +function setMutably(object, path, value) { + path = path.split('.'); + const finalValueKey = path.pop(); + let prev = object; + for (const key of path) { + const current = prev[key]; + prev = current; + } + prev[finalValueKey] = value; + return object; +} + +/** + * Resolves any relative paths if a corresponding theme file URI is available. + * Note: this function mutates the object and is specifically to be used in + * an async styles build context in useGlobalStylesOutput + * + * @param {Object} themeJson Theme.json/Global styles tree. + * @param {Array} themeFileURIs A collection of absolute theme file URIs and their corresponding file paths. + * @return {Object} Returns mutated object. + */ +function setThemeFileUris(themeJson, themeFileURIs) { + if (!themeJson?.styles || !themeFileURIs) { + return themeJson; + } + themeFileURIs.forEach(({ + name, + href, + target + }) => { + const value = getValueFromObjectPath(themeJson, target); + if (value === name) { + /* + * The object must not be updated immutably here because the + * themeJson is a reference to the global styles tree used as a dependency in the + * useGlobalStylesOutputWithConfig() hook. If we don't mutate the object, + * the hook will detect the change and re-render the component, resulting + * in a maximum depth exceeded error. + */ + themeJson = setMutably(themeJson, target, href); + } + }); + return themeJson; +} +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/background-panel.js /** * External dependencies */ @@ -24112,7 +24156,6 @@ const MediaReplaceFlow = ({ - /** * Internal dependencies */ @@ -24121,19 +24164,24 @@ const MediaReplaceFlow = ({ -const BACKGROUND_SUPPORT_KEY = 'background'; + + const IMAGE_BACKGROUND_TYPE = 'image'; +const background_panel_DEFAULT_CONTROLS = { + backgroundImage: true, + backgroundSize: false +}; /** - * Checks if there is a current value in the background image block support - * attributes. + * Checks site settings to see if the background panel may be used. + * `settings.background.backgroundSize` exists also, + * but can only be used if settings?.background?.backgroundImage is `true`. * - * @param {Object} style Style attribute. - * @return {boolean} Whether or not the block has a background image value set. + * @param {Object} settings Site settings + * @return {boolean} Whether site settings has activated background panel. */ -function hasBackgroundImageValue(style) { - const hasValue = !!style?.background?.backgroundImage?.id || !!style?.background?.backgroundImage?.url; - return hasValue; +function useHasBackgroundPanel(settings) { + return external_wp_element_namespaceObject.Platform.OS === 'web' && settings?.background?.backgroundImage; } /** @@ -24142,138 +24190,131 @@ function hasBackgroundImageValue(style) { * as background position. * * @param {Object} style Style attribute. - * @return {boolean} Whether or not the block has a background size value set. + * @return {boolean} Whether the block has a background size value set. */ function hasBackgroundSizeValue(style) { return style?.background?.backgroundPosition !== undefined || style?.background?.backgroundSize !== undefined; } /** - * Determine whether there is block support for background. - * - * @param {string} blockName Block name. - * @param {string} feature Background image feature to check for. + * Checks if there is a current value in the background image block support + * attributes. * - * @return {boolean} Whether there is support. + * @param {Object} style Style attribute. + * @return {boolean} Whether the block has a background image value set. */ -function hasBackgroundSupport(blockName, feature = 'any') { - if (external_wp_element_namespaceObject.Platform.OS !== 'web') { - return false; - } - const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, BACKGROUND_SUPPORT_KEY); - if (support === true) { - return true; - } - if (feature === 'any') { - return !!support?.backgroundImage || !!support?.backgroundSize || !!support?.backgroundRepeat; - } - return !!support?.[feature]; +function hasBackgroundImageValue(style) { + return !!style?.background?.backgroundImage?.id || + // Supports url() string values in theme.json. + 'string' === typeof style?.background?.backgroundImage || !!style?.background?.backgroundImage?.url; } /** - * Resets the background image block support attributes. This can be used when disabling - * the background image controls for a block via a `ToolsPanel`. + * Get the help text for the background size control. * - * @param {Object} style Style attribute. - * @param {Function} setAttributes Function to set block's attributes. + * @param {string} value backgroundSize value. + * @return {string} Translated help text. */ -function resetBackgroundImage(style = {}, setAttributes) { - setAttributes({ - style: utils_cleanEmptyObject({ - ...style, - background: { - ...style?.background, - backgroundImage: undefined - } - }) - }); +function backgroundSizeHelpText(value) { + if (value === 'cover' || value === undefined) { + return (0,external_wp_i18n_namespaceObject.__)('Image covers the space evenly.'); + } + if (value === 'contain') { + return (0,external_wp_i18n_namespaceObject.__)('Image is contained without distortion.'); + } + return (0,external_wp_i18n_namespaceObject.__)('Image has a fixed width.'); } /** - * Resets the background size block support attributes. This can be used when disabling - * the background size controls for a block via a `ToolsPanel`. + * Converts decimal x and y coords from FocalPointPicker to percentage-based values + * to use as backgroundPosition value. * - * @param {Object} style Style attribute. - * @param {Function} setAttributes Function to set block's attributes. + * @param {{x?:number, y?:number}} value FocalPointPicker coords. + * @return {string} backgroundPosition value. */ -function resetBackgroundSize(style = {}, setAttributes) { - setAttributes({ - style: utils_cleanEmptyObject({ - ...style, - background: { - ...style?.background, - backgroundPosition: undefined, - backgroundRepeat: undefined, - backgroundSize: undefined - } - }) - }); -} +const coordsToBackgroundPosition = value => { + if (!value || isNaN(value.x) && isNaN(value.y)) { + return undefined; + } + const x = isNaN(value.x) ? 0.5 : value.x; + const y = isNaN(value.y) ? 0.5 : value.y; + return `${x * 100}% ${y * 100}%`; +}; /** - * Generates a CSS class name if an background image is set. - * - * @param {Object} style A block's style attribute. + * Converts backgroundPosition value to x and y coords for FocalPointPicker. * - * @return {string} CSS class name. + * @param {string} value backgroundPosition value. + * @return {{x?:number, y?:number}} FocalPointPicker coords. */ -function getBackgroundImageClasses(style) { - return hasBackgroundImageValue(style) ? 'has-background' : ''; -} +const backgroundPositionToCoords = value => { + if (!value) { + return { + x: undefined, + y: undefined + }; + } + let [x, y] = value.split(' ').map(v => parseFloat(v) / 100); + x = isNaN(x) ? undefined : x; + y = isNaN(y) ? x : y; + return { + x, + y + }; +}; function InspectorImagePreview({ label, filename, url: imgUrl }) { - const imgLabel = label || (0,external_wp_url_namespaceObject.getFilename)(imgUrl); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, { - as: "span" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { - justify: "flex-start", - as: "span" - }, (0,external_React_.createElement)("span", { - className: classnames_default()('block-editor-hooks__background__inspector-image-indicator-wrapper', { - 'has-image': imgUrl - }), - "aria-hidden": true - }, imgUrl && (0,external_React_.createElement)("span", { - className: "block-editor-hooks__background__inspector-image-indicator", - style: { - backgroundImage: `url(${imgUrl})` - } - })), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, { - as: "span" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, { - numberOfLines: 1, - className: "block-editor-hooks__background__inspector-media-replace-title" - }, imgLabel), (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { - as: "span" - }, filename ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: file name */ - (0,external_wp_i18n_namespaceObject.__)('Selected image: %s'), filename) : (0,external_wp_i18n_namespaceObject.__)('No image selected'))))); -} -function BackgroundImagePanelItem({ - clientId, + const imgLabel = label || (0,external_wp_url_namespaceObject.getFilename)(imgUrl) || (0,external_wp_i18n_namespaceObject.__)('Add background image'); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { + as: "span", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { + justify: imgUrl ? 'flex-start' : 'center', + as: "span", + children: [imgUrl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + className: dist_clsx('block-editor-global-styles-background-panel__inspector-image-indicator-wrapper', { + 'has-image': imgUrl + }), + "aria-hidden": true, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + className: "block-editor-global-styles-background-panel__inspector-image-indicator", + style: { + backgroundImage: `url(${imgUrl})` + } + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexItem, { + as: "span", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { + numberOfLines: 1, + className: "block-editor-global-styles-background-panel__inspector-media-replace-title", + children: imgLabel + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { + as: "span", + children: imgUrl ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: file name */ + (0,external_wp_i18n_namespaceObject.__)('Background image: %s'), filename || imgLabel) : (0,external_wp_i18n_namespaceObject.__)('No background image selected') + })] + })] + }) + }); +} +function BackgroundImageToolsPanelItem({ + panelId, isShownByDefault, - setAttributes + onChange, + style, + inheritedValue, + themeFileURIs }) { - const { - style, - mediaUpload - } = (0,external_wp_data_namespaceObject.useSelect)(select => { - const { - getBlockAttributes, - getSettings - } = select(store); - return { - style: getBlockAttributes(clientId)?.style, - mediaUpload: getSettings().mediaUpload - }; - }, [clientId]); + const mediaUpload = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings().mediaUpload, []); const { id, title, url - } = style?.background?.backgroundImage || {}; + } = style?.background?.backgroundImage || { + ...inheritedValue?.background?.backgroundImage + }; const replaceContainerRef = (0,external_wp_element_namespaceObject.useRef)(); const { createErrorNotice @@ -24283,19 +24324,10 @@ function BackgroundImagePanelItem({ type: 'snackbar' }); }; + const resetBackgroundImage = () => onChange(setImmutably(style, ['background', 'backgroundImage'], undefined)); const onSelectMedia = media => { if (!media || !media.url) { - const newStyle = { - ...style, - background: { - ...style?.background, - backgroundImage: undefined - } - }; - const newAttributes = { - style: utils_cleanEmptyObject(newStyle) - }; - setAttributes(newAttributes); + resetBackgroundImage(); return; } if ((0,external_wp_blob_namespaceObject.isBlobURL)(media.url)) { @@ -24307,26 +24339,22 @@ function BackgroundImagePanelItem({ onUploadError((0,external_wp_i18n_namespaceObject.__)('Only images can be used as a background image.')); return; } - const newStyle = { - ...style, - background: { - ...style?.background, - backgroundImage: { - url: media.url, - id: media.id, - source: 'file', - title: media.title || undefined - } - } - }; - const newAttributes = { - style: utils_cleanEmptyObject(newStyle) - }; - setAttributes(newAttributes); + const sizeValue = style?.background?.backgroundSize; + const positionValue = style?.background?.backgroundPosition; + onChange(setImmutably(style, ['background'], { + ...style?.background, + backgroundImage: { + url: media.url, + id: media.id, + source: 'file', + title: media.title || undefined + }, + backgroundPosition: !positionValue && ('auto' === sizeValue || !sizeValue) ? '50% 0' : positionValue + })); }; const onFilesDrop = filesList => { mediaUpload({ - allowedTypes: ['image'], + allowedTypes: [IMAGE_BACKGROUND_TYPE], filesList, onFileChange([image]) { if ((0,external_wp_blob_namespaceObject.isBlobURL)(image?.url)) { @@ -24347,95 +24375,88 @@ function BackgroundImagePanelItem({ }; }, []); const hasValue = hasBackgroundImageValue(style); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + const closeAndFocus = () => { + const [toggleButton] = external_wp_dom_namespaceObject.focus.tabbable.find(replaceContainerRef.current); + // Focus the toggle button and close the dropdown menu. + // This ensures similar behaviour as to selecting an image, where the dropdown is + // closed and focus is redirected to the dropdown toggle button. + toggleButton?.focus(); + toggleButton?.click(); + }; + const onRemove = () => onChange(setImmutably(style, ['background', 'backgroundImage'], 'none')); + const canRemove = !hasValue && hasBackgroundImageValue(inheritedValue); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { className: "single-column", hasValue: () => hasValue, label: (0,external_wp_i18n_namespaceObject.__)('Background image'), - onDeselect: () => resetBackgroundImage(style, setAttributes), + onDeselect: resetBackgroundImage, isShownByDefault: isShownByDefault, resetAllFilter: resetAllFilter, - panelId: clientId - }, (0,external_React_.createElement)("div", { - className: "block-editor-hooks__background__inspector-media-replace-container", - ref: replaceContainerRef - }, (0,external_React_.createElement)(media_replace_flow, { - mediaId: id, - mediaURL: url, - allowedTypes: [IMAGE_BACKGROUND_TYPE], - accept: "image/*", - onSelect: onSelectMedia, - name: (0,external_React_.createElement)(InspectorImagePreview, { - label: (0,external_wp_i18n_namespaceObject.__)('Background image'), - filename: title, - url: url - }), - variant: "secondary" - }, hasValue && (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { - onClick: () => { - const [toggleButton] = external_wp_dom_namespaceObject.focus.tabbable.find(replaceContainerRef.current); - // Focus the toggle button and close the dropdown menu. - // This ensures similar behaviour as to selecting an image, where the dropdown is - // closed and focus is redirected to the dropdown toggle button. - toggleButton?.focus(); - toggleButton?.click(); - resetBackgroundImage(style, setAttributes); - } - }, (0,external_wp_i18n_namespaceObject.__)('Reset '))), (0,external_React_.createElement)(external_wp_components_namespaceObject.DropZone, { - onFilesDrop: onFilesDrop, - label: (0,external_wp_i18n_namespaceObject.__)('Drop to upload') - }))); -} -function backgroundSizeHelpText(value) { - if (value === 'cover' || value === undefined) { - return (0,external_wp_i18n_namespaceObject.__)('Image covers the space evenly.'); - } - if (value === 'contain') { - return (0,external_wp_i18n_namespaceObject.__)('Image is contained without distortion.'); - } - return (0,external_wp_i18n_namespaceObject.__)('Specify a fixed width.'); + panelId: panelId, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-global-styles-background-panel__inspector-media-replace-container", + ref: replaceContainerRef, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(media_replace_flow, { + mediaId: id, + mediaURL: url, + allowedTypes: [IMAGE_BACKGROUND_TYPE], + accept: "image/*", + onSelect: onSelectMedia, + name: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InspectorImagePreview, { + label: title, + filename: title, + url: getResolvedThemeFilePath(url, themeFileURIs) + }), + variant: "secondary", + children: [canRemove && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { + onClick: () => { + closeAndFocus(); + onRemove(); + }, + children: (0,external_wp_i18n_namespaceObject.__)('Remove') + }), hasValue && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { + onClick: () => { + closeAndFocus(); + resetBackgroundImage(); + }, + children: (0,external_wp_i18n_namespaceObject.__)('Reset ') + })] + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropZone, { + onFilesDrop: onFilesDrop, + label: (0,external_wp_i18n_namespaceObject.__)('Drop to upload') + })] + }) + }); } -const coordsToBackgroundPosition = value => { - if (!value || isNaN(value.x) && isNaN(value.y)) { - return undefined; - } - const x = isNaN(value.x) ? 0.5 : value.x; - const y = isNaN(value.y) ? 0.5 : value.y; - return `${x * 100}% ${y * 100}%`; -}; -const backgroundPositionToCoords = value => { - if (!value) { - return { - x: undefined, - y: undefined - }; - } - let [x, y] = value.split(' ').map(v => parseFloat(v) / 100); - x = isNaN(x) ? undefined : x; - y = isNaN(y) ? x : y; - return { - x, - y - }; -}; -function BackgroundSizePanelItem({ - clientId, +function BackgroundSizeToolsPanelItem({ + panelId, isShownByDefault, - setAttributes + onChange, + style, + inheritedValue, + defaultValues, + themeFileURIs }) { - const style = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getBlockAttributes(clientId)?.style, [clientId]); - const sizeValue = style?.background?.backgroundSize; - const repeatValue = style?.background?.backgroundRepeat; - - // An `undefined` value is treated as `cover` by the toggle group control. - // An empty string is treated as `auto` by the toggle group control. This - // allows a user to select "Size" and then enter a custom value, with an - // empty value being treated as `auto`. - const currentValueForToggle = sizeValue !== undefined && sizeValue !== 'cover' && sizeValue !== 'contain' || sizeValue === '' ? 'auto' : sizeValue || 'cover'; - - // If the current value is `cover` and the repeat value is `undefined`, then - // the toggle should be unchecked as the default state. Otherwise, the toggle - // should reflect the current repeat value. - const repeatCheckedValue = repeatValue === 'no-repeat' || currentValueForToggle === 'cover' && repeatValue === undefined ? false : true; + const sizeValue = style?.background?.backgroundSize || inheritedValue?.background?.backgroundSize; + const repeatValue = style?.background?.backgroundRepeat || inheritedValue?.background?.backgroundRepeat; + const imageValue = style?.background?.backgroundImage?.url || inheritedValue?.background?.backgroundImage?.url; + const positionValue = style?.background?.backgroundPosition || inheritedValue?.background?.backgroundPosition; + + /* + * An `undefined` value is replaced with any supplied + * default control value for the toggle group control. + * An empty string is treated as `auto` - this allows a user + * to select "Size" and then enter a custom value, with an + * empty value being treated as `auto`. + */ + const currentValueForToggle = sizeValue !== undefined && sizeValue !== 'cover' && sizeValue !== 'contain' || sizeValue === '' ? 'auto' : sizeValue || defaultValues?.backgroundSize; + + /* + * If the current value is `cover` and the repeat value is `undefined`, then + * the toggle should be unchecked as the default state. Otherwise, the toggle + * should reflect the current repeat value. + */ + const repeatCheckedValue = !(repeatValue === 'no-repeat' || currentValueForToggle === 'cover' && repeatValue === undefined); const hasValue = hasBackgroundSizeValue(style); const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(previousValue => { return { @@ -24453,400 +24474,988 @@ function BackgroundSizePanelItem({ const updateBackgroundSize = next => { // When switching to 'contain' toggle the repeat off. let nextRepeat = repeatValue; + let nextPosition = positionValue; if (next === 'contain') { nextRepeat = 'no-repeat'; + nextPosition = undefined; + } + if (next === 'cover') { + nextRepeat = undefined; + nextPosition = undefined; } if ((currentValueForToggle === 'cover' || currentValueForToggle === 'contain') && next === 'auto') { nextRepeat = undefined; + /* + * A background image uploaded and set in the editor (an image with a record id), + * receives a default background position of '50% 0', + * when the toggle switches to "Tile". This is to increase the chance that + * the image's focus point is visible. + */ + if (!!style?.background?.backgroundImage?.id) { + nextPosition = '50% 0'; + } } - setAttributes({ - style: utils_cleanEmptyObject({ - ...style, - background: { - ...style?.background, - backgroundRepeat: nextRepeat, - backgroundSize: next - } - }) - }); + + /* + * Next will be null when the input is cleared, + * in which case the value should be 'auto'. + */ + if (!next && currentValueForToggle === 'auto') { + next = 'auto'; + } + onChange(setImmutably(style, ['background'], { + ...style?.background, + backgroundPosition: nextPosition, + backgroundRepeat: nextRepeat, + backgroundSize: next + })); }; const updateBackgroundPosition = next => { - setAttributes({ - style: utils_cleanEmptyObject({ - ...style, - background: { - ...style?.background, - backgroundPosition: coordsToBackgroundPosition(next) - } - }) - }); - }; - const toggleIsRepeated = () => { - setAttributes({ - style: utils_cleanEmptyObject({ - ...style, - background: { - ...style?.background, - backgroundRepeat: repeatCheckedValue === true ? 'no-repeat' : undefined - } - }) - }); + onChange(setImmutably(style, ['background', 'backgroundPosition'], coordsToBackgroundPosition(next))); }; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { + const toggleIsRepeated = () => onChange(setImmutably(style, ['background', 'backgroundRepeat'], repeatCheckedValue === true ? 'no-repeat' : 'repeat')); + const resetBackgroundSize = () => onChange(setImmutably(style, ['background'], { + ...style?.background, + backgroundPosition: undefined, + backgroundRepeat: undefined, + backgroundSize: undefined + })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { as: external_wp_components_namespaceObject.__experimentalToolsPanelItem, spacing: 2, className: "single-column", hasValue: () => hasValue, label: (0,external_wp_i18n_namespaceObject.__)('Size'), - onDeselect: () => resetBackgroundSize(style, setAttributes), + onDeselect: resetBackgroundSize, isShownByDefault: isShownByDefault, resetAllFilter: resetAllFilter, - panelId: clientId - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.FocalPointPicker, { - __next40pxDefaultSize: true, - label: (0,external_wp_i18n_namespaceObject.__)('Position'), - url: style?.background?.backgroundImage?.url, - value: backgroundPositionToCoords(style?.background?.backgroundPosition), - onChange: updateBackgroundPosition - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { - size: '__unstable-large', - label: (0,external_wp_i18n_namespaceObject.__)('Size'), - value: currentValueForToggle, - onChange: updateBackgroundSize, - isBlock: true, - help: backgroundSizeHelpText(sizeValue) - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { - key: 'cover', - value: 'cover', - label: (0,external_wp_i18n_namespaceObject.__)('Cover') - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { - key: 'contain', - value: 'contain', - label: (0,external_wp_i18n_namespaceObject.__)('Contain') - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { - key: 'fixed', - value: 'auto', - label: (0,external_wp_i18n_namespaceObject.__)('Fixed') - })), sizeValue !== undefined && sizeValue !== 'cover' && sizeValue !== 'contain' ? (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, { - size: '__unstable-large', - onChange: updateBackgroundSize, - value: sizeValue - }) : null, currentValueForToggle !== 'cover' && (0,external_React_.createElement)(external_wp_components_namespaceObject.ToggleControl, { - label: (0,external_wp_i18n_namespaceObject.__)('Repeat'), - checked: repeatCheckedValue, - onChange: toggleIsRepeated - })); + panelId: panelId, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FocalPointPicker, { + __next40pxDefaultSize: true, + label: (0,external_wp_i18n_namespaceObject.__)('Position'), + url: getResolvedThemeFilePath(imageValue, themeFileURIs), + value: backgroundPositionToCoords(positionValue), + onChange: updateBackgroundPosition + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { + size: "__unstable-large", + label: (0,external_wp_i18n_namespaceObject.__)('Size'), + value: currentValueForToggle, + onChange: updateBackgroundSize, + isBlock: true, + help: backgroundSizeHelpText(sizeValue || defaultValues?.backgroundSize), + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { + value: "cover", + label: (0,external_wp_i18n_namespaceObject._x)('Cover', 'Size option for background image control') + }, "cover"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { + value: "contain", + label: (0,external_wp_i18n_namespaceObject._x)('Contain', 'Size option for background image control') + }, "contain"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { + value: "auto", + label: (0,external_wp_i18n_namespaceObject._x)('Tile', 'Size option for background image control') + }, "tile")] + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { + justify: "flex-start", + spacing: 2, + as: "span", + children: [currentValueForToggle !== undefined && currentValueForToggle !== 'cover' && currentValueForToggle !== 'contain' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { + "aria-label": (0,external_wp_i18n_namespaceObject.__)('Background image width'), + onChange: updateBackgroundSize, + value: sizeValue, + size: "__unstable-large", + __unstableInputWidth: "100px", + min: 0, + placeholder: (0,external_wp_i18n_namespaceObject.__)('Auto') + }) : null, currentValueForToggle !== 'cover' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Repeat'), + checked: repeatCheckedValue, + onChange: toggleIsRepeated + })] + })] + }); } -function BackgroundImagePanel(props) { - const [backgroundImage, backgroundSize] = use_settings_useSettings('background.backgroundImage', 'background.backgroundSize'); - if (!backgroundImage || !hasBackgroundSupport(props.name, 'backgroundImage')) { - return null; - } - const showBackgroundSize = !!(backgroundSize && hasBackgroundSupport(props.name, 'backgroundSize')); - const defaultControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(props.name, [BACKGROUND_SUPPORT_KEY, '__experimentalDefaultControls']); - return (0,external_React_.createElement)(inspector_controls, { - group: "background" - }, (0,external_React_.createElement)(BackgroundImagePanelItem, { - isShownByDefault: defaultControls?.backgroundImage, - ...props - }), showBackgroundSize && (0,external_React_.createElement)(BackgroundSizePanelItem, { - isShownByDefault: defaultControls?.backgroundSize, - ...props - })); +function BackgroundToolsPanel({ + resetAllFilter, + onChange, + value, + panelId, + children, + headerLabel +}) { + const dropdownMenuProps = useToolsPanelDropdownMenuProps(); + const resetAll = () => { + const updatedValue = resetAllFilter(value); + onChange(updatedValue); + }; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { + as: external_wp_components_namespaceObject.__experimentalToolsPanel, + spacing: 4, + label: headerLabel, + resetAll: resetAll, + panelId: panelId, + dropdownMenuProps: dropdownMenuProps, + children: children + }); +} +function BackgroundPanel({ + as: Wrapper = BackgroundToolsPanel, + value, + onChange, + inheritedValue = value, + settings, + panelId, + defaultControls = background_panel_DEFAULT_CONTROLS, + defaultValues = {}, + headerLabel = (0,external_wp_i18n_namespaceObject.__)('Background image'), + themeFileURIs +}) { + const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(previousValue => { + return { + ...previousValue, + background: {} + }; + }, []); + const shouldShowBackgroundSizeControls = settings?.background?.backgroundSize; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Wrapper, { + resetAllFilter: resetAllFilter, + value: value, + onChange: onChange, + panelId: panelId, + headerLabel: headerLabel, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BackgroundImageToolsPanelItem, { + onChange: onChange, + panelId: panelId, + isShownByDefault: defaultControls.backgroundImage, + style: value, + inheritedValue: inheritedValue, + themeFileURIs: themeFileURIs + }), shouldShowBackgroundSizeControls && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BackgroundSizeToolsPanelItem, { + onChange: onChange, + panelId: panelId, + isShownByDefault: defaultControls.backgroundSize, + style: value, + inheritedValue: inheritedValue, + defaultValues: defaultValues, + themeFileURIs: themeFileURIs + })] + }); } -;// CONCATENATED MODULE: ./node_modules/colord/index.mjs -var r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n+0},e=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},u=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},a=function(r){return{r:e(r.r,0,255),g:e(r.g,0,255),b:e(r.b,0,255),a:e(r.a)}},o=function(r){return{r:n(r.r),g:n(r.g),b:n(r.b),a:n(r.a,3)}},i=/^#([0-9a-f]{3,8})$/i,s=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},h=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,a=Math.max(t,n,e),o=a-Math.min(t,n,e),i=o?a===t?(n-e)/o:a===n?2+(e-t)/o:4+(t-n)/o:0;return{h:60*(i<0?i+6:i),s:a?o/a*100:0,v:a/255*100,a:u}},b=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var a=Math.floor(t),o=e*(1-n),i=e*(1-(t-a)*n),s=e*(1-(1-t+a)*n),h=a%6;return{r:255*[e,i,o,o,s,e][h],g:255*[s,e,e,i,o,o][h],b:255*[o,o,s,e,e,i][h],a:u}},g=function(r){return{h:u(r.h),s:e(r.s,0,100),l:e(r.l,0,100),a:e(r.a)}},d=function(r){return{h:n(r.h),s:n(r.s),l:n(r.l),a:n(r.a,3)}},f=function(r){return b((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e},c=function(r){return{h:(t=h(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u},l=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,p=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,m=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,y={string:[[function(r){var t=i.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:4===r.length?n(parseInt(r[3]+r[3],16)/255,2):1}:6===r.length||8===r.length?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:8===r.length?n(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=v.exec(r)||m.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:a({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(t){var n=l.exec(t)||p.exec(t);if(!n)return null;var e,u,a=g({h:(e=n[1],u=n[2],void 0===u&&(u="deg"),Number(e)*(r[u]||1)),s:Number(n[3]),l:Number(n[4]),a:void 0===n[5]?1:Number(n[5])/(n[6]?100:1)});return f(a)},"hsl"]],object:[[function(r){var n=r.r,e=r.g,u=r.b,o=r.a,i=void 0===o?1:o;return t(n)&&t(e)&&t(u)?a({r:Number(n),g:Number(e),b:Number(u),a:Number(i)}):null},"rgb"],[function(r){var n=r.h,e=r.s,u=r.l,a=r.a,o=void 0===a?1:a;if(!t(n)||!t(e)||!t(u))return null;var i=g({h:Number(n),s:Number(e),l:Number(u),a:Number(o)});return f(i)},"hsl"],[function(r){var n=r.h,a=r.s,o=r.v,i=r.a,s=void 0===i?1:i;if(!t(n)||!t(a)||!t(o))return null;var h=function(r){return{h:u(r.h),s:e(r.s,0,100),v:e(r.v,0,100),a:e(r.a)}}({h:Number(n),s:Number(a),v:Number(o),a:Number(s)});return b(h)},"hsv"]]},N=function(r,t){for(var n=0;n=.5},r.prototype.toHex=function(){return r=o(this.rgba),t=r.r,e=r.g,u=r.b,i=(a=r.a)<1?s(n(255*a)):"","#"+s(t)+s(e)+s(u)+i;var r,t,e,u,a,i},r.prototype.toRgb=function(){return o(this.rgba)},r.prototype.toRgbString=function(){return r=o(this.rgba),t=r.r,n=r.g,e=r.b,(u=r.a)<1?"rgba("+t+", "+n+", "+e+", "+u+")":"rgb("+t+", "+n+", "+e+")";var r,t,n,e,u},r.prototype.toHsl=function(){return d(c(this.rgba))},r.prototype.toHslString=function(){return r=d(c(this.rgba)),t=r.h,n=r.s,e=r.l,(u=r.a)<1?"hsla("+t+", "+n+"%, "+e+"%, "+u+")":"hsl("+t+", "+n+"%, "+e+"%)";var r,t,n,e,u},r.prototype.toHsv=function(){return r=h(this.rgba),{h:n(r.h),s:n(r.s),v:n(r.v),a:n(r.a,3)};var r},r.prototype.invert=function(){return w({r:255-(r=this.rgba).r,g:255-r.g,b:255-r.b,a:r.a});var r},r.prototype.saturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,-r))},r.prototype.grayscale=function(){return w(M(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),w($(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),w($(this.rgba,-r))},r.prototype.rotate=function(r){return void 0===r&&(r=15),this.hue(this.hue()+r)},r.prototype.alpha=function(r){return"number"==typeof r?w({r:(t=this.rgba).r,g:t.g,b:t.b,a:r}):n(this.rgba.a,3);var t},r.prototype.hue=function(r){var t=c(this.rgba);return"number"==typeof r?w({h:r,s:t.s,l:t.l,a:t.a}):n(t.h)},r.prototype.isEqual=function(r){return this.toHex()===w(r).toHex()},r}(),w=function(r){return r instanceof colord_j?r:new colord_j(r)},S=[],k=function(r){r.forEach(function(r){S.indexOf(r)<0&&(r(colord_j,y),S.push(r))})},E=function(){return new colord_j({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})}; - -;// CONCATENATED MODULE: ./node_modules/colord/plugins/names.mjs -/* harmony default export */ function names(e,f){var a={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var d in a)r[a[d]]=d;var l={};e.prototype.toName=function(f){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var d,i,n=r[this.toHex()];if(n)return n;if(null==f?void 0:f.closest){var o=this.toRgb(),t=1/0,b="black";if(!l.length)for(var c in a)l[c]=new e(a[c]).toRgb();for(var g in a){var u=(d=o,i=l[g],Math.pow(d.r-i.r,2)+Math.pow(d.g-i.g,2)+Math.pow(d.b-i.b,2));ud?(u+.05)/(d+.05):(d+.05)/(u+.05),void 0===(a=2)&&(a=0),void 0===i&&(i=Math.pow(10,a)),Math.floor(i*n)/i+0},o.prototype.isReadable=function(o,t){return void 0===o&&(o="#FFF"),void 0===t&&(t={}),this.contrast(o)>=(e=void 0===(i=(r=t).size)?"normal":i,"AAA"===(a=void 0===(n=r.level)?"AA":n)&&"normal"===e?7:"AA"===a&&"large"===e?3:4.5);var r,n,a,i,e}} - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors/utils.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/background.js /** - * External dependencies + * WordPress dependencies */ /** - * WordPress dependencies + * Internal dependencies */ -/** - * Internal dependencies - */ -k([names, a11y]); + + +const BACKGROUND_SUPPORT_KEY = 'background'; + +// Initial control values where no block style is set. +const BACKGROUND_DEFAULT_VALUES = { + backgroundSize: 'cover' +}; /** - * Provided an array of color objects as set by the theme or by the editor defaults, - * and the values of the defined color or custom color returns a color object describing the color. + * Determine whether there is block support for background. * - * @param {Array} colors Array of color objects as set by the theme or by the editor defaults. - * @param {?string} definedColor A string containing the color slug. - * @param {?string} customColor A string containing the customColor value. + * @param {string} blockName Block name. + * @param {string} feature Background image feature to check for. * - * @return {?Object} If definedColor is passed and the name is found in colors, - * the color object exactly as set by the theme or editor defaults is returned. - * Otherwise, an object that just sets the color is defined. + * @return {boolean} Whether there is support. */ -const getColorObjectByAttributeValues = (colors, definedColor, customColor) => { - if (definedColor) { - const colorObj = colors?.find(color => color.slug === definedColor); - if (colorObj) { - return colorObj; +function hasBackgroundSupport(blockName, feature = 'any') { + const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, BACKGROUND_SUPPORT_KEY); + if (support === true) { + return true; + } + if (feature === 'any') { + return !!support?.backgroundImage || !!support?.backgroundSize || !!support?.backgroundRepeat; + } + return !!support?.[feature]; +} +function setBackgroundStyleDefaults(backgroundStyle) { + if (!backgroundStyle) { + return; + } + const backgroundImage = backgroundStyle?.backgroundImage; + let backgroundStylesWithDefaults; + + // Set block background defaults. + if (!!backgroundImage?.url) { + if (!backgroundStyle?.backgroundSize) { + backgroundStylesWithDefaults = { + backgroundSize: 'cover' + }; } + if ('contain' === backgroundStyle?.backgroundSize && !backgroundStyle?.backgroundPosition) { + backgroundStylesWithDefaults = { + backgroundPosition: 'center' + }; + } + } + return backgroundStylesWithDefaults; +} +function background_useBlockProps({ + name, + style +}) { + if (!hasBackgroundSupport(name) || !style?.background?.backgroundImage) { + return; + } + const backgroundStyles = setBackgroundStyleDefaults(style?.background); + if (!backgroundStyles) { + return; } return { - color: customColor + style: { + ...backgroundStyles + } }; -}; +} /** - * Provided an array of color objects as set by the theme or by the editor defaults, and a color value returns the color object matching that value or undefined. + * Generates a CSS class name if an background image is set. * - * @param {Array} colors Array of color objects as set by the theme or by the editor defaults. - * @param {?string} colorValue A string containing the color value. + * @param {Object} style A block's style attribute. * - * @return {?Object} Color object included in the colors array whose color property equals colorValue. - * Returns undefined if no color object matches this requirement. + * @return {string} CSS class name. */ -const getColorObjectByColorValue = (colors, colorValue) => { - return colors?.find(color => color.color === colorValue); -}; +function getBackgroundImageClasses(style) { + return hasBackgroundImageValue(style) ? 'has-background' : ''; +} +function BackgroundInspectorControl({ + children +}) { + const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(attributes => { + return { + ...attributes, + style: { + ...attributes.style, + background: undefined + } + }; + }, []); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls, { + group: "background", + resetAllFilter: resetAllFilter, + children: children + }); +} +function BackgroundImagePanel({ + clientId, + name, + setAttributes, + settings +}) { + const style = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getBlockAttributes(clientId)?.style, [clientId]); + if (!useHasBackgroundPanel(settings) || !hasBackgroundSupport(name, 'backgroundImage')) { + return null; + } + const defaultControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [BACKGROUND_SUPPORT_KEY, '__experimentalDefaultControls']); + const onChange = newStyle => { + setAttributes({ + style: utils_cleanEmptyObject(newStyle) + }); + }; + const updatedSettings = { + ...settings, + background: { + ...settings.background, + backgroundSize: settings?.background?.backgroundSize && hasBackgroundSupport(name, 'backgroundSize') + } + }; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BackgroundPanel, { + as: BackgroundInspectorControl, + panelId: clientId, + defaultControls: defaultControls, + defaultValues: BACKGROUND_DEFAULT_VALUES, + settings: updatedSettings, + onChange: onChange, + value: style + }); +} +/* harmony default export */ const background = ({ + useBlockProps: background_useBlockProps, + attributeKeys: ['style'], + hasSupport: hasBackgroundSupport +}); +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/lock.js /** - * Returns a class based on the context a color is being used and its slug. - * - * @param {string} colorContextName Context/place where color is being used e.g: background, text etc... - * @param {string} colorSlug Slug of the color. - * - * @return {?string} String with the class corresponding to the color in the provided context. - * Returns undefined if either colorContextName or colorSlug are not provided. + * WordPress dependencies */ -function getColorClassName(colorContextName, colorSlug) { - if (!colorContextName || !colorSlug) { - return undefined; - } - const { - kebabCase - } = unlock(external_wp_components_namespaceObject.privateApis); - return `has-${kebabCase(colorSlug)}-${colorContextName}`; -} + /** - * Given an array of color objects and a color value returns the color value of the most readable color in the array. + * Filters registered block settings, extending attributes to include `lock`. * - * @param {Array} colors Array of color objects as set by the theme or by the editor defaults. - * @param {?string} colorValue A string containing the color value. + * @param {Object} settings Original block settings. * - * @return {string} String with the color value of the most readable color. + * @return {Object} Filtered block settings. */ -function getMostReadableColor(colors, colorValue) { - const colordColor = w(colorValue); - const getColorContrast = ({ - color - }) => colordColor.contrast(color); - const maxContrast = Math.max(...colors.map(getColorContrast)); - return colors.find(color => getColorContrast(color) === maxContrast).color; +function lock_addAttribute(settings) { + var _settings$attributes$; + // Allow blocks to specify their own attribute definition with default values if needed. + if ('type' in ((_settings$attributes$ = settings.attributes?.lock) !== null && _settings$attributes$ !== void 0 ? _settings$attributes$ : {})) { + return settings; + } + // Gracefully handle if settings.attributes is undefined. + settings.attributes = { + ...settings.attributes, + lock: { + type: 'object' + } + }; + return settings; } +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/lock/addAttribute', lock_addAttribute); -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/anchor.js /** * WordPress dependencies */ + + + /** * Internal dependencies */ + /** - * Retrieves color and gradient related settings. - * - * The arrays for colors and gradients are made up of color palettes from each - * origin i.e. "Core", "Theme", and "User". + * Regular expression matching invalid anchor characters for replacement. * - * @return {Object} Color and gradient related settings. + * @type {RegExp} */ -function useMultipleOriginColorsAndGradients() { - const [enableCustomColors, customColors, themeColors, defaultColors, shouldDisplayDefaultColors, enableCustomGradients, customGradients, themeGradients, defaultGradients, shouldDisplayDefaultGradients] = use_settings_useSettings('color.custom', 'color.palette.custom', 'color.palette.theme', 'color.palette.default', 'color.defaultPalette', 'color.customGradient', 'color.gradients.custom', 'color.gradients.theme', 'color.gradients.default', 'color.defaultGradients'); - const colorGradientSettings = { - disableCustomColors: !enableCustomColors, - disableCustomGradients: !enableCustomGradients - }; - colorGradientSettings.colors = (0,external_wp_element_namespaceObject.useMemo)(() => { - const result = []; - if (themeColors && themeColors.length) { - result.push({ - name: (0,external_wp_i18n_namespaceObject._x)('Theme', 'Indicates this palette comes from the theme.'), - colors: themeColors - }); - } - if (shouldDisplayDefaultColors && defaultColors && defaultColors.length) { - result.push({ - name: (0,external_wp_i18n_namespaceObject._x)('Default', 'Indicates this palette comes from WordPress.'), - colors: defaultColors - }); - } - if (customColors && customColors.length) { - result.push({ - name: (0,external_wp_i18n_namespaceObject._x)('Custom', 'Indicates this palette comes from the theme.'), - colors: customColors - }); - } - return result; - }, [customColors, themeColors, defaultColors, shouldDisplayDefaultColors]); - colorGradientSettings.gradients = (0,external_wp_element_namespaceObject.useMemo)(() => { - const result = []; - if (themeGradients && themeGradients.length) { - result.push({ - name: (0,external_wp_i18n_namespaceObject._x)('Theme', 'Indicates this palette comes from the theme.'), - gradients: themeGradients - }); - } - if (shouldDisplayDefaultGradients && defaultGradients && defaultGradients.length) { - result.push({ - name: (0,external_wp_i18n_namespaceObject._x)('Default', 'Indicates this palette comes from WordPress.'), - gradients: defaultGradients - }); - } - if (customGradients && customGradients.length) { - result.push({ - name: (0,external_wp_i18n_namespaceObject._x)('Custom', 'Indicates this palette is created by the user.'), - gradients: customGradients - }); - } - return result; - }, [customGradients, themeGradients, defaultGradients, shouldDisplayDefaultGradients]); - colorGradientSettings.hasColorsOrGradients = !!colorGradientSettings.colors.length || !!colorGradientSettings.gradients.length; - return colorGradientSettings; -} -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/utils.js -/** - * WordPress dependencies - */ -/** - * Gets the (non-undefined) item with the highest occurrence within an array - * Based in part on: https://stackoverflow.com/a/20762713 - * - * Undefined values are always sorted to the end by `sort`, so this function - * returns the first element, to always prioritize real values over undefined - * values. - * - * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#description - * - * @param {Array} inputArray Array of items to check. - * @return {any} The item with the most occurrences. - */ -function utils_mode(inputArray) { - const arr = [...inputArray]; - return arr.sort((a, b) => inputArray.filter(v => v === b).length - inputArray.filter(v => v === a).length).shift(); -} +const ANCHOR_REGEX = /[\s#]/g; +const ANCHOR_SCHEMA = { + type: 'string', + source: 'attribute', + attribute: 'id', + selector: '*' +}; /** - * Returns the most common CSS unit from the current CSS unit selections. + * Filters registered block settings, extending attributes with anchor using ID + * of the first node. * - * - If a single flat border radius is set, its unit will be used - * - If individual corner selections, the most common of those will be used - * - Failing any unit selections a default of 'px' is returned. + * @param {Object} settings Original block settings. * - * @param {Object} selectedUnits Unit selections for flat radius & each corner. - * @return {string} Most common CSS unit from current selections. Default: `px`. + * @return {Object} Filtered block settings. */ -function getAllUnit(selectedUnits = {}) { - const { - flat, - ...cornerUnits - } = selectedUnits; - return flat || utils_mode(Object.values(cornerUnits).filter(Boolean)) || 'px'; +function anchor_addAttribute(settings) { + var _settings$attributes$; + // Allow blocks to specify their own attribute definition with default values if needed. + if ('type' in ((_settings$attributes$ = settings.attributes?.anchor) !== null && _settings$attributes$ !== void 0 ? _settings$attributes$ : {})) { + return settings; + } + if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, 'anchor')) { + // Gracefully handle if settings.attributes is undefined. + settings.attributes = { + ...settings.attributes, + anchor: ANCHOR_SCHEMA + }; + } + return settings; } - -/** - * Gets the 'all' input value and unit from values data. - * - * @param {Object|string} values Radius values. - * @return {string} A value + unit for the 'all' input. - */ -function getAllValue(values = {}) { - /** - * Border radius support was originally a single pixel value. - * - * To maintain backwards compatibility treat this case as the all value. - */ - if (typeof values === 'string') { - return values; +function BlockEditAnchorControlPure({ + anchor, + setAttributes +}) { + const blockEditingMode = useBlockEditingMode(); + if (blockEditingMode !== 'default') { + return null; } - const parsedQuantitiesAndUnits = Object.values(values).map(value => (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value)); - const allValues = parsedQuantitiesAndUnits.map(value => { - var _value$; - return (_value$ = value[0]) !== null && _value$ !== void 0 ? _value$ : ''; + const isWeb = external_wp_element_namespaceObject.Platform.OS === 'web'; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls, { + group: "advanced", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { + __nextHasNoMarginBottom: true, + __next40pxDefaultSize: true, + className: "html-anchor-control", + label: (0,external_wp_i18n_namespaceObject.__)('HTML anchor'), + help: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [(0,external_wp_i18n_namespaceObject.__)('Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor”. Then, you’ll be able to link directly to this section of your page.'), isWeb && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [' ', /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { + href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/page-jumps/'), + children: (0,external_wp_i18n_namespaceObject.__)('Learn more about anchors') + })] + })] + }), + value: anchor || '', + placeholder: !isWeb ? (0,external_wp_i18n_namespaceObject.__)('Add an anchor') : null, + onChange: nextValue => { + nextValue = nextValue.replace(ANCHOR_REGEX, '-'); + setAttributes({ + anchor: nextValue + }); + }, + autoCapitalize: "none", + autoComplete: "off" + }) }); - const allUnits = parsedQuantitiesAndUnits.map(value => value[1]); - const value = allValues.every(v => v === allValues[0]) ? allValues[0] : ''; - const unit = utils_mode(allUnits); - const allValue = value === 0 || value ? `${value}${unit}` : undefined; - return allValue; } +/* harmony default export */ const hooks_anchor = ({ + addSaveProps, + edit: BlockEditAnchorControlPure, + attributeKeys: ['anchor'], + hasSupport(name) { + return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, 'anchor'); + } +}); /** - * Checks to determine if values are mixed. + * Override props assigned to save component to inject anchor ID, if block + * supports anchor. This is only applied if the block's save result is an + * element and not a markup string. * - * @param {Object} values Radius values. - * @return {boolean} Whether values are mixed. - */ -function hasMixedValues(values = {}) { - const allValue = getAllValue(values); - const isMixed = typeof values === 'string' ? false : isNaN(parseFloat(allValue)); - return isMixed; -} - -/** - * Checks to determine if values are defined. + * @param {Object} extraProps Additional props applied to save element. + * @param {Object} blockType Block type. + * @param {Object} attributes Current block attributes. * - * @param {Object} values Radius values. - * @return {boolean} Whether values are mixed. + * @return {Object} Filtered props applied to save element. */ -function hasDefinedValues(values) { - if (!values) { - return false; - } - - // A string value represents a shorthand value. - if (typeof values === 'string') { - return true; +function addSaveProps(extraProps, blockType, attributes) { + if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'anchor')) { + extraProps.id = attributes.anchor === '' ? null : attributes.anchor; } - - // An object represents longhand border radius values, if any are set - // flag values as being defined. - const filteredValues = Object.values(values).filter(value => { - return !!value || value === 0; - }); - return !!filteredValues.length; + return extraProps; } +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/anchor/attribute', anchor_addAttribute); -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/all-input-control.js - +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/aria-label.js /** * WordPress dependencies */ - -/** +const ARIA_LABEL_SCHEMA = { + type: 'string', + source: 'attribute', + attribute: 'aria-label', + selector: '*' +}; + +/** + * Filters registered block settings, extending attributes with ariaLabel using aria-label + * of the first node. + * + * @param {Object} settings Original block settings. + * + * @return {Object} Filtered block settings. + */ +function aria_label_addAttribute(settings) { + // Allow blocks to specify their own attribute definition with default values if needed. + if (settings?.attributes?.ariaLabel?.type) { + return settings; + } + if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, 'ariaLabel')) { + // Gracefully handle if settings.attributes is undefined. + settings.attributes = { + ...settings.attributes, + ariaLabel: ARIA_LABEL_SCHEMA + }; + } + return settings; +} + +/** + * Override props assigned to save component to inject aria-label, if block + * supports ariaLabel. This is only applied if the block's save result is an + * element and not a markup string. + * + * @param {Object} extraProps Additional props applied to save element. + * @param {Object} blockType Block type. + * @param {Object} attributes Current block attributes. + * + * @return {Object} Filtered props applied to save element. + */ +function aria_label_addSaveProps(extraProps, blockType, attributes) { + if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'ariaLabel')) { + extraProps['aria-label'] = attributes.ariaLabel === '' ? null : attributes.ariaLabel; + } + return extraProps; +} +/* harmony default export */ const aria_label = ({ + addSaveProps: aria_label_addSaveProps, + attributeKeys: ['ariaLabel'], + hasSupport(name) { + return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, 'ariaLabel'); + } +}); +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/ariaLabel/attribute', aria_label_addAttribute); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/custom-class-name.js +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + + +/** + * Internal dependencies + */ + + + +/** + * Filters registered block settings, extending attributes to include `className`. + * + * @param {Object} settings Original block settings. + * + * @return {Object} Filtered block settings. + */ + +function custom_class_name_addAttribute(settings) { + if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, 'customClassName', true)) { + // Gracefully handle if settings.attributes is undefined. + settings.attributes = { + ...settings.attributes, + className: { + type: 'string' + } + }; + } + return settings; +} +function CustomClassNameControlsPure({ + className, + setAttributes +}) { + const blockEditingMode = useBlockEditingMode(); + if (blockEditingMode !== 'default') { + return null; + } + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls, { + group: "advanced", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { + __nextHasNoMarginBottom: true, + __next40pxDefaultSize: true, + autoComplete: "off", + label: (0,external_wp_i18n_namespaceObject.__)('Additional CSS class(es)'), + value: className || '', + onChange: nextValue => { + setAttributes({ + className: nextValue !== '' ? nextValue : undefined + }); + }, + help: (0,external_wp_i18n_namespaceObject.__)('Separate multiple classes with spaces.') + }) + }); +} +/* harmony default export */ const custom_class_name = ({ + edit: CustomClassNameControlsPure, + addSaveProps: custom_class_name_addSaveProps, + attributeKeys: ['className'], + hasSupport(name) { + return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, 'customClassName', true); + } +}); + +/** + * Override props assigned to save component to inject the className, if block + * supports customClassName. This is only applied if the block's save result is an + * element and not a markup string. + * + * @param {Object} extraProps Additional props applied to save element. + * @param {Object} blockType Block type. + * @param {Object} attributes Current block attributes. + * + * @return {Object} Filtered props applied to save element. + */ +function custom_class_name_addSaveProps(extraProps, blockType, attributes) { + if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'customClassName', true) && attributes.className) { + extraProps.className = dist_clsx(extraProps.className, attributes.className); + } + return extraProps; +} +function addTransforms(result, source, index, results) { + if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(result.name, 'customClassName', true)) { + return result; + } + + // If the condition verifies we are probably in the presence of a wrapping transform + // e.g: nesting paragraphs in a group or columns and in that case the class should not be kept. + if (results.length === 1 && result.innerBlocks.length === source.length) { + return result; + } + + // If we are transforming one block to multiple blocks or multiple blocks to one block, + // we ignore the class during the transform. + if (results.length === 1 && source.length > 1 || results.length > 1 && source.length === 1) { + return result; + } + + // If we are in presence of transform between one or more block in the source + // that have one or more blocks in the result + // we apply the class on source N to the result N, + // if source N does not exists we do nothing. + if (source[index]) { + const originClassName = source[index]?.attributes.className; + if (originClassName) { + return { + ...result, + attributes: { + ...result.attributes, + className: originClassName + } + }; + } + } + return result; +} +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/editor/custom-class-name/attribute', custom_class_name_addAttribute); +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.switchToBlockType.transformedBlock', 'core/color/addTransforms', addTransforms); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/generated-class-name.js +/** + * WordPress dependencies + */ + + + +/** + * Override props assigned to save component to inject generated className if + * block supports it. This is only applied if the block's save result is an + * element and not a markup string. + * + * @param {Object} extraProps Additional props applied to save element. + * @param {Object} blockType Block type. + * + * @return {Object} Filtered props applied to save element. + */ +function addGeneratedClassName(extraProps, blockType) { + // Adding the generated className. + if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'className', true)) { + if (typeof extraProps.className === 'string') { + // We have some extra classes and want to add the default classname + // We use uniq to prevent duplicate classnames. + + extraProps.className = [...new Set([(0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(blockType.name), ...extraProps.className.split(' ')])].join(' ').trim(); + } else { + // There is no string in the className variable, + // so we just dump the default name in there. + extraProps.className = (0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(blockType.name); + } + } + return extraProps; +} +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.getSaveContent.extraProps', 'core/generated-class-name/save-props', addGeneratedClassName); + +;// CONCATENATED MODULE: ./node_modules/colord/index.mjs +var colord_r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n+0},e=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},u=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},a=function(r){return{r:e(r.r,0,255),g:e(r.g,0,255),b:e(r.b,0,255),a:e(r.a)}},o=function(r){return{r:n(r.r),g:n(r.g),b:n(r.b),a:n(r.a,3)}},i=/^#([0-9a-f]{3,8})$/i,s=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},h=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,a=Math.max(t,n,e),o=a-Math.min(t,n,e),i=o?a===t?(n-e)/o:a===n?2+(e-t)/o:4+(t-n)/o:0;return{h:60*(i<0?i+6:i),s:a?o/a*100:0,v:a/255*100,a:u}},b=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var a=Math.floor(t),o=e*(1-n),i=e*(1-(t-a)*n),s=e*(1-(1-t+a)*n),h=a%6;return{r:255*[e,i,o,o,s,e][h],g:255*[s,e,e,i,o,o][h],b:255*[o,o,s,e,e,i][h],a:u}},g=function(r){return{h:u(r.h),s:e(r.s,0,100),l:e(r.l,0,100),a:e(r.a)}},d=function(r){return{h:n(r.h),s:n(r.s),l:n(r.l),a:n(r.a,3)}},f=function(r){return b((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e},c=function(r){return{h:(t=h(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u},l=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,p=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,m=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,y={string:[[function(r){var t=i.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:4===r.length?n(parseInt(r[3]+r[3],16)/255,2):1}:6===r.length||8===r.length?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:8===r.length?n(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=v.exec(r)||m.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:a({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(t){var n=l.exec(t)||p.exec(t);if(!n)return null;var e,u,a=g({h:(e=n[1],u=n[2],void 0===u&&(u="deg"),Number(e)*(colord_r[u]||1)),s:Number(n[3]),l:Number(n[4]),a:void 0===n[5]?1:Number(n[5])/(n[6]?100:1)});return f(a)},"hsl"]],object:[[function(r){var n=r.r,e=r.g,u=r.b,o=r.a,i=void 0===o?1:o;return t(n)&&t(e)&&t(u)?a({r:Number(n),g:Number(e),b:Number(u),a:Number(i)}):null},"rgb"],[function(r){var n=r.h,e=r.s,u=r.l,a=r.a,o=void 0===a?1:a;if(!t(n)||!t(e)||!t(u))return null;var i=g({h:Number(n),s:Number(e),l:Number(u),a:Number(o)});return f(i)},"hsl"],[function(r){var n=r.h,a=r.s,o=r.v,i=r.a,s=void 0===i?1:i;if(!t(n)||!t(a)||!t(o))return null;var h=function(r){return{h:u(r.h),s:e(r.s,0,100),v:e(r.v,0,100),a:e(r.a)}}({h:Number(n),s:Number(a),v:Number(o),a:Number(s)});return b(h)},"hsv"]]},N=function(r,t){for(var n=0;n=.5},r.prototype.toHex=function(){return r=o(this.rgba),t=r.r,e=r.g,u=r.b,i=(a=r.a)<1?s(n(255*a)):"","#"+s(t)+s(e)+s(u)+i;var r,t,e,u,a,i},r.prototype.toRgb=function(){return o(this.rgba)},r.prototype.toRgbString=function(){return r=o(this.rgba),t=r.r,n=r.g,e=r.b,(u=r.a)<1?"rgba("+t+", "+n+", "+e+", "+u+")":"rgb("+t+", "+n+", "+e+")";var r,t,n,e,u},r.prototype.toHsl=function(){return d(c(this.rgba))},r.prototype.toHslString=function(){return r=d(c(this.rgba)),t=r.h,n=r.s,e=r.l,(u=r.a)<1?"hsla("+t+", "+n+"%, "+e+"%, "+u+")":"hsl("+t+", "+n+"%, "+e+"%)";var r,t,n,e,u},r.prototype.toHsv=function(){return r=h(this.rgba),{h:n(r.h),s:n(r.s),v:n(r.v),a:n(r.a,3)};var r},r.prototype.invert=function(){return w({r:255-(r=this.rgba).r,g:255-r.g,b:255-r.b,a:r.a});var r},r.prototype.saturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,-r))},r.prototype.grayscale=function(){return w(M(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),w($(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),w($(this.rgba,-r))},r.prototype.rotate=function(r){return void 0===r&&(r=15),this.hue(this.hue()+r)},r.prototype.alpha=function(r){return"number"==typeof r?w({r:(t=this.rgba).r,g:t.g,b:t.b,a:r}):n(this.rgba.a,3);var t},r.prototype.hue=function(r){var t=c(this.rgba);return"number"==typeof r?w({h:r,s:t.s,l:t.l,a:t.a}):n(t.h)},r.prototype.isEqual=function(r){return this.toHex()===w(r).toHex()},r}(),w=function(r){return r instanceof colord_j?r:new colord_j(r)},S=[],k=function(r){r.forEach(function(r){S.indexOf(r)<0&&(r(colord_j,y),S.push(r))})},E=function(){return new colord_j({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})}; + +;// CONCATENATED MODULE: ./node_modules/colord/plugins/names.mjs +/* harmony default export */ function names(e,f){var a={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var d in a)r[a[d]]=d;var l={};e.prototype.toName=function(f){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var d,i,n=r[this.toHex()];if(n)return n;if(null==f?void 0:f.closest){var o=this.toRgb(),t=1/0,b="black";if(!l.length)for(var c in a)l[c]=new e(a[c]).toRgb();for(var g in a){var u=(d=o,i=l[g],Math.pow(d.r-i.r,2)+Math.pow(d.g-i.g,2)+Math.pow(d.b-i.b,2));ud?(u+.05)/(d+.05):(d+.05)/(u+.05),void 0===(a=2)&&(a=0),void 0===i&&(i=Math.pow(10,a)),Math.floor(i*n)/i+0},o.prototype.isReadable=function(o,t){return void 0===o&&(o="#FFF"),void 0===t&&(t={}),this.contrast(o)>=(e=void 0===(i=(r=t).size)?"normal":i,"AAA"===(a=void 0===(n=r.level)?"AA":n)&&"normal"===e?7:"AA"===a&&"large"===e?3:4.5);var r,n,a,i,e}} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors/utils.js +/** + * External dependencies + */ + + + + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + +k([names, a11y]); +const { + kebabCase +} = unlock(external_wp_components_namespaceObject.privateApis); + +/** + * Provided an array of color objects as set by the theme or by the editor defaults, + * and the values of the defined color or custom color returns a color object describing the color. + * + * @param {Array} colors Array of color objects as set by the theme or by the editor defaults. + * @param {?string} definedColor A string containing the color slug. + * @param {?string} customColor A string containing the customColor value. + * + * @return {?Object} If definedColor is passed and the name is found in colors, + * the color object exactly as set by the theme or editor defaults is returned. + * Otherwise, an object that just sets the color is defined. + */ +const getColorObjectByAttributeValues = (colors, definedColor, customColor) => { + if (definedColor) { + const colorObj = colors?.find(color => color.slug === definedColor); + if (colorObj) { + return colorObj; + } + } + return { + color: customColor + }; +}; + +/** + * Provided an array of color objects as set by the theme or by the editor defaults, and a color value returns the color object matching that value or undefined. + * + * @param {Array} colors Array of color objects as set by the theme or by the editor defaults. + * @param {?string} colorValue A string containing the color value. + * + * @return {?Object} Color object included in the colors array whose color property equals colorValue. + * Returns undefined if no color object matches this requirement. + */ +const getColorObjectByColorValue = (colors, colorValue) => { + return colors?.find(color => color.color === colorValue); +}; + +/** + * Returns a class based on the context a color is being used and its slug. + * + * @param {string} colorContextName Context/place where color is being used e.g: background, text etc... + * @param {string} colorSlug Slug of the color. + * + * @return {?string} String with the class corresponding to the color in the provided context. + * Returns undefined if either colorContextName or colorSlug are not provided. + */ +function getColorClassName(colorContextName, colorSlug) { + if (!colorContextName || !colorSlug) { + return undefined; + } + return `has-${kebabCase(colorSlug)}-${colorContextName}`; +} + +/** + * Given an array of color objects and a color value returns the color value of the most readable color in the array. + * + * @param {Array} colors Array of color objects as set by the theme or by the editor defaults. + * @param {?string} colorValue A string containing the color value. + * + * @return {string} String with the color value of the most readable color. + */ +function getMostReadableColor(colors, colorValue) { + const colordColor = w(colorValue); + const getColorContrast = ({ + color + }) => colordColor.contrast(color); + const maxContrast = Math.max(...colors.map(getColorContrast)); + return colors.find(color => getColorContrast(color) === maxContrast).color; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + +/** + * Retrieves color and gradient related settings. + * + * The arrays for colors and gradients are made up of color palettes from each + * origin i.e. "Core", "Theme", and "User". + * + * @return {Object} Color and gradient related settings. + */ +function useMultipleOriginColorsAndGradients() { + const [enableCustomColors, customColors, themeColors, defaultColors, shouldDisplayDefaultColors, enableCustomGradients, customGradients, themeGradients, defaultGradients, shouldDisplayDefaultGradients] = use_settings_useSettings('color.custom', 'color.palette.custom', 'color.palette.theme', 'color.palette.default', 'color.defaultPalette', 'color.customGradient', 'color.gradients.custom', 'color.gradients.theme', 'color.gradients.default', 'color.defaultGradients'); + const colorGradientSettings = { + disableCustomColors: !enableCustomColors, + disableCustomGradients: !enableCustomGradients + }; + colorGradientSettings.colors = (0,external_wp_element_namespaceObject.useMemo)(() => { + const result = []; + if (themeColors && themeColors.length) { + result.push({ + name: (0,external_wp_i18n_namespaceObject._x)('Theme', 'Indicates this palette comes from the theme.'), + colors: themeColors + }); + } + if (shouldDisplayDefaultColors && defaultColors && defaultColors.length) { + result.push({ + name: (0,external_wp_i18n_namespaceObject._x)('Default', 'Indicates this palette comes from WordPress.'), + colors: defaultColors + }); + } + if (customColors && customColors.length) { + result.push({ + name: (0,external_wp_i18n_namespaceObject._x)('Custom', 'Indicates this palette comes from the theme.'), + colors: customColors + }); + } + return result; + }, [customColors, themeColors, defaultColors, shouldDisplayDefaultColors]); + colorGradientSettings.gradients = (0,external_wp_element_namespaceObject.useMemo)(() => { + const result = []; + if (themeGradients && themeGradients.length) { + result.push({ + name: (0,external_wp_i18n_namespaceObject._x)('Theme', 'Indicates this palette comes from the theme.'), + gradients: themeGradients + }); + } + if (shouldDisplayDefaultGradients && defaultGradients && defaultGradients.length) { + result.push({ + name: (0,external_wp_i18n_namespaceObject._x)('Default', 'Indicates this palette comes from WordPress.'), + gradients: defaultGradients + }); + } + if (customGradients && customGradients.length) { + result.push({ + name: (0,external_wp_i18n_namespaceObject._x)('Custom', 'Indicates this palette is created by the user.'), + gradients: customGradients + }); + } + return result; + }, [customGradients, themeGradients, defaultGradients, shouldDisplayDefaultGradients]); + colorGradientSettings.hasColorsOrGradients = !!colorGradientSettings.colors.length || !!colorGradientSettings.gradients.length; + return colorGradientSettings; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/utils.js +/** + * WordPress dependencies + */ + + +/** + * Gets the (non-undefined) item with the highest occurrence within an array + * Based in part on: https://stackoverflow.com/a/20762713 + * + * Undefined values are always sorted to the end by `sort`, so this function + * returns the first element, to always prioritize real values over undefined + * values. + * + * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#description + * + * @param {Array} inputArray Array of items to check. + * @return {any} The item with the most occurrences. + */ +function utils_mode(inputArray) { + const arr = [...inputArray]; + return arr.sort((a, b) => inputArray.filter(v => v === b).length - inputArray.filter(v => v === a).length).shift(); +} + +/** + * Returns the most common CSS unit from the current CSS unit selections. + * + * - If a single flat border radius is set, its unit will be used + * - If individual corner selections, the most common of those will be used + * - Failing any unit selections a default of 'px' is returned. + * + * @param {Object} selectedUnits Unit selections for flat radius & each corner. + * @return {string} Most common CSS unit from current selections. Default: `px`. + */ +function getAllUnit(selectedUnits = {}) { + const { + flat, + ...cornerUnits + } = selectedUnits; + return flat || utils_mode(Object.values(cornerUnits).filter(Boolean)) || 'px'; +} + +/** + * Gets the 'all' input value and unit from values data. + * + * @param {Object|string} values Radius values. + * @return {string} A value + unit for the 'all' input. + */ +function getAllValue(values = {}) { + /** + * Border radius support was originally a single pixel value. + * + * To maintain backwards compatibility treat this case as the all value. + */ + if (typeof values === 'string') { + return values; + } + const parsedQuantitiesAndUnits = Object.values(values).map(value => (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value)); + const allValues = parsedQuantitiesAndUnits.map(value => { + var _value$; + return (_value$ = value[0]) !== null && _value$ !== void 0 ? _value$ : ''; + }); + const allUnits = parsedQuantitiesAndUnits.map(value => value[1]); + const value = allValues.every(v => v === allValues[0]) ? allValues[0] : ''; + const unit = utils_mode(allUnits); + const allValue = value === 0 || value ? `${value}${unit}` : undefined; + return allValue; +} + +/** + * Checks to determine if values are mixed. + * + * @param {Object} values Radius values. + * @return {boolean} Whether values are mixed. + */ +function hasMixedValues(values = {}) { + const allValue = getAllValue(values); + const isMixed = typeof values === 'string' ? false : isNaN(parseFloat(allValue)); + return isMixed; +} + +/** + * Checks to determine if values are defined. + * + * @param {Object} values Radius values. + * @return {boolean} Whether values are mixed. + */ +function hasDefinedValues(values) { + if (!values) { + return false; + } + + // A string value represents a shorthand value. + if (typeof values === 'string') { + return true; + } + + // An object represents longhand border radius values, if any are set + // flag values as being defined. + const filteredValues = Object.values(values).filter(value => { + return !!value || value === 0; + }); + return !!filteredValues.length; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/all-input-control.js +/** + * WordPress dependencies + */ + + + +/** * Internal dependencies */ + function AllInputControl({ onChange, selectedUnits, @@ -24881,7 +25490,7 @@ function AllInputControl({ bottomRight: unit }); }; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { ...props, "aria-label": (0,external_wp_i18n_namespaceObject.__)('Border radius'), disableUnits: isMixed, @@ -24890,17 +25499,17 @@ function AllInputControl({ onChange: handleOnChange, onUnitChange: handleOnUnitChange, placeholder: allPlaceholder, - size: '__unstable-large' + size: "__unstable-large" }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/input-controls.js - /** * WordPress dependencies */ + const CORNERS = { topLeft: (0,external_wp_i18n_namespaceObject.__)('Top left'), topRight: (0,external_wp_i18n_namespaceObject.__)('Top right'), @@ -24946,69 +25555,72 @@ function BoxInputControls({ // Controls are wrapped in tooltips as visible labels aren't desired here. // Tooltip rendering also requires the UnitControl to be wrapped. See: // https://github.com/WordPress/gutenberg/pull/24966#issuecomment-685875026 - return (0,external_React_.createElement)("div", { - className: "components-border-radius-control__input-controls-wrapper" - }, Object.entries(CORNERS).map(([corner, label]) => { - const [parsedQuantity, parsedUnit] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(values[corner]); - const computedUnit = values[corner] ? parsedUnit : selectedUnits[corner] || selectedUnits.flat; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Tooltip, { - text: label, - placement: "top", - key: corner - }, (0,external_React_.createElement)("div", { - className: "components-border-radius-control__tooltip-wrapper" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, { - ...props, - "aria-label": label, - value: [parsedQuantity, computedUnit].join(''), - onChange: createHandleOnChange(corner), - onUnitChange: createHandleOnUnitChange(corner), - size: '__unstable-large' - }))); - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "components-border-radius-control__input-controls-wrapper", + children: Object.entries(CORNERS).map(([corner, label]) => { + const [parsedQuantity, parsedUnit] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(values[corner]); + const computedUnit = values[corner] ? parsedUnit : selectedUnits[corner] || selectedUnits.flat; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { + text: label, + placement: "top", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "components-border-radius-control__tooltip-wrapper", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { + ...props, + "aria-label": label, + value: [parsedQuantity, computedUnit].join(''), + onChange: createHandleOnChange(corner), + onUnitChange: createHandleOnUnitChange(corner), + size: "__unstable-large" + }) + }) + }, corner); + }) + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/link.js - /** * WordPress dependencies */ -const link_link = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const link_link = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z" + }) +}); /* harmony default export */ const library_link = (link_link); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/linked-button.js - /** * WordPress dependencies */ + function LinkedButton({ isLinked, ...props }) { const label = isLinked ? (0,external_wp_i18n_namespaceObject.__)('Unlink radii') : (0,external_wp_i18n_namespaceObject.__)('Link radii'); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Tooltip, { - text: label - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - ...props, - className: "component-border-radius-control__linked-button", - size: "small", - icon: isLinked ? library_link : link_off, - iconSize: 24, - "aria-label": label - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { + text: label, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + ...props, + className: "component-border-radius-control__linked-button", + size: "small", + icon: isLinked ? library_link : link_off, + iconSize: 24, + "aria-label": label + }) + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/index.js - /** * WordPress dependencies */ @@ -25024,6 +25636,9 @@ function LinkedButton({ + + + const border_radius_control_DEFAULT_VALUES = { topLeft: undefined, topRight: undefined, @@ -25074,75 +25689,81 @@ function BorderRadiusControl({ const handleSliderChange = next => { onChange(next !== undefined ? `${next}${unit}` : undefined); }; - return (0,external_React_.createElement)("fieldset", { - className: "components-border-radius-control" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { - as: "legend" - }, (0,external_wp_i18n_namespaceObject.__)('Radius')), (0,external_React_.createElement)("div", { - className: "components-border-radius-control__wrapper" - }, isLinked ? (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(AllInputControl, { - className: "components-border-radius-control__unit-control", - values: values, - min: MIN_BORDER_RADIUS_VALUE, - onChange: onChange, - selectedUnits: selectedUnits, - setSelectedUnits: setSelectedUnits, - units: units - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.RangeControl, { - label: (0,external_wp_i18n_namespaceObject.__)('Border radius'), - hideLabelFromVision: true, - className: "components-border-radius-control__range-control", - value: allValue !== null && allValue !== void 0 ? allValue : '', - min: MIN_BORDER_RADIUS_VALUE, - max: MAX_BORDER_RADIUS_VALUES[unit], - initialPosition: 0, - withInputField: false, - onChange: handleSliderChange, - step: step, - __nextHasNoMarginBottom: true - })) : (0,external_React_.createElement)(BoxInputControls, { - min: MIN_BORDER_RADIUS_VALUE, - onChange: onChange, - selectedUnits: selectedUnits, - setSelectedUnits: setSelectedUnits, - values: values || border_radius_control_DEFAULT_VALUES, - units: units - }), (0,external_React_.createElement)(LinkedButton, { - onClick: toggleLinked, - isLinked: isLinked - }))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { + className: "components-border-radius-control", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { + as: "legend", + children: (0,external_wp_i18n_namespaceObject.__)('Radius') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "components-border-radius-control__wrapper", + children: [isLinked ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AllInputControl, { + className: "components-border-radius-control__unit-control", + values: values, + min: MIN_BORDER_RADIUS_VALUE, + onChange: onChange, + selectedUnits: selectedUnits, + setSelectedUnits: setSelectedUnits, + units: units + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Border radius'), + hideLabelFromVision: true, + className: "components-border-radius-control__range-control", + value: allValue !== null && allValue !== void 0 ? allValue : '', + min: MIN_BORDER_RADIUS_VALUE, + max: MAX_BORDER_RADIUS_VALUES[unit], + initialPosition: 0, + withInputField: false, + onChange: handleSliderChange, + step: step, + __nextHasNoMarginBottom: true + })] + }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BoxInputControls, { + min: MIN_BORDER_RADIUS_VALUE, + onChange: onChange, + selectedUnits: selectedUnits, + setSelectedUnits: setSelectedUnits, + values: values || border_radius_control_DEFAULT_VALUES, + units: units + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkedButton, { + onClick: toggleLinked, + isLinked: isLinked + })] + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js - /** * WordPress dependencies */ -const check_check = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const check_check = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z" + }) +}); /* harmony default export */ const library_check = (check_check); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/shadow.js - /** * WordPress dependencies */ -const shadow = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const shadow = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M12 8c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm0 6.5c-1.4 0-2.5-1.1-2.5-2.5s1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5-1.1 2.5-2.5 2.5zM12.8 3h-1.5v3h1.5V3zm-1.6 18h1.5v-3h-1.5v3zm6.8-9.8v1.5h3v-1.5h-3zm-12 0H3v1.5h3v-1.5zm9.7 5.6 2.1 2.1 1.1-1.1-2.1-2.1-1.1 1.1zM8.3 7.2 6.2 5.1 5.1 6.2l2.1 2.1 1.1-1.1zM5.1 17.8l1.1 1.1 2.1-2.1-1.1-1.1-2.1 2.1zM18.9 6.2l-1.1-1.1-2.1 2.1 1.1 1.1 2.1-2.1z" -})); + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M12 8c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm0 6.5c-1.4 0-2.5-1.1-2.5-2.5s1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5-1.1 2.5-2.5 2.5zM12.8 3h-1.5v3h1.5V3zm-1.6 18h1.5v-3h-1.5v3zm6.8-9.8v1.5h3v-1.5h-3zm-12 0H3v1.5h3v-1.5zm9.7 5.6 2.1 2.1 1.1-1.1-2.1-2.1-1.1 1.1zM8.3 7.2 6.2 5.1 5.1 6.2l2.1 2.1 1.1-1.1zM5.1 17.8l1.1 1.1 2.1-2.1-1.1-1.1-2.1 2.1zM18.9 6.2l-1.1-1.1-2.1 2.1 1.1 1.1 2.1-2.1z" + }) +}); /* harmony default export */ const library_shadow = (shadow); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/shadow-panel-components.js - /** * WordPress dependencies */ @@ -25167,57 +25788,65 @@ const shadow = (0,external_React_.createElement)(external_wp_primitives_namespac * * @type {Array} */ + + const shadow_panel_components_EMPTY_ARRAY = []; +const { + CompositeItemV2: CompositeItem, + CompositeV2: Composite, + useCompositeStoreV2: useCompositeStore +} = unlock(external_wp_components_namespaceObject.privateApis); function ShadowPopoverContainer({ shadow, onShadowChange, settings }) { const shadows = useShadowPresets(settings); - return (0,external_React_.createElement)("div", { - className: "block-editor-global-styles__shadow-popover-container" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { - spacing: 4 - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHeading, { - level: 5 - }, (0,external_wp_i18n_namespaceObject.__)('Drop shadow')), (0,external_React_.createElement)(ShadowPresets, { - presets: shadows, - activeShadow: shadow, - onSelect: onShadowChange - }), (0,external_React_.createElement)("div", { - className: "block-editor-global-styles__clear-shadow" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - variant: "tertiary", - onClick: () => onShadowChange(undefined) - }, (0,external_wp_i18n_namespaceObject.__)('Clear'))))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-global-styles__shadow-popover-container", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { + spacing: 4, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { + level: 5, + children: (0,external_wp_i18n_namespaceObject.__)('Drop shadow') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowPresets, { + presets: shadows, + activeShadow: shadow, + onSelect: onShadowChange + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-global-styles__clear-shadow", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + variant: "tertiary", + onClick: () => onShadowChange(undefined), + children: (0,external_wp_i18n_namespaceObject.__)('Clear') + }) + })] + }) + }); } function ShadowPresets({ presets, activeShadow, onSelect }) { - const { - CompositeV2: Composite, - useCompositeStoreV2: useCompositeStore - } = unlock(external_wp_components_namespaceObject.privateApis); const compositeStore = useCompositeStore(); - return !presets ? null : (0,external_React_.createElement)(Composite, { + return !presets ? null : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Composite, { store: compositeStore, role: "listbox", className: "block-editor-global-styles__shadow__list", - "aria-label": (0,external_wp_i18n_namespaceObject.__)('Drop shadows') - }, presets.map(({ - name, - slug, - shadow - }) => (0,external_React_.createElement)(ShadowIndicator, { - key: slug, - label: name, - isActive: shadow === activeShadow, - type: slug === 'unset' ? 'unset' : 'preset', - onSelect: () => onSelect(shadow === activeShadow ? undefined : shadow), - shadow: shadow - }))); + "aria-label": (0,external_wp_i18n_namespaceObject.__)('Drop shadows'), + children: presets.map(({ + name, + slug, + shadow + }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowIndicator, { + label: name, + isActive: shadow === activeShadow, + type: slug === 'unset' ? 'unset' : 'preset', + onSelect: () => onSelect(shadow === activeShadow ? undefined : shadow), + shadow: shadow + }, slug)) + }); } function ShadowIndicator({ type, @@ -25226,18 +25855,15 @@ function ShadowIndicator({ onSelect, shadow }) { - const { - CompositeItemV2: CompositeItem - } = unlock(external_wp_components_namespaceObject.privateApis); - return (0,external_React_.createElement)(CompositeItem, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CompositeItem, { role: "option", "aria-label": label, "aria-selected": isActive, - className: classnames_default()('block-editor-global-styles__shadow__item', { + className: dist_clsx('block-editor-global-styles__shadow__item', { 'is-active': isActive }), - render: (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - className: classnames_default()('block-editor-global-styles__shadow-indicator', { + render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + className: dist_clsx('block-editor-global-styles__shadow-indicator', { unset: type === 'unset' }), onClick: onSelect, @@ -25245,10 +25871,11 @@ function ShadowIndicator({ style: { boxShadow: shadow }, - showTooltip: true - }, isActive && (0,external_React_.createElement)(build_module_icon, { - icon: library_check - })) + showTooltip: true, + children: isActive && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { + icon: library_check + }) + }) }); } function ShadowPopover({ @@ -25261,17 +25888,18 @@ function ShadowPopover({ offset: 36, shift: true }; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Dropdown, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: popoverProps, className: "block-editor-global-styles__shadow-dropdown", renderToggle: renderShadowToggle(), - renderContent: () => (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { - paddingSize: "medium" - }, (0,external_React_.createElement)(ShadowPopoverContainer, { - shadow: shadow, - onShadowChange: onShadowChange, - settings: settings - })) + renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { + paddingSize: "medium", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowPopoverContainer, { + shadow: shadow, + onShadowChange: onShadowChange, + settings: settings + }) + }) }); } function renderShadowToggle() { @@ -25281,20 +25909,24 @@ function renderShadowToggle() { }) => { const toggleProps = { onClick: onToggle, - className: classnames_default()({ + className: dist_clsx({ 'is-open': isOpen }), 'aria-expanded': isOpen }; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - ...toggleProps - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { - justify: "flex-start" - }, (0,external_React_.createElement)(build_module_icon, { - className: "block-editor-global-styles__toggle-icon", - icon: library_shadow, - size: 24 - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_i18n_namespaceObject.__)('Drop shadow')))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + ...toggleProps, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { + justify: "flex-start", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { + className: "block-editor-global-styles__toggle-icon", + icon: library_shadow, + size: 24 + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { + children: (0,external_wp_i18n_namespaceObject.__)('Drop shadow') + })] + }) + }); }; } function useShadowPresets(settings) { @@ -25306,14 +25938,15 @@ function useShadowPresets(settings) { const defaultPresetsEnabled = settings?.shadow?.defaultPresets; const { default: defaultShadows, - theme: themeShadows + theme: themeShadows, + custom: customShadows } = (_settings$shadow$pres = settings?.shadow?.presets) !== null && _settings$shadow$pres !== void 0 ? _settings$shadow$pres : {}; const unsetShadow = { name: (0,external_wp_i18n_namespaceObject.__)('Unset'), slug: 'unset', shadow: 'none' }; - const shadowPresets = [...(defaultPresetsEnabled && defaultShadows || shadow_panel_components_EMPTY_ARRAY), ...(themeShadows || shadow_panel_components_EMPTY_ARRAY)]; + const shadowPresets = [...(defaultPresetsEnabled && defaultShadows || shadow_panel_components_EMPTY_ARRAY), ...(themeShadows || shadow_panel_components_EMPTY_ARRAY), ...(customShadows || shadow_panel_components_EMPTY_ARRAY)]; if (shadowPresets.length) { shadowPresets.unshift(unsetShadow); } @@ -25322,7 +25955,6 @@ function useShadowPresets(settings) { } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/border-panel.js - /** * WordPress dependencies */ @@ -25340,6 +25972,7 @@ function useShadowPresets(settings) { + function useHasBorderPanel(settings) { const controls = Object.values(useHasBorderPanelControls(settings)); return controls.some(Boolean); @@ -25378,22 +26011,24 @@ function BorderToolsPanel({ children, label }) { + const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const resetAll = () => { const updatedValue = resetAllFilter(value); onChange(updatedValue); }; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanel, { label: label, resetAll: resetAll, panelId: panelId, - dropdownMenuProps: TOOLSPANEL_DROPDOWNMENU_PROPS - }, children); + dropdownMenuProps: dropdownMenuProps, + children: children + }); } const border_panel_DEFAULT_CONTROLS = { radius: true, color: true, width: true, - shadow: false + shadow: true }; function BorderPanel({ as: Wrapper = BorderToolsPanel, @@ -25405,7 +26040,7 @@ function BorderPanel({ name, defaultControls = border_panel_DEFAULT_CONTROLS }) { - var _settings$shadow$pres, _overrideOrigins; + var _settings$shadow$pres, _ref, _ref2, _shadowPresets$custom; const colors = useColorsPerOrigin(settings); const decodeValue = (0,external_wp_element_namespaceObject.useCallback)(rawValue => getValueFromVariable({ settings @@ -25464,9 +26099,9 @@ function BorderPanel({ // Shadow const shadow = decodeValue(inheritedValue?.shadow); const shadowPresets = (_settings$shadow$pres = settings?.shadow?.presets) !== null && _settings$shadow$pres !== void 0 ? _settings$shadow$pres : {}; - const overriddenShadowPresets = (_overrideOrigins = overrideOrigins(shadowPresets)) !== null && _overrideOrigins !== void 0 ? _overrideOrigins : []; + const mergedShadowPresets = (_ref = (_ref2 = (_shadowPresets$custom = shadowPresets.custom) !== null && _shadowPresets$custom !== void 0 ? _shadowPresets$custom : shadowPresets.theme) !== null && _ref2 !== void 0 ? _ref2 : shadowPresets.default) !== null && _ref !== void 0 ? _ref : []; const setShadow = newValue => { - const slug = overriddenShadowPresets?.find(({ + const slug = mergedShadowPresets?.find(({ shadow: shadowName }) => shadowName === newValue)?.slug; onChange(setImmutably(value, ['shadow'], slug ? `var:preset|shadow|${slug}` : newValue || undefined)); @@ -25522,61 +26157,66 @@ function BorderPanel({ hasShadowControl, hasBorderControl }); - return (0,external_React_.createElement)(Wrapper, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Wrapper, { resetAllFilter: resetAllFilter, value: value, onChange: onChange, panelId: panelId, - label: label - }, (showBorderWidth || showBorderColor) && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { - hasValue: () => (0,external_wp_components_namespaceObject.__experimentalIsDefinedBorder)(value?.border), - label: (0,external_wp_i18n_namespaceObject.__)('Border'), - onDeselect: () => resetBorder(), - isShownByDefault: showBorderByDefault, - panelId: panelId - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalBorderBoxControl, { - colors: colors, - enableAlpha: true, - enableStyle: showBorderStyle, - onChange: onBorderChange, - popoverOffset: 40, - popoverPlacement: "left-start", - value: border, - __experimentalIsRenderedInSidebar: true, - size: '__unstable-large', - hideLabelFromVision: !hasShadowControl, - label: (0,external_wp_i18n_namespaceObject.__)('Border') - })), showBorderRadius && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { - hasValue: hasBorderRadius, - label: (0,external_wp_i18n_namespaceObject.__)('Radius'), - onDeselect: () => setBorderRadius(undefined), - isShownByDefault: defaultControls.radius, - panelId: panelId - }, (0,external_React_.createElement)(BorderRadiusControl, { - values: borderRadiusValues, - onChange: newValue => { - setBorderRadius(newValue || undefined); - } - })), hasShadowControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { - label: (0,external_wp_i18n_namespaceObject.__)('Shadow'), - hasValue: hasShadow, - onDeselect: resetShadow, - isShownByDefault: defaultControls.shadow, - panelId: panelId - }, hasBorderControl ? (0,external_React_.createElement)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { - as: "legend" - }, (0,external_wp_i18n_namespaceObject.__)('Shadow')) : null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, { - isBordered: true, - isSeparated: true - }, (0,external_React_.createElement)(ShadowPopover, { - shadow: shadow, - onShadowChange: setShadow, - settings: settings - })))); + label: label, + children: [(showBorderWidth || showBorderColor) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + hasValue: () => (0,external_wp_components_namespaceObject.__experimentalIsDefinedBorder)(value?.border), + label: (0,external_wp_i18n_namespaceObject.__)('Border'), + onDeselect: () => resetBorder(), + isShownByDefault: showBorderByDefault, + panelId: panelId, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalBorderBoxControl, { + colors: colors, + enableAlpha: true, + enableStyle: showBorderStyle, + onChange: onBorderChange, + popoverOffset: 40, + popoverPlacement: "left-start", + value: border, + __experimentalIsRenderedInSidebar: true, + size: "__unstable-large", + hideLabelFromVision: !hasShadowControl, + label: (0,external_wp_i18n_namespaceObject.__)('Border') + }) + }), showBorderRadius && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + hasValue: hasBorderRadius, + label: (0,external_wp_i18n_namespaceObject.__)('Radius'), + onDeselect: () => setBorderRadius(undefined), + isShownByDefault: defaultControls.radius, + panelId: panelId, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BorderRadiusControl, { + values: borderRadiusValues, + onChange: newValue => { + setBorderRadius(newValue || undefined); + } + }) + }), hasShadowControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + label: (0,external_wp_i18n_namespaceObject.__)('Shadow'), + hasValue: hasShadow, + onDeselect: resetShadow, + isShownByDefault: defaultControls.shadow, + panelId: panelId, + children: [hasBorderControl ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { + as: "legend", + children: (0,external_wp_i18n_namespaceObject.__)('Shadow') + }) : null, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { + isBordered: true, + isSeparated: true, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ShadowPopover, { + shadow: shadow, + onShadowChange: setShadow, + settings: settings + }) + })] + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/border.js - /** * External dependencies */ @@ -25601,6 +26241,7 @@ function BorderPanel({ + const BORDER_SUPPORT_KEY = '__experimentalBorder'; const SHADOW_SUPPORT_KEY = 'shadow'; const getColorByProperty = (colors, property, value) => { @@ -25693,11 +26334,12 @@ function BordersInspectorControl({ ...styleToAttributes(updatedStyle) }; }, [resetAllFilter]); - return (0,external_React_.createElement)(inspector_controls, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls, { group: "border", resetAllFilter: attributesResetAllFilter, - label: label - }, children); + label: label, + children: children + }); } function border_BorderPanel({ clientId, @@ -25736,7 +26378,7 @@ function border_BorderPanel({ ...(0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [BORDER_SUPPORT_KEY, '__experimentalDefaultControls']), ...(0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [SHADOW_SUPPORT_KEY, '__experimentalDefaultControls']) }; - return (0,external_React_.createElement)(BorderPanel, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BorderPanel, { as: BordersInspectorControl, panelId: clientId, settings: settings, @@ -25861,7 +26503,7 @@ function border_addSaveProps(props, blockNameOrType, attributes) { return props; } const borderClasses = getBorderClasses(attributes); - const newClassName = classnames_default()(props.className, borderClasses); + const newClassName = dist_clsx(props.className, borderClasses); // If we are clearing the last of the previous classes in `className` // set it to `undefined` to avoid rendering empty DOM attributes. @@ -25883,7 +26525,7 @@ function getBorderClasses(attributes) { style } = attributes; const borderColorClass = getColorClassName('border-color', borderColor); - return classnames_default()({ + return dist_clsx({ 'has-border-color': borderColor || style?.border?.color, [borderColorClass]: !!borderColorClass }); @@ -26054,7 +26696,6 @@ function __experimentalUseGradient({ } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/control.js - /** * External dependencies */ @@ -26071,6 +26712,11 @@ function __experimentalUseGradient({ */ + + +const { + Tabs +} = unlock(external_wp_components_namespaceObject.privateApis); const colorsAndGradientKeys = ['colors', 'disableCustomColors', 'gradients', 'disableCustomGradients']; const TAB_IDS = { color: 'color', @@ -26099,7 +26745,7 @@ function ColorGradientControlInner({ return null; } const tabPanels = { - [TAB_IDS.color]: (0,external_React_.createElement)(external_wp_components_namespaceObject.ColorPalette, { + [TAB_IDS.color]: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ColorPalette, { value: colorValue, onChange: canChooseAGradient ? newColor => { onColorChange(newColor); @@ -26112,7 +26758,7 @@ function ColorGradientControlInner({ enableAlpha: enableAlpha, headingLevel: headingLevel }), - [TAB_IDS.gradient]: (0,external_React_.createElement)(external_wp_components_namespaceObject.GradientPicker, { + [TAB_IDS.gradient]: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.GradientPicker, { value: gradientValue, onChange: canChooseAColor ? newGradient => { onGradientChange(newGradient); @@ -26125,44 +26771,55 @@ function ColorGradientControlInner({ headingLevel: headingLevel }) }; - const renderPanelType = type => (0,external_React_.createElement)("div", { - className: "block-editor-color-gradient-control__panel" - }, tabPanels[type]); - - // Unlocking `Tabs` too early causes the `unlock` method to receive an empty - // object, due to circular dependencies. - // See https://github.com/WordPress/gutenberg/issues/52692 - const { - Tabs - } = unlock(external_wp_components_namespaceObject.privateApis); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.BaseControl, { + const renderPanelType = type => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-color-gradient-control__panel", + children: tabPanels[type] + }); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl, { __nextHasNoMarginBottom: true, - className: classnames_default()('block-editor-color-gradient-control', className) - }, (0,external_React_.createElement)("fieldset", { - className: "block-editor-color-gradient-control__fieldset" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { - spacing: 1 - }, showTitle && (0,external_React_.createElement)("legend", null, (0,external_React_.createElement)("div", { - className: "block-editor-color-gradient-control__color-indicator" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.BaseControl.VisualLabel, null, label))), canChooseAColor && canChooseAGradient && (0,external_React_.createElement)("div", null, (0,external_React_.createElement)(Tabs, { - initialTabId: gradientValue ? TAB_IDS.gradient : !!canChooseAColor && TAB_IDS.color - }, (0,external_React_.createElement)(Tabs.TabList, null, (0,external_React_.createElement)(Tabs.Tab, { - tabId: TAB_IDS.color - }, (0,external_wp_i18n_namespaceObject.__)('Solid')), (0,external_React_.createElement)(Tabs.Tab, { - tabId: TAB_IDS.gradient - }, (0,external_wp_i18n_namespaceObject.__)('Gradient'))), (0,external_React_.createElement)(Tabs.TabPanel, { - tabId: TAB_IDS.color, - className: 'block-editor-color-gradient-control__panel', - focusable: false - }, tabPanels.color), (0,external_React_.createElement)(Tabs.TabPanel, { - tabId: TAB_IDS.gradient, - className: 'block-editor-color-gradient-control__panel', - focusable: false - }, tabPanels.gradient))), !canChooseAGradient && renderPanelType(TAB_IDS.color), !canChooseAColor && renderPanelType(TAB_IDS.gradient)))); + className: dist_clsx('block-editor-color-gradient-control', className), + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("fieldset", { + className: "block-editor-color-gradient-control__fieldset", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { + spacing: 1, + children: [showTitle && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("legend", { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-color-gradient-control__color-indicator", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { + children: label + }) + }) + }), canChooseAColor && canChooseAGradient && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tabs, { + defaultTabId: gradientValue ? TAB_IDS.gradient : !!canChooseAColor && TAB_IDS.color, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tabs.TabList, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, { + tabId: TAB_IDS.color, + children: (0,external_wp_i18n_namespaceObject.__)('Color') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, { + tabId: TAB_IDS.gradient, + children: (0,external_wp_i18n_namespaceObject.__)('Gradient') + })] + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.TabPanel, { + tabId: TAB_IDS.color, + className: "block-editor-color-gradient-control__panel", + focusable: false, + children: tabPanels.color + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.TabPanel, { + tabId: TAB_IDS.gradient, + className: "block-editor-color-gradient-control__panel", + focusable: false, + children: tabPanels.gradient + })] + }) + }), !canChooseAGradient && renderPanelType(TAB_IDS.color), !canChooseAColor && renderPanelType(TAB_IDS.gradient)] + }) + }) + }); } function ColorGradientControlSelect(props) { const [colors, gradients, customColors, customGradients] = use_settings_useSettings('color.palette', 'color.gradients', 'color.custom', 'color.customGradient'); - return (0,external_React_.createElement)(ColorGradientControlInner, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorGradientControlInner, { colors: colors, gradients: gradients, disableCustomColors: !customColors, @@ -26172,18 +26829,17 @@ function ColorGradientControlSelect(props) { } function ColorGradientControl(props) { if (colorsAndGradientKeys.every(key => props.hasOwnProperty(key))) { - return (0,external_React_.createElement)(ColorGradientControlInner, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorGradientControlInner, { ...props }); } - return (0,external_React_.createElement)(ColorGradientControlSelect, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorGradientControlSelect, { ...props }); } /* harmony default export */ const control = (ColorGradientControl); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/color-panel.js - /** * External dependencies */ @@ -26204,9 +26860,11 @@ function ColorGradientControl(props) { + + function useHasColorPanel(settings) { const hasTextPanel = useHasTextPanel(settings); - const hasBackgroundPanel = useHasBackgroundPanel(settings); + const hasBackgroundPanel = color_panel_useHasBackgroundPanel(settings); const hasLinkPanel = useHasLinkPanel(settings); const hasHeadingPanel = useHasHeadingPanel(settings); const hasButtonPanel = useHasButtonPanel(settings); @@ -26235,7 +26893,7 @@ function useHasButtonPanel(settings) { const gradients = useGradientsPerOrigin(settings); return settings?.color?.button && (colors?.length > 0 || settings?.color?.custom || gradients?.length > 0 || settings?.color?.customGradient); } -function useHasBackgroundPanel(settings) { +function color_panel_useHasBackgroundPanel(settings) { const colors = useColorsPerOrigin(settings); const gradients = useGradientsPerOrigin(settings); return settings?.color?.background && (colors?.length > 0 || settings?.color?.custom || gradients?.length > 0 || settings?.color?.customGradient); @@ -26247,22 +26905,26 @@ function ColorToolsPanel({ panelId, children }) { + const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const resetAll = () => { const updatedValue = resetAllFilter(value); onChange(updatedValue); }; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, { - label: (0,external_wp_i18n_namespaceObject.__)('Color'), + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanel, { + label: (0,external_wp_i18n_namespaceObject.__)('Elements'), resetAll: resetAll, panelId: panelId, hasInnerWrapper: true, + headingLevel: 3, className: "color-block-support-panel", __experimentalFirstVisibleItemClass: "first", __experimentalLastVisibleItemClass: "last", - dropdownMenuProps: TOOLSPANEL_DROPDOWNMENU_PROPS - }, (0,external_React_.createElement)("div", { - className: "color-block-support-panel__inner-wrapper" - }, children)); + dropdownMenuProps: dropdownMenuProps, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "color-block-support-panel__inner-wrapper", + children: children + }) + }); } const color_panel_DEFAULT_CONTROLS = { text: true, @@ -26277,23 +26939,29 @@ const popoverProps = { offset: 36, shift: true }; +const { + Tabs: color_panel_Tabs +} = unlock(external_wp_components_namespaceObject.privateApis); const LabeledColorIndicators = ({ indicators, label -}) => (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { - justify: "flex-start" -}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalZStack, { - isLayered: false, - offset: -8 -}, indicators.map((indicator, index) => (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, { - key: index, - expanded: false -}, (0,external_React_.createElement)(external_wp_components_namespaceObject.ColorIndicator, { - colorValue: indicator -})))), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, { - className: "block-editor-panel-color-gradient-settings__color-name", - title: label -}, label)); +}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { + justify: "flex-start", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalZStack, { + isLayered: false, + offset: -8, + children: indicators.map((indicator, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { + expanded: false, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ColorIndicator, { + colorValue: indicator + }) + }, index)) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { + className: "block-editor-panel-color-gradient-settings__color-name", + title: label, + children: label + })] +}); function ColorPanelTab({ isGradient, inheritedValue, @@ -26301,7 +26969,7 @@ function ColorPanelTab({ setValue, colorGradientControlSettings }) { - return (0,external_React_.createElement)(control, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(control, { ...colorGradientControlSettings, showTitle: false, enableAlpha: true, @@ -26324,66 +26992,76 @@ function ColorPanelDropdown({ colorGradientControlSettings, panelId }) { + var _tabs$; const currentTab = tabs.find(tab => tab.userValue !== undefined); - // Unlocking `Tabs` too early causes the `unlock` method to receive an empty - // object, due to circular dependencies. - // See https://github.com/WordPress/gutenberg/issues/52692 const { - Tabs - } = unlock(external_wp_components_namespaceObject.privateApis); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + key: firstTabKey, + ...firstTab + } = (_tabs$ = tabs[0]) !== null && _tabs$ !== void 0 ? _tabs$ : {}; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { className: "block-editor-tools-panel-color-gradient-settings__item", hasValue: hasValue, label: label, onDeselect: resetValue, isShownByDefault: isShownByDefault, - panelId: panelId - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Dropdown, { - popoverProps: popoverProps, - className: "block-editor-tools-panel-color-gradient-settings__dropdown", - renderToggle: ({ - onToggle, - isOpen - }) => { - const toggleProps = { - onClick: onToggle, - className: classnames_default()('block-editor-panel-color-gradient-settings__dropdown', { - 'is-open': isOpen - }), - 'aria-expanded': isOpen, - 'aria-label': (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s is the type of color property, e.g., "background" */ - (0,external_wp_i18n_namespaceObject.__)('Color %s styles'), label) - }; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - ...toggleProps - }, (0,external_React_.createElement)(LabeledColorIndicators, { - indicators: indicators, - label: label - })); - }, - renderContent: () => (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { - paddingSize: "none" - }, (0,external_React_.createElement)("div", { - className: "block-editor-panel-color-gradient-settings__dropdown-content" - }, tabs.length === 1 && (0,external_React_.createElement)(ColorPanelTab, { - ...tabs[0], - colorGradientControlSettings: colorGradientControlSettings - }), tabs.length > 1 && (0,external_React_.createElement)(Tabs, { - initialTabId: currentTab?.key - }, (0,external_React_.createElement)(Tabs.TabList, null, tabs.map(tab => (0,external_React_.createElement)(Tabs.Tab, { - key: tab.key, - tabId: tab.key - }, tab.label))), tabs.map(tab => { - return (0,external_React_.createElement)(Tabs.TabPanel, { - key: tab.key, - tabId: tab.key, - focusable: false - }, (0,external_React_.createElement)(ColorPanelTab, { - ...tab, - colorGradientControlSettings: colorGradientControlSettings - })); - })))) - })); + panelId: panelId, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { + popoverProps: popoverProps, + className: "block-editor-tools-panel-color-gradient-settings__dropdown", + renderToggle: ({ + onToggle, + isOpen + }) => { + const toggleProps = { + onClick: onToggle, + className: dist_clsx('block-editor-panel-color-gradient-settings__dropdown', { + 'is-open': isOpen + }), + 'aria-expanded': isOpen, + 'aria-label': (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s is the type of color property, e.g., "background" */ + (0,external_wp_i18n_namespaceObject.__)('Color %s styles'), label) + }; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + ...toggleProps, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LabeledColorIndicators, { + indicators: indicators, + label: label + }) + }); + }, + renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { + paddingSize: "none", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-panel-color-gradient-settings__dropdown-content", + children: [tabs.length === 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorPanelTab, { + ...firstTab, + colorGradientControlSettings: colorGradientControlSettings + }, firstTabKey), tabs.length > 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(color_panel_Tabs, { + defaultTabId: currentTab?.key, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(color_panel_Tabs.TabList, { + children: tabs.map(tab => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(color_panel_Tabs.Tab, { + tabId: tab.key, + children: tab.label + }, tab.key)) + }), tabs.map(tab => { + const { + key: tabKey, + ...restTabProps + } = tab; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(color_panel_Tabs.TabPanel, { + tabId: tabKey, + focusable: false, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorPanelTab, { + ...restTabProps, + colorGradientControlSettings: colorGradientControlSettings + }, tabKey) + }, tabKey); + })] + })] + }) + }) + }) + }); } function ColorPanel({ as: Wrapper = ColorToolsPanel, @@ -26424,7 +27102,7 @@ function ColorPanel({ }; // BackgroundColor - const showBackgroundPanel = useHasBackgroundPanel(settings); + const showBackgroundPanel = color_panel_useHasBackgroundPanel(settings); const backgroundColor = decodeValue(inheritedValue?.color?.background); const userBackgroundColor = decodeValue(value?.color?.background); const gradient = decodeValue(inheritedValue?.color?.gradient); @@ -26565,7 +27243,7 @@ function ColorPanel({ indicators: [gradient !== null && gradient !== void 0 ? gradient : backgroundColor], tabs: [hasSolidColors && { key: 'background', - label: (0,external_wp_i18n_namespaceObject.__)('Solid'), + label: (0,external_wp_i18n_namespaceObject.__)('Color'), inheritedValue: backgroundColor, setValue: setBackgroundColor, userValue: userBackgroundColor @@ -26603,7 +27281,9 @@ function ColorPanel({ label, showPanel }) => { - if (!showPanel) return; + if (!showPanel) { + return; + } const elementBackgroundColor = decodeValue(inheritedValue?.elements?.[name]?.color?.background); const elementGradient = decodeValue(inheritedValue?.elements?.[name]?.color?.gradient); const elementTextColor = decodeValue(inheritedValue?.elements?.[name]?.color?.text); @@ -26663,26 +27343,31 @@ function ColorPanel({ }].filter(Boolean) }); }); - return (0,external_React_.createElement)(Wrapper, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Wrapper, { resetAllFilter: resetAllFilter, value: value, onChange: onChange, - panelId: panelId - }, items.map(item => (0,external_React_.createElement)(ColorPanelDropdown, { - key: item.key, - ...item, - colorGradientControlSettings: { - colors, - disableCustomColors: !areCustomSolidsEnabled, - gradients, - disableCustomGradients: !areCustomGradientsEnabled - }, - panelId: panelId - })), children); + panelId: panelId, + children: [items.map(item => { + const { + key, + ...restItem + } = item; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorPanelDropdown, { + ...restItem, + colorGradientControlSettings: { + colors, + disableCustomColors: !areCustomSolidsEnabled, + gradients, + disableCustomGradients: !areCustomGradientsEnabled + }, + panelId: panelId + }, key); + }), children] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/contrast-checker/index.js - /** * External dependencies */ @@ -26696,6 +27381,7 @@ function ColorPanel({ + k([names, a11y]); function ContrastChecker({ backgroundColor, @@ -26780,13 +27466,15 @@ function ContrastChecker({ // announcements are made. Notably, the message will be re-announced if a // new color combination is selected and the contrast is still insufficient. (0,external_wp_a11y_namespaceObject.speak)(speakMessage); - return (0,external_React_.createElement)("div", { - className: "block-editor-contrast-checker" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Notice, { - spokenMessage: null, - status: "warning", - isDismissible: false - }, message)); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-contrast-checker", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { + spokenMessage: null, + status: "warning", + isDismissible: false, + children: message + }) + }); } /** @@ -26794,136 +27482,7 @@ function ContrastChecker({ */ /* harmony default export */ const contrast_checker = (ContrastChecker); -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/provider/block-refs-provider.js - -/** - * WordPress dependencies - */ - -const BlockRefs = (0,external_wp_element_namespaceObject.createContext)({ - refs: new Map(), - callbacks: new Map() -}); -function BlockRefsProvider({ - children -}) { - const value = (0,external_wp_element_namespaceObject.useMemo)(() => ({ - refs: new Map(), - callbacks: new Map() - }), []); - return (0,external_React_.createElement)(BlockRefs.Provider, { - value: value - }, children); -} - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-block-refs.js -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - -/** @typedef {import('@wordpress/element').RefCallback} RefCallback */ -/** @typedef {import('@wordpress/element').RefObject} RefObject */ - -/** - * Provides a ref to the BlockRefs context. - * - * @param {string} clientId The client ID of the element ref. - * - * @return {RefCallback} Ref callback. - */ -function useBlockRefProvider(clientId) { - const { - refs, - callbacks - } = (0,external_wp_element_namespaceObject.useContext)(BlockRefs); - const ref = (0,external_wp_element_namespaceObject.useRef)(); - (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { - refs.set(ref, clientId); - return () => { - refs.delete(ref); - }; - }, [clientId]); - return (0,external_wp_compose_namespaceObject.useRefEffect)(element => { - // Update the ref in the provider. - ref.current = element; - // Call any update functions. - callbacks.forEach((id, setElement) => { - if (clientId === id) { - setElement(element); - } - }); - }, [clientId]); -} - -/** - * Gets a ref pointing to the current block element. Continues to return a - * stable ref even if the block client ID changes. - * - * @param {string} clientId The client ID to get a ref for. - * - * @return {RefObject} A ref containing the element. - */ -function useBlockRef(clientId) { - const { - refs - } = (0,external_wp_element_namespaceObject.useContext)(BlockRefs); - const freshClientId = (0,external_wp_element_namespaceObject.useRef)(); - freshClientId.current = clientId; - // Always return an object, even if no ref exists for a given client ID, so - // that `current` works at a later point. - return (0,external_wp_element_namespaceObject.useMemo)(() => ({ - get current() { - let element = null; - - // Multiple refs may be created for a single block. Find the - // first that has an element set. - for (const [ref, id] of refs.entries()) { - if (id === freshClientId.current && ref.current) { - element = ref.current; - } - } - return element; - } - }), []); -} - -/** - * Return the element for a given client ID. Updates whenever the element - * changes, becomes available, or disappears. - * - * @param {string} clientId The client ID to an element for. - * - * @return {Element|null} The block's wrapper element. - */ -function useBlockElement(clientId) { - const { - callbacks - } = (0,external_wp_element_namespaceObject.useContext)(BlockRefs); - const ref = useBlockRef(clientId); - const [element, setElement] = (0,external_wp_element_namespaceObject.useState)(null); - (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { - if (!clientId) { - return; - } - callbacks.set(setElement, clientId); - return () => { - callbacks.delete(setElement); - }; - }, [clientId]); - return ref.current || element; -} - - - ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/contrast-checker.js - /** * WordPress dependencies */ @@ -26934,6 +27493,7 @@ function useBlockElement(clientId) { */ + function getComputedStyle(node) { return node.ownerDocument.defaultView.getComputedStyle(node); } @@ -26965,7 +27525,7 @@ function BlockColorContrastChecker({ } setDetectedBackgroundColor(backgroundColor); }); - return (0,external_React_.createElement)(contrast_checker, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(contrast_checker, { backgroundColor: detectedBackgroundColor, textColor: detectedColor, enableAlphaChecker: true, @@ -26974,7 +27534,6 @@ function BlockColorContrastChecker({ } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/color.js - /** * External dependencies */ @@ -27000,6 +27559,7 @@ function BlockColorContrastChecker({ + const COLOR_SUPPORT_KEY = 'color'; const hasColorSupport = blockNameOrType => { const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockNameOrType, COLOR_SUPPORT_KEY); @@ -27095,7 +27655,7 @@ function color_addSaveProps(props, blockNameOrType, attributes) { const backgroundClass = shouldSerialize('background') ? getColorClassName('background-color', backgroundColor) : undefined; const serializeHasBackground = shouldSerialize('background') || shouldSerialize('gradients'); const hasBackground = backgroundColor || style?.color?.background || hasGradient && (gradient || style?.color?.gradient); - const newClassName = classnames_default()(props.className, textClass, gradientClass, { + const newClassName = dist_clsx(props.className, textClass, gradientClass, { // Don't apply the background class if there's a custom gradient. [backgroundClass]: (!hasGradient || !style?.color?.gradient) && !!backgroundClass, 'has-text-color': shouldSerialize('text') && (textColor || style?.color?.text), @@ -27151,10 +27711,11 @@ function ColorInspectorControl({ ...color_styleToAttributes(updatedStyle) }; }, [resetAllFilter]); - return (0,external_React_.createElement)(inspector_controls, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls, { group: "color", - resetAllFilter: attributesResetAllFilter - }, children); + resetAllFilter: attributesResetAllFilter, + children: children + }); } function ColorEdit({ clientId, @@ -27203,17 +27764,18 @@ function ColorEdit({ // Deactivating it requires `enableContrastChecker` to have // an explicit value of `false`. false !== (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [COLOR_SUPPORT_KEY, 'enableContrastChecker']); - return (0,external_React_.createElement)(ColorPanel, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorPanel, { as: ColorInspectorControl, panelId: clientId, settings: settings, value: value, onChange: onChange, defaultControls: defaultControls, - enableContrastChecker: false !== (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [COLOR_SUPPORT_KEY, 'enableContrastChecker']) - }, enableContrastChecking && (0,external_React_.createElement)(BlockColorContrastChecker, { - clientId: clientId - })); + enableContrastChecker: false !== (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [COLOR_SUPPORT_KEY, 'enableContrastChecker']), + children: enableContrastChecking && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockColorContrastChecker, { + clientId: clientId + }) + }); } function color_useBlockProps({ name, @@ -27245,7 +27807,7 @@ function color_useBlockProps({ const hasBackgroundValue = backgroundColor || style?.color?.background || gradient || style?.color?.gradient; return { ...saveProps, - className: classnames_default()(saveProps.className, + className: dist_clsx(saveProps.className, // Add background image classes in the editor, if not already handled by background color values. !hasBackgroundValue && getBackgroundImageClasses(style)) }; @@ -27276,7 +27838,6 @@ function color_addTransforms(result, source, index, results) { (0,external_wp_hooks_namespaceObject.addFilter)('blocks.switchToBlockType.transformedBlock', 'core/color/addTransforms', color_addTransforms); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/font-family/index.js - /** * WordPress dependencies */ @@ -27287,6 +27848,7 @@ function color_addTransforms(result, source, index, results) { * Internal dependencies */ + function FontFamilyControl({ value = '', onChange, @@ -27312,7 +27874,7 @@ function FontFamilyControl({ label: name || fontFamily }; })]; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.SelectControl, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { label: (0,external_wp_i18n_namespaceObject.__)('Font'), options: options, value: value, @@ -27323,13 +27885,13 @@ function FontFamilyControl({ } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/font-appearance-control/index.js - /** * WordPress dependencies */ + const FONT_STYLES = [{ name: (0,external_wp_i18n_namespaceObject._x)('Regular', 'font style'), value: 'normal' @@ -27508,7 +28070,7 @@ function FontAppearanceControl(props) { // translators: %s: Currently selected font appearance. (0,external_wp_i18n_namespaceObject.__)('Currently selected font appearance: %s'), currentSelection.name); }; - return hasStylesOrWeights && (0,external_React_.createElement)(external_wp_components_namespaceObject.CustomSelectControl, { + return hasStylesOrWeights && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CustomSelectControl, { ...otherProps, className: "components-font-appearance-control", label: label, @@ -27517,8 +28079,7 @@ function FontAppearanceControl(props) { value: currentSelection, onChange: ({ selectedItem - }) => onChange(selectedItem.style), - __nextUnconstrainedWidth: true + }) => onChange(selectedItem.style) }); } @@ -27554,7 +28115,6 @@ function isLineHeightDefined(lineHeight) { } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/line-height-control/index.js - /** * WordPress dependencies */ @@ -27566,6 +28126,7 @@ function isLineHeightDefined(lineHeight) { * Internal dependencies */ + const line_height_control_LineHeightControl = ({ value: lineHeight, onChange, @@ -27577,7 +28138,9 @@ const line_height_control_LineHeightControl = ({ const isDefined = isLineHeightDefined(lineHeight); const adjustNextValue = (nextValue, wasTypedOrPasted) => { // Set the next value without modification if lineHeight has been defined. - if (isDefined) return nextValue; + if (isDefined) { + return nextValue; + } /** * The following logic handles the initial spin up/down action @@ -27597,7 +28160,9 @@ const line_height_control_LineHeightControl = ({ { // This means the user explicitly input '0', rather than using the // spin down action from an undefined value state. - if (wasTypedOrPasted) return nextValue; + if (wasTypedOrPasted) { + return nextValue; + } // Decrement by spin value. return BASE_DEFAULT_VALUE - spin; } @@ -27643,22 +28208,23 @@ const line_height_control_LineHeightControl = ({ } onChange(`${nextValue}`); }; - return (0,external_React_.createElement)("div", { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-line-height-control", - style: deprecatedStyles - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNumberControl, { - ...otherProps, - __unstableInputWidth: __unstableInputWidth, - __unstableStateReducer: stateReducer, - onChange: handleOnChange, - label: (0,external_wp_i18n_namespaceObject.__)('Line height'), - placeholder: BASE_DEFAULT_VALUE, - step: STEP, - spinFactor: SPIN_FACTOR, - value: value, - min: 0, - spinControls: "custom" - })); + style: deprecatedStyles, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, { + ...otherProps, + __unstableInputWidth: __unstableInputWidth, + __unstableStateReducer: stateReducer, + onChange: handleOnChange, + label: (0,external_wp_i18n_namespaceObject.__)('Line height'), + placeholder: BASE_DEFAULT_VALUE, + step: STEP, + spinFactor: SPIN_FACTOR, + value: value, + min: 0, + spinControls: "custom" + }) + }); }; /** @@ -27667,7 +28233,6 @@ const line_height_control_LineHeightControl = ({ /* harmony default export */ const line_height_control = (line_height_control_LineHeightControl); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/letter-spacing-control/index.js - /** * WordPress dependencies */ @@ -27689,6 +28254,7 @@ const line_height_control_LineHeightControl = ({ * * @return {Element} Letter-spacing control. */ + function LetterSpacingControl({ value, onChange, @@ -27704,7 +28270,7 @@ function LetterSpacingControl({ rem: 0.2 } }); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { ...otherProps, label: (0,external_wp_i18n_namespaceObject.__)('Letter spacing'), value: value, @@ -27714,64 +28280,255 @@ function LetterSpacingControl({ }); } -;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/reset.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/align-left.js +/** + * WordPress dependencies + */ + +const alignLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M13 5.5H4V4h9v1.5Zm7 7H4V11h16v1.5Zm-7 7H4V18h9v1.5Z" + }) +}); +/* harmony default export */ const align_left = (alignLeft); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/align-center.js /** * WordPress dependencies */ -const reset_reset = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const align_center_alignCenter = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M7 11.5h10V13H7z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M7.5 5.5h9V4h-9v1.5Zm-3.5 7h16V11H4v1.5Zm3.5 7h9V18h-9v1.5Z" + }) +}); +/* harmony default export */ const align_center = (align_center_alignCenter); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/align-right.js +/** + * WordPress dependencies + */ + + +const alignRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M11.111 5.5H20V4h-8.889v1.5ZM4 12.5h16V11H4v1.5Zm7.111 7H20V18h-8.889v1.5Z" + }) +}); +/* harmony default export */ const align_right = (alignRight); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/align-justify.js +/** + * WordPress dependencies + */ + + +const alignJustify = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M4 12.8h16v-1.5H4v1.5zm0 7h12.4v-1.5H4v1.5zM4 4.3v1.5h16V4.3H4z" + }) +}); +/* harmony default export */ const align_justify = (alignJustify); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/segmented-text-control/index.js +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + +/** + * @typedef {Object} Option + * @property {string} label The label of the option. + * @property {string} value The value of the option. + * @property {string} icon The icon of the option. + */ + +/** + * Control to facilitate selecting a text style from a set of options. + * + * @param {Object} props Component props. + * @param {string} props.label A label for the option. + * @param {string} props.value Currently selected value. + * @param {Function} props.onChange Callback to handle onChange. + * @param {Option[]} props.options Array of options to display. + * @param {string} props.className Additional class name to apply. + * + * @return {Element} Element to render. + */ + + +function SegmentedTextControl({ + label, + value, + options, + onChange, + className +}) { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { + className: dist_clsx('block-editor-segmented-text-control', className), + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { + as: "legend", + children: label + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-segmented-text-control__buttons", + children: options.map(option => { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + size: "compact", + icon: option.icon, + label: option.label, + isPressed: option.value === value, + onClick: () => onChange(option.value) + }, option.value); + }) + })] + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/text-alignment-control/index.js +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + +const TEXT_ALIGNMENT_OPTIONS = [{ + label: (0,external_wp_i18n_namespaceObject.__)('Align text left'), + value: 'left', + icon: align_left +}, { + label: (0,external_wp_i18n_namespaceObject.__)('Align text center'), + value: 'center', + icon: align_center +}, { + label: (0,external_wp_i18n_namespaceObject.__)('Align text right'), + value: 'right', + icon: align_right +}, { + label: (0,external_wp_i18n_namespaceObject.__)('Justify text'), + value: 'justify', + icon: align_justify +}]; +const DEFAULT_OPTIONS = ['left', 'center', 'right']; + +/** + * Control to facilitate text alignment selections. + * + * @param {Object} props Component props. + * @param {string} props.className Class name to add to the control. + * @param {string} props.value Currently selected text alignment. + * @param {Function} props.onChange Handles change in text alignment selection. + * @param {string[]} props.options Array of text alignment options to display. + * + * @return {Element} Text alignment control. + */ +function TextAlignmentControl({ + className, + value, + onChange, + options = DEFAULT_OPTIONS +}) { + const validOptions = (0,external_wp_element_namespaceObject.useMemo)(() => TEXT_ALIGNMENT_OPTIONS.filter(option => options.includes(option.value)), [options]); + if (!validOptions.length) { + return null; + } + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SegmentedTextControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Text alignment'), + options: validOptions, + className: dist_clsx('block-editor-text-alignment-control', className), + value: value, + onChange: newValue => { + onChange(newValue === value ? undefined : newValue); + } + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/reset.js +/** + * WordPress dependencies + */ + + +const reset_reset = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M7 11.5h10V13H7z" + }) +}); /* harmony default export */ const library_reset = (reset_reset); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-uppercase.js - /** * WordPress dependencies */ -const formatUppercase = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const formatUppercase = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M6.1 6.8L2.1 18h1.6l1.1-3h4.3l1.1 3h1.6l-4-11.2H6.1zm-.8 6.8L7 8.9l1.7 4.7H5.3zm15.1-.7c-.4-.5-.9-.8-1.6-1 .4-.2.7-.5.8-.9.2-.4.3-.9.3-1.4 0-.9-.3-1.6-.8-2-.6-.5-1.3-.7-2.4-.7h-3.5V18h4.2c1.1 0 2-.3 2.6-.8.6-.6 1-1.4 1-2.4-.1-.8-.3-1.4-.6-1.9zm-5.7-4.7h1.8c.6 0 1.1.1 1.4.4.3.2.5.7.5 1.3 0 .6-.2 1.1-.5 1.3-.3.2-.8.4-1.4.4h-1.8V8.2zm4 8c-.4.3-.9.5-1.5.5h-2.6v-3.8h2.6c1.4 0 2 .6 2 1.9.1.6-.1 1-.5 1.4z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M6.1 6.8L2.1 18h1.6l1.1-3h4.3l1.1 3h1.6l-4-11.2H6.1zm-.8 6.8L7 8.9l1.7 4.7H5.3zm15.1-.7c-.4-.5-.9-.8-1.6-1 .4-.2.7-.5.8-.9.2-.4.3-.9.3-1.4 0-.9-.3-1.6-.8-2-.6-.5-1.3-.7-2.4-.7h-3.5V18h4.2c1.1 0 2-.3 2.6-.8.6-.6 1-1.4 1-2.4-.1-.8-.3-1.4-.6-1.9zm-5.7-4.7h1.8c.6 0 1.1.1 1.4.4.3.2.5.7.5 1.3 0 .6-.2 1.1-.5 1.3-.3.2-.8.4-1.4.4h-1.8V8.2zm4 8c-.4.3-.9.5-1.5.5h-2.6v-3.8h2.6c1.4 0 2 .6 2 1.9.1.6-.1 1-.5 1.4z" + }) +}); /* harmony default export */ const format_uppercase = (formatUppercase); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-lowercase.js - /** * WordPress dependencies */ -const formatLowercase = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const formatLowercase = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M11 16.8c-.1-.1-.2-.3-.3-.5v-2.6c0-.9-.1-1.7-.3-2.2-.2-.5-.5-.9-.9-1.2-.4-.2-.9-.3-1.6-.3-.5 0-1 .1-1.5.2s-.9.3-1.2.6l.2 1.2c.4-.3.7-.4 1.1-.5.3-.1.7-.2 1-.2.6 0 1 .1 1.3.4.3.2.4.7.4 1.4-1.2 0-2.3.2-3.3.7s-1.4 1.1-1.4 2.1c0 .7.2 1.2.7 1.6.4.4 1 .6 1.8.6.9 0 1.7-.4 2.4-1.2.1.3.2.5.4.7.1.2.3.3.6.4.3.1.6.1 1.1.1h.1l.2-1.2h-.1c-.4.1-.6 0-.7-.1zM9.2 16c-.2.3-.5.6-.9.8-.3.1-.7.2-1.1.2-.4 0-.7-.1-.9-.3-.2-.2-.3-.5-.3-.9 0-.6.2-1 .7-1.3.5-.3 1.3-.4 2.5-.5v2zm10.6-3.9c-.3-.6-.7-1.1-1.2-1.5-.6-.4-1.2-.6-1.9-.6-.5 0-.9.1-1.4.3-.4.2-.8.5-1.1.8V6h-1.4v12h1.3l.2-1c.2.4.6.6 1 .8.4.2.9.3 1.4.3.7 0 1.2-.2 1.8-.5.5-.4 1-.9 1.3-1.5.3-.6.5-1.3.5-2.1-.1-.6-.2-1.3-.5-1.9zm-1.7 4c-.4.5-.9.8-1.6.8s-1.2-.2-1.7-.7c-.4-.5-.7-1.2-.7-2.1 0-.9.2-1.6.7-2.1.4-.5 1-.7 1.7-.7s1.2.3 1.6.8c.4.5.6 1.2.6 2s-.2 1.4-.6 2z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M11 16.8c-.1-.1-.2-.3-.3-.5v-2.6c0-.9-.1-1.7-.3-2.2-.2-.5-.5-.9-.9-1.2-.4-.2-.9-.3-1.6-.3-.5 0-1 .1-1.5.2s-.9.3-1.2.6l.2 1.2c.4-.3.7-.4 1.1-.5.3-.1.7-.2 1-.2.6 0 1 .1 1.3.4.3.2.4.7.4 1.4-1.2 0-2.3.2-3.3.7s-1.4 1.1-1.4 2.1c0 .7.2 1.2.7 1.6.4.4 1 .6 1.8.6.9 0 1.7-.4 2.4-1.2.1.3.2.5.4.7.1.2.3.3.6.4.3.1.6.1 1.1.1h.1l.2-1.2h-.1c-.4.1-.6 0-.7-.1zM9.2 16c-.2.3-.5.6-.9.8-.3.1-.7.2-1.1.2-.4 0-.7-.1-.9-.3-.2-.2-.3-.5-.3-.9 0-.6.2-1 .7-1.3.5-.3 1.3-.4 2.5-.5v2zm10.6-3.9c-.3-.6-.7-1.1-1.2-1.5-.6-.4-1.2-.6-1.9-.6-.5 0-.9.1-1.4.3-.4.2-.8.5-1.1.8V6h-1.4v12h1.3l.2-1c.2.4.6.6 1 .8.4.2.9.3 1.4.3.7 0 1.2-.2 1.8-.5.5-.4 1-.9 1.3-1.5.3-.6.5-1.3.5-2.1-.1-.6-.2-1.3-.5-1.9zm-1.7 4c-.4.5-.9.8-1.6.8s-1.2-.2-1.7-.7c-.4-.5-.7-1.2-.7-2.1 0-.9.2-1.6.7-2.1.4-.5 1-.7 1.7-.7s1.2.3 1.6.8c.4.5.6 1.2.6 2s-.2 1.4-.6 2z" + }) +}); /* harmony default export */ const format_lowercase = (formatLowercase); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-capitalize.js - /** * WordPress dependencies */ -const formatCapitalize = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const formatCapitalize = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M7.1 6.8L3.1 18h1.6l1.1-3h4.3l1.1 3h1.6l-4-11.2H7.1zm-.8 6.8L8 8.9l1.7 4.7H6.3zm14.5-1.5c-.3-.6-.7-1.1-1.2-1.5-.6-.4-1.2-.6-1.9-.6-.5 0-.9.1-1.4.3-.4.2-.8.5-1.1.8V6h-1.4v12h1.3l.2-1c.2.4.6.6 1 .8.4.2.9.3 1.4.3.7 0 1.2-.2 1.8-.5.5-.4 1-.9 1.3-1.5.3-.6.5-1.3.5-2.1-.1-.6-.2-1.3-.5-1.9zm-1.7 4c-.4.5-.9.8-1.6.8s-1.2-.2-1.7-.7c-.4-.5-.7-1.2-.7-2.1 0-.9.2-1.6.7-2.1.4-.5 1-.7 1.7-.7s1.2.3 1.6.8c.4.5.6 1.2.6 2 .1.8-.2 1.4-.6 2z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M7.1 6.8L3.1 18h1.6l1.1-3h4.3l1.1 3h1.6l-4-11.2H7.1zm-.8 6.8L8 8.9l1.7 4.7H6.3zm14.5-1.5c-.3-.6-.7-1.1-1.2-1.5-.6-.4-1.2-.6-1.9-.6-.5 0-.9.1-1.4.3-.4.2-.8.5-1.1.8V6h-1.4v12h1.3l.2-1c.2.4.6.6 1 .8.4.2.9.3 1.4.3.7 0 1.2-.2 1.8-.5.5-.4 1-.9 1.3-1.5.3-.6.5-1.3.5-2.1-.1-.6-.2-1.3-.5-1.9zm-1.7 4c-.4.5-.9.8-1.6.8s-1.2-.2-1.7-.7c-.4-.5-.7-1.2-.7-2.1 0-.9.2-1.6.7-2.1.4-.5 1-.7 1.7-.7s1.2.3 1.6.8c.4.5.6 1.2.6 2 .1.8-.2 1.4-.6 2z" + }) +}); /* harmony default export */ const format_capitalize = (formatCapitalize); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/text-transform-control/index.js - /** * External dependencies */ @@ -27783,20 +28540,25 @@ const formatCapitalize = (0,external_React_.createElement)(external_wp_primitive +/** + * Internal dependencies + */ + + const TEXT_TRANSFORMS = [{ - name: (0,external_wp_i18n_namespaceObject.__)('None'), + label: (0,external_wp_i18n_namespaceObject.__)('None'), value: 'none', icon: library_reset }, { - name: (0,external_wp_i18n_namespaceObject.__)('Uppercase'), + label: (0,external_wp_i18n_namespaceObject.__)('Uppercase'), value: 'uppercase', icon: format_uppercase }, { - name: (0,external_wp_i18n_namespaceObject.__)('Lowercase'), + label: (0,external_wp_i18n_namespaceObject.__)('Lowercase'), value: 'lowercase', icon: format_lowercase }, { - name: (0,external_wp_i18n_namespaceObject.__)('Capitalize'), + label: (0,external_wp_i18n_namespaceObject.__)('Capitalize'), value: 'capitalize', icon: format_capitalize }]; @@ -27816,55 +28578,48 @@ function TextTransformControl({ value, onChange }) { - return (0,external_React_.createElement)("fieldset", { - className: classnames_default()('block-editor-text-transform-control', className) - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { - as: "legend" - }, (0,external_wp_i18n_namespaceObject.__)('Letter case')), (0,external_React_.createElement)("div", { - className: "block-editor-text-transform-control__buttons" - }, TEXT_TRANSFORMS.map(textTransform => { - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - key: textTransform.value, - icon: textTransform.icon, - label: textTransform.name, - isPressed: textTransform.value === value, - onClick: () => { - onChange(textTransform.value === value ? undefined : textTransform.value); - } - }); - }))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SegmentedTextControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Letter case'), + options: TEXT_TRANSFORMS, + className: dist_clsx('block-editor-text-transform-control', className), + value: value, + onChange: newValue => { + onChange(newValue === value ? undefined : newValue); + } + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-underline.js - /** * WordPress dependencies */ -const formatUnderline = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const formatUnderline = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M7 18v1h10v-1H7zm5-2c1.5 0 2.6-.4 3.4-1.2.8-.8 1.1-2 1.1-3.5V5H15v5.8c0 1.2-.2 2.1-.6 2.8-.4.7-1.2 1-2.4 1s-2-.3-2.4-1c-.4-.7-.6-1.6-.6-2.8V5H7.5v6.2c0 1.5.4 2.7 1.1 3.5.8.9 1.9 1.3 3.4 1.3z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M7 18v1h10v-1H7zm5-2c1.5 0 2.6-.4 3.4-1.2.8-.8 1.1-2 1.1-3.5V5H15v5.8c0 1.2-.2 2.1-.6 2.8-.4.7-1.2 1-2.4 1s-2-.3-2.4-1c-.4-.7-.6-1.6-.6-2.8V5H7.5v6.2c0 1.5.4 2.7 1.1 3.5.8.9 1.9 1.3 3.4 1.3z" + }) +}); /* harmony default export */ const format_underline = (formatUnderline); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-strikethrough.js - /** * WordPress dependencies */ -const formatStrikethrough = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const formatStrikethrough = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M9.1 9v-.5c0-.6.2-1.1.7-1.4.5-.3 1.2-.5 2-.5.7 0 1.4.1 2.1.3.7.2 1.4.5 2.1.9l.2-1.9c-.6-.3-1.2-.5-1.9-.7-.8-.1-1.6-.2-2.4-.2-1.5 0-2.7.3-3.6 1-.8.7-1.2 1.5-1.2 2.6V9h2zM20 12H4v1h8.3c.3.1.6.2.8.3.5.2.9.5 1.1.8.3.3.4.7.4 1.2 0 .7-.2 1.1-.8 1.5-.5.3-1.2.5-2.1.5-.8 0-1.6-.1-2.4-.3-.8-.2-1.5-.5-2.2-.8L7 18.1c.5.2 1.2.4 2 .6.8.2 1.6.3 2.4.3 1.7 0 3-.3 3.9-1 .9-.7 1.3-1.6 1.3-2.8 0-.9-.2-1.7-.7-2.2H20v-1z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M9.1 9v-.5c0-.6.2-1.1.7-1.4.5-.3 1.2-.5 2-.5.7 0 1.4.1 2.1.3.7.2 1.4.5 2.1.9l.2-1.9c-.6-.3-1.2-.5-1.9-.7-.8-.1-1.6-.2-2.4-.2-1.5 0-2.7.3-3.6 1-.8.7-1.2 1.5-1.2 2.6V9h2zM20 12H4v1h8.3c.3.1.6.2.8.3.5.2.9.5 1.1.8.3.3.4.7.4 1.2 0 .7-.2 1.1-.8 1.5-.5.3-1.2.5-2.1.5-.8 0-1.6-.1-2.4-.3-.8-.2-1.5-.5-2.2-.8L7 18.1c.5.2 1.2.4 2 .6.8.2 1.6.3 2.4.3 1.7 0 3-.3 3.9-1 .9-.7 1.3-1.6 1.3-2.8 0-.9-.2-1.7-.7-2.2H20v-1z" + }) +}); /* harmony default export */ const format_strikethrough = (formatStrikethrough); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/text-decoration-control/index.js - /** * External dependencies */ @@ -27876,16 +28631,21 @@ const formatStrikethrough = (0,external_React_.createElement)(external_wp_primit +/** + * Internal dependencies + */ + + const TEXT_DECORATIONS = [{ - name: (0,external_wp_i18n_namespaceObject.__)('None'), + label: (0,external_wp_i18n_namespaceObject.__)('None'), value: 'none', icon: library_reset }, { - name: (0,external_wp_i18n_namespaceObject.__)('Underline'), + label: (0,external_wp_i18n_namespaceObject.__)('Underline'), value: 'underline', icon: format_underline }, { - name: (0,external_wp_i18n_namespaceObject.__)('Strikethrough'), + label: (0,external_wp_i18n_namespaceObject.__)('Strikethrough'), value: 'line-through', icon: format_strikethrough }]; @@ -27893,10 +28653,10 @@ const TEXT_DECORATIONS = [{ /** * Control to facilitate text decoration selections. * - * @param {Object} props Component props. - * @param {string} props.value Currently selected text decoration. - * @param {Function} props.onChange Handles change in text decoration selection. - * @param {string} [props.className] Additional class name to apply. + * @param {Object} props Component props. + * @param {string} props.value Currently selected text decoration. + * @param {Function} props.onChange Handles change in text decoration selection. + * @param {string} props.className Additional class name to apply. * * @return {Element} Text decoration control. */ @@ -27905,55 +28665,48 @@ function TextDecorationControl({ onChange, className }) { - return (0,external_React_.createElement)("fieldset", { - className: classnames_default()('block-editor-text-decoration-control', className) - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { - as: "legend" - }, (0,external_wp_i18n_namespaceObject.__)('Decoration')), (0,external_React_.createElement)("div", { - className: "block-editor-text-decoration-control__buttons" - }, TEXT_DECORATIONS.map(textDecoration => { - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - key: textDecoration.value, - icon: textDecoration.icon, - label: textDecoration.name, - isPressed: textDecoration.value === value, - onClick: () => { - onChange(textDecoration.value === value ? undefined : textDecoration.value); - } - }); - }))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SegmentedTextControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Decoration'), + options: TEXT_DECORATIONS, + className: dist_clsx('block-editor-text-decoration-control', className), + value: value, + onChange: newValue => { + onChange(newValue === value ? undefined : newValue); + } + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/text-horizontal.js - /** * WordPress dependencies */ -const textHorizontal = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const textHorizontal = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M8.2 14.4h3.9L13 17h1.7L11 6.5H9.3L5.6 17h1.7l.9-2.6zm2-5.5 1.4 4H8.8l1.4-4zm7.4 7.5-1.3.8.8 1.4H5.5V20h14.3l-2.2-3.6z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M8.2 14.4h3.9L13 17h1.7L11 6.5H9.3L5.6 17h1.7l.9-2.6zm2-5.5 1.4 4H8.8l1.4-4zm7.4 7.5-1.3.8.8 1.4H5.5V20h14.3l-2.2-3.6z" + }) +}); /* harmony default export */ const text_horizontal = (textHorizontal); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/text-vertical.js - /** * WordPress dependencies */ -const textVertical = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const textVertical = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M7 5.6v1.7l2.6.9v3.9L7 13v1.7L17.5 11V9.3L7 5.6zm4.2 6V8.8l4 1.4-4 1.4zm-5.7 5.6V5.5H4v14.3l3.6-2.2-.8-1.3-1.3.9z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M7 5.6v1.7l2.6.9v3.9L7 13v1.7L17.5 11V9.3L7 5.6zm4.2 6V8.8l4 1.4-4 1.4zm-5.7 5.6V5.5H4v14.3l3.6-2.2-.8-1.3-1.3.9z" + }) +}); /* harmony default export */ const text_vertical = (textVertical); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-mode-control/index.js - /** * External dependencies */ @@ -27965,12 +28718,17 @@ const textVertical = (0,external_React_.createElement)(external_wp_primitives_na +/** + * Internal dependencies + */ + + const WRITING_MODES = [{ - name: (0,external_wp_i18n_namespaceObject.__)('Horizontal'), + label: (0,external_wp_i18n_namespaceObject.__)('Horizontal'), value: 'horizontal-tb', icon: text_horizontal }, { - name: (0,external_wp_i18n_namespaceObject.__)('Vertical'), + label: (0,external_wp_i18n_namespaceObject.__)('Vertical'), value: (0,external_wp_i18n_namespaceObject.isRTL)() ? 'vertical-lr' : 'vertical-rl', icon: text_vertical }]; @@ -27990,27 +28748,18 @@ function WritingModeControl({ value, onChange }) { - return (0,external_React_.createElement)("fieldset", { - className: classnames_default()('block-editor-writing-mode-control', className) - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { - as: "legend" - }, (0,external_wp_i18n_namespaceObject.__)('Orientation')), (0,external_React_.createElement)("div", { - className: "block-editor-writing-mode-control__buttons" - }, WRITING_MODES.map(writingMode => { - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - key: writingMode.value, - icon: writingMode.icon, - label: writingMode.name, - isPressed: writingMode.value === value, - onClick: () => { - onChange(writingMode.value === value ? undefined : writingMode.value); - } - }); - }))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SegmentedTextControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Orientation'), + options: WRITING_MODES, + className: dist_clsx('block-editor-writing-mode-control', className), + value: value, + onChange: newValue => { + onChange(newValue === value ? undefined : newValue); + } + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/typography-panel.js - /** * WordPress dependencies */ @@ -28031,6 +28780,8 @@ function WritingModeControl({ + + const MIN_TEXT_COLUMNS = 1; const MAX_TEXT_COLUMNS = 6; function useHasTypographyPanel(settings) { @@ -28038,18 +28789,19 @@ function useHasTypographyPanel(settings) { const hasLineHeight = useHasLineHeightControl(settings); const hasFontAppearance = useHasAppearanceControl(settings); const hasLetterSpacing = useHasLetterSpacingControl(settings); + const hasTextAlign = useHasTextAlignmentControl(settings); const hasTextTransform = useHasTextTransformControl(settings); const hasTextDecoration = useHasTextDecorationControl(settings); const hasWritingMode = useHasWritingModeControl(settings); const hasTextColumns = useHasTextColumnsControl(settings); const hasFontSize = useHasFontSizeControl(settings); - return hasFontFamily || hasLineHeight || hasFontAppearance || hasLetterSpacing || hasTextTransform || hasFontSize || hasTextDecoration || hasWritingMode || hasTextColumns; + return hasFontFamily || hasLineHeight || hasFontAppearance || hasLetterSpacing || hasTextAlign || hasTextTransform || hasFontSize || hasTextDecoration || hasWritingMode || hasTextColumns; } function useHasFontSizeControl(settings) { - return hasOriginValue(settings?.typography?.fontSizes) || settings?.typography?.customFontSize; + return settings?.typography?.defaultFontSizes !== false && settings?.typography?.fontSizes?.default?.length || settings?.typography?.fontSizes?.theme?.length || settings?.typography?.fontSizes?.custom?.length || settings?.typography?.customFontSize; } function useHasFontFamilyControl(settings) { - return hasOriginValue(settings?.typography?.fontFamilies); + return ['default', 'theme', 'custom'].some(key => settings?.typography?.fontFamilies?.[key]?.length); } function useHasLineHeightControl(settings) { return settings?.typography?.lineHeight; @@ -28072,6 +28824,9 @@ function useHasLetterSpacingControl(settings) { function useHasTextTransformControl(settings) { return settings?.typography?.textTransform; } +function useHasTextAlignmentControl(settings) { + return settings?.typography?.textAlign; +} function useHasTextDecorationControl(settings) { return settings?.typography?.textDecoration; } @@ -28081,19 +28836,19 @@ function useHasWritingModeControl(settings) { function useHasTextColumnsControl(settings) { return settings?.typography?.textColumns; } -function getUniqueFontSizesBySlug(settings) { - var _settings$typography$, _overrideOrigins; - const fontSizes = (_settings$typography$ = settings?.typography?.fontSizes) !== null && _settings$typography$ !== void 0 ? _settings$typography$ : {}; - const overriddenFontSizes = (_overrideOrigins = overrideOrigins(fontSizes)) !== null && _overrideOrigins !== void 0 ? _overrideOrigins : []; - const uniqueSizes = []; - for (const currentSize of overriddenFontSizes) { - if (!uniqueSizes.some(({ - slug - }) => slug === currentSize.slug)) { - uniqueSizes.push(currentSize); - } - } - return uniqueSizes; + +/** + * Concatenate all the font sizes into a single list for the font size picker. + * + * @param {Object} settings The global styles settings. + * + * @return {Array} The merged font sizes. + */ +function getMergedFontSizes(settings) { + var _fontSizes$custom, _fontSizes$theme, _fontSizes$default; + const fontSizes = settings?.typography?.fontSizes; + const defaultFontSizesEnabled = !!settings?.typography?.defaultFontSizes; + return [...((_fontSizes$custom = fontSizes?.custom) !== null && _fontSizes$custom !== void 0 ? _fontSizes$custom : []), ...((_fontSizes$theme = fontSizes?.theme) !== null && _fontSizes$theme !== void 0 ? _fontSizes$theme : []), ...(defaultFontSizesEnabled ? (_fontSizes$default = fontSizes?.default) !== null && _fontSizes$default !== void 0 ? _fontSizes$default : [] : [])]; } function TypographyToolsPanel({ resetAllFilter, @@ -28102,16 +28857,18 @@ function TypographyToolsPanel({ panelId, children }) { + const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const resetAll = () => { const updatedValue = resetAllFilter(value); onChange(updatedValue); }; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanel, { label: (0,external_wp_i18n_namespaceObject.__)('Typography'), resetAll: resetAll, panelId: panelId, - dropdownMenuProps: TOOLSPANEL_DROPDOWNMENU_PROPS - }, children); + dropdownMenuProps: dropdownMenuProps, + children: children + }); } const typography_panel_DEFAULT_CONTROLS = { fontFamily: true, @@ -28119,6 +28876,7 @@ const typography_panel_DEFAULT_CONTROLS = { fontAppearance: true, lineHeight: true, letterSpacing: true, + textAlign: true, textTransform: true, textDecoration: true, writingMode: true, @@ -28133,15 +28891,19 @@ function TypographyPanel({ panelId, defaultControls = typography_panel_DEFAULT_CONTROLS }) { - var _settings$typography$2; const decodeValue = rawValue => getValueFromVariable({ settings }, '', rawValue); // Font Family const hasFontFamilyEnabled = useHasFontFamilyControl(settings); - const fontFamilies = (_settings$typography$2 = settings?.typography?.fontFamilies) !== null && _settings$typography$2 !== void 0 ? _settings$typography$2 : {}; - const mergedFontFamilies = fontFamilies ? mergeOrigins(fontFamilies) : []; + const fontFamilies = settings?.typography?.fontFamilies; + const mergedFontFamilies = (0,external_wp_element_namespaceObject.useMemo)(() => { + return ['default', 'theme', 'custom'].flatMap(key => { + var _fontFamilies$key; + return (_fontFamilies$key = fontFamilies?.[key]) !== null && _fontFamilies$key !== void 0 ? _fontFamilies$key : []; + }); + }, [fontFamilies]); const fontFamily = decodeValue(inheritedValue?.typography?.fontFamily); const setFontFamily = newValue => { const slug = mergedFontFamilies?.find(({ @@ -28155,7 +28917,7 @@ function TypographyPanel({ // Font Size const hasFontSizeEnabled = useHasFontSizeControl(settings); const disableCustomFontSizes = !settings?.typography?.customFontSize; - const mergedFontSizes = getUniqueFontSizesBySlug(settings); + const mergedFontSizes = getMergedFontSizes(settings); const fontSize = decodeValue(inheritedValue?.typography?.fontSize); const setFontSize = (newValue, metadata) => { const actualValue = !!metadata?.slug ? `var:preset|font-size|${metadata?.slug}` : newValue; @@ -28242,143 +29004,173 @@ function TypographyPanel({ }; const hasWritingMode = () => !!value?.typography?.writingMode; const resetWritingMode = () => setWritingMode(undefined); + + // Text Alignment + const hasTextAlignmentControl = useHasTextAlignmentControl(settings); + const textAlign = decodeValue(inheritedValue?.typography?.textAlign); + const setTextAlign = newValue => { + onChange(setImmutably(value, ['typography', 'textAlign'], newValue || undefined)); + }; + const hasTextAlign = () => !!value?.typography?.textAlign; + const resetTextAlign = () => setTextAlign(undefined); const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(previousValue => { return { ...previousValue, typography: {} }; }, []); - return (0,external_React_.createElement)(Wrapper, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Wrapper, { resetAllFilter: resetAllFilter, value: value, onChange: onChange, - panelId: panelId - }, hasFontFamilyEnabled && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { - label: (0,external_wp_i18n_namespaceObject.__)('Font family'), - hasValue: hasFontFamily, - onDeselect: resetFontFamily, - isShownByDefault: defaultControls.fontFamily, - panelId: panelId - }, (0,external_React_.createElement)(FontFamilyControl, { - fontFamilies: mergedFontFamilies, - value: fontFamily, - onChange: setFontFamily, - size: "__unstable-large", - __nextHasNoMarginBottom: true - })), hasFontSizeEnabled && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { - label: (0,external_wp_i18n_namespaceObject.__)('Font size'), - hasValue: hasFontSize, - onDeselect: resetFontSize, - isShownByDefault: defaultControls.fontSize, - panelId: panelId - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.FontSizePicker, { - value: fontSize, - onChange: setFontSize, - fontSizes: mergedFontSizes, - disableCustomFontSizes: disableCustomFontSizes, - withReset: false, - withSlider: true, - size: "__unstable-large" - })), hasAppearanceControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { - className: "single-column", - label: appearanceControlLabel, - hasValue: hasFontAppearance, - onDeselect: resetFontAppearance, - isShownByDefault: defaultControls.fontAppearance, - panelId: panelId - }, (0,external_React_.createElement)(FontAppearanceControl, { - value: { - fontStyle, - fontWeight - }, - onChange: setFontAppearance, - hasFontStyles: hasFontStyles, - hasFontWeights: hasFontWeights, - size: "__unstable-large", - __nextHasNoMarginBottom: true - })), hasLineHeightEnabled && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { - className: "single-column", - label: (0,external_wp_i18n_namespaceObject.__)('Line height'), - hasValue: hasLineHeight, - onDeselect: resetLineHeight, - isShownByDefault: defaultControls.lineHeight, - panelId: panelId - }, (0,external_React_.createElement)(line_height_control, { - __nextHasNoMarginBottom: true, - __unstableInputWidth: "auto", - value: lineHeight, - onChange: setLineHeight, - size: "__unstable-large" - })), hasLetterSpacingControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { - className: "single-column", - label: (0,external_wp_i18n_namespaceObject.__)('Letter spacing'), - hasValue: hasLetterSpacing, - onDeselect: resetLetterSpacing, - isShownByDefault: defaultControls.letterSpacing, - panelId: panelId - }, (0,external_React_.createElement)(LetterSpacingControl, { - value: letterSpacing, - onChange: setLetterSpacing, - size: "__unstable-large", - __unstableInputWidth: "auto" - })), hasTextColumnsControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { - className: "single-column", - label: (0,external_wp_i18n_namespaceObject.__)('Text columns'), - hasValue: hasTextColumns, - onDeselect: resetTextColumns, - isShownByDefault: defaultControls.textColumns, - panelId: panelId - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNumberControl, { - label: (0,external_wp_i18n_namespaceObject.__)('Text columns'), - max: MAX_TEXT_COLUMNS, - min: MIN_TEXT_COLUMNS, - onChange: setTextColumns, - size: "__unstable-large", - spinControls: "custom", - value: textColumns, - initialPosition: 1 - })), hasTextDecorationControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { - className: "single-column", - label: (0,external_wp_i18n_namespaceObject.__)('Text decoration'), - hasValue: hasTextDecoration, - onDeselect: resetTextDecoration, - isShownByDefault: defaultControls.textDecoration, - panelId: panelId - }, (0,external_React_.createElement)(TextDecorationControl, { - value: textDecoration, - onChange: setTextDecoration, - size: "__unstable-large", - __unstableInputWidth: "auto" - })), hasWritingModeControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { - className: "single-column", - label: (0,external_wp_i18n_namespaceObject.__)('Text orientation'), - hasValue: hasWritingMode, - onDeselect: resetWritingMode, - isShownByDefault: defaultControls.writingMode, - panelId: panelId - }, (0,external_React_.createElement)(WritingModeControl, { - value: writingMode, - onChange: setWritingMode, - size: "__unstable-large", - __nextHasNoMarginBottom: true - })), hasTextTransformControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { - label: (0,external_wp_i18n_namespaceObject.__)('Letter case'), - hasValue: hasTextTransform, - onDeselect: resetTextTransform, - isShownByDefault: defaultControls.textTransform, - panelId: panelId - }, (0,external_React_.createElement)(TextTransformControl, { - value: textTransform, - onChange: setTextTransform, - showNone: true, - isBlock: true, - size: "__unstable-large", - __nextHasNoMarginBottom: true - }))); + panelId: panelId, + children: [hasFontFamilyEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + label: (0,external_wp_i18n_namespaceObject.__)('Font'), + hasValue: hasFontFamily, + onDeselect: resetFontFamily, + isShownByDefault: defaultControls.fontFamily, + panelId: panelId, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FontFamilyControl, { + fontFamilies: mergedFontFamilies, + value: fontFamily, + onChange: setFontFamily, + size: "__unstable-large", + __nextHasNoMarginBottom: true + }) + }), hasFontSizeEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + label: (0,external_wp_i18n_namespaceObject.__)('Size'), + hasValue: hasFontSize, + onDeselect: resetFontSize, + isShownByDefault: defaultControls.fontSize, + panelId: panelId, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FontSizePicker, { + value: fontSize, + onChange: setFontSize, + fontSizes: mergedFontSizes, + disableCustomFontSizes: disableCustomFontSizes, + withReset: false, + withSlider: true, + size: "__unstable-large" + }) + }), hasAppearanceControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + className: "single-column", + label: appearanceControlLabel, + hasValue: hasFontAppearance, + onDeselect: resetFontAppearance, + isShownByDefault: defaultControls.fontAppearance, + panelId: panelId, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FontAppearanceControl, { + value: { + fontStyle, + fontWeight + }, + onChange: setFontAppearance, + hasFontStyles: hasFontStyles, + hasFontWeights: hasFontWeights, + size: "__unstable-large", + __nextHasNoMarginBottom: true + }) + }), hasLineHeightEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + className: "single-column", + label: (0,external_wp_i18n_namespaceObject.__)('Line height'), + hasValue: hasLineHeight, + onDeselect: resetLineHeight, + isShownByDefault: defaultControls.lineHeight, + panelId: panelId, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(line_height_control, { + __nextHasNoMarginBottom: true, + __unstableInputWidth: "auto", + value: lineHeight, + onChange: setLineHeight, + size: "__unstable-large" + }) + }), hasLetterSpacingControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + className: "single-column", + label: (0,external_wp_i18n_namespaceObject.__)('Letter spacing'), + hasValue: hasLetterSpacing, + onDeselect: resetLetterSpacing, + isShownByDefault: defaultControls.letterSpacing, + panelId: panelId, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LetterSpacingControl, { + value: letterSpacing, + onChange: setLetterSpacing, + size: "__unstable-large", + __unstableInputWidth: "auto" + }) + }), hasTextColumnsControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + className: "single-column", + label: (0,external_wp_i18n_namespaceObject.__)('Columns'), + hasValue: hasTextColumns, + onDeselect: resetTextColumns, + isShownByDefault: defaultControls.textColumns, + panelId: panelId, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Columns'), + max: MAX_TEXT_COLUMNS, + min: MIN_TEXT_COLUMNS, + onChange: setTextColumns, + size: "__unstable-large", + spinControls: "custom", + value: textColumns, + initialPosition: 1 + }) + }), hasTextDecorationControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + className: "single-column", + label: (0,external_wp_i18n_namespaceObject.__)('Decoration'), + hasValue: hasTextDecoration, + onDeselect: resetTextDecoration, + isShownByDefault: defaultControls.textDecoration, + panelId: panelId, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TextDecorationControl, { + value: textDecoration, + onChange: setTextDecoration, + size: "__unstable-large", + __unstableInputWidth: "auto" + }) + }), hasWritingModeControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + className: "single-column", + label: (0,external_wp_i18n_namespaceObject.__)('Orientation'), + hasValue: hasWritingMode, + onDeselect: resetWritingMode, + isShownByDefault: defaultControls.writingMode, + panelId: panelId, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WritingModeControl, { + value: writingMode, + onChange: setWritingMode, + size: "__unstable-large", + __nextHasNoMarginBottom: true + }) + }), hasTextTransformControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + label: (0,external_wp_i18n_namespaceObject.__)('Letter case'), + hasValue: hasTextTransform, + onDeselect: resetTextTransform, + isShownByDefault: defaultControls.textTransform, + panelId: panelId, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TextTransformControl, { + value: textTransform, + onChange: setTextTransform, + showNone: true, + isBlock: true, + size: "__unstable-large", + __nextHasNoMarginBottom: true + }) + }), hasTextAlignmentControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + label: (0,external_wp_i18n_namespaceObject.__)('Text alignment'), + hasValue: hasTextAlign, + onDeselect: resetTextAlign, + isShownByDefault: defaultControls.textAlign, + panelId: panelId, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TextAlignmentControl, { + value: textAlign, + onChange: setTextAlign, + size: "__unstable-large", + __nextHasNoMarginBottom: true + }) + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/line-height.js - /** * WordPress dependencies */ @@ -28390,6 +29182,7 @@ function TypographyPanel({ + const LINE_HEIGHT_SUPPORT_KEY = 'typography.lineHeight'; /** @@ -28418,7 +29211,7 @@ function LineHeightEdit(props) { style: cleanEmptyObject(newStyle) }); }; - return createElement(LineHeightControl, { + return /*#__PURE__*/_jsx(LineHeightControl, { __unstableInputWidth: "100%", __nextHasNoMarginBottom: true, value: style?.typography?.lineHeight, @@ -28459,6 +29252,9 @@ var external_wp_tokenList_default = /*#__PURE__*/__webpack_require__.n(external_ const FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily'; +const { + kebabCase: font_family_kebabCase +} = unlock(external_wp_components_namespaceObject.privateApis); /** * Filters registered block settings, extending attributes to include @@ -28504,10 +29300,7 @@ function font_family_addSaveProps(props, blockType, attributes) { // Use TokenList to dedupe classes. const classes = new (external_wp_tokenList_default())(props.className); - const { - kebabCase - } = unlock(external_wp_components_namespaceObject.privateApis); - classes.add(`has-${kebabCase(attributes?.fontFamily)}-font-family`); + classes.add(`has-${font_family_kebabCase(attributes?.fontFamily)}-font-family`); const newClassName = classes.value; props.className = newClassName ? newClassName : undefined; return props; @@ -28556,6 +29349,9 @@ function resetFontFamily({ * Internal dependencies */ +const { + kebabCase: utils_kebabCase +} = unlock(external_wp_components_namespaceObject.privateApis); /** * Returns the font size object based on an array of named font sizes and the namedFontSize and customFontSize values. @@ -28614,14 +29410,10 @@ function getFontSizeClass(fontSizeSlug) { if (!fontSizeSlug) { return; } - const { - kebabCase - } = unlock(external_wp_components_namespaceObject.privateApis); - return `has-${kebabCase(fontSizeSlug)}-font-size`; + return `has-${utils_kebabCase(fontSizeSlug)}-font-size`; } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/font-size.js - /** * WordPress dependencies */ @@ -28637,6 +29429,7 @@ function getFontSizeClass(fontSizeSlug) { + const FONT_SIZE_SUPPORT_KEY = 'typography.fontSize'; /** @@ -28719,7 +29512,7 @@ function FontSizeEdit(props) { }; const fontSizeObject = getFontSize(fontSizes, fontSize, style?.typography?.fontSize); const fontSizeValue = fontSizeObject?.size || style?.typography?.fontSize || fontSize; - return createElement(FontSizePicker, { + return /*#__PURE__*/_jsx(FontSizePicker, { onChange: onChange, value: fontSizeValue, withReset: false, @@ -28758,17 +29551,16 @@ function font_size_useBlockProps({ } let props; if (style?.typography?.fontSize) { - const fluidSettings = getFluidTypographyOptionsFromSettings({ - typography: { - fluid: fluidTypographySettings - }, - layout: layoutSettings - }); props = { style: { fontSize: getTypographyFontSizeValue({ size: style.typography.fontSize - }, fluidSettings) + }, { + typography: { + fluid: fluidTypographySettings + }, + layout: layoutSettings + }) } }; } @@ -28807,7 +29599,107 @@ function font_size_addTransforms(result, source, index, results) { (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/font/addAttribute', font_size_addAttributes); (0,external_wp_hooks_namespaceObject.addFilter)('blocks.switchToBlockType.transformedBlock', 'core/font-size/addTransforms', font_size_addTransforms); -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/typography.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/alignment-control/ui.js +/** + * WordPress dependencies + */ + + + + +const DEFAULT_ALIGNMENT_CONTROLS = [{ + icon: align_left, + title: (0,external_wp_i18n_namespaceObject.__)('Align text left'), + align: 'left' +}, { + icon: align_center, + title: (0,external_wp_i18n_namespaceObject.__)('Align text center'), + align: 'center' +}, { + icon: align_right, + title: (0,external_wp_i18n_namespaceObject.__)('Align text right'), + align: 'right' +}]; +const ui_POPOVER_PROPS = { + placement: 'bottom-start' +}; +function AlignmentUI({ + value, + onChange, + alignmentControls = DEFAULT_ALIGNMENT_CONTROLS, + label = (0,external_wp_i18n_namespaceObject.__)('Align text'), + describedBy = (0,external_wp_i18n_namespaceObject.__)('Change text alignment'), + isCollapsed = true, + isToolbar +}) { + function applyOrUnset(align) { + return () => onChange(value === align ? undefined : align); + } + const activeAlignment = alignmentControls.find(control => control.align === value); + function setIcon() { + if (activeAlignment) { + return activeAlignment.icon; + } + return (0,external_wp_i18n_namespaceObject.isRTL)() ? align_right : align_left; + } + const UIComponent = isToolbar ? external_wp_components_namespaceObject.ToolbarGroup : external_wp_components_namespaceObject.ToolbarDropdownMenu; + const extraProps = isToolbar ? { + isCollapsed + } : { + toggleProps: { + describedBy + }, + popoverProps: ui_POPOVER_PROPS + }; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(UIComponent, { + icon: setIcon(), + label: label, + controls: alignmentControls.map(control => { + const { + align + } = control; + const isActive = value === align; + return { + ...control, + isActive, + role: isCollapsed ? 'menuitemradio' : undefined, + onClick: applyOrUnset(align) + }; + }), + ...extraProps + }); +} +/* harmony default export */ const alignment_control_ui = (AlignmentUI); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/alignment-control/index.js +/** + * Internal dependencies + */ + + +const AlignmentControl = props => { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(alignment_control_ui, { + ...props, + isToolbar: false + }); +}; +const AlignmentToolbar = props => { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(alignment_control_ui, { + ...props, + isToolbar: true + }); +}; + +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/alignment-control/README.md + */ + + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/text-align.js +/** + * External dependencies + */ + /** * WordPress dependencies @@ -28824,6 +29716,150 @@ function font_size_addTransforms(result, source, index, results) { +const TEXT_ALIGN_SUPPORT_KEY = 'typography.textAlign'; +const text_align_TEXT_ALIGNMENT_OPTIONS = [{ + icon: align_left, + title: (0,external_wp_i18n_namespaceObject.__)('Align text left'), + align: 'left' +}, { + icon: align_center, + title: (0,external_wp_i18n_namespaceObject.__)('Align text center'), + align: 'center' +}, { + icon: align_right, + title: (0,external_wp_i18n_namespaceObject.__)('Align text right'), + align: 'right' +}]; +const VALID_TEXT_ALIGNMENTS = ['left', 'center', 'right']; +const NO_TEXT_ALIGNMENTS = []; + +/** + * Returns the valid text alignments. + * Takes into consideration the text aligns supported by a block. + * Exported just for testing purposes, not exported outside the module. + * + * @param {?boolean|string[]} blockTextAlign Text aligns supported by the block. + * + * @return {string[]} Valid text alignments. + */ +function getValidTextAlignments(blockTextAlign) { + if (Array.isArray(blockTextAlign)) { + return VALID_TEXT_ALIGNMENTS.filter(textAlign => blockTextAlign.includes(textAlign)); + } + return blockTextAlign === true ? VALID_TEXT_ALIGNMENTS : NO_TEXT_ALIGNMENTS; +} +function BlockEditTextAlignmentToolbarControlsPure({ + style, + name: blockName, + setAttributes +}) { + const settings = useBlockSettings(blockName); + const hasTextAlignControl = settings?.typography?.textAlign; + const blockEditingMode = useBlockEditingMode(); + if (!hasTextAlignControl || blockEditingMode !== 'default') { + return null; + } + const validTextAlignments = getValidTextAlignments((0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, TEXT_ALIGN_SUPPORT_KEY)); + if (!validTextAlignments.length) { + return null; + } + const textAlignmentControls = text_align_TEXT_ALIGNMENT_OPTIONS.filter(control => validTextAlignments.includes(control.align)); + const onChange = newTextAlignValue => { + const newStyle = { + ...style, + typography: { + ...style?.typography, + textAlign: newTextAlignValue + } + }; + setAttributes({ + style: utils_cleanEmptyObject(newStyle) + }); + }; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls, { + group: "block", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AlignmentControl, { + value: style?.typography?.textAlign, + onChange: onChange, + alignmentControls: textAlignmentControls + }) + }); +} +/* harmony default export */ const text_align = ({ + edit: BlockEditTextAlignmentToolbarControlsPure, + useBlockProps: text_align_useBlockProps, + addSaveProps: addAssignedTextAlign, + attributeKeys: ['style'], + hasSupport(name) { + return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, TEXT_ALIGN_SUPPORT_KEY, false); + } +}); +function text_align_useBlockProps({ + name, + style +}) { + if (!style?.typography?.textAlign) { + return null; + } + const validTextAlignments = getValidTextAlignments((0,external_wp_blocks_namespaceObject.getBlockSupport)(name, TEXT_ALIGN_SUPPORT_KEY)); + if (!validTextAlignments.length) { + return null; + } + if (shouldSkipSerialization(name, TYPOGRAPHY_SUPPORT_KEY, 'textAlign')) { + return null; + } + const textAlign = style.typography.textAlign; + const className = dist_clsx({ + [`has-text-align-${textAlign}`]: textAlign + }); + return { + className + }; +} + +/** + * Override props assigned to save component to inject text alignment class + * name if block supports it. + * + * @param {Object} props Additional props applied to save element. + * @param {Object} blockType Block type. + * @param {Object} attributes Block attributes. + * + * @return {Object} Filtered props applied to save element. + */ +function addAssignedTextAlign(props, blockType, attributes) { + if (!attributes?.style?.typography?.textAlign) { + return props; + } + const { + textAlign + } = attributes.style.typography; + const blockTextAlign = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, TEXT_ALIGN_SUPPORT_KEY); + const isTextAlignValid = getValidTextAlignments(blockTextAlign).includes(textAlign); + if (isTextAlignValid && !shouldSkipSerialization(blockType, TYPOGRAPHY_SUPPORT_KEY, 'textAlign')) { + props.className = dist_clsx(`has-text-align-${textAlign}`, props.className); + } + return props; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/typography.js +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + + + + + function omit(object, keys) { @@ -28837,7 +29873,7 @@ const FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle'; const FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight'; const WRITING_MODE_SUPPORT_KEY = 'typography.__experimentalWritingMode'; const TYPOGRAPHY_SUPPORT_KEY = 'typography'; -const TYPOGRAPHY_SUPPORT_KEYS = [LINE_HEIGHT_SUPPORT_KEY, FONT_SIZE_SUPPORT_KEY, FONT_STYLE_SUPPORT_KEY, FONT_WEIGHT_SUPPORT_KEY, FONT_FAMILY_SUPPORT_KEY, TEXT_COLUMNS_SUPPORT_KEY, TEXT_DECORATION_SUPPORT_KEY, WRITING_MODE_SUPPORT_KEY, TEXT_TRANSFORM_SUPPORT_KEY, LETTER_SPACING_SUPPORT_KEY]; +const TYPOGRAPHY_SUPPORT_KEYS = [LINE_HEIGHT_SUPPORT_KEY, FONT_SIZE_SUPPORT_KEY, FONT_STYLE_SUPPORT_KEY, FONT_WEIGHT_SUPPORT_KEY, FONT_FAMILY_SUPPORT_KEY, TEXT_ALIGN_SUPPORT_KEY, TEXT_COLUMNS_SUPPORT_KEY, TEXT_DECORATION_SUPPORT_KEY, WRITING_MODE_SUPPORT_KEY, TEXT_TRANSFORM_SUPPORT_KEY, LETTER_SPACING_SUPPORT_KEY]; function typography_styleToAttributes(style) { const updatedStyle = { ...omit(style, ['fontFamily']) @@ -28878,10 +29914,11 @@ function TypographyInspectorControl({ ...typography_styleToAttributes(updatedStyle) }; }, [resetAllFilter]); - return (0,external_React_.createElement)(inspector_controls, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls, { group: "typography", - resetAllFilter: attributesResetAllFilter - }, children); + resetAllFilter: attributesResetAllFilter, + children: children + }); } function typography_TypographyPanel({ clientId, @@ -28919,7 +29956,7 @@ function typography_TypographyPanel({ return null; } const defaultControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [TYPOGRAPHY_SUPPORT_KEY, '__experimentalDefaultControls']); - return (0,external_React_.createElement)(TypographyPanel, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TypographyPanel, { as: TypographyInspectorControl, panelId: clientId, settings: settings, @@ -28933,23 +29970,24 @@ const hasTypographySupport = blockName => { }; ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/settings.js - /** * WordPress dependencies */ -const settings_settings = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + + +const settings_settings = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z" -}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z" -})); + viewBox: "0 0 24 24", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z" + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z" + })] +}); /* harmony default export */ const library_settings = (settings_settings); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js - /** * WordPress dependencies */ @@ -28966,6 +30004,9 @@ const settings_settings = (0,external_React_.createElement)(external_wp_primitiv + + + const CUSTOM_VALUE_SETTINGS = { px: { max: 300, @@ -29097,12 +30138,13 @@ function SpacingInputControl({ // Treat value as a preset value if the passed in value matches the value of one of the spacingSizes. value = getPresetValueFromCustomValue(value, spacingSizes); let selectListSizes = spacingSizes; - const showRangeControl = spacingSizes.length <= 8; + const showRangeControl = spacingSizes.length <= RANGE_CONTROL_MAX_SIZE; const disableCustomSpacingSizes = (0,external_wp_data_namespaceObject.useSelect)(select => { const editorSettings = select(store).getSettings(); return editorSettings?.disableCustomSpacingSizes; }); const [showCustomValueControl, setShowCustomValueControl] = (0,external_wp_element_namespaceObject.useState)(!disableCustomSpacingSizes && value !== undefined && !isValueSpacingPreset(value)); + const [minValue, setMinValue] = (0,external_wp_element_namespaceObject.useState)(minimumCustomValue); const previousValue = (0,external_wp_compose_namespaceObject.usePrevious)(value); if (!!value && previousValue !== value && !isValueSpacingPreset(value) && showCustomValueControl !== true) { setShowCustomValueControl(true); @@ -29169,101 +30211,117 @@ function SpacingInputControl({ const ariaLabel = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: The side of the block being modified (top, bottom, left, All sides etc.). 2. Type of spacing being modified (Padding, margin, etc) (0,external_wp_i18n_namespaceObject.__)('%1$s %2$s'), sideLabel, typeLabel).trim(); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { - className: "spacing-sizes-control__wrapper" - }, icon && (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, { - className: "spacing-sizes-control__icon", - icon: icon, - size: 24 - }), showCustomValueControl && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, { - onMouseOver: onMouseOver, - onMouseOut: onMouseOut, - onFocus: onMouseOver, - onBlur: onMouseOut, - onChange: newSize => onChange(getNewCustomValue(newSize)), - value: currentValue, - units: units, - min: minimumCustomValue, - placeholder: allPlaceholder, - disableUnits: isMixed, - label: ariaLabel, - hideLabelFromVision: true, - className: "spacing-sizes-control__custom-value-input", - size: '__unstable-large' - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.RangeControl, { - onMouseOver: onMouseOver, - onMouseOut: onMouseOut, - onFocus: onMouseOver, - onBlur: onMouseOut, - value: customRangeValue, - min: 0, - max: (_CUSTOM_VALUE_SETTING = CUSTOM_VALUE_SETTINGS[selectedUnit]?.max) !== null && _CUSTOM_VALUE_SETTING !== void 0 ? _CUSTOM_VALUE_SETTING : 10, - step: (_CUSTOM_VALUE_SETTING2 = CUSTOM_VALUE_SETTINGS[selectedUnit]?.steps) !== null && _CUSTOM_VALUE_SETTING2 !== void 0 ? _CUSTOM_VALUE_SETTING2 : 0.1, - withInputField: false, - onChange: handleCustomValueSliderChange, - className: "spacing-sizes-control__custom-value-range", - __nextHasNoMarginBottom: true - })), showRangeControl && !showCustomValueControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.RangeControl, { - onMouseOver: onMouseOver, - onMouseOut: onMouseOut, - className: "spacing-sizes-control__range-control", - value: currentValue, - onChange: newSize => onChange(getNewPresetValue(newSize)), - onMouseDown: event => { - // If mouse down is near start of range set initial value to 0, which - // prevents the user have to drag right then left to get 0 setting. - if (event?.nativeEvent?.offsetX < 35) { - setInitialValue(); - } - }, - withInputField: false, - "aria-valuenow": currentValue, - "aria-valuetext": spacingSizes[currentValue]?.name, - renderTooltipContent: customTooltipContent, - min: 0, - max: spacingSizes.length - 1, - marks: marks, - label: ariaLabel, - hideLabelFromVision: true, - __nextHasNoMarginBottom: true, - onFocus: onMouseOver, - onBlur: onMouseOut - }), !showRangeControl && !showCustomValueControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.CustomSelectControl, { - className: "spacing-sizes-control__custom-select-control", - value: options.find(option => option.key === currentValue) || '' // passing undefined here causes a downshift controlled/uncontrolled warning - , - onChange: selection => { - onChange(getNewPresetValue(selection.selectedItem.key, 'selectList')); - }, - options: options, - label: ariaLabel, - hideLabelFromVision: true, - __nextUnconstrainedWidth: true, - size: '__unstable-large', - onMouseOver: onMouseOver, - onMouseOut: onMouseOut, - onFocus: onMouseOver, - onBlur: onMouseOut - }), !disableCustomSpacingSizes && (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - label: showCustomValueControl ? (0,external_wp_i18n_namespaceObject.__)('Use size preset') : (0,external_wp_i18n_namespaceObject.__)('Set custom size'), - icon: library_settings, - onClick: () => { - setShowCustomValueControl(!showCustomValueControl); - }, - isPressed: showCustomValueControl, - size: "small", - className: "spacing-sizes-control__custom-toggle", - iconSize: 24 - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { + className: "spacing-sizes-control__wrapper", + children: [icon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { + className: "spacing-sizes-control__icon", + icon: icon, + size: 24 + }), showCustomValueControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { + onMouseOver: onMouseOver, + onMouseOut: onMouseOut, + onFocus: onMouseOver, + onBlur: onMouseOut, + onChange: newSize => onChange(getNewCustomValue(newSize)), + value: currentValue, + units: units, + min: minValue, + placeholder: allPlaceholder, + disableUnits: isMixed, + label: ariaLabel, + hideLabelFromVision: true, + className: "spacing-sizes-control__custom-value-input", + size: "__unstable-large", + onDragStart: () => { + if (value?.charAt(0) === '-') { + setMinValue(0); + } + }, + onDrag: () => { + if (value?.charAt(0) === '-') { + setMinValue(0); + } + }, + onDragEnd: () => { + setMinValue(minimumCustomValue); + } + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, { + onMouseOver: onMouseOver, + onMouseOut: onMouseOut, + onFocus: onMouseOver, + onBlur: onMouseOut, + value: customRangeValue, + min: 0, + max: (_CUSTOM_VALUE_SETTING = CUSTOM_VALUE_SETTINGS[selectedUnit]?.max) !== null && _CUSTOM_VALUE_SETTING !== void 0 ? _CUSTOM_VALUE_SETTING : 10, + step: (_CUSTOM_VALUE_SETTING2 = CUSTOM_VALUE_SETTINGS[selectedUnit]?.steps) !== null && _CUSTOM_VALUE_SETTING2 !== void 0 ? _CUSTOM_VALUE_SETTING2 : 0.1, + withInputField: false, + onChange: handleCustomValueSliderChange, + className: "spacing-sizes-control__custom-value-range", + __nextHasNoMarginBottom: true + })] + }), showRangeControl && !showCustomValueControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, { + onMouseOver: onMouseOver, + onMouseOut: onMouseOut, + className: "spacing-sizes-control__range-control", + value: currentValue, + onChange: newSize => onChange(getNewPresetValue(newSize)), + onMouseDown: event => { + // If mouse down is near start of range set initial value to 0, which + // prevents the user have to drag right then left to get 0 setting. + if (event?.nativeEvent?.offsetX < 35) { + setInitialValue(); + } + }, + withInputField: false, + "aria-valuenow": currentValue, + "aria-valuetext": spacingSizes[currentValue]?.name, + renderTooltipContent: customTooltipContent, + min: 0, + max: spacingSizes.length - 1, + marks: marks, + label: ariaLabel, + hideLabelFromVision: true, + __nextHasNoMarginBottom: true, + onFocus: onMouseOver, + onBlur: onMouseOut + }), !showRangeControl && !showCustomValueControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CustomSelectControl, { + className: "spacing-sizes-control__custom-select-control", + value: options.find(option => option.key === currentValue) || '' // passing undefined here causes a downshift controlled/uncontrolled warning + , + onChange: selection => { + onChange(getNewPresetValue(selection.selectedItem.key, 'selectList')); + }, + options: options, + label: ariaLabel, + hideLabelFromVision: true, + size: "__unstable-large", + onMouseOver: onMouseOver, + onMouseOut: onMouseOut, + onFocus: onMouseOver, + onBlur: onMouseOut + }), !disableCustomSpacingSizes && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + label: showCustomValueControl ? (0,external_wp_i18n_namespaceObject.__)('Use size preset') : (0,external_wp_i18n_namespaceObject.__)('Set custom size'), + icon: library_settings, + onClick: () => { + setShowCustomValueControl(!showCustomValueControl); + }, + isPressed: showCustomValueControl, + size: "small", + className: "spacing-sizes-control__custom-toggle", + iconSize: 24 + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/input-controls/axial.js - /** * Internal dependencies */ + + const groupedSides = ['vertical', 'horizontal']; function AxialInputControls({ minimumCustomValue, @@ -29300,32 +30358,34 @@ function AxialInputControls({ // Filter sides if custom configuration provided, maintaining default order. const filteredSides = sides?.length ? groupedSides.filter(side => hasAxisSupport(sides, side)) : groupedSides; - return (0,external_React_.createElement)(external_React_.Fragment, null, filteredSides.map(side => { - const axisValue = side === 'vertical' ? values.top : values.left; - return (0,external_React_.createElement)(SpacingInputControl, { - key: `spacing-sizes-control-${side}`, - icon: ICONS[side], - label: LABELS[side], - minimumCustomValue: minimumCustomValue, - onChange: createHandleOnChange(side), - onMouseOut: onMouseOut, - onMouseOver: onMouseOver, - side: side, - spacingSizes: spacingSizes, - type: type, - value: axisValue, - withInputField: false - }); - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: filteredSides.map(side => { + const axisValue = side === 'vertical' ? values.top : values.left; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SpacingInputControl, { + icon: ICONS[side], + label: LABELS[side], + minimumCustomValue: minimumCustomValue, + onChange: createHandleOnChange(side), + onMouseOut: onMouseOut, + onMouseOver: onMouseOver, + side: side, + spacingSizes: spacingSizes, + type: type, + value: axisValue, + withInputField: false + }, `spacing-sizes-control-${side}`); + }) + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/input-controls/separated.js - /** * Internal dependencies */ + + function SeparatedInputControls({ minimumCustomValue, onChange, @@ -29349,31 +30409,32 @@ function SeparatedInputControls({ nextValues[side] = next; onChange(nextValues); }; - return (0,external_React_.createElement)(external_React_.Fragment, null, filteredSides.map(side => { - return (0,external_React_.createElement)(SpacingInputControl, { - key: `spacing-sizes-control-${side}`, - icon: ICONS[side], - label: LABELS[side], - minimumCustomValue: minimumCustomValue, - onChange: createHandleOnChange(side), - onMouseOut: onMouseOut, - onMouseOver: onMouseOver, - side: side, - spacingSizes: spacingSizes, - type: type, - value: values[side], - withInputField: false - }); - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: filteredSides.map(side => { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SpacingInputControl, { + icon: ICONS[side], + label: LABELS[side], + minimumCustomValue: minimumCustomValue, + onChange: createHandleOnChange(side), + onMouseOut: onMouseOut, + onMouseOver: onMouseOver, + side: side, + spacingSizes: spacingSizes, + type: type, + value: values[side], + withInputField: false + }, `spacing-sizes-control-${side}`); + }) + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/input-controls/single.js - /** * Internal dependencies */ + function SingleInputControl({ minimumCustomValue, onChange, @@ -29396,7 +30457,7 @@ function SingleInputControl({ nextValues[currentSide] = next; onChange(nextValues); }; - return (0,external_React_.createElement)(SpacingInputControl, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SpacingInputControl, { label: LABELS[side], minimumCustomValue: minimumCustomValue, onChange: createHandleOnChange(side), @@ -29412,7 +30473,6 @@ function SingleInputControl({ } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/sides-dropdown/index.js - /** * WordPress dependencies */ @@ -29423,7 +30483,10 @@ function SingleInputControl({ * Internal dependencies */ -const checkIcon = (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, { + + + +const checkIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: library_check, size: 24 }); @@ -29442,44 +30505,52 @@ function SidesDropdown({ custom: customItem, ...menuItems } = supportedItems; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.DropdownMenu, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { icon: sideIcon, label: labelProp, className: "spacing-sizes-control__dropdown", toggleProps: { - isSmall: true + size: 'small' + }, + children: ({ + onClose + }) => { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { + children: Object.entries(menuItems).map(([slug, { + label, + icon + }]) => { + const isSelected = value === slug; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { + icon: icon, + iconPosition: "left", + isSelected: isSelected, + role: "menuitemradio", + onClick: () => { + onChange(slug); + onClose(); + }, + suffix: isSelected ? checkIcon : undefined, + children: label + }, slug); + }) + }), !!customItem && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { + icon: customItem.icon, + iconPosition: "left", + isSelected: value === VIEWS.custom, + role: "menuitemradio", + onClick: () => { + onChange(VIEWS.custom); + onClose(); + }, + suffix: value === VIEWS.custom ? checkIcon : undefined, + children: customItem.label + }) + })] + }); } - }, ({ - onClose - }) => { - return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, Object.entries(menuItems).map(([slug, { - label, - icon - }]) => { - const isSelected = value === slug; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { - key: slug, - icon: icon, - iconPosition: "left", - isSelected: isSelected, - role: "menuitemradio", - onClick: () => { - onChange(slug); - onClose(); - }, - suffix: isSelected ? checkIcon : undefined - }, label); - })), !!customItem && (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { - icon: customItem.icon, - iconPosition: "left", - isSelected: value === VIEWS.custom, - role: "menuitemradio", - onClick: () => { - onChange(VIEWS.custom); - onClose(); - }, - suffix: value === VIEWS.custom ? checkIcon : undefined - }, customItem.label))); }); } @@ -29489,32 +30560,43 @@ function SidesDropdown({ */ + /** * Internal dependencies */ + +const use_spacing_sizes_EMPTY_ARRAY = []; +const compare = new Intl.Collator('und', { + numeric: true +}).compare; function useSpacingSizes() { - const spacingSizes = [{ - name: 0, - slug: '0', - size: 0 - }]; - const [settingsSizes] = use_settings_useSettings('spacing.spacingSizes'); - if (settingsSizes) { - spacingSizes.push(...settingsSizes); - } - if (spacingSizes.length > 8) { - spacingSizes.unshift({ + const [customSpacingSizes, themeSpacingSizes, defaultSpacingSizes, defaultSpacingSizesEnabled] = use_settings_useSettings('spacing.spacingSizes.custom', 'spacing.spacingSizes.theme', 'spacing.spacingSizes.default', 'spacing.defaultSpacingSizes'); + const customSizes = customSpacingSizes !== null && customSpacingSizes !== void 0 ? customSpacingSizes : use_spacing_sizes_EMPTY_ARRAY; + const themeSizes = themeSpacingSizes !== null && themeSpacingSizes !== void 0 ? themeSpacingSizes : use_spacing_sizes_EMPTY_ARRAY; + const defaultSizes = defaultSpacingSizes && defaultSpacingSizesEnabled !== false ? defaultSpacingSizes : use_spacing_sizes_EMPTY_ARRAY; + return (0,external_wp_element_namespaceObject.useMemo)(() => { + const sizes = [{ + name: (0,external_wp_i18n_namespaceObject.__)('None'), + slug: '0', + size: 0 + }, ...customSizes, ...themeSizes, ...defaultSizes]; + + // Using numeric slugs opts-in to sorting by slug. + if (sizes.every(({ + slug + }) => /^[0-9]/.test(slug))) { + sizes.sort((a, b) => compare(a.slug, b.slug)); + } + return sizes.length > RANGE_CONTROL_MAX_SIZE ? [{ name: (0,external_wp_i18n_namespaceObject.__)('Default'), slug: 'default', size: undefined - }); - } - return spacingSizes; + }, ...sizes] : sizes; + }, [customSizes, themeSizes, defaultSizes]); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/index.js - /** * WordPress dependencies */ @@ -29531,6 +30613,8 @@ function useSpacingSizes() { + + function SpacingSizesControl({ inputProps, label: labelProp, @@ -29569,16 +30653,16 @@ function SpacingSizesControl({ }; const renderControls = () => { if (view === VIEWS.axial) { - return (0,external_React_.createElement)(AxialInputControls, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AxialInputControls, { ...inputControlProps }); } if (view === VIEWS.custom) { - return (0,external_React_.createElement)(SeparatedInputControls, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SeparatedInputControls, { ...inputControlProps }); } - return (0,external_React_.createElement)(SingleInputControl, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SingleInputControl, { side: view, ...inputControlProps, showSideInLabel: showSideInLabel @@ -29591,25 +30675,28 @@ function SpacingSizesControl({ const dropdownLabelText = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The current spacing property e.g. "Padding", "Margin". (0,external_wp_i18n_namespaceObject._x)('%s options', 'Button label to reveal side configuration options'), labelProp); - return (0,external_React_.createElement)("fieldset", { - className: "spacing-sizes-control" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { - className: "spacing-sizes-control__header" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { - as: "legend", - className: "spacing-sizes-control__label" - }, label), !hasOneSide && !hasOnlyAxialSides && (0,external_React_.createElement)(SidesDropdown, { - label: dropdownLabelText, - onChange: setView, - sides: sides, - value: view - })), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { - spacing: 0.5 - }, renderControls())); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { + className: "spacing-sizes-control", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { + className: "spacing-sizes-control__header", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { + as: "legend", + className: "spacing-sizes-control__label", + children: label + }), !hasOneSide && !hasOnlyAxialSides && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SidesDropdown, { + label: dropdownLabelText, + onChange: setView, + sides: sides, + value: view + })] + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { + spacing: 0.5, + children: renderControls() + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/height-control/index.js - /** * WordPress dependencies */ @@ -29621,6 +30708,8 @@ function SpacingSizesControl({ * Internal dependencies */ + + const RANGE_CONTROL_CUSTOM_SETTINGS = { px: { max: 1000, @@ -29778,47 +30867,56 @@ function HeightControl({ onChange(100 + newUnit); } }; - return (0,external_React_.createElement)("fieldset", { - className: "block-editor-height-control" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { - as: "legend" - }, label), (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, { - isBlock: true - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, { - value: value, - units: units, - onChange: onChange, - onUnitChange: handleUnitChange, - min: 0, - size: '__unstable-large', - label: label, - hideLabelFromVision: true - })), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, { - isBlock: true - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, { - marginX: 2, - marginBottom: 0 - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.RangeControl, { - value: customRangeValue, - min: 0, - max: (_RANGE_CONTROL_CUSTOM = RANGE_CONTROL_CUSTOM_SETTINGS[selectedUnit]?.max) !== null && _RANGE_CONTROL_CUSTOM !== void 0 ? _RANGE_CONTROL_CUSTOM : 100, - step: (_RANGE_CONTROL_CUSTOM2 = RANGE_CONTROL_CUSTOM_SETTINGS[selectedUnit]?.step) !== null && _RANGE_CONTROL_CUSTOM2 !== void 0 ? _RANGE_CONTROL_CUSTOM2 : 0.1, - withInputField: false, - onChange: handleSliderChange, - __nextHasNoMarginBottom: true, - label: label, - hideLabelFromVision: true - }))))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { + className: "block-editor-height-control", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { + as: "legend", + children: label + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { + isBlock: true, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { + value: value, + units: units, + onChange: onChange, + onUnitChange: handleUnitChange, + min: 0, + size: "__unstable-large", + label: label, + hideLabelFromVision: true + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { + isBlock: true, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { + marginX: 2, + marginBottom: 0, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, { + value: customRangeValue, + min: 0, + max: (_RANGE_CONTROL_CUSTOM = RANGE_CONTROL_CUSTOM_SETTINGS[selectedUnit]?.max) !== null && _RANGE_CONTROL_CUSTOM !== void 0 ? _RANGE_CONTROL_CUSTOM : 100, + step: (_RANGE_CONTROL_CUSTOM2 = RANGE_CONTROL_CUSTOM_SETTINGS[selectedUnit]?.step) !== null && _RANGE_CONTROL_CUSTOM2 !== void 0 ? _RANGE_CONTROL_CUSTOM2 : 0.1, + withInputField: false, + onChange: handleSliderChange, + __nextHasNoMarginBottom: true, + label: label, + hideLabelFromVision: true + }) + }) + })] + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/child-layout-control/index.js - /** * WordPress dependencies */ + + + function helpText(selfStretch, parentLayout) { const { orientation = 'horizontal' @@ -29837,22 +30935,60 @@ function helpText(selfStretch, parentLayout) { /** * Form to edit the child layout value. * - * @param {Object} props Props. - * @param {Object} props.value The child layout value. - * @param {Function} props.onChange Function to update the child layout value. - * @param {Object} props.parentLayout The parent layout value. + * @param {Object} props Props. + * @param {Object} props.value The child layout value. + * @param {Function} props.onChange Function to update the child layout value. + * @param {Object} props.parentLayout The parent layout value. * + * @param {boolean} props.isShownByDefault + * @param {string} props.panelId * @return {Element} child layout edit element. */ function ChildLayoutControl({ value: childLayout = {}, onChange, - parentLayout + parentLayout, + isShownByDefault, + panelId }) { const { selfStretch, - flexSize + flexSize, + columnStart, + rowStart, + columnSpan, + rowSpan } = childLayout; + const { + type: parentType, + default: { + type: defaultParentType = 'default' + } = {}, + orientation = 'horizontal' + } = parentLayout !== null && parentLayout !== void 0 ? parentLayout : {}; + const parentLayoutType = parentType || defaultParentType; + const hasFlexValue = () => !!selfStretch; + const flexResetLabel = orientation === 'horizontal' ? (0,external_wp_i18n_namespaceObject.__)('Width') : (0,external_wp_i18n_namespaceObject.__)('Height'); + const resetFlex = () => { + onChange({ + selfStretch: undefined, + flexSize: undefined + }); + }; + const hasStartValue = () => !!columnStart || !!rowStart; + const hasSpanValue = () => !!columnSpan || !!rowSpan; + const resetGridStarts = () => { + onChange({ + columnStart: undefined, + rowStart: undefined + }); + }; + const resetGridSpans = () => { + onChange({ + columnSpan: undefined, + rowSpan: undefined + }); + }; (0,external_wp_element_namespaceObject.useEffect)(() => { if (selfStretch === 'fixed' && !flexSize) { onChange({ @@ -29861,43 +30997,142 @@ function ChildLayoutControl({ }); } }, []); - return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { - __nextHasNoMarginBottom: true, - size: '__unstable-large', - label: childLayoutOrientation(parentLayout), - value: selfStretch || 'fit', - help: helpText(selfStretch, parentLayout), - onChange: value => { - const newFlexSize = value !== 'fixed' ? null : flexSize; - onChange({ - ...childLayout, - selfStretch: value, - flexSize: newFlexSize - }); - }, - isBlock: true - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { - key: 'fit', - value: 'fit', - label: (0,external_wp_i18n_namespaceObject.__)('Fit') - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { - key: 'fill', - value: 'fill', - label: (0,external_wp_i18n_namespaceObject.__)('Fill') - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { - key: 'fixed', - value: 'fixed', - label: (0,external_wp_i18n_namespaceObject.__)('Fixed') - })), selfStretch === 'fixed' && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, { - size: '__unstable-large', - onChange: value => { - onChange({ - ...childLayout, - flexSize: value - }); - }, - value: flexSize - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [parentLayoutType === 'flex' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { + as: external_wp_components_namespaceObject.__experimentalToolsPanelItem, + spacing: 2, + hasValue: hasFlexValue, + label: flexResetLabel, + onDeselect: resetFlex, + isShownByDefault: isShownByDefault, + panelId: panelId, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { + __nextHasNoMarginBottom: true, + size: "__unstable-large", + label: childLayoutOrientation(parentLayout), + value: selfStretch || 'fit', + help: helpText(selfStretch, parentLayout), + onChange: value => { + const newFlexSize = value !== 'fixed' ? null : flexSize; + onChange({ + selfStretch: value, + flexSize: newFlexSize + }); + }, + isBlock: true, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { + value: "fit", + label: (0,external_wp_i18n_namespaceObject.__)('Fit') + }, "fit"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { + value: "fill", + label: (0,external_wp_i18n_namespaceObject.__)('Fill') + }, "fill"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { + value: "fixed", + label: (0,external_wp_i18n_namespaceObject.__)('Fixed') + }, "fixed")] + }), selfStretch === 'fixed' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { + size: "__unstable-large", + onChange: value => { + onChange({ + selfStretch, + flexSize: value + }); + }, + value: flexSize + })] + }), parentLayoutType === 'grid' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { + as: external_wp_components_namespaceObject.__experimentalToolsPanelItem, + hasValue: hasSpanValue, + label: (0,external_wp_i18n_namespaceObject.__)('Grid span'), + onDeselect: resetGridSpans, + isShownByDefault: isShownByDefault, + panelId: panelId, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, { + size: "__unstable-large", + label: (0,external_wp_i18n_namespaceObject.__)('Column span'), + type: "number", + onChange: value => { + onChange({ + columnStart, + rowStart, + rowSpan, + columnSpan: value + }); + }, + value: columnSpan, + min: 1 + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, { + size: "__unstable-large", + label: (0,external_wp_i18n_namespaceObject.__)('Row span'), + type: "number", + onChange: value => { + onChange({ + columnStart, + rowStart, + columnSpan, + rowSpan: value + }); + }, + value: rowSpan, + min: 1 + })] + }), window.__experimentalEnableGridInteractivity && + /*#__PURE__*/ + // Use Flex with an explicit width on the FlexItem instead of HStack to + // work around an issue in webkit where inputs with a max attribute are + // sized incorrectly. + (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { + as: external_wp_components_namespaceObject.__experimentalToolsPanelItem, + hasValue: hasStartValue, + label: (0,external_wp_i18n_namespaceObject.__)('Grid placement'), + onDeselect: resetGridStarts, + isShownByDefault: false, + panelId: panelId, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { + style: { + width: '50%' + }, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, { + size: "__unstable-large", + label: (0,external_wp_i18n_namespaceObject.__)('Column'), + type: "number", + onChange: value => { + onChange({ + columnStart: value, + rowStart, + columnSpan, + rowSpan + }); + }, + value: columnStart, + min: 1, + max: parentLayout?.columnCount ? parentLayout.columnCount - (columnSpan !== null && columnSpan !== void 0 ? columnSpan : 1) + 1 : undefined + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { + style: { + width: '50%' + }, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControl, { + size: "__unstable-large", + label: (0,external_wp_i18n_namespaceObject.__)('Row'), + type: "number", + onChange: value => { + onChange({ + columnStart, + rowStart: value, + columnSpan, + rowSpan + }); + }, + value: rowStart, + min: 1, + max: parentLayout?.rowCount ? parentLayout.rowCount - (rowSpan !== null && rowSpan !== void 0 ? rowSpan : 1) + 1 : undefined + }) + })] + })] + })] + }); } function childLayoutOrientation(parentLayout) { const { @@ -29907,50 +31142,19 @@ function childLayoutOrientation(parentLayout) { } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/dimensions-tool/aspect-ratio-tool.js - /** * WordPress dependencies */ - /** - * @typedef {import('@wordpress/components/build-types/select-control/types').SelectControlProps} SelectControlProps + * Internal dependencies */ + /** - * @type {SelectControlProps[]} + * @typedef {import('@wordpress/components/build-types/select-control/types').SelectControlProps} SelectControlProps */ -const DEFAULT_ASPECT_RATIO_OPTIONS = [{ - label: (0,external_wp_i18n_namespaceObject._x)('Original', 'Aspect ratio option for dimensions control'), - value: 'auto' -}, { - label: (0,external_wp_i18n_namespaceObject._x)('Square - 1:1', 'Aspect ratio option for dimensions control'), - value: '1' -}, { - label: (0,external_wp_i18n_namespaceObject._x)('Standard - 4:3', 'Aspect ratio option for dimensions control'), - value: '4/3' -}, { - label: (0,external_wp_i18n_namespaceObject._x)('Portrait - 3:4', 'Aspect ratio option for dimensions control'), - value: '3/4' -}, { - label: (0,external_wp_i18n_namespaceObject._x)('Classic - 3:2', 'Aspect ratio option for dimensions control'), - value: '3/2' -}, { - label: (0,external_wp_i18n_namespaceObject._x)('Classic Portrait - 2:3', 'Aspect ratio option for dimensions control'), - value: '2/3' -}, { - label: (0,external_wp_i18n_namespaceObject._x)('Wide - 16:9', 'Aspect ratio option for dimensions control'), - value: '16/9' -}, { - label: (0,external_wp_i18n_namespaceObject._x)('Tall - 9:16', 'Aspect ratio option for dimensions control'), - value: '9/16' -}, { - label: (0,external_wp_i18n_namespaceObject._x)('Custom', 'Aspect ratio option for dimensions control'), - value: 'custom', - disabled: true, - hidden: true -}]; /** * @callback AspectRatioToolPropsOnChange @@ -29972,31 +31176,55 @@ function AspectRatioTool({ panelId, value, onChange = () => {}, - options = DEFAULT_ASPECT_RATIO_OPTIONS, - defaultValue = DEFAULT_ASPECT_RATIO_OPTIONS[0].value, + options, + defaultValue = 'auto', hasValue, isShownByDefault = true }) { // Match the CSS default so if the value is used directly in CSS it will look correct in the control. const displayValue = value !== null && value !== void 0 ? value : 'auto'; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + const [defaultRatios, themeRatios, showDefaultRatios] = use_settings_useSettings('dimensions.aspectRatios.default', 'dimensions.aspectRatios.theme', 'dimensions.defaultAspectRatios'); + const themeOptions = themeRatios?.map(({ + name, + ratio + }) => ({ + label: name, + value: ratio + })); + const defaultOptions = defaultRatios?.map(({ + name, + ratio + }) => ({ + label: name, + value: ratio + })); + const aspectRatioOptions = [{ + label: (0,external_wp_i18n_namespaceObject._x)('Original', 'Aspect ratio option for dimensions control'), + value: 'auto' + }, ...(showDefaultRatios ? defaultOptions : []), ...(themeOptions ? themeOptions : []), { + label: (0,external_wp_i18n_namespaceObject._x)('Custom', 'Aspect ratio option for dimensions control'), + value: 'custom', + disabled: true, + hidden: true + }]; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { hasValue: hasValue ? hasValue : () => displayValue !== defaultValue, label: (0,external_wp_i18n_namespaceObject.__)('Aspect ratio'), onDeselect: () => onChange(undefined), isShownByDefault: isShownByDefault, - panelId: panelId - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.SelectControl, { - label: (0,external_wp_i18n_namespaceObject.__)('Aspect ratio'), - value: displayValue, - options: options, - onChange: onChange, - size: '__unstable-large', - __nextHasNoMarginBottom: true - })); + panelId: panelId, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Aspect ratio'), + value: displayValue, + options: options !== null && options !== void 0 ? options : aspectRatioOptions, + onChange: onChange, + size: "__unstable-large", + __nextHasNoMarginBottom: true + }) + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/dimensions-panel.js - /** * External dependencies */ @@ -30020,6 +31248,8 @@ function AspectRatioTool({ + + const AXIAL_SIDES = ['horizontal', 'vertical']; function useHasDimensionsPanel(settings) { const hasContentSize = useHasContentSize(settings); @@ -30062,18 +31292,15 @@ function useHasChildLayout(settings) { } = {}, allowSizingOnChildren = false } = (_settings$parentLayou = settings?.parentLayout) !== null && _settings$parentLayou !== void 0 ? _settings$parentLayou : {}; - const support = (defaultParentLayoutType === 'flex' || parentLayoutType === 'flex') && allowSizingOnChildren; + const support = (defaultParentLayoutType === 'flex' || parentLayoutType === 'flex' || defaultParentLayoutType === 'grid' || parentLayoutType === 'grid') && allowSizingOnChildren; return !!settings?.layout && support; } function useHasSpacingPresets(settings) { - var _ref, _ref2; const { - custom, - theme, - default: defaultPresets - } = settings?.spacing?.spacingSizes || {}; - const presets = (_ref = (_ref2 = custom !== null && custom !== void 0 ? custom : theme) !== null && _ref2 !== void 0 ? _ref2 : defaultPresets) !== null && _ref !== void 0 ? _ref : []; - return presets.length > 0; + defaultSpacingSizes, + spacingSizes + } = settings?.spacing || {}; + return defaultSpacingSizes !== false && spacingSizes?.default?.length > 0 || spacingSizes?.theme?.length > 0 || spacingSizes?.custom?.length > 0; } function filterValuesBySides(values, sides) { // If no custom side configuration, all sides are opted into by default. @@ -30134,16 +31361,18 @@ function DimensionsToolsPanel({ panelId, children }) { + const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const resetAll = () => { const updatedValue = resetAllFilter(value); onChange(updatedValue); }; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanel, { label: (0,external_wp_i18n_namespaceObject.__)('Dimensions'), resetAll: resetAll, panelId: panelId, - dropdownMenuProps: TOOLSPANEL_DROPDOWNMENU_PROPS - }, children); + dropdownMenuProps: dropdownMenuProps, + children: children + }); } const dimensions_panel_DEFAULT_CONTROLS = { contentSize: true, @@ -30168,7 +31397,7 @@ function DimensionsPanel({ // in global styles but not in block inspector. includeLayoutControls = false }) { - var _settings$parentLayou2, _defaultControls$cont, _defaultControls$wide, _defaultControls$padd, _defaultControls$marg, _defaultControls$bloc, _defaultControls$minH, _defaultControls$aspe, _defaultControls$chil; + var _defaultControls$cont, _defaultControls$wide, _defaultControls$padd, _defaultControls$marg, _defaultControls$bloc, _defaultControls$chil, _defaultControls$minH, _defaultControls$aspe; const { dimensions, spacing @@ -30197,6 +31426,10 @@ function DimensionsPanel({ availableUnits: settings?.spacing?.units || ['%', 'px', 'em', 'rem', 'vw'] }); + //Minimum Margin Value + const minimumMargin = -Infinity; + const [minMarginValue, setMinMarginValue] = (0,external_wp_element_namespaceObject.useState)(minimumMargin); + // Content Size const showContentSizeControl = useHasContentSize(settings) && includeLayoutControls; const contentSizeValue = decodeValue(inheritedValue?.layout?.contentSize); @@ -30295,26 +31528,14 @@ function DimensionsPanel({ // Child Layout const showChildLayoutControl = useHasChildLayout(settings); const childLayout = inheritedValue?.layout; - const { - orientation = 'horizontal' - } = (_settings$parentLayou2 = settings?.parentLayout) !== null && _settings$parentLayou2 !== void 0 ? _settings$parentLayou2 : {}; - const childLayoutOrientationLabel = orientation === 'horizontal' ? (0,external_wp_i18n_namespaceObject.__)('Width') : (0,external_wp_i18n_namespaceObject.__)('Height'); const setChildLayout = newChildLayout => { onChange({ ...value, layout: { - ...value?.layout, ...newChildLayout } }); }; - const resetChildLayoutValue = () => { - setChildLayout({ - selfStretch: undefined, - flexSize: undefined - }); - }; - const hasChildLayoutValue = () => !!value?.layout; const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(previousValue => { return { ...previousValue, @@ -30323,7 +31544,11 @@ function DimensionsPanel({ contentSize: undefined, wideSize: undefined, selfStretch: undefined, - flexSize: undefined + flexSize: undefined, + columnStart: undefined, + rowStart: undefined, + columnSpan: undefined, + rowSpan: undefined }), spacing: { ...previousValue?.spacing, @@ -30339,492 +31564,305 @@ function DimensionsPanel({ }; }, []); const onMouseLeaveControls = () => onVisualize(false); - return (0,external_React_.createElement)(Wrapper, { + const inputProps = { + min: minMarginValue, + onDragStart: () => { + //Reset to 0 in case the value was negative. + setMinMarginValue(0); + }, + onDragEnd: () => { + setMinMarginValue(minimumMargin); + } + }; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Wrapper, { resetAllFilter: resetAllFilter, value: value, onChange: onChange, - panelId: panelId - }, (showContentSizeControl || showWideSizeControl) && (0,external_React_.createElement)("span", { - className: "span-columns" - }, (0,external_wp_i18n_namespaceObject.__)('Set the width of the main content area.')), showContentSizeControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { - className: "single-column", - label: (0,external_wp_i18n_namespaceObject.__)('Content size'), - hasValue: hasUserSetContentSizeValue, - onDeselect: resetContentSizeValue, - isShownByDefault: (_defaultControls$cont = defaultControls.contentSize) !== null && _defaultControls$cont !== void 0 ? _defaultControls$cont : dimensions_panel_DEFAULT_CONTROLS.contentSize, - panelId: panelId - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { - alignment: "flex-end", - justify: "flex-start" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, { - label: (0,external_wp_i18n_namespaceObject.__)('Content'), - labelPosition: "top", - __unstableInputWidth: "80px", - value: contentSizeValue || '', - onChange: nextContentSize => { - setContentSizeValue(nextContentSize); - }, - units: units - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalView, null, (0,external_React_.createElement)(build_module_icon, { - icon: position_center - })))), showWideSizeControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { - className: "single-column", - label: (0,external_wp_i18n_namespaceObject.__)('Wide size'), - hasValue: hasUserSetWideSizeValue, - onDeselect: resetWideSizeValue, - isShownByDefault: (_defaultControls$wide = defaultControls.wideSize) !== null && _defaultControls$wide !== void 0 ? _defaultControls$wide : dimensions_panel_DEFAULT_CONTROLS.wideSize, - panelId: panelId - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { - alignment: "flex-end", - justify: "flex-start" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, { - label: (0,external_wp_i18n_namespaceObject.__)('Wide'), - labelPosition: "top", - __unstableInputWidth: "80px", - value: wideSizeValue || '', - onChange: nextWideSize => { - setWideSizeValue(nextWideSize); - }, - units: units - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalView, null, (0,external_React_.createElement)(build_module_icon, { - icon: stretch_wide - })))), showPaddingControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { - hasValue: hasPaddingValue, - label: (0,external_wp_i18n_namespaceObject.__)('Padding'), - onDeselect: resetPaddingValue, - isShownByDefault: (_defaultControls$padd = defaultControls.padding) !== null && _defaultControls$padd !== void 0 ? _defaultControls$padd : dimensions_panel_DEFAULT_CONTROLS.padding, - className: classnames_default()({ - 'tools-panel-item-spacing': showSpacingPresetsControl - }), - panelId: panelId - }, !showSpacingPresetsControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalBoxControl, { - values: paddingValues, - onChange: setPaddingValues, - label: (0,external_wp_i18n_namespaceObject.__)('Padding'), - sides: paddingSides, - units: units, - allowReset: false, - splitOnAxis: isAxialPadding, - onMouseOver: onMouseOverPadding, - onMouseOut: onMouseLeaveControls - }), showSpacingPresetsControl && (0,external_React_.createElement)(SpacingSizesControl, { - values: paddingValues, - onChange: setPaddingValues, - label: (0,external_wp_i18n_namespaceObject.__)('Padding'), - sides: paddingSides, - units: units, - allowReset: false, - onMouseOver: onMouseOverPadding, - onMouseOut: onMouseLeaveControls - })), showMarginControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { - hasValue: hasMarginValue, - label: (0,external_wp_i18n_namespaceObject.__)('Margin'), - onDeselect: resetMarginValue, - isShownByDefault: (_defaultControls$marg = defaultControls.margin) !== null && _defaultControls$marg !== void 0 ? _defaultControls$marg : dimensions_panel_DEFAULT_CONTROLS.margin, - className: classnames_default()({ - 'tools-panel-item-spacing': showSpacingPresetsControl - }), - panelId: panelId - }, !showSpacingPresetsControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalBoxControl, { - values: marginValues, - onChange: setMarginValues, - label: (0,external_wp_i18n_namespaceObject.__)('Margin'), - sides: marginSides, - units: units, - allowReset: false, - splitOnAxis: isAxialMargin, - onMouseOver: onMouseOverMargin, - onMouseOut: onMouseLeaveControls - }), showSpacingPresetsControl && (0,external_React_.createElement)(SpacingSizesControl, { - values: marginValues, - onChange: setMarginValues, - label: (0,external_wp_i18n_namespaceObject.__)('Margin'), - sides: marginSides, - units: units, - allowReset: false, - onMouseOver: onMouseOverMargin, - onMouseOut: onMouseLeaveControls - })), showGapControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { - hasValue: hasGapValue, - label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'), - onDeselect: resetGapValue, - isShownByDefault: (_defaultControls$bloc = defaultControls.blockGap) !== null && _defaultControls$bloc !== void 0 ? _defaultControls$bloc : dimensions_panel_DEFAULT_CONTROLS.blockGap, - className: classnames_default()({ - 'tools-panel-item-spacing': showSpacingPresetsControl - }), - panelId: panelId - }, !showSpacingPresetsControl && (isAxialGap ? (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalBoxControl, { - label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'), - min: 0, - onChange: setGapValues, - units: units, - sides: gapSides, - values: gapValues, - allowReset: false, - splitOnAxis: isAxialGap - }) : (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, { - label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'), - __unstableInputWidth: "80px", - min: 0, - onChange: setGapValue, - units: units, - value: gapValue - })), showSpacingPresetsControl && (0,external_React_.createElement)(SpacingSizesControl, { - label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'), - min: 0, - onChange: setGapValues, - showSideInLabel: false, - sides: isAxialGap ? gapSides : ['top'] // Use 'top' as the shorthand property in non-axial configurations. - , - values: gapValues, - allowReset: false - })), showMinHeightControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { - hasValue: hasMinHeightValue, - label: (0,external_wp_i18n_namespaceObject.__)('Minimum height'), - onDeselect: resetMinHeightValue, - isShownByDefault: (_defaultControls$minH = defaultControls.minHeight) !== null && _defaultControls$minH !== void 0 ? _defaultControls$minH : dimensions_panel_DEFAULT_CONTROLS.minHeight, - panelId: panelId - }, (0,external_React_.createElement)(HeightControl, { - label: (0,external_wp_i18n_namespaceObject.__)('Minimum height'), - value: minHeightValue, - onChange: setMinHeightValue - })), showAspectRatioControl && (0,external_React_.createElement)(AspectRatioTool, { - hasValue: hasAspectRatioValue, - value: aspectRatioValue, - onChange: setAspectRatioValue, panelId: panelId, - isShownByDefault: (_defaultControls$aspe = defaultControls.aspectRatio) !== null && _defaultControls$aspe !== void 0 ? _defaultControls$aspe : dimensions_panel_DEFAULT_CONTROLS.aspectRatio - }), showChildLayoutControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { - as: external_wp_components_namespaceObject.__experimentalToolsPanelItem, - spacing: 2, - hasValue: hasChildLayoutValue, - label: childLayoutOrientationLabel, - onDeselect: resetChildLayoutValue, - isShownByDefault: (_defaultControls$chil = defaultControls.childLayout) !== null && _defaultControls$chil !== void 0 ? _defaultControls$chil : dimensions_panel_DEFAULT_CONTROLS.childLayout, - panelId: panelId - }, (0,external_React_.createElement)(ChildLayoutControl, { - value: childLayout, - onChange: setChildLayout, - parentLayout: settings?.parentLayout - }))); -} - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-popover/use-popover-scroll.js -/** - * WordPress dependencies - */ - - -/** - * Allow scrolling "through" popovers over the canvas. This is only called for - * as long as the pointer is over a popover. Do not use React events because it - * will bubble through portals. - * - * @param {Object} scrollableRef - */ -function usePopoverScroll(scrollableRef) { - return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { - if (!scrollableRef) { - return; - } - function onWheel(event) { - const { - deltaX, - deltaY - } = event; - scrollableRef.current.scrollBy(deltaX, deltaY); - } - // Tell the browser that we do not call event.preventDefault - // See https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#improving_scrolling_performance_with_passive_listeners - const options = { - passive: true - }; - node.addEventListener('wheel', onWheel, options); - return () => { - node.removeEventListener('wheel', onWheel, options); - }; - }, [scrollableRef]); + children: [(showContentSizeControl || showWideSizeControl) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + className: "span-columns", + children: (0,external_wp_i18n_namespaceObject.__)('Set the width of the main content area.') + }), showContentSizeControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + className: "single-column", + label: (0,external_wp_i18n_namespaceObject.__)('Content size'), + hasValue: hasUserSetContentSizeValue, + onDeselect: resetContentSizeValue, + isShownByDefault: (_defaultControls$cont = defaultControls.contentSize) !== null && _defaultControls$cont !== void 0 ? _defaultControls$cont : dimensions_panel_DEFAULT_CONTROLS.contentSize, + panelId: panelId, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { + alignment: "flex-end", + justify: "flex-start", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Content'), + labelPosition: "top", + __unstableInputWidth: "80px", + value: contentSizeValue || '', + onChange: nextContentSize => { + setContentSizeValue(nextContentSize); + }, + units: units + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalView, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { + icon: position_center + }) + })] + }) + }), showWideSizeControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + className: "single-column", + label: (0,external_wp_i18n_namespaceObject.__)('Wide size'), + hasValue: hasUserSetWideSizeValue, + onDeselect: resetWideSizeValue, + isShownByDefault: (_defaultControls$wide = defaultControls.wideSize) !== null && _defaultControls$wide !== void 0 ? _defaultControls$wide : dimensions_panel_DEFAULT_CONTROLS.wideSize, + panelId: panelId, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { + alignment: "flex-end", + justify: "flex-start", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Wide'), + labelPosition: "top", + __unstableInputWidth: "80px", + value: wideSizeValue || '', + onChange: nextWideSize => { + setWideSizeValue(nextWideSize); + }, + units: units + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalView, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { + icon: stretch_wide + }) + })] + }) + }), showPaddingControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + hasValue: hasPaddingValue, + label: (0,external_wp_i18n_namespaceObject.__)('Padding'), + onDeselect: resetPaddingValue, + isShownByDefault: (_defaultControls$padd = defaultControls.padding) !== null && _defaultControls$padd !== void 0 ? _defaultControls$padd : dimensions_panel_DEFAULT_CONTROLS.padding, + className: dist_clsx({ + 'tools-panel-item-spacing': showSpacingPresetsControl + }), + panelId: panelId, + children: [!showSpacingPresetsControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalBoxControl, { + values: paddingValues, + onChange: setPaddingValues, + label: (0,external_wp_i18n_namespaceObject.__)('Padding'), + sides: paddingSides, + units: units, + allowReset: false, + splitOnAxis: isAxialPadding, + onMouseOver: onMouseOverPadding, + onMouseOut: onMouseLeaveControls + }), showSpacingPresetsControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SpacingSizesControl, { + values: paddingValues, + onChange: setPaddingValues, + label: (0,external_wp_i18n_namespaceObject.__)('Padding'), + sides: paddingSides, + units: units, + allowReset: false, + onMouseOver: onMouseOverPadding, + onMouseOut: onMouseLeaveControls + })] + }), showMarginControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + hasValue: hasMarginValue, + label: (0,external_wp_i18n_namespaceObject.__)('Margin'), + onDeselect: resetMarginValue, + isShownByDefault: (_defaultControls$marg = defaultControls.margin) !== null && _defaultControls$marg !== void 0 ? _defaultControls$marg : dimensions_panel_DEFAULT_CONTROLS.margin, + className: dist_clsx({ + 'tools-panel-item-spacing': showSpacingPresetsControl + }), + panelId: panelId, + children: [!showSpacingPresetsControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalBoxControl, { + values: marginValues, + onChange: setMarginValues, + inputProps: inputProps, + label: (0,external_wp_i18n_namespaceObject.__)('Margin'), + sides: marginSides, + units: units, + allowReset: false, + splitOnAxis: isAxialMargin, + onMouseOver: onMouseOverMargin, + onMouseOut: onMouseLeaveControls + }), showSpacingPresetsControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SpacingSizesControl, { + values: marginValues, + onChange: setMarginValues, + minimumCustomValue: -Infinity, + label: (0,external_wp_i18n_namespaceObject.__)('Margin'), + sides: marginSides, + units: units, + allowReset: false, + onMouseOver: onMouseOverMargin, + onMouseOut: onMouseLeaveControls + })] + }), showGapControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + hasValue: hasGapValue, + label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'), + onDeselect: resetGapValue, + isShownByDefault: (_defaultControls$bloc = defaultControls.blockGap) !== null && _defaultControls$bloc !== void 0 ? _defaultControls$bloc : dimensions_panel_DEFAULT_CONTROLS.blockGap, + className: dist_clsx({ + 'tools-panel-item-spacing': showSpacingPresetsControl + }), + panelId: panelId, + children: [!showSpacingPresetsControl && (isAxialGap ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalBoxControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'), + min: 0, + onChange: setGapValues, + units: units, + sides: gapSides, + values: gapValues, + allowReset: false, + splitOnAxis: isAxialGap + }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'), + __unstableInputWidth: "80px", + min: 0, + onChange: setGapValue, + units: units, + value: gapValue + })), showSpacingPresetsControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SpacingSizesControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'), + min: 0, + onChange: setGapValues, + showSideInLabel: false, + sides: isAxialGap ? gapSides : ['top'] // Use 'top' as the shorthand property in non-axial configurations. + , + values: gapValues, + allowReset: false + })] + }), showChildLayoutControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ChildLayoutControl, { + value: childLayout, + onChange: setChildLayout, + parentLayout: settings?.parentLayout, + panelId: panelId, + isShownByDefault: (_defaultControls$chil = defaultControls.childLayout) !== null && _defaultControls$chil !== void 0 ? _defaultControls$chil : dimensions_panel_DEFAULT_CONTROLS.childLayout + }), showMinHeightControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + hasValue: hasMinHeightValue, + label: (0,external_wp_i18n_namespaceObject.__)('Minimum height'), + onDeselect: resetMinHeightValue, + isShownByDefault: (_defaultControls$minH = defaultControls.minHeight) !== null && _defaultControls$minH !== void 0 ? _defaultControls$minH : dimensions_panel_DEFAULT_CONTROLS.minHeight, + panelId: panelId, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(HeightControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Minimum height'), + value: minHeightValue, + onChange: setMinHeightValue + }) + }), showAspectRatioControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AspectRatioTool, { + hasValue: hasAspectRatioValue, + value: aspectRatioValue, + onChange: setAspectRatioValue, + panelId: panelId, + isShownByDefault: (_defaultControls$aspe = defaultControls.aspectRatio) !== null && _defaultControls$aspe !== void 0 ? _defaultControls$aspe : dimensions_panel_DEFAULT_CONTROLS.aspectRatio + })] + }); } -/* harmony default export */ const use_popover_scroll = (usePopoverScroll); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-popover/index.js - -/** - * External dependencies - */ - +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/spacing-visualizer.js /** * WordPress dependencies */ - /** * Internal dependencies */ -const MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER; -function BlockPopover({ - clientId, - bottomClientId, - children, - __unstableRefreshSize, - __unstableCoverTarget = false, - __unstablePopoverSlot, - __unstableContentRef, - shift = true, - ...props -}, ref) { - const selectedElement = useBlockElement(clientId); - const lastSelectedElement = useBlockElement(bottomClientId !== null && bottomClientId !== void 0 ? bottomClientId : clientId); - const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, use_popover_scroll(__unstableContentRef)]); - const [popoverDimensionsRecomputeCounter, forceRecomputePopoverDimensions] = (0,external_wp_element_namespaceObject.useReducer)( - // Module is there to make sure that the counter doesn't overflow. - s => (s + 1) % MAX_POPOVER_RECOMPUTE_COUNTER, 0); - - // When blocks are moved up/down, they are animated to their new position by - // updating the `transform` property manually (i.e. without using CSS - // transitions or animations). The animation, which can also scroll the block - // editor, can sometimes cause the position of the Popover to get out of sync. - // A MutationObserver is therefore used to make sure that changes to the - // selectedElement's attribute (i.e. `transform`) can be tracked and used to - // trigger the Popover to rerender. - (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { - if (!selectedElement) { - return; - } - const observer = new window.MutationObserver(forceRecomputePopoverDimensions); - observer.observe(selectedElement, { - attributes: true - }); - return () => { - observer.disconnect(); - }; - }, [selectedElement]); - const style = (0,external_wp_element_namespaceObject.useMemo)(() => { - if ( - // popoverDimensionsRecomputeCounter is by definition always equal or greater - // than 0. This check is only there to satisfy the correctness of the - // exhaustive-deps rule for the `useMemo` hook. - popoverDimensionsRecomputeCounter < 0 || !selectedElement || lastSelectedElement !== selectedElement) { - return {}; - } - return { - position: 'absolute', - width: selectedElement.offsetWidth, - height: selectedElement.offsetHeight - }; - }, [selectedElement, lastSelectedElement, __unstableRefreshSize, popoverDimensionsRecomputeCounter]); - const popoverAnchor = (0,external_wp_element_namespaceObject.useMemo)(() => { - if ( - // popoverDimensionsRecomputeCounter is by definition always equal or greater - // than 0. This check is only there to satisfy the correctness of the - // exhaustive-deps rule for the `useMemo` hook. - popoverDimensionsRecomputeCounter < 0 || !selectedElement || bottomClientId && !lastSelectedElement) { - return undefined; - } - return { - getBoundingClientRect() { - var _lastSelectedBCR$left, _lastSelectedBCR$top, _lastSelectedBCR$righ, _lastSelectedBCR$bott; - const selectedBCR = selectedElement.getBoundingClientRect(); - const lastSelectedBCR = lastSelectedElement?.getBoundingClientRect(); - - // Get the biggest rectangle that encompasses completely the currently - // selected element and the last selected element: - // - for top/left coordinates, use the smaller numbers - // - for the bottom/right coordinates, use the largest numbers - const left = Math.min(selectedBCR.left, (_lastSelectedBCR$left = lastSelectedBCR?.left) !== null && _lastSelectedBCR$left !== void 0 ? _lastSelectedBCR$left : Infinity); - const top = Math.min(selectedBCR.top, (_lastSelectedBCR$top = lastSelectedBCR?.top) !== null && _lastSelectedBCR$top !== void 0 ? _lastSelectedBCR$top : Infinity); - const right = Math.max(selectedBCR.right, (_lastSelectedBCR$righ = lastSelectedBCR.right) !== null && _lastSelectedBCR$righ !== void 0 ? _lastSelectedBCR$righ : -Infinity); - const bottom = Math.max(selectedBCR.bottom, (_lastSelectedBCR$bott = lastSelectedBCR.bottom) !== null && _lastSelectedBCR$bott !== void 0 ? _lastSelectedBCR$bott : -Infinity); - const width = right - left; - const height = bottom - top; - return new window.DOMRect(left, top, width, height); - }, - contextElement: selectedElement - }; - }, [bottomClientId, lastSelectedElement, selectedElement, popoverDimensionsRecomputeCounter]); - if (!selectedElement || bottomClientId && !lastSelectedElement) { - return null; - } - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Popover, { - ref: mergedRefs, - animate: false, - focusOnMount: false, - anchor: popoverAnchor - // Render in the old slot if needed for backward compatibility, - // otherwise render in place (not in the default popover slot). - , - __unstableSlotName: __unstablePopoverSlot, - inline: !__unstablePopoverSlot, - placement: "top-start", - resize: false, - flip: false, - shift: shift, - ...props, - className: classnames_default()('block-editor-block-popover', props.className), - variant: "unstyled" - }, __unstableCoverTarget && (0,external_React_.createElement)("div", { - style: style - }, children), !__unstableCoverTarget && children); -} -/* harmony default export */ const block_popover = ((0,external_wp_element_namespaceObject.forwardRef)(BlockPopover)); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/margin.js - -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - -function getComputedCSS(element, property) { - return element.ownerDocument.defaultView.getComputedStyle(element).getPropertyValue(property); -} -function MarginVisualizer({ +function SpacingVisualizer({ clientId, - attributes, + value, + computeStyle, forceShow }) { const blockElement = useBlockElement(clientId); - const [style, setStyle] = (0,external_wp_element_namespaceObject.useState)(); - const margin = attributes?.style?.spacing?.margin; - (0,external_wp_element_namespaceObject.useEffect)(() => { - if (!blockElement || null === blockElement.ownerDocument.defaultView) { + const [style, updateStyle] = (0,external_wp_element_namespaceObject.useReducer)(() => computeStyle(blockElement)); + (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { + if (!blockElement) { return; } - const top = getComputedCSS(blockElement, 'margin-top'); - const right = getComputedCSS(blockElement, 'margin-right'); - const bottom = getComputedCSS(blockElement, 'margin-bottom'); - const left = getComputedCSS(blockElement, 'margin-left'); - setStyle({ - borderTopWidth: top, - borderRightWidth: right, - borderBottomWidth: bottom, - borderLeftWidth: left, - top: top ? `-${top}` : 0, - right: right ? `-${right}` : 0, - bottom: bottom ? `-${bottom}` : 0, - left: left ? `-${left}` : 0 - }); - }, [blockElement, margin]); + // It's not sufficient to read the computed spacing value when value.spacing changes as + // useEffect may run before the browser recomputes CSS. We therefore combine + // useLayoutEffect and two rAF calls to ensure that we read the spacing after the current + // paint but before the next paint. + // See https://github.com/WordPress/gutenberg/pull/59227. + window.requestAnimationFrame(() => window.requestAnimationFrame(updateStyle)); + }, [blockElement, value]); + const previousValue = (0,external_wp_element_namespaceObject.useRef)(value); const [isActive, setIsActive] = (0,external_wp_element_namespaceObject.useState)(false); - const valueRef = (0,external_wp_element_namespaceObject.useRef)(margin); - const timeoutRef = (0,external_wp_element_namespaceObject.useRef)(); - const clearTimer = () => { - if (timeoutRef.current) { - window.clearTimeout(timeoutRef.current); - } - }; (0,external_wp_element_namespaceObject.useEffect)(() => { - if (!external_wp_isShallowEqual_default()(margin, valueRef.current) && !forceShow) { - setIsActive(true); - valueRef.current = margin; - timeoutRef.current = setTimeout(() => { - setIsActive(false); - }, 400); + if (external_wp_isShallowEqual_default()(value, previousValue.current) || forceShow) { + return; } + setIsActive(true); + previousValue.current = value; + const timeout = setTimeout(() => { + setIsActive(false); + }, 400); return () => { setIsActive(false); - clearTimer(); + clearTimeout(timeout); }; - }, [margin, forceShow]); + }, [value, forceShow]); if (!isActive && !forceShow) { return null; } - return (0,external_React_.createElement)(block_popover, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(cover, { clientId: clientId, - __unstableCoverTarget: true, - __unstableRefreshSize: margin, __unstablePopoverSlot: "block-toolbar", - shift: false - }, (0,external_React_.createElement)("div", { - className: "block-editor__padding-visualizer", - style: style - })); + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor__spacing-visualizer", + style: style + }) + }); } - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/padding.js - -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - -function padding_getComputedCSS(element, property) { +function spacing_visualizer_getComputedCSS(element, property) { return element.ownerDocument.defaultView.getComputedStyle(element).getPropertyValue(property); } +function MarginVisualizer({ + clientId, + value, + forceShow +}) { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SpacingVisualizer, { + clientId: clientId, + value: value?.spacing?.margin, + computeStyle: blockElement => { + const top = spacing_visualizer_getComputedCSS(blockElement, 'margin-top'); + const right = spacing_visualizer_getComputedCSS(blockElement, 'margin-right'); + const bottom = spacing_visualizer_getComputedCSS(blockElement, 'margin-bottom'); + const left = spacing_visualizer_getComputedCSS(blockElement, 'margin-left'); + return { + borderTopWidth: top, + borderRightWidth: right, + borderBottomWidth: bottom, + borderLeftWidth: left, + top: top ? `-${top}` : 0, + right: right ? `-${right}` : 0, + bottom: bottom ? `-${bottom}` : 0, + left: left ? `-${left}` : 0 + }; + }, + forceShow: forceShow + }); +} function PaddingVisualizer({ clientId, value, forceShow }) { - const blockElement = useBlockElement(clientId); - const [style, setStyle] = (0,external_wp_element_namespaceObject.useState)(); - const padding = value?.spacing?.padding; - (0,external_wp_element_namespaceObject.useEffect)(() => { - if (!blockElement || null === blockElement.ownerDocument.defaultView) { - return; - } - setStyle({ - borderTopWidth: padding_getComputedCSS(blockElement, 'padding-top'), - borderRightWidth: padding_getComputedCSS(blockElement, 'padding-right'), - borderBottomWidth: padding_getComputedCSS(blockElement, 'padding-bottom'), - borderLeftWidth: padding_getComputedCSS(blockElement, 'padding-left') - }); - }, [blockElement, padding]); - const [isActive, setIsActive] = (0,external_wp_element_namespaceObject.useState)(false); - const valueRef = (0,external_wp_element_namespaceObject.useRef)(padding); - const timeoutRef = (0,external_wp_element_namespaceObject.useRef)(); - const clearTimer = () => { - if (timeoutRef.current) { - window.clearTimeout(timeoutRef.current); - } - }; - (0,external_wp_element_namespaceObject.useEffect)(() => { - if (!external_wp_isShallowEqual_default()(padding, valueRef.current) && !forceShow) { - setIsActive(true); - valueRef.current = padding; - timeoutRef.current = setTimeout(() => { - setIsActive(false); - }, 400); - } - return () => { - setIsActive(false); - clearTimer(); - }; - }, [padding, forceShow]); - if (!isActive && !forceShow) { - return null; - } - return (0,external_React_.createElement)(block_popover, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SpacingVisualizer, { clientId: clientId, - __unstableCoverTarget: true, - __unstableRefreshSize: padding, - __unstablePopoverSlot: "block-toolbar", - shift: false - }, (0,external_React_.createElement)("div", { - className: "block-editor__padding-visualizer", - style: style - })); + value: value?.spacing?.padding, + computeStyle: blockElement => ({ + borderTopWidth: spacing_visualizer_getComputedCSS(blockElement, 'padding-top'), + borderRightWidth: spacing_visualizer_getComputedCSS(blockElement, 'padding-right'), + borderBottomWidth: spacing_visualizer_getComputedCSS(blockElement, 'padding-bottom'), + borderLeftWidth: spacing_visualizer_getComputedCSS(blockElement, 'padding-left') + }), + forceShow: forceShow + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/dimensions.js - /** * External dependencies */ @@ -30848,6 +31886,8 @@ function PaddingVisualizer({ + + const DIMENSIONS_SUPPORT_KEY = 'dimensions'; const SPACING_SUPPORT_KEY = 'spacing'; const dimensions_ALL_SIDES = (/* unused pure expression or super */ null && (['top', 'right', 'bottom', 'left'])); @@ -30879,10 +31919,11 @@ function DimensionsInspectorControl({ style: updatedStyle }; }, [resetAllFilter]); - return (0,external_React_.createElement)(inspector_controls, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls, { group: "dimensions", - resetAllFilter: attributesResetAllFilter - }, children); + resetAllFilter: attributesResetAllFilter, + children: children + }); } function dimensions_DimensionsPanel({ clientId, @@ -30907,23 +31948,25 @@ function dimensions_DimensionsPanel({ ...defaultDimensionsControls, ...defaultSpacingControls }; - return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(DimensionsPanel, { - as: DimensionsInspectorControl, - panelId: clientId, - settings: settings, - value: value, - onChange: onChange, - defaultControls: defaultControls, - onVisualize: setVisualizedProperty - }), !!settings?.spacing?.padding && (0,external_React_.createElement)(PaddingVisualizer, { - forceShow: visualizedProperty === 'padding', - clientId: clientId, - value: value - }), !!settings?.spacing?.margin && (0,external_React_.createElement)(MarginVisualizer, { - forceShow: visualizedProperty === 'margin', - clientId: clientId, - value: value - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DimensionsPanel, { + as: DimensionsInspectorControl, + panelId: clientId, + settings: settings, + value: value, + onChange: onChange, + defaultControls: defaultControls, + onVisualize: setVisualizedProperty + }), !!settings?.spacing?.padding && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PaddingVisualizer, { + forceShow: visualizedProperty === 'padding', + clientId: clientId, + value: value + }), !!settings?.spacing?.margin && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MarginVisualizer, { + forceShow: visualizedProperty === 'margin', + clientId: clientId, + value: value + })] + }); } /** @@ -30962,7 +32005,7 @@ function dimensions_useBlockProps({ if (!hasDimensionsSupport(name, 'aspectRatio') || shouldSkipSerialization(name, DIMENSIONS_SUPPORT_KEY, 'aspectRatio')) { return {}; } - const className = classnames_default()({ + const className = dist_clsx({ 'has-aspect-ratio': !!style?.dimensions?.aspectRatio }); @@ -31000,7 +32043,6 @@ function useCustomSides() { } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/style.js - /** * WordPress dependencies */ @@ -31021,6 +32063,9 @@ function useCustomSides() { + + + const styleSupportKeys = [...TYPOGRAPHY_SUPPORT_KEYS, BORDER_SUPPORT_KEY, COLOR_SUPPORT_KEY, DIMENSIONS_SUPPORT_KEY, BACKGROUND_SUPPORT_KEY, SPACING_SUPPORT_KEY, SHADOW_SUPPORT_KEY]; const hasStyleSupport = nameOrType => styleSupportKeys.some(key => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, key)); @@ -31280,22 +32325,32 @@ function BlockStyleControls({ clientId, name, setAttributes, - settings + settings: { + ...settings, + typography: { + ...settings.typography, + // The text alignment UI for individual blocks is rendered in + // the block toolbar, so disable it here. + textAlign: false + } + } }; if (blockEditingMode !== 'default') { return null; } - return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(ColorEdit, { - ...passedProps - }), (0,external_React_.createElement)(BackgroundImagePanel, { - ...passedProps - }), (0,external_React_.createElement)(typography_TypographyPanel, { - ...passedProps - }), (0,external_React_.createElement)(border_BorderPanel, { - ...passedProps - }), (0,external_React_.createElement)(dimensions_DimensionsPanel, { - ...passedProps - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorEdit, { + ...passedProps + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BackgroundImagePanel, { + ...passedProps + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(typography_TypographyPanel, { + ...passedProps + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(border_BorderPanel, { + ...passedProps + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dimensions_DimensionsPanel, { + ...passedProps + })] + }); } /* harmony default export */ const style = ({ edit: BlockStyleControls, @@ -31413,21 +32468,21 @@ function settings_addAttribute(settings) { (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/settings/addAttribute', settings_addAttribute); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/filter.js - /** * WordPress dependencies */ -const filter = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const filter = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M12 4 4 19h16L12 4zm0 3.2 5.5 10.3H12V7.2z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M12 4 4 19h16L12 4zm0 3.2 5.5 10.3H12V7.2z" + }) +}); /* harmony default export */ const library_filter = (filter); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/duotone-control/index.js - /** * WordPress dependencies */ @@ -31436,6 +32491,8 @@ const filter = (0,external_React_.createElement)(external_wp_primitives_namespac + + function DuotoneControl({ id: idProp, colorPalette, @@ -31447,22 +32504,22 @@ function DuotoneControl({ }) { let toolbarIcon; if (value === 'unset') { - toolbarIcon = (0,external_React_.createElement)(external_wp_components_namespaceObject.ColorIndicator, { + toolbarIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ColorIndicator, { className: "block-editor-duotone-control__unset-indicator" }); } else if (value) { - toolbarIcon = (0,external_React_.createElement)(external_wp_components_namespaceObject.DuotoneSwatch, { + toolbarIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DuotoneSwatch, { values: value }); } else { - toolbarIcon = (0,external_React_.createElement)(build_module_icon, { + toolbarIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { icon: library_filter }); } const actionLabel = (0,external_wp_i18n_namespaceObject.__)('Apply duotone filter'); const id = (0,external_wp_compose_namespaceObject.useInstanceId)(DuotoneControl, 'duotone-control', idProp); const descriptionId = `${id}__description`; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Dropdown, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: { className: 'block-editor-duotone-control__popover', headerTitle: (0,external_wp_i18n_namespaceObject.__)('Duotone') @@ -31477,7 +32534,7 @@ function DuotoneControl({ onToggle(); } }; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { showTooltip: true, onClick: onToggle, "aria-haspopup": "true", @@ -31487,18 +32544,21 @@ function DuotoneControl({ icon: toolbarIcon }); }, - renderContent: () => (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, { - label: (0,external_wp_i18n_namespaceObject.__)('Duotone') - }, (0,external_React_.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Create a two-tone color effect without losing your original image.')), (0,external_React_.createElement)(external_wp_components_namespaceObject.DuotonePicker, { - "aria-label": actionLabel, - "aria-describedby": descriptionId, - colorPalette: colorPalette, - duotonePalette: duotonePalette, - disableCustomColors: disableCustomColors, - disableCustomDuotone: disableCustomDuotone, - value: value, - onChange: onChange - })) + renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { + label: (0,external_wp_i18n_namespaceObject.__)('Duotone'), + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { + children: (0,external_wp_i18n_namespaceObject.__)('Create a two-tone color effect without losing your original image.') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DuotonePicker, { + "aria-label": actionLabel, + "aria-describedby": descriptionId, + colorPalette: colorPalette, + duotonePalette: duotonePalette, + disableCustomColors: disableCustomColors, + disableCustomDuotone: disableCustomDuotone, + value: value, + onChange: onChange + })] + }) }); } /* harmony default export */ const duotone_control = (DuotoneControl); @@ -31707,7 +32767,6 @@ function getBlockCSSSelector(blockType, target = 'root', options = {}) { } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/filters-panel.js - /** * External dependencies */ @@ -31725,6 +32784,8 @@ function getBlockCSSSelector(blockType, target = 'root', options = {}) { */ + + const filters_panel_EMPTY_ARRAY = []; function useMultiOriginColorPresets(settings, { presetSetting, @@ -31749,16 +32810,18 @@ function FiltersToolsPanel({ panelId, children }) { + const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const resetAll = () => { const updatedValue = resetAllFilter(value); onChange(updatedValue); }; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanel, { label: (0,external_wp_i18n_namespaceObject._x)('Filters', 'Name for applying graphical effects'), resetAll: resetAll, panelId: panelId, - dropdownMenuProps: TOOLSPANEL_DROPDOWNMENU_PROPS - }, children); + dropdownMenuProps: dropdownMenuProps, + children: children + }); } const filters_panel_DEFAULT_CONTROLS = { duotone: true @@ -31773,20 +32836,24 @@ const filters_panel_popoverProps = { const LabeledColorIndicator = ({ indicator, label -}) => (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { - justify: "flex-start" -}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalZStack, { - isLayered: false, - offset: -8 -}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, { - expanded: false -}, indicator === 'unset' || !indicator ? (0,external_React_.createElement)(external_wp_components_namespaceObject.ColorIndicator, { - className: "block-editor-duotone-control__unset-indicator" -}) : (0,external_React_.createElement)(external_wp_components_namespaceObject.DuotoneSwatch, { - values: indicator -}))), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, { - title: label -}, label)); +}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { + justify: "flex-start", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalZStack, { + isLayered: false, + offset: -8, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { + expanded: false, + children: indicator === 'unset' || !indicator ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ColorIndicator, { + className: "block-editor-duotone-control__unset-indicator" + }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DuotoneSwatch, { + values: indicator + }) + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { + title: label, + children: label + })] +}); function FiltersPanel({ as: Wrapper = FiltersToolsPanel, value, @@ -31831,60 +32898,67 @@ function FiltersPanel({ } }; }, []); - return (0,external_React_.createElement)(Wrapper, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Wrapper, { resetAllFilter: resetAllFilter, value: value, onChange: onChange, - panelId: panelId - }, hasDuotoneEnabled && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { - label: (0,external_wp_i18n_namespaceObject.__)('Duotone'), - hasValue: hasDuotone, - onDeselect: resetDuotone, - isShownByDefault: defaultControls.duotone, - panelId: panelId - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Dropdown, { - popoverProps: filters_panel_popoverProps, - className: "block-editor-global-styles-filters-panel__dropdown", - renderToggle: ({ - onToggle, - isOpen - }) => { - const toggleProps = { - onClick: onToggle, - className: classnames_default()({ - 'is-open': isOpen - }), - 'aria-expanded': isOpen - }; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, { - isBordered: true, - isSeparated: true - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - ...toggleProps - }, (0,external_React_.createElement)(LabeledColorIndicator, { - indicator: duotone, - label: (0,external_wp_i18n_namespaceObject.__)('Duotone') - }))); - }, - renderContent: () => (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { - paddingSize: "small" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, { - label: (0,external_wp_i18n_namespaceObject.__)('Duotone') - }, (0,external_React_.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Create a two-tone color effect without losing your original image.')), (0,external_React_.createElement)(external_wp_components_namespaceObject.DuotonePicker, { - colorPalette: colorPalette, - duotonePalette: duotonePalette - // TODO: Re-enable both when custom colors are supported for block-level styles. - , - disableCustomColors: true, - disableCustomDuotone: true, - value: duotone, - onChange: setDuotone - }))) - }))); + panelId: panelId, + children: hasDuotoneEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + label: (0,external_wp_i18n_namespaceObject.__)('Duotone'), + hasValue: hasDuotone, + onDeselect: resetDuotone, + isShownByDefault: defaultControls.duotone, + panelId: panelId, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { + popoverProps: filters_panel_popoverProps, + className: "block-editor-global-styles-filters-panel__dropdown", + renderToggle: ({ + onToggle, + isOpen + }) => { + const toggleProps = { + onClick: onToggle, + className: dist_clsx({ + 'is-open': isOpen + }), + 'aria-expanded': isOpen + }; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { + isBordered: true, + isSeparated: true, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + ...toggleProps, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LabeledColorIndicator, { + indicator: duotone, + label: (0,external_wp_i18n_namespaceObject.__)('Duotone') + }) + }) + }); + }, + renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { + paddingSize: "small", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { + label: (0,external_wp_i18n_namespaceObject.__)('Duotone'), + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { + children: (0,external_wp_i18n_namespaceObject.__)('Create a two-tone color effect without losing your original image.') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DuotonePicker, { + colorPalette: colorPalette, + duotonePalette: duotonePalette + // TODO: Re-enable both when custom colors are supported for block-level styles. + , + disableCustomColors: true, + disableCustomDuotone: true, + value: duotone, + onChange: setDuotone + })] + }) + }) + }) + }) + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/duotone.js - /** * External dependencies */ @@ -31910,6 +32984,9 @@ function FiltersPanel({ + + + const duotone_EMPTY_ARRAY = []; // Safari does not always update the duotone filter when the duotone colors @@ -31971,50 +33048,54 @@ function DuotonePanelPure({ return null; } const duotonePresetOrColors = !Array.isArray(duotoneStyle) ? getColorsFromDuotonePreset(duotoneStyle, duotonePalette) : duotoneStyle; - return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(inspector_controls, { - group: "filter" - }, (0,external_React_.createElement)(FiltersPanel, { - value: { - filter: { - duotone: duotonePresetOrColors - } - }, - onChange: newDuotone => { - const newStyle = { - ...style, - color: { - ...newDuotone?.filter - } - }; - setAttributes({ - style: newStyle - }); - }, - settings: settings - })), (0,external_React_.createElement)(block_controls, { - group: "block", - __experimentalShareWithChildBlocks: true - }, (0,external_React_.createElement)(duotone_control, { - duotonePalette: duotonePalette, - colorPalette: colorPalette, - disableCustomDuotone: disableCustomDuotone, - disableCustomColors: disableCustomColors, - value: duotonePresetOrColors, - onChange: newDuotone => { - const maybePreset = getDuotonePresetFromColors(newDuotone, duotonePalette); - const newStyle = { - ...style, - color: { - ...style?.color, - duotone: maybePreset !== null && maybePreset !== void 0 ? maybePreset : newDuotone // use preset or fallback to custom colors. - } - }; - setAttributes({ - style: newStyle - }); - }, - settings: settings - }))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls, { + group: "filter", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FiltersPanel, { + value: { + filter: { + duotone: duotonePresetOrColors + } + }, + onChange: newDuotone => { + const newStyle = { + ...style, + color: { + ...newDuotone?.filter + } + }; + setAttributes({ + style: newStyle + }); + }, + settings: settings + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls, { + group: "block", + __experimentalShareWithChildBlocks: true, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(duotone_control, { + duotonePalette: duotonePalette, + colorPalette: colorPalette, + disableCustomDuotone: disableCustomDuotone, + disableCustomColors: disableCustomColors, + value: duotonePresetOrColors, + onChange: newDuotone => { + const maybePreset = getDuotonePresetFromColors(newDuotone, duotonePalette); + const newStyle = { + ...style, + color: { + ...style?.color, + duotone: maybePreset !== null && maybePreset !== void 0 ? maybePreset : newDuotone // use preset or fallback to custom colors. + } + }; + setAttributes({ + style: newStyle + }); + }, + settings: settings + }) + })] + }); } /* harmony default export */ const duotone = ({ shareWithChildBlocks: true, @@ -32109,27 +33190,34 @@ function useDuotoneStyles({ } : undefined); const blockElement = useBlockElement(clientId); (0,external_wp_element_namespaceObject.useEffect)(() => { - if (!isValidFilter) return; + if (!isValidFilter) { + return; + } - // Safari does not always update the duotone filter when the duotone colors - // are changed. When using Safari, force the block element to be repainted by - // the browser to ensure any changes are reflected visually. This logic matches - // that used on the site frontend in `block-supports/duotone.php`. + // Safari does not always update the duotone filter when the duotone + // colors are changed. When using Safari, force the block element to be + // repainted by the browser to ensure any changes are reflected + // visually. This logic matches that used on the site frontend in + // `block-supports/duotone.php`. if (blockElement && isSafari) { const display = blockElement.style.display; - // Switch to `inline-block` to force a repaint. In the editor, `inline-block` - // is used instead of `none` to ensure that scroll position is not affected, - // as `none` results in the editor scrolling to the top of the block. + // Switch to `inline-block` to force a repaint. In the editor, + // `inline-block` is used instead of `none` to ensure that scroll + // position is not affected, as `none` results in the editor + // scrolling to the top of the block. blockElement.style.display = 'inline-block'; - // Simply accessing el.offsetHeight flushes layout and style - // changes in WebKit without having to wait for setTimeout. + // Simply accessing el.offsetHeight flushes layout and style changes + // in WebKit without having to wait for setTimeout. // eslint-disable-next-line no-unused-expressions blockElement.offsetHeight; blockElement.style.display = display; } - }, [isValidFilter, blockElement]); + // `colors` must be a dependency so this effect runs when the colors + // change in Safari. + }, [isValidFilter, blockElement, colors]); } function duotone_useBlockProps({ + clientId, name, style }) { @@ -32165,7 +33253,7 @@ function duotone_useBlockProps({ const filterClass = `wp-duotone-${id}`; const shouldRender = selector && attribute; useDuotoneStyles({ - clientId: id, + clientId, id: filterClass, selector, attribute @@ -32238,11 +33326,12 @@ function getPositionTypeLabel(attributes) { function useBlockDisplayInformation(clientId) { return (0,external_wp_data_namespaceObject.useSelect)(select => { - if (!clientId) return null; + if (!clientId) { + return null; + } const { getBlockName, - getBlockAttributes, - __experimentalGetReusableBlockTitle + getBlockAttributes } = select(store); const { getBlockType, @@ -32250,13 +33339,14 @@ function useBlockDisplayInformation(clientId) { } = select(external_wp_blocks_namespaceObject.store); const blockName = getBlockName(clientId); const blockType = getBlockType(blockName); - if (!blockType) return null; + if (!blockType) { + return null; + } const attributes = getBlockAttributes(clientId); const match = getActiveBlockVariation(blockName, attributes); - const isReusable = (0,external_wp_blocks_namespaceObject.isReusableBlock)(blockType); - const resusableTitle = isReusable ? __experimentalGetReusableBlockTitle(attributes.ref) : undefined; - const title = resusableTitle || blockType.title; - const isSynced = isReusable || (0,external_wp_blocks_namespaceObject.isTemplatePart)(blockType); + const isSynced = (0,external_wp_blocks_namespaceObject.isReusableBlock)(blockType) || (0,external_wp_blocks_namespaceObject.isTemplatePart)(blockType); + const syncedTitle = isSynced ? (0,external_wp_blocks_namespaceObject.__experimentalGetBlockLabel)(blockType, attributes) : undefined; + const title = syncedTitle || blockType.title; const positionLabel = getPositionTypeLabel(attributes); const blockTypeInfo = { isSynced, @@ -32268,7 +33358,9 @@ function useBlockDisplayInformation(clientId) { positionType: attributes?.style?.position?.type, name: attributes?.metadata?.name }; - if (!match) return blockTypeInfo; + if (!match) { + return blockTypeInfo; + } return { isSynced, title: match.title || blockType.title, @@ -32283,7 +33375,6 @@ function useBlockDisplayInformation(clientId) { } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/position.js - /** * External dependencies */ @@ -32308,6 +33399,7 @@ function useBlockDisplayInformation(clientId) { + const { CustomSelectControl } = unlock(external_wp_components_namespaceObject.privateApis); @@ -32395,230 +33487,1558 @@ function hasFixedPositionSupport(blockType) { } /** - * Determines if there is position support. - * - * @param {string|Object} blockType Block name or Block Type object. - * - * @return {boolean} Whether there is support. + * Determines if there is position support. + * + * @param {string|Object} blockType Block name or Block Type object. + * + * @return {boolean} Whether there is support. + */ +function hasPositionSupport(blockType) { + const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, POSITION_SUPPORT_KEY); + return !!support; +} + +/** + * Checks if there is a current value in the position block support attributes. + * + * @param {Object} props Block props. + * @return {boolean} Whether or not the block has a position value set. + */ +function hasPositionValue(props) { + return props.attributes.style?.position?.type !== undefined; +} + +/** + * Checks if the block is currently set to a sticky or fixed position. + * This check is helpful for determining how to position block toolbars or other elements. + * + * @param {Object} attributes Block attributes. + * @return {boolean} Whether or not the block is set to a sticky or fixed position. + */ +function hasStickyOrFixedPositionValue(attributes) { + const positionType = attributes?.style?.position?.type; + return positionType === 'sticky' || positionType === 'fixed'; +} + +/** + * Resets the position block support attributes. This can be used when disabling + * the position support controls for a block via a `ToolsPanel`. + * + * @param {Object} props Block props. + * @param {Object} props.attributes Block's attributes. + * @param {Object} props.setAttributes Function to set block's attributes. + */ +function resetPosition({ + attributes = {}, + setAttributes +}) { + const { + style = {} + } = attributes; + setAttributes({ + style: cleanEmptyObject({ + ...style, + position: { + ...style?.position, + type: undefined, + top: undefined, + right: undefined, + bottom: undefined, + left: undefined + } + }) + }); +} + +/** + * Custom hook that checks if position settings have been disabled. + * + * @param {string} name The name of the block. + * + * @return {boolean} Whether padding setting is disabled. + */ +function useIsPositionDisabled({ + name: blockName +} = {}) { + const [allowFixed, allowSticky] = use_settings_useSettings('position.fixed', 'position.sticky'); + const isDisabled = !allowFixed && !allowSticky; + return !hasPositionSupport(blockName) || isDisabled; +} + +/* + * Position controls rendered in an inspector control panel. + * + * @param {Object} props + * + * @return {Element} Position panel. + */ +function PositionPanelPure({ + style = {}, + clientId, + name: blockName, + setAttributes +}) { + const allowFixed = hasFixedPositionSupport(blockName); + const allowSticky = hasStickyPositionSupport(blockName); + const value = style?.position?.type; + const { + firstParentClientId + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getBlockParents + } = select(store); + const parents = getBlockParents(clientId); + return { + firstParentClientId: parents[parents.length - 1] + }; + }, [clientId]); + const blockInformation = useBlockDisplayInformation(firstParentClientId); + const stickyHelpText = allowSticky && value === STICKY_OPTION.value && blockInformation ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: the name of the parent block. */ + (0,external_wp_i18n_namespaceObject.__)('The block will stick to the scrollable area of the parent %s block.'), blockInformation.title) : null; + const options = (0,external_wp_element_namespaceObject.useMemo)(() => { + const availableOptions = [DEFAULT_OPTION]; + // Display options if they are allowed, or if a block already has a valid value set. + // This allows for a block to be switched off from a position type that is not allowed. + if (allowSticky || value === STICKY_OPTION.value) { + availableOptions.push(STICKY_OPTION); + } + if (allowFixed || value === FIXED_OPTION.value) { + availableOptions.push(FIXED_OPTION); + } + return availableOptions; + }, [allowFixed, allowSticky, value]); + const onChangeType = next => { + // For now, use a hard-coded `0px` value for the position. + // `0px` is preferred over `0` as it can be used in `calc()` functions. + // In the future, it could be useful to allow for an offset value. + const placementValue = '0px'; + const newStyle = { + ...style, + position: { + ...style?.position, + type: next, + top: next === 'sticky' || next === 'fixed' ? placementValue : undefined + } + }; + setAttributes({ + style: utils_cleanEmptyObject(newStyle) + }); + }; + const selectedOption = value ? options.find(option => option.value === value) || DEFAULT_OPTION : DEFAULT_OPTION; + + // Only display position controls if there is at least one option to choose from. + return external_wp_element_namespaceObject.Platform.select({ + web: options.length > 1 ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls, { + group: "position", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl, { + className: "block-editor-hooks__position-selection", + __nextHasNoMarginBottom: true, + help: stickyHelpText, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CustomSelectControl, { + __next40pxDefaultSize: true, + className: "block-editor-hooks__position-selection__select-control", + label: (0,external_wp_i18n_namespaceObject.__)('Position'), + hideLabelFromVision: true, + describedBy: (0,external_wp_i18n_namespaceObject.sprintf)( + // translators: %s: Currently selected position. + (0,external_wp_i18n_namespaceObject.__)('Currently selected position: %s'), selectedOption.name), + options: options, + value: selectedOption, + __experimentalShowSelectedHint: true, + onChange: ({ + selectedItem + }) => { + onChangeType(selectedItem.value); + }, + size: "__unstable-large" + }) + }) + }) : null, + native: null + }); +} +/* harmony default export */ const position = ({ + edit: function Edit(props) { + const isPositionDisabled = useIsPositionDisabled(props); + if (isPositionDisabled) { + return null; + } + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PositionPanelPure, { + ...props + }); + }, + useBlockProps: position_useBlockProps, + attributeKeys: ['style'], + hasSupport(name) { + return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, POSITION_SUPPORT_KEY); + } +}); +function position_useBlockProps({ + name, + style +}) { + const hasPositionBlockSupport = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, POSITION_SUPPORT_KEY); + const isPositionDisabled = useIsPositionDisabled({ + name + }); + const allowPositionStyles = hasPositionBlockSupport && !isPositionDisabled; + const id = (0,external_wp_compose_namespaceObject.useInstanceId)(position_useBlockProps); + + // Higher specificity to override defaults in editor UI. + const positionSelector = `.wp-container-${id}.wp-container-${id}`; + + // Get CSS string for the current position values. + let css; + if (allowPositionStyles) { + css = getPositionCSS({ + selector: positionSelector, + style + }) || ''; + } + + // Attach a `wp-container-` id-based class name. + const className = dist_clsx({ + [`wp-container-${id}`]: allowPositionStyles && !!css, + // Only attach a container class if there is generated CSS to be attached. + [`is-position-${style?.position?.type}`]: allowPositionStyles && !!css && !!style?.position?.type + }); + useStyleOverride({ + css + }); + return { + className + }; +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/use-global-styles-output.js +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + + + + + + + + + + + + +// Elements that rely on class names in their selectors. +const ELEMENT_CLASS_NAMES = { + button: 'wp-element-button', + caption: 'wp-element-caption' +}; + +// List of block support features that can have their related styles +// generated under their own feature level selector rather than the block's. +const BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS = { + __experimentalBorder: 'border', + color: 'color', + spacing: 'spacing', + typography: 'typography' +}; +const { + kebabCase: use_global_styles_output_kebabCase +} = unlock(external_wp_components_namespaceObject.privateApis); +function compileStyleValue(uncompiledValue) { + const VARIABLE_REFERENCE_PREFIX = 'var:'; + const VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|'; + const VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--'; + if (uncompiledValue?.startsWith?.(VARIABLE_REFERENCE_PREFIX)) { + const variable = uncompiledValue.slice(VARIABLE_REFERENCE_PREFIX.length).split(VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE).join(VARIABLE_PATH_SEPARATOR_TOKEN_STYLE); + return `var(--wp--${variable})`; + } + return uncompiledValue; +} + +/** + * Transform given preset tree into a set of style declarations. + * + * @param {Object} blockPresets + * @param {Object} mergedSettings Merged theme.json settings. + * + * @return {Array} An array of style declarations. + */ +function getPresetsDeclarations(blockPresets = {}, mergedSettings) { + return PRESET_METADATA.reduce((declarations, { + path, + valueKey, + valueFunc, + cssVarInfix + }) => { + const presetByOrigin = getValueFromObjectPath(blockPresets, path, []); + ['default', 'theme', 'custom'].forEach(origin => { + if (presetByOrigin[origin]) { + presetByOrigin[origin].forEach(value => { + if (valueKey && !valueFunc) { + declarations.push(`--wp--preset--${cssVarInfix}--${use_global_styles_output_kebabCase(value.slug)}: ${value[valueKey]}`); + } else if (valueFunc && typeof valueFunc === 'function') { + declarations.push(`--wp--preset--${cssVarInfix}--${use_global_styles_output_kebabCase(value.slug)}: ${valueFunc(value, mergedSettings)}`); + } + }); + } + }); + return declarations; + }, []); +} + +/** + * Transform given preset tree into a set of preset class declarations. + * + * @param {?string} blockSelector + * @param {Object} blockPresets + * @return {string} CSS declarations for the preset classes. + */ +function getPresetsClasses(blockSelector = '*', blockPresets = {}) { + return PRESET_METADATA.reduce((declarations, { + path, + cssVarInfix, + classes + }) => { + if (!classes) { + return declarations; + } + const presetByOrigin = getValueFromObjectPath(blockPresets, path, []); + ['default', 'theme', 'custom'].forEach(origin => { + if (presetByOrigin[origin]) { + presetByOrigin[origin].forEach(({ + slug + }) => { + classes.forEach(({ + classSuffix, + propertyName + }) => { + const classSelectorToUse = `.has-${use_global_styles_output_kebabCase(slug)}-${classSuffix}`; + const selectorToUse = blockSelector.split(',') // Selector can be "h1, h2, h3" + .map(selector => `${selector}${classSelectorToUse}`).join(','); + const value = `var(--wp--preset--${cssVarInfix}--${use_global_styles_output_kebabCase(slug)})`; + declarations += `${selectorToUse}{${propertyName}: ${value} !important;}`; + }); + }); + } + }); + return declarations; + }, ''); +} +function getPresetsSvgFilters(blockPresets = {}) { + return PRESET_METADATA.filter( + // Duotone are the only type of filters for now. + metadata => metadata.path.at(-1) === 'duotone').flatMap(metadata => { + const presetByOrigin = getValueFromObjectPath(blockPresets, metadata.path, {}); + return ['default', 'theme'].filter(origin => presetByOrigin[origin]).flatMap(origin => presetByOrigin[origin].map(preset => getDuotoneFilter(`wp-duotone-${preset.slug}`, preset.colors))).join(''); + }); +} +function flattenTree(input = {}, prefix, token) { + let result = []; + Object.keys(input).forEach(key => { + const newKey = prefix + use_global_styles_output_kebabCase(key.replace('/', '-')); + const newLeaf = input[key]; + if (newLeaf instanceof Object) { + const newPrefix = newKey + token; + result = [...result, ...flattenTree(newLeaf, newPrefix, token)]; + } else { + result.push(`${newKey}: ${newLeaf}`); + } + }); + return result; +} + +/** + * Gets variation selector string from feature selector. + * + * @param {string} featureSelector The feature selector. + * + * @param {string} styleVariationSelector The style variation selector. + * @return {string} Combined selector string. + */ +function concatFeatureVariationSelectorString(featureSelector, styleVariationSelector) { + const featureSelectors = featureSelector.split(','); + const combinedSelectors = []; + featureSelectors.forEach(selector => { + combinedSelectors.push(`${styleVariationSelector.trim()}${selector.trim()}`); + }); + return combinedSelectors.join(', '); +} + +/** + * Generate style declarations for a block's custom feature and subfeature + * selectors. + * + * NOTE: The passed `styles` object will be mutated by this function. + * + * @param {Object} selectors Custom selectors object for a block. + * @param {Object} styles A block's styles object. + * + * @return {Object} Style declarations. + */ +const getFeatureDeclarations = (selectors, styles) => { + const declarations = {}; + Object.entries(selectors).forEach(([feature, selector]) => { + // We're only processing features/subfeatures that have styles. + if (feature === 'root' || !styles?.[feature]) { + return; + } + const isShorthand = typeof selector === 'string'; + + // If we have a selector object instead of shorthand process it. + if (!isShorthand) { + Object.entries(selector).forEach(([subfeature, subfeatureSelector]) => { + // Don't process root feature selector yet or any + // subfeature that doesn't have a style. + if (subfeature === 'root' || !styles?.[feature][subfeature]) { + return; + } + + // Create a temporary styles object and build + // declarations for subfeature. + const subfeatureStyles = { + [feature]: { + [subfeature]: styles[feature][subfeature] + } + }; + const newDeclarations = getStylesDeclarations(subfeatureStyles); + + // Merge new declarations in with any others that + // share the same selector. + declarations[subfeatureSelector] = [...(declarations[subfeatureSelector] || []), ...newDeclarations]; + + // Remove the subfeature's style now it will be + // included under its own selector not the block's. + delete styles[feature][subfeature]; + }); + } + + // Now subfeatures have been processed and removed, we can + // process root, or shorthand, feature selectors. + if (isShorthand || selector.root) { + const featureSelector = isShorthand ? selector : selector.root; + + // Create temporary style object and build declarations for feature. + const featureStyles = { + [feature]: styles[feature] + }; + const newDeclarations = getStylesDeclarations(featureStyles); + + // Merge new declarations with any others that share the selector. + declarations[featureSelector] = [...(declarations[featureSelector] || []), ...newDeclarations]; + + // Remove the feature from the block's styles now as it will be + // included under its own selector not the block's. + delete styles[feature]; + } + }); + return declarations; +}; + +/** + * Transform given style tree into a set of style declarations. + * + * @param {Object} blockStyles Block styles. + * + * @param {string} selector The selector these declarations should attach to. + * + * @param {boolean} useRootPaddingAlign Whether to use CSS custom properties in root selector. + * + * @param {Object} tree A theme.json tree containing layout definitions. + * + * @param {boolean} disableRootPadding Whether to force disable the root padding styles. + * @return {Array} An array of style declarations. + */ +function getStylesDeclarations(blockStyles = {}, selector = '', useRootPaddingAlign, tree = {}, disableRootPadding = false) { + const isRoot = ROOT_BLOCK_SELECTOR === selector; + const output = Object.entries(external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY).reduce((declarations, [key, { + value, + properties, + useEngine, + rootOnly + }]) => { + if (rootOnly && !isRoot) { + return declarations; + } + const pathToValue = value; + if (pathToValue[0] === 'elements' || useEngine) { + return declarations; + } + const styleValue = getValueFromObjectPath(blockStyles, pathToValue); + + // Root-level padding styles don't currently support strings with CSS shorthand values. + // This may change: https://github.com/WordPress/gutenberg/issues/40132. + if (key === '--wp--style--root--padding' && (typeof styleValue === 'string' || !useRootPaddingAlign)) { + return declarations; + } + if (properties && typeof styleValue !== 'string') { + Object.entries(properties).forEach(entry => { + const [name, prop] = entry; + if (!getValueFromObjectPath(styleValue, [prop], false)) { + // Do not create a declaration + // for sub-properties that don't have any value. + return; + } + const cssProperty = name.startsWith('--') ? name : use_global_styles_output_kebabCase(name); + declarations.push(`${cssProperty}: ${compileStyleValue(getValueFromObjectPath(styleValue, [prop]))}`); + }); + } else if (getValueFromObjectPath(blockStyles, pathToValue, false)) { + const cssProperty = key.startsWith('--') ? key : use_global_styles_output_kebabCase(key); + declarations.push(`${cssProperty}: ${compileStyleValue(getValueFromObjectPath(blockStyles, pathToValue))}`); + } + return declarations; + }, []); + + // The goal is to move everything to server side generated engine styles + // This is temporary as we absorb more and more styles into the engine. + const extraRules = (0,external_wp_styleEngine_namespaceObject.getCSSRules)(blockStyles); + extraRules.forEach(rule => { + // Don't output padding properties if padding variables are set or if we're not editing a full template. + if (isRoot && (useRootPaddingAlign || disableRootPadding) && rule.key.startsWith('padding')) { + return; + } + const cssProperty = rule.key.startsWith('--') ? rule.key : use_global_styles_output_kebabCase(rule.key); + let ruleValue = rule.value; + if (typeof ruleValue !== 'string' && ruleValue?.ref) { + const refPath = ruleValue.ref.split('.'); + ruleValue = compileStyleValue(getValueFromObjectPath(tree, refPath)); + // Presence of another ref indicates a reference to another dynamic value. + // Pointing to another dynamic value is not supported. + if (!ruleValue || ruleValue?.ref) { + return; + } + } + + // Calculate fluid typography rules where available. + if (cssProperty === 'font-size') { + /* + * getTypographyFontSizeValue() will check + * if fluid typography has been activated and also + * whether the incoming value can be converted to a fluid value. + * Values that already have a "clamp()" function will not pass the test, + * and therefore the original $value will be returned. + */ + ruleValue = getTypographyFontSizeValue({ + size: ruleValue + }, tree?.settings); + } + + // For aspect ratio to work, other dimensions rules (and Cover block defaults) must be unset. + // This ensures that a fixed height does not override the aspect ratio. + if (cssProperty === 'aspect-ratio') { + output.push('min-height: unset'); + } + output.push(`${cssProperty}: ${ruleValue}`); + }); + return output; +} + +/** + * Get generated CSS for layout styles by looking up layout definitions provided + * in theme.json, and outputting common layout styles, and specific blockGap values. + * + * @param {Object} props + * @param {Object} props.layoutDefinitions Layout definitions, keyed by layout type. + * @param {Object} props.style A style object containing spacing values. + * @param {string} props.selector Selector used to group together layout styling rules. + * @param {boolean} props.hasBlockGapSupport Whether or not the theme opts-in to blockGap support. + * @param {boolean} props.hasFallbackGapSupport Whether or not the theme allows fallback gap styles. + * @param {?string} props.fallbackGapValue An optional fallback gap value if no real gap value is available. + * @return {string} Generated CSS rules for the layout styles. + */ +function getLayoutStyles({ + layoutDefinitions = LAYOUT_DEFINITIONS, + style, + selector, + hasBlockGapSupport, + hasFallbackGapSupport, + fallbackGapValue +}) { + let ruleset = ''; + let gapValue = hasBlockGapSupport ? getGapCSSValue(style?.spacing?.blockGap) : ''; + + // Ensure a fallback gap value for the root layout definitions, + // and use a fallback value if one is provided for the current block. + if (hasFallbackGapSupport) { + if (selector === ROOT_BLOCK_SELECTOR) { + gapValue = !gapValue ? '0.5em' : gapValue; + } else if (!hasBlockGapSupport && fallbackGapValue) { + gapValue = fallbackGapValue; + } + } + if (gapValue && layoutDefinitions) { + Object.values(layoutDefinitions).forEach(({ + className, + name, + spacingStyles + }) => { + // Allow outputting fallback gap styles for flex layout type when block gap support isn't available. + if (!hasBlockGapSupport && 'flex' !== name && 'grid' !== name) { + return; + } + if (spacingStyles?.length) { + spacingStyles.forEach(spacingStyle => { + const declarations = []; + if (spacingStyle.rules) { + Object.entries(spacingStyle.rules).forEach(([cssProperty, cssValue]) => { + declarations.push(`${cssProperty}: ${cssValue ? cssValue : gapValue}`); + }); + } + if (declarations.length) { + let combinedSelector = ''; + if (!hasBlockGapSupport) { + // For fallback gap styles, use lower specificity, to ensure styles do not unintentionally override theme styles. + combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `:where(.${className}${spacingStyle?.selector || ''})` : `:where(${selector}.${className}${spacingStyle?.selector || ''})`; + } else { + combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `.${className}${spacingStyle?.selector || ''}` : `${selector}-${className}${spacingStyle?.selector || ''}`; + } + ruleset += `${combinedSelector} { ${declarations.join('; ')}; }`; + } + }); + } + }); + // For backwards compatibility, ensure the legacy block gap CSS variable is still available. + if (selector === ROOT_BLOCK_SELECTOR && hasBlockGapSupport) { + ruleset += `${ROOT_CSS_PROPERTIES_SELECTOR} { --wp--style--block-gap: ${gapValue}; }`; + } + } + + // Output base styles + if (selector === ROOT_BLOCK_SELECTOR && layoutDefinitions) { + const validDisplayModes = ['block', 'flex', 'grid']; + Object.values(layoutDefinitions).forEach(({ + className, + displayMode, + baseStyles + }) => { + if (displayMode && validDisplayModes.includes(displayMode)) { + ruleset += `${selector} .${className} { display:${displayMode}; }`; + } + if (baseStyles?.length) { + baseStyles.forEach(baseStyle => { + const declarations = []; + if (baseStyle.rules) { + Object.entries(baseStyle.rules).forEach(([cssProperty, cssValue]) => { + declarations.push(`${cssProperty}: ${cssValue}`); + }); + } + if (declarations.length) { + const combinedSelector = `.${className}${baseStyle?.selector || ''}`; + ruleset += `${combinedSelector} { ${declarations.join('; ')}; }`; + } + }); + } + }); + } + return ruleset; +} +const STYLE_KEYS = ['border', 'color', 'dimensions', 'spacing', 'typography', 'filter', 'outline', 'shadow', 'background']; +function pickStyleKeys(treeToPickFrom) { + if (!treeToPickFrom) { + return {}; + } + const entries = Object.entries(treeToPickFrom); + const pickedEntries = entries.filter(([key]) => STYLE_KEYS.includes(key)); + // clone the style objects so that `getFeatureDeclarations` can remove consumed keys from it + const clonedEntries = pickedEntries.map(([key, style]) => [key, JSON.parse(JSON.stringify(style))]); + return Object.fromEntries(clonedEntries); +} +const getNodesWithStyles = (tree, blockSelectors) => { + var _tree$styles$blocks; + const nodes = []; + if (!tree?.styles) { + return nodes; + } + + // Top-level. + const styles = pickStyleKeys(tree.styles); + if (styles) { + nodes.push({ + styles, + selector: ROOT_BLOCK_SELECTOR + }); + } + Object.entries(external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS).forEach(([name, selector]) => { + if (tree.styles?.elements?.[name]) { + nodes.push({ + styles: tree.styles?.elements?.[name], + selector, + // Top level elements that don't use a class name should not receive the + // `:root :where()` wrapper to maintain backwards compatibility. + skipSelectorWrapper: !ELEMENT_CLASS_NAMES[name] + }); + } + }); + + // Iterate over blocks: they can have styles & elements. + Object.entries((_tree$styles$blocks = tree.styles?.blocks) !== null && _tree$styles$blocks !== void 0 ? _tree$styles$blocks : {}).forEach(([blockName, node]) => { + var _node$elements; + const blockStyles = pickStyleKeys(node); + if (node?.variations) { + const variations = {}; + Object.entries(node.variations).forEach(([variationName, variation]) => { + var _variation$elements, _variation$blocks; + variations[variationName] = pickStyleKeys(variation); + if (variation?.css) { + variations[variationName].css = variation.css; + } + const variationSelector = blockSelectors[blockName]?.styleVariationSelectors?.[variationName]; + + // Process the variation's inner element styles. + // This comes before the inner block styles so the + // element styles within the block type styles take + // precedence over these. + Object.entries((_variation$elements = variation?.elements) !== null && _variation$elements !== void 0 ? _variation$elements : {}).forEach(([element, elementStyles]) => { + if (elementStyles && external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[element]) { + nodes.push({ + styles: elementStyles, + selector: scopeSelector(variationSelector, external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[element]) + }); + } + }); + + // Process the variations inner block type styles. + Object.entries((_variation$blocks = variation?.blocks) !== null && _variation$blocks !== void 0 ? _variation$blocks : {}).forEach(([variationBlockName, variationBlockStyles]) => { + var _variationBlockStyles; + const variationBlockSelector = scopeSelector(variationSelector, blockSelectors[variationBlockName]?.selector); + const variationDuotoneSelector = scopeSelector(variationSelector, blockSelectors[variationBlockName]?.duotoneSelector); + const variationFeatureSelectors = scopeFeatureSelectors(variationSelector, blockSelectors[variationBlockName]?.featureSelectors); + const variationBlockStyleNodes = pickStyleKeys(variationBlockStyles); + if (variationBlockStyles?.css) { + variationBlockStyleNodes.css = variationBlockStyles.css; + } + nodes.push({ + selector: variationBlockSelector, + duotoneSelector: variationDuotoneSelector, + featureSelectors: variationFeatureSelectors, + fallbackGapValue: blockSelectors[variationBlockName]?.fallbackGapValue, + hasLayoutSupport: blockSelectors[variationBlockName]?.hasLayoutSupport, + styles: variationBlockStyleNodes + }); + + // Process element styles for the inner blocks + // of the variation. + Object.entries((_variationBlockStyles = variationBlockStyles.elements) !== null && _variationBlockStyles !== void 0 ? _variationBlockStyles : {}).forEach(([variationBlockElement, variationBlockElementStyles]) => { + if (variationBlockElementStyles && external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[variationBlockElement]) { + nodes.push({ + styles: variationBlockElementStyles, + selector: scopeSelector(variationBlockSelector, external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[variationBlockElement]) + }); + } + }); + }); + }); + blockStyles.variations = variations; + } + if (blockSelectors?.[blockName]?.selector) { + nodes.push({ + duotoneSelector: blockSelectors[blockName].duotoneSelector, + fallbackGapValue: blockSelectors[blockName].fallbackGapValue, + hasLayoutSupport: blockSelectors[blockName].hasLayoutSupport, + selector: blockSelectors[blockName].selector, + styles: blockStyles, + featureSelectors: blockSelectors[blockName].featureSelectors, + styleVariationSelectors: blockSelectors[blockName].styleVariationSelectors + }); + } + Object.entries((_node$elements = node?.elements) !== null && _node$elements !== void 0 ? _node$elements : {}).forEach(([elementName, value]) => { + if (value && blockSelectors?.[blockName] && external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementName]) { + nodes.push({ + styles: value, + selector: blockSelectors[blockName]?.selector.split(',').map(sel => { + const elementSelectors = external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementName].split(','); + return elementSelectors.map(elementSelector => sel + ' ' + elementSelector); + }).join(',') + }); + } + }); + }); + return nodes; +}; +const getNodesWithSettings = (tree, blockSelectors) => { + var _tree$settings$blocks; + const nodes = []; + if (!tree?.settings) { + return nodes; + } + const pickPresets = treeToPickFrom => { + let presets = {}; + PRESET_METADATA.forEach(({ + path + }) => { + const value = getValueFromObjectPath(treeToPickFrom, path, false); + if (value !== false) { + presets = setImmutably(presets, path, value); + } + }); + return presets; + }; + + // Top-level. + const presets = pickPresets(tree.settings); + const custom = tree.settings?.custom; + if (Object.keys(presets).length > 0 || custom) { + nodes.push({ + presets, + custom, + selector: ROOT_CSS_PROPERTIES_SELECTOR + }); + } + + // Blocks. + Object.entries((_tree$settings$blocks = tree.settings?.blocks) !== null && _tree$settings$blocks !== void 0 ? _tree$settings$blocks : {}).forEach(([blockName, node]) => { + const blockPresets = pickPresets(node); + const blockCustom = node.custom; + if (Object.keys(blockPresets).length > 0 || blockCustom) { + nodes.push({ + presets: blockPresets, + custom: blockCustom, + selector: blockSelectors[blockName]?.selector + }); + } + }); + return nodes; +}; +const toCustomProperties = (tree, blockSelectors) => { + const settings = getNodesWithSettings(tree, blockSelectors); + let ruleset = ''; + settings.forEach(({ + presets, + custom, + selector + }) => { + const declarations = getPresetsDeclarations(presets, tree?.settings); + const customProps = flattenTree(custom, '--wp--custom--', '--'); + if (customProps.length > 0) { + declarations.push(...customProps); + } + if (declarations.length > 0) { + ruleset += `${selector}{${declarations.join(';')};}`; + } + }); + return ruleset; +}; +const toStyles = (tree, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles = false, disableRootPadding = false, styleOptions = undefined) => { + // These allow opting out of certain sets of styles. + const options = { + blockGap: true, + blockStyles: true, + layoutStyles: true, + marginReset: true, + presets: true, + rootPadding: true, + variationStyles: false, + ...styleOptions + }; + const nodesWithStyles = getNodesWithStyles(tree, blockSelectors); + const nodesWithSettings = getNodesWithSettings(tree, blockSelectors); + const useRootPaddingAlign = tree?.settings?.useRootPaddingAwareAlignments; + const { + contentSize, + wideSize + } = tree?.settings?.layout || {}; + const hasBodyStyles = options.marginReset || options.rootPadding || options.layoutStyles; + let ruleset = ''; + if (options.presets && (contentSize || wideSize)) { + ruleset += `${ROOT_CSS_PROPERTIES_SELECTOR} {`; + ruleset = contentSize ? ruleset + ` --wp--style--global--content-size: ${contentSize};` : ruleset; + ruleset = wideSize ? ruleset + ` --wp--style--global--wide-size: ${wideSize};` : ruleset; + ruleset += '}'; + } + if (hasBodyStyles) { + /* + * Reset default browser margin on the body element. + * This is set on the body selector **before** generating the ruleset + * from the `theme.json`. This is to ensure that if the `theme.json` declares + * `margin` in its `spacing` declaration for the `body` element then these + * user-generated values take precedence in the CSS cascade. + * @link https://github.com/WordPress/gutenberg/issues/36147. + */ + ruleset += ':where(body) {margin: 0;'; + + // Root padding styles should be output for full templates, patterns and template parts. + if (options.rootPadding && useRootPaddingAlign) { + /* + * These rules reproduce the ones from https://github.com/WordPress/gutenberg/blob/79103f124925d1f457f627e154f52a56228ed5ad/lib/class-wp-theme-json-gutenberg.php#L2508 + * almost exactly, but for the selectors that target block wrappers in the front end. This code only runs in the editor, so it doesn't need those selectors. + */ + ruleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) } + .has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); } + .has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); } + .has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) { padding-right: 0; padding-left: 0; } + .has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) > .alignfull { margin-left: 0; margin-right: 0; + `; + } + ruleset += '}'; + } + if (options.blockStyles) { + nodesWithStyles.forEach(({ + selector, + duotoneSelector, + styles, + fallbackGapValue, + hasLayoutSupport, + featureSelectors, + styleVariationSelectors, + skipSelectorWrapper + }) => { + // Process styles for block support features with custom feature level + // CSS selectors set. + if (featureSelectors) { + const featureDeclarations = getFeatureDeclarations(featureSelectors, styles); + Object.entries(featureDeclarations).forEach(([cssSelector, declarations]) => { + if (declarations.length) { + const rules = declarations.join(';'); + ruleset += `:root :where(${cssSelector}){${rules};}`; + } + }); + } + + // Process duotone styles. + if (duotoneSelector) { + const duotoneStyles = {}; + if (styles?.filter) { + duotoneStyles.filter = styles.filter; + delete styles.filter; + } + const duotoneDeclarations = getStylesDeclarations(duotoneStyles); + if (duotoneDeclarations.length) { + ruleset += `${duotoneSelector}{${duotoneDeclarations.join(';')};}`; + } + } + + // Process blockGap and layout styles. + if (!disableLayoutStyles && (ROOT_BLOCK_SELECTOR === selector || hasLayoutSupport)) { + ruleset += getLayoutStyles({ + style: styles, + selector, + hasBlockGapSupport, + hasFallbackGapSupport, + fallbackGapValue + }); + } + + // Process the remaining block styles (they use either normal block class or __experimentalSelector). + const styleDeclarations = getStylesDeclarations(styles, selector, useRootPaddingAlign, tree, disableRootPadding); + if (styleDeclarations?.length) { + const generalSelector = skipSelectorWrapper ? selector : `:root :where(${selector})`; + ruleset += `${generalSelector}{${styleDeclarations.join(';')};}`; + } + if (styles?.css) { + ruleset += processCSSNesting(styles.css, `:root :where(${selector})`); + } + if (options.variationStyles && styleVariationSelectors) { + Object.entries(styleVariationSelectors).forEach(([styleVariationName, styleVariationSelector]) => { + const styleVariations = styles?.variations?.[styleVariationName]; + if (styleVariations) { + // If the block uses any custom selectors for block support, add those first. + if (featureSelectors) { + const featureDeclarations = getFeatureDeclarations(featureSelectors, styleVariations); + Object.entries(featureDeclarations).forEach(([baseSelector, declarations]) => { + if (declarations.length) { + const cssSelector = concatFeatureVariationSelectorString(baseSelector, styleVariationSelector); + const rules = declarations.join(';'); + ruleset += `:root :where(${cssSelector}){${rules};}`; + } + }); + } + + // Otherwise add regular selectors. + const styleVariationDeclarations = getStylesDeclarations(styleVariations, styleVariationSelector, useRootPaddingAlign, tree); + if (styleVariationDeclarations.length) { + ruleset += `:root :where(${styleVariationSelector}){${styleVariationDeclarations.join(';')};}`; + } + if (styleVariations?.css) { + ruleset += processCSSNesting(styleVariations.css, `:root :where(${styleVariationSelector})`); + } + } + }); + } + + // Check for pseudo selector in `styles` and handle separately. + const pseudoSelectorStyles = Object.entries(styles).filter(([key]) => key.startsWith(':')); + if (pseudoSelectorStyles?.length) { + pseudoSelectorStyles.forEach(([pseudoKey, pseudoStyle]) => { + const pseudoDeclarations = getStylesDeclarations(pseudoStyle); + if (!pseudoDeclarations?.length) { + return; + } + + // `selector` may be provided in a form + // where block level selectors have sub element + // selectors appended to them as a comma separated + // string. + // e.g. `h1 a,h2 a,h3 a,h4 a,h5 a,h6 a`; + // Split and append pseudo selector to create + // the proper rules to target the elements. + const _selector = selector.split(',').map(sel => sel + pseudoKey).join(','); + + // As pseudo classes such as :hover, :focus etc. have class-level + // specificity, they must use the `:root :where()` wrapper. This. + // caps the specificity at `0-1-0` to allow proper nesting of variations + // and block type element styles. + const pseudoRule = `:root :where(${_selector}){${pseudoDeclarations.join(';')};}`; + ruleset += pseudoRule; + }); + } + }); + } + if (options.layoutStyles) { + /* Add alignment / layout styles */ + ruleset = ruleset + '.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }'; + ruleset = ruleset + '.wp-site-blocks > .alignright { float: right; margin-left: 2em; }'; + ruleset = ruleset + '.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }'; + } + if (options.blockGap && hasBlockGapSupport) { + // Use fallback of `0.5em` just in case, however if there is blockGap support, there should nearly always be a real value. + const gapValue = getGapCSSValue(tree?.styles?.spacing?.blockGap) || '0.5em'; + ruleset = ruleset + `:root :where(.wp-site-blocks) > * { margin-block-start: ${gapValue}; margin-block-end: 0; }`; + ruleset = ruleset + ':root :where(.wp-site-blocks) > :first-child { margin-block-start: 0; }'; + ruleset = ruleset + ':root :where(.wp-site-blocks) > :last-child { margin-block-end: 0; }'; + } + if (options.presets) { + nodesWithSettings.forEach(({ + selector, + presets + }) => { + if (ROOT_BLOCK_SELECTOR === selector || ROOT_CSS_PROPERTIES_SELECTOR === selector) { + // Do not add extra specificity for top-level classes. + selector = ''; + } + const classes = getPresetsClasses(selector, presets); + if (classes.length > 0) { + ruleset += classes; + } + }); + } + return ruleset; +}; +function toSvgFilters(tree, blockSelectors) { + const nodesWithSettings = getNodesWithSettings(tree, blockSelectors); + return nodesWithSettings.flatMap(({ + presets + }) => { + return getPresetsSvgFilters(presets); + }); +} +const getSelectorsConfig = (blockType, rootSelector) => { + if (blockType?.selectors && Object.keys(blockType.selectors).length > 0) { + return blockType.selectors; + } + const config = { + root: rootSelector + }; + Object.entries(BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS).forEach(([featureKey, featureName]) => { + const featureSelector = getBlockCSSSelector(blockType, featureKey); + if (featureSelector) { + config[featureName] = featureSelector; + } + }); + return config; +}; +const getBlockSelectors = (blockTypes, getBlockStyles, variationInstanceId) => { + const result = {}; + blockTypes.forEach(blockType => { + const name = blockType.name; + const selector = getBlockCSSSelector(blockType); + let duotoneSelector = getBlockCSSSelector(blockType, 'filter.duotone'); + + // Keep backwards compatibility for support.color.__experimentalDuotone. + if (!duotoneSelector) { + const rootSelector = getBlockCSSSelector(blockType); + const duotoneSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, 'color.__experimentalDuotone', false); + duotoneSelector = duotoneSupport && scopeSelector(rootSelector, duotoneSupport); + } + const hasLayoutSupport = !!blockType?.supports?.layout || !!blockType?.supports?.__experimentalLayout; + const fallbackGapValue = blockType?.supports?.spacing?.blockGap?.__experimentalDefault; + const blockStyleVariations = getBlockStyles(name); + const styleVariationSelectors = {}; + blockStyleVariations?.forEach(variation => { + const variationSuffix = variationInstanceId ? `-${variationInstanceId}` : ''; + const variationName = `${variation.name}${variationSuffix}`; + const styleVariationSelector = getBlockStyleVariationSelector(variationName, selector); + styleVariationSelectors[variationName] = styleVariationSelector; + }); + + // For each block support feature add any custom selectors. + const featureSelectors = getSelectorsConfig(blockType, selector); + result[name] = { + duotoneSelector, + fallbackGapValue, + featureSelectors: Object.keys(featureSelectors).length ? featureSelectors : undefined, + hasLayoutSupport, + name, + selector, + styleVariationSelectors: blockStyleVariations?.length ? styleVariationSelectors : undefined + }; + }); + return result; +}; + +/** + * If there is a separator block whose color is defined in theme.json via background, + * update the separator color to the same value by using border color. + * + * @param {Object} config Theme.json configuration file object. + * @return {Object} configTheme.json configuration file object updated. + */ +function updateConfigWithSeparator(config) { + const needsSeparatorStyleUpdate = config.styles?.blocks?.['core/separator'] && config.styles?.blocks?.['core/separator'].color?.background && !config.styles?.blocks?.['core/separator'].color?.text && !config.styles?.blocks?.['core/separator'].border?.color; + if (needsSeparatorStyleUpdate) { + return { + ...config, + styles: { + ...config.styles, + blocks: { + ...config.styles.blocks, + 'core/separator': { + ...config.styles.blocks['core/separator'], + color: { + ...config.styles.blocks['core/separator'].color, + text: config.styles?.blocks['core/separator'].color.background + } + } + } + } + }; + } + return config; +} +function processCSSNesting(css, blockSelector) { + let processedCSS = ''; + + // Split CSS nested rules. + const parts = css.split('&'); + parts.forEach(part => { + const isRootCss = !part.includes('{'); + if (isRootCss) { + // If the part doesn't contain braces, it applies to the root level. + processedCSS += `:root :where(${blockSelector}){${part.trim()}}`; + } else { + // If the part contains braces, it's a nested CSS rule. + const splittedPart = part.replace('}', '').split('{'); + if (splittedPart.length !== 2) { + return; + } + const [nestedSelector, cssValue] = splittedPart; + const combinedSelector = nestedSelector.startsWith(' ') ? scopeSelector(blockSelector, nestedSelector) : appendToSelector(blockSelector, nestedSelector); + processedCSS += `:root :where(${combinedSelector}){${cssValue.trim()}}`; + } + }); + return processedCSS; +} + +/** + * Returns the global styles output using a global styles configuration. + * If wishing to generate global styles and settings based on the + * global styles config loaded in the editor context, use `useGlobalStylesOutput()`. + * The use case for a custom config is to generate bespoke styles + * and settings for previews, or other out-of-editor experiences. + * + * @param {Object} mergedConfig Global styles configuration. + * @param {boolean} disableRootPadding Disable root padding styles. + * + * @return {Array} Array of stylesheets and settings. + */ +function useGlobalStylesOutputWithConfig(mergedConfig = {}, disableRootPadding) { + const [blockGap] = useGlobalSetting('spacing.blockGap'); + mergedConfig = setThemeFileUris(mergedConfig, mergedConfig?._links?.['wp:theme-file']); + const hasBlockGapSupport = blockGap !== null; + const hasFallbackGapSupport = !hasBlockGapSupport; // This setting isn't useful yet: it exists as a placeholder for a future explicit fallback styles support. + const disableLayoutStyles = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getSettings + } = select(store); + return !!getSettings().disableLayoutStyles; + }); + const { + getBlockStyles + } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); + return (0,external_wp_element_namespaceObject.useMemo)(() => { + var _updatedConfig$styles; + if (!mergedConfig?.styles || !mergedConfig?.settings) { + return []; + } + const updatedConfig = updateConfigWithSeparator(mergedConfig); + const blockSelectors = getBlockSelectors((0,external_wp_blocks_namespaceObject.getBlockTypes)(), getBlockStyles); + const customProperties = toCustomProperties(updatedConfig, blockSelectors); + const globalStyles = toStyles(updatedConfig, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles, disableRootPadding); + const svgs = toSvgFilters(updatedConfig, blockSelectors); + const styles = [{ + css: customProperties, + isGlobalStyles: true + }, { + css: globalStyles, + isGlobalStyles: true + }, + // Load custom CSS in own stylesheet so that any invalid CSS entered in the input won't break all the global styles in the editor. + { + css: (_updatedConfig$styles = updatedConfig.styles.css) !== null && _updatedConfig$styles !== void 0 ? _updatedConfig$styles : '', + isGlobalStyles: true + }, { + assets: svgs, + __unstableType: 'svg', + isGlobalStyles: true + }]; + + // Loop through the blocks to check if there are custom CSS values. + // If there are, get the block selector and push the selector together with + // the CSS value to the 'stylesheets' array. + (0,external_wp_blocks_namespaceObject.getBlockTypes)().forEach(blockType => { + if (updatedConfig.styles.blocks[blockType.name]?.css) { + const selector = blockSelectors[blockType.name].selector; + styles.push({ + css: processCSSNesting(updatedConfig.styles.blocks[blockType.name]?.css, selector), + isGlobalStyles: true + }); + } + }); + return [styles, updatedConfig.settings]; + }, [hasBlockGapSupport, hasFallbackGapSupport, mergedConfig, disableLayoutStyles, disableRootPadding, getBlockStyles]); +} + +/** + * Returns the global styles output based on the current state of global styles config loaded in the editor context. + * + * @param {boolean} disableRootPadding Disable root padding styles. + * + * @return {Array} Array of stylesheets and settings. + */ +function useGlobalStylesOutput(disableRootPadding = false) { + const { + merged: mergedConfig + } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); + return useGlobalStylesOutputWithConfig(mergedConfig, disableRootPadding); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/block-style-variation.js +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies */ -function hasPositionSupport(blockType) { - const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, POSITION_SUPPORT_KEY); - return !!support; + + + + + + + + +const VARIATION_PREFIX = 'is-style-'; +function getVariationMatches(className) { + if (!className) { + return []; + } + return className.split(/\s+/).reduce((matches, name) => { + if (name.startsWith(VARIATION_PREFIX)) { + const match = name.slice(VARIATION_PREFIX.length); + if (match !== 'default') { + matches.push(match); + } + } + return matches; + }, []); } /** - * Checks if there is a current value in the position block support attributes. + * Get the first block style variation that has been registered from the class string. * - * @param {Object} props Block props. - * @return {boolean} Whether or not the block has a position value set. + * @param {string} className CSS class string for a block. + * @param {Array} registeredStyles Currently registered block styles. + * + * @return {string|null} The name of the first registered variation. */ -function hasPositionValue(props) { - return props.attributes.style?.position?.type !== undefined; +function getVariationNameFromClass(className, registeredStyles = []) { + // The global flag affects how capturing groups work in JS. So the regex + // below will only return full CSS classes not just the variation name. + const matches = getVariationMatches(className); + if (!matches) { + return null; + } + for (const variation of matches) { + if (registeredStyles.some(style => style.name === variation)) { + return variation; + } + } + return null; } -/** - * Checks if the block is currently set to a sticky or fixed position. - * This check is helpful for determining how to position block toolbars or other elements. - * - * @param {Object} attributes Block attributes. - * @return {boolean} Whether or not the block is set to a sticky or fixed position. - */ -function hasStickyOrFixedPositionValue(attributes) { - const positionType = attributes.style?.position?.type; - return positionType === 'sticky' || positionType === 'fixed'; +// A helper component to apply a style override using the useStyleOverride hook. +function OverrideStyles({ + override +}) { + useStyleOverride(override); } /** - * Resets the position block support attributes. This can be used when disabling - * the position support controls for a block via a `ToolsPanel`. + * This component is used to generate new block style variation overrides + * based on an incoming theme config. If a matching style is found in the config, + * a new override is created and returned. The overrides can be used in conjunction with + * useStyleOverride to apply the new styles to the editor. Its use is + * subject to change. * - * @param {Object} props Block props. - * @param {Object} props.attributes Block's attributes. - * @param {Object} props.setAttributes Function to set block's attributes. + * @param {Object} props Props. + * @param {Object} props.config A global styles object, containing settings and styles. + * @return {JSX.Element|undefined} An array of new block variation overrides. */ -function resetPosition({ - attributes = {}, - setAttributes +function __unstableBlockStyleVariationOverridesWithConfig({ + config }) { const { - style = {} - } = attributes; - setAttributes({ - style: cleanEmptyObject({ - ...style, - position: { - ...style?.position, - type: undefined, - top: undefined, - right: undefined, - bottom: undefined, - left: undefined + getBlockStyles, + overrides + } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ + getBlockStyles: select(external_wp_blocks_namespaceObject.store).getBlockStyles, + overrides: unlock(select(store)).getStyleOverrides() + }), []); + const { + getBlockName + } = (0,external_wp_data_namespaceObject.useSelect)(store); + const overridesWithConfig = (0,external_wp_element_namespaceObject.useMemo)(() => { + if (!overrides?.length) { + return; + } + const newOverrides = []; + const overriddenClientIds = []; + for (const [, override] of overrides) { + if (override?.variation && override?.clientId && + /* + * Because this component overwrites existing style overrides, + * filter out any overrides that are already present in the store. + */ + !overriddenClientIds.includes(override.clientId)) { + const blockName = getBlockName(override.clientId); + const configStyles = config?.styles?.blocks?.[blockName]?.variations?.[override.variation]; + if (configStyles) { + const variationConfig = { + settings: config?.settings, + // The variation style data is all that is needed to generate + // the styles for the current application to a block. The variation + // name is updated to match the instance specific class name. + styles: { + blocks: { + [blockName]: { + variations: { + [`${override.variation}-${override.clientId}`]: configStyles + } + } + } + } + }; + const blockSelectors = getBlockSelectors((0,external_wp_blocks_namespaceObject.getBlockTypes)(), getBlockStyles, override.clientId); + const hasBlockGapSupport = false; + const hasFallbackGapSupport = true; + const disableLayoutStyles = true; + const disableRootPadding = true; + const variationStyles = toStyles(variationConfig, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles, disableRootPadding, { + blockGap: false, + blockStyles: true, + layoutStyles: false, + marginReset: false, + presets: false, + rootPadding: false, + variationStyles: true + }); + newOverrides.push({ + id: `${override.variation}-${override.clientId}`, + css: variationStyles, + __unstableType: 'variation', + variation: override.variation, + // The clientId will be stored with the override and used to ensure + // the order of overrides matches the order of blocks so that the + // correct CSS cascade is maintained. + clientId: override.clientId + }); + overriddenClientIds.push(override.clientId); + } } - }) + } + return newOverrides; + }, [config, overrides, getBlockStyles, getBlockName]); + if (!overridesWithConfig || !overridesWithConfig.length) { + return; + } + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: overridesWithConfig.map(override => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(OverrideStyles, { + override: override + }, override.id)) }); } /** - * Custom hook that checks if position settings have been disabled. + * Retrieves any variation styles data and resolves any referenced values. * - * @param {string} name The name of the block. + * @param {Object} globalStyles A complete global styles object, containing settings and styles. + * @param {string} name The name of the desired block type. + * @param {variation} variation The of the block style variation to retrieve data for. * - * @return {boolean} Whether padding setting is disabled. + * @return {Object|undefined} The global styles data for the specified variation. */ -function useIsPositionDisabled({ - name: blockName -} = {}) { - const [allowFixed, allowSticky] = use_settings_useSettings('position.fixed', 'position.sticky'); - const isDisabled = !allowFixed && !allowSticky; - return !hasPositionSupport(blockName) || isDisabled; -} +function getVariationStylesWithRefValues(globalStyles, name, variation) { + if (!globalStyles?.styles?.blocks?.[name]?.variations?.[variation]) { + return; + } -/* - * Position controls rendered in an inspector control panel. - * - * @param {Object} props - * - * @return {Element} Position panel. - */ -function PositionPanelPure({ - style = {}, - clientId, - name: blockName, - setAttributes -}) { - const allowFixed = hasFixedPositionSupport(blockName); - const allowSticky = hasStickyPositionSupport(blockName); - const value = style?.position?.type; + // Helper to recursively look for `ref` values to resolve. + const replaceRefs = variationStyles => { + Object.keys(variationStyles).forEach(key => { + const value = variationStyles[key]; + + // Only process objects. + if (typeof value === 'object' && value !== null) { + // Process `ref` value if present. + if (value.ref !== undefined) { + if (typeof value.ref !== 'string' || value.ref.trim() === '') { + // Remove invalid ref. + delete variationStyles[key]; + } else { + // Resolve `ref` value. + const refValue = getValueFromObjectPath(globalStyles, value.ref); + if (refValue) { + variationStyles[key] = refValue; + } else { + delete variationStyles[key]; + } + } + } else { + // Recursively resolve `ref` values in nested objects. + replaceRefs(value); + + // After recursion, if value is empty due to explicitly + // `undefined` ref value, remove it. + if (Object.keys(value).length === 0) { + delete variationStyles[key]; + } + } + } + }); + }; + + // Deep clone variation node to avoid mutating it within global styles and losing refs. + const styles = JSON.parse(JSON.stringify(globalStyles.styles.blocks[name].variations[variation])); + replaceRefs(styles); + return styles; +} +function useBlockStyleVariation(name, variation, clientId) { + // Prefer global styles data in GlobalStylesContext, which are available + // if in the site editor. Otherwise fall back to whatever is in the + // editor settings and available in the post editor. const { - firstParentClientId + merged: mergedConfig + } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); + const { + globalSettings, + globalStyles } = (0,external_wp_data_namespaceObject.useSelect)(select => { - const { - getBlockParents - } = select(store); - const parents = getBlockParents(clientId); + const settings = select(store).getSettings(); return { - firstParentClientId: parents[parents.length - 1] + globalSettings: settings.__experimentalFeatures, + globalStyles: settings[globalStylesDataKey] }; - }, [clientId]); - const blockInformation = useBlockDisplayInformation(firstParentClientId); - const stickyHelpText = allowSticky && value === STICKY_OPTION.value && blockInformation ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: the name of the parent block. */ - (0,external_wp_i18n_namespaceObject.__)('The block will stick to the scrollable area of the parent %s block.'), blockInformation.title) : null; - const options = (0,external_wp_element_namespaceObject.useMemo)(() => { - const availableOptions = [DEFAULT_OPTION]; - // Display options if they are allowed, or if a block already has a valid value set. - // This allows for a block to be switched off from a position type that is not allowed. - if (allowSticky || value === STICKY_OPTION.value) { - availableOptions.push(STICKY_OPTION); - } - if (allowFixed || value === FIXED_OPTION.value) { - availableOptions.push(FIXED_OPTION); - } - return availableOptions; - }, [allowFixed, allowSticky, value]); - const onChangeType = next => { - // For now, use a hard-coded `0px` value for the position. - // `0px` is preferred over `0` as it can be used in `calc()` functions. - // In the future, it could be useful to allow for an offset value. - const placementValue = '0px'; - const newStyle = { - ...style, - position: { - ...style?.position, - type: next, - top: next === 'sticky' || next === 'fixed' ? placementValue : undefined + }, []); + return (0,external_wp_element_namespaceObject.useMemo)(() => { + var _mergedConfig$setting, _mergedConfig$styles, _mergedConfig$setting2; + const variationStyles = getVariationStylesWithRefValues({ + settings: (_mergedConfig$setting = mergedConfig?.settings) !== null && _mergedConfig$setting !== void 0 ? _mergedConfig$setting : globalSettings, + styles: (_mergedConfig$styles = mergedConfig?.styles) !== null && _mergedConfig$styles !== void 0 ? _mergedConfig$styles : globalStyles + }, name, variation); + return { + settings: (_mergedConfig$setting2 = mergedConfig?.settings) !== null && _mergedConfig$setting2 !== void 0 ? _mergedConfig$setting2 : globalSettings, + // The variation style data is all that is needed to generate + // the styles for the current application to a block. The variation + // name is updated to match the instance specific class name. + styles: { + blocks: { + [name]: { + variations: { + [`${variation}-${clientId}`]: variationStyles + } + } + } } }; - setAttributes({ - style: utils_cleanEmptyObject(newStyle) - }); - }; - const selectedOption = value ? options.find(option => option.value === value) || DEFAULT_OPTION : DEFAULT_OPTION; - - // Only display position controls if there is at least one option to choose from. - return external_wp_element_namespaceObject.Platform.select({ - web: options.length > 1 ? (0,external_React_.createElement)(inspector_controls, { - group: "position" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.BaseControl, { - className: "block-editor-hooks__position-selection", - __nextHasNoMarginBottom: true, - help: stickyHelpText - }, (0,external_React_.createElement)(CustomSelectControl, { - __nextUnconstrainedWidth: true, - __next40pxDefaultSize: true, - className: "block-editor-hooks__position-selection__select-control", - label: (0,external_wp_i18n_namespaceObject.__)('Position'), - hideLabelFromVision: true, - describedBy: (0,external_wp_i18n_namespaceObject.sprintf)( - // translators: %s: Currently selected position. - (0,external_wp_i18n_namespaceObject.__)('Currently selected position: %s'), selectedOption.name), - options: options, - value: selectedOption, - __experimentalShowSelectedHint: true, - onChange: ({ - selectedItem - }) => { - onChangeType(selectedItem.value); - }, - size: '__unstable-large' - }))) : null, - native: null - }); + }, [mergedConfig, globalSettings, globalStyles, variation, clientId, name]); } -/* harmony default export */ const position = ({ - edit: function Edit(props) { - const isPositionDisabled = useIsPositionDisabled(props); - if (isPositionDisabled) { - return null; - } - return (0,external_React_.createElement)(PositionPanelPure, { - ...props - }); - }, - useBlockProps: position_useBlockProps, - attributeKeys: ['style'], - hasSupport(name) { - return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, POSITION_SUPPORT_KEY); - } -}); -function position_useBlockProps({ + +// Rather than leveraging `useInstanceId` here, the `clientId` is used. +// This is so that the variation style override's ID is predictable +// when the order of applied style variations changes. +function block_style_variation_useBlockProps({ name, - style + className, + clientId }) { - const hasPositionBlockSupport = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, POSITION_SUPPORT_KEY); - const isPositionDisabled = useIsPositionDisabled({ - name - }); - const allowPositionStyles = hasPositionBlockSupport && !isPositionDisabled; - const id = (0,external_wp_compose_namespaceObject.useInstanceId)(position_useBlockProps); - - // Higher specificity to override defaults in editor UI. - const positionSelector = `.wp-container-${id}.wp-container-${id}`; - - // Get CSS string for the current position values. - let css; - if (allowPositionStyles) { - css = getPositionCSS({ - selector: positionSelector, - style - }) || ''; - } - - // Attach a `wp-container-` id-based class name. - const className = classnames_default()({ - [`wp-container-${id}`]: allowPositionStyles && !!css, - // Only attach a container class if there is generated CSS to be attached. - [`is-position-${style?.position?.type}`]: allowPositionStyles && !!css && !!style?.position?.type - }); + const { + getBlockStyles + } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); + const registeredStyles = getBlockStyles(name); + const variation = getVariationNameFromClass(className, registeredStyles); + const variationClass = `${VARIATION_PREFIX}${variation}-${clientId}`; + const { + settings, + styles + } = useBlockStyleVariation(name, variation, clientId); + const variationStyles = (0,external_wp_element_namespaceObject.useMemo)(() => { + if (!variation) { + return; + } + const variationConfig = { + settings, + styles + }; + const blockSelectors = getBlockSelectors((0,external_wp_blocks_namespaceObject.getBlockTypes)(), getBlockStyles, clientId); + const hasBlockGapSupport = false; + const hasFallbackGapSupport = true; + const disableLayoutStyles = true; + const disableRootPadding = true; + return toStyles(variationConfig, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles, disableRootPadding, { + blockGap: false, + blockStyles: true, + layoutStyles: false, + marginReset: false, + presets: false, + rootPadding: false, + variationStyles: true + }); + }, [variation, settings, styles, getBlockStyles, clientId]); useStyleOverride({ - css + id: `variation-${clientId}`, + css: variationStyles, + __unstableType: 'variation', + variation, + // The clientId will be stored with the override and used to ensure + // the order of overrides matches the order of blocks so that the + // correct CSS cascade is maintained. + clientId }); - return { - className - }; + return variation ? { + className: variationClass + } : {}; } +/* harmony default export */ const block_style_variation = ({ + hasSupport: () => true, + attributeKeys: ['className'], + isMatch: ({ + className + }) => getVariationMatches(className).length > 0, + useBlockProps: block_style_variation_useBlockProps +}); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/layout.js - /** * External dependencies */ @@ -32645,7 +35065,13 @@ function position_useBlockProps({ + + + const layoutBlockSupportKey = 'layout'; +const { + kebabCase: layout_kebabCase +} = unlock(external_wp_components_namespaceObject.privateApis); function hasLayoutBlockSupport(blockName) { return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, 'layout') || (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, '__experimentalLayout'); } @@ -32659,15 +35085,6 @@ function hasLayoutBlockSupport(blockName) { * @return { Array } Array of CSS classname strings. */ function useLayoutClasses(blockAttributes = {}, blockName = '') { - const { - kebabCase - } = unlock(external_wp_components_namespaceObject.privateApis); - const rootPaddingAlignment = (0,external_wp_data_namespaceObject.useSelect)(select => { - const { - getSettings - } = select(store); - return getSettings().__experimentalFeatures?.useRootPaddingAwareAlignments; - }, []); const { layout } = blockAttributes; @@ -32686,14 +35103,17 @@ function useLayoutClasses(blockAttributes = {}, blockName = '') { const compoundClassName = `wp-block-${fullBlockName}-${baseClassName}`; layoutClassnames.push(baseClassName, compoundClassName); } - if ((usedLayout?.inherit || usedLayout?.contentSize || usedLayout?.type === 'constrained') && rootPaddingAlignment) { + const hasGlobalPadding = (0,external_wp_data_namespaceObject.useSelect)(select => { + return (usedLayout?.inherit || usedLayout?.contentSize || usedLayout?.type === 'constrained') && select(store).getSettings().__experimentalFeatures?.useRootPaddingAwareAlignments; + }, [usedLayout?.contentSize, usedLayout?.inherit, usedLayout?.type]); + if (hasGlobalPadding) { layoutClassnames.push('has-global-padding'); } if (usedLayout?.orientation) { - layoutClassnames.push(`is-${kebabCase(usedLayout.orientation)}`); + layoutClassnames.push(`is-${layout_kebabCase(usedLayout.orientation)}`); } if (usedLayout?.justifyContent) { - layoutClassnames.push(`is-content-justification-${kebabCase(usedLayout.justifyContent)}`); + layoutClassnames.push(`is-content-justification-${layout_kebabCase(usedLayout.justifyContent)}`); } if (usedLayout?.flexWrap && usedLayout.flexWrap === 'nowrap') { layoutClassnames.push('is-nowrap'); @@ -32723,27 +35143,25 @@ function useLayoutStyles(blockAttributes = {}, blockName, selector) { const fullLayoutType = getLayoutType(usedLayout?.type || 'default'); const [blockGapSupport] = use_settings_useSettings('spacing.blockGap'); const hasBlockGapSupport = blockGapSupport !== null; - const css = fullLayoutType?.getLayoutStyle?.({ + return fullLayoutType?.getLayoutStyle?.({ blockName, selector, layout, style, hasBlockGapSupport }); - return css; } function LayoutPanelPure({ layout, setAttributes, - name: blockName + name: blockName, + clientId }) { const settings = useBlockSettings(blockName); // Block settings come from theme.json under settings.[blockName]. const { layout: layoutSettings } = settings; - // Layout comes from block attributes. - const [defaultThemeLayout] = use_settings_useSettings('layout'); const { themeSupportsLayout } = (0,external_wp_data_namespaceObject.useSelect)(select => { @@ -32775,14 +35193,28 @@ function LayoutPanelPure({ return null; } + /* + * Try to find the layout type from either the + * block's layout settings or any saved layout config. + */ + const blockSupportAndLayout = { + ...layoutBlockSupport, + ...layout + }; + const { + type, + default: { + type: defaultType = 'default' + } = {} + } = blockSupportAndLayout; + const blockLayoutType = type || defaultType; + // Only show the inherit toggle if it's supported, - // a default theme layout is set (e.g. one that provides `contentSize` and/or `wideSize` values), // and either the default / flow or the constrained layout type is in use, as the toggle switches from one to the other. - const showInheritToggle = !!(allowInheriting && !!defaultThemeLayout && (!layout?.type || layout?.type === 'default' || layout?.type === 'constrained' || layout?.inherit)); + const showInheritToggle = !!(allowInheriting && (!blockLayoutType || blockLayoutType === 'default' || blockLayoutType === 'constrained' || blockSupportAndLayout.inherit)); const usedLayout = layout || defaultBlockLayout || {}; const { inherit = false, - type = 'default', contentSize = null } = usedLayout; /** @@ -32790,10 +35222,10 @@ function LayoutPanelPure({ * `constrained` layouts and it should not be taken into account when other * `layout` types are used. */ - if ((type === 'default' || type === 'constrained') && !themeSupportsLayout) { + if ((blockLayoutType === 'default' || blockLayoutType === 'constrained') && !themeSupportsLayout) { return null; } - const layoutType = getLayoutType(type); + const layoutType = getLayoutType(blockLayoutType); const constrainedType = getLayoutType('constrained'); const displayControlsForLegacyLayouts = !usedLayout.type && (contentSize || inherit); const hasContentSizeOrLegacySettings = !!inherit || !!contentSize; @@ -32805,35 +35237,48 @@ function LayoutPanelPure({ const onChangeLayout = newLayout => setAttributes({ layout: newLayout }); - return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(inspector_controls, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, { - title: (0,external_wp_i18n_namespaceObject.__)('Layout') - }, showInheritToggle && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToggleControl, { - __nextHasNoMarginBottom: true, - className: "block-editor-hooks__toggle-control", - label: (0,external_wp_i18n_namespaceObject.__)('Inner blocks use content width'), - checked: layoutType?.name === 'constrained' || hasContentSizeOrLegacySettings, - onChange: () => setAttributes({ - layout: { - type: layoutType?.name === 'constrained' || hasContentSizeOrLegacySettings ? 'default' : 'constrained' - } - }), - help: layoutType?.name === 'constrained' || hasContentSizeOrLegacySettings ? (0,external_wp_i18n_namespaceObject.__)('Nested blocks use content width with options for full and wide widths.') : (0,external_wp_i18n_namespaceObject.__)('Nested blocks will fill the width of this container. Toggle to constrain.') - })), !inherit && allowSwitching && (0,external_React_.createElement)(LayoutTypeSwitcher, { - type: type, - onChange: onChangeType - }), layoutType && layoutType.name !== 'default' && (0,external_React_.createElement)(layoutType.inspectorControls, { - layout: usedLayout, - onChange: onChangeLayout, - layoutBlockSupport: blockSupportAndThemeSettings - }), constrainedType && displayControlsForLegacyLayouts && (0,external_React_.createElement)(constrainedType.inspectorControls, { - layout: usedLayout, - onChange: onChangeLayout, - layoutBlockSupport: blockSupportAndThemeSettings - }))), !inherit && layoutType && (0,external_React_.createElement)(layoutType.toolBarControls, { - layout: usedLayout, - onChange: onChangeLayout, - layoutBlockSupport: layoutBlockSupport - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { + title: (0,external_wp_i18n_namespaceObject.__)('Layout'), + children: [showInheritToggle && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { + __nextHasNoMarginBottom: true, + className: "block-editor-hooks__toggle-control", + label: (0,external_wp_i18n_namespaceObject.__)('Inner blocks use content width'), + checked: layoutType?.name === 'constrained' || hasContentSizeOrLegacySettings, + onChange: () => setAttributes({ + layout: { + type: layoutType?.name === 'constrained' || hasContentSizeOrLegacySettings ? 'default' : 'constrained' + } + }), + help: layoutType?.name === 'constrained' || hasContentSizeOrLegacySettings ? (0,external_wp_i18n_namespaceObject.__)('Nested blocks use content width with options for full and wide widths.') : (0,external_wp_i18n_namespaceObject.__)('Nested blocks will fill the width of this container. Toggle to constrain.') + }) + }), !inherit && allowSwitching && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutTypeSwitcher, { + type: blockLayoutType, + onChange: onChangeType + }), layoutType && layoutType.name !== 'default' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(layoutType.inspectorControls, { + layout: usedLayout, + onChange: onChangeLayout, + layoutBlockSupport: blockSupportAndThemeSettings, + name: blockName, + clientId: clientId + }), constrainedType && displayControlsForLegacyLayouts && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(constrainedType.inspectorControls, { + layout: usedLayout, + onChange: onChangeLayout, + layoutBlockSupport: blockSupportAndThemeSettings, + name: blockName, + clientId: clientId + })] + }) + }), !inherit && layoutType && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(layoutType.toolBarControls, { + layout: usedLayout, + onChange: onChangeLayout, + layoutBlockSupport: layoutBlockSupport, + name: blockName, + clientId: clientId + })] + }); } /* harmony default export */ const layout = ({ shareWithChildBlocks: true, @@ -32847,16 +35292,18 @@ function LayoutTypeSwitcher({ type, onChange }) { - return (0,external_React_.createElement)(external_wp_components_namespaceObject.ButtonGroup, null, getLayoutTypes().map(({ - name, - label - }) => { - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - key: name, - isPressed: type === name, - onClick: () => onChange(name) - }, label); - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ButtonGroup, { + children: getLayoutTypes().map(({ + name, + label + }) => { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + isPressed: type === name, + onClick: () => onChange(name), + children: label + }, name); + }) + }); } /** @@ -32884,6 +35331,7 @@ function layout_addAttribute(settings) { function BlockWithLayoutStyles({ block: BlockListBlock, props, + blockGapSupport, layoutClasses }) { const { @@ -32901,13 +35349,9 @@ function BlockWithLayoutStyles({ ...layout, type: 'constrained' } : layout || defaultBlockLayout || {}; - const { - kebabCase - } = unlock(external_wp_components_namespaceObject.privateApis); - const selectorPrefix = `wp-container-${kebabCase(name)}-is-layout-`; + const selectorPrefix = `wp-container-${layout_kebabCase(name)}-is-layout-`; // Higher specificity to override defaults from theme.json. - const selector = `.${selectorPrefix}${id}.${selectorPrefix}${id}`; - const [blockGapSupport] = use_settings_useSettings('spacing.blockGap'); + const selector = `.${selectorPrefix}${id}`; const hasBlockGapSupport = blockGapSupport !== null; // Get CSS string for the current layout type. @@ -32922,13 +35366,13 @@ function BlockWithLayoutStyles({ }); // Attach a `wp-container-` id-based class name as well as a layout class name such as `is-layout-flex`. - const layoutClassNames = classnames_default()({ + const layoutClassNames = dist_clsx({ [`${selectorPrefix}${id}`]: !!css // Only attach a container class if there is generated CSS to be attached. }, layoutClasses); useStyleOverride({ css }); - return (0,external_React_.createElement)(BlockListBlock, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockListBlock, { ...props, __unstableLayoutClassNames: layoutClassNames }); @@ -32943,33 +35387,236 @@ function BlockWithLayoutStyles({ */ const withLayoutStyles = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockListBlock => props => { const { + clientId, name, attributes } = props; - const blockSupportsLayout = hasLayoutBlockSupport(props.name); + const blockSupportsLayout = hasLayoutBlockSupport(name); const layoutClasses = useLayoutClasses(attributes, name); - const shouldRenderLayoutStyles = (0,external_wp_data_namespaceObject.useSelect)(select => { + const extraProps = (0,external_wp_data_namespaceObject.useSelect)(select => { // The callback returns early to avoid block editor subscription. if (!blockSupportsLayout) { - return false; + return; } - return !select(store).getSettings().disableLayoutStyles; - }, [blockSupportsLayout]); - if (!shouldRenderLayoutStyles) { - return (0,external_React_.createElement)(BlockListBlock, { + const { + getSettings, + getBlockSettings + } = unlock(select(store)); + const { + disableLayoutStyles + } = getSettings(); + if (disableLayoutStyles) { + return; + } + const [blockGapSupport] = getBlockSettings(clientId, 'spacing.blockGap'); + return { + blockGapSupport + }; + }, [blockSupportsLayout, clientId]); + if (!extraProps) { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockListBlock, { ...props, __unstableLayoutClassNames: blockSupportsLayout ? layoutClasses : undefined }); } - return (0,external_React_.createElement)(BlockWithLayoutStyles, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockWithLayoutStyles, { block: BlockListBlock, props: props, - layoutClasses: layoutClasses + layoutClasses: layoutClasses, + ...extraProps }); }, 'withLayoutStyles'); (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/layout/addAttribute', layout_addAttribute); (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockListBlock', 'core/editor/layout/with-layout-styles', withLayoutStyles); +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/grid-visualizer/grid-item-resizer.js +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + + +function GridItemResizer({ + clientId, + bounds, + onChange +}) { + const blockElement = useBlockElement(clientId); + const rootBlockElement = blockElement?.parentElement; + if (!blockElement || !rootBlockElement) { + return null; + } + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridItemResizerInner, { + clientId: clientId, + bounds: bounds, + blockElement: blockElement, + rootBlockElement: rootBlockElement, + onChange: onChange + }); +} +function GridItemResizerInner({ + clientId, + bounds, + blockElement, + rootBlockElement, + onChange +}) { + const [resizeDirection, setResizeDirection] = (0,external_wp_element_namespaceObject.useState)(null); + const [enableSide, setEnableSide] = (0,external_wp_element_namespaceObject.useState)({ + top: false, + bottom: false, + left: false, + right: false + }); + (0,external_wp_element_namespaceObject.useEffect)(() => { + const observer = new window.ResizeObserver(() => { + const blockClientRect = blockElement.getBoundingClientRect(); + const rootBlockClientRect = rootBlockElement.getBoundingClientRect(); + setEnableSide({ + top: blockClientRect.top > rootBlockClientRect.top, + bottom: blockClientRect.bottom < rootBlockClientRect.bottom, + left: blockClientRect.left > rootBlockClientRect.left, + right: blockClientRect.right < rootBlockClientRect.right + }); + }); + observer.observe(blockElement); + return () => observer.disconnect(); + }, [blockElement, rootBlockElement]); + const justification = { + right: 'flex-start', + left: 'flex-end' + }; + const alignment = { + top: 'flex-end', + bottom: 'flex-start' + }; + const styles = { + display: 'flex', + justifyContent: 'center', + alignItems: 'center', + ...(justification[resizeDirection] && { + justifyContent: justification[resizeDirection] + }), + ...(alignment[resizeDirection] && { + alignItems: alignment[resizeDirection] + }) + }; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(cover, { + className: "block-editor-grid-item-resizer", + clientId: clientId, + __unstablePopoverSlot: "block-toolbar", + additionalStyles: styles, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ResizableBox, { + className: "block-editor-grid-item-resizer__box", + size: { + width: '100%', + height: '100%' + }, + enable: { + bottom: enableSide.bottom, + bottomLeft: false, + bottomRight: false, + left: enableSide.left, + right: enableSide.right, + top: enableSide.top, + topLeft: false, + topRight: false + }, + bounds: bounds, + boundsByDirection: true, + onResizeStart: (event, direction) => { + /* + * The container justification and alignment need to be set + * according to the direction the resizer is being dragged in, + * so that it resizes in the right direction. + */ + setResizeDirection(direction); + + /* + * The mouseup event on the resize handle doesn't trigger if the mouse + * isn't directly above the handle, so we try to detect if it happens + * outside the grid and dispatch a mouseup event on the handle. + */ + blockElement.ownerDocument.addEventListener('mouseup', () => { + event.target.dispatchEvent(new Event('mouseup', { + bubbles: true + })); + }, { + once: true + }); + }, + onResizeStop: (event, direction, boxElement) => { + const columnGap = parseFloat(getComputedCSS(rootBlockElement, 'column-gap')); + const rowGap = parseFloat(getComputedCSS(rootBlockElement, 'row-gap')); + const gridColumnTracks = getGridTracks(getComputedCSS(rootBlockElement, 'grid-template-columns'), columnGap); + const gridRowTracks = getGridTracks(getComputedCSS(rootBlockElement, 'grid-template-rows'), rowGap); + const rect = new window.DOMRect(blockElement.offsetLeft + boxElement.offsetLeft, blockElement.offsetTop + boxElement.offsetTop, boxElement.offsetWidth, boxElement.offsetHeight); + const columnStart = getClosestTrack(gridColumnTracks, rect.left) + 1; + const rowStart = getClosestTrack(gridRowTracks, rect.top) + 1; + const columnEnd = getClosestTrack(gridColumnTracks, rect.right, 'end') + 1; + const rowEnd = getClosestTrack(gridRowTracks, rect.bottom, 'end') + 1; + onChange({ + columnSpan: columnEnd - columnStart + 1, + rowSpan: rowEnd - rowStart + 1 + }); + } + }) + }); +} + +/** + * Given a grid-template-columns or grid-template-rows CSS property value, gets the start and end + * position in pixels of each grid track. + * + * https://css-tricks.com/snippets/css/complete-guide-grid/#aa-grid-track + * + * @param {string} template The grid-template-columns or grid-template-rows CSS property value. + * Only supports fixed sizes in pixels. + * @param {number} gap The gap between grid tracks in pixels. + * + * @return {Array<{start: number, end: number}>} An array of objects with the start and end + * position in pixels of each grid track. + */ +function getGridTracks(template, gap) { + const tracks = []; + for (const size of template.split(' ')) { + const previousTrack = tracks[tracks.length - 1]; + const start = previousTrack ? previousTrack.end + gap : 0; + const end = start + parseFloat(size); + tracks.push({ + start, + end + }); + } + return tracks; +} + +/** + * Given an array of grid tracks and a position in pixels, gets the index of the closest track to + * that position. + * + * https://css-tricks.com/snippets/css/complete-guide-grid/#aa-grid-track + * + * @param {Array<{start: number, end: number}>} tracks An array of objects with the start and end + * position in pixels of each grid track. + * @param {number} position The position in pixels. + * @param {string} edge The edge of the track to compare the + * position to. Either 'start' or 'end'. + * + * @return {number} The index of the closest track to the position. 0-based, unlike CSS grid which + * is 1-based. + */ +function getClosestTrack(tracks, position, edge = 'start') { + return tracks.reduce((closest, track, index) => Math.abs(track[edge] - position) < Math.abs(tracks[closest][edge] - position) ? index : closest, 0); +} + ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/layout-child.js /** * WordPress dependencies @@ -32977,11 +35624,17 @@ const withLayoutStyles = (0,external_wp_compose_namespaceObject.createHigherOrde + /** * Internal dependencies */ + + + + + function useBlockPropsChildLayoutStyles({ style }) { @@ -32992,8 +35645,17 @@ function useBlockPropsChildLayoutStyles({ const layout = (_style$layout = style?.layout) !== null && _style$layout !== void 0 ? _style$layout : {}; const { selfStretch, - flexSize + flexSize, + columnStart, + rowStart, + columnSpan, + rowSpan } = layout; + const parentLayout = useLayout() || {}; + const { + columnCount, + minimumColumnWidth + } = parentLayout; const id = (0,external_wp_compose_namespaceObject.useInstanceId)(useBlockPropsChildLayoutStyles); const selector = `.wp-container-content-${id}`; let css = ''; @@ -33007,6 +35669,67 @@ function useBlockPropsChildLayoutStyles({ css = `${selector} { flex-grow: 1; }`; + } else if (columnStart && columnSpan) { + css = `${selector} { + grid-column: ${columnStart} / span ${columnSpan}; + }`; + } else if (columnStart) { + css = `${selector} { + grid-column: ${columnStart}; + }`; + } else if (columnSpan) { + css = `${selector} { + grid-column: span ${columnSpan}; + }`; + } + /** + * If minimumColumnWidth is set on the parent, or if no + * columnCount is set, the grid is responsive so a + * container query is needed for the span to resize. + */ + if ((columnSpan || columnStart) && (minimumColumnWidth || !columnCount)) { + // Check if columnSpan and columnStart are numbers so Math.max doesn't break. + const columnSpanNumber = columnSpan ? parseInt(columnSpan) : null; + const columnStartNumber = columnStart ? parseInt(columnStart) : null; + const highestNumber = Math.max(columnSpanNumber, columnStartNumber); + let parentColumnValue = parseFloat(minimumColumnWidth); + /** + * 12rem is the default minimumColumnWidth value. + * If parentColumnValue is not a number, default to 12. + */ + if (isNaN(parentColumnValue)) { + parentColumnValue = 12; + } + let parentColumnUnit = minimumColumnWidth?.replace(parentColumnValue, ''); + /** + * Check that parent column unit is either 'px', 'rem' or 'em'. + * If not, default to 'rem'. + */ + if (!['px', 'rem', 'em'].includes(parentColumnUnit)) { + parentColumnUnit = 'rem'; + } + const defaultGapValue = parentColumnUnit === 'px' ? 24 : 1.5; + const containerQueryValue = highestNumber * parentColumnValue + (highestNumber - 1) * defaultGapValue; + // If a span is set we want to preserve it as long as possible, otherwise we just reset the value. + const gridColumnValue = columnSpan ? '1/-1' : 'auto'; + css += `@container (max-width: ${containerQueryValue}${parentColumnUnit}) { + ${selector} { + grid-column: ${gridColumnValue}; + } + }`; + } + if (rowStart && rowSpan) { + css += `${selector} { + grid-row: ${rowStart} / span ${rowSpan}; + }`; + } else if (rowStart) { + css += `${selector} { + grid-row: ${rowStart}; + }`; + } else if (rowSpan) { + css += `${selector} { + grid-row: span ${rowSpan}; + }`; } } useStyleOverride({ @@ -33023,8 +35746,54 @@ function useBlockPropsChildLayoutStyles({ className: `wp-container-content-${id}` }; } +function ChildLayoutControlsPure({ + clientId, + style, + setAttributes +}) { + const { + type: parentLayoutType = 'default', + allowSizingOnChildren = false + } = useLayout() || {}; + const rootClientId = (0,external_wp_data_namespaceObject.useSelect)(select => { + return select(store).getBlockRootClientId(clientId); + }, [clientId]); + + // Use useState() instead of useRef() so that GridItemResizer updates when ref is set. + const [resizerBounds, setResizerBounds] = (0,external_wp_element_namespaceObject.useState)(); + if (parentLayoutType !== 'grid') { + return null; + } + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridVisualizer, { + clientId: rootClientId, + contentRef: setResizerBounds + }), allowSizingOnChildren && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GridItemResizer, { + clientId: clientId + // Don't allow resizing beyond the grid visualizer. + , + bounds: resizerBounds, + onChange: ({ + columnSpan, + rowSpan + }) => { + setAttributes({ + style: { + ...style, + layout: { + ...style?.layout, + columnSpan, + rowSpan + } + } + }); + } + })] + }); +} /* harmony default export */ const layout_child = ({ useBlockProps: useBlockPropsChildLayoutStyles, + edit: ChildLayoutControlsPure, attributeKeys: ['style'], hasSupport() { return true; @@ -33092,7 +35861,6 @@ function useConvertToGroupButtonProps(selectedClientIds) { } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/convert-to-group-buttons/index.js - /** * WordPress dependencies */ @@ -33101,12 +35869,16 @@ function useConvertToGroupButtonProps(selectedClientIds) { + /** * Internal dependencies */ + + + function ConvertToGroupButton({ clientIds, isGroupable, @@ -33116,6 +35888,9 @@ function ConvertToGroupButton({ groupingBlockName, onClose = () => {} }) { + const { + getSelectedBlockClientIds + } = (0,external_wp_data_namespaceObject.useSelect)(store); const { replaceBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store); @@ -33139,17 +35914,23 @@ function ConvertToGroupButton({ if (!isGroupable && !isUngroupable) { return null; } - return (0,external_React_.createElement)(external_React_.Fragment, null, isGroupable && (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { - onClick: () => { - onConvertToGroup(); - onClose(); - } - }, (0,external_wp_i18n_namespaceObject._x)('Group', 'verb')), isUngroupable && (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { - onClick: () => { - onConvertFromGroup(); - onClose(); - } - }, (0,external_wp_i18n_namespaceObject._x)('Ungroup', 'Ungrouping blocks from within a grouping block back into individual blocks within the Editor '))); + const selectedBlockClientIds = getSelectedBlockClientIds(); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [isGroupable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { + shortcut: selectedBlockClientIds.length > 1 ? external_wp_keycodes_namespaceObject.displayShortcut.primary('g') : undefined, + onClick: () => { + onConvertToGroup(); + onClose(); + }, + children: (0,external_wp_i18n_namespaceObject._x)('Group', 'verb') + }), isUngroupable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { + onClick: () => { + onConvertFromGroup(); + onClose(); + }, + children: (0,external_wp_i18n_namespaceObject._x)('Ungroup', 'Ungrouping blocks from within a grouping block back into individual blocks within the Editor ') + })] + }); } @@ -33179,13 +35960,11 @@ function useBlockLock(clientId) { canRemoveBlock, canLockBlockType, getBlockName, - getBlockRootClientId, getTemplateLock } = select(store); - const rootClientId = getBlockRootClientId(clientId); const canEdit = canEditBlock(clientId); - const canMove = canMoveBlock(clientId, rootClientId); - const canRemove = canRemoveBlock(clientId, rootClientId); + const canMove = canMoveBlock(clientId); + const canRemove = canRemoveBlock(clientId); return { canEdit, canMove, @@ -33198,49 +35977,51 @@ function useBlockLock(clientId) { } ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/unlock.js - /** * WordPress dependencies */ -const unlock_unlock = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const unlock_unlock = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M17 10h-1.2V7c0-2.1-1.7-3.8-3.8-3.8-2.1 0-3.8 1.7-3.8 3.8h1.5c0-1.2 1-2.2 2.2-2.2s2.2 1 2.2 2.2v3H7c-.6 0-1 .4-1 1v8c0 .6.4 1 1 1h10c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1z" -})); + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M17 10h-1.2V7c0-2.1-1.7-3.8-3.8-3.8-2.1 0-3.8 1.7-3.8 3.8h1.5c0-1.2 1-2.2 2.2-2.2s2.2 1 2.2 2.2v3H7c-.6 0-1 .4-1 1v8c0 .6.4 1 1 1h10c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1z" + }) +}); /* harmony default export */ const library_unlock = (unlock_unlock); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/lock-outline.js - /** * WordPress dependencies */ -const lockOutline = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const lockOutline = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M17 10h-1.2V7c0-2.1-1.7-3.8-3.8-3.8-2.1 0-3.8 1.7-3.8 3.8v3H7c-.6 0-1 .4-1 1v8c0 .6.4 1 1 1h10c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1zM9.8 7c0-1.2 1-2.2 2.2-2.2 1.2 0 2.2 1 2.2 2.2v3H9.8V7zm6.7 11.5h-9v-7h9v7z" -})); + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M17 10h-1.2V7c0-2.1-1.7-3.8-3.8-3.8-2.1 0-3.8 1.7-3.8 3.8v3H7c-.6 0-1 .4-1 1v8c0 .6.4 1 1 1h10c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1zM9.8 7c0-1.2 1-2.2 2.2-2.2 1.2 0 2.2 1 2.2 2.2v3H9.8V7zm6.7 11.5h-9v-7h9v7z" + }) +}); /* harmony default export */ const lock_outline = (lockOutline); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/lock.js - /** * WordPress dependencies */ -const lock_lock = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const lock_lock = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M17 10h-1.2V7c0-2.1-1.7-3.8-3.8-3.8-2.1 0-3.8 1.7-3.8 3.8v3H7c-.6 0-1 .4-1 1v8c0 .6.4 1 1 1h10c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1zm-2.8 0H9.8V7c0-1.2 1-2.2 2.2-2.2s2.2 1 2.2 2.2v3z" -})); + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M17 10h-1.2V7c0-2.1-1.7-3.8-3.8-3.8-2.1 0-3.8 1.7-3.8 3.8v3H7c-.6 0-1 .4-1 1v8c0 .6.4 1 1 1h10c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1zm-2.8 0H9.8V7c0-1.2 1-2.2 2.2-2.2s2.2 1 2.2 2.2v3z" + }) +}); /* harmony default export */ const library_lock = (lock_lock); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-lock/modal.js - /** * WordPress dependencies */ @@ -33260,6 +36041,8 @@ const lock_lock = (0,external_React_.createElement)(external_wp_primitives_names // Entity based blocks which allow edit locking + + const ALLOWS_EDIT_LOCKING = ['core/block', 'core/navigation']; function getTemplateLockValue(lock) { // Prevents all operations. @@ -33320,102 +36103,118 @@ function BlockLockModal({ }, [canEdit, canMove, canRemove, allowsEditLocking]); const isAllChecked = Object.values(lock).every(Boolean); const isMixed = Object.values(lock).some(Boolean) && !isAllChecked; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Modal, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Name of the block. */ (0,external_wp_i18n_namespaceObject.__)('Lock %s'), blockInformation.title), overlayClassName: "block-editor-block-lock-modal", - onRequestClose: onClose - }, (0,external_React_.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Choose specific attributes to restrict or lock all available options.')), (0,external_React_.createElement)("form", { - onSubmit: event => { - event.preventDefault(); - updateBlockAttributes([clientId], { - lock, - templateLock: applyTemplateLock ? getTemplateLockValue(lock) : undefined - }); - onClose(); - } - }, (0,external_React_.createElement)("div", { - role: "group", - "aria-labelledby": instanceId, - className: "block-editor-block-lock-modal__options" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.CheckboxControl, { - __nextHasNoMarginBottom: true, - className: "block-editor-block-lock-modal__options-title", - label: (0,external_React_.createElement)("span", { - id: instanceId - }, (0,external_wp_i18n_namespaceObject.__)('Lock all')), - checked: isAllChecked, - indeterminate: isMixed, - onChange: newValue => setLock({ - move: newValue, - remove: newValue, - ...(allowsEditLocking ? { - edit: newValue - } : {}) - }) - }), (0,external_React_.createElement)("ul", { - className: "block-editor-block-lock-modal__checklist" - }, allowsEditLocking && (0,external_React_.createElement)("li", { - className: "block-editor-block-lock-modal__checklist-item" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.CheckboxControl, { - __nextHasNoMarginBottom: true, - label: (0,external_wp_i18n_namespaceObject.__)('Restrict editing'), - checked: !!lock.edit, - onChange: edit => setLock(prevLock => ({ - ...prevLock, - edit - })) - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, { - className: "block-editor-block-lock-modal__lock-icon", - icon: lock.edit ? library_lock : library_unlock - })), (0,external_React_.createElement)("li", { - className: "block-editor-block-lock-modal__checklist-item" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.CheckboxControl, { - __nextHasNoMarginBottom: true, - label: (0,external_wp_i18n_namespaceObject.__)('Disable movement'), - checked: lock.move, - onChange: move => setLock(prevLock => ({ - ...prevLock, - move - })) - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, { - className: "block-editor-block-lock-modal__lock-icon", - icon: lock.move ? library_lock : library_unlock - })), (0,external_React_.createElement)("li", { - className: "block-editor-block-lock-modal__checklist-item" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.CheckboxControl, { - __nextHasNoMarginBottom: true, - label: (0,external_wp_i18n_namespaceObject.__)('Prevent removal'), - checked: lock.remove, - onChange: remove => setLock(prevLock => ({ - ...prevLock, - remove - })) - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, { - className: "block-editor-block-lock-modal__lock-icon", - icon: lock.remove ? library_lock : library_unlock - }))), hasTemplateLock && (0,external_React_.createElement)(external_wp_components_namespaceObject.ToggleControl, { - __nextHasNoMarginBottom: true, - className: "block-editor-block-lock-modal__template-lock", - label: (0,external_wp_i18n_namespaceObject.__)('Apply to all blocks inside'), - checked: applyTemplateLock, - disabled: lock.move && !lock.remove, - onChange: () => setApplyTemplateLock(!applyTemplateLock) - })), (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, { - className: "block-editor-block-lock-modal__actions", - justify: "flex-end", - expanded: false - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - variant: "tertiary", - onClick: onClose - }, (0,external_wp_i18n_namespaceObject.__)('Cancel'))), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - variant: "primary", - type: "submit" - }, (0,external_wp_i18n_namespaceObject.__)('Apply')))))); + onRequestClose: onClose, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { + children: (0,external_wp_i18n_namespaceObject.__)('Choose specific attributes to restrict or lock all available options.') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("form", { + onSubmit: event => { + event.preventDefault(); + updateBlockAttributes([clientId], { + lock, + templateLock: applyTemplateLock ? getTemplateLockValue(lock) : undefined + }); + onClose(); + }, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + role: "group", + "aria-labelledby": instanceId, + className: "block-editor-block-lock-modal__options", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { + __nextHasNoMarginBottom: true, + className: "block-editor-block-lock-modal__options-title", + label: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + id: instanceId, + children: (0,external_wp_i18n_namespaceObject.__)('Lock all') + }), + checked: isAllChecked, + indeterminate: isMixed, + onChange: newValue => setLock({ + move: newValue, + remove: newValue, + ...(allowsEditLocking ? { + edit: newValue + } : {}) + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("ul", { + className: "block-editor-block-lock-modal__checklist", + children: [allowsEditLocking && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { + className: "block-editor-block-lock-modal__checklist-item", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { + __nextHasNoMarginBottom: true, + label: (0,external_wp_i18n_namespaceObject.__)('Restrict editing'), + checked: !!lock.edit, + onChange: edit => setLock(prevLock => ({ + ...prevLock, + edit + })) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { + className: "block-editor-block-lock-modal__lock-icon", + icon: lock.edit ? library_lock : library_unlock + })] + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { + className: "block-editor-block-lock-modal__checklist-item", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { + __nextHasNoMarginBottom: true, + label: (0,external_wp_i18n_namespaceObject.__)('Disable movement'), + checked: lock.move, + onChange: move => setLock(prevLock => ({ + ...prevLock, + move + })) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { + className: "block-editor-block-lock-modal__lock-icon", + icon: lock.move ? library_lock : library_unlock + })] + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { + className: "block-editor-block-lock-modal__checklist-item", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, { + __nextHasNoMarginBottom: true, + label: (0,external_wp_i18n_namespaceObject.__)('Prevent removal'), + checked: lock.remove, + onChange: remove => setLock(prevLock => ({ + ...prevLock, + remove + })) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { + className: "block-editor-block-lock-modal__lock-icon", + icon: lock.remove ? library_lock : library_unlock + })] + })] + }), hasTemplateLock && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { + __nextHasNoMarginBottom: true, + className: "block-editor-block-lock-modal__template-lock", + label: (0,external_wp_i18n_namespaceObject.__)('Apply to all blocks inside'), + checked: applyTemplateLock, + disabled: lock.move && !lock.remove, + onChange: () => setApplyTemplateLock(!applyTemplateLock) + })] + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { + className: "block-editor-block-lock-modal__actions", + justify: "flex-end", + expanded: false, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + variant: "tertiary", + onClick: onClose, + children: (0,external_wp_i18n_namespaceObject.__)('Cancel') + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + variant: "primary", + type: "submit", + children: (0,external_wp_i18n_namespaceObject.__)('Apply') + }) + })] + })] + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-lock/menu-item.js - /** * WordPress dependencies */ @@ -33429,6 +36228,9 @@ function BlockLockModal({ */ + + + function BlockLockMenuItem({ clientId }) { @@ -33441,19 +36243,21 @@ function BlockLockMenuItem({ return null; } const label = isLocked ? (0,external_wp_i18n_namespaceObject.__)('Unlock') : (0,external_wp_i18n_namespaceObject.__)('Lock'); - return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { - icon: isLocked ? library_unlock : lock_outline, - onClick: toggleModal, - "aria-expanded": isModalOpen, - "aria-haspopup": "dialog" - }, label), isModalOpen && (0,external_React_.createElement)(BlockLockModal, { - clientId: clientId, - onClose: toggleModal - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { + icon: isLocked ? library_unlock : lock_outline, + onClick: toggleModal, + "aria-expanded": isModalOpen, + "aria-haspopup": "dialog", + children: label + }), isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockLockModal, { + clientId: clientId, + onClose: toggleModal + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-mode-toggle.js - /** * WordPress dependencies */ @@ -33467,6 +36271,7 @@ function BlockLockMenuItem({ * Internal dependencies */ + const block_mode_toggle_noop = () => {}; function BlockModeToggle({ blockType, @@ -33479,9 +36284,10 @@ function BlockModeToggle({ return null; } const label = mode === 'visual' ? (0,external_wp_i18n_namespaceObject.__)('Edit as HTML') : (0,external_wp_i18n_namespaceObject.__)('Edit visually'); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { - onClick: onToggleMode - }, !small && label); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { + onClick: onToggleMode, + children: !small && label + }); } /* harmony default export */ const block_mode_toggle = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, { clientId @@ -33525,7 +36331,6 @@ function isEmptyString(testString) { } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-rename/modal.js - /** * WordPress dependencies */ @@ -33534,24 +36339,28 @@ function isEmptyString(testString) { - /** * Internal dependencies */ + + function BlockRenameModal({ blockName, originalBlockName, onClose, - onSave + onSave, + // Pattern Overrides is a WordPress-only feature but it also uses the Block Binding API. + // Ideally this should not be inside the block editor package, but we keep it here for simplicity. + hasOverridesWarning }) { const [editedBlockName, setEditedBlockName] = (0,external_wp_element_namespaceObject.useState)(blockName); + const descriptionId = (0,external_wp_element_namespaceObject.useId)(); const nameHasChanged = editedBlockName !== blockName; const nameIsOriginal = editedBlockName === originalBlockName; const nameIsEmpty = isEmptyString(editedBlockName); const isNameValid = nameHasChanged || nameIsOriginal; const autoSelectInputText = event => event.target.select(); - const dialogDescription = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockRenameModal, `block-editor-rename-modal__description`); const handleSubmit = () => { const message = nameIsOriginal || nameIsEmpty ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: new name/label for the block */ (0,external_wp_i18n_namespaceObject.__)('Block name reset to: "%s".'), editedBlockName) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: new name/label for the block */ @@ -33564,51 +36373,59 @@ function BlockRenameModal({ // Immediate close avoids ability to hit save multiple times. onClose(); }; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Modal, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)('Rename'), onRequestClose: onClose, overlayClassName: "block-editor-block-rename-modal", + focusOnMount: "firstContentElement", aria: { - describedby: dialogDescription + describedby: descriptionId }, - focusOnMount: "firstContentElement" - }, (0,external_React_.createElement)("p", { - id: dialogDescription - }, (0,external_wp_i18n_namespaceObject.__)('Enter a custom name for this block.')), (0,external_React_.createElement)("form", { - onSubmit: e => { - e.preventDefault(); - if (!isNameValid) { - return; - } - handleSubmit(); - } - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { - spacing: "3" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, { - __nextHasNoMarginBottom: true, - __next40pxDefaultSize: true, - value: editedBlockName, - label: (0,external_wp_i18n_namespaceObject.__)('Block name'), - hideLabelFromVision: true, - placeholder: originalBlockName, - onChange: setEditedBlockName, - onFocus: autoSelectInputText - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { - justify: "right" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - __next40pxDefaultSize: true, - variant: "tertiary", - onClick: onClose - }, (0,external_wp_i18n_namespaceObject.__)('Cancel')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - __next40pxDefaultSize: true, - "aria-disabled": !isNameValid, - variant: "primary", - type: "submit" - }, (0,external_wp_i18n_namespaceObject.__)('Save')))))); + size: "small", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("form", { + onSubmit: e => { + e.preventDefault(); + if (!isNameValid) { + return; + } + handleSubmit(); + }, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { + id: descriptionId, + children: (0,external_wp_i18n_namespaceObject.__)('Enter a custom name for this block.') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { + spacing: "3", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { + __nextHasNoMarginBottom: true, + __next40pxDefaultSize: true, + value: editedBlockName, + label: (0,external_wp_i18n_namespaceObject.__)('Block name'), + hideLabelFromVision: true, + help: hasOverridesWarning ? (0,external_wp_i18n_namespaceObject.__)('This block allows overrides. Changing the name can cause problems with content entered into instances of this pattern.') : undefined, + placeholder: originalBlockName, + onChange: setEditedBlockName, + onFocus: autoSelectInputText + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { + justify: "right", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + __next40pxDefaultSize: true, + variant: "tertiary", + onClick: onClose, + children: (0,external_wp_i18n_namespaceObject.__)('Cancel') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + __next40pxDefaultSize: true, + "aria-disabled": !isNameValid, + variant: "primary", + type: "submit", + children: (0,external_wp_i18n_namespaceObject.__)('Save') + })] + })] + })] + }) + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-rename/rename-control.js - /** * WordPress dependencies */ @@ -33624,6 +36441,9 @@ function BlockRenameModal({ + + + function BlockRenameControl({ clientId }) { @@ -33643,39 +36463,43 @@ function BlockRenameControl({ updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(store); const customName = metadata?.name; + const hasPatternOverrides = !!customName && !!metadata?.bindings && Object.values(metadata.bindings).some(binding => binding.source === 'core/pattern-overrides'); function onChange(newName) { updateBlockAttributes([clientId], { metadata: { - ...(metadata && metadata), + ...metadata, name: newName } }); } const blockInformation = useBlockDisplayInformation(clientId); - return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { - onClick: () => { - setRenamingBlock(true); - }, - "aria-expanded": renamingBlock, - "aria-haspopup": "dialog" - }, (0,external_wp_i18n_namespaceObject.__)('Rename')), renamingBlock && (0,external_React_.createElement)(BlockRenameModal, { - blockName: customName || '', - originalBlockName: blockInformation?.title, - onClose: () => setRenamingBlock(false), - onSave: newName => { - // If the new value is the block's original name (e.g. `Group`) - // or it is an empty string then assume the intent is to reset - // the value. Therefore reset the metadata. - if (newName === blockInformation?.title || isEmptyString(newName)) { - newName = undefined; - } - onChange(newName); - } - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { + onClick: () => { + setRenamingBlock(true); + }, + "aria-expanded": renamingBlock, + "aria-haspopup": "dialog", + children: (0,external_wp_i18n_namespaceObject.__)('Rename') + }), renamingBlock && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockRenameModal, { + blockName: customName || '', + originalBlockName: blockInformation?.title, + hasOverridesWarning: hasPatternOverrides, + onClose: () => setRenamingBlock(false), + onSave: newName => { + // If the new value is the block's original name (e.g. `Group`) + // or it is an empty string then assume the intent is to reset + // the value. Therefore reset the metadata. + if (newName === blockInformation?.title || isEmptyString(newName)) { + newName = undefined; + } + onChange(newName); + } + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu-controls/index.js - /** * WordPress dependencies */ @@ -33692,27 +36516,31 @@ function BlockRenameControl({ + + const { Fill, Slot } = (0,external_wp_components_namespaceObject.createSlotFill)('BlockSettingsMenuControls'); const BlockSettingsMenuControlsSlot = ({ fillProps, - clientIds = null, - __unstableDisplayLocation + clientIds = null }) => { const { selectedBlocks, - selectedClientIds + selectedClientIds, + isContentOnly } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockNamesByClientId, - getSelectedBlockClientIds + getSelectedBlockClientIds, + getBlockEditingMode } = select(store); const ids = clientIds !== null ? clientIds : getSelectedBlockClientIds(); return { selectedBlocks: getBlockNamesByClientId(ids), - selectedClientIds: ids + selectedClientIds: ids, + isContentOnly: getBlockEditingMode(ids[0]) === 'contentOnly' }; }, [clientIds]); const { @@ -33721,8 +36549,8 @@ const BlockSettingsMenuControlsSlot = ({ const { canRename } = useBlockRename(selectedBlocks[0]); - const showLockButton = selectedClientIds.length === 1 && canLock; - const showRenameButton = selectedClientIds.length === 1 && canRename; + const showLockButton = selectedClientIds.length === 1 && canLock && !isContentOnly; + const showRenameButton = selectedClientIds.length === 1 && canRename && !isContentOnly; // Check if current selection of blocks is Groupable or Ungroupable // and pass this props down to ConvertToGroupButton. @@ -33732,30 +36560,33 @@ const BlockSettingsMenuControlsSlot = ({ isUngroupable } = convertToGroupButtonProps; const showConvertToGroupButton = isGroupable || isUngroupable; - return (0,external_React_.createElement)(Slot, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Slot, { fillProps: { ...fillProps, - __unstableDisplayLocation, selectedBlocks, selectedClientIds + }, + children: fills => { + if (!fills?.length > 0 && !showConvertToGroupButton && !showLockButton) { + return null; + } + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { + children: [showConvertToGroupButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ConvertToGroupButton, { + ...convertToGroupButtonProps, + onClose: fillProps?.onClose + }), showLockButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockLockMenuItem, { + clientId: selectedClientIds[0] + }), showRenameButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockRenameControl, { + clientId: selectedClientIds[0] + }), fills, fillProps?.canMove && !fillProps?.onlyBlock && !isContentOnly && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { + onClick: (0,external_wp_compose_namespaceObject.pipe)(fillProps?.onClose, fillProps?.onMoveTo), + children: (0,external_wp_i18n_namespaceObject.__)('Move to') + }), fillProps?.count === 1 && !isContentOnly && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_mode_toggle, { + clientId: fillProps?.firstBlockClientId, + onToggle: fillProps?.onClose + })] + }); } - }, fills => { - if (!fills?.length > 0 && !showConvertToGroupButton && !showLockButton) { - return null; - } - return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, showConvertToGroupButton && (0,external_React_.createElement)(ConvertToGroupButton, { - ...convertToGroupButtonProps, - onClose: fillProps?.onClose - }), showLockButton && (0,external_React_.createElement)(BlockLockMenuItem, { - clientId: selectedClientIds[0] - }), showRenameButton && (0,external_React_.createElement)(BlockRenameControl, { - clientId: selectedClientIds[0] - }), fills, fillProps?.canMove && !fillProps?.onlyBlock && (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { - onClick: (0,external_wp_compose_namespaceObject.pipe)(fillProps?.onClose, fillProps?.onMoveTo) - }, (0,external_wp_i18n_namespaceObject.__)('Move to')), fillProps?.count === 1 && (0,external_React_.createElement)(block_mode_toggle, { - clientId: fillProps?.firstBlockClientId, - onToggle: fillProps?.onClose - })); }); }; @@ -33768,17 +36599,17 @@ const BlockSettingsMenuControlsSlot = ({ function BlockSettingsMenuControls({ ...props }) { - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalStyleProvider, { - document: document - }, (0,external_React_.createElement)(Fill, { - ...props - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalStyleProvider, { + document: document, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, { + ...props + }) + }); } BlockSettingsMenuControls.Slot = BlockSettingsMenuControlsSlot; /* harmony default export */ const block_settings_menu_controls = (BlockSettingsMenuControls); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/content-lock-ui.js - /** * WordPress dependencies */ @@ -33800,43 +36631,33 @@ BlockSettingsMenuControls.Slot = BlockSettingsMenuControlsSlot; // Besides the components on this file and the file referenced above the implementation // also includes artifacts on the store (actions, reducers, and selector). + + function ContentLockControlsPure({ clientId, isSelected }) { - const { - getBlockListSettings, - getSettings - } = (0,external_wp_data_namespaceObject.useSelect)(store); const { templateLock, isLockedByParent, isEditingAsBlocks } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { - __unstableGetContentLockingParent, + getContentLockingParent, getTemplateLock, - __unstableGetTemporarilyEditingAsBlocks - } = select(store); + getTemporarilyEditingAsBlocks + } = unlock(select(store)); return { templateLock: getTemplateLock(clientId), - isLockedByParent: !!__unstableGetContentLockingParent(clientId), - isEditingAsBlocks: __unstableGetTemporarilyEditingAsBlocks() === clientId + isLockedByParent: !!getContentLockingParent(clientId), + isEditingAsBlocks: getTemporarilyEditingAsBlocks() === clientId }; }, [clientId]); const { - updateSettings, - updateBlockListSettings, - __unstableSetTemporarilyEditingAsBlocks - } = (0,external_wp_data_namespaceObject.useDispatch)(store); - const { - stopEditingAsBlocks + stopEditingAsBlocks, + modifyContentLockBlock } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); const isContentLocked = !isLockedByParent && templateLock === 'contentOnly'; - const { - __unstableMarkNextChangeAsNotPersistent, - updateBlockAttributes - } = (0,external_wp_data_namespaceObject.useDispatch)(store); const stopEditingAsBlockCallback = (0,external_wp_element_namespaceObject.useCallback)(() => { stopEditingAsBlocks(clientId); }, [clientId, stopEditingAsBlocks]); @@ -33845,30 +36666,28 @@ function ContentLockControlsPure({ } const showStopEditingAsBlocks = isEditingAsBlocks && !isContentLocked; const showStartEditingAsBlocks = !isEditingAsBlocks && isContentLocked && isSelected; - return (0,external_React_.createElement)(external_React_.Fragment, null, showStopEditingAsBlocks && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(block_controls, { - group: "other" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, { - onClick: stopEditingAsBlockCallback - }, (0,external_wp_i18n_namespaceObject.__)('Done')))), showStartEditingAsBlocks && (0,external_React_.createElement)(block_settings_menu_controls, null, ({ - onClose - }) => (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { - onClick: () => { - __unstableMarkNextChangeAsNotPersistent(); - updateBlockAttributes(clientId, { - templateLock: undefined - }); - updateBlockListSettings(clientId, { - ...getBlockListSettings(clientId), - templateLock: false - }); - const focusModeToRevert = getSettings().focusMode; - updateSettings({ - focusMode: true - }); - __unstableSetTemporarilyEditingAsBlocks(clientId, focusModeToRevert); - onClose(); - } - }, (0,external_wp_i18n_namespaceObject.__)('Modify')))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [showStopEditingAsBlocks && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls, { + group: "other", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { + onClick: stopEditingAsBlockCallback, + children: (0,external_wp_i18n_namespaceObject.__)('Done') + }) + }) + }), showStartEditingAsBlocks && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_settings_menu_controls, { + children: ({ + selectedClientIds, + onClose + }) => selectedClientIds.length === 1 && selectedClientIds[0] === clientId && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { + onClick: () => { + modifyContentLockBlock(clientId); + onClose(); + }, + children: (0,external_wp_i18n_namespaceObject.__)('Modify') + }) + })] + }); } /* harmony default export */ const content_lock_ui = ({ edit: ContentLockControlsPure, @@ -33908,21 +36727,21 @@ function addMetaAttribute(blockTypeSettings) { (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/metadata/addMetaAttribute', addMetaAttribute); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-default.js - /** * WordPress dependencies */ -const blockDefault = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const blockDefault = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.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" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.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" + }) +}); /* harmony default export */ const block_default = (blockDefault); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-icon/index.js - /** * External dependencies */ @@ -33934,6 +36753,7 @@ const blockDefault = (0,external_React_.createElement)(external_wp_primitives_na + function BlockIcon({ icon, showColors = false, @@ -33945,7 +36765,7 @@ function BlockIcon({ src: block_default }; } - const renderedIcon = (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, { + const renderedIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: icon && icon.src ? icon.src : icon, context: context }); @@ -33953,12 +36773,13 @@ function BlockIcon({ backgroundColor: icon && icon.background, color: icon && icon.foreground } : {}; - return (0,external_React_.createElement)("span", { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { style: style, - className: classnames_default()('block-editor-block-icon', className, { + className: dist_clsx('block-editor-block-icon', className, { 'has-colors': showColors - }) - }, renderedIcon); + }), + children: renderedIcon + }); } /** @@ -33967,7 +36788,6 @@ function BlockIcon({ /* harmony default export */ const block_icon = ((0,external_wp_element_namespaceObject.memo)(BlockIcon)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/block-hooks.js - /** * WordPress dependencies */ @@ -33982,7 +36802,9 @@ function BlockIcon({ */ -const EMPTY_OBJECT = {}; + + +const block_hooks_EMPTY_OBJECT = {}; function BlockHooksControlPure({ name, clientId, @@ -34069,7 +36891,7 @@ function BlockHooksControlPure({ if (Object.values(_hookedBlockClientIds).length > 0) { return _hookedBlockClientIds; } - return EMPTY_OBJECT; + return block_hooks_EMPTY_OBJECT; }, [hookedBlocksForCurrentBlock, name, clientId, rootClientId]); const { insertBlock, @@ -34114,39 +36936,47 @@ function BlockHooksControlPure({ break; } }; - return (0,external_React_.createElement)(inspector_controls, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, { - className: "block-editor-hooks__block-hooks", - title: (0,external_wp_i18n_namespaceObject.__)('Plugins'), - initialOpen: true - }, (0,external_React_.createElement)("p", { - className: "block-editor-hooks__block-hooks-helptext" - }, (0,external_wp_i18n_namespaceObject.__)('Manage the inclusion of blocks added automatically by plugins.')), Object.keys(groupedHookedBlocks).map(vendor => { - return (0,external_React_.createElement)(external_wp_element_namespaceObject.Fragment, { - key: vendor - }, (0,external_React_.createElement)("h3", null, vendor), groupedHookedBlocks[vendor].map(block => { - const checked = (block.name in hookedBlockClientIds); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToggleControl, { - checked: checked, - key: block.title, - label: (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { - justify: "flex-start" - }, (0,external_React_.createElement)(block_icon, { - icon: block.icon - }), (0,external_React_.createElement)("span", null, block.title)), - onChange: () => { - if (!checked) { - // Create and insert block. - const relativePosition = block.blockHooks[name]; - insertBlockIntoDesignatedLocation((0,external_wp_blocks_namespaceObject.createBlock)(block.name), relativePosition); - return; - } + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { + className: "block-editor-hooks__block-hooks", + title: (0,external_wp_i18n_namespaceObject.__)('Plugins'), + initialOpen: true, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { + className: "block-editor-hooks__block-hooks-helptext", + children: (0,external_wp_i18n_namespaceObject.__)('Manage the inclusion of blocks added automatically by plugins.') + }), Object.keys(groupedHookedBlocks).map(vendor => { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_element_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", { + children: vendor + }), groupedHookedBlocks[vendor].map(block => { + const checked = (block.name in hookedBlockClientIds); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { + checked: checked, + label: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { + justify: "flex-start", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { + icon: block.icon + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + children: block.title + })] + }), + onChange: () => { + if (!checked) { + // Create and insert block. + const relativePosition = block.blockHooks[name]; + insertBlockIntoDesignatedLocation((0,external_wp_blocks_namespaceObject.createBlock)(block.name), relativePosition); + return; + } - // Remove block. - removeBlock(hookedBlockClientIds[block.name], false); - } - }); - })); - }))); + // Remove block. + removeBlock(hookedBlockClientIds[block.name], false); + } + }, block.title); + })] + }, vendor); + })] + }) + }); } /* harmony default export */ const block_hooks = ({ edit: BlockHooksControlPure, @@ -34156,8 +36986,229 @@ function BlockHooksControlPure({ } }); -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/block-renaming.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/use-bindings-attributes.js +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + +/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */ +/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */ + +/** + * Given a binding of block attributes, returns a higher order component that + * overrides its `attributes` and `setAttributes` props to sync any changes needed. + * + * @return {WPHigherOrderComponent} Higher-order component. + */ + + +const BLOCK_BINDINGS_ALLOWED_BLOCKS = { + 'core/paragraph': ['content'], + 'core/heading': ['content'], + 'core/image': ['id', 'url', 'title', 'alt'], + 'core/button': ['url', 'text', 'linkTarget', 'rel'] +}; +const DEFAULT_ATTRIBUTE = '__default'; + +/** + * Returns the bindings with the `__default` binding for pattern overrides + * replaced with the full-set of supported attributes. e.g.: + * + * bindings passed in: `{ __default: { source: 'core/pattern-overrides' } }` + * bindings returned: `{ content: { source: 'core/pattern-overrides' } }` + * + * @param {string} blockName The block name (e.g. 'core/paragraph'). + * @param {Object} bindings A block's bindings from the metadata attribute. + * + * @return {Object} The bindings with default replaced for pattern overrides. + */ +function replacePatternOverrideDefaultBindings(blockName, bindings) { + // The `__default` binding currently only works for pattern overrides. + if (bindings?.[DEFAULT_ATTRIBUTE]?.source === 'core/pattern-overrides') { + const supportedAttributes = BLOCK_BINDINGS_ALLOWED_BLOCKS[blockName]; + const bindingsWithDefaults = {}; + for (const attributeName of supportedAttributes) { + // If the block has mixed binding sources, retain any non pattern override bindings. + const bindingSource = bindings[attributeName] ? bindings[attributeName] : { + source: 'core/pattern-overrides' + }; + bindingsWithDefaults[attributeName] = bindingSource; + } + return bindingsWithDefaults; + } + return bindings; +} + +/** + * Based on the given block name, + * check if it is possible to bind the block. + * + * @param {string} blockName - The block name. + * @return {boolean} Whether it is possible to bind the block to sources. + */ +function canBindBlock(blockName) { + return blockName in BLOCK_BINDINGS_ALLOWED_BLOCKS; +} + +/** + * Based on the given block name and attribute name, + * check if it is possible to bind the block attribute. + * + * @param {string} blockName - The block name. + * @param {string} attributeName - The attribute name. + * @return {boolean} Whether it is possible to bind the block attribute. + */ +function canBindAttribute(blockName, attributeName) { + return canBindBlock(blockName) && BLOCK_BINDINGS_ALLOWED_BLOCKS[blockName].includes(attributeName); +} +const withBlockBindingSupport = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => { + const registry = (0,external_wp_data_namespaceObject.useRegistry)(); + const sources = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(external_wp_blocks_namespaceObject.store)).getAllBlockBindingsSources()); + const { + name, + clientId, + context + } = props; + const hasParentPattern = !!props.context['pattern/overrides']; + const hasPatternOverridesDefaultBinding = props.attributes.metadata?.bindings?.[DEFAULT_ATTRIBUTE]?.source === 'core/pattern-overrides'; + const bindings = (0,external_wp_element_namespaceObject.useMemo)(() => replacePatternOverrideDefaultBindings(name, props.attributes.metadata?.bindings), [props.attributes.metadata?.bindings, name]); + const boundAttributes = (0,external_wp_data_namespaceObject.useSelect)(() => { + if (!bindings) { + return; + } + const attributes = {}; + for (const [attributeName, boundAttribute] of Object.entries(bindings)) { + const source = sources[boundAttribute.source]; + if (!source?.getValue || !canBindAttribute(name, attributeName)) { + continue; + } + const args = { + registry, + context, + clientId, + attributeName, + args: boundAttribute.args + }; + attributes[attributeName] = source.getValue(args); + if (attributes[attributeName] === undefined) { + if (attributeName === 'url') { + attributes[attributeName] = null; + } else { + attributes[attributeName] = source.getPlaceholder?.(args); + } + } + } + return attributes; + }, [bindings, name, clientId, context, registry, sources]); + const { + setAttributes + } = props; + const _setAttributes = (0,external_wp_element_namespaceObject.useCallback)(nextAttributes => { + registry.batch(() => { + if (!bindings) { + setAttributes(nextAttributes); + return; + } + const keptAttributes = { + ...nextAttributes + }; + const updatesBySource = new Map(); + + // Loop only over the updated attributes to avoid modifying the bound ones that haven't changed. + for (const [attributeName, newValue] of Object.entries(keptAttributes)) { + if (!bindings[attributeName] || !canBindAttribute(name, attributeName)) { + continue; + } + const binding = bindings[attributeName]; + const source = sources[binding?.source]; + if (!source?.setValue && !source?.setValues) { + continue; + } + updatesBySource.set(source, { + ...updatesBySource.get(source), + [attributeName]: newValue + }); + delete keptAttributes[attributeName]; + } + if (updatesBySource.size) { + for (const [source, attributes] of updatesBySource) { + if (source.setValues) { + source.setValues({ + registry, + context, + clientId, + attributes + }); + } else { + for (const [attributeName, value] of Object.entries(attributes)) { + const binding = bindings[attributeName]; + source.setValue({ + registry, + context, + clientId, + attributeName, + args: binding.args, + value + }); + } + } + } + } + if ( + // Don't update non-connected attributes if the block is using pattern overrides + // and the editing is happening while overriding the pattern (not editing the original). + !(hasPatternOverridesDefaultBinding && hasParentPattern) && Object.keys(keptAttributes).length) { + // Don't update caption and href until they are supported. + if (hasPatternOverridesDefaultBinding) { + delete keptAttributes?.caption; + delete keptAttributes?.href; + } + setAttributes(keptAttributes); + } + }); + }, [registry, bindings, name, clientId, context, setAttributes, sources, hasPatternOverridesDefaultBinding, hasParentPattern]); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { + ...props, + attributes: { + ...props.attributes, + ...boundAttributes + }, + setAttributes: _setAttributes + }) + }); +}, 'withBlockBindingSupport'); +/** + * Filters a registered block's settings to enhance a block's `edit` component + * to upgrade bound attributes. + * + * @param {WPBlockSettings} settings - Registered block settings. + * @param {string} name - Block name. + * @return {WPBlockSettings} Filtered block settings. + */ +function shimAttributeSource(settings, name) { + if (!canBindBlock(name)) { + return settings; + } + return { + ...settings, + edit: withBlockBindingSupport(settings.edit) + }; +} +(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/editor/custom-sources-backwards-compatibility/shim-attribute-source', shimAttributeSource); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/block-bindings.js /** * WordPress dependencies */ @@ -34171,6 +37222,84 @@ function BlockHooksControlPure({ */ + + + +const BlockBindingsPanel = ({ + name, + metadata +}) => { + const { + bindings + } = metadata || {}; + const { + sources + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const _sources = unlock(select(external_wp_blocks_namespaceObject.store)).getAllBlockBindingsSources(); + return { + sources: _sources + }; + }, []); + if (!bindings) { + return null; + } + + // Don't show not allowed attributes. + // Don't show the bindings connected to pattern overrides in the inspectors panel. + // TODO: Explore if this should be abstracted to let other sources decide. + const filteredBindings = { + ...bindings + }; + Object.keys(filteredBindings).forEach(key => { + if (!canBindAttribute(name, key) || filteredBindings[key].source === 'core/pattern-overrides') { + delete filteredBindings[key]; + } + }); + if (Object.keys(filteredBindings).length === 0) { + return null; + } + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { + title: (0,external_wp_i18n_namespaceObject.__)('Attributes'), + className: "components-panel__block-bindings-panel", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl, { + help: (0,external_wp_i18n_namespaceObject.__)('Attributes connected to various sources.'), + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { + isBordered: true, + isSeparated: true, + size: "large", + children: Object.keys(filteredBindings).map(key => { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + children: key + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + className: "components-item__block-bindings-source", + children: sources[filteredBindings[key].source] ? sources[filteredBindings[key].source].label : filteredBindings[key].source + })] + }) + }, key); + }) + }) + }) + }) + }); +}; +/* harmony default export */ const block_bindings = ({ + edit: BlockBindingsPanel, + attributeKeys: ['metadata'], + hasSupport() { + return true; + } +}); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/block-renaming.js +/** + * WordPress dependencies + */ + + + /** * Filters registered block settings, adding an `__experimentalLabel` callback if one does not already exist. * @@ -34203,252 +37332,8 @@ function addLabelCallback(settings) { } return settings; } -function BlockRenameControlPure({ - metadata, - setAttributes -}) { - return (0,external_React_.createElement)(inspector_controls, { - group: "advanced" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, { - __nextHasNoMarginBottom: true, - __next40pxDefaultSize: true, - label: (0,external_wp_i18n_namespaceObject.__)('Block name'), - value: metadata?.name || '', - onChange: newName => { - setAttributes({ - metadata: { - ...metadata, - name: newName - } - }); - } - })); -} -/* harmony default export */ const block_renaming = ({ - edit: BlockRenameControlPure, - attributeKeys: ['metadata'], - hasSupport(name) { - return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, 'renaming', true); - } -}); (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/metadata/addLabelCallback', addLabelCallback); -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/use-bindings-attributes.js - -/** - * WordPress dependencies - */ - - - - - - - -/** - * Internal dependencies - */ - - -/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */ -/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */ - -/** - * Given a binding of block attributes, returns a higher order component that - * overrides its `attributes` and `setAttributes` props to sync any changes needed. - * - * @return {WPHigherOrderComponent} Higher-order component. - */ - -const BLOCK_BINDINGS_ALLOWED_BLOCKS = { - 'core/paragraph': ['content'], - 'core/heading': ['content'], - 'core/image': ['url', 'title', 'alt'], - 'core/button': ['url', 'text', 'linkTarget'] -}; - -/** - * Based on the given block name, - * check if it is possible to bind the block. - * - * @param {string} blockName - The block name. - * @return {boolean} Whether it is possible to bind the block to sources. - */ -function canBindBlock(blockName) { - return blockName in BLOCK_BINDINGS_ALLOWED_BLOCKS; -} - -/** - * Based on the given block name and attribute name, - * check if it is possible to bind the block attribute. - * - * @param {string} blockName - The block name. - * @param {string} attributeName - The attribute name. - * @return {boolean} Whether it is possible to bind the block attribute. - */ -function canBindAttribute(blockName, attributeName) { - return canBindBlock(blockName) && BLOCK_BINDINGS_ALLOWED_BLOCKS[blockName].includes(attributeName); -} - -/** - * This component is responsible for detecting and - * propagating data changes from the source to the block. - * - * @param {Object} props - The component props. - * @param {string} props.attrName - The attribute name. - * @param {Object} props.blockProps - The block props with bound attribute. - * @param {Object} props.source - Source handler. - * @param {Object} props.args - The arguments to pass to the source. - * @param {Function} props.onPropValueChange - The function to call when the attribute value changes. - * @return {null} Data-handling component. Render nothing. - */ -const BindingConnector = ({ - args, - attrName, - blockProps, - source, - onPropValueChange -}) => { - const { - placeholder, - value: propValue - } = source.useSource(blockProps, args); - const { - name: blockName - } = blockProps; - const attrValue = blockProps.attributes[attrName]; - const updateBoundAttibute = (0,external_wp_element_namespaceObject.useCallback)((newAttrValue, prevAttrValue) => { - /* - * If the attribute is a RichTextData instance, - * (core/paragraph, core/heading, core/button, etc.) - * compare its HTML representation with the new value. - * - * To do: it looks like a workaround. - * Consider improving the attribute and metadata fields types. - */ - if (prevAttrValue instanceof external_wp_richText_namespaceObject.RichTextData) { - // Bail early if the Rich Text value is the same. - if (prevAttrValue.toHTMLString() === newAttrValue) { - return; - } - - /* - * To preserve the value type, - * convert the new value to a RichTextData instance. - */ - newAttrValue = external_wp_richText_namespaceObject.RichTextData.fromHTMLString(newAttrValue); - } - if (prevAttrValue === newAttrValue) { - return; - } - onPropValueChange({ - [attrName]: newAttrValue - }); - }, [attrName, onPropValueChange]); - (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { - if (typeof propValue !== 'undefined') { - updateBoundAttibute(propValue, attrValue); - } else if (placeholder) { - /* - * Placeholder fallback. - * If the attribute is `src` or `href`, - * a placeholder can't be used because it is not a valid url. - * Adding this workaround until - * attributes and metadata fields types are improved and include `url`. - */ - const htmlAttribute = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName).attributes[attrName].attribute; - if (htmlAttribute === 'src' || htmlAttribute === 'href') { - updateBoundAttibute(null); - return; - } - updateBoundAttibute(placeholder); - } - }, [updateBoundAttibute, propValue, attrValue, placeholder, blockName, attrName]); - return null; -}; - -/** - * BlockBindingBridge acts like a component wrapper - * that connects the bound attributes of a block - * to the source handlers. - * For this, it creates a BindingConnector for each bound attribute. - * - * @param {Object} props - The component props. - * @param {Object} props.blockProps - The BlockEdit props object. - * @param {Object} props.bindings - The block bindings settings. - * @param {Function} props.onPropValueChange - The function to call when the attribute value changes. - * @return {null} Data-handling component. Render nothing. - */ -function BlockBindingBridge({ - blockProps, - bindings, - onPropValueChange -}) { - const blockBindingsSources = unlock((0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store)).getAllBlockBindingsSources(); - return (0,external_React_.createElement)(external_React_.Fragment, null, Object.entries(bindings).map(([attrName, boundAttribute]) => { - // Bail early if the block doesn't have a valid source handler. - const source = blockBindingsSources[boundAttribute.source]; - if (!source?.useSource) { - return null; - } - return (0,external_React_.createElement)(BindingConnector, { - key: attrName, - attrName: attrName, - source: source, - blockProps: blockProps, - args: boundAttribute.args, - onPropValueChange: onPropValueChange - }); - })); -} -const withBlockBindingSupport = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => { - /* - * Collect and update the bound attributes - * in a separate state. - */ - const [boundAttributes, setBoundAttributes] = (0,external_wp_element_namespaceObject.useState)({}); - const updateBoundAttributes = (0,external_wp_element_namespaceObject.useCallback)(newAttributes => setBoundAttributes(prev => ({ - ...prev, - ...newAttributes - })), []); - - /* - * Create binding object filtering - * only the attributes that can be bound. - */ - const bindings = Object.fromEntries(Object.entries(props.attributes.metadata?.bindings || {}).filter(([attrName]) => canBindAttribute(props.name, attrName))); - return (0,external_React_.createElement)(external_React_.Fragment, null, Object.keys(bindings).length > 0 && (0,external_React_.createElement)(BlockBindingBridge, { - blockProps: props, - bindings: bindings, - onPropValueChange: updateBoundAttributes - }), (0,external_React_.createElement)(BlockEdit, { - ...props, - attributes: { - ...props.attributes, - ...boundAttributes - } - })); -}, 'withBlockBindingSupport'); - -/** - * Filters a registered block's settings to enhance a block's `edit` component - * to upgrade bound attributes. - * - * @param {WPBlockSettings} settings - Registered block settings. - * @param {string} name - Block name. - * @return {WPBlockSettings} Filtered block settings. - */ -function shimAttributeSource(settings, name) { - if (!canBindBlock(name)) { - return settings; - } - return { - ...settings, - edit: withBlockBindingSupport(settings.edit) - }; -} -(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/editor/custom-sources-backwards-compatibility/shim-attribute-source', shimAttributeSource); - ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/use-border-props.js /** * Internal dependencies @@ -34586,7 +37471,7 @@ function getColorClassesAndStyles(attributes) { const hasGradient = gradientClass || style?.color?.gradient; // Determine color CSS class name list. - const className = classnames_default()(textClass, gradientClass, { + const className = dist_clsx(textClass, gradientClass, { // Don't apply the background class if there's a gradient. [backgroundClass]: !hasGradient && !!backgroundClass, 'has-text-color': textColor || style?.color?.text, @@ -34694,6 +37579,9 @@ function getSpacingClassesAndStyles(attributes) { +const { + kebabCase: use_typography_props_kebabCase +} = unlock(external_wp_components_namespaceObject.privateApis); /* * This utility is intended to assist where the serialization of the typography @@ -34710,22 +37598,19 @@ function getSpacingClassesAndStyles(attributes) { * @return {Object} Typography block support derived CSS classes & styles. */ function getTypographyClassesAndStyles(attributes, settings) { - const { - kebabCase - } = unlock(external_wp_components_namespaceObject.privateApis); let typographyStyles = attributes?.style?.typography || {}; - const fluidTypographySettings = getFluidTypographyOptionsFromSettings(settings); typographyStyles = { ...typographyStyles, fontSize: getTypographyFontSizeValue({ size: attributes?.style?.typography?.fontSize - }, fluidTypographySettings) + }, settings) }; const style = getInlineStyles({ typography: typographyStyles }); - const fontFamilyClassName = !!attributes?.fontFamily ? `has-${kebabCase(attributes.fontFamily)}-font-family` : ''; - const className = classnames_default()(fontFamilyClassName, getFontSizeClass(attributes?.fontSize)); + const fontFamilyClassName = !!attributes?.fontFamily ? `has-${use_typography_props_kebabCase(attributes.fontFamily)}-font-family` : ''; + const textAlignClassName = !!attributes?.style?.typography?.textAlign ? `has-text-align-${attributes?.style?.typography?.textAlign}` : ''; + const className = dist_clsx(fontFamilyClassName, textAlignClassName, getFontSizeClass(attributes?.fontSize)); return { className, style @@ -34754,6 +37639,55 @@ function useCachedTruthy(value) { return cachedValue; } +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/use-zoom-out.js +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + +/** + * A hook used to set the editor mode to zoomed out mode, invoking the hook sets the mode. + * + * @param {boolean} zoomOut If we should enter into zoomOut mode or not + */ +function useZoomOut(zoomOut = true) { + const { + __unstableSetEditorMode + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const { + __unstableGetEditorMode + } = (0,external_wp_data_namespaceObject.useSelect)(store); + const originalEditingMode = (0,external_wp_element_namespaceObject.useRef)(null); + const mode = __unstableGetEditorMode(); + (0,external_wp_element_namespaceObject.useEffect)(() => { + // Only set this on mount so we know what to return to when we unmount. + if (!originalEditingMode.current) { + originalEditingMode.current = mode; + } + return () => { + // We need to use __unstableGetEditorMode() here and not `mode`, as mode may not update on unmount + if (__unstableGetEditorMode() === 'zoom-out' && __unstableGetEditorMode() !== originalEditingMode.current) { + __unstableSetEditorMode(originalEditingMode.current); + } + }; + }, []); + + // The effect opens the zoom-out view if we want it open and it's not currently in zoom-out mode. + (0,external_wp_element_namespaceObject.useEffect)(() => { + if (zoomOut && mode !== 'zoom-out') { + __unstableSetEditorMode('zoom-out'); + } else if (!zoomOut && __unstableGetEditorMode() === 'zoom-out' && originalEditingMode.current !== mode) { + __unstableSetEditorMode(originalEditingMode.current); + } + }, [__unstableSetEditorMode, zoomOut, mode]); +} + ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/index.js /** * Internal dependencies @@ -34782,9 +37716,14 @@ function useCachedTruthy(value) { -createBlockEditFilter([align, hooks_anchor, custom_class_name, style, duotone, position, layout, content_lock_ui, block_hooks, block_renaming].filter(Boolean)); -createBlockListBlockFilter([align, style, color, dimensions, duotone, font_family, font_size, border, position, layout_child]); -createBlockSaveFilter([align, hooks_anchor, aria_label, custom_class_name, border, color, style, font_family, font_size]); + + + + +createBlockEditFilter([block_bindings, align, text_align, hooks_anchor, custom_class_name, style, duotone, position, layout, content_lock_ui, block_hooks, layout_child].filter(Boolean)); +createBlockListBlockFilter([align, text_align, background, style, color, dimensions, duotone, font_family, font_size, border, position, block_style_variation, layout_child]); +createBlockSaveFilter([align, text_align, hooks_anchor, aria_label, custom_class_name, border, color, style, font_family, font_size]); + @@ -34795,8 +37734,8 @@ createBlockSaveFilter([align, hooks_anchor, aria_label, custom_class_name, borde -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors/with-colors.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors/with-colors.js /** * WordPress dependencies */ @@ -34811,6 +37750,10 @@ createBlockSaveFilter([align, hooks_anchor, aria_label, custom_class_name, borde +const { + kebabCase: with_colors_kebabCase +} = unlock(external_wp_components_namespaceObject.privateApis); + /** * Capitalizes the first letter in a string. * @@ -34828,7 +37771,7 @@ const upperFirst = ([firstLetter, ...rest]) => firstLetter.toUpperCase() + rest. * * @return {Function} The higher order component. */ -const withCustomColorPalette = colorsArray => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => props => (0,external_React_.createElement)(WrappedComponent, { +const withCustomColorPalette = colorsArray => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => props => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ...props, colors: colorsArray }), 'withCustomColorPalette'); @@ -34842,7 +37785,7 @@ const withCustomColorPalette = colorsArray => (0,external_wp_compose_namespaceOb const withEditorColorPalette = () => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => props => { const [userPalette, themePalette, defaultPalette] = use_settings_useSettings('color.palette.custom', 'color.palette.theme', 'color.palette.default'); const allColors = (0,external_wp_element_namespaceObject.useMemo)(() => [...(userPalette || []), ...(themePalette || []), ...(defaultPalette || [])], [userPalette, themePalette, defaultPalette]); - return (0,external_React_.createElement)(WrappedComponent, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ...props, colors: allColors }); @@ -34858,14 +37801,11 @@ const withEditorColorPalette = () => (0,external_wp_compose_namespaceObject.crea * @return {Component} The component that can be used as a HOC. */ function createColorHOC(colorTypes, withColorPalette) { - const { - kebabCase - } = unlock(external_wp_components_namespaceObject.privateApis); const colorMap = colorTypes.reduce((colorObject, colorType) => { return { ...colorObject, ...(typeof colorType === 'string' ? { - [colorType]: kebabCase(colorType) + [colorType]: with_colors_kebabCase(colorType) } : colorType) }; }, {}); @@ -34927,7 +37867,7 @@ function createColorHOC(colorTypes, withColorPalette) { }, {}); } render() { - return (0,external_React_.createElement)(WrappedComponent, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ...this.props, colors: undefined, ...this.state, @@ -35005,7 +37945,6 @@ function withColors(...colorTypes) { ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/font-size-picker.js - /** * WordPress dependencies */ @@ -35015,9 +37954,10 @@ function withColors(...colorTypes) { * Internal dependencies */ + function font_size_picker_FontSizePicker(props) { const [fontSizes, customFontSize] = use_settings_useSettings('typography.fontSizes', 'typography.customFontSize'); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.FontSizePicker, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FontSizePicker, { ...props, fontSizes: fontSizes, disableCustomFontSizes: !customFontSize @@ -35030,7 +37970,6 @@ function font_size_picker_FontSizePicker(props) { /* harmony default export */ const font_size_picker = (font_size_picker_FontSizePicker); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/with-font-sizes.js - /** * WordPress dependencies */ @@ -35042,6 +37981,7 @@ function font_size_picker_FontSizePicker(props) { */ + const DEFAULT_FONT_SIZES = []; /** @@ -35075,7 +38015,7 @@ const with_font_sizes_upperFirst = ([firstLetter, ...rest]) => firstLetter.toUpp }, {}); return (0,external_wp_compose_namespaceObject.createHigherOrderComponent)((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => props => { const [fontSizes] = use_settings_useSettings('typography.fontSizes'); - return (0,external_React_.createElement)(WrappedComponent, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ...props, fontSizes: fontSizes || DEFAULT_FONT_SIZES }); @@ -35138,7 +38078,7 @@ const with_font_sizes_upperFirst = ([firstLetter, ...rest]) => firstLetter.toUpp }; } render() { - return (0,external_React_.createElement)(WrappedComponent, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ...this.props, fontSizes: undefined, ...this.state, @@ -35155,142 +38095,6 @@ const with_font_sizes_upperFirst = ([firstLetter, ...rest]) => firstLetter.toUpp -;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/align-left.js - -/** - * WordPress dependencies - */ - -const alignLeft = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M13 5.5H4V4h9v1.5Zm7 7H4V11h16v1.5Zm-7 7H4V18h9v1.5Z" -})); -/* harmony default export */ const align_left = (alignLeft); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/align-center.js - -/** - * WordPress dependencies - */ - -const align_center_alignCenter = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M7.5 5.5h9V4h-9v1.5Zm-3.5 7h16V11H4v1.5Zm3.5 7h9V18h-9v1.5Z" -})); -/* harmony default export */ const align_center = (align_center_alignCenter); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/align-right.js - -/** - * WordPress dependencies - */ - -const alignRight = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M11.111 5.5H20V4h-8.889v1.5ZM4 12.5h16V11H4v1.5Zm7.111 7H20V18h-8.889v1.5Z" -})); -/* harmony default export */ const align_right = (alignRight); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/alignment-control/ui.js - -/** - * WordPress dependencies - */ - - - -const DEFAULT_ALIGNMENT_CONTROLS = [{ - icon: align_left, - title: (0,external_wp_i18n_namespaceObject.__)('Align text left'), - align: 'left' -}, { - icon: align_center, - title: (0,external_wp_i18n_namespaceObject.__)('Align text center'), - align: 'center' -}, { - icon: align_right, - title: (0,external_wp_i18n_namespaceObject.__)('Align text right'), - align: 'right' -}]; -const ui_POPOVER_PROPS = { - placement: 'bottom-start' -}; -function AlignmentUI({ - value, - onChange, - alignmentControls = DEFAULT_ALIGNMENT_CONTROLS, - label = (0,external_wp_i18n_namespaceObject.__)('Align text'), - describedBy = (0,external_wp_i18n_namespaceObject.__)('Change text alignment'), - isCollapsed = true, - isToolbar -}) { - function applyOrUnset(align) { - return () => onChange(value === align ? undefined : align); - } - const activeAlignment = alignmentControls.find(control => control.align === value); - function setIcon() { - if (activeAlignment) return activeAlignment.icon; - return (0,external_wp_i18n_namespaceObject.isRTL)() ? align_right : align_left; - } - const UIComponent = isToolbar ? external_wp_components_namespaceObject.ToolbarGroup : external_wp_components_namespaceObject.ToolbarDropdownMenu; - const extraProps = isToolbar ? { - isCollapsed - } : { - toggleProps: { - describedBy - }, - popoverProps: ui_POPOVER_PROPS - }; - return (0,external_React_.createElement)(UIComponent, { - icon: setIcon(), - label: label, - controls: alignmentControls.map(control => { - const { - align - } = control; - const isActive = value === align; - return { - ...control, - isActive, - role: isCollapsed ? 'menuitemradio' : undefined, - onClick: applyOrUnset(align) - }; - }), - ...extraProps - }); -} -/* harmony default export */ const alignment_control_ui = (AlignmentUI); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/alignment-control/index.js - -/** - * Internal dependencies - */ - -const AlignmentControl = props => { - return (0,external_React_.createElement)(alignment_control_ui, { - ...props, - isToolbar: false - }); -}; -const AlignmentToolbar = props => { - return (0,external_React_.createElement)(alignment_control_ui, { - ...props, - isToolbar: true - }); -}; - -/** - * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/alignment-control/README.md - */ - - // EXTERNAL MODULE: ./node_modules/remove-accents/index.js var remove_accents = __webpack_require__(9681); var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents); @@ -35390,6 +38194,17 @@ const defaultGetKeywords = item => item.keywords || []; const defaultGetCategory = item => item.category; const defaultGetCollection = () => null; +// Normalization regexes +const splitRegexp = [/([\p{Ll}\p{Lo}\p{N}])([\p{Lu}\p{Lt}])/gu, +// One lowercase or digit, followed by one uppercase. +/([\p{Lu}\p{Lt}])([\p{Lu}\p{Lt}][\p{Ll}\p{Lo}])/gu // One uppercase followed by one uppercase and one lowercase. +]; +const stripRegexp = /(\p{C}|\p{P}|\p{S})+/giu; // Anything that's not a punctuation, symbol or control/format character. + +// Normalization cache +const extractedWords = new Map(); +const normalizedStrings = new Map(); + /** * Extracts words from an input string. * @@ -35398,13 +38213,15 @@ const defaultGetCollection = () => null; * @return {Array} Words, extracted from the input string. */ function extractWords(input = '') { - return noCase(input, { - splitRegexp: [/([\p{Ll}\p{Lo}\p{N}])([\p{Lu}\p{Lt}])/gu, - // One lowercase or digit, followed by one uppercase. - /([\p{Lu}\p{Lt}])([\p{Lu}\p{Lt}][\p{Ll}\p{Lo}])/gu // One uppercase followed by one uppercase and one lowercase. - ], - stripRegexp: /(\p{C}|\p{P}|\p{S})+/giu // Anything that's not a punctuation, symbol or control/format character. + if (extractedWords.has(input)) { + return extractedWords.get(input); + } + const result = noCase(input, { + splitRegexp, + stripRegexp }).split(' ').filter(Boolean); + extractedWords.set(input, result); + return result; } /** @@ -35414,19 +38231,24 @@ function extractWords(input = '') { * * @return {string} The normalized search input. */ -function normalizeSearchInput(input = '') { +function normalizeString(input = '') { + if (normalizedStrings.has(input)) { + return normalizedStrings.get(input); + } + // Disregard diacritics. // Input: "média" - input = remove_accents_default()(input); + let result = remove_accents_default()(input); // Accommodate leading slash, matching autocomplete expectations. // Input: "/media" - input = input.replace(/^\//, ''); + result = result.replace(/^\//, ''); // Lowercase. // Input: "MEDIA" - input = input.toLowerCase(); - return input; + result = result.toLowerCase(); + normalizedStrings.set(input, result); + return result; } /** @@ -35437,7 +38259,7 @@ function normalizeSearchInput(input = '') { * @return {string[]} The normalized list of search terms. */ const getNormalizedSearchTerms = (input = '') => { - return extractWords(normalizeSearchInput(input)); + return extractWords(normalizeString(input)); }; const removeMatchingTerms = (unmatchedTerms, unprocessedTerms) => { return unmatchedTerms.filter(term => !getNormalizedSearchTerms(unprocessedTerms).some(unprocessedTerm => unprocessedTerm.includes(term))); @@ -35503,8 +38325,8 @@ function getItemSearchRank(item, searchTerm, config = {}) { const keywords = getKeywords(item); const category = getCategory(item); const collection = getCollection(item); - const normalizedSearchInput = normalizeSearchInput(searchTerm); - const normalizedTitle = normalizeSearchInput(title); + const normalizedSearchInput = normalizeString(searchTerm); + const normalizedTitle = normalizeString(title); let rank = 0; // Prefers exact matches @@ -35545,15 +38367,20 @@ function getItemSearchRank(item, searchTerm, config = {}) { */ + /** * Retrieves the block types inserter state. * * @param {string=} rootClientId Insertion's root client ID. * @param {Function} onInsert function called when inserter a list of blocks. + * @param {boolean} isQuick * @return {Array} Returns the block types state. (block types, categories, collections, onSelect handler) */ -const useBlockTypesState = (rootClientId, onInsert) => { - const [items] = (0,external_wp_data_namespaceObject.useSelect)(select => [select(store).getInserterItems(rootClientId)], [rootClientId]); +const useBlockTypesState = (rootClientId, onInsert, isQuick) => { + const options = (0,external_wp_element_namespaceObject.useMemo)(() => ({ + [withRootClientIdOptionKey]: !isQuick + }), [isQuick]); + const [items] = (0,external_wp_data_namespaceObject.useSelect)(select => [select(store).getInserterItems(rootClientId, options)], [rootClientId, options]); const [categories, collections] = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getCategories, @@ -35566,12 +38393,13 @@ const useBlockTypesState = (rootClientId, onInsert) => { initialAttributes, innerBlocks, syncStatus, - content + content, + rootClientId: _rootClientId }, shouldFocusBlock) => { const insertedBlock = syncStatus === 'unsynced' ? (0,external_wp_blocks_namespaceObject.parse)(content, { __unstableSkipMigrationLogs: true }) : (0,external_wp_blocks_namespaceObject.createBlock)(name, initialAttributes, (0,external_wp_blocks_namespaceObject.createBlocksFromInnerBlocksTemplate)(innerBlocks)); - onInsert(insertedBlock, undefined, shouldFocusBlock); + onInsert(insertedBlock, undefined, shouldFocusBlock, _rootClientId); }, [onInsert]); return [items, categories, collections, onSelectItem]; }; @@ -35600,15 +38428,18 @@ const orderInserterBlockItems = (items, priority) => { let aIndex = priority.indexOf(aName); let bIndex = priority.indexOf(bName); // All other block items should come after that. - if (aIndex < 0) aIndex = priority.length; - if (bIndex < 0) bIndex = priority.length; + if (aIndex < 0) { + aIndex = priority.length; + } + if (bIndex < 0) { + bIndex = priority.length; + } return aIndex - bIndex; }); return items; }; ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/autocompleters/block.js - /** * WordPress dependencies */ @@ -35625,6 +38456,9 @@ const orderInserterBlockItems = (items, priority) => { + + + const block_noop = () => {}; const SHOWN_BLOCK_TYPES = 9; @@ -35674,11 +38508,12 @@ function createBlockCompleter() { return { key: `block-${blockItem.id}`, value: blockItem, - label: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(block_icon, { - key: "icon", - icon: icon, - showColors: true - }), title), + label: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { + icon: icon, + showColors: true + }, "icon"), title] + }), isDisabled }; }), [filteredItems]); @@ -35716,21 +38551,21 @@ function createBlockCompleter() { const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post.js - /** * WordPress dependencies */ -const post = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const post = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "m7.3 9.7 1.4 1.4c.2-.2.3-.3.4-.5 0 0 0-.1.1-.1.3-.5.4-1.1.3-1.6L12 7 9 4 7.2 6.5c-.6-.1-1.1 0-1.6.3 0 0-.1 0-.1.1-.3.1-.4.2-.6.4l1.4 1.4L4 11v1h1l2.3-2.3zM4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "m7.3 9.7 1.4 1.4c.2-.2.3-.3.4-.5 0 0 0-.1.1-.1.3-.5.4-1.1.3-1.6L12 7 9 4 7.2 6.5c-.6-.1-1.1 0-1.6.3 0 0-.1 0-.1.1-.3.1-.4.2-.6.4l1.4 1.4L4 11v1h1l2.3-2.3zM4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4z" + }) +}); /* harmony default export */ const library_post = (post); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/autocompleters/link.js - /** * WordPress dependencies */ @@ -35739,6 +38574,9 @@ const post = (0,external_React_.createElement)(external_wp_primitives_namespaceO + + + const SHOWN_SUGGESTIONS = 10; /** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */ @@ -35770,15 +38608,17 @@ function createLinkCompleter() { return [...expansionWords]; }, getOptionLabel(item) { - return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(build_module_icon, { - key: "icon", - icon: item.subtype === 'page' ? library_page : library_post - }), item.title); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { + icon: item.subtype === 'page' ? library_page : library_post + }, "icon"), item.title] + }); }, getOptionCompletion(item) { - return (0,external_React_.createElement)("a", { - href: item.url - }, item.title); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { + href: item.url, + children: item.title + }); } }; } @@ -35791,7 +38631,6 @@ function createLinkCompleter() { /* harmony default export */ const autocompleters_link = (createLinkCompleter()); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/autocomplete/index.js - /** * WordPress dependencies */ @@ -35813,6 +38652,7 @@ function createLinkCompleter() { * * @type {Array} */ + const autocomplete_EMPTY_ARRAY = []; function useCompleters({ completers = autocomplete_EMPTY_ARRAY @@ -35851,7 +38691,7 @@ function useBlockEditorAutocompleteProps(props) { * @type {import('react').FC} */ function BlockEditorAutocomplete(props) { - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Autocomplete, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Autocomplete, { ...props, completers: useCompleters(props) }); @@ -35863,34 +38703,35 @@ function BlockEditorAutocomplete(props) { /* harmony default export */ const autocomplete = (BlockEditorAutocomplete); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/fullscreen.js - /** * WordPress dependencies */ -const fullscreen = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const fullscreen = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M6 4a2 2 0 0 0-2 2v3h1.5V6a.5.5 0 0 1 .5-.5h3V4H6Zm3 14.5H6a.5.5 0 0 1-.5-.5v-3H4v3a2 2 0 0 0 2 2h3v-1.5Zm6 1.5v-1.5h3a.5.5 0 0 0 .5-.5v-3H20v3a2 2 0 0 1-2 2h-3Zm3-16a2 2 0 0 1 2 2v3h-1.5V6a.5.5 0 0 0-.5-.5h-3V4h3Z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M6 4a2 2 0 0 0-2 2v3h1.5V6a.5.5 0 0 1 .5-.5h3V4H6Zm3 14.5H6a.5.5 0 0 1-.5-.5v-3H4v3a2 2 0 0 0 2 2h3v-1.5Zm6 1.5v-1.5h3a.5.5 0 0 0 .5-.5v-3H20v3a2 2 0 0 1-2 2h-3Zm3-16a2 2 0 0 1 2 2v3h-1.5V6a.5.5 0 0 0-.5-.5h-3V4h3Z" + }) +}); /* harmony default export */ const library_fullscreen = (fullscreen); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-full-height-alignment-control/index.js - /** * WordPress dependencies */ + function BlockFullHeightAlignmentControl({ isActive, label = (0,external_wp_i18n_namespaceObject.__)('Toggle full height'), onToggle, isDisabled }) { - return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { isActive: isActive, icon: library_fullscreen, label: label, @@ -35901,13 +38742,13 @@ function BlockFullHeightAlignmentControl({ /* harmony default export */ const block_full_height_alignment_control = (BlockFullHeightAlignmentControl); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-matrix-control/index.js - /** * WordPress dependencies */ + const block_alignment_matrix_control_noop = () => {}; function BlockAlignmentMatrixControl(props) { const { @@ -35916,10 +38757,10 @@ function BlockAlignmentMatrixControl(props) { value = 'center', isDisabled } = props; - const icon = (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalAlignmentMatrixControl.Icon, { + const icon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalAlignmentMatrixControl.Icon, { value: value }); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Dropdown, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: { placement: 'bottom-start' }, @@ -35933,7 +38774,7 @@ function BlockAlignmentMatrixControl(props) { onToggle(); } }; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { onClick: onToggle, "aria-haspopup": "true", "aria-expanded": isOpen, @@ -35944,7 +38785,7 @@ function BlockAlignmentMatrixControl(props) { disabled: isDisabled }); }, - renderContent: () => (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalAlignmentMatrixControl, { + renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalAlignmentMatrixControl, { hasFocusBorder: false, onChange: onChange, value: value @@ -36060,7 +38901,6 @@ function BlockTitle({ } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-breadcrumb/index.js - /** * WordPress dependencies */ @@ -36083,6 +38923,8 @@ function BlockTitle({ * @param {string} props.rootLabelText Translated label for the root element of the breadcrumb trail. * @return {Element} Block Breadcrumb. */ + + function BlockBreadcrumb({ rootLabelText }) { @@ -36114,39 +38956,44 @@ function BlockBreadcrumb({ * Safari+VoiceOver won't announce the list otherwise. */ /* eslint-disable jsx-a11y/no-redundant-roles */ - return (0,external_React_.createElement)("ul", { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("ul", { className: "block-editor-block-breadcrumb", role: "list", - "aria-label": (0,external_wp_i18n_namespaceObject.__)('Block breadcrumb') - }, (0,external_React_.createElement)("li", { - className: !hasSelection ? 'block-editor-block-breadcrumb__current' : undefined, - "aria-current": !hasSelection ? 'true' : undefined - }, hasSelection && (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - className: "block-editor-block-breadcrumb__button", - variant: "tertiary", - onClick: clearSelectedBlock - }, rootLabel), !hasSelection && rootLabel, !!clientId && (0,external_React_.createElement)(build_module_icon, { - icon: chevron_right_small, - className: "block-editor-block-breadcrumb__separator" - })), parents.map(parentClientId => (0,external_React_.createElement)("li", { - key: parentClientId - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - className: "block-editor-block-breadcrumb__button", - variant: "tertiary", - onClick: () => selectBlock(parentClientId) - }, (0,external_React_.createElement)(BlockTitle, { - clientId: parentClientId, - maximumLength: 35 - })), (0,external_React_.createElement)(build_module_icon, { - icon: chevron_right_small, - className: "block-editor-block-breadcrumb__separator" - }))), !!clientId && (0,external_React_.createElement)("li", { - className: "block-editor-block-breadcrumb__current", - "aria-current": "true" - }, (0,external_React_.createElement)(BlockTitle, { - clientId: clientId, - maximumLength: 35 - }))) + "aria-label": (0,external_wp_i18n_namespaceObject.__)('Block breadcrumb'), + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { + className: !hasSelection ? 'block-editor-block-breadcrumb__current' : undefined, + "aria-current": !hasSelection ? 'true' : undefined, + children: [hasSelection && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + className: "block-editor-block-breadcrumb__button", + variant: "tertiary", + onClick: clearSelectedBlock, + children: rootLabel + }), !hasSelection && rootLabel, !!clientId && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { + icon: chevron_right_small, + className: "block-editor-block-breadcrumb__separator" + })] + }), parents.map(parentClientId => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + className: "block-editor-block-breadcrumb__button", + variant: "tertiary", + onClick: () => selectBlock(parentClientId), + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockTitle, { + clientId: parentClientId, + maximumLength: 35 + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { + icon: chevron_right_small, + className: "block-editor-block-breadcrumb__separator" + })] + }, parentClientId)), !!clientId && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { + className: "block-editor-block-breadcrumb__current", + "aria-current": "true", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockTitle, { + clientId: clientId, + maximumLength: 35 + }) + })] + }) /* eslint-enable jsx-a11y/no-redundant-roles */; } /* harmony default export */ const block_breadcrumb = (BlockBreadcrumb); @@ -36171,7 +39018,6 @@ function useBlockOverlayActive(clientId) { } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-context/index.js - /** * WordPress dependencies */ @@ -36188,6 +39034,7 @@ function useBlockOverlayActive(clientId) { */ /** @type {import('react').Context>} */ + const block_context_Context = (0,external_wp_element_namespaceObject.createContext)({}); /** @@ -36206,7 +39053,7 @@ function BlockContextProvider({ ...context, ...value }), [context, value]); - return (0,external_React_.createElement)(block_context_Context.Provider, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_context_Context.Provider, { value: nextValue, children: children }); @@ -36214,7 +39061,6 @@ function BlockContextProvider({ /* harmony default export */ const block_context = (block_context_Context); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-edit/edit.js - /** * External dependencies */ @@ -36240,6 +39086,7 @@ function BlockContextProvider({ * * @type {{}} */ + const DEFAULT_BLOCK_CONTEXT = {}; const Edit = props => { const { @@ -36254,7 +39101,7 @@ const Edit = props => { // with which a block is displayed. If `blockType` is valid, assign // them preferentially as the render value for the block. const Component = blockType.edit || blockType.save; - return (0,external_React_.createElement)(Component, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { ...props }); }; @@ -36275,7 +39122,7 @@ const EditWithGeneratedProps = props => { return null; } if (blockType.apiVersion > 1) { - return (0,external_React_.createElement)(EditWithFilters, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditWithFilters, { ...props, context: context }); @@ -36283,8 +39130,8 @@ const EditWithGeneratedProps = props => { // Generate a class name for the block's editable form. const generatedClassName = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'className', true) ? (0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(name) : null; - const className = classnames_default()(generatedClassName, attributes.className, props.className); - return (0,external_React_.createElement)(EditWithFilters, { + const className = dist_clsx(generatedClassName, attributes.className, props.className); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditWithFilters, { ...props, context: context, className: className @@ -36292,19 +39139,149 @@ const EditWithGeneratedProps = props => { }; /* harmony default export */ const block_edit_edit = (EditWithGeneratedProps); -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-edit/index.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js +/** + * WordPress dependencies + */ + + +const moreVertical = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" + }) +}); +/* harmony default export */ const more_vertical = (moreVertical); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/warning/index.js +/** + * External dependencies + */ + /** * WordPress dependencies */ + + + + +function Warning({ + className, + actions, + children, + secondaryActions +}) { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + style: { + display: 'contents', + all: 'initial' + }, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: dist_clsx(className, 'block-editor-warning'), + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-warning__contents", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { + className: "block-editor-warning__message", + children: children + }), (external_wp_element_namespaceObject.Children.count(actions) > 0 || secondaryActions) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-warning__actions", + children: [external_wp_element_namespaceObject.Children.count(actions) > 0 && external_wp_element_namespaceObject.Children.map(actions, (action, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + className: "block-editor-warning__action", + children: action + }, i)), secondaryActions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { + className: "block-editor-warning__secondary", + icon: more_vertical, + label: (0,external_wp_i18n_namespaceObject.__)('More options'), + popoverProps: { + position: 'bottom left', + className: 'block-editor-warning__dropdown' + }, + noIcons: true, + children: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { + children: secondaryActions.map((item, pos) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { + onClick: item.onClick, + children: item.title + }, pos)) + }) + })] + })] + }) + }) + }); +} + +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/warning/README.md + */ +/* harmony default export */ const warning = (Warning); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-edit/multiple-usage-warning.js +/** + * WordPress dependencies + */ + + + + + /** * Internal dependencies */ + +function MultipleUsageWarning({ + originalBlockClientId, + name, + onReplace +}) { + const { + selectBlock + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(warning, { + actions: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + variant: "secondary", + onClick: () => selectBlock(originalBlockClientId), + children: (0,external_wp_i18n_namespaceObject.__)('Find original') + }, "find-original"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + variant: "secondary", + onClick: () => onReplace([]), + children: (0,external_wp_i18n_namespaceObject.__)('Remove') + }, "remove")], + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("strong", { + children: [blockType?.title, ": "] + }), (0,external_wp_i18n_namespaceObject.__)('This block can only be used once.')] + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/private-block-context.js +/** + * WordPress dependencies + */ + +const PrivateBlockContext = (0,external_wp_element_namespaceObject.createContext)({}); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-edit/index.js +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + + + /** * The `useBlockEditContext` hook provides information about the block this hook is being used in. * It returns an object with the `name`, `isSelected` state, and the `clientId` of the block. @@ -36314,10 +39291,13 @@ const EditWithGeneratedProps = props => { * @return {Object} Block edit context */ + + function BlockEdit({ mayDisplayControls, mayDisplayParentControls, blockEditingMode, + isPreviewMode, // The remaining props are passed through the BlockEdit filters and are thus // public API! ...props @@ -36337,7 +39317,10 @@ function BlockEdit({ bindings } = metadata; const layoutSupport = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, 'layout', false) || (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, '__experimentalLayout', false); - return (0,external_React_.createElement)(Provider + const { + originalBlockClientId + } = (0,external_wp_element_namespaceObject.useContext)(PrivateBlockContext); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Provider // It is important to return the same object if props haven't // changed to avoid unnecessary rerenders. // See https://reactjs.org/docs/context.html#caveats. @@ -36353,93 +39336,30 @@ function BlockEdit({ [mayDisplayControlsKey]: mayDisplayControls, [mayDisplayParentControlsKey]: mayDisplayParentControls, [blockEditingModeKey]: blockEditingMode, - [blockBindingsKey]: bindings - }), [name, isSelected, clientId, layoutSupport, layout, __unstableLayoutClassNames, mayDisplayControls, mayDisplayParentControls, blockEditingMode, bindings]) - }, (0,external_React_.createElement)(block_edit_edit, { - ...props - })); -} - -;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js - -/** - * WordPress dependencies - */ - -const moreVertical = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" -})); -/* harmony default export */ const more_vertical = (moreVertical); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/warning/index.js - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - - -function Warning({ - className, - actions, - children, - secondaryActions -}) { - return (0,external_React_.createElement)("div", { - style: { - display: 'contents', - all: 'initial' - } - }, (0,external_React_.createElement)("div", { - className: classnames_default()(className, 'block-editor-warning') - }, (0,external_React_.createElement)("div", { - className: "block-editor-warning__contents" - }, (0,external_React_.createElement)("p", { - className: "block-editor-warning__message" - }, children), (external_wp_element_namespaceObject.Children.count(actions) > 0 || secondaryActions) && (0,external_React_.createElement)("div", { - className: "block-editor-warning__actions" - }, external_wp_element_namespaceObject.Children.count(actions) > 0 && external_wp_element_namespaceObject.Children.map(actions, (action, i) => (0,external_React_.createElement)("span", { - key: i, - className: "block-editor-warning__action" - }, action)), secondaryActions && (0,external_React_.createElement)(external_wp_components_namespaceObject.DropdownMenu, { - className: "block-editor-warning__secondary", - icon: more_vertical, - label: (0,external_wp_i18n_namespaceObject.__)('More options'), - popoverProps: { - position: 'bottom left', - className: 'block-editor-warning__dropdown' - }, - noIcons: true - }, () => (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, secondaryActions.map((item, pos) => (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { - onClick: item.onClick, - key: pos - }, item.title)))))))); + [blockBindingsKey]: bindings, + [isPreviewModeKey]: isPreviewMode + }), [name, isSelected, clientId, layoutSupport, layout, __unstableLayoutClassNames, mayDisplayControls, mayDisplayParentControls, blockEditingMode, bindings, isPreviewMode]), + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_edit_edit, { + ...props + }), originalBlockClientId && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MultipleUsageWarning, { + originalBlockClientId: originalBlockClientId, + name: name, + onReplace: props.onReplace + })] + }); } -/** - * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/warning/README.md - */ -/* harmony default export */ const warning = (Warning); - // EXTERNAL MODULE: ./node_modules/diff/lib/diff/character.js var character = __webpack_require__(8021); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-compare/block-view.js - /** * WordPress dependencies */ + + function BlockView({ title, rawContent, @@ -36448,27 +39368,35 @@ function BlockView({ actionText, className }) { - return (0,external_React_.createElement)("div", { - className: className - }, (0,external_React_.createElement)("div", { - className: "block-editor-block-compare__content" - }, (0,external_React_.createElement)("h2", { - className: "block-editor-block-compare__heading" - }, title), (0,external_React_.createElement)("div", { - className: "block-editor-block-compare__html" - }, rawContent), (0,external_React_.createElement)("div", { - className: "block-editor-block-compare__preview edit-post-visual-editor" - }, (0,external_React_.createElement)(external_wp_element_namespaceObject.RawHTML, null, (0,external_wp_dom_namespaceObject.safeHTML)(renderedContent)))), (0,external_React_.createElement)("div", { - className: "block-editor-block-compare__action" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - variant: "secondary", - tabIndex: "0", - onClick: action - }, actionText))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: className, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-block-compare__content", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { + className: "block-editor-block-compare__heading", + children: title + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-block-compare__html", + children: rawContent + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-block-compare__preview edit-post-visual-editor", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.RawHTML, { + children: (0,external_wp_dom_namespaceObject.safeHTML)(renderedContent) + }) + })] + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-block-compare__action", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + variant: "secondary", + tabIndex: "0", + onClick: action, + children: actionText + }) + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-compare/index.js - /** * External dependencies */ @@ -36487,6 +39415,8 @@ function BlockView({ * Internal dependencies */ + + function BlockCompare({ block, onKeep, @@ -36497,14 +39427,14 @@ function BlockCompare({ function getDifference(originalContent, newContent) { const difference = (0,character/* diffChars */.JJ)(originalContent, newContent); return difference.map((item, pos) => { - const classes = classnames_default()({ + const classes = dist_clsx({ 'block-editor-block-compare__added': item.added, 'block-editor-block-compare__removed': item.removed }); - return (0,external_React_.createElement)("span", { - key: pos, - className: classes - }, item.value); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + className: classes, + children: item.value + }, pos); }); } function getConvertedContent(convertedBlock) { @@ -36517,28 +39447,28 @@ function BlockCompare({ } const converted = getConvertedContent(convertor(block)); const difference = getDifference(block.originalContent, converted); - return (0,external_React_.createElement)("div", { - className: "block-editor-block-compare__wrapper" - }, (0,external_React_.createElement)(BlockView, { - title: (0,external_wp_i18n_namespaceObject.__)('Current'), - className: "block-editor-block-compare__current", - action: onKeep, - actionText: (0,external_wp_i18n_namespaceObject.__)('Convert to HTML'), - rawContent: block.originalContent, - renderedContent: block.originalContent - }), (0,external_React_.createElement)(BlockView, { - title: (0,external_wp_i18n_namespaceObject.__)('After Conversion'), - className: "block-editor-block-compare__converted", - action: onConvert, - actionText: convertButtonText, - rawContent: difference, - renderedContent: converted - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-block-compare__wrapper", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockView, { + title: (0,external_wp_i18n_namespaceObject.__)('Current'), + className: "block-editor-block-compare__current", + action: onKeep, + actionText: (0,external_wp_i18n_namespaceObject.__)('Convert to HTML'), + rawContent: block.originalContent, + renderedContent: block.originalContent + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockView, { + title: (0,external_wp_i18n_namespaceObject.__)('After Conversion'), + className: "block-editor-block-compare__converted", + action: onConvert, + actionText: convertButtonText, + rawContent: difference, + renderedContent: converted + })] + }); } /* harmony default export */ const block_compare = (BlockCompare); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-invalid-warning.js - /** * WordPress dependencies */ @@ -36554,6 +39484,9 @@ function BlockCompare({ + + + const blockToBlocks = block => (0,external_wp_blocks_namespaceObject.rawHandler)({ HTML: block.originalContent }); @@ -36615,30 +39548,33 @@ function BlockInvalidWarning({ title: (0,external_wp_i18n_namespaceObject.__)('Convert to Classic Block'), onClick: convert.toClassic }].filter(Boolean), [canInsertHTMLBlock, canInsertClassicBlock, convert]); - return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(warning, { - actions: [(0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - key: "recover", - onClick: convert.toRecoveredBlock, - variant: "primary" - }, (0,external_wp_i18n_namespaceObject.__)('Attempt Block Recovery'))], - secondaryActions: secondaryActions - }, (0,external_wp_i18n_namespaceObject.__)('This block contains unexpected or invalid content.')), compare && (0,external_React_.createElement)(external_wp_components_namespaceObject.Modal, { - title: - // translators: Dialog title to fix block content - (0,external_wp_i18n_namespaceObject.__)('Resolve Block'), - onRequestClose: onCompareClose, - className: "block-editor-block-compare" - }, (0,external_React_.createElement)(block_compare, { - block: block, - onKeep: convert.toHTML, - onConvert: convert.toBlocks, - convertor: blockToBlocks, - convertButtonText: (0,external_wp_i18n_namespaceObject.__)('Convert to Blocks') - }))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(warning, { + actions: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + onClick: convert.toRecoveredBlock, + variant: "primary", + children: (0,external_wp_i18n_namespaceObject.__)('Attempt Block Recovery') + }, "recover")], + secondaryActions: secondaryActions, + children: (0,external_wp_i18n_namespaceObject.__)('This block contains unexpected or invalid content.') + }), compare && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { + title: + // translators: Dialog title to fix block content + (0,external_wp_i18n_namespaceObject.__)('Resolve Block'), + onRequestClose: onCompareClose, + className: "block-editor-block-compare", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_compare, { + block: block, + onKeep: convert.toHTML, + onConvert: convert.toBlocks, + convertor: blockToBlocks, + convertButtonText: (0,external_wp_i18n_namespaceObject.__)('Convert to Blocks') + }) + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-crash-warning.js - /** * WordPress dependencies */ @@ -36648,9 +39584,11 @@ function BlockInvalidWarning({ * Internal dependencies */ -const block_crash_warning_warning = (0,external_React_.createElement)(warning, { - className: "block-editor-block-list__block-crash-warning" -}, (0,external_wp_i18n_namespaceObject.__)('This block has encountered an error and cannot be previewed.')); + +const block_crash_warning_warning = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(warning, { + className: "block-editor-block-list__block-crash-warning", + children: (0,external_wp_i18n_namespaceObject.__)('This block has encountered an error and cannot be previewed.') +}); /* harmony default export */ const block_crash_warning = (() => block_crash_warning_warning); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-crash-boundary.js @@ -36680,9 +39618,8 @@ class BlockCrashBoundary extends external_wp_element_namespaceObject.Component { /* harmony default export */ const block_crash_boundary = (BlockCrashBoundary); // EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js -var react_autosize_textarea_lib = __webpack_require__(4132); +var lib = __webpack_require__(4132); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-html.js - /** * External dependencies */ @@ -36699,6 +39636,7 @@ var react_autosize_textarea_lib = __webpack_require__(4132); * Internal dependencies */ + function BlockHTML({ clientId }) { @@ -36735,7 +39673,7 @@ function BlockHTML({ (0,external_wp_element_namespaceObject.useEffect)(() => { setHtml((0,external_wp_blocks_namespaceObject.getBlockContent)(block)); }, [block]); - return (0,external_React_.createElement)(react_autosize_textarea_lib/* default */.A, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(lib/* default */.A, { className: "block-editor-block-list__block-html-textarea", value: html, onBlur: onChange, @@ -36916,13 +39854,6 @@ function useMovingAnimation({ } /* harmony default export */ const use_moving_animation = (useMovingAnimation); -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/private-block-context.js -/** - * WordPress dependencies - */ - -const PrivateBlockContext = (0,external_wp_element_namespaceObject.createContext)({}); - ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/dom.js const BLOCK_SELECTOR = '.block-editor-block-list__block'; const APPENDER_SELECTOR = '.block-list-appender'; @@ -37009,11 +39940,12 @@ function useFocusFirstElement({ const ref = (0,external_wp_element_namespaceObject.useRef)(); const { isBlockSelected, - isMultiSelecting + isMultiSelecting, + __unstableGetEditorMode } = (0,external_wp_data_namespaceObject.useSelect)(store); (0,external_wp_element_namespaceObject.useEffect)(() => { // Check if the block is still selected at the time this effect runs. - if (!isBlockSelected(clientId) || isMultiSelecting()) { + if (!isBlockSelected(clientId) || isMultiSelecting() || __unstableGetEditorMode() === 'zoom-out') { return; } if (initialPosition === undefined || initialPosition === null) { @@ -37075,22 +40007,18 @@ function listener(event) { * Adds `is-hovered` class when the block is hovered and in navigation or * outline mode. */ -function useIsHovered({ - isEnabled -}) { +function useIsHovered() { return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { - if (isEnabled) { - node.addEventListener('mouseout', listener); - node.addEventListener('mouseover', listener); - return () => { - node.removeEventListener('mouseout', listener); - node.removeEventListener('mouseover', listener); + node.addEventListener('mouseout', listener); + node.addEventListener('mouseover', listener); + return () => { + node.removeEventListener('mouseout', listener); + node.removeEventListener('mouseover', listener); - // Remove class in case it lingers. - node.classList.remove('is-hovered'); - }; - } - }, [isEnabled]); + // Remove class in case it lingers. + node.classList.remove('is-hovered'); + }; + }, []); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-focus-handler.js @@ -37316,6 +40244,44 @@ function useIntersectionObserver() { }, [observer]); } +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-scroll-into-view.js +/** + * WordPress dependencies + */ + +function useScrollIntoView({ + isSelected +}) { + const prefersReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); + return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { + if (isSelected) { + const { + ownerDocument + } = node; + const { + defaultView + } = ownerDocument; + if (!defaultView.IntersectionObserver) { + return; + } + const observer = new defaultView.IntersectionObserver(entries => { + // Once observing starts, we always get an initial + // entry with the intersecting state. + if (!entries[0].isIntersecting) { + node.scrollIntoView({ + behavior: prefersReducedMotion ? 'instant' : 'smooth' + }); + } + observer.disconnect(); + }); + observer.observe(node); + return () => { + observer.disconnect(); + }; + } + }, [isSelected]); +} + ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-flash-editable-blocks/index.js /** * WordPress dependencies @@ -37401,6 +40367,7 @@ function useFlashEditableBlocks({ + /** * This hook is used to lightly mark an element as a block element. The element * should be the outermost element of a block. Call this hook and pass the @@ -37458,7 +40425,6 @@ function use_block_props_useBlockProps(props = {}, { blockTitle, isSelected, isSubtreeDisabled, - isOutlineEnabled, hasOverlay, initialPosition, blockEditingMode, @@ -37468,7 +40434,6 @@ function use_block_props_useBlockProps(props = {}, { isReusable, isDragging, hasChildSelected, - removeOutline, isBlockMovingMode, canInsertMovingBlock, isEditingDisabled, @@ -37487,9 +40452,7 @@ function use_block_props_useBlockProps(props = {}, { }), useBlockRefProvider(clientId), useFocusHandler(clientId), useEventHandlers({ clientId, isSelected - }), useNavModeExit(clientId), useIsHovered({ - isEnabled: isOutlineEnabled - }), useIntersectionObserver(), use_moving_animation({ + }), useNavModeExit(clientId), useIsHovered(), useIntersectionObserver(), use_moving_animation({ triggerAnimationOnChange: index, clientId }), (0,external_wp_compose_namespaceObject.useDisabled)({ @@ -37497,17 +40460,24 @@ function use_block_props_useBlockProps(props = {}, { }), useFlashEditableBlocks({ clientId, isEnabled: name === 'core/block' || templateLock === 'contentOnly' + }), useScrollIntoView({ + isSelected })]); const blockEditContext = useBlockEditContext(); const hasBlockBindings = !!blockEditContext[blockBindingsKey]; const bindingsStyle = hasBlockBindings && canBindBlock(name) ? { - '--wp-admin-theme-color': 'var(--wp-bound-block-color)' + '--wp-admin-theme-color': 'var(--wp-block-synced-color)', + '--wp-admin-theme-color--rgb': 'var(--wp-block-synced-color--rgb)' } : {}; // Ensures it warns only inside the `edit` implementation for the block. if (blockApiVersion < 2 && clientId === blockEditContext.clientId) { true ? external_wp_warning_default()(`Block type "${name}" must support API version 2 or higher to work correctly with "useBlockProps" method.`) : 0; } + let hasNegativeMargin = false; + if (wrapperProps?.style?.marginTop?.charAt(0) === '-' || wrapperProps?.style?.marginBottom?.charAt(0) === '-' || wrapperProps?.style?.marginLeft?.charAt(0) === '-' || wrapperProps?.style?.marginRight?.charAt(0) === '-') { + hasNegativeMargin = true; + } return { tabIndex: blockEditingMode === 'disabled' ? -1 : 0, ...wrapperProps, @@ -37520,7 +40490,7 @@ function use_block_props_useBlockProps(props = {}, { 'data-type': name, 'data-title': blockTitle, inert: isSubtreeDisabled ? 'true' : undefined, - className: classnames_default()('block-editor-block-list__block', { + className: dist_clsx('block-editor-block-list__block', { // The wp-block className is important for editor styles. 'wp-block': !isAligned, 'has-block-overlay': hasOverlay, @@ -37531,11 +40501,11 @@ function use_block_props_useBlockProps(props = {}, { 'is-reusable': isReusable, 'is-dragging': isDragging, 'has-child-selected': hasChildSelected, - 'remove-outline': removeOutline, 'is-block-moving-mode': isBlockMovingMode, 'can-insert-moving-block': canInsertMovingBlock, 'is-editing-disabled': isEditingDisabled, 'has-editable-outline': hasEditableOutline, + 'has-negative-margin': hasNegativeMargin, 'is-content-locked-temporarily-editing-as-blocks': isTemporarilyEditingAsBlocks }, className, props.className, wrapperProps.className, defaultClassName), style: { @@ -37554,7 +40524,6 @@ function use_block_props_useBlockProps(props = {}, { use_block_props_useBlockProps.save = external_wp_blocks_namespaceObject.__unstableGetBlockProps; ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/block.js - /** * External dependencies */ @@ -37592,6 +40561,9 @@ use_block_props_useBlockProps.save = external_wp_blocks_namespaceObject.__unstab * * @return {Object} Merged props. */ + + + function mergeWrapperProps(propsA, propsB) { const newProps = { ...propsA, @@ -37600,7 +40572,7 @@ function mergeWrapperProps(propsA, propsB) { // May be set to undefined, so check if the property is set! if (propsA?.hasOwnProperty('className') && propsB?.hasOwnProperty('className')) { - newProps.className = classnames_default()(propsA.className, propsB.className); + newProps.className = dist_clsx(propsA.className, propsB.className); } if (propsA?.hasOwnProperty('style') && propsB?.hasOwnProperty('style')) { newProps.style = { @@ -37615,11 +40587,12 @@ function Block({ isHtml, ...props }) { - return (0,external_React_.createElement)("div", { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...use_block_props_useBlockProps(props, { __unstableIsHtml: isHtml - }) - }, children); + }), + children: children + }); } function BlockListBlock({ block: { @@ -37653,14 +40626,14 @@ function BlockListBlock({ const { removeBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); - const onRemove = (0,external_wp_element_namespaceObject.useCallback)(() => removeBlock(clientId), [clientId]); + const onRemove = (0,external_wp_element_namespaceObject.useCallback)(() => removeBlock(clientId), [clientId, removeBlock]); const parentLayout = useLayout() || {}; // We wrap the BlockEdit component in a div that hides it when editing in // HTML mode. This allows us to render all of the ancillary pieces // (InspectorControls, etc.) which are inside `BlockEdit` but not // `BlockHTML`, even in HTML mode. - let blockEdit = (0,external_React_.createElement)(BlockEdit, { + let blockEdit = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { name: name, isSelected: isSelected, attributes: attributes, @@ -37676,7 +40649,8 @@ function BlockListBlock({ __unstableParentLayout: Object.keys(parentLayout).length ? parentLayout : undefined, mayDisplayControls: mayDisplayControls, mayDisplayParentControls: mayDisplayParentControls, - blockEditingMode: context.blockEditingMode + blockEditingMode: context.blockEditingMode, + isPreviewMode: context.isPreviewMode }); const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); @@ -37699,56 +40673,77 @@ function BlockListBlock({ // to the layout feature, and we're now aligning the markup of frontend // and backend. if (isAligned) { - blockEdit = (0,external_React_.createElement)("div", { - className: classnames_default()('wp-block', isSticky && className), - "data-align": wrapperProps['data-align'] - }, blockEdit); + blockEdit = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: dist_clsx('wp-block', isSticky && className), + "data-align": wrapperProps['data-align'], + children: blockEdit + }); } let block; if (!isValid) { const saveContent = __unstableBlockSource ? (0,external_wp_blocks_namespaceObject.serializeRawBlock)(__unstableBlockSource) : (0,external_wp_blocks_namespaceObject.getSaveContent)(blockType, attributes); - block = (0,external_React_.createElement)(Block, { - className: "has-warning" - }, (0,external_React_.createElement)(BlockInvalidWarning, { - clientId: clientId - }), (0,external_React_.createElement)(external_wp_element_namespaceObject.RawHTML, null, (0,external_wp_dom_namespaceObject.safeHTML)(saveContent))); + block = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Block, { + className: "has-warning", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockInvalidWarning, { + clientId: clientId + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.RawHTML, { + children: (0,external_wp_dom_namespaceObject.safeHTML)(saveContent) + })] + }); } else if (mode === 'html') { // Render blockEdit so the inspector controls don't disappear. // See #8969. - block = (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("div", { - style: { - display: 'none' - } - }, blockEdit), (0,external_React_.createElement)(Block, { - isHtml: true - }, (0,external_React_.createElement)(block_html, { - clientId: clientId - }))); + block = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + style: { + display: 'none' + }, + children: blockEdit + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Block, { + isHtml: true, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_html, { + clientId: clientId + }) + })] + }); } else if (blockType?.apiVersion > 1) { block = blockEdit; } else { - block = (0,external_React_.createElement)(Block, null, blockEdit); + block = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Block, { + children: blockEdit + }); } const { 'data-align': dataAlign, ...restWrapperProps } = (_wrapperProps = wrapperProps) !== null && _wrapperProps !== void 0 ? _wrapperProps : {}; - restWrapperProps.className = classnames_default()(restWrapperProps.className, dataAlign && themeSupportsLayout && `align${dataAlign}`, !(dataAlign && isSticky) && className); + const updatedWrapperProps = { + ...restWrapperProps, + className: dist_clsx(restWrapperProps.className, dataAlign && themeSupportsLayout && `align${dataAlign}`, !(dataAlign && isSticky) && className) + }; // We set a new context with the adjusted and filtered wrapperProps (through // `editor.BlockListBlock`), which the `BlockListBlockProvider` did not have // access to. - return (0,external_React_.createElement)(PrivateBlockContext.Provider, { + // Note that the context value doesn't have to be memoized in this case + // because when it changes, this component will be re-rendered anyway, and + // none of the consumers (BlockListBlock and useBlockProps) are memoized or + // "pure". This is different from the public BlockEditContext, where + // consumers might be memoized or "pure". + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateBlockContext.Provider, { value: { - wrapperProps: restWrapperProps, + wrapperProps: updatedWrapperProps, isAligned, ...context - } - }, (0,external_React_.createElement)(block_crash_boundary, { - fallback: (0,external_React_.createElement)(Block, { - className: "has-warning" - }, (0,external_React_.createElement)(block_crash_warning, null)) - }, block)); + }, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_crash_boundary, { + fallback: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Block, { + className: "has-warning", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_crash_warning, {}) + }), + children: block + }) + }); } const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps, registry) => { const { @@ -37759,7 +40754,8 @@ const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)((dis toggleSelection, __unstableMarkLastChangeAsPersistent, moveBlocksToPosition, - removeBlock + removeBlock, + selectBlock } = dispatch(store); // Do not add new properties here, use `useDispatch` instead to avoid @@ -37809,6 +40805,24 @@ const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)((dis getBlockRootClientId, canInsertBlockType } = registry.select(store); + function switchToDefaultOrRemove() { + const block = getBlock(clientId); + const defaultBlockName = (0,external_wp_blocks_namespaceObject.getDefaultBlockName)(); + if (getBlockName(clientId) !== defaultBlockName) { + const replacement = (0,external_wp_blocks_namespaceObject.switchToBlockType)(block, defaultBlockName); + if (replacement && replacement.length) { + replaceBlocks(clientId, replacement); + } + } else if ((0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(block)) { + const nextBlockClientId = getNextBlockClientId(clientId); + if (nextBlockClientId) { + registry.batch(() => { + removeBlock(clientId); + selectBlock(nextBlockClientId); + }); + } + } + } /** * Moves the block with clientId up one level. If the block type @@ -37831,9 +40845,11 @@ const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)((dis moveBlocksToPosition([firstClientId], _clientId, targetRootClientId, getBlockIndex(_clientId)); } else { const replacement = (0,external_wp_blocks_namespaceObject.switchToBlockType)(getBlock(firstClientId), (0,external_wp_blocks_namespaceObject.getDefaultBlockName)()); - if (replacement && replacement.length) { + if (replacement && replacement.length && replacement.every(block => canInsertBlockType(block.name, targetRootClientId))) { insertBlocks(replacement, getBlockIndex(_clientId), targetRootClientId, changeSelection); removeBlock(firstClientId, false); + } else { + switchToDefaultOrRemove(); } } if (!getBlockOrder(_clientId).length && (0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(getBlock(_clientId))) { @@ -37899,7 +40915,7 @@ const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)((dis } moveFirstItemUp(rootClientId); } else { - removeBlock(clientId); + switchToDefaultOrRemove(); } } }, @@ -37943,14 +40959,14 @@ function BlockListBlockProvider(props) { canRemoveBlock, canMoveBlock, getSettings, - __unstableGetTemporarilyEditingAsBlocks, + getTemporarilyEditingAsBlocks, getBlockEditingMode, getBlockName, isFirstMultiSelectedBlock, getMultiSelectedBlockClientIds, hasSelectedInnerBlock, + getBlocksByName, getBlockIndex, - isTyping, isBlockMultiSelected, isBlockSubtreeDisabled, isBlockHighlighted, @@ -37977,77 +40993,96 @@ function BlockListBlockProvider(props) { hasBlockSupport: _hasBlockSupport, getActiveBlockVariation } = select(external_wp_blocks_namespaceObject.store); - const _isSelected = isBlockSelected(clientId); - const canRemove = canRemoveBlock(clientId, rootClientId); - const canMove = canMoveBlock(clientId, rootClientId); const attributes = getBlockAttributes(clientId); const { name: blockName, isValid } = blockWithoutAttributes; const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName); - const match = getActiveBlockVariation(blockName, attributes); const { - outlineMode, - supportsLayout + supportsLayout, + __unstableIsPreviewMode: isPreviewMode } = getSettings(); + const hasLightBlockWrapper = blockType?.apiVersion > 1; + const previewContext = { + isPreviewMode, + blockWithoutAttributes, + name: blockName, + attributes, + isValid, + themeSupportsLayout: supportsLayout, + index: getBlockIndex(clientId), + isReusable: (0,external_wp_blocks_namespaceObject.isReusableBlock)(blockType), + className: hasLightBlockWrapper ? attributes.className : undefined, + defaultClassName: hasLightBlockWrapper ? (0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(blockName) : undefined, + blockTitle: blockType?.title + }; + + // When in preview mode, we can avoid a lot of selection and + // editing related selectors. + if (isPreviewMode) { + return previewContext; + } + const _isSelected = isBlockSelected(clientId); + const canRemove = canRemoveBlock(clientId); + const canMove = canMoveBlock(clientId); + const match = getActiveBlockVariation(blockName, attributes); const isMultiSelected = isBlockMultiSelected(clientId); const checkDeep = true; const isAncestorOfSelectedBlock = hasSelectedInnerBlock(clientId, checkDeep); - const typing = isTyping(); - const hasLightBlockWrapper = blockType?.apiVersion > 1; const movingClientId = hasBlockMovingClientId(); const blockEditingMode = getBlockEditingMode(clientId); + const multiple = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, 'multiple', true); + + // For block types with `multiple` support, there is no "original + // block" to be found in the content, as the block itself is valid. + const blocksWithSameName = multiple ? [] : getBlocksByName(blockName); + const isInvalid = blocksWithSameName.length && blocksWithSameName[0] !== clientId; return { + ...previewContext, mode: getBlockMode(clientId), isSelectionEnabled: isSelectionEnabled(), isLocked: !!getTemplateLock(rootClientId), templateLock: getTemplateLock(clientId), canRemove, canMove, - blockWithoutAttributes, - name: blockName, - attributes, - isValid, isSelected: _isSelected, - themeSupportsLayout: supportsLayout, - isTemporarilyEditingAsBlocks: __unstableGetTemporarilyEditingAsBlocks() === clientId, + isTemporarilyEditingAsBlocks: getTemporarilyEditingAsBlocks() === clientId, blockEditingMode, mayDisplayControls: _isSelected || isFirstMultiSelectedBlock(clientId) && getMultiSelectedBlockClientIds().every(id => getBlockName(id) === blockName), mayDisplayParentControls: _hasBlockSupport(getBlockName(clientId), '__experimentalExposeControlsToChildren', false) && hasSelectedInnerBlock(clientId), - index: getBlockIndex(clientId), blockApiVersion: blockType?.apiVersion || 1, blockTitle: match?.title || blockType?.title, isSubtreeDisabled: blockEditingMode === 'disabled' && isBlockSubtreeDisabled(clientId), - isOutlineEnabled: outlineMode, hasOverlay: __unstableHasActiveBlockOverlayActive(clientId) && !isDragging(), - initialPosition: _isSelected && __unstableGetEditorMode() === 'edit' ? getSelectedBlocksInitialCaretPosition() : undefined, + initialPosition: _isSelected && (__unstableGetEditorMode() === 'edit' || __unstableGetEditorMode() === 'zoom-out') // Don't recalculate the initialPosition when toggling in/out of zoom-out mode + ? getSelectedBlocksInitialCaretPosition() : undefined, isHighlighted: isBlockHighlighted(clientId), isMultiSelected, isPartiallySelected: isMultiSelected && !__unstableIsFullySelected() && !__unstableSelectionHasUnmergeableBlock(), - isReusable: (0,external_wp_blocks_namespaceObject.isReusableBlock)(blockType), isDragging: isBlockBeingDragged(clientId), hasChildSelected: isAncestorOfSelectedBlock, - removeOutline: _isSelected && outlineMode && typing, isBlockMovingMode: !!movingClientId, canInsertMovingBlock: movingClientId && canInsertBlockType(getBlockName(movingClientId), rootClientId), isEditingDisabled: blockEditingMode === 'disabled', hasEditableOutline: blockEditingMode !== 'disabled' && getBlockEditingMode(rootClientId) === 'disabled', - className: hasLightBlockWrapper ? attributes.className : undefined, - defaultClassName: hasLightBlockWrapper ? (0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(blockName) : undefined + originalBlockClientId: isInvalid ? blocksWithSameName[0] : false }; }, [clientId, rootClientId]); const { - mode, - isSelectionEnabled, - isLocked, - canRemove, - canMove, + isPreviewMode, + // Fill values that end up as a public API and may not be defined in + // preview mode. + mode = 'visual', + isSelectionEnabled = false, + isLocked = false, + canRemove = false, + canMove = false, blockWithoutAttributes, name, attributes, isValid, - isSelected, + isSelected = false, themeSupportsLayout, isTemporarilyEditingAsBlocks, blockEditingMode, @@ -38057,7 +41092,6 @@ function BlockListBlockProvider(props) { blockApiVersion, blockTitle, isSubtreeDisabled, - isOutlineEnabled, hasOverlay, initialPosition, isHighlighted, @@ -38066,14 +41100,14 @@ function BlockListBlockProvider(props) { isReusable, isDragging, hasChildSelected, - removeOutline, isBlockMovingMode, canInsertMovingBlock, templateLock, isEditingDisabled, hasEditableOutline, className, - defaultClassName + defaultClassName, + originalBlockClientId } = selectedProps; // Users of the editor.BlockListBlock filter used to be able to @@ -38092,6 +41126,7 @@ function BlockListBlockProvider(props) { return null; } const privateContext = { + isPreviewMode, clientId, className, index, @@ -38101,7 +41136,6 @@ function BlockListBlockProvider(props) { blockTitle, isSelected, isSubtreeDisabled, - isOutlineEnabled, hasOverlay, initialPosition, blockEditingMode, @@ -38111,7 +41145,6 @@ function BlockListBlockProvider(props) { isReusable, isDragging, hasChildSelected, - removeOutline, isBlockMovingMode, canInsertMovingBlock, templateLock, @@ -38121,6 +41154,7 @@ function BlockListBlockProvider(props) { defaultClassName, mayDisplayControls, mayDisplayParentControls, + originalBlockClientId, themeSupportsLayout }; @@ -38133,84 +41167,88 @@ function BlockListBlockProvider(props) { // none of the consumers (BlockListBlock and useBlockProps) are memoized or // "pure". This is different from the public BlockEditContext, where // consumers might be memoized or "pure". - return (0,external_React_.createElement)(PrivateBlockContext.Provider, { - value: privateContext - }, (0,external_React_.createElement)(BlockListBlock, { - ...props, - mode, - isSelectionEnabled, - isLocked, - canRemove, - canMove, - // Users of the editor.BlockListBlock filter used to be able - // to access the block prop. Ideally these blocks would rely - // on the clientId prop only. This is kept for backward - // compatibility reasons. - block, - name, - attributes, - isValid, - isSelected - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateBlockContext.Provider, { + value: privateContext, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockListBlock, { + ...props, + mode, + isSelectionEnabled, + isLocked, + canRemove, + canMove, + // Users of the editor.BlockListBlock filter used to be able + // to access the block prop. Ideally these blocks would rely + // on the clientId prop only. This is kept for backward + // compatibility reasons. + block, + name, + attributes, + isValid, + isSelected + }) + }); } /* harmony default export */ const block_list_block = ((0,external_wp_element_namespaceObject.memo)(BlockListBlockProvider)); ;// CONCATENATED MODULE: external ["wp","htmlEntities"] const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/tips.js - /** * WordPress dependencies */ + const globalTips = [(0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('While writing, you can press / to quickly insert new blocks.'), { - kbd: (0,external_React_.createElement)("kbd", null) + kbd: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("kbd", {}) }), (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Indent a list by pressing space at the beginning of a line.'), { - kbd: (0,external_React_.createElement)("kbd", null) + kbd: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("kbd", {}) }), (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Outdent a list by pressing backspace at the beginning of a line.'), { - kbd: (0,external_React_.createElement)("kbd", null) + kbd: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("kbd", {}) }), (0,external_wp_i18n_namespaceObject.__)('Drag files into the editor to automatically insert media blocks.'), (0,external_wp_i18n_namespaceObject.__)("Change a block's type by pressing the block icon on the toolbar.")]; function Tips() { const [randomIndex] = (0,external_wp_element_namespaceObject.useState)( // Disable Reason: I'm not generating an HTML id. // eslint-disable-next-line no-restricted-syntax Math.floor(Math.random() * globalTips.length)); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Tip, null, globalTips[randomIndex]); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tip, { + children: globalTips[randomIndex] + }); } /* harmony default export */ const tips = (Tips); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right.js - /** * WordPress dependencies */ -const chevronRight = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const chevronRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" + }) +}); /* harmony default export */ const chevron_right = (chevronRight); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left.js - /** * WordPress dependencies */ -const chevronLeft = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const chevronLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" + }) +}); /* harmony default export */ const chevron_left = (chevronLeft); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-card/index.js - /** * External dependencies */ @@ -38230,6 +41268,8 @@ const chevronLeft = (0,external_React_.createElement)(external_wp_primitives_nam */ + + function BlockCard({ title, icon, @@ -38263,37 +41303,41 @@ function BlockCard({ const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); - return (0,external_React_.createElement)("div", { - className: classnames_default()('block-editor-block-card', className) - }, parentNavBlockClientId && - // This is only used by the Navigation block for now. It's not ideal having Navigation block specific code here. - (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - onClick: () => selectBlock(parentNavBlockClientId), - label: (0,external_wp_i18n_namespaceObject.__)('Go to parent Navigation block'), - style: - // TODO: This style override is also used in ToolsPanelHeader. - // It should be supported out-of-the-box by Button. - { - minWidth: 24, - padding: 0 - }, - icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, - size: "small" - }), (0,external_React_.createElement)(block_icon, { - icon: icon, - showColors: true - }), (0,external_React_.createElement)("div", { - className: "block-editor-block-card__content" - }, (0,external_React_.createElement)("h2", { - className: "block-editor-block-card__title" - }, title), description && (0,external_React_.createElement)("span", { - className: "block-editor-block-card__description" - }, description))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: dist_clsx('block-editor-block-card', className), + children: [parentNavBlockClientId && + /*#__PURE__*/ + // This is only used by the Navigation block for now. It's not ideal having Navigation block specific code here. + (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + onClick: () => selectBlock(parentNavBlockClientId), + label: (0,external_wp_i18n_namespaceObject.__)('Go to parent Navigation block'), + style: + // TODO: This style override is also used in ToolsPanelHeader. + // It should be supported out-of-the-box by Button. + { + minWidth: 24, + padding: 0 + }, + icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, + size: "small" + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { + icon: icon, + showColors: true + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { + spacing: 1, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { + className: "block-editor-block-card__title", + children: title + }), description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { + className: "block-editor-block-card__description", + children: description + })] + })] + }); } /* harmony default export */ const block_card = (BlockCard); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/provider/with-registry-provider.js - /** * WordPress dependencies */ @@ -38306,33 +41350,38 @@ function BlockCard({ */ -const withRegistryProvider = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => { - return (0,external_wp_data_namespaceObject.withRegistry)(({ - useSubRegistry = true, - registry, - ...props - }) => { - if (!useSubRegistry) { - return (0,external_React_.createElement)(WrappedComponent, { - registry: registry, - ...props - }); - } - const [subRegistry, setSubRegistry] = (0,external_wp_element_namespaceObject.useState)(null); - (0,external_wp_element_namespaceObject.useEffect)(() => { - const newRegistry = (0,external_wp_data_namespaceObject.createRegistry)({}, registry); - newRegistry.registerStore(STORE_NAME, storeConfig); - setSubRegistry(newRegistry); - }, [registry]); - if (!subRegistry) { - return null; - } - return (0,external_React_.createElement)(external_wp_data_namespaceObject.RegistryProvider, { - value: subRegistry - }, (0,external_React_.createElement)(WrappedComponent, { + +function getSubRegistry(subRegistries, registry, useSubRegistry) { + if (!useSubRegistry) { + return registry; + } + let subRegistry = subRegistries.get(registry); + if (!subRegistry) { + subRegistry = (0,external_wp_data_namespaceObject.createRegistry)({}, registry); + subRegistry.registerStore(STORE_NAME, storeConfig); + subRegistries.set(registry, subRegistry); + } + return subRegistry; +} +const withRegistryProvider = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => ({ + useSubRegistry = true, + ...props +}) => { + const registry = (0,external_wp_data_namespaceObject.useRegistry)(); + const [subRegistries] = (0,external_wp_element_namespaceObject.useState)(() => new WeakMap()); + const subRegistry = getSubRegistry(subRegistries, registry, useSubRegistry); + if (subRegistry === registry) { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { + registry: registry, + ...props + }); + } + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_data_namespaceObject.RegistryProvider, { + value: subRegistry, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { registry: subRegistry, ...props - })); + }) }); }, 'withRegistryProvider'); /* harmony default export */ const with_registry_provider = (withRegistryProvider); @@ -38511,7 +41560,14 @@ function useBlockSync({ } } }, [controlledBlocks, clientId]); + const isMounted = (0,external_wp_element_namespaceObject.useRef)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { + // On mount, controlled blocks are already set in the effect above. + if (!isMounted.current) { + isMounted.current = true; + return; + } + // When the block becomes uncontrolled, it means its inner state has been reset // we need to take the blocks again from the external value property. if (!isControlled) { @@ -38538,7 +41594,9 @@ function useBlockSync({ // the subscription is triggering for a block (`clientId !== null`) // and its block name can't be found because it's not on the list. // (`getBlockName( clientId ) === null`). - if (clientId !== null && getBlockName(clientId) === null) return; + if (clientId !== null && getBlockName(clientId) === null) { + return; + } // When RESET_BLOCKS on parent blocks get called, the controlled blocks // can reset to uncontrolled, in these situations, it means we need to populate @@ -38719,6 +41777,26 @@ function KeyboardShortcutsRegister() { character: 'y' } }); + + // List view shortcuts. + registerShortcut({ + name: 'core/block-editor/collapse-list-view', + category: 'list-view', + description: (0,external_wp_i18n_namespaceObject.__)('Collapse all other items.'), + keyCombination: { + modifier: 'alt', + character: 'l' + } + }); + registerShortcut({ + name: 'core/block-editor/group', + category: 'block', + description: (0,external_wp_i18n_namespaceObject.__)('Create a group block from the selected multiple blocks.'), + keyCombination: { + modifier: 'primary', + character: 'g' + } + }); }, [registerShortcut]); return null; } @@ -38726,7 +41804,6 @@ KeyboardShortcuts.Register = KeyboardShortcutsRegister; /* harmony default export */ const keyboard_shortcuts = (KeyboardShortcuts); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/provider/index.js - /** * WordPress dependencies */ @@ -38746,6 +41823,7 @@ KeyboardShortcuts.Register = KeyboardShortcutsRegister; /** @typedef {import('@wordpress/data').WPDataRegistry} WPDataRegistry */ + const ExperimentalBlockEditorProvider = with_registry_provider(props => { const { children, @@ -38767,20 +41845,23 @@ const ExperimentalBlockEditorProvider = with_registry_provider(props => { // Syncs the entity provider with changes in the block-editor store. useBlockSync(props); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.SlotFillProvider, { - passthrough: true - }, !settings?.__unstableIsPreviewMode && (0,external_React_.createElement)(keyboard_shortcuts.Register, null), (0,external_React_.createElement)(BlockRefsProvider, null, children)); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.SlotFillProvider, { + passthrough: true, + children: [!settings?.__unstableIsPreviewMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcuts.Register, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockRefsProvider, { + children: children + })] + }); }); const BlockEditorProvider = props => { - return (0,external_React_.createElement)(ExperimentalBlockEditorProvider, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ExperimentalBlockEditorProvider, { ...props, - stripExperimentalSettings: true - }, props.children); + stripExperimentalSettings: true, + children: props.children + }); }; /* harmony default export */ const provider = (BlockEditorProvider); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-selection-clearer/index.js - /** * WordPress dependencies */ @@ -38799,6 +41880,7 @@ const BlockEditorProvider = props => { * * @return {import('react').RefCallback} Ref callback. */ + function useBlockSelectionClearer() { const { getSettings, @@ -38833,7 +41915,7 @@ function useBlockSelectionClearer() { }, [hasSelectedBlock, hasMultiSelection, clearSelectedBlock, isEnabled]); } function BlockSelectionClearer(props) { - return (0,external_React_.createElement)("div", { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: useBlockSelectionClearer(), ...props }); @@ -38923,7 +42005,6 @@ function useMultiSelection() { } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-tab-nav.js - /** * WordPress dependencies */ @@ -38939,6 +42020,7 @@ function useMultiSelection() { + function useTabNav() { const container = (0,external_wp_element_namespaceObject.useRef)(); const focusCaptureBeforeRef = (0,external_wp_element_namespaceObject.useRef)(); @@ -38970,7 +42052,12 @@ function useTabNav() { } else if (hasMultiSelection()) { container.current.focus(); } else if (getSelectedBlockClientId()) { - getLastFocus()?.current.focus(); + if (getLastFocus()?.current) { + getLastFocus().current.focus(); + } else { + // Handles when the last focus has not been set yet, or has been cleared by new blocks being added via the inserter. + container.current.querySelector(`[data-block="${getSelectedBlockClientId()}"]`).focus(); + } } else { setNavigationMode(true); const canvasElement = container.current.ownerDocument === event.target.ownerDocument ? container.current : container.current.ownerDocument.defaultView.frameElement; @@ -38984,12 +42071,12 @@ function useTabNav() { } } } - const before = (0,external_React_.createElement)("div", { + const before = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: focusCaptureBeforeRef, tabIndex: focusCaptureTabIndex, onFocus: onFocusCapture }); - const after = (0,external_React_.createElement)("div", { + const after = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: focusCaptureAfterRef, tabIndex: focusCaptureTabIndex, onFocus: onFocusCapture @@ -39023,7 +42110,9 @@ function useTabNav() { // do it again here because after clearing block selection, // focus land on the writing flow container and pressing Tab // will no longer send focus through the focus capture element. - if (event.target === node) setNavigationMode(true); + if (event.target === node) { + setNavigationMode(true); + } return; } const nextTabbable = external_wp_dom_namespaceObject.focus.tabbable[direction](event.target); @@ -39447,7 +42536,9 @@ function useSelectAll() { function setContentEditableWrapper(node, value) { node.contentEditable = value; // Firefox doesn't automatically move focus. - if (value) node.focus(); + if (value) { + node.focus(); + } } /** @@ -39873,15 +42964,23 @@ function useInput() { const { __unstableIsFullySelected, getSelectedBlockClientIds, + getSelectedBlockClientId, __unstableIsSelectionMergeable, - hasMultiSelection + hasMultiSelection, + getBlockName, + canInsertBlockType, + getBlockRootClientId, + getSelectionStart, + getSelectionEnd, + getBlockAttributes } = (0,external_wp_data_namespaceObject.useSelect)(store); const { replaceBlocks, __unstableSplitSelection, removeBlocks, __unstableDeleteSelection, - __unstableExpandSelection + __unstableExpandSelection, + __unstableMarkAutomaticChange } = (0,external_wp_data_namespaceObject.useDispatch)(store); return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { function onBeforeInput(event) { @@ -39897,6 +42996,40 @@ function useInput() { return; } if (!hasMultiSelection()) { + if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) { + if (event.shiftKey || __unstableIsFullySelected()) { + return; + } + const clientId = getSelectedBlockClientId(); + const blockName = getBlockName(clientId); + const selectionStart = getSelectionStart(); + const selectionEnd = getSelectionEnd(); + if (selectionStart.attributeKey === selectionEnd.attributeKey) { + const selectedAttributeValue = getBlockAttributes(clientId)[selectionStart.attributeKey]; + const transforms = (0,external_wp_blocks_namespaceObject.getBlockTransforms)('from').filter(({ + type + }) => type === 'enter'); + const transformation = (0,external_wp_blocks_namespaceObject.findTransform)(transforms, item => { + return item.regExp.test(selectedAttributeValue); + }); + if (transformation) { + replaceBlocks(clientId, transformation.transform({ + content: selectedAttributeValue + })); + __unstableMarkAutomaticChange(); + return; + } + } + if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, 'splitting', false) && !event.__deprecatedOnSplit) { + return; + } + + // Ensure template is not locked. + if (canInsertBlockType(blockName, getBlockRootClientId(clientId))) { + __unstableSplitSelection(); + event.preventDefault(); + } + } return; } if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) { @@ -40117,7 +43250,9 @@ function shouldDismissPastedFiles(files, html /*, plainText */) { // other elements found, like
, but we assume that the user's // intention is to paste the actual image file. const IMAGE_TAG = /<\s*img\b/gi; - if (html.match(IMAGE_TAG)?.length !== 1) return true; + if (html.match(IMAGE_TAG)?.length !== 1) { + return true; + } // Even when there is exactly one tag in the HTML payload, we // choose to weed out local images, i.e. those whose source starts with @@ -40126,7 +43261,9 @@ function shouldDismissPastedFiles(files, html /*, plainText */) { // text and exactly one image, and pasting that content using Google // Chrome. const IMG_WITH_LOCAL_SRC = /<\s*img\b[^>]*\bsrc="file:\/\//i; - if (html.match(IMG_WITH_LOCAL_SRC)) return true; + if (html.match(IMG_WITH_LOCAL_SRC)) { + return true; + } } return false; } @@ -40234,12 +43371,14 @@ function toPlainText(html) { + /** * Internal dependencies */ + function useClipboardHandler() { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const { @@ -40247,11 +43386,13 @@ function useClipboardHandler() { getSelectedBlockClientIds, hasMultiSelection, getSettings, + getBlockName, __unstableIsFullySelected, __unstableIsSelectionCollapsed, __unstableIsSelectionMergeable, __unstableGetSelectedBlocksWithPartialSelection, - canInsertBlockType + canInsertBlockType, + getBlockRootClientId } = (0,external_wp_data_namespaceObject.useSelect)(store); const { flashBlock, @@ -40259,7 +43400,7 @@ function useClipboardHandler() { replaceBlocks, __unstableDeleteSelection, __unstableExpandSelection, - insertBlocks + __unstableSplitSelection } = (0,external_wp_data_namespaceObject.useDispatch)(store); const notifyCopy = useNotifyCopy(); return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { @@ -40273,7 +43414,8 @@ function useClipboardHandler() { return; } - // Always handle multiple selected blocks. + // Let native copy/paste behaviour take over in input fields. + // But always handle multiple selected blocks. if (!hasMultiSelection()) { const { target @@ -40283,21 +43425,24 @@ function useClipboardHandler() { } = target; // If copying, only consider actual text selection as selection. // Otherwise, any focus on an input field is considered. - const hasSelection = event.type === 'copy' || event.type === 'cut' ? (0,external_wp_dom_namespaceObject.documentHasUncollapsedSelection)(ownerDocument) : (0,external_wp_dom_namespaceObject.documentHasSelection)(ownerDocument); + const hasSelection = event.type === 'copy' || event.type === 'cut' ? (0,external_wp_dom_namespaceObject.documentHasUncollapsedSelection)(ownerDocument) : (0,external_wp_dom_namespaceObject.documentHasSelection)(ownerDocument) && !ownerDocument.activeElement.isContentEditable; // Let native copy behaviour take over in input fields. if (hasSelection) { return; } } - if (!node.contains(event.target.ownerDocument.activeElement)) { + const { + activeElement + } = event.target.ownerDocument; + if (!node.contains(activeElement)) { return; } - event.preventDefault(); const isSelectionMergeable = __unstableIsSelectionMergeable(); const shouldHandleWholeBlocks = __unstableIsSelectionCollapsed() || __unstableIsFullySelected(); const expandSelectionIsNeeded = !shouldHandleWholeBlocks && !isSelectionMergeable; if (event.type === 'copy' || event.type === 'cut') { + event.preventDefault(); if (selectedBlockClientIds.length === 1) { flashBlock(selectedBlockClientIds[0]); } @@ -40333,15 +43478,76 @@ function useClipboardHandler() { const { __experimentalCanUserUseUnfilteredHTML: canUserUseUnfilteredHTML } = getSettings(); - const blocks = getPasteBlocks(event, canUserUseUnfilteredHTML); - if (selectedBlockClientIds.length === 1) { - const [selectedBlockClientId] = selectedBlockClientIds; - if (blocks.every(block => canInsertBlockType(block.name, selectedBlockClientId))) { - insertBlocks(blocks, undefined, selectedBlockClientId); - return; + const isInternal = event.clipboardData.getData('rich-text') === 'true'; + if (isInternal) { + return; + } + const { + plainText, + html, + files + } = getPasteEventData(event); + const isFullySelected = __unstableIsFullySelected(); + let blocks = []; + if (files.length) { + const fromTransforms = (0,external_wp_blocks_namespaceObject.getBlockTransforms)('from'); + blocks = files.reduce((accumulator, file) => { + const transformation = (0,external_wp_blocks_namespaceObject.findTransform)(fromTransforms, transform => transform.type === 'files' && transform.isMatch([file])); + if (transformation) { + accumulator.push(transformation.transform([file])); + } + return accumulator; + }, []).flat(); + } else { + blocks = (0,external_wp_blocks_namespaceObject.pasteHandler)({ + HTML: html, + plainText, + mode: isFullySelected ? 'BLOCKS' : 'AUTO', + canUserUseUnfilteredHTML + }); + } + + // Inline paste: let rich text handle it. + if (typeof blocks === 'string') { + return; + } + if (isFullySelected) { + replaceBlocks(selectedBlockClientIds, blocks, blocks.length - 1, -1); + event.preventDefault(); + return; + } + + // If a block doesn't support splitting, let rich text paste + // inline. + if (!hasMultiSelection() && !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(getBlockName(selectedBlockClientIds[0]), 'splitting', false) && !event.__deprecatedOnSplit) { + return; + } + const [firstSelectedClientId] = selectedBlockClientIds; + const rootClientId = getBlockRootClientId(firstSelectedClientId); + const newBlocks = []; + for (const block of blocks) { + if (canInsertBlockType(block.name, rootClientId)) { + newBlocks.push(block); + } else { + // If a block cannot be inserted in a root block, try + // converting it to that root block type and insert the + // inner blocks. + // Example: paragraphs cannot be inserted into a list, + // so convert the paragraphs to a list for list items. + const rootBlockName = getBlockName(rootClientId); + const switchedBlocks = block.name !== rootBlockName ? (0,external_wp_blocks_namespaceObject.switchToBlockType)(block, rootBlockName) : [block]; + if (!switchedBlocks) { + return; + } + for (const switchedBlock of switchedBlocks) { + for (const innerBlock of switchedBlock.innerBlocks) { + newBlocks.push(innerBlock); + } + } } } - replaceBlocks(selectedBlockClientIds, blocks, blocks.length - 1, -1); + __unstableSplitSelection(newBlocks); + event.preventDefault(); } } node.ownerDocument.addEventListener('copy', handler); @@ -40356,7 +43562,6 @@ function useClipboardHandler() { } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/index.js - /** * External dependencies */ @@ -40383,6 +43588,9 @@ function useClipboardHandler() { + + + function useWritingFlow() { const [before, ref, after] = useTabNav(); const hasMultiSelection = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).hasMultiSelection(), []); @@ -40404,11 +43612,14 @@ function WritingFlow({ ...props }, forwardedRef) { const [before, ref, after] = useWritingFlow(); - return (0,external_React_.createElement)(external_React_.Fragment, null, before, (0,external_React_.createElement)("div", { - ...props, - ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, forwardedRef]), - className: classnames_default()(props.className, 'block-editor-writing-flow') - }, children), after); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [before, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + ...props, + ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, forwardedRef]), + className: dist_clsx(props.className, 'block-editor-writing-flow'), + children: children + }), after] + }); } /** @@ -40515,7 +43726,6 @@ function getCompatibilityStyles() { } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/iframe/index.js - /** * External dependencies */ @@ -40537,6 +43747,9 @@ function getCompatibilityStyles() { + + + function bubbleEvent(event, Constructor, frame) { const init = {}; for (const key in event) { @@ -40611,16 +43824,19 @@ function Iframe({ tabIndex = 0, scale = 1, frameSize = 0, - expand = false, readonly, forwardedRef: ref, + title = (0,external_wp_i18n_namespaceObject.__)('Editor canvas'), ...props }) { const { resolvedAssets, isPreviewMode } = (0,external_wp_data_namespaceObject.useSelect)(select => { - const settings = select(store).getSettings(); + const { + getSettings + } = select(store); + const settings = getSettings(); return { resolvedAssets: settings.__unstableResolvedAssets, isPreviewMode: settings.__unstableIsPreviewMode @@ -40631,12 +43847,16 @@ function Iframe({ scripts = '' } = resolvedAssets; const [iframeDocument, setIframeDocument] = (0,external_wp_element_namespaceObject.useState)(); + const prevContainerWidth = (0,external_wp_element_namespaceObject.useRef)(); const [bodyClasses, setBodyClasses] = (0,external_wp_element_namespaceObject.useState)([]); const clearerRef = useBlockSelectionClearer(); const [before, writingFlowRef, after] = useWritingFlow(); const [contentResizeListener, { height: contentHeight }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); + const [containerResizeListener, { + width: containerWidth + }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); const setRef = (0,external_wp_compose_namespaceObject.useRefEffect)(node => { node._load = () => { setIframeDocument(node.contentDocument); @@ -40655,6 +43875,7 @@ function Iframe({ documentElement } = contentDocument; iFrameDocument = contentDocument; + documentElement.classList.add('block-editor-iframe__html'); clearerRef(documentElement); // Ideally ALL classes that are added through get_body_class should @@ -40683,10 +43904,44 @@ function Iframe({ iFrameDocument?.removeEventListener('drop', preventFileDropDefault); }; }, []); + const [iframeWindowInnerHeight, setIframeWindowInnerHeight] = (0,external_wp_element_namespaceObject.useState)(); + const iframeResizeRef = (0,external_wp_compose_namespaceObject.useRefEffect)(node => { + const nodeWindow = node.ownerDocument.defaultView; + setIframeWindowInnerHeight(nodeWindow.innerHeight); + const onResize = () => { + setIframeWindowInnerHeight(nodeWindow.innerHeight); + }; + nodeWindow.addEventListener('resize', onResize); + return () => { + nodeWindow.removeEventListener('resize', onResize); + }; + }, []); + const [windowInnerWidth, setWindowInnerWidth] = (0,external_wp_element_namespaceObject.useState)(); + const windowResizeRef = (0,external_wp_compose_namespaceObject.useRefEffect)(node => { + const nodeWindow = node.ownerDocument.defaultView; + setWindowInnerWidth(nodeWindow.innerWidth); + const onResize = () => { + setWindowInnerWidth(nodeWindow.innerWidth); + }; + nodeWindow.addEventListener('resize', onResize); + return () => { + nodeWindow.removeEventListener('resize', onResize); + }; + }, []); + const isZoomedOut = scale !== 1; + (0,external_wp_element_namespaceObject.useEffect)(() => { + if (!isZoomedOut) { + prevContainerWidth.current = containerWidth; + } + }, [containerWidth, isZoomedOut]); const disabledRef = (0,external_wp_compose_namespaceObject.useDisabled)({ isDisabled: !readonly }); - const bodyRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([useBubbleEvents(iframeDocument), contentRef, clearerRef, writingFlowRef, disabledRef]); + const bodyRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([useBubbleEvents(iframeDocument), contentRef, clearerRef, writingFlowRef, disabledRef, + // Avoid resize listeners when not needed, these will trigger + // unnecessary re-renders when animating the iframe width, or when + // expanding preview iframes. + isZoomedOut ? iframeResizeRef : null]); // Correct doctype is required to enable rendering in standards // mode. Also preload the styles to avoid a flash of unstyled @@ -40696,7 +43951,19 @@ function Iframe({ - + ${styles} ${scripts} @@ -40711,55 +43978,101 @@ function Iframe({ return [_src, () => URL.revokeObjectURL(_src)]; }, [html]); (0,external_wp_element_namespaceObject.useEffect)(() => cleanup, [cleanup]); + (0,external_wp_element_namespaceObject.useEffect)(() => { + if (!iframeDocument || !isZoomedOut) { + return; + } + iframeDocument.documentElement.classList.add('is-zoomed-out'); + const maxWidth = 800; + iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-scale', scale === 'default' ? Math.min(containerWidth, maxWidth) / prevContainerWidth.current : scale); + iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-frame-size', typeof frameSize === 'number' ? `${frameSize}px` : frameSize); + iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-content-height', `${contentHeight}px`); + iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-inner-height', `${iframeWindowInnerHeight}px`); + iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-container-width', `${containerWidth}px`); + iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-prev-container-width', `${prevContainerWidth.current}px`); + return () => { + iframeDocument.documentElement.classList.remove('is-zoomed-out'); + iframeDocument.documentElement.style.removeProperty('--wp-block-editor-iframe-zoom-out-scale'); + iframeDocument.documentElement.style.removeProperty('--wp-block-editor-iframe-zoom-out-frame-size'); + iframeDocument.documentElement.style.removeProperty('--wp-block-editor-iframe-zoom-out-content-height'); + iframeDocument.documentElement.style.removeProperty('--wp-block-editor-iframe-zoom-out-inner-height'); + iframeDocument.documentElement.style.removeProperty('--wp-block-editor-iframe-zoom-out-container-width'); + iframeDocument.documentElement.style.removeProperty('--wp-block-editor-iframe-zoom-out-prev-container-width'); + }; + }, [scale, frameSize, iframeDocument, iframeWindowInnerHeight, contentHeight, containerWidth, windowInnerWidth, isZoomedOut]); - // We need to counter the margin created by scaling the iframe. If the scale - // is e.g. 0.45, then the top + bottom margin is 0.55 (1 - scale). Just the - // top or bottom margin is 0.55 / 2 ((1 - scale) / 2). - const marginFromScaling = contentHeight * (1 - scale) / 2; - return (0,external_React_.createElement)(external_React_.Fragment, null, tabIndex >= 0 && before, (0,external_React_.createElement)("iframe", { - ...props, - style: { - border: 0, - ...props.style, - height: expand ? contentHeight : props.style?.height, - marginTop: scale !== 1 ? -marginFromScaling + frameSize : props.style?.marginTop, - marginBottom: scale !== 1 ? -marginFromScaling + frameSize : props.style?.marginBottom, - transform: scale !== 1 ? `scale( ${scale} )` : props.style?.transform, - transition: 'all .3s' - }, - ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, setRef]), - tabIndex: tabIndex - // Correct doctype is required to enable rendering in standards - // mode. Also preload the styles to avoid a flash of unstyled - // content. - , - src: src, - title: (0,external_wp_i18n_namespaceObject.__)('Editor canvas'), - onKeyDown: event => { - if (props.onKeyDown) { - props.onKeyDown(event); - } - // If the event originates from inside the iframe, it means - // it bubbled through the portal, but only with React - // events. We need to to bubble native events as well, - // though by doing so we also trigger another React event, - // so we need to stop the propagation of this event to avoid - // duplication. - else if (event.currentTarget.ownerDocument !== event.target.ownerDocument) { - event.stopPropagation(); - bubbleEvent(event, window.KeyboardEvent, event.currentTarget); - } - } - }, iframeDocument && (0,external_wp_element_namespaceObject.createPortal)( - // We want to prevent React events from bubbling throught the iframe - // we bubble these manually. - /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ - (0,external_React_.createElement)("body", { - ref: bodyRef, - className: classnames_default()('block-editor-iframe__body', 'editor-styles-wrapper', ...bodyClasses) - }, contentResizeListener, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalStyleProvider, { - document: iframeDocument - }, children)), iframeDocument.documentElement)), tabIndex >= 0 && after); + // Make sure to not render the before and after focusable div elements in view + // mode. They're only needed to capture focus in edit mode. + const shouldRenderFocusCaptureElements = tabIndex >= 0 && !isPreviewMode; + const iframe = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [shouldRenderFocusCaptureElements && before, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("iframe", { + ...props, + style: { + border: 0, + ...props.style, + height: props.style?.height, + transition: 'all .3s' + }, + ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, setRef]), + tabIndex: tabIndex + // Correct doctype is required to enable rendering in standards + // mode. Also preload the styles to avoid a flash of unstyled + // content. + , + src: src, + title: title, + onKeyDown: event => { + if (props.onKeyDown) { + props.onKeyDown(event); + } + // If the event originates from inside the iframe, it means + // it bubbled through the portal, but only with React + // events. We need to to bubble native events as well, + // though by doing so we also trigger another React event, + // so we need to stop the propagation of this event to avoid + // duplication. + if (event.currentTarget.ownerDocument !== event.target.ownerDocument) { + // We should only stop propagation of the React event, + // the native event should further bubble inside the + // iframe to the document and window. + // Alternatively, we could consider redispatching the + // native event in the iframe. + const { + stopPropagation + } = event.nativeEvent; + event.nativeEvent.stopPropagation = () => {}; + event.stopPropagation(); + event.nativeEvent.stopPropagation = stopPropagation; + bubbleEvent(event, window.KeyboardEvent, event.currentTarget); + } + }, + children: iframeDocument && (0,external_wp_element_namespaceObject.createPortal)( + /*#__PURE__*/ + // We want to prevent React events from bubbling throught the iframe + // we bubble these manually. + /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ + (0,external_ReactJSXRuntime_namespaceObject.jsxs)("body", { + ref: bodyRef, + className: dist_clsx('block-editor-iframe__body', 'editor-styles-wrapper', ...bodyClasses), + children: [contentResizeListener, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalStyleProvider, { + document: iframeDocument, + children: children + })] + }), iframeDocument.documentElement) + }), shouldRenderFocusCaptureElements && after] + }); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-iframe__container", + ref: windowResizeRef, + children: [containerResizeListener, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: dist_clsx('block-editor-iframe__scale-container', isZoomedOut && 'is-zoomed-out'), + style: { + '--wp-block-editor-iframe-zoom-out-container-width': isZoomedOut && `${containerWidth}px`, + '--wp-block-editor-iframe-zoom-out-prev-container-width': isZoomedOut && `${prevContainerWidth.current}px` + }, + children: iframe + })] + }); } function IframeIfReady(props, ref) { const isInitialised = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings().__internalIsInitialized, []); @@ -40772,7 +44085,7 @@ function IframeIfReady(props, ref) { if (!isInitialised) { return null; } - return (0,external_React_.createElement)(Iframe, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Iframe, { ...props, forwardedRef: ref }); @@ -40826,7 +44139,7 @@ var postcss_urlrebase_default = /*#__PURE__*/__webpack_require__.n(postcss_urlre -const transformStylesCache = new WeakMap(); +const cacheByWrapperSelector = new Map(); function transformStyle({ css, ignoredSelectors = [], @@ -40839,12 +44152,13 @@ function transformStyle({ if (!wrapperSelector && !baseURL) { return css; } + const postcssFriendlyCSS = css.replace(/:root :where\(body\)/g, 'body').replace(/:where\(body\)/g, 'body'); try { return lib_postcss([wrapperSelector && build_default()(wrapperSelector, { ignoredSelectors: [...ignoredSelectors, wrapperSelector] }), baseURL && postcss_urlrebase_default()({ rootUrl: baseURL - })].filter(Boolean)).process(css, {}).css; // use sync PostCSS API + })].filter(Boolean)).process(postcssFriendlyCSS, {}).css; // use sync PostCSS API } catch (error) { if (error instanceof CssSyntaxError) { // eslint-disable-next-line no-console @@ -40870,19 +44184,23 @@ function transformStyle({ * @return {Array} converted rules. */ const transform_styles_transformStyles = (styles, wrapperSelector = '') => { + let cache = cacheByWrapperSelector.get(wrapperSelector); + if (!cache) { + cache = new WeakMap(); + cacheByWrapperSelector.set(wrapperSelector, cache); + } return styles.map(style => { - if (transformStylesCache.has(style)) { - return transformStylesCache.get(style); + let css = cache.get(style); + if (!css) { + css = transformStyle(style, wrapperSelector); + cache.set(style, css); } - const transformedStyle = transformStyle(style, wrapperSelector); - transformStylesCache.set(style, transformedStyle); - return transformedStyle; + return css; }); }; /* harmony default export */ const transform_styles = (transform_styles_transformStyles); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/editor-styles/index.js - /** * External dependencies */ @@ -40903,6 +44221,9 @@ const transform_styles_transformStyles = (styles, wrapperSelector = '') => { + + + k([names, a11y]); function useDarkThemeBodyClassName(styles, scope) { return (0,external_wp_element_namespaceObject.useCallback)(node => { @@ -40962,30 +44283,32 @@ function EditorStyles({ } return [transform_styles(_styles.filter(style => style?.css), scope), _styles.filter(style => style.__unstableType === 'svgs').map(style => style.assets).join('')]; }, [styles, overrides, scope]); - return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("style", { - ref: useDarkThemeBodyClassName(transformedStyles, scope) - }), transformedStyles.map((css, index) => (0,external_React_.createElement)("style", { - key: index - }, css)), (0,external_React_.createElement)(external_wp_components_namespaceObject.SVG, { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 0 0", - width: "0", - height: "0", - role: "none", - style: { - visibility: 'hidden', - position: 'absolute', - left: '-9999px', - overflow: 'hidden' - }, - dangerouslySetInnerHTML: { - __html: transformedSvgs - } - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("style", { + ref: useDarkThemeBodyClassName(transformedStyles, scope) + }), transformedStyles.map((css, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("style", { + children: css + }, index)), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 0 0", + width: "0", + height: "0", + role: "none", + style: { + visibility: 'hidden', + position: 'absolute', + left: '-9999px', + overflow: 'hidden' + }, + dangerouslySetInnerHTML: { + __html: transformedSvgs + } + })] + }); } +/* harmony default export */ const editor_styles = ((0,external_wp_element_namespaceObject.memo)(EditorStyles)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-preview/auto.js - /** * WordPress dependencies */ @@ -41003,6 +44326,9 @@ function EditorStyles({ // This is used to avoid rendering the block list if the sizes change. + + + let MemoizedBlockList; const MAX_HEIGHT = 2000; const EMPTY_ADDITIONAL_STYLES = []; @@ -41042,7 +44368,7 @@ function ScaledBlockPreview({ MemoizedBlockList = MemoizedBlockList || (0,external_wp_element_namespaceObject.memo)(BlockList); const scale = containerWidth / viewportWidth; const aspectRatio = contentHeight ? containerWidth / (contentHeight * scale) : 0; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Disabled, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Disabled, { className: "block-editor-block-preview__content", style: { transform: `scale(${scale})`, @@ -41053,61 +44379,66 @@ function ScaledBlockPreview({ aspectRatio, maxHeight: contentHeight > MAX_HEIGHT ? MAX_HEIGHT * scale : undefined, minHeight - } - }, (0,external_React_.createElement)(iframe, { - contentRef: (0,external_wp_compose_namespaceObject.useRefEffect)(bodyElement => { - const { - ownerDocument: { - documentElement - } - } = bodyElement; - documentElement.classList.add('block-editor-block-preview__content-iframe'); - documentElement.style.position = 'absolute'; - documentElement.style.width = '100%'; - - // Necessary for contentResizeListener to work. - bodyElement.style.boxSizing = 'border-box'; - bodyElement.style.position = 'absolute'; - bodyElement.style.width = '100%'; - }, []), - "aria-hidden": true, - tabIndex: -1, - style: { - position: 'absolute', - width: viewportWidth, - height: contentHeight, - pointerEvents: 'none', - // This is a catch-all max-height for patterns. - // See: https://github.com/WordPress/gutenberg/pull/38175. - maxHeight: MAX_HEIGHT, - minHeight: scale !== 0 && scale < 1 && minHeight ? minHeight / scale : minHeight - } - }, (0,external_React_.createElement)(EditorStyles, { - styles: editorStyles - }), contentResizeListener, (0,external_React_.createElement)(MemoizedBlockList, { - renderAppender: false - }))); + }, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(iframe, { + contentRef: (0,external_wp_compose_namespaceObject.useRefEffect)(bodyElement => { + const { + ownerDocument: { + documentElement + } + } = bodyElement; + documentElement.classList.add('block-editor-block-preview__content-iframe'); + documentElement.style.position = 'absolute'; + documentElement.style.width = '100%'; + + // Necessary for contentResizeListener to work. + bodyElement.style.boxSizing = 'border-box'; + bodyElement.style.position = 'absolute'; + bodyElement.style.width = '100%'; + }, []), + "aria-hidden": true, + tabIndex: -1, + style: { + position: 'absolute', + width: viewportWidth, + height: contentHeight, + pointerEvents: 'none', + // This is a catch-all max-height for patterns. + // See: https://github.com/WordPress/gutenberg/pull/38175. + maxHeight: MAX_HEIGHT, + minHeight: scale !== 0 && scale < 1 && minHeight ? minHeight / scale : minHeight + }, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_styles, { + styles: editorStyles + }), contentResizeListener, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MemoizedBlockList, { + renderAppender: false + })] + }) + }); } function AutoBlockPreview(props) { const [containerResizeListener, { width: containerWidth }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); - return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("div", { - style: { - position: 'relative', - width: '100%', - height: 0 - } - }, containerResizeListener), (0,external_React_.createElement)("div", { - className: "block-editor-block-preview__container" - }, !!containerWidth && (0,external_React_.createElement)(ScaledBlockPreview, { - ...props, - containerWidth: containerWidth - }))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + style: { + position: 'relative', + width: '100%', + height: 0 + }, + children: containerResizeListener + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-block-preview__container", + children: !!containerWidth && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScaledBlockPreview, { + ...props, + containerWidth: containerWidth + }) + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-preview/index.js - /** * External dependencies */ @@ -41129,11 +44460,14 @@ function AutoBlockPreview(props) { + + +const block_preview_EMPTY_ADDITIONAL_STYLES = []; function BlockPreview({ blocks, viewportWidth = 1200, minHeight, - additionalStyles = [], + additionalStyles = block_preview_EMPTY_ADDITIONAL_STYLES, // Deprecated props: __experimentalMinHeight, __experimentalPadding @@ -41167,14 +44501,15 @@ function BlockPreview({ if (!blocks || blocks.length === 0) { return null; } - return (0,external_React_.createElement)(ExperimentalBlockEditorProvider, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ExperimentalBlockEditorProvider, { value: renderedBlocks, - settings: settings - }, (0,external_React_.createElement)(AutoBlockPreview, { - viewportWidth: viewportWidth, - minHeight: minHeight, - additionalStyles: additionalStyles - })); + settings: settings, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AutoBlockPreview, { + viewportWidth: viewportWidth, + minHeight: minHeight, + additionalStyles: additionalStyles + }) + }); } /** @@ -41222,23 +44557,23 @@ function useBlockPreview({ const disabledRef = (0,external_wp_compose_namespaceObject.useDisabled)(); const ref = (0,external_wp_compose_namespaceObject.useMergeRefs)([props.ref, disabledRef]); const renderedBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => Array.isArray(blocks) ? blocks : [blocks], [blocks]); - const children = (0,external_React_.createElement)(ExperimentalBlockEditorProvider, { + const children = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ExperimentalBlockEditorProvider, { value: renderedBlocks, - settings: settings - }, (0,external_React_.createElement)(EditorStyles, null), (0,external_React_.createElement)(BlockListItems, { - renderAppender: false, - layout: layout - })); + settings: settings, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_styles, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockListItems, { + renderAppender: false, + layout: layout + })] + }); return { ...props, ref, - className: classnames_default()(props.className, 'block-editor-block-preview__live-content', 'components-disabled'), + className: dist_clsx(props.className, 'block-editor-block-preview__live-content', 'components-disabled'), children: blocks?.length ? children : null }; } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/preview-panel.js - /** * WordPress dependencies */ @@ -41251,6 +44586,8 @@ function useBlockPreview({ */ + + function InserterPreviewPanel({ item }) { @@ -41276,30 +44613,33 @@ function InserterPreviewPanel({ innerBlocks: example.innerBlocks }); }, [name, example, initialAttributes]); - return (0,external_React_.createElement)("div", { - className: "block-editor-inserter__preview-container" - }, (0,external_React_.createElement)("div", { - className: "block-editor-inserter__preview" - }, isReusable || example ? (0,external_React_.createElement)("div", { - className: "block-editor-inserter__preview-content" - }, (0,external_React_.createElement)(block_preview, { - blocks: blocks, - viewportWidth: (_example$viewportWidt = example?.viewportWidth) !== null && _example$viewportWidt !== void 0 ? _example$viewportWidt : 500, - additionalStyles: [{ - css: 'body { padding: 24px; }' - }] - })) : (0,external_React_.createElement)("div", { - className: "block-editor-inserter__preview-content-missing" - }, (0,external_wp_i18n_namespaceObject.__)('No preview available.'))), !isReusable && (0,external_React_.createElement)(block_card, { - title: title, - icon: icon, - description: description - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-inserter__preview-container", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-inserter__preview", + children: isReusable || example ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-inserter__preview-content", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_preview, { + blocks: blocks, + viewportWidth: (_example$viewportWidt = example?.viewportWidth) !== null && _example$viewportWidt !== void 0 ? _example$viewportWidt : 500, + additionalStyles: [{ + css: 'body { padding: 24px; }' + }] + }) + }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-inserter__preview-content-missing", + children: (0,external_wp_i18n_namespaceObject.__)('No preview available.') + }) + }), !isReusable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_card, { + title: title, + icon: icon, + description: description + })] + }); } /* harmony default export */ const preview_panel = (InserterPreviewPanel); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/item.js - /** * WordPress dependencies */ @@ -41310,8 +44650,9 @@ function InserterPreviewPanel({ * Internal dependencies */ + const { - CompositeItemV2: CompositeItem + CompositeItemV2: item_CompositeItem } = unlock(external_wp_components_namespaceObject.privateApis); function InserterListboxItem({ isFirst, @@ -41319,7 +44660,7 @@ function InserterListboxItem({ children, ...props }, ref) { - return (0,external_React_.createElement)(CompositeItem, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(item_CompositeItem, { ref: ref, role: "option" // Use the CompositeItem `accessibleWhenDisabled` prop @@ -41334,39 +44675,41 @@ function InserterListboxItem({ tabIndex: isFirst ? 0 : htmlProps.tabIndex }; if (Component) { - return (0,external_React_.createElement)(Component, { - ...propsWithTabIndex - }, children); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { + ...propsWithTabIndex, + children: children + }); } if (typeof children === 'function') { return children(propsWithTabIndex); } - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - ...propsWithTabIndex - }, children); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + ...propsWithTabIndex, + children: children + }); } }); } /* harmony default export */ const inserter_listbox_item = ((0,external_wp_element_namespaceObject.forwardRef)(InserterListboxItem)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/drag-handle.js - /** * WordPress dependencies */ -const dragHandle = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const dragHandle = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { width: "24", height: "24", xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M8 7h2V5H8v2zm0 6h2v-2H8v2zm0 6h2v-2H8v2zm6-14v2h2V5h-2zm0 8h2v-2h-2v2zm0 6h2v-2h-2v2z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M8 7h2V5H8v2zm0 6h2v-2H8v2zm0 6h2v-2H8v2zm6-14v2h2V5h-2zm0 8h2v-2h-2v2zm0 6h2v-2h-2v2z" + }) +}); /* harmony default export */ const drag_handle = (dragHandle); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-draggable/draggable-chip.js - /** * WordPress dependencies */ @@ -41378,6 +44721,8 @@ const dragHandle = (0,external_React_.createElement)(external_wp_primitives_name * Internal dependencies */ + + function BlockDraggableChip({ count, icon, @@ -41385,28 +44730,35 @@ function BlockDraggableChip({ fadeWhenDisabled }) { const patternLabel = isPattern && (0,external_wp_i18n_namespaceObject.__)('Pattern'); - return (0,external_React_.createElement)("div", { - className: "block-editor-block-draggable-chip-wrapper" - }, (0,external_React_.createElement)("div", { - className: "block-editor-block-draggable-chip", - "data-testid": "block-draggable-chip" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, { - justify: "center", - className: "block-editor-block-draggable-chip__content" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, icon ? (0,external_React_.createElement)(block_icon, { - icon: icon - }) : patternLabel || (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: Number of blocks. */ - (0,external_wp_i18n_namespaceObject._n)('%d block', '%d blocks', count), count)), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)(block_icon, { - icon: drag_handle - })), fadeWhenDisabled && (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, { - className: "block-editor-block-draggable-chip__disabled" - }, (0,external_React_.createElement)("span", { - className: "block-editor-block-draggable-chip__disabled-icon" - }))))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-block-draggable-chip-wrapper", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-block-draggable-chip", + "data-testid": "block-draggable-chip", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { + justify: "center", + className: "block-editor-block-draggable-chip__content", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { + children: icon ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { + icon: icon + }) : patternLabel || (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: Number of blocks. */ + (0,external_wp_i18n_namespaceObject._n)('%d block', '%d blocks', count), count) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { + icon: drag_handle + }) + }), fadeWhenDisabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { + className: "block-editor-block-draggable-chip__disabled", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + className: "block-editor-block-draggable-chip__disabled-icon" + }) + })] + }) + }) + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-draggable-blocks/index.js - /** * WordPress dependencies */ @@ -41421,6 +44773,7 @@ function BlockDraggableChip({ + const InserterDraggableBlocks = ({ isEnabled, blocks, @@ -41442,7 +44795,7 @@ const InserterDraggableBlocks = ({ startDragging, stopDragging } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Draggable, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Draggable, { __experimentalTransferDataType: "wp-blocks", transferData: transferData, onDragStart: event => { @@ -41455,26 +44808,26 @@ const InserterDraggableBlocks = ({ onDragEnd: () => { stopDragging(); }, - __experimentalDragComponent: (0,external_React_.createElement)(BlockDraggableChip, { + __experimentalDragComponent: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockDraggableChip, { count: blocks.length, icon: icon || !pattern && blockTypeIcon, isPattern: !!pattern - }) - }, ({ - onDraggableStart, - onDraggableEnd - }) => { - return children({ - draggable: isEnabled, - onDragStart: isEnabled ? onDraggableStart : undefined, - onDragEnd: isEnabled ? onDraggableEnd : undefined - }); + }), + children: ({ + onDraggableStart, + onDraggableEnd + }) => { + return children({ + draggable: isEnabled, + onDragStart: isEnabled ? onDraggableStart : undefined, + onDragEnd: isEnabled ? onDraggableEnd : undefined + }); + } }); }; /* harmony default export */ const inserter_draggable_blocks = (InserterDraggableBlocks); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-list-item/index.js - /** * External dependencies */ @@ -41494,6 +44847,8 @@ const InserterDraggableBlocks = ({ + + function InserterListItem({ className, isFirst, @@ -41510,81 +44865,87 @@ function InserterListItem({ } : {}; const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => [(0,external_wp_blocks_namespaceObject.createBlock)(item.name, item.initialAttributes, (0,external_wp_blocks_namespaceObject.createBlocksFromInnerBlocksTemplate)(item.innerBlocks))], [item.name, item.initialAttributes, item.innerBlocks]); const isSynced = (0,external_wp_blocks_namespaceObject.isReusableBlock)(item) && item.syncStatus !== 'unsynced' || (0,external_wp_blocks_namespaceObject.isTemplatePart)(item); - return (0,external_React_.createElement)(inserter_draggable_blocks, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_draggable_blocks, { isEnabled: isDraggable && !item.isDisabled, blocks: blocks, - icon: item.icon - }, ({ - draggable, - onDragStart, - onDragEnd - }) => (0,external_React_.createElement)("div", { - className: classnames_default()('block-editor-block-types-list__list-item', { - 'is-synced': isSynced - }), - draggable: draggable, - onDragStart: event => { - isDragging.current = true; - if (onDragStart) { - onHover(null); - onDragStart(event); - } - }, - onDragEnd: event => { - isDragging.current = false; - if (onDragEnd) { - onDragEnd(event); - } - } - }, (0,external_React_.createElement)(inserter_listbox_item, { - isFirst: isFirst, - className: classnames_default()('block-editor-block-types-list__item', className), - disabled: item.isDisabled, - onClick: event => { - event.preventDefault(); - onSelect(item, (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? event.metaKey : event.ctrlKey); - onHover(null); - }, - onKeyDown: event => { - const { - keyCode - } = event; - if (keyCode === external_wp_keycodes_namespaceObject.ENTER) { - event.preventDefault(); - onSelect(item, (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? event.metaKey : event.ctrlKey); - onHover(null); - } - }, - onMouseEnter: () => { - if (isDragging.current) { - return; - } - onHover(item); - }, - onMouseLeave: () => onHover(null), - ...props - }, (0,external_React_.createElement)("span", { - className: "block-editor-block-types-list__item-icon", - style: itemIconStyle - }, (0,external_React_.createElement)(block_icon, { icon: item.icon, - showColors: true - })), (0,external_React_.createElement)("span", { - className: "block-editor-block-types-list__item-title" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, { - numberOfLines: 3 - }, item.title))))); + children: ({ + draggable, + onDragStart, + onDragEnd + }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: dist_clsx('block-editor-block-types-list__list-item', { + 'is-synced': isSynced + }), + draggable: draggable, + onDragStart: event => { + isDragging.current = true; + if (onDragStart) { + onHover(null); + onDragStart(event); + } + }, + onDragEnd: event => { + isDragging.current = false; + if (onDragEnd) { + onDragEnd(event); + } + }, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(inserter_listbox_item, { + isFirst: isFirst, + className: dist_clsx('block-editor-block-types-list__item', className), + disabled: item.isDisabled, + onClick: event => { + event.preventDefault(); + onSelect(item, (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? event.metaKey : event.ctrlKey); + onHover(null); + }, + onKeyDown: event => { + const { + keyCode + } = event; + if (keyCode === external_wp_keycodes_namespaceObject.ENTER) { + event.preventDefault(); + onSelect(item, (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? event.metaKey : event.ctrlKey); + onHover(null); + } + }, + onMouseEnter: () => { + if (isDragging.current) { + return; + } + onHover(item); + }, + onMouseLeave: () => onHover(null), + ...props, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + className: "block-editor-block-types-list__item-icon", + style: itemIconStyle, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { + icon: item.icon, + showColors: true + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + className: "block-editor-block-types-list__item-title", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { + numberOfLines: 3, + children: item.title + }) + })] + }) + }) + }); } /* harmony default export */ const inserter_list_item = ((0,external_wp_element_namespaceObject.memo)(InserterListItem)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/group.js - /** * WordPress dependencies */ + function InserterListboxGroup(props, ref) { const [shouldSpeak, setShouldSpeak] = (0,external_wp_element_namespaceObject.useState)(false); (0,external_wp_element_namespaceObject.useEffect)(() => { @@ -41592,7 +44953,7 @@ function InserterListboxGroup(props, ref) { (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Use left and right arrow keys to move through blocks')); } }, [shouldSpeak]); - return (0,external_React_.createElement)("div", { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: ref, role: "listbox", "aria-orientation": "horizontal", @@ -41611,7 +44972,6 @@ function InserterListboxGroup(props, ref) { /* harmony default export */ const group = ((0,external_wp_element_namespaceObject.forwardRef)(InserterListboxGroup)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/row.js - /** * WordPress dependencies */ @@ -41622,11 +44982,12 @@ function InserterListboxGroup(props, ref) { * Internal dependencies */ + const { CompositeGroupV2: CompositeGroup } = unlock(external_wp_components_namespaceObject.privateApis); function InserterListboxRow(props, ref) { - return (0,external_React_.createElement)(CompositeGroup, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CompositeGroup, { role: "presentation", ref: ref, ...props @@ -41635,7 +44996,6 @@ function InserterListboxRow(props, ref) { /* harmony default export */ const inserter_listbox_row = ((0,external_wp_element_namespaceObject.forwardRef)(InserterListboxRow)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-types-list/index.js - /** * WordPress dependencies */ @@ -41647,6 +45007,8 @@ function InserterListboxRow(props, ref) { */ + + function chunk(array, size) { const chunks = []; for (let i = 0, j = array.length; i < j; i += size) { @@ -41664,49 +45026,55 @@ function BlockTypesList({ }) { const className = 'block-editor-block-types-list'; const listId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockTypesList, className); - return (0,external_React_.createElement)(group, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(group, { className: className, - "aria-label": label - }, chunk(items, 3).map((row, i) => (0,external_React_.createElement)(inserter_listbox_row, { - key: i - }, row.map((item, j) => (0,external_React_.createElement)(inserter_list_item, { - key: item.id, - item: item, - className: (0,external_wp_blocks_namespaceObject.getBlockMenuDefaultClassName)(item.id), - onSelect: onSelect, - onHover: onHover, - isDraggable: isDraggable && !item.isDisabled, - isFirst: i === 0 && j === 0, - rowId: `${listId}-${i}` - })))), children); + "aria-label": label, + children: [chunk(items, 3).map((row, i) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_listbox_row, { + children: row.map((item, j) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_list_item, { + item: item, + className: (0,external_wp_blocks_namespaceObject.getBlockMenuDefaultClassName)(item.id), + onSelect: onSelect, + onHover: onHover, + isDraggable: isDraggable && !item.isDisabled, + isFirst: i === 0 && j === 0, + rowId: `${listId}-${i}` + }, item.id)) + }, i)), children] + }); } /* harmony default export */ const block_types_list = (BlockTypesList); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/panel.js - /** * WordPress dependencies */ + + + function InserterPanel({ title, icon, children }) { - return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("div", { - className: "block-editor-inserter__panel-header" - }, (0,external_React_.createElement)("h2", { - className: "block-editor-inserter__panel-title" - }, title), (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, { - icon: icon - })), (0,external_React_.createElement)("div", { - className: "block-editor-inserter__panel-content" - }, children)); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-inserter__panel-header", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { + className: "block-editor-inserter__panel-title", + children: title + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { + icon: icon + })] + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-inserter__panel-content", + children: children + })] + }); } /* harmony default export */ const panel = (InserterPanel); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/index.js - /** * WordPress dependencies */ @@ -41719,26 +45087,49 @@ function InserterPanel({ + + const { - CompositeV2: Composite, - useCompositeStoreV2: useCompositeStore + CompositeV2: inserter_listbox_Composite, + useCompositeStoreV2: inserter_listbox_useCompositeStore } = unlock(external_wp_components_namespaceObject.privateApis); function InserterListbox({ children }) { - const store = useCompositeStore({ + const store = inserter_listbox_useCompositeStore({ focusShift: true, focusWrap: 'horizontal' }); - return (0,external_React_.createElement)(Composite, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_listbox_Composite, { store: store, - render: (0,external_React_.createElement)(external_React_.Fragment, null) - }, children); + render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, {}), + children: children + }); } /* harmony default export */ const inserter_listbox = (InserterListbox); -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-types-tab.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/no-results.js +/** + * WordPress dependencies + */ + + + + +function InserterNoResults() { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-inserter__no-results", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { + className: "block-editor-inserter__no-results-icon", + icon: block_default + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { + children: (0,external_wp_i18n_namespaceObject.__)('No results found.') + })] + }); +} +/* harmony default export */ const no_results = (InserterNoResults); +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-types-tab.js /** * WordPress dependencies */ @@ -41754,6 +45145,10 @@ function InserterListbox({ + + + + const getBlockNamespace = item => item.name.split('/')[0]; const MAX_SUGGESTED_ITEMS = 6; @@ -41764,31 +45159,21 @@ const MAX_SUGGESTED_ITEMS = 6; * @type {Array} */ const block_types_tab_EMPTY_ARRAY = []; -function BlockTypesTab({ - rootClientId, - onInsert, +function BlockTypesTabPanel({ + items, + collections, + categories, + onSelectItem, onHover, - showMostUsedBlocks + showMostUsedBlocks, + className }) { - const [items, categories, collections, onSelectItem] = use_block_types_state(rootClientId, onInsert); const suggestedItems = (0,external_wp_element_namespaceObject.useMemo)(() => { return orderBy(items, 'frecency', 'desc').slice(0, MAX_SUGGESTED_ITEMS); }, [items]); const uncategorizedItems = (0,external_wp_element_namespaceObject.useMemo)(() => { return items.filter(item => !item.category); }, [items]); - const itemsPerCategory = (0,external_wp_element_namespaceObject.useMemo)(() => { - return (0,external_wp_compose_namespaceObject.pipe)(itemList => itemList.filter(item => item.category && item.category !== 'reusable'), itemList => itemList.reduce((acc, item) => { - const { - category - } = item; - if (!acc[category]) { - acc[category] = []; - } - acc[category].push(item); - return acc; - }, {}))(items); - }, [items]); const itemsPerCollection = (0,external_wp_element_namespaceObject.useMemo)(() => { // Create a new Object to avoid mutating collection. const result = { @@ -41820,99 +45205,158 @@ function BlockTypesTab({ return Object.entries(collections); }, [collections]); const currentlyRenderedCollections = (0,external_wp_compose_namespaceObject.useAsyncList)(didRenderAllCategories ? collectionEntries : block_types_tab_EMPTY_ARRAY); - return (0,external_React_.createElement)(inserter_listbox, null, (0,external_React_.createElement)("div", null, showMostUsedBlocks && !!suggestedItems.length && (0,external_React_.createElement)(panel, { - title: (0,external_wp_i18n_namespaceObject._x)('Most used', 'blocks') - }, (0,external_React_.createElement)(block_types_list, { - items: suggestedItems, - onSelect: onSelectItem, - onHover: onHover, - label: (0,external_wp_i18n_namespaceObject._x)('Most used', 'blocks') - })), currentlyRenderedCategories.map(category => { - const categoryItems = itemsPerCategory[category.slug]; - if (!categoryItems || !categoryItems.length) { - return null; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: className, + children: [showMostUsedBlocks && + // Only show the most used blocks if the total amount of block + // is larger than 1 row, otherwise it is not so useful. + items.length > 3 && !!suggestedItems.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(panel, { + title: (0,external_wp_i18n_namespaceObject._x)('Most used', 'blocks'), + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_types_list, { + items: suggestedItems, + onSelect: onSelectItem, + onHover: onHover, + label: (0,external_wp_i18n_namespaceObject._x)('Most used', 'blocks') + }) + }), currentlyRenderedCategories.map(category => { + const categoryItems = items.filter(item => item.category === category.slug); + if (!categoryItems || !categoryItems.length) { + return null; + } + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(panel, { + title: category.title, + icon: category.icon, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_types_list, { + items: categoryItems, + onSelect: onSelectItem, + onHover: onHover, + label: category.title + }) + }, category.slug); + }), didRenderAllCategories && uncategorizedItems.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(panel, { + className: "block-editor-inserter__uncategorized-blocks-panel", + title: (0,external_wp_i18n_namespaceObject.__)('Uncategorized'), + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_types_list, { + items: uncategorizedItems, + onSelect: onSelectItem, + onHover: onHover, + label: (0,external_wp_i18n_namespaceObject.__)('Uncategorized') + }) + }), currentlyRenderedCollections.map(([namespace, collection]) => { + const collectionItems = itemsPerCollection[namespace]; + if (!collectionItems || !collectionItems.length) { + return null; + } + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(panel, { + title: collection.title, + icon: collection.icon, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_types_list, { + items: collectionItems, + onSelect: onSelectItem, + onHover: onHover, + label: collection.title + }) + }, namespace); + })] + }); +} +function BlockTypesTab({ + rootClientId, + onInsert, + onHover, + showMostUsedBlocks +}, ref) { + const [items, categories, collections, onSelectItem] = use_block_types_state(rootClientId, onInsert); + if (!items.length) { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results, {}); + } + const itemsForCurrentRoot = []; + const itemsRemaining = []; + for (const item of items) { + // Skip reusable blocks, they moved to the patterns tab. + if (item.category === 'reusable') { + continue; } - return (0,external_React_.createElement)(panel, { - key: category.slug, - title: category.title, - icon: category.icon - }, (0,external_React_.createElement)(block_types_list, { - items: categoryItems, - onSelect: onSelectItem, - onHover: onHover, - label: category.title - })); - }), didRenderAllCategories && uncategorizedItems.length > 0 && (0,external_React_.createElement)(panel, { - className: "block-editor-inserter__uncategorized-blocks-panel", - title: (0,external_wp_i18n_namespaceObject.__)('Uncategorized') - }, (0,external_React_.createElement)(block_types_list, { - items: uncategorizedItems, - onSelect: onSelectItem, - onHover: onHover, - label: (0,external_wp_i18n_namespaceObject.__)('Uncategorized') - })), currentlyRenderedCollections.map(([namespace, collection]) => { - const collectionItems = itemsPerCollection[namespace]; - if (!collectionItems || !collectionItems.length) { - return null; + if (rootClientId && item.rootClientId === rootClientId) { + itemsForCurrentRoot.push(item); + } else { + itemsRemaining.push(item); } - return (0,external_React_.createElement)(panel, { - key: namespace, - title: collection.title, - icon: collection.icon - }, (0,external_React_.createElement)(block_types_list, { - items: collectionItems, - onSelect: onSelectItem, - onHover: onHover, - label: collection.title - })); - }))); + } + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_listbox, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + ref: ref, + children: [!!itemsForCurrentRoot.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockTypesTabPanel, { + items: itemsForCurrentRoot, + categories: categories, + collections: collections, + onSelectItem: onSelectItem, + onHover: onHover, + showMostUsedBlocks: showMostUsedBlocks, + className: "block-editor-inserter__insertable-blocks-at-selection" + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockTypesTabPanel, { + items: itemsRemaining, + categories: categories, + collections: collections, + onSelectItem: onSelectItem, + onHover: onHover, + showMostUsedBlocks: showMostUsedBlocks, + className: "block-editor-inserter__all-blocks" + })] + }) + }); } -/* harmony default export */ const block_types_tab = (BlockTypesTab); +/* harmony default export */ const block_types_tab = ((0,external_wp_element_namespaceObject.forwardRef)(BlockTypesTab)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js - /** * WordPress dependencies */ + + function PatternCategoriesList({ selectedCategory, patternCategories, onClickCategory }) { const baseClassName = 'block-editor-block-patterns-explorer__sidebar'; - return (0,external_React_.createElement)("div", { - className: `${baseClassName}__categories-list` - }, patternCategories.map(({ - name, - label - }) => { - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - key: name, - label: label, - className: `${baseClassName}__categories-list__item`, - isPressed: selectedCategory === name, - onClick: () => { - onClickCategory(name); - } - }, label); - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: `${baseClassName}__categories-list`, + children: patternCategories.map(({ + name, + label + }) => { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + label: label, + className: `${baseClassName}__categories-list__item`, + isPressed: selectedCategory === name, + onClick: () => { + onClickCategory(name); + }, + children: label + }, name); + }) + }); } function PatternsExplorerSearch({ searchValue, setSearchValue }) { const baseClassName = 'block-editor-block-patterns-explorer__search'; - return (0,external_React_.createElement)("div", { - className: baseClassName - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.SearchControl, { - __nextHasNoMarginBottom: true, - onChange: setSearchValue, - value: searchValue, - label: (0,external_wp_i18n_namespaceObject.__)('Search for patterns'), - placeholder: (0,external_wp_i18n_namespaceObject.__)('Search') - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: baseClassName, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { + __nextHasNoMarginBottom: true, + onChange: setSearchValue, + value: searchValue, + label: (0,external_wp_i18n_namespaceObject.__)('Search for patterns'), + placeholder: (0,external_wp_i18n_namespaceObject.__)('Search') + }) + }); } function PatternExplorerSidebar({ selectedCategory, @@ -41922,87 +45366,106 @@ function PatternExplorerSidebar({ setSearchValue }) { const baseClassName = 'block-editor-block-patterns-explorer__sidebar'; - return (0,external_React_.createElement)("div", { - className: baseClassName - }, (0,external_React_.createElement)(PatternsExplorerSearch, { - searchValue: searchValue, - setSearchValue: setSearchValue - }), !searchValue && (0,external_React_.createElement)(PatternCategoriesList, { - selectedCategory: selectedCategory, - patternCategories: patternCategories, - onClickCategory: onClickCategory - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: baseClassName, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternsExplorerSearch, { + searchValue: searchValue, + setSearchValue: setSearchValue + }), !searchValue && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternCategoriesList, { + selectedCategory: selectedCategory, + patternCategories: patternCategories, + onClickCategory: onClickCategory + })] + }); } /* harmony default export */ const pattern_explorer_sidebar = (PatternExplorerSidebar); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-patterns-paging/index.js - /** * WordPress dependencies */ + + function Pagination({ currentPage, numPages, changePage, totalItems }) { - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { - className: "block-editor-patterns__grid-pagination-wrapper" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, { - variant: "muted" - }, - // translators: %s: Total number of patterns. - (0,external_wp_i18n_namespaceObject.sprintf)( - // translators: %s: Total number of patterns. - (0,external_wp_i18n_namespaceObject._n)('%s item', '%s items', totalItems), totalItems)), numPages > 1 && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { - expanded: false, - spacing: 3, - justify: "flex-start", - className: "block-editor-patterns__grid-pagination" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { - expanded: false, - spacing: 1, - className: "block-editor-patterns__grid-pagination-previous" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - variant: "tertiary", - onClick: () => changePage(1), - disabled: currentPage === 1, - "aria-label": (0,external_wp_i18n_namespaceObject.__)('First page'), - __experimentalIsFocusable: true - }, (0,external_React_.createElement)("span", null, "\xAB")), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - variant: "tertiary", - onClick: () => changePage(currentPage - 1), - disabled: currentPage === 1, - "aria-label": (0,external_wp_i18n_namespaceObject.__)('Previous page'), - __experimentalIsFocusable: true - }, (0,external_React_.createElement)("span", null, "\u2039"))), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, { - variant: "muted" - }, (0,external_wp_i18n_namespaceObject.sprintf)( - // translators: %1$s: Current page number, %2$s: Total number of pages. - (0,external_wp_i18n_namespaceObject._x)('%1$s of %2$s', 'paging'), currentPage, numPages)), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { - expanded: false, - spacing: 1, - className: "block-editor-patterns__grid-pagination-next" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - variant: "tertiary", - onClick: () => changePage(currentPage + 1), - disabled: currentPage === numPages, - "aria-label": (0,external_wp_i18n_namespaceObject.__)('Next page'), - __experimentalIsFocusable: true - }, (0,external_React_.createElement)("span", null, "\u203A")), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - variant: "tertiary", - onClick: () => changePage(numPages), - disabled: currentPage === numPages, - "aria-label": (0,external_wp_i18n_namespaceObject.__)('Last page'), - size: "default", - __experimentalIsFocusable: true - }, (0,external_React_.createElement)("span", null, "\xBB"))))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { + className: "block-editor-patterns__grid-pagination-wrapper", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { + variant: "muted", + children: + // translators: %s: Total number of patterns. + (0,external_wp_i18n_namespaceObject.sprintf)( + // translators: %s: Total number of patterns. + (0,external_wp_i18n_namespaceObject._n)('%s item', '%s items', totalItems), totalItems) + }), numPages > 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { + expanded: false, + spacing: 3, + justify: "flex-start", + className: "block-editor-patterns__grid-pagination", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { + expanded: false, + spacing: 1, + className: "block-editor-patterns__grid-pagination-previous", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + variant: "tertiary", + onClick: () => changePage(1), + disabled: currentPage === 1, + "aria-label": (0,external_wp_i18n_namespaceObject.__)('First page'), + __experimentalIsFocusable: true, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + children: "\xAB" + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + variant: "tertiary", + onClick: () => changePage(currentPage - 1), + disabled: currentPage === 1, + "aria-label": (0,external_wp_i18n_namespaceObject.__)('Previous page'), + __experimentalIsFocusable: true, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + children: "\u2039" + }) + })] + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { + variant: "muted", + children: (0,external_wp_i18n_namespaceObject.sprintf)( + // translators: %1$s: Current page number, %2$s: Total number of pages. + (0,external_wp_i18n_namespaceObject._x)('%1$s of %2$s', 'paging'), currentPage, numPages) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { + expanded: false, + spacing: 1, + className: "block-editor-patterns__grid-pagination-next", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + variant: "tertiary", + onClick: () => changePage(currentPage + 1), + disabled: currentPage === numPages, + "aria-label": (0,external_wp_i18n_namespaceObject.__)('Next page'), + __experimentalIsFocusable: true, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + children: "\u203A" + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + variant: "tertiary", + onClick: () => changePage(numPages), + disabled: currentPage === numPages, + "aria-label": (0,external_wp_i18n_namespaceObject.__)('Last page'), + size: "default", + __experimentalIsFocusable: true, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + children: "\xBB" + }) + })] + })] + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-patterns-list/index.js - /** * External dependencies */ @@ -42017,6 +45480,7 @@ function Pagination({ + /** * Internal dependencies */ @@ -42025,6 +45489,9 @@ function Pagination({ + + + const { CompositeV2: block_patterns_list_Composite, CompositeItemV2: block_patterns_list_CompositeItem, @@ -42036,11 +45503,14 @@ const WithToolTip = ({ children }) => { if (showTooltip) { - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Tooltip, { - text: title - }, children); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { + text: title, + children: children + }); } - return (0,external_React_.createElement)(external_React_.Fragment, null, children); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: children + }); }; function BlockPattern({ id, @@ -42048,7 +45518,9 @@ function BlockPattern({ pattern, onClick, onHover, - showTooltip + showTitle = true, + showTooltip, + category }) { const [isDragging, setIsDragging] = (0,external_wp_element_namespaceObject.useState)(false); const { @@ -42057,72 +45529,98 @@ function BlockPattern({ } = pattern; const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockPattern); const descriptionId = `block-editor-block-patterns-list__item-description-${instanceId}`; - return (0,external_React_.createElement)(inserter_draggable_blocks, { - isEnabled: isDraggable, - blocks: blocks, - pattern: pattern - }, ({ - draggable, - onDragStart, - onDragEnd - }) => (0,external_React_.createElement)("div", { - className: "block-editor-block-patterns-list__list-item", - draggable: draggable, - onDragStart: event => { - setIsDragging(true); - if (onDragStart) { - onHover?.(null); - onDragStart(event); - } - }, - onDragEnd: event => { - setIsDragging(false); - if (onDragEnd) { - onDragEnd(event); - } + + // When we have a selected category and the pattern is draggable, we need to update the + // pattern's categories in metadata to only contain the selected category, and pass this to + // InserterDraggableBlocks component. We do that because we use this information for pattern + // shuffling and it makes more sense to show only the ones from the initially selected category during insertion. + const patternBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => { + if (!category || !isDraggable) { + return blocks; } - }, (0,external_React_.createElement)(WithToolTip, { - showTooltip: showTooltip && !pattern.type !== INSERTER_PATTERN_TYPES.user, - title: pattern.title - }, (0,external_React_.createElement)(block_patterns_list_CompositeItem, { - render: (0,external_React_.createElement)("div", { - role: "option", - "aria-label": pattern.title, - "aria-describedby": pattern.description ? descriptionId : undefined, - className: classnames_default()('block-editor-block-patterns-list__item', { - 'block-editor-block-patterns-list__list-item-synced': pattern.type === INSERTER_PATTERN_TYPES.user && !pattern.syncStatus - }) - }), - id: id, - onClick: () => { - onClick(pattern, blocks); - onHover?.(null); - }, - onMouseEnter: () => { - if (isDragging) { - return; + return (blocks !== null && blocks !== void 0 ? blocks : []).map(block => { + const clonedBlock = (0,external_wp_blocks_namespaceObject.cloneBlock)(block); + if (clonedBlock.attributes.metadata?.categories?.includes(category)) { + clonedBlock.attributes.metadata.categories = [category]; } - onHover?.(pattern); - }, - onMouseLeave: () => onHover?.(null) - }, (0,external_React_.createElement)(block_preview, { - blocks: blocks, - viewportWidth: viewportWidth - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { - className: "block-editor-patterns__pattern-details" - }, pattern.type === INSERTER_PATTERN_TYPES.user && !pattern.syncStatus && (0,external_React_.createElement)("div", { - className: "block-editor-patterns__pattern-icon-wrapper" - }, (0,external_React_.createElement)(build_module_icon, { - className: "block-editor-patterns__pattern-icon", - icon: library_symbol - })), (!showTooltip || pattern.type === INSERTER_PATTERN_TYPES.user) && (0,external_React_.createElement)("div", { - className: "block-editor-block-patterns-list__item-title" - }, pattern.title)), !!pattern.description && (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { - id: descriptionId - }, pattern.description))))); + return clonedBlock; + }); + }, [blocks, isDraggable, category]); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_draggable_blocks, { + isEnabled: isDraggable, + blocks: patternBlocks, + pattern: pattern, + children: ({ + draggable, + onDragStart, + onDragEnd + }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-block-patterns-list__list-item", + draggable: draggable, + onDragStart: event => { + setIsDragging(true); + if (onDragStart) { + onHover?.(null); + onDragStart(event); + } + }, + onDragEnd: event => { + setIsDragging(false); + if (onDragEnd) { + onDragEnd(event); + } + }, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WithToolTip, { + showTooltip: showTooltip && !pattern.type !== INSERTER_PATTERN_TYPES.user, + title: pattern.title, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(block_patterns_list_CompositeItem, { + render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + role: "option", + "aria-label": pattern.title, + "aria-describedby": pattern.description ? descriptionId : undefined, + className: dist_clsx('block-editor-block-patterns-list__item', { + 'block-editor-block-patterns-list__list-item-synced': pattern.type === INSERTER_PATTERN_TYPES.user && !pattern.syncStatus + }) + }), + id: id, + onClick: () => { + onClick(pattern, blocks); + onHover?.(null); + }, + onMouseEnter: () => { + if (isDragging) { + return; + } + onHover?.(pattern); + }, + onMouseLeave: () => onHover?.(null), + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_preview, { + blocks: blocks, + viewportWidth: viewportWidth + }), showTitle && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { + className: "block-editor-patterns__pattern-details", + spacing: 2, + children: [pattern.type === INSERTER_PATTERN_TYPES.user && !pattern.syncStatus && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-patterns__pattern-icon-wrapper", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { + className: "block-editor-patterns__pattern-icon", + icon: library_symbol + }) + }), (!showTooltip || pattern.type === INSERTER_PATTERN_TYPES.user) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-block-patterns-list__item-title", + children: pattern.title + })] + }), !!pattern.description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { + id: descriptionId, + children: pattern.description + })] + }) + }) + }) + }); } function BlockPatternPlaceholder() { - return (0,external_React_.createElement)("div", { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-patterns-list__item is-placeholder" }); } @@ -42134,6 +45632,8 @@ function BlockPatternsList({ onClickPattern, orientation, label = (0,external_wp_i18n_namespaceObject.__)('Block patterns'), + category, + showTitle = true, showTitlesAsTooltip, pagingProps }, ref) { @@ -42149,28 +45649,28 @@ function BlockPatternsList({ // focus is put back to the start. setActiveId(undefined); }, [setActiveId, shownPatterns, blockPatterns]); - return (0,external_React_.createElement)(block_patterns_list_Composite, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(block_patterns_list_Composite, { store: compositeStore, role: "listbox", className: "block-editor-block-patterns-list", "aria-label": label, - ref: ref - }, blockPatterns.map(pattern => { - const isShown = shownPatterns.includes(pattern); - return isShown ? (0,external_React_.createElement)(BlockPattern, { - key: pattern.name, - id: pattern.name, - pattern: pattern, - onClick: onClickPattern, - onHover: onHover, - isDraggable: isDraggable, - showTooltip: showTitlesAsTooltip - }) : (0,external_React_.createElement)(BlockPatternPlaceholder, { - key: pattern.name - }); - }), pagingProps && (0,external_React_.createElement)(Pagination, { - ...pagingProps - })); + ref: ref, + children: [blockPatterns.map(pattern => { + const isShown = shownPatterns.includes(pattern); + return isShown ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockPattern, { + id: pattern.name, + pattern: pattern, + onClick: onClickPattern, + onHover: onHover, + isDraggable: isDraggable, + showTitle: showTitle, + showTooltip: showTitlesAsTooltip, + category: category + }, pattern.name) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockPatternPlaceholder, {}, pattern.name); + }), pagingProps && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Pagination, { + ...pagingProps + })] + }); } /* harmony default export */ const block_patterns_list = ((0,external_wp_element_namespaceObject.forwardRef)(BlockPatternsList)); @@ -42189,6 +45689,23 @@ function BlockPatternsList({ */ +function getIndex({ + destinationRootClientId, + destinationIndex, + rootClientId, + registry +}) { + if (rootClientId === destinationRootClientId) { + return destinationIndex; + } + const parents = ['', ...registry.select(store).getBlockParents(destinationRootClientId), destinationRootClientId]; + const parentIndex = parents.indexOf(rootClientId); + if (parentIndex !== -1) { + return registry.select(store).getBlockIndex(parents[parentIndex + 1]) + 1; + } + return registry.select(store).getBlockOrder(rootClientId).length; +} + /** * @typedef WPInserterConfig * @@ -42218,6 +45735,7 @@ function useInsertionPoint({ shouldFocusBlock = true, selectBlockOnInsert = true }) { + const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const { getSelectedBlock } = (0,external_wp_data_namespaceObject.useSelect)(store); @@ -42256,14 +45774,27 @@ function useInsertionPoint({ replaceBlocks, insertBlocks, showInsertionPoint, - hideInsertionPoint - } = (0,external_wp_data_namespaceObject.useDispatch)(store); - const onInsertBlocks = (0,external_wp_element_namespaceObject.useCallback)((blocks, meta, shouldForceFocusBlock = false) => { + hideInsertionPoint, + setLastFocus + } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); + const onInsertBlocks = (0,external_wp_element_namespaceObject.useCallback)((blocks, meta, shouldForceFocusBlock = false, _rootClientId) => { + // When we are trying to move focus or select a new block on insert, we also + // need to clear the last focus to avoid the focus being set to the wrong block + // when tabbing back into the canvas if the block was added from outside the + // editor canvas. + if (shouldForceFocusBlock || shouldFocusBlock || selectBlockOnInsert) { + setLastFocus(null); + } const selectedBlock = getSelectedBlock(); if (!isAppender && selectedBlock && (0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(selectedBlock)) { replaceBlocks(selectedBlock.clientId, blocks, null, shouldFocusBlock || shouldForceFocusBlock ? 0 : null, meta); } else { - insertBlocks(blocks, destinationIndex, destinationRootClientId, selectBlockOnInsert, shouldFocusBlock || shouldForceFocusBlock ? 0 : null, meta); + insertBlocks(blocks, isAppender || _rootClientId === undefined ? destinationIndex : getIndex({ + destinationRootClientId, + destinationIndex, + rootClientId: _rootClientId, + registry + }), isAppender || _rootClientId === undefined ? destinationRootClientId : _rootClientId, selectBlockOnInsert, shouldFocusBlock || shouldForceFocusBlock ? 0 : null, meta); } const blockLength = Array.isArray(blocks) ? blocks.length : 1; const message = (0,external_wp_i18n_namespaceObject.sprintf)( @@ -42274,9 +45805,14 @@ function useInsertionPoint({ onSelect(blocks); } }, [isAppender, getSelectedBlock, replaceBlocks, insertBlocks, destinationRootClientId, destinationIndex, onSelect, shouldFocusBlock, selectBlockOnInsert]); - const onToggleInsertionPoint = (0,external_wp_element_namespaceObject.useCallback)(show => { - if (show) { - showInsertionPoint(destinationRootClientId, destinationIndex); + const onToggleInsertionPoint = (0,external_wp_element_namespaceObject.useCallback)(item => { + if (item?.hasOwnProperty('rootClientId')) { + showInsertionPoint(item.rootClientId, getIndex({ + destinationRootClientId, + destinationIndex, + rootClientId: item.rootClientId, + registry + })); } else { hideInsertionPoint(); } @@ -42304,12 +45840,13 @@ function useInsertionPoint({ /** * Retrieves the block patterns inserter state. * - * @param {Function} onInsert function called when inserter a list of blocks. - * @param {string=} rootClientId Insertion's root client ID. + * @param {Function} onInsert function called when inserter a list of blocks. + * @param {string=} rootClientId Insertion's root client ID. * + * @param {string} selectedCategory The selected pattern category. * @return {Array} Returns the patterns state. (patterns, categories, onSelect handler) */ -const usePatternsState = (onInsert, rootClientId) => { +const usePatternsState = (onInsert, rootClientId, selectedCategory) => { const { patternCategories, patterns, @@ -42345,13 +45882,19 @@ const usePatternsState = (onInsert, rootClientId) => { const patternBlocks = pattern.type === INSERTER_PATTERN_TYPES.user && pattern.syncStatus !== 'unsynced' ? [(0,external_wp_blocks_namespaceObject.createBlock)('core/block', { ref: pattern.id })] : blocks; - onInsert((patternBlocks !== null && patternBlocks !== void 0 ? patternBlocks : []).map(block => (0,external_wp_blocks_namespaceObject.cloneBlock)(block)), pattern.name); + onInsert((patternBlocks !== null && patternBlocks !== void 0 ? patternBlocks : []).map(block => { + const clonedBlock = (0,external_wp_blocks_namespaceObject.cloneBlock)(block); + if (clonedBlock.attributes.metadata?.categories?.includes(selectedCategory)) { + clonedBlock.attributes.metadata.categories = [selectedCategory]; + } + return clonedBlock; + }), pattern.name); createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block pattern title. */ (0,external_wp_i18n_namespaceObject.__)('Block pattern "%s" inserted.'), pattern.title), { type: 'snackbar', id: 'block-pattern-inserted-notice' }); - }, [createSuccessNotice, onInsert]); + }, [createSuccessNotice, onInsert, selectedCategory]); return [patterns, allCategories, onClickPattern]; }; /* harmony default export */ const use_patterns_state = (usePatternsState); @@ -42412,7 +45955,6 @@ function usePatternsPaging(currentCategoryPatterns, currentCategory, scrollConta } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-explorer/pattern-list.js - /** * WordPress dependencies */ @@ -42433,6 +45975,9 @@ function usePatternsPaging(currentCategoryPatterns, currentCategory, scrollConta + + + function PatternsListHeader({ filterValue, filteredBlockPatternsLength @@ -42440,12 +45985,13 @@ function PatternsListHeader({ if (!filterValue) { return null; } - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHeading, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { level: 2, - lineHeight: '48px', - className: "block-editor-block-patterns-explorer__search-results-count" - }, (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of patterns. */ - (0,external_wp_i18n_namespaceObject._n)('%d pattern found', '%d patterns found', filteredBlockPatternsLength), filteredBlockPatternsLength)); + lineHeight: "48px", + className: "block-editor-block-patterns-explorer__search-results-count", + children: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of patterns. */ + (0,external_wp_i18n_namespaceObject._n)('%d pattern found', '%d patterns found', filteredBlockPatternsLength), filteredBlockPatternsLength) + }); } function PatternList({ searchValue, @@ -42459,7 +46005,7 @@ function PatternList({ rootClientId, shouldFocusBlock: true }); - const [patterns,, onClickPattern] = use_patterns_state(onInsertBlocks, destinationRootClientId); + const [patterns,, onClickPattern] = use_patterns_state(onInsertBlocks, destinationRootClientId, selectedCategory); const registeredPatternCategories = (0,external_wp_element_namespaceObject.useMemo)(() => patternCategories.map(patternCategory => patternCategory.name), [patternCategories]); const filteredBlockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => { const filteredPatterns = patterns.filter(pattern => { @@ -42500,20 +46046,25 @@ function PatternList({ pagingProps.changePage(1); } const hasItems = !!filteredBlockPatterns?.length; - return (0,external_React_.createElement)("div", { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-block-patterns-explorer__list", - ref: container - }, (0,external_React_.createElement)(PatternsListHeader, { - filterValue: searchValue, - filteredBlockPatternsLength: filteredBlockPatterns.length - }), (0,external_React_.createElement)(inserter_listbox, null, hasItems && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(block_patterns_list, { - shownPatterns: pagingProps.categoryPatternsAsyncList, - blockPatterns: pagingProps.categoryPatterns, - onClickPattern: onClickPattern, - isDraggable: false - }), (0,external_React_.createElement)(Pagination, { - ...pagingProps - })))); + ref: container, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternsListHeader, { + filterValue: searchValue, + filteredBlockPatternsLength: filteredBlockPatterns.length + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_listbox, { + children: hasItems && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_patterns_list, { + shownPatterns: pagingProps.categoryPatternsAsyncList, + blockPatterns: pagingProps.categoryPatterns, + onClickPattern: onClickPattern, + isDraggable: false + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Pagination, { + ...pagingProps + })] + }) + })] + }); } /* harmony default export */ const pattern_list = (PatternList); @@ -42566,7 +46117,6 @@ function usePatternCategories(rootClientId, sourceFilter = 'all') { } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-explorer/index.js - /** * WordPress dependencies */ @@ -42580,106 +46130,122 @@ function usePatternCategories(rootClientId, sourceFilter = 'all') { + + function PatternsExplorer({ initialCategory, rootClientId }) { const [searchValue, setSearchValue] = (0,external_wp_element_namespaceObject.useState)(''); - const [patternSourceFilter, setPatternSourceFilter] = (0,external_wp_element_namespaceObject.useState)('all'); const [selectedCategory, setSelectedCategory] = (0,external_wp_element_namespaceObject.useState)(initialCategory?.name); - const patternCategories = usePatternCategories(rootClientId, patternSourceFilter); - return (0,external_React_.createElement)("div", { - className: "block-editor-block-patterns-explorer" - }, (0,external_React_.createElement)(pattern_explorer_sidebar, { - selectedCategory: selectedCategory, - patternCategories: patternCategories, - onClickCategory: setSelectedCategory, - searchValue: searchValue, - setSearchValue: setSearchValue, - patternSourceFilter: patternSourceFilter, - setPatternSourceFilter: setPatternSourceFilter - }), (0,external_React_.createElement)(pattern_list, { - searchValue: searchValue, - selectedCategory: selectedCategory, - patternCategories: patternCategories, - patternSourceFilter: patternSourceFilter, - rootClientId: rootClientId - })); + const patternCategories = usePatternCategories(rootClientId); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-block-patterns-explorer", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(pattern_explorer_sidebar, { + selectedCategory: selectedCategory, + patternCategories: patternCategories, + onClickCategory: setSelectedCategory, + searchValue: searchValue, + setSearchValue: setSearchValue + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(pattern_list, { + searchValue: searchValue, + selectedCategory: selectedCategory, + patternCategories: patternCategories, + rootClientId: rootClientId + })] + }); } function PatternsExplorerModal({ onModalClose, ...restProps }) { - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Modal, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)('Patterns'), onRequestClose: onModalClose, - isFullScreen: true - }, (0,external_React_.createElement)(PatternsExplorer, { - ...restProps - })); + isFullScreen: true, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternsExplorer, { + ...restProps + }) + }); } /* harmony default export */ const block_patterns_explorer = (PatternsExplorerModal); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/mobile-tab-navigation.js - /** * WordPress dependencies */ + + function ScreenHeader({ title }) { - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { - spacing: 0 - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalView, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, { - marginBottom: 0, - paddingX: 4, - paddingY: 3 - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { - spacing: 2 - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorBackButton, { - style: - // TODO: This style override is also used in ToolsPanelHeader. - // It should be supported out-of-the-box by Button. - { - minWidth: 24, - padding: 0 - }, - icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, - isSmall: true, - "aria-label": (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous view') - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHeading, { - level: 5 - }, title)))))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { + spacing: 0, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalView, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { + marginBottom: 0, + paddingX: 4, + paddingY: 3, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { + spacing: 2, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNavigatorBackButton, { + style: + // TODO: This style override is also used in ToolsPanelHeader. + // It should be supported out-of-the-box by Button. + { + minWidth: 24, + padding: 0 + }, + icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, + size: "small", + label: (0,external_wp_i18n_namespaceObject.__)('Back') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { + level: 5, + children: title + }) + })] + }) + }) + }) + }); } function MobileTabNavigation({ categories, children }) { - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, { initialPath: "/", - className: "block-editor-inserter__mobile-tab-navigation" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, { - path: "/" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, categories.map(category => (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorButton, { - key: category.name, - path: `/category/${category.name}`, - as: external_wp_components_namespaceObject.__experimentalItem, - isAction: true - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexBlock, null, category.label), (0,external_React_.createElement)(build_module_icon, { - icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right - })))))), categories.map(category => (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, { - key: category.name, - path: `/category/${category.name}` - }, (0,external_React_.createElement)(ScreenHeader, { - title: (0,external_wp_i18n_namespaceObject.__)('Back') - }), children(category)))); + className: "block-editor-inserter__mobile-tab-navigation", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, { + path: "/", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, { + children: categories.map(category => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNavigatorButton, { + path: `/category/${category.name}`, + as: external_wp_components_namespaceObject.__experimentalItem, + isAction: true, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { + children: category.label + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { + icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right + })] + }) + }, category.name)) + }) + }), categories.map(category => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, { + path: `/category/${category.name}`, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScreenHeader, { + title: (0,external_wp_i18n_namespaceObject.__)('Back') + }), children(category)] + }, category.name))] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/patterns-filter.js - /** * WordPress dependencies */ @@ -42692,6 +46258,9 @@ function MobileTabNavigation({ * Internal dependencies */ + + + const getShouldDisableSyncFilter = sourceFilter => sourceFilter !== 'all'; const getShouldDisableNonUserSources = category => { return category.name === myPatternsCategory.name; @@ -42751,52 +46320,63 @@ function PatternsFilter({ setPatternSyncFilter('all'); } } - return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.DropdownMenu, { - popoverProps: { - placement: 'right-end' - }, - label: "Filter patterns", - icon: (0,external_React_.createElement)(build_module_icon, { - icon: (0,external_React_.createElement)(external_wp_components_namespaceObject.SVG, { - width: "24", - height: "24", - viewBox: "0 0 24 24", - fill: "none", - xmlns: "http://www.w3.org/2000/svg" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Path, { - d: "M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z", - fill: "#1E1E1E" - })) - }) - }, () => (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, { - label: (0,external_wp_i18n_namespaceObject.__)('Source') - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItemsChoice, { - choices: patternSourceMenuOptions, - onSelect: value => { - handleSetSourceFilterChange(value); - scrollContainerRef.current?.scrollTo(0, 0); - }, - value: currentPatternSourceFilter - })), (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, { - label: (0,external_wp_i18n_namespaceObject.__)('Type') - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItemsChoice, { - choices: patternSyncMenuOptions, - onSelect: value => { - setPatternSyncFilter(value); - scrollContainerRef.current?.scrollTo(0, 0); - }, - value: patternSyncFilter - })), (0,external_React_.createElement)("div", { - className: "block-editor-tool-selector__help" - }, (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Patterns are available from the WordPress.org Pattern Directory, bundled in the active theme, or created by users on this site. Only patterns created on this site can be synced.'), { - Link: (0,external_React_.createElement)(external_wp_components_namespaceObject.ExternalLink, { - href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/patterns/') + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { + popoverProps: { + placement: 'right-end' + }, + label: (0,external_wp_i18n_namespaceObject.__)('Filter patterns'), + toggleProps: { + size: 'compact' + }, + icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { + icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SVG, { + width: "24", + height: "24", + viewBox: "0 0 24 24", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { + d: "M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z", + fill: "currentColor" + }) + }) + }), + children: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { + label: (0,external_wp_i18n_namespaceObject.__)('Source'), + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItemsChoice, { + choices: patternSourceMenuOptions, + onSelect: value => { + handleSetSourceFilterChange(value); + scrollContainerRef.current?.scrollTo(0, 0); + }, + value: currentPatternSourceFilter + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { + label: (0,external_wp_i18n_namespaceObject.__)('Type'), + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItemsChoice, { + choices: patternSyncMenuOptions, + onSelect: value => { + setPatternSyncFilter(value); + scrollContainerRef.current?.scrollTo(0, 0); + }, + value: patternSyncFilter + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-tool-selector__help", + children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Patterns are available from the WordPress.org Pattern Directory, bundled in the active theme, or created by users on this site. Only patterns created on this site can be synced.'), { + Link: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { + href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/patterns/') + }) + }) + })] + }) }) - }))))); + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js - /** * WordPress dependencies */ @@ -42813,6 +46393,9 @@ function PatternsFilter({ + + + const pattern_category_previews_noop = () => {}; function PatternCategoryPreviews({ rootClientId, @@ -42821,7 +46404,7 @@ function PatternCategoryPreviews({ category, showTitlesAsTooltip }) { - const [allPatterns,, onClickPattern] = use_patterns_state(onInsert, rootClientId); + const [allPatterns,, onClickPattern] = use_patterns_state(onInsert, rootClientId, category?.name); const [patternSyncFilter, setPatternSyncFilter] = (0,external_wp_element_namespaceObject.useState)('all'); const [patternSourceFilter, setPatternSourceFilter] = (0,external_wp_element_namespaceObject.useState)('all'); const availableCategories = usePatternCategories(rootClientId, patternSourceFilter); @@ -42863,42 +46446,107 @@ function PatternCategoryPreviews({ setPatternSourceFilter(value); changePage(1); }, [setPatternSourceFilter, changePage]); - return (0,external_React_.createElement)("div", { - className: "block-editor-inserter__patterns-category-panel" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { - spacing: 2, - className: "block-editor-inserter__patterns-category-panel-header" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexBlock, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHeading, { - level: 4, - as: "div" - }, category.label)), (0,external_React_.createElement)(PatternsFilter, { - patternSyncFilter: patternSyncFilter, - patternSourceFilter: patternSourceFilter, - setPatternSyncFilter: onSetPatternSyncFilter, - setPatternSourceFilter: onSetPatternSourceFilter, - scrollContainerRef: scrollContainerRef, - category: category - })), !currentCategoryPatterns.length && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, { - variant: "muted", - className: "block-editor-inserter__patterns-category-no-results" - }, (0,external_wp_i18n_namespaceObject.__)('No results found'))), currentCategoryPatterns.length > 0 && (0,external_React_.createElement)(block_patterns_list, { - ref: scrollContainerRef, - shownPatterns: pagingProps.categoryPatternsAsyncList, - blockPatterns: pagingProps.categoryPatterns, - onClickPattern: onClickPattern, - onHover: onHover, - label: category.label, + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { + spacing: 2, + className: "block-editor-inserter__patterns-category-panel-header", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { + className: "block-editor-inserter__patterns-category-panel-title", + size: 13, + level: 4, + as: "div", + children: category.label + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternsFilter, { + patternSyncFilter: patternSyncFilter, + patternSourceFilter: patternSourceFilter, + setPatternSyncFilter: onSetPatternSyncFilter, + setPatternSourceFilter: onSetPatternSourceFilter, + scrollContainerRef: scrollContainerRef, + category: category + })] + }), !currentCategoryPatterns.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { + variant: "muted", + className: "block-editor-inserter__patterns-category-no-results", + children: (0,external_wp_i18n_namespaceObject.__)('No results found') + })] + }), currentCategoryPatterns.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_patterns_list, { + ref: scrollContainerRef, + shownPatterns: pagingProps.categoryPatternsAsyncList, + blockPatterns: pagingProps.categoryPatterns, + onClickPattern: onClickPattern, + onHover: onHover, + label: category.label, + orientation: "vertical", + category: category.name, + isDraggable: true, + showTitlesAsTooltip: showTitlesAsTooltip, + patternFilter: patternSourceFilter, + pagingProps: pagingProps + })] + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/category-tabs/index.js +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + +const { + Tabs: category_tabs_Tabs +} = unlock(external_wp_components_namespaceObject.privateApis); +function CategoryTabs({ + categories, + selectedCategory, + onSelectCategory, + children +}) { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(category_tabs_Tabs, { + className: "block-editor-inserter__category-tabs", + selectOnMove: false, + selectedTabId: selectedCategory ? selectedCategory.name : null, orientation: "vertical", - category: category.name, - isDraggable: true, - showTitlesAsTooltip: showTitlesAsTooltip, - patternFilter: patternSourceFilter, - pagingProps: pagingProps - })); + onSelect: categoryId => { + // Pass the full category object + onSelectCategory(categories.find(category => category.name === categoryId)); + }, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(category_tabs_Tabs.TabList, { + className: "block-editor-inserter__category-tablist", + children: categories.map(category => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(category_tabs_Tabs.Tab, { + tabId: category.name, + className: "block-editor-inserter__category-tab", + "aria-label": category.label, + "aria-current": category === selectedCategory ? 'true' : undefined, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { + children: category.label + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { + icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right + })] + }) + }, category.name)) + }), categories.map(category => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(category_tabs_Tabs.TabPanel, { + tabId: category.name, + focusable: false, + className: "block-editor-inserter__category-panel", + children: children + }, category.name))] + }); } +/* harmony default export */ const category_tabs = (CategoryTabs); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/index.js - /** * WordPress dependencies */ @@ -42915,69 +46563,76 @@ function PatternCategoryPreviews({ + + + + + + + function BlockPatternsTab({ onSelectCategory, selectedCategory, onInsert, - rootClientId + rootClientId, + children }) { const [showPatternsExplorer, setShowPatternsExplorer] = (0,external_wp_element_namespaceObject.useState)(false); const categories = usePatternCategories(rootClientId); - const initialCategory = selectedCategory || categories[0]; const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); - return (0,external_React_.createElement)(external_React_.Fragment, null, !isMobile && (0,external_React_.createElement)("div", { - className: "block-editor-inserter__block-patterns-tabs-container" - }, (0,external_React_.createElement)("nav", { - "aria-label": (0,external_wp_i18n_namespaceObject.__)('Block pattern categories'), - className: "block-editor-inserter__block-patterns-tabs" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, { - role: "list" - }, categories.map(category => (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItem, { - role: "listitem", - key: category.name, - onClick: () => onSelectCategory(category), - className: category === selectedCategory ? 'block-editor-inserter__patterns-category block-editor-inserter__patterns-selected-category' : 'block-editor-inserter__patterns-category', - "aria-label": category.label, - "aria-current": category === selectedCategory ? 'true' : undefined - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexBlock, null, category.label), (0,external_React_.createElement)(build_module_icon, { - icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right - })))), (0,external_React_.createElement)("div", { - role: "listitem" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - className: "block-editor-inserter__patterns-explore-button", - onClick: () => setShowPatternsExplorer(true), - variant: "secondary" - }, (0,external_wp_i18n_namespaceObject.__)('Explore all patterns')))))), isMobile && (0,external_React_.createElement)(MobileTabNavigation, { - categories: categories - }, category => (0,external_React_.createElement)(PatternCategoryPreviews, { - key: category.name, - onInsert: onInsert, - rootClientId: rootClientId, - category: category, - showTitlesAsTooltip: false - })), showPatternsExplorer && (0,external_React_.createElement)(block_patterns_explorer, { - initialCategory: initialCategory, - patternCategories: categories, - onModalClose: () => setShowPatternsExplorer(false), - rootClientId: rootClientId - })); + const isResolvingPatterns = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store)).isResolvingPatterns(), []); + if (isResolvingPatterns) { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-inserter__patterns-loading", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) + }); + } + if (!categories.length) { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results, {}); + } + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [!isMobile && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-inserter__block-patterns-tabs-container", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(category_tabs, { + categories: categories, + selectedCategory: selectedCategory, + onSelectCategory: onSelectCategory, + children: children + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + className: "block-editor-inserter__patterns-explore-button", + onClick: () => setShowPatternsExplorer(true), + variant: "secondary", + children: (0,external_wp_i18n_namespaceObject.__)('Explore all patterns') + })] + }), isMobile && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileTabNavigation, { + categories: categories, + children: category => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-inserter__category-panel", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternCategoryPreviews, { + onInsert: onInsert, + rootClientId: rootClientId, + category: category, + showTitlesAsTooltip: false + }, category.name) + }) + }), showPatternsExplorer && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_patterns_explorer, { + initialCategory: selectedCategory || categories[0], + patternCategories: categories, + onModalClose: () => setShowPatternsExplorer(false), + rootClientId: rootClientId + })] + }); } /* harmony default export */ const block_patterns_tab = (BlockPatternsTab); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js - -/** - * WordPress dependencies - */ - - - /** * Internal dependencies */ -function PatternCategoryPreviewPanel({ + +function PatternCategoryPreviewPanelInner({ rootClientId, onInsert, onHover, @@ -42985,167 +46640,54 @@ function PatternCategoryPreviewPanel({ showTitlesAsTooltip, patternFilter }) { - const container = (0,external_wp_element_namespaceObject.useRef)(); - (0,external_wp_element_namespaceObject.useEffect)(() => { - const timeout = setTimeout(() => { - const [firstTabbable] = external_wp_dom_namespaceObject.focus.tabbable.find(container.current); - firstTabbable?.focus(); - }); - return () => clearTimeout(timeout); - }, [category]); - return (0,external_React_.createElement)("div", { - ref: container, - className: "block-editor-inserter__patterns-category-dialog" - }, (0,external_React_.createElement)(PatternCategoryPreviews, { - key: category.name, + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternCategoryPreviews, { rootClientId: rootClientId, onInsert: onInsert, onHover: onHover, category: category, showTitlesAsTooltip: showTitlesAsTooltip, patternFilter: patternFilter - })); + }, category.name); } - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/hooks.js -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - - -/** @typedef {import('../../../store/actions').InserterMediaRequest} InserterMediaRequest */ -/** @typedef {import('../../../store/actions').InserterMediaItem} InserterMediaItem */ - -/** - * Fetches media items based on the provided category. - * Each media category is responsible for providing a `fetch` function. - * - * @param {Object} category The media category to fetch results for. - * @param {InserterMediaRequest} query The query args to use for the request. - * @return {InserterMediaItem[]} The media results. - */ -function useMediaResults(category, query = {}) { - const [mediaList, setMediaList] = (0,external_wp_element_namespaceObject.useState)(); - const [isLoading, setIsLoading] = (0,external_wp_element_namespaceObject.useState)(false); - // We need to keep track of the last request made because - // multiple request can be fired without knowing the order - // of resolution, and we need to ensure we are showing - // the results of the last request. - // In the future we could use AbortController to cancel previous - // requests, but we don't for now as it involves adding support - // for this to `core-data` package. - const lastRequest = (0,external_wp_element_namespaceObject.useRef)(); - (0,external_wp_element_namespaceObject.useEffect)(() => { - (async () => { - const key = JSON.stringify({ - category: category.name, - ...query - }); - lastRequest.current = key; - setIsLoading(true); - setMediaList([]); // Empty the previous results. - const _media = await category.fetch?.(query); - if (key === lastRequest.current) { - setMediaList(_media); - setIsLoading(false); - } - })(); - }, [category.name, ...Object.values(query)]); - return { - mediaList, - isLoading - }; +function PatternCategoryPreviewPanelWithZoomOut(props) { + useZoomOut(); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternCategoryPreviewPanelInner, { + ...props + }); } -function useMediaCategories(rootClientId) { - const [categories, setCategories] = (0,external_wp_element_namespaceObject.useState)([]); - const inserterMediaCategories = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store)).getInserterMediaCategories(), []); - const { - canInsertImage, - canInsertVideo, - canInsertAudio - } = (0,external_wp_data_namespaceObject.useSelect)(select => { - const { - canInsertBlockType - } = select(store); - return { - canInsertImage: canInsertBlockType('core/image', rootClientId), - canInsertVideo: canInsertBlockType('core/video', rootClientId), - canInsertAudio: canInsertBlockType('core/audio', rootClientId) - }; - }, [rootClientId]); - (0,external_wp_element_namespaceObject.useEffect)(() => { - (async () => { - const _categories = []; - // If `inserterMediaCategories` is not defined in - // block editor settings, do not show any media categories. - if (!inserterMediaCategories) { - return; - } - // Loop through categories to check if they have at least one media item. - const categoriesHaveMedia = new Map(await Promise.all(inserterMediaCategories.map(async category => { - // Some sources are external and we don't need to make a request. - if (category.isExternalResource) { - return [category.name, true]; - } - let results = []; - try { - results = await category.fetch({ - per_page: 1 - }); - } catch (e) { - // If the request fails, we shallow the error and just don't show - // the category, in order to not break the media tab. - } - return [category.name, !!results.length]; - }))); - // We need to filter out categories that don't have any media items or - // whose corresponding block type is not allowed to be inserted, based - // on the category's `mediaType`. - const canInsertMediaType = { - image: canInsertImage, - video: canInsertVideo, - audio: canInsertAudio - }; - inserterMediaCategories.forEach(category => { - if (canInsertMediaType[category.mediaType] && categoriesHaveMedia.get(category.name)) { - _categories.push(category); - } - }); - if (!!_categories.length) { - setCategories(_categories); - } - })(); - }, [canInsertImage, canInsertVideo, canInsertAudio, inserterMediaCategories]); - return categories; +function PatternCategoryPreviewPanel(props) { + // When the pattern panel is showing, we want to use zoom out mode + if (window.__experimentalEnableZoomedOutPatternsTab) { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternCategoryPreviewPanelWithZoomOut, { + ...props + }); + } + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternCategoryPreviewPanelInner, { + ...props + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js - /** * WordPress dependencies */ -const external = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const external = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z" + }) +}); /* harmony default export */ const library_external = (external); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/utils.js - /** * WordPress dependencies */ + const mediaTypeTag = { image: 'img', video: 'video', @@ -43176,7 +46718,7 @@ function getBlockAndPreviewFromMedia(media, mediaType) { attributes.src = mediaSrc; } const PreviewTag = mediaTypeTag[mediaType]; - const preview = (0,external_React_.createElement)(PreviewTag, { + const preview = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewTag, { src: media.previewUrl || mediaSrc, alt: alt, controls: mediaType === 'audio' ? true : undefined, @@ -43194,7 +46736,6 @@ function getBlockAndPreviewFromMedia(media, mediaType) { } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/media-preview.js - /** * External dependencies */ @@ -43219,6 +46760,9 @@ function getBlockAndPreviewFromMedia(media, mediaType) { + + + const ALLOWED_MEDIA_TYPES = ['image']; const MAXIMUM_TITLE_LENGTH = 25; const MEDIA_OPTIONS_POPOVER_PROPS = { @@ -43236,38 +46780,55 @@ function MediaPreviewOptions({ return null; } const reportUrl = category.getReportUrl(media); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.DropdownMenu, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { className: "block-editor-inserter__media-list__item-preview-options", label: (0,external_wp_i18n_namespaceObject.__)('Options'), popoverProps: MEDIA_OPTIONS_POPOVER_PROPS, - icon: more_vertical - }, () => (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { - onClick: () => window.open(reportUrl, '_blank').focus(), - icon: library_external - }, (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The media type to report e.g: "image", "video", "audio" */ - (0,external_wp_i18n_namespaceObject.__)('Report %s'), category.mediaType)))); + icon: more_vertical, + children: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { + onClick: () => window.open(reportUrl, '_blank').focus(), + icon: library_external, + children: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The media type to report e.g: "image", "video", "audio" */ + (0,external_wp_i18n_namespaceObject.__)('Report %s'), category.mediaType) + }) + }) + }); } function InsertExternalImageModal({ onClose, onSubmit }) { - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Modal, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)('Insert external image'), onRequestClose: onClose, - className: "block-editor-inserter-media-tab-media-preview-inserter-external-image-modal" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { - spacing: 3 - }, (0,external_React_.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('This image cannot be uploaded to your Media Library, but it can still be inserted as an external image.')), (0,external_React_.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('External images can be removed by the external provider without warning and could even have legal compliance issues related to privacy legislation.'))), (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, { - className: "block-editor-block-lock-modal__actions", - justify: "flex-end", - expanded: false - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - variant: "tertiary", - onClick: onClose - }, (0,external_wp_i18n_namespaceObject.__)('Cancel'))), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - variant: "primary", - onClick: onSubmit - }, (0,external_wp_i18n_namespaceObject.__)('Insert'))))); + className: "block-editor-inserter-media-tab-media-preview-inserter-external-image-modal", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { + spacing: 3, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { + children: (0,external_wp_i18n_namespaceObject.__)('This image cannot be uploaded to your Media Library, but it can still be inserted as an external image.') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { + children: (0,external_wp_i18n_namespaceObject.__)('External images can be removed by the external provider without warning and could even have legal compliance issues related to privacy legislation.') + })] + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { + className: "block-editor-block-lock-modal__actions", + justify: "flex-end", + expanded: false, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + variant: "tertiary", + onClick: onClose, + children: (0,external_wp_i18n_namespaceObject.__)('Cancel') + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + variant: "primary", + onClick: onSubmit, + children: (0,external_wp_i18n_namespaceObject.__)('Insert') + }) + })] + })] + }); } function MediaPreview({ media, @@ -43282,18 +46843,28 @@ function MediaPreview({ createErrorNotice, createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); - const mediaUpload = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings().mediaUpload, []); + const { + getSettings + } = (0,external_wp_data_namespaceObject.useSelect)(store); const onMediaInsert = (0,external_wp_element_namespaceObject.useCallback)(previewBlock => { // Prevent multiple uploads when we're in the process of inserting. if (isInserting) { return; } + const settings = getSettings(); const clonedBlock = (0,external_wp_blocks_namespaceObject.cloneBlock)(previewBlock); const { id, url, caption } = clonedBlock.attributes; + + // User has no permission to upload media. + if (!id && !settings.mediaUpload) { + setShowExternalUploadModal(true); + return; + } + // Media item already exists in library, so just insert it. if (!!id) { onClick(clonedBlock); @@ -43306,7 +46877,7 @@ function MediaPreview({ // If this happens, we insert the image block using the external // URL and let the user know about the possible implications. window.fetch(url).then(response => response.blob()).then(blob => { - mediaUpload({ + settings.mediaUpload({ filesList: [blob], additionalData: { caption @@ -43340,7 +46911,7 @@ function MediaPreview({ setShowExternalUploadModal(true); setIsInserting(false); }); - }, [isInserting, onClick, mediaUpload, createErrorNotice, createSuccessNotice]); + }, [isInserting, getSettings, onClick, createSuccessNotice, createErrorNotice]); const title = typeof media.title === 'string' ? media.title : media.title?.rendered || (0,external_wp_i18n_namespaceObject.__)('no title'); let truncatedTitle; if (title.length > MAXIMUM_TITLE_LENGTH) { @@ -43349,53 +46920,61 @@ function MediaPreview({ } const onMouseEnter = (0,external_wp_element_namespaceObject.useCallback)(() => setIsHovered(true), []); const onMouseLeave = (0,external_wp_element_namespaceObject.useCallback)(() => setIsHovered(false), []); - return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(inserter_draggable_blocks, { - isEnabled: true, - blocks: [block] - }, ({ - draggable, - onDragStart, - onDragEnd - }) => (0,external_React_.createElement)("div", { - className: classnames_default()('block-editor-inserter__media-list__list-item', { - 'is-hovered': isHovered - }), - draggable: draggable, - onDragStart: onDragStart, - onDragEnd: onDragEnd - }, (0,external_React_.createElement)("div", { - onMouseEnter: onMouseEnter, - onMouseLeave: onMouseLeave - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Tooltip, { - text: truncatedTitle || title - }, (0,external_React_.createElement)(media_preview_CompositeItem, { - render: (0,external_React_.createElement)("div", { - "aria-label": title, - role: "option", - className: "block-editor-inserter__media-list__item" - }), - onClick: () => onMediaInsert(block) - }, (0,external_React_.createElement)("div", { - className: "block-editor-inserter__media-list__item-preview" - }, preview, isInserting && (0,external_React_.createElement)("div", { - className: "block-editor-inserter__media-list__item-preview-spinner" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Spinner, null))))), !isInserting && (0,external_React_.createElement)(MediaPreviewOptions, { - category: category, - media: media - })))), showExternalUploadModal && (0,external_React_.createElement)(InsertExternalImageModal, { - onClose: () => setShowExternalUploadModal(false), - onSubmit: () => { - onClick((0,external_wp_blocks_namespaceObject.cloneBlock)(block)); - createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Image inserted.'), { - type: 'snackbar' - }); - setShowExternalUploadModal(false); - } - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_draggable_blocks, { + isEnabled: true, + blocks: [block], + children: ({ + draggable, + onDragStart, + onDragEnd + }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: dist_clsx('block-editor-inserter__media-list__list-item', { + 'is-hovered': isHovered + }), + draggable: draggable, + onDragStart: onDragStart, + onDragEnd: onDragEnd, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + onMouseEnter: onMouseEnter, + onMouseLeave: onMouseLeave, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { + text: truncatedTitle || title, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(media_preview_CompositeItem, { + render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + "aria-label": title, + role: "option", + className: "block-editor-inserter__media-list__item" + }), + onClick: () => onMediaInsert(block), + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-inserter__media-list__item-preview", + children: [preview, isInserting && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-inserter__media-list__item-preview-spinner", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) + })] + }) + }) + }), !isInserting && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MediaPreviewOptions, { + category: category, + media: media + })] + }) + }) + }), showExternalUploadModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InsertExternalImageModal, { + onClose: () => setShowExternalUploadModal(false), + onSubmit: () => { + onClick((0,external_wp_blocks_namespaceObject.cloneBlock)(block)); + createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Image inserted.'), { + type: 'snackbar' + }); + setShowExternalUploadModal(false); + } + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/media-list.js - /** * WordPress dependencies */ @@ -43407,6 +46986,7 @@ function MediaPreview({ */ + const { CompositeV2: media_list_Composite, useCompositeStoreV2: media_list_useCompositeStore @@ -43418,39 +46998,140 @@ function MediaList({ label = (0,external_wp_i18n_namespaceObject.__)('Media List') }) { const compositeStore = media_list_useCompositeStore(); - return (0,external_React_.createElement)(media_list_Composite, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(media_list_Composite, { store: compositeStore, role: "listbox", className: "block-editor-inserter__media-list", - "aria-label": label - }, mediaList.map((media, index) => (0,external_React_.createElement)(MediaPreview, { - key: media.id || media.sourceId || index, - media: media, - category: category, - onClick: onClick - }))); + "aria-label": label, + children: mediaList.map((media, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MediaPreview, { + media: media, + category: category, + onClick: onClick + }, media.id || media.sourceId || index)) + }); } /* harmony default export */ const media_list = (MediaList); -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/no-results.js - +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/hooks.js /** * WordPress dependencies */ -function InserterNoResults() { - return (0,external_React_.createElement)("div", { - className: "block-editor-inserter__no-results" - }, (0,external_React_.createElement)(build_module_icon, { - className: "block-editor-inserter__no-results-icon", - icon: block_default - }), (0,external_React_.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('No results found.'))); + +/** + * Internal dependencies + */ + + + +/** @typedef {import('../../../store/actions').InserterMediaRequest} InserterMediaRequest */ +/** @typedef {import('../../../store/actions').InserterMediaItem} InserterMediaItem */ + +/** + * Fetches media items based on the provided category. + * Each media category is responsible for providing a `fetch` function. + * + * @param {Object} category The media category to fetch results for. + * @param {InserterMediaRequest} query The query args to use for the request. + * @return {InserterMediaItem[]} The media results. + */ +function useMediaResults(category, query = {}) { + const [mediaList, setMediaList] = (0,external_wp_element_namespaceObject.useState)(); + const [isLoading, setIsLoading] = (0,external_wp_element_namespaceObject.useState)(false); + // We need to keep track of the last request made because + // multiple request can be fired without knowing the order + // of resolution, and we need to ensure we are showing + // the results of the last request. + // In the future we could use AbortController to cancel previous + // requests, but we don't for now as it involves adding support + // for this to `core-data` package. + const lastRequest = (0,external_wp_element_namespaceObject.useRef)(); + (0,external_wp_element_namespaceObject.useEffect)(() => { + (async () => { + const key = JSON.stringify({ + category: category.name, + ...query + }); + lastRequest.current = key; + setIsLoading(true); + setMediaList([]); // Empty the previous results. + const _media = await category.fetch?.(query); + if (key === lastRequest.current) { + setMediaList(_media); + setIsLoading(false); + } + })(); + }, [category.name, ...Object.values(query)]); + return { + mediaList, + isLoading + }; +} +function useMediaCategories(rootClientId) { + const [categories, setCategories] = (0,external_wp_element_namespaceObject.useState)([]); + const inserterMediaCategories = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store)).getInserterMediaCategories(), []); + const { + canInsertImage, + canInsertVideo, + canInsertAudio + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + canInsertBlockType + } = select(store); + return { + canInsertImage: canInsertBlockType('core/image', rootClientId), + canInsertVideo: canInsertBlockType('core/video', rootClientId), + canInsertAudio: canInsertBlockType('core/audio', rootClientId) + }; + }, [rootClientId]); + (0,external_wp_element_namespaceObject.useEffect)(() => { + (async () => { + const _categories = []; + // If `inserterMediaCategories` is not defined in + // block editor settings, do not show any media categories. + if (!inserterMediaCategories) { + return; + } + // Loop through categories to check if they have at least one media item. + const categoriesHaveMedia = new Map(await Promise.all(inserterMediaCategories.map(async category => { + // Some sources are external and we don't need to make a request. + if (category.isExternalResource) { + return [category.name, true]; + } + let results = []; + try { + results = await category.fetch({ + per_page: 1 + }); + } catch (e) { + // If the request fails, we shallow the error and just don't show + // the category, in order to not break the media tab. + } + return [category.name, !!results.length]; + }))); + // We need to filter out categories that don't have any media items or + // whose corresponding block type is not allowed to be inserted, based + // on the category's `mediaType`. + const canInsertMediaType = { + image: canInsertImage, + video: canInsertVideo, + audio: canInsertAudio + }; + inserterMediaCategories.forEach(category => { + if (canInsertMediaType[category.mediaType] && categoriesHaveMedia.get(category.name)) { + _categories.push(category); + } + }); + if (!!_categories.length) { + setCategories(_categories); + } + })(); + }, [canInsertImage, canInsertVideo, canInsertAudio, inserterMediaCategories]); + return categories; } -/* harmony default export */ const no_results = (InserterNoResults); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/media-panel.js - /** * WordPress dependencies */ @@ -43458,37 +47139,15 @@ function InserterNoResults() { - - /** * Internal dependencies */ + + const INITIAL_MEDIA_ITEMS_PER_PAGE = 10; -function MediaCategoryDialog({ - rootClientId, - onInsert, - category -}) { - const container = (0,external_wp_element_namespaceObject.useRef)(); - (0,external_wp_element_namespaceObject.useEffect)(() => { - const timeout = setTimeout(() => { - const [firstTabbable] = external_wp_dom_namespaceObject.focus.tabbable.find(container.current); - firstTabbable?.focus(); - }); - return () => clearTimeout(timeout); - }, [category]); - return (0,external_React_.createElement)("div", { - ref: container, - className: "block-editor-inserter__media-dialog" - }, (0,external_React_.createElement)(MediaCategoryPanel, { - rootClientId: rootClientId, - onInsert: onInsert, - category: category - })); -} function MediaCategoryPanel({ rootClientId, onInsert, @@ -43504,31 +47163,27 @@ function MediaCategoryPanel({ }); const baseCssClass = 'block-editor-inserter__media-panel'; const searchLabel = category.labels.search_items || (0,external_wp_i18n_namespaceObject.__)('Search'); - return (0,external_React_.createElement)("div", { - className: baseCssClass - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.SearchControl, { - className: `${baseCssClass}-search`, - onChange: setSearch, - value: search, - label: searchLabel, - placeholder: searchLabel - }), isLoading && (0,external_React_.createElement)("div", { - className: `${baseCssClass}-spinner` - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Spinner, null)), !isLoading && !mediaList?.length && (0,external_React_.createElement)(no_results, null), !isLoading && !!mediaList?.length && (0,external_React_.createElement)(media_list, { - rootClientId: rootClientId, - onClick: onInsert, - mediaList: mediaList, - category: category - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: baseCssClass, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { + className: `${baseCssClass}-search`, + onChange: setSearch, + value: search, + label: searchLabel, + placeholder: searchLabel + }), isLoading && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: `${baseCssClass}-spinner`, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) + }), !isLoading && !mediaList?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results, {}), !isLoading && !!mediaList?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(media_list, { + rootClientId: rootClientId, + onClick: onInsert, + mediaList: mediaList, + category: category + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/media-tab.js - -/** - * External dependencies - */ - - /** * WordPress dependencies */ @@ -43537,7 +47192,6 @@ function MediaCategoryPanel({ - /** * Internal dependencies */ @@ -43547,12 +47201,18 @@ function MediaCategoryPanel({ + + + + + const media_tab_ALLOWED_MEDIA_TYPES = ['image', 'video', 'audio']; function MediaTab({ rootClientId, selectedCategory, onSelectCategory, - onInsert + onInsert, + children }) { const mediaCategories = useMediaCategories(rootClientId); const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); @@ -43564,58 +47224,55 @@ function MediaTab({ const [block] = getBlockAndPreviewFromMedia(media, media.type); onInsert(block); }, [onInsert]); - const mobileMediaCategories = (0,external_wp_element_namespaceObject.useMemo)(() => mediaCategories.map(mediaCategory => ({ + const categories = (0,external_wp_element_namespaceObject.useMemo)(() => mediaCategories.map(mediaCategory => ({ ...mediaCategory, label: mediaCategory.labels.name })), [mediaCategories]); - return (0,external_React_.createElement)(external_React_.Fragment, null, !isMobile && (0,external_React_.createElement)("div", { - className: `${baseCssClass}-container` - }, (0,external_React_.createElement)("nav", { - "aria-label": (0,external_wp_i18n_namespaceObject.__)('Media categories') - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, { - role: "list", - className: baseCssClass - }, mediaCategories.map(mediaCategory => (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItem, { - role: "listitem", - key: mediaCategory.name, - onClick: () => onSelectCategory(mediaCategory), - className: classnames_default()(`${baseCssClass}__media-category`, { - 'is-selected': selectedCategory === mediaCategory - }), - "aria-label": mediaCategory.labels.name, - "aria-current": mediaCategory === selectedCategory ? 'true' : undefined - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexBlock, null, mediaCategory.labels.name), (0,external_React_.createElement)(build_module_icon, { - icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right - })))), (0,external_React_.createElement)("div", { - role: "listitem" - }, (0,external_React_.createElement)(check, null, (0,external_React_.createElement)(media_upload, { - multiple: false, - onSelect: onSelectMedia, - allowedTypes: media_tab_ALLOWED_MEDIA_TYPES, - render: ({ - open - }) => (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - onClick: event => { - // Safari doesn't emit a focus event on button elements when - // clicked and we need to manually focus the button here. - // The reason is that core's Media Library modal explicitly triggers a - // focus event and therefore a `blur` event is triggered on a different - // element, which doesn't contain the `data-unstable-ignore-focus-outside-for-relatedtarget` - // attribute making the Inserter dialog to close. - event.target.focus(); - open(); - }, - className: "block-editor-inserter__media-library-button", - variant: "secondary", - "data-unstable-ignore-focus-outside-for-relatedtarget": ".media-modal" - }, (0,external_wp_i18n_namespaceObject.__)('Open Media Library')) - })))))), isMobile && (0,external_React_.createElement)(MobileTabNavigation, { - categories: mobileMediaCategories - }, category => (0,external_React_.createElement)(MediaCategoryPanel, { - onInsert: onInsert, - rootClientId: rootClientId, - category: category - }))); + if (!categories.length) { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results, {}); + } + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [!isMobile && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: `${baseCssClass}-container`, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(category_tabs, { + categories: categories, + selectedCategory: selectedCategory, + onSelectCategory: onSelectCategory, + children: children + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(check, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(media_upload, { + multiple: false, + onSelect: onSelectMedia, + allowedTypes: media_tab_ALLOWED_MEDIA_TYPES, + render: ({ + open + }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + onClick: event => { + // Safari doesn't emit a focus event on button elements when + // clicked and we need to manually focus the button here. + // The reason is that core's Media Library modal explicitly triggers a + // focus event and therefore a `blur` event is triggered on a different + // element, which doesn't contain the `data-unstable-ignore-focus-outside-for-relatedtarget` + // attribute making the Inserter dialog to close. + event.target.focus(); + open(); + }, + className: "block-editor-inserter__media-library-button", + variant: "secondary", + "data-unstable-ignore-focus-outside-for-relatedtarget": ".media-modal", + children: (0,external_wp_i18n_namespaceObject.__)('Open Media Library') + }) + }) + })] + }), isMobile && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MobileTabNavigation, { + categories: categories, + children: category => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MediaCategoryPanel, { + onInsert: onInsert, + rootClientId: rootClientId, + category: category + }) + })] + }); } /* harmony default export */ const media_tab = (MediaTab); @@ -43632,7 +47289,6 @@ __unstableInserterMenuExtension.Slot = inserter_menu_extension_Slot; /* harmony default export */ const inserter_menu_extension = (__unstableInserterMenuExtension); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/search-results.js - /** * WordPress dependencies */ @@ -43659,6 +47315,8 @@ __unstableInserterMenuExtension.Slot = inserter_menu_extension_Slot; + + const search_results_INITIAL_INSERTER_RESULTS = 9; /** * Shared reference to an empty array for cases where it is important to avoid @@ -43682,7 +47340,8 @@ function InserterSearchResults({ isDraggable = true, shouldFocusBlock = true, prioritizePatterns, - selectBlockOnInsert + selectBlockOnInsert, + isQuick }) { const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); const { @@ -43702,7 +47361,7 @@ function InserterSearchResults({ shouldFocusBlock, selectBlockOnInsert }); - const [blockTypes, blockTypeCategories, blockTypeCollections, onSelectBlockType] = use_block_types_state(destinationRootClientId, onInsertBlocks); + const [blockTypes, blockTypeCategories, blockTypeCollections, onSelectBlockType] = use_block_types_state(destinationRootClientId, onInsertBlocks, isQuick); const [patterns,, onClickPattern] = use_patterns_state(onInsertBlocks, destinationRootClientId); const filteredBlockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => { if (maxBlockPatterns === 0) { @@ -43743,62 +47402,90 @@ function InserterSearchResults({ }); const currentShownPatterns = (0,external_wp_compose_namespaceObject.useAsyncList)(currentShownBlockTypes.length === filteredBlockTypes.length ? filteredBlockPatterns : search_results_EMPTY_ARRAY); const hasItems = filteredBlockTypes.length > 0 || filteredBlockPatterns.length > 0; - const blocksUI = !!filteredBlockTypes.length && (0,external_React_.createElement)(panel, { - title: (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, null, (0,external_wp_i18n_namespaceObject.__)('Blocks')) - }, (0,external_React_.createElement)(block_types_list, { - items: currentShownBlockTypes, - onSelect: onSelectBlockType, - onHover: onHover, - label: (0,external_wp_i18n_namespaceObject.__)('Blocks'), - isDraggable: isDraggable - })); - const patternsUI = !!filteredBlockPatterns.length && (0,external_React_.createElement)(panel, { - title: (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, null, (0,external_wp_i18n_namespaceObject.__)('Block patterns')) - }, (0,external_React_.createElement)("div", { - className: "block-editor-inserter__quick-inserter-patterns" - }, (0,external_React_.createElement)(block_patterns_list, { - shownPatterns: currentShownPatterns, - blockPatterns: filteredBlockPatterns, - onClickPattern: onClickPattern, - onHover: onHoverPattern, - isDraggable: isDraggable - }))); - return (0,external_React_.createElement)(inserter_listbox, null, !showBlockDirectory && !hasItems && (0,external_React_.createElement)(no_results, null), prioritizePatterns ? patternsUI : blocksUI, !!filteredBlockTypes.length && !!filteredBlockPatterns.length && (0,external_React_.createElement)("div", { - className: "block-editor-inserter__quick-inserter-separator" - }), prioritizePatterns ? blocksUI : patternsUI, showBlockDirectory && (0,external_React_.createElement)(inserter_menu_extension.Slot, { - fillProps: { + const blocksUI = !!filteredBlockTypes.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(panel, { + title: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { + children: (0,external_wp_i18n_namespaceObject.__)('Blocks') + }), + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_types_list, { + items: currentShownBlockTypes, onSelect: onSelectBlockType, - onHover, - filterValue, - hasItems, - rootClientId: destinationRootClientId - } - }, fills => { - if (fills.length) { - return fills; - } - if (!hasItems) { - return (0,external_React_.createElement)(no_results, null); - } - return null; - })); + onHover: onHover, + label: (0,external_wp_i18n_namespaceObject.__)('Blocks'), + isDraggable: isDraggable + }) + }); + const patternsUI = !!filteredBlockPatterns.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(panel, { + title: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { + children: (0,external_wp_i18n_namespaceObject.__)('Block patterns') + }), + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-inserter__quick-inserter-patterns", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_patterns_list, { + shownPatterns: currentShownPatterns, + blockPatterns: filteredBlockPatterns, + onClickPattern: onClickPattern, + onHover: onHoverPattern, + isDraggable: isDraggable + }) + }) + }); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(inserter_listbox, { + children: [!showBlockDirectory && !hasItems && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results, {}), prioritizePatterns ? patternsUI : blocksUI, !!filteredBlockTypes.length && !!filteredBlockPatterns.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-inserter__quick-inserter-separator" + }), prioritizePatterns ? blocksUI : patternsUI, showBlockDirectory && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter_menu_extension.Slot, { + fillProps: { + onSelect: onSelectBlockType, + onHover, + filterValue, + hasItems, + rootClientId: destinationRootClientId + }, + children: fills => { + if (fills.length) { + return fills; + } + if (!hasItems) { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(no_results, {}); + } + return null; + } + })] + }); } /* harmony default export */ const search_results = (InserterSearchResults); -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/tabs.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js +/** + * WordPress dependencies + */ + + +const closeSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.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" + }) +}); +/* harmony default export */ const close_small = (closeSmall); +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/tabs.js /** * WordPress dependencies */ + + /** * Internal dependencies */ + + const { - Tabs + Tabs: tabs_Tabs } = unlock(external_wp_components_namespaceObject.privateApis); const blocksTab = { name: 'blocks', @@ -43816,29 +47503,46 @@ const mediaTab = { title: (0,external_wp_i18n_namespaceObject.__)('Media') }; function InserterTabs({ - showPatterns = false, - showMedia = false, onSelect, - tabsContents -}) { - const tabs = [blocksTab, showPatterns && patternsTab, showMedia && mediaTab].filter(Boolean); - return (0,external_React_.createElement)("div", { - className: "block-editor-inserter__tabs" - }, (0,external_React_.createElement)(Tabs, { - onSelect: onSelect - }, (0,external_React_.createElement)(Tabs.TabList, null, tabs.map(tab => (0,external_React_.createElement)(Tabs.Tab, { - key: tab.name, - tabId: tab.name - }, tab.title))), tabs.map(tab => (0,external_React_.createElement)(Tabs.TabPanel, { - key: tab.name, - tabId: tab.name, - focusable: false - }, tabsContents[tab.name])))); -} -/* harmony default export */ const tabs = (InserterTabs); + children, + onClose, + selectedTab +}, ref) { + const tabs = [blocksTab, patternsTab, mediaTab]; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-inserter__tabs", + ref: ref, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(tabs_Tabs, { + onSelect: onSelect, + selectedTabId: selectedTab, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-inserter__tablist-and-close-button", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + className: "block-editor-inserter__close-button", + icon: close_small, + label: (0,external_wp_i18n_namespaceObject.__)('Close block inserter'), + onClick: () => onClose(), + size: "small" + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tabs_Tabs.TabList, { + className: "block-editor-inserter__tablist", + children: tabs.map(tab => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tabs_Tabs.Tab, { + tabId: tab.name, + className: "block-editor-inserter__tab", + children: tab.title + }, tab.name)) + })] + }), tabs.map(tab => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tabs_Tabs.TabPanel, { + tabId: tab.name, + focusable: false, + className: "block-editor-inserter__tabpanel", + children: children + }, tab.name))] + }) + }); +} +/* harmony default export */ const tabs = ((0,external_wp_element_namespaceObject.forwardRef)(InserterTabs)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/menu.js - /** * External dependencies */ @@ -43867,6 +47571,9 @@ function InserterTabs({ + + +const NOOP = () => {}; function InserterMenu({ rootClientId, clientId, @@ -43876,14 +47583,19 @@ function InserterMenu({ showInserterHelpPanel, showMostUsedBlocks, __experimentalFilterValue = '', - shouldFocusBlock = true + shouldFocusBlock = true, + onPatternCategorySelection, + onClose, + __experimentalInitialTab, + __experimentalInitialCategory }, ref) { + const isZoomOutMode = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).__unstableGetEditorMode() === 'zoom-out', []); const [filterValue, setFilterValue, delayedFilterValue] = (0,external_wp_compose_namespaceObject.useDebouncedInput)(__experimentalFilterValue); const [hoveredItem, setHoveredItem] = (0,external_wp_element_namespaceObject.useState)(null); - const [selectedPatternCategory, setSelectedPatternCategory] = (0,external_wp_element_namespaceObject.useState)(null); + const [selectedPatternCategory, setSelectedPatternCategory] = (0,external_wp_element_namespaceObject.useState)(__experimentalInitialCategory); const [patternFilter, setPatternFilter] = (0,external_wp_element_namespaceObject.useState)('all'); const [selectedMediaCategory, setSelectedMediaCategory] = (0,external_wp_element_namespaceObject.useState)(null); - const [selectedTab, setSelectedTab] = (0,external_wp_element_namespaceObject.useState)(null); + const [selectedTab, setSelectedTab] = (0,external_wp_element_namespaceObject.useState)(__experimentalInitialTab); const [destinationRootClientId, onInsertBlocks, onToggleInsertionPoint] = use_insertion_point({ rootClientId, clientId, @@ -43891,22 +47603,19 @@ function InserterMenu({ insertionIndex: __experimentalInsertionIndex, shouldFocusBlock }); - const { - showPatterns - } = (0,external_wp_data_namespaceObject.useSelect)(select => { - const { - hasAllowedPatterns - } = unlock(select(store)); - return { - showPatterns: hasAllowedPatterns(destinationRootClientId) - }; - }, [destinationRootClientId]); - const mediaCategories = useMediaCategories(destinationRootClientId); - const showMedia = mediaCategories.length > 0; - const onInsert = (0,external_wp_element_namespaceObject.useCallback)((blocks, meta, shouldForceFocusBlock) => { - onInsertBlocks(blocks, meta, shouldForceFocusBlock); + const blockTypesTabRef = (0,external_wp_element_namespaceObject.useRef)(); + const onInsert = (0,external_wp_element_namespaceObject.useCallback)((blocks, meta, shouldForceFocusBlock, _rootClientId) => { + onInsertBlocks(blocks, meta, shouldForceFocusBlock, _rootClientId); onSelect(); - }, [onInsertBlocks, onSelect]); + + // Check for focus loss due to filtering blocks by selected block type + window.requestAnimationFrame(() => { + if (!shouldFocusBlock && !blockTypesTabRef?.current.contains(ref.current.ownerDocument.activeElement)) { + // There has been a focus loss, so focus the first button in the block types tab + blockTypesTabRef?.current.querySelector('button').focus(); + } + }); + }, [onInsertBlocks, onSelect, shouldFocusBlock]); const onInsertPattern = (0,external_wp_element_namespaceObject.useCallback)((blocks, patternName) => { onInsertBlocks(blocks, { patternName @@ -43914,7 +47623,7 @@ function InserterMenu({ onSelect(); }, [onInsertBlocks, onSelect]); const onHover = (0,external_wp_element_namespaceObject.useCallback)(item => { - onToggleInsertionPoint(!!item); + onToggleInsertionPoint(item); setHoveredItem(item); }, [onToggleInsertionPoint, setHoveredItem]); const onHoverPattern = (0,external_wp_element_namespaceObject.useCallback)(item => { @@ -43923,45 +47632,91 @@ function InserterMenu({ const onClickPatternCategory = (0,external_wp_element_namespaceObject.useCallback)((patternCategory, filter) => { setSelectedPatternCategory(patternCategory); setPatternFilter(filter); - }, [setSelectedPatternCategory]); - const blocksTab = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("div", { - className: "block-editor-inserter__block-list" - }, (0,external_React_.createElement)(block_types_tab, { - rootClientId: destinationRootClientId, - onInsert: onInsert, - onHover: onHover, - showMostUsedBlocks: showMostUsedBlocks - })), showInserterHelpPanel && (0,external_React_.createElement)("div", { - className: "block-editor-inserter__tips" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { - as: "h2" - }, (0,external_wp_i18n_namespaceObject.__)('A tip for using the block editor')), (0,external_React_.createElement)(tips, null))), [destinationRootClientId, onInsert, onHover, showMostUsedBlocks, showInserterHelpPanel]); - const patternsTab = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_React_.createElement)(block_patterns_tab, { - rootClientId: destinationRootClientId, - onInsert: onInsertPattern, - onSelectCategory: onClickPatternCategory, - selectedCategory: selectedPatternCategory - }), [destinationRootClientId, onInsertPattern, onClickPatternCategory, selectedPatternCategory]); - const mediaTab = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_React_.createElement)(media_tab, { - rootClientId: destinationRootClientId, - selectedCategory: selectedMediaCategory, - onSelectCategory: setSelectedMediaCategory, - onInsert: onInsert - }), [destinationRootClientId, onInsert, selectedMediaCategory, setSelectedMediaCategory]); - const inserterTabsContents = (0,external_wp_element_namespaceObject.useMemo)(() => ({ - blocks: blocksTab, - patterns: patternsTab, - media: mediaTab - }), [blocksTab, mediaTab, patternsTab]); - const searchRef = (0,external_wp_element_namespaceObject.useRef)(); - (0,external_wp_element_namespaceObject.useImperativeHandle)(ref, () => ({ - focusSearch: () => { - searchRef.current.focus(); + onPatternCategorySelection?.(); + }, [setSelectedPatternCategory, onPatternCategorySelection]); + const showPatternPanel = selectedTab === 'patterns' && !delayedFilterValue && !!selectedPatternCategory; + const showMediaPanel = selectedTab === 'media' && !!selectedMediaCategory; + const inserterSearch = (0,external_wp_element_namespaceObject.useMemo)(() => { + if (selectedTab === 'media') { + return null; } - })); - const showPatternPanel = selectedTab === 'patterns' && !delayedFilterValue && selectedPatternCategory; - const showAsTabs = !delayedFilterValue && (showPatterns || showMedia); - const showMediaPanel = selectedTab === 'media' && !delayedFilterValue && selectedMediaCategory; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { + __nextHasNoMarginBottom: true, + className: "block-editor-inserter__search", + onChange: value => { + if (hoveredItem) { + setHoveredItem(null); + } + setFilterValue(value); + }, + value: filterValue, + label: (0,external_wp_i18n_namespaceObject.__)('Search for blocks and patterns'), + placeholder: (0,external_wp_i18n_namespaceObject.__)('Search') + }), !!delayedFilterValue && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(search_results, { + filterValue: delayedFilterValue, + onSelect: onSelect, + onHover: onHover, + onHoverPattern: onHoverPattern, + rootClientId: rootClientId, + clientId: clientId, + isAppender: isAppender, + __experimentalInsertionIndex: __experimentalInsertionIndex, + showBlockDirectory: true, + shouldFocusBlock: shouldFocusBlock, + prioritizePatterns: selectedTab === 'patterns' + })] + }); + }, [selectedTab, hoveredItem, setHoveredItem, setFilterValue, filterValue, delayedFilterValue, onSelect, onHover, onHoverPattern, shouldFocusBlock, clientId, rootClientId, __experimentalInsertionIndex, isAppender]); + const blocksTab = (0,external_wp_element_namespaceObject.useMemo)(() => { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-inserter__block-list", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_types_tab, { + ref: blockTypesTabRef, + rootClientId: destinationRootClientId, + onInsert: onInsert, + onHover: onHover, + showMostUsedBlocks: showMostUsedBlocks + }) + }), showInserterHelpPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-inserter__tips", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { + as: "h2", + children: (0,external_wp_i18n_namespaceObject.__)('A tip for using the block editor') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tips, {})] + })] + }); + }, [destinationRootClientId, onInsert, onHover, showMostUsedBlocks, showInserterHelpPanel]); + const patternsTab = (0,external_wp_element_namespaceObject.useMemo)(() => { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_patterns_tab, { + rootClientId: destinationRootClientId, + onInsert: onInsertPattern, + onSelectCategory: onClickPatternCategory, + selectedCategory: selectedPatternCategory, + children: showPatternPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternCategoryPreviewPanel, { + rootClientId: destinationRootClientId, + onInsert: onInsertPattern, + onHover: onHoverPattern, + category: selectedPatternCategory, + patternFilter: patternFilter, + showTitlesAsTooltip: true + }) + }); + }, [destinationRootClientId, onHoverPattern, onInsertPattern, onClickPatternCategory, patternFilter, selectedPatternCategory, showPatternPanel]); + const mediaTab = (0,external_wp_element_namespaceObject.useMemo)(() => { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(media_tab, { + rootClientId: destinationRootClientId, + selectedCategory: selectedMediaCategory, + onSelectCategory: setSelectedMediaCategory, + onInsert: onInsert, + children: showMediaPanel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MediaCategoryPanel, { + rootClientId: destinationRootClientId, + onInsert: onInsert, + category: selectedMediaCategory + }) + }); + }, [destinationRootClientId, onInsert, selectedMediaCategory, setSelectedMediaCategory, showMediaPanel]); const handleSetSelectedTab = value => { // If no longer on patterns tab remove the category setting. if (value !== 'patterns') { @@ -43969,68 +47724,54 @@ function InserterMenu({ } setSelectedTab(value); }; - return (0,external_React_.createElement)("div", { - className: "block-editor-inserter__menu" - }, (0,external_React_.createElement)("div", { - className: classnames_default()('block-editor-inserter__main-area', { - 'show-as-tabs': showAsTabs - }) - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.SearchControl, { - __nextHasNoMarginBottom: true, - className: "block-editor-inserter__search", - onChange: value => { - if (hoveredItem) setHoveredItem(null); - setFilterValue(value); - }, - value: filterValue, - label: (0,external_wp_i18n_namespaceObject.__)('Search for blocks and patterns'), - placeholder: (0,external_wp_i18n_namespaceObject.__)('Search'), - ref: searchRef - }), !!delayedFilterValue && (0,external_React_.createElement)("div", { - className: "block-editor-inserter__no-tab-container" - }, (0,external_React_.createElement)(search_results, { - filterValue: delayedFilterValue, - onSelect: onSelect, - onHover: onHover, - onHoverPattern: onHoverPattern, - rootClientId: rootClientId, - clientId: clientId, - isAppender: isAppender, - __experimentalInsertionIndex: __experimentalInsertionIndex, - showBlockDirectory: true, - shouldFocusBlock: shouldFocusBlock - })), showAsTabs && (0,external_React_.createElement)(tabs, { - showPatterns: showPatterns, - showMedia: showMedia, - onSelect: handleSetSelectedTab, - tabsContents: inserterTabsContents - }), !delayedFilterValue && !showAsTabs && (0,external_React_.createElement)("div", { - className: "block-editor-inserter__no-tab-container" - }, blocksTab)), showMediaPanel && (0,external_React_.createElement)(MediaCategoryDialog, { - rootClientId: destinationRootClientId, - onInsert: onInsert, - category: selectedMediaCategory - }), showInserterHelpPanel && hoveredItem && (0,external_React_.createElement)(external_wp_components_namespaceObject.Popover, { - className: "block-editor-inserter__preview-container__popover", - placement: "right-start", - offset: 16, - focusOnMount: false, - animate: false - }, (0,external_React_.createElement)(preview_panel, { - item: hoveredItem - })), showPatternPanel && (0,external_React_.createElement)(PatternCategoryPreviewPanel, { - rootClientId: destinationRootClientId, - onInsert: onInsertPattern, - onHover: onHoverPattern, - category: selectedPatternCategory, - patternFilter: patternFilter, - showTitlesAsTooltip: true - })); + + // Focus first active tab, if any + const tabsRef = (0,external_wp_element_namespaceObject.useRef)(); + (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { + if (tabsRef.current) { + window.requestAnimationFrame(() => { + tabsRef.current.querySelector('[role="tab"][aria-selected="true"]')?.focus(); + }); + } + }, []); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: dist_clsx('block-editor-inserter__menu', { + 'show-panel': showPatternPanel || showMediaPanel, + 'is-zoom-out': isZoomOutMode + }), + ref: ref, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-inserter__main-area", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(tabs, { + ref: tabsRef, + onSelect: handleSetSelectedTab, + onClose: onClose, + selectedTab: selectedTab, + children: [inserterSearch, selectedTab === 'blocks' && !delayedFilterValue && blocksTab, selectedTab === 'patterns' && !delayedFilterValue && patternsTab, selectedTab === 'media' && mediaTab] + }) + }), showInserterHelpPanel && hoveredItem && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, { + className: "block-editor-inserter__preview-container__popover", + placement: "right-start", + offset: 16, + focusOnMount: false, + animate: false, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_panel, { + item: hoveredItem + }) + })] + }); +} +const PrivateInserterMenu = (0,external_wp_element_namespaceObject.forwardRef)(InserterMenu); +function PublicInserterMenu(props, ref) { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateInserterMenu, { + ...props, + onPatternCategorySelection: NOOP, + ref: ref + }); } -/* harmony default export */ const menu = ((0,external_wp_element_namespaceObject.forwardRef)(InserterMenu)); +/* harmony default export */ const menu = ((0,external_wp_element_namespaceObject.forwardRef)(PublicInserterMenu)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/quick-inserter.js - /** * External dependencies */ @@ -44052,6 +47793,8 @@ function InserterMenu({ + + const SEARCH_THRESHOLD = 6; const quick_inserter_SHOWN_BLOCK_TYPES = 6; const SHOWN_BLOCK_PATTERNS = 2; @@ -44073,7 +47816,7 @@ function QuickInserter({ isAppender, selectBlockOnInsert }); - const [blockTypes] = use_block_types_state(destinationRootClientId, onInsertBlocks); + const [blockTypes] = use_block_types_state(destinationRootClientId, onInsertBlocks, true); const [patterns] = use_patterns_state(onInsertBlocks, destinationRootClientId); const { setInserterIsOpened, @@ -44113,42 +47856,45 @@ function QuickInserter({ if (showPatterns) { maxBlockPatterns = prioritizePatterns ? SHOWN_BLOCK_PATTERNS_WITH_PRIORITIZATION : SHOWN_BLOCK_PATTERNS; } - return (0,external_React_.createElement)("div", { - className: classnames_default()('block-editor-inserter__quick-inserter', { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: dist_clsx('block-editor-inserter__quick-inserter', { 'has-search': showSearch, 'has-expand': setInserterIsOpened - }) - }, showSearch && (0,external_React_.createElement)(external_wp_components_namespaceObject.SearchControl, { - __nextHasNoMarginBottom: true, - className: "block-editor-inserter__search", - value: filterValue, - onChange: value => { - setFilterValue(value); - }, - label: (0,external_wp_i18n_namespaceObject.__)('Search for blocks and patterns'), - placeholder: (0,external_wp_i18n_namespaceObject.__)('Search') - }), (0,external_React_.createElement)("div", { - className: "block-editor-inserter__quick-inserter-results" - }, (0,external_React_.createElement)(search_results, { - filterValue: filterValue, - onSelect: onSelect, - rootClientId: rootClientId, - clientId: clientId, - isAppender: isAppender, - maxBlockPatterns: maxBlockPatterns, - maxBlockTypes: quick_inserter_SHOWN_BLOCK_TYPES, - isDraggable: false, - prioritizePatterns: prioritizePatterns, - selectBlockOnInsert: selectBlockOnInsert - })), setInserterIsOpened && (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - className: "block-editor-inserter__quick-inserter-expand", - onClick: onBrowseAll, - "aria-label": (0,external_wp_i18n_namespaceObject.__)('Browse all. This will open the main inserter panel in the editor toolbar.') - }, (0,external_wp_i18n_namespaceObject.__)('Browse all'))); + }), + children: [showSearch && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SearchControl, { + __nextHasNoMarginBottom: true, + className: "block-editor-inserter__search", + value: filterValue, + onChange: value => { + setFilterValue(value); + }, + label: (0,external_wp_i18n_namespaceObject.__)('Search for blocks and patterns'), + placeholder: (0,external_wp_i18n_namespaceObject.__)('Search') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-inserter__quick-inserter-results", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(search_results, { + filterValue: filterValue, + onSelect: onSelect, + rootClientId: rootClientId, + clientId: clientId, + isAppender: isAppender, + maxBlockPatterns: maxBlockPatterns, + maxBlockTypes: quick_inserter_SHOWN_BLOCK_TYPES, + isDraggable: false, + prioritizePatterns: prioritizePatterns, + selectBlockOnInsert: selectBlockOnInsert, + isQuick: true + }) + }), setInserterIsOpened && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + className: "block-editor-inserter__quick-inserter-expand", + onClick: onBrowseAll, + "aria-label": (0,external_wp_i18n_namespaceObject.__)('Browse all. This will open the main inserter panel in the editor toolbar.'), + children: (0,external_wp_i18n_namespaceObject.__)('Browse all') + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/index.js - /** * External dependencies */ @@ -44172,6 +47918,7 @@ function QuickInserter({ + const defaultRenderToggle = ({ onToggle, disabled, @@ -44207,7 +47954,7 @@ const defaultRenderToggle = ({ onClick(event); } } - return (0,external_React_.createElement)(Wrapper, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Wrapper, { icon: library_plus, label: label, tooltipPosition: "bottom", @@ -44298,7 +48045,7 @@ class PrivateInserter extends external_wp_element_namespaceObject.Component { selectBlockOnInsert } = this.props; if (isQuick) { - return (0,external_React_.createElement)(QuickInserter, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(QuickInserter, { onSelect: blocks => { const firstBlock = Array.isArray(blocks) && blocks?.length ? blocks[0] : blocks; if (onSelectOrClose && typeof onSelectOrClose === 'function') { @@ -44313,7 +48060,7 @@ class PrivateInserter extends external_wp_element_namespaceObject.Component { selectBlockOnInsert: selectBlockOnInsert }); } - return (0,external_React_.createElement)(menu, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(menu, { onSelect: () => { onClose(); }, @@ -44337,9 +48084,9 @@ class PrivateInserter extends external_wp_element_namespaceObject.Component { onToggle: insertOnlyAllowedBlock }); } - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Dropdown, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { className: "block-editor-inserter", - contentClassName: classnames_default()('block-editor-inserter__popover', { + contentClassName: dist_clsx('block-editor-inserter__popover', { 'is-quick': isQuick }), popoverProps: { @@ -44506,7 +48253,7 @@ const ComposedPrivateInserter = (0,external_wp_compose_namespaceObject.compose)( clientId }) => hasItems || !isAppender && !rootClientId && !clientId)])(PrivateInserter); const Inserter = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { - return (0,external_React_.createElement)(ComposedPrivateInserter, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComposedPrivateInserter, { ref: ref, ...props }); @@ -44514,7 +48261,6 @@ const Inserter = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) /* harmony default export */ const inserter = (Inserter); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/default-block-appender/index.js - /** * External dependencies */ @@ -44538,6 +48284,8 @@ const Inserter = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) * Zero width non-breaking space, used as padding for the paragraph when it is * empty. */ + + const ZWNBSP = '\ufeff'; function DefaultBlockAppender({ rootClientId @@ -44574,42 +48322,43 @@ function DefaultBlockAppender({ insertDefaultBlock(undefined, rootClientId); startTyping(); }; - return (0,external_React_.createElement)("div", { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { "data-root-client-id": rootClientId || '', - className: classnames_default()('block-editor-default-block-appender', { + className: dist_clsx('block-editor-default-block-appender', { 'has-visible-prompt': showPrompt - }) - }, (0,external_React_.createElement)("p", { - tabIndex: "0" - // We want this element to be styled as a paragraph by themes. - // eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role - , - role: "button", - "aria-label": (0,external_wp_i18n_namespaceObject.__)('Add default block') - // A wrapping container for this one already has the wp-block className. - , - className: "block-editor-default-block-appender__content", - onKeyDown: event => { - if (external_wp_keycodes_namespaceObject.ENTER === event.keyCode || external_wp_keycodes_namespaceObject.SPACE === event.keyCode) { - onAppend(); - } - }, - onClick: () => onAppend(), - onFocus: () => { - if (showPrompt) { - onAppend(); - } - } - }, showPrompt ? value : ZWNBSP), (0,external_React_.createElement)(inserter, { - rootClientId: rootClientId, - position: "bottom right", - isAppender: true, - __experimentalIsQuick: true - })); + }), + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { + tabIndex: "0" + // We want this element to be styled as a paragraph by themes. + // eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role + , + role: "button", + "aria-label": (0,external_wp_i18n_namespaceObject.__)('Add default block') + // A wrapping container for this one already has the wp-block className. + , + className: "block-editor-default-block-appender__content", + onKeyDown: event => { + if (external_wp_keycodes_namespaceObject.ENTER === event.keyCode || external_wp_keycodes_namespaceObject.SPACE === event.keyCode) { + onAppend(); + } + }, + onClick: () => onAppend(), + onFocus: () => { + if (showPrompt) { + onAppend(); + } + }, + children: showPrompt ? value : ZWNBSP + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter, { + rootClientId: rootClientId, + position: "bottom right", + isAppender: true, + __experimentalIsQuick: true + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/button-block-appender/index.js - /** * External dependencies */ @@ -44628,13 +48377,15 @@ function DefaultBlockAppender({ * Internal dependencies */ + + function ButtonBlockAppender({ rootClientId, className, onFocus, tabIndex }, ref) { - return (0,external_React_.createElement)(inserter, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter, { position: "bottom center", rootClientId: rootClientId, __experimentalIsQuick: true, @@ -44654,25 +48405,31 @@ function ButtonBlockAppender({ label = (0,external_wp_i18n_namespaceObject._x)('Add block', 'Generic label for block inserter button'); } const isToggleButton = !hasSingleBlockType; - let inserterButton = (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { + let inserterButton = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Button, { ref: ref, onFocus: onFocus, tabIndex: tabIndex, - className: classnames_default()(className, 'block-editor-button-block-appender'), + className: dist_clsx(className, 'block-editor-button-block-appender'), onClick: onToggle, "aria-haspopup": isToggleButton ? 'true' : undefined, - "aria-expanded": isToggleButton ? isOpen : undefined, + "aria-expanded": isToggleButton ? isOpen : undefined + // Disable reason: There shouldn't be a case where this button is disabled but not visually hidden. + // eslint-disable-next-line no-restricted-syntax + , disabled: disabled, - label: label - }, !hasSingleBlockType && (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { - as: "span" - }, label), (0,external_React_.createElement)(build_module_icon, { - icon: library_plus - })); + label: label, + children: [!hasSingleBlockType && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { + as: "span", + children: label + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { + icon: library_plus + })] + }); if (isToggleButton || hasSingleBlockType) { - inserterButton = (0,external_React_.createElement)(external_wp_components_namespaceObject.Tooltip, { - text: label - }, inserterButton); + inserterButton = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { + text: label, + children: inserterButton + }); } return inserterButton; }, @@ -44699,7 +48456,6 @@ const ButtonBlockerAppender = (0,external_wp_element_namespaceObject.forwardRef) /* harmony default export */ const button_block_appender = ((0,external_wp_element_namespaceObject.forwardRef)(ButtonBlockAppender)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list-appender/index.js - /** * External dependencies */ @@ -44717,6 +48473,7 @@ const ButtonBlockerAppender = (0,external_wp_element_namespaceObject.forwardRef) + function DefaultAppender({ rootClientId }) { @@ -44724,13 +48481,13 @@ function DefaultAppender({ if (canInsertDefaultBlock) { // Render the default block appender if the context supports use // of the default appender. - return (0,external_React_.createElement)(DefaultBlockAppender, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DefaultBlockAppender, { rootClientId: rootClientId }); } // Fallback in case the default block can't be inserted. - return (0,external_React_.createElement)(button_block_appender, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(button_block_appender, { rootClientId: rootClientId, className: "block-list-appender__toggle" }); @@ -44753,7 +48510,7 @@ function BlockListAppender({ // the DnD utility hooks. return isBlockInsertionPointVisible() && rootClientId === insertionPoint?.rootClientId && getBlockCount(rootClientId) === 0; }, [rootClientId]); - return (0,external_React_.createElement)(TagName + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TagName // A `tabIndex` is used on the wrapping `div` element in order to // force a focus event to occur when an appender `button` element // is clicked. In some browsers (Firefox, Safari), button clicks do @@ -44764,7 +48521,7 @@ function BlockListAppender({ // See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus , { tabIndex: -1, - className: classnames_default()('block-list-appender wp-block', className, { + className: dist_clsx('block-list-appender wp-block', className, { 'is-drag-over': isDragOver }) // Needed in case the whole editor is content editable (for multi @@ -44781,14 +48538,14 @@ function BlockListAppender({ // the correct margin is applied, especially for classic themes which // have commonly targeted that attribute for margins. , - "data-block": true - }, CustomAppender ? (0,external_React_.createElement)(CustomAppender, null) : (0,external_React_.createElement)(DefaultAppender, { - rootClientId: rootClientId - })); + "data-block": true, + children: CustomAppender ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CustomAppender, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DefaultAppender, { + rootClientId: rootClientId + }) + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-popover/inbetween.js - /** * External dependencies */ @@ -44808,6 +48565,7 @@ function BlockListAppender({ + const inbetween_MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER; const InsertionPointOpenRef = (0,external_wp_element_namespaceObject.createContext)(); function BlockPopoverInbetween({ @@ -44953,7 +48711,7 @@ function BlockPopoverInbetween({ // Firefox and Safari, it is not reliable. // // See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Popover, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, { ref: popoverScrollRef, animate: false, anchor: popoverAnchor, @@ -44966,22 +48724,22 @@ function BlockPopoverInbetween({ // Forces a remount of the popover when its position changes // This makes sure the popover doesn't animate from its previous position. , - key: nextClientId + '--' + rootClientId, ...props, - className: classnames_default()('block-editor-block-popover', 'block-editor-block-popover__inbetween', props.className), + className: dist_clsx('block-editor-block-popover', 'block-editor-block-popover__inbetween', props.className), resize: false, flip: false, placement: "overlay", - variant: "unstyled" - }, (0,external_React_.createElement)("div", { - className: "block-editor-block-popover__inbetween-container" - }, children)); + variant: "unstyled", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-block-popover__inbetween-container", + children: children + }) + }, nextClientId + '--' + rootClientId); /* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */ } /* harmony default export */ const inbetween = (BlockPopoverInbetween); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-popover/drop-zone.js - /** * WordPress dependencies */ @@ -44994,6 +48752,7 @@ function BlockPopoverInbetween({ */ + const animateVariants = { hide: { opacity: 0, @@ -45029,24 +48788,23 @@ function BlockDropZonePopover({ }; }, []); const reducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); - return (0,external_React_.createElement)(block_popover, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(cover, { clientId: clientId, - __unstableCoverTarget: true, __unstablePopoverSlot: __unstablePopoverSlot, __unstableContentRef: __unstableContentRef, - className: "block-editor-block-popover__drop-zone" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { - "data-testid": "block-popover-drop-zone", - initial: reducedMotion ? animateVariants.show : animateVariants.hide, - animate: animateVariants.show, - exit: reducedMotion ? animateVariants.show : animateVariants.exit, - className: "block-editor-block-popover__drop-zone-foreground" - })); + className: "block-editor-block-popover__drop-zone", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { + "data-testid": "block-popover-drop-zone", + initial: reducedMotion ? animateVariants.show : animateVariants.hide, + animate: animateVariants.show, + exit: reducedMotion ? animateVariants.show : animateVariants.exit, + className: "block-editor-block-popover__drop-zone-foreground" + }) + }); } /* harmony default export */ const drop_zone = (BlockDropZonePopover); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/insertion-point.js - /** * External dependencies */ @@ -45067,6 +48825,8 @@ function BlockDropZonePopover({ + + const insertion_point_InsertionPointOpenRef = (0,external_wp_element_namespaceObject.createContext)(); function InbetweenInsertionPointPopover({ __unstablePopoverSlot, @@ -45187,48 +48947,51 @@ function InbetweenInsertionPointPopover({ return null; } const orientationClassname = orientation === 'horizontal' || operation === 'group' ? 'is-horizontal' : 'is-vertical'; - const className = classnames_default()('block-editor-block-list__insertion-point', orientationClassname); - return (0,external_React_.createElement)(inbetween, { + const className = dist_clsx('block-editor-block-list__insertion-point', orientationClassname); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inbetween, { previousClientId: previousClientId, nextClientId: nextClientId, __unstablePopoverSlot: __unstablePopoverSlot, __unstableContentRef: __unstableContentRef, operation: operation, - nearestSide: nearestSide - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { - layout: !disableMotion, - initial: disableMotion ? 'rest' : 'start', - animate: "rest", - whileHover: "hover", - whileTap: "pressed", - exit: "start", - ref: ref, - tabIndex: -1, - onClick: onClick, - onFocus: onFocus, - className: classnames_default()(className, { - 'is-with-inserter': isInserterShown - }), - onHoverEnd: maybeHideInserterPoint - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { - variants: lineVariants, - className: "block-editor-block-list__insertion-point-indicator", - "data-testid": "block-list-insertion-point-indicator" - }), isInserterShown && (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { - variants: inserterVariants, - className: classnames_default()('block-editor-block-list__insertion-point-inserter') - }, (0,external_React_.createElement)(inserter, { - position: "bottom center", - clientId: nextClientId, - rootClientId: rootClientId, - __experimentalIsQuick: true, - onToggle: isOpen => { - openRef.current = isOpen; - }, - onSelectOrClose: () => { - openRef.current = false; - } - })))); + nearestSide: nearestSide, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, { + layout: !disableMotion, + initial: disableMotion ? 'rest' : 'start', + animate: "rest", + whileHover: "hover", + whileTap: "pressed", + exit: "start", + ref: ref, + tabIndex: -1, + onClick: onClick, + onFocus: onFocus, + className: dist_clsx(className, { + 'is-with-inserter': isInserterShown + }), + onHoverEnd: maybeHideInserterPoint, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { + variants: lineVariants, + className: "block-editor-block-list__insertion-point-indicator", + "data-testid": "block-list-insertion-point-indicator" + }), isInserterShown && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { + variants: inserterVariants, + className: dist_clsx('block-editor-block-list__insertion-point-inserter'), + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter, { + position: "bottom center", + clientId: nextClientId, + rootClientId: rootClientId, + __experimentalIsQuick: true, + onToggle: isOpen => { + openRef.current = isOpen; + }, + onSelectOrClose: () => { + openRef.current = false; + } + }) + })] + }) + }); } function InsertionPoint(props) { const { @@ -45259,12 +49022,11 @@ function InsertionPoint(props) { * Render a popover that overlays the block when the desired operation is to replace it. * Otherwise, render a popover in between blocks for the indication of inserting between them. */ - return insertionPoint.operation === 'replace' ? (0,external_React_.createElement)(drop_zone + return insertionPoint.operation === 'replace' ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(drop_zone // Force remount to trigger the animation. , { - key: `${insertionPoint.rootClientId}-${insertionPoint.index}`, ...props - }) : (0,external_React_.createElement)(InbetweenInsertionPointPopover, { + }, `${insertionPoint.rootClientId}-${insertionPoint.index}`) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InbetweenInsertionPointPopover, { operation: insertionPoint.operation, nearestSide: insertionPoint.nearestSide, ...props @@ -45307,7 +49069,9 @@ function useInBetweenInserter() { return; } function onMouseMove(event) { - if (openRef.current) { + // openRef is the reference to the insertion point between blocks. + // If the reference is not set or the insertion point is already open, return. + if (openRef === undefined || openRef.current) { return; } @@ -45390,7 +49154,6 @@ function useInBetweenInserter() { } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/with-client-id.js - /** * WordPress dependencies */ @@ -45400,11 +49163,12 @@ function useInBetweenInserter() { * Internal dependencies */ + const withClientId = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => props => { const { clientId } = useBlockEditContext(); - return (0,external_React_.createElement)(WrappedComponent, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ...props, clientId: clientId }); @@ -45412,7 +49176,6 @@ const withClientId = (0,external_wp_compose_namespaceObject.createHigherOrderCom /* harmony default export */ const with_client_id = (withClientId); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/button-block-appender.js - /** * External dependencies */ @@ -45423,6 +49186,7 @@ const withClientId = (0,external_wp_compose_namespaceObject.createHigherOrderCom */ + const button_block_appender_ButtonBlockAppender = ({ clientId, showSeparator, @@ -45430,8 +49194,8 @@ const button_block_appender_ButtonBlockAppender = ({ onAddBlock, isToggle }) => { - return (0,external_React_.createElement)(button_block_appender, { - className: classnames_default()({ + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(button_block_appender, { + className: dist_clsx({ 'block-list-appender__toggle': isToggle }), rootClientId: clientId, @@ -45443,7 +49207,6 @@ const button_block_appender_ButtonBlockAppender = ({ /* harmony default export */ const inner_blocks_button_block_appender = (with_client_id(button_block_appender_ButtonBlockAppender)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/default-block-appender.js - /** * WordPress dependencies */ @@ -45456,10 +49219,11 @@ const button_block_appender_ButtonBlockAppender = ({ + const default_block_appender_DefaultBlockAppender = ({ clientId }) => { - return (0,external_React_.createElement)(DefaultBlockAppender, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DefaultBlockAppender, { rootClientId: clientId }); }; @@ -45514,11 +49278,11 @@ function useShallowMemo(value) { * in inner blocks. * @param {string[]} prioritizedInserterBlocks Block names and/or block variations to be prioritized in the inserter, in the format {blockName}/{variationName}. * @param {?WPDirectInsertBlock} defaultBlock The default block to insert: [ blockName, { blockAttributes } ]. - * @param {?Function|boolean} directInsert If a default block should be inserted directly by the appender. + * @param {?boolean} directInsert If a default block should be inserted directly by the appender. * * @param {?WPDirectInsertBlock} __experimentalDefaultBlock A deprecated prop for the default block to insert: [ blockName, { blockAttributes } ]. Use `defaultBlock` instead. * - * @param {?Function|boolean} __experimentalDirectInsert A deprecated prop for whether a default block should be inserted directly by the appender. Use `directInsert` instead. + * @param {?boolean} __experimentalDirectInsert A deprecated prop for whether a default block should be inserted directly by the appender. Use `directInsert` instead. * * @param {string} [templateLock] The template lock specified for the inner * blocks component. (e.g. "all") @@ -45533,9 +49297,6 @@ function useNestedSettingsUpdate(clientId, parentLock, allowedBlocks, prioritize // Instead of adding a useSelect mapping here, please add to the useSelect // mapping in InnerBlocks! Every subscription impacts performance. - const { - updateBlockListSettings - } = (0,external_wp_data_namespaceObject.useDispatch)(store); const registry = (0,external_wp_data_namespaceObject.useRegistry)(); // Implementors often pass a new array on every render, @@ -45591,6 +49352,12 @@ function useNestedSettingsUpdate(clientId, parentLock, allowedBlocks, prioritize if (directInsert !== undefined) { newSettings.directInsert = directInsert; } + if (newSettings.directInsert !== undefined && typeof newSettings.directInsert !== 'boolean') { + external_wp_deprecated_default()('Using `Function` as a `directInsert` argument', { + alternative: '`boolean` values', + since: '6.5' + }); + } // Batch updates to block list settings to avoid triggering cascading renders // for each container block included in a tree and optimize initial render. @@ -45599,20 +49366,20 @@ function useNestedSettingsUpdate(clientId, parentLock, allowedBlocks, prioritize // we batch all the updatedBlockListSettings in a single "data" batch // which results in a single re-render. if (!pendingSettingsUpdates.get(registry)) { - pendingSettingsUpdates.set(registry, []); + pendingSettingsUpdates.set(registry, {}); } - pendingSettingsUpdates.get(registry).push([clientId, newSettings]); + pendingSettingsUpdates.get(registry)[clientId] = newSettings; window.queueMicrotask(() => { - if (pendingSettingsUpdates.get(registry)?.length) { - registry.batch(() => { - pendingSettingsUpdates.get(registry).forEach(args => { - updateBlockListSettings(...args); - }); - pendingSettingsUpdates.set(registry, []); - }); + const settings = pendingSettingsUpdates.get(registry); + if (Object.keys(settings).length) { + const { + updateBlockListSettings + } = registry.dispatch(store); + updateBlockListSettings(settings); + pendingSettingsUpdates.set(registry, {}); } }); - }, [clientId, _allowedBlocks, _prioritizedInserterBlocks, _templateLock, defaultBlock, directInsert, __experimentalDefaultBlock, __experimentalDirectInsert, captureToolbars, orientation, updateBlockListSettings, layout, registry]); + }, [clientId, _allowedBlocks, _prioritizedInserterBlocks, _templateLock, defaultBlock, directInsert, __experimentalDefaultBlock, __experimentalDirectInsert, captureToolbars, orientation, layout, registry]); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/use-inner-block-template-sync.js @@ -45931,7 +49698,9 @@ function useOnBlockDrop(targetRootClientId, targetBlockIndex, options = {}) { } = (0,external_wp_data_namespaceObject.useDispatch)(store); const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const insertOrReplaceBlocks = (0,external_wp_element_namespaceObject.useCallback)((blocks, updateSelection = true, initialPosition = 0, clientIdsToReplace = []) => { - if (!Array.isArray(blocks)) blocks = [blocks]; + if (!Array.isArray(blocks)) { + blocks = [blocks]; + } const clientIds = getBlockOrder(targetRootClientId); const clientId = clientIds[targetBlockIndex]; const blocksClientIds = blocks.map(block => block.clientId); @@ -46423,7 +50192,6 @@ function useBlockDropZone({ } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/index.js - /** * External dependencies */ @@ -46452,15 +50220,17 @@ function useBlockDropZone({ + const inner_blocks_EMPTY_OBJECT = {}; function BlockContext({ children, clientId }) { const context = useBlockContext(clientId); - return (0,external_React_.createElement)(BlockContextProvider, { - value: context - }, children); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockContextProvider, { + value: context, + children: children + }); } const BlockListItemsMemo = (0,external_wp_element_namespaceObject.memo)(BlockListItems); @@ -46514,7 +50284,7 @@ function UncontrolledInnerBlocks(props) { // For controlled inner blocks, we don't want a change in blocks to // re-render the blocks list. - const items = (0,external_React_.createElement)(BlockListItemsMemo, { + const items = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockListItemsMemo, { rootClientId: clientId, renderAppender: renderAppender, __experimentalAppenderTagName: __experimentalAppenderTagName, @@ -46525,9 +50295,10 @@ function UncontrolledInnerBlocks(props) { if (Object.keys(blockType.providesContext).length === 0) { return items; } - return (0,external_React_.createElement)(BlockContext, { - clientId: clientId - }, items); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockContext, { + clientId: clientId, + children: items + }); } /** @@ -46541,7 +50312,7 @@ function UncontrolledInnerBlocks(props) { */ function ControlledInnerBlocks(props) { useBlockSync(props); - return (0,external_React_.createElement)(UncontrolledInnerBlocks, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(UncontrolledInnerBlocks, { ...props }); } @@ -46549,11 +50320,12 @@ const ForwardedInnerBlocks = (0,external_wp_element_namespaceObject.forwardRef)( const innerBlocksProps = useInnerBlocksProps({ ref }, props); - return (0,external_React_.createElement)("div", { - className: "block-editor-inner-blocks" - }, (0,external_React_.createElement)("div", { - ...innerBlocksProps - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-inner-blocks", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + ...innerBlocksProps + }) + }); }); /** @@ -46583,9 +50355,6 @@ function useInnerBlocksProps(props = {}, options = {}) { __unstableLayoutClassNames: layoutClassNames = '' } = useBlockEditContext(); const selected = (0,external_wp_data_namespaceObject.useSelect)(select => { - if (!clientId) { - return {}; - } const { getBlockName, isBlockSelected, @@ -46595,8 +50364,24 @@ function useInnerBlocksProps(props = {}, options = {}) { getBlockRootClientId, getBlockEditingMode, getBlockSettings, - isDragging + isDragging, + getSettings } = unlock(select(store)); + let _isDropZoneDisabled; + // In zoom out mode, we want to disable the drop zone for the sections. + // The inner blocks belonging to the section drop zone is + // already disabled by the blocks themselves being disabled. + if (__unstableGetEditorMode() === 'zoom-out') { + const { + sectionRootClientId + } = unlock(getSettings()); + _isDropZoneDisabled = clientId !== sectionRootClientId; + } + if (!clientId) { + return { + isDropZoneDisabled: _isDropZoneDisabled + }; + } const { hasBlockSupport, getBlockType @@ -46606,6 +50391,9 @@ function useInnerBlocksProps(props = {}, options = {}) { const blockEditingMode = getBlockEditingMode(clientId); const parentClientId = getBlockRootClientId(clientId); const [defaultLayout] = getBlockSettings(clientId, 'layout'); + if (_isDropZoneDisabled !== undefined) { + _isDropZoneDisabled = blockEditingMode === 'disabled'; + } return { __experimentalCaptureToolbars: hasBlockSupport(blockName, '__experimentalExposeControlsToChildren', false), hasOverlay: blockName !== 'core/template' && !isBlockSelected(clientId) && !hasSelectedInnerBlock(clientId, true) && enableClickThrough && !isDragging(), @@ -46613,7 +50401,7 @@ function useInnerBlocksProps(props = {}, options = {}) { blockType: getBlockType(blockName), parentLock: getTemplateLock(parentClientId), parentClientId, - isDropZoneDisabled: blockEditingMode === 'disabled', + isDropZoneDisabled: _isDropZoneDisabled, defaultLayout }; }, [clientId]); @@ -46630,10 +50418,9 @@ function useInnerBlocksProps(props = {}, options = {}) { const blockDropZoneRef = useBlockDropZone({ dropZoneElement, rootClientId: clientId, - parentClientId, - isDisabled: isDropZoneDisabled + parentClientId }); - const ref = (0,external_wp_compose_namespaceObject.useMergeRefs)([props.ref, __unstableDisableDropZone ? null : blockDropZoneRef]); + const ref = (0,external_wp_compose_namespaceObject.useMergeRefs)([props.ref, __unstableDisableDropZone || isDropZoneDisabled ? null : blockDropZoneRef]); const innerBlocksProps = { __experimentalCaptureToolbars, layout, @@ -46647,13 +50434,13 @@ function useInnerBlocksProps(props = {}, options = {}) { return { ...props, ref, - className: classnames_default()(props.className, 'block-editor-block-list__layout', __unstableDisableLayoutClassNames ? '' : layoutClassNames, { + className: dist_clsx(props.className, 'block-editor-block-list__layout', __unstableDisableLayoutClassNames ? '' : layoutClassNames, { 'has-overlay': hasOverlay }), - children: clientId ? (0,external_React_.createElement)(InnerBlocks, { + children: clientId ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InnerBlocks, { ...innerBlocksProps, clientId: clientId - }) : (0,external_React_.createElement)(BlockListItems, { + }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockListItems, { ...options }) }; @@ -46671,7 +50458,6 @@ ForwardedInnerBlocks.Content = () => useInnerBlocksProps.save().children; /* harmony default export */ const inner_blocks = (ForwardedInnerBlocks); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/observe-typing/index.js - /** * WordPress dependencies */ @@ -46690,6 +50476,7 @@ ForwardedInnerBlocks.Content = () => useInnerBlocksProps.save().children; * * @type {Set} */ + const KEY_DOWN_ELIGIBLE_KEY_CODES = new Set([external_wp_keycodes_namespaceObject.UP, external_wp_keycodes_namespaceObject.RIGHT, external_wp_keycodes_namespaceObject.DOWN, external_wp_keycodes_namespaceObject.LEFT, external_wp_keycodes_namespaceObject.ENTER, external_wp_keycodes_namespaceObject.BACKSPACE]); /** @@ -46763,16 +50550,13 @@ function useMouseMoveTypingReset() { */ function useTypingObserver() { const { - isTyping, - hasInlineToolbar + isTyping } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { - isTyping: _isTyping, - getSettings + isTyping: _isTyping } = select(store); return { - isTyping: _isTyping(), - hasInlineToolbar: getSettings().hasInlineToolbar + isTyping: _isTyping() }; }, []); const { @@ -46842,9 +50626,7 @@ function useTypingObserver() { } node.addEventListener('focus', stopTypingOnNonTextField); node.addEventListener('keydown', stopTypingOnEscapeKey); - if (!hasInlineToolbar) { - ownerDocument.addEventListener('selectionchange', stopTypingOnSelectionUncollapse); - } + ownerDocument.addEventListener('selectionchange', stopTypingOnSelectionUncollapse); return () => { defaultView.clearTimeout(timerId); node.removeEventListener('focus', stopTypingOnNonTextField); @@ -46887,15 +50669,16 @@ function useTypingObserver() { node.removeEventListener('keypress', startTypingInTextField); node.removeEventListener('keydown', startTypingInTextField); }; - }, [isTyping, hasInlineToolbar, startTyping, stopTyping]); + }, [isTyping, startTyping, stopTyping]); return (0,external_wp_compose_namespaceObject.useMergeRefs)([ref1, ref2]); } function ObserveTyping({ children }) { - return (0,external_React_.createElement)("div", { - ref: useTypingObserver() - }, children); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + ref: useTypingObserver(), + children: children + }); } /** @@ -46904,7 +50687,6 @@ function ObserveTyping({ /* harmony default export */ const observe_typing = (ObserveTyping); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/index.js - /** * External dependencies */ @@ -46930,6 +50712,8 @@ function ObserveTyping({ + + const block_list_IntersectionObserver = (0,external_wp_element_namespaceObject.createContext)(); const pendingBlockVisibilityUpdatesPerRegistry = new WeakMap(); function block_list_Root({ @@ -46940,20 +50724,24 @@ function block_list_Root({ const { isOutlineMode, isFocusMode, - editorMode + editorMode, + temporarilyEditingAsBlocks } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getSettings, - __unstableGetEditorMode - } = select(store); + __unstableGetEditorMode, + getTemporarilyEditingAsBlocks, + isTyping + } = unlock(select(store)); const { outlineMode, focusMode } = getSettings(); return { - isOutlineMode: outlineMode, + isOutlineMode: outlineMode && !isTyping(), isFocusMode: focusMode, - editorMode: __unstableGetEditorMode() + editorMode: __unstableGetEditorMode(), + temporarilyEditingAsBlocks: getTemporarilyEditingAsBlocks() }; }, []); const registry = (0,external_wp_data_namespaceObject.useRegistry)(); @@ -46989,17 +50777,20 @@ function block_list_Root({ }, []); const innerBlocksProps = useInnerBlocksProps({ ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([useBlockSelectionClearer(), useInBetweenInserter(), useTypingObserver()]), - className: classnames_default()('is-root-container', className, { + className: dist_clsx('is-root-container', className, { 'is-outline-mode': isOutlineMode, 'is-focus-mode': isFocusMode && isLargeViewport, 'is-navigate-mode': editorMode === 'navigation' }) }, settings); - return (0,external_React_.createElement)(block_list_IntersectionObserver.Provider, { - value: intersectionObserver - }, (0,external_React_.createElement)("div", { - ...innerBlocksProps - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(block_list_IntersectionObserver.Provider, { + value: intersectionObserver, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + ...innerBlocksProps + }), !!temporarilyEditingAsBlocks && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StopEditingAsBlocksOnOutsideSelect, { + clientId: temporarilyEditingAsBlocks + })] + }); } function StopEditingAsBlocksOnOutsideSelect({ clientId @@ -47022,12 +50813,15 @@ function StopEditingAsBlocksOnOutsideSelect({ return null; } function BlockList(settings) { - return (0,external_React_.createElement)(Provider, { - value: DEFAULT_BLOCK_EDIT_CONTEXT - }, (0,external_React_.createElement)(block_list_Root, { - ...settings - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Provider, { + value: DEFAULT_BLOCK_EDIT_CONTEXT, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_list_Root, { + ...settings + }) + }); } +const block_list_EMPTY_ARRAY = []; +const block_list_EMPTY_SET = new Set(); function Items({ placeholder, rootClientId, @@ -47043,55 +50837,61 @@ function Items({ order, selectedBlocks, visibleBlocks, - temporarilyEditingAsBlocks, shouldRenderAppender } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { + getSettings, getBlockOrder, getSelectedBlockClientId, getSelectedBlockClientIds, __unstableGetVisibleBlocks, - __unstableGetTemporarilyEditingAsBlocks, getTemplateLock, getBlockEditingMode, __unstableGetEditorMode } = select(store); + const _order = getBlockOrder(rootClientId); + if (getSettings().__unstableIsPreviewMode) { + return { + order: _order, + selectedBlocks: block_list_EMPTY_ARRAY, + visibleBlocks: block_list_EMPTY_SET + }; + } const selectedBlockClientId = getSelectedBlockClientId(); return { - order: getBlockOrder(rootClientId), + order: _order, selectedBlocks: getSelectedBlockClientIds(), visibleBlocks: __unstableGetVisibleBlocks(), - temporarilyEditingAsBlocks: __unstableGetTemporarilyEditingAsBlocks(), - shouldRenderAppender: hasAppender && (hasCustomAppender ? !getTemplateLock(rootClientId) && getBlockEditingMode(rootClientId) !== 'disabled' && __unstableGetEditorMode() !== 'zoom-out' : rootClientId === selectedBlockClientId || !rootClientId && !selectedBlockClientId) + shouldRenderAppender: hasAppender && __unstableGetEditorMode() !== 'zoom-out' && (hasCustomAppender ? !getTemplateLock(rootClientId) && getBlockEditingMode(rootClientId) !== 'disabled' : rootClientId === selectedBlockClientId || !rootClientId && !selectedBlockClientId && !_order.length) }; }, [rootClientId, hasAppender, hasCustomAppender]); - return (0,external_React_.createElement)(LayoutProvider, { - value: layout - }, order.map(clientId => (0,external_React_.createElement)(external_wp_data_namespaceObject.AsyncModeProvider, { - key: clientId, - value: - // Only provide data asynchronously if the block is - // not visible and not selected. - !visibleBlocks.has(clientId) && !selectedBlocks.includes(clientId) - }, (0,external_React_.createElement)(block_list_block, { - rootClientId: rootClientId, - clientId: clientId - }))), order.length < 1 && placeholder, !!temporarilyEditingAsBlocks && (0,external_React_.createElement)(StopEditingAsBlocksOnOutsideSelect, { - clientId: temporarilyEditingAsBlocks - }), shouldRenderAppender && (0,external_React_.createElement)(BlockListAppender, { - tagName: __experimentalAppenderTagName, - rootClientId: rootClientId, - CustomAppender: CustomAppender - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(LayoutProvider, { + value: layout, + children: [order.map(clientId => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_data_namespaceObject.AsyncModeProvider, { + value: + // Only provide data asynchronously if the block is + // not visible and not selected. + !visibleBlocks.has(clientId) && !selectedBlocks.includes(clientId), + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_list_block, { + rootClientId: rootClientId, + clientId: clientId + }) + }, clientId)), order.length < 1 && placeholder, shouldRenderAppender && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockListAppender, { + tagName: __experimentalAppenderTagName, + rootClientId: rootClientId, + CustomAppender: CustomAppender + })] + }); } function BlockListItems(props) { // This component needs to always be synchronous as it's the one changing // the async mode depending on the block selection. - return (0,external_React_.createElement)(external_wp_data_namespaceObject.AsyncModeProvider, { - value: false - }, (0,external_React_.createElement)(Items, { - ...props - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_data_namespaceObject.AsyncModeProvider, { + value: false, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Items, { + ...props + }) + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/use-block-toolbar-popover-props.js @@ -47301,7 +51101,6 @@ function useSelectedBlockToolProps(clientId) { } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/empty-block-inserter.js - /** * External dependencies */ @@ -47314,6 +51113,7 @@ function useSelectedBlockToolProps(clientId) { + function EmptyBlockInserter({ clientId, __unstableContentRef @@ -47328,25 +51128,24 @@ function EmptyBlockInserter({ contentElement: __unstableContentRef?.current, clientId }); - return (0,external_React_.createElement)(block_popover, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(cover, { clientId: capturingClientId || clientId, - __unstableCoverTarget: true, bottomClientId: lastClientId, - className: classnames_default()('block-editor-block-list__block-side-inserter-popover', { + className: dist_clsx('block-editor-block-list__block-side-inserter-popover', { 'is-insertion-point-visible': isInsertionPointVisible }), __unstableContentRef: __unstableContentRef, - resize: false, - shift: false, - ...popoverProps - }, (0,external_React_.createElement)("div", { - className: "block-editor-block-list__empty-block-inserter" - }, (0,external_React_.createElement)(inserter, { - position: "bottom right", - rootClientId: rootClientId, - clientId: clientId, - __experimentalIsQuick: true - }))); + ...popoverProps, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-block-list__empty-block-inserter", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter, { + position: "bottom right", + rootClientId: rootClientId, + clientId: clientId, + __experimentalIsQuick: true + }) + }) + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-draggable/use-scroll-when-dragging.js @@ -47432,7 +51231,6 @@ function useScrollWhenDragging() { } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-draggable/index.js - /** * WordPress dependencies */ @@ -47450,6 +51248,7 @@ function useScrollWhenDragging() { + const BlockDraggable = ({ appendToOwnerDocument, children, @@ -47484,7 +51283,7 @@ const BlockDraggable = ({ const variation = getActiveBlockVariation(blockName, getBlockAttributes(clientIds[0])); return { srcRootClientId: rootClientId, - isDraggable: canMoveBlocks(clientIds, rootClientId), + isDraggable: canMoveBlocks(clientIds), icon: variation?.icon || _getBlockType(blockName)?.icon, visibleInserter: isBlockInsertionPointVisible(), getBlockType: _getBlockType @@ -47575,7 +51374,7 @@ const BlockDraggable = ({ srcClientIds: clientIds, srcRootClientId }; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Draggable, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Draggable, { appendToOwnerDocument: appendToOwnerDocument, cloneClassname: cloneClassname, __experimentalTransferDataType: "wp-blocks", @@ -47604,51 +51403,54 @@ const BlockDraggable = ({ __experimentalDragComponent: // Check against `undefined` so that `null` can be used to disable // the default drag component. - dragComponent !== undefined ? dragComponent : (0,external_React_.createElement)(BlockDraggableChip, { + dragComponent !== undefined ? dragComponent : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockDraggableChip, { count: clientIds.length, icon: icon, fadeWhenDisabled: true }), - elementId: elementId - }, ({ - onDraggableStart, - onDraggableEnd - }) => { - return children({ - draggable: true, - onDragStart: onDraggableStart, - onDragEnd: onDraggableEnd - }); + elementId: elementId, + children: ({ + onDraggableStart, + onDraggableEnd + }) => { + return children({ + draggable: true, + onDragStart: onDraggableStart, + onDragEnd: onDraggableEnd + }); + } }); }; /* harmony default export */ const block_draggable = (BlockDraggable); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-up.js - /** * WordPress dependencies */ -const chevronUp = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const chevronUp = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z" -})); + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z" + }) +}); /* harmony default export */ const chevron_up = (chevronUp); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-down.js - /** * WordPress dependencies */ -const chevronDown = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const chevronDown = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" -})); + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" + }) +}); /* harmony default export */ const chevron_down = (chevronDown); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-mover/mover-description.js @@ -47862,7 +51664,6 @@ function getMultiBlockMoverDescription(selectedCount, firstIndex, isFirst, isLas } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-mover/button.js - /** * External dependencies */ @@ -47884,6 +51685,9 @@ function getMultiBlockMoverDescription(selectedCount, firstIndex, isFirst, isLas + + + const getArrowIcon = (direction, orientation) => { if (direction === 'up') { if (orientation === 'horizontal') { @@ -47921,6 +51725,9 @@ const BlockMoverButton = (0,external_wp_element_namespaceObject.forwardRef)(({ const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockMoverButton); const normalizedClientIds = Array.isArray(clientIds) ? clientIds : [clientIds]; const blocksCount = normalizedClientIds.length; + const { + disabled + } = props; const { blockType, isDisabled, @@ -47950,7 +51757,7 @@ const BlockMoverButton = (0,external_wp_element_namespaceObject.forwardRef)(({ } = getBlockListSettings(blockRootClientId) || {}; return { blockType: block ? (0,external_wp_blocks_namespaceObject.getBlockType)(block.name) : null, - isDisabled: direction === 'up' ? isFirstBlock : isLastBlock, + isDisabled: disabled || (direction === 'up' ? isFirstBlock : isLastBlock), rootClientId: blockRootClientId, firstIndex: firstBlockIndex, isFirst: isFirstBlock, @@ -47970,29 +51777,32 @@ const BlockMoverButton = (0,external_wp_element_namespaceObject.forwardRef)(({ } }; const descriptionId = `block-editor-block-mover-button__description-${instanceId}`; - return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - ref: ref, - className: classnames_default()('block-editor-block-mover-button', `is-${direction}-button`), - icon: getArrowIcon(direction, orientation), - label: getMovementDirectionLabel(direction, orientation), - "aria-describedby": descriptionId, - ...props, - onClick: isDisabled ? null : onClick, - disabled: isDisabled, - __experimentalIsFocusable: true - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { - id: descriptionId - }, getBlockMoverDescription(blocksCount, blockType && blockType.title, firstIndex, isFirst, isLast, direction === 'up' ? -1 : 1, orientation))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + ref: ref, + className: dist_clsx('block-editor-block-mover-button', `is-${direction}-button`), + icon: getArrowIcon(direction, orientation), + label: getMovementDirectionLabel(direction, orientation), + "aria-describedby": descriptionId, + ...props, + onClick: isDisabled ? null : onClick, + disabled: isDisabled, + __experimentalIsFocusable: true + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { + id: descriptionId, + children: getBlockMoverDescription(blocksCount, blockType && blockType.title, firstIndex, isFirst, isLast, direction === 'up' ? -1 : 1, orientation) + })] + }); }); const BlockMoverUpButton = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { - return (0,external_React_.createElement)(BlockMoverButton, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockMoverButton, { direction: "up", ref: ref, ...props }); }); const BlockMoverDownButton = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { - return (0,external_React_.createElement)(BlockMoverButton, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockMoverButton, { direction: "down", ref: ref, ...props @@ -48000,7 +51810,6 @@ const BlockMoverDownButton = (0,external_wp_element_namespaceObject.forwardRef)( }); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-mover/index.js - /** * External dependencies */ @@ -48021,9 +51830,13 @@ const BlockMoverDownButton = (0,external_wp_element_namespaceObject.forwardRef)( + + function BlockMover({ clientIds, - hideDragHandle + hideDragHandle, + isBlockMoverUpButtonDisabled, + isBlockMoverDownButtonDisabled }) { const { canMove, @@ -48046,7 +51859,7 @@ function BlockMover({ const lastIndex = getBlockIndex(normalizedClientIds[normalizedClientIds.length - 1]); const blockOrder = getBlockOrder(_rootClientId); return { - canMove: canMoveBlocks(clientIds, _rootClientId), + canMove: canMoveBlocks(clientIds), rootClientId: _rootClientId, isFirst: firstIndex === 0, isLast: lastIndex === blockOrder.length - 1, @@ -48057,32 +51870,41 @@ function BlockMover({ return null; } const dragHandleLabel = (0,external_wp_i18n_namespaceObject.__)('Drag'); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarGroup, { - className: classnames_default()('block-editor-block-mover', { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ToolbarGroup, { + className: dist_clsx('block-editor-block-mover', { 'is-horizontal': orientation === 'horizontal' - }) - }, !hideDragHandle && (0,external_React_.createElement)(block_draggable, { - clientIds: clientIds, - fadeWhenDisabled: true - }, draggableProps => (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - icon: drag_handle, - className: "block-editor-block-mover__drag-handle", - "aria-hidden": "true", - label: dragHandleLabel - // Should not be able to tab to drag handle as this - // button can only be used with a pointer device. - , - tabIndex: "-1", - ...draggableProps - })), (0,external_React_.createElement)("div", { - className: "block-editor-block-mover__move-button-container" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarItem, null, itemProps => (0,external_React_.createElement)(BlockMoverUpButton, { - clientIds: clientIds, - ...itemProps - })), (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarItem, null, itemProps => (0,external_React_.createElement)(BlockMoverDownButton, { - clientIds: clientIds, - ...itemProps - })))); + }), + children: [!hideDragHandle && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_draggable, { + clientIds: clientIds, + fadeWhenDisabled: true, + children: draggableProps => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + icon: drag_handle, + className: "block-editor-block-mover__drag-handle", + "aria-hidden": "true", + label: dragHandleLabel + // Should not be able to tab to drag handle as this + // button can only be used with a pointer device. + , + tabIndex: "-1", + ...draggableProps + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-block-mover__move-button-container", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { + children: itemProps => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockMoverUpButton, { + disabled: isBlockMoverUpButtonDisabled, + clientIds: clientIds, + ...itemProps + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { + children: itemProps => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockMoverDownButton, { + disabled: isBlockMoverDownButtonDisabled, + clientIds: clientIds, + ...itemProps + }) + })] + })] + }); } /** @@ -48251,7 +52073,6 @@ function useShowHoveredOrFocusedGestures({ } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-parent-selector/index.js - /** * WordPress dependencies */ @@ -48275,6 +52096,7 @@ function useShowHoveredOrFocusedGestures({ * * @return {Component} Parent block selector. */ + function BlockParentSelector() { const { selectBlock @@ -48314,41 +52136,41 @@ function BlockParentSelector() { if (!isVisible) { return null; } - return (0,external_React_.createElement)("div", { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-editor-block-parent-selector", - key: firstParentClientId, ref: nodeRef, - ...showHoveredOrFocusedGestures - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, { - className: "block-editor-block-parent-selector__button", - onClick: () => selectBlock(firstParentClientId), - label: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Name of the block's parent. */ - (0,external_wp_i18n_namespaceObject.__)('Select parent block: %s'), blockInformation?.title), - showTooltip: true, - icon: (0,external_React_.createElement)(block_icon, { - icon: blockInformation?.icon + ...showHoveredOrFocusedGestures, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { + className: "block-editor-block-parent-selector__button", + onClick: () => selectBlock(firstParentClientId), + label: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Name of the block's parent. */ + (0,external_wp_i18n_namespaceObject.__)('Select parent block: %s'), blockInformation?.title), + showTooltip: true, + icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { + icon: blockInformation?.icon + }) }) - })); + }, firstParentClientId); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/copy.js - /** * WordPress dependencies */ -const copy_copy = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const copy_copy = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - fillRule: "evenodd", - clipRule: "evenodd", - d: "M5 4.5h11a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5ZM3 5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm17 3v10.75c0 .69-.56 1.25-1.25 1.25H6v1.5h12.75a2.75 2.75 0 0 0 2.75-2.75V8H20Z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M5 4.5h11a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5ZM3 5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm17 3v10.75c0 .69-.56 1.25-1.25 1.25H6v1.5h12.75a2.75 2.75 0 0 0 2.75-2.75V8H20Z" + }) +}); /* harmony default export */ const library_copy = (copy_copy); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/preview-block-popover.js - /** * WordPress dependencies */ @@ -48359,29 +52181,35 @@ const copy_copy = (0,external_React_.createElement)(external_wp_primitives_names * Internal dependencies */ + + function PreviewBlockPopover({ blocks }) { - return (0,external_React_.createElement)("div", { - className: "block-editor-block-switcher__popover__preview__parent" - }, (0,external_React_.createElement)("div", { - className: "block-editor-block-switcher__popover__preview__container" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Popover, { - className: "block-editor-block-switcher__preview__popover", - placement: "bottom-start", - focusOnMount: false - }, (0,external_React_.createElement)("div", { - className: "block-editor-block-switcher__preview" - }, (0,external_React_.createElement)("div", { - className: "block-editor-block-switcher__preview-title" - }, (0,external_wp_i18n_namespaceObject.__)('Preview')), (0,external_React_.createElement)(block_preview, { - viewportWidth: 500, - blocks: blocks - }))))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-block-switcher__popover__preview__parent", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-block-switcher__popover__preview__container", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, { + className: "block-editor-block-switcher__preview__popover", + placement: "bottom-start", + focusOnMount: false, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-block-switcher__preview", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-block-switcher__preview-title", + children: (0,external_wp_i18n_namespaceObject.__)('Preview') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_preview, { + viewportWidth: 500, + blocks: blocks + })] + }) + }) + }) + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/block-variation-transformations.js - /** * WordPress dependencies */ @@ -48396,6 +52224,9 @@ function PreviewBlockPopover({ + + + const block_variation_transformations_EMPTY_OBJECT = {}; function useBlockVariationTransforms({ clientIds, @@ -48406,7 +52237,6 @@ function useBlockVariationTransforms({ blockVariationTransformations } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { - getBlockRootClientId, getBlockAttributes, canRemoveBlocks } = select(store); @@ -48414,8 +52244,7 @@ function useBlockVariationTransforms({ getActiveBlockVariation, getBlockVariations } = select(external_wp_blocks_namespaceObject.store); - const rootClientId = getBlockRootClientId(Array.isArray(clientIds) ? clientIds[0] : clientIds); - const canRemove = canRemoveBlocks(clientIds, rootClientId); + const canRemove = canRemoveBlocks(clientIds); // Only handle single selected blocks for now. if (blocks.length !== 1 || !canRemove) { return block_variation_transformations_EMPTY_OBJECT; @@ -48439,16 +52268,17 @@ const BlockVariationTransformations = ({ blocks }) => { const [hoveredTransformItemName, setHoveredTransformItemName] = (0,external_wp_element_namespaceObject.useState)(); - return (0,external_React_.createElement)(external_React_.Fragment, null, hoveredTransformItemName && (0,external_React_.createElement)(PreviewBlockPopover, { - blocks: (0,external_wp_blocks_namespaceObject.cloneBlock)(blocks[0], transformations.find(({ - name - }) => name === hoveredTransformItemName).attributes) - }), transformations?.map(item => (0,external_React_.createElement)(BlockVariationTranformationItem, { - key: item.name, - item: item, - onSelect: onSelect, - setHoveredTransformItemName: setHoveredTransformItemName - }))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [hoveredTransformItemName && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewBlockPopover, { + blocks: (0,external_wp_blocks_namespaceObject.cloneBlock)(blocks[0], transformations.find(({ + name + }) => name === hoveredTransformItemName).attributes) + }), transformations?.map(item => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockVariationTranformationItem, { + item: item, + onSelect: onSelect, + setHoveredTransformItemName: setHoveredTransformItemName + }, item.name))] + }); }; function BlockVariationTranformationItem({ item, @@ -48460,23 +52290,23 @@ function BlockVariationTranformationItem({ icon, title } = item; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuItem, { className: (0,external_wp_blocks_namespaceObject.getBlockMenuDefaultClassName)(name), onClick: event => { event.preventDefault(); onSelect(name); }, onMouseLeave: () => setHoveredTransformItemName(null), - onMouseEnter: () => setHoveredTransformItemName(name) - }, (0,external_React_.createElement)(block_icon, { - icon: icon, - showColors: true - }), title); + onMouseEnter: () => setHoveredTransformItemName(name), + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { + icon: icon, + showColors: true + }), title] + }); } /* harmony default export */ const block_variation_transformations = (BlockVariationTransformations); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/block-transformations-menu.js - /** * WordPress dependencies */ @@ -48502,6 +52332,9 @@ function BlockVariationTranformationItem({ * @param {Object[]} possibleBlockTransformations The available block transformations. * @return {Record} The grouped block transformations. */ + + + function useGroupedTransforms(possibleBlockTransformations) { const priorityContentTranformationBlocks = { 'core/paragraph': 1, @@ -48564,40 +52397,42 @@ const BlockTransformationsMenu = ({ // We have to check if both content transformations(priority and rest) are set // in order to create a separate MenuGroup for them. const hasBothContentTransformations = priorityTextTransformations.length && restTransformations.length; - const restTransformItems = !!restTransformations.length && (0,external_React_.createElement)(RestTransformationItems, { + const restTransformItems = !!restTransformations.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RestTransformationItems, { restTransformations: restTransformations, onSelect: onSelect, setHoveredTransformItemName: setHoveredTransformItemName }); - return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, { - label: (0,external_wp_i18n_namespaceObject.__)('Transform to'), - className: className - }, hoveredTransformItemName && (0,external_React_.createElement)(PreviewBlockPopover, { - blocks: (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, hoveredTransformItemName) - }), !!possibleBlockVariationTransformations?.length && (0,external_React_.createElement)(block_variation_transformations, { - transformations: possibleBlockVariationTransformations, - blocks: blocks, - onSelect: onSelectVariation - }), priorityTextTransformations.map(item => (0,external_React_.createElement)(BlockTranformationItem, { - key: item.name, - item: item, - onSelect: onSelect, - setHoveredTransformItemName: setHoveredTransformItemName - })), !hasBothContentTransformations && restTransformItems), !!hasBothContentTransformations && (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, { - className: className - }, restTransformItems)); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { + label: (0,external_wp_i18n_namespaceObject.__)('Transform to'), + className: className, + children: [hoveredTransformItemName && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewBlockPopover, { + blocks: (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, hoveredTransformItemName) + }), !!possibleBlockVariationTransformations?.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_variation_transformations, { + transformations: possibleBlockVariationTransformations, + blocks: blocks, + onSelect: onSelectVariation + }), priorityTextTransformations.map(item => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockTranformationItem, { + item: item, + onSelect: onSelect, + setHoveredTransformItemName: setHoveredTransformItemName + }, item.name)), !hasBothContentTransformations && restTransformItems] + }), !!hasBothContentTransformations && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { + className: className, + children: restTransformItems + })] + }); }; function RestTransformationItems({ restTransformations, onSelect, setHoveredTransformItemName }) { - return restTransformations.map(item => (0,external_React_.createElement)(BlockTranformationItem, { - key: item.name, + return restTransformations.map(item => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockTranformationItem, { item: item, onSelect: onSelect, setHoveredTransformItemName: setHoveredTransformItemName - })); + }, item.name)); } function BlockTranformationItem({ item, @@ -48610,7 +52445,7 @@ function BlockTranformationItem({ title, isDisabled } = item; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuItem, { className: (0,external_wp_blocks_namespaceObject.getBlockMenuDefaultClassName)(name), onClick: event => { event.preventDefault(); @@ -48618,11 +52453,12 @@ function BlockTranformationItem({ }, disabled: isDisabled, onMouseLeave: () => setHoveredTransformItemName(null), - onMouseEnter: () => setHoveredTransformItemName(name) - }, (0,external_React_.createElement)(block_icon, { - icon: icon, - showColors: true - }), title); + onMouseEnter: () => setHoveredTransformItemName(name), + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { + icon: icon, + showColors: true + }), title] + }); } /* harmony default export */ const block_transformations_menu = (BlockTransformationsMenu); @@ -48806,7 +52642,6 @@ function useStylesForBlocks({ } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-styles/menu-items.js - /** * WordPress dependencies */ @@ -48817,6 +52652,8 @@ function useStylesForBlocks({ * Internal dependencies */ + + const menu_items_noop = () => {}; function BlockStylesMenuItems({ clientId, @@ -48833,23 +52670,25 @@ function BlockStylesMenuItems({ if (!stylesToRender || stylesToRender.length === 0) { return null; } - return (0,external_React_.createElement)(external_React_.Fragment, null, stylesToRender.map(style => { - const menuItemText = style.label || style.name; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { - key: style.name, - icon: activeStyle.name === style.name ? library_check : null, - onClick: () => onSelect(style) - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, { - as: "span", - limit: 18, - ellipsizeMode: "tail", - truncate: true - }, menuItemText)); - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: stylesToRender.map(style => { + const menuItemText = style.label || style.name; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { + icon: activeStyle.name === style.name ? library_check : null, + onClick: () => onSelect(style), + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { + as: "span", + limit: 18, + ellipsizeMode: "tail", + truncate: true, + children: menuItemText + }) + }, style.name); + }) + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/block-styles-menu.js - /** * WordPress dependencies */ @@ -48860,6 +52699,7 @@ function BlockStylesMenuItems({ * Internal dependencies */ + function BlockStylesMenu({ hoveredBlock, onSwitch @@ -48867,13 +52707,14 @@ function BlockStylesMenu({ const { clientId } = hoveredBlock; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)('Styles'), - className: "block-editor-block-switcher__styles__menugroup" - }, (0,external_React_.createElement)(BlockStylesMenuItems, { - clientId: clientId, - onSwitch: onSwitch - })); + className: "block-editor-block-switcher__styles__menugroup", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockStylesMenuItems, { + clientId: clientId, + onSwitch: onSwitch + }) + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/utils.js @@ -48901,12 +52742,18 @@ const getMatchingBlockByName = (block, selectedBlockName, consumedBlocks = new S innerBlocks = [] } = block; // Check if block has been consumed already. - if (consumedBlocks.has(clientId)) return; - if (name === selectedBlockName) return block; + if (consumedBlocks.has(clientId)) { + return; + } + if (name === selectedBlockName) { + return block; + } // Try to find a matching block from InnerBlocks recursively. for (const innerBlock of innerBlocks) { const match = getMatchingBlockByName(innerBlock, selectedBlockName, consumedBlocks); - if (match) return match; + if (match) { + return match; + } } }; @@ -48922,9 +52769,13 @@ const getMatchingBlockByName = (block, selectedBlockName, consumedBlocks = new S */ const getRetainedBlockAttributes = (name, attributes) => { const contentAttributes = (0,external_wp_blocks_namespaceObject.__experimentalGetBlockAttributesNamesByRole)(name, 'content'); - if (!contentAttributes?.length) return attributes; + if (!contentAttributes?.length) { + return attributes; + } return contentAttributes.reduce((_accumulator, attribute) => { - if (attributes[attribute]) _accumulator[attribute] = attributes[attribute]; + if (attributes[attribute]) { + _accumulator[attribute] = attributes[attribute]; + } return _accumulator; }, {}); }; @@ -48982,7 +52833,9 @@ const getPatternTransformedBlocks = (selectedBlocks, patternBlocks) => { let isMatch = false; for (const patternBlock of _patternBlocks) { const match = getMatchingBlockByName(patternBlock, selectedBlock.name, consumedBlocks); - if (!match) continue; + if (!match) { + continue; + } isMatch = true; consumedBlocks.add(match.clientId); // We update (mutate) the matching pattern block. @@ -48991,7 +52844,9 @@ const getPatternTransformedBlocks = (selectedBlocks, patternBlocks) => { break; } // Bail eary if a selected block has not been matched. - if (!isMatch) return; + if (!isMatch) { + return; + } } return _patternBlocks; }; @@ -49027,7 +52882,6 @@ const useTransformedPatterns = (patterns, selectedBlocks) => { /* harmony default export */ const use_transformed_patterns = (useTransformedPatterns); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/pattern-transformations-menu.js - /** * WordPress dependencies */ @@ -49043,6 +52897,8 @@ const useTransformedPatterns = (patterns, selectedBlocks) => { + + const { CompositeV2: pattern_transformations_menu_Composite, CompositeItemV2: pattern_transformations_menu_CompositeItem, @@ -49055,53 +52911,61 @@ function PatternTransformationsMenu({ }) { const [showTransforms, setShowTransforms] = (0,external_wp_element_namespaceObject.useState)(false); const patterns = use_transformed_patterns(statePatterns, blocks); - if (!patterns.length) return null; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, { - className: "block-editor-block-switcher__pattern__transforms__menugroup" - }, showTransforms && (0,external_React_.createElement)(PreviewPatternsPopover, { - patterns: patterns, - onSelect: onSelect - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { - onClick: event => { - event.preventDefault(); - setShowTransforms(!showTransforms); - }, - icon: chevron_right - }, (0,external_wp_i18n_namespaceObject.__)('Patterns'))); + if (!patterns.length) { + return null; + } + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { + className: "block-editor-block-switcher__pattern__transforms__menugroup", + children: [showTransforms && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewPatternsPopover, { + patterns: patterns, + onSelect: onSelect + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { + onClick: event => { + event.preventDefault(); + setShowTransforms(!showTransforms); + }, + icon: chevron_right, + children: (0,external_wp_i18n_namespaceObject.__)('Patterns') + })] + }); } function PreviewPatternsPopover({ patterns, onSelect }) { - return (0,external_React_.createElement)("div", { - className: "block-editor-block-switcher__popover__preview__parent" - }, (0,external_React_.createElement)("div", { - className: "block-editor-block-switcher__popover__preview__container" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Popover, { - className: "block-editor-block-switcher__preview__popover", - position: "bottom right" - }, (0,external_React_.createElement)("div", { - className: "block-editor-block-switcher__preview is-pattern-list-preview" - }, (0,external_React_.createElement)(pattern_transformations_menu_BlockPatternsList, { - patterns: patterns, - onSelect: onSelect - }))))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-block-switcher__popover__preview__parent", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-block-switcher__popover__preview__container", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, { + className: "block-editor-block-switcher__preview__popover", + position: "bottom right", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-block-switcher__preview is-pattern-list-preview", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(pattern_transformations_menu_BlockPatternsList, { + patterns: patterns, + onSelect: onSelect + }) + }) + }) + }) + }); } function pattern_transformations_menu_BlockPatternsList({ patterns, onSelect }) { const composite = pattern_transformations_menu_useCompositeStore(); - return (0,external_React_.createElement)(pattern_transformations_menu_Composite, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(pattern_transformations_menu_Composite, { store: composite, role: "listbox", className: "block-editor-block-switcher__preview-patterns-container", - "aria-label": (0,external_wp_i18n_namespaceObject.__)('Patterns list') - }, patterns.map(pattern => (0,external_React_.createElement)(pattern_transformations_menu_BlockPattern, { - key: pattern.name, - pattern: pattern, - onSelect: onSelect - }))); + "aria-label": (0,external_wp_i18n_namespaceObject.__)('Patterns list'), + children: patterns.map(pattern => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(pattern_transformations_menu_BlockPattern, { + pattern: pattern, + onSelect: onSelect + }, pattern.name)) + }); } function pattern_transformations_menu_BlockPattern({ pattern, @@ -49110,29 +52974,32 @@ function pattern_transformations_menu_BlockPattern({ // TODO check pattern/preview width... const baseClassName = 'block-editor-block-switcher__preview-patterns-container'; const descriptionId = (0,external_wp_compose_namespaceObject.useInstanceId)(pattern_transformations_menu_BlockPattern, `${baseClassName}-list__item-description`); - return (0,external_React_.createElement)("div", { - className: `${baseClassName}-list__list-item` - }, (0,external_React_.createElement)(pattern_transformations_menu_CompositeItem, { - render: (0,external_React_.createElement)("div", { - role: "option", - "aria-label": pattern.title, - "aria-describedby": pattern.description ? descriptionId : undefined, - className: `${baseClassName}-list__item` - }), - onClick: () => onSelect(pattern.transformedBlocks) - }, (0,external_React_.createElement)(block_preview, { - blocks: pattern.transformedBlocks, - viewportWidth: pattern.viewportWidth || 500 - }), (0,external_React_.createElement)("div", { - className: `${baseClassName}-list__item-title` - }, pattern.title)), !!pattern.description && (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { - id: descriptionId - }, pattern.description)); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: `${baseClassName}-list__list-item`, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(pattern_transformations_menu_CompositeItem, { + render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + role: "option", + "aria-label": pattern.title, + "aria-describedby": pattern.description ? descriptionId : undefined, + className: `${baseClassName}-list__item` + }), + onClick: () => onSelect(pattern.transformedBlocks), + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_preview, { + blocks: pattern.transformedBlocks, + viewportWidth: pattern.viewportWidth || 500 + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: `${baseClassName}-list__item-title`, + children: pattern.title + })] + }), !!pattern.description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { + id: descriptionId, + children: pattern.description + })] + }); } /* harmony default export */ const pattern_transformations_menu = (PatternTransformationsMenu); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/index.js - /** * WordPress dependencies */ @@ -49152,11 +53019,15 @@ function pattern_transformations_menu_BlockPattern({ + + + function BlockSwitcherDropdownMenuContents({ onClose, clientIds, hasBlockStyles, - canRemove + canRemove, + isUsingBindings }) { const { replaceBlocks, @@ -49222,39 +53093,49 @@ function BlockSwitcherDropdownMenuContents({ const hasBlockOrBlockVariationTransforms = hasPossibleBlockTransformations || hasPossibleBlockVariationTransformations; const hasContents = hasBlockStyles || hasBlockOrBlockVariationTransforms || hasPatternTransformation; if (!hasContents) { - return (0,external_React_.createElement)("p", { - className: "block-editor-block-switcher__no-transforms" - }, (0,external_wp_i18n_namespaceObject.__)('No transforms.')); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { + className: "block-editor-block-switcher__no-transforms", + children: (0,external_wp_i18n_namespaceObject.__)('No transforms.') + }); } - return (0,external_React_.createElement)("div", { - className: "block-editor-block-switcher__container" - }, hasPatternTransformation && (0,external_React_.createElement)(pattern_transformations_menu, { - blocks: blocks, - patterns: patterns, - onSelect: transformedBlocks => { - onPatternTransform(transformedBlocks); - onClose(); - } - }), hasBlockOrBlockVariationTransforms && (0,external_React_.createElement)(block_transformations_menu, { - className: "block-editor-block-switcher__transforms__menugroup", - possibleBlockTransformations: possibleBlockTransformations, - possibleBlockVariationTransformations: blockVariationTransformations, - blocks: blocks, - onSelect: name => { - onBlockTransform(name); - onClose(); - }, - onSelectVariation: name => { - onBlockVariationTransform(name); - onClose(); - } - }), hasBlockStyles && (0,external_React_.createElement)(BlockStylesMenu, { - hoveredBlock: blocks[0], - onSwitch: onClose - })); + const connectedBlockDescription = isSingleBlock ? (0,external_wp_i18n_namespaceObject._x)('This block is connected.', 'block toolbar button label and description') : (0,external_wp_i18n_namespaceObject._x)('These blocks are connected.', 'block toolbar button label and description'); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-block-switcher__container", + children: [hasPatternTransformation && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(pattern_transformations_menu, { + blocks: blocks, + patterns: patterns, + onSelect: transformedBlocks => { + onPatternTransform(transformedBlocks); + onClose(); + } + }), hasBlockOrBlockVariationTransforms && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_transformations_menu, { + className: "block-editor-block-switcher__transforms__menugroup", + possibleBlockTransformations: possibleBlockTransformations, + possibleBlockVariationTransformations: blockVariationTransformations, + blocks: blocks, + onSelect: name => { + onBlockTransform(name); + onClose(); + }, + onSelectVariation: name => { + onBlockVariationTransform(name); + onClose(); + } + }), hasBlockStyles && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockStylesMenu, { + hoveredBlock: blocks[0], + onSwitch: onClose + }), isUsingBindings && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { + className: "block-editor-block-switcher__binding-indicator", + children: connectedBlockDescription + }) + })] + }); } const BlockSwitcher = ({ - clientIds + clientIds, + disabled, + isUsingBindings }) => { const { canRemove, @@ -49265,7 +53146,6 @@ const BlockSwitcher = ({ isTemplate } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { - getBlockRootClientId, getBlocksByClientId, getBlockAttributes, canRemoveBlocks @@ -49281,7 +53161,6 @@ const BlockSwitcher = ({ invalidBlocks: true }; } - const rootClientId = getBlockRootClientId(Array.isArray(clientIds) ? clientIds[0] : clientIds); const [{ name: firstBlockName }] = _blocks; @@ -49301,7 +53180,7 @@ const BlockSwitcher = ({ _icon = isSelectionOfSameType ? blockType.icon : library_copy; } return { - canRemove: canRemoveBlocks(clientIds, rootClientId), + canRemove: canRemoveBlocks(clientIds), hasBlockStyles: _isSingleBlockSelected && !!getBlockStyles(firstBlockName)?.length, icon: _icon, isReusable: _isSingleBlockSelected && (0,external_wp_blocks_namespaceObject.isReusableBlock)(_blocks[0]), @@ -49317,51 +53196,65 @@ const BlockSwitcher = ({ } const isSingleBlock = clientIds.length === 1; const blockSwitcherLabel = isSingleBlock ? blockTitle : (0,external_wp_i18n_namespaceObject.__)('Multiple blocks selected'); - const hideDropdown = !hasBlockStyles && !canRemove; + const hideDropdown = disabled || !hasBlockStyles && !canRemove; if (hideDropdown) { - return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, { - disabled: true, - className: "block-editor-block-switcher__no-switcher-icon", - title: blockSwitcherLabel, - icon: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(block_icon, { - icon: icon, - showColors: true - }), (isReusable || isTemplate) && (0,external_React_.createElement)("span", { - className: "block-editor-block-switcher__toggle-text" - }, blockTitle)) - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { + disabled: true, + className: "block-editor-block-switcher__no-switcher-icon", + title: blockSwitcherLabel, + icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { + icon: icon, + showColors: true + }), (isReusable || isTemplate) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + className: "block-editor-block-switcher__toggle-text", + children: blockTitle + })] + }) + }) + }); } const blockSwitcherDescription = isSingleBlock ? (0,external_wp_i18n_namespaceObject.__)('Change block type or style') : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of blocks. */ (0,external_wp_i18n_namespaceObject._n)('Change type of %d block', 'Change type of %d blocks', clientIds.length), clientIds.length); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarItem, null, toggleProps => (0,external_React_.createElement)(external_wp_components_namespaceObject.DropdownMenu, { - className: "block-editor-block-switcher", - label: blockSwitcherLabel, - popoverProps: { - placement: 'bottom-start', - className: 'block-editor-block-switcher__popover' - }, - icon: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(block_icon, { - icon: icon, - className: "block-editor-block-switcher__toggle", - showColors: true - }), (isReusable || isTemplate) && (0,external_React_.createElement)("span", { - className: "block-editor-block-switcher__toggle-text" - }, blockTitle)), - toggleProps: { - describedBy: blockSwitcherDescription, - ...toggleProps - }, - menuProps: { - orientation: 'both' - } - }, ({ - onClose - }) => (0,external_React_.createElement)(BlockSwitcherDropdownMenuContents, { - onClose: onClose, - clientIds: clientIds, - hasBlockStyles: hasBlockStyles, - canRemove: canRemove - })))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { + children: toggleProps => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { + className: "block-editor-block-switcher", + label: blockSwitcherLabel, + popoverProps: { + placement: 'bottom-start', + className: 'block-editor-block-switcher__popover' + }, + icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { + icon: icon, + className: "block-editor-block-switcher__toggle", + showColors: true + }), (isReusable || isTemplate) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + className: "block-editor-block-switcher__toggle-text", + children: blockTitle + })] + }), + toggleProps: { + describedBy: blockSwitcherDescription, + ...toggleProps + }, + menuProps: { + orientation: 'both' + }, + children: ({ + onClose + }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockSwitcherDropdownMenuContents, { + onClose: onClose, + clientIds: clientIds, + hasBlockStyles: hasBlockStyles, + canRemove: canRemove, + isUsingBindings: isUsingBindings + }) + }) + }) + }); }; /* harmony default export */ const block_switcher = (BlockSwitcher); @@ -49399,6 +53292,11 @@ const supports_FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle'; * Key within block settings' support array indicating support for font weight. */ const supports_FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight'; +/** + * Key within block settings' supports array indicating support for text + * align e.g. settings found in `block.json`. + */ +const supports_TEXT_ALIGN_SUPPORT_KEY = 'typography.textAlign'; /** * Key within block settings' supports array indicating support for text * columns e.g. settings found in `block.json`. @@ -49426,7 +53324,7 @@ const supports_TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransf */ const supports_LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing'; const LAYOUT_SUPPORT_KEY = 'layout'; -const supports_TYPOGRAPHY_SUPPORT_KEYS = [supports_LINE_HEIGHT_SUPPORT_KEY, supports_FONT_SIZE_SUPPORT_KEY, supports_FONT_STYLE_SUPPORT_KEY, supports_FONT_WEIGHT_SUPPORT_KEY, supports_FONT_FAMILY_SUPPORT_KEY, supports_TEXT_COLUMNS_SUPPORT_KEY, supports_TEXT_DECORATION_SUPPORT_KEY, supports_TEXT_TRANSFORM_SUPPORT_KEY, supports_WRITING_MODE_SUPPORT_KEY, supports_LETTER_SPACING_SUPPORT_KEY]; +const supports_TYPOGRAPHY_SUPPORT_KEYS = [supports_LINE_HEIGHT_SUPPORT_KEY, supports_FONT_SIZE_SUPPORT_KEY, supports_FONT_STYLE_SUPPORT_KEY, supports_FONT_WEIGHT_SUPPORT_KEY, supports_FONT_FAMILY_SUPPORT_KEY, supports_TEXT_ALIGN_SUPPORT_KEY, supports_TEXT_COLUMNS_SUPPORT_KEY, supports_TEXT_DECORATION_SUPPORT_KEY, supports_TEXT_TRANSFORM_SUPPORT_KEY, supports_WRITING_MODE_SUPPORT_KEY, supports_LETTER_SPACING_SUPPORT_KEY]; const EFFECTS_SUPPORT_KEYS = ['shadow']; const supports_SPACING_SUPPORT_KEY = 'spacing'; const supports_styleSupportKeys = [...EFFECTS_SUPPORT_KEYS, ...supports_TYPOGRAPHY_SUPPORT_KEYS, supports_BORDER_SUPPORT_KEY, supports_COLOR_SUPPORT_KEY, supports_SPACING_SUPPORT_KEY]; @@ -49542,6 +53440,22 @@ const supports_hasBackgroundColorSupport = nameOrType => { return colorSupport && colorSupport.background !== false; }; +/** + * Returns true if the block defines support for text-align. + * + * @param {string|Object} nameOrType Block name or type object. + * @return {boolean} Whether the block supports the feature. + */ +const hasTextAlignSupport = nameOrType => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, supports_TEXT_ALIGN_SUPPORT_KEY); + +/** + * Returns the block support value for text-align, if defined. + * + * @param {string|Object} nameOrType Block name or type object. + * @return {unknown} The block support value. + */ +const getTextAlignSupport = nameOrType => getBlockSupport(nameOrType, supports_TEXT_ALIGN_SUPPORT_KEY); + /** * Returns true if the block defines support for background color. * @@ -49686,6 +53600,7 @@ const STYLE_ATTRIBUTES = { align: hasAlignSupport, borderColor: nameOrType => supports_hasBorderSupport(nameOrType, 'color'), backgroundColor: supports_hasBackgroundColorSupport, + textAlign: hasTextAlignSupport, textColor: supports_hasTextColorSupport, gradient: supports_hasGradientSupport, className: hasCustomClassNameSupport, @@ -49833,8 +53748,8 @@ function BlockActions({ const canInsertDefaultBlock = canInsertBlockType(getDefaultBlockName(), rootClientId); const directInsertBlock = rootClientId ? getDirectInsertBlock(rootClientId) : null; return { - canMove: canMoveBlocks(clientIds, rootClientId), - canRemove: canRemoveBlocks(clientIds, rootClientId), + canMove: canMoveBlocks(clientIds), + canRemove: canRemoveBlocks(clientIds), canInsertBlock: canInsertDefaultBlock || !!directInsertBlock, canCopyStyles: blocks.every(block => { return !!block && ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, 'color') || (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, 'typography')); @@ -49881,12 +53796,10 @@ function BlockActions({ return removeBlocks(clientIds, updateSelection); }, onInsertBefore() { - const clientId = Array.isArray(clientIds) ? clientIds[0] : clientId; - insertBeforeBlock(clientId); + insertBeforeBlock(clientIds[0]); }, onInsertAfter() { - const clientId = Array.isArray(clientIds) ? clientIds[clientIds.length - 1] : clientId; - insertAfterBlock(clientId); + insertAfterBlock(clientIds[clientIds.length - 1]); }, onMoveTo() { setNavigationMode(true); @@ -49929,7 +53842,6 @@ function BlockActions({ } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-html-convert-button.js - /** * WordPress dependencies */ @@ -49942,6 +53854,7 @@ function BlockActions({ * Internal dependencies */ + function BlockHTMLConvertButton({ clientId }) { @@ -49952,11 +53865,12 @@ function BlockHTMLConvertButton({ if (!block || block.name !== 'core/html') { return null; } - return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { onClick: () => replaceBlocks(clientId, (0,external_wp_blocks_namespaceObject.rawHandler)({ HTML: (0,external_wp_blocks_namespaceObject.getBlockContent)(block) - })) - }, (0,external_wp_i18n_namespaceObject.__)('Convert to Blocks')); + })), + children: (0,external_wp_i18n_namespaceObject.__)('Convert to Blocks') + }); } /* harmony default export */ const block_html_convert_button = (BlockHTMLConvertButton); @@ -49972,8 +53886,7 @@ const { __unstableBlockSettingsMenuFirstItem.Slot = block_settings_menu_first_item_Slot; /* harmony default export */ const block_settings_menu_first_item = (__unstableBlockSettingsMenuFirstItem); -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-settings-dropdown.js - +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-parent-selector-menu-item.js /** * WordPress dependencies */ @@ -49983,9 +53896,6 @@ __unstableBlockSettingsMenuFirstItem.Slot = block_settings_menu_first_item_Slot; - - - /** * Internal dependencies */ @@ -49993,29 +53903,7 @@ __unstableBlockSettingsMenuFirstItem.Slot = block_settings_menu_first_item_Slot; - - - - -const block_settings_dropdown_POPOVER_PROPS = { - className: 'block-editor-block-settings-menu__popover', - placement: 'bottom-start' -}; -function CopyMenuItem({ - clientIds, - onCopy, - label -}) { - const { - getBlocksByClientId - } = (0,external_wp_data_namespaceObject.useSelect)(store); - const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(() => (0,external_wp_blocks_namespaceObject.serialize)(getBlocksByClientId(clientIds)), onCopy); - const copyMenuItemLabel = label ? label : (0,external_wp_i18n_namespaceObject.__)('Copy'); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { - ref: ref - }, copyMenuItemLabel); -} -function ParentSelectorMenuItem({ +function BlockParentSelectorMenuItem({ parentClientId, parentBlockType }) { @@ -50034,35 +53922,85 @@ function ParentSelectorMenuItem({ if (!isSmallViewport) { return null; } - return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { ...gesturesProps, ref: menuItemRef, - icon: (0,external_React_.createElement)(block_icon, { + icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { icon: parentBlockType.icon }), - onClick: () => selectBlock(parentClientId) - }, (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Name of the block's parent. */ - (0,external_wp_i18n_namespaceObject.__)('Select parent block (%s)'), parentBlockType.title)); + onClick: () => selectBlock(parentClientId), + children: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Name of the block's parent. */ + (0,external_wp_i18n_namespaceObject.__)('Select parent block (%s)'), parentBlockType.title) + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-settings-dropdown.js +/** + * WordPress dependencies + */ + + + + + + + + + + +/** + * Internal dependencies + */ + + + + + + + + + + +const block_settings_dropdown_POPOVER_PROPS = { + className: 'block-editor-block-settings-menu__popover', + placement: 'bottom-start' +}; +function CopyMenuItem({ + clientIds, + onCopy, + label, + shortcut +}) { + const { + getBlocksByClientId + } = (0,external_wp_data_namespaceObject.useSelect)(store); + const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(() => (0,external_wp_blocks_namespaceObject.serialize)(getBlocksByClientId(clientIds)), onCopy); + const copyMenuItemLabel = label ? label : (0,external_wp_i18n_namespaceObject.__)('Copy'); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { + ref: ref, + shortcut: shortcut, + children: copyMenuItemLabel + }); } function BlockSettingsDropdown({ block, clientIds, - __experimentalSelectBlock, children, - __unstableDisplayLocation, + __experimentalSelectBlock, ...props }) { // Get the client id of the current block for this menu, if one is set. const currentClientId = block?.clientId; - const blockClientIds = Array.isArray(clientIds) ? clientIds : [clientIds]; - const count = blockClientIds.length; - const firstBlockClientId = blockClientIds[0]; + const count = clientIds.length; + const firstBlockClientId = clientIds[0]; const { firstParentClientId, onlyBlock, parentBlockType, previousBlockClientId, - selectedBlockClientIds + selectedBlockClientIds, + openedBlockSettingsMenu, + isContentOnly } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockCount, @@ -50070,8 +54008,10 @@ function BlockSettingsDropdown({ getBlockRootClientId, getPreviousBlockClientId, getSelectedBlockClientIds, - getBlockAttributes - } = select(store); + getBlockAttributes, + getOpenedBlockSettingsMenu, + getBlockEditingMode + } = unlock(select(store)); const { getActiveBlockVariation } = select(external_wp_blocks_namespaceObject.store); @@ -50082,14 +54022,15 @@ function BlockSettingsDropdown({ onlyBlock: 1 === getBlockCount(_firstParentClientId), parentBlockType: _firstParentClientId && (getActiveBlockVariation(parentBlockName, getBlockAttributes(_firstParentClientId)) || (0,external_wp_blocks_namespaceObject.getBlockType)(parentBlockName)), previousBlockClientId: getPreviousBlockClientId(firstBlockClientId), - selectedBlockClientIds: getSelectedBlockClientIds() + selectedBlockClientIds: getSelectedBlockClientIds(), + openedBlockSettingsMenu: getOpenedBlockSettingsMenu(), + isContentOnly: getBlockEditingMode(firstBlockClientId) === 'contentOnly' }; }, [firstBlockClientId]); const { getBlockOrder, getSelectedBlockClientIds } = (0,external_wp_data_namespaceObject.useSelect)(store); - const openedBlockSettingsMenu = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store)).getOpenedBlockSettingsMenu(), []); const { setOpenedBlockSettingsMenu } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); @@ -50104,30 +54045,31 @@ function BlockSettingsDropdown({ insertBefore: getShortcutRepresentation('core/block-editor/insert-before') }; }, []); - const isMatch = (0,external_wp_keyboardShortcuts_namespaceObject.__unstableUseShortcutEventMatch)(); const hasSelectedBlocks = selectedBlockClientIds.length > 0; - const updateSelectionAfterDuplicate = (0,external_wp_element_namespaceObject.useCallback)(async clientIdsPromise => { - if (__experimentalSelectBlock) { - const ids = await clientIdsPromise; - if (ids && ids[0]) { - __experimentalSelectBlock(ids[0], false); - } + async function updateSelectionAfterDuplicate(clientIdsPromise) { + if (!__experimentalSelectBlock) { + return; } - }, [__experimentalSelectBlock]); - const updateSelectionAfterRemove = (0,external_wp_element_namespaceObject.useCallback)(() => { - if (__experimentalSelectBlock) { - let blockToFocus = previousBlockClientId || firstParentClientId; - - // Focus the first block if there's no previous block nor parent block. - if (!blockToFocus) { - blockToFocus = getBlockOrder()[0]; - } + const ids = await clientIdsPromise; + if (ids && ids[0]) { + __experimentalSelectBlock(ids[0], false); + } + } + function updateSelectionAfterRemove() { + if (!__experimentalSelectBlock) { + return; + } + let blockToFocus = previousBlockClientId || firstParentClientId; - // Only update the selection if the original selection is removed. - const shouldUpdateSelection = hasSelectedBlocks && getSelectedBlockClientIds().length === 0; - __experimentalSelectBlock(blockToFocus, shouldUpdateSelection); + // Focus the first block if there's no previous block nor parent block. + if (!blockToFocus) { + blockToFocus = getBlockOrder()[0]; } - }, [__experimentalSelectBlock, previousBlockClientId, firstParentClientId, getBlockOrder, hasSelectedBlocks, getSelectedBlockClientIds]); + + // Only update the selection if the original selection is removed. + const shouldUpdateSelection = hasSelectedBlocks && getSelectedBlockClientIds().length === 0; + __experimentalSelectBlock(blockToFocus, shouldUpdateSelection); + } // This can occur when the selected block (the parent) // displays child blocks within a List View. @@ -50141,114 +54083,107 @@ function BlockSettingsDropdown({ // right clicking into an inactive window. // See: https://github.com/WordPress/gutenberg/pull/54083 const open = !currentClientId ? undefined : openedBlockSettingsMenu === currentClientId || false; - const onToggle = (0,external_wp_element_namespaceObject.useCallback)(localOpen => { + function onToggle(localOpen) { if (localOpen && openedBlockSettingsMenu !== currentClientId) { setOpenedBlockSettingsMenu(currentClientId); } else if (!localOpen && openedBlockSettingsMenu && openedBlockSettingsMenu === currentClientId) { setOpenedBlockSettingsMenu(undefined); } - }, [currentClientId, openedBlockSettingsMenu, setOpenedBlockSettingsMenu]); - return (0,external_React_.createElement)(BlockActions, { - clientIds: clientIds, - __experimentalUpdateSelection: !__experimentalSelectBlock - }, ({ - canCopyStyles, - canDuplicate, - canInsertBlock, - canMove, - canRemove, - onDuplicate, - onInsertAfter, - onInsertBefore, - onRemove, - onCopy, - onPasteStyles, - onMoveTo - }) => (0,external_React_.createElement)(external_wp_components_namespaceObject.DropdownMenu, { - icon: more_vertical, - label: (0,external_wp_i18n_namespaceObject.__)('Options'), - className: "block-editor-block-settings-menu", - popoverProps: block_settings_dropdown_POPOVER_PROPS, - open: open, - onToggle: onToggle, - noIcons: true, - menuProps: { - /** - * @param {KeyboardEvent} event - */ - onKeyDown(event) { - if (event.defaultPrevented) return; - if (isMatch('core/block-editor/remove', event) && canRemove) { - event.preventDefault(); - updateSelectionAfterRemove(onRemove()); - } else if (isMatch('core/block-editor/duplicate', event) && canDuplicate) { - event.preventDefault(); - updateSelectionAfterDuplicate(onDuplicate()); - } else if (isMatch('core/block-editor/insert-after', event) && canInsertBlock) { - event.preventDefault(); - setOpenedBlockSettingsMenu(undefined); - onInsertAfter(); - } else if (isMatch('core/block-editor/insert-before', event) && canInsertBlock) { - event.preventDefault(); - setOpenedBlockSettingsMenu(undefined); - onInsertBefore(); - } - } - }, - ...props - }, ({ - onClose - }) => (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_React_.createElement)(block_settings_menu_first_item.Slot, { - fillProps: { - onClose - } - }), !parentBlockIsSelected && !!firstParentClientId && (0,external_React_.createElement)(ParentSelectorMenuItem, { - parentClientId: firstParentClientId, - parentBlockType: parentBlockType - }), count === 1 && (0,external_React_.createElement)(block_html_convert_button, { - clientId: firstBlockClientId - }), (0,external_React_.createElement)(CopyMenuItem, { - clientIds: clientIds, - onCopy: onCopy - }), canDuplicate && (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { - onClick: (0,external_wp_compose_namespaceObject.pipe)(onClose, onDuplicate, updateSelectionAfterDuplicate), - shortcut: shortcuts.duplicate - }, (0,external_wp_i18n_namespaceObject.__)('Duplicate')), canInsertBlock && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { - onClick: (0,external_wp_compose_namespaceObject.pipe)(onClose, onInsertBefore), - shortcut: shortcuts.insertBefore - }, (0,external_wp_i18n_namespaceObject.__)('Add before')), (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { - onClick: (0,external_wp_compose_namespaceObject.pipe)(onClose, onInsertAfter), - shortcut: shortcuts.insertAfter - }, (0,external_wp_i18n_namespaceObject.__)('Add after')))), canCopyStyles && (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_React_.createElement)(CopyMenuItem, { + } + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockActions, { clientIds: clientIds, - onCopy: onCopy, - label: (0,external_wp_i18n_namespaceObject.__)('Copy styles') - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { - onClick: onPasteStyles - }, (0,external_wp_i18n_namespaceObject.__)('Paste styles'))), (0,external_React_.createElement)(block_settings_menu_controls.Slot, { - fillProps: { - onClose, + __experimentalUpdateSelection: !__experimentalSelectBlock, + children: ({ + canCopyStyles, + canDuplicate, + canInsertBlock, canMove, - onMoveTo, - onlyBlock, - count, - firstBlockClientId - }, - clientIds: clientIds, - __unstableDisplayLocation: __unstableDisplayLocation - }), typeof children === 'function' ? children({ - onClose - }) : external_wp_element_namespaceObject.Children.map(child => (0,external_wp_element_namespaceObject.cloneElement)(child, { - onClose - })), canRemove && (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { - onClick: (0,external_wp_compose_namespaceObject.pipe)(onClose, onRemove, updateSelectionAfterRemove), - shortcut: shortcuts.remove - }, (0,external_wp_i18n_namespaceObject.__)('Delete')))))); + canRemove, + onDuplicate, + onInsertAfter, + onInsertBefore, + onRemove, + onCopy, + onPasteStyles, + onMoveTo + }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { + icon: more_vertical, + label: (0,external_wp_i18n_namespaceObject.__)('Options'), + className: "block-editor-block-settings-menu", + popoverProps: block_settings_dropdown_POPOVER_PROPS, + open: open, + onToggle: onToggle, + noIcons: true, + ...props, + children: ({ + onClose + }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_settings_menu_first_item.Slot, { + fillProps: { + onClose + } + }), !parentBlockIsSelected && !!firstParentClientId && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockParentSelectorMenuItem, { + parentClientId: firstParentClientId, + parentBlockType: parentBlockType + }), count === 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_html_convert_button, { + clientId: firstBlockClientId + }), !isContentOnly && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyMenuItem, { + clientIds: clientIds, + onCopy: onCopy, + shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('c') + }), canDuplicate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { + onClick: (0,external_wp_compose_namespaceObject.pipe)(onClose, onDuplicate, updateSelectionAfterDuplicate), + shortcut: shortcuts.duplicate, + children: (0,external_wp_i18n_namespaceObject.__)('Duplicate') + }), canInsertBlock && !isContentOnly && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { + onClick: (0,external_wp_compose_namespaceObject.pipe)(onClose, onInsertBefore), + shortcut: shortcuts.insertBefore, + children: (0,external_wp_i18n_namespaceObject.__)('Add before') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { + onClick: (0,external_wp_compose_namespaceObject.pipe)(onClose, onInsertAfter), + shortcut: shortcuts.insertAfter, + children: (0,external_wp_i18n_namespaceObject.__)('Add after') + })] + })] + }), canCopyStyles && !isContentOnly && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyMenuItem, { + clientIds: clientIds, + onCopy: onCopy, + label: (0,external_wp_i18n_namespaceObject.__)('Copy styles') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { + onClick: onPasteStyles, + children: (0,external_wp_i18n_namespaceObject.__)('Paste styles') + })] + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_settings_menu_controls.Slot, { + fillProps: { + onClose, + canMove, + onMoveTo, + onlyBlock, + count, + firstBlockClientId + }, + clientIds: clientIds + }), typeof children === 'function' ? children({ + onClose + }) : external_wp_element_namespaceObject.Children.map(child => (0,external_wp_element_namespaceObject.cloneElement)(child, { + onClose + })), canRemove && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { + onClick: (0,external_wp_compose_namespaceObject.pipe)(onClose, onRemove, updateSelectionAfterRemove), + shortcut: shortcuts.remove, + children: (0,external_wp_i18n_namespaceObject.__)('Delete') + }) + })] + }) + }) + }); } /* harmony default export */ const block_settings_dropdown = (BlockSettingsDropdown); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/index.js - /** * WordPress dependencies */ @@ -50258,20 +54193,24 @@ function BlockSettingsDropdown({ * Internal dependencies */ + function BlockSettingsMenu({ clientIds, ...props }) { - return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarItem, null, toggleProps => (0,external_React_.createElement)(block_settings_dropdown, { - clientIds: clientIds, - toggleProps: toggleProps, - ...props - }))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { + children: toggleProps => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_settings_dropdown, { + clientIds: clientIds, + toggleProps: toggleProps, + ...props + }) + }) + }); } /* harmony default export */ const block_settings_menu = (BlockSettingsMenu); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-lock/toolbar.js - /** * WordPress dependencies */ @@ -50285,6 +54224,9 @@ function BlockSettingsMenu({ */ + + + function BlockLockToolbar({ clientId }) { @@ -50312,66 +54254,88 @@ function BlockLockToolbar({ if (!canLock && isLocked) { label = (0,external_wp_i18n_namespaceObject.__)('Locked'); } - return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarGroup, { - className: "block-editor-block-lock-toolbar" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, { - accessibleWhenDisabled: true, - disabled: !canLock, - icon: isLocked ? library_lock : library_unlock, - label: label, - onClick: toggleModal, - "aria-expanded": isModalOpen, - "aria-haspopup": "dialog" - })), isModalOpen && (0,external_React_.createElement)(BlockLockModal, { - clientId: clientId, - onClose: toggleModal - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { + className: "block-editor-block-lock-toolbar", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { + accessibleWhenDisabled: true, + disabled: !canLock, + icon: isLocked ? library_lock : library_unlock, + label: label, + onClick: toggleModal, + "aria-expanded": isModalOpen, + "aria-haspopup": "dialog" + }) + }), isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockLockModal, { + clientId: clientId, + onClose: toggleModal + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/group.js - /** * WordPress dependencies */ -const group_group = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const group_group = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M18 4h-7c-1.1 0-2 .9-2 2v3H6c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2v-3h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4.5 14c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h3V13c0 1.1.9 2 2 2h2.5v3zm0-4.5H11c-.3 0-.5-.2-.5-.5v-2.5H13c.3 0 .5.2.5.5v2.5zm5-.5c0 .3-.2.5-.5.5h-3V11c0-1.1-.9-2-2-2h-2.5V6c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v7z" -})); + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M18 4h-7c-1.1 0-2 .9-2 2v3H6c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2v-3h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4.5 14c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h3V13c0 1.1.9 2 2 2h2.5v3zm0-4.5H11c-.3 0-.5-.2-.5-.5v-2.5H13c.3 0 .5.2.5.5v2.5zm5-.5c0 .3-.2.5-.5.5h-3V11c0-1.1-.9-2-2-2h-2.5V6c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v7z" + }) +}); /* harmony default export */ const library_group = (group_group); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/row.js - /** * WordPress dependencies */ -const row = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const row = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M4 6.5h5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H4V16h5a.5.5 0 0 0 .5-.5v-7A.5.5 0 0 0 9 8H4V6.5Zm16 0h-5a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h5V16h-5a.5.5 0 0 1-.5-.5v-7A.5.5 0 0 1 15 8h5V6.5Z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M4 6.5h5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H4V16h5a.5.5 0 0 0 .5-.5v-7A.5.5 0 0 0 9 8H4V6.5Zm16 0h-5a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h5V16h-5a.5.5 0 0 1-.5-.5v-7A.5.5 0 0 1 15 8h5V6.5Z" + }) +}); /* harmony default export */ const library_row = (row); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/stack.js - /** * WordPress dependencies */ -const stack = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const stack = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M17.5 4v5a2 2 0 0 1-2 2h-7a2 2 0 0 1-2-2V4H8v5a.5.5 0 0 0 .5.5h7A.5.5 0 0 0 16 9V4h1.5Zm0 16v-5a2 2 0 0 0-2-2h-7a2 2 0 0 0-2 2v5H8v-5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 .5.5v5h1.5Z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M17.5 4v5a2 2 0 0 1-2 2h-7a2 2 0 0 1-2-2V4H8v5a.5.5 0 0 0 .5.5h7A.5.5 0 0 0 16 9V4h1.5Zm0 16v-5a2 2 0 0 0-2-2h-7a2 2 0 0 0-2 2v5H8v-5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 .5.5v5h1.5Z" + }) +}); /* harmony default export */ const library_stack = (stack); -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/convert-to-group-buttons/toolbar.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/grid.js +/** + * WordPress dependencies + */ + + +const grid_grid = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "m3 5c0-1.10457.89543-2 2-2h13.5c1.1046 0 2 .89543 2 2v13.5c0 1.1046-.8954 2-2 2h-13.5c-1.10457 0-2-.8954-2-2zm2-.5h6v6.5h-6.5v-6c0-.27614.22386-.5.5-.5zm-.5 8v6c0 .2761.22386.5.5.5h6v-6.5zm8 0v6.5h6c.2761 0 .5-.2239.5-.5v-6zm0-8v6.5h6.5v-6c0-.27614-.2239-.5-.5-.5z", + fillRule: "evenodd", + clipRule: "evenodd" + }) +}); +/* harmony default export */ const library_grid = (grid_grid); +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/convert-to-group-buttons/toolbar.js /** * WordPress dependencies */ @@ -50386,6 +54350,8 @@ const stack = (0,external_React_.createElement)(external_wp_primitives_namespace */ + + const layouts = { group: { type: 'constrained' @@ -50397,6 +54363,9 @@ const layouts = { stack: { type: 'flex', orientation: 'vertical' + }, + grid: { + type: 'grid' } }; function BlockGroupToolbar() { @@ -50438,6 +54407,7 @@ function BlockGroupToolbar() { }; const onConvertToRow = () => onConvertToGroup('row'); const onConvertToStack = () => onConvertToGroup('stack'); + const onConvertToGrid = () => onConvertToGroup('grid'); // Don't render the button if the current selection cannot be grouped. // A good example is selecting multiple button blocks within a Buttons block: @@ -50452,24 +54422,32 @@ function BlockGroupToolbar() { const canInsertStack = !!variations.find(({ name }) => name === 'group-stack'); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, { - icon: library_group, - label: (0,external_wp_i18n_namespaceObject._x)('Group', 'verb'), - onClick: onConvertToGroup - }), canInsertRow && (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, { - icon: library_row, - label: (0,external_wp_i18n_namespaceObject._x)('Row', 'single horizontal line'), - onClick: onConvertToRow - }), canInsertStack && (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, { - icon: library_stack, - label: (0,external_wp_i18n_namespaceObject._x)('Stack', 'verb'), - onClick: onConvertToStack - })); + const canInsertGrid = !!variations.find(({ + name + }) => name === 'group-grid'); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ToolbarGroup, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { + icon: library_group, + label: (0,external_wp_i18n_namespaceObject._x)('Group', 'verb'), + onClick: onConvertToGroup + }), canInsertRow && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { + icon: library_row, + label: (0,external_wp_i18n_namespaceObject._x)('Row', 'single horizontal line'), + onClick: onConvertToRow + }), canInsertStack && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { + icon: library_stack, + label: (0,external_wp_i18n_namespaceObject._x)('Stack', 'verb'), + onClick: onConvertToStack + }), canInsertGrid && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { + icon: library_grid, + label: (0,external_wp_i18n_namespaceObject._x)('Grid', 'verb'), + onClick: onConvertToGrid + })] + }); } /* harmony default export */ const toolbar = (BlockGroupToolbar); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-edit-visually-button/index.js - /** * WordPress dependencies */ @@ -50481,6 +54459,7 @@ function BlockGroupToolbar() { * Internal dependencies */ + function BlockEditVisuallyButton({ clientIds }) { @@ -50493,11 +54472,14 @@ function BlockEditVisuallyButton({ if (!canEditVisually) { return null; } - return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, { - onClick: () => { - toggleBlockMode(clientId); - } - }, (0,external_wp_i18n_namespaceObject.__)('Edit visually'))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { + onClick: () => { + toggleBlockMode(clientId); + }, + children: (0,external_wp_i18n_namespaceObject.__)('Edit visually') + }) + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/block-name-context.js @@ -50509,7 +54491,6 @@ const __unstableBlockNameContext = (0,external_wp_element_namespaceObject.create /* harmony default export */ const block_name_context = (__unstableBlockNameContext); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/navigable-toolbar/index.js - /** * WordPress dependencies */ @@ -50526,6 +54507,7 @@ const __unstableBlockNameContext = (0,external_wp_element_namespaceObject.create */ + function hasOnlyToolbarItem(elements) { const dataProp = 'toolbarItem'; return !elements.some(element => !(dataProp in element.dataset)); @@ -50646,7 +54628,9 @@ function useToolbarFocus({ } return () => { window.cancelAnimationFrame(raf); - if (!onIndexChange || !navigableToolbarRef) return; + if (!onIndexChange || !navigableToolbarRef) { + return; + } // When the toolbar element is unmounted and onIndexChange is passed, we // pass the focused toolbar item index so it can be hydrated later. const items = getAllFocusableToolbarItemsIn(navigableToolbarRef); @@ -50671,46 +54655,159 @@ function useToolbarFocus({ lastFocus.current.focus(); } }; - navigableToolbarRef.addEventListener('keydown', handleKeyDown); - return () => { - navigableToolbarRef.removeEventListener('keydown', handleKeyDown); - }; + navigableToolbarRef.addEventListener('keydown', handleKeyDown); + return () => { + navigableToolbarRef.removeEventListener('keydown', handleKeyDown); + }; + } + }, [focusEditorOnEscape, getLastFocus, toolbarRef]); +} +function NavigableToolbar({ + children, + focusOnMount, + focusEditorOnEscape = false, + shouldUseKeyboardFocusShortcut = true, + __experimentalInitialIndex: initialIndex, + __experimentalOnIndexChange: onIndexChange, + ...props +}) { + const toolbarRef = (0,external_wp_element_namespaceObject.useRef)(); + const isAccessibleToolbar = useIsAccessibleToolbar(toolbarRef); + useToolbarFocus({ + toolbarRef, + focusOnMount, + defaultIndex: initialIndex, + onIndexChange, + isAccessibleToolbar, + shouldUseKeyboardFocusShortcut, + focusEditorOnEscape + }); + if (isAccessibleToolbar) { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Toolbar, { + label: props['aria-label'], + ref: toolbarRef, + ...props, + children: children + }); + } + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.NavigableMenu, { + orientation: "horizontal", + role: "toolbar", + ref: toolbarRef, + ...props, + children: children + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/shuffle.js +/** + * WordPress dependencies + */ + + +const shuffle = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/SVG", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M17.192 6.75L15.47 5.03l1.06-1.06 3.537 3.53-3.537 3.53-1.06-1.06 1.723-1.72h-3.19c-.602 0-.993.202-1.28.498-.309.319-.538.792-.695 1.383-.13.488-.222 1.023-.296 1.508-.034.664-.116 1.413-.303 2.117-.193.721-.513 1.467-1.068 2.04-.575.594-1.359.954-2.357.954H4v-1.5h4.003c.601 0 .993-.202 1.28-.498.308-.319.538-.792.695-1.383.149-.557.216-1.093.288-1.662l.039-.31a9.653 9.653 0 0 1 .272-1.653c.193-.722.513-1.467 1.067-2.04.576-.594 1.36-.954 2.358-.954h3.19zM8.004 6.75c.8 0 1.46.23 1.988.628a6.24 6.24 0 0 0-.684 1.396 1.725 1.725 0 0 0-.024-.026c-.287-.296-.679-.498-1.28-.498H4v-1.5h4.003zM12.699 14.726c-.161.459-.38.94-.684 1.396.527.397 1.188.628 1.988.628h3.19l-1.722 1.72 1.06 1.06L20.067 16l-3.537-3.53-1.06 1.06 1.723 1.72h-3.19c-.602 0-.993-.202-1.28-.498a1.96 1.96 0 0 1-.024-.026z" + }) +}); +/* harmony default export */ const library_shuffle = (shuffle); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/shuffle.js +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + +const shuffle_EMPTY_ARRAY = []; +function shuffle_Container(props) { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { + ...props + }) + }); +} +function Shuffle({ + clientId, + as = shuffle_Container +}) { + const { + categories, + patterns, + patternName + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getBlockAttributes, + getBlockRootClientId, + __experimentalGetAllowedPatterns + } = select(store); + const attributes = getBlockAttributes(clientId); + const _categories = attributes?.metadata?.categories || shuffle_EMPTY_ARRAY; + const _patternName = attributes?.metadata?.patternName; + const rootBlock = getBlockRootClientId(clientId); + const _patterns = __experimentalGetAllowedPatterns(rootBlock); + return { + categories: _categories, + patterns: _patterns, + patternName: _patternName + }; + }, [clientId]); + const { + replaceBlocks + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const sameCategoryPatternsWithSingleWrapper = (0,external_wp_element_namespaceObject.useMemo)(() => { + if (!categories || categories.length === 0 || !patterns || patterns.length === 0) { + return shuffle_EMPTY_ARRAY; + } + return patterns.filter(pattern => { + return ( + // Check if the pattern has only one top level block, + // otherwise we may shuffle to pattern that will not allow to continue shuffling. + pattern.blocks.length === 1 && pattern.categories?.some(category => { + return categories.includes(category); + }) && ( + // Check if the pattern is not a synced pattern. + pattern.syncStatus === 'unsynced' || !pattern.id) + ); + }); + }, [categories, patterns]); + if (sameCategoryPatternsWithSingleWrapper.length < 2) { + return null; + } + function getNextPattern() { + const numberOfPatterns = sameCategoryPatternsWithSingleWrapper.length; + const patternIndex = sameCategoryPatternsWithSingleWrapper.findIndex(({ + name + }) => name === patternName); + const nextPatternIndex = patternIndex + 1 < numberOfPatterns ? patternIndex + 1 : 0; + return sameCategoryPatternsWithSingleWrapper[nextPatternIndex]; + } + const ComponentToUse = as; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComponentToUse, { + label: (0,external_wp_i18n_namespaceObject.__)('Shuffle'), + icon: library_shuffle, + onClick: () => { + const nextPattern = getNextPattern(); + nextPattern.blocks[0].attributes = { + ...nextPattern.blocks[0].attributes, + metadata: { + ...nextPattern.blocks[0].attributes.metadata, + categories + } + }; + replaceBlocks(clientId, nextPattern.blocks); } - }, [focusEditorOnEscape, getLastFocus, toolbarRef]); -} -function NavigableToolbar({ - children, - focusOnMount, - focusEditorOnEscape = false, - shouldUseKeyboardFocusShortcut = true, - __experimentalInitialIndex: initialIndex, - __experimentalOnIndexChange: onIndexChange, - ...props -}) { - const toolbarRef = (0,external_wp_element_namespaceObject.useRef)(); - const isAccessibleToolbar = useIsAccessibleToolbar(toolbarRef); - useToolbarFocus({ - toolbarRef, - focusOnMount, - defaultIndex: initialIndex, - onIndexChange, - isAccessibleToolbar, - shouldUseKeyboardFocusShortcut, - focusEditorOnEscape }); - if (isAccessibleToolbar) { - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Toolbar, { - label: props['aria-label'], - ref: toolbarRef, - ...props - }, children); - } - return (0,external_React_.createElement)(external_wp_components_namespaceObject.NavigableMenu, { - orientation: "horizontal", - role: "toolbar", - ref: toolbarRef, - ...props - }, children); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-controls/use-has-block-controls.js @@ -50748,54 +54845,52 @@ function useHasBlockControls(group = 'default') { return !!fills?.length; } -;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/connection.js - +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/use-has-block-toolbar.js /** * WordPress dependencies */ -const connection = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { - width: "24", - height: "24", - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg", - fillRule: "evenodd" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M5 19L8 16L5 19Z" -}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M16 8L19 5L16 8Z" -}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.G, null, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M5 19L8 16" -}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M9.30003 17.3C9.523 17.5237 9.78794 17.7013 10.0797 17.8224C10.3714 17.9435 10.6842 18.0059 11 18.0059C11.3159 18.0059 11.6287 17.9435 11.9204 17.8224C12.2121 17.7013 12.4771 17.5237 12.7 17.3L15 15L9.00003 9L6.70003 11.3C6.47629 11.523 6.29876 11.7879 6.17763 12.0796C6.05649 12.3714 5.99414 12.6841 5.99414 13C5.99414 13.3159 6.05649 13.6286 6.17763 13.9204C6.29876 14.2121 6.47629 14.477 6.70003 14.7L9.30003 17.3Z" -}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M16 8L19 5" -}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M9 9.00003L15 15L17.3 12.7C17.5237 12.4771 17.7013 12.2121 17.8224 11.9204C17.9435 11.6287 18.0059 11.3159 18.0059 11C18.0059 10.6842 17.9435 10.3714 17.8224 10.0797C17.7013 9.78794 17.5237 9.523 17.3 9.30003L14.7 6.70003C14.477 6.47629 14.2121 6.29876 13.9204 6.17763C13.6286 6.05649 13.3159 5.99414 13 5.99414C12.6841 5.99414 12.3714 6.05649 12.0796 6.17763C11.7879 6.29876 11.523 6.47629 11.3 6.70003L9 9.00003Z" -}))); -/* harmony default export */ const library_connection = (connection); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-bindings-toolbar-indicator/index.js /** - * WordPress dependencies + * Internal dependencies */ -function BlockBindingsToolbarIndicator() { - return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarItem, { - as: 'div', - "aria-label": (0,external_wp_i18n_namespaceObject._x)('Connected', 'block toolbar button label'), - className: "block-editor-block-bindings-toolbar-indicator" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, { - icon: library_connection, - size: 24 - }))); +/** + * Returns true if the block toolbar should be shown. + * + * @return {boolean} Whether the block toolbar component will be rendered. + */ +function useHasBlockToolbar() { + const { + isToolbarEnabled, + isDefaultEditingMode + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getBlockEditingMode, + getBlockName, + getBlockSelectionStart + } = select(store); + + // we only care about the 1st selected block + // for the toolbar, so we use getBlockSelectionStart + // instead of getSelectedBlockClientIds + const selectedBlockClientId = getBlockSelectionStart(); + const blockType = selectedBlockClientId && (0,external_wp_blocks_namespaceObject.getBlockType)(getBlockName(selectedBlockClientId)); + return { + isToolbarEnabled: blockType && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, '__experimentalToolbar', true), + isDefaultEditingMode: getBlockEditingMode(selectedBlockClientId) === 'default' + }; + }, []); + const hasAnyBlockControls = useHasAnyBlockControls(); + if (!isToolbarEnabled || !isDefaultEditingMode && !hasAnyBlockControls) { + return false; + } + return true; } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/index.js - /** * External dependencies */ @@ -50830,7 +54925,6 @@ function BlockBindingsToolbarIndicator() { - /** * Renders the block toolbar. * @@ -50843,6 +54937,9 @@ function BlockBindingsToolbarIndicator() { * @param {Function} props.__experimentalOnIndexChange Callback function to be called when the index of the focused toolbar item changes. * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons. */ + + + function PrivateBlockToolbar({ hideDragHandle, focusOnMount, @@ -50855,7 +54952,7 @@ function PrivateBlockToolbar({ blockClientIds, isDefaultEditingMode, blockType, - blockName, + toolbarKey, shouldShowVisualToolbar, showParentSelector, isUsingBindings @@ -50881,15 +54978,15 @@ function PrivateBlockToolbar({ const _blockName = getBlockName(selectedBlockClientId); const isValid = selectedBlockClientIds.every(id => isBlockValid(id)); const isVisual = selectedBlockClientIds.every(id => getBlockMode(id) === 'visual'); - const _isUsingBindings = !!getBlockAttributes(selectedBlockClientId)?.metadata?.bindings; + const _isUsingBindings = selectedBlockClientIds.every(clientId => !!getBlockAttributes(clientId)?.metadata?.bindings); return { blockClientId: selectedBlockClientId, blockClientIds: selectedBlockClientIds, isDefaultEditingMode: _isDefaultEditingMode, - blockName: _blockName, blockType: selectedBlockClientId && (0,external_wp_blocks_namespaceObject.getBlockType)(_blockName), shouldShowVisualToolbar: isValid && isVisual, rootClientId: blockRootClientId, + toolbarKey: `${selectedBlockClientId}${firstParentClientId}`, showParentSelector: parentBlockType && getBlockEditingMode(firstParentClientId) === 'default' && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(parentBlockType, '__experimentalParentSelector', true) && selectedBlockClientIds.length === 1 && _isDefaultEditingMode, isUsingBindings: _isUsingBindings }; @@ -50903,22 +55000,22 @@ function PrivateBlockToolbar({ ref: nodeRef }); const isLargeViewport = !(0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); - const isToolbarEnabled = blockType && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, '__experimentalToolbar', true); - const hasAnyBlockControls = useHasAnyBlockControls(); - if (!isToolbarEnabled || !isDefaultEditingMode && !hasAnyBlockControls) { + const hasBlockToolbar = useHasBlockToolbar(); + if (!hasBlockToolbar) { return null; } const isMultiToolbar = blockClientIds.length > 1; const isSynced = (0,external_wp_blocks_namespaceObject.isReusableBlock)(blockType) || (0,external_wp_blocks_namespaceObject.isTemplatePart)(blockType); // Shifts the toolbar to make room for the parent block selector. - const classes = classnames_default()('block-editor-block-contextual-toolbar', { + const classes = dist_clsx('block-editor-block-contextual-toolbar', { 'has-parent': showParentSelector }); - const innerClasses = classnames_default()('block-editor-block-toolbar', { - 'is-synced': isSynced + const innerClasses = dist_clsx('block-editor-block-toolbar', { + 'is-synced': isSynced, + 'is-connected': isUsingBindings }); - return (0,external_React_.createElement)(NavigableToolbar, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigableToolbar, { focusEditorOnEscape: true, className: classes /* translators: accessibility text for the block toolbar */, @@ -50932,43 +55029,55 @@ function PrivateBlockToolbar({ // Resets the index whenever the active block changes so // this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169 , - key: blockClientId - }, (0,external_React_.createElement)("div", { - ref: toolbarWrapperRef, - className: innerClasses - }, !isMultiToolbar && isLargeViewport && isDefaultEditingMode && (0,external_React_.createElement)(BlockParentSelector, null), isUsingBindings && canBindBlock(blockName) && (0,external_React_.createElement)(BlockBindingsToolbarIndicator, null), (shouldShowVisualToolbar || isMultiToolbar) && isDefaultEditingMode && (0,external_React_.createElement)("div", { - ref: nodeRef, - ...showHoveredOrFocusedGestures - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarGroup, { - className: "block-editor-block-toolbar__block-controls" - }, (0,external_React_.createElement)(block_switcher, { - clientIds: blockClientIds - }), !isMultiToolbar && (0,external_React_.createElement)(BlockLockToolbar, { - clientId: blockClientId - }), (0,external_React_.createElement)(block_mover, { - clientIds: blockClientIds, - hideDragHandle: hideDragHandle - }))), shouldShowVisualToolbar && isMultiToolbar && (0,external_React_.createElement)(toolbar, null), shouldShowVisualToolbar && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(block_controls.Slot, { - group: "parent", - className: "block-editor-block-toolbar__slot" - }), (0,external_React_.createElement)(block_controls.Slot, { - group: "block", - className: "block-editor-block-toolbar__slot" - }), (0,external_React_.createElement)(block_controls.Slot, { - className: "block-editor-block-toolbar__slot" - }), (0,external_React_.createElement)(block_controls.Slot, { - group: "inline", - className: "block-editor-block-toolbar__slot" - }), (0,external_React_.createElement)(block_controls.Slot, { - group: "other", - className: "block-editor-block-toolbar__slot" - }), (0,external_React_.createElement)(block_name_context.Provider, { - value: blockType?.name - }, (0,external_React_.createElement)(block_toolbar_last_item.Slot, null))), (0,external_React_.createElement)(BlockEditVisuallyButton, { - clientIds: blockClientIds - }), isDefaultEditingMode && (0,external_React_.createElement)(block_settings_menu, { - clientIds: blockClientIds - }))); + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + ref: toolbarWrapperRef, + className: innerClasses, + children: [!isMultiToolbar && isLargeViewport && isDefaultEditingMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockParentSelector, {}), (shouldShowVisualToolbar || isMultiToolbar) && (isDefaultEditingMode || isSynced) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + ref: nodeRef, + ...showHoveredOrFocusedGestures, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ToolbarGroup, { + className: "block-editor-block-toolbar__block-controls", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_switcher, { + clientIds: blockClientIds, + disabled: !isDefaultEditingMode, + isUsingBindings: isUsingBindings + }), isDefaultEditingMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [!isMultiToolbar && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockLockToolbar, { + clientId: blockClientId + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_mover, { + clientIds: blockClientIds, + hideDragHandle: hideDragHandle + })] + })] + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Shuffle, { + clientId: blockClientId + }), shouldShowVisualToolbar && isMultiToolbar && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(toolbar, {}), shouldShowVisualToolbar && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls.Slot, { + group: "parent", + className: "block-editor-block-toolbar__slot" + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls.Slot, { + group: "block", + className: "block-editor-block-toolbar__slot" + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls.Slot, { + className: "block-editor-block-toolbar__slot" + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls.Slot, { + group: "inline", + className: "block-editor-block-toolbar__slot" + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls.Slot, { + group: "other", + className: "block-editor-block-toolbar__slot" + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_name_context.Provider, { + value: blockType?.name, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_toolbar_last_item.Slot, {}) + })] + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEditVisuallyButton, { + clientIds: blockClientIds + }), isDefaultEditingMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_settings_menu, { + clientIds: blockClientIds + })] + }) + }, toolbarKey); } /** @@ -50984,7 +55093,7 @@ function BlockToolbar({ hideDragHandle, variant }) { - return (0,external_React_.createElement)(PrivateBlockToolbar, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateBlockToolbar, { hideDragHandle: hideDragHandle, variant: variant, focusOnMount: undefined, @@ -50994,7 +55103,6 @@ function BlockToolbar({ } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/block-toolbar-popover.js - /** * External dependencies */ @@ -51013,6 +55121,7 @@ function BlockToolbar({ + function BlockToolbarPopover({ clientId, isTyping, @@ -51047,29 +55156,46 @@ function BlockToolbarPopover({ contentElement: __unstableContentRef?.current, clientId }); - return !isTyping && (0,external_React_.createElement)(block_popover, { + return !isTyping && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_popover, { clientId: capturingClientId || clientId, bottomClientId: lastClientId, - className: classnames_default()('block-editor-block-list__block-popover', { + className: dist_clsx('block-editor-block-list__block-popover', { 'is-insertion-point-visible': isInsertionPointVisible }), resize: false, - ...popoverProps - }, (0,external_React_.createElement)(PrivateBlockToolbar - // If the toolbar is being shown because of being forced - // it should focus the toolbar right after the mount. - , { - focusOnMount: isToolbarForced.current, - __experimentalInitialIndex: initialToolbarItemIndexRef.current, - __experimentalOnIndexChange: index => { - initialToolbarItemIndexRef.current = index; - }, - variant: "toolbar" - })); + ...popoverProps, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateBlockToolbar + // If the toolbar is being shown because of being forced + // it should focus the toolbar right after the mount. + , { + focusOnMount: isToolbarForced.current, + __experimentalInitialIndex: initialToolbarItemIndexRef.current, + __experimentalOnIndexChange: index => { + initialToolbarItemIndexRef.current = index; + }, + variant: "toolbar" + }) + }); } -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/block-selection-button.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/trash.js +/** + * WordPress dependencies + */ + + +const trash = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z" + }) +}); +/* harmony default export */ const library_trash = (trash); +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/block-selection-button.js /** * External dependencies */ @@ -51098,6 +55224,7 @@ function BlockToolbarPopover({ + /** * Block selection button component, displaying the label of the block. If the block * descends from a root block, a button is displayed enabling the user to select @@ -51108,6 +55235,8 @@ function BlockToolbarPopover({ * * @return {Component} The component to be rendered. */ + + function BlockSelectionButton({ clientId, rootClientId @@ -51118,7 +55247,11 @@ function BlockSelectionButton({ getBlockIndex, hasBlockMovingClientId, getBlockListSettings, - __unstableGetEditorMode + __unstableGetEditorMode, + getNextBlockClientId, + getPreviousBlockClientId, + canRemoveBlock, + canMoveBlock } = select(store); const { getActiveBlockVariation, @@ -51132,18 +55265,47 @@ function BlockSelectionButton({ const blockType = getBlockType(name); const orientation = getBlockListSettings(rootClientId)?.orientation; const match = getActiveBlockVariation(name, attributes); + const isBlockTemplatePart = blockType?.name === 'core/template-part'; + let isNextBlockTemplatePart = false; + const nextClientId = getNextBlockClientId(); + if (nextClientId) { + const { + name: nextName + } = getBlock(nextClientId); + const nextBlockType = getBlockType(nextName); + isNextBlockTemplatePart = nextBlockType?.name === 'core/template-part'; + } + let isPrevBlockTemplatePart = false; + const prevClientId = getPreviousBlockClientId(); + if (prevClientId) { + const { + name: prevName + } = getBlock(prevClientId); + const prevBlockType = getBlockType(prevName); + isPrevBlockTemplatePart = prevBlockType?.name === 'core/template-part'; + } return { blockMovingMode: hasBlockMovingClientId(), editorMode: __unstableGetEditorMode(), icon: match?.icon || blockType.icon, - label: (0,external_wp_blocks_namespaceObject.__experimentalGetAccessibleBlockLabel)(blockType, attributes, index + 1, orientation) + label: (0,external_wp_blocks_namespaceObject.__experimentalGetAccessibleBlockLabel)(blockType, attributes, index + 1, orientation), + isBlockTemplatePart, + isNextBlockTemplatePart, + isPrevBlockTemplatePart, + canRemove: canRemoveBlock(clientId), + canMove: canMoveBlock(clientId) }; }, [clientId, rootClientId]); const { label, icon, blockMovingMode, - editorMode + editorMode, + isBlockTemplatePart, + isNextBlockTemplatePart, + isPrevBlockTemplatePart, + canRemove, + canMove } = selected; const { setNavigationMode, @@ -51153,9 +55315,11 @@ function BlockSelectionButton({ // Focus the breadcrumb in navigation mode. (0,external_wp_element_namespaceObject.useEffect)(() => { - ref.current.focus(); - (0,external_wp_a11y_namespaceObject.speak)(label); - }, [label]); + if (editorMode === 'navigation') { + ref.current.focus(); + (0,external_wp_a11y_namespaceObject.speak)(label); + } + }, [label, editorMode]); const blockElement = useBlockElement(clientId); const { hasBlockMovingClientId, @@ -51265,49 +55429,74 @@ function BlockSelectionButton({ } } } - const classNames = classnames_default()('block-editor-block-list__block-selection-button', { + const classNames = dist_clsx('block-editor-block-list__block-selection-button', { 'is-block-moving-mode': !!blockMovingMode }); const dragHandleLabel = (0,external_wp_i18n_namespaceObject.__)('Drag'); - return (0,external_React_.createElement)("div", { - className: classNames - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, { - justify: "center", - className: "block-editor-block-list__block-selection-button__content" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)(block_icon, { - icon: icon, - showColors: true - })), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, editorMode === 'zoom-out' && (0,external_React_.createElement)(block_mover, { - clientIds: [clientId], - hideDragHandle: true - }), editorMode === 'navigation' && (0,external_React_.createElement)(block_draggable, { - clientIds: [clientId] - }, draggableProps => (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - icon: drag_handle, - className: "block-selection-button_drag-handle", - "aria-hidden": "true", - label: dragHandleLabel - // Should not be able to tab to drag handle as this - // button can only be used with a pointer device. - , - tabIndex: "-1", - ...draggableProps - }))), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - ref: ref, - onClick: editorMode === 'navigation' ? () => setNavigationMode(false) : undefined, - onKeyDown: onKeyDown, - label: label, - showTooltip: false, - className: "block-selection-button_select-button" - }, (0,external_React_.createElement)(BlockTitle, { - clientId: clientId, - maximumLength: 35 - }))))); + const showBlockDraggable = canMove && editorMode === 'navigation' || editorMode === 'zoom-out' && canMove && !isBlockTemplatePart; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: classNames, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { + justify: "center", + className: "block-editor-block-list__block-selection-button__content", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { + icon: icon, + showColors: true + }) + }), showBlockDraggable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_draggable, { + clientIds: [clientId], + children: draggableProps => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + icon: drag_handle, + className: "block-selection-button_drag-handle", + "aria-hidden": "true", + label: dragHandleLabel + // Should not be able to tab to drag handle as this + // button can only be used with a pointer device. + , + tabIndex: "-1", + ...draggableProps + }) + }) + }), editorMode === 'zoom-out' && !isBlockTemplatePart && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_mover, { + clientIds: [clientId], + hideDragHandle: true, + isBlockMoverUpButtonDisabled: isPrevBlockTemplatePart, + isBlockMoverDownButtonDisabled: isNextBlockTemplatePart + }) + }), canMove && canRemove && editorMode === 'zoom-out' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Shuffle, { + clientId: clientId, + as: external_wp_components_namespaceObject.Button + }), canRemove && editorMode === 'zoom-out' && !isBlockTemplatePart && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { + icon: library_trash, + label: "Delete", + onClick: () => { + removeBlock(clientId); + } + }) + }), editorMode === 'navigation' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + ref: ref, + onClick: editorMode === 'navigation' ? () => setNavigationMode(false) : undefined, + onKeyDown: onKeyDown, + label: label, + showTooltip: false, + className: "block-selection-button_select-button", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockTitle, { + clientId: clientId, + maximumLength: 35 + }) + }) + })] + }) + }); } /* harmony default export */ const block_selection_button = (BlockSelectionButton); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/block-toolbar-breadcrumb.js - /** * External dependencies */ @@ -51320,6 +55509,7 @@ function BlockSelectionButton({ + function BlockToolbarBreadcrumb({ clientId, __unstableContentRef @@ -51334,41 +55524,79 @@ function BlockToolbarBreadcrumb({ contentElement: __unstableContentRef?.current, clientId }); - return (0,external_React_.createElement)(block_popover, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateBlockPopover, { clientId: capturingClientId || clientId, bottomClientId: lastClientId, - className: classnames_default()('block-editor-block-list__block-popover', { + className: dist_clsx('block-editor-block-list__block-popover', { 'is-insertion-point-visible': isInsertionPointVisible }), resize: false, - ...popoverProps - }, (0,external_React_.createElement)(block_selection_button, { - clientId: clientId, - rootClientId: rootClientId - })); + ...popoverProps, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_selection_button, { + clientId: clientId, + rootClientId: rootClientId + }) + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/zoom-out-mode-inserters.js - /** * WordPress dependencies */ + + + /** * Internal dependencies */ -function ZoomOutModeInserters({ - __unstableContentRef -}) { + + +function ZoomOutModeInserters() { const [isReady, setIsReady] = (0,external_wp_element_namespaceObject.useState)(false); - const blockOrder = (0,external_wp_data_namespaceObject.useSelect)(select => { - return select(store).getBlockOrder(); + const { + blockOrder, + sectionRootClientId, + insertionPoint, + setInserterIsOpened, + selectedSection + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getSettings, + getBlockOrder + } = select(store); + const { + sectionRootClientId: root + } = unlock(getSettings()); + // To do: move ZoomOutModeInserters to core/editor. + // Or we perhaps we should move the insertion point state to the + // block-editor store. I'm not sure what it was ever moved to the editor + // store, because all the inserter components all live in the + // block-editor package. + // eslint-disable-next-line @wordpress/data-no-store-string-literals + const editor = select('core/editor'); + return { + selectedSection: editor.getSelectedBlock(), + blockOrder: getBlockOrder(root), + insertionPoint: unlock(editor).getInsertionPoint(), + sectionRootClientId: root, + setInserterIsOpened: getSettings().__experimentalSetIsInserterOpened + }; }, []); + const isMounted = (0,external_wp_element_namespaceObject.useRef)(false); + (0,external_wp_element_namespaceObject.useEffect)(() => { + if (!isMounted.current) { + isMounted.current = true; + return; + } + // reset insertion point when the block order changes + setInserterIsOpened(true); + }, [blockOrder, setInserterIsOpened]); // Defer the initial rendering to avoid the jumps due to the animation. (0,external_wp_element_namespaceObject.useEffect)(() => { @@ -51379,31 +55607,89 @@ function ZoomOutModeInserters({ clearTimeout(timeout); }; }, []); - if (!isReady) { + if (!isReady || !selectedSection) { return null; } - return blockOrder.map((clientId, index) => { - if (index === blockOrder.length - 1) { - return null; - } - return (0,external_React_.createElement)(inbetween, { - key: clientId, + return [undefined, ...blockOrder].map((clientId, index) => { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(inbetween, { previousClientId: clientId, - nextClientId: blockOrder[index + 1], - __unstableContentRef: __unstableContentRef - }, (0,external_React_.createElement)("div", { - className: "block-editor-block-list__insertion-point-inserter is-with-inserter" - }, (0,external_React_.createElement)(inserter, { - position: "bottom center", - clientId: blockOrder[index + 1], - __experimentalIsQuick: true - }))); + nextClientId: blockOrder[index], + children: [insertionPoint.insertionIndex === index && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + style: { + borderRadius: '0', + height: '12px', + opacity: 1, + transform: 'translateY(-50%)', + width: '100%' + }, + className: "block-editor-block-list__insertion-point-indicator" + }), insertionPoint.insertionIndex !== index && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + variant: "primary", + icon: library_plus, + size: "compact", + className: "block-editor-button-pattern-inserter__button", + onClick: () => { + setInserterIsOpened({ + rootClientId: sectionRootClientId, + insertionIndex: index, + tab: 'patterns', + category: 'all' + }); + }, + label: (0,external_wp_i18n_namespaceObject._x)('Add pattern', 'Generic label for pattern inserter button') + })] + }, index); }); } /* harmony default export */ const zoom_out_mode_inserters = (ZoomOutModeInserters); -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/index.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/use-show-block-tools.js +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + +/** + * Source of truth for which block tools are showing in the block editor. + * + * @return {Object} Object of which block tools will be shown. + */ +function useShowBlockTools() { + return (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getSelectedBlockClientId, + getFirstMultiSelectedBlockClientId, + getBlock, + getSettings, + hasMultiSelection, + __unstableGetEditorMode, + isTyping + } = select(store); + const clientId = getSelectedBlockClientId() || getFirstMultiSelectedBlockClientId(); + const block = getBlock(clientId) || { + name: '', + attributes: {} + }; + const editorMode = __unstableGetEditorMode(); + const hasSelectedBlock = clientId && block?.name; + const isEmptyDefaultBlock = (0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(block); + const _showEmptyBlockSideInserter = clientId && !isTyping() && editorMode === 'edit' && isEmptyDefaultBlock; + const maybeShowBreadcrumb = hasSelectedBlock && !hasMultiSelection() && (editorMode === 'navigation' || editorMode === 'zoom-out'); + return { + showEmptyBlockSideInserter: _showEmptyBlockSideInserter, + showBreadcrumb: !_showEmptyBlockSideInserter && maybeShowBreadcrumb, + showBlockToolbarPopover: !getSettings().hasFixedToolbar && !_showEmptyBlockSideInserter && hasSelectedBlock && !isEmptyDefaultBlock && !maybeShowBreadcrumb + }; + }, []); +} +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/index.js /** * WordPress dependencies */ @@ -51413,6 +55699,9 @@ function ZoomOutModeInserters({ + + + /** * Internal dependencies */ @@ -51423,174 +55712,547 @@ function ZoomOutModeInserters({ + + + + function block_tools_selector(select) { const { getSelectedBlockClientId, getFirstMultiSelectedBlockClientId, - getBlock, getSettings, - hasMultiSelection, __unstableGetEditorMode, isTyping } = select(store); const clientId = getSelectedBlockClientId() || getFirstMultiSelectedBlockClientId(); - const { - name = '', - attributes = {} - } = getBlock(clientId) || {}; const editorMode = __unstableGetEditorMode(); - const hasSelectedBlock = clientId && name; - const isEmptyDefaultBlock = (0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)({ - name, - attributes - }); - const _showEmptyBlockSideInserter = clientId && !isTyping() && editorMode === 'edit' && (0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)({ - name, - attributes + return { + clientId, + hasFixedToolbar: getSettings().hasFixedToolbar, + isTyping: isTyping(), + isZoomOutMode: editorMode === 'zoom-out' + }; +} + +/** + * Renders block tools (the block toolbar, select/navigation mode toolbar, the + * insertion point and a slot for the inline rich text toolbar). Must be wrapped + * around the block content and editor styles wrapper or iframe. + * + * @param {Object} $0 Props. + * @param {Object} $0.children The block content and style container. + * @param {Object} $0.__unstableContentRef Ref holding the content scroll container. + */ +function BlockTools({ + children, + __unstableContentRef, + ...props +}) { + const { + clientId, + hasFixedToolbar, + isTyping, + isZoomOutMode + } = (0,external_wp_data_namespaceObject.useSelect)(block_tools_selector, []); + const isMatch = (0,external_wp_keyboardShortcuts_namespaceObject.__unstableUseShortcutEventMatch)(); + const { + getBlocksByClientId, + getSelectedBlockClientIds, + getBlockRootClientId, + isGroupable + } = (0,external_wp_data_namespaceObject.useSelect)(store); + const { + getGroupingBlockName + } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); + const { + showEmptyBlockSideInserter, + showBreadcrumb, + showBlockToolbarPopover + } = useShowBlockTools(); + const { + duplicateBlocks, + removeBlocks, + replaceBlocks, + insertAfterBlock, + insertBeforeBlock, + selectBlock, + moveBlocksUp, + moveBlocksDown, + expandBlock + } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); + function onKeyDown(event) { + if (event.defaultPrevented) { + return; + } + if (isMatch('core/block-editor/move-up', event)) { + const clientIds = getSelectedBlockClientIds(); + if (clientIds.length) { + event.preventDefault(); + const rootClientId = getBlockRootClientId(clientIds[0]); + moveBlocksUp(clientIds, rootClientId); + } + } else if (isMatch('core/block-editor/move-down', event)) { + const clientIds = getSelectedBlockClientIds(); + if (clientIds.length) { + event.preventDefault(); + const rootClientId = getBlockRootClientId(clientIds[0]); + moveBlocksDown(clientIds, rootClientId); + } + } else if (isMatch('core/block-editor/duplicate', event)) { + const clientIds = getSelectedBlockClientIds(); + if (clientIds.length) { + event.preventDefault(); + duplicateBlocks(clientIds); + } + } else if (isMatch('core/block-editor/remove', event)) { + const clientIds = getSelectedBlockClientIds(); + if (clientIds.length) { + event.preventDefault(); + removeBlocks(clientIds); + } + } else if (isMatch('core/block-editor/insert-after', event)) { + const clientIds = getSelectedBlockClientIds(); + if (clientIds.length) { + event.preventDefault(); + insertAfterBlock(clientIds[clientIds.length - 1]); + } + } else if (isMatch('core/block-editor/insert-before', event)) { + const clientIds = getSelectedBlockClientIds(); + if (clientIds.length) { + event.preventDefault(); + insertBeforeBlock(clientIds[0]); + } + } else if (isMatch('core/block-editor/unselect', event)) { + if (event.target.closest('[role=toolbar]')) { + // This shouldn't be necessary, but we have a combination of a few things all combining to create a situation where: + // - Because the block toolbar uses createPortal to populate the block toolbar fills, we can't rely on the React event bubbling to hit the onKeyDown listener for the block toolbar + // - Since we can't use the React tree, we use the DOM tree which _should_ handle the event bubbling correctly from a `createPortal` element. + // - This bubbles via the React tree, which hits this `unselect` escape keypress before the block toolbar DOM event listener has access to it. + // An alternative would be to remove the addEventListener on the navigableToolbar and use this event to handle it directly right here. That feels hacky too though. + return; + } + const clientIds = getSelectedBlockClientIds(); + if (clientIds.length > 1) { + event.preventDefault(); + // If there is more than one block selected, select the first + // block so that focus is directed back to the beginning of the selection. + // In effect, to the user this feels like deselecting the multi-selection. + selectBlock(clientIds[0]); + } + } else if (isMatch('core/block-editor/collapse-list-view', event)) { + // If focus is currently within a text field, such as a rich text block or other editable field, + // skip collapsing the list view, and allow the keyboard shortcut to be handled by the text field. + // This condition checks for both the active element and the active element within an iframed editor. + if ((0,external_wp_dom_namespaceObject.isTextField)(event.target) || (0,external_wp_dom_namespaceObject.isTextField)(event.target?.contentWindow?.document?.activeElement)) { + return; + } + event.preventDefault(); + expandBlock(clientId); + } else if (isMatch('core/block-editor/group', event)) { + const clientIds = getSelectedBlockClientIds(); + if (clientIds.length > 1 && isGroupable(clientIds)) { + event.preventDefault(); + const blocks = getBlocksByClientId(clientIds); + const groupingBlockName = getGroupingBlockName(); + const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, groupingBlockName); + replaceBlocks(clientIds, newBlocks); + (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Selected blocks are grouped.')); + } + } + } + const blockToolbarRef = use_popover_scroll(__unstableContentRef); + const blockToolbarAfterRef = use_popover_scroll(__unstableContentRef); + return ( + /*#__PURE__*/ + // eslint-disable-next-line jsx-a11y/no-static-element-interactions + (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + ...props, + onKeyDown: onKeyDown, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(insertion_point_InsertionPointOpenRef.Provider, { + value: (0,external_wp_element_namespaceObject.useRef)(false), + children: [!isTyping && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InsertionPoint, { + __unstableContentRef: __unstableContentRef + }), showEmptyBlockSideInserter && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EmptyBlockInserter, { + __unstableContentRef: __unstableContentRef, + clientId: clientId + }), showBlockToolbarPopover && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockToolbarPopover, { + __unstableContentRef: __unstableContentRef, + clientId: clientId, + isTyping: isTyping + }), showBreadcrumb && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockToolbarBreadcrumb, { + __unstableContentRef: __unstableContentRef, + clientId: clientId + }), !isZoomOutMode && !hasFixedToolbar && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover.Slot, { + name: "block-toolbar", + ref: blockToolbarRef + }), children, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover.Slot, { + name: "__unstable-block-tools-after", + ref: blockToolbarAfterRef + }), window.__experimentalEnableZoomedOutPatternsTab && isZoomOutMode && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(zoom_out_mode_inserters, { + __unstableContentRef: __unstableContentRef + })] + }) + }) + ); +} + +;// CONCATENATED MODULE: external ["wp","commands"] +const external_wp_commands_namespaceObject = window["wp"]["commands"]; +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/move-to.js +/** + * WordPress dependencies + */ + + +const move_to_moveTo = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M19.75 9c0-1.257-.565-2.197-1.39-2.858-.797-.64-1.827-1.017-2.815-1.247-1.802-.42-3.703-.403-4.383-.396L11 4.5V6l.177-.001c.696-.006 2.416-.02 4.028.356.887.207 1.67.518 2.216.957.52.416.829.945.829 1.688 0 .592-.167.966-.407 1.23-.255.281-.656.508-1.236.674-1.19.34-2.82.346-4.607.346h-.077c-1.692 0-3.527 0-4.942.404-.732.209-1.424.545-1.935 1.108-.526.579-.796 1.33-.796 2.238 0 1.257.565 2.197 1.39 2.858.797.64 1.827 1.017 2.815 1.247 1.802.42 3.703.403 4.383.396L13 19.5h.714V22L18 18.5 13.714 15v3H13l-.177.001c-.696.006-2.416.02-4.028-.356-.887-.207-1.67-.518-2.216-.957-.52-.416-.829-.945-.829-1.688 0-.592.167-.966.407-1.23.255-.281.656-.508 1.237-.674 1.189-.34 2.819-.346 4.606-.346h.077c1.692 0 3.527 0 4.941-.404.732-.209 1.425-.545 1.936-1.108.526-.579.796-1.33.796-2.238z" + }) +}); +/* harmony default export */ const move_to = (move_to_moveTo); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/ungroup.js +/** + * WordPress dependencies + */ + + +const ungroup = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M18 4h-7c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 9c0 .3-.2.5-.5.5h-7c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v7zm-5 5c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h1V9H6c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2v-1h-1.5v1z" + }) +}); +/* harmony default export */ const library_ungroup = (ungroup); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-block-commands/index.js +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + + +const useTransformCommands = () => { + const { + replaceBlocks, + multiSelect + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const { + blocks, + clientIds, + canRemove, + possibleBlockTransformations, + invalidSelection + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getBlockRootClientId, + getBlockTransformItems, + getSelectedBlockClientIds, + getBlocksByClientId, + canRemoveBlocks + } = select(store); + const selectedBlockClientIds = getSelectedBlockClientIds(); + const selectedBlocks = getBlocksByClientId(selectedBlockClientIds); + + // selectedBlocks can have `null`s when something tries to call `selectBlock` with an inexistent clientId. + // These nulls will cause fatal errors down the line. + // In order to prevent discrepancies between selectedBlockClientIds and selectedBlocks, we effectively treat the entire selection as invalid. + // @see https://github.com/WordPress/gutenberg/pull/59410#issuecomment-2006304536 + if (selectedBlocks.filter(block => !block).length > 0) { + return { + invalidSelection: true + }; + } + const rootClientId = getBlockRootClientId(selectedBlockClientIds[0]); + return { + blocks: selectedBlocks, + clientIds: selectedBlockClientIds, + possibleBlockTransformations: getBlockTransformItems(selectedBlocks, rootClientId), + canRemove: canRemoveBlocks(selectedBlockClientIds), + invalidSelection: false + }; + }, []); + if (invalidSelection) { + return { + isLoading: false, + commands: [] + }; + } + const isTemplate = blocks.length === 1 && (0,external_wp_blocks_namespaceObject.isTemplatePart)(blocks[0]); + function selectForMultipleBlocks(insertedBlocks) { + if (insertedBlocks.length > 1) { + multiSelect(insertedBlocks[0].clientId, insertedBlocks[insertedBlocks.length - 1].clientId); + } + } + + // Simple block tranformation based on the `Block Transforms` API. + function onBlockTransform(name) { + const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, name); + replaceBlocks(clientIds, newBlocks); + selectForMultipleBlocks(newBlocks); + } + + /** + * The `isTemplate` check is a stopgap solution here. + * Ideally, the Transforms API should handle this + * by allowing to exclude blocks from wildcard transformations. + */ + const hasPossibleBlockTransformations = !!possibleBlockTransformations.length && canRemove && !isTemplate; + if (!clientIds || clientIds.length < 1 || !hasPossibleBlockTransformations) { + return { + isLoading: false, + commands: [] + }; + } + const commands = possibleBlockTransformations.map(transformation => { + const { + name, + title, + icon + } = transformation; + return { + name: 'core/block-editor/transform-to-' + name.replace('/', '-'), + // translators: %s: block title/name. + label: (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Transform to %s'), title), + icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { + icon: icon + }), + callback: ({ + close + }) => { + onBlockTransform(name); + close(); + } + }; }); - const maybeShowBreadcrumb = hasSelectedBlock && !hasMultiSelection() && (editorMode === 'navigation' || editorMode === 'zoom-out'); return { - clientId, - hasFixedToolbar: getSettings().hasFixedToolbar, - isTyping: isTyping(), - isZoomOutMode: editorMode === 'zoom-out', - showEmptyBlockSideInserter: _showEmptyBlockSideInserter, - showBreadcrumb: !_showEmptyBlockSideInserter && maybeShowBreadcrumb, - showBlockToolbar: !getSettings().hasFixedToolbar && !_showEmptyBlockSideInserter && hasSelectedBlock && !isEmptyDefaultBlock && !maybeShowBreadcrumb + isLoading: false, + commands + }; +}; +const useActionsCommands = () => { + const { + clientIds + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getSelectedBlockClientIds + } = select(store); + const selectedBlockClientIds = getSelectedBlockClientIds(); + return { + clientIds: selectedBlockClientIds + }; + }, []); + const { + getBlockRootClientId, + canMoveBlocks, + getBlockCount + } = (0,external_wp_data_namespaceObject.useSelect)(store); + const { + setBlockMovingClientId, + setNavigationMode, + selectBlock + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + if (!clientIds || clientIds.length < 1) { + return { + isLoading: false, + commands: [] + }; + } + const rootClientId = getBlockRootClientId(clientIds[0]); + const canMove = canMoveBlocks(clientIds) && getBlockCount(rootClientId) !== 1; + const commands = []; + if (canMove) { + commands.push({ + name: 'move-to', + label: (0,external_wp_i18n_namespaceObject.__)('Move to'), + callback: () => { + setNavigationMode(true); + selectBlock(clientIds[0]); + setBlockMovingClientId(clientIds[0]); + }, + icon: move_to + }); + } + return { + isLoading: false, + commands: commands.map(command => ({ + ...command, + name: 'core/block-editor/action-' + command.name, + callback: ({ + close + }) => { + command.callback(); + close(); + } + })) }; -} - -/** - * Renders block tools (the block toolbar, select/navigation mode toolbar, the - * insertion point and a slot for the inline rich text toolbar). Must be wrapped - * around the block content and editor styles wrapper or iframe. - * - * @param {Object} $0 Props. - * @param {Object} $0.children The block content and style container. - * @param {Object} $0.__unstableContentRef Ref holding the content scroll container. - */ -function BlockTools({ - children, - __unstableContentRef, - ...props -}) { +}; +const useQuickActionsCommands = () => { const { - clientId, - hasFixedToolbar, - isTyping, - isZoomOutMode, - showEmptyBlockSideInserter, - showBreadcrumb, - showBlockToolbar - } = (0,external_wp_data_namespaceObject.useSelect)(block_tools_selector, []); - const isMatch = (0,external_wp_keyboardShortcuts_namespaceObject.__unstableUseShortcutEventMatch)(); + clientIds, + isUngroupable, + isGroupable + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getSelectedBlockClientIds, + isUngroupable: _isUngroupable, + isGroupable: _isGroupable + } = select(store); + const selectedBlockClientIds = getSelectedBlockClientIds(); + return { + clientIds: selectedBlockClientIds, + isUngroupable: _isUngroupable(), + isGroupable: _isGroupable() + }; + }, []); const { - getSelectedBlockClientIds, - getBlockRootClientId + canInsertBlockType, + getBlockRootClientId, + getBlocksByClientId, + canRemoveBlocks } = (0,external_wp_data_namespaceObject.useSelect)(store); const { - duplicateBlocks, + getDefaultBlockName, + getGroupingBlockName + } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); + const blocks = getBlocksByClientId(clientIds); + const { removeBlocks, + replaceBlocks, + duplicateBlocks, insertAfterBlock, - insertBeforeBlock, - selectBlock, - moveBlocksUp, - moveBlocksDown + insertBeforeBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); - function onKeyDown(event) { - if (event.defaultPrevented) return; - if (isMatch('core/block-editor/move-up', event)) { - const clientIds = getSelectedBlockClientIds(); - if (clientIds.length) { - event.preventDefault(); - const rootClientId = getBlockRootClientId(clientIds[0]); - moveBlocksUp(clientIds, rootClientId); - } - } else if (isMatch('core/block-editor/move-down', event)) { - const clientIds = getSelectedBlockClientIds(); - if (clientIds.length) { - event.preventDefault(); - const rootClientId = getBlockRootClientId(clientIds[0]); - moveBlocksDown(clientIds, rootClientId); - } - } else if (isMatch('core/block-editor/duplicate', event)) { - const clientIds = getSelectedBlockClientIds(); - if (clientIds.length) { - event.preventDefault(); - duplicateBlocks(clientIds); - } - } else if (isMatch('core/block-editor/remove', event)) { - const clientIds = getSelectedBlockClientIds(); - if (clientIds.length) { - event.preventDefault(); - removeBlocks(clientIds); - } - } else if (isMatch('core/block-editor/insert-after', event)) { - const clientIds = getSelectedBlockClientIds(); - if (clientIds.length) { - event.preventDefault(); - insertAfterBlock(clientIds[clientIds.length - 1]); - } - } else if (isMatch('core/block-editor/insert-before', event)) { - const clientIds = getSelectedBlockClientIds(); - if (clientIds.length) { - event.preventDefault(); - insertBeforeBlock(clientIds[0]); - } - } else if (isMatch('core/block-editor/unselect', event)) { - if (event.target.closest('[role=toolbar]')) { - // This shouldn't be necessary, but we have a combination of a few things all combining to create a situation where: - // - Because the block toolbar uses createPortal to populate the block toolbar fills, we can't rely on the React event bubbling to hit the onKeyDown listener for the block toolbar - // - Since we can't use the React tree, we use the DOM tree which _should_ handle the event bubbling correctly from a `createPortal` element. - // - This bubbles via the React tree, which hits this `unselect` escape keypress before the block toolbar DOM event listener has access to it. - // An alternative would be to remove the addEventListener on the navigableToolbar and use this event to handle it directly right here. That feels hacky too though. - return; - } - const clientIds = getSelectedBlockClientIds(); - if (clientIds.length > 1) { - event.preventDefault(); - // If there is more than one block selected, select the first - // block so that focus is directed back to the beginning of the selection. - // In effect, to the user this feels like deselecting the multi-selection. - selectBlock(clientIds[0]); - } + const onGroup = () => { + if (!blocks.length) { + return; + } + const groupingBlockName = getGroupingBlockName(); + + // Activate the `transform` on `core/group` which does the conversion. + const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, groupingBlockName); + if (!newBlocks) { + return; + } + replaceBlocks(clientIds, newBlocks); + }; + const onUngroup = () => { + if (!blocks.length) { + return; + } + const innerBlocks = blocks[0].innerBlocks; + if (!innerBlocks.length) { + return; } + replaceBlocks(clientIds, innerBlocks); + }; + if (!clientIds || clientIds.length < 1) { + return { + isLoading: false, + commands: [] + }; } - const blockToolbarRef = use_popover_scroll(__unstableContentRef); - const blockToolbarAfterRef = use_popover_scroll(__unstableContentRef); - return ( - // eslint-disable-next-line jsx-a11y/no-static-element-interactions - (0,external_React_.createElement)("div", { - ...props, - onKeyDown: onKeyDown - }, (0,external_React_.createElement)(insertion_point_InsertionPointOpenRef.Provider, { - value: (0,external_wp_element_namespaceObject.useRef)(false) - }, !isTyping && (0,external_React_.createElement)(InsertionPoint, { - __unstableContentRef: __unstableContentRef - }), showEmptyBlockSideInserter && (0,external_React_.createElement)(EmptyBlockInserter, { - __unstableContentRef: __unstableContentRef, - clientId: clientId - }), showBlockToolbar && (0,external_React_.createElement)(BlockToolbarPopover, { - __unstableContentRef: __unstableContentRef, - clientId: clientId, - isTyping: isTyping - }), showBreadcrumb && (0,external_React_.createElement)(BlockToolbarBreadcrumb, { - __unstableContentRef: __unstableContentRef, - clientId: clientId - }), !isZoomOutMode && !hasFixedToolbar && (0,external_React_.createElement)(external_wp_components_namespaceObject.Popover.Slot, { - name: "block-toolbar", - ref: blockToolbarRef - }), children, (0,external_React_.createElement)(external_wp_components_namespaceObject.Popover.Slot, { - name: "__unstable-block-tools-after", - ref: blockToolbarAfterRef - }), isZoomOutMode && (0,external_React_.createElement)(zoom_out_mode_inserters, { - __unstableContentRef: __unstableContentRef - }))) - ); -} + const rootClientId = getBlockRootClientId(clientIds[0]); + const canInsertDefaultBlock = canInsertBlockType(getDefaultBlockName(), rootClientId); + const canDuplicate = blocks.every(block => { + return !!block && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, 'multiple', true) && canInsertBlockType(block.name, rootClientId); + }); + const canRemove = canRemoveBlocks(clientIds); + const commands = []; + if (canDuplicate) { + commands.push({ + name: 'duplicate', + label: (0,external_wp_i18n_namespaceObject.__)('Duplicate'), + callback: () => duplicateBlocks(clientIds, true), + icon: library_copy + }); + } + if (canInsertDefaultBlock) { + commands.push({ + name: 'add-before', + label: (0,external_wp_i18n_namespaceObject.__)('Add before'), + callback: () => { + const clientId = Array.isArray(clientIds) ? clientIds[0] : clientId; + insertBeforeBlock(clientId); + }, + icon: library_plus + }, { + name: 'add-after', + label: (0,external_wp_i18n_namespaceObject.__)('Add after'), + callback: () => { + const clientId = Array.isArray(clientIds) ? clientIds[clientIds.length - 1] : clientId; + insertAfterBlock(clientId); + }, + icon: library_plus + }); + } + if (isGroupable) { + commands.push({ + name: 'Group', + label: (0,external_wp_i18n_namespaceObject.__)('Group'), + callback: onGroup, + icon: library_group + }); + } + if (isUngroupable) { + commands.push({ + name: 'ungroup', + label: (0,external_wp_i18n_namespaceObject.__)('Ungroup'), + callback: onUngroup, + icon: library_ungroup + }); + } + if (canRemove) { + commands.push({ + name: 'remove', + label: (0,external_wp_i18n_namespaceObject.__)('Delete'), + callback: () => removeBlocks(clientIds, true), + icon: library_trash + }); + } + return { + isLoading: false, + commands: commands.map(command => ({ + ...command, + name: 'core/block-editor/action-' + command.name, + callback: ({ + close + }) => { + command.callback(); + close(); + } + })) + }; +}; +const useBlockCommands = () => { + (0,external_wp_commands_namespaceObject.useCommandLoader)({ + name: 'core/block-editor/blockTransforms', + hook: useTransformCommands + }); + (0,external_wp_commands_namespaceObject.useCommandLoader)({ + name: 'core/block-editor/blockActions', + hook: useActionsCommands + }); + (0,external_wp_commands_namespaceObject.useCommandLoader)({ + name: 'core/block-editor/blockQuickActions', + hook: useQuickActionsCommands, + context: 'block-selection-edit' + }); +}; ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-canvas/index.js - /** * WordPress dependencies */ @@ -51607,55 +56269,63 @@ function BlockTools({ + + + function ExperimentalBlockCanvas({ shouldIframe = true, height = '300px', - children = (0,external_React_.createElement)(BlockList, null), + children = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockList, {}), styles, contentRef: contentRefProp, iframeProps }) { + useBlockCommands(); const resetTypingRef = useMouseMoveTypingReset(); const clearerRef = useBlockSelectionClearer(); const localRef = (0,external_wp_element_namespaceObject.useRef)(); const contentRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([contentRefProp, clearerRef, localRef]); if (!shouldIframe) { - return (0,external_React_.createElement)(BlockTools, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(BlockTools, { __unstableContentRef: localRef, style: { height, display: 'flex' - } - }, (0,external_React_.createElement)(EditorStyles, { - styles: styles, - scope: ".editor-styles-wrapper" - }), (0,external_React_.createElement)(writing_flow, { - ref: contentRef, - className: "editor-styles-wrapper", - tabIndex: -1, - style: { - height: '100%', - width: '100%' - } - }, children)); + }, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_styles, { + styles: styles, + scope: ".editor-styles-wrapper" + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(writing_flow, { + ref: contentRef, + className: "editor-styles-wrapper", + tabIndex: -1, + style: { + height: '100%', + width: '100%' + }, + children: children + })] + }); } - return (0,external_React_.createElement)(BlockTools, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockTools, { __unstableContentRef: localRef, style: { height, display: 'flex' - } - }, (0,external_React_.createElement)(iframe, { - ...iframeProps, - ref: resetTypingRef, - contentRef: contentRef, - style: { - ...iframeProps?.style }, - name: "editor-canvas" - }, (0,external_React_.createElement)(EditorStyles, { - styles: styles - }), children)); + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(iframe, { + ...iframeProps, + ref: resetTypingRef, + contentRef: contentRef, + style: { + ...iframeProps?.style + }, + name: "editor-canvas", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_styles, { + styles: styles + }), children] + }) + }); } /** @@ -51692,15 +56362,15 @@ function BlockCanvas({ height, styles }) { - return (0,external_React_.createElement)(ExperimentalBlockCanvas, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ExperimentalBlockCanvas, { height: height, - styles: styles - }, children); + styles: styles, + children: children + }); } /* harmony default export */ const block_canvas = (BlockCanvas); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/color-style-selector/index.js - /** * WordPress dependencies */ @@ -51708,12 +56378,14 @@ function BlockCanvas({ -const ColorSelectorSVGIcon = () => (0,external_React_.createElement)(external_wp_components_namespaceObject.SVG, { + +const ColorSelectorSVGIcon = () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 20 20" -}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Path, { - d: "M7.434 5l3.18 9.16H8.538l-.692-2.184H4.628l-.705 2.184H2L5.18 5h2.254zm-1.13 1.904h-.115l-1.148 3.593H7.44L6.304 6.904zM14.348 7.006c1.853 0 2.9.876 2.9 2.374v4.78h-1.79v-.914h-.114c-.362.64-1.123 1.022-2.031 1.022-1.346 0-2.292-.826-2.292-2.108 0-1.27.972-2.006 2.71-2.107l1.696-.102V9.38c0-.584-.42-.914-1.18-.914-.667 0-1.112.228-1.264.647h-1.701c.12-1.295 1.307-2.107 3.066-2.107zm1.079 4.1l-1.416.09c-.793.056-1.18.342-1.18.844 0 .52.45.837 1.091.837.857 0 1.505-.545 1.505-1.256v-.515z" -})); + viewBox: "0 0 20 20", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { + d: "M7.434 5l3.18 9.16H8.538l-.692-2.184H4.628l-.705 2.184H2L5.18 5h2.254zm-1.13 1.904h-.115l-1.148 3.593H7.44L6.304 6.904zM14.348 7.006c1.853 0 2.9.876 2.9 2.374v4.78h-1.79v-.914h-.114c-.362.64-1.123 1.022-2.031 1.022-1.346 0-2.292-.826-2.292-2.108 0-1.27.972-2.006 2.71-2.107l1.696-.102V9.38c0-.584-.42-.914-1.18-.914-.667 0-1.112.228-1.264.647h-1.701c.12-1.295 1.307-2.107 3.066-2.107zm1.079 4.1l-1.416.09c-.793.056-1.18.342-1.18.844 0 .52.45.837 1.091.837.857 0 1.505-.545 1.505-1.256v-.515z" + }) +}); /** * Color Selector Icon component. @@ -51728,12 +56400,14 @@ const ColorSelectorIcon = ({ style, className }) => { - return (0,external_React_.createElement)("div", { - className: "block-library-colors-selector__icon-container" - }, (0,external_React_.createElement)("div", { - className: `${className} block-library-colors-selector__state-selection`, - style: style - }, (0,external_React_.createElement)(ColorSelectorSVGIcon, null))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-library-colors-selector__icon-container", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: `${className} block-library-colors-selector__state-selection`, + style: style, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorSelectorSVGIcon, {}) + }) + }); }; /** @@ -51758,13 +56432,19 @@ const renderToggleComponent = ({ onToggle(); } }; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, { - className: "components-toolbar__control block-library-colors-selector__toggle", - label: (0,external_wp_i18n_namespaceObject.__)('Open Colors Selector'), - onClick: onToggle, - onKeyDown: openOnArrowDown, - icon: (0,external_React_.createElement)(BackgroundColor, null, (0,external_React_.createElement)(TextColor, null, (0,external_React_.createElement)(ColorSelectorIcon, null))) - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { + className: "components-toolbar__control block-library-colors-selector__toggle", + label: (0,external_wp_i18n_namespaceObject.__)('Open Colors Selector'), + onClick: onToggle, + onKeyDown: openOnArrowDown, + icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BackgroundColor, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TextColor, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorSelectorIcon, {}) + }) + }) + }) + }); }; const BlockColorsStyleSelector = ({ children, @@ -51775,7 +56455,7 @@ const BlockColorsStyleSelector = ({ since: '6.1', version: '6.3' }); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Dropdown, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: { placement: 'bottom-start' }, @@ -51788,17 +56468,18 @@ const BlockColorsStyleSelector = ({ /* harmony default export */ const color_style_selector = (BlockColorsStyleSelector); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list-view.js - /** * WordPress dependencies */ -const listView = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const listView = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z" -})); + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z" + }) +}); /* harmony default export */ const list_view = (listView); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/context.js @@ -51810,7 +56491,6 @@ const ListViewContext = (0,external_wp_element_namespaceObject.createContext)({} const useListViewContext = () => (0,external_wp_element_namespaceObject.useContext)(ListViewContext); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/aria-referenced-text.js - /** * WordPress dependencies */ @@ -51823,6 +56503,7 @@ const useListViewContext = () => (0,external_wp_element_namespaceObject.useConte * @param {Object} props Props. * @param {import('react').ReactNode} props.children */ + function AriaReferencedText({ children, ...props @@ -51836,15 +56517,15 @@ function AriaReferencedText({ ref.current.textContent = ref.current.textContent; } }, [children]); - return (0,external_React_.createElement)("div", { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { hidden: true, ...props, - ref: ref - }, children); + ref: ref, + children: children + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/appender.js - /** * WordPress dependencies */ @@ -51862,6 +56543,8 @@ function AriaReferencedText({ + + const Appender = (0,external_wp_element_namespaceObject.forwardRef)(({ nestingLevel, blockCount, @@ -51902,32 +56585,33 @@ const Appender = (0,external_wp_element_namespaceObject.forwardRef)(({ const descriptionId = `list-view-appender__${instanceId}`; const description = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: The name of the block. 2: The numerical position of the block. 3: The level of nesting for the block. */ (0,external_wp_i18n_namespaceObject.__)('Append to %1$s block at position %2$d, Level %3$d'), blockTitle, blockCount + 1, nestingLevel); - return (0,external_React_.createElement)("div", { - className: "list-view-appender" - }, (0,external_React_.createElement)(inserter, { - ref: ref, - rootClientId: clientId, - position: "bottom right", - isAppender: true, - selectBlockOnInsert: false, - shouldDirectInsert: false, - __experimentalIsQuick: true, - ...props, - toggleProps: { - 'aria-describedby': descriptionId - }, - onSelectOrClose: maybeInsertedBlock => { - if (maybeInsertedBlock?.clientId) { - setInsertedBlock(maybeInsertedBlock); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "list-view-appender", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inserter, { + ref: ref, + rootClientId: clientId, + position: "bottom right", + isAppender: true, + selectBlockOnInsert: false, + shouldDirectInsert: false, + __experimentalIsQuick: true, + ...props, + toggleProps: { + 'aria-describedby': descriptionId + }, + onSelectOrClose: maybeInsertedBlock => { + if (maybeInsertedBlock?.clientId) { + setInsertedBlock(maybeInsertedBlock); + } } - } - }), (0,external_React_.createElement)(AriaReferencedText, { - id: descriptionId - }, description)); + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AriaReferencedText, { + id: descriptionId, + children: description + })] + }); }); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/leaf.js - /** * External dependencies */ @@ -51945,6 +56629,7 @@ const Appender = (0,external_wp_element_namespaceObject.forwardRef)(({ * Internal dependencies */ + const AnimatedTreeGridRow = dist_esm_it(external_wp_components_namespaceObject.__experimentalTreeGridRow); const ListViewLeaf = (0,external_wp_element_namespaceObject.forwardRef)(({ isDragged, @@ -51963,15 +56648,16 @@ const ListViewLeaf = (0,external_wp_element_namespaceObject.forwardRef)(({ triggerAnimationOnChange: path }); const mergedRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, animationRef]); - return (0,external_React_.createElement)(AnimatedTreeGridRow, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AnimatedTreeGridRow, { ref: mergedRef, - className: classnames_default()('block-editor-list-view-leaf', className), + className: dist_clsx('block-editor-list-view-leaf', className), level: level, positionInSet: position, setSize: rowCount, isExpanded: undefined, - ...props - }, children); + ...props, + children: children + }); }); /* harmony default export */ const leaf = (ListViewLeaf); @@ -52018,48 +56704,51 @@ function useListViewScrollIntoView({ } ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pin-small.js - /** * WordPress dependencies */ -const pinSmall = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const pinSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { width: "24", height: "24", viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M10.97 10.159a3.382 3.382 0 0 0-2.857.955l1.724 1.723-2.836 2.913L7 17h1.25l2.913-2.837 1.723 1.723a3.38 3.38 0 0 0 .606-.825c.33-.63.446-1.343.35-2.032L17 10.695 13.305 7l-2.334 3.159Z" -})); + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M10.97 10.159a3.382 3.382 0 0 0-2.857.955l1.724 1.723-2.836 2.913L7 17h1.25l2.913-2.837 1.723 1.723a3.38 3.38 0 0 0 .606-.825c.33-.63.446-1.343.35-2.032L17 10.695 13.305 7l-2.334 3.159Z" + }) +}); /* harmony default export */ const pin_small = (pinSmall); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/lock-small.js - /** * WordPress dependencies */ -const lockSmall = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const lockSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - fillRule: "evenodd", - clipRule: "evenodd", - d: "M15 11h-.2V9c0-1.5-1.2-2.8-2.8-2.8S9.2 7.5 9.2 9v2H9c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1h6c.6 0 1-.4 1-1v-4c0-.6-.4-1-1-1zm-1.8 0h-2.5V9c0-.7.6-1.2 1.2-1.2s1.2.6 1.2 1.2v2z" -})); + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M15 11h-.2V9c0-1.5-1.2-2.8-2.8-2.8S9.2 7.5 9.2 9v2H9c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1h6c.6 0 1-.4 1-1v-4c0-.6-.4-1-1-1zm-1.8 0h-2.5V9c0-.7.6-1.2 1.2-1.2s1.2.6 1.2 1.2v2z" + }) +}); /* harmony default export */ const lock_small = (lockSmall); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/expander.js - /** * WordPress dependencies */ + function ListViewExpander({ onClick }) { return ( + /*#__PURE__*/ // Keyboard events are handled by TreeGrid see: components/src/tree-grid/index.js // // The expander component is implemented as a pseudo element in the w3 example @@ -52069,16 +56758,17 @@ function ListViewExpander({ // For the current tree grid implementation, please do not try to make this a button. // // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions - (0,external_React_.createElement)("span", { + (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-editor-list-view__expander", onClick: event => onClick(event, { forceToggle: true }), "aria-hidden": "true", - "data-testid": "list-view-expander" - }, (0,external_React_.createElement)(build_module_icon, { - icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_small : chevron_right_small - })) + "data-testid": "list-view-expander", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { + icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_small : chevron_right_small + }) + }) ); } @@ -52163,7 +56853,6 @@ function useListViewImages({ } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/block-select-button.js - /** * External dependencies */ @@ -52179,9 +56868,6 @@ function useListViewImages({ - - - /** * Internal dependencies */ @@ -52197,8 +56883,7 @@ function useListViewImages({ function ListViewBlockSelectButton({ className, block: { - clientId, - name: blockName + clientId }, onClick, onContextMenu, @@ -52210,9 +56895,7 @@ function ListViewBlockSelectButton({ onDragEnd, draggable, isExpanded, - ariaLabel, - ariaDescribedBy, - updateFocusAndSelection + ariaDescribedBy }, ref) { const blockInformation = useBlockDisplayInformation(clientId); const blockTitle = useBlockDisplayTitle({ @@ -52223,30 +56906,16 @@ function ListViewBlockSelectButton({ isLocked } = useBlockLock(clientId); const { - canInsertBlockType, - getSelectedBlockClientIds, - getPreviousBlockClientId, - getBlockRootClientId, - getBlockOrder, - getBlocksByClientId, - getBlockAttributes, - canRemoveBlocks - } = (0,external_wp_data_namespaceObject.useSelect)(store); - const { - duplicateBlocks, - multiSelect, - removeBlocks - } = (0,external_wp_data_namespaceObject.useDispatch)(store); - const isMatch = (0,external_wp_keyboardShortcuts_namespaceObject.__unstableUseShortcutEventMatch)(); + isContentOnly + } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ + isContentOnly: select(store).getBlockEditingMode(clientId) === 'contentOnly' + }), [clientId]); + const shouldShowLockIcon = isLocked && !isContentOnly; const isSticky = blockInformation?.positionType === 'sticky'; const images = useListViewImages({ clientId, isExpanded }); - const { - rootClientId - } = useListViewContext(); - const isConnected = getBlockAttributes(clientId)?.metadata?.bindings; const positionLabel = blockInformation?.positionLabel ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Position of selected block, e.g. "Sticky" or "Fixed". (0,external_wp_i18n_namespaceObject.__)('Position: %1$s'), blockInformation.positionLabel) : ''; @@ -52260,115 +56929,19 @@ function ListViewBlockSelectButton({ onDragStart?.(event); }; - // Determine which blocks to update: - // If the current (focused) block is part of the block selection, use the whole selection. - // If the focused block is not part of the block selection, only update the focused block. - function getBlocksToUpdate() { - const selectedBlockClientIds = getSelectedBlockClientIds(); - const isUpdatingSelectedBlocks = selectedBlockClientIds.includes(clientId); - const firstBlockClientId = isUpdatingSelectedBlocks ? selectedBlockClientIds[0] : clientId; - const firstBlockRootClientId = getBlockRootClientId(firstBlockClientId); - const blocksToUpdate = isUpdatingSelectedBlocks ? selectedBlockClientIds : [clientId]; - return { - blocksToUpdate, - firstBlockClientId, - firstBlockRootClientId, - selectedBlockClientIds - }; - } - /** * @param {KeyboardEvent} event */ - async function onKeyDownHandler(event) { + function onKeyDown(event) { if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER || event.keyCode === external_wp_keycodes_namespaceObject.SPACE) { onClick(event); - } else if (event.keyCode === external_wp_keycodes_namespaceObject.BACKSPACE || event.keyCode === external_wp_keycodes_namespaceObject.DELETE || isMatch('core/block-editor/remove', event)) { - var _getPreviousBlockClie; - const { - blocksToUpdate: blocksToDelete, - firstBlockClientId, - firstBlockRootClientId, - selectedBlockClientIds - } = getBlocksToUpdate(); - - // Don't update the selection if the blocks cannot be deleted. - if (!canRemoveBlocks(blocksToDelete, firstBlockRootClientId)) { - return; - } - let blockToFocus = (_getPreviousBlockClie = getPreviousBlockClientId(firstBlockClientId)) !== null && _getPreviousBlockClie !== void 0 ? _getPreviousBlockClie : - // If the previous block is not found (when the first block is deleted), - // fallback to focus the parent block. - firstBlockRootClientId; - removeBlocks(blocksToDelete, false); - - // Update the selection if the original selection has been removed. - const shouldUpdateSelection = selectedBlockClientIds.length > 0 && getSelectedBlockClientIds().length === 0; - - // If there's no previous block nor parent block, focus the first block. - if (!blockToFocus) { - blockToFocus = getBlockOrder()[0]; - } - updateFocusAndSelection(blockToFocus, shouldUpdateSelection); - } else if (isMatch('core/block-editor/duplicate', event)) { - if (event.defaultPrevented) { - return; - } - event.preventDefault(); - const { - blocksToUpdate, - firstBlockRootClientId - } = getBlocksToUpdate(); - const canDuplicate = getBlocksByClientId(blocksToUpdate).every(block => { - return !!block && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, 'multiple', true) && canInsertBlockType(block.name, firstBlockRootClientId); - }); - if (canDuplicate) { - const updatedBlocks = await duplicateBlocks(blocksToUpdate, false); - if (updatedBlocks?.length) { - // If blocks have been duplicated, focus the first duplicated block. - updateFocusAndSelection(updatedBlocks[0], false); - } - } - } else if (isMatch('core/block-editor/select-all', event)) { - if (event.defaultPrevented) { - return; - } - event.preventDefault(); - const { - firstBlockRootClientId, - selectedBlockClientIds - } = getBlocksToUpdate(); - const blockClientIds = getBlockOrder(firstBlockRootClientId); - if (!blockClientIds.length) { - return; - } - - // If we have selected all sibling nested blocks, try selecting up a level. - // This is a similar implementation to that used by `useSelectAll`. - // `isShallowEqual` is used for the list view instead of a length check, - // as the array of siblings of the currently focused block may be a different - // set of blocks from the current block selection if the user is focused - // on a different part of the list view from the block selection. - if (external_wp_isShallowEqual_default()(selectedBlockClientIds, blockClientIds)) { - // Only select up a level if the first block is not the root block. - // This ensures that the block selection can't break out of the root block - // used by the list view, if the list view is only showing a partial hierarchy. - if (firstBlockRootClientId && firstBlockRootClientId !== rootClientId) { - updateFocusAndSelection(firstBlockRootClientId, true); - return; - } - } - - // Select all while passing `null` to skip focusing to the editor canvas, - // and retain focus within the list view. - multiSelect(blockClientIds[0], blockClientIds[blockClientIds.length - 1], null); } } - return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - className: classnames_default()('block-editor-list-view-block-select-button', className), + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Button, { + className: dist_clsx('block-editor-list-view-block-select-button', className), onClick: onClick, onContextMenu: onContextMenu, - onKeyDown: onKeyDownHandler, + onKeyDown: onKeyDown, onMouseDown: onMouseDown, ref: ref, tabIndex: tabIndex, @@ -52377,57 +56950,59 @@ function ListViewBlockSelectButton({ onDragEnd: onDragEnd, draggable: draggable, href: `#block-${clientId}`, - "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, - "aria-expanded": isExpanded - }, (0,external_React_.createElement)(ListViewExpander, { - onClick: onToggleExpanded - }), (0,external_React_.createElement)(block_icon, { - icon: blockInformation?.icon, - showColors: true, - context: "list-view" - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { - alignment: "center", - className: "block-editor-list-view-block-select-button__label-wrapper", - justify: "flex-start", - spacing: 1 - }, (0,external_React_.createElement)("span", { - className: "block-editor-list-view-block-select-button__title" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, { - ellipsizeMode: "auto" - }, blockTitle)), blockInformation?.anchor && (0,external_React_.createElement)("span", { - className: "block-editor-list-view-block-select-button__anchor-wrapper" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, { - className: "block-editor-list-view-block-select-button__anchor", - ellipsizeMode: "auto" - }, blockInformation.anchor)), isConnected && canBindBlock(blockName) && (0,external_React_.createElement)("span", { - className: "block-editor-list-view-block-select-button__bindings" - }, (0,external_React_.createElement)(build_module_icon, { - icon: library_connection - })), positionLabel && isSticky && (0,external_React_.createElement)(external_wp_components_namespaceObject.Tooltip, { - text: positionLabel - }, (0,external_React_.createElement)(build_module_icon, { - icon: pin_small - })), images.length ? (0,external_React_.createElement)("span", { - className: "block-editor-list-view-block-select-button__images", - "aria-hidden": true - }, images.map((image, index) => (0,external_React_.createElement)("span", { - className: "block-editor-list-view-block-select-button__image", - key: image.clientId, - style: { - backgroundImage: `url(${image.url})`, - zIndex: images.length - index // Ensure the first image is on top, and subsequent images are behind. - } - }))) : null, isLocked && (0,external_React_.createElement)("span", { - className: "block-editor-list-view-block-select-button__lock" - }, (0,external_React_.createElement)(build_module_icon, { - icon: lock_small - }))))); + "aria-expanded": isExpanded, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewExpander, { + onClick: onToggleExpanded + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { + icon: blockInformation?.icon, + showColors: true, + context: "list-view" + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { + alignment: "center", + className: "block-editor-list-view-block-select-button__label-wrapper", + justify: "flex-start", + spacing: 1, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + className: "block-editor-list-view-block-select-button__title", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { + ellipsizeMode: "auto", + children: blockTitle + }) + }), blockInformation?.anchor && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + className: "block-editor-list-view-block-select-button__anchor-wrapper", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { + className: "block-editor-list-view-block-select-button__anchor", + ellipsizeMode: "auto", + children: blockInformation.anchor + }) + }), positionLabel && isSticky && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { + text: positionLabel, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { + icon: pin_small + }) + }), images.length ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + className: "block-editor-list-view-block-select-button__images", + "aria-hidden": true, + children: images.map((image, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + className: "block-editor-list-view-block-select-button__image", + style: { + backgroundImage: `url(${image.url})`, + zIndex: images.length - index // Ensure the first image is on top, and subsequent images are behind. + } + }, image.clientId)) + }) : null, shouldShowLockIcon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + className: "block-editor-list-view-block-select-button__lock", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { + icon: lock_small + }) + })] + })] + }); } /* harmony default export */ const block_select_button = ((0,external_wp_element_namespaceObject.forwardRef)(ListViewBlockSelectButton)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/block-contents.js - /** * External dependencies */ @@ -52446,6 +57021,9 @@ function ListViewBlockSelectButton({ + + + const ListViewBlockContents = (0,external_wp_element_namespaceObject.forwardRef)(({ onClick, onToggleExpanded, @@ -52480,7 +57058,7 @@ const ListViewBlockContents = (0,external_wp_element_namespaceObject.forwardRef) setInsertedBlock } = useListViewContext(); const isBlockMoveTarget = blockMovingClientId && selectedBlockInBlockEditor === clientId; - const className = classnames_default()('block-editor-list-view-block-contents', { + const className = dist_clsx('block-editor-list-view-block-contents', { 'is-dropping-before': isBlockMoveTarget }); @@ -52489,34 +57067,37 @@ const ListViewBlockContents = (0,external_wp_element_namespaceObject.forwardRef) // to drag a block that isn't part of the selection, they're still able // to drag it and rearrange its position. const draggableClientIds = selectedClientIds.includes(clientId) ? selectedClientIds : [clientId]; - return (0,external_React_.createElement)(external_React_.Fragment, null, AdditionalBlockContent && (0,external_React_.createElement)(AdditionalBlockContent, { - block: block, - insertedBlock: insertedBlock, - setInsertedBlock: setInsertedBlock - }), (0,external_React_.createElement)(block_draggable, { - appendToOwnerDocument: true, - clientIds: draggableClientIds, - cloneClassname: 'block-editor-list-view-draggable-chip' - }, ({ - draggable, - onDragStart, - onDragEnd - }) => (0,external_React_.createElement)(block_select_button, { - ref: ref, - className: className, - block: block, - onClick: onClick, - onToggleExpanded: onToggleExpanded, - isSelected: isSelected, - position: position, - siblingBlockCount: siblingBlockCount, - level: level, - draggable: draggable, - onDragStart: onDragStart, - onDragEnd: onDragEnd, - isExpanded: isExpanded, - ...props - }))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [AdditionalBlockContent && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AdditionalBlockContent, { + block: block, + insertedBlock: insertedBlock, + setInsertedBlock: setInsertedBlock + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_draggable, { + appendToOwnerDocument: true, + clientIds: draggableClientIds, + cloneClassname: "block-editor-list-view-draggable-chip", + children: ({ + draggable, + onDragStart, + onDragEnd + }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_select_button, { + ref: ref, + className: className, + block: block, + onClick: onClick, + onToggleExpanded: onToggleExpanded, + isSelected: isSelected, + position: position, + siblingBlockCount: siblingBlockCount, + level: level, + draggable: draggable, + onDragStart: onDragStart, + onDragEnd: onDragEnd, + isExpanded: isExpanded, + ...props + }) + })] + }); }); /* harmony default export */ const block_contents = (ListViewBlockContents); @@ -52527,7 +57108,8 @@ const ListViewBlockContents = (0,external_wp_element_namespaceObject.forwardRef) const getBlockPositionDescription = (position, siblingCount, level) => (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: The numerical position of the block. 2: The total number of blocks. 3. The level of nesting for the block. */ -(0,external_wp_i18n_namespaceObject.__)('Block %1$d of %2$d, Level %3$d'), position, siblingCount, level); +(0,external_wp_i18n_namespaceObject.__)('Block %1$d of %2$d, Level %3$d.'), position, siblingCount, level); +const getBlockPropertiesDescription = isLocked => isLocked ? (0,external_wp_i18n_namespaceObject.__)('This block is locked.') : ''; /** * Returns true if the client ID occurs within the block selection or multi-selection, @@ -52576,7 +57158,9 @@ function getCommonDepthClientIds(startId, endId, startParents, endParents) { function focusListItem(focusClientId, treeGridElement) { const getFocusElement = () => { const row = treeGridElement?.querySelector(`[role=row][data-block="${focusClientId}"]`); - if (!row) return null; + if (!row) { + return null; + } // Focus the first focusable in the row, which is the ListViewBlockSelectButton. return external_wp_dom_namespaceObject.focus.focusable.find(row)[0]; }; @@ -52690,7 +57274,6 @@ function getDragDisplacementValues({ } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/block.js - /** * External dependencies */ @@ -52708,6 +57291,9 @@ function getDragDisplacementValues({ + + + /** * Internal dependencies */ @@ -52721,6 +57307,10 @@ function getDragDisplacementValues({ + + + + function ListViewBlock({ block: { clientId @@ -52755,55 +57345,227 @@ function ListViewBlock({ const isFirstSelectedBlock = isSelected && selectedClientIds[0] === clientId; const isLastSelectedBlock = isSelected && selectedClientIds[selectedClientIds.length - 1] === clientId; const { - toggleBlockHighlight - } = (0,external_wp_data_namespaceObject.useDispatch)(store); + toggleBlockHighlight, + duplicateBlocks, + multiSelect, + replaceBlocks, + removeBlocks, + insertAfterBlock, + insertBeforeBlock, + setOpenedBlockSettingsMenu + } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store)); + const { + canInsertBlockType, + getSelectedBlockClientIds, + getPreviousBlockClientId, + getBlockRootClientId, + getBlockOrder, + getBlockParents, + getBlocksByClientId, + canRemoveBlocks, + isGroupable + } = (0,external_wp_data_namespaceObject.useSelect)(store); + const { + getGroupingBlockName + } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); const blockInformation = useBlockDisplayInformation(clientId); - const blockTitle = blockInformation?.name || blockInformation?.title || (0,external_wp_i18n_namespaceObject.__)('Untitled'); const { block, blockName, - blockEditingMode + allowRightClickOverrides } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlock, getBlockName, - getBlockEditingMode + getSettings } = select(store); return { block: getBlock(clientId), blockName: getBlockName(clientId), - blockEditingMode: getBlockEditingMode(clientId) + allowRightClickOverrides: getSettings().allowRightClickOverrides }; }, [clientId]); - const allowRightClickOverrides = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings().allowRightClickOverrides, []); const showBlockActions = // When a block hides its toolbar it also hides the block settings menu, // since that menu is part of the toolbar in the editor canvas. // List View respects this by also hiding the block settings menu. - (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, '__experimentalToolbar', true) && - // Don't show the settings menu if block is disabled or content only. - blockEditingMode === 'default'; + (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, '__experimentalToolbar', true); const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListViewBlock); - const descriptionId = `list-view-block-select-button__${instanceId}`; + const descriptionId = `list-view-block-select-button__description-${instanceId}`; const { expand, collapse, + collapseAll, BlockSettingsMenu, listViewInstanceId, expandedState, setInsertedBlock, - treeGridElementRef + treeGridElementRef, + rootClientId } = useListViewContext(); + const isMatch = (0,external_wp_keyboardShortcuts_namespaceObject.__unstableUseShortcutEventMatch)(); - // If multiple blocks are selected, deselect all blocks when the user - // presses the escape key. - const onKeyDown = event => { - if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented && selectedClientIds.length > 0) { + // Determine which blocks to update: + // If the current (focused) block is part of the block selection, use the whole selection. + // If the focused block is not part of the block selection, only update the focused block. + function getBlocksToUpdate() { + const selectedBlockClientIds = getSelectedBlockClientIds(); + const isUpdatingSelectedBlocks = selectedBlockClientIds.includes(clientId); + const firstBlockClientId = isUpdatingSelectedBlocks ? selectedBlockClientIds[0] : clientId; + const firstBlockRootClientId = getBlockRootClientId(firstBlockClientId); + const blocksToUpdate = isUpdatingSelectedBlocks ? selectedBlockClientIds : [clientId]; + return { + blocksToUpdate, + firstBlockClientId, + firstBlockRootClientId, + selectedBlockClientIds + }; + } + + /** + * @param {KeyboardEvent} event + */ + async function onKeyDown(event) { + if (event.defaultPrevented) { + return; + } + + // Do not handle events if it comes from modals; + // retain the default behavior for these keys. + if (event.target.closest('[role=dialog]')) { + return; + } + const isDeleteKey = [external_wp_keycodes_namespaceObject.BACKSPACE, external_wp_keycodes_namespaceObject.DELETE].includes(event.keyCode); + + // If multiple blocks are selected, deselect all blocks when the user + // presses the escape key. + if (isMatch('core/block-editor/unselect', event) && selectedClientIds.length > 0) { event.stopPropagation(); event.preventDefault(); selectBlock(event, undefined); + } else if (isDeleteKey || isMatch('core/block-editor/remove', event)) { + var _getPreviousBlockClie; + const { + blocksToUpdate: blocksToDelete, + firstBlockClientId, + firstBlockRootClientId, + selectedBlockClientIds + } = getBlocksToUpdate(); + + // Don't update the selection if the blocks cannot be deleted. + if (!canRemoveBlocks(blocksToDelete)) { + return; + } + let blockToFocus = (_getPreviousBlockClie = getPreviousBlockClientId(firstBlockClientId)) !== null && _getPreviousBlockClie !== void 0 ? _getPreviousBlockClie : + // If the previous block is not found (when the first block is deleted), + // fallback to focus the parent block. + firstBlockRootClientId; + removeBlocks(blocksToDelete, false); + + // Update the selection if the original selection has been removed. + const shouldUpdateSelection = selectedBlockClientIds.length > 0 && getSelectedBlockClientIds().length === 0; + + // If there's no previous block nor parent block, focus the first block. + if (!blockToFocus) { + blockToFocus = getBlockOrder()[0]; + } + updateFocusAndSelection(blockToFocus, shouldUpdateSelection); + } else if (isMatch('core/block-editor/duplicate', event)) { + event.preventDefault(); + const { + blocksToUpdate, + firstBlockRootClientId + } = getBlocksToUpdate(); + const canDuplicate = getBlocksByClientId(blocksToUpdate).every(blockToUpdate => { + return !!blockToUpdate && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockToUpdate.name, 'multiple', true) && canInsertBlockType(blockToUpdate.name, firstBlockRootClientId); + }); + if (canDuplicate) { + const updatedBlocks = await duplicateBlocks(blocksToUpdate, false); + if (updatedBlocks?.length) { + // If blocks have been duplicated, focus the first duplicated block. + updateFocusAndSelection(updatedBlocks[0], false); + } + } + } else if (isMatch('core/block-editor/insert-before', event)) { + event.preventDefault(); + const { + blocksToUpdate + } = getBlocksToUpdate(); + await insertBeforeBlock(blocksToUpdate[0]); + const newlySelectedBlocks = getSelectedBlockClientIds(); + + // Focus the first block of the newly inserted blocks, to keep focus within the list view. + setOpenedBlockSettingsMenu(undefined); + updateFocusAndSelection(newlySelectedBlocks[0], false); + } else if (isMatch('core/block-editor/insert-after', event)) { + event.preventDefault(); + const { + blocksToUpdate + } = getBlocksToUpdate(); + await insertAfterBlock(blocksToUpdate.at(-1)); + const newlySelectedBlocks = getSelectedBlockClientIds(); + + // Focus the first block of the newly inserted blocks, to keep focus within the list view. + setOpenedBlockSettingsMenu(undefined); + updateFocusAndSelection(newlySelectedBlocks[0], false); + } else if (isMatch('core/block-editor/select-all', event)) { + event.preventDefault(); + const { + firstBlockRootClientId, + selectedBlockClientIds + } = getBlocksToUpdate(); + const blockClientIds = getBlockOrder(firstBlockRootClientId); + if (!blockClientIds.length) { + return; + } + + // If we have selected all sibling nested blocks, try selecting up a level. + // This is a similar implementation to that used by `useSelectAll`. + // `isShallowEqual` is used for the list view instead of a length check, + // as the array of siblings of the currently focused block may be a different + // set of blocks from the current block selection if the user is focused + // on a different part of the list view from the block selection. + if (external_wp_isShallowEqual_default()(selectedBlockClientIds, blockClientIds)) { + // Only select up a level if the first block is not the root block. + // This ensures that the block selection can't break out of the root block + // used by the list view, if the list view is only showing a partial hierarchy. + if (firstBlockRootClientId && firstBlockRootClientId !== rootClientId) { + updateFocusAndSelection(firstBlockRootClientId, true); + return; + } + } + + // Select all while passing `null` to skip focusing to the editor canvas, + // and retain focus within the list view. + multiSelect(blockClientIds[0], blockClientIds[blockClientIds.length - 1], null); + } else if (isMatch('core/block-editor/collapse-list-view', event)) { + event.preventDefault(); + const { + firstBlockClientId + } = getBlocksToUpdate(); + const blockParents = getBlockParents(firstBlockClientId, false); + // Collapse all blocks. + collapseAll(); + // Expand all parents of the current block. + expand(blockParents); + } else if (isMatch('core/block-editor/group', event)) { + const { + blocksToUpdate + } = getBlocksToUpdate(); + if (blocksToUpdate.length > 1 && isGroupable(blocksToUpdate)) { + event.preventDefault(); + const blocks = getBlocksByClientId(blocksToUpdate); + const groupingBlockName = getGroupingBlockName(); + const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, groupingBlockName); + replaceBlocks(blocksToUpdate, newBlocks); + (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Selected blocks are grouped.')); + const newlySelectedBlocks = getSelectedBlockClientIds(); + // Focus the first block of the newly inserted blocks, to keep focus within the list view. + setOpenedBlockSettingsMenu(undefined); + updateFocusAndSelection(newlySelectedBlocks[0], false); + } } - }; + } const onMouseEnter = (0,external_wp_element_namespaceObject.useCallback)(() => { setIsHovered(true); toggleBlockHighlight(clientId, true); @@ -52890,18 +57652,13 @@ function ListViewBlock({ return null; } const blockPositionDescription = getBlockPositionDescription(position, siblingBlockCount, level); - const blockAriaLabel = isLocked ? (0,external_wp_i18n_namespaceObject.sprintf)( - // translators: %s: The title of the block. This string indicates a link to select the locked block. - (0,external_wp_i18n_namespaceObject.__)('%s (locked)'), blockTitle) : blockTitle; - const settingsAriaLabel = (0,external_wp_i18n_namespaceObject.sprintf)( - // translators: %s: The title of the block. - (0,external_wp_i18n_namespaceObject.__)('Options for %s'), blockTitle); + const blockPropertiesDescription = getBlockPropertiesDescription(isLocked); const hasSiblings = siblingBlockCount > 0; const hasRenderedMovers = showBlockMovers && hasSiblings; - const moverCellClassName = classnames_default()('block-editor-list-view-block__mover-cell', { + const moverCellClassName = dist_clsx('block-editor-list-view-block__mover-cell', { 'is-visible': isHovered || isSelected }); - const listViewBlockSettingsClassName = classnames_default()('block-editor-list-view-block__menu-cell', { + const listViewBlockSettingsClassName = dist_clsx('block-editor-list-view-block__menu-cell', { 'is-visible': isHovered || isFirstSelectedBlock }); let colSpan; @@ -52910,7 +57667,7 @@ function ListViewBlock({ } else if (!showBlockActions) { colSpan = 3; } - const classes = classnames_default()({ + const classes = dist_clsx({ 'is-selected': isSelected, 'is-first-selected': isFirstSelectedBlock, 'is-last-selected': isLastSelectedBlock, @@ -52935,7 +57692,7 @@ function ListViewBlock({ // Detect if there is a block in the canvas currently being edited and multi-selection is not happening. const currentlyEditingBlockInCanvas = isSelected && selectedClientIds.length === 1; - return (0,external_React_.createElement)(leaf, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(leaf, { className: classes, isDragged: isDragged, onKeyDown: onKeyDown, @@ -52950,95 +57707,104 @@ function ListViewBlock({ id: `list-view-${listViewInstanceId}-block-${clientId}`, "data-block": clientId, "data-expanded": canEdit ? isExpanded : undefined, - ref: rowRef - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTreeGridCell, { - className: "block-editor-list-view-block__contents-cell", - colSpan: colSpan, - ref: cellRef, - "aria-selected": !!isSelected - }, ({ - ref, - tabIndex, - onFocus - }) => (0,external_React_.createElement)("div", { - className: "block-editor-list-view-block__contents-container" - }, (0,external_React_.createElement)(block_contents, { - block: block, - onClick: selectEditorBlock, - onContextMenu: onContextMenu, - onMouseDown: onMouseDown, - onToggleExpanded: toggleExpanded, - isSelected: isSelected, - position: position, - siblingBlockCount: siblingBlockCount, - level: level, - ref: ref, - tabIndex: currentlyEditingBlockInCanvas ? 0 : tabIndex, - onFocus: onFocus, - isExpanded: canEdit ? isExpanded : undefined, - selectedClientIds: selectedClientIds, - ariaLabel: blockAriaLabel, - ariaDescribedBy: descriptionId, - updateFocusAndSelection: updateFocusAndSelection - }), (0,external_React_.createElement)(AriaReferencedText, { - id: descriptionId - }, blockPositionDescription))), hasRenderedMovers && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTreeGridCell, { - className: moverCellClassName, - withoutGridItem: true - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTreeGridItem, null, ({ - ref, - tabIndex, - onFocus - }) => (0,external_React_.createElement)(BlockMoverUpButton, { - orientation: "vertical", - clientIds: [clientId], - ref: ref, - tabIndex: tabIndex, - onFocus: onFocus - })), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTreeGridItem, null, ({ - ref, - tabIndex, - onFocus - }) => (0,external_React_.createElement)(BlockMoverDownButton, { - orientation: "vertical", - clientIds: [clientId], - ref: ref, - tabIndex: tabIndex, - onFocus: onFocus - })))), showBlockActions && BlockSettingsMenu && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTreeGridCell, { - className: listViewBlockSettingsClassName, - "aria-selected": !!isSelected, - ref: settingsRef - }, ({ - ref, - tabIndex, - onFocus - }) => (0,external_React_.createElement)(BlockSettingsMenu, { - clientIds: dropdownClientIds, - block: block, - icon: more_vertical, - label: settingsAriaLabel, - popoverProps: { - anchor: settingsPopoverAnchor // Used to position the settings at the cursor on right-click. - }, - toggleProps: { - ref, - className: 'block-editor-list-view-block__menu', - tabIndex, - onClick: clearSettingsAnchorRect, - onFocus - }, - disableOpenOnArrowDown: true, - expand: expand, - expandedState: expandedState, - setInsertedBlock: setInsertedBlock, - __experimentalSelectBlock: updateFocusAndSelection - }))); + ref: rowRef, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTreeGridCell, { + className: "block-editor-list-view-block__contents-cell", + colSpan: colSpan, + ref: cellRef, + "aria-selected": !!isSelected, + children: ({ + ref, + tabIndex, + onFocus + }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-list-view-block__contents-container", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_contents, { + block: block, + onClick: selectEditorBlock, + onContextMenu: onContextMenu, + onMouseDown: onMouseDown, + onToggleExpanded: toggleExpanded, + isSelected: isSelected, + position: position, + siblingBlockCount: siblingBlockCount, + level: level, + ref: ref, + tabIndex: currentlyEditingBlockInCanvas ? 0 : tabIndex, + onFocus: onFocus, + isExpanded: canEdit ? isExpanded : undefined, + selectedClientIds: selectedClientIds, + ariaDescribedBy: descriptionId + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AriaReferencedText, { + id: descriptionId, + children: `${blockPositionDescription} ${blockPropertiesDescription}` + })] + }) + }), hasRenderedMovers && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalTreeGridCell, { + className: moverCellClassName, + withoutGridItem: true, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTreeGridItem, { + children: ({ + ref, + tabIndex, + onFocus + }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockMoverUpButton, { + orientation: "vertical", + clientIds: [clientId], + ref: ref, + tabIndex: tabIndex, + onFocus: onFocus + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTreeGridItem, { + children: ({ + ref, + tabIndex, + onFocus + }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockMoverDownButton, { + orientation: "vertical", + clientIds: [clientId], + ref: ref, + tabIndex: tabIndex, + onFocus: onFocus + }) + })] + }) + }), showBlockActions && BlockSettingsMenu && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTreeGridCell, { + className: listViewBlockSettingsClassName, + "aria-selected": !!isSelected, + ref: settingsRef, + children: ({ + ref, + tabIndex, + onFocus + }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockSettingsMenu, { + clientIds: dropdownClientIds, + block: block, + icon: more_vertical, + label: (0,external_wp_i18n_namespaceObject.__)('Options'), + popoverProps: { + anchor: settingsPopoverAnchor // Used to position the settings at the cursor on right-click. + }, + toggleProps: { + ref, + className: 'block-editor-list-view-block__menu', + tabIndex, + onClick: clearSettingsAnchorRect, + onFocus + }, + disableOpenOnArrowDown: true, + expand: expand, + expandedState: expandedState, + setInsertedBlock: setInsertedBlock, + __experimentalSelectBlock: updateFocusAndSelection + }) + })] + }); } /* harmony default export */ const list_view_block = ((0,external_wp_element_namespaceObject.memo)(ListViewBlock)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/branch.js - /** * WordPress dependencies */ @@ -53069,6 +57835,9 @@ function ListViewBlock({ * @param {boolean} isExpandedByDefault flag to determine the default fallback expanded state. * @return {number} block count */ + + + function countBlocks(block, expandedState, draggedClientIds, isExpandedByDefault) { var _expandedState$block$; const isDragged = draggedClientIds?.includes(block.clientId); @@ -53138,107 +57907,115 @@ function ListViewBranch(props) { // The appender means an extra row in List View, so add 1 to the row count. const rowCount = showAppender ? blockCount + 1 : blockCount; let nextPosition = listPosition; - return (0,external_React_.createElement)(external_React_.Fragment, null, filteredBlocks.map((block, index) => { - var _expandedState$client; - const { - clientId, - innerBlocks - } = block; - if (index > 0) { - nextPosition += countBlocks(filteredBlocks[index - 1], expandedState, draggedClientIds, isExpanded); - } - const isDragged = !!draggedClientIds?.includes(clientId); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [filteredBlocks.map((block, index) => { + var _expandedState$client; + const { + clientId, + innerBlocks + } = block; + if (index > 0) { + nextPosition += countBlocks(filteredBlocks[index - 1], expandedState, draggedClientIds, isExpanded); + } + const isDragged = !!draggedClientIds?.includes(clientId); - // Determine the displacement of the block while dragging. This - // works out whether the current block should be displaced up or - // down, relative to the dragged blocks and the drop target. - const { - displacement, - isAfterDraggedBlocks, - isNesting - } = getDragDisplacementValues({ - blockIndexes, - blockDropTargetIndex, - blockDropPosition, - clientId, - firstDraggedBlockIndex, - isDragged - }); - const { - itemInView - } = fixedListWindow; - const blockInView = itemInView(nextPosition); - const position = index + 1; - const updatedPath = path.length > 0 ? `${path}_${position}` : `${position}`; - const hasNestedBlocks = !!innerBlocks?.length; - const shouldExpand = hasNestedBlocks && shouldShowInnerBlocks ? (_expandedState$client = expandedState[clientId]) !== null && _expandedState$client !== void 0 ? _expandedState$client : isExpanded : undefined; - - // Make updates to the selected or dragged blocks synchronous, - // but asynchronous for any other block. - const isSelected = isClientIdSelected(clientId, selectedClientIds); - const isSelectedBranch = isBranchSelected || isSelected && hasNestedBlocks; - - // To avoid performance issues, we only render blocks that are in view, - // or blocks that are selected or dragged. If a block is selected, - // it is only counted if it is the first of the block selection. - // This prevents the entire tree from being rendered when a branch is - // selected, or a user selects all blocks, while still enabling scroll - // into view behavior when selecting a block or opening the list view. - const showBlock = isDragged || blockInView || isSelected && clientId === selectedClientIds[0]; - return (0,external_React_.createElement)(external_wp_data_namespaceObject.AsyncModeProvider, { - key: clientId, - value: !isSelected - }, showBlock && (0,external_React_.createElement)(list_view_block, { - block: block, - selectBlock: selectBlock, - isSelected: isSelected, - isBranchSelected: isSelectedBranch, - isDragged: isDragged, + // Determine the displacement of the block while dragging. This + // works out whether the current block should be displaced up or + // down, relative to the dragged blocks and the drop target. + const { + displacement, + isAfterDraggedBlocks, + isNesting + } = getDragDisplacementValues({ + blockIndexes, + blockDropTargetIndex, + blockDropPosition, + clientId, + firstDraggedBlockIndex, + isDragged + }); + const { + itemInView + } = fixedListWindow; + const blockInView = itemInView(nextPosition); + const position = index + 1; + const updatedPath = path.length > 0 ? `${path}_${position}` : `${position}`; + const hasNestedBlocks = !!innerBlocks?.length; + const shouldExpand = hasNestedBlocks && shouldShowInnerBlocks ? (_expandedState$client = expandedState[clientId]) !== null && _expandedState$client !== void 0 ? _expandedState$client : isExpanded : undefined; + + // Make updates to the selected or dragged blocks synchronous, + // but asynchronous for any other block. + const isSelected = isClientIdSelected(clientId, selectedClientIds); + const isSelectedBranch = isBranchSelected || isSelected && hasNestedBlocks; + + // To avoid performance issues, we only render blocks that are in view, + // or blocks that are selected or dragged. If a block is selected, + // it is only counted if it is the first of the block selection. + // This prevents the entire tree from being rendered when a branch is + // selected, or a user selects all blocks, while still enabling scroll + // into view behavior when selecting a block or opening the list view. + // The first and last blocks of the list are always rendered, to ensure + // that Home and End keys work as expected. + const showBlock = isDragged || blockInView || isSelected && clientId === selectedClientIds[0] || index === 0 || index === blockCount - 1; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_data_namespaceObject.AsyncModeProvider, { + value: !isSelected, + children: [showBlock && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(list_view_block, { + block: block, + selectBlock: selectBlock, + isSelected: isSelected, + isBranchSelected: isSelectedBranch, + isDragged: isDragged, + level: level, + position: position, + rowCount: rowCount, + siblingBlockCount: blockCount, + showBlockMovers: showBlockMovers, + path: updatedPath, + isExpanded: isDragged ? false : shouldExpand, + listPosition: nextPosition, + selectedClientIds: selectedClientIds, + isSyncedBranch: syncedBranch, + displacement: displacement, + isAfterDraggedBlocks: isAfterDraggedBlocks, + isNesting: isNesting + }), !showBlock && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("tr", { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("td", { + className: "block-editor-list-view-placeholder" + }) + }), hasNestedBlocks && shouldExpand && !isDragged && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewBranch, { + parentId: clientId, + blocks: innerBlocks, + selectBlock: selectBlock, + showBlockMovers: showBlockMovers, + level: level + 1, + path: updatedPath, + listPosition: nextPosition + 1, + fixedListWindow: fixedListWindow, + isBranchSelected: isSelectedBranch, + selectedClientIds: selectedClientIds, + isExpanded: isExpanded, + isSyncedBranch: syncedBranch + })] + }, clientId); + }), showAppender && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTreeGridRow, { level: level, - position: position, - rowCount: rowCount, - siblingBlockCount: blockCount, - showBlockMovers: showBlockMovers, - path: updatedPath, - isExpanded: isDragged ? false : shouldExpand, - listPosition: nextPosition, - selectedClientIds: selectedClientIds, - isSyncedBranch: syncedBranch, - displacement: displacement, - isAfterDraggedBlocks: isAfterDraggedBlocks, - isNesting: isNesting - }), !showBlock && (0,external_React_.createElement)("tr", null, (0,external_React_.createElement)("td", { - className: "block-editor-list-view-placeholder" - })), hasNestedBlocks && shouldExpand && !isDragged && (0,external_React_.createElement)(ListViewBranch, { - parentId: clientId, - blocks: innerBlocks, - selectBlock: selectBlock, - showBlockMovers: showBlockMovers, - level: level + 1, - path: updatedPath, - listPosition: nextPosition + 1, - fixedListWindow: fixedListWindow, - isBranchSelected: isSelectedBranch, - selectedClientIds: selectedClientIds, - isExpanded: isExpanded, - isSyncedBranch: syncedBranch - })); - }), showAppender && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTreeGridRow, { - level: level, - setSize: rowCount, - positionInSet: rowCount, - isExpanded: true - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTreeGridCell, null, treeGridCellProps => (0,external_React_.createElement)(Appender, { - clientId: parentId, - nestingLevel: level, - blockCount: blockCount, - ...treeGridCellProps - })))); + setSize: rowCount, + positionInSet: rowCount, + isExpanded: true, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTreeGridCell, { + children: treeGridCellProps => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Appender, { + clientId: parentId, + nestingLevel: level, + blockCount: blockCount, + ...treeGridCellProps + }) + }) + })] + }); } /* harmony default export */ const branch = ((0,external_wp_element_namespaceObject.memo)(ListViewBranch)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/drop-indicator.js - /** * External dependencies */ @@ -53259,6 +58036,8 @@ function ListViewBranch(props) { + + function ListViewDropIndicatorPreview({ draggedBlockClientId, listViewRef, @@ -53443,43 +58222,50 @@ function ListViewDropIndicatorPreview({ if (!targetElement) { return null; } - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Popover, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, { animate: false, anchor: popoverAnchor, focusOnMount: false, className: "block-editor-list-view-drop-indicator--preview", variant: "unstyled", flip: false, - resize: true - }, (0,external_React_.createElement)("div", { - style: style, - className: classnames_default()('block-editor-list-view-drop-indicator__line', { - 'block-editor-list-view-drop-indicator__line--darker': hasAdjacentSelectedBranch + resize: true, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + style: style, + className: dist_clsx('block-editor-list-view-drop-indicator__line', { + 'block-editor-list-view-drop-indicator__line--darker': hasAdjacentSelectedBranch + }), + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-list-view-leaf", + "aria-level": ariaLevel, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: dist_clsx('block-editor-list-view-block-select-button', 'block-editor-list-view-block-contents'), + style: horizontalScrollOffsetStyle, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewExpander, { + onClick: () => {} + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { + icon: blockInformation?.icon, + showColors: true, + context: "list-view" + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { + alignment: "center", + className: "block-editor-list-view-block-select-button__label-wrapper", + justify: "flex-start", + spacing: 1, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + className: "block-editor-list-view-block-select-button__title", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { + ellipsizeMode: "auto", + children: blockTitle + }) + }) + })] + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-list-view-block__menu-cell" + })] + }) }) - }, (0,external_React_.createElement)("div", { - className: "block-editor-list-view-leaf", - "aria-level": ariaLevel - }, (0,external_React_.createElement)("div", { - className: classnames_default()('block-editor-list-view-block-select-button', 'block-editor-list-view-block-contents'), - style: horizontalScrollOffsetStyle - }, (0,external_React_.createElement)(ListViewExpander, { - onClick: () => {} - }), (0,external_React_.createElement)(block_icon, { - icon: blockInformation?.icon, - showColors: true, - context: "list-view" - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { - alignment: "center", - className: "block-editor-list-view-block-select-button__label-wrapper", - justify: "flex-start", - spacing: 1 - }, (0,external_React_.createElement)("span", { - className: "block-editor-list-view-block-select-button__title" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, { - ellipsizeMode: "auto" - }, blockTitle)))), (0,external_React_.createElement)("div", { - className: "block-editor-list-view-block__menu-cell" - })))); + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-block-selection.js @@ -53656,6 +58442,47 @@ function useListViewClientIds({ }, [blocks, rootClientId]); } +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-collapse-items.js +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + +function useListViewCollapseItems({ + collapseAll, + expand +}) { + const { + expandedBlock, + getBlockParents + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + getBlockParents: _getBlockParents, + getExpandedBlock + } = unlock(select(store)); + return { + expandedBlock: getExpandedBlock(), + getBlockParents: _getBlockParents + }; + }, []); + + // Collapse all but the specified block when the expanded block client Id changes. + (0,external_wp_element_namespaceObject.useEffect)(() => { + if (expandedBlock) { + const blockParents = getBlockParents(expandedBlock, false); + // Collapse all blocks and expand the block's parents. + collapseAll(); + expand(blockParents); + } + }, [collapseAll, expand, expandedBlock, getBlockParents]); +} + ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-drop-zone.js /** * WordPress dependencies @@ -53714,7 +58541,7 @@ function useListViewClientIds({ // When the indentation level, the corresponding left margin in `style.scss` // must be updated as well to ensure the drop zone is aligned with the indentation. -const NESTING_LEVEL_INDENTATION = 28; +const NESTING_LEVEL_INDENTATION = 24; /** * Determines whether the user is positioning the dragged block to be @@ -54247,7 +59074,7 @@ function use_clipboard_handler_useClipboardHandler({ if (event.type === 'cut') { var _getPreviousBlockClie; // Don't update the selection if the blocks cannot be deleted. - if (!canRemoveBlocks(selectedBlockClientIds, firstBlockRootClientId)) { + if (!canRemoveBlocks(selectedBlockClientIds)) { return; } let blockToFocus = (_getPreviousBlockClie = getPreviousBlockClientId(firstBlockClientId)) !== null && _getPreviousBlockClie !== void 0 ? _getPreviousBlockClie : @@ -54301,7 +59128,6 @@ function use_clipboard_handler_useClipboardHandler({ } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/index.js - /** * External dependencies */ @@ -54332,7 +59158,13 @@ function use_clipboard_handler_useClipboardHandler({ + + + const expanded = (state, action) => { + if (action.type === 'clear') { + return {}; + } if (Array.isArray(action.clientIds)) { return { ...state, @@ -54344,7 +59176,7 @@ const expanded = (state, action) => { } return state; }; -const BLOCK_LIST_ITEM_HEIGHT = 36; +const BLOCK_LIST_ITEM_HEIGHT = 32; /** @typedef {import('react').ComponentType} ComponentType */ /** @typedef {import('react').Ref} Ref */ @@ -54466,9 +59298,10 @@ function ListViewComponent({ if (!clientId) { return; } + const clientIds = Array.isArray(clientId) ? clientId : [clientId]; setExpandedState({ type: 'expand', - clientIds: [clientId] + clientIds }); }, [setExpandedState]); const collapse = (0,external_wp_element_namespaceObject.useCallback)(clientId => { @@ -54480,6 +59313,11 @@ function ListViewComponent({ clientIds: [clientId] }); }, [setExpandedState]); + const collapseAll = (0,external_wp_element_namespaceObject.useCallback)(() => { + setExpandedState({ + type: 'clear' + }); + }, [setExpandedState]); const expandRow = (0,external_wp_element_namespaceObject.useCallback)(row => { expand(row?.dataset?.block); }, [expand]); @@ -54491,6 +59329,10 @@ function ListViewComponent({ updateBlockSelection(event, startRow?.dataset?.block, endRow?.dataset?.block); } }, [updateBlockSelection]); + useListViewCollapseItems({ + collapseAll, + expand + }); const firstDraggedBlockClientId = draggedClientIds?.[0]; // Convert a blockDropTarget into indexes relative to the blocks in the list view. @@ -54529,6 +59371,7 @@ function ListViewComponent({ expand, firstDraggedBlockIndex, collapse, + collapseAll, BlockSettingsMenu, listViewInstanceId: instanceId, AdditionalBlockContent, @@ -54536,7 +59379,7 @@ function ListViewComponent({ setInsertedBlock, treeGridElementRef: elementRef, rootClientId - }), [blockDropPosition, blockDropTargetIndex, blockIndexes, draggedClientIds, expandedState, expand, firstDraggedBlockIndex, collapse, BlockSettingsMenu, instanceId, AdditionalBlockContent, insertedBlock, setInsertedBlock, rootClientId]); + }), [blockDropPosition, blockDropTargetIndex, blockIndexes, draggedClientIds, expandedState, expand, firstDraggedBlockIndex, collapse, collapseAll, BlockSettingsMenu, instanceId, AdditionalBlockContent, insertedBlock, setInsertedBlock, rootClientId]); // List View renders a fixed number of items and relies on each having a fixed item height of 36px. // If this value changes, we should also change the itemHeight value set in useFixedWindowList. @@ -54557,42 +59400,46 @@ function ListViewComponent({ return null; } const describedById = description && `block-editor-list-view-description-${instanceId}`; - return (0,external_React_.createElement)(external_wp_data_namespaceObject.AsyncModeProvider, { - value: true - }, (0,external_React_.createElement)(ListViewDropIndicatorPreview, { - draggedBlockClientId: firstDraggedBlockClientId, - listViewRef: elementRef, - blockDropTarget: blockDropTarget - }), description && (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { - id: describedById - }, description), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTreeGrid, { - id: id, - className: classnames_default()('block-editor-list-view-tree', { - 'is-dragging': draggedClientIds?.length > 0 && blockDropTargetIndex !== undefined - }), - "aria-label": (0,external_wp_i18n_namespaceObject.__)('Block navigation structure'), - ref: treeGridRef, - onCollapseRow: collapseRow, - onExpandRow: expandRow, - onFocusRow: focusRow, - applicationAriaLabel: (0,external_wp_i18n_namespaceObject.__)('Block navigation structure'), - "aria-describedby": describedById, - style: { - '--wp-admin--list-view-dragged-items-height': draggedClientIds?.length ? `${BLOCK_LIST_ITEM_HEIGHT * (draggedClientIds.length - 1)}px` : null - } - }, (0,external_React_.createElement)(ListViewContext.Provider, { - value: contextValue - }, (0,external_React_.createElement)(branch, { - blocks: clientIdsTree, - parentId: rootClientId, - selectBlock: selectEditorBlock, - showBlockMovers: showBlockMovers, - fixedListWindow: fixedListWindow, - selectedClientIds: selectedClientIds, - isExpanded: isExpanded, - shouldShowInnerBlocks: shouldShowInnerBlocks, - showAppender: showAppender - })))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_data_namespaceObject.AsyncModeProvider, { + value: true, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewDropIndicatorPreview, { + draggedBlockClientId: firstDraggedBlockClientId, + listViewRef: elementRef, + blockDropTarget: blockDropTarget + }), description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { + id: describedById, + children: description + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTreeGrid, { + id: id, + className: dist_clsx('block-editor-list-view-tree', { + 'is-dragging': draggedClientIds?.length > 0 && blockDropTargetIndex !== undefined + }), + "aria-label": (0,external_wp_i18n_namespaceObject.__)('Block navigation structure'), + ref: treeGridRef, + onCollapseRow: collapseRow, + onExpandRow: expandRow, + onFocusRow: focusRow, + applicationAriaLabel: (0,external_wp_i18n_namespaceObject.__)('Block navigation structure'), + "aria-describedby": describedById, + style: { + '--wp-admin--list-view-dragged-items-height': draggedClientIds?.length ? `${BLOCK_LIST_ITEM_HEIGHT * (draggedClientIds.length - 1)}px` : null + }, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewContext.Provider, { + value: contextValue, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(branch, { + blocks: clientIdsTree, + parentId: rootClientId, + selectBlock: selectEditorBlock, + showBlockMovers: showBlockMovers, + fixedListWindow: fixedListWindow, + selectedClientIds: selectedClientIds, + isExpanded: isExpanded, + shouldShowInnerBlocks: shouldShowInnerBlocks, + showAppender: showAppender + }) + }) + })] + }); } // This is the private API for the ListView component. @@ -54602,7 +59449,7 @@ const PrivateListView = (0,external_wp_element_namespaceObject.forwardRef)(ListV // This is the public API for the ListView component. // We wrap the PrivateListView component to hide some props from the public API. /* harmony default export */ const components_list_view = ((0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { - return (0,external_React_.createElement)(PrivateListView, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateListView, { ref: ref, ...props, showAppender: false, @@ -54614,7 +59461,6 @@ const PrivateListView = (0,external_wp_element_namespaceObject.forwardRef)(ListV })); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/dropdown.js - /** * WordPress dependencies */ @@ -54634,6 +59480,8 @@ const PrivateListView = (0,external_wp_element_namespaceObject.forwardRef)(ListV */ + + function BlockNavigationDropdownToggle({ isEnabled, onToggle, @@ -54641,7 +59489,7 @@ function BlockNavigationDropdownToggle({ innerRef, ...props }) { - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { ...props, ref: innerRef, icon: list_view, @@ -54664,7 +59512,7 @@ function BlockNavigationDropdown({ }); const hasBlocks = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(store).getBlockCount(), []); const isEnabled = hasBlocks && !isDisabled; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Dropdown, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { contentClassName: "block-editor-block-navigation__popover", popoverProps: { placement: 'bottom-start' @@ -54672,24 +59520,25 @@ function BlockNavigationDropdown({ renderToggle: ({ isOpen, onToggle - }) => (0,external_React_.createElement)(BlockNavigationDropdownToggle, { + }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockNavigationDropdownToggle, { ...props, innerRef: ref, isOpen: isOpen, onToggle: onToggle, isEnabled: isEnabled }), - renderContent: () => (0,external_React_.createElement)("div", { - className: "block-editor-block-navigation__container" - }, (0,external_React_.createElement)("p", { - className: "block-editor-block-navigation__label" - }, (0,external_wp_i18n_namespaceObject.__)('List view')), (0,external_React_.createElement)(components_list_view, null)) + renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-block-navigation__container", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { + className: "block-editor-block-navigation__label", + children: (0,external_wp_i18n_namespaceObject.__)('List view') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(components_list_view, {})] + }) }); } /* harmony default export */ const dropdown = ((0,external_wp_element_namespaceObject.forwardRef)(BlockNavigationDropdown)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-styles/preview-panel.js - /** * WordPress dependencies */ @@ -54701,6 +59550,7 @@ function BlockNavigationDropdown({ */ + function BlockStylesPreviewPanel({ genericPreviewBlock, style, @@ -54721,13 +59571,12 @@ function BlockStylesPreviewPanel({ example }; }, [genericPreviewBlock, styleClassName]); - return (0,external_React_.createElement)(preview_panel, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(preview_panel, { item: previewBlocks }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-styles/index.js - /** * External dependencies */ @@ -54745,6 +59594,8 @@ function BlockStylesPreviewPanel({ */ + + const block_styles_noop = () => {}; // Block Styles component for the Settings Sidebar. @@ -54784,146 +59635,157 @@ function BlockStyles({ debouncedSetHoveredStyle(item); onHoverClassName((_item$name = item?.name) !== null && _item$name !== void 0 ? _item$name : null); }; - return (0,external_React_.createElement)("div", { - className: "block-editor-block-styles" - }, (0,external_React_.createElement)("div", { - className: "block-editor-block-styles__variants" - }, stylesToRender.map(style => { - const buttonText = style.label || style.name; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - __next40pxDefaultSize: true, - className: classnames_default()('block-editor-block-styles__item', { - 'is-active': activeStyle.name === style.name - }), - key: style.name, - variant: "secondary", - label: buttonText, - onMouseEnter: () => styleItemHandler(style), - onFocus: () => styleItemHandler(style), - onMouseLeave: () => styleItemHandler(null), - onBlur: () => styleItemHandler(null), - onClick: () => onSelectStylePreview(style), - "aria-current": activeStyle.name === style.name - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, { - numberOfLines: 1, - className: "block-editor-block-styles__item-text" - }, buttonText)); - })), hoveredStyle && !isMobileViewport && (0,external_React_.createElement)(external_wp_components_namespaceObject.Popover, { - placement: "left-start", - offset: 34, - focusOnMount: false - }, (0,external_React_.createElement)("div", { - className: "block-editor-block-styles__preview-panel", - onMouseLeave: () => styleItemHandler(null) - }, (0,external_React_.createElement)(BlockStylesPreviewPanel, { - activeStyle: activeStyle, - className: previewClassName, - genericPreviewBlock: genericPreviewBlock, - style: hoveredStyle - })))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-block-styles", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-block-styles__variants", + children: stylesToRender.map(style => { + const buttonText = style.label || style.name; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + __next40pxDefaultSize: true, + className: dist_clsx('block-editor-block-styles__item', { + 'is-active': activeStyle.name === style.name + }), + variant: "secondary", + label: buttonText, + onMouseEnter: () => styleItemHandler(style), + onFocus: () => styleItemHandler(style), + onMouseLeave: () => styleItemHandler(null), + onBlur: () => styleItemHandler(null), + onClick: () => onSelectStylePreview(style), + "aria-current": activeStyle.name === style.name, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { + numberOfLines: 1, + className: "block-editor-block-styles__item-text", + children: buttonText + }) + }, style.name); + }) + }), hoveredStyle && !isMobileViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, { + placement: "left-start", + offset: 34, + focusOnMount: false, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-block-styles__preview-panel", + onMouseLeave: () => styleItemHandler(null), + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockStylesPreviewPanel, { + activeStyle: activeStyle, + className: previewClassName, + genericPreviewBlock: genericPreviewBlock, + style: hoveredStyle + }) + }) + })] + }); } /* harmony default export */ const block_styles = (BlockStyles); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/paragraph.js - /** * WordPress dependencies */ -const paragraph = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const paragraph = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "m9.99609 14v-.2251l.00391.0001v6.225h1.5v-14.5h2.5v14.5h1.5v-14.5h3v-1.5h-8.50391c-2.76142 0-5 2.23858-5 5 0 2.7614 2.23858 5 5 5z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "m9.99609 14v-.2251l.00391.0001v6.225h1.5v-14.5h2.5v14.5h1.5v-14.5h3v-1.5h-8.50391c-2.76142 0-5 2.23858-5 5 0 2.7614 2.23858 5 5 5z" + }) +}); /* harmony default export */ const library_paragraph = (paragraph); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/heading-level-1.js - /** * WordPress dependencies */ -const headingLevel1 = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const headingLevel1 = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M17.6 7c-.6.9-1.5 1.7-2.6 2v1h2v7h2V7h-1.4zM11 11H7V7H5v10h2v-4h4v4h2V7h-2v4z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M17.6 7c-.6.9-1.5 1.7-2.6 2v1h2v7h2V7h-1.4zM11 11H7V7H5v10h2v-4h4v4h2V7h-2v4z" + }) +}); /* harmony default export */ const heading_level_1 = (headingLevel1); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/heading-level-2.js - /** * WordPress dependencies */ -const headingLevel2 = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const headingLevel2 = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M9 11.1H5v-4H3v10h2v-4h4v4h2v-10H9v4zm8 4c.5-.4.6-.6 1.1-1.1.4-.4.8-.8 1.2-1.3.3-.4.6-.8.9-1.3.2-.4.3-.8.3-1.3 0-.4-.1-.9-.3-1.3-.2-.4-.4-.7-.8-1-.3-.3-.7-.5-1.2-.6-.5-.2-1-.2-1.5-.2-.4 0-.7 0-1.1.1-.3.1-.7.2-1 .3-.3.1-.6.3-.9.5-.3.2-.6.4-.8.7l1.2 1.2c.3-.3.6-.5 1-.7.4-.2.7-.3 1.2-.3s.9.1 1.3.4c.3.3.5.7.5 1.1 0 .4-.1.8-.4 1.1-.3.5-.6.9-1 1.2-.4.4-1 .9-1.6 1.4-.6.5-1.4 1.1-2.2 1.6v1.5h8v-2H17z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M9 11.1H5v-4H3v10h2v-4h4v4h2v-10H9v4zm8 4c.5-.4.6-.6 1.1-1.1.4-.4.8-.8 1.2-1.3.3-.4.6-.8.9-1.3.2-.4.3-.8.3-1.3 0-.4-.1-.9-.3-1.3-.2-.4-.4-.7-.8-1-.3-.3-.7-.5-1.2-.6-.5-.2-1-.2-1.5-.2-.4 0-.7 0-1.1.1-.3.1-.7.2-1 .3-.3.1-.6.3-.9.5-.3.2-.6.4-.8.7l1.2 1.2c.3-.3.6-.5 1-.7.4-.2.7-.3 1.2-.3s.9.1 1.3.4c.3.3.5.7.5 1.1 0 .4-.1.8-.4 1.1-.3.5-.6.9-1 1.2-.4.4-1 .9-1.6 1.4-.6.5-1.4 1.1-2.2 1.6v1.5h8v-2H17z" + }) +}); /* harmony default export */ const heading_level_2 = (headingLevel2); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/heading-level-3.js - /** * WordPress dependencies */ -const headingLevel3 = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const headingLevel3 = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M9 11H5V7H3v10h2v-4h4v4h2V7H9v4zm11.3 1.7c-.4-.4-1-.7-1.6-.8v-.1c.6-.2 1.1-.5 1.5-.9.3-.4.5-.8.5-1.3 0-.4-.1-.8-.3-1.1-.2-.3-.5-.6-.8-.8-.4-.2-.8-.4-1.2-.5-.6-.1-1.1-.2-1.6-.2-.6 0-1.3.1-1.8.3s-1.1.5-1.6.9l1.2 1.4c.4-.2.7-.4 1.1-.6.3-.2.7-.3 1.1-.3.4 0 .8.1 1.1.3.3.2.4.5.4.8 0 .4-.2.7-.6.9-.7.3-1.5.5-2.2.4v1.6c.5 0 1 0 1.5.1.3.1.7.2 1 .3.2.1.4.2.5.4s.1.4.1.6c0 .3-.2.7-.5.8-.4.2-.9.3-1.4.3s-1-.1-1.4-.3c-.4-.2-.8-.4-1.2-.7L13 15.6c.5.4 1 .8 1.6 1 .7.3 1.5.4 2.3.4.6 0 1.1-.1 1.6-.2.4-.1.9-.2 1.3-.5.4-.2.7-.5.9-.9.2-.4.3-.8.3-1.2 0-.6-.3-1.1-.7-1.5z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M9 11H5V7H3v10h2v-4h4v4h2V7H9v4zm11.3 1.7c-.4-.4-1-.7-1.6-.8v-.1c.6-.2 1.1-.5 1.5-.9.3-.4.5-.8.5-1.3 0-.4-.1-.8-.3-1.1-.2-.3-.5-.6-.8-.8-.4-.2-.8-.4-1.2-.5-.6-.1-1.1-.2-1.6-.2-.6 0-1.3.1-1.8.3s-1.1.5-1.6.9l1.2 1.4c.4-.2.7-.4 1.1-.6.3-.2.7-.3 1.1-.3.4 0 .8.1 1.1.3.3.2.4.5.4.8 0 .4-.2.7-.6.9-.7.3-1.5.5-2.2.4v1.6c.5 0 1 0 1.5.1.3.1.7.2 1 .3.2.1.4.2.5.4s.1.4.1.6c0 .3-.2.7-.5.8-.4.2-.9.3-1.4.3s-1-.1-1.4-.3c-.4-.2-.8-.4-1.2-.7L13 15.6c.5.4 1 .8 1.6 1 .7.3 1.5.4 2.3.4.6 0 1.1-.1 1.6-.2.4-.1.9-.2 1.3-.5.4-.2.7-.5.9-.9.2-.4.3-.8.3-1.2 0-.6-.3-1.1-.7-1.5z" + }) +}); /* harmony default export */ const heading_level_3 = (headingLevel3); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/heading-level-4.js - /** * WordPress dependencies */ -const headingLevel4 = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const headingLevel4 = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M20 13V7h-3l-4 6v2h5v2h2v-2h1v-2h-1zm-2 0h-2.8L18 9v4zm-9-2H5V7H3v10h2v-4h4v4h2V7H9v4z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M20 13V7h-3l-4 6v2h5v2h2v-2h1v-2h-1zm-2 0h-2.8L18 9v4zm-9-2H5V7H3v10h2v-4h4v4h2V7H9v4z" + }) +}); /* harmony default export */ const heading_level_4 = (headingLevel4); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/heading-level-5.js - /** * WordPress dependencies */ -const headingLevel5 = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const headingLevel5 = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M9 11H5V7H3v10h2v-4h4v4h2V7H9v4zm11.7 1.2c-.2-.3-.5-.7-.8-.9-.3-.3-.7-.5-1.1-.6-.5-.1-.9-.2-1.4-.2-.2 0-.5.1-.7.1-.2.1-.5.1-.7.2l.1-1.9h4.3V7H14l-.3 5 1 .6.5-.2.4-.1c.1-.1.3-.1.4-.1h.5c.5 0 1 .1 1.4.4.4.2.6.7.6 1.1 0 .4-.2.8-.6 1.1-.4.3-.9.4-1.4.4-.4 0-.9-.1-1.3-.3-.4-.2-.7-.4-1.1-.7 0 0-1.1 1.4-1 1.5.5.4 1 .8 1.6 1 .7.3 1.5.4 2.3.4.5 0 1-.1 1.5-.3s.9-.4 1.3-.7c.4-.3.7-.7.9-1.1s.3-.9.3-1.4-.1-1-.3-1.4z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M9 11H5V7H3v10h2v-4h4v4h2V7H9v4zm11.7 1.2c-.2-.3-.5-.7-.8-.9-.3-.3-.7-.5-1.1-.6-.5-.1-.9-.2-1.4-.2-.2 0-.5.1-.7.1-.2.1-.5.1-.7.2l.1-1.9h4.3V7H14l-.3 5 1 .6.5-.2.4-.1c.1-.1.3-.1.4-.1h.5c.5 0 1 .1 1.4.4.4.2.6.7.6 1.1 0 .4-.2.8-.6 1.1-.4.3-.9.4-1.4.4-.4 0-.9-.1-1.3-.3-.4-.2-.7-.4-1.1-.7 0 0-1.1 1.4-1 1.5.5.4 1 .8 1.6 1 .7.3 1.5.4 2.3.4.5 0 1-.1 1.5-.3s.9-.4 1.3-.7c.4-.3.7-.7.9-1.1s.3-.9.3-1.4-.1-1-.3-1.4z" + }) +}); /* harmony default export */ const heading_level_5 = (headingLevel5); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/heading-level-6.js - /** * WordPress dependencies */ -const headingLevel6 = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const headingLevel6 = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M20.7 12.4c-.2-.3-.4-.6-.7-.9s-.6-.5-1-.6c-.4-.2-.8-.2-1.2-.2-.5 0-.9.1-1.3.3s-.8.5-1.2.8c0-.5 0-.9.2-1.4l.6-.9c.2-.2.5-.4.8-.5.6-.2 1.3-.2 1.9 0 .3.1.6.3.8.5 0 0 1.3-1.3 1.3-1.4-.4-.3-.9-.6-1.4-.8-.6-.2-1.3-.3-2-.3-.6 0-1.1.1-1.7.4-.5.2-1 .5-1.4.9-.4.4-.8 1-1 1.6-.3.7-.4 1.5-.4 2.3s.1 1.5.3 2.1c.2.6.6 1.1 1 1.5.4.4.9.7 1.4.9 1 .3 2 .3 3 0 .4-.1.8-.3 1.2-.6.3-.3.6-.6.8-1 .2-.5.3-.9.3-1.4s-.1-.9-.3-1.3zm-2 2.1c-.1.2-.3.4-.4.5-.1.1-.3.2-.5.2-.2.1-.4.1-.6.1-.2.1-.5 0-.7-.1-.2 0-.3-.2-.5-.3-.1-.2-.3-.4-.4-.6-.2-.3-.3-.7-.3-1 .3-.3.6-.5 1-.7.3-.1.7-.2 1-.2.4 0 .8.1 1.1.3.3.3.4.7.4 1.1 0 .2 0 .5-.1.7zM9 11H5V7H3v10h2v-4h4v4h2V7H9v4z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M20.7 12.4c-.2-.3-.4-.6-.7-.9s-.6-.5-1-.6c-.4-.2-.8-.2-1.2-.2-.5 0-.9.1-1.3.3s-.8.5-1.2.8c0-.5 0-.9.2-1.4l.6-.9c.2-.2.5-.4.8-.5.6-.2 1.3-.2 1.9 0 .3.1.6.3.8.5 0 0 1.3-1.3 1.3-1.4-.4-.3-.9-.6-1.4-.8-.6-.2-1.3-.3-2-.3-.6 0-1.1.1-1.7.4-.5.2-1 .5-1.4.9-.4.4-.8 1-1 1.6-.3.7-.4 1.5-.4 2.3s.1 1.5.3 2.1c.2.6.6 1.1 1 1.5.4.4.9.7 1.4.9 1 .3 2 .3 3 0 .4-.1.8-.3 1.2-.6.3-.3.6-.6.8-1 .2-.5.3-.9.3-1.4s-.1-.9-.3-1.3zm-2 2.1c-.1.2-.3.4-.4.5-.1.1-.3.2-.5.2-.2.1-.4.1-.6.1-.2.1-.5 0-.7-.1-.2 0-.3-.2-.5-.3-.1-.2-.3-.4-.4-.6-.2-.3-.3-.7-.3-1 .3-.3.6-.5 1-.7.3-.1.7-.2 1-.2.4 0 .8.1 1.1.3.3.3.4.7.4 1.1 0 .2 0 .5-.1.7zM9 11H5V7H3v10h2v-4h4v4h2V7H9v4z" + }) +}); /* harmony default export */ const heading_level_6 = (headingLevel6); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-heading-level-dropdown/heading-level-icon.js - /** * WordPress dependencies */ @@ -54961,7 +59823,7 @@ function HeadingLevelIcon({ level }) { if (LEVEL_TO_PATH[level]) { - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: LEVEL_TO_PATH[level] }); } @@ -54969,7 +59831,6 @@ function HeadingLevelIcon({ } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-heading-level-dropdown/index.js - /** * WordPress dependencies */ @@ -54980,6 +59841,7 @@ function HeadingLevelIcon({ * Internal dependencies */ + const HEADING_LEVELS = [1, 2, 3, 4, 5, 6]; const block_heading_level_dropdown_POPOVER_PROPS = { className: 'block-library-heading-level-dropdown' @@ -54992,10 +59854,10 @@ const block_heading_level_dropdown_POPOVER_PROPS = { * * @typedef WPHeadingLevelDropdownProps * - * @property {number} value The chosen heading level. - * @property {number[]} options An array of supported heading levels. - * @property {(newValue:number)=>any} onChange Callback to run when - * toolbar value is changed. + * @property {number} value The chosen heading level. + * @property {number[]} options An array of supported heading levels. + * @property {()=>number} onChange Function called with + * the selected value changes. */ /** @@ -55010,50 +59872,47 @@ function HeadingLevelDropdown({ value, onChange }) { - return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarDropdownMenu, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarDropdownMenu, { popoverProps: block_heading_level_dropdown_POPOVER_PROPS, - icon: (0,external_React_.createElement)(HeadingLevelIcon, { + icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(HeadingLevelIcon, { level: value }), label: (0,external_wp_i18n_namespaceObject.__)('Change level'), controls: options.map(targetLevel => { - { - const isActive = targetLevel === value; - return { - icon: (0,external_React_.createElement)(HeadingLevelIcon, { - level: targetLevel, - isPressed: isActive - }), - title: targetLevel === 0 ? (0,external_wp_i18n_namespaceObject.__)('Paragraph') : (0,external_wp_i18n_namespaceObject.sprintf)( - // translators: %s: heading level e.g: "1", "2", "3" - (0,external_wp_i18n_namespaceObject.__)('Heading %d'), targetLevel), - isActive, - onClick() { - onChange(targetLevel); - }, - role: 'menuitemradio' - }; - } + const isActive = targetLevel === value; + return { + icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(HeadingLevelIcon, { + level: targetLevel + }), + title: targetLevel === 0 ? (0,external_wp_i18n_namespaceObject.__)('Paragraph') : (0,external_wp_i18n_namespaceObject.sprintf)( + // translators: %d: heading level e.g: "1", "2", "3" + (0,external_wp_i18n_namespaceObject.__)('Heading %d'), targetLevel), + isActive, + onClick() { + onChange(targetLevel); + }, + role: 'menuitemradio' + }; }) }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js - /** * WordPress dependencies */ -const layout_layout = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const layout_layout = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" + }) +}); /* harmony default export */ const library_layout = (layout_layout); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-variation-picker/index.js - /** * External dependencies */ @@ -55065,62 +59924,54 @@ const layout_layout = (0,external_React_.createElement)(external_wp_primitives_n + + function BlockVariationPicker({ icon = library_layout, label = (0,external_wp_i18n_namespaceObject.__)('Choose variation'), - instructions = (0,external_wp_i18n_namespaceObject.__)('Select a variation to start with.'), + instructions = (0,external_wp_i18n_namespaceObject.__)('Select a variation to start with:'), variations, onSelect, allowSkip }) { - const classes = classnames_default()('block-editor-block-variation-picker', { + const classes = dist_clsx('block-editor-block-variation-picker', { 'has-many-variations': variations.length > 4 }); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Placeholder, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Placeholder, { icon: icon, label: label, instructions: instructions, - className: classes - }, (0,external_React_.createElement)("ul", { - className: "block-editor-block-variation-picker__variations", - role: "list", - "aria-label": (0,external_wp_i18n_namespaceObject.__)('Block variations') - }, variations.map(variation => (0,external_React_.createElement)("li", { - key: variation.name - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - variant: "secondary", - icon: variation.icon && variation.icon.src ? variation.icon.src : variation.icon, - iconSize: 48, - onClick: () => onSelect(variation), - className: "block-editor-block-variation-picker__variation", - label: variation.description || variation.title - }), (0,external_React_.createElement)("span", { - className: "block-editor-block-variation-picker__variation-label" - }, variation.title)))), allowSkip && (0,external_React_.createElement)("div", { - className: "block-editor-block-variation-picker__skip" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - variant: "link", - onClick: () => onSelect() - }, (0,external_wp_i18n_namespaceObject.__)('Skip')))); + className: classes, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { + className: "block-editor-block-variation-picker__variations", + role: "list", + "aria-label": (0,external_wp_i18n_namespaceObject.__)('Block variations'), + children: variations.map(variation => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + __next40pxDefaultSize: true, + variant: "tertiary", + icon: variation.icon && variation.icon.src ? variation.icon.src : variation.icon, + iconSize: 48, + onClick: () => onSelect(variation), + className: "block-editor-block-variation-picker__variation", + label: variation.description || variation.title + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + className: "block-editor-block-variation-picker__variation-label", + children: variation.title + })] + }, variation.name)) + }), allowSkip && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-block-variation-picker__skip", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + variant: "link", + onClick: () => onSelect(), + children: (0,external_wp_i18n_namespaceObject.__)('Skip') + }) + })] + }); } /* harmony default export */ const block_variation_picker = (BlockVariationPicker); -;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/grid.js - -/** - * WordPress dependencies - */ - -const grid_grid = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "m3 5c0-1.10457.89543-2 2-2h13.5c1.1046 0 2 .89543 2 2v13.5c0 1.1046-.8954 2-2 2h-13.5c-1.10457 0-2-.8954-2-2zm2-.5h6v6.5h-6.5v-6c0-.27614.22386-.5.5-.5zm-.5 8v6c0 .2761.22386.5.5.5h6v-6.5zm8 0v6.5h6c.2761 0 .5-.2239.5-.5v-6zm0-8v6.5h6.5v-6c0-.27614-.2239-.5-.5-.5z", - fillRule: "evenodd", - clipRule: "evenodd" -})); -/* harmony default export */ const library_grid = (grid_grid); - ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/constants.js const VIEWMODES = { carousel: 'carousel', @@ -55128,7 +59979,6 @@ const VIEWMODES = { }; ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/setup-toolbar.js - /** * WordPress dependencies */ @@ -55140,34 +59990,39 @@ const VIEWMODES = { * Internal dependencies */ + + const Actions = ({ onBlockPatternSelect -}) => (0,external_React_.createElement)("div", { - className: "block-editor-block-pattern-setup__actions" -}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - variant: "primary", - onClick: onBlockPatternSelect -}, (0,external_wp_i18n_namespaceObject.__)('Choose'))); +}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-block-pattern-setup__actions", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + variant: "primary", + onClick: onBlockPatternSelect, + children: (0,external_wp_i18n_namespaceObject.__)('Choose') + }) +}); const CarouselNavigation = ({ handlePrevious, handleNext, activeSlide, totalSlides -}) => (0,external_React_.createElement)("div", { - className: "block-editor-block-pattern-setup__navigation" -}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - icon: chevron_left, - label: (0,external_wp_i18n_namespaceObject.__)('Previous pattern'), - onClick: handlePrevious, - disabled: activeSlide === 0, - __experimentalIsFocusable: true -}), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - icon: chevron_right, - label: (0,external_wp_i18n_namespaceObject.__)('Next pattern'), - onClick: handleNext, - disabled: activeSlide === totalSlides - 1, - __experimentalIsFocusable: true -})); +}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-block-pattern-setup__navigation", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + icon: chevron_left, + label: (0,external_wp_i18n_namespaceObject.__)('Previous pattern'), + onClick: handlePrevious, + disabled: activeSlide === 0, + __experimentalIsFocusable: true + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + icon: chevron_right, + label: (0,external_wp_i18n_namespaceObject.__)('Next pattern'), + onClick: handleNext, + disabled: activeSlide === totalSlides - 1, + __experimentalIsFocusable: true + })] +}); const SetupToolbar = ({ viewMode, setViewMode, @@ -55178,29 +60033,31 @@ const SetupToolbar = ({ onBlockPatternSelect }) => { const isCarouselView = viewMode === VIEWMODES.carousel; - const displayControls = (0,external_React_.createElement)("div", { - className: "block-editor-block-pattern-setup__display-controls" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - icon: stretch_full_width, - label: (0,external_wp_i18n_namespaceObject.__)('Carousel view'), - onClick: () => setViewMode(VIEWMODES.carousel), - isPressed: isCarouselView - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - icon: library_grid, - label: (0,external_wp_i18n_namespaceObject.__)('Grid view'), - onClick: () => setViewMode(VIEWMODES.grid), - isPressed: viewMode === VIEWMODES.grid - })); - return (0,external_React_.createElement)("div", { - className: "block-editor-block-pattern-setup__toolbar" - }, isCarouselView && (0,external_React_.createElement)(CarouselNavigation, { - handlePrevious: handlePrevious, - handleNext: handleNext, - activeSlide: activeSlide, - totalSlides: totalSlides - }), displayControls, isCarouselView && (0,external_React_.createElement)(Actions, { - onBlockPatternSelect: onBlockPatternSelect - })); + const displayControls = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-block-pattern-setup__display-controls", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + icon: stretch_full_width, + label: (0,external_wp_i18n_namespaceObject.__)('Carousel view'), + onClick: () => setViewMode(VIEWMODES.carousel), + isPressed: isCarouselView + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + icon: library_grid, + label: (0,external_wp_i18n_namespaceObject.__)('Grid view'), + onClick: () => setViewMode(VIEWMODES.grid), + isPressed: viewMode === VIEWMODES.grid + })] + }); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-block-pattern-setup__toolbar", + children: [isCarouselView && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CarouselNavigation, { + handlePrevious: handlePrevious, + handleNext: handleNext, + activeSlide: activeSlide, + totalSlides: totalSlides + }), displayControls, isCarouselView && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Actions, { + onBlockPatternSelect: onBlockPatternSelect + })] + }); }; /* harmony default export */ const setup_toolbar = (SetupToolbar); @@ -55231,7 +60088,6 @@ function usePatternsSetup(clientId, blockName, filterPatternsFn) { /* harmony default export */ const use_patterns_setup = (usePatternsSetup); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/index.js - /** * WordPress dependencies */ @@ -55251,6 +60107,9 @@ function usePatternsSetup(clientId, blockName, filterPatternsFn) { + + + const { CompositeV2: block_pattern_setup_Composite, CompositeItemV2: block_pattern_setup_CompositeItem, @@ -55267,32 +60126,35 @@ const SetupContent = ({ const containerClass = 'block-editor-block-pattern-setup__container'; if (viewMode === VIEWMODES.carousel) { const slideClass = new Map([[activeSlide, 'active-slide'], [activeSlide - 1, 'previous-slide'], [activeSlide + 1, 'next-slide']]); - return (0,external_React_.createElement)("div", { - className: "block-editor-block-pattern-setup__carousel" - }, (0,external_React_.createElement)("div", { - className: containerClass - }, (0,external_React_.createElement)("div", { - className: "carousel-container" - }, patterns.map((pattern, index) => (0,external_React_.createElement)(BlockPatternSlide, { - active: index === activeSlide, - className: slideClass.get(index) || '', - key: pattern.name, - pattern: pattern - }))))); - } - return (0,external_React_.createElement)("div", { - className: "block-editor-block-pattern-setup__grid" - }, (0,external_React_.createElement)(block_pattern_setup_Composite, { - store: compositeStore, - role: "listbox", - className: containerClass, - "aria-label": (0,external_wp_i18n_namespaceObject.__)('Patterns list') - }, patterns.map(pattern => (0,external_React_.createElement)(block_pattern_setup_BlockPattern, { - key: pattern.name, - pattern: pattern, - onSelect: onBlockPatternSelect, - showTitles: showTitles - })))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-block-pattern-setup__carousel", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: containerClass, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "carousel-container", + children: patterns.map((pattern, index) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockPatternSlide, { + active: index === activeSlide, + className: slideClass.get(index) || '', + pattern: pattern + }, pattern.name)) + }) + }) + }); + } + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-block-pattern-setup__grid", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_pattern_setup_Composite, { + store: compositeStore, + role: "listbox", + className: containerClass, + "aria-label": (0,external_wp_i18n_namespaceObject.__)('Patterns list'), + children: patterns.map(pattern => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_pattern_setup_BlockPattern, { + pattern: pattern, + onSelect: onBlockPatternSelect, + showTitles: showTitles + }, pattern.name)) + }) + }); }; function block_pattern_setup_BlockPattern({ pattern, @@ -55306,25 +60168,29 @@ function block_pattern_setup_BlockPattern({ viewportWidth = 700 } = pattern; const descriptionId = (0,external_wp_compose_namespaceObject.useInstanceId)(block_pattern_setup_BlockPattern, `${baseClassName}__item-description`); - return (0,external_React_.createElement)("div", { - className: `${baseClassName}__list-item` - }, (0,external_React_.createElement)(block_pattern_setup_CompositeItem, { - render: (0,external_React_.createElement)("div", { - "aria-describedby": description ? descriptionId : undefined, - "aria-label": pattern.title, - className: `${baseClassName}__item` - }), - id: `${baseClassName}__pattern__${pattern.name}`, - role: "option", - onClick: () => onSelect(blocks) - }, (0,external_React_.createElement)(block_preview, { - blocks: blocks, - viewportWidth: viewportWidth - }), showTitles && (0,external_React_.createElement)("div", { - className: `${baseClassName}__item-title` - }, pattern.title), !!description && (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { - id: descriptionId - }, description))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: `${baseClassName}__list-item`, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(block_pattern_setup_CompositeItem, { + render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + "aria-describedby": description ? descriptionId : undefined, + "aria-label": pattern.title, + className: `${baseClassName}__item` + }), + id: `${baseClassName}__pattern__${pattern.name}`, + role: "option", + onClick: () => onSelect(blocks), + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_preview, { + blocks: blocks, + viewportWidth: viewportWidth + }), showTitles && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: `${baseClassName}__item-title`, + children: pattern.title + }), !!description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { + id: descriptionId, + children: description + })] + }) + }); } function BlockPatternSlide({ active, @@ -55338,18 +60204,20 @@ function BlockPatternSlide({ description } = pattern; const descriptionId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockPatternSlide, 'block-editor-block-pattern-setup-list__item-description'); - return (0,external_React_.createElement)("div", { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { "aria-hidden": !active, role: "img", className: `pattern-slide ${className}`, "aria-label": title, - "aria-describedby": description ? descriptionId : undefined - }, (0,external_React_.createElement)(block_preview, { - blocks: blocks, - minHeight: minHeight - }), !!description && (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { - id: descriptionId - }, description)); + "aria-describedby": description ? descriptionId : undefined, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_preview, { + blocks: blocks, + minHeight: minHeight + }), !!description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { + id: descriptionId, + children: description + })] + }); } const BlockPatternSetup = ({ clientId, @@ -55373,34 +60241,36 @@ const BlockPatternSetup = ({ replaceBlock(clientId, clonedBlocks); }; const onPatternSelectCallback = onBlockPatternSelect || onBlockPatternSelectDefault; - return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("div", { - className: `block-editor-block-pattern-setup view-mode-${viewMode}` - }, (0,external_React_.createElement)(SetupContent, { - viewMode: viewMode, - activeSlide: activeSlide, - patterns: patterns, - onBlockPatternSelect: onPatternSelectCallback, - showTitles: showTitles - }), (0,external_React_.createElement)(setup_toolbar, { - viewMode: viewMode, - setViewMode: setViewMode, - activeSlide: activeSlide, - totalSlides: patterns.length, - handleNext: () => { - setActiveSlide(active => Math.min(active + 1, patterns.length - 1)); - }, - handlePrevious: () => { - setActiveSlide(active => Math.max(active - 1, 0)); - }, - onBlockPatternSelect: () => { - onPatternSelectCallback(patterns[activeSlide].blocks); - } - }))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: `block-editor-block-pattern-setup view-mode-${viewMode}`, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SetupContent, { + viewMode: viewMode, + activeSlide: activeSlide, + patterns: patterns, + onBlockPatternSelect: onPatternSelectCallback, + showTitles: showTitles + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(setup_toolbar, { + viewMode: viewMode, + setViewMode: setViewMode, + activeSlide: activeSlide, + totalSlides: patterns.length, + handleNext: () => { + setActiveSlide(active => Math.min(active + 1, patterns.length - 1)); + }, + handlePrevious: () => { + setActiveSlide(active => Math.max(active - 1, 0)); + }, + onBlockPatternSelect: () => { + onPatternSelectCallback(patterns[activeSlide].blocks); + } + })] + }) + }); }; /* harmony default export */ const block_pattern_setup = (BlockPatternSetup); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-variation-transforms/index.js - /** * WordPress dependencies */ @@ -55416,29 +60286,32 @@ const BlockPatternSetup = ({ */ + + function VariationsButtons({ className, onSelectVariation, selectedValue, variations }) { - return (0,external_React_.createElement)("fieldset", { - className: className - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { - as: "legend" - }, (0,external_wp_i18n_namespaceObject.__)('Transform to variation')), variations.map(variation => (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - key: variation.name, - icon: (0,external_React_.createElement)(block_icon, { - icon: variation.icon, - showColors: true - }), - isPressed: selectedValue === variation.name, - label: selectedValue === variation.name ? variation.title : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Name of the block variation */ - (0,external_wp_i18n_namespaceObject.__)('Transform to %s'), variation.title), - onClick: () => onSelectVariation(variation.name), - "aria-label": variation.title, - showTooltip: true - }))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { + className: className, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { + as: "legend", + children: (0,external_wp_i18n_namespaceObject.__)('Transform to variation') + }), variations.map(variation => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { + icon: variation.icon, + showColors: true + }), + isPressed: selectedValue === variation.name, + label: selectedValue === variation.name ? variation.title : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Name of the block variation */ + (0,external_wp_i18n_namespaceObject.__)('Transform to %s'), variation.title), + onClick: () => onSelectVariation(variation.name), + "aria-label": variation.title, + showTooltip: true + }, variation.name))] + }); } function VariationsDropdown({ className, @@ -55455,7 +60328,7 @@ function VariationsDropdown({ label: title, info: description })); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.DropdownMenu, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { className: className, label: (0,external_wp_i18n_namespaceObject.__)('Transform to variation'), text: (0,external_wp_i18n_namespaceObject.__)('Transform to variation'), @@ -55466,14 +60339,18 @@ function VariationsDropdown({ icon: chevron_down, toggleProps: { iconPosition: 'right' - } - }, () => (0,external_React_.createElement)("div", { - className: `${className}__container` - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItemsChoice, { - choices: selectOptions, - value: selectedValue, - onSelect: onSelectVariation - })))); + }, + children: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: `${className}__container`, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItemsChoice, { + choices: selectOptions, + value: selectedValue, + onSelect: onSelectVariation + }) + }) + }) + }); } function VariationsToggleGroupControl({ className, @@ -55481,22 +60358,26 @@ function VariationsToggleGroupControl({ selectedValue, variations }) { - return (0,external_React_.createElement)("div", { - className: className - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { - label: (0,external_wp_i18n_namespaceObject.__)('Transform to variation'), - value: selectedValue, - hideLabelFromVision: true, - onChange: onSelectVariation, - __next40pxDefaultSize: true, - __nextHasNoMarginBottom: true - }, variations.map(variation => (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { - key: variation.name, - icon: variation.icon, - value: variation.name, - label: selectedValue === variation.name ? variation.title : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Name of the block variation */ - (0,external_wp_i18n_namespaceObject.__)('Transform to %s'), variation.title) - })))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: className, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Transform to variation'), + value: selectedValue, + hideLabelFromVision: true, + onChange: onSelectVariation, + __next40pxDefaultSize: true, + __nextHasNoMarginBottom: true, + children: variations.map(variation => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, { + icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { + icon: variation.icon, + showColors: true + }), + value: variation.name, + label: selectedValue === variation.name ? variation.title : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Name of the block variation */ + (0,external_wp_i18n_namespaceObject.__)('Transform to %s'), variation.title) + }, variation.name)) + }) + }); } function __experimentalBlockVariationTransforms({ blockClientId @@ -55546,14 +60427,16 @@ function __experimentalBlockVariationTransforms({ }; // Skip rendering if there are no variations - if (!variations?.length) return null; + if (!variations?.length) { + return null; + } const baseClass = 'block-editor-block-variation-transforms'; // Show buttons if there are more than 5 variations because the ToggleGroupControl does not wrap const showButtons = variations.length > 5; const ButtonComponent = showButtons ? VariationsButtons : VariationsToggleGroupControl; const Component = hasUniqueIcons ? ButtonComponent : VariationsDropdown; - return (0,external_React_.createElement)(Component, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { className: baseClass, onSelectVariation: onSelectVariation, selectedValue: selectedValue, @@ -55563,7 +60446,6 @@ function __experimentalBlockVariationTransforms({ /* harmony default export */ const block_variation_transforms = (__experimentalBlockVariationTransforms); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/color-palette/with-color-context.js - /** * WordPress dependencies */ @@ -55573,6 +60455,7 @@ function __experimentalBlockVariationTransforms({ * Internal dependencies */ + /* harmony default export */ const with_color_context = ((0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => { return props => { const [colorsFeature, enableCustomColors] = use_settings_useSettings('color.palette', 'color.custom'); @@ -55581,7 +60464,7 @@ function __experimentalBlockVariationTransforms({ disableCustomColors = !enableCustomColors } = props; const hasColorsToChoose = colors && colors.length > 0 || !disableCustomColors; - return (0,external_React_.createElement)(WrappedComponent, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { ...props, colors, disableCustomColors, @@ -55603,17 +60486,17 @@ function __experimentalBlockVariationTransforms({ /* harmony default export */ const color_palette = (with_color_context(external_wp_components_namespaceObject.ColorPalette)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/color-palette/control.js - /** * Internal dependencies */ + function ColorPaletteControl({ onChange, value, ...otherProps }) { - return (0,external_React_.createElement)(control, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(control, { ...otherProps, onColorChange: onChange, colorValue: value, @@ -55625,7 +60508,6 @@ function ColorPaletteControl({ ;// CONCATENATED MODULE: external ["wp","date"] const external_wp_date_namespaceObject = window["wp"]["date"]; ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/date-format-picker/index.js - /** * WordPress dependencies */ @@ -55638,6 +60520,8 @@ const external_wp_date_namespaceObject = window["wp"]["date"]; // show a date that has a day greater than 12 and a month with more than three // letters. Here we're using 2022-01-25 which is when WordPress 5.9 was // released. + + const EXAMPLE_DATE = new Date(2022, 0, 25); /** @@ -55667,20 +60551,22 @@ function DateFormatPicker({ defaultFormat, onChange }) { - return (0,external_React_.createElement)("fieldset", { - className: "block-editor-date-format-picker" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { - as: "legend" - }, (0,external_wp_i18n_namespaceObject.__)('Date format')), (0,external_React_.createElement)(external_wp_components_namespaceObject.ToggleControl, { - __nextHasNoMarginBottom: true, - label: (0,external_wp_i18n_namespaceObject.__)('Default format'), - help: `${(0,external_wp_i18n_namespaceObject.__)('Example:')} ${(0,external_wp_date_namespaceObject.dateI18n)(defaultFormat, EXAMPLE_DATE)}`, - checked: !format, - onChange: checked => onChange(checked ? null : defaultFormat) - }), format && (0,external_React_.createElement)(NonDefaultControls, { - format: format, - onChange: onChange - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { + className: "block-editor-date-format-picker", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { + as: "legend", + children: (0,external_wp_i18n_namespaceObject.__)('Date format') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { + __nextHasNoMarginBottom: true, + label: (0,external_wp_i18n_namespaceObject.__)('Default format'), + help: `${(0,external_wp_i18n_namespaceObject.__)('Example:')} ${(0,external_wp_date_namespaceObject.dateI18n)(defaultFormat, EXAMPLE_DATE)}`, + checked: !format, + onChange: checked => onChange(checked ? null : defaultFormat) + }), format && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NonDefaultControls, { + format: format, + onChange: onChange + })] + }); } function NonDefaultControls({ format, @@ -55714,37 +60600,37 @@ function NonDefaultControls({ __experimentalHint: (0,external_wp_i18n_namespaceObject.__)('Enter your own date format') }; const [isCustom, setIsCustom] = (0,external_wp_element_namespaceObject.useState)(() => !!format && !suggestedFormats.includes(format)); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.CustomSelectControl, { - __nextUnconstrainedWidth: true, - label: (0,external_wp_i18n_namespaceObject.__)('Choose a format'), - options: [...suggestedOptions, customOption], - value: isCustom ? customOption : (_suggestedOptions$fin = suggestedOptions.find(option => option.format === format)) !== null && _suggestedOptions$fin !== void 0 ? _suggestedOptions$fin : customOption, - onChange: ({ - selectedItem - }) => { - if (selectedItem === customOption) { - setIsCustom(true); - } else { - setIsCustom(false); - onChange(selectedItem.format); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CustomSelectControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Choose a format'), + options: [...suggestedOptions, customOption], + value: isCustom ? customOption : (_suggestedOptions$fin = suggestedOptions.find(option => option.format === format)) !== null && _suggestedOptions$fin !== void 0 ? _suggestedOptions$fin : customOption, + onChange: ({ + selectedItem + }) => { + if (selectedItem === customOption) { + setIsCustom(true); + } else { + setIsCustom(false); + onChange(selectedItem.format); + } } - } - }), isCustom && (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, { - __nextHasNoMarginBottom: true, - label: (0,external_wp_i18n_namespaceObject.__)('Custom format'), - hideLabelFromVision: true, - help: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Enter a date or time format string.'), { - Link: (0,external_React_.createElement)(external_wp_components_namespaceObject.ExternalLink, { - href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/customize-date-and-time-format/') - }) - }), - value: format, - onChange: value => onChange(value) - })); + }), isCustom && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { + __nextHasNoMarginBottom: true, + label: (0,external_wp_i18n_namespaceObject.__)('Custom format'), + hideLabelFromVision: true, + help: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Enter a date or time format string.'), { + Link: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { + href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/customize-date-and-time-format/') + }) + }), + value: format, + onChange: value => onChange(value) + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/dropdown.js - /** * External dependencies */ @@ -55762,6 +60648,9 @@ function NonDefaultControls({ // When the `ColorGradientSettingsDropdown` controls are being rendered to a // `ToolsPanel` they must be wrapped in a `ToolsPanelItem`. + + + const WithToolsPanelItem = ({ setting, children, @@ -55775,7 +60664,7 @@ const WithToolsPanelItem = ({ setting.onGradientChange(); } }; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { hasValue: () => { return !!setting.colorValue || !!setting.gradientValue; }, @@ -55788,21 +60677,24 @@ const WithToolsPanelItem = ({ // Pass resetAllFilter if supplied due to rendering via SlotFill // into parent ToolsPanel. , - resetAllFilter: setting.resetAllFilter - }, children); + resetAllFilter: setting.resetAllFilter, + children: children + }); }; const dropdown_LabeledColorIndicator = ({ colorValue, label -}) => (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { - justify: "flex-start" -}, (0,external_React_.createElement)(external_wp_components_namespaceObject.ColorIndicator, { - className: "block-editor-panel-color-gradient-settings__color-indicator", - colorValue: colorValue -}), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, { - className: "block-editor-panel-color-gradient-settings__color-name", - title: label -}, label)); +}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { + justify: "flex-start", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ColorIndicator, { + className: "block-editor-panel-color-gradient-settings__color-indicator", + colorValue: colorValue + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { + className: "block-editor-panel-color-gradient-settings__color-name", + title: label, + children: label + })] +}); // Renders a color dropdown's toggle as an `Item` if it is within an `ItemGroup` // or as a `Button` if it isn't e.g. the controls are being rendered in @@ -55817,17 +60709,18 @@ const renderToggle = settings => ({ } = settings; const toggleProps = { onClick: onToggle, - className: classnames_default()('block-editor-panel-color-gradient-settings__dropdown', { + className: dist_clsx('block-editor-panel-color-gradient-settings__dropdown', { 'is-open': isOpen }), 'aria-expanded': isOpen }; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - ...toggleProps - }, (0,external_React_.createElement)(dropdown_LabeledColorIndicator, { - colorValue: colorValue, - label: label - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + ...toggleProps, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dropdown_LabeledColorIndicator, { + colorValue: colorValue, + label: label + }) + }); }; // Renders a collection of color controls as dropdowns. Depending upon the @@ -55855,52 +60748,56 @@ function ColorGradientSettingsDropdown({ shift: true }; } - return (0,external_React_.createElement)(external_React_.Fragment, null, settings.map((setting, index) => { - var _setting$gradientValu; - const controlProps = { - clearable: false, - colorValue: setting.colorValue, - colors, - disableCustomColors, - disableCustomGradients, - enableAlpha, - gradientValue: setting.gradientValue, - gradients, - label: setting.label, - onColorChange: setting.onColorChange, - onGradientChange: setting.onGradientChange, - showTitle: false, - __experimentalIsRenderedInSidebar, - ...setting - }; - const toggleSettings = { - colorValue: (_setting$gradientValu = setting.gradientValue) !== null && _setting$gradientValu !== void 0 ? _setting$gradientValu : setting.colorValue, - label: setting.label - }; - return setting && - // If not in an `ItemGroup` wrap the dropdown in a - // `ToolsPanelItem` - (0,external_React_.createElement)(WithToolsPanelItem, { - key: index, - setting: setting, - ...props - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Dropdown, { - popoverProps: popoverProps, - className: "block-editor-tools-panel-color-gradient-settings__dropdown", - renderToggle: renderToggle(toggleSettings), - renderContent: () => (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { - paddingSize: "none" - }, (0,external_React_.createElement)("div", { - className: "block-editor-panel-color-gradient-settings__dropdown-content" - }, (0,external_React_.createElement)(control, { - ...controlProps - }))) - })); - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: settings.map((setting, index) => { + var _setting$gradientValu; + const controlProps = { + clearable: false, + colorValue: setting.colorValue, + colors, + disableCustomColors, + disableCustomGradients, + enableAlpha, + gradientValue: setting.gradientValue, + gradients, + label: setting.label, + onColorChange: setting.onColorChange, + onGradientChange: setting.onGradientChange, + showTitle: false, + __experimentalIsRenderedInSidebar, + ...setting + }; + const toggleSettings = { + colorValue: (_setting$gradientValu = setting.gradientValue) !== null && _setting$gradientValu !== void 0 ? _setting$gradientValu : setting.colorValue, + label: setting.label + }; + return setting && + /*#__PURE__*/ + // If not in an `ItemGroup` wrap the dropdown in a + // `ToolsPanelItem` + (0,external_ReactJSXRuntime_namespaceObject.jsx)(WithToolsPanelItem, { + setting: setting, + ...props, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { + popoverProps: popoverProps, + className: "block-editor-tools-panel-color-gradient-settings__dropdown", + renderToggle: renderToggle(toggleSettings), + renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, { + paddingSize: "none", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-panel-color-gradient-settings__dropdown-content", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(control, { + ...controlProps + }) + }) + }) + }) + }, index); + }) + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/panel-color-gradient-settings.js - /** * External dependencies */ @@ -55918,6 +60815,9 @@ function ColorGradientSettingsDropdown({ */ + + + const panel_color_gradient_settings_colorsAndGradientKeys = ['colors', 'disableCustomColors', 'gradients', 'disableCustomGradients']; const PanelColorGradientSettingsInner = ({ className, @@ -55939,8 +60839,8 @@ const PanelColorGradientSettingsInner = ({ if ((!colors || colors.length === 0) && (!gradients || gradients.length === 0) && disableCustomColors && disableCustomGradients && settings?.every(setting => (!setting.colors || setting.colors.length === 0) && (!setting.gradients || setting.gradients.length === 0) && (setting.disableCustomColors === undefined || setting.disableCustomColors) && (setting.disableCustomGradients === undefined || setting.disableCustomGradients))) { return null; } - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, { - className: classnames_default()('block-editor-panel-color-gradient-settings', className), + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToolsPanel, { + className: dist_clsx('block-editor-panel-color-gradient-settings', className), label: showTitle ? title : undefined, resetAll: () => { batch(() => { @@ -55960,39 +60860,64 @@ const PanelColorGradientSettingsInner = ({ }, panelId: panelId, __experimentalFirstVisibleItemClass: "first", - __experimentalLastVisibleItemClass: "last" - }, (0,external_React_.createElement)(ColorGradientSettingsDropdown, { - settings: settings, - panelId: panelId, - colors, - gradients, - disableCustomColors, - disableCustomGradients, - __experimentalIsRenderedInSidebar, - enableAlpha - }), !!children && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, { - marginY: 4 - }), " ", children)); + __experimentalLastVisibleItemClass: "last", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorGradientSettingsDropdown, { + settings: settings, + panelId: panelId, + colors, + gradients, + disableCustomColors, + disableCustomGradients, + __experimentalIsRenderedInSidebar, + enableAlpha + }), !!children && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, { + marginY: 4 + }), " ", children] + })] + }); }; const PanelColorGradientSettingsSelect = props => { const colorGradientSettings = useMultipleOriginColorsAndGradients(); - return (0,external_React_.createElement)(PanelColorGradientSettingsInner, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PanelColorGradientSettingsInner, { ...colorGradientSettings, ...props }); }; const PanelColorGradientSettings = props => { if (panel_color_gradient_settings_colorsAndGradientKeys.every(key => props.hasOwnProperty(key))) { - return (0,external_React_.createElement)(PanelColorGradientSettingsInner, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PanelColorGradientSettingsInner, { ...props }); } - return (0,external_React_.createElement)(PanelColorGradientSettingsSelect, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PanelColorGradientSettingsSelect, { ...props }); }; /* harmony default export */ const panel_color_gradient_settings = (PanelColorGradientSettings); +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/aspect-ratio.js +/** + * WordPress dependencies + */ + + +const aspectRatio = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M18.5 5.5h-13c-1.1 0-2 .9-2 2v9c0 1.1.9 2 2 2h13c1.1 0 2-.9 2-2v-9c0-1.1-.9-2-2-2zm.5 11c0 .3-.2.5-.5.5h-13c-.3 0-.5-.2-.5-.5v-9c0-.3.2-.5.5-.5h13c.3 0 .5.2.5.5v9zM6.5 12H8v-2h2V8.5H6.5V12zm9.5 2h-2v1.5h3.5V12H16v2z" + }) +}); +/* harmony default export */ const aspect_ratio = (aspectRatio); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/constants.js +const MIN_ZOOM = 100; +const MAX_ZOOM = 300; +const constants_POPOVER_PROPS = { + placement: 'bottom-start' +}; + ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/use-save-image.js /** * WordPress dependencies @@ -56171,7 +61096,6 @@ function useTransformImage({ } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/context.js - /** * WordPress dependencies */ @@ -56182,6 +61106,7 @@ function useTransformImage({ */ + const ImageEditingContext = (0,external_wp_element_namespaceObject.createContext)({}); const useImageEditingContext = () => (0,external_wp_element_namespaceObject.useContext)(ImageEditingContext); function ImageEditingProvider({ @@ -56209,239 +61134,513 @@ function ImageEditingProvider({ ...transformImage, ...saveImage }), [transformImage, saveImage]); - return (0,external_React_.createElement)(ImageEditingContext.Provider, { - value: providerValue - }, children); -} - -;// CONCATENATED MODULE: ./node_modules/react-easy-crop/node_modules/tslib/tslib.es6.js -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global Reflect, Promise */ - -var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); -}; - -function __extends(d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -} - -var __assign = function() { - __assign = Object.assign || function __assign(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - } - return __assign.apply(this, arguments); -} - -function __rest(s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; -} - -function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -} - -function __param(paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } -} - -function __metadata(metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); -} - -function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -} - -function __generator(thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -} - -var __createBinding = Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -}); - -function __exportStar(m, o) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); -} - -function __values(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -} - -function __read(o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -} - -function __spread() { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; -} - -function __spreadArrays() { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; -}; - -function __await(v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); -} - -function __asyncGenerator(thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } -} - -function __asyncDelegator(o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } -} - -function __asyncValues(o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } -} - -function __makeTemplateObject(cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; -}; - -var __setModuleDefault = Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}; - -function __importStar(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -} - -function __importDefault(mod) { - return (mod && mod.__esModule) ? mod : { default: mod }; -} - -function __classPrivateFieldGet(receiver, privateMap) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to get private field on non-instance"); - } - return privateMap.get(receiver); -} - -function __classPrivateFieldSet(receiver, privateMap, value) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to set private field on non-instance"); - } - privateMap.set(receiver, value); - return value; -} + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ImageEditingContext.Provider, { + value: providerValue, + children: children + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/aspect-ratio-dropdown.js +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + + + + +function AspectRatioGroup({ + aspectRatios, + isDisabled, + label, + onClick, + value +}) { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { + label: label, + children: aspectRatios.map(({ + name, + slug, + ratio + }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { + disabled: isDisabled, + onClick: () => { + onClick(ratio); + }, + role: "menuitemradio", + isSelected: ratio === value, + icon: ratio === value ? library_check : undefined, + children: name + }, slug)) + }); +} +function ratioToNumber(str) { + // TODO: support two-value aspect ratio? + // https://css-tricks.com/almanac/properties/a/aspect-ratio/#aa-it-can-take-two-values + const [a, b, ...rest] = str.split('/').map(Number); + if (a <= 0 || b <= 0 || Number.isNaN(a) || Number.isNaN(b) || rest.length) { + return NaN; + } + return b ? a / b : a; +} +function presetRatioAsNumber({ + ratio, + ...rest +}) { + return { + ratio: ratioToNumber(ratio), + ...rest + }; +} +function AspectRatioDropdown({ + toggleProps +}) { + const { + isInProgress, + aspect, + setAspect, + defaultAspect + } = useImageEditingContext(); + const [defaultRatios, themeRatios, showDefaultRatios] = use_settings_useSettings('dimensions.aspectRatios.default', 'dimensions.aspectRatios.theme', 'dimensions.defaultAspectRatios'); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { + icon: aspect_ratio, + label: (0,external_wp_i18n_namespaceObject.__)('Aspect Ratio'), + popoverProps: constants_POPOVER_PROPS, + toggleProps: toggleProps, + children: ({ + onClose + }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AspectRatioGroup, { + isDisabled: isInProgress, + onClick: newAspect => { + setAspect(newAspect); + onClose(); + }, + value: aspect, + aspectRatios: [ + // All ratios should be mirrored in AspectRatioTool in @wordpress/block-editor. + { + slug: 'original', + name: (0,external_wp_i18n_namespaceObject.__)('Original'), + aspect: defaultAspect + }, ...(showDefaultRatios ? defaultRatios.map(presetRatioAsNumber).filter(({ + ratio + }) => ratio === 1) : [])] + }), themeRatios?.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AspectRatioGroup, { + label: (0,external_wp_i18n_namespaceObject.__)('Theme'), + isDisabled: isInProgress, + onClick: newAspect => { + setAspect(newAspect); + onClose(); + }, + value: aspect, + aspectRatios: themeRatios + }), showDefaultRatios && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AspectRatioGroup, { + label: (0,external_wp_i18n_namespaceObject.__)('Landscape'), + isDisabled: isInProgress, + onClick: newAspect => { + setAspect(newAspect); + onClose(); + }, + value: aspect, + aspectRatios: defaultRatios.map(presetRatioAsNumber).filter(({ + ratio + }) => ratio > 1) + }), showDefaultRatios && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AspectRatioGroup, { + label: (0,external_wp_i18n_namespaceObject.__)('Portrait'), + isDisabled: isInProgress, + onClick: newAspect => { + setAspect(newAspect); + onClose(); + }, + value: aspect, + aspectRatios: defaultRatios.map(presetRatioAsNumber).filter(({ + ratio + }) => ratio < 1) + })] + }) + }); +} + +;// CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.mjs +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global Reflect, Promise, SuppressedError, Symbol */ + +var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); +}; + +function __extends(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} + +var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + } + return __assign.apply(this, arguments); +} + +function __rest(s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +} + +function __decorate(decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +} + +function __param(paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +} + +function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _, done = false; + for (var i = decorators.length - 1; i >= 0; i--) { + var context = {}; + for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; + for (var p in contextIn.access) context.access[p] = contextIn.access[p]; + context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; + var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if (_ = accept(result.get)) descriptor.get = _; + if (_ = accept(result.set)) descriptor.set = _; + if (_ = accept(result.init)) initializers.unshift(_); + } + else if (_ = accept(result)) { + if (kind === "field") initializers.unshift(_); + else descriptor[key] = _; + } + } + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; +}; + +function __runInitializers(thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; +}; + +function __propKey(x) { + return typeof x === "symbol" ? x : "".concat(x); +}; + +function __setFunctionName(f, name, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); +}; + +function __metadata(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); +} + +function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} + +function __generator(thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +} + +var __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +}); + +function __exportStar(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); +} + +function __values(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +} + +function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +} + +/** @deprecated */ +function __spread() { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; +} + +/** @deprecated */ +function __spreadArrays() { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; +} + +function __spreadArray(to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +} + +function __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); +} + +function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } +} + +function __asyncDelegator(o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } +} + +function __asyncValues(o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } +} + +function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; +}; + +var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}; + +function __importStar(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +} + +function __importDefault(mod) { + return (mod && mod.__esModule) ? mod : { default: mod }; +} + +function __classPrivateFieldGet(receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +} + +function __classPrivateFieldSet(receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +} + +function __classPrivateFieldIn(state, receiver) { + if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); + return typeof state === "function" ? receiver === state : state.has(receiver); +} + +function __addDisposableResource(env, value, async) { + if (value !== null && value !== void 0) { + if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); + var dispose; + if (async) { + if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); + dispose = value[Symbol.asyncDispose]; + } + if (dispose === void 0) { + if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); + dispose = value[Symbol.dispose]; + } + if (typeof dispose !== "function") throw new TypeError("Object not disposable."); + env.stack.push({ value: value, dispose: dispose, async: async }); + } + else if (async) { + env.stack.push({ async: true }); + } + return value; +} + +var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; +}; + +function __disposeResources(env) { + function fail(e) { + env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; + env.hasError = true; + } + function next() { + while (env.stack.length) { + var rec = env.stack.pop(); + try { + var result = rec.dispose && rec.dispose.call(rec.value); + if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); + } + catch (e) { + fail(e); + } + } + if (env.hasError) throw env.error; + } + return next(); +} + +/* harmony default export */ const tslib_es6 = ({ + __extends, + __assign, + __rest, + __decorate, + __param, + __metadata, + __awaiter, + __generator, + __createBinding, + __exportStar, + __values, + __read, + __spread, + __spreadArrays, + __spreadArray, + __await, + __asyncGenerator, + __asyncDelegator, + __asyncValues, + __makeTemplateObject, + __importStar, + __importDefault, + __classPrivateFieldGet, + __classPrivateFieldSet, + __classPrivateFieldIn, + __addDisposableResource, + __disposeResources, +}); // EXTERNAL MODULE: ./node_modules/normalize-wheel/index.js var normalize_wheel = __webpack_require__(7520); @@ -56653,14 +61852,18 @@ function classNames() { var css_248z = ".reactEasyCrop_Container {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n overflow: hidden;\n user-select: none;\n touch-action: none;\n cursor: move;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.reactEasyCrop_Image,\n.reactEasyCrop_Video {\n will-change: transform; /* this improves performances and prevent painting issues on iOS Chrome */\n}\n\n.reactEasyCrop_Contain {\n max-width: 100%;\n max-height: 100%;\n margin: auto;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n}\n.reactEasyCrop_Cover_Horizontal {\n width: 100%;\n height: auto;\n}\n.reactEasyCrop_Cover_Vertical {\n width: auto;\n height: 100%;\n}\n\n.reactEasyCrop_CropArea {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n border: 1px solid rgba(255, 255, 255, 0.5);\n box-sizing: border-box;\n box-shadow: 0 0 0 9999em;\n color: rgba(0, 0, 0, 0.5);\n overflow: hidden;\n}\n\n.reactEasyCrop_CropAreaRound {\n border-radius: 50%;\n}\n\n.reactEasyCrop_CropAreaGrid::before {\n content: ' ';\n box-sizing: border-box;\n position: absolute;\n border: 1px solid rgba(255, 255, 255, 0.5);\n top: 0;\n bottom: 0;\n left: 33.33%;\n right: 33.33%;\n border-top: 0;\n border-bottom: 0;\n}\n\n.reactEasyCrop_CropAreaGrid::after {\n content: ' ';\n box-sizing: border-box;\n position: absolute;\n border: 1px solid rgba(255, 255, 255, 0.5);\n top: 33.33%;\n bottom: 33.33%;\n left: 0;\n right: 0;\n border-left: 0;\n border-right: 0;\n}\n"; -var MIN_ZOOM = 1; -var MAX_ZOOM = 3; +var index_module_MIN_ZOOM = 1; +var index_module_MAX_ZOOM = 3; var Cropper = /** @class */function (_super) { __extends(Cropper, _super); function Cropper() { var _this = _super !== null && _super.apply(this, arguments) || this; - _this.imageRef = external_React_default().createRef(); - _this.videoRef = external_React_default().createRef(); + _this.imageRef = external_React_.createRef(); + _this.videoRef = external_React_.createRef(); + _this.containerPosition = { + x: 0, + y: 0 + }; _this.containerRef = null; _this.styleRef = null; _this.containerRect = null; @@ -56691,7 +61894,8 @@ var Cropper = /** @class */function (_super) { _this.resizeObserver = null; _this.state = { cropSize: null, - hasWheelJustStarted: false + hasWheelJustStarted: false, + mediaObjectFit: undefined }; _this.initResizeObserver = function () { if (typeof window.ResizeObserver === 'undefined' || !_this.containerRef) { @@ -56719,6 +61923,7 @@ var Cropper = /** @class */function (_super) { _this.currentDoc.removeEventListener('touchend', _this.onDragStopped); _this.currentDoc.removeEventListener('gesturemove', _this.onGestureMove); _this.currentDoc.removeEventListener('gestureend', _this.onGestureEnd); + _this.currentDoc.removeEventListener('scroll', _this.onScroll); }; _this.clearScrollEvent = function () { if (_this.containerRef) _this.containerRef.removeEventListener('wheel', _this.onWheel); @@ -56756,6 +61961,7 @@ var Cropper = /** @class */function (_super) { var mediaRef = _this.imageRef.current || _this.videoRef.current; if (mediaRef && _this.containerRef) { _this.containerRect = _this.containerRef.getBoundingClientRect(); + _this.saveContainerPosition(); var containerAspect = _this.containerRect.width / _this.containerRect.height; var naturalWidth = ((_a = _this.imageRef.current) === null || _a === void 0 ? void 0 : _a.naturalWidth) || ((_b = _this.videoRef.current) === null || _b === void 0 ? void 0 : _b.videoWidth) || 0; var naturalHeight = ((_c = _this.imageRef.current) === null || _c === void 0 ? void 0 : _c.naturalHeight) || ((_d = _this.videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) || 0; @@ -56769,7 +61975,7 @@ var Cropper = /** @class */function (_super) { // However, for this to work, the container should not be rotated var renderedMediaSize = void 0; if (isMediaScaledDown) { - switch (_this.props.objectFit) { + switch (_this.state.mediaObjectFit) { default: case 'contain': renderedMediaSize = containerAspect > mediaAspect ? { @@ -56792,15 +61998,6 @@ var Cropper = /** @class */function (_super) { height: _this.containerRect.height }; break; - case 'auto-cover': - renderedMediaSize = naturalWidth > naturalHeight ? { - width: _this.containerRect.width, - height: _this.containerRect.width / mediaAspect - } : { - width: _this.containerRect.height * mediaAspect, - height: _this.containerRect.height - }; - break; } } else { renderedMediaSize = { @@ -56830,16 +62027,31 @@ var Cropper = /** @class */function (_super) { return cropSize; } }; + _this.saveContainerPosition = function () { + if (_this.containerRef) { + var bounds = _this.containerRef.getBoundingClientRect(); + _this.containerPosition = { + x: bounds.left, + y: bounds.top + }; + } + }; _this.onMouseDown = function (e) { if (!_this.currentDoc) return; e.preventDefault(); _this.currentDoc.addEventListener('mousemove', _this.onMouseMove); _this.currentDoc.addEventListener('mouseup', _this.onDragStopped); + _this.saveContainerPosition(); _this.onDragStart(Cropper.getMousePoint(e)); }; _this.onMouseMove = function (e) { return _this.onDrag(Cropper.getMousePoint(e)); }; + _this.onScroll = function (e) { + if (!_this.currentDoc) return; + e.preventDefault(); + _this.saveContainerPosition(); + }; _this.onTouchStart = function (e) { if (!_this.currentDoc) return; _this.isTouching = true; @@ -56850,6 +62062,7 @@ var Cropper = /** @class */function (_super) { passive: false }); // iOS 11 now defaults to passive: true _this.currentDoc.addEventListener('touchend', _this.onDragStopped); + _this.saveContainerPosition(); if (e.touches.length === 2) { _this.onPinchStart(e); } else if (e.touches.length === 1) { @@ -56960,15 +62173,15 @@ var Cropper = /** @class */function (_super) { }); }, 250); }; - _this.getPointOnContainer = function (_a) { + _this.getPointOnContainer = function (_a, containerTopLeft) { var x = _a.x, y = _a.y; if (!_this.containerRect) { throw new Error('The Cropper is not mounted'); } return { - x: _this.containerRect.width / 2 - (x - _this.containerRect.left), - y: _this.containerRect.height / 2 - (y - _this.containerRect.top) + x: _this.containerRect.width / 2 - (x - containerTopLeft.x), + y: _this.containerRect.height / 2 - (y - containerTopLeft.y) }; }; _this.getPointOnMedia = function (_a) { @@ -56989,7 +62202,7 @@ var Cropper = /** @class */function (_super) { if (!_this.state.cropSize || !_this.props.onZoomChange) return; var newZoom = clamp(zoom, _this.props.minZoom, _this.props.maxZoom); if (shouldUpdatePosition) { - var zoomPoint = _this.getPointOnContainer(point); + var zoomPoint = _this.getPointOnContainer(point, _this.containerPosition); var zoomTarget = _this.getPointOnMedia(zoomPoint); var requestedPosition = { x: zoomTarget.x * newZoom - zoomPoint.x, @@ -57056,6 +62269,7 @@ var Cropper = /** @class */function (_super) { }); this.containerRef.addEventListener('gesturestart', this.onGestureStart); } + this.currentDoc.addEventListener('scroll', this.onScroll); if (!this.props.disableAutomaticStylesInjection) { this.styleRef = this.currentDoc.createElement('style'); this.styleRef.setAttribute('type', 'text/css'); @@ -57100,6 +62314,8 @@ var Cropper = /** @class */function (_super) { this.recomputeCropPosition(); } else if (prevProps.aspect !== this.props.aspect) { this.computeSizes(); + } else if (prevProps.objectFit !== this.props.objectFit) { + this.computeSizes(); } else if (prevProps.zoom !== this.props.zoom) { this.recomputeCropPosition(); } else if (((_a = prevProps.cropSize) === null || _a === void 0 ? void 0 : _a.height) !== ((_b = this.props.cropSize) === null || _b === void 0 ? void 0 : _b.height) || ((_c = prevProps.cropSize) === null || _c === void 0 ? void 0 : _c.width) !== ((_d = this.props.cropSize) === null || _d === void 0 ? void 0 : _d.width)) { @@ -57115,6 +62331,12 @@ var Cropper = /** @class */function (_super) { if (prevProps.video !== this.props.video) { (_j = this.videoRef.current) === null || _j === void 0 ? void 0 : _j.load(); } + var objectFit = this.getObjectFit(); + if (objectFit !== this.state.mediaObjectFit) { + this.setState({ + mediaObjectFit: objectFit + }, this.computeSizes); + } }; Cropper.prototype.getAspect = function () { var _a = this.props, @@ -57125,6 +62347,22 @@ var Cropper = /** @class */function (_super) { } return aspect; }; + Cropper.prototype.getObjectFit = function () { + var _a, _b, _c, _d; + if (this.props.objectFit === 'cover') { + var mediaRef = this.imageRef.current || this.videoRef.current; + if (mediaRef && this.containerRef) { + this.containerRect = this.containerRef.getBoundingClientRect(); + var containerAspect = this.containerRect.width / this.containerRect.height; + var naturalWidth = ((_a = this.imageRef.current) === null || _a === void 0 ? void 0 : _a.naturalWidth) || ((_b = this.videoRef.current) === null || _b === void 0 ? void 0 : _b.videoWidth) || 0; + var naturalHeight = ((_c = this.imageRef.current) === null || _c === void 0 ? void 0 : _c.naturalHeight) || ((_d = this.videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) || 0; + var mediaAspect = naturalWidth / naturalHeight; + return mediaAspect < containerAspect ? 'horizontal-cover' : 'vertical-cover'; + } + return 'horizontal-cover'; + } + return this.props.objectFit; + }; Cropper.prototype.onPinchStart = function (e) { var pointA = Cropper.getTouchPoint(e.touches[0]); var pointB = Cropper.getTouchPoint(e.touches[1]); @@ -57174,9 +62412,9 @@ var Cropper = /** @class */function (_super) { _d = _a.classes, containerClassName = _d.containerClassName, cropAreaClassName = _d.cropAreaClassName, - mediaClassName = _d.mediaClassName, - objectFit = _a.objectFit; - return external_React_default().createElement("div", { + mediaClassName = _d.mediaClassName; + var objectFit = this.state.mediaObjectFit; + return external_React_.createElement("div", { onMouseDown: this.onMouseDown, onTouchStart: this.onTouchStart, ref: function ref(el) { @@ -57185,9 +62423,9 @@ var Cropper = /** @class */function (_super) { "data-testid": "container", style: containerStyle, className: classNames('reactEasyCrop_Container', containerClassName) - }, image ? external_React_default().createElement("img", __assign({ + }, image ? external_React_.createElement("img", __assign({ alt: "", - className: classNames('reactEasyCrop_Image', objectFit === 'contain' && 'reactEasyCrop_Contain', objectFit === 'horizontal-cover' && 'reactEasyCrop_Cover_Horizontal', objectFit === 'vertical-cover' && 'reactEasyCrop_Cover_Vertical', objectFit === 'auto-cover' && (this.mediaSize.naturalWidth > this.mediaSize.naturalHeight ? 'reactEasyCrop_Cover_Horizontal' : 'reactEasyCrop_Cover_Vertical'), mediaClassName) + className: classNames('reactEasyCrop_Image', objectFit === 'contain' && 'reactEasyCrop_Contain', objectFit === 'horizontal-cover' && 'reactEasyCrop_Cover_Horizontal', objectFit === 'vertical-cover' && 'reactEasyCrop_Cover_Vertical', mediaClassName) }, mediaProps, { src: image, ref: this.imageRef, @@ -57195,11 +62433,11 @@ var Cropper = /** @class */function (_super) { transform: transform || "translate(".concat(x, "px, ").concat(y, "px) rotate(").concat(rotation, "deg) scale(").concat(zoom, ")") }), onLoad: this.onMediaLoad - })) : video && external_React_default().createElement("video", __assign({ + })) : video && external_React_.createElement("video", __assign({ autoPlay: true, loop: true, muted: true, - className: classNames('reactEasyCrop_Video', objectFit === 'contain' && 'reactEasyCrop_Contain', objectFit === 'horizontal-cover' && 'reactEasyCrop_Cover_Horizontal', objectFit === 'vertical-cover' && 'reactEasyCrop_Cover_Vertical', objectFit === 'auto-cover' && (this.mediaSize.naturalWidth > this.mediaSize.naturalHeight ? 'reactEasyCrop_Cover_Horizontal' : 'reactEasyCrop_Cover_Vertical'), mediaClassName) + className: classNames('reactEasyCrop_Video', objectFit === 'contain' && 'reactEasyCrop_Contain', objectFit === 'horizontal-cover' && 'reactEasyCrop_Cover_Horizontal', objectFit === 'vertical-cover' && 'reactEasyCrop_Cover_Vertical', mediaClassName) }, mediaProps, { ref: this.videoRef, onLoadedMetadata: this.onMediaLoad, @@ -57210,10 +62448,10 @@ var Cropper = /** @class */function (_super) { }), (Array.isArray(video) ? video : [{ src: video }]).map(function (item) { - return external_React_default().createElement("source", __assign({ + return external_React_.createElement("source", __assign({ key: item.src }, item)); - })), this.state.cropSize && external_React_default().createElement("div", { + })), this.state.cropSize && external_React_.createElement("div", { style: __assign(__assign({}, cropAreaStyle), { width: this.state.cropSize.width, height: this.state.cropSize.height @@ -57226,8 +62464,8 @@ var Cropper = /** @class */function (_super) { zoom: 1, rotation: 0, aspect: 4 / 3, - maxZoom: MAX_ZOOM, - minZoom: MIN_ZOOM, + maxZoom: index_module_MAX_ZOOM, + minZoom: index_module_MIN_ZOOM, cropShape: 'rect', objectFit: 'contain', showGrid: true, @@ -57251,19 +62489,11 @@ var Cropper = /** @class */function (_super) { }; }; return Cropper; -}((external_React_default()).Component); +}(external_React_.Component); -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/constants.js -const constants_MIN_ZOOM = 100; -const constants_MAX_ZOOM = 300; -const constants_POPOVER_PROPS = { - placement: 'bottom-start' -}; - ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/cropper.js - /** * External dependencies */ @@ -57275,16 +62505,19 @@ const constants_POPOVER_PROPS = { */ + /** * Internal dependencies */ + + + function ImageCropper({ url, width, height, - clientWidth, naturalHeight, naturalWidth, borderProps @@ -57300,55 +62533,62 @@ function ImageCropper({ setZoom, rotation } = useImageEditingContext(); + const [contentResizeListener, { + width: clientWidth + }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); let editedHeight = height || clientWidth * naturalHeight / naturalWidth; if (rotation % 180 === 90) { editedHeight = clientWidth * naturalWidth / naturalHeight; } - return (0,external_React_.createElement)("div", { - className: classnames_default()('wp-block-image__crop-area', borderProps?.className, { + const area = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: dist_clsx('wp-block-image__crop-area', borderProps?.className, { 'is-applying': isInProgress }), style: { ...borderProps?.style, width: width || clientWidth, height: editedHeight - } - }, (0,external_React_.createElement)(Cropper, { - image: editedUrl || url, - disabled: isInProgress, - minZoom: constants_MIN_ZOOM / 100, - maxZoom: constants_MAX_ZOOM / 100, - crop: position, - zoom: zoom / 100, - aspect: aspect, - onCropChange: pos => { - setPosition(pos); }, - onCropComplete: newCropPercent => { - setCrop(newCropPercent); - }, - onZoomChange: newZoom => { - setZoom(newZoom * 100); - } - }), isInProgress && (0,external_React_.createElement)(external_wp_components_namespaceObject.Spinner, null)); + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Cropper, { + image: editedUrl || url, + disabled: isInProgress, + minZoom: MIN_ZOOM / 100, + maxZoom: MAX_ZOOM / 100, + crop: position, + zoom: zoom / 100, + aspect: aspect, + onCropChange: pos => { + setPosition(pos); + }, + onCropComplete: newCropPercent => { + setCrop(newCropPercent); + }, + onZoomChange: newZoom => { + setZoom(newZoom * 100); + } + }), isInProgress && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {})] + }); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [contentResizeListener, area] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/search.js - /** * WordPress dependencies */ -const search = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const search = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z" + }) +}); /* harmony default export */ const library_search = (search); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/zoom-dropdown.js - /** * WordPress dependencies */ @@ -57361,175 +62601,53 @@ const search = (0,external_React_.createElement)(external_wp_primitives_namespac */ + function ZoomDropdown() { const { isInProgress, zoom, setZoom } = useImageEditingContext(); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Dropdown, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { contentClassName: "wp-block-image__zoom", popoverProps: constants_POPOVER_PROPS, renderToggle: ({ isOpen, onToggle - }) => (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, { + }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { icon: library_search, label: (0,external_wp_i18n_namespaceObject.__)('Zoom'), onClick: onToggle, "aria-expanded": isOpen, disabled: isInProgress }), - renderContent: () => (0,external_React_.createElement)(external_wp_components_namespaceObject.RangeControl, { + renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Zoom'), - min: constants_MIN_ZOOM, - max: constants_MAX_ZOOM, + min: MIN_ZOOM, + max: MAX_ZOOM, value: Math.round(zoom), onChange: setZoom }) }); } -;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/aspect-ratio.js - -/** - * WordPress dependencies - */ - -const aspectRatio = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M18.5 5.5h-13c-1.1 0-2 .9-2 2v9c0 1.1.9 2 2 2h13c1.1 0 2-.9 2-2v-9c0-1.1-.9-2-2-2zm.5 11c0 .3-.2.5-.5.5h-13c-.3 0-.5-.2-.5-.5v-9c0-.3.2-.5.5-.5h13c.3 0 .5.2.5.5v9zM6.5 12H8v-2h2V8.5H6.5V12zm9.5 2h-2v1.5h3.5V12H16v2z" -})); -/* harmony default export */ const aspect_ratio = (aspectRatio); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/aspect-ratio-dropdown.js - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - -function AspectGroup({ - aspectRatios, - isDisabled, - label, - onClick, - value -}) { - return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, { - label: label - }, aspectRatios.map(({ - title, - aspect - }) => (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { - key: aspect, - disabled: isDisabled, - onClick: () => { - onClick(aspect); - }, - role: "menuitemradio", - isSelected: aspect === value, - icon: aspect === value ? library_check : undefined - }, title))); -} -function AspectRatioDropdown({ - toggleProps -}) { - const { - isInProgress, - aspect, - setAspect, - defaultAspect - } = useImageEditingContext(); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.DropdownMenu, { - icon: aspect_ratio, - label: (0,external_wp_i18n_namespaceObject.__)('Aspect Ratio'), - popoverProps: constants_POPOVER_PROPS, - toggleProps: toggleProps, - className: "wp-block-image__aspect-ratio" - }, ({ - onClose - }) => (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(AspectGroup, { - isDisabled: isInProgress, - onClick: newAspect => { - setAspect(newAspect); - onClose(); - }, - value: aspect, - aspectRatios: [ - // All ratios should be mirrored in AspectRatioTool in @wordpress/block-editor. - { - title: (0,external_wp_i18n_namespaceObject.__)('Original'), - aspect: defaultAspect - }, { - title: (0,external_wp_i18n_namespaceObject.__)('Square'), - aspect: 1 - }] - }), (0,external_React_.createElement)(AspectGroup, { - label: (0,external_wp_i18n_namespaceObject.__)('Landscape'), - isDisabled: isInProgress, - onClick: newAspect => { - setAspect(newAspect); - onClose(); - }, - value: aspect, - aspectRatios: [{ - title: (0,external_wp_i18n_namespaceObject.__)('16:9'), - aspect: 16 / 9 - }, { - title: (0,external_wp_i18n_namespaceObject.__)('4:3'), - aspect: 4 / 3 - }, { - title: (0,external_wp_i18n_namespaceObject.__)('3:2'), - aspect: 3 / 2 - }] - }), (0,external_React_.createElement)(AspectGroup, { - label: (0,external_wp_i18n_namespaceObject.__)('Portrait'), - isDisabled: isInProgress, - onClick: newAspect => { - setAspect(newAspect); - onClose(); - }, - value: aspect, - aspectRatios: [{ - title: (0,external_wp_i18n_namespaceObject.__)('9:16'), - aspect: 9 / 16 - }, { - title: (0,external_wp_i18n_namespaceObject.__)('3:4'), - aspect: 3 / 4 - }, { - title: (0,external_wp_i18n_namespaceObject.__)('2:3'), - aspect: 2 / 3 - }] - }))); -} - ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/rotate-right.js - /** * WordPress dependencies */ -const rotateRight = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const rotateRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M15.1 4.8l-3-2.5V4c-4.4 0-8 3.6-8 8 0 3.7 2.5 6.9 6 7.7.3.1.6.1 1 .2l.2-1.5c-.4 0-.7-.1-1.1-.2l-.1.2v-.2c-2.6-.8-4.5-3.3-4.5-6.2 0-3.6 2.9-6.5 6.5-6.5v1.8l3-2.5zM20 11c-.2-1.4-.7-2.7-1.6-3.8l-1.2.8c.7.9 1.1 2 1.3 3.1L20 11zm-1.5 1.8c-.1.5-.2 1.1-.4 1.6s-.5 1-.8 1.5l1.2.9c.4-.5.8-1.1 1-1.8s.5-1.3.5-2l-1.5-.2zm-5.6 5.6l.2 1.5c1.4-.2 2.7-.7 3.8-1.6l-.9-1.1c-.9.7-2 1.1-3.1 1.2z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M15.1 4.8l-3-2.5V4c-4.4 0-8 3.6-8 8 0 3.7 2.5 6.9 6 7.7.3.1.6.1 1 .2l.2-1.5c-.4 0-.7-.1-1.1-.2l-.1.2v-.2c-2.6-.8-4.5-3.3-4.5-6.2 0-3.6 2.9-6.5 6.5-6.5v1.8l3-2.5zM20 11c-.2-1.4-.7-2.7-1.6-3.8l-1.2.8c.7.9 1.1 2 1.3 3.1L20 11zm-1.5 1.8c-.1.5-.2 1.1-.4 1.6s-.5 1-.8 1.5l1.2.9c.4-.5.8-1.1 1-1.8s.5-1.3.5-2l-1.5-.2zm-5.6 5.6l.2 1.5c1.4-.2 2.7-.7 3.8-1.6l-.9-1.1c-.9.7-2 1.1-3.1 1.2z" + }) +}); /* harmony default export */ const rotate_right = (rotateRight); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/rotation-button.js - /** * WordPress dependencies */ @@ -57542,12 +62660,13 @@ const rotateRight = (0,external_React_.createElement)(external_wp_primitives_nam * Internal dependencies */ + function RotationButton() { const { isInProgress, rotateClockwise } = useImageEditingContext(); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { icon: rotate_right, label: (0,external_wp_i18n_namespaceObject.__)('Rotate'), onClick: rotateClockwise, @@ -57556,7 +62675,6 @@ function RotationButton() { } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/form-controls.js - /** * WordPress dependencies */ @@ -57567,22 +62685,28 @@ function RotationButton() { * Internal dependencies */ + + + function FormControls() { const { isInProgress, apply, cancel } = useImageEditingContext(); - return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, { - onClick: apply, - disabled: isInProgress - }, (0,external_wp_i18n_namespaceObject.__)('Apply')), (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, { - onClick: cancel - }, (0,external_wp_i18n_namespaceObject.__)('Cancel'))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { + onClick: apply, + disabled: isInProgress, + children: (0,external_wp_i18n_namespaceObject.__)('Apply') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { + onClick: cancel, + children: (0,external_wp_i18n_namespaceObject.__)('Cancel') + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/index.js - /** * WordPress dependencies */ @@ -57598,36 +62722,45 @@ function FormControls() { + + function ImageEditor({ id, url, width, height, - clientWidth, naturalHeight, naturalWidth, onSaveImage, onFinishEditing, borderProps }) { - return (0,external_React_.createElement)(ImageEditingProvider, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ImageEditingProvider, { id: id, url: url, naturalWidth: naturalWidth, naturalHeight: naturalHeight, onSaveImage: onSaveImage, - onFinishEditing: onFinishEditing - }, (0,external_React_.createElement)(ImageCropper, { - borderProps: borderProps, - url: url, - width: width, - height: height, - clientWidth: clientWidth, - naturalHeight: naturalHeight, - naturalWidth: naturalWidth - }), (0,external_React_.createElement)(block_controls, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_.createElement)(ZoomDropdown, null), (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarItem, null, toggleProps => (0,external_React_.createElement)(AspectRatioDropdown, { - toggleProps: toggleProps - })), (0,external_React_.createElement)(RotationButton, null)), (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_.createElement)(FormControls, null)))); + onFinishEditing: onFinishEditing, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ImageCropper, { + borderProps: borderProps, + url: url, + width: width, + height: height, + naturalHeight: naturalHeight, + naturalWidth: naturalWidth + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(block_controls, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ToolbarGroup, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ZoomDropdown, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { + children: toggleProps => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AspectRatioDropdown, { + toggleProps: toggleProps + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RotationButton, {})] + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FormControls, {}) + })] + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-size-control/use-dimension-handler.js @@ -57690,7 +62823,6 @@ function useDimensionHandler(customHeight, customWidth, defaultHeight, defaultWi } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-size-control/index.js - /** * WordPress dependencies */ @@ -57701,6 +62833,9 @@ function useDimensionHandler(customHeight, customWidth, defaultHeight, defaultWi * Internal dependencies */ + + + const IMAGE_SIZE_PRESETS = [25, 50, 75, 100]; const image_size_control_noop = () => {}; function ImageSizeControl({ @@ -57721,54 +62856,61 @@ function ImageSizeControl({ updateDimension, updateDimensions } = useDimensionHandler(height, width, imageHeight, imageWidth, onChange); - return (0,external_React_.createElement)(external_React_.Fragment, null, imageSizeOptions && imageSizeOptions.length > 0 && (0,external_React_.createElement)(external_wp_components_namespaceObject.SelectControl, { - __nextHasNoMarginBottom: true, - label: (0,external_wp_i18n_namespaceObject.__)('Resolution'), - value: slug, - options: imageSizeOptions, - onChange: onChangeImage, - help: imageSizeHelp, - size: "__unstable-large" - }), isResizable && (0,external_React_.createElement)("div", { - className: "block-editor-image-size-control" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { - align: "baseline", - spacing: "3" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNumberControl, { - className: "block-editor-image-size-control__width", - label: (0,external_wp_i18n_namespaceObject.__)('Width'), - value: currentWidth, - min: 1, - onChange: value => updateDimension('width', value), - size: "__unstable-large" - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNumberControl, { - className: "block-editor-image-size-control__height", - label: (0,external_wp_i18n_namespaceObject.__)('Height'), - value: currentHeight, - min: 1, - onChange: value => updateDimension('height', value), - size: "__unstable-large" - })), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.ButtonGroup, { - "aria-label": (0,external_wp_i18n_namespaceObject.__)('Image size presets') - }, IMAGE_SIZE_PRESETS.map(scale => { - const scaledWidth = Math.round(imageWidth * (scale / 100)); - const scaledHeight = Math.round(imageHeight * (scale / 100)); - const isCurrent = currentWidth === scaledWidth && currentHeight === scaledHeight; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - key: scale, - size: "small", - variant: isCurrent ? 'primary' : undefined, - isPressed: isCurrent, - onClick: () => updateDimensions(scaledHeight, scaledWidth) - }, scale, "%"); - })), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - size: "small", - onClick: () => updateDimensions() - }, (0,external_wp_i18n_namespaceObject.__)('Reset'))))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [imageSizeOptions && imageSizeOptions.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { + __nextHasNoMarginBottom: true, + label: (0,external_wp_i18n_namespaceObject.__)('Resolution'), + value: slug, + options: imageSizeOptions, + onChange: onChangeImage, + help: imageSizeHelp, + size: "__unstable-large" + }), isResizable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-image-size-control", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { + align: "baseline", + spacing: "3", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, { + className: "block-editor-image-size-control__width", + label: (0,external_wp_i18n_namespaceObject.__)('Width'), + value: currentWidth, + min: 1, + onChange: value => updateDimension('width', value), + size: "__unstable-large" + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, { + className: "block-editor-image-size-control__height", + label: (0,external_wp_i18n_namespaceObject.__)('Height'), + value: currentHeight, + min: 1, + onChange: value => updateDimension('height', value), + size: "__unstable-large" + })] + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ButtonGroup, { + "aria-label": (0,external_wp_i18n_namespaceObject.__)('Image size presets'), + children: IMAGE_SIZE_PRESETS.map(scale => { + const scaledWidth = Math.round(imageWidth * (scale / 100)); + const scaledHeight = Math.round(imageHeight * (scale / 100)); + const isCurrent = currentWidth === scaledWidth && currentHeight === scaledHeight; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Button, { + size: "small", + variant: isCurrent ? 'primary' : undefined, + isPressed: isCurrent, + onClick: () => updateDimensions(scaledHeight, scaledWidth), + children: [scale, "%"] + }, scale); + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + size: "small", + onClick: () => updateDimensions(), + children: (0,external_wp_i18n_namespaceObject.__)('Reset') + })] + })] + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-popover/link-viewer-url.js - /** * External dependencies */ @@ -57779,25 +62921,26 @@ function ImageSizeControl({ */ + function LinkViewerURL({ url, urlLabel, className }) { - const linkClassName = classnames_default()(className, 'block-editor-url-popover__link-viewer-url'); + const linkClassName = dist_clsx(className, 'block-editor-url-popover__link-viewer-url'); if (!url) { - return (0,external_React_.createElement)("span", { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: linkClassName }); } - return (0,external_React_.createElement)(external_wp_components_namespaceObject.ExternalLink, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { className: linkClassName, - href: url - }, urlLabel || (0,external_wp_url_namespaceObject.filterURLForDisplay)((0,external_wp_url_namespaceObject.safeDecodeURI)(url))); + href: url, + children: urlLabel || (0,external_wp_url_namespaceObject.filterURLForDisplay)((0,external_wp_url_namespaceObject.safeDecodeURI)(url)) + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-popover/link-viewer.js - /** * External dependencies */ @@ -57814,6 +62957,8 @@ function LinkViewerURL({ * Internal dependencies */ + + function LinkViewer({ className, linkClassName, @@ -57822,23 +62967,23 @@ function LinkViewer({ urlLabel, ...props }) { - return (0,external_React_.createElement)("div", { - className: classnames_default()('block-editor-url-popover__link-viewer', className), - ...props - }, (0,external_React_.createElement)(LinkViewerURL, { - url: url, - urlLabel: urlLabel, - className: linkClassName - }), onEditLinkClick && (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - icon: edit, - label: (0,external_wp_i18n_namespaceObject.__)('Edit'), - onClick: onEditLinkClick, - size: "compact" - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: dist_clsx('block-editor-url-popover__link-viewer', className), + ...props, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LinkViewerURL, { + url: url, + urlLabel: urlLabel, + className: linkClassName + }), onEditLinkClick && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + icon: edit, + label: (0,external_wp_i18n_namespaceObject.__)('Edit'), + onClick: onEditLinkClick, + size: "compact" + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-popover/link-editor.js - /** * External dependencies */ @@ -57855,6 +63000,8 @@ function LinkViewer({ * Internal dependencies */ + + function LinkEditor({ autocompleteRef, className, @@ -57862,24 +63009,24 @@ function LinkEditor({ value, ...props }) { - return (0,external_React_.createElement)("form", { - className: classnames_default()('block-editor-url-popover__link-editor', className), - ...props - }, (0,external_React_.createElement)(url_input, { - __nextHasNoMarginBottom: true, - value: value, - onChange: onChangeInputValue, - autocompleteRef: autocompleteRef - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - icon: keyboard_return, - label: (0,external_wp_i18n_namespaceObject.__)('Apply'), - type: "submit", - size: "compact" - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("form", { + className: dist_clsx('block-editor-url-popover__link-editor', className), + ...props, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(url_input, { + __nextHasNoMarginBottom: true, + value: value, + onChange: onChangeInputValue, + autocompleteRef: autocompleteRef + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + icon: keyboard_return, + label: (0,external_wp_i18n_namespaceObject.__)('Apply'), + type: "submit", + size: "compact" + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-popover/index.js - /** * WordPress dependencies */ @@ -57895,6 +63042,8 @@ function LinkEditor({ + + const { __experimentalPopoverLegacyPositionToPlacement } = unlock(external_wp_components_namespaceObject.privateApis); @@ -57934,30 +63083,35 @@ const URLPopover = (0,external_wp_element_namespaceObject.forwardRef)(({ const toggleSettingsVisibility = () => { setIsSettingsExpanded(!isSettingsExpanded); }; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Popover, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Popover, { ref: ref, className: "block-editor-url-popover", focusOnMount: focusOnMount, placement: computedPlacement, shift: true, variant: "toolbar", - ...popoverProps - }, (0,external_React_.createElement)("div", { - className: "block-editor-url-popover__input-container" - }, (0,external_React_.createElement)("div", { - className: "block-editor-url-popover__row" - }, children, !!renderSettings && (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - className: "block-editor-url-popover__settings-toggle", - icon: chevron_down, - label: (0,external_wp_i18n_namespaceObject.__)('Link settings'), - onClick: toggleSettingsVisibility, - "aria-expanded": isSettingsExpanded, - size: "compact" - }))), showSettings && (0,external_React_.createElement)("div", { - className: "block-editor-url-popover__settings" - }, renderSettings()), additionalControls && !showSettings && (0,external_React_.createElement)("div", { - className: "block-editor-url-popover__additional-controls" - }, additionalControls)); + ...popoverProps, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-url-popover__input-container", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-url-popover__row", + children: [children, !!renderSettings && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + className: "block-editor-url-popover__settings-toggle", + icon: chevron_down, + label: (0,external_wp_i18n_namespaceObject.__)('Link settings'), + onClick: toggleSettingsVisibility, + "aria-expanded": isSettingsExpanded, + size: "compact" + })] + }) + }), showSettings && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-url-popover__settings", + children: renderSettings() + }), additionalControls && !showSettings && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-url-popover__additional-controls", + children: additionalControls + })] + }); }); URLPopover.LinkEditor = LinkEditor; URLPopover.LinkViewer = LinkViewer; @@ -57968,7 +63122,6 @@ URLPopover.LinkViewer = LinkViewer; /* harmony default export */ const url_popover = (URLPopover); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/media-placeholder/index.js - /** * External dependencies */ @@ -57992,6 +63145,9 @@ URLPopover.LinkViewer = LinkViewer; + + + const media_placeholder_noop = () => {}; const InsertFromURLPopover = ({ src, @@ -57999,25 +63155,27 @@ const InsertFromURLPopover = ({ onSubmit, onClose, popoverAnchor -}) => (0,external_React_.createElement)(url_popover, { +}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(url_popover, { anchor: popoverAnchor, - onClose: onClose -}, (0,external_React_.createElement)("form", { - className: "block-editor-media-placeholder__url-input-form", - onSubmit: onSubmit -}, (0,external_React_.createElement)("input", { - className: "block-editor-media-placeholder__url-input-field", - type: "text", - "aria-label": (0,external_wp_i18n_namespaceObject.__)('URL'), - placeholder: (0,external_wp_i18n_namespaceObject.__)('Paste or type URL'), - onChange: onChange, - value: src -}), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - className: "block-editor-media-placeholder__url-input-submit-button", - icon: keyboard_return, - label: (0,external_wp_i18n_namespaceObject.__)('Apply'), - type: "submit" -}))); + onClose: onClose, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("form", { + className: "block-editor-media-placeholder__url-input-form", + onSubmit: onSubmit, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("input", { + className: "block-editor-media-placeholder__url-input-field", + type: "text", + "aria-label": (0,external_wp_i18n_namespaceObject.__)('URL'), + placeholder: (0,external_wp_i18n_namespaceObject.__)('Paste or type URL'), + onChange: onChange, + value: src + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + className: "block-editor-media-placeholder__url-input-submit-button", + icon: keyboard_return, + label: (0,external_wp_i18n_namespaceObject.__)('Apply'), + type: "submit" + })] + }) +}); const URLSelectionUI = ({ isURLInputVisible, src, @@ -58029,21 +63187,23 @@ const URLSelectionUI = ({ // Use internal state instead of a ref to make sure that the component // re-renders when the popover's anchor updates. const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); - return (0,external_React_.createElement)("div", { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "block-editor-media-placeholder__url-input-container", - ref: setPopoverAnchor - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - className: "block-editor-media-placeholder__button", - onClick: openURLInput, - isPressed: isURLInputVisible, - variant: "tertiary" - }, (0,external_wp_i18n_namespaceObject.__)('Insert from URL')), isURLInputVisible && (0,external_React_.createElement)(InsertFromURLPopover, { - src: src, - onChange: onChangeSrc, - onSubmit: onSubmitSrc, - onClose: closeURLInput, - popoverAnchor: popoverAnchor - })); + ref: setPopoverAnchor, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + className: "block-editor-media-placeholder__button", + onClick: openURLInput, + isPressed: isURLInputVisible, + variant: "secondary", + children: (0,external_wp_i18n_namespaceObject.__)('Insert from URL') + }), isURLInputVisible && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InsertFromURLPopover, { + src: src, + onChange: onChangeSrc, + onSubmit: onSubmitSrc, + onClose: closeURLInput, + popoverAnchor: popoverAnchor + })] + }); }; function MediaPlaceholder({ value = {}, @@ -58251,10 +63411,10 @@ function MediaPlaceholder({ } } } - const placeholderClassName = classnames_default()('block-editor-media-placeholder', className, { + const placeholderClassName = dist_clsx('block-editor-media-placeholder', className, { 'is-appender': isAppender }); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Placeholder, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Placeholder, { icon: icon, label: title, instructions: instructions, @@ -58262,29 +63422,31 @@ function MediaPlaceholder({ notices: notices, onDoubleClick: onDoubleClick, preview: mediaPreview, - style: style - }, content, children); + style: style, + children: [content, children] + }); }; const renderPlaceholder = placeholder !== null && placeholder !== void 0 ? placeholder : defaultRenderPlaceholder; const renderDropZone = () => { if (disableDropZone) { return null; } - return (0,external_React_.createElement)(external_wp_components_namespaceObject.DropZone, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropZone, { onFilesDrop: onFilesUpload, onHTMLDrop: onHTMLDrop }); }; const renderCancelLink = () => { - return onCancel && (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { + return onCancel && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { className: "block-editor-media-placeholder__cancel-button", title: (0,external_wp_i18n_namespaceObject.__)('Cancel'), variant: "link", - onClick: onCancel - }, (0,external_wp_i18n_namespaceObject.__)('Cancel')); + onClick: onCancel, + children: (0,external_wp_i18n_namespaceObject.__)('Cancel') + }); }; const renderUrlSelectionUI = () => { - return onSelectURL && (0,external_React_.createElement)(URLSelectionUI, { + return onSelectURL && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(URLSelectionUI, { isURLInputVisible: isURLInputVisible, src: src, onChangeSrc: onChangeSrc, @@ -58294,73 +63456,87 @@ function MediaPlaceholder({ }); }; const renderFeaturedImageToggle = () => { - return onToggleFeaturedImage && (0,external_React_.createElement)("div", { - className: "block-editor-media-placeholder__url-input-container" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - className: "block-editor-media-placeholder__button", - onClick: onToggleFeaturedImage, - variant: "tertiary" - }, (0,external_wp_i18n_namespaceObject.__)('Use featured image'))); + return onToggleFeaturedImage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-media-placeholder__url-input-container", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + className: "block-editor-media-placeholder__button", + onClick: onToggleFeaturedImage, + variant: "secondary", + children: (0,external_wp_i18n_namespaceObject.__)('Use featured image') + }) + }); }; const renderMediaUploadChecked = () => { const defaultButton = ({ open }) => { - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - variant: "tertiary", + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + variant: "secondary", onClick: () => { open(); - } - }, (0,external_wp_i18n_namespaceObject.__)('Media Library')); + }, + children: (0,external_wp_i18n_namespaceObject.__)('Media Library') + }); }; const libraryButton = mediaLibraryButton !== null && mediaLibraryButton !== void 0 ? mediaLibraryButton : defaultButton; - const uploadMediaLibraryButton = (0,external_React_.createElement)(media_upload, { + const uploadMediaLibraryButton = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(media_upload, { addToGallery: addToGallery, gallery: multiple && onlyAllowsImages(), multiple: multiple, onSelect: onSelect, allowedTypes: allowedTypes, - mode: 'browse', + mode: "browse", value: Array.isArray(value) ? value.map(({ id }) => id) : value.id, render: libraryButton }); if (mediaUpload && isAppender) { - return (0,external_React_.createElement)(external_React_.Fragment, null, renderDropZone(), (0,external_React_.createElement)(external_wp_components_namespaceObject.FormFileUpload, { - onChange: onUpload, - accept: accept, - multiple: !!multiple, - render: ({ - openFileDialog - }) => { - const content = (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - variant: "primary", - className: classnames_default()('block-editor-media-placeholder__button', 'block-editor-media-placeholder__upload-button'), - onClick: openFileDialog - }, (0,external_wp_i18n_namespaceObject.__)('Upload')), uploadMediaLibraryButton, renderUrlSelectionUI(), renderFeaturedImageToggle(), renderCancelLink()); - return renderPlaceholder(content); - } - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [renderDropZone(), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FormFileUpload, { + onChange: onUpload, + accept: accept, + multiple: !!multiple, + render: ({ + openFileDialog + }) => { + const content = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + variant: "primary", + className: dist_clsx('block-editor-media-placeholder__button', 'block-editor-media-placeholder__upload-button'), + onClick: openFileDialog, + children: (0,external_wp_i18n_namespaceObject.__)('Upload') + }), uploadMediaLibraryButton, renderUrlSelectionUI(), renderFeaturedImageToggle(), renderCancelLink()] + }); + return renderPlaceholder(content); + } + })] + }); } if (mediaUpload) { - const content = (0,external_React_.createElement)(external_React_.Fragment, null, renderDropZone(), (0,external_React_.createElement)(external_wp_components_namespaceObject.FormFileUpload, { - variant: "primary", - className: classnames_default()('block-editor-media-placeholder__button', 'block-editor-media-placeholder__upload-button'), - onChange: onUpload, - accept: accept, - multiple: !!multiple - }, (0,external_wp_i18n_namespaceObject.__)('Upload')), uploadMediaLibraryButton, renderUrlSelectionUI(), renderFeaturedImageToggle(), renderCancelLink()); + const content = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [renderDropZone(), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FormFileUpload, { + variant: "primary", + className: dist_clsx('block-editor-media-placeholder__button', 'block-editor-media-placeholder__upload-button'), + onChange: onUpload, + accept: accept, + multiple: !!multiple, + children: (0,external_wp_i18n_namespaceObject.__)('Upload') + }), uploadMediaLibraryButton, renderUrlSelectionUI(), renderFeaturedImageToggle(), renderCancelLink()] + }); return renderPlaceholder(content); } return renderPlaceholder(uploadMediaLibraryButton); }; if (disableMediaButtons) { - return (0,external_React_.createElement)(check, null, renderDropZone()); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(check, { + children: renderDropZone() + }); } - return (0,external_React_.createElement)(check, { - fallback: renderPlaceholder(renderUrlSelectionUI()) - }, renderMediaUploadChecked()); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(check, { + fallback: renderPlaceholder(renderUrlSelectionUI()), + children: renderMediaUploadChecked() + }); } /** @@ -58369,11 +63545,11 @@ function MediaPlaceholder({ /* harmony default export */ const media_placeholder = ((0,external_wp_components_namespaceObject.withFilters)('editor.MediaPlaceholder')(MediaPlaceholder)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/panel-color-settings/index.js - /** * Internal dependencies */ + const PanelColorSettings = ({ colorSettings, ...props @@ -58393,7 +63569,7 @@ const PanelColorSettings = ({ onColorChange: onChange }; }); - return (0,external_React_.createElement)(panel_color_gradient_settings, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(panel_color_gradient_settings, { settings: settings, gradients: [], disableCustomGradients: true, @@ -58403,7 +63579,6 @@ const PanelColorSettings = ({ /* harmony default export */ const panel_color_settings = (PanelColorSettings); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/format-toolbar/index.js - /** * External dependencies */ @@ -58420,55 +63595,59 @@ const PanelColorSettings = ({ * Internal dependencies */ + + + const format_toolbar_POPOVER_PROPS = { placement: 'bottom-start' }; const FormatToolbar = () => { - return (0,external_React_.createElement)(external_React_.Fragment, null, ['bold', 'italic', 'link', 'unknown'].map(format => (0,external_React_.createElement)(external_wp_components_namespaceObject.Slot, { - name: `RichText.ToolbarControls.${format}`, - key: format - })), (0,external_React_.createElement)(external_wp_components_namespaceObject.Slot, { - name: "RichText.ToolbarControls" - }, fills => { - if (!fills.length) { - return null; - } - const allProps = fills.map(([{ - props - }]) => props); - const hasActive = allProps.some(({ - isActive - }) => isActive); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarItem, null, toggleProps => (0,external_React_.createElement)(external_wp_components_namespaceObject.DropdownMenu, { - icon: chevron_down - /* translators: button label text should, if possible, be under 16 characters. */, - label: (0,external_wp_i18n_namespaceObject.__)('More'), - toggleProps: { - ...toggleProps, - className: classnames_default()(toggleProps.className, { - 'is-pressed': hasActive - }), - describedBy: (0,external_wp_i18n_namespaceObject.__)('Displays more block tools') - }, - controls: orderBy(fills.map(([{ - props - }]) => props), 'title'), - popoverProps: format_toolbar_POPOVER_PROPS - })); - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [['bold', 'italic', 'link', 'unknown'].map(format => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, { + name: `RichText.ToolbarControls.${format}` + }, format)), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, { + name: "RichText.ToolbarControls", + children: fills => { + if (!fills.length) { + return null; + } + const allProps = fills.map(([{ + props + }]) => props); + const hasActive = allProps.some(({ + isActive + }) => isActive); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { + children: toggleProps => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { + icon: chevron_down + /* translators: button label text should, if possible, be under 16 characters. */, + label: (0,external_wp_i18n_namespaceObject.__)('More'), + toggleProps: { + ...toggleProps, + className: dist_clsx(toggleProps.className, { + 'is-pressed': hasActive + }), + describedBy: (0,external_wp_i18n_namespaceObject.__)('Displays more block tools') + }, + controls: orderBy(fills.map(([{ + props + }]) => props), 'title'), + popoverProps: format_toolbar_POPOVER_PROPS + }) + }); + } + })] + }); }; /* harmony default export */ const format_toolbar = (FormatToolbar); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/format-toolbar-container.js - /** * WordPress dependencies */ - - /** * Internal dependencies */ @@ -58476,112 +63655,43 @@ const FormatToolbar = () => { -function InlineSelectionToolbar({ - editableContentElement, - activeFormats -}) { - const lastFormat = activeFormats[activeFormats.length - 1]; - const lastFormatType = lastFormat?.type; - const settings = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_richText_namespaceObject.store).getFormatType(lastFormatType), [lastFormatType]); - const popoverAnchor = (0,external_wp_richText_namespaceObject.useAnchor)({ - editableContentElement, - settings - }); - return (0,external_React_.createElement)(InlineToolbar, { - popoverAnchor: popoverAnchor - }); -} function InlineToolbar({ popoverAnchor }) { - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Popover, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, { placement: "top", focusOnMount: false, anchor: popoverAnchor, className: "block-editor-rich-text__inline-format-toolbar", - __unstableSlotName: "block-toolbar" - }, (0,external_React_.createElement)(NavigableToolbar, { - className: "block-editor-rich-text__inline-format-toolbar-group" - /* translators: accessibility text for the inline format toolbar */, - "aria-label": (0,external_wp_i18n_namespaceObject.__)('Format tools') - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_.createElement)(format_toolbar, null)))); + __unstableSlotName: "block-toolbar", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigableToolbar, { + className: "block-editor-rich-text__inline-format-toolbar-group" + /* translators: accessibility text for the inline format toolbar */, + "aria-label": (0,external_wp_i18n_namespaceObject.__)('Format tools'), + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(format_toolbar, {}) + }) + }) + }); } const FormatToolbarContainer = ({ inline, - editableContentElement, - value + editableContentElement }) => { - const hasInlineToolbar = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings().hasInlineToolbar, []); if (inline) { - return (0,external_React_.createElement)(InlineToolbar, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InlineToolbar, { popoverAnchor: editableContentElement }); } - if (hasInlineToolbar) { - const activeFormats = (0,external_wp_richText_namespaceObject.getActiveFormats)(value); - if ((0,external_wp_richText_namespaceObject.isCollapsed)(value) && !activeFormats.length) { - return null; - } - return (0,external_React_.createElement)(InlineSelectionToolbar, { - editableContentElement: editableContentElement, - activeFormats: activeFormats - }); - } // Render regular toolbar. - return (0,external_React_.createElement)(block_controls, { - group: "inline" - }, (0,external_React_.createElement)(format_toolbar, null)); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls, { + group: "inline", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(format_toolbar, {}) + }); }; /* harmony default export */ const format_toolbar_container = (FormatToolbarContainer); -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-undo-automatic-change.js -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - -function useUndoAutomaticChange() { - const { - didAutomaticChange, - getSettings - } = (0,external_wp_data_namespaceObject.useSelect)(store); - return (0,external_wp_compose_namespaceObject.useRefEffect)(element => { - function onKeyDown(event) { - const { - keyCode - } = event; - if (event.defaultPrevented) { - return; - } - if (keyCode !== external_wp_keycodes_namespaceObject.DELETE && keyCode !== external_wp_keycodes_namespaceObject.BACKSPACE && keyCode !== external_wp_keycodes_namespaceObject.ESCAPE) { - return; - } - const { - __experimentalUndo - } = getSettings(); - if (!__experimentalUndo) { - return; - } - if (!didAutomaticChange()) { - return; - } - event.preventDefault(); - __experimentalUndo(); - } - element.addEventListener('keydown', onKeyDown); - return () => { - element.removeEventListener('keydown', onKeyDown); - }; - }, []); -} - ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-mark-persistent.js /** * WordPress dependencies @@ -58626,700 +63736,6 @@ function useMarkPersistent({ }, [html, hasActiveFormats]); } -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/utils.js - -/** - * WordPress dependencies - */ - - -function addActiveFormats(value, activeFormats) { - if (activeFormats?.length) { - let index = value.formats.length; - while (index--) { - value.formats[index] = [...activeFormats, ...(value.formats[index] || [])]; - } - } -} - -/** - * Get the multiline tag based on the multiline prop. - * - * @param {?(string|boolean)} multiline The multiline prop. - * - * @return {string | undefined} The multiline tag. - */ -function getMultilineTag(multiline) { - if (multiline !== true && multiline !== 'p' && multiline !== 'li') { - return; - } - return multiline === true ? 'p' : multiline; -} -function getAllowedFormats({ - allowedFormats, - disableFormats -}) { - if (disableFormats) { - return getAllowedFormats.EMPTY_ARRAY; - } - return allowedFormats; -} -getAllowedFormats.EMPTY_ARRAY = []; - -/** - * Creates a link from pasted URL. - * Creates a paragraph block containing a link to the URL, and calls `onReplace`. - * - * @param {string} url The URL that could not be embedded. - * @param {Function} onReplace Function to call with the created fallback block. - */ -function createLinkInParagraph(url, onReplace) { - const link = createElement("a", { - href: url - }, url); - onReplace(createBlock('core/paragraph', { - content: renderToString(link) - })); -} - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/split-value.js -/** - * WordPress dependencies - */ - - -/* - * Signals to the RichText owner that the block can be replaced with two blocks - * as a result of splitting the block by pressing enter, or with blocks as a - * result of splitting the block by pasting block content in the instance. - */ -function splitValue({ - value, - pastedBlocks = [], - onReplace, - onSplit -}) { - if (!onReplace || !onSplit) { - return; - } - - // Ensure the value has a selection. This might happen when trying to split - // an empty value before there was a `selectionchange` event. - const { - start = 0, - end = 0 - } = value; - const valueWithEnsuredSelection = { - ...value, - start, - end - }; - const blocks = []; - const [before, after] = (0,external_wp_richText_namespaceObject.split)(valueWithEnsuredSelection); - const hasPastedBlocks = pastedBlocks.length > 0; - let lastPastedBlockIndex = -1; - - // Consider the after value to be the original it is not empty and the - // before value *is* empty. - const isAfterOriginal = (0,external_wp_richText_namespaceObject.isEmpty)(before) && !(0,external_wp_richText_namespaceObject.isEmpty)(after); - - // Create a block with the content before the caret if there's no pasted - // blocks, or if there are pasted blocks and the value is not empty. We do - // not want a leading empty block on paste, but we do if we split with e.g. - // the enter key. - if (!hasPastedBlocks || !(0,external_wp_richText_namespaceObject.isEmpty)(before)) { - blocks.push(onSplit((0,external_wp_richText_namespaceObject.toHTMLString)({ - value: before - }), !isAfterOriginal)); - lastPastedBlockIndex += 1; - } - if (hasPastedBlocks) { - blocks.push(...pastedBlocks); - lastPastedBlockIndex += pastedBlocks.length; - } - - // Create a block with the content after the caret if there's no pasted - // blocks, or if there are pasted blocks and the value is not empty. We do - // not want a trailing empty block on paste, but we do if we split with e.g. - // the enter key. - if (!hasPastedBlocks || !(0,external_wp_richText_namespaceObject.isEmpty)(after)) { - blocks.push(onSplit((0,external_wp_richText_namespaceObject.toHTMLString)({ - value: after - }), isAfterOriginal)); - } - - // If there are pasted blocks, set the selection to the last one. Otherwise, - // set the selection to the second block. - const indexToSelect = hasPastedBlocks ? lastPastedBlockIndex : 1; - - // If there are pasted blocks, move the caret to the end of the selected - // block Otherwise, retain the default value. - const initialPosition = hasPastedBlocks ? -1 : 0; - onReplace(blocks, indexToSelect, initialPosition); -} - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-paste-handler.js -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - - - -/** @typedef {import('@wordpress/rich-text').RichTextValue} RichTextValue */ - -function usePasteHandler(props) { - const propsRef = (0,external_wp_element_namespaceObject.useRef)(props); - propsRef.current = props; - return (0,external_wp_compose_namespaceObject.useRefEffect)(element => { - function _onPaste(event) { - const { - isSelected, - disableFormats, - onChange, - value, - formatTypes, - tagName, - onReplace, - onSplit, - __unstableEmbedURLOnPaste, - pastePlainText - } = propsRef.current; - if (!isSelected) { - return; - } - const { - plainText, - html, - files - } = getPasteEventData(event); - event.preventDefault(); - - // Allows us to ask for this information when we get a report. - window.console.log('Received HTML:\n\n', html); - window.console.log('Received plain text:\n\n', plainText); - if (disableFormats) { - onChange((0,external_wp_richText_namespaceObject.insert)(value, plainText)); - return; - } - const isInternal = event.clipboardData.getData('rich-text') === 'true'; - function pasteInline(content) { - const transformed = formatTypes.reduce((accumulator, { - __unstablePasteRule - }) => { - // Only allow one transform. - if (__unstablePasteRule && accumulator === value) { - accumulator = __unstablePasteRule(value, { - html, - plainText - }); - } - return accumulator; - }, value); - if (transformed !== value) { - onChange(transformed); - } else { - const valueToInsert = (0,external_wp_richText_namespaceObject.create)({ - html: content - }); - addActiveFormats(valueToInsert, value.activeFormats); - onChange((0,external_wp_richText_namespaceObject.insert)(value, valueToInsert)); - } - } - - // If the data comes from a rich text instance, we can directly use it - // without filtering the data. The filters are only meant for externally - // pasted content and remove inline styles. - if (isInternal) { - pasteInline(html); - return; - } - if (pastePlainText) { - onChange((0,external_wp_richText_namespaceObject.insert)(value, (0,external_wp_richText_namespaceObject.create)({ - text: plainText - }))); - return; - } - if (files?.length) { - // Allows us to ask for this information when we get a report. - // eslint-disable-next-line no-console - window.console.log('Received items:\n\n', files); - const fromTransforms = (0,external_wp_blocks_namespaceObject.getBlockTransforms)('from'); - const blocks = files.reduce((accumulator, file) => { - const transformation = (0,external_wp_blocks_namespaceObject.findTransform)(fromTransforms, transform => transform.type === 'files' && transform.isMatch([file])); - if (transformation) { - accumulator.push(transformation.transform([file])); - } - return accumulator; - }, []).flat(); - if (!blocks.length) { - return; - } - if (onReplace && (0,external_wp_richText_namespaceObject.isEmpty)(value)) { - onReplace(blocks); - } else { - splitValue({ - value, - pastedBlocks: blocks, - onReplace, - onSplit - }); - } - return; - } - let mode = onReplace && onSplit ? 'AUTO' : 'INLINE'; - const trimmedPlainText = plainText.trim(); - if (__unstableEmbedURLOnPaste && (0,external_wp_richText_namespaceObject.isEmpty)(value) && (0,external_wp_url_namespaceObject.isURL)(trimmedPlainText) && - // For the link pasting feature, allow only http(s) protocols. - /^https?:/.test(trimmedPlainText)) { - mode = 'BLOCKS'; - } - const content = (0,external_wp_blocks_namespaceObject.pasteHandler)({ - HTML: html, - plainText, - mode, - tagName - }); - if (typeof content === 'string') { - pasteInline(content); - } else if (content.length > 0) { - if (onReplace && (0,external_wp_richText_namespaceObject.isEmpty)(value)) { - onReplace(content, content.length - 1, -1); - } else { - splitValue({ - value, - pastedBlocks: content, - onReplace, - onSplit - }); - } - } - } - element.addEventListener('paste', _onPaste); - return () => { - element.removeEventListener('paste', _onPaste); - }; - }, []); -} - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-before-input-rules.js -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - -/** - * When typing over a selection, the selection will we wrapped by a matching - * character pair. The second character is optional, it defaults to the first - * character. - * - * @type {string[]} Array of character pairs. - */ -const wrapSelectionSettings = ['`', '"', "'", '“”', '‘’']; -function useBeforeInputRules(props) { - const { - __unstableMarkLastChangeAsPersistent, - __unstableMarkAutomaticChange - } = (0,external_wp_data_namespaceObject.useDispatch)(store); - const propsRef = (0,external_wp_element_namespaceObject.useRef)(props); - propsRef.current = props; - return (0,external_wp_compose_namespaceObject.useRefEffect)(element => { - function onInput(event) { - const { - inputType, - data - } = event; - const { - value, - onChange - } = propsRef.current; - - // Only run the rules when inserting text. - if (inputType !== 'insertText') { - return; - } - if ((0,external_wp_richText_namespaceObject.isCollapsed)(value)) { - return; - } - const pair = (0,external_wp_hooks_namespaceObject.applyFilters)('blockEditor.wrapSelectionSettings', wrapSelectionSettings).find(([startChar, endChar]) => startChar === data || endChar === data); - if (!pair) { - return; - } - const [startChar, endChar = startChar] = pair; - const start = value.start; - const end = value.end + startChar.length; - let newValue = (0,external_wp_richText_namespaceObject.insert)(value, startChar, start, start); - newValue = (0,external_wp_richText_namespaceObject.insert)(newValue, endChar, end, end); - __unstableMarkLastChangeAsPersistent(); - onChange(newValue); - __unstableMarkAutomaticChange(); - const init = {}; - for (const key in event) { - init[key] = event[key]; - } - init.data = endChar; - const { - ownerDocument - } = element; - const { - defaultView - } = ownerDocument; - const newEvent = new defaultView.InputEvent('input', init); - - // Dispatch an `input` event with the new data. This will trigger the - // input rules. - // Postpone the `input` to the next event loop tick so that the dispatch - // doesn't happen synchronously in the middle of `beforeinput` dispatch. - // This is closer to how native `input` event would be timed, and also - // makes sure that the `input` event is dispatched only after the `onChange` - // call few lines above has fully updated the data store state and rerendered - // all affected components. - window.queueMicrotask(() => { - event.target.dispatchEvent(newEvent); - }); - event.preventDefault(); - } - element.addEventListener('beforeinput', onInput); - return () => { - element.removeEventListener('beforeinput', onInput); - }; - }, []); -} - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/prevent-event-discovery.js -/** - * WordPress dependencies - */ - -function preventEventDiscovery(value) { - const searchText = 'tales of gutenberg'; - const addText = ' 🐡🐢🦀🐤🦋🐘🐧🐹🦁🦄🦍🐼🐿🎃🐴🐝🐆🦕🦔🌱🍇π🍌🐉💧🥨🌌🍂🍠🥦🥚🥝🎟🥥🥒🛵🥖🍒🍯🎾🎲🐺🐚🐮⌛️'; - const { - start, - text - } = value; - if (start < searchText.length) { - return value; - } - const charactersBefore = text.slice(start - searchText.length, start); - if (charactersBefore.toLowerCase() !== searchText) { - return value; - } - return (0,external_wp_richText_namespaceObject.insert)(value, addText); -} - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-input-rules.js -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - - -function findSelection(blocks) { - let i = blocks.length; - while (i--) { - const attributeKey = retrieveSelectedAttribute(blocks[i].attributes); - if (attributeKey) { - blocks[i].attributes[attributeKey] = blocks[i].attributes[attributeKey] - // To do: refactor this to use rich text's selection instead, so - // we no longer have to use on this hack inserting a special - // character. - .toString().replace(START_OF_SELECTED_AREA, ''); - return [blocks[i].clientId, attributeKey, 0, 0]; - } - const nestedSelection = findSelection(blocks[i].innerBlocks); - if (nestedSelection) { - return nestedSelection; - } - } - return []; -} -function useInputRules(props) { - const { - __unstableMarkLastChangeAsPersistent, - __unstableMarkAutomaticChange - } = (0,external_wp_data_namespaceObject.useDispatch)(store); - const propsRef = (0,external_wp_element_namespaceObject.useRef)(props); - propsRef.current = props; - return (0,external_wp_compose_namespaceObject.useRefEffect)(element => { - function inputRule() { - const { - getValue, - onReplace, - selectionChange - } = propsRef.current; - if (!onReplace) { - return; - } - - // We must use getValue() here because value may be update - // asynchronously. - const value = getValue(); - const { - start, - text - } = value; - const characterBefore = text.slice(start - 1, start); - - // The character right before the caret must be a plain space. - if (characterBefore !== ' ') { - return; - } - const trimmedTextBefore = text.slice(0, start).trim(); - const prefixTransforms = (0,external_wp_blocks_namespaceObject.getBlockTransforms)('from').filter(({ - type - }) => type === 'prefix'); - const transformation = (0,external_wp_blocks_namespaceObject.findTransform)(prefixTransforms, ({ - prefix - }) => { - return trimmedTextBefore === prefix; - }); - if (!transformation) { - return; - } - const content = (0,external_wp_richText_namespaceObject.toHTMLString)({ - value: (0,external_wp_richText_namespaceObject.insert)(value, START_OF_SELECTED_AREA, 0, start) - }); - const block = transformation.transform(content); - selectionChange(...findSelection([block])); - onReplace([block]); - __unstableMarkAutomaticChange(); - return true; - } - function onInput(event) { - const { - inputType, - type - } = event; - const { - getValue, - onChange, - __unstableAllowPrefixTransformations, - formatTypes - } = propsRef.current; - - // Only run input rules when inserting text. - if (inputType !== 'insertText' && type !== 'compositionend') { - return; - } - if (__unstableAllowPrefixTransformations && inputRule()) { - return; - } - const value = getValue(); - const transformed = formatTypes.reduce((accumlator, { - __unstableInputRule - }) => { - if (__unstableInputRule) { - accumlator = __unstableInputRule(accumlator); - } - return accumlator; - }, preventEventDiscovery(value)); - if (transformed !== value) { - __unstableMarkLastChangeAsPersistent(); - onChange({ - ...transformed, - activeFormats: value.activeFormats - }); - __unstableMarkAutomaticChange(); - } - } - element.addEventListener('input', onInput); - element.addEventListener('compositionend', onInput); - return () => { - element.removeEventListener('input', onInput); - element.removeEventListener('compositionend', onInput); - }; - }, []); -} - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-delete.js -/** - * WordPress dependencies - */ - - - - -function useDelete(props) { - const propsRef = (0,external_wp_element_namespaceObject.useRef)(props); - propsRef.current = props; - return (0,external_wp_compose_namespaceObject.useRefEffect)(element => { - function onKeyDown(event) { - const { - keyCode - } = event; - if (event.defaultPrevented) { - return; - } - const { - value, - onMerge, - onRemove - } = propsRef.current; - if (keyCode === external_wp_keycodes_namespaceObject.DELETE || keyCode === external_wp_keycodes_namespaceObject.BACKSPACE) { - const { - start, - end, - text - } = value; - const isReverse = keyCode === external_wp_keycodes_namespaceObject.BACKSPACE; - const hasActiveFormats = value.activeFormats && !!value.activeFormats.length; - - // Only process delete if the key press occurs at an uncollapsed edge. - if (!(0,external_wp_richText_namespaceObject.isCollapsed)(value) || hasActiveFormats || isReverse && start !== 0 || !isReverse && end !== text.length) { - return; - } - if (onMerge) { - onMerge(!isReverse); - } - - // Only handle remove on Backspace. This serves dual-purpose of being - // an intentional user interaction distinguishing between Backspace and - // Delete to remove the empty field, but also to avoid merge & remove - // causing destruction of two fields (merge, then removed merged). - else if (onRemove && (0,external_wp_richText_namespaceObject.isEmpty)(value) && isReverse) { - onRemove(!isReverse); - } - event.preventDefault(); - } - } - element.addEventListener('keydown', onKeyDown); - return () => { - element.removeEventListener('keydown', onKeyDown); - }; - }, []); -} - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-enter.js -/** - * WordPress dependencies - */ - - - - - - - -/** - * Internal dependencies - */ - - -function useEnter(props) { - const registry = (0,external_wp_data_namespaceObject.useRegistry)(); - const { - __unstableMarkAutomaticChange - } = (0,external_wp_data_namespaceObject.useDispatch)(store); - const propsRef = (0,external_wp_element_namespaceObject.useRef)(props); - propsRef.current = props; - return (0,external_wp_compose_namespaceObject.useRefEffect)(element => { - function onKeyDown(event) { - if (event.target.contentEditable !== 'true') { - return; - } - if (event.defaultPrevented) { - return; - } - if (event.keyCode !== external_wp_keycodes_namespaceObject.ENTER) { - return; - } - const { - removeEditorOnlyFormats, - value, - onReplace, - onSplit, - onChange, - disableLineBreaks, - onSplitAtEnd, - onSplitAtDoubleLineEnd - } = propsRef.current; - event.preventDefault(); - const _value = { - ...value - }; - _value.formats = removeEditorOnlyFormats(value); - const canSplit = onReplace && onSplit; - if (onReplace) { - const transforms = (0,external_wp_blocks_namespaceObject.getBlockTransforms)('from').filter(({ - type - }) => type === 'enter'); - const transformation = (0,external_wp_blocks_namespaceObject.findTransform)(transforms, item => { - return item.regExp.test(_value.text); - }); - if (transformation) { - onReplace([transformation.transform({ - content: _value.text - })]); - __unstableMarkAutomaticChange(); - return; - } - } - const { - text, - start, - end - } = _value; - if (event.shiftKey) { - if (!disableLineBreaks) { - onChange((0,external_wp_richText_namespaceObject.insert)(_value, '\n')); - } - } else if (canSplit) { - splitValue({ - value: _value, - onReplace, - onSplit - }); - } else if (onSplitAtEnd && start === end && end === text.length) { - onSplitAtEnd(); - } else if ( - // For some blocks it's desirable to split at the end of the - // block when there are two line breaks at the end of the - // block, so triple Enter exits the block. - onSplitAtDoubleLineEnd && start === end && end === text.length && text.slice(-2) === '\n\n') { - registry.batch(() => { - _value.start = _value.end - 2; - onChange((0,external_wp_richText_namespaceObject.remove)(_value)); - onSplitAtDoubleLineEnd(); - }); - } else if (!disableLineBreaks) { - onChange((0,external_wp_richText_namespaceObject.insert)(_value, '\n')); - } - } - element.addEventListener('keydown', onKeyDown); - return () => { - element.removeEventListener('keydown', onKeyDown); - }; - }, []); -} - ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-format-types.js /** * WordPress dependencies @@ -59338,13 +63754,17 @@ function formatTypesSelector(select) { */ const interactiveContentTags = new Set(['a', 'audio', 'button', 'details', 'embed', 'iframe', 'input', 'label', 'select', 'textarea', 'video']); function prefixSelectKeys(selected, prefix) { - if (typeof selected !== 'object') return { - [prefix]: selected - }; + if (typeof selected !== 'object') { + return { + [prefix]: selected + }; + } return Object.fromEntries(Object.entries(selected).map(([key, value]) => [`${prefix}.${key}`, value])); } function getPrefixedSelectKeys(selected, prefix) { - if (selected[prefix]) return selected[prefix]; + if (selected[prefix]) { + return selected[prefix]; + } return Object.keys(selected).filter(key => key.startsWith(prefix + '.')).reduce((accumulator, key) => { accumulator[key.slice(prefix.length + 1)] = selected[key]; return accumulator; @@ -59442,7 +63862,7 @@ function useFormatTypes({ }; } -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-remove-browser-shortcuts.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/before-input-rules.js /** * WordPress dependencies */ @@ -59450,70 +63870,236 @@ function useFormatTypes({ /** - * Hook to prevent default behaviors for key combinations otherwise handled - * internally by RichText. + * Internal dependencies + */ + + +/** + * When typing over a selection, the selection will we wrapped by a matching + * character pair. The second character is optional, it defaults to the first + * character. * - * @return {import('react').RefObject} The component to be rendered. + * @type {string[]} Array of character pairs. */ -function useRemoveBrowserShortcuts() { - return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { - function onKeydown(event) { - if (external_wp_keycodes_namespaceObject.isKeyboardEvent.primary(event, 'z') || external_wp_keycodes_namespaceObject.isKeyboardEvent.primary(event, 'y') || external_wp_keycodes_namespaceObject.isKeyboardEvent.primaryShift(event, 'z')) { - event.preventDefault(); - } +const wrapSelectionSettings = ['`', '"', "'", '“”', '‘’']; +/* harmony default export */ const before_input_rules = (props => element => { + function onInput(event) { + const { + inputType, + data + } = event; + const { + value, + onChange, + registry + } = props.current; + + // Only run the rules when inserting text. + if (inputType !== 'insertText') { + return; } - node.addEventListener('keydown', onKeydown); - return () => { - node.removeEventListener('keydown', onKeydown); - }; - }, []); -} + if ((0,external_wp_richText_namespaceObject.isCollapsed)(value)) { + return; + } + const pair = (0,external_wp_hooks_namespaceObject.applyFilters)('blockEditor.wrapSelectionSettings', wrapSelectionSettings).find(([startChar, endChar]) => startChar === data || endChar === data); + if (!pair) { + return; + } + const [startChar, endChar = startChar] = pair; + const start = value.start; + const end = value.end + startChar.length; + let newValue = (0,external_wp_richText_namespaceObject.insert)(value, startChar, start, start); + newValue = (0,external_wp_richText_namespaceObject.insert)(newValue, endChar, end, end); + const { + __unstableMarkLastChangeAsPersistent, + __unstableMarkAutomaticChange + } = registry.dispatch(store); + __unstableMarkLastChangeAsPersistent(); + onChange(newValue); + __unstableMarkAutomaticChange(); + const init = {}; + for (const key in event) { + init[key] = event[key]; + } + init.data = endChar; + const { + ownerDocument + } = element; + const { + defaultView + } = ownerDocument; + const newEvent = new defaultView.InputEvent('input', init); + + // Dispatch an `input` event with the new data. This will trigger the + // input rules. + // Postpone the `input` to the next event loop tick so that the dispatch + // doesn't happen synchronously in the middle of `beforeinput` dispatch. + // This is closer to how native `input` event would be timed, and also + // makes sure that the `input` event is dispatched only after the `onChange` + // call few lines above has fully updated the data store state and rerendered + // all affected components. + window.queueMicrotask(() => { + event.target.dispatchEvent(newEvent); + }); + event.preventDefault(); + } + element.addEventListener('beforeinput', onInput); + return () => { + element.removeEventListener('beforeinput', onInput); + }; +}); -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-shortcuts.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/prevent-event-discovery.js /** * WordPress dependencies */ -function useShortcuts(keyboardShortcuts) { - return (0,external_wp_compose_namespaceObject.useRefEffect)(element => { - function onKeyDown(event) { - for (const keyboardShortcut of keyboardShortcuts.current) { - keyboardShortcut(event); - } - } - element.addEventListener('keydown', onKeyDown); - return () => { - element.removeEventListener('keydown', onKeyDown); - }; - }, []); +function preventEventDiscovery(value) { + const searchText = 'tales of gutenberg'; + const addText = ' 🐡🐢🦀🐤🦋🐘🐧🐹🦁🦄🦍🐼🐿🎃🐴🐝🐆🦕🦔🌱🍇π🍌🐉💧🥨🌌🍂🍠🥦🥚🥝🎟🥥🥒🛵🥖🍒🍯🎾🎲🐺🐚🐮⌛️'; + const { + start, + text + } = value; + if (start < searchText.length) { + return value; + } + const charactersBefore = text.slice(start - searchText.length, start); + if (charactersBefore.toLowerCase() !== searchText) { + return value; + } + return (0,external_wp_richText_namespaceObject.insert)(value, addText); } -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-input-events.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/input-rules.js /** * WordPress dependencies */ -function useInputEvents(inputEvents) { - return (0,external_wp_compose_namespaceObject.useRefEffect)(element => { - function onInput(event) { - for (const keyboardShortcut of inputEvents.current) { - keyboardShortcut(event); - } - } - element.addEventListener('input', onInput); - return () => { - element.removeEventListener('input', onInput); - }; - }, []); -} -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-insert-replacement-text.js + /** - * WordPress dependencies + * Internal dependencies */ +function findSelection(blocks) { + let i = blocks.length; + while (i--) { + const attributeKey = retrieveSelectedAttribute(blocks[i].attributes); + if (attributeKey) { + blocks[i].attributes[attributeKey] = blocks[i].attributes[attributeKey] + // To do: refactor this to use rich text's selection instead, so + // we no longer have to use on this hack inserting a special + // character. + .toString().replace(START_OF_SELECTED_AREA, ''); + return [blocks[i].clientId, attributeKey, 0, 0]; + } + const nestedSelection = findSelection(blocks[i].innerBlocks); + if (nestedSelection) { + return nestedSelection; + } + } + return []; +} +/* harmony default export */ const input_rules = (props => element => { + function inputRule() { + const { + getValue, + onReplace, + selectionChange, + registry + } = props.current; + if (!onReplace) { + return; + } + + // We must use getValue() here because value may be update + // asynchronously. + const value = getValue(); + const { + start, + text + } = value; + const characterBefore = text.slice(start - 1, start); + + // The character right before the caret must be a plain space. + if (characterBefore !== ' ') { + return; + } + const trimmedTextBefore = text.slice(0, start).trim(); + const prefixTransforms = (0,external_wp_blocks_namespaceObject.getBlockTransforms)('from').filter(({ + type + }) => type === 'prefix'); + const transformation = (0,external_wp_blocks_namespaceObject.findTransform)(prefixTransforms, ({ + prefix + }) => { + return trimmedTextBefore === prefix; + }); + if (!transformation) { + return; + } + const content = (0,external_wp_richText_namespaceObject.toHTMLString)({ + value: (0,external_wp_richText_namespaceObject.insert)(value, START_OF_SELECTED_AREA, 0, start) + }); + const block = transformation.transform(content); + selectionChange(...findSelection([block])); + onReplace([block]); + registry.dispatch(store).__unstableMarkAutomaticChange(); + return true; + } + function onInput(event) { + const { + inputType, + type + } = event; + const { + getValue, + onChange, + __unstableAllowPrefixTransformations, + formatTypes, + registry + } = props.current; + + // Only run input rules when inserting text. + if (inputType !== 'insertText' && type !== 'compositionend') { + return; + } + if (__unstableAllowPrefixTransformations && inputRule()) { + return; + } + const value = getValue(); + const transformed = formatTypes.reduce((accumlator, { + __unstableInputRule + }) => { + if (__unstableInputRule) { + accumlator = __unstableInputRule(accumlator); + } + return accumlator; + }, preventEventDiscovery(value)); + const { + __unstableMarkLastChangeAsPersistent, + __unstableMarkAutomaticChange + } = registry.dispatch(store); + if (transformed !== value) { + __unstableMarkLastChangeAsPersistent(); + onChange({ + ...transformed, + activeFormats: value.activeFormats + }); + __unstableMarkAutomaticChange(); + } + } + element.addEventListener('input', onInput); + element.addEventListener('compositionend', onInput); + return () => { + element.removeEventListener('input', onInput); + element.removeEventListener('compositionend', onInput); + }; +}); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/insert-replacement-text.js /** * Internal dependencies */ @@ -59522,64 +64108,508 @@ function useInputEvents(inputEvents) { /** * When the browser is about to auto correct, add an undo level so the user can * revert the change. + * + * @param {Object} props + */ +/* harmony default export */ const insert_replacement_text = (props => element => { + function onInput(event) { + if (event.inputType !== 'insertReplacementText') { + return; + } + const { + registry + } = props.current; + registry.dispatch(store).__unstableMarkLastChangeAsPersistent(); + } + element.addEventListener('beforeinput', onInput); + return () => { + element.removeEventListener('beforeinput', onInput); + }; +}); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.js +/** + * WordPress dependencies + */ + + +/** + * Hook to prevent default behaviors for key combinations otherwise handled + * internally by RichText. */ -function useInsertReplacementText() { +/* harmony default export */ const remove_browser_shortcuts = (() => node => { + function onKeydown(event) { + if (external_wp_keycodes_namespaceObject.isKeyboardEvent.primary(event, 'z') || external_wp_keycodes_namespaceObject.isKeyboardEvent.primary(event, 'y') || external_wp_keycodes_namespaceObject.isKeyboardEvent.primaryShift(event, 'z')) { + event.preventDefault(); + } + } + node.addEventListener('keydown', onKeydown); + return () => { + node.removeEventListener('keydown', onKeydown); + }; +}); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/shortcuts.js +/* harmony default export */ const shortcuts = (props => element => { const { - __unstableMarkLastChangeAsPersistent - } = (0,external_wp_data_namespaceObject.useDispatch)(store); - return (0,external_wp_compose_namespaceObject.useRefEffect)(element => { - function onInput(event) { - if (event.inputType === 'insertReplacementText') { - __unstableMarkLastChangeAsPersistent(); - } + keyboardShortcuts + } = props.current; + function onKeyDown(event) { + for (const keyboardShortcut of keyboardShortcuts.current) { + keyboardShortcut(event); } - element.addEventListener('beforeinput', onInput); - return () => { - element.removeEventListener('beforeinput', onInput); - }; - }, []); + } + element.addEventListener('keydown', onKeyDown); + return () => { + element.removeEventListener('keydown', onKeyDown); + }; +}); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/input-events.js +/* harmony default export */ const input_events = (props => element => { + const { + inputEvents + } = props.current; + function onInput(event) { + for (const keyboardShortcut of inputEvents.current) { + keyboardShortcut(event); + } + } + element.addEventListener('input', onInput); + return () => { + element.removeEventListener('input', onInput); + }; +}); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/undo-automatic-change.js +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + +/* harmony default export */ const undo_automatic_change = (props => element => { + function onKeyDown(event) { + const { + keyCode + } = event; + if (event.defaultPrevented) { + return; + } + if (keyCode !== external_wp_keycodes_namespaceObject.BACKSPACE && keyCode !== external_wp_keycodes_namespaceObject.ESCAPE) { + return; + } + const { + registry + } = props.current; + const { + didAutomaticChange, + getSettings + } = registry.select(store); + const { + __experimentalUndo + } = getSettings(); + if (!__experimentalUndo) { + return; + } + if (!didAutomaticChange()) { + return; + } + event.preventDefault(); + __experimentalUndo(); + } + element.addEventListener('keydown', onKeyDown); + return () => { + element.removeEventListener('keydown', onKeyDown); + }; +}); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/utils.js +/** + * WordPress dependencies + */ + + + +function addActiveFormats(value, activeFormats) { + if (activeFormats?.length) { + let index = value.formats.length; + while (index--) { + value.formats[index] = [...activeFormats, ...(value.formats[index] || [])]; + } + } +} + +/** + * Get the multiline tag based on the multiline prop. + * + * @param {?(string|boolean)} multiline The multiline prop. + * + * @return {string | undefined} The multiline tag. + */ +function getMultilineTag(multiline) { + if (multiline !== true && multiline !== 'p' && multiline !== 'li') { + return; + } + return multiline === true ? 'p' : multiline; +} +function getAllowedFormats({ + allowedFormats, + disableFormats +}) { + if (disableFormats) { + return getAllowedFormats.EMPTY_ARRAY; + } + return allowedFormats; +} +getAllowedFormats.EMPTY_ARRAY = []; + +/** + * Creates a link from pasted URL. + * Creates a paragraph block containing a link to the URL, and calls `onReplace`. + * + * @param {string} url The URL that could not be embedded. + * @param {Function} onReplace Function to call with the created fallback block. + */ +function createLinkInParagraph(url, onReplace) { + const link = /*#__PURE__*/_jsx("a", { + href: url, + children: url + }); + onReplace(createBlock('core/paragraph', { + content: renderToString(link) + })); } -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-firefox-compat.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/paste-handler.js /** * WordPress dependencies */ + /** * Internal dependencies */ -function useFirefoxCompat() { + + +/** @typedef {import('@wordpress/rich-text').RichTextValue} RichTextValue */ + +/* harmony default export */ const paste_handler = (props => element => { + function _onPaste(event) { + const { + disableFormats, + onChange, + value, + formatTypes, + tagName, + onReplace, + __unstableEmbedURLOnPaste, + preserveWhiteSpace, + pastePlainText + } = props.current; + + // The event listener is attached to the window, so we need to check if + // the target is the element. + if (event.target !== element) { + return; + } + if (event.defaultPrevented) { + return; + } + const { + plainText, + html + } = getPasteEventData(event); + event.preventDefault(); + + // Allows us to ask for this information when we get a report. + window.console.log('Received HTML:\n\n', html); + window.console.log('Received plain text:\n\n', plainText); + if (disableFormats) { + onChange((0,external_wp_richText_namespaceObject.insert)(value, plainText)); + return; + } + const isInternal = event.clipboardData.getData('rich-text') === 'true'; + function pasteInline(content) { + const transformed = formatTypes.reduce((accumulator, { + __unstablePasteRule + }) => { + // Only allow one transform. + if (__unstablePasteRule && accumulator === value) { + accumulator = __unstablePasteRule(value, { + html, + plainText + }); + } + return accumulator; + }, value); + if (transformed !== value) { + onChange(transformed); + } else { + const valueToInsert = (0,external_wp_richText_namespaceObject.create)({ + html: content + }); + addActiveFormats(valueToInsert, value.activeFormats); + onChange((0,external_wp_richText_namespaceObject.insert)(value, valueToInsert)); + } + } + + // If the data comes from a rich text instance, we can directly use it + // without filtering the data. The filters are only meant for externally + // pasted content and remove inline styles. + if (isInternal) { + pasteInline(html); + return; + } + if (pastePlainText) { + onChange((0,external_wp_richText_namespaceObject.insert)(value, (0,external_wp_richText_namespaceObject.create)({ + text: plainText + }))); + return; + } + let mode = 'INLINE'; + const trimmedPlainText = plainText.trim(); + if (__unstableEmbedURLOnPaste && (0,external_wp_richText_namespaceObject.isEmpty)(value) && (0,external_wp_url_namespaceObject.isURL)(trimmedPlainText) && + // For the link pasting feature, allow only http(s) protocols. + /^https?:/.test(trimmedPlainText)) { + mode = 'BLOCKS'; + } + const content = (0,external_wp_blocks_namespaceObject.pasteHandler)({ + HTML: html, + plainText, + mode, + tagName, + preserveWhiteSpace + }); + if (typeof content === 'string') { + pasteInline(content); + } else if (content.length > 0) { + if (onReplace && (0,external_wp_richText_namespaceObject.isEmpty)(value)) { + onReplace(content, content.length - 1, -1); + } + } + } const { - isMultiSelecting - } = (0,external_wp_data_namespaceObject.useSelect)(store); - return (0,external_wp_compose_namespaceObject.useRefEffect)(element => { - function onFocus() { - if (!isMultiSelecting()) { + defaultView + } = element.ownerDocument; + + // Attach the listener to the window so parent elements have the chance to + // prevent the default behavior. + defaultView.addEventListener('paste', _onPaste); + return () => { + defaultView.removeEventListener('paste', _onPaste); + }; +}); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/delete.js +/** + * WordPress dependencies + */ + + +/* harmony default export */ const event_listeners_delete = (props => element => { + function onKeyDown(event) { + const { + keyCode + } = event; + if (event.defaultPrevented) { + return; + } + const { + value, + onMerge, + onRemove + } = props.current; + if (keyCode === external_wp_keycodes_namespaceObject.DELETE || keyCode === external_wp_keycodes_namespaceObject.BACKSPACE) { + const { + start, + end, + text + } = value; + const isReverse = keyCode === external_wp_keycodes_namespaceObject.BACKSPACE; + const hasActiveFormats = value.activeFormats && !!value.activeFormats.length; + + // Only process delete if the key press occurs at an uncollapsed edge. + if (!(0,external_wp_richText_namespaceObject.isCollapsed)(value) || hasActiveFormats || isReverse && start !== 0 || !isReverse && end !== text.length) { return; } + if (onMerge) { + onMerge(!isReverse); + } + + // Only handle remove on Backspace. This serves dual-purpose of being + // an intentional user interaction distinguishing between Backspace and + // Delete to remove the empty field, but also to avoid merge & remove + // causing destruction of two fields (merge, then removed merged). + else if (onRemove && (0,external_wp_richText_namespaceObject.isEmpty)(value) && isReverse) { + onRemove(!isReverse); + } + event.preventDefault(); + } + } + element.addEventListener('keydown', onKeyDown); + return () => { + element.removeEventListener('keydown', onKeyDown); + }; +}); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/enter.js +/** + * WordPress dependencies + */ + + +/* harmony default export */ const enter = (props => element => { + function onKeyDownDeprecated(event) { + if (event.keyCode !== external_wp_keycodes_namespaceObject.ENTER) { + return; + } + const { + onReplace, + onSplit + } = props.current; + if (onReplace && onSplit) { + event.__deprecatedOnSplit = true; + } + } + function onKeyDown(event) { + if (event.defaultPrevented) { + return; + } - // This is a little hack to work around focus issues with nested - // editable elements in Firefox. For some reason the editable child - // element sometimes regains focus, while it should not be focusable - // and focus should remain on the editable parent element. - // To do: try to find the cause of the shifting focus. - const parentEditable = element.parentElement.closest('[contenteditable="true"]'); - if (parentEditable) { - parentEditable.focus(); + // The event listener is attached to the window, so we need to check if + // the target is the element. + if (event.target !== element) { + return; + } + if (event.keyCode !== external_wp_keycodes_namespaceObject.ENTER) { + return; + } + const { + value, + onChange, + disableLineBreaks, + onSplitAtEnd, + onSplitAtDoubleLineEnd, + registry + } = props.current; + event.preventDefault(); + const { + text, + start, + end + } = value; + if (event.shiftKey) { + if (!disableLineBreaks) { + onChange((0,external_wp_richText_namespaceObject.insert)(value, '\n')); } + } else if (onSplitAtEnd && start === end && end === text.length) { + onSplitAtEnd(); + } else if ( + // For some blocks it's desirable to split at the end of the + // block when there are two line breaks at the end of the + // block, so triple Enter exits the block. + onSplitAtDoubleLineEnd && start === end && end === text.length && text.slice(-2) === '\n\n') { + registry.batch(() => { + const _value = { + ...value + }; + _value.start = _value.end - 2; + onChange((0,external_wp_richText_namespaceObject.remove)(_value)); + onSplitAtDoubleLineEnd(); + }); + } else if (!disableLineBreaks) { + onChange((0,external_wp_richText_namespaceObject.insert)(value, '\n')); + } + } + const { + defaultView + } = element.ownerDocument; + + // Attach the listener to the window so parent elements have the chance to + // prevent the default behavior. + defaultView.addEventListener('keydown', onKeyDown); + element.addEventListener('keydown', onKeyDownDeprecated); + return () => { + defaultView.removeEventListener('keydown', onKeyDown); + element.removeEventListener('keydown', onKeyDownDeprecated); + }; +}); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/firefox-compat.js +/** + * Internal dependencies + */ + +/* harmony default export */ const firefox_compat = (props => element => { + function onFocus() { + const { + registry + } = props.current; + if (!registry.select(store).isMultiSelecting()) { + return; + } + + // This is a little hack to work around focus issues with nested + // editable elements in Firefox. For some reason the editable child + // element sometimes regains focus, while it should not be focusable + // and focus should remain on the editable parent element. + // To do: try to find the cause of the shifting focus. + const parentEditable = element.parentElement.closest('[contenteditable="true"]'); + if (parentEditable) { + parentEditable.focus(); + } + } + element.addEventListener('focus', onFocus); + return () => { + element.removeEventListener('focus', onFocus); + }; +}); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/event-listeners/index.js +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + + + + + + + + + +const allEventListeners = [before_input_rules, input_rules, insert_replacement_text, remove_browser_shortcuts, shortcuts, input_events, undo_automatic_change, paste_handler, event_listeners_delete, enter, firefox_compat]; +function useEventListeners(props) { + const propsRef = (0,external_wp_element_namespaceObject.useRef)(props); + propsRef.current = props; + const refEffects = (0,external_wp_element_namespaceObject.useMemo)(() => allEventListeners.map(refEffect => refEffect(propsRef)), [propsRef]); + return (0,external_wp_compose_namespaceObject.useRefEffect)(element => { + if (!props.isSelected) { + return; } - element.addEventListener('focus', onFocus); + const cleanups = refEffects.map(effect => effect(element)); return () => { - element.removeEventListener('focus', onFocus); + cleanups.forEach(cleanup => cleanup()); }; - }, []); + }, [refEffects, props.isSelected]); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/format-edit.js - /** * WordPress dependencies */ @@ -59590,6 +64620,8 @@ function useFirefoxCompat() { * Internal dependencies */ + + const format_edit_DEFAULT_BLOCK_CONTEXT = {}; const usesContextKey = Symbol('usesContext'); function format_edit_Edit({ @@ -59617,8 +64649,7 @@ function format_edit_Edit({ const isActive = activeFormat !== undefined; const activeObject = (0,external_wp_richText_namespaceObject.getActiveObject)(value); const isObjectActive = activeObject !== undefined && activeObject.type === name; - return (0,external_React_.createElement)(EditFunction, { - key: name, + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditFunction, { isActive: isActive, activeAttributes: isActive ? activeFormat.attributes || {} : {}, isObjectActive: isObjectActive, @@ -59628,13 +64659,13 @@ function format_edit_Edit({ onFocus: onFocus, contentRef: forwardedRef, context: context - }); + }, name); } function FormatEdit({ formatTypes, ...props }) { - return formatTypes.map(settings => (0,external_React_.createElement)(format_edit_Edit, { + return formatTypes.map(settings => /*#__PURE__*/(0,external_React_.createElement)(format_edit_Edit, { settings: settings, ...props, key: settings.name @@ -59642,7 +64673,6 @@ function FormatEdit({ } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/content.js - /** * WordPress dependencies */ @@ -59659,40 +64689,49 @@ function FormatEdit({ * Internal dependencies */ -function Content({ - value, - tagName: Tag, - multiline, - format, - ...props -}) { + +function valueToHTMLString(value, multiline) { if (rich_text.isEmpty(value)) { - const MultilineTag = getMultilineTag(multiline); - value = MultilineTag ? (0,external_React_.createElement)(MultilineTag, null) : null; - } else if (Array.isArray(value)) { + const multilineTag = getMultilineTag(multiline); + return multilineTag ? `<${multilineTag}>` : ''; + } + if (Array.isArray(value)) { external_wp_deprecated_default()('wp.blockEditor.RichText value prop as children type', { since: '6.1', version: '6.3', alternative: 'value prop as string', link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/' }); - value = (0,external_React_.createElement)(external_wp_element_namespaceObject.RawHTML, null, external_wp_blocks_namespaceObject.children.toHTML(value)); - } else if (typeof value === 'string') { - // To do: deprecate. - value = (0,external_React_.createElement)(external_wp_element_namespaceObject.RawHTML, null, value); - } else { - // To do: create a toReactComponent method on RichTextData, which we - // might in the future also use for the editable tree. See - // https://github.com/WordPress/gutenberg/pull/41655. - value = (0,external_React_.createElement)(external_wp_element_namespaceObject.RawHTML, null, value.toHTMLString()); + return external_wp_blocks_namespaceObject.children.toHTML(value); } - return Tag ? (0,external_React_.createElement)(Tag, { - ...props - }, value) : value; + + // To do: deprecate string type. + if (typeof value === 'string') { + return value; + } + + // To do: create a toReactComponent method on RichTextData, which we + // might in the future also use for the editable tree. See + // https://github.com/WordPress/gutenberg/pull/41655. + return value.toHTMLString(); +} +function Content({ + value, + tagName: Tag, + multiline, + format, + ...props +}) { + value = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.RawHTML, { + children: valueToHTMLString(value, multiline) + }); + return Tag ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tag, { + ...props, + children: value + }) : value; } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/multiline.js - /** * WordPress dependencies */ @@ -59700,6 +64739,8 @@ function Content({ + + /** * Internal dependencies */ @@ -59707,6 +64748,7 @@ function Content({ + function RichTextMultiline({ children, identifier, @@ -59725,6 +64767,10 @@ function RichTextMultiline({ const { clientId } = useBlockEditContext(); + const { + getSelectionStart, + getSelectionEnd + } = (0,external_wp_data_namespaceObject.useSelect)(store); const { selectionChange } = (0,external_wp_data_namespaceObject.useDispatch)(store); @@ -59737,50 +64783,75 @@ function RichTextMultiline({ function _onChange(newValues) { onChange(`<${multilineTagName}>${newValues.join(`<${multilineTagName}>`)}`); } - return (0,external_React_.createElement)(TagName, { - ref: forwardedRef - }, values.map((_value, index) => { - return (0,external_React_.createElement)(RichTextWrapper, { - key: index, - identifier: `${identifier}-${index}`, - tagName: multilineTagName, - value: _value, - onChange: newValue => { - const newValues = values.slice(); - newValues[index] = newValue; - _onChange(newValues); - }, - isSelected: undefined, - onSplit: v => v, - onReplace: array => { - const newValues = values.slice(); - newValues.splice(index, 1, ...array); - _onChange(newValues); - selectionChange(clientId, `${identifier}-${index + 1}`, 0, 0); - }, - onMerge: forward => { - const newValues = values.slice(); - let offset = 0; - if (forward) { - if (!newValues[index + 1]) return; - newValues.splice(index, 2, newValues[index] + newValues[index + 1]); - offset = newValues[index].length - 1; - } else { - if (!newValues[index - 1]) return; - newValues.splice(index - 1, 2, newValues[index - 1] + newValues[index]); - offset = newValues[index - 1].length - 1; - } - _onChange(newValues); - selectionChange(clientId, `${identifier}-${index - (forward ? 0 : 1)}`, offset, offset); - }, - ...props - }); - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TagName, { + ref: forwardedRef, + children: values.map((_value, index) => { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RichTextWrapper, { + identifier: `${identifier}-${index}`, + tagName: multilineTagName, + value: _value, + onChange: newValue => { + const newValues = values.slice(); + newValues[index] = newValue; + _onChange(newValues); + }, + isSelected: undefined, + onKeyDown: event => { + if (event.keyCode !== external_wp_keycodes_namespaceObject.ENTER) { + return; + } + event.preventDefault(); + const { + offset: start + } = getSelectionStart(); + const { + offset: end + } = getSelectionEnd(); + + // Cannot split if there is no selection. + if (typeof start !== 'number' || typeof end !== 'number') { + return; + } + const richTextValue = (0,external_wp_richText_namespaceObject.create)({ + html: _value + }); + richTextValue.start = start; + richTextValue.end = end; + const array = (0,external_wp_richText_namespaceObject.split)(richTextValue).map(v => (0,external_wp_richText_namespaceObject.toHTMLString)({ + value: v + })); + const newValues = values.slice(); + newValues.splice(index, 1, ...array); + _onChange(newValues); + selectionChange(clientId, `${identifier}-${index + 1}`, 0, 0); + }, + onMerge: forward => { + const newValues = values.slice(); + let offset = 0; + if (forward) { + if (!newValues[index + 1]) { + return; + } + newValues.splice(index, 2, newValues[index] + newValues[index + 1]); + offset = newValues[index].length - 1; + } else { + if (!newValues[index - 1]) { + return; + } + newValues.splice(index - 1, 2, newValues[index - 1] + newValues[index]); + offset = newValues[index - 1].length - 1; + } + _onChange(newValues); + selectionChange(clientId, `${identifier}-${index - (forward ? 0 : 1)}`, offset, offset); + }, + ...props + }, index); + }) + }); } /* harmony default export */ const multiline = ((0,external_wp_element_namespaceObject.forwardRef)(RichTextMultiline)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/with-deprecations.js - /** * WordPress dependencies */ @@ -59789,11 +64860,11 @@ function RichTextMultiline({ - /** * Internal dependencies */ + function withDeprecations(Component) { return (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { let value = props.value; @@ -59811,10 +64882,8 @@ function withDeprecations(Component) { onChange = newValue => props.onChange(external_wp_blocks_namespaceObject.children.fromDOM((0,external_wp_richText_namespaceObject.__unstableCreateElement)(document, newValue).childNodes)); } const NewComponent = props.multiline ? multiline : Component; - const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(NewComponent); - return (0,external_React_.createElement)(NewComponent, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NewComponent, { ...props, - identifier: props.identifier || instanceId, value: value, onChange: onChange, ref: ref @@ -59823,7 +64892,6 @@ function withDeprecations(Component) { } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/index.js - /** * External dependencies */ @@ -59839,6 +64907,7 @@ function withDeprecations(Component) { + /** * Internal dependencies */ @@ -59856,18 +64925,13 @@ function withDeprecations(Component) { - - - - - - const keyboardShortcutContext = (0,external_wp_element_namespaceObject.createContext)(); const inputEventContext = (0,external_wp_element_namespaceObject.createContext)(); +const instanceIdKey = Symbol('instanceId'); /** * Removes props used for the native version of RichText so that they are not @@ -59892,7 +64956,6 @@ function removeNativeProps(props) { fontStyle, minWidth, maxWidth, - setRef, disableSuggestions, disableAutocorrection, ...restProps @@ -59925,10 +64988,17 @@ function RichTextWrapper({ __unstableDisableFormats: disableFormats, disableLineBreaks, __unstableAllowPrefixTransformations, - disableEditing, + readOnly, ...props }, forwardedRef) { props = removeNativeProps(props); + if (onSplit) { + external_wp_deprecated_default()('wp.blockEditor.RichText onSplit prop', { + since: '6.4', + alternative: 'block.json support key: "splitting"' + }); + } + const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(RichTextWrapper); const anchorRef = (0,external_wp_element_namespaceObject.useRef)(); const context = useBlockEditContext(); const { @@ -59937,6 +65007,7 @@ function RichTextWrapper({ name: blockName } = context; const blockBindings = context[blockBindingsKey]; + const blockContext = (0,external_wp_element_namespaceObject.useContext)(block_context); const selector = select => { // Avoid subscribing to the block editor store if the block is not // selected. @@ -59953,7 +65024,7 @@ function RichTextWrapper({ const selectionEnd = getSelectionEnd(); let isSelected; if (originalIsSelected === undefined) { - isSelected = selectionStart.clientId === clientId && selectionEnd.clientId === clientId && selectionStart.attributeKey === identifier; + isSelected = selectionStart.clientId === clientId && selectionEnd.clientId === clientId && (identifier ? selectionStart.attributeKey === identifier : selectionStart[instanceIdKey] === instanceId); } else if (originalIsSelected) { isSelected = selectionStart.clientId === clientId; } @@ -59967,7 +65038,7 @@ function RichTextWrapper({ selectionStart, selectionEnd, isSelected - } = (0,external_wp_data_namespaceObject.useSelect)(selector, [clientId, identifier, originalIsSelected, isBlockSelected]); + } = (0,external_wp_data_namespaceObject.useSelect)(selector, [clientId, identifier, instanceId, originalIsSelected, isBlockSelected]); const disableBoundBlocks = (0,external_wp_data_namespaceObject.useSelect)(select => { // Disable Rich Text editing if block bindings specify that. let _disableBoundBlocks = false; @@ -59976,14 +65047,18 @@ function RichTextWrapper({ const { getBlockBindingsSource } = unlock(select(external_wp_blocks_namespaceObject.store)); - for (const [attribute, args] of Object.entries(blockBindings)) { + for (const [attribute, binding] of Object.entries(blockBindings)) { if (blockTypeAttributes?.[attribute]?.source !== 'rich-text') { break; } - // If the source is not defined, or if its value of `lockAttributesEditing` is `true`, disable it. - const blockBindingsSource = getBlockBindingsSource(args.source); - if (!blockBindingsSource || blockBindingsSource.lockAttributesEditing) { + // If the source is not defined, or if its value of `canUserEditValue` is `false`, disable it. + const blockBindingsSource = getBlockBindingsSource(binding.source); + if (!blockBindingsSource?.canUserEditValue({ + select, + context: blockContext, + args: binding.args + })) { _disableBoundBlocks = true; break; } @@ -59991,7 +65066,7 @@ function RichTextWrapper({ } return _disableBoundBlocks; }, [blockBindings, blockName]); - const shouldDisableEditing = disableEditing || disableBoundBlocks; + const shouldDisableEditing = readOnly || disableBoundBlocks; const { getSelectionStart, getSelectionEnd, @@ -60008,6 +65083,10 @@ function RichTextWrapper({ const onSelectionChange = (0,external_wp_element_namespaceObject.useCallback)((start, end) => { const selection = {}; const unset = start === undefined && end === undefined; + const baseSelection = { + clientId, + [identifier ? 'attributeKey' : instanceIdKey]: identifier ? identifier : instanceId + }; if (typeof start === 'number' || unset) { // If we are only setting the start (or the end below), which // means a partial selection, and we're not updating a selection @@ -60017,8 +65096,7 @@ function RichTextWrapper({ return; } selection.start = { - clientId, - attributeKey: identifier, + ...baseSelection, offset: start }; } @@ -60027,13 +65105,12 @@ function RichTextWrapper({ return; } selection.end = { - clientId, - attributeKey: identifier, + ...baseSelection, offset: end }; } selectionChange(selection); - }, [clientId, identifier]); + }, [clientId, getBlockRootClientId, getSelectionEnd, getSelectionStart, identifier, instanceId, selectionChange]); const { formatTypes, prepareHandlers, @@ -60104,88 +65181,82 @@ function RichTextWrapper({ function onFocus() { anchorRef.current?.focus(); } + const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const TagName = tagName; - return (0,external_React_.createElement)(external_React_.Fragment, null, isSelected && (0,external_React_.createElement)(keyboardShortcutContext.Provider, { - value: keyboardShortcuts - }, (0,external_React_.createElement)(inputEventContext.Provider, { - value: inputEvents - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Popover.__unstableSlotNameProvider, { - value: "__unstable-block-tools-after" - }, children && children({ - value, - onChange, - onFocus - }), (0,external_React_.createElement)(FormatEdit, { - value: value, - onChange: onChange, - onFocus: onFocus, - formatTypes: formatTypes, - forwardedRef: anchorRef - })))), isSelected && hasFormats && (0,external_React_.createElement)(format_toolbar_container, { - inline: inlineToolbar, - editableContentElement: anchorRef.current, - value: value - }), (0,external_React_.createElement)(TagName - // Overridable props. - , { - role: "textbox", - "aria-multiline": !disableLineBreaks, - "aria-label": placeholder, - "aria-readonly": shouldDisableEditing, - ...props, - ...autocompleteProps, - ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ - // Rich text ref must be first because its focus listener - // must be set up before any other ref calls .focus() on - // mount. - richTextRef, forwardedRef, autocompleteProps.ref, props.ref, useBeforeInputRules({ - value, - onChange - }), useInputRules({ - getValue, - onChange, - __unstableAllowPrefixTransformations, - formatTypes, - onReplace, - selectionChange - }), useInsertReplacementText(), useRemoveBrowserShortcuts(), useShortcuts(keyboardShortcuts), useInputEvents(inputEvents), useUndoAutomaticChange(), usePasteHandler({ - isSelected, - disableFormats, - onChange, - value, - formatTypes, - tagName, - onReplace, - onSplit, - __unstableEmbedURLOnPaste, - pastePlainText - }), useDelete({ - value, - onMerge, - onRemove - }), useEnter({ - removeEditorOnlyFormats, - value, - onReplace, - onSplit, - onChange, - disableLineBreaks, - onSplitAtEnd, - onSplitAtDoubleLineEnd - }), useFirefoxCompat(), anchorRef]), - contentEditable: !shouldDisableEditing, - suppressContentEditableWarning: true, - className: classnames_default()('block-editor-rich-text__editable', props.className, 'rich-text') - // Setting tabIndex to 0 is unnecessary, the element is already - // focusable because it's contentEditable. This also fixes a - // Safari bug where it's not possible to Shift+Click multi - // select blocks when Shift Clicking into an element with - // tabIndex because Safari will focus the element. However, - // Safari will correctly ignore nested contentEditable elements. - , - tabIndex: props.tabIndex === 0 && !shouldDisableEditing ? null : props.tabIndex, - "data-wp-block-attribute-key": identifier - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [isSelected && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboardShortcutContext.Provider, { + value: keyboardShortcuts, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inputEventContext.Provider, { + value: inputEvents, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Popover.__unstableSlotNameProvider, { + value: "__unstable-block-tools-after", + children: [children && children({ + value, + onChange, + onFocus + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FormatEdit, { + value: value, + onChange: onChange, + onFocus: onFocus, + formatTypes: formatTypes, + forwardedRef: anchorRef + })] + }) + }) + }), isSelected && hasFormats && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(format_toolbar_container, { + inline: inlineToolbar, + editableContentElement: anchorRef.current + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TagName + // Overridable props. + , { + role: "textbox", + "aria-multiline": !disableLineBreaks, + "aria-label": placeholder, + "aria-readonly": shouldDisableEditing, + ...props, + ...autocompleteProps, + ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ + // Rich text ref must be first because its focus listener + // must be set up before any other ref calls .focus() on + // mount. + richTextRef, forwardedRef, autocompleteProps.ref, props.ref, useEventListeners({ + registry, + getValue, + onChange, + __unstableAllowPrefixTransformations, + formatTypes, + onReplace, + selectionChange, + isSelected, + disableFormats, + value, + tagName, + onSplit, + __unstableEmbedURLOnPaste, + pastePlainText, + onMerge, + onRemove, + removeEditorOnlyFormats, + disableLineBreaks, + onSplitAtEnd, + onSplitAtDoubleLineEnd, + keyboardShortcuts, + inputEvents + }), anchorRef]), + contentEditable: !shouldDisableEditing, + suppressContentEditableWarning: true, + className: dist_clsx('block-editor-rich-text__editable', props.className, 'rich-text') + // Setting tabIndex to 0 is unnecessary, the element is already + // focusable because it's contentEditable. This also fixes a + // Safari bug where it's not possible to Shift+Click multi + // select blocks when Shift Clicking into an element with + // tabIndex because Safari will focus the element. However, + // Safari will correctly ignore nested contentEditable elements. + , + tabIndex: props.tabIndex === 0 && !shouldDisableEditing ? null : props.tabIndex, + "data-wp-block-attribute-key": identifier + })] + }); } // This is the private API for the RichText component. @@ -60202,10 +65273,50 @@ PrivateRichText.isEmpty = value => { * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md */ const PublicForwardedRichTextContainer = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { - return (0,external_React_.createElement)(PrivateRichText, { + const context = useBlockEditContext(); + const isPreviewMode = context[isPreviewModeKey]; + if (isPreviewMode) { + // Remove all non-content props. + const { + children, + tagName: Tag = 'div', + value, + onChange, + isSelected, + multiline, + inlineToolbar, + wrapperClassName, + autocompleters, + onReplace, + placeholder, + allowedFormats, + withoutInteractiveFormatting, + onRemove, + onMerge, + onSplit, + __unstableOnSplitAtEnd, + __unstableOnSplitAtDoubleLineEnd, + identifier, + preserveWhiteSpace, + __unstablePastePlainText, + __unstableEmbedURLOnPaste, + __unstableDisableFormats, + disableLineBreaks, + __unstableAllowPrefixTransformations, + readOnly, + ...contentProps + } = removeNativeProps(props); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tag, { + ...contentProps, + dangerouslySetInnerHTML: { + __html: valueToHTMLString(value, multiline) + } + }); + } + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateRichText, { ref: ref, ...props, - disableEditing: false + readOnly: false }); }); PublicForwardedRichTextContainer.Content = Content; @@ -60218,7 +65329,6 @@ PublicForwardedRichTextContainer.isEmpty = value => { ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/editable-text/index.js - /** * WordPress dependencies */ @@ -60228,8 +65338,9 @@ PublicForwardedRichTextContainer.isEmpty = value => { * Internal dependencies */ + const EditableText = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { - return (0,external_React_.createElement)(rich_text, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(rich_text, { ref: ref, ...props, __unstableDisableFormats: true @@ -60240,9 +65351,10 @@ EditableText.Content = ({ tagName: Tag = 'div', ...props }) => { - return (0,external_React_.createElement)(Tag, { - ...props - }, value); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tag, { + ...props, + children: value + }); }; /** @@ -60251,7 +65363,6 @@ EditableText.Content = ({ /* harmony default export */ const editable_text = (EditableText); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/plain-text/index.js - /** * External dependencies */ @@ -60271,12 +65382,13 @@ EditableText.Content = ({ /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/plain-text/README.md */ + const PlainText = (0,external_wp_element_namespaceObject.forwardRef)(({ __experimentalVersion, ...props }, ref) => { if (__experimentalVersion === 2) { - return (0,external_React_.createElement)(editable_text, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(editable_text, { ref: ref, ...props }); @@ -60286,9 +65398,9 @@ const PlainText = (0,external_wp_element_namespaceObject.forwardRef)(({ onChange, ...remainingProps } = props; - return (0,external_React_.createElement)(react_autosize_textarea_lib/* default */.A, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(lib/* default */.A, { ref: ref, - className: classnames_default()('block-editor-plain-text', className), + className: dist_clsx('block-editor-plain-text', className), onChange: event => onChange(event.target.value), ...remainingProps }); @@ -60296,13 +65408,15 @@ const PlainText = (0,external_wp_element_namespaceObject.forwardRef)(({ /* harmony default export */ const plain_text = (PlainText); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/responsive-block-control/label.js - /** * WordPress dependencies */ + + + function ResponsiveBlockControlLabel({ property, viewport, @@ -60311,16 +65425,19 @@ function ResponsiveBlockControlLabel({ const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ResponsiveBlockControlLabel); const accessibleLabel = desc || (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: property name. 2: viewport name. */ (0,external_wp_i18n_namespaceObject._x)('Controls the %1$s property for %2$s viewports.', 'Text labelling a interface as controlling a given layout property (eg: margin) for a given screen size.'), property, viewport.label); - return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("span", { - "aria-describedby": `rbc-desc-${instanceId}` - }, viewport.label), (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { - as: "span", - id: `rbc-desc-${instanceId}` - }, accessibleLabel)); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + "aria-describedby": `rbc-desc-${instanceId}`, + children: viewport.label + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { + as: "span", + id: `rbc-desc-${instanceId}`, + children: accessibleLabel + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/responsive-block-control/index.js - /** * External dependencies */ @@ -60337,6 +65454,8 @@ function ResponsiveBlockControlLabel({ * Internal dependencies */ + + function ResponsiveBlockControl(props) { const { title, @@ -60365,38 +65484,42 @@ function ResponsiveBlockControl(props) { return null; } const toggleControlLabel = toggleLabel || (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Property value for the control (eg: margin, padding, etc.). */ - (0,external_wp_i18n_namespaceObject.__)('Use the same %s on all screensizes.'), property); + (0,external_wp_i18n_namespaceObject.__)('Use the same %s on all screen sizes.'), property); const toggleHelpText = (0,external_wp_i18n_namespaceObject.__)('Toggle between using the same value for all screen sizes or using a unique value per screen size.'); - const defaultControl = renderDefaultControl((0,external_React_.createElement)(ResponsiveBlockControlLabel, { + const defaultControl = renderDefaultControl( /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResponsiveBlockControlLabel, { property: property, viewport: defaultLabel }), defaultLabel); const defaultResponsiveControls = () => { - return viewports.map(viewport => (0,external_React_.createElement)(external_wp_element_namespaceObject.Fragment, { - key: viewport.id - }, renderDefaultControl((0,external_React_.createElement)(ResponsiveBlockControlLabel, { - property: property, - viewport: viewport - }), viewport))); + return viewports.map(viewport => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.Fragment, { + children: renderDefaultControl( /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResponsiveBlockControlLabel, { + property: property, + viewport: viewport + }), viewport) + }, viewport.id)); }; - return (0,external_React_.createElement)("fieldset", { - className: "block-editor-responsive-block-control" - }, (0,external_React_.createElement)("legend", { - className: "block-editor-responsive-block-control__title" - }, title), (0,external_React_.createElement)("div", { - className: "block-editor-responsive-block-control__inner" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToggleControl, { - __nextHasNoMarginBottom: true, - className: "block-editor-responsive-block-control__toggle", - label: toggleControlLabel, - checked: !isResponsive, - onChange: onIsResponsiveChange, - help: toggleHelpText - }), (0,external_React_.createElement)("div", { - className: classnames_default()('block-editor-responsive-block-control__group', { - 'is-responsive': isResponsive - }) - }, !isResponsive && defaultControl, isResponsive && (renderResponsiveControls ? renderResponsiveControls(viewports) : defaultResponsiveControls())))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { + className: "block-editor-responsive-block-control", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("legend", { + className: "block-editor-responsive-block-control__title", + children: title + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-responsive-block-control__inner", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { + __nextHasNoMarginBottom: true, + className: "block-editor-responsive-block-control__toggle", + label: toggleControlLabel, + checked: !isResponsive, + onChange: onIsResponsiveChange, + help: toggleHelpText + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: dist_clsx('block-editor-responsive-block-control__group', { + 'is-responsive': isResponsive + }), + children: [!isResponsive && defaultControl, isResponsive && (renderResponsiveControls ? renderResponsiveControls(viewports) : defaultResponsiveControls())] + })] + })] + }); } /* harmony default export */ const responsive_block_control = (ResponsiveBlockControl); @@ -60435,12 +65558,12 @@ function RichTextShortcut({ } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/toolbar-button.js - /** * WordPress dependencies */ + function RichTextToolbarButton({ name, shortcutType, @@ -60455,12 +65578,13 @@ function RichTextToolbarButton({ if (shortcutType && shortcutCharacter) { shortcut = external_wp_keycodes_namespaceObject.displayShortcut[shortcutType](shortcutCharacter); } - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Fill, { - name: fillName - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, { - ...props, - shortcut: shortcut - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, { + name: fillName, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { + ...props, + shortcut: shortcut + }) + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/input-event.js @@ -60496,7 +65620,6 @@ function __unstableRichTextInputEvent({ } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/tool-selector/index.js - /** * WordPress dependencies */ @@ -60510,24 +65633,28 @@ function __unstableRichTextInputEvent({ * Internal dependencies */ -const selectIcon = (0,external_React_.createElement)(external_wp_components_namespaceObject.SVG, { + + + +const selectIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Path, { - d: "M9.4 20.5L5.2 3.8l14.6 9-2 .3c-.2 0-.4.1-.7.1-.9.2-1.6.3-2.2.5-.8.3-1.4.5-1.8.8-.4.3-.8.8-1.3 1.5-.4.5-.8 1.2-1.2 2l-.3.6-.9 1.9zM7.6 7.1l2.4 9.3c.2-.4.5-.8.7-1.1.6-.8 1.1-1.4 1.6-1.8.5-.4 1.3-.8 2.2-1.1l1.2-.3-8.1-5z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { + d: "M9.4 20.5L5.2 3.8l14.6 9-2 .3c-.2 0-.4.1-.7.1-.9.2-1.6.3-2.2.5-.8.3-1.4.5-1.8.8-.4.3-.8.8-1.3 1.5-.4.5-.8 1.2-1.2 2l-.3.6-.9 1.9zM7.6 7.1l2.4 9.3c.2-.4.5-.8.7-1.1.6-.8 1.1-1.4 1.6-1.8.5-.4 1.3-.8 2.2-1.1l1.2-.3-8.1-5z" + }) +}); function ToolSelector(props, ref) { const mode = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).__unstableGetEditorMode(), []); const { __unstableSetEditorMode } = (0,external_wp_data_namespaceObject.useDispatch)(store); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Dropdown, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { renderToggle: ({ isOpen, onToggle - }) => (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { + }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { ...props, ref: ref, icon: mode === 'navigation' ? selectIcon : edit, @@ -60540,30 +65667,37 @@ function ToolSelector(props, ref) { popoverProps: { placement: 'bottom-start' }, - renderContent: () => (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.NavigableMenu, { - role: "menu", - "aria-label": (0,external_wp_i18n_namespaceObject.__)('Tools') - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItemsChoice, { - value: mode === 'navigation' ? 'navigation' : 'edit', - onSelect: __unstableSetEditorMode, - choices: [{ - value: 'edit', - label: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(build_module_icon, { - icon: edit - }), (0,external_wp_i18n_namespaceObject.__)('Edit')) - }, { - value: 'navigation', - label: (0,external_React_.createElement)(external_React_.Fragment, null, selectIcon, (0,external_wp_i18n_namespaceObject.__)('Select')) - }] - })), (0,external_React_.createElement)("div", { - className: "block-editor-tool-selector__help" - }, (0,external_wp_i18n_namespaceObject.__)('Tools provide different interactions for selecting, navigating, and editing blocks. Toggle between select and edit by pressing Escape and Enter.'))) + renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.NavigableMenu, { + role: "menu", + "aria-label": (0,external_wp_i18n_namespaceObject.__)('Tools'), + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItemsChoice, { + value: mode === 'navigation' ? 'navigation' : 'edit', + onSelect: __unstableSetEditorMode, + choices: [{ + value: 'edit', + label: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { + icon: edit + }), (0,external_wp_i18n_namespaceObject.__)('Edit')] + }) + }, { + value: 'navigation', + label: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [selectIcon, (0,external_wp_i18n_namespaceObject.__)('Select')] + }) + }] + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-tool-selector__help", + children: (0,external_wp_i18n_namespaceObject.__)('Tools provide different interactions for selecting, navigating, and editing blocks. Toggle between select and edit by pressing Escape and Enter.') + })] + }) }); } /* harmony default export */ const tool_selector = ((0,external_wp_element_namespaceObject.forwardRef)(ToolSelector)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/unit-control/index.js - /** * WordPress dependencies */ @@ -60573,6 +65707,7 @@ function ToolSelector(props, ref) { * Internal dependencies */ + function UnitControl({ units: unitsProp, ...props @@ -60582,28 +65717,28 @@ function UnitControl({ availableUnits: availableUnits || ['%', 'px', 'em', 'rem', 'vw'], units: unitsProp }); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { units: units, ...props }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-left.js - /** * WordPress dependencies */ -const arrowLeft = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const arrowLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z" + }) +}); /* harmony default export */ const arrow_left = (arrowLeft); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-input/button.js - /** * WordPress dependencies */ @@ -60616,6 +65751,8 @@ const arrowLeft = (0,external_React_.createElement)(external_wp_primitives_names * Internal dependencies */ + + class URLInputButton extends external_wp_element_namespaceObject.Component { constructor() { super(...arguments); @@ -60643,33 +65780,36 @@ class URLInputButton extends external_wp_element_namespaceObject.Component { expanded } = this.state; const buttonLabel = url ? (0,external_wp_i18n_namespaceObject.__)('Edit link') : (0,external_wp_i18n_namespaceObject.__)('Insert link'); - return (0,external_React_.createElement)("div", { - className: "block-editor-url-input__button" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - icon: library_link, - label: buttonLabel, - onClick: this.toggle, - className: "components-toolbar__control", - isPressed: !!url - }), expanded && (0,external_React_.createElement)("form", { - className: "block-editor-url-input__button-modal", - onSubmit: this.submitLink - }, (0,external_React_.createElement)("div", { - className: "block-editor-url-input__button-modal-line" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - className: "block-editor-url-input__back", - icon: arrow_left, - label: (0,external_wp_i18n_namespaceObject.__)('Close'), - onClick: this.toggle - }), (0,external_React_.createElement)(url_input, { - __nextHasNoMarginBottom: true, - value: url || '', - onChange: onChange - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - icon: keyboard_return, - label: (0,external_wp_i18n_namespaceObject.__)('Submit'), - type: "submit" - })))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-url-input__button", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + icon: library_link, + label: buttonLabel, + onClick: this.toggle, + className: "components-toolbar__control", + isPressed: !!url + }), expanded && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { + className: "block-editor-url-input__button-modal", + onSubmit: this.submitLink, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-url-input__button-modal-line", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + className: "block-editor-url-input__back", + icon: arrow_left, + label: (0,external_wp_i18n_namespaceObject.__)('Close'), + onClick: this.toggle + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(url_input, { + __nextHasNoMarginBottom: true, + value: url || '', + onChange: onChange + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + icon: keyboard_return, + label: (0,external_wp_i18n_namespaceObject.__)('Submit'), + type: "submit" + })] + }) + })] + }); } } @@ -60679,21 +65819,21 @@ class URLInputButton extends external_wp_element_namespaceObject.Component { /* harmony default export */ const url_input_button = (URLInputButton); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/image.js - /** * WordPress dependencies */ -const image_image = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const image_image = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z" -})); + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z" + }) +}); /* harmony default export */ const library_image = (image_image); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-popover/image-url-input-ui.js - /** * WordPress dependencies */ @@ -60707,6 +65847,9 @@ const image_image = (0,external_React_.createElement)(external_wp_primitives_nam * Internal dependencies */ + + + const LINK_DESTINATION_NONE = 'none'; const LINK_DESTINATION_CUSTOM = 'custom'; const LINK_DESTINATION_MEDIA = 'media'; @@ -60867,48 +66010,54 @@ const ImageURLInputUI = ({ linkClass: value }); }; - const advancedOptions = (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { - spacing: "3" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToggleControl, { - __nextHasNoMarginBottom: true, - label: (0,external_wp_i18n_namespaceObject.__)('Open in new tab'), - onChange: onSetNewTab, - checked: linkTarget === '_blank' - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, { - __nextHasNoMarginBottom: true, - label: (0,external_wp_i18n_namespaceObject.__)('Link rel'), - value: rel !== null && rel !== void 0 ? rel : '', - onChange: onSetLinkRel - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, { - __nextHasNoMarginBottom: true, - label: (0,external_wp_i18n_namespaceObject.__)('Link CSS class'), - value: linkClass || '', - onChange: onSetLinkClass - })); + const advancedOptions = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { + spacing: "3", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { + __nextHasNoMarginBottom: true, + label: (0,external_wp_i18n_namespaceObject.__)('Open in new tab'), + onChange: onSetNewTab, + checked: linkTarget === '_blank' + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { + __nextHasNoMarginBottom: true, + label: (0,external_wp_i18n_namespaceObject.__)('Link rel'), + value: rel !== null && rel !== void 0 ? rel : '', + onChange: onSetLinkRel + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { + __nextHasNoMarginBottom: true, + label: (0,external_wp_i18n_namespaceObject.__)('Link CSS class'), + value: linkClass || '', + onChange: onSetLinkClass + })] + }); const linkEditorValue = urlInput !== null ? urlInput : url; const hideLightboxPanel = !lightboxEnabled || lightboxEnabled && !showLightboxSetting; const showLinkEditor = !linkEditorValue && hideLightboxPanel; const urlLabel = (getLinkDestinations().find(destination => destination.linkDestination === linkDestination) || {}).title; const PopoverChildren = () => { if (lightboxEnabled && showLightboxSetting && !url && !isEditingLink) { - return (0,external_React_.createElement)("div", { - className: "block-editor-url-popover__expand-on-click" - }, (0,external_React_.createElement)(build_module_icon, { - icon: library_fullscreen - }), (0,external_React_.createElement)("div", { - className: "text" - }, (0,external_React_.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Expand on click')), (0,external_React_.createElement)("p", { - className: "description" - }, (0,external_wp_i18n_namespaceObject.__)('Scales the image with a lightbox effect'))), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - icon: link_off, - label: (0,external_wp_i18n_namespaceObject.__)('Disable expand on click'), - onClick: () => { - onSetLightbox(false); - }, - size: "compact" - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-url-popover__expand-on-click", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, { + icon: library_fullscreen + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "text", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { + children: (0,external_wp_i18n_namespaceObject.__)('Expand on click') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { + className: "description", + children: (0,external_wp_i18n_namespaceObject.__)('Scales the image with a lightbox effect') + })] + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + icon: link_off, + label: (0,external_wp_i18n_namespaceObject.__)('Disable expand on click'), + onClick: () => { + onSetLightbox(false); + }, + size: "compact" + })] + }); } else if (!url || isEditingLink) { - return (0,external_React_.createElement)(url_popover.LinkEditor, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(url_popover.LinkEditor, { className: "block-editor-format-toolbar__link-container-content", value: linkEditorValue, onChangeInputValue: setUrlInput, @@ -60916,63 +66065,70 @@ const ImageURLInputUI = ({ autocompleteRef: autocompleteRef }); } else if (url && !isEditingLink) { - return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(url_popover.LinkViewer, { - className: "block-editor-format-toolbar__link-container-content", - url: url, - onEditLinkClick: startEditLink, - urlLabel: urlLabel - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - icon: link_off, - label: (0,external_wp_i18n_namespaceObject.__)('Remove link'), - onClick: () => { - onLinkRemove(); - resetLightbox(); - }, - size: "compact" - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(url_popover.LinkViewer, { + className: "block-editor-format-toolbar__link-container-content", + url: url, + onEditLinkClick: startEditLink, + urlLabel: urlLabel + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + icon: link_off, + label: (0,external_wp_i18n_namespaceObject.__)('Remove link'), + onClick: () => { + onLinkRemove(); + resetLightbox(); + }, + size: "compact" + })] + }); } }; - return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, { - icon: library_link, - className: "components-toolbar__control", - label: (0,external_wp_i18n_namespaceObject.__)('Link'), - "aria-expanded": isOpen, - onClick: openLinkUI, - ref: setPopoverAnchor, - isActive: !!url || lightboxEnabled && showLightboxSetting - }), isOpen && (0,external_React_.createElement)(url_popover, { - ref: wrapperRef, - anchor: popoverAnchor, - onFocusOutside: onFocusOutside(), - onClose: closeLinkUI, - renderSettings: hideLightboxPanel ? () => advancedOptions : null, - additionalControls: showLinkEditor && (0,external_React_.createElement)(external_wp_components_namespaceObject.NavigableMenu, null, getLinkDestinations().map(link => (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { - key: link.linkDestination, - icon: link.icon, - iconPosition: "left", - onClick: () => { - setUrlInput(null); - onSetHref(link.url); - stopEditLink(); - } - }, link.title)), showLightboxSetting && (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, { - key: "expand-on-click", - className: "block-editor-url-popover__expand-on-click", - icon: library_fullscreen, - info: (0,external_wp_i18n_namespaceObject.__)('Scale the image with a lightbox effect.'), - iconPosition: "left", - onClick: () => { - setUrlInput(null); - onChangeUrl({ - linkDestination: LINK_DESTINATION_NONE, - href: '' - }); - onSetLightbox(true); - stopEditLink(); - } - }, (0,external_wp_i18n_namespaceObject.__)('Expand on click'))), - offset: 13 - }, PopoverChildren())); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { + icon: library_link, + className: "components-toolbar__control", + label: (0,external_wp_i18n_namespaceObject.__)('Link'), + "aria-expanded": isOpen, + onClick: openLinkUI, + ref: setPopoverAnchor, + isActive: !!url || lightboxEnabled && showLightboxSetting + }), isOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(url_popover, { + ref: wrapperRef, + anchor: popoverAnchor, + onFocusOutside: onFocusOutside(), + onClose: closeLinkUI, + renderSettings: hideLightboxPanel ? () => advancedOptions : null, + additionalControls: showLinkEditor && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.NavigableMenu, { + children: [getLinkDestinations().map(link => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { + icon: link.icon, + iconPosition: "left", + onClick: () => { + setUrlInput(null); + onSetHref(link.url); + stopEditLink(); + }, + children: link.title + }, link.linkDestination)), showLightboxSetting && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { + className: "block-editor-url-popover__expand-on-click", + icon: library_fullscreen, + info: (0,external_wp_i18n_namespaceObject.__)('Scale the image with a lightbox effect.'), + iconPosition: "left", + onClick: () => { + setUrlInput(null); + onChangeUrl({ + linkDestination: LINK_DESTINATION_NONE, + href: '' + }); + onSetLightbox(true); + stopEditLink(); + }, + children: (0,external_wp_i18n_namespaceObject.__)('Expand on click') + }, "expand-on-click")] + }), + offset: 13, + children: PopoverChildren() + })] + }); }; @@ -61059,7 +66215,6 @@ function useResizeCanvas(deviceType) { } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/skip-to-selected-block/index.js - /** * WordPress dependencies */ @@ -61072,33 +66227,28 @@ function useResizeCanvas(deviceType) { */ -const SkipToSelectedBlock = ({ - selectedBlockClientId -}) => { + +/** + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/skip-to-selected-block/README.md + */ + +function SkipToSelectedBlock() { + const selectedBlockClientId = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getBlockSelectionStart(), []); const ref = useBlockRef(selectedBlockClientId); const onClick = () => { ref.current.focus(); }; - return selectedBlockClientId ? (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { + return selectedBlockClientId ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { variant: "secondary", className: "block-editor-skip-to-selected-block", - onClick: onClick - }, (0,external_wp_i18n_namespaceObject.__)('Skip to the selected block')) : null; -}; - -/** - * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/skip-to-selected-block/README.md - */ -/* harmony default export */ const skip_to_selected_block = ((0,external_wp_data_namespaceObject.withSelect)(select => { - return { - selectedBlockClientId: select(store).getBlockSelectionStart() - }; -})(SkipToSelectedBlock)); + onClick: onClick, + children: (0,external_wp_i18n_namespaceObject.__)('Skip to the selected block') + }) : null; +} ;// CONCATENATED MODULE: external ["wp","wordcount"] const external_wp_wordcount_namespaceObject = window["wp"]["wordcount"]; ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/multi-selection-inspector/index.js - /** * WordPress dependencies */ @@ -61113,24 +66263,30 @@ const external_wp_wordcount_namespaceObject = window["wp"]["wordcount"]; */ + + function MultiSelectionInspector({ blocks }) { const words = (0,external_wp_wordcount_namespaceObject.count)((0,external_wp_blocks_namespaceObject.serialize)(blocks), 'words'); - return (0,external_React_.createElement)("div", { - className: "block-editor-multi-selection-inspector__card" - }, (0,external_React_.createElement)(block_icon, { - icon: library_copy, - showColors: true - }), (0,external_React_.createElement)("div", { - className: "block-editor-multi-selection-inspector__card-content" - }, (0,external_React_.createElement)("div", { - className: "block-editor-multi-selection-inspector__card-title" - }, (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of blocks */ - (0,external_wp_i18n_namespaceObject._n)('%d Block', '%d Blocks', blocks.length), blocks.length)), (0,external_React_.createElement)("div", { - className: "block-editor-multi-selection-inspector__card-description" - }, (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of words */ - (0,external_wp_i18n_namespaceObject._n)('%d word selected.', '%d words selected.', words), words)))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-multi-selection-inspector__card", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { + icon: library_copy, + showColors: true + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-multi-selection-inspector__card-content", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-multi-selection-inspector__card-title", + children: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of blocks */ + (0,external_wp_i18n_namespaceObject._n)('%d Block', '%d Blocks', blocks.length), blocks.length) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-multi-selection-inspector__card-description", + children: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of words */ + (0,external_wp_i18n_namespaceObject._n)('%d word selected.', '%d words selected.', words), words) + })] + })] + }); } /* harmony default export */ const multi_selection_inspector = ((0,external_wp_data_namespaceObject.withSelect)(select => { const { @@ -61141,98 +66297,36 @@ function MultiSelectionInspector({ }; })(MultiSelectionInspector)); -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/default-style-picker/index.js - -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - -function DefaultStylePicker({ - blockName -}) { - const { - preferredStyle, - onUpdatePreferredStyleVariations, - styles - } = (0,external_wp_data_namespaceObject.useSelect)(select => { - var _preferredStyleVariat; - const settings = select(store).getSettings(); - const preferredStyleVariations = settings.__experimentalPreferredStyleVariations; - return { - preferredStyle: preferredStyleVariations?.value?.[blockName], - onUpdatePreferredStyleVariations: (_preferredStyleVariat = preferredStyleVariations?.onChange) !== null && _preferredStyleVariat !== void 0 ? _preferredStyleVariat : null, - styles: select(external_wp_blocks_namespaceObject.store).getBlockStyles(blockName) - }; - }, [blockName]); - const selectOptions = (0,external_wp_element_namespaceObject.useMemo)(() => [{ - label: (0,external_wp_i18n_namespaceObject.__)('Not set'), - value: '' - }, ...styles.map(({ - label, - name - }) => ({ - label, - value: name - }))], [styles]); - const defaultStyleName = (0,external_wp_element_namespaceObject.useMemo)(() => getDefaultStyle(styles)?.name, [styles]); - const selectOnChange = (0,external_wp_element_namespaceObject.useCallback)(blockStyle => { - onUpdatePreferredStyleVariations(blockName, blockStyle); - }, [blockName, onUpdatePreferredStyleVariations]); - - // Until the functionality is migrated to global styles, - // only show the default style picker if a non-default style has already been selected. - if (!preferredStyle || preferredStyle === defaultStyleName) { - return null; - } - return onUpdatePreferredStyleVariations && (0,external_React_.createElement)("div", { - className: "default-style-picker__default-switcher" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.SelectControl, { - __nextHasNoMarginBottom: true, - options: selectOptions, - value: preferredStyle || '', - label: (0,external_wp_i18n_namespaceObject.__)('Default Style'), - onChange: selectOnChange - })); -} - ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cog.js - /** * WordPress dependencies */ -const cog = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const cog = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.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" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.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" + }) +}); /* harmony default export */ const library_cog = (cog); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/styles.js - /** * WordPress dependencies */ -const styles = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const styles = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z" -})); + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { + d: "M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z" + }) +}); /* harmony default export */ const library_styles = (styles); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/utils.js @@ -61264,7 +66358,6 @@ const TAB_LIST_VIEW = { }; ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/advanced-controls-panel.js - /** * WordPress dependencies */ @@ -61275,24 +66368,25 @@ const TAB_LIST_VIEW = { * Internal dependencies */ + const AdvancedControls = () => { const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(InspectorAdvancedControls.slotName); const hasFills = Boolean(fills && fills.length); if (!hasFills) { return null; } - return (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { className: "block-editor-block-inspector__advanced", title: (0,external_wp_i18n_namespaceObject.__)('Advanced'), - initialOpen: false - }, (0,external_React_.createElement)(inspector_controls.Slot, { - group: "advanced" - })); + initialOpen: false, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { + group: "advanced" + }) + }); }; /* harmony default export */ const advanced_controls_panel = (AdvancedControls); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/position-controls-panel.js - /** * WordPress dependencies */ @@ -61307,6 +66401,7 @@ const AdvancedControls = () => { + const PositionControlsPanel = () => { const [initialOpen, setInitialOpen] = (0,external_wp_element_namespaceObject.useState)(); @@ -61332,13 +66427,14 @@ const PositionControlsPanel = () => { }) => !!attributes?.style?.position?.type)); } }, [initialOpen, multiSelectedBlocks, setInitialOpen]); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { className: "block-editor-block-inspector__position", title: (0,external_wp_i18n_namespaceObject.__)('Position'), - initialOpen: initialOpen !== null && initialOpen !== void 0 ? initialOpen : false - }, (0,external_React_.createElement)(inspector_controls.Slot, { - group: "position" - })); + initialOpen: initialOpen !== null && initialOpen !== void 0 ? initialOpen : false, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { + group: "position" + }) + }); }; const PositionControls = () => { const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(inspector_controls_groups.position.Slot.__unstableName); @@ -61346,26 +66442,26 @@ const PositionControls = () => { if (!hasFills) { return null; } - return (0,external_React_.createElement)(PositionControlsPanel, null); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PositionControlsPanel, {}); }; /* harmony default export */ const position_controls_panel = (PositionControls); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js - /** * WordPress dependencies */ -const close_close = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { + +const close_close = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.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" -})); + viewBox: "0 0 24 24", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.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" + }) +}); /* harmony default export */ const library_close = (close_close); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/settings-tab-hint.js - /** * WordPress dependencies */ @@ -61376,6 +66472,8 @@ const close_close = (0,external_React_.createElement)(external_wp_primitives_nam + + const PREFERENCE_NAME = 'isInspectorControlsTabsHintVisible'; function InspectorControlsTabsHint() { const isInspectorControlsTabsHintVisible = (0,external_wp_data_namespaceObject.useSelect)(select => { @@ -61389,28 +66487,29 @@ function InspectorControlsTabsHint() { if (!isInspectorControlsTabsHintVisible) { return null; } - return (0,external_React_.createElement)("div", { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ref: ref, - className: "block-editor-inspector-controls-tabs__hint" - }, (0,external_React_.createElement)("div", { - className: "block-editor-inspector-controls-tabs__hint-content" - }, (0,external_wp_i18n_namespaceObject.__)("Looking for other block settings? They've moved to the styles tab.")), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - className: "block-editor-inspector-controls-tabs__hint-dismiss", - icon: library_close, - iconSize: "16", - label: (0,external_wp_i18n_namespaceObject.__)('Dismiss hint'), - onClick: () => { - // Retain focus when dismissing the element. - const previousElement = external_wp_dom_namespaceObject.focus.tabbable.findPrevious(ref.current); - previousElement?.focus(); - setPreference('core', PREFERENCE_NAME, false); - }, - showTooltip: false - })); + className: "block-editor-inspector-controls-tabs__hint", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-inspector-controls-tabs__hint-content", + children: (0,external_wp_i18n_namespaceObject.__)("Looking for other block settings? They've moved to the styles tab.") + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + className: "block-editor-inspector-controls-tabs__hint-dismiss", + icon: library_close, + iconSize: "16", + label: (0,external_wp_i18n_namespaceObject.__)('Dismiss hint'), + onClick: () => { + // Retain focus when dismissing the element. + const previousElement = external_wp_dom_namespaceObject.focus.tabbable.findPrevious(ref.current); + previousElement?.focus(); + setPreference('core', PREFERENCE_NAME, false); + }, + showTooltip: false + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/settings-tab.js - /** * Internal dependencies */ @@ -61418,20 +66517,25 @@ function InspectorControlsTabsHint() { + + + const SettingsTab = ({ showAdvancedControls = false -}) => (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(inspector_controls.Slot, null), (0,external_React_.createElement)(position_controls_panel, null), showAdvancedControls && (0,external_React_.createElement)("div", null, (0,external_React_.createElement)(advanced_controls_panel, null)), (0,external_React_.createElement)(InspectorControlsTabsHint, null)); +}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(position_controls_panel, {}), showAdvancedControls && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(advanced_controls_panel, {}) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InspectorControlsTabsHint, {})] +}); /* harmony default export */ const settings_tab = (SettingsTab); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/styles-tab.js - /** * WordPress dependencies */ - /** * Internal dependencies */ @@ -61439,6 +66543,8 @@ const SettingsTab = ({ + + const StylesTab = ({ blockName, clientId, @@ -61447,33 +66553,36 @@ const StylesTab = ({ const borderPanelLabel = useBorderPanelLabel({ blockName }); - return (0,external_React_.createElement)(external_React_.Fragment, null, hasBlockStyles && (0,external_React_.createElement)("div", null, (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, { - title: (0,external_wp_i18n_namespaceObject.__)('Styles') - }, (0,external_React_.createElement)(block_styles, { - clientId: clientId - }), (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, 'defaultStylePicker', true) && (0,external_React_.createElement)(DefaultStylePicker, { - blockName: blockName - }))), (0,external_React_.createElement)(inspector_controls.Slot, { - group: "color", - label: (0,external_wp_i18n_namespaceObject.__)('Color'), - className: "color-block-support-panel__inner-wrapper" - }), (0,external_React_.createElement)(inspector_controls.Slot, { - group: "background", - label: (0,external_wp_i18n_namespaceObject.__)('Background') - }), (0,external_React_.createElement)(inspector_controls.Slot, { - group: "filter" - }), (0,external_React_.createElement)(inspector_controls.Slot, { - group: "typography", - label: (0,external_wp_i18n_namespaceObject.__)('Typography') - }), (0,external_React_.createElement)(inspector_controls.Slot, { - group: "dimensions", - label: (0,external_wp_i18n_namespaceObject.__)('Dimensions') - }), (0,external_React_.createElement)(inspector_controls.Slot, { - group: "border", - label: borderPanelLabel - }), (0,external_React_.createElement)(inspector_controls.Slot, { - group: "styles" - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [hasBlockStyles && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { + title: (0,external_wp_i18n_namespaceObject.__)('Styles'), + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_styles, { + clientId: clientId + }) + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { + group: "color", + label: (0,external_wp_i18n_namespaceObject.__)('Color'), + className: "color-block-support-panel__inner-wrapper" + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { + group: "background", + label: (0,external_wp_i18n_namespaceObject.__)('Background image') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { + group: "filter" + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { + group: "typography", + label: (0,external_wp_i18n_namespaceObject.__)('Typography') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { + group: "dimensions", + label: (0,external_wp_i18n_namespaceObject.__)('Dimensions') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { + group: "border", + label: borderPanelLabel + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { + group: "styles" + })] + }); }; /* harmony default export */ const styles_tab = (StylesTab); @@ -61487,12 +66596,13 @@ const useIsListViewTabDisabled = blockName => { /* harmony default export */ const use_is_list_view_tab_disabled = (useIsListViewTabDisabled); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/index.js - /** * WordPress dependencies */ + + /** * Internal dependencies */ @@ -61502,6 +66612,8 @@ const useIsListViewTabDisabled = blockName => { + + const { Tabs: inspector_controls_tabs_Tabs } = unlock(external_wp_components_namespaceObject.privateApis); @@ -61511,43 +66623,53 @@ function InspectorControlsTabs({ hasBlockStyles, tabs }) { + const showIconLabels = (0,external_wp_data_namespaceObject.useSelect)(select => { + return select(external_wp_preferences_namespaceObject.store).get('core', 'showIconLabels'); + }, []); + // The tabs panel will mount before fills are rendered to the list view // slot. This means the list view tab isn't initially included in the // available tabs so the panel defaults selection to the settings tab // which at the time is the first tab. This check allows blocks known to // include the list view tab to set it as the tab selected by default. const initialTabName = !use_is_list_view_tab_disabled(blockName) ? TAB_LIST_VIEW.name : undefined; - return (0,external_React_.createElement)("div", { - className: "block-editor-block-inspector__tabs" - }, (0,external_React_.createElement)(inspector_controls_tabs_Tabs, { - initialTabId: initialTabName, - key: clientId - }, (0,external_React_.createElement)(inspector_controls_tabs_Tabs.TabList, null, tabs.map(tab => (0,external_React_.createElement)(inspector_controls_tabs_Tabs.Tab, { - key: tab.name, - tabId: tab.name, - render: (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - icon: tab.icon, - label: tab.title, - className: tab.className - }) - }))), (0,external_React_.createElement)(inspector_controls_tabs_Tabs.TabPanel, { - tabId: TAB_SETTINGS.name, - focusable: false - }, (0,external_React_.createElement)(settings_tab, { - showAdvancedControls: !!blockName - })), (0,external_React_.createElement)(inspector_controls_tabs_Tabs.TabPanel, { - tabId: TAB_STYLES.name, - focusable: false - }, (0,external_React_.createElement)(styles_tab, { - blockName: blockName, - clientId: clientId, - hasBlockStyles: hasBlockStyles - })), (0,external_React_.createElement)(inspector_controls_tabs_Tabs.TabPanel, { - tabId: TAB_LIST_VIEW.name, - focusable: false - }, (0,external_React_.createElement)(inspector_controls.Slot, { - group: "list" - })))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "block-editor-block-inspector__tabs", + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(inspector_controls_tabs_Tabs, { + defaultTabId: initialTabName, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_tabs_Tabs.TabList, { + children: tabs.map(tab => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_tabs_Tabs.Tab, { + tabId: tab.name, + render: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + icon: !showIconLabels ? tab.icon : undefined, + label: !showIconLabels ? tab.title : undefined, + className: tab.className, + children: showIconLabels && tab.title + }) + }, tab.name)) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_tabs_Tabs.TabPanel, { + tabId: TAB_SETTINGS.name, + focusable: false, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(settings_tab, { + showAdvancedControls: !!blockName + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_tabs_Tabs.TabPanel, { + tabId: TAB_STYLES.name, + focusable: false, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(styles_tab, { + blockName: blockName, + clientId: clientId, + hasBlockStyles: hasBlockStyles + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls_tabs_Tabs.TabPanel, { + tabId: TAB_LIST_VIEW.name, + focusable: false, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { + group: "list" + }) + })] + }, clientId) + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js @@ -61637,7 +66759,7 @@ function useInspectorControlsTabs(blockName) { * Internal dependencies */ -function useBlockInspectorAnimationSettings(blockType, selectedBlockClientId) { +function useBlockInspectorAnimationSettings(blockType) { return (0,external_wp_data_namespaceObject.useSelect)(select => { if (blockType) { const globalBlockInspectorAnimationSettings = select(store).getSettings().blockInspectorAnimation; @@ -61661,11 +66783,10 @@ function useBlockInspectorAnimationSettings(blockType, selectedBlockClientId) { return globalBlockInspectorAnimationSettings?.[blockType.name]; } return null; - }, [selectedBlockClientId, blockType]); + }, [blockType]); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-info-slot-fill/index.js - /** * WordPress dependencies */ @@ -61676,6 +66797,7 @@ function useBlockInspectorAnimationSettings(blockType, selectedBlockClientId) { */ + const { createPrivateSlotFill } = unlock(external_wp_components_namespaceObject.privateApis); @@ -61688,17 +66810,16 @@ const BlockInfo = props => { if (!context[mayDisplayControlsKey]) { return null; } - return (0,external_React_.createElement)(block_info_slot_fill_Fill, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_info_slot_fill_Fill, { ...props }); }; -BlockInfo.Slot = props => (0,external_React_.createElement)(block_info_slot_fill_Slot, { +BlockInfo.Slot = props => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_info_slot_fill_Slot, { ...props }); /* harmony default export */ const block_info_slot_fill = (BlockInfo); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-quick-navigation/index.js - /** * WordPress dependencies */ @@ -61711,18 +66832,20 @@ BlockInfo.Slot = props => (0,external_React_.createElement)(block_info_slot_fill */ + + function BlockQuickNavigation({ clientIds }) { if (!clientIds.length) { return null; } - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { - spacing: 1 - }, clientIds.map(clientId => (0,external_React_.createElement)(BlockQuickNavigationItem, { - key: clientId, - clientId: clientId - }))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { + spacing: 1, + children: clientIds.map(clientId => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockQuickNavigationItem, { + clientId: clientId + }, clientId)) + }); } function BlockQuickNavigationItem({ clientId @@ -61752,20 +66875,27 @@ function BlockQuickNavigationItem({ const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(store); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { isPressed: isSelected, - onClick: () => selectBlock(clientId) - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)(block_icon, { - icon: icon - })), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexBlock, { - style: { - textAlign: 'left' - } - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, null, name)))); + onClick: () => selectBlock(clientId), + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_icon, { + icon: icon + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { + style: { + textAlign: 'left' + }, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { + children: name + }) + })] + }) + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-inspector/index.js - /** * WordPress dependencies */ @@ -61794,6 +66924,9 @@ function BlockQuickNavigationItem({ + + + function BlockInspectorLockedBlocks({ topLevelLockedBlock }) { @@ -61806,18 +66939,20 @@ function BlockInspectorLockedBlocks({ return getClientIdsOfDescendants(topLevelLockedBlock).filter(clientId => getBlockName(clientId) !== 'core/list-item' && getBlockEditingMode(clientId) === 'contentOnly'); }, [topLevelLockedBlock]); const blockInformation = useBlockDisplayInformation(topLevelLockedBlock); - return (0,external_React_.createElement)("div", { - className: "block-editor-block-inspector" - }, (0,external_React_.createElement)(block_card, { - ...blockInformation, - className: blockInformation.isSynced && 'is-synced' - }), (0,external_React_.createElement)(block_variation_transforms, { - blockClientId: topLevelLockedBlock - }), (0,external_React_.createElement)(block_info_slot_fill.Slot, null), contentClientIds.length > 0 && (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, { - title: (0,external_wp_i18n_namespaceObject.__)('Content') - }, (0,external_React_.createElement)(BlockQuickNavigation, { - clientIds: contentClientIds - }))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-block-inspector", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_card, { + ...blockInformation, + className: blockInformation.isSynced && 'is-synced' + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_variation_transforms, { + blockClientId: topLevelLockedBlock + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_info_slot_fill.Slot, {}), contentClientIds.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { + title: (0,external_wp_i18n_namespaceObject.__)('Content'), + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockQuickNavigation, { + clientIds: contentClientIds + }) + })] + }); } const BlockInspector = ({ showNoBlockSelectedMessage = true @@ -61833,9 +66968,9 @@ const BlockInspector = ({ getSelectedBlockClientId, getSelectedBlockCount, getBlockName, - __unstableGetContentLockingParent, + getContentLockingParent, getTemplateLock - } = select(store); + } = unlock(select(store)); const _selectedBlockClientId = getSelectedBlockClientId(); const _selectedBlockName = _selectedBlockClientId && getBlockName(_selectedBlockClientId); const _blockType = _selectedBlockName && (0,external_wp_blocks_namespaceObject.getBlockType)(_selectedBlockName); @@ -61844,7 +66979,7 @@ const BlockInspector = ({ selectedBlockClientId: _selectedBlockClientId, selectedBlockName: _selectedBlockName, blockType: _blockType, - topLevelLockedBlock: __unstableGetContentLockingParent(_selectedBlockClientId) || (getTemplateLock(_selectedBlockClientId) === 'contentOnly' || _selectedBlockName === 'core/block' ? _selectedBlockClientId : undefined) + topLevelLockedBlock: getContentLockingParent(_selectedBlockClientId) || (getTemplateLock(_selectedBlockClientId) === 'contentOnly' || _selectedBlockName === 'core/block' ? _selectedBlockClientId : undefined) }; }, []); const availableTabs = useInspectorControlsTabs(blockType?.name); @@ -61856,31 +66991,34 @@ const BlockInspector = ({ // displays based on the relationship between the selected block // and its parent, and only enable it if the parent is controlling // its children blocks. - const blockInspectorAnimationSettings = useBlockInspectorAnimationSettings(blockType, selectedBlockClientId); + const blockInspectorAnimationSettings = useBlockInspectorAnimationSettings(blockType); const borderPanelLabel = useBorderPanelLabel({ blockName: selectedBlockName }); if (count > 1) { - return (0,external_React_.createElement)("div", { - className: "block-editor-block-inspector" - }, (0,external_React_.createElement)(multi_selection_inspector, null), showTabs ? (0,external_React_.createElement)(InspectorControlsTabs, { - tabs: availableTabs - }) : (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(inspector_controls.Slot, null), (0,external_React_.createElement)(inspector_controls.Slot, { - group: "color", - label: (0,external_wp_i18n_namespaceObject.__)('Color'), - className: "color-block-support-panel__inner-wrapper" - }), (0,external_React_.createElement)(inspector_controls.Slot, { - group: "typography", - label: (0,external_wp_i18n_namespaceObject.__)('Typography') - }), (0,external_React_.createElement)(inspector_controls.Slot, { - group: "dimensions", - label: (0,external_wp_i18n_namespaceObject.__)('Dimensions') - }), (0,external_React_.createElement)(inspector_controls.Slot, { - group: "border", - label: borderPanelLabel - }), (0,external_React_.createElement)(inspector_controls.Slot, { - group: "styles" - }))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-block-inspector", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(multi_selection_inspector, {}), showTabs ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InspectorControlsTabs, { + tabs: availableTabs + }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { + group: "color", + label: (0,external_wp_i18n_namespaceObject.__)('Color'), + className: "color-block-support-panel__inner-wrapper" + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { + group: "typography", + label: (0,external_wp_i18n_namespaceObject.__)('Typography') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { + group: "dimensions", + label: (0,external_wp_i18n_namespaceObject.__)('Dimensions') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { + group: "border", + label: borderPanelLabel + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { + group: "styles" + })] + })] + }); } const isSelectedBlockUnregistered = selectedBlockName === (0,external_wp_blocks_namespaceObject.getUnregisteredTypeHandlerName)(); @@ -61890,27 +67028,30 @@ const BlockInspector = ({ */ if (!blockType || !selectedBlockClientId || isSelectedBlockUnregistered) { if (showNoBlockSelectedMessage) { - return (0,external_React_.createElement)("span", { - className: "block-editor-block-inspector__no-blocks" - }, (0,external_wp_i18n_namespaceObject.__)('No block selected.')); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { + className: "block-editor-block-inspector__no-blocks", + children: (0,external_wp_i18n_namespaceObject.__)('No block selected.') + }); } return null; } if (topLevelLockedBlock) { - return (0,external_React_.createElement)(BlockInspectorLockedBlocks, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockInspectorLockedBlocks, { topLevelLockedBlock: topLevelLockedBlock }); } - return (0,external_React_.createElement)(BlockInspectorSingleBlockWrapper, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockInspectorSingleBlockWrapper, { animate: blockInspectorAnimationSettings, - wrapper: children => (0,external_React_.createElement)(AnimatedContainer, { + wrapper: children => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AnimatedContainer, { blockInspectorAnimationSettings: blockInspectorAnimationSettings, - selectedBlockClientId: selectedBlockClientId - }, children) - }, (0,external_React_.createElement)(BlockInspectorSingleBlock, { - clientId: selectedBlockClientId, - blockName: blockType.name - })); + selectedBlockClientId: selectedBlockClientId, + children: children + }), + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockInspectorSingleBlock, { + clientId: selectedBlockClientId, + blockName: blockType.name + }) + }); }; const BlockInspectorSingleBlockWrapper = ({ animate, @@ -61925,7 +67066,7 @@ const AnimatedContainer = ({ children }) => { const animationOrigin = blockInspectorAnimationSettings && blockInspectorAnimationSettings.enterDirection === 'leftToRight' ? -50 : 50; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { animate: { x: 0, opacity: 1, @@ -61938,8 +67079,8 @@ const AnimatedContainer = ({ x: animationOrigin, opacity: 0 }, - key: selectedBlockClientId - }, children); + children: children + }, selectedBlockClientId); }; const BlockInspectorSingleBlock = ({ clientId, @@ -61958,47 +67099,51 @@ const BlockInspectorSingleBlock = ({ const borderPanelLabel = useBorderPanelLabel({ blockName }); - return (0,external_React_.createElement)("div", { - className: "block-editor-block-inspector" - }, (0,external_React_.createElement)(block_card, { - ...blockInformation, - className: blockInformation.isSynced && 'is-synced' - }), (0,external_React_.createElement)(block_variation_transforms, { - blockClientId: clientId - }), (0,external_React_.createElement)(block_info_slot_fill.Slot, null), showTabs && (0,external_React_.createElement)(InspectorControlsTabs, { - hasBlockStyles: hasBlockStyles, - clientId: clientId, - blockName: blockName, - tabs: availableTabs - }), !showTabs && (0,external_React_.createElement)(external_React_.Fragment, null, hasBlockStyles && (0,external_React_.createElement)("div", null, (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, { - title: (0,external_wp_i18n_namespaceObject.__)('Styles') - }, (0,external_React_.createElement)(block_styles, { - clientId: clientId - }), (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, 'defaultStylePicker', true) && (0,external_React_.createElement)(DefaultStylePicker, { - blockName: blockName - }))), (0,external_React_.createElement)(inspector_controls.Slot, null), (0,external_React_.createElement)(inspector_controls.Slot, { - group: "list" - }), (0,external_React_.createElement)(inspector_controls.Slot, { - group: "color", - label: (0,external_wp_i18n_namespaceObject.__)('Color'), - className: "color-block-support-panel__inner-wrapper" - }), (0,external_React_.createElement)(inspector_controls.Slot, { - group: "typography", - label: (0,external_wp_i18n_namespaceObject.__)('Typography') - }), (0,external_React_.createElement)(inspector_controls.Slot, { - group: "dimensions", - label: (0,external_wp_i18n_namespaceObject.__)('Dimensions') - }), (0,external_React_.createElement)(inspector_controls.Slot, { - group: "border", - label: borderPanelLabel - }), (0,external_React_.createElement)(inspector_controls.Slot, { - group: "styles" - }), (0,external_React_.createElement)(inspector_controls.Slot, { - group: "background", - label: (0,external_wp_i18n_namespaceObject.__)('Background') - }), (0,external_React_.createElement)(position_controls_panel, null), (0,external_React_.createElement)("div", null, (0,external_React_.createElement)(advanced_controls_panel, null))), (0,external_React_.createElement)(skip_to_selected_block, { - key: "back" - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + className: "block-editor-block-inspector", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_card, { + ...blockInformation, + className: blockInformation.isSynced && 'is-synced' + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_variation_transforms, { + blockClientId: clientId + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_info_slot_fill.Slot, {}), showTabs && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InspectorControlsTabs, { + hasBlockStyles: hasBlockStyles, + clientId: clientId, + blockName: blockName, + tabs: availableTabs + }), !showTabs && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [hasBlockStyles && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { + title: (0,external_wp_i18n_namespaceObject.__)('Styles'), + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_styles, { + clientId: clientId + }) + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { + group: "list" + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { + group: "color", + label: (0,external_wp_i18n_namespaceObject.__)('Color'), + className: "color-block-support-panel__inner-wrapper" + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { + group: "typography", + label: (0,external_wp_i18n_namespaceObject.__)('Typography') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { + group: "dimensions", + label: (0,external_wp_i18n_namespaceObject.__)('Dimensions') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { + group: "border", + label: borderPanelLabel + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { + group: "styles" + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls.Slot, { + group: "background", + label: (0,external_wp_i18n_namespaceObject.__)('Background image') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(position_controls_panel, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(advanced_controls_panel, {}) + })] + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SkipToSelectedBlock, {}, "back")] + }); }; /** @@ -62007,7 +67152,6 @@ const BlockInspectorSingleBlock = ({ /* harmony default export */ const block_inspector = (BlockInspector); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/copy-handler/index.js - /** * WordPress dependencies */ @@ -62021,6 +67165,7 @@ const BlockInspectorSingleBlock = ({ /** * @deprecated */ + const __unstableUseClipboardHandler = () => { external_wp_deprecated_default()('__unstableUseClipboardHandler', { alternative: 'BlockCanvas or WritingFlow', @@ -62040,14 +67185,13 @@ function CopyHandler(props) { since: '6.4', version: '6.7' }); - return (0,external_React_.createElement)("div", { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...props, ref: useClipboardHandler() }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/library.js - /** * WordPress dependencies */ @@ -62059,6 +67203,7 @@ function CopyHandler(props) { */ + const library_noop = () => {}; function InserterLibrary({ rootClientId, @@ -62067,9 +67212,13 @@ function InserterLibrary({ showInserterHelpPanel, showMostUsedBlocks = false, __experimentalInsertionIndex, + __experimentalInitialTab, + __experimentalInitialCategory, __experimentalFilterValue, + onPatternCategorySelection, onSelect = library_noop, - shouldFocusBlock = false + shouldFocusBlock = false, + onClose }, ref) { const { destinationRootClientId @@ -62082,7 +67231,7 @@ function InserterLibrary({ destinationRootClientId: _rootClientId }; }, [clientId, rootClientId]); - return (0,external_React_.createElement)(menu, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateInserterMenu, { onSelect: onSelect, rootClientId: destinationRootClientId, clientId: clientId, @@ -62091,11 +67240,23 @@ function InserterLibrary({ showMostUsedBlocks: showMostUsedBlocks, __experimentalInsertionIndex: __experimentalInsertionIndex, __experimentalFilterValue: __experimentalFilterValue, + onPatternCategorySelection: onPatternCategorySelection, + __experimentalInitialTab: __experimentalInitialTab, + __experimentalInitialCategory: __experimentalInitialCategory, shouldFocusBlock: shouldFocusBlock, + ref: ref, + onClose: onClose + }); +} +const PrivateInserterLibrary = (0,external_wp_element_namespaceObject.forwardRef)(InserterLibrary); +function PublicInserterLibrary(props, ref) { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateInserterLibrary, { + ...props, + onPatternCategorySelection: undefined, ref: ref }); } -/* harmony default export */ const library = ((0,external_wp_element_namespaceObject.forwardRef)(InserterLibrary)); +/* harmony default export */ const library = ((0,external_wp_element_namespaceObject.forwardRef)(PublicInserterLibrary)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/selection-scroll-into-view/index.js /** @@ -62118,7 +67279,6 @@ function MultiSelectScrollIntoView() { } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/typewriter/index.js - /** * WordPress dependencies */ @@ -62131,6 +67291,7 @@ function MultiSelectScrollIntoView() { * Internal dependencies */ + const isIE = window.navigator.userAgent.indexOf('Trident') !== -1; const arrowKeyCodes = new Set([external_wp_keycodes_namespaceObject.UP, external_wp_keycodes_namespaceObject.DOWN, external_wp_keycodes_namespaceObject.LEFT, external_wp_keycodes_namespaceObject.RIGHT]); const initialTriggerPercentage = 0.75; @@ -62314,10 +67475,11 @@ function useTypewriter() { function Typewriter({ children }) { - return (0,external_React_.createElement)("div", { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ref: useTypewriter(), - className: "block-editor__typewriter" - }, children); + className: "block-editor__typewriter", + children: children + }); } /** @@ -62337,7 +67499,6 @@ const TypewriterOrIEBypass = isIE ? props => props.children : Typewriter; /* harmony default export */ const typewriter = (TypewriterOrIEBypass); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/recursion-provider/index.js - /** * WordPress dependencies */ @@ -62348,6 +67509,7 @@ const TypewriterOrIEBypass = isIE ? props => props.children : Typewriter; * Internal dependencies */ + const RenderedRefsContext = (0,external_wp_element_namespaceObject.createContext)({}); /** @@ -62393,9 +67555,10 @@ function RecursionProvider({ } = useBlockEditContext(); blockName = blockName || name; const newRenderedBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => addToBlockType(previouslyRenderedBlocks, blockName, uniqueId), [previouslyRenderedBlocks, blockName, uniqueId]); - return (0,external_React_.createElement)(RenderedRefsContext.Provider, { - value: newRenderedBlocks - }, children); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RenderedRefsContext.Provider, { + value: newRenderedBlocks, + children: children + }); } /** @@ -62424,7 +67587,7 @@ const DeprecatedExperimentalRecursionProvider = props => { since: '6.5', alternative: 'wp.blockEditor.RecursionProvider' }); - return (0,external_React_.createElement)(RecursionProvider, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RecursionProvider, { ...props }); }; @@ -62436,25 +67599,12 @@ const DeprecatedExperimentalUseHasRecursion = (...args) => { return useHasRecursion(...args); }; -;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js - +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-popover-header/index.js /** * WordPress dependencies */ -const closeSmall = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.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" -})); -/* harmony default export */ const close_small = (closeSmall); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-popover-header/index.js -/** - * WordPress dependencies - */ @@ -62464,36 +67614,40 @@ function InspectorPopoverHeader({ actions = [], onClose }) { - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { className: "block-editor-inspector-popover-header", - spacing: 4 - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { - alignment: "center" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHeading, { - className: "block-editor-inspector-popover-header__heading", - level: 2, - size: 13 - }, title), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, null), actions.map(({ - label, - icon, - onClick - }) => (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - key: label, - className: "block-editor-inspector-popover-header__action", - label: label, - icon: icon, - variant: !icon && 'tertiary', - onClick: onClick - }, !icon && label)), onClose && (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - className: "block-editor-inspector-popover-header__action", - label: (0,external_wp_i18n_namespaceObject.__)('Close'), - icon: close_small, - onClick: onClose - })), help && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, null, help)); + spacing: 4, + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { + alignment: "center", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, { + className: "block-editor-inspector-popover-header__heading", + level: 2, + size: 13, + children: title + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}), actions.map(({ + label, + icon, + onClick + }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + className: "block-editor-inspector-popover-header__action", + label: label, + icon: icon, + variant: !icon && 'tertiary', + onClick: onClick, + children: !icon && label + }, label)), onClose && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + className: "block-editor-inspector-popover-header__action", + label: (0,external_wp_i18n_namespaceObject.__)('Close'), + icon: close_small, + onClick: onClose + })] + }), help && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { + children: help + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/publish-date-time-picker/index.js - /** * WordPress dependencies */ @@ -62506,383 +67660,51 @@ function InspectorPopoverHeader({ * Internal dependencies */ + + function PublishDateTimePicker({ onClose, onChange, + showPopoverHeaderActions, + isCompact, + currentDate, ...additionalProps }, ref) { - return (0,external_React_.createElement)("div", { - ref: ref, - className: "block-editor-publish-date-time-picker" - }, (0,external_React_.createElement)(InspectorPopoverHeader, { - title: (0,external_wp_i18n_namespaceObject.__)('Publish'), - actions: [{ - label: (0,external_wp_i18n_namespaceObject.__)('Now'), - onClick: () => onChange?.(null) - }], - onClose: onClose - }), (0,external_React_.createElement)(external_wp_components_namespaceObject.DateTimePicker, { + const datePickerProps = { startOfWeek: (0,external_wp_date_namespaceObject.getSettings)().l10n.startOfWeek, - onChange: onChange, + onChange, + currentDate: isCompact ? undefined : currentDate, + currentTime: isCompact ? currentDate : undefined, ...additionalProps - })); -} -/* harmony default export */ const publish_date_time_picker = ((0,external_wp_element_namespaceObject.forwardRef)(PublishDateTimePicker)); - -;// CONCATENATED MODULE: external ["wp","commands"] -const external_wp_commands_namespaceObject = window["wp"]["commands"]; -;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/move-to.js - -/** - * WordPress dependencies - */ - -const move_to_moveTo = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M19.75 9c0-1.257-.565-2.197-1.39-2.858-.797-.64-1.827-1.017-2.815-1.247-1.802-.42-3.703-.403-4.383-.396L11 4.5V6l.177-.001c.696-.006 2.416-.02 4.028.356.887.207 1.67.518 2.216.957.52.416.829.945.829 1.688 0 .592-.167.966-.407 1.23-.255.281-.656.508-1.236.674-1.19.34-2.82.346-4.607.346h-.077c-1.692 0-3.527 0-4.942.404-.732.209-1.424.545-1.935 1.108-.526.579-.796 1.33-.796 2.238 0 1.257.565 2.197 1.39 2.858.797.64 1.827 1.017 2.815 1.247 1.802.42 3.703.403 4.383.396L13 19.5h.714V22L18 18.5 13.714 15v3H13l-.177.001c-.696.006-2.416.02-4.028-.356-.887-.207-1.67-.518-2.216-.957-.52-.416-.829-.945-.829-1.688 0-.592.167-.966.407-1.23.255-.281.656-.508 1.237-.674 1.189-.34 2.819-.346 4.606-.346h.077c1.692 0 3.527 0 4.941-.404.732-.209 1.425-.545 1.936-1.108.526-.579.796-1.33.796-2.238z" -})); -/* harmony default export */ const move_to = (move_to_moveTo); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/ungroup.js - -/** - * WordPress dependencies - */ - -const ungroup = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M18 4h-7c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 9c0 .3-.2.5-.5.5h-7c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v7zm-5 5c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h1V9H6c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2v-1h-1.5v1z" -})); -/* harmony default export */ const library_ungroup = (ungroup); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/trash.js - -/** - * WordPress dependencies - */ - -const trash = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, { - fillRule: "evenodd", - clipRule: "evenodd", - d: "M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z" -})); -/* harmony default export */ const library_trash = (trash); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-block-commands/index.js - -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - -const useTransformCommands = () => { - const { - replaceBlocks, - multiSelect - } = (0,external_wp_data_namespaceObject.useDispatch)(store); - const { - blocks, - clientIds, - canRemove, - possibleBlockTransformations - } = (0,external_wp_data_namespaceObject.useSelect)(select => { - const { - getBlockRootClientId, - getBlockTransformItems, - getSelectedBlockClientIds, - getBlocksByClientId, - canRemoveBlocks - } = select(store); - const selectedBlockClientIds = getSelectedBlockClientIds(); - const selectedBlocks = getBlocksByClientId(selectedBlockClientIds); - const rootClientId = getBlockRootClientId(selectedBlockClientIds[0]); - return { - blocks: selectedBlocks, - clientIds: selectedBlockClientIds, - possibleBlockTransformations: getBlockTransformItems(selectedBlocks, rootClientId), - canRemove: canRemoveBlocks(selectedBlockClientIds, rootClientId) - }; - }, []); - const isTemplate = blocks.length === 1 && (0,external_wp_blocks_namespaceObject.isTemplatePart)(blocks[0]); - function selectForMultipleBlocks(insertedBlocks) { - if (insertedBlocks.length > 1) { - multiSelect(insertedBlocks[0].clientId, insertedBlocks[insertedBlocks.length - 1].clientId); - } - } - - // Simple block tranformation based on the `Block Transforms` API. - function onBlockTransform(name) { - const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, name); - replaceBlocks(clientIds, newBlocks); - selectForMultipleBlocks(newBlocks); - } - - /** - * The `isTemplate` check is a stopgap solution here. - * Ideally, the Transforms API should handle this - * by allowing to exclude blocks from wildcard transformations. - */ - const hasPossibleBlockTransformations = !!possibleBlockTransformations.length && canRemove && !isTemplate; - if (!clientIds || clientIds.length < 1 || !hasPossibleBlockTransformations) { - return { - isLoading: false, - commands: [] - }; - } - const commands = possibleBlockTransformations.map(transformation => { - const { - name, - title, - icon - } = transformation; - return { - name: 'core/block-editor/transform-to-' + name.replace('/', '-'), - // translators: %s: block title/name. - label: (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Transform to %s'), title), - icon: (0,external_React_.createElement)(block_icon, { - icon: icon - }), - callback: ({ - close - }) => { - onBlockTransform(name); - close(); - } - }; - }); - return { - isLoading: false, - commands - }; -}; -const useActionsCommands = () => { - const { - clientIds - } = (0,external_wp_data_namespaceObject.useSelect)(select => { - const { - getSelectedBlockClientIds - } = select(store); - const selectedBlockClientIds = getSelectedBlockClientIds(); - return { - clientIds: selectedBlockClientIds - }; - }, []); - const { - getBlockRootClientId, - canMoveBlocks, - getBlockCount - } = (0,external_wp_data_namespaceObject.useSelect)(store); - const { - setBlockMovingClientId, - setNavigationMode, - selectBlock - } = (0,external_wp_data_namespaceObject.useDispatch)(store); - if (!clientIds || clientIds.length < 1) { - return { - isLoading: false, - commands: [] - }; - } - const rootClientId = getBlockRootClientId(clientIds[0]); - const canMove = canMoveBlocks(clientIds, rootClientId) && getBlockCount(rootClientId) !== 1; - const commands = []; - if (canMove) { - commands.push({ - name: 'move-to', - label: (0,external_wp_i18n_namespaceObject.__)('Move to'), - callback: () => { - setNavigationMode(true); - selectBlock(clientIds[0]); - setBlockMovingClientId(clientIds[0]); - }, - icon: move_to - }); - } - return { - isLoading: false, - commands: commands.map(command => ({ - ...command, - name: 'core/block-editor/action-' + command.name, - callback: ({ - close - }) => { - command.callback(); - close(); - } - })) - }; -}; -const useQuickActionsCommands = () => { - const { - clientIds, - isUngroupable, - isGroupable - } = (0,external_wp_data_namespaceObject.useSelect)(select => { - const { - getSelectedBlockClientIds, - isUngroupable: _isUngroupable, - isGroupable: _isGroupable - } = select(store); - const selectedBlockClientIds = getSelectedBlockClientIds(); - return { - clientIds: selectedBlockClientIds, - isUngroupable: _isUngroupable(), - isGroupable: _isGroupable() - }; - }, []); - const { - canInsertBlockType, - getBlockRootClientId, - getBlocksByClientId, - canRemoveBlocks - } = (0,external_wp_data_namespaceObject.useSelect)(store); - const { - getDefaultBlockName, - getGroupingBlockName - } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); - const blocks = getBlocksByClientId(clientIds); - const { - removeBlocks, - replaceBlocks, - duplicateBlocks, - insertAfterBlock, - insertBeforeBlock - } = (0,external_wp_data_namespaceObject.useDispatch)(store); - const onGroup = () => { - if (!blocks.length) { - return; - } - const groupingBlockName = getGroupingBlockName(); - - // Activate the `transform` on `core/group` which does the conversion. - const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, groupingBlockName); - if (!newBlocks) { - return; - } - replaceBlocks(clientIds, newBlocks); - }; - const onUngroup = () => { - if (!blocks.length) { - return; - } - const innerBlocks = blocks[0].innerBlocks; - if (!innerBlocks.length) { - return; - } - replaceBlocks(clientIds, innerBlocks); - }; - if (!clientIds || clientIds.length < 1) { - return { - isLoading: false, - commands: [] - }; - } - const rootClientId = getBlockRootClientId(clientIds[0]); - const canInsertDefaultBlock = canInsertBlockType(getDefaultBlockName(), rootClientId); - const canDuplicate = blocks.every(block => { - return !!block && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, 'multiple', true) && canInsertBlockType(block.name, rootClientId); - }); - const canRemove = canRemoveBlocks(clientIds, rootClientId); - const commands = []; - if (canDuplicate) { - commands.push({ - name: 'duplicate', - label: (0,external_wp_i18n_namespaceObject.__)('Duplicate'), - callback: () => duplicateBlocks(clientIds, true), - icon: library_copy - }); - } - if (canInsertDefaultBlock) { - commands.push({ - name: 'add-before', - label: (0,external_wp_i18n_namespaceObject.__)('Add before'), - callback: () => { - const clientId = Array.isArray(clientIds) ? clientIds[0] : clientId; - insertBeforeBlock(clientId); - }, - icon: library_plus - }, { - name: 'add-after', - label: (0,external_wp_i18n_namespaceObject.__)('Add after'), - callback: () => { - const clientId = Array.isArray(clientIds) ? clientIds[clientIds.length - 1] : clientId; - insertAfterBlock(clientId); - }, - icon: library_plus - }); - } - if (isGroupable) { - commands.push({ - name: 'Group', - label: (0,external_wp_i18n_namespaceObject.__)('Group'), - callback: onGroup, - icon: library_group - }); - } - if (isUngroupable) { - commands.push({ - name: 'ungroup', - label: (0,external_wp_i18n_namespaceObject.__)('Ungroup'), - callback: onUngroup, - icon: library_ungroup - }); - } - if (canRemove) { - commands.push({ - name: 'remove', - label: (0,external_wp_i18n_namespaceObject.__)('Delete'), - callback: () => removeBlocks(clientIds, true), - icon: library_trash - }); - } - return { - isLoading: false, - commands: commands.map(command => ({ - ...command, - name: 'core/block-editor/action-' + command.name, - callback: ({ - close - }) => { - command.callback(); - close(); - } - })) }; -}; -const useBlockCommands = () => { - (0,external_wp_commands_namespaceObject.useCommandLoader)({ - name: 'core/block-editor/blockTransforms', - hook: useTransformCommands - }); - (0,external_wp_commands_namespaceObject.useCommandLoader)({ - name: 'core/block-editor/blockActions', - hook: useActionsCommands + const DatePickerComponent = isCompact ? external_wp_components_namespaceObject.TimePicker : external_wp_components_namespaceObject.DateTimePicker; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { + ref: ref, + className: "block-editor-publish-date-time-picker", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InspectorPopoverHeader, { + title: (0,external_wp_i18n_namespaceObject.__)('Publish'), + actions: showPopoverHeaderActions ? [{ + label: (0,external_wp_i18n_namespaceObject.__)('Now'), + onClick: () => onChange?.(null) + }] : undefined, + onClose: onClose + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DatePickerComponent, { + ...datePickerProps + })] }); - (0,external_wp_commands_namespaceObject.useCommandLoader)({ - name: 'core/block-editor/blockQuickActions', - hook: useQuickActionsCommands, - context: 'block-selection-edit' +} +const PrivatePublishDateTimePicker = (0,external_wp_element_namespaceObject.forwardRef)(PublishDateTimePicker); +function PublicPublishDateTimePicker(props, ref) { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivatePublishDateTimePicker, { + ...props, + showPopoverHeaderActions: true, + isCompact: false, + ref: ref }); -}; +} +/* harmony default export */ const publish_date_time_picker = ((0,external_wp_element_namespaceObject.forwardRef)(PublicPublishDateTimePicker)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/reusable-block-rename-hint.js - /** * WordPress dependencies */ @@ -62893,6 +67715,8 @@ const useBlockCommands = () => { + + const reusable_block_rename_hint_PREFERENCE_NAME = 'isResuableBlocksrRenameHintVisible'; /* * This hook was added in 6.3 to help users with the transition from Reusable blocks to Patterns. @@ -62923,24 +67747,26 @@ function ReusableBlocksRenameHint() { if (!isReusableBlocksRenameHint) { return null; } - return (0,external_React_.createElement)("div", { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ref: ref, - className: "reusable-blocks-menu-items__rename-hint" - }, (0,external_React_.createElement)("div", { - className: "reusable-blocks-menu-items__rename-hint-content" - }, (0,external_wp_i18n_namespaceObject.__)('Reusable blocks are now synced patterns. A synced pattern will behave in exactly the same way as a reusable block.')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - className: "reusable-blocks-menu-items__rename-hint-dismiss", - icon: library_close, - iconSize: "16", - label: (0,external_wp_i18n_namespaceObject.__)('Dismiss hint'), - onClick: () => { - // Retain focus when dismissing the element. - const previousElement = external_wp_dom_namespaceObject.focus.tabbable.findPrevious(ref.current); - previousElement?.focus(); - setPreference('core', reusable_block_rename_hint_PREFERENCE_NAME, false); - }, - showTooltip: false - })); + className: "reusable-blocks-menu-items__rename-hint", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { + className: "reusable-blocks-menu-items__rename-hint-content", + children: (0,external_wp_i18n_namespaceObject.__)('Reusable blocks are now synced patterns. A synced pattern will behave in exactly the same way as a reusable block.') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + className: "reusable-blocks-menu-items__rename-hint-dismiss", + icon: library_close, + iconSize: "16", + label: (0,external_wp_i18n_namespaceObject.__)('Dismiss hint'), + onClick: () => { + // Retain focus when dismissing the element. + const previousElement = external_wp_dom_namespaceObject.focus.tabbable.findPrevious(ref.current); + previousElement?.focus(); + setPreference('core', reusable_block_rename_hint_PREFERENCE_NAME, false); + }, + showTooltip: false + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/index.js @@ -63046,982 +67872,57 @@ function ReusableBlocksRenameHint() { - - - - - - - - - - - - - -/* - * State Related Components - */ - - - - - -/* - * The following rename hint component can be removed in 6.4. - */ - - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/elements/index.js -const ELEMENT_CLASS_NAMES = { - button: 'wp-element-button', - caption: 'wp-element-caption' -}; -const __experimentalGetElementClassName = element => { - return ELEMENT_CLASS_NAMES[element] ? ELEMENT_CLASS_NAMES[element] : ''; -}; - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/get-px-from-css-unit.js -/** - * This function was accidentially exposed for mobile/native usage. - * - * @deprecated - * - * @return {string} Empty string. - */ -/* harmony default export */ const get_px_from_css_unit = (() => ''); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/index.js - - - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/use-global-styles-output.js -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - - - - - - - - - - - - -// List of block support features that can have their related styles -// generated under their own feature level selector rather than the block's. -const BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS = { - __experimentalBorder: 'border', - color: 'color', - spacing: 'spacing', - typography: 'typography' -}; -function compileStyleValue(uncompiledValue) { - const VARIABLE_REFERENCE_PREFIX = 'var:'; - const VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|'; - const VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--'; - if (uncompiledValue?.startsWith?.(VARIABLE_REFERENCE_PREFIX)) { - const variable = uncompiledValue.slice(VARIABLE_REFERENCE_PREFIX.length).split(VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE).join(VARIABLE_PATH_SEPARATOR_TOKEN_STYLE); - return `var(--wp--${variable})`; - } - return uncompiledValue; -} - -/** - * Transform given preset tree into a set of style declarations. - * - * @param {Object} blockPresets - * @param {Object} mergedSettings Merged theme.json settings. - * - * @return {Array} An array of style declarations. - */ -function getPresetsDeclarations(blockPresets = {}, mergedSettings) { - const { - kebabCase - } = unlock(external_wp_components_namespaceObject.privateApis); - return PRESET_METADATA.reduce((declarations, { - path, - valueKey, - valueFunc, - cssVarInfix - }) => { - const presetByOrigin = getValueFromObjectPath(blockPresets, path, []); - ['default', 'theme', 'custom'].forEach(origin => { - if (presetByOrigin[origin]) { - presetByOrigin[origin].forEach(value => { - if (valueKey && !valueFunc) { - declarations.push(`--wp--preset--${cssVarInfix}--${kebabCase(value.slug)}: ${value[valueKey]}`); - } else if (valueFunc && typeof valueFunc === 'function') { - declarations.push(`--wp--preset--${cssVarInfix}--${kebabCase(value.slug)}: ${valueFunc(value, mergedSettings)}`); - } - }); - } - }); - return declarations; - }, []); -} - -/** - * Transform given preset tree into a set of preset class declarations. - * - * @param {?string} blockSelector - * @param {Object} blockPresets - * @return {string} CSS declarations for the preset classes. - */ -function getPresetsClasses(blockSelector = '*', blockPresets = {}) { - const { - kebabCase - } = unlock(external_wp_components_namespaceObject.privateApis); - return PRESET_METADATA.reduce((declarations, { - path, - cssVarInfix, - classes - }) => { - if (!classes) { - return declarations; - } - const presetByOrigin = getValueFromObjectPath(blockPresets, path, []); - ['default', 'theme', 'custom'].forEach(origin => { - if (presetByOrigin[origin]) { - presetByOrigin[origin].forEach(({ - slug - }) => { - classes.forEach(({ - classSuffix, - propertyName - }) => { - const classSelectorToUse = `.has-${kebabCase(slug)}-${classSuffix}`; - const selectorToUse = blockSelector.split(',') // Selector can be "h1, h2, h3" - .map(selector => `${selector}${classSelectorToUse}`).join(','); - const value = `var(--wp--preset--${cssVarInfix}--${kebabCase(slug)})`; - declarations += `${selectorToUse}{${propertyName}: ${value} !important;}`; - }); - }); - } - }); - return declarations; - }, ''); -} -function getPresetsSvgFilters(blockPresets = {}) { - return PRESET_METADATA.filter( - // Duotone are the only type of filters for now. - metadata => metadata.path.at(-1) === 'duotone').flatMap(metadata => { - const presetByOrigin = getValueFromObjectPath(blockPresets, metadata.path, {}); - return ['default', 'theme'].filter(origin => presetByOrigin[origin]).flatMap(origin => presetByOrigin[origin].map(preset => getDuotoneFilter(`wp-duotone-${preset.slug}`, preset.colors))).join(''); - }); -} -function flattenTree(input = {}, prefix, token) { - const { - kebabCase - } = unlock(external_wp_components_namespaceObject.privateApis); - let result = []; - Object.keys(input).forEach(key => { - const newKey = prefix + kebabCase(key.replace('/', '-')); - const newLeaf = input[key]; - if (newLeaf instanceof Object) { - const newPrefix = newKey + token; - result = [...result, ...flattenTree(newLeaf, newPrefix, token)]; - } else { - result.push(`${newKey}: ${newLeaf}`); - } - }); - return result; -} - -/** - * Gets variation selector string from feature selector. - * - * @param {string} featureSelector The feature selector. - * - * @param {string} styleVariationSelector The style variation selector. - * @return {string} Combined selector string. - */ -function concatFeatureVariationSelectorString(featureSelector, styleVariationSelector) { - const featureSelectors = featureSelector.split(','); - const combinedSelectors = []; - featureSelectors.forEach(selector => { - combinedSelectors.push(`${styleVariationSelector.trim()}${selector.trim()}`); - }); - return combinedSelectors.join(', '); -} - -/** - * Generate style declarations for a block's custom feature and subfeature - * selectors. - * - * NOTE: The passed `styles` object will be mutated by this function. - * - * @param {Object} selectors Custom selectors object for a block. - * @param {Object} styles A block's styles object. - * - * @return {Object} Style declarations. - */ -const getFeatureDeclarations = (selectors, styles) => { - const declarations = {}; - Object.entries(selectors).forEach(([feature, selector]) => { - // We're only processing features/subfeatures that have styles. - if (feature === 'root' || !styles?.[feature]) { - return; - } - const isShorthand = typeof selector === 'string'; - - // If we have a selector object instead of shorthand process it. - if (!isShorthand) { - Object.entries(selector).forEach(([subfeature, subfeatureSelector]) => { - // Don't process root feature selector yet or any - // subfeature that doesn't have a style. - if (subfeature === 'root' || !styles?.[feature][subfeature]) { - return; - } - - // Create a temporary styles object and build - // declarations for subfeature. - const subfeatureStyles = { - [feature]: { - [subfeature]: styles[feature][subfeature] - } - }; - const newDeclarations = getStylesDeclarations(subfeatureStyles); - - // Merge new declarations in with any others that - // share the same selector. - declarations[subfeatureSelector] = [...(declarations[subfeatureSelector] || []), ...newDeclarations]; - - // Remove the subfeature's style now it will be - // included under its own selector not the block's. - delete styles[feature][subfeature]; - }); - } - - // Now subfeatures have been processed and removed, we can - // process root, or shorthand, feature selectors. - if (isShorthand || selector.root) { - const featureSelector = isShorthand ? selector : selector.root; - - // Create temporary style object and build declarations for feature. - const featureStyles = { - [feature]: styles[feature] - }; - const newDeclarations = getStylesDeclarations(featureStyles); - - // Merge new declarations with any others that share the selector. - declarations[featureSelector] = [...(declarations[featureSelector] || []), ...newDeclarations]; - - // Remove the feature from the block's styles now as it will be - // included under its own selector not the block's. - delete styles[feature]; - } - }); - return declarations; -}; - -/** - * Transform given style tree into a set of style declarations. - * - * @param {Object} blockStyles Block styles. - * - * @param {string} selector The selector these declarations should attach to. - * - * @param {boolean} useRootPaddingAlign Whether to use CSS custom properties in root selector. - * - * @param {Object} tree A theme.json tree containing layout definitions. - * - * @param {boolean} isTemplate Whether the entity being edited is a full template or a pattern. - * @return {Array} An array of style declarations. - */ -function getStylesDeclarations(blockStyles = {}, selector = '', useRootPaddingAlign, tree = {}, isTemplate = true) { - const { - kebabCase - } = unlock(external_wp_components_namespaceObject.privateApis); - const isRoot = ROOT_BLOCK_SELECTOR === selector; - const output = Object.entries(external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY).reduce((declarations, [key, { - value, - properties, - useEngine, - rootOnly - }]) => { - if (rootOnly && !isRoot) { - return declarations; - } - const pathToValue = value; - if (pathToValue[0] === 'elements' || useEngine) { - return declarations; - } - const styleValue = getValueFromObjectPath(blockStyles, pathToValue); - - // Root-level padding styles don't currently support strings with CSS shorthand values. - // This may change: https://github.com/WordPress/gutenberg/issues/40132. - if (key === '--wp--style--root--padding' && (typeof styleValue === 'string' || !useRootPaddingAlign)) { - return declarations; - } - if (properties && typeof styleValue !== 'string') { - Object.entries(properties).forEach(entry => { - const [name, prop] = entry; - if (!getValueFromObjectPath(styleValue, [prop], false)) { - // Do not create a declaration - // for sub-properties that don't have any value. - return; - } - const cssProperty = name.startsWith('--') ? name : kebabCase(name); - declarations.push(`${cssProperty}: ${compileStyleValue(getValueFromObjectPath(styleValue, [prop]))}`); - }); - } else if (getValueFromObjectPath(blockStyles, pathToValue, false)) { - const cssProperty = key.startsWith('--') ? key : kebabCase(key); - declarations.push(`${cssProperty}: ${compileStyleValue(getValueFromObjectPath(blockStyles, pathToValue))}`); - } - return declarations; - }, []); - - // The goal is to move everything to server side generated engine styles - // This is temporary as we absorb more and more styles into the engine. - const extraRules = (0,external_wp_styleEngine_namespaceObject.getCSSRules)(blockStyles); - extraRules.forEach(rule => { - // Don't output padding properties if padding variables are set or if we're not editing a full template. - if (isRoot && (useRootPaddingAlign || !isTemplate) && rule.key.startsWith('padding')) { - return; - } - const cssProperty = rule.key.startsWith('--') ? rule.key : kebabCase(rule.key); - let ruleValue = rule.value; - if (typeof ruleValue !== 'string' && ruleValue?.ref) { - const refPath = ruleValue.ref.split('.'); - ruleValue = getValueFromObjectPath(tree, refPath); - // Presence of another ref indicates a reference to another dynamic value. - // Pointing to another dynamic value is not supported. - if (!ruleValue || ruleValue?.ref) { - return; - } - } - - // Calculate fluid typography rules where available. - if (cssProperty === 'font-size') { - /* - * getTypographyFontSizeValue() will check - * if fluid typography has been activated and also - * whether the incoming value can be converted to a fluid value. - * Values that already have a "clamp()" function will not pass the test, - * and therefore the original $value will be returned. - */ - ruleValue = getTypographyFontSizeValue({ - size: ruleValue - }, getFluidTypographyOptionsFromSettings(tree?.settings)); - } - - // For aspect ratio to work, other dimensions rules (and Cover block defaults) must be unset. - // This ensures that a fixed height does not override the aspect ratio. - if (cssProperty === 'aspect-ratio') { - output.push('min-height: unset'); - } - output.push(`${cssProperty}: ${ruleValue}`); - }); - return output; -} - -/** - * Get generated CSS for layout styles by looking up layout definitions provided - * in theme.json, and outputting common layout styles, and specific blockGap values. - * - * @param {Object} props - * @param {Object} props.layoutDefinitions Layout definitions, keyed by layout type. - * @param {Object} props.style A style object containing spacing values. - * @param {string} props.selector Selector used to group together layout styling rules. - * @param {boolean} props.hasBlockGapSupport Whether or not the theme opts-in to blockGap support. - * @param {boolean} props.hasFallbackGapSupport Whether or not the theme allows fallback gap styles. - * @param {?string} props.fallbackGapValue An optional fallback gap value if no real gap value is available. - * @return {string} Generated CSS rules for the layout styles. - */ -function getLayoutStyles({ - layoutDefinitions = LAYOUT_DEFINITIONS, - style, - selector, - hasBlockGapSupport, - hasFallbackGapSupport, - fallbackGapValue -}) { - let ruleset = ''; - let gapValue = hasBlockGapSupport ? getGapCSSValue(style?.spacing?.blockGap) : ''; - - // Ensure a fallback gap value for the root layout definitions, - // and use a fallback value if one is provided for the current block. - if (hasFallbackGapSupport) { - if (selector === ROOT_BLOCK_SELECTOR) { - gapValue = !gapValue ? '0.5em' : gapValue; - } else if (!hasBlockGapSupport && fallbackGapValue) { - gapValue = fallbackGapValue; - } - } - if (gapValue && layoutDefinitions) { - Object.values(layoutDefinitions).forEach(({ - className, - name, - spacingStyles - }) => { - // Allow outputting fallback gap styles for flex layout type when block gap support isn't available. - if (!hasBlockGapSupport && 'flex' !== name && 'grid' !== name) { - return; - } - if (spacingStyles?.length) { - spacingStyles.forEach(spacingStyle => { - const declarations = []; - if (spacingStyle.rules) { - Object.entries(spacingStyle.rules).forEach(([cssProperty, cssValue]) => { - declarations.push(`${cssProperty}: ${cssValue ? cssValue : gapValue}`); - }); - } - if (declarations.length) { - let combinedSelector = ''; - if (!hasBlockGapSupport) { - // For fallback gap styles, use lower specificity, to ensure styles do not unintentionally override theme styles. - combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `:where(.${className}${spacingStyle?.selector || ''})` : `:where(${selector}.${className}${spacingStyle?.selector || ''})`; - } else { - combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `:where(${selector} .${className})${spacingStyle?.selector || ''}` : `${selector}-${className}${spacingStyle?.selector || ''}`; - } - ruleset += `${combinedSelector} { ${declarations.join('; ')}; }`; - } - }); - } - }); - // For backwards compatibility, ensure the legacy block gap CSS variable is still available. - if (selector === ROOT_BLOCK_SELECTOR && hasBlockGapSupport) { - ruleset += `${selector} { --wp--style--block-gap: ${gapValue}; }`; - } - } - - // Output base styles - if (selector === ROOT_BLOCK_SELECTOR && layoutDefinitions) { - const validDisplayModes = ['block', 'flex', 'grid']; - Object.values(layoutDefinitions).forEach(({ - className, - displayMode, - baseStyles - }) => { - if (displayMode && validDisplayModes.includes(displayMode)) { - ruleset += `${selector} .${className} { display:${displayMode}; }`; - } - if (baseStyles?.length) { - baseStyles.forEach(baseStyle => { - const declarations = []; - if (baseStyle.rules) { - Object.entries(baseStyle.rules).forEach(([cssProperty, cssValue]) => { - declarations.push(`${cssProperty}: ${cssValue}`); - }); - } - if (declarations.length) { - const combinedSelector = `${selector} .${className}${baseStyle?.selector || ''}`; - ruleset += `${combinedSelector} { ${declarations.join('; ')}; }`; - } - }); - } - }); - } - return ruleset; -} -const STYLE_KEYS = ['border', 'color', 'dimensions', 'spacing', 'typography', 'filter', 'outline', 'shadow']; -function pickStyleKeys(treeToPickFrom) { - if (!treeToPickFrom) { - return {}; - } - const entries = Object.entries(treeToPickFrom); - const pickedEntries = entries.filter(([key]) => STYLE_KEYS.includes(key)); - // clone the style objects so that `getFeatureDeclarations` can remove consumed keys from it - const clonedEntries = pickedEntries.map(([key, style]) => [key, JSON.parse(JSON.stringify(style))]); - return Object.fromEntries(clonedEntries); -} -const getNodesWithStyles = (tree, blockSelectors) => { - var _tree$styles$blocks; - const nodes = []; - if (!tree?.styles) { - return nodes; - } - - // Top-level. - const styles = pickStyleKeys(tree.styles); - if (styles) { - nodes.push({ - styles, - selector: ROOT_BLOCK_SELECTOR - }); - } - Object.entries(external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS).forEach(([name, selector]) => { - if (tree.styles?.elements?.[name]) { - nodes.push({ - styles: tree.styles?.elements?.[name], - selector - }); - } - }); - - // Iterate over blocks: they can have styles & elements. - Object.entries((_tree$styles$blocks = tree.styles?.blocks) !== null && _tree$styles$blocks !== void 0 ? _tree$styles$blocks : {}).forEach(([blockName, node]) => { - var _node$elements; - const blockStyles = pickStyleKeys(node); - if (node?.variations) { - const variations = {}; - Object.keys(node.variations).forEach(variation => { - variations[variation] = pickStyleKeys(node.variations[variation]); - }); - blockStyles.variations = variations; - } - if (blockStyles && blockSelectors?.[blockName]?.selector) { - nodes.push({ - duotoneSelector: blockSelectors[blockName].duotoneSelector, - fallbackGapValue: blockSelectors[blockName].fallbackGapValue, - hasLayoutSupport: blockSelectors[blockName].hasLayoutSupport, - selector: blockSelectors[blockName].selector, - styles: blockStyles, - featureSelectors: blockSelectors[blockName].featureSelectors, - styleVariationSelectors: blockSelectors[blockName].styleVariationSelectors - }); - } - Object.entries((_node$elements = node?.elements) !== null && _node$elements !== void 0 ? _node$elements : {}).forEach(([elementName, value]) => { - if (value && blockSelectors?.[blockName] && external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementName]) { - nodes.push({ - styles: value, - selector: blockSelectors[blockName]?.selector.split(',').map(sel => { - const elementSelectors = external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementName].split(','); - return elementSelectors.map(elementSelector => sel + ' ' + elementSelector); - }).join(',') - }); - } - }); - }); - return nodes; -}; -const getNodesWithSettings = (tree, blockSelectors) => { - var _tree$settings$blocks; - const nodes = []; - if (!tree?.settings) { - return nodes; - } - const pickPresets = treeToPickFrom => { - let presets = {}; - PRESET_METADATA.forEach(({ - path - }) => { - const value = getValueFromObjectPath(treeToPickFrom, path, false); - if (value !== false) { - presets = setImmutably(presets, path, value); - } - }); - return presets; - }; - - // Top-level. - const presets = pickPresets(tree.settings); - const custom = tree.settings?.custom; - if (Object.keys(presets).length > 0 || custom) { - nodes.push({ - presets, - custom, - selector: ROOT_BLOCK_SELECTOR - }); - } - - // Blocks. - Object.entries((_tree$settings$blocks = tree.settings?.blocks) !== null && _tree$settings$blocks !== void 0 ? _tree$settings$blocks : {}).forEach(([blockName, node]) => { - const blockPresets = pickPresets(node); - const blockCustom = node.custom; - if (Object.keys(blockPresets).length > 0 || blockCustom) { - nodes.push({ - presets: blockPresets, - custom: blockCustom, - selector: blockSelectors[blockName]?.selector - }); - } - }); - return nodes; -}; -const toCustomProperties = (tree, blockSelectors) => { - const settings = getNodesWithSettings(tree, blockSelectors); - let ruleset = ''; - settings.forEach(({ - presets, - custom, - selector - }) => { - const declarations = getPresetsDeclarations(presets, tree?.settings); - const customProps = flattenTree(custom, '--wp--custom--', '--'); - if (customProps.length > 0) { - declarations.push(...customProps); - } - if (declarations.length > 0) { - ruleset += `${selector}{${declarations.join(';')};}`; - } - }); - return ruleset; -}; -const toStyles = (tree, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles = false, isTemplate = true) => { - const nodesWithStyles = getNodesWithStyles(tree, blockSelectors); - const nodesWithSettings = getNodesWithSettings(tree, blockSelectors); - const useRootPaddingAlign = tree?.settings?.useRootPaddingAwareAlignments; - const { - contentSize, - wideSize - } = tree?.settings?.layout || {}; - - /* - * Reset default browser margin on the root body element. - * This is set on the root selector **before** generating the ruleset - * from the `theme.json`. This is to ensure that if the `theme.json` declares - * `margin` in its `spacing` declaration for the `body` element then these - * user-generated values take precedence in the CSS cascade. - * @link https://github.com/WordPress/gutenberg/issues/36147. - */ - let ruleset = 'body {margin: 0;'; - if (contentSize) { - ruleset += ` --wp--style--global--content-size: ${contentSize};`; - } - if (wideSize) { - ruleset += ` --wp--style--global--wide-size: ${wideSize};`; - } - - // Root padding styles should only be output for full templates, not patterns or template parts. - if (useRootPaddingAlign && isTemplate) { - /* - * These rules reproduce the ones from https://github.com/WordPress/gutenberg/blob/79103f124925d1f457f627e154f52a56228ed5ad/lib/class-wp-theme-json-gutenberg.php#L2508 - * almost exactly, but for the selectors that target block wrappers in the front end. This code only runs in the editor, so it doesn't need those selectors. - */ - ruleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) } - .has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); } - .has-global-padding :where(.has-global-padding:not(.wp-block-block)) { padding-right: 0; padding-left: 0; } - .has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); } - .has-global-padding :where(.has-global-padding:not(.wp-block-block)) > .alignfull { margin-right: 0; margin-left: 0; } - .has-global-padding > .alignfull:where(:not(.has-global-padding):not(.is-layout-flex):not(.is-layout-grid)) > :where(.wp-block:not(.alignfull),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); } - .has-global-padding :where(.has-global-padding) > .alignfull:where(:not(.has-global-padding)) > :where(.wp-block:not(.alignfull),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: 0; padding-left: 0;`; - } - ruleset += '}'; - nodesWithStyles.forEach(({ - selector, - duotoneSelector, - styles, - fallbackGapValue, - hasLayoutSupport, - featureSelectors, - styleVariationSelectors - }) => { - // Process styles for block support features with custom feature level - // CSS selectors set. - if (featureSelectors) { - const featureDeclarations = getFeatureDeclarations(featureSelectors, styles); - Object.entries(featureDeclarations).forEach(([cssSelector, declarations]) => { - if (declarations.length) { - const rules = declarations.join(';'); - ruleset += `${cssSelector}{${rules};}`; - } - }); - } - if (styleVariationSelectors) { - Object.entries(styleVariationSelectors).forEach(([styleVariationName, styleVariationSelector]) => { - const styleVariations = styles?.variations?.[styleVariationName]; - if (styleVariations) { - // If the block uses any custom selectors for block support, add those first. - if (featureSelectors) { - const featureDeclarations = getFeatureDeclarations(featureSelectors, styleVariations); - Object.entries(featureDeclarations).forEach(([baseSelector, declarations]) => { - if (declarations.length) { - const cssSelector = concatFeatureVariationSelectorString(baseSelector, styleVariationSelector); - const rules = declarations.join(';'); - ruleset += `${cssSelector}{${rules};}`; - } - }); - } - - // Otherwise add regular selectors. - const styleVariationDeclarations = getStylesDeclarations(styleVariations, styleVariationSelector, useRootPaddingAlign, tree); - if (styleVariationDeclarations.length) { - ruleset += `${styleVariationSelector}{${styleVariationDeclarations.join(';')};}`; - } - } - }); - } - - // Process duotone styles. - if (duotoneSelector) { - const duotoneStyles = {}; - if (styles?.filter) { - duotoneStyles.filter = styles.filter; - delete styles.filter; - } - const duotoneDeclarations = getStylesDeclarations(duotoneStyles); - if (duotoneDeclarations.length) { - ruleset += `${duotoneSelector}{${duotoneDeclarations.join(';')};}`; - } - } - - // Process blockGap and layout styles. - if (!disableLayoutStyles && (ROOT_BLOCK_SELECTOR === selector || hasLayoutSupport)) { - ruleset += getLayoutStyles({ - style: styles, - selector, - hasBlockGapSupport, - hasFallbackGapSupport, - fallbackGapValue - }); - } - - // Process the remaining block styles (they use either normal block class or __experimentalSelector). - const declarations = getStylesDeclarations(styles, selector, useRootPaddingAlign, tree, isTemplate); - if (declarations?.length) { - ruleset += `${selector}{${declarations.join(';')};}`; - } - - // Check for pseudo selector in `styles` and handle separately. - const pseudoSelectorStyles = Object.entries(styles).filter(([key]) => key.startsWith(':')); - if (pseudoSelectorStyles?.length) { - pseudoSelectorStyles.forEach(([pseudoKey, pseudoStyle]) => { - const pseudoDeclarations = getStylesDeclarations(pseudoStyle); - if (!pseudoDeclarations?.length) { - return; - } - - // `selector` maybe provided in a form - // where block level selectors have sub element - // selectors appended to them as a comma separated - // string. - // e.g. `h1 a,h2 a,h3 a,h4 a,h5 a,h6 a`; - // Split and append pseudo selector to create - // the proper rules to target the elements. - const _selector = selector.split(',').map(sel => sel + pseudoKey).join(','); - const pseudoRule = `${_selector}{${pseudoDeclarations.join(';')};}`; - ruleset += pseudoRule; - }); - } - }); - - /* Add alignment / layout styles */ - ruleset = ruleset + '.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }'; - ruleset = ruleset + '.wp-site-blocks > .alignright { float: right; margin-left: 2em; }'; - ruleset = ruleset + '.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }'; - if (hasBlockGapSupport) { - // Use fallback of `0.5em` just in case, however if there is blockGap support, there should nearly always be a real value. - const gapValue = getGapCSSValue(tree?.styles?.spacing?.blockGap) || '0.5em'; - ruleset = ruleset + `:where(.wp-site-blocks) > * { margin-block-start: ${gapValue}; margin-block-end: 0; }`; - ruleset = ruleset + ':where(.wp-site-blocks) > :first-child:first-child { margin-block-start: 0; }'; - ruleset = ruleset + ':where(.wp-site-blocks) > :last-child:last-child { margin-block-end: 0; }'; - } - nodesWithSettings.forEach(({ - selector, - presets - }) => { - if (ROOT_BLOCK_SELECTOR === selector) { - // Do not add extra specificity for top-level classes. - selector = ''; - } - const classes = getPresetsClasses(selector, presets); - if (classes.length > 0) { - ruleset += classes; - } - }); - return ruleset; -}; -function toSvgFilters(tree, blockSelectors) { - const nodesWithSettings = getNodesWithSettings(tree, blockSelectors); - return nodesWithSettings.flatMap(({ - presets - }) => { - return getPresetsSvgFilters(presets); - }); -} -const getSelectorsConfig = (blockType, rootSelector) => { - if (blockType?.selectors && Object.keys(blockType.selectors).length > 0) { - return blockType.selectors; - } - const config = { - root: rootSelector - }; - Object.entries(BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS).forEach(([featureKey, featureName]) => { - const featureSelector = getBlockCSSSelector(blockType, featureKey); - if (featureSelector) { - config[featureName] = featureSelector; - } - }); - return config; -}; -const getBlockSelectors = (blockTypes, getBlockStyles) => { - const result = {}; - blockTypes.forEach(blockType => { - const name = blockType.name; - const selector = getBlockCSSSelector(blockType); - let duotoneSelector = getBlockCSSSelector(blockType, 'filter.duotone'); - - // Keep backwards compatibility for support.color.__experimentalDuotone. - if (!duotoneSelector) { - const rootSelector = getBlockCSSSelector(blockType); - const duotoneSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, 'color.__experimentalDuotone', false); - duotoneSelector = duotoneSupport && scopeSelector(rootSelector, duotoneSupport); - } - const hasLayoutSupport = !!blockType?.supports?.layout || !!blockType?.supports?.__experimentalLayout; - const fallbackGapValue = blockType?.supports?.spacing?.blockGap?.__experimentalDefault; - const blockStyleVariations = getBlockStyles(name); - const styleVariationSelectors = {}; - if (blockStyleVariations?.length) { - blockStyleVariations.forEach(variation => { - const styleVariationSelector = getBlockStyleVariationSelector(variation.name, selector); - styleVariationSelectors[variation.name] = styleVariationSelector; - }); - } - // For each block support feature add any custom selectors. - const featureSelectors = getSelectorsConfig(blockType, selector); - result[name] = { - duotoneSelector, - fallbackGapValue, - featureSelectors: Object.keys(featureSelectors).length ? featureSelectors : undefined, - hasLayoutSupport, - name, - selector, - styleVariationSelectors: Object.keys(styleVariationSelectors).length ? styleVariationSelectors : undefined - }; - }); - return result; -}; - -/** - * If there is a separator block whose color is defined in theme.json via background, - * update the separator color to the same value by using border color. - * - * @param {Object} config Theme.json configuration file object. - * @return {Object} configTheme.json configuration file object updated. + + + + + + + + + + + + + + +/* + * State Related Components */ -function updateConfigWithSeparator(config) { - const needsSeparatorStyleUpdate = config.styles?.blocks?.['core/separator'] && config.styles?.blocks?.['core/separator'].color?.background && !config.styles?.blocks?.['core/separator'].color?.text && !config.styles?.blocks?.['core/separator'].border?.color; - if (needsSeparatorStyleUpdate) { - return { - ...config, - styles: { - ...config.styles, - blocks: { - ...config.styles.blocks, - 'core/separator': { - ...config.styles.blocks['core/separator'], - color: { - ...config.styles.blocks['core/separator'].color, - text: config.styles?.blocks['core/separator'].color.background - } - } - } - } - }; - } - return config; -} -function processCSSNesting(css, blockSelector) { - let processedCSS = ''; - // Split CSS nested rules. - const parts = css.split('&'); - parts.forEach(part => { - const isRootCss = !part.includes('{'); - if (isRootCss) { - // If the part doesn't contain braces, it applies to the root level. - processedCSS += `${blockSelector}{${part.trim()}}`; - } else { - // If the part contains braces, it's a nested CSS rule. - const splittedPart = part.replace('}', '').split('{'); - if (splittedPart.length !== 2) { - return; - } - const [nestedSelector, cssValue] = splittedPart; - const combinedSelector = nestedSelector.startsWith(' ') ? scopeSelector(blockSelector, nestedSelector) : appendToSelector(blockSelector, nestedSelector); - processedCSS += `${combinedSelector}{${cssValue.trim()}}`; - } - }); - return processedCSS; -} -/** - * Returns the global styles output using a global styles configuration. - * If wishing to generate global styles and settings based on the - * global styles config loaded in the editor context, use `useGlobalStylesOutput()`. - * The use case for a custom config is to generate bespoke styles - * and settings for previews, or other out-of-editor experiences. - * - * @param {Object} mergedConfig Global styles configuration. - * @return {Array} Array of stylesheets and settings. + + + +/* + * The following rename hint component can be removed in 6.4. */ -function useGlobalStylesOutputWithConfig(mergedConfig = {}) { - const [blockGap] = useGlobalSetting('spacing.blockGap'); - const hasBlockGapSupport = blockGap !== null; - const hasFallbackGapSupport = !hasBlockGapSupport; // This setting isn't useful yet: it exists as a placeholder for a future explicit fallback styles support. - const disableLayoutStyles = (0,external_wp_data_namespaceObject.useSelect)(select => { - const { - getSettings - } = select(store); - return !!getSettings().disableLayoutStyles; - }); - const blockContext = (0,external_wp_element_namespaceObject.useContext)(block_context); - const isTemplate = blockContext?.templateSlug !== undefined; - const { - getBlockStyles - } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store); - return (0,external_wp_element_namespaceObject.useMemo)(() => { - var _updatedConfig$styles; - if (!mergedConfig?.styles || !mergedConfig?.settings) { - return []; - } - const updatedConfig = updateConfigWithSeparator(mergedConfig); - const blockSelectors = getBlockSelectors((0,external_wp_blocks_namespaceObject.getBlockTypes)(), getBlockStyles); - const customProperties = toCustomProperties(updatedConfig, blockSelectors); - const globalStyles = toStyles(updatedConfig, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles, isTemplate); - const svgs = toSvgFilters(updatedConfig, blockSelectors); - const styles = [{ - css: customProperties, - isGlobalStyles: true - }, { - css: globalStyles, - isGlobalStyles: true - }, - // Load custom CSS in own stylesheet so that any invalid CSS entered in the input won't break all the global styles in the editor. - { - css: (_updatedConfig$styles = updatedConfig.styles.css) !== null && _updatedConfig$styles !== void 0 ? _updatedConfig$styles : '', - isGlobalStyles: true - }, { - assets: svgs, - __unstableType: 'svg', - isGlobalStyles: true - }]; - // Loop through the blocks to check if there are custom CSS values. - // If there are, get the block selector and push the selector together with - // the CSS value to the 'stylesheets' array. - (0,external_wp_blocks_namespaceObject.getBlockTypes)().forEach(blockType => { - if (updatedConfig.styles.blocks[blockType.name]?.css) { - const selector = blockSelectors[blockType.name].selector; - styles.push({ - css: processCSSNesting(updatedConfig.styles.blocks[blockType.name]?.css, selector), - isGlobalStyles: true - }); - } - }); - return [styles, updatedConfig.settings]; - }, [hasBlockGapSupport, hasFallbackGapSupport, mergedConfig, disableLayoutStyles, isTemplate, getBlockStyles]); -} +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/elements/index.js +const elements_ELEMENT_CLASS_NAMES = { + button: 'wp-element-button', + caption: 'wp-element-caption' +}; +const __experimentalGetElementClassName = element => { + return elements_ELEMENT_CLASS_NAMES[element] ? elements_ELEMENT_CLASS_NAMES[element] : ''; +}; + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/get-px-from-css-unit.js /** - * Returns the global styles output based on the current state of global styles config loaded in the editor context. + * This function was accidentially exposed for mobile/native usage. * - * @return {Array} Array of stylesheets and settings. + * @deprecated + * + * @return {string} Empty string. */ -function useGlobalStylesOutput() { - const { - merged: mergedConfig - } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext); - return useGlobalStylesOutputWithConfig(mergedConfig); -} +/* harmony default export */ const get_px_from_css_unit = (() => ''); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/index.js -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/image-settings-panel.js + +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/image-settings-panel.js /** * WordPress dependencies */ @@ -64032,6 +67933,8 @@ function useGlobalStylesOutput() { * Internal dependencies */ + + function useHasImageSettingsPanel(name, value, inheritedValue) { // Note: If lightbox `value` exists, that means it was // defined via the the Global Styles UI and will NOT @@ -64045,6 +67948,7 @@ function ImageSettingsPanel({ inheritedValue, panelId }) { + const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const resetLightbox = () => { onChange(undefined); }; @@ -64057,31 +67961,34 @@ function ImageSettingsPanel({ if (inheritedValue?.lightbox?.enabled) { lightboxChecked = inheritedValue.lightbox.enabled; } - return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, { - label: (0,external_wp_i18n_namespaceObject._x)('Settings', 'Image settings'), - resetAll: resetLightbox, - panelId: panelId, - dropdownMenuProps: TOOLSPANEL_DROPDOWNMENU_PROPS - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem - // We use the `userSettings` prop instead of `settings`, because `settings` - // contains the core/theme values for the lightbox and we want to show the - // "RESET" button ONLY when the user has explicitly set a value in the - // Global Styles. - , { - hasValue: () => !!value?.lightbox, - label: (0,external_wp_i18n_namespaceObject.__)('Expand on click'), - onDeselect: resetLightbox, - isShownByDefault: true, - panelId: panelId - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToggleControl, { - label: (0,external_wp_i18n_namespaceObject.__)('Expand on click'), - checked: lightboxChecked, - onChange: onChangeLightbox - })))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanel, { + label: (0,external_wp_i18n_namespaceObject._x)('Settings', 'Image settings'), + resetAll: resetLightbox, + panelId: panelId, + dropdownMenuProps: dropdownMenuProps, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem + // We use the `userSettings` prop instead of `settings`, because `settings` + // contains the core/theme values for the lightbox and we want to show the + // "RESET" button ONLY when the user has explicitly set a value in the + // Global Styles. + , { + hasValue: () => !!value?.lightbox, + label: (0,external_wp_i18n_namespaceObject.__)('Expand on click'), + onDeselect: resetLightbox, + isShownByDefault: true, + panelId: panelId, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Expand on click'), + checked: lightboxChecked, + onChange: onChangeLightbox + }) + }) + }) + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/advanced-panel.js - /** * WordPress dependencies */ @@ -64093,6 +68000,8 @@ function ImageSettingsPanel({ * Internal dependencies */ + + function AdvancedPanel({ value, onChange, @@ -64107,9 +68016,12 @@ function AdvancedPanel({ css: newValue }); if (cssError) { + // Check if the new value is valid CSS, and pass a wrapping selector + // to ensure that `transformStyles` validates the CSS. Note that the + // wrapping selector here is not used in the actual output of any styles. const [transformed] = transform_styles([{ css: newValue - }], '.editor-styles-wrapper'); + }], '.for-validation-only'); if (transformed) { setCSSError(null); } @@ -64120,25 +68032,31 @@ function AdvancedPanel({ setCSSError(null); return; } + + // Check if the new value is valid CSS, and pass a wrapping selector + // to ensure that `transformStyles` validates the CSS. Note that the + // wrapping selector here is not used in the actual output of any styles. const [transformed] = transform_styles([{ css: event.target.value - }], '.editor-styles-wrapper'); + }], '.for-validation-only'); setCSSError(transformed === null ? (0,external_wp_i18n_namespaceObject.__)('There is an error with your CSS structure.') : null); } - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { - spacing: 3 - }, cssError && (0,external_React_.createElement)(external_wp_components_namespaceObject.Notice, { - status: "error", - onRemove: () => setCSSError(null) - }, cssError), (0,external_React_.createElement)(external_wp_components_namespaceObject.TextareaControl, { - label: (0,external_wp_i18n_namespaceObject.__)('Additional CSS'), - __nextHasNoMarginBottom: true, - value: customCSS, - onChange: newValue => handleOnChange(newValue), - onBlur: handleOnBlur, - className: "block-editor-global-styles-advanced-panel__custom-css-input", - spellCheck: false - })); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { + spacing: 3, + children: [cssError && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { + status: "error", + onRemove: () => setCSSError(null), + children: cssError + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextareaControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Additional CSS'), + __nextHasNoMarginBottom: true, + value: customCSS, + onChange: newValue => handleOnChange(newValue), + onBlur: handleOnBlur, + className: "block-editor-global-styles-advanced-panel__custom-css-input", + spellCheck: false + })] + }); } ;// CONCATENATED MODULE: ./node_modules/memize/dist/index.js @@ -64331,6 +68249,7 @@ const translationMap = { 'settings.typography': (0,external_wp_i18n_namespaceObject.__)('Typography'), 'styles.color': (0,external_wp_i18n_namespaceObject.__)('Colors'), 'styles.spacing': (0,external_wp_i18n_namespaceObject.__)('Spacing'), + 'styles.background': (0,external_wp_i18n_namespaceObject.__)('Background'), 'styles.typography': (0,external_wp_i18n_namespaceObject.__)('Typography') }; const getBlockNames = memize(() => (0,external_wp_blocks_namespaceObject.getBlockTypes)().reduce((accumulator, { @@ -64418,6 +68337,7 @@ function getGlobalStylesChangelist(next, previous) { */ const changedValueTree = deepCompare({ styles: { + background: next?.styles?.background, color: next?.styles?.color, typography: next?.styles?.typography, spacing: next?.styles?.spacing @@ -64427,6 +68347,7 @@ function getGlobalStylesChangelist(next, previous) { settings: next?.settings }, { styles: { + background: previous?.styles?.background, color: previous?.styles?.color, typography: previous?.styles?.typography, spacing: previous?.styles?.spacing @@ -64537,8 +68458,8 @@ function getGlobalStylesChanges(next, previous, options = {}) { -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/get-rich-text-values.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/get-rich-text-values.js /** * WordPress dependencies */ @@ -64557,6 +68478,7 @@ function getGlobalStylesChanges(next, previous, options = {}) { * except that it does not render the elements to a string, but instead collects * the values of all rich text `Content` elements. */ + function addValuesForElement(element, values, innerBlocks) { if (null === element || undefined === element || false === element) { return; @@ -64610,10 +68532,11 @@ function addValuesForBlocks(values, blocks) { innerBlocks } = blocks[i]; const saveElement = (0,external_wp_blocks_namespaceObject.getSaveElement)(name, attributes, + /*#__PURE__*/ // Instead of letting save elements use `useInnerBlocksProps.save`, // force them to use InnerBlocks.Content instead so we can intercept // a single component. - (0,external_React_.createElement)(inner_blocks.Content, null)); + (0,external_ReactJSXRuntime_namespaceObject.jsx)(inner_blocks.Content, {})); addValuesForElement(saveElement, values, innerBlocks); } } @@ -64626,7 +68549,6 @@ function getRichTextValues(blocks = []) { } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/resizable-box-popover/index.js - /** * WordPress dependencies */ @@ -64636,65 +68558,23 @@ function getRichTextValues(blocks = []) { * Internal dependencies */ + function ResizableBoxPopover({ clientId, resizableBoxProps, ...props }) { - return (0,external_React_.createElement)(block_popover, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(cover, { clientId: clientId, - __unstableCoverTarget: true, - __unstablePopoverSlot: "__unstable-block-tools-after", - shift: false, - ...props - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.ResizableBox, { - ...resizableBoxProps - })); -} - -;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/use-can-block-toolbar-be-focused.js -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - - -/** - * Returns true if the block toolbar should be able to receive focus. - * - * @return {boolean} Whether the block toolbar should be able to receive focus - */ -function useCanBlockToolbarBeFocused() { - return (0,external_wp_data_namespaceObject.useSelect)(select => { - const { - __unstableGetEditorMode, - getBlock, - getSettings, - getSelectedBlockClientId, - getFirstMultiSelectedBlockClientId - } = unlock(select(store)); - const selectedBlockId = getFirstMultiSelectedBlockClientId() || getSelectedBlockClientId(); - const isEmptyDefaultBlock = (0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(getBlock(selectedBlockId) || {}); - - // Fixed Toolbar can be focused when: - // - a block is selected - // - fixed toolbar is on - // Block Toolbar Popover can be focused when: - // - a block is selected - // - we are in edit mode - // - it is not an empty default block - return !!selectedBlockId && (getSettings().hasFixedToolbar || __unstableGetEditorMode() === 'edit' && !isEmptyDefaultBlock); - }, []); + __unstablePopoverSlot: "block-toolbar", + ...props, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ResizableBox, { + ...resizableBoxProps + }) + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-removal-warning-modal/index.js - /** * WordPress dependencies */ @@ -64708,14 +68588,15 @@ function useCanBlockToolbarBeFocused() { */ + + function BlockRemovalWarningModal({ rules }) { const { clientIds, selectPrevious, - blockNamesForPrompt, - messageType + message } = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store)).getRemovalPromptData()); const { clearBlockRemovalPrompt, @@ -64731,31 +68612,35 @@ function BlockRemovalWarningModal({ setBlockRemovalRules(); }; }, [rules, setBlockRemovalRules]); - if (!blockNamesForPrompt) { + if (!message) { return; } - const message = messageType === 'templates' ? (0,external_wp_i18n_namespaceObject._n)('Deleting this block will stop your post or page content from displaying on this template. It is not recommended.', 'Deleting these blocks will stop your post or page content from displaying on this template. It is not recommended.', blockNamesForPrompt.length) : (0,external_wp_i18n_namespaceObject._n)('Deleting this block could break patterns on your site that have content linked to it. Are you sure you want to delete it?', 'Deleting these blocks could break patterns on your site that have content linked to them. Are you sure you want to delete them?', blockNamesForPrompt.length); const onConfirmRemoval = () => { privateRemoveBlocks(clientIds, selectPrevious, /* force */true); clearBlockRemovalPrompt(); }; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.Modal, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Modal, { title: (0,external_wp_i18n_namespaceObject.__)('Be careful!'), onRequestClose: clearBlockRemovalPrompt, - size: "medium" - }, (0,external_React_.createElement)("p", null, message), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { - justify: "right" - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - variant: "tertiary", - onClick: clearBlockRemovalPrompt - }, (0,external_wp_i18n_namespaceObject.__)('Cancel')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, { - variant: "primary", - onClick: onConfirmRemoval - }, (0,external_wp_i18n_namespaceObject.__)('Delete')))); + size: "medium", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { + children: message + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { + justify: "right", + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + variant: "tertiary", + onClick: clearBlockRemovalPrompt, + children: (0,external_wp_i18n_namespaceObject.__)('Cancel') + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { + variant: "primary", + onClick: onConfirmRemoval, + children: (0,external_wp_i18n_namespaceObject.__)('Delete') + })] + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/dimensions-tool/scale-tool.js - /** * WordPress dependencies */ @@ -64776,6 +68661,7 @@ function BlockRemovalWarningModal({ * * @type {SelectControlProps[]} */ + const DEFAULT_SCALE_OPTIONS = [{ value: 'fill', label: (0,external_wp_i18n_namespaceObject._x)('Fill', 'Scale option for dimensions control'), @@ -64838,23 +68724,24 @@ function ScaleTool({ return acc; }, {}); }, [options]); - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { label: (0,external_wp_i18n_namespaceObject.__)('Scale'), isShownByDefault: isShownByDefault, hasValue: () => displayValue !== defaultValue, onDeselect: () => onChange(defaultValue), - panelId: panelId - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { - label: (0,external_wp_i18n_namespaceObject.__)('Scale'), - isBlock: true, - help: scaleHelp[displayValue], - value: displayValue, - onChange: onChange, - size: '__unstable-large' - }, options.map(option => (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { - key: option.value, - ...option - })))); + panelId: panelId, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Scale'), + isBlock: true, + help: scaleHelp[displayValue], + value: displayValue, + onChange: onChange, + size: "__unstable-large", + children: options.map(option => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, { + ...option + }, option.value)) + }) + }); } ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js @@ -66222,7 +70109,7 @@ var emotion_cache_browser_esm_prefixer = function prefixer(element, index, child var defaultStylisPlugins = [emotion_cache_browser_esm_prefixer]; -var emotion_cache_browser_esm_createCache = function createCache(options) { +var createCache = function createCache(options) { var key = options.key; if (false) {} @@ -66322,7 +70209,7 @@ var emotion_cache_browser_esm_createCache = function createCache(options) { return cache; }; -/* harmony default export */ const emotion_cache_browser_esm = (emotion_cache_browser_esm_createCache); +/* harmony default export */ const emotion_cache_browser_esm = (createCache); ;// CONCATENATED MODULE: ./node_modules/@emotion/hash/dist/emotion-hash.esm.js /* eslint-disable */ @@ -67138,7 +71025,6 @@ var createStyled = function createStyled(tag, options) { ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/dimensions-tool/width-height-tool.js - function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /** * External dependencies @@ -67149,6 +71035,9 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif */ + + + const SingleColumnToolsPanelItem = /*#__PURE__*/emotion_styled_base_browser_esm(external_wp_components_namespaceObject.__experimentalToolsPanelItem, true ? { target: "ef8pe3d0" } : 0)( true ? { @@ -67211,41 +71100,44 @@ function WidthHeightTool({ } onChange(nextValue); }; - return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(SingleColumnToolsPanelItem, { - label: (0,external_wp_i18n_namespaceObject.__)('Width'), - isShownByDefault: isShownByDefault, - hasValue: () => width !== '', - onDeselect: onDimensionChange('width'), - panelId: panelId - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, { - label: (0,external_wp_i18n_namespaceObject.__)('Width'), - placeholder: (0,external_wp_i18n_namespaceObject.__)('Auto'), - labelPosition: "top", - units: units, - min: 0, - value: width, - onChange: onDimensionChange('width'), - size: '__unstable-large' - })), (0,external_React_.createElement)(SingleColumnToolsPanelItem, { - label: (0,external_wp_i18n_namespaceObject.__)('Height'), - isShownByDefault: isShownByDefault, - hasValue: () => height !== '', - onDeselect: onDimensionChange('height'), - panelId: panelId - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, { - label: (0,external_wp_i18n_namespaceObject.__)('Height'), - placeholder: (0,external_wp_i18n_namespaceObject.__)('Auto'), - labelPosition: "top", - units: units, - min: 0, - value: height, - onChange: onDimensionChange('height'), - size: '__unstable-large' - }))); + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SingleColumnToolsPanelItem, { + label: (0,external_wp_i18n_namespaceObject.__)('Width'), + isShownByDefault: isShownByDefault, + hasValue: () => width !== '', + onDeselect: onDimensionChange('width'), + panelId: panelId, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Width'), + placeholder: (0,external_wp_i18n_namespaceObject.__)('Auto'), + labelPosition: "top", + units: units, + min: 0, + value: width, + onChange: onDimensionChange('width'), + size: "__unstable-large" + }) + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SingleColumnToolsPanelItem, { + label: (0,external_wp_i18n_namespaceObject.__)('Height'), + isShownByDefault: isShownByDefault, + hasValue: () => height !== '', + onDeselect: onDimensionChange('height'), + panelId: panelId, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Height'), + placeholder: (0,external_wp_i18n_namespaceObject.__)('Auto'), + labelPosition: "top", + units: units, + min: 0, + value: height, + onChange: onDimensionChange('height'), + size: "__unstable-large" + }) + })] + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/dimensions-tool/index.js - /** * WordPress dependencies */ @@ -67297,6 +71189,9 @@ function WidthHeightTool({ * * @return {Element} The dimensions controls. */ + + + function DimensionsTool({ panelId, value = {}, @@ -67328,131 +71223,133 @@ function DimensionsTool({ // as a custom aspect ratio. const aspectRatioValue = width && height ? 'custom' : lastAspectRatio; const showScaleControl = aspectRatio || width && height; - return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(AspectRatioTool, { - panelId: panelId, - options: aspectRatioOptions, - defaultValue: defaultAspectRatio, - value: aspectRatioValue, - onChange: nextAspectRatio => { - const nextValue = { - ...value - }; + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { + children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AspectRatioTool, { + panelId: panelId, + options: aspectRatioOptions, + defaultValue: defaultAspectRatio, + value: aspectRatioValue, + onChange: nextAspectRatio => { + const nextValue = { + ...value + }; - // 'auto' is CSS default, so it gets treated as null. - nextAspectRatio = nextAspectRatio === 'auto' ? null : nextAspectRatio; - setLastAspectRatio(nextAspectRatio); + // 'auto' is CSS default, so it gets treated as null. + nextAspectRatio = nextAspectRatio === 'auto' ? null : nextAspectRatio; + setLastAspectRatio(nextAspectRatio); - // Update aspectRatio. - if (!nextAspectRatio) { - delete nextValue.aspectRatio; - } else { - nextValue.aspectRatio = nextAspectRatio; - } + // Update aspectRatio. + if (!nextAspectRatio) { + delete nextValue.aspectRatio; + } else { + nextValue.aspectRatio = nextAspectRatio; + } - // Auto-update scale. - if (!nextAspectRatio) { - delete nextValue.scale; - } else if (lastScale) { - nextValue.scale = lastScale; - } else { - nextValue.scale = defaultScale; - setLastScale(defaultScale); - } + // Auto-update scale. + if (!nextAspectRatio) { + delete nextValue.scale; + } else if (lastScale) { + nextValue.scale = lastScale; + } else { + nextValue.scale = defaultScale; + setLastScale(defaultScale); + } - // Auto-update width and height. - if ('custom' !== nextAspectRatio && width && height) { - delete nextValue.height; + // Auto-update width and height. + if ('custom' !== nextAspectRatio && width && height) { + delete nextValue.height; + } + onChange(nextValue); } - onChange(nextValue); - } - }), (0,external_React_.createElement)(WidthHeightTool, { - panelId: panelId, - units: unitsOptions, - value: { - width, - height - }, - onChange: ({ - width: nextWidth, - height: nextHeight - }) => { - const nextValue = { - ...value - }; + }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WidthHeightTool, { + panelId: panelId, + units: unitsOptions, + value: { + width, + height + }, + onChange: ({ + width: nextWidth, + height: nextHeight + }) => { + const nextValue = { + ...value + }; - // 'auto' is CSS default, so it gets treated as null. - nextWidth = nextWidth === 'auto' ? null : nextWidth; - nextHeight = nextHeight === 'auto' ? null : nextHeight; + // 'auto' is CSS default, so it gets treated as null. + nextWidth = nextWidth === 'auto' ? null : nextWidth; + nextHeight = nextHeight === 'auto' ? null : nextHeight; - // Update width. - if (!nextWidth) { - delete nextValue.width; - } else { - nextValue.width = nextWidth; - } + // Update width. + if (!nextWidth) { + delete nextValue.width; + } else { + nextValue.width = nextWidth; + } - // Update height. - if (!nextHeight) { - delete nextValue.height; - } else { - nextValue.height = nextHeight; - } + // Update height. + if (!nextHeight) { + delete nextValue.height; + } else { + nextValue.height = nextHeight; + } - // Auto-update aspectRatio. - if (nextWidth && nextHeight) { - delete nextValue.aspectRatio; - } else if (lastAspectRatio) { - nextValue.aspectRatio = lastAspectRatio; - } else { - // No setting defaultAspectRatio here, because - // aspectRatio is optional in this scenario, - // unlike scale. - } + // Auto-update aspectRatio. + if (nextWidth && nextHeight) { + delete nextValue.aspectRatio; + } else if (lastAspectRatio) { + nextValue.aspectRatio = lastAspectRatio; + } else { + // No setting defaultAspectRatio here, because + // aspectRatio is optional in this scenario, + // unlike scale. + } - // Auto-update scale. - if (!lastAspectRatio && !!nextWidth !== !!nextHeight) { - delete nextValue.scale; - } else if (lastScale) { - nextValue.scale = lastScale; - } else { - nextValue.scale = defaultScale; - setLastScale(defaultScale); - } - onChange(nextValue); - } - }), showScaleControl && (0,external_React_.createElement)(ScaleTool, { - panelId: panelId, - options: scaleOptions, - defaultValue: defaultScale, - value: lastScale, - onChange: nextScale => { - const nextValue = { - ...value - }; + // Auto-update scale. + if (!lastAspectRatio && !!nextWidth !== !!nextHeight) { + delete nextValue.scale; + } else if (lastScale) { + nextValue.scale = lastScale; + } else { + nextValue.scale = defaultScale; + setLastScale(defaultScale); + } + onChange(nextValue); + } + }), showScaleControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ScaleTool, { + panelId: panelId, + options: scaleOptions, + defaultValue: defaultScale, + value: lastScale, + onChange: nextScale => { + const nextValue = { + ...value + }; - // 'fill' is CSS default, so it gets treated as null. - nextScale = nextScale === 'fill' ? null : nextScale; - setLastScale(nextScale); + // 'fill' is CSS default, so it gets treated as null. + nextScale = nextScale === 'fill' ? null : nextScale; + setLastScale(nextScale); - // Update scale. - if (!nextScale) { - delete nextValue.scale; - } else { - nextValue.scale = nextScale; + // Update scale. + if (!nextScale) { + delete nextValue.scale; + } else { + nextValue.scale = nextScale; + } + onChange(nextValue); } - onChange(nextValue); - } - })); + })] + }); } /* harmony default export */ const dimensions_tool = (DimensionsTool); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/resolution-tool/index.js - /** * WordPress dependencies */ + const DEFAULT_SIZE_OPTIONS = [{ label: (0,external_wp_i18n_namespaceObject._x)('Thumbnail', 'Image size option for resolution control'), value: 'thumbnail' @@ -67475,20 +71372,21 @@ function ResolutionTool({ isShownByDefault = true }) { const displayValue = value !== null && value !== void 0 ? value : defaultValue; - return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { + return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { hasValue: () => displayValue !== defaultValue, label: (0,external_wp_i18n_namespaceObject.__)('Resolution'), onDeselect: () => onChange(defaultValue), isShownByDefault: isShownByDefault, - panelId: panelId - }, (0,external_React_.createElement)(external_wp_components_namespaceObject.SelectControl, { - label: (0,external_wp_i18n_namespaceObject.__)('Resolution'), - value: displayValue, - options: options, - onChange: onChange, - help: (0,external_wp_i18n_namespaceObject.__)('Select the size of the source image.'), - size: '__unstable-large' - })); + panelId: panelId, + children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Resolution'), + value: displayValue, + options: options, + onChange: onChange, + help: (0,external_wp_i18n_namespaceObject.__)('Select the size of the source image.'), + size: "__unstable-large" + }) + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/private-apis.js @@ -67513,6 +71411,13 @@ function ResolutionTool({ + + + + + + + @@ -67533,10 +71438,13 @@ lock(privateApis, { getRichTextValues: getRichTextValues, PrivateInserter: ComposedPrivateInserter, PrivateQuickInserter: QuickInserter, + extractWords: extractWords, + getNormalizedSearchTerms: getNormalizedSearchTerms, + normalizeString: normalizeString, PrivateListView: PrivateListView, ResizableBoxPopover: ResizableBoxPopover, BlockInfo: block_info_slot_fill, - useCanBlockToolbarBeFocused: useCanBlockToolbarBeFocused, + useHasBlockToolbar: useHasBlockToolbar, cleanEmptyObject: utils_cleanEmptyObject, useStyleOverride: useStyleOverride, BlockQuickNavigation: BlockQuickNavigation, @@ -67546,13 +71454,22 @@ lock(privateApis, { useLayoutStyles: useLayoutStyles, DimensionsTool: dimensions_tool, ResolutionTool: ResolutionTool, + TextAlignmentControl: TextAlignmentControl, ReusableBlocksRenameHint: ReusableBlocksRenameHint, useReusableBlocksRenameHint: useReusableBlocksRenameHint, usesContextKey: usesContextKey, useFlashEditableBlocks: useFlashEditableBlocks, + globalStylesDataKey: globalStylesDataKey, selectBlockPatternsKey: selectBlockPatternsKey, requiresWrapperOnCopy: requiresWrapperOnCopy, - PrivateRichText: PrivateRichText + PrivateRichText: PrivateRichText, + PrivateInserterLibrary: PrivateInserterLibrary, + reusableBlocksSelectKey: reusableBlocksSelectKey, + PrivateBlockPopover: PrivateBlockPopover, + PrivatePublishDateTimePicker: PrivatePublishDateTimePicker, + useSpacingSizes: useSpacingSizes, + useBlockDisplayTitle: useBlockDisplayTitle, + __unstableBlockStyleVariationOverridesWithConfig: __unstableBlockStyleVariationOverridesWithConfig }); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/index.js diff --git a/wp-includes/js/dist/block-editor.min.js b/wp-includes/js/dist/block-editor.min.js index 9c85897..66b42c3 100644 --- a/wp-includes/js/dist/block-editor.min.js +++ b/wp-includes/js/dist/block-editor.min.js @@ -4,12 +4,7 @@ autosize 4.0.4 license: MIT http://www.jacklmoore.com/autosize -*/o=[e,t],n=function(e,t){"use strict";var n,o,r="function"==typeof Map?new Map:(n=[],o=[],{has:function(e){return n.indexOf(e)>-1},get:function(e){return o[n.indexOf(e)]},set:function(e,t){-1===n.indexOf(e)&&(n.push(e),o.push(t))},delete:function(e){var t=n.indexOf(e);t>-1&&(n.splice(t,1),o.splice(t,1))}}),l=function(e){return new Event(e,{bubbles:!0})};try{new Event("test")}catch(e){l=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!1),t}}function i(e){if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!r.has(e)){var t=null,n=null,o=null,i=function(){e.clientWidth!==n&&p()},s=function(t){window.removeEventListener("resize",i,!1),e.removeEventListener("input",p,!1),e.removeEventListener("keyup",p,!1),e.removeEventListener("autosize:destroy",s,!1),e.removeEventListener("autosize:update",p,!1),Object.keys(t).forEach((function(n){e.style[n]=t[n]})),r.delete(e)}.bind(e,{height:e.style.height,resize:e.style.resize,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",s,!1),"onpropertychange"in e&&"oninput"in e&&e.addEventListener("keyup",p,!1),window.addEventListener("resize",i,!1),e.addEventListener("input",p,!1),e.addEventListener("autosize:update",p,!1),e.style.overflowX="hidden",e.style.wordWrap="break-word",r.set(e,{destroy:s,update:p}),a()}function a(){var n=window.getComputedStyle(e,null);"vertical"===n.resize?e.style.resize="none":"both"===n.resize&&(e.style.resize="horizontal"),t="content-box"===n.boxSizing?-(parseFloat(n.paddingTop)+parseFloat(n.paddingBottom)):parseFloat(n.borderTopWidth)+parseFloat(n.borderBottomWidth),isNaN(t)&&(t=0),p()}function c(t){var n=e.style.width;e.style.width="0px",e.offsetWidth,e.style.width=n,e.style.overflowY=t}function u(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push({node:e.parentNode,scrollTop:e.parentNode.scrollTop}),e=e.parentNode;return t}function d(){if(0!==e.scrollHeight){var o=u(e),r=document.documentElement&&document.documentElement.scrollTop;e.style.height="",e.style.height=e.scrollHeight+t+"px",n=e.clientWidth,o.forEach((function(e){e.node.scrollTop=e.scrollTop})),r&&(document.documentElement.scrollTop=r)}}function p(){d();var t=Math.round(parseFloat(e.style.height)),n=window.getComputedStyle(e,null),r="content-box"===n.boxSizing?Math.round(parseFloat(n.height)):e.offsetHeight;if(r{var n; -/*! - Copyright (c) 2018 Jed Watson. - Licensed under the MIT License (MIT), see - http://jedwatson.github.io/classnames -*/!function(){"use strict";var o={}.hasOwnProperty;function r(){for(var e=[],t=0;t{e.exports=function(e,t,n){return((n=window.getComputedStyle)?n(e):e.currentStyle)[t.replace(/-(\w)/gi,(function(e,t){return t.toUpperCase()}))]}},5417:(e,t)=>{"use strict";function n(){}function o(e,t,n,o,r){for(var l=0,i=t.length,s=0,a=0;le.length?n:e})),c.value=e.join(d)}else c.value=e.join(n.slice(s,s+c.count));s+=c.count,c.added||(a+=c.count)}}var p=t[i-1];return i>1&&"string"==typeof p.value&&(p.added||p.removed)&&e.equals("",p.value)&&(t[i-2].value+=p.value,t.pop()),t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,n.prototype={diff:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.callback;"function"==typeof n&&(r=n,n={}),this.options=n;var l=this;function i(e){return r?(setTimeout((function(){r(void 0,e)}),0),!0):e}e=this.castInput(e),t=this.castInput(t),e=this.removeEmpty(this.tokenize(e));var s=(t=this.removeEmpty(this.tokenize(t))).length,a=e.length,c=1,u=s+a,d=[{newPos:-1,components:[]}],p=this.extractCommon(d[0],t,e,0);if(d[0].newPos+1>=s&&p+1>=a)return i([{value:this.join(t),count:t.length}]);function m(){for(var n=-1*c;n<=c;n+=2){var r=void 0,u=d[n-1],p=d[n+1],m=(p?p.newPos:0)-n;u&&(d[n-1]=void 0);var h=u&&u.newPos+1=s&&m+1>=a)return i(o(l,r.components,t,e,l.useLongestToken));d[n]=r}else d[n]=void 0}var f;c++}if(r)!function e(){setTimeout((function(){if(c>u)return r();m()||e()}),0)}();else for(;c<=u;){var h=m();if(h)return h}},pushComponent:function(e,t,n){var o=e[e.length-1];o&&o.added===t&&o.removed===n?e[e.length-1]={count:o.count+1,added:t,removed:n}:e.push({count:1,added:t,removed:n})},extractCommon:function(e,t,n,o){for(var r=t.length,l=n.length,i=e.newPos,s=i-o,a=0;i+1{"use strict";var o;t.JJ=function(e,t,n){return r.diff(e,t,n)};var r=new(((o=n(5417))&&o.__esModule?o:{default:o}).default)},1637:(e,t,n)=>{"use strict";var o=n(3062);e.exports=function(e,t,n){n=n||{},9===t.nodeType&&(t=o.getWindow(t));var r=n.allowHorizontalScroll,l=n.onlyScrollIfNeeded,i=n.alignWithTop,s=n.alignWithLeft,a=n.offsetTop||0,c=n.offsetLeft||0,u=n.offsetBottom||0,d=n.offsetRight||0;r=void 0===r||r;var p=o.isWindow(t),m=o.offset(e),h=o.outerHeight(e),g=o.outerWidth(e),f=void 0,b=void 0,v=void 0,k=void 0,_=void 0,y=void 0,E=void 0,w=void 0,S=void 0,C=void 0;p?(E=t,C=o.height(E),S=o.width(E),w={left:o.scrollLeft(E),top:o.scrollTop(E)},_={left:m.left-w.left-c,top:m.top-w.top-a},y={left:m.left+g-(w.left+S)+d,top:m.top+h-(w.top+C)+u},k=w):(f=o.offset(t),b=t.clientHeight,v=t.clientWidth,k={left:t.scrollLeft,top:t.scrollTop},_={left:m.left-(f.left+(parseFloat(o.css(t,"borderLeftWidth"))||0))-c,top:m.top-(f.top+(parseFloat(o.css(t,"borderTopWidth"))||0))-a},y={left:m.left+g-(f.left+v+(parseFloat(o.css(t,"borderRightWidth"))||0))+d,top:m.top+h-(f.top+b+(parseFloat(o.css(t,"borderBottomWidth"))||0))+u}),_.top<0||y.top>0?!0===i?o.scrollTop(t,k.top+_.top):!1===i?o.scrollTop(t,k.top+y.top):_.top<0?o.scrollTop(t,k.top+_.top):o.scrollTop(t,k.top+y.top):l||((i=void 0===i||!!i)?o.scrollTop(t,k.top+_.top):o.scrollTop(t,k.top+y.top)),r&&(_.left<0||y.left>0?!0===s?o.scrollLeft(t,k.left+_.left):!1===s?o.scrollLeft(t,k.left+y.left):_.left<0?o.scrollLeft(t,k.left+_.left):o.scrollLeft(t,k.left+y.left):l||((s=void 0===s||!!s)?o.scrollLeft(t,k.left+_.left):o.scrollLeft(t,k.left+y.left)))}},5428:(e,t,n)=>{"use strict";e.exports=n(1637)},3062:e=>{"use strict";var t=Object.assign||function(e){for(var t=1;t{"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var o,r,l;if(Array.isArray(t)){if((o=t.length)!=n.length)return!1;for(r=o;0!=r--;)if(!e(t[r],n[r]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(r of t.entries())if(!n.has(r[0]))return!1;for(r of t.entries())if(!e(r[1],n.get(r[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(r of t.entries())if(!n.has(r[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if((o=t.length)!=n.length)return!1;for(r=o;0!=r--;)if(t[r]!==n[r])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((o=(l=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(r=o;0!=r--;)if(!Object.prototype.hasOwnProperty.call(n,l[r]))return!1;for(r=o;0!=r--;){var i=l[r];if(!e(t[i],n[i]))return!1}return!0}return t!=t&&n!=n}},5215:e=>{"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var o,r,l;if(Array.isArray(t)){if((o=t.length)!=n.length)return!1;for(r=o;0!=r--;)if(!e(t[r],n[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((o=(l=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(r=o;0!=r--;)if(!Object.prototype.hasOwnProperty.call(n,l[r]))return!1;for(r=o;0!=r--;){var i=l[r];if(!e(t[i],n[i]))return!1}return!0}return t!=t&&n!=n}},461:(e,t,n)=>{var o=n(6109);e.exports=function(e){var t=o(e,"line-height"),n=parseFloat(t,10);if(t===n+""){var r=e.style.lineHeight;e.style.lineHeight=t+"em",t=o(e,"line-height"),n=parseFloat(t,10),r?e.style.lineHeight=r:delete e.style.lineHeight}if(-1!==t.indexOf("pt")?(n*=4,n/=3):-1!==t.indexOf("mm")?(n*=96,n/=25.4):-1!==t.indexOf("cm")?(n*=96,n/=2.54):-1!==t.indexOf("in")?n*=96:-1!==t.indexOf("pc")&&(n*=16),n=Math.round(n),"normal"===t){var l=e.nodeName,i=document.createElement(l);i.innerHTML=" ","TEXTAREA"===l.toUpperCase()&&i.setAttribute("rows","1");var s=o(e,"font-size");i.style.fontSize=s,i.style.padding="0px",i.style.border="0px";var a=document.body;a.appendChild(i),n=i.offsetHeight,a.removeChild(i)}return n}},7520:(e,t,n)=>{e.exports=n(7191)},8202:e=>{"use strict";var t=!("undefined"==typeof window||!window.document||!window.document.createElement),n={canUseDOM:t,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:t&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:t&&!!window.screen,isInWorker:!t};e.exports=n},2213:e=>{var t,n,o,r,l,i,s,a,c,u,d,p,m,h,g,f=!1;function b(){if(!f){f=!0;var e=navigator.userAgent,b=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(e),v=/(Mac OS X)|(Windows)|(Linux)/.exec(e);if(p=/\b(iPhone|iP[ao]d)/.exec(e),m=/\b(iP[ao]d)/.exec(e),u=/Android/i.exec(e),h=/FBAN\/\w+;/i.exec(e),g=/Mobile/i.exec(e),d=!!/Win64/.exec(e),b){(t=b[1]?parseFloat(b[1]):b[5]?parseFloat(b[5]):NaN)&&document&&document.documentMode&&(t=document.documentMode);var k=/(?:Trident\/(\d+.\d+))/.exec(e);i=k?parseFloat(k[1])+4:t,n=b[2]?parseFloat(b[2]):NaN,o=b[3]?parseFloat(b[3]):NaN,(r=b[4]?parseFloat(b[4]):NaN)?(b=/(?:Chrome\/(\d+\.\d+))/.exec(e),l=b&&b[1]?parseFloat(b[1]):NaN):l=NaN}else t=n=o=l=r=NaN;if(v){if(v[1]){var _=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);s=!_||parseFloat(_[1].replace("_","."))}else s=!1;a=!!v[2],c=!!v[3]}else s=a=c=!1}}var v={ie:function(){return b()||t},ieCompatibilityMode:function(){return b()||i>t},ie64:function(){return v.ie()&&d},firefox:function(){return b()||n},opera:function(){return b()||o},webkit:function(){return b()||r},safari:function(){return v.webkit()},chrome:function(){return b()||l},windows:function(){return b()||a},osx:function(){return b()||s},linux:function(){return b()||c},iphone:function(){return b()||p},mobile:function(){return b()||p||m||u||g},nativeApp:function(){return b()||h},android:function(){return b()||u},ipad:function(){return b()||m}};e.exports=v},1087:(e,t,n)=>{"use strict";var o,r=n(8202);r.canUseDOM&&(o=document.implementation&&document.implementation.hasFeature&&!0!==document.implementation.hasFeature("","")) +*/o=[e,t],n=function(e,t){"use strict";var n,o,r="function"==typeof Map?new Map:(n=[],o=[],{has:function(e){return n.indexOf(e)>-1},get:function(e){return o[n.indexOf(e)]},set:function(e,t){-1===n.indexOf(e)&&(n.push(e),o.push(t))},delete:function(e){var t=n.indexOf(e);t>-1&&(n.splice(t,1),o.splice(t,1))}}),s=function(e){return new Event(e,{bubbles:!0})};try{new Event("test")}catch(e){s=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!1),t}}function i(e){if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!r.has(e)){var t=null,n=null,o=null,i=function(){e.clientWidth!==n&&p()},l=function(t){window.removeEventListener("resize",i,!1),e.removeEventListener("input",p,!1),e.removeEventListener("keyup",p,!1),e.removeEventListener("autosize:destroy",l,!1),e.removeEventListener("autosize:update",p,!1),Object.keys(t).forEach((function(n){e.style[n]=t[n]})),r.delete(e)}.bind(e,{height:e.style.height,resize:e.style.resize,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",l,!1),"onpropertychange"in e&&"oninput"in e&&e.addEventListener("keyup",p,!1),window.addEventListener("resize",i,!1),e.addEventListener("input",p,!1),e.addEventListener("autosize:update",p,!1),e.style.overflowX="hidden",e.style.wordWrap="break-word",r.set(e,{destroy:l,update:p}),a()}function a(){var n=window.getComputedStyle(e,null);"vertical"===n.resize?e.style.resize="none":"both"===n.resize&&(e.style.resize="horizontal"),t="content-box"===n.boxSizing?-(parseFloat(n.paddingTop)+parseFloat(n.paddingBottom)):parseFloat(n.borderTopWidth)+parseFloat(n.borderBottomWidth),isNaN(t)&&(t=0),p()}function c(t){var n=e.style.width;e.style.width="0px",e.offsetWidth,e.style.width=n,e.style.overflowY=t}function u(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push({node:e.parentNode,scrollTop:e.parentNode.scrollTop}),e=e.parentNode;return t}function d(){if(0!==e.scrollHeight){var o=u(e),r=document.documentElement&&document.documentElement.scrollTop;e.style.height="",e.style.height=e.scrollHeight+t+"px",n=e.clientWidth,o.forEach((function(e){e.node.scrollTop=e.scrollTop})),r&&(document.documentElement.scrollTop=r)}}function p(){d();var t=Math.round(parseFloat(e.style.height)),n=window.getComputedStyle(e,null),r="content-box"===n.boxSizing?Math.round(parseFloat(n.height)):e.offsetHeight;if(r{e.exports=function(e,t,n){return((n=window.getComputedStyle)?n(e):e.currentStyle)[t.replace(/-(\w)/gi,(function(e,t){return t.toUpperCase()}))]}},5417:(e,t)=>{"use strict";function n(){}function o(e,t,n,o,r){for(var s=0,i=t.length,l=0,a=0;se.length?n:e})),c.value=e.join(d)}else c.value=e.join(n.slice(l,l+c.count));l+=c.count,c.added||(a+=c.count)}}var p=t[i-1];return i>1&&"string"==typeof p.value&&(p.added||p.removed)&&e.equals("",p.value)&&(t[i-2].value+=p.value,t.pop()),t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,n.prototype={diff:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.callback;"function"==typeof n&&(r=n,n={}),this.options=n;var s=this;function i(e){return r?(setTimeout((function(){r(void 0,e)}),0),!0):e}e=this.castInput(e),t=this.castInput(t),e=this.removeEmpty(this.tokenize(e));var l=(t=this.removeEmpty(this.tokenize(t))).length,a=e.length,c=1,u=l+a,d=[{newPos:-1,components:[]}],p=this.extractCommon(d[0],t,e,0);if(d[0].newPos+1>=l&&p+1>=a)return i([{value:this.join(t),count:t.length}]);function h(){for(var n=-1*c;n<=c;n+=2){var r=void 0,u=d[n-1],p=d[n+1],h=(p?p.newPos:0)-n;u&&(d[n-1]=void 0);var g=u&&u.newPos+1=l&&h+1>=a)return i(o(s,r.components,t,e,s.useLongestToken));d[n]=r}else d[n]=void 0}var f;c++}if(r)!function e(){setTimeout((function(){if(c>u)return r();h()||e()}),0)}();else for(;c<=u;){var g=h();if(g)return g}},pushComponent:function(e,t,n){var o=e[e.length-1];o&&o.added===t&&o.removed===n?e[e.length-1]={count:o.count+1,added:t,removed:n}:e.push({count:1,added:t,removed:n})},extractCommon:function(e,t,n,o){for(var r=t.length,s=n.length,i=e.newPos,l=i-o,a=0;i+1{"use strict";var o;t.JJ=function(e,t,n){return r.diff(e,t,n)};var r=new(((o=n(5417))&&o.__esModule?o:{default:o}).default)},7734:e=>{"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var o,r,s;if(Array.isArray(t)){if((o=t.length)!=n.length)return!1;for(r=o;0!=r--;)if(!e(t[r],n[r]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(r of t.entries())if(!n.has(r[0]))return!1;for(r of t.entries())if(!e(r[1],n.get(r[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(r of t.entries())if(!n.has(r[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if((o=t.length)!=n.length)return!1;for(r=o;0!=r--;)if(t[r]!==n[r])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((o=(s=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(r=o;0!=r--;)if(!Object.prototype.hasOwnProperty.call(n,s[r]))return!1;for(r=o;0!=r--;){var i=s[r];if(!e(t[i],n[i]))return!1}return!0}return t!=t&&n!=n}},5215:e=>{"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var o,r,s;if(Array.isArray(t)){if((o=t.length)!=n.length)return!1;for(r=o;0!=r--;)if(!e(t[r],n[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((o=(s=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(r=o;0!=r--;)if(!Object.prototype.hasOwnProperty.call(n,s[r]))return!1;for(r=o;0!=r--;){var i=s[r];if(!e(t[i],n[i]))return!1}return!0}return t!=t&&n!=n}},461:(e,t,n)=>{var o=n(6109);e.exports=function(e){var t=o(e,"line-height"),n=parseFloat(t,10);if(t===n+""){var r=e.style.lineHeight;e.style.lineHeight=t+"em",t=o(e,"line-height"),n=parseFloat(t,10),r?e.style.lineHeight=r:delete e.style.lineHeight}if(-1!==t.indexOf("pt")?(n*=4,n/=3):-1!==t.indexOf("mm")?(n*=96,n/=25.4):-1!==t.indexOf("cm")?(n*=96,n/=2.54):-1!==t.indexOf("in")?n*=96:-1!==t.indexOf("pc")&&(n*=16),n=Math.round(n),"normal"===t){var s=e.nodeName,i=document.createElement(s);i.innerHTML=" ","TEXTAREA"===s.toUpperCase()&&i.setAttribute("rows","1");var l=o(e,"font-size");i.style.fontSize=l,i.style.padding="0px",i.style.border="0px";var a=document.body;a.appendChild(i),n=i.offsetHeight,a.removeChild(i)}return n}},7520:(e,t,n)=>{e.exports=n(7191)},8202:e=>{"use strict";var t=!("undefined"==typeof window||!window.document||!window.document.createElement),n={canUseDOM:t,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:t&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:t&&!!window.screen,isInWorker:!t};e.exports=n},2213:e=>{var t,n,o,r,s,i,l,a,c,u,d,p,h,g,m,f=!1;function b(){if(!f){f=!0;var e=navigator.userAgent,b=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(e),v=/(Mac OS X)|(Windows)|(Linux)/.exec(e);if(p=/\b(iPhone|iP[ao]d)/.exec(e),h=/\b(iP[ao]d)/.exec(e),u=/Android/i.exec(e),g=/FBAN\/\w+;/i.exec(e),m=/Mobile/i.exec(e),d=!!/Win64/.exec(e),b){(t=b[1]?parseFloat(b[1]):b[5]?parseFloat(b[5]):NaN)&&document&&document.documentMode&&(t=document.documentMode);var k=/(?:Trident\/(\d+.\d+))/.exec(e);i=k?parseFloat(k[1])+4:t,n=b[2]?parseFloat(b[2]):NaN,o=b[3]?parseFloat(b[3]):NaN,(r=b[4]?parseFloat(b[4]):NaN)?(b=/(?:Chrome\/(\d+\.\d+))/.exec(e),s=b&&b[1]?parseFloat(b[1]):NaN):s=NaN}else t=n=o=s=r=NaN;if(v){if(v[1]){var _=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);l=!_||parseFloat(_[1].replace("_","."))}else l=!1;a=!!v[2],c=!!v[3]}else l=a=c=!1}}var v={ie:function(){return b()||t},ieCompatibilityMode:function(){return b()||i>t},ie64:function(){return v.ie()&&d},firefox:function(){return b()||n},opera:function(){return b()||o},webkit:function(){return b()||r},safari:function(){return v.webkit()},chrome:function(){return b()||s},windows:function(){return b()||a},osx:function(){return b()||l},linux:function(){return b()||c},iphone:function(){return b()||p},mobile:function(){return b()||p||h||u||m},nativeApp:function(){return b()||g},android:function(){return b()||u},ipad:function(){return b()||h}};e.exports=v},1087:(e,t,n)=>{"use strict";var o,r=n(8202);r.canUseDOM&&(o=document.implementation&&document.implementation.hasFeature&&!0!==document.implementation.hasFeature("","")) /** * Checks if an event is supported in the current execution environment. * @@ -23,19 +18,4 @@ * @return {boolean} True if the event is supported. * @internal * @license Modernizr 3.0.0pre (Custom Build) | MIT - */,e.exports=function(e,t){if(!r.canUseDOM||t&&!("addEventListener"in document))return!1;var n="on"+e,l=n in document;if(!l){var i=document.createElement("div");i.setAttribute(n,"return;"),l="function"==typeof i[n]}return!l&&o&&"wheel"===e&&(l=document.implementation.hasFeature("Events.wheel","3.0")),l}},7191:(e,t,n)=>{"use strict";var o=n(2213),r=n(1087);function l(e){var t=0,n=0,o=0,r=0;return"detail"in e&&(n=e.detail),"wheelDelta"in e&&(n=-e.wheelDelta/120),"wheelDeltaY"in e&&(n=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=n,n=0),o=10*t,r=10*n,"deltaY"in e&&(r=e.deltaY),"deltaX"in e&&(o=e.deltaX),(o||r)&&e.deltaMode&&(1==e.deltaMode?(o*=40,r*=40):(o*=800,r*=800)),o&&!t&&(t=o<1?-1:1),r&&!n&&(n=r<1?-1:1),{spinX:t,spinY:n,pixelX:o,pixelY:r}}l.getEventType=function(){return o.firefox()?"DOMMouseScroll":r("wheel")?"wheel":"mousewheel"},e.exports=l},2775:e=>{var t=String,n=function(){return{isColorSupported:!1,reset:t,bold:t,dim:t,italic:t,underline:t,inverse:t,hidden:t,strikethrough:t,black:t,red:t,green:t,yellow:t,blue:t,magenta:t,cyan:t,white:t,gray:t,bgBlack:t,bgRed:t,bgGreen:t,bgYellow:t,bgBlue:t,bgMagenta:t,bgCyan:t,bgWhite:t}};e.exports=n(),e.exports.createColors=n},4465:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},8036:function(e,t,n){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};n(4465);const r=o(n(4529)),l=o(n(3576));e.exports=(0,l.default)(r.default)},5525:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.prefixWrapCSSSelector=t.prefixWrapCSSRule=void 0;const o=n(3467);t.prefixWrapCSSRule=(e,n,r,l,i)=>{const s=e.selector.split(",").filter((e=>!(0,o.cssRuleMatchesPrefixSelector)({selector:e},l)));0!==s.length&&(e.selector=s.map((o=>(0,t.prefixWrapCSSSelector)(o,e,n,r,l,i))).filter(o.isValidCSSSelector).join(", "))};t.prefixWrapCSSSelector=(e,t,n,r,l,i)=>{const s=(0,o.cleanSelector)(e);return""===s?null:null!==n&&s.startsWith(n,0)||(0,o.isKeyframes)(t)||r.some((e=>s.match(e)))?s:(0,o.isNotRootTag)(s)?l+" "+s:i?l+" ."+s:s.replace(/^(body|html|:root)/,l)}},3467:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cssRuleMatchesPrefixSelector=t.isNotRootTag=t.isKeyframes=t.cleanSelector=t.isValidCSSSelector=void 0;const n=/(^\s*|\s*$)/g,o=/^(body|html|:root).*$/;t.isValidCSSSelector=e=>null!==e;t.cleanSelector=e=>e.replace(n,"");t.isKeyframes=e=>{const{parent:t}=e,n=t;return void 0!==t&&"atrule"===n.type&&void 0!==n.name&&null!==n.name.match(/keyframes$/)};t.isNotRootTag=e=>!e.match(o);t.cssRuleMatchesPrefixSelector=(e,t)=>{const n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`^${n}$`).test(e.selector)}},9411:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.shouldIncludeFilePath=void 0;t.shouldIncludeFilePath=(e,t,n)=>t.length>0?null!=e&&t.some((t=>e.match(t))):!(n.length>0)||!(null!=e&&n.some((t=>e.match(t))))},8061:function(e,t,n){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,o,r)}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&o(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.asPostCSSv7PluginGenerator=void 0;const i=l(n(1311));t.asPostCSSv7PluginGenerator=e=>e.plugin(i.PLUGIN_NAME,((e,t)=>new i.default(e,t).prefix()))},2888:function(e,t,n){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,o,r)}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&o(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.asPostCSSv8PluginGenerator=t.isPostCSSv8=void 0;const i=l(n(1311));t.isPostCSSv8=e=>void 0!==e.Root;t.asPostCSSv8PluginGenerator=()=>(e,t)=>{const n=new i.default(e,t);return{postcssPlugin:i.PLUGIN_NAME,Once(e){n.prefixRoot(e)}}}},3576:(e,t,n)=>{"use strict";const o=n(2888),r=n(8061);e.exports=e=>(0,o.isPostCSSv8)(e)?(0,o.asPostCSSv8PluginGenerator)():(0,r.asPostCSSv7PluginGenerator)(e)},1311:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PLUGIN_NAME=void 0;const o=n(5525),r=n(9411);t.PLUGIN_NAME="postcss-prefixwrap";t.default=class{blacklist;ignoredSelectors;isPrefixSelector;prefixRootTags;prefixSelector;whitelist;nested;constructor(e,t={}){this.blacklist=t.blacklist??[],this.ignoredSelectors=t.ignoredSelectors??[],this.isPrefixSelector=new RegExp(`^${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`),this.prefixRootTags=t.prefixRootTags??!1,this.prefixSelector=e,this.whitelist=t.whitelist??[],this.nested=t.nested??null}prefixRoot(e){(0,r.shouldIncludeFilePath)(e.source?.input?.file,this.whitelist,this.blacklist)&&e.walkRules((e=>{(0,o.prefixWrapCSSRule)(e,this.nested,this.ignoredSelectors,this.prefixSelector,this.prefixRootTags)}))}prefix(){return e=>{this.prefixRoot(e)}}}},5404:(e,t,n)=>{const o=n(1544);e.exports=e=>{const t=Object.assign({skipHostRelativeUrls:!0},e);return{postcssPlugin:"rebaseUrl",Declaration(n){const r=o(n.value);let l=!1;r.walk((n=>{if("function"!==n.type||"url"!==n.value)return;const o=n.nodes[0].value,r=new URL(o,e.rootUrl);return r.pathname===o&&t.skipHostRelativeUrls||(n.nodes[0].value=r.toString(),l=!0),!1})),l&&(n.value=o.stringify(r))}}},e.exports.postcss=!0},1544:(e,t,n)=>{var o=n(8491),r=n(3815),l=n(4725);function i(e){return this instanceof i?(this.nodes=o(e),this):new i(e)}i.prototype.toString=function(){return Array.isArray(this.nodes)?l(this.nodes):""},i.prototype.walk=function(e,t){return r(this.nodes,e,t),this},i.unit=n(1524),i.walk=r,i.stringify=l,e.exports=i},8491:e=>{var t="(".charCodeAt(0),n=")".charCodeAt(0),o="'".charCodeAt(0),r='"'.charCodeAt(0),l="\\".charCodeAt(0),i="/".charCodeAt(0),s=",".charCodeAt(0),a=":".charCodeAt(0),c="*".charCodeAt(0),u="u".charCodeAt(0),d="U".charCodeAt(0),p="+".charCodeAt(0),m=/^[a-f0-9?-]+$/i;e.exports=function(e){for(var h,g,f,b,v,k,_,y,E,w=[],S=e,C=0,x=S.charCodeAt(C),B=S.length,I=[{nodes:w}],T=0,M="",P="",R="";C{function t(e,t){var o,r,l=e.type,i=e.value;return t&&void 0!==(r=t(e))?r:"word"===l||"space"===l?i:"string"===l?(o=e.quote||"")+i+(e.unclosed?"":o):"comment"===l?"/*"+i+(e.unclosed?"":"*/"):"div"===l?(e.before||"")+i+(e.after||""):Array.isArray(e.nodes)?(o=n(e.nodes,t),"function"!==l?o:i+"("+(e.before||"")+o+(e.after||"")+(e.unclosed?"":")")):i}function n(e,n){var o,r;if(Array.isArray(e)){for(o="",r=e.length-1;~r;r-=1)o=t(e[r],n)+o;return o}return t(e,n)}e.exports=n},1524:e=>{var t="-".charCodeAt(0),n="+".charCodeAt(0),o=".".charCodeAt(0),r="e".charCodeAt(0),l="E".charCodeAt(0);e.exports=function(e){var i,s,a,c=0,u=e.length;if(0===u||!function(e){var r,l=e.charCodeAt(0);if(l===n||l===t){if((r=e.charCodeAt(1))>=48&&r<=57)return!0;var i=e.charCodeAt(2);return r===o&&i>=48&&i<=57}return l===o?(r=e.charCodeAt(1))>=48&&r<=57:l>=48&&l<=57}(e))return!1;for((i=e.charCodeAt(c))!==n&&i!==t||c++;c57);)c+=1;if(i=e.charCodeAt(c),s=e.charCodeAt(c+1),i===o&&s>=48&&s<=57)for(c+=2;c57);)c+=1;if(i=e.charCodeAt(c),s=e.charCodeAt(c+1),a=e.charCodeAt(c+2),(i===r||i===l)&&(s>=48&&s<=57||(s===n||s===t)&&a>=48&&a<=57))for(c+=s===n||s===t?3:2;c57);)c+=1;return{number:e.slice(0,c),unit:e.slice(c)}}},3815:e=>{e.exports=function e(t,n,o){var r,l,i,s;for(r=0,l=t.length;r{"use strict";let o=n(683);class r extends o{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}}e.exports=r,r.default=r,o.registerAtRule(r)},6589:(e,t,n)=>{"use strict";let o=n(7490);class r extends o{constructor(e){super(e),this.type="comment"}}e.exports=r,r.default=r},683:(e,t,n)=>{"use strict";let o,r,l,i,{isClean:s,my:a}=n(1381),c=n(1516),u=n(6589),d=n(7490);function p(e){return e.map((e=>(e.nodes&&(e.nodes=p(e.nodes)),delete e.source,e)))}function m(e){if(e[s]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)m(t)}class h extends d{append(...e){for(let t of e){let e=this.normalize(t,this.last);for(let t of e)this.proxyOf.nodes.push(t)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t,n,o=this.getIterator();for(;this.indexes[o]"proxyOf"===t?e:e[t]?"each"===t||"string"==typeof t&&t.startsWith("walk")?(...n)=>e[t](...n.map((e=>"function"==typeof e?(t,n)=>e(t.toProxy(),n):e))):"every"===t||"some"===t?n=>e[t](((e,...t)=>n(e.toProxy(),...t))):"root"===t?()=>e.root().toProxy():"nodes"===t?e.nodes.map((e=>e.toProxy())):"first"===t||"last"===t?e[t].toProxy():e[t]:e[t],set:(e,t,n)=>(e[t]===n||(e[t]=n,"name"!==t&&"params"!==t&&"selector"!==t||e.markDirty()),!0)}}index(e){return"number"==typeof e?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let n,o=this.index(e),r=this.normalize(t,this.proxyOf.nodes[o]).reverse();o=this.index(e);for(let e of r)this.proxyOf.nodes.splice(o+1,0,e);for(let e in this.indexes)n=this.indexes[e],o(e[a]||h.rebuild(e),(e=e.proxyOf).parent&&e.parent.removeChild(e),e[s]&&m(e),void 0===e.raws.before&&t&&void 0!==t.raws.before&&(e.raws.before=t.raws.before.replace(/\S/g,"")),e.parent=this.proxyOf,e)))}prepend(...e){e=e.reverse();for(let t of e){let e=this.normalize(t,this.first,"prepend").reverse();for(let t of e)this.proxyOf.nodes.unshift(t);for(let t in this.indexes)this.indexes[t]=this.indexes[t]+e.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){let t;e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);for(let n in this.indexes)t=this.indexes[n],t>=e&&(this.indexes[n]=t-1);return this.markDirty(),this}replaceValues(e,t,n){return n||(n=t,t={}),this.walkDecls((o=>{t.props&&!t.props.includes(o.prop)||t.fast&&!o.value.includes(t.fast)||(o.value=o.value.replace(e,n))})),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each(((t,n)=>{let o;try{o=e(t,n)}catch(e){throw t.addToError(e)}return!1!==o&&t.walk&&(o=t.walk(e)),o}))}walkAtRules(e,t){return t?e instanceof RegExp?this.walk(((n,o)=>{if("atrule"===n.type&&e.test(n.name))return t(n,o)})):this.walk(((n,o)=>{if("atrule"===n.type&&n.name===e)return t(n,o)})):(t=e,this.walk(((e,n)=>{if("atrule"===e.type)return t(e,n)})))}walkComments(e){return this.walk(((t,n)=>{if("comment"===t.type)return e(t,n)}))}walkDecls(e,t){return t?e instanceof RegExp?this.walk(((n,o)=>{if("decl"===n.type&&e.test(n.prop))return t(n,o)})):this.walk(((n,o)=>{if("decl"===n.type&&n.prop===e)return t(n,o)})):(t=e,this.walk(((e,n)=>{if("decl"===e.type)return t(e,n)})))}walkRules(e,t){return t?e instanceof RegExp?this.walk(((n,o)=>{if("rule"===n.type&&e.test(n.selector))return t(n,o)})):this.walk(((n,o)=>{if("rule"===n.type&&n.selector===e)return t(n,o)})):(t=e,this.walk(((e,n)=>{if("rule"===e.type)return t(e,n)})))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}}h.registerParse=e=>{o=e},h.registerRule=e=>{r=e},h.registerAtRule=e=>{l=e},h.registerRoot=e=>{i=e},e.exports=h,h.default=h,h.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,l.prototype):"rule"===e.type?Object.setPrototypeOf(e,r.prototype):"decl"===e.type?Object.setPrototypeOf(e,c.prototype):"comment"===e.type?Object.setPrototypeOf(e,u.prototype):"root"===e.type&&Object.setPrototypeOf(e,i.prototype),e[a]=!0,e.nodes&&e.nodes.forEach((e=>{h.rebuild(e)}))}},356:(e,t,n)=>{"use strict";let o=n(2775),r=n(9746);class l extends Error{constructor(e,t,n,o,r,i){super(e),this.name="CssSyntaxError",this.reason=e,r&&(this.file=r),o&&(this.source=o),i&&(this.plugin=i),void 0!==t&&void 0!==n&&("number"==typeof t?(this.line=t,this.column=n):(this.line=t.line,this.column=t.column,this.endLine=n.line,this.endColumn=n.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,l)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"",void 0!==this.line&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;null==e&&(e=o.isColorSupported),r&&e&&(t=r(t));let n,l,i=t.split(/\r?\n/),s=Math.max(this.line-3,0),a=Math.min(this.line+2,i.length),c=String(a).length;if(e){let{bold:e,gray:t,red:r}=o.createColors(!0);n=t=>e(r(t)),l=e=>t(e)}else n=l=e=>e;return i.slice(s,a).map(((e,t)=>{let o=s+1+t,r=" "+(" "+o).slice(-c)+" | ";if(o===this.line){let t=l(r.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return n(">")+l(r)+e+"\n "+t+n("^")}return" "+l(r)+e})).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}}e.exports=l,l.default=l},1516:(e,t,n)=>{"use strict";let o=n(7490);class r extends o{constructor(e){e&&void 0!==e.value&&"string"!=typeof e.value&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||"$"===this.prop[0]}}e.exports=r,r.default=r},271:(e,t,n)=>{"use strict";let o,r,l=n(683);class i extends l{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new o(new r,this,e).stringify()}}i.registerLazyResult=e=>{o=e},i.registerProcessor=e=>{r=e},e.exports=i,i.default=i},8940:(e,t,n)=>{"use strict";let o=n(1516),r=n(5696),l=n(6589),i=n(1326),s=n(5380),a=n(9434),c=n(4092);function u(e,t){if(Array.isArray(e))return e.map((e=>u(e)));let{inputs:n,...d}=e;if(n){t=[];for(let e of n){let n={...e,__proto__:s.prototype};n.map&&(n.map={...n.map,__proto__:r.prototype}),t.push(n)}}if(d.nodes&&(d.nodes=e.nodes.map((e=>u(e,t)))),d.source){let{inputId:e,...n}=d.source;d.source=n,null!=e&&(d.source.input=t[e])}if("root"===d.type)return new a(d);if("decl"===d.type)return new o(d);if("rule"===d.type)return new c(d);if("comment"===d.type)return new l(d);if("atrule"===d.type)return new i(d);throw new Error("Unknown node type: "+e.type)}e.exports=u,u.default=u},5380:(e,t,n)=>{"use strict";let{SourceMapConsumer:o,SourceMapGenerator:r}=n(1866),{fileURLToPath:l,pathToFileURL:i}=n(2739),{isAbsolute:s,resolve:a}=n(197),{nanoid:c}=n(5042),u=n(9746),d=n(356),p=n(5696),m=Symbol("fromOffsetCache"),h=Boolean(o&&r),g=Boolean(a&&s);class f{constructor(e,t={}){if(null==e||"object"==typeof e&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),"\ufeff"===this.css[0]||"￾"===this.css[0]?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!g||/^\w+:\/\//.test(t.from)||s(t.from)?this.file=t.from:this.file=a(t.from)),g&&h){let e=new p(this.css,t);if(e.text){this.map=e;let t=e.consumer().file;!this.file&&t&&(this.file=this.mapResolve(t))}}this.file||(this.id=""),this.map&&(this.map.file=this.from)}error(e,t,n,o={}){let r,l,s;if(t&&"object"==typeof t){let e=t,o=n;if("number"==typeof e.offset){let o=this.fromOffset(e.offset);t=o.line,n=o.col}else t=e.line,n=e.column;if("number"==typeof o.offset){let e=this.fromOffset(o.offset);l=e.line,s=e.col}else l=o.line,s=o.column}else if(!n){let e=this.fromOffset(t);t=e.line,n=e.col}let a=this.origin(t,n,l,s);return r=a?new d(e,void 0===a.endLine?a.line:{column:a.column,line:a.line},void 0===a.endLine?a.column:{column:a.endColumn,line:a.endLine},a.source,a.file,o.plugin):new d(e,void 0===l?t:{column:n,line:t},void 0===l?n:{column:s,line:l},this.css,this.file,o.plugin),r.input={column:n,endColumn:s,endLine:l,line:t,source:this.css},this.file&&(i&&(r.input.url=i(this.file).toString()),r.input.file=this.file),r}fromOffset(e){let t,n;if(this[m])n=this[m];else{let e=this.css.split("\n");n=new Array(e.length);let t=0;for(let o=0,r=e.length;o=t)o=n.length-1;else{let t,r=n.length-2;for(;o>1),e=n[t+1])){o=t;break}o=t+1}}return{col:e-n[o]+1,line:o+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:a(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,n,o){if(!this.map)return!1;let r,a,c=this.map.consumer(),u=c.originalPositionFor({column:t,line:e});if(!u.source)return!1;"number"==typeof n&&(r=c.originalPositionFor({column:o,line:n})),a=s(u.source)?i(u.source):new URL(u.source,this.map.consumer().sourceRoot||i(this.map.mapFile));let d={column:u.column,endColumn:r&&r.column,endLine:r&&r.line,line:u.line,url:a.toString()};if("file:"===a.protocol){if(!l)throw new Error("file: protocol is not available in this PostCSS build");d.file=l(a)}let p=c.sourceContentFor(u.source);return p&&(d.source=p),d}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])null!=this[t]&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}}e.exports=f,f.default=f,u&&u.registerInput&&u.registerInput(f)},448:(e,t,n)=>{"use strict";let{isClean:o,my:r}=n(1381),l=n(1670),i=n(633),s=n(683),a=n(271),c=(n(3122),n(9055)),u=n(4295),d=n(9434);const p={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},m={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},h={Once:!0,postcssPlugin:!0,prepare:!0},g=0;function f(e){return"object"==typeof e&&"function"==typeof e.then}function b(e){let t=!1,n=p[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[n,n+"-"+t,g,n+"Exit",n+"Exit-"+t]:t?[n,n+"-"+t,n+"Exit",n+"Exit-"+t]:e.append?[n,g,n+"Exit"]:[n,n+"Exit"]}function v(e){let t;return t="document"===e.type?["Document",g,"DocumentExit"]:"root"===e.type?["Root",g,"RootExit"]:b(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function k(e){return e[o]=!1,e.nodes&&e.nodes.forEach((e=>k(e))),e}let _={};class y{constructor(e,t,n){let o;if(this.stringified=!1,this.processed=!1,"object"!=typeof t||null===t||"root"!==t.type&&"document"!==t.type)if(t instanceof y||t instanceof c)o=k(t.root),t.map&&(void 0===n.map&&(n.map={}),n.map.inline||(n.map.inline=!1),n.map.prev=t.map);else{let e=u;n.syntax&&(e=n.syntax.parse),n.parser&&(e=n.parser),e.parse&&(e=e.parse);try{o=e(t,n)}catch(e){this.processed=!0,this.error=e}o&&!o[r]&&s.rebuild(o)}else o=k(t);this.result=new c(e,o,n),this.helpers={..._,postcss:_,result:this.result},this.plugins=this.processor.plugins.map((e=>"object"==typeof e&&e.prepare?{...e,...e.prepare(this.result)}:e))}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let n=this.result.lastPlugin;try{t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin?n.postcssVersion:(e.plugin=n.postcssPlugin,e.setMessage())}catch(e){console&&console.error&&console.error(e)}return e}prepareVisitors(){this.listeners={};let e=(e,t,n)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,n])};for(let t of this.plugins)if("object"==typeof t)for(let n in t){if(!m[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!h[n])if("object"==typeof t[n])for(let o in t[n])e(t,"*"===o?n:n+"-"+o.toLowerCase(),t[n][o]);else"function"==typeof t[n]&&e(t,n,t[n])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e0;){let e=this.visitTick(t);if(f(e))try{await e}catch(e){let n=t[t.length-1].node;throw this.handleError(e,n)}}}if(this.listeners.OnceExit)for(let[t,n]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if("document"===e.type){let t=e.nodes.map((e=>n(e,this.helpers)));await Promise.all(t)}else await n(e,this.helpers)}catch(e){throw this.handleError(e)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if("object"==typeof e&&e.Once){if("document"===this.result.root.type){let t=this.result.root.nodes.map((t=>e.Once(t,this.helpers)));return f(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}if("function"==typeof e)return e(this.result.root,this.result)}catch(e){throw this.handleError(e)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=i;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let n=new l(t,this.result.root,this.result.opts).generate();return this.result.css=n[0],this.result.map=n[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){if(f(this.runOnRoot(e)))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[o];)e[o]=!0,this.walkSync(e);if(this.listeners.OnceExit)if("document"===e.type)for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[n,o]of e){let e;this.result.lastPlugin=n;try{e=o(t,this.helpers)}catch(e){throw this.handleError(e,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(f(e))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:n,visitors:r}=t;if("root"!==n.type&&"document"!==n.type&&!n.parent)return void e.pop();if(r.length>0&&t.visitorIndex{e[o]||this.walkSync(e)}));else{let t=this.listeners[n];if(t&&this.visitSync(t,e.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}}y.registerPostcss=e=>{_=e},e.exports=y,y.default=y,d.registerLazyResult(y),a.registerLazyResult(y)},7374:e=>{"use strict";let t={comma:e=>t.split(e,[","],!0),space:e=>t.split(e,[" ","\n","\t"]),split(e,t,n){let o=[],r="",l=!1,i=0,s=!1,a="",c=!1;for(let n of e)c?c=!1:"\\"===n?c=!0:s?n===a&&(s=!1):'"'===n||"'"===n?(s=!0,a=n):"("===n?i+=1:")"===n?i>0&&(i-=1):0===i&&t.includes(n)&&(l=!0),l?(""!==r&&o.push(r.trim()),r="",l=!1):r+=n;return(n||""!==r)&&o.push(r.trim()),o}};e.exports=t,t.default=t},1670:(e,t,n)=>{"use strict";let{SourceMapConsumer:o,SourceMapGenerator:r}=n(1866),{dirname:l,relative:i,resolve:s,sep:a}=n(197),{pathToFileURL:c}=n(2739),u=n(5380),d=Boolean(o&&r),p=Boolean(l&&s&&i&&a);e.exports=class{constructor(e,t,n,o){this.stringify=e,this.mapOpts=n.map||{},this.root=t,this.opts=n,this.css=o,this.originalCSS=o,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;e=this.isInline()?"data:application/json;base64,"+this.toBase64(this.map.toString()):"string"==typeof this.mapOpts.annotation?this.mapOpts.annotation:"function"==typeof this.mapOpts.annotation?this.mapOpts.annotation(this.opts.to,this.root):this.outputFile()+".map";let t="\n";this.css.includes("\r\n")&&(t="\r\n"),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t,n=this.toUrl(this.path(e.file)),r=e.root||l(e.file);!1===this.mapOpts.sourcesContent?(t=new o(e.text),t.sourcesContent&&(t.sourcesContent=null)):t=e.consumer(),this.map.applySourceMap(t,n,this.toUrl(this.path(r)))}}clearAnnotation(){if(!1!==this.mapOpts.annotation)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],"comment"===e.type&&0===e.text.indexOf("# sourceMappingURL=")&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),p&&d&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,(t=>{e+=t})),[e]}}generateMap(){if(this.root)this.generateString();else if(1===this.previous().length){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=r.fromSourceMap(e)}else this.map=new r({file:this.outputFile()}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):""});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new r({file:this.outputFile()});let e,t,n=1,o=1,l="",i={generated:{column:0,line:0},original:{column:0,line:0},source:""};this.stringify(this.root,((r,s,a)=>{if(this.css+=r,s&&"end"!==a&&(i.generated.line=n,i.generated.column=o-1,s.source&&s.source.start?(i.source=this.sourcePath(s),i.original.line=s.source.start.line,i.original.column=s.source.start.column-1,this.map.addMapping(i)):(i.source=l,i.original.line=1,i.original.column=0,this.map.addMapping(i))),e=r.match(/\n/g),e?(n+=e.length,t=r.lastIndexOf("\n"),o=r.length-t):o+=r.length,s&&"start"!==a){let e=s.parent||{raws:{}};("decl"===s.type||"atrule"===s.type&&!s.nodes)&&s===e.last&&!e.raws.semicolon||(s.source&&s.source.end?(i.source=this.sourcePath(s),i.original.line=s.source.end.line,i.original.column=s.source.end.column-1,i.generated.line=n,i.generated.column=o-2,this.map.addMapping(i)):(i.source=l,i.original.line=1,i.original.column=0,i.generated.line=n,i.generated.column=o-1,this.map.addMapping(i)))}}))}isAnnotation(){return!!this.isInline()||(void 0!==this.mapOpts.annotation?this.mapOpts.annotation:!this.previous().length||this.previous().some((e=>e.annotation)))}isInline(){if(void 0!==this.mapOpts.inline)return this.mapOpts.inline;let e=this.mapOpts.annotation;return(void 0===e||!0===e)&&(!this.previous().length||this.previous().some((e=>e.inline)))}isMap(){return void 0!==this.opts.map?!!this.opts.map:this.previous().length>0}isSourcesContent(){return void 0!==this.mapOpts.sourcesContent?this.mapOpts.sourcesContent:!this.previous().length||this.previous().some((e=>e.withContent()))}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute)return e;if(60===e.charCodeAt(0))return e;if(/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let n=this.opts.to?l(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(n=l(s(n,this.mapOpts.annotation)));let o=i(n,e);return this.memoizedPaths.set(e,o),o}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk((e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}}));else{let e=new u(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk((t=>{if(t.source){let n=t.source.input.from;if(n&&!e[n]){e[n]=!0;let o=this.usesFileUrls?this.toFileUrl(n):this.toUrl(this.path(n));this.map.setSourceContent(o,t.source.input.css)}}}));else if(this.css){let e=this.opts.from?this.toUrl(this.path(this.opts.from)):"";this.map.setSourceContent(e,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(c){let t=c(e).toString();return this.memoizedFileURLs.set(e,t),t}throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;"\\"===a&&(e=e.replace(/\\/g,"/"));let n=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,n),n}}},7661:(e,t,n)=>{"use strict";let o=n(1670),r=n(633),l=(n(3122),n(4295));const i=n(9055);class s{constructor(e,t,n){let l;t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=n,this._map=void 0;let s=r;this.result=new i(this._processor,l,this._opts),this.result.css=t;let a=this;Object.defineProperty(this.result,"root",{get:()=>a.root});let c=new o(s,l,this._opts,t);if(c.isMap()){let[e,t]=c.generate();e&&(this.result.css=e),t&&(this.result.map=t)}else c.clearAnnotation(),this.result.css=c.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=l;try{e=t(this._css,this._opts)}catch(e){this.error=e}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}}e.exports=s,s.default=s},7490:(e,t,n)=>{"use strict";let{isClean:o,my:r}=n(1381),l=n(356),i=n(346),s=n(633);function a(e,t){let n=new e.constructor;for(let o in e){if(!Object.prototype.hasOwnProperty.call(e,o))continue;if("proxyCache"===o)continue;let r=e[o],l=typeof r;"parent"===o&&"object"===l?t&&(n[o]=t):"source"===o?n[o]=r:Array.isArray(r)?n[o]=r.map((e=>a(e,n))):("object"===l&&null!==r&&(r=a(r)),n[o]=r)}return n}class c{constructor(e={}){this.raws={},this[o]=!1,this[r]=!0;for(let t in e)if("nodes"===t){this.nodes=[];for(let n of e[t])"function"==typeof n.clone?this.append(n.clone()):this.append(n)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=a(this);for(let n in e)t[n]=e[n];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:n,start:o}=this.rangeBy(t);return this.source.input.error(e,{column:o.column,line:o.line},{column:n.column,line:n.line},t)}return new l(e)}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:"root"===t?()=>e.root().toProxy():e[t],set:(e,t,n)=>(e[t]===n||(e[t]=n,"prop"!==t&&"value"!==t&&"name"!==t&&"params"!==t&&"important"!==t&&"text"!==t||e.markDirty()),!0)}}markDirty(){if(this[o]){this[o]=!1;let e=this;for(;e=e.parent;)e[o]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let n=this.source.start;if(e.index)n=this.positionInside(e.index,t);else if(e.word){let o=(t=this.toString()).indexOf(e.word);-1!==o&&(n=this.positionInside(o,t))}return n}positionInside(e,t){let n=t||this.toString(),o=this.source.start.column,r=this.source.start.line;for(let t=0;t"object"==typeof e&&e.toJSON?e.toJSON(null,t):e));else if("object"==typeof o&&o.toJSON)n[e]=o.toJSON(null,t);else if("source"===e){let l=t.get(o.input);null==l&&(l=r,t.set(o.input,r),r++),n[e]={end:o.end,inputId:l,start:o.start}}else n[e]=o}return o&&(n.inputs=[...t.keys()].map((e=>e.toJSON()))),n}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=s){e.stringify&&(e=e.stringify);let t="";return e(this,(e=>{t+=e})),t}warn(e,t,n){let o={node:this};for(let e in n)o[e]=n[e];return e.warn(t,o)}get proxyOf(){return this}}e.exports=c,c.default=c},4295:(e,t,n)=>{"use strict";let o=n(683),r=n(3937),l=n(5380);function i(e,t){let n=new l(e,t),o=new r(n);try{o.parse()}catch(e){throw e}return o.root}e.exports=i,i.default=i,o.registerParse(i)},3937:(e,t,n)=>{"use strict";let o=n(1516),r=n(2327),l=n(6589),i=n(1326),s=n(9434),a=n(4092);const c={empty:!0,space:!0};e.exports=class{constructor(e){this.input=e,this.root=new s,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t,n,o,r=new i;r.name=e[1].slice(1),""===r.name&&this.unnamedAtrule(r,e),this.init(r,e[2]);let l=!1,s=!1,a=[],c=[];for(;!this.tokenizer.endOfFile();){if(t=(e=this.tokenizer.nextToken())[0],"("===t||"["===t?c.push("("===t?")":"]"):"{"===t&&c.length>0?c.push("}"):t===c[c.length-1]&&c.pop(),0===c.length){if(";"===t){r.source.end=this.getPosition(e[2]),r.source.end.offset++,this.semicolon=!0;break}if("{"===t){s=!0;break}if("}"===t){if(a.length>0){for(o=a.length-1,n=a[o];n&&"space"===n[0];)n=a[--o];n&&(r.source.end=this.getPosition(n[3]||n[2]),r.source.end.offset++)}this.end(e);break}a.push(e)}else a.push(e);if(this.tokenizer.endOfFile()){l=!0;break}}r.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(r.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(r,"params",a),l&&(e=a[a.length-1],r.source.end=this.getPosition(e[3]||e[2]),r.source.end.offset++,this.spaces=r.raws.between,r.raws.between="")):(r.raws.afterName="",r.params=""),s&&(r.nodes=[],this.current=r)}checkMissedSemicolon(e){let t=this.colon(e);if(!1===t)return;let n,o=0;for(let r=t-1;r>=0&&(n=e[r],"space"===n[0]||(o+=1,2!==o));r--);throw this.input.error("Missed semicolon","word"===n[0]?n[3]+1:n[2])}colon(e){let t,n,o,r=0;for(let[l,i]of e.entries()){if(t=i,n=t[0],"("===n&&(r+=1),")"===n&&(r-=1),0===r&&":"===n){if(o){if("word"===o[0]&&"progid"===o[1])continue;return l}this.doubleColon(t)}o=t}return!1}comment(e){let t=new l;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let n=e[1].slice(2,-2);if(/^\s*$/.test(n))t.text="",t.raws.left=n,t.raws.right="";else{let e=n.match(/^(\s*)([^]*\S)(\s*)$/);t.text=e[2],t.raws.left=e[1],t.raws.right=e[3]}}createTokenizer(){this.tokenizer=r(this.input)}decl(e,t){let n=new o;this.init(n,e[0][2]);let r,l=e[e.length-1];for(";"===l[0]&&(this.semicolon=!0,e.pop()),n.source.end=this.getPosition(l[3]||l[2]||function(e){for(let t=e.length-1;t>=0;t--){let n=e[t],o=n[3]||n[2];if(o)return o}}(e)),n.source.end.offset++;"word"!==e[0][0];)1===e.length&&this.unknownWord(e),n.raws.before+=e.shift()[1];for(n.source.start=this.getPosition(e[0][2]),n.prop="";e.length;){let t=e[0][0];if(":"===t||"space"===t||"comment"===t)break;n.prop+=e.shift()[1]}for(n.raws.between="";e.length;){if(r=e.shift(),":"===r[0]){n.raws.between+=r[1];break}"word"===r[0]&&/\w/.test(r[1])&&this.unknownWord([r]),n.raws.between+=r[1]}"_"!==n.prop[0]&&"*"!==n.prop[0]||(n.raws.before+=n.prop[0],n.prop=n.prop.slice(1));let i,s=[];for(;e.length&&(i=e[0][0],"space"===i||"comment"===i);)s.push(e.shift());this.precheckMissedSemicolon(e);for(let t=e.length-1;t>=0;t--){if(r=e[t],"!important"===r[1].toLowerCase()){n.important=!0;let o=this.stringFrom(e,t);o=this.spacesFromEnd(e)+o," !important"!==o&&(n.raws.important=o);break}if("important"===r[1].toLowerCase()){let o=e.slice(0),r="";for(let e=t;e>0;e--){let t=o[e][0];if(0===r.trim().indexOf("!")&&"space"!==t)break;r=o.pop()[1]+r}0===r.trim().indexOf("!")&&(n.important=!0,n.raws.important=r,e=o)}if("space"!==r[0]&&"comment"!==r[0])break}e.some((e=>"space"!==e[0]&&"comment"!==e[0]))&&(n.raws.between+=s.map((e=>e[1])).join(""),s=[]),this.raw(n,"value",s.concat(e),t),n.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new a;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let e=this.current.nodes[this.current.nodes.length-1];e&&"rule"===e.type&&!e.raws.ownSemicolon&&(e.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="","comment"!==e.type&&(this.semicolon=!1)}other(e){let t=!1,n=null,o=!1,r=null,l=[],i=e[1].startsWith("--"),s=[],a=e;for(;a;){if(n=a[0],s.push(a),"("===n||"["===n)r||(r=a),l.push("("===n?")":"]");else if(i&&o&&"{"===n)r||(r=a),l.push("}");else if(0===l.length){if(";"===n){if(o)return void this.decl(s,i);break}if("{"===n)return void this.rule(s);if("}"===n){this.tokenizer.back(s.pop()),t=!0;break}":"===n&&(o=!0)}else n===l[l.length-1]&&(l.pop(),0===l.length&&(r=null));a=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),l.length>0&&this.unclosedBracket(r),t&&o){if(!i)for(;s.length&&(a=s[s.length-1][0],"space"===a||"comment"===a);)this.tokenizer.back(s.pop());this.decl(s,i)}else this.unknownWord(s)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e)}this.endFile()}precheckMissedSemicolon(){}raw(e,t,n,o){let r,l,i,s,a=n.length,u="",d=!0;for(let e=0;ee+t[1]),"");e.raws[t]={raw:o,value:u}}e[t]=u}rule(e){e.pop();let t=new a;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,n="";for(;e.length&&(t=e[e.length-1][0],"space"===t||"comment"===t);)n=e.pop()[1]+n;return n}spacesAndCommentsFromStart(e){let t,n="";for(;e.length&&(t=e[0][0],"space"===t||"comment"===t);)n+=e.shift()[1];return n}spacesFromEnd(e){let t,n="";for(;e.length&&(t=e[e.length-1][0],"space"===t);)n=e.pop()[1]+n;return n}stringFrom(e,t){let n="";for(let o=t;o{"use strict";let o=n(356),r=n(1516),l=n(448),i=n(683),s=n(9656),a=n(633),c=n(8940),u=n(271),d=n(5776),p=n(6589),m=n(1326),h=n(9055),g=n(5380),f=n(4295),b=n(7374),v=n(4092),k=n(9434),_=n(7490);function y(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new s(e)}y.plugin=function(e,t){let n,o=!1;function r(...n){console&&console.warn&&!o&&(o=!0,console.warn(e+": postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration"),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+": 里面 postcss.plugin 被弃用. 迁移指南:\nhttps://www.w3ctech.com/topic/2226"));let r=t(...n);return r.postcssPlugin=e,r.postcssVersion=(new s).version,r}return Object.defineProperty(r,"postcss",{get:()=>(n||(n=r()),n)}),r.process=function(e,t,n){return y([r(n)]).process(e,t)},r},y.stringify=a,y.parse=f,y.fromJSON=c,y.list=b,y.comment=e=>new p(e),y.atRule=e=>new m(e),y.decl=e=>new r(e),y.rule=e=>new v(e),y.root=e=>new k(e),y.document=e=>new u(e),y.CssSyntaxError=o,y.Declaration=r,y.Container=i,y.Processor=s,y.Document=u,y.Comment=p,y.Warning=d,y.AtRule=m,y.Result=h,y.Input=g,y.Rule=v,y.Root=k,y.Node=_,l.registerPostcss(y),e.exports=y,y.default=y},5696:(e,t,n)=>{"use strict";let{SourceMapConsumer:o,SourceMapGenerator:r}=n(1866),{existsSync:l,readFileSync:i}=n(9977),{dirname:s,join:a}=n(197);class c{constructor(e,t){if(!1===t.map)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let n=t.map?t.map.prev:void 0,o=this.loadMap(t.from,n);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=s(this.mapFile)),o&&(this.text=o)}consumer(){return this.consumerCache||(this.consumerCache=new o(this.text)),this.consumerCache}decodeInline(e){if(/^data:application\/json;charset=utf-?8,/.test(e)||/^data:application\/json,/.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(/^data:application\/json;charset=utf-?8;base64,/.test(e)||/^data:application\/json;base64,/.test(e))return t=e.substr(RegExp.lastMatch.length),Buffer?Buffer.from(t,"base64").toString():window.atob(t);var t;let n=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+n)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return"object"==typeof e&&("string"==typeof e.mappings||"string"==typeof e._mappings||Array.isArray(e.sections))}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let n=e.lastIndexOf(t.pop()),o=e.indexOf("*/",n);n>-1&&o>-1&&(this.annotation=this.getAnnotationURL(e.substring(n,o)))}loadFile(e){if(this.root=s(e),l(e))return this.mapFile=e,i(e,"utf-8").toString().trim()}loadMap(e,t){if(!1===t)return!1;if(t){if("string"==typeof t)return t;if("function"!=typeof t){if(t instanceof o)return r.fromSourceMap(t).toString();if(t instanceof r)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}{let n=t(e);if(n){let e=this.loadFile(n);if(!e)throw new Error("Unable to load previous source map: "+n.toString());return e}}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let t=this.annotation;return e&&(t=a(s(e),t)),this.loadFile(t)}}}startWith(e,t){return!!e&&e.substr(0,t.length)===t}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}}e.exports=c,c.default=c},9656:(e,t,n)=>{"use strict";let o=n(7661),r=n(448),l=n(271),i=n(9434);class s{constructor(e=[]){this.version="8.4.35",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let n of e)if(!0===n.postcss?n=n():n.postcss&&(n=n.postcss),"object"==typeof n&&Array.isArray(n.plugins))t=t.concat(n.plugins);else if("object"==typeof n&&n.postcssPlugin)t.push(n);else if("function"==typeof n)t.push(n);else{if("object"!=typeof n||!n.parse&&!n.stringify)throw new Error(n+" is not a PostCSS plugin")}return t}process(e,t={}){return this.plugins.length||t.parser||t.stringifier||t.syntax?new r(this,e,t):new o(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}}e.exports=s,s.default=s,i.registerProcessor(s),l.registerProcessor(s)},9055:(e,t,n)=>{"use strict";let o=n(5776);class r{constructor(e,t,n){this.processor=e,this.messages=[],this.root=t,this.opts=n,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let n=new o(e,t);return this.messages.push(n),n}warnings(){return this.messages.filter((e=>"warning"===e.type))}get content(){return this.css}}e.exports=r,r.default=r},9434:(e,t,n)=>{"use strict";let o,r,l=n(683);class i extends l{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,n){let o=super.normalize(e);if(t)if("prepend"===n)this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let e of o)e.raws.before=t.raws.before;return o}removeChild(e,t){let n=this.index(e);return!t&&0===n&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[n].raws.before),super.removeChild(e)}toResult(e={}){return new o(new r,this,e).stringify()}}i.registerLazyResult=e=>{o=e},i.registerProcessor=e=>{r=e},e.exports=i,i.default=i,l.registerRoot(i)},4092:(e,t,n)=>{"use strict";let o=n(683),r=n(7374);class l extends o{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return r.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,n=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(n)}}e.exports=l,l.default=l,o.registerRule(l)},346:e=>{"use strict";const t={after:"\n",beforeClose:"\n",beforeComment:"\n",beforeDecl:"\n",beforeOpen:" ",beforeRule:"\n",colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};class n{constructor(e){this.builder=e}atrule(e,t){let n="@"+e.name,o=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?n+=e.raws.afterName:o&&(n+=" "),e.nodes)this.block(e,n+o);else{let r=(e.raws.between||"")+(t?";":"");this.builder(n+o+r,e)}}beforeAfter(e,t){let n;n="decl"===e.type?this.raw(e,null,"beforeDecl"):"comment"===e.type?this.raw(e,null,"beforeComment"):"before"===t?this.raw(e,null,"beforeRule"):this.raw(e,null,"beforeClose");let o=e.parent,r=0;for(;o&&"root"!==o.type;)r+=1,o=o.parent;if(n.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e0&&"comment"===e.nodes[t].type;)t-=1;let n=this.raw(e,"semicolon");for(let o=0;o{if(r=e.raws[n],void 0!==r)return!1}))}var s;return void 0===r&&(r=t[o]),i.rawCache[o]=r,r}rawBeforeClose(e){let t;return e.walk((e=>{if(e.nodes&&e.nodes.length>0&&void 0!==e.raws.after)return t=e.raws.after,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1})),t&&(t=t.replace(/\S/g,"")),t}rawBeforeComment(e,t){let n;return e.walkComments((e=>{if(void 0!==e.raws.before)return n=e.raws.before,n.includes("\n")&&(n=n.replace(/[^\n]+$/,"")),!1})),void 0===n?n=this.raw(t,null,"beforeDecl"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeDecl(e,t){let n;return e.walkDecls((e=>{if(void 0!==e.raws.before)return n=e.raws.before,n.includes("\n")&&(n=n.replace(/[^\n]+$/,"")),!1})),void 0===n?n=this.raw(t,null,"beforeRule"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeOpen(e){let t;return e.walk((e=>{if("decl"!==e.type&&(t=e.raws.between,void 0!==t))return!1})),t}rawBeforeRule(e){let t;return e.walk((n=>{if(n.nodes&&(n.parent!==e||e.first!==n)&&void 0!==n.raws.before)return t=n.raws.before,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1})),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls((e=>{if(void 0!==e.raws.between)return t=e.raws.between.replace(/[^\s:]/g,""),!1})),t}rawEmptyBody(e){let t;return e.walk((e=>{if(e.nodes&&0===e.nodes.length&&(t=e.raws.after,void 0!==t))return!1})),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk((n=>{let o=n.parent;if(o&&o!==e&&o.parent&&o.parent===e&&void 0!==n.raws.before){let e=n.raws.before.split("\n");return t=e[e.length-1],t=t.replace(/\S/g,""),!1}})),t}rawSemicolon(e){let t;return e.walk((e=>{if(e.nodes&&e.nodes.length&&"decl"===e.last.type&&(t=e.raws.semicolon,void 0!==t))return!1})),t}rawValue(e,t){let n=e[t],o=e.raws[t];return o&&o.value===n?o.raw:n}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}}e.exports=n,n.default=n},633:(e,t,n)=>{"use strict";let o=n(346);function r(e,t){new o(t).stringify(e)}e.exports=r,r.default=r},1381:e=>{"use strict";e.exports.isClean=Symbol("isClean"),e.exports.my=Symbol("my")},2327:e=>{"use strict";const t="'".charCodeAt(0),n='"'.charCodeAt(0),o="\\".charCodeAt(0),r="/".charCodeAt(0),l="\n".charCodeAt(0),i=" ".charCodeAt(0),s="\f".charCodeAt(0),a="\t".charCodeAt(0),c="\r".charCodeAt(0),u="[".charCodeAt(0),d="]".charCodeAt(0),p="(".charCodeAt(0),m=")".charCodeAt(0),h="{".charCodeAt(0),g="}".charCodeAt(0),f=";".charCodeAt(0),b="*".charCodeAt(0),v=":".charCodeAt(0),k="@".charCodeAt(0),_=/[\t\n\f\r "#'()/;[\\\]{}]/g,y=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,E=/.[\r\n"'(/\\]/,w=/[\da-f]/i;e.exports=function(e,S={}){let C,x,B,I,T,M,P,R,N,L,A=e.css.valueOf(),O=S.ignoreErrors,D=A.length,z=0,V=[],F=[];function H(t){throw e.error("Unclosed "+t,z)}return{back:function(e){F.push(e)},endOfFile:function(){return 0===F.length&&z>=D},nextToken:function(e){if(F.length)return F.pop();if(z>=D)return;let S=!!e&&e.ignoreUnclosed;switch(C=A.charCodeAt(z),C){case l:case i:case a:case c:case s:x=z;do{x+=1,C=A.charCodeAt(x)}while(C===i||C===l||C===a||C===c||C===s);L=["space",A.slice(z,x)],z=x-1;break;case u:case d:case h:case g:case v:case f:case m:{let e=String.fromCharCode(C);L=[e,e,z];break}case p:if(R=V.length?V.pop()[1]:"",N=A.charCodeAt(z+1),"url"===R&&N!==t&&N!==n&&N!==i&&N!==l&&N!==a&&N!==s&&N!==c){x=z;do{if(M=!1,x=A.indexOf(")",x+1),-1===x){if(O||S){x=z;break}H("bracket")}for(P=x;A.charCodeAt(P-1)===o;)P-=1,M=!M}while(M);L=["brackets",A.slice(z,x+1),z,x],z=x}else x=A.indexOf(")",z+1),I=A.slice(z,x+1),-1===x||E.test(I)?L=["(","(",z]:(L=["brackets",I,z,x],z=x);break;case t:case n:B=C===t?"'":'"',x=z;do{if(M=!1,x=A.indexOf(B,x+1),-1===x){if(O||S){x=z+1;break}H("string")}for(P=x;A.charCodeAt(P-1)===o;)P-=1,M=!M}while(M);L=["string",A.slice(z,x+1),z,x],z=x;break;case k:_.lastIndex=z+1,_.test(A),x=0===_.lastIndex?A.length-1:_.lastIndex-2,L=["at-word",A.slice(z,x+1),z,x],z=x;break;case o:for(x=z,T=!0;A.charCodeAt(x+1)===o;)x+=1,T=!T;if(C=A.charCodeAt(x+1),T&&C!==r&&C!==i&&C!==l&&C!==a&&C!==c&&C!==s&&(x+=1,w.test(A.charAt(x)))){for(;w.test(A.charAt(x+1));)x+=1;A.charCodeAt(x+1)===i&&(x+=1)}L=["word",A.slice(z,x+1),z,x],z=x;break;default:C===r&&A.charCodeAt(z+1)===b?(x=A.indexOf("*/",z+2)+1,0===x&&(O||S?x=A.length:H("comment")),L=["comment",A.slice(z,x+1),z,x],z=x):(y.lastIndex=z+1,y.test(A),x=0===y.lastIndex?A.length-1:y.lastIndex-2,L=["word",A.slice(z,x+1),z,x],V.push(L),z=x)}return z++,L},position:function(){return z}}}},3122:e=>{"use strict";let t={};e.exports=function(e){t[e]||(t[e]=!0,"undefined"!=typeof console&&console.warn&&console.warn(e))}},5776:e=>{"use strict";class t{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let e=t.node.rangeBy(t);this.line=e.start.line,this.column=e.start.column,this.endLine=e.end.line,this.endColumn=e.end.column}for(let e in t)this[e]=t[e]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}}e.exports=t,t.default=t},628:(e,t,n)=>{"use strict";var o=n(4067);function r(){}function l(){}l.resetWarningCache=r,e.exports=function(){function e(e,t,n,r,l,i){if(i!==o){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:l,resetWarningCache:r};return n.PropTypes=n,n}},5826:(e,t,n)=>{e.exports=n(628)()},4067:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},4462:function(e,t,n){"use strict";var o,r=this&&this.__extends||(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),l=this&&this.__assign||Object.assign||function(e){for(var t,n=1,o=arguments.length;n{"use strict";var o=n(4462);t.A=o.TextareaAutosize},9681:e=>{var t={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Ấ:"A",Ắ:"A",Ẳ:"A",Ẵ:"A",Ặ:"A",Æ:"AE",Ầ:"A",Ằ:"A",Ȃ:"A",Ả:"A",Ạ:"A",Ẩ:"A",Ẫ:"A",Ậ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ế:"E",Ḗ:"E",Ề:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ẻ:"E",Ẽ:"E",Ẹ:"E",Ể:"E",Ễ:"E",Ệ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḯ:"I",Ȋ:"I",Ỉ:"I",Ị:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",Ố:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ỏ:"O",Ọ:"O",Ổ:"O",Ỗ:"O",Ộ:"O",Ờ:"O",Ở:"O",Ỡ:"O",Ớ:"O",Ợ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ủ:"U",Ụ:"U",Ử:"U",Ữ:"U",Ự:"U",Ý:"Y",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",ấ:"a",ắ:"a",ẳ:"a",ẵ:"a",ặ:"a",æ:"ae",ầ:"a",ằ:"a",ȃ:"a",ả:"a",ạ:"a",ẩ:"a",ẫ:"a",ậ:"a",ç:"c",ḉ:"c",è:"e",é:"e",ê:"e",ë:"e",ế:"e",ḗ:"e",ề:"e",ḕ:"e",ḝ:"e",ȇ:"e",ẻ:"e",ẽ:"e",ẹ:"e",ể:"e",ễ:"e",ệ:"e",ì:"i",í:"i",î:"i",ï:"i",ḯ:"i",ȋ:"i",ỉ:"i",ị:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",ố:"o",ṍ:"o",ṓ:"o",ȏ:"o",ỏ:"o",ọ:"o",ổ:"o",ỗ:"o",ộ:"o",ờ:"o",ở:"o",ỡ:"o",ớ:"o",ợ:"o",ù:"u",ú:"u",û:"u",ü:"u",ủ:"u",ụ:"u",ử:"u",ữ:"u",ự:"u",ý:"y",ÿ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",C̆:"C",c̆:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Ǵ:"G",ĝ:"g",ǵ:"g",Ğ:"G",ğ:"g",Ġ:"G",ġ:"g",Ģ:"G",ģ:"g",Ĥ:"H",ĥ:"h",Ħ:"H",ħ:"h",Ḫ:"H",ḫ:"h",Ĩ:"I",ĩ:"i",Ī:"I",ī:"i",Ĭ:"I",ĭ:"i",Į:"I",į:"i",İ:"I",ı:"i",IJ:"IJ",ij:"ij",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",Ḱ:"K",ḱ:"k",K̆:"K",k̆:"k",Ĺ:"L",ĺ:"l",Ļ:"L",ļ:"l",Ľ:"L",ľ:"l",Ŀ:"L",ŀ:"l",Ł:"l",ł:"l",Ḿ:"M",ḿ:"m",M̆:"M",m̆:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",N̆:"N",n̆:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",P̆:"P",p̆:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",R̆:"R",r̆:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Š:"S",š:"s",Ţ:"T",ţ:"t",ț:"t",Ț:"T",Ť:"T",ť:"t",Ŧ:"T",ŧ:"t",T̆:"T",t̆:"t",Ũ:"U",ũ:"u",Ū:"U",ū:"u",Ŭ:"U",ŭ:"u",Ů:"U",ů:"u",Ű:"U",ű:"u",Ų:"U",ų:"u",Ȗ:"U",ȗ:"u",V̆:"V",v̆:"v",Ŵ:"W",ŵ:"w",Ẃ:"W",ẃ:"w",X̆:"X",x̆:"x",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Y̆:"Y",y̆:"y",Ź:"Z",ź:"z",Ż:"Z",ż:"z",Ž:"Z",ž:"z",ſ:"s",ƒ:"f",Ơ:"O",ơ:"o",Ư:"U",ư:"u",Ǎ:"A",ǎ:"a",Ǐ:"I",ǐ:"i",Ǒ:"O",ǒ:"o",Ǔ:"U",ǔ:"u",Ǖ:"U",ǖ:"u",Ǘ:"U",ǘ:"u",Ǚ:"U",ǚ:"u",Ǜ:"U",ǜ:"u",Ứ:"U",ứ:"u",Ṹ:"U",ṹ:"u",Ǻ:"A",ǻ:"a",Ǽ:"AE",ǽ:"ae",Ǿ:"O",ǿ:"o",Þ:"TH",þ:"th",Ṕ:"P",ṕ:"p",Ṥ:"S",ṥ:"s",X́:"X",x́:"x",Ѓ:"Г",ѓ:"г",Ќ:"К",ќ:"к",A̋:"A",a̋:"a",E̋:"E",e̋:"e",I̋:"I",i̋:"i",Ǹ:"N",ǹ:"n",Ồ:"O",ồ:"o",Ṑ:"O",ṑ:"o",Ừ:"U",ừ:"u",Ẁ:"W",ẁ:"w",Ỳ:"Y",ỳ:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",B̌:"B",b̌:"b",Č̣:"C",č̣:"c",Ê̌:"E",ê̌:"e",F̌:"F",f̌:"f",Ǧ:"G",ǧ:"g",Ȟ:"H",ȟ:"h",J̌:"J",ǰ:"j",Ǩ:"K",ǩ:"k",M̌:"M",m̌:"m",P̌:"P",p̌:"p",Q̌:"Q",q̌:"q",Ř̩:"R",ř̩:"r",Ṧ:"S",ṧ:"s",V̌:"V",v̌:"v",W̌:"W",w̌:"w",X̌:"X",x̌:"x",Y̌:"Y",y̌:"y",A̧:"A",a̧:"a",B̧:"B",b̧:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ȩ:"e",Ɛ̧:"E",ɛ̧:"e",Ḩ:"H",ḩ:"h",I̧:"I",i̧:"i",Ɨ̧:"I",ɨ̧:"i",M̧:"M",m̧:"m",O̧:"O",o̧:"o",Q̧:"Q",q̧:"q",U̧:"U",u̧:"u",X̧:"X",x̧:"x",Z̧:"Z",z̧:"z",й:"и",Й:"И",ё:"е",Ё:"Е"},n=Object.keys(t).join("|"),o=new RegExp(n,"g"),r=new RegExp(n,"");function l(e){return t[e]}var i=function(e){return e.replace(o,l)};e.exports=i,e.exports.has=function(e){return!!e.match(r)},e.exports.remove=i},1609:e=>{"use strict";e.exports=window.React},9746:()=>{},9977:()=>{},197:()=>{},1866:()=>{},2739:()=>{},5042:e=>{e.exports={nanoid:(e=21)=>{let t="",n=e;for(;n--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},customAlphabet:(e,t=21)=>(n=t)=>{let o="",r=n;for(;r--;)o+=e[Math.random()*e.length|0];return o}}}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var l=t[o]={exports:{}};return e[o].call(l.exports,l,l.exports,n),l.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};(()=>{"use strict";n.r(o),n.d(o,{AlignmentControl:()=>Tg,AlignmentToolbar:()=>Mg,Autocomplete:()=>lf,BlockAlignmentControl:()=>es,BlockAlignmentToolbar:()=>ts,BlockBreadcrumb:()=>mf,BlockCanvas:()=>WC,BlockColorsStyleSelector:()=>YC,BlockContextProvider:()=>ff,BlockControls:()=>Bl,BlockEdit:()=>yf,BlockEditorKeyboardShortcuts:()=>D_,BlockEditorProvider:()=>V_,BlockFormatControls:()=>xl,BlockIcon:()=>qh,BlockInspector:()=>XT,BlockList:()=>Xw,BlockMover:()=>bS,BlockNavigationDropdown:()=>Rx,BlockPreview:()=>Ty,BlockSelectionClearer:()=>H_,BlockSettingsMenu:()=>yC,BlockSettingsMenuControls:()=>jh,BlockStyles:()=>Ax,BlockTitle:()=>pf,BlockToolbar:()=>zC,BlockTools:()=>$C,BlockVerticalAlignmentControl:()=>pi,BlockVerticalAlignmentToolbar:()=>mi,ButtonBlockAppender:()=>uw,ButtonBlockerAppender:()=>cw,ColorPalette:()=>aB,ColorPaletteControl:()=>cB,ContrastChecker:()=>pd,CopyHandler:()=>JT,DefaultBlockAppender:()=>sw,FontSizePicker:()=>kg,HeadingLevelDropdown:()=>Fx,HeightControl:()=>Kp,InnerBlocks:()=>Gw,Inserter:()=>lw,InspectorAdvancedControls:()=>xs,InspectorControls:()=>Bs,JustifyContentControl:()=>fi,JustifyToolbar:()=>bi,LineHeightControl:()=>Vd,MediaPlaceholder:()=>cI,MediaReplaceFlow:()=>ec,MediaUpload:()=>Gs,MediaUploadCheck:()=>Us,MultiSelectScrollIntoView:()=>nM,NavigableToolbar:()=>NC,ObserveTyping:()=>Ww,PanelColorSettings:()=>uI,PlainText:()=>YI,RecursionProvider:()=>cM,ReusableBlocksRenameHint:()=>CM,RichText:()=>KI,RichTextShortcut:()=>JI,RichTextToolbarButton:()=>eT,SETTINGS_DEFAULTS:()=>I,SkipToSelectedBlock:()=>bT,ToolSelector:()=>oT,Typewriter:()=>sM,URLInput:()=>ta,URLInputButton:()=>sT,URLPopover:()=>lI,Warning:()=>wf,WritingFlow:()=>sy,__experimentalBlockAlignmentMatrixControl:()=>uf,__experimentalBlockFullHeightAligmentControl:()=>af,__experimentalBlockPatternSetup:()=>nB,__experimentalBlockPatternsList:()=>rE,__experimentalBlockVariationPicker:()=>Gx,__experimentalBlockVariationTransforms:()=>iB,__experimentalBorderRadiusControl:()=>cu,__experimentalColorGradientControl:()=>Xu,__experimentalColorGradientSettingsDropdown:()=>bB,__experimentalDateFormatPicker:()=>pB,__experimentalDuotoneControl:()=>Fm,__experimentalFontAppearanceControl:()=>Dd,__experimentalFontFamilyControl:()=>Nd,__experimentalGetBorderClassesAndStyles:()=>rg,__experimentalGetColorClassesAndStyles:()=>sg,__experimentalGetElementClassName:()=>BM,__experimentalGetGapCSSValue:()=>oi,__experimentalGetGradientClass:()=>Gu,__experimentalGetGradientObjectByGradientValue:()=>$u,__experimentalGetShadowClassesAndStyles:()=>ig,__experimentalGetSpacingClassesAndStyles:()=>cg,__experimentalImageEditor:()=>QB,__experimentalImageSizeControl:()=>tI,__experimentalImageURLInputUI:()=>hT,__experimentalInspectorPopoverHeader:()=>hM,__experimentalLetterSpacingControl:()=>Fd,__experimentalLibrary:()=>tM,__experimentalLinkControl:()=>Xa,__experimentalLinkControlSearchInput:()=>Ra,__experimentalLinkControlSearchItem:()=>ba,__experimentalLinkControlSearchResults:()=>Sa,__experimentalListView:()=>Mx,__experimentalPanelColorGradientSettings:()=>yB,__experimentalPreviewOptions:()=>gT,__experimentalPublishDateTimePicker:()=>gM,__experimentalRecursionProvider:()=>dM,__experimentalResponsiveBlockControl:()=>QI,__experimentalSpacingSizesControl:()=>jp,__experimentalTextDecorationControl:()=>Yd,__experimentalTextTransformControl:()=>Wd,__experimentalUnitControl:()=>rT,__experimentalUseBlockOverlayActive:()=>hf,__experimentalUseBlockPreview:()=>My,__experimentalUseBorderProps:()=>lg,__experimentalUseColorProps:()=>ag,__experimentalUseCustomSides:()=>Bm,__experimentalUseGradient:()=>Wu,__experimentalUseHasRecursion:()=>pM,__experimentalUseMultipleOriginColorsAndGradients:()=>qc,__experimentalUseResizeCanvas:()=>fT,__experimentalWritingModeControl:()=>ep,__unstableBlockNameContext:()=>TC,__unstableBlockSettingsMenuFirstItem:()=>gC,__unstableBlockToolbarLastItem:()=>QS,__unstableEditorStyles:()=>wy,__unstableIframe:()=>py,__unstableInserterMenuExtension:()=>WE,__unstableRichTextInputEvent:()=>tT,__unstableUseBlockSelectionClearer:()=>F_,__unstableUseClipboardHandler:()=>QT,__unstableUseMouseMoveTypingReset:()=>$w,__unstableUseTypewriter:()=>iM,__unstableUseTypingObserver:()=>jw,createCustomColorsHOC:()=>bg,getColorClassName:()=>Zc,getColorObjectByAttributeValues:()=>Wc,getColorObjectByColorValue:()=>Kc,getComputedFluidTypographyValue:()=>Ur,getCustomValueFromPreset:()=>Ql,getFontSize:()=>Ep,getFontSizeClass:()=>Sp,getFontSizeObjectByValue:()=>wp,getGradientSlugByValue:()=>ju,getGradientValueBySlug:()=>Uu,getPxFromCssUnit:()=>IM,getSpacingPresetCssVar:()=>ei,getTypographyClassesAndStyles:()=>ug,isValueSpacingPreset:()=>Xl,privateApis:()=>HR,store:()=>Nr,storeConfig:()=>Rr,transformStyles:()=>yy,useBlockCommands:()=>wM,useBlockDisplayInformation:()=>ih,useBlockEditContext:()=>y,useBlockEditingMode:()=>ns,useBlockProps:()=>y_,useCachedTruthy:()=>dg,useHasRecursion:()=>uM,useInnerBlocksProps:()=>Hw,useSetting:()=>Or,useSettings:()=>Ar,withColorContext:()=>sB,withColors:()=>vg,withFontSizes:()=>Eg});var e={};n.r(e),n.d(e,{__experimentalGetActiveBlockIdByBlockNames:()=>dn,__experimentalGetAllowedBlocks:()=>Ht,__experimentalGetAllowedPatterns:()=>Wt,__experimentalGetBlockListSettingsForBlocks:()=>Jt,__experimentalGetDirectInsertBlock:()=>Ut,__experimentalGetGlobalBlocksByName:()=>ye,__experimentalGetLastBlockAttributeChanges:()=>nn,__experimentalGetParsedPattern:()=>$t,__experimentalGetPatternTransformItems:()=>qt,__experimentalGetPatternsByBlockTypes:()=>Zt,__experimentalGetReusableBlockTitle:()=>en,__unstableGetBlockWithoutInnerBlocks:()=>me,__unstableGetClientIdWithClientIdsTree:()=>ge,__unstableGetClientIdsTree:()=>fe,__unstableGetContentLockingParent:()=>gn,__unstableGetEditorMode:()=>ln,__unstableGetSelectedBlocksWithPartialSelection:()=>nt,__unstableGetTemporarilyEditingAsBlocks:()=>fn,__unstableGetTemporarilyEditingFocusModeToRevert:()=>bn,__unstableGetVisibleBlocks:()=>hn,__unstableHasActiveBlockOverlayActive:()=>vn,__unstableIsFullySelected:()=>Qe,__unstableIsLastBlockChangeIgnored:()=>tn,__unstableIsSelectionCollapsed:()=>Je,__unstableIsSelectionMergeable:()=>tt,__unstableIsWithinBlockOverlay:()=>kn,__unstableSelectionHasUnmergeableBlock:()=>et,areInnerBlocksControlled:()=>un,canEditBlock:()=>Pt,canInsertBlockType:()=>Ct,canInsertBlocks:()=>xt,canLockBlockType:()=>Rt,canMoveBlock:()=>Tt,canMoveBlocks:()=>Mt,canRemoveBlock:()=>Bt,canRemoveBlocks:()=>It,didAutomaticChange:()=>an,getAdjacentBlockClientId:()=>ze,getAllowedBlocks:()=>Ft,getBlock:()=>pe,getBlockAttributes:()=>de,getBlockCount:()=>Se,getBlockEditingMode:()=>_n,getBlockHierarchyRootClientId:()=>Oe,getBlockIndex:()=>rt,getBlockInsertionPoint:()=>kt,getBlockListSettings:()=>Yt,getBlockMode:()=>pt,getBlockName:()=>ce,getBlockNamesByClientId:()=>we,getBlockOrder:()=>ot,getBlockParents:()=>Le,getBlockParentsByBlockName:()=>Ae,getBlockRootClientId:()=>Ne,getBlockSelectionEnd:()=>Ie,getBlockSelectionStart:()=>Be,getBlockTransformItems:()=>zt,getBlocks:()=>he,getBlocksByClientId:()=>Ee,getBlocksByName:()=>_e,getClientIdsOfDescendants:()=>be,getClientIdsWithDescendants:()=>ve,getDirectInsertBlock:()=>Gt,getDraggedBlockClientIds:()=>gt,getFirstMultiSelectedBlockClientId:()=>je,getGlobalBlockCount:()=>ke,getInserterItems:()=>Dt,getLastMultiSelectedBlockClientId:()=>We,getLowestCommonAncestorWithSelectedBlock:()=>De,getMultiSelectedBlockClientIds:()=>Ue,getMultiSelectedBlocks:()=>$e,getMultiSelectedBlocksEndClientId:()=>Xe,getMultiSelectedBlocksStartClientId:()=>Ye,getNextBlockClientId:()=>Fe,getPatternsByBlockTypes:()=>Kt,getPreviousBlockClientId:()=>Ve,getSelectedBlock:()=>Re,getSelectedBlockClientId:()=>Pe,getSelectedBlockClientIds:()=>Ge,getSelectedBlockCount:()=>Te,getSelectedBlocksInitialCaretPosition:()=>He,getSelectionEnd:()=>xe,getSelectionStart:()=>Ce,getSettings:()=>Xt,getTemplate:()=>Et,getTemplateLock:()=>wt,hasBlockMovingClientId:()=>sn,hasDraggedInnerBlock:()=>st,hasInserterItems:()=>Vt,hasMultiSelection:()=>ct,hasSelectedBlock:()=>Me,hasSelectedInnerBlock:()=>it,isAncestorBeingDragged:()=>bt,isAncestorMultiSelected:()=>qe,isBlockBeingDragged:()=>ft,isBlockHighlighted:()=>cn,isBlockInsertionPointVisible:()=>_t,isBlockMultiSelected:()=>Ze,isBlockSelected:()=>lt,isBlockValid:()=>ue,isBlockVisible:()=>mn,isBlockWithinSelection:()=>at,isCaretWithinFormattedText:()=>vt,isDraggingBlocks:()=>ht,isFirstMultiSelectedBlock:()=>Ke,isGroupable:()=>En,isLastBlockChangePersistent:()=>Qt,isMultiSelecting:()=>ut,isNavigationMode:()=>rn,isSelectionEnabled:()=>dt,isTyping:()=>mt,isUngroupable:()=>yn,isValidTemplate:()=>yt,wasBlockJustInserted:()=>pn});var t={};n.r(t),n.d(t,{__experimentalUpdateSettings:()=>Cn,clearBlockRemovalPrompt:()=>Mn,deleteStyleOverride:()=>Ln,ensureDefaultBlock:()=>Tn,hideBlockInterface:()=>xn,privateRemoveBlocks:()=>In,setBlockRemovalRules:()=>Pn,setLastFocus:()=>On,setOpenedBlockSettingsMenu:()=>Rn,setStyleOverride:()=>Nn,showBlockInterface:()=>Bn,startDragging:()=>zn,stopDragging:()=>Vn,stopEditingAsBlocks:()=>Dn,syncDerivedUpdates:()=>An});var r={};n.r(r),n.d(r,{getAllPatterns:()=>go,getBlockRemovalRules:()=>ao,getBlockSettings:()=>eo,getBlockWithoutAttributes:()=>oo,getEnabledBlockParents:()=>io,getEnabledClientIdsTree:()=>lo,getInserterMediaCategories:()=>mo,getLastFocus:()=>fo,getLastInsertedBlocksClientIds:()=>no,getOpenedBlockSettingsMenu:()=>co,getRegisteredInserterMediaCategories:()=>po,getRemovalPromptData:()=>so,getStyleOverrides:()=>uo,hasAllowedPatterns:()=>ho,isBlockInterfaceHidden:()=>to,isBlockSubtreeDisabled:()=>ro,isDragging:()=>bo});var l={};n.r(l),n.d(l,{__unstableDeleteSelection:()=>Yo,__unstableExpandSelection:()=>Qo,__unstableMarkAutomaticChange:()=>br,__unstableMarkLastChangeAsPersistent:()=>gr,__unstableMarkNextChangeAsNotPersistent:()=>fr,__unstableSaveReusableBlock:()=>hr,__unstableSetEditorMode:()=>kr,__unstableSetTemporarilyEditingAsBlocks:()=>Ir,__unstableSplitSelection:()=>Xo,clearSelectedBlock:()=>Lo,duplicateBlocks:()=>yr,enterFormattedText:()=>ar,exitFormattedText:()=>cr,flashBlock:()=>Cr,hideInsertionPoint:()=>Ko,insertAfterBlock:()=>wr,insertBeforeBlock:()=>Er,insertBlock:()=>$o,insertBlocks:()=>jo,insertDefaultBlock:()=>dr,mergeBlocks:()=>Jo,moveBlockToPosition:()=>Uo,moveBlocksDown:()=>Fo,moveBlocksToPosition:()=>Go,moveBlocksUp:()=>Ho,multiSelect:()=>No,receiveBlocks:()=>Co,registerInserterMediaCategory:()=>Tr,removeBlock:()=>tr,removeBlocks:()=>er,replaceBlock:()=>zo,replaceBlocks:()=>Do,replaceInnerBlocks:()=>nr,resetBlocks:()=>Eo,resetSelection:()=>So,selectBlock:()=>Io,selectNextBlock:()=>Mo,selectPreviousBlock:()=>To,selectionChange:()=>ur,setBlockEditingMode:()=>Mr,setBlockMovingClientId:()=>_r,setBlockVisibility:()=>Br,setHasControlledInnerBlocks:()=>xr,setNavigationMode:()=>vr,setTemplateValidity:()=>Zo,showInsertionPoint:()=>Wo,startDraggingBlocks:()=>ir,startMultiSelect:()=>Po,startTyping:()=>rr,stopDraggingBlocks:()=>sr,stopMultiSelect:()=>Ro,stopTyping:()=>lr,synchronizeTemplate:()=>qo,toggleBlockHighlight:()=>Sr,toggleBlockMode:()=>or,toggleSelection:()=>Ao,unsetBlockEditingMode:()=>Pr,updateBlock:()=>Bo,updateBlockAttributes:()=>xo,updateBlockListSettings:()=>pr,updateSettings:()=>mr,validateBlocksToTemplate:()=>wo});var i={};n.r(i),n.d(i,{AdvancedPanel:()=>KM,BorderPanel:()=>Bu,ColorPanel:()=>dd,DimensionsPanel:()=>mm,FiltersPanel:()=>Jm,GlobalStylesContext:()=>ol,ImageSettingsPanel:()=>WM,TypographyPanel:()=>gp,areGlobalStyleConfigsEqual:()=>nl,getBlockCSSSelector:()=>$m,getGlobalStylesChanges:()=>tP,getLayoutStyles:()=>LM,useGlobalSetting:()=>sl,useGlobalStyle:()=>al,useGlobalStylesOutput:()=>$M,useGlobalStylesOutputWithConfig:()=>UM,useGlobalStylesReset:()=>il,useHasBorderPanel:()=>vu,useHasBorderPanelControls:()=>ku,useHasColorPanel:()=>Qu,useHasDimensionsPanel:()=>em,useHasFiltersPanel:()=>Km,useHasImageSettingsPanel:()=>jM,useHasTypographyPanel:()=>op,useSettingsForBlockElement:()=>cl});var s=n(1609),a=n.n(s);const c=window.wp.blocks,u=window.wp.element,d=window.wp.data,p=window.wp.compose,m=window.wp.hooks,h=Symbol("mayDisplayControls"),g=Symbol("mayDisplayParentControls"),f=Symbol("blockEditingMode"),b=Symbol("blockBindings"),v={name:"",isSelected:!1},k=(0,u.createContext)(v),{Provider:_}=k;function y(){return(0,u.useContext)(k)}const E=window.wp.deprecated;var w=n.n(E),S=n(7734),C=n.n(S);const x=window.wp.i18n,B={insertUsage:{}},I={alignWide:!1,supportsLayout:!0,colors:[{name:(0,x.__)("Black"),slug:"black",color:"#000000"},{name:(0,x.__)("Cyan bluish gray"),slug:"cyan-bluish-gray",color:"#abb8c3"},{name:(0,x.__)("White"),slug:"white",color:"#ffffff"},{name:(0,x.__)("Pale pink"),slug:"pale-pink",color:"#f78da7"},{name:(0,x.__)("Vivid red"),slug:"vivid-red",color:"#cf2e2e"},{name:(0,x.__)("Luminous vivid orange"),slug:"luminous-vivid-orange",color:"#ff6900"},{name:(0,x.__)("Luminous vivid amber"),slug:"luminous-vivid-amber",color:"#fcb900"},{name:(0,x.__)("Light green cyan"),slug:"light-green-cyan",color:"#7bdcb5"},{name:(0,x.__)("Vivid green cyan"),slug:"vivid-green-cyan",color:"#00d084"},{name:(0,x.__)("Pale cyan blue"),slug:"pale-cyan-blue",color:"#8ed1fc"},{name:(0,x.__)("Vivid cyan blue"),slug:"vivid-cyan-blue",color:"#0693e3"},{name:(0,x.__)("Vivid purple"),slug:"vivid-purple",color:"#9b51e0"}],fontSizes:[{name:(0,x._x)("Small","font size name"),size:13,slug:"small"},{name:(0,x._x)("Normal","font size name"),size:16,slug:"normal"},{name:(0,x._x)("Medium","font size name"),size:20,slug:"medium"},{name:(0,x._x)("Large","font size name"),size:36,slug:"large"},{name:(0,x._x)("Huge","font size name"),size:42,slug:"huge"}],imageDefaultSize:"large",imageSizes:[{slug:"thumbnail",name:(0,x.__)("Thumbnail")},{slug:"medium",name:(0,x.__)("Medium")},{slug:"large",name:(0,x.__)("Large")},{slug:"full",name:(0,x.__)("Full Size")}],imageEditing:!0,maxWidth:580,allowedBlockTypes:!0,maxUploadFileSize:0,allowedMimeTypes:null,canLockBlocks:!0,enableOpenverseMediaCategory:!0,clearBlockSelection:!0,__experimentalCanUserUseUnfilteredHTML:!1,__experimentalBlockDirectory:!1,__mobileEnablePageTemplates:!1,__experimentalBlockPatterns:[],__experimentalBlockPatternCategories:[],__unstableGalleryWithImageBlocks:!1,__unstableIsPreviewMode:!1,blockInspectorAnimation:{animationParent:"core/navigation","core/navigation":{enterDirection:"leftToRight"},"core/navigation-submenu":{enterDirection:"rightToLeft"},"core/navigation-link":{enterDirection:"rightToLeft"},"core/search":{enterDirection:"rightToLeft"},"core/social-links":{enterDirection:"rightToLeft"},"core/page-list":{enterDirection:"rightToLeft"},"core/spacer":{enterDirection:"rightToLeft"},"core/home-link":{enterDirection:"rightToLeft"},"core/site-title":{enterDirection:"rightToLeft"},"core/site-logo":{enterDirection:"rightToLeft"}},generateAnchors:!1,gradients:[{name:(0,x.__)("Vivid cyan blue to vivid purple"),gradient:"linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)",slug:"vivid-cyan-blue-to-vivid-purple"},{name:(0,x.__)("Light green cyan to vivid green cyan"),gradient:"linear-gradient(135deg,rgb(122,220,180) 0%,rgb(0,208,130) 100%)",slug:"light-green-cyan-to-vivid-green-cyan"},{name:(0,x.__)("Luminous vivid amber to luminous vivid orange"),gradient:"linear-gradient(135deg,rgba(252,185,0,1) 0%,rgba(255,105,0,1) 100%)",slug:"luminous-vivid-amber-to-luminous-vivid-orange"},{name:(0,x.__)("Luminous vivid orange to vivid red"),gradient:"linear-gradient(135deg,rgba(255,105,0,1) 0%,rgb(207,46,46) 100%)",slug:"luminous-vivid-orange-to-vivid-red"},{name:(0,x.__)("Very light gray to cyan bluish gray"),gradient:"linear-gradient(135deg,rgb(238,238,238) 0%,rgb(169,184,195) 100%)",slug:"very-light-gray-to-cyan-bluish-gray"},{name:(0,x.__)("Cool to warm spectrum"),gradient:"linear-gradient(135deg,rgb(74,234,220) 0%,rgb(151,120,209) 20%,rgb(207,42,186) 40%,rgb(238,44,130) 60%,rgb(251,105,98) 80%,rgb(254,248,76) 100%)",slug:"cool-to-warm-spectrum"},{name:(0,x.__)("Blush light purple"),gradient:"linear-gradient(135deg,rgb(255,206,236) 0%,rgb(152,150,240) 100%)",slug:"blush-light-purple"},{name:(0,x.__)("Blush bordeaux"),gradient:"linear-gradient(135deg,rgb(254,205,165) 0%,rgb(254,45,45) 50%,rgb(107,0,62) 100%)",slug:"blush-bordeaux"},{name:(0,x.__)("Luminous dusk"),gradient:"linear-gradient(135deg,rgb(255,203,112) 0%,rgb(199,81,192) 50%,rgb(65,88,208) 100%)",slug:"luminous-dusk"},{name:(0,x.__)("Pale ocean"),gradient:"linear-gradient(135deg,rgb(255,245,203) 0%,rgb(182,227,212) 50%,rgb(51,167,181) 100%)",slug:"pale-ocean"},{name:(0,x.__)("Electric grass"),gradient:"linear-gradient(135deg,rgb(202,248,128) 0%,rgb(113,206,126) 100%)",slug:"electric-grass"},{name:(0,x.__)("Midnight"),gradient:"linear-gradient(135deg,rgb(2,3,129) 0%,rgb(40,116,252) 100%)",slug:"midnight"}],__unstableResolvedAssets:{styles:[],scripts:[]}};function T(e,t,n){return[...e.slice(0,n),...Array.isArray(t)?t:[t],...e.slice(n)]}function M(e,t,n,o=1){const r=[...e];return r.splice(t,o),T(r,e.slice(t,t+o),n)}const P=e=>e;function R(e,t=""){const n=new Map,o=[];return n.set(t,o),e.forEach((e=>{const{clientId:t,innerBlocks:r}=e;o.push(t),R(r,t).forEach(((e,t)=>{n.set(t,e)}))})),n}function N(e,t=""){const n=[],o=[[t,e]];for(;o.length;){const[e,t]=o.shift();t.forEach((({innerBlocks:t,...r})=>{n.push([r.clientId,e]),t?.length&&o.push([r.clientId,t])}))}return n}function L(e,t=P){const n=[],o=[...e];for(;o.length;){const{innerBlocks:e,...r}=o.shift();o.push(...e),n.push([r.clientId,t(r)])}return n}function A(e){return L(e,(e=>{const{attributes:t,...n}=e;return n}))}function O(e){return L(e,(e=>e.attributes))}function D(e,t){return"UPDATE_BLOCK_ATTRIBUTES"===e.type&&void 0!==t&&"UPDATE_BLOCK_ATTRIBUTES"===t.type&&C()(e.clientIds,t.clientIds)&&function(e,t){return C()(Object.keys(e),Object.keys(t))}(e.attributes,t.attributes)}function z(e,t){const n=e.tree,o=[...t],r=[...t];for(;o.length;){const e=o.shift();o.push(...e.innerBlocks),r.push(...e.innerBlocks)}for(const e of r)n.set(e.clientId,{});for(const t of r)n.set(t.clientId,Object.assign(n.get(t.clientId),{...e.byClientId.get(t.clientId),attributes:e.attributes.get(t.clientId),innerBlocks:t.innerBlocks.map((e=>n.get(e.clientId)))}))}function V(e,t,n=!1){const o=e.tree,r=new Set([]),l=new Set;for(const o of t){let t=n?o:e.parents.get(o);do{if(e.controlledInnerBlocks[t]){l.add(t);break}r.add(t),t=e.parents.get(t)}while(void 0!==t)}for(const e of r)o.set(e,{...o.get(e)});for(const t of r)o.get(t).innerBlocks=(e.order.get(t)||[]).map((e=>o.get(e)));for(const t of l)o.set("controlled||"+t,{innerBlocks:(e.order.get(t)||[]).map((e=>o.get(e)))})}const F=(0,p.pipe)(d.combineReducers,(e=>(t,n)=>{if(t&&"SAVE_REUSABLE_BLOCK_SUCCESS"===n.type){const{id:e,updatedId:o}=n;if(e===o)return t;(t={...t}).attributes=new Map(t.attributes),t.attributes.forEach(((n,r)=>{const{name:l}=t.byClientId.get(r);"core/block"===l&&n.ref===e&&t.attributes.set(r,{...n,ref:o})}))}return e(t,n)}),(e=>(t={},n)=>{const o=e(t,n);if(o===t)return t;switch(o.tree=t.tree?t.tree:new Map,n.type){case"RECEIVE_BLOCKS":case"INSERT_BLOCKS":o.tree=new Map(o.tree),z(o,n.blocks),V(o,n.rootClientId?[n.rootClientId]:[""],!0);break;case"UPDATE_BLOCK":o.tree=new Map(o.tree),o.tree.set(n.clientId,{...o.tree.get(n.clientId),...o.byClientId.get(n.clientId),attributes:o.attributes.get(n.clientId)}),V(o,[n.clientId],!1);break;case"SYNC_DERIVED_BLOCK_ATTRIBUTES":case"UPDATE_BLOCK_ATTRIBUTES":o.tree=new Map(o.tree),n.clientIds.forEach((e=>{o.tree.set(e,{...o.tree.get(e),attributes:o.attributes.get(e)})})),V(o,n.clientIds,!1);break;case"REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN":{const e=function(e){const t={},n=[...e];for(;n.length;){const{innerBlocks:e,...o}=n.shift();n.push(...e),t[o.clientId]=!0}return t}(n.blocks);o.tree=new Map(o.tree),n.replacedClientIds.concat(n.replacedClientIds.filter((t=>!e[t])).map((e=>"controlled||"+e))).forEach((e=>{o.tree.delete(e)})),z(o,n.blocks),V(o,n.blocks.map((e=>e.clientId)),!1);const r=[];for(const e of n.clientIds)void 0===t.parents.get(e)||""!==t.parents.get(e)&&!o.byClientId.get(t.parents.get(e))||r.push(t.parents.get(e));V(o,r,!0);break}case"REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN":const e=[];for(const r of n.clientIds)void 0===t.parents.get(r)||""!==t.parents.get(r)&&!o.byClientId.get(t.parents.get(r))||e.push(t.parents.get(r));o.tree=new Map(o.tree),n.removedClientIds.concat(n.removedClientIds.map((e=>"controlled||"+e))).forEach((e=>{o.tree.delete(e)})),V(o,e,!0);break;case"MOVE_BLOCKS_TO_POSITION":{const e=[];n.fromRootClientId?e.push(n.fromRootClientId):e.push(""),n.toRootClientId&&e.push(n.toRootClientId),o.tree=new Map(o.tree),V(o,e,!0);break}case"MOVE_BLOCKS_UP":case"MOVE_BLOCKS_DOWN":{const e=[n.rootClientId?n.rootClientId:""];o.tree=new Map(o.tree),V(o,e,!0);break}case"SAVE_REUSABLE_BLOCK_SUCCESS":{const e=[];o.attributes.forEach(((t,r)=>{"core/block"===o.byClientId.get(r).name&&t.ref===n.updatedId&&e.push(r)})),o.tree=new Map(o.tree),e.forEach((e=>{o.tree.set(e,{...o.byClientId.get(e),attributes:o.attributes.get(e),innerBlocks:o.tree.get(e).innerBlocks})})),V(o,e,!1)}}return o}),(e=>(t,n)=>{const o=e=>{let o=e;for(let r=0;r(t,n)=>{if("REPLACE_INNER_BLOCKS"!==n.type)return e(t,n);const o={};if(Object.keys(t.controlledInnerBlocks).length){const e=[...n.blocks];for(;e.length;){const{innerBlocks:n,...r}=e.shift();e.push(...n),t.controlledInnerBlocks[r.clientId]&&(o[r.clientId]=!0)}}let r=t;t.order.get(n.rootClientId)&&(r=e(r,{type:"REMOVE_BLOCKS",keepControlledInnerBlocks:o,clientIds:t.order.get(n.rootClientId)}));let l=r;if(n.blocks.length){l=e(l,{...n,type:"INSERT_BLOCKS",index:0});const r=new Map(l.order);Object.keys(o).forEach((e=>{t.order.get(e)&&r.set(e,t.order.get(e))})),l.order=r,l.tree=new Map(l.tree),Object.keys(o).forEach((e=>{const n=`controlled||${e}`;t.tree.has(n)&&l.tree.set(n,t.tree.get(n))}))}return l}),(e=>(t,n)=>{if("RESET_BLOCKS"===n.type){const e={...t,byClientId:new Map(A(n.blocks)),attributes:new Map(O(n.blocks)),order:R(n.blocks),parents:new Map(N(n.blocks)),controlledInnerBlocks:{}};return e.tree=new Map(t?.tree),z(e,n.blocks),e.tree.set("",{innerBlocks:n.blocks.map((t=>e.tree.get(t.clientId)))}),e}return e(t,n)}),(function(e){let t,n,o=!1;return(r,l)=>{let i,s=e(r,l);var a;"SET_EXPLICIT_PERSISTENT"===l.type&&(n=l.isPersistentChange,i=null===(a=r.isPersistentChange)||void 0===a||a);if(void 0!==n)return i=n,i===s.isPersistentChange?s:{...s,isPersistentChange:i};const c="MARK_LAST_CHANGE_AS_PERSISTENT"===l.type||o;var u;return r!==s||c?(s={...s,isPersistentChange:c?!o:!D(l,t)},t=l,o="MARK_NEXT_CHANGE_AS_NOT_PERSISTENT"===l.type,s):(o="MARK_NEXT_CHANGE_AS_NOT_PERSISTENT"===l.type,i=null===(u=r?.isPersistentChange)||void 0===u||u,r.isPersistentChange===i?r:{...s,isPersistentChange:i})}}),(function(e){const t=new Set(["RECEIVE_BLOCKS"]);return(n,o)=>{const r=e(n,o);return r!==n&&(r.isIgnoredChange=t.has(o.type)),r}}),(e=>(t,n)=>{if("SET_HAS_CONTROLLED_INNER_BLOCKS"===n.type){const o=e(t,{type:"REPLACE_INNER_BLOCKS",rootClientId:n.clientId,blocks:[]});return e(o,n)}return e(t,n)}))({byClientId(e=new Map,t){switch(t.type){case"RECEIVE_BLOCKS":case"INSERT_BLOCKS":{const n=new Map(e);return A(t.blocks).forEach((([e,t])=>{n.set(e,t)})),n}case"UPDATE_BLOCK":{if(!e.has(t.clientId))return e;const{attributes:n,...o}=t.updates;if(0===Object.values(o).length)return e;const r=new Map(e);return r.set(t.clientId,{...e.get(t.clientId),...o}),r}case"REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN":{if(!t.blocks)return e;const n=new Map(e);return t.replacedClientIds.forEach((e=>{n.delete(e)})),A(t.blocks).forEach((([e,t])=>{n.set(e,t)})),n}case"REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN":{const n=new Map(e);return t.removedClientIds.forEach((e=>{n.delete(e)})),n}}return e},attributes(e=new Map,t){switch(t.type){case"RECEIVE_BLOCKS":case"INSERT_BLOCKS":{const n=new Map(e);return O(t.blocks).forEach((([e,t])=>{n.set(e,t)})),n}case"UPDATE_BLOCK":{if(!e.get(t.clientId)||!t.updates.attributes)return e;const n=new Map(e);return n.set(t.clientId,{...e.get(t.clientId),...t.updates.attributes}),n}case"SYNC_DERIVED_BLOCK_ATTRIBUTES":case"UPDATE_BLOCK_ATTRIBUTES":{if(t.clientIds.every((t=>!e.get(t))))return e;let o=!1;const r=new Map(e);for(const l of t.clientIds){var n;const i=Object.entries(t.uniqueByBlock?t.attributes[l]:null!==(n=t.attributes)&&void 0!==n?n:{});if(0===i.length)continue;let s=!1;const a=e.get(l),c={};i.forEach((([e,t])=>{a[e]!==t&&(s=!0,c[e]=t)})),o=o||s,s&&r.set(l,{...a,...c})}return o?r:e}case"REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN":{if(!t.blocks)return e;const n=new Map(e);return t.replacedClientIds.forEach((e=>{n.delete(e)})),O(t.blocks).forEach((([e,t])=>{n.set(e,t)})),n}case"REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN":{const n=new Map(e);return t.removedClientIds.forEach((e=>{n.delete(e)})),n}}return e},order(e=new Map,t){switch(t.type){case"RECEIVE_BLOCKS":{var n;const o=R(t.blocks),r=new Map(e);return o.forEach(((e,t)=>{""!==t&&r.set(t,e)})),r.set("",(null!==(n=e.get(""))&&void 0!==n?n:[]).concat(o[""])),r}case"INSERT_BLOCKS":{const{rootClientId:n=""}=t,o=e.get(n)||[],r=R(t.blocks,n),{index:l=o.length}=t,i=new Map(e);return r.forEach(((e,t)=>{i.set(t,e)})),i.set(n,T(o,r.get(n),l)),i}case"MOVE_BLOCKS_TO_POSITION":{var o;const{fromRootClientId:n="",toRootClientId:r="",clientIds:l}=t,{index:i=e.get(r).length}=t;if(n===r){const t=e.get(r).indexOf(l[0]),n=new Map(e);return n.set(r,M(e.get(r),t,i,l.length)),n}const s=new Map(e);return s.set(n,null!==(o=e.get(n)?.filter((e=>!l.includes(e))))&&void 0!==o?o:[]),s.set(r,T(e.get(r),l,i)),s}case"MOVE_BLOCKS_UP":{const{clientIds:n,rootClientId:o=""}=t,r=n[0],l=e.get(o);if(!l.length||r===l[0])return e;const i=l.indexOf(r),s=new Map(e);return s.set(o,M(l,i,i-1,n.length)),s}case"MOVE_BLOCKS_DOWN":{const{clientIds:n,rootClientId:o=""}=t,r=n[0],l=n[n.length-1],i=e.get(o);if(!i.length||l===i[i.length-1])return e;const s=i.indexOf(r),a=new Map(e);return a.set(o,M(i,s,s+1,n.length)),a}case"REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN":{const{clientIds:n}=t;if(!t.blocks)return e;const o=R(t.blocks),r=new Map(e);return t.replacedClientIds.forEach((e=>{r.delete(e)})),o.forEach(((e,t)=>{""!==t&&r.set(t,e)})),r.forEach(((e,t)=>{const l=Object.values(e).reduce(((e,t)=>t===n[0]?[...e,...o.get("")]:(-1===n.indexOf(t)&&e.push(t),e)),[]);r.set(t,l)})),r}case"REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN":{const n=new Map(e);return t.removedClientIds.forEach((e=>{n.delete(e)})),n.forEach(((e,o)=>{var r;const l=null!==(r=e?.filter((e=>!t.removedClientIds.includes(e))))&&void 0!==r?r:[];l.length!==e.length&&n.set(o,l)})),n}}return e},parents(e=new Map,t){switch(t.type){case"RECEIVE_BLOCKS":{const n=new Map(e);return N(t.blocks).forEach((([e,t])=>{n.set(e,t)})),n}case"INSERT_BLOCKS":{const n=new Map(e);return N(t.blocks,t.rootClientId||"").forEach((([e,t])=>{n.set(e,t)})),n}case"MOVE_BLOCKS_TO_POSITION":{const n=new Map(e);return t.clientIds.forEach((e=>{n.set(e,t.toRootClientId||"")})),n}case"REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN":{const n=new Map(e);return t.replacedClientIds.forEach((e=>{n.delete(e)})),N(t.blocks,e.get(t.clientIds[0])).forEach((([e,t])=>{n.set(e,t)})),n}case"REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN":{const n=new Map(e);return t.removedClientIds.forEach((e=>{n.delete(e)})),n}}return e},controlledInnerBlocks:(e={},{type:t,clientId:n,hasControlledInnerBlocks:o})=>"SET_HAS_CONTROLLED_INNER_BLOCKS"===t?{...e,[n]:o}:e});function H(e={},t){switch(t.type){case"CLEAR_SELECTED_BLOCK":return e.clientId?{}:e;case"SELECT_BLOCK":return t.clientId===e.clientId?e:{clientId:t.clientId};case"REPLACE_INNER_BLOCKS":case"INSERT_BLOCKS":return t.updateSelection&&t.blocks.length?{clientId:t.blocks[0].clientId}:e;case"REMOVE_BLOCKS":return t.clientIds&&t.clientIds.length&&-1!==t.clientIds.indexOf(e.clientId)?{}:e;case"REPLACE_BLOCKS":{if(-1===t.clientIds.indexOf(e.clientId))return e;const n=t.blocks[t.indexToSelect]||t.blocks[t.blocks.length-1];return n?n.clientId===e.clientId?e:{clientId:n.clientId}:{}}}return e}const G=(0,d.combineReducers)({blocks:F,isDragging:function(e=!1,t){switch(t.type){case"START_DRAGGING":return!0;case"STOP_DRAGGING":return!1}return e},isTyping:function(e=!1,t){switch(t.type){case"START_TYPING":return!0;case"STOP_TYPING":return!1}return e},isBlockInterfaceHidden:function(e=!1,t){switch(t.type){case"HIDE_BLOCK_INTERFACE":return!0;case"SHOW_BLOCK_INTERFACE":return!1}return e},draggedBlocks:function(e=[],t){switch(t.type){case"START_DRAGGING_BLOCKS":return t.clientIds;case"STOP_DRAGGING_BLOCKS":return[]}return e},selection:function(e={},t){switch(t.type){case"SELECTION_CHANGE":return t.clientId?{selectionStart:{clientId:t.clientId,attributeKey:t.attributeKey,offset:t.startOffset},selectionEnd:{clientId:t.clientId,attributeKey:t.attributeKey,offset:t.endOffset}}:{selectionStart:t.start||e.selectionStart,selectionEnd:t.end||e.selectionEnd};case"RESET_SELECTION":const{selectionStart:n,selectionEnd:o}=t;return{selectionStart:n,selectionEnd:o};case"MULTI_SELECT":const{start:r,end:l}=t;return r===e.selectionStart?.clientId&&l===e.selectionEnd?.clientId?e:{selectionStart:{clientId:r},selectionEnd:{clientId:l}};case"RESET_BLOCKS":const i=e?.selectionStart?.clientId,s=e?.selectionEnd?.clientId;if(!i&&!s)return e;if(!t.blocks.some((e=>e.clientId===i)))return{selectionStart:{},selectionEnd:{}};if(!t.blocks.some((e=>e.clientId===s)))return{...e,selectionEnd:e.selectionStart}}const n=H(e.selectionStart,t),o=H(e.selectionEnd,t);return n===e.selectionStart&&o===e.selectionEnd?e:{selectionStart:n,selectionEnd:o}},isMultiSelecting:function(e=!1,t){switch(t.type){case"START_MULTI_SELECT":return!0;case"STOP_MULTI_SELECT":return!1}return e},isSelectionEnabled:function(e=!0,t){return"TOGGLE_SELECTION"===t.type?t.isSelectionEnabled:e},initialPosition:function(e=null,t){return"REPLACE_BLOCKS"===t.type&&void 0!==t.initialPosition||["MULTI_SELECT","SELECT_BLOCK","RESET_SELECTION","INSERT_BLOCKS","REPLACE_INNER_BLOCKS"].includes(t.type)?t.initialPosition:e},blocksMode:function(e={},t){if("TOGGLE_BLOCK_MODE"===t.type){const{clientId:n}=t;return{...e,[n]:e[n]&&"html"===e[n]?"visual":"html"}}return e},blockListSettings:(e={},t)=>{switch(t.type){case"REPLACE_BLOCKS":case"REMOVE_BLOCKS":return Object.fromEntries(Object.entries(e).filter((([e])=>!t.clientIds.includes(e))));case"UPDATE_BLOCK_LIST_SETTINGS":{const{clientId:n}=t;if(!t.settings){if(e.hasOwnProperty(n)){const{[n]:t,...o}=e;return o}return e}return C()(e[n],t.settings)?e:{...e,[n]:t.settings}}}return e},insertionPoint:function(e=null,t){switch(t.type){case"SHOW_INSERTION_POINT":{const{rootClientId:n,index:o,__unstableWithInserter:r,operation:l,nearestSide:i}=t,s={rootClientId:n,index:o,__unstableWithInserter:r,operation:l,nearestSide:i};return C()(e,s)?e:s}case"HIDE_INSERTION_POINT":return null}return e},template:function(e={isValid:!0},t){return"SET_TEMPLATE_VALIDITY"===t.type?{...e,isValid:t.isValid}:e},settings:function(e=I,t){return"UPDATE_SETTINGS"===t.type?t.reset?{...I,...t.settings}:{...e,...t.settings}:e},preferences:function(e=B,t){switch(t.type){case"INSERT_BLOCKS":case"REPLACE_BLOCKS":return t.blocks.reduce(((e,n)=>{const{attributes:o,name:r}=n;let l=r;const i=(0,d.select)(c.store).getActiveBlockVariation(r,o);return i?.name&&(l+="/"+i.name),"core/block"===r&&(l+="/"+o.ref),{...e,insertUsage:{...e.insertUsage,[l]:{time:t.time,count:e.insertUsage[l]?e.insertUsage[l].count+1:1}}}}),e)}return e},lastBlockAttributesChange:function(e=null,t){switch(t.type){case"UPDATE_BLOCK":if(!t.updates.attributes)break;return{[t.clientId]:t.updates.attributes};case"UPDATE_BLOCK_ATTRIBUTES":return t.clientIds.reduce(((e,n)=>({...e,[n]:t.uniqueByBlock?t.attributes[n]:t.attributes})),{})}return e},lastFocus:function(e=!1,t){return"LAST_FOCUS"===t.type?t.lastFocus:e},editorMode:function(e="edit",t){return"INSERT_BLOCKS"===t.type&&"navigation"===e?"edit":"SET_EDITOR_MODE"===t.type?t.mode:e},hasBlockMovingClientId:function(e=null,t){return"SET_BLOCK_MOVING_MODE"===t.type?t.hasBlockMovingClientId:"SET_EDITOR_MODE"===t.type?null:e},highlightedBlock:function(e,t){switch(t.type){case"TOGGLE_BLOCK_HIGHLIGHT":const{clientId:n,isHighlighted:o}=t;return o?n:e===n?null:e;case"SELECT_BLOCK":if(t.clientId!==e)return null}return e},lastBlockInserted:function(e={},t){switch(t.type){case"INSERT_BLOCKS":case"REPLACE_BLOCKS":if(!t.blocks.length)return e;const n=t.blocks.map((e=>e.clientId)),o=t.meta?.source;return{clientIds:n,source:o};case"RESET_BLOCKS":return{}}return e},temporarilyEditingAsBlocks:function(e="",t){return"SET_TEMPORARILY_EDITING_AS_BLOCKS"===t.type?t.temporarilyEditingAsBlocks:e},temporarilyEditingFocusModeRevert:function(e="",t){return"SET_TEMPORARILY_EDITING_AS_BLOCKS"===t.type?t.focusModeToRevert:e},blockVisibility:function(e={},t){return"SET_BLOCK_VISIBILITY"===t.type?{...e,...t.updates}:e},blockEditingModes:function(e=new Map,t){switch(t.type){case"SET_BLOCK_EDITING_MODE":return new Map(e).set(t.clientId,t.mode);case"UNSET_BLOCK_EDITING_MODE":{const n=new Map(e);return n.delete(t.clientId),n}case"RESET_BLOCKS":return e.has("")?(new Map).set("",e.get("")):e}return e},styleOverrides:function(e=new Map,t){switch(t.type){case"SET_STYLE_OVERRIDE":return new Map(e).set(t.id,t.style);case"DELETE_STYLE_OVERRIDE":{const n=new Map(e);return n.delete(t.id),n}}return e},removalPromptData:function(e=!1,t){switch(t.type){case"DISPLAY_BLOCK_REMOVAL_PROMPT":const{clientIds:e,selectPrevious:n,blockNamesForPrompt:o,messageType:r}=t;return{clientIds:e,selectPrevious:n,blockNamesForPrompt:o,messageType:r};case"CLEAR_BLOCK_REMOVAL_PROMPT":return!1}return e},blockRemovalRules:function(e=!1,t){return"SET_BLOCK_REMOVAL_RULES"===t.type?t.rules:e},openedBlockSettingsMenu:function(e=null,t){var n;return"SET_OPENED_BLOCK_SETTINGS_MENU"===t.type?null!==(n=t?.clientId)&&void 0!==n?n:null:e},registeredInserterMediaCategories:function(e=[],t){return"REGISTER_INSERTER_MEDIA_CATEGORY"===t.type?[...e,t.category]:e}});const U=function(e){return(t,n)=>{const o=e(t,n);return t?(o.automaticChangeStatus=t.automaticChangeStatus,"MARK_AUTOMATIC_CHANGE"===n.type?{...o,automaticChangeStatus:"pending"}:"MARK_AUTOMATIC_CHANGE_FINAL"===n.type&&"pending"===t.automaticChangeStatus?{...o,automaticChangeStatus:"final"}:o.blocks===t.blocks&&o.selection===t.selection||"final"!==o.automaticChangeStatus&&o.selection!==t.selection?o:{...o,automaticChangeStatus:void 0}):o}}(G);var $={};function j(e){return[e]}function W(e,t,n){var o;if(e.length!==t.length)return!1;for(o=n;o"boolean"==typeof e?e:Array.isArray(e)?!(!e.includes("core/post-content")||null!==t)||e.includes(t):n,J=(e,t)=>{if("boolean"==typeof t)return t;const n=[...e];for(;n.length>0;){const e=n.shift();if(!Q(t,e.name||e.blockName,!0))return!1;e.innerBlocks?.forEach((e=>{n.push(e)}))}return!0},ee=e=>t=>[t.settings.__experimentalBlockPatterns,t.settings.__experimentalUserPatternCategories,t.settings.__experimentalReusableBlocks,t.settings[X]?.(e),t.blockPatterns],te=(e,t,n)=>(o,r)=>{let l,i;if("function"==typeof e?(l=e(o),i=e(r)):(l=o[e],i=r[e]),l>i)return"asc"===n?1:-1;if(i>l)return"asc"===n?-1:1;const s=t.findIndex((e=>e===o)),a=t.findIndex((e=>e===r));return s>a?1:a>s?-1:0};function ne(e,t,n="asc"){return e.concat().sort(te(t,e,n))}const oe="core/block-editor",re=window.wp.privateApis,{lock:le,unlock:ie}=(0,re.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.","@wordpress/block-editor"),se=[],ae=new Set;function ce(e,t){const n=e.blocks.byClientId.get(t),o="core/social-link";if("web"!==u.Platform.OS&&n?.name===o){const n=e.blocks.attributes.get(t),{service:r}=null!=n?n:{};return r?`${o}-${r}`:o}return n?n.name:null}function ue(e,t){const n=e.blocks.byClientId.get(t);return!!n&&n.isValid}function de(e,t){return e.blocks.byClientId.get(t)?e.blocks.attributes.get(t):null}function pe(e,t){return e.blocks.byClientId.has(t)?e.blocks.tree.get(t):null}const me=K(((e,t)=>{const n=e.blocks.byClientId.get(t);return n?{...n,attributes:de(e,t)}:null}),((e,t)=>[e.blocks.byClientId.get(t),e.blocks.attributes.get(t)]));function he(e,t){const n=t&&un(e,t)?"controlled||"+t:t||"";return e.blocks.tree.get(n)?.innerBlocks||se}const ge=K(((e,t)=>(w()("wp.data.select( 'core/block-editor' ).__unstableGetClientIdWithClientIdsTree",{since:"6.3",version:"6.5"}),{clientId:t,innerBlocks:fe(e,t)})),(e=>[e.blocks.order])),fe=K(((e,t="")=>(w()("wp.data.select( 'core/block-editor' ).__unstableGetClientIdsTree",{since:"6.3",version:"6.5"}),ot(e,t).map((t=>ge(e,t))))),(e=>[e.blocks.order])),be=K(((e,t)=>{t=Array.isArray(t)?[...t]:[t];const n=[];for(const o of t){const t=e.blocks.order.get(o);t&&n.push(...t)}let o=0;for(;o[e.blocks.order])),ve=e=>be(e,""),ke=K(((e,t)=>{const n=ve(e);if(!t)return n.length;let o=0;for(const r of n){e.blocks.byClientId.get(r).name===t&&o++}return o}),(e=>[e.blocks.order,e.blocks.byClientId])),_e=K(((e,t)=>{if(!t)return se;const n=Array.isArray(t)?t:[t],o=ve(e).filter((t=>{const o=e.blocks.byClientId.get(t);return n.includes(o.name)}));return o.length>0?o:se}),(e=>[e.blocks.order,e.blocks.byClientId]));function ye(e,t){return w()("wp.data.select( 'core/block-editor' ).__experimentalGetGlobalBlocksByName",{since:"6.5",alternative:"wp.data.select( 'core/block-editor' ).getBlocksByName"}),_e(e,t)}const Ee=K(((e,t)=>(Array.isArray(t)?t:[t]).map((t=>pe(e,t)))),((e,t)=>(Array.isArray(t)?t:[t]).map((t=>e.blocks.tree.get(t))))),we=K(((e,t)=>Ee(e,t).filter(Boolean).map((e=>e.name))),((e,t)=>Ee(e,t)));function Se(e,t){return ot(e,t).length}function Ce(e){return e.selection.selectionStart}function xe(e){return e.selection.selectionEnd}function Be(e){return e.selection.selectionStart.clientId}function Ie(e){return e.selection.selectionEnd.clientId}function Te(e){const t=Ue(e).length;return t||(e.selection.selectionStart.clientId?1:0)}function Me(e){const{selectionStart:t,selectionEnd:n}=e.selection;return!!t.clientId&&t.clientId===n.clientId}function Pe(e){const{selectionStart:t,selectionEnd:n}=e.selection,{clientId:o}=t;return o&&o===n.clientId?o:null}function Re(e){const t=Pe(e);return t?pe(e,t):null}function Ne(e,t){var n;return null!==(n=e.blocks.parents.get(t))&&void 0!==n?n:null}const Le=K(((e,t,n=!1)=>{const o=[];let r=t;for(;r=e.blocks.parents.get(r);)o.push(r);return o.length?n?o:o.reverse():se}),(e=>[e.blocks.parents])),Ae=K(((e,t,n,o=!1)=>{const r=Le(e,t,o),l=Array.isArray(n)?e=>n.includes(e):e=>n===e;return r.filter((t=>l(ce(e,t))))}),(e=>[e.blocks.parents]));function Oe(e,t){let n,o=t;do{n=o,o=e.blocks.parents.get(o)}while(o);return n}function De(e,t){const n=Pe(e),o=[...Le(e,t),t],r=[...Le(e,n),n];let l;const i=Math.min(o.length,r.length);for(let e=0;e{const{selectionStart:t,selectionEnd:n}=e.selection;if(!t.clientId||!n.clientId)return se;if(t.clientId===n.clientId)return[t.clientId];const o=Ne(e,t.clientId);if(null===o)return se;const r=ot(e,o),l=r.indexOf(t.clientId),i=r.indexOf(n.clientId);return l>i?r.slice(i,l+1):r.slice(l,i+1)}),(e=>[e.blocks.order,e.selection.selectionStart.clientId,e.selection.selectionEnd.clientId]));function Ue(e){const{selectionStart:t,selectionEnd:n}=e.selection;return t.clientId===n.clientId?se:Ge(e)}const $e=K((e=>{const t=Ue(e);return t.length?t.map((t=>pe(e,t))):se}),(e=>[...Ge.getDependants(e),e.blocks.byClientId,e.blocks.order,e.blocks.attributes]));function je(e){return Ue(e)[0]||null}function We(e){const t=Ue(e);return t[t.length-1]||null}function Ke(e,t){return je(e)===t}function Ze(e,t){return-1!==Ue(e).indexOf(t)}const qe=K(((e,t)=>{let n=t,o=!1;for(;n&&!o;)n=Ne(e,n),o=Ze(e,n);return o}),(e=>[e.blocks.order,e.selection.selectionStart.clientId,e.selection.selectionEnd.clientId]));function Ye(e){const{selectionStart:t,selectionEnd:n}=e.selection;return t.clientId===n.clientId?null:t.clientId||null}function Xe(e){const{selectionStart:t,selectionEnd:n}=e.selection;return t.clientId===n.clientId?null:n.clientId||null}function Qe(e){const t=Ce(e),n=xe(e);return!t.attributeKey&&!n.attributeKey&&void 0===t.offset&&void 0===n.offset}function Je(e){const t=Ce(e),n=xe(e);return!!t&&!!n&&t.clientId===n.clientId&&t.attributeKey===n.attributeKey&&t.offset===n.offset}function et(e){return Ge(e).some((t=>{const n=ce(e,t);return!(0,c.getBlockType)(n).merge}))}function tt(e,t){const n=Ce(e),o=xe(e);if(n.clientId===o.clientId)return!1;if(!n.attributeKey||!o.attributeKey||void 0===n.offset||void 0===o.offset)return!1;const r=Ne(e,n.clientId);if(r!==Ne(e,o.clientId))return!1;const l=ot(e,r);let i,s;l.indexOf(n.clientId)>l.indexOf(o.clientId)?(i=o,s=n):(i=n,s=o);const a=t?s.clientId:i.clientId,u=t?i.clientId:s.clientId,d=ce(e,a);if(!(0,c.getBlockType)(d).merge)return!1;const p=pe(e,u);if(p.name===d)return!0;const m=(0,c.switchToBlockType)(p,d);return m&&m.length}const nt=e=>{const t=Ce(e),n=xe(e);if(t.clientId===n.clientId)return se;if(!t.attributeKey||!n.attributeKey||void 0===t.offset||void 0===n.offset)return se;const o=Ne(e,t.clientId);if(o!==Ne(e,n.clientId))return se;const r=ot(e,o),l=r.indexOf(t.clientId),i=r.indexOf(n.clientId),[s,a]=l>i?[n,t]:[t,n],c=pe(e,s.clientId),u=pe(e,a.clientId),d=c.attributes[s.attributeKey],p=u.attributes[a.attributeKey];let m=(0,Y.create)({html:d}),h=(0,Y.create)({html:p});return m=(0,Y.remove)(m,0,s.offset),h=(0,Y.remove)(h,a.offset,h.text.length),[{...c,attributes:{...c.attributes,[s.attributeKey]:(0,Y.toHTMLString)({value:m})}},{...u,attributes:{...u.attributes,[a.attributeKey]:(0,Y.toHTMLString)({value:h})}}]};function ot(e,t){return e.blocks.order.get(t||"")||se}function rt(e,t){return ot(e,Ne(e,t)).indexOf(t)}function lt(e,t){const{selectionStart:n,selectionEnd:o}=e.selection;return n.clientId===o.clientId&&n.clientId===t}function it(e,t,n=!1){return ot(e,t).some((t=>lt(e,t)||Ze(e,t)||n&&it(e,t,n)))}function st(e,t,n=!1){return ot(e,t).some((t=>ft(e,t)||n&&st(e,t,n)))}function at(e,t){if(!t)return!1;const n=Ue(e),o=n.indexOf(t);return o>-1&&oft(e,t)))}function vt(){return w()('wp.data.select( "core/block-editor" ).isCaretWithinFormattedText',{since:"6.1",version:"6.3"}),!1}const kt=K((e=>{let t,n;const{insertionPoint:o,selection:{selectionEnd:r}}=e;if(null!==o)return o;const{clientId:l}=r;return l?(t=Ne(e,l)||void 0,n=rt(e,r.clientId)+1):n=ot(e).length,{rootClientId:t,index:n}}),(e=>[e.insertionPoint,e.selection.selectionEnd.clientId,e.blocks.parents,e.blocks.order]));function _t(e){return null!==e.insertionPoint}function yt(e){return e.template.isValid}function Et(e){return e.settings.template}function wt(e,t){var n,o;return t?null!==(n=Yt(e,t)?.templateLock)&&void 0!==n&&n:null!==(o=e.settings.templateLock)&&void 0!==o&&o}const St=(e,t,n=null)=>{let o;if(t&&"object"==typeof t?(o=t,t=o.name):o=(0,c.getBlockType)(t),!o)return!1;const{allowedBlockTypes:r}=Xt(e);if(!Q(r,t,!0))return!1;if(!!wt(e,n))return!1;if("disabled"===_n(e,null!=n?n:""))return!1;const l=Yt(e,n);if(n&&void 0===l)return!1;const i=ce(e,n),s=(0,c.getBlockType)(i),a=s?.allowedBlocks;let u=Q(a,t);if(!1!==u){const e=l?.allowedBlocks,n=Q(e,t);null!==n&&(u=n)}const d=o.parent,p=Q(d,i);let h=!0;const g=o.ancestor;if(g){h=[n,...Le(e,n)].some((t=>Q(g,ce(e,t))))}const f=h&&(null===u&&null===p||!0===u||!0===p);return f?(0,m.applyFilters)("blockEditor.__unstableCanInsertBlockType",f,o,n,{getBlock:pe.bind(null,e),getBlockParentsByBlockName:Ae.bind(null,e)}):f},Ct=K(St,((e,t,n)=>[e.blockListSettings[n],e.blocks.byClientId.get(n),e.settings.allowedBlockTypes,e.settings.templateLock,e.blockEditingModes]));function xt(e,t,n=null){return t.every((t=>Ct(e,ce(e,t),n)))}function Bt(e,t,n=null){const o=de(e,t);return null===o||(void 0!==o.lock?.remove?!o.lock.remove:!wt(e,n)&&"disabled"!==_n(e,n))}function It(e,t,n=null){return t.every((t=>Bt(e,t,n)))}function Tt(e,t,n=null){const o=de(e,t);return null===o||(void 0!==o.lock?.move?!o.lock.move:"all"!==wt(e,n)&&"disabled"!==_n(e,n))}function Mt(e,t,n=null){return t.every((t=>Tt(e,t,n)))}function Pt(e,t){const n=de(e,t);if(null===n)return!0;const{lock:o}=n;return!o?.edit}function Rt(e,t){return!!(0,c.hasBlockSupport)(t,"lock",!0)&&!!e.settings?.canLockBlocks}function Nt(e,t){var n;return null!==(n=e.preferences.insertUsage?.[t])&&void 0!==n?n:null}const Lt=(e,t,n)=>!!(0,c.hasBlockSupport)(t,"inserter",!0)&&St(e,t.name,n),At=(e,t)=>{if(!e)return t;const n=Date.now()-e;switch(!0){case n<36e5:return 4*t;case n<864e5:return 2*t;case n<6048e5:return t/2;default:return t/4}},Ot=(e,{buildScope:t="inserter"})=>n=>{const o=n.name;let r=!1;(0,c.hasBlockSupport)(n.name,"multiple",!0)||(r=Ee(e,ve(e)).some((({name:e})=>e===n.name)));const{time:l,count:i=0}=Nt(e,o)||{},s={id:o,name:n.name,title:n.title,icon:n.icon,isDisabled:r,frecency:At(l,i)};if("transform"===t)return s;const a=(0,c.getBlockVariations)(n.name,"inserter");return{...s,initialAttributes:{},description:n.description,category:n.category,keywords:n.keywords,variations:a,example:n.example,utility:1}},Dt=K(((e,t=null)=>{const n=St(e,"core/block",t)?on(e).map((t=>{const n=t.wp_pattern_sync_status?q:{src:q,foreground:"var(--wp-block-synced-color)"},o=`core/block/${t.id}`,{time:r,count:l=0}=Nt(e,o)||{},i=At(r,l);return{id:o,name:"core/block",initialAttributes:{ref:t.id},title:t.title?.raw,icon:n,category:"reusable",keywords:["reusable"],isDisabled:!1,utility:1,frecency:i,content:t.content?.raw,syncStatus:t.wp_pattern_sync_status}})):[],o=Ot(e,{buildScope:"inserter"}),r=(0,c.getBlockTypes)().filter((n=>Lt(e,n,t))).map(o).reduce(((t,n)=>{const{variations:o=[]}=n;if(o.some((({isDefault:e})=>e))||t.push(n),o.length){const r=((e,t)=>n=>{const o=`${t.id}/${n.name}`,{time:r,count:l=0}=Nt(e,o)||{};return{...t,id:o,icon:n.icon||t.icon,title:n.title||t.title,description:n.description||t.description,category:n.category||t.category,example:n.hasOwnProperty("example")?n.example:t.example,initialAttributes:{...t.initialAttributes,...n.attributes},innerBlocks:n.innerBlocks,keywords:n.keywords||t.keywords,frecency:At(r,l)}})(e,n);t.push(...o.map(r))}return t}),[]),{core:l,noncore:i}=r.reduce(((e,t)=>{const{core:n,noncore:o}=e;return(t.name.startsWith("core/")?n:o).push(t),e}),{core:[],noncore:[]});return[...[...l,...i],...n]}),((e,t)=>[e.blockListSettings[t],e.blocks.byClientId.get(t),e.blocks.order,e.preferences.insertUsage,e.settings.allowedBlockTypes,e.settings.templateLock,on(e),(0,c.getBlockTypes)()])),zt=K(((e,t,n=null)=>{const o=Array.isArray(t)?t:[t],r=Ot(e,{buildScope:"transform"}),l=(0,c.getBlockTypes)().filter((t=>Lt(e,t,n))).map(r),i=Object.fromEntries(Object.entries(l).map((([,e])=>[e.name,e]))),s=(0,c.getPossibleBlockTransformations)(o).reduce(((e,t)=>(i[t?.name]&&e.push(i[t.name]),e)),[]);return ne(s,(e=>i[e.name].frecency),"desc")}),((e,t,n)=>[e.blockListSettings[n],e.blocks.byClientId.get(n),e.preferences.insertUsage,e.settings.allowedBlockTypes,e.settings.templateLock,(0,c.getBlockTypes)()])),Vt=K(((e,t=null)=>{if((0,c.getBlockTypes)().some((n=>Lt(e,n,t))))return!0;return St(e,"core/block",t)&&on(e).length>0}),((e,t)=>[e.blockListSettings[t],e.blocks.byClientId.get(t),e.settings.allowedBlockTypes,e.settings.templateLock,on(e),(0,c.getBlockTypes)()])),Ft=K(((e,t=null)=>{if(!t)return;const n=(0,c.getBlockTypes)().filter((n=>Lt(e,n,t)));return St(e,"core/block",t)&&on(e).length>0&&n.push("core/block"),n}),((e,t)=>[e.blockListSettings[t],e.blocks.byClientId.get(t),e.settings.allowedBlockTypes,e.settings.templateLock,on(e),(0,c.getBlockTypes)()])),Ht=K(((e,t=null)=>(w()('wp.data.select( "core/block-editor" ).__experimentalGetAllowedBlocks',{alternative:'wp.data.select( "core/block-editor" ).getAllowedBlocks',since:"6.2",version:"6.4"}),Ft(e,t))),((e,t)=>[...Ft.getDependants(e,t)])),Gt=K(((e,t=null)=>{if(!t)return;const n=e.blockListSettings[t]?.defaultBlock,o=e.blockListSettings[t]?.directInsert;return n&&o?"function"==typeof o?o(pe(e,t))?n:null:n:void 0}),((e,t)=>[e.blockListSettings[t],e.blocks.tree.get(t)])),Ut=K(((e,t=null)=>(w()('wp.data.select( "core/block-editor" ).__experimentalGetDirectInsertBlock',{alternative:'wp.data.select( "core/block-editor" ).getDirectInsertBlock',since:"6.3",version:"6.4"}),Gt(e,t))),((e,t)=>[e.blockListSettings[t],e.blocks.tree.get(t)])),$t=(0,d.createRegistrySelector)((e=>K(((t,n)=>{const{getAllPatterns:o}=ie(e(oe)),r=o().find((({name:e})=>e===n));return r?{...r,blocks:(0,c.parse)(r.content,{__unstableSkipMigrationLogs:!0})}:null}),ee(e)))),jt=e=>(t,n)=>[...ee(e)(t),t.settings.allowedBlockTypes,t.settings.templateLock,t.blockListSettings[n],t.blocks.byClientId.get(n)],Wt=(0,d.createRegistrySelector)((e=>K(((t,n=null)=>{const{getAllPatterns:o,__experimentalGetParsedPattern:r}=ie(e(oe)),l=o(),{allowedBlockTypes:i}=Xt(t),s=l.filter((({inserter:e=!0})=>!!e)).map((({name:e})=>r(e))),a=s.filter((({blocks:e})=>J(e,i))),c=a.filter((({blocks:e})=>e.every((({name:e})=>Ct(t,e,n)))));return c}),jt(e)))),Kt=(0,d.createRegistrySelector)((e=>K(((t,n,o=null)=>{if(!n)return se;const r=e(oe).__experimentalGetAllowedPatterns(o),l=Array.isArray(n)?n:[n],i=r.filter((e=>e?.blockTypes?.some?.((e=>l.includes(e)))));return 0===i.length?se:i}),((t,n,o)=>jt(e)(t,o))))),Zt=(0,d.createRegistrySelector)((e=>(w()('wp.data.select( "core/block-editor" ).__experimentalGetPatternsByBlockTypes',{alternative:'wp.data.select( "core/block-editor" ).getPatternsByBlockTypes',since:"6.2",version:"6.4"}),e(oe).getPatternsByBlockTypes))),qt=(0,d.createRegistrySelector)((e=>K(((t,n,o=null)=>{if(!n)return se;if(n.some((({clientId:e,innerBlocks:n})=>n.length||un(t,e))))return se;const r=Array.from(new Set(n.map((({name:e})=>e))));return e(oe).getPatternsByBlockTypes(r,o)}),((t,n,o)=>jt(e)(t,o)))));function Yt(e,t){return e.blockListSettings[t]}function Xt(e){return e.settings}function Qt(e){return e.blocks.isPersistentChange}const Jt=K(((e,t=[])=>t.reduce(((t,n)=>e.blockListSettings[n]?{...t,[n]:e.blockListSettings[n]}:t),{})),(e=>[e.blockListSettings])),en=K(((e,t)=>{const n=on(e).find((e=>e.id===t));return n?n.title?.raw:null}),(e=>[on(e)]));function tn(e){return e.blocks.isIgnoredChange}function nn(e){return e.lastBlockAttributesChange}function on(e){var t;return null!==(t=e.settings.__experimentalReusableBlocks)&&void 0!==t?t:se}function rn(e){return"navigation"===e.editorMode}function ln(e){return e.editorMode}function sn(e){return e.hasBlockMovingClientId}function an(e){return!!e.automaticChangeStatus}function cn(e,t){return e.highlightedBlock===t}function un(e,t){return!!e.blocks.controlledInnerBlocks[t]}const dn=K(((e,t)=>{if(!t.length)return null;const n=Pe(e);if(t.includes(ce(e,n)))return n;const o=Ue(e),r=Ae(e,n||o[0],t);return r?r[r.length-1]:null}),((e,t)=>[e.selection.selectionStart.clientId,e.selection.selectionEnd.clientId,t]));function pn(e,t,n){const{lastBlockInserted:o}=e;return o.clientIds?.includes(t)&&o.source===n}function mn(e,t){var n;return null===(n=e.blockVisibility?.[t])||void 0===n||n}const hn=K((e=>{const t=new Set(Object.keys(e.blockVisibility).filter((t=>e.blockVisibility[t])));return 0===t.size?ae:t}),(e=>[e.blockVisibility])),gn=K(((e,t)=>{let n,o=t;for(;o=e.blocks.parents.get(o);)"core/block"!==ce(e,o)&&"contentOnly"!==wt(e,o)||(n=o);return n}),(e=>[e.blocks.parents,e.blockListSettings]));function fn(e){return e.temporarilyEditingAsBlocks}function bn(e){return e.temporarilyEditingFocusModeRevert}function vn(e,t){if("default"!==_n(e,t))return!1;if(!Pt(e,t))return!0;const n=ln(e);if("zoom-out"===n&&t&&!Ne(e,t))return!0;const o=(0,c.hasBlockSupport)(ce(e,t),"__experimentalDisableBlockOverlay",!1);return("navigation"===n||!o&&un(e,t))&&!lt(e,t)&&!it(e,t,!0)}function kn(e,t){let n=e.blocks.parents.get(t);for(;n;){if(vn(e,n))return!0;n=e.blocks.parents.get(n)}return!1}const _n=(0,d.createRegistrySelector)((e=>(t,n="")=>{const o=t.blockEditingModes.get(n);if(o)return o;if(!n)return"default";const r=Ne(t,n);if("contentOnly"===wt(t,r)){const o=ce(t,n);return e(c.store).__experimentalHasContentRoleAttribute(o)?"contentOnly":"disabled"}const l=_n(t,r);return"contentOnly"===l?"default":l})),yn=(0,d.createRegistrySelector)((e=>(t,n="")=>{const o=n||Pe(t);if(!o)return!1;const{getGroupingBlockName:r}=e(c.store),l=pe(t,o),i=r();return l&&(l.name===i||(0,c.getBlockType)(l.name)?.transforms?.ungroup)&&!!l.innerBlocks.length&&Bt(t,o)})),En=(0,d.createRegistrySelector)((e=>(t,n=se)=>{const{getGroupingBlockName:o}=e(c.store),r=o(),l=n?.length?n:Ge(t),i=l?.length?Ne(t,l[0]):void 0;return Ct(t,r,i)&&l.length&&It(t,l,i)})),wn=new WeakSet,Sn=["inserterMediaCategories","blockInspectorAnimation"];function Cn(e,{stripExperimentalSettings:t=!1,reset:n=!1}={}){let o=e;if(t&&"web"===u.Platform.OS){o={};for(const t in e)Sn.includes(t)||(o[t]=e[t])}return{type:"UPDATE_SETTINGS",settings:o,reset:n}}function xn(){return{type:"HIDE_BLOCK_INTERFACE"}}function Bn(){return{type:"SHOW_BLOCK_INTERFACE"}}const In=(e,t=!0,n=!1)=>({select:o,dispatch:r,registry:l})=>{if(!e||!e.length)return;var i;i=e,e=Array.isArray(i)?i:[i];const s=o.getBlockRootClientId(e[0]);if(!o.canRemoveBlocks(e,s))return;const a=!n&&o.getBlockRemovalRules();if(a){const n=new Set,l=[...e];let i="templates";for(;l.length;){const e=l.shift(),t=o.getBlockName(e);if(a[t]&&n.add(t),a["bindings/core/pattern-overrides"]){const r=o.getBlockParentsByBlockName(e,"core/block");if(r?.length>0)continue;const l=o.getBlockAttributes(e);l?.metadata?.bindings&&JSON.stringify(l.metadata.bindings).includes("core/pattern-overrides")&&(n.add(t),i="patternOverrides")}const r=o.getBlockOrder(e);l.push(...r)}if(n.size)return void r(function(e,t,n,o){return{type:"DISPLAY_BLOCK_REMOVAL_PROMPT",clientIds:e,selectPrevious:t,blockNamesForPrompt:n,messageType:o}}(e,t,Array.from(n),i))}t&&r.selectPreviousBlock(e[0],t),l.batch((()=>{r({type:"REMOVE_BLOCKS",clientIds:e}),r(Tn())}))},Tn=()=>({select:e,dispatch:t})=>{if(e.getBlockCount()>0)return;const{__unstableHasCustomAppender:n}=e.getSettings();n||t.insertDefaultBlock()};function Mn(){return{type:"CLEAR_BLOCK_REMOVAL_PROMPT"}}function Pn(e=!1){return{type:"SET_BLOCK_REMOVAL_RULES",rules:e}}function Rn(e){return{type:"SET_OPENED_BLOCK_SETTINGS_MENU",clientId:e}}function Nn(e,t){return{type:"SET_STYLE_OVERRIDE",id:e,style:t}}function Ln(e){return{type:"DELETE_STYLE_OVERRIDE",id:e}}function An(e){return({dispatch:t,select:n,registry:o})=>{o.batch((()=>{t({type:"SET_EXPLICIT_PERSISTENT",isPersistentChange:!1}),e(),t({type:"SET_EXPLICIT_PERSISTENT",isPersistentChange:void 0});const o=n.getBlocks();wn.add(o)}))}}function On(e=null){return{type:"LAST_FOCUS",lastFocus:e}}function Dn(e){return({select:t,dispatch:n})=>{const o=t.__unstableGetTemporarilyEditingFocusModeToRevert();n.__unstableMarkNextChangeAsNotPersistent(),n.updateBlockAttributes(e,{templateLock:"contentOnly"}),n.updateBlockListSettings(e,{...t.getBlockListSettings(e),templateLock:"contentOnly"}),n.updateSettings({focusMode:o}),n.__unstableSetTemporarilyEditingAsBlocks()}}function zn(){return{type:"START_DRAGGING"}}function Vn(){return{type:"STOP_DRAGGING"}}const Fn={user:"user",theme:"theme",directory:"directory"},Hn={full:"fully",unsynced:"unsynced"},Gn={name:"allPatterns",label:(0,x._x)("All","patterns")},Un={name:"myPatterns",label:(0,x.__)("My patterns")};function $n(e,t,n){const o=e.name.startsWith("core/block"),r="core"===e.source||e.source?.startsWith("pattern-directory");return!(t!==Fn.theme||!o&&!r)||(!(t!==Fn.directory||!o&&r)||(t===Fn.user&&e.type!==Fn.user||(n===Hn.full&&""!==e.syncStatus||!(n!==Hn.unsynced||"unsynced"===e.syncStatus||!o))))}function jn(e,t,n){t=Array.isArray(t)?[...t]:[t],e=Array.isArray(e)?[...e]:{...e};const o=t.pop();let r=e;for(const e of t){const t=r[e];r=r[e]=Array.isArray(t)?[...t]:{...t}}return r[o]=n,e}const Wn=(e,t,n)=>{var o;const r=Array.isArray(t)?t:t.split(".");let l=e;return r.forEach((e=>{l=l?.[e]})),null!==(o=l)&&void 0!==o?o:n},Kn=["color","border","dimensions","typography","spacing"],Zn={"color.palette":e=>e.colors,"color.gradients":e=>e.gradients,"color.custom":e=>void 0===e.disableCustomColors?void 0:!e.disableCustomColors,"color.customGradient":e=>void 0===e.disableCustomGradients?void 0:!e.disableCustomGradients,"typography.fontSizes":e=>e.fontSizes,"typography.customFontSize":e=>void 0===e.disableCustomFontSizes?void 0:!e.disableCustomFontSizes,"typography.lineHeight":e=>e.enableCustomLineHeight,"spacing.units":e=>{if(void 0!==e.enableCustomUnits)return!0===e.enableCustomUnits?["px","em","rem","vh","vw","%"]:e.enableCustomUnits},"spacing.padding":e=>e.enableCustomSpacing},qn={"border.customColor":"border.color","border.customStyle":"border.style","border.customWidth":"border.width","typography.customFontStyle":"typography.fontStyle","typography.customFontWeight":"typography.fontWeight","typography.customLetterSpacing":"typography.letterSpacing","typography.customTextDecorations":"typography.textDecoration","typography.customTextTransforms":"typography.textTransform","border.customRadius":"border.radius","spacing.customMargin":"spacing.margin","spacing.customPadding":"spacing.padding","typography.customLineHeight":"typography.lineHeight"},Yn=e=>qn[e]||e;const Xn=new WeakMap;function Qn(e){var t,n;return null!==(t=null!==(n=e.custom)&&void 0!==n?n:e.theme)&&void 0!==t?t:e.default}function Jn(e){return["default","theme","custom"].some((t=>e?.[t]?.length))}function eo(e,t,...n){const o=ce(e,t),r=[];if(t){let n=t;do{const t=ce(e,n);(0,c.hasBlockSupport)(t,"__experimentalSettings",!1)&&r.push(n)}while(n=e.blocks.parents.get(n))}return n.map((n=>{if(Kn.includes(n))return void console.warn("Top level useSetting paths are disabled. Please use a subpath to query the information needed.");let l=(0,m.applyFilters)("blockEditor.useSetting.before",void 0,n,t,o);if(void 0!==l)return l;const i=Yn(n);for(const t of r){var s;const n=de(e,t);if(l=null!==(s=Wn(n.settings?.blocks?.[o],i))&&void 0!==s?s:Wn(n.settings,i),void 0!==l)break}const a=Xt(e);if(void 0===l&&o&&(l=Wn(a.__experimentalFeatures?.blocks?.[o],i)),void 0===l&&(l=Wn(a.__experimentalFeatures,i)),void 0!==l)return c.__EXPERIMENTAL_PATHS_WITH_OVERRIDE[i]?Qn(l):l;const u=Zn[i]?.(a);return void 0!==u?u:"typography.dropCap"===i||void 0}))}function to(e){return e.isBlockInterfaceHidden}function no(e){return e?.lastBlockInserted?.clientIds}function oo(e,t){return e.blocks.byClientId.get(t)}const ro=(e,t)=>{const n=t=>"disabled"===_n(e,t)&&ot(e,t).every(n);return ot(e,t).every(n)};const lo=K((function e(t,n){const o=ot(t,n),r=[];for(const n of o){const o=e(t,n);"disabled"!==_n(t,n)?r.push({clientId:n,innerBlocks:o}):r.push(...o)}return r}),(e=>[e.blocks.order,e.blockEditingModes,e.settings.templateLock,e.blockListSettings])),io=K(((e,t,n=!1)=>Le(e,t,n).filter((t=>"disabled"!==_n(e,t)))),(e=>[e.blocks.parents,e.blockEditingModes,e.settings.templateLock,e.blockListSettings]));function so(e){return e.removalPromptData}function ao(e){return e.blockRemovalRules}function co(e){return e.openedBlockSettingsMenu}function uo(e){return e.styleOverrides}function po(e){return e.registeredInserterMediaCategories}const mo=K((e=>{const{settings:{inserterMediaCategories:t,allowedMimeTypes:n,enableOpenverseMediaCategory:o},registeredInserterMediaCategories:r}=e;if(!t&&!r.length||!n)return;const l=t?.map((({name:e})=>e))||[];return[...t||[],...(r||[]).filter((({name:e})=>!l.includes(e)))].filter((e=>!(!o&&"openverse"===e.name)&&Object.values(n).some((t=>t.startsWith(`${e.mediaType}/`)))))}),(e=>[e.settings.inserterMediaCategories,e.settings.allowedMimeTypes,e.settings.enableOpenverseMediaCategory,e.registeredInserterMediaCategories])),ho=(0,d.createRegistrySelector)((e=>K(((t,n=null)=>{const{getAllPatterns:o,__experimentalGetParsedPattern:r}=ie(e(oe)),l=o(),{allowedBlockTypes:i}=Xt(t);return l.some((({name:e,inserter:o=!0})=>{if(!o)return!1;const{blocks:l}=r(e);return J(l,i)&&l.every((({name:e})=>Ct(t,e,n)))}))}),((t,n)=>[ee(e)(t),t.settings.allowedBlockTypes,t.settings.templateLock,t.blockListSettings[n],t.blocks.byClientId.get(n)])))),go=(0,d.createRegistrySelector)((e=>K((t=>{var n;const{__experimentalBlockPatterns:o=[],__experimentalUserPatternCategories:r=[],__experimentalReusableBlocks:l=[]}=t.settings,i=(null!=l?l:[]).map((e=>({name:`core/block/${e.id}`,id:e.id,type:Fn.user,title:e.title.raw,categories:e.wp_pattern_category.map((e=>{const t=(null!=r?r:[]).find((({id:t})=>t===e));return t?t.slug:e})),content:e.content.raw,syncStatus:e.wp_pattern_sync_status})));return[...i,...o,...null!==(n=t.settings[X]?.(e))&&void 0!==n?n:[]].filter(((e,t,n)=>t===n.findIndex((t=>e.name===t.name))))}),ee(e))));function fo(e){return e.lastFocus}function bo(e){return e.isDragging}const vo=window.wp.a11y,ko="†";function _o(e){if(e)return Object.keys(e).find((t=>{const n=e[t];return("string"==typeof n||n instanceof Y.RichTextData)&&-1!==n.toString().indexOf(ko)}))}const yo=e=>Array.isArray(e)?e:[e],Eo=e=>({dispatch:t})=>{t({type:"RESET_BLOCKS",blocks:e}),t(wo(e))},wo=e=>({select:t,dispatch:n})=>{const o=t.getTemplate(),r=t.getTemplateLock(),l=!o||"all"!==r||(0,c.doBlocksMatchTemplate)(e,o);if(l!==t.isValidTemplate())return n.setTemplateValidity(l),l};function So(e,t,n){return{type:"RESET_SELECTION",selectionStart:e,selectionEnd:t,initialPosition:n}}function Co(e){return w()('wp.data.dispatch( "core/block-editor" ).receiveBlocks',{since:"5.9",alternative:"resetBlocks or insertBlocks"}),{type:"RECEIVE_BLOCKS",blocks:e}}function xo(e,t,n=!1){return{type:"UPDATE_BLOCK_ATTRIBUTES",clientIds:yo(e),attributes:t,uniqueByBlock:n}}function Bo(e,t){return{type:"UPDATE_BLOCK",clientId:e,updates:t}}function Io(e,t=0){return{type:"SELECT_BLOCK",initialPosition:t,clientId:e}}const To=(e,t=!1)=>({select:n,dispatch:o})=>{const r=n.getPreviousBlockClientId(e);if(r)o.selectBlock(r,-1);else if(t){const t=n.getBlockRootClientId(e);t&&o.selectBlock(t,-1)}},Mo=e=>({select:t,dispatch:n})=>{const o=t.getNextBlockClientId(e);o&&n.selectBlock(o)};function Po(){return{type:"START_MULTI_SELECT"}}function Ro(){return{type:"STOP_MULTI_SELECT"}}const No=(e,t,n=0)=>({select:o,dispatch:r})=>{if(o.getBlockRootClientId(e)!==o.getBlockRootClientId(t))return;r({type:"MULTI_SELECT",start:e,end:t,initialPosition:n});const l=o.getSelectedBlockCount();(0,vo.speak)((0,x.sprintf)((0,x._n)("%s block selected.","%s blocks selected.",l),l),"assertive")};function Lo(){return{type:"CLEAR_SELECTED_BLOCK"}}function Ao(e=!0){return{type:"TOGGLE_SELECTION",isSelectionEnabled:e}}function Oo(e,t){var n;const o=null!==(n=t?.__experimentalPreferredStyleVariations?.value)&&void 0!==n?n:{};return e.map((e=>{const t=e.name;if(!(0,c.hasBlockSupport)(t,"defaultStylePicker",!0))return e;if(!o[t])return e;const n=e.attributes?.className;if(n?.includes("is-style-"))return e;const{attributes:r={}}=e,l=o[t];return{...e,attributes:{...r,className:`${n||""} is-style-${l}`.trim()}}}))}const Do=(e,t,n,o=0,r)=>({select:l,dispatch:i,registry:s})=>{e=yo(e),t=Oo(yo(t),l.getSettings());const a=l.getBlockRootClientId(e[0]);for(let e=0;e{i({type:"REPLACE_BLOCKS",clientIds:e,blocks:t,time:Date.now(),indexToSelect:n,initialPosition:o,meta:r}),i.ensureDefaultBlock()}))};function zo(e,t){return Do(e,t)}const Vo=e=>(t,n)=>({select:o,dispatch:r})=>{o.canMoveBlocks(t,n)&&r({type:e,clientIds:yo(t),rootClientId:n})},Fo=Vo("MOVE_BLOCKS_DOWN"),Ho=Vo("MOVE_BLOCKS_UP"),Go=(e,t="",n="",o)=>({select:r,dispatch:l})=>{if(r.canMoveBlocks(e,t)){if(t!==n){if(!r.canRemoveBlocks(e,t))return;if(!r.canInsertBlocks(e,n))return}l({type:"MOVE_BLOCKS_TO_POSITION",fromRootClientId:t,toRootClientId:n,clientIds:e,index:o})}};function Uo(e,t="",n="",o){return Go([e],t,n,o)}function $o(e,t,n,o,r){return jo([e],t,n,o,0,r)}const jo=(e,t,n,o=!0,r=0,l)=>({select:i,dispatch:s})=>{null!==r&&"object"==typeof r&&(l=r,r=0,w()("meta argument in wp.data.dispatch('core/block-editor')",{since:"5.8",hint:"The meta argument is now the 6th argument of the function"})),e=Oo(yo(e),i.getSettings());const a=[];for(const t of e){i.canInsertBlockType(t.name,n)&&a.push(t)}a.length&&s({type:"INSERT_BLOCKS",blocks:a,index:t,rootClientId:n,time:Date.now(),updateSelection:o,initialPosition:o?r:null,meta:l})};function Wo(e,t,n={}){const{__unstableWithInserter:o,operation:r,nearestSide:l}=n;return{type:"SHOW_INSERTION_POINT",rootClientId:e,index:t,__unstableWithInserter:o,operation:r,nearestSide:l}}const Ko=()=>({select:e,dispatch:t})=>{e.isBlockInsertionPointVisible()&&t({type:"HIDE_INSERTION_POINT"})};function Zo(e){return{type:"SET_TEMPLATE_VALIDITY",isValid:e}}const qo=()=>({select:e,dispatch:t})=>{t({type:"SYNCHRONIZE_TEMPLATE"});const n=e.getBlocks(),o=e.getTemplate(),r=(0,c.synchronizeBlocksWithTemplate)(n,o);t.resetBlocks(r)},Yo=e=>({registry:t,select:n,dispatch:o})=>{const r=n.getSelectionStart(),l=n.getSelectionEnd();if(r.clientId===l.clientId)return;if(!r.attributeKey||!l.attributeKey||void 0===r.offset||void 0===l.offset)return!1;const i=n.getBlockRootClientId(r.clientId);if(i!==n.getBlockRootClientId(l.clientId))return;const s=n.getBlockOrder(i);let a,u;s.indexOf(r.clientId)>s.indexOf(l.clientId)?(a=l,u=r):(a=r,u=l);const d=e?u:a,p=n.getBlock(d.clientId),m=(0,c.getBlockType)(p.name);if(!m.merge)return;const h=a,g=u,f=n.getBlock(h.clientId),b=n.getBlock(g.clientId),v=f.attributes[h.attributeKey],k=b.attributes[g.attributeKey];let _=(0,Y.create)({html:v}),y=(0,Y.create)({html:k});_=(0,Y.remove)(_,h.offset,_.text.length),y=(0,Y.insert)(y,ko,0,g.offset);const E=(0,c.cloneBlock)(f,{[h.attributeKey]:(0,Y.toHTMLString)({value:_})}),w=(0,c.cloneBlock)(b,{[g.attributeKey]:(0,Y.toHTMLString)({value:y})}),S=e?E:w,C=f.name===b.name?[S]:(0,c.switchToBlockType)(S,m.name);if(!C||!C.length)return;let x;if(e){const e=C.pop();x=m.merge(e.attributes,w.attributes)}else{const e=C.shift();x=m.merge(E.attributes,e.attributes)}const B=_o(x),I=x[B],T=(0,Y.create)({html:I}),M=T.text.indexOf(ko),P=(0,Y.remove)(T,M,M+1),R=(0,Y.toHTMLString)({value:P});x[B]=R;const N=n.getSelectedBlockClientIds(),L=[...e?C:[],{...p,attributes:{...p.attributes,...x}},...e?[]:C];t.batch((()=>{o.selectionChange(p.clientId,B,M,M),o.replaceBlocks(N,L,0,n.getSelectedBlocksInitialCaretPosition())}))},Xo=()=>({select:e,dispatch:t})=>{const n=e.getSelectionStart(),o=e.getSelectionEnd();if(n.clientId===o.clientId)return;if(!n.attributeKey||!o.attributeKey||void 0===n.offset||void 0===o.offset)return;const r=e.getBlockRootClientId(n.clientId);if(r!==e.getBlockRootClientId(o.clientId))return;const l=e.getBlockOrder(r);let i,s;l.indexOf(n.clientId)>l.indexOf(o.clientId)?(i=o,s=n):(i=n,s=o);const a=i,c=s,u=e.getBlock(a.clientId),d=e.getBlock(c.clientId),p=u.attributes[a.attributeKey],m=d.attributes[c.attributeKey];let h=(0,Y.create)({html:p}),g=(0,Y.create)({html:m});h=(0,Y.remove)(h,a.offset,h.text.length),g=(0,Y.remove)(g,0,c.offset),t.replaceBlocks(e.getSelectedBlockClientIds(),[{...u,attributes:{...u.attributes,[a.attributeKey]:(0,Y.toHTMLString)({value:h})}},{...d,attributes:{...d.attributes,[c.attributeKey]:(0,Y.toHTMLString)({value:g})}}])},Qo=()=>({select:e,dispatch:t})=>{const n=e.getSelectionStart(),o=e.getSelectionEnd();t.selectionChange({start:{clientId:n.clientId},end:{clientId:o.clientId}})},Jo=(e,t)=>({registry:n,select:o,dispatch:r})=>{const l=[e,t];r({type:"MERGE_BLOCKS",blocks:l});const[i,s]=l,a=o.getBlock(i),u=(0,c.getBlockType)(a.name);if(!u)return;const d=o.getBlock(s);if(!u.merge&&(0,c.getBlockSupport)(a.name,"__experimentalOnMerge")){const e=(0,c.switchToBlockType)(d,u.name);if(1!==e?.length)return void r.selectBlock(a.clientId);const[t]=e;return t.innerBlocks.length<1?void r.selectBlock(a.clientId):void n.batch((()=>{r.insertBlocks(t.innerBlocks,void 0,i),r.removeBlock(s),r.selectBlock(t.innerBlocks[0].clientId);const e=o.getNextBlockClientId(i);if(e&&o.getBlockName(i)===o.getBlockName(e)){const t=o.getBlockAttributes(i),n=o.getBlockAttributes(e);Object.keys(t).every((e=>t[e]===n[e]))&&(r.moveBlocksToPosition(o.getBlockOrder(e),e,i),r.removeBlock(e,!1))}}))}if((0,c.isUnmodifiedDefaultBlock)(a))return void r.removeBlock(i,o.isBlockSelected(i));if((0,c.isUnmodifiedDefaultBlock)(d))return void r.removeBlock(s,o.isBlockSelected(s));if(!u.merge)return void r.selectBlock(a.clientId);const p=(0,c.getBlockType)(d.name),{clientId:m,attributeKey:h,offset:g}=o.getSelectionStart(),f=(m===i?u:p).attributes[h],b=(m===i||m===s)&&void 0!==h&&void 0!==g&&!!f;f||("number"==typeof h?window.console.error("RichText needs an identifier prop that is the block attribute key of the attribute it controls. Its type is expected to be a string, but was "+typeof h):window.console.error("The RichText identifier prop does not match any attributes defined by the block."));const v=(0,c.cloneBlock)(a),k=(0,c.cloneBlock)(d);if(b){const e=m===i?v:k,t=e.attributes[h],n=(0,Y.insert)((0,Y.create)({html:t}),ko,g,g);e.attributes[h]=(0,Y.toHTMLString)({value:n})}const _=a.name===d.name?[k]:(0,c.switchToBlockType)(k,a.name);if(!_||!_.length)return;const y=u.merge(v.attributes,_[0].attributes);if(b){const e=_o(y),t=y[e],n=(0,Y.create)({html:t}),o=n.text.indexOf(ko),l=(0,Y.remove)(n,o,o+1),i=(0,Y.toHTMLString)({value:l});y[e]=i,r.selectionChange(a.clientId,e,o,o)}r.replaceBlocks([a.clientId,d.clientId],[{...a,attributes:{...a.attributes,...y}},..._.slice(1)],0)},er=(e,t=!0)=>In(e,t);function tr(e,t){return er([e],t)}function nr(e,t,n=!1,o=0){return{type:"REPLACE_INNER_BLOCKS",rootClientId:e,blocks:t,updateSelection:n,initialPosition:n?o:null,time:Date.now()}}function or(e){return{type:"TOGGLE_BLOCK_MODE",clientId:e}}function rr(){return{type:"START_TYPING"}}function lr(){return{type:"STOP_TYPING"}}function ir(e=[]){return{type:"START_DRAGGING_BLOCKS",clientIds:e}}function sr(){return{type:"STOP_DRAGGING_BLOCKS"}}function ar(){return w()('wp.data.dispatch( "core/block-editor" ).enterFormattedText',{since:"6.1",version:"6.3"}),{type:"DO_NOTHING"}}function cr(){return w()('wp.data.dispatch( "core/block-editor" ).exitFormattedText',{since:"6.1",version:"6.3"}),{type:"DO_NOTHING"}}function ur(e,t,n,o){return"string"==typeof e?{type:"SELECTION_CHANGE",clientId:e,attributeKey:t,startOffset:n,endOffset:o}:{type:"SELECTION_CHANGE",...e}}const dr=(e,t,n)=>({dispatch:o})=>{const r=(0,c.getDefaultBlockName)();if(!r)return;const l=(0,c.createBlock)(r,e);return o.insertBlock(l,n,t)};function pr(e,t){return{type:"UPDATE_BLOCK_LIST_SETTINGS",clientId:e,settings:t}}function mr(e){return Cn(e,{stripExperimentalSettings:!0})}function hr(e,t){return{type:"SAVE_REUSABLE_BLOCK_SUCCESS",id:e,updatedId:t}}function gr(){return{type:"MARK_LAST_CHANGE_AS_PERSISTENT"}}function fr(){return{type:"MARK_NEXT_CHANGE_AS_NOT_PERSISTENT"}}const br=()=>({dispatch:e})=>{e({type:"MARK_AUTOMATIC_CHANGE"});const{requestIdleCallback:t=(e=>setTimeout(e,100))}=window;t((()=>{e({type:"MARK_AUTOMATIC_CHANGE_FINAL"})}))},vr=(e=!0)=>({dispatch:t})=>{t.__unstableSetEditorMode(e?"navigation":"edit")},kr=e=>({dispatch:t,select:n})=>{if("zoom-out"===e){const e=n.getBlockSelectionStart();e&&t.selectBlock(n.getBlockHierarchyRootClientId(e))}t({type:"SET_EDITOR_MODE",mode:e}),"navigation"===e?(0,vo.speak)((0,x.__)("You are currently in navigation mode. Navigate blocks using the Tab key and Arrow keys. Use Left and Right Arrow keys to move between nesting levels. To exit navigation mode and edit the selected block, press Enter.")):"edit"===e?(0,vo.speak)((0,x.__)("You are currently in edit mode. To return to the navigation mode, press Escape.")):"zoom-out"===e&&(0,vo.speak)((0,x.__)("You are currently in zoom-out mode."))},_r=(e=null)=>({dispatch:t})=>{t({type:"SET_BLOCK_MOVING_MODE",hasBlockMovingClientId:e}),e&&(0,vo.speak)((0,x.__)("Use the Tab key and Arrow keys to choose new block location. Use Left and Right Arrow keys to move between nesting levels. Once location is selected press Enter or Space to move the block."))},yr=(e,t=!0)=>({select:n,dispatch:o})=>{if(!e||!e.length)return;const r=n.getBlocksByClientId(e);if(r.some((e=>!e)))return;const l=r.map((e=>e.name));if(l.some((e=>!(0,c.hasBlockSupport)(e,"multiple",!0))))return;const i=n.getBlockRootClientId(e[0]),s=yo(e),a=n.getBlockIndex(s[s.length-1]),u=r.map((e=>(0,c.__experimentalCloneSanitizedBlock)(e)));return o.insertBlocks(u,a+1,i,t),u.length>1&&t&&o.multiSelect(u[0].clientId,u[u.length-1].clientId),u.map((e=>e.clientId))},Er=e=>({select:t,dispatch:n})=>{if(!e)return;const o=t.getBlockRootClientId(e);if(t.getTemplateLock(o))return;const r=t.getBlockIndex(e),l=o?t.getDirectInsertBlock(o):null;if(!l)return n.insertDefaultBlock({},o,r);const i={};if(l.attributesToCopy){const n=t.getBlockAttributes(e);l.attributesToCopy.forEach((e=>{n[e]&&(i[e]=n[e])}))}const s=(0,c.createBlock)(l.name,{...l.attributes,...i});return n.insertBlock(s,r,o)},wr=e=>({select:t,dispatch:n})=>{if(!e)return;const o=t.getBlockRootClientId(e);if(t.getTemplateLock(o))return;const r=t.getBlockIndex(e),l=o?t.getDirectInsertBlock(o):null;if(!l)return n.insertDefaultBlock({},o,r+1);const i={};if(l.attributesToCopy){const n=t.getBlockAttributes(e);l.attributesToCopy.forEach((e=>{n[e]&&(i[e]=n[e])}))}const s=(0,c.createBlock)(l.name,{...l.attributes,...i});return n.insertBlock(s,r+1,o)};function Sr(e,t){return{type:"TOGGLE_BLOCK_HIGHLIGHT",clientId:e,isHighlighted:t}}const Cr=e=>async({dispatch:t})=>{t(Sr(e,!0)),await new Promise((e=>setTimeout(e,150))),t(Sr(e,!1))};function xr(e,t){return{type:"SET_HAS_CONTROLLED_INNER_BLOCKS",hasControlledInnerBlocks:t,clientId:e}}function Br(e){return{type:"SET_BLOCK_VISIBILITY",updates:e}}function Ir(e,t){return{type:"SET_TEMPORARILY_EDITING_AS_BLOCKS",temporarilyEditingAsBlocks:e,focusModeToRevert:t}}const Tr=e=>({select:t,dispatch:n})=>{if(!e||"object"!=typeof e)return void console.error("Category should be an `InserterMediaCategory` object.");if(!e.name)return void console.error("Category should have a `name` that should be unique among all media categories.");if(!e.labels?.name)return void console.error("Category should have a `labels.name`.");if(!["image","audio","video"].includes(e.mediaType))return void console.error("Category should have `mediaType` property that is one of `image|audio|video`.");if(!e.fetch||"function"!=typeof e.fetch)return void console.error("Category should have a `fetch` function defined with the following signature `(InserterMediaRequest) => Promise`.");const o=t.getRegisteredInserterMediaCategories();o.some((({name:t})=>t===e.name))?console.error(`A category is already registered with the same name: "${e.name}".`):o.some((({labels:{name:t}={}})=>t===e.labels?.name))?console.error(`A category is already registered with the same labels.name: "${e.labels.name}".`):n({type:"REGISTER_INSERTER_MEDIA_CATEGORY",category:{...e,isExternalResource:!0}})};function Mr(e="",t){return{type:"SET_BLOCK_EDITING_MODE",clientId:e,mode:t}}function Pr(e=""){return{type:"UNSET_BLOCK_EDITING_MODE",clientId:e}}const Rr={reducer:U,selectors:e,actions:l},Nr=(0,d.createReduxStore)(oe,{...Rr,persist:["preferences"]}),Lr=(0,d.registerStore)(oe,{...Rr,persist:["preferences"]});function Ar(...e){const{clientId:t=null}=y();return(0,d.useSelect)((n=>ie(n(Nr)).getBlockSettings(t,...e)),[t,...e])}function Or(e){w()("wp.blockEditor.useSetting",{since:"6.5",alternative:"wp.blockEditor.useSettings",note:"The new useSettings function can retrieve multiple settings at once, with better performance."});const[t]=Ar(e);return t}ie(Lr).registerPrivateActions(t),ie(Lr).registerPrivateSelectors(r),ie(Nr).registerPrivateActions(t),ie(Nr).registerPrivateSelectors(r);const Dr="1600px",zr="320px",Vr=1,Fr=.25,Hr=.75,Gr="14px";function Ur({minimumFontSize:e,maximumFontSize:t,fontSize:n,minimumViewportWidth:o=zr,maximumViewportWidth:r=Dr,scaleFactor:l=Vr,minimumFontSizeLimit:i}){if(i=$r(i)?i:Gr,n){const o=$r(n);if(!o?.unit)return null;const r=$r(i,{coerceTo:o.unit});if(r?.value&&!e&&!t&&o?.value<=r?.value)return null;if(t||(t=`${o.value}${o.unit}`),!e){const t="px"===o.unit?o.value:16*o.value,n=Math.min(Math.max(1-.075*Math.log2(t),Fr),Hr),l=jr(o.value*n,3);e=r?.value&&l0}function Zr(e){const t=e?.typography,n=e?.layout,o=$r(n?.wideSize)?n?.wideSize:null;return Kr(t)&&o?{fluid:{maxViewportWidth:o,...t.fluid}}:{fluid:t?.fluid}}const qr="body",Yr=[{path:["color","palette"],valueKey:"color",cssVarInfix:"color",classes:[{classSuffix:"color",propertyName:"color"},{classSuffix:"background-color",propertyName:"background-color"},{classSuffix:"border-color",propertyName:"border-color"}]},{path:["color","gradients"],valueKey:"gradient",cssVarInfix:"gradient",classes:[{classSuffix:"gradient-background",propertyName:"background"}]},{path:["color","duotone"],valueKey:"colors",cssVarInfix:"duotone",valueFunc:({slug:e})=>`url( '#wp-duotone-${e}' )`,classes:[]},{path:["shadow","presets"],valueKey:"shadow",cssVarInfix:"shadow",classes:[]},{path:["typography","fontSizes"],valueFunc:(e,t)=>Wr(e,Zr(t)),valueKey:"size",cssVarInfix:"font-size",classes:[{classSuffix:"font-size",propertyName:"font-size"}]},{path:["typography","fontFamilies"],valueKey:"fontFamily",cssVarInfix:"font-family",classes:[{classSuffix:"font-family",propertyName:"font-family"}]},{path:["spacing","spacingSizes"],valueKey:"size",cssVarInfix:"spacing",valueFunc:({size:e})=>e,classes:[]}],Xr={"color.background":"color","color.text":"color","filter.duotone":"duotone","elements.link.color.text":"color","elements.link.:hover.color.text":"color","elements.link.typography.fontFamily":"font-family","elements.link.typography.fontSize":"font-size","elements.button.color.text":"color","elements.button.color.background":"color","elements.caption.color.text":"color","elements.button.typography.fontFamily":"font-family","elements.button.typography.fontSize":"font-size","elements.heading.color":"color","elements.heading.color.background":"color","elements.heading.typography.fontFamily":"font-family","elements.heading.gradient":"gradient","elements.heading.color.gradient":"gradient","elements.h1.color":"color","elements.h1.color.background":"color","elements.h1.typography.fontFamily":"font-family","elements.h1.color.gradient":"gradient","elements.h2.color":"color","elements.h2.color.background":"color","elements.h2.typography.fontFamily":"font-family","elements.h2.color.gradient":"gradient","elements.h3.color":"color","elements.h3.color.background":"color","elements.h3.typography.fontFamily":"font-family","elements.h3.color.gradient":"gradient","elements.h4.color":"color","elements.h4.color.background":"color","elements.h4.typography.fontFamily":"font-family","elements.h4.color.gradient":"gradient","elements.h5.color":"color","elements.h5.color.background":"color","elements.h5.typography.fontFamily":"font-family","elements.h5.color.gradient":"gradient","elements.h6.color":"color","elements.h6.color.background":"color","elements.h6.typography.fontFamily":"font-family","elements.h6.color.gradient":"gradient","color.gradient":"gradient",shadow:"shadow","typography.fontSize":"font-size","typography.fontFamily":"font-family"},Qr={popoverProps:{placement:"left-start",offset:259}};function Jr(e,t,n,o,r){const l=[Wn(e,["blocks",t,...n]),Wn(e,n)];for(const i of l)if(i){const l=["custom","theme","default"];for(const s of l){const l=i[s];if(l){const i=l.find((e=>e[o]===r));if(i){if("slug"===o)return i;return Jr(e,t,n,"slug",i.slug)[o]===i[o]?i:void 0}}}}}function el(e,t,n){if(!n||"string"!=typeof n){if(!n?.ref||"string"!=typeof n?.ref)return n;{const t=n.ref.split(".");if(!(n=Wn(e,t))||n?.ref)return n}}const o="var:",r="var(--wp--";let l;if(n.startsWith(o))l=n.slice(4).split("|");else{if(!n.startsWith(r)||!n.endsWith(")"))return n;l=n.slice(10,-1).split("--")}const[i,...s]=l;return"preset"===i?function(e,t,n,[o,r]){const l=Yr.find((e=>e.cssVarInfix===o));if(!l)return n;const i=Jr(e.settings,t,l.path,"slug",r);if(i){const{valueKey:n}=l;return el(e,t,i[n])}return n}(e,t,n,s):"custom"===i?function(e,t,n,o){var r;const l=null!==(r=Wn(e.settings,["blocks",t,"custom",...o]))&&void 0!==r?r:Wn(e.settings,["custom",...o]);return l?el(e,t,l):n}(e,t,n,s):n}function tl(e,t){const n=e.split(","),o=t.split(","),r=[];return n.forEach((e=>{o.forEach((t=>{r.push(`${e.trim()} ${t.trim()}`)}))})),r.join(", ")}function nl(e,t){return"object"!=typeof e||"object"!=typeof t?e===t:C()(e?.styles,t?.styles)&&C()(e?.settings,t?.settings)}const ol=(0,u.createContext)({user:{},base:{},merged:{},setUserConfig:()=>{}}),rl={settings:{},styles:{}},ll=["appearanceTools","useRootPaddingAwareAlignments","background.backgroundImage","background.backgroundRepeat","background.backgroundSize","border.color","border.radius","border.style","border.width","shadow.presets","shadow.defaultPresets","color.background","color.button","color.caption","color.custom","color.customDuotone","color.customGradient","color.defaultDuotone","color.defaultGradients","color.defaultPalette","color.duotone","color.gradients","color.heading","color.link","color.palette","color.text","custom","dimensions.aspectRatio","dimensions.minHeight","layout.contentSize","layout.definitions","layout.wideSize","lightbox.enabled","lightbox.allowEditing","position.fixed","position.sticky","spacing.customSpacingSize","spacing.spacingSizes","spacing.spacingScale","spacing.blockGap","spacing.margin","spacing.padding","spacing.units","typography.fluid","typography.customFontSize","typography.dropCap","typography.fontFamilies","typography.fontSizes","typography.fontStyle","typography.fontWeight","typography.letterSpacing","typography.lineHeight","typography.textColumns","typography.textDecoration","typography.textTransform","typography.writingMode"],il=()=>{const{user:e,setUserConfig:t}=(0,u.useContext)(ol);return[!!e&&!C()(e,rl),(0,u.useCallback)((()=>t((()=>rl))),[t])]};function sl(e,t,n="all"){const{setUserConfig:o,...r}=(0,u.useContext)(ol),l=t?".blocks."+t:"",i=e?"."+e:"",s=`settings${l}${i}`,a=`settings${i}`,c="all"===n?"merged":n;return[(0,u.useMemo)((()=>{const t=r[c];if(!t)throw"Unsupported source";var n;if(e)return null!==(n=Wn(t,s))&&void 0!==n?n:Wn(t,a);let o={};return ll.forEach((e=>{var n;const r=null!==(n=Wn(t,`settings${l}.${e}`))&&void 0!==n?n:Wn(t,`settings.${e}`);void 0!==r&&(o=jn(o,e.split("."),r))})),o}),[r,c,e,s,a,l]),e=>{o((t=>jn(t,s.split("."),e)))}]}function al(e,t,n="all",{shouldDecodeEncode:o=!0}={}){const{merged:r,base:l,user:i,setUserConfig:s}=(0,u.useContext)(ol),a=e?"."+e:"",c=t?`styles.blocks.${t}${a}`:`styles${a}`;let d,p;switch(n){case"all":d=Wn(r,c),p=o?el(r,t,d):d;break;case"user":d=Wn(i,c),p=o?el(r,t,d):d;break;case"base":d=Wn(l,c),p=o?el(l,t,d):d;break;default:throw"Unsupported source"}return[p,n=>{s((l=>jn(l,c.split("."),o?function(e,t,n,o){if(!o)return o;const r=Xr[n],l=Yr.find((e=>e.cssVarInfix===r));if(!l)return o;const{valueKey:i,path:s}=l,a=Jr(e,t,s,i,o);return a?`var:preset|${r}|${a.slug}`:o}(r.settings,t,e,n):n)))}]}function cl(e,t,n){const{supportedStyles:o,supports:r}=(0,d.useSelect)((e=>({supportedStyles:ie(e(c.store)).getSupportedStyles(t,n),supports:e(c.store).getBlockType(t)?.supports})),[t,n]);return(0,u.useMemo)((()=>{const t={...e};return o.includes("fontSize")||(t.typography={...t.typography,fontSizes:{},customFontSize:!1}),o.includes("fontFamily")||(t.typography={...t.typography,fontFamilies:{}}),t.color={...t.color,text:t.color?.text&&o.includes("color"),background:t.color?.background&&(o.includes("background")||o.includes("backgroundColor")),button:t.color?.button&&o.includes("buttonColor"),heading:t.color?.heading&&o.includes("headingColor"),link:t.color?.link&&o.includes("linkColor"),caption:t.color?.caption&&o.includes("captionColor")},o.includes("background")||(t.color.gradients=[],t.color.customGradient=!1),o.includes("filter")||(t.color.defaultDuotone=!1,t.color.customDuotone=!1),["lineHeight","fontStyle","fontWeight","letterSpacing","textTransform","textDecoration","writingMode"].forEach((e=>{o.includes(e)||(t.typography={...t.typography,[e]:!1})})),o.includes("columnCount")||(t.typography={...t.typography,textColumns:!1}),["contentSize","wideSize"].forEach((e=>{o.includes(e)||(t.layout={...t.layout,[e]:!1})})),["padding","margin","blockGap"].forEach((e=>{o.includes(e)||(t.spacing={...t.spacing,[e]:!1});const n=Array.isArray(r?.spacing?.[e])?r?.spacing?.[e]:r?.spacing?.[e]?.sides;n?.length&&t.spacing?.[e]&&(t.spacing={...t.spacing,[e]:{...t.spacing?.[e],sides:n}})})),["aspectRatio","minHeight"].forEach((e=>{o.includes(e)||(t.dimensions={...t.dimensions,[e]:!1})})),["radius","color","style","width"].forEach((e=>{o.includes("border"+e.charAt(0).toUpperCase()+e.slice(1))||(t.border={...t.border,[e]:!1})})),t.shadow=!!o.includes("shadow")&&t.shadow,t}),[e,o,r])}function ul(e){const t=e?.color?.palette?.custom,n=e?.color?.palette?.theme,o=e?.color?.palette?.default,r=e?.color?.defaultPalette;return(0,u.useMemo)((()=>{const e=[];return n&&n.length&&e.push({name:(0,x._x)("Theme","Indicates this palette comes from the theme."),colors:n}),r&&o&&o.length&&e.push({name:(0,x._x)("Default","Indicates this palette comes from WordPress."),colors:o}),t&&t.length&&e.push({name:(0,x._x)("Custom","Indicates this palette is created by the user."),colors:t}),e}),[t,n,o,r])}function dl(e){const t=e?.color?.gradients?.custom,n=e?.color?.gradients?.theme,o=e?.color?.gradients?.default,r=e?.color?.defaultGradients;return(0,u.useMemo)((()=>{const e=[];return n&&n.length&&e.push({name:(0,x._x)("Theme","Indicates this palette comes from the theme."),gradients:n}),r&&o&&o.length&&e.push({name:(0,x._x)("Default","Indicates this palette comes from WordPress."),gradients:o}),t&&t.length&&e.push({name:(0,x._x)("Custom","Indicates this palette is created by the user."),gradients:t}),e}),[t,n,o,r])}var pl=n(5755),ml=n.n(pl);const hl=e=>{if(null===e||"object"!=typeof e||Array.isArray(e))return e;const t=Object.entries(e).map((([e,t])=>[e,hl(t)])).filter((([,e])=>void 0!==e));return t.length?Object.fromEntries(t):void 0};function gl(e,t,n,o,r,l){if(Object.values(null!=e?e:{}).every((e=>!e)))return n;if(1===l.length&&n.innerBlocks.length===o.length)return n;let i=o[0]?.attributes;if(l.length>1&&o.length>1){if(!o[r])return n;i=o[r]?.attributes}let s=n;return Object.entries(e).forEach((([e,n])=>{n&&t[e].forEach((e=>{const t=Wn(i,e);t&&(s={...s,attributes:jn(s.attributes,e,t)})}))})),s}function fl(e,t,n){const o=(0,c.getBlockSupport)(e,t),r=o?.__experimentalSkipSerialization;return Array.isArray(r)?r.includes(n):r}function bl({id:e,css:t,assets:n,__unstableType:o}={}){const{setStyleOverride:r,deleteStyleOverride:l}=ie((0,d.useDispatch)(Nr)),i=(0,u.useId)();(0,u.useEffect)((()=>{if(!t&&!n)return;const s=e||i;return r(s,{id:e,css:t,assets:n,__unstableType:o}),()=>{l(s)}}),[e,t,n,o,i,r,l])}function vl(e,t){const[n,o,r,l,i,s,a,c,d,p,m,h,g,f,b,v,k,_,y,E,w,S,C,x,B,I,T,M,P,R,N,L,A,O,D,z,V,F,H,G,U,$,j,W,K,Z,q,Y,X,Q]=Ar("background.backgroundImage","background.backgroundSize","typography.fontFamilies.custom","typography.fontFamilies.default","typography.fontFamilies.theme","typography.fontSizes.custom","typography.fontSizes.default","typography.fontSizes.theme","typography.customFontSize","typography.fontStyle","typography.fontWeight","typography.lineHeight","typography.textColumns","typography.textDecoration","typography.writingMode","typography.textTransform","typography.letterSpacing","spacing.padding","spacing.margin","spacing.blockGap","spacing.spacingSizes","spacing.units","dimensions.aspectRatio","dimensions.minHeight","layout","border.color","border.radius","border.style","border.width","color.custom","color.palette.custom","color.customDuotone","color.palette.theme","color.palette.default","color.defaultPalette","color.defaultDuotone","color.duotone.custom","color.duotone.theme","color.duotone.default","color.gradients.custom","color.gradients.theme","color.gradients.default","color.defaultGradients","color.customGradient","color.background","color.link","color.text","color.heading","color.button","shadow");return cl((0,u.useMemo)((()=>({background:{backgroundImage:n,backgroundSize:o},color:{palette:{custom:N,theme:A,default:O},gradients:{custom:G,theme:U,default:$},duotone:{custom:V,theme:F,default:H},defaultGradients:j,defaultPalette:D,defaultDuotone:z,custom:R,customGradient:W,customDuotone:L,background:K,link:Z,heading:Y,button:X,text:q},typography:{fontFamilies:{custom:r,default:l,theme:i},fontSizes:{custom:s,default:a,theme:c},customFontSize:d,fontStyle:p,fontWeight:m,lineHeight:h,textColumns:g,textDecoration:f,textTransform:v,letterSpacing:k,writingMode:b},spacing:{spacingSizes:{custom:w},padding:_,margin:y,blockGap:E,units:S},border:{color:I,radius:T,style:M,width:P},dimensions:{aspectRatio:C,minHeight:x},layout:B,parentLayout:t,shadow:Q})),[n,o,r,l,i,s,a,c,d,p,m,h,g,f,v,k,b,_,y,E,w,S,C,x,B,t,I,T,M,P,R,N,L,A,O,D,z,V,F,H,G,U,$,j,W,K,Z,q,Y,X,Q]),e)}const kl=(0,u.memo)((function({index:e,useBlockProps:t,setAllWrapperProps:n,...o}){const r=t(o),l=t=>n((n=>{const o=[...n];return o[e]=t,o}));return(0,u.useEffect)((()=>(l(r),()=>{l(void 0)}))),null}));(0,m.addFilter)("blocks.registerBlockType","core/compat/migrateLightBlockWrapper",(function(e){const{apiVersion:t=1}=e;return t<2&&(0,c.hasBlockSupport)(e,"lightBlockWrapper",!1)&&(e.apiVersion=2),e}));const _l=window.wp.components,yl={default:(0,_l.createSlotFill)("BlockControls"),block:(0,_l.createSlotFill)("BlockControlsBlock"),inline:(0,_l.createSlotFill)("BlockFormatControls"),other:(0,_l.createSlotFill)("BlockControlsOther"),parent:(0,_l.createSlotFill)("BlockControlsParent")};function El({group:e="default",controls:t,children:n,__experimentalShareWithChildBlocks:o=!1}){const r=function(e,t){const n=y();return n[h]?yl[e]?.Fill:n[g]&&t?yl.parent.Fill:null}(e,o);if(!r)return null;const l=(0,s.createElement)(s.Fragment,null,"default"===e&&(0,s.createElement)(_l.ToolbarGroup,{controls:t}),n);return(0,s.createElement)(_l.__experimentalStyleProvider,{document},(0,s.createElement)(r,null,(e=>{const{forwardedContext:t=[]}=e;return t.reduce(((e,[t,n])=>(0,s.createElement)(t,{...n},e)),l)})))}window.wp.warning;const{ComponentsContext:wl}=ie(_l.privateApis);function Sl({group:e="default",...t}){const n=(0,u.useContext)(_l.__experimentalToolbarContext),o=(0,u.useContext)(wl),r=(0,u.useMemo)((()=>({forwardedContext:[[_l.__experimentalToolbarContext.Provider,{value:n}],[wl.Provider,{value:o}]]})),[n,o]),l=yl[e]?.Slot,i=(0,_l.__experimentalUseSlotFills)(l?.__unstableName);if(!l)return null;if(!i?.length)return null;const a=(0,s.createElement)(l,{...t,bubblesVirtually:!0,fillProps:r});return"default"===e?a:(0,s.createElement)(_l.ToolbarGroup,null,a)}const Cl=El;Cl.Slot=Sl;const xl=e=>(0,s.createElement)(El,{group:"inline",...e});xl.Slot=e=>(0,s.createElement)(Sl,{group:"inline",...e});const Bl=Cl,Il=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M9 9v6h11V9H9zM4 20h1.5V4H4v16z"})),Tl=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M12.5 15v5H11v-5H4V9h7V4h1.5v5h7v6h-7Z"})),Ml=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M4 15h11V9H4v6zM18.5 4v16H20V4h-1.5z"})),Pl=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M9 15h6V9H9v6zm-5 5h1.5V4H4v16zM18.5 4v16H20V4h-1.5z"})),Rl=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M4 4H5.5V20H4V4ZM7 10L17 10V14L7 14V10ZM20 4H18.5V20H20V4Z"})),Nl=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z"})),Ll=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z"})),Al={default:{name:"default",slug:"flow",className:"is-layout-flow",baseStyles:[{selector:" > .alignleft",rules:{float:"left","margin-inline-start":"0","margin-inline-end":"2em"}},{selector:" > .alignright",rules:{float:"right","margin-inline-start":"2em","margin-inline-end":"0"}},{selector:" > .aligncenter",rules:{"margin-left":"auto !important","margin-right":"auto !important"}}],spacingStyles:[{selector:" > :first-child:first-child",rules:{"margin-block-start":"0"}},{selector:" > :last-child:last-child",rules:{"margin-block-end":"0"}},{selector:" > *",rules:{"margin-block-start":null,"margin-block-end":"0"}}]},constrained:{name:"constrained",slug:"constrained",className:"is-layout-constrained",baseStyles:[{selector:" > .alignleft",rules:{float:"left","margin-inline-start":"0","margin-inline-end":"2em"}},{selector:" > .alignright",rules:{float:"right","margin-inline-start":"2em","margin-inline-end":"0"}},{selector:" > .aligncenter",rules:{"margin-left":"auto !important","margin-right":"auto !important"}},{selector:" > :where(:not(.alignleft):not(.alignright):not(.alignfull))",rules:{"max-width":"var(--wp--style--global--content-size)","margin-left":"auto !important","margin-right":"auto !important"}},{selector:" > .alignwide",rules:{"max-width":"var(--wp--style--global--wide-size)"}}],spacingStyles:[{selector:" > :first-child:first-child",rules:{"margin-block-start":"0"}},{selector:" > :last-child:last-child",rules:{"margin-block-end":"0"}},{selector:" > *",rules:{"margin-block-start":null,"margin-block-end":"0"}}]},flex:{name:"flex",slug:"flex",className:"is-layout-flex",displayMode:"flex",baseStyles:[{selector:"",rules:{"flex-wrap":"wrap","align-items":"center"}},{selector:" > *",rules:{margin:"0"}}],spacingStyles:[{selector:"",rules:{gap:null}}]},grid:{name:"grid",slug:"grid",className:"is-layout-grid",displayMode:"grid",baseStyles:[{selector:" > *",rules:{margin:"0"}}],spacingStyles:[{selector:"",rules:{gap:null}}]}};function Ol(e,t=""){return e.split(",").map((e=>`.editor-styles-wrapper ${e}${t?` ${t}`:""}`)).join(",")}function Dl(e,t=Al,n,o){let r="";return t?.[n]?.spacingStyles?.length&&o&&t[n].spacingStyles.forEach((t=>{r+=`${Ol(e,t.selector.trim())} { `,r+=Object.entries(t.rules).map((([e,t])=>`${e}: ${t||o}`)).join("; "),r+="; }"})),r}function zl(e){const{contentSize:t,wideSize:n,type:o="default"}=e,r={},l=/^(?!0)\d+(px|em|rem|vw|vh|%|svw|lvw|dvw|svh|lvh|dvh|vi|svi|lvi|dvi|vb|svb|lvb|dvb|vmin|svmin|lvmin|dvmin|vmax|svmax|lvmax|dvmax)?$/i;return l.test(t)&&"constrained"===o&&(r.none=(0,x.sprintf)((0,x.__)("Max %s wide"),t)),l.test(n)&&(r.wide=(0,x.sprintf)((0,x.__)("Max %s wide"),n)),r}const Vl=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z"})),Fl=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z",style:{opacity:.25}}),(0,s.createElement)(Z.Path,{d:"m4.5 7.5v9h1.5v-9z"}),(0,s.createElement)(Z.Path,{d:"m18 7.5v9h1.5v-9z"})),Hl=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z",style:{opacity:.25}}),(0,s.createElement)(Z.Path,{d:"m7.5 6h9v-1.5h-9z"}),(0,s.createElement)(Z.Path,{d:"m7.5 19.5h9v-1.5h-9z"})),Gl=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z",style:{opacity:.25}}),(0,s.createElement)(Z.Path,{d:"m16.5 6h-9v-1.5h9z"})),Ul=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z",style:{opacity:.25}}),(0,s.createElement)(Z.Path,{d:"m18 16.5v-9h1.5v9z"})),$l=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z",style:{opacity:.25}}),(0,s.createElement)(Z.Path,{d:"m16.5 19.5h-9v-1.5h9z",style:{fill:"#1e1e1e"}})),jl=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z",style:{opacity:.25}}),(0,s.createElement)(Z.Path,{d:"m4.5 16.5v-9h1.5v9z"})),Wl=["top","right","bottom","left"],Kl={top:void 0,right:void 0,bottom:void 0,left:void 0},Zl={custom:Vl,axial:Vl,horizontal:Fl,vertical:Hl,top:Gl,right:Ul,bottom:$l,left:jl},ql={default:(0,x.__)("Spacing control"),top:(0,x.__)("Top"),bottom:(0,x.__)("Bottom"),left:(0,x.__)("Left"),right:(0,x.__)("Right"),mixed:(0,x.__)("Mixed"),vertical:(0,x.__)("Vertical"),horizontal:(0,x.__)("Horizontal"),axial:(0,x.__)("Horizontal & vertical"),custom:(0,x.__)("Custom")},Yl={axial:"axial",top:"top",right:"right",bottom:"bottom",left:"left",custom:"custom"};function Xl(e){return!!e?.includes&&("0"===e||e.includes("var:preset|spacing|"))}function Ql(e,t){if(!Xl(e))return e;const n=ti(e),o=t.find((e=>String(e.slug)===n));return o?.size}function Jl(e,t){if(!e||Xl(e)||"0"===e)return e;const n=t.find((t=>String(t.size)===String(e)));return n?.slug?`var:preset|spacing|${n.slug}`:e}function ei(e){if(!e)return;const t=e.match(/var:preset\|spacing\|(.+)/);return t?`var(--wp--preset--spacing--${t[1]})`:e}function ti(e){if(!e)return;if("0"===e||"default"===e)return e;const t=e.match(/var:preset\|spacing\|(.+)/);return t?t[1]:void 0}function ni(e,t){if(!e||!e.length)return!1;const n=e.includes("horizontal")||e.includes("left")&&e.includes("right"),o=e.includes("vertical")||e.includes("top")&&e.includes("bottom");return"horizontal"===t?n:"vertical"===t?o:n||o}function oi(e,t="0"){const n=function(e){if(!e)return null;const t="string"==typeof e;return{top:t?e:e?.top,left:t?e:e?.left}}(e);if(!n)return null;const o=ei(n?.top)||t,r=ei(n?.left)||t;return o===r?o:`${o} ${r}`}const ri=(0,s.createElement)(_l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(_l.Path,{d:"M15 4H9v11h6V4zM4 18.5V20h16v-1.5H4z"})),li=(0,s.createElement)(_l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(_l.Path,{d:"M20 11h-5V4H9v7H4v1.5h5V20h6v-7.5h5z"})),ii=(0,s.createElement)(_l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(_l.Path,{d:"M9 20h6V9H9v11zM4 4v1.5h16V4H4z"})),si=(0,s.createElement)(_l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(_l.Path,{d:"M4 4L20 4L20 5.5L4 5.5L4 4ZM10 7L14 7L14 17L10 17L10 7ZM20 18.5L4 18.5L4 20L20 20L20 18.5Z"})),ai=(0,s.createElement)(_l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(_l.Path,{d:"M7 4H17V8L7 8V4ZM7 16L17 16V20L7 20V16ZM20 11.25H4V12.75H20V11.25Z"})),ci={top:{icon:ii,title:(0,x._x)("Align top","Block vertical alignment setting")},center:{icon:li,title:(0,x._x)("Align middle","Block vertical alignment setting")},bottom:{icon:ri,title:(0,x._x)("Align bottom","Block vertical alignment setting")},stretch:{icon:si,title:(0,x._x)("Stretch to fill","Block vertical alignment setting")},"space-between":{icon:ai,title:(0,x._x)("Space between","Block vertical alignment setting")}},ui=["top","center","bottom"];const di=function({value:e,onChange:t,controls:n=ui,isCollapsed:o=!0,isToolbar:r}){function l(n){return()=>t(e===n?void 0:n)}const i=ci[e],a=ci.top,c=r?_l.ToolbarGroup:_l.ToolbarDropdownMenu,u=r?{isCollapsed:o}:{};return(0,s.createElement)(c,{icon:i?i.icon:a.icon,label:(0,x._x)("Change vertical alignment","Block vertical alignment setting label"),controls:n.map((t=>({...ci[t],isActive:e===t,role:o?"menuitemradio":void 0,onClick:l(t)}))),...u})},pi=e=>(0,s.createElement)(di,{...e,isToolbar:!1}),mi=e=>(0,s.createElement)(di,{...e,isToolbar:!0}),hi={left:Il,center:Tl,right:Ml,"space-between":Pl,stretch:Rl};const gi=function({allowedControls:e=["left","center","right","space-between"],isCollapsed:t=!0,onChange:n,value:o,popoverProps:r,isToolbar:l}){const i=e=>{n(e===o?void 0:e)},a=o?hi[o]:hi.left,c=[{name:"left",icon:Il,title:(0,x.__)("Justify items left"),isActive:"left"===o,onClick:()=>i("left")},{name:"center",icon:Tl,title:(0,x.__)("Justify items center"),isActive:"center"===o,onClick:()=>i("center")},{name:"right",icon:Ml,title:(0,x.__)("Justify items right"),isActive:"right"===o,onClick:()=>i("right")},{name:"space-between",icon:Pl,title:(0,x.__)("Space between items"),isActive:"space-between"===o,onClick:()=>i("space-between")},{name:"stretch",icon:Rl,title:(0,x.__)("Stretch items"),isActive:"stretch"===o,onClick:()=>i("stretch")}],u=l?_l.ToolbarGroup:_l.ToolbarDropdownMenu,d=l?{isCollapsed:t}:{};return(0,s.createElement)(u,{icon:a,popoverProps:r,label:(0,x.__)("Change items justification"),controls:c.filter((t=>e.includes(t.name))),...d})},fi=e=>(0,s.createElement)(gi,{...e,isToolbar:!1}),bi=e=>(0,s.createElement)(gi,{...e,isToolbar:!0}),vi={left:"flex-start",right:"flex-end",center:"center","space-between":"space-between"},ki={left:"flex-start",right:"flex-end",center:"center",stretch:"stretch"},_i={top:"flex-start",center:"center",bottom:"flex-end",stretch:"stretch","space-between":"space-between"},yi=["wrap","nowrap"],Ei={name:"flex",label:(0,x.__)("Flex"),inspectorControls:function({layout:e={},onChange:t,layoutBlockSupport:n={}}){const{allowOrientation:o=!0}=n;return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.Flex,null,(0,s.createElement)(_l.FlexItem,null,(0,s.createElement)(Ci,{layout:e,onChange:t})),(0,s.createElement)(_l.FlexItem,null,o&&(0,s.createElement)(Bi,{layout:e,onChange:t}))),(0,s.createElement)(xi,{layout:e,onChange:t}))},toolBarControls:function({layout:e={},onChange:t,layoutBlockSupport:n}){if(n?.allowSwitching)return null;const{allowVerticalAlignment:o=!0}=n;return(0,s.createElement)(Bl,{group:"block",__experimentalShareWithChildBlocks:!0},(0,s.createElement)(Ci,{layout:e,onChange:t,isToolbar:!0}),o&&(0,s.createElement)(wi,{layout:e,onChange:t,isToolbar:!0}))},getLayoutStyle:function({selector:e,layout:t,style:n,blockName:o,hasBlockGapSupport:r,layoutDefinitions:l=Al}){const{orientation:i="horizontal"}=t,s=n?.spacing?.blockGap&&!fl(o,"spacing","blockGap")?oi(n?.spacing?.blockGap,"0.5em"):void 0,a=vi[t.justifyContent],c=yi.includes(t.flexWrap)?t.flexWrap:"wrap",u=_i[t.verticalAlignment],d=ki[t.justifyContent]||ki.left;let p="";const m=[];return c&&"wrap"!==c&&m.push(`flex-wrap: ${c}`),"horizontal"===i?(u&&m.push(`align-items: ${u}`),a&&m.push(`justify-content: ${a}`)):(u&&m.push(`justify-content: ${u}`),m.push("flex-direction: column"),m.push(`align-items: ${d}`)),m.length&&(p=`${Ol(e)} {\n\t\t\t\t${m.join("; ")};\n\t\t\t}`),r&&s&&(p+=Dl(e,l,"flex",s)),p},getOrientation(e){const{orientation:t="horizontal"}=e;return t},getAlignments:()=>[]};function wi({layout:e,onChange:t,isToolbar:n=!1}){const{orientation:o="horizontal"}=e,r="horizontal"===o?_i.center:_i.top,{verticalAlignment:l=r}=e,i=n=>{t({...e,verticalAlignment:n})};if(n)return(0,s.createElement)(pi,{onChange:i,value:l,controls:"horizontal"===o?["top","center","bottom","stretch"]:["top","center","bottom","space-between"]});const a=[{value:"flex-start",label:(0,x.__)("Align items top")},{value:"center",label:(0,x.__)("Align items center")},{value:"flex-end",label:(0,x.__)("Align items bottom")}];return(0,s.createElement)("fieldset",{className:"block-editor-hooks__flex-layout-vertical-alignment-control"},(0,s.createElement)("legend",null,(0,x.__)("Vertical alignment")),(0,s.createElement)("div",null,a.map(((e,t,n)=>(0,s.createElement)(_l.Button,{key:e,label:n,icon:t,isPressed:l===e,onClick:()=>i(e)})))))}const Si={placement:"bottom-start"};function Ci({layout:e,onChange:t,isToolbar:n=!1}){const{justifyContent:o="left",orientation:r="horizontal"}=e,l=n=>{t({...e,justifyContent:n})},i=["left","center","right"];if("horizontal"===r?i.push("space-between"):i.push("stretch"),n)return(0,s.createElement)(fi,{allowedControls:i,value:o,onChange:l,popoverProps:Si});const a=[{value:"left",icon:Il,label:(0,x.__)("Justify items left")},{value:"center",icon:Tl,label:(0,x.__)("Justify items center")},{value:"right",icon:Ml,label:(0,x.__)("Justify items right")}];return"horizontal"===r?a.push({value:"space-between",icon:Pl,label:(0,x.__)("Space between items")}):a.push({value:"stretch",icon:Rl,label:(0,x.__)("Stretch items")}),(0,s.createElement)(_l.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Justification"),value:o,onChange:l,className:"block-editor-hooks__flex-layout-justification-controls"},a.map((({value:e,icon:t,label:n})=>(0,s.createElement)(_l.__experimentalToggleGroupControlOptionIcon,{key:e,value:e,icon:t,label:n}))))}function xi({layout:e,onChange:t}){const{flexWrap:n="wrap"}=e;return(0,s.createElement)(_l.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Allow to wrap to multiple lines"),onChange:n=>{t({...e,flexWrap:n?"wrap":"nowrap"})},checked:"wrap"===n})}function Bi({layout:e,onChange:t}){const{orientation:n="horizontal",verticalAlignment:o,justifyContent:r}=e;return(0,s.createElement)(_l.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,className:"block-editor-hooks__flex-layout-orientation-controls",label:(0,x.__)("Orientation"),value:n,onChange:n=>{let l=o,i=r;return"horizontal"===n?("space-between"===o&&(l="center"),"stretch"===r&&(i="left")):("stretch"===o&&(l="top"),"space-between"===r&&(i="left")),t({...e,orientation:n,verticalAlignment:l,justifyContent:i})}},(0,s.createElement)(_l.__experimentalToggleGroupControlOptionIcon,{icon:Nl,value:"horizontal",label:(0,x.__)("Horizontal")}),(0,s.createElement)(_l.__experimentalToggleGroupControlOptionIcon,{icon:Ll,value:"vertical",label:(0,x.__)("Vertical")}))}const Ii={name:"default",label:(0,x.__)("Flow"),inspectorControls:function(){return null},toolBarControls:function(){return null},getLayoutStyle:function({selector:e,style:t,blockName:n,hasBlockGapSupport:o,layoutDefinitions:r=Al}){const l=oi(t?.spacing?.blockGap);let i="";fl(n,"spacing","blockGap")||(l?.top?i=oi(l?.top):"string"==typeof l&&(i=oi(l)));let s="";return o&&i&&(s+=Dl(e,r,"default",i)),s},getOrientation:()=>"vertical",getAlignments(e,t){const n=zl(e);if(void 0!==e.alignments)return e.alignments.includes("none")||e.alignments.unshift("none"),e.alignments.map((e=>({name:e,info:n[e]})));const o=[{name:"left"},{name:"center"},{name:"right"}];if(!t){const{contentSize:t,wideSize:r}=e;t&&o.unshift({name:"full"}),r&&o.unshift({name:"wide",info:n.wide})}return o.unshift({name:"none",info:n.none}),o}};const Ti=(0,u.forwardRef)((function({icon:e,size:t=24,...n},o){return(0,u.cloneElement)(e,{width:t,height:t,...n,ref:o})})),Mi=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM7 9h10v6H7V9Z"})),Pi=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M16 5.5H8V4h8v1.5ZM16 20H8v-1.5h8V20ZM5 9h14v6H5V9Z"})),Ri=window.wp.styleEngine,Ni={name:"constrained",label:(0,x.__)("Constrained"),inspectorControls:function({layout:e,onChange:t,layoutBlockSupport:n={}}){const{wideSize:o,contentSize:r,justifyContent:l="center"}=e,{allowJustification:i=!0,allowCustomContentAndWideSize:a=!0}=n,c=[{value:"left",icon:Il,label:(0,x.__)("Justify items left")},{value:"center",icon:Tl,label:(0,x.__)("Justify items center")},{value:"right",icon:Ml,label:(0,x.__)("Justify items right")}],[u]=Ar("spacing.units"),d=(0,_l.__experimentalUseCustomUnits)({availableUnits:u||["%","px","em","rem","vw"]});return(0,s.createElement)(s.Fragment,null,a&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)("div",{className:"block-editor-hooks__layout-controls"},(0,s.createElement)("div",{className:"block-editor-hooks__layout-controls-unit"},(0,s.createElement)(_l.__experimentalUnitControl,{className:"block-editor-hooks__layout-controls-unit-input",label:(0,x.__)("Content"),labelPosition:"top",__unstableInputWidth:"80px",value:r||o||"",onChange:n=>{n=0>parseFloat(n)?"0":n,t({...e,contentSize:n})},units:d}),(0,s.createElement)(Ti,{icon:Mi})),(0,s.createElement)("div",{className:"block-editor-hooks__layout-controls-unit"},(0,s.createElement)(_l.__experimentalUnitControl,{className:"block-editor-hooks__layout-controls-unit-input",label:(0,x.__)("Wide"),labelPosition:"top",__unstableInputWidth:"80px",value:o||r||"",onChange:n=>{n=0>parseFloat(n)?"0":n,t({...e,wideSize:n})},units:d}),(0,s.createElement)(Ti,{icon:Pi}))),(0,s.createElement)("p",{className:"block-editor-hooks__layout-controls-helptext"},(0,x.__)("Customize the width for all elements that are assigned to the center or wide columns."))),i&&(0,s.createElement)(_l.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Justification"),value:l,onChange:n=>{t({...e,justifyContent:n})}},c.map((({value:e,icon:t,label:n})=>(0,s.createElement)(_l.__experimentalToggleGroupControlOptionIcon,{key:e,value:e,icon:t,label:n})))))},toolBarControls:function(){return null},getLayoutStyle:function({selector:e,layout:t={},style:n,blockName:o,hasBlockGapSupport:r,layoutDefinitions:l=Al}){const{contentSize:i,wideSize:s,justifyContent:a}=t,c=oi(n?.spacing?.blockGap);let u="";fl(o,"spacing","blockGap")||(c?.top?u=oi(c?.top):"string"==typeof c&&(u=oi(c)));const d="left"===a?"0 !important":"auto !important",p="right"===a?"0 !important":"auto !important";let m=i||s?`\n\t\t\t\t\t${Ol(e,"> :where(:not(.alignleft):not(.alignright):not(.alignfull))")} {\n\t\t\t\t\t\tmax-width: ${null!=i?i:s};\n\t\t\t\t\t\tmargin-left: ${d};\n\t\t\t\t\t\tmargin-right: ${p};\n\t\t\t\t\t}\n\t\t\t\t\t${Ol(e,"> .alignwide")} {\n\t\t\t\t\t\tmax-width: ${null!=s?s:i};\n\t\t\t\t\t}\n\t\t\t\t\t${Ol(e,"> .alignfull")} {\n\t\t\t\t\t\tmax-width: none;\n\t\t\t\t\t}\n\t\t\t\t`:"";if("left"===a?m+=`${Ol(e,"> :where(:not(.alignleft):not(.alignright):not(.alignfull))")}\n\t\t\t{ margin-left: ${d}; }`:"right"===a&&(m+=`${Ol(e,"> :where(:not(.alignleft):not(.alignright):not(.alignfull))")}\n\t\t\t{ margin-right: ${p}; }`),n?.spacing?.padding){(0,Ri.getCSSRules)(n).forEach((t=>{"paddingRight"===t.key?m+=`\n\t\t\t\t\t${Ol(e,"> .alignfull")} {\n\t\t\t\t\t\tmargin-right: calc(${t.value} * -1);\n\t\t\t\t\t}\n\t\t\t\t\t`:"paddingLeft"===t.key&&(m+=`\n\t\t\t\t\t${Ol(e,"> .alignfull")} {\n\t\t\t\t\t\tmargin-left: calc(${t.value} * -1);\n\t\t\t\t\t}\n\t\t\t\t\t`)}))}return r&&u&&(m+=Dl(e,l,"constrained",u)),m},getOrientation:()=>"vertical",getAlignments(e){const t=zl(e);if(void 0!==e.alignments)return e.alignments.includes("none")||e.alignments.unshift("none"),e.alignments.map((e=>({name:e,info:t[e]})));const{contentSize:n,wideSize:o}=e,r=[{name:"left"},{name:"center"},{name:"right"}];return n&&r.unshift({name:"full"}),o&&r.unshift({name:"wide",info:t.wide}),r.unshift({name:"none",info:t.none}),r}},Li={px:600,"%":100,vw:100,vh:100,em:38,rem:38,svw:100,lvw:100,dvw:100,svh:100,lvh:100,dvh:100,vi:100,svi:100,lvi:100,dvi:100,vb:100,svb:100,lvb:100,dvb:100,vmin:100,svmin:100,lvmin:100,dvmin:100,vmax:100,svmax:100,lvmax:100,dvmax:100},Ai={name:"grid",label:(0,x.__)("Grid"),inspectorControls:function({layout:e={},onChange:t}){return e?.columnCount?(0,s.createElement)(Di,{layout:e,onChange:t}):(0,s.createElement)(Oi,{layout:e,onChange:t})},toolBarControls:function(){return null},getLayoutStyle:function({selector:e,layout:t,style:n,blockName:o,hasBlockGapSupport:r,layoutDefinitions:l=Al}){const{minimumColumnWidth:i="12rem",columnCount:s=null}=t,a=n?.spacing?.blockGap&&!fl(o,"spacing","blockGap")?oi(n?.spacing?.blockGap,"0.5em"):void 0;let c="";const u=[];return s?u.push(`grid-template-columns: repeat(${s}, minmax(0, 1fr))`):i&&u.push(`grid-template-columns: repeat(auto-fill, minmax(min(${i}, 100%), 1fr))`),u.length&&(c=`${Ol(e)} { ${u.join("; ")}; }`),r&&a&&(c+=Dl(e,l,"grid",a)),c},getOrientation:()=>"horizontal",getAlignments:()=>[]};function Oi({layout:e,onChange:t}){const{minimumColumnWidth:n="12rem"}=e,[o,r]=(0,_l.__experimentalParseQuantityAndUnitFromRawValue)(n);return(0,s.createElement)("fieldset",null,(0,s.createElement)(_l.BaseControl.VisualLabel,{as:"legend"},(0,x.__)("Minimum column width")),(0,s.createElement)(_l.Flex,{gap:4},(0,s.createElement)(_l.FlexItem,{isBlock:!0},(0,s.createElement)(_l.__experimentalUnitControl,{size:"__unstable-large",onChange:n=>{t({...e,minimumColumnWidth:n})},onUnitChange:n=>{let l;["em","rem"].includes(n)&&"px"===r?l=(o/16).toFixed(2)+n:["em","rem"].includes(r)&&"px"===n?l=Math.round(16*o)+n:["vh","vw","%","svw","lvw","dvw","svh","lvh","dvh","vi","svi","lvi","dvi","vb","svb","lvb","dvb","vmin","svmin","lvmin","dvmin","vmax","svmax","lvmax","dvmax"].includes(n)&&o>100&&(l=100+n),t({...e,minimumColumnWidth:l})},value:n,min:0})),(0,s.createElement)(_l.FlexItem,{isBlock:!0},(0,s.createElement)(_l.RangeControl,{onChange:n=>{t({...e,minimumColumnWidth:[n,r].join("")})},value:o,min:0,max:Li[r]||600,withInputField:!1}))))}function Di({layout:e,onChange:t}){const{columnCount:n=3}=e;return(0,s.createElement)(_l.RangeControl,{label:(0,x.__)("Columns"),value:n,onChange:n=>t({...e,columnCount:n}),min:1,max:6})}const zi=[Ii,Ei,Ni,Ai];function Vi(e="default"){return zi.find((t=>t.name===e))}const Fi={type:"default"},Hi=(0,u.createContext)(Fi),Gi=Hi.Provider;function Ui(){return(0,u.useContext)(Hi)}const $i=[],ji=["none","left","center","right","wide","full"],Wi=["wide","full"];function Ki(e=ji){e.includes("none")||(e=["none",...e]);const t=1===e.length&&"none"===e[0],[n,o,r]=(0,d.useSelect)((e=>{var n;if(t)return[!1,!1,!1];const o=e(Nr).getSettings();return[null!==(n=o.alignWide)&&void 0!==n&&n,o.supportsLayout,o.__unstableIsBlockBasedTheme]}),[t]),l=Ui();if(t)return $i;const i=Vi(l?.type);if(o){const t=i.getAlignments(l,r).filter((t=>e.includes(t.name)));return 1===t.length&&"none"===t[0].name?$i:t}if("default"!==i.name&&"constrained"!==i.name)return $i;const s=e.filter((e=>l.alignments?l.alignments.includes(e):!(!n&&Wi.includes(e))&&ji.includes(e))).map((e=>({name:e})));return 1===s.length&&"none"===s[0].name?$i:s}const Zi=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM5 9h14v6H5V9Z"})),qi=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M5 5.5h8V4H5v1.5ZM5 20h8v-1.5H5V20ZM19 9H5v6h14V9Z"})),Yi=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M19 5.5h-8V4h8v1.5ZM19 20h-8v-1.5h8V20ZM5 9h14v6H5V9Z"})),Xi=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M5 4h14v11H5V4Zm11 16H8v-1.5h8V20Z"})),Qi={none:{icon:Zi,title:(0,x._x)("None","Alignment option")},left:{icon:qi,title:(0,x.__)("Align left")},center:{icon:Mi,title:(0,x.__)("Align center")},right:{icon:Yi,title:(0,x.__)("Align right")},wide:{icon:Pi,title:(0,x.__)("Wide width")},full:{icon:Xi,title:(0,x.__)("Full width")}};const Ji=function({value:e,onChange:t,controls:n,isToolbar:o,isCollapsed:r=!0}){const l=Ki(n);if(!!!l.length)return null;function i(n){t([e,"none"].includes(n)?void 0:n)}const a=Qi[e],c=Qi.none,u=o?_l.ToolbarGroup:_l.ToolbarDropdownMenu,d={icon:a?a.icon:c.icon,label:(0,x.__)("Align")},p=o?{isCollapsed:r,controls:l.map((({name:t})=>({...Qi[t],isActive:e===t||!e&&"none"===t,role:r?"menuitemradio":void 0,onClick:()=>i(t)})))}:{toggleProps:{describedBy:(0,x.__)("Change alignment")},children:({onClose:t})=>(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.MenuGroup,{className:"block-editor-block-alignment-control__menu-group"},l.map((({name:n,info:o})=>{const{icon:r,title:l}=Qi[n],a=n===e||!e&&"none"===n;return(0,s.createElement)(_l.MenuItem,{key:n,icon:r,iconPosition:"left",className:ml()("components-dropdown-menu__menu-item",{"is-active":a}),isSelected:a,onClick:()=>{i(n),t()},role:"menuitemradio",info:o},l)}))))};return(0,s.createElement)(u,{...d,...p})},es=e=>(0,s.createElement)(Ji,{...e,isToolbar:!1}),ts=e=>(0,s.createElement)(Ji,{...e,isToolbar:!0});function ns(e){const t=y(),{clientId:n=""}=t,{setBlockEditingMode:o,unsetBlockEditingMode:r}=(0,d.useDispatch)(Nr),l=(0,d.useSelect)((e=>n?null:e(Nr).getBlockEditingMode()),[n]);return(0,u.useEffect)((()=>(e&&o(n,e),()=>{e&&r(n)})),[n,e,o,r]),n?t[f]:l}const os=["left","center","right","wide","full"],rs=["wide","full"];function ls(e,t=!0,n=!0){let o;return o=Array.isArray(e)?os.filter((t=>e.includes(t))):!0===e?[...os]:[],!n||!0===e&&!t?o.filter((e=>!rs.includes(e))):o}const is={shareWithChildBlocks:!0,edit:function({name:e,align:t,setAttributes:n}){const o=Ki(ls((0,c.getBlockSupport)(e,"align"),(0,c.hasBlockSupport)(e,"alignWide",!0))).map((({name:e})=>e)),r=ns();return o.length&&"default"===r?(0,s.createElement)(Bl,{group:"block",__experimentalShareWithChildBlocks:!0},(0,s.createElement)(es,{value:t,onChange:t=>{if(!t){const n=(0,c.getBlockType)(e),o=n?.attributes?.align?.default;o&&(t="")}n({align:t})},controls:o})):null},useBlockProps:function({name:e,align:t}){const n=ls((0,c.getBlockSupport)(e,"align"),(0,c.hasBlockSupport)(e,"alignWide",!0));if(Ki(n).some((e=>e.name===t)))return{"data-align":t};return{}},addSaveProps:function(e,t,n){const{align:o}=n,r=(0,c.getBlockSupport)(t,"align"),l=(0,c.hasBlockSupport)(t,"alignWide",!0),i=ls(r,l).includes(o);i&&(e.className=ml()(`align${o}`,e.className));return e},attributeKeys:["align"],hasSupport:e=>(0,c.hasBlockSupport)(e,"align",!1)};(0,m.addFilter)("blocks.registerBlockType","core/editor/align/addAttribute",(function(e){var t;return"type"in(null!==(t=e.attributes?.align)&&void 0!==t?t:{})||(0,c.hasBlockSupport)(e,"align")&&(e.attributes={...e.attributes,align:{type:"string",enum:[...os,""]}}),e})),(0,m.addFilter)("blocks.registerBlockType","core/lock/addAttribute",(function(e){var t;return"type"in(null!==(t=e.attributes?.lock)&&void 0!==t?t:{})||(e.attributes={...e.attributes,lock:{type:"object"}}),e}));const ss=(0,_l.createSlotFill)("InspectorControls"),as=(0,_l.createSlotFill)("InspectorAdvancedControls"),cs=(0,_l.createSlotFill)("InspectorControlsBackground"),us=(0,_l.createSlotFill)("InspectorControlsBorder"),ds=(0,_l.createSlotFill)("InspectorControlsColor"),ps=(0,_l.createSlotFill)("InspectorControlsFilter"),ms=(0,_l.createSlotFill)("InspectorControlsDimensions"),hs=(0,_l.createSlotFill)("InspectorControlsPosition"),gs=(0,_l.createSlotFill)("InspectorControlsTypography"),fs=(0,_l.createSlotFill)("InspectorControlsListView"),bs=(0,_l.createSlotFill)("InspectorControlsStyles"),vs={default:ss,advanced:as,background:cs,border:us,color:ds,dimensions:ms,effects:(0,_l.createSlotFill)("InspectorControlsEffects"),filter:ps,list:fs,position:hs,settings:ss,styles:bs,typography:gs};function ks({children:e,group:t="default",__experimentalGroup:n,resetAllFilter:o}){n&&(w()("`__experimentalGroup` property in `InspectorControlsFill`",{since:"6.2",version:"6.4",alternative:"`group`"}),t=n);const r=y(),l=vs[t]?.Fill;return l&&r[h]?(0,s.createElement)(_l.__experimentalStyleProvider,{document},(0,s.createElement)(l,null,(t=>(0,s.createElement)(ys,{fillProps:t,children:e,resetAllFilter:o})))):null}function _s({resetAllFilter:e,children:t}){const{registerResetAllFilter:n,deregisterResetAllFilter:o}=(0,u.useContext)(_l.__experimentalToolsPanelContext);return(0,u.useEffect)((()=>{if(e&&n&&o)return n(e),()=>{o(e)}}),[e,n,o]),t}function ys({children:e,resetAllFilter:t,fillProps:n}){const{forwardedContext:o=[]}=n,r=(0,s.createElement)(_s,{resetAllFilter:t},e);return o.reduce(((e,[t,n])=>(0,s.createElement)(t,{...n},e)),r)}function Es({children:e,group:t,label:n}){const{updateBlockAttributes:o}=(0,d.useDispatch)(Nr),{getBlockAttributes:r,getMultiSelectedBlockClientIds:l,getSelectedBlockClientId:i,hasMultiSelection:a}=(0,d.useSelect)(Nr),c=i(),p=(0,u.useCallback)(((e=[])=>{const t={},n=a()?l():[c];n.forEach((n=>{const{style:o}=r(n);let l={style:o};e.forEach((e=>{l={...l,...e(l)}})),l={...l,style:hl(l.style)},t[n]=l})),o(n,t,!0)}),[r,l,a,c,o]);return(0,s.createElement)(_l.__experimentalToolsPanel,{className:`${t}-block-support-panel`,label:n,resetAll:p,key:c,panelId:c,hasInnerWrapper:!0,shouldRenderPlaceholderItems:!0,__experimentalFirstVisibleItemClass:"first",__experimentalLastVisibleItemClass:"last",dropdownMenuProps:Qr},e)}function ws({Slot:e,fillProps:t,...n}){const o=(0,u.useContext)(_l.__experimentalToolsPanelContext),r=(0,u.useMemo)((()=>{var e;return{...null!=t?t:{},forwardedContext:[...null!==(e=t?.forwardedContext)&&void 0!==e?e:[],[_l.__experimentalToolsPanelContext.Provider,{value:o}]]}}),[o,t]);return(0,s.createElement)(e,{...n,fillProps:r,bubblesVirtually:!0})}function Ss({__experimentalGroup:e,group:t="default",label:n,fillProps:o,...r}){e&&(w()("`__experimentalGroup` property in `InspectorControlsSlot`",{since:"6.2",version:"6.4",alternative:"`group`"}),t=e);const l=vs[t]?.Slot,i=(0,_l.__experimentalUseSlotFills)(l?.__unstableName),a=(0,u.useContext)(_l.__unstableMotionContext),c=(0,u.useMemo)((()=>{var e;return{...null!=o?o:{},forwardedContext:[...null!==(e=o?.forwardedContext)&&void 0!==e?e:[],[_l.__unstableMotionContext.Provider,{value:a}]]}}),[a,o]);return l&&i?.length?n?(0,s.createElement)(Es,{group:t,label:n},(0,s.createElement)(ws,{...r,fillProps:c,Slot:l})):(0,s.createElement)(l,{...r,fillProps:c,bubblesVirtually:!0}):null}const Cs=ks;Cs.Slot=Ss;const xs=e=>(0,s.createElement)(ks,{...e,group:"advanced"});xs.Slot=e=>(0,s.createElement)(Ss,{...e,group:"advanced"}),xs.slotName="InspectorAdvancedControls";const Bs=Cs,Is=/[\s#]/g,Ts={type:"string",source:"attribute",attribute:"id",selector:"*"};const Ms={addSaveProps:function(e,t,n){(0,c.hasBlockSupport)(t,"anchor")&&(e.id=""===n.anchor?null:n.anchor);return e},edit:function({name:e,anchor:t,setAttributes:n}){const o=ns(),r="web"===u.Platform.OS,l=(0,s.createElement)(_l.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,className:"html-anchor-control",label:(0,x.__)("HTML anchor"),help:(0,s.createElement)(s.Fragment,null,(0,x.__)("Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor.” Then, you’ll be able to link directly to this section of your page."),r&&(0,s.createElement)(_l.ExternalLink,{href:(0,x.__)("https://wordpress.org/documentation/article/page-jumps/")},(0,x.__)("Learn more about anchors"))),value:t||"",placeholder:r?null:(0,x.__)("Add an anchor"),onChange:e=>{e=e.replace(Is,"-"),n({anchor:e})},autoCapitalize:"none",autoComplete:"off"});return(0,s.createElement)(s.Fragment,null,r&&"default"===o&&(0,s.createElement)(Bs,{group:"advanced"},l),!r&&"core/heading"===e&&(0,s.createElement)(Bs,null,(0,s.createElement)(_l.PanelBody,{title:(0,x.__)("Heading settings")},l)))},attributeKeys:["anchor"],hasSupport:e=>(0,c.hasBlockSupport)(e,"anchor")};(0,m.addFilter)("blocks.registerBlockType","core/anchor/attribute",(function(e){var t;return"type"in(null!==(t=e.attributes?.anchor)&&void 0!==t?t:{})||(0,c.hasBlockSupport)(e,"anchor")&&(e.attributes={...e.attributes,anchor:Ts}),e}));const Ps={type:"string",source:"attribute",attribute:"aria-label",selector:"*"};const Rs={addSaveProps:function(e,t,n){return(0,c.hasBlockSupport)(t,"ariaLabel")&&(e["aria-label"]=""===n.ariaLabel?null:n.ariaLabel),e},attributeKeys:["ariaLabel"],hasSupport:e=>(0,c.hasBlockSupport)(e,"ariaLabel")};(0,m.addFilter)("blocks.registerBlockType","core/ariaLabel/attribute",(function(e){return e?.attributes?.ariaLabel?.type||(0,c.hasBlockSupport)(e,"ariaLabel")&&(e.attributes={...e.attributes,ariaLabel:Ps}),e}));const Ns={edit:function({className:e,setAttributes:t}){return"default"!==ns()?null:(0,s.createElement)(Bs,{group:"advanced"},(0,s.createElement)(_l.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,autoComplete:"off",label:(0,x.__)("Additional CSS class(es)"),value:e||"",onChange:e=>{t({className:""!==e?e:void 0})},help:(0,x.__)("Separate multiple classes with spaces.")}))},addSaveProps:function(e,t,n){(0,c.hasBlockSupport)(t,"customClassName",!0)&&n.className&&(e.className=ml()(e.className,n.className));return e},attributeKeys:["className"],hasSupport:e=>(0,c.hasBlockSupport)(e,"customClassName",!0)};(0,m.addFilter)("blocks.registerBlockType","core/editor/custom-class-name/attribute",(function(e){return(0,c.hasBlockSupport)(e,"customClassName",!0)&&(e.attributes={...e.attributes,className:{type:"string"}}),e})),(0,m.addFilter)("blocks.switchToBlockType.transformedBlock","core/color/addTransforms",(function(e,t,n,o){if(!(0,c.hasBlockSupport)(e.name,"customClassName",!0))return e;if(1===o.length&&e.innerBlocks.length===t.length)return e;if(1===o.length&&t.length>1||o.length>1&&1===t.length)return e;if(t[n]){const o=t[n]?.attributes.className;if(o)return{...e,attributes:{...e.attributes,className:o}}}return e})),(0,m.addFilter)("blocks.getSaveContent.extraProps","core/generated-class-name/save-props",(function(e,t){return(0,c.hasBlockSupport)(t,"className",!0)&&("string"==typeof e.className?e.className=[...new Set([(0,c.getBlockDefaultClassName)(t.name),...e.className.split(" ")])].join(" ").trim():e.className=(0,c.getBlockDefaultClassName)(t.name)),e}));const Ls=window.wp.blob,As=window.wp.dom,Os=window.wp.notices,Ds=window.wp.url,zs=window.wp.keycodes,Vs=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"m7 6.5 4 2.5-4 2.5z"}),(0,s.createElement)(Z.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"m5 3c-1.10457 0-2 .89543-2 2v14c0 1.1046.89543 2 2 2h14c1.1046 0 2-.8954 2-2v-14c0-1.10457-.8954-2-2-2zm14 1.5h-14c-.27614 0-.5.22386-.5.5v10.7072l3.62953-2.6465c.25108-.1831.58905-.1924.84981-.0234l2.92666 1.8969 3.5712-3.4719c.2911-.2831.7545-.2831 1.0456 0l2.9772 2.8945v-9.3568c0-.27614-.2239-.5-.5-.5zm-14.5 14.5v-1.4364l4.09643-2.987 2.99567 1.9417c.2936.1903.6798.1523.9307-.0917l3.4772-3.3806 3.4772 3.3806.0228-.0234v2.5968c0 .2761-.2239.5-.5.5h-14c-.27614 0-.5-.2239-.5-.5z"})),Fs=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z"})),Hs=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M19 3H5c-.6 0-1 .4-1 1v7c0 .5.4 1 1 1h14c.5 0 1-.4 1-1V4c0-.6-.4-1-1-1zM5.5 10.5v-.4l1.8-1.3 1.3.8c.3.2.7.2.9-.1L11 8.1l2.4 2.4H5.5zm13 0h-2.9l-4-4c-.3-.3-.8-.3-1.1 0L8.9 8l-1.2-.8c-.3-.2-.6-.2-.9 0l-1.3 1V4.5h13v6zM4 20h9v-1.5H4V20zm0-4h16v-1.5H4V16z"})),Gs=(0,_l.withFilters)("editor.MediaUpload")((()=>null));const Us=function({fallback:e=null,children:t}){const n=(0,d.useSelect)((e=>{const{getSettings:t}=e(Nr);return!!t().mediaUpload}),[]);return n?t:e},$s=window.wp.isShallowEqual;var js=n.n($s);const Ws=window.wp.preferences,Ks=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,s.createElement)(Z.Path,{d:"M6.734 16.106l2.176-2.38-1.093-1.028-3.846 4.158 3.846 4.157 1.093-1.027-2.176-2.38h2.811c1.125 0 2.25.03 3.374 0 1.428-.001 3.362-.25 4.963-1.277 1.66-1.065 2.868-2.906 2.868-5.859 0-2.479-1.327-4.896-3.65-5.93-1.82-.813-3.044-.8-4.806-.788l-.567.002v1.5c.184 0 .368 0 .553-.002 1.82-.007 2.704-.014 4.21.657 1.854.827 2.76 2.657 2.76 4.561 0 2.472-.973 3.824-2.178 4.596-1.258.807-2.864 1.04-4.163 1.04h-.02c-1.115.03-2.229 0-3.344 0H6.734z"})),Zs=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z"})),qs=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z"}));const Ys=function e({children:t,settingsOpen:n,setSettingsOpen:o}){const r=(0,p.useReducedMotion)(),l=r?u.Fragment:_l.__unstableAnimatePresence,i=r?"div":_l.__unstableMotion.div,a=`link-control-settings-drawer-${(0,p.useInstanceId)(e)}`;return(0,s.createElement)(u.Fragment,null,(0,s.createElement)(_l.Button,{className:"block-editor-link-control__drawer-toggle","aria-expanded":n,onClick:()=>o(!n),icon:(0,x.isRTL)()?Zs:qs,"aria-controls":a},(0,x._x)("Advanced","Additional link settings")),(0,s.createElement)(l,null,n&&(0,s.createElement)(i,{className:"block-editor-link-control__drawer",hidden:!n,id:a,initial:"collapsed",animate:"open",exit:"collapsed",variants:{open:{opacity:1,height:"auto"},collapsed:{opacity:0,height:0}},transition:{duration:.1}},(0,s.createElement)("div",{className:"block-editor-link-control__drawer-inner"},t))))};var Xs=n(5428),Qs=n.n(Xs);function Js(e){return"function"==typeof e}class ea extends u.Component{constructor(e){super(e),this.onChange=this.onChange.bind(this),this.onFocus=this.onFocus.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.selectLink=this.selectLink.bind(this),this.handleOnClick=this.handleOnClick.bind(this),this.bindSuggestionNode=this.bindSuggestionNode.bind(this),this.autocompleteRef=e.autocompleteRef||(0,u.createRef)(),this.inputRef=(0,u.createRef)(),this.updateSuggestions=(0,p.debounce)(this.updateSuggestions.bind(this),200),this.suggestionNodes=[],this.suggestionsRequest=null,this.state={suggestions:[],showSuggestions:!1,suggestionsValue:null,selectedSuggestion:null,suggestionsListboxId:"",suggestionOptionIdPrefix:""}}componentDidUpdate(e){const{showSuggestions:t,selectedSuggestion:n}=this.state,{value:o,__experimentalShowInitialSuggestions:r=!1}=this.props;t&&null!==n&&this.suggestionNodes[n]&&!this.scrollingIntoView&&(this.scrollingIntoView=!0,Qs()(this.suggestionNodes[n],this.autocompleteRef.current,{onlyScrollIfNeeded:!0}),this.props.setTimeout((()=>{this.scrollingIntoView=!1}),100)),e.value===o||this.props.disableSuggestions||(o?.length?this.updateSuggestions(o):r&&this.updateSuggestions())}componentDidMount(){this.shouldShowInitialSuggestions()&&this.updateSuggestions()}componentWillUnmount(){this.suggestionsRequest?.cancel?.(),this.suggestionsRequest=null}bindSuggestionNode(e){return t=>{this.suggestionNodes[e]=t}}shouldShowInitialSuggestions(){const{__experimentalShowInitialSuggestions:e=!1,value:t}=this.props;return e&&!(t&&t.length)}updateSuggestions(e=""){const{__experimentalFetchLinkSuggestions:t,__experimentalHandleURLSuggestions:n}=this.props;if(!t)return;const o=!e?.length;if(e=e.trim(),!o&&(e.length<2||!n&&(0,Ds.isURL)(e)))return this.suggestionsRequest?.cancel?.(),this.suggestionsRequest=null,void this.setState({suggestions:[],showSuggestions:!1,suggestionsValue:e,selectedSuggestion:null,loading:!1});this.setState({selectedSuggestion:null,loading:!0});const r=t(e,{isInitialSuggestions:o});r.then((t=>{this.suggestionsRequest===r&&(this.setState({suggestions:t,suggestionsValue:e,loading:!1,showSuggestions:!!t.length}),t.length?this.props.debouncedSpeak((0,x.sprintf)((0,x._n)("%d result found, use up and down arrow keys to navigate.","%d results found, use up and down arrow keys to navigate.",t.length),t.length),"assertive"):this.props.debouncedSpeak((0,x.__)("No results."),"assertive"))})).catch((()=>{this.suggestionsRequest===r&&this.setState({loading:!1})})).finally((()=>{this.suggestionsRequest===r&&(this.suggestionsRequest=null)})),this.suggestionsRequest=r}onChange(e){this.props.onChange(e.target.value)}onFocus(){const{suggestions:e}=this.state,{disableSuggestions:t,value:n}=this.props;!n||t||e&&e.length||null!==this.suggestionsRequest||this.updateSuggestions(n)}onKeyDown(e){this.props.onKeyDown?.(e);const{showSuggestions:t,selectedSuggestion:n,suggestions:o,loading:r}=this.state;if(!t||!o.length||r){switch(e.keyCode){case zs.UP:0!==e.target.selectionStart&&(e.preventDefault(),e.target.setSelectionRange(0,0));break;case zs.DOWN:this.props.value.length!==e.target.selectionStart&&(e.preventDefault(),e.target.setSelectionRange(this.props.value.length,this.props.value.length));break;case zs.ENTER:this.props.onSubmit&&(e.preventDefault(),this.props.onSubmit(null,e))}return}const l=this.state.suggestions[this.state.selectedSuggestion];switch(e.keyCode){case zs.UP:{e.preventDefault();const t=n?n-1:o.length-1;this.setState({selectedSuggestion:t});break}case zs.DOWN:{e.preventDefault();const t=null===n||n===o.length-1?0:n+1;this.setState({selectedSuggestion:t});break}case zs.TAB:null!==this.state.selectedSuggestion&&(this.selectLink(l),this.props.speak((0,x.__)("Link selected.")));break;case zs.ENTER:e.preventDefault(),null!==this.state.selectedSuggestion?(this.selectLink(l),this.props.onSubmit&&this.props.onSubmit(l,e)):this.props.onSubmit&&this.props.onSubmit(null,e)}}selectLink(e){this.props.onChange(e.url,e),this.setState({selectedSuggestion:null,showSuggestions:!1})}handleOnClick(e){this.selectLink(e),this.inputRef.current.focus()}static getDerivedStateFromProps({value:e,instanceId:t,disableSuggestions:n,__experimentalShowInitialSuggestions:o=!1},{showSuggestions:r}){let l=r;const i=e&&e.length;return o||i||(l=!1),!0===n&&(l=!1),{showSuggestions:l,suggestionsListboxId:`block-editor-url-input-suggestions-${t}`,suggestionOptionIdPrefix:`block-editor-url-input-suggestion-${t}`}}render(){return(0,s.createElement)(s.Fragment,null,this.renderControl(),this.renderSuggestions())}renderControl(){const{__nextHasNoMarginBottom:e=!1,label:t=null,className:n,isFullWidth:o,instanceId:r,placeholder:l=(0,x.__)("Paste URL or type to search"),__experimentalRenderControl:i,value:a="",hideLabelFromVision:c=!1}=this.props,{loading:u,showSuggestions:d,selectedSuggestion:p,suggestionsListboxId:m,suggestionOptionIdPrefix:h}=this.state,g=`url-input-control-${r}`,f={id:g,label:t,className:ml()("block-editor-url-input",n,{"is-full-width":o}),hideLabelFromVision:c},b={id:g,value:a,required:!0,className:"block-editor-url-input__input",type:"text",onChange:this.onChange,onFocus:this.onFocus,placeholder:l,onKeyDown:this.onKeyDown,role:"combobox","aria-label":t?void 0:(0,x.__)("URL"),"aria-expanded":d,"aria-autocomplete":"list","aria-owns":m,"aria-activedescendant":null!==p?`${h}-${p}`:void 0,ref:this.inputRef};return i?i(f,b,u):(e||w()("Bottom margin styles for wp.blockEditor.URLInput",{since:"6.2",version:"6.5",hint:"Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version"}),(0,s.createElement)(_l.BaseControl,{__nextHasNoMarginBottom:e,...f},(0,s.createElement)("input",{...b}),u&&(0,s.createElement)(_l.Spinner,null)))}renderSuggestions(){const{className:e,__experimentalRenderSuggestions:t}=this.props,{showSuggestions:n,suggestions:o,suggestionsValue:r,selectedSuggestion:l,suggestionsListboxId:i,suggestionOptionIdPrefix:a,loading:c}=this.state;if(!n||0===o.length)return null;const u={id:i,ref:this.autocompleteRef,role:"listbox"},d=(e,t)=>({role:"option",tabIndex:"-1",id:`${a}-${t}`,ref:this.bindSuggestionNode(t),"aria-selected":t===l||void 0});return Js(t)?t({suggestions:o,selectedSuggestion:l,suggestionsListProps:u,buildSuggestionItemProps:d,isLoading:c,handleSuggestionClick:this.handleOnClick,isInitialSuggestions:!r?.length,currentInputValue:r}):(0,s.createElement)(_l.Popover,{placement:"bottom",focusOnMount:!1},(0,s.createElement)("div",{...u,className:ml()("block-editor-url-input__suggestions",`${e}__suggestions`)},o.map(((e,t)=>(0,s.createElement)(_l.Button,{...d(0,t),key:e.id,className:ml()("block-editor-url-input__suggestion",{"is-selected":t===l}),onClick:()=>this.handleOnClick(e)},e.title)))))}}const ta=(0,p.compose)(p.withSafeTimeout,_l.withSpokenMessages,p.withInstanceId,(0,d.withSelect)(((e,t)=>{if(Js(t.__experimentalFetchLinkSuggestions))return;const{getSettings:n}=e(Nr);return{__experimentalFetchLinkSuggestions:n().__experimentalFetchLinkSuggestions}})))(ea),na=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"})),oa=({searchTerm:e,onClick:t,itemProps:n,buttonText:o})=>{if(!e)return null;let r;return r=o?"function"==typeof o?o(e):o:(0,u.createInterpolateElement)((0,x.sprintf)((0,x.__)("Create: %s"),e),{mark:(0,s.createElement)("mark",null)}),(0,s.createElement)(_l.MenuItem,{...n,iconPosition:"left",icon:na,className:"block-editor-link-control__search-item",onClick:t},r)},ra=(0,s.createElement)(Z.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(Z.Path,{d:"M18 5.5H6a.5.5 0 0 0-.5.5v12a.5.5 0 0 0 .5.5h12a.5.5 0 0 0 .5-.5V6a.5.5 0 0 0-.5-.5ZM6 4h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2Zm1 5h1.5v1.5H7V9Zm1.5 4.5H7V15h1.5v-1.5ZM10 9h7v1.5h-7V9Zm7 4.5h-7V15h7v-1.5Z"})),la=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z"}),(0,s.createElement)(Z.Path,{d:"M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z"})),ia=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M4.75 4a.75.75 0 0 0-.75.75v7.826c0 .2.08.39.22.53l6.72 6.716a2.313 2.313 0 0 0 3.276-.001l5.61-5.611-.531-.53.532.528a2.315 2.315 0 0 0 0-3.264L13.104 4.22a.75.75 0 0 0-.53-.22H4.75ZM19 12.576a.815.815 0 0 1-.236.574l-5.61 5.611a.814.814 0 0 1-1.153 0L5.5 12.264V5.5h6.763l6.5 6.502a.816.816 0 0 1 .237.574ZM8.75 9.75a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"})),sa=(0,s.createElement)(Z.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(Z.Path,{d:"M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z",fillRule:"evenodd",clipRule:"evenodd"})),aa=(0,s.createElement)(Z.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(Z.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12.848 8a1 1 0 0 1-.914-.594l-.723-1.63a.5.5 0 0 0-.447-.276H5a.5.5 0 0 0-.5.5v11.5a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5v-9A.5.5 0 0 0 19 8h-6.152Zm.612-1.5a.5.5 0 0 1-.462-.31l-.445-1.084A2 2 0 0 0 10.763 4H5a2 2 0 0 0-2 2v11.5a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2h-5.54Z"})),ca=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M12 3.3c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8s-4-8.8-8.8-8.8zm6.5 5.5h-2.6C15.4 7.3 14.8 6 14 5c2 .6 3.6 2 4.5 3.8zm.7 3.2c0 .6-.1 1.2-.2 1.8h-2.9c.1-.6.1-1.2.1-1.8s-.1-1.2-.1-1.8H19c.2.6.2 1.2.2 1.8zM12 18.7c-1-.7-1.8-1.9-2.3-3.5h4.6c-.5 1.6-1.3 2.9-2.3 3.5zm-2.6-4.9c-.1-.6-.1-1.1-.1-1.8 0-.6.1-1.2.1-1.8h5.2c.1.6.1 1.1.1 1.8s-.1 1.2-.1 1.8H9.4zM4.8 12c0-.6.1-1.2.2-1.8h2.9c-.1.6-.1 1.2-.1 1.8 0 .6.1 1.2.1 1.8H5c-.2-.6-.2-1.2-.2-1.8zM12 5.3c1 .7 1.8 1.9 2.3 3.5H9.7c.5-1.6 1.3-2.9 2.3-3.5zM10 5c-.8 1-1.4 2.3-1.8 3.8H5.5C6.4 7 8 5.6 10 5zM5.5 15.3h2.6c.4 1.5 1 2.8 1.8 3.7-1.8-.6-3.5-2-4.4-3.7zM14 19c.8-1 1.4-2.2 1.8-3.7h2.6C17.6 17 16 18.4 14 19z"})),ua=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z"})),da=(0,s.createElement)(Z.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(Z.Path,{d:"M17.8 2l-.9.3c-.1 0-3.6 1-5.2 2.1C10 5.5 9.3 6.5 8.9 7.1c-.6.9-1.7 4.7-1.7 6.3l-.9 2.3c-.2.4 0 .8.4 1 .1 0 .2.1.3.1.3 0 .6-.2.7-.5l.6-1.5c.3 0 .7-.1 1.2-.2.7-.1 1.4-.3 2.2-.5.8-.2 1.6-.5 2.4-.8.7-.3 1.4-.7 1.9-1.2s.8-1.2 1-1.9c.2-.7.3-1.6.4-2.4.1-.8.1-1.7.2-2.5 0-.8.1-1.5.2-2.1V2zm-1.9 5.6c-.1.8-.2 1.5-.3 2.1-.2.6-.4 1-.6 1.3-.3.3-.8.6-1.4.9-.7.3-1.4.5-2.2.8-.6.2-1.3.3-1.8.4L15 7.5c.3-.3.6-.7 1-1.1 0 .4 0 .8-.1 1.2zM6 20h8v-1.5H6V20z"})),pa={post:ra,page:la,post_tag:ia,category:sa,attachment:aa};function ma({isURL:e,suggestion:t}){let n=null;return e?n=ca:t.type in pa&&(n=pa[t.type],"page"===t.type&&(t.isFrontPage&&(n=ua),t.isBlogHome&&(n=da))),n?(0,s.createElement)(Ti,{className:"block-editor-link-control__search-item-icon",icon:n}):null}function ha(e){const t=e?.trim();return t?.length?e?.replace(/^\/?/,"/"):e}function ga(e){const t=e?.trim();return t?.length?e?.replace(/\/$/,""):e}function fa(e){return e.isFrontPage?"front page":e.isBlogHome?"blog home":"post_tag"===e.type?"tag":e.type}const ba=({itemProps:e,suggestion:t,searchTerm:n,onClick:o,isURL:r=!1,shouldShowType:l=!1})=>{const i=r?(0,x.__)("Press ENTER to add this link"):(a=t.url)?(0,p.pipe)(Ds.safeDecodeURI,Ds.getPath,(e=>t=>null==t||t!=t?e:t)(""),((e,...t)=>(...n)=>e(...n,...t))(Ds.filterURLForDisplay,24),ga,ha)(a):a;var a;return(0,s.createElement)(_l.MenuItem,{...e,info:i,iconPosition:"left",icon:(0,s.createElement)(ma,{suggestion:t,isURL:r}),onClick:o,shortcut:l&&fa(t),className:"block-editor-link-control__search-item"},(0,s.createElement)(_l.TextHighlight,{text:(0,As.__unstableStripHTML)(t.title),highlight:n}))},va="__CREATE__",ka="link",_a="mailto",ya="internal",Ea=[ka,_a,"tel",ya],wa=[{id:"opensInNewTab",title:(0,x.__)("Open in new tab")}];function Sa({instanceId:e,withCreateSuggestion:t,currentInputValue:n,handleSuggestionClick:o,suggestionsListProps:r,buildSuggestionItemProps:l,suggestions:i,selectedSuggestion:a,isLoading:c,isInitialSuggestions:u,createSuggestionButtonText:d,suggestionsQuery:p}){const m=ml()("block-editor-link-control__search-results",{"is-loading":c}),h=1===i.length&&Ea.includes(i[0].type),g=t&&!h&&!u,f=!p?.type,b=`block-editor-link-control-search-results-label-${e}`,v=u?(0,x.__)("Suggestions"):(0,x.sprintf)((0,x.__)('Search results for "%s"'),n),k=(0,s.createElement)(_l.VisuallyHidden,{id:b},v);return(0,s.createElement)("div",{className:"block-editor-link-control__search-results-wrapper"},k,(0,s.createElement)("div",{...r,className:m,"aria-labelledby":b},(0,s.createElement)(_l.MenuGroup,null,i.map(((e,t)=>g&&va===e.type?(0,s.createElement)(oa,{searchTerm:n,buttonText:d,onClick:()=>o(e),key:e.type,itemProps:l(e,t),isSelected:t===a}):va===e.type?null:(0,s.createElement)(ba,{key:`${e.id}-${e.type}`,itemProps:l(e,t),suggestion:e,index:t,onClick:()=>{o(e)},isSelected:t===a,isURL:Ea.includes(e.type),searchTerm:n,shouldShowType:f,isFrontPage:e?.isFrontPage,isBlogHome:e?.isBlogHome}))))))}function Ca(e){if(e.includes(" "))return!1;const t=(0,Ds.getProtocol)(e),n=(0,Ds.isValidProtocol)(t),o=function(e,t=6){const n=e.split(/[?#]/)[0];return new RegExp(`(?<=\\S)\\.(?:[a-zA-Z_]{2,${t}})(?:\\/|$)`).test(n)}(e),r=e?.startsWith("www."),l=e?.startsWith("#")&&(0,Ds.isValidFragment)(e);return n||r||l||o}const xa=()=>Promise.resolve([]),Ba=e=>{let t=ka;const n=(0,Ds.getProtocol)(e)||"";return n.includes("mailto")&&(t=_a),n.includes("tel")&&(t="tel"),e?.startsWith("#")&&(t=ya),Promise.resolve([{id:e,title:e,url:"URL"===t?(0,Ds.prependHTTP)(e):e,type:t}])};function Ia(e,t,n){const{fetchSearchSuggestions:o,pageOnFront:r,pageForPosts:l}=(0,d.useSelect)((e=>{const{getSettings:t}=e(Nr);return{pageOnFront:t().pageOnFront,pageForPosts:t().pageForPosts,fetchSearchSuggestions:t().__experimentalFetchLinkSuggestions}}),[]),i=t?Ba:xa;return(0,u.useCallback)(((t,{isInitialSuggestions:s})=>Ca(t)?i(t,{isInitialSuggestions:s}):(async(e,t,n,o,r,l)=>{const{isInitialSuggestions:i}=t,s=await n(e,t);return s.map((e=>Number(e.id)===r?(e.isFrontPage=!0,e):Number(e.id)===l?(e.isBlogHome=!0,e):e)),i||Ca(e)||!o?s:s.concat({title:e,url:e,type:va})})(t,{...e,isInitialSuggestions:s},o,n,r,l)),[i,o,r,l,e,n])}const Ta=()=>Promise.resolve([]),Ma=()=>{},Pa=(0,u.forwardRef)((({value:e,children:t,currentLink:n={},className:o=null,placeholder:r=null,withCreateSuggestion:l=!1,onCreateSuggestion:i=Ma,onChange:a=Ma,onSelect:c=Ma,showSuggestions:d=!0,renderSuggestions:m=(e=>(0,s.createElement)(Sa,{...e})),fetchSuggestions:h=null,allowDirectEntry:g=!0,showInitialSuggestions:f=!1,suggestionsQuery:b={},withURLSuggestion:v=!0,createSuggestionButtonText:k,hideLabelFromVision:_=!1},y)=>{const E=Ia(b,g,l),w=d?h||E:Ta,S=(0,p.useInstanceId)(Pa),[C,B]=(0,u.useState)(),I=async e=>{let t=e;if(va!==e.type){if(g||t&&Object.keys(t).length>=1){const{id:e,url:o,...r}=null!=n?n:{};c({...r,...t},t)}}else try{t=await i(e.title),t?.url&&c(t)}catch(e){}};return(0,s.createElement)("div",{className:"block-editor-link-control__search-input-container"},(0,s.createElement)(ta,{disableSuggestions:n?.url===e,__nextHasNoMarginBottom:!0,label:(0,x.__)("Link"),hideLabelFromVision:_,className:o,value:e,onChange:(e,t)=>{a(e),B(t)},placeholder:null!=r?r:(0,x.__)("Search or type url"),__experimentalRenderSuggestions:d?e=>m({...e,instanceId:S,withCreateSuggestion:l,createSuggestionButtonText:k,suggestionsQuery:b,handleSuggestionClick:t=>{e.handleSuggestionClick&&e.handleSuggestionClick(t),I(t)}}):null,__experimentalFetchLinkSuggestions:w,__experimentalHandleURLSuggestions:!0,__experimentalShowInitialSuggestions:f,onSubmit:(t,n)=>{const o=t||C;o||e?.trim()?.length?I(o||{url:e}):n.preventDefault()},ref:y}),t)})),Ra=Pa,Na=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z"})),La=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z"})),Aa=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M17.031 4.703 15.576 4l-1.56 3H14v.03l-2.324 4.47H9.5V13h1.396l-1.502 2.889h-.95a3.694 3.694 0 0 1 0-7.389H10V7H8.444a5.194 5.194 0 1 0 0 10.389h.17L7.5 19.53l1.416.719L15.049 8.5h.507a3.694 3.694 0 0 1 0 7.39H14v1.5h1.556a5.194 5.194 0 0 0 .273-10.383l1.202-2.304Z"})),Oa=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M5.625 5.5h9.75c.069 0 .125.056.125.125v9.75a.125.125 0 0 1-.125.125h-9.75a.125.125 0 0 1-.125-.125v-9.75c0-.069.056-.125.125-.125ZM4 5.625C4 4.728 4.728 4 5.625 4h9.75C16.273 4 17 4.728 17 5.625v9.75c0 .898-.727 1.625-1.625 1.625h-9.75A1.625 1.625 0 0 1 4 15.375v-9.75Zm14.5 11.656v-9H20v9C20 18.8 18.77 20 17.251 20H6.25v-1.5h11.001c.69 0 1.249-.528 1.249-1.219Z"})),{Slot:Da,Fill:za}=(0,_l.createSlotFill)("BlockEditorLinkControlViewer");function Va(e,t){switch(t.type){case"RESOLVED":return{...e,isFetching:!1,richData:t.richData};case"ERROR":return{...e,isFetching:!1,richData:null};case"LOADING":return{...e,isFetching:!0};default:throw new Error(`Unexpected action type ${t.type}`)}}const Fa=function(e){const[t,n]=(0,u.useReducer)(Va,{richData:null,isFetching:!1}),{fetchRichUrlData:o}=(0,d.useSelect)((e=>{const{getSettings:t}=e(Nr);return{fetchRichUrlData:t().__experimentalFetchRichUrlData}}),[]);return(0,u.useEffect)((()=>{if(e?.length&&o&&"undefined"!=typeof AbortController){n({type:"LOADING"});const t=new window.AbortController,r=t.signal;return o(e,{signal:r}).then((e=>{n({type:"RESOLVED",richData:e})})).catch((()=>{r.aborted||n({type:"ERROR"})})),()=>{t.abort()}}}),[e]),t};function Ha({value:e,onEditClick:t,hasRichPreviews:n=!1,hasUnlinkControl:o=!1,onRemove:r}){const l=(0,d.useSelect)((e=>e(Ws.store).get("core","showIconLabels")),[]),i=n?e?.url:null,{richData:a,isFetching:c}=Fa(i),u=a&&Object.keys(a).length,m=e&&(0,Ds.filterURLForDisplay)((0,Ds.safeDecodeURI)(e.url),24)||"",h=!e?.url?.length,g=!h&&(0,As.__unstableStripHTML)(a?.title||e?.title||m);let f;f=a?.icon?(0,s.createElement)("img",{src:a?.icon,alt:""}):h?(0,s.createElement)(Ti,{icon:Na,size:32}):(0,s.createElement)(Ti,{icon:ca});const{createNotice:b}=(0,d.useDispatch)(Os.store),v=(0,p.useCopyToClipboard)(e.url,(()=>{b("info",(0,x.__)("Link copied to clipboard."),{isDismissible:!0,type:"snackbar"})}));return(0,s.createElement)("div",{"aria-label":(0,x.__)("Currently selected"),className:ml()("block-editor-link-control__search-item",{"is-current":!0,"is-rich":u,"is-fetching":!!c,"is-preview":!0,"is-error":h,"is-url-title":g===m})},(0,s.createElement)("div",{className:"block-editor-link-control__search-item-top"},(0,s.createElement)("span",{className:"block-editor-link-control__search-item-header"},(0,s.createElement)("span",{className:ml()("block-editor-link-control__search-item-icon",{"is-image":a?.icon})},f),(0,s.createElement)("span",{className:"block-editor-link-control__search-item-details"},h?(0,s.createElement)("span",{className:"block-editor-link-control__search-item-error-notice"},(0,x.__)("Link is empty")):(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.ExternalLink,{className:"block-editor-link-control__search-item-title",href:e.url},(0,s.createElement)(_l.__experimentalTruncate,{numberOfLines:1},g)),e?.url&&g!==m&&(0,s.createElement)("span",{className:"block-editor-link-control__search-item-info"},(0,s.createElement)(_l.__experimentalTruncate,{numberOfLines:1},m))))),(0,s.createElement)(_l.Button,{icon:La,label:(0,x.__)("Edit link"),onClick:t,size:"compact"}),o&&(0,s.createElement)(_l.Button,{icon:Aa,label:(0,x.__)("Remove link"),onClick:r,size:"compact"}),(0,s.createElement)(_l.Button,{icon:Oa,label:(0,x.sprintf)((0,x.__)("Copy link%s"),h||l?"":": "+e.url),ref:v,disabled:h,size:"compact"}),(0,s.createElement)(Da,{fillProps:e})))}const Ga=()=>{},Ua=({value:e,onChange:t=Ga,settings:n})=>{if(!n||!n.length)return null;const o=n=>o=>{t({...e,[n.id]:o})},r=n.map((t=>(0,s.createElement)(_l.CheckboxControl,{__nextHasNoMarginBottom:!0,className:"block-editor-link-control__setting",key:t.id,label:t.title,onChange:o(t),checked:!!e&&!!e[t.id],help:t?.help})));return(0,s.createElement)("fieldset",{className:"block-editor-link-control__settings"},(0,s.createElement)(_l.VisuallyHidden,{as:"legend"},(0,x.__)("Currently selected link settings")),r)};const $a=e=>{let t=!1;return{promise:new Promise(((n,o)=>{e.then((e=>t?o({isCanceled:!0}):n(e)),(e=>o(t?{isCanceled:!0}:e)))})),cancel(){t=!0}}};var ja=n(5215),Wa=n.n(ja);const Ka=()=>{},Za="core/block-editor",qa="linkControlSettingsDrawer";function Ya({searchInputPlaceholder:e,value:t,settings:n=wa,onChange:o=Ka,onRemove:r,onCancel:l,noDirectEntry:i=!1,showSuggestions:a=!0,showInitialSuggestions:c,forceIsEditingLink:p,createSuggestion:m,withCreateSuggestion:h,inputValue:g="",suggestionsQuery:f={},noURLSuggestion:b=!1,createSuggestionButtonText:v,hasRichPreviews:k=!1,hasTextControl:_=!1,renderControlBottom:y=null}){void 0===h&&m&&(h=!0);const[E,w]=(0,u.useState)(!1),{advancedSettingsPreference:S}=(0,d.useSelect)((e=>{var t;return{advancedSettingsPreference:null!==(t=e(Ws.store).get(Za,qa))&&void 0!==t&&t}}),[]),{set:C}=(0,d.useDispatch)(Ws.store),B=S||E,I=(0,u.useRef)(!0),T=(0,u.useRef)(),M=(0,u.useRef)(),P=(0,u.useRef)(!1),R=n.map((({id:e})=>e)),[N,L,A,O,D]=function(e){const[t,n]=(0,u.useState)(e||{}),[o,r]=(0,u.useState)(e);return Wa()(e,o)||(r(e),n(e)),[t,n,e=>{n({...t,url:e})},e=>{n({...t,title:e})},e=>o=>{const r=Object.keys(o).reduce(((t,n)=>(e.includes(n)&&(t[n]=o[n]),t)),{});n({...t,...r})}]}(t),z=t&&!(0,$s.isShallowEqualObjects)(N,t),[V,F]=(0,u.useState)(void 0!==p?p:!t||!t.url),{createPage:H,isCreatingPage:G,errorMessage:U}=function(e){const t=(0,u.useRef)(),[n,o]=(0,u.useState)(!1),[r,l]=(0,u.useState)(null);return(0,u.useEffect)((()=>()=>{t.current&&t.current.cancel()}),[]),{createPage:async function(n){o(!0),l(null);try{return t.current=$a(Promise.resolve(e(n))),await t.current.promise}catch(e){if(e&&e.isCanceled)return;throw l(e.message||(0,x.__)("An unknown error occurred during creation. Please try again.")),e}finally{o(!1)}},isCreatingPage:n,errorMessage:r}}(m);(0,u.useEffect)((()=>{void 0!==p&&F(p)}),[p]),(0,u.useEffect)((()=>{if(I.current)return void(I.current=!1);(As.focus.focusable.find(T.current)[0]||T.current).focus(),P.current=!1}),[V,G]);const $=t?.url?.trim()?.length>0,j=()=>{P.current=!!T.current?.contains(T.current.ownerDocument.activeElement),F(!1)},W=()=>{z&&o({...t,...N,url:K}),j()},K=g||N?.url||"",Z=!K?.trim()?.length,q=r&&t&&!V&&!G,Y=V&&$,X=$&&_,Q=(V||!t)&&!G,J=!z||Z,ee=!!n?.length&&V&&$;return(0,s.createElement)("div",{tabIndex:-1,ref:T,className:"block-editor-link-control"},G&&(0,s.createElement)("div",{className:"block-editor-link-control__loading"},(0,s.createElement)(_l.Spinner,null)," ",(0,x.__)("Creating"),"…"),Q&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)("div",{className:ml()({"block-editor-link-control__search-input-wrapper":!0,"has-text-control":X,"has-actions":Y})},X&&(0,s.createElement)(_l.TextControl,{__nextHasNoMarginBottom:!0,ref:M,className:"block-editor-link-control__field block-editor-link-control__text-content",label:(0,x.__)("Text"),value:N?.title,onChange:O,onKeyDown:e=>{const{keyCode:t}=e;t!==zs.ENTER||Z||(e.preventDefault(),W())},size:"__unstable-large"}),(0,s.createElement)(Ra,{currentLink:t,className:"block-editor-link-control__field block-editor-link-control__search-input",placeholder:e,value:K,withCreateSuggestion:h,onCreateSuggestion:H,onChange:A,onSelect:e=>{const t=Object.keys(e).reduce(((t,n)=>(R.includes(n)||(t[n]=e[n]),t)),{});o({...N,...t,title:N?.title||e?.title}),j()},showInitialSuggestions:c,allowDirectEntry:!i,showSuggestions:a,suggestionsQuery:f,withURLSuggestion:!b,createSuggestionButtonText:v,hideLabelFromVision:!X}),!Y&&(0,s.createElement)("div",{className:"block-editor-link-control__search-enter"},(0,s.createElement)(_l.Button,{onClick:J?Ka:W,label:(0,x.__)("Submit"),icon:Ks,className:"block-editor-link-control__search-submit","aria-disabled":J}))),U&&(0,s.createElement)(_l.Notice,{className:"block-editor-link-control__search-error",status:"error",isDismissible:!1},U)),t&&!V&&!G&&(0,s.createElement)(Ha,{key:t?.url,value:t,onEditClick:()=>F(!0),hasRichPreviews:k,hasUnlinkControl:q,onRemove:()=>{r(),F(!0)}}),ee&&(0,s.createElement)("div",{className:"block-editor-link-control__tools"},!Z&&(0,s.createElement)(Ys,{settingsOpen:B,setSettingsOpen:e=>{C&&C(Za,qa,e),w(e)}},(0,s.createElement)(Ua,{value:N,settings:n,onChange:D(R)}))),Y&&(0,s.createElement)(_l.__experimentalHStack,{justify:"right",className:"block-editor-link-control__search-actions"},(0,s.createElement)(_l.Button,{variant:"tertiary",onClick:e=>{e.preventDefault(),e.stopPropagation(),L(t),$?j():r?.(),l?.()}},(0,x.__)("Cancel")),(0,s.createElement)(_l.Button,{variant:"primary",onClick:J?Ka:W,className:"block-editor-link-control__search-submit","aria-disabled":J},(0,x.__)("Save"))),!G&&y&&y())}Ya.ViewerFill=za,Ya.DEFAULT_LINK_SETTINGS=wa;const Xa=Ya,Qa=()=>{};let Ja=0;const ec=(0,p.compose)([(0,d.withDispatch)((e=>{const{createNotice:t,removeNotice:n}=e(Os.store);return{createNotice:t,removeNotice:n}})),(0,_l.withFilters)("editor.MediaReplaceFlow")])((({mediaURL:e,mediaId:t,mediaIds:n,allowedTypes:o,accept:r,onError:l,onSelect:i,onSelectURL:a,onToggleFeaturedImage:c,useFeaturedImage:p,onFilesUpload:m=Qa,name:h=(0,x.__)("Replace"),createNotice:g,removeNotice:f,children:b,multiple:v=!1,addToGallery:k,handleUpload:_=!0,popoverProps:y})=>{const E=(0,d.useSelect)((e=>e(Nr).getSettings().mediaUpload),[]),w=!!E,S=(0,u.useRef)(),C="block-editor/media-replace-flow/error-notice/"+ ++Ja,B=e=>{const t=(0,As.__unstableStripHTML)(e);l?l(t):setTimeout((()=>{g("error",t,{speak:!0,id:C,isDismissible:!0})}),1e3)},I=(e,t)=>{p&&c&&c(),t(),i(e),(0,vo.speak)((0,x.__)("The media file has been replaced")),f(C)},T=e=>{e.keyCode===zs.DOWN&&(e.preventDefault(),e.target.click())},M=v&&!(!o||0===o.length)&&o.every((e=>"image"===e||e.startsWith("image/")));return(0,s.createElement)(_l.Dropdown,{popoverProps:y,contentClassName:"block-editor-media-replace-flow__options",renderToggle:({isOpen:e,onToggle:t})=>(0,s.createElement)(_l.ToolbarButton,{ref:S,"aria-expanded":e,"aria-haspopup":"true",onClick:t,onKeyDown:T},h),renderContent:({onClose:l})=>(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.NavigableMenu,{className:"block-editor-media-replace-flow__media-upload-menu"},(0,s.createElement)(Us,null,(0,s.createElement)(Gs,{gallery:M,addToGallery:k,multiple:v,value:v?n:t,onSelect:e=>I(e,l),allowedTypes:o,render:({open:e})=>(0,s.createElement)(_l.MenuItem,{icon:Vs,onClick:e},(0,x.__)("Open Media Library"))}),(0,s.createElement)(_l.FormFileUpload,{onChange:e=>{((e,t)=>{const n=e.target.files;if(!_)return t(),i(n);m(n),E({allowedTypes:o,filesList:n,onFileChange:([e])=>{I(e,t)},onError:B})})(e,l)},accept:r,multiple:!!v,render:({openFileDialog:e})=>(0,s.createElement)(_l.MenuItem,{icon:Fs,onClick:()=>{e()}},(0,x.__)("Upload"))})),c&&(0,s.createElement)(_l.MenuItem,{icon:Hs,onClick:c,isPressed:p},(0,x.__)("Use featured image")),b),a&&(0,s.createElement)("form",{className:ml()("block-editor-media-flow__url-input",{"has-siblings":w||c})},(0,s.createElement)("span",{className:"block-editor-media-replace-flow__image-url-label"},(0,x.__)("Current media URL:")),(0,s.createElement)(Xa,{value:{url:e},settings:[],showSuggestions:!1,onChange:({url:e})=>{a(e),S.current.focus()}})))})})),tc="background",nc="image";function oc(e){return!!e?.background?.backgroundImage?.id||!!e?.background?.backgroundImage?.url}function rc(e,t="any"){if("web"!==u.Platform.OS)return!1;const n=(0,c.getBlockSupport)(e,tc);return!0===n||("any"===t?!!n?.backgroundImage||!!n?.backgroundSize||!!n?.backgroundRepeat:!!n?.[t])}function lc(e={},t){t({style:hl({...e,background:{...e?.background,backgroundImage:void 0}})})}function ic(e){return oc(e)?"has-background":""}function sc({label:e,filename:t,url:n}){const o=e||(0,Ds.getFilename)(n);return(0,s.createElement)(_l.__experimentalItemGroup,{as:"span"},(0,s.createElement)(_l.__experimentalHStack,{justify:"flex-start",as:"span"},(0,s.createElement)("span",{className:ml()("block-editor-hooks__background__inspector-image-indicator-wrapper",{"has-image":n}),"aria-hidden":!0},n&&(0,s.createElement)("span",{className:"block-editor-hooks__background__inspector-image-indicator",style:{backgroundImage:`url(${n})`}})),(0,s.createElement)(_l.FlexItem,{as:"span"},(0,s.createElement)(_l.__experimentalTruncate,{numberOfLines:1,className:"block-editor-hooks__background__inspector-media-replace-title"},o),(0,s.createElement)(_l.VisuallyHidden,{as:"span"},t?(0,x.sprintf)((0,x.__)("Selected image: %s"),t):(0,x.__)("No image selected")))))}function ac({clientId:e,isShownByDefault:t,setAttributes:n}){const{style:o,mediaUpload:r}=(0,d.useSelect)((t=>{const{getBlockAttributes:n,getSettings:o}=t(Nr);return{style:n(e)?.style,mediaUpload:o().mediaUpload}}),[e]),{id:l,title:i,url:a}=o?.background?.backgroundImage||{},c=(0,u.useRef)(),{createErrorNotice:p}=(0,d.useDispatch)(Os.store),m=e=>{p(e,{type:"snackbar"})},h=e=>{if(!e||!e.url){const e={...o,background:{...o?.background,backgroundImage:void 0}},t={style:hl(e)};return void n(t)}if((0,Ls.isBlobURL)(e.url))return;if(e.media_type&&e.media_type!==nc||!e.media_type&&e.type&&e.type!==nc)return void m((0,x.__)("Only images can be used as a background image."));const t={...o,background:{...o?.background,backgroundImage:{url:e.url,id:e.id,source:"file",title:e.title||void 0}}},r={style:hl(t)};n(r)},g=(0,u.useCallback)((e=>({...e,style:{...e.style,background:void 0}})),[]),f=oc(o);return(0,s.createElement)(_l.__experimentalToolsPanelItem,{className:"single-column",hasValue:()=>f,label:(0,x.__)("Background image"),onDeselect:()=>lc(o,n),isShownByDefault:t,resetAllFilter:g,panelId:e},(0,s.createElement)("div",{className:"block-editor-hooks__background__inspector-media-replace-container",ref:c},(0,s.createElement)(ec,{mediaId:l,mediaURL:a,allowedTypes:[nc],accept:"image/*",onSelect:h,name:(0,s.createElement)(sc,{label:(0,x.__)("Background image"),filename:i,url:a}),variant:"secondary"},f&&(0,s.createElement)(_l.MenuItem,{onClick:()=>{const[e]=As.focus.tabbable.find(c.current);e?.focus(),e?.click(),lc(o,n)}},(0,x.__)("Reset "))),(0,s.createElement)(_l.DropZone,{onFilesDrop:e=>{r({allowedTypes:["image"],filesList:e,onFileChange([e]){(0,Ls.isBlobURL)(e?.url)||h(e)},onError:m})},label:(0,x.__)("Drop to upload")})))}const cc=e=>{if(!e||isNaN(e.x)&&isNaN(e.y))return;return`${100*(isNaN(e.x)?.5:e.x)}% ${100*(isNaN(e.y)?.5:e.y)}%`},uc=e=>{if(!e)return{x:void 0,y:void 0};let[t,n]=e.split(" ").map((e=>parseFloat(e)/100));return t=isNaN(t)?void 0:t,n=isNaN(n)?t:n,{x:t,y:n}};function dc({clientId:e,isShownByDefault:t,setAttributes:n}){const o=(0,d.useSelect)((t=>t(Nr).getBlockAttributes(e)?.style),[e]),r=o?.background?.backgroundSize,l=o?.background?.backgroundRepeat,i=void 0!==r&&"cover"!==r&&"contain"!==r||""===r?"auto":r||"cover",a="no-repeat"!==l&&("cover"!==i||void 0!==l),c=function(e){return void 0!==e?.background?.backgroundPosition||void 0!==e?.background?.backgroundSize}(o),p=(0,u.useCallback)((e=>({...e,style:{...e.style,background:{...e.style?.background,backgroundRepeat:void 0,backgroundSize:void 0}}})),[]),m=e=>{let t=l;"contain"===e&&(t="no-repeat"),"cover"!==i&&"contain"!==i||"auto"!==e||(t=void 0),n({style:hl({...o,background:{...o?.background,backgroundRepeat:t,backgroundSize:e}})})};return(0,s.createElement)(_l.__experimentalVStack,{as:_l.__experimentalToolsPanelItem,spacing:2,className:"single-column",hasValue:()=>c,label:(0,x.__)("Size"),onDeselect:()=>function(e={},t){t({style:hl({...e,background:{...e?.background,backgroundPosition:void 0,backgroundRepeat:void 0,backgroundSize:void 0}})})}(o,n),isShownByDefault:t,resetAllFilter:p,panelId:e},(0,s.createElement)(_l.FocalPointPicker,{__next40pxDefaultSize:!0,label:(0,x.__)("Position"),url:o?.background?.backgroundImage?.url,value:uc(o?.background?.backgroundPosition),onChange:e=>{n({style:hl({...o,background:{...o?.background,backgroundPosition:cc(e)}})})}}),(0,s.createElement)(_l.__experimentalToggleGroupControl,{size:"__unstable-large",label:(0,x.__)("Size"),value:i,onChange:m,isBlock:!0,help:(h=r,"cover"===h||void 0===h?(0,x.__)("Image covers the space evenly."):"contain"===h?(0,x.__)("Image is contained without distortion."):(0,x.__)("Specify a fixed width."))},(0,s.createElement)(_l.__experimentalToggleGroupControlOption,{key:"cover",value:"cover",label:(0,x.__)("Cover")}),(0,s.createElement)(_l.__experimentalToggleGroupControlOption,{key:"contain",value:"contain",label:(0,x.__)("Contain")}),(0,s.createElement)(_l.__experimentalToggleGroupControlOption,{key:"fixed",value:"auto",label:(0,x.__)("Fixed")})),void 0!==r&&"cover"!==r&&"contain"!==r?(0,s.createElement)(_l.__experimentalUnitControl,{size:"__unstable-large",onChange:m,value:r}):null,"cover"!==i&&(0,s.createElement)(_l.ToggleControl,{label:(0,x.__)("Repeat"),checked:a,onChange:()=>{n({style:hl({...o,background:{...o?.background,backgroundRepeat:!0===a?"no-repeat":void 0}})})}}));var h}function pc(e){const[t,n]=Ar("background.backgroundImage","background.backgroundSize");if(!t||!rc(e.name,"backgroundImage"))return null;const o=!(!n||!rc(e.name,"backgroundSize")),r=(0,c.getBlockSupport)(e.name,[tc,"__experimentalDefaultControls"]);return(0,s.createElement)(Bs,{group:"background"},(0,s.createElement)(ac,{isShownByDefault:r?.backgroundImage,...e}),o&&(0,s.createElement)(dc,{isShownByDefault:r?.backgroundSize,...e}))}var mc={grad:.9,turn:360,rad:360/(2*Math.PI)},hc=function(e){return"string"==typeof e?e.length>0:"number"==typeof e},gc=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},fc=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),e>n?n:e>t?e:t},bc=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},vc=function(e){return{r:fc(e.r,0,255),g:fc(e.g,0,255),b:fc(e.b,0,255),a:fc(e.a)}},kc=function(e){return{r:gc(e.r),g:gc(e.g),b:gc(e.b),a:gc(e.a,3)}},_c=/^#([0-9a-f]{3,8})$/i,yc=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},Ec=function(e){var t=e.r,n=e.g,o=e.b,r=e.a,l=Math.max(t,n,o),i=l-Math.min(t,n,o),s=i?l===t?(n-o)/i:l===n?2+(o-t)/i:4+(t-n)/i:0;return{h:60*(s<0?s+6:s),s:l?i/l*100:0,v:l/255*100,a:r}},wc=function(e){var t=e.h,n=e.s,o=e.v,r=e.a;t=t/360*6,n/=100,o/=100;var l=Math.floor(t),i=o*(1-n),s=o*(1-(t-l)*n),a=o*(1-(1-t+l)*n),c=l%6;return{r:255*[o,s,i,i,a,o][c],g:255*[a,o,o,s,i,i][c],b:255*[i,i,a,o,o,s][c],a:r}},Sc=function(e){return{h:bc(e.h),s:fc(e.s,0,100),l:fc(e.l,0,100),a:fc(e.a)}},Cc=function(e){return{h:gc(e.h),s:gc(e.s),l:gc(e.l),a:gc(e.a,3)}},xc=function(e){return wc((n=(t=e).s,{h:t.h,s:(n*=((o=t.l)<50?o:100-o)/100)>0?2*n/(o+n)*100:0,v:o+n,a:t.a}));var t,n,o},Bc=function(e){return{h:(t=Ec(e)).h,s:(r=(200-(n=t.s))*(o=t.v)/100)>0&&r<200?n*o/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,n,o,r},Ic=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Tc=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Mc=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Pc=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Rc={string:[[function(e){var t=_c.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?gc(parseInt(e[3]+e[3],16)/255,2):1}:6===e.length||8===e.length?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:8===e.length?gc(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=Mc.exec(e)||Pc.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:vc({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=Ic.exec(e)||Tc.exec(e);if(!t)return null;var n,o,r=Sc({h:(n=t[1],o=t[2],void 0===o&&(o="deg"),Number(n)*(mc[o]||1)),s:Number(t[3]),l:Number(t[4]),a:void 0===t[5]?1:Number(t[5])/(t[6]?100:1)});return xc(r)},"hsl"]],object:[[function(e){var t=e.r,n=e.g,o=e.b,r=e.a,l=void 0===r?1:r;return hc(t)&&hc(n)&&hc(o)?vc({r:Number(t),g:Number(n),b:Number(o),a:Number(l)}):null},"rgb"],[function(e){var t=e.h,n=e.s,o=e.l,r=e.a,l=void 0===r?1:r;if(!hc(t)||!hc(n)||!hc(o))return null;var i=Sc({h:Number(t),s:Number(n),l:Number(o),a:Number(l)});return xc(i)},"hsl"],[function(e){var t=e.h,n=e.s,o=e.v,r=e.a,l=void 0===r?1:r;if(!hc(t)||!hc(n)||!hc(o))return null;var i=function(e){return{h:bc(e.h),s:fc(e.s,0,100),v:fc(e.v,0,100),a:fc(e.a)}}({h:Number(t),s:Number(n),v:Number(o),a:Number(l)});return wc(i)},"hsv"]]},Nc=function(e,t){for(var n=0;n=.5},e.prototype.toHex=function(){return t=(e=kc(this.rgba)).r,n=e.g,o=e.b,l=(r=e.a)<1?yc(gc(255*r)):"","#"+yc(t)+yc(n)+yc(o)+l;var e,t,n,o,r,l},e.prototype.toRgb=function(){return kc(this.rgba)},e.prototype.toRgbString=function(){return t=(e=kc(this.rgba)).r,n=e.g,o=e.b,(r=e.a)<1?"rgba("+t+", "+n+", "+o+", "+r+")":"rgb("+t+", "+n+", "+o+")";var e,t,n,o,r},e.prototype.toHsl=function(){return Cc(Bc(this.rgba))},e.prototype.toHslString=function(){return t=(e=Cc(Bc(this.rgba))).h,n=e.s,o=e.l,(r=e.a)<1?"hsla("+t+", "+n+"%, "+o+"%, "+r+")":"hsl("+t+", "+n+"%, "+o+"%)";var e,t,n,o,r},e.prototype.toHsv=function(){return e=Ec(this.rgba),{h:gc(e.h),s:gc(e.s),v:gc(e.v),a:gc(e.a,3)};var e},e.prototype.invert=function(){return Vc({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return void 0===e&&(e=.1),Vc(Ac(this.rgba,e))},e.prototype.desaturate=function(e){return void 0===e&&(e=.1),Vc(Ac(this.rgba,-e))},e.prototype.grayscale=function(){return Vc(Ac(this.rgba,-1))},e.prototype.lighten=function(e){return void 0===e&&(e=.1),Vc(Dc(this.rgba,e))},e.prototype.darken=function(e){return void 0===e&&(e=.1),Vc(Dc(this.rgba,-e))},e.prototype.rotate=function(e){return void 0===e&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return"number"==typeof e?Vc({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):gc(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=Bc(this.rgba);return"number"==typeof e?Vc({h:e,s:t.s,l:t.l,a:t.a}):gc(t.h)},e.prototype.isEqual=function(e){return this.toHex()===Vc(e).toHex()},e}(),Vc=function(e){return e instanceof zc?e:new zc(e)},Fc=[],Hc=function(e){e.forEach((function(e){Fc.indexOf(e)<0&&(e(zc,Rc),Fc.push(e))}))};function Gc(e,t){var n={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},o={};for(var r in n)o[n[r]]=r;var l={};e.prototype.toName=function(t){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var r,i,s=o[this.toHex()];if(s)return s;if(null==t?void 0:t.closest){var a=this.toRgb(),c=1/0,u="black";if(!l.length)for(var d in n)l[d]=new e(n[d]).toRgb();for(var p in n){var m=(r=a,i=l[p],Math.pow(r.r-i.r,2)+Math.pow(r.g-i.g,2)+Math.pow(r.b-i.b,2));m(a=$c(i))?(s+.05)/(a+.05):(a+.05)/(s+.05),void 0===(o=2)&&(o=0),void 0===r&&(r=Math.pow(10,o)),Math.floor(r*n)/r+0},e.prototype.isReadable=function(e,t){return void 0===e&&(e="#FFF"),void 0===t&&(t={}),this.contrast(e)>=(i=void 0===(l=(n=t).size)?"normal":l,"AAA"===(r=void 0===(o=n.level)?"AA":o)&&"normal"===i?7:"AA"===r&&"large"===i?3:4.5);var n,o,r,l,i}}Hc([Gc,jc]);const Wc=(e,t,n)=>{if(t){const n=e?.find((e=>e.slug===t));if(n)return n}return{color:n}},Kc=(e,t)=>e?.find((e=>e.color===t));function Zc(e,t){if(!e||!t)return;const{kebabCase:n}=ie(_l.privateApis);return`has-${n(t)}-${e}`}function qc(){const[e,t,n,o,r,l,i,s,a,c]=Ar("color.custom","color.palette.custom","color.palette.theme","color.palette.default","color.defaultPalette","color.customGradient","color.gradients.custom","color.gradients.theme","color.gradients.default","color.defaultGradients"),d={disableCustomColors:!e,disableCustomGradients:!l};return d.colors=(0,u.useMemo)((()=>{const e=[];return n&&n.length&&e.push({name:(0,x._x)("Theme","Indicates this palette comes from the theme."),colors:n}),r&&o&&o.length&&e.push({name:(0,x._x)("Default","Indicates this palette comes from WordPress."),colors:o}),t&&t.length&&e.push({name:(0,x._x)("Custom","Indicates this palette comes from the theme."),colors:t}),e}),[t,n,o,r]),d.gradients=(0,u.useMemo)((()=>{const e=[];return s&&s.length&&e.push({name:(0,x._x)("Theme","Indicates this palette comes from the theme."),gradients:s}),c&&a&&a.length&&e.push({name:(0,x._x)("Default","Indicates this palette comes from WordPress."),gradients:a}),i&&i.length&&e.push({name:(0,x._x)("Custom","Indicates this palette is created by the user."),gradients:i}),e}),[i,s,a,c]),d.hasColorsOrGradients=!!d.colors.length||!!d.gradients.length,d}function Yc(e){return[...e].sort(((t,n)=>e.filter((e=>e===n)).length-e.filter((e=>e===t)).length)).shift()}function Xc(e={}){const{flat:t,...n}=e;return t||Yc(Object.values(n).filter(Boolean))||"px"}function Qc(e={}){if("string"==typeof e)return e;const t=Object.values(e).map((e=>(0,_l.__experimentalParseQuantityAndUnitFromRawValue)(e))),n=t.map((e=>{var t;return null!==(t=e[0])&&void 0!==t?t:""})),o=t.map((e=>e[1])),r=n.every((e=>e===n[0]))?n[0]:"",l=Yc(o);return 0===r||r?`${r}${l}`:void 0}function Jc(e={}){const t=Qc(e);return"string"!=typeof e&&isNaN(parseFloat(t))}function eu(e){if(!e)return!1;if("string"==typeof e)return!0;return!!Object.values(e).filter((e=>!!e||0===e)).length}function tu({onChange:e,selectedUnits:t,setSelectedUnits:n,values:o,...r}){let l=Qc(o);void 0===l&&(l=Xc(t));const i=eu(o)&&Jc(o),a=i?(0,x.__)("Mixed"):null;return(0,s.createElement)(_l.__experimentalUnitControl,{...r,"aria-label":(0,x.__)("Border radius"),disableUnits:i,isOnly:!0,value:l,onChange:t=>{const n=!isNaN(parseFloat(t));e(n?t:void 0)},onUnitChange:e=>{n({topLeft:e,topRight:e,bottomLeft:e,bottomRight:e})},placeholder:a,size:"__unstable-large"})}const nu={topLeft:(0,x.__)("Top left"),topRight:(0,x.__)("Top right"),bottomLeft:(0,x.__)("Bottom left"),bottomRight:(0,x.__)("Bottom right")};function ou({onChange:e,selectedUnits:t,setSelectedUnits:n,values:o,...r}){const l=t=>n=>{if(!e)return;const o=!isNaN(parseFloat(n))?n:void 0;e({...i,[t]:o})},i="string"!=typeof o?o:{topLeft:o,topRight:o,bottomLeft:o,bottomRight:o};return(0,s.createElement)("div",{className:"components-border-radius-control__input-controls-wrapper"},Object.entries(nu).map((([e,o])=>{const[a,c]=(0,_l.__experimentalParseQuantityAndUnitFromRawValue)(i[e]),u=i[e]?c:t[e]||t.flat;return(0,s.createElement)(_l.Tooltip,{text:o,placement:"top",key:e},(0,s.createElement)("div",{className:"components-border-radius-control__tooltip-wrapper"},(0,s.createElement)(_l.__experimentalUnitControl,{...r,"aria-label":o,value:[a,u].join(""),onChange:l(e),onUnitChange:(d=e,e=>{const o={...t};o[d]=e,n(o)}),size:"__unstable-large"})));var d})))}const ru=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z"}));function lu({isLinked:e,...t}){const n=e?(0,x.__)("Unlink radii"):(0,x.__)("Link radii");return(0,s.createElement)(_l.Tooltip,{text:n},(0,s.createElement)(_l.Button,{...t,className:"component-border-radius-control__linked-button",size:"small",icon:e?ru:Aa,iconSize:24,"aria-label":n}))}const iu={topLeft:void 0,topRight:void 0,bottomLeft:void 0,bottomRight:void 0},su=0,au={px:100,em:20,rem:20};function cu({onChange:e,values:t}){const[n,o]=(0,u.useState)(!eu(t)||!Jc(t)),[r,l]=(0,u.useState)({flat:"string"==typeof t?(0,_l.__experimentalParseQuantityAndUnitFromRawValue)(t)[1]:void 0,topLeft:(0,_l.__experimentalParseQuantityAndUnitFromRawValue)(t?.topLeft)[1],topRight:(0,_l.__experimentalParseQuantityAndUnitFromRawValue)(t?.topRight)[1],bottomLeft:(0,_l.__experimentalParseQuantityAndUnitFromRawValue)(t?.bottomLeft)[1],bottomRight:(0,_l.__experimentalParseQuantityAndUnitFromRawValue)(t?.bottomRight)[1]}),[i]=Ar("spacing.units"),a=(0,_l.__experimentalUseCustomUnits)({availableUnits:i||["px","em","rem"]}),c=Xc(r),d=a&&a.find((e=>e.value===c)),p=d?.step||1,[m]=(0,_l.__experimentalParseQuantityAndUnitFromRawValue)(Qc(t));return(0,s.createElement)("fieldset",{className:"components-border-radius-control"},(0,s.createElement)(_l.BaseControl.VisualLabel,{as:"legend"},(0,x.__)("Radius")),(0,s.createElement)("div",{className:"components-border-radius-control__wrapper"},n?(0,s.createElement)(s.Fragment,null,(0,s.createElement)(tu,{className:"components-border-radius-control__unit-control",values:t,min:su,onChange:e,selectedUnits:r,setSelectedUnits:l,units:a}),(0,s.createElement)(_l.RangeControl,{label:(0,x.__)("Border radius"),hideLabelFromVision:!0,className:"components-border-radius-control__range-control",value:null!=m?m:"",min:su,max:au[c],initialPosition:0,withInputField:!1,onChange:t=>{e(void 0!==t?`${t}${c}`:void 0)},step:p,__nextHasNoMarginBottom:!0})):(0,s.createElement)(ou,{min:su,onChange:e,selectedUnits:r,setSelectedUnits:l,values:t||iu,units:a}),(0,s.createElement)(lu,{onClick:()=>o(!n),isLinked:n})))}const uu=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})),du=(0,s.createElement)(Z.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(Z.Path,{d:"M12 8c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm0 6.5c-1.4 0-2.5-1.1-2.5-2.5s1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5-1.1 2.5-2.5 2.5zM12.8 3h-1.5v3h1.5V3zm-1.6 18h1.5v-3h-1.5v3zm6.8-9.8v1.5h3v-1.5h-3zm-12 0H3v1.5h3v-1.5zm9.7 5.6 2.1 2.1 1.1-1.1-2.1-2.1-1.1 1.1zM8.3 7.2 6.2 5.1 5.1 6.2l2.1 2.1 1.1-1.1zM5.1 17.8l1.1 1.1 2.1-2.1-1.1-1.1-2.1 2.1zM18.9 6.2l-1.1-1.1-2.1 2.1 1.1 1.1 2.1-2.1z"})),pu=[];function mu({shadow:e,onShadowChange:t,settings:n}){const o=bu(n);return(0,s.createElement)("div",{className:"block-editor-global-styles__shadow-popover-container"},(0,s.createElement)(_l.__experimentalVStack,{spacing:4},(0,s.createElement)(_l.__experimentalHeading,{level:5},(0,x.__)("Drop shadow")),(0,s.createElement)(hu,{presets:o,activeShadow:e,onSelect:t}),(0,s.createElement)("div",{className:"block-editor-global-styles__clear-shadow"},(0,s.createElement)(_l.Button,{variant:"tertiary",onClick:()=>t(void 0)},(0,x.__)("Clear")))))}function hu({presets:e,activeShadow:t,onSelect:n}){const{CompositeV2:o,useCompositeStoreV2:r}=ie(_l.privateApis),l=r();return e?(0,s.createElement)(o,{store:l,role:"listbox",className:"block-editor-global-styles__shadow__list","aria-label":(0,x.__)("Drop shadows")},e.map((({name:e,slug:o,shadow:r})=>(0,s.createElement)(gu,{key:o,label:e,isActive:r===t,type:"unset"===o?"unset":"preset",onSelect:()=>n(r===t?void 0:r),shadow:r})))):null}function gu({type:e,label:t,isActive:n,onSelect:o,shadow:r}){const{CompositeItemV2:l}=ie(_l.privateApis);return(0,s.createElement)(l,{role:"option","aria-label":t,"aria-selected":n,className:ml()("block-editor-global-styles__shadow__item",{"is-active":n}),render:(0,s.createElement)(_l.Button,{className:ml()("block-editor-global-styles__shadow-indicator",{unset:"unset"===e}),onClick:o,label:t,style:{boxShadow:r},showTooltip:!0},n&&(0,s.createElement)(Ti,{icon:uu}))})}function fu({shadow:e,onShadowChange:t,settings:n}){return(0,s.createElement)(_l.Dropdown,{popoverProps:{placement:"left-start",offset:36,shift:!0},className:"block-editor-global-styles__shadow-dropdown",renderToggle:({onToggle:e,isOpen:t})=>{const n={onClick:e,className:ml()({"is-open":t}),"aria-expanded":t};return(0,s.createElement)(_l.Button,{...n},(0,s.createElement)(_l.__experimentalHStack,{justify:"flex-start"},(0,s.createElement)(Ti,{className:"block-editor-global-styles__toggle-icon",icon:du,size:24}),(0,s.createElement)(_l.FlexItem,null,(0,x.__)("Drop shadow"))))},renderContent:()=>(0,s.createElement)(_l.__experimentalDropdownContentWrapper,{paddingSize:"medium"},(0,s.createElement)(mu,{shadow:e,onShadowChange:t,settings:n}))})}function bu(e){return(0,u.useMemo)((()=>{var t;if(!e?.shadow)return pu;const n=e?.shadow?.defaultPresets,{default:o,theme:r}=null!==(t=e?.shadow?.presets)&&void 0!==t?t:{},l={name:(0,x.__)("Unset"),slug:"unset",shadow:"none"},i=[...n&&o||pu,...r||pu];return i.length&&i.unshift(l),i}),[e])}function vu(e){return Object.values(ku(e)).some(Boolean)}function ku(e){return{hasBorderColor:_u(e),hasBorderRadius:yu(e),hasBorderStyle:Eu(e),hasBorderWidth:wu(e),hasShadow:Su(e)}}function _u(e){return e?.border?.color}function yu(e){return e?.border?.radius}function Eu(e){return e?.border?.style}function wu(e){return e?.border?.width}function Su(e){const t=bu(e);return!!e?.shadow&&t.length>0}function Cu({resetAllFilter:e,onChange:t,value:n,panelId:o,children:r,label:l}){return(0,s.createElement)(_l.__experimentalToolsPanel,{label:l,resetAll:()=>{const o=e(n);t(o)},panelId:o,dropdownMenuProps:Qr},r)}const xu={radius:!0,color:!0,width:!0,shadow:!1};function Bu({as:e=Cu,value:t,onChange:n,inheritedValue:o=t,settings:r,panelId:l,name:i,defaultControls:a=xu}){var c,d;const p=ul(r),m=(0,u.useCallback)((e=>el({settings:r},"",e)),[r]),h=e=>{const t=p.flatMap((({colors:e})=>e)).find((({color:t})=>t===e));return t?"var:preset|color|"+t.slug:e},g=(0,u.useMemo)((()=>{if((0,_l.__experimentalHasSplitBorders)(o?.border)){const e={...o?.border};return["top","right","bottom","left"].forEach((t=>{e[t]={...e[t],color:m(e[t]?.color)}})),e}return{...o?.border,color:o?.border?.color?m(o?.border?.color):void 0}}),[o?.border,m]),f=e=>n({...t,border:e}),b=_u(r),v=Eu(r),k=wu(r),_=yu(r),y=m(g?.radius),E=e=>f({...g,radius:e}),w=()=>{const e=t?.border?.radius;return"object"==typeof e?Object.entries(e).some(Boolean):!!e},S=Su(r),C=m(o?.shadow),B=null!==(d=Qn(null!==(c=r?.shadow?.presets)&&void 0!==c?c:{}))&&void 0!==d?d:[],I=e=>{const o=B?.find((({shadow:t})=>t===e))?.slug;n(jn(t,["shadow"],o?`var:preset|shadow|${o}`:e||void 0))},T=(0,u.useCallback)((e=>({...e,border:void 0,shadow:void 0})),[]),M=a?.color||a?.width,P=b||v||k||_,R=zu({blockName:i,hasShadowControl:S,hasBorderControl:P});return(0,s.createElement)(e,{resetAllFilter:T,value:t,onChange:n,panelId:l,label:R},(k||b)&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{hasValue:()=>(0,_l.__experimentalIsDefinedBorder)(t?.border),label:(0,x.__)("Border"),onDeselect:()=>(()=>{if(w())return f({radius:t?.border?.radius});f(void 0)})(),isShownByDefault:M,panelId:l},(0,s.createElement)(_l.__experimentalBorderBoxControl,{colors:p,enableAlpha:!0,enableStyle:v,onChange:e=>{const t={...e};(0,_l.__experimentalHasSplitBorders)(t)?["top","right","bottom","left"].forEach((e=>{t[e]&&(t[e]={...t[e],color:h(t[e]?.color)})})):t&&(t.color=h(t.color)),f({radius:g?.radius,...t})},popoverOffset:40,popoverPlacement:"left-start",value:g,__experimentalIsRenderedInSidebar:!0,size:"__unstable-large",hideLabelFromVision:!S,label:(0,x.__)("Border")})),_&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{hasValue:w,label:(0,x.__)("Radius"),onDeselect:()=>E(void 0),isShownByDefault:a.radius,panelId:l},(0,s.createElement)(cu,{values:y,onChange:e=>{E(e||void 0)}})),S&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{label:(0,x.__)("Shadow"),hasValue:()=>!!t?.shadow,onDeselect:()=>I(void 0),isShownByDefault:a.shadow,panelId:l},P?(0,s.createElement)(_l.BaseControl.VisualLabel,{as:"legend"},(0,x.__)("Shadow")):null,(0,s.createElement)(_l.__experimentalItemGroup,{isBordered:!0,isSeparated:!0},(0,s.createElement)(fu,{shadow:C,onShadowChange:I,settings:r}))))}const Iu="__experimentalBorder",Tu="shadow",Mu=(e,t,n)=>{let o;return e.some((e=>e.colors.some((e=>e[t]===n&&(o=e,!0))))),o},Pu=({colors:e,namedColor:t,customColor:n})=>{if(t){const n=Mu(e,"slug",t);if(n)return n}if(!n)return{color:void 0};const o=Mu(e,"color",n);return o||{color:n}};function Ru(e){const t=/var:preset\|color\|(.+)/.exec(e);return t&&t[1]?t[1]:null}function Nu(e){if((0,_l.__experimentalHasSplitBorders)(e?.border))return{style:e,borderColor:void 0};const t=e?.border?.color,n=t?.startsWith("var:preset|color|")?t.substring(17):void 0,o={...e};return o.border={...o.border,color:n?void 0:t},{style:hl(o),borderColor:n}}function Lu(e){return(0,_l.__experimentalHasSplitBorders)(e.style?.border)?e.style:{...e.style,border:{...e.style?.border,color:e.borderColor?"var:preset|color|"+e.borderColor:e.style?.border?.color}}}function Au({label:e,children:t,resetAllFilter:n}){const o=(0,u.useCallback)((e=>{const t=Lu(e),o=n(t);return{...e,...Nu(o)}}),[n]);return(0,s.createElement)(Bs,{group:"border",resetAllFilter:o,label:e},t)}function Ou({clientId:e,name:t,setAttributes:n,settings:o}){const r=vu(o);const{style:l,borderColor:i}=(0,d.useSelect)((function(t){const{style:n,borderColor:o}=t(Nr).getBlockAttributes(e)||{};return{style:n,borderColor:o}}),[e]),a=(0,u.useMemo)((()=>Lu({style:l,borderColor:i})),[l,i]);if(!r)return null;const p={...(0,c.getBlockSupport)(t,[Iu,"__experimentalDefaultControls"]),...(0,c.getBlockSupport)(t,[Tu,"__experimentalDefaultControls"])};return(0,s.createElement)(Bu,{as:Au,panelId:e,settings:o,value:a,onChange:e=>{n(Nu(e))},defaultControls:p})}function Du(e,t="any"){if("web"!==u.Platform.OS)return!1;const n=(0,c.getBlockSupport)(e,Iu);return!0===n||("any"===t?!!(n?.color||n?.radius||n?.width||n?.style):!!n?.[t])}function zu({blockName:e,hasBorderControl:t,hasShadowControl:n}={}){const o=ku(vl(e));return t||n||!e||(t=o?.hasBorderColor||o?.hasBorderStyle||o?.hasBorderWidth||o?.hasBorderRadius,n=o?.hasShadow),t&&n?(0,x.__)("Border & Shadow"):n?(0,x.__)("Shadow"):(0,x.__)("Border")}function Vu(e,t,n){if(!Du(t,"color")||fl(t,Iu,"color"))return e;const o=Fu(n),r=ml()(e.className,o);return e.className=r||void 0,e}function Fu(e){const{borderColor:t,style:n}=e,o=Zc("border-color",t);return ml()({"has-border-color":t||n?.border?.color,[o]:!!o})}const Hu={useBlockProps:function({name:e,borderColor:t,style:n}){const{colors:o}=qc();if(!Du(e,"color")||fl(e,Iu,"color"))return{};const{color:r}=Pu({colors:o,namedColor:t}),{color:l}=Pu({colors:o,namedColor:Ru(n?.border?.top?.color)}),{color:i}=Pu({colors:o,namedColor:Ru(n?.border?.right?.color)}),{color:s}=Pu({colors:o,namedColor:Ru(n?.border?.bottom?.color)}),{color:a}=Pu({colors:o,namedColor:Ru(n?.border?.left?.color)});return Vu({style:hl({borderTopColor:l||r,borderRightColor:i||r,borderBottomColor:s||r,borderLeftColor:a||r})||{}},e,{borderColor:t,style:n})},addSaveProps:Vu,attributeKeys:["borderColor","style"],hasSupport:e=>Du(e,"color")};function Gu(e){if(e)return`has-${e}-gradient-background`}function Uu(e,t){const n=e?.find((e=>e.slug===t));return n&&n.gradient}function $u(e,t){const n=e?.find((e=>e.gradient===t));return n}function ju(e,t){const n=$u(e,t);return n&&n.slug}function Wu({gradientAttribute:e="gradient",customGradientAttribute:t="customGradient"}={}){const{clientId:n}=y(),[o,r,l]=Ar("color.gradients.custom","color.gradients.theme","color.gradients.default"),i=(0,u.useMemo)((()=>[...o||[],...r||[],...l||[]]),[o,r,l]),{gradient:s,customGradient:a}=(0,d.useSelect)((o=>{const{getBlockAttributes:r}=o(Nr),l=r(n)||{};return{customGradient:l[t],gradient:l[e]}}),[n,e,t]),{updateBlockAttributes:c}=(0,d.useDispatch)(Nr),p=(0,u.useCallback)((o=>{const r=ju(i,o);c(n,r?{[e]:r,[t]:void 0}:{[e]:void 0,[t]:o})}),[i,n,c]),m=Gu(s);let h;return h=s?Uu(i,s):a,{gradientClass:m,gradientValue:h,setGradient:p}}(0,m.addFilter)("blocks.registerBlockType","core/border/addAttributes",(function(e){return Du(e,"color")?e.attributes.borderColor?e:{...e,attributes:{...e.attributes,borderColor:{type:"string"}}}:e}));const Ku=["colors","disableCustomColors","gradients","disableCustomGradients"],Zu={color:"color",gradient:"gradient"};function qu({colors:e,gradients:t,disableCustomColors:n,disableCustomGradients:o,__experimentalIsRenderedInSidebar:r,className:l,label:i,onColorChange:a,onGradientChange:c,colorValue:u,gradientValue:d,clearable:p,showTitle:m=!0,enableAlpha:h,headingLevel:g}){const f=a&&(e&&e.length>0||!n),b=c&&(t&&t.length>0||!o);if(!f&&!b)return null;const v={[Zu.color]:(0,s.createElement)(_l.ColorPalette,{value:u,onChange:b?e=>{a(e),c()}:a,colors:e,disableCustomColors:n,__experimentalIsRenderedInSidebar:r,clearable:p,enableAlpha:h,headingLevel:g}),[Zu.gradient]:(0,s.createElement)(_l.GradientPicker,{value:d,onChange:f?e=>{c(e),a()}:c,gradients:t,disableCustomGradients:o,__experimentalIsRenderedInSidebar:r,clearable:p,headingLevel:g})},k=e=>(0,s.createElement)("div",{className:"block-editor-color-gradient-control__panel"},v[e]),{Tabs:_}=ie(_l.privateApis);return(0,s.createElement)(_l.BaseControl,{__nextHasNoMarginBottom:!0,className:ml()("block-editor-color-gradient-control",l)},(0,s.createElement)("fieldset",{className:"block-editor-color-gradient-control__fieldset"},(0,s.createElement)(_l.__experimentalVStack,{spacing:1},m&&(0,s.createElement)("legend",null,(0,s.createElement)("div",{className:"block-editor-color-gradient-control__color-indicator"},(0,s.createElement)(_l.BaseControl.VisualLabel,null,i))),f&&b&&(0,s.createElement)("div",null,(0,s.createElement)(_,{initialTabId:d?Zu.gradient:!!f&&Zu.color},(0,s.createElement)(_.TabList,null,(0,s.createElement)(_.Tab,{tabId:Zu.color},(0,x.__)("Solid")),(0,s.createElement)(_.Tab,{tabId:Zu.gradient},(0,x.__)("Gradient"))),(0,s.createElement)(_.TabPanel,{tabId:Zu.color,className:"block-editor-color-gradient-control__panel",focusable:!1},v.color),(0,s.createElement)(_.TabPanel,{tabId:Zu.gradient,className:"block-editor-color-gradient-control__panel",focusable:!1},v.gradient))),!b&&k(Zu.color),!f&&k(Zu.gradient))))}function Yu(e){const[t,n,o,r]=Ar("color.palette","color.gradients","color.custom","color.customGradient");return(0,s.createElement)(qu,{colors:t,gradients:n,disableCustomColors:!o,disableCustomGradients:!r,...e})}const Xu=function(e){return Ku.every((t=>e.hasOwnProperty(t)))?(0,s.createElement)(qu,{...e}):(0,s.createElement)(Yu,{...e})};function Qu(e){const t=Ju(e),n=rd(e),o=ed(e),r=nd(e),l=od(e),i=td(e);return t||n||o||r||l||i}function Ju(e){const t=ul(e);return e?.color?.text&&(t?.length>0||e?.color?.custom)}function ed(e){const t=ul(e);return e?.color?.link&&(t?.length>0||e?.color?.custom)}function td(e){const t=ul(e);return e?.color?.caption&&(t?.length>0||e?.color?.custom)}function nd(e){const t=ul(e),n=dl(e);return e?.color?.heading&&(t?.length>0||e?.color?.custom||n?.length>0||e?.color?.customGradient)}function od(e){const t=ul(e),n=dl(e);return e?.color?.button&&(t?.length>0||e?.color?.custom||n?.length>0||e?.color?.customGradient)}function rd(e){const t=ul(e),n=dl(e);return e?.color?.background&&(t?.length>0||e?.color?.custom||n?.length>0||e?.color?.customGradient)}function ld({resetAllFilter:e,onChange:t,value:n,panelId:o,children:r}){return(0,s.createElement)(_l.__experimentalToolsPanel,{label:(0,x.__)("Color"),resetAll:()=>{const o=e(n);t(o)},panelId:o,hasInnerWrapper:!0,className:"color-block-support-panel",__experimentalFirstVisibleItemClass:"first",__experimentalLastVisibleItemClass:"last",dropdownMenuProps:Qr},(0,s.createElement)("div",{className:"color-block-support-panel__inner-wrapper"},r))}const id={text:!0,background:!0,link:!0,heading:!0,button:!0,caption:!0},sd={placement:"left-start",offset:36,shift:!0},ad=({indicators:e,label:t})=>(0,s.createElement)(_l.__experimentalHStack,{justify:"flex-start"},(0,s.createElement)(_l.__experimentalZStack,{isLayered:!1,offset:-8},e.map(((e,t)=>(0,s.createElement)(_l.Flex,{key:t,expanded:!1},(0,s.createElement)(_l.ColorIndicator,{colorValue:e}))))),(0,s.createElement)(_l.FlexItem,{className:"block-editor-panel-color-gradient-settings__color-name",title:t},t));function cd({isGradient:e,inheritedValue:t,userValue:n,setValue:o,colorGradientControlSettings:r}){return(0,s.createElement)(Xu,{...r,showTitle:!1,enableAlpha:!0,__experimentalIsRenderedInSidebar:!0,colorValue:e?void 0:t,gradientValue:e?t:void 0,onColorChange:e?void 0:o,onGradientChange:e?o:void 0,clearable:t===n,headingLevel:3})}function ud({label:e,hasValue:t,resetValue:n,isShownByDefault:o,indicators:r,tabs:l,colorGradientControlSettings:i,panelId:a}){const c=l.find((e=>void 0!==e.userValue)),{Tabs:u}=ie(_l.privateApis);return(0,s.createElement)(_l.__experimentalToolsPanelItem,{className:"block-editor-tools-panel-color-gradient-settings__item",hasValue:t,label:e,onDeselect:n,isShownByDefault:o,panelId:a},(0,s.createElement)(_l.Dropdown,{popoverProps:sd,className:"block-editor-tools-panel-color-gradient-settings__dropdown",renderToggle:({onToggle:t,isOpen:n})=>{const o={onClick:t,className:ml()("block-editor-panel-color-gradient-settings__dropdown",{"is-open":n}),"aria-expanded":n,"aria-label":(0,x.sprintf)((0,x.__)("Color %s styles"),e)};return(0,s.createElement)(_l.Button,{...o},(0,s.createElement)(ad,{indicators:r,label:e}))},renderContent:()=>(0,s.createElement)(_l.__experimentalDropdownContentWrapper,{paddingSize:"none"},(0,s.createElement)("div",{className:"block-editor-panel-color-gradient-settings__dropdown-content"},1===l.length&&(0,s.createElement)(cd,{...l[0],colorGradientControlSettings:i}),l.length>1&&(0,s.createElement)(u,{initialTabId:c?.key},(0,s.createElement)(u.TabList,null,l.map((e=>(0,s.createElement)(u.Tab,{key:e.key,tabId:e.key},e.label)))),l.map((e=>(0,s.createElement)(u.TabPanel,{key:e.key,tabId:e.key,focusable:!1},(0,s.createElement)(cd,{...e,colorGradientControlSettings:i})))))))}))}function dd({as:e=ld,value:t,onChange:n,inheritedValue:o=t,settings:r,panelId:l,defaultControls:i=id,children:a}){const c=ul(r),d=dl(r),p=r?.color?.custom,m=r?.color?.customGradient,h=c.length>0||p,g=d.length>0||m,f=e=>el({settings:r},"",e),b=e=>{const t=c.flatMap((({colors:e})=>e)).find((({color:t})=>t===e));return t?"var:preset|color|"+t.slug:e},v=e=>{const t=d.flatMap((({gradients:e})=>e)).find((({gradient:t})=>t===e));return t?"var:preset|gradient|"+t.slug:e},k=rd(r),_=f(o?.color?.background),y=f(t?.color?.background),E=f(o?.color?.gradient),w=f(t?.color?.gradient),S=ed(r),C=f(o?.elements?.link?.color?.text),B=f(t?.elements?.link?.color?.text),I=f(o?.elements?.link?.[":hover"]?.color?.text),T=f(t?.elements?.link?.[":hover"]?.color?.text),M=Ju(r),P=f(o?.color?.text),R=f(t?.color?.text),N=e=>{let o=jn(t,["color","text"],b(e));P===C&&(o=jn(o,["elements","link","color","text"],b(e))),n(o)},L=[{name:"caption",label:(0,x.__)("Captions"),showPanel:td(r)},{name:"button",label:(0,x.__)("Button"),showPanel:od(r)},{name:"heading",label:(0,x.__)("Heading"),showPanel:nd(r)},{name:"h1",label:(0,x.__)("H1"),showPanel:nd(r)},{name:"h2",label:(0,x.__)("H2"),showPanel:nd(r)},{name:"h3",label:(0,x.__)("H3"),showPanel:nd(r)},{name:"h4",label:(0,x.__)("H4"),showPanel:nd(r)},{name:"h5",label:(0,x.__)("H5"),showPanel:nd(r)},{name:"h6",label:(0,x.__)("H6"),showPanel:nd(r)}],A=(0,u.useCallback)((e=>({...e,color:void 0,elements:{...e?.elements,link:{...e?.elements?.link,color:void 0,":hover":{color:void 0}},...L.reduce(((t,n)=>({...t,[n.name]:{...e?.elements?.[n.name],color:void 0}})),{})}})),[]),O=[M&&{key:"text",label:(0,x.__)("Text"),hasValue:()=>!!R,resetValue:()=>N(void 0),isShownByDefault:i.text,indicators:[P],tabs:[{key:"text",label:(0,x.__)("Text"),inheritedValue:P,setValue:N,userValue:R}]},k&&{key:"background",label:(0,x.__)("Background"),hasValue:()=>!!y||!!w,resetValue:()=>{const e=jn(t,["color","background"],void 0);e.color.gradient=void 0,n(e)},isShownByDefault:i.background,indicators:[null!=E?E:_],tabs:[h&&{key:"background",label:(0,x.__)("Solid"),inheritedValue:_,setValue:e=>{const o=jn(t,["color","background"],b(e));o.color.gradient=void 0,n(o)},userValue:y},g&&{key:"gradient",label:(0,x.__)("Gradient"),inheritedValue:E,setValue:e=>{const o=jn(t,["color","gradient"],v(e));o.color.background=void 0,n(o)},userValue:w,isGradient:!0}].filter(Boolean)},S&&{key:"link",label:(0,x.__)("Link"),hasValue:()=>!!B||!!T,resetValue:()=>{let e=jn(t,["elements","link",":hover","color","text"],void 0);e=jn(e,["elements","link","color","text"],void 0),n(e)},isShownByDefault:i.link,indicators:[C,I],tabs:[{key:"link",label:(0,x.__)("Default"),inheritedValue:C,setValue:e=>{n(jn(t,["elements","link","color","text"],b(e)))},userValue:B},{key:"hover",label:(0,x.__)("Hover"),inheritedValue:I,setValue:e=>{n(jn(t,["elements","link",":hover","color","text"],b(e)))},userValue:T}]}].filter(Boolean);return L.forEach((({name:e,label:r,showPanel:l})=>{if(!l)return;const s=f(o?.elements?.[e]?.color?.background),a=f(o?.elements?.[e]?.color?.gradient),c=f(o?.elements?.[e]?.color?.text),u=f(t?.elements?.[e]?.color?.background),d=f(t?.elements?.[e]?.color?.gradient),p=f(t?.elements?.[e]?.color?.text),m="caption"!==e;O.push({key:e,label:r,hasValue:()=>!!(p||u||d),resetValue:()=>{const o=jn(t,["elements",e,"color","background"],void 0);o.elements[e].color.gradient=void 0,o.elements[e].color.text=void 0,n(o)},isShownByDefault:i[e],indicators:m?[c,null!=a?a:s]:[c],tabs:[h&&{key:"text",label:(0,x.__)("Text"),inheritedValue:c,setValue:o=>{n(jn(t,["elements",e,"color","text"],b(o)))},userValue:p},h&&m&&{key:"background",label:(0,x.__)("Background"),inheritedValue:s,setValue:o=>{const r=jn(t,["elements",e,"color","background"],b(o));r.elements[e].color.gradient=void 0,n(r)},userValue:u},g&&m&&{key:"gradient",label:(0,x.__)("Gradient"),inheritedValue:a,setValue:o=>{const r=jn(t,["elements",e,"color","gradient"],v(o));r.elements[e].color.background=void 0,n(r)},userValue:d,isGradient:!0}].filter(Boolean)})})),(0,s.createElement)(e,{resetAllFilter:A,value:t,onChange:n,panelId:l},O.map((e=>(0,s.createElement)(ud,{key:e.key,...e,colorGradientControlSettings:{colors:c,disableCustomColors:!p,gradients:d,disableCustomGradients:!m},panelId:l}))),a)}Hc([Gc,jc]);const pd=function({backgroundColor:e,fallbackBackgroundColor:t,fallbackTextColor:n,fallbackLinkColor:o,fontSize:r,isLargeText:l,textColor:i,linkColor:a,enableAlphaChecker:c=!1}){const u=e||t;if(!u)return null;const d=i||n,p=a||o;if(!d&&!p)return null;const m=[{color:d,description:(0,x.__)("text color")},{color:p,description:(0,x.__)("link color")}],h=Vc(u),g=h.alpha()<1,f=h.brightness(),b={level:"AA",size:l||!1!==l&&r>=24?"large":"small"};let v="",k="";for(const e of m){if(!e.color)continue;const t=Vc(e.color),n=t.isReadable(h,b),o=t.alpha()<1;if(!n){if(g||o)continue;v=f({refs:new Map,callbacks:new Map})),[]);return(0,s.createElement)(md.Provider,{value:t},e)}function gd(e){const{refs:t,callbacks:n}=(0,u.useContext)(md),o=(0,u.useRef)();return(0,u.useLayoutEffect)((()=>(t.set(o,e),()=>{t.delete(o)})),[e]),(0,p.useRefEffect)((t=>{o.current=t,n.forEach(((n,o)=>{e===n&&o(t)}))}),[e])}function fd(e){const{refs:t}=(0,u.useContext)(md),n=(0,u.useRef)();return n.current=e,(0,u.useMemo)((()=>({get current(){let e=null;for(const[o,r]of t.entries())r===n.current&&o.current&&(e=o.current);return e}})),[])}function bd(e){const{callbacks:t}=(0,u.useContext)(md),n=fd(e),[o,r]=(0,u.useState)(null);return(0,u.useLayoutEffect)((()=>{if(e)return t.set(r,e),()=>{t.delete(r)}}),[e]),n.current||o}function vd(e){return e.ownerDocument.defaultView.getComputedStyle(e)}function kd({clientId:e}){const[t,n]=(0,u.useState)(),[o,r]=(0,u.useState)(),[l,i]=(0,u.useState)(),a=fd(e);return(0,u.useEffect)((()=>{if(!a.current)return;r(vd(a.current).color);const e=a.current?.querySelector("a");e&&e.innerText&&i(vd(e).color);let t=a.current,o=vd(t).backgroundColor;for(;"rgba(0, 0, 0, 0)"===o&&t.parentNode&&t.parentNode.nodeType===t.parentNode.ELEMENT_NODE;)t=t.parentNode,o=vd(t).backgroundColor;n(o)})),(0,s.createElement)(pd,{backgroundColor:t,textColor:o,enableAlphaChecker:!0,linkColor:l})}const _d="color",yd=e=>{const t=(0,c.getBlockSupport)(e,_d);return t&&(!0===t.link||!0===t.gradient||!1!==t.background||!1!==t.text)},Ed=e=>{if("web"!==u.Platform.OS)return!1;const t=(0,c.getBlockSupport)(e,_d);return null!==t&&"object"==typeof t&&!!t.link},wd=e=>{const t=(0,c.getBlockSupport)(e,_d);return null!==t&&"object"==typeof t&&!!t.gradients},Sd=e=>{const t=(0,c.getBlockSupport)(e,_d);return t&&!1!==t.background},Cd=e=>{const t=(0,c.getBlockSupport)(e,_d);return t&&!1!==t.text};function xd(e,t,n){if(!yd(t)||fl(t,_d))return e;const o=wd(t),{backgroundColor:r,textColor:l,gradient:i,style:s}=n,a=e=>!fl(t,_d,e),c=a("text")?Zc("color",l):void 0,u=a("gradients")?Gu(i):void 0,d=a("background")?Zc("background-color",r):void 0,p=a("background")||a("gradients"),m=r||s?.color?.background||o&&(i||s?.color?.gradient),h=ml()(e.className,c,u,{[d]:!(o&&s?.color?.gradient||!d),"has-text-color":a("text")&&(l||s?.color?.text),"has-background":p&&m,"has-link-color":a("link")&&s?.elements?.link?.color});return e.className=h||void 0,e}function Bd(e){const t=e?.color?.text,n=t?.startsWith("var:preset|color|")?t.substring(17):void 0,o=e?.color?.background,r=o?.startsWith("var:preset|color|")?o.substring(17):void 0,l=e?.color?.gradient,i=l?.startsWith("var:preset|gradient|")?l.substring(20):void 0,s={...e};return s.color={...s.color,text:n?void 0:t,background:r?void 0:o,gradient:i?void 0:l},{style:hl(s),textColor:n,backgroundColor:r,gradient:i}}function Id(e){return{...e.style,color:{...e.style?.color,text:e.textColor?"var:preset|color|"+e.textColor:e.style?.color?.text,background:e.backgroundColor?"var:preset|color|"+e.backgroundColor:e.style?.color?.background,gradient:e.gradient?"var:preset|gradient|"+e.gradient:e.style?.color?.gradient}}}function Td({children:e,resetAllFilter:t}){const n=(0,u.useCallback)((e=>{const n=Id(e),o=t(n);return{...e,...Bd(o)}}),[t]);return(0,s.createElement)(Bs,{group:"color",resetAllFilter:n},e)}function Md({clientId:e,name:t,setAttributes:n,settings:o}){const r=Qu(o);const{style:l,textColor:i,backgroundColor:a,gradient:p}=(0,d.useSelect)((function(t){const{style:n,textColor:o,backgroundColor:r,gradient:l}=t(Nr).getBlockAttributes(e)||{};return{style:n,textColor:o,backgroundColor:r,gradient:l}}),[e]),m=(0,u.useMemo)((()=>Id({style:l,textColor:i,backgroundColor:a,gradient:p})),[l,i,a,p]);if(!r)return null;const h=(0,c.getBlockSupport)(t,[_d,"__experimentalDefaultControls"]),g="web"===u.Platform.OS&&!m?.color?.gradient&&(o?.color?.text||o?.color?.link)&&!1!==(0,c.getBlockSupport)(t,[_d,"enableContrastChecker"]);return(0,s.createElement)(dd,{as:Td,panelId:e,settings:o,value:m,onChange:e=>{n(Bd(e))},defaultControls:h,enableContrastChecker:!1!==(0,c.getBlockSupport)(t,[_d,"enableContrastChecker"])},g&&(0,s.createElement)(kd,{clientId:e}))}const Pd={useBlockProps:function({name:e,backgroundColor:t,textColor:n,gradient:o,style:r}){const[l,i,s]=Ar("color.palette.custom","color.palette.theme","color.palette.default"),a=(0,u.useMemo)((()=>[...l||[],...i||[],...s||[]]),[l,i,s]);if(!yd(e)||fl(e,_d))return{};const c={};n&&!fl(e,_d,"text")&&(c.color=Wc(a,n)?.color),t&&!fl(e,_d,"background")&&(c.backgroundColor=Wc(a,t)?.color);const d=xd({style:c},e,{textColor:n,backgroundColor:t,gradient:o,style:r}),p=t||r?.color?.background||o||r?.color?.gradient;return{...d,className:ml()(d.className,!p&&ic(r))}},addSaveProps:xd,attributeKeys:["backgroundColor","textColor","gradient","style"],hasSupport:yd},Rd={linkColor:[["style","elements","link","color","text"]],textColor:[["textColor"],["style","color","text"]],backgroundColor:[["backgroundColor"],["style","color","background"]],gradient:[["gradient"],["style","color","gradient"]]};function Nd({value:e="",onChange:t,fontFamilies:n,...o}){const[r]=Ar("typography.fontFamilies");if(n||(n=r),!n||0===n.length)return null;const l=[{value:"",label:(0,x.__)("Default")},...n.map((({fontFamily:e,name:t})=>({value:e,label:t||e})))];return(0,s.createElement)(_l.SelectControl,{label:(0,x.__)("Font"),options:l,value:e,onChange:t,labelPosition:"top",...o})}(0,m.addFilter)("blocks.registerBlockType","core/color/addAttribute",(function(e){return yd(e)?(e.attributes.backgroundColor||Object.assign(e.attributes,{backgroundColor:{type:"string"}}),e.attributes.textColor||Object.assign(e.attributes,{textColor:{type:"string"}}),wd(e)&&!e.attributes.gradient&&Object.assign(e.attributes,{gradient:{type:"string"}}),e):e})),(0,m.addFilter)("blocks.switchToBlockType.transformedBlock","core/color/addTransforms",(function(e,t,n,o){const r=e.name;return gl({linkColor:Ed(r),textColor:Cd(r),backgroundColor:Sd(r),gradient:wd(r)},Rd,e,t,n,o)}));const Ld=[{name:(0,x._x)("Regular","font style"),value:"normal"},{name:(0,x._x)("Italic","font style"),value:"italic"}],Ad=[{name:(0,x._x)("Thin","font weight"),value:"100"},{name:(0,x._x)("Extra Light","font weight"),value:"200"},{name:(0,x._x)("Light","font weight"),value:"300"},{name:(0,x._x)("Regular","font weight"),value:"400"},{name:(0,x._x)("Medium","font weight"),value:"500"},{name:(0,x._x)("Semi Bold","font weight"),value:"600"},{name:(0,x._x)("Bold","font weight"),value:"700"},{name:(0,x._x)("Extra Bold","font weight"),value:"800"},{name:(0,x._x)("Black","font weight"),value:"900"}],Od=(e,t)=>e?t?(0,x.__)("Appearance"):(0,x.__)("Font style"):(0,x.__)("Font weight");function Dd(e){const{onChange:t,hasFontStyles:n=!0,hasFontWeights:o=!0,value:{fontStyle:r,fontWeight:l},...i}=e,a=n||o,c=Od(n,o),d={key:"default",name:(0,x.__)("Default"),style:{fontStyle:void 0,fontWeight:void 0}},p=(0,u.useMemo)((()=>n&&o?(()=>{const e=[d];return Ld.forEach((({name:t,value:n})=>{Ad.forEach((({name:o,value:r})=>{const l="normal"===n?o:(0,x.sprintf)((0,x.__)("%1$s %2$s"),o,t);e.push({key:`${n}-${r}`,name:l,style:{fontStyle:n,fontWeight:r}})}))})),e})():n?(()=>{const e=[d];return Ld.forEach((({name:t,value:n})=>{e.push({key:n,name:t,style:{fontStyle:n,fontWeight:void 0}})})),e})():(()=>{const e=[d];return Ad.forEach((({name:t,value:n})=>{e.push({key:n,name:t,style:{fontStyle:void 0,fontWeight:n}})})),e})()),[e.options]),m=p.find((e=>e.style.fontStyle===r&&e.style.fontWeight===l))||p[0];return a&&(0,s.createElement)(_l.CustomSelectControl,{...i,className:"components-font-appearance-control",label:c,describedBy:m?n?o?(0,x.sprintf)((0,x.__)("Currently selected font appearance: %s"),m.name):(0,x.sprintf)((0,x.__)("Currently selected font style: %s"),m.name):(0,x.sprintf)((0,x.__)("Currently selected font weight: %s"),m.name):(0,x.__)("No selected font appearance"),options:p,value:m,onChange:({selectedItem:e})=>t(e.style),__nextUnconstrainedWidth:!0})}const zd=1.5;const Vd=({value:e,onChange:t,__nextHasNoMarginBottom:n=!1,__unstableInputWidth:o="60px",...r})=>{const l=function(e){return void 0!==e&&""!==e}(e),i=(e,t)=>{if(l)return e;switch(`${e}`){case"0.1":return 1.6;case"0":return t?e:1.4;case"":return zd;default:return e}},a=l?e:"";n||w()("Bottom margin styles for wp.blockEditor.LineHeightControl",{since:"6.0",version:"6.4",hint:"Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version"});const c=n?void 0:{marginBottom:24};return(0,s.createElement)("div",{className:"block-editor-line-height-control",style:c},(0,s.createElement)(_l.__experimentalNumberControl,{...r,__unstableInputWidth:o,__unstableStateReducer:(e,t)=>{const n=["insertText","insertFromPaste"].includes(t.payload.event.nativeEvent?.inputType),o=i(e.value,n);return{...e,value:o}},onChange:(e,{event:n})=>{""!==e?"click"!==n.type?t(`${e}`):t(i(`${e}`,!1)):t()},label:(0,x.__)("Line height"),placeholder:zd,step:.01,spinFactor:10,value:a,min:0,spinControls:"custom"}))};function Fd({value:e,onChange:t,__unstableInputWidth:n="60px",...o}){const[r]=Ar("spacing.units"),l=(0,_l.__experimentalUseCustomUnits)({availableUnits:r||["px","em","rem"],defaultValues:{px:2,em:.2,rem:.2}});return(0,s.createElement)(_l.__experimentalUnitControl,{...o,label:(0,x.__)("Letter spacing"),value:e,__unstableInputWidth:n,units:l,onChange:t})}const Hd=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M7 11.5h10V13H7z"})),Gd=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M6.1 6.8L2.1 18h1.6l1.1-3h4.3l1.1 3h1.6l-4-11.2H6.1zm-.8 6.8L7 8.9l1.7 4.7H5.3zm15.1-.7c-.4-.5-.9-.8-1.6-1 .4-.2.7-.5.8-.9.2-.4.3-.9.3-1.4 0-.9-.3-1.6-.8-2-.6-.5-1.3-.7-2.4-.7h-3.5V18h4.2c1.1 0 2-.3 2.6-.8.6-.6 1-1.4 1-2.4-.1-.8-.3-1.4-.6-1.9zm-5.7-4.7h1.8c.6 0 1.1.1 1.4.4.3.2.5.7.5 1.3 0 .6-.2 1.1-.5 1.3-.3.2-.8.4-1.4.4h-1.8V8.2zm4 8c-.4.3-.9.5-1.5.5h-2.6v-3.8h2.6c1.4 0 2 .6 2 1.9.1.6-.1 1-.5 1.4z"})),Ud=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M11 16.8c-.1-.1-.2-.3-.3-.5v-2.6c0-.9-.1-1.7-.3-2.2-.2-.5-.5-.9-.9-1.2-.4-.2-.9-.3-1.6-.3-.5 0-1 .1-1.5.2s-.9.3-1.2.6l.2 1.2c.4-.3.7-.4 1.1-.5.3-.1.7-.2 1-.2.6 0 1 .1 1.3.4.3.2.4.7.4 1.4-1.2 0-2.3.2-3.3.7s-1.4 1.1-1.4 2.1c0 .7.2 1.2.7 1.6.4.4 1 .6 1.8.6.9 0 1.7-.4 2.4-1.2.1.3.2.5.4.7.1.2.3.3.6.4.3.1.6.1 1.1.1h.1l.2-1.2h-.1c-.4.1-.6 0-.7-.1zM9.2 16c-.2.3-.5.6-.9.8-.3.1-.7.2-1.1.2-.4 0-.7-.1-.9-.3-.2-.2-.3-.5-.3-.9 0-.6.2-1 .7-1.3.5-.3 1.3-.4 2.5-.5v2zm10.6-3.9c-.3-.6-.7-1.1-1.2-1.5-.6-.4-1.2-.6-1.9-.6-.5 0-.9.1-1.4.3-.4.2-.8.5-1.1.8V6h-1.4v12h1.3l.2-1c.2.4.6.6 1 .8.4.2.9.3 1.4.3.7 0 1.2-.2 1.8-.5.5-.4 1-.9 1.3-1.5.3-.6.5-1.3.5-2.1-.1-.6-.2-1.3-.5-1.9zm-1.7 4c-.4.5-.9.8-1.6.8s-1.2-.2-1.7-.7c-.4-.5-.7-1.2-.7-2.1 0-.9.2-1.6.7-2.1.4-.5 1-.7 1.7-.7s1.2.3 1.6.8c.4.5.6 1.2.6 2s-.2 1.4-.6 2z"})),$d=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M7.1 6.8L3.1 18h1.6l1.1-3h4.3l1.1 3h1.6l-4-11.2H7.1zm-.8 6.8L8 8.9l1.7 4.7H6.3zm14.5-1.5c-.3-.6-.7-1.1-1.2-1.5-.6-.4-1.2-.6-1.9-.6-.5 0-.9.1-1.4.3-.4.2-.8.5-1.1.8V6h-1.4v12h1.3l.2-1c.2.4.6.6 1 .8.4.2.9.3 1.4.3.7 0 1.2-.2 1.8-.5.5-.4 1-.9 1.3-1.5.3-.6.5-1.3.5-2.1-.1-.6-.2-1.3-.5-1.9zm-1.7 4c-.4.5-.9.8-1.6.8s-1.2-.2-1.7-.7c-.4-.5-.7-1.2-.7-2.1 0-.9.2-1.6.7-2.1.4-.5 1-.7 1.7-.7s1.2.3 1.6.8c.4.5.6 1.2.6 2 .1.8-.2 1.4-.6 2z"})),jd=[{name:(0,x.__)("None"),value:"none",icon:Hd},{name:(0,x.__)("Uppercase"),value:"uppercase",icon:Gd},{name:(0,x.__)("Lowercase"),value:"lowercase",icon:Ud},{name:(0,x.__)("Capitalize"),value:"capitalize",icon:$d}];function Wd({className:e,value:t,onChange:n}){return(0,s.createElement)("fieldset",{className:ml()("block-editor-text-transform-control",e)},(0,s.createElement)(_l.BaseControl.VisualLabel,{as:"legend"},(0,x.__)("Letter case")),(0,s.createElement)("div",{className:"block-editor-text-transform-control__buttons"},jd.map((e=>(0,s.createElement)(_l.Button,{key:e.value,icon:e.icon,label:e.name,isPressed:e.value===t,onClick:()=>{n(e.value===t?void 0:e.value)}})))))}const Kd=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M7 18v1h10v-1H7zm5-2c1.5 0 2.6-.4 3.4-1.2.8-.8 1.1-2 1.1-3.5V5H15v5.8c0 1.2-.2 2.1-.6 2.8-.4.7-1.2 1-2.4 1s-2-.3-2.4-1c-.4-.7-.6-1.6-.6-2.8V5H7.5v6.2c0 1.5.4 2.7 1.1 3.5.8.9 1.9 1.3 3.4 1.3z"})),Zd=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M9.1 9v-.5c0-.6.2-1.1.7-1.4.5-.3 1.2-.5 2-.5.7 0 1.4.1 2.1.3.7.2 1.4.5 2.1.9l.2-1.9c-.6-.3-1.2-.5-1.9-.7-.8-.1-1.6-.2-2.4-.2-1.5 0-2.7.3-3.6 1-.8.7-1.2 1.5-1.2 2.6V9h2zM20 12H4v1h8.3c.3.1.6.2.8.3.5.2.9.5 1.1.8.3.3.4.7.4 1.2 0 .7-.2 1.1-.8 1.5-.5.3-1.2.5-2.1.5-.8 0-1.6-.1-2.4-.3-.8-.2-1.5-.5-2.2-.8L7 18.1c.5.2 1.2.4 2 .6.8.2 1.6.3 2.4.3 1.7 0 3-.3 3.9-1 .9-.7 1.3-1.6 1.3-2.8 0-.9-.2-1.7-.7-2.2H20v-1z"})),qd=[{name:(0,x.__)("None"),value:"none",icon:Hd},{name:(0,x.__)("Underline"),value:"underline",icon:Kd},{name:(0,x.__)("Strikethrough"),value:"line-through",icon:Zd}];function Yd({value:e,onChange:t,className:n}){return(0,s.createElement)("fieldset",{className:ml()("block-editor-text-decoration-control",n)},(0,s.createElement)(_l.BaseControl.VisualLabel,{as:"legend"},(0,x.__)("Decoration")),(0,s.createElement)("div",{className:"block-editor-text-decoration-control__buttons"},qd.map((n=>(0,s.createElement)(_l.Button,{key:n.value,icon:n.icon,label:n.name,isPressed:n.value===e,onClick:()=>{t(n.value===e?void 0:n.value)}})))))}const Xd=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M8.2 14.4h3.9L13 17h1.7L11 6.5H9.3L5.6 17h1.7l.9-2.6zm2-5.5 1.4 4H8.8l1.4-4zm7.4 7.5-1.3.8.8 1.4H5.5V20h14.3l-2.2-3.6z"})),Qd=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M7 5.6v1.7l2.6.9v3.9L7 13v1.7L17.5 11V9.3L7 5.6zm4.2 6V8.8l4 1.4-4 1.4zm-5.7 5.6V5.5H4v14.3l3.6-2.2-.8-1.3-1.3.9z"})),Jd=[{name:(0,x.__)("Horizontal"),value:"horizontal-tb",icon:Xd},{name:(0,x.__)("Vertical"),value:(0,x.isRTL)()?"vertical-lr":"vertical-rl",icon:Qd}];function ep({className:e,value:t,onChange:n}){return(0,s.createElement)("fieldset",{className:ml()("block-editor-writing-mode-control",e)},(0,s.createElement)(_l.BaseControl.VisualLabel,{as:"legend"},(0,x.__)("Orientation")),(0,s.createElement)("div",{className:"block-editor-writing-mode-control__buttons"},Jd.map((e=>(0,s.createElement)(_l.Button,{key:e.value,icon:e.icon,label:e.name,isPressed:e.value===t,onClick:()=>{n(e.value===t?void 0:e.value)}})))))}const tp=1,np=6;function op(e){const t=lp(e),n=ip(e),o=sp(e),r=ap(e),l=cp(e),i=up(e),s=dp(e),a=pp(e),c=rp(e);return t||n||o||r||l||c||i||s||a}function rp(e){return Jn(e?.typography?.fontSizes)||e?.typography?.customFontSize}function lp(e){return Jn(e?.typography?.fontFamilies)}function ip(e){return e?.typography?.lineHeight}function sp(e){return e?.typography?.fontStyle||e?.typography?.fontWeight}function ap(e){return e?.typography?.letterSpacing}function cp(e){return e?.typography?.textTransform}function up(e){return e?.typography?.textDecoration}function dp(e){return e?.typography?.writingMode}function pp(e){return e?.typography?.textColumns}function mp({resetAllFilter:e,onChange:t,value:n,panelId:o,children:r}){return(0,s.createElement)(_l.__experimentalToolsPanel,{label:(0,x.__)("Typography"),resetAll:()=>{const o=e(n);t(o)},panelId:o,dropdownMenuProps:Qr},r)}const hp={fontFamily:!0,fontSize:!0,fontAppearance:!0,lineHeight:!0,letterSpacing:!0,textTransform:!0,textDecoration:!0,writingMode:!0,textColumns:!0};function gp({as:e=mp,value:t,onChange:n,inheritedValue:o=t,settings:r,panelId:l,defaultControls:i=hp}){var a;const c=e=>el({settings:r},"",e),d=lp(r),p=null!==(a=r?.typography?.fontFamilies)&&void 0!==a?a:{},m=p?function(e){let t=Xn.get(e);return t||(t=["default","theme","custom"].flatMap((t=>{var n;return null!==(n=e[t])&&void 0!==n?n:[]})),Xn.set(e,t)),t}(p):[],h=c(o?.typography?.fontFamily),g=e=>{const o=m?.find((({fontFamily:t})=>t===e))?.slug;n(jn(t,["typography","fontFamily"],o?`var:preset|font-family|${o}`:e||void 0))},f=rp(r),b=!r?.typography?.customFontSize,v=function(e){var t,n;const o=null!==(n=Qn(null!==(t=e?.typography?.fontSizes)&&void 0!==t?t:{}))&&void 0!==n?n:[],r=[];for(const e of o)r.some((({slug:t})=>t===e.slug))||r.push(e);return r}(r),k=c(o?.typography?.fontSize),_=(e,o)=>{n(jn(t,["typography","fontSize"],(o?.slug?`var:preset|font-size|${o?.slug}`:e)||void 0))},y=sp(r),E=function(e){return e?.typography?.fontStyle?e?.typography?.fontWeight?(0,x.__)("Appearance"):(0,x.__)("Font style"):(0,x.__)("Font weight")}(r),w=r?.typography?.fontStyle,S=r?.typography?.fontWeight,C=c(o?.typography?.fontStyle),B=c(o?.typography?.fontWeight),I=({fontStyle:e,fontWeight:o})=>{n({...t,typography:{...t?.typography,fontStyle:e||void 0,fontWeight:o||void 0}})},T=ip(r),M=c(o?.typography?.lineHeight),P=e=>{n(jn(t,["typography","lineHeight"],e||void 0))},R=ap(r),N=c(o?.typography?.letterSpacing),L=e=>{n(jn(t,["typography","letterSpacing"],e||void 0))},A=pp(r),O=c(o?.typography?.textColumns),D=e=>{n(jn(t,["typography","textColumns"],e||void 0))},z=cp(r),V=c(o?.typography?.textTransform),F=e=>{n(jn(t,["typography","textTransform"],e||void 0))},H=up(r),G=c(o?.typography?.textDecoration),U=e=>{n(jn(t,["typography","textDecoration"],e||void 0))},$=dp(r),j=c(o?.typography?.writingMode),W=e=>{n(jn(t,["typography","writingMode"],e||void 0))},K=(0,u.useCallback)((e=>({...e,typography:{}})),[]);return(0,s.createElement)(e,{resetAllFilter:K,value:t,onChange:n,panelId:l},d&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{label:(0,x.__)("Font family"),hasValue:()=>!!t?.typography?.fontFamily,onDeselect:()=>g(void 0),isShownByDefault:i.fontFamily,panelId:l},(0,s.createElement)(Nd,{fontFamilies:m,value:h,onChange:g,size:"__unstable-large",__nextHasNoMarginBottom:!0})),f&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{label:(0,x.__)("Font size"),hasValue:()=>!!t?.typography?.fontSize,onDeselect:()=>_(void 0),isShownByDefault:i.fontSize,panelId:l},(0,s.createElement)(_l.FontSizePicker,{value:k,onChange:_,fontSizes:v,disableCustomFontSizes:b,withReset:!1,withSlider:!0,size:"__unstable-large"})),y&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{className:"single-column",label:E,hasValue:()=>!!t?.typography?.fontStyle||!!t?.typography?.fontWeight,onDeselect:()=>{I({})},isShownByDefault:i.fontAppearance,panelId:l},(0,s.createElement)(Dd,{value:{fontStyle:C,fontWeight:B},onChange:I,hasFontStyles:w,hasFontWeights:S,size:"__unstable-large",__nextHasNoMarginBottom:!0})),T&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{className:"single-column",label:(0,x.__)("Line height"),hasValue:()=>void 0!==t?.typography?.lineHeight,onDeselect:()=>P(void 0),isShownByDefault:i.lineHeight,panelId:l},(0,s.createElement)(Vd,{__nextHasNoMarginBottom:!0,__unstableInputWidth:"auto",value:M,onChange:P,size:"__unstable-large"})),R&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{className:"single-column",label:(0,x.__)("Letter spacing"),hasValue:()=>!!t?.typography?.letterSpacing,onDeselect:()=>L(void 0),isShownByDefault:i.letterSpacing,panelId:l},(0,s.createElement)(Fd,{value:N,onChange:L,size:"__unstable-large",__unstableInputWidth:"auto"})),A&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{className:"single-column",label:(0,x.__)("Text columns"),hasValue:()=>!!t?.typography?.textColumns,onDeselect:()=>D(void 0),isShownByDefault:i.textColumns,panelId:l},(0,s.createElement)(_l.__experimentalNumberControl,{label:(0,x.__)("Text columns"),max:np,min:tp,onChange:D,size:"__unstable-large",spinControls:"custom",value:O,initialPosition:1})),H&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{className:"single-column",label:(0,x.__)("Text decoration"),hasValue:()=>!!t?.typography?.textDecoration,onDeselect:()=>U(void 0),isShownByDefault:i.textDecoration,panelId:l},(0,s.createElement)(Yd,{value:G,onChange:U,size:"__unstable-large",__unstableInputWidth:"auto"})),$&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{className:"single-column",label:(0,x.__)("Text orientation"),hasValue:()=>!!t?.typography?.writingMode,onDeselect:()=>W(void 0),isShownByDefault:i.writingMode,panelId:l},(0,s.createElement)(ep,{value:j,onChange:W,size:"__unstable-large",__nextHasNoMarginBottom:!0})),z&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{label:(0,x.__)("Letter case"),hasValue:()=>!!t?.typography?.textTransform,onDeselect:()=>F(void 0),isShownByDefault:i.textTransform,panelId:l},(0,s.createElement)(Wd,{value:V,onChange:F,showNone:!0,isBlock:!0,size:"__unstable-large",__nextHasNoMarginBottom:!0})))}const fp="typography.lineHeight";const bp=window.wp.tokenList;var vp=n.n(bp);const kp="typography.__experimentalFontFamily";function _p(e,t,n){if(!(0,c.hasBlockSupport)(t,kp))return e;if(fl(t,Mp,"fontFamily"))return e;if(!n?.fontFamily)return e;const o=new(vp())(e.className),{kebabCase:r}=ie(_l.privateApis);o.add(`has-${r(n?.fontFamily)}-font-family`);const l=o.value;return e.className=l||void 0,e}const yp={useBlockProps:function({name:e,fontFamily:t}){return _p({},e,{fontFamily:t})},addSaveProps:_p,attributeKeys:["fontFamily"],hasSupport:e=>(0,c.hasBlockSupport)(e,kp)};(0,m.addFilter)("blocks.registerBlockType","core/fontFamily/addAttribute",(function(e){return(0,c.hasBlockSupport)(e,kp)?(e.attributes.fontFamily||Object.assign(e.attributes,{fontFamily:{type:"string"}}),e):e}));const Ep=(e,t,n)=>{if(t){const n=e?.find((({slug:e})=>e===t));if(n)return n}return{size:n}};function wp(e,t){const n=e?.find((({size:e})=>e===t));return n||{size:t}}function Sp(e){if(!e)return;const{kebabCase:t}=ie(_l.privateApis);return`has-${t(e)}-font-size`}const Cp="typography.fontSize";function xp(e,t,n){if(!(0,c.hasBlockSupport)(t,Cp))return e;if(fl(t,Mp,"fontSize"))return e;const o=new(vp())(e.className);o.add(Sp(n.fontSize));const r=o.value;return e.className=r||void 0,e}const Bp={useBlockProps:function({name:e,fontSize:t,style:n}){const[o,r,l]=Ar("typography.fontSizes","typography.fluid","layout");if(!(0,c.hasBlockSupport)(e,Cp)||fl(e,Mp,"fontSize")||!t&&!n?.typography?.fontSize)return;let i;if(n?.typography?.fontSize){const e=Zr({typography:{fluid:r},layout:l});i={style:{fontSize:Wr({size:n.typography.fontSize},e)}}}return t&&(i={style:{fontSize:Ep(o,t,n?.typography?.fontSize).size}}),i?xp(i,e,{fontSize:t}):void 0},addSaveProps:xp,attributeKeys:["fontSize","style"],hasSupport:e=>(0,c.hasBlockSupport)(e,Cp)},Ip={fontSize:[["fontSize"],["style","typography","fontSize"]]};function Tp(e,t){return Object.fromEntries(Object.entries(e).filter((([e])=>!t.includes(e))))}(0,m.addFilter)("blocks.registerBlockType","core/font/addAttribute",(function(e){return(0,c.hasBlockSupport)(e,Cp)?(e.attributes.fontSize||Object.assign(e.attributes,{fontSize:{type:"string"}}),e):e})),(0,m.addFilter)("blocks.switchToBlockType.transformedBlock","core/font-size/addTransforms",(function(e,t,n,o){const r=e.name;return gl({fontSize:(0,c.hasBlockSupport)(r,Cp)},Ip,e,t,n,o)}));const Mp="typography",Pp=[fp,Cp,"typography.__experimentalFontStyle","typography.__experimentalFontWeight",kp,"typography.textColumns","typography.__experimentalTextDecoration","typography.__experimentalWritingMode","typography.__experimentalTextTransform","typography.__experimentalLetterSpacing"];function Rp(e){const t={...Tp(e,["fontFamily"])},n=e?.typography?.fontSize,o=e?.typography?.fontFamily,r=n?.startsWith("var:preset|font-size|")?n.substring(21):void 0,l=o?.startsWith("var:preset|font-family|")?o.substring(23):void 0;return t.typography={...Tp(t.typography,["fontFamily"]),fontSize:r?void 0:n},{style:hl(t),fontFamily:l,fontSize:r}}function Np(e){return{...e.style,typography:{...e.style?.typography,fontFamily:e.fontFamily?"var:preset|font-family|"+e.fontFamily:void 0,fontSize:e.fontSize?"var:preset|font-size|"+e.fontSize:e.style?.typography?.fontSize}}}function Lp({children:e,resetAllFilter:t}){const n=(0,u.useCallback)((e=>{const n=Np(e),o=t(n);return{...e,...Rp(o)}}),[t]);return(0,s.createElement)(Bs,{group:"typography",resetAllFilter:n},e)}function Ap({clientId:e,name:t,setAttributes:n,settings:o}){const{style:r,fontFamily:l,fontSize:i}=(0,d.useSelect)((function(t){const{style:n,fontFamily:o,fontSize:r}=t(Nr).getBlockAttributes(e)||{};return{style:n,fontFamily:o,fontSize:r}}),[e]),a=op(o),p=(0,u.useMemo)((()=>Np({style:r,fontFamily:l,fontSize:i})),[r,i,l]);if(!a)return null;const m=(0,c.getBlockSupport)(t,[Mp,"__experimentalDefaultControls"]);return(0,s.createElement)(gp,{as:Lp,panelId:e,settings:o,value:p,onChange:e=>{n(Rp(e))},defaultControls:m})}const Op=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z"}),(0,s.createElement)(Z.Path,{d:"m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z"})),Dp={px:{max:300,steps:1},"%":{max:100,steps:1},vw:{max:100,steps:1},vh:{max:100,steps:1},em:{max:10,steps:.1},rm:{max:10,steps:.1},svw:{max:100,steps:1},lvw:{max:100,steps:1},dvw:{max:100,steps:1},svh:{max:100,steps:1},lvh:{max:100,steps:1},dvh:{max:100,steps:1},vi:{max:100,steps:1},svi:{max:100,steps:1},lvi:{max:100,steps:1},dvi:{max:100,steps:1},vb:{max:100,steps:1},svb:{max:100,steps:1},lvb:{max:100,steps:1},dvb:{max:100,steps:1},vmin:{max:100,steps:1},svmin:{max:100,steps:1},lvmin:{max:100,steps:1},dvmin:{max:100,steps:1},vmax:{max:100,steps:1},svmax:{max:100,steps:1},lvmax:{max:100,steps:1},dvmax:{max:100,steps:1}};function zp({icon:e,isMixed:t=!1,minimumCustomValue:n,onChange:o,onMouseOut:r,onMouseOver:l,showSideInLabel:i=!0,side:a,spacingSizes:c,type:m,value:h}){var g,f;h=Jl(h,c);let b=c;const v=c.length<=8,k=(0,d.useSelect)((e=>{const t=e(Nr).getSettings();return t?.disableCustomSpacingSizes})),[_,y]=(0,u.useState)(!k&&void 0!==h&&!Xl(h)),E=(0,p.usePrevious)(h);h&&E!==h&&!Xl(h)&&!0!==_&&y(!0);const[w]=Ar("spacing.units"),S=(0,_l.__experimentalUseCustomUnits)({availableUnits:w||["px","em","rem"]});let C=null;!v&&!_&&void 0!==h&&(!Xl(h)||Xl(h)&&t)?(b=[...c,{name:t?(0,x.__)("Mixed"):(0,x.sprintf)((0,x.__)("Custom (%s)"),h),slug:"custom",size:h}],C=b.length-1):t||(C=_?Ql(h,c):function(e,t){if(void 0===e)return 0;const n=0===parseFloat(e,10)?"0":ti(e),o=t.findIndex((e=>String(e.slug)===n));return-1!==o?o:NaN}(h,c));const B=(0,u.useMemo)((()=>(0,_l.__experimentalParseQuantityAndUnitFromRawValue)(C)),[C])[1]||S[0]?.value,I=parseFloat(C,10),T=(e,t)=>{const n=parseInt(e,10);if("selectList"===t){if(0===n)return;if(1===n)return"0"}else if(0===n)return"0";return`var:preset|spacing|${c[e]?.slug}`},M=t?(0,x.__)("Mixed"):null,P=b.map(((e,t)=>({key:t,name:e.name}))),R=c.map(((e,t)=>({value:t,label:void 0}))),N=Wl.includes(a)&&i?ql[a]:"",L=i?m?.toLowerCase():m,A=(0,x.sprintf)((0,x.__)("%1$s %2$s"),N,L).trim();return(0,s.createElement)(_l.__experimentalHStack,{className:"spacing-sizes-control__wrapper"},e&&(0,s.createElement)(_l.Icon,{className:"spacing-sizes-control__icon",icon:e,size:24}),_&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.__experimentalUnitControl,{onMouseOver:l,onMouseOut:r,onFocus:l,onBlur:r,onChange:e=>o((e=>isNaN(parseFloat(e))?void 0:e)(e)),value:C,units:S,min:n,placeholder:M,disableUnits:t,label:A,hideLabelFromVision:!0,className:"spacing-sizes-control__custom-value-input",size:"__unstable-large"}),(0,s.createElement)(_l.RangeControl,{onMouseOver:l,onMouseOut:r,onFocus:l,onBlur:r,value:I,min:0,max:null!==(g=Dp[B]?.max)&&void 0!==g?g:10,step:null!==(f=Dp[B]?.steps)&&void 0!==f?f:.1,withInputField:!1,onChange:e=>{o([e,B].join(""))},className:"spacing-sizes-control__custom-value-range",__nextHasNoMarginBottom:!0})),v&&!_&&(0,s.createElement)(_l.RangeControl,{onMouseOver:l,onMouseOut:r,className:"spacing-sizes-control__range-control",value:C,onChange:e=>o(T(e)),onMouseDown:e=>{e?.nativeEvent?.offsetX<35&&void 0===h&&o("0")},withInputField:!1,"aria-valuenow":C,"aria-valuetext":c[C]?.name,renderTooltipContent:e=>void 0===h?void 0:c[e]?.name,min:0,max:c.length-1,marks:R,label:A,hideLabelFromVision:!0,__nextHasNoMarginBottom:!0,onFocus:l,onBlur:r}),!v&&!_&&(0,s.createElement)(_l.CustomSelectControl,{className:"spacing-sizes-control__custom-select-control",value:P.find((e=>e.key===C))||"",onChange:e=>{o(T(e.selectedItem.key,"selectList"))},options:P,label:A,hideLabelFromVision:!0,__nextUnconstrainedWidth:!0,size:"__unstable-large",onMouseOver:l,onMouseOut:r,onFocus:l,onBlur:r}),!k&&(0,s.createElement)(_l.Button,{label:_?(0,x.__)("Use size preset"):(0,x.__)("Set custom size"),icon:Op,onClick:()=>{y(!_)},isPressed:_,size:"small",className:"spacing-sizes-control__custom-toggle",iconSize:24}))}const Vp=["vertical","horizontal"];function Fp({minimumCustomValue:e,onChange:t,onMouseOut:n,onMouseOver:o,sides:r,spacingSizes:l,type:i,values:a}){const c=e=>n=>{if(!t)return;const o={...Object.keys(a).reduce(((e,t)=>(e[t]=Jl(a[t],l),e)),{})};"vertical"===e&&(o.top=n,o.bottom=n),"horizontal"===e&&(o.left=n,o.right=n),t(o)},u=r?.length?Vp.filter((e=>ni(r,e))):Vp;return(0,s.createElement)(s.Fragment,null,u.map((t=>{const r="vertical"===t?a.top:a.left;return(0,s.createElement)(zp,{key:`spacing-sizes-control-${t}`,icon:Zl[t],label:ql[t],minimumCustomValue:e,onChange:c(t),onMouseOut:n,onMouseOver:o,side:t,spacingSizes:l,type:i,value:r,withInputField:!1})})))}function Hp({minimumCustomValue:e,onChange:t,onMouseOut:n,onMouseOver:o,sides:r,spacingSizes:l,type:i,values:a}){const c=r?.length?Wl.filter((e=>r.includes(e))):Wl,u=e=>n=>{const o={...Object.keys(a).reduce(((e,t)=>(e[t]=Jl(a[t],l),e)),{})};o[e]=n,t(o)};return(0,s.createElement)(s.Fragment,null,c.map((t=>(0,s.createElement)(zp,{key:`spacing-sizes-control-${t}`,icon:Zl[t],label:ql[t],minimumCustomValue:e,onChange:u(t),onMouseOut:n,onMouseOver:o,side:t,spacingSizes:l,type:i,value:a[t],withInputField:!1}))))}function Gp({minimumCustomValue:e,onChange:t,onMouseOut:n,onMouseOver:o,showSideInLabel:r,side:l,spacingSizes:i,type:a,values:c}){return(0,s.createElement)(zp,{label:ql[l],minimumCustomValue:e,onChange:(u=l,e=>{const n={...Object.keys(c).reduce(((e,t)=>(e[t]=Jl(c[t],i),e)),{})};n[u]=e,t(n)}),onMouseOut:n,onMouseOver:o,showSideInLabel:r,side:l,spacingSizes:i,type:a,value:c[l],withInputField:!1});var u}const Up=(0,s.createElement)(_l.Icon,{icon:uu,size:24});function $p({label:e,onChange:t,sides:n,value:o}){if(!n||!n.length)return;const r=function(e){if(!e||!e.length)return{};const t={},n=ni(e,"horizontal"),o=ni(e,"vertical");n&&o?t.axial={label:ql.axial,icon:Zl.axial}:n?t.axial={label:ql.horizontal,icon:Zl.horizontal}:o&&(t.axial={label:ql.vertical,icon:Zl.vertical});let r=0;return Wl.forEach((n=>{e.includes(n)&&(r+=1,t[n]={label:ql[n],icon:Zl[n]})})),r>1&&(t.custom={label:ql.custom,icon:Zl.custom}),t}(n),l=r[o].icon,{custom:i,...a}=r;return(0,s.createElement)(_l.DropdownMenu,{icon:l,label:e,className:"spacing-sizes-control__dropdown",toggleProps:{isSmall:!0}},(({onClose:e})=>(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.MenuGroup,null,Object.entries(a).map((([n,{label:r,icon:l}])=>{const i=o===n;return(0,s.createElement)(_l.MenuItem,{key:n,icon:l,iconPosition:"left",isSelected:i,role:"menuitemradio",onClick:()=>{t(n),e()},suffix:i?Up:void 0},r)}))),!!i&&(0,s.createElement)(_l.MenuGroup,null,(0,s.createElement)(_l.MenuItem,{icon:i.icon,iconPosition:"left",isSelected:o===Yl.custom,role:"menuitemradio",onClick:()=>{t(Yl.custom),e()},suffix:o===Yl.custom?Up:void 0},i.label)))))}function jp({inputProps:e,label:t,minimumCustomValue:n=0,onChange:o,onMouseOut:r,onMouseOver:l,showSideInLabel:i=!0,sides:a=Wl,useSelect:c,values:d}){const p=function(){const e=[{name:0,slug:"0",size:0}],[t]=Ar("spacing.spacingSizes");return t&&e.push(...t),e.length>8&&e.unshift({name:(0,x.__)("Default"),slug:"default",size:void 0}),e}(),m=d||Kl,h=1===a?.length,g=a?.includes("horizontal")&&a?.includes("vertical")&&2===a?.length,[f,b]=(0,u.useState)(function(e={},t){const{top:n,right:o,bottom:r,left:l}=e,i=[n,o,r,l].filter(Boolean),s=!(n!==r||l!==o||!n&&!l),a=!i.length&&function(e=[]){const t={top:0,right:0,bottom:0,left:0};return e.forEach((e=>t[e]+=1)),(t.top+t.bottom)%2==0&&(t.left+t.right)%2==0}(t);if(ni(t)&&(s||a))return Yl.axial;if(1===i.length){let t;return Object.entries(e).some((([e,n])=>(t=e,void 0!==n))),t}return 1!==t?.length||i.length?Yl.custom:t[0]}(m,a)),v={...e,minimumCustomValue:n,onChange:e=>{const t={...d,...e};o(t)},onMouseOut:r,onMouseOver:l,sides:a,spacingSizes:p,type:t,useSelect:c,values:m},k=Wl.includes(f)&&i?ql[f]:"",_=(0,x.sprintf)((0,x.__)("%1$s %2$s"),t,k).trim(),y=(0,x.sprintf)((0,x._x)("%s options","Button label to reveal side configuration options"),t);return(0,s.createElement)("fieldset",{className:"spacing-sizes-control"},(0,s.createElement)(_l.__experimentalHStack,{className:"spacing-sizes-control__header"},(0,s.createElement)(_l.BaseControl.VisualLabel,{as:"legend",className:"spacing-sizes-control__label"},_),!h&&!g&&(0,s.createElement)($p,{label:y,onChange:b,sides:a,value:f})),(0,s.createElement)(_l.__experimentalVStack,{spacing:.5},f===Yl.axial?(0,s.createElement)(Fp,{...v}):f===Yl.custom?(0,s.createElement)(Hp,{...v}):(0,s.createElement)(Gp,{side:f,...v,showSideInLabel:i})))}const Wp={px:{max:1e3,step:1},"%":{max:100,step:1},vw:{max:100,step:1},vh:{max:100,step:1},em:{max:50,step:.1},rem:{max:50,step:.1},svw:{max:100,step:1},lvw:{max:100,step:1},dvw:{max:100,step:1},svh:{max:100,step:1},lvh:{max:100,step:1},dvh:{max:100,step:1},vi:{max:100,step:1},svi:{max:100,step:1},lvi:{max:100,step:1},dvi:{max:100,step:1},vb:{max:100,step:1},svb:{max:100,step:1},lvb:{max:100,step:1},dvb:{max:100,step:1},vmin:{max:100,step:1},svmin:{max:100,step:1},lvmin:{max:100,step:1},dvmin:{max:100,step:1},vmax:{max:100,step:1},svmax:{max:100,step:1},lvmax:{max:100,step:1},dvmax:{max:100,step:1}};function Kp({label:e=(0,x.__)("Height"),onChange:t,value:n}){var o,r;const l=parseFloat(n),[i]=Ar("spacing.units"),a=(0,_l.__experimentalUseCustomUnits)({availableUnits:i||["%","px","em","rem","vh","vw"]}),c=(0,u.useMemo)((()=>(0,_l.__experimentalParseQuantityAndUnitFromRawValue)(n)),[n])[1]||a[0]?.value||"px";return(0,s.createElement)("fieldset",{className:"block-editor-height-control"},(0,s.createElement)(_l.BaseControl.VisualLabel,{as:"legend"},e),(0,s.createElement)(_l.Flex,null,(0,s.createElement)(_l.FlexItem,{isBlock:!0},(0,s.createElement)(_l.__experimentalUnitControl,{value:n,units:a,onChange:t,onUnitChange:e=>{const[o,r]=(0,_l.__experimentalParseQuantityAndUnitFromRawValue)(n);["em","rem"].includes(e)&&"px"===r?t((o/16).toFixed(2)+e):["em","rem"].includes(r)&&"px"===e?t(Math.round(16*o)+e):["%","vw","svw","lvw","dvw","vh","svh","lvh","dvh","vi","svi","lvi","dvi","vb","svb","lvb","dvb","vmin","svmin","lvmin","dvmin","vmax","svmax","lvmax","dvmax"].includes(e)&&o>100&&t(100+e)},min:0,size:"__unstable-large",label:e,hideLabelFromVision:!0})),(0,s.createElement)(_l.FlexItem,{isBlock:!0},(0,s.createElement)(_l.__experimentalSpacer,{marginX:2,marginBottom:0},(0,s.createElement)(_l.RangeControl,{value:l,min:0,max:null!==(o=Wp[c]?.max)&&void 0!==o?o:100,step:null!==(r=Wp[c]?.step)&&void 0!==r?r:.1,withInputField:!1,onChange:e=>{t([e,c].join(""))},__nextHasNoMarginBottom:!0,label:e,hideLabelFromVision:!0})))))}function Zp(e,t){const{orientation:n="horizontal"}=t;return"fill"===e?(0,x.__)("Stretch to fill available space."):"fixed"===e&&"horizontal"===n?(0,x.__)("Specify a fixed width."):"fixed"===e?(0,x.__)("Specify a fixed height."):(0,x.__)("Fit contents.")}function qp({value:e={},onChange:t,parentLayout:n}){const{selfStretch:o,flexSize:r}=e;return(0,u.useEffect)((()=>{"fixed"!==o||r||t({...e,selfStretch:"fit"})}),[]),(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,size:"__unstable-large",label:Yp(n),value:o||"fit",help:Zp(o,n),onChange:n=>{const o="fixed"!==n?null:r;t({...e,selfStretch:n,flexSize:o})},isBlock:!0},(0,s.createElement)(_l.__experimentalToggleGroupControlOption,{key:"fit",value:"fit",label:(0,x.__)("Fit")}),(0,s.createElement)(_l.__experimentalToggleGroupControlOption,{key:"fill",value:"fill",label:(0,x.__)("Fill")}),(0,s.createElement)(_l.__experimentalToggleGroupControlOption,{key:"fixed",value:"fixed",label:(0,x.__)("Fixed")})),"fixed"===o&&(0,s.createElement)(_l.__experimentalUnitControl,{size:"__unstable-large",onChange:n=>{t({...e,flexSize:n})},value:r}))}function Yp(e){const{orientation:t="horizontal"}=e;return"horizontal"===t?(0,x.__)("Width"):(0,x.__)("Height")}const Xp=[{label:(0,x._x)("Original","Aspect ratio option for dimensions control"),value:"auto"},{label:(0,x._x)("Square - 1:1","Aspect ratio option for dimensions control"),value:"1"},{label:(0,x._x)("Standard - 4:3","Aspect ratio option for dimensions control"),value:"4/3"},{label:(0,x._x)("Portrait - 3:4","Aspect ratio option for dimensions control"),value:"3/4"},{label:(0,x._x)("Classic - 3:2","Aspect ratio option for dimensions control"),value:"3/2"},{label:(0,x._x)("Classic Portrait - 2:3","Aspect ratio option for dimensions control"),value:"2/3"},{label:(0,x._x)("Wide - 16:9","Aspect ratio option for dimensions control"),value:"16/9"},{label:(0,x._x)("Tall - 9:16","Aspect ratio option for dimensions control"),value:"9/16"},{label:(0,x._x)("Custom","Aspect ratio option for dimensions control"),value:"custom",disabled:!0,hidden:!0}];function Qp({panelId:e,value:t,onChange:n=(()=>{}),options:o=Xp,defaultValue:r=Xp[0].value,hasValue:l,isShownByDefault:i=!0}){const a=null!=t?t:"auto";return(0,s.createElement)(_l.__experimentalToolsPanelItem,{hasValue:l||(()=>a!==r),label:(0,x.__)("Aspect ratio"),onDeselect:()=>n(void 0),isShownByDefault:i,panelId:e},(0,s.createElement)(_l.SelectControl,{label:(0,x.__)("Aspect ratio"),value:a,options:o,onChange:n,size:"__unstable-large",__nextHasNoMarginBottom:!0}))}const Jp=["horizontal","vertical"];function em(e){const t=tm(e),n=nm(e),o=om(e),r=rm(e),l=lm(e),i=im(e),s=sm(e),a=am(e);return"web"===u.Platform.OS&&(t||n||o||r||l||i||s||a)}function tm(e){return e?.layout?.contentSize}function nm(e){return e?.layout?.wideSize}function om(e){return e?.spacing?.padding}function rm(e){return e?.spacing?.margin}function lm(e){return e?.spacing?.blockGap}function im(e){return e?.dimensions?.minHeight}function sm(e){return e?.dimensions?.aspectRatio}function am(e){var t;const{type:n="default",default:{type:o="default"}={},allowSizingOnChildren:r=!1}=null!==(t=e?.parentLayout)&&void 0!==t?t:{},l=("flex"===o||"flex"===n)&&r;return!!e?.layout&&l}function cm(e,t){if(!t||!e)return e;const n={};return t.forEach((t=>{"vertical"===t&&(n.top=e.top,n.bottom=e.bottom),"horizontal"===t&&(n.left=e.left,n.right=e.right),n[t]=e?.[t]})),n}function um(e){return e&&"string"==typeof e?{top:e,right:e,bottom:e,left:e}:e}function dm({resetAllFilter:e,onChange:t,value:n,panelId:o,children:r}){return(0,s.createElement)(_l.__experimentalToolsPanel,{label:(0,x.__)("Dimensions"),resetAll:()=>{const o=e(n);t(o)},panelId:o,dropdownMenuProps:Qr},r)}const pm={contentSize:!0,wideSize:!0,padding:!0,margin:!0,blockGap:!0,minHeight:!0,aspectRatio:!0,childLayout:!0};function mm({as:e=dm,value:t,onChange:n,inheritedValue:o=t,settings:r,panelId:l,defaultControls:i=pm,onVisualize:a=(()=>{}),includeLayoutControls:c=!1}){var d,p,m,h,g,f,b,v,k;const{dimensions:_,spacing:y}=r,E=e=>e&&"object"==typeof e?Object.keys(e).reduce(((t,n)=>(t[n]=el({settings:{dimensions:_,spacing:y}},"",e[n]),t)),{}):el({settings:{dimensions:_,spacing:y}},"",e),w=function(e){var t,n;const{custom:o,theme:r,default:l}=e?.spacing?.spacingSizes||{};return(null!==(t=null!==(n=null!=o?o:r)&&void 0!==n?n:l)&&void 0!==t?t:[]).length>0}(r),S=(0,_l.__experimentalUseCustomUnits)({availableUnits:r?.spacing?.units||["%","px","em","rem","vw"]}),C=tm(r)&&c,B=E(o?.layout?.contentSize),I=e=>{n(jn(t,["layout","contentSize"],e||void 0))},T=nm(r)&&c,M=E(o?.layout?.wideSize),P=e=>{n(jn(t,["layout","wideSize"],e||void 0))},R=om(r),N=um(E(o?.spacing?.padding)),L=Array.isArray(r?.spacing?.padding)?r?.spacing?.padding:r?.spacing?.padding?.sides,A=L&&L.some((e=>Jp.includes(e))),O=e=>{const o=cm(e,L);n(jn(t,["spacing","padding"],o))},D=()=>a("padding"),z=rm(r),V=um(E(o?.spacing?.margin)),F=Array.isArray(r?.spacing?.margin)?r?.spacing?.margin:r?.spacing?.margin?.sides,H=F&&F.some((e=>Jp.includes(e))),G=e=>{const o=cm(e,F);n(jn(t,["spacing","margin"],o))},U=()=>a("margin"),$=lm(r),j=E(o?.spacing?.blockGap),W=function(e){return e&&"string"==typeof e?{top:e}:e?{...e,right:e?.left,bottom:e?.top}:e}(j),K=Array.isArray(r?.spacing?.blockGap)?r?.spacing?.blockGap:r?.spacing?.blockGap?.sides,Z=K&&K.some((e=>Jp.includes(e))),q=e=>{n(jn(t,["spacing","blockGap"],e))},Y=e=>{e||q(null),!Z&&e?.hasOwnProperty("top")?q(e.top):q({top:e?.top,left:e?.left})},X=im(r),Q=E(o?.dimensions?.minHeight),J=e=>{const o=jn(t,["dimensions","minHeight"],e);n(jn(o,["dimensions","aspectRatio"],void 0))},ee=sm(r),te=E(o?.dimensions?.aspectRatio),ne=am(r),oe=o?.layout,{orientation:re="horizontal"}=null!==(d=r?.parentLayout)&&void 0!==d?d:{},le="horizontal"===re?(0,x.__)("Width"):(0,x.__)("Height"),ie=e=>{n({...t,layout:{...t?.layout,...e}})},se=(0,u.useCallback)((e=>({...e,layout:hl({...e?.layout,contentSize:void 0,wideSize:void 0,selfStretch:void 0,flexSize:void 0}),spacing:{...e?.spacing,padding:void 0,margin:void 0,blockGap:void 0},dimensions:{...e?.dimensions,minHeight:void 0,aspectRatio:void 0}})),[]),ae=()=>a(!1);return(0,s.createElement)(e,{resetAllFilter:se,value:t,onChange:n,panelId:l},(C||T)&&(0,s.createElement)("span",{className:"span-columns"},(0,x.__)("Set the width of the main content area.")),C&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{className:"single-column",label:(0,x.__)("Content size"),hasValue:()=>!!t?.layout?.contentSize,onDeselect:()=>I(void 0),isShownByDefault:null!==(p=i.contentSize)&&void 0!==p?p:pm.contentSize,panelId:l},(0,s.createElement)(_l.__experimentalHStack,{alignment:"flex-end",justify:"flex-start"},(0,s.createElement)(_l.__experimentalUnitControl,{label:(0,x.__)("Content"),labelPosition:"top",__unstableInputWidth:"80px",value:B||"",onChange:e=>{I(e)},units:S}),(0,s.createElement)(_l.__experimentalView,null,(0,s.createElement)(Ti,{icon:Mi})))),T&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{className:"single-column",label:(0,x.__)("Wide size"),hasValue:()=>!!t?.layout?.wideSize,onDeselect:()=>P(void 0),isShownByDefault:null!==(m=i.wideSize)&&void 0!==m?m:pm.wideSize,panelId:l},(0,s.createElement)(_l.__experimentalHStack,{alignment:"flex-end",justify:"flex-start"},(0,s.createElement)(_l.__experimentalUnitControl,{label:(0,x.__)("Wide"),labelPosition:"top",__unstableInputWidth:"80px",value:M||"",onChange:e=>{P(e)},units:S}),(0,s.createElement)(_l.__experimentalView,null,(0,s.createElement)(Ti,{icon:Pi})))),R&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{hasValue:()=>!!t?.spacing?.padding&&Object.keys(t?.spacing?.padding).length,label:(0,x.__)("Padding"),onDeselect:()=>O(void 0),isShownByDefault:null!==(h=i.padding)&&void 0!==h?h:pm.padding,className:ml()({"tools-panel-item-spacing":w}),panelId:l},!w&&(0,s.createElement)(_l.__experimentalBoxControl,{values:N,onChange:O,label:(0,x.__)("Padding"),sides:L,units:S,allowReset:!1,splitOnAxis:A,onMouseOver:D,onMouseOut:ae}),w&&(0,s.createElement)(jp,{values:N,onChange:O,label:(0,x.__)("Padding"),sides:L,units:S,allowReset:!1,onMouseOver:D,onMouseOut:ae})),z&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{hasValue:()=>!!t?.spacing?.margin&&Object.keys(t?.spacing?.margin).length,label:(0,x.__)("Margin"),onDeselect:()=>G(void 0),isShownByDefault:null!==(g=i.margin)&&void 0!==g?g:pm.margin,className:ml()({"tools-panel-item-spacing":w}),panelId:l},!w&&(0,s.createElement)(_l.__experimentalBoxControl,{values:V,onChange:G,label:(0,x.__)("Margin"),sides:F,units:S,allowReset:!1,splitOnAxis:H,onMouseOver:U,onMouseOut:ae}),w&&(0,s.createElement)(jp,{values:V,onChange:G,label:(0,x.__)("Margin"),sides:F,units:S,allowReset:!1,onMouseOver:U,onMouseOut:ae})),$&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{hasValue:()=>!!t?.spacing?.blockGap,label:(0,x.__)("Block spacing"),onDeselect:()=>q(void 0),isShownByDefault:null!==(f=i.blockGap)&&void 0!==f?f:pm.blockGap,className:ml()({"tools-panel-item-spacing":w}),panelId:l},!w&&(Z?(0,s.createElement)(_l.__experimentalBoxControl,{label:(0,x.__)("Block spacing"),min:0,onChange:Y,units:S,sides:K,values:W,allowReset:!1,splitOnAxis:Z}):(0,s.createElement)(_l.__experimentalUnitControl,{label:(0,x.__)("Block spacing"),__unstableInputWidth:"80px",min:0,onChange:q,units:S,value:j})),w&&(0,s.createElement)(jp,{label:(0,x.__)("Block spacing"),min:0,onChange:Y,showSideInLabel:!1,sides:Z?K:["top"],values:W,allowReset:!1})),X&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{hasValue:()=>!!t?.dimensions?.minHeight,label:(0,x.__)("Minimum height"),onDeselect:()=>{J(void 0)},isShownByDefault:null!==(b=i.minHeight)&&void 0!==b?b:pm.minHeight,panelId:l},(0,s.createElement)(Kp,{label:(0,x.__)("Minimum height"),value:Q,onChange:J})),ee&&(0,s.createElement)(Qp,{hasValue:()=>!!t?.dimensions?.aspectRatio,value:te,onChange:e=>{const o=jn(t,["dimensions","aspectRatio"],e);n(jn(o,["dimensions","minHeight"],void 0))},panelId:l,isShownByDefault:null!==(v=i.aspectRatio)&&void 0!==v?v:pm.aspectRatio}),ne&&(0,s.createElement)(_l.__experimentalVStack,{as:_l.__experimentalToolsPanelItem,spacing:2,hasValue:()=>!!t?.layout,label:le,onDeselect:()=>{ie({selfStretch:void 0,flexSize:void 0})},isShownByDefault:null!==(k=i.childLayout)&&void 0!==k?k:pm.childLayout,panelId:l},(0,s.createElement)(qp,{value:oe,onChange:ie,parentLayout:r?.parentLayout})))}const hm=function(e){return(0,p.useRefEffect)((t=>{if(!e)return;function n(t){const{deltaX:n,deltaY:o}=t;e.current.scrollBy(n,o)}const o={passive:!0};return t.addEventListener("wheel",n,o),()=>{t.removeEventListener("wheel",n,o)}}),[e])},gm=Number.MAX_SAFE_INTEGER;const fm=(0,u.forwardRef)((function({clientId:e,bottomClientId:t,children:n,__unstableRefreshSize:o,__unstableCoverTarget:r=!1,__unstablePopoverSlot:l,__unstableContentRef:i,shift:a=!0,...c},d){const m=bd(e),h=bd(null!=t?t:e),g=(0,p.useMergeRefs)([d,hm(i)]),[f,b]=(0,u.useReducer)((e=>(e+1)%gm),0);(0,u.useLayoutEffect)((()=>{if(!m)return;const e=new window.MutationObserver(b);return e.observe(m,{attributes:!0}),()=>{e.disconnect()}}),[m]);const v=(0,u.useMemo)((()=>f<0||!m||h!==m?{}:{position:"absolute",width:m.offsetWidth,height:m.offsetHeight}),[m,h,o,f]),k=(0,u.useMemo)((()=>{if(!(f<0||!m||t&&!h))return{getBoundingClientRect(){var e,t,n,o;const r=m.getBoundingClientRect(),l=h?.getBoundingClientRect(),i=Math.min(r.left,null!==(e=l?.left)&&void 0!==e?e:1/0),s=Math.min(r.top,null!==(t=l?.top)&&void 0!==t?t:1/0),a=Math.max(r.right,null!==(n=l.right)&&void 0!==n?n:-1/0)-i,c=Math.max(r.bottom,null!==(o=l.bottom)&&void 0!==o?o:-1/0)-s;return new window.DOMRect(i,s,a,c)},contextElement:m}}),[t,h,m,f]);return!m||t&&!h?null:(0,s.createElement)(_l.Popover,{ref:g,animate:!1,focusOnMount:!1,anchor:k,__unstableSlotName:l,inline:!l,placement:"top-start",resize:!1,flip:!1,shift:a,...c,className:ml()("block-editor-block-popover",c.className),variant:"unstyled"},r&&(0,s.createElement)("div",{style:v},n),!r&&n)}));function bm(e,t){return e.ownerDocument.defaultView.getComputedStyle(e).getPropertyValue(t)}function vm({clientId:e,attributes:t,forceShow:n}){const o=bd(e),[r,l]=(0,u.useState)(),i=t?.style?.spacing?.margin;(0,u.useEffect)((()=>{if(!o||null===o.ownerDocument.defaultView)return;const e=bm(o,"margin-top"),t=bm(o,"margin-right"),n=bm(o,"margin-bottom"),r=bm(o,"margin-left");l({borderTopWidth:e,borderRightWidth:t,borderBottomWidth:n,borderLeftWidth:r,top:e?`-${e}`:0,right:t?`-${t}`:0,bottom:n?`-${n}`:0,left:r?`-${r}`:0})}),[o,i]);const[a,c]=(0,u.useState)(!1),d=(0,u.useRef)(i),p=(0,u.useRef)();return(0,u.useEffect)((()=>(js()(i,d.current)||n||(c(!0),d.current=i,p.current=setTimeout((()=>{c(!1)}),400)),()=>{c(!1),p.current&&window.clearTimeout(p.current)})),[i,n]),a||n?(0,s.createElement)(fm,{clientId:e,__unstableCoverTarget:!0,__unstableRefreshSize:i,__unstablePopoverSlot:"block-toolbar",shift:!1},(0,s.createElement)("div",{className:"block-editor__padding-visualizer",style:r})):null}function km(e,t){return e.ownerDocument.defaultView.getComputedStyle(e).getPropertyValue(t)}function _m({clientId:e,value:t,forceShow:n}){const o=bd(e),[r,l]=(0,u.useState)(),i=t?.spacing?.padding;(0,u.useEffect)((()=>{o&&null!==o.ownerDocument.defaultView&&l({borderTopWidth:km(o,"padding-top"),borderRightWidth:km(o,"padding-right"),borderBottomWidth:km(o,"padding-bottom"),borderLeftWidth:km(o,"padding-left")})}),[o,i]);const[a,c]=(0,u.useState)(!1),d=(0,u.useRef)(i),p=(0,u.useRef)();return(0,u.useEffect)((()=>(js()(i,d.current)||n||(c(!0),d.current=i,p.current=setTimeout((()=>{c(!1)}),400)),()=>{c(!1),p.current&&window.clearTimeout(p.current)})),[i,n]),a||n?(0,s.createElement)(fm,{clientId:e,__unstableCoverTarget:!0,__unstableRefreshSize:i,__unstablePopoverSlot:"block-toolbar",shift:!1},(0,s.createElement)("div",{className:"block-editor__padding-visualizer",style:r})):null}const ym="dimensions",Em="spacing";function wm({children:e,resetAllFilter:t}){const n=(0,u.useCallback)((e=>{const n=e.style,o=t(n);return{...e,style:o}}),[t]);return(0,s.createElement)(Bs,{group:"dimensions",resetAllFilter:n},e)}function Sm({clientId:e,name:t,setAttributes:n,settings:o}){const r=em(o),l=(0,d.useSelect)((t=>t(Nr).getBlockAttributes(e)?.style),[e]),[i,a]=function(){const[e,t]=(0,u.useState)(!1),{hideBlockInterface:n,showBlockInterface:o}=ie((0,d.useDispatch)(Nr));return(0,u.useEffect)((()=>{e?n():o()}),[e,o,n]),[e,t]}();if(!r)return null;const p={...(0,c.getBlockSupport)(t,[ym,"__experimentalDefaultControls"]),...(0,c.getBlockSupport)(t,[Em,"__experimentalDefaultControls"])};return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(mm,{as:wm,panelId:e,settings:o,value:l,onChange:e=>{n({style:hl(e)})},defaultControls:p,onVisualize:a}),!!o?.spacing?.padding&&(0,s.createElement)(_m,{forceShow:"padding"===i,clientId:e,value:l}),!!o?.spacing?.margin&&(0,s.createElement)(vm,{forceShow:"margin"===i,clientId:e,value:l}))}function Cm(e,t="any"){if("web"!==u.Platform.OS)return!1;const n=(0,c.getBlockSupport)(e,ym);return!0===n||("any"===t?!(!n?.aspectRatio&&!n?.minHeight):!!n?.[t])}const xm={useBlockProps:function({name:e,minHeight:t,style:n}){if(!Cm(e,"aspectRatio")||fl(e,ym,"aspectRatio"))return{};const o=ml()({"has-aspect-ratio":!!n?.dimensions?.aspectRatio}),r={};n?.dimensions?.aspectRatio?r.minHeight="unset":(t||n?.dimensions?.minHeight)&&(r.aspectRatio="unset");return{className:o,style:r}},attributeKeys:["minHeight","style"],hasSupport:e=>Cm(e,"aspectRatio")};function Bm(){w()("wp.blockEditor.__experimentalUseCustomSides",{since:"6.3",version:"6.4"})}const Im=[...Pp,Iu,_d,ym,tc,Em,Tu],Tm=e=>Im.some((t=>(0,c.hasBlockSupport)(e,t)));function Mm(e={}){const t={};return(0,Ri.getCSSRules)(e).forEach((e=>{t[e.key]=e.value})),t}const Pm={[`${Iu}.__experimentalSkipSerialization`]:["border"],[`${_d}.__experimentalSkipSerialization`]:[_d],[`${Mp}.__experimentalSkipSerialization`]:[Mp],[`${ym}.__experimentalSkipSerialization`]:[ym],[`${Em}.__experimentalSkipSerialization`]:[Em],[`${Tu}.__experimentalSkipSerialization`]:[Tu]},Rm={...Pm,[`${ym}.aspectRatio`]:[`${ym}.aspectRatio`],[`${tc}`]:[tc]},Nm={[`${ym}.aspectRatio`]:!0,[`${tc}`]:!0},Lm={gradients:"gradient"};function Am(e,t,n=!1){if(!e)return e;let o=e;return n||(o=JSON.parse(JSON.stringify(e))),Array.isArray(t)||(t=[t]),t.forEach((e=>{if(Array.isArray(e)||(e=e.split(".")),e.length>1){const[t,...n]=e;Am(o[t],[n],!0)}else 1===e.length&&delete o[e[0]]})),o}function Om(e,t,n,o=Rm){if(!Tm(t))return e;let{style:r}=n;return Object.entries(o).forEach((([e,n])=>{const o=Nm[e]||(0,c.getBlockSupport)(t,e);!0===o&&(r=Am(r,n)),Array.isArray(o)&&o.forEach((e=>{const t=Lm[e]||e;r=Am(r,[[...n,t]])}))})),e.style={...Mm(r),...e.style},e}const Dm={edit:function({clientId:e,name:t,setAttributes:n,__unstableParentLayout:o}){const r={clientId:e,name:t,setAttributes:n,settings:vl(t,o)};return"default"!==ns()?null:(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Md,{...r}),(0,s.createElement)(pc,{...r}),(0,s.createElement)(Ap,{...r}),(0,s.createElement)(Ou,{...r}),(0,s.createElement)(Sm,{...r}))},hasSupport:Tm,addSaveProps:Om,attributeKeys:["style"],useBlockProps:function e({name:t,style:n}){const o=`wp-elements-${(0,p.useInstanceId)(e)}`,r=`.editor-styles-wrapper .${o}`,l=n?.elements,i=(0,u.useMemo)((()=>{if(!l)return;const e=[];return zm.forEach((({elementType:n,pseudo:o,elements:i})=>{if(fl(t,_d,n))return;const s=l?.[n];if(s){const t=tl(r,c.__EXPERIMENTAL_ELEMENTS[n]);e.push((0,Ri.compileCSS)(s,{selector:t})),o&&o.forEach((t=>{s[t]&&e.push((0,Ri.compileCSS)(s[t],{selector:tl(r,`${c.__EXPERIMENTAL_ELEMENTS[n]}${t}`)}))}))}i&&i.forEach((t=>{l[t]&&e.push((0,Ri.compileCSS)(l[t],{selector:tl(r,c.__EXPERIMENTAL_ELEMENTS[t])}))}))})),e.length>0?e.join(""):void 0}),[r,l,t]);return bl({css:i}),Om({className:o},t,{style:n},Pm)}},zm=[{elementType:"button"},{elementType:"link",pseudo:[":hover"]},{elementType:"heading",elements:["h1","h2","h3","h4","h5","h6"]}];(0,m.addFilter)("blocks.registerBlockType","core/style/addAttribute",(function(e){return Tm(e)?(e.attributes.style||Object.assign(e.attributes,{style:{type:"object"}}),e):e}));(0,m.addFilter)("blocks.registerBlockType","core/settings/addAttribute",(function(e){return t=e,(0,c.hasBlockSupport)(t,"__experimentalSettings",!1)?(e?.attributes?.settings||(e.attributes={...e.attributes,settings:{type:"object"}}),e):e;var t}));const Vm=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M12 4 4 19h16L12 4zm0 3.2 5.5 10.3H12V7.2z"}));const Fm=function e({id:t,colorPalette:n,duotonePalette:o,disableCustomColors:r,disableCustomDuotone:l,value:i,onChange:a}){let c;c="unset"===i?(0,s.createElement)(_l.ColorIndicator,{className:"block-editor-duotone-control__unset-indicator"}):i?(0,s.createElement)(_l.DuotoneSwatch,{values:i}):(0,s.createElement)(Ti,{icon:Vm});const u=(0,x.__)("Apply duotone filter"),d=`${(0,p.useInstanceId)(e,"duotone-control",t)}__description`;return(0,s.createElement)(_l.Dropdown,{popoverProps:{className:"block-editor-duotone-control__popover",headerTitle:(0,x.__)("Duotone")},renderToggle:({isOpen:e,onToggle:t})=>(0,s.createElement)(_l.ToolbarButton,{showTooltip:!0,onClick:t,"aria-haspopup":"true","aria-expanded":e,onKeyDown:n=>{e||n.keyCode!==zs.DOWN||(n.preventDefault(),t())},label:u,icon:c}),renderContent:()=>(0,s.createElement)(_l.MenuGroup,{label:(0,x.__)("Duotone")},(0,s.createElement)("p",null,(0,x.__)("Create a two-tone color effect without losing your original image.")),(0,s.createElement)(_l.DuotonePicker,{"aria-label":u,"aria-describedby":d,colorPalette:n,duotonePalette:o,disableCustomColors:r,disableCustomDuotone:l,value:i,onChange:a}))})};function Hm(e){return`${e}{filter:none}`}function Gm(e,t){return`${e}{filter:url(#${t})}`}function Um(e,t){const n=function(e=[]){const t={r:[],g:[],b:[],a:[]};return e.forEach((e=>{const n=Vc(e).toRgb();t.r.push(n.r/255),t.g.push(n.g/255),t.b.push(n.b/255),t.a.push(n.a)})),t}(t);return`\n\n\t\n\t\t\n\t\t\t\x3c!--\n\t\t\t\tUse sRGB instead of linearRGB so transparency looks correct.\n\t\t\t\tUse perceptual brightness to convert to grayscale.\n\t\t\t--\x3e\n\t\t\t\n\t\t\t\x3c!-- Use sRGB instead of linearRGB to be consistent with how CSS gradients work. --\x3e\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\x3c!-- Re-mask the image with the original transparency since the feColorMatrix above loses that information. --\x3e\n\t\t\t\n\t\t\n\t\n`}function $m(e,t="root",n={}){if(!t)return null;const{fallback:o=!1}=n,{name:r,selectors:l,supports:i}=e,s=l&&Object.keys(l).length>0,a=Array.isArray(t)?t.join("."):t;let c=null;if(c=s&&l.root?l?.root:i?.__experimentalSelector?i.__experimentalSelector:".wp-block-"+r.replace("core/","").replace("/","-"),"root"===a)return c;const u=Array.isArray(t)?t:t.split(".");if(1===u.length){const e=o?c:null;if(s){return Wn(l,`${a}.root`,null)||Wn(l,a,null)||e}const t=Wn(i,`${a}.__experimentalSelector`,null);return t?tl(c,t):e}let d;return s&&(d=Wn(l,a,null)),d||(o?$m(e,u[0],n):null)}const jm=[];function Wm(e,{presetSetting:t,defaultSetting:n}){const o=!e?.color?.[n],r=e?.color?.[t]?.custom||jm,l=e?.color?.[t]?.theme||jm,i=e?.color?.[t]?.default||jm;return(0,u.useMemo)((()=>[...r,...l,...o?jm:i]),[o,r,l,i])}function Km(e){return Zm(e)}function Zm(e){return e.color.customDuotone||e.color.defaultDuotone||e.color.duotone.length>0}function qm({resetAllFilter:e,onChange:t,value:n,panelId:o,children:r}){return(0,s.createElement)(_l.__experimentalToolsPanel,{label:(0,x._x)("Filters","Name for applying graphical effects"),resetAll:()=>{const o=e(n);t(o)},panelId:o,dropdownMenuProps:Qr},r)}const Ym={duotone:!0},Xm={placement:"left-start",offset:36,shift:!0,className:"block-editor-duotone-control__popover",headerTitle:(0,x.__)("Duotone")},Qm=({indicator:e,label:t})=>(0,s.createElement)(_l.__experimentalHStack,{justify:"flex-start"},(0,s.createElement)(_l.__experimentalZStack,{isLayered:!1,offset:-8},(0,s.createElement)(_l.Flex,{expanded:!1},"unset"!==e&&e?(0,s.createElement)(_l.DuotoneSwatch,{values:e}):(0,s.createElement)(_l.ColorIndicator,{className:"block-editor-duotone-control__unset-indicator"}))),(0,s.createElement)(_l.FlexItem,{title:t},t));function Jm({as:e=qm,value:t,onChange:n,inheritedValue:o=t,settings:r,panelId:l,defaultControls:i=Ym}){const a=Zm(r),c=Wm(r,{presetSetting:"duotone",defaultSetting:"defaultDuotone"}),d=Wm(r,{presetSetting:"palette",defaultSetting:"defaultPalette"}),p=(m=o?.filter?.duotone,el({settings:r},"",m));var m;const h=e=>{const o=c.find((({colors:t})=>t===e)),r=o?`var:preset|duotone|${o.slug}`:e;n(jn(t,["filter","duotone"],r))},g=(0,u.useCallback)((e=>({...e,filter:{...e.filter,duotone:void 0}})),[]);return(0,s.createElement)(e,{resetAllFilter:g,value:t,onChange:n,panelId:l},a&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{label:(0,x.__)("Duotone"),hasValue:()=>!!t?.filter?.duotone,onDeselect:()=>h(void 0),isShownByDefault:i.duotone,panelId:l},(0,s.createElement)(_l.Dropdown,{popoverProps:Xm,className:"block-editor-global-styles-filters-panel__dropdown",renderToggle:({onToggle:e,isOpen:t})=>{const n={onClick:e,className:ml()({"is-open":t}),"aria-expanded":t};return(0,s.createElement)(_l.__experimentalItemGroup,{isBordered:!0,isSeparated:!0},(0,s.createElement)(_l.Button,{...n},(0,s.createElement)(Qm,{indicator:p,label:(0,x.__)("Duotone")})))},renderContent:()=>(0,s.createElement)(_l.__experimentalDropdownContentWrapper,{paddingSize:"small"},(0,s.createElement)(_l.MenuGroup,{label:(0,x.__)("Duotone")},(0,s.createElement)("p",null,(0,x.__)("Create a two-tone color effect without losing your original image.")),(0,s.createElement)(_l.DuotonePicker,{colorPalette:d,duotonePalette:c,disableCustomColors:!0,disableCustomDuotone:!0,value:p,onChange:h})))})))}const eh=[],th=window?.navigator.userAgent&&window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome")&&!window.navigator.userAgent.includes("Chromium");function nh({presetSetting:e,defaultSetting:t}){const[n,o,r,l]=Ar(t,`${e}.custom`,`${e}.theme`,`${e}.default`);return(0,u.useMemo)((()=>[...o||eh,...r||eh,...n&&l||eh]),[n,o,r,l])}function oh(e,t){if(!e)return;const n=t?.find((({slug:t})=>e===`var:preset|duotone|${t}`));return n?n.colors:void 0}Hc([Gc]);const rh={shareWithChildBlocks:!0,edit:function({style:e,setAttributes:t,name:n}){const o=e?.color?.duotone,r=vl(n),l=ns(),i=nh({presetSetting:"color.duotone",defaultSetting:"color.defaultDuotone"}),a=nh({presetSetting:"color.palette",defaultSetting:"color.defaultPalette"}),[c,u]=Ar("color.custom","color.customDuotone"),d=!c,p=!u||0===a?.length&&d;if(0===i?.length&&p)return null;if("default"!==l)return null;const m=Array.isArray(o)?o:oh(o,i);return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Bs,{group:"filter"},(0,s.createElement)(Jm,{value:{filter:{duotone:m}},onChange:n=>{const o={...e,color:{...n?.filter}};t({style:o})},settings:r})),(0,s.createElement)(Bl,{group:"block",__experimentalShareWithChildBlocks:!0},(0,s.createElement)(Fm,{duotonePalette:i,colorPalette:a,disableCustomDuotone:p,disableCustomColors:d,value:m,onChange:n=>{const o=function(e,t){if(!e||!Array.isArray(e))return;const n=t?.find((t=>t?.colors?.every(((t,n)=>t===e[n]))));return n?`var:preset|duotone|${n.slug}`:void 0}(n,i),r={...e,color:{...e?.color,duotone:null!=o?o:n}};t({style:r})},settings:r})))},useBlockProps:function e({name:t,style:n}){const o=(0,p.useInstanceId)(e),r=(0,u.useMemo)((()=>{const e=(0,c.getBlockType)(t);if(e){if(!(0,c.getBlockSupport)(e,"filter.duotone",!1))return null;const t=(0,c.getBlockSupport)(e,"color.__experimentalDuotone",!1);if(t){const n=$m(e);return"string"==typeof t?tl(n,t):n}return $m(e,"filter.duotone",{fallback:!0})}}),[t]),l=n?.color?.duotone,i=`wp-duotone-${o}`,s=r&&l;return lh({clientId:o,id:i,selector:r,attribute:l}),{className:s?i:""}},attributeKeys:["style"],hasSupport:e=>(0,c.hasBlockSupport)(e,"filter.duotone")};function lh({clientId:e,id:t,selector:n,attribute:o}){const r=nh({presetSetting:"color.duotone",defaultSetting:"color.defaultDuotone"}),l=Array.isArray(o),i=l?void 0:oh(o,r),s="string"==typeof o&&i;let a=null;s?a=i:("string"==typeof o&&!s||l)&&(a=o);const c=n.split(",").map((e=>`.${t}${e.trim()}`)).join(", "),d=Array.isArray(a)||"unset"===a;bl(d?{css:"unset"!==a?Gm(c,t):Hm(c),__unstableType:"presets"}:void 0),bl(d?{assets:"unset"!==a?Um(t,a):"",__unstableType:"svgs"}:void 0);const p=bd(e);(0,u.useEffect)((()=>{if(d&&p&&th){const e=p.style.display;p.style.display="inline-block",p.offsetHeight,p.style.display=e}}),[d,p])}function ih(e){return(0,d.useSelect)((t=>{if(!e)return null;const{getBlockName:n,getBlockAttributes:o,__experimentalGetReusableBlockTitle:r}=t(Nr),{getBlockType:l,getActiveBlockVariation:i}=t(c.store),s=n(e),a=l(s);if(!a)return null;const u=o(e),d=i(s,u),p=(0,c.isReusableBlock)(a),m=(p?r(u.ref):void 0)||a.title,h=p||(0,c.isTemplatePart)(a),g=function(e){const t=e?.style?.position?.type;return"sticky"===t?(0,x.__)("Sticky"):"fixed"===t?(0,x.__)("Fixed"):null}(u),f={isSynced:h,title:m,icon:a.icon,description:a.description,anchor:u?.anchor,positionLabel:g,positionType:u?.style?.position?.type,name:u?.metadata?.name};return d?{isSynced:h,title:d.title||a.title,icon:d.icon||a.icon,description:d.description||a.description,anchor:u?.anchor,positionLabel:g,positionType:u?.style?.position?.type,name:u?.metadata?.name}:f}),[e])}(0,m.addFilter)("blocks.registerBlockType","core/editor/duotone/add-attributes",(function(e){return(0,c.hasBlockSupport)(e,"filter.duotone")?(e.attributes.style||Object.assign(e.attributes,{style:{type:"object"}}),e):e}));const{CustomSelectControl:sh}=ie(_l.privateApis),ah="position",ch="block-editor-hooks__position-selection__select-control__option",uh={key:"default",value:"",name:(0,x.__)("Default"),className:ch},dh={key:"sticky",value:"sticky",name:(0,x._x)("Sticky","Name for the value of the CSS position property"),className:ch,__experimentalHint:(0,x.__)("The block will stick to the top of the window instead of scrolling.")},ph={key:"fixed",value:"fixed",name:(0,x._x)("Fixed","Name for the value of the CSS position property"),className:ch,__experimentalHint:(0,x.__)("The block will not move when the page is scrolled.")},mh=["top","right","bottom","left"],hh=["sticky","fixed"];function gh(e){const t=e.style?.position?.type;return"sticky"===t||"fixed"===t}function fh({name:e}={}){const[t,n]=Ar("position.fixed","position.sticky"),o=!t&&!n;return r=e,!(0,c.getBlockSupport)(r,ah)||o;var r}function bh({style:e={},clientId:t,name:n,setAttributes:o}){const r=function(e){const t=(0,c.getBlockSupport)(e,ah);return!(!0!==t&&!t?.fixed)}(n),l=function(e){const t=(0,c.getBlockSupport)(e,ah);return!(!0!==t&&!t?.sticky)}(n),i=e?.position?.type,{firstParentClientId:a}=(0,d.useSelect)((e=>{const{getBlockParents:n}=e(Nr),o=n(t);return{firstParentClientId:o[o.length-1]}}),[t]),p=ih(a),m=l&&i===dh.value&&p?(0,x.sprintf)((0,x.__)("The block will stick to the scrollable area of the parent %s block."),p.title):null,h=(0,u.useMemo)((()=>{const e=[uh];return(l||i===dh.value)&&e.push(dh),(r||i===ph.value)&&e.push(ph),e}),[r,l,i]),g=i&&h.find((e=>e.value===i))||uh;return u.Platform.select({web:h.length>1?(0,s.createElement)(Bs,{group:"position"},(0,s.createElement)(_l.BaseControl,{className:"block-editor-hooks__position-selection",__nextHasNoMarginBottom:!0,help:m},(0,s.createElement)(sh,{__nextUnconstrainedWidth:!0,__next40pxDefaultSize:!0,className:"block-editor-hooks__position-selection__select-control",label:(0,x.__)("Position"),hideLabelFromVision:!0,describedBy:(0,x.sprintf)((0,x.__)("Currently selected position: %s"),g.name),options:h,value:g,__experimentalShowSelectedHint:!0,onChange:({selectedItem:t})=>{(t=>{const n={...e,position:{...e?.position,type:t,top:"sticky"===t||"fixed"===t?"0px":void 0}};o({style:hl(n)})})(t.value)},size:"__unstable-large"}))):null,native:null})}const vh={edit:function(e){return fh(e)?null:(0,s.createElement)(bh,{...e})},useBlockProps:function e({name:t,style:n}){const o=(0,c.hasBlockSupport)(t,ah),r=fh({name:t}),l=o&&!r,i=(0,p.useInstanceId)(e),s=`.wp-container-${i}.wp-container-${i}`;let a;l&&(a=function({selector:e,style:t}){let n="";const{type:o}=t?.position||{};return hh.includes(o)?(n+=`${e} {`,n+=`position: ${o};`,mh.forEach((e=>{void 0!==t?.position?.[e]&&(n+=`${e}: ${t.position[e]};`)})),"sticky"!==o&&"fixed"!==o||(n+="z-index: 10"),n+="}",n):n}({selector:s,style:n})||"");const u=ml()({[`wp-container-${i}`]:l&&!!a,[`is-position-${n?.position?.type}`]:l&&!!a&&!!n?.position?.type});return bl({css:a}),{className:u}},attributeKeys:["style"],hasSupport:e=>(0,c.hasBlockSupport)(e,ah)};const kh="layout";function _h(e){return(0,c.hasBlockSupport)(e,"layout")||(0,c.hasBlockSupport)(e,"__experimentalLayout")}function yh(e={},t=""){const{kebabCase:n}=ie(_l.privateApis),o=(0,d.useSelect)((e=>{const{getSettings:t}=e(Nr);return t().__experimentalFeatures?.useRootPaddingAwareAlignments}),[]),{layout:r}=e,{default:l}=(0,c.getBlockSupport)(t,kh)||{},i=r?.inherit||r?.contentSize||r?.wideSize?{...r,type:"constrained"}:r||l||{},s=[];if(Al[i?.type||"default"]?.className){const e=Al[i?.type||"default"]?.className,n=t.split("/"),o=`wp-block-${"core"===n[0]?n.pop():n.join("-")}-${e}`;s.push(e,o)}return(i?.inherit||i?.contentSize||"constrained"===i?.type)&&o&&s.push("has-global-padding"),i?.orientation&&s.push(`is-${n(i.orientation)}`),i?.justifyContent&&s.push(`is-content-justification-${n(i.justifyContent)}`),i?.flexWrap&&"nowrap"===i.flexWrap&&s.push("is-nowrap"),s}const Eh={shareWithChildBlocks:!0,edit:function({layout:e,setAttributes:t,name:n}){const o=vl(n),{layout:r}=o,[l]=Ar("layout"),{themeSupportsLayout:i}=(0,d.useSelect)((e=>{const{getSettings:t}=e(Nr);return{themeSupportsLayout:t().supportsLayout}}),[]);if("default"!==ns())return null;const a=(0,c.getBlockSupport)(n,kh,{}),u={...r,...a},{allowSwitching:p,allowEditing:m=!0,allowInheriting:h=!0,default:g}=u;if(!m)return null;const f=!(!h||!l||e?.type&&"default"!==e?.type&&"constrained"!==e?.type&&!e?.inherit),b=e||g||{},{inherit:v=!1,type:k="default",contentSize:_=null}=b;if(("default"===k||"constrained"===k)&&!i)return null;const y=Vi(k),E=Vi("constrained"),w=!b.type&&(_||v),S=!!v||!!_,C=e=>t({layout:e});return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Bs,null,(0,s.createElement)(_l.PanelBody,{title:(0,x.__)("Layout")},f&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.ToggleControl,{__nextHasNoMarginBottom:!0,className:"block-editor-hooks__toggle-control",label:(0,x.__)("Inner blocks use content width"),checked:"constrained"===y?.name||S,onChange:()=>t({layout:{type:"constrained"===y?.name||S?"default":"constrained"}}),help:"constrained"===y?.name||S?(0,x.__)("Nested blocks use content width with options for full and wide widths."):(0,x.__)("Nested blocks will fill the width of this container. Toggle to constrain.")})),!v&&p&&(0,s.createElement)(wh,{type:k,onChange:e=>t({layout:{type:e}})}),y&&"default"!==y.name&&(0,s.createElement)(y.inspectorControls,{layout:b,onChange:C,layoutBlockSupport:u}),E&&w&&(0,s.createElement)(E.inspectorControls,{layout:b,onChange:C,layoutBlockSupport:u}))),!v&&y&&(0,s.createElement)(y.toolBarControls,{layout:b,onChange:C,layoutBlockSupport:a}))},attributeKeys:["layout"],hasSupport:e=>_h(e)};function wh({type:e,onChange:t}){return(0,s.createElement)(_l.ButtonGroup,null,zi.map((({name:n,label:o})=>(0,s.createElement)(_l.Button,{key:n,isPressed:e===n,onClick:()=>t(n)},o))))}function Sh({block:e,props:t,layoutClasses:n}){const{name:o,attributes:r}=t,l=(0,p.useInstanceId)(e),{layout:i}=r,{default:a}=(0,c.getBlockSupport)(o,kh)||{},u=i?.inherit||i?.contentSize||i?.wideSize?{...i,type:"constrained"}:i||a||{},{kebabCase:d}=ie(_l.privateApis),m=`wp-container-${d(o)}-is-layout-`,h=`.${m}${l}.${m}${l}`,[g]=Ar("spacing.blockGap"),f=null!==g,b=Vi(u?.type||"default"),v=b?.getLayoutStyle?.({blockName:o,selector:h,layout:u,style:r?.style,hasBlockGapSupport:f}),k=ml()({[`${m}${l}`]:!!v},n);return bl({css:v}),(0,s.createElement)(e,{...t,__unstableLayoutClassNames:k})}const Ch=(0,p.createHigherOrderComponent)((e=>t=>{const{name:n,attributes:o}=t,r=_h(t.name),l=yh(o,n);return(0,d.useSelect)((e=>!!r&&!e(Nr).getSettings().disableLayoutStyles),[r])?(0,s.createElement)(Sh,{block:e,props:t,layoutClasses:l}):(0,s.createElement)(e,{...t,__unstableLayoutClassNames:r?l:void 0})}),"withLayoutStyles");(0,m.addFilter)("blocks.registerBlockType","core/layout/addAttribute",(function(e){var t;return"type"in(null!==(t=e.attributes?.layout)&&void 0!==t?t:{})||_h(e)&&(e.attributes={...e.attributes,layout:{type:"object"}}),e})),(0,m.addFilter)("editor.BlockListBlock","core/editor/layout/with-layout-styles",Ch);const xh={useBlockProps:function e({style:t}){var n;const o=(0,d.useSelect)((e=>!e(Nr).getSettings().disableLayoutStyles)),r=null!==(n=t?.layout)&&void 0!==n?n:{},{selfStretch:l,flexSize:i}=r,s=(0,p.useInstanceId)(e),a=`.wp-container-content-${s}`;let c="";if(o&&("fixed"===l&&i?c=`${a} {\n\t\t\t\tflex-basis: ${i};\n\t\t\t\tbox-sizing: border-box;\n\t\t\t}`:"fill"===l&&(c=`${a} {\n\t\t\t\tflex-grow: 1;\n\t\t\t}`)),bl({css:c}),c)return{className:`wp-container-content-${s}`}},attributeKeys:["style"],hasSupport:()=>!0};function Bh(e){return(0,d.useSelect)((t=>{const{getBlocksByClientId:n,getSelectedBlockClientIds:o,isUngroupable:r,isGroupable:l}=t(Nr),{getGroupingBlockName:i,getBlockType:s}=t(c.store),a=e?.length?e:o(),u=n(a),[d]=u,p=1===a.length&&r(a[0]);return{clientIds:a,isGroupable:l(a),isUngroupable:p,blocksSelection:u,groupingBlockName:i(),onUngroup:p&&s(d.name)?.transforms?.ungroup}}),[e])}function Ih({clientIds:e,isGroupable:t,isUngroupable:n,onUngroup:o,blocksSelection:r,groupingBlockName:l,onClose:i=(()=>{})}){const{replaceBlocks:a}=(0,d.useDispatch)(Nr);return t||n?(0,s.createElement)(s.Fragment,null,t&&(0,s.createElement)(_l.MenuItem,{onClick:()=>{(()=>{const t=(0,c.switchToBlockType)(r,l);t&&a(e,t)})(),i()}},(0,x._x)("Group","verb")),n&&(0,s.createElement)(_l.MenuItem,{onClick:()=>{(()=>{let t=r[0].innerBlocks;t.length&&(o&&(t=o(r[0].attributes,r[0].innerBlocks)),a(e,t))})(),i()}},(0,x._x)("Ungroup","Ungrouping blocks from within a grouping block back into individual blocks within the Editor "))):null}function Th(e){return(0,d.useSelect)((t=>{const{canEditBlock:n,canMoveBlock:o,canRemoveBlock:r,canLockBlockType:l,getBlockName:i,getBlockRootClientId:s,getTemplateLock:a}=t(Nr),c=s(e),u=n(e),d=o(e,c),p=r(e,c);return{canEdit:u,canMove:d,canRemove:p,canLock:l(i(e)),isContentLocked:"contentOnly"===a(e),isLocked:!u||!d||!p}}),[e])}const Mh=(0,s.createElement)(Z.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(Z.Path,{d:"M17 10h-1.2V7c0-2.1-1.7-3.8-3.8-3.8-2.1 0-3.8 1.7-3.8 3.8h1.5c0-1.2 1-2.2 2.2-2.2s2.2 1 2.2 2.2v3H7c-.6 0-1 .4-1 1v8c0 .6.4 1 1 1h10c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1z"})),Ph=(0,s.createElement)(Z.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(Z.Path,{d:"M17 10h-1.2V7c0-2.1-1.7-3.8-3.8-3.8-2.1 0-3.8 1.7-3.8 3.8v3H7c-.6 0-1 .4-1 1v8c0 .6.4 1 1 1h10c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1zM9.8 7c0-1.2 1-2.2 2.2-2.2 1.2 0 2.2 1 2.2 2.2v3H9.8V7zm6.7 11.5h-9v-7h9v7z"})),Rh=(0,s.createElement)(Z.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(Z.Path,{d:"M17 10h-1.2V7c0-2.1-1.7-3.8-3.8-3.8-2.1 0-3.8 1.7-3.8 3.8v3H7c-.6 0-1 .4-1 1v8c0 .6.4 1 1 1h10c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1zm-2.8 0H9.8V7c0-1.2 1-2.2 2.2-2.2s2.2 1 2.2 2.2v3z"})),Nh=["core/block","core/navigation"];function Lh(e){return e.remove&&e.move?"all":!(!e.remove||e.move)&&"insert"}function Ah({clientId:e,onClose:t}){const[n,o]=(0,u.useState)({move:!1,remove:!1}),{canEdit:r,canMove:l,canRemove:i}=Th(e),{allowsEditLocking:a,templateLock:m,hasTemplateLock:h}=(0,d.useSelect)((t=>{const{getBlockName:n,getBlockAttributes:o}=t(Nr),r=n(e),l=(0,c.getBlockType)(r);return{allowsEditLocking:Nh.includes(r),templateLock:o(e)?.templateLock,hasTemplateLock:!!l?.attributes?.templateLock}}),[e]),[g,f]=(0,u.useState)(!!m),{updateBlockAttributes:b}=(0,d.useDispatch)(Nr),v=ih(e),k=(0,p.useInstanceId)(Ah,"block-editor-block-lock-modal__options-title");(0,u.useEffect)((()=>{o({move:!l,remove:!i,...a?{edit:!r}:{}})}),[r,l,i,a]);const _=Object.values(n).every(Boolean),y=Object.values(n).some(Boolean)&&!_;return(0,s.createElement)(_l.Modal,{title:(0,x.sprintf)((0,x.__)("Lock %s"),v.title),overlayClassName:"block-editor-block-lock-modal",onRequestClose:t},(0,s.createElement)("p",null,(0,x.__)("Choose specific attributes to restrict or lock all available options.")),(0,s.createElement)("form",{onSubmit:o=>{o.preventDefault(),b([e],{lock:n,templateLock:g?Lh(n):void 0}),t()}},(0,s.createElement)("div",{role:"group","aria-labelledby":k,className:"block-editor-block-lock-modal__options"},(0,s.createElement)(_l.CheckboxControl,{__nextHasNoMarginBottom:!0,className:"block-editor-block-lock-modal__options-title",label:(0,s.createElement)("span",{id:k},(0,x.__)("Lock all")),checked:_,indeterminate:y,onChange:e=>o({move:e,remove:e,...a?{edit:e}:{}})}),(0,s.createElement)("ul",{className:"block-editor-block-lock-modal__checklist"},a&&(0,s.createElement)("li",{className:"block-editor-block-lock-modal__checklist-item"},(0,s.createElement)(_l.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Restrict editing"),checked:!!n.edit,onChange:e=>o((t=>({...t,edit:e})))}),(0,s.createElement)(_l.Icon,{className:"block-editor-block-lock-modal__lock-icon",icon:n.edit?Rh:Mh})),(0,s.createElement)("li",{className:"block-editor-block-lock-modal__checklist-item"},(0,s.createElement)(_l.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Disable movement"),checked:n.move,onChange:e=>o((t=>({...t,move:e})))}),(0,s.createElement)(_l.Icon,{className:"block-editor-block-lock-modal__lock-icon",icon:n.move?Rh:Mh})),(0,s.createElement)("li",{className:"block-editor-block-lock-modal__checklist-item"},(0,s.createElement)(_l.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Prevent removal"),checked:n.remove,onChange:e=>o((t=>({...t,remove:e})))}),(0,s.createElement)(_l.Icon,{className:"block-editor-block-lock-modal__lock-icon",icon:n.remove?Rh:Mh}))),h&&(0,s.createElement)(_l.ToggleControl,{__nextHasNoMarginBottom:!0,className:"block-editor-block-lock-modal__template-lock",label:(0,x.__)("Apply to all blocks inside"),checked:g,disabled:n.move&&!n.remove,onChange:()=>f(!g)})),(0,s.createElement)(_l.Flex,{className:"block-editor-block-lock-modal__actions",justify:"flex-end",expanded:!1},(0,s.createElement)(_l.FlexItem,null,(0,s.createElement)(_l.Button,{variant:"tertiary",onClick:t},(0,x.__)("Cancel"))),(0,s.createElement)(_l.FlexItem,null,(0,s.createElement)(_l.Button,{variant:"primary",type:"submit"},(0,x.__)("Apply"))))))}function Oh({clientId:e}){const{canLock:t,isLocked:n}=Th(e),[o,r]=(0,u.useReducer)((e=>!e),!1);if(!t)return null;const l=n?(0,x.__)("Unlock"):(0,x.__)("Lock");return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.MenuItem,{icon:n?Mh:Ph,onClick:r,"aria-expanded":o,"aria-haspopup":"dialog"},l),o&&(0,s.createElement)(Ah,{clientId:e,onClose:r}))}const Dh=()=>{};const zh=(0,p.compose)([(0,d.withSelect)(((e,{clientId:t})=>{const{getBlock:n,getBlockMode:o,getSettings:r}=e(Nr),l=n(t),i=r().codeEditingEnabled;return{mode:o(t),blockType:l?(0,c.getBlockType)(l.name):null,isCodeEditingEnabled:i}})),(0,d.withDispatch)(((e,{onToggle:t=Dh,clientId:n})=>({onToggleMode(){e(Nr).toggleBlockMode(n),t()}})))])((function({blockType:e,mode:t,onToggleMode:n,small:o=!1,isCodeEditingEnabled:r=!0}){if(!e||!(0,c.hasBlockSupport)(e,"html",!0)||!r)return null;const l="visual"===t?(0,x.__)("Edit as HTML"):(0,x.__)("Edit visually");return(0,s.createElement)(_l.MenuItem,{onClick:n},!o&&l)}));function Vh(e){return 0===e?.trim()?.length}function Fh({blockName:e,originalBlockName:t,onClose:n,onSave:o}){const[r,l]=(0,u.useState)(e),i=r!==e,a=r===t,c=Vh(r),d=i||a,m=(0,p.useInstanceId)(Fh,"block-editor-rename-modal__description");return(0,s.createElement)(_l.Modal,{title:(0,x.__)("Rename"),onRequestClose:n,overlayClassName:"block-editor-block-rename-modal",aria:{describedby:m},focusOnMount:"firstContentElement"},(0,s.createElement)("p",{id:m},(0,x.__)("Enter a custom name for this block.")),(0,s.createElement)("form",{onSubmit:e=>{e.preventDefault(),d&&(()=>{const e=a||c?(0,x.sprintf)((0,x.__)('Block name reset to: "%s".'),r):(0,x.sprintf)((0,x.__)('Block name changed to: "%s".'),r);(0,vo.speak)(e,"assertive"),o(r),n()})()}},(0,s.createElement)(_l.__experimentalVStack,{spacing:"3"},(0,s.createElement)(_l.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,value:r,label:(0,x.__)("Block name"),hideLabelFromVision:!0,placeholder:t,onChange:l,onFocus:e=>e.target.select()}),(0,s.createElement)(_l.__experimentalHStack,{justify:"right"},(0,s.createElement)(_l.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:n},(0,x.__)("Cancel")),(0,s.createElement)(_l.Button,{__next40pxDefaultSize:!0,"aria-disabled":!d,variant:"primary",type:"submit"},(0,x.__)("Save"))))))}function Hh({clientId:e}){const[t,n]=(0,u.useState)(!1),{metadata:o}=(0,d.useSelect)((t=>{const{getBlockAttributes:n}=t(Nr),o=n(e)?.metadata;return{metadata:o}}),[e]),{updateBlockAttributes:r}=(0,d.useDispatch)(Nr),l=o?.name;const i=ih(e);return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.MenuItem,{onClick:()=>{n(!0)},"aria-expanded":t,"aria-haspopup":"dialog"},(0,x.__)("Rename")),t&&(0,s.createElement)(Fh,{blockName:l||"",originalBlockName:i?.title,onClose:()=>n(!1),onSave:t=>{(t===i?.title||Vh(t))&&(t=void 0),function(t){r([e],{metadata:{...o&&o,name:t}})}(t)}}))}const{Fill:Gh,Slot:Uh}=(0,_l.createSlotFill)("BlockSettingsMenuControls");function $h({...e}){return(0,s.createElement)(_l.__experimentalStyleProvider,{document},(0,s.createElement)(Gh,{...e}))}$h.Slot=({fillProps:e,clientIds:t=null,__unstableDisplayLocation:n})=>{const{selectedBlocks:o,selectedClientIds:r}=(0,d.useSelect)((e=>{const{getBlockNamesByClientId:n,getSelectedBlockClientIds:o}=e(Nr),r=null!==t?t:o();return{selectedBlocks:n(r),selectedClientIds:r}}),[t]),{canLock:l}=Th(r[0]),{canRename:i}=(a=o[0],{canRename:(0,c.getBlockSupport)(a,"renaming",!0)});var a;const u=1===r.length&&l,m=1===r.length&&i,h=Bh(r),{isGroupable:g,isUngroupable:f}=h,b=g||f;return(0,s.createElement)(Uh,{fillProps:{...e,__unstableDisplayLocation:n,selectedBlocks:o,selectedClientIds:r}},(t=>!t?.length>0&&!b&&!u?null:(0,s.createElement)(_l.MenuGroup,null,b&&(0,s.createElement)(Ih,{...h,onClose:e?.onClose}),u&&(0,s.createElement)(Oh,{clientId:r[0]}),m&&(0,s.createElement)(Hh,{clientId:r[0]}),t,e?.canMove&&!e?.onlyBlock&&(0,s.createElement)(_l.MenuItem,{onClick:(0,p.pipe)(e?.onClose,e?.onMoveTo)},(0,x.__)("Move to")),1===e?.count&&(0,s.createElement)(zh,{clientId:e?.firstBlockClientId,onToggle:e?.onClose}))))};const jh=$h;const Wh={edit:function({clientId:e,isSelected:t}){const{getBlockListSettings:n,getSettings:o}=(0,d.useSelect)(Nr),{templateLock:r,isLockedByParent:l,isEditingAsBlocks:i}=(0,d.useSelect)((t=>{const{__unstableGetContentLockingParent:n,getTemplateLock:o,__unstableGetTemporarilyEditingAsBlocks:r}=t(Nr);return{templateLock:o(e),isLockedByParent:!!n(e),isEditingAsBlocks:r()===e}}),[e]),{updateSettings:a,updateBlockListSettings:c,__unstableSetTemporarilyEditingAsBlocks:p}=(0,d.useDispatch)(Nr),{stopEditingAsBlocks:m}=ie((0,d.useDispatch)(Nr)),h=!l&&"contentOnly"===r,{__unstableMarkNextChangeAsNotPersistent:g,updateBlockAttributes:f}=(0,d.useDispatch)(Nr),b=(0,u.useCallback)((()=>{m(e)}),[e,m]);if(!h&&!i)return null;const v=i&&!h,k=!i&&h&&t;return(0,s.createElement)(s.Fragment,null,v&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Bl,{group:"other"},(0,s.createElement)(_l.ToolbarButton,{onClick:b},(0,x.__)("Done")))),k&&(0,s.createElement)(jh,null,(({onClose:t})=>(0,s.createElement)(_l.MenuItem,{onClick:()=>{g(),f(e,{templateLock:void 0}),c(e,{...n(e),templateLock:!1});const r=o().focusMode;a({focusMode:!0}),p(e,r),t()}},(0,x.__)("Modify")))))},hasSupport:()=>!0},Kh="metadata";(0,m.addFilter)("blocks.registerBlockType","core/metadata/addMetaAttribute",(function(e){return e?.attributes?.[Kh]?.type||(e.attributes={...e.attributes,[Kh]:{type:"object"}}),e}));const Zh=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.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"}));const qh=(0,u.memo)((function({icon:e,showColors:t=!1,className:n,context:o}){"block-default"===e?.src&&(e={src:Zh});const r=(0,s.createElement)(_l.Icon,{icon:e&&e.src?e.src:e,context:o}),l=t?{backgroundColor:e&&e.background,color:e&&e.foreground}:{};return(0,s.createElement)("span",{style:l,className:ml()("block-editor-block-icon",n,{"has-colors":t})},r)})),Yh={};const Xh={edit:function({name:e,clientId:t,metadata:{ignoredHookedBlocks:n=[]}={}}){const o=(0,d.useSelect)((e=>e(c.store).getBlockTypes()),[]),r=(0,u.useMemo)((()=>o?.filter((({name:t,blockHooks:o})=>o&&e in o||n.includes(t)))),[o,e,n]),{blockIndex:l,rootClientId:i,innerBlocksLength:a}=(0,d.useSelect)((e=>{const{getBlocks:n,getBlockIndex:o,getBlockRootClientId:r}=e(Nr);return{blockIndex:o(t),innerBlocksLength:n(t)?.length,rootClientId:r(t)}}),[t]),p=(0,d.useSelect)((n=>{const{getBlocks:o,getGlobalBlockCount:l}=n(Nr),s=r.reduce(((n,r)=>{if(0===l(r.name))return n;const s=r?.blockHooks?.[e];let a;switch(s){case"before":case"after":a=o(i);break;case"first_child":case"last_child":a=o(t);break;case void 0:a=[...o(i),...o(t)]}const c=a?.find((e=>e.name===r.name));return c?{...n,[r.name]:c.clientId}:n}),{});return Object.values(s).length>0?s:Yh}),[r,e,t,i]),{insertBlock:m,removeBlock:h}=(0,d.useDispatch)(Nr);if(!r.length)return null;const g=r.reduce(((e,t)=>{const[n]=t.name.split("/");return e[n]||(e[n]=[]),e[n].push(t),e}),{});return(0,s.createElement)(Bs,null,(0,s.createElement)(_l.PanelBody,{className:"block-editor-hooks__block-hooks",title:(0,x.__)("Plugins"),initialOpen:!0},(0,s.createElement)("p",{className:"block-editor-hooks__block-hooks-helptext"},(0,x.__)("Manage the inclusion of blocks added automatically by plugins.")),Object.keys(g).map((n=>(0,s.createElement)(u.Fragment,{key:n},(0,s.createElement)("h3",null,n),g[n].map((n=>{const o=n.name in p;return(0,s.createElement)(_l.ToggleControl,{checked:o,key:n.title,label:(0,s.createElement)(_l.__experimentalHStack,{justify:"flex-start"},(0,s.createElement)(qh,{icon:n.icon}),(0,s.createElement)("span",null,n.title)),onChange:()=>{if(o)h(p[n.name],!1);else{const o=n.blockHooks[e];((e,n)=>{switch(n){case"before":case"after":m(e,"after"===n?l+1:l,i,!1);break;case"first_child":case"last_child":m(e,"first_child"===n?0:a,t,!1);break;case void 0:m(e,l+1,i,!1)}})((0,c.createBlock)(n.name),o)}}})})))))))},attributeKeys:["metadata"],hasSupport:()=>!0};const Qh={edit:function({metadata:e,setAttributes:t}){return(0,s.createElement)(Bs,{group:"advanced"},(0,s.createElement)(_l.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,x.__)("Block name"),value:e?.name||"",onChange:n=>{t({metadata:{...e,name:n}})}}))},attributeKeys:["metadata"],hasSupport:e=>(0,c.hasBlockSupport)(e,"renaming",!0)};(0,m.addFilter)("blocks.registerBlockType","core/metadata/addLabelCallback",(function(e){return e.__experimentalLabel||(0,c.hasBlockSupport)(e,"renaming",!0)&&(e.__experimentalLabel=(e,{context:t})=>{const{metadata:n}=e;if("list-view"===t&&n?.name)return n.name}),e}));const Jh={"core/paragraph":["content"],"core/heading":["content"],"core/image":["url","title","alt"],"core/button":["url","text","linkTarget"]};function eg(e){return e in Jh}const tg=({args:e,attrName:t,blockProps:n,source:o,onPropValueChange:r})=>{const{placeholder:l,value:i}=o.useSource(n,e),{name:s}=n,a=n.attributes[t],d=(0,u.useCallback)(((e,n)=>{if(n instanceof Y.RichTextData){if(n.toHTMLString()===e)return;e=Y.RichTextData.fromHTMLString(e)}n!==e&&r({[t]:e})}),[t,r]);return(0,u.useLayoutEffect)((()=>{if(void 0!==i)d(i,a);else if(l){const e=(0,c.getBlockType)(s).attributes[t].attribute;if("src"===e||"href"===e)return void d(null);d(l)}}),[d,i,a,l,s,t]),null};function ng({blockProps:e,bindings:t,onPropValueChange:n}){const o=ie((0,d.useSelect)(c.store)).getAllBlockBindingsSources();return(0,s.createElement)(s.Fragment,null,Object.entries(t).map((([t,r])=>{const l=o[r.source];return l?.useSource?(0,s.createElement)(tg,{key:t,attrName:t,source:l,blockProps:e,args:r.args,onPropValueChange:n}):null})))}const og=(0,p.createHigherOrderComponent)((e=>t=>{const[n,o]=(0,u.useState)({}),r=(0,u.useCallback)((e=>o((t=>({...t,...e})))),[]),l=Object.fromEntries(Object.entries(t.attributes.metadata?.bindings||{}).filter((([e])=>{return n=t.name,o=e,eg(n)&&Jh[n].includes(o);var n,o})));return(0,s.createElement)(s.Fragment,null,Object.keys(l).length>0&&(0,s.createElement)(ng,{blockProps:t,bindings:l,onPropValueChange:r}),(0,s.createElement)(e,{...t,attributes:{...t.attributes,...n}}))}),"withBlockBindingSupport");function rg(e){const t=e.style?.border||{};return{className:Fu(e)||void 0,style:Mm({border:t})}}function lg(e){const{colors:t}=qc(),n=rg(e),{borderColor:o}=e;if(o){const e=Pu({colors:t,namedColor:o});n.style.borderColor=e.color}return n}function ig(e){return{style:Mm({shadow:e.style?.shadow||""})}}function sg(e){const{backgroundColor:t,textColor:n,gradient:o,style:r}=e,l=Zc("background-color",t),i=Zc("color",n),s=Gu(o),a=s||r?.color?.gradient;return{className:ml()(i,s,{[l]:!a&&!!l,"has-text-color":n||r?.color?.text,"has-background":t||r?.color?.background||o||r?.color?.gradient,"has-link-color":r?.elements?.link?.color})||void 0,style:Mm({color:r?.color||{}})}}function ag(e){const{backgroundColor:t,textColor:n,gradient:o}=e,[r,l,i,s,a,c]=Ar("color.palette.custom","color.palette.theme","color.palette.default","color.gradients.custom","color.gradients.theme","color.gradients.default"),d=(0,u.useMemo)((()=>[...r||[],...l||[],...i||[]]),[r,l,i]),p=(0,u.useMemo)((()=>[...s||[],...a||[],...c||[]]),[s,a,c]),m=sg(e);if(t){const e=Wc(d,t);m.style.backgroundColor=e.color}if(o&&(m.style.background=Uu(p,o)),n){const e=Wc(d,n);m.style.color=e.color}return m}function cg(e){const{style:t}=e;return{style:Mm({spacing:t?.spacing||{}})}}function ug(e,t){const{kebabCase:n}=ie(_l.privateApis);let o=e?.style?.typography||{};const r=Zr(t);o={...o,fontSize:Wr({size:e?.style?.typography?.fontSize},r)};const l=Mm({typography:o}),i=e?.fontFamily?`has-${n(e.fontFamily)}-font-family`:"";return{className:ml()(i,Sp(e?.fontSize)),style:l}}function dg(e){const[t,n]=(0,u.useState)(e);return(0,u.useEffect)((()=>{e&&n(e)}),[e]),t}var pg;(0,m.addFilter)("blocks.registerBlockType","core/editor/custom-sources-backwards-compatibility/shim-attribute-source",(function(e,t){return eg(t)?{...e,edit:og(e.edit)}:e})),function(e){e=e.map((e=>({...e,Edit:(0,u.memo)(e.edit)})));const t=(0,p.createHigherOrderComponent)((t=>n=>{const o=y();return[...e.map(((e,t)=>{const{Edit:r,hasSupport:l,attributeKeys:i=[],shareWithChildBlocks:a}=e;if(!(o[h]||o[g]&&a)||!l(n.name))return null;const c={};for(const e of i)n.attributes[e]&&(c[e]=n.attributes[e]);return(0,s.createElement)(r,{key:t,name:n.name,isSelected:n.isSelected,clientId:n.clientId,setAttributes:n.setAttributes,__unstableParentLayout:n.__unstableParentLayout,...c})})),(0,s.createElement)(t,{key:"edit",...n})]}),"withBlockEditHooks");(0,m.addFilter)("editor.BlockEdit","core/editor/hooks",t)}([is,Ms,Ns,Dm,rh,vh,Eh,Wh,Xh,Qh].filter(Boolean)),function(e){const t=(0,p.createHigherOrderComponent)((t=>n=>{const[o,r]=(0,u.useState)(Array(e.length).fill(void 0));return[...e.map(((e,t)=>{const{hasSupport:o,attributeKeys:l=[],useBlockProps:i}=e,a={};for(const e of l)n.attributes[e]&&(a[e]=n.attributes[e]);return Object.keys(a).length&&o(n.name)?(0,s.createElement)(kl,{key:t,index:t,useBlockProps:i,setAllWrapperProps:r,name:n.name,...a}):null})),(0,s.createElement)(t,{key:"edit",...n,wrapperProps:o.filter(Boolean).reduce(((e,t)=>({...e,...t,className:ml()(e.className,t.className),style:{...e.style,...t.style}})),n.wrapperProps||{})})]}),"withBlockListBlockHooks");(0,m.addFilter)("editor.BlockListBlock","core/editor/hooks",t)}([is,Dm,Pd,xm,rh,yp,Bp,Hu,vh,xh]),pg=[is,Ms,Rs,Ns,Hu,Pd,Dm,yp,Bp],(0,m.addFilter)("blocks.getSaveContent.extraProps","core/editor/hooks",(function(e,t,n){return pg.reduce(((e,o)=>{const{hasSupport:r,attributeKeys:l=[],addSaveProps:i}=o,s={};for(const e of l)n[e]&&(s[e]=n[e]);return Object.keys(s).length&&r(t)?i(e,t,s):e}),e)}),0),(0,m.addFilter)("blocks.getSaveContent.extraProps","core/editor/hooks",(e=>(e.hasOwnProperty("className")&&!e.className&&delete e.className,e)));const mg=([e,...t])=>e.toUpperCase()+t.join(""),hg=e=>(0,p.createHigherOrderComponent)((t=>n=>(0,s.createElement)(t,{...n,colors:e})),"withCustomColorPalette"),gg=()=>(0,p.createHigherOrderComponent)((e=>t=>{const[n,o,r]=Ar("color.palette.custom","color.palette.theme","color.palette.default"),l=(0,u.useMemo)((()=>[...n||[],...o||[],...r||[]]),[n,o,r]);return(0,s.createElement)(e,{...t,colors:l})}),"withEditorColorPalette");function fg(e,t){const{kebabCase:n}=ie(_l.privateApis),o=e.reduce(((e,t)=>({...e,..."string"==typeof t?{[t]:n(t)}:t})),{});return(0,p.compose)([t,e=>class extends u.Component{constructor(e){super(e),this.setters=this.createSetters(),this.colorUtils={getMostReadableColor:this.getMostReadableColor.bind(this)},this.state={}}getMostReadableColor(e){const{colors:t}=this.props;return function(e,t){const n=Vc(t),o=({color:e})=>n.contrast(e),r=Math.max(...e.map(o));return e.find((e=>o(e)===r)).color}(t,e)}createSetters(){return Object.keys(o).reduce(((e,t)=>{const n=mg(t),o=`custom${n}`;return e[`set${n}`]=this.createSetColor(t,o),e}),{})}createSetColor(e,t){return n=>{const o=Kc(this.props.colors,n);this.props.setAttributes({[e]:o&&o.slug?o.slug:void 0,[t]:o&&o.slug?void 0:n})}}static getDerivedStateFromProps({attributes:e,colors:t},n){return Object.entries(o).reduce(((o,[r,l])=>{const i=Wc(t,e[r],e[`custom${mg(r)}`]),s=n[r],a=s?.color;return a===i.color&&s?o[r]=s:o[r]={...i,class:Zc(l,i.slug)},o}),{})}render(){return(0,s.createElement)(e,{...this.props,colors:void 0,...this.state,...this.setters,colorUtils:this.colorUtils})}}])}function bg(e){return(...t)=>{const n=hg(e);return(0,p.createHigherOrderComponent)(fg(t,n),"withCustomColors")}}function vg(...e){const t=gg();return(0,p.createHigherOrderComponent)(fg(e,t),"withColors")}const kg=function(e){const[t,n]=Ar("typography.fontSizes","typography.customFontSize");return(0,s.createElement)(_l.FontSizePicker,{...e,fontSizes:t,disableCustomFontSizes:!n})},_g=[],yg=([e,...t])=>e.toUpperCase()+t.join(""),Eg=(...e)=>{const t=e.reduce(((e,t)=>(e[t]=`custom${yg(t)}`,e)),{});return(0,p.createHigherOrderComponent)((0,p.compose)([(0,p.createHigherOrderComponent)((e=>t=>{const[n]=Ar("typography.fontSizes");return(0,s.createElement)(e,{...t,fontSizes:n||_g})}),"withFontSizes"),e=>class extends u.Component{constructor(e){super(e),this.setters=this.createSetters(),this.state={}}createSetters(){return Object.entries(t).reduce(((e,[t,n])=>(e[`set${yg(t)}`]=this.createSetFontSize(t,n),e)),{})}createSetFontSize(e,t){return n=>{const o=this.props.fontSizes?.find((({size:e})=>e===Number(n)));this.props.setAttributes({[e]:o&&o.slug?o.slug:void 0,[t]:o&&o.slug?void 0:n})}}static getDerivedStateFromProps({attributes:e,fontSizes:n},o){const r=(t,n)=>!o[n]||(e[n]?e[n]!==o[n].slug:o[n].size!==e[t]);if(!Object.values(t).some(r))return null;const l=Object.entries(t).filter((([e,t])=>r(t,e))).reduce(((t,[o,r])=>{const l=e[o],i=Ep(n,l,e[r]);return t[o]={...i,class:Sp(l)},t}),{});return{...o,...l}}render(){return(0,s.createElement)(e,{...this.props,fontSizes:void 0,...this.state,...this.setters})}}]),"withFontSizes")},wg=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M13 5.5H4V4h9v1.5Zm7 7H4V11h16v1.5Zm-7 7H4V18h9v1.5Z"})),Sg=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M7.5 5.5h9V4h-9v1.5Zm-3.5 7h16V11H4v1.5Zm3.5 7h9V18h-9v1.5Z"})),Cg=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M11.111 5.5H20V4h-8.889v1.5ZM4 12.5h16V11H4v1.5Zm7.111 7H20V18h-8.889v1.5Z"})),xg=[{icon:wg,title:(0,x.__)("Align text left"),align:"left"},{icon:Sg,title:(0,x.__)("Align text center"),align:"center"},{icon:Cg,title:(0,x.__)("Align text right"),align:"right"}],Bg={placement:"bottom-start"};const Ig=function({value:e,onChange:t,alignmentControls:n=xg,label:o=(0,x.__)("Align text"),describedBy:r=(0,x.__)("Change text alignment"),isCollapsed:l=!0,isToolbar:i}){function a(n){return()=>t(e===n?void 0:n)}const c=n.find((t=>t.align===e)),u=i?_l.ToolbarGroup:_l.ToolbarDropdownMenu,d=i?{isCollapsed:l}:{toggleProps:{describedBy:r},popoverProps:Bg};return(0,s.createElement)(u,{icon:c?c.icon:(0,x.isRTL)()?Cg:wg,label:o,controls:n.map((t=>{const{align:n}=t,o=e===n;return{...t,isActive:o,role:l?"menuitemradio":void 0,onClick:a(n)}})),...d})},Tg=e=>(0,s.createElement)(Ig,{...e,isToolbar:!1}),Mg=e=>(0,s.createElement)(Ig,{...e,isToolbar:!0});var Pg=n(9681),Rg=n.n(Pg);function Ng(e){return e.toLowerCase()}var Lg=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],Ag=/[^A-Z0-9]+/gi;function Og(e,t,n){return t instanceof RegExp?e.replace(t,n):t.reduce((function(e,t){return e.replace(t,n)}),e)}const Dg=e=>e.name||"",zg=e=>e.title,Vg=e=>e.description||"",Fg=e=>e.keywords||[],Hg=e=>e.category,Gg=()=>null;function Ug(e=""){return function(e,t){void 0===t&&(t={});for(var n=t.splitRegexp,o=void 0===n?Lg:n,r=t.stripRegexp,l=void 0===r?Ag:r,i=t.transform,s=void 0===i?Ng:i,a=t.delimiter,c=void 0===a?" ":a,u=Og(Og(e,o,"$1\0$2"),l,"\0"),d=0,p=u.length;"\0"===u.charAt(d);)d++;for(;"\0"===u.charAt(p-1);)p--;return u.slice(d,p).split("\0").map(s).join(c)}(e,{splitRegexp:[/([\p{Ll}\p{Lo}\p{N}])([\p{Lu}\p{Lt}])/gu,/([\p{Lu}\p{Lt}])([\p{Lu}\p{Lt}][\p{Ll}\p{Lo}])/gu],stripRegexp:/(\p{C}|\p{P}|\p{S})+/giu}).split(" ").filter(Boolean)}function $g(e=""){return e=(e=(e=Rg()(e)).replace(/^\//,"")).toLowerCase()}const jg=(e="")=>Ug($g(e)),Wg=(e,t,n,o)=>{if(0===jg(o).length)return e;return Kg(e,o,{getCategory:e=>t.find((({slug:t})=>t===e.category))?.title,getCollection:e=>n[e.name.split("/")[0]]?.title})},Kg=(e=[],t="",n={})=>{if(0===jg(t).length)return e;const o=e.map((e=>[e,Zg(e,t,n)])).filter((([,e])=>e>0));return o.sort((([,e],[,t])=>t-e)),o.map((([e])=>e))};function Zg(e,t,n={}){const{getName:o=Dg,getTitle:r=zg,getDescription:l=Vg,getKeywords:i=Fg,getCategory:s=Hg,getCollection:a=Gg}=n,c=o(e),u=r(e),d=l(e),p=i(e),m=s(e),h=a(e),g=$g(t),f=$g(u);let b=0;if(g===f)b+=30;else if(f.startsWith(g))b+=20;else{const e=[c,u,d,...p,m,h].join(" ");0===((e,t)=>e.filter((e=>!jg(t).some((t=>t.includes(e))))))(Ug(g),e).length&&(b+=10)}if(0!==b&&c.startsWith("core/")){b+=c!==e.id?1:2}return b}const qg=(e,t)=>{const[n]=(0,d.useSelect)((t=>[t(Nr).getInserterItems(e)]),[e]),[o,r]=(0,d.useSelect)((e=>{const{getCategories:t,getCollections:n}=e(c.store);return[t(),n()]}),[]);return[n,o,r,(0,u.useCallback)((({name:e,initialAttributes:n,innerBlocks:o,syncStatus:r,content:l},i)=>{const s="unsynced"===r?(0,c.parse)(l,{__unstableSkipMigrationLogs:!0}):(0,c.createBlock)(e,n,(0,c.createBlocksFromInnerBlocksTemplate)(o));t(s,void 0,i)}),[t])]},Yg=(e,t)=>t?(e.sort((({id:e},{id:n})=>{let o=t.indexOf(e),r=t.indexOf(n);return o<0&&(o=t.length),r<0&&(r=t.length),o-r})),e):e,Xg=()=>{};const Qg={name:"blocks",className:"block-editor-autocompleters__block",triggerPrefix:"/",useItems(e){const{rootClientId:t,selectedBlockName:n,prioritizedBlocks:o}=(0,d.useSelect)((e=>{const{getSelectedBlockClientId:t,getBlockName:n,getBlockListSettings:o,getBlockRootClientId:r}=e(Nr),l=t(),i=r(l);return{selectedBlockName:l?n(l):null,rootClientId:i,prioritizedBlocks:o(i)?.prioritizedInserterBlocks}}),[]),[r,l,i]=qg(t,Xg),a=(0,u.useMemo)((()=>(e.trim()?Wg(r,l,i,e):Yg(ne(r,"frecency","desc"),o)).filter((e=>e.name!==n)).slice(0,9)),[e,n,r,l,i,o]);return[(0,u.useMemo)((()=>a.map((e=>{const{title:t,icon:n,isDisabled:o}=e;return{key:`block-${e.id}`,value:e,label:(0,s.createElement)(s.Fragment,null,(0,s.createElement)(qh,{key:"icon",icon:n,showColors:!0}),t),isDisabled:o}}))),[a])]},allowContext:(e,t)=>!(/\S/.test(e)||/\S/.test(t)),getOptionCompletion(e){const{name:t,initialAttributes:n,innerBlocks:o,syncStatus:r,content:l}=e;return{action:"replace",value:"unsynced"===r?(0,c.parse)(l,{__unstableSkipMigrationLogs:!0}):(0,c.createBlock)(t,n,(0,c.createBlocksFromInnerBlocksTemplate)(o))}}},Jg=window.wp.apiFetch;var ef=n.n(Jg);const tf=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"m7.3 9.7 1.4 1.4c.2-.2.3-.3.4-.5 0 0 0-.1.1-.1.3-.5.4-1.1.3-1.6L12 7 9 4 7.2 6.5c-.6-.1-1.1 0-1.6.3 0 0-.1 0-.1.1-.3.1-.4.2-.6.4l1.4 1.4L4 11v1h1l2.3-2.3zM4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4z"}));const nf={name:"links",className:"block-editor-autocompleters__link",triggerPrefix:"[[",options:async e=>{let t=await ef()({path:(0,Ds.addQueryArgs)("/wp/v2/search",{per_page:10,search:e,type:"post",order_by:"menu_order"})});return t=t.filter((e=>""!==e.title)),t},getOptionKeywords:e=>[...e.title.split(/\s+/)],getOptionLabel:e=>(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Ti,{key:"icon",icon:"page"===e.subtype?la:tf}),e.title),getOptionCompletion:e=>(0,s.createElement)("a",{href:e.url},e.title)},of=[];function rf({completers:e=of}){const{name:t}=y();return(0,u.useMemo)((()=>{let n=[...e,nf];return(t===(0,c.getDefaultBlockName)()||(0,c.getBlockSupport)(t,"__experimentalSlashInserter",!1))&&(n=[...n,Qg]),(0,m.hasFilter)("editor.Autocomplete.completers")&&(n===e&&(n=n.map((e=>({...e})))),n=(0,m.applyFilters)("editor.Autocomplete.completers",n,t)),n}),[e,t])}const lf=function(e){return(0,s.createElement)(_l.Autocomplete,{...e,completers:rf(e)})},sf=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M6 4a2 2 0 0 0-2 2v3h1.5V6a.5.5 0 0 1 .5-.5h3V4H6Zm3 14.5H6a.5.5 0 0 1-.5-.5v-3H4v3a2 2 0 0 0 2 2h3v-1.5Zm6 1.5v-1.5h3a.5.5 0 0 0 .5-.5v-3H20v3a2 2 0 0 1-2 2h-3Zm3-16a2 2 0 0 1 2 2v3h-1.5V6a.5.5 0 0 0-.5-.5h-3V4h3Z"}));const af=function({isActive:e,label:t=(0,x.__)("Toggle full height"),onToggle:n,isDisabled:o}){return(0,s.createElement)(_l.ToolbarButton,{isActive:e,icon:sf,label:t,onClick:()=>n(!e),disabled:o})},cf=()=>{};const uf=function(e){const{label:t=(0,x.__)("Change matrix alignment"),onChange:n=cf,value:o="center",isDisabled:r}=e,l=(0,s.createElement)(_l.__experimentalAlignmentMatrixControl.Icon,{value:o});return(0,s.createElement)(_l.Dropdown,{popoverProps:{placement:"bottom-start"},renderToggle:({onToggle:e,isOpen:n})=>(0,s.createElement)(_l.ToolbarButton,{onClick:e,"aria-haspopup":"true","aria-expanded":n,onKeyDown:t=>{n||t.keyCode!==zs.DOWN||(t.preventDefault(),e())},label:t,icon:l,showTooltip:!0,disabled:r}),renderContent:()=>(0,s.createElement)(_l.__experimentalAlignmentMatrixControl,{hasFocusBorder:!1,onChange:n,value:o})})};function df({clientId:e,maximumLength:t,context:n}){const o=(0,d.useSelect)((t=>{if(!e)return null;const{getBlockName:o,getBlockAttributes:r}=t(Nr),{getBlockType:l,getActiveBlockVariation:i}=t(c.store),s=o(e),a=l(s);if(!a)return null;const u=r(e),d=(0,c.__experimentalGetBlockLabel)(a,u,n);if(d!==a.title)return d;const p=i(s,u);return p?.title||a.title}),[e,n]);if(!o)return null;if(t&&t>0&&o.length>t){const e="...";return o.slice(0,t-e.length)+e}return o}function pf({clientId:e,maximumLength:t,context:n}){return df({clientId:e,maximumLength:t,context:n})}const mf=function({rootLabelText:e}){const{selectBlock:t,clearSelectedBlock:n}=(0,d.useDispatch)(Nr),{clientId:o,parents:r,hasSelection:l}=(0,d.useSelect)((e=>{const{getSelectionStart:t,getSelectedBlockClientId:n,getEnabledBlockParents:o}=ie(e(Nr)),r=n();return{parents:o(r),clientId:r,hasSelection:!!t().clientId}}),[]),i=e||(0,x.__)("Document");return(0,s.createElement)("ul",{className:"block-editor-block-breadcrumb",role:"list","aria-label":(0,x.__)("Block breadcrumb")},(0,s.createElement)("li",{className:l?void 0:"block-editor-block-breadcrumb__current","aria-current":l?void 0:"true"},l&&(0,s.createElement)(_l.Button,{className:"block-editor-block-breadcrumb__button",variant:"tertiary",onClick:n},i),!l&&i,!!o&&(0,s.createElement)(Ti,{icon:qs,className:"block-editor-block-breadcrumb__separator"})),r.map((e=>(0,s.createElement)("li",{key:e},(0,s.createElement)(_l.Button,{className:"block-editor-block-breadcrumb__button",variant:"tertiary",onClick:()=>t(e)},(0,s.createElement)(pf,{clientId:e,maximumLength:35})),(0,s.createElement)(Ti,{icon:qs,className:"block-editor-block-breadcrumb__separator"})))),!!o&&(0,s.createElement)("li",{className:"block-editor-block-breadcrumb__current","aria-current":"true"},(0,s.createElement)(pf,{clientId:o,maximumLength:35})))};function hf(e){return(0,d.useSelect)((t=>{const{__unstableHasActiveBlockOverlayActive:n}=t(Nr);return n(e)}),[e])}const gf=(0,u.createContext)({});function ff({value:e,children:t}){const n=(0,u.useContext)(gf),o=(0,u.useMemo)((()=>({...n,...e})),[n,e]);return(0,s.createElement)(gf.Provider,{value:o,children:t})}const bf=gf,vf={},kf=(0,_l.withFilters)("editor.BlockEdit")((e=>{const{name:t}=e,n=(0,c.getBlockType)(t);if(!n)return null;const o=n.edit||n.save;return(0,s.createElement)(o,{...e})})),_f=e=>{const{attributes:t={},name:n}=e,o=(0,c.getBlockType)(n),r=(0,u.useContext)(bf),l=(0,u.useMemo)((()=>o&&o.usesContext?Object.fromEntries(Object.entries(r).filter((([e])=>o.usesContext.includes(e)))):vf),[o,r]);if(!o)return null;if(o.apiVersion>1)return(0,s.createElement)(kf,{...e,context:l});const i=(0,c.hasBlockSupport)(o,"className",!0)?(0,c.getBlockDefaultClassName)(n):null,a=ml()(i,t.className,e.className);return(0,s.createElement)(kf,{...e,context:l,className:a})};function yf({mayDisplayControls:e,mayDisplayParentControls:t,blockEditingMode:n,...o}){const{name:r,isSelected:l,clientId:i,attributes:a={},__unstableLayoutClassNames:d}=o,{layout:p=null,metadata:m={}}=a,{bindings:v}=m,k=(0,c.hasBlockSupport)(r,"layout",!1)||(0,c.hasBlockSupport)(r,"__experimentalLayout",!1);return(0,s.createElement)(_,{value:(0,u.useMemo)((()=>({name:r,isSelected:l,clientId:i,layout:k?p:null,__unstableLayoutClassNames:d,[h]:e,[g]:t,[f]:n,[b]:v})),[r,l,i,k,p,d,e,t,n,v])},(0,s.createElement)(_f,{...o}))}const Ef=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"}));const wf=function({className:e,actions:t,children:n,secondaryActions:o}){return(0,s.createElement)("div",{style:{display:"contents",all:"initial"}},(0,s.createElement)("div",{className:ml()(e,"block-editor-warning")},(0,s.createElement)("div",{className:"block-editor-warning__contents"},(0,s.createElement)("p",{className:"block-editor-warning__message"},n),(u.Children.count(t)>0||o)&&(0,s.createElement)("div",{className:"block-editor-warning__actions"},u.Children.count(t)>0&&u.Children.map(t,((e,t)=>(0,s.createElement)("span",{key:t,className:"block-editor-warning__action"},e))),o&&(0,s.createElement)(_l.DropdownMenu,{className:"block-editor-warning__secondary",icon:Ef,label:(0,x.__)("More options"),popoverProps:{position:"bottom left",className:"block-editor-warning__dropdown"},noIcons:!0},(()=>(0,s.createElement)(_l.MenuGroup,null,o.map(((e,t)=>(0,s.createElement)(_l.MenuItem,{onClick:e.onClick,key:t},e.title))))))))))};var Sf=n(8021);function Cf({title:e,rawContent:t,renderedContent:n,action:o,actionText:r,className:l}){return(0,s.createElement)("div",{className:l},(0,s.createElement)("div",{className:"block-editor-block-compare__content"},(0,s.createElement)("h2",{className:"block-editor-block-compare__heading"},e),(0,s.createElement)("div",{className:"block-editor-block-compare__html"},t),(0,s.createElement)("div",{className:"block-editor-block-compare__preview edit-post-visual-editor"},(0,s.createElement)(u.RawHTML,null,(0,As.safeHTML)(n)))),(0,s.createElement)("div",{className:"block-editor-block-compare__action"},(0,s.createElement)(_l.Button,{variant:"secondary",tabIndex:"0",onClick:o},r)))}const xf=function({block:e,onKeep:t,onConvert:n,convertor:o,convertButtonText:r}){const l=(i=o(e),(Array.isArray(i)?i:[i]).map((e=>(0,c.getSaveContent)(e.name,e.attributes,e.innerBlocks))).join(""));var i;const a=(u=e.originalContent,d=l,(0,Sf.JJ)(u,d).map(((e,t)=>{const n=ml()({"block-editor-block-compare__added":e.added,"block-editor-block-compare__removed":e.removed});return(0,s.createElement)("span",{key:t,className:n},e.value)})));var u,d;return(0,s.createElement)("div",{className:"block-editor-block-compare__wrapper"},(0,s.createElement)(Cf,{title:(0,x.__)("Current"),className:"block-editor-block-compare__current",action:t,actionText:(0,x.__)("Convert to HTML"),rawContent:e.originalContent,renderedContent:e.originalContent}),(0,s.createElement)(Cf,{title:(0,x.__)("After Conversion"),className:"block-editor-block-compare__converted",action:n,actionText:r,rawContent:a,renderedContent:l}))},Bf=e=>(0,c.rawHandler)({HTML:e.originalContent});function If({clientId:e}){const{block:t,canInsertHTMLBlock:n,canInsertClassicBlock:o}=(0,d.useSelect)((t=>{const{canInsertBlockType:n,getBlock:o,getBlockRootClientId:r}=t(Nr),l=r(e);return{block:o(e),canInsertHTMLBlock:n("core/html",l),canInsertClassicBlock:n("core/freeform",l)}}),[e]),{replaceBlock:r}=(0,d.useDispatch)(Nr),[l,i]=(0,u.useState)(!1),a=(0,u.useCallback)((()=>i(!1)),[]),p=(0,u.useMemo)((()=>({toClassic(){const e=(0,c.createBlock)("core/freeform",{content:t.originalContent});return r(t.clientId,e)},toHTML(){const e=(0,c.createBlock)("core/html",{content:t.originalContent});return r(t.clientId,e)},toBlocks(){const e=Bf(t);return r(t.clientId,e)},toRecoveredBlock(){const e=(0,c.createBlock)(t.name,t.attributes,t.innerBlocks);return r(t.clientId,e)}})),[t,r]),m=(0,u.useMemo)((()=>[{title:(0,x._x)("Resolve","imperative verb"),onClick:()=>i(!0)},n&&{title:(0,x.__)("Convert to HTML"),onClick:p.toHTML},o&&{title:(0,x.__)("Convert to Classic Block"),onClick:p.toClassic}].filter(Boolean)),[n,o,p]);return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(wf,{actions:[(0,s.createElement)(_l.Button,{key:"recover",onClick:p.toRecoveredBlock,variant:"primary"},(0,x.__)("Attempt Block Recovery"))],secondaryActions:m},(0,x.__)("This block contains unexpected or invalid content.")),l&&(0,s.createElement)(_l.Modal,{title:(0,x.__)("Resolve Block"),onRequestClose:a,className:"block-editor-block-compare"},(0,s.createElement)(xf,{block:t,onKeep:p.toHTML,onConvert:p.toBlocks,convertor:Bf,convertButtonText:(0,x.__)("Convert to Blocks")})))}const Tf=(0,s.createElement)(wf,{className:"block-editor-block-list__block-crash-warning"},(0,x.__)("This block has encountered an error and cannot be previewed.")),Mf=()=>Tf;class Pf extends u.Component{constructor(){super(...arguments),this.state={hasError:!1}}componentDidCatch(){this.setState({hasError:!0})}render(){return this.state.hasError?this.props.fallback:this.props.children}}const Rf=Pf;var Nf=n(4132);const Lf=function({clientId:e}){const[t,n]=(0,u.useState)(""),o=(0,d.useSelect)((t=>t(Nr).getBlock(e)),[e]),{updateBlock:r}=(0,d.useDispatch)(Nr);return(0,u.useEffect)((()=>{n((0,c.getBlockContent)(o))}),[o]),(0,s.createElement)(Nf.A,{className:"block-editor-block-list__block-html-textarea",value:t,onBlur:()=>{const l=(0,c.getBlockType)(o.name);if(!l)return;const i=(0,c.getBlockAttributes)(l,t,o.attributes),s=t||(0,c.getSaveContent)(l,i),[a]=t?(0,c.validateBlock)({...o,attributes:i,originalContent:s}):[!0];r(e,{attributes:i,originalContent:s,isValid:a}),t||n(s)},onChange:e=>n(e.target.value)})};var Af=Xf(),Of=e=>Kf(e,Af),Df=Xf();Of.write=e=>Kf(e,Df);var zf=Xf();Of.onStart=e=>Kf(e,zf);var Vf=Xf();Of.onFrame=e=>Kf(e,Vf);var Ff=Xf();Of.onFinish=e=>Kf(e,Ff);var Hf=[];Of.setTimeout=(e,t)=>{let n=Of.now()+t,o=()=>{let e=Hf.findIndex((e=>e.cancel==o));~e&&Hf.splice(e,1),jf-=~e?1:0},r={time:n,handler:e,cancel:o};return Hf.splice(Gf(n),0,r),jf+=1,Zf(),r};var Gf=e=>~(~Hf.findIndex((t=>t.time>e))||~Hf.length);Of.cancel=e=>{zf.delete(e),Vf.delete(e),Ff.delete(e),Af.delete(e),Df.delete(e)},Of.sync=e=>{Wf=!0,Of.batchedUpdates(e),Wf=!1},Of.throttle=e=>{let t;function n(){try{e(...t)}finally{t=null}}function o(...e){t=e,Of.onStart(n)}return o.handler=e,o.cancel=()=>{zf.delete(n),t=null},o};var Uf=typeof window<"u"?window.requestAnimationFrame:()=>{};Of.use=e=>Uf=e,Of.now=typeof performance<"u"?()=>performance.now():Date.now,Of.batchedUpdates=e=>e(),Of.catch=console.error,Of.frameLoop="always",Of.advance=()=>{"demand"!==Of.frameLoop?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):Yf()};var $f=-1,jf=0,Wf=!1;function Kf(e,t){Wf?(t.delete(e),e(0)):(t.add(e),Zf())}function Zf(){$f<0&&($f=0,"demand"!==Of.frameLoop&&Uf(qf))}function qf(){~$f&&(Uf(qf),Of.batchedUpdates(Yf))}function Yf(){let e=$f;$f=Of.now();let t=Gf($f);t&&(Qf(Hf.splice(0,t),(e=>e.handler())),jf-=t),jf?(zf.flush(),Af.flush(e?Math.min(64,$f-e):16.667),Vf.flush(),Df.flush(),Ff.flush()):$f=-1}function Xf(){let e=new Set,t=e;return{add(n){jf+=t!=e||e.has(n)?0:1,e.add(n)},delete:n=>(jf-=t==e&&e.has(n)?1:0,e.delete(n)),flush(n){t.size&&(e=new Set,jf-=t.size,Qf(t,(t=>t(n)&&e.add(t))),jf+=e.size,t=e)}}}function Qf(e,t){e.forEach((e=>{try{t(e)}catch(e){Of.catch(e)}}))}var Jf=Object.defineProperty,eb={};function tb(){}((e,t)=>{for(var n in t)Jf(e,n,{get:t[n],enumerable:!0})})(eb,{assign:()=>gb,colors:()=>pb,createStringInterpolator:()=>ab,skipAnimation:()=>mb,to:()=>cb,willAdvance:()=>hb});var nb={arr:Array.isArray,obj:e=>!!e&&"Object"===e.constructor.name,fun:e=>"function"==typeof e,str:e=>"string"==typeof e,num:e=>"number"==typeof e,und:e=>void 0===e};function ob(e,t){if(nb.arr(e)){if(!nb.arr(t)||e.length!==t.length)return!1;for(let n=0;ne.forEach(t);function lb(e,t,n){if(nb.arr(e))for(let o=0;onb.und(e)?[]:nb.arr(e)?e:[e];function sb(e,t){if(e.size){let n=Array.from(e);e.clear(),rb(n,t)}}var ab,cb,ub=(e,...t)=>sb(e,(e=>e(...t))),db=()=>typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),pb=null,mb=!1,hb=tb,gb=e=>{e.to&&(cb=e.to),e.now&&(Of.now=e.now),void 0!==e.colors&&(pb=e.colors),null!=e.skipAnimation&&(mb=e.skipAnimation),e.createStringInterpolator&&(ab=e.createStringInterpolator),e.requestAnimationFrame&&Of.use(e.requestAnimationFrame),e.batchedUpdates&&(Of.batchedUpdates=e.batchedUpdates),e.willAdvance&&(hb=e.willAdvance),e.frameLoop&&(Of.frameLoop=e.frameLoop)},fb=new Set,bb=[],vb=[],kb=0,_b={get idle(){return!fb.size&&!bb.length},start(e){kb>e.priority?(fb.add(e),Of.onStart(yb)):(Eb(e),Of(Sb))},advance:Sb,sort(e){if(kb)Of.onFrame((()=>_b.sort(e)));else{let t=bb.indexOf(e);~t&&(bb.splice(t,1),wb(e))}},clear(){bb=[],fb.clear()}};function yb(){fb.forEach(Eb),fb.clear(),Of(Sb)}function Eb(e){bb.includes(e)||wb(e)}function wb(e){bb.splice(function(e,t){let n=e.findIndex(t);return n<0?e.length:n}(bb,(t=>t.priority>e.priority)),0,e)}function Sb(e){let t=vb;for(let n=0;n0}var Cb="[-+]?\\d*\\.?\\d+",xb=Cb+"%";function Bb(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}var Ib=new RegExp("rgb"+Bb(Cb,Cb,Cb)),Tb=new RegExp("rgba"+Bb(Cb,Cb,Cb,Cb)),Mb=new RegExp("hsl"+Bb(Cb,xb,xb)),Pb=new RegExp("hsla"+Bb(Cb,xb,xb,Cb)),Rb=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,Nb=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,Lb=/^#([0-9a-fA-F]{6})$/,Ab=/^#([0-9a-fA-F]{8})$/;function Ob(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Db(e,t,n){let o=n<.5?n*(1+t):n+t-n*t,r=2*n-o,l=Ob(r,o,e+1/3),i=Ob(r,o,e),s=Ob(r,o,e-1/3);return Math.round(255*l)<<24|Math.round(255*i)<<16|Math.round(255*s)<<8}function zb(e){let t=parseInt(e,10);return t<0?0:t>255?255:t}function Vb(e){return(parseFloat(e)%360+360)%360/360}function Fb(e){let t=parseFloat(e);return t<0?0:t>1?255:Math.round(255*t)}function Hb(e){let t=parseFloat(e);return t<0?0:t>100?1:t/100}function Gb(e){let t=function(e){let t;return"number"==typeof e?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=Lb.exec(e))?parseInt(t[1]+"ff",16)>>>0:pb&&void 0!==pb[e]?pb[e]:(t=Ib.exec(e))?(zb(t[1])<<24|zb(t[2])<<16|zb(t[3])<<8|255)>>>0:(t=Tb.exec(e))?(zb(t[1])<<24|zb(t[2])<<16|zb(t[3])<<8|Fb(t[4]))>>>0:(t=Rb.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+"ff",16)>>>0:(t=Ab.exec(e))?parseInt(t[1],16)>>>0:(t=Nb.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=Mb.exec(e))?(255|Db(Vb(t[1]),Hb(t[2]),Hb(t[3])))>>>0:(t=Pb.exec(e))?(Db(Vb(t[1]),Hb(t[2]),Hb(t[3]))|Fb(t[4]))>>>0:null}(e);return null===t?e:(t=t||0,`rgba(${(4278190080&t)>>>24}, ${(16711680&t)>>>16}, ${(65280&t)>>>8}, ${(255&t)/255})`)}var Ub=(e,t,n)=>{if(nb.fun(e))return e;if(nb.arr(e))return Ub({range:e,output:t,extrapolate:n});if(nb.str(e.output[0]))return ab(e);let o=e,r=o.output,l=o.range||[0,1],i=o.extrapolateLeft||o.extrapolate||"extend",s=o.extrapolateRight||o.extrapolate||"extend",a=o.easing||(e=>e);return e=>{let t=function(e,t){for(var n=1;n=e);++n);return n-1}(e,l);return function(e,t,n,o,r,l,i,s,a){let c=a?a(e):e;if(cn){if("identity"===s)return c;"clamp"===s&&(c=n)}return o===r?o:t===n?e<=t?o:r:(t===-1/0?c=-c:n===1/0?c-=t:c=(c-t)/(n-t),c=l(c),o===-1/0?c=-c:r===1/0?c+=o:c=c*(r-o)+o,c)}(e,l[t],l[t+1],r[t],r[t+1],a,i,s,o.map)}};var $b=1.70158,jb=1.525*$b,Wb=$b+1,Kb=2*Math.PI/3,Zb=2*Math.PI/4.5,qb=e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,Yb={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>1-(1-e)*(1-e),easeInOutQuad:e=>e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2,easeInCubic:e=>e*e*e,easeOutCubic:e=>1-Math.pow(1-e,3),easeInOutCubic:e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1-Math.pow(1-e,4),easeInOutQuart:e=>e<.5?8*e*e*e*e:1-Math.pow(-2*e+2,4)/2,easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>1-Math.pow(1-e,5),easeInOutQuint:e=>e<.5?16*e*e*e*e*e:1-Math.pow(-2*e+2,5)/2,easeInSine:e=>1-Math.cos(e*Math.PI/2),easeOutSine:e=>Math.sin(e*Math.PI/2),easeInOutSine:e=>-(Math.cos(Math.PI*e)-1)/2,easeInExpo:e=>0===e?0:Math.pow(2,10*e-10),easeOutExpo:e=>1===e?1:1-Math.pow(2,-10*e),easeInOutExpo:e=>0===e?0:1===e?1:e<.5?Math.pow(2,20*e-10)/2:(2-Math.pow(2,-20*e+10))/2,easeInCirc:e=>1-Math.sqrt(1-Math.pow(e,2)),easeOutCirc:e=>Math.sqrt(1-Math.pow(e-1,2)),easeInOutCirc:e=>e<.5?(1-Math.sqrt(1-Math.pow(2*e,2)))/2:(Math.sqrt(1-Math.pow(-2*e+2,2))+1)/2,easeInBack:e=>Wb*e*e*e-$b*e*e,easeOutBack:e=>1+Wb*Math.pow(e-1,3)+$b*Math.pow(e-1,2),easeInOutBack:e=>e<.5?Math.pow(2*e,2)*(2*(jb+1)*e-jb)/2:(Math.pow(2*e-2,2)*((jb+1)*(2*e-2)+jb)+2)/2,easeInElastic:e=>0===e?0:1===e?1:-Math.pow(2,10*e-10)*Math.sin((10*e-10.75)*Kb),easeOutElastic:e=>0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin((10*e-.75)*Kb)+1,easeInOutElastic:e=>0===e?0:1===e?1:e<.5?-Math.pow(2,20*e-10)*Math.sin((20*e-11.125)*Zb)/2:Math.pow(2,-20*e+10)*Math.sin((20*e-11.125)*Zb)/2+1,easeInBounce:e=>1-qb(1-e),easeOutBounce:qb,easeInOutBounce:e=>e<.5?(1-qb(1-2*e))/2:(1+qb(2*e-1))/2,steps:(e,t="end")=>n=>{let o=(n="end"===t?Math.min(n,.999):Math.max(n,.001))*e;return((e,t,n)=>Math.min(Math.max(n,e),t))(0,1,("end"===t?Math.floor(o):Math.ceil(o))/e)}},Xb=Symbol.for("FluidValue.get"),Qb=Symbol.for("FluidValue.observers"),Jb=e=>Boolean(e&&e[Xb]),ev=e=>e&&e[Xb]?e[Xb]():e,tv=e=>e[Qb]||null;function nv(e,t){let n=e[Qb];n&&n.forEach((e=>{!function(e,t){e.eventObserved?e.eventObserved(t):e(t)}(e,t)}))}var ov=class{[Xb];[Qb];constructor(e){if(!e&&!(e=this.get))throw Error("Unknown getter");rv(this,e)}},rv=(e,t)=>av(e,Xb,t);function lv(e,t){if(e[Xb]){let n=e[Qb];n||av(e,Qb,n=new Set),n.has(t)||(n.add(t),e.observerAdded&&e.observerAdded(n.size,t))}return t}function iv(e,t){let n=e[Qb];if(n&&n.has(t)){let o=n.size-1;o?n.delete(t):e[Qb]=null,e.observerRemoved&&e.observerRemoved(o,t)}}var sv,av=(e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0}),cv=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,uv=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,dv=new RegExp(`(${cv.source})(%|[a-z]+)`,"i"),pv=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,mv=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/,hv=e=>{let[t,n]=gv(e);if(!t||db())return e;let o=window.getComputedStyle(document.documentElement).getPropertyValue(t);if(o)return o.trim();if(n&&n.startsWith("--")){return window.getComputedStyle(document.documentElement).getPropertyValue(n)||e}return n&&mv.test(n)?hv(n):n||e},gv=e=>{let t=mv.exec(e);if(!t)return[,];let[,n,o]=t;return[n,o]},fv=(e,t,n,o,r)=>`rgba(${Math.round(t)}, ${Math.round(n)}, ${Math.round(o)}, ${r})`,bv=e=>{sv||(sv=pb?new RegExp(`(${Object.keys(pb).join("|")})(?!\\w)`,"g"):/^\b$/);let t=e.output.map((e=>ev(e).replace(mv,hv).replace(uv,Gb).replace(sv,Gb))),n=t.map((e=>e.match(cv).map(Number))),o=n[0].map(((e,t)=>n.map((e=>{if(!(t in e))throw Error('The arity of each "output" value must be equal');return e[t]})))).map((t=>Ub({...e,output:t})));return e=>{let n=!dv.test(t[0])&&t.find((e=>dv.test(e)))?.replace(cv,""),r=0;return t[0].replace(cv,(()=>`${o[r++](e)}${n||""}`)).replace(pv,fv)}},vv="react-spring: ",kv=e=>{let t=e,n=!1;if("function"!=typeof t)throw new TypeError(`${vv}once requires a function parameter`);return(...e)=>{n||(t(...e),n=!0)}},_v=kv(console.warn);kv(console.warn);function yv(e){return nb.str(e)&&("#"==e[0]||/\d/.test(e)||!db()&&mv.test(e)||e in(pb||{}))}new WeakMap;new Set,new WeakMap,new WeakMap,new WeakMap;var Ev=db()?s.useEffect:s.useLayoutEffect;function wv(){let e=(0,s.useState)()[1],t=(()=>{let e=(0,s.useRef)(!1);return Ev((()=>(e.current=!0,()=>{e.current=!1})),[]),e})();return()=>{t.current&&e(Math.random())}}var Sv=[];var Cv=Symbol.for("Animated:node"),xv=e=>e&&e[Cv],Bv=(e,t)=>((e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0}))(e,Cv,t),Iv=e=>e&&e[Cv]&&e[Cv].getPayload(),Tv=class{payload;constructor(){Bv(this,this)}getPayload(){return this.payload||[]}},Mv=class extends Tv{constructor(e){super(),this._value=e,nb.num(this._value)&&(this.lastPosition=this._value)}done=!0;elapsedTime;lastPosition;lastVelocity;v0;durationProgress=0;static create(e){return new Mv(e)}getPayload(){return[this]}getValue(){return this._value}setValue(e,t){return nb.num(e)&&(this.lastPosition=e,t&&(e=Math.round(e/t)*t,this.done&&(this.lastPosition=e))),this._value!==e&&(this._value=e,!0)}reset(){let{done:e}=this;this.done=!1,nb.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,e&&(this.lastVelocity=null),this.v0=null)}},Pv=class extends Mv{_string=null;_toString;constructor(e){super(0),this._toString=Ub({output:[e,e]})}static create(e){return new Pv(e)}getValue(){return this._string??(this._string=this._toString(this._value))}setValue(e){if(nb.str(e)){if(e==this._string)return!1;this._string=e,this._value=1}else{if(!super.setValue(e))return!1;this._string=null}return!0}reset(e){e&&(this._toString=Ub({output:[this.getValue(),e]})),this._value=0,super.reset()}},Rv={dependencies:null},Nv=class extends Tv{constructor(e){super(),this.source=e,this.setValue(e)}getValue(e){let t={};return lb(this.source,((n,o)=>{(e=>!!e&&e[Cv]===e)(n)?t[o]=n.getValue(e):Jb(n)?t[o]=ev(n):e||(t[o]=n)})),t}setValue(e){this.source=e,this.payload=this._makePayload(e)}reset(){this.payload&&rb(this.payload,(e=>e.reset()))}_makePayload(e){if(e){let t=new Set;return lb(e,this._addToPayload,t),Array.from(t)}}_addToPayload(e){Rv.dependencies&&Jb(e)&&Rv.dependencies.add(e);let t=Iv(e);t&&rb(t,(e=>this.add(e)))}},Lv=class extends Nv{constructor(e){super(e)}static create(e){return new Lv(e)}getValue(){return this.source.map((e=>e.getValue()))}setValue(e){let t=this.getPayload();return e.length==t.length?t.map(((t,n)=>t.setValue(e[n]))).some(Boolean):(super.setValue(e.map(Av)),!0)}};function Av(e){return(yv(e)?Pv:Mv).create(e)}function Ov(e){let t=xv(e);return t?t.constructor:nb.arr(e)?Lv:yv(e)?Pv:Mv}var Dv=(e,t)=>{let n=!nb.fun(e)||e.prototype&&e.prototype.isReactComponent;return(0,s.forwardRef)(((o,r)=>{let l=(0,s.useRef)(null),i=n&&(0,s.useCallback)((e=>{l.current=function(e,t){return e&&(nb.fun(e)?e(t):e.current=t),t}(r,e)}),[r]),[a,c]=function(e,t){let n=new Set;return Rv.dependencies=n,e.style&&(e={...e,style:t.createAnimatedStyle(e.style)}),e=new Nv(e),Rv.dependencies=null,[e,n]}(o,t),u=wv(),d=()=>{let e=l.current;n&&!e||!1===(!!e&&t.applyAnimatedValues(e,a.getValue(!0)))&&u()},p=new zv(d,c),m=(0,s.useRef)();Ev((()=>(m.current=p,rb(c,(e=>lv(e,p))),()=>{m.current&&(rb(m.current.deps,(e=>iv(e,m.current))),Of.cancel(m.current.update))}))),(0,s.useEffect)(d,[]),(e=>{(0,s.useEffect)(e,Sv)})((()=>()=>{let e=m.current;rb(e.deps,(t=>iv(t,e)))}));let h=t.getComponentProps(a.getValue());return s.createElement(e,{...h,ref:i})}))},zv=class{constructor(e,t){this.update=e,this.deps=t}eventObserved(e){"change"==e.type&&Of.write(this.update)}};var Vv=Symbol.for("AnimatedComponent"),Fv=e=>nb.str(e)?e:e&&nb.str(e.displayName)?e.displayName:nb.fun(e)&&e.name||null;function Hv(e,...t){return nb.fun(e)?e(...t):e}var Gv=(e,t)=>!0===e||!!(t&&e&&(nb.fun(e)?e(t):ib(e).includes(t))),Uv=(e,t)=>nb.obj(e)?t&&e[t]:e,$v=(e,t)=>!0===e.default?e[t]:e.default?e.default[t]:void 0,jv=e=>e,Wv=(e,t=jv)=>{let n=Kv;e.default&&!0!==e.default&&(e=e.default,n=Object.keys(e));let o={};for(let r of n){let n=t(e[r],r);nb.und(n)||(o[r]=n)}return o},Kv=["config","onProps","onStart","onChange","onPause","onResume","onRest"],Zv={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function qv(e){let t=function(e){let t={},n=0;if(lb(e,((e,o)=>{Zv[o]||(t[o]=e,n++)})),n)return t}(e);if(t){let n={to:t};return lb(e,((e,o)=>o in t||(n[o]=e))),n}return{...e}}function Yv(e){return e=ev(e),nb.arr(e)?e.map(Yv):yv(e)?eb.createStringInterpolator({range:[0,1],output:[e,e]})(1):e}function Xv(e){return nb.fun(e)||nb.arr(e)&&nb.obj(e[0])}var Qv={tension:170,friction:26,mass:1,damping:1,easing:Yb.linear,clamp:!1},Jv=class{tension;friction;frequency;damping;mass;velocity=0;restVelocity;precision;progress;duration;easing;clamp;bounce;decay;round;constructor(){Object.assign(this,Qv)}};function ek(e,t){if(nb.und(t.decay)){let n=!nb.und(t.tension)||!nb.und(t.friction);(n||!nb.und(t.frequency)||!nb.und(t.damping)||!nb.und(t.mass))&&(e.duration=void 0,e.decay=void 0),n&&(e.frequency=void 0)}else e.duration=void 0}var tk=[],nk=class{changed=!1;values=tk;toValues=null;fromValues=tk;to;from;config=new Jv;immediate=!1};function ok(e,{key:t,props:n,defaultProps:o,state:r,actions:l}){return new Promise(((i,s)=>{let a,c,u=Gv(n.cancel??o?.cancel,t);if(u)m();else{nb.und(n.pause)||(r.paused=Gv(n.pause,t));let e=o?.pause;!0!==e&&(e=r.paused||Gv(e,t)),a=Hv(n.delay||0,t),e?(r.resumeQueue.add(p),l.pause()):(l.resume(),p())}function d(){r.resumeQueue.add(p),r.timeouts.delete(c),c.cancel(),a=c.time-Of.now()}function p(){a>0&&!eb.skipAnimation?(r.delayed=!0,c=Of.setTimeout(m,a),r.pauseQueue.add(d),r.timeouts.add(c)):m()}function m(){r.delayed&&(r.delayed=!1),r.pauseQueue.delete(d),r.timeouts.delete(c),e<=(r.cancelId||0)&&(u=!0);try{l.start({...n,callId:e,cancel:u},i)}catch(e){s(e)}}}))}var rk=(e,t)=>1==t.length?t[0]:t.some((e=>e.cancelled))?sk(e.get()):t.every((e=>e.noop))?lk(e.get()):ik(e.get(),t.every((e=>e.finished))),lk=e=>({value:e,noop:!0,finished:!0,cancelled:!1}),ik=(e,t,n=!1)=>({value:e,finished:t,cancelled:n}),sk=e=>({value:e,cancelled:!0,finished:!1});function ak(e,t,n,o){let{callId:r,parentId:l,onRest:i}=t,{asyncTo:s,promise:a}=n;return l||e!==s||t.reset?n.promise=(async()=>{n.asyncId=r,n.asyncTo=e;let c,u,d,p=Wv(t,((e,t)=>"onRest"===t?void 0:e)),m=new Promise(((e,t)=>(c=e,u=t))),h=e=>{let t=r<=(n.cancelId||0)&&sk(o)||r!==n.asyncId&&ik(o,!1);if(t)throw e.result=t,u(e),e},g=(e,t)=>{let l=new uk,i=new dk;return(async()=>{if(eb.skipAnimation)throw ck(n),i.result=ik(o,!1),u(i),i;h(l);let s=nb.obj(e)?{...e}:{...t,to:e};s.parentId=r,lb(p,((e,t)=>{nb.und(s[t])&&(s[t]=e)}));let a=await o.start(s);return h(l),n.paused&&await new Promise((e=>{n.resumeQueue.add(e)})),a})()};if(eb.skipAnimation)return ck(n),ik(o,!1);try{let t;t=nb.arr(e)?(async e=>{for(let t of e)await g(t)})(e):Promise.resolve(e(g,o.stop.bind(o))),await Promise.all([t.then(c),m]),d=ik(o.get(),!0,!1)}catch(e){if(e instanceof uk)d=e.result;else{if(!(e instanceof dk))throw e;d=e.result}}finally{r==n.asyncId&&(n.asyncId=l,n.asyncTo=l?s:void 0,n.promise=l?a:void 0)}return nb.fun(i)&&Of.batchedUpdates((()=>{i(d,o,o.item)})),d})():a}function ck(e,t){sb(e.timeouts,(e=>e.cancel())),e.pauseQueue.clear(),e.resumeQueue.clear(),e.asyncId=e.asyncTo=e.promise=void 0,t&&(e.cancelId=t)}var uk=class extends Error{result;constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.")}},dk=class extends Error{result;constructor(){super("SkipAnimationSignal")}},pk=e=>e instanceof hk,mk=1,hk=class extends ov{id=mk++;_priority=0;get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){let e=xv(this);return e&&e.getValue()}to(...e){return eb.to(this,e)}interpolate(...e){return _v(`${vv}The "interpolate" function is deprecated in v9 (use "to" instead)`),eb.to(this,e)}toJSON(){return this.get()}observerAdded(e){1==e&&this._attach()}observerRemoved(e){0==e&&this._detach()}_attach(){}_detach(){}_onChange(e,t=!1){nv(this,{type:"change",parent:this,value:e,idle:t})}_onPriorityChange(e){this.idle||_b.sort(this),nv(this,{type:"priority",parent:this,priority:e})}},gk=Symbol.for("SpringPhase"),fk=e=>(1&e[gk])>0,bk=e=>(2&e[gk])>0,vk=e=>(4&e[gk])>0,kk=(e,t)=>t?e[gk]|=3:e[gk]&=-3,_k=(e,t)=>t?e[gk]|=4:e[gk]&=-5,yk=class extends hk{key;animation=new nk;queue;defaultProps={};_state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_pendingCalls=new Set;_lastCallId=0;_lastToId=0;_memoizedDuration=0;constructor(e,t){if(super(),!nb.und(e)||!nb.und(t)){let n=nb.obj(e)?{...e}:{...t,from:e};nb.und(n.default)&&(n.default=!0),this.start(n)}}get idle(){return!(bk(this)||this._state.asyncTo)||vk(this)}get goal(){return ev(this.animation.to)}get velocity(){let e=xv(this);return e instanceof Mv?e.lastVelocity||0:e.getPayload().map((e=>e.lastVelocity||0))}get hasAnimated(){return fk(this)}get isAnimating(){return bk(this)}get isPaused(){return vk(this)}get isDelayed(){return this._state.delayed}advance(e){let t=!0,n=!1,o=this.animation,{config:r,toValues:l}=o,i=Iv(o.to);!i&&Jb(o.to)&&(l=ib(ev(o.to))),o.values.forEach(((s,a)=>{if(s.done)return;let c=s.constructor==Pv?1:i?i[a].lastPosition:l[a],u=o.immediate,d=c;if(!u){if(d=s.lastPosition,r.tension<=0)return void(s.done=!0);let t,n=s.elapsedTime+=e,l=o.fromValues[a],i=null!=s.v0?s.v0:s.v0=nb.arr(r.velocity)?r.velocity[a]:r.velocity,p=r.precision||(l==c?.005:Math.min(1,.001*Math.abs(c-l)));if(nb.und(r.duration))if(r.decay){let e=!0===r.decay?.998:r.decay,o=Math.exp(-(1-e)*n);d=l+i/(1-e)*(1-o),u=Math.abs(s.lastPosition-d)<=p,t=i*o}else{t=null==s.lastVelocity?i:s.lastVelocity;let n,o=r.restVelocity||p/10,a=r.clamp?0:r.bounce,m=!nb.und(a),h=l==c?s.v0>0:lo,n||(u=Math.abs(c-d)<=p,!u));++e){m&&(g=d==c||d>c==h,g&&(t=-t*a,d=c)),t+=(1e-6*-r.tension*(d-c)+.001*-r.friction*t)/r.mass*f,d+=t*f}}else{let o=1;r.duration>0&&(this._memoizedDuration!==r.duration&&(this._memoizedDuration=r.duration,s.durationProgress>0&&(s.elapsedTime=r.duration*s.durationProgress,n=s.elapsedTime+=e)),o=(r.progress||0)+n/this._memoizedDuration,o=o>1?1:o<0?0:o,s.durationProgress=o),d=l+r.easing(o)*(c-l),t=(d-s.lastPosition)/e,u=1==o}s.lastVelocity=t,Number.isNaN(d)&&(console.warn("Got NaN while animating:",this),u=!0)}i&&!i[a].done&&(u=!1),u?s.done=!0:t=!1,s.setValue(d,r.round)&&(n=!0)}));let s=xv(this),a=s.getValue();if(t){let e=ev(o.to);a===e&&!n||r.decay?n&&r.decay&&this._onChange(a):(s.setValue(e),this._onChange(e)),this._stop()}else n&&this._onChange(a)}set(e){return Of.batchedUpdates((()=>{this._stop(),this._focus(e),this._set(e)})),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(bk(this)){let{to:e,config:t}=this.animation;Of.batchedUpdates((()=>{this._onStart(),t.decay||this._set(e,!1),this._stop()}))}return this}update(e){return(this.queue||(this.queue=[])).push(e),this}start(e,t){let n;return nb.und(e)?(n=this.queue||[],this.queue=[]):n=[nb.obj(e)?e:{...t,to:e}],Promise.all(n.map((e=>this._update(e)))).then((e=>rk(this,e)))}stop(e){let{to:t}=this.animation;return this._focus(this.get()),ck(this._state,e&&this._lastCallId),Of.batchedUpdates((()=>this._stop(t,e))),this}reset(){this._update({reset:!0})}eventObserved(e){"change"==e.type?this._start():"priority"==e.type&&(this.priority=e.priority+1)}_prepareNode(e){let t=this.key||"",{to:n,from:o}=e;n=nb.obj(n)?n[t]:n,(null==n||Xv(n))&&(n=void 0),o=nb.obj(o)?o[t]:o,null==o&&(o=void 0);let r={to:n,from:o};return fk(this)||(e.reverse&&([n,o]=[o,n]),o=ev(o),nb.und(o)?xv(this)||this._set(n):this._set(o)),r}_update({...e},t){let{key:n,defaultProps:o}=this;e.default&&Object.assign(o,Wv(e,((e,t)=>/^on/.test(t)?Uv(e,n):e))),Bk(this,e,"onProps"),Ik(this,"onProps",e,this);let r=this._prepareNode(e);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");let l=this._state;return ok(++this._lastCallId,{key:n,props:e,defaultProps:o,state:l,actions:{pause:()=>{vk(this)||(_k(this,!0),ub(l.pauseQueue),Ik(this,"onPause",ik(this,Ek(this,this.animation.to)),this))},resume:()=>{vk(this)&&(_k(this,!1),bk(this)&&this._resume(),ub(l.resumeQueue),Ik(this,"onResume",ik(this,Ek(this,this.animation.to)),this))},start:this._merge.bind(this,r)}}).then((n=>{if(e.loop&&n.finished&&(!t||!n.noop)){let t=wk(e);if(t)return this._update(t,!0)}return n}))}_merge(e,t,n){if(t.cancel)return this.stop(!0),n(sk(this));let o=!nb.und(e.to),r=!nb.und(e.from);if(o||r){if(!(t.callId>this._lastToId))return n(sk(this));this._lastToId=t.callId}let{key:l,defaultProps:i,animation:s}=this,{to:a,from:c}=s,{to:u=a,from:d=c}=e;r&&!o&&(!t.default||nb.und(u))&&(u=d),t.reverse&&([u,d]=[d,u]);let p=!ob(d,c);p&&(s.from=d),d=ev(d);let m=!ob(u,a);m&&this._focus(u);let h=Xv(t.to),{config:g}=s,{decay:f,velocity:b}=g;(o||r)&&(g.velocity=0),t.config&&!h&&function(e,t,n){n&&(ek(n={...n},t),t={...n,...t}),ek(e,t),Object.assign(e,t);for(let t in Qv)null==e[t]&&(e[t]=Qv[t]);let{mass:o,frequency:r,damping:l}=e;nb.und(r)||(r<.01&&(r=.01),l<0&&(l=0),e.tension=Math.pow(2*Math.PI/r,2)*o,e.friction=4*Math.PI*l*o/r)}(g,Hv(t.config,l),t.config!==i.config?Hv(i.config,l):void 0);let v=xv(this);if(!v||nb.und(u))return n(ik(this,!0));let k=nb.und(t.reset)?r&&!t.default:!nb.und(d)&&Gv(t.reset,l),_=k?d:this.get(),y=Yv(u),E=nb.num(y)||nb.arr(y)||yv(y),w=!h&&(!E||Gv(i.immediate||t.immediate,l));if(m){let e=Ov(u);if(e!==v.constructor){if(!w)throw Error(`Cannot animate between ${v.constructor.name} and ${e.name}, as the "to" prop suggests`);v=this._set(y)}}let S=v.constructor,C=Jb(u),x=!1;if(!C){let e=k||!fk(this)&&p;(m||e)&&(x=ob(Yv(_),y),C=!x),(!ob(s.immediate,w)&&!w||!ob(g.decay,f)||!ob(g.velocity,b))&&(C=!0)}if(x&&bk(this)&&(s.changed&&!k?C=!0:C||this._stop(a)),!h&&((C||Jb(a))&&(s.values=v.getPayload(),s.toValues=Jb(u)?null:S==Pv?[1]:ib(y)),s.immediate!=w&&(s.immediate=w,!w&&!k&&this._set(a)),C)){let{onRest:e}=s;rb(xk,(e=>Bk(this,t,e)));let o=ik(this,Ek(this,a));ub(this._pendingCalls,o),this._pendingCalls.add(n),s.changed&&Of.batchedUpdates((()=>{s.changed=!k,e?.(o,this),k?Hv(i.onRest,o):s.onStart?.(o,this)}))}k&&this._set(_),h?n(ak(t.to,t,this._state,this)):C?this._start():bk(this)&&!m?this._pendingCalls.add(n):n(lk(_))}_focus(e){let t=this.animation;e!==t.to&&(tv(this)&&this._detach(),t.to=e,tv(this)&&this._attach())}_attach(){let e=0,{to:t}=this.animation;Jb(t)&&(lv(t,this),pk(t)&&(e=t.priority+1)),this.priority=e}_detach(){let{to:e}=this.animation;Jb(e)&&iv(e,this)}_set(e,t=!0){let n=ev(e);if(!nb.und(n)){let e=xv(this);if(!e||!ob(n,e.getValue())){let o=Ov(n);e&&e.constructor==o?e.setValue(n):Bv(this,o.create(n)),e&&Of.batchedUpdates((()=>{this._onChange(n,t)}))}}return xv(this)}_onStart(){let e=this.animation;e.changed||(e.changed=!0,Ik(this,"onStart",ik(this,Ek(this,e.to)),this))}_onChange(e,t){t||(this._onStart(),Hv(this.animation.onChange,e,this)),Hv(this.defaultProps.onChange,e,this),super._onChange(e,t)}_start(){let e=this.animation;xv(this).reset(ev(e.to)),e.immediate||(e.fromValues=e.values.map((e=>e.lastPosition))),bk(this)||(kk(this,!0),vk(this)||this._resume())}_resume(){eb.skipAnimation?this.finish():_b.start(this)}_stop(e,t){if(bk(this)){kk(this,!1);let n=this.animation;rb(n.values,(e=>{e.done=!0})),n.toValues&&(n.onChange=n.onPause=n.onResume=void 0),nv(this,{type:"idle",parent:this});let o=t?sk(this.get()):ik(this.get(),Ek(this,e??n.to));ub(this._pendingCalls,o),n.changed&&(n.changed=!1,Ik(this,"onRest",o,this))}}};function Ek(e,t){let n=Yv(t);return ob(Yv(e.get()),n)}function wk(e,t=e.loop,n=e.to){let o=Hv(t);if(o){let r=!0!==o&&qv(o),l=(r||e).reverse,i=!r||r.reset;return Sk({...e,loop:t,default:!1,pause:void 0,to:!l||Xv(n)?n:void 0,from:i?e.from:void 0,reset:i,...r})}}function Sk(e){let{to:t,from:n}=e=qv(e),o=new Set;return nb.obj(t)&&Ck(t,o),nb.obj(n)&&Ck(n,o),e.keys=o.size?Array.from(o):null,e}function Ck(e,t){lb(e,((e,n)=>null!=e&&t.add(n)))}var xk=["onStart","onRest","onChange","onPause","onResume"];function Bk(e,t,n){e.animation[n]=t[n]!==$v(t,n)?Uv(t[n],e.key):void 0}function Ik(e,t,...n){e.animation[t]?.(...n),e.defaultProps[t]?.(...n)}var Tk=["onStart","onChange","onRest"],Mk=1,Pk=class{id=Mk++;springs={};queue=[];ref;_flush;_initialProps;_lastAsyncId=0;_active=new Set;_changed=new Set;_started=!1;_item;_state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_events={onStart:new Map,onChange:new Map,onRest:new Map};constructor(e,t){this._onFrame=this._onFrame.bind(this),t&&(this._flush=t),e&&this.start({default:!0,...e})}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every((e=>e.idle&&!e.isDelayed&&!e.isPaused))}get item(){return this._item}set item(e){this._item=e}get(){let e={};return this.each(((t,n)=>e[n]=t.get())),e}set(e){for(let t in e){let n=e[t];nb.und(n)||this.springs[t].set(n)}}update(e){return e&&this.queue.push(Sk(e)),this}start(e){let{queue:t}=this;return e?t=ib(e).map(Sk):this.queue=[],this._flush?this._flush(this,t):(Ok(this,t),Rk(this,t))}stop(e,t){if(e!==!!e&&(t=e),t){let n=this.springs;rb(ib(t),(t=>n[t].stop(!!e)))}else ck(this._state,this._lastAsyncId),this.each((t=>t.stop(!!e)));return this}pause(e){if(nb.und(e))this.start({pause:!0});else{let t=this.springs;rb(ib(e),(e=>t[e].pause()))}return this}resume(e){if(nb.und(e))this.start({pause:!1});else{let t=this.springs;rb(ib(e),(e=>t[e].resume()))}return this}each(e){lb(this.springs,e)}_onFrame(){let{onStart:e,onChange:t,onRest:n}=this._events,o=this._active.size>0,r=this._changed.size>0;(o&&!this._started||r&&!this._started)&&(this._started=!0,sb(e,(([e,t])=>{t.value=this.get(),e(t,this,this._item)})));let l=!o&&this._started,i=r||l&&n.size?this.get():null;r&&t.size&&sb(t,(([e,t])=>{t.value=i,e(t,this,this._item)})),l&&(this._started=!1,sb(n,(([e,t])=>{t.value=i,e(t,this,this._item)})))}eventObserved(e){if("change"==e.type)this._changed.add(e.parent),e.idle||this._active.add(e.parent);else{if("idle"!=e.type)return;this._active.delete(e.parent)}Of.onFrame(this._onFrame)}};function Rk(e,t){return Promise.all(t.map((t=>Nk(e,t)))).then((t=>rk(e,t)))}async function Nk(e,t,n){let{keys:o,to:r,from:l,loop:i,onRest:s,onResolve:a}=t,c=nb.obj(t.default)&&t.default;i&&(t.loop=!1),!1===r&&(t.to=null),!1===l&&(t.from=null);let u=nb.arr(r)||nb.fun(r)?r:void 0;u?(t.to=void 0,t.onRest=void 0,c&&(c.onRest=void 0)):rb(Tk,(n=>{let o=t[n];if(nb.fun(o)){let r=e._events[n];t[n]=({finished:e,cancelled:t})=>{let n=r.get(o);n?(e||(n.finished=!1),t&&(n.cancelled=!0)):r.set(o,{value:null,finished:e||!1,cancelled:t||!1})},c&&(c[n]=t[n])}}));let d=e._state;t.pause===!d.paused?(d.paused=t.pause,ub(t.pause?d.pauseQueue:d.resumeQueue)):d.paused&&(t.pause=!0);let p=(o||Object.keys(e.springs)).map((n=>e.springs[n].start(t))),m=!0===t.cancel||!0===$v(t,"cancel");(u||m&&d.asyncId)&&p.push(ok(++e._lastAsyncId,{props:t,state:d,actions:{pause:tb,resume:tb,start(t,n){m?(ck(d,e._lastAsyncId),n(sk(e))):(t.onRest=s,n(ak(u,t,d,e)))}}})),d.paused&&await new Promise((e=>{d.resumeQueue.add(e)}));let h=rk(e,await Promise.all(p));if(i&&h.finished&&(!n||!h.noop)){let n=wk(t,i,r);if(n)return Ok(e,[n]),Nk(e,n,!0)}return a&&Of.batchedUpdates((()=>a(h,e,e.item))),h}function Lk(e,t){let n=new yk;return n.key=e,t&&lv(n,t),n}function Ak(e,t,n){t.keys&&rb(t.keys,(o=>{(e[o]||(e[o]=n(o)))._prepareNode(t)}))}function Ok(e,t){rb(t,(t=>{Ak(e.springs,t,(t=>Lk(t,e)))}))}var Dk=({children:e,...t})=>{let n=(0,s.useContext)(zk),o=t.pause||!!n.pause,r=t.immediate||!!n.immediate;t=function(e,t){let[n]=(0,s.useState)((()=>({inputs:t,result:e()}))),o=(0,s.useRef)(),r=o.current,l=r;return l?Boolean(t&&l.inputs&&function(e,t){if(e.length!==t.length)return!1;for(let n=0;n{o.current=l,r==n&&(n.inputs=n.result=void 0)}),[l]),l.result}((()=>({pause:o,immediate:r})),[o,r]);let{Provider:l}=zk;return s.createElement(l,{value:t},e)},zk=function(e,t){return Object.assign(e,s.createContext(t)),e.Provider._context=e,e.Consumer._context=e,e}(Dk,{});Dk.Provider=zk.Provider,Dk.Consumer=zk.Consumer;var Vk=class extends hk{constructor(e,t){super(),this.source=e,this.calc=Ub(...t);let n=this._get(),o=Ov(n);Bv(this,o.create(n))}key;idle=!0;calc;_active=new Set;advance(e){let t=this._get();ob(t,this.get())||(xv(this).setValue(t),this._onChange(t,this.idle)),!this.idle&&Hk(this._active)&&Gk(this)}_get(){let e=nb.arr(this.source)?this.source.map(ev):ib(ev(this.source));return this.calc(...e)}_start(){this.idle&&!Hk(this._active)&&(this.idle=!1,rb(Iv(this),(e=>{e.done=!1})),eb.skipAnimation?(Of.batchedUpdates((()=>this.advance())),Gk(this)):_b.start(this))}_attach(){let e=1;rb(ib(this.source),(t=>{Jb(t)&&lv(t,this),pk(t)&&(t.idle||this._active.add(t),e=Math.max(e,t.priority+1))})),this.priority=e,this._start()}_detach(){rb(ib(this.source),(e=>{Jb(e)&&iv(e,this)})),this._active.clear(),Gk(this)}eventObserved(e){"change"==e.type?e.idle?this.advance():(this._active.add(e.parent),this._start()):"idle"==e.type?this._active.delete(e.parent):"priority"==e.type&&(this.priority=ib(this.source).reduce(((e,t)=>Math.max(e,(pk(t)?t.priority:0)+1)),0))}};function Fk(e){return!1!==e.idle}function Hk(e){return!e.size||Array.from(e).every(Fk)}function Gk(e){e.idle||(e.idle=!0,rb(Iv(e),(e=>{e.done=!0})),nv(e,{type:"idle",parent:e}))}eb.assign({createStringInterpolator:bv,to:(e,t)=>new Vk(e,t)});_b.advance;const Uk=window.ReactDOM;var $k=/^--/;function jk(e,t){return null==t||"boolean"==typeof t||""===t?"":"number"!=typeof t||0===t||$k.test(e)||Kk.hasOwnProperty(e)&&Kk[e]?(""+t).trim():t+"px"}var Wk={};var Kk={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Zk=["Webkit","Ms","Moz","O"];Kk=Object.keys(Kk).reduce(((e,t)=>(Zk.forEach((n=>e[((e,t)=>e+t.charAt(0).toUpperCase()+t.substring(1))(n,t)]=e[t])),e)),Kk);var qk=/^(matrix|translate|scale|rotate|skew)/,Yk=/^(translate)/,Xk=/^(rotate|skew)/,Qk=(e,t)=>nb.num(e)&&0!==e?e+t:e,Jk=(e,t)=>nb.arr(e)?e.every((e=>Jk(e,t))):nb.num(e)?e===t:parseFloat(e)===t,e_=class extends Nv{constructor({x:e,y:t,z:n,...o}){let r=[],l=[];(e||t||n)&&(r.push([e||0,t||0,n||0]),l.push((e=>[`translate3d(${e.map((e=>Qk(e,"px"))).join(",")})`,Jk(e,0)]))),lb(o,((e,t)=>{if("transform"===t)r.push([e||""]),l.push((e=>[e,""===e]));else if(qk.test(t)){if(delete o[t],nb.und(e))return;let n=Yk.test(t)?"px":Xk.test(t)?"deg":"";r.push(ib(e)),l.push("rotate3d"===t?([e,t,o,r])=>[`rotate3d(${e},${t},${o},${Qk(r,n)})`,Jk(r,0)]:e=>[`${t}(${e.map((e=>Qk(e,n))).join(",")})`,Jk(e,t.startsWith("scale")?1:0)])}})),r.length&&(o.transform=new t_(r,l)),super(o)}},t_=class extends ov{constructor(e,t){super(),this.inputs=e,this.transforms=t}_value=null;get(){return this._value||(this._value=this._get())}_get(){let e="",t=!0;return rb(this.inputs,((n,o)=>{let r=ev(n[0]),[l,i]=this.transforms[o](nb.arr(r)?r:n.map(ev));e+=" "+l,t=t&&i})),t?"none":e}observerAdded(e){1==e&&rb(this.inputs,(e=>rb(e,(e=>Jb(e)&&lv(e,this)))))}observerRemoved(e){0==e&&rb(this.inputs,(e=>rb(e,(e=>Jb(e)&&iv(e,this)))))}eventObserved(e){"change"==e.type&&(this._value=null),nv(this,e)}};eb.assign({batchedUpdates:Uk.unstable_batchedUpdates,createStringInterpolator:bv,colors:{transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199}});var n_=((e,{applyAnimatedValues:t=(()=>!1),createAnimatedStyle:n=(e=>new Nv(e)),getComponentProps:o=(e=>e)}={})=>{let r={applyAnimatedValues:t,createAnimatedStyle:n,getComponentProps:o},l=e=>{let t=Fv(e)||"Anonymous";return(e=nb.str(e)?l[e]||(l[e]=Dv(e,r)):e[Vv]||(e[Vv]=Dv(e,r))).displayName=`Animated(${t})`,e};return lb(e,((t,n)=>{nb.arr(e)&&(n=Fv(t)),l[n]=l(t)})),{animated:l}})(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"],{applyAnimatedValues:function(e,t){if(!e.nodeType||!e.setAttribute)return!1;let n="filter"===e.nodeName||e.parentNode&&"filter"===e.parentNode.nodeName,{style:o,children:r,scrollTop:l,scrollLeft:i,viewBox:s,...a}=t,c=Object.values(a),u=Object.keys(a).map((t=>n||e.hasAttribute(t)?t:Wk[t]||(Wk[t]=t.replace(/([A-Z])/g,(e=>"-"+e.toLowerCase())))));void 0!==r&&(e.textContent=r);for(let t in o)if(o.hasOwnProperty(t)){let n=jk(t,o[t]);$k.test(t)?e.style.setProperty(t,n):e.style[t]=n}u.forEach(((t,n)=>{e.setAttribute(t,c[n])})),void 0!==l&&(e.scrollTop=l),void 0!==i&&(e.scrollLeft=i),void 0!==s&&e.setAttribute("viewBox",s)},createAnimatedStyle:e=>new e_(e),getComponentProps:({scrollTop:e,scrollLeft:t,...n})=>n}),o_=n_.animated;function r_(e){return{top:e.offsetTop,left:e.offsetLeft}}const l_=function({triggerAnimationOnChange:e,clientId:t}){const n=(0,u.useRef)(),{isTyping:o,getGlobalBlockCount:r,isBlockSelected:l,isFirstMultiSelectedBlock:i,isBlockMultiSelected:s,isAncestorMultiSelected:a}=(0,d.useSelect)(Nr),{previous:c,prevRect:p}=(0,u.useMemo)((()=>({previous:n.current&&r_(n.current),prevRect:n.current&&n.current.getBoundingClientRect()})),[e]);return(0,u.useLayoutEffect)((()=>{if(!c||!n.current)return;const e=(0,As.getScrollContainer)(n.current),u=l(t),d=u||i(t);function m(){if(d&&p){const t=n.current.getBoundingClientRect().top-p.top;t&&(e.scrollTop+=t)}}if(window.matchMedia("(prefers-reduced-motion: reduce)").matches||o()||r()>200)return void m();const h=u||s(t)||a(t)?"1":"",g=new Pk({x:0,y:0,config:{mass:5,tension:2e3,friction:200},onChange({value:e}){if(!n.current)return;let{x:t,y:o}=e;t=Math.round(t),o=Math.round(o);const r=0===t&&0===o;n.current.style.transformOrigin="center center",n.current.style.transform=r?null:`translate3d(${t}px,${o}px,0)`,n.current.style.zIndex=h,m()}});n.current.style.transform=void 0;const f=r_(n.current),b=Math.round(c.left-f.left),v=Math.round(c.top-f.top);return g.start({x:0,y:0,from:{x:b,y:v}}),()=>{g.stop(),g.set({x:0,y:0})}}),[c,p,t,o,r,l,i,s,a]),n},i_=(0,u.createContext)({}),s_=".block-editor-block-list__block",a_=".block-list-appender",c_=".block-editor-button-block-appender";function u_(e,t){return e.closest(s_)===t.closest(s_)}function d_(e,t){return t.closest([s_,a_,c_].join(","))===e}function p_(e){for(;e&&e.nodeType!==e.ELEMENT_NODE;)e=e.parentNode;if(!e)return;const t=e.closest(s_);return t?t.id.slice(6):void 0}function m_({clientId:e,initialPosition:t}){const n=(0,u.useRef)(),{isBlockSelected:o,isMultiSelecting:r}=(0,d.useSelect)(Nr);return(0,u.useEffect)((()=>{if(!o(e)||r())return;if(null==t)return;if(!n.current)return;const{ownerDocument:l}=n.current;if(d_(n.current,l.activeElement))return;const i=As.focus.tabbable.find(n.current).filter((e=>(0,As.isTextField)(e))),s=-1===t,a=i[s?i.length-1:0]||n.current;if(d_(n.current,a)){if(!n.current.getAttribute("contenteditable")){const e=As.focus.tabbable.findNext(n.current);if(e&&d_(n.current,e)&&(0,As.isFormElement)(e))return void e.focus()}(0,As.placeCaretAtHorizontalEdge)(a,s)}else n.current.focus()}),[t,e]),n}function h_(e){if(e.defaultPrevented)return;const t="mouseover"===e.type?"add":"remove";e.preventDefault(),e.currentTarget.classList[t]("is-hovered")}function g_({isEnabled:e}){return(0,p.useRefEffect)((t=>{if(e)return t.addEventListener("mouseout",h_),t.addEventListener("mouseover",h_),()=>{t.removeEventListener("mouseout",h_),t.removeEventListener("mouseover",h_),t.classList.remove("is-hovered")}}),[e])}function f_(e){const{isBlockSelected:t}=(0,d.useSelect)(Nr),{selectBlock:n,selectionChange:o}=(0,d.useDispatch)(Nr);return(0,p.useRefEffect)((r=>{function l(l){r.parentElement.closest('[contenteditable="true"]')||(t(e)?l.target.isContentEditable||o(e):d_(r,l.target)&&n(e))}return r.addEventListener("focusin",l),()=>{r.removeEventListener("focusin",l)}}),[t,n])}function b_({clientId:e,isSelected:t}){const{getBlockRootClientId:n,getBlockIndex:o}=(0,d.useSelect)(Nr),{insertAfterBlock:r,removeBlock:l}=(0,d.useDispatch)(Nr);return(0,p.useRefEffect)((n=>{if(t)return n.addEventListener("keydown",o),n.addEventListener("dragstart",i),()=>{n.removeEventListener("keydown",o),n.removeEventListener("dragstart",i)};function o(t){const{keyCode:o,target:i}=t;o!==zs.ENTER&&o!==zs.BACKSPACE&&o!==zs.DELETE||i!==n||(0,As.isTextField)(i)||(t.preventDefault(),o===zs.ENTER?r(e):l(e))}function i(e){e.preventDefault()}}),[e,t,n,o,r,l])}function v_(e){const{isNavigationMode:t,isBlockSelected:n}=(0,d.useSelect)(Nr),{setNavigationMode:o,selectBlock:r}=(0,d.useDispatch)(Nr);return(0,p.useRefEffect)((l=>{function i(l){t()&&!l.defaultPrevented&&(l.preventDefault(),n(e)?o(!1):r(e))}return l.addEventListener("mousedown",i),()=>{l.removeEventListener("mousedown",i)}}),[e,t,n,o])}function k_(){const e=(0,u.useContext)(Kw);return(0,p.useRefEffect)((t=>{if(e)return e.observe(t),()=>{e.unobserve(t)}}),[e])}function __({clientId:e="",isEnabled:t=!0}={}){const{getEnabledClientIdsTree:n}=ie((0,d.useSelect)(Nr));return(0,p.useRefEffect)((o=>{if(!t)return;const r=t=>{(t.target===o||t.target.classList.contains("is-root-container"))&&(t.defaultPrevented||(t.preventDefault(),n(e).forEach((({clientId:e})=>{const t=o.querySelector(`[data-block="${e}"]`);t&&(t.classList.remove("has-editable-outline"),t.offsetWidth,t.classList.add("has-editable-outline"))}))))};return o.addEventListener("click",r),()=>o.removeEventListener("click",r)}),[t])}function y_(e={},{__unstableIsHtml:t}={}){const{clientId:n,className:o,wrapperProps:r={},isAligned:l,index:i,mode:s,name:a,blockApiVersion:c,blockTitle:d,isSelected:m,isSubtreeDisabled:h,isOutlineEnabled:g,hasOverlay:f,initialPosition:v,blockEditingMode:k,isHighlighted:_,isMultiSelected:E,isPartiallySelected:w,isReusable:S,isDragging:C,hasChildSelected:B,removeOutline:I,isBlockMovingMode:T,canInsertMovingBlock:M,isEditingDisabled:P,hasEditableOutline:R,isTemporarilyEditingAsBlocks:N,defaultClassName:L,templateLock:A}=(0,u.useContext)(i_),O=(0,x.sprintf)((0,x.__)("Block: %s"),d),D="html"!==s||t?"":"-visual",z=(0,p.useMergeRefs)([e.ref,m_({clientId:n,initialPosition:v}),gd(n),f_(n),b_({clientId:n,isSelected:m}),v_(n),g_({isEnabled:g}),k_(),l_({triggerAnimationOnChange:i,clientId:n}),(0,p.useDisabled)({isDisabled:!f}),__({clientId:n,isEnabled:"core/block"===a||"contentOnly"===A})]),V=y(),F=!!V[b]&&eg(a)?{"--wp-admin-theme-color":"var(--wp-bound-block-color)"}:{};return c<2&&V.clientId,{tabIndex:"disabled"===k?-1:0,...r,...e,ref:z,id:`block-${n}${D}`,role:"document","aria-label":O,"data-block":n,"data-type":a,"data-title":d,inert:h?"true":void 0,className:ml()("block-editor-block-list__block",{"wp-block":!l,"has-block-overlay":f,"is-selected":m,"is-highlighted":_,"is-multi-selected":E,"is-partially-selected":w,"is-reusable":S,"is-dragging":C,"has-child-selected":B,"remove-outline":I,"is-block-moving-mode":T,"can-insert-moving-block":M,"is-editing-disabled":P,"has-editable-outline":R,"is-content-locked-temporarily-editing-as-blocks":N},o,e.className,r.className,L),style:{...r.style,...e.style,...F}}}function E_({children:e,isHtml:t,...n}){return(0,s.createElement)("div",{...y_(n,{__unstableIsHtml:t})},e)}function w_({block:{__unstableBlockSource:e},mode:t,isLocked:n,canRemove:o,clientId:r,isSelected:l,isSelectionEnabled:i,className:a,__unstableLayoutClassNames:p,name:m,isValid:h,attributes:g,wrapperProps:f,setAttributes:b,onReplace:v,onInsertBlocksAfter:k,onMerge:_,toggleSelection:y}){var E;const{mayDisplayControls:w,mayDisplayParentControls:S,themeSupportsLayout:C,...x}=(0,u.useContext)(i_),{removeBlock:B}=(0,d.useDispatch)(Nr),I=(0,u.useCallback)((()=>B(r)),[r]),T=Ui()||{};let M=(0,s.createElement)(yf,{name:m,isSelected:l,attributes:g,setAttributes:b,insertBlocksAfter:n?void 0:k,onReplace:o?v:void 0,onRemove:o?I:void 0,mergeBlocks:o?_:void 0,clientId:r,isSelectionEnabled:i,toggleSelection:y,__unstableLayoutClassNames:p,__unstableParentLayout:Object.keys(T).length?T:void 0,mayDisplayControls:w,mayDisplayParentControls:S,blockEditingMode:x.blockEditingMode});const P=(0,c.getBlockType)(m);P?.getEditWrapperProps&&(f=function(e,t){const n={...e,...t};return e?.hasOwnProperty("className")&&t?.hasOwnProperty("className")&&(n.className=ml()(e.className,t.className)),e?.hasOwnProperty("style")&&t?.hasOwnProperty("style")&&(n.style={...e.style,...t.style}),n}(f,P.getEditWrapperProps(g)));const R=f&&!!f["data-align"]&&!C,N=a?.includes("is-position-sticky");let L;if(R&&(M=(0,s.createElement)("div",{className:ml()("wp-block",N&&a),"data-align":f["data-align"]},M)),h)L="html"===t?(0,s.createElement)(s.Fragment,null,(0,s.createElement)("div",{style:{display:"none"}},M),(0,s.createElement)(E_,{isHtml:!0},(0,s.createElement)(Lf,{clientId:r}))):P?.apiVersion>1?M:(0,s.createElement)(E_,null,M);else{const t=e?(0,c.serializeRawBlock)(e):(0,c.getSaveContent)(P,g);L=(0,s.createElement)(E_,{className:"has-warning"},(0,s.createElement)(If,{clientId:r}),(0,s.createElement)(u.RawHTML,null,(0,As.safeHTML)(t)))}const{"data-align":A,...O}=null!==(E=f)&&void 0!==E?E:{};return O.className=ml()(O.className,A&&C&&`align${A}`,!(A&&N)&&a),(0,s.createElement)(i_.Provider,{value:{wrapperProps:O,isAligned:R,...x}},(0,s.createElement)(Rf,{fallback:(0,s.createElement)(E_,{className:"has-warning"},(0,s.createElement)(Mf,null))},L))}y_.save=c.__unstableGetBlockProps;const S_=(0,d.withDispatch)(((e,t,n)=>{const{updateBlockAttributes:o,insertBlocks:r,mergeBlocks:l,replaceBlocks:i,toggleSelection:s,__unstableMarkLastChangeAsPersistent:a,moveBlocksToPosition:u,removeBlock:d}=e(Nr);return{setAttributes(e){const{getMultiSelectedBlockClientIds:r}=n.select(Nr),l=r(),{clientId:i}=t,s=l.length?l:[i];o(s,e)},onInsertBlocks(e,n){const{rootClientId:o}=t;r(e,n,o)},onInsertBlocksAfter(e){const{clientId:o,rootClientId:l}=t,{getBlockIndex:i}=n.select(Nr),s=i(o);r(e,s+1,l)},onMerge(e){const{clientId:o,rootClientId:i}=t,{getPreviousBlockClientId:s,getNextBlockClientId:a,getBlock:p,getBlockAttributes:m,getBlockName:h,getBlockOrder:g,getBlockIndex:f,getBlockRootClientId:b,canInsertBlockType:v}=n.select(Nr);function k(e,t=!0){const o=b(e),l=g(e),[i]=l;1===l.length&&(0,c.isUnmodifiedBlock)(p(i))?d(e):n.batch((()=>{if(v(h(i),o))u([i],e,o,f(e));else{const n=(0,c.switchToBlockType)(p(i),(0,c.getDefaultBlockName)());n&&n.length&&(r(n,f(e),o,t),d(i,!1))}!g(e).length&&(0,c.isUnmodifiedBlock)(p(e))&&d(e,!1)}))}if(e){if(i){const e=a(i);if(e){if(h(i)!==h(e))return void l(i,e);{const t=m(i),o=m(e);if(Object.keys(t).every((e=>t[e]===o[e])))return void n.batch((()=>{u(g(e),e,i),d(e,!1)}))}}}const e=a(o);if(!e)return;g(e).length?k(e,!1):l(o,e)}else{const e=s(o);if(e)l(e,o);else if(i){const e=s(i);if(e&&h(i)===h(e)){const t=m(i),o=m(e);if(Object.keys(t).every((e=>t[e]===o[e])))return void n.batch((()=>{u(g(i),i,e),d(i,!1)}))}k(i)}else d(o)}},onReplace(e,n,o){e.length&&!(0,c.isUnmodifiedDefaultBlock)(e[e.length-1])&&a();const r=1===e?.length&&Array.isArray(e[0])?e[0]:e;i([t.clientId],r,n,o)},toggleSelection(e){s(e)}}}));w_=(0,p.compose)(S_,(0,_l.withFilters)("editor.BlockListBlock"))(w_);const C_=(0,u.memo)((function(e){const{clientId:t,rootClientId:n}=e,o=(0,d.useSelect)((e=>{const{isBlockSelected:o,getBlockMode:r,isSelectionEnabled:l,getTemplateLock:i,getBlockWithoutAttributes:s,getBlockAttributes:a,canRemoveBlock:u,canMoveBlock:d,getSettings:p,__unstableGetTemporarilyEditingAsBlocks:m,getBlockEditingMode:h,getBlockName:g,isFirstMultiSelectedBlock:f,getMultiSelectedBlockClientIds:b,hasSelectedInnerBlock:v,getBlockIndex:k,isTyping:_,isBlockMultiSelected:y,isBlockSubtreeDisabled:E,isBlockHighlighted:w,__unstableIsFullySelected:S,__unstableSelectionHasUnmergeableBlock:C,isBlockBeingDragged:x,isDragging:B,hasBlockMovingClientId:I,canInsertBlockType:T,__unstableHasActiveBlockOverlayActive:M,__unstableGetEditorMode:P,getSelectedBlocksInitialCaretPosition:R}=ie(e(Nr)),N=s(t);if(!N)return;const{hasBlockSupport:L,getActiveBlockVariation:A}=e(c.store),O=o(t),D=u(t,n),z=d(t,n),V=a(t),{name:F,isValid:H}=N,G=(0,c.getBlockType)(F),U=A(F,V),{outlineMode:$,supportsLayout:j}=p(),W=y(t),K=v(t,!0),Z=_(),q=G?.apiVersion>1,Y=I(),X=h(t);return{mode:r(t),isSelectionEnabled:l(),isLocked:!!i(n),templateLock:i(t),canRemove:D,canMove:z,blockWithoutAttributes:N,name:F,attributes:V,isValid:H,isSelected:O,themeSupportsLayout:j,isTemporarilyEditingAsBlocks:m()===t,blockEditingMode:X,mayDisplayControls:O||f(t)&&b().every((e=>g(e)===F)),mayDisplayParentControls:L(g(t),"__experimentalExposeControlsToChildren",!1)&&v(t),index:k(t),blockApiVersion:G?.apiVersion||1,blockTitle:U?.title||G?.title,isSubtreeDisabled:"disabled"===X&&E(t),isOutlineEnabled:$,hasOverlay:M(t)&&!B(),initialPosition:O&&"edit"===P()?R():void 0,isHighlighted:w(t),isMultiSelected:W,isPartiallySelected:W&&!S()&&!C(),isReusable:(0,c.isReusableBlock)(G),isDragging:x(t),hasChildSelected:K,removeOutline:O&&$&&Z,isBlockMovingMode:!!Y,canInsertMovingBlock:Y&&T(g(Y),n),isEditingDisabled:"disabled"===X,hasEditableOutline:"disabled"!==X&&"disabled"===h(n),className:q?V.className:void 0,defaultClassName:q?(0,c.getBlockDefaultClassName)(F):void 0}}),[t,n]),{mode:r,isSelectionEnabled:l,isLocked:i,canRemove:a,canMove:p,blockWithoutAttributes:m,name:h,attributes:g,isValid:f,isSelected:b,themeSupportsLayout:v,isTemporarilyEditingAsBlocks:k,blockEditingMode:_,mayDisplayControls:y,mayDisplayParentControls:E,index:w,blockApiVersion:S,blockTitle:C,isSubtreeDisabled:x,isOutlineEnabled:B,hasOverlay:I,initialPosition:T,isHighlighted:M,isMultiSelected:P,isPartiallySelected:R,isReusable:N,isDragging:L,hasChildSelected:A,removeOutline:O,isBlockMovingMode:D,canInsertMovingBlock:z,templateLock:V,isEditingDisabled:F,hasEditableOutline:H,className:G,defaultClassName:U}=o,$=(0,u.useMemo)((()=>({...m,attributes:g})),[m,g]);if(!o)return null;const j={clientId:t,className:G,index:w,mode:r,name:h,blockApiVersion:S,blockTitle:C,isSelected:b,isSubtreeDisabled:x,isOutlineEnabled:B,hasOverlay:I,initialPosition:T,blockEditingMode:_,isHighlighted:M,isMultiSelected:P,isPartiallySelected:R,isReusable:N,isDragging:L,hasChildSelected:A,removeOutline:O,isBlockMovingMode:D,canInsertMovingBlock:z,templateLock:V,isEditingDisabled:F,hasEditableOutline:H,isTemporarilyEditingAsBlocks:k,defaultClassName:U,mayDisplayControls:y,mayDisplayParentControls:E,themeSupportsLayout:v};return(0,s.createElement)(i_.Provider,{value:j},(0,s.createElement)(w_,{...e,mode:r,isSelectionEnabled:l,isLocked:i,canRemove:a,canMove:p,block:$,name:h,attributes:g,isValid:f,isSelected:b}))})),x_=window.wp.htmlEntities,B_=[(0,u.createInterpolateElement)((0,x.__)("While writing, you can press / to quickly insert new blocks."),{kbd:(0,s.createElement)("kbd",null)}),(0,u.createInterpolateElement)((0,x.__)("Indent a list by pressing space at the beginning of a line."),{kbd:(0,s.createElement)("kbd",null)}),(0,u.createInterpolateElement)((0,x.__)("Outdent a list by pressing backspace at the beginning of a line."),{kbd:(0,s.createElement)("kbd",null)}),(0,x.__)("Drag files into the editor to automatically insert media blocks."),(0,x.__)("Change a block's type by pressing the block icon on the toolbar.")];const I_=function(){const[e]=(0,u.useState)(Math.floor(Math.random()*B_.length));return(0,s.createElement)(_l.Tip,null,B_[e])},T_=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"})),M_=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"}));const P_=function({title:e,icon:t,description:n,blockType:o,className:r}){o&&(w()("`blockType` property in `BlockCard component`",{since:"5.7",alternative:"`title, icon and description` properties"}),({title:e,icon:t,description:n}=o));const{parentNavBlockClientId:l}=(0,d.useSelect)((e=>{const{getSelectedBlockClientId:t,getBlockParentsByBlockName:n}=e(Nr);return{parentNavBlockClientId:n(t(),"core/navigation",!0)[0]}}),[]),{selectBlock:i}=(0,d.useDispatch)(Nr);return(0,s.createElement)("div",{className:ml()("block-editor-block-card",r)},l&&(0,s.createElement)(_l.Button,{onClick:()=>i(l),label:(0,x.__)("Go to parent Navigation block"),style:{minWidth:24,padding:0},icon:(0,x.isRTL)()?T_:M_,size:"small"}),(0,s.createElement)(qh,{icon:t,showColors:!0}),(0,s.createElement)("div",{className:"block-editor-block-card__content"},(0,s.createElement)("h2",{className:"block-editor-block-card__title"},e),n&&(0,s.createElement)("span",{className:"block-editor-block-card__description"},n)))},R_=(0,p.createHigherOrderComponent)((e=>(0,d.withRegistry)((({useSubRegistry:t=!0,registry:n,...o})=>{if(!t)return(0,s.createElement)(e,{registry:n,...o});const[r,l]=(0,u.useState)(null);return(0,u.useEffect)((()=>{const e=(0,d.createRegistry)({},n);e.registerStore(oe,Rr),l(e)}),[n]),r?(0,s.createElement)(d.RegistryProvider,{value:r},(0,s.createElement)(e,{registry:r,...o})):null}))),"withRegistryProvider"),N_=()=>{};function L_({clientId:e=null,value:t,selection:n,onChange:o=N_,onInput:r=N_}){const l=(0,d.useRegistry)(),{resetBlocks:i,resetSelection:s,replaceInnerBlocks:a,setHasControlledInnerBlocks:p,__unstableMarkNextChangeAsNotPersistent:m}=l.dispatch(Nr),{getBlockName:h,getBlocks:g,getSelectionStart:f,getSelectionEnd:b}=l.select(Nr),v=(0,d.useSelect)((t=>!e||t(Nr).areInnerBlocksControlled(e)),[e]),k=(0,u.useRef)({incoming:null,outgoing:[]}),_=(0,u.useRef)(!1),y=()=>{t&&(m(),e?l.batch((()=>{p(e,!0);const n=t.map((e=>(0,c.cloneBlock)(e)));_.current&&(k.current.incoming=n),m(),a(e,n)})):(_.current&&(k.current.incoming=t),i(t)))},E=(0,u.useRef)(r),w=(0,u.useRef)(o);(0,u.useEffect)((()=>{E.current=r,w.current=o}),[r,o]),(0,u.useEffect)((()=>{k.current.outgoing.includes(t)?k.current.outgoing[k.current.outgoing.length-1]===t&&(k.current.outgoing=[]):g(e)!==t&&(k.current.outgoing=[],y(),n&&s(n.selectionStart,n.selectionEnd,n.initialPosition))}),[t,e]),(0,u.useEffect)((()=>{v||(k.current.outgoing=[],y())}),[v]),(0,u.useEffect)((()=>{const{getSelectedBlocksInitialCaretPosition:t,isLastBlockChangePersistent:n,__unstableIsLastBlockChangeIgnored:o,areInnerBlocksControlled:r}=l.select(Nr);let i=g(e),s=n(),a=!1;_.current=!0;const c=l.subscribe((()=>{if(null!==e&&null===h(e))return;if(!(!e||r(e)))return;const l=n(),c=g(e),u=c!==i;if(i=c,u&&(k.current.incoming||o()))return k.current.incoming=null,void(s=l);if(u||a&&!u&&l&&!s){s=l,k.current.outgoing.push(i);const e=s?w.current:E.current,n=wn.has(i);n&&wn.delete(i),e(i,{selection:{selectionStart:f(),selectionEnd:b(),initialPosition:t()},undoIgnore:n})}a=u}),Nr);return()=>{_.current=!1,c()}}),[l,e]),(0,u.useEffect)((()=>()=>{m(),e?(p(e,!1),m(),a(e,[])):i([])}),[])}const A_=window.wp.keyboardShortcuts;function O_(){return null}O_.Register=function(){const{registerShortcut:e}=(0,d.useDispatch)(A_.store);return(0,u.useEffect)((()=>{e({name:"core/block-editor/duplicate",category:"block",description:(0,x.__)("Duplicate the selected block(s)."),keyCombination:{modifier:"primaryShift",character:"d"}}),e({name:"core/block-editor/remove",category:"block",description:(0,x.__)("Remove the selected block(s)."),keyCombination:{modifier:"access",character:"z"}}),e({name:"core/block-editor/insert-before",category:"block",description:(0,x.__)("Insert a new block before the selected block(s)."),keyCombination:{modifier:"primaryAlt",character:"t"}}),e({name:"core/block-editor/insert-after",category:"block",description:(0,x.__)("Insert a new block after the selected block(s)."),keyCombination:{modifier:"primaryAlt",character:"y"}}),e({name:"core/block-editor/delete-multi-selection",category:"block",description:(0,x.__)("Delete selection."),keyCombination:{character:"del"},aliases:[{character:"backspace"}]}),e({name:"core/block-editor/select-all",category:"selection",description:(0,x.__)("Select all text when typing. Press again to select all blocks."),keyCombination:{modifier:"primary",character:"a"}}),e({name:"core/block-editor/unselect",category:"selection",description:(0,x.__)("Clear selection."),keyCombination:{character:"escape"}}),e({name:"core/block-editor/multi-text-selection",category:"selection",description:(0,x.__)("Select text across multiple blocks."),keyCombination:{modifier:"shift",character:"arrow"}}),e({name:"core/block-editor/focus-toolbar",category:"global",description:(0,x.__)("Navigate to the nearest toolbar."),keyCombination:{modifier:"alt",character:"F10"}}),e({name:"core/block-editor/move-up",category:"block",description:(0,x.__)("Move the selected block(s) up."),keyCombination:{modifier:"secondary",character:"t"}}),e({name:"core/block-editor/move-down",category:"block",description:(0,x.__)("Move the selected block(s) down."),keyCombination:{modifier:"secondary",character:"y"}})}),[e]),null};const D_=O_,z_=R_((e=>{const{children:t,settings:n,stripExperimentalSettings:o=!1}=e,{__experimentalUpdateSettings:r}=ie((0,d.useDispatch)(Nr));return(0,u.useEffect)((()=>{r({...n,__internalIsInitialized:!0},{stripExperimentalSettings:o,reset:!0})}),[n,o,r]),L_(e),(0,s.createElement)(_l.SlotFillProvider,{passthrough:!0},!n?.__unstableIsPreviewMode&&(0,s.createElement)(D_.Register,null),(0,s.createElement)(hd,null,t))})),V_=e=>(0,s.createElement)(z_,{...e,stripExperimentalSettings:!0},e.children);function F_(){const{getSettings:e,hasSelectedBlock:t,hasMultiSelection:n}=(0,d.useSelect)(Nr),{clearSelectedBlock:o}=(0,d.useDispatch)(Nr),{clearBlockSelection:r}=e();return(0,p.useRefEffect)((e=>{if(r)return e.addEventListener("mousedown",l),()=>{e.removeEventListener("mousedown",l)};function l(r){(t()||n())&&r.target===e&&o()}}),[t,n,o,r])}function H_(e){return(0,s.createElement)("div",{ref:F_(),...e})}function G_(e){const{isMultiSelecting:t,getMultiSelectedBlockClientIds:n,hasMultiSelection:o,getSelectedBlockClientId:r,getSelectedBlocksInitialCaretPosition:l,__unstableIsFullySelected:i}=e(Nr);return{isMultiSelecting:t(),multiSelectedBlockClientIds:n(),hasMultiSelection:o(),selectedBlockClientId:r(),initialPosition:l(),isFullSelection:i()}}function U_(){const{initialPosition:e,isMultiSelecting:t,multiSelectedBlockClientIds:n,hasMultiSelection:o,selectedBlockClientId:r,isFullSelection:l}=(0,d.useSelect)(G_,[]);return(0,p.useRefEffect)((r=>{const{ownerDocument:i}=r,{defaultView:s}=i;if(null==e)return;if(!o||t)return;const{length:a}=n;a<2||l&&(r.contentEditable=!0,r.focus(),s.getSelection().removeAllRanges())}),[o,t,n,r,e,l])}function $_(e,t,n,o){let r,l=As.focus.focusable.find(n);return t&&l.reverse(),l=l.slice(l.indexOf(e)+1),o&&(r=e.getBoundingClientRect()),l.find((function(e){if(!(e.closest("[inert]")||1===e.children.length&&u_(e,e.firstElementChild)&&"true"===e.firstElementChild.getAttribute("contenteditable"))){if(!As.focus.tabbable.isTabbableIndex(e))return!1;if(e.isContentEditable&&"true"!==e.contentEditable)return!1;if(o){const t=e.getBoundingClientRect();if(t.left>=r.right||t.right<=r.left)return!1}return!0}}))}function j_(){const{getMultiSelectedBlocksStartClientId:e,getMultiSelectedBlocksEndClientId:t,getSettings:n,hasMultiSelection:o,__unstableIsFullySelected:r}=(0,d.useSelect)(Nr),{selectBlock:l}=(0,d.useDispatch)(Nr);return(0,p.useRefEffect)((i=>{let s;function a(){s=null}function c(a){if(a.defaultPrevented)return;const{keyCode:c,target:u,shiftKey:d,ctrlKey:p,altKey:m,metaKey:h}=a,g=c===zs.UP,f=c===zs.DOWN,b=c===zs.LEFT,v=c===zs.RIGHT,k=g||b,_=b||v,y=g||f,E=_||y,w=d||p||m||h,S=y?As.isVerticalEdge:As.isHorizontalEdge,{ownerDocument:C}=i,{defaultView:x}=C;if(!E)return;if(o()){if(d)return;if(!r())return;return a.preventDefault(),void(k?l(e()):l(t(),-1))}if(!function(e,t,n){const o=t===zs.UP||t===zs.DOWN,{tagName:r}=e,l=e.getAttribute("type");if(o&&!n)return"INPUT"!==r||!["date","datetime-local","month","number","range","time","week"].includes(l);if("INPUT"===r)return["button","checkbox","number","color","file","image","radio","reset","submit"].includes(l);return"TEXTAREA"!==r}(u,c,w))return;y?s||(s=(0,As.computeCaretRect)(x)):s=null;const B=(0,As.isRTL)(u)?!k:k,{keepCaretInsideBlock:I}=n();if(d)(function(e,t){const n=$_(e,t,i);return n&&p_(n)})(u,k)&&S(u,k)&&(i.contentEditable=!0,i.focus());else if(!y||!(0,As.isVerticalEdge)(u,k)||m&&!(0,As.isHorizontalEdge)(u,B)||I){if(_&&x.getSelection().isCollapsed&&(0,As.isHorizontalEdge)(u,B)&&!I){const e=$_(u,B,i);(0,As.placeCaretAtHorizontalEdge)(e,k),a.preventDefault()}}else{const e=$_(u,k,i,!0);e&&((0,As.placeCaretAtVerticalEdge)(e,m?!k:k,m?void 0:s),a.preventDefault())}}return i.addEventListener("mousedown",a),i.addEventListener("keydown",c),()=>{i.removeEventListener("mousedown",a),i.removeEventListener("keydown",c)}}),[])}function W_(){const{getBlockOrder:e,getSelectedBlockClientIds:t,getBlockRootClientId:n}=(0,d.useSelect)(Nr),{multiSelect:o,selectBlock:r}=(0,d.useDispatch)(Nr),l=(0,A_.__unstableUseShortcutEventMatch)();return(0,p.useRefEffect)((i=>{function s(s){if(!l("core/block-editor/select-all",s))return;const a=t();if(a.length<2&&!(0,As.isEntirelySelected)(s.target))return;s.preventDefault();const[c]=a,u=n(c),d=e(u);a.length!==d.length?o(d[0],d[d.length-1]):u&&(i.ownerDocument.defaultView.getSelection().removeAllRanges(),r(u))}return i.addEventListener("keydown",s),()=>{i.removeEventListener("keydown",s)}}),[])}function K_(e,t){e.contentEditable=t,t&&e.focus()}function Z_(){const{startMultiSelect:e,stopMultiSelect:t}=(0,d.useDispatch)(Nr),{isSelectionEnabled:n,hasSelectedBlock:o,isDraggingBlocks:r,isMultiSelecting:l}=(0,d.useSelect)(Nr);return(0,p.useRefEffect)((i=>{const{ownerDocument:s}=i,{defaultView:a}=s;let c,u;function d(){t(),a.removeEventListener("mouseup",d),u=a.requestAnimationFrame((()=>{if(!o())return;K_(i,!1);const e=a.getSelection();if(e.rangeCount){const t=e.getRangeAt(0),{commonAncestorContainer:n}=t,o=t.cloneRange();c.contains(n)&&(c.focus(),e.removeAllRanges(),e.addRange(o))}}))}function p({buttons:t,target:o,relatedTarget:s}){o.contains(s)||r()||1===t&&(l()||i!==o&&"true"===o.getAttribute("contenteditable")&&n()&&(c=o,e(),a.addEventListener("mouseup",d),K_(i,!0)))}return i.addEventListener("mouseout",p),()=>{i.removeEventListener("mouseout",p),a.removeEventListener("mouseup",d),a.cancelAnimationFrame(u)}}),[e,t,n,o])}function q_(e,t){e.contentEditable!==String(t)&&(e.contentEditable=t,t&&e.focus())}function Y_(e){const t=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;return t?.closest("[data-wp-block-attribute-key]")}function X_(){const{multiSelect:e,selectBlock:t,selectionChange:n}=(0,d.useDispatch)(Nr),{getBlockParents:o,getBlockSelectionStart:r,isMultiSelecting:l}=(0,d.useSelect)(Nr);return(0,p.useRefEffect)((i=>{const{ownerDocument:s}=i,{defaultView:a}=s;function c(s){const c=a.getSelection();if(!c.rangeCount)return;const u=function(e){const{anchorNode:t,anchorOffset:n}=e;return t.nodeType===t.TEXT_NODE||0===n?t:t.childNodes[n-1]}(c),d=function(e){const{focusNode:t,focusOffset:n}=e;return t.nodeType===t.TEXT_NODE||n===t.childNodes.length?t:t.childNodes[n]}(c);if(!i.contains(u)||!i.contains(d))return;const p=s.shiftKey&&"mouseup"===s.type;if(c.isCollapsed&&!p){if("true"===i.contentEditable&&!l()){q_(i,!1);let e=u.nodeType===u.ELEMENT_NODE?u:u.parentElement;e=e?.closest("[contenteditable]"),e?.focus()}return}let m=p_(u),h=p_(d);if(p){const e=r(),t=p_(s.target),n=t!==h;(m===h&&c.isCollapsed||!h||n)&&(h=t),m!==e&&(m=e)}if(void 0===m&&void 0===h)return void q_(i,!1);if(m===h)l()?e(m,m):t(m);else{const t=[...o(m),m],r=[...o(h),h],l=function(e,t){let n=0;for(;e[n]===t[n];)n++;return n}(t,r);if(t[l]!==m||r[l]!==h)return void e(t[l],r[l]);const i=Y_(u),s=Y_(d);if(i&&s){var g,f;const e=c.getRangeAt(0),t=(0,Y.create)({element:i,range:e,__unstableIsEditableTree:!0}),o=(0,Y.create)({element:s,range:e,__unstableIsEditableTree:!0}),r=null!==(g=t.start)&&void 0!==g?g:t.end,l=null!==(f=o.start)&&void 0!==f?f:o.end;n({start:{clientId:m,attributeKey:i.dataset.wpBlockAttributeKey,offset:r},end:{clientId:h,attributeKey:s.dataset.wpBlockAttributeKey,offset:l}})}else e(m,h)}}return s.addEventListener("selectionchange",c),a.addEventListener("mouseup",c),()=>{s.removeEventListener("selectionchange",c),a.removeEventListener("mouseup",c)}}),[e,t,n,o])}function Q_(){const{selectBlock:e}=(0,d.useDispatch)(Nr),{isSelectionEnabled:t,getBlockSelectionStart:n,hasMultiSelection:o}=(0,d.useSelect)(Nr);return(0,p.useRefEffect)((r=>{function l(l){if(!t()||0!==l.button)return;const i=n(),s=p_(l.target);l.shiftKey?i!==s&&(r.contentEditable=!0,r.focus()):o()&&e(s)}return r.addEventListener("mousedown",l),()=>{r.removeEventListener("mousedown",l)}}),[e,t,n,o])}function J_(){const{__unstableIsFullySelected:e,getSelectedBlockClientIds:t,__unstableIsSelectionMergeable:n,hasMultiSelection:o}=(0,d.useSelect)(Nr),{replaceBlocks:r,__unstableSplitSelection:l,removeBlocks:i,__unstableDeleteSelection:s,__unstableExpandSelection:a}=(0,d.useDispatch)(Nr);return(0,p.useRefEffect)((u=>{function d(e){"true"===u.contentEditable&&e.preventDefault()}function p(d){d.defaultPrevented||o()&&(d.keyCode===zs.ENTER?(u.contentEditable=!1,d.preventDefault(),e()?r(t(),(0,c.createBlock)((0,c.getDefaultBlockName)())):l()):d.keyCode===zs.BACKSPACE||d.keyCode===zs.DELETE?(u.contentEditable=!1,d.preventDefault(),e()?i(t()):n()?s(d.keyCode===zs.DELETE):a()):1!==d.key.length||d.metaKey||d.ctrlKey||(u.contentEditable=!1,n()?s(d.keyCode===zs.DELETE):(d.preventDefault(),u.ownerDocument.defaultView.getSelection().removeAllRanges())))}function m(e){o()&&(u.contentEditable=!1,n()?s():(e.preventDefault(),u.ownerDocument.defaultView.getSelection().removeAllRanges()))}return u.addEventListener("beforeinput",d),u.addEventListener("keydown",p),u.addEventListener("compositionstart",m),()=>{u.removeEventListener("beforeinput",d),u.removeEventListener("keydown",p),u.removeEventListener("compositionstart",m)}}),[])}function ey(){const{getBlockName:e}=(0,d.useSelect)(Nr),{getBlockType:t}=(0,d.useSelect)(c.store),{createSuccessNotice:n}=(0,d.useDispatch)(Os.store);return(0,u.useCallback)(((o,r)=>{let l="";if(1===r.length){const n=r[0],i=t(e(n))?.title;l="copy"===o?(0,x.sprintf)((0,x.__)('Copied "%s" to clipboard.'),i):(0,x.sprintf)((0,x.__)('Moved "%s" to clipboard.'),i)}else l="copy"===o?(0,x.sprintf)((0,x._n)("Copied %d block to clipboard.","Copied %d blocks to clipboard.",r.length),r.length):(0,x.sprintf)((0,x._n)("Moved %d block to clipboard.","Moved %d blocks to clipboard.",r.length),r.length);n(l,{type:"snackbar"})}),[])}function ty({clipboardData:e}){let t="",n="";try{t=e.getData("text/plain"),n=e.getData("text/html")}catch(t){try{n=e.getData("Text")}catch(e){return}}n=function(e){const t="\x3c!--StartFragment--\x3e",n=e.indexOf(t);if(!(n>-1))return e;const o=(e=e.substring(n+20)).indexOf("\x3c!--EndFragment--\x3e");return o>-1&&(e=e.substring(0,o)),e}(n),n=function(e){const t="";return e.startsWith(t)?e.slice(22):e}(n);const o=(0,As.getFilesFromDataTransfer)(e);return o.length&&!function(e,t){if(t&&1===e?.length&&0===e[0].type.indexOf("image/")){const e=/<\s*img\b/gi;if(1!==t.match(e)?.length)return!0;const n=/<\s*img\b[^>]*\bsrc="file:\/\//i;if(t.match(n))return!0}return!1}(o,n)?{files:o}:{html:n,plainText:t,files:[]}}const ny=Symbol("requiresWrapperOnCopy");function oy(e,t,n){let o=t;const[r]=t;if(r){if(n.select(c.store).getBlockType(r.name)[ny]){const{getBlockRootClientId:e,getBlockName:t,getBlockAttributes:l}=n.select(Nr),i=e(r.clientId),s=t(i);s&&(o=(0,c.createBlock)(s,l(i),o))}}const l=(0,c.serialize)(o);e.clipboardData.setData("text/plain",function(e){e=e.replace(/
/g,"\n");return(0,As.__unstableStripHTML)(e).trim().replace(/\n\n+/g,"\n\n")}(l)),e.clipboardData.setData("text/html",l)}function ry(e,t){const{plainText:n,html:o,files:r}=ty(e);let l=[];if(r.length){const e=(0,c.getBlockTransforms)("from");l=r.reduce(((t,n)=>{const o=(0,c.findTransform)(e,(e=>"files"===e.type&&e.isMatch([n])));return o&&t.push(o.transform([n])),t}),[]).flat()}else l=(0,c.pasteHandler)({HTML:o,plainText:n,mode:"BLOCKS",canUserUseUnfilteredHTML:t});return l}function ly(){const e=(0,d.useRegistry)(),{getBlocksByClientId:t,getSelectedBlockClientIds:n,hasMultiSelection:o,getSettings:r,__unstableIsFullySelected:l,__unstableIsSelectionCollapsed:i,__unstableIsSelectionMergeable:s,__unstableGetSelectedBlocksWithPartialSelection:a,canInsertBlockType:c}=(0,d.useSelect)(Nr),{flashBlock:u,removeBlocks:m,replaceBlocks:h,__unstableDeleteSelection:g,__unstableExpandSelection:f,insertBlocks:b}=(0,d.useDispatch)(Nr),v=ey();return(0,p.useRefEffect)((d=>{function p(p){if(p.defaultPrevented)return;const k=n();if(0===k.length)return;if(!o()){const{target:e}=p,{ownerDocument:t}=e;if("copy"===p.type||"cut"===p.type?(0,As.documentHasUncollapsedSelection)(t):(0,As.documentHasSelection)(t))return}if(!d.contains(p.target.ownerDocument.activeElement))return;p.preventDefault();const _=s(),y=i()||l(),E=!y&&!_;if("copy"===p.type||"cut"===p.type)if(1===k.length&&u(k[0]),E)f();else{let n;if(v(p.type,k),y)n=t(k);else{const[e,o]=a();n=[e,...t(k.slice(1,k.length-1)),o]}oy(p,n,e)}if("cut"===p.type)y&&!E?m(k):(p.target.ownerDocument.activeElement.contentEditable=!1,g());else if("paste"===p.type){const{__experimentalCanUserUseUnfilteredHTML:e}=r(),t=ry(p,e);if(1===k.length){const[e]=k;if(t.every((t=>c(t.name,e))))return void b(t,void 0,e)}h(k,t,t.length-1,-1)}}return d.ownerDocument.addEventListener("copy",p),d.ownerDocument.addEventListener("cut",p),d.ownerDocument.addEventListener("paste",p),()=>{d.ownerDocument.removeEventListener("copy",p),d.ownerDocument.removeEventListener("cut",p),d.ownerDocument.removeEventListener("paste",p)}}),[])}function iy(){const[e,t,n]=function(){const e=(0,u.useRef)(),t=(0,u.useRef)(),n=(0,u.useRef)(),{hasMultiSelection:o,getSelectedBlockClientId:r,getBlockCount:l}=(0,d.useSelect)(Nr),{setNavigationMode:i,setLastFocus:a}=ie((0,d.useDispatch)(Nr)),c=(0,d.useSelect)((e=>e(Nr).isNavigationMode()),[]),{getLastFocus:m}=ie((0,d.useSelect)(Nr)),h=c?void 0:"0",g=(0,u.useRef)();function f(t){if(g.current)g.current=null;else if(o())e.current.focus();else if(r())m()?.current.focus();else{i(!0);const n=e.current.ownerDocument===t.target.ownerDocument?e.current:e.current.ownerDocument.defaultView.frameElement,o=t.target.compareDocumentPosition(n)&t.target.DOCUMENT_POSITION_FOLLOWING,r=As.focus.tabbable.find(e.current);r.length&&(o?r[0]:r[r.length-1]).focus()}}const b=(0,s.createElement)("div",{ref:t,tabIndex:h,onFocus:f}),v=(0,s.createElement)("div",{ref:n,tabIndex:h,onFocus:f}),k=(0,p.useRefEffect)((s=>{function c(e){if(e.defaultPrevented)return;if(e.keyCode===zs.ESCAPE&&!o())return e.preventDefault(),void i(!0);if(e.keyCode!==zs.TAB)return;const l=e.shiftKey,a=l?"findPrevious":"findNext";if(!o()&&!r())return void(e.target===s&&i(!0));const c=As.focus.tabbable[a](e.target),u=e.target.closest("[data-block]"),d=u&&c&&(u_(u,c)||d_(u,c));if((0,As.isFormElement)(c)&&d)return;const p=l?t:n;g.current=!0,p.current.focus({preventScroll:!0})}function u(e){a({...m(),current:e.target});const{ownerDocument:t}=s;e.relatedTarget||t.activeElement!==t.body||0!==l()||s.focus()}function d(o){if(o.keyCode!==zs.TAB)return;if("region"===o.target?.getAttribute("role"))return;if(e.current===o.target)return;const r=o.shiftKey?"findPrevious":"findNext",l=As.focus.tabbable[r](o.target);l!==t.current&&l!==n.current||(o.preventDefault(),l.focus({preventScroll:!0}))}const{ownerDocument:p}=s,{defaultView:h}=p;return h.addEventListener("keydown",d),s.addEventListener("keydown",c),s.addEventListener("focusout",u),()=>{h.removeEventListener("keydown",d),s.removeEventListener("keydown",c),s.removeEventListener("focusout",u)}}),[]);return[b,(0,p.useMergeRefs)([e,k]),v]}(),o=(0,d.useSelect)((e=>e(Nr).hasMultiSelection()),[]);return[e,(0,p.useMergeRefs)([t,ly(),J_(),Z_(),X_(),Q_(),U_(),W_(),j_(),(0,p.useRefEffect)((e=>{if(e.tabIndex=0,o)return e.classList.add("has-multi-selection"),e.setAttribute("aria-label",(0,x.__)("Multiple selected blocks")),()=>{e.classList.remove("has-multi-selection"),e.removeAttribute("aria-label")}}),[o])]),n]}const sy=(0,u.forwardRef)((function({children:e,...t},n){const[o,r,l]=iy();return(0,s.createElement)(s.Fragment,null,o,(0,s.createElement)("div",{...t,ref:(0,p.useMergeRefs)([r,n]),className:ml()(t.className,"block-editor-writing-flow")},e),l)}));let ay=null;function cy(e,t,n){const o={};for(const t in e)o[t]=e[t];if(e instanceof n.contentDocument.defaultView.MouseEvent){const e=n.getBoundingClientRect();o.clientX+=e.left,o.clientY+=e.top}const r=new t(e.type,o);o.defaultPrevented&&r.preventDefault();!n.dispatchEvent(r)&&e.preventDefault()}function uy(e){return(0,p.useRefEffect)((()=>{const{defaultView:t}=e;if(!t)return;const{frameElement:n}=t,o=e.documentElement,r=["dragover","mousemove"],l={};for(const e of r)l[e]=e=>{const t=Object.getPrototypeOf(e).constructor.name;cy(e,window[t],n)},o.addEventListener(e,l[e]);return()=>{for(const e of r)o.removeEventListener(e,l[e])}}))}function dy({contentRef:e,children:t,tabIndex:n=0,scale:o=1,frameSize:r=0,expand:l=!1,readonly:i,forwardedRef:a,...c}){const{resolvedAssets:m,isPreviewMode:h}=(0,d.useSelect)((e=>{const t=e(Nr).getSettings();return{resolvedAssets:t.__unstableResolvedAssets,isPreviewMode:t.__unstableIsPreviewMode}}),[]),{styles:g="",scripts:f=""}=m,[b,v]=(0,u.useState)(),[k,_]=(0,u.useState)([]),y=F_(),[E,w,S]=iy(),[C,{height:B}]=(0,p.useResizeObserver)(),I=(0,p.useRefEffect)((e=>{let t;function n(e){e.preventDefault()}function o(){const{contentDocument:o,ownerDocument:r}=e,{documentElement:l}=o;t=o,y(l),_(Array.from(r.body.classList).filter((e=>e.startsWith("admin-color-")||e.startsWith("post-type-")||"wp-embed-responsive"===e))),o.dir=r.dir;for(const e of ay||(ay=Array.from(document.styleSheets).reduce(((e,t)=>{try{t.cssRules}catch(t){return e}const{ownerNode:n,cssRules:o}=t;if(null===n)return e;if(!o)return e;if("wp-reset-editor-styles-css"===n.id)return e;if(!n.id)return e;if(function e(t){return Array.from(t).find((({selectorText:t,conditionText:n,cssRules:o})=>n?e(o):t&&(t.includes(".editor-styles-wrapper")||t.includes(".wp-block"))))}(o)){const t="STYLE"===n.tagName;if(t){const t=n.id.replace("-inline-css","-css"),o=document.getElementById(t);o&&e.push(o.cloneNode(!0))}if(e.push(n.cloneNode(!0)),!t){const t=n.id.replace("-css","-inline-css"),o=document.getElementById(t);o&&e.push(o.cloneNode(!0))}}return e}),[]),ay))o.getElementById(e.id)||(o.head.appendChild(e.cloneNode(!0)),h||console.warn(`${e.id} was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.`,e));t.addEventListener("dragover",n,!1),t.addEventListener("drop",n,!1)}return e._load=()=>{v(e.contentDocument)},e.addEventListener("load",o),()=>{delete e._load,e.removeEventListener("load",o),t?.removeEventListener("dragover",n),t?.removeEventListener("drop",n)}}),[]),T=(0,p.useDisabled)({isDisabled:!i}),M=(0,p.useMergeRefs)([uy(b),e,y,w,T]),P=`\n\n\t\n\t\t\n\t\t