@frybynite/image-cloud 0.10.1 → 0.11.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,5 +1,5 @@
1
- import { jsx as Ht } from "react/jsx-runtime";
2
- import { forwardRef as Nt, useRef as It, useImperativeHandle as kt, useEffect as Bt } from "react";
1
+ import { jsx as kt } from "react/jsx-runtime";
2
+ import { forwardRef as Ht, useRef as St, useImperativeHandle as Nt, useEffect as Bt } from "react";
3
3
  const mt = Object.freeze({
4
4
  none: "none",
5
5
  sm: "0 2px 4px rgba(0,0,0,0.1)",
@@ -15,7 +15,7 @@ const mt = Object.freeze({
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
- }), At = Object.freeze({
18
+ }), Tt = 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 }),
@@ -24,9 +24,9 @@ const mt = Object.freeze({
24
24
  type: "linear"
25
25
  }), vt = Object.freeze({
26
26
  mode: "none"
27
- }), Et = Object.freeze({
27
+ }), xt = Object.freeze({
28
28
  mode: "none"
29
- }), Ft = Object.freeze({
29
+ }), Mt = Object.freeze({
30
30
  default: Object.freeze({
31
31
  border: Object.freeze({
32
32
  width: 0,
@@ -66,7 +66,7 @@ const mt = Object.freeze({
66
66
  }), qt = Object.freeze({
67
67
  mobile: Object.freeze({ maxWidth: 767 }),
68
68
  tablet: Object.freeze({ maxWidth: 1199 })
69
- }), Xt = Object.freeze({
69
+ }), Yt = Object.freeze({
70
70
  mode: "adaptive",
71
71
  // Default to adaptive sizing
72
72
  minSize: 50,
@@ -78,16 +78,16 @@ const mt = Object.freeze({
78
78
  // No variance by default
79
79
  max: 1
80
80
  })
81
- }), Yt = Object.freeze({
81
+ }), Xt = Object.freeze({
82
82
  mode: "none",
83
83
  range: Object.freeze({
84
84
  min: -15,
85
85
  max: 15
86
86
  })
87
- }), zt = Object.freeze({
88
- sizing: Xt,
89
- rotation: Yt
90
87
  }), Ot = Object.freeze({
88
+ sizing: Yt,
89
+ rotation: Xt
90
+ }), zt = Object.freeze({
91
91
  validateUrls: !0,
92
92
  validationTimeout: 5e3,
93
93
  validationMethod: "head",
@@ -96,16 +96,16 @@ const mt = Object.freeze({
96
96
  enabled: !1,
97
97
  centers: !1,
98
98
  loaders: !1
99
- }), Vt = Object.freeze({ maxAngle: 5, speed: 2e3, sync: "random" }), Jt = Object.freeze({ minScale: 0.95, maxScale: 1.05, speed: 2400, sync: "random" }), Kt = Object.freeze({ onRatio: 0.7, speed: 3e3, style: "snap" }), Zt = Object.freeze({ speed: 4e3, direction: "clockwise" }), $t = Object.freeze({ type: "none" }), C = Object.freeze({
99
+ }), Vt = Object.freeze({ maxAngle: 5, speed: 2e3, sync: "random" }), Jt = Object.freeze({ minScale: 0.95, maxScale: 1.05, speed: 2400, sync: "random" }), Kt = Object.freeze({ onRatio: 0.7, speed: 3e3, style: "snap" }), Zt = Object.freeze({ speed: 4e3, direction: "clockwise" }), $t = Object.freeze({ type: "none" }), L = Object.freeze({
100
100
  // Loader configuration (always an array, composite behavior is implicit)
101
101
  loaders: [],
102
102
  // Shared loader settings and debug config
103
103
  config: Object.freeze({
104
- loaders: Ot,
104
+ loaders: zt,
105
105
  debug: Dt
106
106
  }),
107
107
  // Image sizing and rotation configuration
108
- image: zt,
108
+ image: Ot,
109
109
  // Pattern-based layout configuration
110
110
  layout: Object.freeze({
111
111
  algorithm: "radial",
@@ -159,7 +159,7 @@ const mt = Object.freeze({
159
159
  // smooth deceleration
160
160
  path: yt,
161
161
  rotation: vt,
162
- scale: Et
162
+ scale: xt
163
163
  }),
164
164
  idle: $t
165
165
  }),
@@ -174,9 +174,7 @@ const mt = Object.freeze({
174
174
  }),
175
175
  navigation: Object.freeze({
176
176
  keyboard: !0,
177
- swipe: !0,
178
- mouseWheel: void 0
179
- // STUB: Not implemented yet
177
+ swipe: !0
180
178
  }),
181
179
  dragging: !0
182
180
  }),
@@ -188,7 +186,7 @@ const mt = Object.freeze({
188
186
  showFocusOutline: !1
189
187
  }),
190
188
  // Image styling
191
- styling: Ft
189
+ styling: Mt
192
190
  });
193
191
  function Z(o, t) {
194
192
  if (!o) return t || {};
@@ -230,132 +228,98 @@ function te(o, t) {
230
228
  }
231
229
  return i;
232
230
  }
233
- function ee(o) {
234
- const t = o.layout?.rotation;
235
- if (t && "enabled" in t)
236
- return {
237
- rotation: {
238
- mode: t.enabled ? "random" : "none",
239
- range: t.range
240
- }
241
- };
242
- }
243
- function ie(o) {
244
- const t = o.layout?.sizing?.variance;
245
- if (t)
246
- return {
247
- sizing: {
248
- mode: "adaptive",
249
- // Legacy variance config implies adaptive mode
250
- variance: t
251
- }
252
- };
253
- }
254
- function ne(o = {}) {
255
- const t = ee(o), i = ie(o);
256
- let e = o.image;
257
- (t || i) && (e = {
258
- ...i || {},
259
- ...t || {},
260
- ...e
261
- }, e.rotation && t?.rotation && o.image?.rotation && (e.rotation = {
262
- ...t.rotation,
263
- ...o.image.rotation
264
- }));
265
- const n = [...o.loaders ?? []];
266
- o.images && o.images.length > 0 && n.unshift({
231
+ function ee(o = {}) {
232
+ const t = o.image, i = [...o.loaders ?? []];
233
+ o.images && o.images.length > 0 && i.unshift({
267
234
  static: {
268
235
  sources: [{ urls: o.images }]
269
236
  }
270
237
  });
271
- const r = {
238
+ const n = {
272
239
  loaders: {
273
- ...Ot,
240
+ ...zt,
274
241
  ...o.config?.loaders ?? {}
275
242
  }
276
- }, a = {
277
- loaders: n,
278
- config: r,
279
- image: te(zt, e),
280
- layout: { ...C.layout },
281
- animation: { ...C.animation },
282
- interaction: { ...C.interaction },
283
- ui: { ...C.ui },
284
- styling: Qt(Ft, o.styling)
243
+ }, s = {
244
+ loaders: i,
245
+ config: n,
246
+ image: te(Ot, t),
247
+ layout: { ...L.layout },
248
+ animation: { ...L.animation },
249
+ interaction: { ...L.interaction },
250
+ ui: { ...L.ui },
251
+ styling: Qt(Mt, o.styling)
285
252
  };
286
- o.layout && (a.layout = {
287
- ...C.layout,
253
+ if (o.layout && (s.layout = {
254
+ ...L.layout,
288
255
  ...o.layout
289
- }, o.layout.responsive && (a.layout.responsive = {
290
- ...C.layout.responsive,
291
- mobile: o.layout.responsive.mobile ? { ...C.layout.responsive.mobile, ...o.layout.responsive.mobile } : C.layout.responsive.mobile,
292
- tablet: o.layout.responsive.tablet ? { ...C.layout.responsive.tablet, ...o.layout.responsive.tablet } : C.layout.responsive.tablet
293
- }), o.layout.spacing && (a.layout.spacing = {
294
- ...C.layout.spacing,
256
+ }, o.layout.responsive && (s.layout.responsive = {
257
+ ...L.layout.responsive,
258
+ mobile: o.layout.responsive.mobile ? { ...L.layout.responsive.mobile, ...o.layout.responsive.mobile } : L.layout.responsive.mobile,
259
+ tablet: o.layout.responsive.tablet ? { ...L.layout.responsive.tablet, ...o.layout.responsive.tablet } : L.layout.responsive.tablet
260
+ }), o.layout.spacing && (s.layout.spacing = {
261
+ ...L.layout.spacing,
295
262
  ...o.layout.spacing
296
- })), o.animation && (a.animation = {
297
- ...C.animation,
263
+ })), o.animation && (s.animation = {
264
+ ...L.animation,
298
265
  ...o.animation
299
- }, o.animation.easing && (a.animation.easing = {
300
- ...C.animation.easing,
266
+ }, o.animation.easing && (s.animation.easing = {
267
+ ...L.animation.easing,
301
268
  ...o.animation.easing
302
- }), o.animation.queue && (a.animation.queue = {
303
- ...C.animation.queue,
269
+ }), o.animation.queue && (s.animation.queue = {
270
+ ...L.animation.queue,
304
271
  ...o.animation.queue
305
- }), o.animation.entry && (a.animation.entry = {
306
- ...C.animation.entry,
272
+ }), o.animation.entry && (s.animation.entry = {
273
+ ...L.animation.entry,
307
274
  ...o.animation.entry,
308
275
  start: o.animation.entry.start ? {
309
- ...C.animation.entry.start,
276
+ ...L.animation.entry.start,
310
277
  ...o.animation.entry.start,
311
- circular: o.animation.entry.start.circular ? { ...C.animation.entry.start.circular, ...o.animation.entry.start.circular } : C.animation.entry.start.circular
312
- } : C.animation.entry.start,
313
- timing: o.animation.entry.timing ? { ...C.animation.entry.timing, ...o.animation.entry.timing } : C.animation.entry.timing,
314
- path: o.animation.entry.path ? { ...yt, ...o.animation.entry.path } : C.animation.entry.path,
315
- rotation: o.animation.entry.rotation ? { ...vt, ...o.animation.entry.rotation } : C.animation.entry.rotation,
316
- scale: o.animation.entry.scale ? { ...Et, ...o.animation.entry.scale } : C.animation.entry.scale
317
- }), o.animation.idle && (a.animation.idle = {
278
+ circular: o.animation.entry.start.circular ? { ...L.animation.entry.start.circular, ...o.animation.entry.start.circular } : L.animation.entry.start.circular
279
+ } : L.animation.entry.start,
280
+ timing: o.animation.entry.timing ? { ...L.animation.entry.timing, ...o.animation.entry.timing } : L.animation.entry.timing,
281
+ path: o.animation.entry.path ? { ...yt, ...o.animation.entry.path } : L.animation.entry.path,
282
+ rotation: o.animation.entry.rotation ? { ...vt, ...o.animation.entry.rotation } : L.animation.entry.rotation,
283
+ scale: o.animation.entry.scale ? { ...xt, ...o.animation.entry.scale } : L.animation.entry.scale
284
+ }), o.animation.idle && (s.animation.idle = {
318
285
  ...$t,
319
286
  ...o.animation.idle
320
- })), o.interaction && (a.interaction = {
321
- ...C.interaction,
287
+ })), o.interaction && (s.interaction = {
288
+ ...L.interaction,
322
289
  ...o.interaction
323
- }, o.interaction.focus && (a.interaction.focus = {
324
- ...C.interaction.focus,
290
+ }, o.interaction.focus && (s.interaction.focus = {
291
+ ...L.interaction.focus,
325
292
  ...o.interaction.focus
326
- }), o.interaction.navigation && (a.interaction.navigation = {
327
- ...C.interaction.navigation,
293
+ }), o.interaction.navigation && (s.interaction.navigation = {
294
+ ...L.interaction.navigation,
328
295
  ...o.interaction.navigation
329
- }));
330
- const c = o.rendering?.ui;
331
- if (c && console.warn("[ImageCloud] rendering.ui is deprecated. Use top-level ui instead."), a.ui = {
332
- ...C.ui,
333
- ...c,
296
+ })), s.ui = {
297
+ ...L.ui,
334
298
  ...o.ui
335
- }, a.config.debug = {
299
+ }, s.config.debug = {
336
300
  ...Dt,
337
301
  ...o.config?.debug ?? {}
338
- }, a.layout.algorithm === "honeycomb" && a.styling) {
339
- const l = { shape: "hexagon", mode: "height-relative" };
340
- a.styling = {
341
- ...a.styling,
342
- default: { ...a.styling.default, clipPath: l },
343
- hover: { ...a.styling.hover, clipPath: l }
302
+ }, s.layout.algorithm === "honeycomb" && s.styling) {
303
+ const r = { shape: "hexagon", mode: "height-relative" };
304
+ s.styling = {
305
+ ...s.styling,
306
+ default: { ...s.styling.default, clipPath: r },
307
+ hover: { ...s.styling.hover, clipPath: r }
344
308
  // focused: untouched — user config respected
345
309
  };
346
310
  }
347
- return a;
311
+ return s;
348
312
  }
349
- function oe(o, t) {
313
+ function ie(o, t) {
350
314
  return { ...o ? Ct[o] : Ct.playful, ...t };
351
315
  }
352
- function se(o, t) {
316
+ function ne(o, t) {
353
317
  return { ...o ? Rt[o] : Rt.gentle, ...t };
354
318
  }
355
- function ae(o, t) {
356
- return { ...o ? At[o] : At.gentle, ...t };
319
+ function oe(o, t) {
320
+ return { ...o ? Tt[o] : Tt.gentle, ...t };
357
321
  }
358
- class re {
322
+ class se {
359
323
  constructor(t) {
360
324
  this.activeAnimations = /* @__PURE__ */ new Map(), this.animationIdCounter = 0, this.config = t;
361
325
  }
@@ -382,12 +346,12 @@ class re {
382
346
  */
383
347
  animateTransformCancellable(t, i, e, n = null, s = null) {
384
348
  this.cancelAllAnimations(t);
385
- const r = n ?? this.config.duration, a = s ?? this.config.easing.default, c = this.buildTransformString(i), l = this.buildTransformString(e);
349
+ const r = n ?? this.config.duration, a = s ?? this.config.easing.default, c = this.buildTransformString(i), d = this.buildTransformString(e);
386
350
  t.style.transition = "none";
387
351
  const u = t.animate(
388
352
  [
389
353
  { transform: c },
390
- { transform: l }
354
+ { transform: d }
391
355
  ],
392
356
  {
393
357
  duration: r,
@@ -395,7 +359,7 @@ class re {
395
359
  fill: "forwards"
396
360
  // Keep final state after animation
397
361
  }
398
- ), h = {
362
+ ), f = {
399
363
  id: `anim-${++this.animationIdCounter}`,
400
364
  element: t,
401
365
  animation: u,
@@ -404,11 +368,11 @@ class re {
404
368
  startTime: performance.now(),
405
369
  duration: r
406
370
  };
407
- return this.activeAnimations.set(t, h), u.finished.then(() => {
408
- t.style.transform = l, this.activeAnimations.delete(t);
371
+ return this.activeAnimations.set(t, f), u.finished.then(() => {
372
+ t.style.transform = d, this.activeAnimations.delete(t);
409
373
  }).catch(() => {
410
374
  this.activeAnimations.delete(t);
411
- }), h;
375
+ }), f;
412
376
  }
413
377
  /**
414
378
  * Cancel an active animation
@@ -514,31 +478,31 @@ class re {
514
478
  function J(o, t, i) {
515
479
  return o + (t - o) * i;
516
480
  }
517
- function ce(o, t, i, e) {
518
- const { overshoot: n, bounces: s, decayRatio: r } = e, a = i.x - t.x, c = i.y - t.y, l = le(s, r);
519
- let u = 0, h = 0, d = 1, g = n, b = !1;
520
- for (let f = 0; f < l.length; f++)
521
- if (o <= l[f].time) {
522
- h = f === 0 ? 0 : l[f - 1].time, d = l[f].time, g = l[f].overshoot, b = l[f].isOvershoot;
481
+ function ae(o, t, i, e) {
482
+ const { overshoot: n, bounces: s, decayRatio: r } = e, a = i.x - t.x, c = i.y - t.y, d = re(s, r);
483
+ let u = 0, f = 0, m = 1, p = n, w = !1;
484
+ for (let l = 0; l < d.length; l++)
485
+ if (o <= d[l].time) {
486
+ f = l === 0 ? 0 : d[l - 1].time, m = d[l].time, p = d[l].overshoot, w = d[l].isOvershoot;
523
487
  break;
524
488
  }
525
- const p = (o - h) / (d - h);
526
- if (b)
527
- u = 1 + g * at(p);
528
- else if (h === 0)
529
- u = at(p);
489
+ const v = (o - f) / (m - f);
490
+ if (w)
491
+ u = 1 + p * at(v);
492
+ else if (f === 0)
493
+ u = at(v);
530
494
  else {
531
- const m = 1 + (l.find(
532
- (y, E) => y.time > h && E > 0 && l[E - 1].isOvershoot
533
- )?.overshoot || g);
534
- u = J(m, 1, at(p));
495
+ const g = 1 + (d.find(
496
+ (h, b) => h.time > f && b > 0 && d[b - 1].isOvershoot
497
+ )?.overshoot || p);
498
+ u = J(g, 1, at(v));
535
499
  }
536
500
  return {
537
501
  x: t.x + a * u,
538
502
  y: t.y + c * u
539
503
  };
540
504
  }
541
- function le(o, t) {
505
+ function re(o, t) {
542
506
  const i = [];
543
507
  let e = 0.6;
544
508
  i.push({ time: e, overshoot: 0, isOvershoot: !1 });
@@ -548,57 +512,57 @@ function le(o, t) {
548
512
  e += r, i.push({ time: e, overshoot: n, isOvershoot: !0 }), e += r, i.push({ time: e, overshoot: n * t, isOvershoot: !1 }), n *= t;
549
513
  return i.push({ time: 1, overshoot: 0, isOvershoot: !1 }), i;
550
514
  }
551
- function he(o, t, i, e) {
552
- const { stiffness: n, damping: s, mass: r, oscillations: a } = e, c = i.x - t.x, l = i.y - t.y, u = Math.sqrt(n / r), h = s / (2 * Math.sqrt(n * r));
553
- let d;
554
- if (h < 1) {
555
- const g = u * Math.sqrt(1 - h * h), b = Math.exp(-h * u * o * 3), p = Math.cos(g * o * a * Math.PI);
556
- d = 1 - b * p;
515
+ function ce(o, t, i, e) {
516
+ const { stiffness: n, damping: s, mass: r, oscillations: a } = e, c = i.x - t.x, d = i.y - t.y, u = Math.sqrt(n / r), f = s / (2 * Math.sqrt(n * r));
517
+ let m;
518
+ if (f < 1) {
519
+ const p = u * Math.sqrt(1 - f * f), w = Math.exp(-f * u * o * 3), v = Math.cos(p * o * a * Math.PI);
520
+ m = 1 - w * v;
557
521
  } else
558
- d = 1 - Math.exp(-u * o * 3);
559
- return d = Math.max(0, Math.min(d, 1.3)), {
560
- x: t.x + c * d,
561
- y: t.y + l * d
522
+ m = 1 - Math.exp(-u * o * 3);
523
+ return m = Math.max(0, Math.min(m, 1.3)), {
524
+ x: t.x + c * m,
525
+ y: t.y + d * m
562
526
  };
563
527
  }
564
- function de(o, t, i, e) {
565
- const { amplitude: n, frequency: s, decay: r, decayRate: a, phase: c } = e, l = i.x - t.x, u = i.y - t.y, h = Math.sqrt(l * l + u * u), d = h > 0 ? -u / h : 0, g = h > 0 ? l / h : 1, b = s * Math.PI * 2 * o + c, p = r ? Math.pow(1 - o, a) : 1, f = n * Math.sin(b) * p, m = ue(o);
528
+ function le(o, t, i, e) {
529
+ const { amplitude: n, frequency: s, decay: r, decayRate: a, phase: c } = e, d = i.x - t.x, u = i.y - t.y, f = Math.sqrt(d * d + u * u), m = f > 0 ? -u / f : 0, p = f > 0 ? d / f : 1, w = s * Math.PI * 2 * o + c, v = r ? Math.pow(1 - o, a) : 1, l = n * Math.sin(w) * v, g = he(o);
566
530
  return {
567
- x: J(t.x, i.x, m) + f * d,
568
- y: J(t.y, i.y, m) + f * g
531
+ x: J(t.x, i.x, g) + l * m,
532
+ y: J(t.y, i.y, g) + l * p
569
533
  };
570
534
  }
571
535
  function at(o) {
572
536
  return 1 - (1 - o) * (1 - o);
573
537
  }
574
- function ue(o) {
538
+ function he(o) {
575
539
  return 1 - Math.pow(1 - o, 3);
576
540
  }
577
- function fe(o, t, i) {
541
+ function de(o, t, i) {
578
542
  const { amplitude: e, frequency: n, decay: s } = i, r = Math.sin(o * n * Math.PI * 2), a = s ? Math.pow(1 - o, 2) : 1, c = e * r * a;
579
543
  return t + c;
580
544
  }
581
- function ge(o, t, i) {
545
+ function ue(o, t, i) {
582
546
  const { overshoot: e, bounces: n } = i, s = [];
583
547
  s.push({ time: 0.5, scale: e });
584
548
  let r = e;
585
- const a = 0.5, l = 0.5 / (n * 2);
549
+ const a = 0.5, d = 0.5 / (n * 2);
586
550
  let u = 0.5;
587
- for (let d = 0; d < n; d++) {
588
- const g = 1 - (r - 1) * a;
589
- u += l, s.push({ time: u, scale: g }), r = 1 + (r - 1) * a * a, u += l, d < n - 1 && s.push({ time: u, scale: r });
551
+ for (let m = 0; m < n; m++) {
552
+ const p = 1 - (r - 1) * a;
553
+ u += d, s.push({ time: u, scale: p }), r = 1 + (r - 1) * a * a, u += d, m < n - 1 && s.push({ time: u, scale: r });
590
554
  }
591
555
  s.push({ time: 1, scale: 1 });
592
- let h = 1;
593
- for (let d = 0; d < s.length; d++)
594
- if (o <= s[d].time) {
595
- const g = d === 0 ? 0 : s[d - 1].time, b = d === 0 ? 1 : s[d - 1].scale, p = (o - g) / (s[d].time - g), f = at(p);
596
- h = b + (s[d].scale - b) * f;
556
+ let f = 1;
557
+ for (let m = 0; m < s.length; m++)
558
+ if (o <= s[m].time) {
559
+ const p = m === 0 ? 0 : s[m - 1].time, w = m === 0 ? 1 : s[m - 1].scale, v = (o - p) / (s[m].time - p), l = at(v);
560
+ f = w + (s[m].scale - w) * l;
597
561
  break;
598
562
  }
599
- return h * t;
563
+ return f * t;
600
564
  }
601
- function me(o) {
565
+ function fe(o) {
602
566
  const {
603
567
  element: t,
604
568
  startPosition: i,
@@ -608,64 +572,70 @@ function me(o) {
608
572
  imageWidth: r,
609
573
  imageHeight: a,
610
574
  rotation: c,
611
- scale: l,
575
+ scale: d,
612
576
  onComplete: u,
613
- rotationConfig: h,
614
- startRotation: d,
615
- scaleConfig: g,
616
- startScale: b
617
- } = o, p = n.type, f = d !== void 0 && d !== c, m = h?.mode === "wobble", y = h?.wobble || { amplitude: 15, frequency: 3, decay: !0 }, E = f || m, v = b !== void 0 && b !== l, S = g?.mode === "pop", w = g?.pop || { overshoot: 1.2, bounces: 1 };
618
- if ((p === "linear" || p === "arc") && !E && !(v || S)) {
577
+ onProgress: f,
578
+ rotationConfig: m,
579
+ startRotation: p,
580
+ scaleConfig: w,
581
+ startScale: v
582
+ } = o, l = n.type, g = p !== void 0 && p !== c, h = m?.mode === "wobble", b = m?.wobble || { amplitude: 15, frequency: 3, decay: !0 }, I = g || h, y = v !== void 0 && v !== d, x = w?.mode === "pop", E = w?.pop || { overshoot: 1.2, bounces: 1 };
583
+ if (l === "linear" && !I && !(y || x)) {
619
584
  u && u();
620
585
  return;
621
586
  }
622
- const z = performance.now(), L = -r / 2, _ = -a / 2;
623
- function O(H) {
624
- const N = H - z, R = Math.min(N / s, 1);
625
- let D;
626
- switch (p) {
587
+ const R = performance.now(), M = -r / 2, T = -a / 2;
588
+ function z(k) {
589
+ const D = k - R, O = Math.min(D / s, 1);
590
+ let S;
591
+ switch (l) {
627
592
  case "bounce": {
628
- const k = oe(
593
+ const N = ie(
629
594
  n.bouncePreset,
630
595
  n.bounce
631
596
  );
632
- D = ce(R, i, e, k);
597
+ S = ae(O, i, e, N);
633
598
  break;
634
599
  }
635
600
  case "elastic": {
636
- const k = se(
601
+ const N = ne(
637
602
  n.elasticPreset,
638
603
  n.elastic
639
604
  );
640
- D = he(R, i, e, k);
605
+ S = ce(O, i, e, N);
641
606
  break;
642
607
  }
643
608
  case "wave": {
644
- const k = ae(
609
+ const N = oe(
645
610
  n.wavePreset,
646
611
  n.wave
647
612
  );
648
- D = de(R, i, e, k);
613
+ S = le(O, i, e, N);
649
614
  break;
650
615
  }
651
616
  default:
652
- D = {
653
- x: J(i.x, e.x, R),
654
- y: J(i.y, e.y, R)
617
+ S = {
618
+ x: J(i.x, e.x, O),
619
+ y: J(i.y, e.y, O)
655
620
  };
656
621
  }
657
- const W = D.x - e.x, U = D.y - e.y;
658
- let M;
659
- m ? M = fe(R, c, y) : f ? M = J(d, c, R) : M = c;
622
+ const _ = S.x - e.x, $ = S.y - e.y;
660
623
  let A;
661
- S ? A = ge(R, l, w) : v ? A = J(b, l, R) : A = l, t.style.transform = `translate(${L}px, ${_}px) translate(${W}px, ${U}px) rotate(${M}deg) scale(${A})`, R < 1 ? requestAnimationFrame(O) : (t.style.transform = `translate(${L}px, ${_}px) rotate(${c}deg) scale(${l})`, u && u());
662
- }
663
- requestAnimationFrame(O);
624
+ h ? A = de(O, c, b) : g ? A = J(p, c, O) : A = c;
625
+ let j;
626
+ x ? j = ue(O, d, E) : y ? j = J(v, d, O) : j = d, t.style.transform = `translate(${M}px, ${T}px) translate(${_}px, ${$}px) rotate(${A}deg) scale(${j})`, f && O < 1 && f(O, D, {
627
+ x: S.x,
628
+ y: S.y,
629
+ rotation: A,
630
+ scale: j
631
+ }), O < 1 ? requestAnimationFrame(z) : (t.style.transform = `translate(${M}px, ${T}px) rotate(${c}deg) scale(${d})`, u && u());
632
+ }
633
+ requestAnimationFrame(z);
664
634
  }
665
- function pe(o) {
635
+ function ge(o) {
666
636
  return o === "bounce" || o === "elastic" || o === "wave";
667
637
  }
668
- const be = {
638
+ const me = {
669
639
  radial: "center",
670
640
  spiral: "center",
671
641
  grid: "top",
@@ -674,15 +644,15 @@ const be = {
674
644
  wave: "left",
675
645
  honeycomb: "center"
676
646
  };
677
- class ye {
647
+ class pe {
678
648
  constructor(t, i) {
679
- this.config = t, this.layoutAlgorithm = i, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || yt, this.rotationConfig = t.rotation || vt, this.scaleConfig = t.scale || Et;
649
+ this.config = t, this.layoutAlgorithm = i, this.resolvedStartPosition = this.resolveStartPosition(), this.pathConfig = t.path || yt, this.rotationConfig = t.rotation || vt, this.scaleConfig = t.scale || xt;
680
650
  }
681
651
  /**
682
652
  * Get the effective start position, considering layout-aware defaults
683
653
  */
684
654
  resolveStartPosition() {
685
- return this.config.start.position ? this.config.start.position : be[this.layoutAlgorithm] || "nearest-edge";
655
+ return this.config.start.position ? this.config.start.position : me[this.layoutAlgorithm] || "nearest-edge";
686
656
  }
687
657
  /**
688
658
  * Calculate the starting position for an image's entry animation
@@ -720,9 +690,9 @@ class ye {
720
690
  * Calculate start position from the nearest edge (current default behavior)
721
691
  */
722
692
  calculateNearestEdge(t, i, e, n) {
723
- const s = t.x, r = t.y, a = s, c = e.width - s, l = r, u = e.height - r, h = Math.min(a, c, l, u);
724
- let d = t.x, g = t.y;
725
- return h === a ? d = -(i.width + n) : h === c ? d = e.width + n : h === l ? g = -(i.height + n) : g = e.height + n, { x: d, y: g };
693
+ const s = t.x, r = t.y, a = s, c = e.width - s, d = r, u = e.height - r, f = Math.min(a, c, d, u);
694
+ let m = t.x, p = t.y;
695
+ return f === a ? m = -(i.width + n) : f === c ? m = e.width + n : f === d ? p = -(i.height + n) : p = e.height + n, { x: m, y: p };
726
696
  }
727
697
  /**
728
698
  * Calculate start position from a specific edge
@@ -770,18 +740,18 @@ class ye {
770
740
  calculateCircularPosition(t, i, e, n, s) {
771
741
  const r = this.config.start.circular || {}, a = r.distribution || "even";
772
742
  let c;
773
- const l = r.radius || "120%";
774
- if (typeof l == "string" && l.endsWith("%")) {
775
- const p = parseFloat(l) / 100;
743
+ const d = r.radius || "120%";
744
+ if (typeof d == "string" && d.endsWith("%")) {
745
+ const v = parseFloat(d) / 100;
776
746
  c = Math.sqrt(
777
747
  e.width ** 2 + e.height ** 2
778
- ) * p / 2;
748
+ ) * v / 2;
779
749
  } else
780
- c = typeof l == "number" ? l : 500;
750
+ c = typeof d == "number" ? d : 500;
781
751
  let u;
782
752
  a === "even" ? u = n / s * 2 * Math.PI : u = Math.random() * 2 * Math.PI;
783
- const h = e.width / 2, d = e.height / 2, g = h + Math.cos(u) * c, b = d + Math.sin(u) * c;
784
- return { x: g, y: b };
753
+ const f = e.width / 2, m = e.height / 2, p = f + Math.cos(u) * c, w = m + Math.sin(u) * c;
754
+ return { x: p, y: w };
785
755
  }
786
756
  /**
787
757
  * Get animation parameters for an image
@@ -801,8 +771,8 @@ class ye {
801
771
  * Uses pixel-based centering offset for reliable cross-browser behavior
802
772
  */
803
773
  buildStartTransform(t, i, e, n, s, r, a, c) {
804
- const l = t.x - i.x, u = t.y - i.y, h = a !== void 0 ? a : e, d = c !== void 0 ? c : n, g = s !== void 0 ? -s / 2 : 0, b = r !== void 0 ? -r / 2 : 0, p = s !== void 0 ? `translate(${g}px, ${b}px)` : "translate(-50%, -50%)";
805
- return t.useScale ? `${p} translate(${l}px, ${u}px) rotate(${h}deg) scale(0)` : `${p} translate(${l}px, ${u}px) rotate(${h}deg) scale(${d})`;
774
+ const d = t.x - i.x, u = t.y - i.y, f = a !== void 0 ? a : e, m = c !== void 0 ? c : n, p = s !== void 0 ? -s / 2 : 0, w = r !== void 0 ? -r / 2 : 0, v = s !== void 0 ? `translate(${p}px, ${w}px)` : "translate(-50%, -50%)";
775
+ return t.useScale ? `${v} translate(${d}px, ${u}px) rotate(${f}deg) scale(0)` : `${v} translate(${d}px, ${u}px) rotate(${f}deg) scale(${m})`;
806
776
  }
807
777
  /**
808
778
  * Build the final CSS transform string
@@ -827,7 +797,7 @@ class ye {
827
797
  * Check if the current path type requires JavaScript animation
828
798
  */
829
799
  requiresJSAnimation() {
830
- return pe(this.pathConfig.type);
800
+ return ge(this.pathConfig.type);
831
801
  }
832
802
  /**
833
803
  * Get the path configuration
@@ -929,8 +899,8 @@ class ye {
929
899
  amplitude: 15,
930
900
  frequency: 3,
931
901
  decay: !0
932
- }, { amplitude: n, frequency: s, decay: r } = e, a = Math.sin(t * s * Math.PI * 2), c = r ? Math.pow(1 - t, 2) : 1, l = n * a * c;
933
- return i + l;
902
+ }, { amplitude: n, frequency: s, decay: r } = e, a = Math.sin(t * s * Math.PI * 2), c = r ? Math.pow(1 - t, 2) : 1, d = n * a * c;
903
+ return i + d;
934
904
  }
935
905
  /**
936
906
  * Get the scale configuration
@@ -990,8 +960,8 @@ class ye {
990
960
  let a = i;
991
961
  for (let c = 0; c < r.length; c++)
992
962
  if (t <= r[c].time) {
993
- const l = c === 0 ? 0 : r[c - 1].time, u = c === 0 ? i : r[c - 1].scale, h = (t - l) / (r[c].time - l), d = this.easeOutQuad(h);
994
- a = u + (r[c].scale - u) * d;
963
+ const d = c === 0 ? 0 : r[c - 1].time, u = c === 0 ? i : r[c - 1].scale, f = (t - d) / (r[c].time - d), m = this.easeOutQuad(f);
964
+ a = u + (r[c].scale - u) * m;
995
965
  break;
996
966
  }
997
967
  return a * i;
@@ -1005,9 +975,9 @@ class ye {
1005
975
  let n = i;
1006
976
  const s = 0.5, a = 0.5 / (t * 2);
1007
977
  let c = 0.5;
1008
- for (let l = 0; l < t; l++) {
978
+ for (let d = 0; d < t; d++) {
1009
979
  const u = 1 - (n - 1) * s;
1010
- c += a, e.push({ time: c, scale: u }), n = 1 + (n - 1) * s * s, c += a, l < t - 1 && e.push({ time: c, scale: n });
980
+ c += a, e.push({ time: c, scale: u }), n = 1 + (n - 1) * s * s, c += a, d < t - 1 && e.push({ time: c, scale: n });
1011
981
  }
1012
982
  return e.push({ time: 1, scale: 1 }), e;
1013
983
  }
@@ -1018,7 +988,7 @@ class ye {
1018
988
  return 1 - (1 - t) * (1 - t);
1019
989
  }
1020
990
  }
1021
- class ve {
991
+ class be {
1022
992
  constructor(t, i = 600) {
1023
993
  this.entries = /* @__PURE__ */ new Map(), this.togetherRafId = null, this.togetherSpeed = 0, this.config = t, this.entryDurationMs = i;
1024
994
  }
@@ -1204,7 +1174,7 @@ class ve {
1204
1174
  t.animation && (t.animation.cancel(), t.animation = null), t.blinkAnimation && (t.blinkAnimation.cancel(), t.blinkAnimation = null), t.customTeardown && (t.customTeardown(), t.customTeardown = null);
1205
1175
  }
1206
1176
  }
1207
- class Ee {
1177
+ class ye {
1208
1178
  constructor(t, i = {}) {
1209
1179
  this.config = t, this.imageConfig = i;
1210
1180
  }
@@ -1216,17 +1186,17 @@ class Ee {
1216
1186
  * @returns Array of layout objects with position, rotation, scale
1217
1187
  */
1218
1188
  generate(t, i, e = {}) {
1219
- const n = [], { width: s, height: r } = i, a = this.config.spacing.padding, c = e.fixedHeight ?? 200, l = 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, g = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || g !== 1, f = c * 1.5 / 2, m = c / 2, y = s - a - f, E = r - a - m, v = a + f, S = a + m;
1220
- for (let w = 0; w < t; w++) {
1221
- const I = this.random(v, y), z = this.random(S, E), L = l === "random" ? this.random(u, h) : 0, _ = b ? this.random(d, g) : 1, O = c * _, H = {
1222
- id: w,
1223
- x: I,
1224
- y: z,
1225
- rotation: L,
1226
- scale: _,
1227
- baseSize: O
1189
+ const n = [], { width: s, height: r } = i, a = this.config.spacing.padding, c = e.fixedHeight ?? 200, d = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, f = this.imageConfig.rotation?.range?.max ?? 15, m = this.imageConfig.sizing?.variance?.min ?? 1, p = this.imageConfig.sizing?.variance?.max ?? 1, w = m !== 1 || p !== 1, l = c * 1.5 / 2, g = c / 2, h = s - a - l, b = r - a - g, I = a + l, y = a + g;
1190
+ for (let x = 0; x < t; x++) {
1191
+ const E = this.random(I, h), F = this.random(y, b), R = d === "random" ? this.random(u, f) : 0, M = w ? this.random(m, p) : 1, T = c * M, z = {
1192
+ id: x,
1193
+ x: E,
1194
+ y: F,
1195
+ rotation: R,
1196
+ scale: M,
1197
+ baseSize: T
1228
1198
  };
1229
- n.push(H);
1199
+ n.push(z);
1230
1200
  }
1231
1201
  return n;
1232
1202
  }
@@ -1240,7 +1210,7 @@ class Ee {
1240
1210
  return Math.random() * (i - t) + t;
1241
1211
  }
1242
1212
  }
1243
- class we {
1213
+ class ve {
1244
1214
  constructor(t, i = {}) {
1245
1215
  this.config = t, this.imageConfig = i;
1246
1216
  }
@@ -1252,53 +1222,53 @@ class we {
1252
1222
  * @returns Array of layout objects with position, rotation, scale
1253
1223
  */
1254
1224
  generate(t, i, e = {}) {
1255
- const n = [], { width: s, height: r } = i, a = e.fixedHeight ?? 200, c = this.imageConfig.rotation?.mode ?? "none", l = 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, g = h !== 1 || d !== 1, b = this.config.scaleDecay ?? 0, p = {
1225
+ const n = [], { width: s, height: r } = i, a = e.fixedHeight ?? 200, c = this.imageConfig.rotation?.mode ?? "none", d = this.imageConfig.rotation?.range?.min ?? -15, u = this.imageConfig.rotation?.range?.max ?? 15, f = this.imageConfig.sizing?.variance?.min ?? 1, m = this.imageConfig.sizing?.variance?.max ?? 1, p = f !== 1 || m !== 1, w = this.config.scaleDecay ?? 0, v = {
1256
1226
  ...jt,
1257
1227
  ...this.config.radial
1258
- }, f = e.fixedHeight ?? a, m = s / 2, y = r / 2, E = Math.ceil(Math.sqrt(t)), v = this.config.spacing.padding ?? 50, S = Math.max(f * 0.8, Math.min(
1259
- m - v - f / 2,
1260
- y - v - f / 2
1228
+ }, l = e.fixedHeight ?? a, g = s / 2, h = r / 2, b = Math.ceil(Math.sqrt(t)), I = this.config.spacing.padding ?? 50, y = Math.max(l * 0.8, Math.min(
1229
+ g - I - l / 2,
1230
+ h - I - l / 2
1261
1231
  ));
1262
1232
  if (t > 0) {
1263
- const z = g ? this.random(h, d) : 1, L = f * z;
1233
+ const F = p ? this.random(f, m) : 1, R = l * F;
1264
1234
  n.push({
1265
1235
  id: 0,
1266
- x: m,
1267
- y,
1268
- rotation: c === "random" ? this.random(l * 0.33, u * 0.33) : 0,
1236
+ x: g,
1237
+ y: h,
1238
+ rotation: c === "random" ? this.random(d * 0.33, u * 0.33) : 0,
1269
1239
  // Less rotation for center
1270
- scale: z,
1271
- baseSize: L,
1240
+ scale: F,
1241
+ baseSize: R,
1272
1242
  zIndex: 100
1273
1243
  // Center image is highest
1274
1244
  });
1275
1245
  }
1276
- let w = 1, I = 1;
1277
- for (; w < t; ) {
1278
- const z = I / E, L = b > 0 ? 1 - z * b * 0.5 : 1, _ = Math.max(f * 0.8, S / E * 1.5 / p.tightness), O = I * _, H = O * 1.5, N = Math.PI * (3 * (H + O) - Math.sqrt((3 * H + O) * (H + 3 * O))), R = this.estimateWidth(f), D = Math.floor(N / (R * 0.7));
1279
- if (D === 0) {
1280
- I++;
1246
+ let x = 1, E = 1;
1247
+ for (; x < t; ) {
1248
+ const F = E / b, R = w > 0 ? 1 - F * w * 0.5 : 1, M = Math.max(l * 0.8, y / b * 1.5 / v.tightness), T = E * M, z = T * 1.5, k = Math.PI * (3 * (z + T) - Math.sqrt((3 * z + T) * (z + 3 * T))), D = this.estimateWidth(l), O = Math.floor(k / (D * 0.7));
1249
+ if (O === 0) {
1250
+ E++;
1281
1251
  continue;
1282
1252
  }
1283
- const W = 2 * Math.PI / D, U = I * (20 * Math.PI / 180);
1284
- for (let M = 0; M < D && w < t; M++) {
1285
- const A = M * W + U, k = g ? this.random(h, d) : 1, q = L * k, T = f * q;
1286
- let $ = m + Math.cos(A) * H, F = y + Math.sin(A) * O;
1287
- const P = T * 1.5 / 2, B = T / 2;
1288
- $ - P < v ? $ = v + P : $ + P > s - v && ($ = s - v - P), F - B < v ? F = v + B : F + B > r - v && (F = r - v - B);
1289
- const Y = c === "random" ? this.random(l, u) : 0;
1253
+ const S = 2 * Math.PI / O, _ = E * (20 * Math.PI / 180);
1254
+ for (let $ = 0; $ < O && x < t; $++) {
1255
+ const A = $ * S + _, j = p ? this.random(f, m) : 1, N = R * j, P = l * N;
1256
+ let H = g + Math.cos(A) * z, U = h + Math.sin(A) * T;
1257
+ const B = P * 1.5 / 2, W = P / 2;
1258
+ H - B < I ? H = I + B : H + B > s - I && (H = s - I - B), U - W < I ? U = I + W : U + W > r - I && (U = r - I - W);
1259
+ const X = c === "random" ? this.random(d, u) : 0;
1290
1260
  n.push({
1291
- id: w,
1292
- x: $,
1293
- y: F,
1294
- rotation: Y,
1295
- scale: q,
1296
- baseSize: T,
1297
- zIndex: Math.max(1, 100 - I)
1261
+ id: x,
1262
+ x: H,
1263
+ y: U,
1264
+ rotation: X,
1265
+ scale: N,
1266
+ baseSize: P,
1267
+ zIndex: Math.max(1, 100 - E)
1298
1268
  // Outer rings have lower z-index
1299
- }), w++;
1269
+ }), x++;
1300
1270
  }
1301
- I++;
1271
+ E++;
1302
1272
  }
1303
1273
  return n;
1304
1274
  }
@@ -1331,7 +1301,7 @@ const xe = {
1331
1301
  alignment: "center",
1332
1302
  gap: 10,
1333
1303
  overflowOffset: 0.25
1334
- }, Tt = [
1304
+ }, At = [
1335
1305
  { x: 1, y: 1 },
1336
1306
  // bottom-right
1337
1307
  { x: -1, y: -1 },
@@ -1349,7 +1319,7 @@ const xe = {
1349
1319
  { x: 0, y: 1 }
1350
1320
  // down
1351
1321
  ];
1352
- class Se {
1322
+ class Ee {
1353
1323
  constructor(t, i = {}) {
1354
1324
  this.config = t, this.imageConfig = i;
1355
1325
  }
@@ -1361,60 +1331,60 @@ class Se {
1361
1331
  * @returns Array of layout objects with position, rotation, scale
1362
1332
  */
1363
1333
  generate(t, i, e = {}) {
1364
- const n = [], { width: s, height: r } = i, a = { ...xe, ...this.config.grid }, c = this.config.spacing.padding, l = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.sizing?.variance?.min ?? 1, d = this.imageConfig.sizing?.variance?.max ?? 1, g = h !== 1 || d !== 1, b = s - 2 * c, p = r - 2 * c, { columns: f, rows: m } = this.calculateGridDimensions(
1334
+ const n = [], { width: s, height: r } = i, a = { ...xe, ...this.config.grid }, c = this.config.spacing.padding, d = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", f = this.imageConfig.sizing?.variance?.min ?? 1, m = this.imageConfig.sizing?.variance?.max ?? 1, p = f !== 1 || m !== 1, w = s - 2 * c, v = r - 2 * c, { columns: l, rows: g } = this.calculateGridDimensions(
1365
1335
  t,
1366
- b,
1367
- p,
1368
- l,
1336
+ w,
1337
+ v,
1338
+ d,
1369
1339
  a
1370
- ), y = a.stagger === "row", E = a.stagger === "column", v = y ? f + 0.5 : f, S = E ? m + 0.5 : m, w = (b - a.gap * (f - 1)) / v, I = (p - a.gap * (m - 1)) / S, z = y ? w / 2 : 0, L = E ? I / 2 : 0, _ = 1 + a.overlap, O = Math.min(w, I) * _, H = e.fixedHeight ? Math.min(e.fixedHeight, O) : O, N = f * w + (f - 1) * a.gap + z, R = m * I + (m - 1) * a.gap + L, D = c + (b - N) / 2, W = c + (p - R) / 2, U = f * m, M = a.columns !== "auto" && a.rows !== "auto", A = M && t > U;
1340
+ ), h = a.stagger === "row", b = a.stagger === "column", I = h ? l + 0.5 : l, y = b ? g + 0.5 : g, x = (w - a.gap * (l - 1)) / I, E = (v - a.gap * (g - 1)) / y, F = h ? x / 2 : 0, R = b ? E / 2 : 0, M = 1 + a.overlap, T = Math.min(x, E) * M, z = e.fixedHeight ? Math.min(e.fixedHeight, T) : T, k = l * x + (l - 1) * a.gap + F, D = g * E + (g - 1) * a.gap + R, O = c + (w - k) / 2, S = c + (v - D) / 2, _ = l * g, $ = a.columns !== "auto" && a.rows !== "auto", A = $ && t > _;
1371
1341
  typeof window < "u" && (window.__gridOverflowDebug = {
1372
1342
  gridConfigColumns: a.columns,
1373
1343
  gridConfigRows: a.rows,
1374
- columns: f,
1375
- rows: m,
1376
- cellCount: U,
1377
- hasFixedGrid: M,
1344
+ columns: l,
1345
+ rows: g,
1346
+ cellCount: _,
1347
+ hasFixedGrid: $,
1378
1348
  imageCount: t,
1379
1349
  isOverflowMode: A
1380
1350
  });
1381
- const k = A ? new Array(U).fill(0) : [], q = Math.min(w, I) * a.overflowOffset;
1382
- for (let T = 0; T < t; T++) {
1383
- let $, F, X = 0;
1384
- if (A && T >= U) {
1385
- const G = T - U, j = G % U;
1386
- X = Math.floor(G / U) + 1, k[j]++, a.fillDirection === "row" ? ($ = j % f, F = Math.floor(j / f)) : (F = j % m, $ = Math.floor(j / m));
1351
+ const j = A ? new Array(_).fill(0) : [], N = Math.min(x, E) * a.overflowOffset;
1352
+ for (let P = 0; P < t; P++) {
1353
+ let H, U, Y = 0;
1354
+ if (A && P >= _) {
1355
+ const q = P - _, G = q % _;
1356
+ Y = Math.floor(q / _) + 1, j[G]++, a.fillDirection === "row" ? (H = G % l, U = Math.floor(G / l)) : (U = G % g, H = Math.floor(G / g));
1387
1357
  } else
1388
- a.fillDirection === "row" ? ($ = T % f, F = Math.floor(T / f)) : (F = T % m, $ = Math.floor(T / m));
1389
- let P = D + $ * (w + a.gap) + w / 2, B = W + F * (I + a.gap) + I / 2;
1390
- if (a.stagger === "row" && F % 2 === 1 ? P += w / 2 : a.stagger === "column" && $ % 2 === 1 && (B += I / 2), X > 0) {
1391
- const G = (X - 1) % Tt.length, j = Tt[G];
1392
- P += j.x * q, B += j.y * q;
1358
+ a.fillDirection === "row" ? (H = P % l, U = Math.floor(P / l)) : (U = P % g, H = Math.floor(P / g));
1359
+ let B = O + H * (x + a.gap) + x / 2, W = S + U * (E + a.gap) + E / 2;
1360
+ if (a.stagger === "row" && U % 2 === 1 ? B += x / 2 : a.stagger === "column" && H % 2 === 1 && (W += E / 2), Y > 0) {
1361
+ const q = (Y - 1) % At.length, G = At[q];
1362
+ B += G.x * N, W += G.y * N;
1393
1363
  }
1394
1364
  if (a.jitter > 0) {
1395
- const G = w / 2 * a.jitter, j = I / 2 * a.jitter;
1396
- P += this.random(-G, G), B += this.random(-j, j);
1365
+ const q = x / 2 * a.jitter, G = E / 2 * a.jitter;
1366
+ B += this.random(-q, q), W += this.random(-G, G);
1397
1367
  }
1398
- let Y = P, V = B;
1368
+ let X = B, V = W;
1399
1369
  if (!A && a.fillDirection === "row") {
1400
- const G = t % f || f;
1401
- if (F === Math.floor((t - 1) / f) && G < f) {
1402
- const St = G * w + (G - 1) * a.gap;
1370
+ const q = t % l || l;
1371
+ if (U === Math.floor((t - 1) / l) && q < l) {
1372
+ const It = q * x + (q - 1) * a.gap;
1403
1373
  let gt = 0;
1404
- a.alignment === "center" ? gt = (N - St) / 2 : a.alignment === "end" && (gt = N - St), Y += gt;
1374
+ a.alignment === "center" ? gt = (k - It) / 2 : a.alignment === "end" && (gt = k - It), X += gt;
1405
1375
  }
1406
1376
  }
1407
- const ct = g ? this.random(h, d) : 1, K = H * ct, nt = K * 1.5 / 2, ot = K / 2, ht = c + nt, dt = s - c - nt, _t = c + ot, Ut = r - c - ot;
1408
- Y = Math.max(ht, Math.min(Y, dt)), V = Math.max(_t, Math.min(V, Ut));
1377
+ const ct = p ? this.random(f, m) : 1, K = z * ct, nt = K * 1.5 / 2, ot = K / 2, ht = c + nt, dt = s - c - nt, _t = c + ot, Ut = r - c - ot;
1378
+ X = Math.max(ht, Math.min(X, dt)), V = Math.max(_t, Math.min(V, Ut));
1409
1379
  let ut = 0;
1410
1380
  if (u === "random") {
1411
- const G = this.imageConfig.rotation?.range?.min ?? -15, j = this.imageConfig.rotation?.range?.max ?? 15;
1412
- a.jitter > 0 ? ut = this.random(G * a.jitter, j * a.jitter) : ut = this.random(G, j);
1381
+ const q = this.imageConfig.rotation?.range?.min ?? -15, G = this.imageConfig.rotation?.range?.max ?? 15;
1382
+ a.jitter > 0 ? ut = this.random(q * a.jitter, G * a.jitter) : ut = this.random(q, G);
1413
1383
  }
1414
1384
  let ft;
1415
- A && X > 0 ? ft = 50 - X : ft = A ? 100 + T : T + 1, n.push({
1416
- id: T,
1417
- x: Y,
1385
+ A && Y > 0 ? ft = 50 - Y : ft = A ? 100 + P : P + 1, n.push({
1386
+ id: P,
1387
+ x: X,
1418
1388
  y: V,
1419
1389
  rotation: ut,
1420
1390
  scale: ct,
@@ -1449,14 +1419,14 @@ class Se {
1449
1419
  return Math.random() * (i - t) + t;
1450
1420
  }
1451
1421
  }
1452
- const Ie = Math.PI * (3 - Math.sqrt(5)), Ce = {
1422
+ const we = Math.PI * (3 - Math.sqrt(5)), Ie = {
1453
1423
  spiralType: "golden",
1454
1424
  direction: "counterclockwise",
1455
1425
  tightness: 1,
1456
1426
  scaleDecay: 0,
1457
1427
  startAngle: 0
1458
1428
  };
1459
- class Re {
1429
+ class Se {
1460
1430
  constructor(t, i = {}) {
1461
1431
  this.config = t, this.imageConfig = i;
1462
1432
  }
@@ -1468,36 +1438,36 @@ class Re {
1468
1438
  * @returns Array of layout objects with position, rotation, scale
1469
1439
  */
1470
1440
  generate(t, i, e = {}) {
1471
- const n = [], { width: s, height: r } = i, a = { ...Ce, ...this.config.spiral }, c = this.config.spacing.padding, l = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, g = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = g !== 1 || b !== 1, f = this.config.scaleDecay ?? a.scaleDecay, m = s / 2, y = r / 2, E = Math.min(
1472
- m - c - l / 2,
1473
- y - c - l / 2
1474
- ), v = a.direction === "clockwise" ? -1 : 1;
1475
- for (let S = 0; S < t; S++) {
1476
- let w, I;
1441
+ const n = [], { width: s, height: r } = i, a = { ...Ie, ...this.config.spiral }, c = this.config.spacing.padding, d = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", f = this.imageConfig.rotation?.range?.min ?? -15, m = this.imageConfig.rotation?.range?.max ?? 15, p = this.imageConfig.sizing?.variance?.min ?? 1, w = this.imageConfig.sizing?.variance?.max ?? 1, v = p !== 1 || w !== 1, l = this.config.scaleDecay ?? a.scaleDecay, g = s / 2, h = r / 2, b = Math.min(
1442
+ g - c - d / 2,
1443
+ h - c - d / 2
1444
+ ), I = a.direction === "clockwise" ? -1 : 1;
1445
+ for (let y = 0; y < t; y++) {
1446
+ let x, E;
1477
1447
  if (a.spiralType === "golden")
1478
- w = S * Ie * v + a.startAngle, I = this.calculateGoldenRadius(S, t, E, a.tightness);
1448
+ x = y * we * I + a.startAngle, E = this.calculateGoldenRadius(y, t, b, a.tightness);
1479
1449
  else if (a.spiralType === "archimedean") {
1480
- const P = S * 0.5 * a.tightness;
1481
- w = P * v + a.startAngle, I = this.calculateArchimedeanRadius(P, t, E, a.tightness);
1450
+ const B = y * 0.5 * a.tightness;
1451
+ x = B * I + a.startAngle, E = this.calculateArchimedeanRadius(B, t, b, a.tightness);
1482
1452
  } else {
1483
- const P = S * 0.3 * a.tightness;
1484
- w = P * v + a.startAngle, I = this.calculateLogarithmicRadius(P, t, E, a.tightness);
1453
+ const B = y * 0.3 * a.tightness;
1454
+ x = B * I + a.startAngle, E = this.calculateLogarithmicRadius(B, t, b, a.tightness);
1485
1455
  }
1486
- const z = m + Math.cos(w) * I, L = y + Math.sin(w) * I, _ = I / E, O = f > 0 ? 1 - _ * f * 0.5 : 1, H = p ? this.random(g, b) : 1, N = O * H, R = l * N, W = R * 1.5 / 2, U = R / 2, M = c + W, A = s - c - W, k = c + U, q = r - c - U, T = Math.max(M, Math.min(z, A)), $ = Math.max(k, Math.min(L, q));
1487
- let F = 0;
1456
+ const F = g + Math.cos(x) * E, R = h + Math.sin(x) * E, M = E / b, T = l > 0 ? 1 - M * l * 0.5 : 1, z = v ? this.random(p, w) : 1, k = T * z, D = d * k, S = D * 1.5 / 2, _ = D / 2, $ = c + S, A = s - c - S, j = c + _, N = r - c - _, P = Math.max($, Math.min(F, A)), H = Math.max(j, Math.min(R, N));
1457
+ let U = 0;
1488
1458
  if (u === "random") {
1489
- const P = w * 180 / Math.PI % 360, B = this.random(h, d);
1490
- F = a.spiralType === "golden" ? B : P * 0.1 + B * 0.9;
1491
- } else u === "tangent" && (F = this.calculateSpiralTangent(w, I, a));
1492
- const X = t - S;
1459
+ const B = x * 180 / Math.PI % 360, W = this.random(f, m);
1460
+ U = a.spiralType === "golden" ? W : B * 0.1 + W * 0.9;
1461
+ } else u === "tangent" && (U = this.calculateSpiralTangent(x, E, a));
1462
+ const Y = t - y;
1493
1463
  n.push({
1494
- id: S,
1495
- x: T,
1496
- y: $,
1497
- rotation: F,
1498
- scale: N,
1499
- baseSize: R,
1500
- zIndex: X
1464
+ id: y,
1465
+ x: P,
1466
+ y: H,
1467
+ rotation: U,
1468
+ scale: k,
1469
+ baseSize: D,
1470
+ zIndex: Y
1501
1471
  });
1502
1472
  }
1503
1473
  return n;
@@ -1540,8 +1510,8 @@ class Re {
1540
1510
  * r = a * e^(b*θ)
1541
1511
  */
1542
1512
  calculateLogarithmicRadius(t, i, e, n) {
1543
- const s = e * 0.05, r = 0.15 / n, a = s * Math.exp(r * t), c = i * 0.3 * n, l = s * Math.exp(r * c);
1544
- return a / l * e;
1513
+ const s = e * 0.05, r = 0.15 / n, a = s * Math.exp(r * t), c = i * 0.3 * n, d = s * Math.exp(r * c);
1514
+ return a / d * e;
1545
1515
  }
1546
1516
  /**
1547
1517
  * Utility: Generate random number between min and max
@@ -1550,7 +1520,7 @@ class Re {
1550
1520
  return Math.random() * (i - t) + t;
1551
1521
  }
1552
1522
  }
1553
- const Ae = {
1523
+ const Ce = {
1554
1524
  clusterCount: "auto",
1555
1525
  clusterSpread: 150,
1556
1526
  clusterSpacing: 200,
@@ -1558,7 +1528,7 @@ const Ae = {
1558
1528
  overlap: 0.3,
1559
1529
  distribution: "gaussian"
1560
1530
  };
1561
- class Te {
1531
+ class Re {
1562
1532
  constructor(t, i = {}) {
1563
1533
  this.config = t, this.imageConfig = i;
1564
1534
  }
@@ -1570,48 +1540,48 @@ class Te {
1570
1540
  * @returns Array of layout objects with position, rotation, scale
1571
1541
  */
1572
1542
  generate(t, i, e = {}) {
1573
- const n = [], { width: s, height: r } = i, a = { ...Ae, ...this.config.cluster }, c = this.config.spacing.padding, l = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", h = this.imageConfig.rotation?.range?.min ?? -15, d = this.imageConfig.rotation?.range?.max ?? 15, g = this.imageConfig.sizing?.variance?.min ?? 1, b = this.imageConfig.sizing?.variance?.max ?? 1, p = g !== 1 || b !== 1, f = this.calculateClusterCount(
1543
+ const n = [], { width: s, height: r } = i, a = { ...Ce, ...this.config.cluster }, c = this.config.spacing.padding, d = e.fixedHeight ?? 200, u = this.imageConfig.rotation?.mode ?? "none", f = this.imageConfig.rotation?.range?.min ?? -15, m = this.imageConfig.rotation?.range?.max ?? 15, p = this.imageConfig.sizing?.variance?.min ?? 1, w = this.imageConfig.sizing?.variance?.max ?? 1, v = p !== 1 || w !== 1, l = this.calculateClusterCount(
1574
1544
  t,
1575
1545
  a.clusterCount,
1576
1546
  s,
1577
1547
  r,
1578
1548
  a.clusterSpacing
1579
- ), m = this.generateClusterCenters(
1580
- f,
1549
+ ), g = this.generateClusterCenters(
1550
+ l,
1581
1551
  s,
1582
1552
  r,
1583
1553
  c,
1584
1554
  a
1585
- ), y = new Array(f).fill(0);
1586
- for (let v = 0; v < t; v++)
1587
- y[v % f]++;
1588
- let E = 0;
1589
- for (let v = 0; v < f; v++) {
1590
- const S = m[v], w = y[v];
1591
- for (let I = 0; I < w; I++) {
1592
- let z, L;
1555
+ ), h = new Array(l).fill(0);
1556
+ for (let I = 0; I < t; I++)
1557
+ h[I % l]++;
1558
+ let b = 0;
1559
+ for (let I = 0; I < l; I++) {
1560
+ const y = g[I], x = h[I];
1561
+ for (let E = 0; E < x; E++) {
1562
+ let F, R;
1593
1563
  if (a.distribution === "gaussian")
1594
- z = this.gaussianRandom() * S.spread, L = this.gaussianRandom() * S.spread;
1564
+ F = this.gaussianRandom() * y.spread, R = this.gaussianRandom() * y.spread;
1595
1565
  else {
1596
- const F = this.random(0, Math.PI * 2), X = this.random(0, S.spread);
1597
- z = Math.cos(F) * X, L = Math.sin(F) * X;
1566
+ const U = this.random(0, Math.PI * 2), Y = this.random(0, y.spread);
1567
+ F = Math.cos(U) * Y, R = Math.sin(U) * Y;
1598
1568
  }
1599
- const _ = 1 + a.overlap * 0.5, O = 1 + a.overlap * 0.3;
1600
- z /= _, L /= _;
1601
- const H = p ? this.random(g, b) : 1, N = O * H, R = l * N;
1602
- let D = S.x + z, W = S.y + L;
1603
- const M = R * 1.5 / 2, A = R / 2;
1604
- D = Math.max(c + M, Math.min(D, s - c - M)), W = Math.max(c + A, Math.min(W, r - c - A));
1605
- const k = u === "random" ? this.random(h, d) : 0, T = Math.sqrt(z * z + L * L) / S.spread, $ = Math.round((1 - T) * 50) + 1;
1569
+ const M = 1 + a.overlap * 0.5, T = 1 + a.overlap * 0.3;
1570
+ F /= M, R /= M;
1571
+ const z = v ? this.random(p, w) : 1, k = T * z, D = d * k;
1572
+ let O = y.x + F, S = y.y + R;
1573
+ const $ = D * 1.5 / 2, A = D / 2;
1574
+ O = Math.max(c + $, Math.min(O, s - c - $)), S = Math.max(c + A, Math.min(S, r - c - A));
1575
+ const j = u === "random" ? this.random(f, m) : 0, P = Math.sqrt(F * F + R * R) / y.spread, H = Math.round((1 - P) * 50) + 1;
1606
1576
  n.push({
1607
- id: E,
1608
- x: D,
1609
- y: W,
1610
- rotation: k,
1611
- scale: N,
1612
- baseSize: R,
1613
- zIndex: $
1614
- }), E++;
1577
+ id: b,
1578
+ x: O,
1579
+ y: S,
1580
+ rotation: j,
1581
+ scale: k,
1582
+ baseSize: D,
1583
+ zIndex: H
1584
+ }), b++;
1615
1585
  }
1616
1586
  }
1617
1587
  return n;
@@ -1631,24 +1601,24 @@ class Te {
1631
1601
  * Generate cluster center positions with spacing constraints
1632
1602
  */
1633
1603
  generateClusterCenters(t, i, e, n, s) {
1634
- const r = [], c = n + s.clusterSpread, l = i - n - s.clusterSpread, u = n + s.clusterSpread, h = e - n - s.clusterSpread;
1635
- for (let d = 0; d < t; d++) {
1636
- let g = null, b = -1;
1637
- for (let p = 0; p < 100; p++) {
1638
- const f = {
1639
- x: this.random(c, l),
1640
- y: this.random(u, h),
1604
+ const r = [], c = n + s.clusterSpread, d = i - n - s.clusterSpread, u = n + s.clusterSpread, f = e - n - s.clusterSpread;
1605
+ for (let m = 0; m < t; m++) {
1606
+ let p = null, w = -1;
1607
+ for (let v = 0; v < 100; v++) {
1608
+ const l = {
1609
+ x: this.random(c, d),
1610
+ y: this.random(u, f),
1641
1611
  spread: this.calculateClusterSpread(s)
1642
1612
  };
1643
- let m = 1 / 0;
1644
- for (const y of r) {
1645
- const E = f.x - y.x, v = f.y - y.y, S = Math.sqrt(E * E + v * v);
1646
- m = Math.min(m, S);
1613
+ let g = 1 / 0;
1614
+ for (const h of r) {
1615
+ const b = l.x - h.x, I = l.y - h.y, y = Math.sqrt(b * b + I * I);
1616
+ g = Math.min(g, y);
1647
1617
  }
1648
- if ((r.length === 0 || m > b) && (g = f, b = m), m >= s.clusterSpacing)
1618
+ if ((r.length === 0 || g > w) && (p = l, w = g), g >= s.clusterSpacing)
1649
1619
  break;
1650
1620
  }
1651
- g && r.push(g);
1621
+ p && r.push(p);
1652
1622
  }
1653
1623
  return r;
1654
1624
  }
@@ -1676,7 +1646,7 @@ class Te {
1676
1646
  return Math.random() * (i - t) + t;
1677
1647
  }
1678
1648
  }
1679
- class Le {
1649
+ class Te {
1680
1650
  constructor(t, i = {}) {
1681
1651
  this.config = t, this.imageConfig = i;
1682
1652
  }
@@ -1688,29 +1658,29 @@ class Le {
1688
1658
  * @returns Array of layout objects with position, rotation, scale
1689
1659
  */
1690
1660
  generate(t, i, e = {}) {
1691
- const n = [], { width: s, height: r } = i, a = e.fixedHeight ?? 200, c = this.config.spacing.padding ?? 50, l = 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, g = this.imageConfig.sizing?.variance?.max ?? 1, b = d !== 1 || g !== 1, p = e.fixedHeight ?? a, f = {
1661
+ const n = [], { width: s, height: r } = i, a = e.fixedHeight ?? 200, c = this.config.spacing.padding ?? 50, d = this.imageConfig.rotation?.mode ?? "none", u = this.imageConfig.rotation?.range?.min ?? -15, f = this.imageConfig.rotation?.range?.max ?? 15, m = this.imageConfig.sizing?.variance?.min ?? 1, p = this.imageConfig.sizing?.variance?.max ?? 1, w = m !== 1 || p !== 1, v = e.fixedHeight ?? a, l = {
1692
1662
  ...Wt,
1693
1663
  ...this.config.wave
1694
- }, { rows: m, amplitude: y, frequency: E, phaseShift: v, synchronization: S } = f, w = Math.ceil(t / m), L = p * 1.5 / 2, _ = c + L, O = s - c - L, H = O - _, N = w > 1 ? H / (w - 1) : 0, R = c + y + p / 2, D = r - c - y - p / 2, W = D - R, U = m > 1 ? W / (m - 1) : 0;
1695
- let M = 0;
1696
- for (let A = 0; A < m && M < t; A++) {
1697
- const k = m === 1 ? (R + D) / 2 : R + A * U;
1698
- let q = 0;
1699
- S === "offset" ? q = A * v : S === "alternating" && (q = A * Math.PI);
1700
- for (let T = 0; T < w && M < t; T++) {
1701
- const $ = w === 1 ? (_ + O) / 2 : _ + T * N, F = this.calculateWaveY($, s, y, E, q), X = $, P = k + F, B = b ? this.random(d, g) : 1, Y = p * B;
1664
+ }, { rows: g, amplitude: h, frequency: b, phaseShift: I, synchronization: y } = l, x = Math.ceil(t / g), R = v * 1.5 / 2, M = c + R, T = s - c - R, z = T - M, k = x > 1 ? z / (x - 1) : 0, D = c + h + v / 2, O = r - c - h - v / 2, S = O - D, _ = g > 1 ? S / (g - 1) : 0;
1665
+ let $ = 0;
1666
+ for (let A = 0; A < g && $ < t; A++) {
1667
+ const j = g === 1 ? (D + O) / 2 : D + A * _;
1668
+ let N = 0;
1669
+ y === "offset" ? N = A * I : y === "alternating" && (N = A * Math.PI);
1670
+ for (let P = 0; P < x && $ < t; P++) {
1671
+ const H = x === 1 ? (M + T) / 2 : M + P * k, U = this.calculateWaveY(H, s, h, b, N), Y = H, B = j + U, W = w ? this.random(m, p) : 1, X = v * W;
1702
1672
  let V = 0;
1703
- l === "tangent" ? V = this.calculateRotation($, s, y, E, q) : l === "random" && (V = this.random(u, h));
1704
- const K = Y * 1.5 / 2, lt = Y / 2, nt = c + K, ot = s - c - K, ht = c + lt, dt = r - c - lt;
1673
+ d === "tangent" ? V = this.calculateRotation(H, s, h, b, N) : d === "random" && (V = this.random(u, f));
1674
+ const K = X * 1.5 / 2, lt = X / 2, nt = c + K, ot = s - c - K, ht = c + lt, dt = r - c - lt;
1705
1675
  n.push({
1706
- id: M,
1707
- x: Math.max(nt, Math.min(X, ot)),
1708
- y: Math.max(ht, Math.min(P, dt)),
1676
+ id: $,
1677
+ x: Math.max(nt, Math.min(Y, ot)),
1678
+ y: Math.max(ht, Math.min(B, dt)),
1709
1679
  rotation: V,
1710
- scale: B,
1711
- baseSize: Y,
1712
- zIndex: M + 1
1713
- }), M++;
1680
+ scale: W,
1681
+ baseSize: X,
1682
+ zIndex: $ + 1
1683
+ }), $++;
1714
1684
  }
1715
1685
  }
1716
1686
  return n;
@@ -1753,7 +1723,7 @@ class Le {
1753
1723
  return Math.random() * (i - t) + t;
1754
1724
  }
1755
1725
  }
1756
- const wt = 100, Q = 100 / Math.sqrt(3), xt = [
1726
+ const Et = 100, Q = 100 / Math.sqrt(3), wt = [
1757
1727
  [Q / 2, 0],
1758
1728
  // upper-left
1759
1729
  [3 * Q / 2, 0],
@@ -1766,21 +1736,21 @@ const wt = 100, Q = 100 / Math.sqrt(3), xt = [
1766
1736
  // lower-left
1767
1737
  [0, 50]
1768
1738
  // left
1769
- ], Me = xt[1][0] / wt, Fe = xt[2][1] / wt;
1770
- function ze(o) {
1739
+ ], Ae = wt[1][0] / Et, Le = wt[2][1] / Et;
1740
+ function Fe(o) {
1771
1741
  return {
1772
- colStep: Me * o,
1773
- rowOffset: Fe * o
1742
+ colStep: Ae * o,
1743
+ rowOffset: Le * o
1774
1744
  };
1775
1745
  }
1776
- function Oe(o, t, i, e, n, s) {
1777
- const { colStep: r } = ze(s);
1746
+ function Me(o, t, i, e, n, s) {
1747
+ const { colStep: r } = Fe(s);
1778
1748
  return {
1779
1749
  px: e + r * o,
1780
1750
  py: n + s * (t + o / 2)
1781
1751
  };
1782
1752
  }
1783
- const De = [
1753
+ const Oe = [
1784
1754
  [1, 0, -1],
1785
1755
  [0, 1, -1],
1786
1756
  [-1, 1, 0],
@@ -1788,49 +1758,49 @@ const De = [
1788
1758
  [0, -1, 1],
1789
1759
  [1, -1, 0]
1790
1760
  ];
1791
- function $e(o) {
1761
+ function ze(o) {
1792
1762
  if (o === 0) return [[0, 0, 0]];
1793
1763
  const t = [];
1794
1764
  let [i, e, n] = [0, -o, o];
1795
- for (const [s, r, a] of De)
1765
+ for (const [s, r, a] of Oe)
1796
1766
  for (let c = 0; c < o; c++)
1797
1767
  t.push([i, e, n]), i += s, e += r, n += a;
1798
1768
  return t;
1799
1769
  }
1800
- class Pe {
1770
+ class De {
1801
1771
  // imageConfig intentionally not stored — honeycomb forces uniform sizing (rotation/variance
1802
1772
  // would break hex tiling). Kept as parameter for interface compatibility.
1803
1773
  constructor(t, i = {}) {
1804
1774
  this.config = t;
1805
1775
  }
1806
1776
  generate(t, i, e = {}) {
1807
- const n = [], { width: s, height: r } = i, a = s / 2, c = r / 2, l = e.fixedHeight ?? 200, h = {
1777
+ const n = [], { width: s, height: r } = i, a = s / 2, c = r / 2, d = e.fixedHeight ?? 200, f = {
1808
1778
  ...Gt,
1809
1779
  ...this.config.honeycomb
1810
- }.spacing ?? 0, d = l + h;
1811
- let g = 0, b = 0;
1812
- for (; g < t; ) {
1813
- const p = $e(b);
1814
- for (const [f, m, y] of p) {
1815
- if (g >= t) break;
1816
- const { px: E, py: v } = Oe(f, m, y, a, c, d);
1780
+ }.spacing ?? 0, m = d + f;
1781
+ let p = 0, w = 0;
1782
+ for (; p < t; ) {
1783
+ const v = ze(w);
1784
+ for (const [l, g, h] of v) {
1785
+ if (p >= t) break;
1786
+ const { px: b, py: I } = Me(l, g, h, a, c, m);
1817
1787
  n.push({
1818
- id: g,
1819
- x: E,
1820
- y: v,
1788
+ id: p,
1789
+ x: b,
1790
+ y: I,
1821
1791
  rotation: 0,
1822
1792
  scale: 1,
1823
- baseSize: l,
1793
+ baseSize: d,
1824
1794
  // Inner rings render above outer rings
1825
- zIndex: Math.max(1, 100 - b)
1826
- }), g++;
1795
+ zIndex: Math.max(1, 100 - w)
1796
+ }), p++;
1827
1797
  }
1828
- b++;
1798
+ w++;
1829
1799
  }
1830
1800
  return n;
1831
1801
  }
1832
1802
  }
1833
- class _e {
1803
+ class $e {
1834
1804
  constructor(t) {
1835
1805
  this.config = t.layout, this.imageConfig = t.image, this.layouts = /* @__PURE__ */ new Map(), this.placementLayout = this.initLayout();
1836
1806
  }
@@ -1841,19 +1811,19 @@ class _e {
1841
1811
  initLayout() {
1842
1812
  switch (this.config.algorithm) {
1843
1813
  case "radial":
1844
- return new we(this.config, this.imageConfig);
1814
+ return new ve(this.config, this.imageConfig);
1845
1815
  case "grid":
1846
- return new Se(this.config, this.imageConfig);
1816
+ return new Ee(this.config, this.imageConfig);
1847
1817
  case "spiral":
1848
- return new Re(this.config, this.imageConfig);
1818
+ return new Se(this.config, this.imageConfig);
1849
1819
  case "cluster":
1850
- return new Te(this.config, this.imageConfig);
1820
+ return new Re(this.config, this.imageConfig);
1851
1821
  case "wave":
1852
- return new Le(this.config, this.imageConfig);
1822
+ return new Te(this.config, this.imageConfig);
1853
1823
  case "honeycomb":
1854
- return new Pe(this.config, this.imageConfig);
1824
+ return new De(this.config, this.imageConfig);
1855
1825
  default:
1856
- return new Ee(this.config, this.imageConfig);
1826
+ return new ye(this.config, this.imageConfig);
1857
1827
  }
1858
1828
  }
1859
1829
  /**
@@ -1935,15 +1905,15 @@ class _e {
1935
1905
  const s = this.imageConfig.sizing, r = this.resolveBaseHeight(n);
1936
1906
  if (r !== void 0)
1937
1907
  return { height: r };
1938
- const a = s?.minSize ?? 50, c = s?.maxSize ?? 400, l = this.config.targetCoverage ?? 0.6, u = this.config.densityFactor ?? 1, { width: h, height: d } = t, p = h * d * l / i;
1939
- let m = Math.sqrt(p / 1.4);
1940
- m *= u, m = Math.min(m, e);
1941
- let y = this.clamp(m, a, c);
1942
- if (y === a && m < a) {
1943
- const E = Math.max(a * 0.05, 20);
1944
- y = Math.max(E, m);
1908
+ const a = s?.minSize ?? 50, c = s?.maxSize ?? 400, d = this.config.targetCoverage ?? 0.6, u = this.config.densityFactor ?? 1, { width: f, height: m } = t, v = f * m * d / i;
1909
+ let g = Math.sqrt(v / 1.4);
1910
+ g *= u, g = Math.min(g, e);
1911
+ let h = this.clamp(g, a, c);
1912
+ if (h === a && g < a) {
1913
+ const b = Math.max(a * 0.05, 20);
1914
+ h = Math.max(b, g);
1945
1915
  }
1946
- return this.config.algorithm === "honeycomb" && (y = Math.min(y, this.honeycombMaxImageHeight(i, t))), { height: y };
1916
+ return this.config.algorithm === "honeycomb" && (h = Math.min(h, this.honeycombMaxImageHeight(i, t))), { height: h };
1947
1917
  }
1948
1918
  /**
1949
1919
  * Returns the largest image height at which all honeycomb rings fit within the container.
@@ -1955,8 +1925,8 @@ class _e {
1955
1925
  let e = 0, n = 1;
1956
1926
  for (; n < t; )
1957
1927
  e++, n += 6 * e;
1958
- const s = this.config.spacing?.padding ?? 50, r = this.config.honeycomb?.spacing ?? 0, a = i.width / 2, c = i.height / 2, l = Math.sqrt(3) / 2, u = 1 / Math.sqrt(3), h = (c - s - r * e) / (e + 0.5), d = (a - s - l * r * e) / (l * e + u);
1959
- return Math.max(10, Math.min(h, d));
1928
+ const s = this.config.spacing?.padding ?? 50, r = this.config.honeycomb?.spacing ?? 0, a = i.width / 2, c = i.height / 2, d = Math.sqrt(3) / 2, u = 1 / Math.sqrt(3), f = (c - s - r * e) / (e + 0.5), m = (a - s - d * r * e) / (d * e + u);
1929
+ return Math.max(10, Math.min(f, m));
1960
1930
  }
1961
1931
  /**
1962
1932
  * Utility: Clamp a value between min and max
@@ -1965,7 +1935,7 @@ class _e {
1965
1935
  return Math.max(i, Math.min(e, t));
1966
1936
  }
1967
1937
  }
1968
- var x = /* @__PURE__ */ ((o) => (o.IDLE = "idle", o.FOCUSING = "focusing", o.FOCUSED = "focused", o.UNFOCUSING = "unfocusing", o.CROSS_ANIMATING = "cross_animating", o))(x || {});
1938
+ var C = /* @__PURE__ */ ((o) => (o.IDLE = "idle", o.FOCUSING = "focusing", o.FOCUSED = "focused", o.UNFOCUSING = "unfocusing", o.CROSS_ANIMATING = "cross_animating", o))(C || {});
1969
1939
  const Lt = {
1970
1940
  // Geometric shapes - uses percentages for responsive sizing
1971
1941
  circle: "circle(50%)",
@@ -1975,7 +1945,7 @@ const Lt = {
1975
1945
  hexagon: "polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)",
1976
1946
  octagon: "polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%)",
1977
1947
  diamond: "polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)"
1978
- }, Ue = {
1948
+ }, Pe = {
1979
1949
  // Circle - uses radius in pixels (refHeight of 100px = 50px radius)
1980
1950
  circle: {
1981
1951
  refHeight: 100,
@@ -1999,8 +1969,8 @@ const Lt = {
1999
1969
  },
2000
1970
  // Hexagon - regular hexagon (reference points imported from hexagonGeometry)
2001
1971
  hexagon: {
2002
- refHeight: wt,
2003
- points: xt
1972
+ refHeight: Et,
1973
+ points: wt
2004
1974
  },
2005
1975
  // Octagon - regular octagon
2006
1976
  octagon: {
@@ -2013,29 +1983,29 @@ const Lt = {
2013
1983
  points: [[50, 0], [100, 50], [50, 100], [0, 50]]
2014
1984
  }
2015
1985
  };
2016
- function He(o) {
1986
+ function _e(o) {
2017
1987
  if (o)
2018
1988
  return o in Lt ? Lt[o] : o;
2019
1989
  }
2020
- function Ne(o, t, i) {
2021
- const e = Ue[o];
1990
+ function Ue(o, t, i) {
1991
+ const e = Pe[o];
2022
1992
  if (!e) return "";
2023
1993
  const n = t / e.refHeight;
2024
1994
  if (o === "circle")
2025
1995
  return `circle(${Math.round(50 * n * 100) / 100}px)`;
2026
- const s = e.points.map(([p]) => p), r = e.points.map(([, p]) => p), a = (Math.min(...s) + Math.max(...s)) / 2 * n, c = (Math.min(...r) + Math.max(...r)) / 2 * n, l = (Math.max(...s) - Math.min(...s)) * n, u = (i ?? l) / 2, h = t / 2, d = u - a, g = h - c;
2027
- return `polygon(${e.points.map(([p, f]) => {
2028
- const m = Math.round((p * n + d) * 100) / 100, y = Math.round((f * n + g) * 100) / 100;
2029
- return `${m}px ${y}px`;
1996
+ const s = e.points.map(([v]) => v), r = e.points.map(([, v]) => v), a = (Math.min(...s) + Math.max(...s)) / 2 * n, c = (Math.min(...r) + Math.max(...r)) / 2 * n, d = (Math.max(...s) - Math.min(...s)) * n, u = (i ?? d) / 2, f = t / 2, m = u - a, p = f - c;
1997
+ return `polygon(${e.points.map(([v, l]) => {
1998
+ const g = Math.round((v * n + m) * 100) / 100, h = Math.round((l * n + p) * 100) / 100;
1999
+ return `${g}px ${h}px`;
2030
2000
  }).join(", ")})`;
2031
2001
  }
2032
2002
  function ke(o) {
2033
2003
  return o in mt;
2034
2004
  }
2035
- function Be(o) {
2005
+ function He(o) {
2036
2006
  return o ? ke(o) ? mt[o] : o : mt.md;
2037
2007
  }
2038
- function je(o) {
2008
+ function Ne(o) {
2039
2009
  if (!o) return "";
2040
2010
  const t = [];
2041
2011
  if (o.grayscale !== void 0 && t.push(`grayscale(${o.grayscale})`), o.blur !== void 0 && t.push(`blur(${o.blur}px)`), o.brightness !== void 0 && t.push(`brightness(${o.brightness})`), o.contrast !== void 0 && t.push(`contrast(${o.contrast})`), o.saturate !== void 0 && t.push(`saturate(${o.saturate})`), o.opacity !== void 0 && t.push(`opacity(${o.opacity})`), o.sepia !== void 0 && t.push(`sepia(${o.sepia})`), o.hueRotate !== void 0 && t.push(`hue-rotate(${o.hueRotate}deg)`), o.invert !== void 0 && t.push(`invert(${o.invert})`), o.dropShadow !== void 0)
@@ -2061,34 +2031,34 @@ function it(o, t, i) {
2061
2031
  o.borderRadiusTopLeft !== void 0 ? e.borderTopLeftRadius = `${o.borderRadiusTopLeft}px` : a && (e.borderTopLeftRadius = `${a}px`), o.borderRadiusTopRight !== void 0 ? e.borderTopRightRadius = `${o.borderRadiusTopRight}px` : a && (e.borderTopRightRadius = `${a}px`), o.borderRadiusBottomRight !== void 0 ? e.borderBottomRightRadius = `${o.borderRadiusBottomRight}px` : a && (e.borderBottomRightRadius = `${a}px`), o.borderRadiusBottomLeft !== void 0 ? e.borderBottomLeftRadius = `${o.borderRadiusBottomLeft}px` : a && (e.borderBottomLeftRadius = `${a}px`);
2062
2032
  } else o.border?.radius !== void 0 && (e.borderRadius = `${o.border.radius}px`);
2063
2033
  if (o.borderTop || o.borderRight || o.borderBottom || o.borderLeft) {
2064
- const a = o.border || {}, c = { ...a, ...o.borderTop }, l = { ...a, ...o.borderRight }, u = { ...a, ...o.borderBottom }, h = { ...a, ...o.borderLeft };
2065
- e.borderTop = tt(c), e.borderRight = tt(l), e.borderBottom = tt(u), e.borderLeft = tt(h);
2034
+ const a = o.border || {}, c = { ...a, ...o.borderTop }, d = { ...a, ...o.borderRight }, u = { ...a, ...o.borderBottom }, f = { ...a, ...o.borderLeft };
2035
+ e.borderTop = tt(c), e.borderRight = tt(d), e.borderBottom = tt(u), e.borderLeft = tt(f);
2066
2036
  } else o.border && (e.border = tt(o.border));
2067
- o.shadow !== void 0 && (e.boxShadow = Be(o.shadow));
2068
- const r = je(o.filter);
2037
+ o.shadow !== void 0 && (e.boxShadow = He(o.shadow));
2038
+ const r = Ne(o.filter);
2069
2039
  if (e.filter = r || "none", o.opacity !== void 0 && (e.opacity = String(o.opacity)), o.cursor !== void 0 && (e.cursor = o.cursor), o.outline && o.outline.style !== "none" && (o.outline.width ?? 0) > 0) {
2070
- const a = o.outline.width ?? 0, c = o.outline.style ?? "solid", l = o.outline.color ?? "#000000";
2071
- e.outline = `${a}px ${c} ${l}`, o.outline.offset !== void 0 && (e.outlineOffset = `${o.outline.offset}px`);
2040
+ const a = o.outline.width ?? 0, c = o.outline.style ?? "solid", d = o.outline.color ?? "#000000";
2041
+ e.outline = `${a}px ${c} ${d}`, o.outline.offset !== void 0 && (e.outlineOffset = `${o.outline.offset}px`);
2072
2042
  }
2073
2043
  if (o.objectFit !== void 0 && (e.objectFit = o.objectFit), o.aspectRatio !== void 0 && (e.aspectRatio = o.aspectRatio), o.clipPath !== void 0) {
2074
2044
  let a;
2075
- const c = typeof o.clipPath == "object" && o.clipPath !== null && "shape" in o.clipPath, l = c ? o.clipPath : void 0;
2076
- if (l?.mode === "height-relative" && t)
2077
- a = Ne(l.shape, t, i);
2045
+ const c = typeof o.clipPath == "object" && o.clipPath !== null && "shape" in o.clipPath, d = c ? o.clipPath : void 0;
2046
+ if (d?.mode === "height-relative" && t)
2047
+ a = Ue(d.shape, t, i);
2078
2048
  else {
2079
- const u = c && l ? l.shape : o.clipPath;
2080
- a = He(u);
2049
+ const u = c && d ? d.shape : o.clipPath;
2050
+ a = _e(u);
2081
2051
  }
2082
2052
  a && (a === "none" ? e.clipPath = "unset" : (e.clipPath = a, e.overflow = "hidden"));
2083
2053
  }
2084
2054
  return e;
2085
2055
  }
2086
- function We(o, t) {
2056
+ function Be(o, t) {
2087
2057
  t.borderRadius !== void 0 && (o.style.borderRadius = t.borderRadius), t.borderTopLeftRadius !== void 0 && (o.style.borderTopLeftRadius = t.borderTopLeftRadius), t.borderTopRightRadius !== void 0 && (o.style.borderTopRightRadius = t.borderTopRightRadius), t.borderBottomRightRadius !== void 0 && (o.style.borderBottomRightRadius = t.borderBottomRightRadius), t.borderBottomLeftRadius !== void 0 && (o.style.borderBottomLeftRadius = t.borderBottomLeftRadius), t.border !== void 0 && (o.style.border = t.border), t.borderTop !== void 0 && (o.style.borderTop = t.borderTop), t.borderRight !== void 0 && (o.style.borderRight = t.borderRight), t.borderBottom !== void 0 && (o.style.borderBottom = t.borderBottom), t.borderLeft !== void 0 && (o.style.borderLeft = t.borderLeft), t.boxShadow !== void 0 && (o.style.boxShadow = t.boxShadow), t.filter !== void 0 && (o.style.filter = t.filter), t.opacity !== void 0 && (o.style.opacity = t.opacity), t.cursor !== void 0 && (o.style.cursor = t.cursor), t.outline !== void 0 && (o.style.outline = t.outline), t.outlineOffset !== void 0 && (o.style.outlineOffset = t.outlineOffset), t.objectFit !== void 0 && (o.style.objectFit = t.objectFit), t.aspectRatio !== void 0 && (o.style.aspectRatio = t.aspectRatio), t.clipPath !== void 0 && (o.style.clipPath = t.clipPath), t.overflow !== void 0 && (o.style.overflow = t.overflow);
2088
2058
  }
2089
2059
  function st(o, t, i, e) {
2090
2060
  const n = it(t, i, e);
2091
- We(o, n);
2061
+ Be(o, n);
2092
2062
  }
2093
2063
  function Pt(o) {
2094
2064
  return o ? Array.isArray(o) ? o.join(" ") : o : "";
@@ -2105,13 +2075,13 @@ function pt(o, t) {
2105
2075
  e.trim() && o.classList.remove(e.trim());
2106
2076
  });
2107
2077
  }
2108
- const Mt = {
2078
+ const Ft = {
2109
2079
  UNFOCUSING: 999,
2110
2080
  FOCUSING: 1e3
2111
2081
  };
2112
- class Ge {
2082
+ class je {
2113
2083
  constructor(t, i, e) {
2114
- this.state = x.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null, this.focusGeneration = 0, this.onUnfocusComplete = null, this.config = t, this.animationEngine = i, this.styling = e, this.focusedClassName = e?.focused?.className;
2084
+ this.state = C.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null, this.focusGeneration = 0, this.onUnfocusComplete = null, this.config = t, this.animationEngine = i, this.styling = e, this.focusedClassName = e?.focused?.className;
2115
2085
  }
2116
2086
  /**
2117
2087
  * Set callback to be fired when an unfocus animation fully completes.
@@ -2129,7 +2099,7 @@ class Ge {
2129
2099
  * Check if any animation is in progress
2130
2100
  */
2131
2101
  isAnimating() {
2132
- return this.state !== x.IDLE && this.state !== x.FOCUSED;
2102
+ return this.state !== C.IDLE && this.state !== C.FOCUSED;
2133
2103
  }
2134
2104
  /**
2135
2105
  * Normalize scalePercent value
@@ -2144,8 +2114,8 @@ class Ge {
2144
2114
  calculateFocusDimensions(t, i, e) {
2145
2115
  const n = this.normalizeScalePercent(this.config.scalePercent), s = e.height * n, r = t / i;
2146
2116
  let a = s, c = a * r;
2147
- const l = e.width * n;
2148
- return c > l && (c = l, a = c / r), { width: c, height: a };
2117
+ const d = e.width * n;
2118
+ return c > d && (c = d, a = c / r), { width: c, height: a };
2149
2119
  }
2150
2120
  /**
2151
2121
  * Calculate the transform needed to center an image (position only, no scale)
@@ -2177,11 +2147,11 @@ class Ge {
2177
2147
  * This provides sharper zoom by re-rendering at target size instead of scaling pixels
2178
2148
  */
2179
2149
  animateWithDimensions(t, i, e, n, s, r, a, c) {
2180
- const l = this.buildDimensionZoomTransform(i), u = this.buildDimensionZoomTransform(e);
2150
+ const d = this.buildDimensionZoomTransform(i), u = this.buildDimensionZoomTransform(e);
2181
2151
  return t.style.transition = "none", t.animate(
2182
2152
  [
2183
2153
  {
2184
- transform: l,
2154
+ transform: d,
2185
2155
  width: `${n}px`,
2186
2156
  height: `${s}px`
2187
2157
  },
@@ -2238,33 +2208,33 @@ class Ge {
2238
2208
  * @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
2239
2209
  */
2240
2210
  startFocusAnimation(t, i, e, n, s) {
2241
- const r = t.style.zIndex || "", a = t.offsetWidth, c = t.offsetHeight, l = this.calculateFocusDimensions(a, c, i), u = this.calculateFocusTransform(i, e);
2211
+ const r = t.style.zIndex || "", a = t.offsetWidth, c = t.offsetHeight, d = this.calculateFocusDimensions(a, c, i), u = this.calculateFocusTransform(i, e);
2242
2212
  this.animationEngine.cancelAllAnimations(t);
2243
- const h = this.config.animationDuration ?? 600;
2244
- this.applyFocusedStyling(t, Mt.FOCUSING);
2245
- const d = n ?? {
2213
+ const f = this.config.animationDuration ?? 600;
2214
+ this.applyFocusedStyling(t, Ft.FOCUSING);
2215
+ const m = n ?? {
2246
2216
  x: 0,
2247
2217
  y: 0,
2248
2218
  rotation: e.rotation,
2249
2219
  scale: 1
2250
2220
  // No scale - using dimensions
2251
- }, g = s?.width ?? a, b = s?.height ?? c, p = this.animateWithDimensions(
2221
+ }, p = s?.width ?? a, w = s?.height ?? c, v = this.animateWithDimensions(
2252
2222
  t,
2253
- d,
2223
+ m,
2254
2224
  u,
2255
- g,
2256
- b,
2257
- l.width,
2258
- l.height,
2259
- h
2260
- ), f = {
2225
+ p,
2226
+ w,
2227
+ d.width,
2228
+ d.height,
2229
+ f
2230
+ ), l = {
2261
2231
  id: `focus-${Date.now()}`,
2262
2232
  element: t,
2263
- animation: p,
2264
- fromState: d,
2233
+ animation: v,
2234
+ fromState: m,
2265
2235
  toState: u,
2266
2236
  startTime: performance.now(),
2267
- duration: h
2237
+ duration: f
2268
2238
  };
2269
2239
  return this.focusData = {
2270
2240
  element: t,
@@ -2273,12 +2243,12 @@ class Ge {
2273
2243
  originalZIndex: r,
2274
2244
  originalWidth: a,
2275
2245
  originalHeight: c,
2276
- focusWidth: l.width,
2277
- focusHeight: l.height
2278
- }, this.startClipPathAnimation(t, f, !0), {
2246
+ focusWidth: d.width,
2247
+ focusHeight: d.height
2248
+ }, this.startClipPathAnimation(t, l, !0), {
2279
2249
  element: t,
2280
2250
  originalState: e,
2281
- animationHandle: f,
2251
+ animationHandle: l,
2282
2252
  direction: "in",
2283
2253
  originalWidth: a,
2284
2254
  originalHeight: c
@@ -2290,40 +2260,40 @@ class Ge {
2290
2260
  * @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
2291
2261
  */
2292
2262
  startUnfocusAnimation(t, i, e, n) {
2293
- t.style.zIndex = String(Mt.UNFOCUSING), this.animationEngine.cancelAllAnimations(t);
2263
+ t.style.zIndex = String(Ft.UNFOCUSING), this.animationEngine.cancelAllAnimations(t);
2294
2264
  const s = this.config.animationDuration ?? 600;
2295
2265
  t.classList.remove("fbn-ic-focused"), pt(t, this.focusedClassName);
2296
- const r = e ?? this.focusData?.focusTransform ?? { x: 0, y: 0, rotation: 0, scale: 1 }, a = n?.width ?? this.focusData?.focusWidth ?? t.offsetWidth, c = n?.height ?? this.focusData?.focusHeight ?? t.offsetHeight, l = {
2266
+ const r = e ?? this.focusData?.focusTransform ?? { x: 0, y: 0, rotation: 0, scale: 1 }, a = n?.width ?? this.focusData?.focusWidth ?? t.offsetWidth, c = n?.height ?? this.focusData?.focusHeight ?? t.offsetHeight, d = {
2297
2267
  x: 0,
2298
2268
  y: 0,
2299
2269
  rotation: i.rotation,
2300
2270
  scale: 1
2301
2271
  // No scale - using dimensions
2302
- }, u = this.focusData?.originalWidth ?? t.offsetWidth, h = this.focusData?.originalHeight ?? t.offsetHeight, d = this.animateWithDimensions(
2272
+ }, u = this.focusData?.originalWidth ?? t.offsetWidth, f = this.focusData?.originalHeight ?? t.offsetHeight, m = this.animateWithDimensions(
2303
2273
  t,
2304
2274
  r,
2305
- l,
2275
+ d,
2306
2276
  a,
2307
2277
  c,
2308
2278
  u,
2309
- h,
2279
+ f,
2310
2280
  s
2311
- ), g = {
2281
+ ), p = {
2312
2282
  id: `unfocus-${Date.now()}`,
2313
2283
  element: t,
2314
- animation: d,
2284
+ animation: m,
2315
2285
  fromState: r,
2316
- toState: l,
2286
+ toState: d,
2317
2287
  startTime: performance.now(),
2318
2288
  duration: s
2319
2289
  };
2320
- return this.startClipPathAnimation(t, g, !1), {
2290
+ return this.startClipPathAnimation(t, p, !1), {
2321
2291
  element: t,
2322
2292
  originalState: i,
2323
- animationHandle: g,
2293
+ animationHandle: p,
2324
2294
  direction: "out",
2325
2295
  originalWidth: u,
2326
- originalHeight: h
2296
+ originalHeight: f
2327
2297
  };
2328
2298
  }
2329
2299
  /**
@@ -2369,26 +2339,26 @@ class Ge {
2369
2339
  * Implements cross-animation when swapping focus
2370
2340
  */
2371
2341
  async focusImage(t, i, e) {
2372
- if (this.currentFocus === t && this.state === x.FOCUSED)
2342
+ if (this.currentFocus === t && this.state === C.FOCUSED)
2373
2343
  return this.unfocusImage();
2374
- if (this.incoming?.element === t && this.state === x.FOCUSING) {
2344
+ if (this.incoming?.element === t && this.state === C.FOCUSING) {
2375
2345
  const { transform: s, dimensions: r } = this.captureMidAnimationState(t);
2376
2346
  this.animationEngine.cancelAllAnimations(t), this.outgoing = this.startUnfocusAnimation(
2377
2347
  t,
2378
2348
  this.incoming.originalState,
2379
2349
  s,
2380
2350
  r
2381
- ), this.incoming = null, this.state = x.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 = x.IDLE;
2351
+ ), this.incoming = null, this.state = C.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 = C.IDLE;
2382
2352
  return;
2383
2353
  }
2384
2354
  const n = ++this.focusGeneration;
2385
2355
  switch (this.state) {
2386
- case x.IDLE:
2387
- if (this.state = x.FOCUSING, this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== n) return;
2388
- this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2356
+ case C.IDLE:
2357
+ if (this.state = C.FOCUSING, this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== n) return;
2358
+ this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
2389
2359
  break;
2390
- case x.FOCUSED:
2391
- if (this.state = x.CROSS_ANIMATING, this.currentFocus && this.focusData && (this.outgoing = this.startUnfocusAnimation(
2360
+ case C.FOCUSED:
2361
+ if (this.state = C.CROSS_ANIMATING, this.currentFocus && this.focusData && (this.outgoing = this.startUnfocusAnimation(
2392
2362
  this.currentFocus,
2393
2363
  this.focusData.originalState
2394
2364
  )), this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
@@ -2400,9 +2370,9 @@ class Ge {
2400
2370
  const s = this.outgoing.element;
2401
2371
  this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
2402
2372
  }
2403
- this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2373
+ this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
2404
2374
  break;
2405
- case x.FOCUSING:
2375
+ case C.FOCUSING:
2406
2376
  if (this.incoming && (this.animationEngine.cancelAnimation(this.incoming.animationHandle, !1), this.resetElementInstantly(
2407
2377
  this.incoming.element,
2408
2378
  this.incoming.originalState,
@@ -2410,10 +2380,10 @@ class Ge {
2410
2380
  this.focusData?.originalWidth,
2411
2381
  this.focusData?.originalHeight
2412
2382
  ), this.incoming = null), this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== n) return;
2413
- this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2383
+ this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
2414
2384
  break;
2415
- case x.UNFOCUSING:
2416
- if (this.state = x.CROSS_ANIMATING, this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
2385
+ case C.UNFOCUSING:
2386
+ if (this.state = C.CROSS_ANIMATING, this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
2417
2387
  this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
2418
2388
  this.waitForAnimation(this.incoming.animationHandle)
2419
2389
  ]), this.focusGeneration !== n) return;
@@ -2421,9 +2391,9 @@ class Ge {
2421
2391
  const s = this.outgoing.element;
2422
2392
  this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
2423
2393
  }
2424
- this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2394
+ this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
2425
2395
  break;
2426
- case x.CROSS_ANIMATING:
2396
+ case C.CROSS_ANIMATING:
2427
2397
  if (this.incoming?.element === t)
2428
2398
  return;
2429
2399
  if (this.outgoing?.element === t) {
@@ -2446,7 +2416,7 @@ class Ge {
2446
2416
  const a = this.outgoing.element;
2447
2417
  this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
2448
2418
  }
2449
- this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2419
+ this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
2450
2420
  return;
2451
2421
  }
2452
2422
  if (this.outgoing && (this.animationEngine.cancelAnimation(this.outgoing.animationHandle, !1), this.resetElementInstantly(
@@ -2472,7 +2442,7 @@ class Ge {
2472
2442
  const s = this.outgoing.element;
2473
2443
  this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
2474
2444
  }
2475
- this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2445
+ this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
2476
2446
  break;
2477
2447
  }
2478
2448
  }
@@ -2480,24 +2450,24 @@ class Ge {
2480
2450
  * Unfocus current image, returning it to original position
2481
2451
  */
2482
2452
  async unfocusImage() {
2483
- if (this.state === x.UNFOCUSING)
2453
+ if (this.state === C.UNFOCUSING)
2484
2454
  return;
2485
2455
  const t = ++this.focusGeneration;
2486
2456
  if (!this.currentFocus || !this.focusData) {
2487
- if (this.incoming && this.state === x.FOCUSING) {
2457
+ if (this.incoming && this.state === C.FOCUSING) {
2488
2458
  const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
2489
2459
  if (this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
2490
2460
  this.incoming.element,
2491
2461
  this.incoming.originalState,
2492
2462
  s,
2493
2463
  r
2494
- ), this.incoming = null, this.state = x.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration !== t) return;
2464
+ ), this.incoming = null, this.state = C.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration !== t) return;
2495
2465
  const a = this.outgoing.element;
2496
- this.removeFocusedStyling(a, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state = x.IDLE, this.onUnfocusComplete?.(a);
2466
+ this.removeFocusedStyling(a, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state = C.IDLE, this.onUnfocusComplete?.(a);
2497
2467
  }
2498
2468
  return;
2499
2469
  }
2500
- if (this.state === x.CROSS_ANIMATING && this.incoming) {
2470
+ if (this.state === C.CROSS_ANIMATING && this.incoming) {
2501
2471
  const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
2502
2472
  this.animationEngine.cancelAllAnimations(this.incoming.element);
2503
2473
  const a = this.startUnfocusAnimation(
@@ -2512,13 +2482,13 @@ class Ge {
2512
2482
  ]), this.focusGeneration !== t) return;
2513
2483
  let c = null;
2514
2484
  this.outgoing && (c = this.outgoing.element, this.removeFocusedStyling(c, this.outgoing.originalState.zIndex?.toString() || ""));
2515
- const l = a.element;
2516
- this.removeFocusedStyling(l, this.incoming.originalState.zIndex?.toString() || ""), this.outgoing = null, this.incoming = null, this.currentFocus = null, this.focusData = null, this.state = x.IDLE, c && this.onUnfocusComplete?.(c), this.onUnfocusComplete?.(l);
2485
+ const d = a.element;
2486
+ this.removeFocusedStyling(d, this.incoming.originalState.zIndex?.toString() || ""), this.outgoing = null, this.incoming = null, this.currentFocus = null, this.focusData = null, this.state = C.IDLE, c && this.onUnfocusComplete?.(c), this.onUnfocusComplete?.(d);
2517
2487
  return;
2518
2488
  }
2519
- this.state = x.UNFOCUSING;
2489
+ this.state = C.UNFOCUSING;
2520
2490
  const i = this.currentFocus, e = this.focusData.originalState, n = this.focusData.originalZIndex;
2521
- this.outgoing = this.startUnfocusAnimation(i, e), await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration === t && (this.removeFocusedStyling(i, n), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = x.IDLE, this.onUnfocusComplete?.(i));
2491
+ this.outgoing = this.startUnfocusAnimation(i, e), await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration === t && (this.removeFocusedStyling(i, n), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = C.IDLE, this.onUnfocusComplete?.(i));
2522
2492
  }
2523
2493
  /**
2524
2494
  * Swap focus from current image to a new one (alias for focusImage with cross-animation)
@@ -2536,7 +2506,7 @@ class Ge {
2536
2506
  * Check if an image is currently focused (stable state)
2537
2507
  */
2538
2508
  isFocused(t) {
2539
- return this.currentFocus === t && this.state === x.FOCUSED;
2509
+ return this.currentFocus === t && this.state === C.FOCUSED;
2540
2510
  }
2541
2511
  /**
2542
2512
  * Check if an image is the target of current focus animation
@@ -2557,7 +2527,7 @@ class Ge {
2557
2527
  * Used during swipe gestures for visual feedback
2558
2528
  */
2559
2529
  setDragOffset(t) {
2560
- if (!this.currentFocus || !this.focusData || this.state !== x.FOCUSED) return;
2530
+ if (!this.currentFocus || !this.focusData || this.state !== C.FOCUSED) return;
2561
2531
  const i = this.currentFocus, e = this.focusData.focusTransform, n = ["translate(-50%, -50%)"], s = (e.x ?? 0) + t, r = e.y ?? 0;
2562
2532
  n.push(`translate(${s}px, ${r}px)`), e.rotation !== void 0 && n.push(`rotate(${e.rotation}deg)`), i.style.transition = "none", i.style.transform = n.join(" ");
2563
2533
  }
@@ -2567,7 +2537,7 @@ class Ge {
2567
2537
  * @param duration - Animation duration in ms (default 150)
2568
2538
  */
2569
2539
  clearDragOffset(t, i = 150) {
2570
- if (!this.currentFocus || !this.focusData || this.state !== x.FOCUSED) return;
2540
+ if (!this.currentFocus || !this.focusData || this.state !== C.FOCUSED) return;
2571
2541
  const e = this.currentFocus, n = this.focusData.focusTransform, s = ["translate(-50%, -50%)"], r = n.x ?? 0, a = n.y ?? 0;
2572
2542
  s.push(`translate(${r}px, ${a}px)`), n.rotation !== void 0 && s.push(`rotate(${n.rotation}deg)`);
2573
2543
  const c = s.join(" ");
@@ -2597,10 +2567,10 @@ class Ge {
2597
2567
  this.focusData.originalZIndex,
2598
2568
  this.focusData.originalWidth,
2599
2569
  this.focusData.originalHeight
2600
- ), this.state = x.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
2570
+ ), this.state = C.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
2601
2571
  }
2602
2572
  }
2603
- const qe = 50, Xe = 0.5, Ye = 20, Ve = 0.3, Je = 150, Ke = 30, rt = class rt {
2573
+ const We = 50, Ge = 0.5, qe = 20, Ye = 0.3, Xe = 150, Ve = 30, rt = class rt {
2604
2574
  constructor(t, i) {
2605
2575
  this.enabled = !1, this.touchState = null, this.recentTouchTimestamp = 0, this.container = t, this.callbacks = i, this.boundTouchStart = this.handleTouchStart.bind(this), this.boundTouchMove = this.handleTouchMove.bind(this), this.boundTouchEnd = this.handleTouchEnd.bind(this), this.boundTouchCancel = this.handleTouchCancel.bind(this);
2606
2576
  }
@@ -2647,11 +2617,11 @@ const qe = 50, Xe = 0.5, Ye = 20, Ve = 0.3, Je = 150, Ke = 30, rt = class rt {
2647
2617
  const i = t.touches[0], e = i.clientX - this.touchState.startX, n = i.clientY - this.touchState.startY;
2648
2618
  if (this.touchState.isHorizontalSwipe === null && Math.sqrt(e * e + n * n) > 10) {
2649
2619
  const a = Math.atan2(Math.abs(n), Math.abs(e)) * (180 / Math.PI);
2650
- this.touchState.isHorizontalSwipe = a <= Ke;
2620
+ this.touchState.isHorizontalSwipe = a <= Ve;
2651
2621
  }
2652
2622
  if (this.touchState.isHorizontalSwipe !== !1 && this.touchState.isHorizontalSwipe === !0) {
2653
2623
  t.preventDefault(), this.touchState.isDragging = !0, this.touchState.currentX = i.clientX;
2654
- const s = e * Ve;
2624
+ const s = e * Ye;
2655
2625
  this.callbacks.onDragOffset(s);
2656
2626
  }
2657
2627
  }
@@ -2660,7 +2630,7 @@ const qe = 50, Xe = 0.5, Ye = 20, Ve = 0.3, Je = 150, Ke = 30, rt = class rt {
2660
2630
  this.recentTouchTimestamp = Date.now();
2661
2631
  const i = this.touchState.currentX - this.touchState.startX, e = performance.now() - this.touchState.startTime, n = Math.abs(i) / e, s = Math.abs(i);
2662
2632
  let r = !1;
2663
- this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (s >= qe || n >= Xe && s >= Ye) && (r = !0, i < 0 ? this.callbacks.onNext() : this.callbacks.onPrev()), this.touchState.isDragging && this.callbacks.onDragEnd(r), this.touchState = null;
2633
+ this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (s >= We || n >= Ge && s >= qe) && (r = !0, i < 0 ? this.callbacks.onNext() : this.callbacks.onPrev()), this.touchState.isDragging && this.callbacks.onDragEnd(r), this.touchState = null;
2664
2634
  }
2665
2635
  handleTouchCancel(t) {
2666
2636
  this.touchState?.isDragging && this.callbacks.onDragEnd(!1), this.touchState = null;
@@ -2668,7 +2638,7 @@ const qe = 50, Xe = 0.5, Ye = 20, Ve = 0.3, Je = 150, Ke = 30, rt = class rt {
2668
2638
  };
2669
2639
  rt.TOUCH_CLICK_DELAY = 300;
2670
2640
  let bt = rt;
2671
- class Ze {
2641
+ class Je {
2672
2642
  constructor(t) {
2673
2643
  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)
2674
2644
  throw new Error("GoogleDriveLoader requires at least one source to be configured");
@@ -2763,10 +2733,10 @@ class Ze {
2763
2733
  const e = [], n = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(n)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, a = await fetch(r);
2764
2734
  if (!a.ok)
2765
2735
  throw new Error(`API request failed: ${a.status} ${a.statusText}`);
2766
- const l = (await a.json()).files.filter(
2736
+ const d = (await a.json()).files.filter(
2767
2737
  (u) => u.mimeType.startsWith("image/") && i.isAllowed(u.name)
2768
2738
  );
2769
- return this.log(`Found ${l.length} images in folder ${t} (non-recursive)`), l.forEach((u) => {
2739
+ return this.log(`Found ${d.length} images in folder ${t} (non-recursive)`), d.forEach((u) => {
2770
2740
  e.push(`https://lh3.googleusercontent.com/d/${u.id}=s1600`), this.log(`Added file: ${u.name}`);
2771
2741
  }), e;
2772
2742
  }
@@ -2833,18 +2803,18 @@ class Ze {
2833
2803
  const e = [], n = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(n)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, a = await fetch(r);
2834
2804
  if (!a.ok)
2835
2805
  throw new Error(`API request failed: ${a.status} ${a.statusText}`);
2836
- const c = await a.json(), l = c.files.filter(
2837
- (h) => h.mimeType.startsWith("image/") && i.isAllowed(h.name)
2806
+ const c = await a.json(), d = c.files.filter(
2807
+ (f) => f.mimeType.startsWith("image/") && i.isAllowed(f.name)
2838
2808
  ), u = c.files.filter(
2839
- (h) => h.mimeType === "application/vnd.google-apps.folder"
2809
+ (f) => f.mimeType === "application/vnd.google-apps.folder"
2840
2810
  );
2841
- this.log(`Found ${c.files.length} total items in folder ${t}`), c.files.forEach((h) => this.log(` - File: ${h.name} (${h.mimeType})`)), this.log(`- ${l.length} valid files (images only)`), this.log(`- ${u.length} subfolders`), l.forEach((h) => {
2842
- e.push(`https://lh3.googleusercontent.com/d/${h.id}=s1600`), this.log(`Added file: ${h.name}`);
2811
+ this.log(`Found ${c.files.length} total items in folder ${t}`), c.files.forEach((f) => this.log(` - File: ${f.name} (${f.mimeType})`)), this.log(`- ${d.length} valid files (images only)`), this.log(`- ${u.length} subfolders`), d.forEach((f) => {
2812
+ e.push(`https://lh3.googleusercontent.com/d/${f.id}=s1600`), this.log(`Added file: ${f.name}`);
2843
2813
  });
2844
- for (const h of u) {
2845
- this.log(`Loading images from subfolder: ${h.name}`);
2846
- const d = await this.loadImagesRecursively(h.id, i);
2847
- e.push(...d);
2814
+ for (const f of u) {
2815
+ this.log(`Loading images from subfolder: ${f.name}`);
2816
+ const m = await this.loadImagesRecursively(f.id, i);
2817
+ e.push(...m);
2848
2818
  }
2849
2819
  return e;
2850
2820
  }
@@ -2889,7 +2859,7 @@ class Ze {
2889
2859
  this.debugLogging && typeof console < "u" && console.log(...t);
2890
2860
  }
2891
2861
  }
2892
- class Qe {
2862
+ class Ke {
2893
2863
  constructor(t) {
2894
2864
  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)
2895
2865
  throw new Error("StaticImageLoader requires at least one source to be configured");
@@ -3069,7 +3039,7 @@ class Qe {
3069
3039
  this.debugLogging && typeof console < "u" && console.log(...t);
3070
3040
  }
3071
3041
  }
3072
- class ti {
3042
+ class Ze {
3073
3043
  constructor(t) {
3074
3044
  if (this._prepared = !1, this._discoveredUrls = [], this.loaders = t.loaders, this.debugLogging = t.debugLogging ?? !1, !this.loaders || this.loaders.length === 0)
3075
3045
  throw new Error("CompositeLoader requires at least one loader to be configured");
@@ -3126,7 +3096,7 @@ class ti {
3126
3096
  this.debugLogging && typeof console < "u" && console.log("[CompositeLoader]", ...t);
3127
3097
  }
3128
3098
  }
3129
- class ei {
3099
+ class Qe {
3130
3100
  /**
3131
3101
  * Create a new ImageFilter
3132
3102
  * @param extensions - Array of allowed file extensions (without dots)
@@ -3163,7 +3133,7 @@ class ei {
3163
3133
  // isAllowedDate(date: Date): boolean
3164
3134
  // isAllowedDimensions(width: number, height: number): boolean
3165
3135
  }
3166
- const ii = `
3136
+ const ti = `
3167
3137
  .fbn-ic-gallery {
3168
3138
  position: relative;
3169
3139
  width: 100%;
@@ -3244,37 +3214,46 @@ const ii = `
3244
3214
  display: none !important;
3245
3215
  }
3246
3216
  `;
3247
- function ni() {
3217
+ function ei() {
3248
3218
  if (typeof document > "u") return;
3249
3219
  const o = "fbn-ic-functional-styles";
3250
3220
  if (document.getElementById(o)) return;
3251
3221
  const t = document.createElement("style");
3252
- t.id = o, t.textContent = ii, document.head.appendChild(t);
3222
+ t.id = o, t.textContent = ti, document.head.appendChild(t);
3253
3223
  }
3254
- let oi = class {
3224
+ let ii = class {
3255
3225
  constructor(t = {}) {
3256
- this.fullConfig = ne(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.prevButtonEl = null, this.nextButtonEl = null, this.prevButtonElAutoCreated = !1, this.nextButtonElAutoCreated = !1, this.animationEngine = new re(this.fullConfig.animation), this.layoutEngine = new _e({
3226
+ this.fullConfig = ee(t), t.container instanceof HTMLElement ? (this.containerRef = t.container, this.containerId = null) : (this.containerRef = null, this.containerId = t.container || "imageCloud"), this.callbacks = t.on ?? {}, 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.prevButtonEl = null, this.nextButtonEl = null, this.prevButtonElAutoCreated = !1, this.nextButtonElAutoCreated = !1, this.animationEngine = new se(this.fullConfig.animation), this.layoutEngine = new $e({
3257
3227
  layout: this.fullConfig.layout,
3258
3228
  image: this.fullConfig.image
3259
- }), this.zoomEngine = new Ge(this.fullConfig.interaction.focus, this.animationEngine, this.fullConfig.styling), this.defaultStyles = it(this.fullConfig.styling?.default), this.defaultClassName = this.fullConfig.styling?.default?.className, this.hoverClassName = this.fullConfig.styling?.hover?.className;
3260
- const i = this.fullConfig.animation.entry || C.animation.entry;
3261
- this.entryAnimationEngine = new ye(
3229
+ }), this.zoomEngine = new je(this.fullConfig.interaction.focus, this.animationEngine, this.fullConfig.styling), this.defaultStyles = it(this.fullConfig.styling?.default), this.defaultClassName = this.fullConfig.styling?.default?.className, this.hoverClassName = this.fullConfig.styling?.hover?.className;
3230
+ const i = this.fullConfig.animation.entry || L.animation.entry;
3231
+ this.entryAnimationEngine = new pe(
3262
3232
  i,
3263
3233
  this.fullConfig.layout.algorithm
3264
3234
  );
3265
3235
  const e = this.fullConfig.animation.idle;
3266
- e && e.type !== "none" ? this.idleAnimationEngine = new ve(
3236
+ e && e.type !== "none" ? this.idleAnimationEngine = new be(
3267
3237
  e,
3268
3238
  i.timing?.duration ?? 600
3269
3239
  ) : this.idleAnimationEngine = null, this.zoomEngine.setOnUnfocusCompleteCallback((n) => {
3270
3240
  this.idleAnimationEngine?.resumeForImage(n);
3271
- const s = n;
3241
+ const s = n, r = this.imageElements.indexOf(s);
3242
+ if (this.callbacks.onImageUnfocus && r !== -1) {
3243
+ const a = this.imageLoader.imageURLs(), c = {
3244
+ element: s,
3245
+ index: r,
3246
+ url: a[r] ?? "",
3247
+ layout: this.imageLayouts[r]
3248
+ };
3249
+ this.callbacks.onImageUnfocus(c);
3250
+ }
3272
3251
  requestAnimationFrame(() => {
3273
3252
  if (s.matches(":hover") && this.fullConfig.styling?.hover) {
3274
- const r = this.imageElements.indexOf(s);
3275
- if (r !== -1) {
3276
- const a = s.offsetHeight, c = s.cachedRenderedWidth;
3277
- st(s, this.fullConfig.styling.hover, a, c), et(s, this.hoverClassName), this.hoveredImage = { element: s, layout: this.imageLayouts[r] };
3253
+ const a = this.imageElements.indexOf(s);
3254
+ if (a !== -1) {
3255
+ const c = s.offsetHeight, d = s.cachedRenderedWidth;
3256
+ st(s, this.fullConfig.styling.hover, c, d), et(s, this.hoverClassName), this.hoveredImage = { element: s, layout: this.imageLayouts[a] };
3278
3257
  }
3279
3258
  }
3280
3259
  });
@@ -3285,7 +3264,7 @@ let oi = class {
3285
3264
  */
3286
3265
  createImageFilter() {
3287
3266
  const t = this.fullConfig.config.loaders?.allowedExtensions;
3288
- return new ei(t);
3267
+ return new Qe(t);
3289
3268
  }
3290
3269
  /**
3291
3270
  * Create appropriate image loader based on config
@@ -3296,7 +3275,7 @@ let oi = class {
3296
3275
  if (!t || t.length === 0)
3297
3276
  throw new Error("No loaders configured. Provide `images`, `loaders`, or both.\n Example: imageCloud({ container: 'id', images: ['https://...'] })");
3298
3277
  const e = t.map((n) => this.createLoaderFromEntry(n, i));
3299
- return e.length === 1 ? e[0] : new ti({
3278
+ return e.length === 1 ? e[0] : new Ze({
3300
3279
  loaders: e,
3301
3280
  debugLogging: this.fullConfig.config.debug?.loaders
3302
3281
  });
@@ -3314,14 +3293,14 @@ let oi = class {
3314
3293
  allowedExtensions: e.allowedExtensions ?? i.allowedExtensions,
3315
3294
  debugLogging: e.debugLogging ?? this.fullConfig.config.debug?.loaders
3316
3295
  };
3317
- return new Qe(n);
3296
+ return new Ke(n);
3318
3297
  } else if ("googleDrive" in t) {
3319
3298
  const e = t.googleDrive, n = {
3320
3299
  ...e,
3321
3300
  allowedExtensions: e.allowedExtensions ?? i.allowedExtensions,
3322
3301
  debugLogging: e.debugLogging ?? this.fullConfig.config.debug?.loaders
3323
3302
  };
3324
- return new Ze(n);
3303
+ return new Je(n);
3325
3304
  } else
3326
3305
  throw new Error(`Unknown loader entry: ${JSON.stringify(t)}`);
3327
3306
  }
@@ -3330,7 +3309,7 @@ let oi = class {
3330
3309
  */
3331
3310
  async init() {
3332
3311
  try {
3333
- if (ni(), this.containerRef)
3312
+ if (ei(), this.containerRef)
3334
3313
  this.containerEl = this.containerRef;
3335
3314
  else if (this.containerEl = document.getElementById(this.containerId), !this.containerEl)
3336
3315
  throw new Error(`Container "#${this.containerId}" not found. Ensure an element with id="${this.containerId}" exists in the DOM before calling imageCloud().`);
@@ -3339,7 +3318,7 @@ let oi = class {
3339
3318
  onPrev: () => this.navigateToPreviousImage(),
3340
3319
  onDragOffset: (t) => this.zoomEngine.setDragOffset(t),
3341
3320
  onDragEnd: (t) => {
3342
- t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0, Je);
3321
+ t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0, Xe);
3343
3322
  }
3344
3323
  })), this.setupUI(), this.setupEventListeners(), this.logDebug("ImageCloud initialized"), await this.loadImages();
3345
3324
  } catch (t) {
@@ -3470,61 +3449,134 @@ let oi = class {
3470
3449
  const e = this.getContainerBounds();
3471
3450
  this.currentImageHeight = i;
3472
3451
  const n = this.loadGeneration, s = this.layoutEngine.generateLayout(t.length, e, { fixedHeight: i });
3473
- this.imageLayouts = s, this.displayQueue = [];
3474
- let r = 0;
3475
- const a = (l) => {
3476
- this.containerEl && (this.containerEl.appendChild(l), this.imageElements.push(l), requestAnimationFrame(() => {
3477
- if (l.offsetWidth, l.style.opacity = this.defaultStyles.opacity ?? "1", l.dataset.startX && (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || l.dataset.startRotation !== l.dataset.rotation || l.dataset.startScale !== l.dataset.scale)) {
3478
- const d = {
3479
- x: parseFloat(l.dataset.startX),
3480
- y: parseFloat(l.dataset.startY)
3481
- }, g = {
3482
- x: parseFloat(l.dataset.endX),
3483
- y: parseFloat(l.dataset.endY)
3484
- }, b = parseFloat(l.dataset.imageWidth), p = parseFloat(l.dataset.imageHeight), f = parseFloat(l.dataset.rotation), m = parseFloat(l.dataset.scale), y = l.dataset.startRotation ? parseFloat(l.dataset.startRotation) : f, E = l.dataset.startScale ? parseFloat(l.dataset.startScale) : m, v = this.entryAnimationEngine.getTiming();
3485
- me({
3452
+ if (this.imageLayouts = s, this.callbacks.onLayoutComplete) {
3453
+ const l = {
3454
+ layouts: [...s],
3455
+ // shallow copy caller should not mutate
3456
+ containerBounds: { ...e },
3457
+ algorithm: this.fullConfig.layout.algorithm,
3458
+ imageCount: t.length
3459
+ };
3460
+ this.callbacks.onLayoutComplete(l);
3461
+ }
3462
+ this.displayQueue = [];
3463
+ let r = 0, a = 0, c = 0, d = 0, u = !1;
3464
+ const f = /* @__PURE__ */ new Map(), m = () => {
3465
+ if (u || n !== this.loadGeneration || !this.callbacks.onGalleryReady) return;
3466
+ u = !0;
3467
+ const l = {
3468
+ totalImages: t.length,
3469
+ failedImages: c,
3470
+ loadDuration: d > 0 ? performance.now() - d : 0
3471
+ };
3472
+ this.callbacks.onGalleryReady(l);
3473
+ }, p = () => {
3474
+ r >= t.length && this.displayQueue.length === 0 && m();
3475
+ }, w = (l) => {
3476
+ this.containerEl && (this.containerEl.appendChild(l), this.imageElements.push(l), requestAnimationFrame(async () => {
3477
+ l.offsetWidth, l.style.opacity = this.defaultStyles.opacity ?? "1";
3478
+ const g = parseInt(l.dataset.imageId || "0"), h = this.imageLayouts[g], b = this.entryAnimationEngine.getTiming(), I = performance.now(), y = parseFloat(l.dataset.startX || "0"), x = parseFloat(l.dataset.startY || "0"), E = parseFloat(l.dataset.endX || "0"), F = parseFloat(l.dataset.endY || "0"), R = parseFloat(l.dataset.rotation || "0"), M = parseFloat(l.dataset.scale || "1"), T = parseFloat(l.dataset.startRotation || l.dataset.rotation || "0"), z = parseFloat(l.dataset.startScale || l.dataset.scale || "1"), k = parseFloat(l.dataset.imageWidth || "0"), D = parseFloat(l.dataset.imageHeight || "0");
3479
+ if (this.callbacks.onEntryStart && h) {
3480
+ const S = {
3486
3481
  element: l,
3487
- startPosition: d,
3488
- endPosition: g,
3482
+ index: g,
3483
+ totalImages: this.imageLayouts.length,
3484
+ layout: h,
3485
+ from: { x: y, y: x, rotation: T, scale: z },
3486
+ to: { x: E, y: F, rotation: R, scale: M },
3487
+ startTime: I,
3488
+ duration: b.duration
3489
+ };
3490
+ this.callbacks.onEntryStart(S);
3491
+ }
3492
+ if (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || l.dataset.startRotation !== l.dataset.rotation || l.dataset.startScale !== l.dataset.scale)
3493
+ fe({
3494
+ element: l,
3495
+ startPosition: { x: y, y: x },
3496
+ endPosition: { x: E, y: F },
3489
3497
  pathConfig: this.entryAnimationEngine.getPathConfig(),
3490
- duration: v.duration,
3491
- imageWidth: b,
3492
- imageHeight: p,
3493
- rotation: f,
3494
- scale: m,
3498
+ duration: b.duration,
3499
+ imageWidth: k,
3500
+ imageHeight: D,
3501
+ rotation: R,
3502
+ scale: M,
3495
3503
  rotationConfig: this.entryAnimationEngine.getRotationConfig(),
3496
- startRotation: y,
3504
+ startRotation: T,
3497
3505
  scaleConfig: this.entryAnimationEngine.getScaleConfig(),
3498
- startScale: E
3506
+ startScale: z,
3507
+ onProgress: this.callbacks.onEntryProgress && h ? (S, _, $) => {
3508
+ const A = {
3509
+ element: l,
3510
+ index: g,
3511
+ totalImages: this.imageLayouts.length,
3512
+ layout: h,
3513
+ from: { x: y, y: x, rotation: T, scale: z },
3514
+ to: { x: E, y: F, rotation: R, scale: M },
3515
+ startTime: I,
3516
+ duration: b.duration,
3517
+ progress: S,
3518
+ rawProgress: S,
3519
+ elapsed: _,
3520
+ current: $
3521
+ };
3522
+ this.callbacks.onEntryProgress(A);
3523
+ } : void 0,
3524
+ onComplete: h ? () => {
3525
+ if (this.callbacks.onEntryComplete) {
3526
+ const S = {
3527
+ element: l,
3528
+ index: g,
3529
+ layout: h,
3530
+ startTime: I,
3531
+ endTime: performance.now(),
3532
+ duration: b.duration
3533
+ };
3534
+ this.callbacks.onEntryComplete(S);
3535
+ }
3536
+ } : void 0
3499
3537
  });
3500
- } else {
3501
- const d = l.dataset.finalTransform || "";
3502
- l.style.transform = d;
3538
+ else {
3539
+ const S = l.dataset.finalTransform || "";
3540
+ if (l.style.transform = S, this.callbacks.onEntryComplete && h) {
3541
+ const _ = ($) => {
3542
+ if ($.propertyName !== "transform") return;
3543
+ l.removeEventListener("transitionend", _);
3544
+ const A = {
3545
+ element: l,
3546
+ index: g,
3547
+ layout: h,
3548
+ startTime: I,
3549
+ endTime: performance.now(),
3550
+ duration: b.duration
3551
+ };
3552
+ this.callbacks.onEntryComplete(A);
3553
+ };
3554
+ l.addEventListener("transitionend", _);
3555
+ }
3503
3556
  }
3504
- const h = parseInt(l.dataset.imageId || "0");
3505
- if (this.fullConfig.config.debug?.enabled && h < 3) {
3506
- const d = l.dataset.finalTransform || "";
3507
- console.log(`Image ${h} final state:`, {
3557
+ if (this.fullConfig.config.debug?.enabled && g < 3) {
3558
+ const S = l.dataset.finalTransform || "";
3559
+ console.log(`Image ${g} final state:`, {
3508
3560
  left: l.style.left,
3509
3561
  top: l.style.top,
3510
3562
  width: l.style.width,
3511
3563
  height: l.style.height,
3512
3564
  computedWidth: l.offsetWidth,
3513
3565
  computedHeight: l.offsetHeight,
3514
- transform: d,
3566
+ transform: S,
3515
3567
  pathType: this.entryAnimationEngine.getPathType()
3516
3568
  });
3517
3569
  }
3518
3570
  if (this.idleAnimationEngine) {
3519
- const d = this.entryAnimationEngine.getTiming().duration;
3520
- this.idleAnimationEngine.register(l, h, this.imageElements.length, d);
3571
+ const S = this.entryAnimationEngine.getTiming().duration;
3572
+ this.idleAnimationEngine.register(l, g, this.imageElements.length, S);
3521
3573
  }
3522
- }), r++);
3523
- }, c = () => {
3574
+ }), r++, p());
3575
+ }, v = () => {
3524
3576
  if (this.logDebug("Starting queue processing, enabled:", this.fullConfig.animation.queue.enabled), !this.fullConfig.animation.queue.enabled) {
3525
3577
  for (; this.displayQueue.length > 0; ) {
3526
3578
  const l = this.displayQueue.shift();
3527
- l && a(l);
3579
+ l && w(l);
3528
3580
  }
3529
3581
  return;
3530
3582
  }
@@ -3535,77 +3587,144 @@ let oi = class {
3535
3587
  }
3536
3588
  if (this.displayQueue.length > 0) {
3537
3589
  const l = this.displayQueue.shift();
3538
- l && a(l);
3590
+ l && w(l);
3539
3591
  }
3540
- r >= t.length && this.displayQueue.length === 0 && this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null);
3592
+ r >= t.length && this.displayQueue.length === 0 && (this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null), m());
3541
3593
  }, this.fullConfig.animation.queue.interval);
3542
3594
  };
3543
3595
  if ("IntersectionObserver" in window && this.containerEl) {
3544
- const l = new IntersectionObserver((u) => {
3545
- u.forEach((h) => {
3546
- h.isIntersecting && (c(), l.disconnect());
3596
+ const l = new IntersectionObserver((g) => {
3597
+ g.forEach((h) => {
3598
+ h.isIntersecting && (v(), l.disconnect());
3547
3599
  });
3548
3600
  }, { threshold: 0.1, rootMargin: "50px" });
3549
3601
  l.observe(this.containerEl);
3550
3602
  } else
3551
- c();
3552
- this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((l) => l.remove()), s.forEach((l, u) => {
3603
+ v();
3604
+ this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((l) => l.remove()), s.forEach((l, g) => {
3553
3605
  const h = document.createElement("div");
3554
3606
  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";
3555
- const d = l.x, g = l.y;
3556
- h.style.left = `${d - 6}px`, h.style.top = `${g - 6}px`, h.title = `Image ${u}: center (${Math.round(d)}, ${Math.round(g)})`, this.containerEl.appendChild(h);
3557
- })), t.forEach((l, u) => {
3607
+ const b = l.x, I = l.y;
3608
+ h.style.left = `${b - 6}px`, h.style.top = `${I - 6}px`, h.title = `Image ${g}: center (${Math.round(b)}, ${Math.round(I)})`, this.containerEl.appendChild(h);
3609
+ })), t.forEach((l, g) => {
3558
3610
  const h = document.createElement("img");
3559
- h.referrerPolicy = "no-referrer", h.classList.add("fbn-ic-image"), this.fullConfig.interaction.dragging === !1 && (h.draggable = !1), h.dataset.imageId = String(u), h.dataset.createdFlag = "true";
3560
- const d = s[u];
3561
- h.style.position = "absolute", h.style.width = "auto", h.style.height = `${i}px`, h.style.left = `${d.x}px`, h.style.top = `${d.y}px`, d.zIndex && (h.style.zIndex = String(d.zIndex)), et(h, this.defaultClassName), h.addEventListener("mouseenter", () => {
3562
- if (this.hoveredImage = { element: h, layout: d }, !this.zoomEngine.isInvolved(h)) {
3563
- const g = h.cachedRenderedWidth;
3564
- st(h, this.fullConfig.styling?.hover, i, g), et(h, this.hoverClassName);
3611
+ h.referrerPolicy = "no-referrer", h.classList.add("fbn-ic-image"), this.fullConfig.interaction.dragging === !1 && (h.draggable = !1), h.dataset.imageId = String(g), h.dataset.createdFlag = "true";
3612
+ const b = s[g];
3613
+ h.style.position = "absolute", h.style.width = "auto", h.style.height = `${i}px`, h.style.left = `${b.x}px`, h.style.top = `${b.y}px`, b.zIndex && (h.style.zIndex = String(b.zIndex)), et(h, this.defaultClassName), h.addEventListener("mouseenter", () => {
3614
+ if (this.hoveredImage = { element: h, layout: b }, !this.zoomEngine.isInvolved(h)) {
3615
+ const y = h.cachedRenderedWidth;
3616
+ st(h, this.fullConfig.styling?.hover, i, y), et(h, this.hoverClassName);
3617
+ }
3618
+ if (this.callbacks.onImageHover) {
3619
+ const y = { element: h, index: g, url: l, layout: b };
3620
+ this.callbacks.onImageHover(y);
3565
3621
  }
3566
3622
  }), h.addEventListener("mouseleave", () => {
3567
3623
  if (this.hoveredImage = null, !this.zoomEngine.isInvolved(h)) {
3568
- const g = h.cachedRenderedWidth;
3569
- st(h, this.fullConfig.styling?.default, i, g), pt(h, this.hoverClassName), et(h, this.defaultClassName);
3624
+ const y = h.cachedRenderedWidth;
3625
+ st(h, this.fullConfig.styling?.default, i, y), pt(h, this.hoverClassName), et(h, this.defaultClassName);
3626
+ }
3627
+ if (this.callbacks.onImageUnhover) {
3628
+ const y = { element: h, index: g, url: l, layout: b };
3629
+ this.callbacks.onImageUnhover(y);
3570
3630
  }
3571
- }), h.addEventListener("click", (g) => {
3572
- g.stopPropagation(), this.handleImageClick(h, d);
3631
+ }), h.addEventListener("click", (y) => {
3632
+ y.stopPropagation(), this.handleImageClick(h, b);
3573
3633
  }), h.style.opacity = "0", h.style.transition = this.entryAnimationEngine.getTransitionCSS(), h.onload = () => {
3574
3634
  if (n !== this.loadGeneration)
3575
3635
  return;
3576
- const g = h.naturalWidth / h.naturalHeight, b = i * g;
3577
- h.dataset.onloadCalled = "true", window.DEBUG_CLIPPATH && console.log(`[onload #${u}] Called with imageHeight=${i}, renderedWidth=${b}`), h.style.width = `${b}px`, h.cachedRenderedWidth = b, h.aspectRatio = g, st(h, this.fullConfig.styling?.default, i, b);
3578
- const p = { x: d.x, y: d.y }, f = { width: b, height: i }, m = this.entryAnimationEngine.calculateStartPosition(
3579
- p,
3580
- f,
3636
+ const y = h.naturalWidth / h.naturalHeight, x = i * y;
3637
+ h.dataset.onloadCalled = "true", window.DEBUG_CLIPPATH && console.log(`[onload #${g}] Called with imageHeight=${i}, renderedWidth=${x}`), h.style.width = `${x}px`, h.cachedRenderedWidth = x, h.aspectRatio = y, st(h, this.fullConfig.styling?.default, i, x);
3638
+ const E = { x: b.x, y: b.y }, F = { width: x, height: i }, R = this.entryAnimationEngine.calculateStartPosition(
3639
+ E,
3640
+ F,
3581
3641
  e,
3582
- u,
3642
+ g,
3583
3643
  t.length
3584
- ), y = this.entryAnimationEngine.calculateStartRotation(d.rotation), E = this.entryAnimationEngine.calculateStartScale(d.scale), v = this.entryAnimationEngine.buildFinalTransform(
3585
- d.rotation,
3586
- d.scale,
3587
- b,
3644
+ ), M = this.entryAnimationEngine.calculateStartRotation(b.rotation), T = this.entryAnimationEngine.calculateStartScale(b.scale), z = this.entryAnimationEngine.buildFinalTransform(
3645
+ b.rotation,
3646
+ b.scale,
3647
+ x,
3588
3648
  i
3589
- ), S = this.entryAnimationEngine.buildStartTransform(
3590
- m,
3591
- p,
3592
- d.rotation,
3593
- d.scale,
3594
- b,
3649
+ ), k = this.entryAnimationEngine.buildStartTransform(
3650
+ R,
3651
+ E,
3652
+ b.rotation,
3653
+ b.scale,
3654
+ x,
3595
3655
  i,
3596
- y,
3597
- E
3656
+ M,
3657
+ T
3598
3658
  );
3599
- this.fullConfig.config.debug?.enabled && u < 3 && console.log(`Image ${u}:`, {
3600
- finalPosition: p,
3601
- imageSize: f,
3602
- left: d.x,
3603
- top: d.y,
3604
- finalTransform: v,
3605
- renderedWidth: b,
3659
+ if (this.fullConfig.config.debug?.enabled && g < 3 && console.log(`Image ${g}:`, {
3660
+ finalPosition: E,
3661
+ imageSize: F,
3662
+ left: b.x,
3663
+ top: b.y,
3664
+ finalTransform: z,
3665
+ renderedWidth: x,
3606
3666
  renderedHeight: i
3607
- }), h.style.transform = S, h.dataset.finalTransform = v, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || y !== d.rotation || E !== 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(i), h.dataset.rotation = String(d.rotation), h.dataset.scale = String(d.scale), h.dataset.startRotation = String(y), h.dataset.startScale = String(E)), this.displayQueue.push(h);
3608
- }, h.onerror = () => r++, h.src = l;
3667
+ }), h.style.transform = k, h.dataset.finalTransform = z, h.dataset.startX = String(R.x), h.dataset.startY = String(R.y), h.dataset.endX = String(E.x), h.dataset.endY = String(E.y), h.dataset.imageWidth = String(x), h.dataset.imageHeight = String(i), h.dataset.rotation = String(b.rotation), h.dataset.scale = String(b.scale), h.dataset.startRotation = String(M), h.dataset.startScale = String(T), a++, this.callbacks.onImageLoaded) {
3668
+ const D = {
3669
+ element: h,
3670
+ url: l,
3671
+ index: g,
3672
+ totalImages: t.length,
3673
+ loadTime: performance.now() - (f.get(g) ?? performance.now())
3674
+ };
3675
+ this.callbacks.onImageLoaded(D);
3676
+ }
3677
+ if (this.callbacks.onLoadProgress) {
3678
+ const D = {
3679
+ loaded: a,
3680
+ failed: c,
3681
+ total: t.length,
3682
+ percent: (a + c) / t.length * 100
3683
+ };
3684
+ this.callbacks.onLoadProgress(D);
3685
+ }
3686
+ this.displayQueue.push(h);
3687
+ };
3688
+ const I = () => {
3689
+ if (n === this.loadGeneration) {
3690
+ if (c++, this.callbacks.onImageError) {
3691
+ const y = { url: l, index: g, totalImages: t.length };
3692
+ this.callbacks.onImageError(y);
3693
+ }
3694
+ if (this.callbacks.onLoadProgress) {
3695
+ const y = {
3696
+ loaded: a,
3697
+ failed: c,
3698
+ total: t.length,
3699
+ percent: (a + c) / t.length * 100
3700
+ };
3701
+ this.callbacks.onLoadProgress(y);
3702
+ }
3703
+ r++, p();
3704
+ }
3705
+ };
3706
+ h.onerror = () => I(), (async () => {
3707
+ let y = l;
3708
+ if (this.callbacks.onBeforeImageLoad) {
3709
+ const x = { url: l, index: g, totalImages: t.length }, E = await this.callbacks.onBeforeImageLoad(x);
3710
+ if (E)
3711
+ if (E.fetch !== void 0) {
3712
+ const F = E.url ?? l;
3713
+ try {
3714
+ const M = await (await fetch(F, E.fetch)).blob(), T = URL.createObjectURL(M);
3715
+ y = T;
3716
+ const z = h.onload;
3717
+ h.onload = (k) => {
3718
+ URL.revokeObjectURL(T), z?.call(h, k);
3719
+ };
3720
+ } catch {
3721
+ I();
3722
+ return;
3723
+ }
3724
+ } else E.url && (y = E.url);
3725
+ }
3726
+ d === 0 && (d = performance.now()), f.set(g, performance.now()), h.src = y;
3727
+ })();
3609
3728
  });
3610
3729
  }
3611
3730
  async handleImageClick(t, i) {
@@ -3619,7 +3738,15 @@ let oi = class {
3619
3738
  else {
3620
3739
  this.idleAnimationEngine?.pauseForImage(t);
3621
3740
  const s = t.dataset.imageId;
3622
- this.currentFocusIndex = s !== void 0 ? parseInt(s, 10) : null, this.swipeEngine?.enable(), this.containerEl?.focus({ preventScroll: !0 }), await this.zoomEngine.focusImage(t, n, i), this.currentFocusIndex !== null && this.updateCounter(this.currentFocusIndex), this.showNavButtons(), this.showFocusIndicator();
3741
+ if (this.currentFocusIndex = s !== void 0 ? parseInt(s, 10) : null, this.swipeEngine?.enable(), this.containerEl?.focus({ preventScroll: !0 }), await this.zoomEngine.focusImage(t, n, i), this.currentFocusIndex !== null && this.updateCounter(this.currentFocusIndex), this.showNavButtons(), this.showFocusIndicator(), this.callbacks.onImageFocus && this.currentFocusIndex !== null) {
3742
+ const r = this.imageLoader.imageURLs(), a = {
3743
+ element: t,
3744
+ index: this.currentFocusIndex,
3745
+ url: r[this.currentFocusIndex] ?? "",
3746
+ layout: i
3747
+ };
3748
+ this.callbacks.onImageFocus(a);
3749
+ }
3623
3750
  }
3624
3751
  }
3625
3752
  /**
@@ -3662,16 +3789,16 @@ let oi = class {
3662
3789
  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.prevButtonElAutoCreated && this.prevButtonEl && (this.prevButtonEl.remove(), this.prevButtonEl = null), this.nextButtonElAutoCreated && this.nextButtonEl && (this.nextButtonEl.remove(), this.nextButtonEl = null), this.resizeTimeout !== null && clearTimeout(this.resizeTimeout), this.swipeEngine?.destroy(), this.idleAnimationEngine?.stopAll(), this.idleAnimationEngine = null;
3663
3790
  }
3664
3791
  };
3665
- const ci = Nt(
3792
+ const ai = Ht(
3666
3793
  function({ className: t, style: i, ...e }, n) {
3667
- const s = It(null), r = It(null);
3668
- return kt(n, () => ({
3794
+ const s = St(null), r = St(null);
3795
+ return Nt(n, () => ({
3669
3796
  get instance() {
3670
3797
  return r.current;
3671
3798
  }
3672
3799
  })), Bt(() => {
3673
3800
  if (!s.current) return;
3674
- const a = new oi({
3801
+ const a = new ii({
3675
3802
  container: s.current,
3676
3803
  ...e
3677
3804
  });
@@ -3680,10 +3807,10 @@ const ci = Nt(
3680
3807
  }), () => {
3681
3808
  a.destroy(), r.current = null;
3682
3809
  };
3683
- }, [JSON.stringify(e)]), /* @__PURE__ */ Ht("div", { ref: s, className: t, style: i });
3810
+ }, [JSON.stringify(e)]), /* @__PURE__ */ kt("div", { ref: s, className: t, style: i });
3684
3811
  }
3685
3812
  );
3686
3813
  export {
3687
- ci as ImageCloud
3814
+ ai as ImageCloud
3688
3815
  };
3689
3816
  //# sourceMappingURL=react.js.map