@frybynite/image-cloud 0.5.0 → 0.6.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.
package/dist/react.js CHANGED
@@ -1,30 +1,30 @@
1
- import { jsx as Ot } from "react/jsx-runtime";
2
- import { forwardRef as $t, useRef as wt, useImperativeHandle as Ut, useEffect as Pt } from "react";
3
- const ft = Object.freeze({
1
+ import { jsx as Pt } from "react/jsx-runtime";
2
+ import { forwardRef as Ht, useRef as Et, useImperativeHandle as Nt, useEffect as jt } from "react";
3
+ const pt = Object.freeze({
4
4
  none: "none",
5
5
  sm: "0 2px 4px rgba(0,0,0,0.1)",
6
6
  md: "0 4px 16px rgba(0,0,0,0.4)",
7
7
  lg: "0 8px 32px rgba(0,0,0,0.5)",
8
8
  glow: "0 0 30px rgba(255,255,255,0.6)"
9
- }), xt = Object.freeze({
9
+ }), wt = Object.freeze({
10
10
  energetic: Object.freeze({ overshoot: 0.25, bounces: 2, decayRatio: 0.5 }),
11
11
  playful: Object.freeze({ overshoot: 0.15, bounces: 1, decayRatio: 0.5 }),
12
12
  subtle: Object.freeze({ overshoot: 0.08, bounces: 1, decayRatio: 0.5 })
13
- }), Et = Object.freeze({
13
+ }), It = Object.freeze({
14
14
  gentle: Object.freeze({ stiffness: 150, damping: 30, mass: 1, oscillations: 2 }),
15
15
  bouncy: Object.freeze({ stiffness: 300, damping: 15, mass: 1, oscillations: 4 }),
16
16
  wobbly: Object.freeze({ stiffness: 180, damping: 12, mass: 1.5, oscillations: 5 }),
17
17
  snappy: Object.freeze({ stiffness: 400, damping: 25, mass: 0.8, oscillations: 2 })
18
- }), St = Object.freeze({
18
+ }), Ct = Object.freeze({
19
19
  gentle: Object.freeze({ amplitude: 30, frequency: 1.5, decay: !0, decayRate: 0.9, phase: 0 }),
20
20
  playful: Object.freeze({ amplitude: 50, frequency: 2.5, decay: !0, decayRate: 0.7, phase: 0 }),
21
21
  serpentine: Object.freeze({ amplitude: 60, frequency: 3, decay: !1, decayRate: 1, phase: 0 }),
22
22
  flutter: Object.freeze({ amplitude: 20, frequency: 4, decay: !0, decayRate: 0.5, phase: 0 })
23
- }), pt = Object.freeze({
23
+ }), yt = Object.freeze({
24
24
  type: "linear"
25
- }), bt = Object.freeze({
25
+ }), vt = Object.freeze({
26
26
  mode: "none"
27
- }), yt = Object.freeze({
27
+ }), xt = Object.freeze({
28
28
  mode: "none"
29
29
  }), Rt = Object.freeze({
30
30
  default: Object.freeze({
@@ -51,17 +51,17 @@ const ft = Object.freeze({
51
51
  focused: Object.freeze({
52
52
  shadow: "none"
53
53
  })
54
- }), _t = Object.freeze({
54
+ }), Wt = Object.freeze({
55
55
  rows: 1,
56
56
  amplitude: 100,
57
57
  frequency: 2,
58
58
  phaseShift: 0,
59
59
  synchronization: "offset"
60
60
  // Note: Image rotation along wave is now controlled via image.rotation.mode = 'tangent'
61
- }), Ht = Object.freeze({
61
+ }), Ut = Object.freeze({
62
62
  mobile: Object.freeze({ maxWidth: 767 }),
63
63
  tablet: Object.freeze({ maxWidth: 1199 })
64
- }), Nt = Object.freeze({
64
+ }), Gt = Object.freeze({
65
65
  mode: "adaptive",
66
66
  // Default to adaptive sizing
67
67
  minSize: 50,
@@ -73,21 +73,21 @@ const ft = Object.freeze({
73
73
  // No variance by default
74
74
  max: 1
75
75
  })
76
- }), jt = Object.freeze({
76
+ }), kt = Object.freeze({
77
77
  mode: "none",
78
78
  range: Object.freeze({
79
79
  min: -15,
80
80
  max: 15
81
81
  })
82
- }), Ct = Object.freeze({
83
- sizing: Nt,
84
- rotation: jt
85
82
  }), At = Object.freeze({
83
+ sizing: Gt,
84
+ rotation: kt
85
+ }), zt = Object.freeze({
86
86
  validateUrls: !0,
87
87
  validationTimeout: 5e3,
88
88
  validationMethod: "head",
89
89
  allowedExtensions: ["jpg", "jpeg", "png", "gif", "webp", "bmp"]
90
- }), Lt = Object.freeze({
90
+ }), Ft = Object.freeze({
91
91
  enabled: !1,
92
92
  centers: !1,
93
93
  loaders: !1
@@ -96,17 +96,17 @@ const ft = Object.freeze({
96
96
  loaders: [],
97
97
  // Shared loader settings and debug config
98
98
  config: Object.freeze({
99
- loaders: At,
100
- debug: Lt
99
+ loaders: zt,
100
+ debug: Ft
101
101
  }),
102
102
  // Image sizing and rotation configuration
103
- image: Ct,
103
+ image: At,
104
104
  // Pattern-based layout configuration
105
105
  layout: Object.freeze({
106
106
  algorithm: "radial",
107
107
  scaleDecay: 0,
108
108
  // No decay by default (0-1 for radial/spiral)
109
- responsive: Ht,
109
+ responsive: Ut,
110
110
  targetCoverage: 0.6,
111
111
  // Target 60% of container area
112
112
  densityFactor: 1,
@@ -162,9 +162,9 @@ const ft = Object.freeze({
162
162
  }),
163
163
  easing: "cubic-bezier(0.25, 1, 0.5, 1)",
164
164
  // smooth deceleration
165
- path: pt,
166
- rotation: bt,
167
- scale: yt
165
+ path: yt,
166
+ rotation: vt,
167
+ scale: xt
168
168
  })
169
169
  }),
170
170
  // Pattern-based interaction configuration
@@ -223,19 +223,19 @@ const ft = Object.freeze({
223
223
  // Image styling
224
224
  styling: Rt
225
225
  });
226
- function Z(n, t) {
226
+ function K(n, t) {
227
227
  if (!n) return t || {};
228
228
  if (!t) return { ...n };
229
229
  const e = { ...n };
230
230
  return t.border !== void 0 && (e.border = { ...n.border, ...t.border }), t.borderTop !== void 0 && (e.borderTop = { ...n.borderTop, ...t.borderTop }), t.borderRight !== void 0 && (e.borderRight = { ...n.borderRight, ...t.borderRight }), t.borderBottom !== void 0 && (e.borderBottom = { ...n.borderBottom, ...t.borderBottom }), t.borderLeft !== void 0 && (e.borderLeft = { ...n.borderLeft, ...t.borderLeft }), t.filter !== void 0 && (e.filter = { ...n.filter, ...t.filter }), t.outline !== void 0 && (e.outline = { ...n.outline, ...t.outline }), t.shadow !== void 0 && (e.shadow = t.shadow), t.opacity !== void 0 && (e.opacity = t.opacity), t.cursor !== void 0 && (e.cursor = t.cursor), t.className !== void 0 && (e.className = t.className), t.objectFit !== void 0 && (e.objectFit = t.objectFit), t.aspectRatio !== void 0 && (e.aspectRatio = t.aspectRatio), t.borderRadiusTopLeft !== void 0 && (e.borderRadiusTopLeft = t.borderRadiusTopLeft), t.borderRadiusTopRight !== void 0 && (e.borderRadiusTopRight = t.borderRadiusTopRight), t.borderRadiusBottomRight !== void 0 && (e.borderRadiusBottomRight = t.borderRadiusBottomRight), t.borderRadiusBottomLeft !== void 0 && (e.borderRadiusBottomLeft = t.borderRadiusBottomLeft), e;
231
231
  }
232
- function kt(n, t) {
232
+ function _t(n, t) {
233
233
  if (!t) return { ...n };
234
- const e = Z(n.default, t.default), i = Z(
235
- Z(e, n.hover),
234
+ const e = K(n.default, t.default), i = K(
235
+ K(e, n.hover),
236
236
  t.hover
237
- ), o = Z(
238
- Z(e, n.focused),
237
+ ), o = K(
238
+ K(e, n.focused),
239
239
  t.focused
240
240
  );
241
241
  return {
@@ -244,7 +244,7 @@ function kt(n, t) {
244
244
  focused: o
245
245
  };
246
246
  }
247
- function Wt(n, t) {
247
+ function qt(n, t) {
248
248
  if (!t) return { ...n };
249
249
  const e = { ...n };
250
250
  if (t.sizing !== void 0 && (e.sizing = {
@@ -263,7 +263,7 @@ function Wt(n, t) {
263
263
  }
264
264
  return e;
265
265
  }
266
- function Gt(n) {
266
+ function Xt(n) {
267
267
  const t = n.layout?.rotation;
268
268
  if (t && "enabled" in t)
269
269
  return {
@@ -273,7 +273,7 @@ function Gt(n) {
273
273
  }
274
274
  };
275
275
  }
276
- function qt(n) {
276
+ function Yt(n) {
277
277
  const t = n.layout?.sizing?.variance;
278
278
  if (t)
279
279
  return {
@@ -284,8 +284,8 @@ function qt(n) {
284
284
  }
285
285
  };
286
286
  }
287
- function Yt(n = {}) {
288
- const t = Gt(n), e = qt(n);
287
+ function Bt(n = {}) {
288
+ const t = Xt(n), e = Yt(n);
289
289
  let i = n.image;
290
290
  (t || e) && (i = {
291
291
  ...e || {},
@@ -303,18 +303,18 @@ function Yt(n = {}) {
303
303
  });
304
304
  const r = {
305
305
  loaders: {
306
- ...At,
306
+ ...zt,
307
307
  ...n.config?.loaders ?? {}
308
308
  }
309
309
  }, a = {
310
310
  loaders: o,
311
311
  config: r,
312
- image: Wt(Ct, i),
312
+ image: qt(At, i),
313
313
  layout: { ...y.layout },
314
314
  animation: { ...y.animation },
315
315
  interaction: { ...y.interaction },
316
316
  rendering: { ...y.rendering },
317
- styling: kt(Rt, n.styling)
317
+ styling: _t(Rt, n.styling)
318
318
  };
319
319
  return n.layout && (a.layout = {
320
320
  ...y.layout,
@@ -347,9 +347,9 @@ function Yt(n = {}) {
347
347
  circular: n.animation.entry.start.circular ? { ...y.animation.entry.start.circular, ...n.animation.entry.start.circular } : y.animation.entry.start.circular
348
348
  } : y.animation.entry.start,
349
349
  timing: n.animation.entry.timing ? { ...y.animation.entry.timing, ...n.animation.entry.timing } : y.animation.entry.timing,
350
- path: n.animation.entry.path ? { ...pt, ...n.animation.entry.path } : y.animation.entry.path,
351
- rotation: n.animation.entry.rotation ? { ...bt, ...n.animation.entry.rotation } : y.animation.entry.rotation,
352
- scale: n.animation.entry.scale ? { ...yt, ...n.animation.entry.scale } : y.animation.entry.scale
350
+ path: n.animation.entry.path ? { ...yt, ...n.animation.entry.path } : y.animation.entry.path,
351
+ rotation: n.animation.entry.rotation ? { ...vt, ...n.animation.entry.rotation } : y.animation.entry.rotation,
352
+ scale: n.animation.entry.scale ? { ...xt, ...n.animation.entry.scale } : y.animation.entry.scale
353
353
  })), n.interaction && (a.interaction = {
354
354
  ...y.interaction,
355
355
  ...n.interaction
@@ -377,20 +377,20 @@ function Yt(n = {}) {
377
377
  ...y.rendering.performance,
378
378
  ...n.rendering.performance
379
379
  })), a.config.debug = {
380
- ...Lt,
380
+ ...Ft,
381
381
  ...n.config?.debug ?? {}
382
382
  }, a;
383
383
  }
384
- function Xt(n, t) {
385
- return { ...n ? xt[n] : xt.playful, ...t };
384
+ function Jt(n, t) {
385
+ return { ...n ? wt[n] : wt.playful, ...t };
386
386
  }
387
- function Bt(n, t) {
388
- return { ...n ? Et[n] : Et.gentle, ...t };
387
+ function Vt(n, t) {
388
+ return { ...n ? It[n] : It.gentle, ...t };
389
389
  }
390
- function Jt(n, t) {
391
- return { ...n ? St[n] : St.gentle, ...t };
390
+ function Qt(n, t) {
391
+ return { ...n ? Ct[n] : Ct.gentle, ...t };
392
392
  }
393
- class Vt {
393
+ class Zt {
394
394
  constructor(t) {
395
395
  this.activeAnimations = /* @__PURE__ */ new Map(), this.animationIdCounter = 0, this.config = t;
396
396
  }
@@ -417,11 +417,11 @@ class Vt {
417
417
  */
418
418
  animateTransformCancellable(t, e, i, o = null, s = null) {
419
419
  this.cancelAllAnimations(t);
420
- const r = o ?? this.config.duration, a = s ?? this.config.easing.default, l = this.buildTransformString(e), c = this.buildTransformString(i);
420
+ const r = o ?? this.config.duration, a = s ?? this.config.easing.default, h = this.buildTransformString(e), c = this.buildTransformString(i);
421
421
  t.style.transition = "none";
422
- const u = t.animate(
422
+ const d = t.animate(
423
423
  [
424
- { transform: l },
424
+ { transform: h },
425
425
  { transform: c }
426
426
  ],
427
427
  {
@@ -430,20 +430,20 @@ class Vt {
430
430
  fill: "forwards"
431
431
  // Keep final state after animation
432
432
  }
433
- ), h = {
433
+ ), l = {
434
434
  id: `anim-${++this.animationIdCounter}`,
435
435
  element: t,
436
- animation: u,
436
+ animation: d,
437
437
  fromState: e,
438
438
  toState: i,
439
439
  startTime: performance.now(),
440
440
  duration: r
441
441
  };
442
- return this.activeAnimations.set(t, h), u.finished.then(() => {
442
+ return this.activeAnimations.set(t, l), d.finished.then(() => {
443
443
  t.style.transform = c, this.activeAnimations.delete(t);
444
444
  }).catch(() => {
445
445
  this.activeAnimations.delete(t);
446
- }), h;
446
+ }), l;
447
447
  }
448
448
  /**
449
449
  * Cancel an active animation
@@ -486,8 +486,8 @@ class Vt {
486
486
  const i = getComputedStyle(t).transform;
487
487
  if (i === "none" || !i)
488
488
  return { x: 0, y: 0, rotation: 0, scale: 1 };
489
- const o = new DOMMatrix(i), s = Math.sqrt(o.a * o.a + o.b * o.b), r = Math.atan2(o.b, o.a) * (180 / Math.PI), a = o.e, l = o.f;
490
- return { x: a, y: l, rotation: r, scale: s };
489
+ const o = new DOMMatrix(i), s = Math.sqrt(o.a * o.a + o.b * o.b), r = Math.atan2(o.b, o.a) * (180 / Math.PI), a = o.e, h = o.f;
490
+ return { x: a, y: h, rotation: r, scale: s };
491
491
  }
492
492
  /**
493
493
  * Check if an element has an active animation
@@ -550,30 +550,30 @@ function V(n, t, e) {
550
550
  return n + (t - n) * e;
551
551
  }
552
552
  function Kt(n, t, e, i) {
553
- const { overshoot: o, bounces: s, decayRatio: r } = i, a = e.x - t.x, l = e.y - t.y, c = Zt(s, r);
554
- let u = 0, h = 0, d = 1, f = o, b = !1;
553
+ const { overshoot: o, bounces: s, decayRatio: r } = i, a = e.x - t.x, h = e.y - t.y, c = te(s, r);
554
+ let d = 0, l = 0, u = 1, m = o, b = !1;
555
555
  for (let g = 0; g < c.length; g++)
556
556
  if (n <= c[g].time) {
557
- h = g === 0 ? 0 : c[g - 1].time, d = c[g].time, f = c[g].overshoot, b = c[g].isOvershoot;
557
+ l = g === 0 ? 0 : c[g - 1].time, u = c[g].time, m = c[g].overshoot, b = c[g].isOvershoot;
558
558
  break;
559
559
  }
560
- const p = (n - h) / (d - h);
560
+ const p = (n - l) / (u - l);
561
561
  if (b)
562
- u = 1 + f * ot(p);
563
- else if (h === 0)
564
- u = ot(p);
562
+ d = 1 + m * at(p);
563
+ else if (l === 0)
564
+ d = at(p);
565
565
  else {
566
- const m = 1 + (c.find(
567
- (E, v) => E.time > h && v > 0 && c[v - 1].isOvershoot
568
- )?.overshoot || f);
569
- u = V(m, 1, ot(p));
566
+ const f = 1 + (c.find(
567
+ (E, v) => E.time > l && v > 0 && c[v - 1].isOvershoot
568
+ )?.overshoot || m);
569
+ d = V(f, 1, at(p));
570
570
  }
571
571
  return {
572
- x: t.x + a * u,
573
- y: t.y + l * u
572
+ x: t.x + a * d,
573
+ y: t.y + h * d
574
574
  };
575
575
  }
576
- function Zt(n, t) {
576
+ function te(n, t) {
577
577
  const e = [];
578
578
  let i = 0.6;
579
579
  e.push({ time: i, overshoot: 0, isOvershoot: !1 });
@@ -583,57 +583,57 @@ function Zt(n, t) {
583
583
  i += r, e.push({ time: i, overshoot: o, isOvershoot: !0 }), i += r, e.push({ time: i, overshoot: o * t, isOvershoot: !1 }), o *= t;
584
584
  return e.push({ time: 1, overshoot: 0, isOvershoot: !1 }), e;
585
585
  }
586
- function Qt(n, t, e, i) {
587
- const { stiffness: o, damping: s, mass: r, oscillations: a } = i, l = e.x - t.x, c = e.y - t.y, u = Math.sqrt(o / r), h = s / (2 * Math.sqrt(o * r));
588
- let d;
589
- if (h < 1) {
590
- const f = u * Math.sqrt(1 - h * h), b = Math.exp(-h * u * n * 3), p = Math.cos(f * n * a * Math.PI);
591
- d = 1 - b * p;
586
+ function ee(n, t, e, i) {
587
+ const { stiffness: o, damping: s, mass: r, oscillations: a } = i, h = e.x - t.x, c = e.y - t.y, d = Math.sqrt(o / r), l = s / (2 * Math.sqrt(o * r));
588
+ let u;
589
+ if (l < 1) {
590
+ const m = d * Math.sqrt(1 - l * l), b = Math.exp(-l * d * n * 3), p = Math.cos(m * n * a * Math.PI);
591
+ u = 1 - b * p;
592
592
  } else
593
- d = 1 - Math.exp(-u * n * 3);
594
- return d = Math.max(0, Math.min(d, 1.3)), {
595
- x: t.x + l * d,
596
- y: t.y + c * d
593
+ u = 1 - Math.exp(-d * n * 3);
594
+ return u = Math.max(0, Math.min(u, 1.3)), {
595
+ x: t.x + h * u,
596
+ y: t.y + c * u
597
597
  };
598
598
  }
599
- function te(n, t, e, i) {
600
- const { amplitude: o, frequency: s, decay: r, decayRate: a, phase: l } = i, c = e.x - t.x, u = e.y - t.y, h = Math.sqrt(c * c + u * u), d = h > 0 ? -u / h : 0, f = h > 0 ? c / h : 1, b = s * Math.PI * 2 * n + l, p = r ? Math.pow(1 - n, a) : 1, g = o * Math.sin(b) * p, m = ee(n);
599
+ function ie(n, t, e, i) {
600
+ const { amplitude: o, frequency: s, decay: r, decayRate: a, phase: h } = i, c = e.x - t.x, d = e.y - t.y, l = Math.sqrt(c * c + d * d), u = l > 0 ? -d / l : 0, m = l > 0 ? c / l : 1, b = s * Math.PI * 2 * n + h, p = r ? Math.pow(1 - n, a) : 1, g = o * Math.sin(b) * p, f = ne(n);
601
601
  return {
602
- x: V(t.x, e.x, m) + g * d,
603
- y: V(t.y, e.y, m) + g * f
602
+ x: V(t.x, e.x, f) + g * u,
603
+ y: V(t.y, e.y, f) + g * m
604
604
  };
605
605
  }
606
- function ot(n) {
606
+ function at(n) {
607
607
  return 1 - (1 - n) * (1 - n);
608
608
  }
609
- function ee(n) {
609
+ function ne(n) {
610
610
  return 1 - Math.pow(1 - n, 3);
611
611
  }
612
- function ie(n, t, e) {
613
- const { amplitude: i, frequency: o, decay: s } = e, r = Math.sin(n * o * Math.PI * 2), a = s ? Math.pow(1 - n, 2) : 1, l = i * r * a;
614
- return t + l;
612
+ function oe(n, t, e) {
613
+ const { amplitude: i, frequency: o, decay: s } = e, r = Math.sin(n * o * Math.PI * 2), a = s ? Math.pow(1 - n, 2) : 1, h = i * r * a;
614
+ return t + h;
615
615
  }
616
- function ne(n, t, e) {
616
+ function se(n, t, e) {
617
617
  const { overshoot: i, bounces: o } = e, s = [];
618
618
  s.push({ time: 0.5, scale: i });
619
619
  let r = i;
620
620
  const a = 0.5, c = 0.5 / (o * 2);
621
- let u = 0.5;
622
- for (let d = 0; d < o; d++) {
623
- const f = 1 - (r - 1) * a;
624
- u += c, s.push({ time: u, scale: f }), r = 1 + (r - 1) * a * a, u += c, d < o - 1 && s.push({ time: u, scale: r });
621
+ let d = 0.5;
622
+ for (let u = 0; u < o; u++) {
623
+ const m = 1 - (r - 1) * a;
624
+ d += c, s.push({ time: d, scale: m }), r = 1 + (r - 1) * a * a, d += c, u < o - 1 && s.push({ time: d, scale: r });
625
625
  }
626
626
  s.push({ time: 1, scale: 1 });
627
- let h = 1;
628
- for (let d = 0; d < s.length; d++)
629
- if (n <= s[d].time) {
630
- const f = d === 0 ? 0 : s[d - 1].time, b = d === 0 ? 1 : s[d - 1].scale, p = (n - f) / (s[d].time - f), g = ot(p);
631
- h = b + (s[d].scale - b) * g;
627
+ let l = 1;
628
+ for (let u = 0; u < s.length; u++)
629
+ if (n <= s[u].time) {
630
+ const m = u === 0 ? 0 : s[u - 1].time, b = u === 0 ? 1 : s[u - 1].scale, p = (n - m) / (s[u].time - m), g = at(p);
631
+ l = b + (s[u].scale - b) * g;
632
632
  break;
633
633
  }
634
- return h * t;
634
+ return l * t;
635
635
  }
636
- function oe(n) {
636
+ function ae(n) {
637
637
  const {
638
638
  element: t,
639
639
  startPosition: e,
@@ -642,65 +642,65 @@ function oe(n) {
642
642
  duration: s,
643
643
  imageWidth: r,
644
644
  imageHeight: a,
645
- rotation: l,
645
+ rotation: h,
646
646
  scale: c,
647
- onComplete: u,
648
- rotationConfig: h,
649
- startRotation: d,
650
- scaleConfig: f,
647
+ onComplete: d,
648
+ rotationConfig: l,
649
+ startRotation: u,
650
+ scaleConfig: m,
651
651
  startScale: b
652
- } = n, p = o.type, g = d !== void 0 && d !== l, m = h?.mode === "wobble", E = h?.wobble || { amplitude: 15, frequency: 3, decay: !0 }, v = g || m, w = b !== void 0 && b !== c, S = f?.mode === "pop", x = f?.pop || { overshoot: 1.2, bounces: 1 };
653
- if ((p === "linear" || p === "arc") && !v && !(w || S)) {
654
- u && u();
652
+ } = n, p = o.type, g = u !== void 0 && u !== h, f = l?.mode === "wobble", E = l?.wobble || { amplitude: 15, frequency: 3, decay: !0 }, v = g || f, x = b !== void 0 && b !== c, w = m?.mode === "pop", S = m?.pop || { overshoot: 1.2, bounces: 1 };
653
+ if ((p === "linear" || p === "arc") && !v && !(x || w)) {
654
+ d && d();
655
655
  return;
656
656
  }
657
- const M = performance.now(), z = -r / 2, P = -a / 2;
658
- function _(Y) {
659
- const N = Y - M, R = Math.min(N / s, 1);
657
+ const z = performance.now(), F = -r / 2, H = -a / 2;
658
+ function N(X) {
659
+ const W = X - z, T = Math.min(W / s, 1);
660
660
  let D;
661
661
  switch (p) {
662
662
  case "bounce": {
663
- const O = Xt(
663
+ const O = Jt(
664
664
  o.bouncePreset,
665
665
  o.bounce
666
666
  );
667
- D = Kt(R, e, i, O);
667
+ D = Kt(T, e, i, O);
668
668
  break;
669
669
  }
670
670
  case "elastic": {
671
- const O = Bt(
671
+ const O = Vt(
672
672
  o.elasticPreset,
673
673
  o.elastic
674
674
  );
675
- D = Qt(R, e, i, O);
675
+ D = ee(T, e, i, O);
676
676
  break;
677
677
  }
678
678
  case "wave": {
679
- const O = Jt(
679
+ const O = Qt(
680
680
  o.wavePreset,
681
681
  o.wave
682
682
  );
683
- D = te(R, e, i, O);
683
+ D = ie(T, e, i, O);
684
684
  break;
685
685
  }
686
686
  default:
687
687
  D = {
688
- x: V(e.x, i.x, R),
689
- y: V(e.y, i.y, R)
688
+ x: V(e.x, i.x, T),
689
+ y: V(e.y, i.y, T)
690
690
  };
691
691
  }
692
- const k = D.x - i.x, H = D.y - i.y;
693
- let A;
694
- m ? A = ie(R, l, E) : g ? A = V(d, l, R) : A = l;
695
- let C;
696
- S ? C = ne(R, c, x) : w ? C = V(b, c, R) : C = c, t.style.transform = `translate(${z}px, ${P}px) translate(${k}px, ${H}px) rotate(${A}deg) scale(${C})`, R < 1 ? requestAnimationFrame(_) : (t.style.transform = `translate(${z}px, ${P}px) rotate(${l}deg) scale(${c})`, u && u());
692
+ const G = D.x - i.x, j = D.y - i.y;
693
+ let R;
694
+ f ? R = oe(T, h, E) : g ? R = V(u, h, T) : R = h;
695
+ let M;
696
+ w ? M = se(T, c, S) : x ? M = V(b, c, T) : M = c, t.style.transform = `translate(${F}px, ${H}px) translate(${G}px, ${j}px) rotate(${R}deg) scale(${M})`, T < 1 ? requestAnimationFrame(N) : (t.style.transform = `translate(${F}px, ${H}px) rotate(${h}deg) scale(${c})`, d && d());
697
697
  }
698
- requestAnimationFrame(_);
698
+ requestAnimationFrame(N);
699
699
  }
700
- function se(n) {
700
+ function re(n) {
701
701
  return n === "bounce" || n === "elastic" || n === "wave";
702
702
  }
703
- const ae = {
703
+ const ce = {
704
704
  radial: "center",
705
705
  spiral: "center",
706
706
  grid: "top",
@@ -708,15 +708,15 @@ const ae = {
708
708
  random: "nearest-edge",
709
709
  wave: "left"
710
710
  };
711
- class re {
711
+ class le {
712
712
  constructor(t, e) {
713
- this.config = t, this.layoutAlgorithm = e, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || pt, this.rotationConfig = t.rotation || bt, this.scaleConfig = t.scale || yt;
713
+ this.config = t, this.layoutAlgorithm = e, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || yt, this.rotationConfig = t.rotation || vt, this.scaleConfig = t.scale || xt;
714
714
  }
715
715
  /**
716
716
  * Get the effective start position, considering layout-aware defaults
717
717
  */
718
718
  resolveStartPosition() {
719
- return this.config.start.position ? this.config.start.position : ae[this.layoutAlgorithm] || "nearest-edge";
719
+ return this.config.start.position ? this.config.start.position : ce[this.layoutAlgorithm] || "nearest-edge";
720
720
  }
721
721
  /**
722
722
  * Calculate the starting position for an image's entry animation
@@ -754,9 +754,9 @@ class re {
754
754
  * Calculate start position from the nearest edge (current default behavior)
755
755
  */
756
756
  calculateNearestEdge(t, e, i, o) {
757
- const s = t.x, r = t.y, a = s, l = i.width - s, c = r, u = i.height - r, h = Math.min(a, l, c, u);
758
- let d = t.x, f = t.y;
759
- return h === a ? d = -(e.width + o) : h === l ? d = i.width + o : h === c ? f = -(e.height + o) : f = i.height + o, { x: d, y: f };
757
+ const s = t.x, r = t.y, a = s, h = i.width - s, c = r, d = i.height - r, l = Math.min(a, h, c, d);
758
+ let u = t.x, m = t.y;
759
+ return l === a ? u = -(e.width + o) : l === h ? u = i.width + o : l === c ? m = -(e.height + o) : m = i.height + o, { x: u, y: m };
760
760
  }
761
761
  /**
762
762
  * Calculate start position from a specific edge
@@ -803,19 +803,19 @@ class re {
803
803
  */
804
804
  calculateCircularPosition(t, e, i, o, s) {
805
805
  const r = this.config.start.circular || {}, a = r.distribution || "even";
806
- let l;
806
+ let h;
807
807
  const c = r.radius || "120%";
808
808
  if (typeof c == "string" && c.endsWith("%")) {
809
809
  const p = parseFloat(c) / 100;
810
- l = Math.sqrt(
810
+ h = Math.sqrt(
811
811
  i.width ** 2 + i.height ** 2
812
812
  ) * p / 2;
813
813
  } else
814
- l = typeof c == "number" ? c : 500;
815
- let u;
816
- a === "even" ? u = o / s * 2 * Math.PI : u = Math.random() * 2 * Math.PI;
817
- const h = i.width / 2, d = i.height / 2, f = h + Math.cos(u) * l, b = d + Math.sin(u) * l;
818
- return { x: f, y: b };
814
+ h = typeof c == "number" ? c : 500;
815
+ let d;
816
+ a === "even" ? d = o / s * 2 * Math.PI : d = Math.random() * 2 * Math.PI;
817
+ const l = i.width / 2, u = i.height / 2, m = l + Math.cos(d) * h, b = u + Math.sin(d) * h;
818
+ return { x: m, y: b };
819
819
  }
820
820
  /**
821
821
  * Get animation parameters for an image
@@ -834,9 +834,9 @@ class re {
834
834
  * Build a CSS transform string for the start position
835
835
  * Uses pixel-based centering offset for reliable cross-browser behavior
836
836
  */
837
- buildStartTransform(t, e, i, o, s, r, a, l) {
838
- const c = t.x - e.x, u = t.y - e.y, h = a !== void 0 ? a : i, d = l !== void 0 ? l : o, f = s !== void 0 ? -s / 2 : 0, b = r !== void 0 ? -r / 2 : 0, p = s !== void 0 ? `translate(${f}px, ${b}px)` : "translate(-50%, -50%)";
839
- return t.useScale ? `${p} translate(${c}px, ${u}px) rotate(${h}deg) scale(0)` : `${p} translate(${c}px, ${u}px) rotate(${h}deg) scale(${d})`;
837
+ buildStartTransform(t, e, i, o, s, r, a, h) {
838
+ const c = t.x - e.x, d = t.y - e.y, l = a !== void 0 ? a : i, u = h !== void 0 ? h : o, m = s !== void 0 ? -s / 2 : 0, b = r !== void 0 ? -r / 2 : 0, p = s !== void 0 ? `translate(${m}px, ${b}px)` : "translate(-50%, -50%)";
839
+ return t.useScale ? `${p} translate(${c}px, ${d}px) rotate(${l}deg) scale(0)` : `${p} translate(${c}px, ${d}px) rotate(${l}deg) scale(${u})`;
840
840
  }
841
841
  /**
842
842
  * Build the final CSS transform string
@@ -861,7 +861,7 @@ class re {
861
861
  * Check if the current path type requires JavaScript animation
862
862
  */
863
863
  requiresJSAnimation() {
864
- return se(this.pathConfig.type);
864
+ return re(this.pathConfig.type);
865
865
  }
866
866
  /**
867
867
  * Get the path configuration
@@ -963,7 +963,7 @@ class re {
963
963
  amplitude: 15,
964
964
  frequency: 3,
965
965
  decay: !0
966
- }, { amplitude: o, frequency: s, decay: r } = i, a = Math.sin(t * s * Math.PI * 2), l = r ? Math.pow(1 - t, 2) : 1, c = o * a * l;
966
+ }, { amplitude: o, frequency: s, decay: r } = i, a = Math.sin(t * s * Math.PI * 2), h = r ? Math.pow(1 - t, 2) : 1, c = o * a * h;
967
967
  return e + c;
968
968
  }
969
969
  /**
@@ -1022,10 +1022,10 @@ class re {
1022
1022
  bounces: 1
1023
1023
  }, { overshoot: o, bounces: s } = i, r = this.generateScaleBounceKeyframes(s, o);
1024
1024
  let a = e;
1025
- for (let l = 0; l < r.length; l++)
1026
- if (t <= r[l].time) {
1027
- const c = l === 0 ? 0 : r[l - 1].time, u = l === 0 ? e : r[l - 1].scale, h = (t - c) / (r[l].time - c), d = this.easeOutQuad(h);
1028
- a = u + (r[l].scale - u) * d;
1025
+ for (let h = 0; h < r.length; h++)
1026
+ if (t <= r[h].time) {
1027
+ const c = h === 0 ? 0 : r[h - 1].time, d = h === 0 ? e : r[h - 1].scale, l = (t - c) / (r[h].time - c), u = this.easeOutQuad(l);
1028
+ a = d + (r[h].scale - d) * u;
1029
1029
  break;
1030
1030
  }
1031
1031
  return a * e;
@@ -1038,10 +1038,10 @@ class re {
1038
1038
  i.push({ time: 0.5, scale: e });
1039
1039
  let o = e;
1040
1040
  const s = 0.5, a = 0.5 / (t * 2);
1041
- let l = 0.5;
1041
+ let h = 0.5;
1042
1042
  for (let c = 0; c < t; c++) {
1043
- const u = 1 - (o - 1) * s;
1044
- l += a, i.push({ time: l, scale: u }), o = 1 + (o - 1) * s * s, l += a, c < t - 1 && i.push({ time: l, scale: o });
1043
+ const d = 1 - (o - 1) * s;
1044
+ h += a, i.push({ time: h, scale: d }), o = 1 + (o - 1) * s * s, h += a, c < t - 1 && i.push({ time: h, scale: o });
1045
1045
  }
1046
1046
  return i.push({ time: 1, scale: 1 }), i;
1047
1047
  }
@@ -1052,7 +1052,7 @@ class re {
1052
1052
  return 1 - (1 - t) * (1 - t);
1053
1053
  }
1054
1054
  }
1055
- class ce {
1055
+ class he {
1056
1056
  constructor(t, e = {}) {
1057
1057
  this.config = t, this.imageConfig = e;
1058
1058
  }
@@ -1064,17 +1064,17 @@ class ce {
1064
1064
  * @returns Array of layout objects with position, rotation, scale
1065
1065
  */
1066
1066
  generate(t, e, i = {}) {
1067
- const o = [], { width: s, height: r } = e, a = this.config.spacing.padding, l = i.fixedHeight ?? 200, c = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, h = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1, f = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || f !== 1, g = l * 1.5 / 2, m = l / 2, E = s - a - g, v = r - a - m, w = a + g, S = a + m;
1068
- for (let x = 0; x < t; x++) {
1069
- const T = this.random(w, E), M = this.random(S, v), z = c === "random" ? this.random(u, h) : 0, P = b ? this.random(d, f) : 1, _ = l * P, Y = {
1070
- id: x,
1071
- x: T,
1072
- y: M,
1073
- rotation: z,
1074
- scale: P,
1075
- baseSize: _
1067
+ const o = [], { width: s, height: r } = e, a = this.config.spacing.padding, h = i.fixedHeight ?? 200, c = this.imageConfig.rotation?.mode ?? "none", d = this.imageConfig.rotation?.range?.min ?? -15, l = this.imageConfig.rotation?.range?.max ?? 15, u = this.imageConfig.sizing?.variance?.min ?? 1, m = this.imageConfig.sizing?.variance?.max ?? 1, b = u !== 1 || m !== 1, g = h * 1.5 / 2, f = h / 2, E = s - a - g, v = r - a - f, x = a + g, w = a + f;
1068
+ for (let S = 0; S < t; S++) {
1069
+ const C = this.random(x, E), z = this.random(w, v), F = c === "random" ? this.random(d, l) : 0, H = b ? this.random(u, m) : 1, N = h * H, X = {
1070
+ id: S,
1071
+ x: C,
1072
+ y: z,
1073
+ rotation: F,
1074
+ scale: H,
1075
+ baseSize: N
1076
1076
  };
1077
- o.push(Y);
1077
+ o.push(X);
1078
1078
  }
1079
1079
  return o;
1080
1080
  }
@@ -1088,7 +1088,7 @@ class ce {
1088
1088
  return Math.random() * (e - t) + t;
1089
1089
  }
1090
1090
  }
1091
- class le {
1091
+ class ue {
1092
1092
  constructor(t, e = {}) {
1093
1093
  this.config = t, this.imageConfig = e;
1094
1094
  }
@@ -1100,47 +1100,47 @@ class le {
1100
1100
  * @returns Array of layout objects with position, rotation, scale
1101
1101
  */
1102
1102
  generate(t, e, i = {}) {
1103
- const o = [], { width: s, height: r } = e, a = i.fixedHeight ?? 200, l = this.imageConfig.rotation?.mode ?? "none", c = this.imageConfig.rotation?.range?.min ?? -15, u = this.imageConfig.rotation?.range?.max ?? 15, h = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1, f = h !== 1 || d !== 1, b = this.config.scaleDecay ?? 0, p = i.fixedHeight ?? a, g = s / 2, m = r / 2, E = Math.ceil(Math.sqrt(t));
1103
+ const o = [], { width: s, height: r } = e, a = i.fixedHeight ?? 200, h = this.imageConfig.rotation?.mode ?? "none", c = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, l = this.imageConfig.sizing?.variance?.min ?? 1, u = this.imageConfig.sizing?.variance?.max ?? 1, m = l !== 1 || u !== 1, b = this.config.scaleDecay ?? 0, p = i.fixedHeight ?? a, g = s / 2, f = r / 2, E = Math.ceil(Math.sqrt(t));
1104
1104
  if (t > 0) {
1105
- const S = f ? this.random(h, d) : 1, x = p * S;
1105
+ const w = m ? this.random(l, u) : 1, S = p * w;
1106
1106
  o.push({
1107
1107
  id: 0,
1108
1108
  x: g,
1109
- y: m,
1110
- rotation: l === "random" ? this.random(c * 0.33, u * 0.33) : 0,
1109
+ y: f,
1110
+ rotation: h === "random" ? this.random(c * 0.33, d * 0.33) : 0,
1111
1111
  // Less rotation for center
1112
- scale: S,
1113
- baseSize: x,
1112
+ scale: w,
1113
+ baseSize: S,
1114
1114
  zIndex: 100
1115
1115
  // Center image is highest
1116
1116
  });
1117
1117
  }
1118
- let v = 1, w = 1;
1118
+ let v = 1, x = 1;
1119
1119
  for (; v < t; ) {
1120
- const S = w / E, x = b > 0 ? 1 - S * b * 0.5 : 1, T = w * (p * 0.8), M = T * 1.5, z = Math.PI * (3 * (M + T) - Math.sqrt((3 * M + T) * (M + 3 * T))), P = this.estimateWidth(p), _ = Math.floor(z / (P * 0.7));
1121
- if (_ === 0) {
1122
- w++;
1120
+ const w = x / E, S = b > 0 ? 1 - w * b * 0.5 : 1, C = x * (p * 0.8), z = C * 1.5, F = Math.PI * (3 * (z + C) - Math.sqrt((3 * z + C) * (z + 3 * C))), H = this.estimateWidth(p), N = Math.floor(F / (H * 0.7));
1121
+ if (N === 0) {
1122
+ x++;
1123
1123
  continue;
1124
1124
  }
1125
- const Y = 2 * Math.PI / _, N = w * (20 * Math.PI / 180);
1126
- for (let R = 0; R < _ && v < t; R++) {
1127
- const D = R * Y + N, k = f ? this.random(h, d) : 1, H = x * k, A = p * H;
1128
- let C = g + Math.cos(D) * M, O = m + Math.sin(D) * T;
1129
- const $ = this.config.spacing.padding ?? 50, U = A * 1.5 / 2, L = A / 2;
1130
- C - U < $ ? C = $ + U : C + U > s - $ && (C = s - $ - U), O - L < $ ? O = $ + L : O + L > r - $ && (O = r - $ - L);
1131
- const W = l === "random" ? this.random(c, u) : 0;
1125
+ const X = 2 * Math.PI / N, W = x * (20 * Math.PI / 180);
1126
+ for (let T = 0; T < N && v < t; T++) {
1127
+ const D = T * X + W, G = m ? this.random(l, u) : 1, j = S * G, R = p * j;
1128
+ let M = g + Math.cos(D) * z, O = f + Math.sin(D) * C;
1129
+ const $ = this.config.spacing.padding ?? 50, P = R * 1.5 / 2, A = R / 2;
1130
+ M - P < $ ? M = $ + P : M + P > s - $ && (M = s - $ - P), O - A < $ ? O = $ + A : O + A > r - $ && (O = r - $ - A);
1131
+ const k = h === "random" ? this.random(c, d) : 0;
1132
1132
  o.push({
1133
1133
  id: v,
1134
- x: C,
1134
+ x: M,
1135
1135
  y: O,
1136
- rotation: W,
1137
- scale: H,
1138
- baseSize: A,
1139
- zIndex: Math.max(1, 100 - w)
1136
+ rotation: k,
1137
+ scale: j,
1138
+ baseSize: R,
1139
+ zIndex: Math.max(1, 100 - x)
1140
1140
  // Outer rings have lower z-index
1141
1141
  }), v++;
1142
1142
  }
1143
- w++;
1143
+ x++;
1144
1144
  }
1145
1145
  return o;
1146
1146
  }
@@ -1163,7 +1163,7 @@ class le {
1163
1163
  return Math.random() * (e - t) + t;
1164
1164
  }
1165
1165
  }
1166
- const he = {
1166
+ const de = {
1167
1167
  columns: "auto",
1168
1168
  rows: "auto",
1169
1169
  stagger: "none",
@@ -1173,7 +1173,7 @@ const he = {
1173
1173
  alignment: "center",
1174
1174
  gap: 10,
1175
1175
  overflowOffset: 0.25
1176
- }, It = [
1176
+ }, Tt = [
1177
1177
  { x: 1, y: 1 },
1178
1178
  // bottom-right
1179
1179
  { x: -1, y: -1 },
@@ -1191,7 +1191,7 @@ const he = {
1191
1191
  { x: 0, y: 1 }
1192
1192
  // down
1193
1193
  ];
1194
- class de {
1194
+ class ge {
1195
1195
  constructor(t, e = {}) {
1196
1196
  this.config = t, this.imageConfig = e;
1197
1197
  }
@@ -1203,65 +1203,65 @@ class de {
1203
1203
  * @returns Array of layout objects with position, rotation, scale
1204
1204
  */
1205
1205
  generate(t, e, i = {}) {
1206
- const o = [], { width: s, height: r } = e, a = { ...he, ...this.config.grid }, l = this.config.spacing.padding, c = i.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1, f = h !== 1 || d !== 1, b = s - 2 * l, p = r - 2 * l, { columns: g, rows: m } = this.calculateGridDimensions(
1206
+ const o = [], { width: s, height: r } = e, a = { ...de, ...this.config.grid }, h = this.config.spacing.padding, c = i.fixedHeight ?? 200, d = this.imageConfig.rotation?.mode ?? "none", l = this.imageConfig.sizing?.variance?.min ?? 1, u = this.imageConfig.sizing?.variance?.max ?? 1, m = l !== 1 || u !== 1, b = s - 2 * h, p = r - 2 * h, { columns: g, rows: f } = this.calculateGridDimensions(
1207
1207
  t,
1208
1208
  b,
1209
1209
  p,
1210
1210
  c,
1211
1211
  a
1212
- ), E = a.stagger === "row", v = a.stagger === "column", w = E ? g + 0.5 : g, S = v ? m + 0.5 : m, x = (b - a.gap * (g - 1)) / w, T = (p - a.gap * (m - 1)) / S, M = E ? x / 2 : 0, z = v ? T / 2 : 0, P = 1 + a.overlap, _ = Math.min(x, T) * P, Y = i.fixedHeight ? Math.min(i.fixedHeight, _) : _, N = g * x + (g - 1) * a.gap + M, R = m * T + (m - 1) * a.gap + z, D = l + (b - N) / 2, k = l + (p - R) / 2, H = g * m, A = a.columns !== "auto" && a.rows !== "auto", C = A && t > H;
1212
+ ), E = a.stagger === "row", v = a.stagger === "column", x = E ? g + 0.5 : g, w = v ? f + 0.5 : f, S = (b - a.gap * (g - 1)) / x, C = (p - a.gap * (f - 1)) / w, z = E ? S / 2 : 0, F = v ? C / 2 : 0, H = 1 + a.overlap, N = Math.min(S, C) * H, X = i.fixedHeight ? Math.min(i.fixedHeight, N) : N, W = g * S + (g - 1) * a.gap + z, T = f * C + (f - 1) * a.gap + F, D = h + (b - W) / 2, G = h + (p - T) / 2, j = g * f, R = a.columns !== "auto" && a.rows !== "auto", M = R && t > j;
1213
1213
  typeof window < "u" && (window.__gridOverflowDebug = {
1214
1214
  gridConfigColumns: a.columns,
1215
1215
  gridConfigRows: a.rows,
1216
1216
  columns: g,
1217
- rows: m,
1218
- cellCount: H,
1219
- hasFixedGrid: A,
1217
+ rows: f,
1218
+ cellCount: j,
1219
+ hasFixedGrid: R,
1220
1220
  imageCount: t,
1221
- isOverflowMode: C
1221
+ isOverflowMode: M
1222
1222
  });
1223
- const O = C ? new Array(H).fill(0) : [], $ = Math.min(x, T) * a.overflowOffset;
1224
- for (let F = 0; F < t; F++) {
1225
- let U, L, W = 0;
1226
- if (C && F >= H) {
1227
- const q = F - H, j = q % H;
1228
- W = Math.floor(q / H) + 1, O[j]++, a.fillDirection === "row" ? (U = j % g, L = Math.floor(j / g)) : (L = j % m, U = Math.floor(j / m));
1223
+ const O = M ? new Array(j).fill(0) : [], $ = Math.min(S, C) * a.overflowOffset;
1224
+ for (let L = 0; L < t; L++) {
1225
+ let P, A, k = 0;
1226
+ if (M && L >= j) {
1227
+ const q = L - j, U = q % j;
1228
+ k = Math.floor(q / j) + 1, O[U]++, a.fillDirection === "row" ? (P = U % g, A = Math.floor(U / g)) : (A = U % f, P = Math.floor(U / f));
1229
1229
  } else
1230
- a.fillDirection === "row" ? (U = F % g, L = Math.floor(F / g)) : (L = F % m, U = Math.floor(F / m));
1231
- let G = D + U * (x + a.gap) + x / 2, X = k + L * (T + a.gap) + T / 2;
1232
- if (a.stagger === "row" && L % 2 === 1 ? G += x / 2 : a.stagger === "column" && U % 2 === 1 && (X += T / 2), W > 0) {
1233
- const q = (W - 1) % It.length, j = It[q];
1234
- G += j.x * $, X += j.y * $;
1230
+ a.fillDirection === "row" ? (P = L % g, A = Math.floor(L / g)) : (A = L % f, P = Math.floor(L / f));
1231
+ let _ = D + P * (S + a.gap) + S / 2, Y = G + A * (C + a.gap) + C / 2;
1232
+ if (a.stagger === "row" && A % 2 === 1 ? _ += S / 2 : a.stagger === "column" && P % 2 === 1 && (Y += C / 2), k > 0) {
1233
+ const q = (k - 1) % Tt.length, U = Tt[q];
1234
+ _ += U.x * $, Y += U.y * $;
1235
1235
  }
1236
1236
  if (a.jitter > 0) {
1237
- const q = x / 2 * a.jitter, j = T / 2 * a.jitter;
1238
- G += this.random(-q, q), X += this.random(-j, j);
1237
+ const q = S / 2 * a.jitter, U = C / 2 * a.jitter;
1238
+ _ += this.random(-q, q), Y += this.random(-U, U);
1239
1239
  }
1240
- let B = G, J = X;
1241
- if (!C && a.fillDirection === "row") {
1240
+ let B = _, J = Y;
1241
+ if (!M && a.fillDirection === "row") {
1242
1242
  const q = t % g || g;
1243
- if (L === Math.floor((t - 1) / g) && q < g) {
1244
- const vt = q * x + (q - 1) * a.gap;
1245
- let gt = 0;
1246
- a.alignment === "center" ? gt = (N - vt) / 2 : a.alignment === "end" && (gt = N - vt), B += gt;
1243
+ if (A === Math.floor((t - 1) / g) && q < g) {
1244
+ const St = q * S + (q - 1) * a.gap;
1245
+ let ft = 0;
1246
+ a.alignment === "center" ? ft = (W - St) / 2 : a.alignment === "end" && (ft = W - St), B += ft;
1247
1247
  }
1248
1248
  }
1249
- const rt = f ? this.random(h, d) : 1, K = Y * rt, it = K * 1.5 / 2, nt = K / 2, lt = l + it, ht = s - l - it, Ft = l + nt, Dt = r - l - nt;
1250
- B = Math.max(lt, Math.min(B, ht)), J = Math.max(Ft, Math.min(J, Dt));
1251
- let dt = 0;
1252
- if (u === "random") {
1253
- const q = this.imageConfig.rotation?.range?.min ?? -15, j = this.imageConfig.rotation?.range?.max ?? 15;
1254
- a.jitter > 0 ? dt = this.random(q * a.jitter, j * a.jitter) : dt = this.random(q, j);
1249
+ const lt = m ? this.random(l, u) : 1, Q = X * lt, ot = Q * 1.5 / 2, st = Q / 2, ut = h + ot, dt = s - h - ot, Ot = h + st, $t = r - h - st;
1250
+ B = Math.max(ut, Math.min(B, dt)), J = Math.max(Ot, Math.min(J, $t));
1251
+ let gt = 0;
1252
+ if (d === "random") {
1253
+ const q = this.imageConfig.rotation?.range?.min ?? -15, U = this.imageConfig.rotation?.range?.max ?? 15;
1254
+ a.jitter > 0 ? gt = this.random(q * a.jitter, U * a.jitter) : gt = this.random(q, U);
1255
1255
  }
1256
- let ut;
1257
- C && W > 0 ? ut = 50 - W : ut = C ? 100 + F : F + 1, o.push({
1258
- id: F,
1256
+ let mt;
1257
+ M && k > 0 ? mt = 50 - k : mt = M ? 100 + L : L + 1, o.push({
1258
+ id: L,
1259
1259
  x: B,
1260
1260
  y: J,
1261
- rotation: dt,
1262
- scale: rt,
1263
- baseSize: K,
1264
- zIndex: ut
1261
+ rotation: gt,
1262
+ scale: lt,
1263
+ baseSize: Q,
1264
+ zIndex: mt
1265
1265
  });
1266
1266
  }
1267
1267
  return o;
@@ -1278,8 +1278,8 @@ class de {
1278
1278
  else if (s.rows !== "auto")
1279
1279
  a = s.rows, r = Math.ceil(t / a);
1280
1280
  else {
1281
- const l = e / i;
1282
- for (r = Math.max(1, Math.round(Math.sqrt(t * l / 1.4))), a = Math.ceil(t / r); r > 1 && (r - 1) * a >= t; )
1281
+ const h = e / i;
1282
+ for (r = Math.max(1, Math.round(Math.sqrt(t * h / 1.4))), a = Math.ceil(t / r); r > 1 && (r - 1) * a >= t; )
1283
1283
  r--;
1284
1284
  }
1285
1285
  return { columns: Math.max(1, r), rows: Math.max(1, a) };
@@ -1291,14 +1291,14 @@ class de {
1291
1291
  return Math.random() * (e - t) + t;
1292
1292
  }
1293
1293
  }
1294
- const ue = Math.PI * (3 - Math.sqrt(5)), ge = {
1294
+ const me = Math.PI * (3 - Math.sqrt(5)), fe = {
1295
1295
  spiralType: "golden",
1296
1296
  direction: "counterclockwise",
1297
1297
  tightness: 1,
1298
1298
  scaleDecay: 0,
1299
1299
  startAngle: 0
1300
1300
  };
1301
- class fe {
1301
+ class pe {
1302
1302
  constructor(t, e = {}) {
1303
1303
  this.config = t, this.imageConfig = e;
1304
1304
  }
@@ -1310,36 +1310,36 @@ class fe {
1310
1310
  * @returns Array of layout objects with position, rotation, scale
1311
1311
  */
1312
1312
  generate(t, e, i = {}) {
1313
- const o = [], { width: s, height: r } = e, a = { ...ge, ...this.config.spiral }, l = this.config.spacing.padding, c = i.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, f = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = f !== 1 || b !== 1, g = this.config.scaleDecay ?? a.scaleDecay, m = s / 2, E = r / 2, v = Math.min(
1314
- m - l - c / 2,
1315
- E - l - c / 2
1316
- ), w = a.direction === "clockwise" ? -1 : 1;
1317
- for (let S = 0; S < t; S++) {
1318
- let x, T;
1313
+ const o = [], { width: s, height: r } = e, a = { ...fe, ...this.config.spiral }, h = this.config.spacing.padding, c = i.fixedHeight ?? 200, d = this.imageConfig.rotation?.mode ?? "none", l = this.imageConfig.rotation?.range?.min ?? -15, u = this.imageConfig.rotation?.range?.max ?? 15, m = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = m !== 1 || b !== 1, g = this.config.scaleDecay ?? a.scaleDecay, f = s / 2, E = r / 2, v = Math.min(
1314
+ f - h - c / 2,
1315
+ E - h - c / 2
1316
+ ), x = a.direction === "clockwise" ? -1 : 1;
1317
+ for (let w = 0; w < t; w++) {
1318
+ let S, C;
1319
1319
  if (a.spiralType === "golden")
1320
- x = S * ue * w + a.startAngle, T = this.calculateGoldenRadius(S, t, v, a.tightness);
1320
+ S = w * me * x + a.startAngle, C = this.calculateGoldenRadius(w, t, v, a.tightness);
1321
1321
  else if (a.spiralType === "archimedean") {
1322
- const G = S * 0.5 * a.tightness;
1323
- x = G * w + a.startAngle, T = this.calculateArchimedeanRadius(G, t, v, a.tightness);
1322
+ const _ = w * 0.5 * a.tightness;
1323
+ S = _ * x + a.startAngle, C = this.calculateArchimedeanRadius(_, t, v, a.tightness);
1324
1324
  } else {
1325
- const G = S * 0.3 * a.tightness;
1326
- x = G * w + a.startAngle, T = this.calculateLogarithmicRadius(G, t, v, a.tightness);
1325
+ const _ = w * 0.3 * a.tightness;
1326
+ S = _ * x + a.startAngle, C = this.calculateLogarithmicRadius(_, t, v, a.tightness);
1327
1327
  }
1328
- const M = m + Math.cos(x) * T, z = E + Math.sin(x) * T, P = T / v, _ = g > 0 ? 1 - P * g * 0.5 : 1, Y = p ? this.random(f, b) : 1, N = _ * Y, R = c * N, k = R * 1.5 / 2, H = R / 2, A = l + k, C = s - l - k, O = l + H, $ = r - l - H, F = Math.max(A, Math.min(M, C)), U = Math.max(O, Math.min(z, $));
1329
- let L = 0;
1330
- if (u === "random") {
1331
- const G = x * 180 / Math.PI % 360, X = this.random(h, d);
1332
- L = a.spiralType === "golden" ? X : G * 0.1 + X * 0.9;
1333
- } else u === "tangent" && (L = this.calculateSpiralTangent(x, T, a));
1334
- const W = t - S;
1328
+ const z = f + Math.cos(S) * C, F = E + Math.sin(S) * C, H = C / v, N = g > 0 ? 1 - H * g * 0.5 : 1, X = p ? this.random(m, b) : 1, W = N * X, T = c * W, G = T * 1.5 / 2, j = T / 2, R = h + G, M = s - h - G, O = h + j, $ = r - h - j, L = Math.max(R, Math.min(z, M)), P = Math.max(O, Math.min(F, $));
1329
+ let A = 0;
1330
+ if (d === "random") {
1331
+ const _ = S * 180 / Math.PI % 360, Y = this.random(l, u);
1332
+ A = a.spiralType === "golden" ? Y : _ * 0.1 + Y * 0.9;
1333
+ } else d === "tangent" && (A = this.calculateSpiralTangent(S, C, a));
1334
+ const k = t - w;
1335
1335
  o.push({
1336
- id: S,
1337
- x: F,
1338
- y: U,
1339
- rotation: L,
1340
- scale: N,
1341
- baseSize: R,
1342
- zIndex: W
1336
+ id: w,
1337
+ x: L,
1338
+ y: P,
1339
+ rotation: A,
1340
+ scale: W,
1341
+ baseSize: T,
1342
+ zIndex: k
1343
1343
  });
1344
1344
  }
1345
1345
  return o;
@@ -1382,7 +1382,7 @@ class fe {
1382
1382
  * r = a * e^(b*θ)
1383
1383
  */
1384
1384
  calculateLogarithmicRadius(t, e, i, o) {
1385
- const s = i * 0.05, r = 0.15 / o, a = s * Math.exp(r * t), l = e * 0.3 * o, c = s * Math.exp(r * l);
1385
+ const s = i * 0.05, r = 0.15 / o, a = s * Math.exp(r * t), h = e * 0.3 * o, c = s * Math.exp(r * h);
1386
1386
  return a / c * i;
1387
1387
  }
1388
1388
  /**
@@ -1392,7 +1392,7 @@ class fe {
1392
1392
  return Math.random() * (e - t) + t;
1393
1393
  }
1394
1394
  }
1395
- const me = {
1395
+ const be = {
1396
1396
  clusterCount: "auto",
1397
1397
  clusterSpread: 150,
1398
1398
  clusterSpacing: 200,
@@ -1400,7 +1400,7 @@ const me = {
1400
1400
  overlap: 0.3,
1401
1401
  distribution: "gaussian"
1402
1402
  };
1403
- class pe {
1403
+ class ye {
1404
1404
  constructor(t, e = {}) {
1405
1405
  this.config = t, this.imageConfig = e;
1406
1406
  }
@@ -1412,47 +1412,47 @@ class pe {
1412
1412
  * @returns Array of layout objects with position, rotation, scale
1413
1413
  */
1414
1414
  generate(t, e, i = {}) {
1415
- const o = [], { width: s, height: r } = e, a = { ...me, ...this.config.cluster }, l = this.config.spacing.padding, c = i.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, f = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = f !== 1 || b !== 1, g = this.calculateClusterCount(
1415
+ const o = [], { width: s, height: r } = e, a = { ...be, ...this.config.cluster }, h = this.config.spacing.padding, c = i.fixedHeight ?? 200, d = this.imageConfig.rotation?.mode ?? "none", l = this.imageConfig.rotation?.range?.min ?? -15, u = this.imageConfig.rotation?.range?.max ?? 15, m = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = m !== 1 || b !== 1, g = this.calculateClusterCount(
1416
1416
  t,
1417
1417
  a.clusterCount,
1418
1418
  s,
1419
1419
  r,
1420
1420
  a.clusterSpacing
1421
- ), m = this.generateClusterCenters(
1421
+ ), f = this.generateClusterCenters(
1422
1422
  g,
1423
1423
  s,
1424
1424
  r,
1425
- l,
1425
+ h,
1426
1426
  a
1427
1427
  ), E = new Array(g).fill(0);
1428
- for (let w = 0; w < t; w++)
1429
- E[w % g]++;
1428
+ for (let x = 0; x < t; x++)
1429
+ E[x % g]++;
1430
1430
  let v = 0;
1431
- for (let w = 0; w < g; w++) {
1432
- const S = m[w], x = E[w];
1433
- for (let T = 0; T < x; T++) {
1434
- let M, z;
1431
+ for (let x = 0; x < g; x++) {
1432
+ const w = f[x], S = E[x];
1433
+ for (let C = 0; C < S; C++) {
1434
+ let z, F;
1435
1435
  if (a.distribution === "gaussian")
1436
- M = this.gaussianRandom() * S.spread, z = this.gaussianRandom() * S.spread;
1436
+ z = this.gaussianRandom() * w.spread, F = this.gaussianRandom() * w.spread;
1437
1437
  else {
1438
- const L = this.random(0, Math.PI * 2), W = this.random(0, S.spread);
1439
- M = Math.cos(L) * W, z = Math.sin(L) * W;
1438
+ const A = this.random(0, Math.PI * 2), k = this.random(0, w.spread);
1439
+ z = Math.cos(A) * k, F = Math.sin(A) * k;
1440
1440
  }
1441
- const P = 1 + a.overlap * 0.5, _ = 1 + a.overlap * 0.3;
1442
- M /= P, z /= P;
1443
- const Y = p ? this.random(f, b) : 1, N = _ * Y, R = c * N;
1444
- let D = S.x + M, k = S.y + z;
1445
- const A = R * 1.5 / 2, C = R / 2;
1446
- D = Math.max(l + A, Math.min(D, s - l - A)), k = Math.max(l + C, Math.min(k, r - l - C));
1447
- const O = u === "random" ? this.random(h, d) : 0, F = Math.sqrt(M * M + z * z) / S.spread, U = Math.round((1 - F) * 50) + 1;
1441
+ const H = 1 + a.overlap * 0.5, N = 1 + a.overlap * 0.3;
1442
+ z /= H, F /= H;
1443
+ const X = p ? this.random(m, b) : 1, W = N * X, T = c * W;
1444
+ let D = w.x + z, G = w.y + F;
1445
+ const R = T * 1.5 / 2, M = T / 2;
1446
+ D = Math.max(h + R, Math.min(D, s - h - R)), G = Math.max(h + M, Math.min(G, r - h - M));
1447
+ const O = d === "random" ? this.random(l, u) : 0, L = Math.sqrt(z * z + F * F) / w.spread, P = Math.round((1 - L) * 50) + 1;
1448
1448
  o.push({
1449
1449
  id: v,
1450
1450
  x: D,
1451
- y: k,
1451
+ y: G,
1452
1452
  rotation: O,
1453
- scale: N,
1454
- baseSize: R,
1455
- zIndex: U
1453
+ scale: W,
1454
+ baseSize: T,
1455
+ zIndex: P
1456
1456
  }), v++;
1457
1457
  }
1458
1458
  }
@@ -1464,33 +1464,33 @@ class pe {
1464
1464
  calculateClusterCount(t, e, i, o, s) {
1465
1465
  if (e !== "auto")
1466
1466
  return Math.max(1, Math.min(e, t));
1467
- const a = Math.max(1, Math.ceil(t / 8)), l = Math.floor(
1467
+ const a = Math.max(1, Math.ceil(t / 8)), h = Math.floor(
1468
1468
  i / s * (o / s) * 0.6
1469
1469
  );
1470
- return Math.max(1, Math.min(a, l, 10));
1470
+ return Math.max(1, Math.min(a, h, 10));
1471
1471
  }
1472
1472
  /**
1473
1473
  * Generate cluster center positions with spacing constraints
1474
1474
  */
1475
1475
  generateClusterCenters(t, e, i, o, s) {
1476
- const r = [], l = o + s.clusterSpread, c = e - o - s.clusterSpread, u = o + s.clusterSpread, h = i - o - s.clusterSpread;
1477
- for (let d = 0; d < t; d++) {
1478
- let f = null, b = -1;
1476
+ const r = [], h = o + s.clusterSpread, c = e - o - s.clusterSpread, d = o + s.clusterSpread, l = i - o - s.clusterSpread;
1477
+ for (let u = 0; u < t; u++) {
1478
+ let m = null, b = -1;
1479
1479
  for (let p = 0; p < 100; p++) {
1480
1480
  const g = {
1481
- x: this.random(l, c),
1482
- y: this.random(u, h),
1481
+ x: this.random(h, c),
1482
+ y: this.random(d, l),
1483
1483
  spread: this.calculateClusterSpread(s)
1484
1484
  };
1485
- let m = 1 / 0;
1485
+ let f = 1 / 0;
1486
1486
  for (const E of r) {
1487
- const v = g.x - E.x, w = g.y - E.y, S = Math.sqrt(v * v + w * w);
1488
- m = Math.min(m, S);
1487
+ const v = g.x - E.x, x = g.y - E.y, w = Math.sqrt(v * v + x * x);
1488
+ f = Math.min(f, w);
1489
1489
  }
1490
- if ((r.length === 0 || m > b) && (f = g, b = m), m >= s.clusterSpacing)
1490
+ if ((r.length === 0 || f > b) && (m = g, b = f), f >= s.clusterSpacing)
1491
1491
  break;
1492
1492
  }
1493
- f && r.push(f);
1493
+ m && r.push(m);
1494
1494
  }
1495
1495
  return r;
1496
1496
  }
@@ -1518,7 +1518,7 @@ class pe {
1518
1518
  return Math.random() * (e - t) + t;
1519
1519
  }
1520
1520
  }
1521
- class be {
1521
+ class ve {
1522
1522
  constructor(t, e = {}) {
1523
1523
  this.config = t, this.imageConfig = e;
1524
1524
  }
@@ -1530,29 +1530,29 @@ class be {
1530
1530
  * @returns Array of layout objects with position, rotation, scale
1531
1531
  */
1532
1532
  generate(t, e, i = {}) {
1533
- const o = [], { width: s, height: r } = e, a = i.fixedHeight ?? 200, l = this.config.spacing.padding ?? 50, c = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, h = this.imageConfig.rotation?.range?.max ?? 15, d = this.imageConfig.sizing?.variance?.min ?? 1, f = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || f !== 1, p = i.fixedHeight ?? a, g = {
1534
- ..._t,
1533
+ const o = [], { width: s, height: r } = e, a = i.fixedHeight ?? 200, h = this.config.spacing.padding ?? 50, c = this.imageConfig.rotation?.mode ?? "none", d = this.imageConfig.rotation?.range?.min ?? -15, l = this.imageConfig.rotation?.range?.max ?? 15, u = this.imageConfig.sizing?.variance?.min ?? 1, m = this.imageConfig.sizing?.variance?.max ?? 1, b = u !== 1 || m !== 1, p = i.fixedHeight ?? a, g = {
1534
+ ...Wt,
1535
1535
  ...this.config.wave
1536
- }, { rows: m, amplitude: E, frequency: v, phaseShift: w, synchronization: S } = g, x = Math.ceil(t / m), z = p * 1.5 / 2, P = l + z, _ = s - l - z, Y = _ - P, N = x > 1 ? Y / (x - 1) : 0, R = l + E + p / 2, D = r - l - E - p / 2, k = D - R, H = m > 1 ? k / (m - 1) : 0;
1537
- let A = 0;
1538
- for (let C = 0; C < m && A < t; C++) {
1539
- const O = m === 1 ? (R + D) / 2 : R + C * H;
1536
+ }, { rows: f, amplitude: E, frequency: v, phaseShift: x, synchronization: w } = g, S = Math.ceil(t / f), F = p * 1.5 / 2, H = h + F, N = s - h - F, X = N - H, W = S > 1 ? X / (S - 1) : 0, T = h + E + p / 2, D = r - h - E - p / 2, G = D - T, j = f > 1 ? G / (f - 1) : 0;
1537
+ let R = 0;
1538
+ for (let M = 0; M < f && R < t; M++) {
1539
+ const O = f === 1 ? (T + D) / 2 : T + M * j;
1540
1540
  let $ = 0;
1541
- S === "offset" ? $ = C * w : S === "alternating" && ($ = C * Math.PI);
1542
- for (let F = 0; F < x && A < t; F++) {
1543
- const U = x === 1 ? (P + _) / 2 : P + F * N, L = this.calculateWaveY(U, s, E, v, $), W = U, G = O + L, X = b ? this.random(d, f) : 1, B = p * X;
1541
+ w === "offset" ? $ = M * x : w === "alternating" && ($ = M * Math.PI);
1542
+ for (let L = 0; L < S && R < t; L++) {
1543
+ const P = S === 1 ? (H + N) / 2 : H + L * W, A = this.calculateWaveY(P, s, E, v, $), k = P, _ = O + A, Y = b ? this.random(u, m) : 1, B = p * Y;
1544
1544
  let J = 0;
1545
- c === "tangent" ? J = this.calculateRotation(U, s, E, v, $) : c === "random" && (J = this.random(u, h));
1546
- const K = B * 1.5 / 2, ct = B / 2, it = l + K, nt = s - l - K, lt = l + ct, ht = r - l - ct;
1545
+ c === "tangent" ? J = this.calculateRotation(P, s, E, v, $) : c === "random" && (J = this.random(d, l));
1546
+ const Q = B * 1.5 / 2, ht = B / 2, ot = h + Q, st = s - h - Q, ut = h + ht, dt = r - h - ht;
1547
1547
  o.push({
1548
- id: A,
1549
- x: Math.max(it, Math.min(W, nt)),
1550
- y: Math.max(lt, Math.min(G, ht)),
1548
+ id: R,
1549
+ x: Math.max(ot, Math.min(k, st)),
1550
+ y: Math.max(ut, Math.min(_, dt)),
1551
1551
  rotation: J,
1552
- scale: X,
1552
+ scale: Y,
1553
1553
  baseSize: B,
1554
- zIndex: A + 1
1555
- }), A++;
1554
+ zIndex: R + 1
1555
+ }), R++;
1556
1556
  }
1557
1557
  }
1558
1558
  return o;
@@ -1595,7 +1595,7 @@ class be {
1595
1595
  return Math.random() * (e - t) + t;
1596
1596
  }
1597
1597
  }
1598
- class ye {
1598
+ class xe {
1599
1599
  constructor(t) {
1600
1600
  this.config = t.layout, this.imageConfig = t.image, this.layouts = /* @__PURE__ */ new Map(), this.placementLayout = this.initLayout();
1601
1601
  }
@@ -1606,17 +1606,17 @@ class ye {
1606
1606
  initLayout() {
1607
1607
  switch (this.config.algorithm) {
1608
1608
  case "radial":
1609
- return new le(this.config, this.imageConfig);
1609
+ return new ue(this.config, this.imageConfig);
1610
1610
  case "grid":
1611
- return new de(this.config, this.imageConfig);
1611
+ return new ge(this.config, this.imageConfig);
1612
1612
  case "spiral":
1613
- return new fe(this.config, this.imageConfig);
1614
- case "cluster":
1615
1613
  return new pe(this.config, this.imageConfig);
1614
+ case "cluster":
1615
+ return new ye(this.config, this.imageConfig);
1616
1616
  case "wave":
1617
- return new be(this.config, this.imageConfig);
1617
+ return new ve(this.config, this.imageConfig);
1618
1618
  default:
1619
- return new ce(this.config, this.imageConfig);
1619
+ return new he(this.config, this.imageConfig);
1620
1620
  }
1621
1621
  }
1622
1622
  /**
@@ -1698,13 +1698,13 @@ class ye {
1698
1698
  const s = this.imageConfig.sizing, r = this.resolveBaseHeight(o);
1699
1699
  if (r !== void 0)
1700
1700
  return { height: r };
1701
- const a = s?.minSize ?? 50, l = s?.maxSize ?? 400, c = this.config.targetCoverage ?? 0.6, u = this.config.densityFactor ?? 1, { width: h, height: d } = t, p = h * d * c / e;
1702
- let m = Math.sqrt(p / 1.4);
1703
- m *= u, m = Math.min(m, i);
1704
- let E = this.clamp(m, a, l);
1705
- if (E === a && m < a) {
1701
+ const a = s?.minSize ?? 50, h = s?.maxSize ?? 400, c = this.config.targetCoverage ?? 0.6, d = this.config.densityFactor ?? 1, { width: l, height: u } = t, p = l * u * c / e;
1702
+ let f = Math.sqrt(p / 1.4);
1703
+ f *= d, f = Math.min(f, i);
1704
+ let E = this.clamp(f, a, h);
1705
+ if (E === a && f < a) {
1706
1706
  const v = Math.max(a * 0.05, 20);
1707
- E = Math.max(v, m);
1707
+ E = Math.max(v, f);
1708
1708
  }
1709
1709
  return { height: E };
1710
1710
  }
@@ -1715,14 +1715,48 @@ class ye {
1715
1715
  return Math.max(e, Math.min(i, t));
1716
1716
  }
1717
1717
  }
1718
+ const Z = class Z {
1719
+ /**
1720
+ * Register a loader implementation with the registry
1721
+ * @param name - Loader identifier (e.g., 'static', 'google-drive', 'composite')
1722
+ * @param Loader - Loader class constructor to register
1723
+ */
1724
+ static registerLoader(t, e) {
1725
+ Z.registry.set(t, e);
1726
+ }
1727
+ /**
1728
+ * Get a registered loader implementation
1729
+ * @param name - Loader identifier
1730
+ * @returns Loader class constructor
1731
+ * @throws Error if loader is not registered
1732
+ */
1733
+ static getLoader(t) {
1734
+ const e = Z.registry.get(t);
1735
+ if (!e)
1736
+ throw new Error(
1737
+ `Loader "${t}" is not registered. Import "@frybynite/image-cloud/loaders/${t}" or "@frybynite/image-cloud/loaders/all".`
1738
+ );
1739
+ return e;
1740
+ }
1741
+ /**
1742
+ * Check if a loader is registered
1743
+ * @param name - Loader identifier
1744
+ * @returns True if the loader is registered, false otherwise
1745
+ */
1746
+ static isRegistered(t) {
1747
+ return Z.registry.has(t);
1748
+ }
1749
+ };
1750
+ Z.registry = /* @__PURE__ */ new Map();
1751
+ let et = Z;
1718
1752
  var I = /* @__PURE__ */ ((n) => (n.IDLE = "idle", n.FOCUSING = "focusing", n.FOCUSED = "focused", n.UNFOCUSING = "unfocusing", n.CROSS_ANIMATING = "cross_animating", n))(I || {});
1719
- function ve(n) {
1720
- return n in ft;
1753
+ function Se(n) {
1754
+ return n in pt;
1721
1755
  }
1722
- function we(n) {
1723
- return n ? ve(n) ? ft[n] : n : ft.md;
1756
+ function Ee(n) {
1757
+ return n ? Se(n) ? pt[n] : n : pt.md;
1724
1758
  }
1725
- function xe(n) {
1759
+ function we(n) {
1726
1760
  if (!n) return "";
1727
1761
  const t = [];
1728
1762
  if (n.grayscale !== void 0 && t.push(`grayscale(${n.grayscale})`), n.blur !== void 0 && t.push(`blur(${n.blur}px)`), n.brightness !== void 0 && t.push(`brightness(${n.brightness})`), n.contrast !== void 0 && t.push(`contrast(${n.contrast})`), n.saturate !== void 0 && t.push(`saturate(${n.saturate})`), n.opacity !== void 0 && t.push(`opacity(${n.opacity})`), n.sepia !== void 0 && t.push(`sepia(${n.sepia})`), n.hueRotate !== void 0 && t.push(`hue-rotate(${n.hueRotate}deg)`), n.invert !== void 0 && t.push(`invert(${n.invert})`), n.dropShadow !== void 0)
@@ -1734,13 +1768,13 @@ function xe(n) {
1734
1768
  }
1735
1769
  return t.join(" ");
1736
1770
  }
1737
- function Q(n) {
1771
+ function tt(n) {
1738
1772
  if (!n || n.style === "none" || n.width === 0)
1739
1773
  return "none";
1740
1774
  const t = n.width ?? 0, e = n.style ?? "solid", i = n.color ?? "#000000";
1741
1775
  return `${t}px ${e} ${i}`;
1742
1776
  }
1743
- function st(n) {
1777
+ function rt(n) {
1744
1778
  if (!n) return {};
1745
1779
  const t = {};
1746
1780
  if (n.borderRadiusTopLeft !== void 0 || n.borderRadiusTopRight !== void 0 || n.borderRadiusBottomRight !== void 0 || n.borderRadiusBottomLeft !== void 0) {
@@ -1748,42 +1782,42 @@ function st(n) {
1748
1782
  n.borderRadiusTopLeft !== void 0 ? t.borderTopLeftRadius = `${n.borderRadiusTopLeft}px` : s && (t.borderTopLeftRadius = `${s}px`), n.borderRadiusTopRight !== void 0 ? t.borderTopRightRadius = `${n.borderRadiusTopRight}px` : s && (t.borderTopRightRadius = `${s}px`), n.borderRadiusBottomRight !== void 0 ? t.borderBottomRightRadius = `${n.borderRadiusBottomRight}px` : s && (t.borderBottomRightRadius = `${s}px`), n.borderRadiusBottomLeft !== void 0 ? t.borderBottomLeftRadius = `${n.borderRadiusBottomLeft}px` : s && (t.borderBottomLeftRadius = `${s}px`);
1749
1783
  } else n.border?.radius !== void 0 && (t.borderRadius = `${n.border.radius}px`);
1750
1784
  if (n.borderTop || n.borderRight || n.borderBottom || n.borderLeft) {
1751
- const s = n.border || {}, r = { ...s, ...n.borderTop }, a = { ...s, ...n.borderRight }, l = { ...s, ...n.borderBottom }, c = { ...s, ...n.borderLeft };
1752
- t.borderTop = Q(r), t.borderRight = Q(a), t.borderBottom = Q(l), t.borderLeft = Q(c);
1753
- } else n.border && (t.border = Q(n.border));
1754
- n.shadow !== void 0 && (t.boxShadow = we(n.shadow));
1755
- const o = xe(n.filter);
1785
+ const s = n.border || {}, r = { ...s, ...n.borderTop }, a = { ...s, ...n.borderRight }, h = { ...s, ...n.borderBottom }, c = { ...s, ...n.borderLeft };
1786
+ t.borderTop = tt(r), t.borderRight = tt(a), t.borderBottom = tt(h), t.borderLeft = tt(c);
1787
+ } else n.border && (t.border = tt(n.border));
1788
+ n.shadow !== void 0 && (t.boxShadow = Ee(n.shadow));
1789
+ const o = we(n.filter);
1756
1790
  if (t.filter = o || "none", n.opacity !== void 0 && (t.opacity = String(n.opacity)), n.cursor !== void 0 && (t.cursor = n.cursor), n.outline && n.outline.style !== "none" && (n.outline.width ?? 0) > 0) {
1757
1791
  const s = n.outline.width ?? 0, r = n.outline.style ?? "solid", a = n.outline.color ?? "#000000";
1758
1792
  t.outline = `${s}px ${r} ${a}`, n.outline.offset !== void 0 && (t.outlineOffset = `${n.outline.offset}px`);
1759
1793
  }
1760
1794
  return n.objectFit !== void 0 && (t.objectFit = n.objectFit), n.aspectRatio !== void 0 && (t.aspectRatio = n.aspectRatio), t;
1761
1795
  }
1762
- function tt(n, t) {
1796
+ function it(n, t) {
1763
1797
  t.borderRadius !== void 0 && (n.style.borderRadius = t.borderRadius), t.borderTopLeftRadius !== void 0 && (n.style.borderTopLeftRadius = t.borderTopLeftRadius), t.borderTopRightRadius !== void 0 && (n.style.borderTopRightRadius = t.borderTopRightRadius), t.borderBottomRightRadius !== void 0 && (n.style.borderBottomRightRadius = t.borderBottomRightRadius), t.borderBottomLeftRadius !== void 0 && (n.style.borderBottomLeftRadius = t.borderBottomLeftRadius), t.border !== void 0 && (n.style.border = t.border), t.borderTop !== void 0 && (n.style.borderTop = t.borderTop), t.borderRight !== void 0 && (n.style.borderRight = t.borderRight), t.borderBottom !== void 0 && (n.style.borderBottom = t.borderBottom), t.borderLeft !== void 0 && (n.style.borderLeft = t.borderLeft), t.boxShadow !== void 0 && (n.style.boxShadow = t.boxShadow), t.filter !== void 0 && (n.style.filter = t.filter), t.opacity !== void 0 && (n.style.opacity = t.opacity), t.cursor !== void 0 && (n.style.cursor = t.cursor), t.outline !== void 0 && (n.style.outline = t.outline), t.outlineOffset !== void 0 && (n.style.outlineOffset = t.outlineOffset), t.objectFit !== void 0 && (n.style.objectFit = t.objectFit), t.aspectRatio !== void 0 && (n.style.aspectRatio = t.aspectRatio);
1764
1798
  }
1765
- function Mt(n) {
1799
+ function Lt(n) {
1766
1800
  return n ? Array.isArray(n) ? n.join(" ") : n : "";
1767
1801
  }
1768
- function et(n, t) {
1769
- const e = Mt(t);
1802
+ function nt(n, t) {
1803
+ const e = Lt(t);
1770
1804
  e && e.split(" ").forEach((i) => {
1771
1805
  i.trim() && n.classList.add(i.trim());
1772
1806
  });
1773
1807
  }
1774
- function zt(n, t) {
1775
- const e = Mt(t);
1808
+ function Dt(n, t) {
1809
+ const e = Lt(t);
1776
1810
  e && e.split(" ").forEach((i) => {
1777
1811
  i.trim() && n.classList.remove(i.trim());
1778
1812
  });
1779
1813
  }
1780
- const Tt = {
1814
+ const Mt = {
1781
1815
  UNFOCUSING: 999,
1782
1816
  FOCUSING: 1e3
1783
1817
  };
1784
- class Ee {
1818
+ class Ie {
1785
1819
  constructor(t, e, i) {
1786
- this.state = I.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null, this.focusGeneration = 0, this.config = t, this.animationEngine = e, this.defaultStyles = st(i?.default), this.focusedStyles = st(i?.focused), this.defaultClassName = i?.default?.className, this.focusedClassName = i?.focused?.className;
1820
+ this.state = I.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null, this.focusGeneration = 0, this.config = t, this.animationEngine = e, this.defaultStyles = rt(i?.default), this.focusedStyles = rt(i?.focused), this.defaultClassName = i?.default?.className, this.focusedClassName = i?.focused?.className;
1787
1821
  }
1788
1822
  /**
1789
1823
  * Get current state machine state
@@ -1809,9 +1843,9 @@ class Ee {
1809
1843
  */
1810
1844
  calculateFocusDimensions(t, e, i) {
1811
1845
  const o = this.normalizeScalePercent(this.config.scalePercent), s = i.height * o, r = t / e;
1812
- let a = s, l = a * r;
1846
+ let a = s, h = a * r;
1813
1847
  const c = i.width * o;
1814
- return l > c && (l = c, a = l / r), { width: l, height: a };
1848
+ return h > c && (h = c, a = h / r), { width: h, height: a };
1815
1849
  }
1816
1850
  /**
1817
1851
  * Calculate the transform needed to center an image (position only, no scale)
@@ -1842,8 +1876,8 @@ class Ee {
1842
1876
  * Create a Web Animation that animates both transform (position) and dimensions
1843
1877
  * This provides sharper zoom by re-rendering at target size instead of scaling pixels
1844
1878
  */
1845
- animateWithDimensions(t, e, i, o, s, r, a, l) {
1846
- const c = this.buildDimensionZoomTransform(e), u = this.buildDimensionZoomTransform(i);
1879
+ animateWithDimensions(t, e, i, o, s, r, a, h) {
1880
+ const c = this.buildDimensionZoomTransform(e), d = this.buildDimensionZoomTransform(i);
1847
1881
  return t.style.transition = "none", t.animate(
1848
1882
  [
1849
1883
  {
@@ -1852,13 +1886,13 @@ class Ee {
1852
1886
  height: `${s}px`
1853
1887
  },
1854
1888
  {
1855
- transform: u,
1889
+ transform: d,
1856
1890
  width: `${r}px`,
1857
1891
  height: `${a}px`
1858
1892
  }
1859
1893
  ],
1860
1894
  {
1861
- duration: l,
1895
+ duration: h,
1862
1896
  easing: "cubic-bezier(0.4, 0, 0.2, 1)",
1863
1897
  fill: "forwards"
1864
1898
  }
@@ -1868,13 +1902,13 @@ class Ee {
1868
1902
  * Apply focused styling to an element
1869
1903
  */
1870
1904
  applyFocusedStyling(t, e) {
1871
- t.style.zIndex = String(e), t.classList.add("fbn-ic-focused"), tt(t, this.focusedStyles), et(t, this.focusedClassName);
1905
+ t.style.zIndex = String(e), t.classList.add("fbn-ic-focused"), it(t, this.focusedStyles), nt(t, this.focusedClassName);
1872
1906
  }
1873
1907
  /**
1874
1908
  * Remove focused styling from an element
1875
1909
  */
1876
1910
  removeFocusedStyling(t, e) {
1877
- t.style.zIndex = e, t.classList.remove("fbn-ic-focused"), zt(t, this.focusedClassName), tt(t, this.defaultStyles), et(t, this.defaultClassName);
1911
+ t.style.zIndex = e, t.classList.remove("fbn-ic-focused"), Dt(t, this.focusedClassName), it(t, this.defaultStyles), nt(t, this.defaultClassName);
1878
1912
  }
1879
1913
  /**
1880
1914
  * Start focus animation for an image using dimension-based zoom
@@ -1883,20 +1917,20 @@ class Ee {
1883
1917
  * @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
1884
1918
  */
1885
1919
  startFocusAnimation(t, e, i, o, s) {
1886
- const r = t.style.zIndex || "", a = t.offsetWidth, l = t.offsetHeight, c = this.calculateFocusDimensions(a, l, e), u = this.calculateFocusTransform(e, i);
1887
- this.applyFocusedStyling(t, Tt.FOCUSING), this.animationEngine.cancelAllAnimations(t);
1888
- const h = o ?? {
1920
+ const r = t.style.zIndex || "", a = t.offsetWidth, h = t.offsetHeight, c = this.calculateFocusDimensions(a, h, e), d = this.calculateFocusTransform(e, i);
1921
+ this.applyFocusedStyling(t, Mt.FOCUSING), this.animationEngine.cancelAllAnimations(t);
1922
+ const l = o ?? {
1889
1923
  x: 0,
1890
1924
  y: 0,
1891
1925
  rotation: i.rotation,
1892
1926
  scale: 1
1893
1927
  // No scale - using dimensions
1894
- }, d = s?.width ?? a, f = s?.height ?? l, b = this.config.animationDuration ?? 600, p = this.animateWithDimensions(
1928
+ }, u = s?.width ?? a, m = s?.height ?? h, b = this.config.animationDuration ?? 600, p = this.animateWithDimensions(
1895
1929
  t,
1896
- h,
1897
- u,
1930
+ l,
1898
1931
  d,
1899
- f,
1932
+ u,
1933
+ m,
1900
1934
  c.width,
1901
1935
  c.height,
1902
1936
  b
@@ -1904,18 +1938,18 @@ class Ee {
1904
1938
  id: `focus-${Date.now()}`,
1905
1939
  element: t,
1906
1940
  animation: p,
1907
- fromState: h,
1908
- toState: u,
1941
+ fromState: l,
1942
+ toState: d,
1909
1943
  startTime: performance.now(),
1910
1944
  duration: b
1911
1945
  };
1912
1946
  return this.focusData = {
1913
1947
  element: t,
1914
1948
  originalState: i,
1915
- focusTransform: u,
1949
+ focusTransform: d,
1916
1950
  originalZIndex: r,
1917
1951
  originalWidth: a,
1918
- originalHeight: l,
1952
+ originalHeight: h,
1919
1953
  focusWidth: c.width,
1920
1954
  focusHeight: c.height
1921
1955
  }, {
@@ -1924,7 +1958,7 @@ class Ee {
1924
1958
  animationHandle: g,
1925
1959
  direction: "in",
1926
1960
  originalWidth: a,
1927
- originalHeight: l
1961
+ originalHeight: h
1928
1962
  };
1929
1963
  }
1930
1964
  /**
@@ -1933,38 +1967,59 @@ class Ee {
1933
1967
  * @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
1934
1968
  */
1935
1969
  startUnfocusAnimation(t, e, i, o) {
1936
- t.style.zIndex = String(Tt.UNFOCUSING), this.animationEngine.cancelAllAnimations(t);
1937
- const s = i ?? this.focusData?.focusTransform ?? { x: 0, y: 0, rotation: 0, scale: 1 }, r = o?.width ?? this.focusData?.focusWidth ?? t.offsetWidth, a = o?.height ?? this.focusData?.focusHeight ?? t.offsetHeight, l = {
1970
+ t.style.zIndex = String(Mt.UNFOCUSING), this.animationEngine.cancelAllAnimations(t);
1971
+ const s = i ?? this.focusData?.focusTransform ?? { x: 0, y: 0, rotation: 0, scale: 1 }, r = o?.width ?? this.focusData?.focusWidth ?? t.offsetWidth, a = o?.height ?? this.focusData?.focusHeight ?? t.offsetHeight, h = {
1938
1972
  x: 0,
1939
1973
  y: 0,
1940
1974
  rotation: e.rotation,
1941
1975
  scale: 1
1942
1976
  // No scale - using dimensions
1943
- }, c = this.focusData?.originalWidth ?? t.offsetWidth, u = this.focusData?.originalHeight ?? t.offsetHeight, h = this.config.animationDuration ?? 600, d = this.animateWithDimensions(
1977
+ }, c = this.focusData?.originalWidth ?? t.offsetWidth, d = this.focusData?.originalHeight ?? t.offsetHeight, l = this.config.animationDuration ?? 600, u = this.animateWithDimensions(
1944
1978
  t,
1945
1979
  s,
1946
- l,
1980
+ h,
1947
1981
  r,
1948
1982
  a,
1949
1983
  c,
1950
- u,
1951
- h
1952
- ), f = {
1984
+ d,
1985
+ l
1986
+ ), m = {
1953
1987
  id: `unfocus-${Date.now()}`,
1954
1988
  element: t,
1955
- animation: d,
1989
+ animation: u,
1956
1990
  fromState: s,
1957
- toState: l,
1991
+ toState: h,
1958
1992
  startTime: performance.now(),
1959
- duration: h
1993
+ duration: l
1960
1994
  };
1961
1995
  return {
1962
1996
  element: t,
1963
1997
  originalState: e,
1964
- animationHandle: f,
1998
+ animationHandle: m,
1965
1999
  direction: "out",
1966
2000
  originalWidth: c,
1967
- originalHeight: u
2001
+ originalHeight: d
2002
+ };
2003
+ }
2004
+ /**
2005
+ * Capture the current visual state of an element mid-animation, BEFORE cancelling.
2006
+ *
2007
+ * The computed matrix.e/f include the -50%/-50% centering offset resolved to pixels.
2008
+ * buildDimensionZoomTransform prepends its own translate(-50%,-50%), so passing raw
2009
+ * matrix.e/f doubles the centering and produces the wrong starting position.
2010
+ *
2011
+ * This method extracts the PURE positional offset (pureX = matrix.e + 0.5*midWidth)
2012
+ * and commits width/height/transform to inline styles before the animation is cancelled,
2013
+ * preventing any visual snap.
2014
+ *
2015
+ * Must be called while the animation is still running (offsetWidth reflects animated size).
2016
+ * Caller is responsible for calling animationEngine.cancelAllAnimations() afterwards.
2017
+ */
2018
+ captureMidAnimationState(t) {
2019
+ const e = getComputedStyle(t), i = new DOMMatrix(e.transform), o = t.offsetWidth, s = t.offsetHeight, r = i.e + o * 0.5, a = i.f + s * 0.5, h = Math.atan2(i.b, i.a) * (180 / Math.PI);
2020
+ return t.style.width = `${o}px`, t.style.height = `${s}px`, t.style.transform = `translate(-50%, -50%) translate(${r}px, ${a}px) rotate(${h}deg)`, t.style.transition = "none", {
2021
+ transform: { x: r, y: a, rotation: h, scale: 1 },
2022
+ dimensions: { width: o, height: s }
1968
2023
  };
1969
2024
  }
1970
2025
  /**
@@ -1992,21 +2047,12 @@ class Ee {
1992
2047
  if (this.currentFocus === t && this.state === I.FOCUSED)
1993
2048
  return this.unfocusImage();
1994
2049
  if (this.incoming?.element === t && this.state === I.FOCUSING) {
1995
- const s = this.animationEngine.cancelAnimation(this.incoming.animationHandle, !0), r = {
1996
- x: s.x,
1997
- y: s.y,
1998
- rotation: s.rotation,
1999
- scale: 1
2000
- // No scale transform - using dimensions
2001
- }, a = {
2002
- width: t.offsetWidth,
2003
- height: t.offsetHeight
2004
- };
2005
- this.outgoing = this.startUnfocusAnimation(
2050
+ const { transform: s, dimensions: r } = this.captureMidAnimationState(t);
2051
+ this.animationEngine.cancelAllAnimations(t), this.outgoing = this.startUnfocusAnimation(
2006
2052
  t,
2007
2053
  this.incoming.originalState,
2008
- r,
2009
- a
2054
+ s,
2055
+ r
2010
2056
  ), this.incoming = null, this.state = I.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.removeFocusedStyling(this.outgoing.element, this.focusData?.originalZIndex || ""), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = I.IDLE;
2011
2057
  return;
2012
2058
  }
@@ -2048,36 +2094,18 @@ class Ee {
2048
2094
  if (this.incoming?.element === t)
2049
2095
  return;
2050
2096
  if (this.outgoing?.element === t) {
2051
- const s = this.animationEngine.cancelAnimation(this.outgoing.animationHandle, !0), r = {
2052
- x: s.x,
2053
- y: s.y,
2054
- rotation: s.rotation,
2055
- scale: 1
2056
- // No scale - using dimensions
2057
- }, a = {
2058
- width: t.offsetWidth,
2059
- height: t.offsetHeight
2060
- };
2061
- if (this.incoming) {
2062
- const l = this.animationEngine.cancelAnimation(this.incoming.animationHandle, !0), c = {
2063
- x: l.x,
2064
- y: l.y,
2065
- rotation: l.rotation,
2066
- scale: 1
2067
- // No scale - using dimensions
2068
- }, u = {
2069
- width: this.incoming.element.offsetWidth,
2070
- height: this.incoming.element.offsetHeight
2071
- };
2072
- this.outgoing = this.startUnfocusAnimation(
2097
+ const { transform: s, dimensions: r } = this.captureMidAnimationState(t);
2098
+ if (this.animationEngine.cancelAllAnimations(t), this.incoming) {
2099
+ const { transform: a, dimensions: h } = this.captureMidAnimationState(this.incoming.element);
2100
+ this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
2073
2101
  this.incoming.element,
2074
2102
  this.incoming.originalState,
2075
- c,
2076
- u
2103
+ a,
2104
+ h
2077
2105
  );
2078
2106
  } else
2079
2107
  this.outgoing = null;
2080
- if (this.incoming = this.startFocusAnimation(t, e, i, r, a), await Promise.all([
2108
+ if (this.incoming = this.startFocusAnimation(t, e, i, s, r), await Promise.all([
2081
2109
  this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
2082
2110
  this.waitForAnimation(this.incoming.animationHandle)
2083
2111
  ]), this.focusGeneration !== o) return;
@@ -2091,21 +2119,12 @@ class Ee {
2091
2119
  this.outgoing.originalWidth,
2092
2120
  this.outgoing.originalHeight
2093
2121
  ), this.outgoing = null), this.incoming) {
2094
- const s = this.animationEngine.cancelAnimation(this.incoming.animationHandle, !0), r = {
2095
- x: s.x,
2096
- y: s.y,
2097
- rotation: s.rotation,
2098
- scale: 1
2099
- // No scale - using dimensions
2100
- }, a = {
2101
- width: this.incoming.element.offsetWidth,
2102
- height: this.incoming.element.offsetHeight
2103
- };
2104
- this.outgoing = this.startUnfocusAnimation(
2122
+ const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
2123
+ this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
2105
2124
  this.incoming.element,
2106
2125
  this.incoming.originalState,
2107
- r,
2108
- a
2126
+ s,
2127
+ r
2109
2128
  );
2110
2129
  }
2111
2130
  if (this.incoming = this.startFocusAnimation(t, e, i), await Promise.all([
@@ -2120,50 +2139,36 @@ class Ee {
2120
2139
  * Unfocus current image, returning it to original position
2121
2140
  */
2122
2141
  async unfocusImage() {
2142
+ if (this.state === I.UNFOCUSING)
2143
+ return;
2123
2144
  const t = ++this.focusGeneration;
2124
2145
  if (!this.currentFocus || !this.focusData) {
2125
2146
  if (this.incoming && this.state === I.FOCUSING) {
2126
- const s = this.animationEngine.cancelAnimation(this.incoming.animationHandle, !0), r = {
2127
- x: s.x,
2128
- y: s.y,
2129
- rotation: s.rotation,
2130
- scale: 1
2131
- // No scale - using dimensions
2132
- }, a = {
2133
- width: this.incoming.element.offsetWidth,
2134
- height: this.incoming.element.offsetHeight
2135
- };
2136
- if (this.outgoing = this.startUnfocusAnimation(
2147
+ const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
2148
+ if (this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
2137
2149
  this.incoming.element,
2138
2150
  this.incoming.originalState,
2139
- r,
2140
- a
2151
+ s,
2152
+ r
2141
2153
  ), this.incoming = null, this.state = I.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration !== t) return;
2142
2154
  this.removeFocusedStyling(this.outgoing.element, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state = I.IDLE;
2143
2155
  }
2144
2156
  return;
2145
2157
  }
2146
2158
  if (this.state === I.CROSS_ANIMATING && this.incoming) {
2147
- const s = this.animationEngine.cancelAnimation(this.incoming.animationHandle, !0), r = {
2148
- x: s.x,
2149
- y: s.y,
2150
- rotation: s.rotation,
2151
- scale: 1
2152
- // No scale - using dimensions
2153
- }, a = {
2154
- width: this.incoming.element.offsetWidth,
2155
- height: this.incoming.element.offsetHeight
2156
- }, l = this.startUnfocusAnimation(
2159
+ const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
2160
+ this.animationEngine.cancelAllAnimations(this.incoming.element);
2161
+ const a = this.startUnfocusAnimation(
2157
2162
  this.incoming.element,
2158
2163
  this.incoming.originalState,
2159
- r,
2160
- a
2164
+ s,
2165
+ r
2161
2166
  );
2162
2167
  if (await Promise.all([
2163
2168
  this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
2164
- this.waitForAnimation(l.animationHandle)
2169
+ this.waitForAnimation(a.animationHandle)
2165
2170
  ]), this.focusGeneration !== t) return;
2166
- this.outgoing && this.removeFocusedStyling(this.outgoing.element, this.outgoing.originalState.zIndex?.toString() || ""), this.removeFocusedStyling(l.element, this.incoming.originalState.zIndex?.toString() || ""), this.outgoing = null, this.incoming = null, this.currentFocus = null, this.focusData = null, this.state = I.IDLE;
2171
+ this.outgoing && this.removeFocusedStyling(this.outgoing.element, this.outgoing.originalState.zIndex?.toString() || ""), this.removeFocusedStyling(a.element, this.incoming.originalState.zIndex?.toString() || ""), this.outgoing = null, this.incoming = null, this.currentFocus = null, this.focusData = null, this.state = I.IDLE;
2167
2172
  return;
2168
2173
  }
2169
2174
  this.state = I.UNFOCUSING;
@@ -2220,10 +2225,10 @@ class Ee {
2220
2225
  if (!this.currentFocus || !this.focusData || this.state !== I.FOCUSED) return;
2221
2226
  const i = this.currentFocus, o = this.focusData.focusTransform, s = ["translate(-50%, -50%)"], r = o.x ?? 0, a = o.y ?? 0;
2222
2227
  s.push(`translate(${r}px, ${a}px)`), o.rotation !== void 0 && s.push(`rotate(${o.rotation}deg)`);
2223
- const l = s.join(" ");
2224
- t ? (i.style.transition = `transform ${e}ms ease-out`, i.style.transform = l, setTimeout(() => {
2228
+ const h = s.join(" ");
2229
+ t ? (i.style.transition = `transform ${e}ms ease-out`, i.style.transform = h, setTimeout(() => {
2225
2230
  this.currentFocus === i && (i.style.transition = "none");
2226
- }, e)) : (i.style.transition = "none", i.style.transform = l);
2231
+ }, e)) : (i.style.transition = "none", i.style.transform = h);
2227
2232
  }
2228
2233
  /**
2229
2234
  * Reset zoom state (cancels all animations)
@@ -2250,7 +2255,7 @@ class Ee {
2250
2255
  ), this.state = I.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
2251
2256
  }
2252
2257
  }
2253
- const Se = 50, Ie = 0.5, Te = 20, Re = 0.3, Ce = 150, Ae = 30, at = class at {
2258
+ const Ce = 50, Te = 0.5, Me = 20, Re = 0.3, Ae = 150, ze = 30, ct = class ct {
2254
2259
  constructor(t, e) {
2255
2260
  this.enabled = !1, this.touchState = null, this.recentTouchTimestamp = 0, this.container = t, this.callbacks = e, this.boundTouchStart = this.handleTouchStart.bind(this), this.boundTouchMove = this.handleTouchMove.bind(this), this.boundTouchEnd = this.handleTouchEnd.bind(this), this.boundTouchCancel = this.handleTouchCancel.bind(this);
2256
2261
  }
@@ -2277,7 +2282,7 @@ const Se = 50, Ie = 0.5, Te = 20, Re = 0.3, Ce = 150, Ae = 30, at = class at {
2277
2282
  * Used to prevent click-outside from unfocusing immediately after touch
2278
2283
  */
2279
2284
  hadRecentTouch() {
2280
- return Date.now() - this.recentTouchTimestamp < at.TOUCH_CLICK_DELAY;
2285
+ return Date.now() - this.recentTouchTimestamp < ct.TOUCH_CLICK_DELAY;
2281
2286
  }
2282
2287
  handleTouchStart(t) {
2283
2288
  if (t.touches.length !== 1) return;
@@ -2297,7 +2302,7 @@ const Se = 50, Ie = 0.5, Te = 20, Re = 0.3, Ce = 150, Ae = 30, at = class at {
2297
2302
  const e = t.touches[0], i = e.clientX - this.touchState.startX, o = e.clientY - this.touchState.startY;
2298
2303
  if (this.touchState.isHorizontalSwipe === null && Math.sqrt(i * i + o * o) > 10) {
2299
2304
  const a = Math.atan2(Math.abs(o), Math.abs(i)) * (180 / Math.PI);
2300
- this.touchState.isHorizontalSwipe = a <= Ae;
2305
+ this.touchState.isHorizontalSwipe = a <= ze;
2301
2306
  }
2302
2307
  if (this.touchState.isHorizontalSwipe !== !1 && this.touchState.isHorizontalSwipe === !0) {
2303
2308
  t.preventDefault(), this.touchState.isDragging = !0, this.touchState.currentX = e.clientX;
@@ -2310,472 +2315,14 @@ const Se = 50, Ie = 0.5, Te = 20, Re = 0.3, Ce = 150, Ae = 30, at = class at {
2310
2315
  this.recentTouchTimestamp = Date.now();
2311
2316
  const e = this.touchState.currentX - this.touchState.startX, i = performance.now() - this.touchState.startTime, o = Math.abs(e) / i, s = Math.abs(e);
2312
2317
  let r = !1;
2313
- this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (s >= Se || o >= Ie && s >= Te) && (r = !0, e < 0 ? this.callbacks.onNext() : this.callbacks.onPrev()), this.touchState.isDragging && this.callbacks.onDragEnd(r), this.touchState = null;
2318
+ this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (s >= Ce || o >= Te && s >= Me) && (r = !0, e < 0 ? this.callbacks.onNext() : this.callbacks.onPrev()), this.touchState.isDragging && this.callbacks.onDragEnd(r), this.touchState = null;
2314
2319
  }
2315
2320
  handleTouchCancel(t) {
2316
2321
  this.touchState?.isDragging && this.callbacks.onDragEnd(!1), this.touchState = null;
2317
2322
  }
2318
2323
  };
2319
- at.TOUCH_CLICK_DELAY = 300;
2320
- let mt = at;
2321
- class Le {
2322
- constructor(t) {
2323
- if (this._prepared = !1, this._discoveredUrls = [], this.apiKey = t.apiKey ?? "", this.apiEndpoint = t.apiEndpoint ?? "https://www.googleapis.com/drive/v3/files", this.debugLogging = t.debugLogging ?? !1, this.sources = t.sources ?? [], !this.sources || this.sources.length === 0)
2324
- throw new Error("GoogleDriveLoader requires at least one source to be configured");
2325
- }
2326
- /**
2327
- * Prepare the loader by discovering all images from configured sources
2328
- * @param filter - Filter to apply to discovered images
2329
- */
2330
- async prepare(t) {
2331
- this._discoveredUrls = [];
2332
- for (const e of this.sources)
2333
- if ("folders" in e)
2334
- for (const i of e.folders) {
2335
- const o = e.recursive !== void 0 ? e.recursive : !0, s = await this.loadFromFolder(i, t, o);
2336
- this._discoveredUrls.push(...s);
2337
- }
2338
- else if ("files" in e) {
2339
- const i = await this.loadFiles(e.files, t);
2340
- this._discoveredUrls.push(...i);
2341
- }
2342
- this._prepared = !0;
2343
- }
2344
- /**
2345
- * Get the number of discovered images
2346
- * @throws Error if called before prepare()
2347
- */
2348
- imagesLength() {
2349
- if (!this._prepared)
2350
- throw new Error("GoogleDriveLoader.imagesLength() called before prepare()");
2351
- return this._discoveredUrls.length;
2352
- }
2353
- /**
2354
- * Get the ordered list of image URLs
2355
- * @throws Error if called before prepare()
2356
- */
2357
- imageURLs() {
2358
- if (!this._prepared)
2359
- throw new Error("GoogleDriveLoader.imageURLs() called before prepare()");
2360
- return [...this._discoveredUrls];
2361
- }
2362
- /**
2363
- * Check if the loader has been prepared
2364
- */
2365
- isPrepared() {
2366
- return this._prepared;
2367
- }
2368
- /**
2369
- * Extract folder ID from various Google Drive URL formats
2370
- * @param folderUrl - Google Drive folder URL
2371
- * @returns Folder ID or null if invalid
2372
- */
2373
- extractFolderId(t) {
2374
- const e = [
2375
- /\/folders\/([a-zA-Z0-9_-]+)/,
2376
- // Standard format
2377
- /id=([a-zA-Z0-9_-]+)/
2378
- // Alternative format
2379
- ];
2380
- for (const i of e) {
2381
- const o = t.match(i);
2382
- if (o && o[1])
2383
- return o[1];
2384
- }
2385
- return null;
2386
- }
2387
- /**
2388
- * Load images from a Google Drive folder
2389
- * @param folderUrl - Google Drive folder URL
2390
- * @param filter - Filter to apply to discovered images
2391
- * @param recursive - Whether to include images from subfolders
2392
- * @returns Promise resolving to array of image URLs
2393
- */
2394
- async loadFromFolder(t, e, i = !0) {
2395
- const o = this.extractFolderId(t);
2396
- if (!o)
2397
- throw new Error("Invalid Google Drive folder URL. Please check the URL format.");
2398
- if (!this.apiKey || this.apiKey === "YOUR_API_KEY_HERE")
2399
- return this.loadImagesDirectly(o, e);
2400
- try {
2401
- return i ? await this.loadImagesRecursively(o, e) : await this.loadImagesFromSingleFolder(o, e);
2402
- } catch (s) {
2403
- return console.error("Error loading from Google Drive API:", s), this.loadImagesDirectly(o, e);
2404
- }
2405
- }
2406
- /**
2407
- * Load images from a single folder (non-recursive)
2408
- * @param folderId - Google Drive folder ID
2409
- * @param filter - Filter to apply to discovered images
2410
- * @returns Promise resolving to array of image URLs
2411
- */
2412
- async loadImagesFromSingleFolder(t, e) {
2413
- const i = [], o = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(o)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, a = await fetch(r);
2414
- if (!a.ok)
2415
- throw new Error(`API request failed: ${a.status} ${a.statusText}`);
2416
- const c = (await a.json()).files.filter(
2417
- (u) => u.mimeType.startsWith("image/") && e.isAllowed(u.name)
2418
- );
2419
- return this.log(`Found ${c.length} images in folder ${t} (non-recursive)`), c.forEach((u) => {
2420
- i.push(`https://lh3.googleusercontent.com/d/${u.id}=s1600`), this.log(`Added file: ${u.name}`);
2421
- }), i;
2422
- }
2423
- /**
2424
- * Load specific files by their URLs or IDs
2425
- * @param fileUrls - Array of Google Drive file URLs or IDs
2426
- * @param filter - Filter to apply to discovered images
2427
- * @returns Promise resolving to array of image URLs
2428
- */
2429
- async loadFiles(t, e) {
2430
- const i = [];
2431
- for (const o of t) {
2432
- const s = this.extractFileId(o);
2433
- if (!s) {
2434
- this.log(`Skipping invalid file URL: ${o}`);
2435
- continue;
2436
- }
2437
- if (this.apiKey && this.apiKey !== "YOUR_API_KEY_HERE")
2438
- try {
2439
- const r = `${this.apiEndpoint}/${s}?fields=name,mimeType&key=${this.apiKey}`, a = await fetch(r);
2440
- if (a.ok) {
2441
- const l = await a.json();
2442
- l.mimeType.startsWith("image/") && e.isAllowed(l.name) ? (i.push(`https://lh3.googleusercontent.com/d/${s}=s1600`), this.log(`Added file: ${l.name}`)) : this.log(`Skipping non-image file: ${l.name} (${l.mimeType})`);
2443
- } else
2444
- this.log(`Failed to fetch metadata for file ${s}: ${a.status}`);
2445
- } catch (r) {
2446
- this.log(`Error fetching metadata for file ${s}:`, r);
2447
- }
2448
- else
2449
- i.push(`https://lh3.googleusercontent.com/d/${s}=s1600`);
2450
- }
2451
- return i;
2452
- }
2453
- /**
2454
- * Extract file ID from Google Drive file URL
2455
- * @param fileUrl - Google Drive file URL or file ID
2456
- * @returns File ID or null if invalid
2457
- */
2458
- extractFileId(t) {
2459
- if (!/[/:.]/.test(t))
2460
- return t;
2461
- const e = [
2462
- /\/file\/d\/([a-zA-Z0-9_-]+)/,
2463
- // Standard file format
2464
- /\/open\?id=([a-zA-Z0-9_-]+)/,
2465
- // Alternative format
2466
- /id=([a-zA-Z0-9_-]+)/
2467
- // Generic id parameter
2468
- ];
2469
- for (const i of e) {
2470
- const o = t.match(i);
2471
- if (o && o[1])
2472
- return o[1];
2473
- }
2474
- return null;
2475
- }
2476
- /**
2477
- * Recursively load images from a folder and all its subfolders
2478
- * @param folderId - Google Drive folder ID
2479
- * @param filter - Filter to apply to discovered images
2480
- * @returns Promise resolving to array of image URLs
2481
- */
2482
- async loadImagesRecursively(t, e) {
2483
- const i = [], o = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(o)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, a = await fetch(r);
2484
- if (!a.ok)
2485
- throw new Error(`API request failed: ${a.status} ${a.statusText}`);
2486
- const l = await a.json(), c = l.files.filter(
2487
- (h) => h.mimeType.startsWith("image/") && e.isAllowed(h.name)
2488
- ), u = l.files.filter(
2489
- (h) => h.mimeType === "application/vnd.google-apps.folder"
2490
- );
2491
- this.log(`Found ${l.files.length} total items in folder ${t}`), l.files.forEach((h) => this.log(` - File: ${h.name} (${h.mimeType})`)), this.log(`- ${c.length} valid files (images only)`), this.log(`- ${u.length} subfolders`), c.forEach((h) => {
2492
- i.push(`https://lh3.googleusercontent.com/d/${h.id}=s1600`), this.log(`Added file: ${h.name}`);
2493
- });
2494
- for (const h of u) {
2495
- this.log(`Loading images from subfolder: ${h.name}`);
2496
- const d = await this.loadImagesRecursively(h.id, e);
2497
- i.push(...d);
2498
- }
2499
- return i;
2500
- }
2501
- /**
2502
- * Direct loading method (no API key required, but less reliable)
2503
- * Uses embedded folder view to scrape image IDs
2504
- * @param folderId - Google Drive folder ID
2505
- * @param filter - Filter to apply (not used in fallback mode)
2506
- * @returns Promise resolving to array of image URLs
2507
- */
2508
- async loadImagesDirectly(t, e) {
2509
- try {
2510
- const i = `https://drive.google.com/embeddedfolderview?id=${t}`, o = await fetch(i, { mode: "cors" });
2511
- if (!o.ok)
2512
- throw new Error("Cannot access folder directly (CORS or permissions issue)");
2513
- const s = await o.text(), r = /\/file\/d\/([a-zA-Z0-9_-]+)/g, a = [...s.matchAll(r)];
2514
- return [...new Set(a.map((u) => u[1]))].map(
2515
- (u) => `https://drive.google.com/uc?export=view&id=${u}`
2516
- );
2517
- } catch (i) {
2518
- throw console.error("Direct loading failed:", i), new Error(
2519
- `Unable to load images. Please ensure:
2520
- 1. The folder is shared publicly (Anyone with the link can view)
2521
- 2. The folder contains image files
2522
- 3. Consider adding a Google Drive API key in config.js for better reliability`
2523
- );
2524
- }
2525
- }
2526
- /**
2527
- * Manually add image URLs (for testing or when auto-loading fails)
2528
- * @param imageIds - Array of Google Drive file IDs
2529
- * @returns Array of direct image URLs
2530
- */
2531
- manualImageUrls(t) {
2532
- return t.map((e) => `https://drive.google.com/uc?export=view&id=${e}`);
2533
- }
2534
- /**
2535
- * Debug logging helper
2536
- * @param args - Arguments to log
2537
- */
2538
- log(...t) {
2539
- this.debugLogging && typeof console < "u" && console.log(...t);
2540
- }
2541
- }
2542
- class Me {
2543
- constructor(t) {
2544
- if (this._prepared = !1, this._discoveredUrls = [], this.validateUrls = t.validateUrls !== !1, this.validationTimeout = t.validationTimeout ?? 5e3, this.validationMethod = t.validationMethod ?? "head", this.debugLogging = t.debugLogging ?? !1, this.sources = t.sources ?? [], !this.sources || this.sources.length === 0)
2545
- throw new Error("StaticImageLoader requires at least one source to be configured");
2546
- this.log("StaticImageLoader initialized with config:", t);
2547
- }
2548
- /**
2549
- * Prepare the loader by discovering all images from configured sources
2550
- * @param filter - Filter to apply to discovered images
2551
- */
2552
- async prepare(t) {
2553
- this._discoveredUrls = [], this.log(`Processing ${this.sources.length} source(s)`);
2554
- for (const e of this.sources)
2555
- try {
2556
- const i = await this.processSource(e, t);
2557
- this._discoveredUrls.push(...i);
2558
- } catch (i) {
2559
- console.warn("Failed to process source:", e, i);
2560
- }
2561
- this._prepared = !0, this.log(`Successfully loaded ${this._discoveredUrls.length} image(s)`);
2562
- }
2563
- /**
2564
- * Get the number of discovered images
2565
- * @throws Error if called before prepare()
2566
- */
2567
- imagesLength() {
2568
- if (!this._prepared)
2569
- throw new Error("StaticImageLoader.imagesLength() called before prepare()");
2570
- return this._discoveredUrls.length;
2571
- }
2572
- /**
2573
- * Get the ordered list of image URLs
2574
- * @throws Error if called before prepare()
2575
- */
2576
- imageURLs() {
2577
- if (!this._prepared)
2578
- throw new Error("StaticImageLoader.imageURLs() called before prepare()");
2579
- return [...this._discoveredUrls];
2580
- }
2581
- /**
2582
- * Check if the loader has been prepared
2583
- */
2584
- isPrepared() {
2585
- return this._prepared;
2586
- }
2587
- /**
2588
- * Process a single source object using shape-based detection
2589
- * @param source - Source configuration detected by key presence
2590
- * @param filter - Filter to apply to discovered images
2591
- * @returns Promise resolving to array of valid URLs from this source
2592
- */
2593
- async processSource(t, e) {
2594
- return t ? "urls" in t ? await this.processUrls(t.urls, e) : "path" in t ? await this.processPath(t.path, t.files, e) : "json" in t ? await this.processJson(t.json, e) : (console.warn("Unknown source shape:", t), []) : (console.warn("Invalid source object:", t), []);
2595
- }
2596
- /**
2597
- * Process a list of direct URLs
2598
- * @param urls - Array of image URLs
2599
- * @param filter - Filter to apply to discovered images
2600
- * @returns Promise resolving to array of validated URLs
2601
- */
2602
- async processUrls(t, e) {
2603
- if (!Array.isArray(t))
2604
- return console.warn("URLs must be an array:", t), [];
2605
- const i = [];
2606
- for (const o of t) {
2607
- const s = o.split("/").pop() || o;
2608
- if (!e.isAllowed(s)) {
2609
- this.log(`Skipping filtered URL: ${o}`);
2610
- continue;
2611
- }
2612
- this.validateUrls ? await this.validateUrl(o) ? i.push(o) : console.warn(`Skipping invalid/missing URL: ${o}`) : i.push(o);
2613
- }
2614
- return i;
2615
- }
2616
- /**
2617
- * Process a path-based source
2618
- * @param basePath - Base path (relative or absolute)
2619
- * @param files - Array of filenames
2620
- * @param filter - Filter to apply to discovered images
2621
- * @returns Promise resolving to array of validated URLs
2622
- */
2623
- async processPath(t, e, i) {
2624
- if (!Array.isArray(e))
2625
- return console.warn("files must be an array:", e), [];
2626
- const o = [];
2627
- for (const s of e) {
2628
- if (!i.isAllowed(s)) {
2629
- this.log(`Skipping filtered file: ${s}`);
2630
- continue;
2631
- }
2632
- const r = this.constructUrl(t, s);
2633
- this.validateUrls ? await this.validateUrl(r) ? o.push(r) : console.warn(`Skipping invalid/missing file: ${r}`) : o.push(r);
2634
- }
2635
- return o;
2636
- }
2637
- /**
2638
- * Process a JSON endpoint source
2639
- * Fetches a JSON endpoint that returns { images: string[] }
2640
- * @param url - JSON endpoint URL
2641
- * @param filter - Filter to apply to discovered images
2642
- * @returns Promise resolving to array of validated URLs
2643
- */
2644
- async processJson(t, e) {
2645
- this.log(`Fetching JSON endpoint: ${t}`);
2646
- const i = new AbortController(), o = setTimeout(() => i.abort(), 1e4);
2647
- try {
2648
- const s = await fetch(t, { signal: i.signal });
2649
- if (clearTimeout(o), !s.ok)
2650
- throw new Error(`HTTP ${s.status} fetching ${t}`);
2651
- const r = await s.json();
2652
- if (!r || !Array.isArray(r.images))
2653
- throw new Error('JSON source must return JSON with shape { "images": ["url1", "url2", ...] }');
2654
- return this.log(`JSON endpoint returned ${r.images.length} image(s)`), await this.processUrls(r.images, e);
2655
- } catch (s) {
2656
- throw clearTimeout(o), s instanceof Error && s.name === "AbortError" ? new Error(`Timeout fetching JSON endpoint: ${t}`) : s;
2657
- }
2658
- }
2659
- /**
2660
- * Validate a single URL using HEAD request
2661
- * @param url - URL to validate
2662
- * @returns Promise resolving to true if valid and accessible
2663
- */
2664
- async validateUrl(t) {
2665
- if (this.validationMethod === "none")
2666
- return !0;
2667
- if (this.validationMethod === "simple")
2668
- try {
2669
- return typeof window < "u" ? new URL(t, window.location.origin) : new URL(t), !0;
2670
- } catch {
2671
- return !1;
2672
- }
2673
- if (typeof window > "u")
2674
- return !0;
2675
- if (!(t.startsWith(window.location.origin) || t.startsWith("/")))
2676
- return this.log(`Skipping validation for cross-origin URL: ${t}`), !0;
2677
- try {
2678
- const i = new AbortController(), o = setTimeout(() => i.abort(), this.validationTimeout), s = await fetch(t, {
2679
- method: "HEAD",
2680
- signal: i.signal
2681
- });
2682
- return clearTimeout(o), s.ok ? !0 : (this.log(`Validation failed for ${t}: HTTP ${s.status}`), !1);
2683
- } catch (i) {
2684
- return i instanceof Error && (i.name === "AbortError" ? this.log(`Validation timeout for ${t}`) : this.log(`Validation failed for ${t}:`, i.message)), !1;
2685
- }
2686
- }
2687
- /**
2688
- * Construct full URL from basePath and filename
2689
- * @param basePath - Base path (relative or absolute)
2690
- * @param filename - Filename to append
2691
- * @returns Complete URL
2692
- */
2693
- constructUrl(t, e) {
2694
- const i = t.replace(/\/$/, "");
2695
- if (this.isAbsoluteUrl(t))
2696
- return `${i}/${e}`;
2697
- if (typeof window > "u")
2698
- return `${i}/${e}`;
2699
- const o = window.location.origin, r = (t.startsWith("/") ? t : "/" + t).replace(/\/$/, "");
2700
- return `${o}${r}/${e}`;
2701
- }
2702
- /**
2703
- * Check if URL is absolute (contains protocol)
2704
- * @param url - URL to check
2705
- * @returns True if absolute URL
2706
- */
2707
- isAbsoluteUrl(t) {
2708
- try {
2709
- return new URL(t), !0;
2710
- } catch {
2711
- return !1;
2712
- }
2713
- }
2714
- /**
2715
- * Debug logging helper
2716
- * @param args - Arguments to log
2717
- */
2718
- log(...t) {
2719
- this.debugLogging && typeof console < "u" && console.log(...t);
2720
- }
2721
- }
2722
- class ze {
2723
- constructor(t) {
2724
- if (this._prepared = !1, this._discoveredUrls = [], this.loaders = t.loaders, this.debugLogging = t.debugLogging ?? !1, !this.loaders || this.loaders.length === 0)
2725
- throw new Error("CompositeLoader requires at least one loader to be configured");
2726
- this.log(`CompositeLoader initialized with ${this.loaders.length} loader(s)`);
2727
- }
2728
- /**
2729
- * Prepare all loaders in parallel and combine their results
2730
- * @param filter - Filter to apply to discovered images
2731
- */
2732
- async prepare(t) {
2733
- this._discoveredUrls = [], this.log(`Preparing ${this.loaders.length} loader(s) in parallel`);
2734
- const e = this.loaders.map((i, o) => i.prepare(t).then(() => {
2735
- this.log(`Loader ${o} prepared with ${i.imagesLength()} images`);
2736
- }).catch((s) => {
2737
- console.warn(`Loader ${o} failed to prepare:`, s);
2738
- }));
2739
- await Promise.all(e);
2740
- for (const i of this.loaders)
2741
- if (i.isPrepared()) {
2742
- const o = i.imageURLs();
2743
- this._discoveredUrls.push(...o);
2744
- }
2745
- this._prepared = !0, this.log(`CompositeLoader prepared with ${this._discoveredUrls.length} total images`);
2746
- }
2747
- /**
2748
- * Get the combined number of discovered images
2749
- * @throws Error if called before prepare()
2750
- */
2751
- imagesLength() {
2752
- if (!this._prepared)
2753
- throw new Error("CompositeLoader.imagesLength() called before prepare()");
2754
- return this._discoveredUrls.length;
2755
- }
2756
- /**
2757
- * Get the combined ordered list of image URLs
2758
- * @throws Error if called before prepare()
2759
- */
2760
- imageURLs() {
2761
- if (!this._prepared)
2762
- throw new Error("CompositeLoader.imageURLs() called before prepare()");
2763
- return [...this._discoveredUrls];
2764
- }
2765
- /**
2766
- * Check if the loader has been prepared
2767
- */
2768
- isPrepared() {
2769
- return this._prepared;
2770
- }
2771
- /**
2772
- * Debug logging helper
2773
- * @param args - Arguments to log
2774
- */
2775
- log(...t) {
2776
- this.debugLogging && typeof console < "u" && console.log("[CompositeLoader]", ...t);
2777
- }
2778
- }
2324
+ ct.TOUCH_CLICK_DELAY = 300;
2325
+ let bt = ct;
2779
2326
  class Fe {
2780
2327
  /**
2781
2328
  * Create a new ImageFilter
@@ -2813,7 +2360,7 @@ class Fe {
2813
2360
  // isAllowedDate(date: Date): boolean
2814
2361
  // isAllowedDimensions(width: number, height: number): boolean
2815
2362
  }
2816
- const De = `
2363
+ const Le = `
2817
2364
  .fbn-ic-gallery {
2818
2365
  position: relative;
2819
2366
  width: 100%;
@@ -2863,24 +2410,24 @@ const De = `
2863
2410
  display: none !important;
2864
2411
  }
2865
2412
  `;
2866
- function Oe() {
2413
+ function De() {
2867
2414
  if (typeof document > "u") return;
2868
2415
  const n = "fbn-ic-functional-styles";
2869
2416
  if (document.getElementById(n)) return;
2870
2417
  const t = document.createElement("style");
2871
- t.id = n, t.textContent = De, document.head.appendChild(t);
2418
+ t.id = n, t.textContent = Le, document.head.appendChild(t);
2872
2419
  }
2873
- let $e = class {
2420
+ let Oe = class {
2874
2421
  constructor(t = {}) {
2875
- this.fullConfig = Yt(t), t.container instanceof HTMLElement ? (this.containerRef = t.container, this.containerId = null) : (this.containerRef = null, this.containerId = t.container || "imageCloud"), this.imagesLoaded = !1, this.imageElements = [], this.imageLayouts = [], this.currentImageHeight = 225, this.currentFocusIndex = null, this.hoveredImage = null, this.resizeTimeout = null, this.displayQueue = [], this.queueInterval = null, this.loadGeneration = 0, this.loadingElAutoCreated = !1, this.errorElAutoCreated = !1, this.counterEl = null, this.counterElAutoCreated = !1, this.animationEngine = new Vt(this.fullConfig.animation), this.layoutEngine = new ye({
2422
+ this.fullConfig = Bt(t), t.container instanceof HTMLElement ? (this.containerRef = t.container, this.containerId = null) : (this.containerRef = null, this.containerId = t.container || "imageCloud"), this.imagesLoaded = !1, this.imageElements = [], this.imageLayouts = [], this.currentImageHeight = 225, this.currentFocusIndex = null, this.hoveredImage = null, this.resizeTimeout = null, this.displayQueue = [], this.queueInterval = null, this.loadGeneration = 0, this.loadingElAutoCreated = !1, this.errorElAutoCreated = !1, this.counterEl = null, this.counterElAutoCreated = !1, this.animationEngine = new Zt(this.fullConfig.animation), this.layoutEngine = new xe({
2876
2423
  layout: this.fullConfig.layout,
2877
2424
  image: this.fullConfig.image
2878
- }), this.zoomEngine = new Ee(this.fullConfig.interaction.focus, this.animationEngine, this.fullConfig.styling), this.defaultStyles = st(this.fullConfig.styling?.default), this.hoverStyles = st(this.fullConfig.styling?.hover), this.defaultClassName = this.fullConfig.styling?.default?.className, this.hoverClassName = this.fullConfig.styling?.hover?.className;
2425
+ }), this.zoomEngine = new Ie(this.fullConfig.interaction.focus, this.animationEngine, this.fullConfig.styling), this.defaultStyles = rt(this.fullConfig.styling?.default), this.hoverStyles = rt(this.fullConfig.styling?.hover), this.defaultClassName = this.fullConfig.styling?.default?.className, this.hoverClassName = this.fullConfig.styling?.hover?.className;
2879
2426
  const e = this.fullConfig.animation.entry || y.animation.entry;
2880
- this.entryAnimationEngine = new re(
2427
+ this.entryAnimationEngine = new le(
2881
2428
  e,
2882
2429
  this.fullConfig.layout.algorithm
2883
- ), this.swipeEngine = null, this.imageFilter = this.createImageFilter(), this.imageLoader = this.createLoader(), this.containerEl = null, this.loadingEl = null, this.errorEl = null;
2430
+ ), this.swipeEngine = null, this.imageFilter = this.createImageFilter(), this.containerEl = null, this.loadingEl = null, this.errorEl = null;
2884
2431
  }
2885
2432
  /**
2886
2433
  * Create image filter based on shared loader config
@@ -2892,38 +2439,48 @@ let $e = class {
2892
2439
  /**
2893
2440
  * Create appropriate image loader based on config
2894
2441
  * Processes loaders array, merges shared config, wraps in CompositeLoader if needed
2442
+ * Uses dynamic imports to trigger loader registration and enable tree-shaking
2895
2443
  */
2896
- createLoader() {
2444
+ async createLoader() {
2897
2445
  const t = this.fullConfig.loaders, e = this.fullConfig.config.loaders ?? {};
2898
2446
  if (!t || t.length === 0)
2899
2447
  throw new Error("No loaders configured. Provide `images`, `loaders`, or both.");
2900
- const i = t.map((o) => this.createLoaderFromEntry(o, e));
2901
- return i.length === 1 ? i[0] : new ze({
2448
+ const i = await Promise.all(
2449
+ t.map((s) => this.createLoaderFromEntry(s, e))
2450
+ );
2451
+ if (i.length === 1)
2452
+ return i[0];
2453
+ await import("./composite-CtUxtN2l.js");
2454
+ const o = et.getLoader("composite");
2455
+ return new o({
2902
2456
  loaders: i,
2903
2457
  debugLogging: this.fullConfig.config.debug?.loaders
2904
2458
  });
2905
2459
  }
2906
2460
  /**
2907
2461
  * Create a single loader from a LoaderEntry, merging shared config
2462
+ * Uses dynamic imports to trigger loader registration and enable tree-shaking
2908
2463
  */
2909
- createLoaderFromEntry(t, e) {
2464
+ async createLoaderFromEntry(t, e) {
2910
2465
  if ("static" in t) {
2911
- const i = t.static, o = {
2912
- ...i,
2913
- validateUrls: i.validateUrls ?? e.validateUrls,
2914
- validationTimeout: i.validationTimeout ?? e.validationTimeout,
2915
- validationMethod: i.validationMethod ?? e.validationMethod,
2916
- allowedExtensions: i.allowedExtensions ?? e.allowedExtensions,
2917
- debugLogging: i.debugLogging ?? this.fullConfig.config.debug?.loaders
2466
+ await import("./static-ejylHtQ4.js");
2467
+ const i = et.getLoader("static"), o = t.static, s = {
2468
+ ...o,
2469
+ validateUrls: o.validateUrls ?? e.validateUrls,
2470
+ validationTimeout: o.validationTimeout ?? e.validationTimeout,
2471
+ validationMethod: o.validationMethod ?? e.validationMethod,
2472
+ allowedExtensions: o.allowedExtensions ?? e.allowedExtensions,
2473
+ debugLogging: o.debugLogging ?? this.fullConfig.config.debug?.loaders
2918
2474
  };
2919
- return new Me(o);
2475
+ return new i(s);
2920
2476
  } else if ("googleDrive" in t) {
2921
- const i = t.googleDrive, o = {
2922
- ...i,
2923
- allowedExtensions: i.allowedExtensions ?? e.allowedExtensions,
2924
- debugLogging: i.debugLogging ?? this.fullConfig.config.debug?.loaders
2477
+ await import("./google-drive-CC-qFSV1.js");
2478
+ const i = et.getLoader("google-drive"), o = t.googleDrive, s = {
2479
+ ...o,
2480
+ allowedExtensions: o.allowedExtensions ?? e.allowedExtensions,
2481
+ debugLogging: o.debugLogging ?? this.fullConfig.config.debug?.loaders
2925
2482
  };
2926
- return new Le(o);
2483
+ return new i(s);
2927
2484
  } else
2928
2485
  throw new Error(`Unknown loader entry: ${JSON.stringify(t)}`);
2929
2486
  }
@@ -2932,18 +2489,18 @@ let $e = class {
2932
2489
  */
2933
2490
  async init() {
2934
2491
  try {
2935
- if (Oe(), this.containerRef)
2492
+ if (De(), this.containerRef)
2936
2493
  this.containerEl = this.containerRef;
2937
2494
  else if (this.containerEl = document.getElementById(this.containerId), !this.containerEl)
2938
2495
  throw new Error(`Container #${this.containerId} not found`);
2939
- this.containerEl.classList.add("fbn-ic-gallery"), this.swipeEngine = new mt(this.containerEl, {
2496
+ this.containerEl.classList.add("fbn-ic-gallery"), this.swipeEngine = new bt(this.containerEl, {
2940
2497
  onNext: () => this.navigateToNextImage(),
2941
2498
  onPrev: () => this.navigateToPreviousImage(),
2942
2499
  onDragOffset: (t) => this.zoomEngine.setDragOffset(t),
2943
2500
  onDragEnd: (t) => {
2944
- t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0, Ce);
2501
+ t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0, Ae);
2945
2502
  }
2946
- }), this.setupUI(), this.setupEventListeners(), this.logDebug("ImageCloud initialized"), await this.loadImages();
2503
+ }), this.setupUI(), this.setupEventListeners(), this.imageLoader = await this.createLoader(), this.logDebug("ImageCloud initialized"), await this.loadImages();
2947
2504
  } catch (t) {
2948
2505
  console.error("Gallery initialization failed:", t), this.errorEl && t instanceof Error && this.showError("Gallery failed to initialize: " + t.message);
2949
2506
  }
@@ -3065,48 +2622,48 @@ let $e = class {
3065
2622
  const a = (c) => {
3066
2623
  this.containerEl && (this.containerEl.appendChild(c), this.imageElements.push(c), requestAnimationFrame(() => {
3067
2624
  if (c.offsetWidth, c.style.opacity = this.defaultStyles.opacity ?? "1", c.dataset.startX && (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || c.dataset.startRotation !== c.dataset.rotation || c.dataset.startScale !== c.dataset.scale)) {
3068
- const d = {
2625
+ const u = {
3069
2626
  x: parseFloat(c.dataset.startX),
3070
2627
  y: parseFloat(c.dataset.startY)
3071
- }, f = {
2628
+ }, m = {
3072
2629
  x: parseFloat(c.dataset.endX),
3073
2630
  y: parseFloat(c.dataset.endY)
3074
- }, b = parseFloat(c.dataset.imageWidth), p = parseFloat(c.dataset.imageHeight), g = parseFloat(c.dataset.rotation), m = parseFloat(c.dataset.scale), E = c.dataset.startRotation ? parseFloat(c.dataset.startRotation) : g, v = c.dataset.startScale ? parseFloat(c.dataset.startScale) : m, w = this.entryAnimationEngine.getTiming();
3075
- oe({
2631
+ }, b = parseFloat(c.dataset.imageWidth), p = parseFloat(c.dataset.imageHeight), g = parseFloat(c.dataset.rotation), f = parseFloat(c.dataset.scale), E = c.dataset.startRotation ? parseFloat(c.dataset.startRotation) : g, v = c.dataset.startScale ? parseFloat(c.dataset.startScale) : f, x = this.entryAnimationEngine.getTiming();
2632
+ ae({
3076
2633
  element: c,
3077
- startPosition: d,
3078
- endPosition: f,
2634
+ startPosition: u,
2635
+ endPosition: m,
3079
2636
  pathConfig: this.entryAnimationEngine.getPathConfig(),
3080
- duration: w.duration,
2637
+ duration: x.duration,
3081
2638
  imageWidth: b,
3082
2639
  imageHeight: p,
3083
2640
  rotation: g,
3084
- scale: m,
2641
+ scale: f,
3085
2642
  rotationConfig: this.entryAnimationEngine.getRotationConfig(),
3086
2643
  startRotation: E,
3087
2644
  scaleConfig: this.entryAnimationEngine.getScaleConfig(),
3088
2645
  startScale: v
3089
2646
  });
3090
2647
  } else {
3091
- const d = c.dataset.finalTransform || "";
3092
- c.style.transform = d;
2648
+ const u = c.dataset.finalTransform || "";
2649
+ c.style.transform = u;
3093
2650
  }
3094
- const h = parseInt(c.dataset.imageId || "0");
3095
- if (this.fullConfig.config.debug?.enabled && h < 3) {
3096
- const d = c.dataset.finalTransform || "";
3097
- console.log(`Image ${h} final state:`, {
2651
+ const l = parseInt(c.dataset.imageId || "0");
2652
+ if (this.fullConfig.config.debug?.enabled && l < 3) {
2653
+ const u = c.dataset.finalTransform || "";
2654
+ console.log(`Image ${l} final state:`, {
3098
2655
  left: c.style.left,
3099
2656
  top: c.style.top,
3100
2657
  width: c.style.width,
3101
2658
  height: c.style.height,
3102
2659
  computedWidth: c.offsetWidth,
3103
2660
  computedHeight: c.offsetHeight,
3104
- transform: d,
2661
+ transform: u,
3105
2662
  pathType: this.entryAnimationEngine.getPathType()
3106
2663
  });
3107
2664
  }
3108
2665
  }), r++);
3109
- }, l = () => {
2666
+ }, h = () => {
3110
2667
  if (this.logDebug("Starting queue processing, enabled:", this.fullConfig.animation.queue.enabled), !this.fullConfig.animation.queue.enabled) {
3111
2668
  for (; this.displayQueue.length > 0; ) {
3112
2669
  const c = this.displayQueue.shift();
@@ -3127,65 +2684,65 @@ let $e = class {
3127
2684
  }, this.fullConfig.animation.queue.interval);
3128
2685
  };
3129
2686
  if ("IntersectionObserver" in window && this.containerEl) {
3130
- const c = new IntersectionObserver((u) => {
3131
- u.forEach((h) => {
3132
- h.isIntersecting && (l(), c.disconnect());
2687
+ const c = new IntersectionObserver((d) => {
2688
+ d.forEach((l) => {
2689
+ l.isIntersecting && (h(), c.disconnect());
3133
2690
  });
3134
2691
  }, { threshold: 0.1, rootMargin: "50px" });
3135
2692
  c.observe(this.containerEl);
3136
2693
  } else
3137
- l();
3138
- this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((c) => c.remove()), s.forEach((c, u) => {
3139
- const h = document.createElement("div");
3140
- h.className = "fbn-ic-debug-center", h.style.position = "absolute", h.style.width = "12px", h.style.height = "12px", h.style.borderRadius = "50%", h.style.backgroundColor = "red", h.style.border = "2px solid yellow", h.style.zIndex = "9999", h.style.pointerEvents = "none";
3141
- const d = c.x, f = c.y;
3142
- h.style.left = `${d - 6}px`, h.style.top = `${f - 6}px`, h.title = `Image ${u}: center (${Math.round(d)}, ${Math.round(f)})`, this.containerEl.appendChild(h);
3143
- })), t.forEach((c, u) => {
3144
- const h = document.createElement("img");
3145
- h.referrerPolicy = "no-referrer", h.classList.add("fbn-ic-image"), h.dataset.imageId = String(u);
3146
- const d = s[u];
3147
- h.style.position = "absolute", h.style.width = "auto", h.style.height = `${e}px`, h.style.left = `${d.x}px`, h.style.top = `${d.y}px`, d.zIndex && (h.style.zIndex = String(d.zIndex)), tt(h, this.defaultStyles), et(h, this.defaultClassName), h.addEventListener("mouseenter", () => {
3148
- this.hoveredImage = { element: h, layout: d }, this.zoomEngine.isInvolved(h) || (tt(h, this.hoverStyles), et(h, this.hoverClassName));
3149
- }), h.addEventListener("mouseleave", () => {
3150
- this.hoveredImage = null, this.zoomEngine.isInvolved(h) || (tt(h, this.defaultStyles), zt(h, this.hoverClassName), et(h, this.defaultClassName));
3151
- }), h.addEventListener("click", (f) => {
3152
- f.stopPropagation(), this.handleImageClick(h, d);
3153
- }), h.style.opacity = "0", h.style.transition = this.entryAnimationEngine.getTransitionCSS(), h.onload = () => {
2694
+ h();
2695
+ this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((c) => c.remove()), s.forEach((c, d) => {
2696
+ const l = document.createElement("div");
2697
+ l.className = "fbn-ic-debug-center", l.style.position = "absolute", l.style.width = "12px", l.style.height = "12px", l.style.borderRadius = "50%", l.style.backgroundColor = "red", l.style.border = "2px solid yellow", l.style.zIndex = "9999", l.style.pointerEvents = "none";
2698
+ const u = c.x, m = c.y;
2699
+ l.style.left = `${u - 6}px`, l.style.top = `${m - 6}px`, l.title = `Image ${d}: center (${Math.round(u)}, ${Math.round(m)})`, this.containerEl.appendChild(l);
2700
+ })), t.forEach((c, d) => {
2701
+ const l = document.createElement("img");
2702
+ l.referrerPolicy = "no-referrer", l.classList.add("fbn-ic-image"), l.dataset.imageId = String(d);
2703
+ const u = s[d];
2704
+ l.style.position = "absolute", l.style.width = "auto", l.style.height = `${e}px`, l.style.left = `${u.x}px`, l.style.top = `${u.y}px`, u.zIndex && (l.style.zIndex = String(u.zIndex)), it(l, this.defaultStyles), nt(l, this.defaultClassName), l.addEventListener("mouseenter", () => {
2705
+ this.hoveredImage = { element: l, layout: u }, this.zoomEngine.isInvolved(l) || (it(l, this.hoverStyles), nt(l, this.hoverClassName));
2706
+ }), l.addEventListener("mouseleave", () => {
2707
+ this.hoveredImage = null, this.zoomEngine.isInvolved(l) || (it(l, this.defaultStyles), Dt(l, this.hoverClassName), nt(l, this.defaultClassName));
2708
+ }), l.addEventListener("click", (m) => {
2709
+ m.stopPropagation(), this.handleImageClick(l, u);
2710
+ }), l.style.opacity = "0", l.style.transition = this.entryAnimationEngine.getTransitionCSS(), l.onload = () => {
3154
2711
  if (o !== this.loadGeneration)
3155
2712
  return;
3156
- const f = h.naturalWidth / h.naturalHeight, b = e * f;
3157
- h.style.width = `${b}px`;
3158
- const p = { x: d.x, y: d.y }, g = { width: b, height: e }, m = this.entryAnimationEngine.calculateStartPosition(
2713
+ const m = l.naturalWidth / l.naturalHeight, b = e * m;
2714
+ l.style.width = `${b}px`;
2715
+ const p = { x: u.x, y: u.y }, g = { width: b, height: e }, f = this.entryAnimationEngine.calculateStartPosition(
3159
2716
  p,
3160
2717
  g,
3161
2718
  i,
3162
- u,
2719
+ d,
3163
2720
  t.length
3164
- ), E = this.entryAnimationEngine.calculateStartRotation(d.rotation), v = this.entryAnimationEngine.calculateStartScale(d.scale), w = this.entryAnimationEngine.buildFinalTransform(
3165
- d.rotation,
3166
- d.scale,
2721
+ ), E = this.entryAnimationEngine.calculateStartRotation(u.rotation), v = this.entryAnimationEngine.calculateStartScale(u.scale), x = this.entryAnimationEngine.buildFinalTransform(
2722
+ u.rotation,
2723
+ u.scale,
3167
2724
  b,
3168
2725
  e
3169
- ), S = this.entryAnimationEngine.buildStartTransform(
3170
- m,
2726
+ ), w = this.entryAnimationEngine.buildStartTransform(
2727
+ f,
3171
2728
  p,
3172
- d.rotation,
3173
- d.scale,
2729
+ u.rotation,
2730
+ u.scale,
3174
2731
  b,
3175
2732
  e,
3176
2733
  E,
3177
2734
  v
3178
2735
  );
3179
- this.fullConfig.config.debug?.enabled && u < 3 && console.log(`Image ${u}:`, {
2736
+ this.fullConfig.config.debug?.enabled && d < 3 && console.log(`Image ${d}:`, {
3180
2737
  finalPosition: p,
3181
2738
  imageSize: g,
3182
- left: d.x,
3183
- top: d.y,
3184
- finalTransform: w,
2739
+ left: u.x,
2740
+ top: u.y,
2741
+ finalTransform: x,
3185
2742
  renderedWidth: b,
3186
2743
  renderedHeight: e
3187
- }), h.style.transform = S, h.dataset.finalTransform = w, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || E !== d.rotation || v !== d.scale) && (h.dataset.startX = String(m.x), h.dataset.startY = String(m.y), h.dataset.endX = String(p.x), h.dataset.endY = String(p.y), h.dataset.imageWidth = String(b), h.dataset.imageHeight = String(e), h.dataset.rotation = String(d.rotation), h.dataset.scale = String(d.scale), h.dataset.startRotation = String(E), h.dataset.startScale = String(v)), this.displayQueue.push(h);
3188
- }, h.onerror = () => r++, h.src = c;
2744
+ }), l.style.transform = w, l.dataset.finalTransform = x, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || E !== u.rotation || v !== u.scale) && (l.dataset.startX = String(f.x), l.dataset.startY = String(f.y), l.dataset.endX = String(p.x), l.dataset.endY = String(p.y), l.dataset.imageWidth = String(b), l.dataset.imageHeight = String(e), l.dataset.rotation = String(u.rotation), l.dataset.scale = String(u.scale), l.dataset.startRotation = String(E), l.dataset.startScale = String(v)), this.displayQueue.push(l);
2745
+ }, l.onerror = () => r++, l.src = c;
3189
2746
  });
3190
2747
  }
3191
2748
  async handleImageClick(t, e) {
@@ -3229,28 +2786,28 @@ let $e = class {
3229
2786
  this.clearImageCloud(), this.loadingElAutoCreated && this.loadingEl && (this.loadingEl.remove(), this.loadingEl = null), this.errorElAutoCreated && this.errorEl && (this.errorEl.remove(), this.errorEl = null), this.counterElAutoCreated && this.counterEl && (this.counterEl.remove(), this.counterEl = null), this.resizeTimeout !== null && clearTimeout(this.resizeTimeout), this.swipeEngine?.destroy();
3230
2787
  }
3231
2788
  };
3232
- const He = $t(
2789
+ const Ne = Ht(
3233
2790
  function({ className: t, style: e, ...i }, o) {
3234
- const s = wt(null), r = wt(null);
3235
- return Ut(o, () => ({
2791
+ const s = Et(null), r = Et(null);
2792
+ return Nt(o, () => ({
3236
2793
  get instance() {
3237
2794
  return r.current;
3238
2795
  }
3239
- })), Pt(() => {
2796
+ })), jt(() => {
3240
2797
  if (!s.current) return;
3241
- const a = new $e({
2798
+ const a = new Oe({
3242
2799
  container: s.current,
3243
2800
  ...i
3244
2801
  });
3245
- return r.current = a, a.init().catch((l) => {
3246
- console.error("ImageCloud init failed:", l);
2802
+ return r.current = a, a.init().catch((h) => {
2803
+ console.error("ImageCloud init failed:", h);
3247
2804
  }), () => {
3248
2805
  a.destroy(), r.current = null;
3249
2806
  };
3250
- }, [JSON.stringify(i)]), /* @__PURE__ */ Ot("div", { ref: s, className: t, style: e });
2807
+ }, [JSON.stringify(i)]), /* @__PURE__ */ Pt("div", { ref: s, className: t, style: e });
3251
2808
  }
3252
2809
  );
3253
2810
  export {
3254
- He as ImageCloud
2811
+ Ne as ImageCloud
3255
2812
  };
3256
2813
  //# sourceMappingURL=react.js.map