eddyter 1.4.18 → 1.4.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AIChatPlugin-BUWq8ixX.js +1042 -0
- package/dist/{CombinedAutocompletGrammarPlugin-BXOz6IRb.js → CombinedAutocompletGrammarPlugin-Dq25w8tq.js} +388 -337
- package/dist/{CommentBubblePlugin-kiMehQkL.js → CommentBubblePlugin-B77d3Qq6.js} +4 -4
- package/dist/CommentPlugin-BJQyKmrN.js +212 -0
- package/dist/{NotePanelPlugin-FirMseLu.js → NotePanelPlugin-BqOdcg07.js} +3 -3
- package/dist/{TextEnhancePlugin-oXbL_F1i.js → TextEnhancePlugin-BnmdRgUu.js} +2 -2
- package/dist/assets/style.css +1 -1
- package/dist/components/AnimatedPlaceholderText.d.ts +2 -0
- package/dist/components/DividerPicker/DividerPicker.d.ts +17 -0
- package/dist/components/EditorialDivider/EditorialDividerView.d.ts +23 -0
- package/dist/components/EmojiPickerWidget/EmojiPickerWidget.d.ts +1 -1
- package/dist/components/LockedFeature/LockedFeature.d.ts +4 -0
- package/dist/components/Toolbar/styles.d.ts +19 -1
- package/dist/components/UnifiedColorPicker/UnifiedColorPicker.d.ts +1 -0
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/separator.d.ts +4 -1
- package/dist/constants.d.ts +12 -1
- package/dist/editorConfig.d.ts +7 -0
- package/dist/{generateDocxThumbnail-RE7yNAXP.js → generateDocxThumbnail-DBMxjZ83.js} +1 -1
- package/dist/{generatePdfThumbnail-CnldK2yE.js → generatePdfThumbnail-Cv2-ZCzh.js} +4 -4
- package/dist/{generateXlsxThumbnail-BpBB4ePK.js → generateXlsxThumbnail-UHmNc7Fa.js} +1 -1
- package/dist/hooks/useEditorToolbar.d.ts +1 -1
- package/dist/{index-CL0adQ5R.js → index-BaWQzoL2.js} +11 -11
- package/dist/{index-CXyZgoBl.js → index-Bex3G_eE.js} +18704 -15777
- package/dist/index-C_mjLQUF.js +796 -0
- package/dist/{index-C8ZUqYRj.js → index-ChSepytp.js} +26 -26
- package/dist/index-Cl_A9eof.js +1508 -0
- package/dist/{index-B4W_mfNI.js → index-DcHU8PlQ.js} +120 -123
- package/dist/{index-CKRp6axU.js → index-q_TW8dU1.js} +19 -19
- package/dist/index.js +7 -7
- package/dist/nodes/AsterismNode.d.ts +22 -0
- package/dist/nodes/ButtonNode.d.ts +37 -0
- package/dist/nodes/ColumnNode.d.ts +44 -0
- package/dist/nodes/ColumnsNode.d.ts +45 -0
- package/dist/nodes/EditorialFieldNode.d.ts +32 -0
- package/dist/nodes/FaqNode.d.ts +28 -0
- package/dist/nodes/ImagePlaceholderNode.d.ts +15 -0
- package/dist/nodes/LabeledRuleNode.d.ts +33 -0
- package/dist/nodes/OrnamentDividerNode.d.ts +22 -0
- package/dist/nodes/PullQuoteRulesNode.d.ts +32 -0
- package/dist/nodes/SectionNumberHeadingNode.d.ts +42 -0
- package/dist/plugins/BlockLayoutPlugin.d.ts +29 -0
- package/dist/plugins/ColumnAddButtonPlugin.d.ts +12 -0
- package/dist/plugins/CommentPlugin.commands.d.ts +1 -0
- package/dist/plugins/CustomHorizontalRulePlugin/CustomHorizontalRuleNode.d.ts +12 -2
- package/dist/plugins/CustomHorizontalRulePlugin/HorizontalRuleCustomizationDialog.d.ts +2 -1
- package/dist/plugins/CustomHorizontalRulePlugin/styles.d.ts +38 -0
- package/dist/plugins/EditorialFloatingToolbarPlugin.d.ts +8 -0
- package/dist/plugins/EditorialTypographyPlugin.d.ts +18 -0
- package/dist/plugins/PatternsPlugin.d.ts +12 -0
- package/dist/{sparkles-CTAYmQOE.js → sparkles-C-XoMho5.js} +1 -1
- package/dist/types.d.ts +11 -0
- package/dist/ui/Icons.d.ts +34 -9
- package/dist/{useVoiceToText-U0yKgS5Q.js → useVoiceToText-BzaLSbRi.js} +17 -17
- package/package.json +1 -1
- package/dist/AIChatPlugin-DsUPycjT.js +0 -872
- package/dist/CommentPlugin-DIuM-Jao.js +0 -154
- package/dist/index-DZAvLKar.js +0 -1431
- package/dist/index-F2-F96Nx.js +0 -720
- package/dist/square-CupR-YWR.js +0 -7
|
@@ -0,0 +1,1508 @@
|
|
|
1
|
+
import { jsx as e, jsxs as a, Fragment as Me } from "react/jsx-runtime";
|
|
2
|
+
import { I as Tt } from "./ImageResizer-BVwxL4Eh.js";
|
|
3
|
+
import { CodeNode as Wt } from "@lexical/code";
|
|
4
|
+
import { LinkNode as zt } from "@lexical/link";
|
|
5
|
+
import { AutoFocusPlugin as Ot } from "@lexical/react/LexicalAutoFocusPlugin";
|
|
6
|
+
import { useCollaborationContext as _t } from "@lexical/react/LexicalCollaborationContext";
|
|
7
|
+
import { useLexicalComposerContext as Ft } from "@lexical/react/LexicalComposerContext";
|
|
8
|
+
import { ContentEditable as Ht } from "@lexical/react/LexicalContentEditable";
|
|
9
|
+
import { LexicalErrorBoundary as Yt } from "@lexical/react/LexicalErrorBoundary";
|
|
10
|
+
import { HistoryPlugin as jt } from "@lexical/react/LexicalHistoryPlugin";
|
|
11
|
+
import { LexicalNestedComposer as Bt } from "@lexical/react/LexicalNestedComposer";
|
|
12
|
+
import { OnChangePlugin as Xt } from "@lexical/react/LexicalOnChangePlugin";
|
|
13
|
+
import { RichTextPlugin as Kt } from "@lexical/react/LexicalRichTextPlugin";
|
|
14
|
+
import { useLexicalEditable as Ut } from "@lexical/react/useLexicalEditable";
|
|
15
|
+
import { useLexicalNodeSelection as Gt } from "@lexical/react/useLexicalNodeSelection";
|
|
16
|
+
import { mergeRegister as qt } from "@lexical/utils";
|
|
17
|
+
import { $getRoot as Xe, $createParagraphNode as Vt, $createTextNode as Jt, $isNodeSelection as ge, $getSelection as ce, $isParagraphNode as Ke, $setSelection as we, $isRangeSelection as Qt, SELECTION_CHANGE_COMMAND as Zt, COMMAND_PRIORITY_LOW as de, CLICK_COMMAND as er, DRAGSTART_COMMAND as tr, KEY_DELETE_COMMAND as rr, KEY_BACKSPACE_COMMAND as ir, KEY_ENTER_COMMAND as or, KEY_ESCAPE_COMMAND as nr, $getNodeByKey as se, RootNode as ar, TextNode as cr, LineBreakNode as dr, ParagraphNode as sr, createCommand as lr } from "lexical";
|
|
18
|
+
import { useState as v, useRef as X, useEffect as G, useMemo as it, useCallback as R, useLayoutEffect as ot, Suspense as ur } from "react";
|
|
19
|
+
import { c as Ue, D as ct, a as dt, b as st, d as lt, e as ut, g as mr, B as Ie, aK as De, t as I, x as hr, aL as re, aM as gr, aN as fr, aO as pr, O as br, Q as Y, U as j, ap as xr, V as B, aq as wr, ar as yr, as as Cr, at as Nr, aP as vr, am as kr, aQ as Rr, aR as Er, a0 as Ir, aS as Pr, aT as Sr, r as $r, aU as Mr, aV as Dr } from "./index-Bex3G_eE.js";
|
|
20
|
+
import { S as Lr } from "./sparkles-C-XoMho5.js";
|
|
21
|
+
const Ar = Ue("Crop", [
|
|
22
|
+
["path", { d: "M6 2v14a2 2 0 0 0 2 2h14", key: "ron5a4" }],
|
|
23
|
+
["path", { d: "M18 22V8a2 2 0 0 0-2-2H2", key: "7s9ehn" }]
|
|
24
|
+
]);
|
|
25
|
+
const Tr = Ue("Link2", [
|
|
26
|
+
["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
|
|
27
|
+
["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
|
|
28
|
+
["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
|
|
29
|
+
]);
|
|
30
|
+
const mt = Ue("RotateCcw", [
|
|
31
|
+
["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
|
|
32
|
+
["path", { d: "M3 3v5h5", key: "1xhq8a" }]
|
|
33
|
+
]), Wr = ({
|
|
34
|
+
open: r,
|
|
35
|
+
onOpenChange: c,
|
|
36
|
+
oldImageUrl: u,
|
|
37
|
+
newImageUrl: p,
|
|
38
|
+
onReplace: N,
|
|
39
|
+
onCancel: y
|
|
40
|
+
}) => /* @__PURE__ */ e(ct, { open: r, onOpenChange: c, children: /* @__PURE__ */ a(dt, { className: "sm:max-w-[800px] max-h-[90vh] overflow-y-auto", children: [
|
|
41
|
+
/* @__PURE__ */ a(st, { children: [
|
|
42
|
+
/* @__PURE__ */ a(lt, { className: "flex items-center gap-2 text-xl", children: [
|
|
43
|
+
/* @__PURE__ */ e("span", { className: "text-2xl", children: "🔄" }),
|
|
44
|
+
"Compare Images"
|
|
45
|
+
] }),
|
|
46
|
+
/* @__PURE__ */ e(ut, { className: "text-sm pt-1", children: "Choose whether to replace the original image with the refined version." })
|
|
47
|
+
] }),
|
|
48
|
+
/* @__PURE__ */ a("div", { className: "space-y-4 py-4", children: [
|
|
49
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-2 gap-4", children: /* @__PURE__ */ a("div", { className: "space-y-2", children: [
|
|
50
|
+
/* @__PURE__ */ a("div", { className: "flex items-center justify-between", children: [
|
|
51
|
+
/* @__PURE__ */ e("span", { className: "text-sm font-semibold text-gray-700 dark:text-gray-300", children: "Refined Image" }),
|
|
52
|
+
/* @__PURE__ */ e("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" })
|
|
53
|
+
] }),
|
|
54
|
+
/* @__PURE__ */ e("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__ */ e(
|
|
55
|
+
"img",
|
|
56
|
+
{
|
|
57
|
+
src: p,
|
|
58
|
+
alt: "Refined",
|
|
59
|
+
className: "w-full h-full object-contain"
|
|
60
|
+
}
|
|
61
|
+
) })
|
|
62
|
+
] }) }),
|
|
63
|
+
/* @__PURE__ */ e("div", { className: "p-3 rounded-lg bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800", children: /* @__PURE__ */ a("p", { className: "text-sm text-blue-800 dark:text-blue-200", children: [
|
|
64
|
+
/* @__PURE__ */ e("span", { className: "font-semibold", children: "Note:" }),
|
|
65
|
+
' Clicking "Replace" will update the image in your document. This action cannot be undone.'
|
|
66
|
+
] }) })
|
|
67
|
+
] }),
|
|
68
|
+
/* @__PURE__ */ a(mr, { className: "gap-2", children: [
|
|
69
|
+
/* @__PURE__ */ e(
|
|
70
|
+
Ie,
|
|
71
|
+
{
|
|
72
|
+
variant: "outline",
|
|
73
|
+
onClick: y,
|
|
74
|
+
children: "Keep Original"
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
/* @__PURE__ */ a(
|
|
78
|
+
Ie,
|
|
79
|
+
{
|
|
80
|
+
onClick: N,
|
|
81
|
+
className: "bg-blue-500 hover:bg-blue-600 text-white",
|
|
82
|
+
children: [
|
|
83
|
+
/* @__PURE__ */ e("span", { className: "mr-2", children: "✓" }),
|
|
84
|
+
"Replace Image"
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
] })
|
|
89
|
+
] }) });
|
|
90
|
+
function zr({
|
|
91
|
+
caption: r
|
|
92
|
+
}) {
|
|
93
|
+
const [c, u] = v(""), [p, N] = v(""), [y, q] = v(""), E = X(null), P = X(!1);
|
|
94
|
+
G(() => {
|
|
95
|
+
const w = (f) => {
|
|
96
|
+
const D = f.split(" • "), o = D[0] || "";
|
|
97
|
+
o.startsWith("by ") ? (u("by "), N(o.slice(3))) : (u(""), N(o)), q(D[1] || "");
|
|
98
|
+
};
|
|
99
|
+
return w(r.getEditorState().read(() => Xe().getTextContent())), r.registerUpdateListener(({ editorState: f }) => {
|
|
100
|
+
P.current || w(f.read(() => Xe().getTextContent()));
|
|
101
|
+
});
|
|
102
|
+
}, [r]), G(() => {
|
|
103
|
+
E.current && !P.current && (E.current.textContent = p);
|
|
104
|
+
}, [p]);
|
|
105
|
+
const K = r.isEditable();
|
|
106
|
+
return /* @__PURE__ */ e("div", { className: "signature-caption-container", children: /* @__PURE__ */ a("div", { className: "signature-caption-info", children: [
|
|
107
|
+
/* @__PURE__ */ a("span", { className: "signature-user-name", children: [
|
|
108
|
+
c && /* @__PURE__ */ e("span", { className: "signature-name-prefix", children: c }),
|
|
109
|
+
/* @__PURE__ */ e(
|
|
110
|
+
"span",
|
|
111
|
+
{
|
|
112
|
+
ref: E,
|
|
113
|
+
className: `signature-name-value${K ? " is-editable" : ""}`,
|
|
114
|
+
contentEditable: K,
|
|
115
|
+
suppressContentEditableWarning: !0,
|
|
116
|
+
spellCheck: !1,
|
|
117
|
+
title: K ? "Click to edit name" : void 0,
|
|
118
|
+
onFocus: () => {
|
|
119
|
+
P.current = !0;
|
|
120
|
+
},
|
|
121
|
+
onBlur: () => {
|
|
122
|
+
P.current = !1;
|
|
123
|
+
const w = (E.current?.textContent || "").trim();
|
|
124
|
+
let f = `${c}${w}`;
|
|
125
|
+
y && (f += ` • ${y}`), r.update(() => {
|
|
126
|
+
const D = Xe();
|
|
127
|
+
D.clear();
|
|
128
|
+
const o = Vt();
|
|
129
|
+
o.append(Jt(f)), D.append(o);
|
|
130
|
+
});
|
|
131
|
+
},
|
|
132
|
+
onKeyDown: (w) => {
|
|
133
|
+
w.key === "Enter" && (w.preventDefault(), E.current?.blur());
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
)
|
|
137
|
+
] }),
|
|
138
|
+
y && /* @__PURE__ */ e("span", { className: "signature-separator" }),
|
|
139
|
+
y && /* @__PURE__ */ e("span", { className: "signature-timestamp", children: y })
|
|
140
|
+
] }) });
|
|
141
|
+
}
|
|
142
|
+
const Or = "/transform-image/";
|
|
143
|
+
function fe(r) {
|
|
144
|
+
if (!De || r.startsWith("data:") || r.toLowerCase().endsWith(".svg")) return !1;
|
|
145
|
+
try {
|
|
146
|
+
const c = new URL(r).origin, u = new URL(De).origin;
|
|
147
|
+
return c === u;
|
|
148
|
+
} catch {
|
|
149
|
+
return !1;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
function ht(r) {
|
|
153
|
+
if (!fe(r)) return null;
|
|
154
|
+
try {
|
|
155
|
+
const u = new URL(r).pathname.replace(/^\//, ""), p = "transform-image/";
|
|
156
|
+
return u.startsWith(p) ? u.slice(p.length) || null : u || null;
|
|
157
|
+
} catch {
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function _r(r, c) {
|
|
162
|
+
if (!fe(r)) return r;
|
|
163
|
+
const u = ht(r);
|
|
164
|
+
if (!u) return r;
|
|
165
|
+
const p = `${c.x},${c.y},${c.width},${c.height}`;
|
|
166
|
+
return `${De.replace(/\/$/, "")}${Or}${u}?crop=${p}`;
|
|
167
|
+
}
|
|
168
|
+
function nt(r) {
|
|
169
|
+
if (!fe(r)) return r;
|
|
170
|
+
try {
|
|
171
|
+
const c = new URL(r);
|
|
172
|
+
return c.searchParams.delete("crop"), c.toString();
|
|
173
|
+
} catch {
|
|
174
|
+
return r;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
function Ee(r) {
|
|
178
|
+
if (!fe(r)) return nt(r);
|
|
179
|
+
const c = ht(r);
|
|
180
|
+
return c ? `${De.replace(/\/$/, "")}/${c}` : nt(r);
|
|
181
|
+
}
|
|
182
|
+
function Fr({
|
|
183
|
+
open: r,
|
|
184
|
+
onOpenChange: c,
|
|
185
|
+
src: u,
|
|
186
|
+
altText: p,
|
|
187
|
+
width: N,
|
|
188
|
+
height: y,
|
|
189
|
+
onCropApply: q
|
|
190
|
+
}) {
|
|
191
|
+
const [E, P] = v("freeform"), [K, W] = v(u), [x, w] = v(!1), f = X(null), D = X(null), [o, z] = v({ x: 0, y: 0, width: 0, height: 0 }), [k, A] = v({ x: 0, y: 0, width: 0, height: 0 }), le = X(null), pe = it(() => typeof N == "number" && typeof y == "number" && y > 0 ? N / y : o.width > 0 && o.height > 0 ? o.width / o.height : null, [o.height, o.width, y, N]), ye = it(() => {
|
|
192
|
+
switch (E) {
|
|
193
|
+
case "original":
|
|
194
|
+
return pe;
|
|
195
|
+
case "1:1":
|
|
196
|
+
return 1;
|
|
197
|
+
case "4:3":
|
|
198
|
+
return 4 / 3;
|
|
199
|
+
case "16:9":
|
|
200
|
+
return 16 / 9;
|
|
201
|
+
case "3:4":
|
|
202
|
+
return 3 / 4;
|
|
203
|
+
case "9:16":
|
|
204
|
+
return 9 / 16;
|
|
205
|
+
default:
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
}, [pe, E]), l = 24, O = R(
|
|
209
|
+
(n) => {
|
|
210
|
+
let { x: h, y: C, width: s, height: b } = n;
|
|
211
|
+
const L = o.width, S = o.height;
|
|
212
|
+
return h = Math.max(0, Math.min(h, L - l)), C = Math.max(0, Math.min(C, S - l)), s = Math.max(l, Math.min(s, L - h)), b = Math.max(l, Math.min(b, S - C)), { x: h, y: C, width: s, height: b };
|
|
213
|
+
},
|
|
214
|
+
[o.height, o.width]
|
|
215
|
+
), Ce = R(
|
|
216
|
+
(n) => {
|
|
217
|
+
if (o.width <= 0 || o.height <= 0) return;
|
|
218
|
+
if (n == null) {
|
|
219
|
+
A({
|
|
220
|
+
x: 0,
|
|
221
|
+
y: 0,
|
|
222
|
+
width: o.width,
|
|
223
|
+
height: o.height
|
|
224
|
+
});
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
const h = o.width * 0.9, C = o.height * 0.9;
|
|
228
|
+
let s = h, b = s / n;
|
|
229
|
+
b > C && (b = C, s = b * n), A(
|
|
230
|
+
O({
|
|
231
|
+
x: (o.width - s) / 2,
|
|
232
|
+
y: (o.height - b) / 2,
|
|
233
|
+
width: s,
|
|
234
|
+
height: b
|
|
235
|
+
})
|
|
236
|
+
);
|
|
237
|
+
},
|
|
238
|
+
[o.height, o.width, O]
|
|
239
|
+
), ue = R(() => {
|
|
240
|
+
const n = f.current, h = D.current;
|
|
241
|
+
if (!n || !h) return;
|
|
242
|
+
let C = 0, s = 0, b = h;
|
|
243
|
+
for (; b && b !== n; )
|
|
244
|
+
C += b.offsetLeft, s += b.offsetTop, b = b.offsetParent;
|
|
245
|
+
z({
|
|
246
|
+
x: C,
|
|
247
|
+
y: s,
|
|
248
|
+
width: h.offsetWidth,
|
|
249
|
+
height: h.offsetHeight
|
|
250
|
+
});
|
|
251
|
+
}, []), Z = R(
|
|
252
|
+
(n) => {
|
|
253
|
+
o.width <= 0 || o.height <= 0 || (n.preventDefault(), n.stopPropagation(), n.target.setPointerCapture?.(n.pointerId), le.current = {
|
|
254
|
+
mode: "move",
|
|
255
|
+
startX: n.clientX,
|
|
256
|
+
startY: n.clientY,
|
|
257
|
+
initialRect: { ...k }
|
|
258
|
+
});
|
|
259
|
+
},
|
|
260
|
+
[o.height, o.width, k]
|
|
261
|
+
), Ne = R(
|
|
262
|
+
(n, h) => {
|
|
263
|
+
o.width <= 0 || o.height <= 0 || (n.preventDefault(), n.stopPropagation(), n.target.setPointerCapture?.(n.pointerId), le.current = {
|
|
264
|
+
mode: h,
|
|
265
|
+
startX: n.clientX,
|
|
266
|
+
startY: n.clientY,
|
|
267
|
+
initialRect: { ...k }
|
|
268
|
+
});
|
|
269
|
+
},
|
|
270
|
+
[o.height, o.width, k]
|
|
271
|
+
), Le = R(async () => {
|
|
272
|
+
if (o.width <= 0 || o.height <= 0) {
|
|
273
|
+
c(!1);
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
const n = D.current;
|
|
277
|
+
if (!n || !n.naturalWidth || !n.naturalHeight) {
|
|
278
|
+
I.error("Could not read image dimensions");
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
const h = n.naturalWidth / o.width, C = n.naturalHeight / o.height, s = {
|
|
282
|
+
x: Math.max(0, Math.round(k.x * h)),
|
|
283
|
+
y: Math.max(0, Math.round(k.y * C)),
|
|
284
|
+
width: Math.max(1, Math.round(k.width * h)),
|
|
285
|
+
height: Math.max(1, Math.round(k.height * C)),
|
|
286
|
+
naturalWidth: n.naturalWidth,
|
|
287
|
+
naturalHeight: n.naturalHeight
|
|
288
|
+
};
|
|
289
|
+
s.width = Math.min(s.width, n.naturalWidth - s.x), s.height = Math.min(s.height, n.naturalHeight - s.y), c(!1), Promise.resolve(q(s));
|
|
290
|
+
}, [o, k, q, c]);
|
|
291
|
+
return G(() => {
|
|
292
|
+
r && (z({ x: 0, y: 0, width: 0, height: 0 }), A({ x: 0, y: 0, width: 0, height: 0 }), w(!1), W(Ee(u)));
|
|
293
|
+
}, [r, u]), G(() => {
|
|
294
|
+
if (!r) return;
|
|
295
|
+
const n = f.current;
|
|
296
|
+
if (!n) return;
|
|
297
|
+
const h = new ResizeObserver(() => {
|
|
298
|
+
ue();
|
|
299
|
+
});
|
|
300
|
+
h.observe(n);
|
|
301
|
+
const C = D.current;
|
|
302
|
+
C && h.observe(C);
|
|
303
|
+
const s = () => ue();
|
|
304
|
+
return window.addEventListener("resize", s), () => {
|
|
305
|
+
h.disconnect(), window.removeEventListener("resize", s);
|
|
306
|
+
};
|
|
307
|
+
}, [r, ue]), G(() => {
|
|
308
|
+
if (!r) return;
|
|
309
|
+
const n = (C) => {
|
|
310
|
+
const s = le.current;
|
|
311
|
+
if (!s) return;
|
|
312
|
+
C.preventDefault();
|
|
313
|
+
const b = C.clientX - s.startX, L = C.clientY - s.startY, S = o.width, ie = o.height, V = ye ?? null, { x: _, y: oe, width: ee, height: F } = s.initialRect;
|
|
314
|
+
if (s.mode === "move") {
|
|
315
|
+
const ve = Math.max(0, S - ee), ae = Math.max(0, ie - F);
|
|
316
|
+
A(
|
|
317
|
+
O({
|
|
318
|
+
x: Math.max(0, Math.min(ve, _ + b)),
|
|
319
|
+
y: Math.max(0, Math.min(ae, oe + L)),
|
|
320
|
+
width: ee,
|
|
321
|
+
height: F
|
|
322
|
+
})
|
|
323
|
+
);
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
const M = s.mode;
|
|
327
|
+
let ne = _, be = oe, H = ee, J = F;
|
|
328
|
+
M.includes("e") && (H = ee + b), M.includes("w") && (ne = _ + b, H = ee - b), M.includes("s") && (J = F + L), M.includes("n") && (be = oe + L, J = F - L), V != null && V > 0 && (M === "e" || M === "w" ? (J = H / V, M.includes("n") && (be = oe + F - J)) : M === "n" || M === "s" ? (H = J * V, M.includes("w") && (ne = _ + ee - H)) : (J = H / V, M.includes("n") && (be = oe + F - J), M.includes("w") && (ne = _ + ee - H))), A(O({ x: ne, y: be, width: H, height: J }));
|
|
329
|
+
}, h = () => {
|
|
330
|
+
le.current = null;
|
|
331
|
+
};
|
|
332
|
+
return window.addEventListener("pointermove", n), window.addEventListener("pointerup", h), () => {
|
|
333
|
+
window.removeEventListener("pointermove", n), window.removeEventListener("pointerup", h);
|
|
334
|
+
};
|
|
335
|
+
}, [
|
|
336
|
+
r,
|
|
337
|
+
o.width,
|
|
338
|
+
o.height,
|
|
339
|
+
ye,
|
|
340
|
+
O
|
|
341
|
+
]), G(() => {
|
|
342
|
+
r && Ce(ye);
|
|
343
|
+
}, [r, ye, o, Ce]), /* @__PURE__ */ e(ct, { open: r, onOpenChange: c, children: /* @__PURE__ */ e(
|
|
344
|
+
dt,
|
|
345
|
+
{
|
|
346
|
+
className: "sm:cteditor-max-w-[860px] cteditor-max-w-[calc(100%-2rem)] cteditor-rounded-xl cteditor-overflow-hidden !cteditor-p-0 cteditor-border-none cteditor-bg-background",
|
|
347
|
+
onClick: (n) => n.stopPropagation(),
|
|
348
|
+
onPointerDown: (n) => n.stopPropagation(),
|
|
349
|
+
children: /* @__PURE__ */ a("div", { className: "cteditor-grid md:cteditor-grid-cols-[1.4fr_320px]", children: [
|
|
350
|
+
/* @__PURE__ */ e("div", { className: "cteditor-bg-background cteditor-p-4 md:cteditor-p-6 cteditor-flex cteditor-items-center cteditor-justify-center cropTransparentBg", children: /* @__PURE__ */ a(
|
|
351
|
+
"div",
|
|
352
|
+
{
|
|
353
|
+
ref: f,
|
|
354
|
+
className: "cteditor-relative cteditor-rounded-lg cteditor-bg-black/60 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-select-none cteditor-touch-none cteditor-w-full",
|
|
355
|
+
children: [
|
|
356
|
+
/* @__PURE__ */ e("div", { className: "cteditor-overflow-hidden cteditor-rounded-lg cteditor-flex cteditor-items-center cteditor-justify-center cteditor-w-full", children: x ? /* @__PURE__ */ e("div", { className: "cteditor-text-sm cteditor-text-foreground/50", children: "Failed to load image preview" }) : /* @__PURE__ */ e(
|
|
357
|
+
"img",
|
|
358
|
+
{
|
|
359
|
+
ref: D,
|
|
360
|
+
src: K,
|
|
361
|
+
alt: p || "Crop preview",
|
|
362
|
+
className: "cteditor-max-w-full cteditor-max-h-[460px] cteditor-w-auto cteditor-h-auto cteditor-select-none cteditor-block",
|
|
363
|
+
draggable: !1,
|
|
364
|
+
onLoad: () => {
|
|
365
|
+
w(!1), ue();
|
|
366
|
+
},
|
|
367
|
+
onError: () => {
|
|
368
|
+
w(!0);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
) }),
|
|
372
|
+
o.width > 0 && o.height > 0 && !x && /* @__PURE__ */ a(
|
|
373
|
+
"div",
|
|
374
|
+
{
|
|
375
|
+
className: "cteditor-absolute cteditor-border-2 cteditor-border-[#8a7df4] cteditor-cursor-move cteditor-select-none",
|
|
376
|
+
style: {
|
|
377
|
+
left: o.x + k.x,
|
|
378
|
+
top: o.y + k.y,
|
|
379
|
+
width: k.width,
|
|
380
|
+
height: k.height
|
|
381
|
+
},
|
|
382
|
+
children: [
|
|
383
|
+
/* @__PURE__ */ e(
|
|
384
|
+
"div",
|
|
385
|
+
{
|
|
386
|
+
className: "cteditor-absolute cteditor-inset-0 cteditor-grid cteditor-grid-cols-3 cteditor-grid-rows-3 cteditor-pointer-events-none",
|
|
387
|
+
"aria-hidden": !0,
|
|
388
|
+
children: Array.from({ length: 9 }).map((n, h) => /* @__PURE__ */ e(
|
|
389
|
+
"div",
|
|
390
|
+
{
|
|
391
|
+
className: "cteditor-border cteditor-border-[#8a7df4]/35"
|
|
392
|
+
},
|
|
393
|
+
h
|
|
394
|
+
))
|
|
395
|
+
}
|
|
396
|
+
),
|
|
397
|
+
/* @__PURE__ */ e(
|
|
398
|
+
"div",
|
|
399
|
+
{
|
|
400
|
+
className: "cteditor-absolute cteditor-inset-0 cteditor-pointer-events-auto",
|
|
401
|
+
onPointerDown: Z,
|
|
402
|
+
"aria-label": "Move crop area"
|
|
403
|
+
}
|
|
404
|
+
),
|
|
405
|
+
[
|
|
406
|
+
["n", "cteditor-top-0 cteditor-left-1/2 cteditor--translate-x-1/2 cteditor--translate-y-1/2", "cteditor-cursor-n-resize", "cteditor-w-8 cteditor-h-2"],
|
|
407
|
+
["s", "cteditor-bottom-0 cteditor-left-1/2 cteditor--translate-x-1/2 cteditor-translate-y-1/2", "cteditor-cursor-s-resize", "cteditor-w-8 cteditor-h-2"],
|
|
408
|
+
["e", "cteditor-right-0 cteditor-top-1/2 cteditor-translate-x-1/2 cteditor--translate-y-1/2", "cteditor-cursor-e-resize", "cteditor-w-2 cteditor-h-8"],
|
|
409
|
+
["w", "cteditor-left-0 cteditor-top-1/2 cteditor--translate-x-1/2 cteditor--translate-y-1/2", "cteditor-cursor-w-resize", "cteditor-w-2 cteditor-h-8"],
|
|
410
|
+
["nw", "cteditor-left-0 cteditor-top-0 cteditor--translate-x-1/2 cteditor--translate-y-1/2", "cteditor-cursor-nw-resize", "cteditor-size-4"],
|
|
411
|
+
["ne", "cteditor-right-0 cteditor-top-0 cteditor-translate-x-1/2 cteditor--translate-y-1/2", "cteditor-cursor-ne-resize", "cteditor-size-4"],
|
|
412
|
+
["sw", "cteditor-left-0 cteditor-bottom-0 cteditor--translate-x-1/2 cteditor-translate-y-1/2", "cteditor-cursor-sw-resize", "cteditor-size-4"],
|
|
413
|
+
["se", "cteditor-right-0 cteditor-bottom-0 cteditor-translate-x-1/2 cteditor-translate-y-1/2", "cteditor-cursor-se-resize", "cteditor-size-4"]
|
|
414
|
+
].map(([n, h, C, s]) => /* @__PURE__ */ e(
|
|
415
|
+
"div",
|
|
416
|
+
{
|
|
417
|
+
className: `cteditor-absolute cteditor-border-2 cteditor-border-white cteditor-bg-[#8a7df4] cteditor-rounded-sm cteditor-pointer-events-auto cteditor-shadow ${h} ${C} ${s}`,
|
|
418
|
+
onPointerDown: (b) => Ne(b, n),
|
|
419
|
+
"aria-label": `Resize ${n}`
|
|
420
|
+
},
|
|
421
|
+
n
|
|
422
|
+
))
|
|
423
|
+
]
|
|
424
|
+
}
|
|
425
|
+
)
|
|
426
|
+
]
|
|
427
|
+
}
|
|
428
|
+
) }),
|
|
429
|
+
/* @__PURE__ */ a("div", { className: "md:cteditor-w-[320px] cteditor-flex cteditor-flex-col dark:cteditor-bg-black/10 cteditor-bg-white/10 cteditor-border-l cteditor-border-foreground/5", children: [
|
|
430
|
+
/* @__PURE__ */ a(st, { className: "md:cteditor-pt-6 cteditor-pt-3 md:cteditor-px-6 cteditor-px-4 md:cteditor-pb-4 cteditor-pb-2 cteditor-relative cteditor-space-y-1", children: [
|
|
431
|
+
/* @__PURE__ */ e(lt, { className: "cteditor-text-2xl cteditor-font-semibold cteditor-text-foreground/90 cteditor-tracking-[-0.02em] cteditor-mb-1.5 max-md:cteditor-hidden", children: "Crop" }),
|
|
432
|
+
/* @__PURE__ */ e(ut, { className: "cteditor-text-sm cteditor-leading-normal cteditor-text-foreground/50 md:cteditor-max-w-[250px]", children: "Choose an aspect ratio and adjust the crop area, then click Apply." })
|
|
433
|
+
] }),
|
|
434
|
+
/* @__PURE__ */ a("div", { className: "cteditor-pt-1 md:cteditor-px-5.5 cteditor-px-3 cteditor-pb-0 cteditor-flex-1 cteditor-overflow-y-auto cteditor-space-y-4", children: [
|
|
435
|
+
/* @__PURE__ */ a("div", { children: [
|
|
436
|
+
/* @__PURE__ */ e("p", { className: "cteditor-font-mono cteditor-text-[10px] cteditor-font-medium cteditor-uppercase cteditor-tracking-[0.16em] cteditor-text-foreground/50 cteditor-mt-3.5 cteditor-mb-[9px]", children: "Aspect ratio" }),
|
|
437
|
+
/* @__PURE__ */ e("div", { className: "md:cteditor-grid md:cteditor-grid-cols-3 md:cteditor-gap-3 cteditor-gap-2 max-md:cteditor-flex max-md:cteditor-flex-wrap ", children: [
|
|
438
|
+
{ id: "freeform", label: "Freeform", shapeClass: "cteditor-w-4 cteditor-h-4 cteditor-border-dashed" },
|
|
439
|
+
{ id: "original", label: "Original", shapeClass: "cteditor-w-[18px] cteditor-h-[13.5px]" },
|
|
440
|
+
{ id: "1:1", label: "1:1", shapeClass: "cteditor-w-[15px] cteditor-h-[15px]" },
|
|
441
|
+
{ id: "4:3", label: "4:3", shapeClass: "cteditor-w-[18px] cteditor-h-[13.5px]" },
|
|
442
|
+
{ id: "16:9", label: "16:9", shapeClass: "cteditor-w-5 cteditor-h-[11.3px]" },
|
|
443
|
+
{ id: "3:4", label: "3:4", shapeClass: "cteditor-w-[13.5px] cteditor-h-[18px]" },
|
|
444
|
+
{ id: "9:16", label: "9:16", shapeClass: "cteditor-w-[11.3px] cteditor-h-[20px]" }
|
|
445
|
+
].map((n) => {
|
|
446
|
+
const h = E === n.id;
|
|
447
|
+
return /* @__PURE__ */ a(
|
|
448
|
+
"button",
|
|
449
|
+
{
|
|
450
|
+
type: "button",
|
|
451
|
+
onClick: () => {
|
|
452
|
+
P(n.id);
|
|
453
|
+
},
|
|
454
|
+
className: `group md:cteditor-h-[61px] cteditor-w-full cteditor-flex cteditor-flex-col cteditor-items-center cteditor-justify-center cteditor-gap-3 cteditor-rounded-xl cteditor-transition-all max-md:cteditor-w-fit max-md:cteditor-p-3 cteditor-bg-background cteditor-border cteditor-border-foreground/10 cteditor-text-foreground/70 hover:cteditor-crop-btn-glow ${h ? "cteditor-crop-btn-glow" : ""}`,
|
|
455
|
+
children: [
|
|
456
|
+
/* @__PURE__ */ e(
|
|
457
|
+
"div",
|
|
458
|
+
{
|
|
459
|
+
className: `cteditor-border-[1.6px] cteditor-rounded-[3px] max-md:cteditor-hidden cteditor-border-current ${h ? "cteditor-text-[#8a7df4]" : "cteditor-text-foreground/50 group-hover:cteditor-text-[#8a7df4]"} ${n.shapeClass}`
|
|
460
|
+
}
|
|
461
|
+
),
|
|
462
|
+
/* @__PURE__ */ e(
|
|
463
|
+
"span",
|
|
464
|
+
{
|
|
465
|
+
className: `cteditor-font-mono cteditor-text-[11px] cteditor-tracking-[0.02em] ${h ? "cteditor-text-foreground/90" : "cteditor-text-foreground/70 group-hover:cteditor-text-foreground/90"}`,
|
|
466
|
+
children: n.label
|
|
467
|
+
}
|
|
468
|
+
)
|
|
469
|
+
]
|
|
470
|
+
},
|
|
471
|
+
n.id
|
|
472
|
+
);
|
|
473
|
+
}) })
|
|
474
|
+
] }),
|
|
475
|
+
/* @__PURE__ */ a("div", { className: "cteditor-mt-1 cteditor-border cteditor-border-foreground/10 cteditor-rounded-[10px] ", children: [
|
|
476
|
+
/* @__PURE__ */ a("div", { className: "cteditor-flex cteditor-items-baseline cteditor-justify-between cteditor-gap-3 cteditor-py-2 cteditor-px-3", children: [
|
|
477
|
+
/* @__PURE__ */ e("span", { className: "cteditor-text-[11px] cteditor-text-foreground/50 cteditor-whitespace-nowrap", children: "Crop size" }),
|
|
478
|
+
/* @__PURE__ */ a("span", { className: "cteditor-font-mono cteditor-text-[13px] cteditor-text-[#8a7df4] cteditor-whitespace-nowrap cteditor-text-right", children: [
|
|
479
|
+
Math.round(k.width),
|
|
480
|
+
" ",
|
|
481
|
+
/* @__PURE__ */ e("span", { className: "cteditor-text-foreground/30", children: "×" }),
|
|
482
|
+
" ",
|
|
483
|
+
Math.round(k.height),
|
|
484
|
+
" ",
|
|
485
|
+
/* @__PURE__ */ e("span", { className: "cteditor-text-foreground/30", children: "px" })
|
|
486
|
+
] })
|
|
487
|
+
] }),
|
|
488
|
+
/* @__PURE__ */ a("div", { className: "cteditor-flex cteditor-items-baseline cteditor-justify-between cteditor-gap-3 cteditor-py-2 cteditor-px-3 cteditor-border-t cteditor-border-foreground/5", children: [
|
|
489
|
+
/* @__PURE__ */ e("span", { className: "cteditor-text-[11px] cteditor-text-foreground/50 cteditor-whitespace-nowrap", children: "Aspect ratio" }),
|
|
490
|
+
/* @__PURE__ */ e("span", { className: "cteditor-font-mono cteditor-text-[13px] cteditor-text-foreground/90 cteditor-whitespace-nowrap cteditor-text-right", children: E === "freeform" ? "Freeform" : E === "original" ? "Original" : E })
|
|
491
|
+
] })
|
|
492
|
+
] })
|
|
493
|
+
] }),
|
|
494
|
+
/* @__PURE__ */ a("div", { className: "cteditor-border-t cteditor-border-foreground/5 cteditor-pt-3.5 cteditor-px-4 cteditor-pb-4 cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-mt-4", children: [
|
|
495
|
+
/* @__PURE__ */ a(
|
|
496
|
+
Ie,
|
|
497
|
+
{
|
|
498
|
+
onClick: () => {
|
|
499
|
+
P("freeform"), Ce(null);
|
|
500
|
+
},
|
|
501
|
+
variant: "ghost",
|
|
502
|
+
children: [
|
|
503
|
+
/* @__PURE__ */ e(mt, { strokeWidth: 1.85, className: "!cteditor-size-4" }),
|
|
504
|
+
/* @__PURE__ */ e("span", { children: "Reset" })
|
|
505
|
+
]
|
|
506
|
+
}
|
|
507
|
+
),
|
|
508
|
+
/* @__PURE__ */ e("div", { className: "cteditor-flex-1" }),
|
|
509
|
+
/* @__PURE__ */ e(
|
|
510
|
+
Ie,
|
|
511
|
+
{
|
|
512
|
+
onClick: () => c(!1),
|
|
513
|
+
variant: "outline",
|
|
514
|
+
children: "Cancel"
|
|
515
|
+
}
|
|
516
|
+
),
|
|
517
|
+
/* @__PURE__ */ e(
|
|
518
|
+
Ie,
|
|
519
|
+
{
|
|
520
|
+
onClick: Le,
|
|
521
|
+
children: "Apply"
|
|
522
|
+
}
|
|
523
|
+
)
|
|
524
|
+
] })
|
|
525
|
+
] })
|
|
526
|
+
] })
|
|
527
|
+
}
|
|
528
|
+
) });
|
|
529
|
+
}
|
|
530
|
+
const Pe = /* @__PURE__ */ new Set(), at = lr("RIGHT_CLICK_IMAGE_COMMAND");
|
|
531
|
+
function Hr(r) {
|
|
532
|
+
if (!Pe.has(r))
|
|
533
|
+
throw new Promise((c) => {
|
|
534
|
+
const u = new Image();
|
|
535
|
+
u.src = r, u.onload = () => {
|
|
536
|
+
Pe.add(r), c(null);
|
|
537
|
+
}, u.onerror = () => {
|
|
538
|
+
Pe.add(r);
|
|
539
|
+
};
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
function Yr({
|
|
543
|
+
altText: r,
|
|
544
|
+
className: c,
|
|
545
|
+
imageRef: u,
|
|
546
|
+
src: p,
|
|
547
|
+
width: N,
|
|
548
|
+
height: y,
|
|
549
|
+
maxWidth: q,
|
|
550
|
+
onError: E,
|
|
551
|
+
onLoad: P
|
|
552
|
+
}) {
|
|
553
|
+
Hr(p);
|
|
554
|
+
const K = typeof N == "number", W = typeof y == "number", x = K && W, w = K ? N : "auto", f = W ? y : "auto";
|
|
555
|
+
return /* @__PURE__ */ e(
|
|
556
|
+
"img",
|
|
557
|
+
{
|
|
558
|
+
className: c || void 0,
|
|
559
|
+
src: p,
|
|
560
|
+
alt: r,
|
|
561
|
+
ref: u,
|
|
562
|
+
style: x ? {
|
|
563
|
+
width: w,
|
|
564
|
+
height: "auto",
|
|
565
|
+
aspectRatio: `${w} / ${f}`,
|
|
566
|
+
maxWidth: "100%"
|
|
567
|
+
} : K ? {
|
|
568
|
+
// Only width known (e.g. bogus height stripped from source HTML):
|
|
569
|
+
// fix the width and let the browser compute height naturally.
|
|
570
|
+
width: w,
|
|
571
|
+
height: "auto",
|
|
572
|
+
maxWidth: "100%"
|
|
573
|
+
} : W ? {
|
|
574
|
+
// Only height known: fix height, let browser compute width.
|
|
575
|
+
width: "auto",
|
|
576
|
+
height: f,
|
|
577
|
+
maxWidth: "100%"
|
|
578
|
+
} : {
|
|
579
|
+
// No dimensions specified - use original image size.
|
|
580
|
+
height: "auto"
|
|
581
|
+
},
|
|
582
|
+
onError: E,
|
|
583
|
+
onLoad: P,
|
|
584
|
+
draggable: "false"
|
|
585
|
+
}
|
|
586
|
+
);
|
|
587
|
+
}
|
|
588
|
+
function jr() {
|
|
589
|
+
return /* @__PURE__ */ e(
|
|
590
|
+
"img",
|
|
591
|
+
{
|
|
592
|
+
src: "",
|
|
593
|
+
style: {
|
|
594
|
+
height: 200,
|
|
595
|
+
opacity: 0.2,
|
|
596
|
+
width: 200
|
|
597
|
+
},
|
|
598
|
+
draggable: "false"
|
|
599
|
+
}
|
|
600
|
+
);
|
|
601
|
+
}
|
|
602
|
+
function Br(r, c = 12e3) {
|
|
603
|
+
return new Promise((u, p) => {
|
|
604
|
+
const N = new Image();
|
|
605
|
+
let y = !1;
|
|
606
|
+
const q = window.setTimeout(() => {
|
|
607
|
+
y || (y = !0, p(new Error("Image load timeout")));
|
|
608
|
+
}, c);
|
|
609
|
+
N.onload = () => {
|
|
610
|
+
y || (y = !0, window.clearTimeout(q), u());
|
|
611
|
+
}, N.onerror = () => {
|
|
612
|
+
y || (y = !0, window.clearTimeout(q), p(new Error("Image failed to load")));
|
|
613
|
+
}, N.src = r;
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
function mi({
|
|
617
|
+
src: r,
|
|
618
|
+
altText: c,
|
|
619
|
+
nodeKey: u,
|
|
620
|
+
width: p,
|
|
621
|
+
height: N,
|
|
622
|
+
maxWidth: y,
|
|
623
|
+
resizable: q,
|
|
624
|
+
showCaption: E,
|
|
625
|
+
caption: P,
|
|
626
|
+
captionsEnabled: K,
|
|
627
|
+
originalPrompt: W,
|
|
628
|
+
position: x = "none",
|
|
629
|
+
linkUrl: w
|
|
630
|
+
}) {
|
|
631
|
+
const f = X(null), D = X(null), [o, z, k] = Gt(u), [A, le] = v(!1), pe = X(!1), { isCollabActive: ye } = _t(), [l] = Ft(), [O, Ce] = v(null), ue = X(null), [Z, Ne] = v(!1), Le = Ut(), [n, h] = v(!1), C = "cteditor-absolute cteditor-flex cteditor-items-center cteditor-gap-1 z-10 cteditor-text-foreground cteditor-bg-accent cteditor-border cteditor-border-foreground/10 cteditor-rounded-lg cteditor-shadow-md cteditor-p-1 cteditor-h-10 cteditor-w-max", s = "cteditor-h-7 cteditor-w-7 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-md hover:cteditor-bg-foreground/10 cteditor-transition-all", b = "cteditor-w-px cteditor-h-5 cteditor-bg-foreground/10 cteditor-mx-0.5", L = "cteditor-bg-foreground/10 cteditor-text-foreground cteditor-font-medium", S = "cteditor-text-foreground/80 hover:cteditor-text-foreground", [ie, V] = v(""), [_, oe] = v(!1), [ee, F] = v(!1), [M, ne] = v(""), [be, H] = v(""), [J, ve] = v(!1), ae = X(null), [Ae, gt] = v(0), [ft, Te] = v(!1), Ge = X(null), [pt, ke] = v(null), [We, Re] = v(!1), [qe, Ve] = v(!1), me = X(null), Se = hr()?.apiKey, ze = Ae > 0 && Ae < 350;
|
|
632
|
+
ot(() => {
|
|
633
|
+
if (!o || !ge(O) || Z) {
|
|
634
|
+
ke(null);
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
const t = Ge.current, i = l.getRootElement(), d = t?.parentElement;
|
|
638
|
+
if (!t || !i || !d) {
|
|
639
|
+
ke(null);
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
const m = i.getBoundingClientRect(), g = d.getBoundingClientRect(), $ = t.getBoundingClientRect(), T = 8, U = $.width;
|
|
643
|
+
if (U <= 0) {
|
|
644
|
+
ke(null);
|
|
645
|
+
return;
|
|
646
|
+
}
|
|
647
|
+
if (ze) {
|
|
648
|
+
const he = g.left + g.width / 2 - U / 2, Q = Math.max(m.left + T, Math.min(he, m.right - T - U));
|
|
649
|
+
ke({
|
|
650
|
+
left: Q - g.left,
|
|
651
|
+
bottom: 0,
|
|
652
|
+
right: "auto",
|
|
653
|
+
transform: "translateY(100%) translateY(4px)"
|
|
654
|
+
});
|
|
655
|
+
} else {
|
|
656
|
+
const he = g.right - T - U, Q = Math.max(m.left + T, Math.min(he, m.right - T - U));
|
|
657
|
+
ke({
|
|
658
|
+
left: Q - g.left,
|
|
659
|
+
top: T,
|
|
660
|
+
right: "auto"
|
|
661
|
+
});
|
|
662
|
+
}
|
|
663
|
+
}, [o, O, Z, ze, l, Ae]), G(() => {
|
|
664
|
+
if (f.current) {
|
|
665
|
+
const t = () => {
|
|
666
|
+
pe.current || f.current && gt(f.current.offsetWidth);
|
|
667
|
+
};
|
|
668
|
+
t();
|
|
669
|
+
const i = new ResizeObserver(t);
|
|
670
|
+
return i.observe(f.current), () => i.disconnect();
|
|
671
|
+
}
|
|
672
|
+
}, [p, N, o]), ot(() => {
|
|
673
|
+
if ((x === "left" || x === "right") && typeof p == "number" && f.current) {
|
|
674
|
+
const t = f.current.closest(".editor-image"), i = t?.parentElement, d = l.getRootElement(), m = d ? d.getBoundingClientRect().width : p + 32, g = `${Math.min(p + 32, m)}px`;
|
|
675
|
+
return t && (t.style.removeProperty("display"), t.style.setProperty("max-width", g, "important")), i && i.style.setProperty("max-width", g, "important"), () => {
|
|
676
|
+
t && (t.style.removeProperty("max-width"), t.style.removeProperty("display")), i && i.style.removeProperty("max-width");
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
}, [x, p, l]);
|
|
680
|
+
const Oe = R(
|
|
681
|
+
(t) => {
|
|
682
|
+
const i = ce();
|
|
683
|
+
return o && ge(i) && (t.preventDefault(), l.update(() => {
|
|
684
|
+
i.getNodes().forEach((m) => {
|
|
685
|
+
if (re(m)) {
|
|
686
|
+
const g = m.getParent();
|
|
687
|
+
m.remove(), g && Ke(g) && g.getChildrenSize() === 0 && g.setFormat("left");
|
|
688
|
+
}
|
|
689
|
+
});
|
|
690
|
+
})), !1;
|
|
691
|
+
},
|
|
692
|
+
[l, o]
|
|
693
|
+
), Je = R(
|
|
694
|
+
(t) => {
|
|
695
|
+
const i = ce(), d = D.current;
|
|
696
|
+
if (o && ge(i) && i.getNodes().length === 1) {
|
|
697
|
+
if (E)
|
|
698
|
+
return we(null), t.preventDefault(), P.focus(), !0;
|
|
699
|
+
if (d !== null && d !== document.activeElement)
|
|
700
|
+
return t.preventDefault(), d.focus(), !0;
|
|
701
|
+
}
|
|
702
|
+
return !1;
|
|
703
|
+
},
|
|
704
|
+
[P, o, E]
|
|
705
|
+
), Qe = R(
|
|
706
|
+
(t) => ue.current === P || D.current === t.target ? (we(null), l.update(() => {
|
|
707
|
+
z(!0);
|
|
708
|
+
const i = l.getRootElement();
|
|
709
|
+
i !== null && i.focus();
|
|
710
|
+
}), !0) : !1,
|
|
711
|
+
[P, l, z]
|
|
712
|
+
), _e = R(
|
|
713
|
+
(t) => {
|
|
714
|
+
const i = t;
|
|
715
|
+
if (A)
|
|
716
|
+
return !0;
|
|
717
|
+
const d = i.target;
|
|
718
|
+
if (d.closest("button") && f.current && d.closest(".editor-image") === f.current.closest(".editor-image"))
|
|
719
|
+
return !0;
|
|
720
|
+
const m = d === f.current;
|
|
721
|
+
let g = !1;
|
|
722
|
+
if (!m && f.current) {
|
|
723
|
+
const $ = f.current.getBoundingClientRect();
|
|
724
|
+
g = i.clientX >= $.left && i.clientX <= $.right && i.clientY >= $.top && i.clientY <= $.bottom;
|
|
725
|
+
}
|
|
726
|
+
return m || g ? (i.shiftKey ? z(!o) : (k(), z(!0)), !0) : !1;
|
|
727
|
+
},
|
|
728
|
+
[A, o, z, k]
|
|
729
|
+
), Fe = R(
|
|
730
|
+
(t) => {
|
|
731
|
+
l.getEditorState().read(() => {
|
|
732
|
+
const i = ce();
|
|
733
|
+
t.target.tagName === "IMG" && Qt(i) && i.getNodes().length === 1 && l.dispatchCommand(
|
|
734
|
+
at,
|
|
735
|
+
t
|
|
736
|
+
);
|
|
737
|
+
});
|
|
738
|
+
},
|
|
739
|
+
[l]
|
|
740
|
+
);
|
|
741
|
+
G(() => {
|
|
742
|
+
let t = !0;
|
|
743
|
+
const i = l.getRootElement(), d = qt(
|
|
744
|
+
l.registerUpdateListener(({ editorState: m }) => {
|
|
745
|
+
t && Ce(m.read(() => ce()));
|
|
746
|
+
}),
|
|
747
|
+
l.registerCommand(
|
|
748
|
+
Zt,
|
|
749
|
+
(m, g) => (ue.current = g, !1),
|
|
750
|
+
de
|
|
751
|
+
),
|
|
752
|
+
l.registerCommand(
|
|
753
|
+
er,
|
|
754
|
+
_e,
|
|
755
|
+
de
|
|
756
|
+
),
|
|
757
|
+
l.registerCommand(
|
|
758
|
+
at,
|
|
759
|
+
_e,
|
|
760
|
+
de
|
|
761
|
+
),
|
|
762
|
+
l.registerCommand(
|
|
763
|
+
tr,
|
|
764
|
+
(m) => m.target === f.current ? (m.preventDefault(), !0) : !1,
|
|
765
|
+
de
|
|
766
|
+
),
|
|
767
|
+
l.registerCommand(
|
|
768
|
+
rr,
|
|
769
|
+
Oe,
|
|
770
|
+
de
|
|
771
|
+
),
|
|
772
|
+
l.registerCommand(
|
|
773
|
+
ir,
|
|
774
|
+
Oe,
|
|
775
|
+
de
|
|
776
|
+
),
|
|
777
|
+
l.registerCommand(or, Je, de),
|
|
778
|
+
l.registerCommand(
|
|
779
|
+
nr,
|
|
780
|
+
Qe,
|
|
781
|
+
de
|
|
782
|
+
)
|
|
783
|
+
);
|
|
784
|
+
return i?.addEventListener("contextmenu", Fe), () => {
|
|
785
|
+
t = !1, d(), i?.removeEventListener("contextmenu", Fe);
|
|
786
|
+
};
|
|
787
|
+
}, [
|
|
788
|
+
k,
|
|
789
|
+
l,
|
|
790
|
+
A,
|
|
791
|
+
o,
|
|
792
|
+
u,
|
|
793
|
+
Oe,
|
|
794
|
+
Je,
|
|
795
|
+
Qe,
|
|
796
|
+
_e,
|
|
797
|
+
Fe,
|
|
798
|
+
z
|
|
799
|
+
]);
|
|
800
|
+
const bt = () => {
|
|
801
|
+
l.update(() => {
|
|
802
|
+
const t = se(u);
|
|
803
|
+
re(t) && t.setShowCaption(!0);
|
|
804
|
+
});
|
|
805
|
+
}, xt = (t, i) => {
|
|
806
|
+
pe.current = !1, setTimeout(() => {
|
|
807
|
+
le(!1);
|
|
808
|
+
}, 200), l.update(() => {
|
|
809
|
+
const d = se(u);
|
|
810
|
+
re(d) && d.setWidthAndHeight(t, i);
|
|
811
|
+
});
|
|
812
|
+
}, wt = () => {
|
|
813
|
+
pe.current = !0, le(!0);
|
|
814
|
+
}, yt = (t) => {
|
|
815
|
+
if (t.preventDefault(), t.stopPropagation(), r.startsWith("data:")) {
|
|
816
|
+
const i = window.open("", "_blank");
|
|
817
|
+
i && (i.document.write(`
|
|
818
|
+
<!DOCTYPE html>
|
|
819
|
+
<html>
|
|
820
|
+
<head>
|
|
821
|
+
<title>${c || "Image"}</title>
|
|
822
|
+
<style>
|
|
823
|
+
body {
|
|
824
|
+
margin: 0;
|
|
825
|
+
display: flex;
|
|
826
|
+
justify-content: center;
|
|
827
|
+
align-items: center;
|
|
828
|
+
min-height: 100vh;
|
|
829
|
+
background-color: #1a1a1a;
|
|
830
|
+
}
|
|
831
|
+
img {
|
|
832
|
+
max-width: 100%;
|
|
833
|
+
max-height: 100vh;
|
|
834
|
+
object-fit: contain;
|
|
835
|
+
}
|
|
836
|
+
</style>
|
|
837
|
+
</head>
|
|
838
|
+
<body>
|
|
839
|
+
<img src="${r}" alt="${c || "Image"}" />
|
|
840
|
+
</body>
|
|
841
|
+
</html>
|
|
842
|
+
`), i.document.close());
|
|
843
|
+
} else
|
|
844
|
+
window.open(r, "_blank");
|
|
845
|
+
}, Ct = (t) => {
|
|
846
|
+
t.preventDefault(), t.stopPropagation(), l.update(() => {
|
|
847
|
+
const i = se(u);
|
|
848
|
+
if (re(i)) {
|
|
849
|
+
const d = i.getParent();
|
|
850
|
+
i.remove(), d && Ke(d) && d.getChildrenSize() === 0 && d.setFormat("left");
|
|
851
|
+
}
|
|
852
|
+
});
|
|
853
|
+
}, xe = (t, i) => {
|
|
854
|
+
t.preventDefault(), t.stopPropagation(), l.update(() => {
|
|
855
|
+
const d = se(u);
|
|
856
|
+
if (re(d)) {
|
|
857
|
+
d.setPosition(i);
|
|
858
|
+
const m = d.getParent();
|
|
859
|
+
m && Ke(m) && (i === "left" ? m.setFormat("left") : i === "right" ? m.setFormat("right") : m.setFormat(""));
|
|
860
|
+
}
|
|
861
|
+
});
|
|
862
|
+
}, Nt = (t) => {
|
|
863
|
+
t.preventDefault(), t.stopPropagation(), h(!n);
|
|
864
|
+
}, vt = R((t) => {
|
|
865
|
+
t.preventDefault(), t.stopPropagation(), Te(!0);
|
|
866
|
+
}, []), kt = R(
|
|
867
|
+
(t) => {
|
|
868
|
+
t.preventDefault(), t.stopPropagation();
|
|
869
|
+
const i = Ee(r);
|
|
870
|
+
if (!(fe(r) && r !== i) && !(typeof p == "number" || typeof N == "number"))
|
|
871
|
+
return;
|
|
872
|
+
l.update(
|
|
873
|
+
() => {
|
|
874
|
+
const $ = se(u);
|
|
875
|
+
if (!re($)) return;
|
|
876
|
+
$.setSrc(i), $.setWidthAndHeight("inherit", "inherit");
|
|
877
|
+
const T = ce();
|
|
878
|
+
T && we(T.clone());
|
|
879
|
+
},
|
|
880
|
+
{ tag: "image-reset" }
|
|
881
|
+
);
|
|
882
|
+
const g = f.current;
|
|
883
|
+
g && requestAnimationFrame(() => {
|
|
884
|
+
g.src = i, g.style.removeProperty("width"), g.style.removeProperty("height");
|
|
885
|
+
}), I.success("Image reset to original size and crop");
|
|
886
|
+
},
|
|
887
|
+
[l, u, r, p, N]
|
|
888
|
+
), Rt = R(
|
|
889
|
+
async (t) => {
|
|
890
|
+
let i = r;
|
|
891
|
+
if (fe(r))
|
|
892
|
+
i = Ee(r);
|
|
893
|
+
else {
|
|
894
|
+
if (!Se) {
|
|
895
|
+
I.error("API key is required to upload and crop external images.");
|
|
896
|
+
return;
|
|
897
|
+
}
|
|
898
|
+
const m = I.loading("Uploading image…");
|
|
899
|
+
try {
|
|
900
|
+
i = (await gr.post(
|
|
901
|
+
fr.project.fileUploadFromUrl,
|
|
902
|
+
{ url: r, prefix: "uploads" },
|
|
903
|
+
{ headers: { "x-api-key": Se } }
|
|
904
|
+
)).data.fileUrl, I.dismiss(m);
|
|
905
|
+
} catch {
|
|
906
|
+
I.dismiss(m), I.error("Failed to upload image. Try again.");
|
|
907
|
+
return;
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
const d = _r(i, t);
|
|
911
|
+
if (d === i) {
|
|
912
|
+
I.error("Cropping is only supported for images hosted on the CDN.");
|
|
913
|
+
return;
|
|
914
|
+
}
|
|
915
|
+
Re(!0), me.current = d;
|
|
916
|
+
try {
|
|
917
|
+
await Br(d), Pe.add(d), l.update(() => {
|
|
918
|
+
const m = se(u);
|
|
919
|
+
if (!re(m)) return;
|
|
920
|
+
m.setSrc(d), m.setWidthAndHeight(t.width, t.height);
|
|
921
|
+
const g = ce();
|
|
922
|
+
g && we(g.clone());
|
|
923
|
+
}), I.success("Image cropped");
|
|
924
|
+
} catch {
|
|
925
|
+
me.current = null, Re(!1), I.error("Crop failed to load. Showing original image.");
|
|
926
|
+
}
|
|
927
|
+
},
|
|
928
|
+
[l, u, r, Se]
|
|
929
|
+
), Et = R(() => {
|
|
930
|
+
w && !o && (ae.current = setTimeout(() => {
|
|
931
|
+
ve(!0);
|
|
932
|
+
}, 300));
|
|
933
|
+
}, [w, o]), It = R(() => {
|
|
934
|
+
ae.current && (clearTimeout(ae.current), ae.current = null), ve(!1);
|
|
935
|
+
}, []), Ze = R((t) => {
|
|
936
|
+
t.preventDefault(), t.stopPropagation(), w && window.open(w, "_blank", "noopener,noreferrer");
|
|
937
|
+
}, [w]);
|
|
938
|
+
G(() => () => {
|
|
939
|
+
ae.current && clearTimeout(ae.current);
|
|
940
|
+
}, []), G(() => {
|
|
941
|
+
o || Te(!1);
|
|
942
|
+
}, [o]), G(() => {
|
|
943
|
+
Ne(!1), Ve(!1);
|
|
944
|
+
}, [r]);
|
|
945
|
+
const et = async () => {
|
|
946
|
+
if (!ie.trim() || _) return;
|
|
947
|
+
oe(!0);
|
|
948
|
+
const t = I.loading("Refining image...", {
|
|
949
|
+
description: "This may take 10-30 seconds. Please wait."
|
|
950
|
+
});
|
|
951
|
+
try {
|
|
952
|
+
let i = ie.trim();
|
|
953
|
+
const m = ie.trim().replace(/^(add|also add|include|with|and)\s+(some|a|an)\s+/gi, "").replace(/^(add|also add|include|with|and)\s+/gi, "").trim(), g = (Q) => {
|
|
954
|
+
const je = Q.toLowerCase();
|
|
955
|
+
return [
|
|
956
|
+
"article",
|
|
957
|
+
"write",
|
|
958
|
+
"blog",
|
|
959
|
+
"post",
|
|
960
|
+
"essay",
|
|
961
|
+
"content",
|
|
962
|
+
"generate an article",
|
|
963
|
+
"create an article",
|
|
964
|
+
"write about",
|
|
965
|
+
"and add some pictures",
|
|
966
|
+
"with pictures",
|
|
967
|
+
"with images",
|
|
968
|
+
"add some images",
|
|
969
|
+
"include images",
|
|
970
|
+
"include pictures"
|
|
971
|
+
].some(($e) => je.includes($e));
|
|
972
|
+
};
|
|
973
|
+
let $ = "";
|
|
974
|
+
if (W && W.trim()) {
|
|
975
|
+
const Q = W.trim();
|
|
976
|
+
g(Q) && c && c !== "Generated image" && c.trim() ? $ = c.trim() : $ = Q;
|
|
977
|
+
} else c && c !== "Generated image" && c.trim() && ($ = c.trim());
|
|
978
|
+
$ ? i = `${$} with ${m}` : i = m;
|
|
979
|
+
const T = await fetch(`${$r}/agent/stream`, {
|
|
980
|
+
method: "POST",
|
|
981
|
+
headers: { "Content-Type": "application/json" },
|
|
982
|
+
body: JSON.stringify({
|
|
983
|
+
type: "general",
|
|
984
|
+
query: `Generate Image: ${i}`,
|
|
985
|
+
model: "openai",
|
|
986
|
+
api_key: Se || ""
|
|
987
|
+
})
|
|
988
|
+
});
|
|
989
|
+
if (!T.ok)
|
|
990
|
+
throw new Error(`Image service error: ${T.status}`);
|
|
991
|
+
const U = T.body?.getReader(), Ye = new TextDecoder();
|
|
992
|
+
if (!U) throw new Error("Stream reader not available");
|
|
993
|
+
let he = null;
|
|
994
|
+
e: for (; ; ) {
|
|
995
|
+
const { done: Q, value: je } = await U.read();
|
|
996
|
+
if (Q) break;
|
|
997
|
+
const rt = Ye.decode(je, { stream: !0 }).split(`
|
|
998
|
+
`);
|
|
999
|
+
for (const $e of rt) {
|
|
1000
|
+
if (!$e.startsWith("data: ")) continue;
|
|
1001
|
+
const Be = $e.slice(6).trim();
|
|
1002
|
+
if (!(!Be || Be === "[DONE]"))
|
|
1003
|
+
try {
|
|
1004
|
+
const te = JSON.parse(Be);
|
|
1005
|
+
if (te.type === "image_ready") {
|
|
1006
|
+
he = te.url, U.cancel();
|
|
1007
|
+
break e;
|
|
1008
|
+
} else {
|
|
1009
|
+
if (te.type === "image_failed")
|
|
1010
|
+
throw U.cancel(), new Error(te.error || "Image generation failed");
|
|
1011
|
+
if (te.type === "error")
|
|
1012
|
+
throw U.cancel(), new Error(te.message || "Image generation failed");
|
|
1013
|
+
}
|
|
1014
|
+
} catch (te) {
|
|
1015
|
+
if (te instanceof SyntaxError) continue;
|
|
1016
|
+
throw te;
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
if (!he)
|
|
1021
|
+
throw new Error("Failed to generate image - no image received");
|
|
1022
|
+
I.dismiss(t), I.success("Image refined successfully!", {
|
|
1023
|
+
description: "Compare the images and choose which to keep."
|
|
1024
|
+
}), ne(he), H(i), F(!0), V(""), h(!1);
|
|
1025
|
+
} catch (i) {
|
|
1026
|
+
if (I.dismiss(t), i instanceof Mr) {
|
|
1027
|
+
const d = i.code === "API_KEYS_DISABLED" ? "API Keys Disabled" : "API Key Required";
|
|
1028
|
+
I.error(d, {
|
|
1029
|
+
description: i.message,
|
|
1030
|
+
duration: 8e3
|
|
1031
|
+
});
|
|
1032
|
+
} else i instanceof Dr ? I.error("Credits Issue", {
|
|
1033
|
+
description: i.message,
|
|
1034
|
+
duration: 8e3
|
|
1035
|
+
}) : I.error("Failed to refine image", {
|
|
1036
|
+
description: i instanceof Error ? i.message : "Unknown error. Please try again."
|
|
1037
|
+
});
|
|
1038
|
+
} finally {
|
|
1039
|
+
oe(!1);
|
|
1040
|
+
}
|
|
1041
|
+
}, Pt = () => {
|
|
1042
|
+
l.update(() => {
|
|
1043
|
+
const t = se(u);
|
|
1044
|
+
if (re(t)) {
|
|
1045
|
+
t.setSrc(M), t.setOriginalPrompt(be);
|
|
1046
|
+
const i = ce();
|
|
1047
|
+
i && we(i.clone());
|
|
1048
|
+
}
|
|
1049
|
+
}), F(!1), ne(""), H(""), I.success("Image replaced successfully!", {
|
|
1050
|
+
description: "The image has been updated with the refined version."
|
|
1051
|
+
});
|
|
1052
|
+
}, St = () => {
|
|
1053
|
+
F(!1), ne(""), H("");
|
|
1054
|
+
}, $t = o && ge(O) && !A, tt = (o || A) && Le, He = Ee(r), Mt = R(() => {
|
|
1055
|
+
me.current && r === me.current && (Pe.add(r), me.current = null, Re(!1));
|
|
1056
|
+
}, [r]), Dt = R(() => {
|
|
1057
|
+
if (!qe && fe(r) && r !== He) {
|
|
1058
|
+
Ve(!0), Ne(!1), Re(!1), me.current = null, l.update(() => {
|
|
1059
|
+
const i = se(u);
|
|
1060
|
+
if (!re(i)) return;
|
|
1061
|
+
i.setSrc(He);
|
|
1062
|
+
const d = ce();
|
|
1063
|
+
d && we(d.clone());
|
|
1064
|
+
}), I.error("Cropped image failed. Showing original image instead.");
|
|
1065
|
+
return;
|
|
1066
|
+
}
|
|
1067
|
+
Re(!1), me.current = null, Ne(!0);
|
|
1068
|
+
}, [qe, r, He, l, u]), Lt = () => x === "left" || x === "right" ? {
|
|
1069
|
+
position: "relative",
|
|
1070
|
+
display: "block",
|
|
1071
|
+
width: "100%"
|
|
1072
|
+
// Fill the floated container
|
|
1073
|
+
} : x === "full" ? {
|
|
1074
|
+
position: "relative",
|
|
1075
|
+
display: "block",
|
|
1076
|
+
width: "fit-content",
|
|
1077
|
+
margin: "0 auto"
|
|
1078
|
+
} : x === "inline-left" ? {
|
|
1079
|
+
position: "relative",
|
|
1080
|
+
display: "block",
|
|
1081
|
+
width: "fit-content",
|
|
1082
|
+
marginRight: "auto"
|
|
1083
|
+
} : x === "inline-center" ? {
|
|
1084
|
+
position: "relative",
|
|
1085
|
+
display: "block",
|
|
1086
|
+
width: "fit-content",
|
|
1087
|
+
margin: "0 auto"
|
|
1088
|
+
} : x === "inline-right" ? {
|
|
1089
|
+
position: "relative",
|
|
1090
|
+
display: "block",
|
|
1091
|
+
width: "fit-content",
|
|
1092
|
+
marginLeft: "auto"
|
|
1093
|
+
} : {
|
|
1094
|
+
position: "relative",
|
|
1095
|
+
display: "inline-block"
|
|
1096
|
+
}, At = R(
|
|
1097
|
+
(t) => {
|
|
1098
|
+
if (A || t.target.closest("button"))
|
|
1099
|
+
return;
|
|
1100
|
+
const d = t.target === f.current;
|
|
1101
|
+
let m = !1;
|
|
1102
|
+
if (!d && f.current) {
|
|
1103
|
+
const g = f.current.getBoundingClientRect();
|
|
1104
|
+
m = t.clientX >= g.left && t.clientX <= g.right && t.clientY >= g.top && t.clientY <= g.bottom;
|
|
1105
|
+
}
|
|
1106
|
+
!d && !m || (t.stopPropagation(), t.shiftKey ? z(!o) : (k(), z(!0)));
|
|
1107
|
+
},
|
|
1108
|
+
[A, o, z, k]
|
|
1109
|
+
);
|
|
1110
|
+
return /* @__PURE__ */ e(ur, { fallback: null, children: /* @__PURE__ */ a(Me, { children: [
|
|
1111
|
+
/* @__PURE__ */ a(
|
|
1112
|
+
"div",
|
|
1113
|
+
{
|
|
1114
|
+
draggable: $t,
|
|
1115
|
+
style: Lt(),
|
|
1116
|
+
onClick: At,
|
|
1117
|
+
onMouseEnter: Et,
|
|
1118
|
+
onMouseLeave: It,
|
|
1119
|
+
children: [
|
|
1120
|
+
Z ? /* @__PURE__ */ e(jr, {}) : /* @__PURE__ */ e(
|
|
1121
|
+
Yr,
|
|
1122
|
+
{
|
|
1123
|
+
className: tt ? `focused ${ge(O) ? "draggable" : ""}` : w ? "cteditor-cursor-pointer" : null,
|
|
1124
|
+
src: r,
|
|
1125
|
+
altText: c,
|
|
1126
|
+
imageRef: f,
|
|
1127
|
+
width: p,
|
|
1128
|
+
height: N,
|
|
1129
|
+
maxWidth: y,
|
|
1130
|
+
onLoad: Mt,
|
|
1131
|
+
onError: Dt
|
|
1132
|
+
}
|
|
1133
|
+
),
|
|
1134
|
+
We && !Z && /* @__PURE__ */ a("div", { className: "cteditor-absolute cteditor-inset-0 cteditor-flex cteditor-flex-col cteditor-items-center cteditor-justify-center cteditor-rounded-lg cteditor-bg-background/50 cteditor-backdrop-blur-[1px] cteditor-pointer-events-none", children: [
|
|
1135
|
+
/* @__PURE__ */ e(pr, { className: "cteditor-w-10 cteditor-h-10 cteditor-text-foreground cteditor-animate-spin cteditor-mb-2", "aria-hidden": !0 }),
|
|
1136
|
+
/* @__PURE__ */ e("span", { className: "cteditor-text-sm cteditor-font-medium cteditor-text-foreground", children: "Applying crop..." })
|
|
1137
|
+
] }),
|
|
1138
|
+
J && w && !o && /* @__PURE__ */ a(
|
|
1139
|
+
"div",
|
|
1140
|
+
{
|
|
1141
|
+
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",
|
|
1142
|
+
style: { zIndex: 10 },
|
|
1143
|
+
children: [
|
|
1144
|
+
/* @__PURE__ */ e(Tr, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-muted-foreground cteditor-flex-shrink-0" }),
|
|
1145
|
+
/* @__PURE__ */ e("span", { className: "cteditor-text-sm cteditor-text-foreground cteditor-truncate cteditor-flex-1", children: w }),
|
|
1146
|
+
/* @__PURE__ */ e(
|
|
1147
|
+
"button",
|
|
1148
|
+
{
|
|
1149
|
+
type: "button",
|
|
1150
|
+
onClick: Ze,
|
|
1151
|
+
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",
|
|
1152
|
+
children: "Open"
|
|
1153
|
+
}
|
|
1154
|
+
)
|
|
1155
|
+
]
|
|
1156
|
+
}
|
|
1157
|
+
),
|
|
1158
|
+
o && ge(O) && !Z && !We && /* @__PURE__ */ e(br, { delayDuration: 300, children: /* @__PURE__ */ a(
|
|
1159
|
+
"div",
|
|
1160
|
+
{
|
|
1161
|
+
ref: Ge,
|
|
1162
|
+
className: C,
|
|
1163
|
+
style: pt ?? (ze ? { left: "50%", transform: "translateX(-50%) translateY(100%) translateY(4px)", bottom: 0 } : { top: 8, right: 8 }),
|
|
1164
|
+
children: [
|
|
1165
|
+
/* @__PURE__ */ a(Y, { children: [
|
|
1166
|
+
/* @__PURE__ */ e(j, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1167
|
+
"button",
|
|
1168
|
+
{
|
|
1169
|
+
type: "button",
|
|
1170
|
+
onClick: (t) => xe(t, "left"),
|
|
1171
|
+
className: `${s} ${x === "left" ? L : S}`,
|
|
1172
|
+
"aria-label": "Wrap text left",
|
|
1173
|
+
children: /* @__PURE__ */ e(xr, {})
|
|
1174
|
+
}
|
|
1175
|
+
) }),
|
|
1176
|
+
/* @__PURE__ */ e(B, { children: "Wrap text left" })
|
|
1177
|
+
] }),
|
|
1178
|
+
/* @__PURE__ */ a(Y, { children: [
|
|
1179
|
+
/* @__PURE__ */ e(j, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1180
|
+
"button",
|
|
1181
|
+
{
|
|
1182
|
+
type: "button",
|
|
1183
|
+
onClick: (t) => xe(t, "right"),
|
|
1184
|
+
className: `${s} ${x === "right" ? L : S}`,
|
|
1185
|
+
"aria-label": "Wrap text right",
|
|
1186
|
+
children: /* @__PURE__ */ e(wr, {})
|
|
1187
|
+
}
|
|
1188
|
+
) }),
|
|
1189
|
+
/* @__PURE__ */ e(B, { children: "Wrap text right" })
|
|
1190
|
+
] }),
|
|
1191
|
+
/* @__PURE__ */ e("div", { className: b }),
|
|
1192
|
+
/* @__PURE__ */ a(Y, { children: [
|
|
1193
|
+
/* @__PURE__ */ e(j, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1194
|
+
"button",
|
|
1195
|
+
{
|
|
1196
|
+
type: "button",
|
|
1197
|
+
onClick: (t) => xe(t, "inline-left"),
|
|
1198
|
+
className: `${s} ${x === "inline-left" ? L : S}`,
|
|
1199
|
+
"aria-label": "Align left",
|
|
1200
|
+
children: /* @__PURE__ */ e(yr, {})
|
|
1201
|
+
}
|
|
1202
|
+
) }),
|
|
1203
|
+
/* @__PURE__ */ e(B, { children: "Align left (no text wrap)" })
|
|
1204
|
+
] }),
|
|
1205
|
+
/* @__PURE__ */ a(Y, { children: [
|
|
1206
|
+
/* @__PURE__ */ e(j, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1207
|
+
"button",
|
|
1208
|
+
{
|
|
1209
|
+
type: "button",
|
|
1210
|
+
onClick: (t) => xe(t, "inline-center"),
|
|
1211
|
+
className: `${s} ${x === "inline-center" || x === "full" ? L : S}`,
|
|
1212
|
+
"aria-label": "Align center",
|
|
1213
|
+
children: /* @__PURE__ */ e(Cr, {})
|
|
1214
|
+
}
|
|
1215
|
+
) }),
|
|
1216
|
+
/* @__PURE__ */ e(B, { children: "Align center (no text wrap)" })
|
|
1217
|
+
] }),
|
|
1218
|
+
/* @__PURE__ */ a(Y, { children: [
|
|
1219
|
+
/* @__PURE__ */ e(j, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1220
|
+
"button",
|
|
1221
|
+
{
|
|
1222
|
+
type: "button",
|
|
1223
|
+
onClick: (t) => xe(t, "inline-right"),
|
|
1224
|
+
className: `${s} ${x === "inline-right" ? L : S}`,
|
|
1225
|
+
"aria-label": "Align right",
|
|
1226
|
+
children: /* @__PURE__ */ e(Nr, {})
|
|
1227
|
+
}
|
|
1228
|
+
) }),
|
|
1229
|
+
/* @__PURE__ */ e(B, { children: "Align right (no text wrap)" })
|
|
1230
|
+
] }),
|
|
1231
|
+
/* @__PURE__ */ e("div", { className: b }),
|
|
1232
|
+
/* @__PURE__ */ a(Y, { children: [
|
|
1233
|
+
/* @__PURE__ */ e(j, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1234
|
+
"button",
|
|
1235
|
+
{
|
|
1236
|
+
type: "button",
|
|
1237
|
+
onClick: (t) => xe(t, "none"),
|
|
1238
|
+
className: `${s} ${x === "none" ? L : S}`,
|
|
1239
|
+
"aria-label": "Inline",
|
|
1240
|
+
children: /* @__PURE__ */ e(vr, { className: "cteditor-w-4 cteditor-h-4" })
|
|
1241
|
+
}
|
|
1242
|
+
) }),
|
|
1243
|
+
/* @__PURE__ */ e(B, { children: "Inline with text" })
|
|
1244
|
+
] }),
|
|
1245
|
+
!r.startsWith("data:") && !r.toLowerCase().endsWith(".svg") && /* @__PURE__ */ a(Me, { children: [
|
|
1246
|
+
/* @__PURE__ */ e("div", { className: b }),
|
|
1247
|
+
/* @__PURE__ */ a(Y, { children: [
|
|
1248
|
+
/* @__PURE__ */ e(j, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1249
|
+
"button",
|
|
1250
|
+
{
|
|
1251
|
+
type: "button",
|
|
1252
|
+
onClick: vt,
|
|
1253
|
+
className: `${s} ${S}`,
|
|
1254
|
+
"aria-label": "Crop image",
|
|
1255
|
+
children: /* @__PURE__ */ e(Ar, { className: "cteditor-w-4 cteditor-h-4" })
|
|
1256
|
+
}
|
|
1257
|
+
) }),
|
|
1258
|
+
/* @__PURE__ */ e(B, { children: "Crop image" })
|
|
1259
|
+
] }),
|
|
1260
|
+
(Ee(r) !== r || typeof p == "number" || typeof N == "number") && /* @__PURE__ */ a(Y, { children: [
|
|
1261
|
+
/* @__PURE__ */ e(j, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1262
|
+
"button",
|
|
1263
|
+
{
|
|
1264
|
+
type: "button",
|
|
1265
|
+
onClick: kt,
|
|
1266
|
+
className: `${s} ${S}`,
|
|
1267
|
+
"aria-label": "Reset image to original size and crop",
|
|
1268
|
+
children: /* @__PURE__ */ e(mt, { className: "cteditor-w-4 cteditor-h-4" })
|
|
1269
|
+
}
|
|
1270
|
+
) }),
|
|
1271
|
+
/* @__PURE__ */ e(B, { children: "Reset to original size and crop" })
|
|
1272
|
+
] })
|
|
1273
|
+
] }),
|
|
1274
|
+
w && /* @__PURE__ */ a(Me, { children: [
|
|
1275
|
+
/* @__PURE__ */ e("div", { className: b }),
|
|
1276
|
+
/* @__PURE__ */ a(Y, { children: [
|
|
1277
|
+
/* @__PURE__ */ e(j, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1278
|
+
"button",
|
|
1279
|
+
{
|
|
1280
|
+
type: "button",
|
|
1281
|
+
onClick: Ze,
|
|
1282
|
+
className: `${s} ${S}`,
|
|
1283
|
+
"aria-label": "Visit link",
|
|
1284
|
+
children: /* @__PURE__ */ e(kr, {})
|
|
1285
|
+
}
|
|
1286
|
+
) }),
|
|
1287
|
+
/* @__PURE__ */ a(B, { children: [
|
|
1288
|
+
"Visit: ",
|
|
1289
|
+
w
|
|
1290
|
+
] })
|
|
1291
|
+
] })
|
|
1292
|
+
] }),
|
|
1293
|
+
W && /* @__PURE__ */ a(Me, { children: [
|
|
1294
|
+
/* @__PURE__ */ e("div", { className: b }),
|
|
1295
|
+
/* @__PURE__ */ a(Y, { children: [
|
|
1296
|
+
/* @__PURE__ */ e(j, { asChild: !0, children: /* @__PURE__ */ a(
|
|
1297
|
+
"button",
|
|
1298
|
+
{
|
|
1299
|
+
type: "button",
|
|
1300
|
+
onClick: (t) => {
|
|
1301
|
+
t.stopPropagation(), Nt(t);
|
|
1302
|
+
},
|
|
1303
|
+
className: `cteditor-h-8 cteditor-px-2.5 cteditor-flex cteditor-items-center cteditor-gap-1 cteditor-rounded-md hover:cteditor-bg-foreground/10 cteditor-transition-colors ${S}`,
|
|
1304
|
+
"aria-label": "Refine image",
|
|
1305
|
+
children: [
|
|
1306
|
+
/* @__PURE__ */ e(Lr, { className: "cteditor-size-3.5" }),
|
|
1307
|
+
/* @__PURE__ */ e("span", { className: "cteditor-text-[11px] cteditor-font-medium", children: "AI" })
|
|
1308
|
+
]
|
|
1309
|
+
}
|
|
1310
|
+
) }),
|
|
1311
|
+
/* @__PURE__ */ e(B, { children: "Refine image" })
|
|
1312
|
+
] })
|
|
1313
|
+
] }),
|
|
1314
|
+
/* @__PURE__ */ e("div", { className: b }),
|
|
1315
|
+
/* @__PURE__ */ a(Y, { children: [
|
|
1316
|
+
/* @__PURE__ */ e(j, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1317
|
+
"button",
|
|
1318
|
+
{
|
|
1319
|
+
type: "button",
|
|
1320
|
+
onClick: (t) => {
|
|
1321
|
+
t.stopPropagation(), yt(t);
|
|
1322
|
+
},
|
|
1323
|
+
className: `${s} ${S}`,
|
|
1324
|
+
"aria-label": "Open image in new tab",
|
|
1325
|
+
children: /* @__PURE__ */ e(Rr, {})
|
|
1326
|
+
}
|
|
1327
|
+
) }),
|
|
1328
|
+
/* @__PURE__ */ e(B, { children: "Open in new tab" })
|
|
1329
|
+
] }),
|
|
1330
|
+
/* @__PURE__ */ a(Y, { children: [
|
|
1331
|
+
/* @__PURE__ */ e(j, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1332
|
+
"button",
|
|
1333
|
+
{
|
|
1334
|
+
type: "button",
|
|
1335
|
+
onClick: (t) => {
|
|
1336
|
+
t.stopPropagation(), Ct(t);
|
|
1337
|
+
},
|
|
1338
|
+
className: `${s} hover:cteditor-bg-red-500/10 hover:cteditor-text-red-500 cteditor-text-foreground/80`,
|
|
1339
|
+
"aria-label": "Delete image",
|
|
1340
|
+
children: /* @__PURE__ */ e(Er, {})
|
|
1341
|
+
}
|
|
1342
|
+
) }),
|
|
1343
|
+
/* @__PURE__ */ e(B, { children: "Delete image" })
|
|
1344
|
+
] })
|
|
1345
|
+
]
|
|
1346
|
+
}
|
|
1347
|
+
) }),
|
|
1348
|
+
n && o && !Z && W && /* @__PURE__ */ e(
|
|
1349
|
+
"div",
|
|
1350
|
+
{
|
|
1351
|
+
className: "cteditor-absolute cteditor-bottom-2 cteditor-left-2 cteditor-right-2 cteditor-bg-background/85 cteditor-rounded-lg cteditor-shadow-xl cteditor-border cteditor-border-foreground/20 cteditor-p-3 cteditor-backdrop-blur-lg md:cteditor-min-w-80",
|
|
1352
|
+
style: { zIndex: 10 },
|
|
1353
|
+
onClick: (t) => t.stopPropagation(),
|
|
1354
|
+
onKeyDown: (t) => t.stopPropagation(),
|
|
1355
|
+
onKeyUp: (t) => t.stopPropagation(),
|
|
1356
|
+
children: /* @__PURE__ */ a("div", { className: "cteditor-flex cteditor-flex-col cteditor-gap-2", children: [
|
|
1357
|
+
/* @__PURE__ */ e("label", { className: "cteditor-text-xs cteditor-font-medium cteditor-text-foreground", children: "What else do you want in this scene?" }),
|
|
1358
|
+
/* @__PURE__ */ e(
|
|
1359
|
+
"input",
|
|
1360
|
+
{
|
|
1361
|
+
type: "text",
|
|
1362
|
+
value: ie,
|
|
1363
|
+
onChange: (t) => V(t.target.value),
|
|
1364
|
+
onKeyDown: (t) => {
|
|
1365
|
+
t.stopPropagation(), t.key === "Enter" && ie.trim() && !_ && et(), t.key === "Escape" && (h(!1), V(""));
|
|
1366
|
+
},
|
|
1367
|
+
onKeyUp: (t) => {
|
|
1368
|
+
t.stopPropagation();
|
|
1369
|
+
},
|
|
1370
|
+
onClick: (t) => {
|
|
1371
|
+
t.stopPropagation();
|
|
1372
|
+
},
|
|
1373
|
+
placeholder: "e.g., flying birds, golden sunset, stormy clouds...",
|
|
1374
|
+
className: "cteditor-w-full cteditor-px-3 cteditor-py-2 cteditor-text-sm cteditor-border cteditor-border-foreground/10 focus:cteditor-border-foreground cteditor-rounded-md cteditor-bg-background cteditor-text-foreground ",
|
|
1375
|
+
disabled: _,
|
|
1376
|
+
autoFocus: !0
|
|
1377
|
+
}
|
|
1378
|
+
),
|
|
1379
|
+
/* @__PURE__ */ a("div", { className: "cteditor-flex cteditor-gap-2 cteditor-justify-end", children: [
|
|
1380
|
+
/* @__PURE__ */ e(
|
|
1381
|
+
"button",
|
|
1382
|
+
{
|
|
1383
|
+
type: "button",
|
|
1384
|
+
onClick: (t) => {
|
|
1385
|
+
t.stopPropagation(), et();
|
|
1386
|
+
},
|
|
1387
|
+
disabled: _ || !ie.trim(),
|
|
1388
|
+
className: " cteditor-px-5 cteditor-py-2 cteditor-text-sm cteditor-rounded-md cteditor-bg-foreground cteditor-text-background hover:cteditor-bg-foreground/95 disabled:cteditor-opacity-50 disabled:cteditor-cursor-not-allowed cteditor-transition-colors focus:cteditor-outline-none focus:cteditor-ring-2 focus:cteditor-ring-background",
|
|
1389
|
+
children: _ ? /* @__PURE__ */ a("span", { className: "cteditor-flex cteditor-items-center cteditor-justify-center cteditor-gap-2", children: [
|
|
1390
|
+
/* @__PURE__ */ e("span", { className: "cteditor-inline-block cteditor-w-4 cteditor-h-4 cteditor-border-2 cteditor-border-t-transparent cteditor-rounded-full cteditor-animate-spin" }),
|
|
1391
|
+
"Refining..."
|
|
1392
|
+
] }) : "Refine Image"
|
|
1393
|
+
}
|
|
1394
|
+
),
|
|
1395
|
+
/* @__PURE__ */ e(
|
|
1396
|
+
"button",
|
|
1397
|
+
{
|
|
1398
|
+
type: "button",
|
|
1399
|
+
onClick: (t) => {
|
|
1400
|
+
t.stopPropagation(), h(!1), V("");
|
|
1401
|
+
},
|
|
1402
|
+
disabled: _,
|
|
1403
|
+
className: "cteditor-size-9 cteditor-flex cteditor-items-center cteditor-justify-center 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",
|
|
1404
|
+
children: /* @__PURE__ */ e(Ir, { size: 16 })
|
|
1405
|
+
}
|
|
1406
|
+
)
|
|
1407
|
+
] })
|
|
1408
|
+
] })
|
|
1409
|
+
}
|
|
1410
|
+
),
|
|
1411
|
+
q && ge(O) && tt && !We && /* @__PURE__ */ e(
|
|
1412
|
+
Tt,
|
|
1413
|
+
{
|
|
1414
|
+
showCaption: E,
|
|
1415
|
+
setShowCaption: bt,
|
|
1416
|
+
editor: l,
|
|
1417
|
+
buttonRef: D,
|
|
1418
|
+
imageRef: f,
|
|
1419
|
+
maxWidth: y,
|
|
1420
|
+
onResizeStart: wt,
|
|
1421
|
+
onResizeEnd: xt,
|
|
1422
|
+
captionsEnabled: !Z && K
|
|
1423
|
+
}
|
|
1424
|
+
)
|
|
1425
|
+
]
|
|
1426
|
+
}
|
|
1427
|
+
),
|
|
1428
|
+
E && (c.startsWith("Signature by") ? /* @__PURE__ */ e(zr, { caption: P }) : /* @__PURE__ */ e(
|
|
1429
|
+
"div",
|
|
1430
|
+
{
|
|
1431
|
+
className: "image-caption-container",
|
|
1432
|
+
style: {
|
|
1433
|
+
width: typeof p == "number" ? `${p}px` : "100%",
|
|
1434
|
+
maxWidth: "100%",
|
|
1435
|
+
// Match the image's alignment
|
|
1436
|
+
...x === "inline-center" || x === "full" ? { margin: "0 auto" } : x === "inline-right" ? { marginLeft: "auto" } : x === "left" ? { float: "left", clear: "left" } : x === "right" ? { float: "right", clear: "right" } : {}
|
|
1437
|
+
},
|
|
1438
|
+
children: /* @__PURE__ */ a(
|
|
1439
|
+
Bt,
|
|
1440
|
+
{
|
|
1441
|
+
initialEditor: P,
|
|
1442
|
+
initialNodes: [
|
|
1443
|
+
ar,
|
|
1444
|
+
cr,
|
|
1445
|
+
dr,
|
|
1446
|
+
sr,
|
|
1447
|
+
zt,
|
|
1448
|
+
Wt
|
|
1449
|
+
],
|
|
1450
|
+
children: [
|
|
1451
|
+
/* @__PURE__ */ e(Ot, {}),
|
|
1452
|
+
/* @__PURE__ */ e(
|
|
1453
|
+
Kt,
|
|
1454
|
+
{
|
|
1455
|
+
contentEditable: /* @__PURE__ */ e(
|
|
1456
|
+
Ht,
|
|
1457
|
+
{
|
|
1458
|
+
"aria-placeholder": "Enter a caption...",
|
|
1459
|
+
placeholder: () => /* @__PURE__ */ e("span", { className: "cteditor-text-xs cteditor-absolute cteditor-left-2 cteditor-top-[7px]", children: "Enter a caption..." }),
|
|
1460
|
+
className: " cteditor-outline-none !cteditor-shadow-none cteditor-bg-foreground/10 cteditor-border !cteditor-border-foreground/15 cteditor-py-1 cteditor-px-2 cteditor-rounded-sm cteditor-text-xs cteditor-relative"
|
|
1461
|
+
}
|
|
1462
|
+
),
|
|
1463
|
+
ErrorBoundary: Yt
|
|
1464
|
+
}
|
|
1465
|
+
),
|
|
1466
|
+
/* @__PURE__ */ e(
|
|
1467
|
+
Xt,
|
|
1468
|
+
{
|
|
1469
|
+
onChange: () => {
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
),
|
|
1473
|
+
/* @__PURE__ */ e(jt, {}),
|
|
1474
|
+
/* @__PURE__ */ e(Pr, { namespace: Sr.namespace })
|
|
1475
|
+
]
|
|
1476
|
+
}
|
|
1477
|
+
)
|
|
1478
|
+
}
|
|
1479
|
+
)),
|
|
1480
|
+
/* @__PURE__ */ e(
|
|
1481
|
+
Fr,
|
|
1482
|
+
{
|
|
1483
|
+
open: ft,
|
|
1484
|
+
onOpenChange: Te,
|
|
1485
|
+
src: r,
|
|
1486
|
+
altText: c,
|
|
1487
|
+
width: p,
|
|
1488
|
+
height: N,
|
|
1489
|
+
onCropApply: Rt
|
|
1490
|
+
}
|
|
1491
|
+
),
|
|
1492
|
+
/* @__PURE__ */ e(
|
|
1493
|
+
Wr,
|
|
1494
|
+
{
|
|
1495
|
+
open: ee,
|
|
1496
|
+
onOpenChange: F,
|
|
1497
|
+
oldImageUrl: r,
|
|
1498
|
+
newImageUrl: M,
|
|
1499
|
+
onReplace: Pt,
|
|
1500
|
+
onCancel: St
|
|
1501
|
+
}
|
|
1502
|
+
)
|
|
1503
|
+
] }) });
|
|
1504
|
+
}
|
|
1505
|
+
export {
|
|
1506
|
+
at as RIGHT_CLICK_IMAGE_COMMAND,
|
|
1507
|
+
mi as default
|
|
1508
|
+
};
|