@everymatrix/mini-games-hub 0.2.8 → 0.2.10

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 (67) hide show
  1. package/components/ArrowLeftIcon--eD-7fsx.cjs +1 -0
  2. package/components/ArrowLeftIcon-Bfs5TaL6.js +20 -0
  3. package/components/ArrowLeftIcon-D98iyiSl.js +20 -0
  4. package/components/ArrowLeftIcon-Ypzji-S_.cjs +1 -0
  5. package/components/{CoinFlip-BOrc1Sgy.cjs → CoinFlip-BI2KQoYz.cjs} +1 -1
  6. package/components/{CoinFlip-uc2aguuz.js → CoinFlip-BxeM60kP.js} +2 -2
  7. package/components/{CoinFlip-DgM6tDy5.js → CoinFlip-CIqBL9-4.js} +18 -18
  8. package/components/{CoinFlip-DiCOvx3Q.cjs → CoinFlip-tTQwMgSv.cjs} +1 -1
  9. package/components/{CoinRoyale-DLL1bCAy.js → CoinRoyale-AIjHyYRF.js} +120 -116
  10. package/components/{CoinRoyale-Bkr3Rd-u.cjs → CoinRoyale-B08ETrbd.cjs} +4 -4
  11. package/components/{CoinRoyale-BH73ZSrU.cjs → CoinRoyale-DqOsokVD.cjs} +4 -4
  12. package/components/{CoinRoyale-fp-xfwl2.js → CoinRoyale-gjCYpNk5.js} +105 -101
  13. package/components/{GameCard-D78hDMaL.js → GameCard-BAO-RWT9.js} +36 -36
  14. package/components/{GameCard-BiO9Cay-.cjs → GameCard-CehoUog_.cjs} +3 -3
  15. package/components/{GameCard-Qh_fk15-.cjs → GameCard-DfHnwOqs.cjs} +3 -3
  16. package/components/{GameCard-jCZ6S2Wu.js → GameCard-pddtwXsP.js} +31 -31
  17. package/components/{MiniGamesHub-Bf2Cd1bB.js → MiniGamesHub-BPYHmhQ0.js} +157 -88
  18. package/components/{MiniGamesHub-KqAdBJEX.js → MiniGamesHub-CJjxsGLO.js} +138 -69
  19. package/components/MiniGamesHub-DzY6bqFU.cjs +79 -0
  20. package/components/MiniGamesHub-rHaCMzIp.cjs +79 -0
  21. package/components/{WheelOfFortune-CBYo6vCg.js → WheelOfFortune-Bz-AxMjO.js} +20 -20
  22. package/components/{WheelOfFortune-CDTzbAjp.cjs → WheelOfFortune-C0aA8AWD.cjs} +1 -1
  23. package/components/{WheelOfFortune-8HCl7aHv.js → WheelOfFortune-CBD1u1Ya.js} +29 -29
  24. package/components/{WheelOfFortune-XfmUFV3-.cjs → WheelOfFortune-D3EtOxbR.cjs} +1 -1
  25. package/components/WheelOfFortuneDrawResults-BBd3dkqS.cjs +1 -0
  26. package/components/WheelOfFortuneDrawResults-D7SxQsQ4.cjs +1 -0
  27. package/components/WheelOfFortuneDrawResults-Dg54Kewh.js +286 -0
  28. package/components/WheelOfFortuneDrawResults-XxUjXAw4.js +261 -0
  29. package/components/WheelOfFortuneHistory-C8xiNova.js +222 -0
  30. package/components/WheelOfFortuneHistory-KBjh_Fju.cjs +13 -0
  31. package/components/WheelOfFortuneHistory-QwT2V9EM.cjs +13 -0
  32. package/components/WheelOfFortuneHistory-txMyUapV.js +223 -0
  33. package/components/WheelOfFortuneRules-BJENXLzh.cjs +5 -0
  34. package/components/WheelOfFortuneRules-BtC1z4Di.js +109 -0
  35. package/components/WheelOfFortuneRules-C3McWywL.js +120 -0
  36. package/components/WheelOfFortuneRules-YSDAQ18X.cjs +5 -0
  37. package/components/{WheelOfFortuneWheel-F62aU_CL.js → WheelOfFortuneWheel-B11sYKJn.js} +364 -346
  38. package/components/{WheelOfFortuneWheel-CiyQZNAd.js → WheelOfFortuneWheel-D1cbM2SU.js} +718 -700
  39. package/components/WheelOfFortuneWheel-DB0BZCUo.cjs +3 -0
  40. package/components/WheelOfFortuneWheel-DWAdby4o.cjs +3 -0
  41. package/components/utils-BqkCy2Rz.cjs +3 -0
  42. package/components/{utils-3LNftCeZ.js → utils-CzSqbDv1.js} +633 -639
  43. package/components/{utils-DGrEJJ_K.js → utils-UAFcjwcH.js} +1737 -1745
  44. package/components/utils-uE8V9ar8.cjs +3 -0
  45. package/es2015/mini-games-hub.cjs +1 -1
  46. package/es2015/mini-games-hub.js +1 -1
  47. package/esnext/mini-games-hub.cjs +1 -1
  48. package/esnext/mini-games-hub.js +1 -1
  49. package/package.json +1 -1
  50. package/components/MiniGamesHub-5tuj6CDm.cjs +0 -16
  51. package/components/MiniGamesHub-SxucWl3S.cjs +0 -16
  52. package/components/WheelOfFortuneDrawResults-CASEqNiM.cjs +0 -1
  53. package/components/WheelOfFortuneDrawResults-DqgsImHB.js +0 -254
  54. package/components/WheelOfFortuneDrawResults-DsfJ3803.js +0 -279
  55. package/components/WheelOfFortuneDrawResults-l8iWZa_e.cjs +0 -1
  56. package/components/WheelOfFortuneHistory-CF8B0i5m.js +0 -213
  57. package/components/WheelOfFortuneHistory-Cnk8otCw.js +0 -213
  58. package/components/WheelOfFortuneHistory-DARohsMs.cjs +0 -12
  59. package/components/WheelOfFortuneHistory-ld2sGzjI.cjs +0 -12
  60. package/components/WheelOfFortuneRules-BZqR4cT9.js +0 -118
  61. package/components/WheelOfFortuneRules-Bv-d_VAp.cjs +0 -3
  62. package/components/WheelOfFortuneRules-CRGG3J0S.js +0 -107
  63. package/components/WheelOfFortuneRules-DLj96pqu.cjs +0 -3
  64. package/components/WheelOfFortuneWheel-CrRAYCB1.cjs +0 -3
  65. package/components/WheelOfFortuneWheel-DGD-zfeE.cjs +0 -3
  66. package/components/utils-BxNmJ6YA.cjs +0 -3
  67. package/components/utils-DyVEmMSf.cjs +0 -3
