{"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/mdx/mdxComponents/Citation/index.tsx"],"sourcesContent":["'use client';\n\nimport { cx } from 'antd-style';\nimport { isEmpty } from 'es-toolkit/compat';\nimport type { FC, ReactNode } from 'react';\n\nimport PopoverPanel from '@/mdx/mdxComponents/Citation/PopoverPanel';\nimport type { CitationItem } from '@/types/citation';\n\nimport { styles } from './style';\n\ninterface CitationProps {\n  children?: ReactNode;\n  citationDetail?: CitationItem;\n  citations?: string[];\n  href?: string;\n  id: string;\n  inSup?: boolean;\n}\n\nconst Citation: FC<CitationProps> = ({ children, href, inSup, id, citationDetail }) => {\n  const usePopover = !isEmpty(citationDetail);\n  const url = citationDetail?.url || href;\n\n  // [^1] 格式类型\n  if (inSup) {\n    return (\n      <PopoverPanel {...citationDetail} usePopover={usePopover}>\n        <span className={styles.container}>\n          <a\n            aria-describedby=\"footnote-label\"\n            data-footnote-ref=\"true\"\n            href={url}\n            id={id}\n            rel=\"noreferrer\"\n            target={citationDetail?.url ? '_blank' : undefined}\n          >\n            {children}\n          </a>\n        </span>\n      </PopoverPanel>\n    );\n  }\n\n  return (\n    <PopoverPanel {...citationDetail} usePopover={usePopover}>\n      <sup className={cx(styles.container, styles.supContainer)}>\n        {url ? (\n          <a\n            aria-describedby=\"footnote-label\"\n            data-footnote-ref={true}\n            href={url}\n            rel=\"noreferrer\"\n            target={'_blank'}\n          >\n            {children}\n          </a>\n        ) : (\n          <span aria-describedby=\"footnote-label\" data-footnote-ref={true}>\n            {children}\n          </span>\n        )}\n      </sup>\n    </PopoverPanel>\n  );\n};\n\nCitation.displayName = 'MdxCitation';\n\nexport default Citation;\n"],"mappings":";;;;;;;AAoBA,MAAM,YAA+B,EAAE,UAAU,MAAM,OAAO,IAAI,qBAAqB;CACrF,MAAM,aAAa,CAAC,QAAQ,eAAe;CAC3C,MAAM,MAAM,gBAAgB,OAAO;AAGnC,KAAI,MACF,QACE,oBAAC,cAAD;EAAc,GAAI;EAA4B;YAC5C,oBAAC,QAAD;GAAM,WAAW,OAAO;aACtB,oBAAC,KAAD;IACE,oBAAiB;IACjB,qBAAkB;IAClB,MAAM;IACF;IACJ,KAAI;IACJ,QAAQ,gBAAgB,MAAM,WAAW,KAAA;IAExC;IACC,CAAA;GACC,CAAA;EACM,CAAA;AAInB,QACE,oBAAC,cAAD;EAAc,GAAI;EAA4B;YAC5C,oBAAC,OAAD;GAAK,WAAW,GAAG,OAAO,WAAW,OAAO,aAAa;aACtD,MACC,oBAAC,KAAD;IACE,oBAAiB;IACjB,qBAAmB;IACnB,MAAM;IACN,KAAI;IACJ,QAAQ;IAEP;IACC,CAAA,GAEJ,oBAAC,QAAD;IAAM,oBAAiB;IAAiB,qBAAmB;IACxD;IACI,CAAA;GAEL,CAAA;EACO,CAAA;;AAInB,SAAS,cAAc"}