eddyter 1.3.41 → 1.3.43
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/README.md +483 -483
- package/dist/App.d.ts +3 -2
- package/dist/Provider/EditorProvider.d.ts +32 -31
- package/dist/Provider/LexicalProvider.d.ts +6 -5
- package/dist/api/ai/index.d.ts +83 -32
- package/dist/api/auth.d.ts +108 -108
- package/dist/api/config/axios.d.ts +2 -1
- package/dist/api/config/endpoints.d.ts +24 -22
- package/dist/api/featureSuggestion.d.ts +23 -23
- package/dist/api/linkPreview.d.ts +15 -15
- package/dist/api/transcript/index.d.ts +21 -21
- package/dist/assets/style.css +5269 -5287
- package/dist/{babel-d3085146.js → babel-d155920e.js} +3278 -3551
- package/dist/babel-d155920e.js.map +1 -0
- package/dist/components/AiPlugin/index.d.ts +6 -6
- package/dist/components/AlignMenu/AlignMenu.d.ts +9 -8
- package/dist/components/AlignMenu/AlignMenuDrop.d.ts +3 -2
- package/dist/components/AlignMenu/index.d.ts +1 -1
- package/dist/components/AutoExpandingDemo.d.ts +6 -5
- package/dist/components/BlockFormatMenu/BlockFormatMenu.d.ts +3 -2
- package/dist/components/BlockFormatMenu/constants.d.ts +14 -14
- package/dist/components/BlockFormatMenu/index.d.ts +1 -1
- package/dist/components/ChartEditDialog.d.ts +9 -8
- package/dist/components/ChartInsertDialog.d.ts +8 -7
- package/dist/components/CodeActionMenuPlugin/components/CopyButton/index.d.ts +7 -6
- package/dist/components/CodeActionMenuPlugin/components/PrettierButton/index.d.ts +9 -8
- package/dist/components/CodeActionMenuPlugin/index.d.ts +5 -4
- package/dist/components/CodeActionMenuPlugin/utils.d.ts +1 -1
- package/dist/components/ColorPicker/ColorPicker.d.ts +3 -2
- package/dist/components/ColorPicker/index.d.ts +1 -1
- package/dist/components/CommentSidebar/CommentSidebar.d.ts +8 -7
- package/dist/components/CommentSidebar/index.d.ts +1 -1
- package/dist/components/CommentToggle/CommentToggle.d.ts +8 -7
- package/dist/components/CommentToggle/index.d.ts +1 -1
- package/dist/components/CommentView/CommentView.d.ts +9 -8
- package/dist/components/CommentView/index.d.ts +1 -1
- package/dist/components/ConfigurableEditorWithAuth.d.ts +35 -34
- package/dist/components/ContentPreview/index.d.ts +37 -36
- package/dist/components/DatePicker/DatePickerWidget.d.ts +7 -6
- package/dist/components/EmojiPickerWidget/EmojiPickerWidget.d.ts +3 -2
- package/dist/components/EmojiPickerWidget/index.d.ts +1 -1
- package/dist/components/FeatureSuggestionDialog/index.d.ts +6 -6
- package/dist/components/FileUpload/InsertFileDialog.d.ts +7 -7
- package/dist/components/FileUpload/InsertFileUploadedDialogBody.d.ts +5 -4
- package/dist/components/FileView/index.d.ts +9 -8
- package/dist/components/FontFamilySelect/FontFamilyMenu.d.ts +7 -6
- package/dist/components/FontSizePicker/FontSizeControl.d.ts +3 -2
- package/dist/components/FormatTextMenu/FormatTextMenu.d.ts +3 -2
- package/dist/components/FormatTextMenu/FormatTextMenuDrop.d.ts +3 -2
- package/dist/components/FormatTextMenu/index.d.ts +1 -1
- package/dist/components/HighlightColorPicker/HighlightColorPicker.d.ts +7 -6
- package/dist/components/HtmlViewDisplay.d.ts +3 -2
- package/dist/components/ImageComparisonDialog/index.d.ts +11 -10
- package/dist/components/ImageGenerationDialog/ImageGenerationManager.d.ts +11 -10
- package/dist/components/ImageGenerationDialog/index.d.ts +11 -10
- package/dist/components/ImageInsertTest.d.ts +3 -2
- package/dist/components/ImageView/ImageDialog/ImageUploadDialogBody.d.ts +9 -8
- package/dist/components/ImageView/ImageDialog/index.d.ts +6 -5
- package/dist/components/ImageView/ImageResizer.d.ts +16 -15
- package/dist/components/ImageView/index.d.ts +17 -16
- package/dist/components/InsertMenu/InsertMenu.d.ts +9 -8
- package/dist/components/InsertMenu/InsertMenuDrop.d.ts +9 -8
- package/dist/components/InsertMenu/index.d.ts +1 -1
- package/dist/components/LanguageSelectorDialog/index.d.ts +8 -7
- package/dist/components/LinkPreviewHover/index.d.ts +40 -40
- package/dist/components/NotePanelMenu/NotePanelMenu.d.ts +6 -5
- package/dist/components/NotePanelMenu/index.d.ts +1 -1
- package/dist/components/NotePanelView/NotePanelView.d.ts +9 -8
- package/dist/components/NotePanelView/index.d.ts +1 -1
- package/dist/components/Placeholder/Placeholder.d.ts +3 -2
- package/dist/components/Placeholder/index.d.ts +1 -1
- package/dist/components/Placeholder/styles.d.ts +1 -1
- package/dist/components/ScopedEditor.d.ts +8 -8
- package/dist/components/SignatureCaption/index.d.ts +6 -5
- package/dist/components/TableColorPicker/index.d.ts +8 -7
- package/dist/components/TableModal/TableModal.d.ts +10 -9
- package/dist/components/TextEnhanceDialog/index.d.ts +10 -9
- package/dist/components/ToneAdjustDialog/index.d.ts +8 -7
- package/dist/components/Toolbar/Toolbar.d.ts +3 -2
- package/dist/components/Toolbar/index.d.ts +1 -1
- package/dist/components/Toolbar/styles.d.ts +6 -6
- package/dist/components/VoiceTranscriptIcon/VoiceTranscriptIcon.d.ts +2 -1
- package/dist/components/VoiceTranscriptIcon/index.d.ts +1 -1
- package/dist/components/ui/avatar.d.ts +6 -6
- package/dist/components/ui/badge.d.ts +9 -8
- package/dist/components/ui/button.d.ts +11 -10
- package/dist/components/ui/calendar.d.ts +8 -7
- package/dist/components/ui/card.d.ts +8 -8
- package/dist/components/ui/checkbox.d.ts +4 -4
- package/dist/components/ui/dialog.d.ts +19 -19
- package/dist/components/ui/dropdown-menu.d.ts +27 -27
- package/dist/components/ui/input.d.ts +3 -3
- package/dist/components/ui/label.d.ts +4 -4
- package/dist/components/ui/popover.d.ts +7 -7
- package/dist/components/ui/select.d.ts +13 -13
- package/dist/components/ui/separator.d.ts +4 -4
- package/dist/components/ui/sheet.d.ts +24 -24
- package/dist/components/ui/skeleton.d.ts +3 -3
- package/dist/components/ui/tabs.d.ts +7 -7
- package/dist/components/ui/textarea.d.ts +3 -3
- package/dist/components/ui/tooltip.d.ts +7 -7
- package/dist/constants.d.ts +22 -21
- package/dist/context/CommentContext.d.ts +43 -42
- package/dist/context/HtmlViewContext.d.ts +17 -16
- package/dist/context/ToolbarContext.d.ts +56 -55
- package/dist/editorConfig.d.ts +48 -48
- package/dist/{estree-164983f6.js → estree-b1fff53b.js} +1778 -1763
- package/dist/estree-b1fff53b.js.map +1 -0
- package/dist/hooks/useAutoExpandingHeight.d.ts +15 -15
- package/dist/hooks/useBlockFormat.d.ts +17 -16
- package/dist/hooks/useColorPicker.d.ts +6 -6
- package/dist/hooks/useCustomCommands.d.ts +3 -2
- package/dist/hooks/useDebounce.d.ts +1 -1
- package/dist/hooks/useEditorToolbar.d.ts +10 -9
- package/dist/hooks/useInsertMenu.d.ts +9 -9
- package/dist/hooks/useModal.d.ts +5 -5
- package/dist/hooks/useReactNativeBridge.d.ts +54 -54
- package/dist/hooks/useS3Uploader.d.ts +11 -11
- package/dist/hooks/useVoiceToText.d.ts +20 -20
- package/dist/{html-5586dbf6.js → html-f95ee5dc.js} +656 -701
- package/dist/html-f95ee5dc.js.map +1 -0
- package/dist/{html2pdf.bundle-85e30143.js → html2pdf.bundle-29ea2f41.js} +2 -2
- package/dist/html2pdf.bundle-29ea2f41.js.map +1 -0
- package/dist/{html2pdf.bundle.min-eb51bd12.js → html2pdf.bundle.min-f6392183.js} +2 -2
- package/dist/html2pdf.bundle.min-f6392183.js.map +1 -0
- package/dist/{index-f679e2a3.js → index-34ac313f.js} +18 -5
- package/dist/index-34ac313f.js.map +1 -0
- package/dist/{index-0632c8fb.js → index-4ea49f5b.js} +2 -2
- package/dist/index-4ea49f5b.js.map +1 -0
- package/dist/{index-7b5e3701.js → index-636eff7f.js} +984 -934
- package/dist/index-636eff7f.js.map +1 -0
- package/dist/index.d.ts +14 -14
- package/dist/index.js +11 -11
- package/dist/lib/utils.d.ts +2 -1
- package/dist/main.d.ts +1 -0
- package/dist/{markdown-d513479b.js → markdown-1d9e6c3f.js} +1789 -1836
- package/dist/markdown-1d9e6c3f.js.map +1 -0
- package/dist/nodes/ChartNode.d.ts +41 -40
- package/dist/nodes/CommentNode.d.ts +34 -33
- package/dist/nodes/CommentedTextNode.d.ts +29 -28
- package/dist/nodes/EmbedNode.d.ts +32 -31
- package/dist/nodes/FileNode.d.ts +32 -31
- package/dist/nodes/ImageNode.d.ts +65 -64
- package/dist/nodes/MentionNode.d.ts +75 -74
- package/dist/nodes/NotePanelNode.d.ts +31 -30
- package/dist/pages/ConfigurableEditor/ConfigurableEditor.d.ts +25 -24
- package/dist/pages/ConfigurableEditor/index.d.ts +2 -2
- package/dist/pages/NotFound.d.ts +2 -2
- package/dist/pages/RichTextEditor.d.ts +6 -6
- package/dist/pages/TextareaEditor.d.ts +6 -6
- package/dist/pages/styles.d.ts +5 -5
- package/dist/plugins/AIChatPlugin.d.ts +11 -10
- package/dist/plugins/AndroidKeyboardFixPlugin.d.ts +16 -16
- package/dist/plugins/AutocompletePlugin.d.ts +22 -22
- package/dist/plugins/CodeBlockNormalizerPlugin.d.ts +8 -8
- package/dist/plugins/CodeBlockSelectAllPlugin.d.ts +8 -8
- package/dist/plugins/CodeHighlightPlugin.d.ts +3 -2
- package/dist/plugins/CombinedAutocompletGrammarPlugin.d.ts +21 -20
- package/dist/plugins/CommentBubblePlugin.d.ts +3 -2
- package/dist/plugins/CommentPlugin.d.ts +7 -6
- package/dist/plugins/CustomHorizontalRulePlugin/CustomHorizontalRuleNode.d.ts +29 -28
- package/dist/plugins/CustomHorizontalRulePlugin/CustomHorizontalRulePlugin.d.ts +3 -3
- package/dist/plugins/CustomHorizontalRulePlugin/HorizontalRuleCustomizationDialog.d.ts +7 -6
- package/dist/plugins/CustomHorizontalRulePlugin/index.d.ts +3 -3
- package/dist/plugins/DragDropPastePlugin/index.d.ts +8 -8
- package/dist/plugins/EmbedPreviewPlugin/FloatingEmbedMenuPlugin.d.ts +4 -3
- package/dist/plugins/EmbedPreviewPlugin/index.d.ts +6 -5
- package/dist/plugins/FilePlugin.d.ts +8 -7
- package/dist/plugins/FloatingLinkEditorPlugin/index.d.ts +6 -5
- package/dist/plugins/FloatingTextFormatToolbarPlugin/index.d.ts +27 -26
- package/dist/plugins/GrammarCheckPlugin.d.ts +2 -1
- package/dist/plugins/HtmlCodeViewPlugin/index.d.ts +2 -2
- package/dist/plugins/HtmlImportPlugin.d.ts +5 -5
- package/dist/plugins/HtmlSyncPlugin.d.ts +3 -3
- package/dist/plugins/ImagePlugin.d.ts +7 -6
- package/dist/plugins/LinkPlugin/index.d.ts +6 -5
- package/dist/plugins/LinkPreviewPlugin/index.d.ts +4 -4
- package/dist/plugins/LocalStoragePlugin.d.ts +7 -6
- package/dist/plugins/MarkdownShortcutsPlugin/index.d.ts +20 -20
- package/dist/plugins/MentionsPlugin/index.d.ts +7 -6
- package/dist/plugins/NotePanelPlugin.d.ts +7 -6
- package/dist/plugins/PasteOptionsPlugin/index.d.ts +17 -17
- package/dist/plugins/RichTextPastePlugin/index.d.ts +6 -5
- package/dist/plugins/SignatureCanvasPlugin/SignatureCanvasDialog.d.ts +6 -5
- package/dist/plugins/SignatureCanvasPlugin/SignatureCanvasPlugin.d.ts +9 -9
- package/dist/plugins/SignatureCanvasPlugin/index.d.ts +2 -2
- package/dist/plugins/SlashCommandPlugin/index.d.ts +2 -2
- package/dist/plugins/TableActionMenuPlugin/index.d.ts +6 -5
- package/dist/plugins/TableCellResizer/index.d.ts +2 -1
- package/dist/plugins/TableHoverActionsPlugin/index.d.ts +4 -4
- package/dist/plugins/TablePlugin.d.ts +5 -4
- package/dist/plugins/Tableimageautoresizeplugin.d.ts +1 -1
- package/dist/plugins/TextEnhancePlugin.d.ts +6 -6
- package/dist/plugins/TreeViewPlugin.d.ts +3 -2
- package/dist/plugins/UsageTrackingPlugin.d.ts +15 -15
- package/dist/plugins/VoiceTranscriptPlugin.d.ts +22 -22
- package/dist/plugins/WordCountPlugin.d.ts +3 -2
- package/dist/{postcss-f084f74d.js → postcss-c2592f3f.js} +1357 -1378
- package/dist/postcss-c2592f3f.js.map +1 -0
- package/dist/services/chartService.d.ts +19 -18
- package/dist/standalone-bcc7f37a.js +2649 -0
- package/dist/standalone-bcc7f37a.js.map +1 -0
- package/dist/styles/PlaygroundEditorTheme.d.ts +3 -2
- package/dist/types.d.ts +150 -149
- package/dist/typescript-48c10f50.js +13601 -0
- package/dist/typescript-48c10f50.js.map +1 -0
- package/dist/ui/ColorPicker.d.ts +14 -13
- package/dist/ui/Icons.d.ts +76 -76
- package/dist/ui/TextInput.d.ts +11 -10
- package/dist/utils/dateFormats.d.ts +33 -33
- package/dist/utils/debounce.d.ts +6 -5
- package/dist/utils/editorStyleConverter.d.ts +17 -16
- package/dist/utils/export.d.ts +2 -1
- package/dist/utils/getDOMRangeRect.d.ts +13 -13
- package/dist/utils/getSelectedNode.d.ts +3 -2
- package/dist/utils/helper.d.ts +3 -3
- package/dist/utils/index.d.ts +4 -3
- package/dist/utils/invarient.d.ts +1 -1
- package/dist/utils/setFloatingElemPosition.d.ts +8 -8
- package/dist/utils/setFloatingElemPositionForLinkEditor.d.ts +1 -1
- package/dist/utils/url.d.ts +9 -9
- package/package.json +149 -149
- package/dist/babel-d3085146.js.map +0 -1
- package/dist/estree-164983f6.js.map +0 -1
- package/dist/html-5586dbf6.js.map +0 -1
- package/dist/html2pdf.bundle-85e30143.js.map +0 -1
- package/dist/html2pdf.bundle.min-eb51bd12.js.map +0 -1
- package/dist/index-0632c8fb.js.map +0 -1
- package/dist/index-7b5e3701.js.map +0 -1
- package/dist/index-f679e2a3.js.map +0 -1
- package/dist/markdown-d513479b.js.map +0 -1
- package/dist/postcss-f084f74d.js.map +0 -1
- package/dist/standalone-5a8c6b7e.js +0 -2518
- package/dist/standalone-5a8c6b7e.js.map +0 -1
- package/dist/typescript-b1005db4.js +0 -13705
- package/dist/typescript-b1005db4.js.map +0 -1
|
@@ -25,7 +25,7 @@ import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
|
|
|
25
25
|
import { TablePlugin } from "@lexical/react/LexicalTablePlugin";
|
|
26
26
|
import { TableNode, TableCellNode, TableRowNode, $createTableNodeWithDimensions, $isTableRowNode, $isTableCellNode, TableCellHeaderStates, $isTableNode, $isTableSelection, $getTableCellNodeFromLexicalNode, $getTableNodeFromLexicalNodeOrThrow, getTableElement, getTableObserverFromTableElement, $getTableRowIndexFromTableCellNode, $getNodeTriplet, $insertTableRow__EXPERIMENTAL, $getTableColumnIndexFromTableCellNode, $insertTableColumn__EXPERIMENTAL, $deleteTableRow__EXPERIMENTAL, $deleteTableColumn__EXPERIMENTAL, $unmergeCell, $computeTableMapSkipCellCheck, getDOMCellFromTarget, $getTableAndElementByKey } from "@lexical/table";
|
|
27
27
|
import { mergeRegister, $wrapNodeInElement, $findMatchingParent, $getNearestNodeOfType, $getNearestBlockElementAncestorOrThrow, $insertNodeToNearestRoot, $isEditorIsNestedEditor, mediaFileReader, isMimeType, calculateZoomLevel, CAN_USE_DOM } from "@lexical/utils";
|
|
28
|
-
import { createCommand, DecoratorNode, createEditor, $applyNodeReplacement, $insertNodes, $isRootOrShadowRoot, $createParagraphNode, COMMAND_PRIORITY_EDITOR, COMMAND_PRIORITY_LOW, $getSelection, $isRangeSelection, $getNearestNodeFromDOMNode, isHTMLElement as isHTMLElement$1, TextNode, $getRoot, $createTextNode, $getNodeByKey, $isParagraphNode, $isTextNode, FORMAT_TEXT_COMMAND, FORMAT_ELEMENT_COMMAND, KEY_DOWN_COMMAND, COMMAND_PRIORITY_CRITICAL, CAN_UNDO_COMMAND, CAN_REDO_COMMAND, $isElementNode, SELECTION_CHANGE_COMMAND, UNDO_COMMAND, REDO_COMMAND, KEY_SPACE_COMMAND, $isLineBreakNode, $createRangeSelection,
|
|
28
|
+
import { createCommand, DecoratorNode, createEditor, $applyNodeReplacement, $insertNodes, $isRootOrShadowRoot, $createParagraphNode, COMMAND_PRIORITY_EDITOR, COMMAND_PRIORITY_LOW, $getSelection, $isRangeSelection, $getNearestNodeFromDOMNode, isHTMLElement as isHTMLElement$1, TextNode, $getRoot, $createTextNode, $getNodeByKey, $isParagraphNode, $isTextNode, $setSelection, FORMAT_TEXT_COMMAND, FORMAT_ELEMENT_COMMAND, KEY_DOWN_COMMAND, COMMAND_PRIORITY_CRITICAL, CAN_UNDO_COMMAND, CAN_REDO_COMMAND, $isElementNode, SELECTION_CHANGE_COMMAND, UNDO_COMMAND, REDO_COMMAND, KEY_SPACE_COMMAND, $isLineBreakNode, $createRangeSelection, COMMAND_PRIORITY_HIGH, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_UP_COMMAND, KEY_ESCAPE_COMMAND, KEY_TAB_COMMAND, KEY_ENTER_COMMAND, $createNodeSelection, $isNodeSelection, PASTE_COMMAND, CLICK_COMMAND, getDOMSelection, KEY_BACKSPACE_COMMAND, ParagraphNode, $createLineBreakNode, isDOMNode } from "lexical";
|
|
29
29
|
import { $isCodeNode, CodeNode, normalizeCodeLang, getLanguageFriendlyName, CodeHighlightNode, CODE_LANGUAGE_MAP, $createCodeNode, registerCodeHighlighting, $isCodeHighlightNode } from "@lexical/code";
|
|
30
30
|
import { LinkNode, $isLinkNode, TOGGLE_LINK_COMMAND, $isAutoLinkNode, $createLinkNode } from "@lexical/link";
|
|
31
31
|
import { ListNode, ListItemNode, $isListNode, INSERT_UNORDERED_LIST_COMMAND, REMOVE_LIST_COMMAND, INSERT_CHECK_LIST_COMMAND, INSERT_ORDERED_LIST_COMMAND, $isListItemNode, $createListNode, $createListItemNode } from "@lexical/list";
|
|
@@ -118,8 +118,10 @@ const apiEndpoints = {
|
|
|
118
118
|
json: "/api/chat/json",
|
|
119
119
|
textEnhance: "/api/chat/text-enhance",
|
|
120
120
|
textTransform: "/api/chat/text-transform",
|
|
121
|
+
textTransformStream: "/api/chat/text-transform-stream",
|
|
121
122
|
imageCreation: "/api/chat/image-creation",
|
|
122
123
|
editorAction: "/api/chat/chat-action",
|
|
124
|
+
editorActionStream: "/api/chat/chat-action-stream",
|
|
123
125
|
credits: "/api/chat/credits",
|
|
124
126
|
userInfo: "/api/chat/user-info"
|
|
125
127
|
},
|
|
@@ -2065,47 +2067,165 @@ const Toaster = /* @__PURE__ */ React__default.forwardRef(function Toaster2(prop
|
|
|
2065
2067
|
}))
|
|
2066
2068
|
);
|
|
2067
2069
|
});
|
|
2068
|
-
|
|
2070
|
+
let ApiKeyRequiredError$1 = class ApiKeyRequiredError extends Error {
|
|
2071
|
+
constructor(message, code) {
|
|
2072
|
+
super(message);
|
|
2073
|
+
__publicField(this, "code");
|
|
2074
|
+
this.name = "ApiKeyRequiredError";
|
|
2075
|
+
this.code = code;
|
|
2076
|
+
}
|
|
2077
|
+
};
|
|
2078
|
+
let CreditError$1 = class CreditError extends Error {
|
|
2079
|
+
constructor(message, code) {
|
|
2080
|
+
super(message);
|
|
2081
|
+
__publicField(this, "code");
|
|
2082
|
+
this.name = "CreditError";
|
|
2083
|
+
this.code = code;
|
|
2084
|
+
}
|
|
2085
|
+
};
|
|
2086
|
+
function handleApiError(error) {
|
|
2087
|
+
var _a, _b;
|
|
2088
|
+
const responseData = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data;
|
|
2089
|
+
if (responseData) {
|
|
2090
|
+
const { code, message } = responseData;
|
|
2091
|
+
if (code === "API_KEYS_REQUIRED" || code === "NO_API_KEYS_CONFIGURED") {
|
|
2092
|
+
throw new ApiKeyRequiredError$1(
|
|
2093
|
+
message || "Please upload at least one AI provider API key (OpenAI, Anthropic, or Grok).",
|
|
2094
|
+
code
|
|
2095
|
+
);
|
|
2096
|
+
}
|
|
2097
|
+
if (code === "API_KEYS_DISABLED") {
|
|
2098
|
+
throw new ApiKeyRequiredError$1(
|
|
2099
|
+
message || "Your API keys are currently disabled. Please enable them to use AI features.",
|
|
2100
|
+
code
|
|
2101
|
+
);
|
|
2102
|
+
}
|
|
2103
|
+
if (((_b = error == null ? void 0 : error.response) == null ? void 0 : _b.status) === 500 && (message == null ? void 0 : message.includes("BYOK_NO_"))) {
|
|
2104
|
+
const userMessage = message.replace(/^BYOK_NO_\w+:\s*/, "");
|
|
2105
|
+
throw new ApiKeyRequiredError$1(userMessage, "BYOK_API_KEY_REQUIRED");
|
|
2106
|
+
}
|
|
2107
|
+
if (code === "INSUFFICIENT_CREDITS") {
|
|
2108
|
+
throw new CreditError$1("Insufficient credits. Please purchase more credits.", code);
|
|
2109
|
+
}
|
|
2110
|
+
if (code === "NO_ACTIVE_SUBSCRIPTION") {
|
|
2111
|
+
throw new CreditError$1("No active subscription. Please subscribe to continue.", code);
|
|
2112
|
+
}
|
|
2113
|
+
if (code === "SUBSCRIPTION_EXPIRED") {
|
|
2114
|
+
throw new CreditError$1("Your subscription has expired. Please renew to continue.", code);
|
|
2115
|
+
}
|
|
2116
|
+
if (message) {
|
|
2117
|
+
throw new Error(message);
|
|
2118
|
+
}
|
|
2119
|
+
}
|
|
2120
|
+
throw error;
|
|
2121
|
+
}
|
|
2122
|
+
const AiJsonResponse = async ({ content, apiKey, userTextLength }) => {
|
|
2069
2123
|
try {
|
|
2070
2124
|
const res = await backendAPI.post(
|
|
2071
2125
|
apiEndpoints.chat.json,
|
|
2072
|
-
{ content },
|
|
2126
|
+
{ content, userTextLength },
|
|
2073
2127
|
apiKey ? { headers: { "X-API-Key": apiKey } } : void 0
|
|
2074
2128
|
);
|
|
2075
2129
|
return res.data;
|
|
2076
2130
|
} catch (error) {
|
|
2077
2131
|
console.error("Error in AiJsonResponse:", error);
|
|
2078
|
-
|
|
2132
|
+
handleApiError(error);
|
|
2079
2133
|
}
|
|
2080
2134
|
};
|
|
2081
|
-
const
|
|
2135
|
+
const AiEditorActionStream = async ({
|
|
2082
2136
|
content,
|
|
2083
2137
|
provider = "chatgpt",
|
|
2084
|
-
apiKey
|
|
2138
|
+
apiKey,
|
|
2139
|
+
userTextLength,
|
|
2140
|
+
onChunk,
|
|
2141
|
+
onComplete,
|
|
2142
|
+
onError: onError2
|
|
2085
2143
|
}) => {
|
|
2144
|
+
var _a;
|
|
2086
2145
|
try {
|
|
2146
|
+
let fullContent = "";
|
|
2147
|
+
let metadata = {};
|
|
2148
|
+
let processedLength = 0;
|
|
2149
|
+
let lineBuffer = "";
|
|
2087
2150
|
const res = await backendAPI.post(
|
|
2088
|
-
apiEndpoints.chat.
|
|
2089
|
-
{ content, provider },
|
|
2090
|
-
|
|
2151
|
+
apiEndpoints.chat.editorActionStream,
|
|
2152
|
+
{ content, provider, userTextLength },
|
|
2153
|
+
{
|
|
2154
|
+
headers: apiKey ? { "X-API-Key": apiKey } : void 0,
|
|
2155
|
+
responseType: "stream",
|
|
2156
|
+
onDownloadProgress: (progressEvent) => {
|
|
2157
|
+
var _a2, _b;
|
|
2158
|
+
const responseText = (_b = (_a2 = progressEvent.event) == null ? void 0 : _a2.target) == null ? void 0 : _b.responseText;
|
|
2159
|
+
if (!responseText)
|
|
2160
|
+
return;
|
|
2161
|
+
const newData = responseText.slice(processedLength);
|
|
2162
|
+
processedLength = responseText.length;
|
|
2163
|
+
if (!newData)
|
|
2164
|
+
return;
|
|
2165
|
+
const dataToProcess = lineBuffer + newData;
|
|
2166
|
+
const lines = dataToProcess.split("\n");
|
|
2167
|
+
lineBuffer = lines.pop() || "";
|
|
2168
|
+
for (const line of lines) {
|
|
2169
|
+
if (!line.trim() || !line.startsWith("data: "))
|
|
2170
|
+
continue;
|
|
2171
|
+
const data = line.slice(6);
|
|
2172
|
+
if (data === "[DONE]") {
|
|
2173
|
+
continue;
|
|
2174
|
+
}
|
|
2175
|
+
try {
|
|
2176
|
+
const parsed = JSON.parse(data);
|
|
2177
|
+
if (parsed.type === "chunk" && parsed.content) {
|
|
2178
|
+
const newChunk = parsed.content;
|
|
2179
|
+
fullContent += newChunk;
|
|
2180
|
+
onChunk(newChunk, fullContent);
|
|
2181
|
+
} else if (parsed.type === "complete") {
|
|
2182
|
+
fullContent = parsed.content || fullContent;
|
|
2183
|
+
metadata = {
|
|
2184
|
+
isImage: parsed.isImage,
|
|
2185
|
+
isChart: parsed.isChart,
|
|
2186
|
+
credits: parsed.credits
|
|
2187
|
+
};
|
|
2188
|
+
} else if (parsed.type === "error") {
|
|
2189
|
+
onError2(new Error(parsed.message || "Stream error"));
|
|
2190
|
+
return;
|
|
2191
|
+
}
|
|
2192
|
+
} catch {
|
|
2193
|
+
}
|
|
2194
|
+
}
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2091
2197
|
);
|
|
2092
|
-
|
|
2198
|
+
if (res.status === 200) {
|
|
2199
|
+
onComplete(fullContent, metadata);
|
|
2200
|
+
}
|
|
2093
2201
|
} catch (error) {
|
|
2094
|
-
console.error("Error in
|
|
2095
|
-
|
|
2202
|
+
console.error("Error in AiEditorActionStream:", error);
|
|
2203
|
+
const responseData = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data;
|
|
2204
|
+
if (responseData) {
|
|
2205
|
+
const { code, message } = responseData;
|
|
2206
|
+
if (code === "API_KEYS_REQUIRED" || code === "NO_API_KEYS_CONFIGURED" || code === "API_KEYS_DISABLED") {
|
|
2207
|
+
onError2(new ApiKeyRequiredError$1(message || "API key required", code));
|
|
2208
|
+
return;
|
|
2209
|
+
}
|
|
2210
|
+
if (code === "INSUFFICIENT_CREDITS" || code === "NO_ACTIVE_SUBSCRIPTION" || code === "SUBSCRIPTION_EXPIRED") {
|
|
2211
|
+
onError2(new CreditError$1(message || "Credit error", code));
|
|
2212
|
+
return;
|
|
2213
|
+
}
|
|
2214
|
+
}
|
|
2215
|
+
onError2(error instanceof Error ? error : new Error(String(error)));
|
|
2096
2216
|
}
|
|
2097
2217
|
};
|
|
2098
|
-
const AiTextEnhance = async ({ content, apiKey }) => {
|
|
2218
|
+
const AiTextEnhance = async ({ content, apiKey, userTextLength }) => {
|
|
2099
2219
|
try {
|
|
2100
2220
|
const res = await backendAPI.post(
|
|
2101
2221
|
apiEndpoints.chat.textEnhance,
|
|
2102
|
-
{ content },
|
|
2222
|
+
{ content, userTextLength },
|
|
2103
2223
|
apiKey ? { headers: { "X-API-Key": apiKey } } : void 0
|
|
2104
2224
|
);
|
|
2105
2225
|
return res.data;
|
|
2106
2226
|
} catch (error) {
|
|
2107
2227
|
console.error("Error in AiTextEnhance:", error);
|
|
2108
|
-
|
|
2228
|
+
handleApiError(error);
|
|
2109
2229
|
}
|
|
2110
2230
|
};
|
|
2111
2231
|
const GetCreditsInfo = async ({ apiKey }) => {
|
|
@@ -2132,23 +2252,88 @@ const GetUserInfo = async ({ apiKey }) => {
|
|
|
2132
2252
|
return { success: false, data: null };
|
|
2133
2253
|
}
|
|
2134
2254
|
};
|
|
2135
|
-
const
|
|
2255
|
+
const AiTextTransformStream = async ({
|
|
2256
|
+
content,
|
|
2257
|
+
apiKey,
|
|
2258
|
+
userTextLength,
|
|
2259
|
+
onChunk,
|
|
2260
|
+
onComplete,
|
|
2261
|
+
onError: onError2
|
|
2262
|
+
}) => {
|
|
2263
|
+
var _a;
|
|
2136
2264
|
try {
|
|
2265
|
+
let fullText = "";
|
|
2266
|
+
let credits;
|
|
2267
|
+
let processedLength = 0;
|
|
2268
|
+
let lineBuffer = "";
|
|
2137
2269
|
const res = await backendAPI.post(
|
|
2138
|
-
apiEndpoints.chat.
|
|
2139
|
-
{ content },
|
|
2140
|
-
|
|
2270
|
+
apiEndpoints.chat.textTransformStream,
|
|
2271
|
+
{ content, userTextLength },
|
|
2272
|
+
{
|
|
2273
|
+
headers: apiKey ? { "X-API-Key": apiKey } : void 0,
|
|
2274
|
+
responseType: "stream",
|
|
2275
|
+
onDownloadProgress: (progressEvent) => {
|
|
2276
|
+
var _a2, _b;
|
|
2277
|
+
const responseText = (_b = (_a2 = progressEvent.event) == null ? void 0 : _a2.target) == null ? void 0 : _b.responseText;
|
|
2278
|
+
if (!responseText)
|
|
2279
|
+
return;
|
|
2280
|
+
const newData = responseText.slice(processedLength);
|
|
2281
|
+
processedLength = responseText.length;
|
|
2282
|
+
if (!newData)
|
|
2283
|
+
return;
|
|
2284
|
+
const dataToProcess = lineBuffer + newData;
|
|
2285
|
+
const lines = dataToProcess.split("\n");
|
|
2286
|
+
lineBuffer = lines.pop() || "";
|
|
2287
|
+
for (const line of lines) {
|
|
2288
|
+
if (!line.trim() || !line.startsWith("data: "))
|
|
2289
|
+
continue;
|
|
2290
|
+
const data = line.slice(6);
|
|
2291
|
+
if (data === "[DONE]") {
|
|
2292
|
+
continue;
|
|
2293
|
+
}
|
|
2294
|
+
try {
|
|
2295
|
+
const parsed = JSON.parse(data);
|
|
2296
|
+
if (parsed.type === "chunk" && parsed.content) {
|
|
2297
|
+
const newChunk = parsed.content;
|
|
2298
|
+
fullText += newChunk;
|
|
2299
|
+
onChunk(newChunk);
|
|
2300
|
+
} else if (parsed.type === "complete") {
|
|
2301
|
+
fullText = parsed.content || fullText;
|
|
2302
|
+
credits = parsed.credits;
|
|
2303
|
+
} else if (parsed.type === "error") {
|
|
2304
|
+
onError2(new Error(parsed.message || "Stream error"));
|
|
2305
|
+
return;
|
|
2306
|
+
}
|
|
2307
|
+
} catch {
|
|
2308
|
+
}
|
|
2309
|
+
}
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2141
2312
|
);
|
|
2142
|
-
|
|
2313
|
+
if (res.status === 200) {
|
|
2314
|
+
onComplete(fullText, credits);
|
|
2315
|
+
}
|
|
2143
2316
|
} catch (error) {
|
|
2144
|
-
console.error("Error in
|
|
2145
|
-
|
|
2317
|
+
console.error("Error in AiTextTransformStream:", error);
|
|
2318
|
+
const responseData = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data;
|
|
2319
|
+
if (responseData) {
|
|
2320
|
+
const { code, message } = responseData;
|
|
2321
|
+
if (code === "API_KEYS_REQUIRED" || code === "NO_API_KEYS_CONFIGURED" || code === "API_KEYS_DISABLED") {
|
|
2322
|
+
onError2(new ApiKeyRequiredError$1(message || "API key required", code));
|
|
2323
|
+
return;
|
|
2324
|
+
}
|
|
2325
|
+
if (code === "INSUFFICIENT_CREDITS" || code === "NO_ACTIVE_SUBSCRIPTION" || code === "SUBSCRIPTION_EXPIRED") {
|
|
2326
|
+
onError2(new CreditError$1(message || "Credit error", code));
|
|
2327
|
+
return;
|
|
2328
|
+
}
|
|
2329
|
+
}
|
|
2330
|
+
onError2(error instanceof Error ? error : new Error(String(error)));
|
|
2146
2331
|
}
|
|
2147
2332
|
};
|
|
2148
2333
|
const AI_ACTION_COMMAND = createCommand(
|
|
2149
2334
|
"AI_ACTION_COMMAND"
|
|
2150
2335
|
);
|
|
2151
|
-
const ImageView = React__default.lazy(() => import("./index-
|
|
2336
|
+
const ImageView = React__default.lazy(() => import("./index-34ac313f.js"));
|
|
2152
2337
|
function isGoogleDocCheckboxImg(img) {
|
|
2153
2338
|
return img.parentElement != null && img.parentElement.tagName === "LI" && img.previousSibling === null && img.getAttribute("aria-roledescription") === "checkbox";
|
|
2154
2339
|
}
|
|
@@ -2451,18 +2636,18 @@ const ImagePlugin = ({
|
|
|
2451
2636
|
}, [captionsEnabled, editor]);
|
|
2452
2637
|
return null;
|
|
2453
2638
|
};
|
|
2454
|
-
function setRef(ref, value) {
|
|
2639
|
+
function setRef$1(ref, value) {
|
|
2455
2640
|
if (typeof ref === "function") {
|
|
2456
2641
|
return ref(value);
|
|
2457
2642
|
} else if (ref !== null && ref !== void 0) {
|
|
2458
2643
|
ref.current = value;
|
|
2459
2644
|
}
|
|
2460
2645
|
}
|
|
2461
|
-
function composeRefs(...refs) {
|
|
2646
|
+
function composeRefs$1(...refs) {
|
|
2462
2647
|
return (node) => {
|
|
2463
2648
|
let hasCleanup = false;
|
|
2464
2649
|
const cleanups = refs.map((ref) => {
|
|
2465
|
-
const cleanup = setRef(ref, node);
|
|
2650
|
+
const cleanup = setRef$1(ref, node);
|
|
2466
2651
|
if (!hasCleanup && typeof cleanup == "function") {
|
|
2467
2652
|
hasCleanup = true;
|
|
2468
2653
|
}
|
|
@@ -2475,34 +2660,31 @@ function composeRefs(...refs) {
|
|
|
2475
2660
|
if (typeof cleanup == "function") {
|
|
2476
2661
|
cleanup();
|
|
2477
2662
|
} else {
|
|
2478
|
-
setRef(refs[i2], null);
|
|
2663
|
+
setRef$1(refs[i2], null);
|
|
2479
2664
|
}
|
|
2480
2665
|
}
|
|
2481
2666
|
};
|
|
2482
2667
|
}
|
|
2483
2668
|
};
|
|
2484
2669
|
}
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
var REACT_LAZY_TYPE$3 = Symbol.for("react.lazy");
|
|
2489
|
-
var use$3 = React$1[" use ".trim().toString()];
|
|
2490
|
-
function isPromiseLike$3(value) {
|
|
2670
|
+
var REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
2671
|
+
var use = React$1[" use ".trim().toString()];
|
|
2672
|
+
function isPromiseLike(value) {
|
|
2491
2673
|
return typeof value === "object" && value !== null && "then" in value;
|
|
2492
2674
|
}
|
|
2493
|
-
function isLazyComponent
|
|
2494
|
-
return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE
|
|
2675
|
+
function isLazyComponent(element) {
|
|
2676
|
+
return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike(element._payload);
|
|
2495
2677
|
}
|
|
2496
2678
|
// @__NO_SIDE_EFFECTS__
|
|
2497
|
-
function createSlot$
|
|
2498
|
-
const SlotClone = /* @__PURE__ */ createSlotClone$
|
|
2679
|
+
function createSlot$1(ownerName) {
|
|
2680
|
+
const SlotClone = /* @__PURE__ */ createSlotClone$1(ownerName);
|
|
2499
2681
|
const Slot2 = React$1.forwardRef((props, forwardedRef) => {
|
|
2500
2682
|
let { children, ...slotProps } = props;
|
|
2501
|
-
if (isLazyComponent
|
|
2502
|
-
children = use
|
|
2683
|
+
if (isLazyComponent(children) && typeof use === "function") {
|
|
2684
|
+
children = use(children._payload);
|
|
2503
2685
|
}
|
|
2504
2686
|
const childrenArray = React$1.Children.toArray(children);
|
|
2505
|
-
const slottable = childrenArray.find(isSlottable$
|
|
2687
|
+
const slottable = childrenArray.find(isSlottable$1);
|
|
2506
2688
|
if (slottable) {
|
|
2507
2689
|
const newElement = slottable.props.children;
|
|
2508
2690
|
const newChildren = childrenArray.map((child) => {
|
|
@@ -2521,19 +2703,19 @@ function createSlot$4(ownerName) {
|
|
|
2521
2703
|
Slot2.displayName = `${ownerName}.Slot`;
|
|
2522
2704
|
return Slot2;
|
|
2523
2705
|
}
|
|
2524
|
-
var Slot$4 = /* @__PURE__ */ createSlot$
|
|
2706
|
+
var Slot$4 = /* @__PURE__ */ createSlot$1("Slot");
|
|
2525
2707
|
// @__NO_SIDE_EFFECTS__
|
|
2526
|
-
function createSlotClone$
|
|
2708
|
+
function createSlotClone$1(ownerName) {
|
|
2527
2709
|
const SlotClone = React$1.forwardRef((props, forwardedRef) => {
|
|
2528
2710
|
let { children, ...slotProps } = props;
|
|
2529
|
-
if (isLazyComponent
|
|
2530
|
-
children = use
|
|
2711
|
+
if (isLazyComponent(children) && typeof use === "function") {
|
|
2712
|
+
children = use(children._payload);
|
|
2531
2713
|
}
|
|
2532
2714
|
if (React$1.isValidElement(children)) {
|
|
2533
|
-
const childrenRef = getElementRef$
|
|
2534
|
-
const props2 = mergeProps$
|
|
2715
|
+
const childrenRef = getElementRef$2(children);
|
|
2716
|
+
const props2 = mergeProps$1(slotProps, children.props);
|
|
2535
2717
|
if (children.type !== React$1.Fragment) {
|
|
2536
|
-
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
2718
|
+
props2.ref = forwardedRef ? composeRefs$1(forwardedRef, childrenRef) : childrenRef;
|
|
2537
2719
|
}
|
|
2538
2720
|
return React$1.cloneElement(children, props2);
|
|
2539
2721
|
}
|
|
@@ -2542,11 +2724,11 @@ function createSlotClone$4(ownerName) {
|
|
|
2542
2724
|
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
2543
2725
|
return SlotClone;
|
|
2544
2726
|
}
|
|
2545
|
-
var SLOTTABLE_IDENTIFIER$
|
|
2546
|
-
function isSlottable$
|
|
2547
|
-
return React$1.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$
|
|
2727
|
+
var SLOTTABLE_IDENTIFIER$1 = Symbol("radix.slottable");
|
|
2728
|
+
function isSlottable$1(child) {
|
|
2729
|
+
return React$1.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$1;
|
|
2548
2730
|
}
|
|
2549
|
-
function mergeProps$
|
|
2731
|
+
function mergeProps$1(slotProps, childProps) {
|
|
2550
2732
|
const overrideProps = { ...childProps };
|
|
2551
2733
|
for (const propName in childProps) {
|
|
2552
2734
|
const slotPropValue = slotProps[propName];
|
|
@@ -2570,7 +2752,7 @@ function mergeProps$4(slotProps, childProps) {
|
|
|
2570
2752
|
}
|
|
2571
2753
|
return { ...slotProps, ...overrideProps };
|
|
2572
2754
|
}
|
|
2573
|
-
function getElementRef$
|
|
2755
|
+
function getElementRef$2(element) {
|
|
2574
2756
|
var _a, _b;
|
|
2575
2757
|
let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
|
|
2576
2758
|
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
@@ -2645,28 +2827,7 @@ const cva = (base, config) => (props) => {
|
|
|
2645
2827
|
}, []);
|
|
2646
2828
|
return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
2647
2829
|
};
|
|
2648
|
-
const concatArrays = (array1, array2) => {
|
|
2649
|
-
const combinedArray = new Array(array1.length + array2.length);
|
|
2650
|
-
for (let i2 = 0; i2 < array1.length; i2++) {
|
|
2651
|
-
combinedArray[i2] = array1[i2];
|
|
2652
|
-
}
|
|
2653
|
-
for (let i2 = 0; i2 < array2.length; i2++) {
|
|
2654
|
-
combinedArray[array1.length + i2] = array2[i2];
|
|
2655
|
-
}
|
|
2656
|
-
return combinedArray;
|
|
2657
|
-
};
|
|
2658
|
-
const createClassValidatorObject = (classGroupId, validator) => ({
|
|
2659
|
-
classGroupId,
|
|
2660
|
-
validator
|
|
2661
|
-
});
|
|
2662
|
-
const createClassPartObject = (nextPart = /* @__PURE__ */ new Map(), validators = null, classGroupId) => ({
|
|
2663
|
-
nextPart,
|
|
2664
|
-
validators,
|
|
2665
|
-
classGroupId
|
|
2666
|
-
});
|
|
2667
2830
|
const CLASS_PART_SEPARATOR = "-";
|
|
2668
|
-
const EMPTY_CONFLICTS = [];
|
|
2669
|
-
const ARBITRARY_PROPERTY_PREFIX = "arbitrary..";
|
|
2670
2831
|
const createClassGroupUtils = (config) => {
|
|
2671
2832
|
const classMap = createClassMap(config);
|
|
2672
2833
|
const {
|
|
@@ -2674,135 +2835,104 @@ const createClassGroupUtils = (config) => {
|
|
|
2674
2835
|
conflictingClassGroupModifiers
|
|
2675
2836
|
} = config;
|
|
2676
2837
|
const getClassGroupId = (className) => {
|
|
2677
|
-
if (className.startsWith("[") && className.endsWith("]")) {
|
|
2678
|
-
return getGroupIdForArbitraryProperty(className);
|
|
2679
|
-
}
|
|
2680
2838
|
const classParts = className.split(CLASS_PART_SEPARATOR);
|
|
2681
|
-
|
|
2682
|
-
|
|
2839
|
+
if (classParts[0] === "" && classParts.length !== 1) {
|
|
2840
|
+
classParts.shift();
|
|
2841
|
+
}
|
|
2842
|
+
return getGroupRecursive(classParts, classMap) || getGroupIdForArbitraryProperty(className);
|
|
2683
2843
|
};
|
|
2684
2844
|
const getConflictingClassGroupIds = (classGroupId, hasPostfixModifier) => {
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
if (modifierConflicts) {
|
|
2689
|
-
if (baseConflicts) {
|
|
2690
|
-
return concatArrays(baseConflicts, modifierConflicts);
|
|
2691
|
-
}
|
|
2692
|
-
return modifierConflicts;
|
|
2693
|
-
}
|
|
2694
|
-
return baseConflicts || EMPTY_CONFLICTS;
|
|
2845
|
+
const conflicts = conflictingClassGroups[classGroupId] || [];
|
|
2846
|
+
if (hasPostfixModifier && conflictingClassGroupModifiers[classGroupId]) {
|
|
2847
|
+
return [...conflicts, ...conflictingClassGroupModifiers[classGroupId]];
|
|
2695
2848
|
}
|
|
2696
|
-
return
|
|
2849
|
+
return conflicts;
|
|
2697
2850
|
};
|
|
2698
2851
|
return {
|
|
2699
2852
|
getClassGroupId,
|
|
2700
2853
|
getConflictingClassGroupIds
|
|
2701
2854
|
};
|
|
2702
2855
|
};
|
|
2703
|
-
const getGroupRecursive = (classParts,
|
|
2704
|
-
|
|
2705
|
-
if (
|
|
2856
|
+
const getGroupRecursive = (classParts, classPartObject) => {
|
|
2857
|
+
var _a;
|
|
2858
|
+
if (classParts.length === 0) {
|
|
2706
2859
|
return classPartObject.classGroupId;
|
|
2707
2860
|
}
|
|
2708
|
-
const currentClassPart = classParts[
|
|
2861
|
+
const currentClassPart = classParts[0];
|
|
2709
2862
|
const nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
return result;
|
|
2863
|
+
const classGroupFromNextClassPart = nextClassPartObject ? getGroupRecursive(classParts.slice(1), nextClassPartObject) : void 0;
|
|
2864
|
+
if (classGroupFromNextClassPart) {
|
|
2865
|
+
return classGroupFromNextClassPart;
|
|
2714
2866
|
}
|
|
2715
|
-
|
|
2716
|
-
if (validators === null) {
|
|
2867
|
+
if (classPartObject.validators.length === 0) {
|
|
2717
2868
|
return void 0;
|
|
2718
2869
|
}
|
|
2719
|
-
const classRest =
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2870
|
+
const classRest = classParts.join(CLASS_PART_SEPARATOR);
|
|
2871
|
+
return (_a = classPartObject.validators.find(({
|
|
2872
|
+
validator
|
|
2873
|
+
}) => validator(classRest))) == null ? void 0 : _a.classGroupId;
|
|
2874
|
+
};
|
|
2875
|
+
const arbitraryPropertyRegex = /^\[(.+)\]$/;
|
|
2876
|
+
const getGroupIdForArbitraryProperty = (className) => {
|
|
2877
|
+
if (arbitraryPropertyRegex.test(className)) {
|
|
2878
|
+
const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)[1];
|
|
2879
|
+
const property = arbitraryPropertyClassName == null ? void 0 : arbitraryPropertyClassName.substring(0, arbitraryPropertyClassName.indexOf(":"));
|
|
2880
|
+
if (property) {
|
|
2881
|
+
return "arbitrary.." + property;
|
|
2725
2882
|
}
|
|
2726
2883
|
}
|
|
2727
|
-
return void 0;
|
|
2728
2884
|
};
|
|
2729
|
-
const getGroupIdForArbitraryProperty = (className) => className.slice(1, -1).indexOf(":") === -1 ? void 0 : (() => {
|
|
2730
|
-
const content = className.slice(1, -1);
|
|
2731
|
-
const colonIndex = content.indexOf(":");
|
|
2732
|
-
const property = content.slice(0, colonIndex);
|
|
2733
|
-
return property ? ARBITRARY_PROPERTY_PREFIX + property : void 0;
|
|
2734
|
-
})();
|
|
2735
2885
|
const createClassMap = (config) => {
|
|
2736
2886
|
const {
|
|
2737
2887
|
theme: theme2,
|
|
2738
2888
|
classGroups
|
|
2739
2889
|
} = config;
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2890
|
+
const classMap = {
|
|
2891
|
+
nextPart: /* @__PURE__ */ new Map(),
|
|
2892
|
+
validators: []
|
|
2893
|
+
};
|
|
2744
2894
|
for (const classGroupId in classGroups) {
|
|
2745
|
-
|
|
2746
|
-
processClassesRecursively(group, classMap, classGroupId, theme2);
|
|
2895
|
+
processClassesRecursively(classGroups[classGroupId], classMap, classGroupId, theme2);
|
|
2747
2896
|
}
|
|
2748
2897
|
return classMap;
|
|
2749
2898
|
};
|
|
2750
2899
|
const processClassesRecursively = (classGroup, classPartObject, classGroupId, theme2) => {
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
}
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
}
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
};
|
|
2772
|
-
const processFunctionDefinition = (classDefinition, classPartObject, classGroupId, theme2) => {
|
|
2773
|
-
if (isThemeGetter(classDefinition)) {
|
|
2774
|
-
processClassesRecursively(classDefinition(theme2), classPartObject, classGroupId, theme2);
|
|
2775
|
-
return;
|
|
2776
|
-
}
|
|
2777
|
-
if (classPartObject.validators === null) {
|
|
2778
|
-
classPartObject.validators = [];
|
|
2779
|
-
}
|
|
2780
|
-
classPartObject.validators.push(createClassValidatorObject(classGroupId, classDefinition));
|
|
2781
|
-
};
|
|
2782
|
-
const processObjectDefinition = (classDefinition, classPartObject, classGroupId, theme2) => {
|
|
2783
|
-
const entries = Object.entries(classDefinition);
|
|
2784
|
-
const len = entries.length;
|
|
2785
|
-
for (let i2 = 0; i2 < len; i2++) {
|
|
2786
|
-
const [key, value] = entries[i2];
|
|
2787
|
-
processClassesRecursively(value, getPart(classPartObject, key), classGroupId, theme2);
|
|
2788
|
-
}
|
|
2900
|
+
classGroup.forEach((classDefinition) => {
|
|
2901
|
+
if (typeof classDefinition === "string") {
|
|
2902
|
+
const classPartObjectToEdit = classDefinition === "" ? classPartObject : getPart(classPartObject, classDefinition);
|
|
2903
|
+
classPartObjectToEdit.classGroupId = classGroupId;
|
|
2904
|
+
return;
|
|
2905
|
+
}
|
|
2906
|
+
if (typeof classDefinition === "function") {
|
|
2907
|
+
if (isThemeGetter(classDefinition)) {
|
|
2908
|
+
processClassesRecursively(classDefinition(theme2), classPartObject, classGroupId, theme2);
|
|
2909
|
+
return;
|
|
2910
|
+
}
|
|
2911
|
+
classPartObject.validators.push({
|
|
2912
|
+
validator: classDefinition,
|
|
2913
|
+
classGroupId
|
|
2914
|
+
});
|
|
2915
|
+
return;
|
|
2916
|
+
}
|
|
2917
|
+
Object.entries(classDefinition).forEach(([key, classGroup2]) => {
|
|
2918
|
+
processClassesRecursively(classGroup2, getPart(classPartObject, key), classGroupId, theme2);
|
|
2919
|
+
});
|
|
2920
|
+
});
|
|
2789
2921
|
};
|
|
2790
2922
|
const getPart = (classPartObject, path) => {
|
|
2791
|
-
let
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
next = createClassPartObject();
|
|
2799
|
-
current.nextPart.set(part, next);
|
|
2923
|
+
let currentClassPartObject = classPartObject;
|
|
2924
|
+
path.split(CLASS_PART_SEPARATOR).forEach((pathPart) => {
|
|
2925
|
+
if (!currentClassPartObject.nextPart.has(pathPart)) {
|
|
2926
|
+
currentClassPartObject.nextPart.set(pathPart, {
|
|
2927
|
+
nextPart: /* @__PURE__ */ new Map(),
|
|
2928
|
+
validators: []
|
|
2929
|
+
});
|
|
2800
2930
|
}
|
|
2801
|
-
|
|
2802
|
-
}
|
|
2803
|
-
return
|
|
2931
|
+
currentClassPartObject = currentClassPartObject.nextPart.get(pathPart);
|
|
2932
|
+
});
|
|
2933
|
+
return currentClassPartObject;
|
|
2804
2934
|
};
|
|
2805
|
-
const isThemeGetter = (func) =>
|
|
2935
|
+
const isThemeGetter = (func) => func.isThemeGetter;
|
|
2806
2936
|
const createLruCache = (maxCacheSize) => {
|
|
2807
2937
|
if (maxCacheSize < 1) {
|
|
2808
2938
|
return {
|
|
@@ -2812,31 +2942,31 @@ const createLruCache = (maxCacheSize) => {
|
|
|
2812
2942
|
};
|
|
2813
2943
|
}
|
|
2814
2944
|
let cacheSize = 0;
|
|
2815
|
-
let cache2 = /* @__PURE__ */
|
|
2816
|
-
let previousCache = /* @__PURE__ */
|
|
2945
|
+
let cache2 = /* @__PURE__ */ new Map();
|
|
2946
|
+
let previousCache = /* @__PURE__ */ new Map();
|
|
2817
2947
|
const update = (key, value) => {
|
|
2818
|
-
cache2
|
|
2948
|
+
cache2.set(key, value);
|
|
2819
2949
|
cacheSize++;
|
|
2820
2950
|
if (cacheSize > maxCacheSize) {
|
|
2821
2951
|
cacheSize = 0;
|
|
2822
2952
|
previousCache = cache2;
|
|
2823
|
-
cache2 = /* @__PURE__ */
|
|
2953
|
+
cache2 = /* @__PURE__ */ new Map();
|
|
2824
2954
|
}
|
|
2825
2955
|
};
|
|
2826
2956
|
return {
|
|
2827
2957
|
get(key) {
|
|
2828
|
-
let value = cache2
|
|
2958
|
+
let value = cache2.get(key);
|
|
2829
2959
|
if (value !== void 0) {
|
|
2830
2960
|
return value;
|
|
2831
2961
|
}
|
|
2832
|
-
if ((value = previousCache
|
|
2962
|
+
if ((value = previousCache.get(key)) !== void 0) {
|
|
2833
2963
|
update(key, value);
|
|
2834
2964
|
return value;
|
|
2835
2965
|
}
|
|
2836
2966
|
},
|
|
2837
2967
|
set(key, value) {
|
|
2838
|
-
if (key
|
|
2839
|
-
cache2
|
|
2968
|
+
if (cache2.has(key)) {
|
|
2969
|
+
cache2.set(key, value);
|
|
2840
2970
|
} else {
|
|
2841
2971
|
update(key, value);
|
|
2842
2972
|
}
|
|
@@ -2845,14 +2975,7 @@ const createLruCache = (maxCacheSize) => {
|
|
|
2845
2975
|
};
|
|
2846
2976
|
const IMPORTANT_MODIFIER = "!";
|
|
2847
2977
|
const MODIFIER_SEPARATOR = ":";
|
|
2848
|
-
const
|
|
2849
|
-
const createResultObject = (modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition, isExternal) => ({
|
|
2850
|
-
modifiers,
|
|
2851
|
-
hasImportantModifier,
|
|
2852
|
-
baseClassName,
|
|
2853
|
-
maybePostfixModifierPosition,
|
|
2854
|
-
isExternal
|
|
2855
|
-
});
|
|
2978
|
+
const MODIFIER_SEPARATOR_LENGTH = MODIFIER_SEPARATOR.length;
|
|
2856
2979
|
const createParseClassName = (config) => {
|
|
2857
2980
|
const {
|
|
2858
2981
|
prefix,
|
|
@@ -2864,13 +2987,12 @@ const createParseClassName = (config) => {
|
|
|
2864
2987
|
let parenDepth = 0;
|
|
2865
2988
|
let modifierStart = 0;
|
|
2866
2989
|
let postfixModifierPosition;
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
const currentCharacter = className[index2];
|
|
2990
|
+
for (let index2 = 0; index2 < className.length; index2++) {
|
|
2991
|
+
let currentCharacter = className[index2];
|
|
2870
2992
|
if (bracketDepth === 0 && parenDepth === 0) {
|
|
2871
2993
|
if (currentCharacter === MODIFIER_SEPARATOR) {
|
|
2872
2994
|
modifiers.push(className.slice(modifierStart, index2));
|
|
2873
|
-
modifierStart = index2 +
|
|
2995
|
+
modifierStart = index2 + MODIFIER_SEPARATOR_LENGTH;
|
|
2874
2996
|
continue;
|
|
2875
2997
|
}
|
|
2876
2998
|
if (currentCharacter === "/") {
|
|
@@ -2878,38 +3000,37 @@ const createParseClassName = (config) => {
|
|
|
2878
3000
|
continue;
|
|
2879
3001
|
}
|
|
2880
3002
|
}
|
|
2881
|
-
if (currentCharacter === "[")
|
|
3003
|
+
if (currentCharacter === "[") {
|
|
2882
3004
|
bracketDepth++;
|
|
2883
|
-
else if (currentCharacter === "]")
|
|
3005
|
+
} else if (currentCharacter === "]") {
|
|
2884
3006
|
bracketDepth--;
|
|
2885
|
-
else if (currentCharacter === "(")
|
|
3007
|
+
} else if (currentCharacter === "(") {
|
|
2886
3008
|
parenDepth++;
|
|
2887
|
-
else if (currentCharacter === ")")
|
|
3009
|
+
} else if (currentCharacter === ")") {
|
|
2888
3010
|
parenDepth--;
|
|
3011
|
+
}
|
|
2889
3012
|
}
|
|
2890
|
-
const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
if (baseClassNameWithImportantModifier.endsWith(IMPORTANT_MODIFIER)) {
|
|
2894
|
-
baseClassName = baseClassNameWithImportantModifier.slice(0, -1);
|
|
2895
|
-
hasImportantModifier = true;
|
|
2896
|
-
} else if (
|
|
2897
|
-
/**
|
|
2898
|
-
* In Tailwind CSS v3 the important modifier was at the start of the base class name. This is still supported for legacy reasons.
|
|
2899
|
-
* @see https://github.com/dcastil/tailwind-merge/issues/513#issuecomment-2614029864
|
|
2900
|
-
*/
|
|
2901
|
-
baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER)
|
|
2902
|
-
) {
|
|
2903
|
-
baseClassName = baseClassNameWithImportantModifier.slice(1);
|
|
2904
|
-
hasImportantModifier = true;
|
|
2905
|
-
}
|
|
3013
|
+
const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.substring(modifierStart);
|
|
3014
|
+
const baseClassName = stripImportantModifier(baseClassNameWithImportantModifier);
|
|
3015
|
+
const hasImportantModifier = baseClassName !== baseClassNameWithImportantModifier;
|
|
2906
3016
|
const maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart : void 0;
|
|
2907
|
-
return
|
|
3017
|
+
return {
|
|
3018
|
+
modifiers,
|
|
3019
|
+
hasImportantModifier,
|
|
3020
|
+
baseClassName,
|
|
3021
|
+
maybePostfixModifierPosition
|
|
3022
|
+
};
|
|
2908
3023
|
};
|
|
2909
3024
|
if (prefix) {
|
|
2910
3025
|
const fullPrefix = prefix + MODIFIER_SEPARATOR;
|
|
2911
3026
|
const parseClassNameOriginal = parseClassName;
|
|
2912
|
-
parseClassName = (className) => className.startsWith(fullPrefix) ? parseClassNameOriginal(className.
|
|
3027
|
+
parseClassName = (className) => className.startsWith(fullPrefix) ? parseClassNameOriginal(className.substring(fullPrefix.length)) : {
|
|
3028
|
+
isExternal: true,
|
|
3029
|
+
modifiers: [],
|
|
3030
|
+
hasImportantModifier: false,
|
|
3031
|
+
baseClassName: className,
|
|
3032
|
+
maybePostfixModifierPosition: void 0
|
|
3033
|
+
};
|
|
2913
3034
|
}
|
|
2914
3035
|
if (experimentalParseClassName) {
|
|
2915
3036
|
const parseClassNameOriginal = parseClassName;
|
|
@@ -2920,35 +3041,36 @@ const createParseClassName = (config) => {
|
|
|
2920
3041
|
}
|
|
2921
3042
|
return parseClassName;
|
|
2922
3043
|
};
|
|
3044
|
+
const stripImportantModifier = (baseClassName) => {
|
|
3045
|
+
if (baseClassName.endsWith(IMPORTANT_MODIFIER)) {
|
|
3046
|
+
return baseClassName.substring(0, baseClassName.length - 1);
|
|
3047
|
+
}
|
|
3048
|
+
if (baseClassName.startsWith(IMPORTANT_MODIFIER)) {
|
|
3049
|
+
return baseClassName.substring(1);
|
|
3050
|
+
}
|
|
3051
|
+
return baseClassName;
|
|
3052
|
+
};
|
|
2923
3053
|
const createSortModifiers = (config) => {
|
|
2924
|
-
const
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
const
|
|
2930
|
-
let
|
|
2931
|
-
|
|
2932
|
-
const
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
if (currentSegment.length > 0) {
|
|
2937
|
-
currentSegment.sort();
|
|
2938
|
-
result.push(...currentSegment);
|
|
2939
|
-
currentSegment = [];
|
|
2940
|
-
}
|
|
2941
|
-
result.push(modifier);
|
|
3054
|
+
const orderSensitiveModifiers = Object.fromEntries(config.orderSensitiveModifiers.map((modifier) => [modifier, true]));
|
|
3055
|
+
const sortModifiers = (modifiers) => {
|
|
3056
|
+
if (modifiers.length <= 1) {
|
|
3057
|
+
return modifiers;
|
|
3058
|
+
}
|
|
3059
|
+
const sortedModifiers = [];
|
|
3060
|
+
let unsortedModifiers = [];
|
|
3061
|
+
modifiers.forEach((modifier) => {
|
|
3062
|
+
const isPositionSensitive = modifier[0] === "[" || orderSensitiveModifiers[modifier];
|
|
3063
|
+
if (isPositionSensitive) {
|
|
3064
|
+
sortedModifiers.push(...unsortedModifiers.sort(), modifier);
|
|
3065
|
+
unsortedModifiers = [];
|
|
2942
3066
|
} else {
|
|
2943
|
-
|
|
3067
|
+
unsortedModifiers.push(modifier);
|
|
2944
3068
|
}
|
|
2945
|
-
}
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
result.push(...currentSegment);
|
|
2949
|
-
}
|
|
2950
|
-
return result;
|
|
3069
|
+
});
|
|
3070
|
+
sortedModifiers.push(...unsortedModifiers.sort());
|
|
3071
|
+
return sortedModifiers;
|
|
2951
3072
|
};
|
|
3073
|
+
return sortModifiers;
|
|
2952
3074
|
};
|
|
2953
3075
|
const createConfigUtils = (config) => ({
|
|
2954
3076
|
cache: createLruCache(config.cacheSize),
|
|
@@ -2994,10 +3116,10 @@ const mergeClassList = (classList, configUtils) => {
|
|
|
2994
3116
|
}
|
|
2995
3117
|
hasPostfixModifier = false;
|
|
2996
3118
|
}
|
|
2997
|
-
const variantModifier =
|
|
3119
|
+
const variantModifier = sortModifiers(modifiers).join(":");
|
|
2998
3120
|
const modifierId = hasImportantModifier ? variantModifier + IMPORTANT_MODIFIER : variantModifier;
|
|
2999
3121
|
const classId = modifierId + classGroupId;
|
|
3000
|
-
if (classGroupsInConflict.
|
|
3122
|
+
if (classGroupsInConflict.includes(classId)) {
|
|
3001
3123
|
continue;
|
|
3002
3124
|
}
|
|
3003
3125
|
classGroupsInConflict.push(classId);
|
|
@@ -3010,13 +3132,13 @@ const mergeClassList = (classList, configUtils) => {
|
|
|
3010
3132
|
}
|
|
3011
3133
|
return result;
|
|
3012
3134
|
};
|
|
3013
|
-
|
|
3135
|
+
function twJoin() {
|
|
3014
3136
|
let index2 = 0;
|
|
3015
3137
|
let argument;
|
|
3016
3138
|
let resolvedValue;
|
|
3017
3139
|
let string = "";
|
|
3018
|
-
while (index2 <
|
|
3019
|
-
if (argument =
|
|
3140
|
+
while (index2 < arguments.length) {
|
|
3141
|
+
if (argument = arguments[index2++]) {
|
|
3020
3142
|
if (resolvedValue = toValue(argument)) {
|
|
3021
3143
|
string && (string += " ");
|
|
3022
3144
|
string += resolvedValue;
|
|
@@ -3024,7 +3146,7 @@ const twJoin = (...classLists) => {
|
|
|
3024
3146
|
}
|
|
3025
3147
|
}
|
|
3026
3148
|
return string;
|
|
3027
|
-
}
|
|
3149
|
+
}
|
|
3028
3150
|
const toValue = (mix) => {
|
|
3029
3151
|
if (typeof mix === "string") {
|
|
3030
3152
|
return mix;
|
|
@@ -3041,20 +3163,20 @@ const toValue = (mix) => {
|
|
|
3041
3163
|
}
|
|
3042
3164
|
return string;
|
|
3043
3165
|
};
|
|
3044
|
-
|
|
3166
|
+
function createTailwindMerge(createConfigFirst, ...createConfigRest) {
|
|
3045
3167
|
let configUtils;
|
|
3046
3168
|
let cacheGet;
|
|
3047
3169
|
let cacheSet;
|
|
3048
|
-
let functionToCall;
|
|
3049
|
-
|
|
3170
|
+
let functionToCall = initTailwindMerge;
|
|
3171
|
+
function initTailwindMerge(classList) {
|
|
3050
3172
|
const config = createConfigRest.reduce((previousConfig, createConfigCurrent) => createConfigCurrent(previousConfig), createConfigFirst());
|
|
3051
3173
|
configUtils = createConfigUtils(config);
|
|
3052
3174
|
cacheGet = configUtils.cache.get;
|
|
3053
3175
|
cacheSet = configUtils.cache.set;
|
|
3054
3176
|
functionToCall = tailwindMerge;
|
|
3055
3177
|
return tailwindMerge(classList);
|
|
3056
|
-
}
|
|
3057
|
-
|
|
3178
|
+
}
|
|
3179
|
+
function tailwindMerge(classList) {
|
|
3058
3180
|
const cachedResult = cacheGet(classList);
|
|
3059
3181
|
if (cachedResult) {
|
|
3060
3182
|
return cachedResult;
|
|
@@ -3062,13 +3184,13 @@ const createTailwindMerge = (createConfigFirst, ...createConfigRest) => {
|
|
|
3062
3184
|
const result = mergeClassList(classList, configUtils);
|
|
3063
3185
|
cacheSet(classList, result);
|
|
3064
3186
|
return result;
|
|
3187
|
+
}
|
|
3188
|
+
return function callTailwindMerge() {
|
|
3189
|
+
return functionToCall(twJoin.apply(null, arguments));
|
|
3065
3190
|
};
|
|
3066
|
-
|
|
3067
|
-
return (...args) => functionToCall(twJoin(...args));
|
|
3068
|
-
};
|
|
3069
|
-
const fallbackThemeArr = [];
|
|
3191
|
+
}
|
|
3070
3192
|
const fromTheme = (key) => {
|
|
3071
|
-
const themeGetter = (theme2) => theme2[key] ||
|
|
3193
|
+
const themeGetter = (theme2) => theme2[key] || [];
|
|
3072
3194
|
themeGetter.isThemeGetter = true;
|
|
3073
3195
|
return themeGetter;
|
|
3074
3196
|
};
|
|
@@ -5710,6 +5832,40 @@ function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForD
|
|
|
5710
5832
|
}
|
|
5711
5833
|
};
|
|
5712
5834
|
}
|
|
5835
|
+
function setRef(ref, value) {
|
|
5836
|
+
if (typeof ref === "function") {
|
|
5837
|
+
return ref(value);
|
|
5838
|
+
} else if (ref !== null && ref !== void 0) {
|
|
5839
|
+
ref.current = value;
|
|
5840
|
+
}
|
|
5841
|
+
}
|
|
5842
|
+
function composeRefs(...refs) {
|
|
5843
|
+
return (node) => {
|
|
5844
|
+
let hasCleanup = false;
|
|
5845
|
+
const cleanups = refs.map((ref) => {
|
|
5846
|
+
const cleanup = setRef(ref, node);
|
|
5847
|
+
if (!hasCleanup && typeof cleanup == "function") {
|
|
5848
|
+
hasCleanup = true;
|
|
5849
|
+
}
|
|
5850
|
+
return cleanup;
|
|
5851
|
+
});
|
|
5852
|
+
if (hasCleanup) {
|
|
5853
|
+
return () => {
|
|
5854
|
+
for (let i2 = 0; i2 < cleanups.length; i2++) {
|
|
5855
|
+
const cleanup = cleanups[i2];
|
|
5856
|
+
if (typeof cleanup == "function") {
|
|
5857
|
+
cleanup();
|
|
5858
|
+
} else {
|
|
5859
|
+
setRef(refs[i2], null);
|
|
5860
|
+
}
|
|
5861
|
+
}
|
|
5862
|
+
};
|
|
5863
|
+
}
|
|
5864
|
+
};
|
|
5865
|
+
}
|
|
5866
|
+
function useComposedRefs(...refs) {
|
|
5867
|
+
return React$1.useCallback(composeRefs(...refs), refs);
|
|
5868
|
+
}
|
|
5713
5869
|
function createContext2(rootComponentName, defaultContext) {
|
|
5714
5870
|
const Context2 = React$1.createContext(defaultContext);
|
|
5715
5871
|
const Provider2 = (props) => {
|
|
@@ -5728,7 +5884,7 @@ function createContext2(rootComponentName, defaultContext) {
|
|
|
5728
5884
|
}
|
|
5729
5885
|
return [Provider2, useContext2];
|
|
5730
5886
|
}
|
|
5731
|
-
function createContextScope
|
|
5887
|
+
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
5732
5888
|
let defaultContexts = [];
|
|
5733
5889
|
function createContext3(rootComponentName, defaultContext) {
|
|
5734
5890
|
const BaseContext = React$1.createContext(defaultContext);
|
|
@@ -5767,9 +5923,9 @@ function createContextScope$1(scopeName, createContextScopeDeps = []) {
|
|
|
5767
5923
|
};
|
|
5768
5924
|
};
|
|
5769
5925
|
createScope.scopeName = scopeName;
|
|
5770
|
-
return [createContext3, composeContextScopes
|
|
5926
|
+
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
5771
5927
|
}
|
|
5772
|
-
function composeContextScopes
|
|
5928
|
+
function composeContextScopes(...scopes) {
|
|
5773
5929
|
const baseScope = scopes[0];
|
|
5774
5930
|
if (scopes.length === 1)
|
|
5775
5931
|
return baseScope;
|
|
@@ -5869,12 +6025,12 @@ function isFunction(value) {
|
|
|
5869
6025
|
return typeof value === "function";
|
|
5870
6026
|
}
|
|
5871
6027
|
// @__NO_SIDE_EFFECTS__
|
|
5872
|
-
function createSlot
|
|
5873
|
-
const SlotClone = /* @__PURE__ */ createSlotClone
|
|
6028
|
+
function createSlot(ownerName) {
|
|
6029
|
+
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
5874
6030
|
const Slot2 = React$1.forwardRef((props, forwardedRef) => {
|
|
5875
6031
|
const { children, ...slotProps } = props;
|
|
5876
6032
|
const childrenArray = React$1.Children.toArray(children);
|
|
5877
|
-
const slottable = childrenArray.find(isSlottable
|
|
6033
|
+
const slottable = childrenArray.find(isSlottable);
|
|
5878
6034
|
if (slottable) {
|
|
5879
6035
|
const newElement = slottable.props.children;
|
|
5880
6036
|
const newChildren = childrenArray.map((child) => {
|
|
@@ -5894,12 +6050,12 @@ function createSlot$3(ownerName) {
|
|
|
5894
6050
|
return Slot2;
|
|
5895
6051
|
}
|
|
5896
6052
|
// @__NO_SIDE_EFFECTS__
|
|
5897
|
-
function createSlotClone
|
|
6053
|
+
function createSlotClone(ownerName) {
|
|
5898
6054
|
const SlotClone = React$1.forwardRef((props, forwardedRef) => {
|
|
5899
6055
|
const { children, ...slotProps } = props;
|
|
5900
6056
|
if (React$1.isValidElement(children)) {
|
|
5901
|
-
const childrenRef = getElementRef$
|
|
5902
|
-
const props2 = mergeProps
|
|
6057
|
+
const childrenRef = getElementRef$1(children);
|
|
6058
|
+
const props2 = mergeProps(slotProps, children.props);
|
|
5903
6059
|
if (children.type !== React$1.Fragment) {
|
|
5904
6060
|
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
5905
6061
|
}
|
|
@@ -5910,20 +6066,20 @@ function createSlotClone$3(ownerName) {
|
|
|
5910
6066
|
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
5911
6067
|
return SlotClone;
|
|
5912
6068
|
}
|
|
5913
|
-
var SLOTTABLE_IDENTIFIER
|
|
6069
|
+
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
5914
6070
|
// @__NO_SIDE_EFFECTS__
|
|
5915
6071
|
function createSlottable(ownerName) {
|
|
5916
6072
|
const Slottable2 = ({ children }) => {
|
|
5917
6073
|
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
5918
6074
|
};
|
|
5919
6075
|
Slottable2.displayName = `${ownerName}.Slottable`;
|
|
5920
|
-
Slottable2.__radixId = SLOTTABLE_IDENTIFIER
|
|
6076
|
+
Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
|
|
5921
6077
|
return Slottable2;
|
|
5922
6078
|
}
|
|
5923
|
-
function isSlottable
|
|
5924
|
-
return React$1.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER
|
|
6079
|
+
function isSlottable(child) {
|
|
6080
|
+
return React$1.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
5925
6081
|
}
|
|
5926
|
-
function mergeProps
|
|
6082
|
+
function mergeProps(slotProps, childProps) {
|
|
5927
6083
|
const overrideProps = { ...childProps };
|
|
5928
6084
|
for (const propName in childProps) {
|
|
5929
6085
|
const slotPropValue = slotProps[propName];
|
|
@@ -5947,7 +6103,7 @@ function mergeProps$3(slotProps, childProps) {
|
|
|
5947
6103
|
}
|
|
5948
6104
|
return { ...slotProps, ...overrideProps };
|
|
5949
6105
|
}
|
|
5950
|
-
function getElementRef$
|
|
6106
|
+
function getElementRef$1(element) {
|
|
5951
6107
|
var _a, _b;
|
|
5952
6108
|
let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
|
|
5953
6109
|
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
@@ -5961,7 +6117,7 @@ function getElementRef$4(element) {
|
|
|
5961
6117
|
}
|
|
5962
6118
|
return element.props.ref || element.ref;
|
|
5963
6119
|
}
|
|
5964
|
-
var NODES
|
|
6120
|
+
var NODES = [
|
|
5965
6121
|
"a",
|
|
5966
6122
|
"button",
|
|
5967
6123
|
"div",
|
|
@@ -5980,8 +6136,8 @@ var NODES$3 = [
|
|
|
5980
6136
|
"svg",
|
|
5981
6137
|
"ul"
|
|
5982
6138
|
];
|
|
5983
|
-
var Primitive
|
|
5984
|
-
const Slot2 = /* @__PURE__ */ createSlot
|
|
6139
|
+
var Primitive = NODES.reduce((primitive, node) => {
|
|
6140
|
+
const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
5985
6141
|
const Node2 = React$1.forwardRef((props, forwardedRef) => {
|
|
5986
6142
|
const { asChild, ...primitiveProps } = props;
|
|
5987
6143
|
const Comp = asChild ? Slot2 : node;
|
|
@@ -6114,7 +6270,7 @@ var DismissableLayer = React$1.forwardRef(
|
|
|
6114
6270
|
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
6115
6271
|
}, []);
|
|
6116
6272
|
return /* @__PURE__ */ jsx(
|
|
6117
|
-
Primitive
|
|
6273
|
+
Primitive.div,
|
|
6118
6274
|
{
|
|
6119
6275
|
...layerProps,
|
|
6120
6276
|
ref: composedRefs,
|
|
@@ -6147,7 +6303,7 @@ var DismissableLayerBranch = React$1.forwardRef((props, forwardedRef) => {
|
|
|
6147
6303
|
};
|
|
6148
6304
|
}
|
|
6149
6305
|
}, [context.branches]);
|
|
6150
|
-
return /* @__PURE__ */ jsx(Primitive
|
|
6306
|
+
return /* @__PURE__ */ jsx(Primitive.div, { ...props, ref: composedRefs });
|
|
6151
6307
|
});
|
|
6152
6308
|
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
6153
6309
|
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
|
|
@@ -6356,7 +6512,7 @@ var FocusScope = React$1.forwardRef((props, forwardedRef) => {
|
|
|
6356
6512
|
},
|
|
6357
6513
|
[loop, trapped, focusScope.paused]
|
|
6358
6514
|
);
|
|
6359
|
-
return /* @__PURE__ */ jsx(Primitive
|
|
6515
|
+
return /* @__PURE__ */ jsx(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
|
|
6360
6516
|
});
|
|
6361
6517
|
FocusScope.displayName = FOCUS_SCOPE_NAME;
|
|
6362
6518
|
function focusFirst$2(candidates, { select = false } = {}) {
|
|
@@ -6453,7 +6609,7 @@ var Portal$5 = React$1.forwardRef((props, forwardedRef) => {
|
|
|
6453
6609
|
const [mounted, setMounted] = React$1.useState(false);
|
|
6454
6610
|
useLayoutEffect2(() => setMounted(true), []);
|
|
6455
6611
|
const container = containerProp || mounted && ((_a = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : _a.body);
|
|
6456
|
-
return container ? ReactDOM__default.createPortal(/* @__PURE__ */ jsx(Primitive
|
|
6612
|
+
return container ? ReactDOM__default.createPortal(/* @__PURE__ */ jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
6457
6613
|
});
|
|
6458
6614
|
Portal$5.displayName = PORTAL_NAME$6;
|
|
6459
6615
|
function useStateMachine(initialState, machine) {
|
|
@@ -6466,7 +6622,7 @@ var Presence = (props) => {
|
|
|
6466
6622
|
const { present, children } = props;
|
|
6467
6623
|
const presence = usePresence(present);
|
|
6468
6624
|
const child = typeof children === "function" ? children({ present: presence.isPresent }) : React$1.Children.only(children);
|
|
6469
|
-
const ref = useComposedRefs(presence.ref, getElementRef
|
|
6625
|
+
const ref = useComposedRefs(presence.ref, getElementRef(child));
|
|
6470
6626
|
const forceMount = typeof children === "function";
|
|
6471
6627
|
return forceMount || presence.isPresent ? React$1.cloneElement(child, { ref }) : null;
|
|
6472
6628
|
};
|
|
@@ -6565,7 +6721,7 @@ function usePresence(present) {
|
|
|
6565
6721
|
function getAnimationName(styles) {
|
|
6566
6722
|
return (styles == null ? void 0 : styles.animationName) || "none";
|
|
6567
6723
|
}
|
|
6568
|
-
function getElementRef
|
|
6724
|
+
function getElementRef(element) {
|
|
6569
6725
|
var _a, _b;
|
|
6570
6726
|
let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
|
|
6571
6727
|
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
@@ -7388,7 +7544,7 @@ var hideOthers = function(originalTarget, parentNode, markerName) {
|
|
|
7388
7544
|
return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
|
|
7389
7545
|
};
|
|
7390
7546
|
var DIALOG_NAME = "Dialog";
|
|
7391
|
-
var [createDialogContext, createDialogScope] = createContextScope
|
|
7547
|
+
var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
|
|
7392
7548
|
var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
|
|
7393
7549
|
var Dialog$1 = (props) => {
|
|
7394
7550
|
const {
|
|
@@ -7432,7 +7588,7 @@ var DialogTrigger = React$1.forwardRef(
|
|
|
7432
7588
|
const context = useDialogContext(TRIGGER_NAME$5, __scopeDialog);
|
|
7433
7589
|
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
7434
7590
|
return /* @__PURE__ */ jsx(
|
|
7435
|
-
Primitive
|
|
7591
|
+
Primitive.button,
|
|
7436
7592
|
{
|
|
7437
7593
|
type: "button",
|
|
7438
7594
|
"aria-haspopup": "dialog",
|
|
@@ -7467,7 +7623,7 @@ var DialogOverlay$1 = React$1.forwardRef(
|
|
|
7467
7623
|
}
|
|
7468
7624
|
);
|
|
7469
7625
|
DialogOverlay$1.displayName = OVERLAY_NAME;
|
|
7470
|
-
var Slot$3 = /* @__PURE__ */ createSlot
|
|
7626
|
+
var Slot$3 = /* @__PURE__ */ createSlot("DialogOverlay.RemoveScroll");
|
|
7471
7627
|
var DialogOverlayImpl = React$1.forwardRef(
|
|
7472
7628
|
(props, forwardedRef) => {
|
|
7473
7629
|
const { __scopeDialog, ...overlayProps } = props;
|
|
@@ -7476,7 +7632,7 @@ var DialogOverlayImpl = React$1.forwardRef(
|
|
|
7476
7632
|
// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
|
|
7477
7633
|
// ie. when `Overlay` and `Content` are siblings
|
|
7478
7634
|
/* @__PURE__ */ jsx(RemoveScroll, { as: Slot$3, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsx(
|
|
7479
|
-
Primitive
|
|
7635
|
+
Primitive.div,
|
|
7480
7636
|
{
|
|
7481
7637
|
"data-state": getState$1(context.open),
|
|
7482
7638
|
...overlayProps,
|
|
@@ -7621,7 +7777,7 @@ var DialogTitle$1 = React$1.forwardRef(
|
|
|
7621
7777
|
(props, forwardedRef) => {
|
|
7622
7778
|
const { __scopeDialog, ...titleProps } = props;
|
|
7623
7779
|
const context = useDialogContext(TITLE_NAME, __scopeDialog);
|
|
7624
|
-
return /* @__PURE__ */ jsx(Primitive
|
|
7780
|
+
return /* @__PURE__ */ jsx(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
|
|
7625
7781
|
}
|
|
7626
7782
|
);
|
|
7627
7783
|
DialogTitle$1.displayName = TITLE_NAME;
|
|
@@ -7630,7 +7786,7 @@ var DialogDescription$1 = React$1.forwardRef(
|
|
|
7630
7786
|
(props, forwardedRef) => {
|
|
7631
7787
|
const { __scopeDialog, ...descriptionProps } = props;
|
|
7632
7788
|
const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
|
|
7633
|
-
return /* @__PURE__ */ jsx(Primitive
|
|
7789
|
+
return /* @__PURE__ */ jsx(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
|
|
7634
7790
|
}
|
|
7635
7791
|
);
|
|
7636
7792
|
DialogDescription$1.displayName = DESCRIPTION_NAME;
|
|
@@ -7640,7 +7796,7 @@ var DialogClose = React$1.forwardRef(
|
|
|
7640
7796
|
const { __scopeDialog, ...closeProps } = props;
|
|
7641
7797
|
const context = useDialogContext(CLOSE_NAME$1, __scopeDialog);
|
|
7642
7798
|
return /* @__PURE__ */ jsx(
|
|
7643
|
-
Primitive
|
|
7799
|
+
Primitive.button,
|
|
7644
7800
|
{
|
|
7645
7801
|
type: "button",
|
|
7646
7802
|
...closeProps,
|
|
@@ -8314,7 +8470,7 @@ const DialogContent = React$1.forwardRef(({ className, children, ...props }, ref
|
|
|
8314
8470
|
/* @__PURE__ */ jsxs(
|
|
8315
8471
|
Close,
|
|
8316
8472
|
{
|
|
8317
|
-
className: "closeDialog cteditor-absolute cteditor-right-4 cteditor-top-4 cteditor-rounded-full cteditor-bg-secondary cteditor-p-1 cteditor-opacity-70 cteditor-transition-opacity focus:cteditor-outline-none cteditor-disabled:pointer-events-none data-[state=open]:cteditor-bg-accent data-[state=open]:cteditor-text-muted-foreground hover:cteditor-opacity-100\n",
|
|
8473
|
+
className: "closeDialog cteditor-absolute cteditor-right-4 cteditor-top-4 cteditor-rounded-full cteditor-bg-secondary cteditor-p-1 cteditor-opacity-70 cteditor-transition-opacity focus:cteditor-outline-none cteditor-disabled:pointer-events-none data-[state=open]:cteditor-bg-accent data-[state=open]:cteditor-text-muted-foreground hover:cteditor-opacity-100\r\n",
|
|
8318
8474
|
children: [
|
|
8319
8475
|
/* @__PURE__ */ jsx(X$1, { className: "cteditor-h-4 cteditor-w-4" }),
|
|
8320
8476
|
/* @__PURE__ */ jsx("span", { className: "!cteditor-sr-only", children: "Close" })
|
|
@@ -8392,140 +8548,10 @@ const Input$1 = React$1.forwardRef(
|
|
|
8392
8548
|
}
|
|
8393
8549
|
);
|
|
8394
8550
|
Input$1.displayName = "Input";
|
|
8395
|
-
var REACT_LAZY_TYPE$2 = Symbol.for("react.lazy");
|
|
8396
|
-
var use$2 = React$1[" use ".trim().toString()];
|
|
8397
|
-
function isPromiseLike$2(value) {
|
|
8398
|
-
return typeof value === "object" && value !== null && "then" in value;
|
|
8399
|
-
}
|
|
8400
|
-
function isLazyComponent$2(element) {
|
|
8401
|
-
return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE$2 && "_payload" in element && isPromiseLike$2(element._payload);
|
|
8402
|
-
}
|
|
8403
|
-
// @__NO_SIDE_EFFECTS__
|
|
8404
|
-
function createSlot$2(ownerName) {
|
|
8405
|
-
const SlotClone = /* @__PURE__ */ createSlotClone$2(ownerName);
|
|
8406
|
-
const Slot2 = React$1.forwardRef((props, forwardedRef) => {
|
|
8407
|
-
let { children, ...slotProps } = props;
|
|
8408
|
-
if (isLazyComponent$2(children) && typeof use$2 === "function") {
|
|
8409
|
-
children = use$2(children._payload);
|
|
8410
|
-
}
|
|
8411
|
-
const childrenArray = React$1.Children.toArray(children);
|
|
8412
|
-
const slottable = childrenArray.find(isSlottable$2);
|
|
8413
|
-
if (slottable) {
|
|
8414
|
-
const newElement = slottable.props.children;
|
|
8415
|
-
const newChildren = childrenArray.map((child) => {
|
|
8416
|
-
if (child === slottable) {
|
|
8417
|
-
if (React$1.Children.count(newElement) > 1)
|
|
8418
|
-
return React$1.Children.only(null);
|
|
8419
|
-
return React$1.isValidElement(newElement) ? newElement.props.children : null;
|
|
8420
|
-
} else {
|
|
8421
|
-
return child;
|
|
8422
|
-
}
|
|
8423
|
-
});
|
|
8424
|
-
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React$1.isValidElement(newElement) ? React$1.cloneElement(newElement, void 0, newChildren) : null });
|
|
8425
|
-
}
|
|
8426
|
-
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
8427
|
-
});
|
|
8428
|
-
Slot2.displayName = `${ownerName}.Slot`;
|
|
8429
|
-
return Slot2;
|
|
8430
|
-
}
|
|
8431
|
-
// @__NO_SIDE_EFFECTS__
|
|
8432
|
-
function createSlotClone$2(ownerName) {
|
|
8433
|
-
const SlotClone = React$1.forwardRef((props, forwardedRef) => {
|
|
8434
|
-
let { children, ...slotProps } = props;
|
|
8435
|
-
if (isLazyComponent$2(children) && typeof use$2 === "function") {
|
|
8436
|
-
children = use$2(children._payload);
|
|
8437
|
-
}
|
|
8438
|
-
if (React$1.isValidElement(children)) {
|
|
8439
|
-
const childrenRef = getElementRef$2(children);
|
|
8440
|
-
const props2 = mergeProps$2(slotProps, children.props);
|
|
8441
|
-
if (children.type !== React$1.Fragment) {
|
|
8442
|
-
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
8443
|
-
}
|
|
8444
|
-
return React$1.cloneElement(children, props2);
|
|
8445
|
-
}
|
|
8446
|
-
return React$1.Children.count(children) > 1 ? React$1.Children.only(null) : null;
|
|
8447
|
-
});
|
|
8448
|
-
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
8449
|
-
return SlotClone;
|
|
8450
|
-
}
|
|
8451
|
-
var SLOTTABLE_IDENTIFIER$2 = Symbol("radix.slottable");
|
|
8452
|
-
function isSlottable$2(child) {
|
|
8453
|
-
return React$1.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$2;
|
|
8454
|
-
}
|
|
8455
|
-
function mergeProps$2(slotProps, childProps) {
|
|
8456
|
-
const overrideProps = { ...childProps };
|
|
8457
|
-
for (const propName in childProps) {
|
|
8458
|
-
const slotPropValue = slotProps[propName];
|
|
8459
|
-
const childPropValue = childProps[propName];
|
|
8460
|
-
const isHandler = /^on[A-Z]/.test(propName);
|
|
8461
|
-
if (isHandler) {
|
|
8462
|
-
if (slotPropValue && childPropValue) {
|
|
8463
|
-
overrideProps[propName] = (...args) => {
|
|
8464
|
-
const result = childPropValue(...args);
|
|
8465
|
-
slotPropValue(...args);
|
|
8466
|
-
return result;
|
|
8467
|
-
};
|
|
8468
|
-
} else if (slotPropValue) {
|
|
8469
|
-
overrideProps[propName] = slotPropValue;
|
|
8470
|
-
}
|
|
8471
|
-
} else if (propName === "style") {
|
|
8472
|
-
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
8473
|
-
} else if (propName === "className") {
|
|
8474
|
-
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
8475
|
-
}
|
|
8476
|
-
}
|
|
8477
|
-
return { ...slotProps, ...overrideProps };
|
|
8478
|
-
}
|
|
8479
|
-
function getElementRef$2(element) {
|
|
8480
|
-
var _a, _b;
|
|
8481
|
-
let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
|
|
8482
|
-
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
8483
|
-
if (mayWarn) {
|
|
8484
|
-
return element.ref;
|
|
8485
|
-
}
|
|
8486
|
-
getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
|
|
8487
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
8488
|
-
if (mayWarn) {
|
|
8489
|
-
return element.props.ref;
|
|
8490
|
-
}
|
|
8491
|
-
return element.props.ref || element.ref;
|
|
8492
|
-
}
|
|
8493
|
-
var NODES$2 = [
|
|
8494
|
-
"a",
|
|
8495
|
-
"button",
|
|
8496
|
-
"div",
|
|
8497
|
-
"form",
|
|
8498
|
-
"h2",
|
|
8499
|
-
"h3",
|
|
8500
|
-
"img",
|
|
8501
|
-
"input",
|
|
8502
|
-
"label",
|
|
8503
|
-
"li",
|
|
8504
|
-
"nav",
|
|
8505
|
-
"ol",
|
|
8506
|
-
"p",
|
|
8507
|
-
"select",
|
|
8508
|
-
"span",
|
|
8509
|
-
"svg",
|
|
8510
|
-
"ul"
|
|
8511
|
-
];
|
|
8512
|
-
var Primitive$2 = NODES$2.reduce((primitive, node) => {
|
|
8513
|
-
const Slot2 = /* @__PURE__ */ createSlot$2(`Primitive.${node}`);
|
|
8514
|
-
const Node2 = React$1.forwardRef((props, forwardedRef) => {
|
|
8515
|
-
const { asChild, ...primitiveProps } = props;
|
|
8516
|
-
const Comp = asChild ? Slot2 : node;
|
|
8517
|
-
if (typeof window !== "undefined") {
|
|
8518
|
-
window[Symbol.for("radix-ui")] = true;
|
|
8519
|
-
}
|
|
8520
|
-
return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
8521
|
-
});
|
|
8522
|
-
Node2.displayName = `Primitive.${node}`;
|
|
8523
|
-
return { ...primitive, [node]: Node2 };
|
|
8524
|
-
}, {});
|
|
8525
8551
|
var NAME$4 = "Label";
|
|
8526
8552
|
var Label$3 = React$1.forwardRef((props, forwardedRef) => {
|
|
8527
8553
|
return /* @__PURE__ */ jsx(
|
|
8528
|
-
Primitive
|
|
8554
|
+
Primitive.label,
|
|
8529
8555
|
{
|
|
8530
8556
|
...props,
|
|
8531
8557
|
ref: forwardedRef,
|
|
@@ -8590,7 +8616,22 @@ const ImageGenerationDialog = ({
|
|
|
8590
8616
|
handleClose();
|
|
8591
8617
|
} catch (error) {
|
|
8592
8618
|
console.error("Error generating image:", error);
|
|
8593
|
-
|
|
8619
|
+
if (error instanceof ApiKeyRequiredError$1) {
|
|
8620
|
+
const title = error.code === "API_KEYS_DISABLED" ? "API Keys Disabled" : "API Key Required";
|
|
8621
|
+
toast.error(title, {
|
|
8622
|
+
description: error.message,
|
|
8623
|
+
duration: 8e3
|
|
8624
|
+
});
|
|
8625
|
+
} else if (error instanceof CreditError$1) {
|
|
8626
|
+
toast.error("Credits Issue", {
|
|
8627
|
+
description: error.message,
|
|
8628
|
+
duration: 8e3
|
|
8629
|
+
});
|
|
8630
|
+
} else {
|
|
8631
|
+
toast.error("Image generation failed", {
|
|
8632
|
+
description: error instanceof Error ? error.message : "An error occurred"
|
|
8633
|
+
});
|
|
8634
|
+
}
|
|
8594
8635
|
}
|
|
8595
8636
|
};
|
|
8596
8637
|
const handleClose = () => {
|
|
@@ -9044,7 +9085,59 @@ const AIRephrasePlugin = () => {
|
|
|
9044
9085
|
duration: Infinity
|
|
9045
9086
|
});
|
|
9046
9087
|
try {
|
|
9047
|
-
const
|
|
9088
|
+
const userTextLength = selectedText.length;
|
|
9089
|
+
if (type === "MAKE_LONGER" || type === "MAKE_SHORTER") {
|
|
9090
|
+
const savedSelection = {
|
|
9091
|
+
anchor: { key: selection.anchor.key, offset: selection.anchor.offset, type: selection.anchor.type },
|
|
9092
|
+
focus: { key: selection.focus.key, offset: selection.focus.offset, type: selection.focus.type }
|
|
9093
|
+
};
|
|
9094
|
+
let isFirstChunk = true;
|
|
9095
|
+
let streamedContent = "";
|
|
9096
|
+
await AiTextTransformStream({
|
|
9097
|
+
content: prompt,
|
|
9098
|
+
apiKey: apiKey || void 0,
|
|
9099
|
+
userTextLength,
|
|
9100
|
+
onChunk: (chunk) => {
|
|
9101
|
+
streamedContent += chunk;
|
|
9102
|
+
editor.update(() => {
|
|
9103
|
+
if (isFirstChunk) {
|
|
9104
|
+
isFirstChunk = false;
|
|
9105
|
+
try {
|
|
9106
|
+
const newSelection = $getSelection();
|
|
9107
|
+
if (newSelection && $isRangeSelection(newSelection)) {
|
|
9108
|
+
newSelection.anchor.set(savedSelection.anchor.key, savedSelection.anchor.offset, savedSelection.anchor.type);
|
|
9109
|
+
newSelection.focus.set(savedSelection.focus.key, savedSelection.focus.offset, savedSelection.focus.type);
|
|
9110
|
+
newSelection.insertText("");
|
|
9111
|
+
}
|
|
9112
|
+
} catch (e) {
|
|
9113
|
+
console.warn("Could not restore selection", e);
|
|
9114
|
+
}
|
|
9115
|
+
}
|
|
9116
|
+
const currentSelection = $getSelection();
|
|
9117
|
+
if (currentSelection && $isRangeSelection(currentSelection)) {
|
|
9118
|
+
currentSelection.insertText(chunk);
|
|
9119
|
+
}
|
|
9120
|
+
});
|
|
9121
|
+
},
|
|
9122
|
+
onComplete: () => {
|
|
9123
|
+
toast.dismiss(loadingToastId);
|
|
9124
|
+
toast.success(successMessage);
|
|
9125
|
+
},
|
|
9126
|
+
onError: (error) => {
|
|
9127
|
+
toast.dismiss(loadingToastId);
|
|
9128
|
+
if (error instanceof ApiKeyRequiredError$1) {
|
|
9129
|
+
const title = error.code === "API_KEYS_DISABLED" ? "API Keys Disabled" : "API Key Required";
|
|
9130
|
+
toast.error(title, { description: error.message, duration: 8e3 });
|
|
9131
|
+
} else if (error instanceof CreditError$1) {
|
|
9132
|
+
toast.error("Credits Issue", { description: error.message, duration: 8e3 });
|
|
9133
|
+
} else {
|
|
9134
|
+
toast.error(`${actionName} failed`, { description: error.message });
|
|
9135
|
+
}
|
|
9136
|
+
}
|
|
9137
|
+
});
|
|
9138
|
+
return true;
|
|
9139
|
+
}
|
|
9140
|
+
const response = await AiJsonResponse({ content: prompt, apiKey: apiKey || void 0, userTextLength });
|
|
9048
9141
|
if (!response.data) {
|
|
9049
9142
|
console.warn("Empty response received");
|
|
9050
9143
|
toast.dismiss(loadingToastId);
|
|
@@ -9069,9 +9162,22 @@ const AIRephrasePlugin = () => {
|
|
|
9069
9162
|
} catch (error) {
|
|
9070
9163
|
console.error("Error in AI stream:", error);
|
|
9071
9164
|
toast.dismiss(loadingToastId);
|
|
9072
|
-
|
|
9073
|
-
|
|
9074
|
-
|
|
9165
|
+
if (error instanceof ApiKeyRequiredError$1) {
|
|
9166
|
+
const title = error.code === "API_KEYS_DISABLED" ? "API Keys Disabled" : "API Key Required";
|
|
9167
|
+
toast.error(title, {
|
|
9168
|
+
description: error.message,
|
|
9169
|
+
duration: 8e3
|
|
9170
|
+
});
|
|
9171
|
+
} else if (error instanceof CreditError$1) {
|
|
9172
|
+
toast.error("Credits Issue", {
|
|
9173
|
+
description: error.message,
|
|
9174
|
+
duration: 8e3
|
|
9175
|
+
});
|
|
9176
|
+
} else {
|
|
9177
|
+
toast.error(`${actionName} failed`, {
|
|
9178
|
+
description: error instanceof Error ? error.message : "An error occurred"
|
|
9179
|
+
});
|
|
9180
|
+
}
|
|
9075
9181
|
return false;
|
|
9076
9182
|
}
|
|
9077
9183
|
};
|
|
@@ -9083,10 +9189,11 @@ const AIRephrasePlugin = () => {
|
|
|
9083
9189
|
duration: Infinity
|
|
9084
9190
|
});
|
|
9085
9191
|
try {
|
|
9192
|
+
const userTextLength = selectedTextForTranslation.length;
|
|
9086
9193
|
const prompt = `Translate this text to ${targetLanguage}. Return ONLY the translated text without any markdown formatting, headers, or special symbols. Just the plain translated text:
|
|
9087
9194
|
|
|
9088
9195
|
"${selectedTextForTranslation}"`;
|
|
9089
|
-
const response = await AiJsonResponse({ content: prompt, apiKey: apiKey || void 0 });
|
|
9196
|
+
const response = await AiJsonResponse({ content: prompt, apiKey: apiKey || void 0, userTextLength });
|
|
9090
9197
|
if (!response.data) {
|
|
9091
9198
|
console.warn("Empty response received");
|
|
9092
9199
|
toast.dismiss(loadingToastId);
|
|
@@ -9130,9 +9237,22 @@ const AIRephrasePlugin = () => {
|
|
|
9130
9237
|
} catch (error) {
|
|
9131
9238
|
console.error("Error in translation:", error);
|
|
9132
9239
|
toast.dismiss(loadingToastId);
|
|
9133
|
-
|
|
9134
|
-
|
|
9135
|
-
|
|
9240
|
+
if (error instanceof ApiKeyRequiredError$1) {
|
|
9241
|
+
const title = error.code === "API_KEYS_DISABLED" ? "API Keys Disabled" : "API Key Required";
|
|
9242
|
+
toast.error(title, {
|
|
9243
|
+
description: error.message,
|
|
9244
|
+
duration: 8e3
|
|
9245
|
+
});
|
|
9246
|
+
} else if (error instanceof CreditError$1) {
|
|
9247
|
+
toast.error("Credits Issue", {
|
|
9248
|
+
description: error.message,
|
|
9249
|
+
duration: 8e3
|
|
9250
|
+
});
|
|
9251
|
+
} else {
|
|
9252
|
+
toast.error("Translation failed", {
|
|
9253
|
+
description: error instanceof Error ? error.message : "An error occurred"
|
|
9254
|
+
});
|
|
9255
|
+
}
|
|
9136
9256
|
return false;
|
|
9137
9257
|
}
|
|
9138
9258
|
};
|
|
@@ -9143,6 +9263,7 @@ const AIRephrasePlugin = () => {
|
|
|
9143
9263
|
toast.error("No text selected for tone adjustment");
|
|
9144
9264
|
return false;
|
|
9145
9265
|
}
|
|
9266
|
+
const userTextLength = selectedText.length;
|
|
9146
9267
|
const prompt = `Adjust the tone of this text to be ${targetTone.toLowerCase()}. Maintain the core message and key information, but change the style and word choice to match the ${targetTone.toLowerCase()} tone:
|
|
9147
9268
|
"${selectedText}"`;
|
|
9148
9269
|
const loadingToastId = toast.loading(`Adjusting to ${targetTone} tone...`, {
|
|
@@ -9150,46 +9271,69 @@ const AIRephrasePlugin = () => {
|
|
|
9150
9271
|
duration: Infinity
|
|
9151
9272
|
});
|
|
9152
9273
|
try {
|
|
9153
|
-
|
|
9154
|
-
|
|
9155
|
-
|
|
9156
|
-
|
|
9157
|
-
|
|
9158
|
-
|
|
9159
|
-
|
|
9160
|
-
|
|
9161
|
-
|
|
9162
|
-
|
|
9163
|
-
|
|
9164
|
-
|
|
9165
|
-
|
|
9166
|
-
|
|
9167
|
-
|
|
9168
|
-
|
|
9169
|
-
|
|
9274
|
+
let isFirstChunk = true;
|
|
9275
|
+
await AiTextTransformStream({
|
|
9276
|
+
content: prompt,
|
|
9277
|
+
apiKey: apiKey || void 0,
|
|
9278
|
+
userTextLength,
|
|
9279
|
+
onChunk: (chunk) => {
|
|
9280
|
+
editor.update(() => {
|
|
9281
|
+
if (isFirstChunk) {
|
|
9282
|
+
isFirstChunk = false;
|
|
9283
|
+
try {
|
|
9284
|
+
const newSelection = $getSelection();
|
|
9285
|
+
if (newSelection && $isRangeSelection(newSelection)) {
|
|
9286
|
+
newSelection.anchor.set(savedSelection.anchor.key, savedSelection.anchor.offset, savedSelection.anchor.type);
|
|
9287
|
+
newSelection.focus.set(savedSelection.focus.key, savedSelection.focus.offset, savedSelection.focus.type);
|
|
9288
|
+
newSelection.insertText("");
|
|
9289
|
+
}
|
|
9290
|
+
} catch (e) {
|
|
9291
|
+
console.warn("Could not restore selection", e);
|
|
9292
|
+
}
|
|
9293
|
+
}
|
|
9294
|
+
const currentSelection = $getSelection();
|
|
9295
|
+
if (currentSelection && $isRangeSelection(currentSelection)) {
|
|
9296
|
+
currentSelection.insertText(chunk);
|
|
9297
|
+
}
|
|
9298
|
+
});
|
|
9299
|
+
},
|
|
9300
|
+
onComplete: () => {
|
|
9301
|
+
toast.dismiss(loadingToastId);
|
|
9302
|
+
toast.success(`Tone adjusted to ${targetTone} successfully!`);
|
|
9303
|
+
toneSelectionRef.current = null;
|
|
9304
|
+
},
|
|
9305
|
+
onError: (error) => {
|
|
9306
|
+
toast.dismiss(loadingToastId);
|
|
9307
|
+
if (error instanceof ApiKeyRequiredError$1) {
|
|
9308
|
+
const title = error.code === "API_KEYS_DISABLED" ? "API Keys Disabled" : "API Key Required";
|
|
9309
|
+
toast.error(title, { description: error.message, duration: 8e3 });
|
|
9310
|
+
} else if (error instanceof CreditError$1) {
|
|
9311
|
+
toast.error("Credits Issue", { description: error.message, duration: 8e3 });
|
|
9312
|
+
} else {
|
|
9313
|
+
toast.error("Tone adjustment failed", { description: error.message });
|
|
9170
9314
|
}
|
|
9171
|
-
} catch (e) {
|
|
9172
|
-
console.warn("Could not restore selection, will append at end", e);
|
|
9173
9315
|
}
|
|
9174
|
-
const currentSelection = $getSelection();
|
|
9175
|
-
if (!currentSelection || !$isRangeSelection(currentSelection))
|
|
9176
|
-
return;
|
|
9177
|
-
const parser = new DOMParser();
|
|
9178
|
-
const dom = parser.parseFromString(response.data, "text/html");
|
|
9179
|
-
const nodes = $generateNodesFromDOM(editor, dom);
|
|
9180
|
-
currentSelection.insertText("");
|
|
9181
|
-
$insertNodes(nodes);
|
|
9182
9316
|
});
|
|
9183
|
-
toast.dismiss(loadingToastId);
|
|
9184
|
-
toast.success(`Tone adjusted to ${targetTone} successfully!`);
|
|
9185
|
-
toneSelectionRef.current = null;
|
|
9186
9317
|
return true;
|
|
9187
9318
|
} catch (error) {
|
|
9188
9319
|
console.error("Error in tone adjustment:", error);
|
|
9189
9320
|
toast.dismiss(loadingToastId);
|
|
9190
|
-
|
|
9191
|
-
|
|
9192
|
-
|
|
9321
|
+
if (error instanceof ApiKeyRequiredError$1) {
|
|
9322
|
+
const title = error.code === "API_KEYS_DISABLED" ? "API Keys Disabled" : "API Key Required";
|
|
9323
|
+
toast.error(title, {
|
|
9324
|
+
description: error.message,
|
|
9325
|
+
duration: 8e3
|
|
9326
|
+
});
|
|
9327
|
+
} else if (error instanceof CreditError$1) {
|
|
9328
|
+
toast.error("Credits Issue", {
|
|
9329
|
+
description: error.message,
|
|
9330
|
+
duration: 8e3
|
|
9331
|
+
});
|
|
9332
|
+
} else {
|
|
9333
|
+
toast.error("Tone adjustment failed", {
|
|
9334
|
+
description: error instanceof Error ? error.message : "An error occurred"
|
|
9335
|
+
});
|
|
9336
|
+
}
|
|
9193
9337
|
return false;
|
|
9194
9338
|
}
|
|
9195
9339
|
};
|
|
@@ -9599,16 +9743,16 @@ function CopyButton({ editor, getCodeDOMNode }) {
|
|
|
9599
9743
|
}
|
|
9600
9744
|
const index$6 = "";
|
|
9601
9745
|
const PRETTIER_PARSER_MODULES = {
|
|
9602
|
-
css: [() => import("./postcss-
|
|
9603
|
-
html: [() => import("./html-
|
|
9746
|
+
css: [() => import("./postcss-c2592f3f.js")],
|
|
9747
|
+
html: [() => import("./html-f95ee5dc.js")],
|
|
9604
9748
|
js: [
|
|
9605
|
-
() => import("./babel-
|
|
9606
|
-
() => import("./estree-
|
|
9749
|
+
() => import("./babel-d155920e.js"),
|
|
9750
|
+
() => import("./estree-b1fff53b.js")
|
|
9607
9751
|
],
|
|
9608
|
-
markdown: [() => import("./markdown-
|
|
9752
|
+
markdown: [() => import("./markdown-1d9e6c3f.js")],
|
|
9609
9753
|
typescript: [
|
|
9610
|
-
() => import("./typescript-
|
|
9611
|
-
() => import("./estree-
|
|
9754
|
+
() => import("./typescript-48c10f50.js"),
|
|
9755
|
+
() => import("./estree-b1fff53b.js")
|
|
9612
9756
|
]
|
|
9613
9757
|
};
|
|
9614
9758
|
async function loadPrettierParserByLang(lang) {
|
|
@@ -9619,7 +9763,7 @@ async function loadPrettierParserByLang(lang) {
|
|
|
9619
9763
|
return modules;
|
|
9620
9764
|
}
|
|
9621
9765
|
async function loadPrettierFormat() {
|
|
9622
|
-
const { format } = await import("./standalone-
|
|
9766
|
+
const { format } = await import("./standalone-bcc7f37a.js");
|
|
9623
9767
|
return format;
|
|
9624
9768
|
}
|
|
9625
9769
|
const PRETTIER_OPTIONS_BY_LANG = {
|
|
@@ -10096,199 +10240,6 @@ function $createCommentedTextNode(text, commentId, commentText, commentAuthor, c
|
|
|
10096
10240
|
function $isCommentedTextNode(node) {
|
|
10097
10241
|
return node instanceof CommentedTextNode;
|
|
10098
10242
|
}
|
|
10099
|
-
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
10100
|
-
let defaultContexts = [];
|
|
10101
|
-
function createContext3(rootComponentName, defaultContext) {
|
|
10102
|
-
const BaseContext = React$1.createContext(defaultContext);
|
|
10103
|
-
BaseContext.displayName = rootComponentName + "Context";
|
|
10104
|
-
const index2 = defaultContexts.length;
|
|
10105
|
-
defaultContexts = [...defaultContexts, defaultContext];
|
|
10106
|
-
const Provider2 = (props) => {
|
|
10107
|
-
var _a;
|
|
10108
|
-
const { scope, children, ...context } = props;
|
|
10109
|
-
const Context2 = ((_a = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a[index2]) || BaseContext;
|
|
10110
|
-
const value = React$1.useMemo(() => context, Object.values(context));
|
|
10111
|
-
return /* @__PURE__ */ jsx(Context2.Provider, { value, children });
|
|
10112
|
-
};
|
|
10113
|
-
Provider2.displayName = rootComponentName + "Provider";
|
|
10114
|
-
function useContext2(consumerName, scope) {
|
|
10115
|
-
var _a;
|
|
10116
|
-
const Context2 = ((_a = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a[index2]) || BaseContext;
|
|
10117
|
-
const context = React$1.useContext(Context2);
|
|
10118
|
-
if (context)
|
|
10119
|
-
return context;
|
|
10120
|
-
if (defaultContext !== void 0)
|
|
10121
|
-
return defaultContext;
|
|
10122
|
-
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
10123
|
-
}
|
|
10124
|
-
return [Provider2, useContext2];
|
|
10125
|
-
}
|
|
10126
|
-
const createScope = () => {
|
|
10127
|
-
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
10128
|
-
return React$1.createContext(defaultContext);
|
|
10129
|
-
});
|
|
10130
|
-
return function useScope(scope) {
|
|
10131
|
-
const contexts = (scope == null ? void 0 : scope[scopeName]) || scopeContexts;
|
|
10132
|
-
return React$1.useMemo(
|
|
10133
|
-
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
10134
|
-
[scope, contexts]
|
|
10135
|
-
);
|
|
10136
|
-
};
|
|
10137
|
-
};
|
|
10138
|
-
createScope.scopeName = scopeName;
|
|
10139
|
-
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
10140
|
-
}
|
|
10141
|
-
function composeContextScopes(...scopes) {
|
|
10142
|
-
const baseScope = scopes[0];
|
|
10143
|
-
if (scopes.length === 1)
|
|
10144
|
-
return baseScope;
|
|
10145
|
-
const createScope = () => {
|
|
10146
|
-
const scopeHooks = scopes.map((createScope2) => ({
|
|
10147
|
-
useScope: createScope2(),
|
|
10148
|
-
scopeName: createScope2.scopeName
|
|
10149
|
-
}));
|
|
10150
|
-
return function useComposedScopes(overrideScopes) {
|
|
10151
|
-
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
10152
|
-
const scopeProps = useScope(overrideScopes);
|
|
10153
|
-
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
10154
|
-
return { ...nextScopes2, ...currentScope };
|
|
10155
|
-
}, {});
|
|
10156
|
-
return React$1.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
10157
|
-
};
|
|
10158
|
-
};
|
|
10159
|
-
createScope.scopeName = baseScope.scopeName;
|
|
10160
|
-
return createScope;
|
|
10161
|
-
}
|
|
10162
|
-
var REACT_LAZY_TYPE$1 = Symbol.for("react.lazy");
|
|
10163
|
-
var use$1 = React$1[" use ".trim().toString()];
|
|
10164
|
-
function isPromiseLike$1(value) {
|
|
10165
|
-
return typeof value === "object" && value !== null && "then" in value;
|
|
10166
|
-
}
|
|
10167
|
-
function isLazyComponent$1(element) {
|
|
10168
|
-
return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE$1 && "_payload" in element && isPromiseLike$1(element._payload);
|
|
10169
|
-
}
|
|
10170
|
-
// @__NO_SIDE_EFFECTS__
|
|
10171
|
-
function createSlot$1(ownerName) {
|
|
10172
|
-
const SlotClone = /* @__PURE__ */ createSlotClone$1(ownerName);
|
|
10173
|
-
const Slot2 = React$1.forwardRef((props, forwardedRef) => {
|
|
10174
|
-
let { children, ...slotProps } = props;
|
|
10175
|
-
if (isLazyComponent$1(children) && typeof use$1 === "function") {
|
|
10176
|
-
children = use$1(children._payload);
|
|
10177
|
-
}
|
|
10178
|
-
const childrenArray = React$1.Children.toArray(children);
|
|
10179
|
-
const slottable = childrenArray.find(isSlottable$1);
|
|
10180
|
-
if (slottable) {
|
|
10181
|
-
const newElement = slottable.props.children;
|
|
10182
|
-
const newChildren = childrenArray.map((child) => {
|
|
10183
|
-
if (child === slottable) {
|
|
10184
|
-
if (React$1.Children.count(newElement) > 1)
|
|
10185
|
-
return React$1.Children.only(null);
|
|
10186
|
-
return React$1.isValidElement(newElement) ? newElement.props.children : null;
|
|
10187
|
-
} else {
|
|
10188
|
-
return child;
|
|
10189
|
-
}
|
|
10190
|
-
});
|
|
10191
|
-
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React$1.isValidElement(newElement) ? React$1.cloneElement(newElement, void 0, newChildren) : null });
|
|
10192
|
-
}
|
|
10193
|
-
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
10194
|
-
});
|
|
10195
|
-
Slot2.displayName = `${ownerName}.Slot`;
|
|
10196
|
-
return Slot2;
|
|
10197
|
-
}
|
|
10198
|
-
// @__NO_SIDE_EFFECTS__
|
|
10199
|
-
function createSlotClone$1(ownerName) {
|
|
10200
|
-
const SlotClone = React$1.forwardRef((props, forwardedRef) => {
|
|
10201
|
-
let { children, ...slotProps } = props;
|
|
10202
|
-
if (isLazyComponent$1(children) && typeof use$1 === "function") {
|
|
10203
|
-
children = use$1(children._payload);
|
|
10204
|
-
}
|
|
10205
|
-
if (React$1.isValidElement(children)) {
|
|
10206
|
-
const childrenRef = getElementRef$1(children);
|
|
10207
|
-
const props2 = mergeProps$1(slotProps, children.props);
|
|
10208
|
-
if (children.type !== React$1.Fragment) {
|
|
10209
|
-
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
10210
|
-
}
|
|
10211
|
-
return React$1.cloneElement(children, props2);
|
|
10212
|
-
}
|
|
10213
|
-
return React$1.Children.count(children) > 1 ? React$1.Children.only(null) : null;
|
|
10214
|
-
});
|
|
10215
|
-
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
10216
|
-
return SlotClone;
|
|
10217
|
-
}
|
|
10218
|
-
var SLOTTABLE_IDENTIFIER$1 = Symbol("radix.slottable");
|
|
10219
|
-
function isSlottable$1(child) {
|
|
10220
|
-
return React$1.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$1;
|
|
10221
|
-
}
|
|
10222
|
-
function mergeProps$1(slotProps, childProps) {
|
|
10223
|
-
const overrideProps = { ...childProps };
|
|
10224
|
-
for (const propName in childProps) {
|
|
10225
|
-
const slotPropValue = slotProps[propName];
|
|
10226
|
-
const childPropValue = childProps[propName];
|
|
10227
|
-
const isHandler = /^on[A-Z]/.test(propName);
|
|
10228
|
-
if (isHandler) {
|
|
10229
|
-
if (slotPropValue && childPropValue) {
|
|
10230
|
-
overrideProps[propName] = (...args) => {
|
|
10231
|
-
const result = childPropValue(...args);
|
|
10232
|
-
slotPropValue(...args);
|
|
10233
|
-
return result;
|
|
10234
|
-
};
|
|
10235
|
-
} else if (slotPropValue) {
|
|
10236
|
-
overrideProps[propName] = slotPropValue;
|
|
10237
|
-
}
|
|
10238
|
-
} else if (propName === "style") {
|
|
10239
|
-
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
10240
|
-
} else if (propName === "className") {
|
|
10241
|
-
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
10242
|
-
}
|
|
10243
|
-
}
|
|
10244
|
-
return { ...slotProps, ...overrideProps };
|
|
10245
|
-
}
|
|
10246
|
-
function getElementRef$1(element) {
|
|
10247
|
-
var _a, _b;
|
|
10248
|
-
let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
|
|
10249
|
-
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
10250
|
-
if (mayWarn) {
|
|
10251
|
-
return element.ref;
|
|
10252
|
-
}
|
|
10253
|
-
getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
|
|
10254
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
10255
|
-
if (mayWarn) {
|
|
10256
|
-
return element.props.ref;
|
|
10257
|
-
}
|
|
10258
|
-
return element.props.ref || element.ref;
|
|
10259
|
-
}
|
|
10260
|
-
var NODES$1 = [
|
|
10261
|
-
"a",
|
|
10262
|
-
"button",
|
|
10263
|
-
"div",
|
|
10264
|
-
"form",
|
|
10265
|
-
"h2",
|
|
10266
|
-
"h3",
|
|
10267
|
-
"img",
|
|
10268
|
-
"input",
|
|
10269
|
-
"label",
|
|
10270
|
-
"li",
|
|
10271
|
-
"nav",
|
|
10272
|
-
"ol",
|
|
10273
|
-
"p",
|
|
10274
|
-
"select",
|
|
10275
|
-
"span",
|
|
10276
|
-
"svg",
|
|
10277
|
-
"ul"
|
|
10278
|
-
];
|
|
10279
|
-
var Primitive$1 = NODES$1.reduce((primitive, node) => {
|
|
10280
|
-
const Slot2 = /* @__PURE__ */ createSlot$1(`Primitive.${node}`);
|
|
10281
|
-
const Node2 = React$1.forwardRef((props, forwardedRef) => {
|
|
10282
|
-
const { asChild, ...primitiveProps } = props;
|
|
10283
|
-
const Comp = asChild ? Slot2 : node;
|
|
10284
|
-
if (typeof window !== "undefined") {
|
|
10285
|
-
window[Symbol.for("radix-ui")] = true;
|
|
10286
|
-
}
|
|
10287
|
-
return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
10288
|
-
});
|
|
10289
|
-
Node2.displayName = `Primitive.${node}`;
|
|
10290
|
-
return { ...primitive, [node]: Node2 };
|
|
10291
|
-
}, {});
|
|
10292
10243
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
10293
10244
|
function getDefaultExportFromCjs(x2) {
|
|
10294
10245
|
return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
|
|
@@ -10374,7 +10325,7 @@ var Avatar$1 = React$1.forwardRef(
|
|
|
10374
10325
|
scope: __scopeAvatar,
|
|
10375
10326
|
imageLoadingStatus,
|
|
10376
10327
|
onImageLoadingStatusChange: setImageLoadingStatus,
|
|
10377
|
-
children: /* @__PURE__ */ jsx(Primitive
|
|
10328
|
+
children: /* @__PURE__ */ jsx(Primitive.span, { ...avatarProps, ref: forwardedRef })
|
|
10378
10329
|
}
|
|
10379
10330
|
);
|
|
10380
10331
|
}
|
|
@@ -10396,7 +10347,7 @@ var AvatarImage$1 = React$1.forwardRef(
|
|
|
10396
10347
|
handleLoadingStatusChange(imageLoadingStatus);
|
|
10397
10348
|
}
|
|
10398
10349
|
}, [imageLoadingStatus, handleLoadingStatusChange]);
|
|
10399
|
-
return imageLoadingStatus === "loaded" ? /* @__PURE__ */ jsx(Primitive
|
|
10350
|
+
return imageLoadingStatus === "loaded" ? /* @__PURE__ */ jsx(Primitive.img, { ...imageProps, ref: forwardedRef, src }) : null;
|
|
10400
10351
|
}
|
|
10401
10352
|
);
|
|
10402
10353
|
AvatarImage$1.displayName = IMAGE_NAME;
|
|
@@ -10412,7 +10363,7 @@ var AvatarFallback$1 = React$1.forwardRef(
|
|
|
10412
10363
|
return () => window.clearTimeout(timerId);
|
|
10413
10364
|
}
|
|
10414
10365
|
}, [delayMs]);
|
|
10415
|
-
return canRender && context.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ jsx(Primitive
|
|
10366
|
+
return canRender && context.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ jsx(Primitive.span, { ...fallbackProps, ref: forwardedRef }) : null;
|
|
10416
10367
|
}
|
|
10417
10368
|
);
|
|
10418
10369
|
AvatarFallback$1.displayName = FALLBACK_NAME;
|
|
@@ -10557,136 +10508,6 @@ const CardFooter = React$1.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
10557
10508
|
}
|
|
10558
10509
|
));
|
|
10559
10510
|
CardFooter.displayName = "CardFooter";
|
|
10560
|
-
var REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
10561
|
-
var use = React$1[" use ".trim().toString()];
|
|
10562
|
-
function isPromiseLike(value) {
|
|
10563
|
-
return typeof value === "object" && value !== null && "then" in value;
|
|
10564
|
-
}
|
|
10565
|
-
function isLazyComponent(element) {
|
|
10566
|
-
return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike(element._payload);
|
|
10567
|
-
}
|
|
10568
|
-
// @__NO_SIDE_EFFECTS__
|
|
10569
|
-
function createSlot(ownerName) {
|
|
10570
|
-
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
10571
|
-
const Slot2 = React$1.forwardRef((props, forwardedRef) => {
|
|
10572
|
-
let { children, ...slotProps } = props;
|
|
10573
|
-
if (isLazyComponent(children) && typeof use === "function") {
|
|
10574
|
-
children = use(children._payload);
|
|
10575
|
-
}
|
|
10576
|
-
const childrenArray = React$1.Children.toArray(children);
|
|
10577
|
-
const slottable = childrenArray.find(isSlottable);
|
|
10578
|
-
if (slottable) {
|
|
10579
|
-
const newElement = slottable.props.children;
|
|
10580
|
-
const newChildren = childrenArray.map((child) => {
|
|
10581
|
-
if (child === slottable) {
|
|
10582
|
-
if (React$1.Children.count(newElement) > 1)
|
|
10583
|
-
return React$1.Children.only(null);
|
|
10584
|
-
return React$1.isValidElement(newElement) ? newElement.props.children : null;
|
|
10585
|
-
} else {
|
|
10586
|
-
return child;
|
|
10587
|
-
}
|
|
10588
|
-
});
|
|
10589
|
-
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React$1.isValidElement(newElement) ? React$1.cloneElement(newElement, void 0, newChildren) : null });
|
|
10590
|
-
}
|
|
10591
|
-
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
10592
|
-
});
|
|
10593
|
-
Slot2.displayName = `${ownerName}.Slot`;
|
|
10594
|
-
return Slot2;
|
|
10595
|
-
}
|
|
10596
|
-
// @__NO_SIDE_EFFECTS__
|
|
10597
|
-
function createSlotClone(ownerName) {
|
|
10598
|
-
const SlotClone = React$1.forwardRef((props, forwardedRef) => {
|
|
10599
|
-
let { children, ...slotProps } = props;
|
|
10600
|
-
if (isLazyComponent(children) && typeof use === "function") {
|
|
10601
|
-
children = use(children._payload);
|
|
10602
|
-
}
|
|
10603
|
-
if (React$1.isValidElement(children)) {
|
|
10604
|
-
const childrenRef = getElementRef(children);
|
|
10605
|
-
const props2 = mergeProps(slotProps, children.props);
|
|
10606
|
-
if (children.type !== React$1.Fragment) {
|
|
10607
|
-
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
10608
|
-
}
|
|
10609
|
-
return React$1.cloneElement(children, props2);
|
|
10610
|
-
}
|
|
10611
|
-
return React$1.Children.count(children) > 1 ? React$1.Children.only(null) : null;
|
|
10612
|
-
});
|
|
10613
|
-
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
10614
|
-
return SlotClone;
|
|
10615
|
-
}
|
|
10616
|
-
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
10617
|
-
function isSlottable(child) {
|
|
10618
|
-
return React$1.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
10619
|
-
}
|
|
10620
|
-
function mergeProps(slotProps, childProps) {
|
|
10621
|
-
const overrideProps = { ...childProps };
|
|
10622
|
-
for (const propName in childProps) {
|
|
10623
|
-
const slotPropValue = slotProps[propName];
|
|
10624
|
-
const childPropValue = childProps[propName];
|
|
10625
|
-
const isHandler = /^on[A-Z]/.test(propName);
|
|
10626
|
-
if (isHandler) {
|
|
10627
|
-
if (slotPropValue && childPropValue) {
|
|
10628
|
-
overrideProps[propName] = (...args) => {
|
|
10629
|
-
const result = childPropValue(...args);
|
|
10630
|
-
slotPropValue(...args);
|
|
10631
|
-
return result;
|
|
10632
|
-
};
|
|
10633
|
-
} else if (slotPropValue) {
|
|
10634
|
-
overrideProps[propName] = slotPropValue;
|
|
10635
|
-
}
|
|
10636
|
-
} else if (propName === "style") {
|
|
10637
|
-
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
10638
|
-
} else if (propName === "className") {
|
|
10639
|
-
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
10640
|
-
}
|
|
10641
|
-
}
|
|
10642
|
-
return { ...slotProps, ...overrideProps };
|
|
10643
|
-
}
|
|
10644
|
-
function getElementRef(element) {
|
|
10645
|
-
var _a, _b;
|
|
10646
|
-
let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
|
|
10647
|
-
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
10648
|
-
if (mayWarn) {
|
|
10649
|
-
return element.ref;
|
|
10650
|
-
}
|
|
10651
|
-
getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
|
|
10652
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
10653
|
-
if (mayWarn) {
|
|
10654
|
-
return element.props.ref;
|
|
10655
|
-
}
|
|
10656
|
-
return element.props.ref || element.ref;
|
|
10657
|
-
}
|
|
10658
|
-
var NODES = [
|
|
10659
|
-
"a",
|
|
10660
|
-
"button",
|
|
10661
|
-
"div",
|
|
10662
|
-
"form",
|
|
10663
|
-
"h2",
|
|
10664
|
-
"h3",
|
|
10665
|
-
"img",
|
|
10666
|
-
"input",
|
|
10667
|
-
"label",
|
|
10668
|
-
"li",
|
|
10669
|
-
"nav",
|
|
10670
|
-
"ol",
|
|
10671
|
-
"p",
|
|
10672
|
-
"select",
|
|
10673
|
-
"span",
|
|
10674
|
-
"svg",
|
|
10675
|
-
"ul"
|
|
10676
|
-
];
|
|
10677
|
-
var Primitive = NODES.reduce((primitive, node) => {
|
|
10678
|
-
const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
10679
|
-
const Node2 = React$1.forwardRef((props, forwardedRef) => {
|
|
10680
|
-
const { asChild, ...primitiveProps } = props;
|
|
10681
|
-
const Comp = asChild ? Slot2 : node;
|
|
10682
|
-
if (typeof window !== "undefined") {
|
|
10683
|
-
window[Symbol.for("radix-ui")] = true;
|
|
10684
|
-
}
|
|
10685
|
-
return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
10686
|
-
});
|
|
10687
|
-
Node2.displayName = `Primitive.${node}`;
|
|
10688
|
-
return { ...primitive, [node]: Node2 };
|
|
10689
|
-
}, {});
|
|
10690
10511
|
var NAME$3 = "Separator";
|
|
10691
10512
|
var DEFAULT_ORIENTATION = "horizontal";
|
|
10692
10513
|
var ORIENTATIONS = ["horizontal", "vertical"];
|
|
@@ -10813,7 +10634,7 @@ const SheetDescription = React$1.forwardRef(({ className, ...props }, ref) => /*
|
|
|
10813
10634
|
SheetDescription.displayName = Description.displayName;
|
|
10814
10635
|
function createCollection(name) {
|
|
10815
10636
|
const PROVIDER_NAME2 = name + "CollectionProvider";
|
|
10816
|
-
const [createCollectionContext, createCollectionScope2] = createContextScope
|
|
10637
|
+
const [createCollectionContext, createCollectionScope2] = createContextScope(PROVIDER_NAME2);
|
|
10817
10638
|
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
|
|
10818
10639
|
PROVIDER_NAME2,
|
|
10819
10640
|
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
@@ -10826,7 +10647,7 @@ function createCollection(name) {
|
|
|
10826
10647
|
};
|
|
10827
10648
|
CollectionProvider.displayName = PROVIDER_NAME2;
|
|
10828
10649
|
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
10829
|
-
const CollectionSlotImpl = /* @__PURE__ */ createSlot
|
|
10650
|
+
const CollectionSlotImpl = /* @__PURE__ */ createSlot(COLLECTION_SLOT_NAME);
|
|
10830
10651
|
const CollectionSlot = React__default.forwardRef(
|
|
10831
10652
|
(props, forwardedRef) => {
|
|
10832
10653
|
const { scope, children } = props;
|
|
@@ -10838,7 +10659,7 @@ function createCollection(name) {
|
|
|
10838
10659
|
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
|
|
10839
10660
|
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
|
|
10840
10661
|
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
|
10841
|
-
const CollectionItemSlotImpl = /* @__PURE__ */ createSlot
|
|
10662
|
+
const CollectionItemSlotImpl = /* @__PURE__ */ createSlot(ITEM_SLOT_NAME);
|
|
10842
10663
|
const CollectionItemSlot = React__default.forwardRef(
|
|
10843
10664
|
(props, forwardedRef) => {
|
|
10844
10665
|
const { scope, children, ...itemData } = props;
|
|
@@ -10883,7 +10704,7 @@ var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
|
|
|
10883
10704
|
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
10884
10705
|
var GROUP_NAME$3 = "RovingFocusGroup";
|
|
10885
10706
|
var [Collection$2, useCollection$2, createCollectionScope$2] = createCollection(GROUP_NAME$3);
|
|
10886
|
-
var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope
|
|
10707
|
+
var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope(
|
|
10887
10708
|
GROUP_NAME$3,
|
|
10888
10709
|
[createCollectionScope$2]
|
|
10889
10710
|
);
|
|
@@ -10950,7 +10771,7 @@ var RovingFocusGroupImpl = React$1.forwardRef((props, forwardedRef) => {
|
|
|
10950
10771
|
[]
|
|
10951
10772
|
),
|
|
10952
10773
|
children: /* @__PURE__ */ jsx(
|
|
10953
|
-
Primitive
|
|
10774
|
+
Primitive.div,
|
|
10954
10775
|
{
|
|
10955
10776
|
tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
|
|
10956
10777
|
"data-orientation": orientation,
|
|
@@ -11015,7 +10836,7 @@ var RovingFocusGroupItem = React$1.forwardRef(
|
|
|
11015
10836
|
focusable,
|
|
11016
10837
|
active,
|
|
11017
10838
|
children: /* @__PURE__ */ jsx(
|
|
11018
|
-
Primitive
|
|
10839
|
+
Primitive.span,
|
|
11019
10840
|
{
|
|
11020
10841
|
tabIndex: isCurrentTabStop ? 0 : -1,
|
|
11021
10842
|
"data-orientation": context.orientation,
|
|
@@ -11100,7 +10921,7 @@ function wrapArray$2(array, startIndex) {
|
|
|
11100
10921
|
var Root$2 = RovingFocusGroup;
|
|
11101
10922
|
var Item$1 = RovingFocusGroupItem;
|
|
11102
10923
|
var TABS_NAME = "Tabs";
|
|
11103
|
-
var [createTabsContext, createTabsScope] = createContextScope
|
|
10924
|
+
var [createTabsContext, createTabsScope] = createContextScope(TABS_NAME, [
|
|
11104
10925
|
createRovingFocusGroupScope
|
|
11105
10926
|
]);
|
|
11106
10927
|
var useRovingFocusGroupScope$1 = createRovingFocusGroupScope();
|
|
@@ -11135,7 +10956,7 @@ var Tabs$1 = React$1.forwardRef(
|
|
|
11135
10956
|
dir: direction,
|
|
11136
10957
|
activationMode,
|
|
11137
10958
|
children: /* @__PURE__ */ jsx(
|
|
11138
|
-
Primitive
|
|
10959
|
+
Primitive.div,
|
|
11139
10960
|
{
|
|
11140
10961
|
dir: direction,
|
|
11141
10962
|
"data-orientation": orientation,
|
|
@@ -11163,7 +10984,7 @@ var TabsList$1 = React$1.forwardRef(
|
|
|
11163
10984
|
dir: context.dir,
|
|
11164
10985
|
loop,
|
|
11165
10986
|
children: /* @__PURE__ */ jsx(
|
|
11166
|
-
Primitive
|
|
10987
|
+
Primitive.div,
|
|
11167
10988
|
{
|
|
11168
10989
|
role: "tablist",
|
|
11169
10990
|
"aria-orientation": context.orientation,
|
|
@@ -11193,7 +11014,7 @@ var TabsTrigger$1 = React$1.forwardRef(
|
|
|
11193
11014
|
focusable: !disabled,
|
|
11194
11015
|
active: isSelected,
|
|
11195
11016
|
children: /* @__PURE__ */ jsx(
|
|
11196
|
-
Primitive
|
|
11017
|
+
Primitive.button,
|
|
11197
11018
|
{
|
|
11198
11019
|
type: "button",
|
|
11199
11020
|
role: "tab",
|
|
@@ -11243,7 +11064,7 @@ var TabsContent$1 = React$1.forwardRef(
|
|
|
11243
11064
|
return () => cancelAnimationFrame(rAF);
|
|
11244
11065
|
}, []);
|
|
11245
11066
|
return /* @__PURE__ */ jsx(Presence, { present: forceMount || isSelected, children: ({ present }) => /* @__PURE__ */ jsx(
|
|
11246
|
-
Primitive
|
|
11067
|
+
Primitive.div,
|
|
11247
11068
|
{
|
|
11248
11069
|
"data-state": isSelected ? "active" : "inactive",
|
|
11249
11070
|
"data-orientation": context.orientation,
|
|
@@ -13665,7 +13486,7 @@ var NAME$2 = "Arrow";
|
|
|
13665
13486
|
var Arrow$1 = React$1.forwardRef((props, forwardedRef) => {
|
|
13666
13487
|
const { children, width = 10, height = 5, ...arrowProps } = props;
|
|
13667
13488
|
return /* @__PURE__ */ jsx(
|
|
13668
|
-
Primitive
|
|
13489
|
+
Primitive.svg,
|
|
13669
13490
|
{
|
|
13670
13491
|
...arrowProps,
|
|
13671
13492
|
ref: forwardedRef,
|
|
@@ -13714,7 +13535,7 @@ function useSize(element) {
|
|
|
13714
13535
|
return size2;
|
|
13715
13536
|
}
|
|
13716
13537
|
var POPPER_NAME = "Popper";
|
|
13717
|
-
var [createPopperContext, createPopperScope] = createContextScope
|
|
13538
|
+
var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
|
|
13718
13539
|
var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
|
|
13719
13540
|
var Popper = (props) => {
|
|
13720
13541
|
const { __scopePopper, children } = props;
|
|
@@ -13737,7 +13558,7 @@ var PopperAnchor = React$1.forwardRef(
|
|
|
13737
13558
|
context.onAnchorChange(anchorRef.current);
|
|
13738
13559
|
}
|
|
13739
13560
|
});
|
|
13740
|
-
return virtualRef ? null : /* @__PURE__ */ jsx(Primitive
|
|
13561
|
+
return virtualRef ? null : /* @__PURE__ */ jsx(Primitive.div, { ...anchorProps, ref: composedRefs });
|
|
13741
13562
|
}
|
|
13742
13563
|
);
|
|
13743
13564
|
PopperAnchor.displayName = ANCHOR_NAME$2;
|
|
@@ -13866,7 +13687,7 @@ var PopperContent = React$1.forwardRef(
|
|
|
13866
13687
|
arrowY,
|
|
13867
13688
|
shouldHideArrow: cannotCenterArrow,
|
|
13868
13689
|
children: /* @__PURE__ */ jsx(
|
|
13869
|
-
Primitive
|
|
13690
|
+
Primitive.div,
|
|
13870
13691
|
{
|
|
13871
13692
|
"data-side": placedSide,
|
|
13872
13693
|
"data-align": placedAlign,
|
|
@@ -14002,7 +13823,7 @@ var NAME$1 = "VisuallyHidden";
|
|
|
14002
13823
|
var VisuallyHidden = React$1.forwardRef(
|
|
14003
13824
|
(props, forwardedRef) => {
|
|
14004
13825
|
return /* @__PURE__ */ jsx(
|
|
14005
|
-
Primitive
|
|
13826
|
+
Primitive.span,
|
|
14006
13827
|
{
|
|
14007
13828
|
...props,
|
|
14008
13829
|
ref: forwardedRef,
|
|
@@ -14013,7 +13834,7 @@ var VisuallyHidden = React$1.forwardRef(
|
|
|
14013
13834
|
);
|
|
14014
13835
|
VisuallyHidden.displayName = NAME$1;
|
|
14015
13836
|
var Root = VisuallyHidden;
|
|
14016
|
-
var [createTooltipContext, createTooltipScope] = createContextScope
|
|
13837
|
+
var [createTooltipContext, createTooltipScope] = createContextScope("Tooltip", [
|
|
14017
13838
|
createPopperScope
|
|
14018
13839
|
]);
|
|
14019
13840
|
var usePopperScope$3 = createPopperScope();
|
|
@@ -14174,7 +13995,7 @@ var TooltipTrigger$1 = React$1.forwardRef(
|
|
|
14174
13995
|
return () => document.removeEventListener("pointerup", handlePointerUp);
|
|
14175
13996
|
}, [handlePointerUp]);
|
|
14176
13997
|
return /* @__PURE__ */ jsx(Anchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsx(
|
|
14177
|
-
Primitive
|
|
13998
|
+
Primitive.button,
|
|
14178
13999
|
{
|
|
14179
14000
|
"aria-describedby": context.open ? context.contentId : void 0,
|
|
14180
14001
|
"data-state": context.stateAttribute,
|
|
@@ -15224,7 +15045,7 @@ const HtmlViewDisplay = () => {
|
|
|
15224
15045
|
onBlur: handleTextareaBlur,
|
|
15225
15046
|
onClick: handleTextareaClick,
|
|
15226
15047
|
onKeyDown: handleTextareaKeyDown,
|
|
15227
|
-
className: " cteditor-w-full cteditor-flex-1\n cteditor-font-mono cteditor-text-[13px] \n cteditor-p-3 \n cteditor-border cteditor-rounded-lg \n cteditor-resize-y cteditor-leading-[1.4] \n cteditor-outline-none cteditor-transition-colors cteditor-duration-200 \n cteditor-whitespace-pre-wrap cteditor-break-words\n dark:cteditor-text-background\n cteditor-text-foreground\n cteditor-bg-foreground/5\n",
|
|
15048
|
+
className: " cteditor-w-full cteditor-flex-1\r\n cteditor-font-mono cteditor-text-[13px] \r\n cteditor-p-3 \r\n cteditor-border cteditor-rounded-lg \r\n cteditor-resize-y cteditor-leading-[1.4] \r\n cteditor-outline-none cteditor-transition-colors cteditor-duration-200 \r\n cteditor-whitespace-pre-wrap cteditor-break-words\r\n dark:cteditor-text-background\r\n cteditor-text-foreground\r\n cteditor-bg-foreground/5\r\n",
|
|
15228
15049
|
placeholder: "HTML content will appear here... Edit and click 'Sync to Editor' to apply changes."
|
|
15229
15050
|
}
|
|
15230
15051
|
)
|
|
@@ -16430,7 +16251,7 @@ const EmbedComponent = ({ url, displayType, alignment, width: initialWidth, heig
|
|
|
16430
16251
|
}
|
|
16431
16252
|
);
|
|
16432
16253
|
};
|
|
16433
|
-
const FileComponent = React$1.lazy(() => import("./index-
|
|
16254
|
+
const FileComponent = React$1.lazy(() => import("./index-4ea49f5b.js"));
|
|
16434
16255
|
function convertFileElement(domNode) {
|
|
16435
16256
|
if (domNode instanceof HTMLDivElement) {
|
|
16436
16257
|
const dataUrl = domNode.getAttribute("data-lexical-file-src");
|
|
@@ -16913,7 +16734,7 @@ var OPEN_KEYS = [" ", "Enter", "ArrowUp", "ArrowDown"];
|
|
|
16913
16734
|
var SELECTION_KEYS$1 = [" ", "Enter"];
|
|
16914
16735
|
var SELECT_NAME = "Select";
|
|
16915
16736
|
var [Collection$1, useCollection$1, createCollectionScope$1] = createCollection(SELECT_NAME);
|
|
16916
|
-
var [createSelectContext, createSelectScope] = createContextScope
|
|
16737
|
+
var [createSelectContext, createSelectScope] = createContextScope(SELECT_NAME, [
|
|
16917
16738
|
createCollectionScope$1,
|
|
16918
16739
|
createPopperScope
|
|
16919
16740
|
]);
|
|
@@ -17050,7 +16871,7 @@ var SelectTrigger$1 = React$1.forwardRef(
|
|
|
17050
16871
|
}
|
|
17051
16872
|
};
|
|
17052
16873
|
return /* @__PURE__ */ jsx(Anchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsx(
|
|
17053
|
-
Primitive
|
|
16874
|
+
Primitive.button,
|
|
17054
16875
|
{
|
|
17055
16876
|
type: "button",
|
|
17056
16877
|
role: "combobox",
|
|
@@ -17111,7 +16932,7 @@ var SelectValue$1 = React$1.forwardRef(
|
|
|
17111
16932
|
onValueNodeHasChildrenChange(hasChildren);
|
|
17112
16933
|
}, [onValueNodeHasChildrenChange, hasChildren]);
|
|
17113
16934
|
return /* @__PURE__ */ jsx(
|
|
17114
|
-
Primitive
|
|
16935
|
+
Primitive.span,
|
|
17115
16936
|
{
|
|
17116
16937
|
...valueProps,
|
|
17117
16938
|
ref: composedRefs,
|
|
@@ -17126,7 +16947,7 @@ var ICON_NAME = "SelectIcon";
|
|
|
17126
16947
|
var SelectIcon = React$1.forwardRef(
|
|
17127
16948
|
(props, forwardedRef) => {
|
|
17128
16949
|
const { __scopeSelect, children, ...iconProps } = props;
|
|
17129
|
-
return /* @__PURE__ */ jsx(Primitive
|
|
16950
|
+
return /* @__PURE__ */ jsx(Primitive.span, { "aria-hidden": true, ...iconProps, ref: forwardedRef, children: children || "▼" });
|
|
17130
16951
|
}
|
|
17131
16952
|
);
|
|
17132
16953
|
SelectIcon.displayName = ICON_NAME;
|
|
@@ -17157,7 +16978,7 @@ SelectContent$1.displayName = CONTENT_NAME$3;
|
|
|
17157
16978
|
var CONTENT_MARGIN = 10;
|
|
17158
16979
|
var [SelectContentProvider, useSelectContentContext] = createSelectContext(CONTENT_NAME$3);
|
|
17159
16980
|
var CONTENT_IMPL_NAME = "SelectContentImpl";
|
|
17160
|
-
var Slot$2 = /* @__PURE__ */ createSlot
|
|
16981
|
+
var Slot$2 = /* @__PURE__ */ createSlot("SelectContent.RemoveScroll");
|
|
17161
16982
|
var SelectContentImpl = React$1.forwardRef(
|
|
17162
16983
|
(props, forwardedRef) => {
|
|
17163
16984
|
const {
|
|
@@ -17546,7 +17367,7 @@ var SelectItemAlignedPosition = React$1.forwardRef((props, forwardedRef) => {
|
|
|
17546
17367
|
zIndex: contentZIndex
|
|
17547
17368
|
},
|
|
17548
17369
|
children: /* @__PURE__ */ jsx(
|
|
17549
|
-
Primitive
|
|
17370
|
+
Primitive.div,
|
|
17550
17371
|
{
|
|
17551
17372
|
...popperProps,
|
|
17552
17373
|
ref: composedRefs,
|
|
@@ -17620,7 +17441,7 @@ var SelectViewport = React$1.forwardRef(
|
|
|
17620
17441
|
}
|
|
17621
17442
|
),
|
|
17622
17443
|
/* @__PURE__ */ jsx(Collection$1.Slot, { scope: __scopeSelect, children: /* @__PURE__ */ jsx(
|
|
17623
|
-
Primitive
|
|
17444
|
+
Primitive.div,
|
|
17624
17445
|
{
|
|
17625
17446
|
"data-radix-select-viewport": "",
|
|
17626
17447
|
role: "presentation",
|
|
@@ -17675,7 +17496,7 @@ var SelectGroup = React$1.forwardRef(
|
|
|
17675
17496
|
(props, forwardedRef) => {
|
|
17676
17497
|
const { __scopeSelect, ...groupProps } = props;
|
|
17677
17498
|
const groupId = useId();
|
|
17678
|
-
return /* @__PURE__ */ jsx(SelectGroupContextProvider, { scope: __scopeSelect, id: groupId, children: /* @__PURE__ */ jsx(Primitive
|
|
17499
|
+
return /* @__PURE__ */ jsx(SelectGroupContextProvider, { scope: __scopeSelect, id: groupId, children: /* @__PURE__ */ jsx(Primitive.div, { role: "group", "aria-labelledby": groupId, ...groupProps, ref: forwardedRef }) });
|
|
17679
17500
|
}
|
|
17680
17501
|
);
|
|
17681
17502
|
SelectGroup.displayName = GROUP_NAME$2;
|
|
@@ -17684,7 +17505,7 @@ var SelectLabel$1 = React$1.forwardRef(
|
|
|
17684
17505
|
(props, forwardedRef) => {
|
|
17685
17506
|
const { __scopeSelect, ...labelProps } = props;
|
|
17686
17507
|
const groupContext = useSelectGroupContext(LABEL_NAME$2, __scopeSelect);
|
|
17687
|
-
return /* @__PURE__ */ jsx(Primitive
|
|
17508
|
+
return /* @__PURE__ */ jsx(Primitive.div, { id: groupContext.id, ...labelProps, ref: forwardedRef });
|
|
17688
17509
|
}
|
|
17689
17510
|
);
|
|
17690
17511
|
SelectLabel$1.displayName = LABEL_NAME$2;
|
|
@@ -17743,7 +17564,7 @@ var SelectItem$1 = React$1.forwardRef(
|
|
|
17743
17564
|
disabled,
|
|
17744
17565
|
textValue,
|
|
17745
17566
|
children: /* @__PURE__ */ jsx(
|
|
17746
|
-
Primitive
|
|
17567
|
+
Primitive.div,
|
|
17747
17568
|
{
|
|
17748
17569
|
role: "option",
|
|
17749
17570
|
"aria-labelledby": textId,
|
|
@@ -17831,7 +17652,7 @@ var SelectItemText = React$1.forwardRef(
|
|
|
17831
17652
|
return () => onNativeOptionRemove(nativeOption);
|
|
17832
17653
|
}, [onNativeOptionAdd, onNativeOptionRemove, nativeOption]);
|
|
17833
17654
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
17834
|
-
/* @__PURE__ */ jsx(Primitive
|
|
17655
|
+
/* @__PURE__ */ jsx(Primitive.span, { id: itemContext.textId, ...itemTextProps, ref: composedRefs }),
|
|
17835
17656
|
itemContext.isSelected && context.valueNode && !context.valueNodeHasChildren ? ReactDOM.createPortal(itemTextProps.children, context.valueNode) : null
|
|
17836
17657
|
] });
|
|
17837
17658
|
}
|
|
@@ -17842,7 +17663,7 @@ var SelectItemIndicator = React$1.forwardRef(
|
|
|
17842
17663
|
(props, forwardedRef) => {
|
|
17843
17664
|
const { __scopeSelect, ...itemIndicatorProps } = props;
|
|
17844
17665
|
const itemContext = useSelectItemContext(ITEM_INDICATOR_NAME$1, __scopeSelect);
|
|
17845
|
-
return itemContext.isSelected ? /* @__PURE__ */ jsx(Primitive
|
|
17666
|
+
return itemContext.isSelected ? /* @__PURE__ */ jsx(Primitive.span, { "aria-hidden": true, ...itemIndicatorProps, ref: forwardedRef }) : null;
|
|
17846
17667
|
}
|
|
17847
17668
|
);
|
|
17848
17669
|
SelectItemIndicator.displayName = ITEM_INDICATOR_NAME$1;
|
|
@@ -17933,7 +17754,7 @@ var SelectScrollButtonImpl = React$1.forwardRef((props, forwardedRef) => {
|
|
|
17933
17754
|
(_a = activeItem == null ? void 0 : activeItem.ref.current) == null ? void 0 : _a.scrollIntoView({ block: "nearest" });
|
|
17934
17755
|
}, [getItems]);
|
|
17935
17756
|
return /* @__PURE__ */ jsx(
|
|
17936
|
-
Primitive
|
|
17757
|
+
Primitive.div,
|
|
17937
17758
|
{
|
|
17938
17759
|
"aria-hidden": true,
|
|
17939
17760
|
...scrollIndicatorProps,
|
|
@@ -17961,7 +17782,7 @@ var SEPARATOR_NAME$2 = "SelectSeparator";
|
|
|
17961
17782
|
var SelectSeparator$1 = React$1.forwardRef(
|
|
17962
17783
|
(props, forwardedRef) => {
|
|
17963
17784
|
const { __scopeSelect, ...separatorProps } = props;
|
|
17964
|
-
return /* @__PURE__ */ jsx(Primitive
|
|
17785
|
+
return /* @__PURE__ */ jsx(Primitive.div, { "aria-hidden": true, ...separatorProps, ref: forwardedRef });
|
|
17965
17786
|
}
|
|
17966
17787
|
);
|
|
17967
17788
|
SelectSeparator$1.displayName = SEPARATOR_NAME$2;
|
|
@@ -17999,7 +17820,7 @@ var SelectBubbleInput = React$1.forwardRef(
|
|
|
17999
17820
|
}
|
|
18000
17821
|
}, [prevValue, value]);
|
|
18001
17822
|
return /* @__PURE__ */ jsx(
|
|
18002
|
-
Primitive
|
|
17823
|
+
Primitive.select,
|
|
18003
17824
|
{
|
|
18004
17825
|
...props,
|
|
18005
17826
|
style: { ...VISUALLY_HIDDEN_STYLES, ...props.style },
|
|
@@ -19388,7 +19209,7 @@ const useEditorToolbar = () => {
|
|
|
19388
19209
|
clearFormatting
|
|
19389
19210
|
};
|
|
19390
19211
|
};
|
|
19391
|
-
class
|
|
19212
|
+
class ApiKeyRequiredError2 extends Error {
|
|
19392
19213
|
constructor(message, code) {
|
|
19393
19214
|
super(message);
|
|
19394
19215
|
__publicField(this, "code");
|
|
@@ -19412,7 +19233,7 @@ const getAssemblyAIToken = async (apiKey) => {
|
|
|
19412
19233
|
if (responseData) {
|
|
19413
19234
|
const { code, message } = responseData;
|
|
19414
19235
|
if (code === "API_KEYS_REQUIRED" || code === "ASSEMBLYAI_KEY_REQUIRED" || code === "NO_API_KEYS_CONFIGURED") {
|
|
19415
|
-
throw new
|
|
19236
|
+
throw new ApiKeyRequiredError2(message || "API key configuration required", code);
|
|
19416
19237
|
}
|
|
19417
19238
|
if (code === "INSUFFICIENT_CREDITS") {
|
|
19418
19239
|
throw new Error("Insufficient credits for voice transcription. Please purchase more credits.");
|
|
@@ -19430,7 +19251,7 @@ const getAssemblyAIToken = async (apiKey) => {
|
|
|
19430
19251
|
throw error;
|
|
19431
19252
|
}
|
|
19432
19253
|
};
|
|
19433
|
-
class
|
|
19254
|
+
class CreditError2 extends Error {
|
|
19434
19255
|
constructor(message, code) {
|
|
19435
19256
|
super(message);
|
|
19436
19257
|
__publicField(this, "code");
|
|
@@ -19450,7 +19271,7 @@ const endVoiceSession = async (durationSeconds, apiKey) => {
|
|
|
19450
19271
|
});
|
|
19451
19272
|
const data = res.data;
|
|
19452
19273
|
if (data.credits && !data.credits.success) {
|
|
19453
|
-
throw new
|
|
19274
|
+
throw new CreditError2(
|
|
19454
19275
|
data.message || "Credit deduction failed",
|
|
19455
19276
|
data.code || data.credits.error || "CREDIT_DEDUCTION_FAILED"
|
|
19456
19277
|
);
|
|
@@ -19462,10 +19283,10 @@ const endVoiceSession = async (durationSeconds, apiKey) => {
|
|
|
19462
19283
|
if (responseData) {
|
|
19463
19284
|
const { code, message } = responseData;
|
|
19464
19285
|
if (code === "INSUFFICIENT_CREDITS") {
|
|
19465
|
-
throw new
|
|
19286
|
+
throw new CreditError2("Insufficient credits. Please purchase more credits.", code);
|
|
19466
19287
|
}
|
|
19467
19288
|
if (code === "CREDIT_DEDUCTION_FAILED") {
|
|
19468
|
-
throw new
|
|
19289
|
+
throw new CreditError2(message || "Failed to deduct credits", code);
|
|
19469
19290
|
}
|
|
19470
19291
|
if (message) {
|
|
19471
19292
|
throw new Error(message);
|
|
@@ -19611,7 +19432,7 @@ const useVoiceToText = ({ onTranscriptUpdate, onSessionEnd, apiKey }) => {
|
|
|
19611
19432
|
}
|
|
19612
19433
|
setIsRecording(true);
|
|
19613
19434
|
} catch (err) {
|
|
19614
|
-
if (err instanceof
|
|
19435
|
+
if (err instanceof ApiKeyRequiredError2) {
|
|
19615
19436
|
toast.error("API Key Required", {
|
|
19616
19437
|
description: "Please upload your AssemblyAI key in License Section > Manage API keys > API Keys to configure your keys.",
|
|
19617
19438
|
duration: 5e3
|
|
@@ -19721,7 +19542,7 @@ const useVoiceToText = ({ onTranscriptUpdate, onSessionEnd, apiKey }) => {
|
|
|
19721
19542
|
}
|
|
19722
19543
|
} catch (error2) {
|
|
19723
19544
|
console.error("Failed to end voice session:", error2);
|
|
19724
|
-
if (error2 instanceof
|
|
19545
|
+
if (error2 instanceof CreditError2) {
|
|
19725
19546
|
toast.error("Credit Error", {
|
|
19726
19547
|
description: error2.message,
|
|
19727
19548
|
duration: 5e3
|
|
@@ -19758,7 +19579,8 @@ function AIChatDialog({
|
|
|
19758
19579
|
apiKey,
|
|
19759
19580
|
initialText,
|
|
19760
19581
|
onShowInEditor,
|
|
19761
|
-
selectedTextForInline
|
|
19582
|
+
selectedTextForInline,
|
|
19583
|
+
savedSelection
|
|
19762
19584
|
}) {
|
|
19763
19585
|
const [inputValue, setInputValue] = useState$1("");
|
|
19764
19586
|
const [selectedText, setSelectedText] = useState$1("");
|
|
@@ -19852,6 +19674,7 @@ function AIChatDialog({
|
|
|
19852
19674
|
const isImageRequest = isImageGenerationRequest(inputValue);
|
|
19853
19675
|
let finalPrompt;
|
|
19854
19676
|
const hasSelectedText = selectedText && selectedText.trim() !== "";
|
|
19677
|
+
const userTextLength = inputValue.length + (hasSelectedText ? selectedText.length : 0);
|
|
19855
19678
|
if (isImageRequest) {
|
|
19856
19679
|
if (hasSelectedText) {
|
|
19857
19680
|
finalPrompt = `${inputValue}: ${selectedText}`;
|
|
@@ -19869,29 +19692,140 @@ Text to transform:
|
|
|
19869
19692
|
finalPrompt = inputValue;
|
|
19870
19693
|
}
|
|
19871
19694
|
try {
|
|
19872
|
-
|
|
19873
|
-
|
|
19874
|
-
|
|
19875
|
-
|
|
19876
|
-
|
|
19877
|
-
|
|
19878
|
-
|
|
19879
|
-
|
|
19880
|
-
|
|
19881
|
-
|
|
19882
|
-
|
|
19883
|
-
|
|
19884
|
-
|
|
19885
|
-
editor.update(() => {
|
|
19886
|
-
const nodes = $generateNodesFromDOM(editor, dom);
|
|
19887
|
-
const currentSelection = $getSelection();
|
|
19888
|
-
if (currentSelection) {
|
|
19889
|
-
$insertNodes(nodes);
|
|
19695
|
+
let isFirstChunk = true;
|
|
19696
|
+
let selectionInfo = null;
|
|
19697
|
+
if (savedSelection && $isRangeSelection(savedSelection)) {
|
|
19698
|
+
selectionInfo = {
|
|
19699
|
+
anchor: {
|
|
19700
|
+
key: savedSelection.anchor.key,
|
|
19701
|
+
offset: savedSelection.anchor.offset,
|
|
19702
|
+
type: savedSelection.anchor.type
|
|
19703
|
+
},
|
|
19704
|
+
focus: {
|
|
19705
|
+
key: savedSelection.focus.key,
|
|
19706
|
+
offset: savedSelection.focus.offset,
|
|
19707
|
+
type: savedSelection.focus.type
|
|
19890
19708
|
}
|
|
19891
|
-
}
|
|
19709
|
+
};
|
|
19892
19710
|
}
|
|
19893
|
-
|
|
19894
|
-
|
|
19711
|
+
await AiEditorActionStream({
|
|
19712
|
+
content: finalPrompt,
|
|
19713
|
+
provider,
|
|
19714
|
+
apiKey,
|
|
19715
|
+
userTextLength,
|
|
19716
|
+
onChunk: (chunk) => {
|
|
19717
|
+
editor.focus();
|
|
19718
|
+
editor.update(() => {
|
|
19719
|
+
if (isFirstChunk) {
|
|
19720
|
+
isFirstChunk = false;
|
|
19721
|
+
if (selectionInfo) {
|
|
19722
|
+
try {
|
|
19723
|
+
const newSelection = $getSelection();
|
|
19724
|
+
if (newSelection && $isRangeSelection(newSelection)) {
|
|
19725
|
+
newSelection.anchor.set(selectionInfo.anchor.key, selectionInfo.anchor.offset, selectionInfo.anchor.type);
|
|
19726
|
+
newSelection.focus.set(selectionInfo.focus.key, selectionInfo.focus.offset, selectionInfo.focus.type);
|
|
19727
|
+
const selText = newSelection.getTextContent();
|
|
19728
|
+
if (selText && selText.trim()) {
|
|
19729
|
+
newSelection.insertText("");
|
|
19730
|
+
}
|
|
19731
|
+
}
|
|
19732
|
+
} catch (e) {
|
|
19733
|
+
console.warn("Could not restore selection", e);
|
|
19734
|
+
const root2 = $getRoot();
|
|
19735
|
+
const lastChild = root2.getLastChild();
|
|
19736
|
+
if (lastChild) {
|
|
19737
|
+
lastChild.selectEnd();
|
|
19738
|
+
}
|
|
19739
|
+
}
|
|
19740
|
+
} else {
|
|
19741
|
+
const root2 = $getRoot();
|
|
19742
|
+
const lastChild = root2.getLastChild();
|
|
19743
|
+
if (lastChild) {
|
|
19744
|
+
lastChild.selectEnd();
|
|
19745
|
+
} else {
|
|
19746
|
+
const paragraph = $createParagraphNode();
|
|
19747
|
+
root2.append(paragraph);
|
|
19748
|
+
paragraph.select();
|
|
19749
|
+
}
|
|
19750
|
+
}
|
|
19751
|
+
}
|
|
19752
|
+
const selection = $getSelection();
|
|
19753
|
+
if (selection && $isRangeSelection(selection)) {
|
|
19754
|
+
selection.insertText(chunk);
|
|
19755
|
+
} else {
|
|
19756
|
+
const root2 = $getRoot();
|
|
19757
|
+
const lastChild = root2.getLastChild();
|
|
19758
|
+
if (lastChild) {
|
|
19759
|
+
lastChild.selectEnd();
|
|
19760
|
+
const newSelection = $getSelection();
|
|
19761
|
+
if (newSelection && $isRangeSelection(newSelection)) {
|
|
19762
|
+
newSelection.insertText(chunk);
|
|
19763
|
+
}
|
|
19764
|
+
}
|
|
19765
|
+
}
|
|
19766
|
+
});
|
|
19767
|
+
},
|
|
19768
|
+
onComplete: (fullContent, metadata) => {
|
|
19769
|
+
if (metadata == null ? void 0 : metadata.isImage) {
|
|
19770
|
+
const parser = new DOMParser();
|
|
19771
|
+
const dom = parser.parseFromString(fullContent.trim(), "text/html");
|
|
19772
|
+
const imgElement = dom.querySelector("img");
|
|
19773
|
+
if (imgElement && imgElement.src) {
|
|
19774
|
+
editor.dispatchCommand(INSERT_IMAGE_COMMAND, {
|
|
19775
|
+
src: imgElement.src,
|
|
19776
|
+
altText: imgElement.alt || "AI generated image",
|
|
19777
|
+
originalPrompt: inputValue
|
|
19778
|
+
});
|
|
19779
|
+
}
|
|
19780
|
+
handleClose();
|
|
19781
|
+
setIsLoading(false);
|
|
19782
|
+
return;
|
|
19783
|
+
} else if (metadata == null ? void 0 : metadata.isChart) {
|
|
19784
|
+
let dom;
|
|
19785
|
+
try {
|
|
19786
|
+
const chartData = JSON.parse(fullContent);
|
|
19787
|
+
const parser = new DOMParser();
|
|
19788
|
+
dom = parser.parseFromString(chartData.html || fullContent, "text/html");
|
|
19789
|
+
} catch {
|
|
19790
|
+
const parser = new DOMParser();
|
|
19791
|
+
dom = parser.parseFromString(fullContent.trim(), "text/html");
|
|
19792
|
+
}
|
|
19793
|
+
editor.update(
|
|
19794
|
+
() => {
|
|
19795
|
+
const nodes = $generateNodesFromDOM(editor, dom);
|
|
19796
|
+
if (savedSelection) {
|
|
19797
|
+
$setSelection(savedSelection.clone());
|
|
19798
|
+
}
|
|
19799
|
+
const currentSelection = $getSelection();
|
|
19800
|
+
if (currentSelection) {
|
|
19801
|
+
$insertNodes(nodes);
|
|
19802
|
+
} else {
|
|
19803
|
+
const root2 = $getRoot();
|
|
19804
|
+
root2.append(...nodes);
|
|
19805
|
+
}
|
|
19806
|
+
},
|
|
19807
|
+
{
|
|
19808
|
+
onUpdate: () => {
|
|
19809
|
+
handleClose();
|
|
19810
|
+
setIsLoading(false);
|
|
19811
|
+
}
|
|
19812
|
+
}
|
|
19813
|
+
);
|
|
19814
|
+
return;
|
|
19815
|
+
} else {
|
|
19816
|
+
handleClose();
|
|
19817
|
+
setIsLoading(false);
|
|
19818
|
+
return;
|
|
19819
|
+
}
|
|
19820
|
+
},
|
|
19821
|
+
onError: (error) => {
|
|
19822
|
+
console.error("Error processing AI action:", error);
|
|
19823
|
+
const safeMessage = error.message || "Error processing your request. Please try again.";
|
|
19824
|
+
setErrorMessage(safeMessage);
|
|
19825
|
+
toast.error(safeMessage);
|
|
19826
|
+
setIsLoading(false);
|
|
19827
|
+
}
|
|
19828
|
+
});
|
|
19895
19829
|
} catch (error) {
|
|
19896
19830
|
console.error("Error processing AI action:", error);
|
|
19897
19831
|
const errorCode = (_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.code;
|
|
@@ -20162,7 +20096,16 @@ function InlineAIPrompt({
|
|
|
20162
20096
|
const [status, setStatus] = useState$1("idle");
|
|
20163
20097
|
const [showMessage, setShowMessage] = useState$1(true);
|
|
20164
20098
|
const inputRef = useRef(null);
|
|
20099
|
+
const savedSelectionRef = useRef(null);
|
|
20165
20100
|
const [selectedText, setSelectedText] = useState$1(initialSelectedText);
|
|
20101
|
+
useEffect$1(() => {
|
|
20102
|
+
editor.getEditorState().read(() => {
|
|
20103
|
+
const selection = $getSelection();
|
|
20104
|
+
if (selection) {
|
|
20105
|
+
savedSelectionRef.current = selection.clone();
|
|
20106
|
+
}
|
|
20107
|
+
});
|
|
20108
|
+
}, [editor]);
|
|
20166
20109
|
useEffect$1(() => {
|
|
20167
20110
|
const unregister = editor.registerUpdateListener(({ editorState }) => {
|
|
20168
20111
|
editorState.read(() => {
|
|
@@ -20216,6 +20159,7 @@ function InlineAIPrompt({
|
|
|
20216
20159
|
setIsLoading(true);
|
|
20217
20160
|
const isImageRequest = isImageGenerationRequest(inputValue) || selectedText && isImageGenerationRequest(selectedText);
|
|
20218
20161
|
const hasSelectedText2 = selectedText && selectedText.trim() !== "";
|
|
20162
|
+
const userTextLength = inputValue.length + (hasSelectedText2 ? selectedText.length : 0);
|
|
20219
20163
|
let finalPrompt;
|
|
20220
20164
|
if (isImageRequest) {
|
|
20221
20165
|
if (hasSelectedText2) {
|
|
@@ -20234,37 +20178,149 @@ Text to transform:
|
|
|
20234
20178
|
finalPrompt = inputValue;
|
|
20235
20179
|
}
|
|
20236
20180
|
try {
|
|
20237
|
-
|
|
20238
|
-
let
|
|
20239
|
-
if (
|
|
20240
|
-
|
|
20241
|
-
|
|
20242
|
-
|
|
20243
|
-
|
|
20244
|
-
|
|
20245
|
-
|
|
20246
|
-
|
|
20247
|
-
|
|
20248
|
-
|
|
20249
|
-
|
|
20250
|
-
src: imgElement.src,
|
|
20251
|
-
altText: imgElement.alt || "AI generated image",
|
|
20252
|
-
originalPrompt: finalPrompt
|
|
20253
|
-
// Store the prompt for refinement
|
|
20254
|
-
});
|
|
20255
|
-
} else {
|
|
20256
|
-
editor.update(() => {
|
|
20257
|
-
const nodes = $generateNodesFromDOM(editor, dom);
|
|
20258
|
-
const currentSelection = $getSelection();
|
|
20259
|
-
if (currentSelection) {
|
|
20260
|
-
$insertNodes(nodes);
|
|
20181
|
+
let isFirstChunk = true;
|
|
20182
|
+
let selectionInfo = null;
|
|
20183
|
+
if (savedSelectionRef.current && $isRangeSelection(savedSelectionRef.current)) {
|
|
20184
|
+
selectionInfo = {
|
|
20185
|
+
anchor: {
|
|
20186
|
+
key: savedSelectionRef.current.anchor.key,
|
|
20187
|
+
offset: savedSelectionRef.current.anchor.offset,
|
|
20188
|
+
type: savedSelectionRef.current.anchor.type
|
|
20189
|
+
},
|
|
20190
|
+
focus: {
|
|
20191
|
+
key: savedSelectionRef.current.focus.key,
|
|
20192
|
+
offset: savedSelectionRef.current.focus.offset,
|
|
20193
|
+
type: savedSelectionRef.current.focus.type
|
|
20261
20194
|
}
|
|
20262
|
-
}
|
|
20195
|
+
};
|
|
20263
20196
|
}
|
|
20264
|
-
|
|
20265
|
-
|
|
20266
|
-
|
|
20267
|
-
|
|
20197
|
+
await AiEditorActionStream({
|
|
20198
|
+
content: finalPrompt,
|
|
20199
|
+
provider,
|
|
20200
|
+
apiKey,
|
|
20201
|
+
userTextLength,
|
|
20202
|
+
onChunk: (chunk) => {
|
|
20203
|
+
editor.focus();
|
|
20204
|
+
editor.update(() => {
|
|
20205
|
+
if (isFirstChunk) {
|
|
20206
|
+
isFirstChunk = false;
|
|
20207
|
+
if (selectionInfo) {
|
|
20208
|
+
try {
|
|
20209
|
+
const newSelection = $getSelection();
|
|
20210
|
+
if (newSelection && $isRangeSelection(newSelection)) {
|
|
20211
|
+
newSelection.anchor.set(selectionInfo.anchor.key, selectionInfo.anchor.offset, selectionInfo.anchor.type);
|
|
20212
|
+
newSelection.focus.set(selectionInfo.focus.key, selectionInfo.focus.offset, selectionInfo.focus.type);
|
|
20213
|
+
const selText = newSelection.getTextContent();
|
|
20214
|
+
if (selText && selText.trim()) {
|
|
20215
|
+
newSelection.insertText("");
|
|
20216
|
+
}
|
|
20217
|
+
}
|
|
20218
|
+
} catch (e) {
|
|
20219
|
+
console.warn("Could not restore selection", e);
|
|
20220
|
+
const root2 = $getRoot();
|
|
20221
|
+
const lastChild = root2.getLastChild();
|
|
20222
|
+
if (lastChild) {
|
|
20223
|
+
lastChild.selectEnd();
|
|
20224
|
+
}
|
|
20225
|
+
}
|
|
20226
|
+
} else {
|
|
20227
|
+
const root2 = $getRoot();
|
|
20228
|
+
const lastChild = root2.getLastChild();
|
|
20229
|
+
if (lastChild) {
|
|
20230
|
+
lastChild.selectEnd();
|
|
20231
|
+
} else {
|
|
20232
|
+
const paragraph = $createParagraphNode();
|
|
20233
|
+
root2.append(paragraph);
|
|
20234
|
+
paragraph.select();
|
|
20235
|
+
}
|
|
20236
|
+
}
|
|
20237
|
+
}
|
|
20238
|
+
const selection = $getSelection();
|
|
20239
|
+
if (selection && $isRangeSelection(selection)) {
|
|
20240
|
+
selection.insertText(chunk);
|
|
20241
|
+
} else {
|
|
20242
|
+
const root2 = $getRoot();
|
|
20243
|
+
const lastChild = root2.getLastChild();
|
|
20244
|
+
if (lastChild) {
|
|
20245
|
+
lastChild.selectEnd();
|
|
20246
|
+
const newSelection = $getSelection();
|
|
20247
|
+
if (newSelection && $isRangeSelection(newSelection)) {
|
|
20248
|
+
newSelection.insertText(chunk);
|
|
20249
|
+
}
|
|
20250
|
+
}
|
|
20251
|
+
}
|
|
20252
|
+
});
|
|
20253
|
+
},
|
|
20254
|
+
onComplete: (fullContent, metadata) => {
|
|
20255
|
+
if (metadata == null ? void 0 : metadata.isImage) {
|
|
20256
|
+
const parser = new DOMParser();
|
|
20257
|
+
const dom = parser.parseFromString(fullContent.trim(), "text/html");
|
|
20258
|
+
const imgElement = dom.querySelector("img");
|
|
20259
|
+
if (imgElement && imgElement.src) {
|
|
20260
|
+
editor.dispatchCommand(INSERT_IMAGE_COMMAND, {
|
|
20261
|
+
src: imgElement.src,
|
|
20262
|
+
altText: imgElement.alt || "AI generated image",
|
|
20263
|
+
originalPrompt: finalPrompt
|
|
20264
|
+
});
|
|
20265
|
+
}
|
|
20266
|
+
setInputValue("");
|
|
20267
|
+
setSelectedText("");
|
|
20268
|
+
setStatus("success");
|
|
20269
|
+
setShowMessage(true);
|
|
20270
|
+
setIsLoading(false);
|
|
20271
|
+
return;
|
|
20272
|
+
} else if (metadata == null ? void 0 : metadata.isChart) {
|
|
20273
|
+
let dom;
|
|
20274
|
+
try {
|
|
20275
|
+
const chartData = JSON.parse(fullContent);
|
|
20276
|
+
const parser = new DOMParser();
|
|
20277
|
+
dom = parser.parseFromString(chartData.html || fullContent, "text/html");
|
|
20278
|
+
} catch {
|
|
20279
|
+
const parser = new DOMParser();
|
|
20280
|
+
dom = parser.parseFromString(fullContent.trim(), "text/html");
|
|
20281
|
+
}
|
|
20282
|
+
editor.update(
|
|
20283
|
+
() => {
|
|
20284
|
+
const nodes = $generateNodesFromDOM(editor, dom);
|
|
20285
|
+
if (savedSelectionRef.current) {
|
|
20286
|
+
$setSelection(savedSelectionRef.current.clone());
|
|
20287
|
+
}
|
|
20288
|
+
const currentSelection = $getSelection();
|
|
20289
|
+
if (currentSelection) {
|
|
20290
|
+
$insertNodes(nodes);
|
|
20291
|
+
} else {
|
|
20292
|
+
const root2 = $getRoot();
|
|
20293
|
+
root2.append(...nodes);
|
|
20294
|
+
}
|
|
20295
|
+
},
|
|
20296
|
+
{
|
|
20297
|
+
onUpdate: () => {
|
|
20298
|
+
setInputValue("");
|
|
20299
|
+
setSelectedText("");
|
|
20300
|
+
setStatus("success");
|
|
20301
|
+
setShowMessage(true);
|
|
20302
|
+
setIsLoading(false);
|
|
20303
|
+
}
|
|
20304
|
+
}
|
|
20305
|
+
);
|
|
20306
|
+
return;
|
|
20307
|
+
} else {
|
|
20308
|
+
setInputValue("");
|
|
20309
|
+
setSelectedText("");
|
|
20310
|
+
setStatus("success");
|
|
20311
|
+
setShowMessage(true);
|
|
20312
|
+
setIsLoading(false);
|
|
20313
|
+
return;
|
|
20314
|
+
}
|
|
20315
|
+
},
|
|
20316
|
+
onError: (error) => {
|
|
20317
|
+
console.error("Error processing AI action:", error);
|
|
20318
|
+
toast.error(error.message || "Error processing your request. Please try again.");
|
|
20319
|
+
setStatus("error");
|
|
20320
|
+
setShowMessage(true);
|
|
20321
|
+
setIsLoading(false);
|
|
20322
|
+
}
|
|
20323
|
+
});
|
|
20268
20324
|
} catch (error) {
|
|
20269
20325
|
console.error("Error processing AI action:", error);
|
|
20270
20326
|
const errorCode = (_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.code;
|
|
@@ -20276,7 +20332,6 @@ Text to transform:
|
|
|
20276
20332
|
toast.error(safeMessage);
|
|
20277
20333
|
setStatus("error");
|
|
20278
20334
|
setShowMessage(true);
|
|
20279
|
-
} finally {
|
|
20280
20335
|
setIsLoading(false);
|
|
20281
20336
|
}
|
|
20282
20337
|
};
|
|
@@ -20982,7 +21037,7 @@ const useVoiceRecording = (apiKey) => {
|
|
|
20982
21037
|
setIsRecording(true);
|
|
20983
21038
|
updateCursorStyle(true);
|
|
20984
21039
|
} catch (err) {
|
|
20985
|
-
if (err instanceof
|
|
21040
|
+
if (err instanceof ApiKeyRequiredError2) {
|
|
20986
21041
|
toast.error("API Key Required", {
|
|
20987
21042
|
description: "Please upload your AssemblyAI key in License Section > Manage API keys > API Keys to configure your keys.",
|
|
20988
21043
|
duration: 5e3
|
|
@@ -21087,7 +21142,7 @@ const useVoiceRecording = (apiKey) => {
|
|
|
21087
21142
|
await endVoiceSession(finalElapsedTime, apiKeyRef.current);
|
|
21088
21143
|
} catch (error2) {
|
|
21089
21144
|
console.error("Failed to end voice session:", error2);
|
|
21090
|
-
if (error2 instanceof
|
|
21145
|
+
if (error2 instanceof CreditError2) {
|
|
21091
21146
|
toast.error("Credit Error", {
|
|
21092
21147
|
description: error2.message,
|
|
21093
21148
|
duration: 5e3
|
|
@@ -21226,10 +21281,10 @@ const PDF_CONFIG = {
|
|
|
21226
21281
|
};
|
|
21227
21282
|
const loadHtml2Pdf = async () => {
|
|
21228
21283
|
try {
|
|
21229
|
-
const mod = await import("./html2pdf.bundle.min-
|
|
21284
|
+
const mod = await import("./html2pdf.bundle.min-f6392183.js").then((n) => n.h);
|
|
21230
21285
|
return (mod == null ? void 0 : mod.default) || mod;
|
|
21231
21286
|
} catch {
|
|
21232
|
-
const mod2 = await import("./html2pdf.bundle-
|
|
21287
|
+
const mod2 = await import("./html2pdf.bundle-29ea2f41.js").then((n) => n.h);
|
|
21233
21288
|
return (mod2 == null ? void 0 : mod2.default) || mod2;
|
|
21234
21289
|
}
|
|
21235
21290
|
};
|
|
@@ -21981,7 +22036,7 @@ var SUB_CLOSE_KEYS = {
|
|
|
21981
22036
|
};
|
|
21982
22037
|
var MENU_NAME = "Menu";
|
|
21983
22038
|
var [Collection, useCollection, createCollectionScope] = createCollection(MENU_NAME);
|
|
21984
|
-
var [createMenuContext, createMenuScope] = createContextScope
|
|
22039
|
+
var [createMenuContext, createMenuScope] = createContextScope(MENU_NAME, [
|
|
21985
22040
|
createCollectionScope,
|
|
21986
22041
|
createPopperScope,
|
|
21987
22042
|
createRovingFocusGroupScope
|
|
@@ -22106,7 +22161,7 @@ var MenuRootContentNonModal = React$1.forwardRef((props, forwardedRef) => {
|
|
|
22106
22161
|
}
|
|
22107
22162
|
);
|
|
22108
22163
|
});
|
|
22109
|
-
var Slot$1 = /* @__PURE__ */ createSlot
|
|
22164
|
+
var Slot$1 = /* @__PURE__ */ createSlot("MenuContent.ScrollLock");
|
|
22110
22165
|
var MenuContentImpl = React$1.forwardRef(
|
|
22111
22166
|
(props, forwardedRef) => {
|
|
22112
22167
|
const {
|
|
@@ -22308,7 +22363,7 @@ var GROUP_NAME$1 = "MenuGroup";
|
|
|
22308
22363
|
var MenuGroup = React$1.forwardRef(
|
|
22309
22364
|
(props, forwardedRef) => {
|
|
22310
22365
|
const { __scopeMenu, ...groupProps } = props;
|
|
22311
|
-
return /* @__PURE__ */ jsx(Primitive
|
|
22366
|
+
return /* @__PURE__ */ jsx(Primitive.div, { role: "group", ...groupProps, ref: forwardedRef });
|
|
22312
22367
|
}
|
|
22313
22368
|
);
|
|
22314
22369
|
MenuGroup.displayName = GROUP_NAME$1;
|
|
@@ -22316,7 +22371,7 @@ var LABEL_NAME$1 = "MenuLabel";
|
|
|
22316
22371
|
var MenuLabel = React$1.forwardRef(
|
|
22317
22372
|
(props, forwardedRef) => {
|
|
22318
22373
|
const { __scopeMenu, ...labelProps } = props;
|
|
22319
|
-
return /* @__PURE__ */ jsx(Primitive
|
|
22374
|
+
return /* @__PURE__ */ jsx(Primitive.div, { ...labelProps, ref: forwardedRef });
|
|
22320
22375
|
}
|
|
22321
22376
|
);
|
|
22322
22377
|
MenuLabel.displayName = LABEL_NAME$1;
|
|
@@ -22396,7 +22451,7 @@ var MenuItemImpl = React$1.forwardRef(
|
|
|
22396
22451
|
disabled,
|
|
22397
22452
|
textValue: textValue ?? textContent,
|
|
22398
22453
|
children: /* @__PURE__ */ jsx(Item$1, { asChild: true, ...rovingFocusGroupScope, focusable: !disabled, children: /* @__PURE__ */ jsx(
|
|
22399
|
-
Primitive
|
|
22454
|
+
Primitive.div,
|
|
22400
22455
|
{
|
|
22401
22456
|
role: "menuitem",
|
|
22402
22457
|
"data-highlighted": isFocused ? "" : void 0,
|
|
@@ -22507,7 +22562,7 @@ var MenuItemIndicator = React$1.forwardRef(
|
|
|
22507
22562
|
{
|
|
22508
22563
|
present: forceMount || isIndeterminate(indicatorContext.checked) || indicatorContext.checked === true,
|
|
22509
22564
|
children: /* @__PURE__ */ jsx(
|
|
22510
|
-
Primitive
|
|
22565
|
+
Primitive.span,
|
|
22511
22566
|
{
|
|
22512
22567
|
...itemIndicatorProps,
|
|
22513
22568
|
ref: forwardedRef,
|
|
@@ -22524,7 +22579,7 @@ var MenuSeparator = React$1.forwardRef(
|
|
|
22524
22579
|
(props, forwardedRef) => {
|
|
22525
22580
|
const { __scopeMenu, ...separatorProps } = props;
|
|
22526
22581
|
return /* @__PURE__ */ jsx(
|
|
22527
|
-
Primitive
|
|
22582
|
+
Primitive.div,
|
|
22528
22583
|
{
|
|
22529
22584
|
role: "separator",
|
|
22530
22585
|
"aria-orientation": "horizontal",
|
|
@@ -22784,7 +22839,7 @@ var Arrow2 = MenuArrow;
|
|
|
22784
22839
|
var SubTrigger = MenuSubTrigger;
|
|
22785
22840
|
var SubContent = MenuSubContent;
|
|
22786
22841
|
var DROPDOWN_MENU_NAME = "DropdownMenu";
|
|
22787
|
-
var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope
|
|
22842
|
+
var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope(
|
|
22788
22843
|
DROPDOWN_MENU_NAME,
|
|
22789
22844
|
[createMenuScope]
|
|
22790
22845
|
);
|
|
@@ -22831,7 +22886,7 @@ var DropdownMenuTrigger$1 = React$1.forwardRef(
|
|
|
22831
22886
|
const context = useDropdownMenuContext(TRIGGER_NAME$1, __scopeDropdownMenu);
|
|
22832
22887
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
22833
22888
|
return /* @__PURE__ */ jsx(Anchor2, { asChild: true, ...menuScope, children: /* @__PURE__ */ jsx(
|
|
22834
|
-
Primitive
|
|
22889
|
+
Primitive.button,
|
|
22835
22890
|
{
|
|
22836
22891
|
type: "button",
|
|
22837
22892
|
id: context.triggerId,
|
|
@@ -23170,13 +23225,13 @@ const AlignMenu = () => {
|
|
|
23170
23225
|
{
|
|
23171
23226
|
variant: "ghost",
|
|
23172
23227
|
size: "sm",
|
|
23173
|
-
className: "cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-h-7 cteditor-rounded-sm cteditor-px-2\n",
|
|
23228
|
+
className: "cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-h-7 cteditor-rounded-sm cteditor-px-2\r\n",
|
|
23174
23229
|
children: [
|
|
23175
23230
|
/* @__PURE__ */ jsx(AlignLeftIcon, {}),
|
|
23176
23231
|
/* @__PURE__ */ jsx(
|
|
23177
23232
|
ChevronDown,
|
|
23178
23233
|
{
|
|
23179
|
-
className: "!cteditor-size-4 cteditor-opacity-50\n"
|
|
23234
|
+
className: "!cteditor-size-4 cteditor-opacity-50\r\n"
|
|
23180
23235
|
}
|
|
23181
23236
|
)
|
|
23182
23237
|
]
|
|
@@ -23679,7 +23734,7 @@ var V = "undefined" != typeof window ? useLayoutEffect$1 : useEffect$1, $ = func
|
|
|
23679
23734
|
return React__default.createElement(U, u({}, r2, { colorModel: W }));
|
|
23680
23735
|
};
|
|
23681
23736
|
var POPOVER_NAME = "Popover";
|
|
23682
|
-
var [createPopoverContext, createPopoverScope] = createContextScope
|
|
23737
|
+
var [createPopoverContext, createPopoverScope] = createContextScope(POPOVER_NAME, [
|
|
23683
23738
|
createPopperScope
|
|
23684
23739
|
]);
|
|
23685
23740
|
var usePopperScope = createPopperScope();
|
|
@@ -23743,7 +23798,7 @@ var PopoverTrigger$1 = React$1.forwardRef(
|
|
|
23743
23798
|
const popperScope = usePopperScope(__scopePopover);
|
|
23744
23799
|
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
23745
23800
|
const trigger = /* @__PURE__ */ jsx(
|
|
23746
|
-
Primitive
|
|
23801
|
+
Primitive.button,
|
|
23747
23802
|
{
|
|
23748
23803
|
type: "button",
|
|
23749
23804
|
"aria-haspopup": "dialog",
|
|
@@ -23779,7 +23834,7 @@ var PopoverContent$1 = React$1.forwardRef(
|
|
|
23779
23834
|
}
|
|
23780
23835
|
);
|
|
23781
23836
|
PopoverContent$1.displayName = CONTENT_NAME;
|
|
23782
|
-
var Slot = /* @__PURE__ */ createSlot
|
|
23837
|
+
var Slot = /* @__PURE__ */ createSlot("PopoverContent.RemoveScroll");
|
|
23783
23838
|
var PopoverContentModal = React$1.forwardRef(
|
|
23784
23839
|
(props, forwardedRef) => {
|
|
23785
23840
|
const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);
|
|
@@ -23936,7 +23991,7 @@ var PopoverClose = React$1.forwardRef(
|
|
|
23936
23991
|
const { __scopePopover, ...closeProps } = props;
|
|
23937
23992
|
const context = usePopoverContext(CLOSE_NAME, __scopePopover);
|
|
23938
23993
|
return /* @__PURE__ */ jsx(
|
|
23939
|
-
Primitive
|
|
23994
|
+
Primitive.button,
|
|
23940
23995
|
{
|
|
23941
23996
|
type: "button",
|
|
23942
23997
|
...closeProps,
|
|
@@ -24151,7 +24206,7 @@ const ColorPicker$2 = ({
|
|
|
24151
24206
|
{
|
|
24152
24207
|
onMouseDown: (e) => e.preventDefault(),
|
|
24153
24208
|
onClick: () => setShowAdvanced(!showAdvanced),
|
|
24154
|
-
className: "cteditor-text-xs cteditor-text-primary/90 hover:cteditor-text-primary cteditor-transition-colors cteditor-flex cteditor-items-center cteditor-gap-2\n",
|
|
24209
|
+
className: "cteditor-text-xs cteditor-text-primary/90 hover:cteditor-text-primary cteditor-transition-colors cteditor-flex cteditor-items-center cteditor-gap-2\r\n",
|
|
24155
24210
|
children: [
|
|
24156
24211
|
/* @__PURE__ */ jsx("span", { className: "cteditor-text-xs", children: showAdvanced ? "▼" : "▶" }),
|
|
24157
24212
|
showAdvanced ? "Hide Advanced" : "Show Advanced"
|
|
@@ -31492,13 +31547,14 @@ const TextEnhancePlugin = ({ apiKey }) => {
|
|
|
31492
31547
|
const enhanceDialogRef = useRef(null);
|
|
31493
31548
|
const handleTextEnhancement = async (selectedText, userPrompt) => {
|
|
31494
31549
|
try {
|
|
31550
|
+
const userTextLength = selectedText.length + userPrompt.length;
|
|
31495
31551
|
const prompt = `Enhance the following text based on this instruction: "${userPrompt}"
|
|
31496
31552
|
|
|
31497
31553
|
Original text:
|
|
31498
31554
|
"${selectedText}"
|
|
31499
31555
|
|
|
31500
31556
|
Provide only the enhanced text without any additional explanation.`;
|
|
31501
|
-
const response = await AiTextEnhance({ content: prompt, apiKey });
|
|
31557
|
+
const response = await AiTextEnhance({ content: prompt, apiKey, userTextLength });
|
|
31502
31558
|
if (!response.data) {
|
|
31503
31559
|
throw new Error("No response received from AI");
|
|
31504
31560
|
}
|
|
@@ -37149,7 +37205,7 @@ function TableActionMenu({
|
|
|
37149
37205
|
/* @__PURE__ */ jsxs(
|
|
37150
37206
|
"div",
|
|
37151
37207
|
{
|
|
37152
|
-
className: "dropdown table-drop cteditor-z-[100]\n cteditor-flex\n cteditor-flex-col\n cteditor-fixed\n cteditor-min-h-[40px]\n cteditor-min-w-[200px]\n cteditor-p-[6px]\n cteditor-overflow-y-auto\n cteditor-overflow-x-hidden \n cteditor-shadow-xl\n cteditor-rounded-lg\n cteditor-border\n cteditor-border-border\n cteditor-bg-background \n cteditor-backdrop-blur-md\n cteditor-space-y-0.5\n ",
|
|
37208
|
+
className: "dropdown table-drop cteditor-z-[100]\r\n cteditor-flex\r\n cteditor-flex-col\r\n cteditor-fixed\r\n cteditor-min-h-[40px]\r\n cteditor-min-w-[200px]\r\n cteditor-p-[6px]\r\n cteditor-overflow-y-auto\r\n cteditor-overflow-x-hidden \r\n cteditor-shadow-xl\r\n cteditor-rounded-lg\r\n cteditor-border\r\n cteditor-border-border\r\n cteditor-bg-background \r\n cteditor-backdrop-blur-md\r\n cteditor-space-y-0.5\r\n ",
|
|
37153
37209
|
ref: dropDownRef,
|
|
37154
37210
|
onClick: (e) => {
|
|
37155
37211
|
e.stopPropagation();
|
|
@@ -39562,20 +39618,14 @@ const WordCountPlugin = () => {
|
|
|
39562
39618
|
});
|
|
39563
39619
|
});
|
|
39564
39620
|
}, [editor]);
|
|
39565
|
-
return /* @__PURE__ */ jsxs("div", { className: "cteditor-absolute cteditor-bottom-1 cteditor-right-1 cteditor-flex cteditor-
|
|
39566
|
-
/* @__PURE__ */ jsxs("
|
|
39567
|
-
|
|
39568
|
-
|
|
39569
|
-
stats.words
|
|
39570
|
-
] }),
|
|
39571
|
-
/* @__PURE__ */ jsxs("span", { children: [
|
|
39572
|
-
"Characters: ",
|
|
39573
|
-
stats.characters
|
|
39574
|
-
] })
|
|
39621
|
+
return /* @__PURE__ */ jsxs("div", { className: "cteditor-absolute cteditor-bottom-1 cteditor-right-1 cteditor-flex cteditor-gap-4 cteditor-text-xs cteditor-text-gray-600 cteditor-bg-white/90 cteditor-py-1.5 cteditor-px-3 cteditor-rounded cteditor-shadow-sm cteditor-z-[5] cteditor-pointer-events-none", children: [
|
|
39622
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
39623
|
+
"Words: ",
|
|
39624
|
+
stats.words
|
|
39575
39625
|
] }),
|
|
39576
|
-
/* @__PURE__ */ jsxs("span", {
|
|
39577
|
-
"
|
|
39578
|
-
|
|
39626
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
39627
|
+
"Characters: ",
|
|
39628
|
+
stats.characters
|
|
39579
39629
|
] })
|
|
39580
39630
|
] });
|
|
39581
39631
|
};
|
|
@@ -39942,9 +39992,7 @@ function applyGenericSafeStyles(container, codeBlockStyles) {
|
|
|
39942
39992
|
addStyleIfNotSetOnElementOrChildren(blockSelectors, "font-family", defaultFontFamily);
|
|
39943
39993
|
addStyleIfNotSet("table, p, li, td, th, div", "font-size", "16px");
|
|
39944
39994
|
addStyle("p", "margin: 0;");
|
|
39945
|
-
addStyle("p + p", "margin-top: 1em;");
|
|
39946
39995
|
addStyle("th p, td p", "margin: 0; padding: 0;");
|
|
39947
|
-
addStyle("th p + p, td p + p", "margin-top: 0;");
|
|
39948
39996
|
addStyle(
|
|
39949
39997
|
"table",
|
|
39950
39998
|
"border-collapse: collapse; width: 100%; max-width: 100%; margin: 20px 0;"
|
|
@@ -41335,11 +41383,13 @@ export {
|
|
|
41335
41383
|
$isFileNode as $,
|
|
41336
41384
|
AlignLeftIcon as A,
|
|
41337
41385
|
Button as B,
|
|
41338
|
-
|
|
41386
|
+
CreditError$1 as C,
|
|
41339
41387
|
Download as D,
|
|
41340
41388
|
ExternalLink as E,
|
|
41341
41389
|
FileText as F,
|
|
41390
|
+
useReactNativeBridge as G,
|
|
41342
41391
|
HtmlViewProvider as H,
|
|
41392
|
+
editorConfig as I,
|
|
41343
41393
|
LocalStoragePlugin$1 as L,
|
|
41344
41394
|
Sparkles as S,
|
|
41345
41395
|
Trash2 as T,
|
|
@@ -41358,16 +41408,16 @@ export {
|
|
|
41358
41408
|
AlignRightIcon as m,
|
|
41359
41409
|
Type as n,
|
|
41360
41410
|
AiJsonResponse as o,
|
|
41361
|
-
|
|
41362
|
-
|
|
41363
|
-
|
|
41364
|
-
|
|
41411
|
+
ApiKeyRequiredError$1 as p,
|
|
41412
|
+
EditorProvider as q,
|
|
41413
|
+
useEditor as r,
|
|
41414
|
+
ConfigurableEditorWithAuth as s,
|
|
41365
41415
|
toast as t,
|
|
41366
41416
|
useHtmlView as u,
|
|
41367
|
-
|
|
41368
|
-
|
|
41369
|
-
|
|
41370
|
-
|
|
41371
|
-
|
|
41417
|
+
ConfigurableEditor as v,
|
|
41418
|
+
verifyApiKey as w,
|
|
41419
|
+
LinkPreviewHover as x,
|
|
41420
|
+
ContentPreview as y,
|
|
41421
|
+
isReactNativeWebView as z
|
|
41372
41422
|
};
|
|
41373
|
-
//# sourceMappingURL=index-
|
|
41423
|
+
//# sourceMappingURL=index-636eff7f.js.map
|