Fix File
•
/
home
/
sportsfe...
/
httpdocs
/
clone
/
wp-inclu...
/
js
/
dist
•
File:
block-library.js
•
Content:
className }), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { className: "blocks-gallery-grid", children: images.map(image => { let href; switch (linkTo) { case DEPRECATED_LINK_DESTINATION_MEDIA: href = image.fullUrl || image.url; break; case DEPRECATED_LINK_DESTINATION_ATTACHMENT: href = image.link; break; } const img = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: image.url, alt: image.alt, "data-id": image.id, "data-full-url": image.fullUrl, "data-link": image.link, className: image.id ? `wp-image-${image.id}` : null }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { className: "blocks-gallery-item", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("figure", { children: [href ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { href: href, children: img }) : img, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(image.caption) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { tagName: "figcaption", className: "blocks-gallery-item__caption", value: image.caption })] }) }, image.id || image.url); }) }), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { tagName: "figcaption", className: "blocks-gallery-caption", value: caption })] }); }, migrate(attributes) { if (isGalleryV2Enabled()) { return runV2Migration(attributes); } return attributes; } }; const deprecated_v5 = { attributes: { images: { type: 'array', default: [], source: 'query', selector: '.blocks-gallery-item', query: { url: { type: 'string', source: 'attribute', selector: 'img', attribute: 'src' }, fullUrl: { type: 'string', source: 'attribute', selector: 'img', attribute: 'data-full-url' }, link: { type: 'string', source: 'attribute', selector: 'img', attribute: 'data-link' }, alt: { type: 'string', source: 'attribute', selector: 'img', attribute: 'alt', default: '' }, id: { type: 'string', source: 'attribute', selector: 'img', attribute: 'data-id' }, caption: { type: 'string', source: 'html', selector: '.blocks-gallery-item__caption' } } }, ids: { type: 'array', items: { type: 'number' }, default: [] }, columns: { type: 'number', minimum: 1, maximum: 8 }, caption: { type: 'string', source: 'html', selector: '.blocks-gallery-caption' }, imageCrop: { type: 'boolean', default: true }, linkTo: { type: 'string', default: 'none' }, sizeSlug: { type: 'string', default: 'large' } }, supports: { align: true }, isEligible({ linkTo }) { return !linkTo || linkTo === 'attachment' || linkTo === 'media'; }, migrate(attributes) { if (isGalleryV2Enabled()) { return runV2Migration(attributes); } let linkTo = attributes.linkTo; if (!attributes.linkTo) { linkTo = 'none'; } else if (attributes.linkTo === 'attachment') { linkTo = 'post'; } else if (attributes.linkTo === 'media') { linkTo = 'file'; } return { ...attributes, linkTo }; }, save({ attributes }) { const { images, columns = defaultColumnsNumberV1(attributes), imageCrop, caption, linkTo } = attributes; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("figure", { className: `columns-${columns} ${imageCrop ? 'is-cropped' : ''}`, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { className: "blocks-gallery-grid", children: images.map(image => { let href; switch (linkTo) { case 'media': href = image.fullUrl || image.url; break; case 'attachment': href = image.link; break; } const img = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: image.url, alt: image.alt, "data-id": image.id, "data-full-url": image.fullUrl, "data-link": image.link, className: image.id ? `wp-image-${image.id}` : null }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { className: "blocks-gallery-item", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("figure", { children: [href ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { href: href, children: img }) : img, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(image.caption) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { tagName: "figcaption", className: "blocks-gallery-item__caption", value: image.caption })] }) }, image.id || image.url); }) }), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { tagName: "figcaption", className: "blocks-gallery-caption", value: caption })] }); } }; const deprecated_v4 = { attributes: { images: { type: 'array', default: [], source: 'query', selector: '.blocks-gallery-item', query: { url: { source: 'attribute', selector: 'img', attribute: 'src' }, fullUrl: { source: 'attribute', selector: 'img', attribute: 'data-full-url' }, link: { source: 'attribute', selector: 'img', attribute: 'data-link' }, alt: { source: 'attribute', selector: 'img', attribute: 'alt', default: '' }, id: { source: 'attribute', selector: 'img', attribute: 'data-id' }, caption: { type: 'string', source: 'html', selector: '.blocks-gallery-item__caption' } } }, ids: { type: 'array', default: [] }, columns: { type: 'number' }, caption: { type: 'string', source: 'html', selector: '.blocks-gallery-caption' }, imageCrop: { type: 'boolean', default: true }, linkTo: { type: 'string', default: 'none' } }, supports: { align: true }, isEligible({ ids }) { return ids && ids.some(id => typeof id === 'string'); }, migrate(attributes) { var _attributes$ids; if (isGalleryV2Enabled()) { return runV2Migration(attributes); } return { ...attributes, ids: ((_attributes$ids = attributes.ids) !== null && _attributes$ids !== void 0 ? _attributes$ids : []).map(id => { const parsedId = parseInt(id, 10); return Number.isInteger(parsedId) ? parsedId : null; }) }; }, save({ attributes }) { const { images, columns = defaultColumnsNumberV1(attributes), imageCrop, caption, linkTo } = attributes; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("figure", { className: `columns-${columns} ${imageCrop ? 'is-cropped' : ''}`, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { className: "blocks-gallery-grid", children: images.map(image => { let href; switch (linkTo) { case 'media': href = image.fullUrl || image.url; break; case 'attachment': href = image.link; break; } const img = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: image.url, alt: image.alt, "data-id": image.id, "data-full-url": image.fullUrl, "data-link": image.link, className: image.id ? `wp-image-${image.id}` : null }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { className: "blocks-gallery-item", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("figure", { children: [href ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { href: href, children: img }) : img, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(image.caption) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { tagName: "figcaption", className: "blocks-gallery-item__caption", value: image.caption })] }) }, image.id || image.url); }) }), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { tagName: "figcaption", className: "blocks-gallery-caption", value: caption })] }); } }; const gallery_deprecated_v3 = { attributes: { images: { type: 'array', default: [], source: 'query', selector: 'ul.wp-block-gallery .blocks-gallery-item', query: { url: { source: 'attribute', selector: 'img', attribute: 'src' }, fullUrl: { source: 'attribute', selector: 'img', attribute: 'data-full-url' }, alt: { source: 'attribute', selector: 'img', attribute: 'alt', default: '' }, id: { source: 'attribute', selector: 'img', attribute: 'data-id' }, link: { source: 'attribute', selector: 'img', attribute: 'data-link' }, caption: { type: 'string', source: 'html', selector: 'figcaption' } } }, ids: { type: 'array', default: [] }, columns: { type: 'number' }, imageCrop: { type: 'boolean', default: true }, linkTo: { type: 'string', default: 'none' } }, supports: { align: true }, save({ attributes }) { const { images, columns = defaultColumnsNumberV1(attributes), imageCrop, linkTo } = attributes; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { className: `columns-${columns} ${imageCrop ? 'is-cropped' : ''}`, children: images.map(image => { let href; switch (linkTo) { case 'media': href = image.fullUrl || image.url; break; case 'attachment': href = image.link; break; } const img = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: image.url, alt: image.alt, "data-id": image.id, "data-full-url": image.fullUrl, "data-link": image.link, className: image.id ? `wp-image-${image.id}` : null }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { className: "blocks-gallery-item", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("figure", { children: [href ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { href: href, children: img }) : img, image.caption && image.caption.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { tagName: "figcaption", value: image.caption })] }) }, image.id || image.url); }) }); }, migrate(attributes) { if (isGalleryV2Enabled()) { return runV2Migration(attributes); } return attributes; } }; const gallery_deprecated_v2 = { attributes: { images: { type: 'array', default: [], source: 'query', selector: 'ul.wp-block-gallery .blocks-gallery-item', query: { url: { source: 'attribute', selector: 'img', attribute: 'src' }, alt: { source: 'attribute', selector: 'img', attribute: 'alt', default: '' }, id: { source: 'attribute', selector: 'img', attribute: 'data-id' }, link: { source: 'attribute', selector: 'img', attribute: 'data-link' }, caption: { type: 'string', source: 'html', selector: 'figcaption' } } }, columns: { type: 'number' }, imageCrop: { type: 'boolean', default: true }, linkTo: { type: 'string', default: 'none' } }, isEligible({ images, ids }) { return images && images.length > 0 && (!ids && images || ids && images && ids.length !== images.length || images.some((id, index) => { if (!id && ids[index] !== null) { return true; } return parseInt(id, 10) !== ids[index]; })); }, migrate(attributes) { var _attributes$images; if (isGalleryV2Enabled()) { return runV2Migration(attributes); } return { ...attributes, ids: ((_attributes$images = attributes.images) !== null && _attributes$images !== void 0 ? _attributes$images : []).map(({ id }) => { if (!id) { return null; } return parseInt(id, 10); }) }; }, supports: { align: true }, save({ attributes }) { const { images, columns = defaultColumnsNumberV1(attributes), imageCrop, linkTo } = attributes; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { className: `columns-${columns} ${imageCrop ? 'is-cropped' : ''}`, children: images.map(image => { let href; switch (linkTo) { case 'media': href = image.url; break; case 'attachment': href = image.link; break; } const img = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: image.url, alt: image.alt, "data-id": image.id, "data-link": image.link, className: image.id ? `wp-image-${image.id}` : null }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { className: "blocks-gallery-item", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("figure", { children: [href ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { href: href, children: img }) : img, image.caption && image.caption.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { tagName: "figcaption", value: image.caption })] }) }, image.id || image.url); }) }); } }; const gallery_deprecated_v1 = { attributes: { images: { type: 'array', default: [], source: 'query', selector: 'div.wp-block-gallery figure.blocks-gallery-image img', query: { url: { source: 'attribute', attribute: 'src' }, alt: { source: 'attribute', attribute: 'alt', default: '' }, id: { source: 'attribute', attribute: 'data-id' } } }, columns: { type: 'number' }, imageCrop: { type: 'boolean', default: true }, linkTo: { type: 'string', default: 'none' }, align: { type: 'string', default: 'none' } }, supports: { align: true }, save({ attributes }) { const { images, columns = defaultColumnsNumberV1(attributes), align, imageCrop, linkTo } = attributes; const className = dist_clsx(`columns-${columns}`, { alignnone: align === 'none', 'is-cropped': imageCrop }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: className, children: images.map(image => { let href; switch (linkTo) { case 'media': href = image.url; break; case 'attachment': href = image.link; break; } const img = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: image.url, alt: image.alt, "data-id": image.id }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("figure", { className: "blocks-gallery-image", children: href ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { href: href, children: img }) : img }, image.id || image.url); }) }); }, migrate(attributes) { if (isGalleryV2Enabled()) { return runV2Migration(attributes); } return attributes; } }; /* harmony default export */ const gallery_deprecated = ([deprecated_v7, deprecated_v6, deprecated_v5, deprecated_v4, gallery_deprecated_v3, gallery_deprecated_v2, gallery_deprecated_v1]); ;// CONCATENATED MODULE: external ["wp","viewport"] const external_wp_viewport_namespaceObject = window["wp"]["viewport"]; ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/shared-icon.js /** * WordPress dependencies */ const sharedIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { icon: library_gallery }); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/constants.js const constants_MIN_SIZE = 20; const constants_LINK_DESTINATION_NONE = 'none'; const constants_LINK_DESTINATION_MEDIA = 'media'; const constants_LINK_DESTINATION_ATTACHMENT = 'attachment'; const LINK_DESTINATION_CUSTOM = 'custom'; const constants_NEW_TAB_REL = ['noreferrer', 'noopener']; const constants_ALLOWED_MEDIA_TYPES = ['image']; const MEDIA_ID_NO_FEATURED_IMAGE_SET = 0; ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/utils.js /** * Internal dependencies */ /** * Determines new href and linkDestination values for an Image block from the * supplied Gallery link destination, or falls back to the Image blocks link. * * @param {Object} image Gallery image. * @param {string} galleryDestination Gallery's selected link destination. * @param {Object} imageDestination Image blocks attributes. * @return {Object} New attributes to assign to image block. */ function utils_getHrefAndDestination(image, galleryDestination, imageDestination) { // Gutenberg and WordPress use different constants so if image_default_link_type // option is set we need to map from the WP Core values. switch (imageDestination ? imageDestination : galleryDestination) { case LINK_DESTINATION_MEDIA_WP_CORE: case LINK_DESTINATION_MEDIA: return { href: image?.source_url || image?.url, // eslint-disable-line camelcase linkDestination: constants_LINK_DESTINATION_MEDIA }; case LINK_DESTINATION_ATTACHMENT_WP_CORE: case LINK_DESTINATION_ATTACHMENT: return { href: image?.link, linkDestination: constants_LINK_DESTINATION_ATTACHMENT }; case LINK_DESTINATION_NONE: return { href: undefined, linkDestination: constants_LINK_DESTINATION_NONE }; } return {}; } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/utils.js /** * Internal dependencies */ /** * Evaluates a CSS aspect-ratio property value as a number. * * Degenerate or invalid ratios behave as 'auto'. And 'auto' ratios return NaN. * * @see https://drafts.csswg.org/css-sizing-4/#aspect-ratio * * @param {string} value CSS aspect-ratio property value. * @return {number} Numerical aspect ratio or NaN if invalid. */ function evalAspectRatio(value) { const [width, height = 1] = value.split('/').map(Number); const aspectRatio = width / height; return aspectRatio === Infinity || aspectRatio === 0 ? NaN : aspectRatio; } function removeNewTabRel(currentRel) { let newRel = currentRel; if (currentRel !== undefined && newRel) { constants_NEW_TAB_REL.forEach(relVal => { const regExp = new RegExp('\\b' + relVal + '\\b', 'gi'); newRel = newRel.replace(regExp, ''); }); // Only trim if NEW_TAB_REL values was replaced. if (newRel !== currentRel) { newRel = newRel.trim(); } if (!newRel) { newRel = undefined; } } return newRel; } /** * Helper to get the link target settings to be stored. * * @param {boolean} value The new link target value. * @param {Object} attributes Block attributes. * @param {Object} attributes.rel Image block's rel attribute. * * @return {Object} Updated link target settings. */ function getUpdatedLinkTargetSettings(value, { rel }) { const linkTarget = value ? '_blank' : undefined; let updatedRel; if (!linkTarget && !rel) { updatedRel = undefined; } else { updatedRel = removeNewTabRel(rel); } return { linkTarget, rel: updatedRel }; } /** * Determines new Image block attributes size selection. * * @param {Object} image Media file object for gallery image. * @param {string} size Selected size slug to apply. */ function getImageSizeAttributes(image, size) { const url = image?.media_details?.sizes?.[size]?.source_url; if (url) { return { url, width: undefined, height: undefined, sizeSlug: size }; } return {}; } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/gallery.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function Gallery(props) { const { attributes, isSelected, setAttributes, mediaPlaceholder, insertBlocksAfter, blockProps, __unstableLayoutClassNames: layoutClassNames, isContentLocked, multiGallerySelection } = props; const { align, columns, imageCrop } = attributes; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("figure", { ...blockProps, className: dist_clsx(blockProps.className, layoutClassNames, 'blocks-gallery-grid', { [`align${align}`]: align, [`columns-${columns}`]: columns !== undefined, [`columns-default`]: columns === undefined, 'is-cropped': imageCrop }), children: [blockProps.children, isSelected && !blockProps.children && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.View, { className: "blocks-gallery-media-placeholder-wrapper", children: mediaPlaceholder }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Caption, { attributes: attributes, setAttributes: setAttributes, isSelected: isSelected, insertBlocksAfter: insertBlocksAfter, showToolbarButton: !multiGallerySelection && !isContentLocked, className: "blocks-gallery-caption", label: (0,external_wp_i18n_namespaceObject.__)('Gallery caption text'), placeholder: (0,external_wp_i18n_namespaceObject.__)('Add gallery caption') })] }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/use-image-sizes.js /** * WordPress dependencies */ /** * Calculates the image sizes that are avaible for the current gallery images in order to * populate the 'Resolution' selector. * * @param {Array} images Basic image block data taken from current gallery innerBlock * @param {boolean} isSelected Is the block currently selected in the editor. * @param {Function} getSettings Block editor store selector. * * @return {Array} An array of image size options. */ function useImageSizes(images, isSelected, getSettings) { return (0,external_wp_element_namespaceObject.useMemo)(() => getImageSizing(), [images, isSelected]); function getImageSizing() { if (!images || images.length === 0) { return; } const { imageSizes } = getSettings(); let resizedImages = {}; if (isSelected) { resizedImages = images.reduce((currentResizedImages, img) => { if (!img.id) { return currentResizedImages; } const sizes = imageSizes.reduce((currentSizes, size) => { const defaultUrl = img.sizes?.[size.slug]?.url; const mediaDetailsUrl = img.media_details?.sizes?.[size.slug]?.source_url; return { ...currentSizes, [size.slug]: defaultUrl || mediaDetailsUrl }; }, {}); return { ...currentResizedImages, [parseInt(img.id, 10)]: sizes }; }, {}); } const resizedImageSizes = Object.values(resizedImages); return imageSizes.filter(({ slug }) => resizedImageSizes.some(sizes => sizes[slug])).map(({ name, slug }) => ({ value: slug, label: name })); } } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/use-get-new-images.js /** * WordPress dependencies */ /** * Keeps track of images already in the gallery to allow new innerBlocks to be identified. This * is required so default gallery attributes can be applied without overwriting any custom * attributes applied to existing images. * * @param {Array} images Basic image block data taken from current gallery innerBlock * @param {Array} imageData The related image data for each of the current gallery images. * * @return {Array} An array of any new images that have been added to the gallery. */ function useGetNewImages(images, imageData) { const [currentImages, setCurrentImages] = (0,external_wp_element_namespaceObject.useState)([]); return (0,external_wp_element_namespaceObject.useMemo)(() => getNewImages(), [images, imageData]); function getNewImages() { let imagesUpdated = false; // First lets check if any images have been deleted. const newCurrentImages = currentImages.filter(currentImg => images.find(img => { return currentImg.clientId === img.clientId; })); if (newCurrentImages.length < currentImages.length) { imagesUpdated = true; } // Now lets see if we have any images hydrated from saved content and if so // add them to currentImages state. images.forEach(image => { if (image.fromSavedContent && !newCurrentImages.find(currentImage => currentImage.id === image.id)) { imagesUpdated = true; newCurrentImages.push(image); } }); // Now check for any new images that have been added to InnerBlocks and for which // we have the imageData we need for setting default block attributes. const newImages = images.filter(image => !newCurrentImages.find(currentImage => image.clientId && currentImage.clientId === image.clientId) && imageData?.find(img => img.id === image.id) && !image.fromSavedConent); if (imagesUpdated || newImages?.length > 0) { setCurrentImages([...newCurrentImages, ...newImages]); } return newImages.length > 0 ? newImages : null; } } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/use-get-media.js /** * WordPress dependencies */ const EMPTY_IMAGE_MEDIA = []; /** * Retrieves the extended media info for each gallery image from the store. This is used to * determine which image size options are available for the current gallery. * * @param {Array} innerBlockImages An array of the innerBlock images currently in the gallery. * * @return {Array} An array of media info options for each gallery image. */ function useGetMedia(innerBlockImages) { return (0,external_wp_data_namespaceObject.useSelect)(select => { var _select$getMediaItems; const imageIds = innerBlockImages.map(imageBlock => imageBlock.attributes.id).filter(id => id !== undefined); if (imageIds.length === 0) { return EMPTY_IMAGE_MEDIA; } return (_select$getMediaItems = select(external_wp_coreData_namespaceObject.store).getMediaItems({ include: imageIds.join(','), per_page: -1, orderby: 'include' })) !== null && _select$getMediaItems !== void 0 ? _select$getMediaItems : EMPTY_IMAGE_MEDIA; }, [innerBlockImages]); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/gap-styles.js /** * WordPress dependencies */ /** * Internal dependencies */ const { useStyleOverride } = unlock(external_wp_blockEditor_namespaceObject.privateApis); function GapStyles({ blockGap, clientId }) { // --gallery-block--gutter-size is deprecated. --wp--style--gallery-gap-default should be used by themes that want to set a default // gap on the gallery. const fallbackValue = `var( --wp--style--gallery-gap-default, var( --gallery-block--gutter-size, var( --wp--style--block-gap, 0.5em ) ) )`; let gapValue = fallbackValue; let column = fallbackValue; let row; // Check for the possibility of split block gap values. See: https://github.com/WordPress/gutenberg/pull/37736 if (!!blockGap) { row = typeof blockGap === 'string' ? (0,external_wp_blockEditor_namespaceObject.__experimentalGetGapCSSValue)(blockGap) : (0,external_wp_blockEditor_namespaceObject.__experimentalGetGapCSSValue)(blockGap?.top) || fallbackValue; column = typeof blockGap === 'string' ? (0,external_wp_blockEditor_namespaceObject.__experimentalGetGapCSSValue)(blockGap) : (0,external_wp_blockEditor_namespaceObject.__experimentalGetGapCSSValue)(blockGap?.left) || fallbackValue; gapValue = row === column ? row : `${row} ${column}`; } // The unstable gallery gap calculation requires a real value (such as `0px`) and not `0`. const gap = `#block-${clientId} { --wp--style--unstable-gallery-gap: ${column === '0' ? '0px' : column}; gap: ${gapValue} }`; useStyleOverride({ css: gap }); return null; } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/edit.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const MAX_COLUMNS = 8; const linkOptions = [{ value: LINK_DESTINATION_ATTACHMENT, label: (0,external_wp_i18n_namespaceObject.__)('Attachment Page') }, { value: LINK_DESTINATION_MEDIA, label: (0,external_wp_i18n_namespaceObject.__)('Media File') }, { value: LINK_DESTINATION_NONE, label: (0,external_wp_i18n_namespaceObject._x)('None', 'Media item link option') }]; const edit_ALLOWED_MEDIA_TYPES = ['image']; const PLACEHOLDER_TEXT = external_wp_element_namespaceObject.Platform.isNative ? (0,external_wp_i18n_namespaceObject.__)('Add media') : (0,external_wp_i18n_namespaceObject.__)('Drag images, upload new ones or select files from your library.'); const MOBILE_CONTROL_PROPS_RANGE_CONTROL = external_wp_element_namespaceObject.Platform.isNative ? { type: 'stepper' } : {}; const gallery_edit_DEFAULT_BLOCK = { name: 'core/image' }; const EMPTY_ARRAY = []; function GalleryEdit(props) { const { setAttributes, attributes, className, clientId, isSelected, insertBlocksAfter, isContentLocked, onFocus } = props; const { columns, imageCrop, randomOrder, linkTarget, linkTo, sizeSlug } = attributes; const { __unstableMarkNextChangeAsNotPersistent, replaceInnerBlocks, updateBlockAttributes, selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const { getBlock, getSettings, innerBlockImages, blockWasJustInserted, multiGallerySelection } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _getBlock$innerBlocks; const { getBlockName, getMultiSelectedBlockClientIds, getSettings: _getSettings, getBlock: _getBlock, wasBlockJustInserted } = select(external_wp_blockEditor_namespaceObject.store); const multiSelectedClientIds = getMultiSelectedBlockClientIds(); return { getBlock: _getBlock, getSettings: _getSettings, innerBlockImages: (_getBlock$innerBlocks = _getBlock(clientId)?.innerBlocks) !== null && _getBlock$innerBlocks !== void 0 ? _getBlock$innerBlocks : EMPTY_ARRAY, blockWasJustInserted: wasBlockJustInserted(clientId, 'inserter_menu'), multiGallerySelection: multiSelectedClientIds.length && multiSelectedClientIds.every(_clientId => getBlockName(_clientId) === 'core/gallery') }; }, [clientId]); const images = (0,external_wp_element_namespaceObject.useMemo)(() => innerBlockImages?.map(block => ({ clientId: block.clientId, id: block.attributes.id, url: block.attributes.url, attributes: block.attributes, fromSavedContent: Boolean(block.originalContent) })), [innerBlockImages]); const imageData = useGetMedia(innerBlockImages); const newImages = useGetNewImages(images, imageData); (0,external_wp_element_namespaceObject.useEffect)(() => { newImages?.forEach(newImage => { // Update the images data without creating new undo levels. __unstableMarkNextChangeAsNotPersistent(); updateBlockAttributes(newImage.clientId, { ...buildImageAttributes(newImage.attributes), id: newImage.id, align: undefined }); }); }, [newImages]); const imageSizeOptions = useImageSizes(imageData, isSelected, getSettings); /** * Determines the image attributes that should be applied to an image block * after the gallery updates. * * The gallery will receive the full collection of images when a new image * is added. As a result we need to reapply the image's original settings if * it already existed in the gallery. If the image is in fact new, we need * to apply the gallery's current settings to the image. * * @param {Object} imageAttributes Media object for the actual image. * @return {Object} Attributes to set on the new image block. */ function buildImageAttributes(imageAttributes) { const image = imageAttributes.id ? imageData.find(({ id }) => id === imageAttributes.id) : null; let newClassName; if (imageAttributes.className && imageAttributes.className !== '') { newClassName = imageAttributes.className; } let newLinkTarget; if (imageAttributes.linkTarget || imageAttributes.rel) { // When transformed from image blocks, the link destination and rel attributes are inherited. newLinkTarget = { linkTarget: imageAttributes.linkTarget, rel: imageAttributes.rel }; } else { // When an image is added, update the link destination and rel attributes according to the gallery settings newLinkTarget = getUpdatedLinkTargetSettings(linkTarget, attributes); } return { ...pickRelevantMediaFiles(image, sizeSlug), ...utils_getHrefAndDestination(image, linkTo, imageAttributes?.linkDestination), ...newLinkTarget, className: newClassName, sizeSlug, caption: imageAttributes.caption || image.caption?.raw, alt: imageAttributes.alt || image.alt_text }; } function isValidFileType(file) { // It's necessary to retrieve the media type from the raw image data for already-uploaded images on native. const nativeFileData = external_wp_element_namespaceObject.Platform.isNative && file.id ? imageData.find(({ id }) => id === file.id) : null; const mediaTypeSelector = nativeFileData ? nativeFileData?.media_type : file.type; return edit_ALLOWED_MEDIA_TYPES.some(mediaType => mediaTypeSelector?.indexOf(mediaType) === 0) || file.url?.indexOf('blob:') === 0; } function updateImages(selectedImages) { const newFileUploads = Object.prototype.toString.call(selectedImages) === '[object FileList]'; const imageArray = newFileUploads ? Array.from(selectedImages).map(file => { if (!file.url) { return pickRelevantMediaFiles({ url: (0,external_wp_blob_namespaceObject.createBlobURL)(file) }); } return file; }) : selectedImages; if (!imageArray.every(isValidFileType)) { createErrorNotice((0,external_wp_i18n_namespaceObject.__)('If uploading to a gallery all files need to be image formats'), { id: 'gallery-upload-invalid-file', type: 'snackbar' }); } const processedImages = imageArray.filter(file => file.url || isValidFileType(file)).map(file => { if (!file.url) { return pickRelevantMediaFiles({ url: (0,external_wp_blob_namespaceObject.createBlobURL)(file) }); } return file; }); // Because we are reusing existing innerImage blocks any reordering // done in the media library will be lost so we need to reapply that ordering // once the new image blocks are merged in with existing. const newOrderMap = processedImages.reduce((result, image, index) => (result[image.id] = index, result), {}); const existingImageBlocks = !newFileUploads ? innerBlockImages.filter(block => processedImages.find(img => img.id === block.attributes.id)) : innerBlockImages; const newImageList = processedImages.filter(img => !existingImageBlocks.find(existingImg => img.id === existingImg.attributes.id)); const newBlocks = newImageList.map(image => { return (0,external_wp_blocks_namespaceObject.createBlock)('core/image', { id: image.id, url: image.url, caption: image.caption, alt: image.alt }); }); replaceInnerBlocks(clientId, existingImageBlocks.concat(newBlocks).sort((a, b) => newOrderMap[a.attributes.id] - newOrderMap[b.attributes.id])); // Select the first block to scroll into view when new blocks are added. if (newBlocks?.length > 0) { selectBlock(newBlocks[0].clientId); } } function onUploadError(message) { createErrorNotice(message, { type: 'snackbar' }); } function setLinkTo(value) { setAttributes({ linkTo: value }); const changedAttributes = {}; const blocks = []; getBlock(clientId).innerBlocks.forEach(block => { blocks.push(block.clientId); const image = block.attributes.id ? imageData.find(({ id }) => id === block.attributes.id) : null; changedAttributes[block.clientId] = utils_getHrefAndDestination(image, value); }); updateBlockAttributes(blocks, changedAttributes, true); const linkToText = [...linkOptions].find(linkType => linkType.value === value); createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: image size settings */ (0,external_wp_i18n_namespaceObject.__)('All gallery image links updated to: %s'), linkToText.label), { id: 'gallery-attributes-linkTo', type: 'snackbar' }); } function setColumnsNumber(value) { setAttributes({ columns: value }); } function toggleImageCrop() { setAttributes({ imageCrop: !imageCrop }); } function toggleRandomOrder() { setAttributes({ randomOrder: !randomOrder }); } function toggleOpenInNewTab(openInNewTab) { const newLinkTarget = openInNewTab ? '_blank' : undefined; setAttributes({ linkTarget: newLinkTarget }); const changedAttributes = {}; const blocks = []; getBlock(clientId).innerBlocks.forEach(block => { blocks.push(block.clientId); changedAttributes[block.clientId] = getUpdatedLinkTargetSettings(newLinkTarget, block.attributes); }); updateBlockAttributes(blocks, changedAttributes, true); const noticeText = openInNewTab ? (0,external_wp_i18n_namespaceObject.__)('All gallery images updated to open in new tab') : (0,external_wp_i18n_namespaceObject.__)('All gallery images updated to not open in new tab'); createSuccessNotice(noticeText, { id: 'gallery-attributes-openInNewTab', type: 'snackbar' }); } function updateImagesSize(newSizeSlug) { setAttributes({ sizeSlug: newSizeSlug }); const changedAttributes = {}; const blocks = []; getBlock(clientId).innerBlocks.forEach(block => { blocks.push(block.clientId); const image = block.attributes.id ? imageData.find(({ id }) => id === block.attributes.id) : null; changedAttributes[block.clientId] = getImageSizeAttributes(image, newSizeSlug); }); updateBlockAttributes(blocks, changedAttributes, true); const imageSize = imageSizeOptions.find(size => size.value === newSizeSlug); createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: image size settings */ (0,external_wp_i18n_namespaceObject.__)('All gallery image sizes updated to: %s'), imageSize.label), { id: 'gallery-attributes-sizeSlug', type: 'snackbar' }); } (0,external_wp_element_namespaceObject.useEffect)(() => { // linkTo attribute must be saved so blocks don't break when changing image_default_link_type in options.php. if (!linkTo) { __unstableMarkNextChangeAsNotPersistent(); setAttributes({ linkTo: window?.wp?.media?.view?.settings?.defaultProps?.link || LINK_DESTINATION_NONE }); } }, [linkTo]); const hasImages = !!images.length; const hasImageIds = hasImages && images.some(image => !!image.id); const imagesUploading = images.some(img => !external_wp_element_namespaceObject.Platform.isNative ? !img.id && img.url?.indexOf('blob:') === 0 : img.url?.indexOf('file:') === 0); // MediaPlaceholder props are different between web and native hence, we provide a platform-specific set. const mediaPlaceholderProps = external_wp_element_namespaceObject.Platform.select({ web: { addToGallery: false, disableMediaButtons: imagesUploading, value: {} }, native: { addToGallery: hasImageIds, isAppender: hasImages, disableMediaButtons: hasImages && !isSelected || imagesUploading, value: hasImageIds ? images : {}, autoOpenMediaUpload: !hasImages && isSelected && blockWasJustInserted, onFocus } }); const mediaPlaceholder = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.MediaPlaceholder, { handleUpload: false, icon: sharedIcon, labels: { title: (0,external_wp_i18n_namespaceObject.__)('Gallery'), instructions: PLACEHOLDER_TEXT }, onSelect: updateImages, accept: "image/*", allowedTypes: edit_ALLOWED_MEDIA_TYPES, multiple: true, onError: onUploadError, ...mediaPlaceholderProps }); const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({ className: dist_clsx(className, 'has-nested-images') }); const nativeInnerBlockProps = external_wp_element_namespaceObject.Platform.isNative && { marginHorizontal: 0, marginVertical: 0 }; const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(blockProps, { defaultBlock: gallery_edit_DEFAULT_BLOCK, directInsert: true, orientation: 'horizontal', renderAppender: false, ...nativeInnerBlockProps }); if (!hasImages) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.View, { ...innerBlocksProps, children: [innerBlocksProps.children, mediaPlaceholder] }); } const hasLinkTo = linkTo && linkTo !== 'none'; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorControls, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)('Settings'), children: [images.length > 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Columns'), value: columns ? columns : defaultColumnsNumber(images.length), onChange: setColumnsNumber, min: 1, max: Math.min(MAX_COLUMNS, images.length), ...MOBILE_CONTROL_PROPS_RANGE_CONTROL, required: true, __next40pxDefaultSize: true }), imageSizeOptions?.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Resolution'), help: (0,external_wp_i18n_namespaceObject.__)('Select the size of the source images.'), value: sizeSlug, options: imageSizeOptions, onChange: updateImagesSize, hideCancelButton: true, size: "__unstable-large" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Link to'), value: linkTo, onChange: setLinkTo, options: linkOptions, hideCancelButton: true, size: "__unstable-large" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Crop images to fit'), checked: !!imageCrop, onChange: toggleImageCrop }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Randomize order'), checked: !!randomOrder, onChange: toggleRandomOrder }), hasLinkTo && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Open images in new tab'), checked: linkTarget === '_blank', onChange: toggleOpenInNewTab }), external_wp_element_namespaceObject.Platform.isWeb && !imageSizeOptions && hasImageIds && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.BaseControl, { className: "gallery-image-sizes", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { children: (0,external_wp_i18n_namespaceObject.__)('Resolution') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.View, { className: "gallery-image-sizes__loading", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}), (0,external_wp_i18n_namespaceObject.__)('Loading options…')] })] })] }) }), external_wp_element_namespaceObject.Platform.isWeb && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [!multiGallerySelection && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, { group: "other", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.MediaReplaceFlow, { allowedTypes: edit_ALLOWED_MEDIA_TYPES, accept: "image/*", handleUpload: false, onSelect: updateImages, name: (0,external_wp_i18n_namespaceObject.__)('Add'), multiple: true, mediaIds: images.filter(image => image.id).map(image => image.id), addToGallery: hasImageIds }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GapStyles, { blockGap: attributes.style?.spacing?.blockGap, clientId: clientId })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Gallery, { ...props, isContentLocked: isContentLocked, images: images, mediaPlaceholder: !hasImages || external_wp_element_namespaceObject.Platform.isNative ? mediaPlaceholder : undefined, blockProps: innerBlocksProps, insertBlocksAfter: insertBlocksAfter, multiGallerySelection: multiGallerySelection })] }); } /* harmony default export */ const gallery_edit = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_viewport_namespaceObject.withViewportMatch)({ isNarrow: '< small' })])(GalleryEdit)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/v1/shared.js const shared_pickRelevantMediaFiles = (image, sizeSlug = 'large') => { const imageProps = Object.fromEntries(Object.entries(image !== null && image !== void 0 ? image : {}).filter(([key]) => ['alt', 'id', 'link', 'caption'].includes(key))); imageProps.url = image?.sizes?.[sizeSlug]?.url || image?.media_details?.sizes?.[sizeSlug]?.source_url || image?.url; const fullUrl = image?.sizes?.full?.url || image?.media_details?.sizes?.full?.source_url; if (fullUrl) { imageProps.fullUrl = fullUrl; } return imageProps; }; ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/image.js /** * WordPress dependencies */ const image_image = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z" }) }); /* harmony default export */ const library_image = (image_image); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left.js /** * WordPress dependencies */ const chevronLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" }) }); /* harmony default export */ const chevron_left = (chevronLeft); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right.js /** * WordPress dependencies */ const chevronRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" }) }); /* harmony default export */ const chevron_right = (chevronRight); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js /** * WordPress dependencies */ const closeSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" }) }); /* harmony default export */ const close_small = (closeSmall); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/v1/constants.js const v1_constants_LINK_DESTINATION_NONE = 'none'; const v1_constants_LINK_DESTINATION_MEDIA = 'file'; const v1_constants_LINK_DESTINATION_ATTACHMENT = 'post'; ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/v1/gallery-image.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const isTemporaryImage = (id, url) => !id && (0,external_wp_blob_namespaceObject.isBlobURL)(url); class GalleryImage extends external_wp_element_namespaceObject.Component { constructor() { super(...arguments); this.onSelectImage = this.onSelectImage.bind(this); this.onRemoveImage = this.onRemoveImage.bind(this); this.bindContainer = this.bindContainer.bind(this); this.onEdit = this.onEdit.bind(this); this.onSelectImageFromLibrary = this.onSelectImageFromLibrary.bind(this); this.onSelectCustomURL = this.onSelectCustomURL.bind(this); this.state = { isEditing: false }; } bindContainer(ref) { this.container = ref; } onSelectImage() { if (!this.props.isSelected) { this.props.onSelect(); } } onRemoveImage(event) { if (this.container === this.container.ownerDocument.activeElement && this.props.isSelected && [external_wp_keycodes_namespaceObject.BACKSPACE, external_wp_keycodes_namespaceObject.DELETE].indexOf(event.keyCode) !== -1) { event.preventDefault(); this.props.onRemove(); } } onEdit() { this.setState({ isEditing: true }); } componentDidUpdate() { const { image, url, __unstableMarkNextChangeAsNotPersistent } = this.props; if (image && !url) { __unstableMarkNextChangeAsNotPersistent(); this.props.setAttributes({ url: image.source_url, alt: image.alt_text }); } } deselectOnBlur() { this.props.onDeselect(); } onSelectImageFromLibrary(media) { const { setAttributes, id, url, alt, caption, sizeSlug } = this.props; if (!media || !media.url) { return; } let mediaAttributes = shared_pickRelevantMediaFiles(media, sizeSlug); // If the current image is temporary but an alt text was meanwhile // written by the user, make sure the text is not overwritten. if (isTemporaryImage(id, url)) { if (alt) { const { alt: omittedAlt, ...restMediaAttributes } = mediaAttributes; mediaAttributes = restMediaAttributes; } } // If a caption text was meanwhile written by the user, // make sure the text is not overwritten by empty captions. if (caption && !mediaAttributes.caption) { const { caption: omittedCaption, ...restMediaAttributes } = mediaAttributes; mediaAttributes = restMediaAttributes; } setAttributes(mediaAttributes); this.setState({ isEditing: false }); } onSelectCustomURL(newURL) { const { setAttributes, url } = this.props; if (newURL !== url) { setAttributes({ url: newURL, id: undefined }); this.setState({ isEditing: false }); } } render() { const { url, alt, id, linkTo, link, isFirstItem, isLastItem, isSelected, caption, onRemove, onMoveForward, onMoveBackward, setAttributes, 'aria-label': ariaLabel } = this.props; const { isEditing } = this.state; let href; switch (linkTo) { case v1_constants_LINK_DESTINATION_MEDIA: href = url; break; case v1_constants_LINK_DESTINATION_ATTACHMENT: href = link; break; } const img = /*#__PURE__*/ // Disable reason: Image itself is not meant to be interactive, but should // direct image selection and unfocus caption fields. /* eslint-disable jsx-a11y/no-noninteractive-element-interactions */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: url, alt: alt, "data-id": id, onKeyDown: this.onRemoveImage, tabIndex: "0", "aria-label": ariaLabel, ref: this.bindContainer }), (0,external_wp_blob_namespaceObject.isBlobURL)(url) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {})] }) /* eslint-enable jsx-a11y/no-noninteractive-element-interactions */; const className = dist_clsx({ 'is-selected': isSelected, 'is-transient': (0,external_wp_blob_namespaceObject.isBlobURL)(url) }); return ( /*#__PURE__*/ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions (0,external_ReactJSXRuntime_namespaceObject.jsxs)("figure", { className: className, onClick: this.onSelectImage, onFocus: this.onSelectImage, children: [!isEditing && (href ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { href: href, children: img }) : img), isEditing && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.MediaPlaceholder, { labels: { title: (0,external_wp_i18n_namespaceObject.__)('Edit gallery image') }, icon: library_image, onSelect: this.onSelectImageFromLibrary, onSelectURL: this.onSelectCustomURL, accept: "image/*", allowedTypes: ['image'], value: { id, src: url } }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ButtonGroup, { className: "block-library-gallery-item__inline-menu is-left", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { icon: chevron_left, onClick: isFirstItem ? undefined : onMoveBackward, label: (0,external_wp_i18n_namespaceObject.__)('Move image backward'), "aria-disabled": isFirstItem // Disable reason: Truly disable when image is not selected. // eslint-disable-next-line no-restricted-syntax , disabled: !isSelected }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { icon: chevron_right, onClick: isLastItem ? undefined : onMoveForward, label: (0,external_wp_i18n_namespaceObject.__)('Move image forward'), "aria-disabled": isLastItem // Disable reason: Truly disable when image is not selected. // eslint-disable-next-line no-restricted-syntax , disabled: !isSelected })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ButtonGroup, { className: "block-library-gallery-item__inline-menu is-right", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { icon: library_edit, onClick: this.onEdit, label: (0,external_wp_i18n_namespaceObject.__)('Replace image') // Disable reason: Truly disable when image is not selected. // eslint-disable-next-line no-restricted-syntax , disabled: !isSelected }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { icon: close_small, onClick: onRemove, label: (0,external_wp_i18n_namespaceObject.__)('Remove image') // Disable reason: Truly disable when image is not selected. // eslint-disable-next-line no-restricted-syntax , disabled: !isSelected })] }), !isEditing && (isSelected || caption) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText, { tagName: "figcaption", className: (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('caption'), "aria-label": (0,external_wp_i18n_namespaceObject.__)('Image caption text'), placeholder: isSelected ? (0,external_wp_i18n_namespaceObject.__)('Add caption') : null, value: caption, onChange: newCaption => setAttributes({ caption: newCaption }), inlineToolbar: true })] }) ); } } /* harmony default export */ const gallery_image = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, ownProps) => { const { getMedia } = select(external_wp_coreData_namespaceObject.store); const { id } = ownProps; return { image: id ? getMedia(parseInt(id, 10)) : null }; }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => { const { __unstableMarkNextChangeAsNotPersistent } = dispatch(external_wp_blockEditor_namespaceObject.store); return { __unstableMarkNextChangeAsNotPersistent }; })])(GalleryImage)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/v1/gallery.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ const gallery_Gallery = props => { const { attributes, isSelected, setAttributes, selectedImage, mediaPlaceholder, onMoveBackward, onMoveForward, onRemoveImage, onSelectImage, onDeselectImage, onSetImageAttributes, insertBlocksAfter, blockProps } = props; const { align, columns = defaultColumnsNumberV1(attributes), caption, imageCrop, images } = attributes; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("figure", { ...blockProps, className: dist_clsx(blockProps.className, { [`align${align}`]: align, [`columns-${columns}`]: columns, 'is-cropped': imageCrop }), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { className: "blocks-gallery-grid", children: images.map((img, index) => { const ariaLabel = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: the order number of the image. 2: the total number of images. */ (0,external_wp_i18n_namespaceObject.__)('image %1$d of %2$d in gallery'), index + 1, images.length); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { className: "blocks-gallery-item", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(gallery_image, { url: img.url, alt: img.alt, id: img.id, isFirstItem: index === 0, isLastItem: index + 1 === images.length, isSelected: isSelected && selectedImage === index, onMoveBackward: onMoveBackward(index), onMoveForward: onMoveForward(index), onRemove: onRemoveImage(index), onSelect: onSelectImage(index), onDeselect: onDeselectImage(index), setAttributes: attrs => onSetImageAttributes(index, attrs), caption: img.caption, "aria-label": ariaLabel, sizeSlug: attributes.sizeSlug }) }, img.id ? `${img.id}-${index}` : img.url); }) }), mediaPlaceholder, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RichTextVisibilityHelper, { isHidden: !isSelected && external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption), tagName: "figcaption", className: dist_clsx('blocks-gallery-caption', (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('caption')), "aria-label": (0,external_wp_i18n_namespaceObject.__)('Gallery caption text'), placeholder: (0,external_wp_i18n_namespaceObject.__)('Write gallery caption…'), value: caption, onChange: value => setAttributes({ caption: value }), inlineToolbar: true, __unstableOnSplitAtEnd: () => insertBlocksAfter((0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)())) })] }); }; function RichTextVisibilityHelper({ isHidden, ...richTextProps }) { return isHidden ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: external_wp_blockEditor_namespaceObject.RichText, ...richTextProps }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText, { ...richTextProps }); } /* harmony default export */ const v1_gallery = (gallery_Gallery); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/v1/edit.js /** * WordPress dependencies */ /** * Internal dependencies */ const edit_MAX_COLUMNS = 8; const edit_linkOptions = [{ value: v1_constants_LINK_DESTINATION_ATTACHMENT, label: (0,external_wp_i18n_namespaceObject.__)('Attachment Page') }, { value: v1_constants_LINK_DESTINATION_MEDIA, label: (0,external_wp_i18n_namespaceObject.__)('Media File') }, { value: v1_constants_LINK_DESTINATION_NONE, label: (0,external_wp_i18n_namespaceObject.__)('None') }]; const v1_edit_ALLOWED_MEDIA_TYPES = ['image']; const edit_PLACEHOLDER_TEXT = external_wp_element_namespaceObject.Platform.select({ web: (0,external_wp_i18n_namespaceObject.__)('Drag images, upload new ones or select files from your library.'), native: (0,external_wp_i18n_namespaceObject.__)('ADD MEDIA') }); const edit_MOBILE_CONTROL_PROPS_RANGE_CONTROL = external_wp_element_namespaceObject.Platform.select({ web: {}, native: { type: 'stepper' } }); function edit_GalleryEdit(props) { const { attributes, clientId, isSelected, noticeUI, noticeOperations, onFocus } = props; const { columns = defaultColumnsNumberV1(attributes), imageCrop, images, linkTo, sizeSlug } = attributes; const [selectedImage, setSelectedImage] = (0,external_wp_element_namespaceObject.useState)(); const [attachmentCaptions, setAttachmentCaptions] = (0,external_wp_element_namespaceObject.useState)(); const { __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const { imageSizes, mediaUpload, getMedia, wasBlockJustInserted } = (0,external_wp_data_namespaceObject.useSelect)(select => { const settings = select(external_wp_blockEditor_namespaceObject.store).getSettings(); return { imageSizes: settings.imageSizes, mediaUpload: settings.mediaUpload, getMedia: select(external_wp_coreData_namespaceObject.store).getMedia, wasBlockJustInserted: select(external_wp_blockEditor_namespaceObject.store).wasBlockJustInserted(clientId, 'inserter_menu') }; }); const resizedImages = (0,external_wp_element_namespaceObject.useMemo)(() => { if (isSelected) { var _attributes$ids; return ((_attributes$ids = attributes.ids) !== null && _attributes$ids !== void 0 ? _attributes$ids : []).reduce((currentResizedImages, id) => { if (!id) { return currentResizedImages; } const image = getMedia(id); const sizes = imageSizes.reduce((currentSizes, size) => { const defaultUrl = image?.sizes?.[size.slug]?.url; const mediaDetailsUrl = image?.media_details?.sizes?.[size.slug]?.source_url; return { ...currentSizes, [size.slug]: defaultUrl || mediaDetailsUrl }; }, {}); return { ...currentResizedImages, [parseInt(id, 10)]: sizes }; }, {}); } return {}; }, [isSelected, attributes.ids, imageSizes]); function onFocusGalleryCaption() { setSelectedImage(); } function setAttributes(newAttrs) { if (newAttrs.ids) { throw new Error('The "ids" attribute should not be changed directly. It is managed automatically when "images" attribute changes'); } if (newAttrs.images) { newAttrs = { ...newAttrs, // Unlike images[ n ].id which is a string, always ensure the // ids array contains numbers as per its attribute type. ids: newAttrs.images.map(({ id }) => parseInt(id, 10)) }; } props.setAttributes(newAttrs); } function onSelectImage(index) { return () => { setSelectedImage(index); }; } function onDeselectImage() { return () => { setSelectedImage(); }; } function onMove(oldIndex, newIndex) { const newImages = [...images]; newImages.splice(newIndex, 1, images[oldIndex]); newImages.splice(oldIndex, 1, images[newIndex]); setSelectedImage(newIndex); setAttributes({ images: newImages }); } function onMoveForward(oldIndex) { return () => { if (oldIndex === images.length - 1) { return; } onMove(oldIndex, oldIndex + 1); }; } function onMoveBackward(oldIndex) { return () => { if (oldIndex === 0) { return; } onMove(oldIndex, oldIndex - 1); }; } function onRemoveImage(index) { return () => { const newImages = images.filter((img, i) => index !== i); setSelectedImage(); setAttributes({ images: newImages, columns: attributes.columns ? Math.min(newImages.length, attributes.columns) : attributes.columns }); }; } function selectCaption(newImage) { // The image id in both the images and attachmentCaptions arrays is a // string, so ensure comparison works correctly by converting the // newImage.id to a string. const newImageId = newImage.id.toString(); const currentImage = images.find(({ id }) => id === newImageId); const currentImageCaption = currentImage ? currentImage.caption : newImage.caption; if (!attachmentCaptions) { return currentImageCaption; } const attachment = attachmentCaptions.find(({ id }) => id === newImageId); // If the attachment caption is updated. if (attachment && attachment.caption !== newImage.caption) { return newImage.caption; } return currentImageCaption; } function onSelectImages(newImages) { setAttachmentCaptions(newImages.map(newImage => ({ // Store the attachmentCaption id as a string for consistency // with the type of the id in the images attribute. id: newImage.id.toString(), caption: newImage.caption }))); setAttributes({ images: newImages.map(newImage => ({ ...shared_pickRelevantMediaFiles(newImage, sizeSlug), caption: selectCaption(newImage, images, attachmentCaptions), // The id value is stored in a data attribute, so when the // block is parsed it's converted to a string. Converting // to a string here ensures it's type is consistent. id: newImage.id.toString() })), columns: attributes.columns ? Math.min(newImages.length, attributes.columns) : attributes.columns }); } function onUploadError(message) { noticeOperations.removeAllNotices(); noticeOperations.createErrorNotice(message); } function setLinkTo(value) { setAttributes({ linkTo: value }); } function setColumnsNumber(value) { setAttributes({ columns: value }); } function toggleImageCrop() { setAttributes({ imageCrop: !imageCrop }); } function getImageCropHelp(checked) { return checked ? (0,external_wp_i18n_namespaceObject.__)('Thumbnails are cropped to align.') : (0,external_wp_i18n_namespaceObject.__)('Thumbnails are not cropped.'); } function setImageAttributes(index, newAttributes) { if (!images[index]) { return; } setAttributes({ images: [...images.slice(0, index), { ...images[index], ...newAttributes }, ...images.slice(index + 1)] }); } function getImagesSizeOptions() { const resizedImageSizes = Object.values(resizedImages); return imageSizes.filter(({ slug }) => resizedImageSizes.some(sizes => sizes[slug])).map(({ name, slug }) => ({ value: slug, label: name })); } function updateImagesSize(newSizeSlug) { const updatedImages = (images !== null && images !== void 0 ? images : []).map(image => { if (!image.id) { return image; } const url = resizedImages[parseInt(image.id, 10)]?.[newSizeSlug]; return { ...image, ...(url && { url }) }; }); setAttributes({ images: updatedImages, sizeSlug: newSizeSlug }); } (0,external_wp_element_namespaceObject.useEffect)(() => { if (external_wp_element_namespaceObject.Platform.OS === 'web' && images && images.length > 0 && images.every(({ url }) => (0,external_wp_blob_namespaceObject.isBlobURL)(url))) { const filesList = images.map(({ url }) => (0,external_wp_blob_namespaceObject.getBlobByURL)(url)); images.forEach(({ url }) => (0,external_wp_blob_namespaceObject.revokeBlobURL)(url)); mediaUpload({ filesList, onFileChange: onSelectImages, allowedTypes: ['image'] }); } }, []); (0,external_wp_element_namespaceObject.useEffect)(() => { // Deselect images when deselecting the block. if (!isSelected) { setSelectedImage(); } }, [isSelected]); (0,external_wp_element_namespaceObject.useEffect)(() => { // linkTo attribute must be saved so blocks don't break when changing // image_default_link_type in options.php. if (!linkTo) { __unstableMarkNextChangeAsNotPersistent(); setAttributes({ linkTo: window?.wp?.media?.view?.settings?.defaultProps?.link || v1_constants_LINK_DESTINATION_NONE }); } }, [linkTo]); const hasImages = !!images.length; const hasImageIds = hasImages && images.some(image => !!image.id); const mediaPlaceholder = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.MediaPlaceholder, { addToGallery: hasImageIds, isAppender: hasImages, disableMediaButtons: hasImages && !isSelected, icon: !hasImages && sharedIcon, labels: { title: !hasImages && (0,external_wp_i18n_namespaceObject.__)('Gallery'), instructions: !hasImages && edit_PLACEHOLDER_TEXT }, onSelect: onSelectImages, accept: "image/*", allowedTypes: v1_edit_ALLOWED_MEDIA_TYPES, multiple: true, value: hasImageIds ? images : {}, onError: onUploadError, notices: hasImages ? undefined : noticeUI, onFocus: onFocus, autoOpenMediaUpload: !hasImages && isSelected && wasBlockJustInserted }); const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)(); if (!hasImages) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.View, { ...blockProps, children: mediaPlaceholder }); } const imageSizeOptions = getImagesSizeOptions(); const shouldShowSizeOptions = hasImages && imageSizeOptions.length > 0; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorControls, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)('Settings'), children: [images.length > 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Columns'), value: columns, onChange: setColumnsNumber, min: 1, max: Math.min(edit_MAX_COLUMNS, images.length), ...edit_MOBILE_CONTROL_PROPS_RANGE_CONTROL, required: true }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Crop images'), checked: !!imageCrop, onChange: toggleImageCrop, help: getImageCropHelp }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Link to'), value: linkTo, onChange: setLinkTo, options: edit_linkOptions, hideCancelButton: true }), shouldShowSizeOptions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Image size'), value: sizeSlug, options: imageSizeOptions, onChange: updateImagesSize, hideCancelButton: true })] }) }), noticeUI, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(v1_gallery, { ...props, selectedImage: selectedImage, mediaPlaceholder: mediaPlaceholder, onMoveBackward: onMoveBackward, onMoveForward: onMoveForward, onRemoveImage: onRemoveImage, onSelectImage: onSelectImage, onDeselectImage: onDeselectImage, onSetImageAttributes: setImageAttributes, blockProps: blockProps // This prop is used by gallery.native.js. , onFocusGalleryCaption: onFocusGalleryCaption })] }); } /* harmony default export */ const v1_edit = ((0,external_wp_compose_namespaceObject.compose)([external_wp_components_namespaceObject.withNotices, (0,external_wp_viewport_namespaceObject.withViewportMatch)({ isNarrow: '< small' })])(edit_GalleryEdit)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/edit-wrapper.js /** * WordPress dependencies */ /** * Internal dependencies */ /* * Using a wrapper around the logic to load the edit for v1 of Gallery block * or the refactored version with InnerBlocks. This is to prevent conditional * use of hooks lint errors if adding this logic to the top of the edit component. */ function GalleryEditWrapper(props) { if (!isGalleryV2Enabled()) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(v1_edit, { ...props }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(gallery_edit, { ...props }); } /* harmony default export */ const edit_wrapper = ((0,external_wp_compose_namespaceObject.compose)([external_wp_components_namespaceObject.withNotices])(GalleryEditWrapper)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/v1/save.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function saveV1({ attributes }) { const { images, columns = defaultColumnsNumberV1(attributes), imageCrop, caption, linkTo } = attributes; const className = `columns-${columns} ${imageCrop ? 'is-cropped' : ''}`; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("figure", { ...external_wp_blockEditor_namespaceObject.useBlockProps.save({ className }), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { className: "blocks-gallery-grid", children: images.map(image => { let href; switch (linkTo) { case v1_constants_LINK_DESTINATION_MEDIA: href = image.fullUrl || image.url; break; case v1_constants_LINK_DESTINATION_ATTACHMENT: href = image.link; break; } const img = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: image.url, alt: image.alt, "data-id": image.id, "data-full-url": image.fullUrl, "data-link": image.link, className: image.id ? `wp-image-${image.id}` : null }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { className: "blocks-gallery-item", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("figure", { children: [href ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { href: href, children: img }) : img, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(image.caption) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { tagName: "figcaption", className: dist_clsx('blocks-gallery-item__caption', (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('caption')), value: image.caption })] }) }, image.id || image.url); }) }), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { tagName: "figcaption", className: dist_clsx('blocks-gallery-caption', (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('caption')), value: caption })] }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/save.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function saveWithInnerBlocks({ attributes }) { if (!isGalleryV2Enabled()) { return saveV1({ attributes }); } const { caption, columns, imageCrop } = attributes; const className = dist_clsx('has-nested-images', { [`columns-${columns}`]: columns !== undefined, [`columns-default`]: columns === undefined, 'is-cropped': imageCrop }); const blockProps = external_wp_blockEditor_namespaceObject.useBlockProps.save({ className }); const innerBlocksProps = external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save(blockProps); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("figure", { ...innerBlocksProps, children: [innerBlocksProps.children, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { tagName: "figcaption", className: dist_clsx('blocks-gallery-caption', (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('caption')), value: caption })] }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/transforms.js /** * WordPress dependencies */ /** * Internal dependencies */ const parseShortcodeIds = ids => { if (!ids) { return []; } return ids.split(',').map(id => parseInt(id, 10)); }; /** * Third party block plugins don't have an easy way to detect if the * innerBlocks version of the Gallery is running when they run a * 3rdPartyBlock -> GalleryBlock transform so this tranform filter * will handle this. Once the innerBlocks version is the default * in a core release, this could be deprecated and removed after * plugin authors have been given time to update transforms. * * @typedef {Object} Attributes * @typedef {Object} Block * @property {Attributes} attributes The attributes of the block. * @param {Block} block The transformed block. * @return {Block} The transformed block. */ function updateThirdPartyTransformToGallery(block) { if (isGalleryV2Enabled() && block.name === 'core/gallery' && block.attributes?.images.length > 0) { const innerBlocks = block.attributes.images.map(({ url, id, alt }) => { return (0,external_wp_blocks_namespaceObject.createBlock)('core/image', { url, id: id ? parseInt(id, 10) : null, alt, sizeSlug: block.attributes.sizeSlug, linkDestination: block.attributes.linkDestination }); }); delete block.attributes.ids; delete block.attributes.images; block.innerBlocks = innerBlocks; } return block; } (0,external_wp_hooks_namespaceObject.addFilter)('blocks.switchToBlockType.transformedBlock', 'core/gallery/update-third-party-transform-to', updateThirdPartyTransformToGallery); /** * Third party block plugins don't have an easy way to detect if the * innerBlocks version of the Gallery is running when they run a * GalleryBlock -> 3rdPartyBlock transform so this transform filter * will handle this. Once the innerBlocks version is the default * in a core release, this could be deprecated and removed after * plugin authors have been given time to update transforms. * * @typedef {Object} Attributes * @typedef {Object} Block * @property {Attributes} attributes The attributes of the block. * @param {Block} toBlock The block to transform to. * @param {Block[]} fromBlocks The blocks to transform from. * @return {Block} The transformed block. */ function updateThirdPartyTransformFromGallery(toBlock, fromBlocks) { const from = Array.isArray(fromBlocks) ? fromBlocks : [fromBlocks]; const galleryBlock = from.find(transformedBlock => transformedBlock.name === 'core/gallery' && transformedBlock.innerBlocks.length > 0 && !transformedBlock.attributes.images?.length > 0 && !toBlock.name.includes('core/')); if (galleryBlock) { const images = galleryBlock.innerBlocks.map(({ attributes: { url, id, alt } }) => ({ url, id: id ? parseInt(id, 10) : null, alt })); const ids = images.map(({ id }) => id); galleryBlock.attributes.images = images; galleryBlock.attributes.ids = ids; } return toBlock; } (0,external_wp_hooks_namespaceObject.addFilter)('blocks.switchToBlockType.transformedBlock', 'core/gallery/update-third-party-transform-from', updateThirdPartyTransformFromGallery); const gallery_transforms_transforms = { from: [{ type: 'block', isMultiBlock: true, blocks: ['core/image'], transform: attributes => { // Init the align and size from the first item which may be either the placeholder or an image. let { align, sizeSlug } = attributes[0]; // Loop through all the images and check if they have the same align and size. align = attributes.every(attribute => attribute.align === align) ? align : undefined; sizeSlug = attributes.every(attribute => attribute.sizeSlug === sizeSlug) ? sizeSlug : undefined; const validImages = attributes.filter(({ url }) => url); if (isGalleryV2Enabled()) { const innerBlocks = validImages.map(image => { // Gallery images can't currently be resized so make sure height and width are undefined. image.width = undefined; image.height = undefined; return (0,external_wp_blocks_namespaceObject.createBlock)('core/image', image); }); return (0,external_wp_blocks_namespaceObject.createBlock)('core/gallery', { align, sizeSlug }, innerBlocks); } return (0,external_wp_blocks_namespaceObject.createBlock)('core/gallery', { images: validImages.map(({ id, url, alt, caption }) => ({ id: id.toString(), url, alt, caption })), ids: validImages.map(({ id }) => parseInt(id, 10)), align, sizeSlug }); } }, { type: 'shortcode', tag: 'gallery', transform({ named: { ids, columns = 3, link, orderby } }) { const imageIds = parseShortcodeIds(ids).map(id => parseInt(id, 10)); let linkTo = LINK_DESTINATION_NONE; if (link === 'post') { linkTo = LINK_DESTINATION_ATTACHMENT; } else if (link === 'file') { linkTo = LINK_DESTINATION_MEDIA; } const galleryBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/gallery', { columns: parseInt(columns, 10), linkTo, randomOrder: orderby === 'rand' }, imageIds.map(imageId => (0,external_wp_blocks_namespaceObject.createBlock)('core/image', { id: imageId }))); return galleryBlock; }, isMatch({ named }) { return undefined !== named.ids; } }, { // When created by drag and dropping multiple files on an insertion point. Because multiple // files must not be transformed to a gallery when dropped within a gallery there is another transform // within the image block to handle that case. Therefore this transform has to have priority 1 // set so that it overrrides the image block transformation when mulitple images are dropped outside // of a gallery block. type: 'files', priority: 1, isMatch(files) { return files.length !== 1 && files.every(file => file.type.indexOf('image/') === 0); }, transform(files) { if (isGalleryV2Enabled()) { const innerBlocks = files.map(file => (0,external_wp_blocks_namespaceObject.createBlock)('core/image', { url: (0,external_wp_blob_namespaceObject.createBlobURL)(file) })); return (0,external_wp_blocks_namespaceObject.createBlock)('core/gallery', {}, innerBlocks); } const block = (0,external_wp_blocks_namespaceObject.createBlock)('core/gallery', { images: files.map(file => pickRelevantMediaFiles({ url: (0,external_wp_blob_namespaceObject.createBlobURL)(file) })) }); return block; } }], to: [{ type: 'block', blocks: ['core/image'], transform: ({ align, images, ids, sizeSlug }, innerBlocks) => { if (isGalleryV2Enabled()) { if (innerBlocks.length > 0) { return innerBlocks.map(({ attributes: { url, alt, caption, title, href, rel, linkClass, id, sizeSlug: imageSizeSlug, linkDestination, linkTarget, anchor, className } }) => (0,external_wp_blocks_namespaceObject.createBlock)('core/image', { align, url, alt, caption, title, href, rel, linkClass, id, sizeSlug: imageSizeSlug, linkDestination, linkTarget, anchor, className })); } return (0,external_wp_blocks_namespaceObject.createBlock)('core/image', { align }); } if (images.length > 0) { return images.map(({ url, alt, caption }, index) => (0,external_wp_blocks_namespaceObject.createBlock)('core/image', { id: ids[index], url, alt, caption, align, sizeSlug })); } return (0,external_wp_blocks_namespaceObject.createBlock)('core/image', { align }); } }] }; /* harmony default export */ const gallery_transforms = (gallery_transforms_transforms); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const gallery_metadata = { $schema: "https://schemas.wp.org/trunk/block.json", apiVersion: 3, name: "core/gallery", title: "Gallery", category: "media", allowedBlocks: ["core/image"], description: "Display multiple images in a rich gallery.", keywords: ["images", "photos"], textdomain: "default", attributes: { images: { type: "array", "default": [], source: "query", selector: ".blocks-gallery-item", query: { url: { type: "string", source: "attribute", selector: "img", attribute: "src" }, fullUrl: { type: "string", source: "attribute", selector: "img", attribute: "data-full-url" }, link: { type: "string", source: "attribute", selector: "img", attribute: "data-link" }, alt: { type: "string", source: "attribute", selector: "img", attribute: "alt", "default": "" }, id: { type: "string", source: "attribute", selector: "img", attribute: "data-id" }, caption: { type: "rich-text", source: "rich-text", selector: ".blocks-gallery-item__caption" } } }, ids: { type: "array", items: { type: "number" }, "default": [] }, shortCodeTransforms: { type: "array", items: { type: "object" }, "default": [] }, columns: { type: "number", minimum: 1, maximum: 8 }, caption: { type: "rich-text", source: "rich-text", selector: ".blocks-gallery-caption" }, imageCrop: { type: "boolean", "default": true }, randomOrder: { type: "boolean", "default": false }, fixedHeight: { type: "boolean", "default": true }, linkTarget: { type: "string" }, linkTo: { type: "string" }, sizeSlug: { type: "string", "default": "large" }, allowResize: { type: "boolean", "default": false } }, providesContext: { allowResize: "allowResize", imageCrop: "imageCrop", fixedHeight: "fixedHeight" }, supports: { anchor: true, align: true, html: false, units: ["px", "em", "rem", "vh", "vw"], spacing: { margin: true, padding: true, blockGap: ["horizontal", "vertical"], __experimentalSkipSerialization: ["blockGap"], __experimentalDefaultControls: { blockGap: true, margin: false, padding: false } }, color: { text: false, background: true, gradients: true }, layout: { allowSwitching: false, allowInheriting: false, allowEditing: false, "default": { type: "flex" } }, interactivity: { clientNavigation: true } }, editorStyle: "wp-block-gallery-editor", style: "wp-block-gallery" }; const { name: gallery_name } = gallery_metadata; const gallery_settings = { icon: library_gallery, example: { attributes: { columns: 2 }, innerBlocks: [{ name: 'core/image', attributes: { url: 'https://s.w.org/images/core/5.3/Glacial_lakes%2C_Bhutan.jpg' } }, { name: 'core/image', attributes: { url: 'https://s.w.org/images/core/5.3/Sediment_off_the_Yucatan_Peninsula.jpg' } }] }, transforms: gallery_transforms, edit: edit_wrapper, save: saveWithInnerBlocks, deprecated: gallery_deprecated }; const gallery_init = () => initBlock({ name: gallery_name, metadata: gallery_metadata, settings: gallery_settings }); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/group/deprecated.js /** * External dependencies */ /** * WordPress dependencies */ const migrateAttributes = attributes => { if (!attributes.tagName) { attributes = { ...attributes, tagName: 'div' }; } if (!attributes.customTextColor && !attributes.customBackgroundColor) { return attributes; } const style = { color: {} }; if (attributes.customTextColor) { style.color.text = attributes.customTextColor; } if (attributes.customBackgroundColor) { style.color.background = attributes.customBackgroundColor; } const { customTextColor, customBackgroundColor, ...restAttributes } = attributes; return { ...restAttributes, style }; }; const group_deprecated_deprecated = [ // Version with default layout. { attributes: { tagName: { type: 'string', default: 'div' }, templateLock: { type: ['string', 'boolean'], enum: ['all', 'insert', false] } }, supports: { __experimentalOnEnter: true, __experimentalSettings: true, align: ['wide', 'full'], anchor: true, ariaLabel: true, html: false, color: { gradients: true, link: true, __experimentalDefaultControls: { background: true, text: true } }, spacing: { margin: ['top', 'bottom'], padding: true, blockGap: true, __experimentalDefaultControls: { padding: true, blockGap: true } }, __experimentalBorder: { color: true, radius: true, style: true, width: true, __experimentalDefaultControls: { color: true, radius: true, style: true, width: true } }, typography: { fontSize: true, lineHeight: true, __experimentalFontStyle: true, __experimentalFontWeight: true, __experimentalLetterSpacing: true, __experimentalTextTransform: true, __experimentalDefaultControls: { fontSize: true } }, layout: true }, save({ attributes: { tagName: Tag } }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tag, { ...external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save(external_wp_blockEditor_namespaceObject.useBlockProps.save()) }); }, isEligible: ({ layout }) => !layout || layout.inherit || layout.contentSize && layout.type !== 'constrained', migrate: attributes => { const { layout = null } = attributes; if (!layout) { return attributes; } if (layout.inherit || layout.contentSize) { return { ...attributes, layout: { ...layout, type: 'constrained' } }; } } }, // Version of the block with the double div. { attributes: { tagName: { type: 'string', default: 'div' }, templateLock: { type: ['string', 'boolean'], enum: ['all', 'insert', false] } }, supports: { align: ['wide', 'full'], anchor: true, color: { gradients: true, link: true }, spacing: { padding: true }, __experimentalBorder: { radius: true } }, save({ attributes }) { const { tagName: Tag } = attributes; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tag, { ...external_wp_blockEditor_namespaceObject.useBlockProps.save(), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "wp-block-group__inner-container", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, {}) }) }); } }, // Version of the block without global styles support { attributes: { backgroundColor: { type: 'string' }, customBackgroundColor: { type: 'string' }, textColor: { type: 'string' }, customTextColor: { type: 'string' } }, supports: { align: ['wide', 'full'], anchor: true, html: false }, migrate: migrateAttributes, save({ attributes }) { const { backgroundColor, customBackgroundColor, textColor, customTextColor } = attributes; const backgroundClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', backgroundColor); const textClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor); const className = dist_clsx(backgroundClass, textClass, { 'has-text-color': textColor || customTextColor, 'has-background': backgroundColor || customBackgroundColor }); const styles = { backgroundColor: backgroundClass ? undefined : customBackgroundColor, color: textClass ? undefined : customTextColor }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: className, style: styles, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "wp-block-group__inner-container", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, {}) }) }); } }, // Version of the group block with a bug that made text color class not applied. { attributes: { backgroundColor: { type: 'string' }, customBackgroundColor: { type: 'string' }, textColor: { type: 'string' }, customTextColor: { type: 'string' } }, migrate: migrateAttributes, supports: { align: ['wide', 'full'], anchor: true, html: false }, save({ attributes }) { const { backgroundColor, customBackgroundColor, textColor, customTextColor } = attributes; const backgroundClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', backgroundColor); const textClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor); const className = dist_clsx(backgroundClass, { 'has-text-color': textColor || customTextColor, 'has-background': backgroundColor || customBackgroundColor }); const styles = { backgroundColor: backgroundClass ? undefined : customBackgroundColor, color: textClass ? undefined : customTextColor }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: className, style: styles, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "wp-block-group__inner-container", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, {}) }) }); } }, // v1 of group block. Deprecated to add an inner-container div around `InnerBlocks.Content`. { attributes: { backgroundColor: { type: 'string' }, customBackgroundColor: { type: 'string' } }, supports: { align: ['wide', 'full'], anchor: true, html: false }, migrate: migrateAttributes, save({ attributes }) { const { backgroundColor, customBackgroundColor } = attributes; const backgroundClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', backgroundColor); const className = dist_clsx(backgroundClass, { 'has-background': backgroundColor || customBackgroundColor }); const styles = { backgroundColor: backgroundClass ? undefined : customBackgroundColor }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: className, style: styles, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, {}) }); } }]; /* harmony default export */ const group_deprecated = (group_deprecated_deprecated); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/group/placeholder.js /** * WordPress dependencies */ /** * Returns a custom variation icon. * * @param {string} name The block variation name. * * @return {JSX.Element} The SVG element. */ const getGroupPlaceholderIcons = (name = 'group') => { const icons = { group: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", width: "48", height: "48", viewBox: "0 0 48 48", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { d: "M0 10a2 2 0 0 1 2-2h44a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V10Z" }) }), 'group-row': /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", width: "48", height: "48", viewBox: "0 0 48 48", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { d: "M0 10a2 2 0 0 1 2-2h19a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V10Zm25 0a2 2 0 0 1 2-2h19a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2H27a2 2 0 0 1-2-2V10Z" }) }), 'group-stack': /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", width: "48", height: "48", viewBox: "0 0 48 48", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { d: "M0 10a2 2 0 0 1 2-2h44a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V10Zm0 17a2 2 0 0 1 2-2h44a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V27Z" }) }), 'group-grid': /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", width: "48", height: "48", viewBox: "0 0 48 48", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { d: "M0 10a2 2 0 0 1 2-2h19a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V10Zm25 0a2 2 0 0 1 2-2h19a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H27a2 2 0 0 1-2-2V10ZM0 27a2 2 0 0 1 2-2h19a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V27Zm25 0a2 2 0 0 1 2-2h19a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H27a2 2 0 0 1-2-2V27Z" }) }) }; return icons?.[name]; }; /** * A custom hook to tell the Group block whether to show the variation placeholder. * * @param {Object} props Arguments to pass to hook. * @param {Object} [props.attributes] The block's attributes. * @param {string} [props.usedLayoutType] The block's current layout type. * @param {boolean} [props.hasInnerBlocks] Whether the block has inner blocks. * * @return {[boolean, Function]} A state value and setter function. */ function useShouldShowPlaceHolder({ attributes = { style: undefined, backgroundColor: undefined, textColor: undefined, fontSize: undefined }, usedLayoutType = '', hasInnerBlocks = false }) { const { style, backgroundColor, textColor, fontSize } = attributes; /* * Shows the placeholder when no known styles are set, * or when a non-default layout has been selected. * Should the Group block support more style presets in the * future, e.g., attributes.spacingSize, we can add them to the * condition. */ const [showPlaceholder, setShowPlaceholder] = (0,external_wp_element_namespaceObject.useState)(!hasInnerBlocks && !backgroundColor && !fontSize && !textColor && !style && usedLayoutType !== 'flex' && usedLayoutType !== 'grid'); (0,external_wp_element_namespaceObject.useEffect)(() => { if (!!hasInnerBlocks || !!backgroundColor || !!fontSize || !!textColor || !!style || usedLayoutType === 'flex') { setShowPlaceholder(false); } }, [backgroundColor, fontSize, textColor, style, usedLayoutType, hasInnerBlocks]); return [showPlaceholder, setShowPlaceholder]; } /** * Display group variations if none is selected. * * @param {Object} props Component props. * @param {string} props.name The block's name. * @param {Function} props.onSelect Function to set block's attributes. * * @return {JSX.Element} The placeholder. */ function GroupPlaceHolder({ name, onSelect }) { const variations = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blocks_namespaceObject.store).getBlockVariations(name, 'block'), [name]); const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({ className: 'wp-block-group__placeholder' }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...blockProps, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, { instructions: (0,external_wp_i18n_namespaceObject.__)('Group blocks together. Select a layout:'), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { role: "list", className: "wp-block-group-placeholder__variations", "aria-label": (0,external_wp_i18n_namespaceObject.__)('Block variations'), children: variations.map(variation => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "tertiary", icon: getGroupPlaceholderIcons(variation.name), iconSize: 48, onClick: () => onSelect(variation), className: "wp-block-group-placeholder__variation-button", label: `${variation.title}: ${variation.description}` }) }, variation.name)) }) }) }); } /* harmony default export */ const placeholder = (GroupPlaceHolder); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/group/edit.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Render inspector controls for the Group block. * * @param {Object} props Component props. * @param {string} props.tagName The HTML tag name. * @param {Function} props.onSelectTagName onChange function for the SelectControl. * * @return {JSX.Element} The control group. */ function GroupEditControls({ tagName, onSelectTagName }) { const htmlElementMessages = { header: (0,external_wp_i18n_namespaceObject.__)('The <header> element should represent introductory content, typically a group of introductory or navigational aids.'), main: (0,external_wp_i18n_namespaceObject.__)('The <main> element should be used for the primary content of your document only. '), section: (0,external_wp_i18n_namespaceObject.__)("The <section> element should represent a standalone portion of the document that can't be better represented by another element."), article: (0,external_wp_i18n_namespaceObject.__)('The <article> element should represent a self-contained, syndicatable portion of the document.'), aside: (0,external_wp_i18n_namespaceObject.__)("The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content."), footer: (0,external_wp_i18n_namespaceObject.__)('The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).') }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorControls, { group: "advanced", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('HTML element'), options: [{ label: (0,external_wp_i18n_namespaceObject.__)('Default (<div>)'), value: 'div' }, { label: '<header>', value: 'header' }, { label: '<main>', value: 'main' }, { label: '<section>', value: 'section' }, { label: '<article>', value: 'article' }, { label: '<aside>', value: 'aside' }, { label: '<footer>', value: 'footer' }], value: tagName, onChange: onSelectTagName, help: htmlElementMessages[tagName] }) }); } function GroupEdit({ attributes, name, setAttributes, clientId }) { const { hasInnerBlocks, themeSupportsLayout } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlock, getSettings } = select(external_wp_blockEditor_namespaceObject.store); const block = getBlock(clientId); return { hasInnerBlocks: !!(block && block.innerBlocks.length), themeSupportsLayout: getSettings()?.supportsLayout }; }, [clientId]); const { tagName: TagName = 'div', templateLock, allowedBlocks, layout = {} } = attributes; // Layout settings. const { type = 'default' } = layout; const layoutSupportEnabled = themeSupportsLayout || type === 'flex' || type === 'grid'; // Hooks. const ref = (0,external_wp_element_namespaceObject.useRef)(); const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({ ref }); const [showPlaceholder, setShowPlaceholder] = useShouldShowPlaceHolder({ attributes, usedLayoutType: type, hasInnerBlocks }); // Default to the regular appender being rendered. let renderAppender; if (showPlaceholder) { // In the placeholder state, ensure the appender is not rendered. // This is needed because `...innerBlocksProps` is used in the placeholder // state so that blocks can dragged onto the placeholder area // from both the list view and in the editor canvas. renderAppender = false; } else if (!hasInnerBlocks) { // When there is no placeholder, but the block is also empty, // use the larger button appender. renderAppender = external_wp_blockEditor_namespaceObject.InnerBlocks.ButtonBlockAppender; } const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(layoutSupportEnabled ? blockProps : { className: 'wp-block-group__inner-container' }, { dropZoneElement: ref.current, templateLock, allowedBlocks, renderAppender }); const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const selectVariation = nextVariation => { setAttributes(nextVariation.attributes); selectBlock(clientId, -1); setShowPlaceholder(false); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GroupEditControls, { tagName: TagName, onSelectTagName: value => setAttributes({ tagName: value }) }), showPlaceholder && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.View, { children: [innerBlocksProps.children, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(placeholder, { name: name, onSelect: selectVariation })] }), layoutSupportEnabled && !showPlaceholder && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TagName, { ...innerBlocksProps }), !layoutSupportEnabled && !showPlaceholder && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TagName, { ...blockProps, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...innerBlocksProps }) })] }); } /* harmony default export */ const group_edit = (GroupEdit); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/group/save.js /** * WordPress dependencies */ function group_save_save({ attributes: { tagName: Tag } }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tag, { ...external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save(external_wp_blockEditor_namespaceObject.useBlockProps.save()) }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/group/transforms.js /** * WordPress dependencies */ const group_transforms_transforms = { from: [{ type: 'block', isMultiBlock: true, blocks: ['*'], __experimentalConvert(blocks) { const alignments = ['wide', 'full']; // Determine the widest setting of all the blocks to be grouped const widestAlignment = blocks.reduce((accumulator, block) => { const { align } = block.attributes; return alignments.indexOf(align) > alignments.indexOf(accumulator) ? align : accumulator; }, undefined); // Clone the Blocks to be Grouped // Failing to create new block references causes the original blocks // to be replaced in the switchToBlockType call thereby meaning they // are removed both from their original location and within the // new group block. const groupInnerBlocks = blocks.map(block => { return (0,external_wp_blocks_namespaceObject.createBlock)(block.name, block.attributes, block.innerBlocks); }); return (0,external_wp_blocks_namespaceObject.createBlock)('core/group', { align: widestAlignment, layout: { type: 'constrained' } }, groupInnerBlocks); } }] }; /* harmony default export */ const group_transforms = (group_transforms_transforms); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/row.js /** * WordPress dependencies */ const row = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4 6.5h5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H4V16h5a.5.5 0 0 0 .5-.5v-7A.5.5 0 0 0 9 8H4V6.5Zm16 0h-5a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h5V16h-5a.5.5 0 0 1-.5-.5v-7A.5.5 0 0 1 15 8h5V6.5Z" }) }); /* harmony default export */ const library_row = (row); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/stack.js /** * WordPress dependencies */ const stack = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.5 4v5a2 2 0 0 1-2 2h-7a2 2 0 0 1-2-2V4H8v5a.5.5 0 0 0 .5.5h7A.5.5 0 0 0 16 9V4h1.5Zm0 16v-5a2 2 0 0 0-2-2h-7a2 2 0 0 0-2 2v5H8v-5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 .5.5v5h1.5Z" }) }); /* harmony default export */ const library_stack = (stack); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/grid.js /** * WordPress dependencies */ const grid = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m3 5c0-1.10457.89543-2 2-2h13.5c1.1046 0 2 .89543 2 2v13.5c0 1.1046-.8954 2-2 2h-13.5c-1.10457 0-2-.8954-2-2zm2-.5h6v6.5h-6.5v-6c0-.27614.22386-.5.5-.5zm-.5 8v6c0 .2761.22386.5.5.5h6v-6.5zm8 0v6.5h6c.2761 0 .5-.2239.5-.5v-6zm0-8v6.5h6.5v-6c0-.27614-.2239-.5-.5-.5z", fillRule: "evenodd", clipRule: "evenodd" }) }); /* harmony default export */ const library_grid = (grid); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/group/variations.js /** * WordPress dependencies */ const group_variations_variations = [{ name: 'group', title: (0,external_wp_i18n_namespaceObject.__)('Group'), description: (0,external_wp_i18n_namespaceObject.__)('Gather blocks in a container.'), attributes: { layout: { type: 'constrained' } }, isDefault: true, scope: ['block', 'inserter', 'transform'], isActive: blockAttributes => !blockAttributes.layout || !blockAttributes.layout?.type || blockAttributes.layout?.type === 'default' || blockAttributes.layout?.type === 'constrained', icon: library_group }, { name: 'group-row', title: (0,external_wp_i18n_namespaceObject._x)('Row', 'single horizontal line'), description: (0,external_wp_i18n_namespaceObject.__)('Arrange blocks horizontally.'), attributes: { layout: { type: 'flex', flexWrap: 'nowrap' } }, scope: ['block', 'inserter', 'transform'], isActive: blockAttributes => blockAttributes.layout?.type === 'flex' && (!blockAttributes.layout?.orientation || blockAttributes.layout?.orientation === 'horizontal'), icon: library_row }, { name: 'group-stack', title: (0,external_wp_i18n_namespaceObject.__)('Stack'), description: (0,external_wp_i18n_namespaceObject.__)('Arrange blocks vertically.'), attributes: { layout: { type: 'flex', orientation: 'vertical' } }, scope: ['block', 'inserter', 'transform'], isActive: blockAttributes => blockAttributes.layout?.type === 'flex' && blockAttributes.layout?.orientation === 'vertical', icon: library_stack }, { name: 'group-grid', title: (0,external_wp_i18n_namespaceObject.__)('Grid'), description: (0,external_wp_i18n_namespaceObject.__)('Arrange blocks in a grid.'), attributes: { layout: { type: 'grid' } }, scope: ['block', 'inserter', 'transform'], isActive: blockAttributes => blockAttributes.layout?.type === 'grid', icon: library_grid }]; /* harmony default export */ const group_variations = (group_variations_variations); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/group/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const group_metadata = { $schema: "https://schemas.wp.org/trunk/block.json", apiVersion: 3, name: "core/group", title: "Group", category: "design", description: "Gather blocks in a layout container.", keywords: ["container", "wrapper", "row", "section"], textdomain: "default", attributes: { tagName: { type: "string", "default": "div" }, templateLock: { type: ["string", "boolean"], "enum": ["all", "insert", "contentOnly", false] }, allowedBlocks: { type: "array" } }, supports: { __experimentalOnEnter: true, __experimentalOnMerge: true, __experimentalSettings: true, align: ["wide", "full"], anchor: true, ariaLabel: true, html: false, background: { backgroundImage: true, backgroundSize: true, __experimentalDefaultControls: { backgroundImage: true } }, color: { gradients: true, heading: true, button: true, link: true, __experimentalDefaultControls: { background: true, text: true } }, spacing: { margin: ["top", "bottom"], padding: true, blockGap: true, __experimentalDefaultControls: { padding: true, blockGap: true } }, dimensions: { minHeight: true }, __experimentalBorder: { color: true, radius: true, style: true, width: true, __experimentalDefaultControls: { color: true, radius: true, style: true, width: true } }, position: { sticky: true }, typography: { fontSize: true, lineHeight: true, __experimentalFontFamily: true, __experimentalFontWeight: true, __experimentalFontStyle: true, __experimentalTextTransform: true, __experimentalTextDecoration: true, __experimentalLetterSpacing: true, __experimentalDefaultControls: { fontSize: true } }, layout: { allowSizingOnChildren: true }, interactivity: { clientNavigation: true } }, editorStyle: "wp-block-group-editor", style: "wp-block-group" }; const { name: group_name } = group_metadata; const group_settings = { icon: library_group, example: { innerBlocks: [{ name: 'core/paragraph', attributes: { customTextColor: '#cf2e2e', fontSize: 'large', content: (0,external_wp_i18n_namespaceObject.__)('One.') } }, { name: 'core/paragraph', attributes: { customTextColor: '#ff6900', fontSize: 'large', content: (0,external_wp_i18n_namespaceObject.__)('Two.') } }, { name: 'core/paragraph', attributes: { customTextColor: '#fcb900', fontSize: 'large', content: (0,external_wp_i18n_namespaceObject.__)('Three.') } }, { name: 'core/paragraph', attributes: { customTextColor: '#00d084', fontSize: 'large', content: (0,external_wp_i18n_namespaceObject.__)('Four.') } }, { name: 'core/paragraph', attributes: { customTextColor: '#0693e3', fontSize: 'large', content: (0,external_wp_i18n_namespaceObject.__)('Five.') } }, { name: 'core/paragraph', attributes: { customTextColor: '#9b51e0', fontSize: 'large', content: (0,external_wp_i18n_namespaceObject.__)('Six.') } }] }, transforms: group_transforms, edit: group_edit, save: group_save_save, deprecated: group_deprecated, variations: group_variations }; const group_init = () => initBlock({ name: group_name, metadata: group_metadata, settings: group_settings }); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/heading.js /** * WordPress dependencies */ const heading = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M6 5V18.5911L12 13.8473L18 18.5911V5H6Z" }) }); /* harmony default export */ const library_heading = (heading); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/heading/deprecated.js /** * External dependencies */ /** * WordPress dependencies */ const blockSupports = { className: false, anchor: true }; const heading_deprecated_blockAttributes = { align: { type: 'string' }, content: { type: 'string', source: 'html', selector: 'h1,h2,h3,h4,h5,h6', default: '' }, level: { type: 'number', default: 2 }, placeholder: { type: 'string' } }; const deprecated_migrateCustomColors = attributes => { if (!attributes.customTextColor) { return attributes; } const style = { color: { text: attributes.customTextColor } }; const { customTextColor, ...restAttributes } = attributes; return { ...restAttributes, style }; }; const TEXT_ALIGN_OPTIONS = ['left', 'right', 'center']; const migrateTextAlign = attributes => { const { align, ...rest } = attributes; return TEXT_ALIGN_OPTIONS.includes(align) ? { ...rest, textAlign: align } : attributes; }; const heading_deprecated_v1 = { supports: blockSupports, attributes: { ...heading_deprecated_blockAttributes, customTextColor: { type: 'string' }, textColor: { type: 'string' } }, migrate: attributes => deprecated_migrateCustomColors(migrateTextAlign(attributes)), save({ attributes }) { const { align, level, content, textColor, customTextColor } = attributes; const tagName = 'h' + level; const textClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor); const className = dist_clsx({ [textClass]: textClass }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { className: className ? className : undefined, tagName: tagName, style: { textAlign: align, color: textClass ? undefined : customTextColor }, value: content }); } }; const heading_deprecated_v2 = { attributes: { ...heading_deprecated_blockAttributes, customTextColor: { type: 'string' }, textColor: { type: 'string' } }, migrate: attributes => deprecated_migrateCustomColors(migrateTextAlign(attributes)), save({ attributes }) { const { align, content, customTextColor, level, textColor } = attributes; const tagName = 'h' + level; const textClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor); const className = dist_clsx({ [textClass]: textClass, [`has-text-align-${align}`]: align }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { className: className ? className : undefined, tagName: tagName, style: { color: textClass ? undefined : customTextColor }, value: content }); }, supports: blockSupports }; const heading_deprecated_v3 = { supports: blockSupports, attributes: { ...heading_deprecated_blockAttributes, customTextColor: { type: 'string' }, textColor: { type: 'string' } }, migrate: attributes => deprecated_migrateCustomColors(migrateTextAlign(attributes)), save({ attributes }) { const { align, content, customTextColor, level, textColor } = attributes; const tagName = 'h' + level; const textClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor); const className = dist_clsx({ [textClass]: textClass, 'has-text-color': textColor || customTextColor, [`has-text-align-${align}`]: align }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { className: className ? className : undefined, tagName: tagName, style: { color: textClass ? undefined : customTextColor }, value: content }); } }; const heading_deprecated_v4 = { supports: { align: ['wide', 'full'], anchor: true, className: false, color: { link: true }, fontSize: true, lineHeight: true, __experimentalSelector: { 'core/heading/h1': 'h1', 'core/heading/h2': 'h2', 'core/heading/h3': 'h3', 'core/heading/h4': 'h4', 'core/heading/h5': 'h5', 'core/heading/h6': 'h6' }, __unstablePasteTextInline: true }, attributes: heading_deprecated_blockAttributes, isEligible: ({ align }) => TEXT_ALIGN_OPTIONS.includes(align), migrate: migrateTextAlign, save({ attributes }) { const { align, content, level } = attributes; const TagName = 'h' + level; const className = dist_clsx({ [`has-text-align-${align}`]: align }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TagName, { ...external_wp_blockEditor_namespaceObject.useBlockProps.save({ className }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { value: content }) }); } }; // This deprecation covers the serialization of the `wp-block-heading` class // into the block's markup after className support was enabled. const heading_deprecated_v5 = { supports: { align: ['wide', 'full'], anchor: true, className: false, color: { gradients: true, link: true, __experimentalDefaultControls: { background: true, text: true } }, spacing: { margin: true, padding: true }, typography: { fontSize: true, lineHeight: true, __experimentalFontFamily: true, __experimentalFontStyle: true, __experimentalFontWeight: true, __experimentalLetterSpacing: true, __experimentalTextTransform: true, __experimentalTextDecoration: true, __experimentalDefaultControls: { fontSize: true, fontAppearance: true, textTransform: true } }, __experimentalSelector: 'h1,h2,h3,h4,h5,h6', __unstablePasteTextInline: true, __experimentalSlashInserter: true }, attributes: { textAlign: { type: 'string' }, content: { type: 'string', source: 'html', selector: 'h1,h2,h3,h4,h5,h6', default: '', __experimentalRole: 'content' }, level: { type: 'number', default: 2 }, placeholder: { type: 'string' } }, save({ attributes }) { const { textAlign, content, level } = attributes; const TagName = 'h' + level; const className = dist_clsx({ [`has-text-align-${textAlign}`]: textAlign }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TagName, { ...external_wp_blockEditor_namespaceObject.useBlockProps.save({ className }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { value: content }) }); } }; const heading_deprecated_deprecated = [heading_deprecated_v5, heading_deprecated_v4, heading_deprecated_v3, heading_deprecated_v2, heading_deprecated_v1]; /* harmony default export */ const heading_deprecated = (heading_deprecated_deprecated); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/heading/autogenerate-anchors.js /** * External dependencies */ /** * Object map tracking anchors. * * @type {Record<string, string | null>} */ const autogenerate_anchors_anchors = {}; /** * Returns the text without markup. * * @param {string} text The text. * * @return {string} The text without markup. */ const getTextWithoutMarkup = text => { const dummyElement = document.createElement('div'); dummyElement.innerHTML = text; return dummyElement.innerText; }; /** * Get the slug from the content. * * @param {string} content The block content. * * @return {string} Returns the slug. */ const getSlug = content => { // Get the slug. return remove_accents_default()(getTextWithoutMarkup(content)) // Convert anything that's not a letter or number to a hyphen. .replace(/[^\p{L}\p{N}]+/gu, '-') // Convert to lowercase .toLowerCase() // Remove any remaining leading or trailing hyphens. .replace(/(^-+)|(-+$)/g, ''); }; /** * Generate the anchor for a heading. * * @param {string} clientId The block ID. * @param {string} content The block content. * * @return {string|null} Return the heading anchor. */ const generateAnchor = (clientId, content) => { const slug = getSlug(content); // If slug is empty, then return null. // Returning null instead of an empty string allows us to check again when the content changes. if ('' === slug) { return null; } delete autogenerate_anchors_anchors[clientId]; let anchor = slug; let i = 0; // If the anchor already exists in another heading, append -i. while (Object.values(autogenerate_anchors_anchors).includes(anchor)) { i += 1; anchor = slug + '-' + i; } return anchor; }; /** * Set the anchor for a heading. * * @param {string} clientId The block ID. * @param {string|null} anchor The block anchor. */ const setAnchor = (clientId, anchor) => { autogenerate_anchors_anchors[clientId] = anchor; }; ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/heading/edit.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function HeadingEdit({ attributes, setAttributes, mergeBlocks, onReplace, style, clientId }) { const { textAlign, content, level, placeholder, anchor } = attributes; const tagName = 'h' + level; const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({ className: dist_clsx({ [`has-text-align-${textAlign}`]: textAlign }), style }); const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)(); const { canGenerateAnchors } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getGlobalBlockCount, getSettings } = select(external_wp_blockEditor_namespaceObject.store); const settings = getSettings(); return { canGenerateAnchors: !!settings.generateAnchors || getGlobalBlockCount('core/table-of-contents') > 0 }; }, []); const { __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); // Initially set anchor for headings that have content but no anchor set. // This is used when transforming a block to heading, or for legacy anchors. (0,external_wp_element_namespaceObject.useEffect)(() => { if (!canGenerateAnchors) { return; } if (!anchor && content) { // This side-effect should not create an undo level. __unstableMarkNextChangeAsNotPersistent(); setAttributes({ anchor: generateAnchor(clientId, content) }); } setAnchor(clientId, anchor); // Remove anchor map when block unmounts. return () => setAnchor(clientId, null); }, [anchor, content, clientId, canGenerateAnchors]); const onContentChange = value => { const newAttrs = { content: value }; if (canGenerateAnchors && (!anchor || !value || generateAnchor(clientId, content) === anchor)) { newAttrs.anchor = generateAnchor(clientId, value); } setAttributes(newAttrs); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [blockEditingMode === 'default' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.BlockControls, { group: "block", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.HeadingLevelDropdown, { value: level, onChange: newLevel => setAttributes({ level: newLevel }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.AlignmentControl, { value: textAlign, onChange: nextAlign => { setAttributes({ textAlign: nextAlign }); } })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText, { identifier: "content", tagName: tagName, value: content, onChange: onContentChange, onMerge: mergeBlocks, onReplace: onReplace, onRemove: () => onReplace([]), placeholder: placeholder || (0,external_wp_i18n_namespaceObject.__)('Heading'), textAlign: textAlign, ...(external_wp_element_namespaceObject.Platform.isNative && { deleteEnter: true }), ...blockProps })] }); } /* harmony default export */ const heading_edit = (HeadingEdit); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/heading/save.js /** * External dependencies */ /** * WordPress dependencies */ function heading_save_save({ attributes }) { const { textAlign, content, level } = attributes; const TagName = 'h' + level; const className = dist_clsx({ [`has-text-align-${textAlign}`]: textAlign }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TagName, { ...external_wp_blockEditor_namespaceObject.useBlockProps.save({ className }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { value: content }) }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/heading/shared.js /** * Given a node name string for a heading node, returns its numeric level. * * @param {string} nodeName Heading node name. * * @return {number} Heading level. */ function getLevelFromHeadingNodeName(nodeName) { return Number(nodeName.substr(1)); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/heading/transforms.js /** * WordPress dependencies */ /** * Internal dependencies */ const heading_transforms_transforms = { from: [{ type: 'block', isMultiBlock: true, blocks: ['core/paragraph'], transform: attributes => attributes.map(({ content, anchor, align: textAlign, metadata }) => (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', { content, anchor, textAlign, metadata: getTransformedMetadata(metadata, 'core/heading', ({ content: contentBinding }) => ({ content: contentBinding })) })) }, { type: 'raw', selector: 'h1,h2,h3,h4,h5,h6', schema: ({ phrasingContentSchema, isPaste }) => { const schema = { children: phrasingContentSchema, attributes: isPaste ? [] : ['style', 'id'] }; return { h1: schema, h2: schema, h3: schema, h4: schema, h5: schema, h6: schema }; }, transform(node) { const attributes = (0,external_wp_blocks_namespaceObject.getBlockAttributes)('core/heading', node.outerHTML); const { textAlign } = node.style || {}; attributes.level = getLevelFromHeadingNodeName(node.nodeName); if (textAlign === 'left' || textAlign === 'center' || textAlign === 'right') { attributes.align = textAlign; } return (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', attributes); } }, ...[1, 2, 3, 4, 5, 6].map(level => ({ type: 'prefix', prefix: Array(level + 1).join('#'), transform(content) { return (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', { level, content }); } })), ...[1, 2, 3, 4, 5, 6].map(level => ({ type: 'enter', regExp: new RegExp(`^/(h|H)${level}$`), transform: () => (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', { level }) }))], to: [{ type: 'block', isMultiBlock: true, blocks: ['core/paragraph'], transform: attributes => attributes.map(({ content, textAlign: align, metadata }) => (0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', { content, align, metadata: getTransformedMetadata(metadata, 'core/paragraph', ({ content: contentBinding }) => ({ content: contentBinding })) })) }] }; /* harmony default export */ const heading_transforms = (heading_transforms_transforms); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/heading/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const heading_metadata = { $schema: "https://schemas.wp.org/trunk/block.json", apiVersion: 3, name: "core/heading", title: "Heading", category: "text", description: "Introduce new sections and organize content to help visitors (and search engines) understand the structure of your content.", keywords: ["title", "subtitle"], textdomain: "default", attributes: { textAlign: { type: "string" }, content: { type: "rich-text", source: "rich-text", selector: "h1,h2,h3,h4,h5,h6", __experimentalRole: "content" }, level: { type: "number", "default": 2 }, placeholder: { type: "string" } }, supports: { align: ["wide", "full"], anchor: true, className: true, splitting: true, color: { gradients: true, link: true, __experimentalDefaultControls: { background: true, text: true } }, spacing: { margin: true, padding: true, __experimentalDefaultControls: { margin: false, padding: false } }, typography: { fontSize: true, lineHeight: true, __experimentalFontFamily: true, __experimentalFontStyle: true, __experimentalFontWeight: true, __experimentalLetterSpacing: true, __experimentalTextTransform: true, __experimentalTextDecoration: true, __experimentalWritingMode: true, __experimentalDefaultControls: { fontSize: true } }, __unstablePasteTextInline: true, __experimentalSlashInserter: true, interactivity: { clientNavigation: true } }, editorStyle: "wp-block-heading-editor", style: "wp-block-heading" }; const { name: heading_name } = heading_metadata; const heading_settings = { icon: library_heading, example: { attributes: { content: (0,external_wp_i18n_namespaceObject.__)('Code is Poetry'), level: 2 } }, __experimentalLabel(attributes, { context }) { const { content, level } = attributes; const customName = attributes?.metadata?.name; const hasContent = content?.trim().length > 0; // In the list view, use the block's content as the label. // If the content is empty, fall back to the default label. if (context === 'list-view' && (customName || hasContent)) { return customName || content; } if (context === 'accessibility') { return !hasContent ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: accessibility text. %s: heading level. */ (0,external_wp_i18n_namespaceObject.__)('Level %s. Empty.'), level) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: accessibility text. 1: heading level. 2: heading content. */ (0,external_wp_i18n_namespaceObject.__)('Level %1$s. %2$s'), level, content); } }, transforms: heading_transforms, deprecated: heading_deprecated, merge(attributes, attributesToMerge) { return { content: (attributes.content || '') + (attributesToMerge.content || '') }; }, edit: heading_edit, save: heading_save_save }; const heading_init = () => initBlock({ name: heading_name, metadata: heading_metadata, settings: heading_settings }); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/home.js /** * WordPress dependencies */ const home = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z" }) }); /* harmony default export */ const library_home = (home); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/home-link/edit.js /** * External dependencies */ /** * WordPress dependencies */ const preventDefault = event => event.preventDefault(); function HomeEdit({ attributes, setAttributes, context }) { const { homeUrl } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getUnstableBase // Site index. } = select(external_wp_coreData_namespaceObject.store); return { homeUrl: getUnstableBase()?.home }; }, []); const { __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const { textColor, backgroundColor, style } = context; const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({ className: dist_clsx('wp-block-navigation-item', { 'has-text-color': !!textColor || !!style?.color?.text, [`has-${textColor}-color`]: !!textColor, 'has-background': !!backgroundColor || !!style?.color?.background, [`has-${backgroundColor}-background-color`]: !!backgroundColor }), style: { color: style?.color?.text, backgroundColor: style?.color?.background } }); const { label } = attributes; (0,external_wp_element_namespaceObject.useEffect)(() => { if (label === undefined) { __unstableMarkNextChangeAsNotPersistent(); setAttributes({ label: (0,external_wp_i18n_namespaceObject.__)('Home') }); } }, [label]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...blockProps, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { className: "wp-block-home-link__content wp-block-navigation-item__content", href: homeUrl, onClick: preventDefault, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText, { identifier: "label", className: "wp-block-home-link__label", value: label, onChange: labelValue => { setAttributes({ label: labelValue }); }, "aria-label": (0,external_wp_i18n_namespaceObject.__)('Home link text'), placeholder: (0,external_wp_i18n_namespaceObject.__)('Add home link'), withoutInteractiveFormatting: true, allowedFormats: ['core/bold', 'core/italic', 'core/image', 'core/strikethrough'] }) }) }) }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/home-link/save.js /** * WordPress dependencies */ function home_link_save_save() { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, {}); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/home-link/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const home_link_metadata = { $schema: "https://schemas.wp.org/trunk/block.json", apiVersion: 3, name: "core/home-link", category: "design", parent: ["core/navigation"], title: "Home Link", description: "Create a link that always points to the homepage of the site. Usually not necessary if there is already a site title link present in the header.", textdomain: "default", attributes: { label: { type: "string" } }, usesContext: ["textColor", "customTextColor", "backgroundColor", "customBackgroundColor", "fontSize", "customFontSize", "style"], supports: { reusable: false, html: false, typography: { fontSize: true, lineHeight: true, __experimentalFontFamily: true, __experimentalFontWeight: true, __experimentalFontStyle: true, __experimentalTextTransform: true, __experimentalTextDecoration: true, __experimentalLetterSpacing: true, __experimentalDefaultControls: { fontSize: true } }, interactivity: { clientNavigation: true } }, editorStyle: "wp-block-home-link-editor", style: "wp-block-home-link" }; const { name: home_link_name } = home_link_metadata; const home_link_settings = { icon: library_home, edit: HomeEdit, save: home_link_save_save, example: { attributes: { label: (0,external_wp_i18n_namespaceObject._x)('Home Link', 'block example') } } }; const home_link_init = () => initBlock({ name: home_link_name, metadata: home_link_metadata, settings: home_link_settings }); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/html.js /** * WordPress dependencies */ const html = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4.8 11.4H2.1V9H1v6h1.1v-2.6h2.7V15h1.1V9H4.8v2.4zm1.9-1.3h1.7V15h1.1v-4.9h1.7V9H6.7v1.1zM16.2 9l-1.5 2.7L13.3 9h-.9l-.8 6h1.1l.5-4 1.5 2.8 1.5-2.8.5 4h1.1L17 9h-.8zm3.8 5V9h-1.1v6h3.6v-1H20z" }) }); /* harmony default export */ const library_html = (html); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/html/preview.js /** * WordPress dependencies */ // Default styles used to unset some of the styles // that might be inherited from the editor style. const DEFAULT_STYLES = ` html,body,:root { margin: 0 !important; padding: 0 !important; overflow: visible !important; min-height: auto !important; } `; function HTMLEditPreview({ content, isSelected }) { const settingStyles = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSettings().styles); const styles = (0,external_wp_element_namespaceObject.useMemo)(() => [DEFAULT_STYLES, ...(0,external_wp_blockEditor_namespaceObject.transformStyles)(settingStyles.filter(style => style.css))], [settingStyles]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SandBox, { html: content, styles: styles, title: (0,external_wp_i18n_namespaceObject.__)('Custom HTML Preview'), tabIndex: -1 }), !isSelected && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "block-library-html__preview-overlay" })] }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/html/edit.js /** * WordPress dependencies */ /** * Internal dependencies */ function HTMLEdit({ attributes, setAttributes, isSelected }) { const [isPreview, setIsPreview] = (0,external_wp_element_namespaceObject.useState)(); const isDisabled = (0,external_wp_element_namespaceObject.useContext)(external_wp_components_namespaceObject.Disabled.Context); const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(HTMLEdit, 'html-edit-desc'); function switchToPreview() { setIsPreview(true); } function switchToHTML() { setIsPreview(false); } const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({ className: 'block-library-html__edit', 'aria-describedby': isPreview ? instanceId : undefined }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ...blockProps, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ToolbarGroup, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { isPressed: !isPreview, onClick: switchToHTML, children: "HTML" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { isPressed: isPreview, onClick: switchToPreview, children: (0,external_wp_i18n_namespaceObject.__)('Preview') })] }) }), isPreview || isDisabled ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(HTMLEditPreview, { content: attributes.content, isSelected: isSelected }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: instanceId, children: (0,external_wp_i18n_namespaceObject.__)('HTML preview is not yet fully accessible. Please switch screen reader to virtualized mode to navigate the below iFrame.') })] }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.PlainText, { value: attributes.content, onChange: content => setAttributes({ content }), placeholder: (0,external_wp_i18n_namespaceObject.__)('Write HTML…'), "aria-label": (0,external_wp_i18n_namespaceObject.__)('HTML') })] }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/html/save.js /** * WordPress dependencies */ function html_save_save({ attributes }) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.RawHTML, { children: attributes.content }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/html/transforms.js /** * WordPress dependencies */ const html_transforms_transforms = { from: [{ type: 'block', blocks: ['core/code'], transform: ({ content: html }) => { return (0,external_wp_blocks_namespaceObject.createBlock)('core/html', { // The code block may output HTML formatting, so convert it // to plain text. content: (0,external_wp_richText_namespaceObject.create)({ html }).text }); } }] }; /* harmony default export */ const html_transforms = (html_transforms_transforms); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/html/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const html_metadata = { $schema: "https://schemas.wp.org/trunk/block.json", apiVersion: 3, name: "core/html", title: "Custom HTML", category: "widgets", description: "Add custom HTML code and preview it as you edit.", keywords: ["embed"], textdomain: "default", attributes: { content: { type: "string", source: "raw" } }, supports: { customClassName: false, className: false, html: false, interactivity: { clientNavigation: true } }, editorStyle: "wp-block-html-editor" }; const { name: html_name } = html_metadata; const html_settings = { icon: library_html, example: { attributes: { content: '<marquee>' + (0,external_wp_i18n_namespaceObject.__)('Welcome to the wonderful world of blocks…') + '</marquee>' } }, edit: HTMLEdit, save: html_save_save, transforms: html_transforms }; const html_init = () => initBlock({ name: html_name, metadata: html_metadata, settings: html_settings }); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/deprecated.js /** * External dependencies */ /** * WordPress dependencies */ /** * Deprecation for adding the `wp-image-${id}` class to the image block for * responsive images. * * @see https://github.com/WordPress/gutenberg/pull/4898 */ const image_deprecated_v1 = { attributes: { url: { type: 'string', source: 'attribute', selector: 'img', attribute: 'src' }, alt: { type: 'string', source: 'attribute', selector: 'img', attribute: 'alt', default: '' }, caption: { type: 'array', source: 'children', selector: 'figcaption' }, href: { type: 'string', source: 'attribute', selector: 'a', attribute: 'href' }, id: { type: 'number' }, align: { type: 'string' }, width: { type: 'number' }, height: { type: 'number' } }, save({ attributes }) { const { url, alt, caption, align, href, width, height } = attributes; const extraImageProps = width || height ? { width, height } : {}; const image = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: url, alt: alt, ...extraImageProps }); let figureStyle = {}; if (width) { figureStyle = { width }; } else if (align === 'left' || align === 'right') { figureStyle = { maxWidth: '50%' }; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("figure", { className: align ? `align${align}` : null, style: figureStyle, children: [href ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { href: href, children: image }) : image, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { tagName: "figcaption", value: caption })] }); } }; /** * Deprecation for adding the `is-resized` class to the image block to fix * captions on resized images. * * @see https://github.com/WordPress/gutenberg/pull/6496 */ const image_deprecated_v2 = { attributes: { url: { type: 'string', source: 'attribute', selector: 'img', attribute: 'src' }, alt: { type: 'string', source: 'attribute', selector: 'img', attribute: 'alt', default: '' }, caption: { type: 'array', source: 'children', selector: 'figcaption' }, href: { type: 'string', source: 'attribute', selector: 'a', attribute: 'href' }, id: { type: 'number' }, align: { type: 'string' }, width: { type: 'number' }, height: { type: 'number' } }, save({ attributes }) { const { url, alt, caption, align, href, width, height, id } = attributes; const image = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: url, alt: alt, className: id ? `wp-image-${id}` : null, width: width, height: height }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("figure", { className: align ? `align${align}` : null, children: [href ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { href: href, children: image }) : image, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { tagName: "figcaption", value: caption })] }); } }; /** * Deprecation for image floats including a wrapping div. * * @see https://github.com/WordPress/gutenberg/pull/7721 */ const image_deprecated_v3 = { attributes: { url: { type: 'string', source: 'attribute', selector: 'img', attribute: 'src' }, alt: { type: 'string', source: 'attribute', selector: 'img', attribute: 'alt', default: '' }, caption: { type: 'array', source: 'children', selector: 'figcaption' }, href: { type: 'string', source: 'attribute', selector: 'figure > a', attribute: 'href' }, id: { type: 'number' }, align: { type: 'string' }, width: { type: 'number' }, height: { type: 'number' }, linkDestination: { type: 'string', default: 'none' } }, save({ attributes }) { const { url, alt, caption, align, href, width, height, id } = attributes; const classes = dist_clsx({ [`align${align}`]: align, 'is-resized': width || height }); const image = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: url, alt: alt, className: id ? `wp-image-${id}` : null, width: width, height: height }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("figure", { className: classes, children: [href ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { href: href, children: image }) : image, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { tagName: "figcaption", value: caption })] }); } }; /** * Deprecation for removing the outer div wrapper around aligned images. * * @see https://github.com/WordPress/gutenberg/pull/38657 */ const image_deprecated_v4 = { attributes: { align: { type: 'string' }, url: { type: 'string', source: 'attribute', selector: 'img', attribute: 'src' }, alt: { type: 'string', source: 'attribute', selector: 'img', attribute: 'alt', default: '' }, caption: { type: 'string', source: 'html', selector: 'figcaption' }, title: { type: 'string', source: 'attribute', selector: 'img', attribute: 'title' }, href: { type: 'string', source: 'attribute', selector: 'figure > a', attribute: 'href' }, rel: { type: 'string', source: 'attribute', selector: 'figure > a', attribute: 'rel' }, linkClass: { type: 'string', source: 'attribute', selector: 'figure > a', attribute: 'class' }, id: { type: 'number' }, width: { type: 'number' }, height: { type: 'number' }, sizeSlug: { type: 'string' }, linkDestination: { type: 'string' }, linkTarget: { type: 'string', source: 'attribute', selector: 'figure > a', attribute: 'target' } }, supports: { anchor: true }, save({ attributes }) { const { url, alt, caption, align, href, rel, linkClass, width, height, id, linkTarget, sizeSlug, title } = attributes; const newRel = !rel ? undefined : rel; const classes = dist_clsx({ [`align${align}`]: align, [`size-${sizeSlug}`]: sizeSlug, 'is-resized': width || height }); const image = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: url, alt: alt, className: id ? `wp-image-${id}` : null, width: width, height: height, title: title }); const figure = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [href ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { className: linkClass, href: href, target: linkTarget, rel: newRel, children: image }) : image, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { tagName: "figcaption", value: caption })] }); if ('left' === align || 'right' === align || 'center' === align) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { ...external_wp_blockEditor_namespaceObject.useBlockProps.save(), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("figure", { className: classes, children: figure }) }); } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("figure", { ...external_wp_blockEditor_namespaceObject.useBlockProps.save({ className: classes }), children: figure }); } }; /** * Deprecation for moving existing border radius styles onto the inner img * element where new border block support styles must be applied. * It will also add a new `.has-custom-border` class for existing blocks * with border radii set. This class is required to improve caption position * and styling when an image within a gallery has a custom border or * rounded corners. * * @see https://github.com/WordPress/gutenberg/pull/31366 */ const image_deprecated_v5 = { attributes: { align: { type: 'string' }, url: { type: 'string', source: 'attribute', selector: 'img', attribute: 'src' }, alt: { type: 'string', source: 'attribute', selector: 'img', attribute: 'alt', default: '' }, caption: { type: 'string', source: 'html', selector: 'figcaption' }, title: { type: 'string', source: 'attribute', selector: 'img', attribute: 'title' }, href: { type: 'string', source: 'attribute', selector: 'figure > a', attribute: 'href' }, rel: { type: 'string', source: 'attribute', selector: 'figure > a', attribute: 'rel' }, linkClass: { type: 'string', source: 'attribute', selector: 'figure > a', attribute: 'class' }, id: { type: 'number' }, width: { type: 'number' }, height: { type: 'number' }, sizeSlug: { type: 'string' }, linkDestination: { type: 'string' }, linkTarget: { type: 'string', source: 'attribute', selector: 'figure > a', attribute: 'target' } }, supports: { anchor: true, color: { __experimentalDuotone: 'img', text: false, background: false }, __experimentalBorder: { radius: true, __experimentalDefaultControls: { radius: true } }, __experimentalStyle: { spacing: { margin: '0 0 1em 0' } } }, save({ attributes }) { const { url, alt, caption, align, href, rel, linkClass, width, height, id, linkTarget, sizeSlug, title } = attributes; const newRel = !rel ? undefined : rel; const classes = dist_clsx({ [`align${align}`]: align, [`size-${sizeSlug}`]: sizeSlug, 'is-resized': width || height }); const image = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: url, alt: alt, className: id ? `wp-image-${id}` : null, width: width, height: height, title: title }); const figure = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [href ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { className: linkClass, href: href, target: linkTarget, rel: newRel, children: image }) : image, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { tagName: "figcaption", value: caption })] }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("figure", { ...external_wp_blockEditor_namespaceObject.useBlockProps.save({ className: classes }), children: figure }); } }; /** * Deprecation for adding width and height as style rules on the inner img. * * @see https://github.com/WordPress/gutenberg/pull/31366 */ const image_deprecated_v6 = { attributes: { align: { type: 'string' }, url: { type: 'string', source: 'attribute', selector: 'img', attribute: 'src', __experimentalRole: 'content' }, alt: { type: 'string', source: 'attribute', selector: 'img', attribute: 'alt', default: '', __experimentalRole: 'content' }, caption: { type: 'string', source: 'html', selector: 'figcaption', __experimentalRole: 'content' }, title: { type: 'string', source: 'attribute', selector: 'img', attribute: 'title', __experimentalRole: 'content' }, href: { type: 'string', source: 'attribute', selector: 'figure > a', attribute: 'href', __experimentalRole: 'content' }, rel: { type: 'string', source: 'attribute', selector: 'figure > a', attribute: 'rel' }, linkClass: { type: 'string', source: 'attribute', selector: 'figure > a', attribute: 'class' }, id: { type: 'number', __experimentalRole: 'content' }, width: { type: 'number' }, height: { type: 'number' }, aspectRatio: { type: 'string' }, scale: { type: 'string' }, sizeSlug: { type: 'string' }, linkDestination: { type: 'string' }, linkTarget: { type: 'string', source: 'attribute', selector: 'figure > a', attribute: 'target' } }, supports: { anchor: true, color: { text: false, background: false }, filter: { duotone: true }, __experimentalBorder: { color: true, radius: true, width: true, __experimentalSkipSerialization: true, __experimentalDefaultControls: { color: true, radius: true, width: true } } }, migrate(attributes) { const { height, width } = attributes; return { ...attributes, width: typeof width === 'number' ? `${width}px` : width, height: typeof height === 'number' ? `${height}px` : height }; }, save({ attributes }) { const { url, alt, caption, align, href, rel, linkClass, width, height, aspectRatio, scale, id, linkTarget, sizeSlug, title } = attributes; const newRel = !rel ? undefined : rel; const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetBorderClassesAndStyles)(attributes); const classes = dist_clsx({ [`align${align}`]: align, [`size-${sizeSlug}`]: sizeSlug, 'is-resized': width || height, 'has-custom-border': !!borderProps.className || borderProps.style && Object.keys(borderProps.style).length > 0 }); const imageClasses = dist_clsx(borderProps.className, { [`wp-image-${id}`]: !!id }); const image = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: url, alt: alt, className: imageClasses || undefined, style: { ...borderProps.style, aspectRatio, objectFit: scale }, width: width, height: height, title: title }); const figure = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [href ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { className: linkClass, href: href, target: linkTarget, rel: newRel, children: image }) : image, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { className: (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('caption'), tagName: "figcaption", value: caption })] }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("figure", { ...external_wp_blockEditor_namespaceObject.useBlockProps.save({ className: classes }), children: figure }); } }; /** * Deprecation for converting to string width and height block attributes and * removing the width and height img element attributes which are not needed * as they get added by the TODO hook. * * @see https://github.com/WordPress/gutenberg/pull/53274 */ const image_deprecated_v7 = { attributes: { align: { type: 'string' }, url: { type: 'string', source: 'attribute', selector: 'img', attribute: 'src', __experimentalRole: 'content' }, alt: { type: 'string', source: 'attribute', selector: 'img', attribute: 'alt', default: '', __experimentalRole: 'content' }, caption: { type: 'string', source: 'html', selector: 'figcaption', __experimentalRole: 'content' }, title: { type: 'string', source: 'attribute', selector: 'img', attribute: 'title', __experimentalRole: 'content' }, href: { type: 'string', source: 'attribute', selector: 'figure > a', attribute: 'href', __experimentalRole: 'content' }, rel: { type: 'string', source: 'attribute', selector: 'figure > a', attribute: 'rel' }, linkClass: { type: 'string', source: 'attribute', selector: 'figure > a', attribute: 'class' }, id: { type: 'number', __experimentalRole: 'content' }, width: { type: 'number' }, height: { type: 'number' }, aspectRatio: { type: 'string' }, scale: { type: 'string' }, sizeSlug: { type: 'string' }, linkDestination: { type: 'string' }, linkTarget: { type: 'string', source: 'attribute', selector: 'figure > a', attribute: 'target' } }, supports: { anchor: true, color: { text: false, background: false }, filter: { duotone: true }, __experimentalBorder: { color: true, radius: true, width: true, __experimentalSkipSerialization: true, __experimentalDefaultControls: { color: true, radius: true, width: true } } }, migrate({ width, height, ...attributes }) { return { ...attributes, width: `${width}px`, height: `${height}px` }; }, save({ attributes }) { const { url, alt, caption, align, href, rel, linkClass, width, height, aspectRatio, scale, id, linkTarget, sizeSlug, title } = attributes; const newRel = !rel ? undefined : rel; const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetBorderClassesAndStyles)(attributes); const classes = dist_clsx({ [`align${align}`]: align, [`size-${sizeSlug}`]: sizeSlug, 'is-resized': width || height, 'has-custom-border': !!borderProps.className || borderProps.style && Object.keys(borderProps.style).length > 0 }); const imageClasses = dist_clsx(borderProps.className, { [`wp-image-${id}`]: !!id }); const image = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: url, alt: alt, className: imageClasses || undefined, style: { ...borderProps.style, aspectRatio, objectFit: scale, width, height }, width: width, height: height, title: title }); const figure = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [href ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { className: linkClass, href: href, target: linkTarget, rel: newRel, children: image }) : image, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { className: (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('caption'), tagName: "figcaption", value: caption })] }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("figure", { ...external_wp_blockEditor_namespaceObject.useBlockProps.save({ className: classes }), children: figure }); } }; const deprecated_v8 = { attributes: { align: { type: 'string' }, behaviors: { type: 'object' }, url: { type: 'string', source: 'attribute', selector: 'img', attribute: 'src', __experimentalRole: 'content' }, alt: { type: 'string', source: 'attribute', selector: 'img', attribute: 'alt', default: '', __experimentalRole: 'content' }, caption: { type: 'string', source: 'html', selector: 'figcaption', __experimentalRole: 'content' }, title: { type: 'string', source: 'attribute', selector: 'img', attribute: 'title', __experimentalRole: 'content' }, href: { type: 'string', source: 'attribute', selector: 'figure > a', attribute: 'href', __experimentalRole: 'content' }, rel: { type: 'string', source: 'attribute', selector: 'figure > a', attribute: 'rel' }, linkClass: { type: 'string', source: 'attribute', selector: 'figure > a', attribute: 'class' }, id: { type: 'number', __experimentalRole: 'content' }, width: { type: 'string' }, height: { type: 'string' }, aspectRatio: { type: 'string' }, scale: { type: 'string' }, sizeSlug: { type: 'string' }, linkDestination: { type: 'string' }, linkTarget: { type: 'string', source: 'attribute', selector: 'figure > a', attribute: 'target' } }, supports: { anchor: true, color: { text: false, background: false }, filter: { duotone: true }, __experimentalBorder: { color: true, radius: true, width: true, __experimentalSkipSerialization: true, __experimentalDefaultControls: { color: true, radius: true, width: true } } }, migrate({ width, height, ...attributes }) { // We need to perform a check here because in cases // where attributes are added dynamically to blocks, // block invalidation overrides the isEligible() method // and forces the migration to run, so it's not guaranteed // that `behaviors` or `behaviors.lightbox` will be defined. if (!attributes.behaviors?.lightbox) { return attributes; } const { behaviors: { lightbox: { enabled } } } = attributes; const newAttributes = { ...attributes, lightbox: { enabled } }; delete newAttributes.behaviors; return newAttributes; }, isEligible(attributes) { return !!attributes.behaviors; }, save({ attributes }) { const { url, alt, caption, align, href, rel, linkClass, width, height, aspectRatio, scale, id, linkTarget, sizeSlug, title } = attributes; const newRel = !rel ? undefined : rel; const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetBorderClassesAndStyles)(attributes); const classes = dist_clsx({ [`align${align}`]: align, [`size-${sizeSlug}`]: sizeSlug, 'is-resized': width || height, 'has-custom-border': !!borderProps.className || borderProps.style && Object.keys(borderProps.style).length > 0 }); const imageClasses = dist_clsx(borderProps.className, { [`wp-image-${id}`]: !!id }); const image = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: url, alt: alt, className: imageClasses || undefined, style: { ...borderProps.style, aspectRatio, objectFit: scale, width, height }, title: title }); const figure = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [href ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { className: linkClass, href: href, target: linkTarget, rel: newRel, children: image }) : image, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { className: (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('caption'), tagName: "figcaption", value: caption })] }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("figure", { ...external_wp_blockEditor_namespaceObject.useBlockProps.save({ className: classes }), children: figure }); } }; /* harmony default export */ const image_deprecated = ([deprecated_v8, image_deprecated_v7, image_deprecated_v6, image_deprecated_v5, image_deprecated_v4, image_deprecated_v3, image_deprecated_v2, image_deprecated_v1]); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plugins.js /** * WordPress dependencies */ const plugins = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.5 4v4h3V4H15v4h1.5a1 1 0 011 1v4l-3 4v2a1 1 0 01-1 1h-3a1 1 0 01-1-1v-2l-3-4V9a1 1 0 011-1H9V4h1.5zm.5 12.5v2h2v-2l3-4v-3H8v3l3 4z" }) }); /* harmony default export */ const library_plugins = (plugins); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/crop.js /** * WordPress dependencies */ const crop = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 20v-2h2v-1.5H7.75a.25.25 0 0 1-.25-.25V4H6v2H4v1.5h2v8.75c0 .966.784 1.75 1.75 1.75h8.75v2H18ZM9.273 7.5h6.977a.25.25 0 0 1 .25.25v6.977H18V7.75A1.75 1.75 0 0 0 16.25 6H9.273v1.5Z" }) }); /* harmony default export */ const library_crop = (crop); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/overlay-text.js /** * WordPress dependencies */ const overlayText = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12-9.8c.4 0 .8-.3.9-.7l1.1-3h3.6l.5 1.7h1.9L13 9h-2.2l-3.4 9.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v12H20V6c0-1.1-.9-2-2-2zm-6 7l1.4 3.9h-2.7L12 11z" }) }); /* harmony default export */ const overlay_text = (overlayText); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/upload.js /** * WordPress dependencies */ const upload = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z" }) }); /* harmony default export */ const library_upload = (upload); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/image.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Module constants */ const { DimensionsTool, ResolutionTool } = unlock(external_wp_blockEditor_namespaceObject.privateApis); const scaleOptions = [{ value: 'cover', label: (0,external_wp_i18n_namespaceObject._x)('Cover', 'Scale option for dimensions control'), help: (0,external_wp_i18n_namespaceObject.__)('Image covers the space evenly.') }, { value: 'contain', label: (0,external_wp_i18n_namespaceObject._x)('Contain', 'Scale option for dimensions control'), help: (0,external_wp_i18n_namespaceObject.__)('Image is contained without distortion.') }]; // If the image has a href, wrap in an <a /> tag to trigger any inherited link element styles. const ImageWrapper = ({ href, children }) => { if (!href) { return children; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { href: href, onClick: event => event.preventDefault(), "aria-disabled": true, style: { // When the Image block is linked, // it's wrapped with a disabled <a /> tag. // Restore cursor style so it doesn't appear 'clickable' // and remove pointer events. Safari needs the display property. pointerEvents: 'none', cursor: 'default', display: 'inline' }, children: children }); }; function image_Image({ temporaryURL, attributes, setAttributes, isSingleSelected, insertBlocksAfter, onReplace, onSelectImage, onSelectURL, onUploadError, context, clientId, blockEditingMode, parentLayoutType }) { const { url = '', alt, align, id, href, rel, linkClass, linkDestination, title, width, height, aspectRatio, scale, linkTarget, sizeSlug, lightbox, metadata } = attributes; // The only supported unit is px, so we can parseInt to strip the px here. const numericWidth = width ? parseInt(width, 10) : undefined; const numericHeight = height ? parseInt(height, 10) : undefined; const imageRef = (0,external_wp_element_namespaceObject.useRef)(); const { allowResize = true } = context; const { getBlock, getSettings } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); const image = (0,external_wp_data_namespaceObject.useSelect)(select => id && isSingleSelected ? select(external_wp_coreData_namespaceObject.store).getMedia(id, { context: 'view' }) : null, [id, isSingleSelected]); const { canInsertCover, imageEditing, imageSizes, maxWidth } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockRootClientId, canInsertBlockType } = select(external_wp_blockEditor_namespaceObject.store); const rootClientId = getBlockRootClientId(clientId); const settings = getSettings(); return { imageEditing: settings.imageEditing, imageSizes: settings.imageSizes, maxWidth: settings.maxWidth, canInsertCover: canInsertBlockType('core/cover', rootClientId) }; }, [clientId]); const { replaceBlocks, toggleSelection } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const { createErrorNotice, createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); const isWideAligned = ['wide', 'full'].includes(align); const [{ loadedNaturalWidth, loadedNaturalHeight }, setLoadedNaturalSize] = (0,external_wp_element_namespaceObject.useState)({}); const [isEditingImage, setIsEditingImage] = (0,external_wp_element_namespaceObject.useState)(false); const [externalBlob, setExternalBlob] = (0,external_wp_element_namespaceObject.useState)(); const hasNonContentControls = blockEditingMode === 'default'; const isContentOnlyMode = blockEditingMode === 'contentOnly'; const isResizable = allowResize && hasNonContentControls && !isWideAligned && isLargeViewport && parentLayoutType !== 'grid'; const imageSizeOptions = imageSizes.filter(({ slug }) => image?.media_details?.sizes?.[slug]?.source_url).map(({ name, slug }) => ({ value: slug, label: name })); // If an image is externally hosted, try to fetch the image data. This may // fail if the image host doesn't allow CORS with the domain. If it works, // we can enable a button in the toolbar to upload the image. (0,external_wp_element_namespaceObject.useEffect)(() => { if (!isExternalImage(id, url) || !isSingleSelected || !getSettings().mediaUpload) { setExternalBlob(); return; } if (externalBlob) { return; } window // Avoid cache, which seems to help avoid CORS problems. .fetch(url.includes('?') ? url : url + '?').then(response => response.blob()).then(blob => setExternalBlob(blob)) // Do nothing, cannot upload. .catch(() => {}); }, [id, url, isSingleSelected, externalBlob]); // Get naturalWidth and naturalHeight from image ref, and fall back to loaded natural // width and height. This resolves an issue in Safari where the loaded natural // width and height is otherwise lost when switching between alignments. // See: https://github.com/WordPress/gutenberg/pull/37210. const { naturalWidth, naturalHeight } = (0,external_wp_element_namespaceObject.useMemo)(() => { return { naturalWidth: imageRef.current?.naturalWidth || loadedNaturalWidth || undefined, naturalHeight: imageRef.current?.naturalHeight || loadedNaturalHeight || undefined }; }, [loadedNaturalWidth, loadedNaturalHeight, imageRef.current?.complete]); function onResizeStart() { toggleSelection(false); } function onResizeStop() { toggleSelection(true); } function onImageError() { // Check if there's an embed block that handles this URL, e.g., instagram URL. // See: https://github.com/WordPress/gutenberg/pull/11472 const embedBlock = createUpgradedEmbedBlock({ attributes: { url } }); if (undefined !== embedBlock) { onReplace(embedBlock); } } function onSetHref(props) { setAttributes(props); } function onSetLightbox(enable) { if (enable && !lightboxSetting?.enabled) { setAttributes({ lightbox: { enabled: true } }); } else if (!enable && lightboxSetting?.enabled) { setAttributes({ lightbox: { enabled: false } }); } else { setAttributes({ lightbox: undefined }); } } function resetLightbox() { // When deleting a link from an image while lightbox settings // are enabled by default, we should disable the lightbox, // otherwise the resulting UX looks like a mistake. // See https://github.com/WordPress/gutenberg/pull/59890/files#r1532286123. if (lightboxSetting?.enabled && lightboxSetting?.allowEditing) { setAttributes({ lightbox: { enabled: false } }); } else { setAttributes({ lightbox: undefined }); } } function onSetTitle(value) { // This is the HTML title attribute, separate from the media object // title. setAttributes({ title: value }); } function updateAlt(newAlt) { setAttributes({ alt: newAlt }); } function updateImage(newSizeSlug) { const newUrl = image?.media_details?.sizes?.[newSizeSlug]?.source_url; if (!newUrl) { return null; } setAttributes({ url: newUrl, sizeSlug: newSizeSlug }); } function uploadExternal() { const { mediaUpload } = getSettings(); if (!mediaUpload) { return; } mediaUpload({ filesList: [externalBlob], onFileChange([img]) { onSelectImage(img); if ((0,external_wp_blob_namespaceObject.isBlobURL)(img.url)) { return; } setExternalBlob(); createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Image uploaded.'), { type: 'snackbar' }); }, allowedTypes: constants_ALLOWED_MEDIA_TYPES, onError(message) { createErrorNotice(message, { type: 'snackbar' }); } }); } (0,external_wp_element_namespaceObject.useEffect)(() => { if (!isSingleSelected) { setIsEditingImage(false); } }, [isSingleSelected]); const canEditImage = id && naturalWidth && naturalHeight && imageEditing; const allowCrop = isSingleSelected && canEditImage && !isEditingImage; function switchToCover() { replaceBlocks(clientId, (0,external_wp_blocks_namespaceObject.switchToBlockType)(getBlock(clientId), 'core/cover')); } // TODO: Can allow more units after figuring out how they should interact // with the ResizableBox and ImageEditor components. Calculations later on // for those components are currently assuming px units. const dimensionsUnitsOptions = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({ availableUnits: ['px'] }); const [lightboxSetting] = (0,external_wp_blockEditor_namespaceObject.useSettings)('lightbox'); const showLightboxSetting = // If a block-level override is set, we should give users the option to // remove that override, even if the lightbox UI is disabled in the settings. !!lightbox && lightbox?.enabled !== lightboxSetting?.enabled || lightboxSetting?.allowEditing; const lightboxChecked = !!lightbox?.enabled || !lightbox && !!lightboxSetting?.enabled; const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const dimensionsControl = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DimensionsTool, { value: { width, height, scale, aspectRatio }, onChange: ({ width: newWidth, height: newHeight, scale: newScale, aspectRatio: newAspectRatio }) => { // Rebuilding the object forces setting `undefined` // for values that are removed since setAttributes // doesn't do anything with keys that aren't set. setAttributes({ // CSS includes `height: auto`, but we need // `width: auto` to fix the aspect ratio when // only height is set due to the width and // height attributes set via the server. width: !newWidth && newHeight ? 'auto' : newWidth, height: newHeight, scale: newScale, aspectRatio: newAspectRatio }); }, defaultScale: "cover", defaultAspectRatio: "auto", scaleOptions: scaleOptions, unitsOptions: dimensionsUnitsOptions }); const resetAll = () => { setAttributes({ alt: undefined, width: undefined, height: undefined, scale: undefined, aspectRatio: undefined, lightbox: undefined }); }; const sizeControls = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorControls, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanel, { label: (0,external_wp_i18n_namespaceObject.__)('Settings'), resetAll: resetAll, dropdownMenuProps: dropdownMenuProps, children: isResizable && dimensionsControl }) }); const arePatternOverridesEnabled = metadata?.bindings?.__default?.source === 'core/pattern-overrides'; const { lockUrlControls = false, lockHrefControls = false, lockAltControls = false, lockAltControlsMessage, lockTitleControls = false, lockTitleControlsMessage, lockCaption = false } = (0,external_wp_data_namespaceObject.useSelect)(select => { if (!isSingleSelected) { return {}; } const { getBlockBindingsSource } = unlock(select(external_wp_blocks_namespaceObject.store)); const { url: urlBinding, alt: altBinding, title: titleBinding } = metadata?.bindings || {}; const hasParentPattern = !!context['pattern/overrides']; const urlBindingSource = getBlockBindingsSource(urlBinding?.source); const altBindingSource = getBlockBindingsSource(altBinding?.source); const titleBindingSource = getBlockBindingsSource(titleBinding?.source); return { lockUrlControls: !!urlBinding && !urlBindingSource?.canUserEditValue({ select, context, args: urlBinding?.args }), lockHrefControls: // Disable editing the link of the URL if the image is inside a pattern instance. // This is a temporary solution until we support overriding the link on the frontend. hasParentPattern || arePatternOverridesEnabled, lockCaption: // Disable editing the caption if the image is inside a pattern instance. // This is a temporary solution until we support overriding the caption on the frontend. hasParentPattern, lockAltControls: !!altBinding && !altBindingSource?.canUserEditValue({ select, context, args: altBinding?.args }), lockAltControlsMessage: altBindingSource?.label ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Label of the bindings source. */ (0,external_wp_i18n_namespaceObject.__)('Connected to %s'), altBindingSource.label) : (0,external_wp_i18n_namespaceObject.__)('Connected to dynamic data'), lockTitleControls: !!titleBinding && !titleBindingSource?.canUserEditValue({ select, context, args: titleBinding?.args }), lockTitleControlsMessage: titleBindingSource?.label ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Label of the bindings source. */ (0,external_wp_i18n_namespaceObject.__)('Connected to %s'), titleBindingSource.label) : (0,external_wp_i18n_namespaceObject.__)('Connected to dynamic data') }; }, [arePatternOverridesEnabled, context, isSingleSelected, metadata?.bindings]); const showUrlInput = isSingleSelected && !isEditingImage && !lockHrefControls && !lockUrlControls; const showCoverControls = isSingleSelected && canInsertCover; const showBlockControls = showUrlInput || allowCrop || showCoverControls; const controls = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [showBlockControls && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.BlockControls, { group: "block", children: [showUrlInput && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalImageURLInputUI, { url: href || '', onChangeUrl: onSetHref, linkDestination: linkDestination, mediaUrl: image && image.source_url || url, mediaLink: image && image.link, linkTarget: linkTarget, linkClass: linkClass, rel: rel, showLightboxSetting: showLightboxSetting, lightboxEnabled: lightboxChecked, onSetLightbox: onSetLightbox, resetLightbox: resetLightbox }), allowCrop && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { onClick: () => setIsEditingImage(true), icon: library_crop, label: (0,external_wp_i18n_namespaceObject.__)('Crop') }), showCoverControls && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { icon: overlay_text, label: (0,external_wp_i18n_namespaceObject.__)('Add text over image'), onClick: switchToCover })] }), isSingleSelected && !isEditingImage && !lockUrlControls && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, { group: "other", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.MediaReplaceFlow, { mediaId: id, mediaURL: url, allowedTypes: constants_ALLOWED_MEDIA_TYPES, accept: "image/*", onSelect: onSelectImage, onSelectURL: onSelectURL, onError: onUploadError }) }), isSingleSelected && externalBlob && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { onClick: uploadExternal, icon: library_upload, label: (0,external_wp_i18n_namespaceObject.__)('Upload to Media Library') }) }) }), isContentOnlyMode && /*#__PURE__*/ // Add some extra controls for content attributes when content only mode is active. // With content only mode active, the inspector is hidden, so users need another way // to edit these attributes. (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.BlockControls, { group: "other", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: { position: 'bottom right' }, renderToggle: ({ isOpen, onToggle }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { onClick: onToggle, "aria-haspopup": "true", "aria-expanded": isOpen, onKeyDown: event => { if (!isOpen && event.keyCode === external_wp_keycodes_namespaceObject.DOWN) { event.preventDefault(); onToggle(); } }, children: (0,external_wp_i18n_namespaceObject._x)('Alt', 'Alternative text for an image. Block toolbar label, a low character count is preferred.') }), renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextareaControl, { className: "wp-block-image__toolbar_content_textarea", label: (0,external_wp_i18n_namespaceObject.__)('Alternative text'), value: alt || '', onChange: updateAlt, disabled: lockAltControls, help: lockAltControls ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: lockAltControlsMessage }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: // translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations. (0,external_wp_i18n_namespaceObject.__)('https://www.w3.org/WAI/tutorials/images/decision-tree/'), children: (0,external_wp_i18n_namespaceObject.__)('Describe the purpose of the image.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}), (0,external_wp_i18n_namespaceObject.__)('Leave empty if decorative.')] }), __nextHasNoMarginBottom: true }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, { popoverProps: { position: 'bottom right' }, renderToggle: ({ isOpen, onToggle }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { onClick: onToggle, "aria-haspopup": "true", "aria-expanded": isOpen, onKeyDown: event => { if (!isOpen && event.keyCode === external_wp_keycodes_namespaceObject.DOWN) { event.preventDefault(); onToggle(); } }, children: (0,external_wp_i18n_namespaceObject.__)('Title') }), renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { className: "wp-block-image__toolbar_content_textarea", __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Title attribute'), value: title || '', onChange: onSetTitle, disabled: lockTitleControls, help: lockTitleControls ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: lockTitleControlsMessage }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [(0,external_wp_i18n_namespaceObject.__)('Describe the role of this image on the page.'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: "https://www.w3.org/TR/html52/dom.html#the-title-attribute", children: (0,external_wp_i18n_namespaceObject.__)('(Note: many devices and browsers do not display this text.)') })] }) }) })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorControls, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalToolsPanel, { label: (0,external_wp_i18n_namespaceObject.__)('Settings'), resetAll: resetAll, dropdownMenuProps: dropdownMenuProps, children: [isSingleSelected && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { label: (0,external_wp_i18n_namespaceObject.__)('Alternative text'), isShownByDefault: true, hasValue: () => !!alt, onDeselect: () => setAttributes({ alt: undefined }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextareaControl, { label: (0,external_wp_i18n_namespaceObject.__)('Alternative text'), value: alt || '', onChange: updateAlt, readOnly: lockAltControls, help: lockAltControls ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: lockAltControlsMessage }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: // translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations. (0,external_wp_i18n_namespaceObject.__)('https://www.w3.org/WAI/tutorials/images/decision-tree/'), children: (0,external_wp_i18n_namespaceObject.__)('Describe the purpose of the image.') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}), (0,external_wp_i18n_namespaceObject.__)('Leave empty if decorative.')] }), __nextHasNoMarginBottom: true }) }), isResizable && dimensionsControl, !!imageSizeOptions.length && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResolutionTool, { value: sizeSlug, onChange: updateImage, options: imageSizeOptions })] }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorControls, { group: "advanced", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Title attribute'), value: title || '', onChange: onSetTitle, readOnly: lockTitleControls, help: lockTitleControls ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: lockTitleControlsMessage }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [(0,external_wp_i18n_namespaceObject.__)('Describe the role of this image on the page.'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: "https://www.w3.org/TR/html52/dom.html#the-title-attribute", children: (0,external_wp_i18n_namespaceObject.__)('(Note: many devices and browsers do not display this text.)') })] }) }) })] }); const filename = (0,external_wp_url_namespaceObject.getFilename)(url); let defaultedAlt; if (alt) { defaultedAlt = alt; } else if (filename) { defaultedAlt = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: file name */ (0,external_wp_i18n_namespaceObject.__)('This image has an empty alt attribute; its file name is %s'), filename); } else { defaultedAlt = (0,external_wp_i18n_namespaceObject.__)('This image has an empty alt attribute'); } const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalUseBorderProps)(attributes); const shadowProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetShadowClassesAndStyles)(attributes); const isRounded = attributes.className?.includes('is-style-rounded'); let img = /*#__PURE__*/ // Disable reason: Image itself is not meant to be interactive, but // should direct focus to block. /* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: temporaryURL || url, alt: defaultedAlt, onError: () => onImageError(), onLoad: event => { setLoadedNaturalSize({ loadedNaturalWidth: event.target?.naturalWidth, loadedNaturalHeight: event.target?.naturalHeight }); }, ref: imageRef, className: borderProps.className, style: { width: width && height || aspectRatio ? '100%' : undefined, height: width && height || aspectRatio ? '100%' : undefined, objectFit: scale, ...borderProps.style, ...shadowProps.style } }), temporaryURL && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {})] }) /* eslint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */; if (canEditImage && isEditingImage) { img = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ImageWrapper, { href: href, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalImageEditor, { id: id, url: url, width: numericWidth, height: numericHeight, naturalHeight: naturalHeight, naturalWidth: naturalWidth, onSaveImage: imageAttributes => setAttributes(imageAttributes), onFinishEditing: () => { setIsEditingImage(false); }, borderProps: isRounded ? undefined : borderProps }) }); } else if (!isResizable) { img = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { style: { width, height, aspectRatio }, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ImageWrapper, { href: href, children: img }) }); } else { const numericRatio = aspectRatio && evalAspectRatio(aspectRatio); const customRatio = numericWidth / numericHeight; const naturalRatio = naturalWidth / naturalHeight; const ratio = numericRatio || customRatio || naturalRatio || 1; const currentWidth = !numericWidth && numericHeight ? numericHeight * ratio : numericWidth; const currentHeight = !numericHeight && numericWidth ? numericWidth / ratio : numericHeight; const minWidth = naturalWidth < naturalHeight ? constants_MIN_SIZE : constants_MIN_SIZE * ratio; const minHeight = naturalHeight < naturalWidth ? constants_MIN_SIZE : constants_MIN_SIZE / ratio; // With the current implementation of ResizableBox, an image needs an // explicit pixel value for the max-width. In absence of being able to // set the content-width, this max-width is currently dictated by the // vanilla editor style. The following variable adds a buffer to this // vanilla style, so 3rd party themes have some wiggleroom. This does, // in most cases, allow you to scale the image beyond the width of the // main column, though not infinitely. // @todo It would be good to revisit this once a content-width variable // becomes available. const maxWidthBuffer = maxWidth * 2.5; let showRightHandle = false; let showLeftHandle = false; /* eslint-disable no-lonely-if */ // See https://github.com/WordPress/gutenberg/issues/7584. if (align === 'center') { // When the image is centered, show both handles. showRightHandle = true; showLeftHandle = true; } else if ((0,external_wp_i18n_namespaceObject.isRTL)()) { // In RTL mode the image is on the right by default. // Show the right handle and hide the left handle only when it is // aligned left. Otherwise always show the left handle. if (align === 'left') { showRightHandle = true; } else { showLeftHandle = true; } } else { // Show the left handle and hide the right handle only when the // image is aligned right. Otherwise always show the right handle. if (align === 'right') { showLeftHandle = true; } else { showRightHandle = true; } } /* eslint-enable no-lonely-if */ img = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ResizableBox, { style: { display: 'block', objectFit: scale, aspectRatio: !width && !height && aspectRatio ? aspectRatio : undefined }, size: { width: currentWidth !== null && currentWidth !== void 0 ? currentWidth : 'auto', height: currentHeight !== null && currentHeight !== void 0 ? currentHeight : 'auto' }, showHandle: isSingleSelected, minWidth: minWidth, maxWidth: maxWidthBuffer, minHeight: minHeight, maxHeight: maxWidthBuffer / ratio, lockAspectRatio: ratio, enable: { top: false, right: showRightHandle, bottom: true, left: showLeftHandle }, onResizeStart: onResizeStart, onResizeStop: (event, direction, elt) => { onResizeStop(); // Since the aspect ratio is locked when resizing, we can // use the width of the resized element to calculate the // height in CSS to prevent stretching when the max-width // is reached. setAttributes({ width: `${elt.offsetWidth}px`, height: 'auto', aspectRatio: ratio === naturalRatio ? undefined : String(ratio) }); }, resizeRatio: align === 'center' ? 2 : 1, children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ImageWrapper, { href: href, children: img }) }); } if (!url && !temporaryURL) { // Add all controls if the image attributes are connected. return metadata?.bindings ? controls : sizeControls; } return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [controls, img, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Caption, { attributes: attributes, setAttributes: setAttributes, isSelected: isSingleSelected, insertBlocksAfter: insertBlocksAfter, label: (0,external_wp_i18n_namespaceObject.__)('Image caption text'), showToolbarButton: isSingleSelected && hasNonContentControls && !arePatternOverridesEnabled, readOnly: lockCaption })] }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/edit.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Module constants */ const edit_pickRelevantMediaFiles = (image, size) => { const imageProps = Object.fromEntries(Object.entries(image !== null && image !== void 0 ? image : {}).filter(([key]) => ['alt', 'id', 'link', 'caption'].includes(key))); imageProps.url = image?.sizes?.[size]?.url || image?.media_details?.sizes?.[size]?.source_url || image.url; return imageProps; }; /** * Is the URL a temporary blob URL? A blob URL is one that is used temporarily * while the image is being uploaded and will not have an id yet allocated. * * @param {number=} id The id of the image. * @param {string=} url The url of the image. * * @return {boolean} Is the URL a Blob URL */ const edit_isTemporaryImage = (id, url) => !id && (0,external_wp_blob_namespaceObject.isBlobURL)(url); /** * Is the url for the image hosted externally. An externally hosted image has no * id and is not a blob url. * * @param {number=} id The id of the image. * @param {string=} url The url of the image. * * @return {boolean} Is the url an externally hosted url? */ const isExternalImage = (id, url) => url && !id && !(0,external_wp_blob_namespaceObject.isBlobURL)(url); /** * Checks if WP generated the specified image size. Size generation is skipped * when the image is smaller than the said size. * * @param {Object} image * @param {string} size * * @return {boolean} Whether or not it has default image size. */ function hasSize(image, size) { var _image$sizes$size, _image$media_details$; return 'url' in ((_image$sizes$size = image?.sizes?.[size]) !== null && _image$sizes$size !== void 0 ? _image$sizes$size : {}) || 'source_url' in ((_image$media_details$ = image?.media_details?.sizes?.[size]) !== null && _image$media_details$ !== void 0 ? _image$media_details$ : {}); } function ImageEdit({ attributes, setAttributes, isSelected: isSingleSelected, className, insertBlocksAfter, onReplace, context, clientId, __unstableParentLayout: parentLayout }) { const { url = '', alt, caption, id, width, height, sizeSlug, aspectRatio, scale, align, metadata } = attributes; const [temporaryURL, setTemporaryURL] = (0,external_wp_element_namespaceObject.useState)(() => { return edit_isTemporaryImage(id, url) ? url : undefined; }); const altRef = (0,external_wp_element_namespaceObject.useRef)(); (0,external_wp_element_namespaceObject.useEffect)(() => { altRef.current = alt; }, [alt]); const captionRef = (0,external_wp_element_namespaceObject.useRef)(); (0,external_wp_element_namespaceObject.useEffect)(() => { captionRef.current = caption; }, [caption]); const { __unstableMarkNextChangeAsNotPersistent } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); (0,external_wp_element_namespaceObject.useEffect)(() => { if (['wide', 'full'].includes(align)) { __unstableMarkNextChangeAsNotPersistent(); setAttributes({ width: undefined, height: undefined, aspectRatio: undefined, scale: undefined }); } }, [__unstableMarkNextChangeAsNotPersistent, align, setAttributes]); const { getSettings } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)(); const { createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); function onUploadError(message) { createErrorNotice(message, { type: 'snackbar' }); setAttributes({ src: undefined, id: undefined, url: undefined }); setTemporaryURL(undefined); } function onSelectImage(media) { if (!media || !media.url) { setAttributes({ url: undefined, alt: undefined, id: undefined, title: undefined, caption: undefined }); return; } if ((0,external_wp_blob_namespaceObject.isBlobURL)(media.url)) { setTemporaryURL(media.url); return; } setTemporaryURL(); const { imageDefaultSize } = getSettings(); // Try to use the previous selected image size if its available // otherwise try the default image size or fallback to "full" let newSize = 'full'; if (sizeSlug && hasSize(media, sizeSlug)) { newSize = sizeSlug; } else if (hasSize(media, imageDefaultSize)) { newSize = imageDefaultSize; } let mediaAttributes = edit_pickRelevantMediaFiles(media, newSize); // If a caption text was meanwhile written by the user, // make sure the text is not overwritten by empty captions. if (captionRef.current && !mediaAttributes.caption) { const { caption: omittedCaption, ...restMediaAttributes } = mediaAttributes; mediaAttributes = restMediaAttributes; } let additionalAttributes; // Reset the dimension attributes if changing to a different image. if (!media.id || media.id !== id) { additionalAttributes = { sizeSlug: newSize }; } else { // Keep the same url when selecting the same file, so "Resolution" // option is not changed. additionalAttributes = { url }; } // Check if default link setting should be used. let linkDestination = attributes.linkDestination; if (!linkDestination) { // Use the WordPress option to determine the proper default. // The constants used in Gutenberg do not match WP options so a little more complicated than ideal. // TODO: fix this in a follow up PR, requires updating media-text and ui component. switch (window?.wp?.media?.view?.settings?.defaultProps?.link || constants_LINK_DESTINATION_NONE) { case 'file': case constants_LINK_DESTINATION_MEDIA: linkDestination = constants_LINK_DESTINATION_MEDIA; break; case 'post': case constants_LINK_DESTINATION_ATTACHMENT: linkDestination = constants_LINK_DESTINATION_ATTACHMENT; break; case LINK_DESTINATION_CUSTOM: linkDestination = LINK_DESTINATION_CUSTOM; break; case constants_LINK_DESTINATION_NONE: linkDestination = constants_LINK_DESTINATION_NONE; break; } } // Check if the image is linked to it's media. let href; switch (linkDestination) { case constants_LINK_DESTINATION_MEDIA: href = media.url; break; case constants_LINK_DESTINATION_ATTACHMENT: href = media.link; break; } mediaAttributes.href = href; setAttributes({ ...mediaAttributes, ...additionalAttributes, linkDestination }); } function onSelectURL(newURL) { if (newURL !== url) { setAttributes({ url: newURL, id: undefined, sizeSlug: getSettings().imageDefaultSize }); } } useUploadMediaFromBlobURL({ url, allowedTypes: constants_ALLOWED_MEDIA_TYPES, onChange: onSelectImage, onError: onUploadError }); const isExternal = isExternalImage(id, url); const src = isExternal ? url : undefined; const mediaPreview = !!url && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { alt: (0,external_wp_i18n_namespaceObject.__)('Edit image'), title: (0,external_wp_i18n_namespaceObject.__)('Edit image'), className: "edit-image-preview", src: url }); const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalUseBorderProps)(attributes); const shadowProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetShadowClassesAndStyles)(attributes); const classes = dist_clsx(className, { 'is-transient': temporaryURL, 'is-resized': !!width || !!height, [`size-${sizeSlug}`]: sizeSlug, 'has-custom-border': !!borderProps.className || borderProps.style && Object.keys(borderProps.style).length > 0 }); const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({ className: classes }); // Much of this description is duplicated from MediaPlaceholder. const { lockUrlControls = false, lockUrlControlsMessage } = (0,external_wp_data_namespaceObject.useSelect)(select => { if (!isSingleSelected) { return {}; } const blockBindingsSource = unlock(select(external_wp_blocks_namespaceObject.store)).getBlockBindingsSource(metadata?.bindings?.url?.source); return { lockUrlControls: !!metadata?.bindings?.url && !blockBindingsSource?.canUserEditValue({ select, context, args: metadata?.bindings?.url?.args }), lockUrlControlsMessage: blockBindingsSource?.label ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Label of the bindings source. */ (0,external_wp_i18n_namespaceObject.__)('Connected to %s'), blockBindingsSource.label) : (0,external_wp_i18n_namespaceObject.__)('Connected to dynamic data') }; }, [isSingleSelected, metadata?.bindings?.url]); const placeholder = content => { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, { className: dist_clsx('block-editor-media-placeholder', { [borderProps.className]: !!borderProps.className && !isSingleSelected }), withIllustration: true, icon: lockUrlControls ? library_plugins : library_image, label: (0,external_wp_i18n_namespaceObject.__)('Image'), instructions: !lockUrlControls && (0,external_wp_i18n_namespaceObject.__)('Upload an image file, pick one from your media library, or add one with a URL.'), style: { aspectRatio: !(width && height) && aspectRatio ? aspectRatio : undefined, width: height && aspectRatio ? '100%' : width, height: width && aspectRatio ? '100%' : height, objectFit: scale, ...borderProps.style, ...shadowProps.style }, children: lockUrlControls ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "block-bindings-media-placeholder-message", children: lockUrlControlsMessage }) : content }); }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("figure", { ...blockProps, children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(image_Image, { temporaryURL: temporaryURL, attributes: attributes, setAttributes: setAttributes, isSingleSelected: isSingleSelected, insertBlocksAfter: insertBlocksAfter, onReplace: onReplace, onSelectImage: onSelectImage, onSelectURL: onSelectURL, onUploadError: onUploadError, context: context, clientId: clientId, blockEditingMode: blockEditingMode, parentLayoutType: parentLayout?.type }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.MediaPlaceholder, { icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { icon: library_image }), onSelect: onSelectImage, onSelectURL: onSelectURL, onError: onUploadError, placeholder: placeholder, accept: "image/*", allowedTypes: constants_ALLOWED_MEDIA_TYPES, value: { id, src }, mediaPreview: mediaPreview, disableMediaButtons: temporaryURL || url })] }); } /* harmony default export */ const image_edit = (ImageEdit); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/save.js /** * External dependencies */ /** * WordPress dependencies */ function image_save_save({ attributes }) { const { url, alt, caption, align, href, rel, linkClass, width, height, aspectRatio, scale, id, linkTarget, sizeSlug, title } = attributes; const newRel = !rel ? undefined : rel; const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetBorderClassesAndStyles)(attributes); const shadowProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetShadowClassesAndStyles)(attributes); const classes = dist_clsx({ // All other align classes are handled by block supports. // `{ align: 'none' }` is unique to transforms for the image block. alignnone: 'none' === align, [`size-${sizeSlug}`]: sizeSlug, 'is-resized': width || height, 'has-custom-border': !!borderProps.className || borderProps.style && Object.keys(borderProps.style).length > 0 }); const imageClasses = dist_clsx(borderProps.className, { [`wp-image-${id}`]: !!id }); const image = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: url, alt: alt, className: imageClasses || undefined, style: { ...borderProps.style, ...shadowProps.style, aspectRatio, objectFit: scale, width, height }, title: title }); const figure = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [href ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { className: linkClass, href: href, target: linkTarget, rel: newRel, children: image }) : image, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { className: (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('caption'), tagName: "figcaption", value: caption })] }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("figure", { ...external_wp_blockEditor_namespaceObject.useBlockProps.save({ className: classes }), children: figure }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/transforms.js /** * WordPress dependencies */ function stripFirstImage(attributes, { shortcode }) { const { body } = document.implementation.createHTMLDocument(''); body.innerHTML = shortcode.content; let nodeToRemove = body.querySelector('img'); // If an image has parents, find the topmost node to remove. while (nodeToRemove && nodeToRemove.parentNode && nodeToRemove.parentNode !== body) { nodeToRemove = nodeToRemove.parentNode; } if (nodeToRemove) { nodeToRemove.parentNode.removeChild(nodeToRemove); } return body.innerHTML.trim(); } function getFirstAnchorAttributeFormHTML(html, attributeName) { const { body } = document.implementation.createHTMLDocument(''); body.innerHTML = html; const { firstElementChild } = body; if (firstElementChild && firstElementChild.nodeName === 'A') { return firstElementChild.getAttribute(attributeName) || undefined; } } const imageSchema = { img: { attributes: ['src', 'alt', 'title'], classes: ['alignleft', 'aligncenter', 'alignright', 'alignnone', /^wp-image-\d+$/] } }; const schema = ({ phrasingContentSchema }) => ({ figure: { require: ['img'], children: { ...imageSchema, a: { attributes: ['href', 'rel', 'target'], children: imageSchema }, figcaption: { children: phrasingContentSchema } } } }); const image_transforms_transforms = { from: [{ type: 'raw', isMatch: node => node.nodeName === 'FIGURE' && !!node.querySelector('img'), schema, transform: node => { // Search both figure and image classes. Alignment could be // set on either. ID is set on the image. const className = node.className + ' ' + node.querySelector('img').className; const alignMatches = /(?:^|\s)align(left|center|right)(?:$|\s)/.exec(className); const anchor = node.id === '' ? undefined : node.id; const align = alignMatches ? alignMatches[1] : undefined; const idMatches = /(?:^|\s)wp-image-(\d+)(?:$|\s)/.exec(className); const id = idMatches ? Number(idMatches[1]) : undefined; const anchorElement = node.querySelector('a'); const linkDestination = anchorElement && anchorElement.href ? 'custom' : undefined; const href = anchorElement && anchorElement.href ? anchorElement.href : undefined; const rel = anchorElement && anchorElement.rel ? anchorElement.rel : undefined; const linkClass = anchorElement && anchorElement.className ? anchorElement.className : undefined; const attributes = (0,external_wp_blocks_namespaceObject.getBlockAttributes)('core/image', node.outerHTML, { align, id, linkDestination, href, rel, linkClass, anchor }); return (0,external_wp_blocks_namespaceObject.createBlock)('core/image', attributes); } }, { // Note: when dragging and dropping multiple files onto a gallery this overrides the // gallery transform in order to add new images to the gallery instead of // creating a new gallery. type: 'files', isMatch(files) { // The following check is intended to catch non-image files when dropped together with images. if (files.some(file => file.type.indexOf('image/') === 0) && files.some(file => file.type.indexOf('image/') !== 0)) { const { createErrorNotice } = (0,external_wp_data_namespaceObject.dispatch)(external_wp_notices_namespaceObject.store); createErrorNotice((0,external_wp_i18n_namespaceObject.__)('If uploading to a gallery all files need to be image formats'), { id: 'gallery-transform-invalid-file', type: 'snackbar' }); } return files.every(file => file.type.indexOf('image/') === 0); }, transform(files) { const blocks = files.map(file => { return (0,external_wp_blocks_namespaceObject.createBlock)('core/image', { url: (0,external_wp_blob_namespaceObject.createBlobURL)(file) }); }); return blocks; } }, { type: 'shortcode', tag: 'caption', attributes: { url: { type: 'string', source: 'attribute', attribute: 'src', selector: 'img' }, alt: { type: 'string', source: 'attribute', attribute: 'alt', selector: 'img' }, caption: { shortcode: stripFirstImage }, href: { shortcode: (attributes, { shortcode }) => { return getFirstAnchorAttributeFormHTML(shortcode.content, 'href'); } }, rel: { shortcode: (attributes, { shortcode }) => { return getFirstAnchorAttributeFormHTML(shortcode.content, 'rel'); } }, linkClass: { shortcode: (attributes, { shortcode }) => { return getFirstAnchorAttributeFormHTML(shortcode.content, 'class'); } }, id: { type: 'number', shortcode: ({ named: { id } }) => { if (!id) { return; } return parseInt(id.replace('attachment_', ''), 10); } }, align: { type: 'string', shortcode: ({ named: { align = 'alignnone' } }) => { return align.replace('align', ''); } } } }] }; /* harmony default export */ const image_transforms = (image_transforms_transforms); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const image_metadata = { $schema: "https://schemas.wp.org/trunk/block.json", apiVersion: 3, name: "core/image", title: "Image", category: "media", usesContext: ["allowResize", "imageCrop", "fixedHeight"], description: "Insert an image to make a visual statement.", keywords: ["img", "photo", "picture"], textdomain: "default", attributes: { url: { type: "string", source: "attribute", selector: "img", attribute: "src", __experimentalRole: "content" }, alt: { type: "string", source: "attribute", selector: "img", attribute: "alt", "default": "", __experimentalRole: "content" }, caption: { type: "rich-text", source: "rich-text", selector: "figcaption", __experimentalRole: "content" }, lightbox: { type: "object", enabled: { type: "boolean" } }, title: { type: "string", source: "attribute", selector: "img", attribute: "title", __experimentalRole: "content" }, href: { type: "string", source: "attribute", selector: "figure > a", attribute: "href", __experimentalRole: "content" }, rel: { type: "string", source: "attribute", selector: "figure > a", attribute: "rel" }, linkClass: { type: "string", source: "attribute", selector: "figure > a", attribute: "class" }, id: { type: "number", __experimentalRole: "content" }, width: { type: "string" }, height: { type: "string" }, aspectRatio: { type: "string" }, scale: { type: "string" }, sizeSlug: { type: "string" }, linkDestination: { type: "string" }, linkTarget: { type: "string", source: "attribute", selector: "figure > a", attribute: "target" } }, supports: { interactivity: true, align: ["left", "center", "right", "wide", "full"], anchor: true, color: { text: false, background: false }, filter: { duotone: true }, __experimentalBorder: { color: true, radius: true, width: true, __experimentalSkipSerialization: true, __experimentalDefaultControls: { color: true, radius: true, width: true } }, shadow: { __experimentalSkipSerialization: true } }, selectors: { border: ".wp-block-image img, .wp-block-image .wp-block-image__crop-area, .wp-block-image .components-placeholder", shadow: ".wp-block-image img, .wp-block-image .wp-block-image__crop-area, .wp-block-image .components-placeholder", filter: { duotone: ".wp-block-image img, .wp-block-image .components-placeholder" } }, styles: [{ name: "default", label: "Default", isDefault: true }, { name: "rounded", label: "Rounded" }], editorStyle: "wp-block-image-editor", style: "wp-block-image" }; const { name: image_name } = image_metadata; const image_settings = { icon: library_image, example: { attributes: { sizeSlug: 'large', url: 'https://s.w.org/images/core/5.3/MtBlanc1.jpg', // translators: Caption accompanying an image of the Mont Blanc, which serves as an example for the Image block. caption: (0,external_wp_i18n_namespaceObject.__)('Mont Blanc appears—still, snowy, and serene.') } }, __experimentalLabel(attributes, { context }) { const customName = attributes?.metadata?.name; if (context === 'list-view' && customName) { return customName; } if (context === 'accessibility') { const { caption, alt, url } = attributes; if (!url) { return (0,external_wp_i18n_namespaceObject.__)('Empty'); } if (!alt) { return caption || ''; } // This is intended to be read by a screen reader. // A period simply means a pause, no need to translate it. return alt + (caption ? '. ' + caption : ''); } }, getEditWrapperProps(attributes) { return { 'data-align': attributes.align }; }, transforms: image_transforms, edit: image_edit, save: image_save_save, deprecated: image_deprecated }; const image_init = () => initBlock({ name: image_name, metadata: image_metadata, settings: image_settings }); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/comment.js /** * WordPress dependencies */ const comment = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 4H6c-1.1 0-2 .9-2 2v12.9c0 .6.5 1.1 1.1 1.1.3 0 .5-.1.8-.3L8.5 17H18c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 11c0 .3-.2.5-.5.5H7.9l-2.4 2.4V6c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v9z" }) }); /* harmony default export */ const library_comment = (comment); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/latest-comments/edit.js /** * WordPress dependencies */ /** * Minimum number of comments a user can show using this block. * * @type {number} */ const MIN_COMMENTS = 1; /** * Maximum number of comments a user can show using this block. * * @type {number} */ const MAX_COMMENTS = 100; function LatestComments({ attributes, setAttributes }) { const { commentsToShow, displayAvatar, displayDate, displayExcerpt } = attributes; const serverSideAttributes = { ...attributes, style: { ...attributes?.style, spacing: undefined } }; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ...(0,external_wp_blockEditor_namespaceObject.useBlockProps)(), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorControls, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)('Settings'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Display avatar'), checked: displayAvatar, onChange: () => setAttributes({ displayAvatar: !displayAvatar }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Display date'), checked: displayDate, onChange: () => setAttributes({ displayDate: !displayDate }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Display excerpt'), checked: displayExcerpt, onChange: () => setAttributes({ displayExcerpt: !displayExcerpt }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Number of comments'), value: commentsToShow, onChange: value => setAttributes({ commentsToShow: value }), min: MIN_COMMENTS, max: MAX_COMMENTS, required: true })] }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Disabled, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)((external_wp_serverSideRender_default()), { block: "core/latest-comments", attributes: serverSideAttributes // The preview uses the site's locale to make it more true to how // the block appears on the frontend. Setting the locale // explicitly prevents any middleware from setting it to 'user'. , urlQueryArgs: { _locale: 'site' } }) })] }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/latest-comments/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const latest_comments_metadata = { $schema: "https://schemas.wp.org/trunk/block.json", apiVersion: 3, name: "core/latest-comments", title: "Latest Comments", category: "widgets", description: "Display a list of your most recent comments.", keywords: ["recent comments"], textdomain: "default", attributes: { commentsToShow: { type: "number", "default": 5, minimum: 1, maximum: 100 }, displayAvatar: { type: "boolean", "default": true }, displayDate: { type: "boolean", "default": true }, displayExcerpt: { type: "boolean", "default": true } }, supports: { align: true, html: false, spacing: { margin: true, padding: true }, typography: { fontSize: true, lineHeight: true, __experimentalFontFamily: true, __experimentalFontWeight: true, __experimentalFontStyle: true, __experimentalTextTransform: true, __experimentalTextDecoration: true, __experimentalLetterSpacing: true, __experimentalDefaultControls: { fontSize: true } }, interactivity: { clientNavigation: true } }, editorStyle: "wp-block-latest-comments-editor", style: "wp-block-latest-comments" }; const { name: latest_comments_name } = latest_comments_metadata; const latest_comments_settings = { icon: library_comment, example: {}, edit: LatestComments }; const latest_comments_init = () => initBlock({ name: latest_comments_name, metadata: latest_comments_metadata, settings: latest_comments_settings }); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-list.js /** * WordPress dependencies */ const postList = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 5.5H6a.5.5 0 0 0-.5.5v12a.5.5 0 0 0 .5.5h12a.5.5 0 0 0 .5-.5V6a.5.5 0 0 0-.5-.5ZM6 4h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2Zm1 5h1.5v1.5H7V9Zm1.5 4.5H7V15h1.5v-1.5ZM10 9h7v1.5h-7V9Zm7 4.5h-7V15h7v-1.5Z" }) }); /* harmony default export */ const post_list = (postList); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/latest-posts/deprecated.js /** * Internal dependencies */ const latest_posts_deprecated_metadata = { $schema: "https://schemas.wp.org/trunk/block.json", apiVersion: 3, name: "core/latest-posts", title: "Latest Posts", category: "widgets", description: "Display a list of your most recent posts.", keywords: ["recent posts"], textdomain: "default", attributes: { categories: { type: "array", items: { type: "object" } }, selectedAuthor: { type: "number" }, postsToShow: { type: "number", "default": 5 }, displayPostContent: { type: "boolean", "default": false }, displayPostContentRadio: { type: "string", "default": "excerpt" }, excerptLength: { type: "number", "default": 55 }, displayAuthor: { type: "boolean", "default": false }, displayPostDate: { type: "boolean", "default": false }, postLayout: { type: "string", "default": "list" }, columns: { type: "number", "default": 3 }, order: { type: "string", "default": "desc" }, orderBy: { type: "string", "default": "date" }, displayFeaturedImage: { type: "boolean", "default": false }, featuredImageAlign: { type: "string", "enum": ["left", "center", "right"] }, featuredImageSizeSlug: { type: "string", "default": "thumbnail" }, featuredImageSizeWidth: { type: "number", "default": null }, featuredImageSizeHeight: { type: "number", "default": null }, addLinkToFeaturedImage: { type: "boolean", "default": false } }, supports: { align: true, html: false, color: { gradients: true, link: true, __experimentalDefaultControls: { background: true, text: true, link: true } }, spacing: { margin: true, padding: true }, typography: { fontSize: true, lineHeight: true, __experimentalFontFamily: true, __experimentalFontWeight: true, __experimentalFontStyle: true, __experimentalTextTransform: true, __experimentalTextDecoration: true, __experimentalLetterSpacing: true, __experimentalDefaultControls: { fontSize: true } }, interactivity: { clientNavigation: true } }, editorStyle: "wp-block-latest-posts-editor", style: "wp-block-latest-posts" }; const { attributes: deprecated_attributes } = latest_posts_deprecated_metadata; /* harmony default export */ const latest_posts_deprecated = ([{ attributes: { ...deprecated_attributes, categories: { type: 'string' } }, supports: { align: true, html: false }, migrate: oldAttributes => { // This needs the full category object, not just the ID. return { ...oldAttributes, categories: [{ id: Number(oldAttributes.categories) }] }; }, isEligible: ({ categories }) => categories && 'string' === typeof categories, save: () => null }]); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list.js /** * WordPress dependencies */ const list = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4 4v1.5h16V4H4zm8 8.5h8V11h-8v1.5zM4 20h16v-1.5H4V20zm4-8c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2z" }) }); /* harmony default export */ const library_list = (list); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/latest-posts/constants.js const MIN_EXCERPT_LENGTH = 10; const MAX_EXCERPT_LENGTH = 100; const MAX_POSTS_COLUMNS = 6; ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/latest-posts/edit.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Module Constants */ const CATEGORIES_LIST_QUERY = { per_page: -1, context: 'view' }; const USERS_LIST_QUERY = { per_page: -1, has_published_posts: ['post'], context: 'view' }; function getFeaturedImageDetails(post, size) { var _image$media_details$; const image = post._embedded?.['wp:featuredmedia']?.['0']; return { url: (_image$media_details$ = image?.media_details?.sizes?.[size]?.source_url) !== null && _image$media_details$ !== void 0 ? _image$media_details$ : image?.source_url, alt: image?.alt_text }; } function LatestPostsEdit({ attributes, setAttributes }) { var _categoriesList$reduc; const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(LatestPostsEdit); const { postsToShow, order, orderBy, categories, selectedAuthor, displayFeaturedImage, displayPostContentRadio, displayPostContent, displayPostDate, displayAuthor, postLayout, columns, excerptLength, featuredImageAlign, featuredImageSizeSlug, featuredImageSizeWidth, featuredImageSizeHeight, addLinkToFeaturedImage } = attributes; const { imageSizes, latestPosts, defaultImageWidth, defaultImageHeight, categoriesList, authorList } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _settings$imageDimens, _settings$imageDimens2; const { getEntityRecords, getUsers } = select(external_wp_coreData_namespaceObject.store); const settings = select(external_wp_blockEditor_namespaceObject.store).getSettings(); const catIds = categories && categories.length > 0 ? categories.map(cat => cat.id) : []; const latestPostsQuery = Object.fromEntries(Object.entries({ categories: catIds, author: selectedAuthor, order, orderby: orderBy, per_page: postsToShow, _embed: 'wp:featuredmedia' }).filter(([, value]) => typeof value !== 'undefined')); return { defaultImageWidth: (_settings$imageDimens = settings.imageDimensions?.[featuredImageSizeSlug]?.width) !== null && _settings$imageDimens !== void 0 ? _settings$imageDimens : 0, defaultImageHeight: (_settings$imageDimens2 = settings.imageDimensions?.[featuredImageSizeSlug]?.height) !== null && _settings$imageDimens2 !== void 0 ? _settings$imageDimens2 : 0, imageSizes: settings.imageSizes, latestPosts: getEntityRecords('postType', 'post', latestPostsQuery), categoriesList: getEntityRecords('taxonomy', 'category', CATEGORIES_LIST_QUERY), authorList: getUsers(USERS_LIST_QUERY) }; }, [featuredImageSizeSlug, postsToShow, order, orderBy, categories, selectedAuthor]); // If a user clicks to a link prevent redirection and show a warning. const { createWarningNotice, removeNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); let noticeId; const showRedirectionPreventedNotice = event => { event.preventDefault(); // Remove previous warning if any, to show one at a time per block. removeNotice(noticeId); noticeId = `block-library/core/latest-posts/redirection-prevented/${instanceId}`; createWarningNotice((0,external_wp_i18n_namespaceObject.__)('Links are disabled in the editor.'), { id: noticeId, type: 'snackbar' }); }; const imageSizeOptions = imageSizes.filter(({ slug }) => slug !== 'full').map(({ name, slug }) => ({ value: slug, label: name })); const categorySuggestions = (_categoriesList$reduc = categoriesList?.reduce((accumulator, category) => ({ ...accumulator, [category.name]: category }), {})) !== null && _categoriesList$reduc !== void 0 ? _categoriesList$reduc : {}; const selectCategories = tokens => { const hasNoSuggestion = tokens.some(token => typeof token === 'string' && !categorySuggestions[token]); if (hasNoSuggestion) { return; } // Categories that are already will be objects, while new additions will be strings (the name). // allCategories nomalizes the array so that they are all objects. const allCategories = tokens.map(token => { return typeof token === 'string' ? categorySuggestions[token] : token; }); // We do nothing if the category is not selected // from suggestions. if (allCategories.includes(null)) { return false; } setAttributes({ categories: allCategories }); }; const hasPosts = !!latestPosts?.length; const inspectorControls = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.InspectorControls, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)('Post content'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { label: (0,external_wp_i18n_namespaceObject.__)('Post content'), checked: displayPostContent, onChange: value => setAttributes({ displayPostContent: value }) }), displayPostContent && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RadioControl, { label: (0,external_wp_i18n_namespaceObject.__)('Show:'), selected: displayPostContentRadio, options: [{ label: (0,external_wp_i18n_namespaceObject.__)('Excerpt'), value: 'excerpt' }, { label: (0,external_wp_i18n_namespaceObject.__)('Full post'), value: 'full_post' }], onChange: value => setAttributes({ displayPostContentRadio: value }) }), displayPostContent && displayPostContentRadio === 'excerpt' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Max number of words'), value: excerptLength, onChange: value => setAttributes({ excerptLength: value }), min: MIN_EXCERPT_LENGTH, max: MAX_EXCERPT_LENGTH })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)('Post meta'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Display author name'), checked: displayAuthor, onChange: value => setAttributes({ displayAuthor: value }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Display post date'), checked: displayPostDate, onChange: value => setAttributes({ displayPostDate: value }) })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)('Featured image'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Display featured image'), checked: displayFeaturedImage, onChange: value => setAttributes({ displayFeaturedImage: value }) }), displayFeaturedImage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalImageSizeControl, { onChange: value => { const newAttrs = {}; if (value.hasOwnProperty('width')) { newAttrs.featuredImageSizeWidth = value.width; } if (value.hasOwnProperty('height')) { newAttrs.featuredImageSizeHeight = value.height; } setAttributes(newAttrs); }, slug: featuredImageSizeSlug, width: featuredImageSizeWidth, height: featuredImageSizeHeight, imageWidth: defaultImageWidth, imageHeight: defaultImageHeight, imageSizeOptions: imageSizeOptions, imageSizeHelp: (0,external_wp_i18n_namespaceObject.__)('Select the size of the source image.'), onChangeImage: value => setAttributes({ featuredImageSizeSlug: value, featuredImageSizeWidth: undefined, featuredImageSizeHeight: undefined }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.BaseControl, { className: "editor-latest-posts-image-alignment-control", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { children: (0,external_wp_i18n_namespaceObject.__)('Image alignment') }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockAlignmentToolbar, { value: featuredImageAlign, onChange: value => setAttributes({ featuredImageAlign: value }), controls: ['left', 'center', 'right'], isCollapsed: false })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Add link to featured image'), checked: addLinkToFeaturedImage, onChange: value => setAttributes({ addLinkToFeaturedImage: value }) })] })] }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)('Sorting and filtering'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.QueryControls, { order, orderBy, numberOfItems: postsToShow, onOrderChange: value => setAttributes({ order: value }), onOrderByChange: value => setAttributes({ orderBy: value }), onNumberOfItemsChange: value => setAttributes({ postsToShow: value }), categorySuggestions: categorySuggestions, onCategoryChange: selectCategories, selectedCategories: categories, onAuthorChange: value => setAttributes({ selectedAuthor: '' !== value ? Number(value) : undefined }), authorList: authorList !== null && authorList !== void 0 ? authorList : [], selectedAuthorId: selectedAuthor }), postLayout === 'grid' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, { __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, label: (0,external_wp_i18n_namespaceObject.__)('Columns'), value: columns, onChange: value => setAttributes({ columns: value }), min: 2, max: !hasPosts ? MAX_POSTS_COLUMNS : Math.min(MAX_POSTS_COLUMNS, latestPosts.length), required: true })] })] }); const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({ className: dist_clsx({ 'wp-block-latest-posts__list': true, 'is-grid': postLayout === 'grid', 'has-dates': displayPostDate, 'has-author': displayAuthor, [`columns-${columns}`]: postLayout === 'grid' }) }); if (!hasPosts) { return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { ...blockProps, children: [inspectorControls, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, { icon: library_pin, label: (0,external_wp_i18n_namespaceObject.__)('Latest Posts'), children: !Array.isArray(latestPosts) ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) : (0,external_wp_i18n_namespaceObject.__)('No posts found.') })] }); } // Removing posts from display should be instant. const displayPosts = latestPosts.length > postsToShow ? latestPosts.slice(0, postsToShow) : latestPosts; const layoutControls = [{ icon: library_list, title: (0,external_wp_i18n_namespaceObject._x)('List view', 'Latest posts block display setting'), onClick: () => setAttributes({ postLayout: 'list' }), isActive: postLayout === 'list' }, { icon: library_grid, title: (0,external_wp_i18n_namespaceObject._x)('Grid view', 'Latest posts block display setting'), onClick: () => setAttributes({ postLayout: 'grid' }), isActive: postLayout === 'grid' }]; const dateFormat = (0,external_wp_date_namespaceObject.getSettings)().formats.date; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [inspectorControls, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { controls: layoutControls }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { ...blockProps, children: displayPosts.map(post => { const titleTrimmed = post.title.rendered.trim(); let excerpt = post.excerpt.rendered; const currentAuthor = authorList?.find(author => author.id === post.author); const excerptElement = document.createElement('div'); excerptElement.innerHTML = excerpt; excerpt = excerptElement.textContent || excerptElement.innerText || ''; const { url: imageSourceUrl, alt: featuredImageAlt } = getFeaturedImageDetails(post, featuredImageSizeSlug); const imageClasses = dist_clsx({ 'wp-block-latest-posts__featured-image': true, [`align${featuredImageAlign}`]: !!featuredImageAlign }); const renderFeaturedImage = displayFeaturedImage && imageSourceUrl; const featuredImage = renderFeaturedImage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { src: imageSourceUrl, alt: featuredImageAlt, style: { maxWidth: featuredImageSizeWidth, maxHeight: featuredImageSizeHeight } }); const needsReadMore = excerptLength < excerpt.trim().split(' ').length && post.excerpt.raw === ''; const postExcerpt = needsReadMore ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [excerpt.trim().split(' ', excerptLength).join(' '), (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: Hidden accessibility text: Post title */ (0,external_wp_i18n_namespaceObject.__)('… <a>Read more<span>: %1$s</span></a>'), titleTrimmed || (0,external_wp_i18n_namespaceObject.__)('(no title)')), { a: /*#__PURE__*/ // eslint-disable-next-line jsx-a11y/anchor-has-content (0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { className: "wp-block-latest-posts__read-more", href: post.link, rel: "noopener noreferrer", onClick: showRedirectionPreventedNotice }), span: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "screen-reader-text" }) })] }) : excerpt; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { children: [renderFeaturedImage && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: imageClasses, children: addLinkToFeaturedImage ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { href: post.link, rel: "noreferrer noopener", onClick: showRedirectionPreventedNotice, children: featuredImage }) : featuredImage }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("a", { className: "wp-block-latest-posts__post-title", href: post.link, rel: "noreferrer noopener", dangerouslySetInnerHTML: !!titleTrimmed ? { __html: titleTrimmed } : undefined, onClick: showRedirectionPreventedNotice, children: !titleTrimmed ? (0,external_wp_i18n_namespaceObject.__)('(no title)') : null }), displayAuthor && currentAuthor && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "wp-block-latest-posts__post-author", children: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: byline. %s: current author. */ (0,external_wp_i18n_namespaceObject.__)('by %s'), currentAuthor.name) }), displayPostDate && post.date_gmt && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("time", { dateTime: (0,external_wp_date_namespaceObject.format)('c', post.date_gmt), className: "wp-block-latest-posts__post-date", children: (0,external_wp_date_namespaceObject.dateI18n)(dateFormat, post.date_gmt) }), displayPostContent && displayPostContentRadio === 'excerpt' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "wp-block-latest-posts__post-excerpt", children: postExcerpt }), displayPostContent && displayPostContentRadio === 'full_post' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "wp-block-latest-posts__post-full-content", dangerouslySetInnerHTML: { __html: post.content.raw.trim() } })] }, post.id); }) })] }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/latest-posts/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const latest_posts_metadata = { $schema: "https://schemas.wp.org/trunk/block.json", apiVersion: 3, name: "core/latest-posts", title: "Latest Posts", category: "widgets", description: "Display a list of your most recent posts.", keywords: ["recent posts"], textdomain: "default", attributes: { categories: { type: "array", items: { type: "object" } }, selectedAuthor: { type: "number" }, postsToShow: { type: "number", "default": 5 }, displayPostContent: { type: "boolean", "default": false }, displayPostContentRadio: { type: "string", "default": "excerpt" }, excerptLength: { type: "number", "default": 55 }, displayAuthor: { type: "boolean", "default": false }, displayPostDate: { type: "boolean", "default": false }, postLayout: { type: "string", "default": "list" }, columns: { type: "number", "default": 3 }, order: { type: "string", "default": "desc" }, orderBy: { type: "string", "default": "date" }, displayFeaturedImage: { type: "boolean", "default": false }, featuredImageAlign: { type: "string", "enum": ["left", "center", "right"] }, featuredImageSizeSlug: { type: "string", "default": "thumbnail" }, featuredImageSizeWidth: { type: "number", "default": null }, featuredImageSizeHeight: { type: "number", "default": null }, addLinkToFeaturedImage: { type: "boolean", "default": false } }, supports: { align: true, html: false, color: { gradients: true, link: true, __experimentalDefaultControls: { background: true, text: true, link: true } }, spacing: { margin: true, padding: true }, typography: { fontSize: true, lineHeight: true, __experimentalFontFamily: true, __experimentalFontWeight: true, __experimentalFontStyle: true, __experimentalTextTransform: true, __experimentalTextDecoration: true, __experimentalLetterSpacing: true, __experimentalDefaultControls: { fontSize: true } }, interactivity: { clientNavigation: true } }, editorStyle: "wp-block-latest-posts-editor", style: "wp-block-latest-posts" }; const { name: latest_posts_name } = latest_posts_metadata; const latest_posts_settings = { icon: post_list, example: {}, edit: LatestPostsEdit, deprecated: latest_posts_deprecated }; const latest_posts_init = () => initBlock({ name: latest_posts_name, metadata: latest_posts_metadata, settings: latest_posts_settings }); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list/utils.js /** * WordPress dependencies */ const LIST_STYLES = { A: 'upper-alpha', a: 'lower-alpha', I: 'upper-roman', i: 'lower-roman' }; function createListBlockFromDOMElement(listElement) { const type = listElement.getAttribute('type'); const listAttributes = { ordered: 'OL' === listElement.tagName, anchor: listElement.id === '' ? undefined : listElement.id, start: listElement.getAttribute('start') ? parseInt(listElement.getAttribute('start'), 10) : undefined, reversed: listElement.hasAttribute('reversed') ? true : undefined, type: type && LIST_STYLES[type] ? LIST_STYLES[type] : undefined }; const innerBlocks = Array.from(listElement.children).map(listItem => { const children = Array.from(listItem.childNodes).filter(node => node.nodeType !== node.TEXT_NODE || node.textContent.trim().length !== 0); children.reverse(); const [nestedList, ...nodes] = children; const hasNestedList = nestedList?.tagName === 'UL' || nestedList?.tagName === 'OL'; if (!hasNestedList) { return (0,external_wp_blocks_namespaceObject.createBlock)('core/list-item', { content: listItem.innerHTML }); } const htmlNodes = nodes.map(node => { if (node.nodeType === node.TEXT_NODE) { return node.textContent; } return node.outerHTML; }); htmlNodes.reverse(); const childAttributes = { content: htmlNodes.join('').trim() }; const childInnerBlocks = [createListBlockFromDOMElement(nestedList)]; return (0,external_wp_blocks_namespaceObject.createBlock)('core/list-item', childAttributes, childInnerBlocks); }); return (0,external_wp_blocks_namespaceObject.createBlock)('core/list', listAttributes, innerBlocks); } function migrateToListV2(attributes) { const { values, start, reversed, ordered, type, ...otherAttributes } = attributes; const list = document.createElement(ordered ? 'ol' : 'ul'); list.innerHTML = values; if (start) { list.setAttribute('start', start); } if (reversed) { list.setAttribute('reversed', true); } if (type) { list.setAttribute('type', type); } const [listBlock] = (0,external_wp_blocks_namespaceObject.rawHandler)({ HTML: list.outerHTML }); return [{ ...otherAttributes, ...listBlock.attributes }, listBlock.innerBlocks]; } function migrateTypeToInlineStyle(attributes) { const { type } = attributes; if (type && LIST_STYLES[type]) { return { ...attributes, type: LIST_STYLES[type] }; } return attributes; } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list/deprecated.js /** * WordPress dependencies */ /** * Internal dependencies */ const v0 = { attributes: { ordered: { type: 'boolean', default: false, __experimentalRole: 'content' }, values: { type: 'string', source: 'html', selector: 'ol,ul', multiline: 'li', __unstableMultilineWrapperTags: ['ol', 'ul'], default: '', __experimentalRole: 'content' }, type: { type: 'string' }, start: { type: 'number' }, reversed: { type: 'boolean' }, placeholder: { type: 'string' } }, supports: { anchor: true, className: false, typography: { fontSize: true, __experimentalFontFamily: true }, color: { gradients: true, link: true }, __unstablePasteTextInline: true, __experimentalSelector: 'ol,ul', __experimentalSlashInserter: true }, save({ attributes }) { const { ordered, values, type, reversed, start } = attributes; const TagName = ordered ? 'ol' : 'ul'; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TagName, { ...external_wp_blockEditor_namespaceObject.useBlockProps.save({ type, reversed, start }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { value: values, multiline: "li" }) }); }, migrate: migrate_font_family, isEligible({ style }) { return style?.typography?.fontFamily; } }; const list_deprecated_v1 = { attributes: { ordered: { type: 'boolean', default: false, __experimentalRole: 'content' }, values: { type: 'string', source: 'html', selector: 'ol,ul', multiline: 'li', __unstableMultilineWrapperTags: ['ol', 'ul'], default: '', __experimentalRole: 'content' }, type: { type: 'string' }, start: { type: 'number' }, reversed: { type: 'boolean' }, placeholder: { type: 'string' } }, supports: { anchor: true, className: false, typography: { fontSize: true, __experimentalFontFamily: true, lineHeight: true, __experimentalFontStyle: true, __experimentalFontWeight: true, __experimentalLetterSpacing: true, __experimentalTextTransform: true, __experimentalDefaultControls: { fontSize: true } }, color: { gradients: true, link: true, __experimentalDefaultControls: { background: true, text: true } }, __unstablePasteTextInline: true, __experimentalSelector: 'ol,ul', __experimentalSlashInserter: true }, save({ attributes }) { const { ordered, values, type, reversed, start } = attributes; const TagName = ordered ? 'ol' : 'ul'; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TagName, { ...external_wp_blockEditor_namespaceObject.useBlockProps.save({ type, reversed, start }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { value: values, multiline: "li" }) }); }, migrate: migrateToListV2 }; // In #53301 changed to use the inline style instead of type attribute. const list_deprecated_v2 = { attributes: { ordered: { type: 'boolean', default: false, __experimentalRole: 'content' }, values: { type: 'string', source: 'html', selector: 'ol,ul', multiline: 'li', __unstableMultilineWrapperTags: ['ol', 'ul'], default: '', __experimentalRole: 'content' }, type: { type: 'string' }, start: { type: 'number' }, reversed: { type: 'boolean' }, placeholder: { type: 'string' } }, supports: { anchor: true, className: false, typography: { fontSize: true, lineHeight: true, __experimentalFontFamily: true, __experimentalFontWeight: true, __experimentalFontStyle: true, __experimentalTextTransform: true, __experimentalTextDecoration: true, __experimentalLetterSpacing: true, __experimentalDefaultControls: { fontSize: true } }, color: { gradients: true, link: true, __experimentalDefaultControls: { background: true, text: true } }, spacing: { margin: true, padding: true, __experimentalDefaultControls: { margin: false, padding: false } }, __unstablePasteTextInline: true, __experimentalSelector: 'ol,ul', __experimentalSlashInserter: true }, isEligible({ type }) { return !!type; }, save({ attributes }) { const { ordered, type, reversed, start } = attributes; const TagName = ordered ? 'ol' : 'ul'; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TagName, { ...external_wp_blockEditor_namespaceObject.useBlockProps.save({ type, reversed, start }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, {}) }); }, migrate: migrateTypeToInlineStyle }; // Version without block support 'className: true'. const list_deprecated_v3 = { attributes: { ordered: { type: 'boolean', default: false, __experimentalRole: 'content' }, values: { type: 'string', source: 'html', selector: 'ol,ul', multiline: 'li', __unstableMultilineWrapperTags: ['ol', 'ul'], default: '', __experimentalRole: 'content' }, type: { type: 'string' }, start: { type: 'number' }, reversed: { type: 'boolean' }, placeholder: { type: 'string' } }, supports: { anchor: true, className: false, typography: { fontSize: true, lineHeight: true, __experimentalFontFamily: true, __experimentalFontWeight: true, __experimentalFontStyle: true, __experimentalTextTransform: true, __experimentalTextDecoration: true, __experimentalLetterSpacing: true, __experimentalDefaultControls: { fontSize: true } }, color: { gradients: true, link: true, __experimentalDefaultControls: { background: true, text: true } }, spacing: { margin: true, padding: true, __experimentalDefaultControls: { margin: false, padding: false } }, __unstablePasteTextInline: true, __experimentalSelector: 'ol,ul', __experimentalOnMerge: 'true', __experimentalSlashInserter: true }, save({ attributes }) { const { ordered, type, reversed, start } = attributes; const TagName = ordered ? 'ol' : 'ul'; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TagName, { ...external_wp_blockEditor_namespaceObject.useBlockProps.save({ reversed, start, style: { listStyleType: ordered && type !== 'decimal' ? type : undefined } }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, {}) }); } }; /** * New deprecations need to be placed first * for them to have higher priority. * * Old deprecations may need to be updated as well. * * See block-deprecation.md */ /* harmony default export */ const list_deprecated = ([list_deprecated_v3, list_deprecated_v2, list_deprecated_v1, v0]); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-outdent-rtl.js /** * WordPress dependencies */ const formatOutdentRTL = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20 5.5H4V4H20V5.5ZM12 12.5H4V11H12V12.5ZM20 20V18.5H4V20H20ZM15.4697 14.9697L18.4393 12L15.4697 9.03033L16.5303 7.96967L20.0303 11.4697L20.5607 12L20.0303 12.5303L16.5303 16.0303L15.4697 14.9697Z" }) }); /* harmony default export */ const format_outdent_rtl = (formatOutdentRTL); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-outdent.js /** * WordPress dependencies */ const formatOutdent = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4 7.2v1.5h16V7.2H4zm8 8.6h8v-1.5h-8v1.5zm-4-4.6l-4 4 4 4 1-1-3-3 3-3-1-1z" }) }); /* harmony default export */ const format_outdent = (formatOutdent); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-list-bullets-rtl.js /** * WordPress dependencies */ const formatListBulletsRTL = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M4 8.8h8.9V7.2H4v1.6zm0 7h8.9v-1.5H4v1.5zM18 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z" }) }); /* harmony default export */ const format_list_bullets_rtl = (formatListBulletsRTL); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-list-bullets.js /** * WordPress dependencies */ const formatListBullets = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" }) }); /* harmony default export */ const format_list_bullets = (formatListBullets); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-list-numbered-rtl.js /** * WordPress dependencies */ const formatListNumberedRTL = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M3.8 15.8h8.9v-1.5H3.8v1.5zm0-7h8.9V7.2H3.8v1.6zm14.7-2.1V10h1V5.3l-2.2.7.3 1 .9-.3zm1.2 6.1c-.5-.6-1.2-.5-1.7-.4-.3.1-.5.2-.7.3l.1 1.1c.2-.2.5-.4.8-.5.3-.1.6 0 .7.1.2.3 0 .8-.2 1.1-.5.8-.9 1.6-1.4 2.5H20v-1h-.9c.3-.6.8-1.4.9-2.1 0-.3 0-.8-.3-1.1z" }) }); /* harmony default export */ const format_list_numbered_rtl = (formatListNumberedRTL); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-list-numbered.js /** * WordPress dependencies */ const formatListNumbered = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM5 6.7V10h1V5.3L3.8 6l.4 1 .8-.3zm-.4 5.7c-.3.1-.5.2-.7.3l.1 1.1c.2-.2.5-.4.8-.5.3-.1.6 0 .7.1.2.3 0 .8-.2 1.1-.5.8-.9 1.6-1.4 2.5h2.7v-1h-1c.3-.6.8-1.4.9-2.1.1-.3 0-.8-.2-1.1-.5-.6-1.3-.5-1.7-.4z" }) }); /* harmony default export */ const format_list_numbered = (formatListNumbered); ;// CONCATENATED MODULE: external ["wp","deprecated"] const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list/ordered-list-settings.js /** * WordPress dependencies */ const OrderedListSettings = ({ setAttributes, reversed, start, type }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorControls, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)('Settings'), children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Start value'), type: "number", onChange: value => { const int = parseInt(value, 10); setAttributes({ // It should be possible to unset the value, // e.g. with an empty string. start: isNaN(int) ? undefined : int }); }, value: Number.isInteger(start) ? start.toString(10) : '', step: "1" }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Numbering style'), options: [{ label: (0,external_wp_i18n_namespaceObject.__)('Numbers'), value: 'decimal' }, { label: (0,external_wp_i18n_namespaceObject.__)('Uppercase letters'), value: 'upper-alpha' }, { label: (0,external_wp_i18n_namespaceObject.__)('Lowercase letters'), value: 'lower-alpha' }, { label: (0,external_wp_i18n_namespaceObject.__)('Uppercase Roman numerals'), value: 'upper-roman' }, { label: (0,external_wp_i18n_namespaceObject.__)('Lowercase Roman numerals'), value: 'lower-roman' }], value: type, onChange: newValue => setAttributes({ type: newValue }) }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Reverse list numbering'), checked: reversed || false, onChange: value => { setAttributes({ // Unset the attribute if not reversed. reversed: value || undefined }); } })] }) }); /* harmony default export */ const ordered_list_settings = (OrderedListSettings); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list/tag-name.js /** * WordPress dependencies */ function TagName(props, ref) { const { ordered, ...extraProps } = props; const Tag = ordered ? 'ol' : 'ul'; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tag, { ref: ref, ...extraProps }); } /* harmony default export */ const tag_name = ((0,external_wp_element_namespaceObject.forwardRef)(TagName)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list/edit.js /** * WordPress dependencies */ /** * Internal dependencies */ const list_edit_DEFAULT_BLOCK = { name: 'core/list-item' }; const list_edit_TEMPLATE = [['core/list-item']]; const NATIVE_MARGIN_SPACING = 8; /** * At the moment, deprecations don't handle create blocks from attributes * (like when using CPT templates). For this reason, this hook is necessary * to avoid breaking templates using the old list block format. * * @param {Object} attributes Block attributes. * @param {string} clientId Block client ID. */ function useMigrateOnLoad(attributes, clientId) { const registry = (0,external_wp_data_namespaceObject.useRegistry)(); const { updateBlockAttributes, replaceInnerBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); (0,external_wp_element_namespaceObject.useEffect)(() => { // As soon as the block is loaded, migrate it to the new version. if (!attributes.values) { return; } const [newAttributes, newInnerBlocks] = migrateToListV2(attributes); external_wp_deprecated_default()('Value attribute on the list block', { since: '6.0', version: '6.5', alternative: 'inner blocks' }); registry.batch(() => { updateBlockAttributes(clientId, newAttributes); replaceInnerBlocks(clientId, newInnerBlocks); }); }, [attributes.values]); } function useOutdentList(clientId) { const { replaceBlocks, selectionChange } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); const { getBlockRootClientId, getBlockAttributes, getBlock } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); return (0,external_wp_element_namespaceObject.useCallback)(() => { const parentBlockId = getBlockRootClientId(clientId); const parentBlockAttributes = getBlockAttributes(parentBlockId); // Create a new parent block without the inner blocks. const newParentBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/list-item', parentBlockAttributes); const { innerBlocks } = getBlock(clientId); // Replace the parent block with a new parent block without inner blocks, // and make the inner blocks siblings of the parent. replaceBlocks([parentBlockId], [newParentBlock, ...innerBlocks]); // Select the last child of the list being outdent. selectionChange(innerBlocks[innerBlocks.length - 1].clientId); }, [clientId]); } function IndentUI({ clientId }) { const outdentList = useOutdentList(clientId); const canOutdent = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getBlockRootClientId, getBlockName } = select(external_wp_blockEditor_namespaceObject.store); return getBlockName(getBlockRootClientId(clientId)) === 'core/list-item'; }, [clientId]); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? format_outdent_rtl : format_outdent, title: (0,external_wp_i18n_namespaceObject.__)('Outdent'), describedBy: (0,external_wp_i18n_namespaceObject.__)('Outdent list item'), disabled: !canOutdent, onClick: outdentList }) }); } function list_edit_Edit({ attributes, setAttributes, clientId, style }) { const { ordered, type, reversed, start } = attributes; const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({ style: { ...(external_wp_element_namespaceObject.Platform.isNative && style), listStyleType: ordered && type !== 'decimal' ? type : undefined } }); const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(blockProps, { defaultBlock: list_edit_DEFAULT_BLOCK, directInsert: true, template: list_edit_TEMPLATE, templateLock: false, templateInsertUpdatesSelection: true, ...(external_wp_element_namespaceObject.Platform.isNative && { marginVertical: NATIVE_MARGIN_SPACING, marginHorizontal: NATIVE_MARGIN_SPACING, renderAppender: false }), __experimentalCaptureToolbars: true }); useMigrateOnLoad(attributes, clientId); const controls = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.BlockControls, { group: "block", children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? format_list_bullets_rtl : format_list_bullets, title: (0,external_wp_i18n_namespaceObject.__)('Unordered'), describedBy: (0,external_wp_i18n_namespaceObject.__)('Convert to unordered list'), isActive: ordered === false, onClick: () => { setAttributes({ ordered: false }); } }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? format_list_numbered_rtl : format_list_numbered, title: (0,external_wp_i18n_namespaceObject.__)('Ordered'), describedBy: (0,external_wp_i18n_namespaceObject.__)('Convert to ordered list'), isActive: ordered === true, onClick: () => { setAttributes({ ordered: true }); } }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(IndentUI, { clientId: clientId })] }); return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tag_name, { ordered: ordered, reversed: reversed, start: start, ...innerBlocksProps }), controls, ordered && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ordered_list_settings, { setAttributes, reversed, start, type })] }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list/save.js /** * WordPress dependencies */ function list_save_save({ attributes }) { const { ordered, type, reversed, start } = attributes; const TagName = ordered ? 'ol' : 'ul'; return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TagName, { ...external_wp_blockEditor_namespaceObject.useBlockProps.save({ reversed, start, style: { listStyleType: ordered && type !== 'decimal' ? type : undefined } }), children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, {}) }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list/transforms.js /** * WordPress dependencies */ /** * Internal dependencies */ function getListContentSchema({ phrasingContentSchema }) { const listContentSchema = { ...phrasingContentSchema, ul: {}, ol: { attributes: ['type', 'start', 'reversed'] } }; // Recursion is needed. // Possible: ul > li > ul. // Impossible: ul > ul. ['ul', 'ol'].forEach(tag => { listContentSchema[tag].children = { li: { children: listContentSchema } }; }); return listContentSchema; } function getListContentFlat(blocks) { return blocks.flatMap(({ name, attributes, innerBlocks = [] }) => { if (name === 'core/list-item') { return [attributes.content, ...getListContentFlat(innerBlocks)]; } return getListContentFlat(innerBlocks); }); } const list_transforms_transforms = { from: [{ type: 'block', isMultiBlock: true, blocks: ['core/paragraph', 'core/heading'], transform: blockAttributes => { let childBlocks = []; if (blockAttributes.length > 1) { childBlocks = blockAttributes.map(({ content }) => { return (0,external_wp_blocks_namespaceObject.createBlock)('core/list-item', { content }); }); } else if (blockAttributes.length === 1) { const value = (0,external_wp_richText_namespaceObject.create)({ html: blockAttributes[0].content }); childBlocks = (0,external_wp_richText_namespaceObject.split)(value, '\n').map(result => { return (0,external_wp_blocks_namespaceObject.createBlock)('core/list-item', { content: (0,external_wp_richText_namespaceObject.toHTMLString)({ value: result }) }); }); } return (0,external_wp_blocks_namespaceObject.createBlock)('core/list', { anchor: blockAttributes.anchor }, childBlocks); } }, { type: 'raw', selector: 'ol,ul', schema: args => ({ ol: getListContentSchema(args).ol, ul: getListContentSchema(args).ul }), transform: createListBlockFromDOMElement }, ...['*', '-'].map(prefix => ({ type: 'prefix', prefix, transform(content) { return (0,external_wp_blocks_namespaceObject.createBlock)('core/list', {}, [(0,external_wp_blocks_namespaceObject.createBlock)('core/list-item', { content })]); } })), ...['1.', '1)'].map(prefix => ({ type: 'prefix', prefix, transform(content) { return (0,external_wp_blocks_namespaceObject.createBlock)('core/list', { ordered: true }, [(0,external_wp_blocks_namespaceObject.createBlock)('core/list-item', { content })]); } }))], to: [...['core/paragraph', 'core/heading'].map(block => ({ type: 'block', blocks: [block], transform: (_attributes, childBlocks) => { return getListContentFlat(childBlocks).map(content => (0,external_wp_blocks_namespaceObject.createBlock)(block, { content })); } }))] }; /* harmony default export */ const list_transforms = (list_transforms_transforms); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list/index.js /** * WordPress dependencies */ /** * Internal dependencies */ const list_metadata = { $schema: "https://schemas.wp.org/trunk/block.json", apiVersion: 3, name: "core/list", title: "List", category: "text", allowedBlocks: ["core/list-item"], description: "Create a bulleted or numbered list.", keywords: ["bullet list", "ordered list", "numbered list"], textdomain: "default", attributes: { ordered: { type: "boolean", "default": false, __experimentalRole: "content" }, values: { type: "string", source: "html", selector: "ol,ul", multiline: "li", __unstableMultilineWrapperTags: ["ol", "ul"], "default": "", __experimentalRole: "content" }, type: { type: "string" }, start: { type: "number" }, reversed: { type: "boolean" }, placeholder: { type: "string" } }, supports: { anchor: true, html: false, typography: { fontSize: true, lineHeight: true, __experimentalFontFamily: true, __experimentalFontWeight: true, __experimentalFontStyle: true, __experimentalTextTransform: true, __experimentalTextDecoration: true, __experimentalLetterSpacing: true, __experimentalDefaultControls: { fontSize: true } }, color: { gradients: true, link: true, __experimentalDefaultControls: { background: true, text: true } }, spacing: { margin: true, padding: true, __experimentalDefaultControls: { margin: false, padding: false } }, __unstablePasteTextInline: true, __experimentalOnMerge: true, __experimentalSlashInserter: true, interactivity: { clientNavigation: true } }, editorStyle: "wp-block-list-editor", style: "wp-block-list" }; const { name: list_name } = list_metadata; const list_settings = { icon: library_list, example: { innerBlocks: [{ name: 'core/list-item', attributes: { content: (0,external_wp_i18n_namespaceObject.__)('Alice.') } }, { name: 'core/list-item', attributes: { content: (0,external_wp_i18n_namespaceObject.__)('The White Rabbit.') } }, {
•
Search:
•
Replace:
1
2
3
4
5
6
7
Function
Edit by line
Download
Information
Rename
Copy
Move
Delete
Chmod
List