@everymatrix/mini-games-hub 0.1.4 → 0.1.6

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.
Files changed (56) hide show
  1. package/components/GameCard-B2Vf_Okb.cjs +3 -0
  2. package/components/GameCard-DX4XDT2r.js +58 -0
  3. package/components/GameCard-FmSc9xvG.js +58 -0
  4. package/components/GameCard-M2W5m0Zm.js +58 -0
  5. package/components/GameCard-_o5MuNe0.cjs +3 -0
  6. package/components/GameCard-m8ao3BnH.js +58 -0
  7. package/components/MiniGamesHub-BEAlx3WE.js +1350 -0
  8. package/components/MiniGamesHub-BaAiz62L.cjs +94 -0
  9. package/components/MiniGamesHub-CMCQVVj-.cjs +94 -0
  10. package/components/MiniGamesHub-CZqhbkAH.js +1363 -0
  11. package/components/MiniGamesHub-DXDzq6kn.js +1383 -0
  12. package/components/MiniGamesHub-DxW3lK75.js +1369 -0
  13. package/components/WheelOfFortune-5qXt_Tgq.js +881 -0
  14. package/components/WheelOfFortune-C175eyqQ.js +891 -0
  15. package/components/WheelOfFortune-Cfe5KhF-.cjs +588 -0
  16. package/components/WheelOfFortune-DDfYKRzu.js +862 -0
  17. package/components/WheelOfFortune-DfEViFbR.cjs +607 -0
  18. package/components/WheelOfFortune-Dtoep2n2.js +852 -0
  19. package/components/WheelOfFortuneDrawResults-3S77J9M5.js +292 -0
  20. package/components/WheelOfFortuneDrawResults-BmOTEhGD.js +317 -0
  21. package/components/WheelOfFortuneDrawResults-CKkYMVLn.js +317 -0
  22. package/components/WheelOfFortuneDrawResults-CRTL9AxF.cjs +1 -0
  23. package/components/WheelOfFortuneDrawResults-D_QT2RDK.cjs +1 -0
  24. package/components/WheelOfFortuneDrawResults-tMY81TeU.js +292 -0
  25. package/components/WheelOfFortuneHistory-3lEfr9Yn.cjs +13 -0
  26. package/components/WheelOfFortuneHistory-BpfmGEE1.js +233 -0
  27. package/components/WheelOfFortuneHistory-C1VQ9CfR.cjs +13 -0
  28. package/components/WheelOfFortuneHistory-CdbwXfZf.js +233 -0
  29. package/components/WheelOfFortuneHistory-CpY9Bvl5.js +233 -0
  30. package/components/WheelOfFortuneHistory-DoYx_EbF.js +233 -0
  31. package/components/WheelOfFortuneRules-C9cNreB6.cjs +5 -0
  32. package/components/WheelOfFortuneRules-CD5FcLZh.js +117 -0
  33. package/components/WheelOfFortuneRules-DAM5aq_8.js +128 -0
  34. package/components/WheelOfFortuneRules-DTZ61azL.js +128 -0
  35. package/components/WheelOfFortuneRules-DUjXad1Z.cjs +5 -0
  36. package/components/WheelOfFortuneRules-DWgbOzlP.js +117 -0
  37. package/components/WheelOfFortuneWheel-B0P_kjVI.js +599 -0
  38. package/components/WheelOfFortuneWheel-CeSTBBTb.js +640 -0
  39. package/components/WheelOfFortuneWheel-D-wKWbJO.cjs +1 -0
  40. package/components/WheelOfFortuneWheel-Dn6de3eN.js +674 -0
  41. package/components/WheelOfFortuneWheel-JKN_P3ES.cjs +1 -0
  42. package/components/WheelOfFortuneWheel-LXdY_AV0.js +633 -0
  43. package/components/constants-CWz8CXw2.js +29 -0
  44. package/components/constants-DM6Vdc6Z.cjs +1 -0
  45. package/components/sparkles-BnriHiyw.cjs +1 -0
  46. package/components/sparkles-BzZDomk7.js +25 -0
  47. package/components/sparkles-C9wObsYC.js +29 -0
  48. package/components/spin-controller-BjXSz9Me.js +161 -0
  49. package/components/spin-controller-CETKYiGM.js +163 -0
  50. package/components/spin-controller-q2CuZMYj.cjs +1 -0
  51. package/components/utils-CCuzS-TL.js +6831 -0
  52. package/components/utils-DrO0OQK_.js +6918 -0
  53. package/es2015/mini-games-hub.cjs +1 -1
  54. package/es2015/mini-games-hub.js +1 -1
  55. package/esnext/mini-games-hub.js +1 -1
  56. package/package.json +1 -1
