{"version":3,"file":"index.mjs","names":["Citation: FC<CitationProps>","PopoverPanel"],"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,MAAMA,YAA+B,EAAE,UAAU,MAAM,OAAO,IAAI,qBAAqB;CACrF,MAAM,aAAa,CAAC,QAAQ,eAAe;CAC3C,MAAM,MAAM,gBAAgB,OAAO;AAGnC,KAAI,MACF,QACE,oBAACC;EAAa,GAAI;EAA4B;YAC5C,oBAAC;GAAK,WAAW,OAAO;aACtB,oBAAC;IACC,oBAAiB;IACjB,qBAAkB;IAClB,MAAM;IACF;IACJ,KAAI;IACJ,QAAQ,gBAAgB,MAAM,WAAW;IAExC;KACC;IACC;GACM;AAInB,QACE,oBAACA;EAAa,GAAI;EAA4B;YAC5C,oBAAC;GAAI,WAAW,GAAG,OAAO,WAAW,OAAO,aAAa;aACtD,MACC,oBAAC;IACC,oBAAiB;IACjB,qBAAmB;IACnB,MAAM;IACN,KAAI;IACJ,QAAQ;IAEP;KACC,GAEJ,oBAAC;IAAK,oBAAiB;IAAiB,qBAAmB;IACxD;KACI;IAEL;GACO;;AAInB,SAAS,cAAc;AAEvB,uBAAe"}