@pstdio/ui 0.16.0 → 0.18.0
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.
- package/dist/{MermaidComponent-BCMQqPqu.js → MermaidComponent-BPiVFNYK.js} +2 -2
- package/dist/{MermaidComponent-BCMQqPqu.js.map → MermaidComponent-BPiVFNYK.js.map} +1 -1
- package/dist/chat-ui.js +1618 -1102
- package/dist/chat-ui.js.map +1 -1
- package/dist/{checkbox-D5AzFRlb.js → checkbox-B2zYVemL.js} +28 -28
- package/dist/checkbox-B2zYVemL.js.map +1 -0
- package/dist/components/chat-ui/components/chat-input-actions.d.ts +1 -0
- package/dist/components/chat-ui/components/chat-input.d.ts +8 -2
- package/dist/components/chat-ui/components/chat-panel.d.ts +11 -5
- package/dist/components/chat-ui/components/composer-constants.d.ts +1 -0
- package/dist/components/chat-ui/components/conversation-browse.d.ts +22 -0
- package/dist/components/chat-ui/components/message-types.d.ts +14 -0
- package/dist/components/chat-ui/components/queued-follow-up-list-state.d.ts +4 -0
- package/dist/components/chat-ui/components/queued-follow-up-list.d.ts +11 -0
- package/dist/components/chat-ui/components/timeline.d.ts +5 -0
- package/dist/components/chat-ui/components/working-indicator.d.ts +9 -0
- package/dist/components/chat-ui/components/workspace-hub.d.ts +8 -1
- package/dist/components/chat-ui/index.d.ts +4 -2
- package/dist/components/chat-ui/tool-rendering/build-timeline.d.ts +2 -2
- package/dist/components/chat-ui/tool-rendering/question-prompt.d.ts +9 -0
- package/dist/components/data-table/build-columns.d.ts +13 -2
- package/dist/components/data-table/categorical-color-cell.d.ts +8 -0
- package/dist/components/data-table/color-cell-style.d.ts +13 -0
- package/dist/components/data-table/color-scale-cell.d.ts +7 -0
- package/dist/components/data-table/data-table-column-menu.d.ts +15 -0
- package/dist/components/data-table/data-table-header.d.ts +10 -0
- package/dist/components/data-table/data-table-stat-chart.d.ts +21 -0
- package/dist/components/data-table/data-table-state.d.ts +27 -0
- package/dist/components/data-table/data-table-stats-row.d.ts +11 -0
- package/dist/components/data-table/data-table-stats.d.ts +19 -0
- package/dist/components/data-table/data-table-table-parts.d.ts +21 -0
- package/dist/components/data-table/data-table.story-descriptions.d.ts +6 -0
- package/dist/components/data-table/data-table.story-fixtures.d.ts +6 -0
- package/dist/components/data-table/editable-cells-story.d.ts +9 -0
- package/dist/components/data-table/friendly-json-display.d.ts +31 -0
- package/dist/components/data-table/index.d.ts +3 -1
- package/dist/components/data-table/json-cell.d.ts +6 -0
- package/dist/components/data-table/pagination-footer.d.ts +4 -1
- package/dist/components/data-table/selection-toolbar.d.ts +3 -1
- package/dist/components/data-table/types.d.ts +72 -0
- package/dist/components/diff-viewer/code-editor.d.ts +2 -0
- package/dist/components/diff-viewer/index.d.ts +1 -1
- package/dist/components/diff-viewer/monaco-browser.d.ts +1 -0
- package/dist/components/{data-renderer → kanban-renderer}/display-menu.d.ts +4 -4
- package/dist/components/{data-renderer → kanban-renderer}/filter-menu.d.ts +3 -3
- package/dist/components/kanban-renderer/index.d.ts +19 -0
- package/dist/components/kanban-renderer/kanban-renderer-attribute-badge.d.ts +7 -0
- package/dist/components/{data-renderer/data-renderer-board-column-header.d.ts → kanban-renderer/kanban-renderer-board-column-header.d.ts} +2 -2
- package/dist/components/{data-renderer/data-renderer-board-group-section.d.ts → kanban-renderer/kanban-renderer-board-group-section.d.ts} +2 -2
- package/dist/components/{data-renderer/data-renderer-board-move.d.ts → kanban-renderer/kanban-renderer-board-move.d.ts} +3 -3
- package/dist/components/{data-renderer/data-renderer-board.d.ts → kanban-renderer/kanban-renderer-board.d.ts} +15 -14
- package/dist/components/{data-renderer/data-renderer-card.d.ts → kanban-renderer/kanban-renderer-card.d.ts} +4 -3
- package/dist/components/{data-renderer/data-renderer-content.d.ts → kanban-renderer/kanban-renderer-content.d.ts} +8 -8
- package/dist/components/kanban-renderer/kanban-renderer-create-dialog.d.ts +12 -0
- package/dist/components/kanban-renderer/kanban-renderer-create-field.d.ts +10 -0
- package/dist/components/kanban-renderer/kanban-renderer-grouping.d.ts +23 -0
- package/dist/components/{data-renderer/data-renderer-helpers.d.ts → kanban-renderer/kanban-renderer-helpers.d.ts} +15 -15
- package/dist/components/kanban-renderer/kanban-renderer-list-items.d.ts +25 -0
- package/dist/components/kanban-renderer/kanban-renderer-list.d.ts +43 -0
- package/dist/components/{data-renderer/data-renderer-story-fixtures.d.ts → kanban-renderer/kanban-renderer-story-fixtures.d.ts} +3 -2
- package/dist/components/kanban-renderer/kanban-renderer-toolbar.d.ts +15 -0
- package/dist/components/kanban-renderer/kanban-renderer-view-bar.d.ts +14 -0
- package/dist/components/kanban-renderer/kanban-renderer-views.d.ts +12 -0
- package/dist/components/{data-renderer/data-renderer.d.ts → kanban-renderer/kanban-renderer.d.ts} +11 -8
- package/dist/components/{data-renderer → kanban-renderer}/types.d.ts +51 -8
- package/dist/components/kanban-renderer/use-kanban-renderer-store.d.ts +78 -0
- package/dist/components/layout/index.d.ts +1 -0
- package/dist/components/layout/panel-header.constants.d.ts +2 -0
- package/dist/components/layout/resizable-split-layout.d.ts +3 -2
- package/dist/components/layout/resizable-split-layout.geometry.d.ts +56 -0
- package/dist/components/layout/resizable-split-layout.handle.d.ts +6 -2
- package/dist/components/layout/resizable-split-layout.panels.d.ts +25 -0
- package/dist/components/list-row/list-row-actions.d.ts +1 -0
- package/dist/components/list-row/list-row-content.d.ts +7 -0
- package/dist/components/list-row/list-row.types.d.ts +4 -1
- package/dist/components/overlays/attached-menu.d.ts +6 -0
- package/dist/components/overlays/attachment-chip.d.ts +13 -0
- package/dist/components/overlays/index.d.ts +6 -2
- package/dist/components/overlays/resource-context-menu.d.ts +13 -1
- package/dist/components/overlays/searchable-menu-input.d.ts +9 -0
- package/dist/components/param-editor/index.d.ts +6 -2
- package/dist/components/param-editor/inputs/action-input.d.ts +1 -0
- package/dist/components/param-editor/inputs/boolean-input.d.ts +13 -0
- package/dist/components/param-editor/inputs/color-input.d.ts +1 -0
- package/dist/components/param-editor/inputs/date-input.d.ts +1 -0
- package/dist/components/param-editor/inputs/file-upload-input.d.ts +15 -0
- package/dist/components/param-editor/inputs/file-upload-value.d.ts +7 -0
- package/dist/components/param-editor/inputs/horizontal-text-input.d.ts +1 -0
- package/dist/components/param-editor/inputs/markdown-input.d.ts +13 -0
- package/dist/components/param-editor/inputs/number-input.d.ts +1 -0
- package/dist/components/param-editor/inputs/range-input.d.ts +1 -0
- package/dist/components/param-editor/inputs/resource-input.d.ts +2 -0
- package/dist/components/param-editor/inputs/segmented-input.d.ts +1 -0
- package/dist/components/param-editor/inputs/selection-input.d.ts +7 -6
- package/dist/components/param-editor/inputs/selection-menu.d.ts +33 -0
- package/dist/components/param-editor/inputs/text-input.d.ts +1 -0
- package/dist/components/param-editor/param-editor-advanced-field.d.ts +14 -0
- package/dist/components/param-editor/param-editor-control-fixtures.d.ts +24 -0
- package/dist/components/param-editor/param-editor-field.d.ts +2 -0
- package/dist/components/param-editor/param-editor-horizontal.d.ts +3 -2
- package/dist/components/param-editor/param-editor-label.d.ts +1 -0
- package/dist/components/param-editor/param-editor-presentation.d.ts +3 -0
- package/dist/components/param-editor/param-editor-read-only-field.d.ts +9 -0
- package/dist/components/param-editor/param-editor-section.d.ts +1 -0
- package/dist/components/param-editor/param-editor.d.ts +1 -0
- package/dist/components/param-editor/param-editor.types.d.ts +59 -18
- package/dist/components/param-editor/resolve-param-value.d.ts +2 -0
- package/dist/components/primitives/chip.d.ts +4 -0
- package/dist/components/primitives/index.d.ts +2 -0
- package/dist/components/primitives/resource-badge.d.ts +12 -10
- package/dist/components/rich-text/index.d.ts +1 -0
- package/dist/components/rich-text/lazy-markdown-editor.d.ts +2 -0
- package/dist/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/ReferenceMenuPlugin.d.ts +2 -1
- package/dist/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/hooks/useContextLookup.d.ts +2 -1
- package/dist/components/rich-text/prompt-input/plugins/ReferencePlugin/ReferencePlugin.d.ts +2 -1
- package/dist/components/rich-text/prompt-input/prompt-input.d.ts +3 -2
- package/dist/components/rich-text/types.d.ts +1 -1
- package/dist/components/rich-text/utils/inferResourceType.d.ts +1 -1
- package/dist/components/{sidebar/sidebar-footer.d.ts → sidenav/sidenav-footer.d.ts} +2 -2
- package/dist/components/{sidebar/sidebar-header.d.ts → sidenav/sidenav-header.d.ts} +2 -2
- package/dist/components/sidenav/sidenav.d.ts +2 -0
- package/dist/components/sidenav/sidenav.store.d.ts +49 -0
- package/dist/components/{sidebar/sidebar.types.d.ts → sidenav/sidenav.types.d.ts} +5 -5
- package/dist/components/tab-strip/tab-visibility-filter.d.ts +1 -0
- package/dist/components/terminal/terminal.d.ts +11 -0
- package/dist/components/tree-list/tree-list-visibility-filter.d.ts +0 -1
- package/dist/components/tree-list/tree-list.d.ts +1 -1
- package/dist/components/tree-list/tree-list.types.d.ts +4 -0
- package/dist/data-table.js +1321 -0
- package/dist/data-table.js.map +1 -0
- package/dist/diff.js +370 -366
- package/dist/diff.js.map +1 -1
- package/dist/font/css/prompt-studio-icons.css +690 -0
- package/dist/font/prompt-studio-icons.eot +0 -0
- package/dist/font/prompt-studio-icons.svg +1 -0
- package/dist/font/prompt-studio-icons.ttf +0 -0
- package/dist/font/prompt-studio-icons.woff +0 -0
- package/dist/font/prompt-studio-icons.woff2 +0 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1854 -3381
- package/dist/index.js.map +1 -1
- package/dist/kanban-renderer-toolbar-Db1mIWWd.js +1318 -0
- package/dist/kanban-renderer-toolbar-Db1mIWWd.js.map +1 -0
- package/dist/kanban-renderer.js +1101 -0
- package/dist/kanban-renderer.js.map +1 -0
- package/dist/lazy-markdown-editor-DwhqQ-NN.js +26 -0
- package/dist/lazy-markdown-editor-DwhqQ-NN.js.map +1 -0
- package/dist/list-row-BYWwcbGK.js +823 -0
- package/dist/list-row-BYWwcbGK.js.map +1 -0
- package/dist/markdown-DDd2ESoH.js +743 -0
- package/dist/markdown-DDd2ESoH.js.map +1 -0
- package/dist/markdown-editor-CYVkzt8t.js +741 -0
- package/dist/markdown-editor-CYVkzt8t.js.map +1 -0
- package/dist/monaco-browser-CO0NxK_Z.js +19 -0
- package/dist/monaco-browser-CO0NxK_Z.js.map +1 -0
- package/dist/param-editor-BCZOw5Gt.js +140 -0
- package/dist/param-editor-BCZOw5Gt.js.map +1 -0
- package/dist/param-editor-field-ZzZwgjZ_.js +2094 -0
- package/dist/param-editor-field-ZzZwgjZ_.js.map +1 -0
- package/dist/resource-badge-CuItchgL.js +98 -0
- package/dist/resource-badge-CuItchgL.js.map +1 -0
- package/dist/rich-message--eRzjWYK.js +730 -0
- package/dist/rich-message--eRzjWYK.js.map +1 -0
- package/dist/rich-text.js +114 -827
- package/dist/rich-text.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/terminal.js +197 -177
- package/dist/terminal.js.map +1 -1
- package/dist/theme/primitives/fonts.d.ts +3 -0
- package/dist/theme/primitives/sizes.d.ts +23 -0
- package/dist/theme/recipes/badge.d.ts +8 -0
- package/dist/theme/recipes/button.d.ts +6 -0
- package/dist/theme/recipes/color-picker.d.ts +18 -1
- package/dist/theme/recipes/switch.d.ts +17 -0
- package/dist/theme/recipes/tabs.d.ts +4 -4
- package/dist/theme/tokens/colors.d.ts +18 -24
- package/dist/{theme-CJBYBJaA.js → theme-poQlUgt0.js} +414 -240
- package/dist/theme-poQlUgt0.js.map +1 -0
- package/dist/theme.js +1 -1
- package/dist/tree-list-BAja2eXU.js +1033 -0
- package/dist/tree-list-BAja2eXU.js.map +1 -0
- package/package.json +11 -4
- package/dist/checkbox-D5AzFRlb.js.map +0 -1
- package/dist/components/data-renderer/card-interaction-guard.d.ts +0 -2
- package/dist/components/data-renderer/data-renderer-attribute-badge.d.ts +0 -7
- package/dist/components/data-renderer/data-renderer-grouping.d.ts +0 -23
- package/dist/components/data-renderer/data-renderer-list.d.ts +0 -39
- package/dist/components/data-renderer/data-renderer-toolbar.d.ts +0 -12
- package/dist/components/data-renderer/index.d.ts +0 -18
- package/dist/components/data-renderer/use-data-renderer-store.d.ts +0 -59
- package/dist/components/param-editor/inputs/file-accept.d.ts +0 -22
- package/dist/components/param-editor/inputs/file-drop-input.d.ts +0 -14
- package/dist/components/sidebar/sidebar.d.ts +0 -2
- package/dist/components/sidebar/sidebar.store.d.ts +0 -49
- package/dist/data-renderer.js +0 -1669
- package/dist/data-renderer.js.map +0 -1
- package/dist/list-row-mi3Hn-Um.js +0 -740
- package/dist/list-row-mi3Hn-Um.js.map +0 -1
- package/dist/resource-badge-qCWHP-wQ.js +0 -99
- package/dist/resource-badge-qCWHP-wQ.js.map +0 -1
- package/dist/rich-message-DBf_5YlW.js +0 -1450
- package/dist/rich-message-DBf_5YlW.js.map +0 -1
- package/dist/theme-CJBYBJaA.js.map +0 -1
- package/dist/tree-list-CcuZMLS5.js +0 -930
- package/dist/tree-list-CcuZMLS5.js.map +0 -1
- package/dist/workspace-badge-Fuo-1zPj.js +0 -314
- package/dist/workspace-badge-Fuo-1zPj.js.map +0 -1
- /package/dist/components/{data-renderer/data-renderer-badge-helpers.d.ts → kanban-renderer/kanban-renderer-badge-helpers.d.ts} +0 -0
- /package/dist/components/{data-renderer/data-renderer-enum-helpers.d.ts → kanban-renderer/kanban-renderer-enum-helpers.d.ts} +0 -0
- /package/dist/components/{data-renderer → kanban-renderer}/use-resolved-attributes.d.ts +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rich-message-DBf_5YlW.js","sources":["../src/components/rich-text/shared/components/content-editable.tsx","../src/components/rich-text/markdown-editor/plugins/ReferenceLinkPlugin/ReferenceLinkNode.tsx","../src/components/rich-text/markdown-editor/plugins/ReferenceLinkPlugin/ReferenceLinkTransformer.ts","../src/components/rich-text/theme/rich-text-theme.tsx","../src/components/rich-text/shared/components/default-rich-text-components.tsx","../src/components/rich-text/shared/nodes/DataTableNode.tsx","../src/components/rich-text/shared/plugins/EquationPlugin/EquationNode.tsx","../src/components/rich-text/shared/plugins/EquationPlugin/EquationPlugin.tsx","../src/components/rich-text/shared/plugins/HorizontalRulePlugin/HorizontalRuleNode.ts","../src/components/rich-text/shared/plugins/MermaidPlugin/MermaidNode.tsx","../src/components/rich-text/shared/plugins/HorizontalRulePlugin/horizontalRule.ts","../src/components/rich-text/shared/transformers/markdown-transformers.ts","../src/components/rich-text/shared/editor-config.ts","../src/components/rich-text/shared/plugins/CodePlugin/CodeBlockPlugin.tsx","../src/components/rich-text/shared/plugins/CodePlugin/CodeHighlightingPlugin.tsx","../src/components/rich-text/shared/plugins/ToggleEditablePlugin.tsx","../src/components/rich-text/shared/plugins/TreeViewPlugin/TreeViewPlugin.tsx","../src/components/rich-text/utils/markdown.ts","../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/plugins/ReferenceLinkPlugin/ReferenceLinkNode.tsx","../src/components/rich-text/rich-message/plugins/ReferenceLinkPlugin/ReferenceLinkTransformer.ts","../src/components/rich-text/rich-message/rich-message.tsx"],"sourcesContent":["import { Box, chakra } from \"@chakra-ui/react\";\nimport { ContentEditable as LexicalContentEditable } from \"@lexical/react/LexicalContentEditable\";\nimport { ScrollArea } from \"@/components/primitives/scroll-area\";\n\nconst StyledEditable = chakra(LexicalContentEditable);\n\ninterface ContentEditableProps {\n onRef?: (elem: HTMLDivElement) => void;\n fullWidth?: boolean;\n padding?: string;\n isRichMessage?: boolean;\n scrollable?: boolean;\n}\n\nexport function ContentEditable({\n onRef,\n fullWidth = false,\n padding,\n isRichMessage = false,\n scrollable = true,\n}: ContentEditableProps) {\n const editor = (\n <Box ref={onRef} width=\"100%\" minH=\"100%\" padding={padding}>\n <StyledEditable\n data-testid=\"content-editable\"\n height=\"fit-content\"\n minH=\"100%\"\n width=\"100%\"\n maxWidth={fullWidth ? \"100%\" : \"45rem\"}\n marginInline={fullWidth ? \"0\" : \"auto\"}\n textStyle=\"paragraph/M/regular\"\n fontSize=\"calc(var(--chakra-font-sizes-md) * var(--rich-text-font-scale))\"\n position=\"relative\"\n outline=\"none\"\n />\n </Box>\n );\n\n if (!scrollable) return editor;\n\n return (\n <ScrollArea\n className=\"rich-text\"\n data-rich-message={isRichMessage ? \"true\" : undefined}\n height=\"100%\"\n minH=\"0\"\n position=\"relative\"\n contentProps={{ width: \"100%\", minH: \"100%\" }}\n >\n {editor}\n </ScrollArea>\n );\n}\n","import { Box } from \"@chakra-ui/react\";\nimport {\n DecoratorNode,\n type EditorConfig,\n type LexicalEditor,\n type LexicalNode,\n type NodeKey,\n type SerializedLexicalNode,\n type Spread,\n} from \"lexical\";\nimport type { ReactElement } from \"react\";\nimport { ResourceBadge } from \"@/components/primitives/resource-badge\";\n\nexport type SerializedReferenceLinkNode = Spread<\n {\n href: string;\n label?: string;\n },\n SerializedLexicalNode\n>;\n\nexport class ReferenceLinkNode extends DecoratorNode<ReactElement> {\n __href: string;\n __label?: string;\n\n static getType(): string {\n return \"reference-link\";\n }\n\n static clone(node: ReferenceLinkNode): ReferenceLinkNode {\n return new ReferenceLinkNode(node.__href, node.__label, node.__key);\n }\n\n constructor(href: string, label?: string, key?: NodeKey) {\n super(key);\n this.__href = href;\n this.__label = label;\n }\n\n createDOM(_config: EditorConfig, _editor: LexicalEditor): HTMLElement {\n return document.createElement(\"span\");\n }\n\n updateDOM(_prevNode: ReferenceLinkNode, _dom: HTMLElement, _config: EditorConfig): boolean {\n return false;\n }\n\n getTextContent(): string {\n const label = this.__label ?? this.__href;\n return `{{link('${label}')}}`;\n }\n\n exportJSON(): SerializedReferenceLinkNode {\n return {\n type: ReferenceLinkNode.getType(),\n version: 1,\n href: this.__href,\n label: this.__label,\n };\n }\n\n static importJSON(serializedNode: SerializedReferenceLinkNode): ReferenceLinkNode {\n return $createReferenceLinkNode(serializedNode.href, serializedNode.label);\n }\n\n decorate(_editor: LexicalEditor, _config: EditorConfig): ReactElement {\n const href = this.__href;\n const fileName = href.split(\"/\").pop();\n const label = fileName || \"unknown\";\n const isExternal = /^https?:\\/\\//i.test(href);\n const isProjectFile = /^#?\\$PROJECT\\//i.test(href);\n\n return (\n <Box width=\"fit-content\" display=\"inline-block\">\n <ResourceBadge\n fileName={label}\n onSelect={() => {\n if (isExternal) {\n window.open(href, \"_blank\", \"noopener,noreferrer\");\n } else if (isProjectFile) {\n const projectPath = href.replace(/^#?\\$PROJECT\\//i, \"\");\n const event = new CustomEvent(\"ui:open-project-file\", { detail: projectPath });\n window.dispatchEvent(event);\n } else {\n window.location.assign(href);\n }\n }}\n />\n </Box>\n );\n }\n}\n\nexport function $createReferenceLinkNode(href: string, label?: string): ReferenceLinkNode {\n return new ReferenceLinkNode(href, label);\n}\n\nexport function $isReferenceLinkNode(node: LexicalNode | null | undefined): node is ReferenceLinkNode {\n return node instanceof ReferenceLinkNode;\n}\n","import type { TextMatchTransformer } from \"@lexical/markdown\";\nimport { $createReferenceLinkNode, $isReferenceLinkNode, ReferenceLinkNode } from \"./ReferenceLinkNode\";\n\n// Matches {{link('xxx')}} or {{ link(\"xxx\") }}\nconst LINK_REGEXP = /\\{\\{\\s*link\\((['\"])([^'\"\\s]+)\\1\\)\\s*\\}\\}/;\n\nexport const REFERENCE_LINK_TRANSFORMER: TextMatchTransformer = {\n dependencies: [ReferenceLinkNode],\n export: (node) => {\n if ($isReferenceLinkNode(node)) {\n const href = (node as ReferenceLinkNode).__href;\n const label = (node as ReferenceLinkNode).__label ?? href;\n // Export back to token form so markdown roundtrips\n if (label) {\n return `{{link('${label}')}}`;\n }\n return `{{link('${href}')}}`;\n }\n return null;\n },\n regExp: LINK_REGEXP,\n importRegExp: LINK_REGEXP,\n replace: (textNode, match) => {\n const value = match[2];\n // For now we assume value is both label and href; if it looks like a URL, use as href.\n const looksLikeUrl = /^(https?:\\/\\/|\\/)/i.test(value);\n const href = looksLikeUrl ? value : `#${value}`;\n const label = value;\n textNode.replace($createReferenceLinkNode(href, label));\n },\n type: \"text-match\",\n};\n","import type { EditorThemeClasses } from \"lexical\";\n\nimport \"./rich-text-theme.css\";\n\nconst theme: EditorThemeClasses = {\n code: \"rich-text__code\",\n codeHighlight: {\n atrule: \"rich-text__tokenAttr\",\n attr: \"rich-text__tokenAttr\",\n boolean: \"rich-text__tokenProperty\",\n builtin: \"rich-text__tokenSelector\",\n cdata: \"rich-text__tokenComment\",\n char: \"rich-text__tokenSelector\",\n class: \"rich-text__tokenFunction\",\n \"class-name\": \"rich-text__tokenFunction\",\n comment: \"rich-text__tokenComment\",\n constant: \"rich-text__tokenProperty\",\n deleted: \"rich-text__tokenProperty\",\n doctype: \"rich-text__tokenComment\",\n entity: \"rich-text__tokenOperator\",\n function: \"rich-text__tokenFunction\",\n important: \"rich-text__tokenVariable\",\n inserted: \"rich-text__tokenSelector\",\n keyword: \"rich-text__tokenAttr\",\n namespace: \"rich-text__tokenVariable\",\n number: \"rich-text__tokenProperty\",\n operator: \"rich-text__tokenOperator\",\n prolog: \"rich-text__tokenComment\",\n property: \"rich-text__tokenProperty\",\n punctuation: \"rich-text__tokenPunctuation\",\n regex: \"rich-text__tokenVariable\",\n selector: \"rich-text__tokenSelector\",\n string: \"rich-text__tokenSelector\",\n symbol: \"rich-text__tokenProperty\",\n tag: \"rich-text__tokenProperty\",\n url: \"rich-text__tokenOperator\",\n variable: \"rich-text__tokenVariable\",\n },\n embedBlock: {\n base: \"rich-text__embedBlock\",\n focus: \"rich-text__embedBlockFocus\",\n },\n list: {\n checklist: \"rich-text__checklist\",\n listitem: \"rich-text__listItem\",\n listitemChecked: \"rich-text__listItemChecked\",\n listitemUnchecked: \"rich-text__listItemUnchecked\",\n nested: {\n listitem: \"rich-text__nestedListItem\",\n },\n olDepth: [\"rich-text__ol1\", \"rich-text__ol2\", \"rich-text__ol3\", \"rich-text__ol4\", \"rich-text__ol5\"],\n ol: \"rich-text__ol\",\n ul: \"rich-text__ul\",\n },\n heading: {\n h1: \"rich-text__h1\",\n h2: \"rich-text__h2\",\n h3: \"rich-text__h3\",\n },\n paragraph: \"rich-text__p\",\n text: {\n underline: \"rich-text__textUnderline\",\n italic: \"rich-text__textItalic\",\n code: \"rich-text__textCode\",\n },\n link: \"rich-text__link\",\n quote: \"rich-text__quote\",\n reference: \"rich-text__reference\",\n table: \"rich-text__table\",\n tableCell: \"rich-text__tableCell\",\n tableRow: \"rich-text__tableRow\",\n tableCellHeader: \"rich-text__tableCellHeader\",\n layoutContainer: \"rich-text__layoutContainer\",\n layoutItem: \"rich-text__layoutItem\",\n draggableBlockDemo: {\n row: \"rich-text__row\",\n content: \"rich-text__content\",\n },\n};\n\nexport default theme;\n","import { Box, Table, Text, Textarea } from \"@chakra-ui/react\";\nimport { ScrollArea } from \"@/components/primitives/scroll-area\";\nimport type { CodeEditorProps, DataTableProps } from \"../types/rich-text-components\";\n\nconst scaledSmallFontSize = \"calc(var(--chakra-font-sizes-sm) * var(--rich-text-font-scale))\";\n\nconst formatValue = (value: unknown) => {\n if (value === null || value === undefined) return \"-\";\n if (typeof value === \"string\") return value.length ? value : \"-\";\n if (typeof value === \"number\" || typeof value === \"boolean\") return String(value).toUpperCase();\n if (value instanceof Date) return value.toISOString();\n return JSON.stringify(value);\n};\n\nexport const DefaultRichTextCodeEditor = (props: CodeEditorProps) => {\n const { defaultCode = \"\", isEditable = false, showLineNumbers = false, disableScroll = false } = props;\n\n if (isEditable) {\n return (\n <Textarea\n defaultValue={defaultCode}\n fontFamily=\"mono\"\n fontSize={scaledSmallFontSize}\n resize=\"vertical\"\n minHeight=\"100%\"\n />\n );\n }\n\n const lines = showLineNumbers ? defaultCode.split(\"\\n\") : [defaultCode];\n\n const codeBlock = (\n <Box\n as=\"pre\"\n margin={0}\n padding=\"sm\"\n fontFamily=\"mono\"\n fontSize={scaledSmallFontSize}\n lineHeight=\"1.5\"\n background=\"bg.code\"\n borderRadius=\"md\"\n width=\"100%\"\n overflowY={disableScroll ? \"hidden\" : undefined}\n >\n {showLineNumbers ? (\n <Box as=\"code\" display=\"grid\" gridTemplateColumns=\"auto 1fr\" columnGap=\"sm\">\n {lines.map((line, index) => (\n <Box as=\"span\" key={`${index}-${line}`} display=\"contents\">\n <Text as=\"span\" color=\"fg.muted\" textAlign=\"right\" fontSize=\"inherit\">\n {index + 1}\n </Text>\n <Text as=\"span\" fontSize=\"inherit\">\n {line.length ? line : \" \"}\n </Text>\n </Box>\n ))}\n </Box>\n ) : (\n <Box as=\"code\">{defaultCode}</Box>\n )}\n </Box>\n );\n\n if (disableScroll) return codeBlock;\n\n return (\n <ScrollArea width=\"100%\" background=\"bg.code\" borderRadius=\"md\" showHorizontalScrollbar>\n {codeBlock}\n </ScrollArea>\n );\n};\n\nexport const DefaultRichTextDataTable = (props: DataTableProps) => {\n const { data, fullWidth = false, noBorder = false, hiddenColumns = [] } = props;\n\n if (!data.length) {\n return (\n <Box padding=\"sm\" borderWidth={noBorder ? \"0\" : \"1px\"} borderColor=\"border.subtle\">\n <Text textStyle=\"label/S/regular\" fontSize={scaledSmallFontSize} color=\"fg.muted\">\n No data\n </Text>\n </Box>\n );\n }\n\n const hiddenSet = new Set(hiddenColumns);\n const columns = Object.keys(data[0] ?? {}).filter((key) => !hiddenSet.has(key));\n\n return (\n <ScrollArea maxWidth=\"100%\" showHorizontalScrollbar showVerticalScrollbar={false}>\n <Table.Root\n size=\"sm\"\n width={fullWidth ? \"100%\" : \"fit-content\"}\n borderWidth={noBorder ? \"0\" : \"1px\"}\n borderColor=\"border.subtle\"\n >\n <Table.Header>\n <Table.Row background=\"bg.muted\">\n {columns.map((column) => (\n <Table.ColumnHeader key={column} textTransform=\"none\" paddingX=\"xs\" paddingY=\"2xs\">\n <Text textStyle=\"label/S/medium\" fontSize={scaledSmallFontSize}>\n {column}\n </Text>\n </Table.ColumnHeader>\n ))}\n </Table.Row>\n </Table.Header>\n <Table.Body>\n {data.map((row, rowIndex) => (\n <Table.Row key={`${rowIndex}-${columns.join(\"-\")}`}>\n {columns.map((column) => (\n <Table.Cell key={`${rowIndex}-${column}`} paddingX=\"xs\" paddingY=\"2xs\">\n <Text textStyle=\"paragraph/S/regular\" fontSize={scaledSmallFontSize}>\n {formatValue(row[column])}\n </Text>\n </Table.Cell>\n ))}\n </Table.Row>\n ))}\n </Table.Body>\n </Table.Root>\n </ScrollArea>\n );\n};\n","import { DecoratorNode, type NodeKey, type SerializedLexicalNode, type Spread } from \"lexical\";\nimport type React from \"react\";\nimport { DefaultRichTextDataTable } from \"../components/default-rich-text-components\";\nimport type { RowData } from \"../types/rich-text-components\";\n\nexport type { RowData } from \"../types/rich-text-components\";\n\nexport class DataTableNode extends DecoratorNode<React.JSX.Element> {\n __data: RowData[];\n\n static getType() {\n return \"data_table\";\n }\n\n static clone(node: DataTableNode) {\n return new DataTableNode(node.__data, node.__key);\n }\n\n constructor(data: RowData[], key?: NodeKey) {\n super(key);\n this.__data = data;\n }\n\n getData(): RowData[] {\n return this.__data;\n }\n\n createDOM(): HTMLElement {\n return document.createElement(\"div\");\n }\n\n updateDOM(): boolean {\n return false;\n }\n\n decorate() {\n return <DefaultRichTextDataTable fullWidth isReadOnly data={this.__data} />;\n }\n\n exportJSON(): SerializedDataTableNode {\n return {\n type: \"data_table\",\n version: 1,\n data: this.__data,\n };\n }\n\n static importJSON(json: SerializedDataTableNode) {\n return new DataTableNode(json.data);\n }\n\n getTextContent(): string {\n // Convert table data to a readable text representation\n if (!this.__data.length) return \"\";\n\n const headers = Object.keys(this.__data[0]);\n const headerRow = headers.join(\" | \");\n const separator = headers.map(() => \"---\").join(\" | \");\n const dataRows = this.__data.map((row) => headers.map((header) => String(row[header] || \"\")).join(\" | \"));\n\n return [headerRow, separator, ...dataRows].join(\"\\n\");\n }\n}\n\nexport type SerializedDataTableNode = Spread<{ data: RowData[] }, SerializedLexicalNode>;\n\nexport function $createDataTableNode(data: RowData[]) {\n return new DataTableNode(data);\n}\n\nexport function $isDataTableNode(node: unknown): node is DataTableNode {\n return node instanceof DataTableNode;\n}\n","import katex from \"katex\";\nimport type {\n DOMConversionMap,\n DOMConversionOutput,\n EditorConfig,\n LexicalNode,\n NodeKey,\n SerializedLexicalNode,\n Spread,\n} from \"lexical\";\nimport { $applyNodeReplacement, DecoratorNode, type DOMExportOutput } from \"lexical\";\nimport * as React from \"react\";\nimport { Suspense } from \"react\";\n\nconst EquationComponent = React.lazy(() => import(\"./EquationComponent\"));\n\nexport type SerializedEquationNode = Spread<\n {\n equation: string;\n inline: boolean;\n },\n SerializedLexicalNode\n>;\n\nfunction $convertEquationElement(domNode: HTMLElement): null | DOMConversionOutput {\n let equation = domNode.getAttribute(\"data-lexical-equation\");\n const inline = domNode.getAttribute(\"data-lexical-inline\") === \"true\";\n\n // Decode the equation from base64\n equation = atob(equation || \"\");\n\n if (equation) {\n const node = $createEquationNode(equation, inline);\n return { node };\n }\n\n return null;\n}\n\nexport class EquationNode extends DecoratorNode<React.ReactNode> {\n __equation: string;\n __inline: boolean;\n\n static getType(): string {\n return \"equation\";\n }\n\n static clone(node: EquationNode): EquationNode {\n return new EquationNode(node.__equation, node.__inline, node.__key);\n }\n\n constructor(equation: string, inline?: boolean, key?: NodeKey) {\n super(key);\n this.__equation = equation;\n this.__inline = inline ?? false;\n }\n\n static importJSON(serializedNode: SerializedEquationNode): EquationNode {\n return $createEquationNode(serializedNode.equation, serializedNode.inline);\n }\n\n exportJSON(): SerializedEquationNode {\n return {\n equation: this.getEquation(),\n inline: this.__inline,\n type: \"equation\",\n version: 1,\n };\n }\n\n createDOM(_config: EditorConfig): HTMLElement {\n const element = document.createElement(this.__inline ? \"span\" : \"div\");\n\n // EquationNodes should implement `user-action:none` in their CSS to avoid issues with deletion on Android.\n element.className = \"editor-equation\";\n return element;\n }\n\n exportDOM(): DOMExportOutput {\n const element = document.createElement(this.__inline ? \"span\" : \"div\");\n\n // Encode the equation as base64 to avoid issues with special characters\n const equation = btoa(this.__equation);\n element.setAttribute(\"data-lexical-equation\", equation);\n element.setAttribute(\"data-lexical-inline\", `${this.__inline}`);\n katex.render(this.__equation, element, {\n displayMode: !this.__inline, // true === block display //\n errorColor: \"#cc0000\",\n output: \"html\",\n strict: \"warn\",\n throwOnError: false,\n trust: false,\n });\n\n return { element };\n }\n\n static importDOM(): DOMConversionMap | null {\n return {\n div: (domNode: HTMLElement) => {\n if (!domNode.hasAttribute(\"data-lexical-equation\")) {\n return null;\n }\n\n return {\n conversion: $convertEquationElement,\n priority: 2,\n };\n },\n span: (domNode: HTMLElement) => {\n if (!domNode.hasAttribute(\"data-lexical-equation\")) {\n return null;\n }\n\n return {\n conversion: $convertEquationElement,\n priority: 1,\n };\n },\n };\n }\n\n updateDOM(prevNode: EquationNode): boolean {\n // If the inline property changes, replace the element\n return this.__inline !== prevNode.__inline;\n }\n\n getTextContent(): string {\n return this.__equation;\n }\n\n getEquation(): string {\n return this.__equation;\n }\n\n setEquation(equation: string): void {\n const writable = this.getWritable();\n writable.__equation = equation;\n }\n\n isInline(): boolean {\n return this.__inline;\n }\n\n decorate() {\n return (\n <Suspense fallback={null}>\n <EquationComponent equation={this.__equation} inline={this.__inline} />\n </Suspense>\n );\n }\n}\n\nexport function $createEquationNode(equation = \"\", inline = false): EquationNode {\n const equationNode = new EquationNode(equation, inline);\n return $applyNodeReplacement(equationNode);\n}\n\nexport function $isEquationNode(node: LexicalNode | null | undefined): node is EquationNode {\n return node instanceof EquationNode;\n}\n","import \"./EquationPlugin.css\";\n\nimport type { MultilineElementTransformer, TextMatchTransformer } from \"@lexical/markdown\";\nimport { $createEquationNode, $isEquationNode, EquationNode } from \"./EquationNode.tsx\";\n\nexport const EQUATION_INLINE: TextMatchTransformer = {\n dependencies: [EquationNode],\n export: (node) => {\n if ($isEquationNode(node) && node.isInline()) {\n return `\\\\( ${node.getEquation().trim()} \\\\)`;\n }\n return null;\n },\n importRegExp: /\\\\\\((.*?)\\\\\\)/,\n regExp: /\\\\\\((.*?)\\\\\\)/,\n replace: (textNode, match) => {\n const equationNode = $createEquationNode(match[1].trim(), true);\n textNode.replace(equationNode);\n },\n type: \"text-match\",\n};\n\nexport const EQUATION_MULTILINE: MultilineElementTransformer = {\n dependencies: [EquationNode],\n regExpStart: /\\\\\\[/,\n regExpEnd: /\\\\]/,\n export: (node) => {\n if ($isEquationNode(node) && !node.isInline()) {\n return `\\\\[ ${node.getEquation().trim()} \\\\]`;\n }\n return null;\n },\n replace: (rootNode, _children, _startMatch, _endMatch, linesInBetween) => {\n if (linesInBetween) {\n rootNode.append($createEquationNode(linesInBetween.join(\" \"), false));\n return true;\n }\n return false;\n },\n type: \"multiline-element\",\n};\n\nexport function EquationPlugin(): null {\n return null;\n}\n","import {\n type EditorConfig,\n ElementNode,\n type LexicalEditor,\n type LexicalNode,\n type SerializedElementNode,\n type Spread,\n} from \"lexical\";\n\nexport type SerializedHRNode = Spread<SerializedElementNode, SerializedElementNode>;\n\nexport class HRNode extends ElementNode {\n static getType() {\n return \"hr\";\n }\n\n static clone(node: HRNode) {\n return new HRNode(node?.__key);\n }\n\n static importJSON(_serializedNode: SerializedHRNode) {\n return $createHRNode();\n }\n\n exportJSON(): SerializedHRNode {\n return {\n ...super.exportJSON(),\n };\n }\n\n createDOM(_config: EditorConfig, _editor: LexicalEditor): HTMLElement {\n const element = document.createElement(\"hr\");\n element.style = \"margin: 2rem 0;\";\n return element;\n }\n\n updateDOM(_prevNode: unknown, _dom: HTMLElement, _config: EditorConfig): boolean {\n return false;\n }\n\n decorate(_editor: LexicalEditor) {\n return null;\n }\n}\n\nexport function $createHRNode(): HRNode {\n return new HRNode();\n}\n\nexport function $isHRNode(node: LexicalNode | null | undefined): node is HRNode {\n return node instanceof HRNode;\n}\n","import type { LexicalNode, NodeKey, SerializedLexicalNode } from \"lexical\";\nimport { DecoratorNode } from \"lexical\";\nimport type { ReactNode } from \"react\";\nimport { lazy, Suspense } from \"react\";\n\nconst MermaidComponent = lazy(() => import(\"./MermaidComponent\"));\n\nexport interface SerializedMermaidNode extends SerializedLexicalNode {\n type: \"mermaid\";\n code: string;\n version: 1;\n}\n\nexport class MermaidNode extends DecoratorNode<ReactNode> {\n __code: string;\n\n static getType() {\n return \"mermaid\";\n }\n\n static clone(node: MermaidNode) {\n return new MermaidNode(node.__code, node.__key);\n }\n\n constructor(code: string, key?: NodeKey) {\n super(key);\n this.__code = code;\n }\n\n createDOM() {\n return document.createElement(\"div\");\n }\n\n updateDOM() {\n return false;\n }\n\n static importJSON(serializedNode: SerializedMermaidNode): MermaidNode {\n return new MermaidNode(serializedNode.code);\n }\n\n exportJSON(): SerializedMermaidNode {\n return {\n type: \"mermaid\",\n code: this.__code,\n version: 1,\n };\n }\n\n getTextContent() {\n return `\\`\\`\\`mermaid\\n${this.__code}\\n\\`\\`\\``;\n }\n\n getCode() {\n return this.__code;\n }\n\n setCode(code: string) {\n const writable = this.getWritable();\n writable.__code = code;\n }\n\n decorate() {\n return (\n <Suspense fallback={null}>\n <MermaidComponent code={this.__code} nodeKey={this.__key} />\n </Suspense>\n );\n }\n}\n\nexport function $isMermaidNode(node: LexicalNode | null | undefined): node is MermaidNode {\n return node instanceof MermaidNode;\n}\n","import type { ElementTransformer } from \"@lexical/markdown\";\nimport type { LexicalNode } from \"lexical\";\nimport { $createHRNode, $isHRNode, HRNode } from \"./HorizontalRuleNode\";\n\nexport const HR: ElementTransformer = {\n dependencies: [HRNode],\n export: (node: LexicalNode) => {\n return $isHRNode(node) ? \"***\" : null;\n },\n regExp: /^(---|\\*\\*\\*|___)\\s?$/,\n replace: (parentNode) => {\n const line = $createHRNode();\n parentNode.replace(line);\n },\n type: \"element\",\n};\n","import {\n $createAutoLinkNode,\n $createLinkNode,\n $isAutoLinkNode,\n $isLinkNode,\n AutoLinkNode,\n LinkNode,\n} from \"@lexical/link\";\nimport type { ElementTransformer, TextMatchTransformer } from \"@lexical/markdown\";\nimport { $createTextNode, TextNode } from \"lexical\";\nimport { $createDataTableNode, $isDataTableNode, type RowData } from \"../nodes/DataTableNode\";\nimport { HR } from \"../plugins/HorizontalRulePlugin/horizontalRule\";\n\nexport const TABLE: ElementTransformer = {\n dependencies: [],\n export: (node, _traverseChildren) => {\n if ($isDataTableNode(node)) {\n const data = node.getData();\n\n if (!data.length) return \"\";\n\n const headers = Object.keys(data[0]);\n const headerRow = headers.join(\" | \");\n const separator = headers.map(() => \"---\").join(\" | \");\n const dataRows = data.map((row) => headers.map((header) => String(row[header] || \"\")).join(\" | \"));\n\n return [`| ${headerRow} |`, `| ${separator} |`, ...dataRows.map((row) => `| ${row} |`)].join(\"\\n\");\n }\n\n return null;\n },\n regExp: /^\\s*(\\|.+\\|)\\s*$/,\n replace: (parentNode, _children, match, _isImport) => {\n const previousNode = parentNode.getPreviousSibling();\n const isTableDelimiter = /^\\|?\\s*:?-{3,}:?\\s*(?:\\|\\s*:?-{3,}:?\\s*)*\\|?$/gm.test(match[0]);\n\n // if it is a delimiter, remove it\n if (isTableDelimiter) {\n parentNode.remove();\n return;\n }\n\n // Parse current row\n const cells = match[0]\n .split(\"|\")\n .slice(1, -1)\n .map((cell) => cell.trim());\n\n if (previousNode?.getType() === \"data_table\" && $isDataTableNode(previousNode)) {\n // Add row to existing table\n const existingData = previousNode.getData();\n const newRow: RowData = {};\n\n // Check if we have a placeholder row with empty values (created from headers)\n const isPlaceholderRow =\n existingData.length === 1 && Object.values(existingData[0]).every((value) => value === \"\");\n\n // Get headers from existing data structure\n const headers = existingData.length > 0 ? Object.keys(existingData[0]) : cells.map((_, index) => `col_${index}`);\n\n cells.forEach((cell, index) => {\n const header = headers[index] || `col_${index}`;\n newRow[header] = cell;\n });\n\n // If we had a placeholder row, replace it; otherwise append\n const newTableData = isPlaceholderRow ? [newRow] : [...existingData, newRow];\n const newTableNode = $createDataTableNode(newTableData);\n previousNode.replace(newTableNode);\n parentNode.remove();\n } else {\n // Create new table - treat first row as headers\n // Create a temporary empty row with these headers, which will be replaced when actual data comes\n const newRow: RowData = {};\n cells.forEach((cell, index) => {\n newRow[cell || `col_${index}`] = \"\";\n });\n\n const tableNode = $createDataTableNode([newRow]);\n parentNode.replace(tableNode);\n }\n },\n type: \"element\",\n};\n\nexport const UNDERLINE_INS_TAG: TextMatchTransformer = {\n dependencies: [TextNode],\n export: (node, _children) => {\n if (node instanceof TextNode) {\n let markdownText = node.getTextContent();\n\n if (node.hasFormat(\"bold\")) {\n markdownText = `**${markdownText}**`;\n } else if (node.hasFormat(\"italic\")) {\n markdownText = `*${markdownText}*`;\n } else if (node.hasFormat(\"underline\")) {\n markdownText = `<ins>${markdownText}</ins>`;\n } else {\n return null;\n }\n\n return markdownText;\n }\n return null;\n },\n regExp: /<ins>(.*)<\\/ins>/,\n importRegExp: /<ins>(.*)<\\/ins>/,\n replace: (node, match) => {\n const textNode = $createTextNode(match[1]);\n textNode.toggleFormat(\"underline\");\n node.replace(textNode);\n },\n type: \"text-match\",\n};\n\nexport const UNDERLINE_U_TAG: TextMatchTransformer = {\n dependencies: [TextNode],\n export: (_node, _children) => {\n return null;\n },\n regExp: /<u>(.*)<\\/u>/,\n importRegExp: /<u>(.*)<\\/u>/,\n replace: (node, match) => {\n const textNode = $createTextNode(match[1]);\n textNode.toggleFormat(\"underline\");\n node.replace(textNode);\n },\n type: \"text-match\",\n};\n\nconst BARE_URL_REGEXP = /https?:\\/\\/[^\\s<>\"']*[^\\s<>\"'.,:;\"')\\]}]/;\n\n// Strip markdown character escapes that may have leaked into a URL, e.g.\n// `https://example.com/foo\\_bar` -> `https://example.com/foo_bar`.\n// Without this, repeated save/reopen cycles would accumulate backslashes\n// because the URL is stored as both text content and href.\nconst unescapeUrl = (url: string) => url.replace(/\\\\([*_`~\\\\])/g, \"$1\");\n\nconst escapeLinkTitle = (title: string) => title.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, '\\\\\"');\n\nconst unescapeLinkTitle = (title: string | undefined) => title?.replace(/\\\\([\"\\\\])/g, \"$1\");\n\nconst normalizeEscapedUrlText = (textContent: string, href: string, exportedText: string) => {\n if (textContent !== href) {\n return exportedText;\n }\n\n const escapedHref = href.replace(/([*_`~\\\\])/g, \"\\\\$1\");\n\n return exportedText.replace(escapedHref, href);\n};\n\nexport const LINK: TextMatchTransformer = {\n dependencies: [LinkNode],\n export: (node, exportChildren) => {\n if (!$isLinkNode(node) || $isAutoLinkNode(node)) {\n return null;\n }\n\n const title = node.getTitle();\n const href = unescapeUrl(node.getURL());\n const textContent = normalizeEscapedUrlText(node.getTextContent(), href, exportChildren(node));\n\n return title != null ? `[${textContent}](${href} \"${escapeLinkTitle(title)}\")` : `[${textContent}](${href})`;\n },\n importRegExp: /(?:\\[(.+?)\\])(?:\\((?:([^()\\s]+)(?:\\s\"((?:[^\"]*\\\\\")*[^\"]*)\"\\s*)?)\\))/,\n regExp: /(?:\\[(.+?)\\])(?:\\((?:([^()\\s]+)(?:\\s\"((?:[^\"]*\\\\\")*[^\"]*)\"\\s*)?)\\))$/,\n replace: (textNode, match) => {\n const [, linkText, linkUrl, linkTitle] = match;\n const href = unescapeUrl(linkUrl);\n const linkNode = $createLinkNode(href, { title: unescapeLinkTitle(linkTitle) });\n const openBracketAmount = linkText.split(\"[\").length - 1;\n const closeBracketAmount = linkText.split(\"]\").length - 1;\n let parsedLinkText = linkText;\n let outsideLinkText = \"\";\n\n if (openBracketAmount < closeBracketAmount) {\n return;\n }\n\n if (openBracketAmount > closeBracketAmount) {\n const linkTextParts = linkText.split(\"[\");\n outsideLinkText = `[${linkTextParts[0]}`;\n parsedLinkText = linkTextParts.slice(1).join(\"[\");\n }\n\n const normalizedLinkText = unescapeUrl(parsedLinkText);\n const linkTextNode = $createTextNode(normalizedLinkText === href ? href : normalizedLinkText);\n\n linkTextNode.setFormat(textNode.getFormat());\n linkNode.append(linkTextNode);\n textNode.replace(linkNode);\n\n if (outsideLinkText) {\n linkNode.insertBefore($createTextNode(outsideLinkText));\n }\n\n return linkTextNode;\n },\n trigger: \")\",\n type: \"text-match\",\n};\n\nexport const BARE_URL: TextMatchTransformer = {\n dependencies: [AutoLinkNode],\n export: (node, exportChildren) => {\n if (!$isAutoLinkNode(node)) {\n return null;\n }\n\n const href = unescapeUrl(node.getURL());\n\n return normalizeEscapedUrlText(node.getTextContent(), href, exportChildren(node));\n },\n regExp: BARE_URL_REGEXP,\n importRegExp: BARE_URL_REGEXP,\n replace: (textNode, match) => {\n const href = unescapeUrl(match[0]);\n const autoLinkNode = $createAutoLinkNode(href);\n const linkTextNode = $createTextNode(href);\n\n linkTextNode.setFormat(textNode.getFormat());\n autoLinkNode.append(linkTextNode);\n textNode.replace(autoLinkNode);\n },\n type: \"text-match\",\n};\n\nexport const TRANSFORMERS_EXTENDED = [TABLE, HR, UNDERLINE_INS_TAG, UNDERLINE_U_TAG, LINK, BARE_URL];\n","import { AutoLinkNode, LinkNode } from \"@lexical/link\";\nimport { ListItemNode, ListNode } from \"@lexical/list\";\nimport { CHECK_LIST, LINK as LEXICAL_LINK, TRANSFORMERS } from \"@lexical/markdown\";\nimport { HeadingNode, QuoteNode } from \"@lexical/rich-text\";\nimport type { Klass, LexicalNode } from \"lexical\";\nimport { REFERENCE_LINK_TRANSFORMER, ReferenceLinkNode } from \"../markdown-editor/plugins/ReferenceLinkPlugin\";\nimport theme from \"../theme/rich-text-theme\";\nimport { CodeHighlightNode, CodeNode } from \"./lexical-code\";\nimport { DataTableNode } from \"./nodes/DataTableNode\";\nimport { EquationNode } from \"./plugins/EquationPlugin/EquationNode\";\nimport { EQUATION_INLINE, EQUATION_MULTILINE } from \"./plugins/EquationPlugin/EquationPlugin\";\nimport { HRNode } from \"./plugins/HorizontalRulePlugin/HorizontalRuleNode\";\nimport { MermaidNode } from \"./plugins/MermaidPlugin/MermaidNode\";\nimport { TRANSFORMERS_EXTENDED } from \"./transformers/markdown-transformers\";\n\nexport const editorNodes: Array<Klass<LexicalNode>> = [\n QuoteNode,\n LinkNode,\n AutoLinkNode,\n DataTableNode,\n HeadingNode,\n ListNode,\n ListItemNode,\n CodeNode,\n CodeHighlightNode,\n MermaidNode,\n EquationNode,\n HRNode,\n ReferenceLinkNode,\n];\n\nexport const baseEditorTransformers = [\n CHECK_LIST,\n ...TRANSFORMERS.filter((transformer) => transformer !== LEXICAL_LINK),\n ...TRANSFORMERS_EXTENDED,\n EQUATION_INLINE,\n EQUATION_MULTILINE,\n];\n\nexport const editorTransformers = [...baseEditorTransformers, REFERENCE_LINK_TRANSFORMER];\n\nexport const editorTheme = theme;\n","import { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport { $nodesOfType } from \"lexical\";\nimport { useEffect } from \"react\";\nimport { CodeNode } from \"../../lexical-code\";\nimport { MermaidNode } from \"../MermaidPlugin/MermaidNode\";\n\nfunction isMermaidLanguage(language: string) {\n return language.trim().toLowerCase() === \"mermaid\";\n}\n\nexport function replaceCodeNodeWithMermaidNode(node: CodeNode) {\n const language = node.getLanguage() ?? \"plaintext\";\n if (!isMermaidLanguage(language)) {\n return false;\n }\n\n node.replace(new MermaidNode(node.getTextContent()));\n return true;\n}\n\nexport function ImportCodeBlocksPlugin() {\n const [editor] = useLexicalComposerContext();\n\n useEffect(() => {\n editor.update(() => {\n const codeNodes = $nodesOfType(CodeNode);\n for (const n of codeNodes) {\n replaceCodeNodeWithMermaidNode(n);\n }\n });\n }, [editor]);\n\n return null;\n}\n","import { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport { useEffect } from \"react\";\nimport { registerCodeHighlighting } from \"../../lexical-code\";\n\nexport function CodeHighlightingPlugin() {\n const [editor] = useLexicalComposerContext();\n\n useEffect(() => {\n return registerCodeHighlighting(editor);\n }, [editor]);\n\n return null;\n}\n","import { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport { useEffect } from \"react\";\n\nexport default function ToggleEditablePlugin({ isEditable }: { isEditable: boolean }) {\n const [editor] = useLexicalComposerContext();\n\n useEffect(() => {\n editor.setEditable(isEditable);\n }, [isEditable, editor]);\n\n return null;\n}\n","import { Box } from \"@chakra-ui/react\";\nimport { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport { TreeView } from \"@lexical/react/LexicalTreeView\";\n\nexport function TreeViewPlugin() {\n const [editor] = useLexicalComposerContext();\n return (\n <Box fontSize=\"xs\" color=\"fg.muted\" padding=\"4\">\n <TreeView\n treeTypeButtonClassName=\"debug-treetype-button\"\n timeTravelButtonClassName=\"debug-timetravel-button\"\n timeTravelPanelButtonClassName=\"debug-timetravel-button\"\n timeTravelPanelClassName=\"debug-timetravel-panel\"\n timeTravelPanelSliderClassName=\"debug-timetravel-slider\"\n viewClassName=\"tree-view-output\"\n editor={editor}\n />\n </Box>\n );\n}\n","const FRONTMATTER_PATTERN = /^---\\s*\\n([\\s\\S]*?)\\n---\\s*(?:\\n|$)/;\n\nconst FENCE_PATTERN = /^```/;\nconst LIST_ITEM_PATTERN = /^([ \\t]*)((?:[-*+])|(?:\\d+\\.))\\s+/;\nconst INDENTED_LINE_PATTERN = /^([ \\t]+)/;\n\ninterface ActiveListIndent {\n normalizedIndentWidth: number;\n sourceIndentWidth: number;\n}\n\ninterface MarkdownListState {\n isInCodeFence: boolean;\n activeListIndents: ActiveListIndent[];\n}\n\nfunction getExpandedIndentWidth(indent: string) {\n let width = 0;\n\n for (const char of indent) {\n width += char === \"\\t\" ? 4 : 1;\n }\n\n return width;\n}\n\nfunction findParentIndent(activeListIndents: ActiveListIndent[], sourceIndentWidth: number) {\n return [...activeListIndents].reverse().find((indent) => indent.sourceIndentWidth < sourceIndentWidth);\n}\n\nfunction toNormalizedIndent(indent: string, normalizedWidth: number, sourceWidth: number) {\n if (normalizedWidth === sourceWidth && !indent.includes(\"\\t\")) return indent;\n return \" \".repeat(normalizedWidth);\n}\n\nfunction normalizeIndentedContinuation(line: string, activeListIndents: ActiveListIndent[]) {\n const indentedLineMatch = line.match(INDENTED_LINE_PATTERN);\n if (!indentedLineMatch) {\n if (line.trim() !== \"\") {\n activeListIndents.length = 0;\n }\n\n return line;\n }\n\n const sourceIndentWidth = getExpandedIndentWidth(indentedLineMatch[1]);\n const parentLevel = findParentIndent(activeListIndents, sourceIndentWidth);\n if (!parentLevel) return line;\n\n const normalizedIndentWidth = sourceIndentWidth + (parentLevel.normalizedIndentWidth - parentLevel.sourceIndentWidth);\n const normalizedIndent = toNormalizedIndent(indentedLineMatch[1], normalizedIndentWidth, sourceIndentWidth);\n\n if (normalizedIndent === indentedLineMatch[1]) return line;\n\n return `${normalizedIndent}${line.slice(indentedLineMatch[1].length)}`;\n}\n\nfunction normalizeListItem(line: string, match: RegExpMatchArray, activeListIndents: ActiveListIndent[]) {\n const sourceIndentWidth = getExpandedIndentWidth(match[1]);\n\n while (activeListIndents.length && activeListIndents.at(-1)!.sourceIndentWidth > sourceIndentWidth) {\n activeListIndents.pop();\n }\n\n const currentLevel = activeListIndents.at(-1);\n if (currentLevel?.sourceIndentWidth === sourceIndentWidth) {\n return `${toNormalizedIndent(match[1], currentLevel.normalizedIndentWidth, sourceIndentWidth)}${line.slice(match[1].length)}`;\n }\n\n const parentLevel = activeListIndents.at(-1);\n const indentStep = sourceIndentWidth - (parentLevel?.sourceIndentWidth ?? 0);\n let normalizedIndentWidth = sourceIndentWidth;\n\n if (parentLevel && indentStep === 2 && !match[1].includes(\"\\t\")) {\n normalizedIndentWidth = parentLevel.normalizedIndentWidth + 4;\n }\n\n activeListIndents.push({ normalizedIndentWidth, sourceIndentWidth });\n\n return `${toNormalizedIndent(match[1], normalizedIndentWidth, sourceIndentWidth)}${line.slice(match[1].length)}`;\n}\n\nfunction normalizeMarkdownLine(line: string, state: MarkdownListState) {\n if (FENCE_PATTERN.test(line.trimStart())) {\n state.isInCodeFence = !state.isInCodeFence;\n return line;\n }\n\n if (state.isInCodeFence) return line;\n\n const match = line.match(LIST_ITEM_PATTERN);\n if (!match) return normalizeIndentedContinuation(line, state.activeListIndents);\n\n return normalizeListItem(line, match, state.activeListIndents);\n}\n\nexport function normalizeMarkdownListIndentation(content: string) {\n const lines = content.split(\"\\n\");\n const state: MarkdownListState = { isInCodeFence: false, activeListIndents: [] };\n\n return lines.map((line) => normalizeMarkdownLine(line, state)).join(\"\\n\");\n}\n\nexport function splitFrontmatter(content: string) {\n const match = content.match(FRONTMATTER_PATTERN);\n if (!match) {\n return { frontmatter: \"\", body: content };\n }\n return {\n frontmatter: match[0],\n body: content.slice(match[0].length),\n };\n}\n","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 { 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: \"table\" | \"connector\";\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 { 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: \"table\" | \"connector\";\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 { $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: \"table\" | \"connector\") => 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: \"table\" | \"connector\";\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 ReferenceItem = {\n resourceId: string;\n resourceType: \"table\" | \"connector\";\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: \"table\" | \"connector\") => 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 { Box } from \"@chakra-ui/react\";\nimport {\n DecoratorNode,\n type EditorConfig,\n type LexicalEditor,\n type LexicalNode,\n type NodeKey,\n type SerializedLexicalNode,\n type Spread,\n} from \"lexical\";\nimport type { ReactElement } from \"react\";\nimport { ResourceBadge } from \"@/components/primitives/resource-badge\";\n\nexport type SerializedReferenceLinkNode = Spread<\n {\n href: string;\n label?: string;\n },\n SerializedLexicalNode\n>;\n\nexport class ReferenceLinkNode extends DecoratorNode<ReactElement> {\n __href: string;\n __label?: string;\n\n static getType(): string {\n return \"reference-link\";\n }\n\n static clone(node: ReferenceLinkNode): ReferenceLinkNode {\n return new ReferenceLinkNode(node.__href, node.__label, node.__key);\n }\n\n constructor(href: string, label?: string, key?: NodeKey) {\n super(key);\n this.__href = href;\n this.__label = label;\n }\n\n createDOM(_config: EditorConfig, _editor: LexicalEditor): HTMLElement {\n return document.createElement(\"span\");\n }\n\n updateDOM(_prevNode: ReferenceLinkNode, _dom: HTMLElement, _config: EditorConfig): boolean {\n return false;\n }\n\n getTextContent(): string {\n const label = this.__label ?? this.__href;\n return `{{link('${label}')}}`;\n }\n\n exportJSON(): SerializedReferenceLinkNode {\n return {\n type: ReferenceLinkNode.getType(),\n version: 1,\n href: this.__href,\n label: this.__label,\n };\n }\n\n static importJSON(serializedNode: SerializedReferenceLinkNode): ReferenceLinkNode {\n return $createReferenceLinkNode(serializedNode.href, serializedNode.label);\n }\n\n decorate(_editor: LexicalEditor, _config: EditorConfig): ReactElement {\n const href = this.__href;\n const fileName = href.split(\"/\").pop();\n const label = fileName || \"unknown\";\n const isExternal = /^https?:\\/\\//i.test(href);\n const isProjectFile = /^#?\\$PROJECT\\//i.test(href);\n\n return (\n <Box width=\"fit-content\" display=\"inline-block\">\n <ResourceBadge\n fileName={label}\n onSelect={() => {\n if (isExternal) {\n window.open(href, \"_blank\", \"noopener,noreferrer\");\n } else if (isProjectFile) {\n const projectPath = href.replace(/^#?\\$PROJECT\\//i, \"\");\n const event = new CustomEvent(\"ui:open-project-file\", { detail: projectPath });\n window.dispatchEvent(event);\n } else {\n window.location.assign(href);\n }\n }}\n />\n </Box>\n );\n }\n}\n\nexport function $createReferenceLinkNode(href: string, label?: string): ReferenceLinkNode {\n return new ReferenceLinkNode(href, label);\n}\n\nexport function $isReferenceLinkNode(node: LexicalNode | null | undefined): node is ReferenceLinkNode {\n return node instanceof ReferenceLinkNode;\n}\n","import type { TextMatchTransformer } from \"@lexical/markdown\";\nimport { $createReferenceLinkNode, $isReferenceLinkNode, ReferenceLinkNode } from \"./ReferenceLinkNode\";\n\n// Matches {{link('xxx')}} or {{ link(\"xxx\") }}\nconst LINK_REGEXP = /\\{\\{\\s*link\\((['\"])([^'\"\\s]+)\\1\\)\\s*\\}\\}/;\n\nexport const REFERENCE_LINK_TRANSFORMER: TextMatchTransformer = {\n dependencies: [ReferenceLinkNode],\n export: (node) => {\n if ($isReferenceLinkNode(node)) {\n const href = (node as ReferenceLinkNode).__href;\n const label = (node as ReferenceLinkNode).__label ?? href;\n // Export back to token form so markdown roundtrips\n if (label) {\n return `{{link('${label}')}}`;\n }\n return `{{link('${href}')}}`;\n }\n return null;\n },\n regExp: LINK_REGEXP,\n importRegExp: LINK_REGEXP,\n replace: (textNode, match) => {\n const value = match[2];\n // For now we assume value is both label and href; if it looks like a URL, use as href.\n const looksLikeUrl = /^(https?:\\/\\/|\\/)/i.test(value);\n const href = looksLikeUrl ? value : `#${value}`;\n const label = value;\n textNode.replace($createReferenceLinkNode(href, label));\n },\n type: \"text-match\",\n};\n","import \"../theme/rich-text-theme.css\";\n\nimport { Flex } from \"@chakra-ui/react\";\nimport { AutoLinkNode, LinkNode } from \"@lexical/link\";\nimport { ListItemNode, ListNode } from \"@lexical/list\";\nimport { $convertFromMarkdownString, $convertToMarkdownString } from \"@lexical/markdown\";\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 { HeadingNode, QuoteNode } from \"@lexical/rich-text\";\nimport { $getRoot } from \"lexical\";\nimport { ContentEditable } from \"../shared/components/content-editable\";\nimport { baseEditorTransformers } from \"../shared/editor-config\";\nimport { CodeHighlightNode, CodeNode } from \"../shared/lexical-code\";\nimport { DataTableNode } from \"../shared/nodes/DataTableNode\";\nimport { ImportCodeBlocksPlugin } from \"../shared/plugins/CodePlugin/CodeBlockPlugin\";\nimport { CodeHighlightingPlugin } from \"../shared/plugins/CodePlugin/CodeHighlightingPlugin\";\nimport { EquationNode } from \"../shared/plugins/EquationPlugin/EquationNode\";\nimport { EquationPlugin } from \"../shared/plugins/EquationPlugin/EquationPlugin\";\nimport { HRNode } from \"../shared/plugins/HorizontalRulePlugin/HorizontalRuleNode\";\nimport { MermaidNode } from \"../shared/plugins/MermaidPlugin/MermaidNode\";\nimport StateUpdatePlugin from \"../shared/plugins/StateUpdatePlugin\";\nimport ToggleEditablePlugin from \"../shared/plugins/ToggleEditablePlugin\";\nimport { TreeViewPlugin } from \"../shared/plugins/TreeViewPlugin/TreeViewPlugin\";\nimport theme from \"../theme/rich-text-theme\";\nimport { normalizeMarkdownListIndentation, splitFrontmatter } from \"../utils/markdown\";\nimport { REFERENCE_LINK_TRANSFORMER, ReferenceLinkNode } from \"./plugins/ReferenceLinkPlugin\";\n\nexport interface RichMessageProps {\n debug?: boolean;\n defaultState: string;\n fullWidth?: boolean;\n isEditable?: boolean;\n onChange?: (value: string) => void;\n}\n\nconst transformers = [...baseEditorTransformers, REFERENCE_LINK_TRANSFORMER];\n\nexport function RichMessage(props: RichMessageProps) {\n const { debug = false, defaultState = \"\", fullWidth = false, isEditable = false, onChange } = props;\n const { frontmatter, body } = splitFrontmatter(defaultState);\n const shouldTrackChanges = isEditable && Boolean(onChange);\n\n const initialConfig = {\n namespace: \"RICH_MESSAGE\",\n nodes: [\n QuoteNode,\n LinkNode,\n AutoLinkNode,\n DataTableNode,\n HeadingNode,\n ListNode,\n ListItemNode,\n CodeNode,\n CodeHighlightNode,\n MermaidNode,\n EquationNode,\n HRNode,\n ReferenceLinkNode,\n ],\n editorState: () => {\n return $convertFromMarkdownString(normalizeMarkdownListIndentation(body), transformers, undefined, false);\n },\n onError: (error: Error) => console.error(error),\n editable: isEditable,\n theme,\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 <LexicalComposer initialConfig={initialConfig}>\n <StateUpdatePlugin\n value={body}\n onUpdate={(value: string) => {\n $convertFromMarkdownString(normalizeMarkdownListIndentation(value), transformers, undefined, false);\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) => {\n editorState.read(() => {\n const root = $getRoot();\n const markdownBody = $convertToMarkdownString(transformers, root);\n onChange?.(frontmatter + markdownBody);\n });\n }}\n />\n ) : null}\n <ToggleEditablePlugin isEditable={isEditable} />\n {debug && <TreeViewPlugin />}\n </LexicalComposer>\n </Flex>\n );\n}\n"],"names":["StyledEditable","chakra","LexicalContentEditable","ContentEditable","t0","$","_c","onRef","fullWidth","t1","padding","isRichMessage","t2","scrollable","t3","undefined","t4","t5","t6","jsx","t7","Box","editor","t8","t9","Symbol","for","width","minH","t10","ScrollArea","ReferenceLinkNode","DecoratorNode","__href","__label","getType","clone","node","__key","constructor","href","label","key","createDOM","_config","_editor","document","createElement","updateDOM","_prevNode","_dom","getTextContent","exportJSON","type","version","importJSON","serializedNode","$createReferenceLinkNode","decorate","split","pop","isExternal","test","isProjectFile","ResourceBadge","window","open","projectPath","replace","event","CustomEvent","detail","dispatchEvent","location","assign","$isReferenceLinkNode","LINK_REGEXP","REFERENCE_LINK_TRANSFORMER","dependencies","export","regExp","importRegExp","textNode","match","value","theme","code","codeHighlight","atrule","attr","boolean","builtin","cdata","char","class","comment","constant","deleted","doctype","entity","function","important","inserted","keyword","namespace","number","operator","prolog","property","punctuation","regex","selector","string","symbol","tag","url","variable","embedBlock","base","focus","list","checklist","listitem","listitemChecked","listitemUnchecked","nested","olDepth","ol","ul","heading","h1","h2","h3","paragraph","text","underline","italic","link","quote","reference","table","tableCell","tableRow","tableCellHeader","layoutContainer","layoutItem","draggableBlockDemo","row","content","scaledSmallFontSize","formatValue","length","String","toUpperCase","Date","toISOString","JSON","stringify","DefaultRichTextCodeEditor","props","defaultCode","isEditable","showLineNumbers","disableScroll","Textarea","lines","map","_temp","codeBlock","DefaultRichTextDataTable","data","noBorder","hiddenColumns","Text","Set","hiddenSet","Object","keys","filter","has","columns","Table","_temp2","t11","rowIndex","column_0","column","join","t12","jsxs","line","index","DataTableNode","__data","getData","json","headers","headerRow","separator","dataRows","header","$createDataTableNode","$isDataTableNode","EquationComponent","React","lazy","$convertEquationElement","domNode","equation","getAttribute","inline","atob","$createEquationNode","EquationNode","__equation","__inline","getEquation","element","className","exportDOM","btoa","setAttribute","katex","render","displayMode","errorColor","output","strict","throwOnError","trust","importDOM","div","hasAttribute","conversion","priority","span","prevNode","setEquation","writable","getWritable","isInline","Suspense","equationNode","$applyNodeReplacement","$isEquationNode","EQUATION_INLINE","trim","EQUATION_MULTILINE","regExpStart","regExpEnd","rootNode","_children","_startMatch","_endMatch","linesInBetween","append","EquationPlugin","HRNode","ElementNode","_serializedNode","$createHRNode","style","$isHRNode","MermaidComponent","MermaidNode","__code","getCode","setCode","$isMermaidNode","HR","parentNode","TABLE","_traverseChildren","_isImport","previousNode","getPreviousSibling","remove","cells","slice","cell","existingData","newRow","isPlaceholderRow","values","every","_","forEach","newTableData","newTableNode","tableNode","UNDERLINE_INS_TAG","TextNode","markdownText","hasFormat","$createTextNode","toggleFormat","UNDERLINE_U_TAG","_node","BARE_URL_REGEXP","unescapeUrl","escapeLinkTitle","title","unescapeLinkTitle","normalizeEscapedUrlText","textContent","exportedText","escapedHref","LINK","LinkNode","exportChildren","$isLinkNode","$isAutoLinkNode","getTitle","getURL","linkText","linkUrl","linkTitle","linkNode","$createLinkNode","openBracketAmount","closeBracketAmount","parsedLinkText","outsideLinkText","linkTextParts","normalizedLinkText","linkTextNode","setFormat","getFormat","insertBefore","trigger","BARE_URL","AutoLinkNode","autoLinkNode","$createAutoLinkNode","TRANSFORMERS_EXTENDED","editorNodes","QuoteNode","HeadingNode","ListNode","ListItemNode","CodeNode","CodeHighlightNode","baseEditorTransformers","CHECK_LIST","TRANSFORMERS","transformer","LEXICAL_LINK","editorTransformers","editorTheme","isMermaidLanguage","language","toLowerCase","replaceCodeNodeWithMermaidNode","getLanguage","ImportCodeBlocksPlugin","useLexicalComposerContext","update","useEffect","codeNodes","$nodesOfType","n","CodeHighlightingPlugin","registerCodeHighlighting","ToggleEditablePlugin","setEditable","TreeViewPlugin","TreeView","FRONTMATTER_PATTERN","FENCE_PATTERN","LIST_ITEM_PATTERN","INDENTED_LINE_PATTERN","getExpandedIndentWidth","indent","findParentIndent","activeListIndents","sourceIndentWidth","reverse","find","toNormalizedIndent","normalizedWidth","sourceWidth","includes","repeat","normalizeIndentedContinuation","indentedLineMatch","parentLevel","normalizedIndentWidth","normalizedIndent","normalizeListItem","at","currentLevel","indentStep","push","normalizeMarkdownLine","state","trimStart","isInCodeFence","normalizeMarkdownListIndentation","splitFrontmatter","frontmatter","body","INSERT_REFERENCE","INSERT_BLOCK","INSERT_REFERENCE_COMMAND","createCommand","INSERT_BLOCK_COMMAND","convertCommentElement","$createCommentNode","textAlign","CommentNode","config","addClassNamesToElement","blockquote","isHTMLElement","isEmpty","formatType","getFormatType","direction","getDirection","dir","format","setIndent","setDirection","insertNewAfter","restoreSelection","newBlock","$createParagraphNode","insertAfter","collapseAtStart","children","getChildren","child","insertCommentBlock","_blockType","nodeToReplace","selection","$getSelection","commentNode","nodeParent","getParent","selectEnd","$isRangeSelection","$setBlocksType","useCommentCommands","mergeRegister","registerCommand","COMMAND_PRIORITY_LOW","optionId","useCommentSchema","registerNodeTransform","invalidChildren","child_0","CommentPlugin","$getTextContent","root","childrenLength","i","$isElementNode","getReferenceMarker","name","referenceId","shouldAppendParagraphBreak","Boolean","traverseSerializedNode","referenceMarker","Array","isArray","getTextFromSerializedEditorState","parsed","parse","emptyEditorState","textFormat","generateEditorStateFromString","input","mode","ImperativeAPIPlugin","editorRef","previousTextRef","setEditorValue","parseEditorState","setEditorState","current","defaultSelection","useImperativeHandle","shouldSubmitOnEnter","ctrlKey","metaKey","shiftKey","altKey","KeyboardShortcutPlugin","onSubmit","KEY_DOWN_COMMAND","preventDefault","COMMAND_PRIORITY_HIGH","menuSortOrder","getSortedMenuOptions","options","sort","a","b","indexOf","group","option","reduce","acc","bucket","ReferenceMenuItem","id","isSelected","onClick","onMouseEnter","setRefElement","secondaryLabel","primaryLabel","tabIndex","bg","Tooltip","Flex","ReferenceMenu","selectedIndex","onSelectItem","onMouseEnterItem","connector","hasResults","getElementById","scrollIntoView","behavior","block","T0","md","Fragment","description","option_0","t13","localFilter","q","m","useContextLookup","queryString","items","baseOptions","res","resourceId","resourceType","VALID_PUNCTUATION","TRIGGERS","VALID_CHARS","VALID_JOINS","LENGTH_LIMIT","TriggerRegex","RegExp","AliasRegex","checkForTriggers","minMatchLength","exec","maybeLeadingWhitespace","matchingString","leadOffset","replaceableString","SUGGESTION_LIST_LENGTH_LIMIT","ReferenceMenuPlugin","setQueryString","useState","searchResults","selectedOption","closeMenu","dispatchCommand","onSelectOption","checkForTrigger","menuOptions","LexicalTypeaheadMenuPlugin","anchorElementRef","selectOptionAndCleanUp","setHighlightedIndex","ReactDOM","createPortal","i_0","ReferenceNode","__referenceId","__name","isKeyboardSelectable","canBeEmpty","canInsertTextAfter","canInsertTextBefore","dom","el","$convertReferenceElement","$createReferenceNode","$insertExistingReference","refNode","ReferencePlugin","onAddReference","promptInputTheme","baseTheme","nodes","MarkNode","BasePromptEditor","ref","defaultState","debug","placeholder","onChange","onError","references","editorState","editable","initialConfig","useRef","Kbd","placeholderNode","HistoryPlugin","RichTextPlugin","LexicalErrorBoundary","OnChangePlugin","read","$getRoot","rawText","toJSON","t14","t15","t16","t17","t18","t19","LexicalComposer","PromptEditor","forwardRef","StateUpdatePlugin","onUpdate","transformers","RichMessage","shouldTrackChanges","$convertFromMarkdownString","LinkPlugin","ClickableLinkPlugin","ListPlugin","TabIndentationPlugin","HorizontalRulePlugin","markdownBody","$convertToMarkdownString","t20","t21","error","console"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,MAAMA,KAAiBC,GAAOC,EAAsB;AAU7C,SAAAC,GAAAC,GAAA;AAAA,QAAAC,IAAAC,EAAA,EAAA,GAAyB;AAAA,IAAAC,OAAAA;AAAAA,IAAAC,WAAAC;AAAAA,IAAAC,SAAAA;AAAAA,IAAAC,eAAAC;AAAAA,IAAAC,YAAAC;AAAAA,EAAAA,IAAAV,GAE9BI,IAAAC,MAAAM,SAAA,KAAAN,GAEAE,IAAAC,MAAAG,SAAA,KAAAH,GACAC,IAAAC,MAAAC,SAAA,KAAAD,GASgBE,IAAAR,IAAA,SAAA,SACIS,IAAAT,IAAA,MAAA;AAAwB,MAAAU;AAAA,EAAAb,EAAA,CAAA,MAAAW,KAAAX,SAAAY,KANxCC,IAAA,gBAAAC,EAACnB,MACa,eAAA,oBACL,QAAA,eACF,MAAA,QACC,OAAA,QACI,UAAAgB,GACI,cAAAC,GACJ,WAAA,uBACD,UAAA,mEACA,UAAA,YACD,SAAA,OAAA,CAAM,GACdZ,OAAAW,GAAAX,OAAAY,GAAAZ,OA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