sykpcomposer 1.20.124 → 1.20.126

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,9 +1,9 @@
1
- import { j as b, u as de, a as se, x as F, $ as T, w as Z, d as V, b as te, c as le, e as ue, f as ge, C as B, g as pe, k as we, h as me, I as fe, r as ye, i as xe, l as Ce, L as ve, P as De, m as be, t as Re } from "./index-fde88807.js";
2
- import { d as Ee } from "./LexicalNestedComposer.prod-5fe44982.js";
3
- import C, { useRef as L, PureComponent as Me, createRef as ne, useState as G, useCallback as U, useEffect as q, Suspense as Pe } from "react";
1
+ import { j as b, u as de, a as ae, x as T, $ as G, w as ee, d as q, b as ne, c as le, e as ge, f as ue, C as B, g as pe, k as me, h as we, I as fe, r as xe, i as ye, l as Ce, L as ve, P as De, m as be, t as Re } from "./index-c6d40f36.js";
2
+ import { d as Ee } from "./LexicalNestedComposer.prod-fd8d53c1.js";
3
+ import C, { useRef as j, PureComponent as Me, createRef as re, useState as V, useCallback as F, useEffect as J, Suspense as He } from "react";
4
4
  import "react-dom";
5
- function ee(u, t, e) {
6
- return Math.min(Math.max(u, t), e);
5
+ function te(g, t, e) {
6
+ return Math.min(Math.max(g, t), e);
7
7
  }
8
8
  const v = {
9
9
  east: 1,
@@ -11,8 +11,8 @@ const v = {
11
11
  south: 2,
12
12
  west: 4
13
13
  };
14
- function ke({
15
- onResizeStart: u,
14
+ function Pe({
15
+ onResizeStart: g,
16
16
  onResizeEnd: t,
17
17
  buttonRef: e,
18
18
  imageRef: o,
@@ -22,10 +22,10 @@ function ke({
22
22
  setShowCaption: p,
23
23
  enableCaptions: s
24
24
  }) {
25
- const i = L(null), l = L({
25
+ const i = j(null), l = j({
26
26
  priority: "",
27
27
  value: "default"
28
- }), h = L({
28
+ }), h = j({
29
29
  currentHeight: 0,
30
30
  currentWidth: 0,
31
31
  direction: 0,
@@ -35,15 +35,15 @@ function ke({
35
35
  startWidth: 0,
36
36
  startX: 0,
37
37
  startY: 0
38
- }), d = r.getRootElement(), c = d !== null ? d.getBoundingClientRect().width - 20 : 100, R = d !== null ? d.getBoundingClientRect().height - 20 : 100, M = 100, H = 100, w = (g) => {
39
- const m = g === v.east || g === v.west, f = g === v.north || g === v.south, $ = g & v.north && g & v.west || g & v.south && g & v.east, k = m ? "ew" : f ? "ns" : $ ? "nwse" : "nesw";
38
+ }), d = r.getRootElement(), c = d !== null ? d.getBoundingClientRect().width - 20 : 100, R = d !== null ? d.getBoundingClientRect().height - 20 : 100, H = 100, k = 100, m = (u) => {
39
+ const f = u === v.east || u === v.west, w = u === v.north || u === v.south, $ = u & v.north && u & v.west || u & v.south && u & v.east, P = f ? "ew" : w ? "ns" : $ ? "nwse" : "nesw";
40
40
  d !== null && d.style.setProperty(
41
41
  "cursor",
42
- `${k}-resize`,
42
+ `${P}-resize`,
43
43
  "important"
44
44
  ), document.body !== null && (document.body.style.setProperty(
45
45
  "cursor",
46
- `${k}-resize`,
46
+ `${P}-resize`,
47
47
  "important"
48
48
  ), l.current.value = document.body.style.getPropertyValue(
49
49
  "-webkit-user-select"
@@ -54,59 +54,64 @@ function ke({
54
54
  "none",
55
55
  "important"
56
56
  ));
57
- }, j = () => {
57
+ }, A = () => {
58
58
  d !== null && d.style.setProperty("cursor", "text"), document.body !== null && (document.body.style.setProperty("cursor", "default"), document.body.style.setProperty(
59
59
  "-webkit-user-select",
60
60
  l.current.value,
61
61
  l.current.priority
62
62
  ));
63
- }, N = (g, m) => {
63
+ }, N = (u, f) => {
64
64
  if (!r.isEditable())
65
65
  return;
66
- const f = o.current, $ = i.current;
67
- if (f !== null && $ !== null) {
68
- g.preventDefault();
69
- const { width: k, height: x } = f.getBoundingClientRect(), D = h.current;
70
- D.startWidth = k, D.startHeight = x, D.ratio = k / x, D.currentWidth = k, D.currentHeight = x, D.startX = g.clientX, D.startY = g.clientY, D.isResizing = !0, D.direction = m, w(m), u(), $.classList.add("image-control-wrapper--resizing"), f.style.height = `${x}px`, f.style.width = `${k}px`, document.addEventListener("pointermove", S), document.addEventListener("pointerup", P);
66
+ const w = o.current, $ = i.current;
67
+ if (w !== null && $ !== null) {
68
+ u.preventDefault();
69
+ const { width: P, height: y } = w.getBoundingClientRect(), D = h.current;
70
+ D.startWidth = P, D.startHeight = y, D.ratio = P / y, D.currentWidth = P, D.currentHeight = y, D.startX = u.clientX, D.startY = u.clientY, D.isResizing = !0, D.direction = f, m(f), g(), $.classList.add("image-control-wrapper--resizing"), w.style.height = `${y}px`, w.style.width = `${P}px`, document.addEventListener("pointermove", S), document.addEventListener("pointerup", E);
71
71
  }
72
- }, S = (g) => {
73
- const m = o.current, f = h.current, $ = f.direction & (v.east | v.west), k = f.direction & (v.south | v.north);
74
- if (m !== null && f.isResizing) {
75
- if ($ && k) {
76
- let x = Math.floor(f.startX - g.clientX);
77
- x = f.direction & v.east ? -x : x;
78
- const D = ee(
79
- f.startWidth + x,
80
- M,
81
- c
82
- ), A = D / f.ratio;
83
- m.style.width = `${D}px`, m.style.height = `${A}px`, f.currentHeight = A, f.currentWidth = D;
84
- } else if (k) {
85
- let x = Math.floor(f.startY - g.clientY);
86
- x = f.direction & v.south ? -x : x;
87
- const D = ee(
88
- f.startHeight + x,
72
+ }, S = (u) => {
73
+ const f = o.current, w = h.current, $ = w.direction & (v.east | v.west), P = w.direction & (v.south | v.north);
74
+ if (f !== null && w.isResizing) {
75
+ if ($ && P) {
76
+ let y = Math.floor(w.startX - u.clientX);
77
+ y = w.direction & v.east ? -y : y;
78
+ const D = te(
79
+ w.startWidth + y,
89
80
  H,
90
- R
91
- );
92
- m.style.height = `${D}px`, m.style.maxHeight = `${D}px`, f.currentHeight = D;
81
+ c
82
+ ), _ = D / w.ratio;
83
+ if (_ > 600) {
84
+ alert("Image height cannot be greater than 600px."), E();
85
+ return;
86
+ }
87
+ f.style.width = `${D}px`, f.style.height = `${_}px`, w.currentHeight = _, w.currentWidth = D;
88
+ } else if (P) {
89
+ let y = Math.floor(w.startY - u.clientY);
90
+ y = w.direction & v.south ? -y : y;
91
+ const D = w.startHeight + y;
92
+ if (D > w.startHeight && D > 600) {
93
+ alert("Image height cannot be greater than 600px."), E();
94
+ return;
95
+ }
96
+ const U = te(D, k, R);
97
+ f.style.height = `${U}px`, f.style.maxHeight = `${U}px`, w.currentHeight = U;
93
98
  } else {
94
- let x = Math.floor(f.startX - g.clientX);
95
- x = f.direction & v.east ? -x : x;
96
- const D = ee(
97
- f.startWidth + x,
98
- M,
99
+ let y = Math.floor(w.startX - u.clientX);
100
+ y = w.direction & v.east ? -y : y;
101
+ const D = te(
102
+ w.startWidth + y,
103
+ H,
99
104
  c
100
105
  );
101
- m.style.width = `${D}px`, m.style.maxWidth = `${D}px`, f.currentWidth = D;
106
+ f.style.width = `${D}px`, f.style.maxWidth = `${D}px`, w.currentWidth = D;
102
107
  }
103
- m && (m.setAttribute("width", `${f.currentWidth}`), m.setAttribute("height", `${f.currentHeight}`));
108
+ f && (f.setAttribute("width", `${w.currentWidth}`), f.setAttribute("height", `${w.currentHeight}`));
104
109
  }
105
- }, P = () => {
106
- const g = o.current, m = h.current, f = i.current;
107
- if (g !== null && f !== null && m.isResizing) {
108
- const $ = m.currentWidth, k = m.currentHeight;
109
- m.startWidth = 0, m.startHeight = 0, m.ratio = 0, m.startX = 0, m.startY = 0, m.currentWidth = 0, m.currentHeight = 0, m.isResizing = !1, f.classList.remove("image-control-wrapper--resizing"), j(), t($, k), document.removeEventListener("pointermove", S), document.removeEventListener("pointerup", P);
110
+ }, E = () => {
111
+ const u = o.current, f = h.current, w = i.current;
112
+ if (u !== null && w !== null && f.isResizing) {
113
+ const $ = f.currentWidth, P = f.currentHeight;
114
+ f.startWidth = 0, f.startHeight = 0, f.ratio = 0, f.startX = 0, f.startY = 0, f.currentWidth = 0, f.currentHeight = 0, f.isResizing = !1, w.classList.remove("image-control-wrapper--resizing"), A(), t($, P), document.removeEventListener("pointermove", S), document.removeEventListener("pointerup", E);
110
115
  }
111
116
  };
112
117
  return /* @__PURE__ */ b.jsxs("div", { ref: i, children: [
@@ -114,8 +119,8 @@ function ke({
114
119
  "div",
115
120
  {
116
121
  className: "image-resizer image-resizer-n",
117
- onPointerDown: (g) => {
118
- N(g, v.north);
122
+ onPointerDown: (u) => {
123
+ N(u, v.north);
119
124
  }
120
125
  }
121
126
  ),
@@ -123,8 +128,8 @@ function ke({
123
128
  "div",
124
129
  {
125
130
  className: "image-resizer image-resizer-ne",
126
- onPointerDown: (g) => {
127
- N(g, v.north | v.east);
131
+ onPointerDown: (u) => {
132
+ N(u, v.north | v.east);
128
133
  }
129
134
  }
130
135
  ),
@@ -132,8 +137,8 @@ function ke({
132
137
  "div",
133
138
  {
134
139
  className: "image-resizer image-resizer-e",
135
- onPointerDown: (g) => {
136
- N(g, v.east);
140
+ onPointerDown: (u) => {
141
+ N(u, v.east);
137
142
  }
138
143
  }
139
144
  ),
@@ -141,8 +146,8 @@ function ke({
141
146
  "div",
142
147
  {
143
148
  className: "image-resizer image-resizer-se",
144
- onPointerDown: (g) => {
145
- N(g, v.south | v.east);
149
+ onPointerDown: (u) => {
150
+ N(u, v.south | v.east);
146
151
  }
147
152
  }
148
153
  ),
@@ -150,8 +155,8 @@ function ke({
150
155
  "div",
151
156
  {
152
157
  className: "image-resizer image-resizer-s",
153
- onPointerDown: (g) => {
154
- N(g, v.south);
158
+ onPointerDown: (u) => {
159
+ N(u, v.south);
155
160
  }
156
161
  }
157
162
  ),
@@ -159,8 +164,8 @@ function ke({
159
164
  "div",
160
165
  {
161
166
  className: "image-resizer image-resizer-sw",
162
- onPointerDown: (g) => {
163
- N(g, v.south | v.west);
167
+ onPointerDown: (u) => {
168
+ N(u, v.south | v.west);
164
169
  }
165
170
  }
166
171
  ),
@@ -168,8 +173,8 @@ function ke({
168
173
  "div",
169
174
  {
170
175
  className: "image-resizer image-resizer-w",
171
- onPointerDown: (g) => {
172
- N(g, v.west);
176
+ onPointerDown: (u) => {
177
+ N(u, v.west);
173
178
  }
174
179
  }
175
180
  ),
@@ -177,64 +182,64 @@ function ke({
177
182
  "div",
178
183
  {
179
184
  className: "image-resizer image-resizer-nw",
180
- onPointerDown: (g) => {
181
- N(g, v.north | v.west);
185
+ onPointerDown: (u) => {
186
+ N(u, v.north | v.west);
182
187
  }
183
188
  }
184
189
  )
185
190
  ] });
186
191
  }
187
- const J = {
192
+ const Q = {
188
193
  x: 0,
189
194
  y: 0,
190
195
  width: 0,
191
196
  height: 0,
192
197
  unit: "px"
193
- }, O = (u, t, e) => Math.min(Math.max(u, t), e), He = (...u) => u.filter((t) => t && typeof t == "string").join(" "), re = (u, t) => u === t || u.width === t.width && u.height === t.height && u.x === t.x && u.y === t.y && u.unit === t.unit;
194
- function W(u, t, e) {
195
- return u.unit === "%" ? { ...J, ...u, unit: "%" } : {
198
+ }, O = (g, t, e) => Math.min(Math.max(g, t), e), ke = (...g) => g.filter((t) => t && typeof t == "string").join(" "), ie = (g, t) => g === t || g.width === t.width && g.height === t.height && g.x === t.x && g.y === t.y && g.unit === t.unit;
199
+ function W(g, t, e) {
200
+ return g.unit === "%" ? { ...Q, ...g, unit: "%" } : {
196
201
  unit: "%",
197
- x: u.x ? u.x / t * 100 : 0,
198
- y: u.y ? u.y / e * 100 : 0,
199
- width: u.width ? u.width / t * 100 : 0,
200
- height: u.height ? u.height / e * 100 : 0
202
+ x: g.x ? g.x / t * 100 : 0,
203
+ y: g.y ? g.y / e * 100 : 0,
204
+ width: g.width ? g.width / t * 100 : 0,
205
+ height: g.height ? g.height / e * 100 : 0
201
206
  };
202
207
  }
203
- function X(u, t, e) {
204
- return u.unit ? u.unit === "px" ? { ...J, ...u, unit: "px" } : {
208
+ function Y(g, t, e) {
209
+ return g.unit ? g.unit === "px" ? { ...Q, ...g, unit: "px" } : {
205
210
  unit: "px",
206
- x: u.x ? u.x * t / 100 : 0,
207
- y: u.y ? u.y * e / 100 : 0,
208
- width: u.width ? u.width * t / 100 : 0,
209
- height: u.height ? u.height * e / 100 : 0
210
- } : { ...J, ...u, unit: "px" };
211
+ x: g.x ? g.x * t / 100 : 0,
212
+ y: g.y ? g.y * e / 100 : 0,
213
+ width: g.width ? g.width * t / 100 : 0,
214
+ height: g.height ? g.height * e / 100 : 0
215
+ } : { ...Q, ...g, unit: "px" };
211
216
  }
212
- function ie(u, t, e, o, n, r = 0, a = 0, p = o, s = n) {
213
- const i = { ...u };
217
+ function oe(g, t, e, o, n, r = 0, a = 0, p = o, s = n) {
218
+ const i = { ...g };
214
219
  let l = Math.min(r, o), h = Math.min(a, n), d = Math.min(p, o), c = Math.min(s, n);
215
220
  t && (t > 1 ? (l = a ? a * t : l, h = l / t, d = p * t) : (h = r ? r / t : h, l = h * t, c = s / t)), i.y < 0 && (i.height = Math.max(i.height + i.y, h), i.y = 0), i.x < 0 && (i.width = Math.max(i.width + i.x, l), i.x = 0);
216
221
  const R = o - (i.x + i.width);
217
222
  R < 0 && (i.x = Math.min(i.x, o - l), i.width += R);
218
- const M = n - (i.y + i.height);
219
- if (M < 0 && (i.y = Math.min(i.y, n - h), i.height += M), i.width < l && ((e === "sw" || e == "nw") && (i.x -= l - i.width), i.width = l), i.height < h && ((e === "nw" || e == "ne") && (i.y -= h - i.height), i.height = h), i.width > d && ((e === "sw" || e == "nw") && (i.x -= d - i.width), i.width = d), i.height > c && ((e === "nw" || e == "ne") && (i.y -= c - i.height), i.height = c), t) {
220
- const H = i.width / i.height;
221
- if (H < t) {
222
- const w = Math.max(i.width / t, h);
223
- (e === "nw" || e == "ne") && (i.y -= w - i.height), i.height = w;
224
- } else if (H > t) {
225
- const w = Math.max(i.height * t, l);
226
- (e === "sw" || e == "nw") && (i.x -= w - i.width), i.width = w;
223
+ const H = n - (i.y + i.height);
224
+ if (H < 0 && (i.y = Math.min(i.y, n - h), i.height += H), i.width < l && ((e === "sw" || e == "nw") && (i.x -= l - i.width), i.width = l), i.height < h && ((e === "nw" || e == "ne") && (i.y -= h - i.height), i.height = h), i.width > d && ((e === "sw" || e == "nw") && (i.x -= d - i.width), i.width = d), i.height > c && ((e === "nw" || e == "ne") && (i.y -= c - i.height), i.height = c), t) {
225
+ const k = i.width / i.height;
226
+ if (k < t) {
227
+ const m = Math.max(i.width / t, h);
228
+ (e === "nw" || e == "ne") && (i.y -= m - i.height), i.height = m;
229
+ } else if (k > t) {
230
+ const m = Math.max(i.height * t, l);
231
+ (e === "sw" || e == "nw") && (i.x -= m - i.width), i.width = m;
227
232
  }
228
233
  }
229
234
  return i;
230
235
  }
231
- function Ne(u, t, e, o) {
232
- const n = { ...u };
236
+ function Ne(g, t, e, o) {
237
+ const n = { ...g };
233
238
  return t === "ArrowLeft" ? o === "nw" ? (n.x -= e, n.y -= e, n.width += e, n.height += e) : o === "w" ? (n.x -= e, n.width += e) : o === "sw" ? (n.x -= e, n.width += e, n.height += e) : o === "ne" ? (n.y += e, n.width -= e, n.height -= e) : o === "e" ? n.width -= e : o === "se" && (n.width -= e, n.height -= e) : t === "ArrowRight" && (o === "nw" ? (n.x += e, n.y += e, n.width -= e, n.height -= e) : o === "w" ? (n.x += e, n.width -= e) : o === "sw" ? (n.x += e, n.width -= e, n.height -= e) : o === "ne" ? (n.y -= e, n.width += e, n.height += e) : o === "e" ? n.width += e : o === "se" && (n.width += e, n.height += e)), t === "ArrowUp" ? o === "nw" ? (n.x -= e, n.y -= e, n.width += e, n.height += e) : o === "n" ? (n.y -= e, n.height += e) : o === "ne" ? (n.y -= e, n.width += e, n.height += e) : o === "sw" ? (n.x += e, n.width -= e, n.height -= e) : o === "s" ? n.height -= e : o === "se" && (n.width -= e, n.height -= e) : t === "ArrowDown" && (o === "nw" ? (n.x += e, n.y += e, n.width -= e, n.height -= e) : o === "n" ? (n.y += e, n.height -= e) : o === "ne" ? (n.y += e, n.width -= e, n.height -= e) : o === "sw" ? (n.x -= e, n.width += e, n.height += e) : o === "s" ? n.height += e : o === "se" && (n.width += e, n.height += e)), n;
234
239
  }
235
240
  const K = { capture: !0, passive: !1 };
236
241
  let $e = 0;
237
- const Y = class _ extends Me {
242
+ const L = class I extends Me {
238
243
  constructor() {
239
244
  super(...arguments), this.docMoveBound = !1, this.mouseDownOnCrop = !1, this.dragStarted = !1, this.evData = {
240
245
  startClientX: 0,
@@ -244,14 +249,14 @@ const Y = class _ extends Me {
244
249
  clientX: 0,
245
250
  clientY: 0,
246
251
  isResize: !0
247
- }, this.componentRef = ne(), this.mediaRef = ne(), this.initChangeCalled = !1, this.instanceId = `rc-${$e++}`, this.state = {
252
+ }, this.componentRef = re(), this.mediaRef = re(), this.initChangeCalled = !1, this.instanceId = `rc-${$e++}`, this.state = {
248
253
  cropIsActive: !1,
249
254
  newCropIsBeingDrawn: !1
250
255
  }, this.onCropPointerDown = (t) => {
251
256
  const { crop: e, disabled: o } = this.props, n = this.getBox();
252
257
  if (!e)
253
258
  return;
254
- const r = X(e, n.width, n.height);
259
+ const r = Y(e, n.width, n.height);
255
260
  if (o)
256
261
  return;
257
262
  t.cancelable && t.preventDefault(), this.bindDocMove(), this.componentRef.current.focus({ preventScroll: !0 });
@@ -259,8 +264,8 @@ const Y = class _ extends Me {
259
264
  let s = t.clientX, i = t.clientY, l = r.x, h = r.y;
260
265
  if (a) {
261
266
  const d = t.clientX - n.x, c = t.clientY - n.y;
262
- let R = 0, M = 0;
263
- a === "ne" || a == "e" ? (R = d - (r.x + r.width), M = c - r.y, l = r.x, h = r.y + r.height) : a === "se" || a === "s" ? (R = d - (r.x + r.width), M = c - (r.y + r.height), l = r.x, h = r.y) : a === "sw" || a == "w" ? (R = d - r.x, M = c - (r.y + r.height), l = r.x + r.width, h = r.y) : (a === "nw" || a == "n") && (R = d - r.x, M = c - r.y, l = r.x + r.width, h = r.y + r.height), s = l + n.x + R, i = h + n.y + M;
267
+ let R = 0, H = 0;
268
+ a === "ne" || a == "e" ? (R = d - (r.x + r.width), H = c - r.y, l = r.x, h = r.y + r.height) : a === "se" || a === "s" ? (R = d - (r.x + r.width), H = c - (r.y + r.height), l = r.x, h = r.y) : a === "sw" || a == "w" ? (R = d - r.x, H = c - (r.y + r.height), l = r.x + r.width, h = r.y) : (a === "nw" || a == "n") && (R = d - r.x, H = c - r.y, l = r.x + r.width, h = r.y + r.height), s = l + n.x + R, i = h + n.y + H;
264
269
  }
265
270
  this.evData = {
266
271
  startClientX: s,
@@ -292,7 +297,7 @@ const Y = class _ extends Me {
292
297
  clientX: t.clientX,
293
298
  clientY: t.clientY,
294
299
  isResize: !0
295
- }, this.mouseDownOnCrop = !0, a(X(l, p.width, p.height), W(l, p.width, p.height)), this.setState({ cropIsActive: !0, newCropIsBeingDrawn: !0 });
300
+ }, this.mouseDownOnCrop = !0, a(Y(l, p.width, p.height), W(l, p.width, p.height)), this.setState({ cropIsActive: !0, newCropIsBeingDrawn: !0 });
296
301
  }, this.onDocPointerMove = (t) => {
297
302
  const { crop: e, disabled: o, onChange: n, onDragStart: r } = this.props, a = this.getBox();
298
303
  if (o || !e || !this.mouseDownOnCrop)
@@ -301,8 +306,8 @@ const Y = class _ extends Me {
301
306
  const { evData: p } = this;
302
307
  p.clientX = t.clientX, p.clientY = t.clientY;
303
308
  let s;
304
- p.isResize ? s = this.resizeCrop() : s = this.dragCrop(), re(e, s) || n(
305
- X(s, a.width, a.height),
309
+ p.isResize ? s = this.resizeCrop() : s = this.dragCrop(), ie(e, s) || n(
310
+ Y(s, a.width, a.height),
306
311
  W(s, a.width, a.height)
307
312
  );
308
313
  }, this.onComponentKeyDown = (t) => {
@@ -313,10 +318,10 @@ const Y = class _ extends Me {
313
318
  let p = !1;
314
319
  if (!e)
315
320
  return;
316
- const s = this.getBox(), i = this.makePixelCrop(s), l = (navigator.platform.match("Mac") ? t.metaKey : t.ctrlKey) ? _.nudgeStepLarge : t.shiftKey ? _.nudgeStepMedium : _.nudgeStep;
321
+ const s = this.getBox(), i = this.makePixelCrop(s), l = (navigator.platform.match("Mac") ? t.metaKey : t.ctrlKey) ? I.nudgeStepLarge : t.shiftKey ? I.nudgeStepMedium : I.nudgeStep;
317
322
  if (a === "ArrowLeft" ? (i.x -= l, p = !0) : a === "ArrowRight" ? (i.x += l, p = !0) : a === "ArrowUp" ? (i.y -= l, p = !0) : a === "ArrowDown" && (i.y += l, p = !0), p) {
318
323
  t.cancelable && t.preventDefault(), i.x = O(i.x, 0, s.width - i.width), i.y = O(i.y, 0, s.height - i.height);
319
- const h = X(i, s.width, s.height), d = W(i, s.width, s.height);
324
+ const h = Y(i, s.width, s.height), d = W(i, s.width, s.height);
320
325
  n(h, d), r && r(h, d);
321
326
  }
322
327
  }, this.onHandlerKeyDown = (t, e) => {
@@ -337,8 +342,8 @@ const Y = class _ extends Me {
337
342
  t.stopPropagation(), t.preventDefault();
338
343
  else
339
344
  return;
340
- const c = (navigator.platform.match("Mac") ? t.metaKey : t.ctrlKey) ? _.nudgeStepLarge : t.shiftKey ? _.nudgeStepMedium : _.nudgeStep, R = X(n, d.width, d.height), M = Ne(R, t.key, c, e), H = ie(
341
- M,
345
+ const c = (navigator.platform.match("Mac") ? t.metaKey : t.ctrlKey) ? I.nudgeStepLarge : t.shiftKey ? I.nudgeStepMedium : I.nudgeStep, R = Y(n, d.width, d.height), H = Ne(R, t.key, c, e), k = oe(
346
+ H,
342
347
  o,
343
348
  e,
344
349
  d.width,
@@ -348,13 +353,13 @@ const Y = class _ extends Me {
348
353
  s,
349
354
  i
350
355
  );
351
- if (!re(n, H)) {
352
- const w = W(H, d.width, d.height);
353
- l(H, w), h && h(H, w);
356
+ if (!ie(n, k)) {
357
+ const m = W(k, d.width, d.height);
358
+ l(k, m), h && h(k, m);
354
359
  }
355
360
  }, this.onDocPointerDone = (t) => {
356
361
  const { crop: e, disabled: o, onComplete: n, onDragEnd: r } = this.props, a = this.getBox();
357
- this.unbindDocMove(), !(o || !e) && this.mouseDownOnCrop && (this.mouseDownOnCrop = !1, this.dragStarted = !1, r && r(t), n && n(X(e, a.width, a.height), W(e, a.width, a.height)), this.setState({ cropIsActive: !1, newCropIsBeingDrawn: !1 }));
362
+ this.unbindDocMove(), !(o || !e) && this.mouseDownOnCrop && (this.mouseDownOnCrop = !1, this.dragStarted = !1, r && r(t), n && n(Y(e, a.width, a.height), W(e, a.width, a.height)), this.setState({ cropIsActive: !1, newCropIsBeingDrawn: !1 }));
358
363
  }, this.onDragFocus = () => {
359
364
  var t;
360
365
  (t = this.componentRef.current) == null || t.scrollTo(0, 0);
@@ -376,7 +381,7 @@ const Y = class _ extends Me {
376
381
  const { crop: e, onComplete: o } = this.props;
377
382
  if (o && !t.crop && e) {
378
383
  const { width: n, height: r } = this.getBox();
379
- n && r && o(X(e, n, r), W(e, n, r));
384
+ n && r && o(Y(e, n, r), W(e, n, r));
380
385
  }
381
386
  }
382
387
  componentWillUnmount() {
@@ -427,7 +432,7 @@ const Y = class _ extends Me {
427
432
  height: 0
428
433
  };
429
434
  i === "ne" ? (c.x = t.startCropX, c.width = h, e ? (c.height = c.width / e, c.y = t.startCropY - c.height) : (c.height = Math.abs(d), c.y = t.startCropY - c.height)) : i === "se" ? (c.x = t.startCropX, c.y = t.startCropY, c.width = h, e ? c.height = c.width / e : c.height = d) : i === "sw" ? (c.x = t.startCropX + h, c.y = t.startCropY, c.width = Math.abs(h), e ? c.height = c.width / e : c.height = d) : i === "nw" && (c.x = t.startCropX + h, c.width = Math.abs(h), e ? (c.height = c.width / e, c.y = t.startCropY - c.height) : (c.height = Math.abs(d), c.y = t.startCropY + d));
430
- const R = ie(
435
+ const R = oe(
431
436
  c,
432
437
  e,
433
438
  i,
@@ -438,11 +443,11 @@ const Y = class _ extends Me {
438
443
  o,
439
444
  n
440
445
  );
441
- return e || _.xyOrds.indexOf(l) > -1 ? s = R : _.xOrds.indexOf(l) > -1 ? (s.x = R.x, s.width = R.width) : _.yOrds.indexOf(l) > -1 && (s.y = R.y, s.height = R.height), s.x = O(s.x, 0, r.width - s.width), s.y = O(s.y, 0, r.height - s.height), s;
446
+ return e || I.xyOrds.indexOf(l) > -1 ? s = R : I.xOrds.indexOf(l) > -1 ? (s.x = R.x, s.width = R.width) : I.yOrds.indexOf(l) > -1 && (s.y = R.y, s.height = R.height), s.x = O(s.x, 0, r.width - s.width), s.y = O(s.y, 0, r.height - s.height), s;
442
447
  }
443
448
  renderCropSelection() {
444
449
  const {
445
- ariaLabels: t = _.defaultProps.ariaLabels,
450
+ ariaLabels: t = I.defaultProps.ariaLabels,
446
451
  disabled: e,
447
452
  locked: o,
448
453
  renderSelectionAddon: n,
@@ -547,11 +552,11 @@ const Y = class _ extends Me {
547
552
  );
548
553
  }
549
554
  makePixelCrop(t) {
550
- const e = { ...J, ...this.props.crop || {} };
551
- return X(e, t.width, t.height);
555
+ const e = { ...Q, ...this.props.crop || {} };
556
+ return Y(e, t.width, t.height);
552
557
  }
553
558
  render() {
554
- const { aspect: t, children: e, circularCrop: o, className: n, crop: r, disabled: a, locked: p, style: s, ruleOfThirds: i } = this.props, { cropIsActive: l, newCropIsBeingDrawn: h } = this.state, d = r ? this.renderCropSelection() : null, c = He(
559
+ const { aspect: t, children: e, circularCrop: o, className: n, crop: r, disabled: a, locked: p, style: s, ruleOfThirds: i } = this.props, { cropIsActive: l, newCropIsBeingDrawn: h } = this.state, d = r ? this.renderCropSelection() : null, c = ke(
555
560
  "ReactCrop",
556
561
  n,
557
562
  l && "ReactCrop--active",
@@ -585,7 +590,7 @@ const Y = class _ extends Me {
585
590
  ))), /* @__PURE__ */ C.createElement("rect", { fill: "black", fillOpacity: 0.5, width: "100%", height: "100%", mask: `url(#hole-${this.instanceId})` })) : void 0, d);
586
591
  }
587
592
  };
588
- Y.xOrds = ["e", "w"], Y.yOrds = ["n", "s"], Y.xyOrds = ["nw", "ne", "se", "sw"], Y.nudgeStep = 1, Y.nudgeStepMedium = 10, Y.nudgeStepLarge = 100, Y.defaultProps = {
593
+ L.xOrds = ["e", "w"], L.yOrds = ["n", "s"], L.xyOrds = ["nw", "ne", "se", "sw"], L.nudgeStep = 1, L.nudgeStepMedium = 10, L.nudgeStepLarge = 100, L.defaultProps = {
589
594
  ariaLabels: {
590
595
  cropArea: "Use the arrow keys to move the crop selection area",
591
596
  nwDragHandle: "Use the arrow keys to move the north west drag handle to change the crop selection area",
@@ -598,10 +603,10 @@ Y.xOrds = ["e", "w"], Y.yOrds = ["n", "s"], Y.xyOrds = ["nw", "ne", "se", "sw"],
598
603
  wDragHandle: "Use the up and down arrow keys to move the west drag handle to change the crop selection area"
599
604
  }
600
605
  };
601
- let ze = Y;
602
- const oe = Re();
606
+ let ze = L;
607
+ const se = Re();
603
608
  function Se({
604
- altText: u,
609
+ altText: g,
605
610
  className: t,
606
611
  src: e,
607
612
  width: o,
@@ -613,7 +618,7 @@ function Se({
613
618
  isFocused: i,
614
619
  nodeKey: l
615
620
  }) {
616
- const [h, d] = G(null), [c, R] = G({
621
+ const [h, d] = V(null), [c, R] = V({
617
622
  //@ts-ignore
618
623
  unit: "px",
619
624
  // Can be 'px' or '%'
@@ -621,69 +626,69 @@ function Se({
621
626
  y: 25,
622
627
  width: 50,
623
628
  height: 50
624
- }), [M] = se(), H = () => {
629
+ }), [H] = ae(), k = () => {
625
630
  if (h) {
626
- const P = a.current;
627
- if (!P || !h)
631
+ const E = a.current;
632
+ if (!E || !h)
628
633
  return;
629
- const g = P.naturalWidth / P.width, m = P.naturalHeight / P.height, f = new OffscreenCanvas(
630
- h.width * g,
631
- h.height * m
632
- ), $ = f.getContext("2d");
634
+ const u = E.naturalWidth / E.width, f = E.naturalHeight / E.height, w = new OffscreenCanvas(
635
+ h.width * u,
636
+ h.height * f
637
+ ), $ = w.getContext("2d");
633
638
  if (!$)
634
639
  throw new Error("No 2D context available");
635
640
  $.drawImage(
636
- P,
637
- h.x * g,
638
- h.y * m,
639
- h.width * g,
640
- h.height * m,
641
+ E,
642
+ h.x * u,
643
+ h.y * f,
644
+ h.width * u,
645
+ h.height * f,
641
646
  0,
642
647
  0,
643
- h.width * g,
644
- h.height * m
645
- ), f.convertToBlob({ type: "image/png" }).then((k) => {
648
+ h.width * u,
649
+ h.height * f
650
+ ), w.convertToBlob({ type: "image/png" }).then((P) => {
646
651
  s(!1);
647
- const x = new FileReader();
648
- x.onload = () => {
649
- const D = x.result;
652
+ const y = new FileReader();
653
+ y.onload = () => {
654
+ const D = y.result;
650
655
  setTimeout(() => {
651
- M.update(
656
+ H.update(
652
657
  () => {
653
- const A = F(l);
654
- T(A) && D && A.setSrc(D);
658
+ const _ = T(l);
659
+ G(_) && D && _.setSrc(D);
655
660
  },
656
661
  { tag: "crop" }
657
662
  );
658
663
  }, 100);
659
- }, x.onerror = () => {
664
+ }, y.onerror = () => {
660
665
  console.error("Error reading the cropped image blob");
661
- }, x.readAsDataURL(k);
666
+ }, y.readAsDataURL(P);
662
667
  });
663
668
  }
664
- }, w = () => {
665
- p || s((P) => {
666
- if (P === !1) {
667
- const g = a.current;
669
+ }, m = () => {
670
+ p || s((E) => {
671
+ if (E === !1) {
672
+ const u = a.current;
668
673
  R({
669
674
  unit: "px",
670
675
  // Can be 'px' or '%'
671
676
  x: 0,
672
677
  y: 0,
673
- width: g.width,
674
- height: g.height
678
+ width: u.width,
679
+ height: u.height
675
680
  });
676
681
  }
677
- return !P;
682
+ return !E;
678
683
  });
679
- }, j = L(null), N = L(null);
680
- q(() => {
681
- h && (j.current = h);
684
+ }, A = j(null), N = j(null);
685
+ J(() => {
686
+ h && (A.current = h);
682
687
  }, [h]);
683
- const S = (P) => {
684
- N.current && !N.current.contains(P.target) && s(!1);
688
+ const S = (E) => {
689
+ N.current && !N.current.contains(E.target) && s(!1);
685
690
  };
686
- return q(() => (document.addEventListener("mousedown", S), () => {
691
+ return J(() => (document.addEventListener("mousedown", S), () => {
687
692
  document.removeEventListener("mousedown", S);
688
693
  }), []), /* @__PURE__ */ b.jsxs("div", { ref: N, children: [
689
694
  i && /* @__PURE__ */ b.jsx(
@@ -691,7 +696,7 @@ function Se({
691
696
  {
692
697
  style: { zIndex: 999 },
693
698
  className: "image-caption-button",
694
- onClick: () => w(),
699
+ onClick: () => m(),
695
700
  children: "Crop"
696
701
  }
697
702
  ),
@@ -700,7 +705,7 @@ function Se({
700
705
  {
701
706
  style: { zIndex: 999 },
702
707
  className: "image-caption-button",
703
- onClick: () => H(),
708
+ onClick: () => k(),
704
709
  children: "Apply Crop"
705
710
  }
706
711
  ),
@@ -708,14 +713,14 @@ function Se({
708
713
  ze,
709
714
  {
710
715
  crop: c,
711
- onChange: (P) => R(P),
712
- onComplete: (P) => d(P),
716
+ onChange: (E) => R(E),
717
+ onComplete: (E) => d(E),
713
718
  children: /* @__PURE__ */ b.jsx(
714
719
  "img",
715
720
  {
716
721
  className: t || void 0,
717
722
  src: e,
718
- alt: u,
723
+ alt: g,
719
724
  ref: a,
720
725
  width: typeof o == "number" ? o : void 0,
721
726
  height: typeof n == "number" ? n : void 0,
@@ -736,7 +741,7 @@ function Se({
736
741
  {
737
742
  className: t || void 0,
738
743
  src: e,
739
- alt: u,
744
+ alt: g,
740
745
  ref: a,
741
746
  width: typeof o == "number" ? o : void 0,
742
747
  height: typeof n == "number" ? n : void 0,
@@ -753,7 +758,7 @@ function Se({
753
758
  ] });
754
759
  }
755
760
  function Le({
756
- src: u,
761
+ src: g,
757
762
  altText: t,
758
763
  nodeKey: e,
759
764
  width: o,
@@ -764,140 +769,140 @@ function Le({
764
769
  caption: s,
765
770
  enableCaptions: i
766
771
  }) {
767
- const l = L(null), h = L(null), [d, c, R] = de(e), [M, H] = G(!1), [w] = se(), [j, N] = G(null), [S, P] = G(!1), g = L(null), m = U((E) => d ? (E.preventDefault(), w.update(() => {
768
- const y = F(e);
769
- T(y) && y.remove();
770
- }), !0) : !1, [d, w, e]), f = U(
771
- (E) => {
772
- const y = Z(), z = h.current;
773
- if (d && V(y) && y.getNodes().length === 1) {
772
+ const l = j(null), h = j(null), [d, c, R] = de(e), [H, k] = V(!1), [m] = ae(), [A, N] = V(null), [S, E] = V(!1), u = j(null), f = F((M) => d ? (M.preventDefault(), m.update(() => {
773
+ const x = T(e);
774
+ G(x) && x.remove();
775
+ }), !0) : !1, [d, m, e]), w = F(
776
+ (M) => {
777
+ const x = ee(), z = h.current;
778
+ if (d && q(x) && x.getNodes().length === 1) {
774
779
  if (p)
775
- return te(null), E.preventDefault(), s.focus(), !0;
780
+ return ne(null), M.preventDefault(), s.focus(), !0;
776
781
  if (z !== null && z !== document.activeElement)
777
- return E.preventDefault(), z.focus(), !0;
782
+ return M.preventDefault(), z.focus(), !0;
778
783
  }
779
784
  return !1;
780
785
  },
781
786
  [s, d, p]
782
- ), $ = U(
783
- (E) => g.current === s || h.current === E.target ? (te(null), w.update(() => {
787
+ ), $ = F(
788
+ (M) => u.current === s || h.current === M.target ? (ne(null), m.update(() => {
784
789
  c(!0);
785
- const y = w.getRootElement();
786
- y !== null && y.focus();
790
+ const x = m.getRootElement();
791
+ x !== null && x.focus();
787
792
  }), !0) : !1,
788
- [s, w, c]
789
- ), k = U(
790
- (E) => {
791
- const y = E;
792
- return M ? !0 : y.target === l.current ? (y.shiftKey ? c(!d) : (R(), c(!0)), !0) : !1;
793
+ [s, m, c]
794
+ ), P = F(
795
+ (M) => {
796
+ const x = M;
797
+ return H ? !0 : x.target === l.current ? (x.shiftKey ? c(!d) : (R(), c(!0)), !0) : !1;
793
798
  },
794
- [M, d, c, R]
795
- ), x = U(
796
- (E) => {
797
- w.getEditorState().read(() => {
798
- const y = Z();
799
- E.target.tagName === "IMG" && le(y) && y.getNodes().length === 1 && w.dispatchCommand(
800
- oe,
801
- E
799
+ [H, d, c, R]
800
+ ), y = F(
801
+ (M) => {
802
+ m.getEditorState().read(() => {
803
+ const x = ee();
804
+ M.target.tagName === "IMG" && le(x) && x.getNodes().length === 1 && m.dispatchCommand(
805
+ se,
806
+ M
802
807
  );
803
808
  });
804
809
  },
805
- [w]
810
+ [m]
806
811
  );
807
- q(() => {
808
- const E = (z) => {
809
- (z.key === "Delete" || z.key === "Backspace") && d && (z.stopPropagation(), z.preventDefault(), w.update(() => {
810
- const I = F(e);
811
- T(I) && I.remove();
812
+ J(() => {
813
+ const M = (z) => {
814
+ (z.key === "Delete" || z.key === "Backspace") && d && (z.stopPropagation(), z.preventDefault(), m.update(() => {
815
+ const X = T(e);
816
+ G(X) && X.remove();
812
817
  }));
813
- }, y = w.getRootElement();
814
- return y == null || y.addEventListener("keydown", E), () => {
815
- y == null || y.removeEventListener("keydown", E);
818
+ }, x = m.getRootElement();
819
+ return x == null || x.addEventListener("keydown", M), () => {
820
+ x == null || x.removeEventListener("keydown", M);
816
821
  };
817
- }, [d, w, e]), q(() => {
818
- let E = !0;
819
- const y = w.getRootElement(), z = ue(
820
- w.registerUpdateListener(({ editorState: I }) => {
821
- E && N(I.read(() => Z()));
822
+ }, [d, m, e]), J(() => {
823
+ let M = !0;
824
+ const x = m.getRootElement(), z = ge(
825
+ m.registerUpdateListener(({ editorState: X }) => {
826
+ M && N(X.read(() => ee()));
822
827
  }),
823
- w.registerCommand(
824
- xe,
825
- (I, ce) => (g.current = ce, !1),
828
+ m.registerCommand(
829
+ ye,
830
+ (X, ce) => (u.current = ce, !1),
826
831
  B
827
832
  ),
828
- w.registerCommand(
829
- ye,
830
- k,
833
+ m.registerCommand(
834
+ xe,
835
+ P,
831
836
  B
832
837
  ),
833
- w.registerCommand(
834
- oe,
835
- k,
838
+ m.registerCommand(
839
+ se,
840
+ P,
836
841
  B
837
842
  ),
838
- w.registerCommand(
843
+ m.registerCommand(
839
844
  fe,
840
- (I) => I.target === l.current ? (I.preventDefault(), !0) : !1,
845
+ (X) => X.target === l.current ? (X.preventDefault(), !0) : !1,
841
846
  B
842
847
  ),
843
- w.registerCommand(
844
- me,
845
- m,
848
+ m.registerCommand(
849
+ we,
850
+ f,
846
851
  4
847
852
  ),
848
- w.registerCommand(
849
- we,
850
- m,
853
+ m.registerCommand(
854
+ me,
855
+ f,
851
856
  4
852
857
  ),
853
- w.registerCommand(pe, f, B),
854
- w.registerCommand(ge, $, B)
858
+ m.registerCommand(pe, w, B),
859
+ m.registerCommand(ue, $, B)
855
860
  );
856
- return y == null || y.addEventListener("contextmenu", x), () => {
857
- E = !1, z(), y == null || y.removeEventListener("contextmenu", x);
861
+ return x == null || x.addEventListener("contextmenu", y), () => {
862
+ M = !1, z(), x == null || x.removeEventListener("contextmenu", y);
858
863
  };
859
864
  }, [
860
865
  R,
861
- w,
862
- M,
866
+ m,
867
+ H,
863
868
  d,
864
869
  e,
865
870
  // onDelete,
866
- f,
871
+ w,
867
872
  $,
868
- k,
869
- x,
873
+ P,
874
+ y,
870
875
  c
871
876
  ]);
872
877
  const D = () => {
873
- w.update(() => {
874
- const E = F(e);
875
- T(E) && E.setShowCaption(!0);
878
+ m.update(() => {
879
+ const M = T(e);
880
+ G(M) && M.setShowCaption(!0);
876
881
  });
877
- }, A = (E, y) => {
882
+ }, _ = (M, x) => {
878
883
  setTimeout(() => {
879
- H(!1);
880
- }, 200), w.update(() => {
881
- const z = F(e);
882
- T(z) && z.setWidthAndHeight(E, y);
884
+ k(!1);
885
+ }, 200), m.update(() => {
886
+ const z = T(e);
887
+ G(z) && z.setWidthAndHeight(M, x);
883
888
  });
884
- }, ae = () => {
885
- S || H(!0);
886
- }, he = d && V(j) && !M, Q = d || M;
887
- return /* @__PURE__ */ b.jsx(Pe, { fallback: null, children: /* @__PURE__ */ b.jsxs(b.Fragment, { children: [
889
+ }, U = () => {
890
+ S || k(!0);
891
+ }, he = d && q(A) && !H, Z = d || H;
892
+ return /* @__PURE__ */ b.jsx(He, { fallback: null, children: /* @__PURE__ */ b.jsxs(b.Fragment, { children: [
888
893
  /* @__PURE__ */ b.jsx("div", { draggable: he, children: /* @__PURE__ */ b.jsx(
889
894
  Se,
890
895
  {
891
- className: Q ? `focused ${V(j) ? "draggable" : ""}` : null,
892
- src: u,
896
+ className: Z ? `focused ${q(A) ? "draggable" : ""}` : null,
897
+ src: g,
893
898
  altText: t,
894
899
  width: o,
895
900
  height: n,
896
901
  maxWidth: r,
897
902
  imageRef: l,
898
903
  startCrop: S,
899
- setStartCrop: P,
900
- isFocused: Q,
904
+ setStartCrop: E,
905
+ isFocused: Z,
901
906
  nodeKey: e
902
907
  }
903
908
  ) }),
@@ -909,18 +914,18 @@ function Le({
909
914
  ErrorBoundary: be
910
915
  }
911
916
  ) }) }),
912
- !S && a && V(j) && Q && /* @__PURE__ */ b.jsx(
913
- ke,
917
+ !S && a && q(A) && Z && /* @__PURE__ */ b.jsx(
918
+ Pe,
914
919
  {
915
920
  showCaption: p,
916
921
  setShowCaption: D,
917
- editor: w,
922
+ editor: m,
918
923
  buttonRef: h,
919
924
  maxWidth: r,
920
925
  onResizeStart: S ? () => {
921
- } : ae,
926
+ } : U,
922
927
  onResizeEnd: S ? () => {
923
- } : A,
928
+ } : _,
924
929
  enableCaptions: i,
925
930
  imageRef: l
926
931
  }
@@ -928,7 +933,7 @@ function Le({
928
933
  ] }) });
929
934
  }
930
935
  export {
931
- oe as RIGHT_CLICK_IMAGE_COMMAND,
936
+ se as RIGHT_CLICK_IMAGE_COMMAND,
932
937
  Le as default
933
938
  };
934
- //# sourceMappingURL=ImageComponent-5923c11d.js.map
939
+ //# sourceMappingURL=ImageComponent-462c3315.js.map