@@ -0,0 +1 @@
1
+ "use strict";const e=require("./WheelOfFortuneWheel-DB0BZCUo.cjs"),t=require("./utils-BqkCy2Rz.cjs");var C=e.from_svg('<svg viewBox="0 0 14 13" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M6.41602 0.508789C6.52096 0.508793 6.59652 0.539241 6.66797 0.602539C6.7386 0.67644 6.76557 0.747068 6.76562 0.837891C6.76562 0.932337 6.7377 1.00571 6.66113 1.08203H6.66016L2.52344 5.21777L1.6543 6.08691H12.3633C12.475 6.08691 12.5456 6.11894 12.6084 6.18164C12.6712 6.24445 12.7034 6.31429 12.7031 6.4248C12.7029 6.53664 12.67 6.60779 12.6064 6.67188C12.5449 6.73387 12.4767 6.76611 12.3662 6.76562H1.6543L2.52344 7.63477L6.68066 11.791C6.75777 11.8681 6.77865 11.933 6.77637 12.0098C6.77383 12.0944 6.7457 12.1683 6.66797 12.249C6.58857 12.3195 6.50864 12.3512 6.40918 12.3545C6.33349 12.357 6.26929 12.3368 6.19238 12.2598L0.592773 6.66016C0.553631 6.62101 0.537222 6.59146 0.530273 6.57227C0.516661 6.53445 0.508264 6.48865 0.508789 6.43164C0.509411 6.36947 0.519283 6.31813 0.53418 6.27539C0.539753 6.25947 0.553255 6.23167 0.591797 6.19336L6.19238 0.592773C6.24602 0.539241 6.30834 0.508789 6.41602 0.508789Z" stroke="currentColor" stroke-width="1.018"></path></svg>');function n(c,r){t.push(r,!0);const s=e.prop(r,"class",7,"");var a={get class(){return s()},set class(l=""){s(l),t.flushSync()}},o=C();return t.template_effect(()=>e.set_class(o,0,e.clsx(s()))),e.append(c,o),t.pop(a)}e.create_custom_element(n,{class:{}},[],[],{mode:"open"});exports.ArrowLeftIcon=n;
@@ -0,0 +1,20 @@
1
+ import { c as C, p as c, e as n, n as p, q as l, y as m } from "./WheelOfFortuneWheel-B11sYKJn.js";
2
+ import { a5 as f, ar as u, a9 as v, aU as i } from "./utils-CzSqbDv1.js";
3
+ var g = p('<svg viewBox="0 0 14 13" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M6.41602 0.508789C6.52096 0.508793 6.59652 0.539241 6.66797 0.602539C6.7386 0.67644 6.76557 0.747068 6.76562 0.837891C6.76562 0.932337 6.7377 1.00571 6.66113 1.08203H6.66016L2.52344 5.21777L1.6543 6.08691H12.3633C12.475 6.08691 12.5456 6.11894 12.6084 6.18164C12.6712 6.24445 12.7034 6.31429 12.7031 6.4248C12.7029 6.53664 12.67 6.60779 12.6064 6.67188C12.5449 6.73387 12.4767 6.76611 12.3662 6.76562H1.6543L2.52344 7.63477L6.68066 11.791C6.75777 11.8681 6.77865 11.933 6.77637 12.0098C6.77383 12.0944 6.7457 12.1683 6.66797 12.249C6.58857 12.3195 6.50864 12.3512 6.40918 12.3545C6.33349 12.357 6.26929 12.3368 6.19238 12.2598L0.592773 6.66016C0.553631 6.62101 0.537222 6.59146 0.530273 6.57227C0.516661 6.53445 0.508264 6.48865 0.508789 6.43164C0.509411 6.36947 0.519283 6.31813 0.53418 6.27539C0.539753 6.25947 0.553255 6.23167 0.591797 6.19336L6.19238 0.592773C6.24602 0.539241 6.30834 0.508789 6.41602 0.508789Z" stroke="currentColor" stroke-width="1.018"></path></svg>');
4
+ function h(t, a) {
5
+ f(a, !0);
6
+ const s = c(a, "class", 7, "");
7
+ var r = {
8
+ get class() {
9
+ return s();
10
+ },
11
+ set class(o = "") {
12
+ s(o), i();
13
+ }
14
+ }, e = g();
15
+ return u(() => l(e, 0, m(s()))), n(t, e), v(r);
16
+ }
17
+ C(h, { class: {} }, [], [], { mode: "open" });
18
+ export {
19
+ h as A
20
+ };
@@ -0,0 +1,20 @@
1
+ import { c as C, p as c, e as n, n as p, q as l, y as m } from "./WheelOfFortuneWheel-D1cbM2SU.js";
2
+ import { a5 as f, ar as u, a9 as v, aU as i } from "./utils-UAFcjwcH.js";
3
+ var g = p('<svg viewBox="0 0 14 13" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M6.41602 0.508789C6.52096 0.508793 6.59652 0.539241 6.66797 0.602539C6.7386 0.67644 6.76557 0.747068 6.76562 0.837891C6.76562 0.932337 6.7377 1.00571 6.66113 1.08203H6.66016L2.52344 5.21777L1.6543 6.08691H12.3633C12.475 6.08691 12.5456 6.11894 12.6084 6.18164C12.6712 6.24445 12.7034 6.31429 12.7031 6.4248C12.7029 6.53664 12.67 6.60779 12.6064 6.67188C12.5449 6.73387 12.4767 6.76611 12.3662 6.76562H1.6543L2.52344 7.63477L6.68066 11.791C6.75777 11.8681 6.77865 11.933 6.77637 12.0098C6.77383 12.0944 6.7457 12.1683 6.66797 12.249C6.58857 12.3195 6.50864 12.3512 6.40918 12.3545C6.33349 12.357 6.26929 12.3368 6.19238 12.2598L0.592773 6.66016C0.553631 6.62101 0.537222 6.59146 0.530273 6.57227C0.516661 6.53445 0.508264 6.48865 0.508789 6.43164C0.509411 6.36947 0.519283 6.31813 0.53418 6.27539C0.539753 6.25947 0.553255 6.23167 0.591797 6.19336L6.19238 0.592773C6.24602 0.539241 6.30834 0.508789 6.41602 0.508789Z" stroke="currentColor" stroke-width="1.018"></path></svg>');
4
+ function h(t, a) {
5
+ f(a, !0);
6
+ const s = c(a, "class", 7, "");
7
+ var r = {
8
+ get class() {
9
+ return s();
10
+ },
11
+ set class(o = "") {
12
+ s(o), i();
13
+ }
14
+ }, e = g();
15
+ return u(() => l(e, 0, m(s()))), n(t, e), v(r);
16
+ }
17
+ C(h, { class: {} }, [], [], { mode: "open" });
18
+ export {
19
+ h as A
20
+ };
@@ -0,0 +1 @@
1
+ "use strict";const e=require("./WheelOfFortuneWheel-DWAdby4o.cjs"),t=require("./utils-uE8V9ar8.cjs");var C=e.from_svg('<svg viewBox="0 0 14 13" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M6.41602 0.508789C6.52096 0.508793 6.59652 0.539241 6.66797 0.602539C6.7386 0.67644 6.76557 0.747068 6.76562 0.837891C6.76562 0.932337 6.7377 1.00571 6.66113 1.08203H6.66016L2.52344 5.21777L1.6543 6.08691H12.3633C12.475 6.08691 12.5456 6.11894 12.6084 6.18164C12.6712 6.24445 12.7034 6.31429 12.7031 6.4248C12.7029 6.53664 12.67 6.60779 12.6064 6.67188C12.5449 6.73387 12.4767 6.76611 12.3662 6.76562H1.6543L2.52344 7.63477L6.68066 11.791C6.75777 11.8681 6.77865 11.933 6.77637 12.0098C6.77383 12.0944 6.7457 12.1683 6.66797 12.249C6.58857 12.3195 6.50864 12.3512 6.40918 12.3545C6.33349 12.357 6.26929 12.3368 6.19238 12.2598L0.592773 6.66016C0.553631 6.62101 0.537222 6.59146 0.530273 6.57227C0.516661 6.53445 0.508264 6.48865 0.508789 6.43164C0.509411 6.36947 0.519283 6.31813 0.53418 6.27539C0.539753 6.25947 0.553255 6.23167 0.591797 6.19336L6.19238 0.592773C6.24602 0.539241 6.30834 0.508789 6.41602 0.508789Z" stroke="currentColor" stroke-width="1.018"></path></svg>');function n(c,r){t.push(r,!0);const s=e.prop(r,"class",7,"");var a={get class(){return s()},set class(l=""){s(l),t.flushSync()}},o=C();return t.template_effect(()=>e.set_class(o,0,e.clsx(s()))),e.append(c,o),t.pop(a)}e.create_custom_element(n,{class:{}},[],[],{mode:"open"});exports.ArrowLeftIcon=n;
@@ -1 +1 @@
1
- "use strict";var st=Object.defineProperty,at=Object.defineProperties;var rt=Object.getOwnPropertyDescriptors;var Pe=Object.getOwnPropertySymbols;var ot=Object.prototype.hasOwnProperty,lt=Object.prototype.propertyIsEnumerable;var _e=Math.pow,ke=(p,o,r)=>o in p?st(p,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):p[o]=r,ge=(p,o)=>{for(var r in o||(o={}))ot.call(o,r)&&ke(p,r,o[r]);if(Pe)for(var r of Pe(o))lt.call(o,r)&&ke(p,r,o[r]);return p},Ce=(p,o)=>at(p,rt(o));var ue=(p,o,r)=>new Promise((ee,$)=>{var E=g=>{try{M(r.next(g))}catch(R){$(R)}},F=g=>{try{M(r.throw(g))}catch(R){$(R)}},M=g=>g.done?ee(g.value):Promise.resolve(g.value).then(E,F);M((r=r.apply(p,o)).next())});const n=require("./WheelOfFortuneWheel-DGD-zfeE.cjs"),e=require("./utils-BxNmJ6YA.cjs"),f=require("./constants-CoPH35Re.cjs"),De=require("./coin-heads-BuJOLpyg.cjs"),ct=require("./coin-tails-20vJmhwv.cjs");var dt=n.from_html('<div><span class="coin-royale__chev">︿</span> <span class="coin-royale__hint-text"> </span> <span class="coin-royale__chev coin-royale__chev--down">﹀</span></div> <svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M9 11V5.5a1.5 1.5 0 0 1 3 0V11h.5V7.5a1.5 1.5 0 0 1 3 0V11h.5V9a1.5 1.5 0 0 1 3 0v6.5c0 3-2 5.5-5.5 5.5H12c-2 0-3.2-.8-4.2-2.3l-2.4-3.6a1.5 1.5 0 0 1 2.3-1.9L9 15.5V11Z"></path></svg>',1),_t=n.from_html('<div class="coin-royale__badge"><p class="coin-royale__badge-title"> </p> <p class="coin-royale__badge-countdown"> </p></div>'),gt=n.from_html('<div class="coin-royale__badge"><p class="coin-royale__badge-title"> </p> <p class="coin-royale__badge-body"> </p> <button class="coin-royale__badge-close" type="button"> </button></div>'),ut=n.from_html('<span class="coin-royale__flips-loader"></span>'),ft=n.from_html('<p class="coin-royale__flips"> <span class="coin-royale__flips-count"><img class="coin-royale__flips-icon" alt="" aria-hidden="true"/> <!></span></p>'),pt=n.from_html('<div class="coin-royale__play"><div class="coin-royale__stage"><div role="button"><div class="coin-royale__coin-shadow"></div> <div class="coin-royale__coin"><div class="coin-royale__coin-drop-shadow" aria-hidden="true"></div> <div class="coin-royale__coin-edge" aria-hidden="true"></div> <div class="coin-royale__face coin-royale__face--front"><img alt="" draggable="false"/></div> <div class="coin-royale__face coin-royale__face--back"><img alt="" draggable="false"/></div></div> <!></div> <!></div></div> <!> <button class="coin-royale__cta" type="button"> </button>',1);function Le(p,o){e.push(o,!0);const r=()=>n.store_get(e.$format,"$_",ee),[ee,$]=n.setup_stores();let E=n.prop(o,"program",7,null),F=n.prop(o,"endpoint",7,null),M=n.prop(o,"session",7,null),g=n.prop(o,"isAvailable",7,!1),R=n.prop(o,"spinResults",15,null),y=n.prop(o,"spinActive",15,!1),j=n.prop(o,"remainingTimesLoading",7,!1),te=n.prop(o,"onFlip",7,()=>{}),z=e.state(e.proxy({}));e.user_effect(()=>{if(!g()&&E()){const t=()=>{var s,l;return e.set(z,e.getTimeRemaining((l=(s=E())==null?void 0:s.next)==null?void 0:l.startTime),!0)};t();const i=setInterval(t,1e3);return()=>clearInterval(i)}});let P=e.state(!1),ne;const Ne=()=>{clearTimeout(ne),ne=setTimeout(()=>e.set(P,!1),400)};let G=e.state(!1),I=e.state(void 0),d=e.state(void 0),k=e.state(void 0),A=e.state(void 0);const ie=e.user_derived(()=>g()&&!y()&&!e.get(G)&&!j());let C=0,D=!1,U=!1,se=0,q=0,ae=0,a=null,L=null,fe,N=!1;const Y=(t,i=1,s=0)=>{e.get(d)&&(e.get(d).style.transform=`translateY(${s}px) rotateX(${t}deg) scale(${i})`)};e.user_effect(()=>{if(!e.get(I)||!e.get(d)||!e.get(k))return;pe(),Y(C);const t=new ResizeObserver(()=>pe());return t.observe(e.get(I)),()=>t.disconnect()});const pe=()=>{if(!e.get(I)||!e.get(d)||!e.get(k))return;const t=e.get(I).clientWidth;if(!t)return;const i=t/2*f.RIM_FACTOR,s=Math.max(14,t*f.THICKNESS_FACTOR),l=2*i*Math.tan(Math.PI/f.EDGE_SEGMENTS)+.6;e.get(d).style.setProperty("--half-t",`${(s/2).toFixed(2)}px`),e.get(k).replaceChildren();for(let c=0;c<f.EDGE_SEGMENTS;c++){const u=document.createElement("div");u.className=`coin-royale__edge-seg coin-royale__edge-seg--${c%2===0?"a":"b"}`,u.style.width=`${l.toFixed(2)}px`,u.style.height=`${s.toFixed(2)}px`,u.style.transform=`translate(-50%,-50%) rotateZ(${c*360/f.EDGE_SEGMENTS}deg) translateY(${(-i).toFixed(2)}px) rotateX(90deg)`,e.get(k).appendChild(u)}},ve=t=>{C=t,a==null||a.cancel(),a=null,Y(t,1),e.get(d)&&(e.get(d).style.animation=""),e.get(A)&&(e.get(A).style.opacity="",e.get(A).style.width="")},Ye=(t,i)=>new Promise(s=>{if(!e.get(d))return s();a==null||a.cancel(),a=e.get(d).animate(t,ge({fill:"forwards"},i)),a.onfinish=()=>s(),a.oncancel=()=>s()}),He=(t,i)=>ue(this,null,function*(){var c;const s=new Headers({"Content-Type":"application/json"});M()&&s.append("X-SessionId",M());const l=yield fetch(new URL(`${F()}/v1/wof/draw/${(c=E())==null?void 0:c.id}`),{method:"PUT",headers:s,cache:"no-store",body:JSON.stringify({action:1,guid:t}),signal:i});if(!l.ok)throw new Error(`draw request failed: ${l.status}`);return l.json()}),B=t=>ue(this,null,function*(){var V,X;if(!e.get(ie)||!e.get(d)||!e.get(I)||!F())return;te()();const i=typeof t=="number"?t:C;y(!0),e.set(P,!0),e.set(G,!1),a==null||a.cancel();const s=-(e.get(I).clientHeight*f.RISE_FACTOR);e.get(A)&&(e.get(A).style.opacity="0.3",e.get(A).style.width="34%");const l=()=>new Promise((h,S)=>requestAnimationFrame(le=>N?S(new Error("destroyed")):h(le)));let c=!1,u=!1,v;const w=e.generateUUID(),_=new AbortController;L=_;const x=Promise.race([He(w,_.signal),new Promise((h,S)=>{v=setTimeout(()=>{u=!0,_.abort(),S(new Error("draw timed out"))},f.SPIN_TIMEOUT_MS)})]);x.then(()=>c=!0,()=>c=!0);let m=i;try{let h=yield l();const S=h;for(;!c||h-S<f.RISE_MS;){const T=yield l(),H=Math.min(T-h,50)/1e3;h=T;const W=T-S,O=Math.min(W/f.SPIN_UP_MS,1);m+=f.SPIN_SPEED*O*O*(3-2*O)*H;const Z=Math.min(W/f.RISE_MS,1),Q=1-_e(1-Z,3),Fe=Z>=1?Math.sin((W-f.RISE_MS)/380)*.015:0;Y(m,1+f.SCALE_GAIN*(Q+Fe),s*(Q+Fe))}const le=yield x;clearTimeout(v);const K=e.normalizeDrawResult(le,"draw");if(K.success!==!0)throw new Error("draw failed");const et=Ce(ge({},K),{guid:w,lotteryProgramID:(X=K.lotteryProgramID)!=null?X:(V=E())==null?void 0:V.id}),tt=K.type==="noprize"?180:0,Ae=360,ce=Ae+(tt-((m+Ae)%360+360)%360+360)%360,nt=m+ce,Re=2*ce/f.SPIN_SPEED*1e3,it=m,de=yield l();for(let T=de;T-de<Re;T=yield l()){const H=(T-de)/Re,W=1-_e(1-H,2),O=Math.min(H/.78,1),Z=1-O*O,Q=H>.78?Math.sin((H-.78)/.22*Math.PI)*5:0;Y(it+ce*W,1+f.SCALE_GAIN*Z,s*Z+Q)}if(ve(nt),yield new Promise(T=>fe=setTimeout(T,550)),N)return;R(et),y(!1)}catch(h){if(clearTimeout(v),N)return;console.log(h);const S=m+((i-m)%360+360)%360;if(e.get(d)&&(yield Ye([{transform:e.get(d).style.transform},{transform:`translateY(0px) rotateX(${S}deg) scale(1)`}],{duration:420,easing:"cubic-bezier(.55,0,.75,.4)"})),N)return;ve(S),u&&e.set(G,!0),y(!1)}finally{L===_&&(L=null),N||Ne()}}),Oe=()=>{e.set(G,!1),y(!1)},me=t=>{e.get(d)&&(a==null||a.cancel(),a=e.get(d).animate([{transform:`translateY(0px) rotateX(${t}deg) scale(1)`},{transform:`translateY(0px) rotateX(${C}deg) scale(1)`}],{duration:320,easing:"cubic-bezier(.22,.61,.32,1)",fill:"forwards"}),a.onfinish=()=>{a==null||a.cancel(),a=null,Y(C,1),e.get(d)&&(e.get(d).style.animation=""),e.set(P,!1)})},ze=t=>{e.get(ie)&&(D=!0,U=!1,se=t.clientY,ae=0,q=C,a==null||a.cancel(),e.get(d)&&(e.get(d).style.animation="none"),e.set(P,!0))},he=t=>{if(!D||y())return;const i=se-t.clientY;ae=i,Math.abs(i)>4&&(U=!0),Y(q+i*1.1,1+Math.min(Math.abs(i)/400,.12))},ye=t=>{if(!D)return;D=!1;const i=se-t.clientY;if(Math.abs(i)>f.DRAG_THRESHOLD){B(q+i*1.1);return}me(q+i*1.1)},be=()=>{D&&(D=!1,U=!1,me(q+ae*1.1))},Ge=()=>{if(U){U=!1;return}B()};n.onMount(()=>(window.addEventListener("pointermove",he),window.addEventListener("pointerup",ye),window.addEventListener("pointercancel",be),()=>{N=!0,L==null||L.abort(),clearTimeout(fe),clearTimeout(ne),window.removeEventListener("pointermove",he),window.removeEventListener("pointerup",ye),window.removeEventListener("pointercancel",be),a==null||a.cancel()}));var Ue={get program(){return E()},set program(t=null){E(t),e.flushSync()},get endpoint(){return F()},set endpoint(t=null){F(t),e.flushSync()},get session(){return M()},set session(t=null){M(t),e.flushSync()},get isAvailable(){return g()},set isAvailable(t=!1){g(t),e.flushSync()},get spinResults(){return R()},set spinResults(t=null){R(t),e.flushSync()},get spinActive(){return y()},set spinActive(t=!1){y(t),e.flushSync()},get remainingTimesLoading(){return j()},set remainingTimesLoading(t=!1){j(t),e.flushSync()},get onFlip(){return te()},set onFlip(t=()=>{}){te(t),e.flushSync()}},we=pt(),re=e.first_child(we),Ee=e.child(re),b=e.child(Ee);let xe;var Se=e.child(b);n.bind_this(Se,t=>e.set(A,t),()=>e.get(A));var J=e.sibling(Se,2),Te=e.sibling(e.child(J),2);n.bind_this(Te,t=>e.set(k,t),()=>e.get(k));var Me=e.sibling(Te,2),qe=e.only_child(Me),Ve=e.sibling(Me,2),Xe=e.only_child(Ve);e.reset(J),n.bind_this(J,t=>e.set(d,t),()=>e.get(d));var We=e.sibling(J,2);{var Ze=t=>{var i=dt(),s=e.first_child(i);let l;var c=e.sibling(e.child(s),2),u=e.only_child(c,!0);e.next(2),e.reset(s);var v=e.sibling(s,2);let w;e.template_effect(_=>{l=n.set_class(s,1,"coin-royale__drag-hint",null,l,{"coin-royale__drag-hint--hidden":e.get(P)||y()}),n.set_text(u,_),w=n.set_class(v,0,"coin-royale__finger-cue",null,w,{"coin-royale__finger-cue--hidden":e.get(P)||y()})},[()=>r()("dragToFlip")]),n.append(t,i)};n.if_block(We,t=>{g()&&t(Ze)})}e.reset(b),n.bind_this(b,t=>e.set(I,t),()=>e.get(I));var $e=e.sibling(b,2);{var je=t=>{var i=_t(),s=e.child(i),l=e.only_child(s,!0),c=e.sibling(s,2),u=e.only_child(c,!0);e.reset(i),e.template_effect((v,w)=>{n.set_text(l,v),n.set_text(u,w)},[()=>r()("nextAvailable"),()=>r()("countdown",{values:{days:e.get(z).days,hours:e.get(z).hours,minutes:e.get(z).minutes,seconds:e.get(z).seconds}})]),n.append(t,i)},Be=t=>{var i=gt(),s=e.child(i),l=e.only_child(s,!0),c=e.sibling(s,2),u=e.only_child(c,!0),v=e.sibling(c,2),w=e.only_child(v,!0);e.reset(i),e.template_effect((_,x,m)=>{n.set_text(l,_),n.set_text(u,x),n.set_text(w,m)},[()=>r()("timeoutTitle"),()=>r()("timeoutDescription"),()=>r()("close")]),n.delegated("click",v,Oe),n.append(t,i)};n.if_block($e,t=>{g()?e.get(G)&&t(Be,1):t(je)})}e.reset(Ee),e.reset(re);var Ie=e.sibling(re,2);{var Je=t=>{var i=ft(),s=e.child(i),l=e.sibling(s),c=e.child(l),u=e.sibling(c,2);{var v=_=>{var x=ut();n.append(_,x)},w=_=>{var x=n.text();e.template_effect(()=>{var m,V,X,h;return n.set_text(x,(h=(V=(m=E())==null?void 0:m.current)==null?void 0:V.remainingTimes)!=null?h:(X=E())==null?void 0:X.remainingTimes)}),n.append(_,x)};n.if_block(u,_=>{j()?_(v):_(w,-1)})}e.reset(l),e.reset(i),e.template_effect(_=>{n.set_text(s,`${_!=null?_:""} `),n.set_attribute(c,"src",De.coinHeads)},[()=>r()("remainingFlips")]),n.append(t,i)};n.if_block(Ie,t=>{g()&&t(Je)})}var oe=e.sibling(Ie,2),Ke=e.only_child(oe,!0);e.template_effect((t,i)=>{xe=n.set_class(b,1,"coin-royale__flip-zone",null,xe,{"coin-royale__flip-zone--disabled":!g(),"coin-royale__flip-zone--settling":y()}),n.set_attribute(b,"tabindex",g()?0:-1),n.set_attribute(b,"aria-label",t),n.set_attribute(b,"aria-disabled",!e.get(ie)),n.set_attribute(qe,"src",De.coinHeads),n.set_attribute(Xe,"src",ct.coinTails),oe.disabled=!g(),n.set_text(Ke,i)},[()=>r()("flipCoin"),()=>r()("flipCoin")]),n.delegated("pointerdown",b,ze),n.delegated("click",b,Ge),n.delegated("keydown",b,t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),B())}),n.delegated("click",oe,()=>B()),n.append(p,we);var Qe=e.pop(Ue);return $(),Qe}n.delegate(["pointerdown","click","keydown"]);n.create_custom_element(Le,{program:{},endpoint:{},session:{},isAvailable:{},spinResults:{},spinActive:{},remainingTimesLoading:{},onFlip:{}},[],[],{mode:"open"});exports.CoinFlip=Le;
1
+ "use strict";var st=Object.defineProperty,at=Object.defineProperties;var rt=Object.getOwnPropertyDescriptors;var Pe=Object.getOwnPropertySymbols;var ot=Object.prototype.hasOwnProperty,lt=Object.prototype.propertyIsEnumerable;var _e=Math.pow,ke=(p,o,r)=>o in p?st(p,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):p[o]=r,ge=(p,o)=>{for(var r in o||(o={}))ot.call(o,r)&&ke(p,r,o[r]);if(Pe)for(var r of Pe(o))lt.call(o,r)&&ke(p,r,o[r]);return p},Ce=(p,o)=>at(p,rt(o));var ue=(p,o,r)=>new Promise((ee,$)=>{var E=g=>{try{M(r.next(g))}catch(R){$(R)}},F=g=>{try{M(r.throw(g))}catch(R){$(R)}},M=g=>g.done?ee(g.value):Promise.resolve(g.value).then(E,F);M((r=r.apply(p,o)).next())});const n=require("./WheelOfFortuneWheel-DWAdby4o.cjs"),e=require("./utils-uE8V9ar8.cjs"),f=require("./constants-CoPH35Re.cjs"),De=require("./coin-heads-BuJOLpyg.cjs"),ct=require("./coin-tails-20vJmhwv.cjs");var dt=n.from_html('<div><span class="coin-royale__chev">︿</span> <span class="coin-royale__hint-text"> </span> <span class="coin-royale__chev coin-royale__chev--down">﹀</span></div> <svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M9 11V5.5a1.5 1.5 0 0 1 3 0V11h.5V7.5a1.5 1.5 0 0 1 3 0V11h.5V9a1.5 1.5 0 0 1 3 0v6.5c0 3-2 5.5-5.5 5.5H12c-2 0-3.2-.8-4.2-2.3l-2.4-3.6a1.5 1.5 0 0 1 2.3-1.9L9 15.5V11Z"></path></svg>',1),_t=n.from_html('<div class="coin-royale__badge"><p class="coin-royale__badge-title"> </p> <p class="coin-royale__badge-countdown"> </p></div>'),gt=n.from_html('<div class="coin-royale__badge"><p class="coin-royale__badge-title"> </p> <p class="coin-royale__badge-body"> </p> <button class="coin-royale__badge-close" type="button"> </button></div>'),ut=n.from_html('<span class="coin-royale__flips-loader"></span>'),ft=n.from_html('<p class="coin-royale__flips"> <span class="coin-royale__flips-count"><img class="coin-royale__flips-icon" alt="" aria-hidden="true"/> <!></span></p>'),pt=n.from_html('<div class="coin-royale__play"><div class="coin-royale__stage"><div role="button"><div class="coin-royale__coin-shadow"></div> <div class="coin-royale__coin"><div class="coin-royale__coin-drop-shadow" aria-hidden="true"></div> <div class="coin-royale__coin-edge" aria-hidden="true"></div> <div class="coin-royale__face coin-royale__face--front"><img alt="" draggable="false"/></div> <div class="coin-royale__face coin-royale__face--back"><img alt="" draggable="false"/></div></div> <!></div> <!></div></div> <!> <button class="coin-royale__cta" type="button"> </button>',1);function Le(p,o){e.push(o,!0);const r=()=>n.store_get(e.$format,"$_",ee),[ee,$]=n.setup_stores();let E=n.prop(o,"program",7,null),F=n.prop(o,"endpoint",7,null),M=n.prop(o,"session",7,null),g=n.prop(o,"isAvailable",7,!1),R=n.prop(o,"spinResults",15,null),y=n.prop(o,"spinActive",15,!1),j=n.prop(o,"remainingTimesLoading",7,!1),te=n.prop(o,"onFlip",7,()=>{}),z=e.state(e.proxy({}));e.user_effect(()=>{if(!g()&&E()){const t=()=>{var s,l;return e.set(z,e.getTimeRemaining((l=(s=E())==null?void 0:s.next)==null?void 0:l.startTime),!0)};t();const i=setInterval(t,1e3);return()=>clearInterval(i)}});let P=e.state(!1),ne;const Ne=()=>{clearTimeout(ne),ne=setTimeout(()=>e.set(P,!1),400)};let G=e.state(!1),I=e.state(void 0),d=e.state(void 0),k=e.state(void 0),A=e.state(void 0);const ie=e.user_derived(()=>g()&&!y()&&!e.get(G)&&!j());let C=0,D=!1,U=!1,se=0,q=0,ae=0,a=null,L=null,fe,N=!1;const Y=(t,i=1,s=0)=>{e.get(d)&&(e.get(d).style.transform=`translateY(${s}px) rotateX(${t}deg) scale(${i})`)};e.user_effect(()=>{if(!e.get(I)||!e.get(d)||!e.get(k))return;pe(),Y(C);const t=new ResizeObserver(()=>pe());return t.observe(e.get(I)),()=>t.disconnect()});const pe=()=>{if(!e.get(I)||!e.get(d)||!e.get(k))return;const t=e.get(I).clientWidth;if(!t)return;const i=t/2*f.RIM_FACTOR,s=Math.max(14,t*f.THICKNESS_FACTOR),l=2*i*Math.tan(Math.PI/f.EDGE_SEGMENTS)+.6;e.get(d).style.setProperty("--half-t",`${(s/2).toFixed(2)}px`),e.get(k).replaceChildren();for(let c=0;c<f.EDGE_SEGMENTS;c++){const u=document.createElement("div");u.className=`coin-royale__edge-seg coin-royale__edge-seg--${c%2===0?"a":"b"}`,u.style.width=`${l.toFixed(2)}px`,u.style.height=`${s.toFixed(2)}px`,u.style.transform=`translate(-50%,-50%) rotateZ(${c*360/f.EDGE_SEGMENTS}deg) translateY(${(-i).toFixed(2)}px) rotateX(90deg)`,e.get(k).appendChild(u)}},ve=t=>{C=t,a==null||a.cancel(),a=null,Y(t,1),e.get(d)&&(e.get(d).style.animation=""),e.get(A)&&(e.get(A).style.opacity="",e.get(A).style.width="")},Ye=(t,i)=>new Promise(s=>{if(!e.get(d))return s();a==null||a.cancel(),a=e.get(d).animate(t,ge({fill:"forwards"},i)),a.onfinish=()=>s(),a.oncancel=()=>s()}),He=(t,i)=>ue(this,null,function*(){var c;const s=new Headers({"Content-Type":"application/json"});M()&&s.append("X-SessionId",M());const l=yield fetch(new URL(`${F()}/v1/wof/draw/${(c=E())==null?void 0:c.id}`),{method:"PUT",headers:s,cache:"no-store",body:JSON.stringify({action:1,guid:t}),signal:i});if(!l.ok)throw new Error(`draw request failed: ${l.status}`);return l.json()}),B=t=>ue(this,null,function*(){var V,X;if(!e.get(ie)||!e.get(d)||!e.get(I)||!F())return;te()();const i=typeof t=="number"?t:C;y(!0),e.set(P,!0),e.set(G,!1),a==null||a.cancel();const s=-(e.get(I).clientHeight*f.RISE_FACTOR);e.get(A)&&(e.get(A).style.opacity="0.3",e.get(A).style.width="34%");const l=()=>new Promise((h,S)=>requestAnimationFrame(le=>N?S(new Error("destroyed")):h(le)));let c=!1,u=!1,v;const w=e.generateUUID(),_=new AbortController;L=_;const x=Promise.race([He(w,_.signal),new Promise((h,S)=>{v=setTimeout(()=>{u=!0,_.abort(),S(new Error("draw timed out"))},f.SPIN_TIMEOUT_MS)})]);x.then(()=>c=!0,()=>c=!0);let m=i;try{let h=yield l();const S=h;for(;!c||h-S<f.RISE_MS;){const T=yield l(),H=Math.min(T-h,50)/1e3;h=T;const W=T-S,O=Math.min(W/f.SPIN_UP_MS,1);m+=f.SPIN_SPEED*O*O*(3-2*O)*H;const Z=Math.min(W/f.RISE_MS,1),Q=1-_e(1-Z,3),Fe=Z>=1?Math.sin((W-f.RISE_MS)/380)*.015:0;Y(m,1+f.SCALE_GAIN*(Q+Fe),s*(Q+Fe))}const le=yield x;clearTimeout(v);const K=e.normalizeDrawResult(le,"draw");if(K.success!==!0)throw new Error("draw failed");const et=Ce(ge({},K),{guid:w,lotteryProgramID:(X=K.lotteryProgramID)!=null?X:(V=E())==null?void 0:V.id}),tt=K.type==="noprize"?180:0,Ae=360,ce=Ae+(tt-((m+Ae)%360+360)%360+360)%360,nt=m+ce,Re=2*ce/f.SPIN_SPEED*1e3,it=m,de=yield l();for(let T=de;T-de<Re;T=yield l()){const H=(T-de)/Re,W=1-_e(1-H,2),O=Math.min(H/.78,1),Z=1-O*O,Q=H>.78?Math.sin((H-.78)/.22*Math.PI)*5:0;Y(it+ce*W,1+f.SCALE_GAIN*Z,s*Z+Q)}if(ve(nt),yield new Promise(T=>fe=setTimeout(T,550)),N)return;R(et),y(!1)}catch(h){if(clearTimeout(v),N)return;console.log(h);const S=m+((i-m)%360+360)%360;if(e.get(d)&&(yield Ye([{transform:e.get(d).style.transform},{transform:`translateY(0px) rotateX(${S}deg) scale(1)`}],{duration:420,easing:"cubic-bezier(.55,0,.75,.4)"})),N)return;ve(S),u&&e.set(G,!0),y(!1)}finally{L===_&&(L=null),N||Ne()}}),Oe=()=>{e.set(G,!1),y(!1)},me=t=>{e.get(d)&&(a==null||a.cancel(),a=e.get(d).animate([{transform:`translateY(0px) rotateX(${t}deg) scale(1)`},{transform:`translateY(0px) rotateX(${C}deg) scale(1)`}],{duration:320,easing:"cubic-bezier(.22,.61,.32,1)",fill:"forwards"}),a.onfinish=()=>{a==null||a.cancel(),a=null,Y(C,1),e.get(d)&&(e.get(d).style.animation=""),e.set(P,!1)})},ze=t=>{e.get(ie)&&(D=!0,U=!1,se=t.clientY,ae=0,q=C,a==null||a.cancel(),e.get(d)&&(e.get(d).style.animation="none"),e.set(P,!0))},he=t=>{if(!D||y())return;const i=se-t.clientY;ae=i,Math.abs(i)>4&&(U=!0),Y(q+i*1.1,1+Math.min(Math.abs(i)/400,.12))},ye=t=>{if(!D)return;D=!1;const i=se-t.clientY;if(Math.abs(i)>f.DRAG_THRESHOLD){B(q+i*1.1);return}me(q+i*1.1)},be=()=>{D&&(D=!1,U=!1,me(q+ae*1.1))},Ge=()=>{if(U){U=!1;return}B()};n.onMount(()=>(window.addEventListener("pointermove",he),window.addEventListener("pointerup",ye),window.addEventListener("pointercancel",be),()=>{N=!0,L==null||L.abort(),clearTimeout(fe),clearTimeout(ne),window.removeEventListener("pointermove",he),window.removeEventListener("pointerup",ye),window.removeEventListener("pointercancel",be),a==null||a.cancel()}));var Ue={get program(){return E()},set program(t=null){E(t),e.flushSync()},get endpoint(){return F()},set endpoint(t=null){F(t),e.flushSync()},get session(){return M()},set session(t=null){M(t),e.flushSync()},get isAvailable(){return g()},set isAvailable(t=!1){g(t),e.flushSync()},get spinResults(){return R()},set spinResults(t=null){R(t),e.flushSync()},get spinActive(){return y()},set spinActive(t=!1){y(t),e.flushSync()},get remainingTimesLoading(){return j()},set remainingTimesLoading(t=!1){j(t),e.flushSync()},get onFlip(){return te()},set onFlip(t=()=>{}){te(t),e.flushSync()}},we=pt(),re=e.first_child(we),Ee=e.child(re),b=e.child(Ee);let xe;var Se=e.child(b);n.bind_this(Se,t=>e.set(A,t),()=>e.get(A));var J=e.sibling(Se,2),Te=e.sibling(e.child(J),2);n.bind_this(Te,t=>e.set(k,t),()=>e.get(k));var Me=e.sibling(Te,2),qe=e.only_child(Me),Ve=e.sibling(Me,2),Xe=e.only_child(Ve);e.reset(J),n.bind_this(J,t=>e.set(d,t),()=>e.get(d));var We=e.sibling(J,2);{var Ze=t=>{var i=dt(),s=e.first_child(i);let l;var c=e.sibling(e.child(s),2),u=e.only_child(c,!0);e.next(2),e.reset(s);var v=e.sibling(s,2);let w;e.template_effect(_=>{l=n.set_class(s,1,"coin-royale__drag-hint",null,l,{"coin-royale__drag-hint--hidden":e.get(P)||y()}),n.set_text(u,_),w=n.set_class(v,0,"coin-royale__finger-cue",null,w,{"coin-royale__finger-cue--hidden":e.get(P)||y()})},[()=>r()("dragToFlip")]),n.append(t,i)};n.if_block(We,t=>{g()&&t(Ze)})}e.reset(b),n.bind_this(b,t=>e.set(I,t),()=>e.get(I));var $e=e.sibling(b,2);{var je=t=>{var i=_t(),s=e.child(i),l=e.only_child(s,!0),c=e.sibling(s,2),u=e.only_child(c,!0);e.reset(i),e.template_effect((v,w)=>{n.set_text(l,v),n.set_text(u,w)},[()=>r()("nextAvailable"),()=>r()("countdown",{values:{days:e.get(z).days,hours:e.get(z).hours,minutes:e.get(z).minutes,seconds:e.get(z).seconds}})]),n.append(t,i)},Be=t=>{var i=gt(),s=e.child(i),l=e.only_child(s,!0),c=e.sibling(s,2),u=e.only_child(c,!0),v=e.sibling(c,2),w=e.only_child(v,!0);e.reset(i),e.template_effect((_,x,m)=>{n.set_text(l,_),n.set_text(u,x),n.set_text(w,m)},[()=>r()("timeoutTitle"),()=>r()("timeoutDescription"),()=>r()("close")]),n.delegated("click",v,Oe),n.append(t,i)};n.if_block($e,t=>{g()?e.get(G)&&t(Be,1):t(je)})}e.reset(Ee),e.reset(re);var Ie=e.sibling(re,2);{var Je=t=>{var i=ft(),s=e.child(i),l=e.sibling(s),c=e.child(l),u=e.sibling(c,2);{var v=_=>{var x=ut();n.append(_,x)},w=_=>{var x=n.text();e.template_effect(()=>{var m,V,X,h;return n.set_text(x,(h=(V=(m=E())==null?void 0:m.current)==null?void 0:V.remainingTimes)!=null?h:(X=E())==null?void 0:X.remainingTimes)}),n.append(_,x)};n.if_block(u,_=>{j()?_(v):_(w,-1)})}e.reset(l),e.reset(i),e.template_effect(_=>{n.set_text(s,`${_!=null?_:""} `),n.set_attribute(c,"src",De.coinHeads)},[()=>r()("remainingFlips")]),n.append(t,i)};n.if_block(Ie,t=>{g()&&t(Je)})}var oe=e.sibling(Ie,2),Ke=e.only_child(oe,!0);e.template_effect((t,i)=>{xe=n.set_class(b,1,"coin-royale__flip-zone",null,xe,{"coin-royale__flip-zone--disabled":!g(),"coin-royale__flip-zone--settling":y()}),n.set_attribute(b,"tabindex",g()?0:-1),n.set_attribute(b,"aria-label",t),n.set_attribute(b,"aria-disabled",!e.get(ie)),n.set_attribute(qe,"src",De.coinHeads),n.set_attribute(Xe,"src",ct.coinTails),oe.disabled=!g(),n.set_text(Ke,i)},[()=>r()("flipCoin"),()=>r()("flipCoin")]),n.delegated("pointerdown",b,ze),n.delegated("click",b,Ge),n.delegated("keydown",b,t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),B())}),n.delegated("click",oe,()=>B()),n.append(p,we);var Qe=e.pop(Ue);return $(),Qe}n.delegate(["pointerdown","click","keydown"]);n.create_custom_element(Le,{program:{},endpoint:{},session:{},isAvailable:{},spinResults:{},spinActive:{},remainingTimesLoading:{},onFlip:{}},[],[],{mode:"open"});exports.CoinFlip=Le;
@@ -1,5 +1,5 @@
1
- import { d as mt, c as gt, p as I, o as yt, r as oe, i as le, n as we, g as V, k as E, q as K, b as k, f as q, s as ht, e as wt, x as bt } from "./WheelOfFortuneWheel-F62aU_CL.js";
2
- import { a5 as Tt, b1 as L, aQ as xt, ad as Ue, aJ as u, bl as Et, L as t, b2 as Ne, b5 as c, b6 as M, ar as X, a9 as Mt, b3 as St, bc as Rt, b7 as S, b8 as At, b9 as Ct, aU as P, ba as R, O as Ft } from "./utils-3LNftCeZ.js";
1
+ import { d as mt, c as gt, p as I, o as yt, b as oe, i as le, q as we, h as V, l as E, r as K, e as k, f as q, s as ht, g as wt, x as bt } from "./WheelOfFortuneWheel-B11sYKJn.js";
2
+ import { a5 as Tt, b1 as L, aQ as xt, ad as Ue, aJ as u, bl as Et, L as t, b2 as Ne, b5 as c, b6 as M, ar as X, a9 as Mt, b3 as St, bc as Rt, b7 as S, b8 as At, b9 as Ct, aU as P, ba as R, O as Ft } from "./utils-CzSqbDv1.js";
3
3
  import { E as be, R as It, T as Pt, l as kt, k as Lt, m as Te, n as Dt, o as $e, q as Ve, r as Yt } from "./constants-BDSd8ptj.js";
