{"version":3,"file":"Thinking.mjs","names":[],"sources":["../../../../src/ai/thinking/Thinking.tsx"],"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 classNames from 'classnames';\n\nimport type { CommonProps } from '../../_common/types';\nimport { Typography } from '../../typography';\nimport { Presence } from '../presence';\nimport { formatThinkingDuration } from './thinking-duration-formatter';\n\ntype ThinkingProps = {\n  /** Whether the AI is thinking.\n   * If true, will render a thinking presence icon and the text \"Thinking\".\n   * If false, will render the duration of the thinking.\n   */\n  isThinking?: boolean;\n  /** The duration of the thinking in milliseconds */\n  thinkingMs?: number;\n};\n\n/**\n * The component is used to display the thinking state of an LLM.\n * If the `isThinking` prop is true, it will render a thinking presence icon and the text \"Thinking\".\n * If the `isThinking` prop is false, it will render the duration of the thinking.\n *\n * @alpha - Changes to this component may be breaking.\n */\nconst Thinking = ({\n  className,\n  isThinking = true,\n  style,\n  htmlAttributes,\n  ref,\n  thinkingMs = 1000,\n  ...restProps\n}: CommonProps<'div', ThinkingProps>) => {\n  const classes = classNames('ndl-ai-thinking', className);\n\n  const { value: thinkingDuration, unit } = formatThinkingDuration(thinkingMs);\n\n  return (\n    <div\n      ref={ref}\n      className={classes}\n      style={style}\n      {...restProps}\n      {...htmlAttributes}\n    >\n      {isThinking === true ? (\n        <>\n          <Presence\n            isThinking={isThinking}\n            className=\"ndl-ai-thinking-presence\"\n          />\n          <Typography\n            variant=\"subheading-small\"\n            className=\"ndl-ai-thinking-label\"\n          >\n            Thinking\n          </Typography>\n        </>\n      ) : (\n        <Typography variant=\"subheading-small\" className=\"ndl-ai-thinking-done\">\n          Thought{' '}\n          <span className=\"ndl-ai-thinking-duration\">\n            for {thinkingDuration} {unit}\n          </span>\n        </Typography>\n      )}\n    </div>\n  );\n};\n\nexport { Thinking };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8CE;CACA;CACA;CACA;CACA;CACA;;;;;;;;;AANF,MAAM,YAAY,SAQuB;CARvB,IAAA,EAChB,WACA,aAAa,MACb,OACA,gBACA,KACA,aAAa,QAAA,MACV,YAAA,yBAAA,MAAA,SAAA;CAEH,MAAM,UAAU,WAAW,mBAAmB,SAAS;CAEvD,MAAM,EAAE,OAAO,kBAAkB,SAAS,uBAAuB,UAAU;CAE3E,OACE,oBAAC,OAAA,eAAA,eAAA,eAAA;EACM;EACL,WAAW;EACJ;CACH,GAAA,SAAA,GACA,cAAA,GAAA,CAAA,GAAA,EAAA,UAEH,eAAe,OACd,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,UAAD;EACc;EACZ,WAAU;CACX,CAAA,GACD,oBAAC,YAAD;EACE,SAAQ;EACR,WAAU;EACX,UAAA;CAEW,CAAA,CACZ,EAAA,CAAA,IAEF,qBAAC,YAAD;EAAY,SAAQ;EAAmB,WAAU;EAAjD,UAAA;GAAwE;GAC9D;GACR,qBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA;KAA2C;KACpC;KAAiB;KAAE;IACpB;;EACI;CAEX,CAAA,EAAA,CAAA,CAAA;AAET"}