@@ -0,0 +1,29 @@
1
+ const e = 0.972, s = 2.4, a = 9e-3, I = 1200, _ = 0.3, t = 1.2, f = 0.3, n = 0.998, i = 0.5, T = 0.94, r = 1e4, o = 0.25, c = 2500, N = 6e3, S = ["#c0392b", "#c8a84b"], E = ["#fff7a8", "#ffd229", "#ff9f1c", "#ff3158", "#ffffff"], O = ["#fff7a8", "#ffd229", "#ff9f1c", "#ff3158", "#36c7ff", "#ffffff"], m = [
2
+ { name: { "*": "Cash Bonus" }, image1: {}, prizeText: { "*": "Cash Bonus" }, prizeImage: {}, rules: [] },
3
+ { name: { "*": "Free Spins" }, image1: {}, prizeText: { "*": "Free Spins" }, prizeImage: {}, rules: [] },
4
+ { name: { "*": "Try Again" }, image1: {}, prizeText: { "*": "Try Again" }, prizeImage: {}, rules: [] },
5
+ { name: { "*": "VIP Points" }, image1: {}, prizeText: { "*": "VIP Points" }, prizeImage: {}, rules: [] },
6
+ { name: { "*": "Mystery Prize" }, image1: {}, prizeText: { "*": "Mystery Prize" }, prizeImage: {}, rules: [] },
7
+ { name: { "*": "Jackpot" }, image1: {}, prizeText: { "*": "Jackpot" }, prizeImage: {}, rules: [] },
8
+ { name: { "*": "Loyalty Points" }, image1: {}, prizeText: { "*": "Loyalty Points" }, prizeImage: {}, rules: [] }
9
+ ];
10
+ export {
11
+ T as A,
12
+ E as C,
13
+ _ as D,
14
+ n as F,
15
+ c as L,
16
+ I as P,
17
+ O as S,
18
+ i as a,
19
+ e as b,
20
+ a as c,
21
+ s as d,
22
+ t as e,
23
+ f,
24
+ N as g,
25
+ o as h,
26
+ S as i,
27
+ r as j,
28
+ m as p
29
+ };
@@ -0,0 +1 @@
1
+ "use strict";const _=["#c0392b","#c8a84b"],I=["#fff7a8","#ffd229","#ff9f1c","#ff3158","#ffffff"],N=["#fff7a8","#ffd229","#ff9f1c","#ff3158","#36c7ff","#ffffff"],T=[{name:{"*":"Cash Bonus"},image1:{},prizeText:{"*":"Cash Bonus"},prizeImage:{},rules:[]},{name:{"*":"Free Spins"},image1:{},prizeText:{"*":"Free Spins"},prizeImage:{},rules:[]},{name:{"*":"Try Again"},image1:{},prizeText:{"*":"Try Again"},prizeImage:{},rules:[]},{name:{"*":"VIP Points"},image1:{},prizeText:{"*":"VIP Points"},prizeImage:{},rules:[]},{name:{"*":"Mystery Prize"},image1:{},prizeText:{"*":"Mystery Prize"},prizeImage:{},rules:[]},{name:{"*":"Jackpot"},image1:{},prizeText:{"*":"Jackpot"},prizeImage:{},rules:[]},{name:{"*":"Loyalty Points"},image1:{},prizeText:{"*":"Loyalty Points"},prizeImage:{},rules:[]}];exports.ABORT_SPIN_DECAY=.94;exports.CONFETTI_COLORS=I;exports.DRAG_MIN_VELOCITY=.3;exports.FALLBACK_SLICE_COLORS=_;exports.FREE_SPIN_DECAY=.998;exports.FREE_SPIN_VELOCITY_FLOOR=.5;exports.LANDING_MAX_DURATION_MS=6e3;exports.LANDING_MIN_DURATION_MS=2500;exports.LANDING_MIN_VELOCITY=.25;exports.PRIZE_HIT_MS=1200;exports.SPIN_BUTTON_VELOCITY_MIN=1.2;exports.SPIN_BUTTON_VELOCITY_RANGE=.3;exports.SPIN_DECAY=.972;exports.SPIN_MAX_VELOCITY=2.4;exports.SPIN_SETTLE_THRESHOLD=.009;exports.SPIN_TIMEOUT_MS=1e4;exports.SUCCESS_CONFETTI_COLORS=N;exports.placeholderWheelSlices=T;
@@ -0,0 +1 @@
1
+ "use strict";const p=require("./constants-DM6Vdc6Z.cjs");function S(o,i,h,c=14){var d;const t=o.getBoundingClientRect(),r=i-t.left,y=h-t.top,a=Math.min(c,30),s=o.parentElement;s&&((d=s.classList)==null||d.add("is-bursting"),clearTimeout(s._burstTimer),s._burstTimer=setTimeout(()=>{var n;return(n=s.classList)==null?void 0:n.remove("is-bursting")},780));for(let n=0;n<a;n++){const e=document.createElement("span"),m=n<Math.ceil(a*.18),M=Math.random();e.className=m?"sparkle":`confetti ${M>.76?"is-diamond":M>.56?"is-ribbon":""}`;const l=Math.PI*2*n/a+(Math.random()-.5)*.42,u=t.width*(.12+Math.random()*.14),x=Math.sin(l)<0?1.08:.74,P=Math.cos(l)*u,C=Math.sin(l)*u*x,$=m?4+Math.random()*7:4+Math.random()*8,f=m?$:3+Math.random()*8;e.style.setProperty("--x",`${r}px`),e.style.setProperty("--y",`${y}px`),e.style.setProperty("--tx",`${P}px`),e.style.setProperty("--ty",`${C}px`),e.style.setProperty("--fall",`${42+Math.random()*82}px`),e.style.setProperty("--w",`${$}px`),e.style.setProperty("--h",`${f}px`),e.style.setProperty("--radius",`${m?50:2+Math.random()*4}px`),e.style.setProperty("--hue",p.CONFETTI_COLORS[Math.floor(Math.random()*p.CONFETTI_COLORS.length)]),e.style.setProperty("--d",`${950+Math.random()*700}ms`),e.style.setProperty("--rot",`${Math.random()*360}deg`),e.style.setProperty("--spin",`${(Math.random()>.5?1:-1)*(180+Math.random()*360)}deg`),e.style.animationDelay=`${Math.random()*55}ms`,o.appendChild(e),e.addEventListener("animationend",()=>e.remove(),{once:!0})}}function b(o){o.innerHTML="";const i=window.matchMedia("(pointer: coarse), (max-width: 640px)").matches,h=i?28:44;for(let c=0;c<h;c++){const t=document.createElement("span"),r=Math.random();t.className=`success-confetti-piece ${r>.78?"is-diamond":r>.56?"is-ribbon":""}`;const y=8+Math.random()*84,a=(Math.random()-.5)*(i?130:190),s=5+Math.random()*8,d=r>.56?3+Math.random()*8:7+Math.random()*11;t.style.setProperty("--x",`${y}%`),t.style.setProperty("--tx",`${a}px`),t.style.setProperty("--w",`${s}px`),t.style.setProperty("--h",`${d}px`),t.style.setProperty("--hue",p.SUCCESS_CONFETTI_COLORS[Math.floor(Math.random()*p.SUCCESS_CONFETTI_COLORS.length)]),t.style.setProperty("--d",`${1500+Math.random()*1050}ms`),t.style.setProperty("--rot",`${Math.random()*360}deg`),t.style.setProperty("--spin",`${(Math.random()>.5?1:-1)*(260+Math.random()*520)}deg`),t.style.animationDelay=`${Math.random()*260}ms`,o.appendChild(t),t.addEventListener("animationend",()=>t.remove(),{once:!0})}}exports.burstSparkles=S;exports.burstSuccessConfetti=b;
@@ -0,0 +1,25 @@
1
+ import { S as u, C as x } from "./constants-CWz8CXw2.js";
2
+ function C(o, i, c, d = 14) {
3
+ const t = o.getBoundingClientRect(), n = i - t.left, p = c - t.top, r = Math.min(d, 30), s = o.parentElement;
4
+ s && (s.classList?.add("is-bursting"), clearTimeout(s._burstTimer), s._burstTimer = setTimeout(() => s.classList?.remove("is-bursting"), 780));
5
+ for (let a = 0; a < r; a++) {
6
+ const e = document.createElement("span"), m = a < Math.ceil(r * 0.18), y = Math.random();
7
+ e.className = m ? "sparkle" : `confetti ${y > 0.76 ? "is-diamond" : y > 0.56 ? "is-ribbon" : ""}`;
8
+ const h = Math.PI * 2 * a / r + (Math.random() - 0.5) * 0.42, l = t.width * (0.12 + Math.random() * 0.14), $ = Math.sin(h) < 0 ? 1.08 : 0.74, P = Math.cos(h) * l, f = Math.sin(h) * l * $, M = m ? 4 + Math.random() * 7 : 4 + Math.random() * 8, b = m ? M : 3 + Math.random() * 8;
9
+ e.style.setProperty("--x", `${n}px`), e.style.setProperty("--y", `${p}px`), e.style.setProperty("--tx", `${P}px`), e.style.setProperty("--ty", `${f}px`), e.style.setProperty("--fall", `${42 + Math.random() * 82}px`), e.style.setProperty("--w", `${M}px`), e.style.setProperty("--h", `${b}px`), e.style.setProperty("--radius", `${m ? 50 : 2 + Math.random() * 4}px`), e.style.setProperty("--hue", x[Math.floor(Math.random() * x.length)]), e.style.setProperty("--d", `${950 + Math.random() * 700}ms`), e.style.setProperty("--rot", `${Math.random() * 360}deg`), e.style.setProperty("--spin", `${(Math.random() > 0.5 ? 1 : -1) * (180 + Math.random() * 360)}deg`), e.style.animationDelay = `${Math.random() * 55}ms`, o.appendChild(e), e.addEventListener("animationend", () => e.remove(), { once: !0 });
10
+ }
11
+ }
12
+ function w(o) {
13
+ o.innerHTML = "";
14
+ const i = window.matchMedia("(pointer: coarse), (max-width: 640px)").matches, c = i ? 28 : 44;
15
+ for (let d = 0; d < c; d++) {
16
+ const t = document.createElement("span"), n = Math.random();
17
+ t.className = `success-confetti-piece ${n > 0.78 ? "is-diamond" : n > 0.56 ? "is-ribbon" : ""}`;
18
+ const p = 8 + Math.random() * 84, r = (Math.random() - 0.5) * (i ? 130 : 190), s = 5 + Math.random() * 8, a = n > 0.56 ? 3 + Math.random() * 8 : 7 + Math.random() * 11;
19
+ t.style.setProperty("--x", `${p}%`), t.style.setProperty("--tx", `${r}px`), t.style.setProperty("--w", `${s}px`), t.style.setProperty("--h", `${a}px`), t.style.setProperty("--hue", u[Math.floor(Math.random() * u.length)]), t.style.setProperty("--d", `${1500 + Math.random() * 1050}ms`), t.style.setProperty("--rot", `${Math.random() * 360}deg`), t.style.setProperty("--spin", `${(Math.random() > 0.5 ? 1 : -1) * (260 + Math.random() * 520)}deg`), t.style.animationDelay = `${Math.random() * 260}ms`, o.appendChild(t), t.addEventListener("animationend", () => t.remove(), { once: !0 });
20
+ }
21
+ }
22
+ export {
23
+ w as a,
24
+ C as b
25
+ };
@@ -0,0 +1,29 @@
1
+ import { S as x, C as $ } from "./constants-CWz8CXw2.js";
2
+ function w(a, i, p, d = 14) {
3
+ var m;
4
+ const t = a.getBoundingClientRect(), n = i - t.left, h = p - t.top, r = Math.min(d, 30), s = a.parentElement;
5
+ s && ((m = s.classList) == null || m.add("is-bursting"), clearTimeout(s._burstTimer), s._burstTimer = setTimeout(() => {
6
+ var o;
7
+ return (o = s.classList) == null ? void 0 : o.remove("is-bursting");
8
+ }, 780));
9
+ for (let o = 0; o < r; o++) {
10
+ const e = document.createElement("span"), c = o < Math.ceil(r * 0.18), l = Math.random();
11
+ e.className = c ? "sparkle" : `confetti ${l > 0.76 ? "is-diamond" : l > 0.56 ? "is-ribbon" : ""}`;
12
+ const y = Math.PI * 2 * o / r + (Math.random() - 0.5) * 0.42, M = t.width * (0.12 + Math.random() * 0.14), P = Math.sin(y) < 0 ? 1.08 : 0.74, f = Math.cos(y) * M, b = Math.sin(y) * M * P, u = c ? 4 + Math.random() * 7 : 4 + Math.random() * 8, g = c ? u : 3 + Math.random() * 8;
13
+ e.style.setProperty("--x", `${n}px`), e.style.setProperty("--y", `${h}px`), e.style.setProperty("--tx", `${f}px`), e.style.setProperty("--ty", `${b}px`), e.style.setProperty("--fall", `${42 + Math.random() * 82}px`), e.style.setProperty("--w", `${u}px`), e.style.setProperty("--h", `${g}px`), e.style.setProperty("--radius", `${c ? 50 : 2 + Math.random() * 4}px`), e.style.setProperty("--hue", $[Math.floor(Math.random() * $.length)]), e.style.setProperty("--d", `${950 + Math.random() * 700}ms`), e.style.setProperty("--rot", `${Math.random() * 360}deg`), e.style.setProperty("--spin", `${(Math.random() > 0.5 ? 1 : -1) * (180 + Math.random() * 360)}deg`), e.style.animationDelay = `${Math.random() * 55}ms`, a.appendChild(e), e.addEventListener("animationend", () => e.remove(), { once: !0 });
14
+ }
15
+ }
16
+ function S(a) {
17
+ a.innerHTML = "";
18
+ const i = window.matchMedia("(pointer: coarse), (max-width: 640px)").matches, p = i ? 28 : 44;
19
+ for (let d = 0; d < p; d++) {
20
+ const t = document.createElement("span"), n = Math.random();
21
+ t.className = `success-confetti-piece ${n > 0.78 ? "is-diamond" : n > 0.56 ? "is-ribbon" : ""}`;
22
+ const h = 8 + Math.random() * 84, r = (Math.random() - 0.5) * (i ? 130 : 190), s = 5 + Math.random() * 8, m = n > 0.56 ? 3 + Math.random() * 8 : 7 + Math.random() * 11;
23
+ t.style.setProperty("--x", `${h}%`), t.style.setProperty("--tx", `${r}px`), t.style.setProperty("--w", `${s}px`), t.style.setProperty("--h", `${m}px`), t.style.setProperty("--hue", x[Math.floor(Math.random() * x.length)]), t.style.setProperty("--d", `${1500 + Math.random() * 1050}ms`), t.style.setProperty("--rot", `${Math.random() * 360}deg`), t.style.setProperty("--spin", `${(Math.random() > 0.5 ? 1 : -1) * (260 + Math.random() * 520)}deg`), t.style.animationDelay = `${Math.random() * 260}ms`, a.appendChild(t), t.addEventListener("animationend", () => t.remove(), { once: !0 });
24
+ }
25
+ }
26
+ export {
27
+ S as a,
28
+ w as b
29
+ };
@@ -0,0 +1,161 @@
1
+ import { b as ot } from "./sparkles-BzZDomk7.js";
2
+ import { D as at, F as rt, a as O, b as ct, c as x, d as H, P as lt, e as ut, f as mt, A as dt, L as pt, g as ft, h as vt } from "./constants-CWz8CXw2.js";
3
+ function Mt(M) {
4
+ const { stage: a, disc: l, sparkleLayer: q, sliceCount: _, onSpinStart: D, onDragStart: Y, onSettled: B, onPrizeClear: U, onSpinAbort: k, liteMode: E } = M;
5
+ let m = 0, r = 0, f = 0, v = "idle", d = 0, i = null;
6
+ p(m);
7
+ function p(t) {
8
+ m = t, l.style.setProperty("--wheel-rotation", `${t}deg`);
9
+ }
10
+ function w(t) {
11
+ return (t + 540) % 360 - 180;
12
+ }
13
+ function y(t) {
14
+ const e = l.getBoundingClientRect(), n = e.left + e.width / 2, s = e.top + e.height / 2;
15
+ return Math.atan2(t.clientY - s, t.clientX - n) * 180 / Math.PI;
16
+ }
17
+ function h() {
18
+ r && cancelAnimationFrame(r), r = 0, a.classList.remove("is-spin-active");
19
+ }
20
+ function z() {
21
+ const t = _();
22
+ if (t === 0) return 0;
23
+ const e = 360 / t, n = (-m % 360 + 360) % 360;
24
+ return Math.floor(n / e) % t;
25
+ }
26
+ function S(t) {
27
+ const e = t !== void 0 ? t : z();
28
+ a.classList.add("is-prize-hit"), f && clearTimeout(f), f = window.setTimeout(() => {
29
+ a.classList.remove("is-prize-hit"), f = 0, U?.();
30
+ }, lt), B?.(e);
31
+ }
32
+ function G(t, e = !0) {
33
+ h(), a.classList.add("is-spin-active");
34
+ let n = performance.now(), s = Math.max(-H, Math.min(H, t));
35
+ function o(c) {
36
+ const u = Math.min(32, c - n);
37
+ n = c, p(m + s * u), s *= Math.pow(ct, u / 16.67), Math.abs(s) > x ? r = requestAnimationFrame(o) : (r = 0, a.classList.remove("is-spin-active"), e && S());
38
+ }
39
+ r = requestAnimationFrame(o);
40
+ }
41
+ function V() {
42
+ const t = l.getBoundingClientRect(), e = t.left + t.width / 2, n = t.top + t.height / 2;
43
+ a.classList.add("is-spinning");
44
+ const s = a;
45
+ if (clearTimeout(s._spinGlowTimer), s._spinGlowTimer = setTimeout(() => a.classList.remove("is-spinning"), 960), !E) {
46
+ const o = window.matchMedia("(pointer: coarse), (max-width: 640px)").matches;
47
+ ot(q, e, n, o ? 8 : 18);
48
+ }
49
+ }
50
+ function X(t) {
51
+ l.style.animation = "none", h(), a.classList.remove("is-prize-hit"), f && (clearTimeout(f), f = 0), v = "free", t !== void 0 ? d = t : d = -(ut + Math.random() * mt);
52
+ const e = t !== void 0 ? Math.min(O, Math.abs(t)) : O;
53
+ V(), D?.(), a.classList.add("is-spin-active");
54
+ let n = performance.now();
55
+ function s(o) {
56
+ if (v !== "free") return;
57
+ const c = Math.min(32, o - n);
58
+ n = o, p(m + d * c), d *= Math.pow(rt, c / 16.67), Math.abs(d) < e && (d = d < 0 ? -e : e), r = requestAnimationFrame(s);
59
+ }
60
+ r = requestAnimationFrame(s);
61
+ }
62
+ function W(t) {
63
+ v === "free" && (v = "targeted", h(), $(t));
64
+ }
65
+ function Z() {
66
+ if (v !== "free") return;
67
+ v = "aborting", h();
68
+ let t = performance.now(), e = d;
69
+ a.classList.add("is-spin-active");
70
+ function n(s) {
71
+ const o = Math.min(32, s - t);
72
+ t = s, p(m + e * o), e *= Math.pow(dt, o / 16.67), Math.abs(e) > x ? r = requestAnimationFrame(n) : (r = 0, a.classList.remove("is-spin-active"), v = "idle", k?.());
73
+ }
74
+ r = requestAnimationFrame(n);
75
+ }
76
+ function N(t) {
77
+ h();
78
+ const e = m, n = t - e;
79
+ if (Math.abs(n) < 0.5) {
80
+ p(t);
81
+ return;
82
+ }
83
+ const s = Math.min(600, Math.max(300, Math.abs(n) * 5)), o = performance.now();
84
+ function c(u) {
85
+ const g = Math.min(1, (u - o) / s), T = 1 - Math.pow(1 - g, 3);
86
+ p(e + n * T), g < 1 ? r = requestAnimationFrame(c) : (r = 0, p(t));
87
+ }
88
+ r = requestAnimationFrame(c);
89
+ }
90
+ function $(t) {
91
+ const e = _();
92
+ if (e === 0) return;
93
+ const n = 360 / e, s = (t + 0.5) * n, o = (-m % 360 + 360) % 360, c = ((s - o) % 360 + 360) % 360, u = d <= 0, g = u ? c : (360 - c) % 360, T = Math.abs(d), Q = E ? 2 : Math.max(2, Math.round(T * 3)), I = g + Q * 360, A = m, F = u ? A - I : A + I, tt = Math.max(vt, T), et = Math.max(
94
+ pt,
95
+ Math.min(ft, 2 * I / tt)
96
+ ), nt = performance.now();
97
+ a.classList.add("is-spin-active");
98
+ function b(it) {
99
+ const C = Math.min(1, (it - nt) / et), st = 1 - Math.pow(1 - C, 2);
100
+ p(A + (F - A) * st), C < 1 ? r = requestAnimationFrame(b) : (r = 0, a.classList.remove("is-spin-active"), v = "idle", p(F), S(t));
101
+ }
102
+ r = requestAnimationFrame(b);
103
+ }
104
+ function j(t) {
105
+ t.classList.remove("is-pressing"), t.offsetWidth, t.classList.add("is-pressing");
106
+ const e = t;
107
+ clearTimeout(e._pressTimer), e._pressTimer = setTimeout(() => t.classList.remove("is-pressing"), 620);
108
+ }
109
+ function R(t) {
110
+ if (M.centerButtonEl && M.centerButtonEl.contains(t.target)) return;
111
+ if (i !== null) {
112
+ l.releasePointerCapture(i.pointerId), a.classList.remove("is-dragging"), N(i.startRotation), i = null;
113
+ return;
114
+ }
115
+ if (!t.isPrimary) return;
116
+ t.preventDefault(), Y?.(), h(), a.classList.add("is-dragging"), l.setPointerCapture?.(t.pointerId);
117
+ const e = y(t);
118
+ i = {
119
+ pointerId: t.pointerId,
120
+ startAngle: e,
121
+ previousAngle: e,
122
+ startRotation: m,
123
+ previousTime: performance.now(),
124
+ velocity: 0,
125
+ didDrag: !1,
126
+ cumulativeDelta: 0,
127
+ velocityHistory: [{ cumulative: 0, t: performance.now() }]
128
+ };
129
+ }
130
+ function P(t) {
131
+ if (!i || t.pointerId !== i.pointerId) return;
132
+ t.preventDefault();
133
+ const e = performance.now(), n = y(t), s = w(n - i.startAngle), o = w(n - i.previousAngle), c = Math.max(8, e - i.previousTime);
134
+ Math.abs(s) > 2 && (i.didDrag = !0), p(i.startRotation + s), i.velocity = o / c, i.previousAngle = n, i.previousTime = e, i.cumulativeDelta += o, i.velocityHistory.push({ cumulative: i.cumulativeDelta, t: e });
135
+ const u = e - 150;
136
+ for (; i.velocityHistory.length > 2 && i.velocityHistory[0].t < u; )
137
+ i.velocityHistory.shift();
138
+ }
139
+ function L(t) {
140
+ if (!i || t.pointerId !== i.pointerId) return;
141
+ const e = i.velocityHistory;
142
+ let n;
143
+ if (e.length >= 2) {
144
+ const c = e[0], u = e[e.length - 1], g = u.t - c.t;
145
+ n = g > 0 ? (u.cumulative - c.cumulative) / g : i.velocity;
146
+ } else
147
+ n = i.velocity;
148
+ const s = i.didDrag, o = i.startRotation;
149
+ i = null, a.classList.remove("is-dragging"), l.releasePointerCapture?.(t.pointerId), s && Math.abs(n) > at ? M.onDragRelease ? M.onDragRelease(n) : (D?.(), G(n, !0)) : s && N(o);
150
+ }
151
+ function J() {
152
+ l.addEventListener("pointerdown", R), l.addEventListener("pointermove", P), l.addEventListener("pointerup", L), l.addEventListener("pointercancel", L);
153
+ }
154
+ function K() {
155
+ h(), f && clearTimeout(f), l.removeEventListener("pointerdown", R), l.removeEventListener("pointermove", P), l.removeEventListener("pointerup", L), l.removeEventListener("pointercancel", L);
156
+ }
157
+ return { startFreeSpin: X, landOnIndex: W, abortSpin: Z, enableDrag: J, destroy: K, centerButtonPress: j };
158
+ }
159
+ export {
160
+ Mt as c
161
+ };
@@ -0,0 +1,163 @@
1
+ import { b as ot } from "./sparkles-C9wObsYC.js";
2
+ import { D as at, F as rt, a as Y, b as ct, c as B, d as U, P as lt, e as ut, f as mt, A as dt, L as ft, g as pt, h as vt } from "./constants-CWz8CXw2.js";
3
+ function gt(T) {
4
+ const { stage: r, disc: o, sparkleLayer: k, sliceCount: N, onSpinStart: L, onDragStart: _, onSettled: E, onPrizeClear: D, onSpinAbort: w, liteMode: R } = T;
5
+ let m = 0, c = 0, p = 0, v = "idle", d = 0, i = null;
6
+ f(m);
7
+ function f(t) {
8
+ m = t, o.style.setProperty("--wheel-rotation", `${t}deg`);
9
+ }
10
+ function P(t) {
11
+ return (t + 540) % 360 - 180;
12
+ }
13
+ function F(t) {
14
+ const e = o.getBoundingClientRect(), n = e.left + e.width / 2, s = e.top + e.height / 2;
15
+ return Math.atan2(t.clientY - s, t.clientX - n) * 180 / Math.PI;
16
+ }
17
+ function h() {
18
+ c && cancelAnimationFrame(c), c = 0, r.classList.remove("is-spin-active");
19
+ }
20
+ function G() {
21
+ const t = N();
22
+ if (t === 0) return 0;
23
+ const e = 360 / t, n = (-m % 360 + 360) % 360;
24
+ return Math.floor(n / e) % t;
25
+ }
26
+ function O(t) {
27
+ const e = t !== void 0 ? t : G();
28
+ r.classList.add("is-prize-hit"), p && clearTimeout(p), p = window.setTimeout(() => {
29
+ r.classList.remove("is-prize-hit"), p = 0, D == null || D();
30
+ }, lt), E == null || E(e);
31
+ }
32
+ function z(t, e = !0) {
33
+ h(), r.classList.add("is-spin-active");
34
+ let n = performance.now(), s = Math.max(-U, Math.min(U, t));
35
+ function a(l) {
36
+ const u = Math.min(32, l - n);
37
+ n = l, f(m + s * u), s *= Math.pow(ct, u / 16.67), Math.abs(s) > B ? c = requestAnimationFrame(a) : (c = 0, r.classList.remove("is-spin-active"), e && O());
38
+ }
39
+ c = requestAnimationFrame(a);
40
+ }
41
+ function V() {
42
+ const t = o.getBoundingClientRect(), e = t.left + t.width / 2, n = t.top + t.height / 2;
43
+ r.classList.add("is-spinning");
44
+ const s = r;
45
+ if (clearTimeout(s._spinGlowTimer), s._spinGlowTimer = setTimeout(() => r.classList.remove("is-spinning"), 960), !R) {
46
+ const a = window.matchMedia("(pointer: coarse), (max-width: 640px)").matches;
47
+ ot(k, e, n, a ? 8 : 18);
48
+ }
49
+ }
50
+ function X(t) {
51
+ o.style.animation = "none", h(), r.classList.remove("is-prize-hit"), p && (clearTimeout(p), p = 0), v = "free", t !== void 0 ? d = t : d = -(ut + Math.random() * mt);
52
+ const e = t !== void 0 ? Math.min(Y, Math.abs(t)) : Y;
53
+ V(), L == null || L(), r.classList.add("is-spin-active");
54
+ let n = performance.now();
55
+ function s(a) {
56
+ if (v !== "free") return;
57
+ const l = Math.min(32, a - n);
58
+ n = a, f(m + d * l), d *= Math.pow(rt, l / 16.67), Math.abs(d) < e && (d = d < 0 ? -e : e), c = requestAnimationFrame(s);
59
+ }
60
+ c = requestAnimationFrame(s);
61
+ }
62
+ function W(t) {
63
+ v === "free" && (v = "targeted", h(), $(t));
64
+ }
65
+ function Z() {
66
+ if (v !== "free") return;
67
+ v = "aborting", h();
68
+ let t = performance.now(), e = d;
69
+ r.classList.add("is-spin-active");
70
+ function n(s) {
71
+ const a = Math.min(32, s - t);
72
+ t = s, f(m + e * a), e *= Math.pow(dt, a / 16.67), Math.abs(e) > B ? c = requestAnimationFrame(n) : (c = 0, r.classList.remove("is-spin-active"), v = "idle", w == null || w());
73
+ }
74
+ c = requestAnimationFrame(n);
75
+ }
76
+ function b(t) {
77
+ h();
78
+ const e = m, n = t - e;
79
+ if (Math.abs(n) < 0.5) {
80
+ f(t);
81
+ return;
82
+ }
83
+ const s = Math.min(600, Math.max(300, Math.abs(n) * 5)), a = performance.now();
84
+ function l(u) {
85
+ const M = Math.min(1, (u - a) / s), g = 1 - Math.pow(1 - M, 3);
86
+ f(e + n * g), M < 1 ? c = requestAnimationFrame(l) : (c = 0, f(t));
87
+ }
88
+ c = requestAnimationFrame(l);
89
+ }
90
+ function $(t) {
91
+ const e = N();
92
+ if (e === 0) return;
93
+ const n = 360 / e, s = (t + 0.5) * n, a = (-m % 360 + 360) % 360, l = ((s - a) % 360 + 360) % 360, u = d <= 0, M = u ? l : (360 - l) % 360, g = Math.abs(d), Q = R ? 2 : Math.max(2, Math.round(g * 3)), y = M + Q * 360, A = m, S = u ? A - y : A + y, tt = Math.max(vt, g), et = Math.max(
94
+ ft,
95
+ Math.min(pt, 2 * y / tt)
96
+ ), nt = performance.now();
97
+ r.classList.add("is-spin-active");
98
+ function H(it) {
99
+ const q = Math.min(1, (it - nt) / et), st = 1 - Math.pow(1 - q, 2);
100
+ f(A + (S - A) * st), q < 1 ? c = requestAnimationFrame(H) : (c = 0, r.classList.remove("is-spin-active"), v = "idle", f(S), O(t));
101
+ }
102
+ c = requestAnimationFrame(H);
103
+ }
104
+ function j(t) {
105
+ t.classList.remove("is-pressing"), t.offsetWidth, t.classList.add("is-pressing");
106
+ const e = t;
107
+ clearTimeout(e._pressTimer), e._pressTimer = setTimeout(() => t.classList.remove("is-pressing"), 620);
108
+ }
109
+ function C(t) {
110
+ var n;
111
+ if (T.centerButtonEl && T.centerButtonEl.contains(t.target)) return;
112
+ if (i !== null) {
113
+ o.releasePointerCapture(i.pointerId), r.classList.remove("is-dragging"), b(i.startRotation), i = null;
114
+ return;
115
+ }
116
+ if (!t.isPrimary) return;
117
+ t.preventDefault(), _ == null || _(), h(), r.classList.add("is-dragging"), (n = o.setPointerCapture) == null || n.call(o, t.pointerId);
118
+ const e = F(t);
119
+ i = {
120
+ pointerId: t.pointerId,
121
+ startAngle: e,
122
+ previousAngle: e,
123
+ startRotation: m,
124
+ previousTime: performance.now(),
125
+ velocity: 0,
126
+ didDrag: !1,
127
+ cumulativeDelta: 0,
128
+ velocityHistory: [{ cumulative: 0, t: performance.now() }]
129
+ };
130
+ }
131
+ function x(t) {
132
+ if (!i || t.pointerId !== i.pointerId) return;
133
+ t.preventDefault();
134
+ const e = performance.now(), n = F(t), s = P(n - i.startAngle), a = P(n - i.previousAngle), l = Math.max(8, e - i.previousTime);
135
+ Math.abs(s) > 2 && (i.didDrag = !0), f(i.startRotation + s), i.velocity = a / l, i.previousAngle = n, i.previousTime = e, i.cumulativeDelta += a, i.velocityHistory.push({ cumulative: i.cumulativeDelta, t: e });
136
+ const u = e - 150;
137
+ for (; i.velocityHistory.length > 2 && i.velocityHistory[0].t < u; )
138
+ i.velocityHistory.shift();
139
+ }
140
+ function I(t) {
141
+ var l;
142
+ if (!i || t.pointerId !== i.pointerId) return;
143
+ const e = i.velocityHistory;
144
+ let n;
145
+ if (e.length >= 2) {
146
+ const u = e[0], M = e[e.length - 1], g = M.t - u.t;
147
+ n = g > 0 ? (M.cumulative - u.cumulative) / g : i.velocity;
148
+ } else
149
+ n = i.velocity;
150
+ const s = i.didDrag, a = i.startRotation;
151
+ i = null, r.classList.remove("is-dragging"), (l = o.releasePointerCapture) == null || l.call(o, t.pointerId), s && Math.abs(n) > at ? T.onDragRelease ? T.onDragRelease(n) : (L == null || L(), z(n, !0)) : s && b(a);
152
+ }
153
+ function J() {
154
+ o.addEventListener("pointerdown", C), o.addEventListener("pointermove", x), o.addEventListener("pointerup", I), o.addEventListener("pointercancel", I);
155
+ }
156
+ function K() {
157
+ h(), p && clearTimeout(p), o.removeEventListener("pointerdown", C), o.removeEventListener("pointermove", x), o.removeEventListener("pointerup", I), o.removeEventListener("pointercancel", I);
158
+ }
159
+ return { startFreeSpin: X, landOnIndex: W, abortSpin: Z, enableDrag: J, destroy: K, centerButtonPress: j };
160
+ }
161
+ export {
162
+ gt as c
163
+ };
@@ -0,0 +1 @@
1
+ "use strict";const it=require("./sparkles-BnriHiyw.cjs"),u=require("./constants-DM6Vdc6Z.cjs");function st(I){const{stage:a,disc:o,sparkleLayer:B,sliceCount:y,onSpinStart:T,onDragStart:E,onSettled:D,onPrizeClear:N,onSpinAbort:R,liteMode:P}=I;let p=0,c=0,v=0,h="idle",d=0,i=null;f(p);function f(t){p=t,o.style.setProperty("--wheel-rotation",`${t}deg`)}function O(t){return(t+540)%360-180}function F(t){const e=o.getBoundingClientRect(),n=e.left+e.width/2,s=e.top+e.height/2;return Math.atan2(t.clientY-s,t.clientX-n)*180/Math.PI}function M(){c&&cancelAnimationFrame(c),c=0,a.classList.remove("is-spin-active")}function k(){const t=y();if(t===0)return 0;const e=360/t,n=(-p%360+360)%360;return Math.floor(n/e)%t}function S(t){const e=t!==void 0?t:k();a.classList.add("is-prize-hit"),v&&clearTimeout(v),v=window.setTimeout(()=>{a.classList.remove("is-prize-hit"),v=0,N==null||N()},u.PRIZE_HIT_MS),D==null||D(e)}function U(t,e=!0){M(),a.classList.add("is-spin-active");let n=performance.now(),s=Math.max(-u.SPIN_MAX_VELOCITY,Math.min(u.SPIN_MAX_VELOCITY,t));function r(l){const m=Math.min(32,l-n);n=l,f(p+s*m),s*=Math.pow(u.SPIN_DECAY,m/16.67),Math.abs(s)>u.SPIN_SETTLE_THRESHOLD?c=requestAnimationFrame(r):(c=0,a.classList.remove("is-spin-active"),e&&S())}c=requestAnimationFrame(r)}function G(){const t=o.getBoundingClientRect(),e=t.left+t.width/2,n=t.top+t.height/2;a.classList.add("is-spinning");const s=a;if(clearTimeout(s._spinGlowTimer),s._spinGlowTimer=setTimeout(()=>a.classList.remove("is-spinning"),960),!P){const r=window.matchMedia("(pointer: coarse), (max-width: 640px)").matches;it.burstSparkles(B,e,n,r?8:18)}}function V(t){o.style.animation="none",M(),a.classList.remove("is-prize-hit"),v&&(clearTimeout(v),v=0),h="free",t!==void 0?d=t:d=-(u.SPIN_BUTTON_VELOCITY_MIN+Math.random()*u.SPIN_BUTTON_VELOCITY_RANGE);const e=t!==void 0?Math.min(u.FREE_SPIN_VELOCITY_FLOOR,Math.abs(t)):u.FREE_SPIN_VELOCITY_FLOOR;G(),T==null||T(),a.classList.add("is-spin-active");let n=performance.now();function s(r){if(h!=="free")return;const l=Math.min(32,r-n);n=r,f(p+d*l),d*=Math.pow(u.FREE_SPIN_DECAY,l/16.67),Math.abs(d)<e&&(d=d<0?-e:e),c=requestAnimationFrame(s)}c=requestAnimationFrame(s)}function z(t){h==="free"&&(h="targeted",M(),W(t))}function X(){if(h!=="free")return;h="aborting",M();let t=performance.now(),e=d;a.classList.add("is-spin-active");function n(s){const r=Math.min(32,s-t);t=s,f(p+e*r),e*=Math.pow(u.ABORT_SPIN_DECAY,r/16.67),Math.abs(e)>u.SPIN_SETTLE_THRESHOLD?c=requestAnimationFrame(n):(c=0,a.classList.remove("is-spin-active"),h="idle",R==null||R())}c=requestAnimationFrame(n)}function C(t){M();const e=p,n=t-e;if(Math.abs(n)<.5){f(t);return}const s=Math.min(600,Math.max(300,Math.abs(n)*5)),r=performance.now();function l(m){const g=Math.min(1,(m-r)/s),L=1-Math.pow(1-g,3);f(e+n*L),g<1?c=requestAnimationFrame(l):(c=0,f(t))}c=requestAnimationFrame(l)}function W(t){const e=y();if(e===0)return;const n=360/e,s=(t+.5)*n,r=(-p%360+360)%360,l=((s-r)%360+360)%360,m=d<=0,g=m?l:(360-l)%360,L=Math.abs(d),J=P?2:Math.max(2,Math.round(L*3)),w=g+J*360,A=p,q=m?A-w:A+w,K=Math.max(u.LANDING_MIN_VELOCITY,L),Q=Math.max(u.LANDING_MIN_DURATION_MS,Math.min(u.LANDING_MAX_DURATION_MS,2*w/K)),tt=performance.now();a.classList.add("is-spin-active");function x(et){const Y=Math.min(1,(et-tt)/Q),nt=1-Math.pow(1-Y,2);f(A+(q-A)*nt),Y<1?c=requestAnimationFrame(x):(c=0,a.classList.remove("is-spin-active"),h="idle",f(q),S(t))}c=requestAnimationFrame(x)}function Z(t){t.classList.remove("is-pressing"),t.offsetWidth,t.classList.add("is-pressing");const e=t;clearTimeout(e._pressTimer),e._pressTimer=setTimeout(()=>t.classList.remove("is-pressing"),620)}function b(t){var n;if(I.centerButtonEl&&I.centerButtonEl.contains(t.target))return;if(i!==null){o.releasePointerCapture(i.pointerId),a.classList.remove("is-dragging"),C(i.startRotation),i=null;return}if(!t.isPrimary)return;t.preventDefault(),E==null||E(),M(),a.classList.add("is-dragging"),(n=o.setPointerCapture)==null||n.call(o,t.pointerId);const e=F(t);i={pointerId:t.pointerId,startAngle:e,previousAngle:e,startRotation:p,previousTime:performance.now(),velocity:0,didDrag:!1,cumulativeDelta:0,velocityHistory:[{cumulative:0,t:performance.now()}]}}function H(t){if(!i||t.pointerId!==i.pointerId)return;t.preventDefault();const e=performance.now(),n=F(t),s=O(n-i.startAngle),r=O(n-i.previousAngle),l=Math.max(8,e-i.previousTime);Math.abs(s)>2&&(i.didDrag=!0),f(i.startRotation+s),i.velocity=r/l,i.previousAngle=n,i.previousTime=e,i.cumulativeDelta+=r,i.velocityHistory.push({cumulative:i.cumulativeDelta,t:e});const m=e-150;for(;i.velocityHistory.length>2&&i.velocityHistory[0].t<m;)i.velocityHistory.shift()}function _(t){var l;if(!i||t.pointerId!==i.pointerId)return;const e=i.velocityHistory;let n;if(e.length>=2){const m=e[0],g=e[e.length-1],L=g.t-m.t;n=L>0?(g.cumulative-m.cumulative)/L:i.velocity}else n=i.velocity;const s=i.didDrag,r=i.startRotation;i=null,a.classList.remove("is-dragging"),(l=o.releasePointerCapture)==null||l.call(o,t.pointerId),s&&Math.abs(n)>u.DRAG_MIN_VELOCITY?I.onDragRelease?I.onDragRelease(n):(T==null||T(),U(n,!0)):s&&C(r)}function $(){o.addEventListener("pointerdown",b),o.addEventListener("pointermove",H),o.addEventListener("pointerup",_),o.addEventListener("pointercancel",_)}function j(){M(),v&&clearTimeout(v),o.removeEventListener("pointerdown",b),o.removeEventListener("pointermove",H),o.removeEventListener("pointerup",_),o.removeEventListener("pointercancel",_)}return{startFreeSpin:V,landOnIndex:z,abortSpin:X,enableDrag:$,destroy:j,centerButtonPress:Z}}exports.createSpinController=st;