4
4
  import { c as Xe } from "./coin-heads-loqcEtH2.js";
5
5
  import { c as Ot } from "./coin-tails-BTbsTwkz.js";
@@ -1,12 +1,12 @@
1
1
  var Et = Object.defineProperty, Mt = Object.defineProperties;
2
2
  var St = Object.getOwnPropertyDescriptors;
3
- var $e = Object.getOwnPropertySymbols;
3
+ var je = Object.getOwnPropertySymbols;
4
4
  var Rt = Object.prototype.hasOwnProperty, At = Object.prototype.propertyIsEnumerable;
5
5
  var Me = Math.pow, Be = (f, r, i) => r in f ? Et(f, r, { enumerable: !0, configurable: !0, writable: !0, value: i }) : f[r] = i, Se = (f, r) => {
6
6
  for (var i in r || (r = {}))
7
7
  Rt.call(r, i) && Be(f, i, r[i]);
8
- if ($e)
9
- for (var i of $e(r))
8
+ if (je)
9
+ for (var i of je(r))
10
10
  At.call(r, i) && Be(f, i, r[i]);
11
11
  return f;
12
12
  }, Je = (f, r) => Mt(f, St(r));
@@ -26,9 +26,9 @@ var Re = (f, r, i) => new Promise((fe, re) => {
26
26
  }, I = (_) => _.done ? fe(_.value) : Promise.resolve(_.value).then(T, z);
27
27
  I((i = i.apply(f, r)).next());
28
28
  });
