@pstdio/ui 0.24.1 → 0.24.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/{MermaidComponent-BTgLnpLA.js → MermaidComponent-DSvPk-J8.js} +2 -2
  2. package/dist/{MermaidComponent-BTgLnpLA.js.map → MermaidComponent-DSvPk-J8.js.map} +1 -1
  3. package/dist/chat-ui.js +1325 -1414
  4. package/dist/chat-ui.js.map +1 -1
  5. package/dist/components/chat-ui/components/chat-input.d.ts +1 -1
  6. package/dist/components/chat-ui/components/chat-panel.d.ts +1 -1
  7. package/dist/components/tab-strip/window-tabs.d.ts +1 -0
  8. package/dist/data-table.js +5 -5
  9. package/dist/diff.js +2 -2
  10. package/dist/{edit-mode-data-table-BrydKuMM.js → edit-mode-data-table-2E4GSOou.js} +4 -4
  11. package/dist/{edit-mode-data-table-BrydKuMM.js.map → edit-mode-data-table-2E4GSOou.js.map} +1 -1
  12. package/dist/index.js +1232 -1153
  13. package/dist/index.js.map +1 -1
  14. package/dist/{kanban-renderer-toolbar-ebqlG13w.js → kanban-renderer-toolbar-Dcbxujbk.js} +3 -3
  15. package/dist/{kanban-renderer-toolbar-ebqlG13w.js.map → kanban-renderer-toolbar-Dcbxujbk.js.map} +1 -1
  16. package/dist/kanban-renderer.js +5 -5
  17. package/dist/{lazy-markdown-editor-Obb0M8xc.js → lazy-markdown-editor-DSlelhHV.js} +2 -2
  18. package/dist/{lazy-markdown-editor-Obb0M8xc.js.map → lazy-markdown-editor-DSlelhHV.js.map} +1 -1
  19. package/dist/{list-row-CRi3Luog.js → list-row-BDoV_iMV.js} +3 -3
  20. package/dist/list-row-BDoV_iMV.js.map +1 -0
  21. package/dist/{markdown-kuU19Oh3.js → markdown-Cli3KGu9.js} +4 -4
  22. package/dist/{markdown-kuU19Oh3.js.map → markdown-Cli3KGu9.js.map} +1 -1
  23. package/dist/{markdown-editor-Bj_QX4oN.js → markdown-editor-BHoRATej.js} +2 -2
  24. package/dist/{markdown-editor-Bj_QX4oN.js.map → markdown-editor-BHoRATej.js.map} +1 -1
  25. package/dist/{param-editor-DhoxgwGd.js → param-editor-CaRflJ3e.js} +2 -2
  26. package/dist/{param-editor-DhoxgwGd.js.map → param-editor-CaRflJ3e.js.map} +1 -1
  27. package/dist/{param-editor-field-DurcyLuw.js → param-editor-field-DVQlXbid.js} +3 -3
  28. package/dist/{param-editor-field-DurcyLuw.js.map → param-editor-field-DVQlXbid.js.map} +1 -1
  29. package/dist/{rich-message-dNYvLDd4.js → rich-message-gWYlm8Ji.js} +2 -2
  30. package/dist/{rich-message-dNYvLDd4.js.map → rich-message-gWYlm8Ji.js.map} +1 -1
  31. package/dist/rich-text.js +5 -5
  32. package/dist/theme/recipes/window-title-bar.d.ts +3 -0
  33. package/dist/{theme-Ca-KyNoi.js → theme-B5OVwYEU.js} +31 -22
  34. package/dist/theme-B5OVwYEU.js.map +1 -0
  35. package/dist/theme.js +1 -1
  36. package/dist/{tree-list-DXwHWodb.js → tree-list-CZvcg3_6.js} +2 -2
  37. package/dist/{tree-list-DXwHWodb.js.map → tree-list-CZvcg3_6.js.map} +1 -1
  38. package/package.json +2 -2
  39. package/dist/list-row-CRi3Luog.js.map +0 -1
  40. package/dist/theme-Ca-KyNoi.js.map +0 -1
@@ -9,7 +9,7 @@ import { OnChangePlugin as se } from "@lexical/react/LexicalOnChangePlugin";
9
9
  import { RichTextPlugin as ce } from "@lexical/react/LexicalRichTextPlugin";
10
10
  import { createCommand as le, ElementNode as Oe, isHTMLElement as Me, $createParagraphNode as j, COMMAND_PRIORITY_LOW as ae, $getSelection as $e, $isRangeSelection as Ne, $isElementNode as ve, KEY_DOWN_COMMAND as Pe, COMMAND_PRIORITY_HIGH as Ae, TextNode as Le, $getRoot as de, $addUpdateTag as ee } from "lexical";
11
11
  import { useEffect as B, useImperativeHandle as ke, useState as we, forwardRef as De, useRef as ue } from "react";
12
- import { t as Be, b as me, T as fe, h as pe, s as Fe, f as te, M as He, e as Je, a as Ke, C as Ue, I as Ge, E as We } from "./markdown-kuU19Oh3.js";
12
+ import { t as Be, b as me, T as fe, h as pe, s as Fe, f as te, M as He, e as Je, a as Ke, C as Ue, I as Ge, E as We } from "./markdown-Cli3KGu9.js";
13
13
  import { useLexicalComposerContext as M } from "@lexical/react/LexicalComposerContext";
14
14
  import { $setBlocksType as Ve } from "@lexical/selection";
15
15
  import { addClassNamesToElement as ge, mergeRegister as X } from "@lexical/utils";
@@ -625,4 +625,4 @@ export {
625
625
  Ee as a,
626
626
  ht as g
627
627
  };
