eddyter 1.4.9 → 1.4.11

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