{"version":3,"file":"use-code-theme.mjs","names":["ndlCodeDark","ndlCodeLight"],"sources":["../../../../src/code-block/hooks/use-code-theme.ts"],"sourcesContent":["/*!\n *\n *  Copyright (c) \"Neo4j\"\n *  Neo4j Sweden AB [http://neo4j.com]\n *\n *  This file is part of Neo4j.\n *\n *  Neo4j is free software: you can redistribute it and/or modify\n *  it under the terms of the GNU General Public License as published by\n *  the Free Software Foundation, either version 3 of the License, or\n *  (at your option) any later version.\n *\n *  This program is distributed in the hope that it will be useful,\n *  but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { type SyntaxHighlighterProps } from 'react-syntax-highlighter';\nimport {\n  base16AteliersulphurpoolLight,\n  coy,\n  duotoneLight,\n  ghcolors,\n  prism,\n  solarizedlight,\n  vs,\n} from 'react-syntax-highlighter/dist/cjs/styles/prism';\n\nimport { useNeedleTheme } from '../../theme';\nimport { type CodeTheme } from '../code-themes';\nimport ndlCodeDark from '../themes/ndl-code-dark';\nimport ndlCodeLight from '../themes/ndl-code-light';\n\ntype PrismTheme = SyntaxHighlighterProps['style'];\n\n/**\n * The color themes that we support for the Prism code highlighting library.\n */\nconst PRISM_CODE_THEMES = {\n  'base16-ateliersulphurpool.light': base16AteliersulphurpoolLight,\n  coy,\n  'duotone-light': duotoneLight,\n  ghcolors,\n  'ndl-code-dark': ndlCodeDark,\n  'ndl-code-light': ndlCodeLight,\n  prism,\n  solarizedlight,\n  vs,\n} satisfies Record<CodeTheme, PrismTheme>;\n\n/**\n * Map the Needle theme to the corresponding Prism color theme.\n */\nconst NEEDLE_CODE_THEMES = {\n  dark: ndlCodeDark,\n  light: ndlCodeLight,\n} as const;\n\n/**\n * Get the Prism code color theme.\n * Defaults to the appropriate Prism theme based on the Needle theme if no chosen theme is provided.\n */\nexport const useCodeTheme = (chosenTheme: CodeTheme | undefined) => {\n  const { theme: needleTheme } = useNeedleTheme();\n  return (\n    (chosenTheme && PRISM_CODE_THEMES[chosenTheme]) ??\n    NEEDLE_CODE_THEMES[needleTheme]\n  );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAM,oBAAoB;CACxB,mCAAmC;CACnC;CACA,iBAAiB;CACjB;CACA,iBAAiBA;CACjB,kBAAkBC;CAClB;CACA;CACA;AACF;;;;AAKA,MAAM,qBAAqB;CACzB,MAAMD;CACN,OAAOC;AACT;;;;;AAMA,MAAa,gBAAgB,gBAAuC;;CAClE,MAAM,EAAE,OAAO,gBAAgB,eAAe;CAC9C,QAAA,OACG,eAAe,kBAAkB,kBAAA,QAAA,SAAA,KAAA,IAAA,OAClC,mBAAmB;AAEvB"}