@frybynite/image-cloud 0.3.1 → 0.3.3

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.
@@ -4,16 +4,16 @@ const Et = Object.freeze({
4
4
  md: "0 4px 16px rgba(0,0,0,0.4)",
5
5
  lg: "0 8px 32px rgba(0,0,0,0.5)",
6
6
  glow: "0 0 30px rgba(255,255,255,0.6)"
7
- }), zt = Object.freeze({
7
+ }), Ct = Object.freeze({
8
8
  energetic: Object.freeze({ overshoot: 0.25, bounces: 2, decayRatio: 0.5 }),
9
9
  playful: Object.freeze({ overshoot: 0.15, bounces: 1, decayRatio: 0.5 }),
10
10
  subtle: Object.freeze({ overshoot: 0.08, bounces: 1, decayRatio: 0.5 })
11
- }), Ct = Object.freeze({
11
+ }), Lt = Object.freeze({
12
12
  gentle: Object.freeze({ stiffness: 150, damping: 30, mass: 1, oscillations: 2 }),
13
13
  bouncy: Object.freeze({ stiffness: 300, damping: 15, mass: 1, oscillations: 4 }),
14
14
  wobbly: Object.freeze({ stiffness: 180, damping: 12, mass: 1.5, oscillations: 5 }),
15
15
  snappy: Object.freeze({ stiffness: 400, damping: 25, mass: 0.8, oscillations: 2 })
16
- }), Ft = Object.freeze({
16
+ }), zt = Object.freeze({
17
17
  gentle: Object.freeze({ amplitude: 30, frequency: 1.5, decay: !0, decayRate: 0.9, phase: 0 }),
18
18
  playful: Object.freeze({ amplitude: 50, frequency: 2.5, decay: !0, decayRate: 0.7, phase: 0 }),
19
19
  serpentine: Object.freeze({ amplitude: 60, frequency: 3, decay: !1, decayRate: 1, phase: 0 }),
@@ -386,13 +386,13 @@ function Jt(o = {}) {
386
386
  })), o.debug !== void 0 && (s.debug = o.debug), s;
387
387
  }
388
388
  function Vt(o, t) {
389
- return { ...o ? zt[o] : zt.playful, ...t };
389
+ return { ...o ? Ct[o] : Ct.playful, ...t };
390
390
  }
391
391
  function Kt(o, t) {
392
- return { ...o ? Ct[o] : Ct.gentle, ...t };
392
+ return { ...o ? Lt[o] : Lt.gentle, ...t };
393
393
  }
394
394
  function Zt(o, t) {
395
- return { ...o ? Ft[o] : Ft.gentle, ...t };
395
+ return { ...o ? zt[o] : zt.gentle, ...t };
396
396
  }
