: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* @return {Object} Merged attributes.
const getMergedAttributesWithPreview = (currentAttributes, preview, title, isResponsive) => {
...getAttributesFromPreview(preview, title, className, isResponsive, allowResponsive)
;// CONCATENATED MODULE: external ["wp","compose"]
const external_wp_compose_namespaceObject = window["wp"]["compose"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/utils/hooks.js
* Returns whether the current user can edit the given entity.
* @param {string} kind Entity kind.
* @param {string} name Entity name.
* @param {string} recordId Record's id.
function useCanEditEntity(kind, name, recordId) {
return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).canUserEditEntityRecord(kind, name, recordId), [kind, name, recordId]);
* Handles uploading a media file from a blob URL on mount.
* @param {Object} args Upload media arguments.
* @param {string} args.url Blob URL.
* @param {?Array} args.allowedTypes Array of allowed media types.
* @param {Function} args.onChange Function called when the media is uploaded.
* @param {Function} args.onError Function called when an error happens.
function useUploadMediaFromBlobURL(args = {}) {
const latestArgs = (0,external_wp_element_namespaceObject.useRef)(args);
const hasUploadStarted = (0,external_wp_element_namespaceObject.useRef)(false);
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
latestArgs.current = args;
(0,external_wp_element_namespaceObject.useEffect)(() => {
// Uploading is a special effect that can't be canceled via the cleanup method.
// The extra check avoids duplicate uploads in development mode (React.StrictMode).
if (hasUploadStarted.current) {
if (!latestArgs.current.url || !(0,external_wp_blob_namespaceObject.isBlobURL)(latestArgs.current.url)) {
const file = (0,external_wp_blob_namespaceObject.getBlobByURL)(latestArgs.current.url);
hasUploadStarted.current = true;
onFileChange: ([media]) => {
if ((0,external_wp_blob_namespaceObject.isBlobURL)(media?.url)) {
(0,external_wp_blob_namespaceObject.revokeBlobURL)(url);
hasUploadStarted.current = false;
(0,external_wp_blob_namespaceObject.revokeBlobURL)(url);
hasUploadStarted.current = false;
function useToolsPanelDropdownMenuProps() {
const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
// For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/caption.js
const caption = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
d: "M6 5.5h12a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H6a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5ZM4 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6Zm4 10h2v-1.5H8V16Zm5 0h-2v-1.5h2V16Zm1 0h2v-1.5h-2V16Z"
/* harmony default export */ const library_caption = (caption);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/utils/caption.js
attributeKey = 'caption',
placeholder = (0,external_wp_i18n_namespaceObject.__)('Add caption'),
label = (0,external_wp_i18n_namespaceObject.__)('Caption text'),
showToolbarButton = true,
addLabel = (0,external_wp_i18n_namespaceObject.__)('Add caption'),
removeLabel = (0,external_wp_i18n_namespaceObject.__)('Remove caption'),
const caption = attributes[attributeKey];
const prevCaption = (0,external_wp_compose_namespaceObject.usePrevious)(caption);
PrivateRichText: RichText
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
const isCaptionEmpty = RichText.isEmpty(caption);
const isPrevCaptionEmpty = RichText.isEmpty(prevCaption);
const [showCaption, setShowCaption] = (0,external_wp_element_namespaceObject.useState)(!isCaptionEmpty);
// We need to show the caption when changes come from
// history navigation(undo/redo).
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!isCaptionEmpty && isPrevCaptionEmpty) {
}, [isCaptionEmpty, isPrevCaptionEmpty]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!isSelected && isCaptionEmpty) {
}, [isSelected, isCaptionEmpty]);
// Focus the caption when we click to add one.
const ref = (0,external_wp_element_namespaceObject.useCallback)(node => {
if (node && isCaptionEmpty) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [showToolbarButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, {
setShowCaption(!showCaption);
if (showCaption && caption) {
[attributeKey]: undefined
label: showCaption ? removeLabel : addLabel
}), showCaption && (!RichText.isEmpty(caption) || isSelected) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(RichText, {
identifier: attributeKey,
className: dist_clsx(className, excludeElementClassName ? '' : (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('caption')),
placeholder: placeholder,
onChange: value => setAttributes({
__unstableOnSplitAtEnd: () => insertBlocksAfter((0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)())),
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/audio/edit.js
const ALLOWED_MEDIA_TYPES = ['audio'];
isSelected: isSingleSelected,
const isTemporaryAudio = !id && (0,external_wp_blob_namespaceObject.isBlobURL)(src);
useUploadMediaFromBlobURL({
allowedTypes: ALLOWED_MEDIA_TYPES,
function toggleAttribute(attribute) {
function onSelectURL(newSrc) {
// Set the block's src from the edit component's state, and switch off
// Check if there's an embed block that handles this URL.
const embedBlock = createUpgradedEmbedBlock({
if (undefined !== embedBlock && onReplace) {
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
function onUploadError(message) {
createErrorNotice(message, {
function getAutoplayHelp(checked) {
return checked ? (0,external_wp_i18n_namespaceObject.__)('Autoplay may cause usability issues for some users.') : null;
function onSelectAudio(media) {
if (!media || !media.url) {
// In this case there was an error and we should continue in the editing state
// previous attributes should be removed because they may be temporary blob urls.
// Sets the block's attribute and updates the edit component from the
// selected media, then switches off the editing UI.
const classes = dist_clsx(className, {
'is-transient': isTemporaryAudio
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.MediaPlaceholder, {
icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, {
onSelectURL: onSelectURL,
allowedTypes: ALLOWED_MEDIA_TYPES,
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [isSingleSelected && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.MediaReplaceFlow, {
allowedTypes: ALLOWED_MEDIA_TYPES,
onSelectURL: onSelectURL,
}), /*#__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.__)('Autoplay'),
onChange: toggleAttribute('autoplay'),
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Loop'),
onChange: toggleAttribute('loop'),
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject._x)('Preload', 'noun; Audio block parameter'),
// `undefined` is required for the preload attribute to be unset.
onChange: value => setAttributes({
preload: value || undefined
label: (0,external_wp_i18n_namespaceObject.__)('Browser default')
label: (0,external_wp_i18n_namespaceObject.__)('Auto')
label: (0,external_wp_i18n_namespaceObject.__)('Metadata')
label: (0,external_wp_i18n_namespaceObject._x)('None', 'Preload value')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("figure", {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Disabled, {
isDisabled: !isSingleSelected,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("audio", {
}), isTemporaryAudio && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Caption, {
setAttributes: setAttributes,
isSelected: isSingleSelected,
insertBlocksAfter: insertBlocksAfter,
label: (0,external_wp_i18n_namespaceObject.__)('Audio caption text'),
showToolbarButton: isSingleSelected
/* harmony default export */ const edit = (AudioEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/audio/save.js
return src && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("figure", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save(),
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("audio", {
}), !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')
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/audio/transforms.js
return files.length === 1 && files[0].type.indexOf('audio/') === 0;
// We don't need to upload the media directly here
// It's already done as part of the `componentDidMount`
const block = (0,external_wp_blocks_namespaceObject.createBlock)('core/audio', {
src: (0,external_wp_blob_namespaceObject.createBlobURL)(file)