eddyter 1.4.1 → 1.4.2

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