{
  "version": 3,
  "sources": ["../../../src/components/post-card-panel/index.js"],
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalText as Text,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { close } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../../store/constants';\nimport { unlock } from '../../lock-unlock';\nimport PostActions from '../post-actions';\nimport usePageTypeBadge from '../../utils/pageTypeBadge';\nimport { getTemplateInfo } from '../../utils/get-template-info';\nconst { Badge } = unlock( componentsPrivateApis );\n\n/**\n * Renders a title of the post type and the available quick actions available within a 3-dot dropdown.\n *\n * @param {Object}          props                     - Component props.\n * @param {string}          [props.postType]          - The post type string.\n * @param {string|string[]} [props.postId]            - The post id or list of post ids.\n * @param {boolean}         [props.hideActions]       - Whether to hide the actions. False by default.\n * @param {Function}        [props.onActionPerformed] - A callback function for when a quick action is performed.\n * @param {Function}        [props.onClose]           - A callback function for when the close button is clicked.\n * @return {React.ReactNode} The rendered component.\n */\nexport default function PostCardPanel( {\n\tpostType,\n\tpostId,\n\thideActions = false,\n\tonActionPerformed,\n\tonClose,\n} ) {\n\tconst postIds = useMemo(\n\t\t() => ( Array.isArray( postId ) ? postId : [ postId ] ),\n\t\t[ postId ]\n\t);\n\tconst { postTitle, icon, labels } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, getCurrentTheme, getPostType } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst {\n\t\t\t\tgetPostIcon,\n\t\t\t\tgetCurrentPostType,\n\t\t\t\tisRevisionsMode,\n\t\t\t\tgetCurrentRevision,\n\t\t\t} = unlock( select( editorStore ) );\n\t\t\tlet _title = '';\n\n\t\t\t// In revisions mode, use the current revision.\n\t\t\tif ( isRevisionsMode() ) {\n\t\t\t\tconst parentPostType = getCurrentPostType();\n\t\t\t\tconst _record = getCurrentRevision();\n\t\t\t\t_title = _record?.title?.rendered || _record?.title?.raw || '';\n\t\t\t\treturn {\n\t\t\t\t\tpostTitle: _title,\n\t\t\t\t\ticon: getPostIcon( parentPostType, {\n\t\t\t\t\t\tarea: _record?.area,\n\t\t\t\t\t} ),\n\t\t\t\t\tlabels: getPostType( parentPostType )?.labels,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst _record = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostIds[ 0 ]\n\t\t\t);\n\t\t\tif ( postIds.length === 1 ) {\n\t\t\t\tconst { default_template_types: templateTypes = [] } =\n\t\t\t\t\tgetCurrentTheme() ?? {};\n\n\t\t\t\tconst _templateInfo = [\n\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t\t].includes( postType )\n\t\t\t\t\t? getTemplateInfo( {\n\t\t\t\t\t\t\ttemplate: _record,\n\t\t\t\t\t\t\ttemplateTypes,\n\t\t\t\t\t  } )\n\t\t\t\t\t: {};\n\t\t\t\t_title = _templateInfo?.title || _record?.title;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tpostTitle: _title,\n\t\t\t\ticon: getPostIcon( postType, {\n\t\t\t\t\tarea: _record?.area,\n\t\t\t\t} ),\n\t\t\t\tlabels: getPostType( postType )?.labels,\n\t\t\t};\n\t\t},\n\t\t[ postIds, postType ]\n\t);\n\n\tconst pageTypeBadge = usePageTypeBadge( postId );\n\tlet title = __( 'No title' );\n\tif ( labels?.name && postIds.length > 1 ) {\n\t\ttitle = sprintf(\n\t\t\t// translators: %1$d number of selected items %2$s: Name of the plural post type e.g: \"Posts\".\n\t\t\t__( '%1$d %2$s' ),\n\t\t\tpostIds.length,\n\t\t\tlabels?.name\n\t\t);\n\t} else if ( postTitle ) {\n\t\ttitle = stripHTML( postTitle );\n\t}\n\n\treturn (\n\t\t<VStack spacing={ 1 } className=\"editor-post-card-panel\">\n\t\t\t<HStack\n\t\t\t\tspacing={ 2 }\n\t\t\t\tclassName=\"editor-post-card-panel__header\"\n\t\t\t\talignment=\"flex-start\"\n\t\t\t>\n\t\t\t\t<Icon className=\"editor-post-card-panel__icon\" icon={ icon } />\n\t\t\t\t<Text\n\t\t\t\t\tnumberOfLines={ 2 }\n\t\t\t\t\ttruncate\n\t\t\t\t\tclassName=\"editor-post-card-panel__title\"\n\t\t\t\t\tas=\"h2\"\n\t\t\t\t>\n\t\t\t\t\t<span className=\"editor-post-card-panel__title-name\">\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</span>\n\t\t\t\t\t{ pageTypeBadge && postIds.length === 1 && (\n\t\t\t\t\t\t<Badge>{ pageTypeBadge }</Badge>\n\t\t\t\t\t) }\n\t\t\t\t</Text>\n\t\t\t\t{ ! hideActions && postIds.length === 1 && (\n\t\t\t\t\t<PostActions\n\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\tpostId={ postIds[ 0 ] }\n\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ onClose && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\ticon={ close }\n\t\t\t\t\t\tlabel={ __( 'Close' ) }\n\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</HStack>\n\t\t\t{ postIds.length > 1 && (\n\t\t\t\t<Text className=\"editor-post-card-panel__description\">\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t// translators: %s: Name of the plural post type e.g: \"Posts\".\n\t\t\t\t\t\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