29
- import { d as Ft, c as It, p as C, o as Pt, r as ue, i as ve, n as Ae, l as $, j as S, q as ie, b as Y, f as J, s as kt, e as Ct, x as Lt } from "./WheelOfFortuneWheel-CiyQZNAd.js";
30
- import { a5 as Dt, b1 as O, aQ as Yt, ad as We, aJ as y, bl as Ot, L as t, b2 as Ke, b3 as v, b6 as R, ar as B, a9 as zt, b4 as Ht, bb as Ut, b7 as A, b8 as Nt, b9 as Vt, aU as L, ba as F, O as Xt } from "./utils-DGrEJJ_K.js";
31
- import { E as Fe, R as qt, T as Gt, l as jt, k as Zt, m as Ie, n as $t, o as Qe, q as et, r as Bt } from "./constants-BDSd8ptj.js";
29
+ import { d as Ft, c as It, p as C, o as Pt, b as ue, i as ve, q as Ae, m as j, k as S, r as ie, e as Y, f as J, s as kt, g as Ct, x as Lt } from "./WheelOfFortuneWheel-D1cbM2SU.js";
30
+ import { a5 as Dt, b1 as O, aQ as Yt, ad as We, aJ as y, bl as Ot, L as t, b2 as Ke, b3 as v, b6 as R, ar as B, a9 as zt, b4 as Ht, bb as Ut, b7 as A, b8 as Nt, b9 as Vt, aU as L, ba as F, O as Xt } from "./utils-UAFcjwcH.js";
31
+ import { E as Fe, R as qt, T as Gt, l as Zt, k as $t, m as Ie, n as jt, o as Qe, q as et, r as Bt } from "./constants-BDSd8ptj.js";
32
32
  import { c as tt } from "./coin-heads-loqcEtH2.js";
