this["wp"] = this["wp"] || {}; this["wp"]["blockEditor"] = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = "tr0p"); /******/ }) /************************************************************************/ /******/ ({ /***/ "+0ps": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, "c", function() { return /* binding */ useNotifyCopy; }); __webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ useClipboardHandler; }); // EXTERNAL MODULE: external ["wp","element"] var external_wp_element_ = __webpack_require__("GRId"); // EXTERNAL MODULE: external ["wp","blocks"] var external_wp_blocks_ = __webpack_require__("HSyU"); // EXTERNAL MODULE: external ["wp","dom"] var external_wp_dom_ = __webpack_require__("1CF3"); // EXTERNAL MODULE: external ["wp","data"] var external_wp_data_ = __webpack_require__("1ZqX"); // EXTERNAL MODULE: external ["wp","i18n"] var external_wp_i18n_ = __webpack_require__("l3Sj"); // EXTERNAL MODULE: external ["wp","notices"] var external_wp_notices_ = __webpack_require__("onLe"); // EXTERNAL MODULE: external ["wp","compose"] var external_wp_compose_ = __webpack_require__("K9lf"); // EXTERNAL MODULE: external ["wp","blob"] var external_wp_blob_ = __webpack_require__("xTGt"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/get-paste-event-data.js /** * WordPress dependencies */ function getPasteEventData({ clipboardData }) { let plainText = ''; let html = ''; // IE11 only supports `Text` as an argument for `getData` and will // otherwise throw an invalid argument error, so we try the standard // arguments first, then fallback to `Text` if they fail. try { plainText = clipboardData.getData('text/plain'); html = clipboardData.getData('text/html'); } catch (error1) { try { html = clipboardData.getData('Text'); } catch (error2) { // Some browsers like UC Browser paste plain text by default and // don't support clipboardData at all, so allow default // behaviour. return; } } const files = Object(external_wp_dom_["getFilesFromDataTransfer"])(clipboardData).filter(({ type }) => /^image\/(?:jpe?g|png|gif)$/.test(type)); // Only process files if no HTML is present. // A pasted file may have the URL as plain text. if (files.length && !html) { html = files.map(file => ``).join(''); plainText = ''; } return { html, plainText }; } // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/store/index.js + 4 modules var store = __webpack_require__("BhPs"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/copy-handler/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function useNotifyCopy() { const { getBlockName } = Object(external_wp_data_["useSelect"])(store["a" /* store */]); const { getBlockType } = Object(external_wp_data_["useSelect"])(external_wp_blocks_["store"]); const { createSuccessNotice } = Object(external_wp_data_["useDispatch"])(external_wp_notices_["store"]); return Object(external_wp_element_["useCallback"])((eventType, selectedBlockClientIds) => { let notice = ''; if (selectedBlockClientIds.length === 1) { var _getBlockType; const clientId = selectedBlockClientIds[0]; const title = (_getBlockType = getBlockType(getBlockName(clientId))) === null || _getBlockType === void 0 ? void 0 : _getBlockType.title; notice = eventType === 'copy' ? Object(external_wp_i18n_["sprintf"])( // Translators: Name of the block being copied, e.g. "Paragraph". Object(external_wp_i18n_["__"])('Copied "%s" to clipboard.'), title) : Object(external_wp_i18n_["sprintf"])( // Translators: Name of the block being cut, e.g. "Paragraph". Object(external_wp_i18n_["__"])('Moved "%s" to clipboard.'), title); } else { notice = eventType === 'copy' ? Object(external_wp_i18n_["sprintf"])( // Translators: %d: Number of blocks being copied. Object(external_wp_i18n_["_n"])('Copied %d block to clipboard.', 'Copied %d blocks to clipboard.', selectedBlockClientIds.length), selectedBlockClientIds.length) : Object(external_wp_i18n_["sprintf"])( // Translators: %d: Number of blocks being cut. Object(external_wp_i18n_["_n"])('Moved %d block to clipboard.', 'Moved %d blocks to clipboard.', selectedBlockClientIds.length), selectedBlockClientIds.length); } createSuccessNotice(notice, { type: 'snackbar' }); }, []); } function useClipboardHandler() { const { getBlocksByClientId, getSelectedBlockClientIds, hasMultiSelection, getSettings } = Object(external_wp_data_["useSelect"])(store["a" /* store */]); const { flashBlock, removeBlocks, replaceBlocks } = Object(external_wp_data_["useDispatch"])(store["a" /* store */]); const notifyCopy = useNotifyCopy(); return Object(external_wp_compose_["useRefEffect"])(node => { function handler(event) { const selectedBlockClientIds = getSelectedBlockClientIds(); if (selectedBlockClientIds.length === 0) { return; } // Always handle multiple selected blocks. if (!hasMultiSelection()) { const { target } = event; const { ownerDocument } = 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' ? Object(external_wp_dom_["documentHasUncollapsedSelection"])(ownerDocument) : Object(external_wp_dom_["documentHasSelection"])(ownerDocument); // Let native copy behaviour take over in input fields. if (hasSelection) { return; } } if (!node.contains(event.target.ownerDocument.activeElement)) { return; } const eventDefaultPrevented = event.defaultPrevented; event.preventDefault(); if (event.type === 'copy' || event.type === 'cut') { if (selectedBlockClientIds.length === 1) { flashBlock(selectedBlockClientIds[0]); } notifyCopy(event.type, selectedBlockClientIds); const blocks = getBlocksByClientId(selectedBlockClientIds); const serialized = Object(external_wp_blocks_["serialize"])(blocks); event.clipboardData.setData('text/plain', serialized); event.clipboardData.setData('text/html', serialized); } if (event.type === 'cut') { removeBlocks(selectedBlockClientIds); } else if (event.type === 'paste') { if (eventDefaultPrevented) { // This was likely already handled in rich-text/use-paste-handler.js return; } const { __experimentalCanUserUseUnfilteredHTML: canUserUseUnfilteredHTML } = getSettings(); const { plainText, html } = getPasteEventData(event); const blocks = Object(external_wp_blocks_["pasteHandler"])({ HTML: html, plainText, mode: 'BLOCKS', canUserUseUnfilteredHTML }); replaceBlocks(selectedBlockClientIds, blocks, blocks.length - 1, -1); } } node.ownerDocument.addEventListener('copy', handler); node.ownerDocument.addEventListener('cut', handler); node.ownerDocument.addEventListener('paste', handler); return () => { node.ownerDocument.removeEventListener('copy', handler); node.ownerDocument.removeEventListener('cut', handler); node.ownerDocument.removeEventListener('paste', handler); }; }, []); } function CopyHandler({ children }) { return Object(external_wp_element_["createElement"])("div", { ref: useClipboardHandler() }, children); } /* harmony default export */ var copy_handler = __webpack_exports__["a"] = (CopyHandler); /***/ }), /***/ "+6d5": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useBlockMovingModeClassNames; }); /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("TSYQ"); /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("1ZqX"); /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("BhPs"); /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Returns the class names used for block moving mode. * * @param {string} clientId The block client ID to insert above. * * @return {string} The class names. */ function useBlockMovingModeClassNames(clientId) { return Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__["useSelect"])(select => { const { hasBlockMovingClientId, canInsertBlockType, getBlockName, getBlockRootClientId, isBlockSelected } = select(_store__WEBPACK_IMPORTED_MODULE_2__[/* store */ "a"]); // The classes are only relevant for the selected block. Avoid // re-rendering all blocks! if (!isBlockSelected(clientId)) { return; } const movingClientId = hasBlockMovingClientId(); if (!movingClientId) { return; } return classnames__WEBPACK_IMPORTED_MODULE_0___default()('is-block-moving-mode', { 'can-insert-moving-block': canInsertBlockType(getBlockName(movingClientId), getBlockRootClientId(clientId)) }); }, [clientId]); } /***/ }), /***/ "+DUQ": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export a */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "animated", function() { return animated; }); /* harmony import */ var _react_spring_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("kmrn"); /* harmony reexport (checked) */ if(__webpack_require__.o(_react_spring_core__WEBPACK_IMPORTED_MODULE_0__, "useSpring")) __webpack_require__.d(__webpack_exports__, "useSpring", function() { return _react_spring_core__WEBPACK_IMPORTED_MODULE_0__["useSpring"]; }); /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("faye"); /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _react_spring_shared__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("nEW0"); /* harmony import */ var _react_spring_animated__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("dfZa"); function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } const _excluded$2 = ["style", "children", "scrollTop", "scrollLeft"]; const isCustomPropRE = /^--/; function dangerousStyleValue(name, value) { if (value == null || typeof value === 'boolean' || value === '') return ''; if (typeof value === 'number' && value !== 0 && !isCustomPropRE.test(name) && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) return value + 'px'; return ('' + value).trim(); } const attributeCache = {}; function applyAnimatedValues(instance, props) { if (!instance.nodeType || !instance.setAttribute) { return false; } const isFilterElement = instance.nodeName === 'filter' || instance.parentNode && instance.parentNode.nodeName === 'filter'; const _ref = props, { style, children, scrollTop, scrollLeft } = _ref, attributes = _objectWithoutPropertiesLoose(_ref, _excluded$2); const values = Object.values(attributes); const names = Object.keys(attributes).map(name => isFilterElement || instance.hasAttribute(name) ? name : attributeCache[name] || (attributeCache[name] = name.replace(/([A-Z])/g, n => '-' + n.toLowerCase()))); if (children !== void 0) { instance.textContent = children; } for (let name in style) { if (style.hasOwnProperty(name)) { const value = dangerousStyleValue(name, style[name]); if (isCustomPropRE.test(name)) { instance.style.setProperty(name, value); } else { instance.style[name] = value; } } } names.forEach((name, i) => { instance.setAttribute(name, values[i]); }); if (scrollTop !== void 0) { instance.scrollTop = scrollTop; } if (scrollLeft !== void 0) { instance.scrollLeft = scrollLeft; } } let isUnitlessNumber = { animationIterationCount: true, borderImageOutset: true, borderImageSlice: true, borderImageWidth: true, boxFlex: true, boxFlexGroup: true, boxOrdinalGroup: true, columnCount: true, columns: true, flex: true, flexGrow: true, flexPositive: true, flexShrink: true, flexNegative: true, flexOrder: true, gridRow: true, gridRowEnd: true, gridRowSpan: true, gridRowStart: true, gridColumn: true, gridColumnEnd: true, gridColumnSpan: true, gridColumnStart: true, fontWeight: true, lineClamp: true, lineHeight: true, opacity: true, order: true, orphans: true, tabSize: true, widows: true, zIndex: true, zoom: true, fillOpacity: true, floodOpacity: true, stopOpacity: true, strokeDasharray: true, strokeDashoffset: true, strokeMiterlimit: true, strokeOpacity: true, strokeWidth: true }; const prefixKey = (prefix, key) => prefix + key.charAt(0).toUpperCase() + key.substring(1); const prefixes = ['Webkit', 'Ms', 'Moz', 'O']; isUnitlessNumber = Object.keys(isUnitlessNumber).reduce((acc, prop) => { prefixes.forEach(prefix => acc[prefixKey(prefix, prop)] = acc[prop]); return acc; }, isUnitlessNumber); const _excluded$1 = ["x", "y", "z"]; const domTransforms = /^(matrix|translate|scale|rotate|skew)/; const pxTransforms = /^(translate)/; const degTransforms = /^(rotate|skew)/; const addUnit = (value, unit) => _react_spring_shared__WEBPACK_IMPORTED_MODULE_2__[/* is */ "s"].num(value) && value !== 0 ? value + unit : value; const isValueIdentity = (value, id) => _react_spring_shared__WEBPACK_IMPORTED_MODULE_2__[/* is */ "s"].arr(value) ? value.every(v => isValueIdentity(v, id)) : _react_spring_shared__WEBPACK_IMPORTED_MODULE_2__[/* is */ "s"].num(value) ? value === id : parseFloat(value) === id; class AnimatedStyle extends _react_spring_animated__WEBPACK_IMPORTED_MODULE_3__[/* AnimatedObject */ "a"] { constructor(_ref) { let { x, y, z } = _ref, style = _objectWithoutPropertiesLoose(_ref, _excluded$1); const inputs = []; const transforms = []; if (x || y || z) { inputs.push([x || 0, y || 0, z || 0]); transforms.push(xyz => [`translate3d(${xyz.map(v => addUnit(v, 'px')).join(',')})`, isValueIdentity(xyz, 0)]); } Object(_react_spring_shared__WEBPACK_IMPORTED_MODULE_2__[/* eachProp */ "l"])(style, (value, key) => { if (key === 'transform') { inputs.push([value || '']); transforms.push(transform => [transform, transform === '']); } else if (domTransforms.test(key)) { delete style[key]; if (_react_spring_shared__WEBPACK_IMPORTED_MODULE_2__[/* is */ "s"].und(value)) return; const unit = pxTransforms.test(key) ? 'px' : degTransforms.test(key) ? 'deg' : ''; inputs.push(Object(_react_spring_shared__WEBPACK_IMPORTED_MODULE_2__[/* toArray */ "y"])(value)); transforms.push(key === 'rotate3d' ? ([x, y, z, deg]) => [`rotate3d(${x},${y},${z},${addUnit(deg, unit)})`, isValueIdentity(deg, 0)] : input => [`${key}(${input.map(v => addUnit(v, unit)).join(',')})`, isValueIdentity(input, key.startsWith('scale') ? 1 : 0)]); } }); if (inputs.length) { style.transform = new FluidTransform(inputs, transforms); } super(style); } } class FluidTransform extends _react_spring_shared__WEBPACK_IMPORTED_MODULE_2__[/* FluidValue */ "a"] { constructor(inputs, transforms) { super(); this._value = null; this.inputs = inputs; this.transforms = transforms; } get() { return this._value || (this._value = this._get()); } _get() { let transform = ''; let identity = true; Object(_react_spring_shared__WEBPACK_IMPORTED_MODULE_2__[/* each */ "k"])(this.inputs, (input, i) => { const arg1 = Object(_react_spring_shared__WEBPACK_IMPORTED_MODULE_2__[/* getFluidValue */ "q"])(input[0]); const [t, id] = this.transforms[i](_react_spring_shared__WEBPACK_IMPORTED_MODULE_2__[/* is */ "s"].arr(arg1) ? arg1 : input.map(_react_spring_shared__WEBPACK_IMPORTED_MODULE_2__[/* getFluidValue */ "q"])); transform += ' ' + t; identity = identity && id; }); return identity ? 'none' : transform; } observerAdded(count) { if (count == 1) Object(_react_spring_shared__WEBPACK_IMPORTED_MODULE_2__[/* each */ "k"])(this.inputs, input => Object(_react_spring_shared__WEBPACK_IMPORTED_MODULE_2__[/* each */ "k"])(input, value => Object(_react_spring_shared__WEBPACK_IMPORTED_MODULE_2__[/* hasFluidValue */ "r"])(value) && Object(_react_spring_shared__WEBPACK_IMPORTED_MODULE_2__[/* addFluidObserver */ "c"])(value, this))); } observerRemoved(count) { if (count == 0) Object(_react_spring_shared__WEBPACK_IMPORTED_MODULE_2__[/* each */ "k"])(this.inputs, input => Object(_react_spring_shared__WEBPACK_IMPORTED_MODULE_2__[/* each */ "k"])(input, value => Object(_react_spring_shared__WEBPACK_IMPORTED_MODULE_2__[/* hasFluidValue */ "r"])(value) && Object(_react_spring_shared__WEBPACK_IMPORTED_MODULE_2__[/* removeFluidObserver */ "x"])(value, this))); } eventObserved(event) { if (event.type == 'change') { this._value = null; } Object(_react_spring_shared__WEBPACK_IMPORTED_MODULE_2__[/* callFluidObservers */ "d"])(this, event); } } const primitives = ['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']; const _excluded = ["scrollTop", "scrollLeft"]; _react_spring_core__WEBPACK_IMPORTED_MODULE_0__["Globals"].assign({ batchedUpdates: react_dom__WEBPACK_IMPORTED_MODULE_1__["unstable_batchedUpdates"], createStringInterpolator: _react_spring_shared__WEBPACK_IMPORTED_MODULE_2__[/* createStringInterpolator */ "g"], colors: _react_spring_shared__WEBPACK_IMPORTED_MODULE_2__[/* colors */ "e"] }); const host = Object(_react_spring_animated__WEBPACK_IMPORTED_MODULE_3__[/* createHost */ "d"])(primitives, { applyAnimatedValues, createAnimatedStyle: style => new AnimatedStyle(style), getComponentProps: _ref => { let props = _objectWithoutPropertiesLoose(_ref, _excluded); return props; } }); const animated = host.animated; /***/ }), /***/ "+G0a": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("HSyU"); /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("1ZqX"); /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("GRId"); /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("BhPs"); /** * WordPress dependencies */ /** * Internal dependencies */ /** * 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. * @return {Array} Returns the block types state. (block types, categories, collections, onSelect handler) */ const useBlockTypesState = (rootClientId, onInsert) => { const { categories, collections, items } = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__["useSelect"])(select => { const { getInserterItems } = select(_store__WEBPACK_IMPORTED_MODULE_3__[/* store */ "a"]); const { getCategories, getCollections } = select(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__["store"]); return { categories: getCategories(), collections: getCollections(), items: getInserterItems(rootClientId) }; }, [rootClientId]); const onSelectItem = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__["useCallback"])(({ name, initialAttributes, innerBlocks }, shouldFocusBlock) => { const insertedBlock = Object(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__["createBlock"])(name, initialAttributes, Object(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__["createBlocksFromInnerBlocksTemplate"])(innerBlocks)); onInsert(insertedBlock, undefined, shouldFocusBlock); }, [onInsert]); return [items, categories, collections, onSelectItem]; }; /* harmony default export */ __webpack_exports__["a"] = (useBlockTypesState); /***/ }), /***/ "+WrK": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); /** * WordPress dependencies */ const symbol = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["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 */ __webpack_exports__["a"] = (symbol); /***/ }), /***/ "+gtr": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ BlockToolbar; }); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js var esm_extends = __webpack_require__("wx14"); // EXTERNAL MODULE: external ["wp","element"] var external_wp_element_ = __webpack_require__("GRId"); // EXTERNAL MODULE: ./node_modules/classnames/index.js var classnames = __webpack_require__("TSYQ"); var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); // EXTERNAL MODULE: external ["wp","data"] var external_wp_data_ = __webpack_require__("1ZqX"); // EXTERNAL MODULE: external ["wp","compose"] var external_wp_compose_ = __webpack_require__("K9lf"); // EXTERNAL MODULE: external ["wp","blocks"] var external_wp_blocks_ = __webpack_require__("HSyU"); // EXTERNAL MODULE: external ["wp","components"] var external_wp_components_ = __webpack_require__("tI+e"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-mover/index.js var block_mover = __webpack_require__("JygI"); // EXTERNAL MODULE: external ["wp","i18n"] var external_wp_i18n_ = __webpack_require__("l3Sj"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-block-display-information/index.js var use_block_display_information = __webpack_require__("wC17"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-icon/index.js var block_icon = __webpack_require__("7SSY"); // EXTERNAL MODULE: external "lodash" var external_lodash_ = __webpack_require__("YLtl"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/utils.js /** * External dependencies */ /** * WordPress dependencies */ const { clearTimeout: utils_clearTimeout, setTimeout: utils_setTimeout } = window; const DEBOUNCE_TIMEOUT = 200; /** * Hook that creates a showMover state, as well as debounced show/hide callbacks. * * @param {Object} props Component props. * @param {Object} props.ref Element reference. * @param {boolean} props.isFocused Whether the component has current focus. * @param {number} [props.debounceTimeout=250] Debounce timeout in milliseconds. * @param {Function} [props.onChange=noop] Callback function. */ function useDebouncedShowMovers({ ref, isFocused, debounceTimeout = DEBOUNCE_TIMEOUT, onChange = external_lodash_["noop"] }) { const [showMovers, setShowMovers] = Object(external_wp_element_["useState"])(false); const timeoutRef = Object(external_wp_element_["useRef"])(); const handleOnChange = nextIsFocused => { if (ref !== null && ref !== void 0 && ref.current) { setShowMovers(nextIsFocused); } onChange(nextIsFocused); }; const getIsHovered = () => { return (ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.matches(':hover'); }; const shouldHideMovers = () => { const isHovered = getIsHovered(); return !isFocused && !isHovered; }; const clearTimeoutRef = () => { const timeout = timeoutRef.current; if (timeout && utils_clearTimeout) { utils_clearTimeout(timeout); } }; const debouncedShowMovers = event => { if (event) { event.stopPropagation(); } clearTimeoutRef(); if (!showMovers) { handleOnChange(true); } }; const debouncedHideMovers = event => { if (event) { event.stopPropagation(); } clearTimeoutRef(); timeoutRef.current = utils_setTimeout(() => { if (shouldHideMovers()) { handleOnChange(false); } }, debounceTimeout); }; Object(external_wp_element_["useEffect"])(() => () => clearTimeoutRef(), []); return { showMovers, debouncedShowMovers, debouncedHideMovers }; } /** * Hook that provides a showMovers state and gesture events for DOM elements * that interact with the showMovers state. * * @param {Object} props Component props. * @param {Object} props.ref Element reference. * @param {number} [props.debounceTimeout=250] Debounce timeout in milliseconds. * @param {Function} [props.onChange=noop] Callback function. */ function useShowMoversGestures({ ref, debounceTimeout = DEBOUNCE_TIMEOUT, onChange = external_lodash_["noop"] }) { const [isFocused, setIsFocused] = Object(external_wp_element_["useState"])(false); const { showMovers, debouncedShowMovers, debouncedHideMovers } = useDebouncedShowMovers({ ref, debounceTimeout, isFocused, onChange }); const registerRef = Object(external_wp_element_["useRef"])(false); const isFocusedWithin = () => { return (ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.contains(ref.current.ownerDocument.activeElement); }; Object(external_wp_element_["useEffect"])(() => { const node = ref.current; const handleOnFocus = () => { if (isFocusedWithin()) { setIsFocused(true); debouncedShowMovers(); } }; const handleOnBlur = () => { if (!isFocusedWithin()) { setIsFocused(false); debouncedHideMovers(); } }; /** * Events are added via DOM events (vs. React synthetic events), * as the child React components swallow mouse events. */ if (node && !registerRef.current) { node.addEventListener('focus', handleOnFocus, true); node.addEventListener('blur', handleOnBlur, true); registerRef.current = true; } return () => { if (node) { node.removeEventListener('focus', handleOnFocus); node.removeEventListener('blur', handleOnBlur); } }; }, [ref, registerRef, setIsFocused, debouncedShowMovers, debouncedHideMovers]); return { showMovers, gestures: { onMouseMove: debouncedShowMovers, onMouseLeave: debouncedHideMovers } }; } // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/store/index.js + 4 modules var store = __webpack_require__("BhPs"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-parent-selector/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Block parent selector component, displaying the hierarchy of the * current block selection as a single icon to "go up" a level. * * @return {WPComponent} Parent block selector. */ function BlockParentSelector() { const { selectBlock, toggleBlockHighlight } = Object(external_wp_data_["useDispatch"])(store["a" /* store */]); const { firstParentClientId, shouldHide, hasReducedUI } = Object(external_wp_data_["useSelect"])(select => { const { getBlockName, getBlockParents, getSelectedBlockClientId, getSettings } = select(store["a" /* store */]); const { hasBlockSupport } = select(external_wp_blocks_["store"]); const selectedBlockClientId = getSelectedBlockClientId(); const parents = getBlockParents(selectedBlockClientId); const _firstParentClientId = parents[parents.length - 1]; const parentBlockName = getBlockName(_firstParentClientId); const _parentBlockType = Object(external_wp_blocks_["getBlockType"])(parentBlockName); const settings = getSettings(); return { firstParentClientId: _firstParentClientId, shouldHide: !hasBlockSupport(_parentBlockType, '__experimentalParentSelector', true), hasReducedUI: settings.hasReducedUI }; }, []); const blockInformation = Object(use_block_display_information["a" /* default */])(firstParentClientId); // Allows highlighting the parent block outline when focusing or hovering // the parent block selector within the child. const nodeRef = Object(external_wp_element_["useRef"])(); const { gestures: showMoversGestures } = useShowMoversGestures({ ref: nodeRef, onChange(isFocused) { if (isFocused && hasReducedUI) { return; } toggleBlockHighlight(firstParentClientId, isFocused); } }); if (shouldHide || firstParentClientId === undefined) { return null; } return Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({ className: "block-editor-block-parent-selector", key: firstParentClientId, ref: nodeRef }, showMoversGestures), Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { className: "block-editor-block-parent-selector__button", onClick: () => selectBlock(firstParentClientId), label: Object(external_wp_i18n_["sprintf"])( /* translators: %s: Name of the block's parent. */ Object(external_wp_i18n_["__"])('Select %s'), blockInformation.title), showTooltip: true, icon: Object(external_wp_element_["createElement"])(block_icon["a" /* default */], { icon: blockInformation.icon }) })); } // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/stack.js var stack = __webpack_require__("wzfx"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-title/index.js var block_title = __webpack_require__("f8JO"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-preview/index.js + 2 modules var block_preview = __webpack_require__("REKd"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/preview-block-popover.js /** * WordPress dependencies */ /** * Internal dependencies */ function PreviewBlockPopover({ blocks }) { return Object(external_wp_element_["createElement"])("div", { className: "block-editor-block-switcher__popover__preview__parent" }, Object(external_wp_element_["createElement"])("div", { className: "block-editor-block-switcher__popover__preview__container" }, Object(external_wp_element_["createElement"])(external_wp_components_["Popover"], { className: "block-editor-block-switcher__preview__popover", position: "bottom right", focusOnMount: false }, Object(external_wp_element_["createElement"])("div", { className: "block-editor-block-switcher__preview" }, Object(external_wp_element_["createElement"])("div", { className: "block-editor-block-switcher__preview-title" }, Object(external_wp_i18n_["__"])('Preview')), Object(external_wp_element_["createElement"])(block_preview["a" /* default */], { viewportWidth: 500, blocks: blocks }))))); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/block-transformations-menu.js /** * WordPress dependencies */ /** * Internal dependencies */ const BlockTransformationsMenu = ({ className, possibleBlockTransformations, onSelect, blocks }) => { const [hoveredTransformItemName, setHoveredTransformItemName] = Object(external_wp_element_["useState"])(); return Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], { label: Object(external_wp_i18n_["__"])('Transform to'), className: className }, hoveredTransformItemName && Object(external_wp_element_["createElement"])(PreviewBlockPopover, { blocks: Object(external_wp_blocks_["switchToBlockType"])(blocks, hoveredTransformItemName) }), possibleBlockTransformations.map(item => { const { name, icon, title, isDisabled } = item; return Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { key: name, className: Object(external_wp_blocks_["getBlockMenuDefaultClassName"])(name), onClick: event => { event.preventDefault(); onSelect(name); }, disabled: isDisabled, onMouseLeave: () => setHoveredTransformItemName(null), onMouseEnter: () => setHoveredTransformItemName(name) }, Object(external_wp_element_["createElement"])(block_icon["a" /* default */], { icon: icon, showColors: true }), title); })); }; /* harmony default export */ var block_transformations_menu = (BlockTransformationsMenu); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-styles/index.js + 1 modules var block_styles = __webpack_require__("7NR9"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/block-styles-menu.js /** * WordPress dependencies */ /** * Internal dependencies */ function BlockStylesMenu({ hoveredBlock, onSwitch }) { const { name, clientId } = hoveredBlock; const [hoveredClassName, setHoveredClassName] = Object(external_wp_element_["useState"])(); const blockType = Object(external_wp_data_["useSelect"])(select => select(external_wp_blocks_["store"]).getBlockType(name), [name]); return Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], { label: Object(external_wp_i18n_["__"])('Styles'), className: "block-editor-block-switcher__styles__menugroup" }, hoveredClassName && Object(external_wp_element_["createElement"])(PreviewBlockPopover, { blocks: blockType && blockType.example ? Object(external_wp_blocks_["getBlockFromExample"])(blockType.name, { attributes: { ...blockType.example.attributes, className: hoveredClassName }, innerBlocks: blockType.example.innerBlocks }) : Object(external_wp_blocks_["cloneBlock"])(hoveredBlock, { className: hoveredClassName }) }), Object(external_wp_element_["createElement"])(block_styles["a" /* default */], { clientId: clientId, onSwitch: onSwitch, onHoverClassName: setHoveredClassName, itemRole: "menuitem" })); } // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right.js var chevron_right = __webpack_require__("1iEr"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/utils.js /** * WordPress dependencies */ /** * Try to find a matching block by a block's name in a provided * block. We recurse through InnerBlocks and return the reference * of the matched block (it could be an InnerBlock). * If no match is found return nothing. * * @param {WPBlock} block The block to try to find a match. * @param {string} selectedBlockName The block's name to use for matching condition. * @param {Set} consumedBlocks A set holding the previously matched/consumed blocks. * * @return {WPBlock?} The matched block if found or nothing(`undefined`). */ const getMatchingBlockByName = (block, selectedBlockName, consumedBlocks = new Set()) => { const { clientId, name, innerBlocks = [] } = block; // Check if block has been consumed already. 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; } }; /** * Find and return the block attributes to retain through * the transformation, based on Block Type's `role:content` * attributes. If no `role:content` attributes exist, * return selected block's attributes. * * @param {string} name Block type's namespaced name. * @param {Object} attributes Selected block's attributes. * @return {Object} The block's attributes to retain. */ const getRetainedBlockAttributes = (name, attributes) => { const contentAttributes = Object(external_wp_blocks_["__experimentalGetBlockAttributesNamesByRole"])(name, 'content'); if (!(contentAttributes !== null && contentAttributes !== void 0 && contentAttributes.length)) return attributes; return contentAttributes.reduce((_accumulator, attribute) => { if (attributes[attribute]) _accumulator[attribute] = attributes[attribute]; return _accumulator; }, {}); }; // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/use-transformed-patterns.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Mutate the matched block's attributes by getting * which block type's attributes to retain and prioritize * them in the merging of the attributes. * * @param {WPBlock} match The matched block. * @param {WPBlock} selectedBlock The selected block. * @return {void} */ const transformMatchingBlock = (match, selectedBlock) => { // Get the block attributes to retain through the transformation. const retainedBlockAttributes = getRetainedBlockAttributes(selectedBlock.name, selectedBlock.attributes); match.attributes = { ...match.attributes, ...retainedBlockAttributes }; }; /** * By providing the selected blocks and pattern's blocks * find the matching blocks, transform them and return them. * If not all selected blocks are matched, return nothing. * * @param {WPBlock[]} selectedBlocks The selected blocks. * @param {WPBlock[]} patternBlocks The pattern's blocks. * @return {WPBlock[]|void} The transformed pattern's blocks or undefined if not all selected blocks have been matched. */ const getPatternTransformedBlocks = (selectedBlocks, patternBlocks) => { // Clone Pattern's blocks to produce new clientIds and be able to mutate the matches. const _patternBlocks = patternBlocks.map(block => Object(external_wp_blocks_["cloneBlock"])(block)); /** * Keep track of the consumed pattern blocks. * This is needed because we loop the selected blocks * and for example we may have selected two paragraphs and * the pattern's blocks could have more `paragraphs`. */ const consumedBlocks = new Set(); for (const selectedBlock of selectedBlocks) { let isMatch = false; for (const patternBlock of _patternBlocks) { const match = getMatchingBlockByName(patternBlock, selectedBlock.name, consumedBlocks); if (!match) continue; isMatch = true; consumedBlocks.add(match.clientId); // We update (mutate) the matching pattern block. transformMatchingBlock(match, selectedBlock); // No need to loop through other pattern's blocks. break; } // Bail eary if a selected block has not been matched. if (!isMatch) return; } return _patternBlocks; }; /** * @typedef {WPBlockPattern & {transformedBlocks: WPBlock[]}} TransformedBlockPattern */ /** * Custom hook that accepts patterns from state and the selected * blocks and tries to match these with the pattern's blocks. * If all selected blocks are matched with a Pattern's block, * we transform them by retaining block's attributes with `role:content`. * The transformed pattern's blocks are set to a new pattern * property `transformedBlocks`. * * @param {WPBlockPattern[]} patterns Patterns from state. * @param {WPBlock[]} selectedBlocks The currently selected blocks. * @return {TransformedBlockPattern[]} Returns the eligible matched patterns with all the selected blocks. */ // TODO tests const useTransformedPatterns = (patterns, selectedBlocks) => { return Object(external_wp_element_["useMemo"])(() => patterns.reduce((accumulator, _pattern) => { const transformedBlocks = getPatternTransformedBlocks(selectedBlocks, _pattern.blocks); if (transformedBlocks) { accumulator.push({ ..._pattern, transformedBlocks }); } return accumulator; }, []), [patterns, selectedBlocks]); }; /* harmony default export */ var use_transformed_patterns = (useTransformedPatterns); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/pattern-transformations-menu.js /** * WordPress dependencies */ /** * Internal dependencies */ function PatternTransformationsMenu({ blocks, patterns: statePatterns, onSelect }) { const [showTransforms, setShowTransforms] = Object(external_wp_element_["useState"])(false); const patterns = use_transformed_patterns(statePatterns, blocks); if (!patterns.length) return null; return Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], { className: "block-editor-block-switcher__pattern__transforms__menugroup" }, showTransforms && Object(external_wp_element_["createElement"])(PreviewPatternsPopover, { patterns: patterns, onSelect: onSelect }), Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { onClick: event => { event.preventDefault(); setShowTransforms(!showTransforms); }, icon: chevron_right["a" /* default */] }, Object(external_wp_i18n_["__"])('Patterns'))); } function PreviewPatternsPopover({ patterns, onSelect }) { return Object(external_wp_element_["createElement"])("div", { className: "block-editor-block-switcher__popover__preview__parent" }, Object(external_wp_element_["createElement"])("div", { className: "block-editor-block-switcher__popover__preview__container" }, Object(external_wp_element_["createElement"])(external_wp_components_["Popover"], { className: "block-editor-block-switcher__preview__popover", position: "bottom right" }, Object(external_wp_element_["createElement"])("div", { className: "block-editor-block-switcher__preview" }, Object(external_wp_element_["createElement"])("div", { className: "block-editor-block-switcher__preview-title" }, Object(external_wp_i18n_["__"])('Preview')), Object(external_wp_element_["createElement"])(BlockPatternsList, { patterns: patterns, onSelect: onSelect }))))); } function BlockPatternsList({ patterns, onSelect }) { const composite = Object(external_wp_components_["__unstableUseCompositeState"])(); return Object(external_wp_element_["createElement"])(external_wp_components_["__unstableComposite"], Object(esm_extends["a" /* default */])({}, composite, { role: "listbox", className: "block-editor-block-switcher__preview-patterns-container", "aria-label": Object(external_wp_i18n_["__"])('Patterns list') }), patterns.map(pattern => Object(external_wp_element_["createElement"])(BlockPattern, { key: pattern.name, pattern: pattern, onSelect: onSelect, composite: composite }))); } function BlockPattern({ pattern, onSelect, composite }) { // TODO check pattern/preview width... const baseClassName = 'block-editor-block-switcher__preview-patterns-container'; const descriptionId = Object(external_wp_compose_["useInstanceId"])(BlockPattern, `${baseClassName}-list__item-description`); return Object(external_wp_element_["createElement"])("div", { className: `${baseClassName}-list__list-item`, "aria-label": pattern.title, "aria-describedby": pattern.description ? descriptionId : undefined }, Object(external_wp_element_["createElement"])(external_wp_components_["__unstableCompositeItem"], Object(esm_extends["a" /* default */])({ role: "option", as: "div" }, composite, { className: `${baseClassName}-list__item`, onClick: () => onSelect(pattern.transformedBlocks) }), Object(external_wp_element_["createElement"])(block_preview["a" /* default */], { blocks: pattern.transformedBlocks, viewportWidth: pattern.viewportWidth || 500 }), Object(external_wp_element_["createElement"])("div", { className: `${baseClassName}-list__item-title` }, pattern.title)), !!pattern.description && Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { id: descriptionId }, pattern.description)); } /* harmony default export */ var pattern_transformations_menu = (PatternTransformationsMenu); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const BlockSwitcherDropdownMenu = ({ clientIds, blocks }) => { const { replaceBlocks } = Object(external_wp_data_["useDispatch"])(store["a" /* store */]); const blockInformation = Object(use_block_display_information["a" /* default */])(blocks[0].clientId); const { possibleBlockTransformations, canRemove, hasBlockStyles, icon, blockTitle, patterns } = Object(external_wp_data_["useSelect"])(select => { var _getBlockType2; const { getBlockRootClientId, getBlockTransformItems, __experimentalGetPatternTransformItems } = select(store["a" /* store */]); const { getBlockStyles, getBlockType } = select(external_wp_blocks_["store"]); const { canRemoveBlocks } = select(store["a" /* store */]); const rootClientId = getBlockRootClientId(Object(external_lodash_["castArray"])(clientIds)[0]); const [{ name: firstBlockName }] = blocks; const _isSingleBlockSelected = blocks.length === 1; const styles = _isSingleBlockSelected && getBlockStyles(firstBlockName); let _icon; if (_isSingleBlockSelected) { _icon = blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.icon; // Take into account active block variations. } else { var _getBlockType; const isSelectionOfSameType = Object(external_lodash_["uniq"])(blocks.map(({ name }) => name)).length === 1; // When selection consists of blocks of multiple types, display an // appropriate icon to communicate the non-uniformity. _icon = isSelectionOfSameType ? (_getBlockType = getBlockType(firstBlockName)) === null || _getBlockType === void 0 ? void 0 : _getBlockType.icon : stack["a" /* default */]; } return { possibleBlockTransformations: getBlockTransformItems(blocks, rootClientId), canRemove: canRemoveBlocks(clientIds, rootClientId), hasBlockStyles: !!(styles !== null && styles !== void 0 && styles.length), icon: _icon, blockTitle: (_getBlockType2 = getBlockType(firstBlockName)) === null || _getBlockType2 === void 0 ? void 0 : _getBlockType2.title, patterns: __experimentalGetPatternTransformItems(blocks, rootClientId) }; }, [clientIds, blocks, blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.icon]); const isReusable = blocks.length === 1 && Object(external_wp_blocks_["isReusableBlock"])(blocks[0]); const isTemplate = blocks.length === 1 && Object(external_wp_blocks_["isTemplatePart"])(blocks[0]); // Simple block tranformation based on the `Block Transforms` API. const onBlockTransform = name => replaceBlocks(clientIds, Object(external_wp_blocks_["switchToBlockType"])(blocks, name)); // Pattern transformation through the `Patterns` API. const onPatternTransform = transformedBlocks => replaceBlocks(clientIds, transformedBlocks); const hasPossibleBlockTransformations = !!possibleBlockTransformations.length && canRemove; const hasPatternTransformation = !!(patterns !== null && patterns !== void 0 && patterns.length) && canRemove; if (!hasBlockStyles && !hasPossibleBlockTransformations) { return Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { disabled: true, className: "block-editor-block-switcher__no-switcher-icon", title: blockTitle, icon: Object(external_wp_element_["createElement"])(block_icon["a" /* default */], { icon: icon, showColors: true }) })); } const blockSwitcherLabel = blockTitle; const blockSwitcherDescription = 1 === blocks.length ? Object(external_wp_i18n_["sprintf"])( /* translators: %s: block title. */ Object(external_wp_i18n_["__"])('%s: Change block type or style'), blockTitle) : Object(external_wp_i18n_["sprintf"])( /* translators: %d: number of blocks. */ Object(external_wp_i18n_["_n"])('Change type of %d block', 'Change type of %d blocks', blocks.length), blocks.length); const showDropDown = hasBlockStyles || hasPossibleBlockTransformations || hasPatternTransformation; return Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarItem"], null, toggleProps => Object(external_wp_element_["createElement"])(external_wp_components_["DropdownMenu"], { className: "block-editor-block-switcher", label: blockSwitcherLabel, popoverProps: { position: 'bottom right', isAlternate: true, className: 'block-editor-block-switcher__popover' }, icon: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(block_icon["a" /* default */], { icon: icon, className: "block-editor-block-switcher__toggle", showColors: true }), (isReusable || isTemplate) && Object(external_wp_element_["createElement"])("span", { className: "block-editor-block-switcher__toggle-text" }, Object(external_wp_element_["createElement"])(block_title["a" /* default */], { clientId: clientIds }))), toggleProps: { describedBy: blockSwitcherDescription, ...toggleProps }, menuProps: { orientation: 'both' } }, ({ onClose }) => showDropDown && Object(external_wp_element_["createElement"])("div", { className: "block-editor-block-switcher__container" }, hasPatternTransformation && Object(external_wp_element_["createElement"])(pattern_transformations_menu, { blocks: blocks, patterns: patterns, onSelect: transformedBlocks => { onPatternTransform(transformedBlocks); onClose(); } }), hasPossibleBlockTransformations && Object(external_wp_element_["createElement"])(block_transformations_menu, { className: "block-editor-block-switcher__transforms__menugroup", possibleBlockTransformations: possibleBlockTransformations, blocks: blocks, onSelect: name => { onBlockTransform(name); onClose(); } }), hasBlockStyles && Object(external_wp_element_["createElement"])(BlockStylesMenu, { hoveredBlock: blocks[0], onSwitch: onClose }))))); }; const BlockSwitcher = ({ clientIds }) => { const blocks = Object(external_wp_data_["useSelect"])(select => select(store["a" /* store */]).getBlocksByClientId(clientIds), [clientIds]); if (!blocks.length || blocks.some(block => !block)) { return null; } return Object(external_wp_element_["createElement"])(BlockSwitcherDropdownMenu, { clientIds: clientIds, blocks: blocks }); }; /* harmony default export */ var block_switcher = (BlockSwitcher); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-controls/index.js + 4 modules var block_controls = __webpack_require__("fOYa"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/index.js var block_settings_menu = __webpack_require__("U1WI"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function BlockToolbar({ hideDragHandle }) { const { blockClientIds, blockClientId, blockType, hasFixedToolbar, hasReducedUI, isValid, isVisual } = Object(external_wp_data_["useSelect"])(select => { const { getBlockName, getBlockMode, getSelectedBlockClientIds, isBlockValid, getBlockRootClientId, getSettings } = select(store["a" /* store */]); const selectedBlockClientIds = getSelectedBlockClientIds(); const selectedBlockClientId = selectedBlockClientIds[0]; const blockRootClientId = getBlockRootClientId(selectedBlockClientId); const settings = getSettings(); return { blockClientIds: selectedBlockClientIds, blockClientId: selectedBlockClientId, blockType: selectedBlockClientId && Object(external_wp_blocks_["getBlockType"])(getBlockName(selectedBlockClientId)), hasFixedToolbar: settings.hasFixedToolbar, hasReducedUI: settings.hasReducedUI, rootClientId: blockRootClientId, isValid: selectedBlockClientIds.every(id => isBlockValid(id)), isVisual: selectedBlockClientIds.every(id => getBlockMode(id) === 'visual') }; }, []); // Handles highlighting the current block outline on hover or focus of the // block type toolbar area. const { toggleBlockHighlight } = Object(external_wp_data_["useDispatch"])(store["a" /* store */]); const nodeRef = Object(external_wp_element_["useRef"])(); const { showMovers, gestures: showMoversGestures } = useShowMoversGestures({ ref: nodeRef, onChange(isFocused) { if (isFocused && hasReducedUI) { return; } toggleBlockHighlight(blockClientId, isFocused); } }); // Account for the cases where the block toolbar is rendered within the // header area and not contextually to the block. const displayHeaderToolbar = Object(external_wp_compose_["useViewportMatch"])('medium', '<') || hasFixedToolbar; if (blockType) { if (!Object(external_wp_blocks_["hasBlockSupport"])(blockType, '__experimentalToolbar', true)) { return null; } } const shouldShowMovers = displayHeaderToolbar || showMovers; if (blockClientIds.length === 0) { return null; } const shouldShowVisualToolbar = isValid && isVisual; const isMultiToolbar = blockClientIds.length > 1; const classes = classnames_default()('block-editor-block-toolbar', shouldShowMovers && 'is-showing-movers'); return Object(external_wp_element_["createElement"])("div", { className: classes }, !isMultiToolbar && !displayHeaderToolbar && Object(external_wp_element_["createElement"])(BlockParentSelector, { clientIds: blockClientIds }), Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({ ref: nodeRef }, showMoversGestures), (shouldShowVisualToolbar || isMultiToolbar) && Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], { className: "block-editor-block-toolbar__block-controls" }, Object(external_wp_element_["createElement"])(block_switcher, { clientIds: blockClientIds }), Object(external_wp_element_["createElement"])(block_mover["a" /* default */], { clientIds: blockClientIds, hideDragHandle: hideDragHandle || hasReducedUI }))), shouldShowVisualToolbar && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(block_controls["b" /* default */].Slot, { group: "parent", className: "block-editor-block-toolbar__slot" }), Object(external_wp_element_["createElement"])(block_controls["b" /* default */].Slot, { group: "block", className: "block-editor-block-toolbar__slot" }), Object(external_wp_element_["createElement"])(block_controls["b" /* default */].Slot, { className: "block-editor-block-toolbar__slot" }), Object(external_wp_element_["createElement"])(block_controls["b" /* default */].Slot, { group: "inline", className: "block-editor-block-toolbar__slot" }), Object(external_wp_element_["createElement"])(block_controls["b" /* default */].Slot, { group: "other", className: "block-editor-block-toolbar__slot" })), Object(external_wp_element_["createElement"])(block_settings_menu["a" /* default */], { clientIds: blockClientIds })); } /***/ }), /***/ "//Lo": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); /** * WordPress dependencies */ const blockDefault = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["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 */ __webpack_exports__["a"] = (blockDefault); /***/ }), /***/ "/Hvg": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ TextTransformControl; }); // EXTERNAL MODULE: external ["wp","element"] var external_wp_element_ = __webpack_require__("GRId"); // EXTERNAL MODULE: external ["wp","components"] var external_wp_components_ = __webpack_require__("tI+e"); // EXTERNAL MODULE: external ["wp","i18n"] var external_wp_i18n_ = __webpack_require__("l3Sj"); // EXTERNAL MODULE: external ["wp","primitives"] var external_wp_primitives_ = __webpack_require__("Tqx9"); // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-uppercase.js /** * WordPress dependencies */ const formatUppercase = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" }, Object(external_wp_element_["createElement"])(external_wp_primitives_["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 */ var format_uppercase = (formatUppercase); // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-lowercase.js /** * WordPress dependencies */ const formatLowercase = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" }, Object(external_wp_element_["createElement"])(external_wp_primitives_["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 */ var format_lowercase = (formatLowercase); // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-capitalize.js /** * WordPress dependencies */ const formatCapitalize = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" }, Object(external_wp_element_["createElement"])(external_wp_primitives_["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 */ var format_capitalize = (formatCapitalize); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/text-transform-control/index.js /** * WordPress dependencies */ const TEXT_TRANSFORMS = [{ name: Object(external_wp_i18n_["__"])('Uppercase'), value: 'uppercase', icon: format_uppercase }, { name: Object(external_wp_i18n_["__"])('Lowercase'), value: 'lowercase', icon: format_lowercase }, { name: Object(external_wp_i18n_["__"])('Capitalize'), value: 'capitalize', icon: format_capitalize }]; /** * Control to facilitate text transform selections. * * @param {Object} props Component props. * @param {string} props.value Currently selected text transform. * @param {Function} props.onChange Handles change in text transform selection. * * @return {WPElement} Text transform control. */ function TextTransformControl({ value, onChange }) { return Object(external_wp_element_["createElement"])("fieldset", { className: "block-editor-text-transform-control" }, Object(external_wp_element_["createElement"])("legend", null, Object(external_wp_i18n_["__"])('Letter case')), Object(external_wp_element_["createElement"])("div", { className: "block-editor-text-transform-control__buttons" }, TEXT_TRANSFORMS.map(textTransform => { return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { key: textTransform.value, icon: textTransform.icon, isSmall: true, isPressed: value === textTransform.value, "aria-label": textTransform.name, onClick: () => onChange(value === textTransform.value ? undefined : textTransform.value) }); }))); } /***/ }), /***/ "/QNa": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // EXTERNAL MODULE: external ["wp","element"] var external_wp_element_ = __webpack_require__("GRId"); // EXTERNAL MODULE: external ["wp","data"] var external_wp_data_ = __webpack_require__("1ZqX"); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js var esm_extends = __webpack_require__("wx14"); // EXTERNAL MODULE: external ["wp","compose"] var external_wp_compose_ = __webpack_require__("K9lf"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/store/index.js + 4 modules var store = __webpack_require__("BhPs"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/store/constants.js var constants = __webpack_require__("AHN3"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/provider/with-registry-provider.js /** * WordPress dependencies */ /** * Internal dependencies */ const withRegistryProvider = Object(external_wp_compose_["createHigherOrderComponent"])(WrappedComponent => { return Object(external_wp_data_["withRegistry"])(({ useSubRegistry = true, registry, ...props }) => { if (!useSubRegistry) { return Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({ registry: registry }, props)); } const [subRegistry, setSubRegistry] = Object(external_wp_element_["useState"])(null); Object(external_wp_element_["useEffect"])(() => { const newRegistry = Object(external_wp_data_["createRegistry"])({}, registry); newRegistry.registerStore(constants["a" /* STORE_NAME */], store["b" /* storeConfig */]); setSubRegistry(newRegistry); }, [registry]); if (!subRegistry) { return null; } return Object(external_wp_element_["createElement"])(external_wp_data_["RegistryProvider"], { value: subRegistry }, Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({ registry: subRegistry }, props))); }); }, 'withRegistryProvider'); /* harmony default export */ var with_registry_provider = (withRegistryProvider); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/provider/use-block-sync.js var use_block_sync = __webpack_require__("JGYp"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/provider/block-refs-provider.js var block_refs_provider = __webpack_require__("cDhi"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/provider/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** @typedef {import('@wordpress/data').WPDataRegistry} WPDataRegistry */ function BlockEditorProvider(props) { const { children, settings } = props; const { updateSettings } = Object(external_wp_data_["useDispatch"])(store["a" /* store */]); Object(external_wp_element_["useEffect"])(() => { updateSettings(settings); }, [settings]); // Syncs the entity provider with changes in the block-editor store. Object(use_block_sync["a" /* default */])(props); return Object(external_wp_element_["createElement"])(block_refs_provider["b" /* BlockRefsProvider */], null, children); } /* harmony default export */ var provider = __webpack_exports__["a"] = (with_registry_provider(BlockEditorProvider)); /***/ }), /***/ "/lNF": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export parseDropEvent */ /* unused harmony export onBlockDrop */ /* unused harmony export onFilesDrop */ /* unused harmony export onHTMLDrop */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useOnBlockDrop; }); /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("HSyU"); /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("1ZqX"); /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _wordpress_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("1CF3"); /* harmony import */ var _wordpress_dom__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_dom__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("BhPs"); /** * WordPress dependencies */ /** * Internal dependencies */ /** @typedef {import('@wordpress/element').WPSyntheticEvent} WPSyntheticEvent */ /** * Retrieve the data for a block drop event. * * @param {WPSyntheticEvent} event The drop event. * * @return {Object} An object with block drag and drop data. */ function parseDropEvent(event) { let result = { srcRootClientId: null, srcClientIds: null, srcIndex: null, type: null, blocks: null }; if (!event.dataTransfer) { return result; } try { result = Object.assign(result, JSON.parse(event.dataTransfer.getData('wp-blocks'))); } catch (err) { return result; } return result; } /** * A function that returns an event handler function for block drop events. * * @param {string} targetRootClientId The root client id where the block(s) will be inserted. * @param {number} targetBlockIndex The index where the block(s) will be inserted. * @param {Function} getBlockIndex A function that gets the index of a block. * @param {Function} getClientIdsOfDescendants A function that gets the client ids of descendant blocks. * @param {Function} moveBlocksToPosition A function that moves blocks. * @param {Function} insertBlocks A function that inserts blocks. * @param {Function} clearSelectedBlock A function that clears block selection. * @return {Function} The event handler for a block drop event. */ function onBlockDrop(targetRootClientId, targetBlockIndex, getBlockIndex, getClientIdsOfDescendants, moveBlocksToPosition, insertBlocks, clearSelectedBlock) { return event => { const { srcRootClientId: sourceRootClientId, srcClientIds: sourceClientIds, type: dropType, blocks } = parseDropEvent(event); // If the user is inserting a block if (dropType === 'inserter') { clearSelectedBlock(); const blocksToInsert = blocks.map(block => Object(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__["cloneBlock"])(block)); insertBlocks(blocksToInsert, targetBlockIndex, targetRootClientId, true, null); } // If the user is moving a block if (dropType === 'block') { const sourceBlockIndex = getBlockIndex(sourceClientIds[0], sourceRootClientId); // If the user is dropping to the same position, return early. if (sourceRootClientId === targetRootClientId && sourceBlockIndex === targetBlockIndex) { return; } // If the user is attempting to drop a block within its own // nested blocks, return early as this would create infinite // recursion. if (sourceClientIds.includes(targetRootClientId) || getClientIdsOfDescendants(sourceClientIds).some(id => id === targetRootClientId)) { return; } const isAtSameLevel = sourceRootClientId === targetRootClientId; const draggedBlockCount = sourceClientIds.length; // If the block is kept at the same level and moved downwards, // subtract to take into account that the blocks being dragged // were removed from the block list above the insertion point. const insertIndex = isAtSameLevel && sourceBlockIndex < targetBlockIndex ? targetBlockIndex - draggedBlockCount : targetBlockIndex; moveBlocksToPosition(sourceClientIds, sourceRootClientId, targetRootClientId, insertIndex); } }; } /** * A function that returns an event handler function for block-related file drop events. * * @param {string} targetRootClientId The root client id where the block(s) will be inserted. * @param {number} targetBlockIndex The index where the block(s) will be inserted. * @param {boolean} hasUploadPermissions Whether the user has upload permissions. * @param {Function} updateBlockAttributes A function that updates a block's attributes. * @param {Function} canInsertBlockType A function that returns checks whether a block type can be inserted. * @param {Function} insertBlocks A function that inserts blocks. * * @return {Function} The event handler for a block-related file drop event. */ function onFilesDrop(targetRootClientId, targetBlockIndex, hasUploadPermissions, updateBlockAttributes, canInsertBlockType, insertBlocks) { return files => { if (!hasUploadPermissions) { return; } const transformation = Object(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__["findTransform"])(Object(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__["getBlockTransforms"])('from'), transform => transform.type === 'files' && canInsertBlockType(transform.blockName, targetRootClientId) && transform.isMatch(files)); if (transformation) { const blocks = transformation.transform(files, updateBlockAttributes); insertBlocks(blocks, targetBlockIndex, targetRootClientId); } }; } /** * A function that returns an event handler function for block-related HTML drop events. * * @param {string} targetRootClientId The root client id where the block(s) will be inserted. * @param {number} targetBlockIndex The index where the block(s) will be inserted. * @param {Function} insertBlocks A function that inserts blocks. * * @return {Function} The event handler for a block-related HTML drop event. */ function onHTMLDrop(targetRootClientId, targetBlockIndex, insertBlocks) { return HTML => { const blocks = Object(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__["pasteHandler"])({ HTML, mode: 'BLOCKS' }); if (blocks.length) { insertBlocks(blocks, targetBlockIndex, targetRootClientId); } }; } /** * A React hook for handling block drop events. * * @param {string} targetRootClientId The root client id where the block(s) will be inserted. * @param {number} targetBlockIndex The index where the block(s) will be inserted. * * @return {Object} An object that contains the event handlers `onDrop`, `onFilesDrop` and `onHTMLDrop`. */ function useOnBlockDrop(targetRootClientId, targetBlockIndex) { const hasUploadPermissions = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__["useSelect"])(select => select(_store__WEBPACK_IMPORTED_MODULE_3__[/* store */ "a"]).getSettings().mediaUpload, []); const { canInsertBlockType, getBlockIndex, getClientIdsOfDescendants } = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__["useSelect"])(_store__WEBPACK_IMPORTED_MODULE_3__[/* store */ "a"]); const { insertBlocks, moveBlocksToPosition, updateBlockAttributes, clearSelectedBlock } = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__["useDispatch"])(_store__WEBPACK_IMPORTED_MODULE_3__[/* store */ "a"]); const _onDrop = onBlockDrop(targetRootClientId, targetBlockIndex, getBlockIndex, getClientIdsOfDescendants, moveBlocksToPosition, insertBlocks, clearSelectedBlock); const _onFilesDrop = onFilesDrop(targetRootClientId, targetBlockIndex, hasUploadPermissions, updateBlockAttributes, canInsertBlockType, insertBlocks); const _onHTMLDrop = onHTMLDrop(targetRootClientId, targetBlockIndex, insertBlocks); return event => { const files = Object(_wordpress_dom__WEBPACK_IMPORTED_MODULE_2__["getFilesFromDataTransfer"])(event.dataTransfer); const html = event.dataTransfer.getData('text/html'); if (files.length) { _onFilesDrop(files); } else if (html) { _onHTMLDrop(html); } else { _onDrop(event); } }; } /***/ }), /***/ "0E5u": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ JustifyContentControl; }); __webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ JustifyToolbar; }); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js var esm_extends = __webpack_require__("wx14"); // EXTERNAL MODULE: external ["wp","element"] var external_wp_element_ = __webpack_require__("GRId"); // EXTERNAL MODULE: external ["wp","components"] var external_wp_components_ = __webpack_require__("tI+e"); // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/justify-left.js var justify_left = __webpack_require__("kWXm"); // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/justify-center.js var justify_center = __webpack_require__("DmX/"); // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/justify-right.js var justify_right = __webpack_require__("suLj"); // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/justify-space-between.js var justify_space_between = __webpack_require__("bTSr"); // EXTERNAL MODULE: external ["wp","i18n"] var external_wp_i18n_ = __webpack_require__("l3Sj"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/justify-content-control/ui.js /** * WordPress dependencies */ const icons = { left: justify_left["a" /* default */], center: justify_center["a" /* default */], right: justify_right["a" /* default */], 'space-between': justify_space_between["a" /* default */] }; function JustifyContentUI({ allowedControls = ['left', 'center', 'right', 'space-between'], isCollapsed = true, onChange, value, popoverProps, isToolbar }) { // If the control is already selected we want a click // again on the control to deselect the item, so we // call onChange( undefined ) const handleClick = next => { if (next === value) { onChange(undefined); } else { onChange(next); } }; const icon = value ? icons[value] : icons.left; const allControls = [{ name: 'left', icon: justify_left["a" /* default */], title: Object(external_wp_i18n_["__"])('Justify items left'), isActive: 'left' === value, onClick: () => handleClick('left') }, { name: 'center', icon: justify_center["a" /* default */], title: Object(external_wp_i18n_["__"])('Justify items center'), isActive: 'center' === value, onClick: () => handleClick('center') }, { name: 'right', icon: justify_right["a" /* default */], title: Object(external_wp_i18n_["__"])('Justify items right'), isActive: 'right' === value, onClick: () => handleClick('right') }, { name: 'space-between', icon: justify_space_between["a" /* default */], title: Object(external_wp_i18n_["__"])('Space between items'), isActive: 'space-between' === value, onClick: () => handleClick('space-between') }]; const UIComponent = isToolbar ? external_wp_components_["ToolbarGroup"] : external_wp_components_["ToolbarDropdownMenu"]; const extraProps = isToolbar ? { isCollapsed } : {}; return Object(external_wp_element_["createElement"])(UIComponent, Object(esm_extends["a" /* default */])({ icon: icon, popoverProps: popoverProps, label: Object(external_wp_i18n_["__"])('Change items justification'), controls: allControls.filter(elem => allowedControls.includes(elem.name)) }, extraProps)); } /* harmony default export */ var ui = (JustifyContentUI); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/justify-content-control/index.js /** * Internal dependencies */ function JustifyContentControl(props) { return Object(external_wp_element_["createElement"])(ui, Object(esm_extends["a" /* default */])({}, props, { isToolbar: false })); } function JustifyToolbar(props) { return Object(external_wp_element_["createElement"])(ui, Object(esm_extends["a" /* default */])({}, props, { isToolbar: true })); } /***/ }), /***/ "14PQ": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, "gc", function() { return /* reexport */ components_colors["b" /* getColorClassName */]; }); __webpack_require__.d(__webpack_exports__, "hc", function() { return /* reexport */ components_colors["c" /* getColorObjectByAttributeValues */]; }); __webpack_require__.d(__webpack_exports__, "ic", function() { return /* reexport */ components_colors["d" /* getColorObjectByColorValue */]; }); __webpack_require__.d(__webpack_exports__, "fc", function() { return /* reexport */ components_colors["a" /* createCustomColorsHOC */]; }); __webpack_require__.d(__webpack_exports__, "uc", function() { return /* reexport */ components_colors["e" /* withColors */]; }); __webpack_require__.d(__webpack_exports__, "xb", function() { return /* reexport */ gradients["a" /* __experimentalGetGradientClass */]; }); __webpack_require__.d(__webpack_exports__, "nc", function() { return /* reexport */ gradients["e" /* getGradientValueBySlug */]; }); __webpack_require__.d(__webpack_exports__, "yb", function() { return /* reexport */ gradients["b" /* __experimentalGetGradientObjectByGradientValue */]; }); __webpack_require__.d(__webpack_exports__, "mc", function() { return /* reexport */ gradients["d" /* getGradientSlugByValue */]; }); __webpack_require__.d(__webpack_exports__, "Rb", function() { return /* reexport */ gradients["c" /* __experimentalUseGradient */]; }); __webpack_require__.d(__webpack_exports__, "jc", function() { return /* reexport */ font_sizes["b" /* getFontSize */]; }); __webpack_require__.d(__webpack_exports__, "kc", function() { return /* reexport */ font_sizes["c" /* getFontSizeClass */]; }); __webpack_require__.d(__webpack_exports__, "lc", function() { return /* reexport */ font_sizes["d" /* getFontSizeObjectByValue */]; }); __webpack_require__.d(__webpack_exports__, "I", function() { return /* reexport */ font_sizes["a" /* FontSizePicker */]; }); __webpack_require__.d(__webpack_exports__, "vc", function() { return /* reexport */ font_sizes["e" /* withFontSizes */]; }); __webpack_require__.d(__webpack_exports__, "a", function() { return /* reexport */ AlignmentControl; }); __webpack_require__.d(__webpack_exports__, "b", function() { return /* reexport */ AlignmentToolbar; }); __webpack_require__.d(__webpack_exports__, "c", function() { return /* reexport */ autocomplete; }); __webpack_require__.d(__webpack_exports__, "d", function() { return /* reexport */ block_alignment_control["a" /* BlockAlignmentControl */]; }); __webpack_require__.d(__webpack_exports__, "e", function() { return /* reexport */ block_alignment_control["b" /* BlockAlignmentToolbar */]; }); __webpack_require__.d(__webpack_exports__, "nb", function() { return /* reexport */ block_full_height_alignment_control; }); __webpack_require__.d(__webpack_exports__, "lb", function() { return /* reexport */ block_alignment_matrix_control; }); __webpack_require__.d(__webpack_exports__, "f", function() { return /* reexport */ block_breadcrumb; }); __webpack_require__.d(__webpack_exports__, "mb", function() { return /* reexport */ BlockContentOverlay; }); __webpack_require__.d(__webpack_exports__, "h", function() { return /* reexport */ block_context["a" /* BlockContextProvider */]; }); __webpack_require__.d(__webpack_exports__, "i", function() { return /* reexport */ block_controls["b" /* default */]; }); __webpack_require__.d(__webpack_exports__, "m", function() { return /* reexport */ block_controls["a" /* BlockFormatControls */]; }); __webpack_require__.d(__webpack_exports__, "g", function() { return /* reexport */ color_style_selector; }); __webpack_require__.d(__webpack_exports__, "j", function() { return /* reexport */ block_edit["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "pc", function() { return /* reexport */ context["c" /* useBlockEditContext */]; }); __webpack_require__.d(__webpack_exports__, "n", function() { return /* reexport */ block_icon["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "r", function() { return /* reexport */ dropdown; }); __webpack_require__.d(__webpack_exports__, "pb", function() { return /* reexport */ block_variation_picker; }); __webpack_require__.d(__webpack_exports__, "ob", function() { return /* reexport */ block_pattern_setup; }); __webpack_require__.d(__webpack_exports__, "qb", function() { return /* reexport */ components_block_variation_transforms; }); __webpack_require__.d(__webpack_exports__, "A", function() { return /* reexport */ BlockVerticalAlignmentToolbar; }); __webpack_require__.d(__webpack_exports__, "z", function() { return /* reexport */ BlockVerticalAlignmentControl; }); __webpack_require__.d(__webpack_exports__, "rb", function() { return /* reexport */ border_radius_control["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "sb", function() { return /* reexport */ border_style_control["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "C", function() { return /* reexport */ button_block_appender["a" /* ButtonBlockerAppender */]; }); __webpack_require__.d(__webpack_exports__, "B", function() { return /* reexport */ button_block_appender["b" /* default */]; }); __webpack_require__.d(__webpack_exports__, "D", function() { return /* reexport */ color_palette; }); __webpack_require__.d(__webpack_exports__, "E", function() { return /* reexport */ ColorPaletteControl; }); __webpack_require__.d(__webpack_exports__, "F", function() { return /* reexport */ contrast_checker["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "ub", function() { return /* reexport */ duotone_control["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "vb", function() { return /* reexport */ font_appearance_control["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "wb", function() { return /* reexport */ font_family["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "Eb", function() { return /* reexport */ letter_spacing_control["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "Ob", function() { return /* reexport */ text_decoration_control["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "Pb", function() { return /* reexport */ text_transform_control["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "tb", function() { return /* reexport */ control["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "Lb", function() { return /* reexport */ panel_color_gradient_settings["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "Ab", function() { return /* reexport */ ImageEditor; }); __webpack_require__.d(__webpack_exports__, "zb", function() { return /* reexport */ ImageEditingProvider; }); __webpack_require__.d(__webpack_exports__, "Bb", function() { return /* reexport */ ImageSizeControl; }); __webpack_require__.d(__webpack_exports__, "J", function() { return /* reexport */ inner_blocks["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "rc", function() { return /* reexport */ inner_blocks["b" /* useInnerBlocksProps */]; }); __webpack_require__.d(__webpack_exports__, "M", function() { return /* reexport */ inspector_controls["b" /* default */]; }); __webpack_require__.d(__webpack_exports__, "L", function() { return /* reexport */ inspector_controls["a" /* InspectorAdvancedControls */]; }); __webpack_require__.d(__webpack_exports__, "O", function() { return /* reexport */ justify_content_control["b" /* JustifyToolbar */]; }); __webpack_require__.d(__webpack_exports__, "N", function() { return /* reexport */ justify_content_control["a" /* JustifyContentControl */]; }); __webpack_require__.d(__webpack_exports__, "Gb", function() { return /* reexport */ link_control; }); __webpack_require__.d(__webpack_exports__, "Hb", function() { return /* reexport */ search_input; }); __webpack_require__.d(__webpack_exports__, "Jb", function() { return /* reexport */ LinkControlSearchResults; }); __webpack_require__.d(__webpack_exports__, "Ib", function() { return /* reexport */ search_item; }); __webpack_require__.d(__webpack_exports__, "P", function() { return /* reexport */ line_height_control["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "Kb", function() { return /* reexport */ components_list_view; }); __webpack_require__.d(__webpack_exports__, "R", function() { return /* reexport */ media_replace_flow; }); __webpack_require__.d(__webpack_exports__, "Q", function() { return /* reexport */ media_placeholder; }); __webpack_require__.d(__webpack_exports__, "S", function() { return /* reexport */ media_upload; }); __webpack_require__.d(__webpack_exports__, "T", function() { return /* reexport */ media_upload_check; }); __webpack_require__.d(__webpack_exports__, "X", function() { return /* reexport */ panel_color_settings; }); __webpack_require__.d(__webpack_exports__, "Y", function() { return /* reexport */ plain_text; }); __webpack_require__.d(__webpack_exports__, "Nb", function() { return /* reexport */ responsive_block_control; }); __webpack_require__.d(__webpack_exports__, "ab", function() { return /* reexport */ rich_text; }); __webpack_require__.d(__webpack_exports__, "bb", function() { return /* reexport */ RichTextShortcut; }); __webpack_require__.d(__webpack_exports__, "cb", function() { return /* reexport */ RichTextToolbarButton; }); __webpack_require__.d(__webpack_exports__, "Yb", function() { return /* reexport */ __unstableRichTextInputEvent; }); __webpack_require__.d(__webpack_exports__, "eb", function() { return /* reexport */ tool_selector; }); __webpack_require__.d(__webpack_exports__, "Qb", function() { return /* reexport */ UnitControl; }); __webpack_require__.d(__webpack_exports__, "gb", function() { return /* reexport */ url_input; }); __webpack_require__.d(__webpack_exports__, "hb", function() { return /* reexport */ url_input_button; }); __webpack_require__.d(__webpack_exports__, "ib", function() { return /* reexport */ url_popover; }); __webpack_require__.d(__webpack_exports__, "Cb", function() { return /* reexport */ ImageURLInputUI; }); __webpack_require__.d(__webpack_exports__, "tc", function() { return /* reexport */ with_color_context; }); __webpack_require__.d(__webpack_exports__, "Ub", function() { return /* reexport */ block_settings_menu_first_item["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "Xb", function() { return /* reexport */ inserter_menu_extension["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "Mb", function() { return /* reexport */ PreviewOptions; }); __webpack_require__.d(__webpack_exports__, "Tb", function() { return /* reexport */ useResizeCanvas; }); __webpack_require__.d(__webpack_exports__, "o", function() { return /* reexport */ block_inspector; }); __webpack_require__.d(__webpack_exports__, "p", function() { return /* reexport */ block_list["c" /* default */]; }); __webpack_require__.d(__webpack_exports__, "qc", function() { return /* reexport */ use_block_props["a" /* useBlockProps */]; }); __webpack_require__.d(__webpack_exports__, "Db", function() { return /* reexport */ block_list_layout["b" /* LayoutStyle */]; }); __webpack_require__.d(__webpack_exports__, "q", function() { return /* reexport */ block_mover["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "s", function() { return /* reexport */ block_preview["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "t", function() { return /* reexport */ block_selection_clearer["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "Zb", function() { return /* reexport */ block_selection_clearer["b" /* useBlockSelectionClearer */]; }); __webpack_require__.d(__webpack_exports__, "u", function() { return /* reexport */ block_settings_menu["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "v", function() { return /* reexport */ block_settings_menu_controls["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "w", function() { return /* reexport */ block_title["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "x", function() { return /* reexport */ block_toolbar["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "y", function() { return /* reexport */ BlockTools; }); __webpack_require__.d(__webpack_exports__, "G", function() { return /* reexport */ copy_handler["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "bc", function() { return /* reexport */ copy_handler["b" /* useClipboardHandler */]; }); __webpack_require__.d(__webpack_exports__, "H", function() { return /* reexport */ default_block_appender["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "Vb", function() { return /* reexport */ editor_styles["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "K", function() { return /* reexport */ inserter["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "Fb", function() { return /* reexport */ library; }); __webpack_require__.d(__webpack_exports__, "k", function() { return /* reexport */ keyboard_shortcuts; }); __webpack_require__.d(__webpack_exports__, "U", function() { return /* reexport */ MultiSelectScrollIntoView; }); __webpack_require__.d(__webpack_exports__, "V", function() { return /* reexport */ navigable_toolbar["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "W", function() { return /* reexport */ observe_typing; }); __webpack_require__.d(__webpack_exports__, "ec", function() { return /* reexport */ useTypingObserver; }); __webpack_require__.d(__webpack_exports__, "cc", function() { return /* reexport */ useMouseMoveTypingReset; }); __webpack_require__.d(__webpack_exports__, "Z", function() { return /* reexport */ PreserveScrollInReorder; }); __webpack_require__.d(__webpack_exports__, "db", function() { return /* reexport */ skip_to_selected_block; }); __webpack_require__.d(__webpack_exports__, "fb", function() { return /* reexport */ typewriter; }); __webpack_require__.d(__webpack_exports__, "dc", function() { return /* reexport */ useTypewriter; }); __webpack_require__.d(__webpack_exports__, "jb", function() { return /* reexport */ warning["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "kb", function() { return /* reexport */ writing_flow["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "ac", function() { return /* reexport */ useCanvasClickRedirect; }); __webpack_require__.d(__webpack_exports__, "oc", function() { return /* reexport */ use_block_display_information["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "Wb", function() { return /* reexport */ iframe["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "Sb", function() { return /* reexport */ useNoRecursiveRenders; }); __webpack_require__.d(__webpack_exports__, "l", function() { return /* reexport */ provider["a" /* default */]; }); __webpack_require__.d(__webpack_exports__, "sc", function() { return /* reexport */ use_setting["a" /* default */]; }); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors/index.js + 1 modules var components_colors = __webpack_require__("5gPN"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/gradients/index.js var gradients = __webpack_require__("zmSX"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/index.js + 1 modules var font_sizes = __webpack_require__("9XVa"); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js var esm_extends = __webpack_require__("wx14"); // EXTERNAL MODULE: external ["wp","element"] var external_wp_element_ = __webpack_require__("GRId"); // EXTERNAL MODULE: external "lodash" var external_lodash_ = __webpack_require__("YLtl"); // EXTERNAL MODULE: external ["wp","i18n"] var external_wp_i18n_ = __webpack_require__("l3Sj"); // EXTERNAL MODULE: external ["wp","components"] var external_wp_components_ = __webpack_require__("tI+e"); // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/align-left.js var align_left = __webpack_require__("fPbg"); // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/align-center.js var align_center = __webpack_require__("plpT"); // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/align-right.js var align_right = __webpack_require__("ziDm"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/alignment-control/ui.js /** * External dependencies */ /** * WordPress dependencies */ const DEFAULT_ALIGNMENT_CONTROLS = [{ icon: align_left["a" /* default */], title: Object(external_wp_i18n_["__"])('Align text left'), align: 'left' }, { icon: align_center["a" /* default */], title: Object(external_wp_i18n_["__"])('Align text center'), align: 'center' }, { icon: align_right["a" /* default */], title: Object(external_wp_i18n_["__"])('Align text right'), align: 'right' }]; const ui_POPOVER_PROPS = { position: 'bottom right', isAlternate: true }; function AlignmentUI({ value, onChange, alignmentControls = DEFAULT_ALIGNMENT_CONTROLS, label = Object(external_wp_i18n_["__"])('Align'), describedBy = Object(external_wp_i18n_["__"])('Change text alignment'), isCollapsed = true, isToolbar }) { function applyOrUnset(align) { return () => onChange(value === align ? undefined : align); } const activeAlignment = Object(external_lodash_["find"])(alignmentControls, control => control.align === value); function setIcon() { if (activeAlignment) return activeAlignment.icon; return Object(external_wp_i18n_["isRTL"])() ? align_right["a" /* default */] : align_left["a" /* default */]; } const UIComponent = isToolbar ? external_wp_components_["ToolbarGroup"] : external_wp_components_["ToolbarDropdownMenu"]; const extraProps = isToolbar ? { isCollapsed } : {}; return Object(external_wp_element_["createElement"])(UIComponent, Object(esm_extends["a" /* default */])({ icon: setIcon(), label: label, toggleProps: { describedBy }, popoverProps: ui_POPOVER_PROPS, 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 */ var ui = (AlignmentUI); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/alignment-control/index.js /** * Internal dependencies */ function AlignmentControl(props) { return Object(external_wp_element_["createElement"])(ui, Object(esm_extends["a" /* default */])({}, props, { isToolbar: false })); } function AlignmentToolbar(props) { return Object(external_wp_element_["createElement"])(ui, Object(esm_extends["a" /* default */])({}, props, { isToolbar: true })); } // EXTERNAL MODULE: external ["wp","hooks"] var external_wp_hooks_ = __webpack_require__("g56x"); // EXTERNAL MODULE: external ["wp","blocks"] var external_wp_blocks_ = __webpack_require__("HSyU"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-edit/context.js var context = __webpack_require__("ur0x"); // EXTERNAL MODULE: external ["wp","data"] var external_wp_data_ = __webpack_require__("1ZqX"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/search-items.js var search_items = __webpack_require__("pOGT"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-block-types-state.js var use_block_types_state = __webpack_require__("+G0a"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-icon/index.js var block_icon = __webpack_require__("7SSY"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/store/index.js + 4 modules var store = __webpack_require__("BhPs"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/autocompleters/block.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const SHOWN_BLOCK_TYPES = 9; /** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */ /** * Creates a blocks repeater for replacing the current block with a selected block type. * * @return {WPCompleter} A blocks completer. */ function createBlockCompleter() { return { name: 'blocks', className: 'block-editor-autocompleters__block', triggerPrefix: '/', useItems(filterValue) { const { rootClientId, selectedBlockName } = Object(external_wp_data_["useSelect"])(select => { const { getSelectedBlockClientId, getBlockName, getBlockInsertionPoint } = select(store["a" /* store */]); const selectedBlockClientId = getSelectedBlockClientId(); return { selectedBlockName: selectedBlockClientId ? getBlockName(selectedBlockClientId) : null, rootClientId: getBlockInsertionPoint().rootClientId }; }, []); const [items, categories, collections] = Object(use_block_types_state["a" /* default */])(rootClientId, external_lodash_["noop"]); const filteredItems = Object(external_wp_element_["useMemo"])(() => { const initialFilteredItems = !!filterValue.trim() ? Object(search_items["a" /* searchBlockItems */])(items, categories, collections, filterValue) : Object(external_lodash_["orderBy"])(items, ['frecency'], ['desc']); return initialFilteredItems.filter(item => item.name !== selectedBlockName).slice(0, SHOWN_BLOCK_TYPES); }, [filterValue, selectedBlockName, items, categories, collections]); const options = Object(external_wp_element_["useMemo"])(() => filteredItems.map(blockItem => { const { title, icon, isDisabled } = blockItem; return { key: `block-${blockItem.id}`, value: blockItem, label: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(block_icon["a" /* default */], { key: "icon", icon: icon, showColors: true }), title), isDisabled }; }), [filteredItems]); return [options]; }, allowContext(before, after) { return !(/\S/.test(before) || /\S/.test(after)); }, getOptionCompletion(inserterItem) { const { name, initialAttributes, innerBlocks } = inserterItem; return { action: 'replace', value: Object(external_wp_blocks_["createBlock"])(name, initialAttributes, Object(external_wp_blocks_["createBlocksFromInnerBlocksTemplate"])(innerBlocks)) }; } }; } /** * Creates a blocks repeater for replacing the current block with a selected block type. * * @return {WPCompleter} A blocks completer. */ /* harmony default export */ var autocompleters_block = (createBlockCompleter()); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/autocomplete/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Shared reference to an empty array for cases where it is important to avoid * returning a new array reference on every invocation. * * @type {Array} */ const EMPTY_ARRAY = []; function useCompleters({ completers = EMPTY_ARRAY }) { const { name } = Object(context["c" /* useBlockEditContext */])(); return Object(external_wp_element_["useMemo"])(() => { let filteredCompleters = completers; if (name === Object(external_wp_blocks_["getDefaultBlockName"])() || Object(external_wp_blocks_["getBlockSupport"])(name, '__experimentalSlashInserter', false)) { filteredCompleters = filteredCompleters.concat([autocompleters_block]); } if (Object(external_wp_hooks_["hasFilter"])('editor.Autocomplete.completers')) { // Provide copies so filters may directly modify them. if (filteredCompleters === completers) { filteredCompleters = filteredCompleters.map(external_lodash_["clone"]); } filteredCompleters = Object(external_wp_hooks_["applyFilters"])('editor.Autocomplete.completers', filteredCompleters, name); } return filteredCompleters; }, [completers, name]); } function useBlockEditorAutocompleteProps(props) { return Object(external_wp_components_["__unstableUseAutocompleteProps"])({ ...props, completers: useCompleters(props) }); } /** * Wrap the default Autocomplete component with one that supports a filter hook * for customizing its list of autocompleters. * * @type {import('react').FC} */ function BlockEditorAutocomplete(props) { return Object(external_wp_element_["createElement"])(external_wp_components_["Autocomplete"], Object(esm_extends["a" /* default */])({}, props, { completers: useCompleters(props) })); } /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/autocomplete/README.md */ /* harmony default export */ var autocomplete = (BlockEditorAutocomplete); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/index.js + 4 modules var block_alignment_control = __webpack_require__("vtO0"); // EXTERNAL MODULE: external ["wp","primitives"] var external_wp_primitives_ = __webpack_require__("Tqx9"); // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/fullscreen.js /** * WordPress dependencies */ const fullscreen = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M4.2 9h1.5V5.8H9V4.2H4.2V9zm14 9.2H15v1.5h4.8V15h-1.5v3.2zM15 4.2v1.5h3.2V9h1.5V4.2H15zM5.8 15H4.2v4.8H9v-1.5H5.8V15z" })); /* harmony default export */ var 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 = Object(external_wp_i18n_["__"])('Toggle full height'), onToggle, isDisabled }) { return Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { isActive: isActive, icon: library_fullscreen, label: label, onClick: () => onToggle(!isActive), disabled: isDisabled }); } /* harmony default export */ var block_full_height_alignment_control = (BlockFullHeightAlignmentControl); // EXTERNAL MODULE: external ["wp","keycodes"] var external_wp_keycodes_ = __webpack_require__("RxS6"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-matrix-control/index.js /** * External dependencies */ /** * WordPress dependencies */ function BlockAlignmentMatrixControl(props) { const { label = Object(external_wp_i18n_["__"])('Change matrix alignment'), onChange = external_lodash_["noop"], value = 'center', isDisabled } = props; const icon = Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalAlignmentMatrixControl"].Icon, { value: value }); const className = 'block-editor-block-alignment-matrix-control'; const popoverClassName = `${className}__popover`; const isAlternate = true; return Object(external_wp_element_["createElement"])(external_wp_components_["Dropdown"], { position: "bottom right", className: className, popoverProps: { className: popoverClassName, isAlternate }, renderToggle: ({ onToggle, isOpen }) => { const openOnArrowDown = event => { if (!isOpen && event.keyCode === external_wp_keycodes_["DOWN"]) { event.preventDefault(); onToggle(); } }; return Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { onClick: onToggle, "aria-haspopup": "true", "aria-expanded": isOpen, onKeyDown: openOnArrowDown, label: label, icon: icon, showTooltip: true, disabled: isDisabled }); }, renderContent: () => Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalAlignmentMatrixControl"], { hasFocusBorder: false, onChange: onChange, value: value }) }); } /* harmony default export */ var block_alignment_matrix_control = (BlockAlignmentMatrixControl); // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js var build_module_icon = __webpack_require__("iClF"); // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right-small.js /** * WordPress dependencies */ const chevronRightSmall = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" }, Object(external_wp_element_["createElement"])(external_wp_primitives_["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 */ var chevron_right_small = (chevronRightSmall); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-title/index.js var block_title = __webpack_require__("f8JO"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-breadcrumb/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Block breadcrumb component, displaying the hierarchy of the current block selection as a breadcrumb. * * @param {Object} props Component props. * @param {string} props.rootLabelText Translated label for the root element of the breadcrumb trail. * @return {WPElement} Block Breadcrumb. */ function BlockBreadcrumb({ rootLabelText }) { const { selectBlock, clearSelectedBlock } = Object(external_wp_data_["useDispatch"])(store["a" /* store */]); const { clientId, parents, hasSelection } = Object(external_wp_data_["useSelect"])(select => { const { getSelectionStart, getSelectedBlockClientId, getBlockParents } = select(store["a" /* store */]); const selectedBlockClientId = getSelectedBlockClientId(); return { parents: getBlockParents(selectedBlockClientId), clientId: selectedBlockClientId, hasSelection: !!getSelectionStart().clientId }; }, []); const rootLabel = rootLabelText || Object(external_wp_i18n_["__"])('Document'); /* * Disable reason: The `list` ARIA role is redundant but * Safari+VoiceOver won't announce the list otherwise. */ /* eslint-disable jsx-a11y/no-redundant-roles */ return Object(external_wp_element_["createElement"])("ul", { className: "block-editor-block-breadcrumb", role: "list", "aria-label": Object(external_wp_i18n_["__"])('Block breadcrumb') }, Object(external_wp_element_["createElement"])("li", { className: !hasSelection ? 'block-editor-block-breadcrumb__current' : undefined, "aria-current": !hasSelection ? 'true' : undefined }, hasSelection && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { className: "block-editor-block-breadcrumb__button", variant: "tertiary", onClick: clearSelectedBlock }, rootLabel), !hasSelection && rootLabel, !!clientId && Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], { icon: chevron_right_small, className: "block-editor-block-breadcrumb__separator" })), parents.map(parentClientId => Object(external_wp_element_["createElement"])("li", { key: parentClientId }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { className: "block-editor-block-breadcrumb__button", variant: "tertiary", onClick: () => selectBlock(parentClientId) }, Object(external_wp_element_["createElement"])(block_title["a" /* default */], { clientId: parentClientId })), Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], { icon: chevron_right_small, className: "block-editor-block-breadcrumb__separator" }))), !!clientId && Object(external_wp_element_["createElement"])("li", { className: "block-editor-block-breadcrumb__current", "aria-current": "true" }, Object(external_wp_element_["createElement"])(block_title["a" /* default */], { clientId: clientId }))) /* eslint-enable jsx-a11y/no-redundant-roles */ ; } /* harmony default export */ var block_breadcrumb = (BlockBreadcrumb); // EXTERNAL MODULE: ./node_modules/classnames/index.js var classnames = __webpack_require__("TSYQ"); var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-content-overlay/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * External dependencies */ function BlockContentOverlay({ clientId, tagName: TagName = 'div', wrapperProps, className }) { const baseClassName = 'block-editor-block-content-overlay'; const [isOverlayActive, setIsOverlayActive] = Object(external_wp_element_["useState"])(true); const [isHovered, setIsHovered] = Object(external_wp_element_["useState"])(false); const { isParentSelected, hasChildSelected, isDraggingBlocks, isParentHighlighted } = Object(external_wp_data_["useSelect"])(select => { const { isBlockSelected, hasSelectedInnerBlock, isDraggingBlocks: _isDraggingBlocks, isBlockHighlighted } = select(store["a" /* store */]); return { isParentSelected: isBlockSelected(clientId), hasChildSelected: hasSelectedInnerBlock(clientId, true), isDraggingBlocks: _isDraggingBlocks(), isParentHighlighted: isBlockHighlighted(clientId) }; }, [clientId]); const classes = classnames_default()(baseClassName, wrapperProps === null || wrapperProps === void 0 ? void 0 : wrapperProps.className, className, { 'overlay-active': isOverlayActive, 'parent-highlighted': isParentHighlighted, 'is-dragging-blocks': isDraggingBlocks }); Object(external_wp_element_["useEffect"])(() => { // Reenable when blocks are not in use. if (!isParentSelected && !hasChildSelected && !isOverlayActive) { setIsOverlayActive(true); } // Disable if parent selected by another means (such as list view). // We check hover to ensure the overlay click interaction is not taking place. // Trying to click the overlay will select the parent block via its 'focusin' // listener on the wrapper, so if the block is selected while hovered we will // let the mouseup disable the overlay instead. if (isParentSelected && !isHovered && isOverlayActive) { setIsOverlayActive(false); } // Ensure overlay is disabled if a child block is selected. if (hasChildSelected && isOverlayActive) { setIsOverlayActive(false); } }, [isParentSelected, hasChildSelected, isOverlayActive, isHovered]); // Disabled because the overlay div doesn't actually have a role or functionality // as far as the a11y is concerned. We're just catching the first click so that // the block can be selected without interacting with its contents. /* eslint-disable jsx-a11y/no-static-element-interactions */ return Object(external_wp_element_["createElement"])(TagName, Object(esm_extends["a" /* default */])({}, wrapperProps, { className: classes, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), onMouseUp: isOverlayActive ? () => setIsOverlayActive(false) : undefined }), wrapperProps === null || wrapperProps === void 0 ? void 0 : wrapperProps.children); } /* eslint-enable jsx-a11y/no-static-element-interactions */ // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-context/index.js var block_context = __webpack_require__("uoCR"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-controls/index.js + 4 modules var block_controls = __webpack_require__("fOYa"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/color-style-selector/index.js /** * WordPress dependencies */ const ColorSelectorSVGIcon = () => Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { xmlns: "https://www.w3.org/2000/svg", viewBox: "0 0 20 20" }, Object(external_wp_element_["createElement"])(external_wp_components_["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. * * @param {Object} props Component properties. * @param {Object} props.style Style object. * @param {string} props.className Class name for component. * * @return {*} React Icon component. */ const ColorSelectorIcon = ({ style, className }) => { return Object(external_wp_element_["createElement"])("div", { className: "block-library-colors-selector__icon-container" }, Object(external_wp_element_["createElement"])("div", { className: `${className} block-library-colors-selector__state-selection`, style: style }, Object(external_wp_element_["createElement"])(ColorSelectorSVGIcon, null))); }; /** * Renders the Colors Selector Toolbar with the icon button. * * @param {Object} props Component properties. * @param {Object} props.TextColor Text color component that wraps icon. * @param {Object} props.BackgroundColor Background color component that wraps icon. * * @return {*} React toggle button component. */ const renderToggleComponent = ({ TextColor, BackgroundColor }) => ({ onToggle, isOpen }) => { const openOnArrowDown = event => { if (!isOpen && event.keyCode === external_wp_keycodes_["DOWN"]) { event.preventDefault(); onToggle(); } }; return Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { className: "components-toolbar__control block-library-colors-selector__toggle", label: Object(external_wp_i18n_["__"])('Open Colors Selector'), onClick: onToggle, onKeyDown: openOnArrowDown, icon: Object(external_wp_element_["createElement"])(BackgroundColor, null, Object(external_wp_element_["createElement"])(TextColor, null, Object(external_wp_element_["createElement"])(ColorSelectorIcon, null))) })); }; const BlockColorsStyleSelector = ({ children, ...other }) => Object(external_wp_element_["createElement"])(external_wp_components_["Dropdown"], { position: "bottom right", className: "block-library-colors-selector", contentClassName: "block-library-colors-selector__popover", renderToggle: renderToggleComponent(other), renderContent: () => children }); /* harmony default export */ var color_style_selector = (BlockColorsStyleSelector); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-edit/index.js + 1 modules var block_edit = __webpack_require__("JRTi"); // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/list-view.js var list_view = __webpack_require__("OzlF"); // EXTERNAL MODULE: external ["wp","compose"] var external_wp_compose_ = __webpack_require__("K9lf"); // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js var more_vertical = __webpack_require__("VKE3"); // EXTERNAL MODULE: ./node_modules/@react-spring/web/dist/react-spring-web.esm.js var react_spring_web_esm = __webpack_require__("+DUQ"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-moving-animation/index.js var use_moving_animation = __webpack_require__("Xkls"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/leaf.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const AnimatedTreeGridRow = Object(react_spring_web_esm["animated"])(external_wp_components_["__experimentalTreeGridRow"]); function ListViewLeaf({ isSelected, position, level, rowCount, children, className, path, ...props }) { const ref = Object(use_moving_animation["a" /* default */])({ isSelected, adjustScrolling: false, enableAnimation: true, triggerAnimationOnChange: path }); return Object(external_wp_element_["createElement"])(AnimatedTreeGridRow, Object(esm_extends["a" /* default */])({ ref: ref, className: classnames_default()('block-editor-list-view-leaf', className), level: level, positionInSet: position, setSize: rowCount }, props), children); } // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-mover/button.js + 1 modules var block_mover_button = __webpack_require__("9Ma0"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-block-display-information/index.js var use_block_display_information = __webpack_require__("wC17"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/utils.js /** * External dependencies */ /** * WordPress dependencies */ const getBlockPositionDescription = (position, siblingCount, level) => Object(external_wp_i18n_["sprintf"])( /* translators: 1: The numerical position of the block. 2: The total number of blocks. 3. The level of nesting for the block. */ Object(external_wp_i18n_["__"])('Block %1$d of %2$d, Level %3$d'), position, siblingCount, level); /** * Returns true if the client ID occurs within the block selection or multi-selection, * or false otherwise. * * @param {string} clientId Block client ID. * @param {string|string[]} selectedBlockClientIds Selected block client ID, or an array of multi-selected blocks client IDs. * * @return {boolean} Whether the block is in multi-selection set. */ const isClientIdSelected = (clientId, selectedBlockClientIds) => Object(external_lodash_["isArray"])(selectedBlockClientIds) && selectedBlockClientIds.length ? selectedBlockClientIds.indexOf(clientId) !== -1 : selectedBlockClientIds === clientId; // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/expander.js /** * WordPress dependencies */ function ListViewExpander({ onClick }) { return (// 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 // https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html // // We've mimicked this by adding an icon with aria-hidden set to true to hide this from the accessibility tree. // 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 Object(external_wp_element_["createElement"])("span", { className: "block-editor-list-view__expander", onClick: event => onClick(event, { forceToggle: true }), "aria-hidden": "true" }, Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], { icon: chevron_right_small })) ); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/block-select-button.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function ListViewBlockSelectButton({ className, block: { clientId }, isSelected, onClick, onToggleExpanded, position, siblingBlockCount, level, tabIndex, onFocus, onDragStart, onDragEnd, draggable }, ref) { const blockInformation = Object(use_block_display_information["a" /* default */])(clientId); const instanceId = Object(external_wp_compose_["useInstanceId"])(ListViewBlockSelectButton); const descriptionId = `list-view-block-select-button__${instanceId}`; const blockPositionDescription = getBlockPositionDescription(position, siblingBlockCount, level); return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { className: classnames_default()('block-editor-list-view-block-select-button', className), onClick: onClick, "aria-describedby": descriptionId, ref: ref, tabIndex: tabIndex, onFocus: onFocus, onDragStart: onDragStart, onDragEnd: onDragEnd, draggable: draggable }, Object(external_wp_element_["createElement"])(ListViewExpander, { onClick: onToggleExpanded }), Object(external_wp_element_["createElement"])(block_icon["a" /* default */], { icon: blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.icon, showColors: true }), Object(external_wp_element_["createElement"])(block_title["a" /* default */], { clientId: clientId }), (blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.anchor) && Object(external_wp_element_["createElement"])("span", { className: "block-editor-list-view-block-select-button__anchor" }, blockInformation.anchor), isSelected && Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], null, Object(external_wp_i18n_["__"])('(selected block)'))), Object(external_wp_element_["createElement"])("div", { className: "block-editor-list-view-block-select-button__description", id: descriptionId }, blockPositionDescription)); } /* harmony default export */ var block_select_button = (Object(external_wp_element_["forwardRef"])(ListViewBlockSelectButton)); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-draggable/index.js + 1 modules var block_draggable = __webpack_require__("ZAjO"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/block-contents.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const ListViewBlockContents = Object(external_wp_element_["forwardRef"])(({ onClick, onToggleExpanded, block, isSelected, position, siblingBlockCount, level, ...props }, ref) => { const { clientId } = block; const { blockMovingClientId, selectedBlockInBlockEditor } = Object(external_wp_data_["useSelect"])(select => { const { getBlockRootClientId, hasBlockMovingClientId, getSelectedBlockClientId } = select(store["a" /* store */]); return { rootClientId: getBlockRootClientId(clientId) || '', blockMovingClientId: hasBlockMovingClientId(), selectedBlockInBlockEditor: getSelectedBlockClientId() }; }, [clientId]); const isBlockMoveTarget = blockMovingClientId && selectedBlockInBlockEditor === clientId; const className = classnames_default()('block-editor-list-view-block-contents', { 'is-dropping-before': isBlockMoveTarget }); return Object(external_wp_element_["createElement"])(block_draggable["a" /* default */], { clientIds: [block.clientId] }, ({ draggable, onDragStart, onDragEnd }) => Object(external_wp_element_["createElement"])(block_select_button, Object(esm_extends["a" /* default */])({ ref: ref, className: className, block: block, onClick: onClick, onToggleExpanded: onToggleExpanded, isSelected: isSelected, position: position, siblingBlockCount: siblingBlockCount, level: level, draggable: draggable, onDragStart: onDragStart, onDragEnd: onDragEnd }, props))); }); /* harmony default export */ var block_contents = (ListViewBlockContents); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-settings-dropdown.js + 4 modules var block_settings_dropdown = __webpack_require__("1eGn"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/context.js /** * WordPress dependencies */ const ListViewContext = Object(external_wp_element_["createContext"])({ __experimentalFeatures: false, __experimentalPersistentListViewFeatures: false }); const useListViewContext = () => Object(external_wp_element_["useContext"])(ListViewContext); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/block.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function ListViewBlock({ block, isDragged, isSelected, isBranchSelected, selectBlock, position, level, rowCount, siblingBlockCount, showBlockMovers, path, isExpanded }) { const cellRef = Object(external_wp_element_["useRef"])(null); const [isHovered, setIsHovered] = Object(external_wp_element_["useState"])(false); const { clientId } = block; const { toggleBlockHighlight } = Object(external_wp_data_["useDispatch"])(store["a" /* store */]); const { __experimentalFeatures: withExperimentalFeatures, __experimentalPersistentListViewFeatures: withExperimentalPersistentListViewFeatures, __experimentalHideContainerBlockActions: hideContainerBlockActions, isTreeGridMounted, expand, collapse } = useListViewContext(); const hasSiblings = siblingBlockCount > 0; const hasRenderedMovers = showBlockMovers && hasSiblings; const moverCellClassName = classnames_default()('block-editor-list-view-block__mover-cell', { 'is-visible': isHovered || isSelected }); const listViewBlockSettingsClassName = classnames_default()('block-editor-list-view-block__menu-cell', { 'is-visible': isHovered || isSelected }); // If ListView has experimental features related to the Persistent List View, // only focus the selected list item on mount; otherwise the list would always // try to steal the focus from the editor canvas. Object(external_wp_element_["useEffect"])(() => { if (withExperimentalPersistentListViewFeatures && !isTreeGridMounted && isSelected) { cellRef.current.focus(); } }, []); const highlightBlock = withExperimentalPersistentListViewFeatures ? toggleBlockHighlight : () => {}; const onMouseEnter = Object(external_wp_element_["useCallback"])(() => { setIsHovered(true); highlightBlock(clientId, true); }, [clientId, setIsHovered, highlightBlock]); const onMouseLeave = Object(external_wp_element_["useCallback"])(() => { setIsHovered(false); highlightBlock(clientId, false); }, [clientId, setIsHovered, highlightBlock]); const selectEditorBlock = Object(external_wp_element_["useCallback"])(event => { event.stopPropagation(); selectBlock(clientId); }, [clientId, selectBlock]); const toggleExpanded = Object(external_wp_element_["useCallback"])(event => { event.stopPropagation(); if (isExpanded === true) { collapse(clientId); } else if (isExpanded === false) { expand(clientId); } }, [clientId, expand, collapse, isExpanded]); const showBlockActions = withExperimentalFeatures && ( //hide actions for blocks like core/widget-areas !hideContainerBlockActions || hideContainerBlockActions && level > 1); const hideBlockActions = withExperimentalFeatures && !showBlockActions; let colSpan; if (hasRenderedMovers) { colSpan = 2; } else if (hideBlockActions) { colSpan = 3; } const classes = classnames_default()({ 'is-selected': isSelected, 'is-branch-selected': withExperimentalPersistentListViewFeatures && isBranchSelected, 'is-dragging': isDragged, 'has-single-cell': hideBlockActions }); return Object(external_wp_element_["createElement"])(ListViewLeaf, { className: classes, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onFocus: onMouseEnter, onBlur: onMouseLeave, level: level, position: position, rowCount: rowCount, path: path, id: `list-view-block-${clientId}`, "data-block": clientId, isExpanded: isExpanded }, Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalTreeGridCell"], { className: "block-editor-list-view-block__contents-cell", colSpan: colSpan, ref: cellRef }, ({ ref, tabIndex, onFocus }) => Object(external_wp_element_["createElement"])("div", { className: "block-editor-list-view-block__contents-container" }, Object(external_wp_element_["createElement"])(block_contents, { block: block, onClick: selectEditorBlock, onToggleExpanded: toggleExpanded, isSelected: isSelected, position: position, siblingBlockCount: siblingBlockCount, level: level, ref: ref, tabIndex: tabIndex, onFocus: onFocus }))), hasRenderedMovers && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalTreeGridCell"], { className: moverCellClassName, withoutGridItem: true }, Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalTreeGridItem"], null, ({ ref, tabIndex, onFocus }) => Object(external_wp_element_["createElement"])(block_mover_button["b" /* BlockMoverUpButton */], { orientation: "vertical", clientIds: [clientId], ref: ref, tabIndex: tabIndex, onFocus: onFocus })), Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalTreeGridItem"], null, ({ ref, tabIndex, onFocus }) => Object(external_wp_element_["createElement"])(block_mover_button["a" /* BlockMoverDownButton */], { orientation: "vertical", clientIds: [clientId], ref: ref, tabIndex: tabIndex, onFocus: onFocus })))), showBlockActions && Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalTreeGridCell"], { className: listViewBlockSettingsClassName }, ({ ref, tabIndex, onFocus }) => Object(external_wp_element_["createElement"])(block_settings_dropdown["a" /* default */], { clientIds: [clientId], icon: more_vertical["a" /* default */], toggleProps: { ref, className: 'block-editor-list-view-block__menu', tabIndex, onFocus }, disableOpenOnArrowDown: true, __experimentalSelectBlock: selectEditorBlock }))); } /* harmony default export */ var list_view_block = (Object(external_wp_element_["memo"])(ListViewBlock)); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/branch.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Given a block, returns the total number of blocks in that subtree. This is used to help determine * the list position of a block. * * When a block is collapsed, we do not count their children as part of that total. In the current drag * implementation dragged blocks and their children are not counted. * * @param {Object} block block tree * @param {Object} expandedState state that notes which branches are collapsed * @param {Array} draggedClientIds a list of dragged client ids * @return {number} block count */ function countBlocks(block, expandedState, draggedClientIds) { var _expandedState$block$; const isDragged = draggedClientIds === null || draggedClientIds === void 0 ? void 0 : draggedClientIds.includes(block.clientId); if (isDragged) { return 0; } const isExpanded = (_expandedState$block$ = expandedState[block.clientId]) !== null && _expandedState$block$ !== void 0 ? _expandedState$block$ : true; if (isExpanded) { return 1 + block.innerBlocks.reduce(countReducer(expandedState, draggedClientIds), 0); } return 1; } const countReducer = (expandedState, draggedClientIds) => (count, block) => { var _expandedState$block$2; const isDragged = draggedClientIds === null || draggedClientIds === void 0 ? void 0 : draggedClientIds.includes(block.clientId); if (isDragged) { return count; } const isExpanded = (_expandedState$block$2 = expandedState[block.clientId]) !== null && _expandedState$block$2 !== void 0 ? _expandedState$block$2 : true; if (isExpanded && block.innerBlocks.length > 0) { return count + countBlocks(block, expandedState, draggedClientIds); } return count + 1; }; function ListViewBranch(props) { const { blocks, selectBlock, showBlockMovers, showNestedBlocks, selectedClientIds, level = 1, path = '', isBranchSelected = false, listPosition = 0, fixedListWindow } = props; const { expandedState, draggedClientIds, __experimentalPersistentListViewFeatures } = useListViewContext(); const filteredBlocks = Object(external_lodash_["compact"])(blocks); const blockCount = filteredBlocks.length; let nextPosition = listPosition; return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, filteredBlocks.map((block, index) => { var _expandedState$client; const { clientId, innerBlocks } = block; if (index > 0) { nextPosition += countBlocks(filteredBlocks[index - 1], expandedState, draggedClientIds); } const usesWindowing = __experimentalPersistentListViewFeatures; const { itemInView } = fixedListWindow; const blockInView = !usesWindowing || itemInView(nextPosition); const position = index + 1; const updatedPath = path.length > 0 ? `${path}_${position}` : `${position}`; const hasNestedBlocks = showNestedBlocks && !!innerBlocks && !!innerBlocks.length; const isExpanded = hasNestedBlocks ? (_expandedState$client = expandedState[clientId]) !== null && _expandedState$client !== void 0 ? _expandedState$client : true : undefined; const isDragged = !!(draggedClientIds !== null && draggedClientIds !== void 0 && draggedClientIds.includes(clientId)); const showBlock = isDragged || blockInView; // 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; return Object(external_wp_element_["createElement"])(external_wp_data_["AsyncModeProvider"], { key: clientId, value: !isSelected }, showBlock && Object(external_wp_element_["createElement"])(list_view_block, { block: block, selectBlock: selectBlock, isSelected: isSelected, isBranchSelected: isSelectedBranch, isDragged: isDragged, level: level, position: position, rowCount: blockCount, siblingBlockCount: blockCount, showBlockMovers: showBlockMovers, path: updatedPath, isExpanded: isExpanded, listPosition: nextPosition }), !showBlock && Object(external_wp_element_["createElement"])("tr", null, Object(external_wp_element_["createElement"])("td", { className: "block-editor-list-view-placeholder" })), hasNestedBlocks && isExpanded && !isDragged && Object(external_wp_element_["createElement"])(ListViewBranch, { blocks: innerBlocks, selectBlock: selectBlock, showBlockMovers: showBlockMovers, showNestedBlocks: showNestedBlocks, level: level + 1, path: updatedPath, listPosition: nextPosition + 1, fixedListWindow: fixedListWindow, isBranchSelected: isSelectedBranch, selectedClientIds: selectedClientIds })); })); } ListViewBranch.defaultProps = { selectBlock: () => {} }; /* harmony default export */ var branch = (Object(external_wp_element_["memo"])(ListViewBranch)); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/drop-indicator.js /** * WordPress dependencies */ function ListViewDropIndicator({ listViewRef, blockDropTarget }) { const { rootClientId, clientId, dropPosition } = blockDropTarget || {}; const [rootBlockElement, blockElement] = Object(external_wp_element_["useMemo"])(() => { if (!listViewRef.current) { return []; } // The rootClientId will be defined whenever dropping into inner // block lists, but is undefined when dropping at the root level. const _rootBlockElement = rootClientId ? listViewRef.current.querySelector(`[data-block="${rootClientId}"]`) : undefined; // The clientId represents the sibling block, the dragged block will // usually be inserted adjacent to it. It will be undefined when // dropping a block into an empty block list. const _blockElement = clientId ? listViewRef.current.querySelector(`[data-block="${clientId}"]`) : undefined; return [_rootBlockElement, _blockElement]; }, [rootClientId, clientId]); // The targetElement is the element that the drop indicator will appear // before or after. When dropping into an empty block list, blockElement // is undefined, so the indicator will appear after the rootBlockElement. const targetElement = blockElement || rootBlockElement; const getDropIndicatorIndent = Object(external_wp_element_["useCallback"])(() => { if (!rootBlockElement) { return 0; } // Calculate the indent using the block icon of the root block. // Using a classname selector here might be flaky and could be // improved. const targetElementRect = targetElement.getBoundingClientRect(); const rootBlockIconElement = rootBlockElement.querySelector('.block-editor-block-icon'); const rootBlockIconRect = rootBlockIconElement.getBoundingClientRect(); return rootBlockIconRect.right - targetElementRect.left; }, [rootBlockElement, targetElement]); const style = Object(external_wp_element_["useMemo"])(() => { if (!targetElement) { return {}; } const indent = getDropIndicatorIndent(); return { width: targetElement.offsetWidth - indent }; }, [getDropIndicatorIndent, targetElement]); const getAnchorRect = Object(external_wp_element_["useCallback"])(() => { if (!targetElement) { return {}; } const ownerDocument = targetElement.ownerDocument; const rect = targetElement.getBoundingClientRect(); const indent = getDropIndicatorIndent(); const anchorRect = { left: rect.left + indent, right: rect.right, width: 0, height: rect.height, ownerDocument }; if (dropPosition === 'top') { return { ...anchorRect, top: rect.top, bottom: rect.top }; } if (dropPosition === 'bottom' || dropPosition === 'inside') { return { ...anchorRect, top: rect.bottom, bottom: rect.bottom }; } return {}; }, [targetElement, dropPosition, getDropIndicatorIndent]); if (!targetElement) { return null; } return Object(external_wp_element_["createElement"])(external_wp_components_["Popover"], { noArrow: true, animate: false, getAnchorRect: getAnchorRect, focusOnMount: false, className: "block-editor-list-view-drop-indicator" }, Object(external_wp_element_["createElement"])("div", { style: style, className: "block-editor-list-view-drop-indicator__line" })); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-client-ids.js /** * WordPress dependencies */ /** * Internal dependencies */ function useListViewClientIds(blocks) { return Object(external_wp_data_["useSelect"])(select => { const { getDraggedBlockClientIds, getSelectedBlockClientIds, __unstableGetClientIdsTree } = select(store["a" /* store */]); return { selectedClientIds: getSelectedBlockClientIds(), draggedClientIds: getDraggedBlockClientIds(), clientIdsTree: blocks ? blocks : __unstableGetClientIdsTree() }; }, [blocks]); } // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/math.js var math = __webpack_require__("vIlp"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-on-block-drop/index.js var use_on_block_drop = __webpack_require__("/lNF"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-drop-zone.js /** * WordPress dependencies */ /** * Internal dependencies */ /** @typedef {import('../../utils/math').WPPoint} WPPoint */ /** * The type of a drag event. * * @typedef {'default'|'file'|'html'} WPDragEventType */ /** * An array representing data for blocks in the DOM used by drag and drop. * * @typedef {Object} WPListViewDropZoneBlocks * @property {string} clientId The client id for the block. * @property {string} rootClientId The root client id for the block. * @property {number} blockIndex The block's index. * @property {Element} element The DOM element representing the block. * @property {number} innerBlockCount The number of inner blocks the block has. * @property {boolean} isDraggedBlock Whether the block is currently being dragged. * @property {boolean} canInsertDraggedBlocksAsSibling Whether the dragged block can be a sibling of this block. * @property {boolean} canInsertDraggedBlocksAsChild Whether the dragged block can be a child of this block. */ /** * An object containing details of a drop target. * * @typedef {Object} WPListViewDropZoneTarget * @property {string} blockIndex The insertion index. * @property {string} rootClientId The root client id for the block. * @property {string|undefined} clientId The client id for the block. * @property {'top'|'bottom'|'inside'} dropPosition The position relative to the block that the user is dropping to. * 'inside' refers to nesting as an inner block. */ /** * Is the point contained by the rectangle. * * @param {WPPoint} point The point. * @param {DOMRect} rect The rectangle. * * @return {boolean} True if the point is contained by the rectangle, false otherwise. */ function isPointContainedByRect(point, rect) { return rect.left <= point.x && rect.right >= point.x && rect.top <= point.y && rect.bottom >= point.y; } /** * Determines whether the user positioning the dragged block to nest as an * inner block. * * Presently this is determined by whether the cursor is on the right hand side * of the block. * * @param {WPPoint} point The point representing the cursor position when dragging. * @param {DOMRect} rect The rectangle. */ function isNestingGesture(point, rect) { const blockCenterX = rect.left + rect.width / 2; return point.x > blockCenterX; } // Block navigation is always a vertical list, so only allow dropping // to the above or below a block. const ALLOWED_DROP_EDGES = ['top', 'bottom']; /** * Given blocks data and the cursor position, compute the drop target. * * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view. * @param {WPPoint} position The point representing the cursor position when dragging. * * @return {WPListViewDropZoneTarget} An object containing data about the drop target. */ function getListViewDropTarget(blocksData, position) { let candidateEdge; let candidateBlockData; let candidateDistance; let candidateRect; for (const blockData of blocksData) { if (blockData.isDraggedBlock) { continue; } const rect = blockData.element.getBoundingClientRect(); const [distance, edge] = Object(math["a" /* getDistanceToNearestEdge */])(position, rect, ALLOWED_DROP_EDGES); const isCursorWithinBlock = isPointContainedByRect(position, rect); if (candidateDistance === undefined || distance < candidateDistance || isCursorWithinBlock) { candidateDistance = distance; const index = blocksData.indexOf(blockData); const previousBlockData = blocksData[index - 1]; // If dragging near the top of a block and the preceding block // is at the same level, use the preceding block as the candidate // instead, as later it makes determining a nesting drop easier. if (edge === 'top' && previousBlockData && previousBlockData.rootClientId === blockData.rootClientId && !previousBlockData.isDraggedBlock) { candidateBlockData = previousBlockData; candidateEdge = 'bottom'; candidateRect = previousBlockData.element.getBoundingClientRect(); } else { candidateBlockData = blockData; candidateEdge = edge; candidateRect = rect; } // If the mouse position is within the block, break early // as the user would intend to drop either before or after // this block. // // This solves an issue where some rows in the list view // tree overlap slightly due to sub-pixel rendering. if (isCursorWithinBlock) { break; } } } if (!candidateBlockData) { return; } const isDraggingBelow = candidateEdge === 'bottom'; // If the user is dragging towards the bottom of the block check whether // they might be trying to nest the block as a child. // If the block already has inner blocks, this should always be treated // as nesting since the next block in the tree will be the first child. if (isDraggingBelow && candidateBlockData.canInsertDraggedBlocksAsChild && (candidateBlockData.innerBlockCount > 0 || isNestingGesture(position, candidateRect))) { return { rootClientId: candidateBlockData.clientId, blockIndex: 0, dropPosition: 'inside' }; } // If dropping as a sibling, but block cannot be inserted in // this context, return early. if (!candidateBlockData.canInsertDraggedBlocksAsSibling) { return; } const offset = isDraggingBelow ? 1 : 0; return { rootClientId: candidateBlockData.rootClientId, clientId: candidateBlockData.clientId, blockIndex: candidateBlockData.blockIndex + offset, dropPosition: candidateEdge }; } /** * A react hook for implementing a drop zone in list view. * * @return {WPListViewDropZoneTarget} The drop target. */ function useListViewDropZone() { const { getBlockRootClientId, getBlockIndex, getBlockCount, getDraggedBlockClientIds, canInsertBlocks } = Object(external_wp_data_["useSelect"])(store["a" /* store */]); const [target, setTarget] = Object(external_wp_element_["useState"])(); const { rootClientId: targetRootClientId, blockIndex: targetBlockIndex } = target || {}; const onBlockDrop = Object(use_on_block_drop["a" /* default */])(targetRootClientId, targetBlockIndex); const draggedBlockClientIds = getDraggedBlockClientIds(); const throttled = Object(external_wp_compose_["useThrottle"])(Object(external_wp_element_["useCallback"])((event, currentTarget) => { const position = { x: event.clientX, y: event.clientY }; const isBlockDrag = !!(draggedBlockClientIds !== null && draggedBlockClientIds !== void 0 && draggedBlockClientIds.length); const blockElements = Array.from(currentTarget.querySelectorAll('[data-block]')); const blocksData = blockElements.map(blockElement => { const clientId = blockElement.dataset.block; const rootClientId = getBlockRootClientId(clientId); return { clientId, rootClientId, blockIndex: getBlockIndex(clientId, rootClientId), element: blockElement, isDraggedBlock: isBlockDrag ? draggedBlockClientIds.includes(clientId) : false, innerBlockCount: getBlockCount(clientId), canInsertDraggedBlocksAsSibling: isBlockDrag ? canInsertBlocks(draggedBlockClientIds, rootClientId) : true, canInsertDraggedBlocksAsChild: isBlockDrag ? canInsertBlocks(draggedBlockClientIds, clientId) : true }; }); const newTarget = getListViewDropTarget(blocksData, position); if (newTarget) { setTarget(newTarget); } }, [draggedBlockClientIds]), 200); const ref = Object(external_wp_compose_["__experimentalUseDropZone"])({ onDrop: onBlockDrop, onDragOver(event) { // `currentTarget` is only available while the event is being // handled, so get it now and pass it to the thottled function. // https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget throttled(event, event.currentTarget); }, onDragEnd() { throttled.cancel(); setTarget(null); } }); return { ref, target }; } // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const noop = () => {}; const list_view_expanded = (state, action) => { switch (action.type) { case 'expand': return { ...state, ...{ [action.clientId]: true } }; case 'collapse': return { ...state, ...{ [action.clientId]: false } }; default: return state; } }; /** * Wrap `ListViewRows` with `TreeGrid`. ListViewRows is a * recursive component (it renders itself), so this ensures TreeGrid is only * present at the very top of the navigation grid. * * @param {Object} props Components props. * @param {Array} props.blocks Custom subset of block client IDs to be used instead of the default hierarchy. * @param {Function} props.onSelect Block selection callback. * @param {boolean} props.showNestedBlocks Flag to enable displaying nested blocks. * @param {boolean} props.showBlockMovers Flag to enable block movers * @param {boolean} props.__experimentalFeatures Flag to enable experimental features. * @param {boolean} props.__experimentalPersistentListViewFeatures Flag to enable features for the Persistent List View experiment. * @param {boolean} props.__experimentalHideContainerBlockActions Flag to hide actions of top level blocks (like core/widget-area) * @param {Object} ref Forwarded ref */ function ListView({ blocks, onSelect = noop, __experimentalFeatures, __experimentalPersistentListViewFeatures, __experimentalHideContainerBlockActions, showNestedBlocks, showBlockMovers, ...props }, ref) { const { clientIdsTree, draggedClientIds, selectedClientIds } = useListViewClientIds(blocks); const { selectBlock } = Object(external_wp_data_["useDispatch"])(store["a" /* store */]); const { visibleBlockCount } = Object(external_wp_data_["useSelect"])(select => { const { getGlobalBlockCount, getClientIdsOfDescendants } = select(store["a" /* store */]); const draggedBlockCount = (draggedClientIds === null || draggedClientIds === void 0 ? void 0 : draggedClientIds.length) > 0 ? getClientIdsOfDescendants(draggedClientIds).length + 1 : 0; return { visibleBlockCount: getGlobalBlockCount() - draggedBlockCount }; }, [draggedClientIds]); const selectEditorBlock = Object(external_wp_element_["useCallback"])(clientId => { selectBlock(clientId); onSelect(clientId); }, [selectBlock, onSelect]); const [expandedState, setExpandedState] = Object(external_wp_element_["useReducer"])(list_view_expanded, {}); const { ref: dropZoneRef, target: blockDropTarget } = useListViewDropZone(); const elementRef = Object(external_wp_element_["useRef"])(); const treeGridRef = Object(external_wp_compose_["useMergeRefs"])([elementRef, dropZoneRef, ref]); const isMounted = Object(external_wp_element_["useRef"])(false); Object(external_wp_element_["useEffect"])(() => { isMounted.current = true; }, []); // 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. // See: https://github.com/WordPress/gutenberg/pull/35230 for additional context. const [fixedListWindow] = Object(external_wp_compose_["__experimentalUseFixedWindowList"])(elementRef, 36, visibleBlockCount, { useWindowing: __experimentalPersistentListViewFeatures, windowOverscan: 40 }); const expand = Object(external_wp_element_["useCallback"])(clientId => { if (!clientId) { return; } setExpandedState({ type: 'expand', clientId }); }, [setExpandedState]); const collapse = Object(external_wp_element_["useCallback"])(clientId => { if (!clientId) { return; } setExpandedState({ type: 'collapse', clientId }); }, [setExpandedState]); const expandRow = Object(external_wp_element_["useCallback"])(row => { var _row$dataset; expand(row === null || row === void 0 ? void 0 : (_row$dataset = row.dataset) === null || _row$dataset === void 0 ? void 0 : _row$dataset.block); }, [expand]); const collapseRow = Object(external_wp_element_["useCallback"])(row => { var _row$dataset2; collapse(row === null || row === void 0 ? void 0 : (_row$dataset2 = row.dataset) === null || _row$dataset2 === void 0 ? void 0 : _row$dataset2.block); }, [collapse]); const contextValue = Object(external_wp_element_["useMemo"])(() => ({ __experimentalFeatures, __experimentalPersistentListViewFeatures, __experimentalHideContainerBlockActions, isTreeGridMounted: isMounted.current, draggedClientIds, expandedState, expand, collapse }), [__experimentalFeatures, __experimentalPersistentListViewFeatures, __experimentalHideContainerBlockActions, isMounted.current, draggedClientIds, expandedState, expand, collapse]); return Object(external_wp_element_["createElement"])(external_wp_data_["AsyncModeProvider"], { value: true }, Object(external_wp_element_["createElement"])(ListViewDropIndicator, { listViewRef: elementRef, blockDropTarget: blockDropTarget }), Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalTreeGrid"], { className: "block-editor-list-view-tree", "aria-label": Object(external_wp_i18n_["__"])('Block navigation structure'), ref: treeGridRef, onCollapseRow: collapseRow, onExpandRow: expandRow }, Object(external_wp_element_["createElement"])(ListViewContext.Provider, { value: contextValue }, Object(external_wp_element_["createElement"])(branch, Object(esm_extends["a" /* default */])({ blocks: clientIdsTree, selectBlock: selectEditorBlock, showNestedBlocks: showNestedBlocks, showBlockMovers: showBlockMovers, fixedListWindow: fixedListWindow, selectedClientIds: selectedClientIds }, props))))); } /* harmony default export */ var components_list_view = (Object(external_wp_element_["forwardRef"])(ListView)); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/dropdown.js /** * WordPress dependencies */ /** * Internal dependencies */ function BlockNavigationDropdownToggle({ isEnabled, onToggle, isOpen, innerRef, ...props }) { return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, props, { ref: innerRef, icon: list_view["a" /* default */], "aria-expanded": isOpen, "aria-haspopup": "true", onClick: isEnabled ? onToggle : undefined /* translators: button label text should, if possible, be under 16 characters. */ , label: Object(external_wp_i18n_["__"])('List view'), className: "block-editor-block-navigation", "aria-disabled": !isEnabled })); } function BlockNavigationDropdown({ isDisabled, __experimentalFeatures, ...props }, ref) { const hasBlocks = Object(external_wp_data_["useSelect"])(select => !!select(store["a" /* store */]).getBlockCount(), []); const isEnabled = hasBlocks && !isDisabled; return Object(external_wp_element_["createElement"])(external_wp_components_["Dropdown"], { contentClassName: "block-editor-block-navigation__popover", position: "bottom right", renderToggle: ({ isOpen, onToggle }) => Object(external_wp_element_["createElement"])(BlockNavigationDropdownToggle, Object(esm_extends["a" /* default */])({}, props, { innerRef: ref, isOpen: isOpen, onToggle: onToggle, isEnabled: isEnabled })), renderContent: () => Object(external_wp_element_["createElement"])("div", { className: "block-editor-block-navigation__container" }, Object(external_wp_element_["createElement"])("p", { className: "block-editor-block-navigation__label" }, Object(external_wp_i18n_["__"])('List view')), Object(external_wp_element_["createElement"])(components_list_view, { showNestedBlocks: true, __experimentalFeatures: __experimentalFeatures })) }); } /* harmony default export */ var dropdown = (Object(external_wp_element_["forwardRef"])(BlockNavigationDropdown)); // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js var layout = __webpack_require__("Civd"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-variation-picker/index.js /** * External dependencies */ /** * WordPress dependencies */ function BlockVariationPicker({ icon = layout["a" /* default */], label = Object(external_wp_i18n_["__"])('Choose variation'), instructions = Object(external_wp_i18n_["__"])('Select a variation to start with.'), variations, onSelect, allowSkip }) { const classes = classnames_default()('block-editor-block-variation-picker', { 'has-many-variations': variations.length > 4 }); return Object(external_wp_element_["createElement"])(external_wp_components_["Placeholder"], { icon: icon, label: label, instructions: instructions, className: classes }, Object(external_wp_element_["createElement"])("ul", { className: "block-editor-block-variation-picker__variations", role: "list", "aria-label": Object(external_wp_i18n_["__"])('Block variations') }, variations.map(variation => Object(external_wp_element_["createElement"])("li", { key: variation.name }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { variant: "secondary", icon: variation.icon, iconSize: 48, onClick: () => onSelect(variation), className: "block-editor-block-variation-picker__variation", label: variation.description || variation.title }), Object(external_wp_element_["createElement"])("span", { className: "block-editor-block-variation-picker__variation-label", role: "presentation" }, variation.title)))), allowSkip && Object(external_wp_element_["createElement"])("div", { className: "block-editor-block-variation-picker__skip" }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { variant: "link", onClick: () => onSelect() }, Object(external_wp_i18n_["__"])('Skip')))); } /* harmony default export */ var block_variation_picker = (BlockVariationPicker); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-preview/index.js + 2 modules var block_preview = __webpack_require__("REKd"); // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left.js var chevron_left = __webpack_require__("2gm7"); // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right.js var chevron_right = __webpack_require__("1iEr"); // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/stretch-full-width.js var stretch_full_width = __webpack_require__("XNw2"); // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/grid.js var grid = __webpack_require__("b2RC"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/constants.js const VIEWMODES = { carousel: 'carousel', grid: 'grid' }; // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/setup-toolbar.js /** * WordPress dependencies */ /** * Internal dependencies */ const Actions = ({ onStartBlank, onBlockPatternSelect }) => Object(external_wp_element_["createElement"])("div", { className: "block-editor-block-pattern-setup__actions" }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { onClick: onStartBlank }, Object(external_wp_i18n_["__"])('Start blank')), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { variant: "primary", onClick: onBlockPatternSelect }, Object(external_wp_i18n_["__"])('Choose'))); const CarouselNavigation = ({ handlePrevious, handleNext, activeSlide, totalSlides }) => Object(external_wp_element_["createElement"])("div", { className: "block-editor-block-pattern-setup__navigation" }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { icon: chevron_left["a" /* default */], label: Object(external_wp_i18n_["__"])('Previous pattern'), onClick: handlePrevious, disabled: activeSlide === 0 }), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { icon: chevron_right["a" /* default */], label: Object(external_wp_i18n_["__"])('Next pattern'), onClick: handleNext, disabled: activeSlide === totalSlides - 1 })); const SetupToolbar = ({ viewMode, setViewMode, handlePrevious, handleNext, activeSlide, totalSlides, onBlockPatternSelect, onStartBlank }) => { const isCarouselView = viewMode === VIEWMODES.carousel; const displayControls = Object(external_wp_element_["createElement"])("div", { className: "block-editor-block-pattern-setup__display-controls" }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { icon: stretch_full_width["a" /* default */], label: Object(external_wp_i18n_["__"])('Carousel view'), onClick: () => setViewMode(VIEWMODES.carousel), isPressed: isCarouselView }), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { icon: grid["a" /* default */], label: Object(external_wp_i18n_["__"])('Grid view'), onClick: () => setViewMode(VIEWMODES.grid), isPressed: viewMode === VIEWMODES.grid })); return Object(external_wp_element_["createElement"])("div", { className: "block-editor-block-pattern-setup__toolbar" }, isCarouselView && Object(external_wp_element_["createElement"])(CarouselNavigation, { handlePrevious: handlePrevious, handleNext: handleNext, activeSlide: activeSlide, totalSlides: totalSlides }), displayControls, isCarouselView && Object(external_wp_element_["createElement"])(Actions, { onBlockPatternSelect: onBlockPatternSelect, onStartBlank: onStartBlank })); }; /* harmony default export */ var setup_toolbar = (SetupToolbar); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/use-patterns-setup.js /** * WordPress dependencies */ /** * Internal dependencies */ function usePatternsSetup(clientId, blockName, filterPatternsFn) { return Object(external_wp_data_["useSelect"])(select => { const { getBlockRootClientId, __experimentalGetPatternsByBlockTypes, __experimentalGetAllowedPatterns } = select(store["a" /* store */]); const rootClientId = getBlockRootClientId(clientId); if (filterPatternsFn) { return __experimentalGetAllowedPatterns(rootClientId).filter(filterPatternsFn); } return __experimentalGetPatternsByBlockTypes(blockName, rootClientId); }, [clientId, blockName, filterPatternsFn]); } /* harmony default export */ var use_patterns_setup = (usePatternsSetup); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const SetupContent = ({ viewMode, activeSlide, patterns, onBlockPatternSelect }) => { const composite = Object(external_wp_components_["__unstableUseCompositeState"])(); 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 Object(external_wp_element_["createElement"])("div", { className: containerClass }, Object(external_wp_element_["createElement"])("ul", { className: "carousel-container" }, patterns.map((pattern, index) => Object(external_wp_element_["createElement"])(BlockPatternSlide, { className: slideClass.get(index) || '', key: pattern.name, pattern: pattern })))); } return Object(external_wp_element_["createElement"])(external_wp_components_["__unstableComposite"], Object(esm_extends["a" /* default */])({}, composite, { role: "listbox", className: containerClass, "aria-label": Object(external_wp_i18n_["__"])('Patterns list') }), patterns.map(pattern => Object(external_wp_element_["createElement"])(BlockPattern, { key: pattern.name, pattern: pattern, onSelect: onBlockPatternSelect, composite: composite }))); }; function BlockPattern({ pattern, onSelect, composite }) { const baseClassName = 'block-editor-block-pattern-setup-list'; const { blocks, title, description, viewportWidth = 700 } = pattern; const descriptionId = Object(external_wp_compose_["useInstanceId"])(BlockPattern, `${baseClassName}__item-description`); return Object(external_wp_element_["createElement"])("div", { className: `${baseClassName}__list-item`, "aria-label": pattern.title, "aria-describedby": pattern.description ? descriptionId : undefined }, Object(external_wp_element_["createElement"])(external_wp_components_["__unstableCompositeItem"], Object(esm_extends["a" /* default */])({ role: "option", as: "div" }, composite, { className: `${baseClassName}__item`, onClick: () => onSelect(blocks) }), Object(external_wp_element_["createElement"])(block_preview["a" /* default */], { blocks: blocks, viewportWidth: viewportWidth }), Object(external_wp_element_["createElement"])("div", { className: `${baseClassName}__item-title` }, title)), !!description && Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { id: descriptionId }, description)); } function BlockPatternSlide({ className, pattern }) { const { blocks, title, description } = pattern; const descriptionId = Object(external_wp_compose_["useInstanceId"])(BlockPatternSlide, 'block-editor-block-pattern-setup-list__item-description'); return Object(external_wp_element_["createElement"])("li", { className: `pattern-slide ${className}`, "aria-label": title, "aria-describedby": description ? descriptionId : undefined }, Object(external_wp_element_["createElement"])(block_preview["a" /* default */], { blocks: blocks, __experimentalLive: true }), !!description && Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { id: descriptionId }, description)); } const BlockPatternSetup = ({ clientId, blockName, filterPatternsFn, startBlankComponent, onBlockPatternSelect }) => { const [viewMode, setViewMode] = Object(external_wp_element_["useState"])(VIEWMODES.carousel); const [activeSlide, setActiveSlide] = Object(external_wp_element_["useState"])(0); const [showBlank, setShowBlank] = Object(external_wp_element_["useState"])(false); const { replaceBlock } = Object(external_wp_data_["useDispatch"])(store["a" /* store */]); const patterns = use_patterns_setup(clientId, blockName, filterPatternsFn); if (!(patterns !== null && patterns !== void 0 && patterns.length) || showBlank) { return startBlankComponent; } const onBlockPatternSelectDefault = blocks => { const clonedBlocks = blocks.map(block => Object(external_wp_blocks_["cloneBlock"])(block)); replaceBlock(clientId, clonedBlocks); }; const onPatternSelectCallback = onBlockPatternSelect || onBlockPatternSelectDefault; return Object(external_wp_element_["createElement"])("div", { className: `block-editor-block-pattern-setup view-mode-${viewMode}` }, Object(external_wp_element_["createElement"])(setup_toolbar, { viewMode: viewMode, setViewMode: setViewMode, activeSlide: activeSlide, totalSlides: patterns.length, handleNext: () => { setActiveSlide(active => active + 1); }, handlePrevious: () => { setActiveSlide(active => active - 1); }, onBlockPatternSelect: () => { onPatternSelectCallback(patterns[activeSlide].blocks); }, onStartBlank: () => { setShowBlank(true); } }), Object(external_wp_element_["createElement"])(SetupContent, { viewMode: viewMode, activeSlide: activeSlide, patterns: patterns, onBlockPatternSelect: onPatternSelectCallback })); }; /* harmony default export */ var block_pattern_setup = (BlockPatternSetup); // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-down.js var chevron_down = __webpack_require__("NWDH"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/block-variation-transforms.js var block_variation_transforms = __webpack_require__("Btt3"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-variation-transforms/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function __experimentalBlockVariationTransforms({ blockClientId }) { const [selectedValue, setSelectedValue] = Object(external_wp_element_["useState"])(); const { updateBlockAttributes } = Object(external_wp_data_["useDispatch"])(store["a" /* store */]); const { variations, blockAttributes } = Object(external_wp_data_["useSelect"])(select => { const { getBlockVariations } = select(external_wp_blocks_["store"]); const { getBlockName, getBlockAttributes } = select(store["a" /* store */]); const blockName = blockClientId && getBlockName(blockClientId); return { variations: blockName && getBlockVariations(blockName, 'transform'), blockAttributes: getBlockAttributes(blockClientId) }; }, [blockClientId]); Object(external_wp_element_["useEffect"])(() => { var _getMatchingVariation; setSelectedValue((_getMatchingVariation = Object(block_variation_transforms["a" /* __experimentalGetMatchingVariation */])(blockAttributes, variations)) === null || _getMatchingVariation === void 0 ? void 0 : _getMatchingVariation.name); }, [blockAttributes, variations]); if (!(variations !== null && variations !== void 0 && variations.length)) return null; const selectOptions = variations.map(({ name, title, description }) => ({ value: name, label: title, info: description })); const onSelectVariation = variationName => { updateBlockAttributes(blockClientId, { ...variations.find(({ name }) => name === variationName).attributes }); }; const baseClass = 'block-editor-block-variation-transforms'; return Object(external_wp_element_["createElement"])(external_wp_components_["DropdownMenu"], { className: baseClass, label: Object(external_wp_i18n_["__"])('Transform to variation'), text: Object(external_wp_i18n_["__"])('Transform to variation'), popoverProps: { position: 'bottom center', className: `${baseClass}__popover` }, icon: chevron_down["a" /* default */], toggleProps: { iconPosition: 'right' } }, () => Object(external_wp_element_["createElement"])("div", { className: `${baseClass}__container` }, Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], null, Object(external_wp_element_["createElement"])(external_wp_components_["MenuItemsChoice"], { choices: selectOptions, value: selectedValue, onSelect: onSelectVariation })))); } /* harmony default export */ var components_block_variation_transforms = (__experimentalBlockVariationTransforms); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-vertical-alignment-control/icons.js /** * WordPress dependencies */ const alignBottom = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" }, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { d: "M15 4H9v11h6V4zM4 18.5V20h16v-1.5H4z" })); const alignCenter = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" }, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { d: "M20 11h-5V4H9v7H4v1.5h5V20h6v-7.5h5z" })); const alignTop = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" }, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { d: "M9 20h6V9H9v11zM4 4v1.5h16V4H4z" })); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-vertical-alignment-control/ui.js /** * WordPress dependencies */ /** * Internal dependencies */ const BLOCK_ALIGNMENTS_CONTROLS = { top: { icon: alignTop, title: Object(external_wp_i18n_["_x"])('Align top', 'Block vertical alignment setting') }, center: { icon: alignCenter, title: Object(external_wp_i18n_["_x"])('Align middle', 'Block vertical alignment setting') }, bottom: { icon: alignBottom, title: Object(external_wp_i18n_["_x"])('Align bottom', 'Block vertical alignment setting') } }; const DEFAULT_CONTROLS = ['top', 'center', 'bottom']; const DEFAULT_CONTROL = 'top'; const block_vertical_alignment_control_ui_POPOVER_PROPS = { isAlternate: true }; function BlockVerticalAlignmentUI({ value, onChange, controls = DEFAULT_CONTROLS, isCollapsed = true, isToolbar }) { function applyOrUnset(align) { return () => onChange(value === align ? undefined : align); } const activeAlignment = BLOCK_ALIGNMENTS_CONTROLS[value]; const defaultAlignmentControl = BLOCK_ALIGNMENTS_CONTROLS[DEFAULT_CONTROL]; const UIComponent = isToolbar ? external_wp_components_["ToolbarGroup"] : external_wp_components_["ToolbarDropdownMenu"]; const extraProps = isToolbar ? { isCollapsed } : {}; return Object(external_wp_element_["createElement"])(UIComponent, Object(esm_extends["a" /* default */])({ popoverProps: block_vertical_alignment_control_ui_POPOVER_PROPS, icon: activeAlignment ? activeAlignment.icon : defaultAlignmentControl.icon, label: Object(external_wp_i18n_["_x"])('Change vertical alignment', 'Block vertical alignment setting label'), controls: controls.map(control => { return { ...BLOCK_ALIGNMENTS_CONTROLS[control], isActive: value === control, role: isCollapsed ? 'menuitemradio' : undefined, onClick: applyOrUnset(control) }; }) }, extraProps)); } /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-vertical-alignment-toolbar/README.md */ /* harmony default export */ var block_vertical_alignment_control_ui = (BlockVerticalAlignmentUI); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-vertical-alignment-control/index.js /** * Internal dependencies */ function BlockVerticalAlignmentControl(props) { return Object(external_wp_element_["createElement"])(block_vertical_alignment_control_ui, Object(esm_extends["a" /* default */])({}, props, { isToolbar: false })); } function BlockVerticalAlignmentToolbar(props) { return Object(external_wp_element_["createElement"])(block_vertical_alignment_control_ui, Object(esm_extends["a" /* default */])({}, props, { isToolbar: true })); } // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/index.js + 4 modules var border_radius_control = __webpack_require__("Wy3j"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/border-style-control/index.js + 2 modules var border_style_control = __webpack_require__("2YCo"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/button-block-appender/index.js var button_block_appender = __webpack_require__("I5Hl"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-setting/index.js var use_setting = __webpack_require__("v5LD"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/color-palette/with-color-context.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /* harmony default export */ var with_color_context = (Object(external_wp_compose_["createHigherOrderComponent"])(WrappedComponent => { return props => { const colorsFeature = Object(use_setting["a" /* default */])('color.palette'); const disableCustomColorsFeature = !Object(use_setting["a" /* default */])('color.custom'); const colors = props.colors === undefined ? colorsFeature : props.colors; const disableCustomColors = props.disableCustomColors === undefined ? disableCustomColorsFeature : props.disableCustomColors; const hasColorsToChoose = !Object(external_lodash_["isEmpty"])(colors) || !disableCustomColors; return Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, props, { colors, disableCustomColors, hasColorsToChoose })); }; }, 'withColorContext')); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/color-palette/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /* harmony default export */ var color_palette = (with_color_context(external_wp_components_["ColorPalette"])); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/control.js var control = __webpack_require__("hMaJ"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/color-palette/control.js /** * Internal dependencies */ function ColorPaletteControl({ onChange, value, ...otherProps }) { return Object(external_wp_element_["createElement"])(control["a" /* default */], Object(esm_extends["a" /* default */])({}, otherProps, { onColorChange: onChange, colorValue: value, gradients: [], disableCustomGradients: true })); } // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/contrast-checker/index.js var contrast_checker = __webpack_require__("6c9H"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/duotone-control/index.js var duotone_control = __webpack_require__("1uGa"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/font-appearance-control/index.js var font_appearance_control = __webpack_require__("Bo0k"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/font-family/index.js var font_family = __webpack_require__("GKUk"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/letter-spacing-control/index.js var letter_spacing_control = __webpack_require__("xBDm"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/text-decoration-control/index.js + 1 modules var text_decoration_control = __webpack_require__("kVRd"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/text-transform-control/index.js + 3 modules var text_transform_control = __webpack_require__("/Hvg"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/panel-color-gradient-settings.js var panel_color_gradient_settings = __webpack_require__("yU1v"); // 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; } // EXTERNAL MODULE: external "React" var external_React_ = __webpack_require__("cDcd"); var external_React_default = /*#__PURE__*/__webpack_require__.n(external_React_); // EXTERNAL MODULE: ./node_modules/normalize-wheel/index.js var normalize_wheel = __webpack_require__("wJiJ"); var normalize_wheel_default = /*#__PURE__*/__webpack_require__.n(normalize_wheel); // CONCATENATED MODULE: ./node_modules/react-easy-crop/index.module.js /** * Compute the dimension of the crop area based on media size, * aspect ratio and optionally rotation */ function getCropSize(mediaWidth, mediaHeight, containerWidth, containerHeight, aspect, rotation) { if (rotation === void 0) { rotation = 0; } var _a = translateSize(mediaWidth, mediaHeight, rotation), width = _a.width, height = _a.height; var fittingWidth = Math.min(width, containerWidth); var fittingHeight = Math.min(height, containerHeight); if (fittingWidth > fittingHeight * aspect) { return { width: fittingHeight * aspect, height: fittingHeight }; } return { width: fittingWidth, height: fittingWidth / aspect }; } /** * Ensure a new media position stays in the crop area. */ function index_module_restrictPosition(position, mediaSize, cropSize, zoom, rotation) { if (rotation === void 0) { rotation = 0; } var _a = translateSize(mediaSize.width, mediaSize.height, rotation), width = _a.width, height = _a.height; return { x: restrictPositionCoord(position.x, width, cropSize.width, zoom), y: restrictPositionCoord(position.y, height, cropSize.height, zoom) }; } function restrictPositionCoord(position, mediaSize, cropSize, zoom) { var maxPosition = mediaSize * zoom / 2 - cropSize / 2; return Math.min(maxPosition, Math.max(position, -maxPosition)); } function getDistanceBetweenPoints(pointA, pointB) { return Math.sqrt(Math.pow(pointA.y - pointB.y, 2) + Math.pow(pointA.x - pointB.x, 2)); } function getRotationBetweenPoints(pointA, pointB) { return Math.atan2(pointB.y - pointA.y, pointB.x - pointA.x) * 180 / Math.PI; } /** * Compute the output cropped area of the media in percentages and pixels. * x/y are the top-left coordinates on the src media */ function computeCroppedArea(crop, mediaSize, cropSize, aspect, zoom, rotation, restrictPosition) { if (rotation === void 0) { rotation = 0; } if (restrictPosition === void 0) { restrictPosition = true; } // if the media is rotated by the user, we cannot limit the position anymore // as it might need to be negative. var limitAreaFn = restrictPosition && rotation === 0 ? limitArea : noOp; var croppedAreaPercentages = { x: limitAreaFn(100, ((mediaSize.width - cropSize.width / zoom) / 2 - crop.x / zoom) / mediaSize.width * 100), y: limitAreaFn(100, ((mediaSize.height - cropSize.height / zoom) / 2 - crop.y / zoom) / mediaSize.height * 100), width: limitAreaFn(100, cropSize.width / mediaSize.width * 100 / zoom), height: limitAreaFn(100, cropSize.height / mediaSize.height * 100 / zoom) }; // we compute the pixels size naively var widthInPixels = Math.round(limitAreaFn(mediaSize.naturalWidth, croppedAreaPercentages.width * mediaSize.naturalWidth / 100)); var heightInPixels = Math.round(limitAreaFn(mediaSize.naturalHeight, croppedAreaPercentages.height * mediaSize.naturalHeight / 100)); var isImgWiderThanHigh = mediaSize.naturalWidth >= mediaSize.naturalHeight * aspect; // then we ensure the width and height exactly match the aspect (to avoid rounding approximations) // if the media is wider than high, when zoom is 0, the crop height will be equals to iamge height // thus we want to compute the width from the height and aspect for accuracy. // Otherwise, we compute the height from width and aspect. var sizePixels = isImgWiderThanHigh ? { width: Math.round(heightInPixels * aspect), height: heightInPixels } : { width: widthInPixels, height: Math.round(widthInPixels / aspect) }; var croppedAreaPixels = __assign(__assign({}, sizePixels), { x: Math.round(limitAreaFn(mediaSize.naturalWidth - sizePixels.width, croppedAreaPercentages.x * mediaSize.naturalWidth / 100)), y: Math.round(limitAreaFn(mediaSize.naturalHeight - sizePixels.height, croppedAreaPercentages.y * mediaSize.naturalHeight / 100)) }); return { croppedAreaPercentages: croppedAreaPercentages, croppedAreaPixels: croppedAreaPixels }; } /** * Ensure the returned value is between 0 and max */ function limitArea(max, value) { return Math.min(max, Math.max(0, value)); } function noOp(_max, value) { return value; } /** * Compute the crop and zoom from the croppedAreaPixels */ function getZoomFromCroppedAreaPixels(croppedAreaPixels, mediaSize, cropSize) { var mediaZoom = mediaSize.width / mediaSize.naturalWidth; if (cropSize) { var isHeightMaxSize_1 = cropSize.height > cropSize.width; return isHeightMaxSize_1 ? cropSize.height / mediaZoom / croppedAreaPixels.height : cropSize.width / mediaZoom / croppedAreaPixels.width; } var aspect = croppedAreaPixels.width / croppedAreaPixels.height; var isHeightMaxSize = mediaSize.naturalWidth >= mediaSize.naturalHeight * aspect; return isHeightMaxSize ? mediaSize.naturalHeight / croppedAreaPixels.height : mediaSize.naturalWidth / croppedAreaPixels.width; } /** * Compute the crop and zoom from the croppedAreaPixels */ function getInitialCropFromCroppedAreaPixels(croppedAreaPixels, mediaSize, cropSize) { var mediaZoom = mediaSize.width / mediaSize.naturalWidth; var zoom = getZoomFromCroppedAreaPixels(croppedAreaPixels, mediaSize, cropSize); var cropZoom = mediaZoom * zoom; var crop = { x: ((mediaSize.naturalWidth - croppedAreaPixels.width) / 2 - croppedAreaPixels.x) * cropZoom, y: ((mediaSize.naturalHeight - croppedAreaPixels.height) / 2 - croppedAreaPixels.y) * cropZoom }; return { crop: crop, zoom: zoom }; } /** * Return the point that is the center of point a and b */ function getCenter(a, b) { return { x: (b.x + a.x) / 2, y: (b.y + a.y) / 2 }; } /** * * Returns an x,y point once rotated around xMid,yMid */ function rotateAroundMidPoint(x, y, xMid, yMid, degrees) { var cos = Math.cos; var sin = Math.sin; var radian = degrees * Math.PI / 180; // Convert to radians // Subtract midpoints, so that midpoint is translated to origin // and add it in the end again var xr = (x - xMid) * cos(radian) - (y - yMid) * sin(radian) + xMid; var yr = (x - xMid) * sin(radian) + (y - yMid) * cos(radian) + yMid; return [xr, yr]; } /** * Returns the new bounding area of a rotated rectangle. */ function translateSize(width, height, rotation) { var centerX = width / 2; var centerY = height / 2; var outerBounds = [rotateAroundMidPoint(0, 0, centerX, centerY, rotation), rotateAroundMidPoint(width, 0, centerX, centerY, rotation), rotateAroundMidPoint(width, height, centerX, centerY, rotation), rotateAroundMidPoint(0, height, centerX, centerY, rotation)]; var minX = Math.min.apply(Math, outerBounds.map(function (p) { return p[0]; })); var maxX = Math.max.apply(Math, outerBounds.map(function (p) { return p[0]; })); var minY = Math.min.apply(Math, outerBounds.map(function (p) { return p[1]; })); var maxY = Math.max.apply(Math, outerBounds.map(function (p) { return p[1]; })); return { width: maxX - minX, height: maxY - minY }; } /** * Combine multiple class names into a single string. */ function classNames() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } return args.filter(function (value) { if (typeof value === 'string' && value.length > 0) { return true; } return false; }).join(' ').trim(); } 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_Cropper = /** @class */ function (_super) { __extends(Cropper, _super); function Cropper() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.imageRef = null; _this.videoRef = null; _this.containerRef = null; _this.styleRef = null; _this.containerRect = null; _this.mediaSize = { width: 0, height: 0, naturalWidth: 0, naturalHeight: 0 }; _this.dragStartPosition = { x: 0, y: 0 }; _this.dragStartCrop = { x: 0, y: 0 }; _this.lastPinchDistance = 0; _this.lastPinchRotation = 0; _this.rafDragTimeout = null; _this.rafPinchTimeout = null; _this.wheelTimer = null; _this.state = { cropSize: null, hasWheelJustStarted: false }; // this is to prevent Safari on iOS >= 10 to zoom the page _this.preventZoomSafari = function (e) { return e.preventDefault(); }; _this.cleanEvents = function () { document.removeEventListener('mousemove', _this.onMouseMove); document.removeEventListener('mouseup', _this.onDragStopped); document.removeEventListener('touchmove', _this.onTouchMove); document.removeEventListener('touchend', _this.onDragStopped); }; _this.clearScrollEvent = function () { if (_this.containerRef) _this.containerRef.removeEventListener('wheel', _this.onWheel); if (_this.wheelTimer) { clearTimeout(_this.wheelTimer); } }; _this.onMediaLoad = function () { _this.computeSizes(); _this.emitCropData(); _this.setInitialCrop(); if (_this.props.onMediaLoaded) { _this.props.onMediaLoaded(_this.mediaSize); } }; _this.setInitialCrop = function () { var _a = _this.props, initialCroppedAreaPixels = _a.initialCroppedAreaPixels, cropSize = _a.cropSize; if (!initialCroppedAreaPixels) { return; } var _b = getInitialCropFromCroppedAreaPixels(initialCroppedAreaPixels, _this.mediaSize, cropSize), crop = _b.crop, zoom = _b.zoom; _this.props.onCropChange(crop); _this.props.onZoomChange && _this.props.onZoomChange(zoom); }; _this.computeSizes = function () { var _a, _b, _c, _d, _e, _f; var mediaRef = _this.imageRef || _this.videoRef; if (mediaRef && _this.containerRef) { _this.containerRect = _this.containerRef.getBoundingClientRect(); _this.mediaSize = { width: mediaRef.offsetWidth, height: mediaRef.offsetHeight, naturalWidth: ((_a = _this.imageRef) === null || _a === void 0 ? void 0 : _a.naturalWidth) || ((_b = _this.videoRef) === null || _b === void 0 ? void 0 : _b.videoWidth) || 0, naturalHeight: ((_c = _this.imageRef) === null || _c === void 0 ? void 0 : _c.naturalHeight) || ((_d = _this.videoRef) === null || _d === void 0 ? void 0 : _d.videoHeight) || 0 }; var cropSize = _this.props.cropSize ? _this.props.cropSize : getCropSize(mediaRef.offsetWidth, mediaRef.offsetHeight, _this.containerRect.width, _this.containerRect.height, _this.props.aspect, _this.props.rotation); if (((_e = _this.state.cropSize) === null || _e === void 0 ? void 0 : _e.height) !== cropSize.height || ((_f = _this.state.cropSize) === null || _f === void 0 ? void 0 : _f.width) !== cropSize.width) { _this.props.onCropSizeChange && _this.props.onCropSizeChange(cropSize); } _this.setState({ cropSize: cropSize }, _this.recomputeCropPosition); } }; _this.onMouseDown = function (e) { e.preventDefault(); document.addEventListener('mousemove', _this.onMouseMove); document.addEventListener('mouseup', _this.onDragStopped); _this.onDragStart(Cropper.getMousePoint(e)); }; _this.onMouseMove = function (e) { return _this.onDrag(Cropper.getMousePoint(e)); }; _this.onTouchStart = function (e) { document.addEventListener('touchmove', _this.onTouchMove, { passive: false }); // iOS 11 now defaults to passive: true document.addEventListener('touchend', _this.onDragStopped); if (e.touches.length === 2) { _this.onPinchStart(e); } else if (e.touches.length === 1) { _this.onDragStart(Cropper.getTouchPoint(e.touches[0])); } }; _this.onTouchMove = function (e) { // Prevent whole page from scrolling on iOS. e.preventDefault(); if (e.touches.length === 2) { _this.onPinchMove(e); } else if (e.touches.length === 1) { _this.onDrag(Cropper.getTouchPoint(e.touches[0])); } }; _this.onDragStart = function (_a) { var _b, _c; var x = _a.x, y = _a.y; _this.dragStartPosition = { x: x, y: y }; _this.dragStartCrop = __assign({}, _this.props.crop); (_c = (_b = _this.props).onInteractionStart) === null || _c === void 0 ? void 0 : _c.call(_b); }; _this.onDrag = function (_a) { var x = _a.x, y = _a.y; if (_this.rafDragTimeout) window.cancelAnimationFrame(_this.rafDragTimeout); _this.rafDragTimeout = window.requestAnimationFrame(function () { if (!_this.state.cropSize) return; if (x === undefined || y === undefined) return; var offsetX = x - _this.dragStartPosition.x; var offsetY = y - _this.dragStartPosition.y; var requestedPosition = { x: _this.dragStartCrop.x + offsetX, y: _this.dragStartCrop.y + offsetY }; var newPosition = _this.props.restrictPosition ? index_module_restrictPosition(requestedPosition, _this.mediaSize, _this.state.cropSize, _this.props.zoom, _this.props.rotation) : requestedPosition; _this.props.onCropChange(newPosition); }); }; _this.onDragStopped = function () { var _a, _b; _this.cleanEvents(); _this.emitCropData(); (_b = (_a = _this.props).onInteractionEnd) === null || _b === void 0 ? void 0 : _b.call(_a); }; _this.onWheel = function (e) { e.preventDefault(); var point = Cropper.getMousePoint(e); var pixelY = normalize_wheel_default()(e).pixelY; var newZoom = _this.props.zoom - pixelY * _this.props.zoomSpeed / 200; _this.setNewZoom(newZoom, point); if (!_this.state.hasWheelJustStarted) { _this.setState({ hasWheelJustStarted: true }, function () { var _a, _b; return (_b = (_a = _this.props).onInteractionStart) === null || _b === void 0 ? void 0 : _b.call(_a); }); } if (_this.wheelTimer) { clearTimeout(_this.wheelTimer); } _this.wheelTimer = window.setTimeout(function () { return _this.setState({ hasWheelJustStarted: false }, function () { var _a, _b; return (_b = (_a = _this.props).onInteractionEnd) === null || _b === void 0 ? void 0 : _b.call(_a); }); }, 250); }; _this.getPointOnContainer = function (_a) { 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) }; }; _this.getPointOnMedia = function (_a) { var x = _a.x, y = _a.y; var _b = _this.props, crop = _b.crop, zoom = _b.zoom; return { x: (x + crop.x) / zoom, y: (y + crop.y) / zoom }; }; _this.setNewZoom = function (zoom, point) { if (!_this.state.cropSize || !_this.props.onZoomChange) return; var zoomPoint = _this.getPointOnContainer(point); var zoomTarget = _this.getPointOnMedia(zoomPoint); var newZoom = Math.min(_this.props.maxZoom, Math.max(zoom, _this.props.minZoom)); var requestedPosition = { x: zoomTarget.x * newZoom - zoomPoint.x, y: zoomTarget.y * newZoom - zoomPoint.y }; var newPosition = _this.props.restrictPosition ? index_module_restrictPosition(requestedPosition, _this.mediaSize, _this.state.cropSize, newZoom, _this.props.rotation) : requestedPosition; _this.props.onCropChange(newPosition); _this.props.onZoomChange(newZoom); }; _this.getCropData = function () { if (!_this.state.cropSize) { return null; } // this is to ensure the crop is correctly restricted after a zoom back (https://github.com/ricardo-ch/react-easy-crop/issues/6) var restrictedPosition = _this.props.restrictPosition ? index_module_restrictPosition(_this.props.crop, _this.mediaSize, _this.state.cropSize, _this.props.zoom, _this.props.rotation) : _this.props.crop; return computeCroppedArea(restrictedPosition, _this.mediaSize, _this.state.cropSize, _this.getAspect(), _this.props.zoom, _this.props.rotation, _this.props.restrictPosition); }; _this.emitCropData = function () { var cropData = _this.getCropData(); if (!cropData) return; var croppedAreaPercentages = cropData.croppedAreaPercentages, croppedAreaPixels = cropData.croppedAreaPixels; if (_this.props.onCropComplete) { _this.props.onCropComplete(croppedAreaPercentages, croppedAreaPixels); } if (_this.props.onCropAreaChange) { _this.props.onCropAreaChange(croppedAreaPercentages, croppedAreaPixels); } }; _this.emitCropAreaChange = function () { var cropData = _this.getCropData(); if (!cropData) return; var croppedAreaPercentages = cropData.croppedAreaPercentages, croppedAreaPixels = cropData.croppedAreaPixels; if (_this.props.onCropAreaChange) { _this.props.onCropAreaChange(croppedAreaPercentages, croppedAreaPixels); } }; _this.recomputeCropPosition = function () { if (!_this.state.cropSize) return; var newPosition = _this.props.restrictPosition ? index_module_restrictPosition(_this.props.crop, _this.mediaSize, _this.state.cropSize, _this.props.zoom, _this.props.rotation) : _this.props.crop; _this.props.onCropChange(newPosition); _this.emitCropData(); }; return _this; } Cropper.prototype.componentDidMount = function () { window.addEventListener('resize', this.computeSizes); if (this.containerRef) { this.props.zoomWithScroll && this.containerRef.addEventListener('wheel', this.onWheel, { passive: false }); this.containerRef.addEventListener('gesturestart', this.preventZoomSafari); this.containerRef.addEventListener('gesturechange', this.preventZoomSafari); } if (!this.props.disableAutomaticStylesInjection) { this.styleRef = document.createElement('style'); this.styleRef.setAttribute('type', 'text/css'); this.styleRef.innerHTML = css_248z; document.head.appendChild(this.styleRef); } // when rendered via SSR, the image can already be loaded and its onLoad callback will never be called if (this.imageRef && this.imageRef.complete) { this.onMediaLoad(); } }; Cropper.prototype.componentWillUnmount = function () { var _a; window.removeEventListener('resize', this.computeSizes); if (this.containerRef) { this.containerRef.removeEventListener('gesturestart', this.preventZoomSafari); this.containerRef.removeEventListener('gesturechange', this.preventZoomSafari); } if (this.styleRef) { (_a = this.styleRef.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(this.styleRef); } this.cleanEvents(); this.props.zoomWithScroll && this.clearScrollEvent(); }; Cropper.prototype.componentDidUpdate = function (prevProps) { var _a, _b, _c, _d, _e, _f, _g, _h, _j; if (prevProps.rotation !== this.props.rotation) { this.computeSizes(); this.recomputeCropPosition(); } else if (prevProps.aspect !== this.props.aspect) { 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)) { this.computeSizes(); } else if (((_e = prevProps.crop) === null || _e === void 0 ? void 0 : _e.x) !== ((_f = this.props.crop) === null || _f === void 0 ? void 0 : _f.x) || ((_g = prevProps.crop) === null || _g === void 0 ? void 0 : _g.y) !== ((_h = this.props.crop) === null || _h === void 0 ? void 0 : _h.y)) { this.emitCropAreaChange(); } if (prevProps.zoomWithScroll !== this.props.zoomWithScroll && this.containerRef) { this.props.zoomWithScroll ? this.containerRef.addEventListener('wheel', this.onWheel, { passive: false }) : this.clearScrollEvent(); } if (prevProps.video !== this.props.video) { (_j = this.videoRef) === null || _j === void 0 ? void 0 : _j.load(); } }; Cropper.prototype.getAspect = function () { var _a = this.props, cropSize = _a.cropSize, aspect = _a.aspect; if (cropSize) { return cropSize.width / cropSize.height; } return aspect; }; Cropper.prototype.onPinchStart = function (e) { var pointA = Cropper.getTouchPoint(e.touches[0]); var pointB = Cropper.getTouchPoint(e.touches[1]); this.lastPinchDistance = getDistanceBetweenPoints(pointA, pointB); this.lastPinchRotation = getRotationBetweenPoints(pointA, pointB); this.onDragStart(getCenter(pointA, pointB)); }; Cropper.prototype.onPinchMove = function (e) { var _this = this; var pointA = Cropper.getTouchPoint(e.touches[0]); var pointB = Cropper.getTouchPoint(e.touches[1]); var center = getCenter(pointA, pointB); this.onDrag(center); if (this.rafPinchTimeout) window.cancelAnimationFrame(this.rafPinchTimeout); this.rafPinchTimeout = window.requestAnimationFrame(function () { var distance = getDistanceBetweenPoints(pointA, pointB); var newZoom = _this.props.zoom * (distance / _this.lastPinchDistance); _this.setNewZoom(newZoom, center); _this.lastPinchDistance = distance; var rotation = getRotationBetweenPoints(pointA, pointB); var newRotation = _this.props.rotation + (rotation - _this.lastPinchRotation); _this.props.onRotationChange && _this.props.onRotationChange(newRotation); _this.lastPinchRotation = rotation; }); }; Cropper.prototype.render = function () { var _this = this; var _a = this.props, image = _a.image, video = _a.video, mediaProps = _a.mediaProps, transform = _a.transform, _b = _a.crop, x = _b.x, y = _b.y, rotation = _a.rotation, zoom = _a.zoom, cropShape = _a.cropShape, showGrid = _a.showGrid, _c = _a.style, containerStyle = _c.containerStyle, cropAreaStyle = _c.cropAreaStyle, mediaStyle = _c.mediaStyle, _d = _a.classes, containerClassName = _d.containerClassName, cropAreaClassName = _d.cropAreaClassName, mediaClassName = _d.mediaClassName, objectFit = _a.objectFit; return /*#__PURE__*/external_React_default.a.createElement("div", { onMouseDown: this.onMouseDown, onTouchStart: this.onTouchStart, ref: function ref(el) { return _this.containerRef = el; }, "data-testid": "container", style: containerStyle, className: classNames('reactEasyCrop_Container', containerClassName) }, image ? /*#__PURE__*/external_React_default.a.createElement("img", __assign({ alt: "", 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: function ref(el) { return _this.imageRef = el; }, style: __assign(__assign({}, mediaStyle), { transform: transform || "translate(" + x + "px, " + y + "px) rotate(" + rotation + "deg) scale(" + zoom + ")" }), onLoad: this.onMediaLoad })) : video && /*#__PURE__*/external_React_default.a.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', mediaClassName) }, mediaProps, { ref: function ref(el) { return _this.videoRef = el; }, onLoadedMetadata: this.onMediaLoad, style: __assign(__assign({}, mediaStyle), { transform: transform || "translate(" + x + "px, " + y + "px) rotate(" + rotation + "deg) scale(" + zoom + ")" }), controls: false }), (Array.isArray(video) ? video : [{ src: video }]).map(function (item) { return /*#__PURE__*/external_React_default.a.createElement("source", __assign({ key: item.src }, item)); })), this.state.cropSize && /*#__PURE__*/external_React_default.a.createElement("div", { style: __assign(__assign({}, cropAreaStyle), { width: this.state.cropSize.width, height: this.state.cropSize.height }), "data-testid": "cropper", className: classNames('reactEasyCrop_CropArea', cropShape === 'round' && 'reactEasyCrop_CropAreaRound', showGrid && 'reactEasyCrop_CropAreaGrid', cropAreaClassName) })); }; Cropper.defaultProps = { zoom: 1, rotation: 0, aspect: 4 / 3, maxZoom: MAX_ZOOM, minZoom: MIN_ZOOM, cropShape: 'rect', objectFit: 'contain', showGrid: true, style: {}, classes: {}, mediaProps: {}, zoomSpeed: 1, restrictPosition: true, zoomWithScroll: true }; Cropper.getMousePoint = function (e) { return { x: Number(e.clientX), y: Number(e.clientY) }; }; Cropper.getTouchPoint = function (touch) { return { x: Number(touch.clientX), y: Number(touch.clientY) }; }; return Cropper; }(external_React_default.a.Component); /* harmony default export */ var index_module = (index_module_Cropper); // 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 = { position: 'bottom right', isAlternate: true }; // EXTERNAL MODULE: external ["wp","apiFetch"] var external_wp_apiFetch_ = __webpack_require__("ywyh"); var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_); // EXTERNAL MODULE: external ["wp","notices"] var external_wp_notices_ = __webpack_require__("onLe"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/use-save-image.js /** * WordPress dependencies */ function useSaveImage({ crop, rotation, height, width, aspect, url, id, onSaveImage, onFinishEditing }) { const { createErrorNotice } = Object(external_wp_data_["useDispatch"])(external_wp_notices_["store"]); const [isInProgress, setIsInProgress] = Object(external_wp_element_["useState"])(false); const cancel = Object(external_wp_element_["useCallback"])(() => { setIsInProgress(false); onFinishEditing(); }, [setIsInProgress, onFinishEditing]); const apply = Object(external_wp_element_["useCallback"])(() => { setIsInProgress(true); let attrs = {}; // The crop script may return some very small, sub-pixel values when the image was not cropped. // Crop only when the new size has changed by more than 0.1%. if (crop.width < 99.9 || crop.height < 99.9) { attrs = crop; } if (rotation > 0) { attrs.rotation = rotation; } attrs.src = url; external_wp_apiFetch_default()({ path: `/wp/v2/media/${id}/edit`, method: 'POST', data: attrs }).then(response => { onSaveImage({ id: response.id, url: response.source_url, height: height && width ? width / aspect : undefined }); }).catch(error => { createErrorNotice(Object(external_wp_i18n_["sprintf"])( /* translators: 1. Error message */ Object(external_wp_i18n_["__"])('Could not edit image. %s'), error.message), { id: 'image-editing-error', type: 'snackbar' }); }).finally(() => { setIsInProgress(false); onFinishEditing(); }); }, [setIsInProgress, crop, rotation, height, width, aspect, url, onSaveImage, createErrorNotice, setIsInProgress, onFinishEditing]); return Object(external_wp_element_["useMemo"])(() => ({ isInProgress, apply, cancel }), [isInProgress, apply, cancel]); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/use-transform-image.js /** * WordPress dependencies */ function useTransformState({ url, naturalWidth, naturalHeight }) { const [editedUrl, setEditedUrl] = Object(external_wp_element_["useState"])(); const [crop, setCrop] = Object(external_wp_element_["useState"])(); const [position, setPosition] = Object(external_wp_element_["useState"])({ x: 0, y: 0 }); const [zoom, setZoom] = Object(external_wp_element_["useState"])(); const [rotation, setRotation] = Object(external_wp_element_["useState"])(); const [aspect, setAspect] = Object(external_wp_element_["useState"])(); const [defaultAspect, setDefaultAspect] = Object(external_wp_element_["useState"])(); const initializeTransformValues = Object(external_wp_element_["useCallback"])(() => { setPosition({ x: 0, y: 0 }); setZoom(100); setRotation(0); setAspect(naturalWidth / naturalHeight); setDefaultAspect(naturalWidth / naturalHeight); }, [naturalWidth, naturalHeight, setPosition, setZoom, setRotation, setAspect, setDefaultAspect]); const rotateClockwise = Object(external_wp_element_["useCallback"])(() => { const angle = (rotation + 90) % 360; let naturalAspectRatio = naturalWidth / naturalHeight; if (rotation % 180 === 90) { naturalAspectRatio = naturalHeight / naturalWidth; } if (angle === 0) { setEditedUrl(); setRotation(angle); setAspect(1 / aspect); setPosition({ x: -(position.y * naturalAspectRatio), y: position.x * naturalAspectRatio }); return; } function editImage(event) { const canvas = document.createElement('canvas'); let translateX = 0; let translateY = 0; if (angle % 180) { canvas.width = event.target.height; canvas.height = event.target.width; } else { canvas.width = event.target.width; canvas.height = event.target.height; } if (angle === 90 || angle === 180) { translateX = canvas.width; } if (angle === 270 || angle === 180) { translateY = canvas.height; } const context = canvas.getContext('2d'); context.translate(translateX, translateY); context.rotate(angle * Math.PI / 180); context.drawImage(event.target, 0, 0); canvas.toBlob(blob => { setEditedUrl(URL.createObjectURL(blob)); setRotation(angle); setAspect(1 / aspect); setPosition({ x: -(position.y * naturalAspectRatio), y: position.x * naturalAspectRatio }); }); } const el = new window.Image(); el.src = url; el.onload = editImage; const imgCrossOrigin = Object(external_wp_hooks_["applyFilters"])('media.crossOrigin', undefined, url); if (typeof imgCrossOrigin === 'string') { el.crossOrigin = imgCrossOrigin; } }, [rotation, naturalWidth, naturalHeight, setEditedUrl, setRotation, setAspect, setPosition]); return Object(external_wp_element_["useMemo"])(() => ({ editedUrl, setEditedUrl, crop, setCrop, position, setPosition, zoom, setZoom, rotation, setRotation, rotateClockwise, aspect, setAspect, defaultAspect, initializeTransformValues }), [editedUrl, setEditedUrl, crop, setCrop, position, setPosition, zoom, setZoom, rotation, setRotation, rotateClockwise, aspect, setAspect, defaultAspect, initializeTransformValues]); } function useTransformImage(imageProperties, isEditing) { const transformState = useTransformState(imageProperties); const { initializeTransformValues } = transformState; Object(external_wp_element_["useEffect"])(() => { if (isEditing) { initializeTransformValues(); } }, [isEditing, initializeTransformValues]); return transformState; } // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/context.js /** * WordPress dependencies */ /** * Internal dependencies */ const ImageEditingContext = Object(external_wp_element_["createContext"])({}); const useImageEditingContext = () => Object(external_wp_element_["useContext"])(ImageEditingContext); function ImageEditingProvider({ id, url, naturalWidth, naturalHeight, isEditing, onFinishEditing, onSaveImage, children }) { const transformImage = useTransformImage({ url, naturalWidth, naturalHeight }, isEditing); const saveImage = useSaveImage({ id, url, onSaveImage, onFinishEditing, ...transformImage }); const providerValue = Object(external_wp_element_["useMemo"])(() => ({ ...transformImage, ...saveImage }), [transformImage, saveImage]); return Object(external_wp_element_["createElement"])(ImageEditingContext.Provider, { value: providerValue }, children); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/cropper.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function ImageCropper({ url, width, height, clientWidth, naturalHeight, naturalWidth }) { const { isInProgress, editedUrl, position, zoom, aspect, setPosition, setCrop, setZoom, rotation } = useImageEditingContext(); let editedHeight = height || clientWidth * naturalHeight / naturalWidth; if (rotation % 180 === 90) { editedHeight = clientWidth * naturalWidth / naturalHeight; } return Object(external_wp_element_["createElement"])("div", { className: classnames_default()('wp-block-image__crop-area', { 'is-applying': isInProgress }), style: { width: width || clientWidth, height: editedHeight } }, Object(external_wp_element_["createElement"])(index_module, { image: editedUrl || url, disabled: isInProgress, minZoom: constants_MIN_ZOOM / 100, maxZoom: constants_MAX_ZOOM / 100, crop: position, zoom: zoom / 100, aspect: aspect, onCropChange: setPosition, onCropComplete: newCropPercent => { setCrop(newCropPercent); }, onZoomChange: newZoom => { setZoom(newZoom * 100); } }), isInProgress && Object(external_wp_element_["createElement"])(external_wp_components_["Spinner"], null)); } // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/search.js var search = __webpack_require__("cGtP"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/zoom-dropdown.js /** * WordPress dependencies */ /** * Internal dependencies */ function ZoomDropdown() { const { isInProgress, zoom, setZoom } = useImageEditingContext(); return Object(external_wp_element_["createElement"])(external_wp_components_["Dropdown"], { contentClassName: "wp-block-image__zoom", popoverProps: constants_POPOVER_PROPS, renderToggle: ({ isOpen, onToggle }) => Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { icon: search["a" /* default */], label: Object(external_wp_i18n_["__"])('Zoom'), onClick: onToggle, "aria-expanded": isOpen, disabled: isInProgress }), renderContent: () => Object(external_wp_element_["createElement"])(external_wp_components_["RangeControl"], { label: Object(external_wp_i18n_["__"])('Zoom'), min: constants_MIN_ZOOM, max: constants_MAX_ZOOM, value: Math.round(zoom), onChange: setZoom }) }); } // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js var check = __webpack_require__("RMJe"); // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/aspect-ratio.js /** * WordPress dependencies */ const aspectRatio = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" }, Object(external_wp_element_["createElement"])(external_wp_primitives_["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 */ var 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 Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], { label: label }, aspectRatios.map(({ title, aspect }) => Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { key: aspect, disabled: isDisabled, onClick: () => { onClick(aspect); }, role: "menuitemradio", isSelected: aspect === value, icon: aspect === value ? check["a" /* default */] : undefined }, title))); } function AspectRatioDropdown({ toggleProps }) { const { isInProgress, aspect, setAspect, defaultAspect } = useImageEditingContext(); return Object(external_wp_element_["createElement"])(external_wp_components_["DropdownMenu"], { icon: aspect_ratio, label: Object(external_wp_i18n_["__"])('Aspect Ratio'), popoverProps: constants_POPOVER_PROPS, toggleProps: toggleProps, className: "wp-block-image__aspect-ratio" }, ({ onClose }) => Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(AspectGroup, { isDisabled: isInProgress, onClick: newAspect => { setAspect(newAspect); onClose(); }, value: aspect, aspectRatios: [{ title: Object(external_wp_i18n_["__"])('Original'), aspect: defaultAspect }, { title: Object(external_wp_i18n_["__"])('Square'), aspect: 1 }] }), Object(external_wp_element_["createElement"])(AspectGroup, { label: Object(external_wp_i18n_["__"])('Landscape'), isDisabled: isInProgress, onClick: newAspect => { setAspect(newAspect); onClose(); }, value: aspect, aspectRatios: [{ title: Object(external_wp_i18n_["__"])('16:10'), aspect: 16 / 10 }, { title: Object(external_wp_i18n_["__"])('16:9'), aspect: 16 / 9 }, { title: Object(external_wp_i18n_["__"])('4:3'), aspect: 4 / 3 }, { title: Object(external_wp_i18n_["__"])('3:2'), aspect: 3 / 2 }] }), Object(external_wp_element_["createElement"])(AspectGroup, { label: Object(external_wp_i18n_["__"])('Portrait'), isDisabled: isInProgress, onClick: newAspect => { setAspect(newAspect); onClose(); }, value: aspect, aspectRatios: [{ title: Object(external_wp_i18n_["__"])('10:16'), aspect: 10 / 16 }, { title: Object(external_wp_i18n_["__"])('9:16'), aspect: 9 / 16 }, { title: Object(external_wp_i18n_["__"])('3:4'), aspect: 3 / 4 }, { title: Object(external_wp_i18n_["__"])('2:3'), aspect: 2 / 3 }] }))); } // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/rotate-right.js /** * WordPress dependencies */ const rotateRight = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" }, Object(external_wp_element_["createElement"])(external_wp_primitives_["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 */ var rotate_right = (rotateRight); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/rotation-button.js /** * WordPress dependencies */ /** * Internal dependencies */ function RotationButton() { const { isInProgress, rotateClockwise } = useImageEditingContext(); return Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { icon: rotate_right, label: Object(external_wp_i18n_["__"])('Rotate'), onClick: rotateClockwise, disabled: isInProgress }); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/form-controls.js /** * WordPress dependencies */ /** * Internal dependencies */ function FormControls() { const { isInProgress, apply, cancel } = useImageEditingContext(); return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { onClick: apply, disabled: isInProgress }, Object(external_wp_i18n_["__"])('Apply')), Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { onClick: cancel }, Object(external_wp_i18n_["__"])('Cancel'))); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function ImageEditor({ url, width, height, clientWidth, naturalHeight, naturalWidth }) { return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(ImageCropper, { url: url, width: width, height: height, clientWidth: clientWidth, naturalHeight: naturalHeight, naturalWidth: naturalWidth }), Object(external_wp_element_["createElement"])(block_controls["b" /* default */], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], null, Object(external_wp_element_["createElement"])(ZoomDropdown, null), Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarItem"], null, toggleProps => Object(external_wp_element_["createElement"])(AspectRatioDropdown, { toggleProps: toggleProps })), Object(external_wp_element_["createElement"])(RotationButton, null)), Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], null, Object(external_wp_element_["createElement"])(FormControls, null)))); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-size-control/use-dimension-handler.js /** * WordPress dependencies */ function useDimensionHandler(customHeight, customWidth, defaultHeight, defaultWidth, onChange) { var _ref, _ref2; const [currentWidth, setCurrentWidth] = Object(external_wp_element_["useState"])((_ref = customWidth !== null && customWidth !== void 0 ? customWidth : defaultWidth) !== null && _ref !== void 0 ? _ref : ''); const [currentHeight, setCurrentHeight] = Object(external_wp_element_["useState"])((_ref2 = customHeight !== null && customHeight !== void 0 ? customHeight : defaultHeight) !== null && _ref2 !== void 0 ? _ref2 : ''); // When an image is first inserted, the default dimensions are initially // undefined. This effect updates the dimensions when the default values // come through. Object(external_wp_element_["useEffect"])(() => { if (customWidth === undefined && defaultWidth !== undefined) { setCurrentWidth(defaultWidth); } if (customHeight === undefined && defaultHeight !== undefined) { setCurrentHeight(defaultHeight); } }, [defaultWidth, defaultHeight]); // If custom values change, it means an outsider has resized the image using some other method (eg resize box) // this keeps track of these values too. We need to parse before comparing; custom values can be strings. Object(external_wp_element_["useEffect"])(() => { if (customWidth !== undefined && Number.parseInt(customWidth) !== Number.parseInt(currentWidth)) { setCurrentWidth(customWidth); } if (customHeight !== undefined && Number.parseInt(customHeight) !== Number.parseInt(currentHeight)) { setCurrentHeight(customHeight); } }, [customWidth, customHeight]); const updateDimension = (dimension, value) => { if (dimension === 'width') { setCurrentWidth(value); } else { setCurrentHeight(value); } onChange({ [dimension]: value === '' ? undefined : parseInt(value, 10) }); }; const updateDimensions = (nextHeight, nextWidth) => { setCurrentHeight(nextHeight !== null && nextHeight !== void 0 ? nextHeight : defaultHeight); setCurrentWidth(nextWidth !== null && nextWidth !== void 0 ? nextWidth : defaultWidth); onChange({ height: nextHeight, width: nextWidth }); }; return { currentHeight, currentWidth, updateDimension, updateDimensions }; } // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-size-control/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const IMAGE_SIZE_PRESETS = [25, 50, 75, 100]; function ImageSizeControl({ imageWidth, imageHeight, imageSizeOptions = [], isResizable = true, slug, width, height, onChange, onChangeImage = external_lodash_["noop"] }) { const { currentHeight, currentWidth, updateDimension, updateDimensions } = useDimensionHandler(height, width, imageHeight, imageWidth, onChange); return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, !Object(external_lodash_["isEmpty"])(imageSizeOptions) && Object(external_wp_element_["createElement"])(external_wp_components_["SelectControl"], { label: Object(external_wp_i18n_["__"])('Image size'), value: slug, options: imageSizeOptions, onChange: onChangeImage }), isResizable && Object(external_wp_element_["createElement"])("div", { className: "block-editor-image-size-control" }, Object(external_wp_element_["createElement"])("p", { className: "block-editor-image-size-control__row" }, Object(external_wp_i18n_["__"])('Image dimensions')), Object(external_wp_element_["createElement"])("div", { className: "block-editor-image-size-control__row" }, Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], { type: "number", className: "block-editor-image-size-control__width", label: Object(external_wp_i18n_["__"])('Width'), value: currentWidth, min: 1, onChange: value => updateDimension('width', value) }), Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], { type: "number", className: "block-editor-image-size-control__height", label: Object(external_wp_i18n_["__"])('Height'), value: currentHeight, min: 1, onChange: value => updateDimension('height', value) })), Object(external_wp_element_["createElement"])("div", { className: "block-editor-image-size-control__row" }, Object(external_wp_element_["createElement"])(external_wp_components_["ButtonGroup"], { "aria-label": Object(external_wp_i18n_["__"])('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 Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { key: scale, isSmall: true, variant: isCurrent ? 'primary' : undefined, isPressed: isCurrent, onClick: () => updateDimensions(scaledHeight, scaledWidth) }, scale, "%"); })), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { isSmall: true, onClick: () => updateDimensions() }, Object(external_wp_i18n_["__"])('Reset'))))); } // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/index.js + 7 modules var inner_blocks = __webpack_require__("p3NJ"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/index.js var inspector_controls = __webpack_require__("1oY3"); // EXTERNAL MODULE: ./node_modules/@wordpress/block-editor/build-module/components/justify-content-control/index.js + 1 modules var justify_content_control = __webpack_require__("0E5u"); // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/keyboard-return.js var keyboard_return = __webpack_require__("btIw"); // EXTERNAL MODULE: external ["wp","dom"] var external_wp_dom_ = __webpack_require__("1CF3"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/settings-drawer.js /** * External dependencies */ /** * WordPress dependencies */ const LinkControlSettingsDrawer = ({ value, onChange = external_lodash_["noop"], settings }) => { if (!settings || !settings.length) { return null; } const handleSettingChange = setting => newValue => { onChange({ ...value, [setting.id]: newValue }); }; const theSettings = settings.map(setting => Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { className: "block-editor-link-control__setting", key: setting.id, label: setting.title, onChange: handleSettingChange(setting), checked: value ? !!value[setting.id] : false })); return Object(external_wp_element_["createElement"])("fieldset", { className: "block-editor-link-control__settings" }, Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { as: "legend" }, Object(external_wp_i18n_["__"])('Currently selected link settings')), theSettings); }; /* harmony default export */ var settings_drawer = (LinkControlSettingsDrawer); // EXTERNAL MODULE: ./node_modules/dom-scroll-into-view/lib/index.js var lib = __webpack_require__("9Do8"); var lib_default = /*#__PURE__*/__webpack_require__.n(lib); // EXTERNAL MODULE: external ["wp","url"] var external_wp_url_ = __webpack_require__("Mmq9"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-input/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ class url_input_URLInput extends external_wp_element_["Component"] { constructor(props) { super(props); 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 = props.autocompleteRef || Object(external_wp_element_["createRef"])(); this.inputRef = Object(external_wp_element_["createRef"])(); this.updateSuggestions = Object(external_lodash_["debounce"])(this.updateSuggestions.bind(this), 200); this.suggestionNodes = []; this.isUpdatingSuggestions = false; this.state = { suggestions: [], showSuggestions: false, selectedSuggestion: null, suggestionsListboxId: '', suggestionOptionIdPrefix: '' }; } componentDidUpdate(prevProps) { const { showSuggestions, selectedSuggestion } = this.state; const { value, __experimentalShowInitialSuggestions = false } = this.props; // 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 }); this.props.setTimeout(() => { this.scrollingIntoView = false; }, 100); } // Update suggestions when the value changes if (prevProps.value !== value && !this.props.disableSuggestions && !this.isUpdatingSuggestions) { if (value !== null && value !== void 0 && value.length) { // If the new value is not empty we need to update with suggestions for it this.updateSuggestions(value); } else if (__experimentalShowInitialSuggestions) { // If the new value is empty and we can show initial suggestions, then show initial suggestions this.updateSuggestions(); } } } componentDidMount() { if (this.shouldShowInitialSuggestions()) { this.updateSuggestions(); } } componentWillUnmount() { var _this$suggestionsRequ, _this$suggestionsRequ2; (_this$suggestionsRequ = this.suggestionsRequest) === null || _this$suggestionsRequ === void 0 ? void 0 : (_this$suggestionsRequ2 = _this$suggestionsRequ.cancel) === null || _this$suggestionsRequ2 === void 0 ? void 0 : _this$suggestionsRequ2.call(_this$suggestionsRequ); delete this.suggestionsRequest; } bindSuggestionNode(index) { return ref => { this.suggestionNodes[index] = ref; }; } shouldShowInitialSuggestions() { const { suggestions } = this.state; const { __experimentalShowInitialSuggestions = false, value } = this.props; return !this.isUpdatingSuggestions && __experimentalShowInitialSuggestions && !(value && value.length) && !(suggestions && suggestions.length); } updateSuggestions(value = '') { var _value; const { __experimentalFetchLinkSuggestions: fetchLinkSuggestions, __experimentalHandleURLSuggestions: handleURLSuggestions } = this.props; if (!fetchLinkSuggestions) { return; } // Initial suggestions may only show if there is no value // (note: this includes whitespace). const isInitialSuggestions = !((_value = value) !== null && _value !== void 0 && _value.length); // Trim only now we've determined whether or not it originally had a "length" // (even if that value was all whitespace). value = value.trim(); // Allow a suggestions request if: // - there are at least 2 characters in the search input (except manual searches where // search input length is not required to trigger a fetch) // - this is a direct entry (eg: a URL) if (!isInitialSuggestions && (value.length < 2 || !handleURLSuggestions && Object(external_wp_url_["isURL"])(value))) { this.setState({ showSuggestions: false, selectedSuggestion: null, loading: false }); return; } this.isUpdatingSuggestions = true; this.setState({ selectedSuggestion: null, loading: true }); const request = fetchLinkSuggestions(value, { isInitialSuggestions }); request.then(suggestions => { // A fetch Promise doesn't have an abort option. It's mimicked by // comparing the request reference in on the instance, which is // reset or deleted on subsequent requests or unmounting. if (this.suggestionsRequest !== request) { return; } this.setState({ suggestions, loading: false, showSuggestions: !!suggestions.length }); if (!!suggestions.length) { this.props.debouncedSpeak(Object(external_wp_i18n_["sprintf"])( /* translators: %s: number of results. */ Object(external_wp_i18n_["_n"])('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', suggestions.length), suggestions.length), 'assertive'); } else { this.props.debouncedSpeak(Object(external_wp_i18n_["__"])('No results.'), 'assertive'); } this.isUpdatingSuggestions = false; }).catch(() => { if (this.suggestionsRequest === request) { this.setState({ loading: false }); this.isUpdatingSuggestions = false; } }); // Note that this assignment is handled *before* the async search request // as a Promise always resolves on the next tick of the event loop. this.suggestionsRequest = request; } onChange(event) { const inputValue = event.target.value; this.props.onChange(inputValue); if (!this.props.disableSuggestions) { this.updateSuggestions(inputValue); } } onFocus() { const { suggestions } = this.state; const { disableSuggestions, value } = this.props; // When opening the link editor, if there's a value present, we want to load the suggestions pane with the results for this input search value // Don't re-run the suggestions on focus if there are already suggestions present (prevents searching again when tabbing between the input and buttons) if (value && !disableSuggestions && !this.isUpdatingSuggestions && !(suggestions && suggestions.length)) { // Ensure the suggestions are updated with the current input value this.updateSuggestions(value); } } onKeyDown(event) { const { showSuggestions, selectedSuggestion, suggestions, loading } = this.state; // If the suggestions are not shown or loading, we shouldn't handle the arrow keys // We shouldn't preventDefault to allow block arrow keys navigation if (!showSuggestions || !suggestions.length || loading) { // In the Windows version of Firefox the up and down arrows don't move the caret // within an input field like they do for Mac Firefox/Chrome/Safari. This causes // a form of focus trapping that is disruptive to the user experience. This disruption // only happens if the caret is not in the first or last position in the text input. // See: https://github.com/WordPress/gutenberg/issues/5693#issuecomment-436684747 switch (event.keyCode) { // When UP is pressed, if the caret is at the start of the text, move it to the 0 // position. case external_wp_keycodes_["UP"]: { if (0 !== event.target.selectionStart) { event.preventDefault(); // Set the input caret to position 0 event.target.setSelectionRange(0, 0); } break; } // When DOWN is pressed, if the caret is not at the end of the text, move it to the // last position. case external_wp_keycodes_["DOWN"]: { if (this.props.value.length !== event.target.selectionStart) { event.preventDefault(); // Set the input caret to the last position event.target.setSelectionRange(this.props.value.length, this.props.value.length); } break; } // Submitting while loading should trigger onSubmit case external_wp_keycodes_["ENTER"]: { if (this.props.onSubmit) { this.props.onSubmit(null, event); } break; } } return; } const suggestion = this.state.suggestions[this.state.selectedSuggestion]; switch (event.keyCode) { case external_wp_keycodes_["UP"]: { event.preventDefault(); const previousIndex = !selectedSuggestion ? suggestions.length - 1 : selectedSuggestion - 1; this.setState({ selectedSuggestion: previousIndex }); break; } case external_wp_keycodes_["DOWN"]: { event.preventDefault(); const nextIndex = selectedSuggestion === null || selectedSuggestion === suggestions.length - 1 ? 0 : selectedSuggestion + 1; this.setState({ selectedSuggestion: nextIndex }); break; } case external_wp_keycodes_["TAB"]: { if (this.state.selectedSuggestion !== null) { this.selectLink(suggestion); // Announce a link has been selected when tabbing away from the input field. this.props.speak(Object(external_wp_i18n_["__"])('Link selected.')); } break; } case external_wp_keycodes_["ENTER"]: { if (this.state.selectedSuggestion !== null) { this.selectLink(suggestion); if (this.props.onSubmit) { this.props.onSubmit(suggestion, event); } } else if (this.props.onSubmit) { this.props.onSubmit(null, event); } break; } } } selectLink(suggestion) { this.props.onChange(suggestion.url, suggestion); this.setState({ selectedSuggestion: null, showSuggestions: false }); } handleOnClick(suggestion) { this.selectLink(suggestion); // Move focus to the input field when a link suggestion is clicked. this.inputRef.current.focus(); } static getDerivedStateFromProps({ value, instanceId, disableSuggestions, __experimentalShowInitialSuggestions = false }, { showSuggestions }) { let shouldShowSuggestions = showSuggestions; const hasValue = value && value.length; if (!__experimentalShowInitialSuggestions && !hasValue) { shouldShowSuggestions = false; } if (disableSuggestions === true) { shouldShowSuggestions = false; } return { showSuggestions: shouldShowSuggestions, suggestionsListboxId: `block-editor-url-input-suggestions-${instanceId}`, suggestionOptionIdPrefix: `block-editor-url-input-suggestion-${instanceId}` }; } render() { return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, this.renderControl(), this.renderSuggestions()); } renderControl() { const { label, className, isFullWidth, instanceId, placeholder = Object(external_wp_i18n_["__"])('Paste URL or type to search'), __experimentalRenderControl: renderControl, value = '' } = this.props; const { loading, showSuggestions, selectedSuggestion, suggestionsListboxId, suggestionOptionIdPrefix } = this.state; const controlProps = { id: `url-input-control-${instanceId}`, label, className: classnames_default()('block-editor-url-input', className, { 'is-full-width': isFullWidth }) }; const inputProps = { value, required: true, className: 'block-editor-url-input__input', type: 'text', onChange: this.onChange, onFocus: this.onFocus, placeholder, onKeyDown: this.onKeyDown, role: 'combobox', 'aria-label': Object(external_wp_i18n_["__"])('URL'), 'aria-expanded': showSuggestions, 'aria-autocomplete': 'list', 'aria-owns': suggestionsListboxId, 'aria-activedescendant': selectedSuggestion !== null ? `${suggestionOptionIdPrefix}-${selectedSuggestion}` : undefined, ref: this.inputRef }; if (renderControl) { return renderControl(controlProps, inputProps, loading); } return Object(external_wp_element_["createElement"])(external_wp_components_["BaseControl"], controlProps, Object(external_wp_element_["createElement"])("input", inputProps), loading && Object(external_wp_element_["createElement"])(external_wp_components_["Spinner"], null)); } renderSuggestions() { const { className, __experimentalRenderSuggestions: renderSuggestions, value = '', __experimentalShowInitialSuggestions = false } = this.props; const { showSuggestions, suggestions, selectedSuggestion, suggestionsListboxId, suggestionOptionIdPrefix, loading } = this.state; const suggestionsListProps = { id: suggestionsListboxId, ref: this.autocompleteRef, role: 'listbox' }; const buildSuggestionItemProps = (suggestion, index) => { return { role: 'option', tabIndex: '-1', id: `${suggestionOptionIdPrefix}-${index}`, ref: this.bindSuggestionNode(index), 'aria-selected': index === selectedSuggestion }; }; if (Object(external_lodash_["isFunction"])(renderSuggestions) && showSuggestions && !!suggestions.length) { return renderSuggestions({ suggestions, selectedSuggestion, suggestionsListProps, buildSuggestionItemProps, isLoading: loading, handleSuggestionClick: this.handleOnClick, isInitialSuggestions: __experimentalShowInitialSuggestions && !(value && value.length) }); } if (!Object(external_lodash_["isFunction"])(renderSuggestions) && showSuggestions && !!suggestions.length) { return Object(external_wp_element_["createElement"])(external_wp_components_["Popover"], { position: "bottom", noArrow: true, focusOnMount: false }, Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({}, suggestionsListProps, { className: classnames_default()('block-editor-url-input__suggestions', `${className}__suggestions`) }), suggestions.map((suggestion, index) => Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, buildSuggestionItemProps(suggestion, index), { key: suggestion.id, className: classnames_default()('block-editor-url-input__suggestion', { 'is-selected': index === selectedSuggestion }), onClick: () => this.handleOnClick(suggestion) }), suggestion.title)))); } return null; } } /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/url-input/README.md */ /* harmony default export */ var url_input = (Object(external_wp_compose_["compose"])(external_wp_compose_["withSafeTimeout"], external_wp_components_["withSpokenMessages"], external_wp_compose_["withInstanceId"], Object(external_wp_data_["withSelect"])((select, props) => { // If a link suggestions handler is already provided then // bail if (Object(external_lodash_["isFunction"])(props.__experimentalFetchLinkSuggestions)) { return; } const { getSettings } = select(store["a" /* store */]); return { __experimentalFetchLinkSuggestions: getSettings().__experimentalFetchLinkSuggestions }; }))(url_input_URLInput)); // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js var plus = __webpack_require__("Q4Sy"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-create-button.js /** * External dependencies */ /** * WordPress dependencies */ const LinkControlSearchCreate = ({ searchTerm, onClick, itemProps, isSelected, buttonText }) => { if (!searchTerm) { return null; } let text; if (buttonText) { text = Object(external_lodash_["isFunction"])(buttonText) ? buttonText(searchTerm) : buttonText; } else { text = Object(external_wp_element_["createInterpolateElement"])(Object(external_wp_i18n_["sprintf"])( /* translators: %s: search term. */ Object(external_wp_i18n_["__"])('Create: %s'), searchTerm), { mark: Object(external_wp_element_["createElement"])("mark", null) }); } return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, itemProps, { className: classnames_default()('block-editor-link-control__search-create block-editor-link-control__search-item', { 'is-selected': isSelected }), onClick: onClick }), Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], { className: "block-editor-link-control__search-item-icon", icon: plus["a" /* default */] }), Object(external_wp_element_["createElement"])("span", { className: "block-editor-link-control__search-item-header" }, Object(external_wp_element_["createElement"])("span", { className: "block-editor-link-control__search-item-title" }, text))); }; /* harmony default export */ var search_create_button = (LinkControlSearchCreate); // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/globe.js /** * WordPress dependencies */ const globe = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" }, Object(external_wp_element_["createElement"])(external_wp_primitives_["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 */ var library_globe = (globe); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-item.js /** * External dependencies */ /** * WordPress dependencies */ const LinkControlSearchItem = ({ itemProps, suggestion, isSelected = false, onClick, isURL = false, searchTerm = '', shouldShowType = false }) => { return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, itemProps, { onClick: onClick, className: classnames_default()('block-editor-link-control__search-item', { 'is-selected': isSelected, 'is-url': isURL, 'is-entity': !isURL }) }), isURL && Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], { className: "block-editor-link-control__search-item-icon", icon: library_globe }), Object(external_wp_element_["createElement"])("span", { className: "block-editor-link-control__search-item-header" }, Object(external_wp_element_["createElement"])("span", { className: "block-editor-link-control__search-item-title" }, Object(external_wp_element_["createElement"])(external_wp_components_["TextHighlight"], { text: suggestion.title, highlight: searchTerm })), Object(external_wp_element_["createElement"])("span", { "aria-hidden": !isURL, className: "block-editor-link-control__search-item-info" }, !isURL && (Object(external_wp_url_["filterURLForDisplay"])(Object(external_wp_url_["safeDecodeURI"])(suggestion.url)) || ''), isURL && Object(external_wp_i18n_["__"])('Press ENTER to add this link'))), shouldShowType && suggestion.type && Object(external_wp_element_["createElement"])("span", { className: "block-editor-link-control__search-item-type" }, suggestion.type === 'post_tag' ? 'tag' : suggestion.type)); }; /* harmony default export */ var search_item = (LinkControlSearchItem); // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/constants.js /** * WordPress dependencies */ // Used as a unique identifier for the "Create" option within search results. // Used to help distinguish the "Create" suggestion within the search results in // order to handle it as a unique case. const CREATE_TYPE = '__CREATE__'; const DEFAULT_LINK_SETTINGS = [{ id: 'opensInNewTab', title: Object(external_wp_i18n_["__"])('Open in new tab') }]; // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-results.js /** * WordPress dependencies */ /** * External dependencies */ /** * Internal dependencies */ function LinkControlSearchResults({ instanceId, withCreateSuggestion, currentInputValue, handleSuggestionClick, suggestionsListProps, buildSuggestionItemProps, suggestions, selectedSuggestion, isLoading, isInitialSuggestions, createSuggestionButtonText, suggestionsQuery }) { const resultsListClasses = classnames_default()('block-editor-link-control__search-results', { 'is-loading': isLoading }); const directLinkEntryTypes = ['url', 'mailto', 'tel', 'internal']; const isSingleDirectEntryResult = suggestions.length === 1 && directLinkEntryTypes.includes(suggestions[0].type.toLowerCase()); const shouldShowCreateSuggestion = withCreateSuggestion && !isSingleDirectEntryResult && !isInitialSuggestions; // If the query has a specified type, then we can skip showing them in the result. See #24839. const shouldShowSuggestionsTypes = !(suggestionsQuery !== null && suggestionsQuery !== void 0 && suggestionsQuery.type); // According to guidelines aria-label should be added if the label // itself is not visible. // See: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role const searchResultsLabelId = `block-editor-link-control-search-results-label-${instanceId}`; const labelText = isInitialSuggestions ? Object(external_wp_i18n_["__"])('Recently updated') : Object(external_wp_i18n_["sprintf"])( /* translators: %s: search term. */ Object(external_wp_i18n_["__"])('Search results for "%s"'), currentInputValue); // VisuallyHidden rightly doesn't accept custom classNames // so we conditionally render it as a wrapper to visually hide the label // when that is required. const searchResultsLabel = Object(external_wp_element_["createElement"])(isInitialSuggestions ? external_wp_element_["Fragment"] : external_wp_components_["VisuallyHidden"], {}, // empty props Object(external_wp_element_["createElement"])("span", { className: "block-editor-link-control__search-results-label", id: searchResultsLabelId }, labelText)); return Object(external_wp_element_["createElement"])("div", { className: "block-editor-link-control__search-results-wrapper" }, searchResultsLabel, Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({}, suggestionsListProps, { className: resultsListClasses, "aria-labelledby": searchResultsLabelId }), suggestions.map((suggestion, index) => { if (shouldShowCreateSuggestion && CREATE_TYPE === suggestion.type) { return Object(external_wp_element_["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 }); } // 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 Object(external_wp_element_["createElement"])(search_item, { key: `${suggestion.id}-${suggestion.type}`, itemProps: buildSuggestionItemProps(suggestion, index), suggestion: suggestion, index: index, onClick: () => { handleSuggestionClick(suggestion); }, isSelected: index === selectedSuggestion, isURL: directLinkEntryTypes.includes(suggestion.type.toLowerCase()), searchTerm: currentInputValue, shouldShowType: shouldShowSuggestionsTypes }); }))); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/is-url-like.js /** * External dependencies */ /** * WordPress dependencies */ /** * Determines whether a given value could be a URL. Note this does not * guarantee the value is a URL only that it looks like it might be one. For * example, just because a string has `www.` in it doesn't make it a URL, * but it does make it highly likely that it will be so in the context of * creating a link it makes sense to treat it like one. * * @param {string} val the candidate for being URL-like (or not). * * @return {boolean} whether or not the value is potentially a URL. */ function isURLLike(val) { const isInternal = Object(external_lodash_["startsWith"])(val, '#'); return Object(external_wp_url_["isURL"])(val) || val && val.includes('www.') || isInternal; } // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/use-search-handler.js /** * WordPress dependencies */ /** * External dependencies */ /** * Internal dependencies */ const handleNoop = () => Promise.resolve([]); const handleDirectEntry = val => { let type = 'URL'; const protocol = Object(external_wp_url_["getProtocol"])(val) || ''; if (protocol.includes('mailto')) { type = 'mailto'; } if (protocol.includes('tel')) { type = 'tel'; } if (Object(external_lodash_["startsWith"])(val, '#')) { type = 'internal'; } return Promise.resolve([{ id: val, title: val, url: type === 'URL' ? Object(external_wp_url_["prependHTTP"])(val) : val, type }]); }; const handleEntitySearch = async (val, suggestionsQuery, fetchSearchSuggestions, directEntryHandler, withCreateSuggestion, withURLSuggestion) => { const { isInitialSuggestions } = suggestionsQuery; let results = await Promise.all([fetchSearchSuggestions(val, suggestionsQuery), directEntryHandler(val)]); const couldBeURL = !val.includes(' '); // If it's potentially a URL search then concat on a URL search suggestion // just for good measure. That way once the actual results run out we always // have a URL option to fallback on. if (couldBeURL && withURLSuggestion && !isInitialSuggestions) { results = results[0].concat(results[1]); } else { results = results[0]; } // If displaying initial suggestions just return plain results. if (isInitialSuggestions) { return results; } // Here we append a faux suggestion to represent a "CREATE" option. This // is detected in the rendering of the search results and handled as a // special case. This is currently necessary because the suggestions // dropdown will only appear if there are valid suggestions and // therefore unless the create option is a suggestion it will not // display in scenarios where there are no results returned from the // API. In addition promoting CREATE to a first class suggestion affords // the a11y benefits afforded by `URLInput` to all suggestions (eg: // keyboard handling, ARIA roles...etc). // // Note also that the value of the `title` and `url` properties must correspond // to the text value of the ``. This is because `title` is used // when creating the suggestion. Similarly `url` is used when using keyboard to select // the suggestion (the