@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/vue.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent as Ht, ref as It, onMounted as Nt, onUnmounted as kt, watch as Bt, h as jt } from "vue";
1
+ import { defineComponent as kt, ref as St, onMounted as Ht, onUnmounted as Nt, watch as Bt, h as jt } from "vue";
2
2
  const mt = Object.freeze({
3
3
  none: "none",
4
4
  sm: "0 2px 4px rgba(0,0,0,0.1)",
@@ -9,12 +9,12 @@ const mt = Object.freeze({
9
9
  energetic: Object.freeze({ overshoot: 0.25, bounces: 2, decayRatio: 0.5 }),
10
10
  playful: Object.freeze({ overshoot: 0.15, bounces: 1, decayRatio: 0.5 }),
11
11
  subtle: Object.freeze({ overshoot: 0.08, bounces: 1, decayRatio: 0.5 })
12
- }), At = Object.freeze({
12
+ }), Rt = Object.freeze({
13
13
  gentle: Object.freeze({ stiffness: 150, damping: 30, mass: 1, oscillations: 2 }),
14
14
  bouncy: Object.freeze({ stiffness: 300, damping: 15, mass: 1, oscillations: 4 }),
15
15
  wobbly: Object.freeze({ stiffness: 180, damping: 12, mass: 1.5, oscillations: 5 }),
16
16
  snappy: Object.freeze({ stiffness: 400, damping: 25, mass: 0.8, oscillations: 2 })
17
- }), Rt = Object.freeze({
17
+ }), Tt = Object.freeze({
18
18
  gentle: Object.freeze({ amplitude: 30, frequency: 1.5, decay: !0, decayRate: 0.9, phase: 0 }),
19
19
  playful: Object.freeze({ amplitude: 50, frequency: 2.5, decay: !0, decayRate: 0.7, phase: 0 }),
20
20
  serpentine: Object.freeze({ amplitude: 60, frequency: 3, decay: !1, decayRate: 1, phase: 0 }),
@@ -23,9 +23,9 @@ const mt = Object.freeze({
23
23
  type: "linear"
24
24
  }), vt = Object.freeze({
25
25
  mode: "none"
26
- }), Et = Object.freeze({
26
+ }), xt = Object.freeze({
27
27
  mode: "none"
28
- }), Ft = Object.freeze({
28
+ }), Mt = Object.freeze({
29
29
  default: Object.freeze({
30
30
  border: Object.freeze({
31
31
  width: 0,
@@ -62,10 +62,10 @@ const mt = Object.freeze({
62
62
  // Note: Image rotation along wave is now controlled via image.rotation.mode = 'tangent'
63
63
  }), qt = Object.freeze({
64
64
  spacing: 0
65
- }), Xt = Object.freeze({
65
+ }), Yt = Object.freeze({
66
66
  mobile: Object.freeze({ maxWidth: 767 }),
67
67
  tablet: Object.freeze({ maxWidth: 1199 })
68
- }), Yt = Object.freeze({
68
+ }), Xt = Object.freeze({
69
69
  mode: "adaptive",
70
70
  // Default to adaptive sizing
71
71
  minSize: 50,
@@ -83,10 +83,10 @@ const mt = Object.freeze({
83
83
  min: -15,
84
84
  max: 15
85
85
  })
86
- }), zt = Object.freeze({
87
- sizing: Yt,
88
- rotation: Vt
89
86
  }), Ot = Object.freeze({
87
+ sizing: Xt,
88
+ rotation: Vt
89
+ }), zt = Object.freeze({
90
90
  validateUrls: !0,
91
91
  validationTimeout: 5e3,
92
92
  validationMethod: "head",
@@ -95,22 +95,22 @@ const mt = Object.freeze({
95
95
  enabled: !1,
96
96
  centers: !1,
97
97
  loaders: !1
98
- }), Jt = Object.freeze({ maxAngle: 5, speed: 2e3, sync: "random" }), Kt = Object.freeze({ minScale: 0.95, maxScale: 1.05, speed: 2400, sync: "random" }), Zt = Object.freeze({ onRatio: 0.7, speed: 3e3, style: "snap" }), Qt = Object.freeze({ speed: 4e3, direction: "clockwise" }), $t = Object.freeze({ type: "none" }), C = Object.freeze({
98
+ }), Jt = Object.freeze({ maxAngle: 5, speed: 2e3, sync: "random" }), Kt = Object.freeze({ minScale: 0.95, maxScale: 1.05, speed: 2400, sync: "random" }), Zt = Object.freeze({ onRatio: 0.7, speed: 3e3, style: "snap" }), Qt = Object.freeze({ speed: 4e3, direction: "clockwise" }), $t = Object.freeze({ type: "none" }), L = Object.freeze({
99
99
  // Loader configuration (always an array, composite behavior is implicit)
100
100
  loaders: [],
101
101
  // Shared loader settings and debug config
102
102
  config: Object.freeze({
103
- loaders: Ot,
103
+ loaders: zt,
104
104
  debug: Dt
105
105
  }),
106
106
  // Image sizing and rotation configuration
107
- image: zt,
107
+ image: Ot,
108
108
  // Pattern-based layout configuration
109
109
  layout: Object.freeze({
110
110
  algorithm: "radial",
111
111
  scaleDecay: 0,
112
112
  // No decay by default (0-1 for radial/spiral)
113
- responsive: Xt,
113
+ responsive: Yt,
114
114
  targetCoverage: 0.6,
115
115
  // Target 60% of container area
116
116
  densityFactor: 1,
@@ -158,7 +158,7 @@ const mt = Object.freeze({
158
158
  // smooth deceleration
159
159
  path: yt,
160
160
  rotation: vt,
161
- scale: Et
161
+ scale: xt
162
162
  }),
163
163
  idle: $t
164
164
  }),
@@ -173,9 +173,7 @@ const mt = Object.freeze({
173
173
  }),
174
174
  navigation: Object.freeze({
175
175
  keyboard: !0,
176
- swipe: !0,
177
- mouseWheel: void 0
178
- // STUB: Not implemented yet
176
+ swipe: !0
179
177
  }),
180
178
  dragging: !0
181
179
  }),
@@ -187,174 +185,140 @@ const mt = Object.freeze({
187
185
  showFocusOutline: !1
188
186
  }),
189
187
  // Image styling
190
- styling: Ft
188
+ styling: Mt
191
189
  });
192
- function Z(o, t) {
193
- if (!o) return t || {};
194
- if (!t) return { ...o };
195
- const i = { ...o };
196
- return t.border !== void 0 && (i.border = { ...o.border, ...t.border }), t.borderTop !== void 0 && (i.borderTop = { ...o.borderTop, ...t.borderTop }), t.borderRight !== void 0 && (i.borderRight = { ...o.borderRight, ...t.borderRight }), t.borderBottom !== void 0 && (i.borderBottom = { ...o.borderBottom, ...t.borderBottom }), t.borderLeft !== void 0 && (i.borderLeft = { ...o.borderLeft, ...t.borderLeft }), t.filter !== void 0 && (i.filter = { ...o.filter, ...t.filter }), t.outline !== void 0 && (i.outline = { ...o.outline, ...t.outline }), t.shadow !== void 0 && (i.shadow = t.shadow), t.clipPath !== void 0 && (i.clipPath = t.clipPath), t.opacity !== void 0 && (i.opacity = t.opacity), t.cursor !== void 0 && (i.cursor = t.cursor), t.className !== void 0 && (i.className = t.className), t.objectFit !== void 0 && (i.objectFit = t.objectFit), t.aspectRatio !== void 0 && (i.aspectRatio = t.aspectRatio), t.borderRadiusTopLeft !== void 0 && (i.borderRadiusTopLeft = t.borderRadiusTopLeft), t.borderRadiusTopRight !== void 0 && (i.borderRadiusTopRight = t.borderRadiusTopRight), t.borderRadiusBottomRight !== void 0 && (i.borderRadiusBottomRight = t.borderRadiusBottomRight), t.borderRadiusBottomLeft !== void 0 && (i.borderRadiusBottomLeft = t.borderRadiusBottomLeft), i;
190
+ function Z(n, t) {
191
+ if (!n) return t || {};
192
+ if (!t) return { ...n };
193
+ const i = { ...n };
194
+ return t.border !== void 0 && (i.border = { ...n.border, ...t.border }), t.borderTop !== void 0 && (i.borderTop = { ...n.borderTop, ...t.borderTop }), t.borderRight !== void 0 && (i.borderRight = { ...n.borderRight, ...t.borderRight }), t.borderBottom !== void 0 && (i.borderBottom = { ...n.borderBottom, ...t.borderBottom }), t.borderLeft !== void 0 && (i.borderLeft = { ...n.borderLeft, ...t.borderLeft }), t.filter !== void 0 && (i.filter = { ...n.filter, ...t.filter }), t.outline !== void 0 && (i.outline = { ...n.outline, ...t.outline }), t.shadow !== void 0 && (i.shadow = t.shadow), t.clipPath !== void 0 && (i.clipPath = t.clipPath), t.opacity !== void 0 && (i.opacity = t.opacity), t.cursor !== void 0 && (i.cursor = t.cursor), t.className !== void 0 && (i.className = t.className), t.objectFit !== void 0 && (i.objectFit = t.objectFit), t.aspectRatio !== void 0 && (i.aspectRatio = t.aspectRatio), t.borderRadiusTopLeft !== void 0 && (i.borderRadiusTopLeft = t.borderRadiusTopLeft), t.borderRadiusTopRight !== void 0 && (i.borderRadiusTopRight = t.borderRadiusTopRight), t.borderRadiusBottomRight !== void 0 && (i.borderRadiusBottomRight = t.borderRadiusBottomRight), t.borderRadiusBottomLeft !== void 0 && (i.borderRadiusBottomLeft = t.borderRadiusBottomLeft), i;
197
195
  }
198
- function te(o, t) {
199
- if (!t) return { ...o };
200
- const i = Z(o.default, t.default), e = Z(
201
- Z(i, o.hover),
196
+ function te(n, t) {
197
+ if (!t) return { ...n };
198
+ const i = Z(n.default, t.default), e = Z(
199
+ Z(i, n.hover),
202
200
  t.hover
203
- ), n = Z(
204
- Z(i, o.focused),
201
+ ), o = Z(
202
+ Z(i, n.focused),
205
203
  t.focused
206
204
  );
207
205
  return {
208
206
  default: i,
209
207
  hover: e,
210
- focused: n
208
+ focused: o
211
209
  };
212
210
  }
213
- function ee(o, t) {
214
- if (!t) return { ...o };
215
- const i = { ...o };
211
+ function ee(n, t) {
212
+ if (!t) return { ...n };
213
+ const i = { ...n };
216
214
  if (t.sizing !== void 0 && (i.sizing = {
217
- ...o.sizing,
215
+ ...n.sizing,
218
216
  ...t.sizing
219
217
  }, t.sizing.variance)) {
220
- const e = t.sizing.variance, n = e.min !== void 0 && e.min >= 0.25 && e.min <= 1 ? e.min : o.sizing?.variance?.min ?? 1, s = e.max !== void 0 && e.max >= 1 && e.max <= 1.75 ? e.max : o.sizing?.variance?.max ?? 1;
221
- i.sizing.variance = { min: n, max: s };
218
+ const e = t.sizing.variance, o = e.min !== void 0 && e.min >= 0.25 && e.min <= 1 ? e.min : n.sizing?.variance?.min ?? 1, s = e.max !== void 0 && e.max >= 1 && e.max <= 1.75 ? e.max : n.sizing?.variance?.max ?? 1;
219
+ i.sizing.variance = { min: o, max: s };
222
220
  }
223
221
  if (t.rotation !== void 0 && (i.rotation = {
224
- ...o.rotation,
222
+ ...n.rotation,
225
223
  ...t.rotation
226
224
  }, t.rotation.range)) {
227
- const e = t.rotation.range, n = e.min !== void 0 && e.min >= -180 && e.min <= 0 ? e.min : o.rotation?.range?.min ?? -15, s = e.max !== void 0 && e.max >= 0 && e.max <= 180 ? e.max : o.rotation?.range?.max ?? 15;
228
- i.rotation.range = { min: n, max: s };
225
+ const e = t.rotation.range, o = e.min !== void 0 && e.min >= -180 && e.min <= 0 ? e.min : n.rotation?.range?.min ?? -15, s = e.max !== void 0 && e.max >= 0 && e.max <= 180 ? e.max : n.rotation?.range?.max ?? 15;
226
+ i.rotation.range = { min: o, max: s };
229
227
  }
230
228
  return i;
231
229
  }
232
- function ie(o) {
233
- const t = o.layout?.rotation;
234
- if (t && "enabled" in t)
235
- return {
236
- rotation: {
237
- mode: t.enabled ? "random" : "none",
238
- range: t.range
239
- }
240
- };
241
- }
242
- function ne(o) {
243
- const t = o.layout?.sizing?.variance;
244
- if (t)
245
- return {
246
- sizing: {
247
- mode: "adaptive",
248
- // Legacy variance config implies adaptive mode
249
- variance: t
250
- }
251
- };
252
- }
253
- function oe(o = {}) {
254
- const t = ie(o), i = ne(o);
255
- let e = o.image;
256
- (t || i) && (e = {
257
- ...i || {},
258
- ...t || {},
259
- ...e
260
- }, e.rotation && t?.rotation && o.image?.rotation && (e.rotation = {
261
- ...t.rotation,
262
- ...o.image.rotation
263
- }));
264
- const n = [...o.loaders ?? []];
265
- o.images && o.images.length > 0 && n.unshift({
230
+ function ie(n = {}) {
231
+ const t = n.image, i = [...n.loaders ?? []];
232
+ n.images && n.images.length > 0 && i.unshift({
266
233
  static: {
267
- sources: [{ urls: o.images }]
234
+ sources: [{ urls: n.images }]
268
235
  }
269
236
  });
270
- const r = {
237
+ const o = {
271
238
  loaders: {
272
- ...Ot,
273
- ...o.config?.loaders ?? {}
239
+ ...zt,
240
+ ...n.config?.loaders ?? {}
274
241
  }
275
- }, a = {
276
- loaders: n,
277
- config: r,
278
- image: ee(zt, e),
279
- layout: { ...C.layout },
280
- animation: { ...C.animation },
281
- interaction: { ...C.interaction },
282
- ui: { ...C.ui },
283
- styling: te(Ft, o.styling)
242
+ }, s = {
243
+ loaders: i,
244
+ config: o,
245
+ image: ee(Ot, t),
246
+ layout: { ...L.layout },
247
+ animation: { ...L.animation },
248
+ interaction: { ...L.interaction },
249
+ ui: { ...L.ui },
250
+ styling: te(Mt, n.styling)
284
251
  };
285
- o.layout && (a.layout = {
286
- ...C.layout,
287
- ...o.layout
288
- }, o.layout.responsive && (a.layout.responsive = {
289
- ...C.layout.responsive,
290
- mobile: o.layout.responsive.mobile ? { ...C.layout.responsive.mobile, ...o.layout.responsive.mobile } : C.layout.responsive.mobile,
291
- tablet: o.layout.responsive.tablet ? { ...C.layout.responsive.tablet, ...o.layout.responsive.tablet } : C.layout.responsive.tablet
292
- }), o.layout.spacing && (a.layout.spacing = {
293
- ...C.layout.spacing,
294
- ...o.layout.spacing
295
- })), o.animation && (a.animation = {
296
- ...C.animation,
297
- ...o.animation
298
- }, o.animation.easing && (a.animation.easing = {
299
- ...C.animation.easing,
300
- ...o.animation.easing
301
- }), o.animation.queue && (a.animation.queue = {
302
- ...C.animation.queue,
303
- ...o.animation.queue
304
- }), o.animation.entry && (a.animation.entry = {
305
- ...C.animation.entry,
306
- ...o.animation.entry,
307
- start: o.animation.entry.start ? {
308
- ...C.animation.entry.start,
309
- ...o.animation.entry.start,
310
- circular: o.animation.entry.start.circular ? { ...C.animation.entry.start.circular, ...o.animation.entry.start.circular } : C.animation.entry.start.circular
311
- } : C.animation.entry.start,
312
- timing: o.animation.entry.timing ? { ...C.animation.entry.timing, ...o.animation.entry.timing } : C.animation.entry.timing,
313
- path: o.animation.entry.path ? { ...yt, ...o.animation.entry.path } : C.animation.entry.path,
314
- rotation: o.animation.entry.rotation ? { ...vt, ...o.animation.entry.rotation } : C.animation.entry.rotation,
315
- scale: o.animation.entry.scale ? { ...Et, ...o.animation.entry.scale } : C.animation.entry.scale
316
- }), o.animation.idle && (a.animation.idle = {
252
+ if (n.layout && (s.layout = {
253
+ ...L.layout,
254
+ ...n.layout
255
+ }, n.layout.responsive && (s.layout.responsive = {
256
+ ...L.layout.responsive,
257
+ mobile: n.layout.responsive.mobile ? { ...L.layout.responsive.mobile, ...n.layout.responsive.mobile } : L.layout.responsive.mobile,
258
+ tablet: n.layout.responsive.tablet ? { ...L.layout.responsive.tablet, ...n.layout.responsive.tablet } : L.layout.responsive.tablet
259
+ }), n.layout.spacing && (s.layout.spacing = {
260
+ ...L.layout.spacing,
261
+ ...n.layout.spacing
262
+ })), n.animation && (s.animation = {
263
+ ...L.animation,
264
+ ...n.animation
265
+ }, n.animation.easing && (s.animation.easing = {
266
+ ...L.animation.easing,
267
+ ...n.animation.easing
268
+ }), n.animation.queue && (s.animation.queue = {
269
+ ...L.animation.queue,
270
+ ...n.animation.queue
271
+ }), n.animation.entry && (s.animation.entry = {
272
+ ...L.animation.entry,
273
+ ...n.animation.entry,
274
+ start: n.animation.entry.start ? {
275
+ ...L.animation.entry.start,
276
+ ...n.animation.entry.start,
277
+ circular: n.animation.entry.start.circular ? { ...L.animation.entry.start.circular, ...n.animation.entry.start.circular } : L.animation.entry.start.circular
278
+ } : L.animation.entry.start,
279
+ timing: n.animation.entry.timing ? { ...L.animation.entry.timing, ...n.animation.entry.timing } : L.animation.entry.timing,
280
+ path: n.animation.entry.path ? { ...yt, ...n.animation.entry.path } : L.animation.entry.path,
281
+ rotation: n.animation.entry.rotation ? { ...vt, ...n.animation.entry.rotation } : L.animation.entry.rotation,
282
+ scale: n.animation.entry.scale ? { ...xt, ...n.animation.entry.scale } : L.animation.entry.scale
283
+ }), n.animation.idle && (s.animation.idle = {
317
284
  ...$t,
318
- ...o.animation.idle
319
- })), o.interaction && (a.interaction = {
320
- ...C.interaction,
321
- ...o.interaction
322
- }, o.interaction.focus && (a.interaction.focus = {
323
- ...C.interaction.focus,
324
- ...o.interaction.focus
325
- }), o.interaction.navigation && (a.interaction.navigation = {
326
- ...C.interaction.navigation,
327
- ...o.interaction.navigation
328
- }));
329
- const c = o.rendering?.ui;
330
- if (c && console.warn("[ImageCloud] rendering.ui is deprecated. Use top-level ui instead."), a.ui = {
331
- ...C.ui,
332
- ...c,
333
- ...o.ui
334
- }, a.config.debug = {
285
+ ...n.animation.idle
286
+ })), n.interaction && (s.interaction = {
287
+ ...L.interaction,
288
+ ...n.interaction
289
+ }, n.interaction.focus && (s.interaction.focus = {
290
+ ...L.interaction.focus,
291
+ ...n.interaction.focus
292
+ }), n.interaction.navigation && (s.interaction.navigation = {
293
+ ...L.interaction.navigation,
294
+ ...n.interaction.navigation
295
+ })), s.ui = {
296
+ ...L.ui,
297
+ ...n.ui
298
+ }, s.config.debug = {
335
299
  ...Dt,
336
- ...o.config?.debug ?? {}
337
- }, a.layout.algorithm === "honeycomb" && a.styling) {
338
- const l = { shape: "hexagon", mode: "height-relative" };
339
- a.styling = {
340
- ...a.styling,
341
- default: { ...a.styling.default, clipPath: l },
342
- hover: { ...a.styling.hover, clipPath: l }
300
+ ...n.config?.debug ?? {}
301
+ }, s.layout.algorithm === "honeycomb" && s.styling) {
302
+ const r = { shape: "hexagon", mode: "height-relative" };
303
+ s.styling = {
304
+ ...s.styling,
305
+ default: { ...s.styling.default, clipPath: r },
306
+ hover: { ...s.styling.hover, clipPath: r }
343
307
  // focused: untouched — user config respected
344
308
  };
345
309
  }
346
- return a;
310
+ return s;
347
311
  }
348
- function se(o, t) {
349
- return { ...o ? Ct[o] : Ct.playful, ...t };
312
+ function oe(n, t) {
313
+ return { ...n ? Ct[n] : Ct.playful, ...t };
350
314
  }
351
- function ae(o, t) {
352
- return { ...o ? At[o] : At.gentle, ...t };
315
+ function ne(n, t) {
316
+ return { ...n ? Rt[n] : Rt.gentle, ...t };
353
317
  }
354
- function re(o, t) {
355
- return { ...o ? Rt[o] : Rt.gentle, ...t };
318
+ function se(n, t) {
319
+ return { ...n ? Tt[n] : Tt.gentle, ...t };
356
320
  }
357
- class ce {
321
+ class ae {
358
322
  constructor(t) {
359
323
  this.activeAnimations = /* @__PURE__ */ new Map(), this.animationIdCounter = 0, this.config = t;
360
324
  }
@@ -365,8 +329,8 @@ class ce {
365
329
  buildTransformString(t) {
366
330
  const i = ["translate(-50%, -50%)"];
367
331
  if (t.x !== void 0 || t.y !== void 0) {
368
- const e = t.x ?? 0, n = t.y ?? 0;
369
- i.push(`translate(${e}px, ${n}px)`);
332
+ const e = t.x ?? 0, o = t.y ?? 0;
333
+ i.push(`translate(${e}px, ${o}px)`);
370
334
  }
371
335
  return t.rotation !== void 0 && i.push(`rotate(${t.rotation}deg)`), t.scale !== void 0 && i.push(`scale(${t.scale})`), i.join(" ");
372
336
  }
@@ -379,14 +343,14 @@ class ce {
379
343
  * @param easing - CSS easing function (optional)
380
344
  * @returns AnimationHandle that can be used to cancel or query the animation
381
345
  */
382
- animateTransformCancellable(t, i, e, n = null, s = null) {
346
+ animateTransformCancellable(t, i, e, o = null, s = null) {
383
347
  this.cancelAllAnimations(t);
384
- const r = n ?? this.config.duration, a = s ?? this.config.easing.default, c = this.buildTransformString(i), l = this.buildTransformString(e);
348
+ const r = o ?? this.config.duration, a = s ?? this.config.easing.default, c = this.buildTransformString(i), d = this.buildTransformString(e);
385
349
  t.style.transition = "none";
386
350
  const u = t.animate(
387
351
  [
388
352
  { transform: c },
389
- { transform: l }
353
+ { transform: d }
390
354
  ],
391
355
  {
392
356
  duration: r,
@@ -394,7 +358,7 @@ class ce {
394
358
  fill: "forwards"
395
359
  // Keep final state after animation
396
360
  }
397
- ), h = {
361
+ ), f = {
398
362
  id: `anim-${++this.animationIdCounter}`,
399
363
  element: t,
400
364
  animation: u,
@@ -403,11 +367,11 @@ class ce {
403
367
  startTime: performance.now(),
404
368
  duration: r
405
369
  };
406
- return this.activeAnimations.set(t, h), u.finished.then(() => {
407
- t.style.transform = l, this.activeAnimations.delete(t);
370
+ return this.activeAnimations.set(t, f), u.finished.then(() => {
371
+ t.style.transform = d, this.activeAnimations.delete(t);
408
372
  }).catch(() => {
409
373
  this.activeAnimations.delete(t);
410
- }), h;
374
+ }), f;
411
375
  }
412
376
  /**
413
377
  * Cancel an active animation
@@ -418,13 +382,13 @@ class ce {
418
382
  cancelAnimation(t, i = !0) {
419
383
  const e = this.getCurrentTransform(t.element);
420
384
  if (t.animation.cancel(), i) {
421
- const n = this.buildTransformString({
385
+ const o = this.buildTransformString({
422
386
  x: e.x,
423
387
  y: e.y,
424
388
  rotation: e.rotation,
425
389
  scale: e.scale
426
390
  });
427
- t.element.style.transform = n;
391
+ t.element.style.transform = o;
428
392
  }
429
393
  return this.activeAnimations.delete(t.element), e;
430
394
  }
@@ -437,8 +401,8 @@ class ce {
437
401
  const i = this.activeAnimations.get(t);
438
402
  i && this.cancelAnimation(i, !1);
439
403
  const e = t.getAnimations();
440
- for (const n of e)
441
- n.cancel();
404
+ for (const o of e)
405
+ o.cancel();
442
406
  }
443
407
  /**
444
408
  * Get current transform state of an element (works mid-animation)
@@ -450,7 +414,7 @@ class ce {
450
414
  const e = getComputedStyle(t).transform;
451
415
  if (e === "none" || !e)
452
416
  return { x: 0, y: 0, rotation: 0, scale: 1 };
453
- const n = new DOMMatrix(e), s = Math.sqrt(n.a * n.a + n.b * n.b), r = Math.atan2(n.b, n.a) * (180 / Math.PI), a = n.e, c = n.f;
417
+ const o = new DOMMatrix(e), s = Math.sqrt(o.a * o.a + o.b * o.b), r = Math.atan2(o.b, o.a) * (180 / Math.PI), a = o.e, c = o.f;
454
418
  return { x: a, y: c, rotation: r, scale: s };
455
419
  }
456
420
  /**
@@ -477,9 +441,9 @@ class ce {
477
441
  * @param easing - CSS easing function (optional)
478
442
  * @returns Promise that resolves when animation completes
479
443
  */
480
- animateTransform(t, i, e = null, n = null) {
444
+ animateTransform(t, i, e = null, o = null) {
481
445
  return new Promise((s) => {
482
- const r = e ?? this.config.duration, a = n ?? this.config.easing.default;
446
+ const r = e ?? this.config.duration, a = o ?? this.config.easing.default;
483
447
  t.style.transition = `transform ${r}ms ${a}, box-shadow ${r}ms ${a}`, t.style.transform = this.buildTransformString(i), setTimeout(() => {
484
448
  s();
485
449
  }, r);
@@ -510,161 +474,167 @@ class ce {
510
474
  return new Promise((i) => setTimeout(i, t));
511
475
  }
512
476
  }
513
- function J(o, t, i) {
514
- return o + (t - o) * i;
477
+ function J(n, t, i) {
478
+ return n + (t - n) * i;
515
479
  }
516
- function le(o, t, i, e) {
517
- const { overshoot: n, bounces: s, decayRatio: r } = e, a = i.x - t.x, c = i.y - t.y, l = he(s, r);
518
- let u = 0, h = 0, d = 1, g = n, b = !1;
519
- for (let f = 0; f < l.length; f++)
520
- if (o <= l[f].time) {
521
- h = f === 0 ? 0 : l[f - 1].time, d = l[f].time, g = l[f].overshoot, b = l[f].isOvershoot;
480
+ function re(n, t, i, e) {
481
+ const { overshoot: o, bounces: s, decayRatio: r } = e, a = i.x - t.x, c = i.y - t.y, d = ce(s, r);
482
+ let u = 0, f = 0, m = 1, p = o, w = !1;
483
+ for (let l = 0; l < d.length; l++)
484
+ if (n <= d[l].time) {
485
+ f = l === 0 ? 0 : d[l - 1].time, m = d[l].time, p = d[l].overshoot, w = d[l].isOvershoot;
522
486
  break;
523
487
  }
524
- const p = (o - h) / (d - h);
525
- if (b)
526
- u = 1 + g * at(p);
527
- else if (h === 0)
528
- u = at(p);
488
+ const v = (n - f) / (m - f);
489
+ if (w)
490
+ u = 1 + p * at(v);
491
+ else if (f === 0)
492
+ u = at(v);
529
493
  else {
530
- const m = 1 + (l.find(
531
- (y, E) => y.time > h && E > 0 && l[E - 1].isOvershoot
532
- )?.overshoot || g);
533
- u = J(m, 1, at(p));
494
+ const g = 1 + (d.find(
495
+ (h, b) => h.time > f && b > 0 && d[b - 1].isOvershoot
496
+ )?.overshoot || p);
497
+ u = J(g, 1, at(v));
534
498
  }
535
499
  return {
536
500
  x: t.x + a * u,
537
501
  y: t.y + c * u
538
502
  };
539
503
  }
540
- function he(o, t) {
504
+ function ce(n, t) {
541
505
  const i = [];
542
506
  let e = 0.6;
543
507
  i.push({ time: e, overshoot: 0, isOvershoot: !1 });
544
- let n = 0.15;
545
- const r = 0.4 / (o * 2);
546
- for (let a = 0; a < o; a++)
547
- e += r, i.push({ time: e, overshoot: n, isOvershoot: !0 }), e += r, i.push({ time: e, overshoot: n * t, isOvershoot: !1 }), n *= t;
508
+ let o = 0.15;
509
+ const r = 0.4 / (n * 2);
510
+ for (let a = 0; a < n; a++)
511
+ e += r, i.push({ time: e, overshoot: o, isOvershoot: !0 }), e += r, i.push({ time: e, overshoot: o * t, isOvershoot: !1 }), o *= t;
548
512
  return i.push({ time: 1, overshoot: 0, isOvershoot: !1 }), i;
549
513
  }
550
- function de(o, t, i, e) {
551
- 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));
552
- let d;
553
- if (h < 1) {
554
- const g = u * Math.sqrt(1 - h * h), b = Math.exp(-h * u * o * 3), p = Math.cos(g * o * a * Math.PI);
555
- d = 1 - b * p;
514
+ function le(n, t, i, e) {
515
+ const { stiffness: o, damping: s, mass: r, oscillations: a } = e, c = i.x - t.x, d = i.y - t.y, u = Math.sqrt(o / r), f = s / (2 * Math.sqrt(o * r));
516
+ let m;
517
+ if (f < 1) {
518
+ const p = u * Math.sqrt(1 - f * f), w = Math.exp(-f * u * n * 3), v = Math.cos(p * n * a * Math.PI);
519
+ m = 1 - w * v;
556
520
  } else
557
- d = 1 - Math.exp(-u * o * 3);
558
- return d = Math.max(0, Math.min(d, 1.3)), {
559
- x: t.x + c * d,
560
- y: t.y + l * d
521
+ m = 1 - Math.exp(-u * n * 3);
522
+ return m = Math.max(0, Math.min(m, 1.3)), {
523
+ x: t.x + c * m,
524
+ y: t.y + d * m
561
525
  };
562
526
  }
563
- function ue(o, t, i, e) {
564
- 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 = fe(o);
527
+ function he(n, t, i, e) {
528
+ const { amplitude: o, 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 * n + c, v = r ? Math.pow(1 - n, a) : 1, l = o * Math.sin(w) * v, g = de(n);
565
529
  return {
566
- x: J(t.x, i.x, m) + f * d,
567
- y: J(t.y, i.y, m) + f * g
530
+ x: J(t.x, i.x, g) + l * m,
531
+ y: J(t.y, i.y, g) + l * p
568
532
  };
569
533
  }
570
- function at(o) {
571
- return 1 - (1 - o) * (1 - o);
534
+ function at(n) {
535
+ return 1 - (1 - n) * (1 - n);
572
536
  }
573
- function fe(o) {
574
- return 1 - Math.pow(1 - o, 3);
537
+ function de(n) {
538
+ return 1 - Math.pow(1 - n, 3);
575
539
  }
576
- function ge(o, t, i) {
577
- 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;
540
+ function ue(n, t, i) {
541
+ const { amplitude: e, frequency: o, decay: s } = i, r = Math.sin(n * o * Math.PI * 2), a = s ? Math.pow(1 - n, 2) : 1, c = e * r * a;
578
542
  return t + c;
579
543
  }
580
- function me(o, t, i) {
581
- const { overshoot: e, bounces: n } = i, s = [];
544
+ function fe(n, t, i) {
545
+ const { overshoot: e, bounces: o } = i, s = [];
582
546
  s.push({ time: 0.5, scale: e });
583
547
  let r = e;
584
- const a = 0.5, l = 0.5 / (n * 2);
548
+ const a = 0.5, d = 0.5 / (o * 2);
585
549
  let u = 0.5;
586
- for (let d = 0; d < n; d++) {
587
- const g = 1 - (r - 1) * a;
588
- 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 });
550
+ for (let m = 0; m < o; m++) {
551
+ const p = 1 - (r - 1) * a;
552
+ u += d, s.push({ time: u, scale: p }), r = 1 + (r - 1) * a * a, u += d, m < o - 1 && s.push({ time: u, scale: r });
589
553
  }
590
554
  s.push({ time: 1, scale: 1 });
591
- let h = 1;
592
- for (let d = 0; d < s.length; d++)
593
- if (o <= s[d].time) {
594
- 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);
595
- h = b + (s[d].scale - b) * f;
555
+ let f = 1;
556
+ for (let m = 0; m < s.length; m++)
557
+ if (n <= s[m].time) {
558
+ const p = m === 0 ? 0 : s[m - 1].time, w = m === 0 ? 1 : s[m - 1].scale, v = (n - p) / (s[m].time - p), l = at(v);
559
+ f = w + (s[m].scale - w) * l;
596
560
  break;
597
561
  }
598
- return h * t;
562
+ return f * t;
599
563
  }
600
- function pe(o) {
564
+ function ge(n) {
601
565
  const {
602
566
  element: t,
603
567
  startPosition: i,
604
568
  endPosition: e,
605
- pathConfig: n,
569
+ pathConfig: o,
606
570
  duration: s,
607
571
  imageWidth: r,
608
572
  imageHeight: a,
609
573
  rotation: c,
610
- scale: l,
574
+ scale: d,
611
575
  onComplete: u,
612
- rotationConfig: h,
613
- startRotation: d,
614
- scaleConfig: g,
615
- startScale: b
616
- } = 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 };
617
- if ((p === "linear" || p === "arc") && !E && !(v || S)) {
576
+ onProgress: f,
577
+ rotationConfig: m,
578
+ startRotation: p,
579
+ scaleConfig: w,
580
+ startScale: v
581
+ } = n, l = o.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 };
582
+ if (l === "linear" && !I && !(y || x)) {
618
583
  u && u();
619
584
  return;
620
585
  }
621
- const z = performance.now(), L = -r / 2, _ = -a / 2;
622
- function O(H) {
623
- const N = H - z, A = Math.min(N / s, 1);
624
- let D;
625
- switch (p) {
586
+ const R = performance.now(), M = -r / 2, T = -a / 2;
587
+ function z(k) {
588
+ const D = k - R, O = Math.min(D / s, 1);
589
+ let S;
590
+ switch (l) {
626
591
  case "bounce": {
627
- const k = se(
628
- n.bouncePreset,
629
- n.bounce
592
+ const N = oe(
593
+ o.bouncePreset,
594
+ o.bounce
630
595
  );
631
- D = le(A, i, e, k);
596
+ S = re(O, i, e, N);
632
597
  break;
633
598
  }
634
599
  case "elastic": {
635
- const k = ae(
636
- n.elasticPreset,
637
- n.elastic
600
+ const N = ne(
601
+ o.elasticPreset,
602
+ o.elastic
638
603
  );
639
- D = de(A, i, e, k);
604
+ S = le(O, i, e, N);
640
605
  break;
641
606
  }
642
607
  case "wave": {
643
- const k = re(
644
- n.wavePreset,
645
- n.wave
608
+ const N = se(
609
+ o.wavePreset,
610
+ o.wave
646
611
  );
647
- D = ue(A, i, e, k);
612
+ S = he(O, i, e, N);
648
613
  break;
649
614
  }
650
615
  default:
651
- D = {
652
- x: J(i.x, e.x, A),
653
- y: J(i.y, e.y, A)
616
+ S = {
617
+ x: J(i.x, e.x, O),
618
+ y: J(i.y, e.y, O)
654
619
  };
655
620
  }
656
- const W = D.x - e.x, U = D.y - e.y;
657
- let M;
658
- m ? M = ge(A, c, y) : f ? M = J(d, c, A) : M = c;
659
- let R;
660
- S ? R = me(A, l, w) : v ? R = J(b, l, A) : R = l, t.style.transform = `translate(${L}px, ${_}px) translate(${W}px, ${U}px) rotate(${M}deg) scale(${R})`, A < 1 ? requestAnimationFrame(O) : (t.style.transform = `translate(${L}px, ${_}px) rotate(${c}deg) scale(${l})`, u && u());
661
- }
662
- requestAnimationFrame(O);
621
+ const _ = S.x - e.x, $ = S.y - e.y;
622
+ let A;
623
+ h ? A = ue(O, c, b) : g ? A = J(p, c, O) : A = c;
624
+ let j;
625
+ x ? j = fe(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, {
626
+ x: S.x,
627
+ y: S.y,
628
+ rotation: A,
629
+ scale: j
630
+ }), O < 1 ? requestAnimationFrame(z) : (t.style.transform = `translate(${M}px, ${T}px) rotate(${c}deg) scale(${d})`, u && u());
631
+ }
632
+ requestAnimationFrame(z);
663
633
  }
664
- function be(o) {
665
- return o === "bounce" || o === "elastic" || o === "wave";
634
+ function me(n) {
635
+ return n === "bounce" || n === "elastic" || n === "wave";
666
636
  }
667
- const ye = {
637
+ const pe = {
668
638
  radial: "center",
669
639
  spiral: "center",
670
640
  grid: "top",
@@ -673,20 +643,20 @@ const ye = {
673
643
  wave: "left",
674
644
  honeycomb: "center"
675
645
  };
676
- class ve {
646
+ class be {
677
647
  constructor(t, i) {
678
- 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;
648
+ 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;
679
649
  }
680
650
  /**
681
651
  * Get the effective start position, considering layout-aware defaults
682
652
  */
683
653
  resolveStartPosition() {
684
- return this.config.start.position ? this.config.start.position : ye[this.layoutAlgorithm] || "nearest-edge";
654
+ return this.config.start.position ? this.config.start.position : pe[this.layoutAlgorithm] || "nearest-edge";
685
655
  }
686
656
  /**
687
657
  * Calculate the starting position for an image's entry animation
688
658
  */
689
- calculateStartPosition(t, i, e, n, s) {
659
+ calculateStartPosition(t, i, e, o, s) {
690
660
  const r = this.resolvedStartPosition, a = this.config.start.offset ?? 100;
691
661
  switch (r) {
692
662
  case "nearest-edge":
@@ -708,7 +678,7 @@ class ve {
708
678
  t,
709
679
  i,
710
680
  e,
711
- n,
681
+ o,
712
682
  s
713
683
  );
714
684
  default:
@@ -718,28 +688,28 @@ class ve {
718
688
  /**
719
689
  * Calculate start position from the nearest edge (current default behavior)
720
690
  */
721
- calculateNearestEdge(t, i, e, n) {
722
- 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);
723
- let d = t.x, g = t.y;
724
- 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 };
691
+ calculateNearestEdge(t, i, e, o) {
692
+ 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);
693
+ let m = t.x, p = t.y;
694
+ return f === a ? m = -(i.width + o) : f === c ? m = e.width + o : f === d ? p = -(i.height + o) : p = e.height + o, { x: m, y: p };
725
695
  }
726
696
  /**
727
697
  * Calculate start position from a specific edge
728
698
  */
729
- calculateEdgePosition(t, i, e, n, s) {
699
+ calculateEdgePosition(t, i, e, o, s) {
730
700
  let r = i.x, a = i.y;
731
701
  switch (t) {
732
702
  case "top":
733
703
  a = -(e.height + s);
734
704
  break;
735
705
  case "bottom":
736
- a = n.height + s;
706
+ a = o.height + s;
737
707
  break;
738
708
  case "left":
739
709
  r = -(e.width + s);
740
710
  break;
741
711
  case "right":
742
- r = n.width + s;
712
+ r = o.width + s;
743
713
  break;
744
714
  }
745
715
  return { x: r, y: a };
@@ -748,9 +718,9 @@ class ve {
748
718
  * Calculate start position from center with scale animation
749
719
  */
750
720
  calculateCenterPosition(t, i, e) {
751
- const n = t.width / 2, s = t.height / 2;
721
+ const o = t.width / 2, s = t.height / 2;
752
722
  return {
753
- x: n,
723
+ x: o,
754
724
  y: s,
755
725
  useScale: !0
756
726
  // Signal to use scale animation from 0
@@ -759,28 +729,28 @@ class ve {
759
729
  /**
760
730
  * Calculate start position from a random edge
761
731
  */
762
- calculateRandomEdge(t, i, e, n) {
732
+ calculateRandomEdge(t, i, e, o) {
763
733
  const s = ["top", "bottom", "left", "right"], r = s[Math.floor(Math.random() * s.length)];
764
- return this.calculateEdgePosition(r, t, i, e, n);
734
+ return this.calculateEdgePosition(r, t, i, e, o);
765
735
  }
766
736
  /**
767
737
  * Calculate start position on a circle around the container
768
738
  */
769
- calculateCircularPosition(t, i, e, n, s) {
739
+ calculateCircularPosition(t, i, e, o, s) {
770
740
  const r = this.config.start.circular || {}, a = r.distribution || "even";
771
741
  let c;
772
- const l = r.radius || "120%";
773
- if (typeof l == "string" && l.endsWith("%")) {
774
- const p = parseFloat(l) / 100;
742
+ const d = r.radius || "120%";
743
+ if (typeof d == "string" && d.endsWith("%")) {
744
+ const v = parseFloat(d) / 100;
775
745
  c = Math.sqrt(
776
746
  e.width ** 2 + e.height ** 2
777
- ) * p / 2;
747
+ ) * v / 2;
778
748
  } else
779
- c = typeof l == "number" ? l : 500;
749
+ c = typeof d == "number" ? d : 500;
780
750
  let u;
781
- a === "even" ? u = n / s * 2 * Math.PI : u = Math.random() * 2 * Math.PI;
782
- const h = e.width / 2, d = e.height / 2, g = h + Math.cos(u) * c, b = d + Math.sin(u) * c;
783
- return { x: g, y: b };
751
+ a === "even" ? u = o / s * 2 * Math.PI : u = Math.random() * 2 * Math.PI;
752
+ const f = e.width / 2, m = e.height / 2, p = f + Math.cos(u) * c, w = m + Math.sin(u) * c;
753
+ return { x: p, y: w };
784
754
  }
785
755
  /**
786
756
  * Get animation parameters for an image
@@ -799,17 +769,17 @@ class ve {
799
769
  * Build a CSS transform string for the start position
800
770
  * Uses pixel-based centering offset for reliable cross-browser behavior
801
771
  */
802
- buildStartTransform(t, i, e, n, s, r, a, c) {
803
- 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%)";
804
- 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})`;
772
+ buildStartTransform(t, i, e, o, s, r, a, c) {
773
+ const d = t.x - i.x, u = t.y - i.y, f = a !== void 0 ? a : e, m = c !== void 0 ? c : o, 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%)";
774
+ 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})`;
805
775
  }
806
776
  /**
807
777
  * Build the final CSS transform string
808
778
  * Uses pixel-based centering offset for reliable cross-browser behavior
809
779
  */
810
- buildFinalTransform(t, i, e, n) {
811
- if (e !== void 0 && n !== void 0) {
812
- const s = -e / 2, r = -n / 2;
780
+ buildFinalTransform(t, i, e, o) {
781
+ if (e !== void 0 && o !== void 0) {
782
+ const s = -e / 2, r = -o / 2;
813
783
  return `translate(${s}px, ${r}px) rotate(${t}deg) scale(${i})`;
814
784
  }
815
785
  return `translate(-50%, -50%) rotate(${t}deg) scale(${i})`;
@@ -826,7 +796,7 @@ class ve {
826
796
  * Check if the current path type requires JavaScript animation
827
797
  */
828
798
  requiresJSAnimation() {
829
- return be(this.pathConfig.type);
799
+ return me(this.pathConfig.type);
830
800
  }
831
801
  /**
832
802
  * Get the path configuration
@@ -875,12 +845,12 @@ class ve {
875
845
  return t + (Math.random() - 0.5) * 60;
876
846
  if (typeof e == "number")
877
847
  return e;
878
- const n = e.max - e.min;
879
- return e.min + Math.random() * n;
848
+ const o = e.max - e.min;
849
+ return e.min + Math.random() * o;
880
850
  }
881
851
  case "spin": {
882
- const e = this.rotationConfig.spinCount ?? 1, n = this.resolveSpinDirection(t);
883
- return t + e * 360 * n;
852
+ const e = this.rotationConfig.spinCount ?? 1, o = this.resolveSpinDirection(t);
853
+ return t + e * 360 * o;
884
854
  }
885
855
  case "random":
886
856
  return t + (Math.random() - 0.5) * 60;
@@ -928,8 +898,8 @@ class ve {
928
898
  amplitude: 15,
929
899
  frequency: 3,
930
900
  decay: !0
931
- }, { 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;
932
- return i + l;
901
+ }, { amplitude: o, frequency: s, decay: r } = e, a = Math.sin(t * s * Math.PI * 2), c = r ? Math.pow(1 - t, 2) : 1, d = o * a * c;
902
+ return i + d;
933
903
  }
934
904
  /**
935
905
  * Get the scale configuration
@@ -985,12 +955,12 @@ class ve {
985
955
  const e = this.scaleConfig.pop || {
986
956
  overshoot: 1.2,
987
957
  bounces: 1
988
- }, { overshoot: n, bounces: s } = e, r = this.generateScaleBounceKeyframes(s, n);
958
+ }, { overshoot: o, bounces: s } = e, r = this.generateScaleBounceKeyframes(s, o);
989
959
  let a = i;
990
960
  for (let c = 0; c < r.length; c++)
991
961
  if (t <= r[c].time) {
992
- 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);
993
- a = u + (r[c].scale - u) * d;
962
+ 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);
963
+ a = u + (r[c].scale - u) * m;
994
964
  break;
995
965
  }
996
966
  return a * i;
@@ -1001,12 +971,12 @@ class ve {
1001
971
  generateScaleBounceKeyframes(t, i) {
1002
972
  const e = [];
1003
973
  e.push({ time: 0.5, scale: i });
1004
- let n = i;
974
+ let o = i;
1005
975
  const s = 0.5, a = 0.5 / (t * 2);
1006
976
  let c = 0.5;
1007
- for (let l = 0; l < t; l++) {
1008
- const u = 1 - (n - 1) * s;
1009
- 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 });
977
+ for (let d = 0; d < t; d++) {
978
+ const u = 1 - (o - 1) * s;
979
+ c += a, e.push({ time: c, scale: u }), o = 1 + (o - 1) * s * s, c += a, d < t - 1 && e.push({ time: c, scale: o });
1010
980
  }
1011
981
  return e.push({ time: 1, scale: 1 }), e;
1012
982
  }
@@ -1017,7 +987,7 @@ class ve {
1017
987
  return 1 - (1 - t) * (1 - t);
1018
988
  }
1019
989
  }
1020
- class Ee {
990
+ class ye {
1021
991
  constructor(t, i = 600) {
1022
992
  this.entries = /* @__PURE__ */ new Map(), this.togetherRafId = null, this.togetherSpeed = 0, this.config = t, this.entryDurationMs = i;
1023
993
  }
@@ -1025,9 +995,9 @@ class Ee {
1025
995
  * Register an image element for idle animation.
1026
996
  * Starts animation after entry duration completes.
1027
997
  */
1028
- register(t, i, e, n) {
998
+ register(t, i, e, o) {
1029
999
  if (this.entries.has(t)) return;
1030
- const s = n ?? this.entryDurationMs, r = this.config.startDelay ?? s, a = {
1000
+ const s = o ?? this.entryDurationMs, r = this.config.startDelay ?? s, a = {
1031
1001
  element: t,
1032
1002
  index: i,
1033
1003
  totalImages: e,
@@ -1142,23 +1112,23 @@ class Ee {
1142
1112
  });
1143
1113
  }
1144
1114
  _startBlink(t) {
1145
- const i = { ...Zt, ...this.config.blink }, e = -(Math.random() * i.speed), n = parseFloat(getComputedStyle(t.element).opacity) || 1;
1115
+ const i = { ...Zt, ...this.config.blink }, e = -(Math.random() * i.speed), o = parseFloat(getComputedStyle(t.element).opacity) || 1;
1146
1116
  let s, r;
1147
1117
  i.style === "fade" ? (s = [
1148
- { opacity: n, offset: 0 },
1118
+ { opacity: o, offset: 0 },
1149
1119
  { opacity: 0, offset: 0.5 },
1150
- { opacity: n, offset: 1 }
1120
+ { opacity: o, offset: 1 }
1151
1121
  ], r = {
1152
1122
  duration: i.speed,
1153
1123
  delay: e,
1154
1124
  iterations: 1 / 0,
1155
1125
  easing: "ease-in-out"
1156
1126
  }) : (s = [
1157
- { opacity: n, offset: 0 },
1158
- { opacity: n, offset: i.onRatio },
1127
+ { opacity: o, offset: 0 },
1128
+ { opacity: o, offset: i.onRatio },
1159
1129
  { opacity: 0, offset: Math.min(i.onRatio + 0.01, 0.99) },
1160
1130
  { opacity: 0, offset: 0.99 },
1161
- { opacity: n, offset: 1 }
1131
+ { opacity: o, offset: 1 }
1162
1132
  ], r = {
1163
1133
  duration: i.speed,
1164
1134
  delay: e,
@@ -1187,8 +1157,8 @@ class Ee {
1187
1157
  if (this.togetherSpeed = t, this.togetherRafId !== null) return;
1188
1158
  const i = () => {
1189
1159
  const e = performance.now() % this.togetherSpeed;
1190
- for (const n of this.entries.values())
1191
- !n.stopped && !n.paused && n.animation && (n.animation.currentTime = e);
1160
+ for (const o of this.entries.values())
1161
+ !o.stopped && !o.paused && o.animation && (o.animation.currentTime = e);
1192
1162
  this.togetherRafId = requestAnimationFrame(i);
1193
1163
  };
1194
1164
  this.togetherRafId = requestAnimationFrame(i);
@@ -1203,7 +1173,7 @@ class Ee {
1203
1173
  t.animation && (t.animation.cancel(), t.animation = null), t.blinkAnimation && (t.blinkAnimation.cancel(), t.blinkAnimation = null), t.customTeardown && (t.customTeardown(), t.customTeardown = null);
1204
1174
  }
1205
1175
  }
1206
- class we {
1176
+ class ve {
1207
1177
  constructor(t, i = {}) {
1208
1178
  this.config = t, this.imageConfig = i;
1209
1179
  }
@@ -1215,19 +1185,19 @@ class we {
1215
1185
  * @returns Array of layout objects with position, rotation, scale
1216
1186
  */
1217
1187
  generate(t, i, e = {}) {
1218
- 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;
1219
- for (let w = 0; w < t; w++) {
1220
- 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 = {
1221
- id: w,
1222
- x: I,
1223
- y: z,
1224
- rotation: L,
1225
- scale: _,
1226
- baseSize: O
1188
+ const o = [], { 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;
1189
+ for (let x = 0; x < t; x++) {
1190
+ 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 = {
1191
+ id: x,
1192
+ x: E,
1193
+ y: F,
1194
+ rotation: R,
1195
+ scale: M,
1196
+ baseSize: T
1227
1197
  };
1228
- n.push(H);
1198
+ o.push(z);
1229
1199
  }
1230
- return n;
1200
+ return o;
1231
1201
  }
1232
1202
  /**
1233
1203
  * Utility: Generate random number between min and max
@@ -1251,55 +1221,55 @@ class xe {
1251
1221
  * @returns Array of layout objects with position, rotation, scale
1252
1222
  */
1253
1223
  generate(t, i, e = {}) {
1254
- 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 = {
1224
+ const o = [], { 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 = {
1255
1225
  ...Wt,
1256
1226
  ...this.config.radial
1257
- }, 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(
1258
- m - v - f / 2,
1259
- y - v - f / 2
1227
+ }, 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(
1228
+ g - I - l / 2,
1229
+ h - I - l / 2
1260
1230
  ));
1261
1231
  if (t > 0) {
1262
- const z = g ? this.random(h, d) : 1, L = f * z;
1263
- n.push({
1232
+ const F = p ? this.random(f, m) : 1, R = l * F;
1233
+ o.push({
1264
1234
  id: 0,
1265
- x: m,
1266
- y,
1267
- rotation: c === "random" ? this.random(l * 0.33, u * 0.33) : 0,
1235
+ x: g,
1236
+ y: h,
1237
+ rotation: c === "random" ? this.random(d * 0.33, u * 0.33) : 0,
1268
1238
  // Less rotation for center
1269
- scale: z,
1270
- baseSize: L,
1239
+ scale: F,
1240
+ baseSize: R,
1271
1241
  zIndex: 100
1272
1242
  // Center image is highest
1273
1243
  });
1274
1244
  }
1275
- let w = 1, I = 1;
1276
- for (; w < t; ) {
1277
- 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))), A = this.estimateWidth(f), D = Math.floor(N / (A * 0.7));
1278
- if (D === 0) {
1279
- I++;
1245
+ let x = 1, E = 1;
1246
+ for (; x < t; ) {
1247
+ 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));
1248
+ if (O === 0) {
1249
+ E++;
1280
1250
  continue;
1281
1251
  }
1282
- const W = 2 * Math.PI / D, U = I * (20 * Math.PI / 180);
1283
- for (let M = 0; M < D && w < t; M++) {
1284
- const R = M * W + U, k = g ? this.random(h, d) : 1, q = L * k, T = f * q;
1285
- let $ = m + Math.cos(R) * H, F = y + Math.sin(R) * O;
1286
- const P = T * 1.5 / 2, B = T / 2;
1287
- $ - P < v ? $ = v + P : $ + P > s - v && ($ = s - v - P), F - B < v ? F = v + B : F + B > r - v && (F = r - v - B);
1288
- const Y = c === "random" ? this.random(l, u) : 0;
1289
- n.push({
1290
- id: w,
1291
- x: $,
1292
- y: F,
1293
- rotation: Y,
1294
- scale: q,
1295
- baseSize: T,
1296
- zIndex: Math.max(1, 100 - I)
1252
+ const S = 2 * Math.PI / O, _ = E * (20 * Math.PI / 180);
1253
+ for (let $ = 0; $ < O && x < t; $++) {
1254
+ const A = $ * S + _, j = p ? this.random(f, m) : 1, N = R * j, P = l * N;
1255
+ let H = g + Math.cos(A) * z, U = h + Math.sin(A) * T;
1256
+ const B = P * 1.5 / 2, W = P / 2;
1257
+ 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);
1258
+ const X = c === "random" ? this.random(d, u) : 0;
1259
+ o.push({
1260
+ id: x,
1261
+ x: H,
1262
+ y: U,
1263
+ rotation: X,
1264
+ scale: N,
1265
+ baseSize: P,
1266
+ zIndex: Math.max(1, 100 - E)
1297
1267
  // Outer rings have lower z-index
1298
- }), w++;
1268
+ }), x++;
1299
1269
  }
1300
- I++;
1270
+ E++;
1301
1271
  }
1302
- return n;
1272
+ return o;
1303
1273
  }
1304
1274
  /**
1305
1275
  * Estimate image width based on height
@@ -1320,7 +1290,7 @@ class xe {
1320
1290
  return Math.random() * (i - t) + t;
1321
1291
  }
1322
1292
  }
1323
- const Se = {
1293
+ const Ee = {
1324
1294
  columns: "auto",
1325
1295
  rows: "auto",
1326
1296
  stagger: "none",
@@ -1330,7 +1300,7 @@ const Se = {
1330
1300
  alignment: "center",
1331
1301
  gap: 10,
1332
1302
  overflowOffset: 0.25
1333
- }, Tt = [
1303
+ }, At = [
1334
1304
  { x: 1, y: 1 },
1335
1305
  // bottom-right
1336
1306
  { x: -1, y: -1 },
@@ -1348,7 +1318,7 @@ const Se = {
1348
1318
  { x: 0, y: 1 }
1349
1319
  // down
1350
1320
  ];
1351
- class Ie {
1321
+ class we {
1352
1322
  constructor(t, i = {}) {
1353
1323
  this.config = t, this.imageConfig = i;
1354
1324
  }
@@ -1360,60 +1330,60 @@ class Ie {
1360
1330
  * @returns Array of layout objects with position, rotation, scale
1361
1331
  */
1362
1332
  generate(t, i, e = {}) {
1363
- const n = [], { width: s, height: r } = i, a = { ...Se, ...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(
1333
+ const o = [], { width: s, height: r } = i, a = { ...Ee, ...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(
1364
1334
  t,
1365
- b,
1366
- p,
1367
- l,
1335
+ w,
1336
+ v,
1337
+ d,
1368
1338
  a
1369
- ), 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, A = m * I + (m - 1) * a.gap + L, D = c + (b - N) / 2, W = c + (p - A) / 2, U = f * m, M = a.columns !== "auto" && a.rows !== "auto", R = M && t > U;
1339
+ ), 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 > _;
1370
1340
  typeof window < "u" && (window.__gridOverflowDebug = {
1371
1341
  gridConfigColumns: a.columns,
1372
1342
  gridConfigRows: a.rows,
1373
- columns: f,
1374
- rows: m,
1375
- cellCount: U,
1376
- hasFixedGrid: M,
1343
+ columns: l,
1344
+ rows: g,
1345
+ cellCount: _,
1346
+ hasFixedGrid: $,
1377
1347
  imageCount: t,
1378
- isOverflowMode: R
1348
+ isOverflowMode: A
1379
1349
  });
1380
- const k = R ? new Array(U).fill(0) : [], q = Math.min(w, I) * a.overflowOffset;
1381
- for (let T = 0; T < t; T++) {
1382
- let $, F, X = 0;
1383
- if (R && T >= U) {
1384
- const G = T - U, j = G % U;
1385
- 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));
1350
+ const j = A ? new Array(_).fill(0) : [], N = Math.min(x, E) * a.overflowOffset;
1351
+ for (let P = 0; P < t; P++) {
1352
+ let H, U, Y = 0;
1353
+ if (A && P >= _) {
1354
+ const q = P - _, G = q % _;
1355
+ 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));
1386
1356
  } else
1387
- a.fillDirection === "row" ? ($ = T % f, F = Math.floor(T / f)) : (F = T % m, $ = Math.floor(T / m));
1388
- let P = D + $ * (w + a.gap) + w / 2, B = W + F * (I + a.gap) + I / 2;
1389
- if (a.stagger === "row" && F % 2 === 1 ? P += w / 2 : a.stagger === "column" && $ % 2 === 1 && (B += I / 2), X > 0) {
1390
- const G = (X - 1) % Tt.length, j = Tt[G];
1391
- P += j.x * q, B += j.y * q;
1357
+ a.fillDirection === "row" ? (H = P % l, U = Math.floor(P / l)) : (U = P % g, H = Math.floor(P / g));
1358
+ let B = O + H * (x + a.gap) + x / 2, W = S + U * (E + a.gap) + E / 2;
1359
+ if (a.stagger === "row" && U % 2 === 1 ? B += x / 2 : a.stagger === "column" && H % 2 === 1 && (W += E / 2), Y > 0) {
1360
+ const q = (Y - 1) % At.length, G = At[q];
1361
+ B += G.x * N, W += G.y * N;
1392
1362
  }
1393
1363
  if (a.jitter > 0) {
1394
- const G = w / 2 * a.jitter, j = I / 2 * a.jitter;
1395
- P += this.random(-G, G), B += this.random(-j, j);
1364
+ const q = x / 2 * a.jitter, G = E / 2 * a.jitter;
1365
+ B += this.random(-q, q), W += this.random(-G, G);
1396
1366
  }
1397
- let Y = P, V = B;
1398
- if (!R && a.fillDirection === "row") {
1399
- const G = t % f || f;
1400
- if (F === Math.floor((t - 1) / f) && G < f) {
1401
- const St = G * w + (G - 1) * a.gap;
1367
+ let X = B, V = W;
1368
+ if (!A && a.fillDirection === "row") {
1369
+ const q = t % l || l;
1370
+ if (U === Math.floor((t - 1) / l) && q < l) {
1371
+ const It = q * x + (q - 1) * a.gap;
1402
1372
  let gt = 0;
1403
- a.alignment === "center" ? gt = (N - St) / 2 : a.alignment === "end" && (gt = N - St), Y += gt;
1373
+ a.alignment === "center" ? gt = (k - It) / 2 : a.alignment === "end" && (gt = k - It), X += gt;
1404
1374
  }
1405
1375
  }
1406
- 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;
1407
- Y = Math.max(ht, Math.min(Y, dt)), V = Math.max(_t, Math.min(V, Ut));
1376
+ const ct = p ? this.random(f, m) : 1, K = z * ct, ot = K * 1.5 / 2, nt = K / 2, ht = c + ot, dt = s - c - ot, _t = c + nt, Ut = r - c - nt;
1377
+ X = Math.max(ht, Math.min(X, dt)), V = Math.max(_t, Math.min(V, Ut));
1408
1378
  let ut = 0;
1409
1379
  if (u === "random") {
1410
- const G = this.imageConfig.rotation?.range?.min ?? -15, j = this.imageConfig.rotation?.range?.max ?? 15;
1411
- a.jitter > 0 ? ut = this.random(G * a.jitter, j * a.jitter) : ut = this.random(G, j);
1380
+ const q = this.imageConfig.rotation?.range?.min ?? -15, G = this.imageConfig.rotation?.range?.max ?? 15;
1381
+ a.jitter > 0 ? ut = this.random(q * a.jitter, G * a.jitter) : ut = this.random(q, G);
1412
1382
  }
1413
1383
  let ft;
1414
- R && X > 0 ? ft = 50 - X : ft = R ? 100 + T : T + 1, n.push({
1415
- id: T,
1416
- x: Y,
1384
+ A && Y > 0 ? ft = 50 - Y : ft = A ? 100 + P : P + 1, o.push({
1385
+ id: P,
1386
+ x: X,
1417
1387
  y: V,
1418
1388
  rotation: ut,
1419
1389
  scale: ct,
@@ -1421,12 +1391,12 @@ class Ie {
1421
1391
  zIndex: ft
1422
1392
  });
1423
1393
  }
1424
- return n;
1394
+ return o;
1425
1395
  }
1426
1396
  /**
1427
1397
  * Calculate optimal grid dimensions based on image count and container
1428
1398
  */
1429
- calculateGridDimensions(t, i, e, n, s) {
1399
+ calculateGridDimensions(t, i, e, o, s) {
1430
1400
  let r, a;
1431
1401
  if (s.columns !== "auto" && s.rows !== "auto")
1432
1402
  r = s.columns, a = s.rows;
@@ -1448,14 +1418,14 @@ class Ie {
1448
1418
  return Math.random() * (i - t) + t;
1449
1419
  }
1450
1420
  }
1451
- const Ce = Math.PI * (3 - Math.sqrt(5)), Ae = {
1421
+ const Ie = Math.PI * (3 - Math.sqrt(5)), Se = {
1452
1422
  spiralType: "golden",
1453
1423
  direction: "counterclockwise",
1454
1424
  tightness: 1,
1455
1425
  scaleDecay: 0,
1456
1426
  startAngle: 0
1457
1427
  };
1458
- class Re {
1428
+ class Ce {
1459
1429
  constructor(t, i = {}) {
1460
1430
  this.config = t, this.imageConfig = i;
1461
1431
  }
@@ -1467,80 +1437,80 @@ class Re {
1467
1437
  * @returns Array of layout objects with position, rotation, scale
1468
1438
  */
1469
1439
  generate(t, i, e = {}) {
1470
- const n = [], { width: s, height: r } = i, a = { ...Ae, ...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(
1471
- m - c - l / 2,
1472
- y - c - l / 2
1473
- ), v = a.direction === "clockwise" ? -1 : 1;
1474
- for (let S = 0; S < t; S++) {
1475
- let w, I;
1440
+ const o = [], { width: s, height: r } = i, a = { ...Se, ...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(
1441
+ g - c - d / 2,
1442
+ h - c - d / 2
1443
+ ), I = a.direction === "clockwise" ? -1 : 1;
1444
+ for (let y = 0; y < t; y++) {
1445
+ let x, E;
1476
1446
  if (a.spiralType === "golden")
1477
- w = S * Ce * v + a.startAngle, I = this.calculateGoldenRadius(S, t, E, a.tightness);
1447
+ x = y * Ie * I + a.startAngle, E = this.calculateGoldenRadius(y, t, b, a.tightness);
1478
1448
  else if (a.spiralType === "archimedean") {
1479
- const P = S * 0.5 * a.tightness;
1480
- w = P * v + a.startAngle, I = this.calculateArchimedeanRadius(P, t, E, a.tightness);
1449
+ const B = y * 0.5 * a.tightness;
1450
+ x = B * I + a.startAngle, E = this.calculateArchimedeanRadius(B, t, b, a.tightness);
1481
1451
  } else {
1482
- const P = S * 0.3 * a.tightness;
1483
- w = P * v + a.startAngle, I = this.calculateLogarithmicRadius(P, t, E, a.tightness);
1452
+ const B = y * 0.3 * a.tightness;
1453
+ x = B * I + a.startAngle, E = this.calculateLogarithmicRadius(B, t, b, a.tightness);
1484
1454
  }
1485
- 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, A = l * N, W = A * 1.5 / 2, U = A / 2, M = c + W, R = s - c - W, k = c + U, q = r - c - U, T = Math.max(M, Math.min(z, R)), $ = Math.max(k, Math.min(L, q));
1486
- let F = 0;
1455
+ 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));
1456
+ let U = 0;
1487
1457
  if (u === "random") {
1488
- const P = w * 180 / Math.PI % 360, B = this.random(h, d);
1489
- F = a.spiralType === "golden" ? B : P * 0.1 + B * 0.9;
1490
- } else u === "tangent" && (F = this.calculateSpiralTangent(w, I, a));
1491
- const X = t - S;
1492
- n.push({
1493
- id: S,
1494
- x: T,
1495
- y: $,
1496
- rotation: F,
1497
- scale: N,
1498
- baseSize: A,
1499
- zIndex: X
1458
+ const B = x * 180 / Math.PI % 360, W = this.random(f, m);
1459
+ U = a.spiralType === "golden" ? W : B * 0.1 + W * 0.9;
1460
+ } else u === "tangent" && (U = this.calculateSpiralTangent(x, E, a));
1461
+ const Y = t - y;
1462
+ o.push({
1463
+ id: y,
1464
+ x: P,
1465
+ y: H,
1466
+ rotation: U,
1467
+ scale: k,
1468
+ baseSize: D,
1469
+ zIndex: Y
1500
1470
  });
1501
1471
  }
1502
- return n;
1472
+ return o;
1503
1473
  }
1504
1474
  /**
1505
1475
  * Calculate tangent angle for spiral curve at given position
1506
1476
  * This aligns the image along the spiral's direction of travel
1507
1477
  */
1508
1478
  calculateSpiralTangent(t, i, e) {
1509
- let n;
1479
+ let o;
1510
1480
  if (e.spiralType === "golden")
1511
- n = t + Math.PI / 2;
1481
+ o = t + Math.PI / 2;
1512
1482
  else if (e.spiralType === "archimedean") {
1513
1483
  const r = 1 / e.tightness, a = Math.atan(i / r);
1514
- n = t + a;
1484
+ o = t + a;
1515
1485
  } else {
1516
1486
  const r = 0.15 / e.tightness, a = Math.atan(1 / r);
1517
- n = t + a;
1487
+ o = t + a;
1518
1488
  }
1519
- return n * 180 / Math.PI % 360 - 90;
1489
+ return o * 180 / Math.PI % 360 - 90;
1520
1490
  }
1521
1491
  /**
1522
1492
  * Calculate radius for golden spiral (Vogel's model)
1523
1493
  * Creates even distribution like sunflower seeds
1524
1494
  */
1525
- calculateGoldenRadius(t, i, e, n) {
1526
- const r = e / Math.sqrt(i) * Math.sqrt(t) / n;
1495
+ calculateGoldenRadius(t, i, e, o) {
1496
+ const r = e / Math.sqrt(i) * Math.sqrt(t) / o;
1527
1497
  return Math.min(r, e);
1528
1498
  }
1529
1499
  /**
1530
1500
  * Calculate radius for Archimedean spiral
1531
1501
  * r = a + b*θ (constant spacing between arms)
1532
1502
  */
1533
- calculateArchimedeanRadius(t, i, e, n) {
1534
- const s = i * 0.5 * n;
1503
+ calculateArchimedeanRadius(t, i, e, o) {
1504
+ const s = i * 0.5 * o;
1535
1505
  return t / s * e;
1536
1506
  }
1537
1507
  /**
1538
1508
  * Calculate radius for logarithmic (equiangular) spiral
1539
1509
  * r = a * e^(b*θ)
1540
1510
  */
1541
- calculateLogarithmicRadius(t, i, e, n) {
1542
- 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);
1543
- return a / l * e;
1511
+ calculateLogarithmicRadius(t, i, e, o) {
1512
+ const s = e * 0.05, r = 0.15 / o, a = s * Math.exp(r * t), c = i * 0.3 * o, d = s * Math.exp(r * c);
1513
+ return a / d * e;
1544
1514
  }
1545
1515
  /**
1546
1516
  * Utility: Generate random number between min and max
@@ -1549,7 +1519,7 @@ class Re {
1549
1519
  return Math.random() * (i - t) + t;
1550
1520
  }
1551
1521
  }
1552
- const Te = {
1522
+ const Re = {
1553
1523
  clusterCount: "auto",
1554
1524
  clusterSpread: 150,
1555
1525
  clusterSpacing: 200,
@@ -1557,7 +1527,7 @@ const Te = {
1557
1527
  overlap: 0.3,
1558
1528
  distribution: "gaussian"
1559
1529
  };
1560
- class Le {
1530
+ class Te {
1561
1531
  constructor(t, i = {}) {
1562
1532
  this.config = t, this.imageConfig = i;
1563
1533
  }
@@ -1569,85 +1539,85 @@ class Le {
1569
1539
  * @returns Array of layout objects with position, rotation, scale
1570
1540
  */
1571
1541
  generate(t, i, e = {}) {
1572
- const n = [], { width: s, height: r } = i, a = { ...Te, ...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(
1542
+ const o = [], { width: s, height: r } = i, a = { ...Re, ...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(
1573
1543
  t,
1574
1544
  a.clusterCount,
1575
1545
  s,
1576
1546
  r,
1577
1547
  a.clusterSpacing
1578
- ), m = this.generateClusterCenters(
1579
- f,
1548
+ ), g = this.generateClusterCenters(
1549
+ l,
1580
1550
  s,
1581
1551
  r,
1582
1552
  c,
1583
1553
  a
1584
- ), y = new Array(f).fill(0);
1585
- for (let v = 0; v < t; v++)
1586
- y[v % f]++;
1587
- let E = 0;
1588
- for (let v = 0; v < f; v++) {
1589
- const S = m[v], w = y[v];
1590
- for (let I = 0; I < w; I++) {
1591
- let z, L;
1554
+ ), h = new Array(l).fill(0);
1555
+ for (let I = 0; I < t; I++)
1556
+ h[I % l]++;
1557
+ let b = 0;
1558
+ for (let I = 0; I < l; I++) {
1559
+ const y = g[I], x = h[I];
1560
+ for (let E = 0; E < x; E++) {
1561
+ let F, R;
1592
1562
  if (a.distribution === "gaussian")
1593
- z = this.gaussianRandom() * S.spread, L = this.gaussianRandom() * S.spread;
1563
+ F = this.gaussianRandom() * y.spread, R = this.gaussianRandom() * y.spread;
1594
1564
  else {
1595
- const F = this.random(0, Math.PI * 2), X = this.random(0, S.spread);
1596
- z = Math.cos(F) * X, L = Math.sin(F) * X;
1565
+ const U = this.random(0, Math.PI * 2), Y = this.random(0, y.spread);
1566
+ F = Math.cos(U) * Y, R = Math.sin(U) * Y;
1597
1567
  }
1598
- const _ = 1 + a.overlap * 0.5, O = 1 + a.overlap * 0.3;
1599
- z /= _, L /= _;
1600
- const H = p ? this.random(g, b) : 1, N = O * H, A = l * N;
1601
- let D = S.x + z, W = S.y + L;
1602
- const M = A * 1.5 / 2, R = A / 2;
1603
- D = Math.max(c + M, Math.min(D, s - c - M)), W = Math.max(c + R, Math.min(W, r - c - R));
1604
- const k = u === "random" ? this.random(h, d) : 0, T = Math.sqrt(z * z + L * L) / S.spread, $ = Math.round((1 - T) * 50) + 1;
1605
- n.push({
1606
- id: E,
1607
- x: D,
1608
- y: W,
1609
- rotation: k,
1610
- scale: N,
1611
- baseSize: A,
1612
- zIndex: $
1613
- }), E++;
1568
+ const M = 1 + a.overlap * 0.5, T = 1 + a.overlap * 0.3;
1569
+ F /= M, R /= M;
1570
+ const z = v ? this.random(p, w) : 1, k = T * z, D = d * k;
1571
+ let O = y.x + F, S = y.y + R;
1572
+ const $ = D * 1.5 / 2, A = D / 2;
1573
+ O = Math.max(c + $, Math.min(O, s - c - $)), S = Math.max(c + A, Math.min(S, r - c - A));
1574
+ 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;
1575
+ o.push({
1576
+ id: b,
1577
+ x: O,
1578
+ y: S,
1579
+ rotation: j,
1580
+ scale: k,
1581
+ baseSize: D,
1582
+ zIndex: H
1583
+ }), b++;
1614
1584
  }
1615
1585
  }
1616
- return n;
1586
+ return o;
1617
1587
  }
1618
1588
  /**
1619
1589
  * Calculate optimal number of clusters based on image count and container
1620
1590
  */
1621
- calculateClusterCount(t, i, e, n, s) {
1591
+ calculateClusterCount(t, i, e, o, s) {
1622
1592
  if (i !== "auto")
1623
1593
  return Math.max(1, Math.min(i, t));
1624
1594
  const a = Math.max(1, Math.ceil(t / 8)), c = Math.floor(
1625
- e / s * (n / s) * 0.6
1595
+ e / s * (o / s) * 0.6
1626
1596
  );
1627
1597
  return Math.max(1, Math.min(a, c, 10));
1628
1598
  }
1629
1599
  /**
1630
1600
  * Generate cluster center positions with spacing constraints
1631
1601
  */
1632
- generateClusterCenters(t, i, e, n, s) {
1633
- const r = [], c = n + s.clusterSpread, l = i - n - s.clusterSpread, u = n + s.clusterSpread, h = e - n - s.clusterSpread;
1634
- for (let d = 0; d < t; d++) {
1635
- let g = null, b = -1;
1636
- for (let p = 0; p < 100; p++) {
1637
- const f = {
1638
- x: this.random(c, l),
1639
- y: this.random(u, h),
1602
+ generateClusterCenters(t, i, e, o, s) {
1603
+ const r = [], c = o + s.clusterSpread, d = i - o - s.clusterSpread, u = o + s.clusterSpread, f = e - o - s.clusterSpread;
1604
+ for (let m = 0; m < t; m++) {
1605
+ let p = null, w = -1;
1606
+ for (let v = 0; v < 100; v++) {
1607
+ const l = {
1608
+ x: this.random(c, d),
1609
+ y: this.random(u, f),
1640
1610
  spread: this.calculateClusterSpread(s)
1641
1611
  };
1642
- let m = 1 / 0;
1643
- for (const y of r) {
1644
- const E = f.x - y.x, v = f.y - y.y, S = Math.sqrt(E * E + v * v);
1645
- m = Math.min(m, S);
1612
+ let g = 1 / 0;
1613
+ for (const h of r) {
1614
+ const b = l.x - h.x, I = l.y - h.y, y = Math.sqrt(b * b + I * I);
1615
+ g = Math.min(g, y);
1646
1616
  }
1647
- if ((r.length === 0 || m > b) && (g = f, b = m), m >= s.clusterSpacing)
1617
+ if ((r.length === 0 || g > w) && (p = l, w = g), g >= s.clusterSpacing)
1648
1618
  break;
1649
1619
  }
1650
- g && r.push(g);
1620
+ p && r.push(p);
1651
1621
  }
1652
1622
  return r;
1653
1623
  }
@@ -1675,7 +1645,7 @@ class Le {
1675
1645
  return Math.random() * (i - t) + t;
1676
1646
  }
1677
1647
  }
1678
- class Me {
1648
+ class Ae {
1679
1649
  constructor(t, i = {}) {
1680
1650
  this.config = t, this.imageConfig = i;
1681
1651
  }
@@ -1687,32 +1657,32 @@ class Me {
1687
1657
  * @returns Array of layout objects with position, rotation, scale
1688
1658
  */
1689
1659
  generate(t, i, e = {}) {
1690
- 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 = {
1660
+ const o = [], { 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 = {
1691
1661
  ...Gt,
1692
1662
  ...this.config.wave
1693
- }, { 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, A = c + y + p / 2, D = r - c - y - p / 2, W = D - A, U = m > 1 ? W / (m - 1) : 0;
1694
- let M = 0;
1695
- for (let R = 0; R < m && M < t; R++) {
1696
- const k = m === 1 ? (A + D) / 2 : A + R * U;
1697
- let q = 0;
1698
- S === "offset" ? q = R * v : S === "alternating" && (q = R * Math.PI);
1699
- for (let T = 0; T < w && M < t; T++) {
1700
- 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;
1663
+ }, { 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;
1664
+ let $ = 0;
1665
+ for (let A = 0; A < g && $ < t; A++) {
1666
+ const j = g === 1 ? (D + O) / 2 : D + A * _;
1667
+ let N = 0;
1668
+ y === "offset" ? N = A * I : y === "alternating" && (N = A * Math.PI);
1669
+ for (let P = 0; P < x && $ < t; P++) {
1670
+ 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;
1701
1671
  let V = 0;
1702
- l === "tangent" ? V = this.calculateRotation($, s, y, E, q) : l === "random" && (V = this.random(u, h));
1703
- const K = Y * 1.5 / 2, lt = Y / 2, nt = c + K, ot = s - c - K, ht = c + lt, dt = r - c - lt;
1704
- n.push({
1705
- id: M,
1706
- x: Math.max(nt, Math.min(X, ot)),
1707
- y: Math.max(ht, Math.min(P, dt)),
1672
+ d === "tangent" ? V = this.calculateRotation(H, s, h, b, N) : d === "random" && (V = this.random(u, f));
1673
+ const K = X * 1.5 / 2, lt = X / 2, ot = c + K, nt = s - c - K, ht = c + lt, dt = r - c - lt;
1674
+ o.push({
1675
+ id: $,
1676
+ x: Math.max(ot, Math.min(Y, nt)),
1677
+ y: Math.max(ht, Math.min(B, dt)),
1708
1678
  rotation: V,
1709
- scale: B,
1710
- baseSize: Y,
1711
- zIndex: M + 1
1712
- }), M++;
1679
+ scale: W,
1680
+ baseSize: X,
1681
+ zIndex: $ + 1
1682
+ }), $++;
1713
1683
  }
1714
1684
  }
1715
- return n;
1685
+ return o;
1716
1686
  }
1717
1687
  /**
1718
1688
  * Calculate Y position displacement on wave curve
@@ -1723,9 +1693,9 @@ class Me {
1723
1693
  * @param phase - Phase offset
1724
1694
  * @returns Y displacement from baseline
1725
1695
  */
1726
- calculateWaveY(t, i, e, n, s) {
1696
+ calculateWaveY(t, i, e, o, s) {
1727
1697
  const r = t / i;
1728
- return e * Math.sin(n * r * 2 * Math.PI + s);
1698
+ return e * Math.sin(o * r * 2 * Math.PI + s);
1729
1699
  }
1730
1700
  /**
1731
1701
  * Calculate rotation based on wave tangent
@@ -1736,8 +1706,8 @@ class Me {
1736
1706
  * @param phase - Phase offset
1737
1707
  * @returns Rotation angle in degrees
1738
1708
  */
1739
- calculateRotation(t, i, e, n, s) {
1740
- const r = t / i, a = e * n * 2 * Math.PI * Math.cos(n * r * 2 * Math.PI + s) / i;
1709
+ calculateRotation(t, i, e, o, s) {
1710
+ const r = t / i, a = e * o * 2 * Math.PI * Math.cos(o * r * 2 * Math.PI + s) / i;
1741
1711
  return Math.atan(a) * (180 / Math.PI);
1742
1712
  }
1743
1713
  /**
@@ -1752,7 +1722,7 @@ class Me {
1752
1722
  return Math.random() * (i - t) + t;
1753
1723
  }
1754
1724
  }
1755
- const wt = 100, Q = 100 / Math.sqrt(3), xt = [
1725
+ const Et = 100, Q = 100 / Math.sqrt(3), wt = [
1756
1726
  [Q / 2, 0],
1757
1727
  // upper-left
1758
1728
  [3 * Q / 2, 0],
@@ -1765,21 +1735,21 @@ const wt = 100, Q = 100 / Math.sqrt(3), xt = [
1765
1735
  // lower-left
1766
1736
  [0, 50]
1767
1737
  // left
1768
- ], Fe = xt[1][0] / wt, ze = xt[2][1] / wt;
1769
- function Oe(o) {
1738
+ ], Le = wt[1][0] / Et, Fe = wt[2][1] / Et;
1739
+ function Me(n) {
1770
1740
  return {
1771
- colStep: Fe * o,
1772
- rowOffset: ze * o
1741
+ colStep: Le * n,
1742
+ rowOffset: Fe * n
1773
1743
  };
1774
1744
  }
1775
- function De(o, t, i, e, n, s) {
1776
- const { colStep: r } = Oe(s);
1745
+ function Oe(n, t, i, e, o, s) {
1746
+ const { colStep: r } = Me(s);
1777
1747
  return {
1778
- px: e + r * o,
1779
- py: n + s * (t + o / 2)
1748
+ px: e + r * n,
1749
+ py: o + s * (t + n / 2)
1780
1750
  };
1781
1751
  }
1782
- const $e = [
1752
+ const ze = [
1783
1753
  [1, 0, -1],
1784
1754
  [0, 1, -1],
1785
1755
  [-1, 1, 0],
@@ -1787,49 +1757,49 @@ const $e = [
1787
1757
  [0, -1, 1],
1788
1758
  [1, -1, 0]
1789
1759
  ];
1790
- function Pe(o) {
1791
- if (o === 0) return [[0, 0, 0]];
1760
+ function De(n) {
1761
+ if (n === 0) return [[0, 0, 0]];
1792
1762
  const t = [];
1793
- let [i, e, n] = [0, -o, o];
1794
- for (const [s, r, a] of $e)
1795
- for (let c = 0; c < o; c++)
1796
- t.push([i, e, n]), i += s, e += r, n += a;
1763
+ let [i, e, o] = [0, -n, n];
1764
+ for (const [s, r, a] of ze)
1765
+ for (let c = 0; c < n; c++)
1766
+ t.push([i, e, o]), i += s, e += r, o += a;
1797
1767
  return t;
1798
1768
  }
1799
- class _e {
1769
+ class $e {
1800
1770
  // imageConfig intentionally not stored — honeycomb forces uniform sizing (rotation/variance
1801
1771
  // would break hex tiling). Kept as parameter for interface compatibility.
1802
1772
  constructor(t, i = {}) {
1803
1773
  this.config = t;
1804
1774
  }
1805
1775
  generate(t, i, e = {}) {
1806
- const n = [], { width: s, height: r } = i, a = s / 2, c = r / 2, l = e.fixedHeight ?? 200, h = {
1776
+ const o = [], { width: s, height: r } = i, a = s / 2, c = r / 2, d = e.fixedHeight ?? 200, f = {
1807
1777
  ...qt,
1808
1778
  ...this.config.honeycomb
1809
- }.spacing ?? 0, d = l + h;
1810
- let g = 0, b = 0;
1811
- for (; g < t; ) {
1812
- const p = Pe(b);
1813
- for (const [f, m, y] of p) {
1814
- if (g >= t) break;
1815
- const { px: E, py: v } = De(f, m, y, a, c, d);
1816
- n.push({
1817
- id: g,
1818
- x: E,
1819
- y: v,
1779
+ }.spacing ?? 0, m = d + f;
1780
+ let p = 0, w = 0;
1781
+ for (; p < t; ) {
1782
+ const v = De(w);
1783
+ for (const [l, g, h] of v) {
1784
+ if (p >= t) break;
1785
+ const { px: b, py: I } = Oe(l, g, h, a, c, m);
1786
+ o.push({
1787
+ id: p,
1788
+ x: b,
1789
+ y: I,
1820
1790
  rotation: 0,
1821
1791
  scale: 1,
1822
- baseSize: l,
1792
+ baseSize: d,
1823
1793
  // Inner rings render above outer rings
1824
- zIndex: Math.max(1, 100 - b)
1825
- }), g++;
1794
+ zIndex: Math.max(1, 100 - w)
1795
+ }), p++;
1826
1796
  }
1827
- b++;
1797
+ w++;
1828
1798
  }
1829
- return n;
1799
+ return o;
1830
1800
  }
1831
1801
  }
1832
- class Ue {
1802
+ class Pe {
1833
1803
  constructor(t) {
1834
1804
  this.config = t.layout, this.imageConfig = t.image, this.layouts = /* @__PURE__ */ new Map(), this.placementLayout = this.initLayout();
1835
1805
  }
@@ -1842,17 +1812,17 @@ class Ue {
1842
1812
  case "radial":
1843
1813
  return new xe(this.config, this.imageConfig);
1844
1814
  case "grid":
1845
- return new Ie(this.config, this.imageConfig);
1815
+ return new we(this.config, this.imageConfig);
1846
1816
  case "spiral":
1847
- return new Re(this.config, this.imageConfig);
1817
+ return new Ce(this.config, this.imageConfig);
1848
1818
  case "cluster":
1849
- return new Le(this.config, this.imageConfig);
1819
+ return new Te(this.config, this.imageConfig);
1850
1820
  case "wave":
1851
- return new Me(this.config, this.imageConfig);
1821
+ return new Ae(this.config, this.imageConfig);
1852
1822
  case "honeycomb":
1853
- return new _e(this.config, this.imageConfig);
1823
+ return new $e(this.config, this.imageConfig);
1854
1824
  default:
1855
- return new we(this.config, this.imageConfig);
1825
+ return new ve(this.config, this.imageConfig);
1856
1826
  }
1857
1827
  }
1858
1828
  /**
@@ -1863,10 +1833,10 @@ class Ue {
1863
1833
  * @returns Array of layout objects with position, rotation, scale
1864
1834
  */
1865
1835
  generateLayout(t, i, e = {}) {
1866
- const n = this.placementLayout.generate(t, i, e);
1867
- return n.forEach((s) => {
1836
+ const o = this.placementLayout.generate(t, i, e);
1837
+ return o.forEach((s) => {
1868
1838
  this.layouts.set(s.id, s);
1869
- }), n;
1839
+ }), o;
1870
1840
  }
1871
1841
  /**
1872
1842
  * Get the original layout state for an image
@@ -1919,8 +1889,8 @@ class Ue {
1919
1889
  return;
1920
1890
  if (typeof e == "number")
1921
1891
  return e;
1922
- const n = e, s = this.resolveBreakpoint(t);
1923
- return s === "mobile" ? n.mobile ?? n.tablet ?? n.screen : s === "tablet" ? n.tablet ?? n.screen ?? n.mobile : n.screen ?? n.tablet ?? n.mobile;
1892
+ const o = e, s = this.resolveBreakpoint(t);
1893
+ return s === "mobile" ? o.mobile ?? o.tablet ?? o.screen : s === "tablet" ? o.tablet ?? o.screen ?? o.mobile : o.screen ?? o.tablet ?? o.mobile;
1924
1894
  }
1925
1895
  /**
1926
1896
  * Calculate adaptive image size based on container dimensions and image count
@@ -1930,19 +1900,19 @@ class Ue {
1930
1900
  * @param viewportWidth - Current viewport width for baseHeight resolution
1931
1901
  * @returns Calculated sizing result with height
1932
1902
  */
1933
- calculateAdaptiveSize(t, i, e, n) {
1934
- const s = this.imageConfig.sizing, r = this.resolveBaseHeight(n);
1903
+ calculateAdaptiveSize(t, i, e, o) {
1904
+ const s = this.imageConfig.sizing, r = this.resolveBaseHeight(o);
1935
1905
  if (r !== void 0)
1936
1906
  return { height: r };
1937
- 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;
1938
- let m = Math.sqrt(p / 1.4);
1939
- m *= u, m = Math.min(m, e);
1940
- let y = this.clamp(m, a, c);
1941
- if (y === a && m < a) {
1942
- const E = Math.max(a * 0.05, 20);
1943
- y = Math.max(E, m);
1907
+ 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;
1908
+ let g = Math.sqrt(v / 1.4);
1909
+ g *= u, g = Math.min(g, e);
1910
+ let h = this.clamp(g, a, c);
1911
+ if (h === a && g < a) {
1912
+ const b = Math.max(a * 0.05, 20);
1913
+ h = Math.max(b, g);
1944
1914
  }
1945
- return this.config.algorithm === "honeycomb" && (y = Math.min(y, this.honeycombMaxImageHeight(i, t))), { height: y };
1915
+ return this.config.algorithm === "honeycomb" && (h = Math.min(h, this.honeycombMaxImageHeight(i, t))), { height: h };
1946
1916
  }
1947
1917
  /**
1948
1918
  * Returns the largest image height at which all honeycomb rings fit within the container.
@@ -1951,11 +1921,11 @@ class Ue {
1951
1921
  */
1952
1922
  honeycombMaxImageHeight(t, i) {
1953
1923
  if (t <= 1) return 1 / 0;
1954
- let e = 0, n = 1;
1955
- for (; n < t; )
1956
- e++, n += 6 * e;
1957
- 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);
1958
- return Math.max(10, Math.min(h, d));
1924
+ let e = 0, o = 1;
1925
+ for (; o < t; )
1926
+ e++, o += 6 * e;
1927
+ 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);
1928
+ return Math.max(10, Math.min(f, m));
1959
1929
  }
1960
1930
  /**
1961
1931
  * Utility: Clamp a value between min and max
@@ -1964,7 +1934,7 @@ class Ue {
1964
1934
  return Math.max(i, Math.min(e, t));
1965
1935
  }
1966
1936
  }
1967
- var x = /* @__PURE__ */ ((o) => (o.IDLE = "idle", o.FOCUSING = "focusing", o.FOCUSED = "focused", o.UNFOCUSING = "unfocusing", o.CROSS_ANIMATING = "cross_animating", o))(x || {});
1937
+ var C = /* @__PURE__ */ ((n) => (n.IDLE = "idle", n.FOCUSING = "focusing", n.FOCUSED = "focused", n.UNFOCUSING = "unfocusing", n.CROSS_ANIMATING = "cross_animating", n))(C || {});
1968
1938
  const Lt = {
1969
1939
  // Geometric shapes - uses percentages for responsive sizing
1970
1940
  circle: "circle(50%)",
@@ -1974,7 +1944,7 @@ const Lt = {
1974
1944
  hexagon: "polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)",
1975
1945
  octagon: "polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%)",
1976
1946
  diamond: "polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)"
1977
- }, He = {
1947
+ }, _e = {
1978
1948
  // Circle - uses radius in pixels (refHeight of 100px = 50px radius)
1979
1949
  circle: {
1980
1950
  refHeight: 100,
@@ -1998,8 +1968,8 @@ const Lt = {
1998
1968
  },
1999
1969
  // Hexagon - regular hexagon (reference points imported from hexagonGeometry)
2000
1970
  hexagon: {
2001
- refHeight: wt,
2002
- points: xt
1971
+ refHeight: Et,
1972
+ points: wt
2003
1973
  },
2004
1974
  // Octagon - regular octagon
2005
1975
  octagon: {
@@ -2012,105 +1982,105 @@ const Lt = {
2012
1982
  points: [[50, 0], [100, 50], [50, 100], [0, 50]]
2013
1983
  }
2014
1984
  };
2015
- function Ne(o) {
2016
- if (o)
2017
- return o in Lt ? Lt[o] : o;
1985
+ function Ue(n) {
1986
+ if (n)
1987
+ return n in Lt ? Lt[n] : n;
2018
1988
  }
2019
- function ke(o, t, i) {
2020
- const e = He[o];
1989
+ function ke(n, t, i) {
1990
+ const e = _e[n];
2021
1991
  if (!e) return "";
2022
- const n = t / e.refHeight;
2023
- if (o === "circle")
2024
- return `circle(${Math.round(50 * n * 100) / 100}px)`;
2025
- 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;
2026
- return `polygon(${e.points.map(([p, f]) => {
2027
- const m = Math.round((p * n + d) * 100) / 100, y = Math.round((f * n + g) * 100) / 100;
2028
- return `${m}px ${y}px`;
1992
+ const o = t / e.refHeight;
1993
+ if (n === "circle")
1994
+ return `circle(${Math.round(50 * o * 100) / 100}px)`;
1995
+ const s = e.points.map(([v]) => v), r = e.points.map(([, v]) => v), a = (Math.min(...s) + Math.max(...s)) / 2 * o, c = (Math.min(...r) + Math.max(...r)) / 2 * o, d = (Math.max(...s) - Math.min(...s)) * o, u = (i ?? d) / 2, f = t / 2, m = u - a, p = f - c;
1996
+ return `polygon(${e.points.map(([v, l]) => {
1997
+ const g = Math.round((v * o + m) * 100) / 100, h = Math.round((l * o + p) * 100) / 100;
1998
+ return `${g}px ${h}px`;
2029
1999
  }).join(", ")})`;
2030
2000
  }
2031
- function Be(o) {
2032
- return o in mt;
2001
+ function He(n) {
2002
+ return n in mt;
2033
2003
  }
2034
- function je(o) {
2035
- return o ? Be(o) ? mt[o] : o : mt.md;
2004
+ function Ne(n) {
2005
+ return n ? He(n) ? mt[n] : n : mt.md;
2036
2006
  }
2037
- function We(o) {
2038
- if (!o) return "";
2007
+ function Be(n) {
2008
+ if (!n) return "";
2039
2009
  const t = [];
2040
- 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)
2041
- if (typeof o.dropShadow == "string")
2042
- t.push(`drop-shadow(${o.dropShadow})`);
2010
+ if (n.grayscale !== void 0 && t.push(`grayscale(${n.grayscale})`), n.blur !== void 0 && t.push(`blur(${n.blur}px)`), n.brightness !== void 0 && t.push(`brightness(${n.brightness})`), n.contrast !== void 0 && t.push(`contrast(${n.contrast})`), n.saturate !== void 0 && t.push(`saturate(${n.saturate})`), n.opacity !== void 0 && t.push(`opacity(${n.opacity})`), n.sepia !== void 0 && t.push(`sepia(${n.sepia})`), n.hueRotate !== void 0 && t.push(`hue-rotate(${n.hueRotate}deg)`), n.invert !== void 0 && t.push(`invert(${n.invert})`), n.dropShadow !== void 0)
2011
+ if (typeof n.dropShadow == "string")
2012
+ t.push(`drop-shadow(${n.dropShadow})`);
2043
2013
  else {
2044
- const i = o.dropShadow;
2014
+ const i = n.dropShadow;
2045
2015
  t.push(`drop-shadow(${i.x}px ${i.y}px ${i.blur}px ${i.color})`);
2046
2016
  }
2047
2017
  return t.join(" ");
2048
2018
  }
2049
- function tt(o) {
2050
- if (!o || o.style === "none" || o.width === 0)
2019
+ function tt(n) {
2020
+ if (!n || n.style === "none" || n.width === 0)
2051
2021
  return "none";
2052
- const t = o.width ?? 0, i = o.style ?? "solid", e = o.color ?? "#000000";
2022
+ const t = n.width ?? 0, i = n.style ?? "solid", e = n.color ?? "#000000";
2053
2023
  return `${t}px ${i} ${e}`;
2054
2024
  }
2055
- function it(o, t, i) {
2056
- if (!o) return {};
2025
+ function it(n, t, i) {
2026
+ if (!n) return {};
2057
2027
  const e = {};
2058
- if (o.borderRadiusTopLeft !== void 0 || o.borderRadiusTopRight !== void 0 || o.borderRadiusBottomRight !== void 0 || o.borderRadiusBottomLeft !== void 0) {
2059
- const a = o.border?.radius ?? 0;
2060
- 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`);
2061
- } else o.border?.radius !== void 0 && (e.borderRadius = `${o.border.radius}px`);
2062
- if (o.borderTop || o.borderRight || o.borderBottom || o.borderLeft) {
2063
- const a = o.border || {}, c = { ...a, ...o.borderTop }, l = { ...a, ...o.borderRight }, u = { ...a, ...o.borderBottom }, h = { ...a, ...o.borderLeft };
2064
- e.borderTop = tt(c), e.borderRight = tt(l), e.borderBottom = tt(u), e.borderLeft = tt(h);
2065
- } else o.border && (e.border = tt(o.border));
2066
- o.shadow !== void 0 && (e.boxShadow = je(o.shadow));
2067
- const r = We(o.filter);
2068
- 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) {
2069
- const a = o.outline.width ?? 0, c = o.outline.style ?? "solid", l = o.outline.color ?? "#000000";
2070
- e.outline = `${a}px ${c} ${l}`, o.outline.offset !== void 0 && (e.outlineOffset = `${o.outline.offset}px`);
2071
- }
2072
- if (o.objectFit !== void 0 && (e.objectFit = o.objectFit), o.aspectRatio !== void 0 && (e.aspectRatio = o.aspectRatio), o.clipPath !== void 0) {
2028
+ if (n.borderRadiusTopLeft !== void 0 || n.borderRadiusTopRight !== void 0 || n.borderRadiusBottomRight !== void 0 || n.borderRadiusBottomLeft !== void 0) {
2029
+ const a = n.border?.radius ?? 0;
2030
+ n.borderRadiusTopLeft !== void 0 ? e.borderTopLeftRadius = `${n.borderRadiusTopLeft}px` : a && (e.borderTopLeftRadius = `${a}px`), n.borderRadiusTopRight !== void 0 ? e.borderTopRightRadius = `${n.borderRadiusTopRight}px` : a && (e.borderTopRightRadius = `${a}px`), n.borderRadiusBottomRight !== void 0 ? e.borderBottomRightRadius = `${n.borderRadiusBottomRight}px` : a && (e.borderBottomRightRadius = `${a}px`), n.borderRadiusBottomLeft !== void 0 ? e.borderBottomLeftRadius = `${n.borderRadiusBottomLeft}px` : a && (e.borderBottomLeftRadius = `${a}px`);
2031
+ } else n.border?.radius !== void 0 && (e.borderRadius = `${n.border.radius}px`);
2032
+ if (n.borderTop || n.borderRight || n.borderBottom || n.borderLeft) {
2033
+ const a = n.border || {}, c = { ...a, ...n.borderTop }, d = { ...a, ...n.borderRight }, u = { ...a, ...n.borderBottom }, f = { ...a, ...n.borderLeft };
2034
+ e.borderTop = tt(c), e.borderRight = tt(d), e.borderBottom = tt(u), e.borderLeft = tt(f);
2035
+ } else n.border && (e.border = tt(n.border));
2036
+ n.shadow !== void 0 && (e.boxShadow = Ne(n.shadow));
2037
+ const r = Be(n.filter);
2038
+ if (e.filter = r || "none", n.opacity !== void 0 && (e.opacity = String(n.opacity)), n.cursor !== void 0 && (e.cursor = n.cursor), n.outline && n.outline.style !== "none" && (n.outline.width ?? 0) > 0) {
2039
+ const a = n.outline.width ?? 0, c = n.outline.style ?? "solid", d = n.outline.color ?? "#000000";
2040
+ e.outline = `${a}px ${c} ${d}`, n.outline.offset !== void 0 && (e.outlineOffset = `${n.outline.offset}px`);
2041
+ }
2042
+ if (n.objectFit !== void 0 && (e.objectFit = n.objectFit), n.aspectRatio !== void 0 && (e.aspectRatio = n.aspectRatio), n.clipPath !== void 0) {
2073
2043
  let a;
2074
- const c = typeof o.clipPath == "object" && o.clipPath !== null && "shape" in o.clipPath, l = c ? o.clipPath : void 0;
2075
- if (l?.mode === "height-relative" && t)
2076
- a = ke(l.shape, t, i);
2044
+ const c = typeof n.clipPath == "object" && n.clipPath !== null && "shape" in n.clipPath, d = c ? n.clipPath : void 0;
2045
+ if (d?.mode === "height-relative" && t)
2046
+ a = ke(d.shape, t, i);
2077
2047
  else {
2078
- const u = c && l ? l.shape : o.clipPath;
2079
- a = Ne(u);
2048
+ const u = c && d ? d.shape : n.clipPath;
2049
+ a = Ue(u);
2080
2050
  }
2081
2051
  a && (a === "none" ? e.clipPath = "unset" : (e.clipPath = a, e.overflow = "hidden"));
2082
2052
  }
2083
2053
  return e;
2084
2054
  }
2085
- function Ge(o, t) {
2086
- 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);
2055
+ function je(n, t) {
2056
+ t.borderRadius !== void 0 && (n.style.borderRadius = t.borderRadius), t.borderTopLeftRadius !== void 0 && (n.style.borderTopLeftRadius = t.borderTopLeftRadius), t.borderTopRightRadius !== void 0 && (n.style.borderTopRightRadius = t.borderTopRightRadius), t.borderBottomRightRadius !== void 0 && (n.style.borderBottomRightRadius = t.borderBottomRightRadius), t.borderBottomLeftRadius !== void 0 && (n.style.borderBottomLeftRadius = t.borderBottomLeftRadius), t.border !== void 0 && (n.style.border = t.border), t.borderTop !== void 0 && (n.style.borderTop = t.borderTop), t.borderRight !== void 0 && (n.style.borderRight = t.borderRight), t.borderBottom !== void 0 && (n.style.borderBottom = t.borderBottom), t.borderLeft !== void 0 && (n.style.borderLeft = t.borderLeft), t.boxShadow !== void 0 && (n.style.boxShadow = t.boxShadow), t.filter !== void 0 && (n.style.filter = t.filter), t.opacity !== void 0 && (n.style.opacity = t.opacity), t.cursor !== void 0 && (n.style.cursor = t.cursor), t.outline !== void 0 && (n.style.outline = t.outline), t.outlineOffset !== void 0 && (n.style.outlineOffset = t.outlineOffset), t.objectFit !== void 0 && (n.style.objectFit = t.objectFit), t.aspectRatio !== void 0 && (n.style.aspectRatio = t.aspectRatio), t.clipPath !== void 0 && (n.style.clipPath = t.clipPath), t.overflow !== void 0 && (n.style.overflow = t.overflow);
2087
2057
  }
2088
- function st(o, t, i, e) {
2089
- const n = it(t, i, e);
2090
- Ge(o, n);
2058
+ function st(n, t, i, e) {
2059
+ const o = it(t, i, e);
2060
+ je(n, o);
2091
2061
  }
2092
- function Pt(o) {
2093
- return o ? Array.isArray(o) ? o.join(" ") : o : "";
2062
+ function Pt(n) {
2063
+ return n ? Array.isArray(n) ? n.join(" ") : n : "";
2094
2064
  }
2095
- function et(o, t) {
2065
+ function et(n, t) {
2096
2066
  const i = Pt(t);
2097
2067
  i && i.split(" ").forEach((e) => {
2098
- e.trim() && o.classList.add(e.trim());
2068
+ e.trim() && n.classList.add(e.trim());
2099
2069
  });
2100
2070
  }
2101
- function pt(o, t) {
2071
+ function pt(n, t) {
2102
2072
  const i = Pt(t);
2103
2073
  i && i.split(" ").forEach((e) => {
2104
- e.trim() && o.classList.remove(e.trim());
2074
+ e.trim() && n.classList.remove(e.trim());
2105
2075
  });
2106
2076
  }
2107
- const Mt = {
2077
+ const Ft = {
2108
2078
  UNFOCUSING: 999,
2109
2079
  FOCUSING: 1e3
2110
2080
  };
2111
- class qe {
2081
+ class We {
2112
2082
  constructor(t, i, e) {
2113
- 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;
2083
+ 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;
2114
2084
  }
2115
2085
  /**
2116
2086
  * Set callback to be fired when an unfocus animation fully completes.
@@ -2128,7 +2098,7 @@ class qe {
2128
2098
  * Check if any animation is in progress
2129
2099
  */
2130
2100
  isAnimating() {
2131
- return this.state !== x.IDLE && this.state !== x.FOCUSED;
2101
+ return this.state !== C.IDLE && this.state !== C.FOCUSED;
2132
2102
  }
2133
2103
  /**
2134
2104
  * Normalize scalePercent value
@@ -2141,17 +2111,17 @@ class qe {
2141
2111
  * Returns actual pixel dimensions instead of scale factor for sharper rendering
2142
2112
  */
2143
2113
  calculateFocusDimensions(t, i, e) {
2144
- const n = this.normalizeScalePercent(this.config.scalePercent), s = e.height * n, r = t / i;
2114
+ const o = this.normalizeScalePercent(this.config.scalePercent), s = e.height * o, r = t / i;
2145
2115
  let a = s, c = a * r;
2146
- const l = e.width * n;
2147
- return c > l && (c = l, a = c / r), { width: c, height: a };
2116
+ const d = e.width * o;
2117
+ return c > d && (c = d, a = c / r), { width: c, height: a };
2148
2118
  }
2149
2119
  /**
2150
2120
  * Calculate the transform needed to center an image (position only, no scale)
2151
2121
  * Scale is handled by animating actual dimensions for sharper rendering
2152
2122
  */
2153
2123
  calculateFocusTransform(t, i) {
2154
- const e = t.width / 2, n = t.height / 2, s = e - i.x, r = n - i.y;
2124
+ const e = t.width / 2, o = t.height / 2, s = e - i.x, r = o - i.y;
2155
2125
  return {
2156
2126
  x: s,
2157
2127
  y: r,
@@ -2166,8 +2136,8 @@ class qe {
2166
2136
  buildDimensionZoomTransform(t) {
2167
2137
  const i = ["translate(-50%, -50%)"];
2168
2138
  if (t.x !== void 0 || t.y !== void 0) {
2169
- const e = t.x ?? 0, n = t.y ?? 0;
2170
- i.push(`translate(${e}px, ${n}px)`);
2139
+ const e = t.x ?? 0, o = t.y ?? 0;
2140
+ i.push(`translate(${e}px, ${o}px)`);
2171
2141
  }
2172
2142
  return t.rotation !== void 0 && i.push(`rotate(${t.rotation}deg)`), i.join(" ");
2173
2143
  }
@@ -2175,13 +2145,13 @@ class qe {
2175
2145
  * Create a Web Animation that animates both transform (position) and dimensions
2176
2146
  * This provides sharper zoom by re-rendering at target size instead of scaling pixels
2177
2147
  */
2178
- animateWithDimensions(t, i, e, n, s, r, a, c) {
2179
- const l = this.buildDimensionZoomTransform(i), u = this.buildDimensionZoomTransform(e);
2148
+ animateWithDimensions(t, i, e, o, s, r, a, c) {
2149
+ const d = this.buildDimensionZoomTransform(i), u = this.buildDimensionZoomTransform(e);
2180
2150
  return t.style.transition = "none", t.animate(
2181
2151
  [
2182
2152
  {
2183
- transform: l,
2184
- width: `${n}px`,
2153
+ transform: d,
2154
+ width: `${o}px`,
2185
2155
  height: `${s}px`
2186
2156
  },
2187
2157
  {
@@ -2222,10 +2192,10 @@ class qe {
2222
2192
  * This ensures clip-path changes smoothly as width/height animate
2223
2193
  */
2224
2194
  startClipPathAnimation(t, i, e) {
2225
- let n = e ? this.styling?.focused ?? this.styling?.default : this.styling?.default;
2226
- e && this.styling?.focused && this.styling.focused.clipPath === void 0 && (n = { ...n, clipPath: void 0 });
2195
+ let o = e ? this.styling?.focused ?? this.styling?.default : this.styling?.default;
2196
+ e && this.styling?.focused && this.styling.focused.clipPath === void 0 && (o = { ...o, clipPath: void 0 });
2227
2197
  const s = () => {
2228
- const r = t.offsetHeight, a = t.offsetWidth, c = it(n, r, a);
2198
+ const r = t.offsetHeight, a = t.offsetWidth, c = it(o, r, a);
2229
2199
  c.clipPath !== void 0 ? t.style.clipPath = c.clipPath : t.style.clipPath = "unset", c.overflow !== void 0 && (t.style.overflow = c.overflow), i.animation.playState === "running" && requestAnimationFrame(s);
2230
2200
  };
2231
2201
  requestAnimationFrame(s);
@@ -2236,34 +2206,34 @@ class qe {
2236
2206
  * @param fromTransform - Optional starting transform (for mid-animation reversals)
2237
2207
  * @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
2238
2208
  */
2239
- startFocusAnimation(t, i, e, n, s) {
2240
- const r = t.style.zIndex || "", a = t.offsetWidth, c = t.offsetHeight, l = this.calculateFocusDimensions(a, c, i), u = this.calculateFocusTransform(i, e);
2209
+ startFocusAnimation(t, i, e, o, s) {
2210
+ const r = t.style.zIndex || "", a = t.offsetWidth, c = t.offsetHeight, d = this.calculateFocusDimensions(a, c, i), u = this.calculateFocusTransform(i, e);
2241
2211
  this.animationEngine.cancelAllAnimations(t);
2242
- const h = this.config.animationDuration ?? 600;
2243
- this.applyFocusedStyling(t, Mt.FOCUSING);
2244
- const d = n ?? {
2212
+ const f = this.config.animationDuration ?? 600;
2213
+ this.applyFocusedStyling(t, Ft.FOCUSING);
2214
+ const m = o ?? {
2245
2215
  x: 0,
2246
2216
  y: 0,
2247
2217
  rotation: e.rotation,
2248
2218
  scale: 1
2249
2219
  // No scale - using dimensions
2250
- }, g = s?.width ?? a, b = s?.height ?? c, p = this.animateWithDimensions(
2220
+ }, p = s?.width ?? a, w = s?.height ?? c, v = this.animateWithDimensions(
2251
2221
  t,
2252
- d,
2222
+ m,
2253
2223
  u,
2254
- g,
2255
- b,
2256
- l.width,
2257
- l.height,
2258
- h
2259
- ), f = {
2224
+ p,
2225
+ w,
2226
+ d.width,
2227
+ d.height,
2228
+ f
2229
+ ), l = {
2260
2230
  id: `focus-${Date.now()}`,
2261
2231
  element: t,
2262
- animation: p,
2263
- fromState: d,
2232
+ animation: v,
2233
+ fromState: m,
2264
2234
  toState: u,
2265
2235
  startTime: performance.now(),
2266
- duration: h
2236
+ duration: f
2267
2237
  };
2268
2238
  return this.focusData = {
2269
2239
  element: t,
@@ -2272,12 +2242,12 @@ class qe {
2272
2242
  originalZIndex: r,
2273
2243
  originalWidth: a,
2274
2244
  originalHeight: c,
2275
- focusWidth: l.width,
2276
- focusHeight: l.height
2277
- }, this.startClipPathAnimation(t, f, !0), {
2245
+ focusWidth: d.width,
2246
+ focusHeight: d.height
2247
+ }, this.startClipPathAnimation(t, l, !0), {
2278
2248
  element: t,
2279
2249
  originalState: e,
2280
- animationHandle: f,
2250
+ animationHandle: l,
2281
2251
  direction: "in",
2282
2252
  originalWidth: a,
2283
2253
  originalHeight: c
@@ -2288,41 +2258,41 @@ class qe {
2288
2258
  * Animates back to original dimensions for consistent behavior
2289
2259
  * @param fromDimensions - Optional starting dimensions (for mid-animation reversals)
2290
2260
  */
2291
- startUnfocusAnimation(t, i, e, n) {
2292
- t.style.zIndex = String(Mt.UNFOCUSING), this.animationEngine.cancelAllAnimations(t);
2261
+ startUnfocusAnimation(t, i, e, o) {
2262
+ t.style.zIndex = String(Ft.UNFOCUSING), this.animationEngine.cancelAllAnimations(t);
2293
2263
  const s = this.config.animationDuration ?? 600;
2294
2264
  t.classList.remove("fbn-ic-focused"), pt(t, this.focusedClassName);
2295
- 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 = {
2265
+ const r = e ?? this.focusData?.focusTransform ?? { x: 0, y: 0, rotation: 0, scale: 1 }, a = o?.width ?? this.focusData?.focusWidth ?? t.offsetWidth, c = o?.height ?? this.focusData?.focusHeight ?? t.offsetHeight, d = {
2296
2266
  x: 0,
2297
2267
  y: 0,
2298
2268
  rotation: i.rotation,
2299
2269
  scale: 1
2300
2270
  // No scale - using dimensions
2301
- }, u = this.focusData?.originalWidth ?? t.offsetWidth, h = this.focusData?.originalHeight ?? t.offsetHeight, d = this.animateWithDimensions(
2271
+ }, u = this.focusData?.originalWidth ?? t.offsetWidth, f = this.focusData?.originalHeight ?? t.offsetHeight, m = this.animateWithDimensions(
2302
2272
  t,
2303
2273
  r,
2304
- l,
2274
+ d,
2305
2275
  a,
2306
2276
  c,
2307
2277
  u,
2308
- h,
2278
+ f,
2309
2279
  s
2310
- ), g = {
2280
+ ), p = {
2311
2281
  id: `unfocus-${Date.now()}`,
2312
2282
  element: t,
2313
- animation: d,
2283
+ animation: m,
2314
2284
  fromState: r,
2315
- toState: l,
2285
+ toState: d,
2316
2286
  startTime: performance.now(),
2317
2287
  duration: s
2318
2288
  };
2319
- return this.startClipPathAnimation(t, g, !1), {
2289
+ return this.startClipPathAnimation(t, p, !1), {
2320
2290
  element: t,
2321
2291
  originalState: i,
2322
- animationHandle: g,
2292
+ animationHandle: p,
2323
2293
  direction: "out",
2324
2294
  originalWidth: u,
2325
- originalHeight: h
2295
+ originalHeight: f
2326
2296
  };
2327
2297
  }
2328
2298
  /**
@@ -2340,10 +2310,10 @@ class qe {
2340
2310
  * Caller is responsible for calling animationEngine.cancelAllAnimations() afterwards.
2341
2311
  */
2342
2312
  captureMidAnimationState(t) {
2343
- const i = getComputedStyle(t), e = new DOMMatrix(i.transform), n = t.offsetWidth, s = t.offsetHeight, r = e.e + n * 0.5, a = e.f + s * 0.5, c = Math.atan2(e.b, e.a) * (180 / Math.PI);
2344
- return t.style.width = `${n}px`, t.style.height = `${s}px`, t.style.transform = `translate(-50%, -50%) translate(${r}px, ${a}px) rotate(${c}deg)`, t.style.transition = "none", {
2313
+ const i = getComputedStyle(t), e = new DOMMatrix(i.transform), o = t.offsetWidth, s = t.offsetHeight, r = e.e + o * 0.5, a = e.f + s * 0.5, c = Math.atan2(e.b, e.a) * (180 / Math.PI);
2314
+ return t.style.width = `${o}px`, t.style.height = `${s}px`, t.style.transform = `translate(-50%, -50%) translate(${r}px, ${a}px) rotate(${c}deg)`, t.style.transition = "none", {
2345
2315
  transform: { x: r, y: a, rotation: c, scale: 1 },
2346
- dimensions: { width: n, height: s }
2316
+ dimensions: { width: o, height: s }
2347
2317
  };
2348
2318
  }
2349
2319
  /**
@@ -2358,71 +2328,71 @@ class qe {
2358
2328
  /**
2359
2329
  * Reset an element instantly to its original position and dimensions (no animation)
2360
2330
  */
2361
- resetElementInstantly(t, i, e, n, s) {
2331
+ resetElementInstantly(t, i, e, o, s) {
2362
2332
  this.animationEngine.cancelAllAnimations(t);
2363
2333
  const r = ["translate(-50%, -50%)"];
2364
- r.push("translate(0px, 0px)"), r.push(`rotate(${i.rotation}deg)`), t.style.transition = "none", t.style.transform = r.join(" "), n !== void 0 && s !== void 0 && (t.style.width = `${n}px`, t.style.height = `${s}px`), this.removeFocusedStyling(t, e);
2334
+ r.push("translate(0px, 0px)"), r.push(`rotate(${i.rotation}deg)`), t.style.transition = "none", t.style.transform = r.join(" "), o !== void 0 && s !== void 0 && (t.style.width = `${o}px`, t.style.height = `${s}px`), this.removeFocusedStyling(t, e);
2365
2335
  }
2366
2336
  /**
2367
2337
  * Focus (zoom) an image to center of container
2368
2338
  * Implements cross-animation when swapping focus
2369
2339
  */
2370
2340
  async focusImage(t, i, e) {
2371
- if (this.currentFocus === t && this.state === x.FOCUSED)
2341
+ if (this.currentFocus === t && this.state === C.FOCUSED)
2372
2342
  return this.unfocusImage();
2373
- if (this.incoming?.element === t && this.state === x.FOCUSING) {
2343
+ if (this.incoming?.element === t && this.state === C.FOCUSING) {
2374
2344
  const { transform: s, dimensions: r } = this.captureMidAnimationState(t);
2375
2345
  this.animationEngine.cancelAllAnimations(t), this.outgoing = this.startUnfocusAnimation(
2376
2346
  t,
2377
2347
  this.incoming.originalState,
2378
2348
  s,
2379
2349
  r
2380
- ), 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;
2350
+ ), 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;
2381
2351
  return;
2382
2352
  }
2383
- const n = ++this.focusGeneration;
2353
+ const o = ++this.focusGeneration;
2384
2354
  switch (this.state) {
2385
- case x.IDLE:
2386
- if (this.state = x.FOCUSING, this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== n) return;
2387
- this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2355
+ case C.IDLE:
2356
+ if (this.state = C.FOCUSING, this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== o) return;
2357
+ this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
2388
2358
  break;
2389
- case x.FOCUSED:
2390
- if (this.state = x.CROSS_ANIMATING, this.currentFocus && this.focusData && (this.outgoing = this.startUnfocusAnimation(
2359
+ case C.FOCUSED:
2360
+ if (this.state = C.CROSS_ANIMATING, this.currentFocus && this.focusData && (this.outgoing = this.startUnfocusAnimation(
2391
2361
  this.currentFocus,
2392
2362
  this.focusData.originalState
2393
2363
  )), this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
2394
2364
  this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
2395
2365
  this.waitForAnimation(this.incoming.animationHandle)
2396
- ]), this.focusGeneration !== n)
2366
+ ]), this.focusGeneration !== o)
2397
2367
  return;
2398
2368
  if (this.outgoing) {
2399
2369
  const s = this.outgoing.element;
2400
2370
  this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
2401
2371
  }
2402
- this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2372
+ this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
2403
2373
  break;
2404
- case x.FOCUSING:
2374
+ case C.FOCUSING:
2405
2375
  if (this.incoming && (this.animationEngine.cancelAnimation(this.incoming.animationHandle, !1), this.resetElementInstantly(
2406
2376
  this.incoming.element,
2407
2377
  this.incoming.originalState,
2408
2378
  this.focusData?.originalZIndex || "",
2409
2379
  this.focusData?.originalWidth,
2410
2380
  this.focusData?.originalHeight
2411
- ), this.incoming = null), this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== n) return;
2412
- this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2381
+ ), this.incoming = null), this.incoming = this.startFocusAnimation(t, i, e), await this.waitForAnimation(this.incoming.animationHandle), this.focusGeneration !== o) return;
2382
+ this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
2413
2383
  break;
2414
- case x.UNFOCUSING:
2415
- if (this.state = x.CROSS_ANIMATING, this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
2384
+ case C.UNFOCUSING:
2385
+ if (this.state = C.CROSS_ANIMATING, this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
2416
2386
  this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
2417
2387
  this.waitForAnimation(this.incoming.animationHandle)
2418
- ]), this.focusGeneration !== n) return;
2388
+ ]), this.focusGeneration !== o) return;
2419
2389
  if (this.outgoing) {
2420
2390
  const s = this.outgoing.element;
2421
2391
  this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
2422
2392
  }
2423
- this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2393
+ this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
2424
2394
  break;
2425
- case x.CROSS_ANIMATING:
2395
+ case C.CROSS_ANIMATING:
2426
2396
  if (this.incoming?.element === t)
2427
2397
  return;
2428
2398
  if (this.outgoing?.element === t) {
@@ -2440,12 +2410,12 @@ class qe {
2440
2410
  if (this.incoming = this.startFocusAnimation(t, i, e, s, r), await Promise.all([
2441
2411
  this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
2442
2412
  this.waitForAnimation(this.incoming.animationHandle)
2443
- ]), this.focusGeneration !== n) return;
2413
+ ]), this.focusGeneration !== o) return;
2444
2414
  if (this.outgoing) {
2445
2415
  const a = this.outgoing.element;
2446
2416
  this.removeFocusedStyling(a, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(a);
2447
2417
  }
2448
- this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2418
+ this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
2449
2419
  return;
2450
2420
  }
2451
2421
  if (this.outgoing && (this.animationEngine.cancelAnimation(this.outgoing.animationHandle, !1), this.resetElementInstantly(
@@ -2466,12 +2436,12 @@ class qe {
2466
2436
  if (this.incoming = this.startFocusAnimation(t, i, e), await Promise.all([
2467
2437
  this.outgoing ? this.waitForAnimation(this.outgoing.animationHandle) : Promise.resolve(),
2468
2438
  this.waitForAnimation(this.incoming.animationHandle)
2469
- ]), this.focusGeneration !== n) return;
2439
+ ]), this.focusGeneration !== o) return;
2470
2440
  if (this.outgoing) {
2471
2441
  const s = this.outgoing.element;
2472
2442
  this.removeFocusedStyling(s, this.outgoing.originalState.zIndex?.toString() || ""), this.outgoing = null, this.onUnfocusComplete?.(s);
2473
2443
  }
2474
- this.currentFocus = t, this.incoming = null, this.state = x.FOCUSED;
2444
+ this.currentFocus = t, this.incoming = null, this.state = C.FOCUSED;
2475
2445
  break;
2476
2446
  }
2477
2447
  }
@@ -2479,24 +2449,24 @@ class qe {
2479
2449
  * Unfocus current image, returning it to original position
2480
2450
  */
2481
2451
  async unfocusImage() {
2482
- if (this.state === x.UNFOCUSING)
2452
+ if (this.state === C.UNFOCUSING)
2483
2453
  return;
2484
2454
  const t = ++this.focusGeneration;
2485
2455
  if (!this.currentFocus || !this.focusData) {
2486
- if (this.incoming && this.state === x.FOCUSING) {
2456
+ if (this.incoming && this.state === C.FOCUSING) {
2487
2457
  const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
2488
2458
  if (this.animationEngine.cancelAllAnimations(this.incoming.element), this.outgoing = this.startUnfocusAnimation(
2489
2459
  this.incoming.element,
2490
2460
  this.incoming.originalState,
2491
2461
  s,
2492
2462
  r
2493
- ), this.incoming = null, this.state = x.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration !== t) return;
2463
+ ), this.incoming = null, this.state = C.UNFOCUSING, await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration !== t) return;
2494
2464
  const a = this.outgoing.element;
2495
- this.removeFocusedStyling(a, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state = x.IDLE, this.onUnfocusComplete?.(a);
2465
+ this.removeFocusedStyling(a, this.focusData?.originalZIndex || ""), this.outgoing = null, this.focusData = null, this.state = C.IDLE, this.onUnfocusComplete?.(a);
2496
2466
  }
2497
2467
  return;
2498
2468
  }
2499
- if (this.state === x.CROSS_ANIMATING && this.incoming) {
2469
+ if (this.state === C.CROSS_ANIMATING && this.incoming) {
2500
2470
  const { transform: s, dimensions: r } = this.captureMidAnimationState(this.incoming.element);
2501
2471
  this.animationEngine.cancelAllAnimations(this.incoming.element);
2502
2472
  const a = this.startUnfocusAnimation(
@@ -2511,13 +2481,13 @@ class qe {
2511
2481
  ]), this.focusGeneration !== t) return;
2512
2482
  let c = null;
2513
2483
  this.outgoing && (c = this.outgoing.element, this.removeFocusedStyling(c, this.outgoing.originalState.zIndex?.toString() || ""));
2514
- const l = a.element;
2515
- 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);
2484
+ const d = a.element;
2485
+ 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);
2516
2486
  return;
2517
2487
  }
2518
- this.state = x.UNFOCUSING;
2519
- const i = this.currentFocus, e = this.focusData.originalState, n = this.focusData.originalZIndex;
2520
- 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));
2488
+ this.state = C.UNFOCUSING;
2489
+ const i = this.currentFocus, e = this.focusData.originalState, o = this.focusData.originalZIndex;
2490
+ this.outgoing = this.startUnfocusAnimation(i, e), await this.waitForAnimation(this.outgoing.animationHandle), this.focusGeneration === t && (this.removeFocusedStyling(i, o), this.outgoing = null, this.currentFocus = null, this.focusData = null, this.state = C.IDLE, this.onUnfocusComplete?.(i));
2521
2491
  }
2522
2492
  /**
2523
2493
  * Swap focus from current image to a new one (alias for focusImage with cross-animation)
@@ -2535,7 +2505,7 @@ class qe {
2535
2505
  * Check if an image is currently focused (stable state)
2536
2506
  */
2537
2507
  isFocused(t) {
2538
- return this.currentFocus === t && this.state === x.FOCUSED;
2508
+ return this.currentFocus === t && this.state === C.FOCUSED;
2539
2509
  }
2540
2510
  /**
2541
2511
  * Check if an image is the target of current focus animation
@@ -2556,9 +2526,9 @@ class qe {
2556
2526
  * Used during swipe gestures for visual feedback
2557
2527
  */
2558
2528
  setDragOffset(t) {
2559
- if (!this.currentFocus || !this.focusData || this.state !== x.FOCUSED) return;
2560
- const i = this.currentFocus, e = this.focusData.focusTransform, n = ["translate(-50%, -50%)"], s = (e.x ?? 0) + t, r = e.y ?? 0;
2561
- 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(" ");
2529
+ if (!this.currentFocus || !this.focusData || this.state !== C.FOCUSED) return;
2530
+ const i = this.currentFocus, e = this.focusData.focusTransform, o = ["translate(-50%, -50%)"], s = (e.x ?? 0) + t, r = e.y ?? 0;
2531
+ o.push(`translate(${s}px, ${r}px)`), e.rotation !== void 0 && o.push(`rotate(${e.rotation}deg)`), i.style.transition = "none", i.style.transform = o.join(" ");
2562
2532
  }
2563
2533
  /**
2564
2534
  * Clear the drag offset, optionally animating back to center
@@ -2566,9 +2536,9 @@ class qe {
2566
2536
  * @param duration - Animation duration in ms (default 150)
2567
2537
  */
2568
2538
  clearDragOffset(t, i = 150) {
2569
- if (!this.currentFocus || !this.focusData || this.state !== x.FOCUSED) return;
2570
- const e = this.currentFocus, n = this.focusData.focusTransform, s = ["translate(-50%, -50%)"], r = n.x ?? 0, a = n.y ?? 0;
2571
- s.push(`translate(${r}px, ${a}px)`), n.rotation !== void 0 && s.push(`rotate(${n.rotation}deg)`);
2539
+ if (!this.currentFocus || !this.focusData || this.state !== C.FOCUSED) return;
2540
+ const e = this.currentFocus, o = this.focusData.focusTransform, s = ["translate(-50%, -50%)"], r = o.x ?? 0, a = o.y ?? 0;
2541
+ s.push(`translate(${r}px, ${a}px)`), o.rotation !== void 0 && s.push(`rotate(${o.rotation}deg)`);
2572
2542
  const c = s.join(" ");
2573
2543
  t ? (e.style.transition = `transform ${i}ms ease-out`, e.style.transform = c, setTimeout(() => {
2574
2544
  this.currentFocus === e && (e.style.transition = "none");
@@ -2596,10 +2566,10 @@ class qe {
2596
2566
  this.focusData.originalZIndex,
2597
2567
  this.focusData.originalWidth,
2598
2568
  this.focusData.originalHeight
2599
- ), this.state = x.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
2569
+ ), this.state = C.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
2600
2570
  }
2601
2571
  }
2602
- const Xe = 50, Ye = 0.5, Ve = 20, Je = 0.3, Ke = 150, Ze = 30, rt = class rt {
2572
+ const Ge = 50, qe = 0.5, Ye = 20, Xe = 0.3, Ve = 150, Je = 30, rt = class rt {
2603
2573
  constructor(t, i) {
2604
2574
  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);
2605
2575
  }
@@ -2643,23 +2613,23 @@ const Xe = 50, Ye = 0.5, Ve = 20, Je = 0.3, Ke = 150, Ze = 30, rt = class rt {
2643
2613
  }
2644
2614
  handleTouchMove(t) {
2645
2615
  if (!this.touchState || t.touches.length !== 1) return;
2646
- const i = t.touches[0], e = i.clientX - this.touchState.startX, n = i.clientY - this.touchState.startY;
2647
- if (this.touchState.isHorizontalSwipe === null && Math.sqrt(e * e + n * n) > 10) {
2648
- const a = Math.atan2(Math.abs(n), Math.abs(e)) * (180 / Math.PI);
2649
- this.touchState.isHorizontalSwipe = a <= Ze;
2616
+ const i = t.touches[0], e = i.clientX - this.touchState.startX, o = i.clientY - this.touchState.startY;
2617
+ if (this.touchState.isHorizontalSwipe === null && Math.sqrt(e * e + o * o) > 10) {
2618
+ const a = Math.atan2(Math.abs(o), Math.abs(e)) * (180 / Math.PI);
2619
+ this.touchState.isHorizontalSwipe = a <= Je;
2650
2620
  }
2651
2621
  if (this.touchState.isHorizontalSwipe !== !1 && this.touchState.isHorizontalSwipe === !0) {
2652
2622
  t.preventDefault(), this.touchState.isDragging = !0, this.touchState.currentX = i.clientX;
2653
- const s = e * Je;
2623
+ const s = e * Xe;
2654
2624
  this.callbacks.onDragOffset(s);
2655
2625
  }
2656
2626
  }
2657
2627
  handleTouchEnd(t) {
2658
2628
  if (!this.touchState) return;
2659
2629
  this.recentTouchTimestamp = Date.now();
2660
- const i = this.touchState.currentX - this.touchState.startX, e = performance.now() - this.touchState.startTime, n = Math.abs(i) / e, s = Math.abs(i);
2630
+ const i = this.touchState.currentX - this.touchState.startX, e = performance.now() - this.touchState.startTime, o = Math.abs(i) / e, s = Math.abs(i);
2661
2631
  let r = !1;
2662
- this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (s >= Xe || n >= Ye && s >= Ve) && (r = !0, i < 0 ? this.callbacks.onNext() : this.callbacks.onPrev()), this.touchState.isDragging && this.callbacks.onDragEnd(r), this.touchState = null;
2632
+ this.touchState.isHorizontalSwipe === !0 && this.touchState.isDragging && (s >= Ge || o >= qe && s >= Ye) && (r = !0, i < 0 ? this.callbacks.onNext() : this.callbacks.onPrev()), this.touchState.isDragging && this.callbacks.onDragEnd(r), this.touchState = null;
2663
2633
  }
2664
2634
  handleTouchCancel(t) {
2665
2635
  this.touchState?.isDragging && this.callbacks.onDragEnd(!1), this.touchState = null;
@@ -2667,7 +2637,7 @@ const Xe = 50, Ye = 0.5, Ve = 20, Je = 0.3, Ke = 150, Ze = 30, rt = class rt {
2667
2637
  };
2668
2638
  rt.TOUCH_CLICK_DELAY = 300;
2669
2639
  let bt = rt;
2670
- class Qe {
2640
+ class Ke {
2671
2641
  constructor(t) {
2672
2642
  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)
2673
2643
  throw new Error("GoogleDriveLoader requires at least one source to be configured");
@@ -2681,7 +2651,7 @@ class Qe {
2681
2651
  for (const i of this.sources)
2682
2652
  if ("folders" in i)
2683
2653
  for (const e of i.folders) {
2684
- const n = i.recursive !== void 0 ? i.recursive : !0, s = await this.loadFromFolder(e, t, n);
2654
+ const o = i.recursive !== void 0 ? i.recursive : !0, s = await this.loadFromFolder(e, t, o);
2685
2655
  this._discoveredUrls.push(...s);
2686
2656
  }
2687
2657
  else if ("files" in i) {
@@ -2727,9 +2697,9 @@ class Qe {
2727
2697
  // Alternative format
2728
2698
  ];
2729
2699
  for (const e of i) {
2730
- const n = t.match(e);
2731
- if (n && n[1])
2732
- return n[1];
2700
+ const o = t.match(e);
2701
+ if (o && o[1])
2702
+ return o[1];
2733
2703
  }
2734
2704
  return null;
2735
2705
  }
@@ -2741,15 +2711,15 @@ class Qe {
2741
2711
  * @returns Promise resolving to array of image URLs
2742
2712
  */
2743
2713
  async loadFromFolder(t, i, e = !0) {
2744
- const n = this.extractFolderId(t);
2745
- if (!n)
2714
+ const o = this.extractFolderId(t);
2715
+ if (!o)
2746
2716
  throw new Error("Invalid Google Drive folder URL. Please check the URL format.");
2747
2717
  if (!this.apiKey || this.apiKey === "YOUR_API_KEY_HERE")
2748
- return this.loadImagesDirectly(n, i);
2718
+ return this.loadImagesDirectly(o, i);
2749
2719
  try {
2750
- return e ? await this.loadImagesRecursively(n, i) : await this.loadImagesFromSingleFolder(n, i);
2720
+ return e ? await this.loadImagesRecursively(o, i) : await this.loadImagesFromSingleFolder(o, i);
2751
2721
  } catch (s) {
2752
- return console.error("Error loading from Google Drive API:", s), this.loadImagesDirectly(n, i);
2722
+ return console.error("Error loading from Google Drive API:", s), this.loadImagesDirectly(o, i);
2753
2723
  }
2754
2724
  }
2755
2725
  /**
@@ -2759,13 +2729,13 @@ class Qe {
2759
2729
  * @returns Promise resolving to array of image URLs
2760
2730
  */
2761
2731
  async loadImagesFromSingleFolder(t, i) {
2762
- 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);
2732
+ const e = [], o = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(o)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, a = await fetch(r);
2763
2733
  if (!a.ok)
2764
2734
  throw new Error(`API request failed: ${a.status} ${a.statusText}`);
2765
- const l = (await a.json()).files.filter(
2735
+ const d = (await a.json()).files.filter(
2766
2736
  (u) => u.mimeType.startsWith("image/") && i.isAllowed(u.name)
2767
2737
  );
2768
- return this.log(`Found ${l.length} images in folder ${t} (non-recursive)`), l.forEach((u) => {
2738
+ return this.log(`Found ${d.length} images in folder ${t} (non-recursive)`), d.forEach((u) => {
2769
2739
  e.push(`https://lh3.googleusercontent.com/d/${u.id}=s1600`), this.log(`Added file: ${u.name}`);
2770
2740
  }), e;
2771
2741
  }
@@ -2777,10 +2747,10 @@ class Qe {
2777
2747
  */
2778
2748
  async loadFiles(t, i) {
2779
2749
  const e = [];
2780
- for (const n of t) {
2781
- const s = this.extractFileId(n);
2750
+ for (const o of t) {
2751
+ const s = this.extractFileId(o);
2782
2752
  if (!s) {
2783
- this.log(`Skipping invalid file URL: ${n}`);
2753
+ this.log(`Skipping invalid file URL: ${o}`);
2784
2754
  continue;
2785
2755
  }
2786
2756
  if (this.apiKey && this.apiKey !== "YOUR_API_KEY_HERE")
@@ -2816,9 +2786,9 @@ class Qe {
2816
2786
  // Generic id parameter
2817
2787
  ];
2818
2788
  for (const e of i) {
2819
- const n = t.match(e);
2820
- if (n && n[1])
2821
- return n[1];
2789
+ const o = t.match(e);
2790
+ if (o && o[1])
2791
+ return o[1];
2822
2792
  }
2823
2793
  return null;
2824
2794
  }
@@ -2829,21 +2799,21 @@ class Qe {
2829
2799
  * @returns Promise resolving to array of image URLs
2830
2800
  */
2831
2801
  async loadImagesRecursively(t, i) {
2832
- 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);
2802
+ const e = [], o = `'${t}' in parents and trashed=false`, r = `${this.apiEndpoint}?q=${encodeURIComponent(o)}&fields=files(id,name,mimeType,thumbnailLink)&key=${this.apiKey}`, a = await fetch(r);
2833
2803
  if (!a.ok)
2834
2804
  throw new Error(`API request failed: ${a.status} ${a.statusText}`);
2835
- const c = await a.json(), l = c.files.filter(
2836
- (h) => h.mimeType.startsWith("image/") && i.isAllowed(h.name)
2805
+ const c = await a.json(), d = c.files.filter(
2806
+ (f) => f.mimeType.startsWith("image/") && i.isAllowed(f.name)
2837
2807
  ), u = c.files.filter(
2838
- (h) => h.mimeType === "application/vnd.google-apps.folder"
2808
+ (f) => f.mimeType === "application/vnd.google-apps.folder"
2839
2809
  );
2840
- 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) => {
2841
- e.push(`https://lh3.googleusercontent.com/d/${h.id}=s1600`), this.log(`Added file: ${h.name}`);
2810
+ 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) => {
2811
+ e.push(`https://lh3.googleusercontent.com/d/${f.id}=s1600`), this.log(`Added file: ${f.name}`);
2842
2812
  });
2843
- for (const h of u) {
2844
- this.log(`Loading images from subfolder: ${h.name}`);
2845
- const d = await this.loadImagesRecursively(h.id, i);
2846
- e.push(...d);
2813
+ for (const f of u) {
2814
+ this.log(`Loading images from subfolder: ${f.name}`);
2815
+ const m = await this.loadImagesRecursively(f.id, i);
2816
+ e.push(...m);
2847
2817
  }
2848
2818
  return e;
2849
2819
  }
@@ -2856,10 +2826,10 @@ class Qe {
2856
2826
  */
2857
2827
  async loadImagesDirectly(t, i) {
2858
2828
  try {
2859
- const e = `https://drive.google.com/embeddedfolderview?id=${t}`, n = await fetch(e, { mode: "cors" });
2860
- if (!n.ok)
2829
+ const e = `https://drive.google.com/embeddedfolderview?id=${t}`, o = await fetch(e, { mode: "cors" });
2830
+ if (!o.ok)
2861
2831
  throw new Error("Cannot access folder directly (CORS or permissions issue)");
2862
- const s = await n.text(), r = /\/file\/d\/([a-zA-Z0-9_-]+)/g, a = [...s.matchAll(r)];
2832
+ const s = await o.text(), r = /\/file\/d\/([a-zA-Z0-9_-]+)/g, a = [...s.matchAll(r)];
2863
2833
  return [...new Set(a.map((u) => u[1]))].map(
2864
2834
  (u) => `https://drive.google.com/uc?export=view&id=${u}`
2865
2835
  );
@@ -2888,7 +2858,7 @@ class Qe {
2888
2858
  this.debugLogging && typeof console < "u" && console.log(...t);
2889
2859
  }
2890
2860
  }
2891
- class ti {
2861
+ class Ze {
2892
2862
  constructor(t) {
2893
2863
  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)
2894
2864
  throw new Error("StaticImageLoader requires at least one source to be configured");
@@ -2952,13 +2922,13 @@ class ti {
2952
2922
  if (!Array.isArray(t))
2953
2923
  return console.warn("URLs must be an array:", t), [];
2954
2924
  const e = [];
2955
- for (const n of t) {
2956
- const s = n.split("/").pop() || n;
2925
+ for (const o of t) {
2926
+ const s = o.split("/").pop() || o;
2957
2927
  if (!i.isAllowed(s)) {
2958
- this.log(`Skipping filtered URL: ${n}`);
2928
+ this.log(`Skipping filtered URL: ${o}`);
2959
2929
  continue;
2960
2930
  }
2961
- this.validateUrls ? await this.validateUrl(n) ? e.push(n) : console.warn(`Skipping invalid/missing URL: ${n}`) : e.push(n);
2931
+ this.validateUrls ? await this.validateUrl(o) ? e.push(o) : console.warn(`Skipping invalid/missing URL: ${o}`) : e.push(o);
2962
2932
  }
2963
2933
  return e;
2964
2934
  }
@@ -2972,16 +2942,16 @@ class ti {
2972
2942
  async processPath(t, i, e) {
2973
2943
  if (!Array.isArray(i))
2974
2944
  return console.warn("files must be an array:", i), [];
2975
- const n = [];
2945
+ const o = [];
2976
2946
  for (const s of i) {
2977
2947
  if (!e.isAllowed(s)) {
2978
2948
  this.log(`Skipping filtered file: ${s}`);
2979
2949
  continue;
2980
2950
  }
2981
2951
  const r = this.constructUrl(t, s);
2982
- this.validateUrls ? await this.validateUrl(r) ? n.push(r) : console.warn(`Skipping invalid/missing file: ${r}`) : n.push(r);
2952
+ this.validateUrls ? await this.validateUrl(r) ? o.push(r) : console.warn(`Skipping invalid/missing file: ${r}`) : o.push(r);
2983
2953
  }
2984
- return n;
2954
+ return o;
2985
2955
  }
2986
2956
  /**
2987
2957
  * Process a JSON endpoint source
@@ -2992,17 +2962,17 @@ class ti {
2992
2962
  */
2993
2963
  async processJson(t, i) {
2994
2964
  this.log(`Fetching JSON endpoint: ${t}`);
2995
- const e = new AbortController(), n = setTimeout(() => e.abort(), 1e4);
2965
+ const e = new AbortController(), o = setTimeout(() => e.abort(), 1e4);
2996
2966
  try {
2997
2967
  const s = await fetch(t, { signal: e.signal });
2998
- if (clearTimeout(n), !s.ok)
2968
+ if (clearTimeout(o), !s.ok)
2999
2969
  throw new Error(`HTTP ${s.status} fetching ${t}`);
3000
2970
  const r = await s.json();
3001
2971
  if (!r || !Array.isArray(r.images))
3002
2972
  throw new Error('JSON source must return JSON with shape { "images": ["url1", "url2", ...] }');
3003
2973
  return this.log(`JSON endpoint returned ${r.images.length} image(s)`), await this.processUrls(r.images, i);
3004
2974
  } catch (s) {
3005
- throw clearTimeout(n), s instanceof Error && s.name === "AbortError" ? new Error(`Timeout fetching JSON endpoint: ${t}`) : s;
2975
+ throw clearTimeout(o), s instanceof Error && s.name === "AbortError" ? new Error(`Timeout fetching JSON endpoint: ${t}`) : s;
3006
2976
  }
3007
2977
  }
3008
2978
  /**
@@ -3024,11 +2994,11 @@ class ti {
3024
2994
  if (!(t.startsWith(window.location.origin) || t.startsWith("/")))
3025
2995
  return this.log(`Skipping validation for cross-origin URL: ${t}`), !0;
3026
2996
  try {
3027
- const e = new AbortController(), n = setTimeout(() => e.abort(), this.validationTimeout), s = await fetch(t, {
2997
+ const e = new AbortController(), o = setTimeout(() => e.abort(), this.validationTimeout), s = await fetch(t, {
3028
2998
  method: "HEAD",
3029
2999
  signal: e.signal
3030
3000
  });
3031
- return clearTimeout(n), s.ok ? !0 : (this.log(`Validation failed for ${t}: HTTP ${s.status}`), !1);
3001
+ return clearTimeout(o), s.ok ? !0 : (this.log(`Validation failed for ${t}: HTTP ${s.status}`), !1);
3032
3002
  } catch (e) {
3033
3003
  return e instanceof Error && (e.name === "AbortError" ? this.log(`Validation timeout for ${t}`) : this.log(`Validation failed for ${t}:`, e.message)), !1;
3034
3004
  }
@@ -3045,8 +3015,8 @@ class ti {
3045
3015
  return `${e}/${i}`;
3046
3016
  if (typeof window > "u")
3047
3017
  return `${e}/${i}`;
3048
- const n = window.location.origin, r = (t.startsWith("/") ? t : "/" + t).replace(/\/$/, "");
3049
- return `${n}${r}/${i}`;
3018
+ const o = window.location.origin, r = (t.startsWith("/") ? t : "/" + t).replace(/\/$/, "");
3019
+ return `${o}${r}/${i}`;
3050
3020
  }
3051
3021
  /**
3052
3022
  * Check if URL is absolute (contains protocol)
@@ -3068,7 +3038,7 @@ class ti {
3068
3038
  this.debugLogging && typeof console < "u" && console.log(...t);
3069
3039
  }
3070
3040
  }
3071
- class ei {
3041
+ class Qe {
3072
3042
  constructor(t) {
3073
3043
  if (this._prepared = !1, this._discoveredUrls = [], this.loaders = t.loaders, this.debugLogging = t.debugLogging ?? !1, !this.loaders || this.loaders.length === 0)
3074
3044
  throw new Error("CompositeLoader requires at least one loader to be configured");
@@ -3080,16 +3050,16 @@ class ei {
3080
3050
  */
3081
3051
  async prepare(t) {
3082
3052
  this._discoveredUrls = [], this.log(`Preparing ${this.loaders.length} loader(s) in parallel`);
3083
- const i = this.loaders.map((e, n) => e.prepare(t).then(() => {
3084
- this.log(`Loader ${n} prepared with ${e.imagesLength()} images`);
3053
+ const i = this.loaders.map((e, o) => e.prepare(t).then(() => {
3054
+ this.log(`Loader ${o} prepared with ${e.imagesLength()} images`);
3085
3055
  }).catch((s) => {
3086
- console.warn(`Loader ${n} failed to prepare:`, s);
3056
+ console.warn(`Loader ${o} failed to prepare:`, s);
3087
3057
  }));
3088
3058
  await Promise.all(i);
3089
3059
  for (const e of this.loaders)
3090
3060
  if (e.isPrepared()) {
3091
- const n = e.imageURLs();
3092
- this._discoveredUrls.push(...n);
3061
+ const o = e.imageURLs();
3062
+ this._discoveredUrls.push(...o);
3093
3063
  }
3094
3064
  this._prepared = !0, this.log(`CompositeLoader prepared with ${this._discoveredUrls.length} total images`);
3095
3065
  }
@@ -3125,7 +3095,7 @@ class ei {
3125
3095
  this.debugLogging && typeof console < "u" && console.log("[CompositeLoader]", ...t);
3126
3096
  }
3127
3097
  }
3128
- class ii {
3098
+ class ti {
3129
3099
  /**
3130
3100
  * Create a new ImageFilter
3131
3101
  * @param extensions - Array of allowed file extensions (without dots)
@@ -3162,7 +3132,7 @@ class ii {
3162
3132
  // isAllowedDate(date: Date): boolean
3163
3133
  // isAllowedDimensions(width: number, height: number): boolean
3164
3134
  }
3165
- const ni = `
3135
+ const ei = `
3166
3136
  .fbn-ic-gallery {
3167
3137
  position: relative;
3168
3138
  width: 100%;
@@ -3243,37 +3213,46 @@ const ni = `
3243
3213
  display: none !important;
3244
3214
  }
3245
3215
  `;
3246
- function oi() {
3216
+ function ii() {
3247
3217
  if (typeof document > "u") return;
3248
- const o = "fbn-ic-functional-styles";
3249
- if (document.getElementById(o)) return;
3218
+ const n = "fbn-ic-functional-styles";
3219
+ if (document.getElementById(n)) return;
3250
3220
  const t = document.createElement("style");
3251
- t.id = o, t.textContent = ni, document.head.appendChild(t);
3221
+ t.id = n, t.textContent = ei, document.head.appendChild(t);
3252
3222
  }
3253
- let si = class {
3223
+ let oi = class {
3254
3224
  constructor(t = {}) {
3255
- this.fullConfig = oe(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 ce(this.fullConfig.animation), this.layoutEngine = new Ue({
3225
+ this.fullConfig = ie(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 ae(this.fullConfig.animation), this.layoutEngine = new Pe({
3256
3226
  layout: this.fullConfig.layout,
3257
3227
  image: this.fullConfig.image
3258
- }), this.zoomEngine = new qe(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;
3259
- const i = this.fullConfig.animation.entry || C.animation.entry;
3260
- this.entryAnimationEngine = new ve(
3228
+ }), this.zoomEngine = new We(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;
3229
+ const i = this.fullConfig.animation.entry || L.animation.entry;
3230
+ this.entryAnimationEngine = new be(
3261
3231
  i,
3262
3232
  this.fullConfig.layout.algorithm
3263
3233
  );
3264
3234
  const e = this.fullConfig.animation.idle;
3265
- e && e.type !== "none" ? this.idleAnimationEngine = new Ee(
3235
+ e && e.type !== "none" ? this.idleAnimationEngine = new ye(
3266
3236
  e,
3267
3237
  i.timing?.duration ?? 600
3268
- ) : this.idleAnimationEngine = null, this.zoomEngine.setOnUnfocusCompleteCallback((n) => {
3269
- this.idleAnimationEngine?.resumeForImage(n);
3270
- const s = n;
3238
+ ) : this.idleAnimationEngine = null, this.zoomEngine.setOnUnfocusCompleteCallback((o) => {
3239
+ this.idleAnimationEngine?.resumeForImage(o);
3240
+ const s = o, r = this.imageElements.indexOf(s);
3241
+ if (this.callbacks.onImageUnfocus && r !== -1) {
3242
+ const a = this.imageLoader.imageURLs(), c = {
3243
+ element: s,
3244
+ index: r,
3245
+ url: a[r] ?? "",
3246
+ layout: this.imageLayouts[r]
3247
+ };
3248
+ this.callbacks.onImageUnfocus(c);
3249
+ }
3271
3250
  requestAnimationFrame(() => {
3272
3251
  if (s.matches(":hover") && this.fullConfig.styling?.hover) {
3273
- const r = this.imageElements.indexOf(s);
3274
- if (r !== -1) {
3275
- const a = s.offsetHeight, c = s.cachedRenderedWidth;
3276
- st(s, this.fullConfig.styling.hover, a, c), et(s, this.hoverClassName), this.hoveredImage = { element: s, layout: this.imageLayouts[r] };
3252
+ const a = this.imageElements.indexOf(s);
3253
+ if (a !== -1) {
3254
+ const c = s.offsetHeight, d = s.cachedRenderedWidth;
3255
+ st(s, this.fullConfig.styling.hover, c, d), et(s, this.hoverClassName), this.hoveredImage = { element: s, layout: this.imageLayouts[a] };
3277
3256
  }
3278
3257
  }
3279
3258
  });
@@ -3284,7 +3263,7 @@ let si = class {
3284
3263
  */
3285
3264
  createImageFilter() {
3286
3265
  const t = this.fullConfig.config.loaders?.allowedExtensions;
3287
- return new ii(t);
3266
+ return new ti(t);
3288
3267
  }
3289
3268
  /**
3290
3269
  * Create appropriate image loader based on config
@@ -3294,8 +3273,8 @@ let si = class {
3294
3273
  const t = this.fullConfig.loaders, i = this.fullConfig.config.loaders ?? {};
3295
3274
  if (!t || t.length === 0)
3296
3275
  throw new Error("No loaders configured. Provide `images`, `loaders`, or both.\n Example: imageCloud({ container: 'id', images: ['https://...'] })");
3297
- const e = t.map((n) => this.createLoaderFromEntry(n, i));
3298
- return e.length === 1 ? e[0] : new ei({
3276
+ const e = t.map((o) => this.createLoaderFromEntry(o, i));
3277
+ return e.length === 1 ? e[0] : new Qe({
3299
3278
  loaders: e,
3300
3279
  debugLogging: this.fullConfig.config.debug?.loaders
3301
3280
  });
@@ -3305,7 +3284,7 @@ let si = class {
3305
3284
  */
3306
3285
  createLoaderFromEntry(t, i) {
3307
3286
  if ("static" in t) {
3308
- const e = t.static, n = {
3287
+ const e = t.static, o = {
3309
3288
  ...e,
3310
3289
  validateUrls: e.validateUrls ?? i.validateUrls,
3311
3290
  validationTimeout: e.validationTimeout ?? i.validationTimeout,
@@ -3313,14 +3292,14 @@ let si = class {
3313
3292
  allowedExtensions: e.allowedExtensions ?? i.allowedExtensions,
3314
3293
  debugLogging: e.debugLogging ?? this.fullConfig.config.debug?.loaders
3315
3294
  };
3316
- return new ti(n);
3295
+ return new Ze(o);
3317
3296
  } else if ("googleDrive" in t) {
3318
- const e = t.googleDrive, n = {
3297
+ const e = t.googleDrive, o = {
3319
3298
  ...e,
3320
3299
  allowedExtensions: e.allowedExtensions ?? i.allowedExtensions,
3321
3300
  debugLogging: e.debugLogging ?? this.fullConfig.config.debug?.loaders
3322
3301
  };
3323
- return new Qe(n);
3302
+ return new Ke(o);
3324
3303
  } else
3325
3304
  throw new Error(`Unknown loader entry: ${JSON.stringify(t)}`);
3326
3305
  }
@@ -3329,7 +3308,7 @@ let si = class {
3329
3308
  */
3330
3309
  async init() {
3331
3310
  try {
3332
- if (oi(), this.containerRef)
3311
+ if (ii(), this.containerRef)
3333
3312
  this.containerEl = this.containerRef;
3334
3313
  else if (this.containerEl = document.getElementById(this.containerId), !this.containerEl)
3335
3314
  throw new Error(`Container "#${this.containerId}" not found. Ensure an element with id="${this.containerId}" exists in the DOM before calling imageCloud().`);
@@ -3338,7 +3317,7 @@ let si = class {
3338
3317
  onPrev: () => this.navigateToPreviousImage(),
3339
3318
  onDragOffset: (t) => this.zoomEngine.setDragOffset(t),
3340
3319
  onDragEnd: (t) => {
3341
- t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0, Ke);
3320
+ t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0, Ve);
3342
3321
  }
3343
3322
  })), this.setupUI(), this.setupEventListeners(), this.logDebug("ImageCloud initialized"), await this.loadImages();
3344
3323
  } catch (t) {
@@ -3393,7 +3372,7 @@ let si = class {
3393
3372
  navigateToNextImage() {
3394
3373
  if (this.currentFocusIndex === null || this.imageElements.length === 0) return;
3395
3374
  const t = (this.currentFocusIndex + 1) % this.imageLayouts.length, i = this.imageElements.find(
3396
- (n) => n.dataset.imageId === String(t)
3375
+ (o) => o.dataset.imageId === String(t)
3397
3376
  );
3398
3377
  if (!i) return;
3399
3378
  const e = this.imageLayouts[t];
@@ -3405,7 +3384,7 @@ let si = class {
3405
3384
  navigateToPreviousImage() {
3406
3385
  if (this.currentFocusIndex === null || this.imageElements.length === 0) return;
3407
3386
  const t = (this.currentFocusIndex - 1 + this.imageLayouts.length) % this.imageLayouts.length, i = this.imageElements.find(
3408
- (n) => n.dataset.imageId === String(t)
3387
+ (o) => o.dataset.imageId === String(t)
3409
3388
  );
3410
3389
  if (!i) return;
3411
3390
  const e = this.imageLayouts[t];
@@ -3421,8 +3400,8 @@ let si = class {
3421
3400
  }, 500));
3422
3401
  }
3423
3402
  getImageHeight() {
3424
- const t = window.innerWidth, i = this.fullConfig.layout.responsive, n = this.fullConfig.image.sizing?.maxSize ?? 400;
3425
- return i ? t <= i.mobile.maxWidth ? Math.min(100, n) : t <= i.tablet.maxWidth ? Math.min(180, n) : Math.min(225, n) : t <= 767 ? Math.min(100, n) : t <= 1199 ? Math.min(180, n) : Math.min(225, n);
3403
+ const t = window.innerWidth, i = this.fullConfig.layout.responsive, o = this.fullConfig.image.sizing?.maxSize ?? 400;
3404
+ return i ? t <= i.mobile.maxWidth ? Math.min(100, o) : t <= i.tablet.maxWidth ? Math.min(180, o) : Math.min(225, o) : t <= 767 ? Math.min(100, o) : t <= 1199 ? Math.min(180, o) : Math.min(225, o);
3426
3405
  }
3427
3406
  /**
3428
3407
  * Get container bounds for layout calculations
@@ -3445,12 +3424,12 @@ let si = class {
3445
3424
  this.showError("No images found."), this.showLoading(!1);
3446
3425
  return;
3447
3426
  }
3448
- const e = this.getContainerBounds(), n = this.getImageHeight(), s = window.innerWidth;
3449
- this.logDebug(`Adaptive sizing input: container=${e.width}x${e.height}px, images=${t}, responsiveMax=${n}px`);
3427
+ const e = this.getContainerBounds(), o = this.getImageHeight(), s = window.innerWidth;
3428
+ this.logDebug(`Adaptive sizing input: container=${e.width}x${e.height}px, images=${t}, responsiveMax=${o}px`);
3450
3429
  const r = this.layoutEngine.calculateAdaptiveSize(
3451
3430
  e,
3452
3431
  t,
3453
- n,
3432
+ o,
3454
3433
  s
3455
3434
  );
3456
3435
  this.logDebug(`Adaptive sizing result: height=${r.height}px`), await this.createImageCloud(i, r.height), this.showLoading(!1), this.imagesLoaded = !0;
@@ -3468,148 +3447,288 @@ let si = class {
3468
3447
  if (!this.containerEl) return;
3469
3448
  const e = this.getContainerBounds();
3470
3449
  this.currentImageHeight = i;
3471
- const n = this.loadGeneration, s = this.layoutEngine.generateLayout(t.length, e, { fixedHeight: i });
3472
- this.imageLayouts = s, this.displayQueue = [];
3473
- let r = 0;
3474
- const a = (l) => {
3475
- this.containerEl && (this.containerEl.appendChild(l), this.imageElements.push(l), requestAnimationFrame(() => {
3476
- 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)) {
3477
- const d = {
3478
- x: parseFloat(l.dataset.startX),
3479
- y: parseFloat(l.dataset.startY)
3480
- }, g = {
3481
- x: parseFloat(l.dataset.endX),
3482
- y: parseFloat(l.dataset.endY)
3483
- }, 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();
3484
- pe({
3450
+ const o = this.loadGeneration, s = this.layoutEngine.generateLayout(t.length, e, { fixedHeight: i });
3451
+ if (this.imageLayouts = s, this.callbacks.onLayoutComplete) {
3452
+ const l = {
3453
+ layouts: [...s],
3454
+ // shallow copy caller should not mutate
3455
+ containerBounds: { ...e },
3456
+ algorithm: this.fullConfig.layout.algorithm,
3457
+ imageCount: t.length
3458
+ };
3459
+ this.callbacks.onLayoutComplete(l);
3460
+ }
3461
+ this.displayQueue = [];
3462
+ let r = 0, a = 0, c = 0, d = 0, u = !1;
3463
+ const f = /* @__PURE__ */ new Map(), m = () => {
3464
+ if (u || o !== this.loadGeneration || !this.callbacks.onGalleryReady) return;
3465
+ u = !0;
3466
+ const l = {
3467
+ totalImages: t.length,
3468
+ failedImages: c,
3469
+ loadDuration: d > 0 ? performance.now() - d : 0
3470
+ };
3471
+ this.callbacks.onGalleryReady(l);
3472
+ }, p = () => {
3473
+ r >= t.length && this.displayQueue.length === 0 && m();
3474
+ }, w = (l) => {
3475
+ this.containerEl && (this.containerEl.appendChild(l), this.imageElements.push(l), requestAnimationFrame(async () => {
3476
+ l.offsetWidth, l.style.opacity = this.defaultStyles.opacity ?? "1";
3477
+ 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");
3478
+ if (this.callbacks.onEntryStart && h) {
3479
+ const S = {
3485
3480
  element: l,
3486
- startPosition: d,
3487
- endPosition: g,
3481
+ index: g,
3482
+ totalImages: this.imageLayouts.length,
3483
+ layout: h,
3484
+ from: { x: y, y: x, rotation: T, scale: z },
3485
+ to: { x: E, y: F, rotation: R, scale: M },
3486
+ startTime: I,
3487
+ duration: b.duration
3488
+ };
3489
+ this.callbacks.onEntryStart(S);
3490
+ }
3491
+ if (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || l.dataset.startRotation !== l.dataset.rotation || l.dataset.startScale !== l.dataset.scale)
3492
+ ge({
3493
+ element: l,
3494
+ startPosition: { x: y, y: x },
3495
+ endPosition: { x: E, y: F },
3488
3496
  pathConfig: this.entryAnimationEngine.getPathConfig(),
3489
- duration: v.duration,
3490
- imageWidth: b,
3491
- imageHeight: p,
3492
- rotation: f,
3493
- scale: m,
3497
+ duration: b.duration,
3498
+ imageWidth: k,
3499
+ imageHeight: D,
3500
+ rotation: R,
3501
+ scale: M,
3494
3502
  rotationConfig: this.entryAnimationEngine.getRotationConfig(),
3495
- startRotation: y,
3503
+ startRotation: T,
3496
3504
  scaleConfig: this.entryAnimationEngine.getScaleConfig(),
3497
- startScale: E
3505
+ startScale: z,
3506
+ onProgress: this.callbacks.onEntryProgress && h ? (S, _, $) => {
3507
+ const A = {
3508
+ element: l,
3509
+ index: g,
3510
+ totalImages: this.imageLayouts.length,
3511
+ layout: h,
3512
+ from: { x: y, y: x, rotation: T, scale: z },
3513
+ to: { x: E, y: F, rotation: R, scale: M },
3514
+ startTime: I,
3515
+ duration: b.duration,
3516
+ progress: S,
3517
+ rawProgress: S,
3518
+ elapsed: _,
3519
+ current: $
3520
+ };
3521
+ this.callbacks.onEntryProgress(A);
3522
+ } : void 0,
3523
+ onComplete: h ? () => {
3524
+ if (this.callbacks.onEntryComplete) {
3525
+ const S = {
3526
+ element: l,
3527
+ index: g,
3528
+ layout: h,
3529
+ startTime: I,
3530
+ endTime: performance.now(),
3531
+ duration: b.duration
3532
+ };
3533
+ this.callbacks.onEntryComplete(S);
3534
+ }
3535
+ } : void 0
3498
3536
  });
3499
- } else {
3500
- const d = l.dataset.finalTransform || "";
3501
- l.style.transform = d;
3537
+ else {
3538
+ const S = l.dataset.finalTransform || "";
3539
+ if (l.style.transform = S, this.callbacks.onEntryComplete && h) {
3540
+ const _ = ($) => {
3541
+ if ($.propertyName !== "transform") return;
3542
+ l.removeEventListener("transitionend", _);
3543
+ const A = {
3544
+ element: l,
3545
+ index: g,
3546
+ layout: h,
3547
+ startTime: I,
3548
+ endTime: performance.now(),
3549
+ duration: b.duration
3550
+ };
3551
+ this.callbacks.onEntryComplete(A);
3552
+ };
3553
+ l.addEventListener("transitionend", _);
3554
+ }
3502
3555
  }
3503
- const h = parseInt(l.dataset.imageId || "0");
3504
- if (this.fullConfig.config.debug?.enabled && h < 3) {
3505
- const d = l.dataset.finalTransform || "";
3506
- console.log(`Image ${h} final state:`, {
3556
+ if (this.fullConfig.config.debug?.enabled && g < 3) {
3557
+ const S = l.dataset.finalTransform || "";
3558
+ console.log(`Image ${g} final state:`, {
3507
3559
  left: l.style.left,
3508
3560
  top: l.style.top,
3509
3561
  width: l.style.width,
3510
3562
  height: l.style.height,
3511
3563
  computedWidth: l.offsetWidth,
3512
3564
  computedHeight: l.offsetHeight,
3513
- transform: d,
3565
+ transform: S,
3514
3566
  pathType: this.entryAnimationEngine.getPathType()
3515
3567
  });
3516
3568
  }
3517
3569
  if (this.idleAnimationEngine) {
3518
- const d = this.entryAnimationEngine.getTiming().duration;
3519
- this.idleAnimationEngine.register(l, h, this.imageElements.length, d);
3570
+ const S = this.entryAnimationEngine.getTiming().duration;
3571
+ this.idleAnimationEngine.register(l, g, this.imageElements.length, S);
3520
3572
  }
3521
- }), r++);
3522
- }, c = () => {
3573
+ }), r++, p());
3574
+ }, v = () => {
3523
3575
  if (this.logDebug("Starting queue processing, enabled:", this.fullConfig.animation.queue.enabled), !this.fullConfig.animation.queue.enabled) {
3524
3576
  for (; this.displayQueue.length > 0; ) {
3525
3577
  const l = this.displayQueue.shift();
3526
- l && a(l);
3578
+ l && w(l);
3527
3579
  }
3528
3580
  return;
3529
3581
  }
3530
3582
  this.queueInterval !== null && clearInterval(this.queueInterval), this.queueInterval = window.setInterval(() => {
3531
- if (n !== this.loadGeneration) {
3583
+ if (o !== this.loadGeneration) {
3532
3584
  this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null);
3533
3585
  return;
3534
3586
  }
3535
3587
  if (this.displayQueue.length > 0) {
3536
3588
  const l = this.displayQueue.shift();
3537
- l && a(l);
3589
+ l && w(l);
3538
3590
  }
3539
- r >= t.length && this.displayQueue.length === 0 && this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null);
3591
+ r >= t.length && this.displayQueue.length === 0 && (this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null), m());
3540
3592
  }, this.fullConfig.animation.queue.interval);
3541
3593
  };
3542
3594
  if ("IntersectionObserver" in window && this.containerEl) {
3543
- const l = new IntersectionObserver((u) => {
3544
- u.forEach((h) => {
3545
- h.isIntersecting && (c(), l.disconnect());
3595
+ const l = new IntersectionObserver((g) => {
3596
+ g.forEach((h) => {
3597
+ h.isIntersecting && (v(), l.disconnect());
3546
3598
  });
3547
3599
  }, { threshold: 0.1, rootMargin: "50px" });
3548
3600
  l.observe(this.containerEl);
3549
3601
  } else
3550
- c();
3551
- this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((l) => l.remove()), s.forEach((l, u) => {
3602
+ v();
3603
+ this.fullConfig.config.debug?.centers && this.containerEl && (this.containerEl.querySelectorAll(".fbn-ic-debug-center").forEach((l) => l.remove()), s.forEach((l, g) => {
3552
3604
  const h = document.createElement("div");
3553
3605
  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";
3554
- const d = l.x, g = l.y;
3555
- 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);
3556
- })), t.forEach((l, u) => {
3606
+ const b = l.x, I = l.y;
3607
+ 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);
3608
+ })), t.forEach((l, g) => {
3557
3609
  const h = document.createElement("img");
3558
- 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";
3559
- const d = s[u];
3560
- 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", () => {
3561
- if (this.hoveredImage = { element: h, layout: d }, !this.zoomEngine.isInvolved(h)) {
3562
- const g = h.cachedRenderedWidth;
3563
- st(h, this.fullConfig.styling?.hover, i, g), et(h, this.hoverClassName);
3610
+ 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";
3611
+ const b = s[g];
3612
+ 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", () => {
3613
+ if (this.hoveredImage = { element: h, layout: b }, !this.zoomEngine.isInvolved(h)) {
3614
+ const y = h.cachedRenderedWidth;
3615
+ st(h, this.fullConfig.styling?.hover, i, y), et(h, this.hoverClassName);
3616
+ }
3617
+ if (this.callbacks.onImageHover) {
3618
+ const y = { element: h, index: g, url: l, layout: b };
3619
+ this.callbacks.onImageHover(y);
3564
3620
  }
3565
3621
  }), h.addEventListener("mouseleave", () => {
3566
3622
  if (this.hoveredImage = null, !this.zoomEngine.isInvolved(h)) {
3567
- const g = h.cachedRenderedWidth;
3568
- st(h, this.fullConfig.styling?.default, i, g), pt(h, this.hoverClassName), et(h, this.defaultClassName);
3623
+ const y = h.cachedRenderedWidth;
3624
+ st(h, this.fullConfig.styling?.default, i, y), pt(h, this.hoverClassName), et(h, this.defaultClassName);
3625
+ }
3626
+ if (this.callbacks.onImageUnhover) {
3627
+ const y = { element: h, index: g, url: l, layout: b };
3628
+ this.callbacks.onImageUnhover(y);
3569
3629
  }
3570
- }), h.addEventListener("click", (g) => {
3571
- g.stopPropagation(), this.handleImageClick(h, d);
3630
+ }), h.addEventListener("click", (y) => {
3631
+ y.stopPropagation(), this.handleImageClick(h, b);
3572
3632
  }), h.style.opacity = "0", h.style.transition = this.entryAnimationEngine.getTransitionCSS(), h.onload = () => {
3573
- if (n !== this.loadGeneration)
3633
+ if (o !== this.loadGeneration)
3574
3634
  return;
3575
- const g = h.naturalWidth / h.naturalHeight, b = i * g;
3576
- 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);
3577
- const p = { x: d.x, y: d.y }, f = { width: b, height: i }, m = this.entryAnimationEngine.calculateStartPosition(
3578
- p,
3579
- f,
3635
+ const y = h.naturalWidth / h.naturalHeight, x = i * y;
3636
+ 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);
3637
+ const E = { x: b.x, y: b.y }, F = { width: x, height: i }, R = this.entryAnimationEngine.calculateStartPosition(
3638
+ E,
3639
+ F,
3580
3640
  e,
3581
- u,
3641
+ g,
3582
3642
  t.length
3583
- ), y = this.entryAnimationEngine.calculateStartRotation(d.rotation), E = this.entryAnimationEngine.calculateStartScale(d.scale), v = this.entryAnimationEngine.buildFinalTransform(
3584
- d.rotation,
3585
- d.scale,
3586
- b,
3643
+ ), M = this.entryAnimationEngine.calculateStartRotation(b.rotation), T = this.entryAnimationEngine.calculateStartScale(b.scale), z = this.entryAnimationEngine.buildFinalTransform(
3644
+ b.rotation,
3645
+ b.scale,
3646
+ x,
3587
3647
  i
3588
- ), S = this.entryAnimationEngine.buildStartTransform(
3589
- m,
3590
- p,
3591
- d.rotation,
3592
- d.scale,
3593
- b,
3648
+ ), k = this.entryAnimationEngine.buildStartTransform(
3649
+ R,
3650
+ E,
3651
+ b.rotation,
3652
+ b.scale,
3653
+ x,
3594
3654
  i,
3595
- y,
3596
- E
3655
+ M,
3656
+ T
3597
3657
  );
3598
- this.fullConfig.config.debug?.enabled && u < 3 && console.log(`Image ${u}:`, {
3599
- finalPosition: p,
3600
- imageSize: f,
3601
- left: d.x,
3602
- top: d.y,
3603
- finalTransform: v,
3604
- renderedWidth: b,
3658
+ if (this.fullConfig.config.debug?.enabled && g < 3 && console.log(`Image ${g}:`, {
3659
+ finalPosition: E,
3660
+ imageSize: F,
3661
+ left: b.x,
3662
+ top: b.y,
3663
+ finalTransform: z,
3664
+ renderedWidth: x,
3605
3665
  renderedHeight: i
3606
- }), 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);
3607
- }, h.onerror = () => r++, h.src = l;
3666
+ }), 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) {
3667
+ const D = {
3668
+ element: h,
3669
+ url: l,
3670
+ index: g,
3671
+ totalImages: t.length,
3672
+ loadTime: performance.now() - (f.get(g) ?? performance.now())
3673
+ };
3674
+ this.callbacks.onImageLoaded(D);
3675
+ }
3676
+ if (this.callbacks.onLoadProgress) {
3677
+ const D = {
3678
+ loaded: a,
3679
+ failed: c,
3680
+ total: t.length,
3681
+ percent: (a + c) / t.length * 100
3682
+ };
3683
+ this.callbacks.onLoadProgress(D);
3684
+ }
3685
+ this.displayQueue.push(h);
3686
+ };
3687
+ const I = () => {
3688
+ if (o === this.loadGeneration) {
3689
+ if (c++, this.callbacks.onImageError) {
3690
+ const y = { url: l, index: g, totalImages: t.length };
3691
+ this.callbacks.onImageError(y);
3692
+ }
3693
+ if (this.callbacks.onLoadProgress) {
3694
+ const y = {
3695
+ loaded: a,
3696
+ failed: c,
3697
+ total: t.length,
3698
+ percent: (a + c) / t.length * 100
3699
+ };
3700
+ this.callbacks.onLoadProgress(y);
3701
+ }
3702
+ r++, p();
3703
+ }
3704
+ };
3705
+ h.onerror = () => I(), (async () => {
3706
+ let y = l;
3707
+ if (this.callbacks.onBeforeImageLoad) {
3708
+ const x = { url: l, index: g, totalImages: t.length }, E = await this.callbacks.onBeforeImageLoad(x);
3709
+ if (E)
3710
+ if (E.fetch !== void 0) {
3711
+ const F = E.url ?? l;
3712
+ try {
3713
+ const M = await (await fetch(F, E.fetch)).blob(), T = URL.createObjectURL(M);
3714
+ y = T;
3715
+ const z = h.onload;
3716
+ h.onload = (k) => {
3717
+ URL.revokeObjectURL(T), z?.call(h, k);
3718
+ };
3719
+ } catch {
3720
+ I();
3721
+ return;
3722
+ }
3723
+ } else E.url && (y = E.url);
3724
+ }
3725
+ d === 0 && (d = performance.now()), f.set(g, performance.now()), h.src = y;
3726
+ })();
3608
3727
  });
3609
3728
  }
3610
3729
  async handleImageClick(t, i) {
3611
3730
  if (!this.containerEl) return;
3612
- const e = this.zoomEngine.isFocused(t), n = {
3731
+ const e = this.zoomEngine.isFocused(t), o = {
3613
3732
  width: this.containerEl.offsetWidth,
3614
3733
  height: this.containerEl.offsetHeight
3615
3734
  };
@@ -3618,7 +3737,15 @@ let si = class {
3618
3737
  else {
3619
3738
  this.idleAnimationEngine?.pauseForImage(t);
3620
3739
  const s = t.dataset.imageId;
3621
- 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();
3740
+ if (this.currentFocusIndex = s !== void 0 ? parseInt(s, 10) : null, this.swipeEngine?.enable(), this.containerEl?.focus({ preventScroll: !0 }), await this.zoomEngine.focusImage(t, o, i), this.currentFocusIndex !== null && this.updateCounter(this.currentFocusIndex), this.showNavButtons(), this.showFocusIndicator(), this.callbacks.onImageFocus && this.currentFocusIndex !== null) {
3741
+ const r = this.imageLoader.imageURLs(), a = {
3742
+ element: t,
3743
+ index: this.currentFocusIndex,
3744
+ url: r[this.currentFocusIndex] ?? "",
3745
+ layout: i
3746
+ };
3747
+ this.callbacks.onImageFocus(a);
3748
+ }
3622
3749
  }
3623
3750
  }
3624
3751
  /**
@@ -3661,7 +3788,7 @@ let si = class {
3661
3788
  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;
3662
3789
  }
3663
3790
  };
3664
- const ci = Ht({
3791
+ const ai = kt({
3665
3792
  name: "ImageCloud",
3666
3793
  props: {
3667
3794
  options: {
@@ -3669,27 +3796,27 @@ const ci = Ht({
3669
3796
  required: !0
3670
3797
  }
3671
3798
  },
3672
- setup(o, { expose: t }) {
3673
- const i = It(null), e = It(null);
3674
- function n() {
3799
+ setup(n, { expose: t }) {
3800
+ const i = St(null), e = St(null);
3801
+ function o() {
3675
3802
  if (!i.value) return;
3676
3803
  e.value?.destroy();
3677
- const s = new si({
3804
+ const s = new oi({
3678
3805
  container: i.value,
3679
- ...o.options
3806
+ ...n.options
3680
3807
  });
3681
3808
  e.value = s, s.init().catch((r) => {
3682
3809
  console.error("ImageCloud init failed:", r);
3683
3810
  });
3684
3811
  }
3685
- return Nt(() => {
3686
- n();
3687
- }), kt(() => {
3812
+ return Ht(() => {
3813
+ o();
3814
+ }), Nt(() => {
3688
3815
  e.value?.destroy(), e.value = null;
3689
3816
  }), Bt(
3690
- () => o.options,
3817
+ () => n.options,
3691
3818
  () => {
3692
- n();
3819
+ o();
3693
3820
  },
3694
3821
  { deep: !0 }
3695
3822
  ), t({ instance: e }), () => jt("div", {
@@ -3698,6 +3825,6 @@ const ci = Ht({
3698
3825
  }
3699
3826
  });
3700
3827
  export {
3701
- ci as ImageCloud
3828
+ ai as ImageCloud
3702
3829
  };
3703
3830
  //# sourceMappingURL=vue.js.map