33
33
  import { c as Jt } from "./coin-tails-BTbsTwkz.js";
34
34
  var Wt = J('<div><span class="coin-royale__chev">︿</span> <span class="coin-royale__hint-text"> </span> <span class="coin-royale__chev coin-royale__chev--down">﹀</span></div> <svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M9 11V5.5a1.5 1.5 0 0 1 3 0V11h.5V7.5a1.5 1.5 0 0 1 3 0V11h.5V9a1.5 1.5 0 0 1 3 0v6.5c0 3-2 5.5-5.5 5.5H12c-2 0-3.2-.8-4.2-2.3l-2.4-3.6a1.5 1.5 0 0 1 2.3-1.9L9 15.5V11Z"></path></svg>', 1), Kt = J('<div class="coin-royale__badge"><p class="coin-royale__badge-title"> </p> <p class="coin-royale__badge-countdown"> </p></div>'), Qt = J('<div class="coin-royale__badge"><p class="coin-royale__badge-title"> </p> <p class="coin-royale__badge-body"> </p> <button class="coin-royale__badge-close" type="button"> </button></div>'), ea = J('<span class="coin-royale__flips-loader"></span>'), ta = J('<p class="coin-royale__flips"> <span class="coin-royale__flips-count"><img class="coin-royale__flips-icon" alt="" aria-hidden="true"/> <!></span></p>'), aa = J('<div class="coin-royale__play"><div class="coin-royale__stage"><div role="button"><div class="coin-royale__coin-shadow"></div> <div class="coin-royale__coin"><div class="coin-royale__coin-drop-shadow" aria-hidden="true"></div> <div class="coin-royale__coin-edge" aria-hidden="true"></div> <div class="coin-royale__face coin-royale__face--front"><img alt="" draggable="false"/></div> <div class="coin-royale__face coin-royale__face--back"><img alt="" draggable="false"/></div></div> <!></div> <!></div></div> <!> <button class="coin-royale__cta" type="button"> </button>', 1);
@@ -98,7 +98,7 @@ function na(f, r) {
98
98
  pe()();
99
99
  const a = typeof e == "number" ? e : N;
100
100
  h(!0), y(H, !0), y(K, !1), s == null || s.cancel();
101
- const n = -(t(P).clientHeight * jt);
101
+ const n = -(t(P).clientHeight * Zt);
102
102
  t(k) && (t(k).style.opacity = "0.3", t(k).style.width = "34%");
103
103
  const o = () => new Promise((g, E) => requestAnimationFrame((Te) => q ? E(new Error("destroyed")) : g(Te)));
104
104
  let l = !1, u = !1, p;
@@ -111,7 +111,7 @@ function na(f, r) {
111
111
  () => {
112
112
  u = !0, d.abort(), E(new Error("draw timed out"));
113
113
  },
114
- Zt
114
+ $t
115
115
  );
116
116
  })
117
117
  ]);