397
397
  class Qt {
398
398
  constructor(t) {
@@ -660,7 +660,7 @@ function re(o) {
660
660
  }
661
661
  const N = performance.now(), P = -r / 2, D = -s / 2;
662
662
  function U(j) {
663
- const C = j - N, x = Math.min(C / a, 1);
663
+ const L = j - N, x = Math.min(L / a, 1);
664
664
  let A;
665
665
  switch (p) {
666
666
  case "bounce": {
@@ -693,11 +693,11 @@ function re(o) {
693
693
  y: st(e.y, i.y, x)
694
694
  };
695
695
  }
696
- const O = A.x - i.x, z = A.y - i.y;
696
+ const O = A.x - i.x, C = A.y - i.y;
697
697
  let T;
698
698
  f ? T = se(x, h, y) : g ? T = st(d, h, x) : T = h;
699
699
  let M;
700
- R ? M = ae(x, l, w) : I ? M = st(b, l, x) : M = l, t.style.transform = `translate(${P}px, ${D}px) translate(${O}px, ${z}px) rotate(${T}deg) scale(${M})`, x < 1 ? requestAnimationFrame(U) : (t.style.transform = `translate(${P}px, ${D}px) rotate(${h}deg) scale(${l})`, u && u());
700
+ R ? M = ae(x, l, w) : I ? M = st(b, l, x) : M = l, t.style.transform = `translate(${P}px, ${D}px) translate(${O}px, ${C}px) rotate(${T}deg) scale(${M})`, x < 1 ? requestAnimationFrame(U) : (t.style.transform = `translate(${P}px, ${D}px) rotate(${h}deg) scale(${l})`, u && u());
701
701
  }
702
702
  requestAnimationFrame(U);
703
703
  }
@@ -1068,13 +1068,13 @@ class de {
1068
1068
  * @returns Array of layout objects with position, rotation, scale
1069
1069
  */
1070
1070
  generate(t, e, i = {}) {
1071
- var w, L, N, P, D, U, j, C, x;
1072
- const n = [], { width: a, height: r } = e, s = this.config.spacing.padding, h = i.fixedHeight ?? 200, l = ((w = this.imageConfig.rotation) == null ? void 0 : w.mode) ?? "none", u = ((N = (L = this.imageConfig.rotation) == null ? void 0 : L.range) == null ? void 0 : N.min) ?? -15, c = ((D = (P = this.imageConfig.rotation) == null ? void 0 : P.range) == null ? void 0 : D.max) ?? 15, d = ((j = (U = this.imageConfig.sizing) == null ? void 0 : U.variance) == null ? void 0 : j.min) ?? 1, m = ((x = (C = this.imageConfig.sizing) == null ? void 0 : C.variance) == null ? void 0 : x.max) ?? 1, b = d !== 1 || m !== 1, g = h * 1.5 / 2, f = h / 2, y = a - s - g, v = r - s - f, I = s + g, R = s + f;
1071
+ var w, F, N, P, D, U, j, L, x;
1072
+ const n = [], { width: a, height: r } = e, s = this.config.spacing.padding, h = i.fixedHeight ?? 200, l = ((w = this.imageConfig.rotation) == null ? void 0 : w.mode) ?? "none", u = ((N = (F = this.imageConfig.rotation) == null ? void 0 : F.range) == null ? void 0 : N.min) ?? -15, c = ((D = (P = this.imageConfig.rotation) == null ? void 0 : P.range) == null ? void 0 : D.max) ?? 15, d = ((j = (U = this.imageConfig.sizing) == null ? void 0 : U.variance) == null ? void 0 : j.min) ?? 1, m = ((x = (L = this.imageConfig.sizing) == null ? void 0 : L.variance) == null ? void 0 : x.max) ?? 1, b = d !== 1 || m !== 1, g = h * 1.5 / 2, f = h / 2, y = a - s - g, v = r - s - f, I = s + g, R = s + f;
1073
1073
  for (let A = 0; A < t; A++) {
1074
- const O = this.random(I, y), z = this.random(R, v), T = l === "random" ? this.random(u, c) : 0, M = b ? this.random(d, m) : 1, H = h * M, K = {
1074
+ const O = this.random(I, y), C = this.random(R, v), T = l === "random" ? this.random(u, c) : 0, M = b ? this.random(d, m) : 1, H = h * M, K = {
1075
1075
  id: A,
1076
1076
  x: O,
1077
- y: z,
1077
+ y: C,
1078
1078
  rotation: T,
1079
1079
  scale: M,
1080
1080
  baseSize: H
@@ -1105,10 +1105,10 @@ class ue {
1105
1105
  * @returns Array of layout objects with position, rotation, scale
1106
1106
  */
1107
1107
  generate(t, e, i = {}) {
1108
- var L, N, P, D, U, j, C, x, A;
1109
- const n = [], { width: a, height: r } = e, { debugRadials: s } = this.config, h = i.fixedHeight ?? 200, l = ((L = this.imageConfig.rotation) == null ? void 0 : L.mode) ?? "none", u = ((P = (N = this.imageConfig.rotation) == null ? void 0 : N.range) == null ? void 0 : P.min) ?? -15, c = ((U = (D = this.imageConfig.rotation) == null ? void 0 : D.range) == null ? void 0 : U.max) ?? 15, d = ((C = (j = this.imageConfig.sizing) == null ? void 0 : j.variance) == null ? void 0 : C.min) ?? 1, m = ((A = (x = this.imageConfig.sizing) == null ? void 0 : x.variance) == null ? void 0 : A.max) ?? 1, b = d !== 1 || m !== 1, p = this.config.scaleDecay ?? 0, g = ["green", "blue", "red", "yellow", "orange", "purple"], f = i.fixedHeight ?? h, y = a / 2, v = r / 2, I = Math.ceil(Math.sqrt(t));
1108
+ var F, N, P, D, U, j, L, x, A;
1109
+ const n = [], { width: a, height: r } = e, { debugRadials: s } = this.config, h = i.fixedHeight ?? 200, l = ((F = this.imageConfig.rotation) == null ? void 0 : F.mode) ?? "none", u = ((P = (N = this.imageConfig.rotation) == null ? void 0 : N.range) == null ? void 0 : P.min) ?? -15, c = ((U = (D = this.imageConfig.rotation) == null ? void 0 : D.range) == null ? void 0 : U.max) ?? 15, d = ((L = (j = this.imageConfig.sizing) == null ? void 0 : j.variance) == null ? void 0 : L.min) ?? 1, m = ((A = (x = this.imageConfig.sizing) == null ? void 0 : x.variance) == null ? void 0 : A.max) ?? 1, b = d !== 1 || m !== 1, p = this.config.scaleDecay ?? 0, g = ["green", "blue", "red", "yellow", "orange", "purple"], f = i.fixedHeight ?? h, y = a / 2, v = r / 2, I = Math.ceil(Math.sqrt(t));
1110
1110
  if (t > 0) {
1111
- const O = b ? this.random(d, m) : 1, z = f * O;
1111
+ const O = b ? this.random(d, m) : 1, C = f * O;
1112
1112
  n.push({
1113
1113
  id: 0,
1114
1114
  x: y,
@@ -1116,7 +1116,7 @@ class ue {
1116
1116
  rotation: l === "random" ? this.random(u * 0.33, c * 0.33) : 0,
1117
1117
  // Less rotation for center
1118
1118
  scale: O,
1119
- baseSize: z,
1119
+ baseSize: C,
1120
1120
  zIndex: 100,
1121
1121
  // Center image is highest
1122
1122
  borderColor: s ? "cyan" : void 0
@@ -1124,22 +1124,22 @@ class ue {
1124
1124
  }
1125
1125
  let R = 1, w = 1;
1126
1126
  for (; R < t; ) {
1127
- const O = w / I, z = p > 0 ? 1 - O * p * 0.5 : 1, T = w * (f * 0.8), M = T * 1.5, H = Math.PI * (3 * (M + T) - Math.sqrt((3 * M + T) * (M + 3 * T))), K = this.estimateWidth(f), X = Math.floor(H / (K * 0.7));
1127
+ const O = w / I, C = p > 0 ? 1 - O * p * 0.5 : 1, T = w * (f * 0.8), M = T * 1.5, H = Math.PI * (3 * (M + T) - Math.sqrt((3 * M + T) * (M + 3 * T))), K = this.estimateWidth(f), X = Math.floor(H / (K * 0.7));
1128
1128
  if (X === 0) {
1129
1129
  w++;
1130
1130
  continue;
1131
1131
  }
1132
1132
  const B = 2 * Math.PI / X, Z = w * (20 * Math.PI / 180);
1133
1133
  for (let W = 0; W < X && R < t; W++) {
1134
- const Q = W * B + Z, tt = b ? this.random(d, m) : 1, q = z * tt, et = f * q;
1135
- let Y = y + Math.cos(Q) * M, F = v + Math.sin(Q) * T;
1134
+ const Q = W * B + Z, tt = b ? this.random(d, m) : 1, q = C * tt, et = f * q;
1135
+ let Y = y + Math.cos(Q) * M, z = v + Math.sin(Q) * T;
1136
1136
  const $ = this.config.spacing.padding ?? 50, G = et * 1.5 / 2, _ = et / 2;
1137
- Y - G < $ ? Y = $ + G : Y + G > a - $ && (Y = a - $ - G), F - _ < $ ? F = $ + _ : F + _ > r - $ && (F = r - $ - _);
1137
+ Y - G < $ ? Y = $ + G : Y + G > a - $ && (Y = a - $ - G), z - _ < $ ? z = $ + _ : z + _ > r - $ && (z = r - $ - _);
1138
1138
  const it = l === "random" ? this.random(u, c) : 0;
1139
1139
  n.push({
1140
1140
  id: R,
1141
1141
  x: Y,
1142
- y: F,
1142
+ y: z,
1143
1143
  rotation: it,
1144
1144
  scale: q,
1145
1145
  baseSize: et,
@@ -1181,7 +1181,7 @@ const ge = {
1181
1181
  alignment: "center",
1182
1182
  gap: 10,
1183
1183
  overflowOffset: 0.25
1184
- }, Lt = [
1184
+ }, Ft = [
1185
1185
  { x: 1, y: 1 },
1186
1186
  // bottom-right
1187
1187
  { x: -1, y: -1 },
@@ -1218,32 +1218,32 @@ class fe {
1218
1218
  p,
1219
1219
  l,
1220
1220
  s
1221
- ), y = s.stagger === "row", v = s.stagger === "column", I = y ? g + 0.5 : g, R = v ? f + 0.5 : f, w = (b - s.gap * (g - 1)) / I, L = (p - s.gap * (f - 1)) / R, N = y ? w / 2 : 0, P = v ? L / 2 : 0, D = 1 + s.overlap, U = Math.min(w, L) * D, j = i.fixedHeight ? Math.min(i.fixedHeight, U) : U, C = g * w + (g - 1) * s.gap + N, x = f * L + (f - 1) * s.gap + P, A = h + (b - C) / 2, O = h + (p - x) / 2, z = g * f, T = s.columns !== "auto" && s.rows !== "auto", M = T && t > z;
1221
+ ), y = s.stagger === "row", v = s.stagger === "column", I = y ? g + 0.5 : g, R = v ? f + 0.5 : f, w = (b - s.gap * (g - 1)) / I, F = (p - s.gap * (f - 1)) / R, N = y ? w / 2 : 0, P = v ? F / 2 : 0, D = 1 + s.overlap, U = Math.min(w, F) * D, j = i.fixedHeight ? Math.min(i.fixedHeight, U) : U, L = g * w + (g - 1) * s.gap + N, x = f * F + (f - 1) * s.gap + P, A = h + (b - L) / 2, O = h + (p - x) / 2, C = g * f, T = s.columns !== "auto" && s.rows !== "auto", M = T && t > C;
1222
1222
  typeof window < "u" && (window.__gridOverflowDebug = {
1223
1223
  gridConfigColumns: s.columns,
1224
1224
  gridConfigRows: s.rows,
1225
1225
  columns: g,
1226
1226
  rows: f,
1227
- cellCount: z,
1227
+ cellCount: C,
1228
1228
  hasFixedGrid: T,
1229
1229
  imageCount: t,
1230
1230
  isOverflowMode: M
1231
1231
  });
1232
- const H = M ? new Array(z).fill(0) : [], K = Math.min(w, L) * s.overflowOffset;
1233
- for (let F = 0; F < t; F++) {
1232
+ const H = M ? new Array(C).fill(0) : [], K = Math.min(w, F) * s.overflowOffset;
1233
+ for (let z = 0; z < t; z++) {
1234
1234
  let $, k, G = 0;
1235
- if (M && F >= z) {
1236
- const V = F - z, J = V % z;
1237
- G = Math.floor(V / z) + 1, H[J]++, s.fillDirection === "row" ? ($ = J % g, k = Math.floor(J / g)) : (k = J % f, $ = Math.floor(J / f));
1235
+ if (M && z >= C) {
1236
+ const V = z - C, J = V % C;
1237
+ G = Math.floor(V / C) + 1, H[J]++, s.fillDirection === "row" ? ($ = J % g, k = Math.floor(J / g)) : (k = J % f, $ = Math.floor(J / f));
1238
1238
  } else
1239
- s.fillDirection === "row" ? ($ = F % g, k = Math.floor(F / g)) : (k = F % f, $ = Math.floor(F / f));
1240
- let _ = A + $ * (w + s.gap) + w / 2, it = O + k * (L + s.gap) + L / 2;
1241
- if (s.stagger === "row" && k % 2 === 1 ? _ += w / 2 : s.stagger === "column" && $ % 2 === 1 && (it += L / 2), G > 0) {
1242
- const V = (G - 1) % Lt.length, J = Lt[V];
1239
+ s.fillDirection === "row" ? ($ = z % g, k = Math.floor(z / g)) : (k = z % f, $ = Math.floor(z / f));
1240
+ let _ = A + $ * (w + s.gap) + w / 2, it = O + k * (F + s.gap) + F / 2;
1241
+ if (s.stagger === "row" && k % 2 === 1 ? _ += w / 2 : s.stagger === "column" && $ % 2 === 1 && (it += F / 2), G > 0) {
1242
+ const V = (G - 1) % Ft.length, J = Ft[V];
1243
1243
  _ += J.x * K, it += J.y * K;
1244
1244
  }
1245
1245
  if (s.jitter > 0) {
1246
- const V = w / 2 * s.jitter, J = L / 2 * s.jitter;
1246
+ const V = w / 2 * s.jitter, J = F / 2 * s.jitter;
1247
1247
  _ += this.random(-V, V), it += this.random(-J, J);
1248
1248
  }
1249
1249
  let nt = _, ot = it;
@@ -1252,7 +1252,7 @@ class fe {
1252
1252
  if (k === Math.floor((t - 1) / g) && V < g) {
1253
1253
  const Mt = V * w + (V - 1) * s.gap;
1254
1254
  let St = 0;
1255
- s.alignment === "center" ? St = (C - Mt) / 2 : s.alignment === "end" && (St = C - Mt), nt += St;
1255
+ s.alignment === "center" ? St = (L - Mt) / 2 : s.alignment === "end" && (St = L - Mt), nt += St;
1256
1256
  }
1257
1257
  }
1258
1258
  const pt = m ? this.random(c, d) : 1, at = j * pt, dt = at * 1.5 / 2, ut = at / 2, yt = h + dt, vt = a - h - dt, Ht = h + ut, Nt = r - h - ut;
@@ -1263,8 +1263,8 @@ class fe {
1263
1263
  s.jitter > 0 ? wt = this.random(V * s.jitter, J * s.jitter) : wt = this.random(V, J);
1264
1264
  }
1265
1265
  let xt;
1266
- M && G > 0 ? xt = 50 - G : xt = M ? 100 + F : F + 1, n.push({
1267
- id: F,
1266
+ M && G > 0 ? xt = 50 - G : xt = M ? 100 + z : z + 1, n.push({
1267
+ id: z,
1268
1268
  x: nt,
1269
1269
  y: ot,
1270
1270
  rotation: wt,
@@ -1319,8 +1319,8 @@ class be {
1319
1319
  * @returns Array of layout objects with position, rotation, scale
1320
1320
  */
1321
1321
  generate(t, e, i = {}) {
1322
- var R, w, L, N, P, D, U, j, C;
1323
- const n = [], { width: a, height: r } = e, s = { ...pe, ...this.config.spiral }, h = this.config.spacing.padding, l = i.fixedHeight ?? 200, u = ((R = this.imageConfig.rotation) == null ? void 0 : R.mode) ?? "none", c = ((L = (w = this.imageConfig.rotation) == null ? void 0 : w.range) == null ? void 0 : L.min) ?? -15, d = ((P = (N = this.imageConfig.rotation) == null ? void 0 : N.range) == null ? void 0 : P.max) ?? 15, m = ((U = (D = this.imageConfig.sizing) == null ? void 0 : D.variance) == null ? void 0 : U.min) ?? 1, b = ((C = (j = this.imageConfig.sizing) == null ? void 0 : j.variance) == null ? void 0 : C.max) ?? 1, p = m !== 1 || b !== 1, g = this.config.scaleDecay ?? s.scaleDecay, f = a / 2, y = r / 2, v = Math.min(
1322
+ var R, w, F, N, P, D, U, j, L;
1323
+ const n = [], { width: a, height: r } = e, s = { ...pe, ...this.config.spiral }, h = this.config.spacing.padding, l = i.fixedHeight ?? 200, u = ((R = this.imageConfig.rotation) == null ? void 0 : R.mode) ?? "none", c = ((F = (w = this.imageConfig.rotation) == null ? void 0 : w.range) == null ? void 0 : F.min) ?? -15, d = ((P = (N = this.imageConfig.rotation) == null ? void 0 : N.range) == null ? void 0 : P.max) ?? 15, m = ((U = (D = this.imageConfig.sizing) == null ? void 0 : D.variance) == null ? void 0 : U.min) ?? 1, b = ((L = (j = this.imageConfig.sizing) == null ? void 0 : j.variance) == null ? void 0 : L.max) ?? 1, p = m !== 1 || b !== 1, g = this.config.scaleDecay ?? s.scaleDecay, f = a / 2, y = r / 2, v = Math.min(
1324
1324
  f - h - l / 2,
1325
1325
  y - h - l / 2
1326
1326
  ), I = s.direction === "clockwise" ? -1 : 1;
@@ -1335,7 +1335,7 @@ class be {
1335
1335
  const _ = x * 0.3 * s.tightness;
1336
1336
  A = _ * I + s.startAngle, O = this.calculateLogarithmicRadius(_, t, v, s.tightness);
1337
1337
  }
1338
- const z = f + Math.cos(A) * O, T = y + Math.sin(A) * O, M = O / v, H = g > 0 ? 1 - M * g * 0.5 : 1, K = p ? this.random(m, b) : 1, X = H * K, B = l * X, W = B * 1.5 / 2, Q = B / 2, tt = h + W, q = a - h - W, et = h + Q, Y = r - h - Q, F = Math.max(tt, Math.min(z, q)), $ = Math.max(et, Math.min(T, Y));
1338
+ const C = f + Math.cos(A) * O, T = y + Math.sin(A) * O, M = O / v, H = g > 0 ? 1 - M * g * 0.5 : 1, K = p ? this.random(m, b) : 1, X = H * K, B = l * X, W = B * 1.5 / 2, Q = B / 2, tt = h + W, q = a - h - W, et = h + Q, Y = r - h - Q, z = Math.max(tt, Math.min(C, q)), $ = Math.max(et, Math.min(T, Y));
1339
1339
  let k = 0;
1340
1340
  if (u === "random") {
1341
1341
  const _ = A * 180 / Math.PI % 360, it = this.random(c, d);
@@ -1344,7 +1344,7 @@ class be {
1344
1344
  const G = t - x;
1345
1345
  n.push({
1346
1346
  id: x,
1347
- x: F,
1347
+ x: z,
1348
1348
  y: $,
1349
1349
  rotation: k,
1350
1350
  scale: X,
@@ -1422,8 +1422,8 @@ class ve {
1422
1422
  * @returns Array of layout objects with position, rotation, scale
1423
1423
  */
1424
1424
  generate(t, e, i = {}) {
1425
- var I, R, w, L, N, P, D, U, j;
1426
- const n = [], { width: a, height: r } = e, s = { ...ye, ...this.config.cluster }, h = this.config.spacing.padding, l = i.fixedHeight ?? 200, u = ((I = this.imageConfig.rotation) == null ? void 0 : I.mode) ?? "none", c = ((w = (R = this.imageConfig.rotation) == null ? void 0 : R.range) == null ? void 0 : w.min) ?? -15, d = ((N = (L = this.imageConfig.rotation) == null ? void 0 : L.range) == null ? void 0 : N.max) ?? 15, m = ((D = (P = this.imageConfig.sizing) == null ? void 0 : P.variance) == null ? void 0 : D.min) ?? 1, b = ((j = (U = this.imageConfig.sizing) == null ? void 0 : U.variance) == null ? void 0 : j.max) ?? 1, p = m !== 1 || b !== 1, g = this.calculateClusterCount(
1425
+ var I, R, w, F, N, P, D, U, j;
1426
+ const n = [], { width: a, height: r } = e, s = { ...ye, ...this.config.cluster }, h = this.config.spacing.padding, l = i.fixedHeight ?? 200, u = ((I = this.imageConfig.rotation) == null ? void 0 : I.mode) ?? "none", c = ((w = (R = this.imageConfig.rotation) == null ? void 0 : R.range) == null ? void 0 : w.min) ?? -15, d = ((N = (F = this.imageConfig.rotation) == null ? void 0 : F.range) == null ? void 0 : N.max) ?? 15, m = ((D = (P = this.imageConfig.sizing) == null ? void 0 : P.variance) == null ? void 0 : D.min) ?? 1, b = ((j = (U = this.imageConfig.sizing) == null ? void 0 : U.variance) == null ? void 0 : j.max) ?? 1, p = m !== 1 || b !== 1, g = this.calculateClusterCount(
1427
1427
  t,
1428
1428
  s.clusterCount,
1429
1429
  a,
@@ -1436,26 +1436,26 @@ class ve {
1436
1436
  h,
1437
1437
  s
1438
1438
  ), y = new Array(g).fill(0);
1439
- for (let C = 0; C < t; C++)
1440
- y[C % g]++;
1439
+ for (let L = 0; L < t; L++)
1440
+ y[L % g]++;
1441
1441
  let v = 0;
1442
- for (let C = 0; C < g; C++) {
1443
- const x = f[C], A = y[C];
1442
+ for (let L = 0; L < g; L++) {
1443
+ const x = f[L], A = y[L];
1444
1444
  for (let O = 0; O < A; O++) {
1445
- let z, T;
1445
+ let C, T;
1446
1446
  if (s.distribution === "gaussian")
1447
- z = this.gaussianRandom() * x.spread, T = this.gaussianRandom() * x.spread;
1447
+ C = this.gaussianRandom() * x.spread, T = this.gaussianRandom() * x.spread;
1448
1448
  else {
1449
1449
  const k = this.random(0, Math.PI * 2), G = this.random(0, x.spread);
1450
- z = Math.cos(k) * G, T = Math.sin(k) * G;
1450
+ C = Math.cos(k) * G, T = Math.sin(k) * G;
1451
1451
  }
1452
1452
  const M = 1 + s.overlap * 0.5, H = 1 + s.overlap * 0.3;
1453
- z /= M, T /= M;
1453
+ C /= M, T /= M;
1454
1454
  const K = p ? this.random(m, b) : 1, X = H * K, B = l * X;
1455
- let Z = x.x + z, W = x.y + T;
1455
+ let Z = x.x + C, W = x.y + T;
1456
1456
  const tt = B * 1.5 / 2, q = B / 2;
1457
1457
  Z = Math.max(h + tt, Math.min(Z, a - h - tt)), W = Math.max(h + q, Math.min(W, r - h - q));
1458
- const et = u === "random" ? this.random(c, d) : 0, F = Math.sqrt(z * z + T * T) / x.spread, $ = Math.round((1 - F) * 50) + 1;
1458
+ const et = u === "random" ? this.random(c, d) : 0, z = Math.sqrt(C * C + T * T) / x.spread, $ = Math.round((1 - z) * 50) + 1;
1459
1459
  n.push({
1460
1460
  id: v,
1461
1461
  x: Z,
@@ -1545,14 +1545,14 @@ class we {
1545
1545
  const n = [], { width: a, height: r } = e, s = i.fixedHeight ?? 200, h = this.config.spacing.padding ?? 50, l = ((M = this.imageConfig.rotation) == null ? void 0 : M.mode) ?? "none", u = ((K = (H = this.imageConfig.rotation) == null ? void 0 : H.range) == null ? void 0 : K.min) ?? -15, c = ((B = (X = this.imageConfig.rotation) == null ? void 0 : X.range) == null ? void 0 : B.max) ?? 15, d = ((W = (Z = this.imageConfig.sizing) == null ? void 0 : Z.variance) == null ? void 0 : W.min) ?? 1, m = ((tt = (Q = this.imageConfig.sizing) == null ? void 0 : Q.variance) == null ? void 0 : tt.max) ?? 1, b = d !== 1 || m !== 1, p = i.fixedHeight ?? s, g = {
1546
1546
  ...jt,
1547
1547
  ...this.config.wave
1548
- }, { rows: f, amplitude: y, frequency: v, phaseShift: I, synchronization: R } = g, w = Math.ceil(t / f), P = p * 1.5 / 2, D = h + P, U = a - h - P, j = U - D, C = w > 1 ? j / (w - 1) : 0, x = h + y + p / 2, A = r - h - y - p / 2, O = A - x, z = f > 1 ? O / (f - 1) : 0;
1548
+ }, { rows: f, amplitude: y, frequency: v, phaseShift: I, synchronization: R } = g, w = Math.ceil(t / f), P = p * 1.5 / 2, D = h + P, U = a - h - P, j = U - D, L = w > 1 ? j / (w - 1) : 0, x = h + y + p / 2, A = r - h - y - p / 2, O = A - x, C = f > 1 ? O / (f - 1) : 0;
1549
1549
  let T = 0;
1550
1550
  for (let q = 0; q < f && T < t; q++) {
1551
- const et = f === 1 ? (x + A) / 2 : x + q * z;
1551
+ const et = f === 1 ? (x + A) / 2 : x + q * C;
1552
1552
  let Y = 0;
1553
1553
  R === "offset" ? Y = q * I : R === "alternating" && (Y = q * Math.PI);
1554
- for (let F = 0; F < w && T < t; F++) {
1555
- const $ = w === 1 ? (D + U) / 2 : D + F * C, k = this.calculateWaveY($, a, y, v, Y), G = $, _ = et + k, it = b ? this.random(d, m) : 1, nt = p * it;
1554
+ for (let z = 0; z < w && T < t; z++) {
1555
+ const $ = w === 1 ? (D + U) / 2 : D + z * L, k = this.calculateWaveY($, a, y, v, Y), G = $, _ = et + k, it = b ? this.random(d, m) : 1, nt = p * it;
1556
1556
  let ot = 0;
1557
1557
  l === "tangent" ? ot = this.calculateRotation($, a, y, v, Y) : l === "random" && (ot = this.random(u, c));
1558
1558
  const at = nt * 1.5 / 2, bt = nt / 2, dt = h + at, ut = a - h - at, yt = h + bt, vt = r - h - bt;
@@ -2271,7 +2271,7 @@ class Te {
2271
2271
  ), this.state = E.IDLE, this.currentFocus = null, this.focusData = null, this.outgoing = null, this.incoming = null;
2272
2272
  }
2273
2273
  }
2274
- const Re = 50, Ae = 0.5, Me = 20, ze = 0.3, Ce = 150, Fe = 30, mt = class mt {
2274
+ const Re = 50, Ae = 0.5, Me = 20, Ce = 0.3, Le = 150, ze = 30, mt = class mt {
2275
2275
  constructor(t, e) {
2276
2276
  this.enabled = !1, this.touchState = null, this.recentTouchTimestamp = 0, this.container = t, this.callbacks = e, this.boundTouchStart = this.handleTouchStart.bind(this), this.boundTouchMove = this.handleTouchMove.bind(this), this.boundTouchEnd = this.handleTouchEnd.bind(this), this.boundTouchCancel = this.handleTouchCancel.bind(this);
2277
2277
  }
@@ -2319,11 +2319,11 @@ const Re = 50, Ae = 0.5, Me = 20, ze = 0.3, Ce = 150, Fe = 30, mt = class mt {
2319
2319
  const e = t.touches[0], i = e.clientX - this.touchState.startX, n = e.clientY - this.touchState.startY;
2320
2320
  if (this.touchState.isHorizontalSwipe === null && Math.sqrt(i * i + n * n) > 10) {
2321
2321
  const s = Math.atan2(Math.abs(n), Math.abs(i)) * (180 / Math.PI);
2322
- this.touchState.isHorizontalSwipe = s <= Fe;
2322
+ this.touchState.isHorizontalSwipe = s <= ze;
2323
2323
  }
2324
2324
  if (this.touchState.isHorizontalSwipe !== !1 && this.touchState.isHorizontalSwipe === !0) {
2325
2325
  t.preventDefault(), this.touchState.isDragging = !0, this.touchState.currentX = e.clientX;
2326
- const a = i * ze;
2326
+ const a = i * Ce;
2327
2327
  this.callbacks.onDragOffset(a);
2328
2328
  }
2329
2329
  }
@@ -2341,7 +2341,7 @@ const Re = 50, Ae = 0.5, Me = 20, ze = 0.3, Ce = 150, Fe = 30, mt = class mt {
2341
2341
  };
2342
2342
  mt.TOUCH_CLICK_DELAY = 300;
2343
2343
  let It = mt;
2344
- class Le {
2344
+ class Fe {
2345
2345
  constructor(t) {
2346
2346
  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)
2347
2347
  throw new Error("GoogleDriveLoader requires at least one source to be configured");
@@ -2888,7 +2888,7 @@ function Pe() {
2888
2888
  class _e {
2889
2889
  constructor(t = {}) {
2890
2890
  var i, n, a, r, s, h;
2891
- this.fullConfig = Jt(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.animationEngine = new Qt(this.fullConfig.animation), this.layoutEngine = new xe({
2891
+ this.fullConfig = Jt(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.animationEngine = new Qt(this.fullConfig.animation), this.layoutEngine = new xe({
2892
2892
  layout: this.fullConfig.layout,
2893
2893
  image: this.fullConfig.image
2894
2894
  }), this.zoomEngine = new Te(this.fullConfig.interaction.focus, this.animationEngine, this.fullConfig.styling), this.defaultStyles = ft((i = this.fullConfig.styling) == null ? void 0 : i.default), this.hoverStyles = ft((n = this.fullConfig.styling) == null ? void 0 : n.hover), this.defaultClassName = (r = (a = this.fullConfig.styling) == null ? void 0 : a.default) == null ? void 0 : r.className, this.hoverClassName = (h = (s = this.fullConfig.styling) == null ? void 0 : s.hover) == null ? void 0 : h.className;
@@ -2941,7 +2941,7 @@ class _e {
2941
2941
  allowedExtensions: i.allowedExtensions ?? e.allowedExtensions,
2942
2942
  debugLogging: i.debugLogging ?? e.debugLogging
2943
2943
  };
2944
- return new Le(n);
2944
+ return new Fe(n);
2945
2945
  } else
2946
2946
  throw new Error(`Unknown loader entry: ${JSON.stringify(t)}`);
2947
2947
  }
@@ -2959,7 +2959,7 @@ class _e {
2959
2959
  onPrev: () => this.navigateToPreviousImage(),
2960
2960
  onDragOffset: (t) => this.zoomEngine.setDragOffset(t),
2961
2961
  onDragEnd: (t) => {
2962
- t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0, Ce);
2962
+ t ? this.zoomEngine.clearDragOffset(!1) : this.zoomEngine.clearDragOffset(!0, Le);
2963
2963
  }
2964
2964
  }), this.setupUI(), this.setupEventListeners(), this.logDebug("ImageCloud initialized"), await this.loadImages();
2965
2965
  } catch (t) {
@@ -2967,7 +2967,23 @@ class _e {
2967
2967
  }
2968
2968
  }
2969
2969
  setupUI() {
2970
- this.loadingEl = document.getElementById("loading"), this.errorEl = document.getElementById("error");
2970
+ const t = this.fullConfig.rendering.ui;
2971
+ t.showLoadingSpinner && (t.loadingElement ? (this.loadingEl = this.resolveElement(t.loadingElement), this.loadingElAutoCreated = !1) : (this.loadingEl = this.createDefaultLoadingElement(), this.loadingElAutoCreated = !0)), t.errorElement ? (this.errorEl = this.resolveElement(t.errorElement), this.errorElAutoCreated = !1) : (this.errorEl = this.createDefaultErrorElement(), this.errorElAutoCreated = !0);
2972
+ }
2973
+ resolveElement(t) {
2974
+ return t instanceof HTMLElement ? t : document.getElementById(t);
2975
+ }
2976
+ createDefaultLoadingElement() {
2977
+ const t = document.createElement("div");
2978
+ t.className = "fbn-ic-loading fbn-ic-hidden";
2979
+ const e = document.createElement("div");
2980
+ e.className = "fbn-ic-spinner", t.appendChild(e);
2981
+ const i = document.createElement("p");
2982
+ return i.textContent = "Loading images...", t.appendChild(i), this.containerEl.appendChild(t), t;
2983
+ }
2984
+ createDefaultErrorElement() {
2985
+ const t = document.createElement("div");
2986
+ return t.className = "fbn-ic-error fbn-ic-hidden", this.containerEl.appendChild(t), t;
2971
2987
  }
2972
2988
  setupEventListeners() {
2973
2989
  document.addEventListener("keydown", (t) => {
@@ -3164,7 +3180,7 @@ class _e {
3164
3180
  d.scale,
3165
3181
  g,
3166
3182
  e
3167
- ), L = this.entryAnimationEngine.buildStartTransform(
3183
+ ), F = this.entryAnimationEngine.buildStartTransform(
3168
3184
  v,
3169
3185
  f,
3170
3186
  d.rotation,
@@ -3182,7 +3198,7 @@ class _e {
3182
3198
  finalTransform: w,
3183
3199
  renderedWidth: g,
3184
3200
  renderedHeight: e
3185
- }), c.style.transform = L, c.dataset.finalTransform = w, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || I !== d.rotation || R !== d.scale) && (c.dataset.startX = String(v.x), c.dataset.startY = String(v.y), c.dataset.endX = String(f.x), c.dataset.endY = String(f.y), c.dataset.imageWidth = String(g), c.dataset.imageHeight = String(e), c.dataset.rotation = String(d.rotation), c.dataset.scale = String(d.scale), c.dataset.startRotation = String(I), c.dataset.startScale = String(R)), this.displayQueue.push(c);
3201
+ }), c.style.transform = F, c.dataset.finalTransform = w, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || I !== d.rotation || R !== d.scale) && (c.dataset.startX = String(v.x), c.dataset.startY = String(v.y), c.dataset.endX = String(f.x), c.dataset.endY = String(f.y), c.dataset.imageWidth = String(g), c.dataset.imageHeight = String(e), c.dataset.rotation = String(d.rotation), c.dataset.scale = String(d.scale), c.dataset.startRotation = String(I), c.dataset.startScale = String(R)), this.displayQueue.push(c);
3186
3202
  }, c.onerror = () => r++, c.src = l;
3187
3203
  });
3188
3204
  }
@@ -3204,7 +3220,7 @@ class _e {
3204
3220
  * Clear the image cloud and reset state
3205
3221
  */
3206
3222
  clearImageCloud() {
3207
- this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null), this.loadGeneration++, this.displayQueue = [], this.containerEl && (this.containerEl.innerHTML = ""), this.imageElements = [], this.imageLayouts = [], this.currentFocusIndex = null, this.hoveredImage = null, this.layoutEngine.reset(), this.zoomEngine.reset(), this.imagesLoaded = !1;
3223
+ this.queueInterval !== null && (clearInterval(this.queueInterval), this.queueInterval = null), this.loadGeneration++, this.displayQueue = [], this.containerEl && this.containerEl.querySelectorAll(".fbn-ic-image, .fbn-ic-debug-center").forEach((t) => t.remove()), this.imageElements = [], this.imageLayouts = [], this.currentFocusIndex = null, this.hoveredImage = null, this.layoutEngine.reset(), this.zoomEngine.reset(), this.imagesLoaded = !1;
3208
3224
  }
3209
3225
  showLoading(t) {
3210
3226
  !this.fullConfig.rendering.ui.showLoadingSpinner || !this.loadingEl || (t ? this.loadingEl.classList.remove("fbn-ic-hidden") : this.loadingEl.classList.add("fbn-ic-hidden"));
@@ -3220,20 +3236,20 @@ class _e {
3220
3236
  */
3221
3237
  destroy() {
3222
3238
  var t;
3223
- this.clearImageCloud(), this.resizeTimeout !== null && clearTimeout(this.resizeTimeout), (t = this.swipeEngine) == null || t.destroy();
3239
+ this.clearImageCloud(), this.loadingElAutoCreated && this.loadingEl && (this.loadingEl.remove(), this.loadingEl = null), this.errorElAutoCreated && this.errorEl && (this.errorEl.remove(), this.errorEl = null), this.resizeTimeout !== null && clearTimeout(this.resizeTimeout), (t = this.swipeEngine) == null || t.destroy();
3224
3240
  }
3225
3241
  }
3226
3242
  export {
3227
3243
  Qt as AnimationEngine,
3228
- zt as BOUNCE_PRESETS,
3244
+ Ct as BOUNCE_PRESETS,
3229
3245
  ve as ClusterPlacementGenerator,
3230
3246
  $e as CompositeLoader,
3231
3247
  S as DEFAULT_CONFIG,
3232
3248
  Ut as DEFAULT_SHARED_LOADER_CONFIG,
3233
- Ct as ELASTIC_PRESETS,
3249
+ Lt as ELASTIC_PRESETS,
3234
3250
  he as EntryAnimationEngine,
3235
3251
  Ue as FUNCTIONAL_CSS,
3236
- Le as GoogleDriveLoader,
3252
+ Fe as GoogleDriveLoader,
3237
3253
  fe as GridPlacementGenerator,
3238
3254
  _e as ImageCloud,
3239
3255
  De as ImageFilter,
@@ -3243,7 +3259,7 @@ export {
3243
3259
  de as RandomPlacementGenerator,
3244
3260
  be as SpiralPlacementGenerator,
3245
3261
  Oe as StaticImageLoader,
3246
- Ft as WAVE_PATH_PRESETS,
3262
+ zt as WAVE_PATH_PRESETS,
3247
3263
  Te as ZoomEngine,
3248
3264
  re as animatePath,
3249
3265
  Pe as injectFunctionalStyles,