@orangelogic/design-system 2.222.0 → 2.223.0

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,80 +1,80 @@
1
- import { n as S, C as be } from "../chunks/lib-cortex-element.CVMmyPMC.js";
2
- import { c as ye } from "../chunks/component.styles.CRO4Odto.js";
3
- import { U as N } from "../chunks/asset-link-format.ClaYu_v8.js";
4
- import { c as Re } from "../chunks/custom-element.L4WJXn1j.js";
5
- import { i as _e, x as te } from "../chunks/lit-element.jLBm65_O.js";
6
- import { r as ve } from "../chunks/state.CSDxrqLd.js";
7
- import { e as De } from "../chunks/query.BBf1UFkC.js";
8
- import { n as ae } from "../chunks/when.Dr1es41R.js";
9
- import { r as w, j as f, w as Me, R as ke, a as ze } from "../chunks/jsx-runtime.CTpPVMxj.js";
10
- import { c as He, r as je, a as Se } from "../chunks/image.Y5c_hFx8.js";
11
- import { r as $e } from "../chunks/number.Cx2ncfJJ.js";
12
- import { d as se } from "../chunks/debounce.Bv1rtE8D.js";
13
- const Ie = _e`:host{--rc-drag-handle-size:12px;--rc-drag-handle-mobile-size:24px;--rc-drag-handle-bg-colour:#0003;--rc-drag-bar-size:6px;--rc-border-color:#ffffffb3;--rc-focus-color:#08f;width:100%;height:100%;display:block;position:relative}.cropper{justify-content:center;align-items:center;width:100%;height:100%;display:flex;position:relative;container-type:size}.loading-container{z-index:1000;background-color:#00000080;width:100%;height:100%;position:absolute;top:0;left:0}.loading-container .loading{width:100%;height:100%;position:absolute}.loading-container .loading__skeleton{--border-radius:0;width:100%;height:100%}.loading-container .loading__spinner{--track-width:.2rem;font-size:var(--cx-font-size-3x-large);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.cropper--portrait .cropper__image{max-width:100cqw;max-height:100cqh}.cropper__image{width:auto;max-width:100%;height:auto;max-height:100%;display:block}.cropper__image--loading{opacity:0}@keyframes marching-ants{0%{background-position:0 0,0 100%,0 0,100% 0}to{background-position:20px 0,-20px 100%,0 -20px,100% 20px}}.ReactCrop{cursor:crosshair;isolation:isolate;max-width:100%;display:inline-block;position:relative}.cropper--multiple .ReactCrop:before{content:"";z-index:-1;background:var(--cx-color-neutral-300);border-radius:2px;position:absolute;inset:0;transform:translate(-8px,-8px)}.ReactCrop *,.ReactCrop :before,.ReactCrop :after{box-sizing:border-box}.ReactCrop--disabled,.ReactCrop--loading,.ReactCrop--locked{cursor:inherit}.ReactCrop__child-wrapper{max-height:inherit;justify-content:center;align-items:center;width:100%;height:100%;display:flex;overflow:hidden}.ReactCrop__child-wrapper>img,.ReactCrop__child-wrapper>video{width:auto;max-width:100%;height:auto;max-height:100%;display:block}.ReactCrop:not(.ReactCrop--disabled):not(.ReactCrop--loading) .ReactCrop__child-wrapper>img,.ReactCrop:not(.ReactCrop--disabled):not(.ReactCrop--loading) .ReactCrop__child-wrapper>video,.ReactCrop:not(.ReactCrop--disabled):not(.ReactCrop--loading) .ReactCrop__crop-selection{touch-action:none}.ReactCrop__crop-mask{pointer-events:none;width:calc(100% + .5px);height:calc(100% + .5px);position:absolute;inset:0}.ReactCrop__crop-selection{cursor:move;position:absolute;top:0;left:0;transform:translateZ(0)}.ReactCrop--disabled .ReactCrop__crop-selection{cursor:inherit;display:none}.ReactCrop--circular-crop .ReactCrop__crop-selection{border-radius:50%}.ReactCrop--circular-crop .ReactCrop__crop-selection:after{pointer-events:none;content:"";border:1px solid var(--rc-border-color);opacity:.3;position:absolute;inset:-1px}.ReactCrop--no-animate .ReactCrop__crop-selection,.ReactCrop--loading .ReactCrop__crop-selection{outline:1px dashed #fff}.ReactCrop__crop-selection:not(.ReactCrop--no-animate .ReactCrop__crop-selection,.ReactCrop--loading .ReactCrop__crop-selection){color:#fff;background-image:linear-gradient(90deg,#fff 50%,#444 50%),linear-gradient(90deg,#fff 50%,#444 50%),linear-gradient(#fff 50%,#444 50%),linear-gradient(#fff 50%,#444 50%);background-position:0 0,0 100%,0 0,100% 0;background-repeat:repeat-x,repeat-x,repeat-y,repeat-y;background-size:10px 1px,10px 1px,1px 10px,1px 10px;animation:1s linear infinite marching-ants}.ReactCrop__crop-selection:focus{outline:2px solid var(--rc-focus-color);outline-offset:-1px}.ReactCrop--disabled .ReactCrop__crop-mask,.ReactCrop--invisible-crop .ReactCrop__crop-mask,.ReactCrop--invisible-crop .ReactCrop__crop-selection{display:none}.ReactCrop__rule-of-thirds-vt:before,.ReactCrop__rule-of-thirds-vt:after,.ReactCrop__rule-of-thirds-hz:before,.ReactCrop__rule-of-thirds-hz:after{content:"";background-color:#fff6;display:block;position:absolute}.ReactCrop__rule-of-thirds-vt:before,.ReactCrop__rule-of-thirds-vt:after{width:1px;height:100%}.ReactCrop__rule-of-thirds-vt:before{left:33.3333%}.ReactCrop__rule-of-thirds-vt:after{left:66.6667%}.ReactCrop__rule-of-thirds-hz:before,.ReactCrop__rule-of-thirds-hz:after{width:100%;height:1px}.ReactCrop__rule-of-thirds-hz:before{top:33.3333%}.ReactCrop__rule-of-thirds-hz:after{top:66.6667%}.ReactCrop__drag-handle{width:var(--rc-drag-handle-size);height:var(--rc-drag-handle-size);background-color:var(--rc-drag-handle-bg-colour);border:1px solid var(--rc-border-color);position:absolute}.ReactCrop__drag-handle:focus{background:var(--rc-focus-color)}.ReactCrop .ord-nw{cursor:nw-resize;top:0;left:0;transform:translate(-50%,-50%)}.ReactCrop .ord-n{cursor:n-resize;top:0;left:50%;transform:translate(-50%,-50%)}.ReactCrop .ord-ne{cursor:ne-resize;top:0;right:0;transform:translate(50%,-50%)}.ReactCrop .ord-e{cursor:e-resize;top:50%;right:0;transform:translate(50%,-50%)}.ReactCrop .ord-se{cursor:se-resize;bottom:0;right:0;transform:translate(50%,50%)}.ReactCrop .ord-s{cursor:s-resize;bottom:0;left:50%;transform:translate(-50%,50%)}.ReactCrop .ord-sw{cursor:sw-resize;bottom:0;left:0;transform:translate(-50%,50%)}.ReactCrop .ord-w{cursor:w-resize;top:50%;left:0;transform:translate(-50%,-50%)}.ReactCrop__disabled .ReactCrop__drag-handle{cursor:inherit}.ReactCrop__drag-bar{position:absolute}.ReactCrop__drag-bar.ord-n{width:100%;height:var(--rc-drag-bar-size);top:0;left:0;transform:translateY(-50%)}.ReactCrop__drag-bar.ord-e{width:var(--rc-drag-bar-size);height:100%;top:0;right:0;transform:translate(50%)}.ReactCrop__drag-bar.ord-s{width:100%;height:var(--rc-drag-bar-size);bottom:0;left:0;transform:translateY(50%)}.ReactCrop__drag-bar.ord-w{width:var(--rc-drag-bar-size);height:100%;top:0;left:0;transform:translate(-50%)}.ReactCrop--new-crop .ReactCrop__drag-bar,.ReactCrop--new-crop .ReactCrop__drag-handle,.ReactCrop--fixed-aspect .ReactCrop__drag-bar,.ReactCrop--fixed-aspect .ReactCrop__drag-handle.ord-n,.ReactCrop--fixed-aspect .ReactCrop__drag-handle.ord-e,.ReactCrop--fixed-aspect .ReactCrop__drag-handle.ord-s,.ReactCrop--fixed-aspect .ReactCrop__drag-handle.ord-w{display:none}@media (pointer:coarse){.ReactCrop .ord-n,.ReactCrop .ord-e,.ReactCrop .ord-s,.ReactCrop .ord-w{display:none}.ReactCrop__drag-handle{width:var(--rc-drag-handle-mobile-size);height:var(--rc-drag-handle-mobile-size)}}`, q = {
1
+ import { n as S, C as bt } from "../chunks/lib-cortex-element.CVMmyPMC.js";
2
+ import { c as yt } from "../chunks/component.styles.CRO4Odto.js";
3
+ import { U } from "../chunks/asset-link-format.ClaYu_v8.js";
4
+ import { c as Rt } from "../chunks/custom-element.L4WJXn1j.js";
5
+ import { i as vt, x as et } from "../chunks/lit-element.jLBm65_O.js";
6
+ import { r as _t } from "../chunks/state.CSDxrqLd.js";
7
+ import { e as Dt } from "../chunks/query.BBf1UFkC.js";
8
+ import { n as at } from "../chunks/when.Dr1es41R.js";
9
+ import { r as w, j as f, w as Mt, R as kt, a as zt } from "../chunks/jsx-runtime.CTpPVMxj.js";
10
+ import { c as Ht, r as jt, a as St } from "../chunks/image.Y5c_hFx8.js";
11
+ import { r as $t } from "../chunks/number.Cx2ncfJJ.js";
12
+ import { d as st } from "../chunks/debounce.Bv1rtE8D.js";
13
+ const It = vt`:host{--rc-drag-handle-size:12px;--rc-drag-handle-mobile-size:24px;--rc-drag-handle-bg-colour:#0003;--rc-drag-bar-size:6px;--rc-border-color:#ffffffb3;--rc-focus-color:#08f;width:100%;height:100%;display:block;position:relative}.cropper{justify-content:center;align-items:center;width:100%;height:100%;display:flex;position:relative;container-type:size}.loading-container{z-index:1000;background-color:#00000080;width:100%;height:100%;position:absolute;top:0;left:0}.loading-container .loading{width:100%;height:100%;position:absolute}.loading-container .loading__skeleton{--border-radius:0;width:100%;height:100%}.loading-container .loading__spinner{--track-width:.2rem;font-size:var(--cx-font-size-3x-large);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.cropper--portrait .cropper__image{max-width:100cqw;max-height:100cqh}.cropper__image{width:auto;max-width:100%;height:auto;max-height:100%;display:block}.cropper__image--loading{opacity:0}@keyframes marching-ants{0%{background-position:0 0,0 100%,0 0,100% 0}to{background-position:20px 0,-20px 100%,0 -20px,100% 20px}}.ReactCrop{cursor:crosshair;isolation:isolate;max-width:100%;display:inline-block;position:relative}.cropper--multiple .ReactCrop:before{content:"";z-index:-1;background:var(--cx-color-neutral-300);border-radius:2px;position:absolute;inset:0;transform:translate(-8px,-8px)}.ReactCrop *,.ReactCrop :before,.ReactCrop :after{box-sizing:border-box}.ReactCrop--disabled,.ReactCrop--loading,.ReactCrop--locked{cursor:inherit}.ReactCrop__child-wrapper{max-height:inherit;justify-content:center;align-items:center;width:100%;height:100%;display:flex;overflow:hidden}.ReactCrop__child-wrapper>img,.ReactCrop__child-wrapper>video{width:auto;max-width:100%;height:auto;max-height:100%;display:block}.ReactCrop:not(.ReactCrop--disabled):not(.ReactCrop--loading) .ReactCrop__child-wrapper>img,.ReactCrop:not(.ReactCrop--disabled):not(.ReactCrop--loading) .ReactCrop__child-wrapper>video,.ReactCrop:not(.ReactCrop--disabled):not(.ReactCrop--loading) .ReactCrop__crop-selection{touch-action:none}.ReactCrop__crop-mask{pointer-events:none;width:calc(100% + .5px);height:calc(100% + .5px);position:absolute;inset:0}.ReactCrop__crop-selection{cursor:move;position:absolute;top:0;left:0;transform:translateZ(0)}.ReactCrop--disabled .ReactCrop__crop-selection{cursor:inherit;display:none}.ReactCrop--circular-crop .ReactCrop__crop-selection{border-radius:50%}.ReactCrop--circular-crop .ReactCrop__crop-selection:after{pointer-events:none;content:"";border:1px solid var(--rc-border-color);opacity:.3;position:absolute;inset:-1px}.ReactCrop--no-animate .ReactCrop__crop-selection,.ReactCrop--loading .ReactCrop__crop-selection{outline:1px dashed #fff}.ReactCrop__crop-selection:not(.ReactCrop--no-animate .ReactCrop__crop-selection,.ReactCrop--loading .ReactCrop__crop-selection){color:#fff;background-image:linear-gradient(90deg,#fff 50%,#444 50%),linear-gradient(90deg,#fff 50%,#444 50%),linear-gradient(#fff 50%,#444 50%),linear-gradient(#fff 50%,#444 50%);background-position:0 0,0 100%,0 0,100% 0;background-repeat:repeat-x,repeat-x,repeat-y,repeat-y;background-size:10px 1px,10px 1px,1px 10px,1px 10px;animation:1s linear infinite marching-ants}.ReactCrop__crop-selection:focus{outline:2px solid var(--rc-focus-color);outline-offset:-1px}.ReactCrop--disabled .ReactCrop__crop-mask,.ReactCrop--invisible-crop .ReactCrop__crop-mask,.ReactCrop--invisible-crop .ReactCrop__crop-selection{display:none}.ReactCrop__rule-of-thirds-vt:before,.ReactCrop__rule-of-thirds-vt:after,.ReactCrop__rule-of-thirds-hz:before,.ReactCrop__rule-of-thirds-hz:after{content:"";background-color:#fff6;display:block;position:absolute}.ReactCrop__rule-of-thirds-vt:before,.ReactCrop__rule-of-thirds-vt:after{width:1px;height:100%}.ReactCrop__rule-of-thirds-vt:before{left:33.3333%}.ReactCrop__rule-of-thirds-vt:after{left:66.6667%}.ReactCrop__rule-of-thirds-hz:before,.ReactCrop__rule-of-thirds-hz:after{width:100%;height:1px}.ReactCrop__rule-of-thirds-hz:before{top:33.3333%}.ReactCrop__rule-of-thirds-hz:after{top:66.6667%}.ReactCrop__drag-handle{width:var(--rc-drag-handle-size);height:var(--rc-drag-handle-size);background-color:var(--rc-drag-handle-bg-colour);border:1px solid var(--rc-border-color);position:absolute}.ReactCrop__drag-handle:focus{background:var(--rc-focus-color)}.ReactCrop .ord-nw{cursor:nw-resize;top:0;left:0;transform:translate(-50%,-50%)}.ReactCrop .ord-n{cursor:n-resize;top:0;left:50%;transform:translate(-50%,-50%)}.ReactCrop .ord-ne{cursor:ne-resize;top:0;right:0;transform:translate(50%,-50%)}.ReactCrop .ord-e{cursor:e-resize;top:50%;right:0;transform:translate(50%,-50%)}.ReactCrop .ord-se{cursor:se-resize;bottom:0;right:0;transform:translate(50%,50%)}.ReactCrop .ord-s{cursor:s-resize;bottom:0;left:50%;transform:translate(-50%,50%)}.ReactCrop .ord-sw{cursor:sw-resize;bottom:0;left:0;transform:translate(-50%,50%)}.ReactCrop .ord-w{cursor:w-resize;top:50%;left:0;transform:translate(-50%,-50%)}.ReactCrop__disabled .ReactCrop__drag-handle{cursor:inherit}.ReactCrop__drag-bar{position:absolute}.ReactCrop__drag-bar.ord-n{width:100%;height:var(--rc-drag-bar-size);top:0;left:0;transform:translateY(-50%)}.ReactCrop__drag-bar.ord-e{width:var(--rc-drag-bar-size);height:100%;top:0;right:0;transform:translate(50%)}.ReactCrop__drag-bar.ord-s{width:100%;height:var(--rc-drag-bar-size);bottom:0;left:0;transform:translateY(50%)}.ReactCrop__drag-bar.ord-w{width:var(--rc-drag-bar-size);height:100%;top:0;left:0;transform:translate(-50%)}.ReactCrop--new-crop .ReactCrop__drag-bar,.ReactCrop--new-crop .ReactCrop__drag-handle,.ReactCrop--fixed-aspect .ReactCrop__drag-bar,.ReactCrop--fixed-aspect .ReactCrop__drag-handle.ord-n,.ReactCrop--fixed-aspect .ReactCrop__drag-handle.ord-e,.ReactCrop--fixed-aspect .ReactCrop__drag-handle.ord-s,.ReactCrop--fixed-aspect .ReactCrop__drag-handle.ord-w{display:none}@media (pointer:coarse){.ReactCrop .ord-n,.ReactCrop .ord-e,.ReactCrop .ord-s,.ReactCrop .ord-w{display:none}.ReactCrop__drag-handle{width:var(--rc-drag-handle-mobile-size);height:var(--rc-drag-handle-mobile-size)}}`, q = {
14
14
  height: 0,
15
15
  unit: "px",
16
16
  width: 0,
17
17
  x: 0,
18
18
  y: 0
19
- }, W = (h, e, t) => Math.min(Math.max(h, e), t), Pe = (...h) => h.filter((e) => e && typeof e == "string").join(" "), he = (h, e) => h === e || h.width === e.width && h.height === e.height && h.x === e.x && h.y === e.y && h.unit === e.unit;
20
- function Ye(h, e, t, r) {
21
- const i = j(h, t, r);
22
- return h.width && (i.height = i.width / e), h.height && (i.width = i.height * e), i.y + i.height > r && (i.height = r - i.y, i.width = i.height * e), i.x + i.width > t && (i.width = t - i.x, i.height = i.width / e), h.unit === "%" ? P(i, t, r) : i;
19
+ }, A = (s, t, e) => Math.min(Math.max(s, t), e), Pt = (...s) => s.filter((t) => t && typeof t == "string").join(" "), ht = (s, t) => s === t || s.width === t.width && s.height === t.height && s.x === t.x && s.y === t.y && s.unit === t.unit;
20
+ function Yt(s, t, e, r) {
21
+ const i = j(s, e, r);
22
+ return s.width && (i.height = i.width / t), s.height && (i.width = i.height * t), i.y + i.height > r && (i.height = r - i.y, i.width = i.height * t), i.x + i.width > e && (i.width = e - i.x, i.height = i.width / t), s.unit === "%" ? Y(i, e, r) : i;
23
23
  }
24
- function Le(h, e, t) {
25
- const r = j(h, e, t);
26
- return r.x = (e - r.width) / 2, r.y = (t - r.height) / 2, h.unit === "%" ? P(r, e, t) : r;
24
+ function Lt(s, t, e) {
25
+ const r = j(s, t, e);
26
+ return r.x = (t - r.width) / 2, r.y = (e - r.height) / 2, s.unit === "%" ? Y(r, t, e) : r;
27
27
  }
28
- function P(h, e, t) {
29
- return h.unit === "%" ? { ...q, ...h, unit: "%" } : {
30
- height: h.height ? h.height / t * 100 : 0,
28
+ function Y(s, t, e) {
29
+ return s.unit === "%" ? { ...q, ...s, unit: "%" } : {
30
+ height: s.height ? s.height / e * 100 : 0,
31
31
  unit: "%",
32
- width: h.width ? h.width / e * 100 : 0,
33
- x: h.x ? h.x / e * 100 : 0,
34
- y: h.y ? h.y / t * 100 : 0
32
+ width: s.width ? s.width / t * 100 : 0,
33
+ x: s.x ? s.x / t * 100 : 0,
34
+ y: s.y ? s.y / e * 100 : 0
35
35
  };
36
36
  }
37
- function j(h, e, t) {
38
- return h.unit ? h.unit === "px" ? { ...q, ...h, unit: "px" } : {
39
- height: h.height ? h.height * t / 100 : 0,
37
+ function j(s, t, e) {
38
+ return s.unit ? s.unit === "px" ? { ...q, ...s, unit: "px" } : {
39
+ height: s.height ? s.height * e / 100 : 0,
40
40
  unit: "px",
41
- width: h.width ? h.width * e / 100 : 0,
42
- x: h.x ? h.x * e / 100 : 0,
43
- y: h.y ? h.y * t / 100 : 0
44
- } : { ...q, ...h, unit: "px" };
41
+ width: s.width ? s.width * t / 100 : 0,
42
+ x: s.x ? s.x * t / 100 : 0,
43
+ y: s.y ? s.y * e / 100 : 0
44
+ } : { ...q, ...s, unit: "px" };
45
45
  }
46
- function ce(h, e, t, r, i, s = 0, a = 0, l = r, c = i) {
47
- const o = { ...h };
48
- let d = Math.min(s, r), p = Math.min(a, i), g = Math.min(l, r), u = Math.min(c, i);
49
- e && (e > 1 ? (d = a ? a * e : d, p = d / e, g = l * e) : (p = s ? s / e : p, d = p * e, u = c / e)), o.y < 0 && (o.height = Math.max(
46
+ function ct(s, t, e, r, i, h = 0, a = 0, l = r, c = i) {
47
+ const o = { ...s };
48
+ let d = Math.min(h, r), g = Math.min(a, i), u = Math.min(l, r), p = Math.min(c, i);
49
+ t && (t > 1 ? (d = a ? a * t : d, g = d / t, u = l * t) : (g = h ? h / t : g, d = g * t, p = c / t)), o.y < 0 && (o.height = Math.max(
50
50
  o.height + o.y,
51
- p
51
+ g
52
52
  ), o.y = 0), o.x < 0 && (o.width = Math.max(
53
53
  o.width + o.x,
54
54
  d
55
55
  ), o.x = 0);
56
56
  const n = r - (o.x + o.width);
57
57
  n < 0 && (o.x = Math.min(o.x, r - d), o.width += n);
58
- const x = i - (o.y + o.height);
59
- if (x < 0 && (o.y = Math.min(o.y, i - p), o.height += x), o.width < d && ((t === "sw" || t == "nw") && (o.x -= d - o.width), o.width = d), o.height < p && ((t === "nw" || t == "ne") && (o.y -= p - o.height), o.height = p), o.width > g && ((t === "sw" || t == "nw") && (o.x -= g - o.width), o.width = g), o.height > u && ((t === "nw" || t == "ne") && (o.y -= u - o.height), o.height = u), e) {
60
- const b = o.width / o.height;
61
- if (b < e) {
62
- const v = Math.max(o.width / e, p);
63
- (t === "nw" || t == "ne") && (o.y -= v - o.height), o.height = v;
64
- } else if (b > e) {
65
- const v = Math.max(o.height * e, d);
66
- (t === "sw" || t == "nw") && (o.x -= v - o.width), o.width = v;
58
+ const C = i - (o.y + o.height);
59
+ if (C < 0 && (o.y = Math.min(o.y, i - g), o.height += C), o.width < d && ((e === "sw" || e == "nw") && (o.x -= d - o.width), o.width = d), o.height < g && ((e === "nw" || e == "ne") && (o.y -= g - o.height), o.height = g), o.width > u && ((e === "sw" || e == "nw") && (o.x -= u - o.width), o.width = u), o.height > p && ((e === "nw" || e == "ne") && (o.y -= p - o.height), o.height = p), t) {
60
+ const x = o.width / o.height;
61
+ if (x < t) {
62
+ const _ = Math.max(o.width / t, g);
63
+ (e === "nw" || e == "ne") && (o.y -= _ - o.height), o.height = _;
64
+ } else if (x > t) {
65
+ const _ = Math.max(o.height * t, d);
66
+ (e === "sw" || e == "nw") && (o.x -= _ - o.width), o.width = _;
67
67
  }
68
68
  }
69
69
  return o;
70
70
  }
71
- function Xe(h, e, t, r) {
72
- const i = { ...h };
73
- return e === "ArrowLeft" ? r === "nw" ? (i.x -= t, i.y -= t, i.width += t, i.height += t) : r === "w" ? (i.x -= t, i.width += t) : r === "sw" ? (i.x -= t, i.width += t, i.height += t) : r === "ne" ? (i.y += t, i.width -= t, i.height -= t) : r === "e" ? i.width -= t : r === "se" && (i.width -= t, i.height -= t) : e === "ArrowRight" && (r === "nw" ? (i.x += t, i.y += t, i.width -= t, i.height -= t) : r === "w" ? (i.x += t, i.width -= t) : r === "sw" ? (i.x += t, i.width -= t, i.height -= t) : r === "ne" ? (i.y -= t, i.width += t, i.height += t) : r === "e" ? i.width += t : r === "se" && (i.width += t, i.height += t)), e === "ArrowUp" ? r === "nw" ? (i.x -= t, i.y -= t, i.width += t, i.height += t) : r === "n" ? (i.y -= t, i.height += t) : r === "ne" ? (i.y -= t, i.width += t, i.height += t) : r === "sw" ? (i.x += t, i.width -= t, i.height -= t) : r === "s" ? i.height -= t : r === "se" && (i.width -= t, i.height -= t) : e === "ArrowDown" && (r === "nw" ? (i.x += t, i.y += t, i.width -= t, i.height -= t) : r === "n" ? (i.y += t, i.height -= t) : r === "ne" ? (i.y += t, i.width -= t, i.height -= t) : r === "sw" ? (i.x -= t, i.width += t, i.height += t) : r === "s" ? i.height += t : r === "se" && (i.width += t, i.height += t)), i;
71
+ function Xt(s, t, e, r) {
72
+ const i = { ...s };
73
+ return t === "ArrowLeft" ? r === "nw" ? (i.x -= e, i.y -= e, i.width += e, i.height += e) : r === "w" ? (i.x -= e, i.width += e) : r === "sw" ? (i.x -= e, i.width += e, i.height += e) : r === "ne" ? (i.y += e, i.width -= e, i.height -= e) : r === "e" ? i.width -= e : r === "se" && (i.width -= e, i.height -= e) : t === "ArrowRight" && (r === "nw" ? (i.x += e, i.y += e, i.width -= e, i.height -= e) : r === "w" ? (i.x += e, i.width -= e) : r === "sw" ? (i.x += e, i.width -= e, i.height -= e) : r === "ne" ? (i.y -= e, i.width += e, i.height += e) : r === "e" ? i.width += e : r === "se" && (i.width += e, i.height += e)), t === "ArrowUp" ? r === "nw" ? (i.x -= e, i.y -= e, i.width += e, i.height += e) : r === "n" ? (i.y -= e, i.height += e) : r === "ne" ? (i.y -= e, i.width += e, i.height += e) : r === "sw" ? (i.x += e, i.width -= e, i.height -= e) : r === "s" ? i.height -= e : r === "se" && (i.width -= e, i.height -= e) : t === "ArrowDown" && (r === "nw" ? (i.x += e, i.y += e, i.width -= e, i.height -= e) : r === "n" ? (i.y += e, i.height -= e) : r === "ne" ? (i.y += e, i.width -= e, i.height -= e) : r === "sw" ? (i.x -= e, i.width += e, i.height += e) : r === "s" ? i.height += e : r === "se" && (i.width += e, i.height += e)), i;
74
74
  }
75
- const A = { capture: !0, passive: !1 };
76
- let Ee = 0;
77
- const _ = class _ extends w.PureComponent {
75
+ const K = { capture: !0, passive: !1 };
76
+ let Ot = 0;
77
+ const v = class v extends w.PureComponent {
78
78
  constructor() {
79
79
  super(...arguments), this.docMoveBound = !1, this.mouseDownOnCrop = !1, this.dragStarted = !1, this.evData = {
80
80
  clientX: 0,
@@ -86,46 +86,46 @@ const _ = class _ extends w.PureComponent {
86
86
  startCropWidth: 0,
87
87
  startCropX: 0,
88
88
  startCropY: 0
89
- }, this.componentRef = w.createRef(), this.mediaRef = w.createRef(), this.initChangeCalled = !1, this.instanceId = `rc-${Ee++}`, this.state = {
89
+ }, this.componentRef = w.createRef(), this.mediaRef = w.createRef(), this.initChangeCalled = !1, this.instanceId = `rc-${Ot++}`, this.state = {
90
90
  cropIsActive: !1,
91
91
  newCropIsBeingDrawn: !1
92
- }, this.onCropPointerDown = (e) => {
93
- const { crop: t, disabled: r, loading: i } = this.props, s = this.getBox();
94
- if (!t)
92
+ }, this.onCropPointerDown = (t) => {
93
+ const { crop: e, disabled: r, loading: i } = this.props, h = this.getBox();
94
+ if (!e)
95
95
  return;
96
- const a = j(t, s.width, s.height);
96
+ const a = j(e, h.width, h.height);
97
97
  if (r || i)
98
98
  return;
99
- e.cancelable && e.preventDefault(), this.bindDocMove(), this.componentRef.current.focus({
99
+ t.cancelable && t.preventDefault(), this.bindDocMove(), this.componentRef.current.focus({
100
100
  preventScroll: !0
101
101
  });
102
- const l = e.target.dataset.ord, c = !!l;
103
- let o = e.clientX, d = e.clientY, p = a.x, g = a.y;
102
+ const l = t.target.dataset.ord, c = !!l;
103
+ let o = t.clientX, d = t.clientY, g = a.x, u = a.y;
104
104
  if (l) {
105
- const u = e.clientX - s.x, n = e.clientY - s.y;
106
- let x = 0, b = 0;
107
- l === "ne" || l == "e" ? (x = u - (a.x + a.width), b = n - a.y, p = a.x, g = a.y + a.height) : l === "se" || l === "s" ? (x = u - (a.x + a.width), b = n - (a.y + a.height), p = a.x, g = a.y) : l === "sw" || l == "w" ? (x = u - a.x, b = n - (a.y + a.height), p = a.x + a.width, g = a.y) : (l === "nw" || l == "n") && (x = u - a.x, b = n - a.y, p = a.x + a.width, g = a.y + a.height), o = p + s.x + x, d = g + s.y + b;
105
+ const p = t.clientX - h.x, n = t.clientY - h.y;
106
+ let C = 0, x = 0;
107
+ l === "ne" || l == "e" ? (C = p - (a.x + a.width), x = n - a.y, g = a.x, u = a.y + a.height) : l === "se" || l === "s" ? (C = p - (a.x + a.width), x = n - (a.y + a.height), g = a.x, u = a.y) : l === "sw" || l == "w" ? (C = p - a.x, x = n - (a.y + a.height), g = a.x + a.width, u = a.y) : (l === "nw" || l == "n") && (C = p - a.x, x = n - a.y, g = a.x + a.width, u = a.y + a.height), o = g + h.x + C, d = u + h.y + x;
108
108
  }
109
109
  this.evData = {
110
- clientX: e.clientX,
111
- clientY: e.clientY,
110
+ clientX: t.clientX,
111
+ clientY: t.clientY,
112
112
  isResize: c,
113
113
  ord: l,
114
114
  startClientX: o,
115
115
  startClientY: d,
116
116
  startCropHeight: a.height,
117
117
  startCropWidth: a.width,
118
- startCropX: p,
119
- startCropY: g
118
+ startCropX: g,
119
+ startCropY: u
120
120
  }, this.mouseDownOnCrop = !0, this.setState({ cropIsActive: !0 });
121
- }, this.onComponentPointerDown = (e) => {
122
- const { crop: t, disabled: r, keepSelection: i, loading: s, locked: a, onChange: l } = this.props, c = this.getBox();
123
- if (r || a || s || i && t)
121
+ }, this.onComponentPointerDown = (t) => {
122
+ const { crop: e, disabled: r, keepSelection: i, loading: h, locked: a, onChange: l } = this.props, c = this.getBox();
123
+ if (r || a || h || i && e)
124
124
  return;
125
- e.cancelable && e.preventDefault(), this.bindDocMove(), this.componentRef.current.focus({
125
+ t.cancelable && t.preventDefault(), this.bindDocMove(), this.componentRef.current.focus({
126
126
  preventScroll: !0
127
127
  });
128
- const o = e.clientX - c.x, d = e.clientY - c.y, p = {
128
+ const o = t.clientX - c.x, d = t.clientY - c.y, g = {
129
129
  height: 0,
130
130
  unit: "px",
131
131
  width: 0,
@@ -133,88 +133,93 @@ const _ = class _ extends w.PureComponent {
133
133
  y: d
134
134
  };
135
135
  this.evData = {
136
- clientX: e.clientX,
137
- clientY: e.clientY,
136
+ clientX: t.clientX,
137
+ clientY: t.clientY,
138
138
  isResize: !0,
139
- startClientX: e.clientX,
140
- startClientY: e.clientY,
139
+ startClientX: t.clientX,
140
+ startClientY: t.clientY,
141
141
  startCropHeight: 0,
142
142
  startCropWidth: 0,
143
143
  startCropX: o,
144
144
  startCropY: d
145
145
  }, this.mouseDownOnCrop = !0, l(
146
- j(p, c.width, c.height),
147
- P(p, c.width, c.height)
146
+ j(g, c.width, c.height),
147
+ Y(g, c.width, c.height)
148
148
  ), this.setState({ cropIsActive: !0, newCropIsBeingDrawn: !0 });
149
- }, this.onDocPointerMove = (e) => {
150
- const { crop: t, disabled: r, loading: i, onChange: s, onDragStart: a } = this.props, l = this.getBox();
151
- if (r || i || !t || !this.mouseDownOnCrop)
149
+ }, this.onDocPointerMove = (t) => {
150
+ const { crop: e, disabled: r, loading: i, onChange: h, onDragStart: a } = this.props, l = this.getBox();
151
+ if (r || i || !e || !this.mouseDownOnCrop)
152
152
  return;
153
- e.cancelable && e.preventDefault(), this.dragStarted || (this.dragStarted = !0);
153
+ t.cancelable && t.preventDefault(), this.dragStarted || (this.dragStarted = !0);
154
154
  const { evData: c } = this;
155
- c.clientX = e.clientX, c.clientY = e.clientY;
155
+ c.clientX = t.clientX, c.clientY = t.clientY;
156
156
  let o;
157
- c.isResize ? o = this.resizeCrop() : (o = this.dragCrop(), a && a(e)), he(t, o) || s(
157
+ c.isResize ? o = this.resizeCrop() : (o = this.dragCrop(), a && a(t)), ht(e, o) || h(
158
158
  j(o, l.width, l.height),
159
- P(o, l.width, l.height)
159
+ Y(o, l.width, l.height)
160
160
  );
161
- }, this.onComponentKeyDown = (e) => {
162
- const { crop: t, disabled: r, loading: i, onChange: s, onComplete: a } = this.props;
161
+ }, this.onComponentKeyDown = (t) => {
162
+ const { crop: e, disabled: r, loading: i, onChange: h, onComplete: a } = this.props;
163
163
  if (r || i)
164
164
  return;
165
- const l = e.key;
165
+ const l = t.key;
166
166
  let c = !1;
167
- if (!t)
167
+ if (!e)
168
168
  return;
169
- const o = this.getBox(), d = this.makePixelCrop(o), g = (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey) ? _.nudgeStepLarge : e.shiftKey ? _.nudgeStepMedium : _.nudgeStep;
170
- if (l === "ArrowLeft" ? (d.x -= g, c = !0) : l === "ArrowRight" ? (d.x += g, c = !0) : l === "ArrowUp" ? (d.y -= g, c = !0) : l === "ArrowDown" && (d.y += g, c = !0), c) {
171
- e.cancelable && e.preventDefault(), d.x = W(d.x, 0, o.width - d.width), d.y = W(d.y, 0, o.height - d.height);
172
- const u = j(d, o.width, o.height), n = P(d, o.width, o.height);
173
- s(u, n), a && a(u, n);
169
+ const o = this.getBox(), d = this.makePixelCrop(o), u = (navigator.platform.match("Mac") ? t.metaKey : t.ctrlKey) ? v.nudgeStepLarge : t.shiftKey ? v.nudgeStepMedium : v.nudgeStep;
170
+ if (l === "ArrowLeft" ? (d.x -= u, c = !0) : l === "ArrowRight" ? (d.x += u, c = !0) : l === "ArrowUp" ? (d.y -= u, c = !0) : l === "ArrowDown" && (d.y += u, c = !0), c) {
171
+ t.cancelable && t.preventDefault(), d.x = A(d.x, 0, o.width - d.width), d.y = A(d.y, 0, o.height - d.height);
172
+ const p = j(d, o.width, o.height), n = Y(d, o.width, o.height);
173
+ h(p, n), a && a(p, n);
174
174
  }
175
- }, this.onHandlerKeyDown = (e, t) => {
175
+ }, this.onHandlerKeyDown = (t, e) => {
176
176
  const {
177
177
  aspect: r = 0,
178
178
  crop: i,
179
- disabled: s,
179
+ disabled: h,
180
180
  loading: a,
181
181
  maxHeight: l,
182
182
  maxWidth: c,
183
183
  minHeight: o = 0,
184
184
  minWidth: d = 0,
185
- onChange: p,
186
- onComplete: g
187
- } = this.props, u = this.getBox();
188
- if (s || a || !i)
185
+ onChange: g,
186
+ onComplete: u
187
+ } = this.props, p = this.getBox();
188
+ if (h || a || !i)
189
189
  return;
190
- if (e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "ArrowLeft" || e.key === "ArrowRight")
191
- e.stopPropagation(), e.preventDefault();
190
+ if (t.key === "ArrowUp" || t.key === "ArrowDown" || t.key === "ArrowLeft" || t.key === "ArrowRight")
191
+ t.stopPropagation(), t.preventDefault();
192
192
  else
193
193
  return;
194
- const x = (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey) ? _.nudgeStepLarge : e.shiftKey ? _.nudgeStepMedium : _.nudgeStep, b = j(i, u.width, u.height), v = Xe(b, e.key, x, t), C = ce(
195
- v,
194
+ const C = (navigator.platform.match("Mac") ? t.metaKey : t.ctrlKey) ? v.nudgeStepLarge : t.shiftKey ? v.nudgeStepMedium : v.nudgeStep, x = j(i, p.width, p.height), _ = Xt(x, t.key, C, e), [R, k] = this.resolveMinDimensions(
195
+ p,
196
196
  r,
197
- t,
198
- u.width,
199
- u.height,
200
197
  d,
201
- o,
198
+ o
199
+ ), $ = ct(
200
+ _,
201
+ r,
202
+ e,
203
+ p.width,
204
+ p.height,
205
+ R,
206
+ k,
202
207
  c,
203
208
  l
204
209
  );
205
- if (!he(i, C)) {
206
- const D = P(
207
- C,
208
- u.width,
209
- u.height
210
+ if (!ht(i, $)) {
211
+ const L = Y(
212
+ $,
213
+ p.width,
214
+ p.height
210
215
  );
211
- p(C, D), g && g(C, D);
216
+ g($, L), u && u($, L);
212
217
  }
213
- }, this.onDocPointerDone = (e) => {
214
- const { crop: t, disabled: r, loading: i, onComplete: s, onDragEnd: a } = this.props, l = this.getBox();
215
- this.unbindDocMove(), !(r || i || !t) && this.mouseDownOnCrop && (this.mouseDownOnCrop = !1, this.dragStarted = !1, a && a(e), s && s(
216
- j(t, l.width, l.height),
217
- P(t, l.width, l.height)
218
+ }, this.onDocPointerDone = (t) => {
219
+ const { crop: e, disabled: r, loading: i, onComplete: h, onDragEnd: a } = this.props, l = this.getBox();
220
+ this.unbindDocMove(), !(r || i || !e) && this.mouseDownOnCrop && (this.mouseDownOnCrop = !1, this.dragStarted = !1, a && a(t), h && h(
221
+ j(e, l.width, l.height),
222
+ Y(e, l.width, l.height)
218
223
  ), this.setState({ cropIsActive: !1, newCropIsBeingDrawn: !1 }));
219
224
  }, this.onDragFocus = () => {
220
225
  this.componentRef.current?.scrollTo(0, 0);
@@ -226,19 +231,19 @@ const _ = class _ extends w.PureComponent {
226
231
  // We unfortunately get the bounding box every time as x+y changes
227
232
  // due to scrolling.
228
233
  getBox() {
229
- const e = this.mediaRef.current;
230
- if (!e)
234
+ const t = this.mediaRef.current;
235
+ if (!t)
231
236
  return { height: 0, width: 0, x: 0, y: 0 };
232
- const { height: t, width: r, x: i, y: s } = e.getBoundingClientRect();
233
- return { height: t, width: r, x: i, y: s };
237
+ const { height: e, width: r, x: i, y: h } = t.getBoundingClientRect();
238
+ return { height: e, width: r, x: i, y: h };
234
239
  }
235
- componentDidUpdate(e) {
236
- const { crop: t, onComplete: r } = this.props;
237
- if (r && !e.crop && t) {
238
- const { height: i, width: s } = this.getBox();
239
- s && i && r(
240
- j(t, s, i),
241
- P(t, s, i)
240
+ componentDidUpdate(t) {
241
+ const { crop: e, onComplete: r } = this.props;
242
+ if (r && !t.crop && e) {
243
+ const { height: i, width: h } = this.getBox();
244
+ h && i && r(
245
+ j(e, h, i),
246
+ Y(e, h, i)
242
247
  );
243
248
  }
244
249
  }
@@ -249,82 +254,76 @@ const _ = class _ extends w.PureComponent {
249
254
  this.docMoveBound || (this.document.addEventListener(
250
255
  "pointermove",
251
256
  this.onDocPointerMove,
252
- A
257
+ K
253
258
  ), this.document.addEventListener(
254
259
  "pointerup",
255
260
  this.onDocPointerDone,
256
- A
261
+ K
257
262
  ), this.document.addEventListener(
258
263
  "pointercancel",
259
264
  this.onDocPointerDone,
260
- A
265
+ K
261
266
  ), this.docMoveBound = !0);
262
267
  }
263
268
  unbindDocMove() {
264
269
  this.docMoveBound && (this.document.removeEventListener(
265
270
  "pointermove",
266
271
  this.onDocPointerMove,
267
- A
272
+ K
268
273
  ), this.document.removeEventListener(
269
274
  "pointerup",
270
275
  this.onDocPointerDone,
271
- A
276
+ K
272
277
  ), this.document.removeEventListener(
273
278
  "pointercancel",
274
279
  this.onDocPointerDone,
275
- A
280
+ K
276
281
  ), this.docMoveBound = !1);
277
282
  }
278
283
  getCropStyle() {
279
- const { crop: e } = this.props;
280
- if (e)
284
+ const { crop: t } = this.props;
285
+ if (t)
281
286
  return {
282
- height: `${e.height}${e.unit}`,
283
- left: `${e.x}${e.unit}`,
284
- top: `${e.y}${e.unit}`,
285
- width: `${e.width}${e.unit}`
287
+ height: `${t.height}${t.unit}`,
288
+ left: `${t.x}${t.unit}`,
289
+ top: `${t.y}${t.unit}`,
290
+ width: `${t.width}${t.unit}`
286
291
  };
287
292
  }
288
293
  dragCrop() {
289
- const { evData: e } = this, t = this.getBox(), r = this.makePixelCrop(t), i = e.clientX - e.startClientX, s = e.clientY - e.startClientY;
290
- return r.x = W(
291
- e.startCropX + i,
294
+ const { evData: t } = this, e = this.getBox(), r = this.makePixelCrop(e), i = t.clientX - t.startClientX, h = t.clientY - t.startClientY;
295
+ return r.x = A(
296
+ t.startCropX + i,
292
297
  0,
293
- t.width - r.width
294
- ), r.y = W(
295
- e.startCropY + s,
298
+ e.width - r.width
299
+ ), r.y = A(
300
+ t.startCropY + h,
296
301
  0,
297
- t.height - r.height
302
+ e.height - r.height
298
303
  ), r;
299
304
  }
300
- getPointRegion(e, t, r, i) {
301
- const { evData: s } = this, a = s.clientX - e.x, l = s.clientY - e.y;
302
- let c;
303
- i && t ? c = t === "nw" || t === "n" || t === "ne" : c = l < s.startCropY;
304
- let o;
305
- return r && t ? o = t === "nw" || t === "w" || t === "sw" : o = a < s.startCropX, o ? c ? "nw" : "sw" : c ? "ne" : "se";
305
+ getPointRegion(t) {
306
+ const { evData: e } = this, r = e.clientX - t.x, h = e.clientY - t.y < e.startCropY;
307
+ return r < e.startCropX ? h ? "nw" : "sw" : h ? "ne" : "se";
306
308
  }
307
- resolveMinDimensions(e, t, r = 0, i = 0) {
308
- const s = Math.min(r, e.width), a = Math.min(i, e.height);
309
- return !t || !s && !a ? [s, a] : t > 1 ? s ? [s, s / t] : [a * t, a] : a ? [a * t, a] : [s, s / t];
309
+ resolveMinDimensions(t, e, r = 0, i = 0) {
310
+ const h = Math.min(r, t.width), a = Math.min(i, t.height);
311
+ return !e || !h && !a ? [h, a] : e > 1 ? h ? [h, h / e] : [a * e, a] : a ? [a * e, a] : [h, h / e];
310
312
  }
311
313
  resizeCrop() {
312
- const { evData: e } = this, {
313
- aspect: t = 0,
314
+ const { evData: t } = this, {
315
+ aspect: e = 0,
314
316
  centerCrop: r,
315
317
  maxHeight: i,
316
- maxWidth: s
318
+ maxWidth: h
317
319
  } = this.props, a = this.getBox(), [l, c] = this.resolveMinDimensions(
318
320
  a,
319
- t,
321
+ e,
320
322
  this.props.minWidth,
321
323
  this.props.minHeight
322
324
  );
323
325
  let o = this.makePixelCrop(a);
324
- const d = this.getPointRegion(a, e.ord, l, c), p = e.ord || d;
325
- let g = e.clientX - e.startClientX, u = e.clientY - e.startClientY;
326
- (l && p === "nw" || p === "w" || p === "sw") && (g = Math.min(g, -l)), (c && p === "nw" || p === "n" || p === "ne") && (u = Math.min(u, -c));
327
- const n = {
326
+ const d = this.getPointRegion(a), g = t.ord || d, u = t.clientX - t.startClientX, p = t.clientY - t.startClientY, n = {
328
327
  height: 0,
329
328
  unit: "px",
330
329
  width: 0,
@@ -332,56 +331,56 @@ const _ = class _ extends w.PureComponent {
332
331
  y: 0
333
332
  };
334
333
  if (r) {
335
- const b = a.width / 2, v = a.height / 2;
334
+ const x = a.width / 2, _ = a.height / 2;
336
335
  if (d === "ne") {
337
- const C = e.startCropWidth + (g - e.startCropWidth) * 2, D = e.startCropHeight - (e.startCropHeight + u) * 2;
338
- n.width = Math.min(Math.max(20, C), a.width), n.height = Math.min(Math.max(20, D), a.height), n.x = b - n.width / 2, n.y = v - n.height / 2;
336
+ const R = t.startCropWidth + (u - t.startCropWidth) * 2, k = t.startCropHeight - (t.startCropHeight + p) * 2;
337
+ n.width = Math.min(Math.max(20, R), a.width), n.height = Math.min(Math.max(20, k), a.height), n.x = x - n.width / 2, n.y = _ - n.height / 2;
339
338
  } else if (d === "se") {
340
- const C = e.startCropWidth + (g - e.startCropWidth) * 2, D = e.startCropHeight + (u - e.startCropHeight) * 2;
341
- n.width = Math.min(Math.max(20, C), a.width), n.height = Math.min(Math.max(20, D), a.height), n.x = b - n.width / 2, n.y = v - n.height / 2;
339
+ const R = t.startCropWidth + (u - t.startCropWidth) * 2, k = t.startCropHeight + (p - t.startCropHeight) * 2;
340
+ n.width = Math.min(Math.max(20, R), a.width), n.height = Math.min(Math.max(20, k), a.height), n.x = x - n.width / 2, n.y = _ - n.height / 2;
342
341
  } else if (d === "sw") {
343
- const C = e.startCropWidth - (e.startCropWidth + g) * 2, D = e.startCropHeight - (e.startCropHeight - u) * 2;
344
- n.width = Math.min(Math.max(20, C), a.width), n.height = Math.min(Math.max(20, D), a.height), n.x = b - n.width / 2, n.y = v - n.height / 2;
342
+ const R = t.startCropWidth - (t.startCropWidth + u) * 2, k = t.startCropHeight - (t.startCropHeight - p) * 2;
343
+ n.width = Math.min(Math.max(20, R), a.width), n.height = Math.min(Math.max(20, k), a.height), n.x = x - n.width / 2, n.y = _ - n.height / 2;
345
344
  } else if (d === "nw") {
346
- const C = e.startCropWidth - (e.startCropWidth + g) * 2, D = e.startCropHeight - (e.startCropHeight + u) * 2;
347
- n.width = Math.min(Math.max(20, C), a.width), n.height = Math.min(Math.max(20, D), a.height), n.x = b - n.width / 2, n.y = v - n.height / 2;
345
+ const R = t.startCropWidth - (t.startCropWidth + u) * 2, k = t.startCropHeight - (t.startCropHeight + p) * 2;
346
+ n.width = Math.min(Math.max(20, R), a.width), n.height = Math.min(Math.max(20, k), a.height), n.x = x - n.width / 2, n.y = _ - n.height / 2;
348
347
  }
349
- if (t && n.width && n.height) {
350
- const C = n.height * t, D = n.width / t;
351
- C <= n.width ? n.width = C : n.height = D, n.x = b - n.width / 2, n.y = v - n.height / 2;
348
+ if (e && n.width && n.height) {
349
+ const R = n.height * e, k = n.width / e;
350
+ R <= n.width ? n.width = R : n.height = k, n.x = x - n.width / 2, n.y = _ - n.height / 2;
352
351
  }
353
352
  } else
354
- d === "ne" ? (n.x = e.startCropX, n.width = g, t ? (n.height = n.width / t, n.y = e.startCropY - n.height) : (n.height = Math.abs(u), n.y = e.startCropY - n.height)) : d === "se" ? (n.x = e.startCropX, n.y = e.startCropY, n.width = g, t ? n.height = n.width / t : n.height = u) : d === "sw" ? (n.x = e.startCropX + g, n.y = e.startCropY, n.width = Math.abs(g), t ? n.height = n.width / t : n.height = u) : d === "nw" && (n.x = e.startCropX + g, n.width = Math.abs(g), t ? (n.height = n.width / t, n.y = e.startCropY - n.height) : (n.height = Math.abs(u), n.y = e.startCropY + u));
355
- const x = ce(
353
+ d === "ne" ? (n.x = t.startCropX, n.width = u, e ? (n.height = n.width / e, n.y = t.startCropY - n.height) : (n.height = Math.abs(p), n.y = t.startCropY - n.height)) : d === "se" ? (n.x = t.startCropX, n.y = t.startCropY, n.width = u, e ? n.height = n.width / e : n.height = p) : d === "sw" ? (n.x = t.startCropX + u, n.y = t.startCropY, n.width = Math.abs(u), e ? n.height = n.width / e : n.height = p) : d === "nw" && (n.x = t.startCropX + u, n.width = Math.abs(u), e ? (n.height = n.width / e, n.y = t.startCropY - n.height) : (n.height = Math.abs(p), n.y = t.startCropY + p));
354
+ const C = ct(
356
355
  n,
357
- t,
356
+ e,
358
357
  d,
359
358
  a.width,
360
359
  a.height,
361
360
  l,
362
361
  c,
363
- s,
362
+ h,
364
363
  i
365
364
  );
366
- return t || _.xyOrds.indexOf(p) > -1 ? o = x : _.xOrds.indexOf(p) > -1 ? (o.x = x.x, o.width = x.width) : _.yOrds.indexOf(p) > -1 && (o.y = x.y, o.height = x.height), o.x = W(o.x, 0, a.width - o.width), o.y = W(o.y, 0, a.height - o.height), o;
365
+ return e || v.xyOrds.indexOf(g) > -1 ? o = C : v.xOrds.indexOf(g) > -1 ? (o.x = C.x, o.width = C.width) : v.yOrds.indexOf(g) > -1 && (o.y = C.y, o.height = C.height), o.x = A(o.x, 0, a.width - o.width), o.y = A(o.y, 0, a.height - o.height), o;
367
366
  }
368
367
  renderCropSelection() {
369
368
  const {
370
- ariaLabels: e = _.defaultProps.ariaLabels,
371
- crop: t,
369
+ ariaLabels: t = v.defaultProps.ariaLabels,
370
+ crop: e,
372
371
  disabled: r,
373
372
  locked: i,
374
- renderSelectionAddon: s,
373
+ renderSelectionAddon: h,
375
374
  ruleOfThirds: a
376
375
  } = this.props, l = this.getCropStyle();
377
- if (t)
376
+ if (e)
378
377
  return /* @__PURE__ */ f.jsxs(
379
378
  "div",
380
379
  {
381
380
  style: l,
382
381
  className: "ReactCrop__crop-selection",
383
382
  onPointerDown: this.onCropPointerDown,
384
- "aria-label": e.cropArea,
383
+ "aria-label": t.cropArea,
385
384
  tabIndex: 0,
386
385
  onKeyDown: this.onComponentKeyDown,
387
386
  role: "group",
@@ -397,7 +396,7 @@ const _ = class _ extends w.PureComponent {
397
396
  className: "ReactCrop__drag-handle ord-nw",
398
397
  "data-ord": "nw",
399
398
  tabIndex: 0,
400
- "aria-label": e.nwDragHandle,
399
+ "aria-label": t.nwDragHandle,
401
400
  onKeyDown: (c) => this.onHandlerKeyDown(c, "nw"),
402
401
  role: "button"
403
402
  }
@@ -408,7 +407,7 @@ const _ = class _ extends w.PureComponent {
408
407
  className: "ReactCrop__drag-handle ord-n",
409
408
  "data-ord": "n",
410
409
  tabIndex: 0,
411
- "aria-label": e.nDragHandle,
410
+ "aria-label": t.nDragHandle,
412
411
  onKeyDown: (c) => this.onHandlerKeyDown(c, "n"),
413
412
  role: "button"
414
413
  }
@@ -419,7 +418,7 @@ const _ = class _ extends w.PureComponent {
419
418
  className: "ReactCrop__drag-handle ord-ne",
420
419
  "data-ord": "ne",
421
420
  tabIndex: 0,
422
- "aria-label": e.neDragHandle,
421
+ "aria-label": t.neDragHandle,
423
422
  onKeyDown: (c) => this.onHandlerKeyDown(c, "ne"),
424
423
  role: "button"
425
424
  }
@@ -430,7 +429,7 @@ const _ = class _ extends w.PureComponent {
430
429
  className: "ReactCrop__drag-handle ord-e",
431
430
  "data-ord": "e",
432
431
  tabIndex: 0,
433
- "aria-label": e.eDragHandle,
432
+ "aria-label": t.eDragHandle,
434
433
  onKeyDown: (c) => this.onHandlerKeyDown(c, "e"),
435
434
  role: "button"
436
435
  }
@@ -441,7 +440,7 @@ const _ = class _ extends w.PureComponent {
441
440
  className: "ReactCrop__drag-handle ord-se",
442
441
  "data-ord": "se",
443
442
  tabIndex: 0,
444
- "aria-label": e.seDragHandle,
443
+ "aria-label": t.seDragHandle,
445
444
  onKeyDown: (c) => this.onHandlerKeyDown(c, "se"),
446
445
  role: "button"
447
446
  }
@@ -452,7 +451,7 @@ const _ = class _ extends w.PureComponent {
452
451
  className: "ReactCrop__drag-handle ord-s",
453
452
  "data-ord": "s",
454
453
  tabIndex: 0,
455
- "aria-label": e.sDragHandle,
454
+ "aria-label": t.sDragHandle,
456
455
  onKeyDown: (c) => this.onHandlerKeyDown(c, "s"),
457
456
  role: "button"
458
457
  }
@@ -463,7 +462,7 @@ const _ = class _ extends w.PureComponent {
463
462
  className: "ReactCrop__drag-handle ord-sw",
464
463
  "data-ord": "sw",
465
464
  tabIndex: 0,
466
- "aria-label": e.swDragHandle,
465
+ "aria-label": t.swDragHandle,
467
466
  onKeyDown: (c) => this.onHandlerKeyDown(c, "sw"),
468
467
  role: "button"
469
468
  }
@@ -474,18 +473,18 @@ const _ = class _ extends w.PureComponent {
474
473
  className: "ReactCrop__drag-handle ord-w",
475
474
  "data-ord": "w",
476
475
  tabIndex: 0,
477
- "aria-label": e.wDragHandle,
476
+ "aria-label": t.wDragHandle,
478
477
  onKeyDown: (c) => this.onHandlerKeyDown(c, "w"),
479
478
  role: "button"
480
479
  }
481
480
  )
482
481
  ] }),
483
- s && /* @__PURE__ */ f.jsx(
482
+ h && /* @__PURE__ */ f.jsx(
484
483
  "div",
485
484
  {
486
485
  className: "ReactCrop__selection-addon",
487
486
  onPointerDown: (c) => c.stopPropagation(),
488
- children: s(this.state)
487
+ children: h(this.state)
489
488
  }
490
489
  ),
491
490
  a && /* @__PURE__ */ f.jsxs(f.Fragment, { children: [
@@ -496,61 +495,61 @@ const _ = class _ extends w.PureComponent {
496
495
  }
497
496
  );
498
497
  }
499
- makePixelCrop(e) {
500
- const t = { ...q, ...this.props.crop || {} };
501
- return j(t, e.width, e.height);
498
+ makePixelCrop(t) {
499
+ const e = { ...q, ...this.props.crop || {} };
500
+ return j(e, t.width, t.height);
502
501
  }
503
502
  render() {
504
503
  const {
505
- aspect: e,
506
- children: t,
504
+ aspect: t,
505
+ children: e,
507
506
  circularCrop: r,
508
507
  className: i,
509
- crop: s,
508
+ crop: h,
510
509
  disabled: a,
511
510
  loading: l,
512
511
  locked: c,
513
512
  ruleOfThirds: o,
514
513
  style: d
515
- } = this.props, { cropIsActive: p, newCropIsBeingDrawn: g } = this.state, u = s ? this.renderCropSelection() : null, n = Pe(
514
+ } = this.props, { cropIsActive: g, newCropIsBeingDrawn: u } = this.state, p = h ? this.renderCropSelection() : null, n = Pt(
516
515
  "ReactCrop",
517
516
  i,
518
- p && "ReactCrop--active",
517
+ g && "ReactCrop--active",
519
518
  a && "ReactCrop--disabled",
520
519
  c && "ReactCrop--locked",
521
- g && "ReactCrop--new-crop",
522
- s && e && "ReactCrop--fixed-aspect",
523
- s && r && "ReactCrop--circular-crop",
524
- s && o && "ReactCrop--rule-of-thirds",
525
- !this.dragStarted && s && !s.width && !s.height && "ReactCrop--invisible-crop",
520
+ u && "ReactCrop--new-crop",
521
+ h && t && "ReactCrop--fixed-aspect",
522
+ h && r && "ReactCrop--circular-crop",
523
+ h && o && "ReactCrop--rule-of-thirds",
524
+ !this.dragStarted && h && !h.width && !h.height && "ReactCrop--invisible-crop",
526
525
  r && "ReactCrop--no-animate",
527
526
  l && "ReactCrop--loading"
528
527
  );
529
- let x;
530
- if (s) {
531
- let b = /* @__PURE__ */ f.jsx(
528
+ let C;
529
+ if (h) {
530
+ let x = /* @__PURE__ */ f.jsx(
532
531
  "rect",
533
532
  {
534
- x: `${s.x}${s.unit}`,
535
- y: `${s.y}${s.unit}`,
536
- width: `${s.width}${s.unit}`,
537
- height: `${s.height}${s.unit}`,
533
+ x: `${h.x}${h.unit}`,
534
+ y: `${h.y}${h.unit}`,
535
+ width: `${h.width}${h.unit}`,
536
+ height: `${h.height}${h.unit}`,
538
537
  fill: "black"
539
538
  }
540
539
  );
541
- r && (b = /* @__PURE__ */ f.jsx(
540
+ r && (x = /* @__PURE__ */ f.jsx(
542
541
  "ellipse",
543
542
  {
544
- cx: `${s.x + s.width / 2}${s.unit}`,
545
- cy: `${s.y + s.height / 2}${s.unit}`,
546
- rx: `${s.width / 2}${s.unit}`,
547
- ry: `${s.height / 2}${s.unit}`,
543
+ cx: `${h.x + h.width / 2}${h.unit}`,
544
+ cy: `${h.y + h.height / 2}${h.unit}`,
545
+ rx: `${h.width / 2}${h.unit}`,
546
+ ry: `${h.height / 2}${h.unit}`,
548
547
  fill: "black"
549
548
  }
550
- )), x = /* @__PURE__ */ f.jsxs("svg", { className: "ReactCrop__crop-mask", width: "100%", height: "100%", children: [
549
+ )), C = /* @__PURE__ */ f.jsxs("svg", { className: "ReactCrop__crop-mask", width: "100%", height: "100%", children: [
551
550
  /* @__PURE__ */ f.jsx("defs", { children: /* @__PURE__ */ f.jsxs("mask", { id: `hole-${this.instanceId}`, children: [
552
551
  /* @__PURE__ */ f.jsx("rect", { width: "100%", height: "100%", fill: "white" }),
553
- b
552
+ x
554
553
  ] }) }),
555
554
  /* @__PURE__ */ f.jsx(
556
555
  "rect",
@@ -571,15 +570,15 @@ const _ = class _ extends w.PureComponent {
571
570
  ref: this.mediaRef,
572
571
  className: "ReactCrop__child-wrapper",
573
572
  onPointerDown: this.onComponentPointerDown,
574
- children: t
573
+ children: e
575
574
  }
576
575
  ),
577
- x,
578
- u
576
+ C,
577
+ p
579
578
  ] });
580
579
  }
581
580
  };
582
- _.xOrds = ["e", "w"], _.yOrds = ["n", "s"], _.xyOrds = ["nw", "ne", "se", "sw"], _.nudgeStep = 1, _.nudgeStepMedium = 10, _.nudgeStepLarge = 100, _.defaultProps = {
581
+ v.xOrds = ["e", "w"], v.yOrds = ["n", "s"], v.xyOrds = ["nw", "ne", "se", "sw"], v.nudgeStep = 1, v.nudgeStepMedium = 10, v.nudgeStepLarge = 100, v.defaultProps = {
583
582
  ariaLabels: {
584
583
  cropArea: "Use the arrow keys to move the crop selection area",
585
584
  eDragHandle: "Use the up and down arrow keys to move the east drag handle to change the crop selection area",
@@ -592,215 +591,215 @@ _.xOrds = ["e", "w"], _.yOrds = ["n", "s"], _.xyOrds = ["nw", "ne", "se", "sw"],
592
591
  wDragHandle: "Use the up and down arrow keys to move the west drag handle to change the crop selection area"
593
592
  }
594
593
  };
595
- let ie = _;
596
- function le(h, e, t, r = 100) {
597
- return Le(
598
- Ye(
594
+ let it = v;
595
+ function lt(s, t, e, r = 100) {
596
+ return Lt(
597
+ Yt(
599
598
  {
600
599
  unit: "%",
601
600
  width: r
602
601
  },
603
- t,
604
- h,
605
- e
602
+ e,
603
+ s,
604
+ t
606
605
  ),
607
- h,
608
- e
606
+ s,
607
+ t
609
608
  );
610
609
  }
611
- const We = w.forwardRef(
610
+ const Et = w.forwardRef(
612
611
  ({
613
- cropper: h,
614
- disabled: e,
615
- fillImage: t,
612
+ cropper: s,
613
+ disabled: t,
614
+ fillImage: e,
616
615
  image: r,
617
616
  loadable: i,
618
- loading: s,
617
+ loading: h,
619
618
  multiple: a,
620
619
  resizer: l,
621
620
  rotation: c,
622
621
  useInternalLoading: o
623
622
  }, d) => {
624
- const [p, g] = w.useState(!1), [u, n] = w.useState(e), [x, b] = w.useState(!1), [v, C] = w.useState({
623
+ const [g, u] = w.useState(!1), [p, n] = w.useState(t), [C, x] = w.useState(!1), [_, R] = w.useState({
625
624
  height: 0,
626
- unit: N.AspectRatio,
625
+ unit: U.AspectRatio,
627
626
  width: 0,
628
627
  x: 0,
629
628
  y: 0
630
- }), [D, B] = w.useState(r?.url ?? ""), [U, V] = w.useState({
629
+ }), [k, $] = w.useState(r?.url ?? ""), [L, V] = w.useState({
631
630
  height: 0,
632
631
  width: 0
633
- }), [de, pe] = w.useState({
632
+ }), [dt, pt] = w.useState({
634
633
  height: r?.height ?? 0,
635
634
  width: r?.width ?? 0
636
- }), M = w.useRef(null), T = w.useRef(r?.url ?? ""), Z = w.useRef(null), G = w.useRef({
635
+ }), D = w.useRef(null), T = w.useRef(r?.url ?? ""), Z = w.useRef(null), G = w.useRef({
637
636
  height: r?.height ?? 0,
638
637
  width: r?.width ?? 0
639
- }), $ = w.useRef(null);
640
- G.current = { ...de };
641
- const O = w.useCallback(() => {
642
- $.current && clearTimeout($.current), $.current = setTimeout(() => {
643
- $.current = null, g(!0);
638
+ }), I = w.useRef(null);
639
+ G.current = { ...dt };
640
+ const N = w.useCallback(() => {
641
+ I.current && clearTimeout(I.current), I.current = setTimeout(() => {
642
+ I.current = null, u(!0);
644
643
  }, 1e3);
645
- }, []), L = w.useCallback(() => {
646
- $.current ? (clearTimeout($.current), $.current = null) : g(!1);
644
+ }, []), O = w.useCallback(() => {
645
+ I.current ? (clearTimeout(I.current), I.current = null) : u(!1);
647
646
  }, []);
648
647
  w.useEffect(() => () => {
649
- $.current && clearTimeout($.current);
648
+ I.current && clearTimeout(I.current);
650
649
  }, []);
651
- const R = w.useMemo(() => r, [r.url, r.width, r.height, r.rotation, r.extension, r.x, r.y]), I = w.useMemo(() => l, [l.width, l.height, l.maxWidth, l.maxHeight]), J = w.useCallback(() => {
652
- if (!M.current)
650
+ const y = w.useMemo(() => r, [r.url, r.width, r.height, r.rotation, r.extension, r.x, r.y]), P = w.useMemo(() => l, [l.width, l.height, l.maxWidth, l.maxHeight]), J = w.useCallback(() => {
651
+ if (!D.current)
653
652
  return { maxHeight: 0, maxWidth: 0 };
654
- let m = 0, y = 0;
655
- const H = R.width / R.height, X = M.current.clientWidth / M.current.clientHeight;
656
- return H > X ? (m = M.current.clientWidth, y = m / H) : (y = M.current.clientHeight, m = y * H), { maxHeight: y, maxWidth: m };
657
- }, [R.width, R.height]);
653
+ let m = 0, b = 0;
654
+ const H = y.width / y.height, E = D.current.clientWidth / D.current.clientHeight;
655
+ return H > E ? (m = D.current.clientWidth, b = m / H) : (b = D.current.clientHeight, m = b * H), { maxHeight: b, maxWidth: m };
656
+ }, [y.width, y.height]);
658
657
  w.useEffect(() => {
659
- C({
660
- height: h.percentageHeight,
661
- unit: N.AspectRatio,
662
- width: h.percentageWidth,
663
- x: h.x,
664
- y: h.y
658
+ R({
659
+ height: s.percentageHeight,
660
+ unit: U.AspectRatio,
661
+ width: s.percentageWidth,
662
+ x: s.x,
663
+ y: s.y
665
664
  });
666
- }, [h]), w.useEffect(() => {
667
- const { height: m, width: y } = I, H = (Y, K) => e ? I.width !== G.current.width || I.height !== G.current.height : y < Y || m < K, E = se(async () => {
665
+ }, [s]), w.useEffect(() => {
666
+ const { height: m, width: b } = P, H = (X, B) => t ? P.width !== G.current.width || P.height !== G.current.height : b < X || m < B, W = st(async () => {
668
667
  if (c !== 0)
669
668
  return;
670
- const { maxHeight: Y, maxWidth: K } = J(), fe = H(K, Y);
671
- if (!i || !fe && T.current) {
672
- B(R.url), n(e), L();
669
+ const { maxHeight: X, maxWidth: B } = J(), ft = H(B, X);
670
+ if (!i || !ft && T.current) {
671
+ $(y.url), n(t), O();
673
672
  return;
674
673
  }
675
- const ne = T.current !== R.url;
676
- ne && O();
677
- const F = e && !t, { height: me, width: Ce } = He(R.width, R.height, y, m), { url: xe } = await je(
678
- R.url,
679
- F && I.width || K,
680
- F && I.height || Y,
681
- M.current?.clientWidth ?? window.innerWidth,
682
- M.current?.clientHeight ?? window.innerHeight
674
+ const nt = T.current !== y.url;
675
+ nt && N();
676
+ const F = t && !e, { height: mt, width: Ct } = Ht(y.width, y.height, b, m), { url: xt } = await jt(
677
+ y.url,
678
+ F && P.width || B,
679
+ F && P.height || X,
680
+ D.current?.clientWidth ?? window.innerWidth,
681
+ D.current?.clientHeight ?? window.innerHeight
683
682
  );
684
- B(xe), V({
685
- height: F ? I.height : me,
686
- width: F ? I.width : Ce
687
- }), n(e), ne || L(), T.current = R.url;
683
+ $(xt), V({
684
+ height: F ? P.height : mt,
685
+ width: F ? P.width : Ct
686
+ }), n(t), nt || O(), T.current = y.url;
688
687
  }, 300, { leading: !1 });
689
- return E(), () => E.cancel();
690
- }, [e, R, i, J, I, c, t, O, L, n]), w.useEffect(() => {
691
- const y = se(async () => {
688
+ return W(), () => W.cancel();
689
+ }, [t, y, i, J, P, c, e, N, O, n]), w.useEffect(() => {
690
+ const b = st(async () => {
692
691
  if (i && c !== 0) {
693
- O();
694
- const { height: X, width: E } = $e(
695
- R.width,
696
- R.height,
692
+ N();
693
+ const { height: E, width: W } = $t(
694
+ y.width,
695
+ y.height,
697
696
  c
698
- ), Y = await Se(
697
+ ), X = await St(
699
698
  {
700
- height: R.height,
701
- url: R.url,
702
- width: R.width
699
+ height: y.height,
700
+ url: y.url,
701
+ width: y.width
703
702
  },
704
703
  c
705
704
  );
706
- B(Y), V({
707
- height: X,
708
- width: E
709
- }), n(e), T.current = R.url;
705
+ $(X), V({
706
+ height: E,
707
+ width: W
708
+ }), n(t), T.current = y.url;
710
709
  } else
711
- i ? O() : B(R.url);
710
+ i ? N() : $(y.url);
712
711
  }, 300, { leading: !1 });
713
- return y(), () => y.cancel();
714
- }, [R, i, c, e, J, O, L]);
715
- const re = w.useCallback(() => {
716
- C({
712
+ return b(), () => b.cancel();
713
+ }, [y, i, c, t, J, N, O]);
714
+ const rt = w.useCallback(() => {
715
+ R({
717
716
  height: 100,
718
717
  unit: "%",
719
718
  width: 100,
720
719
  x: 0,
721
720
  y: 0
722
721
  });
723
- }, []), ge = w.useCallback(
724
- (m, y) => {
725
- e || C(y);
722
+ }, []), gt = w.useCallback(
723
+ (m, b) => {
724
+ t || R(b);
726
725
  },
727
- [e]
728
- ), oe = w.useCallback(
726
+ [t]
727
+ ), ot = w.useCallback(
729
728
  (m) => {
730
729
  if (!Z.current)
731
730
  return;
732
- const { naturalHeight: y, naturalWidth: H } = m.currentTarget;
733
- if (pe({
734
- height: y,
731
+ const { naturalHeight: b, naturalWidth: H } = m.currentTarget;
732
+ if (pt({
733
+ height: b,
735
734
  width: H
736
735
  }), V({
737
- height: y,
736
+ height: b,
738
737
  width: H
739
- }), h.unit === N.AspectRatio) {
740
- const { height: X, width: E } = m.currentTarget;
741
- C(
742
- le(E, X, h.width / h.height)
738
+ }), s.unit === U.AspectRatio) {
739
+ const { height: E, width: W } = m.currentTarget;
740
+ R(
741
+ lt(W, E, s.width / s.height)
743
742
  );
744
743
  } else
745
- C({
744
+ R({
746
745
  height: 100,
747
746
  unit: "%",
748
747
  width: 100,
749
748
  x: 0,
750
749
  y: 0
751
750
  });
752
- L();
751
+ O();
753
752
  },
754
- [h.height, h.unit, h.width, L]
753
+ [s.height, s.unit, s.width, O]
755
754
  );
756
755
  w.useEffect(() => {
757
- re();
758
- }, [e, re]), w.useEffect(() => {
759
- if (!M.current || !i)
756
+ rt();
757
+ }, [t, rt]), w.useEffect(() => {
758
+ if (!D.current || !i)
760
759
  return;
761
760
  const m = new CustomEvent("cx-cropper-loading-change", {
762
761
  bubbles: !0,
763
762
  cancelable: !1,
764
763
  composed: !0,
765
- detail: p
764
+ detail: g
766
765
  });
767
- M.current.dispatchEvent(m), p || b(!0);
768
- }, [p, i]);
769
- const Q = w.useMemo(() => h.focusMode === "center", [h.focusMode]), ee = w.useCallback(
770
- (m, y) => {
766
+ D.current.dispatchEvent(m), g || x(!0);
767
+ }, [g, i]);
768
+ const Q = w.useMemo(() => s.focusMode === "center", [s.focusMode]), tt = w.useCallback(
769
+ (m, b) => {
771
770
  const H = new CustomEvent("cx-cropper-crop-complete", {
772
771
  bubbles: !0,
773
772
  cancelable: !1,
774
773
  composed: !0,
775
774
  detail: {
776
- croppedArea: y
775
+ croppedArea: b
777
776
  }
778
777
  });
779
- M.current?.dispatchEvent(H);
778
+ D.current?.dispatchEvent(H);
780
779
  },
781
780
  []
782
781
  );
783
782
  w.useEffect(() => {
784
783
  if (Q) {
785
- const m = le(
784
+ const m = lt(
786
785
  r.width,
787
786
  r.height,
788
- h.width / h.height,
789
- h.percentageWidth
787
+ s.width / s.height,
788
+ s.percentageWidth
790
789
  );
791
- C(m), ee(void 0, m);
790
+ R(m), tt(void 0, m);
792
791
  }
793
792
  }, [
794
793
  Q,
795
- h.percentageWidth,
796
- h.width,
797
- h.height,
794
+ s.percentageWidth,
795
+ s.width,
796
+ s.height,
798
797
  r.width,
799
798
  r.height,
800
- ee
799
+ tt
801
800
  ]);
802
- const ue = w.useCallback((m) => {
803
- const y = new CustomEvent("cx-cropper-crop-drag-start", {
801
+ const ut = w.useCallback((m) => {
802
+ const b = new CustomEvent("cx-cropper-crop-drag-start", {
804
803
  bubbles: !0,
805
804
  cancelable: !1,
806
805
  composed: !0,
@@ -809,67 +808,69 @@ const We = w.forwardRef(
809
808
  clientY: m.clientY
810
809
  }
811
810
  });
812
- M.current?.dispatchEvent(y);
813
- }, []), we = w.useMemo(() => {
814
- if (!M.current)
811
+ D.current?.dispatchEvent(b);
812
+ }, []), wt = w.useMemo(() => {
813
+ if (!D.current)
815
814
  return !1;
816
- const m = U.height / U.width, y = M.current.clientHeight / M.current.clientWidth;
817
- return m > y;
818
- }, [U.height, U.width]);
815
+ const m = L.height / L.width, b = D.current.clientHeight / D.current.clientWidth;
816
+ return m > b;
817
+ }, [L.height, L.width]);
819
818
  return /* @__PURE__ */ f.jsx(
820
819
  "div",
821
820
  {
822
- ref: M,
823
- className: `cropper cropper--${we ? "portrait" : "landscape"}${a ? " cropper--multiple" : ""}`,
821
+ ref: D,
822
+ className: `cropper cropper--${wt ? "portrait" : "landscape"}${a ? " cropper--multiple" : ""}`,
824
823
  children: i ? /* @__PURE__ */ f.jsx(
825
- ie,
824
+ it,
826
825
  {
827
- aspect: h.keepAspectRatio || h.unit === N.AspectRatio ? h.width / h.height : void 0,
828
- crop: v,
826
+ aspect: s.keepAspectRatio || s.unit === U.AspectRatio ? s.width / s.height : void 0,
827
+ crop: _,
829
828
  centerCrop: Q,
830
- disabled: u,
831
- loading: s || o && p,
829
+ disabled: p,
830
+ loading: h || o && g,
832
831
  keepSelection: !0,
832
+ minHeight: 1,
833
+ minWidth: 1,
833
834
  ruleOfThirds: !0,
834
- onChange: ge,
835
- onComplete: ee,
836
- onDragStart: ue,
835
+ onChange: gt,
836
+ onComplete: tt,
837
+ onDragStart: ut,
837
838
  style: {
838
- cursor: u ? "default" : "move",
839
- pointerEvents: u ? "none" : "auto"
839
+ cursor: p ? "default" : "move",
840
+ pointerEvents: p ? "none" : "auto"
840
841
  },
841
842
  children: /* @__PURE__ */ f.jsx(
842
843
  "img",
843
844
  {
844
845
  className: "cropper__image",
845
- src: D,
846
+ src: k,
846
847
  alt: "Cropped",
847
848
  ref: Z,
848
- onLoad: oe
849
+ onLoad: ot
849
850
  }
850
851
  )
851
852
  },
852
- R.url
853
+ y.url
853
854
  ) : /* @__PURE__ */ f.jsx(
854
855
  "img",
855
856
  {
856
- className: `cropper__image ${p && !x ? "cropper__image--loading" : ""}`,
857
- src: D,
857
+ className: `cropper__image ${g && !C ? "cropper__image--loading" : ""}`,
858
+ src: k,
858
859
  alt: "Cropped",
859
860
  ref: Z,
860
- onLoad: oe
861
+ onLoad: ot
861
862
  }
862
863
  )
863
864
  }
864
865
  );
865
866
  }
866
867
  );
867
- var Ae = Object.defineProperty, Oe = Object.getOwnPropertyDescriptor, z = (h, e, t, r) => {
868
- for (var i = r > 1 ? void 0 : r ? Oe(e, t) : e, s = h.length - 1, a; s >= 0; s--)
869
- (a = h[s]) && (i = (r ? a(e, t, i) : a(i)) || i);
870
- return r && i && Ae(e, t, i), i;
868
+ var Wt = Object.defineProperty, At = Object.getOwnPropertyDescriptor, z = (s, t, e, r) => {
869
+ for (var i = r > 1 ? void 0 : r ? At(t, e) : t, h = s.length - 1, a; h >= 0; h--)
870
+ (a = s[h]) && (i = (r ? a(t, e, i) : a(i)) || i);
871
+ return r && i && Wt(t, e, i), i;
871
872
  };
872
- const Ke = Me(We, ze, ke, {
873
+ const Kt = Mt(Et, zt, kt, {
873
874
  // @ts-expect-error type error
874
875
  props: {
875
876
  cropper: "object",
@@ -885,15 +886,15 @@ const Ke = Me(We, ze, ke, {
885
886
  useInternalLoading: "boolean"
886
887
  }
887
888
  });
888
- customElements.get("custom-cropper") || customElements.define("custom-cropper", Ke);
889
- let k = class extends be {
889
+ customElements.get("custom-cropper") || customElements.define("custom-cropper", Kt);
890
+ let M = class extends bt {
890
891
  constructor() {
891
892
  super(...arguments), this.cropper = {
892
893
  height: 0,
893
894
  keepAspectRatio: !0,
894
895
  percentageHeight: 0,
895
896
  percentageWidth: 0,
896
- unit: N.Pixel,
897
+ unit: U.Pixel,
897
898
  width: 0,
898
899
  x: 0,
899
900
  y: 0
@@ -902,62 +903,62 @@ let k = class extends be {
902
903
  width: 0
903
904
  }, this.rotation = 0, this.fillImage = !1, this.disabled = !1, this.loadable = !1, this.loading = !1, this.multiple = !1, this.useInternalLoading = !1, this.showLoading = !0;
904
905
  }
905
- handleLoadingChange(h) {
906
- h.detail || (this.showLoading = h.detail);
906
+ handleLoadingChange(s) {
907
+ s.detail || (this.showLoading = s.detail);
907
908
  }
908
909
  render() {
909
- return te`
910
- ${ae(
910
+ return et`
911
+ ${at(
911
912
  this.image,
912
- () => te`<custom-cropper .ref=${this} .cropper=${this.cropper} .image=${this.image} .loadable=${this.loadable} .resizer=${this.resizer} .rotation=${this.rotation} .disabled=${this.disabled} .loading=${this.loading} .fillImage=${this.fillImage} .useInternalLoading=${this.useInternalLoading} .multiple=${this.multiple} @cx-cropper-loading-change=${this.handleLoadingChange}></custom-cropper>`
913
+ () => et`<custom-cropper .ref=${this} .cropper=${this.cropper} .image=${this.image} .loadable=${this.loadable} .resizer=${this.resizer} .rotation=${this.rotation} .disabled=${this.disabled} .loading=${this.loading} .fillImage=${this.fillImage} .useInternalLoading=${this.useInternalLoading} .multiple=${this.multiple} @cx-cropper-loading-change=${this.handleLoadingChange}></custom-cropper>`
913
914
  )}
914
- ${ae(
915
+ ${at(
915
916
  this.showLoading,
916
- () => te`<div class="loading-container"><div class="loading"><cx-skeleton class="loading__skeleton"></cx-skeleton><cx-spinner class="loading__spinner"></cx-spinner></div></div>`
917
+ () => et`<div class="loading-container"><div class="loading"><cx-skeleton class="loading__skeleton"></cx-skeleton><cx-spinner class="loading__spinner"></cx-spinner></div></div>`
917
918
  )}
918
919
  `;
919
920
  }
920
921
  };
921
- k.styles = [ye, Ie];
922
+ M.styles = [yt, It];
922
923
  z([
923
- De("custom-cropper")
924
- ], k.prototype, "cropperEl", 2);
924
+ Dt("custom-cropper")
925
+ ], M.prototype, "cropperEl", 2);
925
926
  z([
926
927
  S({ type: Object })
927
- ], k.prototype, "cropper", 2);
928
+ ], M.prototype, "cropper", 2);
928
929
  z([
929
930
  S({ type: Object })
930
- ], k.prototype, "image", 2);
931
+ ], M.prototype, "image", 2);
931
932
  z([
932
933
  S({ type: Object })
933
- ], k.prototype, "resizer", 2);
934
+ ], M.prototype, "resizer", 2);
934
935
  z([
935
936
  S({ reflect: !0, type: Number })
936
- ], k.prototype, "rotation", 2);
937
+ ], M.prototype, "rotation", 2);
937
938
  z([
938
939
  S({ attribute: "fill-image", reflect: !0, type: Boolean })
939
- ], k.prototype, "fillImage", 2);
940
+ ], M.prototype, "fillImage", 2);
940
941
  z([
941
942
  S({ reflect: !0, type: Boolean })
942
- ], k.prototype, "disabled", 2);
943
+ ], M.prototype, "disabled", 2);
943
944
  z([
944
945
  S({ reflect: !0, type: Boolean })
945
- ], k.prototype, "loadable", 2);
946
+ ], M.prototype, "loadable", 2);
946
947
  z([
947
948
  S({ reflect: !0, type: Boolean })
948
- ], k.prototype, "loading", 2);
949
+ ], M.prototype, "loading", 2);
949
950
  z([
950
951
  S({ reflect: !0, type: Boolean })
951
- ], k.prototype, "multiple", 2);
952
+ ], M.prototype, "multiple", 2);
952
953
  z([
953
954
  S({ attribute: "use-internal-loading", reflect: !0, type: Boolean })
954
- ], k.prototype, "useInternalLoading", 2);
955
+ ], M.prototype, "useInternalLoading", 2);
955
956
  z([
956
- ve()
957
- ], k.prototype, "showLoading", 2);
958
- k = z([
959
- Re("cx-cropper")
960
- ], k);
957
+ _t()
958
+ ], M.prototype, "showLoading", 2);
959
+ M = z([
960
+ Rt("cx-cropper")
961
+ ], M);
961
962
  export {
962
- k as default
963
+ M as default
963
964
  };