eddyter 1.3.5
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/LICENSE +24 -0
- package/README.md +489 -0
- package/dist/App.d.ts +3 -0
- package/dist/Provider/EditorProvider.d.ts +32 -0
- package/dist/Provider/LexicalProvider.d.ts +6 -0
- package/dist/api/ai/index.d.ts +83 -0
- package/dist/api/analytics.d.ts +21 -0
- package/dist/api/auth.d.ts +108 -0
- package/dist/api/bugReport.d.ts +27 -0
- package/dist/api/config/axios.d.ts +2 -0
- package/dist/api/config/endpoints.d.ts +24 -0
- package/dist/api/featureSuggestion.d.ts +23 -0
- package/dist/api/feedback.d.ts +26 -0
- package/dist/api/linkPreview.d.ts +15 -0
- package/dist/api/transcript/index.d.ts +21 -0
- package/dist/assets/style.css +1 -0
- package/dist/babel-44680aef.js +7744 -0
- package/dist/components/AiPlugin/index.d.ts +6 -0
- package/dist/components/AlignMenu/AlignMenu.d.ts +9 -0
- package/dist/components/AlignMenu/AlignMenuDrop.d.ts +3 -0
- package/dist/components/AlignMenu/index.d.ts +1 -0
- package/dist/components/AutoExpandingDemo.d.ts +6 -0
- package/dist/components/BlockFormatMenu/BlockFormatMenu.d.ts +4 -0
- package/dist/components/BlockFormatMenu/constants.d.ts +14 -0
- package/dist/components/BlockFormatMenu/index.d.ts +1 -0
- package/dist/components/BugReportDialog/index.d.ts +6 -0
- package/dist/components/ChartEditDialog.d.ts +9 -0
- package/dist/components/ChartInsertDialog.d.ts +8 -0
- package/dist/components/CodeActionMenuPlugin/components/CopyButton/index.d.ts +7 -0
- package/dist/components/CodeActionMenuPlugin/components/PrettierButton/index.d.ts +9 -0
- package/dist/components/CodeActionMenuPlugin/index.d.ts +4 -0
- package/dist/components/CodeActionMenuPlugin/utils.d.ts +1 -0
- package/dist/components/ColorPicker/ColorPicker.d.ts +4 -0
- package/dist/components/ColorPicker/index.d.ts +1 -0
- package/dist/components/CommentSidebar/CommentSidebar.d.ts +8 -0
- package/dist/components/CommentSidebar/index.d.ts +1 -0
- package/dist/components/CommentToggle/CommentToggle.d.ts +8 -0
- package/dist/components/CommentToggle/index.d.ts +1 -0
- package/dist/components/CommentView/CommentView.d.ts +9 -0
- package/dist/components/CommentView/index.d.ts +1 -0
- package/dist/components/ConfigurableEditorWithAuth.d.ts +36 -0
- package/dist/components/ContentPreview/index.d.ts +37 -0
- package/dist/components/DatePicker/DatePickerWidget.d.ts +8 -0
- package/dist/components/EmojiPickerWidget/EmojiPickerWidget.d.ts +4 -0
- package/dist/components/EmojiPickerWidget/index.d.ts +1 -0
- package/dist/components/FeatureSuggestionDialog/index.d.ts +6 -0
- package/dist/components/FeedbackDialog/index.d.ts +7 -0
- package/dist/components/FileUpload/InsertFileDialog.d.ts +7 -0
- package/dist/components/FileUpload/InsertFileUploadedDialogBody.d.ts +5 -0
- package/dist/components/FileView/index.d.ts +9 -0
- package/dist/components/FontFamilySelect/FontFamilyMenu.d.ts +8 -0
- package/dist/components/FontSizePicker/FontSizeControl.d.ts +3 -0
- package/dist/components/FormatTextMenu/FormatTextMenu.d.ts +4 -0
- package/dist/components/FormatTextMenu/FormatTextMenuDrop.d.ts +4 -0
- package/dist/components/FormatTextMenu/index.d.ts +1 -0
- package/dist/components/HighlightColorPicker/HighlightColorPicker.d.ts +7 -0
- package/dist/components/HtmlViewDisplay.d.ts +3 -0
- package/dist/components/ImageComparisonDialog/index.d.ts +11 -0
- package/dist/components/ImageGenerationDialog/ImageGenerationManager.d.ts +11 -0
- package/dist/components/ImageGenerationDialog/index.d.ts +11 -0
- package/dist/components/ImageInsertTest.d.ts +3 -0
- package/dist/components/ImageView/ImageDialog/ImageUploadDialogBody.d.ts +9 -0
- package/dist/components/ImageView/ImageDialog/index.d.ts +6 -0
- package/dist/components/ImageView/ImageResizer.d.ts +16 -0
- package/dist/components/ImageView/index.d.ts +18 -0
- package/dist/components/InsertMenu/InsertMenu.d.ts +10 -0
- package/dist/components/InsertMenu/InsertMenuDrop.d.ts +10 -0
- package/dist/components/InsertMenu/index.d.ts +1 -0
- package/dist/components/LanguageSelectorDialog/index.d.ts +8 -0
- package/dist/components/LinkPreviewHover/index.d.ts +40 -0
- package/dist/components/NotePanelMenu/NotePanelMenu.d.ts +6 -0
- package/dist/components/NotePanelMenu/index.d.ts +1 -0
- package/dist/components/NotePanelView/NotePanelView.d.ts +10 -0
- package/dist/components/NotePanelView/index.d.ts +1 -0
- package/dist/components/Placeholder/Placeholder.d.ts +4 -0
- package/dist/components/Placeholder/index.d.ts +1 -0
- package/dist/components/Placeholder/styles.d.ts +1 -0
- package/dist/components/ScopedEditor.d.ts +8 -0
- package/dist/components/SignatureCaption/index.d.ts +6 -0
- package/dist/components/TableColorPicker/index.d.ts +8 -0
- package/dist/components/TableModal/TableModal.d.ts +10 -0
- package/dist/components/TextEnhanceDialog/index.d.ts +10 -0
- package/dist/components/ToneAdjustDialog/index.d.ts +8 -0
- package/dist/components/Toolbar/Toolbar.d.ts +4 -0
- package/dist/components/Toolbar/index.d.ts +1 -0
- package/dist/components/Toolbar/styles.d.ts +6 -0
- package/dist/components/VoiceTranscriptIcon/VoiceTranscriptIcon.d.ts +2 -0
- package/dist/components/VoiceTranscriptIcon/index.d.ts +1 -0
- package/dist/components/ui/avatar.d.ts +6 -0
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/components/ui/calendar.d.ts +8 -0
- package/dist/components/ui/card.d.ts +8 -0
- package/dist/components/ui/checkbox.d.ts +4 -0
- package/dist/components/ui/dialog.d.ts +19 -0
- package/dist/components/ui/dropdown-menu.d.ts +27 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/label.d.ts +5 -0
- package/dist/components/ui/popover.d.ts +7 -0
- package/dist/components/ui/select.d.ts +13 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/sheet.d.ts +25 -0
- package/dist/components/ui/skeleton.d.ts +3 -0
- package/dist/components/ui/tabs.d.ts +7 -0
- package/dist/components/ui/textarea.d.ts +3 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/constants.d.ts +40 -0
- package/dist/context/CommentContext.d.ts +43 -0
- package/dist/context/HtmlViewContext.d.ts +17 -0
- package/dist/context/ToolbarContext.d.ts +57 -0
- package/dist/editorConfig.d.ts +70 -0
- package/dist/estree-a7dc9ac5.js +4647 -0
- package/dist/hooks/useAutoExpandingHeight.d.ts +15 -0
- package/dist/hooks/useBlockFormat.d.ts +20 -0
- package/dist/hooks/useColorPicker.d.ts +6 -0
- package/dist/hooks/useCustomCommands.d.ts +3 -0
- package/dist/hooks/useDebounce.d.ts +1 -0
- package/dist/hooks/useEditorToolbar.d.ts +10 -0
- package/dist/hooks/useFeedbackEligibility.d.ts +18 -0
- package/dist/hooks/useInsertMenu.d.ts +9 -0
- package/dist/hooks/useModal.d.ts +5 -0
- package/dist/hooks/useReactNativeBridge.d.ts +54 -0
- package/dist/hooks/useS3Uploader.d.ts +21 -0
- package/dist/hooks/useVoiceToText.d.ts +20 -0
- package/dist/html-f2fcab26.js +2882 -0
- package/dist/html2pdf.bundle-e489c7ca.js +34001 -0
- package/dist/html2pdf.bundle.min-1a7f5c4e.js +21964 -0
- package/dist/index-87b1c23b.js +111 -0
- package/dist/index-8ec718de.js +1002 -0
- package/dist/index-ce18ac94.js +35387 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +46 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/main.d.ts +0 -0
- package/dist/markdown-48d2f5f1.js +3592 -0
- package/dist/nodes/ChartNode.d.ts +41 -0
- package/dist/nodes/CommentNode.d.ts +34 -0
- package/dist/nodes/CommentedTextNode.d.ts +29 -0
- package/dist/nodes/EmbedNode.d.ts +32 -0
- package/dist/nodes/FileNode.d.ts +32 -0
- package/dist/nodes/ImageNode.d.ts +65 -0
- package/dist/nodes/MentionNode.d.ts +75 -0
- package/dist/nodes/NotePanelNode.d.ts +31 -0
- package/dist/pages/ConfigurableEditor/ConfigurableEditor.d.ts +26 -0
- package/dist/pages/ConfigurableEditor/index.d.ts +2 -0
- package/dist/pages/NotFound.d.ts +2 -0
- package/dist/pages/RichTextEditor.d.ts +6 -0
- package/dist/pages/TextareaEditor.d.ts +6 -0
- package/dist/pages/styles.d.ts +5 -0
- package/dist/pcm-processor.js +50 -0
- package/dist/plugins/AIChatPlugin.d.ts +11 -0
- package/dist/plugins/AndroidKeyboardFixPlugin.d.ts +16 -0
- package/dist/plugins/AutocompletePlugin.d.ts +22 -0
- package/dist/plugins/CodeBlockNormalizerPlugin.d.ts +8 -0
- package/dist/plugins/CodeBlockSelectAllPlugin.d.ts +8 -0
- package/dist/plugins/CodeHighlightPlugin.d.ts +3 -0
- package/dist/plugins/CombinedAutocompletGrammarPlugin.d.ts +20 -0
- package/dist/plugins/CommentBubblePlugin.d.ts +3 -0
- package/dist/plugins/CommentPlugin.d.ts +8 -0
- package/dist/plugins/CustomHorizontalRulePlugin/CustomHorizontalRuleNode.d.ts +30 -0
- package/dist/plugins/CustomHorizontalRulePlugin/CustomHorizontalRulePlugin.d.ts +3 -0
- package/dist/plugins/CustomHorizontalRulePlugin/HorizontalRuleCustomizationDialog.d.ts +8 -0
- package/dist/plugins/CustomHorizontalRulePlugin/index.d.ts +3 -0
- package/dist/plugins/DragDropPastePlugin/index.d.ts +8 -0
- package/dist/plugins/EmbedPreviewPlugin/FloatingEmbedMenuPlugin.d.ts +3 -0
- package/dist/plugins/EmbedPreviewPlugin/index.d.ts +6 -0
- package/dist/plugins/FilePlugin.d.ts +8 -0
- package/dist/plugins/FloatingLinkEditorPlugin/index.d.ts +6 -0
- package/dist/plugins/FloatingTextFormatToolbarPlugin/index.d.ts +27 -0
- package/dist/plugins/GrammarCheckPlugin.d.ts +1 -0
- package/dist/plugins/HtmlCodeViewPlugin/index.d.ts +2 -0
- package/dist/plugins/HtmlImportPlugin.d.ts +5 -0
- package/dist/plugins/HtmlSyncPlugin.d.ts +3 -0
- package/dist/plugins/ImagePlugin.d.ts +9 -0
- package/dist/plugins/LinkPlugin/index.d.ts +6 -0
- package/dist/plugins/LinkPreviewPlugin/index.d.ts +4 -0
- package/dist/plugins/LocalStoragePlugin.d.ts +8 -0
- package/dist/plugins/MarkdownShortcutsPlugin/index.d.ts +20 -0
- package/dist/plugins/MentionsPlugin/index.d.ts +7 -0
- package/dist/plugins/NotePanelPlugin.d.ts +7 -0
- package/dist/plugins/PasteOptionsPlugin/index.d.ts +17 -0
- package/dist/plugins/RichTextPastePlugin/index.d.ts +6 -0
- package/dist/plugins/SignatureCanvasPlugin/SignatureCanvasDialog.d.ts +6 -0
- package/dist/plugins/SignatureCanvasPlugin/SignatureCanvasPlugin.d.ts +9 -0
- package/dist/plugins/SignatureCanvasPlugin/index.d.ts +2 -0
- package/dist/plugins/SlashCommandPlugin/index.d.ts +2 -0
- package/dist/plugins/TableActionMenuPlugin/index.d.ts +6 -0
- package/dist/plugins/TableCellResizer/index.d.ts +2 -0
- package/dist/plugins/TableHoverActionsPlugin/index.d.ts +4 -0
- package/dist/plugins/TablePlugin.d.ts +5 -0
- package/dist/plugins/Tableimageautoresizeplugin.d.ts +1 -0
- package/dist/plugins/TextEnhancePlugin.d.ts +6 -0
- package/dist/plugins/TreeViewPlugin.d.ts +3 -0
- package/dist/plugins/UsageTrackingPlugin.d.ts +15 -0
- package/dist/plugins/VoiceTranscriptPlugin.d.ts +22 -0
- package/dist/plugins/WordCountPlugin.d.ts +3 -0
- package/dist/postcss-9ac167c3.js +5172 -0
- package/dist/services/chartService.d.ts +19 -0
- package/dist/standalone-2029bc8b.js +2467 -0
- package/dist/styles/PlaygroundEditorTheme.d.ts +3 -0
- package/dist/types.d.ts +207 -0
- package/dist/typescript-bd1bb88f.js +13632 -0
- package/dist/ui/ColorPicker.d.ts +14 -0
- package/dist/ui/Icons.d.ts +80 -0
- package/dist/ui/TextInput.d.ts +11 -0
- package/dist/utils/dateFormats.d.ts +33 -0
- package/dist/utils/debounce.d.ts +6 -0
- package/dist/utils/editorStyleConverter.d.ts +17 -0
- package/dist/utils/export.d.ts +2 -0
- package/dist/utils/getDOMRangeRect.d.ts +13 -0
- package/dist/utils/getSelectedNode.d.ts +3 -0
- package/dist/utils/helper.d.ts +3 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/invarient.d.ts +1 -0
- package/dist/utils/setFloatingElemPosition.d.ts +8 -0
- package/dist/utils/setFloatingElemPositionForLinkEditor.d.ts +1 -0
- package/dist/utils/url.d.ts +9 -0
- package/dist/vite.svg +1 -0
- package/package.json +150 -0
|
@@ -0,0 +1,1002 @@
|
|
|
1
|
+
import { jsx as t, jsxs as g, Fragment as it } from "react/jsx-runtime";
|
|
2
|
+
import { CodeNode as ve } from "@lexical/code";
|
|
3
|
+
import { LinkNode as ke } from "@lexical/link";
|
|
4
|
+
import { AutoFocusPlugin as ot } from "@lexical/react/LexicalAutoFocusPlugin";
|
|
5
|
+
import { useCollaborationContext as nt } from "@lexical/react/LexicalCollaborationContext";
|
|
6
|
+
import { useLexicalComposerContext as ct } from "@lexical/react/LexicalComposerContext";
|
|
7
|
+
import { ContentEditable as Ee } from "@lexical/react/LexicalContentEditable";
|
|
8
|
+
import { LexicalErrorBoundary as Ie } from "@lexical/react/LexicalErrorBoundary";
|
|
9
|
+
import { HistoryPlugin as Pe } from "@lexical/react/LexicalHistoryPlugin";
|
|
10
|
+
import { LexicalNestedComposer as Re } from "@lexical/react/LexicalNestedComposer";
|
|
11
|
+
import { OnChangePlugin as De } from "@lexical/react/LexicalOnChangePlugin";
|
|
12
|
+
import { RichTextPlugin as ze } from "@lexical/react/LexicalRichTextPlugin";
|
|
13
|
+
import { useLexicalEditable as at } from "@lexical/react/useLexicalEditable";
|
|
14
|
+
import { useLexicalNodeSelection as st } from "@lexical/react/useLexicalNodeSelection";
|
|
15
|
+
import { calculateZoomLevel as we, mergeRegister as dt } from "@lexical/utils";
|
|
16
|
+
import { RootNode as Se, TextNode as Le, LineBreakNode as We, ParagraphNode as Ae, $getSelection as J, $isNodeSelection as X, $isParagraphNode as xe, $setSelection as ce, $isRangeSelection as lt, SELECTION_CHANGE_COMMAND as ut, COMMAND_PRIORITY_LOW as M, CLICK_COMMAND as mt, DRAGSTART_COMMAND as gt, KEY_DELETE_COMMAND as ht, KEY_BACKSPACE_COMMAND as pt, KEY_ENTER_COMMAND as ft, KEY_ESCAPE_COMMAND as bt, createCommand as yt, $getNodeByKey as U } from "lexical";
|
|
17
|
+
import { useRef as j, useState as R, useEffect as ae, useCallback as W, Suspense as wt } from "react";
|
|
18
|
+
import { d as xt, e as Ct, f as Nt, h as vt, i as kt, j as Et, k as It, B as Ce, L as Me, l as $e, m as F, W as Pt, n as Rt, A as Dt, o as zt, p as St, q as Lt, r as Wt, S as At, E as Mt, s as $t, t as $, u as _t, v as Ot, C as Ht } from "./index-ce18ac94.js";
|
|
19
|
+
import "axios";
|
|
20
|
+
import "react-dom";
|
|
21
|
+
import "@emotion/styled";
|
|
22
|
+
import "@lexical/html";
|
|
23
|
+
import "@lexical/react/LexicalCheckListPlugin";
|
|
24
|
+
import "@lexical/react/LexicalComposer";
|
|
25
|
+
import "@lexical/react/LexicalHorizontalRulePlugin";
|
|
26
|
+
import "@lexical/react/LexicalListPlugin";
|
|
27
|
+
import "@lexical/react/LexicalTablePlugin";
|
|
28
|
+
import "@lexical/table";
|
|
29
|
+
import "@lexical/list";
|
|
30
|
+
import "@lexical/rich-text";
|
|
31
|
+
import "@lexical/selection";
|
|
32
|
+
import "@lexical/react/LexicalHorizontalRuleNode";
|
|
33
|
+
import "@lexical/react/LexicalDecoratorBlockNode";
|
|
34
|
+
import "emoji-picker-react";
|
|
35
|
+
import "@lexical/react/LexicalLinkPlugin";
|
|
36
|
+
import "@lexical/react/LexicalTypeaheadMenuPlugin";
|
|
37
|
+
/**
|
|
38
|
+
* @license lucide-react v0.344.0 - ISC
|
|
39
|
+
*
|
|
40
|
+
* This source code is licensed under the ISC license.
|
|
41
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
42
|
+
*/
|
|
43
|
+
const jt = xt("Link2", [
|
|
44
|
+
["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
|
|
45
|
+
["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
|
|
46
|
+
["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
|
|
47
|
+
]);
|
|
48
|
+
const Tt = ({
|
|
49
|
+
open: u,
|
|
50
|
+
onOpenChange: p,
|
|
51
|
+
oldImageUrl: f,
|
|
52
|
+
newImageUrl: N,
|
|
53
|
+
onReplace: z,
|
|
54
|
+
onCancel: v
|
|
55
|
+
}) => /* @__PURE__ */ t(Ct, { open: u, onOpenChange: p, children: /* @__PURE__ */ g(Nt, { className: "sm:max-w-[800px] max-h-[90vh] overflow-y-auto", children: [
|
|
56
|
+
/* @__PURE__ */ g(vt, { children: [
|
|
57
|
+
/* @__PURE__ */ g(kt, { className: "flex items-center gap-2 text-xl", children: [
|
|
58
|
+
/* @__PURE__ */ t("span", { className: "text-2xl", children: "🔄" }),
|
|
59
|
+
"Compare Images"
|
|
60
|
+
] }),
|
|
61
|
+
/* @__PURE__ */ t(Et, { className: "text-sm pt-1", children: "Choose whether to replace the original image with the refined version." })
|
|
62
|
+
] }),
|
|
63
|
+
/* @__PURE__ */ g("div", { className: "space-y-4 py-4", children: [
|
|
64
|
+
/* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-4", children: /* @__PURE__ */ g("div", { className: "space-y-2", children: [
|
|
65
|
+
/* @__PURE__ */ g("div", { className: "flex items-center justify-between", children: [
|
|
66
|
+
/* @__PURE__ */ t("span", { className: "text-sm font-semibold text-gray-700 dark:text-gray-300", children: "Refined Image" }),
|
|
67
|
+
/* @__PURE__ */ t("span", { className: "text-xs px-2 py-1 rounded-full bg-blue-100 dark:bg-blue-950/30 text-blue-600 dark:text-blue-400", children: "New" })
|
|
68
|
+
] }),
|
|
69
|
+
/* @__PURE__ */ t("div", { className: "relative aspect-square rounded-lg overflow-hidden bg-gray-100 dark:bg-gray-800 border-2 border-blue-500 dark:border-blue-600", children: /* @__PURE__ */ t(
|
|
70
|
+
"img",
|
|
71
|
+
{
|
|
72
|
+
src: N,
|
|
73
|
+
alt: "Refined",
|
|
74
|
+
className: "w-full h-full object-contain"
|
|
75
|
+
}
|
|
76
|
+
) })
|
|
77
|
+
] }) }),
|
|
78
|
+
/* @__PURE__ */ t("div", { className: "p-3 rounded-lg bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800", children: /* @__PURE__ */ g("p", { className: "text-sm text-blue-800 dark:text-blue-200", children: [
|
|
79
|
+
/* @__PURE__ */ t("span", { className: "font-semibold", children: "Note:" }),
|
|
80
|
+
' Clicking "Replace" will update the image in your document. This action cannot be undone.'
|
|
81
|
+
] }) })
|
|
82
|
+
] }),
|
|
83
|
+
/* @__PURE__ */ g(It, { className: "gap-2", children: [
|
|
84
|
+
/* @__PURE__ */ t(
|
|
85
|
+
Ce,
|
|
86
|
+
{
|
|
87
|
+
variant: "outline",
|
|
88
|
+
onClick: v,
|
|
89
|
+
children: "Keep Original"
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
/* @__PURE__ */ g(
|
|
93
|
+
Ce,
|
|
94
|
+
{
|
|
95
|
+
onClick: z,
|
|
96
|
+
className: "bg-blue-500 hover:bg-blue-600 text-white",
|
|
97
|
+
children: [
|
|
98
|
+
/* @__PURE__ */ t("span", { className: "mr-2", children: "✓" }),
|
|
99
|
+
"Replace Image"
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
] })
|
|
104
|
+
] }) });
|
|
105
|
+
function Bt({
|
|
106
|
+
caption: u
|
|
107
|
+
}) {
|
|
108
|
+
return /* @__PURE__ */ t("div", { className: "signature-caption-container", children: /* @__PURE__ */ g(
|
|
109
|
+
Re,
|
|
110
|
+
{
|
|
111
|
+
initialEditor: u,
|
|
112
|
+
initialNodes: [
|
|
113
|
+
Se,
|
|
114
|
+
Le,
|
|
115
|
+
We,
|
|
116
|
+
Ae,
|
|
117
|
+
ke,
|
|
118
|
+
ve
|
|
119
|
+
],
|
|
120
|
+
children: [
|
|
121
|
+
/* @__PURE__ */ t(
|
|
122
|
+
ze,
|
|
123
|
+
{
|
|
124
|
+
contentEditable: /* @__PURE__ */ t(
|
|
125
|
+
Ee,
|
|
126
|
+
{
|
|
127
|
+
"aria-placeholder": "Enter signature name...",
|
|
128
|
+
placeholder: /* @__PURE__ */ t("div", { style: {
|
|
129
|
+
position: "absolute",
|
|
130
|
+
top: "4px",
|
|
131
|
+
left: "8px",
|
|
132
|
+
right: "8px",
|
|
133
|
+
textAlign: "center",
|
|
134
|
+
pointerEvents: "none",
|
|
135
|
+
color: "hsla(var(--cteditorf47ac10b-foreground) / 0.4)",
|
|
136
|
+
fontStyle: "italic"
|
|
137
|
+
}, children: "Enter signature name..." }),
|
|
138
|
+
className: "signature-caption-editable"
|
|
139
|
+
}
|
|
140
|
+
),
|
|
141
|
+
ErrorBoundary: Ie
|
|
142
|
+
}
|
|
143
|
+
),
|
|
144
|
+
/* @__PURE__ */ t(De, { onChange: () => {
|
|
145
|
+
} }),
|
|
146
|
+
/* @__PURE__ */ t(Pe, {}),
|
|
147
|
+
/* @__PURE__ */ t(Me, { namespace: $e.namespace })
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
) });
|
|
151
|
+
}
|
|
152
|
+
function se(u, p, f) {
|
|
153
|
+
return Math.min(Math.max(u, p), f);
|
|
154
|
+
}
|
|
155
|
+
const s = {
|
|
156
|
+
east: 1,
|
|
157
|
+
north: 8,
|
|
158
|
+
south: 2,
|
|
159
|
+
west: 4
|
|
160
|
+
};
|
|
161
|
+
function Yt({
|
|
162
|
+
onResizeStart: u,
|
|
163
|
+
onResizeEnd: p,
|
|
164
|
+
buttonRef: f,
|
|
165
|
+
imageRef: N,
|
|
166
|
+
maxWidth: z,
|
|
167
|
+
editor: v,
|
|
168
|
+
showCaption: G,
|
|
169
|
+
setShowCaption: A,
|
|
170
|
+
captionsEnabled: S
|
|
171
|
+
}) {
|
|
172
|
+
const T = j(null), k = j({
|
|
173
|
+
priority: "",
|
|
174
|
+
value: "default"
|
|
175
|
+
}), y = j({
|
|
176
|
+
currentHeight: 0,
|
|
177
|
+
currentWidth: 0,
|
|
178
|
+
direction: 0,
|
|
179
|
+
isResizing: !1,
|
|
180
|
+
ratio: 0,
|
|
181
|
+
startHeight: 0,
|
|
182
|
+
startWidth: 0,
|
|
183
|
+
startX: 0,
|
|
184
|
+
startY: 0
|
|
185
|
+
}), h = v.getRootElement(), w = h !== null ? h.getBoundingClientRect().width - 20 : 100, q = h !== null ? h.getBoundingClientRect().height - 20 : 100, m = 100, E = 100, _ = (i) => {
|
|
186
|
+
const d = i === s.east || i === s.west, o = i === s.north || i === s.south, D = i & s.north && i & s.west || i & s.south && i & s.east, C = d ? "ew" : o ? "ns" : D ? "nwse" : "nesw";
|
|
187
|
+
h !== null && h.style.setProperty(
|
|
188
|
+
"cursor",
|
|
189
|
+
`${C}-resize`,
|
|
190
|
+
"important"
|
|
191
|
+
), document.body !== null && (document.body.style.setProperty(
|
|
192
|
+
"cursor",
|
|
193
|
+
`${C}-resize`,
|
|
194
|
+
"important"
|
|
195
|
+
), k.current.value = document.body.style.getPropertyValue(
|
|
196
|
+
"-webkit-user-select"
|
|
197
|
+
), k.current.priority = document.body.style.getPropertyPriority(
|
|
198
|
+
"-webkit-user-select"
|
|
199
|
+
), document.body.style.setProperty(
|
|
200
|
+
"-webkit-user-select",
|
|
201
|
+
"none",
|
|
202
|
+
"important"
|
|
203
|
+
));
|
|
204
|
+
}, L = () => {
|
|
205
|
+
h !== null && h.style.setProperty("cursor", "text"), document.body !== null && (document.body.style.setProperty("cursor", "default"), document.body.style.setProperty(
|
|
206
|
+
"-webkit-user-select",
|
|
207
|
+
k.current.value,
|
|
208
|
+
k.current.priority
|
|
209
|
+
));
|
|
210
|
+
}, I = (i, d) => {
|
|
211
|
+
if (!v.isEditable())
|
|
212
|
+
return;
|
|
213
|
+
const o = N.current, D = T.current;
|
|
214
|
+
if (o !== null && D !== null) {
|
|
215
|
+
i.preventDefault();
|
|
216
|
+
const { width: C, height: P } = o.getBoundingClientRect(), l = we(o), a = y.current;
|
|
217
|
+
a.startWidth = C, a.startHeight = P, a.ratio = C / P, a.currentWidth = C, a.currentHeight = P, a.startX = i.clientX / l, a.startY = i.clientY / l, a.isResizing = !0, a.direction = d, _(d), u(), D.classList.add("image-control-wrapper--resizing"), o.style.height = `${P}px`, o.style.width = `${C}px`, document.addEventListener("pointermove", n), document.addEventListener("pointerup", O);
|
|
218
|
+
}
|
|
219
|
+
}, n = (i) => {
|
|
220
|
+
const d = N.current, o = y.current, D = o.direction & (s.east | s.west), C = o.direction & (s.south | s.north);
|
|
221
|
+
if (d !== null && o.isResizing) {
|
|
222
|
+
const P = we(d);
|
|
223
|
+
if (D && C) {
|
|
224
|
+
let l = Math.floor(o.startX - i.clientX / P);
|
|
225
|
+
l = o.direction & s.east ? -l : l;
|
|
226
|
+
const a = se(
|
|
227
|
+
o.startWidth + l,
|
|
228
|
+
m,
|
|
229
|
+
w
|
|
230
|
+
), H = a / o.ratio;
|
|
231
|
+
d.style.width = `${a}px`, d.style.height = `${H}px`, o.currentHeight = H, o.currentWidth = a;
|
|
232
|
+
} else if (C) {
|
|
233
|
+
let l = Math.floor(o.startY - i.clientY / P);
|
|
234
|
+
l = o.direction & s.south ? -l : l;
|
|
235
|
+
const a = se(
|
|
236
|
+
o.startHeight + l,
|
|
237
|
+
E,
|
|
238
|
+
q
|
|
239
|
+
);
|
|
240
|
+
d.style.height = `${a}px`, o.currentHeight = a;
|
|
241
|
+
} else {
|
|
242
|
+
let l = Math.floor(o.startX - i.clientX / P);
|
|
243
|
+
l = o.direction & s.east ? -l : l;
|
|
244
|
+
const a = se(
|
|
245
|
+
o.startWidth + l,
|
|
246
|
+
m,
|
|
247
|
+
w
|
|
248
|
+
);
|
|
249
|
+
d.style.width = `${a}px`, o.currentWidth = a;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}, O = () => {
|
|
253
|
+
const i = N.current, d = y.current, o = T.current;
|
|
254
|
+
if (i !== null && o !== null && d.isResizing) {
|
|
255
|
+
const D = d.currentWidth, C = d.currentHeight;
|
|
256
|
+
d.startWidth = 0, d.startHeight = 0, d.ratio = 0, d.startX = 0, d.startY = 0, d.currentWidth = 0, d.currentHeight = 0, d.isResizing = !1, o.classList.remove("image-control-wrapper--resizing"), L(), p(D, C), document.removeEventListener("pointermove", n), document.removeEventListener("pointerup", O);
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
return /* @__PURE__ */ g("div", { ref: T, children: [
|
|
260
|
+
!G && S && /* @__PURE__ */ t(
|
|
261
|
+
"button",
|
|
262
|
+
{
|
|
263
|
+
className: "image-caption-button",
|
|
264
|
+
ref: f,
|
|
265
|
+
onClick: () => {
|
|
266
|
+
A(!G);
|
|
267
|
+
},
|
|
268
|
+
children: "Add Caption"
|
|
269
|
+
}
|
|
270
|
+
),
|
|
271
|
+
/* @__PURE__ */ t(
|
|
272
|
+
"div",
|
|
273
|
+
{
|
|
274
|
+
className: "image-resizer image-resizer-n",
|
|
275
|
+
onPointerDown: (i) => {
|
|
276
|
+
I(i, s.north);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
),
|
|
280
|
+
/* @__PURE__ */ t(
|
|
281
|
+
"div",
|
|
282
|
+
{
|
|
283
|
+
className: "image-resizer image-resizer-ne",
|
|
284
|
+
onPointerDown: (i) => {
|
|
285
|
+
I(i, s.north | s.east);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
),
|
|
289
|
+
/* @__PURE__ */ t(
|
|
290
|
+
"div",
|
|
291
|
+
{
|
|
292
|
+
className: "image-resizer image-resizer-e",
|
|
293
|
+
onPointerDown: (i) => {
|
|
294
|
+
I(i, s.east);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
),
|
|
298
|
+
/* @__PURE__ */ t(
|
|
299
|
+
"div",
|
|
300
|
+
{
|
|
301
|
+
className: "image-resizer image-resizer-se",
|
|
302
|
+
onPointerDown: (i) => {
|
|
303
|
+
I(i, s.south | s.east);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
),
|
|
307
|
+
/* @__PURE__ */ t(
|
|
308
|
+
"div",
|
|
309
|
+
{
|
|
310
|
+
className: "image-resizer image-resizer-s",
|
|
311
|
+
onPointerDown: (i) => {
|
|
312
|
+
I(i, s.south);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
),
|
|
316
|
+
/* @__PURE__ */ t(
|
|
317
|
+
"div",
|
|
318
|
+
{
|
|
319
|
+
className: "image-resizer image-resizer-sw",
|
|
320
|
+
onPointerDown: (i) => {
|
|
321
|
+
I(i, s.south | s.west);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
),
|
|
325
|
+
/* @__PURE__ */ t(
|
|
326
|
+
"div",
|
|
327
|
+
{
|
|
328
|
+
className: "image-resizer image-resizer-w",
|
|
329
|
+
onPointerDown: (i) => {
|
|
330
|
+
I(i, s.west);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
),
|
|
334
|
+
/* @__PURE__ */ t(
|
|
335
|
+
"div",
|
|
336
|
+
{
|
|
337
|
+
className: "image-resizer image-resizer-nw",
|
|
338
|
+
onPointerDown: (i) => {
|
|
339
|
+
I(i, s.north | s.west);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
)
|
|
343
|
+
] });
|
|
344
|
+
}
|
|
345
|
+
const de = /* @__PURE__ */ new Set(), Ne = yt("RIGHT_CLICK_IMAGE_COMMAND");
|
|
346
|
+
function Kt(u) {
|
|
347
|
+
if (!de.has(u))
|
|
348
|
+
throw new Promise((p) => {
|
|
349
|
+
const f = new Image();
|
|
350
|
+
f.src = u, f.onload = () => {
|
|
351
|
+
de.add(u), p(null);
|
|
352
|
+
}, f.onerror = () => {
|
|
353
|
+
de.add(u);
|
|
354
|
+
};
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
function Xt({
|
|
358
|
+
altText: u,
|
|
359
|
+
className: p,
|
|
360
|
+
imageRef: f,
|
|
361
|
+
src: N,
|
|
362
|
+
width: z,
|
|
363
|
+
height: v,
|
|
364
|
+
maxWidth: G,
|
|
365
|
+
onError: A
|
|
366
|
+
}) {
|
|
367
|
+
return Kt(N), /* @__PURE__ */ t(
|
|
368
|
+
"img",
|
|
369
|
+
{
|
|
370
|
+
className: p || void 0,
|
|
371
|
+
src: N,
|
|
372
|
+
alt: u,
|
|
373
|
+
ref: f,
|
|
374
|
+
style: typeof z == "number" && typeof v == "number" ? {
|
|
375
|
+
// User has set a numeric size or original dimensions are provided
|
|
376
|
+
width: typeof z == "number" ? z : "auto",
|
|
377
|
+
height: typeof v == "number" ? v : "auto",
|
|
378
|
+
maxWidth: "100%"
|
|
379
|
+
} : {
|
|
380
|
+
// No dimensions specified - use original image size
|
|
381
|
+
maxWidth: "100%",
|
|
382
|
+
height: "auto"
|
|
383
|
+
},
|
|
384
|
+
onError: A,
|
|
385
|
+
draggable: "false"
|
|
386
|
+
}
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
function Ft() {
|
|
390
|
+
return /* @__PURE__ */ t(
|
|
391
|
+
"img",
|
|
392
|
+
{
|
|
393
|
+
src: "",
|
|
394
|
+
style: {
|
|
395
|
+
height: 200,
|
|
396
|
+
opacity: 0.2,
|
|
397
|
+
width: 200
|
|
398
|
+
},
|
|
399
|
+
draggable: "false"
|
|
400
|
+
}
|
|
401
|
+
);
|
|
402
|
+
}
|
|
403
|
+
function zr({
|
|
404
|
+
src: u,
|
|
405
|
+
altText: p,
|
|
406
|
+
nodeKey: f,
|
|
407
|
+
width: N,
|
|
408
|
+
height: z,
|
|
409
|
+
maxWidth: v,
|
|
410
|
+
resizable: G,
|
|
411
|
+
showCaption: A,
|
|
412
|
+
caption: S,
|
|
413
|
+
captionsEnabled: T,
|
|
414
|
+
originalPrompt: k,
|
|
415
|
+
position: y = "none",
|
|
416
|
+
linkUrl: h
|
|
417
|
+
}) {
|
|
418
|
+
const w = j(null), q = j(null), [m, E, _] = st(f), [L, I] = R(!1);
|
|
419
|
+
nt();
|
|
420
|
+
const [n] = ct(), [O, i] = R(null), d = j(null), [o, D] = R(!1), C = at(), [P, l] = R(!1), [a, H] = R(""), [B, le] = R(!1), [_e, Z] = R(!1), [ue, Q] = R(""), [Oe, ee] = R(""), [He, me] = R(!1), Y = j(null), [ge, je] = R(0), Te = ge > 0 && ge < 350;
|
|
421
|
+
ae(() => {
|
|
422
|
+
if (w.current) {
|
|
423
|
+
const e = () => {
|
|
424
|
+
w.current && je(w.current.offsetWidth);
|
|
425
|
+
};
|
|
426
|
+
e();
|
|
427
|
+
const r = new ResizeObserver(e);
|
|
428
|
+
return r.observe(w.current), () => r.disconnect();
|
|
429
|
+
}
|
|
430
|
+
}, [N, z, m]);
|
|
431
|
+
const te = W(
|
|
432
|
+
(e) => {
|
|
433
|
+
const r = J();
|
|
434
|
+
return m && X(r) && (e.preventDefault(), n.update(() => {
|
|
435
|
+
r.getNodes().forEach((b) => {
|
|
436
|
+
if (F(b)) {
|
|
437
|
+
const x = b.getParent();
|
|
438
|
+
b.remove(), x && xe(x) && x.getChildrenSize() === 0 && x.setFormat("left");
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
})), !1;
|
|
442
|
+
},
|
|
443
|
+
[n, m]
|
|
444
|
+
), he = W(
|
|
445
|
+
(e) => {
|
|
446
|
+
const r = J(), c = q.current;
|
|
447
|
+
if (m && X(r) && r.getNodes().length === 1) {
|
|
448
|
+
if (A)
|
|
449
|
+
return ce(null), e.preventDefault(), S.focus(), !0;
|
|
450
|
+
if (c !== null && c !== document.activeElement)
|
|
451
|
+
return e.preventDefault(), c.focus(), !0;
|
|
452
|
+
}
|
|
453
|
+
return !1;
|
|
454
|
+
},
|
|
455
|
+
[S, m, A]
|
|
456
|
+
), pe = W(
|
|
457
|
+
(e) => d.current === S || q.current === e.target ? (ce(null), n.update(() => {
|
|
458
|
+
E(!0);
|
|
459
|
+
const r = n.getRootElement();
|
|
460
|
+
r !== null && r.focus();
|
|
461
|
+
}), !0) : !1,
|
|
462
|
+
[S, n, E]
|
|
463
|
+
), re = W(
|
|
464
|
+
(e) => {
|
|
465
|
+
const r = e;
|
|
466
|
+
if (L)
|
|
467
|
+
return !0;
|
|
468
|
+
const b = r.target === w.current;
|
|
469
|
+
let x = !1;
|
|
470
|
+
if (!b && w.current) {
|
|
471
|
+
const V = w.current.getBoundingClientRect();
|
|
472
|
+
x = r.clientX >= V.left && r.clientX <= V.right && r.clientY >= V.top && r.clientY <= V.bottom;
|
|
473
|
+
}
|
|
474
|
+
return b || x ? (r.shiftKey ? E(!m) : (_(), E(!0)), !0) : !1;
|
|
475
|
+
},
|
|
476
|
+
[L, m, E, _]
|
|
477
|
+
), ie = W(
|
|
478
|
+
(e) => {
|
|
479
|
+
n.getEditorState().read(() => {
|
|
480
|
+
const r = J();
|
|
481
|
+
e.target.tagName === "IMG" && lt(r) && r.getNodes().length === 1 && n.dispatchCommand(
|
|
482
|
+
Ne,
|
|
483
|
+
e
|
|
484
|
+
);
|
|
485
|
+
});
|
|
486
|
+
},
|
|
487
|
+
[n]
|
|
488
|
+
);
|
|
489
|
+
ae(() => {
|
|
490
|
+
let e = !0;
|
|
491
|
+
const r = n.getRootElement(), c = dt(
|
|
492
|
+
n.registerUpdateListener(({ editorState: b }) => {
|
|
493
|
+
e && i(b.read(() => J()));
|
|
494
|
+
}),
|
|
495
|
+
n.registerCommand(
|
|
496
|
+
ut,
|
|
497
|
+
(b, x) => (d.current = x, !1),
|
|
498
|
+
M
|
|
499
|
+
),
|
|
500
|
+
n.registerCommand(
|
|
501
|
+
mt,
|
|
502
|
+
re,
|
|
503
|
+
M
|
|
504
|
+
),
|
|
505
|
+
n.registerCommand(
|
|
506
|
+
Ne,
|
|
507
|
+
re,
|
|
508
|
+
M
|
|
509
|
+
),
|
|
510
|
+
n.registerCommand(
|
|
511
|
+
gt,
|
|
512
|
+
(b) => b.target === w.current ? (b.preventDefault(), !0) : !1,
|
|
513
|
+
M
|
|
514
|
+
),
|
|
515
|
+
n.registerCommand(
|
|
516
|
+
ht,
|
|
517
|
+
te,
|
|
518
|
+
M
|
|
519
|
+
),
|
|
520
|
+
n.registerCommand(
|
|
521
|
+
pt,
|
|
522
|
+
te,
|
|
523
|
+
M
|
|
524
|
+
),
|
|
525
|
+
n.registerCommand(ft, he, M),
|
|
526
|
+
n.registerCommand(
|
|
527
|
+
bt,
|
|
528
|
+
pe,
|
|
529
|
+
M
|
|
530
|
+
)
|
|
531
|
+
);
|
|
532
|
+
return r == null || r.addEventListener("contextmenu", ie), () => {
|
|
533
|
+
e = !1, c(), r == null || r.removeEventListener("contextmenu", ie);
|
|
534
|
+
};
|
|
535
|
+
}, [
|
|
536
|
+
_,
|
|
537
|
+
n,
|
|
538
|
+
L,
|
|
539
|
+
m,
|
|
540
|
+
f,
|
|
541
|
+
te,
|
|
542
|
+
he,
|
|
543
|
+
pe,
|
|
544
|
+
re,
|
|
545
|
+
ie,
|
|
546
|
+
E
|
|
547
|
+
]);
|
|
548
|
+
const Be = () => {
|
|
549
|
+
n.update(() => {
|
|
550
|
+
const e = U(f);
|
|
551
|
+
F(e) && e.setShowCaption(!0);
|
|
552
|
+
});
|
|
553
|
+
}, Ye = (e, r) => {
|
|
554
|
+
setTimeout(() => {
|
|
555
|
+
I(!1);
|
|
556
|
+
}, 200), n.update(() => {
|
|
557
|
+
const c = U(f);
|
|
558
|
+
F(c) && c.setWidthAndHeight(e, r);
|
|
559
|
+
});
|
|
560
|
+
}, Ke = () => {
|
|
561
|
+
I(!0);
|
|
562
|
+
}, Xe = (e) => {
|
|
563
|
+
if (e.preventDefault(), e.stopPropagation(), u.startsWith("data:")) {
|
|
564
|
+
const r = window.open("", "_blank");
|
|
565
|
+
r && (r.document.write(`
|
|
566
|
+
<!DOCTYPE html>
|
|
567
|
+
<html>
|
|
568
|
+
<head>
|
|
569
|
+
<title>${p || "Image"}</title>
|
|
570
|
+
<style>
|
|
571
|
+
body {
|
|
572
|
+
margin: 0;
|
|
573
|
+
display: flex;
|
|
574
|
+
justify-content: center;
|
|
575
|
+
align-items: center;
|
|
576
|
+
min-height: 100vh;
|
|
577
|
+
background-color: #1a1a1a;
|
|
578
|
+
}
|
|
579
|
+
img {
|
|
580
|
+
max-width: 100%;
|
|
581
|
+
max-height: 100vh;
|
|
582
|
+
object-fit: contain;
|
|
583
|
+
}
|
|
584
|
+
</style>
|
|
585
|
+
</head>
|
|
586
|
+
<body>
|
|
587
|
+
<img src="${u}" alt="${p || "Image"}" />
|
|
588
|
+
</body>
|
|
589
|
+
</html>
|
|
590
|
+
`), r.document.close());
|
|
591
|
+
} else
|
|
592
|
+
window.open(u, "_blank");
|
|
593
|
+
}, Fe = (e) => {
|
|
594
|
+
e.preventDefault(), e.stopPropagation(), n.update(() => {
|
|
595
|
+
const r = U(f);
|
|
596
|
+
if (F(r)) {
|
|
597
|
+
const c = r.getParent();
|
|
598
|
+
r.remove(), c && xe(c) && c.getChildrenSize() === 0 && c.setFormat("left");
|
|
599
|
+
}
|
|
600
|
+
});
|
|
601
|
+
}, K = (e, r) => {
|
|
602
|
+
e.preventDefault(), e.stopPropagation(), n.update(() => {
|
|
603
|
+
const c = U(f);
|
|
604
|
+
F(c) && c.setPosition(r);
|
|
605
|
+
});
|
|
606
|
+
}, Ge = (e) => {
|
|
607
|
+
e.preventDefault(), e.stopPropagation(), l(!P);
|
|
608
|
+
}, qe = W(() => {
|
|
609
|
+
h && !m && (Y.current = setTimeout(() => {
|
|
610
|
+
me(!0);
|
|
611
|
+
}, 300));
|
|
612
|
+
}, [h, m]), Ve = W(() => {
|
|
613
|
+
Y.current && (clearTimeout(Y.current), Y.current = null), me(!1);
|
|
614
|
+
}, []), fe = W((e) => {
|
|
615
|
+
e.preventDefault(), e.stopPropagation(), h && window.open(h, "_blank", "noopener,noreferrer");
|
|
616
|
+
}, [h]);
|
|
617
|
+
ae(() => () => {
|
|
618
|
+
Y.current && clearTimeout(Y.current);
|
|
619
|
+
}, []);
|
|
620
|
+
const be = async () => {
|
|
621
|
+
if (!a.trim() || B)
|
|
622
|
+
return;
|
|
623
|
+
le(!0);
|
|
624
|
+
const e = $.loading("Refining image...", {
|
|
625
|
+
description: "This may take 10-30 seconds. Please wait."
|
|
626
|
+
});
|
|
627
|
+
try {
|
|
628
|
+
let r = a.trim();
|
|
629
|
+
if (k && k.trim()) {
|
|
630
|
+
const ne = k.trim(), rt = a.trim().replace(/^(add|also add|include|with|and)\s+(some|a|an)\s+/gi, "").replace(/^(add|also add|include|with|and)\s+/gi, "").trim();
|
|
631
|
+
r = `${ne} with ${rt}`;
|
|
632
|
+
} else if (p && p !== "Generated image" && p.trim()) {
|
|
633
|
+
const ne = a.trim().replace(/^(add|also add|include|with|and)\s+(some|a|an)\s+/gi, "").replace(/^(add|also add|include|with|and)\s+/gi, "").trim();
|
|
634
|
+
r = `${p} with ${ne}`;
|
|
635
|
+
}
|
|
636
|
+
const c = await _t({
|
|
637
|
+
content: `Generate Image: ${r}`
|
|
638
|
+
}), b = c == null ? void 0 : c.data;
|
|
639
|
+
if (!b)
|
|
640
|
+
throw new Error("Failed to generate image - empty response");
|
|
641
|
+
const oe = new DOMParser().parseFromString(b, "text/html").querySelector("img");
|
|
642
|
+
if (!oe || !oe.src)
|
|
643
|
+
throw new Error("No image found in response");
|
|
644
|
+
const tt = oe.src;
|
|
645
|
+
$.dismiss(e), $.success("Image refined successfully!", {
|
|
646
|
+
description: "Compare the images and choose which to keep."
|
|
647
|
+
}), Q(tt), ee(r), Z(!0), H(""), l(!1);
|
|
648
|
+
} catch (r) {
|
|
649
|
+
if ($.dismiss(e), r instanceof Ot) {
|
|
650
|
+
const c = r.code === "API_KEYS_DISABLED" ? "API Keys Disabled" : "API Key Required";
|
|
651
|
+
$.error(c, {
|
|
652
|
+
description: r.message,
|
|
653
|
+
duration: 8e3
|
|
654
|
+
});
|
|
655
|
+
} else
|
|
656
|
+
r instanceof Ht ? $.error("Credits Issue", {
|
|
657
|
+
description: r.message,
|
|
658
|
+
duration: 8e3
|
|
659
|
+
}) : $.error("Failed to refine image", {
|
|
660
|
+
description: r instanceof Error ? r.message : "Unknown error. Please try again."
|
|
661
|
+
});
|
|
662
|
+
} finally {
|
|
663
|
+
le(!1);
|
|
664
|
+
}
|
|
665
|
+
}, Je = () => {
|
|
666
|
+
n.update(() => {
|
|
667
|
+
const e = U(f);
|
|
668
|
+
if (F(e)) {
|
|
669
|
+
e.setSrc(ue), e.setOriginalPrompt(Oe);
|
|
670
|
+
const r = J();
|
|
671
|
+
r && ce(r.clone());
|
|
672
|
+
}
|
|
673
|
+
}), Z(!1), Q(""), ee(""), $.success("Image replaced successfully!", {
|
|
674
|
+
description: "The image has been updated with the refined version."
|
|
675
|
+
});
|
|
676
|
+
}, Ue = () => {
|
|
677
|
+
Z(!1), Q(""), ee("");
|
|
678
|
+
}, Ze = m && X(O) && !L, ye = (m || L) && C, Qe = () => y === "left" || y === "right" ? {
|
|
679
|
+
position: "relative",
|
|
680
|
+
display: "block",
|
|
681
|
+
width: "100%"
|
|
682
|
+
// Fill the floated container
|
|
683
|
+
} : y === "full" ? {
|
|
684
|
+
position: "relative",
|
|
685
|
+
display: "inline-block"
|
|
686
|
+
// Use inline-block to respect text-align: center from parent
|
|
687
|
+
} : y === "inline-left" || y === "inline-center" || y === "inline-right" ? {
|
|
688
|
+
position: "relative",
|
|
689
|
+
display: "inline-block"
|
|
690
|
+
// Use inline-block to respect text-align from parent
|
|
691
|
+
} : {
|
|
692
|
+
position: "relative",
|
|
693
|
+
display: "inline-block"
|
|
694
|
+
}, et = W(
|
|
695
|
+
(e) => {
|
|
696
|
+
if (L || e.target.closest("button"))
|
|
697
|
+
return;
|
|
698
|
+
const c = e.target === w.current;
|
|
699
|
+
let b = !1;
|
|
700
|
+
if (!c && w.current) {
|
|
701
|
+
const x = w.current.getBoundingClientRect();
|
|
702
|
+
b = e.clientX >= x.left && e.clientX <= x.right && e.clientY >= x.top && e.clientY <= x.bottom;
|
|
703
|
+
}
|
|
704
|
+
!c && !b || (e.stopPropagation(), e.shiftKey ? E(!m) : (_(), E(!0)));
|
|
705
|
+
},
|
|
706
|
+
[L, m, E, _]
|
|
707
|
+
);
|
|
708
|
+
return /* @__PURE__ */ t(wt, { fallback: null, children: /* @__PURE__ */ g(it, { children: [
|
|
709
|
+
/* @__PURE__ */ g(
|
|
710
|
+
"div",
|
|
711
|
+
{
|
|
712
|
+
draggable: Ze,
|
|
713
|
+
style: Qe(),
|
|
714
|
+
onClick: et,
|
|
715
|
+
onMouseEnter: qe,
|
|
716
|
+
onMouseLeave: Ve,
|
|
717
|
+
children: [
|
|
718
|
+
o ? /* @__PURE__ */ t(Ft, {}) : /* @__PURE__ */ t(
|
|
719
|
+
Xt,
|
|
720
|
+
{
|
|
721
|
+
className: ye ? `focused ${X(O) ? "draggable" : ""}` : h ? "cteditor-cursor-pointer" : null,
|
|
722
|
+
src: u,
|
|
723
|
+
altText: p,
|
|
724
|
+
imageRef: w,
|
|
725
|
+
width: N,
|
|
726
|
+
height: z,
|
|
727
|
+
maxWidth: v,
|
|
728
|
+
onError: () => D(!0)
|
|
729
|
+
}
|
|
730
|
+
),
|
|
731
|
+
He && h && !m && /* @__PURE__ */ g(
|
|
732
|
+
"div",
|
|
733
|
+
{
|
|
734
|
+
className: "cteditor-absolute cteditor-bottom-2 cteditor-left-2 cteditor-right-2 cteditor-bg-background cteditor-rounded-lg cteditor-shadow-lg cteditor-border cteditor-border-border cteditor-p-2 cteditor-flex cteditor-items-center cteditor-gap-2",
|
|
735
|
+
style: { zIndex: 10 },
|
|
736
|
+
children: [
|
|
737
|
+
/* @__PURE__ */ t(jt, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-muted-foreground cteditor-flex-shrink-0" }),
|
|
738
|
+
/* @__PURE__ */ t("span", { className: "cteditor-text-sm cteditor-text-foreground cteditor-truncate cteditor-flex-1", children: h }),
|
|
739
|
+
/* @__PURE__ */ t(
|
|
740
|
+
"button",
|
|
741
|
+
{
|
|
742
|
+
onClick: fe,
|
|
743
|
+
className: "cteditor-px-2 cteditor-py-1.5 cteditor-text-xs cteditor-rounded cteditor-bg-primary cteditor-text-primary-foreground hover:cteditor-bg-primary/90 cteditor-transition-colors cteditor-flex-shrink-0",
|
|
744
|
+
children: "Open"
|
|
745
|
+
}
|
|
746
|
+
)
|
|
747
|
+
]
|
|
748
|
+
}
|
|
749
|
+
),
|
|
750
|
+
m && X(O) && !o && /* @__PURE__ */ g(
|
|
751
|
+
"div",
|
|
752
|
+
{
|
|
753
|
+
className: `cteditor-absolute cteditor-flex cteditor-gap-1 z-10 ${Te ? "cteditor-left-1/2 cteditor--translate-x-1/2 cteditor-bottom-0 cteditor-translate-y-full cteditor-mt-1" : "cteditor-top-2 cteditor-right-2"}`,
|
|
754
|
+
children: [
|
|
755
|
+
/* @__PURE__ */ g("div", { className: "cteditor-flex cteditor-items-center cteditor-gap-0.5 cteditor-bg-background/80 cteditor-rounded-md cteditor-shadow-md cteditor-border cteditor-border-border cteditor-p-0.5", children: [
|
|
756
|
+
/* @__PURE__ */ t(
|
|
757
|
+
"button",
|
|
758
|
+
{
|
|
759
|
+
onClick: (e) => K(e, "left"),
|
|
760
|
+
className: ` cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${y === "left" ? "cteditor-bg-accent" : ""}`,
|
|
761
|
+
"aria-label": "Wrap text left",
|
|
762
|
+
title: "Wrap text left",
|
|
763
|
+
children: /* @__PURE__ */ t(Pt, {})
|
|
764
|
+
}
|
|
765
|
+
),
|
|
766
|
+
/* @__PURE__ */ t(
|
|
767
|
+
"button",
|
|
768
|
+
{
|
|
769
|
+
onClick: (e) => K(e, "right"),
|
|
770
|
+
className: ` cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${y === "right" ? "cteditor-bg-accent" : ""}`,
|
|
771
|
+
"aria-label": "Wrap text right",
|
|
772
|
+
title: "Wrap text right",
|
|
773
|
+
children: /* @__PURE__ */ t(Rt, {})
|
|
774
|
+
}
|
|
775
|
+
),
|
|
776
|
+
/* @__PURE__ */ t("div", { className: "cteditor-w-px cteditor-h-5 cteditor-bg-border cteditor-mx-0.5" }),
|
|
777
|
+
/* @__PURE__ */ t(
|
|
778
|
+
"button",
|
|
779
|
+
{
|
|
780
|
+
onClick: (e) => K(e, "inline-left"),
|
|
781
|
+
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${y === "inline-left" ? "cteditor-bg-accent" : ""}`,
|
|
782
|
+
"aria-label": "Align left",
|
|
783
|
+
title: "Align left (no text wrap)",
|
|
784
|
+
children: /* @__PURE__ */ t(Dt, {})
|
|
785
|
+
}
|
|
786
|
+
),
|
|
787
|
+
/* @__PURE__ */ t(
|
|
788
|
+
"button",
|
|
789
|
+
{
|
|
790
|
+
onClick: (e) => K(e, "inline-center"),
|
|
791
|
+
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${y === "inline-center" || y === "full" ? "cteditor-bg-accent" : ""}`,
|
|
792
|
+
"aria-label": "Align center",
|
|
793
|
+
title: "Align center (no text wrap)",
|
|
794
|
+
children: /* @__PURE__ */ t(zt, {})
|
|
795
|
+
}
|
|
796
|
+
),
|
|
797
|
+
/* @__PURE__ */ t(
|
|
798
|
+
"button",
|
|
799
|
+
{
|
|
800
|
+
onClick: (e) => K(e, "inline-right"),
|
|
801
|
+
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${y === "inline-right" ? "cteditor-bg-accent" : ""}`,
|
|
802
|
+
"aria-label": "Align right",
|
|
803
|
+
title: "Align right (no text wrap)",
|
|
804
|
+
children: /* @__PURE__ */ t(St, {})
|
|
805
|
+
}
|
|
806
|
+
),
|
|
807
|
+
/* @__PURE__ */ t("div", { className: "cteditor-w-px cteditor-h-5 cteditor-bg-border cteditor-mx-0.5" }),
|
|
808
|
+
/* @__PURE__ */ t(
|
|
809
|
+
"button",
|
|
810
|
+
{
|
|
811
|
+
onClick: (e) => K(e, "none"),
|
|
812
|
+
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${y === "none" ? "cteditor-bg-accent" : ""}`,
|
|
813
|
+
"aria-label": "Inline",
|
|
814
|
+
title: "Inline with text",
|
|
815
|
+
children: /* @__PURE__ */ t(Lt, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
|
|
816
|
+
}
|
|
817
|
+
)
|
|
818
|
+
] }),
|
|
819
|
+
h && /* @__PURE__ */ t(
|
|
820
|
+
"button",
|
|
821
|
+
{
|
|
822
|
+
onClick: fe,
|
|
823
|
+
className: " cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-md cteditor-bg-background/80 hover:cteditor-bg-accent cteditor-transition-colors cteditor-shadow-md cteditor-border cteditor-border-border",
|
|
824
|
+
"aria-label": "Visit link",
|
|
825
|
+
title: `Visit: ${h}`,
|
|
826
|
+
children: /* @__PURE__ */ t(Wt, {})
|
|
827
|
+
}
|
|
828
|
+
),
|
|
829
|
+
k && /* @__PURE__ */ t(
|
|
830
|
+
"button",
|
|
831
|
+
{
|
|
832
|
+
onClick: (e) => {
|
|
833
|
+
e.stopPropagation(), Ge(e);
|
|
834
|
+
},
|
|
835
|
+
className: " cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-md cteditor-bg-background/80 hover:cteditor-bg-accent cteditor-transition-colors cteditor-shadow-md cteditor-border cteditor-border-border",
|
|
836
|
+
"aria-label": "Refine image",
|
|
837
|
+
title: "Refine image",
|
|
838
|
+
children: /* @__PURE__ */ t(At, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
|
|
839
|
+
}
|
|
840
|
+
),
|
|
841
|
+
/* @__PURE__ */ t(
|
|
842
|
+
"button",
|
|
843
|
+
{
|
|
844
|
+
onClick: (e) => {
|
|
845
|
+
e.stopPropagation(), Xe(e);
|
|
846
|
+
},
|
|
847
|
+
className: " cteditor-size-8 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-md cteditor-bg-background/80 hover:cteditor-bg-accent cteditor-transition-colors cteditor-shadow-md cteditor-border cteditor-border-border",
|
|
848
|
+
"aria-label": "Open image in new tab",
|
|
849
|
+
title: "Open in new tab",
|
|
850
|
+
children: /* @__PURE__ */ t(Mt, {})
|
|
851
|
+
}
|
|
852
|
+
),
|
|
853
|
+
/* @__PURE__ */ t(
|
|
854
|
+
"button",
|
|
855
|
+
{
|
|
856
|
+
onClick: (e) => {
|
|
857
|
+
e.stopPropagation(), Fe(e);
|
|
858
|
+
},
|
|
859
|
+
className: " cteditor-size-8 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-md cteditor-bg-background/80 hover:cteditor-bg-destructive hover:cteditor-text-destructive-foreground cteditor-transition-colors cteditor-shadow-md cteditor-border cteditor-border-border",
|
|
860
|
+
"aria-label": "Delete image",
|
|
861
|
+
title: "Delete image",
|
|
862
|
+
children: /* @__PURE__ */ t($t, {})
|
|
863
|
+
}
|
|
864
|
+
)
|
|
865
|
+
]
|
|
866
|
+
}
|
|
867
|
+
),
|
|
868
|
+
P && m && !o && k && /* @__PURE__ */ t(
|
|
869
|
+
"div",
|
|
870
|
+
{
|
|
871
|
+
className: "cteditor-absolute cteditor-bottom-2 cteditor-left-2 cteditor-right-2 cteditor-bg-background cteditor-rounded-lg cteditor-shadow-xl cteditor-border cteditor-border-border cteditor-p-3",
|
|
872
|
+
style: { zIndex: 10 },
|
|
873
|
+
onClick: (e) => e.stopPropagation(),
|
|
874
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
875
|
+
onKeyUp: (e) => e.stopPropagation(),
|
|
876
|
+
children: /* @__PURE__ */ g("div", { className: "cteditor-flex cteditor-flex-col cteditor-gap-2", children: [
|
|
877
|
+
/* @__PURE__ */ t("label", { className: "cteditor-text-xs cteditor-font-medium cteditor-text-foreground", children: "What else do you want in this scene?" }),
|
|
878
|
+
/* @__PURE__ */ t(
|
|
879
|
+
"input",
|
|
880
|
+
{
|
|
881
|
+
type: "text",
|
|
882
|
+
value: a,
|
|
883
|
+
onChange: (e) => H(e.target.value),
|
|
884
|
+
onKeyDown: (e) => {
|
|
885
|
+
e.stopPropagation(), e.key === "Enter" && a.trim() && !B && be(), e.key === "Escape" && (l(!1), H(""));
|
|
886
|
+
},
|
|
887
|
+
onKeyUp: (e) => {
|
|
888
|
+
e.stopPropagation();
|
|
889
|
+
},
|
|
890
|
+
onClick: (e) => {
|
|
891
|
+
e.stopPropagation();
|
|
892
|
+
},
|
|
893
|
+
placeholder: "e.g., flying birds, golden sunset, stormy clouds...",
|
|
894
|
+
className: "cteditor-w-full cteditor-px-3 cteditor-py-2 cteditor-text-sm cteditor-border cteditor-border-border cteditor-rounded-md cteditor-bg-background cteditor-text-foreground focus:cteditor-outline-none focus:cteditor-ring-2 focus:cteditor-ring-blue-500",
|
|
895
|
+
disabled: B,
|
|
896
|
+
autoFocus: !0
|
|
897
|
+
}
|
|
898
|
+
),
|
|
899
|
+
/* @__PURE__ */ g("div", { className: "cteditor-flex cteditor-gap-2", children: [
|
|
900
|
+
/* @__PURE__ */ t(
|
|
901
|
+
"button",
|
|
902
|
+
{
|
|
903
|
+
onClick: (e) => {
|
|
904
|
+
e.stopPropagation(), be();
|
|
905
|
+
},
|
|
906
|
+
disabled: B || !a.trim(),
|
|
907
|
+
className: "cteditor-flex-1 cteditor-px-3 cteditor-py-2 cteditor-text-sm cteditor-rounded-md cteditor-bg-blue-500 cteditor-text-white hover:cteditor-bg-blue-600 disabled:cteditor-opacity-50 disabled:cteditor-cursor-not-allowed cteditor-transition-colors",
|
|
908
|
+
children: B ? /* @__PURE__ */ g("span", { className: "cteditor-flex cteditor-items-center cteditor-justify-center cteditor-gap-2", children: [
|
|
909
|
+
/* @__PURE__ */ t("span", { className: "cteditor-inline-block cteditor-w-4 cteditor-h-4 cteditor-border-2 cteditor-border-white cteditor-border-t-transparent cteditor-rounded-full cteditor-animate-spin" }),
|
|
910
|
+
"Refining..."
|
|
911
|
+
] }) : "Refine Image"
|
|
912
|
+
}
|
|
913
|
+
),
|
|
914
|
+
/* @__PURE__ */ t(
|
|
915
|
+
"button",
|
|
916
|
+
{
|
|
917
|
+
onClick: (e) => {
|
|
918
|
+
e.stopPropagation(), l(!1), H("");
|
|
919
|
+
},
|
|
920
|
+
disabled: B,
|
|
921
|
+
className: "cteditor-px-3 cteditor-py-2 cteditor-text-sm cteditor-rounded-md cteditor-bg-background cteditor-border cteditor-border-border cteditor-text-foreground hover:cteditor-bg-accent disabled:cteditor-opacity-50 disabled:cteditor-cursor-not-allowed cteditor-transition-colors",
|
|
922
|
+
children: "Cancel"
|
|
923
|
+
}
|
|
924
|
+
)
|
|
925
|
+
] })
|
|
926
|
+
] })
|
|
927
|
+
}
|
|
928
|
+
),
|
|
929
|
+
G && X(O) && ye && /* @__PURE__ */ t(
|
|
930
|
+
Yt,
|
|
931
|
+
{
|
|
932
|
+
showCaption: A,
|
|
933
|
+
setShowCaption: Be,
|
|
934
|
+
editor: n,
|
|
935
|
+
buttonRef: q,
|
|
936
|
+
imageRef: w,
|
|
937
|
+
maxWidth: v,
|
|
938
|
+
onResizeStart: Ke,
|
|
939
|
+
onResizeEnd: Ye,
|
|
940
|
+
captionsEnabled: !o && T
|
|
941
|
+
}
|
|
942
|
+
)
|
|
943
|
+
]
|
|
944
|
+
}
|
|
945
|
+
),
|
|
946
|
+
A && (p.startsWith("Signature by") ? /* @__PURE__ */ t(Bt, { caption: S }) : /* @__PURE__ */ t("div", { className: "image-caption-container", children: /* @__PURE__ */ g(
|
|
947
|
+
Re,
|
|
948
|
+
{
|
|
949
|
+
initialEditor: S,
|
|
950
|
+
initialNodes: [
|
|
951
|
+
Se,
|
|
952
|
+
Le,
|
|
953
|
+
We,
|
|
954
|
+
Ae,
|
|
955
|
+
ke,
|
|
956
|
+
ve
|
|
957
|
+
],
|
|
958
|
+
children: [
|
|
959
|
+
/* @__PURE__ */ t(ot, {}),
|
|
960
|
+
/* @__PURE__ */ t(
|
|
961
|
+
ze,
|
|
962
|
+
{
|
|
963
|
+
contentEditable: /* @__PURE__ */ t(
|
|
964
|
+
Ee,
|
|
965
|
+
{
|
|
966
|
+
"aria-placeholder": "Enter a caption...",
|
|
967
|
+
placeholder: () => /* @__PURE__ */ t("span", { className: "cteditor-text-xs", children: "Enter a caption..." }),
|
|
968
|
+
className: "ImageNode__contentEditable"
|
|
969
|
+
}
|
|
970
|
+
),
|
|
971
|
+
ErrorBoundary: Ie
|
|
972
|
+
}
|
|
973
|
+
),
|
|
974
|
+
/* @__PURE__ */ t(
|
|
975
|
+
De,
|
|
976
|
+
{
|
|
977
|
+
onChange: () => {
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
),
|
|
981
|
+
/* @__PURE__ */ t(Pe, {}),
|
|
982
|
+
/* @__PURE__ */ t(Me, { namespace: $e.namespace })
|
|
983
|
+
]
|
|
984
|
+
}
|
|
985
|
+
) })),
|
|
986
|
+
/* @__PURE__ */ t(
|
|
987
|
+
Tt,
|
|
988
|
+
{
|
|
989
|
+
open: _e,
|
|
990
|
+
onOpenChange: Z,
|
|
991
|
+
oldImageUrl: u,
|
|
992
|
+
newImageUrl: ue,
|
|
993
|
+
onReplace: Je,
|
|
994
|
+
onCancel: Ue
|
|
995
|
+
}
|
|
996
|
+
)
|
|
997
|
+
] }) });
|
|
998
|
+
}
|
|
999
|
+
export {
|
|
1000
|
+
Ne as RIGHT_CLICK_IMAGE_COMMAND,
|
|
1001
|
+
zr as default
|
|
1002
|
+
};
|