628
- //# sourceMappingURL=rich-message-dNYvLDd4.js.map
628
+ //# sourceMappingURL=rich-message-gWYlm8Ji.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rich-message-dNYvLDd4.js","sources":["../src/components/rich-text/prompt-input/events.ts","../src/components/rich-text/prompt-input/commands.ts","../src/components/rich-text/prompt-input/plugins/CommentPlugin/nodes/CommentNode/CommentNode.tsx","../src/components/rich-text/prompt-input/plugins/CommentPlugin/hooks/useCommentCommands.ts","../src/components/rich-text/prompt-input/plugins/CommentPlugin/hooks/useCommentSchema.ts","../src/components/rich-text/prompt-input/plugins/CommentPlugin/CommentPlugin.tsx","../src/components/rich-text/prompt-input/utils.ts","../src/components/rich-text/prompt-input/plugins/ImperativeAPIPlugin.tsx","../src/components/rich-text/prompt-input/plugins/keyboard-shortcuts.ts","../src/components/rich-text/prompt-input/plugins/KeyboardShortcutPlugin.tsx","../src/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/constants.ts","../src/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/utils/getSortedMenuOptions.ts","../src/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/components/ReferenceMenu/ReferenceMenuItem.tsx","../src/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/components/ReferenceMenu/ReferenceMenu.tsx","../src/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/hooks/useContextLookup.tsx","../src/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/utils/checkForTriggers.ts","../src/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/ReferenceMenuPlugin.tsx","../src/components/rich-text/prompt-input/plugins/ReferencePlugin/nodes/ReferenceNode/ReferenceNode.tsx","../src/components/rich-text/prompt-input/plugins/ReferencePlugin/ReferencePlugin.tsx","../src/components/rich-text/prompt-input/theme/prompt-input-theme.ts","../src/components/rich-text/prompt-input/prompt-input.tsx","../src/components/rich-text/shared/plugins/StateUpdatePlugin.tsx","../src/components/rich-text/rich-message/rich-message.tsx"],"sourcesContent":["export const INSERT_REFERENCE = \"INSERT_REFERENCE\";\nexport const INSERT_BLOCK = \"INSERT_BLOCK\";\n","import { createCommand } from \"lexical\";\nimport { INSERT_BLOCK, INSERT_REFERENCE } from \"./events\";\n\nexport const INSERT_REFERENCE_COMMAND = createCommand(INSERT_REFERENCE);\n\nexport const INSERT_BLOCK_COMMAND = createCommand(INSERT_BLOCK);\n","import { addClassNamesToElement } from \"@lexical/utils\";\nimport {\n $createParagraphNode,\n type DOMConversionMap,\n type DOMConversionOutput,\n type DOMExportOutput,\n type EditorConfig,\n type ElementFormatType,\n ElementNode,\n isHTMLElement,\n type LexicalEditor,\n type ParagraphNode,\n type RangeSelection,\n type SerializedElementNode,\n} from \"lexical\";\n\nexport type SerializedCommentNode = SerializedElementNode;\n\nfunction convertCommentElement(element: HTMLElement): DOMConversionOutput {\n const node = $createCommentNode();\n if (element.style !== null) {\n node.setFormat(element.style.textAlign as ElementFormatType);\n }\n return { node };\n}\n\nexport class CommentNode extends ElementNode {\n static getType(): string {\n return \"comment\";\n }\n\n static clone(node: CommentNode): CommentNode {\n return new CommentNode(node.__key);\n }\n\n createDOM(config: EditorConfig): HTMLElement {\n const element = document.createElement(\"blockquote\");\n addClassNamesToElement(element, config.theme.comment);\n return element;\n }\n\n updateDOM(): boolean {\n return false;\n }\n\n static importDOM(): DOMConversionMap | null {\n return {\n blockquote: () => ({\n conversion: convertCommentElement,\n priority: 0,\n }),\n };\n }\n\n exportDOM(editor: LexicalEditor): DOMExportOutput {\n const { element } = super.exportDOM(editor);\n\n if (element && isHTMLElement(element)) {\n if (this.isEmpty()) {\n element.append(document.createElement(\"br\"));\n }\n\n const formatType = this.getFormatType();\n element.style.textAlign = formatType;\n\n const direction = this.getDirection();\n if (direction) {\n element.dir = direction;\n }\n }\n\n return {\n element,\n };\n }\n\n static importJSON(serializedNode: SerializedCommentNode): CommentNode {\n const node = $createCommentNode();\n node.setFormat(serializedNode.format);\n node.setIndent(serializedNode.indent);\n node.setDirection(serializedNode.direction);\n return node;\n }\n\n exportJSON(): SerializedElementNode {\n return {\n ...super.exportJSON(),\n type: \"comment\",\n };\n }\n\n getTextContent(): string {\n const originalText = super.getTextContent();\n // escape { and } symbols\n const withEscapedReferences = originalText.replace(/([{}])/g, \"\\\\$1\");\n return `{{! ${withEscapedReferences} }}`;\n }\n\n // mutation\n\n insertNewAfter(_: RangeSelection, restoreSelection?: boolean): ParagraphNode {\n const newBlock = $createParagraphNode();\n const direction = this.getDirection();\n newBlock.setDirection(direction);\n this.insertAfter(newBlock, restoreSelection);\n return newBlock;\n }\n\n collapseAtStart(): true {\n const paragraph = $createParagraphNode();\n const children = this.getChildren();\n children.forEach((child) => {\n paragraph.append(child);\n });\n this.replace(paragraph);\n return true;\n }\n}\n\nexport function $createCommentNode(): CommentNode {\n return new CommentNode();\n}\n","import { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport { $setBlocksType } from \"@lexical/selection\";\nimport { mergeRegister } from \"@lexical/utils\";\nimport { $getSelection, $isRangeSelection, COMMAND_PRIORITY_LOW, type TextNode } from \"lexical\";\nimport { useEffect } from \"react\";\nimport { INSERT_BLOCK_COMMAND } from \"../../../commands\";\nimport { $createCommentNode } from \"../nodes/CommentNode/CommentNode\";\n\nexport const insertCommentBlock = (_blockType: string, nodeToReplace?: TextNode) => {\n const selection = $getSelection();\n const commentNode = $createCommentNode();\n\n if (nodeToReplace) {\n const nodeParent = nodeToReplace.getParent();\n nodeParent?.replace(commentNode, true);\n nodeToReplace.remove();\n commentNode.selectEnd();\n return;\n }\n\n if ($isRangeSelection(selection)) {\n $setBlocksType(selection, $createCommentNode);\n }\n};\n\ntype InsertBlockEvent = {\n optionId: string;\n nodeToReplace?: TextNode;\n};\n\nexport function useCommentCommands(): null {\n const [editor] = useLexicalComposerContext();\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand(\n INSERT_BLOCK_COMMAND,\n (event: InsertBlockEvent) => {\n const { optionId, nodeToReplace } = event;\n insertCommentBlock(optionId, nodeToReplace);\n return false;\n },\n COMMAND_PRIORITY_LOW,\n ),\n );\n }, [editor]);\n\n return null;\n}\n","import { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport { mergeRegister } from \"@lexical/utils\";\nimport { $createParagraphNode } from \"lexical\";\nimport { useEffect } from \"react\";\nimport { CommentNode } from \"../nodes/CommentNode/CommentNode\";\n\nexport const useCommentSchema = () => {\n const [editor] = useLexicalComposerContext();\n\n useEffect(() => {\n return mergeRegister(\n editor.registerNodeTransform(CommentNode, (node) => {\n const children = node.getChildren();\n\n /**\n * Comment nodes cannot have other comments as children\n */\n const invalidChildren = children.filter((child) => child.getType() === \"comment\");\n\n if (invalidChildren.length > 0) {\n editor.update(() => {\n invalidChildren.forEach((child) => {\n child.replace($createParagraphNode(), true);\n });\n });\n }\n }),\n );\n }, [editor]);\n};\n","import { useCommentCommands } from \"./hooks/useCommentCommands\";\nimport { useCommentSchema } from \"./hooks/useCommentSchema\";\n\nexport function CommentPlugin(): null {\n useCommentSchema();\n useCommentCommands();\n return null;\n}\n","import { $isElementNode, type RootNode } from \"lexical\";\n\nexport const $getTextContent = (root: RootNode) => {\n let textContent = \"\";\n const children = root.getChildren();\n const childrenLength = children.length;\n for (let i = 0; i < childrenLength; i++) {\n const child = children[i];\n textContent += child.getTextContent();\n if ($isElementNode(child) && i !== childrenLength - 1 && !child.isInline()) {\n textContent += \"\\n\";\n }\n }\n return textContent;\n};\n\ntype SerializedNode = {\n type?: string;\n text?: string;\n name?: string;\n referenceId?: string;\n children?: SerializedNode[];\n};\n\ntype SerializedRoot = {\n root?: SerializedNode;\n};\n\nconst getReferenceMarker = (node: SerializedNode) => {\n if (node.type !== \"reference\") return null;\n return `#${node.name ?? node.referenceId ?? \"\"}`;\n};\n\nconst shouldAppendParagraphBreak = (node: SerializedNode) => {\n return node.type === \"paragraph\" && Boolean(node.children?.length);\n};\n\nconst traverseSerializedNode = (node: SerializedNode): string => {\n if (node.type === \"comment\") {\n return \"\";\n }\n\n const referenceMarker = getReferenceMarker(node);\n if (referenceMarker !== null) {\n return referenceMarker;\n }\n\n let text = typeof node.text === \"string\" ? node.text : \"\";\n const children = node.children;\n if (!Array.isArray(children)) return text;\n\n const childrenLength = children.length;\n for (let i = 0; i < childrenLength; i += 1) {\n const child = children[i];\n if (child.type === \"comment\") {\n if (i !== childrenLength - 1) {\n text += \"\\n\";\n }\n continue;\n }\n\n text += traverseSerializedNode(child);\n if (shouldAppendParagraphBreak(child)) {\n text += \"\\n\";\n }\n }\n\n return text;\n};\n\nexport const getTextFromSerializedEditorState = (state: string): string => {\n try {\n const parsed = JSON.parse(state) as SerializedRoot;\n return traverseSerializedNode(parsed.root ?? {});\n } catch {\n return \"\";\n }\n};\n\nexport const emptyEditorState = {\n root: {\n direction: \"ltr\",\n format: \"\",\n indent: 0,\n type: \"root\",\n version: 1,\n children: [\n {\n type: \"paragraph\",\n version: 1,\n format: \"\",\n indent: 0,\n textFormat: undefined,\n direction: null,\n children: [],\n },\n ],\n },\n};\n\nexport function generateEditorStateFromString(input = \"\") {\n if (!input.trim()) {\n return JSON.parse(JSON.stringify(emptyEditorState));\n }\n\n // Split on line breaks → one paragraph per line\n const paragraphs = input.split(/\\r?\\n/);\n\n const children = paragraphs.map((line) => ({\n type: \"paragraph\",\n version: 1,\n format: \"\",\n indent: 0,\n textFormat: undefined,\n direction: null,\n children: line\n ? [\n {\n type: \"text\",\n version: 1,\n text: line,\n format: \"\",\n detail: 0,\n mode: \"normal\",\n style: \"\",\n },\n ]\n : [],\n }));\n\n return {\n root: {\n direction: \"ltr\",\n format: \"\",\n indent: 0,\n type: \"root\",\n version: 1,\n children,\n },\n };\n}\n","import { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport { useImperativeHandle } from \"react\";\nimport { generateEditorStateFromString, getTextFromSerializedEditorState } from \"../utils\";\n\nexport interface PromptEditorRef {\n setEditorValue: (value: string) => void;\n}\n\nexport function ImperativeAPIPlugin({\n editorRef,\n previousTextRef,\n}: {\n editorRef: React.ForwardedRef<PromptEditorRef>;\n previousTextRef: React.MutableRefObject<string>;\n}) {\n const [editor] = useLexicalComposerContext();\n\n useImperativeHandle(\n editorRef,\n () => ({\n setEditorValue: (value: string) => {\n const state = editor.parseEditorState(JSON.stringify(generateEditorStateFromString(value)));\n editor.setEditorState(state);\n previousTextRef.current = getTextFromSerializedEditorState(value);\n editor.focus(undefined, { defaultSelection: \"rootEnd\" });\n },\n }),\n [editor, previousTextRef],\n );\n\n return null;\n}\n","type KeyDownLikeEvent = {\n key: string;\n ctrlKey: boolean;\n metaKey: boolean;\n shiftKey: boolean;\n altKey: boolean;\n};\n\nexport const shouldSubmitOnEnter = (event: KeyDownLikeEvent) => {\n if (event.key !== \"Enter\") return false;\n\n return !event.ctrlKey && !event.metaKey && !event.shiftKey && !event.altKey;\n};\n","import { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport { COMMAND_PRIORITY_HIGH, KEY_DOWN_COMMAND } from \"lexical\";\nimport { useEffect } from \"react\";\nimport { shouldSubmitOnEnter } from \"./keyboard-shortcuts\";\n\nexport interface KeyboardShortcutPluginProps {\n onSubmit?: () => void;\n}\n\nexport function KeyboardShortcutPlugin({ onSubmit }: KeyboardShortcutPluginProps) {\n const [editor] = useLexicalComposerContext();\n\n useEffect(() => {\n return editor.registerCommand(\n KEY_DOWN_COMMAND,\n (event: KeyboardEvent) => {\n if (shouldSubmitOnEnter(event)) {\n event.preventDefault();\n onSubmit?.();\n return true;\n }\n\n return false;\n },\n COMMAND_PRIORITY_HIGH,\n );\n }, [editor, onSubmit]);\n\n return null;\n}\n","import type { MenuOptionGroup } from \"./ReferenceMenuOption\";\n\nexport const menuSortOrder: MenuOptionGroup[] = [\"table\", \"connector\"];\n","import { menuSortOrder } from \"../constants\";\nimport type { MenuOptionGroup, ReferenceMenuOption } from \"../ReferenceMenuOption\";\n\nexport const getSortedMenuOptions = (options: ReferenceMenuOption[]) => {\n const sortedOptions = options\n .sort((a, b) => menuSortOrder.indexOf(a.group) - menuSortOrder.indexOf(b.group))\n .map((option, index) => ({ ...option, index }) as ReferenceMenuOption);\n\n const groupedOptions = sortedOptions.reduce(\n (acc, option) => {\n const bucket = acc[option.group] ?? [];\n bucket.push(option);\n acc[option.group] = bucket;\n return acc;\n },\n {} as Record<MenuOptionGroup, ReferenceMenuOption[]>,\n );\n\n return groupedOptions;\n};\n","import { Flex, Text, Tooltip } from \"@chakra-ui/react\";\n\ninterface ReferenceMenuItemProps {\n id: string;\n isSelected: boolean;\n onClick: () => void;\n onMouseEnter: () => void;\n primaryLabel: string;\n secondaryLabel?: string;\n setRefElement: (element: HTMLDivElement) => void;\n tabIndex: number;\n}\n\nexport function ReferenceMenuItem(props: ReferenceMenuItemProps) {\n const { id, isSelected, onClick, onMouseEnter, setRefElement, secondaryLabel, primaryLabel, tabIndex = -1 } = props;\n\n return (\n <Flex\n direction=\"column\"\n cursor=\"pointer\"\n gap=\"2xs\"\n padding=\"2xs\"\n paddingX=\"sm\"\n bg={isSelected ? \"bg.active\" : \"transparent\"}\n _hover={{ bg: isSelected ? \"bg.active\" : \"bg.hover\" }}\n tabIndex={tabIndex}\n ref={setRefElement}\n role=\"option\"\n aria-selected={isSelected}\n id={id}\n onMouseEnter={onMouseEnter}\n onClick={onClick}\n >\n <Tooltip.Root>\n <Tooltip.Trigger>\n <Text mt=\"1px\" lineClamp={1} textOverflow=\"ellipsis\" textStyle=\"label/M/regular\">\n {primaryLabel}\n </Text>\n </Tooltip.Trigger>\n <Tooltip.Positioner>\n <Tooltip.Content>{primaryLabel}</Tooltip.Content>\n </Tooltip.Positioner>\n </Tooltip.Root>\n {secondaryLabel && (\n <Text lineClamp={2} textOverflow=\"ellipsis\" textStyle=\"label/S/regular\" color=\"fg.muted\">\n {secondaryLabel}\n </Text>\n )}\n </Flex>\n );\n}\n","import { Box, Text } from \"@chakra-ui/react\";\nimport { useEffect } from \"react\";\nimport { ScrollArea } from \"@/components/primitives/scroll-area\";\nimport type { ReferenceMenuOption } from \"../../ReferenceMenuOption\";\nimport { getSortedMenuOptions } from \"../../utils/getSortedMenuOptions\";\nimport { ReferenceMenuItem } from \"./ReferenceMenuItem\";\n\ninterface ReferenceMenuProps {\n options: ReferenceMenuOption[];\n selectedIndex: number | null;\n onSelectItem: (option: ReferenceMenuOption, index: number) => void;\n onMouseEnterItem: (index: number) => void;\n}\n\nexport const ReferenceMenu = (props: ReferenceMenuProps) => {\n const { options, selectedIndex, onSelectItem, onMouseEnterItem } = props;\n const { table = [], connector = [] } = getSortedMenuOptions(options);\n\n const hasResults = [...table, ...connector].length;\n\n /** scroll to the selected item if necessary */\n useEffect(() => {\n document\n .getElementById(`typeahead-item-${selectedIndex}`)\n ?.scrollIntoView({ behavior: \"instant\", block: \"nearest\" });\n }, [selectedIndex]);\n\n return (\n <ScrollArea\n zIndex=\"1000\"\n position=\"absolute\"\n layerStyle=\"modal\"\n maxHeight={\"24rem\"}\n showHorizontalScrollbar={false}\n minWidth={{\n base: \"100vw\",\n md: \"264px\",\n }}\n >\n {!hasResults && <Text>No results</Text>}\n {!!table.length && (\n <>\n <Text paddingTop=\"xs\" paddingBottom=\"2xs\" paddingX=\"sm\" color=\"fg.muted\" textStyle=\"label/S/medium\">\n Tables\n </Text>\n <Box>\n {table.map((option) => {\n return (\n <ReferenceMenuItem\n id={`typeahead-item-${option.index}`}\n isSelected={selectedIndex === option.index}\n onClick={() => onSelectItem(option, option.index)}\n onMouseEnter={() => onMouseEnterItem(option.index)}\n key={option.id}\n primaryLabel={option.name}\n secondaryLabel={option.description}\n setRefElement={option.setRefElement}\n tabIndex={-1}\n />\n );\n })}\n </Box>\n </>\n )}\n {!!connector.length && (\n <>\n <Text paddingTop=\"xs\" paddingBottom=\"2xs\" paddingX=\"sm\" color=\"fg.muted\" textStyle=\"label/S/medium\">\n Data Sources\n </Text>\n <Box>\n {connector.map((option) => {\n return (\n <ReferenceMenuItem\n id={`typeahead-item-${option.index}`}\n isSelected={selectedIndex === option.index}\n onClick={() => onSelectItem(option, option.index)}\n onMouseEnter={() => onMouseEnterItem(option.index)}\n key={option.id}\n primaryLabel={option.name}\n secondaryLabel={option.description}\n setRefElement={option.setRefElement}\n tabIndex={-1}\n />\n );\n })}\n </Box>\n </>\n )}\n </ScrollArea>\n );\n};\n","import type { ReferenceResourceType } from \"../../../prompt-input\";\nimport type { ReferenceMenuOption } from \"../ReferenceMenuOption\";\n\nconst localFilter = (data: ReferenceMenuOption[], q: string) =>\n data.filter((m) => m.name.replace(/ /g, \"_\").toLowerCase().includes(q.toLowerCase()));\n\n/**\n * Search across all resources and menu options\n *\n * @param queryString\n * @returns\n */\nexport function useContextLookup(\n queryString: string | null,\n items: {\n resourceId: string;\n resourceType: ReferenceResourceType;\n name: string;\n description?: string;\n }[] = [],\n) {\n const baseOptions: ReferenceMenuOption[] = items.map(\n (res, index): ReferenceMenuOption => ({\n id: res.resourceId,\n key: res.resourceId,\n index,\n group: res.resourceType,\n name: res.name,\n description: res.description,\n setRefElement: () => {},\n }),\n );\n\n if (queryString == null || queryString === \"\") {\n return baseOptions;\n }\n\n return localFilter(baseOptions, queryString);\n}\n","import type { MenuTextMatch } from \"@lexical/react/LexicalTypeaheadMenuPlugin\";\n\nconst VALID_PUNCTUATION = \"\\\\.\\\\-<>_:\";\nconst TRIGGERS = [\"#\"].join(\"\");\n\nconst VALID_CHARS = `[^${TRIGGERS}${VALID_PUNCTUATION}\\\\s]`;\nconst VALID_JOINS = `(?:[${VALID_PUNCTUATION}]|)`;\n\nconst LENGTH_LIMIT = 75;\n\nconst TriggerRegex = new RegExp(`(^|\\\\s|\\\\()([${TRIGGERS}]((?:${VALID_CHARS}${VALID_JOINS}){0,${LENGTH_LIMIT}}))$`);\n\nconst AliasRegex = new RegExp(`(^|\\\\s|\\\\()([${TRIGGERS}]((?:${VALID_CHARS}){0,${LENGTH_LIMIT}}))$`);\n\n/**\n * lexical will run this function on text nodes\n *\n * @param text\n * @param minMatchLength\n * @returns\n */\nexport function checkForTriggers(text: string, minMatchLength: number): MenuTextMatch | null {\n let match = TriggerRegex.exec(text);\n\n if (match === null) {\n match = AliasRegex.exec(text);\n }\n\n if (match !== null) {\n // The strategy ignores leading whitespace but we need to know it's\n // length to add it to the leadOffset\n const maybeLeadingWhitespace = match[1];\n const matchingString = match[3];\n\n if (matchingString.length >= minMatchLength) {\n return {\n leadOffset: match.index + maybeLeadingWhitespace.length,\n matchingString,\n replaceableString: match[2],\n };\n }\n }\n\n return null;\n}\n","import { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport { LexicalTypeaheadMenuPlugin } from \"@lexical/react/LexicalTypeaheadMenuPlugin\";\nimport type { TextNode } from \"lexical\";\nimport { useState } from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { INSERT_REFERENCE_COMMAND } from \"../../commands\";\nimport type { ReferenceResourceType } from \"../../prompt-input\";\nimport { ReferenceMenu } from \"./components/ReferenceMenu/ReferenceMenu\";\nimport { useContextLookup } from \"./hooks/useContextLookup\";\nimport type { ReferenceMenuOption } from \"./ReferenceMenuOption\";\nimport { checkForTriggers } from \"./utils/checkForTriggers\";\n\nconst SUGGESTION_LIST_LENGTH_LIMIT = 20;\n\ntype Props = {\n items?: Array<{\n resourceId: string;\n resourceType: ReferenceResourceType;\n name: string;\n description?: string;\n }>;\n};\n\nexport function ReferenceMenuPlugin({ items = [] }: Props) {\n const [queryString, setQueryString] = useState<string | null>(null);\n const [editor] = useLexicalComposerContext();\n const searchResults = useContextLookup(queryString, items);\n\n /**\n * triggers when the user selects an option in the context menu\n */\n const onSelectOption = (\n selectedOption: ReferenceMenuOption,\n nodeToReplace: TextNode | null,\n closeMenu: () => void,\n ) => {\n editor.update(() => {\n if (!nodeToReplace) return;\n\n editor.dispatchCommand(INSERT_REFERENCE_COMMAND, {\n resourceId: selectedOption.id,\n resourceType: selectedOption.group,\n name: selectedOption.name,\n nodeToReplace,\n });\n\n closeMenu();\n });\n };\n\n /**\n * checks text nodes and return nodes matching the trigger\n */\n const checkForTrigger = (text: string) => {\n return checkForTriggers(text, 0);\n };\n\n /**\n * define the options to display in the context menu\n */\n const menuOptions = searchResults.slice(0, SUGGESTION_LIST_LENGTH_LIMIT);\n\n return (\n <LexicalTypeaheadMenuPlugin<ReferenceMenuOption>\n onQueryChange={setQueryString}\n onSelectOption={onSelectOption}\n triggerFn={checkForTrigger}\n options={menuOptions}\n menuRenderFn={(anchorElementRef, { options, selectedIndex, selectOptionAndCleanUp, setHighlightedIndex }) => {\n if (!anchorElementRef.current) return null;\n return ReactDOM.createPortal(\n <ReferenceMenu\n options={options}\n selectedIndex={selectedIndex}\n onSelectItem={(option, i) => {\n setHighlightedIndex(i);\n selectOptionAndCleanUp(option);\n }}\n onMouseEnterItem={(i) => {\n setHighlightedIndex(i);\n }}\n />,\n anchorElementRef.current,\n );\n }}\n />\n );\n}\n","import { addClassNamesToElement } from \"@lexical/utils\";\nimport {\n type DOMConversionMap,\n type DOMConversionOutput,\n type DOMExportOutput,\n type EditorConfig,\n type LexicalEditor,\n type NodeKey,\n type SerializedTextNode,\n type Spread,\n TextNode,\n} from \"lexical\";\n\ntype SerializedReferenceNode = Spread<\n {\n referenceId: string;\n name: string;\n },\n SerializedTextNode\n>;\n\nexport class ReferenceNode extends TextNode {\n __referenceId: string;\n __name: string;\n\n static getType(): string {\n return \"reference\";\n }\n\n static clone(node: ReferenceNode): ReferenceNode {\n return new ReferenceNode(node.__referenceId, node.__name, node.__key);\n }\n\n constructor(referenceId: string, name: string, key?: NodeKey) {\n super(name, key);\n this.__referenceId = referenceId;\n this.__name = name;\n }\n\n isKeyboardSelectable(): boolean {\n return false;\n }\n\n canBeEmpty(): boolean {\n return false;\n }\n\n canInsertTextAfter(): boolean {\n return false;\n }\n\n canInsertTextBefore(): boolean {\n return false;\n }\n\n createDOM(config: EditorConfig): HTMLElement {\n const span = document.createElement(\"span\");\n addClassNamesToElement(span, config.theme.reference);\n span.setAttribute(\"data-reference-id\", this.__referenceId);\n span.setAttribute(\"data-name\", this.__name);\n span.textContent = `#${this.__name}`;\n return span;\n }\n\n updateDOM(prevNode: ReferenceNode, dom: HTMLElement): boolean {\n if (prevNode.__name !== this.__name || prevNode.__referenceId !== this.__referenceId) {\n dom.setAttribute(\"data-reference-id\", this.__referenceId);\n dom.setAttribute(\"data-name\", this.__name);\n dom.textContent = `#${this.__name}`;\n }\n\n return false;\n }\n\n exportDOM(_editor: LexicalEditor): DOMExportOutput {\n const el = document.createElement(\"span\");\n el.setAttribute(\"data-reference-id\", this.__referenceId);\n el.setAttribute(\"data-name\", this.__name);\n el.textContent = `#${this.__name}`;\n return { element: el };\n }\n\n static importDOM(): DOMConversionMap | null {\n return {\n span: (domNode: HTMLElement) => {\n if (!domNode.hasAttribute(\"data-reference-id\") || !domNode.hasAttribute(\"data-name\")) {\n return null;\n }\n return {\n conversion: $convertReferenceElement,\n priority: 1,\n };\n },\n };\n }\n\n static importJSON(serializedNode: SerializedReferenceNode): ReferenceNode {\n const node = new ReferenceNode(serializedNode.referenceId, serializedNode.name);\n return node;\n }\n\n exportJSON(): SerializedReferenceNode {\n return {\n ...super.exportJSON(),\n type: \"reference\",\n referenceId: this.__referenceId,\n name: this.__name,\n };\n }\n\n getTextContent(): string {\n return `#${this.__name}`;\n }\n}\n\nfunction $convertReferenceElement(domNode: HTMLElement): DOMConversionOutput | null {\n const referenceId = domNode.getAttribute(\"data-reference-id\");\n const name = domNode.getAttribute(\"data-name\");\n if (!referenceId || !name) return null;\n return { node: $createReferenceNode(referenceId, name) };\n}\n\nexport function $createReferenceNode(referenceId: string, name: string): ReferenceNode {\n return new ReferenceNode(referenceId, name);\n}\n","import { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport { mergeRegister } from \"@lexical/utils\";\nimport { COMMAND_PRIORITY_LOW, type LexicalNode } from \"lexical\";\nimport { type PropsWithChildren, useEffect } from \"react\";\nimport { INSERT_REFERENCE_COMMAND } from \"../../commands\";\nimport type { ReferenceResourceType } from \"../../prompt-input\";\nimport { $createReferenceNode } from \"./nodes/ReferenceNode/ReferenceNode\";\n\nexport const $insertExistingReference = (nodeToReplace: LexicalNode, resourceId: string, name: string) => {\n const refNode = $createReferenceNode(resourceId, name);\n\n if (nodeToReplace) {\n nodeToReplace?.replace(refNode);\n nodeToReplace.remove();\n refNode.selectEnd();\n return;\n }\n};\n\nexport function ReferencePlugin(\n props: PropsWithChildren<{ onAddReference?: (resourceId: string, resourceType: ReferenceResourceType) => void }>,\n) {\n const { onAddReference } = props;\n const [editor] = useLexicalComposerContext();\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand(\n INSERT_REFERENCE_COMMAND,\n (event: {\n resourceId: string;\n resourceType: ReferenceResourceType;\n name: string;\n nodeToReplace: LexicalNode;\n }) => {\n const { resourceId, resourceType, name, nodeToReplace } = event;\n\n editor.update(() => {\n $insertExistingReference(nodeToReplace, resourceId, name);\n });\n\n onAddReference?.(resourceId, resourceType);\n return true;\n },\n COMMAND_PRIORITY_LOW,\n ),\n );\n }, [editor, onAddReference]);\n\n return null;\n}\n","import type { EditorThemeClasses } from \"lexical\";\nimport baseTheme from \"../../theme/rich-text-theme\";\nimport \"./prompt-input-theme.css\";\n\nconst promptInputTheme: EditorThemeClasses = {\n ...baseTheme,\n // Override paragraph class to remove margins specifically for prompt input\n paragraph: \"rich-text__p rich-text__p--no-margin\",\n};\n\nexport default promptInputTheme;\n","import { Flex, Kbd, Text } from \"@chakra-ui/react\";\nimport { MarkNode } from \"@lexical/mark\";\nimport { LexicalComposer } from \"@lexical/react/LexicalComposer\";\nimport { LexicalErrorBoundary } from \"@lexical/react/LexicalErrorBoundary\";\nimport { HistoryPlugin } from \"@lexical/react/LexicalHistoryPlugin\";\nimport { OnChangePlugin } from \"@lexical/react/LexicalOnChangePlugin\";\nimport { RichTextPlugin } from \"@lexical/react/LexicalRichTextPlugin\";\nimport { $getRoot } from \"lexical\";\nimport type { ReactElement } from \"react\";\nimport { type ForwardRefRenderFunction, forwardRef, useRef } from \"react\";\nimport { ContentEditable } from \"../shared/components/content-editable\";\nimport ToggleEditablePlugin from \"../shared/plugins/ToggleEditablePlugin\";\nimport { TreeViewPlugin } from \"../shared/plugins/TreeViewPlugin/TreeViewPlugin\";\nimport { CommentPlugin } from \"./plugins/CommentPlugin/CommentPlugin\";\nimport { CommentNode } from \"./plugins/CommentPlugin/nodes/CommentNode/CommentNode\";\nimport { ImperativeAPIPlugin, type PromptEditorRef } from \"./plugins/ImperativeAPIPlugin\";\nimport { KeyboardShortcutPlugin } from \"./plugins/KeyboardShortcutPlugin\";\nimport { ReferenceMenuPlugin } from \"./plugins/ReferenceMenuPlugin/ReferenceMenuPlugin\";\nimport { ReferenceNode } from \"./plugins/ReferencePlugin/nodes/ReferenceNode/ReferenceNode\";\nimport { ReferencePlugin } from \"./plugins/ReferencePlugin/ReferencePlugin\";\nimport theme from \"./theme/prompt-input-theme\";\nimport { $getTextContent, getTextFromSerializedEditorState } from \"./utils\";\n\nexport type ReferenceResourceType = \"table\" | \"connector\" | \"file\";\n\nexport type ReferenceItem = {\n resourceId: string;\n resourceType: ReferenceResourceType;\n name: string;\n description?: string;\n};\n\nexport interface PromptEditorProps {\n defaultState: string;\n debug?: boolean;\n isEditable?: boolean;\n placeholder?: ReactElement | ((isEditable: boolean) => ReactElement | null);\n onChange?: (text: string, state: object) => void;\n onError?: (error: Error) => void;\n onSubmit?: () => void;\n /** Dynamic list of references (tables, connectors) shown when typing # */\n references?: ReferenceItem[];\n /** Optional app callback when a reference is inserted */\n onAddReference?: (resourceId: string, resourceType: ReferenceResourceType) => void;\n}\n\nconst nodes = [CommentNode, MarkNode, ReferenceNode];\n\nexport const BasePromptEditor: ForwardRefRenderFunction<PromptEditorRef, PromptEditorProps> = (props, ref) => {\n const { defaultState, debug = false, isEditable = true, placeholder } = props;\n const { onChange, onError = () => {}, onSubmit, references = [], onAddReference } = props;\n\n const initialConfig = {\n namespace: \"PROMPT_EDITOR\",\n nodes,\n editorState: defaultState,\n editable: isEditable,\n onError,\n theme,\n };\n\n const previousTextRef = useRef<string>(getTextFromSerializedEditorState(defaultState));\n const placeholderNode: ReactElement | ((isEditable: boolean) => ReactElement | null) = placeholder ?? (\n <Text textStyle=\"label/M/regular\" color=\"fg.subtle\" pointerEvents=\"none\" position=\"absolute\" top=\"0\">\n Type your query here or press <Kbd color=\"fg.subtle\">#</Kbd> to add a reference.\n </Text>\n );\n\n return (\n <Flex direction=\"column\" justifyContent=\"space-between\" width=\"100%\" position=\"relative\">\n <LexicalComposer initialConfig={initialConfig}>\n <HistoryPlugin />\n <RichTextPlugin\n contentEditable={<ContentEditable fullWidth />}\n placeholder={placeholderNode}\n ErrorBoundary={LexicalErrorBoundary}\n />\n <OnChangePlugin\n ignoreSelectionChange\n ignoreHistoryMergeTagChange={false}\n onChange={(editorState) => {\n editorState.read(() => {\n // handle comment blocks properly\n const root = $getRoot();\n const rawText = $getTextContent(root);\n\n if (rawText !== previousTextRef.current) {\n previousTextRef.current = rawText;\n onChange?.(rawText, editorState.toJSON());\n }\n });\n }}\n />\n <ImperativeAPIPlugin editorRef={ref} previousTextRef={previousTextRef} />\n <ToggleEditablePlugin isEditable={isEditable} />\n <CommentPlugin />\n <KeyboardShortcutPlugin onSubmit={onSubmit} />\n <ReferenceMenuPlugin items={references} />\n <ReferencePlugin onAddReference={onAddReference} />\n {debug ? <TreeViewPlugin /> : \"\"}\n </LexicalComposer>\n </Flex>\n );\n};\n\nexport const PromptEditor = forwardRef(BasePromptEditor);\n\nexport type { PromptEditorRef } from \"./plugins/ImperativeAPIPlugin\";\n","import { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport { useEffect } from \"react\";\n\ntype StateUpdatePluginProps = {\n value: string;\n onUpdate: (value: string) => void;\n};\n\nexport default function StateUpdatePlugin({ value, onUpdate }: StateUpdatePluginProps) {\n const [editor] = useLexicalComposerContext();\n\n useEffect(() => {\n if (!editor) {\n return;\n }\n\n editor.update(() => onUpdate(value), { tag: \"history-merge\" });\n }, [value, editor, onUpdate]);\n\n return null;\n}\n","import \"../theme/rich-text-theme.css\";\n\nimport { Flex } from \"@chakra-ui/react\";\nimport { ClickableLinkPlugin } from \"@lexical/react/LexicalClickableLinkPlugin\";\nimport { LexicalComposer } from \"@lexical/react/LexicalComposer\";\nimport { LexicalErrorBoundary } from \"@lexical/react/LexicalErrorBoundary\";\nimport { HorizontalRulePlugin } from \"@lexical/react/LexicalHorizontalRulePlugin\";\nimport { LinkPlugin } from \"@lexical/react/LexicalLinkPlugin\";\nimport { ListPlugin } from \"@lexical/react/LexicalListPlugin\";\nimport { OnChangePlugin } from \"@lexical/react/LexicalOnChangePlugin\";\nimport { RichTextPlugin } from \"@lexical/react/LexicalRichTextPlugin\";\nimport { TabIndentationPlugin } from \"@lexical/react/LexicalTabIndentationPlugin\";\nimport { $addUpdateTag, $getRoot } from \"lexical\";\nimport { useRef } from \"react\";\nimport { ContentEditable } from \"../shared/components/content-editable\";\nimport { editorNodes, editorTheme } from \"../shared/editor-config\";\nimport { createMarkdownSourceDocument } from \"../shared/markdown-source-document\";\nimport type { MarkdownUrlResolver } from \"../shared/markdown-url\";\nimport { MarkdownUrlProvider } from \"../shared/markdown-url-context\";\nimport { ImportCodeBlocksPlugin } from \"../shared/plugins/CodePlugin/CodeBlockPlugin\";\nimport { CodeHighlightingPlugin } from \"../shared/plugins/CodePlugin/CodeHighlightingPlugin\";\nimport { EquationPlugin } from \"../shared/plugins/EquationPlugin/EquationPlugin\";\nimport StateUpdatePlugin from \"../shared/plugins/StateUpdatePlugin\";\nimport ToggleEditablePlugin from \"../shared/plugins/ToggleEditablePlugin\";\nimport { TreeViewPlugin } from \"../shared/plugins/TreeViewPlugin/TreeViewPlugin\";\nimport { splitFrontmatter } from \"../utils/markdown\";\n\nexport interface RichMessageProps {\n debug?: boolean;\n defaultState: string;\n fullWidth?: boolean;\n isEditable?: boolean;\n resolveMarkdownUrl?: MarkdownUrlResolver;\n onChange?: (value: string) => void;\n}\n\nconst SOURCE_IMPORT_TAG = \"markdown-source-import\";\n\nexport function RichMessage(props: RichMessageProps) {\n const {\n debug = false,\n defaultState = \"\",\n fullWidth = false,\n isEditable = false,\n resolveMarkdownUrl,\n onChange,\n } = props;\n const { frontmatter, body } = splitFrontmatter(defaultState);\n const shouldTrackChanges = isEditable && Boolean(onChange);\n const sourceDocumentRef = useRef<ReturnType<typeof createMarkdownSourceDocument> | null>(null);\n sourceDocumentRef.current ??= createMarkdownSourceDocument(body, resolveMarkdownUrl);\n\n const initialConfig = {\n namespace: \"RICH_MESSAGE\",\n nodes: editorNodes,\n editorState: () => {\n $addUpdateTag(SOURCE_IMPORT_TAG);\n sourceDocumentRef.current?.importToLexical();\n },\n onError: (error: Error) => console.error(error),\n editable: isEditable,\n theme: editorTheme,\n };\n\n return (\n <Flex\n className=\"rich-text\"\n data-rich-message=\"true\"\n justifyContent=\"space-between\"\n width=\"100%\"\n maxWidth=\"100%\"\n height=\"100%\"\n position=\"relative\"\n direction=\"column\"\n overflow=\"hidden\"\n >\n <MarkdownUrlProvider resolver={resolveMarkdownUrl}>\n <LexicalComposer initialConfig={initialConfig}>\n <StateUpdatePlugin\n value={body}\n onUpdate={(value: string) => {\n const sourceDocument = createMarkdownSourceDocument(value, resolveMarkdownUrl);\n sourceDocumentRef.current = sourceDocument;\n $addUpdateTag(SOURCE_IMPORT_TAG);\n sourceDocument.importToLexical();\n }}\n />\n <LinkPlugin />\n <ClickableLinkPlugin newTab />\n <ListPlugin />\n {isEditable ? <TabIndentationPlugin maxIndent={7} /> : null}\n <HorizontalRulePlugin />\n <CodeHighlightingPlugin />\n <ImportCodeBlocksPlugin />\n <EquationPlugin />\n <RichTextPlugin\n contentEditable={<ContentEditable fullWidth={fullWidth} isRichMessage />}\n ErrorBoundary={LexicalErrorBoundary}\n />\n {shouldTrackChanges ? (\n <OnChangePlugin\n ignoreSelectionChange\n ignoreHistoryMergeTagChange={false}\n onChange={(editorState, _editor, tags) => {\n if (tags.has(SOURCE_IMPORT_TAG)) return;\n editorState.read(() => {\n const root = $getRoot();\n const markdownBody = sourceDocumentRef.current?.exportFromLexical(root) ?? \"\";\n onChange?.(frontmatter + markdownBody);\n });\n }}\n />\n ) : null}\n <ToggleEditablePlugin isEditable={isEditable} />\n {debug && <TreeViewPlugin />}\n </LexicalComposer>\n </MarkdownUrlProvider>\n </Flex>\n );\n}\n"],"names":["INSERT_REFERENCE","INSERT_BLOCK","INSERT_REFERENCE_COMMAND","createCommand","INSERT_BLOCK_COMMAND","convertCommentElement","element","node","$createCommentNode","style","setFormat","textAlign","CommentNode","ElementNode","getType","clone","__key","createDOM","config","document","createElement","addClassNamesToElement","theme","comment","updateDOM","importDOM","blockquote","conversion","priority","exportDOM","editor","isHTMLElement","isEmpty","append","formatType","getFormatType","direction","getDirection","dir","importJSON","serializedNode","format","setIndent","indent","setDirection","exportJSON","type","getTextContent","replace","insertNewAfter","_","restoreSelection","newBlock","$createParagraphNode","insertAfter","collapseAtStart","paragraph","children","getChildren","forEach","child","insertCommentBlock","_blockType","nodeToReplace","selection","$getSelection","commentNode","nodeParent","getParent","remove","selectEnd","$isRangeSelection","$setBlocksType","useCommentCommands","$","_c","useLexicalComposerContext","t0","t1","mergeRegister","registerCommand","_temp","COMMAND_PRIORITY_LOW","useEffect","event","optionId","useCommentSchema","registerNodeTransform","invalidChildren","filter","length","update","_temp2","child_0","CommentPlugin","$getTextContent","root","textContent","childrenLength","i","$isElementNode","isInline","getReferenceMarker","name","referenceId","shouldAppendParagraphBreak","Boolean","traverseSerializedNode","referenceMarker","text","Array","isArray","getTextFromSerializedEditorState","state","parsed","JSON","parse","emptyEditorState","version","textFormat","undefined","generateEditorStateFromString","input","trim","split","map","line","detail","mode","stringify","ImperativeAPIPlugin","editorRef","previousTextRef","t2","setEditorValue","value","parseEditorState","setEditorState","current","focus","defaultSelection","useImperativeHandle","shouldSubmitOnEnter","key","ctrlKey","metaKey","shiftKey","altKey","KeyboardShortcutPlugin","onSubmit","KEY_DOWN_COMMAND","preventDefault","COMMAND_PRIORITY_HIGH","menuSortOrder","getSortedMenuOptions","options","sort","a","b","indexOf","group","option","index","reduce","acc","bucket","push","ReferenceMenuItem","props","id","isSelected","onClick","onMouseEnter","setRefElement","secondaryLabel","primaryLabel","tabIndex","t3","bg","t4","jsx","Tooltip","Text","t5","t6","t7","t8","Flex","ReferenceMenu","selectedIndex","onSelectItem","onMouseEnterItem","table","connector","hasResults","getElementById","scrollIntoView","behavior","block","T0","ScrollArea","t9","Symbol","for","base","md","t10","t11","jsxs","Fragment","Box","description","t12","option_0","t13","localFilter","data","q","m","toLowerCase","includes","useContextLookup","queryString","items","baseOptions","res","resourceId","resourceType","VALID_PUNCTUATION","TRIGGERS","join","VALID_CHARS","VALID_JOINS","LENGTH_LIMIT","TriggerRegex","RegExp","AliasRegex","checkForTriggers","minMatchLength","match","exec","maybeLeadingWhitespace","matchingString","leadOffset","replaceableString","SUGGESTION_LIST_LENGTH_LIMIT","ReferenceMenuPlugin","setQueryString","useState","searchResults","selectedOption","closeMenu","dispatchCommand","onSelectOption","checkForTrigger","slice","menuOptions","LexicalTypeaheadMenuPlugin","anchorElementRef","selectOptionAndCleanUp","setHighlightedIndex","ReactDOM","createPortal","i_0","ReferenceNode","TextNode","__referenceId","__name","constructor","isKeyboardSelectable","canBeEmpty","canInsertTextAfter","canInsertTextBefore","span","reference","setAttribute","prevNode","dom","_editor","el","domNode","hasAttribute","$convertReferenceElement","getAttribute","$createReferenceNode","$insertExistingReference","refNode","ReferencePlugin","onAddReference","promptInputTheme","baseTheme","nodes","MarkNode","BasePromptEditor","ref","defaultState","debug","isEditable","placeholder","onChange","onError","references","namespace","editorState","editable","initialConfig","useRef","Kbd","placeholderNode","HistoryPlugin","ContentEditable","RichTextPlugin","LexicalErrorBoundary","OnChangePlugin","read","$getRoot","rawText","toJSON","ToggleEditablePlugin","t14","t15","t16","t17","t18","TreeViewPlugin","t19","LexicalComposer","PromptEditor","forwardRef","StateUpdatePlugin","onUpdate","tag","SOURCE_IMPORT_TAG","RichMessage","fullWidth","resolveMarkdownUrl","frontmatter","body","splitFrontmatter","shouldTrackChanges","sourceDocumentRef","createMarkdownSourceDocument","MarkdownUrlProvider","editorNodes","$addUpdateTag","importToLexical","error","console","editorTheme","sourceDocument","LinkPlugin","ClickableLinkPlugin","ListPlugin","TabIndentationPlugin","HorizontalRulePlugin","CodeHighlightingPlugin","ImportCodeBlocksPlugin","EquationPlugin","tags","has","markdownBody","exportFromLexical"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAO,MAAMA,KAAmB,oBACnBC,KAAe,gBCEfC,KAA2BC,GAAcH,EAAgB,GAEzDI,KAAuBD,GAAcF,EAAY;ACa9D,SAASI,GAAsBC,GAA2C;AACxE,QAAMC,IAAOC,EAAAA;AACb,SAAIF,EAAQG,UAAU,QACpBF,EAAKG,UAAUJ,EAAQG,MAAME,SAA8B,GAEtD;AAAA,IAAEJ,MAAAA;AAAAA,EAAAA;AACX;AAEO,MAAMK,UAAoBC,GAAY;AAAA,EAC3C,OAAOC,UAAkB;AACvB,WAAO;AAAA,EACT;AAAA,EAEA,OAAOC,MAAMR,GAAgC;AAC3C,WAAO,IAAIK,EAAYL,EAAKS,KAAK;AAAA,EACnC;AAAA,EAEAC,UAAUC,GAAmC;AAC3C,UAAMZ,IAAUa,SAASC,cAAc,YAAY;AACnDC,WAAAA,GAAuBf,GAASY,EAAOI,MAAMC,OAAO,GAC7Cj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,uBAAU4B,IAAA,CAAA,CAAc;AAAA,EAAA,EAAA,CAC3B,GACF,GACF;AAEJ;"}
1
+ {"version":3,"file":"rich-message-gWYlm8Ji.js","sources":["../src/components/rich-text/prompt-input/events.ts","../src/components/rich-text/prompt-input/commands.ts","../src/components/rich-text/prompt-input/plugins/CommentPlugin/nodes/CommentNode/CommentNode.tsx","../src/components/rich-text/prompt-input/plugins/CommentPlugin/hooks/useCommentCommands.ts","../src/components/rich-text/prompt-input/plugins/CommentPlugin/hooks/useCommentSchema.ts","../src/components/rich-text/prompt-input/plugins/CommentPlugin/CommentPlugin.tsx","../src/components/rich-text/prompt-input/utils.ts","../src/components/rich-text/prompt-input/plugins/ImperativeAPIPlugin.tsx","../src/components/rich-text/prompt-input/plugins/keyboard-shortcuts.ts","../src/components/rich-text/prompt-input/plugins/KeyboardShortcutPlugin.tsx","../src/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/constants.ts","../src/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/utils/getSortedMenuOptions.ts","../src/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/components/ReferenceMenu/ReferenceMenuItem.tsx","../src/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/components/ReferenceMenu/ReferenceMenu.tsx","../src/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/hooks/useContextLookup.tsx","../src/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/utils/checkForTriggers.ts","../src/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/ReferenceMenuPlugin.tsx","../src/components/rich-text/prompt-input/plugins/ReferencePlugin/nodes/ReferenceNode/ReferenceNode.tsx","../src/components/rich-text/prompt-input/plugins/ReferencePlugin/ReferencePlugin.tsx","../src/components/rich-text/prompt-input/theme/prompt-input-theme.ts","../src/components/rich-text/prompt-input/prompt-input.tsx","../src/components/rich-text/shared/plugins/StateUpdatePlugin.tsx","../src/components/rich-text/rich-message/rich-message.tsx"],"sourcesContent":["export const INSERT_REFERENCE = \"INSERT_REFERENCE\";\nexport const INSERT_BLOCK = \"INSERT_BLOCK\";\n","import { createCommand } from \"lexical\";\nimport { INSERT_BLOCK, INSERT_REFERENCE } from \"./events\";\n\nexport const INSERT_REFERENCE_COMMAND = createCommand(INSERT_REFERENCE);\n\nexport const INSERT_BLOCK_COMMAND = createCommand(INSERT_BLOCK);\n","import { addClassNamesToElement } from \"@lexical/utils\";\nimport {\n $createParagraphNode,\n type DOMConversionMap,\n type DOMConversionOutput,\n type DOMExportOutput,\n type EditorConfig,\n type ElementFormatType,\n ElementNode,\n isHTMLElement,\n type LexicalEditor,\n type ParagraphNode,\n type RangeSelection,\n type SerializedElementNode,\n} from \"lexical\";\n\nexport type SerializedCommentNode = SerializedElementNode;\n\nfunction convertCommentElement(element: HTMLElement): DOMConversionOutput {\n const node = $createCommentNode();\n if (element.style !== null) {\n node.setFormat(element.style.textAlign as ElementFormatType);\n }\n return { node };\n}\n\nexport class CommentNode extends ElementNode {\n static getType(): string {\n return \"comment\";\n }\n\n static clone(node: CommentNode): CommentNode {\n return new CommentNode(node.__key);\n }\n\n createDOM(config: EditorConfig): HTMLElement {\n const element = document.createElement(\"blockquote\");\n addClassNamesToElement(element, config.theme.comment);\n return element;\n }\n\n updateDOM(): boolean {\n return false;\n }\n\n static importDOM(): DOMConversionMap | null {\n return {\n blockquote: () => ({\n conversion: convertCommentElement,\n priority: 0,\n }),\n };\n }\n\n exportDOM(editor: LexicalEditor): DOMExportOutput {\n const { element } = super.exportDOM(editor);\n\n if (element && isHTMLElement(element)) {\n if (this.isEmpty()) {\n element.append(document.createElement(\"br\"));\n }\n\n const formatType = this.getFormatType();\n element.style.textAlign = formatType;\n\n const direction = this.getDirection();\n if (direction) {\n element.dir = direction;\n }\n }\n\n return {\n element,\n };\n }\n\n static importJSON(serializedNode: SerializedCommentNode): CommentNode {\n const node = $createCommentNode();\n node.setFormat(serializedNode.format);\n node.setIndent(serializedNode.indent);\n node.setDirection(serializedNode.direction);\n return node;\n }\n\n exportJSON(): SerializedElementNode {\n return {\n ...super.exportJSON(),\n type: \"comment\",\n };\n }\n\n getTextContent(): string {\n const originalText = super.getTextContent();\n // escape { and } symbols\n const withEscapedReferences = originalText.replace(/([{}])/g, \"\\\\$1\");\n return `{{! ${withEscapedReferences} }}`;\n }\n\n // mutation\n\n insertNewAfter(_: RangeSelection, restoreSelection?: boolean): ParagraphNode {\n const newBlock = $createParagraphNode();\n const direction = this.getDirection();\n newBlock.setDirection(direction);\n this.insertAfter(newBlock, restoreSelection);\n return newBlock;\n }\n\n collapseAtStart(): true {\n const paragraph = $createParagraphNode();\n const children = this.getChildren();\n children.forEach((child) => {\n paragraph.append(child);\n });\n this.replace(paragraph);\n return true;\n }\n}\n\nexport function $createCommentNode(): CommentNode {\n return new CommentNode();\n}\n","import { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport { $setBlocksType } from \"@lexical/selection\";\nimport { mergeRegister } from \"@lexical/utils\";\nimport { $getSelection, $isRangeSelection, COMMAND_PRIORITY_LOW, type TextNode } from \"lexical\";\nimport { useEffect } from \"react\";\nimport { INSERT_BLOCK_COMMAND } from \"../../../commands\";\nimport { $createCommentNode } from \"../nodes/CommentNode/CommentNode\";\n\nexport const insertCommentBlock = (_blockType: string, nodeToReplace?: TextNode) => {\n const selection = $getSelection();\n const commentNode = $createCommentNode();\n\n if (nodeToReplace) {\n const nodeParent = nodeToReplace.getParent();\n nodeParent?.replace(commentNode, true);\n nodeToReplace.remove();\n commentNode.selectEnd();\n return;\n }\n\n if ($isRangeSelection(selection)) {\n $setBlocksType(selection, $createCommentNode);\n }\n};\n\ntype InsertBlockEvent = {\n optionId: string;\n nodeToReplace?: TextNode;\n};\n\nexport function useCommentCommands(): null {\n const [editor] = useLexicalComposerContext();\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand(\n INSERT_BLOCK_COMMAND,\n (event: InsertBlockEvent) => {\n const { optionId, nodeToReplace } = event;\n insertCommentBlock(optionId, nodeToReplace);\n return false;\n },\n COMMAND_PRIORITY_LOW,\n ),\n );\n }, [editor]);\n\n return null;\n}\n","import { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport { mergeRegister } from \"@lexical/utils\";\nimport { $createParagraphNode } from \"lexical\";\nimport { useEffect } from \"react\";\nimport { CommentNode } from \"../nodes/CommentNode/CommentNode\";\n\nexport const useCommentSchema = () => {\n const [editor] = useLexicalComposerContext();\n\n useEffect(() => {\n return mergeRegister(\n editor.registerNodeTransform(CommentNode, (node) => {\n const children = node.getChildren();\n\n /**\n * Comment nodes cannot have other comments as children\n */\n const invalidChildren = children.filter((child) => child.getType() === \"comment\");\n\n if (invalidChildren.length > 0) {\n editor.update(() => {\n invalidChildren.forEach((child) => {\n child.replace($createParagraphNode(), true);\n });\n });\n }\n }),\n );\n }, [editor]);\n};\n","import { useCommentCommands } from \"./hooks/useCommentCommands\";\nimport { useCommentSchema } from \"./hooks/useCommentSchema\";\n\nexport function CommentPlugin(): null {\n useCommentSchema();\n useCommentCommands();\n return null;\n}\n","import { $isElementNode, type RootNode } from \"lexical\";\n\nexport const $getTextContent = (root: RootNode) => {\n let textContent = \"\";\n const children = root.getChildren();\n const childrenLength = children.length;\n for (let i = 0; i < childrenLength; i++) {\n const child = children[i];\n textContent += child.getTextContent();\n if ($isElementNode(child) && i !== childrenLength - 1 && !child.isInline()) {\n textContent += \"\\n\";\n }\n }\n return textContent;\n};\n\ntype SerializedNode = {\n type?: string;\n text?: string;\n name?: string;\n referenceId?: string;\n children?: SerializedNode[];\n};\n\ntype SerializedRoot = {\n root?: SerializedNode;\n};\n\nconst getReferenceMarker = (node: SerializedNode) => {\n if (node.type !== \"reference\") return null;\n return `#${node.name ?? node.referenceId ?? \"\"}`;\n};\n\nconst shouldAppendParagraphBreak = (node: SerializedNode) => {\n return node.type === \"paragraph\" && Boolean(node.children?.length);\n};\n\nconst traverseSerializedNode = (node: SerializedNode): string => {\n if (node.type === \"comment\") {\n return \"\";\n }\n\n const referenceMarker = getReferenceMarker(node);\n if (referenceMarker !== null) {\n return referenceMarker;\n }\n\n let text = typeof node.text === \"string\" ? node.text : \"\";\n const children = node.children;\n if (!Array.isArray(children)) return text;\n\n const childrenLength = children.length;\n for (let i = 0; i < childrenLength; i += 1) {\n const child = children[i];\n if (child.type === \"comment\") {\n if (i !== childrenLength - 1) {\n text += \"\\n\";\n }\n continue;\n }\n\n text += traverseSerializedNode(child);\n if (shouldAppendParagraphBreak(child)) {\n text += \"\\n\";\n }\n }\n\n return text;\n};\n\nexport const getTextFromSerializedEditorState = (state: string): string => {\n try {\n const parsed = JSON.parse(state) as SerializedRoot;\n return traverseSerializedNode(parsed.root ?? {});\n } catch {\n return \"\";\n }\n};\n\nexport const emptyEditorState = {\n root: {\n direction: \"ltr\",\n format: \"\",\n indent: 0,\n type: \"root\",\n version: 1,\n children: [\n {\n type: \"paragraph\",\n version: 1,\n format: \"\",\n indent: 0,\n textFormat: undefined,\n direction: null,\n children: [],\n },\n ],\n },\n};\n\nexport function generateEditorStateFromString(input = \"\") {\n if (!input.trim()) {\n return JSON.parse(JSON.stringify(emptyEditorState));\n }\n\n // Split on line breaks → one paragraph per line\n const paragraphs = input.split(/\\r?\\n/);\n\n const children = paragraphs.map((line) => ({\n type: \"paragraph\",\n version: 1,\n format: \"\",\n indent: 0,\n textFormat: undefined,\n direction: null,\n children: line\n ? [\n {\n type: \"text\",\n version: 1,\n text: line,\n format: \"\",\n detail: 0,\n mode: \"normal\",\n style: \"\",\n },\n ]\n : [],\n }));\n\n return {\n root: {\n direction: \"ltr\",\n format: \"\",\n indent: 0,\n type: \"root\",\n version: 1,\n children,\n },\n };\n}\n","import { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport { useImperativeHandle } from \"react\";\nimport { generateEditorStateFromString, getTextFromSerializedEditorState } from \"../utils\";\n\nexport interface PromptEditorRef {\n setEditorValue: (value: string) => void;\n}\n\nexport function ImperativeAPIPlugin({\n editorRef,\n previousTextRef,\n}: {\n editorRef: React.ForwardedRef<PromptEditorRef>;\n previousTextRef: React.MutableRefObject<string>;\n}) {\n const [editor] = useLexicalComposerContext();\n\n useImperativeHandle(\n editorRef,\n () => ({\n setEditorValue: (value: string) => {\n const state = editor.parseEditorState(JSON.stringify(generateEditorStateFromString(value)));\n editor.setEditorState(state);\n previousTextRef.current = getTextFromSerializedEditorState(value);\n editor.focus(undefined, { defaultSelection: \"rootEnd\" });\n },\n }),\n [editor, previousTextRef],\n );\n\n return null;\n}\n","type KeyDownLikeEvent = {\n key: string;\n ctrlKey: boolean;\n metaKey: boolean;\n shiftKey: boolean;\n altKey: boolean;\n};\n\nexport const shouldSubmitOnEnter = (event: KeyDownLikeEvent) => {\n if (event.key !== \"Enter\") return false;\n\n return !event.ctrlKey && !event.metaKey && !event.shiftKey && !event.altKey;\n};\n","import { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport { COMMAND_PRIORITY_HIGH, KEY_DOWN_COMMAND } from \"lexical\";\nimport { useEffect } from \"react\";\nimport { shouldSubmitOnEnter } from \"./keyboard-shortcuts\";\n\nexport interface KeyboardShortcutPluginProps {\n onSubmit?: () => void;\n}\n\nexport function KeyboardShortcutPlugin({ onSubmit }: KeyboardShortcutPluginProps) {\n const [editor] = useLexicalComposerContext();\n\n useEffect(() => {\n return editor.registerCommand(\n KEY_DOWN_COMMAND,\n (event: KeyboardEvent) => {\n if (shouldSubmitOnEnter(event)) {\n event.preventDefault();\n onSubmit?.();\n return true;\n }\n\n return false;\n },\n COMMAND_PRIORITY_HIGH,\n );\n }, [editor, onSubmit]);\n\n return null;\n}\n","import type { MenuOptionGroup } from \"./ReferenceMenuOption\";\n\nexport const menuSortOrder: MenuOptionGroup[] = [\"table\", \"connector\"];\n","import { menuSortOrder } from \"../constants\";\nimport type { MenuOptionGroup, ReferenceMenuOption } from \"../ReferenceMenuOption\";\n\nexport const getSortedMenuOptions = (options: ReferenceMenuOption[]) => {\n const sortedOptions = options\n .sort((a, b) => menuSortOrder.indexOf(a.group) - menuSortOrder.indexOf(b.group))\n .map((option, index) => ({ ...option, index }) as ReferenceMenuOption);\n\n const groupedOptions = sortedOptions.reduce(\n (acc, option) => {\n const bucket = acc[option.group] ?? [];\n bucket.push(option);\n acc[option.group] = bucket;\n return acc;\n },\n {} as Record<MenuOptionGroup, ReferenceMenuOption[]>,\n );\n\n return groupedOptions;\n};\n","import { Flex, Text, Tooltip } from \"@chakra-ui/react\";\n\ninterface ReferenceMenuItemProps {\n id: string;\n isSelected: boolean;\n onClick: () => void;\n onMouseEnter: () => void;\n primaryLabel: string;\n secondaryLabel?: string;\n setRefElement: (element: HTMLDivElement) => void;\n tabIndex: number;\n}\n\nexport function ReferenceMenuItem(props: ReferenceMenuItemProps) {\n const { id, isSelected, onClick, onMouseEnter, setRefElement, secondaryLabel, primaryLabel, tabIndex = -1 } = props;\n\n return (\n <Flex\n direction=\"column\"\n cursor=\"pointer\"\n gap=\"2xs\"\n padding=\"2xs\"\n paddingX=\"sm\"\n bg={isSelected ? \"bg.active\" : \"transparent\"}\n _hover={{ bg: isSelected ? \"bg.active\" : \"bg.hover\" }}\n tabIndex={tabIndex}\n ref={setRefElement}\n role=\"option\"\n aria-selected={isSelected}\n id={id}\n onMouseEnter={onMouseEnter}\n onClick={onClick}\n >\n <Tooltip.Root>\n <Tooltip.Trigger>\n <Text mt=\"1px\" lineClamp={1} textOverflow=\"ellipsis\" textStyle=\"label/M/regular\">\n {primaryLabel}\n </Text>\n </Tooltip.Trigger>\n <Tooltip.Positioner>\n <Tooltip.Content>{primaryLabel}</Tooltip.Content>\n </Tooltip.Positioner>\n </Tooltip.Root>\n {secondaryLabel && (\n <Text lineClamp={2} textOverflow=\"ellipsis\" textStyle=\"label/S/regular\" color=\"fg.muted\">\n {secondaryLabel}\n </Text>\n )}\n </Flex>\n );\n}\n","import { Box, Text } from \"@chakra-ui/react\";\nimport { useEffect } from \"react\";\nimport { ScrollArea } from \"@/components/primitives/scroll-area\";\nimport type { ReferenceMenuOption } from \"../../ReferenceMenuOption\";\nimport { getSortedMenuOptions } from \"../../utils/getSortedMenuOptions\";\nimport { ReferenceMenuItem } from \"./ReferenceMenuItem\";\n\ninterface ReferenceMenuProps {\n options: ReferenceMenuOption[];\n selectedIndex: number | null;\n onSelectItem: (option: ReferenceMenuOption, index: number) => void;\n onMouseEnterItem: (index: number) => void;\n}\n\nexport const ReferenceMenu = (props: ReferenceMenuProps) => {\n const { options, selectedIndex, onSelectItem, onMouseEnterItem } = props;\n const { table = [], connector = [] } = getSortedMenuOptions(options);\n\n const hasResults = [...table, ...connector].length;\n\n /** scroll to the selected item if necessary */\n useEffect(() => {\n document\n .getElementById(`typeahead-item-${selectedIndex}`)\n ?.scrollIntoView({ behavior: \"instant\", block: \"nearest\" });\n }, [selectedIndex]);\n\n return (\n <ScrollArea\n zIndex=\"1000\"\n position=\"absolute\"\n layerStyle=\"modal\"\n maxHeight={\"24rem\"}\n showHorizontalScrollbar={false}\n minWidth={{\n base: \"100vw\",\n md: \"264px\",\n }}\n >\n {!hasResults && <Text>No results</Text>}\n {!!table.length && (\n <>\n <Text paddingTop=\"xs\" paddingBottom=\"2xs\" paddingX=\"sm\" color=\"fg.muted\" textStyle=\"label/S/medium\">\n Tables\n </Text>\n <Box>\n {table.map((option) => {\n return (\n <ReferenceMenuItem\n id={`typeahead-item-${option.index}`}\n isSelected={selectedIndex === option.index}\n onClick={() => onSelectItem(option, option.index)}\n onMouseEnter={() => onMouseEnterItem(option.index)}\n key={option.id}\n primaryLabel={option.name}\n secondaryLabel={option.description}\n setRefElement={option.setRefElement}\n tabIndex={-1}\n />\n );\n })}\n </Box>\n </>\n )}\n {!!connector.length && (\n <>\n <Text paddingTop=\"xs\" paddingBottom=\"2xs\" paddingX=\"sm\" color=\"fg.muted\" textStyle=\"label/S/medium\">\n Data Sources\n </Text>\n <Box>\n {connector.map((option) => {\n return (\n <ReferenceMenuItem\n id={`typeahead-item-${option.index}`}\n isSelected={selectedIndex === option.index}\n onClick={() => onSelectItem(option, option.index)}\n onMouseEnter={() => onMouseEnterItem(option.index)}\n key={option.id}\n primaryLabel={option.name}\n secondaryLabel={option.description}\n setRefElement={option.setRefElement}\n tabIndex={-1}\n />\n );\n })}\n </Box>\n </>\n )}\n </ScrollArea>\n );\n};\n","import type { ReferenceResourceType } from \"../../../prompt-input\";\nimport type { ReferenceMenuOption } from \"../ReferenceMenuOption\";\n\nconst localFilter = (data: ReferenceMenuOption[], q: string) =>\n data.filter((m) => m.name.replace(/ /g, \"_\").toLowerCase().includes(q.toLowerCase()));\n\n/**\n * Search across all resources and menu options\n *\n * @param queryString\n * @returns\n */\nexport function useContextLookup(\n queryString: string | null,\n items: {\n resourceId: string;\n resourceType: ReferenceResourceType;\n name: string;\n description?: string;\n }[] = [],\n) {\n const baseOptions: ReferenceMenuOption[] = items.map(\n (res, index): ReferenceMenuOption => ({\n id: res.resourceId,\n key: res.resourceId,\n index,\n group: res.resourceType,\n name: res.name,\n description: res.description,\n setRefElement: () => {},\n }),\n );\n\n if (queryString == null || queryString === \"\") {\n return baseOptions;\n }\n\n return localFilter(baseOptions, queryString);\n}\n","import type { MenuTextMatch } from \"@lexical/react/LexicalTypeaheadMenuPlugin\";\n\nconst VALID_PUNCTUATION = \"\\\\.\\\\-<>_:\";\nconst TRIGGERS = [\"#\"].join(\"\");\n\nconst VALID_CHARS = `[^${TRIGGERS}${VALID_PUNCTUATION}\\\\s]`;\nconst VALID_JOINS = `(?:[${VALID_PUNCTUATION}]|)`;\n\nconst LENGTH_LIMIT = 75;\n\nconst TriggerRegex = new RegExp(`(^|\\\\s|\\\\()([${TRIGGERS}]((?:${VALID_CHARS}${VALID_JOINS}){0,${LENGTH_LIMIT}}))$`);\n\nconst AliasRegex = new RegExp(`(^|\\\\s|\\\\()([${TRIGGERS}]((?:${VALID_CHARS}){0,${LENGTH_LIMIT}}))$`);\n\n/**\n * lexical will run this function on text nodes\n *\n * @param text\n * @param minMatchLength\n * @returns\n */\nexport function checkForTriggers(text: string, minMatchLength: number): MenuTextMatch | null {\n let match = TriggerRegex.exec(text);\n\n if (match === null) {\n match = AliasRegex.exec(text);\n }\n\n if (match !== null) {\n // The strategy ignores leading whitespace but we need to know it's\n // length to add it to the leadOffset\n const maybeLeadingWhitespace = match[1];\n const matchingString = match[3];\n\n if (matchingString.length >= minMatchLength) {\n return {\n leadOffset: match.index + maybeLeadingWhitespace.length,\n matchingString,\n replaceableString: match[2],\n };\n }\n }\n\n return null;\n}\n","import { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport { LexicalTypeaheadMenuPlugin } from \"@lexical/react/LexicalTypeaheadMenuPlugin\";\nimport type { TextNode } from \"lexical\";\nimport { useState } from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { INSERT_REFERENCE_COMMAND } from \"../../commands\";\nimport type { ReferenceResourceType } from \"../../prompt-input\";\nimport { ReferenceMenu } from \"./components/ReferenceMenu/ReferenceMenu\";\nimport { useContextLookup } from \"./hooks/useContextLookup\";\nimport type { ReferenceMenuOption } from \"./ReferenceMenuOption\";\nimport { checkForTriggers } from \"./utils/checkForTriggers\";\n\nconst SUGGESTION_LIST_LENGTH_LIMIT = 20;\n\ntype Props = {\n items?: Array<{\n resourceId: string;\n resourceType: ReferenceResourceType;\n name: string;\n description?: string;\n }>;\n};\n\nexport function ReferenceMenuPlugin({ items = [] }: Props) {\n const [queryString, setQueryString] = useState<string | null>(null);\n const [editor] = useLexicalComposerContext();\n const searchResults = useContextLookup(queryString, items);\n\n /**\n * triggers when the user selects an option in the context menu\n */\n const onSelectOption = (\n selectedOption: ReferenceMenuOption,\n nodeToReplace: TextNode | null,\n closeMenu: () => void,\n ) => {\n editor.update(() => {\n if (!nodeToReplace) return;\n\n editor.dispatchCommand(INSERT_REFERENCE_COMMAND, {\n resourceId: selectedOption.id,\n resourceType: selectedOption.group,\n name: selectedOption.name,\n nodeToReplace,\n });\n\n closeMenu();\n });\n };\n\n /**\n * checks text nodes and return nodes matching the trigger\n */\n const checkForTrigger = (text: string) => {\n return checkForTriggers(text, 0);\n };\n\n /**\n * define the options to display in the context menu\n */\n const menuOptions = searchResults.slice(0, SUGGESTION_LIST_LENGTH_LIMIT);\n\n return (\n <LexicalTypeaheadMenuPlugin<ReferenceMenuOption>\n onQueryChange={setQueryString}\n onSelectOption={onSelectOption}\n triggerFn={checkForTrigger}\n options={menuOptions}\n menuRenderFn={(anchorElementRef, { options, selectedIndex, selectOptionAndCleanUp, setHighlightedIndex }) => {\n if (!anchorElementRef.current) return null;\n return ReactDOM.createPortal(\n <ReferenceMenu\n options={options}\n selectedIndex={selectedIndex}\n onSelectItem={(option, i) => {\n setHighlightedIndex(i);\n selectOptionAndCleanUp(option);\n }}\n onMouseEnterItem={(i) => {\n setHighlightedIndex(i);\n }}\n />,\n anchorElementRef.current,\n );\n }}\n />\n );\n}\n","import { addClassNamesToElement } from \"@lexical/utils\";\nimport {\n type DOMConversionMap,\n type DOMConversionOutput,\n type DOMExportOutput,\n type EditorConfig,\n type LexicalEditor,\n type NodeKey,\n type SerializedTextNode,\n type Spread,\n TextNode,\n} from \"lexical\";\n\ntype SerializedReferenceNode = Spread<\n {\n referenceId: string;\n name: string;\n },\n SerializedTextNode\n>;\n\nexport class ReferenceNode extends TextNode {\n __referenceId: string;\n __name: string;\n\n static getType(): string {\n return \"reference\";\n }\n\n static clone(node: ReferenceNode): ReferenceNode {\n return new ReferenceNode(node.__referenceId, node.__name, node.__key);\n }\n\n constructor(referenceId: string, name: string, key?: NodeKey) {\n super(name, key);\n this.__referenceId = referenceId;\n this.__name = name;\n }\n\n isKeyboardSelectable(): boolean {\n return false;\n }\n\n canBeEmpty(): boolean {\n return false;\n }\n\n canInsertTextAfter(): boolean {\n return false;\n }\n\n canInsertTextBefore(): boolean {\n return false;\n }\n\n createDOM(config: EditorConfig): HTMLElement {\n const span = document.createElement(\"span\");\n addClassNamesToElement(span, config.theme.reference);\n span.setAttribute(\"data-reference-id\", this.__referenceId);\n span.setAttribute(\"data-name\", this.__name);\n span.textContent = `#${this.__name}`;\n return span;\n }\n\n updateDOM(prevNode: ReferenceNode, dom: HTMLElement): boolean {\n if (prevNode.__name !== this.__name || prevNode.__referenceId !== this.__referenceId) {\n dom.setAttribute(\"data-reference-id\", this.__referenceId);\n dom.setAttribute(\"data-name\", this.__name);\n dom.textContent = `#${this.__name}`;\n }\n\n return false;\n }\n\n exportDOM(_editor: LexicalEditor): DOMExportOutput {\n const el = document.createElement(\"span\");\n el.setAttribute(\"data-reference-id\", this.__referenceId);\n el.setAttribute(\"data-name\", this.__name);\n el.textContent = `#${this.__name}`;\n return { element: el };\n }\n\n static importDOM(): DOMConversionMap | null {\n return {\n span: (domNode: HTMLElement) => {\n if (!domNode.hasAttribute(\"data-reference-id\") || !domNode.hasAttribute(\"data-name\")) {\n return null;\n }\n return {\n conversion: $convertReferenceElement,\n priority: 1,\n };\n },\n };\n }\n\n static importJSON(serializedNode: SerializedReferenceNode): ReferenceNode {\n const node = new ReferenceNode(serializedNode.referenceId, serializedNode.name);\n return node;\n }\n\n exportJSON(): SerializedReferenceNode {\n return {\n ...super.exportJSON(),\n type: \"reference\",\n referenceId: this.__referenceId,\n name: this.__name,\n };\n }\n\n getTextContent(): string {\n return `#${this.__name}`;\n }\n}\n\nfunction $convertReferenceElement(domNode: HTMLElement): DOMConversionOutput | null {\n const referenceId = domNode.getAttribute(\"data-reference-id\");\n const name = domNode.getAttribute(\"data-name\");\n if (!referenceId || !name) return null;\n return { node: $createReferenceNode(referenceId, name) };\n}\n\nexport function $createReferenceNode(referenceId: string, name: string): ReferenceNode {\n return new ReferenceNode(referenceId, name);\n}\n","import { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport { mergeRegister } from \"@lexical/utils\";\nimport { COMMAND_PRIORITY_LOW, type LexicalNode } from \"lexical\";\nimport { type PropsWithChildren, useEffect } from \"react\";\nimport { INSERT_REFERENCE_COMMAND } from \"../../commands\";\nimport type { ReferenceResourceType } from \"../../prompt-input\";\nimport { $createReferenceNode } from \"./nodes/ReferenceNode/ReferenceNode\";\n\nexport const $insertExistingReference = (nodeToReplace: LexicalNode, resourceId: string, name: string) => {\n const refNode = $createReferenceNode(resourceId, name);\n\n if (nodeToReplace) {\n nodeToReplace?.replace(refNode);\n nodeToReplace.remove();\n refNode.selectEnd();\n return;\n }\n};\n\nexport function ReferencePlugin(\n props: PropsWithChildren<{ onAddReference?: (resourceId: string, resourceType: ReferenceResourceType) => void }>,\n) {\n const { onAddReference } = props;\n const [editor] = useLexicalComposerContext();\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand(\n INSERT_REFERENCE_COMMAND,\n (event: {\n resourceId: string;\n resourceType: ReferenceResourceType;\n name: string;\n nodeToReplace: LexicalNode;\n }) => {\n const { resourceId, resourceType, name, nodeToReplace } = event;\n\n editor.update(() => {\n $insertExistingReference(nodeToReplace, resourceId, name);\n });\n\n onAddReference?.(resourceId, resourceType);\n return true;\n },\n COMMAND_PRIORITY_LOW,\n ),\n );\n }, [editor, onAddReference]);\n\n return null;\n}\n","import type { EditorThemeClasses } from \"lexical\";\nimport baseTheme from \"../../theme/rich-text-theme\";\nimport \"./prompt-input-theme.css\";\n\nconst promptInputTheme: EditorThemeClasses = {\n ...baseTheme,\n // Override paragraph class to remove margins specifically for prompt input\n paragraph: \"rich-text__p rich-text__p--no-margin\",\n};\n\nexport default promptInputTheme;\n","import { Flex, Kbd, Text } from \"@chakra-ui/react\";\nimport { MarkNode } from \"@lexical/mark\";\nimport { LexicalComposer } from \"@lexical/react/LexicalComposer\";\nimport { LexicalErrorBoundary } from \"@lexical/react/LexicalErrorBoundary\";\nimport { HistoryPlugin } from \"@lexical/react/LexicalHistoryPlugin\";\nimport { OnChangePlugin } from \"@lexical/react/LexicalOnChangePlugin\";\nimport { RichTextPlugin } from \"@lexical/react/LexicalRichTextPlugin\";\nimport { $getRoot } from \"lexical\";\nimport type { ReactElement } from \"react\";\nimport { type ForwardRefRenderFunction, forwardRef, useRef } from \"react\";\nimport { ContentEditable } from \"../shared/components/content-editable\";\nimport ToggleEditablePlugin from \"../shared/plugins/ToggleEditablePlugin\";\nimport { TreeViewPlugin } from \"../shared/plugins/TreeViewPlugin/TreeViewPlugin\";\nimport { CommentPlugin } from \"./plugins/CommentPlugin/CommentPlugin\";\nimport { CommentNode } from \"./plugins/CommentPlugin/nodes/CommentNode/CommentNode\";\nimport { ImperativeAPIPlugin, type PromptEditorRef } from \"./plugins/ImperativeAPIPlugin\";\nimport { KeyboardShortcutPlugin } from \"./plugins/KeyboardShortcutPlugin\";\nimport { ReferenceMenuPlugin } from \"./plugins/ReferenceMenuPlugin/ReferenceMenuPlugin\";\nimport { ReferenceNode } from \"./plugins/ReferencePlugin/nodes/ReferenceNode/ReferenceNode\";\nimport { ReferencePlugin } from \"./plugins/ReferencePlugin/ReferencePlugin\";\nimport theme from \"./theme/prompt-input-theme\";\nimport { $getTextContent, getTextFromSerializedEditorState } from \"./utils\";\n\nexport type ReferenceResourceType = \"table\" | \"connector\" | \"file\";\n\nexport type ReferenceItem = {\n resourceId: string;\n resourceType: ReferenceResourceType;\n name: string;\n description?: string;\n};\n\nexport interface PromptEditorProps {\n defaultState: string;\n debug?: boolean;\n isEditable?: boolean;\n placeholder?: ReactElement | ((isEditable: boolean) => ReactElement | null);\n onChange?: (text: string, state: object) => void;\n onError?: (error: Error) => void;\n onSubmit?: () => void;\n /** Dynamic list of references (tables, connectors) shown when typing # */\n references?: ReferenceItem[];\n /** Optional app callback when a reference is inserted */\n onAddReference?: (resourceId: string, resourceType: ReferenceResourceType) => void;\n}\n\nconst nodes = [CommentNode, MarkNode, ReferenceNode];\n\nexport const BasePromptEditor: ForwardRefRenderFunction<PromptEditorRef, PromptEditorProps> = (props, ref) => {\n const { defaultState, debug = false, isEditable = true, placeholder } = props;\n const { onChange, onError = () => {}, onSubmit, references = [], onAddReference } = props;\n\n const initialConfig = {\n namespace: \"PROMPT_EDITOR\",\n nodes,\n editorState: defaultState,\n editable: isEditable,\n onError,\n theme,\n };\n\n const previousTextRef = useRef<string>(getTextFromSerializedEditorState(defaultState));\n const placeholderNode: ReactElement | ((isEditable: boolean) => ReactElement | null) = placeholder ?? (\n <Text textStyle=\"label/M/regular\" color=\"fg.subtle\" pointerEvents=\"none\" position=\"absolute\" top=\"0\">\n Type your query here or press <Kbd color=\"fg.subtle\">#</Kbd> to add a reference.\n </Text>\n );\n\n return (\n <Flex direction=\"column\" justifyContent=\"space-between\" width=\"100%\" position=\"relative\">\n <LexicalComposer initialConfig={initialConfig}>\n <HistoryPlugin />\n <RichTextPlugin\n contentEditable={<ContentEditable fullWidth />}\n placeholder={placeholderNode}\n ErrorBoundary={LexicalErrorBoundary}\n />\n <OnChangePlugin\n ignoreSelectionChange\n ignoreHistoryMergeTagChange={false}\n onChange={(editorState) => {\n editorState.read(() => {\n // handle comment blocks properly\n const root = $getRoot();\n const rawText = $getTextContent(root);\n\n if (rawText !== previousTextRef.current) {\n previousTextRef.current = rawText;\n onChange?.(rawText, editorState.toJSON());\n }\n });\n }}\n />\n <ImperativeAPIPlugin editorRef={ref} previousTextRef={previousTextRef} />\n <ToggleEditablePlugin isEditable={isEditable} />\n <CommentPlugin />\n <KeyboardShortcutPlugin onSubmit={onSubmit} />\n <ReferenceMenuPlugin items={references} />\n <ReferencePlugin onAddReference={onAddReference} />\n {debug ? <TreeViewPlugin /> : \"\"}\n </LexicalComposer>\n </Flex>\n );\n};\n\nexport const PromptEditor = forwardRef(BasePromptEditor);\n\nexport type { PromptEditorRef } from \"./plugins/ImperativeAPIPlugin\";\n","import { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport { useEffect } from \"react\";\n\ntype StateUpdatePluginProps = {\n value: string;\n onUpdate: (value: string) => void;\n};\n\nexport default function StateUpdatePlugin({ value, onUpdate }: StateUpdatePluginProps) {\n const [editor] = useLexicalComposerContext();\n\n useEffect(() => {\n if (!editor) {\n return;\n }\n\n editor.update(() => onUpdate(value), { tag: \"history-merge\" });\n }, [value, editor, onUpdate]);\n\n return null;\n}\n","import \"../theme/rich-text-theme.css\";\n\nimport { Flex } from \"@chakra-ui/react\";\nimport { ClickableLinkPlugin } from \"@lexical/react/LexicalClickableLinkPlugin\";\nimport { LexicalComposer } from \"@lexical/react/LexicalComposer\";\nimport { LexicalErrorBoundary } from \"@lexical/react/LexicalErrorBoundary\";\nimport { HorizontalRulePlugin } from \"@lexical/react/LexicalHorizontalRulePlugin\";\nimport { LinkPlugin } from \"@lexical/react/LexicalLinkPlugin\";\nimport { ListPlugin } from \"@lexical/react/LexicalListPlugin\";\nimport { OnChangePlugin } from \"@lexical/react/LexicalOnChangePlugin\";\nimport { RichTextPlugin } from \"@lexical/react/LexicalRichTextPlugin\";\nimport { TabIndentationPlugin } from \"@lexical/react/LexicalTabIndentationPlugin\";\nimport { $addUpdateTag, $getRoot } from \"lexical\";\nimport { useRef } from \"react\";\nimport { ContentEditable } from \"../shared/components/content-editable\";\nimport { editorNodes, editorTheme } from \"../shared/editor-config\";\nimport { createMarkdownSourceDocument } from \"../shared/markdown-source-document\";\nimport type { MarkdownUrlResolver } from \"../shared/markdown-url\";\nimport { MarkdownUrlProvider } from \"../shared/markdown-url-context\";\nimport { ImportCodeBlocksPlugin } from \"../shared/plugins/CodePlugin/CodeBlockPlugin\";\nimport { CodeHighlightingPlugin } from \"../shared/plugins/CodePlugin/CodeHighlightingPlugin\";\nimport { EquationPlugin } from \"../shared/plugins/EquationPlugin/EquationPlugin\";\nimport StateUpdatePlugin from \"../shared/plugins/StateUpdatePlugin\";\nimport ToggleEditablePlugin from \"../shared/plugins/ToggleEditablePlugin\";\nimport { TreeViewPlugin } from \"../shared/plugins/TreeViewPlugin/TreeViewPlugin\";\nimport { splitFrontmatter } from \"../utils/markdown\";\n\nexport interface RichMessageProps {\n debug?: boolean;\n defaultState: string;\n fullWidth?: boolean;\n isEditable?: boolean;\n resolveMarkdownUrl?: MarkdownUrlResolver;\n onChange?: (value: string) => void;\n}\n\nconst SOURCE_IMPORT_TAG = \"markdown-source-import\";\n\nexport function RichMessage(props: RichMessageProps) {\n const {\n debug = false,\n defaultState = \"\",\n fullWidth = false,\n isEditable = false,\n resolveMarkdownUrl,\n onChange,\n } = props;\n const { frontmatter, body } = splitFrontmatter(defaultState);\n const shouldTrackChanges = isEditable && Boolean(onChange);\n const sourceDocumentRef = useRef<ReturnType<typeof createMarkdownSourceDocument> | null>(null);\n sourceDocumentRef.current ??= createMarkdownSourceDocument(body, resolveMarkdownUrl);\n\n const initialConfig = {\n namespace: \"RICH_MESSAGE\",\n nodes: editorNodes,\n editorState: () => {\n $addUpdateTag(SOURCE_IMPORT_TAG);\n sourceDocumentRef.current?.importToLexical();\n },\n onError: (error: Error) => console.error(error),\n editable: isEditable,\n theme: editorTheme,\n };\n\n return (\n <Flex\n className=\"rich-text\"\n data-rich-message=\"true\"\n justifyContent=\"space-between\"\n width=\"100%\"\n maxWidth=\"100%\"\n height=\"100%\"\n position=\"relative\"\n direction=\"column\"\n overflow=\"hidden\"\n >\n <MarkdownUrlProvider resolver={resolveMarkdownUrl}>\n <LexicalComposer initialConfig={initialConfig}>\n <StateUpdatePlugin\n value={body}\n onUpdate={(value: string) => {\n const sourceDocument = createMarkdownSourceDocument(value, resolveMarkdownUrl);\n sourceDocumentRef.current = sourceDocument;\n $addUpdateTag(SOURCE_IMPORT_TAG);\n sourceDocument.importToLexical();\n }}\n />\n <LinkPlugin />\n <ClickableLinkPlugin newTab />\n <ListPlugin />\n {isEditable ? <TabIndentationPlugin maxIndent={7} /> : null}\n <HorizontalRulePlugin />\n <CodeHighlightingPlugin />\n <ImportCodeBlocksPlugin />\n <EquationPlugin />\n <RichTextPlugin\n contentEditable={<ContentEditable fullWidth={fullWidth} isRichMessage />}\n ErrorBoundary={LexicalErrorBoundary}\n />\n {shouldTrackChanges ? (\n <OnChangePlugin\n ignoreSelectionChange\n ignoreHistoryMergeTagChange={false}\n onChange={(editorState, _editor, tags) => {\n if (tags.has(SOURCE_IMPORT_TAG)) return;\n editorState.read(() => {\n const root = $getRoot();\n const markdownBody = sourceDocumentRef.current?.exportFromLexical(root) ?? \"\";\n onChange?.(frontmatter + markdownBody);\n });\n }}\n />\n ) : null}\n <ToggleEditablePlugin isEditable={isEditable} />\n {debug && <TreeViewPlugin />}\n </LexicalComposer>\n </MarkdownUrlProvider>\n </Flex>\n );\n}\n"],"names":["INSERT_REFERENCE","INSERT_BLOCK","INSERT_REFERENCE_COMMAND","createCommand","INSERT_BLOCK_COMMAND","convertCommentElement","element","node","$createCommentNode","style","setFormat","textAlign","CommentNode","ElementNode","getType","clone","__key","createDOM","config","document","createElement","addClassNamesToElement","theme","comment","updateDOM","importDOM","blockquote","conversion","priority","exportDOM","editor","isHTMLElement","isEmpty","append","formatType","getFormatType","direction","getDirection","dir","importJSON","serializedNode","format","setIndent","indent","setDirection","exportJSON","type","getTextContent","replace","insertNewAfter","_","restoreSelection","newBlock","$createParagraphNode","insertAfter","collapseAtStart","paragraph","children","getChildren","forEach","child","insertCommentBlock","_blockType","nodeToReplace","selection","$getSelection","commentNode","nodeParent","getParent","remove","selectEnd","$isRangeSelection","$setBlocksType","useCommentCommands","$","_c","useLexicalComposerContext","t0","t1","mergeRegister","registerCommand","_temp","COMMAND_PRIORITY_LOW","useEffect","event","optionId","useCommentSchema","registerNodeTransform","invalidChildren","filter","length","update","_temp2","child_0","CommentPlugin","$getTextContent","root","textContent","childrenLength","i","$isElementNode","isInline","getReferenceMarker","name","referenceId","shouldAppendParagraphBreak","Boolean","traverseSerializedNode","referenceMarker","text","Array","isArray","getTextFromSerializedEditorState","state","parsed","JSON","parse","emptyEditorState","version","textFormat","undefined","generateEditorStateFromString","input","trim","split","map","line","detail","mode","stringify","ImperativeAPIPlugin","editorRef","previousTextRef","t2","setEditorValue","value","parseEditorState","setEditorState","current","focus","defaultSelection","useImperativeHandle","shouldSubmitOnEnter","key","ctrlKey","metaKey","shiftKey","altKey","KeyboardShortcutPlugin","onSubmit","KEY_DOWN_COMMAND","preventDefault","COMMAND_PRIORITY_HIGH","menuSortOrder","getSortedMenuOptions","options","sort","a","b","indexOf","group","option","index","reduce","acc","bucket","push","ReferenceMenuItem","props","id","isSelected","onClick","onMouseEnter","setRefElement","secondaryLabel","primaryLabel","tabIndex","t3","bg","t4","jsx","Tooltip","Text","t5","t6","t7","t8","Flex","ReferenceMenu","selectedIndex","onSelectItem","onMouseEnterItem","table","connector","hasResults","getElementById","scrollIntoView","behavior","block","T0","ScrollArea","t9","Symbol","for","base","md","t10","t11","jsxs","Fragment","Box","description","t12","option_0","t13","localFilter","data","q","m","toLowerCase","includes","useContextLookup","queryString","items","baseOptions","res","resourceId","resourceType","VALID_PUNCTUATION","TRIGGERS","join","VALID_CHARS","VALID_JOINS","LENGTH_LIMIT","TriggerRegex","RegExp","AliasRegex","checkForTriggers","minMatchLength","match","exec","maybeLeadingWhitespace","matchingString","leadOffset","replaceableString","SUGGESTION_LIST_LENGTH_LIMIT","ReferenceMenuPlugin","setQueryString","useState","searchResults","selectedOption","closeMenu","dispatchCommand","onSelectOption","checkForTrigger","slice","menuOptions","LexicalTypeaheadMenuPlugin","anchorElementRef","selectOptionAndCleanUp","setHighlightedIndex","ReactDOM","createPortal","i_0","ReferenceNode","TextNode","__referenceId","__name","constructor","isKeyboardSelectable","canBeEmpty","canInsertTextAfter","canInsertTextBefore","span","reference","setAttribute","prevNode","dom","_editor","el","domNode","hasAttribute","$convertReferenceElement","getAttribute","$createReferenceNode","$insertExistingReference","refNode","ReferencePlugin","onAddReference","promptInputTheme","baseTheme","nodes","MarkNode","BasePromptEditor","ref","defaultState","debug","isEditable","placeholder","onChange","onError","references","namespace","editorState","editable","initialConfig","useRef","Kbd","placeholderNode","HistoryPlugin","ContentEditable","RichTextPlugin","LexicalErrorBoundary","OnChangePlugin","read","$getRoot","rawText","toJSON","ToggleEditablePlugin","t14","t15","t16","t17","t18","TreeViewPlugin","t19","LexicalComposer","PromptEditor","forwardRef","StateUpdatePlugin","onUpdate","tag","SOURCE_IMPORT_TAG","RichMessage","fullWidth","resolveMarkdownUrl","frontmatter","body","splitFrontmatter","shouldTrackChanges","sourceDocumentRef","createMarkdownSourceDocument","MarkdownUrlProvider","editorNodes","$addUpdateTag","importToLexical","error","console","editorTheme","sourceDocument","LinkPlugin","ClickableLinkPlugin","ListPlugin","TabIndentationPlugin","HorizontalRulePlugin","CodeHighlightingPlugin","ImportCodeBlocksPlugin","EquationPlugin","tags","has","markdownBody","exportFromLexical"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAO,MAAMA,KAAmB,oBACnBC,KAAe,gBCEfC,KAA2BC,GAAcH,EAAgB,GAEzDI,KAAuBD,GAAcF,EAAY;ACa9D,SAASI,GAAsBC,GAA2C;AACxE,QAAMC,IAAOC,EAAAA;AACb,SAAIF,EAAQG,UAAU,QACpBF,EAAKG,UAAUJ,EAAQG,MAAME,SAA8B,GAEtD;AAAA,IAAEJ,MAAAA;AAAAA,EAAAA;AACX;AAEO,MAAMK,UAAoBC,GAAY;AAAA,EAC3C,OAAOC,UAAkB;AACvB,WAAO;AAAA,EACT;AAAA,EAEA,OAAOC,MAAMR,GAAgC;AAC3C,WAAO,IAAIK,EAAYL,EAAKS,KAAK;AAAA,EACnC;AAAA,EAEAC,UAAUC,GAAmC;AAC3C,UAAMZ,IAAUa,SAASC,cAAc,YAAY;AACnDC,WAAAA,GAAuBf,GAASY,EAAOI,MAAMC,OAAO,GAC7CjB;AAAAA,EACT;AAAA,EAEAkB,YAAqB;AACnB,WAAO;AAAA,EACT;AAAA,EAEA,OAAOC,YAAqC;AAC1C,WAAO;AAAA,MACLC,YAAYA,OAAO;AAAA,QACjBC,YAAYtB;AAAAA,QACZuB,UAAU;AAAA,MAAA;AAAA,IACZ;AAAA,EAEJ;AAAA,EAEAC,UAAUC,GAAwC;AAChD,UAAM;AAAA,MAAExB,SAAAA;AAAAA,IAAAA,IAAY,MAAMuB,UAAUC,CAAM;AAE1C,QAAIxB,KAAWyB,GAAczB,CAAO,GAAG;AACrC,MAAI,KAAK0B,aACP1B,E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AAAAA,IACjB,GAAE;AAAA,sBAEHK,IAAA,EAAU;AAAA,IACX,gBAAA1K,EAAC2K,IAAA,EAAoB,QAAM,GAAA,CAAA;AAAA,sBAC1BC,IAAA,EAAU;AAAA,IACVvD,IAAa,gBAAArH,EAAC6K,IAAA,EAAqB,WAAW,GAAE,IAAM;AAAA,sBACtDC,IAAA,EAAoB;AAAA,sBACpBC,IAAA,EAAsB;AAAA,sBACtBC,IAAA,EAAsB;AAAA,sBACtBC,IAAA,EAAc;AAAA,IACf,gBAAAjL,EAACmI,IAAA,EACC,iBAAiB,gBAAAnI,EAACkI,IAAA,EAAgB,WAAAwB,GAAsB,eAAa,GAAA,CAAA,GACrE,eAAetB,GAAAA,CAAqB;AAAA,IAErC2B,IACC,gBAAA/J,EAACqI,IAAA,EACC,uBAAqB,IACrB,6BAA6B,IAC7B,UAAU,CAACV,GAAazB,GAASgF,MAAS;AACxC,MAAIA,EAAKC,IAAI3B,CAAiB,KAC9B7B,EAAYW,KAAK,MAAM;AACrB,cAAM1N,IAAO2N,GAAAA,GACP6C,IAAepB,EAAkB1M,SAAS+N,kBAAkBzQ,CAAI,KAAK;AAC3E2M,QAAAA,IAAWqC,IAAcwB,CAAY;AAAA,MACvC,CAAC;AAAA,IACH,GAAE,IAEF;AAAA,IACJ,gBAAApL,EAAC0I,MAAqB,YAAArB,GAAuB;AAAA,IAC5CD,uBAAU4B,IAAA,CAAA,CAAc;AAAA,EAAA,EAAA,CAC3B,GACF,GACF;AAEJ;"}
package/dist/rich-text.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx as o, jsxs as Y } from "react/jsx-runtime";
2
2
  import { c as U } from "react/compiler-runtime";
3
- import { e as ee, a as te, C as oe, I as ne, E as re, b as ie } from "./markdown-kuU19Oh3.js";
3
+ import { e as ee, a as te, C as oe, I as ne, E as re, b as ie } from "./markdown-Cli3KGu9.js";
4
4
  import { Box as j, Flex as le, Table as T, Text as F, Textarea as se } from "@chakra-ui/react";
5
5
  import { LexicalCollaboration as ae } from "@lexical/react/LexicalCollaborationContext";
6
6
  import { CollaborationPluginV2__EXPERIMENTAL as ce } from "@lexical/react/LexicalCollaborationPlugin";
@@ -14,10 +14,10 @@ import { TabIndentationPlugin as ge } from "@lexical/react/LexicalTabIndentation
14
14
  import { useRef as be, useState as q, useEffect as J } from "react";
15
15
  import { WebsocketProvider as xe } from "y-websocket";
16
16
  import * as Se from "yjs";
17
- import { C as ye, F as we } from "./markdown-editor-Bj_QX4oN.js";
18
- import { M as Ze } from "./markdown-editor-Bj_QX4oN.js";
19
- import { L as tt } from "./lazy-markdown-editor-Obb0M8xc.js";
20
- import { R as nt, P as rt, R as it, g as lt, a as st } from "./rich-message-dNYvLDd4.js";
17
+ import { C as ye, F as we } from "./markdown-editor-BHoRATej.js";
18
+ import { M as Ze } from "./markdown-editor-BHoRATej.js";
19
+ import { L as tt } from "./lazy-markdown-editor-DSlelhHV.js";
20
+ import { R as nt, P as rt, R as it, g as lt, a as st } from "./rich-message-gWYlm8Ji.js";
21
21
  import { S as K } from "./browser-storage-DPtOQJx0.js";
22
22
  function ve() {
23
23
  const t = U(1);
@@ -3,6 +3,9 @@ export declare const windowTitleBarRecipe: import('@chakra-ui/react').SlotRecipe
3
3
  mac: {
4
4
  content: {
5
5
  paddingInlineStart: "window-controls-mac";
6
+ "[data-window-full-screen] &": {
7
+ paddingInlineStart: "compact";
8
+ };
6
9
  };
7
10
  };
8
11
  overlay: {
@@ -10,10 +10,8 @@ const X = t({
10
10
  flexShrink: 0,
11
11
  width: "full",
12
12
  height: "window-title-bar",
13
- bg: "bg.subtle",
13
+ bg: "bg",
14
14
  color: "fg",
15
- borderBottomWidth: "1px",
16
- borderColor: "border",
17
15
  userSelect: "none",
18
16
  WebkitAppRegion: "drag"
19
17
  },
@@ -33,7 +31,10 @@ const X = t({
33
31
  controls: {
34
32
  mac: {
35
33
  content: {
36
- paddingInlineStart: "window-controls-mac"
34
+ paddingInlineStart: "window-controls-mac",
35
+ "[data-window-full-screen] &": {
36
+ paddingInlineStart: "compact"
37
+ }
37
38
  }
38
39
  },
39
40
  overlay: {
@@ -60,6 +61,7 @@ const X = t({
60
61
  scrollbarWidth: "none"
61
62
  },
62
63
  tab: {
64
+ position: "relative",
63
65
  display: "flex",
64
66
  alignItems: "center",
65
67
  flexShrink: 0,
@@ -77,7 +79,13 @@ const X = t({
77
79
  _hover: {
78
80
  bg: "bg.hover",
79
81
  color: "fg"
80
- }
82
+ },
83
+ _dragging: {
84
+ bg: "bg.hover",
85
+ color: "fg",
86
+ zIndex: "docked"
87
+ },
88
+ WebkitAppRegion: "no-drag"
81
89
  },
82
90
  trigger: {
83
91
  display: "flex",
@@ -92,6 +100,7 @@ const X = t({
92
100
  borderRadius: "xs",
93
101
  focusVisibleRing: "inside",
94
102
  WebkitAppRegion: "no-drag",
103
+ touchAction: "none",
95
104
  _icon: {
96
105
  width: "icon-xs",
97
106
  height: "icon-xs",
@@ -180,9 +189,9 @@ const X = t({
180
189
  for (const [n, s] of Object.entries(r))
181
190
  l[O(n)] = s;
182
191
  for (const [n, s] of Object.entries(j)) {
183
- const g = r[n];
184
- if (g)
185
- for (const m of s) l[m] = g;
192
+ const b = r[n];
193
+ if (b)
194
+ for (const m of s) l[m] = b;
186
195
  }
187
196
  return {
188
197
  id: o.id,
@@ -952,12 +961,12 @@ const X = t({
952
961
  1600: "8rem",
953
962
  // 128px
954
963
  2e3: "10rem"
955
- }, be = {
964
+ }, ge = {
956
965
  "window-tab-gap": {
957
966
  value: "0.4375rem"
958
967
  },
959
968
  "window-controls-mac": {
960
- value: "4.875rem"
969
+ value: "5.625rem"
961
970
  },
962
971
  none: {
963
972
  value: "0"
@@ -1010,7 +1019,7 @@ const X = t({
1010
1019
  "panel-gap": {
1011
1020
  value: e[50]
1012
1021
  }
1013
- }, ge = {
1022
+ }, be = {
1014
1023
  "panel-gap": {
1015
1024
  value: e[50]
1016
1025
  },
@@ -3571,9 +3580,9 @@ const X = t({
3571
3580
  const l = o.split(",").map((r) => r.trim()).filter((r) => !f.test(r));
3572
3581
  if (l.length !== 0)
3573
3582
  return l.join(", ");
3574
- }, b = (o) => Array.isArray(o) ? o.map(b).filter((l) => l !== void 0) : typeof o == "string" ? Ue(o) : !o || typeof o != "object" ? o : Object.fromEntries(Object.entries(o).flatMap(([l, r]) => {
3583
+ }, g = (o) => Array.isArray(o) ? o.map(g).filter((l) => l !== void 0) : typeof o == "string" ? Ue(o) : !o || typeof o != "object" ? o : Object.fromEntries(Object.entries(o).flatMap(([l, r]) => {
3575
3584
  if (Oe.has(l) || f.test(l)) return [];
3576
- const n = b(r);
3585
+ const n = g(r);
3577
3586
  return n === void 0 ? [] : [[l, n]];
3578
3587
  })), y = (o) => {
3579
3588
  const {
@@ -3591,11 +3600,11 @@ const X = t({
3591
3600
  for (const [r, n] of Object.entries(Ne)) {
3592
3601
  const s = l[r];
3593
3602
  if (!s || typeof s != "object") continue;
3594
- const g = s, m = g.variants, x = m?.variant;
3603
+ const b = s, m = b.variants, x = m?.variant;
3595
3604
  if (!x) continue;
3596
3605
  const S = new Set(n), _ = Object.fromEntries(Object.entries(x).filter(([w]) => !S.has(w)));
3597
3606
  l[r] = {
3598
- ...g,
3607
+ ...b,
3599
3608
  variants: {
3600
3609
  ...m,
3601
3610
  variant: _
@@ -3609,10 +3618,10 @@ const X = t({
3609
3618
  ...d.theme,
3610
3619
  tokens: y(d.theme?.tokens),
3611
3620
  semanticTokens: y(d.theme?.semanticTokens),
3612
- recipes: Ye(b(d.theme?.recipes)),
3613
- slotRecipes: b(d.theme?.slotRecipes),
3614
- layerStyles: b(d.theme?.layerStyles),
3615
- animationStyles: b(d.theme?.animationStyles)
3621
+ recipes: Ye(g(d.theme?.recipes)),
3622
+ slotRecipes: g(d.theme?.slotRecipes),
3623
+ layerStyles: g(d.theme?.layerStyles),
3624
+ animationStyles: g(d.theme?.animationStyles)
3616
3625
  }
3617
3626
  }, $e = {
3618
3627
  DEFAULT: {
@@ -4630,8 +4639,8 @@ const X = t({
4630
4639
  fontSizes: ce,
4631
4640
  fontWeights: ue,
4632
4641
  radii: pe,
4633
- sizes: ge,
4634
- spacing: be
4642
+ sizes: be,
4643
+ spacing: ge
4635
4644
  },
4636
4645
  semanticTokens: {
4637
4646
  colors: ro,
@@ -4668,4 +4677,4 @@ export {
4668
4677
  uo as t,
4669
4678
  M as w
4670
4679
  };
4671
- //# sourceMappingURL=theme-Ca-KyNoi.js.map
4680
+ //# sourceMappingURL=theme-B5OVwYEU.js.map