eddyter 1.4.3 → 1.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,55 +1,55 @@
1
- import { jsx as r, jsxs as h, Fragment as Ft } from "react/jsx-runtime";
2
- import { I as Ye } from "./ImageResizer-Bt7kgv0a.js";
3
- import { CodeNode as Jt } from "@lexical/code";
4
- import { LinkNode as Qt } from "@lexical/link";
5
- import { AutoFocusPlugin as _e } from "@lexical/react/LexicalAutoFocusPlugin";
6
- import { useCollaborationContext as Oe } from "@lexical/react/LexicalCollaborationContext";
7
- import { useLexicalComposerContext as He } from "@lexical/react/LexicalComposerContext";
8
- import { ContentEditable as Zt } from "@lexical/react/LexicalContentEditable";
9
- import { LexicalErrorBoundary as te } from "@lexical/react/LexicalErrorBoundary";
10
- import { HistoryPlugin as ee } from "@lexical/react/LexicalHistoryPlugin";
11
- import { LexicalNestedComposer as re } from "@lexical/react/LexicalNestedComposer";
12
- import { OnChangePlugin as oe } from "@lexical/react/LexicalOnChangePlugin";
13
- import { RichTextPlugin as ie } from "@lexical/react/LexicalRichTextPlugin";
14
- import { useLexicalEditable as Fe } from "@lexical/react/useLexicalEditable";
15
- import { useLexicalNodeSelection as Xe } from "@lexical/react/useLexicalNodeSelection";
16
- import { mergeRegister as Be } from "@lexical/utils";
17
- import { RootNode as ae, TextNode as ne, LineBreakNode as se, ParagraphNode as de, $isNodeSelection as at, $getSelection as nt, $isParagraphNode as $t, $setSelection as bt, $isRangeSelection as Ue, SELECTION_CHANGE_COMMAND as Ke, COMMAND_PRIORITY_LOW as Q, CLICK_COMMAND as qe, DRAGSTART_COMMAND as Ge, KEY_DELETE_COMMAND as Ve, KEY_BACKSPACE_COMMAND as Je, KEY_ENTER_COMMAND as Qe, KEY_ESCAPE_COMMAND as Ze, $getNodeByKey as st, createCommand as tr } from "lexical";
18
- import yt, { useState as I, useRef as K, useMemo as Xt, useCallback as S, useEffect as tt, useLayoutEffect as Bt, Suspense as er } from "react";
19
- import { c as xt, D as ce, a as le, b as ue, d as me, e as ge, f as fe, B as Ut, L as he, i as pe, C as Et, I as rr, S as or, u as ir, $ as Z, t as M, g as ar, h as nr, j as sr, W as dr, k as cr, A as lr, l as ur, m as mr, T as gr, n as fr, o as hr, E as pr, p as br, X as yr, q as xr, r as vr, s as wr } from "./index-Bvb6NDBM.js";
1
+ import { jsx as r, jsxs as h, Fragment as Kt } from "react/jsx-runtime";
2
+ import { I as _e } from "./ImageResizer-Bt7kgv0a.js";
3
+ import { CodeNode as ee } from "@lexical/code";
4
+ import { LinkNode as re } from "@lexical/link";
5
+ import { AutoFocusPlugin as Oe } from "@lexical/react/LexicalAutoFocusPlugin";
6
+ import { useCollaborationContext as He } from "@lexical/react/LexicalCollaborationContext";
7
+ import { useLexicalComposerContext as Fe } from "@lexical/react/LexicalComposerContext";
8
+ import { ContentEditable as oe } from "@lexical/react/LexicalContentEditable";
9
+ import { LexicalErrorBoundary as ie } from "@lexical/react/LexicalErrorBoundary";
10
+ import { HistoryPlugin as ae } from "@lexical/react/LexicalHistoryPlugin";
11
+ import { LexicalNestedComposer as ne } from "@lexical/react/LexicalNestedComposer";
12
+ import { OnChangePlugin as se } from "@lexical/react/LexicalOnChangePlugin";
13
+ import { RichTextPlugin as de } from "@lexical/react/LexicalRichTextPlugin";
14
+ import { useLexicalEditable as Xe } from "@lexical/react/useLexicalEditable";
15
+ import { useLexicalNodeSelection as Be } from "@lexical/react/useLexicalNodeSelection";
16
+ import { mergeRegister as Ue } from "@lexical/utils";
17
+ import { RootNode as ce, TextNode as le, LineBreakNode as ue, ParagraphNode as me, $isNodeSelection as st, $getSelection as dt, $isParagraphNode as Yt, $setSelection as xt, $isRangeSelection as Ke, SELECTION_CHANGE_COMMAND as Ge, COMMAND_PRIORITY_LOW as tt, CLICK_COMMAND as qe, DRAGSTART_COMMAND as Ve, KEY_DELETE_COMMAND as Je, KEY_BACKSPACE_COMMAND as Qe, KEY_ENTER_COMMAND as Ze, KEY_ESCAPE_COMMAND as tr, $getNodeByKey as ct, createCommand as er } from "lexical";
18
+ import wt, { useState as I, useRef as V, useMemo as Gt, useCallback as S, useEffect as rt, useLayoutEffect as qt, Suspense as rr } from "react";
19
+ import { c as vt, D as ge, a as fe, b as he, d as pe, e as be, f as ye, B as Vt, L as xe, i as we, C as It, I as or, S as ir, u as ar, $ as et, t as M, g as nr, h as sr, j as dr, W as cr, k as lr, A as ur, l as mr, m as gr, T as fr, n as hr, o as pr, E as br, p as yr, X as xr, q as wr, r as vr, s as Cr } from "./index-DMZDKMjN.js";
20
20
  import "react-dom";
