File "index.min.js.map"
Full Path: /home/pumpbmko/public_html/wp-content/plugins/gutenberg/build/reusable-blocks/index.min.js.map
File size: 25.85 KB
MIME-type: application/json
Charset: utf-8
{"version":3,"file":"./build/reusable-blocks/index.min.js","mappings":"mBACA,IAAIA,EAAsB,CCA1BA,EAAwB,CAACC,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXF,EAAoBI,EAAEF,EAAYC,KAASH,EAAoBI,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDH,EAAwB,CAACS,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFV,EAAyBC,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,qUCL9D,MAAM,EAA+BC,OAAW,GAAQ,KCAlD,EAA+BA,OAAW,GAAe,YCAzD,EAA+BA,OAAW,GAAU,OCApD,EAA+BA,OAAW,GAAQ,KCiB3CC,EACVC,GACF,EAAIC,eACH,MAAMC,EAAWD,EACfE,OAAQC,EAAAA,OACRC,SAAUL,GACNM,EAAgBL,EACpBE,OAAQ,QACRI,sBACA,WACA,WACAL,EAASM,WAAWC,KAGhBC,GAAYC,EAAAA,EAAAA,OACgB,mBAA1BL,EAAcM,QAClBN,EAAcM,QAASN,GACvBA,EAAcM,SAElBX,EACEY,SAAUT,EAAAA,OACVU,cAAeZ,EAASF,SAAUU,EAAW,EAUpCK,EACZA,CAAEC,EAAWC,EAAOC,IACpBC,OAAUlB,WAAUY,eACnB,MAAMO,EACQ,aAAbF,EACG,CACAG,uBAAwBH,QAExBI,EAEEhB,EAAgB,CACrBW,MAAOA,IAASM,EAAAA,EAAAA,IAAI,0BACpBX,SAASY,EAAAA,EAAAA,WACRvB,EACEE,OAAQC,EAAAA,OACRq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GAAY4D,UACzDrC,EAAAA,EAAAA,IAAI,eAVF,IAeT,EC7De,SAASiH,GAAyB,aAAExE,IAClD,OACCR,EAAAA,EAAAA,KAACiF,EAAAA,0BAAyB,CAAA7E,SACvBA,EAAIK,UAASyE,wBACdzC,EAAAA,EAAAA,MAAAC,EAAAA,SAAA,CAAAtC,SAAA,EACCJ,EAAAA,EAAAA,KAACO,EAA0B,CAC1B/C,UAAY0H,EACZ1E,aAAeA,EACfC,QAAUA,IAEoB,IAA7ByE,EAAkBlG,SACnBgB,EAAAA,EAAAA,KAACmF,EAA0B,CAC1B3I,SAAW0I,EAAmB,SAOrC,E","sources":["webpack://wp/webpack/bootstrap","webpack://wp/webpack/runtime/define property getters","webpack://wp/webpack/runtime/hasOwnProperty shorthand","webpack://wp/webpack/runtime/make namespace object","webpack://wp/external window [\"wp\",\"data\"]","webpack://wp/external window [\"wp\",\"blockEditor\"]","webpack://wp/external window [\"wp\",\"blocks\"]","webpack://wp/external window [\"wp\",\"i18n\"]","../../packages/reusable-blocks/src/store/actions.js","../../packages/reusable-blocks/src/store/reducer.js","../../packages/reusable-blocks/src/store/selectors.js","../../packages/reusable-blocks/src/store/index.js","webpack://wp/external window [\"wp\",\"element\"]","webpack://wp/external window [\"wp\",\"components\"]","webpack://wp/external window [\"wp\",\"primitives\"]","webpack://wp/external window \"ReactJSXRuntime\"","../../packages/icons/src/library/symbol.js","webpack://wp/external window [\"wp\",\"notices\"]","webpack://wp/external window [\"wp\",\"coreData\"]","../../packages/reusable-blocks/src/components/reusable-blocks-menu-items/reusable-block-convert-button.js","webpack://wp/external window [\"wp\",\"url\"]","../../packages/reusable-blocks/src/components/reusable-blocks-menu-items/reusable-blocks-manage-button.js","../../packages/reusable-blocks/src/components/reusable-blocks-menu-items/index.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = window[\"wp\"][\"data\"];","const __WEBPACK_NAMESPACE_OBJECT__ = window[\"wp\"][\"blockEditor\"];","const __WEBPACK_NAMESPACE_OBJECT__ = window[\"wp\"][\"blocks\"];","const __WEBPACK_NAMESPACE_OBJECT__ = window[\"wp\"][\"i18n\"];","/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport {\n\tcreateBlock,\n\tisReusableBlock,\n\tparse,\n\tserialize,\n} from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Returns a generator converting a reusable block into a static block.\n *\n * @param {string} clientId The client ID of the block to attach.\n */\nexport const __experimentalConvertBlockToStatic =\n\t( clientId ) =>\n\t( { registry } ) => {\n\t\tconst oldBlock = registry\n\t\t\t.select( blockEditorStore )\n\t\t\t.getBlock( clientId );\n\t\tconst reusableBlock = registry\n\t\t\t.select( 'core' )\n\t\t\t.getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_block',\n\t\t\t\toldBlock.attributes.ref\n\t\t\t);\n\n\t\tconst newBlocks = parse(\n\t\t\ttypeof reusableBlock.content === 'function'\n\t\t\t\t? reusableBlock.content( reusableBlock )\n\t\t\t\t: reusableBlock.content\n\t\t);\n\t\tregistry\n\t\t\t.dispatch( blockEditorStore )\n\t\t\t.replaceBlocks( oldBlock.clientId, newBlocks );\n\t};\n\n/**\n * Returns a generator converting one or more static blocks into a pattern.\n *\n * @param {string[]} clientIds The client IDs of the block to detach.\n * @param {string} title Pattern title.\n * @param {undefined|'unsynced'} syncType They way block is synced, current undefined (synced) and 'unsynced'.\n */\nexport const __experimentalConvertBlocksToReusable =\n\t( clientIds, title, syncType ) =>\n\tasync ( { registry, dispatch } ) => {\n\t\tconst meta =\n\t\t\tsyncType === 'unsynced'\n\t\t\t\t? {\n\t\t\t\t\t\twp_pattern_sync_status: syncType,\n\t\t\t\t }\n\t\t\t\t: undefined;\n\n\t\tconst reusableBlock = {\n\t\t\ttitle: title || __( 'Untitled pattern block' ),\n\t\t\tcontent: serialize(\n\t\t\t\tregistry\n\t\t\t\t\t.select( blockEditorStore )\n\t\t\t\t\t.getBlocksByClientId( clientIds )\n\t\t\t),\n\t\t\tstatus: 'publish',\n\t\t\tmeta,\n\t\t};\n\n\t\tconst updatedRecord = await registry\n\t\t\t.dispatch( 'core' )\n\t\t\t.saveEntityRecord( 'postType', 'wp_block', reusableBlock );\n\n\t\tif ( syncType === 'unsynced' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst newBlock = createBlock( 'core/block', {\n\t\t\tref: updatedRecord.id,\n\t\t} );\n\t\tregistry\n\t\t\t.dispatch( blockEditorStore )\n\t\t\t.replaceBlocks( clientIds, newBlock );\n\t\tdispatch.__experimentalSetEditingReusableBlock(\n\t\t\tnewBlock.clientId,\n\t\t\ttrue\n\t\t);\n\t};\n\n/**\n * Returns a generator deleting a reusable block.\n *\n * @param {string} id The ID of the reusable block to delete.\n */\nexport const __experimentalDeleteReusableBlock =\n\t( id ) =>\n\tasync ( { registry } ) => {\n\t\tconst reusableBlock = registry\n\t\t\t.select( 'core' )\n\t\t\t.getEditedEntityRecord( 'postType', 'wp_block', id );\n\n\t\t// Don't allow a reusable block with a temporary ID to be deleted.\n\t\tif ( ! reusableBlock ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Remove any other blocks that reference this reusable block.\n\t\tconst allBlocks = registry.select( blockEditorStore ).getBlocks();\n\t\tconst associatedBlocks = allBlocks.filter(\n\t\t\t( block ) => isReusableBlock( block ) && block.attributes.ref === id\n\t\t);\n\t\tconst associatedBlockClientIds = associatedBlocks.map(\n\t\t\t( block ) => block.clientId\n\t\t);\n\n\t\t// Remove the parsed block.\n\t\tif ( associatedBlockClientIds.length ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( blockEditorStore )\n\t\t\t\t.removeBlocks( associatedBlockClientIds );\n\t\t}\n\n\t\tawait registry\n\t\t\t.dispatch( 'core' )\n\t\t\t.deleteEntityRecord( 'postType', 'wp_block', id );\n\t};\n\n/**\n * Returns an action descriptor for SET_EDITING_REUSABLE_BLOCK action.\n *\n * @param {string} clientId The clientID of the reusable block to target.\n * @param {boolean} isEditing Whether the block should be in editing state.\n * @return {Object} Action descriptor.\n */\nexport function __experimentalSetEditingReusableBlock( clientId, isEditing ) {\n\treturn {\n\t\ttype: 'SET_EDITING_REUSABLE_BLOCK',\n\t\tclientId,\n\t\tisEditing,\n\t};\n}\n","/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\nexport function isEditingReusableBlock( state = {}, action ) {\n\tif ( action?.type === 'SET_EDITING_REUSABLE_BLOCK' ) {\n\t\treturn {\n\t\t\t...state,\n\t\t\t[ action.clientId ]: action.isEditing,\n\t\t};\n\t}\n\n\treturn state;\n}\n\nexport default combineReducers( {\n\tisEditingReusableBlock,\n} );\n","/**\n * Returns true if reusable block is in the editing state.\n *\n * @param {Object} state Global application state.\n * @param {number} clientId the clientID of the block.\n * @return {boolean} Whether the reusable block is in the editing state.\n */\nexport function __experimentalIsEditingReusableBlock( state, clientId ) {\n\treturn state.isEditingReusableBlock[ clientId ];\n}\n","/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport * as actions from './actions';\nimport reducer from './reducer';\nimport * as selectors from './selectors';\n\nconst STORE_NAME = 'core/reusable-blocks';\n\n/**\n * Store definition for the reusable blocks namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, {\n\tactions,\n\treducer,\n\tselectors,\n} );\n\nregister( store );\n","const __WEBPACK_NAMESPACE_OBJECT__ = window[\"wp\"][\"element\"];","const __WEBPACK_NAMESPACE_OBJECT__ = window[\"wp\"][\"components\"];","const __WEBPACK_NAMESPACE_OBJECT__ = window[\"wp\"][\"primitives\"];","const __WEBPACK_NAMESPACE_OBJECT__ = window[\"ReactJSXRuntime\"];","/**\n * WordPress dependencies\n */\nimport { SVG, Path } from '@wordpress/primitives';\n\nconst symbol = (\n\t<SVG xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n\t\t<Path d=\"M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z\" />\n\t</SVG>\n);\n\nexport default symbol;\n","const __WEBPACK_NAMESPACE_OBJECT__ = window[\"wp\"][\"notices\"];","const __WEBPACK_NAMESPACE_OBJECT__ = window[\"wp\"][\"coreData\"];","/**\n * WordPress dependencies\n */\nimport { hasBlockSupport, isReusableBlock } from '@wordpress/blocks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useCallback, useState } from '@wordpress/element';\nimport {\n\tMenuItem,\n\tModal,\n\tButton,\n\tTextControl,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tToggleControl,\n} from '@wordpress/components';\nimport { symbol } from '@wordpress/icons';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store } from '../../store';\n\n/**\n * Menu control to convert block(s) to reusable block.\n *\n * @param {Object} props Component props.\n * @param {string[]} props.clientIds Client ids of selected blocks.\n * @param {string} props.rootClientId ID of the currently selected top-level block.\n * @param {()=>void} props.onClose Callback to close the menu.\n * @return {import('react').ComponentType} The menu control or null.\n */\nexport default function ReusableBlockConvertButton( {\n\tclientIds,\n\trootClientId,\n\tonClose,\n} ) {\n\tconst [ syncType, setSyncType ] = useState( undefined );\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst [ title, setTitle ] = useState( '' );\n\tconst canConvert = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canUser } = select( coreStore );\n\t\t\tconst {\n\t\t\t\tgetBlocksByClientId,\n\t\t\t\tcanInsertBlockType,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst rootId =\n\t\t\t\trootClientId ||\n\t\t\t\t( clientIds.length > 0\n\t\t\t\t\t? getBlockRootClientId( clientIds[ 0 ] )\n\t\t\t\t\t: undefined );\n\n\t\t\tconst blocks = getBlocksByClientId( clientIds ) ?? [];\n\n\t\t\tconst isReusable =\n\t\t\t\tblocks.length === 1 &&\n\t\t\t\tblocks[ 0 ] &&\n\t\t\t\tisReusableBlock( blocks[ 0 ] ) &&\n\t\t\t\t!! select( coreStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_block',\n\t\t\t\t\tblocks[ 0 ].attributes.ref\n\t\t\t\t);\n\n\t\t\tconst _canConvert =\n\t\t\t\t// Hide when this is already a reusable block.\n\t\t\t\t! isReusable &&\n\t\t\t\t// Hide when reusable blocks are disabled.\n\t\t\t\tcanInsertBlockType( 'core/block', rootId ) &&\n\t\t\t\tblocks.every(\n\t\t\t\t\t( block ) =>\n\t\t\t\t\t\t// Guard against the case where a regular block has *just* been converted.\n\t\t\t\t\t\t!! block &&\n\t\t\t\t\t\t// Hide on invalid blocks.\n\t\t\t\t\t\tblock.isValid &&\n\t\t\t\t\t\t// Hide when block doesn't support being made reusable.\n\t\t\t\t\t\thasBlockSupport( block.name, 'reusable', true )\n\t\t\t\t) &&\n\t\t\t\t// Hide when current doesn't have permission to do that.\n\t\t\t\t// Blocks refers to the wp_block post type, this checks the ability to create a post of that type.\n\t\t\t\t!! canUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: 'wp_block',\n\t\t\t\t} );\n\n\t\t\treturn _canConvert;\n\t\t},\n\t\t[ clientIds, rootClientId ]\n\t);\n\n\tconst { __experimentalConvertBlocksToReusable: convertBlocksToReusable } =\n\t\tuseDispatch( store );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst onConvert = useCallback(\n\t\tasync function ( reusableBlockTitle ) {\n\t\t\ttry {\n\t\t\t\tawait convertBlocksToReusable(\n\t\t\t\t\tclientIds,\n\t\t\t\t\treusableBlockTitle,\n\t\t\t\t\tsyncType\n\t\t\t\t);\n\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t! syncType\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: the name the user has given to the pattern.\n\t\t\t\t\t\t\t\t__( 'Synced pattern created: %s' ),\n\t\t\t\t\t\t\t\treusableBlockTitle\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: the name the user has given to the pattern.\n\t\t\t\t\t\t\t\t__( 'Unsynced pattern created: %s' ),\n\t\t\t\t\t\t\t\treusableBlockTitle\n\t\t\t\t\t\t ),\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: 'convert-to-reusable-block-success',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} catch ( error ) {\n\t\t\t\tcreateErrorNotice( error.message, {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tid: 'convert-to-reusable-block-error',\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tconvertBlocksToReusable,\n\t\t\tclientIds,\n\t\t\tsyncType,\n\t\t\tcreateSuccessNotice,\n\t\t\tcreateErrorNotice,\n\t\t]\n\t);\n\n\tif ( ! canConvert ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<MenuItem icon={ symbol } onClick={ () => setIsModalOpen( true ) }>\n\t\t\t\t{ __( 'Create pattern' ) }\n\t\t\t</MenuItem>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Create pattern' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\tsetTitle( '' );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName=\"reusable-blocks-menu-items__convert-modal\"\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tonConvert( title );\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\tsetTitle( '' );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<VStack spacing=\"5\">\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\t\t\tplaceholder={ __( 'My pattern' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ _x( 'Synced', 'pattern (singular)' ) }\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Sync this pattern across multiple locations.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tchecked={ ! syncType }\n\t\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\t\tsetSyncType(\n\t\t\t\t\t\t\t\t\t\t! syncType ? 'unsynced' : undefined\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\t\t\t\tsetTitle( '' );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t\t\t<Button variant=\"primary\" type=\"submit\">\n\t\t\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</form>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = window[\"wp\"][\"url\"];","/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { isReusableBlock } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { addQueryArgs } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as reusableBlocksStore } from '../../store';\n\nfunction ReusableBlocksManageButton( { clientId } ) {\n\tconst { canRemove, isVisible, managePatternsUrl } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlock, canRemoveBlock, getBlockCount } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst { canUser } = select( coreStore );\n\t\t\tconst reusableBlock = getBlock( clientId );\n\n\t\t\treturn {\n\t\t\t\tcanRemove: canRemoveBlock( clientId ),\n\t\t\t\tisVisible:\n\t\t\t\t\t!! reusableBlock &&\n\t\t\t\t\tisReusableBlock( reusableBlock ) &&\n\t\t\t\t\t!! canUser( 'update', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: 'wp_block',\n\t\t\t\t\t\tid: reusableBlock.attributes.ref,\n\t\t\t\t\t} ),\n\t\t\t\tinnerBlockCount: getBlockCount( clientId ),\n\t\t\t\t// The site editor and templates both check whether the user\n\t\t\t\t// has edit_theme_options capabilities. We can leverage that here\n\t\t\t\t// and omit the manage patterns link if the user can't access it.\n\t\t\t\tmanagePatternsUrl: canUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: 'wp_template',\n\t\t\t\t} )\n\t\t\t\t\t? addQueryArgs( 'site-editor.php', {\n\t\t\t\t\t\t\tpath: '/patterns',\n\t\t\t\t\t } )\n\t\t\t\t\t: addQueryArgs( 'edit.php', {\n\t\t\t\t\t\t\tpost_type: 'wp_block',\n\t\t\t\t\t } ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst { __experimentalConvertBlockToStatic: convertBlockToStatic } =\n\t\tuseDispatch( reusableBlocksStore );\n\n\tif ( ! isVisible ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<MenuItem href={ managePatternsUrl }>\n\t\t\t\t{ __( 'Manage patterns' ) }\n\t\t\t</MenuItem>\n\t\t\t{ canRemove && (\n\t\t\t\t<MenuItem onClick={ () => convertBlockToStatic( clientId ) }>\n\t\t\t\t\t{ __( 'Detach' ) }\n\t\t\t\t</MenuItem>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ReusableBlocksManageButton;\n","/**\n * WordPress dependencies\n */\nimport { BlockSettingsMenuControls } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ReusableBlockConvertButton from './reusable-block-convert-button';\nimport ReusableBlocksManageButton from './reusable-blocks-manage-button';\n\nexport default function ReusableBlocksMenuItems( { rootClientId } ) {\n\treturn (\n\t\t<BlockSettingsMenuControls>\n\t\t\t{ ( { onClose, selectedClientIds } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<ReusableBlockConvertButton\n\t\t\t\t\t\tclientIds={ selectedClientIds }\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t/>\n\t\t\t\t\t{ selectedClientIds.length === 1 && (\n\t\t\t\t\t\t<ReusableBlocksManageButton\n\t\t\t\t\t\t\tclientId={ selectedClientIds[ 0 ] }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t</BlockSettingsMenuControls>\n\t);\n}\n"],"names":["__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","window","__experimentalConvertBlockToStatic","clientId","registry","oldBlock","select","blockEditorStore","getBlock","reusableBlock","getEditedEntityRecord","attributes","ref","newBlocks","parse","content","dispatch","replaceBlocks","__experimentalConvertBlocksToReusable","clientIds","title","syncType","async","meta","wp_pattern_sync_status","undefined","__","serialize","getBlocksByClientId","status","updatedRecord","saveEntityRecord","newBlock","createBlock","id","__experimentalSetEditingReusableBlock","__experimentalDeleteReusableBlock","associatedBlockClientIds","getBlocks","filter","block","isReusableBlock","map","length","removeBlocks","deleteEntityRecord","isEditing","type","combineReducers","isEditingReusableBlock","state","action","__experimentalIsEditingReusableBlock","store","createReduxStore","actions","reducer","selectors","register","_jsx","SVG","xmlns","viewBox","children","Path","d","ReusableBlockConvertButton","rootClientId","onClose","setSyncType","useState","isModalOpen","setIsModalOpen","setTitle","canConvert","useSelect","_getBlocksByClientId","canUser","coreStore","canInsertBlockType","getBlockRootClientId","rootId","blocks","getEntityRecord","every","isValid","hasBlockSupport","name","kind","convertBlocksToReusable","useDispatch","createSuccessNotice","createErrorNotice","noticesStore","onConvert","useCallback","reusableBlockTitle","sprintf","error","message","_jsxs","_Fragment","MenuItem","icon","symbol","onClick","Modal","onRequestClose","overlayClassName","onSubmit","event","preventDefault","VStack","spacing","TextControl","__nextHasNoMarginBottom","label","onChange","placeholder","ToggleControl","_x","help","checked","HStack","justify","Button","variant","canRemove","isVisible","managePatternsUrl","canRemoveBlock","getBlockCount","innerBlockCount","addQueryArgs","path","post_type","convertBlockToStatic","reusableBlocksStore","href","ReusableBlocksMenuItems","BlockSettingsMenuControls","selectedClientIds","ReusableBlocksManageButton"],"sourceRoot":""}