@@ -121,12 +121,12 @@ function na(f, r) {
121
121
  let g = yield o();
122
122
  const E = g;
123
123
  for (; !l || g - E < Ie; ) {
124
- const M = yield o(), j = Math.min(M - g, 50) / 1e3;
124
+ const M = yield o(), Z = Math.min(M - g, 50) / 1e3;
125
125
  g = M;
126
- const ne = M - E, Z = Math.min(ne / $t, 1);
127
- m += Qe * Z * Z * (3 - 2 * Z) * j;
128
- const se = Math.min(ne / Ie, 1), _e = 1 - Me(1 - se, 3), Ze = se >= 1 ? Math.sin((ne - Ie) / 380) * 0.015 : 0;
129
- G(m, 1 + et * (_e + Ze), n * (_e + Ze));
126
+ const ne = M - E, $ = Math.min(ne / jt, 1);
127
+ m += Qe * $ * $ * (3 - 2 * $) * Z;
128
+ const se = Math.min(ne / Ie, 1), _e = 1 - Me(1 - se, 3), $e = se >= 1 ? Math.sin((ne - Ie) / 380) * 0.015 : 0;
129
+ G(m, 1 + et * (_e + $e), n * (_e + $e));
130
130
  }
131
131
  const Te = yield x;
132
132
  clearTimeout(p);
@@ -135,9 +135,9 @@ function na(f, r) {
135
135
  const wt = Je(Se({}, de), {
136
136
  guid: b,
137
137
  lotteryProgramID: (ae = de.lotteryProgramID) != null ? ae : (te = T()) == null ? void 0 : te.id
138
- }), bt = de.type === "noprize" ? 180 : 0, Ge = 360, xe = Ge + (bt - ((m + Ge) % 360 + 360) % 360 + 360) % 360, Tt = m + xe, je = 2 * xe / Qe * 1e3, xt = m, Ee = yield o();
139
- for (let M = Ee; M - Ee < je; M = yield o()) {
140
- const j = (M - Ee) / je, ne = 1 - Me(1 - j, 2), Z = Math.min(j / 0.78, 1), se = 1 - Z * Z, _e = j > 0.78 ? Math.sin((j - 0.78) / 0.22 * Math.PI) * 5 : 0;
138
+ }), bt = de.type === "noprize" ? 180 : 0, Ge = 360, xe = Ge + (bt - ((m + Ge) % 360 + 360) % 360 + 360) % 360, Tt = m + xe, Ze = 2 * xe / Qe * 1e3, xt = m, Ee = yield o();
139
+ for (let M = Ee; M - Ee < Ze; M = yield o()) {
140
+ const Z = (M - Ee) / Ze, ne = 1 - Me(1 - Z, 2), $ = Math.min(Z / 0.78, 1), se = 1 - $ * $, _e = Z > 0.78 ? Math.sin((Z - 0.78) / 0.22 * Math.PI) * 5 : 0;
141
141
  G(xt + xe * ne, 1 + et * se, n * se + _e);
142
142
  }
143
143
  if (Ce(Tt), yield new Promise((M) => Pe = setTimeout(M, 550)), q) return;
@@ -344,7 +344,7 @@ function na(f, r) {
344
344
  }
345
345
  F(o), F(a), B(
346
346
  (d) => {
347
- S(n, `${d != null ? d : ""} `), $(l, "src", tt);
347
+ S(n, `${d != null ? d : ""} `), j(l, "src", tt);
348
348
  },
349
349
  [() => i()("remainingFlips")]
350
350
  ), Y(e, a);
@@ -359,7 +359,7 @@ function na(f, r) {
359
359
  Ue = Ae(w, 1, "coin-royale__flip-zone", null, Ue, {
360
360
  "coin-royale__flip-zone--disabled": !_(),
361
361
  "coin-royale__flip-zone--settling": h()
362
- }), $(w, "tabindex", _() ? 0 : -1), $(w, "aria-label", e), $(w, "aria-disabled", !t(ge)), $(ct, "src", tt), $(_t, "src", Jt), be.disabled = !_(), S(yt, a);
362
+ }), j(w, "tabindex", _() ? 0 : -1), j(w, "aria-label", e), j(w, "aria-disabled", !t(ge)), j(ct, "src", tt), j(_t, "src", Jt), be.disabled = !_(), S(yt, a);
363
363
  },
364
364
  [() => i()("flipCoin"), () => i()("flipCoin")]
