{"version":3,"file":"save.cjs","names":["RichText","useBlockProps","__experimentalGetElementClassName"],"sources":["../../src/file/save.jsx"],"sourcesContent":["import clsx from 'clsx';\nimport {\n\tRichText,\n\tuseBlockProps,\n\t__experimentalGetElementClassName,\n} from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst {\n\t\thref,\n\t\tfileId,\n\t\tfileName,\n\t\ttextLinkHref,\n\t\ttextLinkTarget,\n\t\tshowDownloadButton,\n\t\tdownloadButtonText,\n\t\tdisplayPreview,\n\t\tpreviewHeight,\n\t} = attributes;\n\n\tconst pdfEmbedLabel = RichText.isEmpty( fileName )\n\t\t? 'PDF embed'\n\t\t: // To do: use toPlainText, but we need ensure it's RichTextData. See\n\t\t\t// https://github.com/WordPress/gutenberg/pull/56710.\n\t\t\tfileName.toString();\n\n\tconst hasFilename = ! RichText.isEmpty( fileName );\n\n\t// Only output an `aria-describedby` when the element it's referring to is\n\t// actually rendered.\n\tconst describedById = hasFilename ? fileId : undefined;\n\n\treturn (\n\t\thref && (\n\t\t\t<div { ...useBlockProps.save() }>\n\t\t\t\t{ displayPreview && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<object\n\t\t\t\t\t\t\tclassName=\"wp-block-file__embed\"\n\t\t\t\t\t\t\tdata={ href }\n\t\t\t\t\t\t\ttype=\"application/pdf\"\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\t\theight: `${ previewHeight }px`,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\taria-label={ pdfEmbedLabel }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t{ hasFilename && (\n\t\t\t\t\t<a\n\t\t\t\t\t\tid={ describedById }\n\t\t\t\t\t\thref={ textLinkHref }\n\t\t\t\t\t\ttarget={ textLinkTarget }\n\t\t\t\t\t\trel={\n\t\t\t\t\t\t\ttextLinkTarget ? 'noreferrer noopener' : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<RichText.Content value={ fileName } />\n\t\t\t\t\t</a>\n\t\t\t\t) }\n\t\t\t\t{ showDownloadButton && (\n\t\t\t\t\t<a\n\t\t\t\t\t\thref={ href }\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t'wp-block-file__button',\n\t\t\t\t\t\t\t__experimentalGetElementClassName( 'button' )\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tdownload\n\t\t\t\t\t\taria-describedby={ describedById }\n\t\t\t\t\t>\n\t\t\t\t\t\t<RichText.Content value={ downloadButtonText } />\n\t\t\t\t\t</a>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t)\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,SAAwB,KAAM,EAAE,cAAe;CAC9C,MAAM,EACL,MACA,QACA,UACA,cACA,gBACA,oBACA,oBACA,gBACA,kBACG;CAEJ,MAAM,gBAAgBA,wBAAAA,SAAS,QAAS,QAAS,IAC9C,cAGD,SAAS,SAAS;CAEpB,MAAM,cAAc,CAAEA,wBAAAA,SAAS,QAAS,QAAS;CAIjD,MAAM,gBAAgB,cAAc,SAAS,KAAA;CAE7C,OACC,QACC,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EAAK,GAAKC,wBAAAA,cAAc,KAAK;EAA7B,UAAA;GACG,kBACD,iBAAA,GAAA,kBAAA,IAAA,CAAA,kBAAA,UAAA,EAAA,UACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD;IACC,WAAU;IACV,MAAO;IACP,MAAK;IACL,OAAQ;KACP,OAAO;KACP,QAAQ,GAAI,cAAe;IAC5B;IACA,cAAa;GACb,CAAA,EACA,CAAA;GAED,eACD,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;IACC,IAAK;IACL,MAAO;IACP,QAAS;IACT,KACC,iBAAiB,wBAAwB,KAAA;IAG1C,UAAA,iBAAA,GAAA,kB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