@everymatrix/mini-games-hub 0.1.14 → 0.1.16
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/components/BackButton-BMWvZ9Lb.js +39 -0
- package/components/BackButton-BNp3jVLa.js +39 -0
- package/components/BackButton-Bi1zFTns.js +38 -0
- package/components/BackButton-BvRNh4nJ.js +39 -0
- package/components/BackButton-C2-HXI2m.cjs +1 -0
- package/components/BackButton-C_v3b0Ky.cjs +1 -0
- package/components/BackButton-D5gfQ3NI.cjs +1 -0
- package/components/BackButton-DOW_OP-H.cjs +1 -0
- package/components/BackButton-DznJk3U4.js +38 -0
- package/components/BackButton-gIVGAf6v.js +38 -0
- package/components/BackButton-s0YqvufR.cjs +1 -0
- package/components/CoinFlip-5qt33VpA.js +399 -0
- package/components/CoinFlip-9-7FNYAn.js +364 -0
- package/components/CoinFlip-B0Q-xZDI.cjs +1 -0
- package/components/CoinFlip-BWNJK7aS.js +402 -0
- package/components/CoinFlip-BaNNMAYb.cjs +1 -0
- package/components/CoinFlip-BgRZmhbg.js +367 -0
- package/components/CoinFlip-COwy7cq1.cjs +1 -0
- package/components/CoinFlip-CSel9VZR.js +398 -0
- package/components/CoinFlip-CfHvSwpV.cjs +1 -0
- package/components/CoinFlip-ClRh6gz2.js +363 -0
- package/components/CoinFlip-D7Bwnl8W.cjs +1 -0
- package/components/CoinFlip-D8OLaQiA.js +367 -0
- package/components/CoinFlip-Dg2ZA_B2.cjs +1 -0
- package/components/CoinFlip-DoASIhfX.cjs +1 -0
- package/components/CoinFlip-pvtcTO4f.cjs +1 -0
- package/components/CoinFlip-vrZpkrnS.js +402 -0
- package/components/CoinRoyale-4Oe-x5-J.cjs +734 -0
- package/components/CoinRoyale-9nHMXODj.js +1017 -0
- package/components/CoinRoyale-B3bu5S4n.cjs +734 -0
- package/components/CoinRoyale-B4dKiGgG.cjs +736 -0
- package/components/CoinRoyale-BNxFDqe1.js +999 -0
- package/components/CoinRoyale-BwNvG3QI.js +1009 -0
- package/components/CoinRoyale-Bza84vCL.cjs +738 -0
- package/components/CoinRoyale-C-x6uDgh.js +989 -0
- package/components/CoinRoyale-CAI2JCvG.js +1020 -0
- package/components/CoinRoyale-CGHKZ-kc.js +997 -0
- package/components/CoinRoyale-CbqmmMPg.cjs +736 -0
- package/components/CoinRoyale-ChWsctqo.cjs +759 -0
- package/components/CoinRoyale-Cw8ImDP5.js +1040 -0
- package/components/CoinRoyale-CxIBSKFK.js +1017 -0
- package/components/CoinRoyale-D-rF6BV4.js +1019 -0
- package/components/CoinRoyale-DH-tQHtT.cjs +736 -0
- package/components/CoinRoyale-DmcgvBwG.js +997 -0
- package/components/CoinRoyale-d2utu3E3.cjs +759 -0
- package/components/CoinRoyale-xAkf1dm_.cjs +738 -0
- package/components/DrawResult-BHZeM1oX.cjs +1 -0
- package/components/DrawResult-BVtwLs-z.js +373 -0
- package/components/DrawResult-CG5KTjF7.cjs +1 -0
- package/components/DrawResult-COyPm6Cv.cjs +1 -0
- package/components/DrawResult-CbLPtjvZ.js +343 -0
- package/components/DrawResult-Cul15bW0.cjs +1 -0
- package/components/DrawResult-DMRODSxk.cjs +1 -0
- package/components/DrawResult-DTJJfQkP.js +373 -0
- package/components/DrawResult-DdL4fFZM.js +343 -0
- package/components/DrawResult-DxG4CaKK.cjs +1 -0
- package/components/DrawResult-SyzKXHgd.js +343 -0
- package/components/DrawResult-ZEAa0flC.js +373 -0
- package/components/GameCard-8k9KvRun.cjs +3 -0
- package/components/GameCard-A3k7RxF5.js +63 -0
- package/components/GameCard-B2td6J8K.js +62 -0
- package/components/{GameCard-BIn8BJ4U.cjs → GameCard-Bku9nP58.cjs} +3 -3
- package/components/GameCard-CBGi9i6m.cjs +3 -0
- package/components/GameCard-CHZmVd6n.cjs +3 -0
- package/components/GameCard-Cj4zAE8_.js +59 -0
- package/components/GameCard-CrKoQU1B.js +59 -0
- package/components/GameCard-DFVjSdtd.cjs +3 -0
- package/components/GameCard-DHetS96-.js +66 -0
- package/components/GameCard-DcWpuwMl.cjs +3 -0
- package/components/GameCard-jIcB63Tt.js +62 -0
- package/components/GameHistory-9Mf_u0La.js +231 -0
- package/components/GameHistory-BktmYuDa.js +231 -0
- package/components/GameHistory-CGAhNQKk.js +231 -0
- package/components/GameHistory-ChYjWDsa.cjs +12 -0
- package/components/GameHistory-CmiIChL-.cjs +12 -0
- package/components/GameHistory-CrrlOaAg.js +231 -0
- package/components/GameHistory-DVsHn3lx.cjs +12 -0
- package/components/GameHistory-_jU0BiqI.js +231 -0
- package/components/GameHistory-aQf3vf9u.cjs +12 -0
- package/components/GameHistory-lyXo0tYb.cjs +12 -0
- package/components/GameHistory-uzrT81kU.js +231 -0
- package/components/GameHistory-v6cI-TIF.cjs +12 -0
- package/components/GamePlaceholder-4oI8uJ-1.cjs +1 -0
- package/components/GamePlaceholder-Bp4nTJeL.js +84 -0
- package/components/GamePlaceholder-COiYGwNi.cjs +15 -0
- package/components/GamePlaceholder-CfJ4hx9w.js +70 -0
- package/components/GamePlaceholder-D9JEXsAk.js +84 -0
- package/components/GamePlaceholder-DGnB06iW.js +71 -0
- package/components/GamePlaceholder-DS5evGU6.js +85 -0
- package/components/GamePlaceholder-DmiU1G7G.cjs +15 -0
- package/components/GamePlaceholder-Dwo_YAUQ.cjs +1 -0
- package/components/GamePlaceholder-Uni3xW09.cjs +15 -0
- package/components/GamePlaceholder-fVPk29f9.cjs +15 -0
- package/components/GamePlaceholder-vUYYV2Ps.js +85 -0
- package/components/GameRules-41OkRwZu.js +115 -0
- package/components/GameRules-BwLJBo6z.cjs +3 -0
- package/components/GameRules-CRiycUU8.js +115 -0
- package/components/GameRules-CTKyBDZO.cjs +3 -0
- package/components/GameRules-CV9sxZYz.js +126 -0
- package/components/GameRules-CuuoMoqN.cjs +3 -0
- package/components/GameRules-Cy7jwBok.js +126 -0
- package/components/GameRules-DUD8OKC0.js +115 -0
- package/components/GameRules-Dkl0qVzr.js +126 -0
- package/components/GameRules-DpGqZdSj.cjs +3 -0
- package/components/GameRules-DrBYjWA6.cjs +3 -0
- package/components/GameRules-DrZ6w0LM.cjs +3 -0
- package/components/MiniGamesHub-BWPRLpyq.cjs +16 -0
- package/components/MiniGamesHub-BXcQ_faH.js +1022 -0
- package/components/MiniGamesHub-BbkgB1GV.js +1105 -0
- package/components/MiniGamesHub-BjME_rom.cjs +16 -0
- package/components/{MiniGamesHub-BYJ7lK90.js → MiniGamesHub-Bn-xvO1e.js} +416 -760
- package/components/MiniGamesHub-BpjzFxHO.cjs +16 -0
- package/components/MiniGamesHub-BtC6TmtK.cjs +16 -0
- package/components/{MiniGamesHub-D3n-AyD7.js → MiniGamesHub-BvS3Q0HA.js} +452 -696
- package/components/MiniGamesHub-C-9Nf-x7.js +1029 -0
- package/components/MiniGamesHub-C0ESIt9P.cjs +16 -0
- package/components/MiniGamesHub-CfIFEVOU.js +1022 -0
- package/components/MiniGamesHub-Cj_6ebsL.cjs +16 -0
- package/components/MiniGamesHub-CkVJjuZl.cjs +79 -0
- package/components/MiniGamesHub-CktxKKTj.cjs +16 -0
- package/components/MiniGamesHub-ClPq7L0V.cjs +79 -0
- package/components/MiniGamesHub-CrPltGGl.js +1042 -0
- package/components/MiniGamesHub-D2Eet3pe.js +1048 -0
- package/components/MiniGamesHub-DCCeYwnc.js +1055 -0
- package/components/MiniGamesHub-DuyWceLB.cjs +16 -0
- package/components/MiniGamesHub-Dz8Ltp98.js +1048 -0
- package/components/MiniGamesHub-_uRBhzYg.js +1029 -0
- package/components/MiniGamesHub-kIXoGqbZ.cjs +16 -0
- package/components/MiniGamesHub-v8PPHifq.js +1072 -0
- package/components/MysteryChest-B4h9tqVR.js +1301 -0
- package/components/MysteryChest-BJCFkn02.cjs +737 -0
- package/components/MysteryChest-BXPAdruk.js +1290 -0
- package/components/MysteryChest-BuB9PD57.js +1240 -0
- package/components/MysteryChest-C40hwiCW.cjs +745 -0
- package/components/MysteryChest-CKPELFiF.cjs +737 -0
- package/components/MysteryChest-CRJtPhlo.cjs +743 -0
- package/components/MysteryChest-CScyc3Jw.cjs +745 -0
- package/components/MysteryChest-CheF_Rh5.cjs +739 -0
- package/components/MysteryChest-CrL8IXga.js +1309 -0
- package/components/MysteryChest-CrXzepqD.js +1296 -0
- package/components/MysteryChest-D6eks4QE.js +1254 -0
- package/components/MysteryChest-DJuhkpSa.cjs +743 -0
- package/components/MysteryChest-DOTlHt7A.js +1248 -0
- package/components/MysteryChest-DfggF659.js +1262 -0
- package/components/MysteryChest-Di-dVQnd.cjs +745 -0
- package/components/MysteryChest-DnstXEZJ.js +1298 -0
- package/components/MysteryChest-IcRh-Dcp.js +1247 -0
- package/components/MysteryChest-dyhqTxMg.cjs +739 -0
- package/components/WheelOfFortune--1feiOUD.js +950 -0
- package/components/WheelOfFortune-B0g1znMo.cjs +627 -0
- package/components/{WheelOfFortune--4nTtnMR.cjs → WheelOfFortune-BC0wwnC-.cjs} +6 -6
- package/components/{WheelOfFortune-BjNsD2ND.js → WheelOfFortune-BYxOqBjA.js} +148 -159
- package/components/WheelOfFortune-BgUB1tnc.js +942 -0
- package/components/WheelOfFortune-Bh2XAbs4.cjs +619 -0
- package/components/WheelOfFortune-BwmCnHru.js +926 -0
- package/components/WheelOfFortune-CHgHhi9q.cjs +619 -0
- package/components/WheelOfFortune-CRgnumXh.cjs +627 -0
- package/components/WheelOfFortune-CZ2cERqz.cjs +619 -0
- package/components/WheelOfFortune-CpYsfi8D.js +934 -0
- package/components/WheelOfFortune-Cy64rFDw.js +942 -0
- package/components/WheelOfFortune-DZ7fGpS9.cjs +619 -0
- package/components/WheelOfFortune-DZg0i79U.js +949 -0
- package/components/{WheelOfFortune-DkVQIxzg.js → WheelOfFortune-DawF7WTd.js} +178 -214
- package/components/WheelOfFortune-DjdKhLGF.cjs +617 -0
- package/components/WheelOfFortune-M5VMIsnw.cjs +619 -0
- package/components/WheelOfFortune-kXjxp6t7.js +926 -0
- package/components/WheelOfFortune-pBG33-QJ.js +933 -0
- package/components/WheelOfFortuneWheel-7PqVvd_8.cjs +3 -0
- package/components/WheelOfFortuneWheel-B4fe-idJ.cjs +3 -0
- package/components/WheelOfFortuneWheel-BABzaEBd.js +1812 -0
- package/components/WheelOfFortuneWheel-BQFaJ7ZB.cjs +3 -0
- package/components/WheelOfFortuneWheel-BYEHNHdI.js +1807 -0
- package/components/WheelOfFortuneWheel-BoZ9evN7.cjs +3 -0
- package/components/WheelOfFortuneWheel-BuBjvGRI.cjs +3 -0
- package/components/{WheelOfFortuneWheel-BAR98ByP.js → WheelOfFortuneWheel-CQCLWOFi.js} +310 -302
- package/components/WheelOfFortuneWheel-CsOjhUcv.cjs +3 -0
- package/components/WheelOfFortuneWheel-DUE4gyGP.js +1741 -0
- package/components/{WheelOfFortuneWheel-DxFn6jjg.js → WheelOfFortuneWheel-DXhwrWpD.js} +548 -539
- package/components/WheelOfFortuneWheel-DgVQP4GA.js +1735 -0
- package/components/bg-scene-Bz42V1FW.cjs +1 -0
- package/components/bg-scene-DpHgKCHj.js +4 -0
- package/components/coin-heads-BuJOLpyg.cjs +1 -0
- package/components/coin-heads-loqcEtH2.js +4 -0
- package/components/coin-tails-20vJmhwv.cjs +1 -0
- package/components/coin-tails-BTbsTwkz.js +4 -0
- package/components/confetti-CIk02Iw8.cjs +1 -0
- package/components/confetti-QNsE8ssC.js +14 -0
- package/components/constants-BDMySuIA.cjs +1 -0
- package/components/constants-DNSPUges.cjs +1 -0
- package/components/{constants-BYsDpbRv.js → constants-DdcZGwlM.js} +28 -19
- package/components/constants-DgCBmV7S.js +29 -0
- package/components/constants-Ds7J0meH.cjs +1 -0
- package/components/constants-Q_kcdbM6.js +29 -0
- package/components/countdown-2m_26DZf.js +157 -0
- package/components/countdown-BhZfvy-p.cjs +1 -0
- package/components/countdown-Bp3yWidJ.cjs +1 -0
- package/components/countdown-CH5h-cVr.js +146 -0
- package/components/countdown-CnUPVFlE.cjs +1 -0
- package/components/countdown-DmWNNDzv.js +168 -0
- package/components/countdown-YmZm4DrD.js +146 -0
- package/components/countdown-o9wqo7P7.cjs +1 -0
- package/components/key-CFhvp9Ju.cjs +1 -0
- package/components/key-D1g9LqMU.js +4 -0
- package/components/mystery-chest-bg-CGT-JTBW.js +4 -0
- package/components/mystery-chest-bg-vrQMNafs.cjs +1 -0
- package/components/mystery-chest-empty-CSY7-Vbl.cjs +1 -0
- package/components/mystery-chest-empty-D7bbrCHH.js +4 -0
- package/components/mystery-chest-locked-CIxpYU3v.js +4 -0
- package/components/mystery-chest-locked-DiyrvNm3.cjs +1 -0
- package/components/mystery-chest-win-D1NYItcd.js +4 -0
- package/components/mystery-chest-win-OxXZtQQd.cjs +1 -0
- package/components/remaining-times-Dexper1E.js +52 -0
- package/components/remaining-times-DiYnfuZB.js +23 -0
- package/components/remaining-times-Eqo69UfM.cjs +1 -0
- package/components/remaining-times-Gt6ytHaa.cjs +1 -0
- package/components/sparkles-B2kHtb3R.js +14 -0
- package/components/sparkles-BBLT1jhq.js +14 -0
- package/components/sparkles-BIl7-lvq.cjs +1 -0
- package/components/sparkles-BRrL2C0i.cjs +1 -0
- package/components/sparkles-BXFe6GK6.js +18 -0
- package/components/sparkles-C2rT-gN_.cjs +1 -0
- package/components/sparkles-Cfa1xTlQ.js +14 -0
- package/components/sparkles-Cot5wZXx.cjs +1 -0
- package/components/sparkles-D1RTsqBU.js +18 -0
- package/components/sparkles-DKbGLSaY.cjs +1 -0
- package/components/sparkles-DmL-n8od.cjs +1 -0
- package/components/sparkles-WqrZ-iXs.js +18 -0
- package/components/spin-controller-3wmy9F5-.cjs +1 -0
- package/components/{spin-controller-CIshWmlA.cjs → spin-controller-BF6ymCY4.cjs} +1 -1
- package/components/spin-controller-Bc8nQATS.cjs +1 -0
- package/components/{spin-controller-BuBkKrNR.js → spin-controller-BcBfHUn9.js} +7 -7
- package/components/{spin-controller-REPdRwaB.js → spin-controller-CC3QZvWl.js} +8 -8
- package/components/spin-controller-CEIahkSh.cjs +1 -0
- package/components/spin-controller-CUb1rpPl.js +177 -0
- package/components/spin-controller-CVXfvzb7.cjs +1 -0
- package/components/spin-controller-DBglqs7W.js +175 -0
- package/components/spin-controller-Db-fwR9V.cjs +1 -0
- package/components/spin-controller-DkSQ07IL.js +177 -0
- package/components/spin-controller-Dxxx3-ya.js +175 -0
- package/components/utils-8EFTHKcu.cjs +3 -0
- package/components/utils-AGVOgUGK.cjs +3 -0
- package/components/{utils-C7uxZXaZ.js → utils-B3aNdyMX.js} +968 -958
- package/components/utils-BJHloM10.js +6055 -0
- package/components/utils-C1uNHR_J.cjs +3 -0
- package/components/{utils-d-JrZBJu.js → utils-DEov6Qk_.js} +902 -892
- package/components/utils-DQ220WK3.js +6016 -0
- package/components/utils-DwrHy7a0.js +6007 -0
- package/components/utils-Dwz-wUFC.cjs +3 -0
- package/components/utils-Rda5erjI.cjs +3 -0
- package/components/utils-fG_nzyoc.cjs +3 -0
- package/components/utils-qUyu-MNU.js +6064 -0
- package/es2015/mini-games-hub.cjs +1 -1
- package/es2015/mini-games-hub.js +1 -1
- package/esnext/mini-games-hub.cjs +1 -0
- package/esnext/mini-games-hub.js +1 -1
- package/package.json +12 -13
- package/components/GameCard-D3knomma.js +0 -56
- package/components/GameCard-Ds0FcnPp.js +0 -56
- package/components/MiniGamesHub-zNncMSFn.cjs +0 -94
- package/components/WheelOfFortuneDrawResults-1lzyxrks.cjs +0 -1
- package/components/WheelOfFortuneDrawResults-DQweghnp.js +0 -301
- package/components/WheelOfFortuneDrawResults-dOeQDVub.js +0 -276
- package/components/WheelOfFortuneHistory-CQZ9QtVt.js +0 -232
- package/components/WheelOfFortuneHistory-DZNPM57t.cjs +0 -13
- package/components/WheelOfFortuneHistory-DygZEtcR.js +0 -232
- package/components/WheelOfFortuneRules-D3N1c8PX.js +0 -117
- package/components/WheelOfFortuneRules-DuiCet95.js +0 -128
- package/components/WheelOfFortuneRules-VAMAiK0m.cjs +0 -5
- package/components/WheelOfFortuneWheel-hSjxThyU.cjs +0 -3
- package/components/constants-DM6Vdc6Z.cjs +0 -1
- package/components/sparkles-BnriHiyw.cjs +0 -1
- package/components/sparkles-CSfeD2Zu.js +0 -25
- package/components/sparkles-CTrQ372y.js +0 -29
- package/components/utils-DQIHJIDu.cjs +0 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const st=require("./sparkles-BRrL2C0i.cjs"),u=require("./constants-DNSPUges.cjs");function ot(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,m=0,f="idle",v=0,i=null;h(p);function h(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"),m&&clearTimeout(m),m=window.setTimeout(()=>{a.classList.remove("is-prize-hit"),m=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 d=Math.min(32,l-n);n=l,h(p+s*d),s*=Math.pow(u.SPIN_DECAY,d/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;st.burstSparkles(B,e,n,r?8:18)}}function V(t){o.style.animation="none",M(),a.classList.remove("is-prize-hit"),m&&(clearTimeout(m),m=0),f="free",t!==void 0?v=t:v=-(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(f!=="free")return;const l=Math.min(32,r-n);n=r,h(p+v*l),v*=Math.pow(u.FREE_SPIN_DECAY,l/16.67),Math.abs(v)<e&&(v=v<0?-e:e),c=requestAnimationFrame(s)}c=requestAnimationFrame(s)}function z(t){f==="free"&&(f="targeted",M(),W(t))}function X(){if(f!=="free")return;f="aborting",M();let t=performance.now(),e=v;a.classList.add("is-spin-active");function n(s){const r=Math.min(32,s-t);t=s,h(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"),f="idle",R==null||R())}c=requestAnimationFrame(n)}function C(t){M();const e=p,n=t-e;if(Math.abs(n)<.5){h(t);return}const s=Math.min(600,Math.max(300,Math.abs(n)*5)),r=performance.now();function l(d){const g=Math.min(1,(d-r)/s),L=1-Math.pow(1-g,3);h(e+n*L),g<1?c=requestAnimationFrame(l):(c=0,h(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,d=v<=0,g=d?l:(360-l)%360,L=Math.abs(v),K=P?2:Math.max(2,Math.round(L*3)),w=g+K*360,A=p,q=d?A-w:A+w,Q=Math.max(u.LANDING_MIN_VELOCITY,L),tt=Math.max(u.LANDING_MIN_DURATION_MS,Math.min(u.LANDING_MAX_DURATION_MS,2*w/Q)),et=performance.now();a.classList.add("is-spin-active");function x(nt){const Y=Math.min(1,(nt-et)/tt),it=1-Math.pow(1-Y,2);h(A+(q-A)*it),Y<1?c=requestAnimationFrame(x):(c=0,a.classList.remove("is-spin-active"),f="idle",h(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)||f!=="idle")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),h(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 d=e-150;for(;i.velocityHistory.length>2&&i.velocityHistory[0].t<d;)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 d=e[0],g=e[e.length-1],L=g.t-d.t;n=L>0?(g.cumulative-d.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(),m&&(clearTimeout(m),m=0,a.classList.remove("is-prize-hit")),f="idle",i=null}function J(){M(),m&&clearTimeout(m),o.removeEventListener("pointerdown",b),o.removeEventListener("pointermove",H),o.removeEventListener("pointerup",_),o.removeEventListener("pointercancel",_)}return{startFreeSpin:V,landOnIndex:z,abortSpin:X,reset:j,enableDrag:$,destroy:J,centerButtonPress:Z}}exports.createSpinController=ot;
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { b as at } from "./sparkles-WqrZ-iXs.js";
|
|
2
|
+
import { D as rt, A as ct, S as Y, F as lt, a as B, b as ut, P as mt, c as U, L as ft, d as dt, e as pt, f as vt, g as ht } from "./constants-DdcZGwlM.js";
|
|
3
|
+
function Lt(T) {
|
|
4
|
+
const {
|
|
5
|
+
stage: r,
|
|
6
|
+
disc: o,
|
|
7
|
+
sparkleLayer: k,
|
|
8
|
+
sliceCount: N,
|
|
9
|
+
onSpinStart: L,
|
|
10
|
+
onDragStart: _,
|
|
11
|
+
onSettled: E,
|
|
12
|
+
onPrizeClear: D,
|
|
13
|
+
onSpinAbort: w,
|
|
14
|
+
liteMode: R
|
|
15
|
+
} = T;
|
|
16
|
+
let f = 0, c = 0, u = 0, d = "idle", p = 0, i = null;
|
|
17
|
+
v(f);
|
|
18
|
+
function v(t) {
|
|
19
|
+
f = t, o.style.setProperty("--wheel-rotation", `${t}deg`);
|
|
20
|
+
}
|
|
21
|
+
function P(t) {
|
|
22
|
+
return (t + 540) % 360 - 180;
|
|
23
|
+
}
|
|
24
|
+
function F(t) {
|
|
25
|
+
const e = o.getBoundingClientRect(), n = e.left + e.width / 2, s = e.top + e.height / 2;
|
|
26
|
+
return Math.atan2(t.clientY - s, t.clientX - n) * 180 / Math.PI;
|
|
27
|
+
}
|
|
28
|
+
function h() {
|
|
29
|
+
c && cancelAnimationFrame(c), c = 0, r.classList.remove("is-spin-active");
|
|
30
|
+
}
|
|
31
|
+
function G() {
|
|
32
|
+
const t = N();
|
|
33
|
+
if (t === 0) return 0;
|
|
34
|
+
const e = 360 / t, n = (-f % 360 + 360) % 360;
|
|
35
|
+
return Math.floor(n / e) % t;
|
|
36
|
+
}
|
|
37
|
+
function O(t) {
|
|
38
|
+
const e = t !== void 0 ? t : G();
|
|
39
|
+
r.classList.add("is-prize-hit"), u && clearTimeout(u), u = window.setTimeout(() => {
|
|
40
|
+
r.classList.remove("is-prize-hit"), u = 0, D == null || D();
|
|
41
|
+
}, mt), E == null || E(e);
|
|
42
|
+
}
|
|
43
|
+
function z(t, e = !0) {
|
|
44
|
+
h(), r.classList.add("is-spin-active");
|
|
45
|
+
let n = performance.now(), s = Math.max(-U, Math.min(U, t));
|
|
46
|
+
function a(l) {
|
|
47
|
+
const m = Math.min(32, l - n);
|
|
48
|
+
n = l, v(f + s * m), s *= Math.pow(ut, m / 16.67), Math.abs(s) > Y ? c = requestAnimationFrame(a) : (c = 0, r.classList.remove("is-spin-active"), e && O());
|
|
49
|
+
}
|
|
50
|
+
c = requestAnimationFrame(a);
|
|
51
|
+
}
|
|
52
|
+
function V() {
|
|
53
|
+
const t = o.getBoundingClientRect(), e = t.left + t.width / 2, n = t.top + t.height / 2;
|
|
54
|
+
r.classList.add("is-spinning");
|
|
55
|
+
const s = r;
|
|
56
|
+
if (clearTimeout(s._spinGlowTimer), s._spinGlowTimer = setTimeout(() => r.classList.remove("is-spinning"), 960), !R) {
|
|
57
|
+
const a = window.matchMedia("(pointer: coarse), (max-width: 640px)").matches;
|
|
58
|
+
at(k, e, n, a ? 8 : 18);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function X(t) {
|
|
62
|
+
o.style.animation = "none", h(), r.classList.remove("is-prize-hit"), u && (clearTimeout(u), u = 0), d = "free", t !== void 0 ? p = t : p = -(vt + Math.random() * ht);
|
|
63
|
+
const e = t !== void 0 ? Math.min(B, Math.abs(t)) : B;
|
|
64
|
+
V(), L == null || L(), r.classList.add("is-spin-active");
|
|
65
|
+
let n = performance.now();
|
|
66
|
+
function s(a) {
|
|
67
|
+
if (d !== "free") return;
|
|
68
|
+
const l = Math.min(32, a - n);
|
|
69
|
+
n = a, v(f + p * l), p *= Math.pow(lt, l / 16.67), Math.abs(p) < e && (p = p < 0 ? -e : e), c = requestAnimationFrame(s);
|
|
70
|
+
}
|
|
71
|
+
c = requestAnimationFrame(s);
|
|
72
|
+
}
|
|
73
|
+
function W(t) {
|
|
74
|
+
d === "free" && (d = "targeted", h(), $(t));
|
|
75
|
+
}
|
|
76
|
+
function Z() {
|
|
77
|
+
if (d !== "free") return;
|
|
78
|
+
d = "aborting", h();
|
|
79
|
+
let t = performance.now(), e = p;
|
|
80
|
+
r.classList.add("is-spin-active");
|
|
81
|
+
function n(s) {
|
|
82
|
+
const a = Math.min(32, s - t);
|
|
83
|
+
t = s, v(f + e * a), e *= Math.pow(ct, a / 16.67), Math.abs(e) > Y ? c = requestAnimationFrame(n) : (c = 0, r.classList.remove("is-spin-active"), d = "idle", w == null || w());
|
|
84
|
+
}
|
|
85
|
+
c = requestAnimationFrame(n);
|
|
86
|
+
}
|
|
87
|
+
function b(t) {
|
|
88
|
+
h();
|
|
89
|
+
const e = f, n = t - e;
|
|
90
|
+
if (Math.abs(n) < 0.5) {
|
|
91
|
+
v(t);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const s = Math.min(600, Math.max(300, Math.abs(n) * 5)), a = performance.now();
|
|
95
|
+
function l(m) {
|
|
96
|
+
const M = Math.min(1, (m - a) / s), g = 1 - Math.pow(1 - M, 3);
|
|
97
|
+
v(e + n * g), M < 1 ? c = requestAnimationFrame(l) : (c = 0, v(t));
|
|
98
|
+
}
|
|
99
|
+
c = requestAnimationFrame(l);
|
|
100
|
+
}
|
|
101
|
+
function $(t) {
|
|
102
|
+
const e = N();
|
|
103
|
+
if (e === 0) return;
|
|
104
|
+
const n = 360 / e, s = (t + 0.5) * n, a = (-f % 360 + 360) % 360, l = ((s - a) % 360 + 360) % 360, m = p <= 0, M = m ? l : (360 - l) % 360, g = Math.abs(p), tt = R ? 2 : Math.max(2, Math.round(g * 3)), y = M + tt * 360, A = f, x = m ? A - y : A + y, et = Math.max(pt, g), nt = Math.max(
|
|
105
|
+
ft,
|
|
106
|
+
Math.min(dt, 2 * y / et)
|
|
107
|
+
), it = performance.now();
|
|
108
|
+
r.classList.add("is-spin-active");
|
|
109
|
+
function H(st) {
|
|
110
|
+
const q = Math.min(1, (st - it) / nt), ot = 1 - Math.pow(1 - q, 2);
|
|
111
|
+
v(A + (x - A) * ot), q < 1 ? c = requestAnimationFrame(H) : (c = 0, r.classList.remove("is-spin-active"), d = "idle", v(x), O(t));
|
|
112
|
+
}
|
|
113
|
+
c = requestAnimationFrame(H);
|
|
114
|
+
}
|
|
115
|
+
function j(t) {
|
|
116
|
+
t.classList.remove("is-pressing"), t.offsetWidth, t.classList.add("is-pressing");
|
|
117
|
+
const e = t;
|
|
118
|
+
clearTimeout(e._pressTimer), e._pressTimer = setTimeout(() => t.classList.remove("is-pressing"), 620);
|
|
119
|
+
}
|
|
120
|
+
function C(t) {
|
|
121
|
+
var n;
|
|
122
|
+
if (T.centerButtonEl && T.centerButtonEl.contains(t.target) || d !== "idle") return;
|
|
123
|
+
if (i !== null) {
|
|
124
|
+
o.releasePointerCapture(i.pointerId), r.classList.remove("is-dragging"), b(i.startRotation), i = null;
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (!t.isPrimary) return;
|
|
128
|
+
t.preventDefault(), _ == null || _(), h(), r.classList.add("is-dragging"), (n = o.setPointerCapture) == null || n.call(o, t.pointerId);
|
|
129
|
+
const e = F(t);
|
|
130
|
+
i = {
|
|
131
|
+
pointerId: t.pointerId,
|
|
132
|
+
startAngle: e,
|
|
133
|
+
previousAngle: e,
|
|
134
|
+
startRotation: f,
|
|
135
|
+
previousTime: performance.now(),
|
|
136
|
+
velocity: 0,
|
|
137
|
+
didDrag: !1,
|
|
138
|
+
cumulativeDelta: 0,
|
|
139
|
+
velocityHistory: [{ cumulative: 0, t: performance.now() }]
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function S(t) {
|
|
143
|
+
if (!i || t.pointerId !== i.pointerId) return;
|
|
144
|
+
t.preventDefault();
|
|
145
|
+
const e = performance.now(), n = F(t), s = P(n - i.startAngle), a = P(n - i.previousAngle), l = Math.max(8, e - i.previousTime);
|
|
146
|
+
Math.abs(s) > 2 && (i.didDrag = !0), v(i.startRotation + s), i.velocity = a / l, i.previousAngle = n, i.previousTime = e, i.cumulativeDelta += a, i.velocityHistory.push({ cumulative: i.cumulativeDelta, t: e });
|
|
147
|
+
const m = e - 150;
|
|
148
|
+
for (; i.velocityHistory.length > 2 && i.velocityHistory[0].t < m; )
|
|
149
|
+
i.velocityHistory.shift();
|
|
150
|
+
}
|
|
151
|
+
function I(t) {
|
|
152
|
+
var l;
|
|
153
|
+
if (!i || t.pointerId !== i.pointerId) return;
|
|
154
|
+
const e = i.velocityHistory;
|
|
155
|
+
let n;
|
|
156
|
+
if (e.length >= 2) {
|
|
157
|
+
const m = e[0], M = e[e.length - 1], g = M.t - m.t;
|
|
158
|
+
n = g > 0 ? (M.cumulative - m.cumulative) / g : i.velocity;
|
|
159
|
+
} else
|
|
160
|
+
n = i.velocity;
|
|
161
|
+
const s = i.didDrag, a = i.startRotation;
|
|
162
|
+
i = null, r.classList.remove("is-dragging"), (l = o.releasePointerCapture) == null || l.call(o, t.pointerId), s && Math.abs(n) > rt ? T.onDragRelease ? T.onDragRelease(n) : (L == null || L(), z(n, !0)) : s && b(a);
|
|
163
|
+
}
|
|
164
|
+
function J() {
|
|
165
|
+
o.addEventListener("pointerdown", C), o.addEventListener("pointermove", S), o.addEventListener("pointerup", I), o.addEventListener("pointercancel", I);
|
|
166
|
+
}
|
|
167
|
+
function K() {
|
|
168
|
+
h(), u && (clearTimeout(u), u = 0, r.classList.remove("is-prize-hit")), d = "idle", i = null;
|
|
169
|
+
}
|
|
170
|
+
function Q() {
|
|
171
|
+
h(), u && clearTimeout(u), o.removeEventListener("pointerdown", C), o.removeEventListener("pointermove", S), o.removeEventListener("pointerup", I), o.removeEventListener("pointercancel", I);
|
|
172
|
+
}
|
|
173
|
+
return { startFreeSpin: X, landOnIndex: W, abortSpin: Z, reset: K, enableDrag: J, destroy: Q, centerButtonPress: j };
|
|
174
|
+
}
|
|
175
|
+
export {
|
|
176
|
+
Lt as c
|
|
177
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const ot=require("./sparkles-DKbGLSaY.cjs"),l=require("./constants-DNSPUges.cjs");function st(L){const{stage:r,disc:u,sparkleLayer:H,sliceCount:E,onSpinStart:S,onDragStart:q,onSettled:x,onPrizeClear:Y,onSpinAbort:B,liteMode:D}=L;let p=0,a=0,m=0,f="idle",v=0,n=null;h(p);function h(t){p=t,u.style.setProperty("--wheel-rotation",`${t}deg`)}function N(t){return(t+540)%360-180}function R(t){const e=u.getBoundingClientRect(),i=e.left+e.width/2,o=e.top+e.height/2;return Math.atan2(t.clientY-o,t.clientX-i)*180/Math.PI}function M(){a&&cancelAnimationFrame(a),a=0,r.classList.remove("is-spin-active")}function k(){const t=E();if(t===0)return 0;const e=360/t,i=(-p%360+360)%360;return Math.floor(i/e)%t}function w(t){const e=t!==void 0?t:k();r.classList.add("is-prize-hit"),m&&clearTimeout(m),m=window.setTimeout(()=>{r.classList.remove("is-prize-hit"),m=0,Y?.()},l.PRIZE_HIT_MS),x?.(e)}function z(t,e=!0){M(),r.classList.add("is-spin-active");let i=performance.now(),o=Math.max(-l.SPIN_MAX_VELOCITY,Math.min(l.SPIN_MAX_VELOCITY,t));function s(c){const d=Math.min(32,c-i);i=c,h(p+o*d),o*=Math.pow(l.SPIN_DECAY,d/16.67),Math.abs(o)>l.SPIN_SETTLE_THRESHOLD?a=requestAnimationFrame(s):(a=0,r.classList.remove("is-spin-active"),e&&w())}a=requestAnimationFrame(s)}function U(){const t=u.getBoundingClientRect(),e=t.left+t.width/2,i=t.top+t.height/2;r.classList.add("is-spinning");const o=r;if(clearTimeout(o._spinGlowTimer),o._spinGlowTimer=setTimeout(()=>r.classList.remove("is-spinning"),960),!D){const s=window.matchMedia("(pointer: coarse), (max-width: 640px)").matches;ot.burstSparkles(H,e,i,s?8:18)}}function G(t){u.style.animation="none",M(),r.classList.remove("is-prize-hit"),m&&(clearTimeout(m),m=0),f="free",t!==void 0?v=t:v=-(l.SPIN_BUTTON_VELOCITY_MIN+Math.random()*l.SPIN_BUTTON_VELOCITY_RANGE);const e=t!==void 0?Math.min(l.FREE_SPIN_VELOCITY_FLOOR,Math.abs(t)):l.FREE_SPIN_VELOCITY_FLOOR;U(),S?.(),r.classList.add("is-spin-active");let i=performance.now();function o(s){if(f!=="free")return;const c=Math.min(32,s-i);i=s,h(p+v*c),v*=Math.pow(l.FREE_SPIN_DECAY,c/16.67),Math.abs(v)<e&&(v=v<0?-e:e),a=requestAnimationFrame(o)}a=requestAnimationFrame(o)}function V(t){f==="free"&&(f="targeted",M(),W(t))}function X(){if(f!=="free")return;f="aborting",M();let t=performance.now(),e=v;r.classList.add("is-spin-active");function i(o){const s=Math.min(32,o-t);t=o,h(p+e*s),e*=Math.pow(l.ABORT_SPIN_DECAY,s/16.67),Math.abs(e)>l.SPIN_SETTLE_THRESHOLD?a=requestAnimationFrame(i):(a=0,r.classList.remove("is-spin-active"),f="idle",B?.())}a=requestAnimationFrame(i)}function y(t){M();const e=p,i=t-e;if(Math.abs(i)<.5){h(t);return}const o=Math.min(600,Math.max(300,Math.abs(i)*5)),s=performance.now();function c(d){const g=Math.min(1,(d-s)/o),I=1-Math.pow(1-g,3);h(e+i*I),g<1?a=requestAnimationFrame(c):(a=0,h(t))}a=requestAnimationFrame(c)}function W(t){const e=E();if(e===0)return;const i=360/e,o=(t+.5)*i,s=(-p%360+360)%360,c=((o-s)%360+360)%360,d=v<=0,g=d?c:(360-c)%360,I=Math.abs(v),K=D?2:Math.max(2,Math.round(I*3)),A=g+K*360,_=p,C=d?_-A:_+A,Q=Math.max(l.LANDING_MIN_VELOCITY,I),tt=Math.max(l.LANDING_MIN_DURATION_MS,Math.min(l.LANDING_MAX_DURATION_MS,2*A/Q)),et=performance.now();r.classList.add("is-spin-active");function F(nt){const b=Math.min(1,(nt-et)/tt),it=1-Math.pow(1-b,2);h(_+(C-_)*it),b<1?a=requestAnimationFrame(F):(a=0,r.classList.remove("is-spin-active"),f="idle",h(C),w(t))}a=requestAnimationFrame(F)}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 P(t){if(L.centerButtonEl&&L.centerButtonEl.contains(t.target)||f!=="idle")return;if(n!==null){u.releasePointerCapture(n.pointerId),r.classList.remove("is-dragging"),y(n.startRotation),n=null;return}if(!t.isPrimary)return;t.preventDefault(),q?.(),M(),r.classList.add("is-dragging"),u.setPointerCapture?.(t.pointerId);const e=R(t);n={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 O(t){if(!n||t.pointerId!==n.pointerId)return;t.preventDefault();const e=performance.now(),i=R(t),o=N(i-n.startAngle),s=N(i-n.previousAngle),c=Math.max(8,e-n.previousTime);Math.abs(o)>2&&(n.didDrag=!0),h(n.startRotation+o),n.velocity=s/c,n.previousAngle=i,n.previousTime=e,n.cumulativeDelta+=s,n.velocityHistory.push({cumulative:n.cumulativeDelta,t:e});const d=e-150;for(;n.velocityHistory.length>2&&n.velocityHistory[0].t<d;)n.velocityHistory.shift()}function T(t){if(!n||t.pointerId!==n.pointerId)return;const e=n.velocityHistory;let i;if(e.length>=2){const c=e[0],d=e[e.length-1],g=d.t-c.t;i=g>0?(d.cumulative-c.cumulative)/g:n.velocity}else i=n.velocity;const o=n.didDrag,s=n.startRotation;n=null,r.classList.remove("is-dragging"),u.releasePointerCapture?.(t.pointerId),o&&Math.abs(i)>l.DRAG_MIN_VELOCITY?L.onDragRelease?L.onDragRelease(i):(S?.(),z(i,!0)):o&&y(s)}function $(){u.addEventListener("pointerdown",P),u.addEventListener("pointermove",O),u.addEventListener("pointerup",T),u.addEventListener("pointercancel",T)}function j(){M(),m&&(clearTimeout(m),m=0,r.classList.remove("is-prize-hit")),f="idle",n=null}function J(){M(),m&&clearTimeout(m),u.removeEventListener("pointerdown",P),u.removeEventListener("pointermove",O),u.removeEventListener("pointerup",T),u.removeEventListener("pointercancel",T)}return{startFreeSpin:G,landOnIndex:V,abortSpin:X,reset:j,enableDrag:$,destroy:J,centerButtonPress:Z}}exports.createSpinController=st;
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { b as at } from "./sparkles-Cfa1xTlQ.js";
|
|
2
|
+
import { D as rt, A as ct, S as O, F as lt, a as x, b as ut, P as mt, c as H, L as dt, d as pt, e as ft, f as vt, g as ht } from "./constants-Q_kcdbM6.js";
|
|
3
|
+
function Lt(M) {
|
|
4
|
+
const {
|
|
5
|
+
stage: a,
|
|
6
|
+
disc: l,
|
|
7
|
+
sparkleLayer: q,
|
|
8
|
+
sliceCount: _,
|
|
9
|
+
onSpinStart: D,
|
|
10
|
+
onDragStart: Y,
|
|
11
|
+
onSettled: B,
|
|
12
|
+
onPrizeClear: z,
|
|
13
|
+
onSpinAbort: U,
|
|
14
|
+
liteMode: E
|
|
15
|
+
} = M;
|
|
16
|
+
let d = 0, r = 0, u = 0, p = "idle", f = 0, n = null;
|
|
17
|
+
v(d);
|
|
18
|
+
function v(t) {
|
|
19
|
+
d = t, l.style.setProperty("--wheel-rotation", `${t}deg`);
|
|
20
|
+
}
|
|
21
|
+
function w(t) {
|
|
22
|
+
return (t + 540) % 360 - 180;
|
|
23
|
+
}
|
|
24
|
+
function S(t) {
|
|
25
|
+
const e = l.getBoundingClientRect(), i = e.left + e.width / 2, s = e.top + e.height / 2;
|
|
26
|
+
return Math.atan2(t.clientY - s, t.clientX - i) * 180 / Math.PI;
|
|
27
|
+
}
|
|
28
|
+
function h() {
|
|
29
|
+
r && cancelAnimationFrame(r), r = 0, a.classList.remove("is-spin-active");
|
|
30
|
+
}
|
|
31
|
+
function k() {
|
|
32
|
+
const t = _();
|
|
33
|
+
if (t === 0) return 0;
|
|
34
|
+
const e = 360 / t, i = (-d % 360 + 360) % 360;
|
|
35
|
+
return Math.floor(i / e) % t;
|
|
36
|
+
}
|
|
37
|
+
function y(t) {
|
|
38
|
+
const e = t !== void 0 ? t : k();
|
|
39
|
+
a.classList.add("is-prize-hit"), u && clearTimeout(u), u = window.setTimeout(() => {
|
|
40
|
+
a.classList.remove("is-prize-hit"), u = 0, z?.();
|
|
41
|
+
}, mt), B?.(e);
|
|
42
|
+
}
|
|
43
|
+
function G(t, e = !0) {
|
|
44
|
+
h(), a.classList.add("is-spin-active");
|
|
45
|
+
let i = performance.now(), s = Math.max(-H, Math.min(H, t));
|
|
46
|
+
function o(c) {
|
|
47
|
+
const m = Math.min(32, c - i);
|
|
48
|
+
i = c, v(d + s * m), s *= Math.pow(ut, m / 16.67), Math.abs(s) > O ? r = requestAnimationFrame(o) : (r = 0, a.classList.remove("is-spin-active"), e && y());
|
|
49
|
+
}
|
|
50
|
+
r = requestAnimationFrame(o);
|
|
51
|
+
}
|
|
52
|
+
function V() {
|
|
53
|
+
const t = l.getBoundingClientRect(), e = t.left + t.width / 2, i = t.top + t.height / 2;
|
|
54
|
+
a.classList.add("is-spinning");
|
|
55
|
+
const s = a;
|
|
56
|
+
if (clearTimeout(s._spinGlowTimer), s._spinGlowTimer = setTimeout(() => a.classList.remove("is-spinning"), 960), !E) {
|
|
57
|
+
const o = window.matchMedia("(pointer: coarse), (max-width: 640px)").matches;
|
|
58
|
+
at(q, e, i, o ? 8 : 18);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function X(t) {
|
|
62
|
+
l.style.animation = "none", h(), a.classList.remove("is-prize-hit"), u && (clearTimeout(u), u = 0), p = "free", t !== void 0 ? f = t : f = -(vt + Math.random() * ht);
|
|
63
|
+
const e = t !== void 0 ? Math.min(x, Math.abs(t)) : x;
|
|
64
|
+
V(), D?.(), a.classList.add("is-spin-active");
|
|
65
|
+
let i = performance.now();
|
|
66
|
+
function s(o) {
|
|
67
|
+
if (p !== "free") return;
|
|
68
|
+
const c = Math.min(32, o - i);
|
|
69
|
+
i = o, v(d + f * c), f *= Math.pow(lt, c / 16.67), Math.abs(f) < e && (f = f < 0 ? -e : e), r = requestAnimationFrame(s);
|
|
70
|
+
}
|
|
71
|
+
r = requestAnimationFrame(s);
|
|
72
|
+
}
|
|
73
|
+
function W(t) {
|
|
74
|
+
p === "free" && (p = "targeted", h(), $(t));
|
|
75
|
+
}
|
|
76
|
+
function Z() {
|
|
77
|
+
if (p !== "free") return;
|
|
78
|
+
p = "aborting", h();
|
|
79
|
+
let t = performance.now(), e = f;
|
|
80
|
+
a.classList.add("is-spin-active");
|
|
81
|
+
function i(s) {
|
|
82
|
+
const o = Math.min(32, s - t);
|
|
83
|
+
t = s, v(d + e * o), e *= Math.pow(ct, o / 16.67), Math.abs(e) > O ? r = requestAnimationFrame(i) : (r = 0, a.classList.remove("is-spin-active"), p = "idle", U?.());
|
|
84
|
+
}
|
|
85
|
+
r = requestAnimationFrame(i);
|
|
86
|
+
}
|
|
87
|
+
function N(t) {
|
|
88
|
+
h();
|
|
89
|
+
const e = d, i = t - e;
|
|
90
|
+
if (Math.abs(i) < 0.5) {
|
|
91
|
+
v(t);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const s = Math.min(600, Math.max(300, Math.abs(i) * 5)), o = performance.now();
|
|
95
|
+
function c(m) {
|
|
96
|
+
const g = Math.min(1, (m - o) / s), T = 1 - Math.pow(1 - g, 3);
|
|
97
|
+
v(e + i * T), g < 1 ? r = requestAnimationFrame(c) : (r = 0, v(t));
|
|
98
|
+
}
|
|
99
|
+
r = requestAnimationFrame(c);
|
|
100
|
+
}
|
|
101
|
+
function $(t) {
|
|
102
|
+
const e = _();
|
|
103
|
+
if (e === 0) return;
|
|
104
|
+
const i = 360 / e, s = (t + 0.5) * i, o = (-d % 360 + 360) % 360, c = ((s - o) % 360 + 360) % 360, m = f <= 0, g = m ? c : (360 - c) % 360, T = Math.abs(f), tt = E ? 2 : Math.max(2, Math.round(T * 3)), I = g + tt * 360, A = d, F = m ? A - I : A + I, et = Math.max(ft, T), nt = Math.max(
|
|
105
|
+
dt,
|
|
106
|
+
Math.min(pt, 2 * I / et)
|
|
107
|
+
), it = performance.now();
|
|
108
|
+
a.classList.add("is-spin-active");
|
|
109
|
+
function b(st) {
|
|
110
|
+
const C = Math.min(1, (st - it) / nt), ot = 1 - Math.pow(1 - C, 2);
|
|
111
|
+
v(A + (F - A) * ot), C < 1 ? r = requestAnimationFrame(b) : (r = 0, a.classList.remove("is-spin-active"), p = "idle", v(F), y(t));
|
|
112
|
+
}
|
|
113
|
+
r = requestAnimationFrame(b);
|
|
114
|
+
}
|
|
115
|
+
function j(t) {
|
|
116
|
+
t.classList.remove("is-pressing"), t.offsetWidth, t.classList.add("is-pressing");
|
|
117
|
+
const e = t;
|
|
118
|
+
clearTimeout(e._pressTimer), e._pressTimer = setTimeout(() => t.classList.remove("is-pressing"), 620);
|
|
119
|
+
}
|
|
120
|
+
function R(t) {
|
|
121
|
+
if (M.centerButtonEl && M.centerButtonEl.contains(t.target) || p !== "idle") return;
|
|
122
|
+
if (n !== null) {
|
|
123
|
+
l.releasePointerCapture(n.pointerId), a.classList.remove("is-dragging"), N(n.startRotation), n = null;
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if (!t.isPrimary) return;
|
|
127
|
+
t.preventDefault(), Y?.(), h(), a.classList.add("is-dragging"), l.setPointerCapture?.(t.pointerId);
|
|
128
|
+
const e = S(t);
|
|
129
|
+
n = {
|
|
130
|
+
pointerId: t.pointerId,
|
|
131
|
+
startAngle: e,
|
|
132
|
+
previousAngle: e,
|
|
133
|
+
startRotation: d,
|
|
134
|
+
previousTime: performance.now(),
|
|
135
|
+
velocity: 0,
|
|
136
|
+
didDrag: !1,
|
|
137
|
+
cumulativeDelta: 0,
|
|
138
|
+
velocityHistory: [{ cumulative: 0, t: performance.now() }]
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function P(t) {
|
|
142
|
+
if (!n || t.pointerId !== n.pointerId) return;
|
|
143
|
+
t.preventDefault();
|
|
144
|
+
const e = performance.now(), i = S(t), s = w(i - n.startAngle), o = w(i - n.previousAngle), c = Math.max(8, e - n.previousTime);
|
|
145
|
+
Math.abs(s) > 2 && (n.didDrag = !0), v(n.startRotation + s), n.velocity = o / c, n.previousAngle = i, n.previousTime = e, n.cumulativeDelta += o, n.velocityHistory.push({ cumulative: n.cumulativeDelta, t: e });
|
|
146
|
+
const m = e - 150;
|
|
147
|
+
for (; n.velocityHistory.length > 2 && n.velocityHistory[0].t < m; )
|
|
148
|
+
n.velocityHistory.shift();
|
|
149
|
+
}
|
|
150
|
+
function L(t) {
|
|
151
|
+
if (!n || t.pointerId !== n.pointerId) return;
|
|
152
|
+
const e = n.velocityHistory;
|
|
153
|
+
let i;
|
|
154
|
+
if (e.length >= 2) {
|
|
155
|
+
const c = e[0], m = e[e.length - 1], g = m.t - c.t;
|
|
156
|
+
i = g > 0 ? (m.cumulative - c.cumulative) / g : n.velocity;
|
|
157
|
+
} else
|
|
158
|
+
i = n.velocity;
|
|
159
|
+
const s = n.didDrag, o = n.startRotation;
|
|
160
|
+
n = null, a.classList.remove("is-dragging"), l.releasePointerCapture?.(t.pointerId), s && Math.abs(i) > rt ? M.onDragRelease ? M.onDragRelease(i) : (D?.(), G(i, !0)) : s && N(o);
|
|
161
|
+
}
|
|
162
|
+
function J() {
|
|
163
|
+
l.addEventListener("pointerdown", R), l.addEventListener("pointermove", P), l.addEventListener("pointerup", L), l.addEventListener("pointercancel", L);
|
|
164
|
+
}
|
|
165
|
+
function K() {
|
|
166
|
+
h(), u && (clearTimeout(u), u = 0, a.classList.remove("is-prize-hit")), p = "idle", n = null;
|
|
167
|
+
}
|
|
168
|
+
function Q() {
|
|
169
|
+
h(), u && clearTimeout(u), l.removeEventListener("pointerdown", R), l.removeEventListener("pointermove", P), l.removeEventListener("pointerup", L), l.removeEventListener("pointercancel", L);
|
|
170
|
+
}
|
|
171
|
+
return { startFreeSpin: X, landOnIndex: W, abortSpin: Z, reset: K, enableDrag: J, destroy: Q, centerButtonPress: j };
|
|
172
|
+
}
|
|
173
|
+
export {
|
|
174
|
+
Lt as c
|
|
175
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const st=require("./sparkles-C2rT-gN_.cjs"),u=require("./constants-Ds7J0meH.cjs");function ot(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,m=0,f="idle",v=0,i=null;h(p);function h(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"),m&&clearTimeout(m),m=window.setTimeout(()=>{a.classList.remove("is-prize-hit"),m=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 d=Math.min(32,l-n);n=l,h(p+s*d),s*=Math.pow(u.SPIN_DECAY,d/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;st.burstSparkles(B,e,n,r?8:18)}}function V(t){o.style.animation="none",M(),a.classList.remove("is-prize-hit"),m&&(clearTimeout(m),m=0),f="free",t!==void 0?v=t:v=-(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(f!=="free")return;const l=Math.min(32,r-n);n=r,h(p+v*l),v*=Math.pow(u.FREE_SPIN_DECAY,l/16.67),Math.abs(v)<e&&(v=v<0?-e:e),c=requestAnimationFrame(s)}c=requestAnimationFrame(s)}function z(t){f==="free"&&(f="targeted",M(),W(t))}function X(){if(f!=="free")return;f="aborting",M();let t=performance.now(),e=v;a.classList.add("is-spin-active");function n(s){const r=Math.min(32,s-t);t=s,h(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"),f="idle",R==null||R())}c=requestAnimationFrame(n)}function C(t){M();const e=p,n=t-e;if(Math.abs(n)<.5){h(t);return}const s=Math.min(600,Math.max(300,Math.abs(n)*5)),r=performance.now();function l(d){const g=Math.min(1,(d-r)/s),L=1-Math.pow(1-g,3);h(e+n*L),g<1?c=requestAnimationFrame(l):(c=0,h(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,d=v<=0,g=d?l:(360-l)%360,L=Math.abs(v),K=P?2:Math.max(2,Math.round(L*3)),w=g+K*360,A=p,q=d?A-w:A+w,Q=Math.max(u.LANDING_MIN_VELOCITY,L),tt=Math.max(u.LANDING_MIN_DURATION_MS,Math.min(u.LANDING_MAX_DURATION_MS,2*w/Q)),et=performance.now();a.classList.add("is-spin-active");function x(nt){const Y=Math.min(1,(nt-et)/tt),it=1-Math.pow(1-Y,2);h(A+(q-A)*it),Y<1?c=requestAnimationFrame(x):(c=0,a.classList.remove("is-spin-active"),f="idle",h(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)||f!=="idle")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),h(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 d=e-150;for(;i.velocityHistory.length>2&&i.velocityHistory[0].t<d;)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 d=e[0],g=e[e.length-1],L=g.t-d.t;n=L>0?(g.cumulative-d.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(),m&&(clearTimeout(m),m=0,a.classList.remove("is-prize-hit")),f="idle",i=null}function J(){M(),m&&clearTimeout(m),o.removeEventListener("pointerdown",b),o.removeEventListener("pointermove",H),o.removeEventListener("pointerup",_),o.removeEventListener("pointercancel",_)}return{startFreeSpin:V,landOnIndex:z,abortSpin:X,reset:j,enableDrag:$,destroy:J,centerButtonPress:Z}}exports.createSpinController=ot;
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { b as at } from "./sparkles-BXFe6GK6.js";
|
|
2
|
+
import { D as rt, A as ct, S as Y, F as lt, a as B, b as ut, P as mt, c as U, L as ft, d as dt, e as pt, f as vt, g as ht } from "./constants-DgCBmV7S.js";
|
|
3
|
+
function Lt(T) {
|
|
4
|
+
const {
|
|
5
|
+
stage: r,
|
|
6
|
+
disc: o,
|
|
7
|
+
sparkleLayer: k,
|
|
8
|
+
sliceCount: N,
|
|
9
|
+
onSpinStart: L,
|
|
10
|
+
onDragStart: _,
|
|
11
|
+
onSettled: E,
|
|
12
|
+
onPrizeClear: D,
|
|
13
|
+
onSpinAbort: w,
|
|
14
|
+
liteMode: R
|
|
15
|
+
} = T;
|
|
16
|
+
let f = 0, c = 0, u = 0, d = "idle", p = 0, i = null;
|
|
17
|
+
v(f);
|
|
18
|
+
function v(t) {
|
|
19
|
+
f = t, o.style.setProperty("--wheel-rotation", `${t}deg`);
|
|
20
|
+
}
|
|
21
|
+
function P(t) {
|
|
22
|
+
return (t + 540) % 360 - 180;
|
|
23
|
+
}
|
|
24
|
+
function F(t) {
|
|
25
|
+
const e = o.getBoundingClientRect(), n = e.left + e.width / 2, s = e.top + e.height / 2;
|
|
26
|
+
return Math.atan2(t.clientY - s, t.clientX - n) * 180 / Math.PI;
|
|
27
|
+
}
|
|
28
|
+
function h() {
|
|
29
|
+
c && cancelAnimationFrame(c), c = 0, r.classList.remove("is-spin-active");
|
|
30
|
+
}
|
|
31
|
+
function G() {
|
|
32
|
+
const t = N();
|
|
33
|
+
if (t === 0) return 0;
|
|
34
|
+
const e = 360 / t, n = (-f % 360 + 360) % 360;
|
|
35
|
+
return Math.floor(n / e) % t;
|
|
36
|
+
}
|
|
37
|
+
function O(t) {
|
|
38
|
+
const e = t !== void 0 ? t : G();
|
|
39
|
+
r.classList.add("is-prize-hit"), u && clearTimeout(u), u = window.setTimeout(() => {
|
|
40
|
+
r.classList.remove("is-prize-hit"), u = 0, D == null || D();
|
|
41
|
+
}, mt), E == null || E(e);
|
|
42
|
+
}
|
|
43
|
+
function z(t, e = !0) {
|
|
44
|
+
h(), r.classList.add("is-spin-active");
|
|
45
|
+
let n = performance.now(), s = Math.max(-U, Math.min(U, t));
|
|
46
|
+
function a(l) {
|
|
47
|
+
const m = Math.min(32, l - n);
|
|
48
|
+
n = l, v(f + s * m), s *= Math.pow(ut, m / 16.67), Math.abs(s) > Y ? c = requestAnimationFrame(a) : (c = 0, r.classList.remove("is-spin-active"), e && O());
|
|
49
|
+
}
|
|
50
|
+
c = requestAnimationFrame(a);
|
|
51
|
+
}
|
|
52
|
+
function V() {
|
|
53
|
+
const t = o.getBoundingClientRect(), e = t.left + t.width / 2, n = t.top + t.height / 2;
|
|
54
|
+
r.classList.add("is-spinning");
|
|
55
|
+
const s = r;
|
|
56
|
+
if (clearTimeout(s._spinGlowTimer), s._spinGlowTimer = setTimeout(() => r.classList.remove("is-spinning"), 960), !R) {
|
|
57
|
+
const a = window.matchMedia("(pointer: coarse), (max-width: 640px)").matches;
|
|
58
|
+
at(k, e, n, a ? 8 : 18);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function X(t) {
|
|
62
|
+
o.style.animation = "none", h(), r.classList.remove("is-prize-hit"), u && (clearTimeout(u), u = 0), d = "free", t !== void 0 ? p = t : p = -(vt + Math.random() * ht);
|
|
63
|
+
const e = t !== void 0 ? Math.min(B, Math.abs(t)) : B;
|
|
64
|
+
V(), L == null || L(), r.classList.add("is-spin-active");
|
|
65
|
+
let n = performance.now();
|
|
66
|
+
function s(a) {
|
|
67
|
+
if (d !== "free") return;
|
|
68
|
+
const l = Math.min(32, a - n);
|
|
69
|
+
n = a, v(f + p * l), p *= Math.pow(lt, l / 16.67), Math.abs(p) < e && (p = p < 0 ? -e : e), c = requestAnimationFrame(s);
|
|
70
|
+
}
|
|
71
|
+
c = requestAnimationFrame(s);
|
|
72
|
+
}
|
|
73
|
+
function W(t) {
|
|
74
|
+
d === "free" && (d = "targeted", h(), $(t));
|
|
75
|
+
}
|
|
76
|
+
function Z() {
|
|
77
|
+
if (d !== "free") return;
|
|
78
|
+
d = "aborting", h();
|
|
79
|
+
let t = performance.now(), e = p;
|
|
80
|
+
r.classList.add("is-spin-active");
|
|
81
|
+
function n(s) {
|
|
82
|
+
const a = Math.min(32, s - t);
|
|
83
|
+
t = s, v(f + e * a), e *= Math.pow(ct, a / 16.67), Math.abs(e) > Y ? c = requestAnimationFrame(n) : (c = 0, r.classList.remove("is-spin-active"), d = "idle", w == null || w());
|
|
84
|
+
}
|
|
85
|
+
c = requestAnimationFrame(n);
|
|
86
|
+
}
|
|
87
|
+
function b(t) {
|
|
88
|
+
h();
|
|
89
|
+
const e = f, n = t - e;
|
|
90
|
+
if (Math.abs(n) < 0.5) {
|
|
91
|
+
v(t);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const s = Math.min(600, Math.max(300, Math.abs(n) * 5)), a = performance.now();
|
|
95
|
+
function l(m) {
|
|
96
|
+
const M = Math.min(1, (m - a) / s), g = 1 - Math.pow(1 - M, 3);
|
|
97
|
+
v(e + n * g), M < 1 ? c = requestAnimationFrame(l) : (c = 0, v(t));
|
|
98
|
+
}
|
|
99
|
+
c = requestAnimationFrame(l);
|
|
100
|
+
}
|
|
101
|
+
function $(t) {
|
|
102
|
+
const e = N();
|
|
103
|
+
if (e === 0) return;
|
|
104
|
+
const n = 360 / e, s = (t + 0.5) * n, a = (-f % 360 + 360) % 360, l = ((s - a) % 360 + 360) % 360, m = p <= 0, M = m ? l : (360 - l) % 360, g = Math.abs(p), tt = R ? 2 : Math.max(2, Math.round(g * 3)), y = M + tt * 360, A = f, x = m ? A - y : A + y, et = Math.max(pt, g), nt = Math.max(
|
|
105
|
+
ft,
|
|
106
|
+
Math.min(dt, 2 * y / et)
|
|
107
|
+
), it = performance.now();
|
|
108
|
+
r.classList.add("is-spin-active");
|
|
109
|
+
function H(st) {
|
|
110
|
+
const q = Math.min(1, (st - it) / nt), ot = 1 - Math.pow(1 - q, 2);
|
|
111
|
+
v(A + (x - A) * ot), q < 1 ? c = requestAnimationFrame(H) : (c = 0, r.classList.remove("is-spin-active"), d = "idle", v(x), O(t));
|
|
112
|
+
}
|
|
113
|
+
c = requestAnimationFrame(H);
|
|
114
|
+
}
|
|
115
|
+
function j(t) {
|
|
116
|
+
t.classList.remove("is-pressing"), t.offsetWidth, t.classList.add("is-pressing");
|
|
117
|
+
const e = t;
|
|
118
|
+
clearTimeout(e._pressTimer), e._pressTimer = setTimeout(() => t.classList.remove("is-pressing"), 620);
|
|
119
|
+
}
|
|
120
|
+
function C(t) {
|
|
121
|
+
var n;
|
|
122
|
+
if (T.centerButtonEl && T.centerButtonEl.contains(t.target) || d !== "idle") return;
|
|
123
|
+
if (i !== null) {
|
|
124
|
+
o.releasePointerCapture(i.pointerId), r.classList.remove("is-dragging"), b(i.startRotation), i = null;
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (!t.isPrimary) return;
|
|
128
|
+
t.preventDefault(), _ == null || _(), h(), r.classList.add("is-dragging"), (n = o.setPointerCapture) == null || n.call(o, t.pointerId);
|
|
129
|
+
const e = F(t);
|
|
130
|
+
i = {
|
|
131
|
+
pointerId: t.pointerId,
|
|
132
|
+
startAngle: e,
|
|
133
|
+
previousAngle: e,
|
|
134
|
+
startRotation: f,
|
|
135
|
+
previousTime: performance.now(),
|
|
136
|
+
velocity: 0,
|
|
137
|
+
didDrag: !1,
|
|
138
|
+
cumulativeDelta: 0,
|
|
139
|
+
velocityHistory: [{ cumulative: 0, t: performance.now() }]
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function S(t) {
|
|
143
|
+
if (!i || t.pointerId !== i.pointerId) return;
|
|
144
|
+
t.preventDefault();
|
|
145
|
+
const e = performance.now(), n = F(t), s = P(n - i.startAngle), a = P(n - i.previousAngle), l = Math.max(8, e - i.previousTime);
|
|
146
|
+
Math.abs(s) > 2 && (i.didDrag = !0), v(i.startRotation + s), i.velocity = a / l, i.previousAngle = n, i.previousTime = e, i.cumulativeDelta += a, i.velocityHistory.push({ cumulative: i.cumulativeDelta, t: e });
|
|
147
|
+
const m = e - 150;
|
|
148
|
+
for (; i.velocityHistory.length > 2 && i.velocityHistory[0].t < m; )
|
|
149
|
+
i.velocityHistory.shift();
|
|
150
|
+
}
|
|
151
|
+
function I(t) {
|
|
152
|
+
var l;
|
|
153
|
+
if (!i || t.pointerId !== i.pointerId) return;
|
|
154
|
+
const e = i.velocityHistory;
|
|
155
|
+
let n;
|
|
156
|
+
if (e.length >= 2) {
|
|
157
|
+
const m = e[0], M = e[e.length - 1], g = M.t - m.t;
|
|
158
|
+
n = g > 0 ? (M.cumulative - m.cumulative) / g : i.velocity;
|
|
159
|
+
} else
|
|
160
|
+
n = i.velocity;
|
|
161
|
+
const s = i.didDrag, a = i.startRotation;
|
|
162
|
+
i = null, r.classList.remove("is-dragging"), (l = o.releasePointerCapture) == null || l.call(o, t.pointerId), s && Math.abs(n) > rt ? T.onDragRelease ? T.onDragRelease(n) : (L == null || L(), z(n, !0)) : s && b(a);
|
|
163
|
+
}
|
|
164
|
+
function J() {
|
|
165
|
+
o.addEventListener("pointerdown", C), o.addEventListener("pointermove", S), o.addEventListener("pointerup", I), o.addEventListener("pointercancel", I);
|
|
166
|
+
}
|
|
167
|
+
function K() {
|
|
168
|
+
h(), u && (clearTimeout(u), u = 0, r.classList.remove("is-prize-hit")), d = "idle", i = null;
|
|
169
|
+
}
|
|
170
|
+
function Q() {
|
|
171
|
+
h(), u && clearTimeout(u), o.removeEventListener("pointerdown", C), o.removeEventListener("pointermove", S), o.removeEventListener("pointerup", I), o.removeEventListener("pointercancel", I);
|
|
172
|
+
}
|
|
173
|
+
return { startFreeSpin: X, landOnIndex: W, abortSpin: Z, reset: K, enableDrag: J, destroy: Q, centerButtonPress: j };
|
|
174
|
+
}
|
|
175
|
+
export {
|
|
176
|
+
Lt as c
|
|
177
|
+
};
|