365
365
  ), ie("pointerdown", w, rt), ie("click", w, ot), ie("keydown", w, (e) => {
@@ -1 +1 @@
1
- "use strict";const n=require("./WheelOfFortuneWheel-CrRAYCB1.cjs"),e=require("./utils-DyVEmMSf.cjs"),d=require("./constants-CoPH35Re.cjs"),xe=require("./coin-heads-BuJOLpyg.cjs"),Be=require("./coin-tails-20vJmhwv.cjs");var Je=n.from_html('<div><span class="coin-royale__chev">︿</span> <span class="coin-royale__hint-text"> </span> <span class="coin-royale__chev coin-royale__chev--down">﹀</span></div> <svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M9 11V5.5a1.5 1.5 0 0 1 3 0V11h.5V7.5a1.5 1.5 0 0 1 3 0V11h.5V9a1.5 1.5 0 0 1 3 0v6.5c0 3-2 5.5-5.5 5.5H12c-2 0-3.2-.8-4.2-2.3l-2.4-3.6a1.5 1.5 0 0 1 2.3-1.9L9 15.5V11Z"></path></svg>',1),Ke=n.from_html('<div class="coin-royale__badge"><p class="coin-royale__badge-title"> </p> <p class="coin-royale__badge-countdown"> </p></div>'),Qe=n.from_html('<div class="coin-royale__badge"><p class="coin-royale__badge-title"> </p> <p class="coin-royale__badge-body"> </p> <button class="coin-royale__badge-close" type="button"> </button></div>'),et=n.from_html('<span class="coin-royale__flips-loader"></span>'),tt=n.from_html('<p class="coin-royale__flips"> <span class="coin-royale__flips-count"><img class="coin-royale__flips-icon" alt="" aria-hidden="true"/> <!></span></p>'),nt=n.from_html('<div class="coin-royale__play"><div class="coin-royale__stage"><div role="button"><div class="coin-royale__coin-shadow"></div> <div class="coin-royale__coin"><div class="coin-royale__coin-drop-shadow" aria-hidden="true"></div> <div class="coin-royale__coin-edge" aria-hidden="true"></div> <div class="coin-royale__face coin-royale__face--front"><img alt="" draggable="false"/></div> <div class="coin-royale__face coin-royale__face--back"><img alt="" draggable="false"/></div></div> <!></div> <!></div></div> <!> <button class="coin-royale__cta" type="button"> </button>',1);function Se(Te,m){e.push(m,!0);const h=()=>n.store_get(e.$format,"$_",Me),[Me,Ie]=n.setup_stores();let S=n.prop(m,"program",7,null),G=n.prop(m,"endpoint",7,null),U=n.prop(m,"session",7,null),v=n.prop(m,"isAvailable",7,!1),j=n.prop(m,"spinResults",15,null),u=n.prop(m,"spinActive",15,!1),q=n.prop(m,"remainingTimesLoading",7,!1),B=n.prop(m,"onFlip",7,()=>{}),L=e.state(e.proxy({}));e.user_effect(()=>{if(!v()&&S()){const t=()=>e.set(L,e.getTimeRemaining(S()?.next?.startTime),!0);t();const i=setInterval(t,1e3);return()=>clearInterval(i)}});let I=e.state(!1),J;const Ae=()=>{clearTimeout(J),J=setTimeout(()=>e.set(I,!1),400)};let N=e.state(!1),T=e.state(void 0),s=e.state(void 0),A=e.state(void 0),M=e.state(void 0);const K=e.user_derived(()=>v()&&!u()&&!e.get(N)&&!q());let R=0,F=!1,Y=!1,Q=0,H=0,ee=0,_=null,$=null,re,P=!1;const C=(t,i=1,a=0)=>{e.get(s)&&(e.get(s).style.transform=`translateY(${a}px) rotateX(${t}deg) scale(${i})`)};e.user_effect(()=>{if(!e.get(T)||!e.get(s)||!e.get(A))return;oe(),C(R);const t=new ResizeObserver(()=>oe());return t.observe(e.get(T)),()=>t.disconnect()});const oe=()=>{if(!e.get(T)||!e.get(s)||!e.get(A))return;const t=e.get(T).clientWidth;if(!t)return;const i=t/2*d.RIM_FACTOR,a=Math.max(14,t*d.THICKNESS_FACTOR),r=2*i*Math.tan(Math.PI/d.EDGE_SEGMENTS)+.6;e.get(s).style.setProperty("--half-t",`${(a/2).toFixed(2)}px`),e.get(A).replaceChildren();for(let o=0;o<d.EDGE_SEGMENTS;o++){const c=document.createElement("div");c.className=`coin-royale__edge-seg coin-royale__edge-seg--${o%2===0?"a":"b"}`,c.style.width=`${r.toFixed(2)}px`,c.style.height=`${a.toFixed(2)}px`,c.style.transform=`translate(-50%,-50%) rotateZ(${o*360/d.EDGE_SEGMENTS}deg) translateY(${(-i).toFixed(2)}px) rotateX(90deg)`,e.get(A).appendChild(c)}},le=t=>{R=t,_?.cancel(),_=null,C(t,1),e.get(s)&&(e.get(s).style.animation=""),e.get(M)&&(e.get(M).style.opacity="",e.get(M).style.width="")},Re=(t,i)=>new Promise(a=>{if(!e.get(s))return a();_?.cancel(),_=e.get(s).animate(t,{fill:"forwards",...i}),_.onfinish=()=>a(),_.oncancel=()=>a()}),Fe=async(t,i)=>{const a=new Headers({"Content-Type":"application/json"});U()&&a.append("X-SessionId",U());const r=await fetch(new URL(`${G()}/v1/wof/draw/${S()?.id}`),{method:"PUT",headers:a,cache:"no-store",body:JSON.stringify({action:1,guid:t}),signal:i});if(!r.ok)throw new Error(`draw request failed: ${r.status}`);return r.json()},V=async t=>{if(!e.get(K)||!e.get(s)||!e.get(T)||!G())return;B()();const i=typeof t=="number"?t:R;u(!0),e.set(I,!0),e.set(N,!1),_?.cancel();const a=-(e.get(T).clientHeight*d.RISE_FACTOR);e.get(M)&&(e.get(M).style.opacity="0.3",e.get(M).style.width="34%");const r=()=>new Promise((w,E)=>requestAnimationFrame(ie=>P?E(new Error("destroyed")):w(ie)));let o=!1,c=!1,g;const p=e.generateUUID(),l=new AbortController;$=l;const y=Promise.race([Fe(p,l.signal),new Promise((w,E)=>{g=setTimeout(()=>{c=!0,l.abort(),E(new Error("draw timed out"))},d.SPIN_TIMEOUT_MS)})]);y.then(()=>o=!0,()=>o=!0);let b=i;try{let w=await r();const E=w;for(;!o||w-E<d.RISE_MS;){const x=await r(),k=Math.min(x-w,50)/1e3;w=x;const O=x-E,D=Math.min(O/d.SPIN_UP_MS,1);b+=d.SPIN_SPEED*D*D*(3-2*D)*k;const z=Math.min(O/d.RISE_MS,1),Z=1-(1-z)**3,Ee=z>=1?Math.sin((O-d.RISE_MS)/380)*.015:0;C(b,1+d.SCALE_GAIN*(Z+Ee),a*(Z+Ee))}const ie=await y;clearTimeout(g);const W=e.normalizeDrawResult(ie,"draw");if(W.success!==!0)throw new Error("draw failed");const Xe={...W,guid:p,lotteryProgramID:W.lotteryProgramID??S()?.id},We=W.type==="noprize"?180:0,be=360,ae=be+(We-((b+be)%360+360)%360+360)%360,Ze=b+ae,we=2*ae/d.SPIN_SPEED*1e3,je=b,se=await r();for(let x=se;x-se<we;x=await r()){const k=(x-se)/we,O=1-(1-k)**2,D=Math.min(k/.78,1),z=1-D*D,Z=k>.78?Math.sin((k-.78)/.22*Math.PI)*5:0;C(je+ae*O,1+d.SCALE_GAIN*z,a*z+Z)}if(le(Ze),await new Promise(x=>re=setTimeout(x,550)),P)return;j(Xe),u(!1)}catch(w){if(clearTimeout(g),P)return;console.log(w);const E=b+((i-b)%360+360)%360;if(e.get(s)&&await Re([{transform:e.get(s).style.transform},{transform:`translateY(0px) rotateX(${E}deg) scale(1)`}],{duration:420,easing:"cubic-bezier(.55,0,.75,.4)"}),P)return;le(E),c&&e.set(N,!0),u(!1)}finally{$===l&&($=null),P||Ae()}},Pe=()=>{e.set(N,!1),u(!1)},ce=t=>{e.get(s)&&(_?.cancel(),_=e.get(s).animate([{transform:`translateY(0px) rotateX(${t}deg) scale(1)`},{transform:`translateY(0px) rotateX(${R}deg) scale(1)`}],{duration:320,easing:"cubic-bezier(.22,.61,.32,1)",fill:"forwards"}),_.onfinish=()=>{_?.cancel(),_=null,C(R,1),e.get(s)&&(e.get(s).style.animation=""),e.set(I,!1)})},Ce=t=>{e.get(K)&&(F=!0,Y=!1,Q=t.clientY,ee=0,H=R,_?.cancel(),e.get(s)&&(e.get(s).style.animation="none"),e.set(I,!0))},de=t=>{if(!F||u())return;const i=Q-t.clientY;ee=i,Math.abs(i)>4&&(Y=!0),C(H+i*1.1,1+Math.min(Math.abs(i)/400,.12))},_e=t=>{if(!F)return;F=!1;const i=Q-t.clientY;if(Math.abs(i)>d.DRAG_THRESHOLD){V(H+i*1.1);return}ce(H+i*1.1)},ge=()=>{F&&(F=!1,Y=!1,ce(H+ee*1.1))},ke=()=>{if(Y){Y=!1;return}V()};n.onMount(()=>(window.addEventListener("pointermove",de),window.addEventListener("pointerup",_e),window.addEventListener("pointercancel",ge),()=>{P=!0,$?.abort(),clearTimeout(re),clearTimeout(J),window.removeEventListener("pointermove",de),window.removeEventListener("pointerup",_e),window.removeEventListener("pointercancel",ge),_?.cancel()}));var De={get program(){return S()},set program(t=null){S(t),e.flushSync()},get endpoint(){return G()},set endpoint(t=null){G(t),e.flushSync()},get session(){return U()},set session(t=null){U(t),e.flushSync()},get isAvailable(){return v()},set isAvailable(t=!1){v(t),e.flushSync()},get spinResults(){return j()},set spinResults(t=null){j(t),e.flushSync()},get spinActive(){return u()},set spinActive(t=!1){u(t),e.flushSync()},get remainingTimesLoading(){return q()},set remainingTimesLoading(t=!1){q(t),e.flushSync()},get onFlip(){return B()},set onFlip(t=()=>{}){B(t),e.flushSync()}},ue=nt(),te=e.first_child(ue),fe=e.child(te),f=e.child(fe);let pe;var ve=e.child(f);n.bind_this(ve,t=>e.set(M,t),()=>e.get(M));var X=e.sibling(ve,2),me=e.sibling(e.child(X),2);n.bind_this(me,t=>e.set(A,t),()=>e.get(A));var he=e.sibling(me,2),Le=e.only_child(he),Ne=e.sibling(he,2),Ye=e.only_child(Ne);e.reset(X),n.bind_this(X,t=>e.set(s,t),()=>e.get(s));var He=e.sibling(X,2);{var Oe=t=>{var i=Je(),a=e.first_child(i);let r;var o=e.sibling(e.child(a),2),c=e.only_child(o,!0);e.next(2),e.reset(a);var g=e.sibling(a,2);let p;e.template_effect(l=>{r=n.set_class(a,1,"coin-royale__drag-hint",null,r,{"coin-royale__drag-hint--hidden":e.get(I)||u()}),n.set_text(c,l),p=n.set_class(g,0,"coin-royale__finger-cue",null,p,{"coin-royale__finger-cue--hidden":e.get(I)||u()})},[()=>h()("dragToFlip")]),n.append(t,i)};n.if_block(He,t=>{v()&&t(Oe)})}e.reset(f),n.bind_this(f,t=>e.set(T,t),()=>e.get(T));var ze=e.sibling(f,2);{var Ge=t=>{var i=Ke(),a=e.child(i),r=e.only_child(a,!0),o=e.sibling(a,2),c=e.only_child(o,!0);e.reset(i),e.template_effect((g,p)=>{n.set_text(r,g),n.set_text(c,p)},[()=>h()("nextAvailable"),()=>h()("countdown",{values:{days:e.get(L).days,hours:e.get(L).hours,minutes:e.get(L).minutes,seconds:e.get(L).seconds}})]),n.append(t,i)},Ue=t=>{var i=Qe(),a=e.child(i),r=e.only_child(a,!0),o=e.sibling(a,2),c=e.only_child(o,!0),g=e.sibling(o,2),p=e.only_child(g,!0);e.reset(i),e.template_effect((l,y,b)=>{n.set_text(r,l),n.set_text(c,y),n.set_text(p,b)},[()=>h()("timeoutTitle"),()=>h()("timeoutDescription"),()=>h()("close")]),n.delegated("click",g,Pe),n.append(t,i)};n.if_block(ze,t=>{v()?e.get(N)&&t(Ue,1):t(Ge)})}e.reset(fe),e.reset(te);var ye=e.sibling(te,2);{var qe=t=>{var i=tt(),a=e.child(i),r=e.sibling(a),o=e.child(r),c=e.sibling(o,2);{var g=l=>{var y=et();n.append(l,y)},p=l=>{var y=n.text();e.template_effect(()=>n.set_text(y,S()?.current?.remainingTimes??S()?.remainingTimes)),n.append(l,y)};n.if_block(c,l=>{q()?l(g):l(p,-1)})}e.reset(r),e.reset(i),e.template_effect(l=>{n.set_text(a,`${l??""} `),n.set_attribute(o,"src",xe.coinHeads)},[()=>h()("remainingFlips")]),n.append(t,i)};n.if_block(ye,t=>{v()&&t(qe)})}var ne=e.sibling(ye,2),$e=e.only_child(ne,!0);e.template_effect((t,i)=>{pe=n.set_class(f,1,"coin-royale__flip-zone",null,pe,{"coin-royale__flip-zone--disabled":!v(),"coin-royale__flip-zone--settling":u()}),n.set_attribute(f,"tabindex",v()?0:-1),n.set_attribute(f,"aria-label",t),n.set_attribute(f,"aria-disabled",!e.get(K)),n.set_attribute(Le,"src",xe.coinHeads),n.set_attribute(Ye,"src",Be.coinTails),ne.disabled=!v(),n.set_text($e,i)},[()=>h()("flipCoin"),()=>h()("flipCoin")]),n.delegated("pointerdown",f,Ce),n.delegated("click",f,ke),n.delegated("keydown",f,t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),V())}),n.delegated("click",ne,()=>V()),n.append(Te,ue);var Ve=e.pop(De);return Ie(),Ve}n.delegate(["pointerdown","click","keydown"]);n.create_custom_element(Se,{program:{},endpoint:{},session:{},isAvailable:{},spinResults:{},spinActive:{},remainingTimesLoading:{},onFlip:{}},[],[],{mode:"open"});exports.CoinFlip=Se;
1
+ "use strict";const n=require("./WheelOfFortuneWheel-DB0BZCUo.cjs"),e=require("./utils-BqkCy2Rz.cjs"),d=require("./constants-CoPH35Re.cjs"),xe=require("./coin-heads-BuJOLpyg.cjs"),Be=require("./coin-tails-20vJmhwv.cjs");var Je=n.from_html('<div><span class="coin-royale__chev">︿</span> <span class="coin-royale__hint-text"> </span> <span class="coin-royale__chev coin-royale__chev--down">﹀</span></div> <svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M9 11V5.5a1.5 1.5 0 0 1 3 0V11h.5V7.5a1.5 1.5 0 0 1 3 0V11h.5V9a1.5 1.5 0 0 1 3 0v6.5c0 3-2 5.5-5.5 5.5H12c-2 0-3.2-.8-4.2-2.3l-2.4-3.6a1.5 1.5 0 0 1 2.3-1.9L9 15.5V11Z"></path></svg>',1),Ke=n.from_html('<div class="coin-royale__badge"><p class="coin-royale__badge-title"> </p> <p class="coin-royale__badge-countdown"> </p></div>'),Qe=n.from_html('<div class="coin-royale__badge"><p class="coin-royale__badge-title"> </p> <p class="coin-royale__badge-body"> </p> <button class="coin-royale__badge-close" type="button"> </button></div>'),et=n.from_html('<span class="coin-royale__flips-loader"></span>'),tt=n.from_html('<p class="coin-royale__flips"> <span class="coin-royale__flips-count"><img class="coin-royale__flips-icon" alt="" aria-hidden="true"/> <!></span></p>'),nt=n.from_html('<div class="coin-royale__play"><div class="coin-royale__stage"><div role="button"><div class="coin-royale__coin-shadow"></div> <div class="coin-royale__coin"><div class="coin-royale__coin-drop-shadow" aria-hidden="true"></div> <div class="coin-royale__coin-edge" aria-hidden="true"></div> <div class="coin-royale__face coin-royale__face--front"><img alt="" draggable="false"/></div> <div class="coin-royale__face coin-royale__face--back"><img alt="" draggable="false"/></div></div> <!></div> <!></div></div> <!> <button class="coin-royale__cta" type="button"> </button>',1);function Se(Te,m){e.push(m,!0);const h=()=>n.store_get(e.$format,"$_",Me),[Me,Ie]=n.setup_stores();let S=n.prop(m,"program",7,null),G=n.prop(m,"endpoint",7,null),U=n.prop(m,"session",7,null),v=n.prop(m,"isAvailable",7,!1),j=n.prop(m,"spinResults",15,null),u=n.prop(m,"spinActive",15,!1),q=n.prop(m,"remainingTimesLoading",7,!1),B=n.prop(m,"onFlip",7,()=>{}),L=e.state(e.proxy({}));e.user_effect(()=>{if(!v()&&S()){const t=()=>e.set(L,e.getTimeRemaining(S()?.next?.startTime),!0);t();const i=setInterval(t,1e3);return()=>clearInterval(i)}});let I=e.state(!1),J;const Ae=()=>{clearTimeout(J),J=setTimeout(()=>e.set(I,!1),400)};let N=e.state(!1),T=e.state(void 0),s=e.state(void 0),A=e.state(void 0),M=e.state(void 0);const K=e.user_derived(()=>v()&&!u()&&!e.get(N)&&!q());let R=0,F=!1,Y=!1,Q=0,H=0,ee=0,_=null,$=null,re,P=!1;const C=(t,i=1,a=0)=>{e.get(s)&&(e.get(s).style.transform=`translateY(${a}px) rotateX(${t}deg) scale(${i})`)};e.user_effect(()=>{if(!e.get(T)||!e.get(s)||!e.get(A))return;oe(),C(R);const t=new ResizeObserver(()=>oe());return t.observe(e.get(T)),()=>t.disconnect()});const oe=()=>{if(!e.get(T)||!e.get(s)||!e.get(A))return;const t=e.get(T).clientWidth;if(!t)return;const i=t/2*d.RIM_FACTOR,a=Math.max(14,t*d.THICKNESS_FACTOR),r=2*i*Math.tan(Math.PI/d.EDGE_SEGMENTS)+.6;e.get(s).style.setProperty("--half-t",`${(a/2).toFixed(2)}px`),e.get(A).replaceChildren();for(let o=0;o<d.EDGE_SEGMENTS;o++){const c=document.createElement("div");c.className=`coin-royale__edge-seg coin-royale__edge-seg--${o%2===0?"a":"b"}`,c.style.width=`${r.toFixed(2)}px`,c.style.height=`${a.toFixed(2)}px`,c.style.transform=`translate(-50%,-50%) rotateZ(${o*360/d.EDGE_SEGMENTS}deg) translateY(${(-i).toFixed(2)}px) rotateX(90deg)`,e.get(A).appendChild(c)}},le=t=>{R=t,_?.cancel(),_=null,C(t,1),e.get(s)&&(e.get(s).style.animation=""),e.get(M)&&(e.get(M).style.opacity="",e.get(M).style.width="")},Re=(t,i)=>new Promise(a=>{if(!e.get(s))return a();_?.cancel(),_=e.get(s).animate(t,{fill:"forwards",...i}),_.onfinish=()=>a(),_.oncancel=()=>a()}),Fe=async(t,i)=>{const a=new Headers({"Content-Type":"application/json"});U()&&a.append("X-SessionId",U());const r=await fetch(new URL(`${G()}/v1/wof/draw/${S()?.id}`),{method:"PUT",headers:a,cache:"no-store",body:JSON.stringify({action:1,guid:t}),signal:i});if(!r.ok)throw new Error(`draw request failed: ${r.status}`);return r.json()},V=async t=>{if(!e.get(K)||!e.get(s)||!e.get(T)||!G())return;B()();const i=typeof t=="number"?t:R;u(!0),e.set(I,!0),e.set(N,!1),_?.cancel();const a=-(e.get(T).clientHeight*d.RISE_FACTOR);e.get(M)&&(e.get(M).style.opacity="0.3",e.get(M).style.width="34%");const r=()=>new Promise((w,E)=>requestAnimationFrame(ie=>P?E(new Error("destroyed")):w(ie)));let o=!1,c=!1,g;const p=e.generateUUID(),l=new AbortController;$=l;const y=Promise.race([Fe(p,l.signal),new Promise((w,E)=>{g=setTimeout(()=>{c=!0,l.abort(),E(new Error("draw timed out"))},d.SPIN_TIMEOUT_MS)})]);y.then(()=>o=!0,()=>o=!0);let b=i;try{let w=await r();const E=w;for(;!o||w-E<d.RISE_MS;){const x=await r(),k=Math.min(x-w,50)/1e3;w=x;const O=x-E,D=Math.min(O/d.SPIN_UP_MS,1);b+=d.SPIN_SPEED*D*D*(3-2*D)*k;const z=Math.min(O/d.RISE_MS,1),Z=1-(1-z)**3,Ee=z>=1?Math.sin((O-d.RISE_MS)/380)*.015:0;C(b,1+d.SCALE_GAIN*(Z+Ee),a*(Z+Ee))}const ie=await y;clearTimeout(g);const W=e.normalizeDrawResult(ie,"draw");if(W.success!==!0)throw new Error("draw failed");const Xe={...W,guid:p,lotteryProgramID:W.lotteryProgramID??S()?.id},We=W.type==="noprize"?180:0,be=360,ae=be+(We-((b+be)%360+360)%360+360)%360,Ze=b+ae,we=2*ae/d.SPIN_SPEED*1e3,je=b,se=await r();for(let x=se;x-se<we;x=await r()){const k=(x-se)/we,O=1-(1-k)**2,D=Math.min(k/.78,1),z=1-D*D,Z=k>.78?Math.sin((k-.78)/.22*Math.PI)*5:0;C(je+ae*O,1+d.SCALE_GAIN*z,a*z+Z)}if(le(Ze),await new Promise(x=>re=setTimeout(x,550)),P)return;j(Xe),u(!1)}catch(w){if(clearTimeout(g),P)return;console.log(w);const E=b+((i-b)%360+360)%360;if(e.get(s)&&await Re([{transform:e.get(s).style.transform},{transform:`translateY(0px) rotateX(${E}deg) scale(1)`}],{duration:420,easing:"cubic-bezier(.55,0,.75,.4)"}),P)return;le(E),c&&e.set(N,!0),u(!1)}finally{$===l&&($=null),P||Ae()}},Pe=()=>{e.set(N,!1),u(!1)},ce=t=>{e.get(s)&&(_?.cancel(),_=e.get(s).animate([{transform:`translateY(0px) rotateX(${t}deg) scale(1)`},{transform:`translateY(0px) rotateX(${R}deg) scale(1)`}],{duration:320,easing:"cubic-bezier(.22,.61,.32,1)",fill:"forwards"}),_.onfinish=()=>{_?.cancel(),_=null,C(R,1),e.get(s)&&(e.get(s).style.animation=""),e.set(I,!1)})},Ce=t=>{e.get(K)&&(F=!0,Y=!1,Q=t.clientY,ee=0,H=R,_?.cancel(),e.get(s)&&(e.get(s).style.animation="none"),e.set(I,!0))},de=t=>{if(!F||u())return;const i=Q-t.clientY;ee=i,Math.abs(i)>4&&(Y=!0),C(H+i*1.1,1+Math.min(Math.abs(i)/400,.12))},_e=t=>{if(!F)return;F=!1;const i=Q-t.clientY;if(Math.abs(i)>d.DRAG_THRESHOLD){V(H+i*1.1);return}ce(H+i*1.1)},ge=()=>{F&&(F=!1,Y=!1,ce(H+ee*1.1))},ke=()=>{if(Y){Y=!1;return}V()};n.onMount(()=>(window.addEventListener("pointermove",de),window.addEventListener("pointerup",_e),window.addEventListener("pointercancel",ge),()=>{P=!0,$?.abort(),clearTimeout(re),clearTimeout(J),window.removeEventListener("pointermove",de),window.removeEventListener("pointerup",_e),window.removeEventListener("pointercancel",ge),_?.cancel()}));var De={get program(){return S()},set program(t=null){S(t),e.flushSync()},get endpoint(){return G()},set endpoint(t=null){G(t),e.flushSync()},get session(){return U()},set session(t=null){U(t),e.flushSync()},get isAvailable(){return v()},set isAvailable(t=!1){v(t),e.flushSync()},get spinResults(){return j()},set spinResults(t=null){j(t),e.flushSync()},get spinActive(){return u()},set spinActive(t=!1){u(t),e.flushSync()},get remainingTimesLoading(){return q()},set remainingTimesLoading(t=!1){q(t),e.flushSync()},get onFlip(){return B()},set onFlip(t=()=>{}){B(t),e.flushSync()}},ue=nt(),te=e.first_child(ue),fe=e.child(te),f=e.child(fe);let pe;var ve=e.child(f);n.bind_this(ve,t=>e.set(M,t),()=>e.get(M));var X=e.sibling(ve,2),me=e.sibling(e.child(X),2);n.bind_this(me,t=>e.set(A,t),()=>e.get(A));var he=e.sibling(me,2),Le=e.only_child(he),Ne=e.sibling(he,2),Ye=e.only_child(Ne);e.reset(X),n.bind_this(X,t=>e.set(s,t),()=>e.get(s));var He=e.sibling(X,2);{var Oe=t=>{var i=Je(),a=e.first_child(i);let r;var o=e.sibling(e.child(a),2),c=e.only_child(o,!0);e.next(2),e.reset(a);var g=e.sibling(a,2);let p;e.template_effect(l=>{r=n.set_class(a,1,"coin-royale__drag-hint",null,r,{"coin-royale__drag-hint--hidden":e.get(I)||u()}),n.set_text(c,l),p=n.set_class(g,0,"coin-royale__finger-cue",null,p,{"coin-royale__finger-cue--hidden":e.get(I)||u()})},[()=>h()("dragToFlip")]),n.append(t,i)};n.if_block(He,t=>{v()&&t(Oe)})}e.reset(f),n.bind_this(f,t=>e.set(T,t),()=>e.get(T));var ze=e.sibling(f,2);{var Ge=t=>{var i=Ke(),a=e.child(i),r=e.only_child(a,!0),o=e.sibling(a,2),c=e.only_child(o,!0);e.reset(i),e.template_effect((g,p)=>{n.set_text(r,g),n.set_text(c,p)},[()=>h()("nextAvailable"),()=>h()("countdown",{values:{days:e.get(L).days,hours:e.get(L).hours,minutes:e.get(L).minutes,seconds:e.get(L).seconds}})]),n.append(t,i)},Ue=t=>{var i=Qe(),a=e.child(i),r=e.only_child(a,!0),o=e.sibling(a,2),c=e.only_child(o,!0),g=e.sibling(o,2),p=e.only_child(g,!0);e.reset(i),e.template_effect((l,y,b)=>{n.set_text(r,l),n.set_text(c,y),n.set_text(p,b)},[()=>h()("timeoutTitle"),()=>h()("timeoutDescription"),()=>h()("close")]),n.delegated("click",g,Pe),n.append(t,i)};n.if_block(ze,t=>{v()?e.get(N)&&t(Ue,1):t(Ge)})}e.reset(fe),e.reset(te);var ye=e.sibling(te,2);{var qe=t=>{var i=tt(),a=e.child(i),r=e.sibling(a),o=e.child(r),c=e.sibling(o,2);{var g=l=>{var y=et();n.append(l,y)},p=l=>{var y=n.text();e.template_effect(()=>n.set_text(y,S()?.current?.remainingTimes??S()?.remainingTimes)),n.append(l,y)};n.if_block(c,l=>{q()?l(g):l(p,-1)})}e.reset(r),e.reset(i),e.template_effect(l=>{n.set_text(a,`${l??""} `),n.set_attribute(o,"src",xe.coinHeads)},[()=>h()("remainingFlips")]),n.append(t,i)};n.if_block(ye,t=>{v()&&t(qe)})}var ne=e.sibling(ye,2),$e=e.only_child(ne,!0);e.template_effect((t,i)=>{pe=n.set_class(f,1,"coin-royale__flip-zone",null,pe,{"coin-royale__flip-zone--disabled":!v(),"coin-royale__flip-zone--settling":u()}),n.set_attribute(f,"tabindex",v()?0:-1),n.set_attribute(f,"aria-label",t),n.set_attribute(f,"aria-disabled",!e.get(K)),n.set_attribute(Le,"src",xe.coinHeads),n.set_attribute(Ye,"src",Be.coinTails),ne.disabled=!v(),n.set_text($e,i)},[()=>h()("flipCoin"),()=>h()("flipCoin")]),n.delegated("pointerdown",f,Ce),n.delegated("click",f,ke),n.delegated("keydown",f,t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),V())}),n.delegated("click",ne,()=>V()),n.append(Te,ue);var Ve=e.pop(De);return Ie(),Ve}n.delegate(["pointerdown","click","keydown"]);n.create_custom_element(Se,{program:{},endpoint:{},session:{},isAvailable:{},spinResults:{},spinActive:{},remainingTimesLoading:{},onFlip:{}},[],[],{mode:"open"});exports.CoinFlip=Se;