{"version":3,"file":"DownloadButton.mjs","names":[],"sources":["../../src/DownloadButton/DownloadButton.tsx"],"sourcesContent":["'use client';\n\nimport { Download } from 'lucide-react';\nimport React, { memo } from 'react';\n\nimport ActionIcon from '@/ActionIcon';\nimport { downloadBlob } from '@/utils/downloadBlob';\n\nimport type { DownloadButtonProps } from './type';\n\nconst DownloadButton = memo<DownloadButtonProps>(\n  ({ fileName = 'download', fileType = 'svg', disabled = false, blobUrl, ...rest }) => {\n    const handleDownload = async () => {\n      if (!blobUrl || disabled) return;\n      try {\n        await downloadBlob(blobUrl, `${fileName.replace(/\\.[^./]+$/, '')}.${fileType}`);\n      } catch (error) {\n        console.error('Download failed:', error);\n      }\n    };\n    return (\n      <ActionIcon\n        title={`Download ${fileType.toUpperCase()}`}\n        {...rest}\n        icon={Download}\n        onClick={handleDownload}\n      />\n    );\n  },\n);\n\nDownloadButton.displayName = 'DownloadButton';\n\nexport default DownloadButton;\n"],"mappings":";;;;;;;AAUA,MAAM,iBAAiB,MACpB,EAAE,WAAW,YAAY,WAAW,OAAO,WAAW,OAAO,SAAS,GAAG,WAAW;CACnF,MAAM,iBAAiB,YAAY;AACjC,MAAI,CAAC,WAAW,SAAU;AAC1B,MAAI;AACF,SAAM,aAAa,SAAS,GAAG,SAAS,QAAQ,aAAa,GAAG,CAAC,GAAG,WAAW;WACxE,OAAO;AACd,WAAQ,MAAM,oBAAoB,MAAM;;;AAG5C,QACE,oBAAC,YAAD;EACE,OAAO,YAAY,SAAS,aAAa;EACzC,GAAI;EACJ,MAAM;EACN,SAAS;EACT,CAAA;EAGP;AAED,eAAe,cAAc"}