eddyter 1.3.70 → 1.3.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +247 -262
- package/dist/EddyterIcon.svg +24 -0
- package/dist/ImageResizer-FrE13F54.js +237 -0
- package/dist/assets/style.css +1 -1
- package/dist/components/EddyterLogo/EddyterLogo.d.ts +13 -0
- package/dist/{html2pdf.bundle-ZbgrRtz0.js → html2pdf.bundle-Bptnpoce.js} +1 -1
- package/dist/{html2pdf.bundle.min-D6BlTaug.js → html2pdf.bundle.min-CL0HFz_I.js} +1 -1
- package/dist/{index-DJEsPHep.js → index-BgjRNNca.js} +6719 -6616
- package/dist/{index-7sHS7FZi.js → index-CTVNcCfu.js} +2 -2
- package/dist/{index-BJBbBVqE.js → index-Y3Jbqb5R.js} +351 -331
- package/dist/{index-aG2ca7vV.js → index-aoU-Zn1p.js} +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/ImageResizer-CbtUYHip.js +0 -199
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { I as
|
|
1
|
+
import { jsx as t, jsxs as s, Fragment as it } from "react/jsx-runtime";
|
|
2
|
+
import { I as nt } from "./ImageResizer-FrE13F54.js";
|
|
3
3
|
import { CodeNode as xe } from "@lexical/code";
|
|
4
4
|
import { LinkNode as Ce } from "@lexical/link";
|
|
5
|
-
import { AutoFocusPlugin as
|
|
6
|
-
import { useCollaborationContext as
|
|
7
|
-
import { useLexicalComposerContext as
|
|
8
|
-
import { ContentEditable as
|
|
9
|
-
import { LexicalErrorBoundary as
|
|
10
|
-
import { HistoryPlugin as
|
|
11
|
-
import { LexicalNestedComposer as
|
|
12
|
-
import { OnChangePlugin as
|
|
13
|
-
import { RichTextPlugin as
|
|
5
|
+
import { AutoFocusPlugin as ct } from "@lexical/react/LexicalAutoFocusPlugin";
|
|
6
|
+
import { useCollaborationContext as at } from "@lexical/react/LexicalCollaborationContext";
|
|
7
|
+
import { useLexicalComposerContext as st } from "@lexical/react/LexicalComposerContext";
|
|
8
|
+
import { ContentEditable as Ne } from "@lexical/react/LexicalContentEditable";
|
|
9
|
+
import { LexicalErrorBoundary as we } from "@lexical/react/LexicalErrorBoundary";
|
|
10
|
+
import { HistoryPlugin as ve } from "@lexical/react/LexicalHistoryPlugin";
|
|
11
|
+
import { LexicalNestedComposer as Ee } from "@lexical/react/LexicalNestedComposer";
|
|
12
|
+
import { OnChangePlugin as ke } from "@lexical/react/LexicalOnChangePlugin";
|
|
13
|
+
import { RichTextPlugin as Ie } from "@lexical/react/LexicalRichTextPlugin";
|
|
14
14
|
import { useLexicalEditable as dt } from "@lexical/react/useLexicalEditable";
|
|
15
|
-
import { useLexicalNodeSelection as
|
|
16
|
-
import { mergeRegister as
|
|
17
|
-
import { RootNode as
|
|
18
|
-
import { useRef as
|
|
19
|
-
import { a as
|
|
20
|
-
const
|
|
15
|
+
import { useLexicalNodeSelection as lt } from "@lexical/react/useLexicalNodeSelection";
|
|
16
|
+
import { mergeRegister as mt } from "@lexical/utils";
|
|
17
|
+
import { RootNode as Re, TextNode as Pe, LineBreakNode as De, ParagraphNode as Se, $getSelection as O, $isNodeSelection as L, $isParagraphNode as Z, $setSelection as ee, $isRangeSelection as ut, SELECTION_CHANGE_COMMAND as gt, COMMAND_PRIORITY_LOW as v, CLICK_COMMAND as ft, DRAGSTART_COMMAND as pt, KEY_DELETE_COMMAND as ht, KEY_BACKSPACE_COMMAND as bt, KEY_ENTER_COMMAND as yt, KEY_ESCAPE_COMMAND as xt, createCommand as Ct, $getNodeByKey as _ } from "lexical";
|
|
18
|
+
import { useRef as z, useState as p, useEffect as te, useLayoutEffect as Nt, useCallback as x, Suspense as wt } from "react";
|
|
19
|
+
import { a as vt, D as Et, b as kt, d as It, e as Rt, f as Pt, h as Dt, B as be, L as Ae, i as Le, u as St, $ as M, W as At, j as Lt, A as Mt, k as $t, l as Ot, T as _t, m as zt, S as Wt, E as jt, n as Kt, t as E, o as Bt, p as Tt, C as Ft } from "./index-BgjRNNca.js";
|
|
20
|
+
const Gt = vt("Link2", [
|
|
21
21
|
["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
|
|
22
22
|
["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
|
|
23
23
|
["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
|
|
24
|
-
]),
|
|
25
|
-
open:
|
|
26
|
-
onOpenChange:
|
|
27
|
-
oldImageUrl:
|
|
28
|
-
newImageUrl:
|
|
29
|
-
onReplace:
|
|
24
|
+
]), Yt = ({
|
|
25
|
+
open: u,
|
|
26
|
+
onOpenChange: d,
|
|
27
|
+
oldImageUrl: g,
|
|
28
|
+
newImageUrl: f,
|
|
29
|
+
onReplace: C,
|
|
30
30
|
onCancel: N
|
|
31
|
-
}) => /* @__PURE__ */ t(
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
/* @__PURE__ */
|
|
31
|
+
}) => /* @__PURE__ */ t(Et, { open: u, onOpenChange: d, children: /* @__PURE__ */ s(kt, { className: "sm:max-w-[800px] max-h-[90vh] overflow-y-auto", children: [
|
|
32
|
+
/* @__PURE__ */ s(It, { children: [
|
|
33
|
+
/* @__PURE__ */ s(Rt, { className: "flex items-center gap-2 text-xl", children: [
|
|
34
34
|
/* @__PURE__ */ t("span", { className: "text-2xl", children: "🔄" }),
|
|
35
35
|
"Compare Images"
|
|
36
36
|
] }),
|
|
37
|
-
/* @__PURE__ */ t(
|
|
37
|
+
/* @__PURE__ */ t(Pt, { className: "text-sm pt-1", children: "Choose whether to replace the original image with the refined version." })
|
|
38
38
|
] }),
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
/* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-4", children: /* @__PURE__ */
|
|
41
|
-
/* @__PURE__ */
|
|
39
|
+
/* @__PURE__ */ s("div", { className: "space-y-4 py-4", children: [
|
|
40
|
+
/* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-4", children: /* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
41
|
+
/* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
|
|
42
42
|
/* @__PURE__ */ t("span", { className: "text-sm font-semibold text-gray-700 dark:text-gray-300", children: "Refined Image" }),
|
|
43
43
|
/* @__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" })
|
|
44
44
|
] }),
|
|
45
45
|
/* @__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(
|
|
46
46
|
"img",
|
|
47
47
|
{
|
|
48
|
-
src:
|
|
48
|
+
src: f,
|
|
49
49
|
alt: "Refined",
|
|
50
50
|
className: "w-full h-full object-contain"
|
|
51
51
|
}
|
|
52
52
|
) })
|
|
53
53
|
] }) }),
|
|
54
|
-
/* @__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__ */
|
|
54
|
+
/* @__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__ */ s("p", { className: "text-sm text-blue-800 dark:text-blue-200", children: [
|
|
55
55
|
/* @__PURE__ */ t("span", { className: "font-semibold", children: "Note:" }),
|
|
56
56
|
' Clicking "Replace" will update the image in your document. This action cannot be undone.'
|
|
57
57
|
] }) })
|
|
58
58
|
] }),
|
|
59
|
-
/* @__PURE__ */
|
|
59
|
+
/* @__PURE__ */ s(Dt, { className: "gap-2", children: [
|
|
60
60
|
/* @__PURE__ */ t(
|
|
61
|
-
|
|
61
|
+
be,
|
|
62
62
|
{
|
|
63
63
|
variant: "outline",
|
|
64
64
|
onClick: N,
|
|
65
65
|
children: "Keep Original"
|
|
66
66
|
}
|
|
67
67
|
),
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
-
|
|
68
|
+
/* @__PURE__ */ s(
|
|
69
|
+
be,
|
|
70
70
|
{
|
|
71
|
-
onClick:
|
|
71
|
+
onClick: C,
|
|
72
72
|
className: "bg-blue-500 hover:bg-blue-600 text-white",
|
|
73
73
|
children: [
|
|
74
74
|
/* @__PURE__ */ t("span", { className: "mr-2", children: "✓" }),
|
|
@@ -78,27 +78,27 @@ const Bt = Nt("Link2", [
|
|
|
78
78
|
)
|
|
79
79
|
] })
|
|
80
80
|
] }) });
|
|
81
|
-
function
|
|
82
|
-
caption:
|
|
81
|
+
function Ht({
|
|
82
|
+
caption: u
|
|
83
83
|
}) {
|
|
84
|
-
return /* @__PURE__ */ t("div", { className: "signature-caption-container", children: /* @__PURE__ */
|
|
85
|
-
|
|
84
|
+
return /* @__PURE__ */ t("div", { className: "signature-caption-container", children: /* @__PURE__ */ s(
|
|
85
|
+
Ee,
|
|
86
86
|
{
|
|
87
|
-
initialEditor:
|
|
87
|
+
initialEditor: u,
|
|
88
88
|
initialNodes: [
|
|
89
|
-
Ie,
|
|
90
89
|
Re,
|
|
91
90
|
Pe,
|
|
91
|
+
De,
|
|
92
92
|
Se,
|
|
93
93
|
Ce,
|
|
94
94
|
xe
|
|
95
95
|
],
|
|
96
96
|
children: [
|
|
97
97
|
/* @__PURE__ */ t(
|
|
98
|
-
|
|
98
|
+
Ie,
|
|
99
99
|
{
|
|
100
100
|
contentEditable: /* @__PURE__ */ t(
|
|
101
|
-
|
|
101
|
+
Ne,
|
|
102
102
|
{
|
|
103
103
|
"aria-placeholder": "Enter signature name...",
|
|
104
104
|
placeholder: /* @__PURE__ */ t("div", { style: {
|
|
@@ -114,54 +114,60 @@ function Yt({
|
|
|
114
114
|
className: "signature-caption-editable"
|
|
115
115
|
}
|
|
116
116
|
),
|
|
117
|
-
ErrorBoundary:
|
|
117
|
+
ErrorBoundary: we
|
|
118
118
|
}
|
|
119
119
|
),
|
|
120
|
-
/* @__PURE__ */ t(
|
|
120
|
+
/* @__PURE__ */ t(ke, { onChange: () => {
|
|
121
121
|
} }),
|
|
122
|
-
/* @__PURE__ */ t(
|
|
123
|
-
/* @__PURE__ */ t(
|
|
122
|
+
/* @__PURE__ */ t(ve, {}),
|
|
123
|
+
/* @__PURE__ */ t(Ae, { namespace: Le.namespace })
|
|
124
124
|
]
|
|
125
125
|
}
|
|
126
126
|
) });
|
|
127
127
|
}
|
|
128
|
-
const
|
|
129
|
-
function
|
|
130
|
-
if (!
|
|
131
|
-
throw new Promise((
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
},
|
|
136
|
-
|
|
128
|
+
const re = /* @__PURE__ */ new Set(), ye = Ct("RIGHT_CLICK_IMAGE_COMMAND");
|
|
129
|
+
function qt(u) {
|
|
130
|
+
if (!re.has(u))
|
|
131
|
+
throw new Promise((d) => {
|
|
132
|
+
const g = new Image();
|
|
133
|
+
g.src = u, g.onload = () => {
|
|
134
|
+
re.add(u), d(null);
|
|
135
|
+
}, g.onerror = () => {
|
|
136
|
+
re.add(u);
|
|
137
137
|
};
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
|
-
function
|
|
141
|
-
altText:
|
|
142
|
-
className:
|
|
143
|
-
imageRef:
|
|
144
|
-
src:
|
|
145
|
-
width:
|
|
140
|
+
function Xt({
|
|
141
|
+
altText: u,
|
|
142
|
+
className: d,
|
|
143
|
+
imageRef: g,
|
|
144
|
+
src: f,
|
|
145
|
+
width: C,
|
|
146
146
|
height: N,
|
|
147
|
-
maxWidth:
|
|
147
|
+
maxWidth: oe,
|
|
148
148
|
onError: I
|
|
149
149
|
}) {
|
|
150
|
-
|
|
150
|
+
qt(f);
|
|
151
|
+
const w = typeof C == "number" && typeof N == "number", W = typeof C == "number" ? C : "auto";
|
|
152
|
+
return /* @__PURE__ */ t(
|
|
151
153
|
"img",
|
|
152
154
|
{
|
|
153
|
-
className:
|
|
154
|
-
src:
|
|
155
|
-
alt:
|
|
156
|
-
ref:
|
|
157
|
-
style:
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
155
|
+
className: d || void 0,
|
|
156
|
+
src: f,
|
|
157
|
+
alt: u,
|
|
158
|
+
ref: g,
|
|
159
|
+
style: w ? {
|
|
160
|
+
width: W,
|
|
161
|
+
// Use height: auto + aspect-ratio so the image scales
|
|
162
|
+
// proportionally when max-width constrains on small screens.
|
|
163
|
+
// The useLayoutEffect in ImageComponent widens the container
|
|
164
|
+
// to fit the explicit width on desktop.
|
|
165
|
+
height: "auto",
|
|
166
|
+
aspectRatio: `${W} / ${typeof N == "number" ? N : "auto"}`,
|
|
161
167
|
maxWidth: "100%"
|
|
162
168
|
} : {
|
|
163
|
-
// No dimensions specified - use original image size
|
|
164
|
-
|
|
169
|
+
// No dimensions specified - use original image size.
|
|
170
|
+
// max-width from CSS rule prevents overflow.
|
|
165
171
|
height: "auto"
|
|
166
172
|
},
|
|
167
173
|
onError: I,
|
|
@@ -169,7 +175,7 @@ function Ht({
|
|
|
169
175
|
}
|
|
170
176
|
);
|
|
171
177
|
}
|
|
172
|
-
function
|
|
178
|
+
function Vt() {
|
|
173
179
|
return /* @__PURE__ */ t(
|
|
174
180
|
"img",
|
|
175
181
|
{
|
|
@@ -183,171 +189,181 @@ function qt() {
|
|
|
183
189
|
}
|
|
184
190
|
);
|
|
185
191
|
}
|
|
186
|
-
function
|
|
187
|
-
src:
|
|
188
|
-
altText:
|
|
189
|
-
nodeKey:
|
|
190
|
-
width:
|
|
191
|
-
height:
|
|
192
|
+
function Nr({
|
|
193
|
+
src: u,
|
|
194
|
+
altText: d,
|
|
195
|
+
nodeKey: g,
|
|
196
|
+
width: f,
|
|
197
|
+
height: C,
|
|
192
198
|
maxWidth: N,
|
|
193
|
-
resizable:
|
|
199
|
+
resizable: oe,
|
|
194
200
|
showCaption: I,
|
|
195
|
-
caption:
|
|
196
|
-
captionsEnabled:
|
|
201
|
+
caption: w,
|
|
202
|
+
captionsEnabled: W,
|
|
197
203
|
originalPrompt: R,
|
|
198
|
-
position:
|
|
199
|
-
linkUrl:
|
|
204
|
+
position: c = "none",
|
|
205
|
+
linkUrl: h
|
|
200
206
|
}) {
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
if (
|
|
207
|
+
const l = z(null), Y = z(null), [m, y, $] = lt(g), [k, ie] = p(!1), H = z(!1), { isCollabActive: Jt } = at(), [i] = st(), [j, Me] = p(null), ne = z(null), [K, $e] = p(!1), Oe = dt(), [ce, B] = p(!1), [P, T] = p(""), [D, ae] = p(!1), [_e, F] = p(!1), [se, q] = p(""), [ze, X] = p(""), [We, de] = p(!1), S = z(null), [le, je] = p(0), Ke = St()?.apiKey, Be = le > 0 && le < 350;
|
|
208
|
+
te(() => {
|
|
209
|
+
if (l.current) {
|
|
204
210
|
const e = () => {
|
|
205
|
-
|
|
211
|
+
H.current || l.current && je(l.current.offsetWidth);
|
|
206
212
|
};
|
|
207
213
|
e();
|
|
208
214
|
const r = new ResizeObserver(e);
|
|
209
|
-
return r.observe(
|
|
215
|
+
return r.observe(l.current), () => r.disconnect();
|
|
210
216
|
}
|
|
211
|
-
}, [
|
|
212
|
-
|
|
217
|
+
}, [f, C, m]), Nt(() => {
|
|
218
|
+
if ((c === "left" || c === "right") && typeof f == "number" && l.current) {
|
|
219
|
+
const e = l.current.closest(".editor-image"), r = e?.parentElement, o = i.getRootElement(), n = o ? o.getBoundingClientRect().width : f + 32, a = `${Math.min(f + 32, n)}px`;
|
|
220
|
+
return e && (e.style.removeProperty("display"), e.style.setProperty("max-width", a, "important")), r && r.style.setProperty("max-width", a, "important"), () => {
|
|
221
|
+
e && (e.style.removeProperty("max-width"), e.style.removeProperty("display")), r && r.style.removeProperty("max-width");
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
}, [c, f, i]);
|
|
225
|
+
const V = x(
|
|
213
226
|
(e) => {
|
|
214
|
-
const r =
|
|
215
|
-
return
|
|
216
|
-
r.getNodes().forEach((
|
|
217
|
-
if (M(
|
|
218
|
-
const
|
|
219
|
-
|
|
227
|
+
const r = O();
|
|
228
|
+
return m && L(r) && (e.preventDefault(), i.update(() => {
|
|
229
|
+
r.getNodes().forEach((n) => {
|
|
230
|
+
if (M(n)) {
|
|
231
|
+
const a = n.getParent();
|
|
232
|
+
n.remove(), a && Z(a) && a.getChildrenSize() === 0 && a.setFormat("left");
|
|
220
233
|
}
|
|
221
234
|
});
|
|
222
235
|
})), !1;
|
|
223
236
|
},
|
|
224
|
-
[
|
|
225
|
-
),
|
|
237
|
+
[i, m]
|
|
238
|
+
), me = x(
|
|
226
239
|
(e) => {
|
|
227
|
-
const r =
|
|
228
|
-
if (
|
|
240
|
+
const r = O(), o = Y.current;
|
|
241
|
+
if (m && L(r) && r.getNodes().length === 1) {
|
|
229
242
|
if (I)
|
|
230
|
-
return
|
|
231
|
-
if (
|
|
232
|
-
return e.preventDefault(),
|
|
243
|
+
return ee(null), e.preventDefault(), w.focus(), !0;
|
|
244
|
+
if (o !== null && o !== document.activeElement)
|
|
245
|
+
return e.preventDefault(), o.focus(), !0;
|
|
233
246
|
}
|
|
234
247
|
return !1;
|
|
235
248
|
},
|
|
236
|
-
[
|
|
237
|
-
),
|
|
238
|
-
(e) =>
|
|
239
|
-
|
|
240
|
-
const r =
|
|
249
|
+
[w, m, I]
|
|
250
|
+
), ue = x(
|
|
251
|
+
(e) => ne.current === w || Y.current === e.target ? (ee(null), i.update(() => {
|
|
252
|
+
y(!0);
|
|
253
|
+
const r = i.getRootElement();
|
|
241
254
|
r !== null && r.focus();
|
|
242
255
|
}), !0) : !1,
|
|
243
|
-
[
|
|
244
|
-
),
|
|
256
|
+
[w, i, y]
|
|
257
|
+
), J = x(
|
|
245
258
|
(e) => {
|
|
246
259
|
const r = e;
|
|
247
260
|
if (k)
|
|
248
261
|
return !0;
|
|
249
|
-
const
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
262
|
+
const o = r.target;
|
|
263
|
+
if (o.closest("button") && l.current && o.closest(".editor-image") === l.current.closest(".editor-image"))
|
|
264
|
+
return !0;
|
|
265
|
+
const n = o === l.current;
|
|
266
|
+
let a = !1;
|
|
267
|
+
if (!n && l.current) {
|
|
268
|
+
const b = l.current.getBoundingClientRect();
|
|
269
|
+
a = r.clientX >= b.left && r.clientX <= b.right && r.clientY >= b.top && r.clientY <= b.bottom;
|
|
254
270
|
}
|
|
255
|
-
return
|
|
271
|
+
return n || a ? (r.shiftKey ? y(!m) : ($(), y(!0)), !0) : !1;
|
|
256
272
|
},
|
|
257
|
-
[k,
|
|
258
|
-
),
|
|
273
|
+
[k, m, y, $]
|
|
274
|
+
), Q = x(
|
|
259
275
|
(e) => {
|
|
260
|
-
|
|
261
|
-
const r =
|
|
262
|
-
e.target.tagName === "IMG" &&
|
|
263
|
-
|
|
276
|
+
i.getEditorState().read(() => {
|
|
277
|
+
const r = O();
|
|
278
|
+
e.target.tagName === "IMG" && ut(r) && r.getNodes().length === 1 && i.dispatchCommand(
|
|
279
|
+
ye,
|
|
264
280
|
e
|
|
265
281
|
);
|
|
266
282
|
});
|
|
267
283
|
},
|
|
268
|
-
[
|
|
284
|
+
[i]
|
|
269
285
|
);
|
|
270
|
-
|
|
286
|
+
te(() => {
|
|
271
287
|
let e = !0;
|
|
272
|
-
const r =
|
|
273
|
-
|
|
274
|
-
e &&
|
|
288
|
+
const r = i.getRootElement(), o = mt(
|
|
289
|
+
i.registerUpdateListener(({ editorState: n }) => {
|
|
290
|
+
e && Me(n.read(() => O()));
|
|
275
291
|
}),
|
|
276
|
-
|
|
277
|
-
ut,
|
|
278
|
-
(d, m) => (oe.current = m, !1),
|
|
279
|
-
w
|
|
280
|
-
),
|
|
281
|
-
o.registerCommand(
|
|
292
|
+
i.registerCommand(
|
|
282
293
|
gt,
|
|
283
|
-
|
|
284
|
-
|
|
294
|
+
(n, a) => (ne.current = a, !1),
|
|
295
|
+
v
|
|
285
296
|
),
|
|
286
|
-
|
|
287
|
-
be,
|
|
288
|
-
X,
|
|
289
|
-
w
|
|
290
|
-
),
|
|
291
|
-
o.registerCommand(
|
|
297
|
+
i.registerCommand(
|
|
292
298
|
ft,
|
|
293
|
-
|
|
294
|
-
|
|
299
|
+
J,
|
|
300
|
+
v
|
|
301
|
+
),
|
|
302
|
+
i.registerCommand(
|
|
303
|
+
ye,
|
|
304
|
+
J,
|
|
305
|
+
v
|
|
295
306
|
),
|
|
296
|
-
|
|
307
|
+
i.registerCommand(
|
|
297
308
|
pt,
|
|
298
|
-
|
|
299
|
-
|
|
309
|
+
(n) => n.target === l.current ? (n.preventDefault(), !0) : !1,
|
|
310
|
+
v
|
|
300
311
|
),
|
|
301
|
-
|
|
312
|
+
i.registerCommand(
|
|
302
313
|
ht,
|
|
303
|
-
|
|
304
|
-
|
|
314
|
+
V,
|
|
315
|
+
v
|
|
305
316
|
),
|
|
306
|
-
|
|
307
|
-
|
|
317
|
+
i.registerCommand(
|
|
318
|
+
bt,
|
|
319
|
+
V,
|
|
320
|
+
v
|
|
321
|
+
),
|
|
322
|
+
i.registerCommand(yt, me, v),
|
|
323
|
+
i.registerCommand(
|
|
308
324
|
xt,
|
|
309
|
-
|
|
310
|
-
|
|
325
|
+
ue,
|
|
326
|
+
v
|
|
311
327
|
)
|
|
312
328
|
);
|
|
313
|
-
return r?.addEventListener("contextmenu",
|
|
314
|
-
e = !1,
|
|
329
|
+
return r?.addEventListener("contextmenu", Q), () => {
|
|
330
|
+
e = !1, o(), r?.removeEventListener("contextmenu", Q);
|
|
315
331
|
};
|
|
316
332
|
}, [
|
|
317
|
-
|
|
318
|
-
|
|
333
|
+
$,
|
|
334
|
+
i,
|
|
319
335
|
k,
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
q,
|
|
323
|
-
se,
|
|
324
|
-
le,
|
|
325
|
-
X,
|
|
336
|
+
m,
|
|
337
|
+
g,
|
|
326
338
|
V,
|
|
327
|
-
|
|
339
|
+
me,
|
|
340
|
+
ue,
|
|
341
|
+
J,
|
|
342
|
+
Q,
|
|
343
|
+
y
|
|
328
344
|
]);
|
|
329
345
|
const Te = () => {
|
|
330
|
-
|
|
331
|
-
const e =
|
|
346
|
+
i.update(() => {
|
|
347
|
+
const e = _(g);
|
|
332
348
|
M(e) && e.setShowCaption(!0);
|
|
333
349
|
});
|
|
334
|
-
},
|
|
335
|
-
setTimeout(() => {
|
|
336
|
-
|
|
337
|
-
}, 200),
|
|
338
|
-
const
|
|
339
|
-
M(
|
|
350
|
+
}, Fe = (e, r) => {
|
|
351
|
+
H.current = !1, setTimeout(() => {
|
|
352
|
+
ie(!1);
|
|
353
|
+
}, 200), i.update(() => {
|
|
354
|
+
const o = _(g);
|
|
355
|
+
M(o) && o.setWidthAndHeight(e, r);
|
|
340
356
|
});
|
|
341
357
|
}, Ge = () => {
|
|
342
|
-
|
|
358
|
+
H.current = !0, ie(!0);
|
|
343
359
|
}, Ye = (e) => {
|
|
344
|
-
if (e.preventDefault(), e.stopPropagation(),
|
|
360
|
+
if (e.preventDefault(), e.stopPropagation(), u.startsWith("data:")) {
|
|
345
361
|
const r = window.open("", "_blank");
|
|
346
362
|
r && (r.document.write(`
|
|
347
363
|
<!DOCTYPE html>
|
|
348
364
|
<html>
|
|
349
365
|
<head>
|
|
350
|
-
<title>${
|
|
366
|
+
<title>${d || "Image"}</title>
|
|
351
367
|
<style>
|
|
352
368
|
body {
|
|
353
369
|
margin: 0;
|
|
@@ -365,50 +381,54 @@ function Cr({
|
|
|
365
381
|
</style>
|
|
366
382
|
</head>
|
|
367
383
|
<body>
|
|
368
|
-
<img src="${
|
|
384
|
+
<img src="${u}" alt="${d || "Image"}" />
|
|
369
385
|
</body>
|
|
370
386
|
</html>
|
|
371
387
|
`), r.document.close());
|
|
372
388
|
} else
|
|
373
|
-
window.open(
|
|
374
|
-
},
|
|
375
|
-
e.preventDefault(), e.stopPropagation(),
|
|
376
|
-
const r =
|
|
389
|
+
window.open(u, "_blank");
|
|
390
|
+
}, He = (e) => {
|
|
391
|
+
e.preventDefault(), e.stopPropagation(), i.update(() => {
|
|
392
|
+
const r = _(g);
|
|
377
393
|
if (M(r)) {
|
|
378
|
-
const
|
|
379
|
-
r.remove(),
|
|
394
|
+
const o = r.getParent();
|
|
395
|
+
r.remove(), o && Z(o) && o.getChildrenSize() === 0 && o.setFormat("left");
|
|
380
396
|
}
|
|
381
397
|
});
|
|
382
398
|
}, A = (e, r) => {
|
|
383
|
-
e.preventDefault(), e.stopPropagation(),
|
|
384
|
-
const
|
|
385
|
-
M(
|
|
399
|
+
e.preventDefault(), e.stopPropagation(), i.update(() => {
|
|
400
|
+
const o = _(g);
|
|
401
|
+
if (M(o)) {
|
|
402
|
+
o.setPosition(r);
|
|
403
|
+
const n = o.getParent();
|
|
404
|
+
n && Z(n) && (r === "left" ? n.setFormat("left") : r === "right" ? n.setFormat("right") : n.setFormat(""));
|
|
405
|
+
}
|
|
386
406
|
});
|
|
387
|
-
},
|
|
388
|
-
e.preventDefault(), e.stopPropagation(),
|
|
389
|
-
},
|
|
390
|
-
|
|
391
|
-
|
|
407
|
+
}, qe = (e) => {
|
|
408
|
+
e.preventDefault(), e.stopPropagation(), B(!ce);
|
|
409
|
+
}, Xe = x(() => {
|
|
410
|
+
h && !m && (S.current = setTimeout(() => {
|
|
411
|
+
de(!0);
|
|
392
412
|
}, 300));
|
|
393
|
-
}, [
|
|
394
|
-
|
|
395
|
-
}, []),
|
|
396
|
-
e.preventDefault(), e.stopPropagation(),
|
|
397
|
-
}, [
|
|
398
|
-
|
|
399
|
-
|
|
413
|
+
}, [h, m]), Ve = x(() => {
|
|
414
|
+
S.current && (clearTimeout(S.current), S.current = null), de(!1);
|
|
415
|
+
}, []), ge = x((e) => {
|
|
416
|
+
e.preventDefault(), e.stopPropagation(), h && window.open(h, "_blank", "noopener,noreferrer");
|
|
417
|
+
}, [h]);
|
|
418
|
+
te(() => () => {
|
|
419
|
+
S.current && clearTimeout(S.current);
|
|
400
420
|
}, []);
|
|
401
|
-
const
|
|
402
|
-
if (!P.trim() ||
|
|
421
|
+
const fe = async () => {
|
|
422
|
+
if (!P.trim() || D)
|
|
403
423
|
return;
|
|
404
|
-
|
|
405
|
-
const e =
|
|
424
|
+
ae(!0);
|
|
425
|
+
const e = E.loading("Refining image...", {
|
|
406
426
|
description: "This may take 10-30 seconds. Please wait."
|
|
407
427
|
});
|
|
408
428
|
try {
|
|
409
429
|
let r = P.trim();
|
|
410
|
-
const
|
|
411
|
-
const
|
|
430
|
+
const n = P.trim().replace(/^(add|also add|include|with|and)\s+(some|a|an)\s+/gi, "").replace(/^(add|also add|include|with|and)\s+/gi, "").trim(), a = (G) => {
|
|
431
|
+
const rt = G.toLowerCase();
|
|
412
432
|
return [
|
|
413
433
|
"article",
|
|
414
434
|
"write",
|
|
@@ -425,123 +445,123 @@ function Cr({
|
|
|
425
445
|
"add some images",
|
|
426
446
|
"include images",
|
|
427
447
|
"include pictures"
|
|
428
|
-
].some((
|
|
448
|
+
].some((ot) => rt.includes(ot));
|
|
429
449
|
};
|
|
430
|
-
let
|
|
450
|
+
let b = "";
|
|
431
451
|
if (R && R.trim()) {
|
|
432
|
-
const
|
|
433
|
-
|
|
452
|
+
const G = R.trim();
|
|
453
|
+
a(G) && d && d !== "Generated image" && d.trim() ? b = d.trim() : b = G;
|
|
434
454
|
} else
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
const
|
|
455
|
+
d && d !== "Generated image" && d.trim() && (b = d.trim());
|
|
456
|
+
b ? r = `${b} with ${n}` : r = n;
|
|
457
|
+
const he = (await Bt({
|
|
438
458
|
content: `Generate Image: ${r}`,
|
|
439
|
-
apiKey:
|
|
459
|
+
apiKey: Ke || void 0
|
|
440
460
|
}))?.data;
|
|
441
|
-
if (!
|
|
461
|
+
if (!he)
|
|
442
462
|
throw new Error("Failed to generate image - empty response");
|
|
443
|
-
const
|
|
444
|
-
if (!
|
|
463
|
+
const U = new DOMParser().parseFromString(he, "text/html").querySelector("img");
|
|
464
|
+
if (!U || !U.src)
|
|
445
465
|
throw new Error("No image found in response");
|
|
446
|
-
const
|
|
447
|
-
|
|
466
|
+
const tt = U.src;
|
|
467
|
+
E.dismiss(e), E.success("Image refined successfully!", {
|
|
448
468
|
description: "Compare the images and choose which to keep."
|
|
449
|
-
}),
|
|
469
|
+
}), q(tt), X(r), F(!0), T(""), B(!1);
|
|
450
470
|
} catch (r) {
|
|
451
|
-
if (
|
|
452
|
-
const
|
|
453
|
-
|
|
471
|
+
if (E.dismiss(e), r instanceof Tt) {
|
|
472
|
+
const o = r.code === "API_KEYS_DISABLED" ? "API Keys Disabled" : "API Key Required";
|
|
473
|
+
E.error(o, {
|
|
454
474
|
description: r.message,
|
|
455
475
|
duration: 8e3
|
|
456
476
|
});
|
|
457
477
|
} else
|
|
458
|
-
r instanceof
|
|
478
|
+
r instanceof Ft ? E.error("Credits Issue", {
|
|
459
479
|
description: r.message,
|
|
460
480
|
duration: 8e3
|
|
461
|
-
}) :
|
|
481
|
+
}) : E.error("Failed to refine image", {
|
|
462
482
|
description: r instanceof Error ? r.message : "Unknown error. Please try again."
|
|
463
483
|
});
|
|
464
484
|
} finally {
|
|
465
|
-
|
|
485
|
+
ae(!1);
|
|
466
486
|
}
|
|
467
|
-
},
|
|
468
|
-
|
|
469
|
-
const e =
|
|
487
|
+
}, Je = () => {
|
|
488
|
+
i.update(() => {
|
|
489
|
+
const e = _(g);
|
|
470
490
|
if (M(e)) {
|
|
471
|
-
e.setSrc(
|
|
472
|
-
const r =
|
|
473
|
-
r &&
|
|
491
|
+
e.setSrc(se), e.setOriginalPrompt(ze);
|
|
492
|
+
const r = O();
|
|
493
|
+
r && ee(r.clone());
|
|
474
494
|
}
|
|
475
|
-
}),
|
|
495
|
+
}), F(!1), q(""), X(""), E.success("Image replaced successfully!", {
|
|
476
496
|
description: "The image has been updated with the refined version."
|
|
477
497
|
});
|
|
478
|
-
},
|
|
479
|
-
|
|
480
|
-
},
|
|
498
|
+
}, Qe = () => {
|
|
499
|
+
F(!1), q(""), X("");
|
|
500
|
+
}, Ue = m && L(j) && !k, pe = (m || k) && Oe, Ze = () => c === "left" || c === "right" ? {
|
|
481
501
|
position: "relative",
|
|
482
502
|
display: "block",
|
|
483
503
|
width: "100%"
|
|
484
504
|
// Fill the floated container
|
|
485
|
-
} :
|
|
505
|
+
} : c === "full" ? {
|
|
486
506
|
position: "relative",
|
|
487
507
|
display: "inline-block"
|
|
488
508
|
// Use inline-block to respect text-align: center from parent
|
|
489
|
-
} :
|
|
509
|
+
} : c === "inline-left" || c === "inline-center" || c === "inline-right" ? {
|
|
490
510
|
position: "relative",
|
|
491
511
|
display: "inline-block"
|
|
492
512
|
// Use inline-block to respect text-align from parent
|
|
493
513
|
} : {
|
|
494
514
|
position: "relative",
|
|
495
515
|
display: "inline-block"
|
|
496
|
-
},
|
|
516
|
+
}, et = x(
|
|
497
517
|
(e) => {
|
|
498
518
|
if (k || e.target.closest("button"))
|
|
499
519
|
return;
|
|
500
|
-
const
|
|
501
|
-
let
|
|
502
|
-
if (!
|
|
503
|
-
const
|
|
504
|
-
|
|
520
|
+
const o = e.target === l.current;
|
|
521
|
+
let n = !1;
|
|
522
|
+
if (!o && l.current) {
|
|
523
|
+
const a = l.current.getBoundingClientRect();
|
|
524
|
+
n = e.clientX >= a.left && e.clientX <= a.right && e.clientY >= a.top && e.clientY <= a.bottom;
|
|
505
525
|
}
|
|
506
|
-
!
|
|
526
|
+
!o && !n || (e.stopPropagation(), e.shiftKey ? y(!m) : ($(), y(!0)));
|
|
507
527
|
},
|
|
508
|
-
[k,
|
|
528
|
+
[k, m, y, $]
|
|
509
529
|
);
|
|
510
|
-
return /* @__PURE__ */ t(
|
|
511
|
-
/* @__PURE__ */
|
|
530
|
+
return /* @__PURE__ */ t(wt, { fallback: null, children: /* @__PURE__ */ s(it, { children: [
|
|
531
|
+
/* @__PURE__ */ s(
|
|
512
532
|
"div",
|
|
513
533
|
{
|
|
514
|
-
draggable:
|
|
515
|
-
style:
|
|
516
|
-
onClick:
|
|
517
|
-
onMouseEnter:
|
|
518
|
-
onMouseLeave:
|
|
534
|
+
draggable: Ue,
|
|
535
|
+
style: Ze(),
|
|
536
|
+
onClick: et,
|
|
537
|
+
onMouseEnter: Xe,
|
|
538
|
+
onMouseLeave: Ve,
|
|
519
539
|
children: [
|
|
520
|
-
|
|
521
|
-
|
|
540
|
+
K ? /* @__PURE__ */ t(Vt, {}) : /* @__PURE__ */ t(
|
|
541
|
+
Xt,
|
|
522
542
|
{
|
|
523
|
-
className:
|
|
524
|
-
src:
|
|
525
|
-
altText:
|
|
526
|
-
imageRef:
|
|
527
|
-
width:
|
|
528
|
-
height:
|
|
543
|
+
className: pe ? `focused ${L(j) ? "draggable" : ""}` : h ? "cteditor-cursor-pointer" : null,
|
|
544
|
+
src: u,
|
|
545
|
+
altText: d,
|
|
546
|
+
imageRef: l,
|
|
547
|
+
width: f,
|
|
548
|
+
height: C,
|
|
529
549
|
maxWidth: N,
|
|
530
|
-
onError: () =>
|
|
550
|
+
onError: () => $e(!0)
|
|
531
551
|
}
|
|
532
552
|
),
|
|
533
|
-
|
|
553
|
+
We && h && !m && /* @__PURE__ */ s(
|
|
534
554
|
"div",
|
|
535
555
|
{
|
|
536
556
|
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",
|
|
537
557
|
style: { zIndex: 10 },
|
|
538
558
|
children: [
|
|
539
|
-
/* @__PURE__ */ t(
|
|
540
|
-
/* @__PURE__ */ t("span", { className: "cteditor-text-sm cteditor-text-foreground cteditor-truncate cteditor-flex-1", children:
|
|
559
|
+
/* @__PURE__ */ t(Gt, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-muted-foreground cteditor-flex-shrink-0" }),
|
|
560
|
+
/* @__PURE__ */ t("span", { className: "cteditor-text-sm cteditor-text-foreground cteditor-truncate cteditor-flex-1", children: h }),
|
|
541
561
|
/* @__PURE__ */ t(
|
|
542
562
|
"button",
|
|
543
563
|
{
|
|
544
|
-
onClick:
|
|
564
|
+
onClick: ge,
|
|
545
565
|
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",
|
|
546
566
|
children: "Open"
|
|
547
567
|
}
|
|
@@ -549,30 +569,30 @@ function Cr({
|
|
|
549
569
|
]
|
|
550
570
|
}
|
|
551
571
|
),
|
|
552
|
-
|
|
572
|
+
m && L(j) && !K && /* @__PURE__ */ s(
|
|
553
573
|
"div",
|
|
554
574
|
{
|
|
555
|
-
className: `cteditor-absolute cteditor-flex cteditor-gap-1 z-10 ${
|
|
575
|
+
className: `cteditor-absolute cteditor-flex cteditor-gap-1 z-10 ${Be ? "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"}`,
|
|
556
576
|
children: [
|
|
557
|
-
/* @__PURE__ */
|
|
577
|
+
/* @__PURE__ */ s("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: [
|
|
558
578
|
/* @__PURE__ */ t(
|
|
559
579
|
"button",
|
|
560
580
|
{
|
|
561
581
|
onClick: (e) => A(e, "left"),
|
|
562
|
-
className: ` cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${
|
|
582
|
+
className: ` cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${c === "left" ? "cteditor-bg-accent" : ""}`,
|
|
563
583
|
"aria-label": "Wrap text left",
|
|
564
584
|
title: "Wrap text left",
|
|
565
|
-
children: /* @__PURE__ */ t(
|
|
585
|
+
children: /* @__PURE__ */ t(At, {})
|
|
566
586
|
}
|
|
567
587
|
),
|
|
568
588
|
/* @__PURE__ */ t(
|
|
569
589
|
"button",
|
|
570
590
|
{
|
|
571
591
|
onClick: (e) => A(e, "right"),
|
|
572
|
-
className: ` cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${
|
|
592
|
+
className: ` cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${c === "right" ? "cteditor-bg-accent" : ""}`,
|
|
573
593
|
"aria-label": "Wrap text right",
|
|
574
594
|
title: "Wrap text right",
|
|
575
|
-
children: /* @__PURE__ */ t(
|
|
595
|
+
children: /* @__PURE__ */ t(Lt, {})
|
|
576
596
|
}
|
|
577
597
|
),
|
|
578
598
|
/* @__PURE__ */ t("div", { className: "cteditor-w-px cteditor-h-5 cteditor-bg-border cteditor-mx-0.5" }),
|
|
@@ -580,30 +600,30 @@ function Cr({
|
|
|
580
600
|
"button",
|
|
581
601
|
{
|
|
582
602
|
onClick: (e) => A(e, "inline-left"),
|
|
583
|
-
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${
|
|
603
|
+
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${c === "inline-left" ? "cteditor-bg-accent" : ""}`,
|
|
584
604
|
"aria-label": "Align left",
|
|
585
605
|
title: "Align left (no text wrap)",
|
|
586
|
-
children: /* @__PURE__ */ t(
|
|
606
|
+
children: /* @__PURE__ */ t(Mt, {})
|
|
587
607
|
}
|
|
588
608
|
),
|
|
589
609
|
/* @__PURE__ */ t(
|
|
590
610
|
"button",
|
|
591
611
|
{
|
|
592
612
|
onClick: (e) => A(e, "inline-center"),
|
|
593
|
-
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${
|
|
613
|
+
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${c === "inline-center" || c === "full" ? "cteditor-bg-accent" : ""}`,
|
|
594
614
|
"aria-label": "Align center",
|
|
595
615
|
title: "Align center (no text wrap)",
|
|
596
|
-
children: /* @__PURE__ */ t(
|
|
616
|
+
children: /* @__PURE__ */ t($t, {})
|
|
597
617
|
}
|
|
598
618
|
),
|
|
599
619
|
/* @__PURE__ */ t(
|
|
600
620
|
"button",
|
|
601
621
|
{
|
|
602
622
|
onClick: (e) => A(e, "inline-right"),
|
|
603
|
-
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${
|
|
623
|
+
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${c === "inline-right" ? "cteditor-bg-accent" : ""}`,
|
|
604
624
|
"aria-label": "Align right",
|
|
605
625
|
title: "Align right (no text wrap)",
|
|
606
|
-
children: /* @__PURE__ */ t(
|
|
626
|
+
children: /* @__PURE__ */ t(Ot, {})
|
|
607
627
|
}
|
|
608
628
|
),
|
|
609
629
|
/* @__PURE__ */ t("div", { className: "cteditor-w-px cteditor-h-5 cteditor-bg-border cteditor-mx-0.5" }),
|
|
@@ -611,33 +631,33 @@ function Cr({
|
|
|
611
631
|
"button",
|
|
612
632
|
{
|
|
613
633
|
onClick: (e) => A(e, "none"),
|
|
614
|
-
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${
|
|
634
|
+
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${c === "none" ? "cteditor-bg-accent" : ""}`,
|
|
615
635
|
"aria-label": "Inline",
|
|
616
636
|
title: "Inline with text",
|
|
617
|
-
children: /* @__PURE__ */ t(
|
|
637
|
+
children: /* @__PURE__ */ t(_t, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
|
|
618
638
|
}
|
|
619
639
|
)
|
|
620
640
|
] }),
|
|
621
|
-
|
|
641
|
+
h && /* @__PURE__ */ t(
|
|
622
642
|
"button",
|
|
623
643
|
{
|
|
624
|
-
onClick:
|
|
644
|
+
onClick: ge,
|
|
625
645
|
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",
|
|
626
646
|
"aria-label": "Visit link",
|
|
627
|
-
title: `Visit: ${
|
|
628
|
-
children: /* @__PURE__ */ t(
|
|
647
|
+
title: `Visit: ${h}`,
|
|
648
|
+
children: /* @__PURE__ */ t(zt, {})
|
|
629
649
|
}
|
|
630
650
|
),
|
|
631
651
|
R && /* @__PURE__ */ t(
|
|
632
652
|
"button",
|
|
633
653
|
{
|
|
634
654
|
onClick: (e) => {
|
|
635
|
-
e.stopPropagation(),
|
|
655
|
+
e.stopPropagation(), qe(e);
|
|
636
656
|
},
|
|
637
657
|
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",
|
|
638
658
|
"aria-label": "Refine image",
|
|
639
659
|
title: "Refine image",
|
|
640
|
-
children: /* @__PURE__ */ t(
|
|
660
|
+
children: /* @__PURE__ */ t(Wt, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
|
|
641
661
|
}
|
|
642
662
|
),
|
|
643
663
|
/* @__PURE__ */ t(
|
|
@@ -649,25 +669,25 @@ function Cr({
|
|
|
649
669
|
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",
|
|
650
670
|
"aria-label": "Open image in new tab",
|
|
651
671
|
title: "Open in new tab",
|
|
652
|
-
children: /* @__PURE__ */ t(
|
|
672
|
+
children: /* @__PURE__ */ t(jt, {})
|
|
653
673
|
}
|
|
654
674
|
),
|
|
655
675
|
/* @__PURE__ */ t(
|
|
656
676
|
"button",
|
|
657
677
|
{
|
|
658
678
|
onClick: (e) => {
|
|
659
|
-
e.stopPropagation(),
|
|
679
|
+
e.stopPropagation(), He(e);
|
|
660
680
|
},
|
|
661
681
|
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",
|
|
662
682
|
"aria-label": "Delete image",
|
|
663
683
|
title: "Delete image",
|
|
664
|
-
children: /* @__PURE__ */ t(
|
|
684
|
+
children: /* @__PURE__ */ t(Kt, {})
|
|
665
685
|
}
|
|
666
686
|
)
|
|
667
687
|
]
|
|
668
688
|
}
|
|
669
689
|
),
|
|
670
|
-
|
|
690
|
+
ce && m && !K && R && /* @__PURE__ */ t(
|
|
671
691
|
"div",
|
|
672
692
|
{
|
|
673
693
|
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",
|
|
@@ -675,16 +695,16 @@ function Cr({
|
|
|
675
695
|
onClick: (e) => e.stopPropagation(),
|
|
676
696
|
onKeyDown: (e) => e.stopPropagation(),
|
|
677
697
|
onKeyUp: (e) => e.stopPropagation(),
|
|
678
|
-
children: /* @__PURE__ */
|
|
698
|
+
children: /* @__PURE__ */ s("div", { className: "cteditor-flex cteditor-flex-col cteditor-gap-2", children: [
|
|
679
699
|
/* @__PURE__ */ t("label", { className: "cteditor-text-xs cteditor-font-medium cteditor-text-foreground", children: "What else do you want in this scene?" }),
|
|
680
700
|
/* @__PURE__ */ t(
|
|
681
701
|
"input",
|
|
682
702
|
{
|
|
683
703
|
type: "text",
|
|
684
704
|
value: P,
|
|
685
|
-
onChange: (e) =>
|
|
705
|
+
onChange: (e) => T(e.target.value),
|
|
686
706
|
onKeyDown: (e) => {
|
|
687
|
-
e.stopPropagation(), e.key === "Enter" && P.trim() && !
|
|
707
|
+
e.stopPropagation(), e.key === "Enter" && P.trim() && !D && fe(), e.key === "Escape" && (B(!1), T(""));
|
|
688
708
|
},
|
|
689
709
|
onKeyUp: (e) => {
|
|
690
710
|
e.stopPropagation();
|
|
@@ -694,20 +714,20 @@ function Cr({
|
|
|
694
714
|
},
|
|
695
715
|
placeholder: "e.g., flying birds, golden sunset, stormy clouds...",
|
|
696
716
|
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",
|
|
697
|
-
disabled:
|
|
717
|
+
disabled: D,
|
|
698
718
|
autoFocus: !0
|
|
699
719
|
}
|
|
700
720
|
),
|
|
701
|
-
/* @__PURE__ */
|
|
721
|
+
/* @__PURE__ */ s("div", { className: "cteditor-flex cteditor-gap-2", children: [
|
|
702
722
|
/* @__PURE__ */ t(
|
|
703
723
|
"button",
|
|
704
724
|
{
|
|
705
725
|
onClick: (e) => {
|
|
706
|
-
e.stopPropagation(),
|
|
726
|
+
e.stopPropagation(), fe();
|
|
707
727
|
},
|
|
708
|
-
disabled:
|
|
728
|
+
disabled: D || !P.trim(),
|
|
709
729
|
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",
|
|
710
|
-
children:
|
|
730
|
+
children: D ? /* @__PURE__ */ s("span", { className: "cteditor-flex cteditor-items-center cteditor-justify-center cteditor-gap-2", children: [
|
|
711
731
|
/* @__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" }),
|
|
712
732
|
"Refining..."
|
|
713
733
|
] }) : "Refine Image"
|
|
@@ -717,9 +737,9 @@ function Cr({
|
|
|
717
737
|
"button",
|
|
718
738
|
{
|
|
719
739
|
onClick: (e) => {
|
|
720
|
-
e.stopPropagation(),
|
|
740
|
+
e.stopPropagation(), B(!1), T("");
|
|
721
741
|
},
|
|
722
|
-
disabled:
|
|
742
|
+
disabled: D,
|
|
723
743
|
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",
|
|
724
744
|
children: "Cancel"
|
|
725
745
|
}
|
|
@@ -728,89 +748,89 @@ function Cr({
|
|
|
728
748
|
] })
|
|
729
749
|
}
|
|
730
750
|
),
|
|
731
|
-
|
|
732
|
-
|
|
751
|
+
oe && L(j) && pe && /* @__PURE__ */ t(
|
|
752
|
+
nt,
|
|
733
753
|
{
|
|
734
754
|
showCaption: I,
|
|
735
755
|
setShowCaption: Te,
|
|
736
|
-
editor:
|
|
756
|
+
editor: i,
|
|
737
757
|
buttonRef: Y,
|
|
738
|
-
imageRef:
|
|
758
|
+
imageRef: l,
|
|
739
759
|
maxWidth: N,
|
|
740
760
|
onResizeStart: Ge,
|
|
741
|
-
onResizeEnd:
|
|
742
|
-
captionsEnabled: !
|
|
761
|
+
onResizeEnd: Fe,
|
|
762
|
+
captionsEnabled: !K && W
|
|
743
763
|
}
|
|
744
764
|
)
|
|
745
765
|
]
|
|
746
766
|
}
|
|
747
767
|
),
|
|
748
|
-
I && (
|
|
768
|
+
I && (d.startsWith("Signature by") ? /* @__PURE__ */ t(Ht, { caption: w }) : /* @__PURE__ */ t(
|
|
749
769
|
"div",
|
|
750
770
|
{
|
|
751
771
|
className: "image-caption-container",
|
|
752
772
|
style: {
|
|
753
|
-
width: typeof
|
|
773
|
+
width: typeof f == "number" ? `${f}px` : "100%",
|
|
754
774
|
maxWidth: "100%",
|
|
755
775
|
// Match the image's alignment
|
|
756
|
-
...
|
|
776
|
+
...c === "inline-center" || c === "full" ? { margin: "0 auto" } : c === "inline-right" ? { marginLeft: "auto" } : c === "left" ? { float: "left", clear: "left" } : c === "right" ? { float: "right", clear: "right" } : {}
|
|
757
777
|
},
|
|
758
|
-
children: /* @__PURE__ */
|
|
759
|
-
|
|
778
|
+
children: /* @__PURE__ */ s(
|
|
779
|
+
Ee,
|
|
760
780
|
{
|
|
761
|
-
initialEditor:
|
|
781
|
+
initialEditor: w,
|
|
762
782
|
initialNodes: [
|
|
763
|
-
Ie,
|
|
764
783
|
Re,
|
|
765
784
|
Pe,
|
|
785
|
+
De,
|
|
766
786
|
Se,
|
|
767
787
|
Ce,
|
|
768
788
|
xe
|
|
769
789
|
],
|
|
770
790
|
children: [
|
|
771
|
-
/* @__PURE__ */ t(
|
|
791
|
+
/* @__PURE__ */ t(ct, {}),
|
|
772
792
|
/* @__PURE__ */ t(
|
|
773
|
-
|
|
793
|
+
Ie,
|
|
774
794
|
{
|
|
775
795
|
contentEditable: /* @__PURE__ */ t(
|
|
776
|
-
|
|
796
|
+
Ne,
|
|
777
797
|
{
|
|
778
798
|
"aria-placeholder": "Enter a caption...",
|
|
779
799
|
placeholder: () => /* @__PURE__ */ t("span", { className: "cteditor-text-xs", children: "Enter a caption..." }),
|
|
780
800
|
className: "ImageNode__contentEditable"
|
|
781
801
|
}
|
|
782
802
|
),
|
|
783
|
-
ErrorBoundary:
|
|
803
|
+
ErrorBoundary: we
|
|
784
804
|
}
|
|
785
805
|
),
|
|
786
806
|
/* @__PURE__ */ t(
|
|
787
|
-
|
|
807
|
+
ke,
|
|
788
808
|
{
|
|
789
809
|
onChange: () => {
|
|
790
810
|
}
|
|
791
811
|
}
|
|
792
812
|
),
|
|
793
|
-
/* @__PURE__ */ t(
|
|
794
|
-
/* @__PURE__ */ t(
|
|
813
|
+
/* @__PURE__ */ t(ve, {}),
|
|
814
|
+
/* @__PURE__ */ t(Ae, { namespace: Le.namespace })
|
|
795
815
|
]
|
|
796
816
|
}
|
|
797
817
|
)
|
|
798
818
|
}
|
|
799
819
|
)),
|
|
800
820
|
/* @__PURE__ */ t(
|
|
801
|
-
|
|
821
|
+
Yt,
|
|
802
822
|
{
|
|
803
823
|
open: _e,
|
|
804
|
-
onOpenChange:
|
|
805
|
-
oldImageUrl:
|
|
806
|
-
newImageUrl:
|
|
807
|
-
onReplace:
|
|
808
|
-
onCancel:
|
|
824
|
+
onOpenChange: F,
|
|
825
|
+
oldImageUrl: u,
|
|
826
|
+
newImageUrl: se,
|
|
827
|
+
onReplace: Je,
|
|
828
|
+
onCancel: Qe
|
|
809
829
|
}
|
|
810
830
|
)
|
|
811
831
|
] }) });
|
|
812
832
|
}
|
|
813
833
|
export {
|
|
814
|
-
|
|
815
|
-
|
|
834
|
+
ye as RIGHT_CLICK_IMAGE_COMMAND,
|
|
835
|
+
Nr as default
|
|
816
836
|
};
|