eddyter 1.4.12 → 1.4.13
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 +3 -2
- package/dist/CommentBubblePlugin-DDCERFQO.js +29 -0
- package/dist/{LazyCodeMirror-CcceEUqu.js → LazyCodeMirror-C1bW4mVF.js} +941 -1484
- package/dist/{LazySignatureCanvas-Cck44R9l.js → LazySignatureCanvas-D5P1189T.js} +21 -38
- package/dist/Provider/EditorProvider.d.ts +2 -0
- package/dist/api/auth.d.ts +4 -0
- package/dist/assets/style.css +1 -1
- package/dist/{babel-CCPWkrf4.js → babel-B9hn44Wo.js} +726 -1302
- package/dist/components/ColorPicker/LazyHexColorPicker.d.ts +2 -0
- package/dist/components/CommentToggle/CommentToggle.d.ts +2 -2
- package/dist/components/ConfigurableEditorWithAuth.d.ts +2 -2
- package/dist/components/EmojiPickerWidget/LazyEmojiPicker.d.ts +4 -0
- package/dist/components/LockedFeature/FeatureLockCard.d.ts +22 -0
- package/dist/components/LockedFeature/FeatureLockTooltipContent.d.ts +12 -0
- package/dist/components/LockedFeature/LockedFeature.d.ts +6 -1
- package/dist/components/LockedFeature/lockedFeatureMetadata.d.ts +7 -0
- package/dist/components/Toolbar/styles.d.ts +5 -5
- package/dist/components/ui/tooltip.d.ts +2 -1
- package/dist/{estree-CxUPh9wa.js → estree-CocPn_Md.js} +529 -917
- package/dist/{generateDocxThumbnail-DGj_L73_.js → generateDocxThumbnail-BVFpoKUP.js} +762 -1118
- package/dist/{generatePdfThumbnail-D1ui86rp.js → generatePdfThumbnail-Pvt57kGy.js} +13 -19
- package/dist/{generateXlsxThumbnail-CbJOr-_6.js → generateXlsxThumbnail-DRggrLYK.js} +3322 -3508
- package/dist/{html-CmniStvG.js → html-CxCicOef.js} +350 -589
- package/dist/{html2canvas.esm-C2wu93Kq.js → html2canvas.esm-BD_Vwvv8.js} +139 -204
- package/dist/{html2pdf.bundle.min-CN_w9Sxu.js → html2pdf.bundle.min-DElEIEzd.js} +3405 -5221
- package/dist/{index-DiSjJC3k.js → index-C9Dld3-L.js} +13 -13
- package/dist/{index-CuwrKBfY.js → index-Cojy1w7r.js} +194 -217
- package/dist/index-D11sRTul.js +147 -0
- package/dist/{index-Dh0oRk6u.js → index-DFEFJp4J.js} +37294 -41489
- package/dist/index-D_izLqTY.js +552 -0
- package/dist/{index-hrDzgkRb.js → index-ZBDns08-.js} +81 -80
- package/dist/index-rm00T8b9.js +166 -0
- package/dist/index.js +2 -2
- package/dist/{markdown-B0mEGGfQ.js → markdown-BUjgWFLu.js} +578 -1015
- package/dist/{objectWithoutPropertiesLoose-DO0w4vQT.js → objectWithoutPropertiesLoose-DiWPeE4c.js} +6 -10
- package/dist/pages/ConfigurableEditor/ConfigurableEditor.d.ts +1 -1
- package/dist/plugins/LocalStoragePlugin.d.ts +0 -2
- package/dist/{postcss-B0bxXf7u.js → postcss-CGIcwj_g.js} +615 -1065
- package/dist/{standalone-DmuJV5rn.js → standalone-C0qguT38.js} +350 -596
- package/dist/{typescript-DZlC_9M8.js → typescript-BM7wk6k-.js} +1114 -1806
- package/package.json +8 -1
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { jsx as o, jsxs as b, Fragment as Jt } from "react/jsx-runtime";
|
|
2
2
|
import { I as De } from "./ImageResizer-BVwxL4Eh.js";
|
|
3
|
-
import {
|
|
4
|
-
import { LinkNode as
|
|
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
|
|
14
|
-
import { useLexicalEditable as
|
|
15
|
-
import { useLexicalNodeSelection as
|
|
16
|
-
import { mergeRegister as
|
|
17
|
-
import { $getRoot as
|
|
18
|
-
import
|
|
3
|
+
import { CodeNode as Le } from "@lexical/code";
|
|
4
|
+
import { LinkNode as Te } from "@lexical/link";
|
|
5
|
+
import { AutoFocusPlugin as $e } from "@lexical/react/LexicalAutoFocusPlugin";
|
|
6
|
+
import { useCollaborationContext as We } from "@lexical/react/LexicalCollaborationContext";
|
|
7
|
+
import { useLexicalComposerContext as Ye } from "@lexical/react/LexicalComposerContext";
|
|
8
|
+
import { ContentEditable as Oe } from "@lexical/react/LexicalContentEditable";
|
|
9
|
+
import { LexicalErrorBoundary as je } from "@lexical/react/LexicalErrorBoundary";
|
|
10
|
+
import { HistoryPlugin as _e } from "@lexical/react/LexicalHistoryPlugin";
|
|
11
|
+
import { LexicalNestedComposer as He } from "@lexical/react/LexicalNestedComposer";
|
|
12
|
+
import { OnChangePlugin as Fe } from "@lexical/react/LexicalOnChangePlugin";
|
|
13
|
+
import { RichTextPlugin as Xe } from "@lexical/react/LexicalRichTextPlugin";
|
|
14
|
+
import { useLexicalEditable as Be } from "@lexical/react/useLexicalEditable";
|
|
15
|
+
import { useLexicalNodeSelection as Ue } from "@lexical/react/useLexicalNodeSelection";
|
|
16
|
+
import { mergeRegister as Ge } from "@lexical/utils";
|
|
17
|
+
import { $getRoot as Qt, $isNodeSelection as lt, $getSelection as rt, $isParagraphNode as _t, $setSelection as bt, $isRangeSelection as Ke, SELECTION_CHANGE_COMMAND as qe, COMMAND_PRIORITY_LOW as ot, CLICK_COMMAND as Ve, DRAGSTART_COMMAND as Je, KEY_DELETE_COMMAND as Qe, KEY_BACKSPACE_COMMAND as Ze, KEY_ENTER_COMMAND as tr, KEY_ESCAPE_COMMAND as er, $getNodeByKey as it, RootNode as rr, TextNode as or, LineBreakNode as ir, ParagraphNode as ar, createCommand as nr } from "lexical";
|
|
18
|
+
import Nt, { useState as E, useEffect as K, useRef as G, useMemo as Zt, useCallback as S, useLayoutEffect as te, Suspense as sr } from "react";
|
|
19
|
+
import { c as Et, n as ne, o as se, p as de, q as ce, r as le, s as ue, B as ee, t as zt, I as dr, S as cr, v as lr, w as Z, x as M, y as ur, z as mr, G as gr, W as fr, b as hr, A as pr, d as br, e as yr, H as xr, L as wr, J as vr, K as Cr, M as Nr, X as kr, N as Rr, O as Er, P as Ir, Q as Pr, R as Sr } from "./index-DFEFJp4J.js";
|
|
19
20
|
import "react-dom";
|
|
20
21
|
const me = Et("Crop", [
|
|
21
22
|
["path", { d: "M6 2v14a2 2 0 0 0 2 2h14", key: "ron5a4" }],
|
|
@@ -72,7 +73,7 @@ const Mr = Et("RotateCcw", [
|
|
|
72
73
|
] }),
|
|
73
74
|
/* @__PURE__ */ b(ue, { className: "gap-2", children: [
|
|
74
75
|
/* @__PURE__ */ o(
|
|
75
|
-
|
|
76
|
+
ee,
|
|
76
77
|
{
|
|
77
78
|
variant: "outline",
|
|
78
79
|
onClick: g,
|
|
@@ -80,7 +81,7 @@ const Mr = Et("RotateCcw", [
|
|
|
80
81
|
}
|
|
81
82
|
),
|
|
82
83
|
/* @__PURE__ */ b(
|
|
83
|
-
|
|
84
|
+
ee,
|
|
84
85
|
{
|
|
85
86
|
onClick: v,
|
|
86
87
|
className: "bg-blue-500 hover:bg-blue-600 text-white",
|
|
@@ -97,11 +98,11 @@ function Dr({
|
|
|
97
98
|
}) {
|
|
98
99
|
const [r, e] = E(""), [d, v] = E("");
|
|
99
100
|
return K(() => ((() => {
|
|
100
|
-
const R = i.getEditorState().read(() =>
|
|
101
|
+
const R = i.getEditorState().read(() => Qt().getTextContent()).split(" • ");
|
|
101
102
|
e(R[0] || ""), v(R[1] || "");
|
|
102
103
|
})(), i.registerUpdateListener(({ editorState: z }) => {
|
|
103
|
-
const
|
|
104
|
-
e(
|
|
104
|
+
const k = z.read(() => Qt().getTextContent()).split(" • ");
|
|
105
|
+
e(k[0] || ""), v(k[1] || "");
|
|
105
106
|
})), [i]), /* @__PURE__ */ o("div", { className: "signature-caption-container", children: /* @__PURE__ */ b("div", { className: "signature-caption-info", children: [
|
|
106
107
|
r && /* @__PURE__ */ o("span", { className: "signature-user-name", children: r }),
|
|
107
108
|
r && d && /* @__PURE__ */ o("span", { className: "signature-separator" }),
|
|
@@ -111,8 +112,7 @@ function Dr({
|
|
|
111
112
|
}
|
|
112
113
|
const Lr = "/transform-image/";
|
|
113
114
|
function ut(i) {
|
|
114
|
-
if (!zt || i.startsWith("data:") || i.toLowerCase().endsWith(".svg"))
|
|
115
|
-
return !1;
|
|
115
|
+
if (!zt || i.startsWith("data:") || i.toLowerCase().endsWith(".svg")) return !1;
|
|
116
116
|
try {
|
|
117
117
|
const r = new URL(i).origin, e = new URL(zt).origin;
|
|
118
118
|
return r === e;
|
|
@@ -121,8 +121,7 @@ function ut(i) {
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
function ge(i) {
|
|
124
|
-
if (!ut(i))
|
|
125
|
-
return null;
|
|
124
|
+
if (!ut(i)) return null;
|
|
126
125
|
try {
|
|
127
126
|
const e = new URL(i).pathname.replace(/^\//, ""), d = "transform-image/";
|
|
128
127
|
return e.startsWith(d) ? e.slice(d.length) || null : e || null;
|
|
@@ -131,17 +130,14 @@ function ge(i) {
|
|
|
131
130
|
}
|
|
132
131
|
}
|
|
133
132
|
function Tr(i, r) {
|
|
134
|
-
if (!ut(i))
|
|
135
|
-
return i;
|
|
133
|
+
if (!ut(i)) return i;
|
|
136
134
|
const e = ge(i);
|
|
137
|
-
if (!e)
|
|
138
|
-
return i;
|
|
135
|
+
if (!e) return i;
|
|
139
136
|
const d = `${r.x},${r.y},${r.width},${r.height}`;
|
|
140
137
|
return `${zt.replace(/\/$/, "")}${Lr}${e}?crop=${d}`;
|
|
141
138
|
}
|
|
142
139
|
function ie(i) {
|
|
143
|
-
if (!ut(i))
|
|
144
|
-
return i;
|
|
140
|
+
if (!ut(i)) return i;
|
|
145
141
|
try {
|
|
146
142
|
const r = new URL(i);
|
|
147
143
|
return r.searchParams.delete("crop"), r.toString();
|
|
@@ -149,15 +145,13 @@ function ie(i) {
|
|
|
149
145
|
return i;
|
|
150
146
|
}
|
|
151
147
|
}
|
|
152
|
-
function
|
|
153
|
-
if (!ut(i))
|
|
154
|
-
return ie(i);
|
|
148
|
+
function kt(i) {
|
|
149
|
+
if (!ut(i)) return ie(i);
|
|
155
150
|
const r = ge(i);
|
|
156
151
|
return r ? `${zt.replace(/\/$/, "")}/${r}` : ie(i);
|
|
157
152
|
}
|
|
158
153
|
function $r(i) {
|
|
159
|
-
if (typeof document > "u")
|
|
160
|
-
return;
|
|
154
|
+
if (typeof document > "u") return;
|
|
161
155
|
let r = document.head || document.getElementsByTagName("head")[0], e = document.createElement("style");
|
|
162
156
|
e.type = "text/css", r.appendChild(e), e.styleSheet ? e.styleSheet.cssText = i : e.appendChild(document.createTextNode(i));
|
|
163
157
|
}
|
|
@@ -177,19 +171,19 @@ class Wr {
|
|
|
177
171
|
];
|
|
178
172
|
}, this.create = (r) => {
|
|
179
173
|
var e;
|
|
180
|
-
const { message: d, ...v } = r, g = typeof r?.id == "number" || ((e = r.id) == null ? void 0 : e.length) > 0 ? r.id : Ht++, z = this.toasts.find((
|
|
181
|
-
return this.dismissedToasts.has(g) && this.dismissedToasts.delete(g), z ? this.toasts = this.toasts.map((
|
|
182
|
-
...
|
|
174
|
+
const { message: d, ...v } = r, g = typeof r?.id == "number" || ((e = r.id) == null ? void 0 : e.length) > 0 ? r.id : Ht++, z = this.toasts.find((k) => k.id === g), R = r.dismissible === void 0 ? !0 : r.dismissible;
|
|
175
|
+
return this.dismissedToasts.has(g) && this.dismissedToasts.delete(g), z ? this.toasts = this.toasts.map((k) => k.id === g ? (this.publish({
|
|
176
|
+
...k,
|
|
183
177
|
...r,
|
|
184
178
|
id: g,
|
|
185
179
|
title: d
|
|
186
180
|
}), {
|
|
187
|
-
...
|
|
181
|
+
...k,
|
|
188
182
|
...r,
|
|
189
183
|
id: g,
|
|
190
184
|
dismissible: R,
|
|
191
185
|
title: d
|
|
192
|
-
}) :
|
|
186
|
+
}) : k) : this.addToast({
|
|
193
187
|
title: d,
|
|
194
188
|
...v,
|
|
195
189
|
dismissible: R,
|
|
@@ -243,43 +237,43 @@ class Wr {
|
|
|
243
237
|
if (z = [
|
|
244
238
|
"resolve",
|
|
245
239
|
C
|
|
246
|
-
],
|
|
240
|
+
], Nt.isValidElement(C))
|
|
247
241
|
g = !1, this.create({
|
|
248
242
|
id: d,
|
|
249
243
|
type: "default",
|
|
250
244
|
message: C
|
|
251
245
|
});
|
|
252
|
-
else if (
|
|
246
|
+
else if (Or(C) && !C.ok) {
|
|
253
247
|
g = !1;
|
|
254
|
-
const l = typeof e.error == "function" ? await e.error(`HTTP error! status: ${C.status}`) : e.error,
|
|
248
|
+
const l = typeof e.error == "function" ? await e.error(`HTTP error! status: ${C.status}`) : e.error, N = typeof e.description == "function" ? await e.description(`HTTP error! status: ${C.status}`) : e.description, L = typeof l == "object" && !Nt.isValidElement(l) ? l : {
|
|
255
249
|
message: l
|
|
256
250
|
};
|
|
257
251
|
this.create({
|
|
258
252
|
id: d,
|
|
259
253
|
type: "error",
|
|
260
|
-
description:
|
|
254
|
+
description: N,
|
|
261
255
|
...L
|
|
262
256
|
});
|
|
263
257
|
} else if (C instanceof Error) {
|
|
264
258
|
g = !1;
|
|
265
|
-
const l = typeof e.error == "function" ? await e.error(C) : e.error,
|
|
259
|
+
const l = typeof e.error == "function" ? await e.error(C) : e.error, N = typeof e.description == "function" ? await e.description(C) : e.description, L = typeof l == "object" && !Nt.isValidElement(l) ? l : {
|
|
266
260
|
message: l
|
|
267
261
|
};
|
|
268
262
|
this.create({
|
|
269
263
|
id: d,
|
|
270
264
|
type: "error",
|
|
271
|
-
description:
|
|
265
|
+
description: N,
|
|
272
266
|
...L
|
|
273
267
|
});
|
|
274
268
|
} else if (e.success !== void 0) {
|
|
275
269
|
g = !1;
|
|
276
|
-
const l = typeof e.success == "function" ? await e.success(C) : e.success,
|
|
270
|
+
const l = typeof e.success == "function" ? await e.success(C) : e.success, N = typeof e.description == "function" ? await e.description(C) : e.description, L = typeof l == "object" && !Nt.isValidElement(l) ? l : {
|
|
277
271
|
message: l
|
|
278
272
|
};
|
|
279
273
|
this.create({
|
|
280
274
|
id: d,
|
|
281
275
|
type: "success",
|
|
282
|
-
description:
|
|
276
|
+
description: N,
|
|
283
277
|
...L
|
|
284
278
|
});
|
|
285
279
|
}
|
|
@@ -289,7 +283,7 @@ class Wr {
|
|
|
289
283
|
C
|
|
290
284
|
], e.error !== void 0) {
|
|
291
285
|
g = !1;
|
|
292
|
-
const P = typeof e.error == "function" ? await e.error(C) : e.error, l = typeof e.description == "function" ? await e.description(C) : e.description, x = typeof P == "object" && !
|
|
286
|
+
const P = typeof e.error == "function" ? await e.error(C) : e.error, l = typeof e.description == "function" ? await e.description(C) : e.description, x = typeof P == "object" && !Nt.isValidElement(P) ? P : {
|
|
293
287
|
message: P
|
|
294
288
|
};
|
|
295
289
|
this.create({
|
|
@@ -301,11 +295,11 @@ class Wr {
|
|
|
301
295
|
}
|
|
302
296
|
}).finally(() => {
|
|
303
297
|
g && (this.dismiss(d), d = void 0), e.finally == null || e.finally.call(e);
|
|
304
|
-
}),
|
|
298
|
+
}), k = () => new Promise((C, P) => R.then(() => z[0] === "reject" ? P(z[1]) : C(z[1])).catch(P));
|
|
305
299
|
return typeof d != "string" && typeof d != "number" ? {
|
|
306
|
-
unwrap:
|
|
300
|
+
unwrap: k
|
|
307
301
|
} : Object.assign(d, {
|
|
308
|
-
unwrap:
|
|
302
|
+
unwrap: k
|
|
309
303
|
});
|
|
310
304
|
}, this.custom = (r, e) => {
|
|
311
305
|
const d = e?.id || Ht++;
|
|
@@ -317,23 +311,23 @@ class Wr {
|
|
|
317
311
|
}, this.getActiveToasts = () => this.toasts.filter((r) => !this.dismissedToasts.has(r.id)), this.subscribers = [], this.toasts = [], this.dismissedToasts = /* @__PURE__ */ new Set();
|
|
318
312
|
}
|
|
319
313
|
}
|
|
320
|
-
const
|
|
314
|
+
const O = new Wr(), Yr = (i, r) => {
|
|
321
315
|
const e = r?.id || Ht++;
|
|
322
|
-
return
|
|
316
|
+
return O.addToast({
|
|
323
317
|
title: i,
|
|
324
318
|
...r,
|
|
325
319
|
id: e
|
|
326
320
|
}), e;
|
|
327
|
-
},
|
|
328
|
-
success:
|
|
329
|
-
info:
|
|
330
|
-
warning:
|
|
331
|
-
error:
|
|
332
|
-
custom:
|
|
333
|
-
message:
|
|
334
|
-
promise:
|
|
335
|
-
dismiss:
|
|
336
|
-
loading:
|
|
321
|
+
}, Or = (i) => i && typeof i == "object" && "ok" in i && typeof i.ok == "boolean" && "status" in i && typeof i.status == "number", jr = Yr, _r = () => O.toasts, Hr = () => O.getActiveToasts(), Fr = Object.assign(jr, {
|
|
322
|
+
success: O.success,
|
|
323
|
+
info: O.info,
|
|
324
|
+
warning: O.warning,
|
|
325
|
+
error: O.error,
|
|
326
|
+
custom: O.custom,
|
|
327
|
+
message: O.message,
|
|
328
|
+
promise: O.promise,
|
|
329
|
+
dismiss: O.dismiss,
|
|
330
|
+
loading: O.loading
|
|
337
331
|
}, {
|
|
338
332
|
getHistory: _r,
|
|
339
333
|
getToasts: Hr
|
|
@@ -348,7 +342,7 @@ function Xr({
|
|
|
348
342
|
height: g,
|
|
349
343
|
onCropApply: z
|
|
350
344
|
}) {
|
|
351
|
-
const [R,
|
|
345
|
+
const [R, k] = E("freeform"), [C, P] = E(e), [l, N] = E(!1), x = G(null), L = G(null), [n, W] = E({ x: 0, y: 0, width: 0, height: 0 }), [I, T] = E({ x: 0, y: 0, width: 0, height: 0 }), at = G(null), mt = Zt(() => typeof v == "number" && typeof g == "number" && g > 0 ? v / g : n.width > 0 && n.height > 0 ? n.width / n.height : null, [n.height, n.width, g, v]), yt = Zt(() => {
|
|
352
346
|
switch (R) {
|
|
353
347
|
case "original":
|
|
354
348
|
return mt;
|
|
@@ -374,8 +368,7 @@ function Xr({
|
|
|
374
368
|
[n.height, n.width]
|
|
375
369
|
), xt = S(
|
|
376
370
|
(s) => {
|
|
377
|
-
if (n.width <= 0 || n.height <= 0)
|
|
378
|
-
return;
|
|
371
|
+
if (n.width <= 0 || n.height <= 0) return;
|
|
379
372
|
if (s == null) {
|
|
380
373
|
T({
|
|
381
374
|
x: 0,
|
|
@@ -399,8 +392,7 @@ function Xr({
|
|
|
399
392
|
[n.height, n.width, Y]
|
|
400
393
|
), nt = S(() => {
|
|
401
394
|
const s = x.current, p = L.current;
|
|
402
|
-
if (!s || !p)
|
|
403
|
-
return;
|
|
395
|
+
if (!s || !p) return;
|
|
404
396
|
let y = 0, f = 0, w = p;
|
|
405
397
|
for (; w && w !== s; )
|
|
406
398
|
y += w.offsetLeft, f += w.offsetTop, w = w.offsetParent;
|
|
@@ -451,13 +443,11 @@ function Xr({
|
|
|
451
443
|
f.width = Math.min(f.width, s.naturalWidth - f.x), f.height = Math.min(f.height, s.naturalHeight - f.y), r(!1), Promise.resolve(z(f));
|
|
452
444
|
}, [n, I, z, r]);
|
|
453
445
|
return K(() => {
|
|
454
|
-
i && (W({ x: 0, y: 0, width: 0, height: 0 }), T({ x: 0, y: 0, width: 0, height: 0 }),
|
|
446
|
+
i && (W({ x: 0, y: 0, width: 0, height: 0 }), T({ x: 0, y: 0, width: 0, height: 0 }), N(!1), P(kt(e)));
|
|
455
447
|
}, [i, e]), K(() => {
|
|
456
|
-
if (!i)
|
|
457
|
-
return;
|
|
448
|
+
if (!i) return;
|
|
458
449
|
const s = x.current;
|
|
459
|
-
if (!s)
|
|
460
|
-
return;
|
|
450
|
+
if (!s) return;
|
|
461
451
|
const p = new ResizeObserver(() => {
|
|
462
452
|
nt();
|
|
463
453
|
});
|
|
@@ -469,29 +459,27 @@ function Xr({
|
|
|
469
459
|
p.disconnect(), window.removeEventListener("resize", f);
|
|
470
460
|
};
|
|
471
461
|
}, [i, nt]), K(() => {
|
|
472
|
-
if (!i)
|
|
473
|
-
return;
|
|
462
|
+
if (!i) return;
|
|
474
463
|
const s = (y) => {
|
|
475
464
|
const f = at.current;
|
|
476
|
-
if (!f)
|
|
477
|
-
return;
|
|
465
|
+
if (!f) return;
|
|
478
466
|
y.preventDefault();
|
|
479
|
-
const w = y.clientX - f.startX, F = y.clientY - f.startY, gt = n.width, ft = n.height, tt = yt ?? null, { x: V, y: st, width:
|
|
467
|
+
const w = y.clientX - f.startX, F = y.clientY - f.startY, gt = n.width, ft = n.height, tt = yt ?? null, { x: V, y: st, width: j, height: J } = f.initialRect;
|
|
480
468
|
if (f.mode === "move") {
|
|
481
|
-
const ht = Math.max(0, gt -
|
|
469
|
+
const ht = Math.max(0, gt - j), It = Math.max(0, ft - J);
|
|
482
470
|
T(
|
|
483
471
|
Y({
|
|
484
472
|
x: Math.max(0, Math.min(ht, V + w)),
|
|
485
473
|
y: Math.max(0, Math.min(It, st + F)),
|
|
486
|
-
width:
|
|
474
|
+
width: j,
|
|
487
475
|
height: J
|
|
488
476
|
})
|
|
489
477
|
);
|
|
490
478
|
return;
|
|
491
479
|
}
|
|
492
480
|
const D = f.mode;
|
|
493
|
-
let _ = V, et = st, X =
|
|
494
|
-
D.includes("e") && (X =
|
|
481
|
+
let _ = V, et = st, X = j, B = J;
|
|
482
|
+
D.includes("e") && (X = j + w), D.includes("w") && (_ = V + w, X = j - w), D.includes("s") && (B = J + F), D.includes("n") && (et = st + F, B = J - F), tt != null && tt > 0 && (D === "e" || D === "w" ? (B = X / tt, D.includes("n") && (et = st + J - B)) : D === "n" || D === "s" ? (X = B * tt, D.includes("w") && (_ = V + j - X)) : (B = X / tt, D.includes("n") && (et = st + J - B), D.includes("w") && (_ = V + j - X))), T(Y({ x: _, y: et, width: X, height: B }));
|
|
495
483
|
}, p = () => {
|
|
496
484
|
at.current = null;
|
|
497
485
|
};
|
|
@@ -528,10 +516,10 @@ function Xr({
|
|
|
528
516
|
className: "cteditor-max-w-full cteditor-max-h-[460px] cteditor-w-auto cteditor-h-auto cteditor-select-none cteditor-block",
|
|
529
517
|
draggable: !1,
|
|
530
518
|
onLoad: () => {
|
|
531
|
-
|
|
519
|
+
N(!1), nt();
|
|
532
520
|
},
|
|
533
521
|
onError: () => {
|
|
534
|
-
|
|
522
|
+
N(!0);
|
|
535
523
|
}
|
|
536
524
|
}
|
|
537
525
|
) }),
|
|
@@ -602,8 +590,8 @@ function Xr({
|
|
|
602
590
|
/* @__PURE__ */ o("p", { className: "cteditor-text-sm cteditor-font-medium cteditor-mb-2", children: "Aspect ratio" }),
|
|
603
591
|
/* @__PURE__ */ o("div", { className: "cteditor-grid cteditor-grid-cols-3 cteditor-gap-2", children: [
|
|
604
592
|
{ id: "freeform", label: "Freeform", icon: me },
|
|
605
|
-
{ id: "original", label: "Original", icon:
|
|
606
|
-
{ id: "1:1", label: "1:1", icon:
|
|
593
|
+
{ id: "original", label: "Original", icon: dr },
|
|
594
|
+
{ id: "1:1", label: "1:1", icon: cr },
|
|
607
595
|
{ id: "4:3", label: "4:3", icon: re },
|
|
608
596
|
{ id: "16:9", label: "16:9", icon: re },
|
|
609
597
|
{ id: "3:4", label: "3:4", icon: oe },
|
|
@@ -615,7 +603,7 @@ function Xr({
|
|
|
615
603
|
{
|
|
616
604
|
type: "button",
|
|
617
605
|
onClick: () => {
|
|
618
|
-
|
|
606
|
+
k(s.id);
|
|
619
607
|
},
|
|
620
608
|
className: `cteditor-h-20 cteditor-rounded-md cteditor-border cteditor-text-sm cteditor-transition-colors cteditor-flex cteditor-flex-col cteditor-items-center cteditor-justify-center cteditor-gap-1.5 ${y ? "cteditor-border-primary cteditor-bg-primary/10 cteditor-text-primary" : "cteditor-border-border hover:cteditor-bg-accent"}`,
|
|
621
609
|
children: [
|
|
@@ -649,7 +637,7 @@ function Xr({
|
|
|
649
637
|
{
|
|
650
638
|
type: "button",
|
|
651
639
|
onClick: () => {
|
|
652
|
-
|
|
640
|
+
k("freeform"), xt(null);
|
|
653
641
|
},
|
|
654
642
|
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 cteditor-transition-colors",
|
|
655
643
|
children: "Reset"
|
|
@@ -679,7 +667,7 @@ function Xr({
|
|
|
679
667
|
}
|
|
680
668
|
) });
|
|
681
669
|
}
|
|
682
|
-
const Rt = /* @__PURE__ */ new Set(), ae =
|
|
670
|
+
const Rt = /* @__PURE__ */ new Set(), ae = nr("RIGHT_CLICK_IMAGE_COMMAND");
|
|
683
671
|
function Br(i) {
|
|
684
672
|
if (!Rt.has(i))
|
|
685
673
|
throw new Promise((r) => {
|
|
@@ -700,10 +688,10 @@ function Ur({
|
|
|
700
688
|
height: g,
|
|
701
689
|
maxWidth: z,
|
|
702
690
|
onError: R,
|
|
703
|
-
onLoad:
|
|
691
|
+
onLoad: k
|
|
704
692
|
}) {
|
|
705
693
|
Br(d);
|
|
706
|
-
const C = typeof v == "number", P = typeof g == "number", l = C && P,
|
|
694
|
+
const C = typeof v == "number", P = typeof g == "number", l = C && P, N = C ? v : "auto", x = P ? g : "auto";
|
|
707
695
|
return /* @__PURE__ */ o(
|
|
708
696
|
"img",
|
|
709
697
|
{
|
|
@@ -712,14 +700,14 @@ function Ur({
|
|
|
712
700
|
alt: i,
|
|
713
701
|
ref: e,
|
|
714
702
|
style: l ? {
|
|
715
|
-
width:
|
|
703
|
+
width: N,
|
|
716
704
|
height: "auto",
|
|
717
|
-
aspectRatio: `${
|
|
705
|
+
aspectRatio: `${N} / ${x}`,
|
|
718
706
|
maxWidth: "100%"
|
|
719
707
|
} : C ? {
|
|
720
708
|
// Only width known (e.g. bogus height stripped from source HTML):
|
|
721
709
|
// fix the width and let the browser compute height naturally.
|
|
722
|
-
width:
|
|
710
|
+
width: N,
|
|
723
711
|
height: "auto",
|
|
724
712
|
maxWidth: "100%"
|
|
725
713
|
} : P ? {
|
|
@@ -732,7 +720,7 @@ function Ur({
|
|
|
732
720
|
height: "auto"
|
|
733
721
|
},
|
|
734
722
|
onError: R,
|
|
735
|
-
onLoad:
|
|
723
|
+
onLoad: k,
|
|
736
724
|
draggable: "false"
|
|
737
725
|
}
|
|
738
726
|
);
|
|
@@ -765,7 +753,7 @@ function Kr(i, r = 12e3) {
|
|
|
765
753
|
}, v.src = i;
|
|
766
754
|
});
|
|
767
755
|
}
|
|
768
|
-
function
|
|
756
|
+
function bo({
|
|
769
757
|
src: i,
|
|
770
758
|
altText: r,
|
|
771
759
|
nodeKey: e,
|
|
@@ -774,14 +762,14 @@ function po({
|
|
|
774
762
|
maxWidth: g,
|
|
775
763
|
resizable: z,
|
|
776
764
|
showCaption: R,
|
|
777
|
-
caption:
|
|
765
|
+
caption: k,
|
|
778
766
|
captionsEnabled: C,
|
|
779
767
|
originalPrompt: P,
|
|
780
768
|
position: l = "none",
|
|
781
|
-
linkUrl:
|
|
769
|
+
linkUrl: N
|
|
782
770
|
}) {
|
|
783
|
-
const x = G(null), L = G(null), [n, W, I] =
|
|
784
|
-
|
|
771
|
+
const x = G(null), L = G(null), [n, W, I] = Ue(e), [T, at] = E(!1), mt = G(!1), { isCollabActive: yt } = We(), [u] = Ye(), [Y, xt] = E(null), nt = G(null), [q, wt] = E(!1), Mt = Be(), [s, p] = E(!1), [y, f] = E(""), [w, F] = E(!1), [gt, ft] = E(!1), [tt, V] = E(""), [st, j] = E(""), [J, D] = E(!1), _ = G(null), [et, X] = E(0), [B, ht] = E(!1), It = G(null), [fe, vt] = E(null), [At, Ct] = E(!1), [Ft, Xt] = E(!1), dt = G(null), Pt = lr()?.apiKey, Dt = et > 0 && et < 350;
|
|
772
|
+
te(() => {
|
|
785
773
|
if (!n || !lt(Y) || q) {
|
|
786
774
|
vt(null);
|
|
787
775
|
return;
|
|
@@ -821,7 +809,7 @@ function po({
|
|
|
821
809
|
const a = new ResizeObserver(t);
|
|
822
810
|
return a.observe(x.current), () => a.disconnect();
|
|
823
811
|
}
|
|
824
|
-
}, [d, v, n]),
|
|
812
|
+
}, [d, v, n]), te(() => {
|
|
825
813
|
if ((l === "left" || l === "right") && typeof d == "number" && x.current) {
|
|
826
814
|
const t = x.current.closest(".editor-image"), a = t?.parentElement, c = u.getRootElement(), m = c ? c.getBoundingClientRect().width : d + 32, h = `${Math.min(d + 32, m)}px`;
|
|
827
815
|
return t && (t.style.removeProperty("display"), t.style.setProperty("max-width", h, "important")), a && a.style.setProperty("max-width", h, "important"), () => {
|
|
@@ -847,20 +835,20 @@ function po({
|
|
|
847
835
|
const a = rt(), c = L.current;
|
|
848
836
|
if (n && lt(a) && a.getNodes().length === 1) {
|
|
849
837
|
if (R)
|
|
850
|
-
return bt(null), t.preventDefault(),
|
|
838
|
+
return bt(null), t.preventDefault(), k.focus(), !0;
|
|
851
839
|
if (c !== null && c !== document.activeElement)
|
|
852
840
|
return t.preventDefault(), c.focus(), !0;
|
|
853
841
|
}
|
|
854
842
|
return !1;
|
|
855
843
|
},
|
|
856
|
-
[
|
|
844
|
+
[k, n, R]
|
|
857
845
|
), Ut = S(
|
|
858
|
-
(t) => nt.current ===
|
|
846
|
+
(t) => nt.current === k || L.current === t.target ? (bt(null), u.update(() => {
|
|
859
847
|
W(!0);
|
|
860
848
|
const a = u.getRootElement();
|
|
861
849
|
a !== null && a.focus();
|
|
862
850
|
}), !0) : !1,
|
|
863
|
-
[
|
|
851
|
+
[k, u, W]
|
|
864
852
|
), Tt = S(
|
|
865
853
|
(t) => {
|
|
866
854
|
const a = t;
|
|
@@ -882,7 +870,7 @@ function po({
|
|
|
882
870
|
(t) => {
|
|
883
871
|
u.getEditorState().read(() => {
|
|
884
872
|
const a = rt();
|
|
885
|
-
t.target.tagName === "IMG" &&
|
|
873
|
+
t.target.tagName === "IMG" && Ke(a) && a.getNodes().length === 1 && u.dispatchCommand(
|
|
886
874
|
ae,
|
|
887
875
|
t
|
|
888
876
|
);
|
|
@@ -892,17 +880,17 @@ function po({
|
|
|
892
880
|
);
|
|
893
881
|
K(() => {
|
|
894
882
|
let t = !0;
|
|
895
|
-
const a = u.getRootElement(), c =
|
|
883
|
+
const a = u.getRootElement(), c = Ge(
|
|
896
884
|
u.registerUpdateListener(({ editorState: m }) => {
|
|
897
885
|
t && xt(m.read(() => rt()));
|
|
898
886
|
}),
|
|
899
887
|
u.registerCommand(
|
|
900
|
-
|
|
888
|
+
qe,
|
|
901
889
|
(m, h) => (nt.current = h, !1),
|
|
902
890
|
ot
|
|
903
891
|
),
|
|
904
892
|
u.registerCommand(
|
|
905
|
-
|
|
893
|
+
Ve,
|
|
906
894
|
Tt,
|
|
907
895
|
ot
|
|
908
896
|
),
|
|
@@ -912,23 +900,23 @@ function po({
|
|
|
912
900
|
ot
|
|
913
901
|
),
|
|
914
902
|
u.registerCommand(
|
|
915
|
-
|
|
903
|
+
Je,
|
|
916
904
|
(m) => m.target === x.current ? (m.preventDefault(), !0) : !1,
|
|
917
905
|
ot
|
|
918
906
|
),
|
|
919
907
|
u.registerCommand(
|
|
920
|
-
|
|
908
|
+
Qe,
|
|
921
909
|
Lt,
|
|
922
910
|
ot
|
|
923
911
|
),
|
|
924
912
|
u.registerCommand(
|
|
925
|
-
|
|
913
|
+
Ze,
|
|
926
914
|
Lt,
|
|
927
915
|
ot
|
|
928
916
|
),
|
|
929
|
-
u.registerCommand(
|
|
917
|
+
u.registerCommand(tr, Bt, ot),
|
|
930
918
|
u.registerCommand(
|
|
931
|
-
|
|
919
|
+
er,
|
|
932
920
|
Ut,
|
|
933
921
|
ot
|
|
934
922
|
)
|
|
@@ -1018,14 +1006,13 @@ function po({
|
|
|
1018
1006
|
}, []), Ce = S(
|
|
1019
1007
|
(t) => {
|
|
1020
1008
|
t.preventDefault(), t.stopPropagation();
|
|
1021
|
-
const a =
|
|
1009
|
+
const a = kt(i);
|
|
1022
1010
|
if (!(ut(i) && i !== a) && !(typeof d == "number" || typeof v == "number"))
|
|
1023
1011
|
return;
|
|
1024
1012
|
u.update(
|
|
1025
1013
|
() => {
|
|
1026
1014
|
const A = it(e);
|
|
1027
|
-
if (!Z(A))
|
|
1028
|
-
return;
|
|
1015
|
+
if (!Z(A)) return;
|
|
1029
1016
|
A.setSrc(a), A.setWidthAndHeight("inherit", "inherit");
|
|
1030
1017
|
const $ = rt();
|
|
1031
1018
|
$ && bt($.clone());
|
|
@@ -1038,11 +1025,11 @@ function po({
|
|
|
1038
1025
|
}), M.success("Image reset to original size and crop");
|
|
1039
1026
|
},
|
|
1040
1027
|
[u, e, i, d, v]
|
|
1041
|
-
),
|
|
1028
|
+
), Ne = S(
|
|
1042
1029
|
async (t) => {
|
|
1043
1030
|
let a = i;
|
|
1044
1031
|
if (ut(i))
|
|
1045
|
-
a =
|
|
1032
|
+
a = kt(i);
|
|
1046
1033
|
else {
|
|
1047
1034
|
if (!Pt) {
|
|
1048
1035
|
M.error("API key is required to upload and crop external images.");
|
|
@@ -1050,8 +1037,8 @@ function po({
|
|
|
1050
1037
|
}
|
|
1051
1038
|
const m = M.loading("Uploading image…");
|
|
1052
1039
|
try {
|
|
1053
|
-
a = (await
|
|
1054
|
-
|
|
1040
|
+
a = (await ur.post(
|
|
1041
|
+
mr.project.fileUploadFromUrl,
|
|
1055
1042
|
{ url: i, prefix: "uploads" },
|
|
1056
1043
|
{ headers: { "x-api-key": Pt } }
|
|
1057
1044
|
)).data.fileUrl, M.dismiss(m);
|
|
@@ -1069,8 +1056,7 @@ function po({
|
|
|
1069
1056
|
try {
|
|
1070
1057
|
await Kr(c), Rt.add(c), u.update(() => {
|
|
1071
1058
|
const m = it(e);
|
|
1072
|
-
if (!Z(m))
|
|
1073
|
-
return;
|
|
1059
|
+
if (!Z(m)) return;
|
|
1074
1060
|
m.setSrc(c), m.setWidthAndHeight(t.width, t.height);
|
|
1075
1061
|
const h = rt();
|
|
1076
1062
|
h && bt(h.clone());
|
|
@@ -1080,15 +1066,15 @@ function po({
|
|
|
1080
1066
|
}
|
|
1081
1067
|
},
|
|
1082
1068
|
[u, e, i, Pt]
|
|
1083
|
-
),
|
|
1084
|
-
|
|
1069
|
+
), ke = S(() => {
|
|
1070
|
+
N && !n && (_.current = setTimeout(() => {
|
|
1085
1071
|
D(!0);
|
|
1086
1072
|
}, 300));
|
|
1087
|
-
}, [
|
|
1073
|
+
}, [N, n]), Re = S(() => {
|
|
1088
1074
|
_.current && (clearTimeout(_.current), _.current = null), D(!1);
|
|
1089
1075
|
}, []), Gt = S((t) => {
|
|
1090
|
-
t.preventDefault(), t.stopPropagation(),
|
|
1091
|
-
}, [
|
|
1076
|
+
t.preventDefault(), t.stopPropagation(), N && window.open(N, "_blank", "noopener,noreferrer");
|
|
1077
|
+
}, [N]);
|
|
1092
1078
|
K(() => () => {
|
|
1093
1079
|
_.current && clearTimeout(_.current);
|
|
1094
1080
|
}, []), K(() => {
|
|
@@ -1097,8 +1083,7 @@ function po({
|
|
|
1097
1083
|
wt(!1), Xt(!1);
|
|
1098
1084
|
}, [i]);
|
|
1099
1085
|
const Kt = async () => {
|
|
1100
|
-
if (!y.trim() || w)
|
|
1101
|
-
return;
|
|
1086
|
+
if (!y.trim() || w) return;
|
|
1102
1087
|
F(!0);
|
|
1103
1088
|
const t = M.loading("Refining image...", {
|
|
1104
1089
|
description: "This may take 10-30 seconds. Please wait."
|
|
@@ -1106,7 +1091,7 @@ function po({
|
|
|
1106
1091
|
try {
|
|
1107
1092
|
let a = y.trim();
|
|
1108
1093
|
const m = y.trim().replace(/^(add|also add|include|with|and)\s+(some|a|an)\s+/gi, "").replace(/^(add|also add|include|with|and)\s+/gi, "").trim(), h = (U) => {
|
|
1109
|
-
const
|
|
1094
|
+
const Ot = U.toLowerCase();
|
|
1110
1095
|
return [
|
|
1111
1096
|
"article",
|
|
1112
1097
|
"write",
|
|
@@ -1123,16 +1108,15 @@ function po({
|
|
|
1123
1108
|
"add some images",
|
|
1124
1109
|
"include images",
|
|
1125
1110
|
"include pictures"
|
|
1126
|
-
].some((St) =>
|
|
1111
|
+
].some((St) => Ot.includes(St));
|
|
1127
1112
|
};
|
|
1128
1113
|
let A = "";
|
|
1129
1114
|
if (P && P.trim()) {
|
|
1130
1115
|
const U = P.trim();
|
|
1131
1116
|
h(U) && r && r !== "Generated image" && r.trim() ? A = r.trim() : A = U;
|
|
1132
|
-
} else
|
|
1133
|
-
r && r !== "Generated image" && r.trim() && (A = r.trim());
|
|
1117
|
+
} else r && r !== "Generated image" && r.trim() && (A = r.trim());
|
|
1134
1118
|
A ? a = `${A} with ${m}` : a = m;
|
|
1135
|
-
const $ = await fetch(`${
|
|
1119
|
+
const $ = await fetch(`${Ir}/agent/stream`, {
|
|
1136
1120
|
method: "POST",
|
|
1137
1121
|
headers: { "Content-Type": "application/json" },
|
|
1138
1122
|
body: JSON.stringify({
|
|
@@ -1145,58 +1129,52 @@ function po({
|
|
|
1145
1129
|
if (!$.ok)
|
|
1146
1130
|
throw new Error(`Image service error: ${$.status}`);
|
|
1147
1131
|
const H = $.body?.getReader(), Yt = new TextDecoder();
|
|
1148
|
-
if (!H)
|
|
1149
|
-
throw new Error("Stream reader not available");
|
|
1132
|
+
if (!H) throw new Error("Stream reader not available");
|
|
1150
1133
|
let ct = null;
|
|
1151
|
-
t:
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
break;
|
|
1156
|
-
const Vt = Yt.decode(jt, { stream: !0 }).split(`
|
|
1134
|
+
t: for (; ; ) {
|
|
1135
|
+
const { done: U, value: Ot } = await H.read();
|
|
1136
|
+
if (U) break;
|
|
1137
|
+
const Vt = Yt.decode(Ot, { stream: !0 }).split(`
|
|
1157
1138
|
`);
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
throw H.cancel(), new Error(Q.message || "Image generation failed");
|
|
1173
|
-
}
|
|
1174
|
-
} catch (Q) {
|
|
1175
|
-
if (Q instanceof SyntaxError)
|
|
1176
|
-
continue;
|
|
1177
|
-
throw Q;
|
|
1139
|
+
for (const St of Vt) {
|
|
1140
|
+
if (!St.startsWith("data: ")) continue;
|
|
1141
|
+
const jt = St.slice(6).trim();
|
|
1142
|
+
if (!(!jt || jt === "[DONE]"))
|
|
1143
|
+
try {
|
|
1144
|
+
const Q = JSON.parse(jt);
|
|
1145
|
+
if (Q.type === "image_ready") {
|
|
1146
|
+
ct = Q.url, H.cancel();
|
|
1147
|
+
break t;
|
|
1148
|
+
} else {
|
|
1149
|
+
if (Q.type === "image_failed")
|
|
1150
|
+
throw H.cancel(), new Error(Q.error || "Image generation failed");
|
|
1151
|
+
if (Q.type === "error")
|
|
1152
|
+
throw H.cancel(), new Error(Q.message || "Image generation failed");
|
|
1178
1153
|
}
|
|
1179
|
-
|
|
1154
|
+
} catch (Q) {
|
|
1155
|
+
if (Q instanceof SyntaxError) continue;
|
|
1156
|
+
throw Q;
|
|
1157
|
+
}
|
|
1180
1158
|
}
|
|
1159
|
+
}
|
|
1181
1160
|
if (!ct)
|
|
1182
1161
|
throw new Error("Failed to generate image - no image received");
|
|
1183
1162
|
M.dismiss(t), M.success("Image refined successfully!", {
|
|
1184
1163
|
description: "Compare the images and choose which to keep."
|
|
1185
|
-
}), V(ct),
|
|
1164
|
+
}), V(ct), j(a), ft(!0), f(""), p(!1);
|
|
1186
1165
|
} catch (a) {
|
|
1187
|
-
if (M.dismiss(t), a instanceof
|
|
1166
|
+
if (M.dismiss(t), a instanceof Pr) {
|
|
1188
1167
|
const c = a.code === "API_KEYS_DISABLED" ? "API Keys Disabled" : "API Key Required";
|
|
1189
1168
|
M.error(c, {
|
|
1190
1169
|
description: a.message,
|
|
1191
1170
|
duration: 8e3
|
|
1192
1171
|
});
|
|
1193
|
-
} else
|
|
1194
|
-
a
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
});
|
|
1172
|
+
} else a instanceof Sr ? M.error("Credits Issue", {
|
|
1173
|
+
description: a.message,
|
|
1174
|
+
duration: 8e3
|
|
1175
|
+
}) : M.error("Failed to refine image", {
|
|
1176
|
+
description: a instanceof Error ? a.message : "Unknown error. Please try again."
|
|
1177
|
+
});
|
|
1200
1178
|
} finally {
|
|
1201
1179
|
F(!1);
|
|
1202
1180
|
}
|
|
@@ -1208,19 +1186,18 @@ function po({
|
|
|
1208
1186
|
const a = rt();
|
|
1209
1187
|
a && bt(a.clone());
|
|
1210
1188
|
}
|
|
1211
|
-
}), ft(!1), V(""),
|
|
1189
|
+
}), ft(!1), V(""), j(""), M.success("Image replaced successfully!", {
|
|
1212
1190
|
description: "The image has been updated with the refined version."
|
|
1213
1191
|
});
|
|
1214
1192
|
}, Ie = () => {
|
|
1215
|
-
ft(!1), V(""),
|
|
1216
|
-
}, Pe = n && lt(Y) && !T, qt = (n || T) && Mt, Wt =
|
|
1193
|
+
ft(!1), V(""), j("");
|
|
1194
|
+
}, Pe = n && lt(Y) && !T, qt = (n || T) && Mt, Wt = kt(i), Se = S(() => {
|
|
1217
1195
|
dt.current && i === dt.current && (Rt.add(i), dt.current = null, Ct(!1));
|
|
1218
1196
|
}, [i]), ze = S(() => {
|
|
1219
1197
|
if (!Ft && ut(i) && i !== Wt) {
|
|
1220
1198
|
Xt(!0), wt(!1), Ct(!1), dt.current = null, u.update(() => {
|
|
1221
1199
|
const a = it(e);
|
|
1222
|
-
if (!Z(a))
|
|
1223
|
-
return;
|
|
1200
|
+
if (!Z(a)) return;
|
|
1224
1201
|
a.setSrc(Wt);
|
|
1225
1202
|
const c = rt();
|
|
1226
1203
|
c && bt(c.clone());
|
|
@@ -1270,20 +1247,20 @@ function po({
|
|
|
1270
1247
|
},
|
|
1271
1248
|
[T, n, W, I]
|
|
1272
1249
|
);
|
|
1273
|
-
return /* @__PURE__ */ o(
|
|
1250
|
+
return /* @__PURE__ */ o(sr, { fallback: null, children: /* @__PURE__ */ b(Jt, { children: [
|
|
1274
1251
|
/* @__PURE__ */ b(
|
|
1275
1252
|
"div",
|
|
1276
1253
|
{
|
|
1277
1254
|
draggable: Pe,
|
|
1278
1255
|
style: Me(),
|
|
1279
1256
|
onClick: Ae,
|
|
1280
|
-
onMouseEnter:
|
|
1257
|
+
onMouseEnter: ke,
|
|
1281
1258
|
onMouseLeave: Re,
|
|
1282
1259
|
children: [
|
|
1283
1260
|
q ? /* @__PURE__ */ o(Gr, {}) : /* @__PURE__ */ o(
|
|
1284
1261
|
Ur,
|
|
1285
1262
|
{
|
|
1286
|
-
className: qt ? `focused ${lt(Y) ? "draggable" : ""}` :
|
|
1263
|
+
className: qt ? `focused ${lt(Y) ? "draggable" : ""}` : N ? "cteditor-cursor-pointer" : null,
|
|
1287
1264
|
src: i,
|
|
1288
1265
|
altText: r,
|
|
1289
1266
|
imageRef: x,
|
|
@@ -1295,17 +1272,17 @@ function po({
|
|
|
1295
1272
|
}
|
|
1296
1273
|
),
|
|
1297
1274
|
At && !q && /* @__PURE__ */ b("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: [
|
|
1298
|
-
/* @__PURE__ */ o(
|
|
1275
|
+
/* @__PURE__ */ o(gr, { className: "cteditor-w-10 cteditor-h-10 cteditor-text-foreground cteditor-animate-spin cteditor-mb-2", "aria-hidden": !0 }),
|
|
1299
1276
|
/* @__PURE__ */ o("span", { className: "cteditor-text-sm cteditor-font-medium cteditor-text-foreground", children: "Applying crop..." })
|
|
1300
1277
|
] }),
|
|
1301
|
-
J &&
|
|
1278
|
+
J && N && !n && /* @__PURE__ */ b(
|
|
1302
1279
|
"div",
|
|
1303
1280
|
{
|
|
1304
1281
|
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",
|
|
1305
1282
|
style: { zIndex: 10 },
|
|
1306
1283
|
children: [
|
|
1307
1284
|
/* @__PURE__ */ o(zr, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-muted-foreground cteditor-flex-shrink-0" }),
|
|
1308
|
-
/* @__PURE__ */ o("span", { className: "cteditor-text-sm cteditor-text-foreground cteditor-truncate cteditor-flex-1", children:
|
|
1285
|
+
/* @__PURE__ */ o("span", { className: "cteditor-text-sm cteditor-text-foreground cteditor-truncate cteditor-flex-1", children: N }),
|
|
1309
1286
|
/* @__PURE__ */ o(
|
|
1310
1287
|
"button",
|
|
1311
1288
|
{
|
|
@@ -1334,7 +1311,7 @@ function po({
|
|
|
1334
1311
|
className: ` cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-foreground/10 cteditor-transition-colors ${l === "left" ? "cteditor-bg-foreground/10" : ""}`,
|
|
1335
1312
|
"aria-label": "Wrap text left",
|
|
1336
1313
|
title: "Wrap text left",
|
|
1337
|
-
children: /* @__PURE__ */ o(
|
|
1314
|
+
children: /* @__PURE__ */ o(fr, {})
|
|
1338
1315
|
}
|
|
1339
1316
|
),
|
|
1340
1317
|
/* @__PURE__ */ o(
|
|
@@ -1345,7 +1322,7 @@ function po({
|
|
|
1345
1322
|
className: ` cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-foreground/10 cteditor-transition-colors ${l === "right" ? "cteditor-bg-foreground/10" : ""}`,
|
|
1346
1323
|
"aria-label": "Wrap text right",
|
|
1347
1324
|
title: "Wrap text right",
|
|
1348
|
-
children: /* @__PURE__ */ o(
|
|
1325
|
+
children: /* @__PURE__ */ o(hr, {})
|
|
1349
1326
|
}
|
|
1350
1327
|
),
|
|
1351
1328
|
/* @__PURE__ */ o("div", { className: "cteditor-w-px cteditor-h-5 cteditor-bg-foreground/10 cteditor-mx-0.5" }),
|
|
@@ -1357,7 +1334,7 @@ function po({
|
|
|
1357
1334
|
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-foreground/10 cteditor-transition-colors ${l === "inline-left" ? "cteditor-bg-foreground/10" : ""}`,
|
|
1358
1335
|
"aria-label": "Align left",
|
|
1359
1336
|
title: "Align left (no text wrap)",
|
|
1360
|
-
children: /* @__PURE__ */ o(
|
|
1337
|
+
children: /* @__PURE__ */ o(pr, {})
|
|
1361
1338
|
}
|
|
1362
1339
|
),
|
|
1363
1340
|
/* @__PURE__ */ o(
|
|
@@ -1368,7 +1345,7 @@ function po({
|
|
|
1368
1345
|
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-foreground/10 cteditor-transition-colors ${l === "inline-center" || l === "full" ? "cteditor-bg-foreground/10" : ""}`,
|
|
1369
1346
|
"aria-label": "Align center",
|
|
1370
1347
|
title: "Align center (no text wrap)",
|
|
1371
|
-
children: /* @__PURE__ */ o(
|
|
1348
|
+
children: /* @__PURE__ */ o(br, {})
|
|
1372
1349
|
}
|
|
1373
1350
|
),
|
|
1374
1351
|
/* @__PURE__ */ o(
|
|
@@ -1379,7 +1356,7 @@ function po({
|
|
|
1379
1356
|
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-foreground/10 cteditor-transition-colors ${l === "inline-right" ? "cteditor-bg-foreground/10" : ""}`,
|
|
1380
1357
|
"aria-label": "Align right",
|
|
1381
1358
|
title: "Align right (no text wrap)",
|
|
1382
|
-
children: /* @__PURE__ */ o(
|
|
1359
|
+
children: /* @__PURE__ */ o(yr, {})
|
|
1383
1360
|
}
|
|
1384
1361
|
),
|
|
1385
1362
|
/* @__PURE__ */ o("div", { className: "cteditor-w-px cteditor-h-5 cteditor-bg-foreground/10 cteditor-mx-0.5" }),
|
|
@@ -1391,7 +1368,7 @@ function po({
|
|
|
1391
1368
|
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-foreground/10 cteditor-transition-colors ${l === "none" ? "cteditor-bg-foreground/10" : ""}`,
|
|
1392
1369
|
"aria-label": "Inline",
|
|
1393
1370
|
title: "Inline with text",
|
|
1394
|
-
children: /* @__PURE__ */ o(
|
|
1371
|
+
children: /* @__PURE__ */ o(xr, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
|
|
1395
1372
|
}
|
|
1396
1373
|
),
|
|
1397
1374
|
/* @__PURE__ */ o("div", { className: "cteditor-w-px cteditor-h-5 cteditor-bg-foreground/10 cteditor-mx-0.5" }),
|
|
@@ -1407,7 +1384,7 @@ function po({
|
|
|
1407
1384
|
children: /* @__PURE__ */ o(me, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
|
|
1408
1385
|
}
|
|
1409
1386
|
),
|
|
1410
|
-
(
|
|
1387
|
+
(kt(i) !== i || typeof d == "number" || typeof v == "number") && /* @__PURE__ */ o(
|
|
1411
1388
|
"button",
|
|
1412
1389
|
{
|
|
1413
1390
|
type: "button",
|
|
@@ -1420,15 +1397,15 @@ function po({
|
|
|
1420
1397
|
)
|
|
1421
1398
|
] })
|
|
1422
1399
|
] }),
|
|
1423
|
-
|
|
1400
|
+
N && /* @__PURE__ */ o(
|
|
1424
1401
|
"button",
|
|
1425
1402
|
{
|
|
1426
1403
|
type: "button",
|
|
1427
1404
|
onClick: Gt,
|
|
1428
1405
|
className: " cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-md cteditor-bg-accent hover:cteditor-bg-accent/95 cteditor-transition-colors cteditor-shadow-md cteditor-border cteditor-border-foreground/20",
|
|
1429
1406
|
"aria-label": "Visit link",
|
|
1430
|
-
title: `Visit: ${
|
|
1431
|
-
children: /* @__PURE__ */ o(
|
|
1407
|
+
title: `Visit: ${N}`,
|
|
1408
|
+
children: /* @__PURE__ */ o(wr, {})
|
|
1432
1409
|
}
|
|
1433
1410
|
),
|
|
1434
1411
|
P && /* @__PURE__ */ o(
|
|
@@ -1441,7 +1418,7 @@ function po({
|
|
|
1441
1418
|
className: " cteditor-size-8 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-md cteditor-bg-accent hover:cteditor-bg-accent/90 cteditor-transition-colors cteditor-shadow-md cteditor-border cteditor-border-foreground/20",
|
|
1442
1419
|
"aria-label": "Refine image",
|
|
1443
1420
|
title: "Refine image",
|
|
1444
|
-
children: /* @__PURE__ */ o(
|
|
1421
|
+
children: /* @__PURE__ */ o(vr, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
|
|
1445
1422
|
}
|
|
1446
1423
|
),
|
|
1447
1424
|
/* @__PURE__ */ o(
|
|
@@ -1454,7 +1431,7 @@ function po({
|
|
|
1454
1431
|
className: " cteditor-size-8 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-md cteditor-bg-accent hover:cteditor-bg-accent/90 cteditor-transition-colors cteditor-shadow-md cteditor-border cteditor-border-foreground/20",
|
|
1455
1432
|
"aria-label": "Open image in new tab",
|
|
1456
1433
|
title: "Open in new tab",
|
|
1457
|
-
children: /* @__PURE__ */ o(
|
|
1434
|
+
children: /* @__PURE__ */ o(Cr, {})
|
|
1458
1435
|
}
|
|
1459
1436
|
),
|
|
1460
1437
|
/* @__PURE__ */ o(
|
|
@@ -1467,7 +1444,7 @@ function po({
|
|
|
1467
1444
|
className: " cteditor-size-8 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-md cteditor-bg-accent hover:cteditor-bg-destructive hover:cteditor-text-destructive-foreground cteditor-transition-colors cteditor-shadow-md cteditor-border cteditor-border-foreground/20",
|
|
1468
1445
|
"aria-label": "Delete image",
|
|
1469
1446
|
title: "Delete image",
|
|
1470
|
-
children: /* @__PURE__ */ o(
|
|
1447
|
+
children: /* @__PURE__ */ o(Nr, {})
|
|
1471
1448
|
}
|
|
1472
1449
|
)
|
|
1473
1450
|
]
|
|
@@ -1529,7 +1506,7 @@ function po({
|
|
|
1529
1506
|
},
|
|
1530
1507
|
disabled: w,
|
|
1531
1508
|
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",
|
|
1532
|
-
children: /* @__PURE__ */ o(
|
|
1509
|
+
children: /* @__PURE__ */ o(kr, { size: 16 })
|
|
1533
1510
|
}
|
|
1534
1511
|
)
|
|
1535
1512
|
] })
|
|
@@ -1553,7 +1530,7 @@ function po({
|
|
|
1553
1530
|
]
|
|
1554
1531
|
}
|
|
1555
1532
|
),
|
|
1556
|
-
R && (r.startsWith("Signature by") ? /* @__PURE__ */ o(Dr, { caption:
|
|
1533
|
+
R && (r.startsWith("Signature by") ? /* @__PURE__ */ o(Dr, { caption: k }) : /* @__PURE__ */ o(
|
|
1557
1534
|
"div",
|
|
1558
1535
|
{
|
|
1559
1536
|
className: "image-caption-container",
|
|
@@ -1564,42 +1541,42 @@ function po({
|
|
|
1564
1541
|
...l === "inline-center" || l === "full" ? { margin: "0 auto" } : l === "inline-right" ? { marginLeft: "auto" } : l === "left" ? { float: "left", clear: "left" } : l === "right" ? { float: "right", clear: "right" } : {}
|
|
1565
1542
|
},
|
|
1566
1543
|
children: /* @__PURE__ */ b(
|
|
1567
|
-
|
|
1544
|
+
He,
|
|
1568
1545
|
{
|
|
1569
|
-
initialEditor:
|
|
1546
|
+
initialEditor: k,
|
|
1570
1547
|
initialNodes: [
|
|
1571
|
-
|
|
1572
|
-
Rr,
|
|
1573
|
-
Er,
|
|
1574
|
-
Ir,
|
|
1548
|
+
rr,
|
|
1575
1549
|
or,
|
|
1576
|
-
|
|
1550
|
+
ir,
|
|
1551
|
+
ar,
|
|
1552
|
+
Te,
|
|
1553
|
+
Le
|
|
1577
1554
|
],
|
|
1578
1555
|
children: [
|
|
1579
|
-
/* @__PURE__ */ o(
|
|
1556
|
+
/* @__PURE__ */ o($e, {}),
|
|
1580
1557
|
/* @__PURE__ */ o(
|
|
1581
|
-
|
|
1558
|
+
Xe,
|
|
1582
1559
|
{
|
|
1583
1560
|
contentEditable: /* @__PURE__ */ o(
|
|
1584
|
-
|
|
1561
|
+
Oe,
|
|
1585
1562
|
{
|
|
1586
1563
|
"aria-placeholder": "Enter a caption...",
|
|
1587
1564
|
placeholder: () => /* @__PURE__ */ o("span", { className: "cteditor-text-xs cteditor-absolute cteditor-left-2 cteditor-top-[7px]", children: "Enter a caption..." }),
|
|
1588
1565
|
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"
|
|
1589
1566
|
}
|
|
1590
1567
|
),
|
|
1591
|
-
ErrorBoundary:
|
|
1568
|
+
ErrorBoundary: je
|
|
1592
1569
|
}
|
|
1593
1570
|
),
|
|
1594
1571
|
/* @__PURE__ */ o(
|
|
1595
|
-
|
|
1572
|
+
Fe,
|
|
1596
1573
|
{
|
|
1597
1574
|
onChange: () => {
|
|
1598
1575
|
}
|
|
1599
1576
|
}
|
|
1600
1577
|
),
|
|
1601
|
-
/* @__PURE__ */ o(
|
|
1602
|
-
/* @__PURE__ */ o(
|
|
1578
|
+
/* @__PURE__ */ o(_e, {}),
|
|
1579
|
+
/* @__PURE__ */ o(Rr, { namespace: Er.namespace })
|
|
1603
1580
|
]
|
|
1604
1581
|
}
|
|
1605
1582
|
)
|
|
@@ -1614,7 +1591,7 @@ function po({
|
|
|
1614
1591
|
altText: r,
|
|
1615
1592
|
width: d,
|
|
1616
1593
|
height: v,
|
|
1617
|
-
onCropApply:
|
|
1594
|
+
onCropApply: Ne
|
|
1618
1595
|
}
|
|
1619
1596
|
),
|
|
1620
1597
|
/* @__PURE__ */ o(
|
|
@@ -1632,5 +1609,5 @@ function po({
|
|
|
1632
1609
|
}
|
|
1633
1610
|
export {
|
|
1634
1611
|
ae as RIGHT_CLICK_IMAGE_COMMAND,
|
|
1635
|
-
|
|
1612
|
+
bo as default
|
|
1636
1613
|
};
|