21
- const be = xt("Crop", [
21
+ const ve = vt("Crop", [
22
22
  ["path", { d: "M6 2v14a2 2 0 0 0 2 2h14", key: "ron5a4" }],
23
23
  ["path", { d: "M18 22V8a2 2 0 0 0-2-2H2", key: "7s9ehn" }]
24
24
  ]);
25
- const Cr = xt("Link2", [
25
+ const Nr = vt("Link2", [
26
26
  ["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
27
27
  ["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
28
28
  ["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
29
29
  ]);
30
- const Kt = xt("RectangleHorizontal", [
30
+ const Jt = vt("RectangleHorizontal", [
31
31
  ["rect", { width: "20", height: "12", x: "2", y: "6", rx: "2", key: "9lu3g6" }]
32
32
  ]);
33
- const qt = xt("RectangleVertical", [
33
+ const Qt = vt("RectangleVertical", [
34
34
  ["rect", { width: "12", height: "20", x: "6", y: "2", rx: "2", key: "1oxtiu" }]
35
35
  ]);
36
- const Nr = xt("RotateCcw", [
36
+ const kr = vt("RotateCcw", [
37
37
  ["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
38
38
  ["path", { d: "M3 3v5h5", key: "1xhq8a" }]
39
- ]), kr = ({
39
+ ]), Rr = ({
40
40
  open: i,
41
41
  onOpenChange: o,
42
42
  oldImageUrl: e,
43
43
  newImageUrl: d,
44
- onReplace: w,
45
- onCancel: x
46
- }) => /* @__PURE__ */ r(ce, { open: i, onOpenChange: o, children: /* @__PURE__ */ h(le, { className: "sm:max-w-[800px] max-h-[90vh] overflow-y-auto", children: [
47
- /* @__PURE__ */ h(ue, { children: [
48
- /* @__PURE__ */ h(me, { className: "flex items-center gap-2 text-xl", children: [
44
+ onReplace: N,
45
+ onCancel: w
46
+ }) => /* @__PURE__ */ r(ge, { open: i, onOpenChange: o, children: /* @__PURE__ */ h(fe, { className: "sm:max-w-[800px] max-h-[90vh] overflow-y-auto", children: [
47
+ /* @__PURE__ */ h(he, { children: [
48
+ /* @__PURE__ */ h(pe, { className: "flex items-center gap-2 text-xl", children: [
49
49
  /* @__PURE__ */ r("span", { className: "text-2xl", children: "🔄" }),
50
50
  "Compare Images"
51
51
  ] }),
52
- /* @__PURE__ */ r(ge, { className: "text-sm pt-1", children: "Choose whether to replace the original image with the refined version." })
52
+ /* @__PURE__ */ r(be, { className: "text-sm pt-1", children: "Choose whether to replace the original image with the refined version." })
53
53
  ] }),
54
54
  /* @__PURE__ */ h("div", { className: "space-y-4 py-4", children: [
55
55
  /* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-4", children: /* @__PURE__ */ h("div", { className: "space-y-2", children: [
@@ -71,19 +71,19 @@ const Nr = xt("RotateCcw", [
71
71
  ' Clicking "Replace" will update the image in your document. This action cannot be undone.'
72
72
  ] }) })
73
73
  ] }),
74
- /* @__PURE__ */ h(fe, { className: "gap-2", children: [
74
+ /* @__PURE__ */ h(ye, { className: "gap-2", children: [
75
75
  /* @__PURE__ */ r(
76
- Ut,
76
+ Vt,
77
77
  {
78
78
  variant: "outline",
79
- onClick: x,
79
+ onClick: w,
80
80
  children: "Keep Original"
81
81
  }
82
82
  ),
83
83
  /* @__PURE__ */ h(
84
- Ut,
84
+ Vt,
85
85
  {
86
- onClick: w,
86
+ onClick: N,
87
87
  className: "bg-blue-500 hover:bg-blue-600 text-white",
88
88
  children: [
89
89
  /* @__PURE__ */ r("span", { className: "mr-2", children: "✓" }),
@@ -93,27 +93,27 @@ const Nr = xt("RotateCcw", [
93
93
  )
94
94
  ] })
95
95
  ] }) });
96
- function Rr({
96
+ function Er({
97
97
  caption: i
98
98
  }) {
99
99
  return /* @__PURE__ */ r("div", { className: "signature-caption-container", children: /* @__PURE__ */ h(
100
- re,
100
+ ne,
101
101
  {
102
102
  initialEditor: i,
103
103
  initialNodes: [
104
- ae,
105
- ne,
106
- se,
107
- de,
108
- Qt,
109
- Jt
104
+ ce,
105
+ le,
106
+ ue,
107
+ me,
108
+ re,
109
+ ee
110
110
  ],
111
111
  children: [
112
112
  /* @__PURE__ */ r(
113
- ie,
113
+ de,
114
114
  {
115
115
  contentEditable: /* @__PURE__ */ r(
116
- Zt,
116
+ oe,
117
117
  {
118
118
  "aria-placeholder": "Enter signature name...",
119
119
  placeholder: /* @__PURE__ */ r("div", { style: {
@@ -129,30 +129,30 @@ function Rr({
129
129
  className: "signature-caption-editable"
130
130
  }
131
131
  ),
132
- ErrorBoundary: te
132
+ ErrorBoundary: ie
133
133
  }
134
134
  ),
135
- /* @__PURE__ */ r(oe, { onChange: () => {
135
+ /* @__PURE__ */ r(se, { onChange: () => {
136
136
  } }),
137
- /* @__PURE__ */ r(ee, {}),
138
- /* @__PURE__ */ r(he, { namespace: pe.namespace })
137
+ /* @__PURE__ */ r(ae, {}),
138
+ /* @__PURE__ */ r(xe, { namespace: we.namespace })
139
139
  ]
140
140
  }
141
141
  ) });
142
142
  }
143
- const Er = "/transform-image/";
144
- function gt(i) {
145
- if (!Et || i.startsWith("data:") || i.toLowerCase().endsWith(".svg"))
143
+ const Ir = "/transform-image/";
144
+ function ht(i) {
145
+ if (!It || i.startsWith("data:") || i.toLowerCase().endsWith(".svg"))
146
146
  return !1;
147
147
  try {
148
- const o = new URL(i).origin, e = new URL(Et).origin;
148
+ const o = new URL(i).origin, e = new URL(It).origin;
149
149
  return o === e;
150
150
  } catch {
151
151
  return !1;
152
152
  }
153
153
  }
154
- function ye(i) {
155
- if (!gt(i))
154
+ function Ce(i) {
155
+ if (!ht(i))
156
156
  return null;
157
157
  try {
158
158
  const e = new URL(i).pathname.replace(/^\//, ""), d = "transform-image/";
@@ -161,17 +161,17 @@ function ye(i) {
161
161
  return null;
162
162
  }
163
163
  }
164
- function Ir(i, o) {
165
- if (!gt(i))
164
+ function Pr(i, o) {
165
+ if (!ht(i))
166
166
  return i;
167
- const e = ye(i);
167
+ const e = Ce(i);
168
168
  if (!e)
169
169
  return i;
170
170
  const d = `${o.x},${o.y},${o.width},${o.height}`;
171
- return `${Et.replace(/\/$/, "")}${Er}${e}?crop=${d}`;
171
+ return `${It.replace(/\/$/, "")}${Ir}${e}?crop=${d}`;
172
172
  }
173
- function Gt(i) {
174
- if (!gt(i))
173
+ function Zt(i) {
174
+ if (!ht(i))
175
175
  return i;
176
176
  try {
177
177
  const o = new URL(i);
@@ -180,21 +180,21 @@ function Gt(i) {
180
180
  return i;
181
181
  }
182
182
  }
183
- function kt(i) {
184
- if (!gt(i))
185
- return Gt(i);
186
- const o = ye(i);
187
- return o ? `${Et.replace(/\/$/, "")}/${o}` : Gt(i);
183
+ function Rt(i) {
184
+ if (!ht(i))
185
+ return Zt(i);
186
+ const o = Ce(i);
187
+ return o ? `${It.replace(/\/$/, "")}/${o}` : Zt(i);
188
188
  }
189
- function Pr(i) {
189
+ function Sr(i) {
190
190
  if (typeof document > "u")
191
191
  return;
192
192
  let o = document.head || document.getElementsByTagName("head")[0], e = document.createElement("style");
193
193
  e.type = "text/css", o.appendChild(e), e.styleSheet ? e.styleSheet.cssText = i : e.appendChild(document.createTextNode(i));
194
194
  }
195
195
  Array(12).fill(0);
196
- let Tt = 1;
197
- class Sr {
196
+ let _t = 1;
197
+ class zr {
198
198
  constructor() {
199
199
  this.subscribe = (o) => (this.subscribers.push(o), () => {
200
200
  const e = this.subscribers.indexOf(o);
@@ -208,24 +208,24 @@ class Sr {
208
208
  ];
209
209
  }, this.create = (o) => {
210
210
  var e;
211
- const { message: d, ...w } = o, x = typeof o?.id == "number" || ((e = o.id) == null ? void 0 : e.length) > 0 ? o.id : Tt++, L = this.toasts.find((N) => N.id === x), P = o.dismissible === void 0 ? !0 : o.dismissible;
212
- return this.dismissedToasts.has(x) && this.dismissedToasts.delete(x), L ? this.toasts = this.toasts.map((N) => N.id === x ? (this.publish({
213
- ...N,
211
+ const { message: d, ...N } = o, w = typeof o?.id == "number" || ((e = o.id) == null ? void 0 : e.length) > 0 ? o.id : _t++, L = this.toasts.find((k) => k.id === w), P = o.dismissible === void 0 ? !0 : o.dismissible;
212
+ return this.dismissedToasts.has(w) && this.dismissedToasts.delete(w), L ? this.toasts = this.toasts.map((k) => k.id === w ? (this.publish({
213
+ ...k,
214
214
  ...o,
215
- id: x,
215
+ id: w,
216
216
  title: d
217
217
  }), {
218
- ...N,
218
+ ...k,
219
219
  ...o,
220
- id: x,
220
+ id: w,
221
221
  dismissible: P,
222
222
  title: d
223
- }) : N) : this.addToast({
223
+ }) : k) : this.addToast({
224
224
  title: d,
225
- ...w,
225
+ ...N,
226
226
  dismissible: P,
227
- id: x
228
- }), x;
227
+ id: w
228
+ }), w;
229
229
  }, this.dismiss = (o) => (o ? (this.dismissedToasts.add(o), requestAnimationFrame(() => this.subscribers.forEach((e) => e({
230
230
  id: o,
231
231
  dismiss: !0
@@ -268,78 +268,78 @@ class Sr {
268
268
  message: e.loading,
269
269
  description: typeof e.description != "function" ? e.description : void 0
270
270
  }));
271
- const w = Promise.resolve(o instanceof Function ? o() : o);
272
- let x = d !== void 0, L;
273
- const P = w.then(async (C) => {
271
+ const N = Promise.resolve(o instanceof Function ? o() : o);
272
+ let w = d !== void 0, L;
273
+ const P = N.then(async (v) => {
274
274
  if (L = [
275
275
  "resolve",
276
- C
277
- ], yt.isValidElement(C))
278
- x = !1, this.create({
276
+ v
277
+ ], wt.isValidElement(v))
278
+ w = !1, this.create({
279
279
  id: d,
280
280
  type: "default",
281
- message: C
281
+ message: v
282
282
  });
283
- else if (Mr(C) && !C.ok) {
284
- x = !1;
285
- const c = typeof e.error == "function" ? await e.error(`HTTP error! status: ${C.status}`) : e.error, k = typeof e.description == "function" ? await e.description(`HTTP error! status: ${C.status}`) : e.description, D = typeof c == "object" && !yt.isValidElement(c) ? c : {
283
+ else if (Ar(v) && !v.ok) {
284
+ w = !1;
285
+ const c = typeof e.error == "function" ? await e.error(`HTTP error! status: ${v.status}`) : e.error, C = typeof e.description == "function" ? await e.description(`HTTP error! status: ${v.status}`) : e.description, D = typeof c == "object" && !wt.isValidElement(c) ? c : {
286
286
  message: c
287
287
  };
288
288
  this.create({
289
289
  id: d,
290
290
  type: "error",
291
- description: k,
291
+ description: C,
292
292
  ...D
293
293
  });
294
- } else if (C instanceof Error) {
295
- x = !1;
296
- const c = typeof e.error == "function" ? await e.error(C) : e.error, k = typeof e.description == "function" ? await e.description(C) : e.description, D = typeof c == "object" && !yt.isValidElement(c) ? c : {
294
+ } else if (v instanceof Error) {
295
+ w = !1;
296
+ const c = typeof e.error == "function" ? await e.error(v) : e.error, C = typeof e.description == "function" ? await e.description(v) : e.description, D = typeof c == "object" && !wt.isValidElement(c) ? c : {
297
297
  message: c
298
298
  };
299
299
  this.create({
300
300
  id: d,
301
301
  type: "error",
302
- description: k,
302
+ description: C,
303
303
  ...D
304
304
  });
305
305
  } else if (e.success !== void 0) {
306
- x = !1;
307
- const c = typeof e.success == "function" ? await e.success(C) : e.success, k = typeof e.description == "function" ? await e.description(C) : e.description, D = typeof c == "object" && !yt.isValidElement(c) ? c : {
306
+ w = !1;
307
+ const c = typeof e.success == "function" ? await e.success(v) : e.success, C = typeof e.description == "function" ? await e.description(v) : e.description, D = typeof c == "object" && !wt.isValidElement(c) ? c : {
308
308
  message: c
309
309
  };
310
310
  this.create({
311
311
  id: d,
312
312
  type: "success",
313
- description: k,
313
+ description: C,
314
314
  ...D
315
315
  });
316
316
  }
317
- }).catch(async (C) => {
317
+ }).catch(async (v) => {
318
318
  if (L = [
319
319
  "reject",
320
- C
320
+ v
321
321
  ], e.error !== void 0) {
322
- x = !1;
323
- const E = typeof e.error == "function" ? await e.error(C) : e.error, c = typeof e.description == "function" ? await e.description(C) : e.description, v = typeof E == "object" && !yt.isValidElement(E) ? E : {
322
+ w = !1;
323
+ const E = typeof e.error == "function" ? await e.error(v) : e.error, c = typeof e.description == "function" ? await e.description(v) : e.description, y = typeof E == "object" && !wt.isValidElement(E) ? E : {
324
324
  message: E
325
325
  };
326
326
  this.create({
327
327
  id: d,
328
328
  type: "error",
329
329
  description: c,
330
- ...v
330
+ ...y
331
331
  });
332
332
  }
333
333
  }).finally(() => {
334
- x && (this.dismiss(d), d = void 0), e.finally == null || e.finally.call(e);
335
- }), N = () => new Promise((C, E) => P.then(() => L[0] === "reject" ? E(L[1]) : C(L[1])).catch(E));
334
+ w && (this.dismiss(d), d = void 0), e.finally == null || e.finally.call(e);
335
+ }), k = () => new Promise((v, E) => P.then(() => L[0] === "reject" ? E(L[1]) : v(L[1])).catch(E));
336
336
  return typeof d != "string" && typeof d != "number" ? {
337
- unwrap: N
337
+ unwrap: k
338
338
  } : Object.assign(d, {
339
- unwrap: N
339
+ unwrap: k
340
340
  });
341
341
  }, this.custom = (o, e) => {
342
- const d = e?.id || Tt++;
342
+ const d = e?.id || _t++;
343
343
  return this.create({
344
344
  jsx: o(d),
345
345
  id: d,
@@ -348,41 +348,41 @@ class Sr {
348
348
  }, this.getActiveToasts = () => this.toasts.filter((o) => !this.dismissedToasts.has(o.id)), this.subscribers = [], this.toasts = [], this.dismissedToasts = /* @__PURE__ */ new Set();
349
349
  }
350
350
  }
351
- const W = new Sr(), zr = (i, o) => {
352
- const e = o?.id || Tt++;
353
- return W.addToast({
351
+ const Y = new zr(), Mr = (i, o) => {
352
+ const e = o?.id || _t++;
353
+ return Y.addToast({
354
354
  title: i,
355
355
  ...o,
356
356
  id: e
357
357
  }), e;
358
- }, Mr = (i) => i && typeof i == "object" && "ok" in i && typeof i.ok == "boolean" && "status" in i && typeof i.status == "number", Ar = zr, Dr = () => W.toasts, Lr = () => W.getActiveToasts(), $r = Object.assign(Ar, {
359
- success: W.success,
360
- info: W.info,
361
- warning: W.warning,
362
- error: W.error,
363
- custom: W.custom,
364
- message: W.message,
365
- promise: W.promise,
366
- dismiss: W.dismiss,
367
- loading: W.loading
358
+ }, Ar = (i) => i && typeof i == "object" && "ok" in i && typeof i.ok == "boolean" && "status" in i && typeof i.status == "number", Dr = Mr, Lr = () => Y.toasts, $r = () => Y.getActiveToasts(), Tr = Object.assign(Dr, {
359
+ success: Y.success,
360
+ info: Y.info,
361
+ warning: Y.warning,
362
+ error: Y.error,
363
+ custom: Y.custom,
364
+ message: Y.message,
365
+ promise: Y.promise,
366
+ dismiss: Y.dismiss,
367
+ loading: Y.loading
368
368
  }, {
369
- getHistory: Dr,
370
- getToasts: Lr
369
+ getHistory: Lr,
370
+ getToasts: $r
371
371
  });
372
- Pr("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");
373
- function Tr({
372
+ Sr("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");
373
+ function Wr({
374
374
  open: i,
375
375
  onOpenChange: o,
376
376
  src: e,
377
377
  altText: d,
378
- width: w,
379
- height: x,
378
+ width: N,
379
+ height: w,
380
380
  onCropApply: L
381
381
  }) {
382
- const [P, N] = I("freeform"), [C, E] = I(e), [c, k] = I(!1), v = K(null), D = K(null), [n, T] = I({ x: 0, y: 0, width: 0, height: 0 }), [R, $] = I({ x: 0, y: 0, width: 0, height: 0 }), et = K(null), dt = Xt(() => typeof w == "number" && typeof x == "number" && x > 0 ? w / x : n.width > 0 && n.height > 0 ? n.width / n.height : null, [n.height, n.width, x, w]), ft = Xt(() => {
382
+ const [P, k] = I("freeform"), [v, E] = I(e), [c, C] = I(!1), y = V(null), D = V(null), [n, W] = I({ x: 0, y: 0, width: 0, height: 0 }), [R, $] = I({ x: 0, y: 0, width: 0, height: 0 }), ot = V(null), lt = Gt(() => typeof N == "number" && typeof w == "number" && w > 0 ? N / w : n.width > 0 && n.height > 0 ? n.width / n.height : null, [n.height, n.width, w, N]), pt = Gt(() => {
383
383
  switch (P) {
384
384
  case "original":
385
- return dt;
385
+ return lt;
386
386
  case "1:1":
387
387
  return 1;
388
388
  case "4:3":
@@ -396,14 +396,14 @@ function Tr({
396
396
  default:
397
397
  return null;
398
398
  }
399
- }, [dt, P]), m = 24, j = S(
399
+ }, [lt, P]), m = 24, j = S(
400
400
  (s) => {
401
- let { x: p, y: b, width: g, height: y } = s;
402
- const O = n.width, ct = n.height;
403
- return p = Math.max(0, Math.min(p, O - m)), b = Math.max(0, Math.min(b, ct - m)), g = Math.max(m, Math.min(g, O - p)), y = Math.max(m, Math.min(y, ct - b)), { x: p, y: b, width: g, height: y };
401
+ let { x: p, y: b, width: g, height: x } = s;
402
+ const F = n.width, ut = n.height;
403
+ return p = Math.max(0, Math.min(p, F - m)), b = Math.max(0, Math.min(b, ut - m)), g = Math.max(m, Math.min(g, F - p)), x = Math.max(m, Math.min(x, ut - b)), { x: p, y: b, width: g, height: x };
404
404
  },
405
405
  [n.height, n.width]
406
- ), ht = S(
406
+ ), bt = S(
407
407
  (s) => {
408
408
  if (n.width <= 0 || n.height <= 0)
409
409
  return;
@@ -417,33 +417,33 @@ function Tr({
417
417
  return;
418
418
  }
419
419
  const p = n.width * 0.9, b = n.height * 0.9;
420
- let g = p, y = g / s;
421
- y > b && (y = b, g = y * s), $(
420
+ let g = p, x = g / s;
421
+ x > b && (x = b, g = x * s), $(
422
422
  j({
423
423
  x: (n.width - g) / 2,
424
- y: (n.height - y) / 2,
424
+ y: (n.height - x) / 2,
425
425
  width: g,
426
- height: y
426
+ height: x
427
427
  })
428
428
  );
429
429
  },
430
430
  [n.height, n.width, j]
431
- ), rt = S(() => {
432
- const s = v.current, p = D.current;
431
+ ), it = S(() => {
432
+ const s = y.current, p = D.current;
433
433
  if (!s || !p)
434
434
  return;
435
- let b = 0, g = 0, y = p;
436
- for (; y && y !== s; )
437
- b += y.offsetLeft, g += y.offsetTop, y = y.offsetParent;
438
- T({
435
+ let b = 0, g = 0, x = p;
436
+ for (; x && x !== s; )
437
+ b += x.offsetLeft, g += x.offsetTop, x = x.offsetParent;
438
+ W({
439
439
  x: b,
440
440
  y: g,
441
441
  width: p.offsetWidth,
442
442
  height: p.offsetHeight
443
443
  });
444
- }, []), q = S(
444
+ }, []), J = S(
445
445
  (s) => {
446
- n.width <= 0 || n.height <= 0 || (s.preventDefault(), s.stopPropagation(), s.target.setPointerCapture?.(s.pointerId), et.current = {
446
+ n.width <= 0 || n.height <= 0 || (s.preventDefault(), s.stopPropagation(), s.target.setPointerCapture?.(s.pointerId), ot.current = {
447
447
  mode: "move",
448
448
  startX: s.clientX,
449
449
  startY: s.clientY,
@@ -451,9 +451,9 @@ function Tr({
451
451
  });
452
452
  },
453
453
  [n.height, n.width, R]
454
- ), It = S(
454
+ ), Pt = S(
455
455
  (s, p) => {
456
- n.width <= 0 || n.height <= 0 || (s.preventDefault(), s.stopPropagation(), s.target.setPointerCapture?.(s.pointerId), et.current = {
456
+ n.width <= 0 || n.height <= 0 || (s.preventDefault(), s.stopPropagation(), s.target.setPointerCapture?.(s.pointerId), ot.current = {
457
457
  mode: p,
458
458
  startX: s.clientX,
459
459
  startY: s.clientY,
@@ -461,14 +461,14 @@ function Tr({
461
461
  });
462
462
  },
463
463
  [n.height, n.width, R]
464
- ), Pt = S(async () => {
464
+ ), St = S(async () => {
465
465
  if (n.width <= 0 || n.height <= 0) {
466
466
  o(!1);
467
467
  return;
468
468
  }
469
469
  const s = D.current;
470
470
  if (!s || !s.naturalWidth || !s.naturalHeight) {
471
- $r.error("Could not read image dimensions");
471
+ Tr.error("Could not read image dimensions");
472
472
  return;
473
473
  }
474
474
  const p = s.naturalWidth / n.width, b = s.naturalHeight / n.height, g = {
@@ -481,50 +481,50 @@ function Tr({
481
481
  };
482
482
  g.width = Math.min(g.width, s.naturalWidth - g.x), g.height = Math.min(g.height, s.naturalHeight - g.y), await Promise.resolve(L(g)), o(!1);
483
483
  }, [n, R, L, o]);
484
- return tt(() => {
485
- i && (T({ x: 0, y: 0, width: 0, height: 0 }), $({ x: 0, y: 0, width: 0, height: 0 }), k(!1), E(kt(e)));
486
- }, [i, e]), tt(() => {
484
+ return rt(() => {
485
+ i && (W({ x: 0, y: 0, width: 0, height: 0 }), $({ x: 0, y: 0, width: 0, height: 0 }), C(!1), E(Rt(e)));
486
+ }, [i, e]), rt(() => {
487
487
  if (!i)
488
488
  return;
489
- const s = v.current;
489
+ const s = y.current;
490
490
  if (!s)
491
491
  return;
492
492
  const p = new ResizeObserver(() => {
493
- rt();
493
+ it();
494
494
  });
495
495
  p.observe(s);
496
496
  const b = D.current;
497
497
  b && p.observe(b);
498
- const g = () => rt();
498
+ const g = () => it();
499
499
  return window.addEventListener("resize", g), () => {
500
500
  p.disconnect(), window.removeEventListener("resize", g);
501
501
  };
502
- }, [i, rt]), tt(() => {
502
+ }, [i, it]), rt(() => {
503
503
  if (!i)
504
504
  return;
505
505
  const s = (b) => {
506
- const g = et.current;
506
+ const g = ot.current;
507
507
  if (!g)
508
508
  return;
509
509
  b.preventDefault();
510
- const y = b.clientX - g.startX, O = b.clientY - g.startY, ct = n.width, lt = n.height, G = ft ?? null, { x: B, y: ot, width: Y, height: U } = g.initialRect;
510
+ const x = b.clientX - g.startX, F = b.clientY - g.startY, ut = n.width, mt = n.height, Q = pt ?? null, { x: K, y: at, width: _, height: G } = g.initialRect;
511
511
  if (g.mode === "move") {
512
- const ut = Math.max(0, ct - Y), vt = Math.max(0, lt - U);
512
+ const gt = Math.max(0, ut - _), Ct = Math.max(0, mt - G);
513
513
  $(
514
514
  j({
515
- x: Math.max(0, Math.min(ut, B + y)),
516
- y: Math.max(0, Math.min(vt, ot + O)),
517
- width: Y,
518
- height: U
515
+ x: Math.max(0, Math.min(gt, K + x)),
516
+ y: Math.max(0, Math.min(Ct, at + F)),
517
+ width: _,
518
+ height: G
519
519
  })
520
520
  );
521
521
  return;
522
522
  }
523
523
  const A = g.mode;
524
- let _ = B, V = ot, H = Y, F = U;
525
- A.includes("e") && (H = Y + y), A.includes("w") && (_ = B + y, H = Y - y), A.includes("s") && (F = U + O), A.includes("n") && (V = ot + O, F = U - O), G != null && G > 0 && (A === "e" || A === "w" ? (F = H / G, A.includes("n") && (V = ot + U - F)) : A === "n" || A === "s" ? (H = F * G, A.includes("w") && (_ = B + Y - H)) : (F = H / G, A.includes("n") && (V = ot + U - F), A.includes("w") && (_ = B + Y - H))), $(j({ x: _, y: V, width: H, height: F }));
524
+ let O = K, Z = at, X = _, B = G;
525
+ A.includes("e") && (X = _ + x), A.includes("w") && (O = K + x, X = _ - x), A.includes("s") && (B = G + F), A.includes("n") && (Z = at + F, B = G - F), Q != null && Q > 0 && (A === "e" || A === "w" ? (B = X / Q, A.includes("n") && (Z = at + G - B)) : A === "n" || A === "s" ? (X = B * Q, A.includes("w") && (O = K + _ - X)) : (B = X / Q, A.includes("n") && (Z = at + G - B), A.includes("w") && (O = K + _ - X))), $(j({ x: O, y: Z, width: X, height: B }));
526
526
  }, p = () => {
527
- et.current = null;
527
+ ot.current = null;
528
528
  };
529
529
  return window.addEventListener("pointermove", s), window.addEventListener("pointerup", p), () => {
530
530
  window.removeEventListener("pointermove", s), window.removeEventListener("pointerup", p);
@@ -533,12 +533,12 @@ function Tr({
533
533
  i,
534
534
  n.width,
535
535
  n.height,
536
- ft,
536
+ pt,
537
537
  j
538
- ]), tt(() => {
539
- i && ht(ft);
540
- }, [i, ft, n, ht]), /* @__PURE__ */ r(ce, { open: i, onOpenChange: o, children: /* @__PURE__ */ r(
541
- le,
538
+ ]), rt(() => {
539
+ i && bt(pt);
540
+ }, [i, pt, n, bt]), /* @__PURE__ */ r(ge, { open: i, onOpenChange: o, children: /* @__PURE__ */ r(
541
+ fe,
542
542
  {
543
543
  className: "sm:cteditor-max-w-[860px] cteditor-max-w-[calc(100%-2rem)] cteditor-rounded-xl cteditor-overflow-hidden cteditor-p-0",
544
544
  onClick: (s) => s.stopPropagation(),
@@ -547,22 +547,22 @@ function Tr({
547
547
  /* @__PURE__ */ r("div", { className: "cteditor-bg-muted/20 cteditor-p-4 md:cteditor-p-6", children: /* @__PURE__ */ h(
548
548
  "div",
549
549
  {
550
- ref: v,
550
+ ref: y,
551
551
  className: "cteditor-relative cteditor-min-h-[340px] cteditor-rounded-lg cteditor-bg-black/70 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-select-none cteditor-touch-none",
552
552
  children: [
553
553
  /* @__PURE__ */ r("div", { className: "cteditor-overflow-hidden cteditor-rounded-lg cteditor-flex cteditor-items-center cteditor-justify-center cteditor-w-full", children: c ? /* @__PURE__ */ r("div", { className: "cteditor-text-sm cteditor-text-muted-foreground", children: "Failed to load image preview" }) : /* @__PURE__ */ r(
554
554
  "img",
555
555
  {
556
556
  ref: D,
557
- src: C,
557
+ src: v,
558
558
  alt: d || "Crop preview",
559
559
  className: "cteditor-max-w-full cteditor-max-h-[460px] cteditor-w-auto cteditor-h-auto cteditor-select-none cteditor-block",
560
560
  draggable: !1,
561
561
  onLoad: () => {
562
- k(!1), rt();
562
+ C(!1), it();
563
563
  },
564
564
  onError: () => {
565
- k(!0);
565
+ C(!0);
566
566
  }
567
567
  }
568
568
  ) }),
@@ -595,7 +595,7 @@ function Tr({
595
595
  "div",
596
596
  {
597
597
  className: "cteditor-absolute cteditor-inset-0 cteditor-pointer-events-auto",
598
- onPointerDown: q,
598
+ onPointerDown: J,
599
599
  "aria-label": "Move crop area"
600
600
  }
601
601
  ),
@@ -612,7 +612,7 @@ function Tr({
612
612
  "div",
613
613
  {
614
614
  className: `cteditor-absolute cteditor-border-2 cteditor-border-white cteditor-bg-blue-500 cteditor-rounded-sm cteditor-pointer-events-auto cteditor-shadow ${p} ${b} ${g}`,
615
- onPointerDown: (y) => It(y, s),
615
+ onPointerDown: (x) => Pt(x, s),
616
616
  "aria-label": `Resize ${s}`
617
617
  },
618
618
  s
@@ -624,21 +624,21 @@ function Tr({
624
624
  }
625
625
  ) }),
626
626
  /* @__PURE__ */ h("div", { className: "cteditor-p-4 md:cteditor-p-5 cteditor-border-l cteditor-border-border cteditor-bg-background", children: [
627
- /* @__PURE__ */ h(ue, { className: "cteditor-mb-4 cteditor-space-y-1", children: [
628
- /* @__PURE__ */ r(me, { children: "Crop" }),
629
- /* @__PURE__ */ r(ge, { children: "Choose an aspect ratio and adjust the crop area, then click Apply." })
627
+ /* @__PURE__ */ h(he, { className: "cteditor-mb-4 cteditor-space-y-1", children: [
628
+ /* @__PURE__ */ r(pe, { children: "Crop" }),
629
+ /* @__PURE__ */ r(be, { children: "Choose an aspect ratio and adjust the crop area, then click Apply." })
630
630
  ] }),
631
631
  /* @__PURE__ */ h("div", { className: "cteditor-space-y-4", children: [
632
632
  /* @__PURE__ */ h("div", { children: [
633
633
  /* @__PURE__ */ r("p", { className: "cteditor-text-sm cteditor-font-medium cteditor-mb-2", children: "Aspect ratio" }),
634
634
  /* @__PURE__ */ r("div", { className: "cteditor-grid cteditor-grid-cols-3 cteditor-gap-2", children: [
635
- { id: "freeform", label: "Freeform", icon: be },
636
- { id: "original", label: "Original", icon: rr },
637
- { id: "1:1", label: "1:1", icon: or },
638
- { id: "4:3", label: "4:3", icon: Kt },
639
- { id: "16:9", label: "16:9", icon: Kt },
640
- { id: "3:4", label: "3:4", icon: qt },
641
- { id: "9:16", label: "9:16", icon: qt }
635
+ { id: "freeform", label: "Freeform", icon: ve },
636
+ { id: "original", label: "Original", icon: or },
637
+ { id: "1:1", label: "1:1", icon: ir },
638
+ { id: "4:3", label: "4:3", icon: Jt },
639
+ { id: "16:9", label: "16:9", icon: Jt },
640
+ { id: "3:4", label: "3:4", icon: Qt },
641
+ { id: "9:16", label: "9:16", icon: Qt }
642
642
  ].map((s) => {
643
643
  const p = s.icon, b = P === s.id;
644
644
  return /* @__PURE__ */ h(
@@ -646,7 +646,7 @@ function Tr({
646
646
  {
647
647
  type: "button",
648
648
  onClick: () => {
649
- N(s.id);
649
+ k(s.id);
650
650
  },
651
651
  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 ${b ? "cteditor-border-primary cteditor-bg-primary/10 cteditor-text-primary" : "cteditor-border-border hover:cteditor-bg-accent"}`,
652
652
  children: [
@@ -674,13 +674,13 @@ function Tr({
674
674
  ] })
675
675
  ] })
676
676
  ] }),
677
- /* @__PURE__ */ h(fe, { className: "cteditor-gap-2 cteditor-mt-4", children: [
677
+ /* @__PURE__ */ h(ye, { className: "cteditor-gap-2 cteditor-mt-4", children: [
678
678
  /* @__PURE__ */ r(
679
679
  "button",
680
680
  {
681
681
  type: "button",
682
682
  onClick: () => {
683
- N("freeform"), ht(null);
683
+ k("freeform"), bt(null);
684
684
  },
685
685
  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",
686
686
  children: "Reset"
@@ -699,7 +699,7 @@ function Tr({
699
699
  "button",
700
700
  {
701
701
  type: "button",
702
- onClick: Pt,
702
+ onClick: St,
703
703
  className: "cteditor-px-3 cteditor-py-2 cteditor-text-sm cteditor-rounded-md cteditor-bg-primary cteditor-text-primary-foreground hover:cteditor-bg-primary/90 cteditor-transition-colors",
704
704
  children: "Apply"
705
705
  }
@@ -710,31 +710,31 @@ function Tr({
710
710
  }
711
711
  ) });
712
712
  }
713
- const Rt = /* @__PURE__ */ new Set(), Vt = tr("RIGHT_CLICK_IMAGE_COMMAND");
713
+ const Et = /* @__PURE__ */ new Set(), te = er("RIGHT_CLICK_IMAGE_COMMAND");
714
714
  function jr(i) {
715
- if (!Rt.has(i))
715
+ if (!Et.has(i))
716
716
  throw new Promise((o) => {
717
717
  const e = new Image();
718
718
  e.src = i, e.onload = () => {
719
- Rt.add(i), o(null);
719
+ Et.add(i), o(null);
720
720
  }, e.onerror = () => {
721
- Rt.add(i);
721
+ Et.add(i);
722
722
  };
723
723
  });
724
724
  }
725
- function Wr({
725
+ function Yr({
726
726
  altText: i,
727
727
  className: o,
728
728
  imageRef: e,
729
729
  src: d,
730
- width: w,
731
- height: x,
730
+ width: N,
731
+ height: w,
732
732
  maxWidth: L,
733
733
  onError: P,
734
- onLoad: N
734
+ onLoad: k
735
735
  }) {
736
736
  jr(d);
737
- const C = typeof w == "number" && typeof x == "number", E = typeof w == "number" ? w : "auto";
737
+ const v = typeof N == "number", E = typeof w == "number", c = v && E, C = v ? N : "auto", y = E ? w : "auto";
738
738
  return /* @__PURE__ */ r(
739
739
  "img",
740
740
  {
@@ -742,27 +742,35 @@ function Wr({
742
742
  src: d,
743
743
  alt: i,
744
744
  ref: e,
745
- style: C ? {
746
- width: E,
745
+ style: c ? {
746
+ width: C,
747
747
  // Use height: auto + aspect-ratio so the image scales
748
748
  // proportionally when max-width constrains on small screens.
749
- // The useLayoutEffect in ImageComponent widens the container
750
- // to fit the explicit width on desktop.
751
749
  height: "auto",
752
- aspectRatio: `${E} / ${typeof x == "number" ? x : "auto"}`,
750
+ aspectRatio: `${C} / ${y}`,
751
+ maxWidth: "100%"
752
+ } : v ? {
753
+ // Only width known (e.g. bogus height stripped from source HTML):
754
+ // fix the width and let the browser compute height naturally.
755
+ width: C,
756
+ height: "auto",
757
+ maxWidth: "100%"
758
+ } : E ? {
759
+ // Only height known: fix height, let browser compute width.
760
+ width: "auto",
761
+ height: y,
753
762
  maxWidth: "100%"
754
763
  } : {
755
764
  // No dimensions specified - use original image size.
756
- // max-width from CSS rule prevents overflow.
757
765
  height: "auto"
758
766
  },
759
767
  onError: P,
760
- onLoad: N,
768
+ onLoad: k,
761
769
  draggable: "false"
762
770
  }
763
771
  );
764
772
  }
765
- function Yr() {
773
+ function _r() {
766
774
  return /* @__PURE__ */ r(
767
775
  "img",
768
776
  {
@@ -781,171 +789,171 @@ function co({
781
789
  altText: o,
782
790
  nodeKey: e,
783
791
  width: d,
784
- height: w,
785
- maxWidth: x,
792
+ height: N,
793
+ maxWidth: w,
786
794
  resizable: L,
787
795
  showCaption: P,
788
- caption: N,
789
- captionsEnabled: C,
796
+ caption: k,
797
+ captionsEnabled: v,
790
798
  originalPrompt: E,
791
799
  position: c = "none",
792
- linkUrl: k
800
+ linkUrl: C
793
801
  }) {
794
- const v = K(null), D = K(null), [n, T, R] = Xe(e), [$, et] = I(!1), dt = K(!1), { isCollabActive: ft } = Oe(), [m] = He(), [j, ht] = I(null), rt = K(null), [q, It] = I(!1), Pt = Fe(), [s, p] = I(!1), [b, g] = I(""), [y, O] = I(!1), [ct, lt] = I(!1), [G, B] = I(""), [ot, Y] = I(""), [U, A] = I(!1), _ = K(null), [V, H] = I(0), [F, ut] = I(!1), vt = K(null), [xe, pt] = I(null), [St, zt] = I(!1), wt = ir()?.apiKey, Mt = V > 0 && V < 350;
795
- Bt(() => {
796
- if (!n || !at(j) || q) {
797
- pt(null);
802
+ const y = V(null), D = V(null), [n, W, R] = Be(e), [$, ot] = I(!1), lt = V(!1), { isCollabActive: pt } = He(), [m] = Fe(), [j, bt] = I(null), it = V(null), [J, Pt] = I(!1), St = Xe(), [s, p] = I(!1), [b, g] = I(""), [x, F] = I(!1), [ut, mt] = I(!1), [Q, K] = I(""), [at, _] = I(""), [G, A] = I(!1), O = V(null), [Z, X] = I(0), [B, gt] = I(!1), Ct = V(null), [Ne, yt] = I(null), [zt, Mt] = I(!1), Nt = ar()?.apiKey, At = Z > 0 && Z < 350;
803
+ qt(() => {
804
+ if (!n || !st(j) || J) {
805
+ yt(null);
798
806
  return;
799
807
  }
800
- const t = vt.current, a = m.getRootElement(), l = t?.parentElement;
808
+ const t = Ct.current, a = m.getRootElement(), l = t?.parentElement;
801
809
  if (!t || !a || !l) {
802
- pt(null);
810
+ yt(null);
803
811
  return;
804
812
  }
805
- const u = a.getBoundingClientRect(), f = l.getBoundingClientRect(), z = t.getBoundingClientRect(), X = 8, J = z.width;
806
- if (J <= 0) {
807
- pt(null);
813
+ const u = a.getBoundingClientRect(), f = l.getBoundingClientRect(), z = t.getBoundingClientRect(), T = 8, H = z.width;
814
+ if (H <= 0) {
815
+ yt(null);
808
816
  return;
809
817
  }
810
- if (Mt) {
811
- const Ct = f.left + f.width / 2 - J / 2, it = Math.max(u.left + X, Math.min(Ct, u.right - X - J));
812
- pt({
813
- left: it - f.left,
818
+ if (At) {
819
+ const nt = f.left + f.width / 2 - H / 2, U = Math.max(u.left + T, Math.min(nt, u.right - T - H));
820
+ yt({
821
+ left: U - f.left,
814
822
  bottom: 0,
815
823
  right: "auto",
816
824
  transform: "translateY(100%) translateY(4px)"
817
825
  });
818
826
  } else {
819
- const Ct = f.right - X - J, it = Math.max(u.left + X, Math.min(Ct, u.right - X - J));
820
- pt({
821
- left: it - f.left,
822
- top: X,
827
+ const nt = f.right - T - H, U = Math.max(u.left + T, Math.min(nt, u.right - T - H));
828
+ yt({
829
+ left: U - f.left,
830
+ top: T,
823
831
  right: "auto"
824
832
  });
825
833
  }
826
- }, [n, j, q, Mt, m, V]), tt(() => {
827
- if (v.current) {
834
+ }, [n, j, J, At, m, Z]), rt(() => {
835
+ if (y.current) {
828
836
  const t = () => {
829
- dt.current || v.current && H(v.current.offsetWidth);
837
+ lt.current || y.current && X(y.current.offsetWidth);
830
838
  };
831
839
  t();
832
840
  const a = new ResizeObserver(t);
833
- return a.observe(v.current), () => a.disconnect();
841
+ return a.observe(y.current), () => a.disconnect();
834
842
  }
835
- }, [d, w, n]), Bt(() => {
836
- if ((c === "left" || c === "right") && typeof d == "number" && v.current) {
837
- const t = v.current.closest(".editor-image"), a = t?.parentElement, l = m.getRootElement(), u = l ? l.getBoundingClientRect().width : d + 32, f = `${Math.min(d + 32, u)}px`;
843
+ }, [d, N, n]), qt(() => {
844
+ if ((c === "left" || c === "right") && typeof d == "number" && y.current) {
845
+ const t = y.current.closest(".editor-image"), a = t?.parentElement, l = m.getRootElement(), u = l ? l.getBoundingClientRect().width : d + 32, f = `${Math.min(d + 32, u)}px`;
838
846
  return t && (t.style.removeProperty("display"), t.style.setProperty("max-width", f, "important")), a && a.style.setProperty("max-width", f, "important"), () => {
839
847
  t && (t.style.removeProperty("max-width"), t.style.removeProperty("display")), a && a.style.removeProperty("max-width");
840
848
  };
841
849
  }
842
850
  }, [c, d, m]);
843
- const At = S(
851
+ const Dt = S(
844
852
  (t) => {
845
- const a = nt();
846
- return n && at(a) && (t.preventDefault(), m.update(() => {
853
+ const a = dt();
854
+ return n && st(a) && (t.preventDefault(), m.update(() => {
847
855
  a.getNodes().forEach((u) => {
848
- if (Z(u)) {
856
+ if (et(u)) {
849
857
  const f = u.getParent();
850
- u.remove(), f && $t(f) && f.getChildrenSize() === 0 && f.setFormat("left");
858
+ u.remove(), f && Yt(f) && f.getChildrenSize() === 0 && f.setFormat("left");
851
859
  }
852
860
  });
853
861
  })), !1;
854
862
  },
855
863
  [m, n]
856
- ), jt = S(
864
+ ), Ot = S(
857
865
  (t) => {
858
- const a = nt(), l = D.current;
859
- if (n && at(a) && a.getNodes().length === 1) {
866
+ const a = dt(), l = D.current;
867
+ if (n && st(a) && a.getNodes().length === 1) {
860
868
  if (P)
861
- return bt(null), t.preventDefault(), N.focus(), !0;
869
+ return xt(null), t.preventDefault(), k.focus(), !0;
862
870
  if (l !== null && l !== document.activeElement)
863
871
  return t.preventDefault(), l.focus(), !0;
864
872
  }
865
873
  return !1;
866
874
  },
867
- [N, n, P]
868
- ), Wt = S(
869
- (t) => rt.current === N || D.current === t.target ? (bt(null), m.update(() => {
870
- T(!0);
875
+ [k, n, P]
876
+ ), Ht = S(
877
+ (t) => it.current === k || D.current === t.target ? (xt(null), m.update(() => {
878
+ W(!0);
871
879
  const a = m.getRootElement();
872
880
  a !== null && a.focus();
873
881
  }), !0) : !1,
874
- [N, m, T]
875
- ), Dt = S(
882
+ [k, m, W]
883
+ ), Lt = S(
876
884
  (t) => {
877
885
  const a = t;
878
886
  if ($)
879
887
  return !0;
880
888
  const l = a.target;
881
- if (l.closest("button") && v.current && l.closest(".editor-image") === v.current.closest(".editor-image"))
889
+ if (l.closest("button") && y.current && l.closest(".editor-image") === y.current.closest(".editor-image"))
882
890
  return !0;
883
- const u = l === v.current;
891
+ const u = l === y.current;
884
892
  let f = !1;
885
- if (!u && v.current) {
886
- const z = v.current.getBoundingClientRect();
893
+ if (!u && y.current) {
894
+ const z = y.current.getBoundingClientRect();
887
895
  f = a.clientX >= z.left && a.clientX <= z.right && a.clientY >= z.top && a.clientY <= z.bottom;
888
896
  }
889
- return u || f ? (a.shiftKey ? T(!n) : (R(), T(!0)), !0) : !1;
897
+ return u || f ? (a.shiftKey ? W(!n) : (R(), W(!0)), !0) : !1;
890
898
  },
891
- [$, n, T, R]
892
- ), Lt = S(
899
+ [$, n, W, R]
900
+ ), $t = S(
893
901
  (t) => {
894
902
  m.getEditorState().read(() => {
895
- const a = nt();
896
- t.target.tagName === "IMG" && Ue(a) && a.getNodes().length === 1 && m.dispatchCommand(
897
- Vt,
903
+ const a = dt();
904
+ t.target.tagName === "IMG" && Ke(a) && a.getNodes().length === 1 && m.dispatchCommand(
905
+ te,
898
906
  t
899
907
  );
900
908
  });
901
909
  },
902
910
  [m]
903
911
  );
904
- tt(() => {
912
+ rt(() => {
905
913
  let t = !0;
906
- const a = m.getRootElement(), l = Be(
914
+ const a = m.getRootElement(), l = Ue(
907
915
  m.registerUpdateListener(({ editorState: u }) => {
908
- t && ht(u.read(() => nt()));
916
+ t && bt(u.read(() => dt()));
909
917
  }),
910
918
  m.registerCommand(
911
- Ke,
912
- (u, f) => (rt.current = f, !1),
913
- Q
919
+ Ge,
920
+ (u, f) => (it.current = f, !1),
921
+ tt
914
922
  ),
915
923
  m.registerCommand(
916
924
  qe,
917
- Dt,
918
- Q
925
+ Lt,
926
+ tt
919
927
  ),
920
928
  m.registerCommand(
921
- Vt,
922
- Dt,
923
- Q
924
- ),
925
- m.registerCommand(
926
- Ge,
927
- (u) => u.target === v.current ? (u.preventDefault(), !0) : !1,
928
- Q
929
+ te,
930
+ Lt,
931
+ tt
929
932
  ),
930
933
  m.registerCommand(
931
934
  Ve,
932
- At,
933
- Q
935
+ (u) => u.target === y.current ? (u.preventDefault(), !0) : !1,
936
+ tt
934
937
  ),
935
938
  m.registerCommand(
936
939
  Je,
937
- At,
938
- Q
940
+ Dt,
941
+ tt
939
942
  ),
940
- m.registerCommand(Qe, jt, Q),
941
943
  m.registerCommand(
942
- Ze,
943
- Wt,
944
- Q
944
+ Qe,
945
+ Dt,
946
+ tt
947
+ ),
948
+ m.registerCommand(Ze, Ot, tt),
949
+ m.registerCommand(
950
+ tr,
951
+ Ht,
952
+ tt
945
953
  )
946
954
  );
947
- return a?.addEventListener("contextmenu", Lt), () => {
948
- t = !1, l(), a?.removeEventListener("contextmenu", Lt);
955
+ return a?.addEventListener("contextmenu", $t), () => {
956
+ t = !1, l(), a?.removeEventListener("contextmenu", $t);
949
957
  };
950
958
  }, [
951
959
  R,
@@ -953,28 +961,28 @@ function co({
953
961
  $,
954
962
  n,
955
963
  e,
956
- At,
957
- jt,
958
- Wt,
959
964
  Dt,
965
+ Ot,
966
+ Ht,
960
967
  Lt,
961
- T
968
+ $t,
969
+ W
962
970
  ]);
963
- const ve = () => {
971
+ const ke = () => {
964
972
  m.update(() => {
965
- const t = st(e);
966
- Z(t) && t.setShowCaption(!0);
973
+ const t = ct(e);
974
+ et(t) && t.setShowCaption(!0);
967
975
  });
968
- }, we = (t, a) => {
969
- dt.current = !1, setTimeout(() => {
970
- et(!1);
976
+ }, Re = (t, a) => {
977
+ lt.current = !1, setTimeout(() => {
978
+ ot(!1);
971
979
  }, 200), m.update(() => {
972
- const l = st(e);
973
- Z(l) && l.setWidthAndHeight(t, a);
980
+ const l = ct(e);
981
+ et(l) && l.setWidthAndHeight(t, a);
974
982
  });
975
- }, Ce = () => {
976
- dt.current = !0, et(!0);
977
- }, Ne = (t) => {
983
+ }, Ee = () => {
984
+ lt.current = !0, ot(!0);
985
+ }, Ie = (t) => {
978
986
  if (t.preventDefault(), t.stopPropagation(), i.startsWith("data:")) {
979
987
  const a = window.open("", "_blank");
980
988
  a && (a.document.write(`
@@ -1005,112 +1013,112 @@ function co({
1005
1013
  `), a.document.close());
1006
1014
  } else
1007
1015
  window.open(i, "_blank");
1008
- }, ke = (t) => {
1016
+ }, Pe = (t) => {
1009
1017
  t.preventDefault(), t.stopPropagation(), m.update(() => {
1010
- const a = st(e);
1011
- if (Z(a)) {
1018
+ const a = ct(e);
1019
+ if (et(a)) {
1012
1020
  const l = a.getParent();
1013
- a.remove(), l && $t(l) && l.getChildrenSize() === 0 && l.setFormat("left");
1021
+ a.remove(), l && Yt(l) && l.getChildrenSize() === 0 && l.setFormat("left");
1014
1022
  }
1015
1023
  });
1016
- }, mt = (t, a) => {
1024
+ }, ft = (t, a) => {
1017
1025
  t.preventDefault(), t.stopPropagation(), m.update(() => {
1018
- const l = st(e);
1019
- if (Z(l)) {
1026
+ const l = ct(e);
1027
+ if (et(l)) {
1020
1028
  l.setPosition(a);
1021
1029
  const u = l.getParent();
1022
- u && $t(u) && (a === "left" ? u.setFormat("left") : a === "right" ? u.setFormat("right") : u.setFormat(""));
1030
+ u && Yt(u) && (a === "left" ? u.setFormat("left") : a === "right" ? u.setFormat("right") : u.setFormat(""));
1023
1031
  }
1024
1032
  });
1025
- }, Re = (t) => {
1033
+ }, Se = (t) => {
1026
1034
  t.preventDefault(), t.stopPropagation(), p(!s);
1027
- }, Ee = S((t) => {
1028
- t.preventDefault(), t.stopPropagation(), ut(!0);
1029
- }, []), Ie = S(
1035
+ }, ze = S((t) => {
1036
+ t.preventDefault(), t.stopPropagation(), gt(!0);
1037
+ }, []), Me = S(
1030
1038
  (t) => {
1031
1039
  t.preventDefault(), t.stopPropagation();
1032
- const a = kt(i);
1033
- if (!(gt(i) && i !== a) && !(typeof d == "number" || typeof w == "number"))
1040
+ const a = Rt(i);
1041
+ if (!(ht(i) && i !== a) && !(typeof d == "number" || typeof N == "number"))
1034
1042
  return;
1035
1043
  m.update(
1036
1044
  () => {
1037
- const z = st(e);
1038
- if (!Z(z))
1045
+ const z = ct(e);
1046
+ if (!et(z))
1039
1047
  return;
1040
1048
  z.setSrc(a), z.setWidthAndHeight("inherit", "inherit");
1041
- const X = nt();
1042
- X && bt(X.clone());
1049
+ const T = dt();
1050
+ T && xt(T.clone());
1043
1051
  },
1044
1052
  { tag: "image-reset" }
1045
1053
  );
1046
- const f = v.current;
1054
+ const f = y.current;
1047
1055
  f && requestAnimationFrame(() => {
1048
1056
  f.src = a, f.style.removeProperty("width"), f.style.removeProperty("height");
1049
1057
  }), M.success("Image reset to original size and crop");
1050
1058
  },
1051
- [m, e, i, d, w]
1052
- ), Pe = S(
1059
+ [m, e, i, d, N]
1060
+ ), Ae = S(
1053
1061
  async (t) => {
1054
1062
  let a = i;
1055
- if (gt(i))
1056
- a = kt(i);
1063
+ if (ht(i))
1064
+ a = Rt(i);
1057
1065
  else {
1058
- if (!wt) {
1066
+ if (!Nt) {
1059
1067
  M.error("API key is required to upload and crop external images.");
1060
1068
  return;
1061
1069
  }
1062
1070
  const u = M.loading("Uploading image…");
1063
1071
  try {
1064
- a = (await ar.post(
1065
- nr.project.fileUploadFromUrl,
1072
+ a = (await nr.post(
1073
+ sr.project.fileUploadFromUrl,
1066
1074
  { url: i, prefix: "uploads" },
1067
- { headers: { "x-api-key": wt } }
1075
+ { headers: { "x-api-key": Nt } }
1068
1076
  )).data.fileUrl, M.dismiss(u);
1069
1077
  } catch {
1070
1078
  M.dismiss(u), M.error("Failed to upload image. Try again.");
1071
1079
  return;
1072
1080
  }
1073
1081
  }
1074
- const l = Ir(a, t);
1082
+ const l = Pr(a, t);
1075
1083
  if (l === a) {
1076
1084
  M.error("Cropping is only supported for images hosted on the CDN.");
1077
1085
  return;
1078
1086
  }
1079
- zt(!0), m.update(() => {
1080
- const u = st(e);
1081
- if (!Z(u))
1087
+ Mt(!0), m.update(() => {
1088
+ const u = ct(e);
1089
+ if (!et(u))
1082
1090
  return;
1083
1091
  u.setSrc(l), u.setWidthAndHeight(t.width, t.height);
1084
- const f = nt();
1085
- f && bt(f.clone());
1092
+ const f = dt();
1093
+ f && xt(f.clone());
1086
1094
  }), M.success("Image cropped");
1087
1095
  },
1088
- [m, e, i, wt]
1089
- ), Se = S(() => {
1090
- k && !n && (_.current = setTimeout(() => {
1096
+ [m, e, i, Nt]
1097
+ ), De = S(() => {
1098
+ C && !n && (O.current = setTimeout(() => {
1091
1099
  A(!0);
1092
1100
  }, 300));
1093
- }, [k, n]), ze = S(() => {
1094
- _.current && (clearTimeout(_.current), _.current = null), A(!1);
1095
- }, []), Yt = S((t) => {
1096
- t.preventDefault(), t.stopPropagation(), k && window.open(k, "_blank", "noopener,noreferrer");
1097
- }, [k]);
1098
- tt(() => () => {
1099
- _.current && clearTimeout(_.current);
1100
- }, []), tt(() => {
1101
- n || ut(!1);
1101
+ }, [C, n]), Le = S(() => {
1102
+ O.current && (clearTimeout(O.current), O.current = null), A(!1);
1103
+ }, []), Ft = S((t) => {
1104
+ t.preventDefault(), t.stopPropagation(), C && window.open(C, "_blank", "noopener,noreferrer");
1105
+ }, [C]);
1106
+ rt(() => () => {
1107
+ O.current && clearTimeout(O.current);
1108
+ }, []), rt(() => {
1109
+ n || gt(!1);
1102
1110
  }, [n]);
1103
- const _t = async () => {
1104
- if (!b.trim() || y)
1111
+ const Xt = async () => {
1112
+ if (!b.trim() || x)
1105
1113
  return;
1106
- O(!0);
1114
+ F(!0);
1107
1115
  const t = M.loading("Refining image...", {
1108
1116
  description: "This may take 10-30 seconds. Please wait."
1109
1117
  });
1110
1118
  try {
1111
1119
  let a = b.trim();
1112
- const u = b.trim().replace(/^(add|also add|include|with|and)\s+(some|a|an)\s+/gi, "").replace(/^(add|also add|include|with|and)\s+/gi, "").trim(), f = (Nt) => {
1113
- const je = Nt.toLowerCase();
1120
+ const u = b.trim().replace(/^(add|also add|include|with|and)\s+(some|a|an)\s+/gi, "").replace(/^(add|also add|include|with|and)\s+/gi, "").trim(), f = (U) => {
1121
+ const Wt = U.toLowerCase();
1114
1122
  return [
1115
1123
  "article",
1116
1124
  "write",
@@ -1127,28 +1135,66 @@ function co({
1127
1135
  "add some images",
1128
1136
  "include images",
1129
1137
  "include pictures"
1130
- ].some((We) => je.includes(We));
1138
+ ].some((kt) => Wt.includes(kt));
1131
1139
  };
1132
1140
  let z = "";
1133
1141
  if (E && E.trim()) {
1134
- const Nt = E.trim();
1135
- f(Nt) && o && o !== "Generated image" && o.trim() ? z = o.trim() : z = Nt;
1142
+ const U = E.trim();
1143
+ f(U) && o && o !== "Generated image" && o.trim() ? z = o.trim() : z = U;
1136
1144
  } else
1137
1145
  o && o !== "Generated image" && o.trim() && (z = o.trim());
1138
1146
  z ? a = `${z} with ${u}` : a = u;
1139
- const J = (await xr({
1140
- content: `Generate Image: ${a}`,
1141
- apiKey: wt || void 0
1142
- }))?.data;
1143
- if (!J)
1144
- throw new Error("Failed to generate image - empty response");
1145
- const it = new DOMParser().parseFromString(J, "text/html").querySelector("img");
1146
- if (!it || !it.src)
1147
- throw new Error("No image found in response");
1148
- const Te = it.src;
1147
+ const T = await fetch(`${wr}/agent/stream`, {
1148
+ method: "POST",
1149
+ headers: { "Content-Type": "application/json" },
1150
+ body: JSON.stringify({
1151
+ type: "general",
1152
+ query: `Generate Image: ${a}`,
1153
+ model: "openai",
1154
+ api_key: Nt || ""
1155
+ })
1156
+ });
1157
+ if (!T.ok)
1158
+ throw new Error(`Image service error: ${T.status}`);
1159
+ const H = T.body?.getReader(), Tt = new TextDecoder();
1160
+ if (!H)
1161
+ throw new Error("Stream reader not available");
1162
+ let nt = null;
1163
+ t:
1164
+ for (; ; ) {
1165
+ const { done: U, value: Wt } = await H.read();
1166
+ if (U)
1167
+ break;
1168
+ const Ut = Tt.decode(Wt, { stream: !0 }).split(`
1169
+ `);
1170
+ for (const kt of Ut) {
1171
+ if (!kt.startsWith("data: "))
1172
+ continue;
1173
+ const jt = kt.slice(6).trim();
1174
+ if (!(!jt || jt === "[DONE]"))
1175
+ try {
1176
+ const q = JSON.parse(jt);
1177
+ if (q.type === "image_ready") {
1178
+ nt = q.url, H.cancel();
1179
+ break t;
1180
+ } else {
1181
+ if (q.type === "image_failed")
1182
+ throw H.cancel(), new Error(q.error || "Image generation failed");
1183
+ if (q.type === "error")
1184
+ throw H.cancel(), new Error(q.message || "Image generation failed");
1185
+ }
1186
+ } catch (q) {
1187
+ if (q instanceof SyntaxError)
1188
+ continue;
1189
+ throw q;
1190
+ }
1191
+ }
1192
+ }
1193
+ if (!nt)
1194
+ throw new Error("Failed to generate image - no image received");
1149
1195
  M.dismiss(t), M.success("Image refined successfully!", {
1150
1196
  description: "Compare the images and choose which to keep."
1151
- }), B(Te), Y(a), lt(!0), g(""), p(!1);
1197
+ }), K(nt), _(a), mt(!0), g(""), p(!1);
1152
1198
  } catch (a) {
1153
1199
  if (M.dismiss(t), a instanceof vr) {
1154
1200
  const l = a.code === "API_KEYS_DISABLED" ? "API Keys Disabled" : "API Key Required";
@@ -1157,29 +1203,29 @@ function co({
1157
1203
  duration: 8e3
1158
1204
  });
1159
1205
  } else
1160
- a instanceof wr ? M.error("Credits Issue", {
1206
+ a instanceof Cr ? M.error("Credits Issue", {
1161
1207
  description: a.message,
1162
1208
  duration: 8e3
1163
1209
  }) : M.error("Failed to refine image", {
1164
1210
  description: a instanceof Error ? a.message : "Unknown error. Please try again."
1165
1211
  });
1166
1212
  } finally {
1167
- O(!1);
1213
+ F(!1);
1168
1214
  }
1169
- }, Me = () => {
1215
+ }, $e = () => {
1170
1216
  m.update(() => {
1171
- const t = st(e);
1172
- if (Z(t)) {
1173
- t.setSrc(G), t.setOriginalPrompt(ot);
1174
- const a = nt();
1175
- a && bt(a.clone());
1217
+ const t = ct(e);
1218
+ if (et(t)) {
1219
+ t.setSrc(Q), t.setOriginalPrompt(at);
1220
+ const a = dt();
1221
+ a && xt(a.clone());
1176
1222
  }
1177
- }), lt(!1), B(""), Y(""), M.success("Image replaced successfully!", {
1223
+ }), mt(!1), K(""), _(""), M.success("Image replaced successfully!", {
1178
1224
  description: "The image has been updated with the refined version."
1179
1225
  });
1180
- }, Ae = () => {
1181
- lt(!1), B(""), Y("");
1182
- }, De = n && at(j) && !$, Ot = (n || $) && Pt, Le = () => c === "left" || c === "right" ? {
1226
+ }, Te = () => {
1227
+ mt(!1), K(""), _("");
1228
+ }, We = n && st(j) && !$, Bt = (n || $) && St, je = () => c === "left" || c === "right" ? {
1183
1229
  position: "relative",
1184
1230
  display: "block",
1185
1231
  width: "100%"
@@ -1207,36 +1253,36 @@ function co({
1207
1253
  } : {
1208
1254
  position: "relative",
1209
1255
  display: "inline-block"
1210
- }, $e = S(
1256
+ }, Ye = S(
1211
1257
  (t) => {
1212
1258
  if ($ || t.target.closest("button"))
1213
1259
  return;
1214
- const l = t.target === v.current;
1260
+ const l = t.target === y.current;
1215
1261
  let u = !1;
1216
- if (!l && v.current) {
1217
- const f = v.current.getBoundingClientRect();
1262
+ if (!l && y.current) {
1263
+ const f = y.current.getBoundingClientRect();
1218
1264
  u = t.clientX >= f.left && t.clientX <= f.right && t.clientY >= f.top && t.clientY <= f.bottom;
1219
1265
  }
1220
- !l && !u || (t.stopPropagation(), t.shiftKey ? T(!n) : (R(), T(!0)));
1266
+ !l && !u || (t.stopPropagation(), t.shiftKey ? W(!n) : (R(), W(!0)));
1221
1267
  },
1222
- [$, n, T, R]
1268
+ [$, n, W, R]
1223
1269
  );
1224
- return /* @__PURE__ */ r(er, { fallback: null, children: /* @__PURE__ */ h(Ft, { children: [
1270
+ return /* @__PURE__ */ r(rr, { fallback: null, children: /* @__PURE__ */ h(Kt, { children: [
1225
1271
  /* @__PURE__ */ h(
1226
1272
  "div",
1227
1273
  {
1228
- draggable: De,
1229
- style: Le(),
1230
- onClick: $e,
1231
- onMouseEnter: Se,
1232
- onMouseLeave: ze,
1274
+ draggable: We,
1275
+ style: je(),
1276
+ onClick: Ye,
1277
+ onMouseEnter: De,
1278
+ onMouseLeave: Le,
1233
1279
  children: [
1234
- St ? /* @__PURE__ */ h(
1280
+ zt ? /* @__PURE__ */ h(
1235
1281
  "div",
1236
1282
  {
1237
1283
  className: "cteditor-relative cteditor-inline-block cteditor-my-2 cteditor-select-none cteditor-rounded-lg cteditor-overflow-hidden",
1238
1284
  style: {
1239
- ...typeof d == "number" && typeof w == "number" ? { width: d, height: w, aspectRatio: `${d} / ${w}`, maxWidth: "100%" } : { minWidth: 200, minHeight: 150 }
1285
+ ...typeof d == "number" && typeof N == "number" ? { width: d, height: N, aspectRatio: `${d} / ${N}`, maxWidth: "100%" } : { minWidth: 200, minHeight: 150 }
1240
1286
  },
1241
1287
  children: [
1242
1288
  /* @__PURE__ */ r(
@@ -1246,42 +1292,42 @@ function co({
1246
1292
  alt: "",
1247
1293
  className: "cteditor-absolute cteditor-opacity-0 cteditor-pointer-events-none cteditor-w-full cteditor-h-full cteditor-object-cover",
1248
1294
  onLoad: () => {
1249
- Rt.add(i), zt(!1);
1295
+ Et.add(i), Mt(!1);
1250
1296
  },
1251
- onError: () => zt(!1)
1297
+ onError: () => Mt(!1)
1252
1298
  }
1253
1299
  ),
1254
1300
  /* @__PURE__ */ h("div", { className: "cteditor-absolute cteditor-inset-0 cteditor-flex cteditor-flex-col cteditor-items-center cteditor-justify-center cteditor-rounded-lg cteditor-bg-muted", children: [
1255
- /* @__PURE__ */ r(sr, { className: "cteditor-w-10 cteditor-h-10 cteditor-text-muted-foreground cteditor-animate-spin cteditor-mb-2", "aria-hidden": !0 }),
1301
+ /* @__PURE__ */ r(dr, { className: "cteditor-w-10 cteditor-h-10 cteditor-text-muted-foreground cteditor-animate-spin cteditor-mb-2", "aria-hidden": !0 }),
1256
1302
  /* @__PURE__ */ r("span", { className: "cteditor-text-sm cteditor-font-medium cteditor-text-muted-foreground", children: "Applying crop…" })
1257
1303
  ] })
1258
1304
  ]
1259
1305
  }
1260
- ) : q ? /* @__PURE__ */ r(Yr, {}) : /* @__PURE__ */ r(
1261
- Wr,
1306
+ ) : J ? /* @__PURE__ */ r(_r, {}) : /* @__PURE__ */ r(
1307
+ Yr,
1262
1308
  {
1263
- className: Ot ? `focused ${at(j) ? "draggable" : ""}` : k ? "cteditor-cursor-pointer" : null,
1309
+ className: Bt ? `focused ${st(j) ? "draggable" : ""}` : C ? "cteditor-cursor-pointer" : null,
1264
1310
  src: i,
1265
1311
  altText: o,
1266
- imageRef: v,
1312
+ imageRef: y,
1267
1313
  width: d,
1268
- height: w,
1269
- maxWidth: x,
1270
- onError: () => It(!0)
1314
+ height: N,
1315
+ maxWidth: w,
1316
+ onError: () => Pt(!0)
1271
1317
  }
1272
1318
  ),
1273
- U && k && !n && /* @__PURE__ */ h(
1319
+ G && C && !n && /* @__PURE__ */ h(
1274
1320
  "div",
1275
1321
  {
1276
1322
  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",
1277
1323
  style: { zIndex: 10 },
1278
1324
  children: [
1279
- /* @__PURE__ */ r(Cr, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-muted-foreground cteditor-flex-shrink-0" }),
1280
- /* @__PURE__ */ r("span", { className: "cteditor-text-sm cteditor-text-foreground cteditor-truncate cteditor-flex-1", children: k }),
1325
+ /* @__PURE__ */ r(Nr, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-muted-foreground cteditor-flex-shrink-0" }),
1326
+ /* @__PURE__ */ r("span", { className: "cteditor-text-sm cteditor-text-foreground cteditor-truncate cteditor-flex-1", children: C }),
1281
1327
  /* @__PURE__ */ r(
1282
1328
  "button",
1283
1329
  {
1284
- onClick: Yt,
1330
+ onClick: Ft,
1285
1331
  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",
1286
1332
  children: "Open"
1287
1333
  }
@@ -1289,150 +1335,150 @@ function co({
1289
1335
  ]
1290
1336
  }
1291
1337
  ),
1292
- n && at(j) && !q && !St && /* @__PURE__ */ h(
1338
+ n && st(j) && !J && !zt && /* @__PURE__ */ h(
1293
1339
  "div",
1294
1340
  {
1295
- ref: vt,
1341
+ ref: Ct,
1296
1342
  className: "cteditor-absolute cteditor-flex cteditor-gap-1 z-10 cteditor-text-foreground",
1297
- style: xe ?? (Mt ? { left: "50%", transform: "translateX(-50%) translateY(100%) translateY(4px)", bottom: 0 } : { top: 8, right: 8 }),
1343
+ style: Ne ?? (At ? { left: "50%", transform: "translateX(-50%) translateY(100%) translateY(4px)", bottom: 0 } : { top: 8, right: 8 }),
1298
1344
  children: [
1299
1345
  /* @__PURE__ */ h("div", { className: "cteditor-flex cteditor-items-center cteditor-gap-0.5 cteditor-bg-accent cteditor-border cteditor-border-foreground/10 cteditor-rounded-md cteditor-shadow-md cteditor-p-0.5", children: [
1300
1346
  /* @__PURE__ */ r(
1301
1347
  "button",
1302
1348
  {
1303
- onClick: (t) => mt(t, "left"),
1349
+ onClick: (t) => ft(t, "left"),
1304
1350
  className: ` cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-foreground/10 cteditor-transition-colors ${c === "left" ? "cteditor-bg-foreground/10" : ""}`,
1305
1351
  "aria-label": "Wrap text left",
1306
1352
  title: "Wrap text left",
1307
- children: /* @__PURE__ */ r(dr, {})
1353
+ children: /* @__PURE__ */ r(cr, {})
1308
1354
  }
1309
1355
  ),
1310
1356
  /* @__PURE__ */ r(
1311
1357
  "button",
1312
1358
  {
1313
- onClick: (t) => mt(t, "right"),
1359
+ onClick: (t) => ft(t, "right"),
1314
1360
  className: ` cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-foreground/10 cteditor-transition-colors ${c === "right" ? "cteditor-bg-foreground/10" : ""}`,
1315
1361
  "aria-label": "Wrap text right",
1316
1362
  title: "Wrap text right",
1317
- children: /* @__PURE__ */ r(cr, {})
1363
+ children: /* @__PURE__ */ r(lr, {})
1318
1364
  }
1319
1365
  ),
1320
1366
  /* @__PURE__ */ r("div", { className: "cteditor-w-px cteditor-h-5 cteditor-bg-foreground/10 cteditor-mx-0.5" }),
1321
1367
  /* @__PURE__ */ r(
1322
1368
  "button",
1323
1369
  {
1324
- onClick: (t) => mt(t, "inline-left"),
1370
+ onClick: (t) => ft(t, "inline-left"),
1325
1371
  className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-foreground/10 cteditor-transition-colors ${c === "inline-left" ? "cteditor-bg-foreground/10" : ""}`,
1326
1372
  "aria-label": "Align left",
1327
1373
  title: "Align left (no text wrap)",
1328
- children: /* @__PURE__ */ r(lr, {})
1374
+ children: /* @__PURE__ */ r(ur, {})
1329
1375
  }
1330
1376
  ),
1331
1377
  /* @__PURE__ */ r(
1332
1378
  "button",
1333
1379
  {
1334
- onClick: (t) => mt(t, "inline-center"),
1380
+ onClick: (t) => ft(t, "inline-center"),
1335
1381
  className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-foreground/10 cteditor-transition-colors ${c === "inline-center" || c === "full" ? "cteditor-bg-foreground/10" : ""}`,
1336
1382
  "aria-label": "Align center",
1337
1383
  title: "Align center (no text wrap)",
1338
- children: /* @__PURE__ */ r(ur, {})
1384
+ children: /* @__PURE__ */ r(mr, {})
1339
1385
  }
1340
1386
  ),
1341
1387
  /* @__PURE__ */ r(
1342
1388
  "button",
1343
1389
  {
1344
- onClick: (t) => mt(t, "inline-right"),
1390
+ onClick: (t) => ft(t, "inline-right"),
1345
1391
  className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-foreground/10 cteditor-transition-colors ${c === "inline-right" ? "cteditor-bg-foreground/10" : ""}`,
1346
1392
  "aria-label": "Align right",
1347
1393
  title: "Align right (no text wrap)",
1348
- children: /* @__PURE__ */ r(mr, {})
1394
+ children: /* @__PURE__ */ r(gr, {})
1349
1395
  }
1350
1396
  ),
1351
1397
  /* @__PURE__ */ r("div", { className: "cteditor-w-px cteditor-h-5 cteditor-bg-foreground/10 cteditor-mx-0.5" }),
1352
1398
  /* @__PURE__ */ r(
1353
1399
  "button",
1354
1400
  {
1355
- onClick: (t) => mt(t, "none"),
1401
+ onClick: (t) => ft(t, "none"),
1356
1402
  className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-foreground/10 cteditor-transition-colors ${c === "none" ? "cteditor-bg-foreground/10" : ""}`,
1357
1403
  "aria-label": "Inline",
1358
1404
  title: "Inline with text",
1359
- children: /* @__PURE__ */ r(gr, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
1405
+ children: /* @__PURE__ */ r(fr, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
1360
1406
  }
1361
1407
  ),
1362
1408
  /* @__PURE__ */ r("div", { className: "cteditor-w-px cteditor-h-5 cteditor-bg-foreground/10 cteditor-mx-0.5" }),
1363
- !i.startsWith("data:") && !i.toLowerCase().endsWith(".svg") && /* @__PURE__ */ h(Ft, { children: [
1409
+ !i.startsWith("data:") && !i.toLowerCase().endsWith(".svg") && /* @__PURE__ */ h(Kt, { children: [
1364
1410
  /* @__PURE__ */ r(
1365
1411
  "button",
1366
1412
  {
1367
- onClick: Ee,
1413
+ onClick: ze,
1368
1414
  className: "cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-foreground/10 cteditor-transition-colors",
1369
1415
  "aria-label": "Crop image",
1370
1416
  title: "Crop image",
1371
- children: /* @__PURE__ */ r(be, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
1417
+ children: /* @__PURE__ */ r(ve, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
1372
1418
  }
1373
1419
  ),
1374
- (kt(i) !== i || typeof d == "number" || typeof w == "number") && /* @__PURE__ */ r(
1420
+ (Rt(i) !== i || typeof d == "number" || typeof N == "number") && /* @__PURE__ */ r(
1375
1421
  "button",
1376
1422
  {
1377
- onClick: Ie,
1423
+ onClick: Me,
1378
1424
  className: "cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-foreground/10 cteditor-transition-colors",
1379
1425
  "aria-label": "Reset image to original size and crop",
1380
1426
  title: "Reset to original size and crop",
1381
- children: /* @__PURE__ */ r(Nr, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
1427
+ children: /* @__PURE__ */ r(kr, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
1382
1428
  }
1383
1429
  )
1384
1430
  ] })
1385
1431
  ] }),
1386
- k && /* @__PURE__ */ r(
1432
+ C && /* @__PURE__ */ r(
1387
1433
  "button",
1388
1434
  {
1389
- onClick: Yt,
1435
+ onClick: Ft,
1390
1436
  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",
1391
1437
  "aria-label": "Visit link",
1392
- title: `Visit: ${k}`,
1393
- children: /* @__PURE__ */ r(fr, {})
1438
+ title: `Visit: ${C}`,
1439
+ children: /* @__PURE__ */ r(hr, {})
1394
1440
  }
1395
1441
  ),
1396
1442
  E && /* @__PURE__ */ r(
1397
1443
  "button",
1398
1444
  {
1399
1445
  onClick: (t) => {
1400
- t.stopPropagation(), Re(t);
1446
+ t.stopPropagation(), Se(t);
1401
1447
  },
1402
1448
  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",
1403
1449
  "aria-label": "Refine image",
1404
1450
  title: "Refine image",
1405
- children: /* @__PURE__ */ r(hr, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
1451
+ children: /* @__PURE__ */ r(pr, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
1406
1452
  }
1407
1453
  ),
1408
1454
  /* @__PURE__ */ r(
1409
1455
  "button",
1410
1456
  {
1411
1457
  onClick: (t) => {
1412
- t.stopPropagation(), Ne(t);
1458
+ t.stopPropagation(), Ie(t);
1413
1459
  },
1414
1460
  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",
1415
1461
  "aria-label": "Open image in new tab",
1416
1462
  title: "Open in new tab",
1417
- children: /* @__PURE__ */ r(pr, {})
1463
+ children: /* @__PURE__ */ r(br, {})
1418
1464
  }
1419
1465
  ),
1420
1466
  /* @__PURE__ */ r(
1421
1467
  "button",
1422
1468
  {
1423
1469
  onClick: (t) => {
1424
- t.stopPropagation(), ke(t);
1470
+ t.stopPropagation(), Pe(t);
1425
1471
  },
1426
1472
  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",
1427
1473
  "aria-label": "Delete image",
1428
1474
  title: "Delete image",
1429
- children: /* @__PURE__ */ r(br, {})
1475
+ children: /* @__PURE__ */ r(yr, {})
1430
1476
  }
1431
1477
  )
1432
1478
  ]
1433
1479
  }
1434
1480
  ),
1435
- s && n && !q && E && /* @__PURE__ */ r(
1481
+ s && n && !J && E && /* @__PURE__ */ r(
1436
1482
  "div",
1437
1483
  {
1438
1484
  className: "cteditor-absolute cteditor-bottom-2 cteditor-left-2 cteditor-right-2 cteditor-bg-background/85 cteditor-rounded-lg cteditor-shadow-xl cteditor-border cteditor-border-foreground/20 cteditor-p-3 cteditor-backdrop-blur-lg md:cteditor-min-w-80",
@@ -1449,7 +1495,7 @@ function co({
1449
1495
  value: b,
1450
1496
  onChange: (t) => g(t.target.value),
1451
1497
  onKeyDown: (t) => {
1452
- t.stopPropagation(), t.key === "Enter" && b.trim() && !y && _t(), t.key === "Escape" && (p(!1), g(""));
1498
+ t.stopPropagation(), t.key === "Enter" && b.trim() && !x && Xt(), t.key === "Escape" && (p(!1), g(""));
1453
1499
  },
1454
1500
  onKeyUp: (t) => {
1455
1501
  t.stopPropagation();
@@ -1459,7 +1505,7 @@ function co({
1459
1505
  },
1460
1506
  placeholder: "e.g., flying birds, golden sunset, stormy clouds...",
1461
1507
  className: "cteditor-w-full cteditor-px-3 cteditor-py-2 cteditor-text-sm cteditor-border cteditor-border-foreground/10 focus:cteditor-border-foreground cteditor-rounded-md cteditor-bg-background cteditor-text-foreground ",
1462
- disabled: y,
1508
+ disabled: x,
1463
1509
  autoFocus: !0
1464
1510
  }
1465
1511
  ),
@@ -1468,11 +1514,11 @@ function co({
1468
1514
  "button",
1469
1515
  {
1470
1516
  onClick: (t) => {
1471
- t.stopPropagation(), _t();
1517
+ t.stopPropagation(), Xt();
1472
1518
  },
1473
- disabled: y || !b.trim(),
1519
+ disabled: x || !b.trim(),
1474
1520
  className: " cteditor-px-5 cteditor-py-2 cteditor-text-sm cteditor-rounded-md cteditor-bg-foreground cteditor-text-background hover:cteditor-bg-foreground/95 disabled:cteditor-opacity-50 disabled:cteditor-cursor-not-allowed cteditor-transition-colors focus:cteditor-outline-none focus:cteditor-ring-2 focus:cteditor-ring-background",
1475
- children: y ? /* @__PURE__ */ h("span", { className: "cteditor-flex cteditor-items-center cteditor-justify-center cteditor-gap-2", children: [
1521
+ children: x ? /* @__PURE__ */ h("span", { className: "cteditor-flex cteditor-items-center cteditor-justify-center cteditor-gap-2", children: [
1476
1522
  /* @__PURE__ */ r("span", { className: "cteditor-inline-block cteditor-w-4 cteditor-h-4 cteditor-border-2 cteditor-border-t-transparent cteditor-rounded-full cteditor-animate-spin" }),
1477
1523
  "Refining..."
1478
1524
  ] }) : "Refine Image"
@@ -1484,33 +1530,33 @@ function co({
1484
1530
  onClick: (t) => {
1485
1531
  t.stopPropagation(), p(!1), g("");
1486
1532
  },
1487
- disabled: y,
1533
+ disabled: x,
1488
1534
  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",
1489
- children: /* @__PURE__ */ r(yr, { size: 16 })
1535
+ children: /* @__PURE__ */ r(xr, { size: 16 })
1490
1536
  }
1491
1537
  )
1492
1538
  ] })
1493
1539
  ] })
1494
1540
  }
1495
1541
  ),
1496
- L && at(j) && Ot && !St && /* @__PURE__ */ r(
1497
- Ye,
1542
+ L && st(j) && Bt && !zt && /* @__PURE__ */ r(
1543
+ _e,
1498
1544
  {
1499
1545
  showCaption: P,
1500
- setShowCaption: ve,
1546
+ setShowCaption: ke,
1501
1547
  editor: m,
1502
1548
  buttonRef: D,
1503
- imageRef: v,
1504
- maxWidth: x,
1505
- onResizeStart: Ce,
1506
- onResizeEnd: we,
1507
- captionsEnabled: !q && C
1549
+ imageRef: y,
1550
+ maxWidth: w,
1551
+ onResizeStart: Ee,
1552
+ onResizeEnd: Re,
1553
+ captionsEnabled: !J && v
1508
1554
  }
1509
1555
  )
1510
1556
  ]
1511
1557
  }
1512
1558
  ),
1513
- P && (o.startsWith("Signature by") ? /* @__PURE__ */ r(Rr, { caption: N }) : /* @__PURE__ */ r(
1559
+ P && (o.startsWith("Signature by") ? /* @__PURE__ */ r(Er, { caption: k }) : /* @__PURE__ */ r(
1514
1560
  "div",
1515
1561
  {
1516
1562
  className: "image-caption-container",
@@ -1521,73 +1567,73 @@ function co({
1521
1567
  ...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" } : {}
1522
1568
  },
1523
1569
  children: /* @__PURE__ */ h(
1524
- re,
1570
+ ne,
1525
1571
  {
1526
- initialEditor: N,
1572
+ initialEditor: k,
1527
1573
  initialNodes: [
1528
- ae,
1529
- ne,
1530
- se,
1531
- de,
1532
- Qt,
1533
- Jt
1574
+ ce,
1575
+ le,
1576
+ ue,
1577
+ me,
1578
+ re,
1579
+ ee
1534
1580
  ],
1535
1581
  children: [
1536
- /* @__PURE__ */ r(_e, {}),
1582
+ /* @__PURE__ */ r(Oe, {}),
1537
1583
  /* @__PURE__ */ r(
1538
- ie,
1584
+ de,
1539
1585
  {
1540
1586
  contentEditable: /* @__PURE__ */ r(
1541
- Zt,
1587
+ oe,
1542
1588
  {
1543
1589
  "aria-placeholder": "Enter a caption...",
1544
- placeholder: () => /* @__PURE__ */ r("span", { className: "cteditor-text-xs", children: "Enter a caption..." }),
1545
- 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"
1590
+ placeholder: () => /* @__PURE__ */ r("span", { className: "cteditor-text-xs cteditor-absolute cteditor-left-2 cteditor-top-[7px]", children: "Enter a caption..." }),
1591
+ 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"
1546
1592
  }
1547
1593
  ),
1548
- ErrorBoundary: te
1594
+ ErrorBoundary: ie
1549
1595
  }
1550
1596
  ),
1551
1597
  /* @__PURE__ */ r(
1552
- oe,
1598
+ se,
1553
1599
  {
1554
1600
  onChange: () => {
1555
1601
  }
1556
1602
  }
1557
1603
  ),
1558
- /* @__PURE__ */ r(ee, {}),
1559
- /* @__PURE__ */ r(he, { namespace: pe.namespace })
1604
+ /* @__PURE__ */ r(ae, {}),
1605
+ /* @__PURE__ */ r(xe, { namespace: we.namespace })
1560
1606
  ]
1561
1607
  }
1562
1608
  )
1563
1609
  }
1564
1610
  )),
1565
1611
  /* @__PURE__ */ r(
1566
- Tr,
1612
+ Wr,
1567
1613
  {
1568
- open: F,
1569
- onOpenChange: ut,
1614
+ open: B,
1615
+ onOpenChange: gt,
1570
1616
  src: i,
1571
1617
  altText: o,
1572
1618
  width: d,
1573
- height: w,
1574
- onCropApply: Pe
1619
+ height: N,
1620
+ onCropApply: Ae
1575
1621
  }
1576
1622
  ),
1577
1623
  /* @__PURE__ */ r(
1578
- kr,
1624
+ Rr,
1579
1625
  {
1580
- open: ct,
1581
- onOpenChange: lt,
1626
+ open: ut,
1627
+ onOpenChange: mt,
1582
1628
  oldImageUrl: i,
1583
- newImageUrl: G,
1584
- onReplace: Me,
1585
- onCancel: Ae
1629
+ newImageUrl: Q,
1630
+ onReplace: $e,
1631
+ onCancel: Te
1586
1632
  }
1587
1633
  )
1588
1634
  ] }) });
1589
1635
  }
1590
1636
  export {
1591
- Vt as RIGHT_CLICK_IMAGE_COMMAND,
1637
+ te as RIGHT_CLICK_IMAGE_COMMAND,
1592
1638
  co as default
1593
1639
  };