{
  "version": 3,
  "sources": ["../../src/api/registration.ts"],
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { select, dispatch } from '@wordpress/data';\nimport { _x } from '@wordpress/i18n';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport i18nBlockSchema from './i18n-block.json';\nimport { store as blocksStore } from '../store';\nimport { unlock } from '../lock-unlock';\nimport type {\n\tBlockType,\n\tBlock,\n\tBlockVariation,\n\tBlockVariationScope,\n\tBlockStyle,\n\tBlockBindingsSource,\n\tIcon,\n} from '../types';\n\nfunction isObject( object: unknown ): object is Record< string, unknown > {\n\treturn object !== null && typeof object === 'object';\n}\n\n/**\n * Sets the server side block definition of blocks.\n *\n * Ignored from documentation due to being marked as unstable.\n *\n * @ignore\n *\n * @param definitions Server-side block definitions\n */\n// eslint-disable-next-line camelcase\nexport function unstable__bootstrapServerSideBlockDefinitions(\n\tdefinitions: Record< string, Record< string, unknown > >\n): void {\n\tconst { addBootstrappedBlockType } = unlock( dispatch( blocksStore ) );\n\tfor ( const [ name, blockType ] of Object.entries( definitions ) ) {\n\t\taddBootstrappedBlockType( name, blockType );\n\t}\n}\n\n/**\n * Gets block settings from metadata loaded from `block.json` file\n *\n * @param metadata            Block metadata loaded from `block.json`.\n * @param metadata.textdomain Textdomain to use with translations.\n *\n * @return Block settings.\n */\nfunction getBlockSettingsFromMetadata( {\n\ttextdomain,\n\t...metadata\n}: Record< string, unknown > & { textdomain?: string } ) {\n\tconst allowedFields = [\n\t\t'apiVersion',\n\t\t'title',\n\t\t'category',\n\t\t'parent',\n\t\t'ancestor',\n\t\t'icon',\n\t\t'description',\n\t\t'keywords',\n\t\t'attributes',\n\t\t'providesContext',\n\t\t'usesContext',\n\t\t'selectors',\n\t\t'supports',\n\t\t'styles',\n\t\t'example',\n\t\t'variations',\n\t\t'blockHooks',\n\t\t'allowedBlocks',\n\t];\n\n\tconst settings = Object.fromEntries(\n\t\tObject.entries( metadata ).filter( ( [ key ] ) =>\n\t\t\tallowedFields.includes( key )\n\t\t)\n\t);\n\n\tif ( textdomain ) {\n\t\tObject.keys( i18nBlockSchema ).forEach( ( key ) => {\n\t\t\tif ( ! settings[ key ] ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsettings[ key ] = translateBlockSettingUsingI18nSchema(\n\t\t\t\t( i18nBlockSchema as Record< string, unknown > )[ key ],\n\t\t\t\tsettings[ key ],\n\t\t\t\ttextdomain\n\t\t\t);\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * Registers a new block provided a unique name and an object defining its\n * behavior. Once registered, the block is made available as an option to any\n * editor interface where blocks are implemented.\n *\n * For more in-depth information on registering a custom block see the\n * [Create a block tutorial](https://developer.wordpress.org/block-editor/getting-started/create-block/).\n *\n * @param blockNameOrMetadata Block type name or its metadata.\n * @param settings            Block settings.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { registerBlockType } from '@wordpress/blocks'\n *\n * registerBlockType( 'namespace/block-name', {\n *     title: __( 'My First Block' ),\n *     edit: () => <div>{ __( 'Hello from the editor!' ) }</div>,\n *     save: () => <div>Hello from the saved content!</div>,\n * } );\n * ```\n *\n * @return The block, if it has been successfully registered;\n *         otherwise `undefined`.\n */\nexport function registerBlockType(\n\tblockNameOrMetadata: string | Record< string, unknown >,\n\tsettings: Partial< BlockType >\n): BlockType | undefined {\n\tconst name = isObject( blockNameOrMetadata )\n\t\t? blockNameOrMetadata.name\n\t\t: blockNameOrMetadata;\n\n\tif ( typeof name !== 'string' ) {\n\t\twarning( 'Block names must be strings.' );\n\t\treturn;\n\t}\n\n\tif ( ! /^[a-z][a-z0-9-]*\\/[a-z][a-z0-9-]*$/.test( name ) ) {\n\t\twarning(\n\t\t\t'Block names must contain a namespace prefix, include only lowercase alphanumeric characters or dashes, and start with a letter. Example: my-plugin/my-custom-block'\n\t\t);\n\t\treturn;\n\t}\n\tif ( select( blocksStore ).getBlockType( name ) ) {\n\t\twarning( 'Block \"' + name + '\" is already registered.' );\n\t\treturn;\n\t}\n\n\tconst { addBootstrappedBlockType, addUnprocessedBlockType } = unlock(\n\t\tdispatch( blocksStore )\n\t);\n\n\tif ( isObject( blockNameOrMetadata ) ) {\n\t\tconst metadata = getBlockSettingsFromMetadata( blockNameOrMetadata );\n\t\taddBootstrappedBlockType( name, metadata );\n\t}\n\n\taddUnprocessedBlockType( name, settings );\n\n\treturn select( blocksStore ).getBlockType( name );\n}\n\n/**\n * Translates block settings provided with metadata using the i18n schema.\n *\n * @param i18nSchema   I18n schema for the block setting.\n * @param settingValue Value for the block setting.\n * @param textdomain   Textdomain to use with translations.\n *\n * @return Translated setting.\n */\nfunction translateBlockSettingUsingI18nSchema(\n\ti18nSchema: unknown,\n\tsettingValue: unknown,\n\ttextdomain: string\n): unknown {\n\tif ( typeof i18nSchema === 'string' && typeof settingValue === 'string' ) {\n\t\t// eslint-disable-next-line @wordpress/i18n-no-variables, @wordpress/i18n-text-domain\n\t\treturn _x( settingValue, i18nSchema, textdomain );\n\t}\n\tif (\n\t\tArray.isArray( i18nSchema ) &&\n\t\ti18nSchema.length &&\n\t\tArray.isArray( settingValue )\n\t) {\n\t\treturn settingValue.map( ( value ) =>\n\t\t\ttranslateBlockSettingUsingI18nSchema(\n\t\t\t\ti18nSchema[ 0 ],\n\t\t\t\tvalue,\n\t\t\t\ttextdomain\n\t\t\t)\n\t\t);\n\t}\n\tif (\n\t\tisObject( i18nSchema ) &&\n\t\tObject.entries( i18nSchema ).length &&\n\t\tisObject( settingValue )\n\t) {\n\t\treturn Object.keys( settingValue ).reduce(\n\t\t\t( accumulator: Record< string, unknown >, key ) => {\n\t\t\t\tif ( ! ( i18nSchema as Record< string, unknown > )[ key ] ) {\n\t\t\t\t\taccumulator[ key ] = settingValue[ key ];\n\t\t\t\t\treturn accumulator;\n\t\t\t\t}\n\t\t\t\taccumulator[ key ] = translateBlockSettingUsingI18nSchema(\n\t\t\t\t\t( i18nSchema as Record< string, unknown > )[ key ],\n\t\t\t\t\tsettingValue[ key ],\n\t\t\t\t\ttextdomain\n\t\t\t\t);\n\t\t\t\treturn accumulator;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\t}\n\treturn settingValue;\n}\n\n/**\n * Registers a new block collection to group blocks in the same namespace in the inserter.\n *\n * @param namespace      The namespace to group blocks by in the inserter; corresponds to the block namespace.\n * @param settings       The block collection settings.\n * @param settings.title The title to display in the block inserter.\n * @param settings.icon  The icon to display in the block inserter.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { registerBlockCollection, registerBlockType } from '@wordpress/blocks';\n *\n * // Register the collection.\n * registerBlockCollection( 'my-collection', {\n *     title: __( 'Custom Collection' ),\n * } );\n *\n * // Register a block in the same namespace to add it to the collection.\n * registerBlockType( 'my-collection/block-name', {\n *     title: __( 'My First Block' ),\n *     edit: () => <div>{ __( 'Hello from the editor!' ) }</div>,\n *     save: () => <div>'Hello from the saved content!</div>,\n * } );\n * ```\n */\nexport function registerBlockCollection(\n\tnamespace: string,\n\t{ title, icon }: { title: string; icon?: Icon }\n): void {\n\tdispatch( blocksStore ).addBlockCollection( namespace, title, icon );\n}\n\n/**\n * Unregisters a block collection\n *\n * @param namespace The namespace to group blocks by in the inserter; corresponds to the block namespace\n *\n * @example\n * ```js\n * import { unregisterBlockCollection } from '@wordpress/blocks';\n *\n * unregisterBlockCollection( 'my-collection' );\n * ```\n */\nexport function unregisterBlockCollection( namespace: string ): void {\n\tdispatch( blocksStore ).removeBlockCollection( namespace );\n}\n\n/**\n * Unregisters a block.\n *\n * @param name Block name.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { unregisterBlockType } from '@wordpress/blocks';\n *\n * const ExampleComponent = () => {\n *     return (\n *         <Button\n *             onClick={ () =>\n *                 unregisterBlockType( 'my-collection/block-name' )\n *             }\n *         >\n *             { __( 'Unregister my custom block.' ) }\n *         </Button>\n *     );\n * };\n * ```\n *\n * @return The previous block value, if it has been successfully\n *         unregistered; otherwise `undefined`.\n */\nexport function unregisterBlockType( name: string ): BlockType | undefined {\n\tconst oldBlock = select( blocksStore ).getBlockType( name );\n\tif ( ! oldBlock ) {\n\t\twarning( 'Block \"' + name + '\" is not registered.' );\n\t\treturn;\n\t}\n\tdispatch( blocksStore ).removeBlockTypes( name );\n\treturn oldBlock;\n}\n\n/**\n * Assigns name of block for handling non-block content.\n *\n * @param blockName Block name.\n */\nexport function setFreeformContentHandlerName( blockName: string ): void {\n\tdispatch( blocksStore ).setFreeformFallbackBlockName( blockName );\n}\n\n/**\n * Retrieves name of block handling non-block content, or undefined if no\n * handler has been defined.\n *\n * @return Block name.\n */\nexport function getFreeformContentHandlerName(): string | null {\n\treturn select( blocksStore ).getFreeformFallbackBlockName();\n}\n\n/**\n * Retrieves name of block used for handling grouping interactions.\n *\n * @return Block name.\n */\nexport function getGroupingBlockName(): string | null {\n\treturn select( blocksStore ).getGroupingBlockName();\n}\n\n/**\n * Assigns name of block handling unregistered block types.\n *\n * @param blockName Block name.\n */\nexport function setUnregisteredTypeHandlerName( blockName: string ): void {\n\tdispatch( blocksStore ).setUnregisteredFallbackBlockName( blockName );\n}\n\n/**\n * Retrieves name of block handling unregistered block types, or undefined if no\n * handler has been defined.\n *\n * @return Block name.\n */\nexport function getUnregisteredTypeHandlerName(): string | null {\n\treturn select( blocksStore ).getUnregisteredFallbackBlockName();\n}\n\n/**\n * Assigns the default block name.\n *\n * @param name Block name.\n *\n * @example\n * ```js\n * import { setDefaultBlockName } from '@wordpress/blocks';\n *\n * const ExampleComponent = () => {\n *\n *     return (\n *         <Button onClick={ () => setDefaultBlockName( 'core/heading' ) }>\n *             { __( 'Set the default block to Heading' ) }\n *         </Button>\n *     );\n * };\n * ```\n */\nexport function setDefaultBlockName( name: string ): void {\n\tdispatch( blocksStore ).setDefaultBlockName( name );\n}\n\n/**\n * Assigns name of block for handling block grouping interactions.\n *\n * This function lets you select a different block to group other blocks in instead of the\n * default `core/group` block. This function must be used in a component or when the DOM is fully\n * loaded. See https://developer.wordpress.org/block-editor/reference-guides/packages/packages-dom-ready/\n *\n * @param name Block name.\n *\n * @example\n * ```js\n * import { setGroupingBlockName } from '@wordpress/blocks';\n *\n * const ExampleComponent = () => {\n *\n *     return (\n *         <Button onClick={ () => setGroupingBlockName( 'core/columns' ) }>\n *             { __( 'Wrap in columns' ) }\n *         </Button>\n *     );\n * };\n * ```\n */\nexport function setGroupingBlockName( name: string ): void {\n\tdispatch( blocksStore ).setGroupingBlockName( name );\n}\n\n/**\n * Retrieves the default block name.\n *\n * @return Block name.\n */\nexport function getDefaultBlockName(): string | null {\n\treturn select( blocksStore ).getDefaultBlockName();\n}\n\n/**\n * Returns a registered block type.\n *\n * @param name Block name.\n *\n * @return Block type.\n */\nexport function getBlockType( name: string ): BlockType | undefined {\n\treturn select( blocksStore )?.getBlockType( name );\n}\n\n/**\n * Returns all registered blocks.\n *\n * @return Block settings.\n */\nexport function getBlockTypes(): BlockType[] {\n\treturn select( blocksStore ).getBlockTypes();\n}\n\n/**\n * Returns the block support value for a feature, if defined.\n *\n * @param nameOrType      Block name or type object\n * @param feature         Feature to retrieve\n * @param defaultSupports Default value to return if not\n *                        explicitly defined\n *\n * @return Block support value\n */\nexport function getBlockSupport(\n\tnameOrType: string | BlockType,\n\tfeature: string,\n\tdefaultSupports?: unknown\n): unknown {\n\treturn select( blocksStore ).getBlockSupport(\n\t\tnameOrType,\n\t\tfeature,\n\t\tdefaultSupports\n\t);\n}\n\n/**\n * Returns true if the block defines support for a feature, or false otherwise.\n *\n * @param nameOrType      Block name or type object.\n * @param feature         Feature to test.\n * @param defaultSupports Whether feature is supported by\n *                        default if not explicitly defined.\n *\n * @return Whether block supports feature.\n */\nexport function hasBlockSupport(\n\tnameOrType: string | BlockType,\n\tfeature: string,\n\tdefaultSupports?: boolean\n): boolean {\n\treturn select( blocksStore ).hasBlockSupport(\n\t\tnameOrType,\n\t\tfeature,\n\t\tdefaultSupports\n\t);\n}\n\n/**\n * Determines whether or not the given block is a reusable block. This is a\n * special block type that is used to point to a global block stored via the\n * API.\n *\n * @param blockOrType Block or Block Type to test.\n *\n * @return Whether the given block is a reusable block.\n */\nexport function isReusableBlock(\n\tblockOrType: Block | BlockType | null | undefined\n): boolean {\n\treturn blockOrType?.name === 'core/block';\n}\n\n/**\n * Determines whether or not the given block is a template part. This is a\n * special block type that allows composing a page template out of reusable\n * design elements.\n *\n * @param blockOrType Block or Block Type to test.\n *\n * @return Whether the given block is a template part.\n */\nexport function isTemplatePart(\n\tblockOrType: Block | BlockType | null | undefined\n): boolean {\n\treturn blockOrType?.name === 'core/template-part';\n}\n\n/**\n * Returns an array with the child blocks of a given block.\n *\n * @param blockName Name of block (example: \u201Clatest-posts\u201D).\n *\n * @return Array of child block names.\n */\nexport const getChildBlockNames = ( blockName: string ): string[] => {\n\treturn select( blocksStore ).getChildBlockNames( blockName );\n};\n\n/**\n * Returns a boolean indicating if a block has child blocks or not.\n *\n * @param blockName Name of block (example: \u201Clatest-posts\u201D).\n *\n * @return True if a block contains child blocks and false otherwise.\n */\nexport const hasChildBlocks = ( blockName: string ): boolean => {\n\treturn select( blocksStore ).hasChildBlocks( blockName );\n};\n\n/**\n * Returns a boolean indicating if a block has at least one child block with inserter support.\n *\n * @param blockName Block type name.\n *\n * @return True if a block contains at least one child blocks with inserter support\n *         and false otherwise.\n */\nexport const hasChildBlocksWithInserterSupport = (\n\tblockName: string\n): boolean => {\n\treturn select( blocksStore ).hasChildBlocksWithInserterSupport( blockName );\n};\n\n/**\n * Registers a new block style for the given block types.\n *\n * For more information on connecting the styles with CSS\n * [the official documentation](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-styles/#styles).\n *\n * @param blockNames     Name of blocks e.g. \u201Ccore/latest-posts\u201D or `[\u201Ccore/group\u201D, \u201Ccore/columns\u201D]`.\n * @param styleVariation Object containing `name` which is the class name applied to the block and `label` which identifies the variation to the user.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { registerBlockStyle } from '@wordpress/blocks';\n * import { Button } from '@wordpress/components';\n *\n *\n * const ExampleComponent = () => {\n *     return (\n *         <Button\n *             onClick={ () => {\n *                 registerBlockStyle( 'core/quote', {\n *                     name: 'fancy-quote',\n *                     label: __( 'Fancy Quote' ),\n *                 } );\n *             } }\n *         >\n *             { __( 'Add a new block style for core/quote' ) }\n *         </Button>\n *     );\n * };\n * ```\n */\nexport const registerBlockStyle = (\n\tblockNames: string | string[],\n\tstyleVariation: BlockStyle | BlockStyle[]\n): void => {\n\tdispatch( blocksStore ).addBlockStyles( blockNames, styleVariation );\n};\n\n/**\n * Unregisters a block style for the given block.\n *\n * @param blockName          Name of block (example: \u201Ccore/latest-posts\u201D).\n * @param styleVariationName Name of class applied to the block.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { unregisterBlockStyle } from '@wordpress/blocks';\n * import { Button } from '@wordpress/components';\n *\n * const ExampleComponent = () => {\n *     return (\n *     <Button\n *         onClick={ () => {\n *             unregisterBlockStyle( 'core/quote', 'plain' );\n *         } }\n *     >\n *         { __( 'Remove the \"Plain\" block style for core/quote' ) }\n *     </Button>\n *     );\n * };\n * ```\n */\nexport const unregisterBlockStyle = (\n\tblockName: string,\n\tstyleVariationName: string\n): void => {\n\tdispatch( blocksStore ).removeBlockStyles( blockName, styleVariationName );\n};\n\n/**\n * Returns an array with the variations of a given block type.\n * Ignored from documentation as the recommended usage is via useSelect from @wordpress/data.\n *\n * @ignore\n *\n * @param blockName Name of block (example: \u201Ccore/columns\u201D).\n * @param scope     Block variation scope name.\n *\n * @return Block variations.\n */\nexport const getBlockVariations = (\n\tblockName: string,\n\tscope?: BlockVariationScope\n): BlockVariation[] | void => {\n\treturn select( blocksStore ).getBlockVariations( blockName, scope );\n};\n\n/**\n * Registers a new block variation for the given block type.\n *\n * For more information on block variations see\n * [the official documentation ](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-variations/).\n *\n * @param blockName Name of the block (example: \u201Ccore/columns\u201D).\n * @param variation Object describing a block variation.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { registerBlockVariation } from '@wordpress/blocks';\n * import { Button } from '@wordpress/components';\n *\n * const ExampleComponent = () => {\n *     return (\n *         <Button\n *             onClick={ () => {\n *                 registerBlockVariation( 'core/embed', {\n *                     name: 'custom',\n *                     title: __( 'My Custom Embed' ),\n *                     attributes: { providerNameSlug: 'custom' },\n *                 } );\n *             } }\n *          >\n *              __( 'Add a custom variation for core/embed' ) }\n *         </Button>\n *     );\n * };\n * ```\n */\nexport const registerBlockVariation = (\n\tblockName: string,\n\tvariation: BlockVariation\n): void => {\n\tif ( typeof variation.name !== 'string' ) {\n\t\twarning( 'Variation names must be unique strings.' );\n\t}\n\n\tdispatch( blocksStore ).addBlockVariations( blockName, variation );\n};\n\n/**\n * Unregisters a block variation defined for the given block type.\n *\n * @param blockName     Name of the block (example: \u201Ccore/columns\u201D).\n * @param variationName Name of the variation defined for the block.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { unregisterBlockVariation } from '@wordpress/blocks';\n * import { Button } from '@wordpress/components';\n *\n * const ExampleComponent = () => {\n *     return (\n *         <Button\n *             onClick={ () => {\n *                 unregisterBlockVariation( 'core/embed', 'youtube' );\n *             } }\n *         >\n *             { __( 'Remove the YouTube variation from core/embed' ) }\n *         </Button>\n *     );\n * };\n * ```\n */\nexport const unregisterBlockVariation = (\n\tblockName: string,\n\tvariationName: string\n): void => {\n\tdispatch( blocksStore ).removeBlockVariations( blockName, variationName );\n};\n\n/**\n * Registers a new block bindings source with an object defining its\n * behavior. Once registered, the source is available to be connected\n * to the supported block attributes.\n *\n * @since 6.7.0 Introduced in WordPress core.\n *\n * @param source Object describing a block bindings source.\n *\n * @example\n * ```js\n * import { _x } from '@wordpress/i18n';\n * import { registerBlockBindingsSource } from '@wordpress/blocks'\n *\n * registerBlockBindingsSource( {\n *     name: 'plugin/my-custom-source',\n *     label: _x( 'My Custom Source', 'block bindings source' ),\n *     usesContext: [ 'postType' ],\n *     getValues: getSourceValues,\n *     setValues: updateMyCustomValuesInBatch,\n *     canUserEditValue: () => true,\n * } );\n * ```\n */\nexport const registerBlockBindingsSource = (\n\tsource: BlockBindingsSource\n): void => {\n\tconst {\n\t\tname,\n\t\tlabel,\n\t\tusesContext,\n\t\tgetValues,\n\t\tsetValues,\n\t\tcanUserEditValue,\n\t\tgetFieldsList,\n\t} = source;\n\n\tconst existingSource = unlock(\n\t\tselect( blocksStore )\n\t).getBlockBindingsSource( name );\n\n\t/*\n\t * Check if the source has been already registered on the client.\n\t * If any property expected to be \"client-only\" is defined, return a warning.\n\t */\n\tconst serverProps = [ 'label', 'usesContext' ];\n\tfor ( const prop in existingSource ) {\n\t\tif ( ! serverProps.includes( prop ) && existingSource[ prop ] ) {\n\t\t\twarning(\n\t\t\t\t'Block bindings source \"' + name + '\" is already registered.'\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\t}\n\n\t// Check the `name` property is correct.\n\tif ( ! name ) {\n\t\twarning( 'Block bindings source must contain a name.' );\n\t\treturn;\n\t}\n\n\tif ( typeof name !== 'string' ) {\n\t\twarning( 'Block bindings source name must be a string.' );\n\t\treturn;\n\t}\n\n\tif ( /[A-Z]+/.test( name ) ) {\n\t\twarning(\n\t\t\t'Block bindings source name must not contain uppercase characters.'\n\t\t);\n\t\treturn;\n\t}\n\n\tif ( ! /^[a-z0-9/-]+$/.test( name ) ) {\n\t\twarning(\n\t\t\t'Block bindings source name must contain only valid characters: lowercase characters, hyphens, or digits. Example: my-plugin/my-custom-source.'\n\t\t);\n\t\treturn;\n\t}\n\n\tif ( ! /^[a-z0-9-]+\\/[a-z0-9-]+$/.test( name ) ) {\n\t\twarning(\n\t\t\t'Block bindings source name must contain a namespace and valid characters. Example: my-plugin/my-custom-source.'\n\t\t);\n\t\treturn;\n\t}\n\n\t// Check the `label` property is correct.\n\n\tif ( ! label && ! existingSource?.label ) {\n\t\twarning( 'Block bindings source must contain a label.' );\n\t\treturn;\n\t}\n\n\tif ( label && typeof label !== 'string' ) {\n\t\twarning( 'Block bindings source label must be a string.' );\n\t\treturn;\n\t}\n\n\tif ( label && existingSource?.label && label !== existingSource?.label ) {\n\t\twarning( 'Block bindings \"' + name + '\" source label was overridden.' );\n\t}\n\n\t// Check the `usesContext` property is correct.\n\tif ( usesContext && ! Array.isArray( usesContext ) ) {\n\t\twarning( 'Block bindings source usesContext must be an array.' );\n\t\treturn;\n\t}\n\n\t// Check the `getValues` property is correct.\n\tif ( getValues && typeof getValues !== 'function' ) {\n\t\twarning( 'Block bindings source getValues must be a function.' );\n\t\treturn;\n\t}\n\n\t// Check the `setValues` property is correct.\n\tif ( setValues && typeof setValues !== 'function' ) {\n\t\twarning( 'Block bindings source setValues must be a function.' );\n\t\treturn;\n\t}\n\n\t// Check the `canUserEditValue` property is correct.\n\tif ( canUserEditValue && typeof canUserEditValue !== 'function' ) {\n\t\twarning( 'Block bindings source canUserEditValue must be a function.' );\n\t\treturn;\n\t}\n\n\t// Check the `getFieldsList` property is correct.\n\tif ( getFieldsList && typeof getFieldsList !== 'function' ) {\n\t\twarning( 'Block bindings source getFieldsList must be a function.' );\n\t\treturn;\n\t}\n\n\treturn unlock( dispatch( blocksStore ) ).addBlockBindingsSource( source );\n};\n\n/**\n * Unregisters a block bindings source by providing its name.\n *\n * @since 6.7.0 Introduced in WordPress core.\n *\n * @param name The name of the block bindings source to unregister.\n *\n * @example\n * ```js\n * import { unregisterBlockBindingsSource } from '@wordpress/blocks';\n *\n * unregisterBlockBindingsSource( 'plugin/my-custom-source' );\n * ```\n */\nexport function unregisterBlockBindingsSource( name: string ): void {\n\tconst oldSource = getBlockBindingsSource( name );\n\tif ( ! oldSource ) {\n\t\twarning( 'Block bindings source \"' + name + '\" is not registered.' );\n\t\treturn;\n\t}\n\tunlock( dispatch( blocksStore ) ).removeBlockBindingsSource( name );\n}\n\n/**\n * Returns a registered block bindings source by its name.\n *\n * @since 6.7.0 Introduced in WordPress core.\n *\n * @param name Block bindings source name.\n *\n * @return Block bindings source.\n */\nexport function getBlockBindingsSource(\n\tname: string\n): BlockBindingsSource | undefined {\n\treturn unlock( select( blocksStore ) ).getBlockBindingsSource( name );\n}\n\n/**\n * Returns all registered block bindings sources.\n *\n * @since 6.7.0 Introduced in WordPress core.\n *\n * @return Block bindings sources.\n */\nexport function getBlockBindingsSources(): Record<\n\tstring,\n\tBlockBindingsSource\n> {\n\treturn unlock( select( blocksStore ) ).getAllBlockBindingsSources();\n}\n"],
  "mappings": ";AAGA,SAAS,QAAQ,gBAAgB;AACjC,SAAS,UAAU;AACnB,OAAO,aAAa;AAKpB,OAAO,qBAAqB;AAC5B,SAAS,SAAS,mBAAmB;AACrC,SAAS,cAAc;AAWvB,SAAS,SAAU,QAAuD;AACzE,SAAO,WAAW,QAAQ,OAAO,WAAW;AAC7C;AAYO,SAAS,8CACf,aACO;AACP,QAAM,EAAE,yBAAyB,IAAI,OAAQ,SAAU,WAAY,CAAE;AACrE,aAAY,CAAE,MAAM,SAAU,KAAK,OAAO,QAAS,WAAY,GAAI;AAClE,6BAA0B,MAAM,SAAU;AAAA,EAC3C;AACD;AAUA,SAAS,6BAA8B;AAAA,EACtC;AAAA,EACA,GAAG;AACJ,GAAyD;AACxD,QAAM,gBAAgB;AAAA,IACrB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,QAAM,WAAW,OAAO;AAAA,IACvB,OAAO,QAAS,QAAS,EAAE;AAAA,MAAQ,CAAE,CAAE,GAAI,MAC1C,cAAc,SAAU,GAAI;AAAA,IAC7B;AAAA,EACD;AAEA,MAAK,YAAa;AACjB,WAAO,KAAM,eAAgB,EAAE,QAAS,CAAE,QAAS;AAClD,UAAK,CAAE,SAAU,GAAI,GAAI;AACxB;AAAA,MACD;AACA,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