"use client";
const w = [
  [[0, 0], [1, 0], [0, 1]],
  [[0, 0], [1, 0], [1, 1]],
  [[0, 0], [0, 1], [1, 1]],
  [[0, 1], [1, 0], [1, 1]]
], F = 9301, X = 49297, R = 233280, k = 4, M = 1, b = 8, H = 0.12, Y = 0.3, E = { circle: 0.2, dot: 0.35, triangle: 0.5, diamond: 0.62, cross: 0.75 }, z = 0.3, V = 0.3, j = 450, v = 320, Z = 300, q = 0.8, J = 0.17, T = 0.25, d = 0.25, K = 0.25, Q = 7e3, $ = 2, W = 5, g = 0.75;
function _(t, o, s) {
  return Math.floor(s() * (o - t + 1)) + t;
}
function et(t) {
  return () => (t = (t * F + X) % R, t / R);
}
function at(t, o, s, I, r, c = "right", e = 2) {
  return tt(t, o, s, I, r, c, e);
}
function tt(t, o, s, I, r, c, e) {
  if (t <= 0 || o <= 0) return [];
  const N = Math.max(k, s), A = Math.max(M, Math.floor(o / N)), i = Math.min(b, Math.max(M, e));
  let a = 1;
  for (; a < A && o / (a + 1) >= N; )
    a++;
  let n = o / a;
  n > t && (n = t, a = Math.max(M, Math.floor(o / n)));
  const y = t / i, L = o / i;
  if (n = Math.min(n, y, L), n <= 0) return [];
  a = Math.max(M, Math.floor(o / n));
  const C = Math.max(M, Math.floor(t / n)), x = () => r() > H, P = (l) => _(Math.max(M, Math.floor(l * Y)), l, r), f = c === "right" || c === "left", O = f ? a : C, u = f ? C : a, p = c === "right" || c === "bottom", S = [];
  for (let l = 0; l < O; l++) {
    if (!x()) continue;
    const m = P(u), D = p ? u - m : 0, U = p ? u : m;
    for (let h = D; h < U; h++) {
      const B = f ? h : l, G = f ? l : h;
      nt(S, B * n, G * n, n, n, I, r);
    }
  }
  return S;
}
function ot(t) {
  const o = t();
  if (o < E.circle) return { shapeType: "circle" };
  if (o < E.dot)
    return { shapeType: "dot", dotScale: z + t() * V };
  if (o < E.triangle)
    return {
      shapeType: "triangle",
      triangleIndex: _(0, w.length - 1, t)
    };
  if (o < E.diamond) return { shapeType: "diamond" };
  if (o < E.cross) return { shapeType: "cross" };
  const s = _($, W, t);
  return {
    shapeType: "stripes",
    stripeDirection: t() > 0.35 ? 1 : 0,
    stripeCount: s,
    stripeMask: Array.from({ length: s }, () => t() > 1 - g)
  };
}
function nt(t, o, s, I, r, c, e) {
  const N = _(0, c - 1, e);
  let A = _(0, c - 1, e);
  for (; A === N; )
    A = _(0, c - 1, e);
  const i = ot(e), a = e();
  let n;
  a < T ? n = "breathe" : a < T + d ? n = "pulse" : a < T + d + K && (n = "opacity"), t.push({
    x: o,
    y: s,
    width: I,
    height: r,
    bgColorIndex: N,
    shapeColorIndex: A,
    shapeType: i.shapeType,
    triangleIndex: i.triangleIndex,
    stripeDirection: i.stripeDirection,
    stripeCount: i.stripeCount,
    stripeMask: i.stripeMask,
    animationDelay: Math.floor(e() * j),
    animationDuration: v + Math.floor(e() * Z),
    animationScaleFrom: q + e() * J,
    dotScale: i.dotScale,
    animationType: n,
    animationPhase: n ? Math.floor(e() * Q) : void 0
  });
}
export {
  w as TRIANGLE_TEMPLATES,
  et as createSeededRandom,
  at as generatePattern,
  _ as getRandomInt
};
//# sourceMappingURL=index.esm58.js.map
