eddyter 1.3.76 → 1.3.78

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.
@@ -1,848 +0,0 @@
1
- import { jsx as t, jsxs as s, Fragment as it } from "react/jsx-runtime";
2
- import { I as nt } from "./ImageResizer-o0eMm1Mg.js";
3
- import { CodeNode as xe } from "@lexical/code";
4
- import { LinkNode as Ce } from "@lexical/link";
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
- import { useLexicalEditable as dt } from "@lexical/react/useLexicalEditable";
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-DjD3NbU0.js";
20
- const Gt = vt("Link2", [
21
- ["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
22
- ["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
23
- ["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
24
- ]), Yt = ({
25
- open: u,
26
- onOpenChange: d,
27
- oldImageUrl: g,
28
- newImageUrl: f,
29
- onReplace: C,
30
- onCancel: N
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
- /* @__PURE__ */ t("span", { className: "text-2xl", children: "🔄" }),
35
- "Compare Images"
36
- ] }),
37
- /* @__PURE__ */ t(Pt, { className: "text-sm pt-1", children: "Choose whether to replace the original image with the refined version." })
38
- ] }),
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
- /* @__PURE__ */ t("span", { className: "text-sm font-semibold text-gray-700 dark:text-gray-300", children: "Refined Image" }),
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
- ] }),
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
- "img",
47
- {
48
- src: f,
49
- alt: "Refined",
50
- className: "w-full h-full object-contain"
51
- }
52
- ) })
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__ */ s("p", { className: "text-sm text-blue-800 dark:text-blue-200", children: [
55
- /* @__PURE__ */ t("span", { className: "font-semibold", children: "Note:" }),
56
- ' Clicking "Replace" will update the image in your document. This action cannot be undone.'
57
- ] }) })
58
- ] }),
59
- /* @__PURE__ */ s(Dt, { className: "gap-2", children: [
60
- /* @__PURE__ */ t(
61
- be,
62
- {
63
- variant: "outline",
64
- onClick: N,
65
- children: "Keep Original"
66
- }
67
- ),
68
- /* @__PURE__ */ s(
69
- be,
70
- {
71
- onClick: C,
72
- className: "bg-blue-500 hover:bg-blue-600 text-white",
73
- children: [
74
- /* @__PURE__ */ t("span", { className: "mr-2", children: "✓" }),
75
- "Replace Image"
76
- ]
77
- }
78
- )
79
- ] })
80
- ] }) });
81
- function Ht({
82
- caption: u
83
- }) {
84
- return /* @__PURE__ */ t("div", { className: "signature-caption-container", children: /* @__PURE__ */ s(
85
- Ee,
86
- {
87
- initialEditor: u,
88
- initialNodes: [
89
- Re,
90
- Pe,
91
- De,
92
- Se,
93
- Ce,
94
- xe
95
- ],
96
- children: [
97
- /* @__PURE__ */ t(
98
- Ie,
99
- {
100
- contentEditable: /* @__PURE__ */ t(
101
- Ne,
102
- {
103
- "aria-placeholder": "Enter signature name...",
104
- placeholder: /* @__PURE__ */ t("div", { style: {
105
- position: "absolute",
106
- top: "4px",
107
- left: "8px",
108
- right: "8px",
109
- textAlign: "center",
110
- pointerEvents: "none",
111
- color: "hsla(var(--cteditorf47ac10b-foreground) / 0.4)",
112
- fontStyle: "italic"
113
- }, children: "Enter signature name..." }),
114
- className: "signature-caption-editable"
115
- }
116
- ),
117
- ErrorBoundary: we
118
- }
119
- ),
120
- /* @__PURE__ */ t(ke, { onChange: () => {
121
- } }),
122
- /* @__PURE__ */ t(ve, {}),
123
- /* @__PURE__ */ t(Ae, { namespace: Le.namespace })
124
- ]
125
- }
126
- ) });
127
- }
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
- };
138
- });
139
- }
140
- function Xt({
141
- altText: u,
142
- className: d,
143
- imageRef: g,
144
- src: f,
145
- width: C,
146
- height: N,
147
- maxWidth: oe,
148
- onError: I
149
- }) {
150
- qt(f);
151
- const w = typeof C == "number" && typeof N == "number", W = typeof C == "number" ? C : "auto";
152
- return /* @__PURE__ */ t(
153
- "img",
154
- {
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"}`,
167
- maxWidth: "100%"
168
- } : {
169
- // No dimensions specified - use original image size.
170
- // max-width from CSS rule prevents overflow.
171
- height: "auto"
172
- },
173
- onError: I,
174
- draggable: "false"
175
- }
176
- );
177
- }
178
- function Vt() {
179
- return /* @__PURE__ */ t(
180
- "img",
181
- {
182
- src: "",
183
- style: {
184
- height: 200,
185
- opacity: 0.2,
186
- width: 200
187
- },
188
- draggable: "false"
189
- }
190
- );
191
- }
192
- function Nr({
193
- src: u,
194
- altText: d,
195
- nodeKey: g,
196
- width: f,
197
- height: C,
198
- maxWidth: N,
199
- resizable: oe,
200
- showCaption: I,
201
- caption: w,
202
- captionsEnabled: W,
203
- originalPrompt: R,
204
- position: c = "none",
205
- linkUrl: h
206
- }) {
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) {
210
- const e = () => {
211
- H.current || l.current && je(l.current.offsetWidth);
212
- };
213
- e();
214
- const r = new ResizeObserver(e);
215
- return r.observe(l.current), () => r.disconnect();
216
- }
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(
226
- (e) => {
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");
233
- }
234
- });
235
- })), !1;
236
- },
237
- [i, m]
238
- ), me = x(
239
- (e) => {
240
- const r = O(), o = Y.current;
241
- if (m && L(r) && r.getNodes().length === 1) {
242
- if (I)
243
- return ee(null), e.preventDefault(), w.focus(), !0;
244
- if (o !== null && o !== document.activeElement)
245
- return e.preventDefault(), o.focus(), !0;
246
- }
247
- return !1;
248
- },
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();
254
- r !== null && r.focus();
255
- }), !0) : !1,
256
- [w, i, y]
257
- ), J = x(
258
- (e) => {
259
- const r = e;
260
- if (k)
261
- return !0;
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;
270
- }
271
- return n || a ? (r.shiftKey ? y(!m) : ($(), y(!0)), !0) : !1;
272
- },
273
- [k, m, y, $]
274
- ), Q = x(
275
- (e) => {
276
- i.getEditorState().read(() => {
277
- const r = O();
278
- e.target.tagName === "IMG" && ut(r) && r.getNodes().length === 1 && i.dispatchCommand(
279
- ye,
280
- e
281
- );
282
- });
283
- },
284
- [i]
285
- );
286
- te(() => {
287
- let e = !0;
288
- const r = i.getRootElement(), o = mt(
289
- i.registerUpdateListener(({ editorState: n }) => {
290
- e && Me(n.read(() => O()));
291
- }),
292
- i.registerCommand(
293
- gt,
294
- (n, a) => (ne.current = a, !1),
295
- v
296
- ),
297
- i.registerCommand(
298
- ft,
299
- J,
300
- v
301
- ),
302
- i.registerCommand(
303
- ye,
304
- J,
305
- v
306
- ),
307
- i.registerCommand(
308
- pt,
309
- (n) => n.target === l.current ? (n.preventDefault(), !0) : !1,
310
- v
311
- ),
312
- i.registerCommand(
313
- ht,
314
- V,
315
- v
316
- ),
317
- i.registerCommand(
318
- bt,
319
- V,
320
- v
321
- ),
322
- i.registerCommand(yt, me, v),
323
- i.registerCommand(
324
- xt,
325
- ue,
326
- v
327
- )
328
- );
329
- return r?.addEventListener("contextmenu", Q), () => {
330
- e = !1, o(), r?.removeEventListener("contextmenu", Q);
331
- };
332
- }, [
333
- $,
334
- i,
335
- k,
336
- m,
337
- g,
338
- V,
339
- me,
340
- ue,
341
- J,
342
- Q,
343
- y
344
- ]);
345
- const Te = () => {
346
- i.update(() => {
347
- const e = _(g);
348
- M(e) && e.setShowCaption(!0);
349
- });
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);
356
- });
357
- }, Ge = () => {
358
- H.current = !0, ie(!0);
359
- }, Ye = (e) => {
360
- if (e.preventDefault(), e.stopPropagation(), u.startsWith("data:")) {
361
- const r = window.open("", "_blank");
362
- r && (r.document.write(`
363
- <!DOCTYPE html>
364
- <html>
365
- <head>
366
- <title>${d || "Image"}</title>
367
- <style>
368
- body {
369
- margin: 0;
370
- display: flex;
371
- justify-content: center;
372
- align-items: center;
373
- min-height: 100vh;
374
- background-color: #1a1a1a;
375
- }
376
- img {
377
- max-width: 100%;
378
- max-height: 100vh;
379
- object-fit: contain;
380
- }
381
- </style>
382
- </head>
383
- <body>
384
- <img src="${u}" alt="${d || "Image"}" />
385
- </body>
386
- </html>
387
- `), r.document.close());
388
- } else
389
- window.open(u, "_blank");
390
- }, He = (e) => {
391
- e.preventDefault(), e.stopPropagation(), i.update(() => {
392
- const r = _(g);
393
- if (M(r)) {
394
- const o = r.getParent();
395
- r.remove(), o && Z(o) && o.getChildrenSize() === 0 && o.setFormat("left");
396
- }
397
- });
398
- }, A = (e, r) => {
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
- }
406
- });
407
- }, qe = (e) => {
408
- e.preventDefault(), e.stopPropagation(), B(!ce);
409
- }, Xe = x(() => {
410
- h && !m && (S.current = setTimeout(() => {
411
- de(!0);
412
- }, 300));
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);
420
- }, []);
421
- const fe = async () => {
422
- if (!P.trim() || D)
423
- return;
424
- ae(!0);
425
- const e = E.loading("Refining image...", {
426
- description: "This may take 10-30 seconds. Please wait."
427
- });
428
- try {
429
- let r = P.trim();
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();
432
- return [
433
- "article",
434
- "write",
435
- "blog",
436
- "post",
437
- "essay",
438
- "content",
439
- "generate an article",
440
- "create an article",
441
- "write about",
442
- "and add some pictures",
443
- "with pictures",
444
- "with images",
445
- "add some images",
446
- "include images",
447
- "include pictures"
448
- ].some((ot) => rt.includes(ot));
449
- };
450
- let b = "";
451
- if (R && R.trim()) {
452
- const G = R.trim();
453
- a(G) && d && d !== "Generated image" && d.trim() ? b = d.trim() : b = G;
454
- } else
455
- d && d !== "Generated image" && d.trim() && (b = d.trim());
456
- b ? r = `${b} with ${n}` : r = n;
457
- const he = (await Bt({
458
- content: `Generate Image: ${r}`,
459
- apiKey: Ke || void 0
460
- }))?.data;
461
- if (!he)
462
- throw new Error("Failed to generate image - empty response");
463
- const U = new DOMParser().parseFromString(he, "text/html").querySelector("img");
464
- if (!U || !U.src)
465
- throw new Error("No image found in response");
466
- const tt = U.src;
467
- E.dismiss(e), E.success("Image refined successfully!", {
468
- description: "Compare the images and choose which to keep."
469
- }), q(tt), X(r), F(!0), T(""), B(!1);
470
- } catch (r) {
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, {
474
- description: r.message,
475
- duration: 8e3
476
- });
477
- } else
478
- r instanceof Ft ? E.error("Credits Issue", {
479
- description: r.message,
480
- duration: 8e3
481
- }) : E.error("Failed to refine image", {
482
- description: r instanceof Error ? r.message : "Unknown error. Please try again."
483
- });
484
- } finally {
485
- ae(!1);
486
- }
487
- }, Je = () => {
488
- i.update(() => {
489
- const e = _(g);
490
- if (M(e)) {
491
- e.setSrc(se), e.setOriginalPrompt(ze);
492
- const r = O();
493
- r && ee(r.clone());
494
- }
495
- }), F(!1), q(""), X(""), E.success("Image replaced successfully!", {
496
- description: "The image has been updated with the refined version."
497
- });
498
- }, Qe = () => {
499
- F(!1), q(""), X("");
500
- }, Ue = m && L(j) && !k, pe = (m || k) && Oe, Ze = () => c === "left" || c === "right" ? {
501
- position: "relative",
502
- display: "block",
503
- width: "100%"
504
- // Fill the floated container
505
- } : c === "full" ? {
506
- position: "relative",
507
- display: "block",
508
- width: "fit-content",
509
- margin: "0 auto"
510
- } : c === "inline-left" ? {
511
- position: "relative",
512
- display: "block",
513
- width: "fit-content",
514
- marginRight: "auto"
515
- } : c === "inline-center" ? {
516
- position: "relative",
517
- display: "block",
518
- width: "fit-content",
519
- margin: "0 auto"
520
- } : c === "inline-right" ? {
521
- position: "relative",
522
- display: "block",
523
- width: "fit-content",
524
- marginLeft: "auto"
525
- } : {
526
- position: "relative",
527
- display: "inline-block"
528
- }, et = x(
529
- (e) => {
530
- if (k || e.target.closest("button"))
531
- return;
532
- const o = e.target === l.current;
533
- let n = !1;
534
- if (!o && l.current) {
535
- const a = l.current.getBoundingClientRect();
536
- n = e.clientX >= a.left && e.clientX <= a.right && e.clientY >= a.top && e.clientY <= a.bottom;
537
- }
538
- !o && !n || (e.stopPropagation(), e.shiftKey ? y(!m) : ($(), y(!0)));
539
- },
540
- [k, m, y, $]
541
- );
542
- return /* @__PURE__ */ t(wt, { fallback: null, children: /* @__PURE__ */ s(it, { children: [
543
- /* @__PURE__ */ s(
544
- "div",
545
- {
546
- draggable: Ue,
547
- style: Ze(),
548
- onClick: et,
549
- onMouseEnter: Xe,
550
- onMouseLeave: Ve,
551
- children: [
552
- K ? /* @__PURE__ */ t(Vt, {}) : /* @__PURE__ */ t(
553
- Xt,
554
- {
555
- className: pe ? `focused ${L(j) ? "draggable" : ""}` : h ? "cteditor-cursor-pointer" : null,
556
- src: u,
557
- altText: d,
558
- imageRef: l,
559
- width: f,
560
- height: C,
561
- maxWidth: N,
562
- onError: () => $e(!0)
563
- }
564
- ),
565
- We && h && !m && /* @__PURE__ */ s(
566
- "div",
567
- {
568
- 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",
569
- style: { zIndex: 10 },
570
- children: [
571
- /* @__PURE__ */ t(Gt, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-muted-foreground cteditor-flex-shrink-0" }),
572
- /* @__PURE__ */ t("span", { className: "cteditor-text-sm cteditor-text-foreground cteditor-truncate cteditor-flex-1", children: h }),
573
- /* @__PURE__ */ t(
574
- "button",
575
- {
576
- onClick: ge,
577
- 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",
578
- children: "Open"
579
- }
580
- )
581
- ]
582
- }
583
- ),
584
- m && L(j) && !K && /* @__PURE__ */ s(
585
- "div",
586
- {
587
- 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"}`,
588
- children: [
589
- /* @__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: [
590
- /* @__PURE__ */ t(
591
- "button",
592
- {
593
- onClick: (e) => A(e, "left"),
594
- 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" : ""}`,
595
- "aria-label": "Wrap text left",
596
- title: "Wrap text left",
597
- children: /* @__PURE__ */ t(At, {})
598
- }
599
- ),
600
- /* @__PURE__ */ t(
601
- "button",
602
- {
603
- onClick: (e) => A(e, "right"),
604
- 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" : ""}`,
605
- "aria-label": "Wrap text right",
606
- title: "Wrap text right",
607
- children: /* @__PURE__ */ t(Lt, {})
608
- }
609
- ),
610
- /* @__PURE__ */ t("div", { className: "cteditor-w-px cteditor-h-5 cteditor-bg-border cteditor-mx-0.5" }),
611
- /* @__PURE__ */ t(
612
- "button",
613
- {
614
- onClick: (e) => A(e, "inline-left"),
615
- 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" : ""}`,
616
- "aria-label": "Align left",
617
- title: "Align left (no text wrap)",
618
- children: /* @__PURE__ */ t(Mt, {})
619
- }
620
- ),
621
- /* @__PURE__ */ t(
622
- "button",
623
- {
624
- onClick: (e) => A(e, "inline-center"),
625
- 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" : ""}`,
626
- "aria-label": "Align center",
627
- title: "Align center (no text wrap)",
628
- children: /* @__PURE__ */ t($t, {})
629
- }
630
- ),
631
- /* @__PURE__ */ t(
632
- "button",
633
- {
634
- onClick: (e) => A(e, "inline-right"),
635
- 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" : ""}`,
636
- "aria-label": "Align right",
637
- title: "Align right (no text wrap)",
638
- children: /* @__PURE__ */ t(Ot, {})
639
- }
640
- ),
641
- /* @__PURE__ */ t("div", { className: "cteditor-w-px cteditor-h-5 cteditor-bg-border cteditor-mx-0.5" }),
642
- /* @__PURE__ */ t(
643
- "button",
644
- {
645
- onClick: (e) => A(e, "none"),
646
- 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" : ""}`,
647
- "aria-label": "Inline",
648
- title: "Inline with text",
649
- children: /* @__PURE__ */ t(_t, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
650
- }
651
- )
652
- ] }),
653
- h && /* @__PURE__ */ t(
654
- "button",
655
- {
656
- onClick: ge,
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",
658
- "aria-label": "Visit link",
659
- title: `Visit: ${h}`,
660
- children: /* @__PURE__ */ t(zt, {})
661
- }
662
- ),
663
- R && /* @__PURE__ */ t(
664
- "button",
665
- {
666
- onClick: (e) => {
667
- e.stopPropagation(), qe(e);
668
- },
669
- 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",
670
- "aria-label": "Refine image",
671
- title: "Refine image",
672
- children: /* @__PURE__ */ t(Wt, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
673
- }
674
- ),
675
- /* @__PURE__ */ t(
676
- "button",
677
- {
678
- onClick: (e) => {
679
- e.stopPropagation(), Ye(e);
680
- },
681
- 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",
682
- "aria-label": "Open image in new tab",
683
- title: "Open in new tab",
684
- children: /* @__PURE__ */ t(jt, {})
685
- }
686
- ),
687
- /* @__PURE__ */ t(
688
- "button",
689
- {
690
- onClick: (e) => {
691
- e.stopPropagation(), He(e);
692
- },
693
- 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",
694
- "aria-label": "Delete image",
695
- title: "Delete image",
696
- children: /* @__PURE__ */ t(Kt, {})
697
- }
698
- )
699
- ]
700
- }
701
- ),
702
- ce && m && !K && R && /* @__PURE__ */ t(
703
- "div",
704
- {
705
- 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",
706
- style: { zIndex: 10 },
707
- onClick: (e) => e.stopPropagation(),
708
- onKeyDown: (e) => e.stopPropagation(),
709
- onKeyUp: (e) => e.stopPropagation(),
710
- children: /* @__PURE__ */ s("div", { className: "cteditor-flex cteditor-flex-col cteditor-gap-2", children: [
711
- /* @__PURE__ */ t("label", { className: "cteditor-text-xs cteditor-font-medium cteditor-text-foreground", children: "What else do you want in this scene?" }),
712
- /* @__PURE__ */ t(
713
- "input",
714
- {
715
- type: "text",
716
- value: P,
717
- onChange: (e) => T(e.target.value),
718
- onKeyDown: (e) => {
719
- e.stopPropagation(), e.key === "Enter" && P.trim() && !D && fe(), e.key === "Escape" && (B(!1), T(""));
720
- },
721
- onKeyUp: (e) => {
722
- e.stopPropagation();
723
- },
724
- onClick: (e) => {
725
- e.stopPropagation();
726
- },
727
- placeholder: "e.g., flying birds, golden sunset, stormy clouds...",
728
- 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",
729
- disabled: D,
730
- autoFocus: !0
731
- }
732
- ),
733
- /* @__PURE__ */ s("div", { className: "cteditor-flex cteditor-gap-2", children: [
734
- /* @__PURE__ */ t(
735
- "button",
736
- {
737
- onClick: (e) => {
738
- e.stopPropagation(), fe();
739
- },
740
- disabled: D || !P.trim(),
741
- 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",
742
- children: D ? /* @__PURE__ */ s("span", { className: "cteditor-flex cteditor-items-center cteditor-justify-center cteditor-gap-2", children: [
743
- /* @__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" }),
744
- "Refining..."
745
- ] }) : "Refine Image"
746
- }
747
- ),
748
- /* @__PURE__ */ t(
749
- "button",
750
- {
751
- onClick: (e) => {
752
- e.stopPropagation(), B(!1), T("");
753
- },
754
- disabled: D,
755
- 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",
756
- children: "Cancel"
757
- }
758
- )
759
- ] })
760
- ] })
761
- }
762
- ),
763
- oe && L(j) && pe && /* @__PURE__ */ t(
764
- nt,
765
- {
766
- showCaption: I,
767
- setShowCaption: Te,
768
- editor: i,
769
- buttonRef: Y,
770
- imageRef: l,
771
- maxWidth: N,
772
- onResizeStart: Ge,
773
- onResizeEnd: Fe,
774
- captionsEnabled: !K && W
775
- }
776
- )
777
- ]
778
- }
779
- ),
780
- I && (d.startsWith("Signature by") ? /* @__PURE__ */ t(Ht, { caption: w }) : /* @__PURE__ */ t(
781
- "div",
782
- {
783
- className: "image-caption-container",
784
- style: {
785
- width: typeof f == "number" ? `${f}px` : "100%",
786
- maxWidth: "100%",
787
- // Match the image's alignment
788
- ...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" } : {}
789
- },
790
- children: /* @__PURE__ */ s(
791
- Ee,
792
- {
793
- initialEditor: w,
794
- initialNodes: [
795
- Re,
796
- Pe,
797
- De,
798
- Se,
799
- Ce,
800
- xe
801
- ],
802
- children: [
803
- /* @__PURE__ */ t(ct, {}),
804
- /* @__PURE__ */ t(
805
- Ie,
806
- {
807
- contentEditable: /* @__PURE__ */ t(
808
- Ne,
809
- {
810
- "aria-placeholder": "Enter a caption...",
811
- placeholder: () => /* @__PURE__ */ t("span", { className: "cteditor-text-xs", children: "Enter a caption..." }),
812
- className: "ImageNode__contentEditable"
813
- }
814
- ),
815
- ErrorBoundary: we
816
- }
817
- ),
818
- /* @__PURE__ */ t(
819
- ke,
820
- {
821
- onChange: () => {
822
- }
823
- }
824
- ),
825
- /* @__PURE__ */ t(ve, {}),
826
- /* @__PURE__ */ t(Ae, { namespace: Le.namespace })
827
- ]
828
- }
829
- )
830
- }
831
- )),
832
- /* @__PURE__ */ t(
833
- Yt,
834
- {
835
- open: _e,
836
- onOpenChange: F,
837
- oldImageUrl: u,
838
- newImageUrl: se,
839
- onReplace: Je,
840
- onCancel: Qe
841
- }
842
- )
843
- ] }) });
844
- }
845
- export {
846
- ye as RIGHT_CLICK_IMAGE_COMMAND,
847
- Nr as default
848
- };