@everymatrix/mini-games-hub 0.2.7 → 0.2.8

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 (74) hide show
  1. package/components/CoinFlip-BOrc1Sgy.cjs +1 -0
  2. package/components/CoinFlip-DgM6tDy5.js +390 -0
  3. package/components/CoinFlip-DiCOvx3Q.cjs +1 -0
  4. package/components/CoinFlip-uc2aguuz.js +355 -0
  5. package/components/CoinRoyale-BH73ZSrU.cjs +734 -0
  6. package/components/CoinRoyale-Bkr3Rd-u.cjs +734 -0
  7. package/components/CoinRoyale-DLL1bCAy.js +1032 -0
  8. package/components/CoinRoyale-fp-xfwl2.js +994 -0
  9. package/components/{GameCard-C-zSlvo1.cjs → GameCard-BiO9Cay-.cjs} +2 -2
  10. package/components/{GameCard-BQ6hFy67.js → GameCard-D78hDMaL.js} +24 -21
  11. package/components/{GameCard-vgoswSWl.cjs → GameCard-Qh_fk15-.cjs} +2 -2
  12. package/components/{GameCard-B3YKo9k6.js → GameCard-jCZ6S2Wu.js} +23 -23
  13. package/components/MiniGamesHub-5tuj6CDm.cjs +16 -0
  14. package/components/{MiniGamesHub-C0q9vZFD.js → MiniGamesHub-Bf2Cd1bB.js} +269 -202
  15. package/components/{MiniGamesHub-D5Y5OYt-.js → MiniGamesHub-KqAdBJEX.js} +231 -167
  16. package/components/MiniGamesHub-SxucWl3S.cjs +16 -0
  17. package/components/{WheelOfFortune-DC57_QGF.js → WheelOfFortune-8HCl7aHv.js} +186 -175
  18. package/components/{WheelOfFortune-u6v6YLc5.js → WheelOfFortune-CBYo6vCg.js} +146 -138
  19. package/components/{WheelOfFortune-2WKhJAdZ.cjs → WheelOfFortune-CDTzbAjp.cjs} +2 -2
  20. package/components/{WheelOfFortune-BJ9iMr53.cjs → WheelOfFortune-XfmUFV3-.cjs} +2 -2
  21. package/components/{WheelOfFortuneDrawResults-BKkTmsVC.cjs → WheelOfFortuneDrawResults-CASEqNiM.cjs} +1 -1
  22. package/components/{WheelOfFortuneDrawResults-D3rgrYi_.js → WheelOfFortuneDrawResults-DqgsImHB.js} +3 -3
  23. package/components/{WheelOfFortuneDrawResults-gx2xkUtF.js → WheelOfFortuneDrawResults-DsfJ3803.js} +3 -3
  24. package/components/{WheelOfFortuneDrawResults-DTufAeXD.cjs → WheelOfFortuneDrawResults-l8iWZa_e.cjs} +1 -1
  25. package/components/WheelOfFortuneHistory-CF8B0i5m.js +213 -0
  26. package/components/WheelOfFortuneHistory-Cnk8otCw.js +213 -0
  27. package/components/WheelOfFortuneHistory-DARohsMs.cjs +12 -0
  28. package/components/WheelOfFortuneHistory-ld2sGzjI.cjs +12 -0
  29. package/components/{WheelOfFortuneRules-DkQOlpqR.js → WheelOfFortuneRules-BZqR4cT9.js} +27 -27
  30. package/components/WheelOfFortuneRules-Bv-d_VAp.cjs +3 -0
  31. package/components/{WheelOfFortuneRules-BM75DT61.js → WheelOfFortuneRules-CRGG3J0S.js} +23 -23
  32. package/components/WheelOfFortuneRules-DLj96pqu.cjs +3 -0
  33. package/components/{WheelOfFortuneWheel-DmTRvIN6.js → WheelOfFortuneWheel-CiyQZNAd.js} +673 -664
  34. package/components/WheelOfFortuneWheel-CrRAYCB1.cjs +3 -0
  35. package/components/WheelOfFortuneWheel-DGD-zfeE.cjs +3 -0
  36. package/components/{WheelOfFortuneWheel-D_tfW-rK.js → WheelOfFortuneWheel-F62aU_CL.js} +186 -178
  37. package/components/bg-scene-Bz42V1FW.cjs +1 -0
  38. package/components/bg-scene-DpHgKCHj.js +4 -0
  39. package/components/coin-heads-BuJOLpyg.cjs +1 -0
  40. package/components/coin-heads-loqcEtH2.js +4 -0
  41. package/components/coin-tails-20vJmhwv.cjs +1 -0
  42. package/components/coin-tails-BTbsTwkz.js +4 -0
  43. package/components/{constants-BYsDpbRv.js → constants-BDSd8ptj.js} +25 -15
  44. package/components/constants-CoPH35Re.cjs +1 -0
  45. package/components/{sparkles-BnriHiyw.cjs → sparkles-9YGw1xiU.cjs} +1 -1
  46. package/components/{sparkles-DplvhrIm.cjs → sparkles-B3XdFovy.cjs} +1 -1
  47. package/components/{sparkles-CSfeD2Zu.js → sparkles-BWGIWWDc.js} +1 -1
  48. package/components/{sparkles-CTrQ372y.js → sparkles-uxV1OTbN.js} +1 -1
  49. package/components/{spin-controller-CIshWmlA.cjs → spin-controller-BXcblJt7.cjs} +1 -1
  50. package/components/{spin-controller-HS3m99tB.cjs → spin-controller-BzO5YNSN.cjs} +1 -1
  51. package/components/{spin-controller-BuBkKrNR.js → spin-controller-CZWa2gmm.js} +2 -2
  52. package/components/{spin-controller-REPdRwaB.js → spin-controller-D3hdDnQ0.js} +2 -2
  53. package/components/{utils-B86dsoC-.js → utils-3LNftCeZ.js} +976 -958
  54. package/components/utils-BxNmJ6YA.cjs +3 -0
  55. package/components/{utils-BtFS7k_l.js → utils-DGrEJJ_K.js} +1063 -1045
  56. package/components/utils-DyVEmMSf.cjs +3 -0
  57. package/es2015/mini-games-hub.cjs +1 -1
  58. package/es2015/mini-games-hub.js +1 -1
  59. package/esnext/mini-games-hub.cjs +1 -1
  60. package/esnext/mini-games-hub.js +1 -1
  61. package/package.json +1 -1
  62. package/components/MiniGamesHub-CfiDjCz7.cjs +0 -16
  63. package/components/MiniGamesHub-DYwmUNTy.cjs +0 -16
  64. package/components/WheelOfFortuneHistory-B-Yadw5p.js +0 -213
  65. package/components/WheelOfFortuneHistory-DdXxYW6M.cjs +0 -12
  66. package/components/WheelOfFortuneHistory-DhFZUmGd.cjs +0 -12
  67. package/components/WheelOfFortuneHistory-IM5H-der.js +0 -213
  68. package/components/WheelOfFortuneRules-D-xnWFIU.cjs +0 -3
  69. package/components/WheelOfFortuneRules-_a2c-LEy.cjs +0 -3
  70. package/components/WheelOfFortuneWheel-CUs0nOjA.cjs +0 -3
  71. package/components/WheelOfFortuneWheel-D9nXwM0H.cjs +0 -3
  72. package/components/constants-DM6Vdc6Z.cjs +0 -1
  73. package/components/utils-By_D2O28.cjs +0 -3
  74. package/components/utils-CSIl6eA7.cjs +0 -3
@@ -0,0 +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;
@@ -0,0 +1,390 @@
1
+ var Et = Object.defineProperty, Mt = Object.defineProperties;
2
+ var St = Object.getOwnPropertyDescriptors;
3
+ var $e = Object.getOwnPropertySymbols;
4
+ var Rt = Object.prototype.hasOwnProperty, At = Object.prototype.propertyIsEnumerable;
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
+ for (var i in r || (r = {}))
7
+ Rt.call(r, i) && Be(f, i, r[i]);
8
+ if ($e)
9
+ for (var i of $e(r))
10
+ At.call(r, i) && Be(f, i, r[i]);
11
+ return f;
12
+ }, Je = (f, r) => Mt(f, St(r));
13
+ var Re = (f, r, i) => new Promise((fe, re) => {
14
+ var T = (_) => {
15
+ try {
16
+ I(i.next(_));
17
+ } catch (D) {
18
+ re(D);
19
+ }
20
+ }, z = (_) => {
21
+ try {
22
+ I(i.throw(_));
23
+ } catch (D) {
24
+ re(D);
25
+ }
26
+ }, I = (_) => _.done ? fe(_.value) : Promise.resolve(_.value).then(T, z);
27
+ I((i = i.apply(f, r)).next());
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";
32
+ import { c as tt } from "./coin-heads-loqcEtH2.js";
33
+ import { c as Jt } from "./coin-tails-BTbsTwkz.js";
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);
35
+ function na(f, r) {
36
+ Dt(r, !0);
37
+ const i = () => kt(Ht, "$_", fe), [fe, re] = Ct();
38
+ let T = C(r, "program", 7, null), z = C(r, "endpoint", 7, null), I = C(r, "session", 7, null), _ = C(r, "isAvailable", 7, !1), D = C(r, "spinResults", 15, null), h = C(r, "spinActive", 15, !1), oe = C(r, "remainingTimesLoading", 7, !1), pe = C(r, "onFlip", 7, () => {
39
+ }), W = O(Yt({}));
40
+ We(() => {
41
+ if (!_() && T()) {
42
+ const e = () => {
43
+ var n, o;
44
+ return y(W, Ot((o = (n = T()) == null ? void 0 : n.next) == null ? void 0 : o.startTime), !0);
45
+ };
46
+ e();
47
+ const a = setInterval(e, 1e3);
48
+ return () => clearInterval(a);
49
+ }
50
+ });
51
+ let H = O(!1), me;
52
+ const at = () => {
53
+ clearTimeout(me), me = setTimeout(() => y(H, !1), 400);
54
+ };
55
+ let K = O(!1), P = O(void 0), c = O(void 0), U = O(void 0), k = O(void 0);
56
+ const ge = Ut(() => _() && !h() && !t(K) && !oe());
57
+ let N = 0, V = !1, Q = !1, ye = 0, ee = 0, he = 0, s = null, X = null, Pe, q = !1;
58
+ const G = (e, a = 1, n = 0) => {
59
+ t(c) && (t(c).style.transform = `translateY(${n}px) rotateX(${e}deg) scale(${a})`);
60
+ };
61
+ We(() => {
62
+ if (!t(P) || !t(c) || !t(U)) return;
63
+ ke(), G(N);
64
+ const e = new ResizeObserver(() => ke());
65
+ return e.observe(t(P)), () => e.disconnect();
66
+ });
67
+ const ke = () => {
68
+ if (!t(P) || !t(c) || !t(U)) return;
69
+ const e = t(P).clientWidth;
70
+ if (!e) return;
71
+ const a = e / 2 * qt, n = Math.max(14, e * Gt), o = 2 * a * Math.tan(Math.PI / Fe) + 0.6;
72
+ t(c).style.setProperty("--half-t", `${(n / 2).toFixed(2)}px`), t(U).replaceChildren();
73
+ for (let l = 0; l < Fe; l++) {
74
+ const u = document.createElement("div");
75
+ u.className = `coin-royale__edge-seg coin-royale__edge-seg--${l % 2 === 0 ? "a" : "b"}`, u.style.width = `${o.toFixed(2)}px`, u.style.height = `${n.toFixed(2)}px`, u.style.transform = `translate(-50%,-50%) rotateZ(${l * 360 / Fe}deg) translateY(${(-a).toFixed(2)}px) rotateX(90deg)`, t(U).appendChild(u);
76
+ }
77
+ }, Ce = (e) => {
78
+ N = e, s == null || s.cancel(), s = null, G(e, 1), t(c) && (t(c).style.animation = ""), t(k) && (t(k).style.opacity = "", t(k).style.width = "");
79
+ }, nt = (e, a) => new Promise((n) => {
80
+ if (!t(c)) return n();
81
+ s == null || s.cancel(), s = t(c).animate(e, Se({ fill: "forwards" }, a)), s.onfinish = () => n(), s.oncancel = () => n();
82
+ }), st = (e, a) => Re(this, null, function* () {
83
+ var l;
84
+ const n = new Headers({ "Content-Type": "application/json" });
85
+ I() && n.append("X-SessionId", I());
86
+ const o = yield fetch(new URL(`${z()}/v1/wof/draw/${(l = T()) == null ? void 0 : l.id}`), {
87
+ method: "PUT",
88
+ headers: n,
89
+ cache: "no-store",
90
+ body: JSON.stringify({ action: 1, guid: e }),
91
+ signal: a
92
+ });
93
+ if (!o.ok) throw new Error(`draw request failed: ${o.status}`);
94
+ return o.json();
95
+ }), le = (e) => Re(this, null, function* () {
96
+ var te, ae;
97
+ if (!t(ge) || !t(c) || !t(P) || !z()) return;
98
+ pe()();
99
+ const a = typeof e == "number" ? e : N;
100
+ h(!0), y(H, !0), y(K, !1), s == null || s.cancel();
101
+ const n = -(t(P).clientHeight * jt);
102
+ t(k) && (t(k).style.opacity = "0.3", t(k).style.width = "34%");
103
+ const o = () => new Promise((g, E) => requestAnimationFrame((Te) => q ? E(new Error("destroyed")) : g(Te)));
104
+ let l = !1, u = !1, p;
105
+ const b = Nt(), d = new AbortController();
106
+ X = d;
107
+ const x = Promise.race([
108
+ st(b, d.signal),
109
+ new Promise((g, E) => {
110
+ p = setTimeout(
111
+ () => {
112
+ u = !0, d.abort(), E(new Error("draw timed out"));
113
+ },
114
+ Zt
115
+ );
116
+ })
117
+ ]);
118
+ x.then(() => l = !0, () => l = !0);
119
+ let m = a;
120
+ try {
121
+ let g = yield o();
122
+ const E = g;
123
+ for (; !l || g - E < Ie; ) {
124
+ const M = yield o(), j = Math.min(M - g, 50) / 1e3;
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));
130
+ }
131
+ const Te = yield x;
132
+ clearTimeout(p);
133
+ const de = Vt(Te, "draw");
134
+ if (de.success !== !0) throw new Error("draw failed");
135
+ const wt = Je(Se({}, de), {
136
+ guid: b,
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;
141
+ G(xt + xe * ne, 1 + et * se, n * se + _e);
142
+ }
143
+ if (Ce(Tt), yield new Promise((M) => Pe = setTimeout(M, 550)), q) return;
144
+ D(wt), h(!1);
145
+ } catch (g) {
146
+ if (clearTimeout(p), q) return;
147
+ console.log(g);
148
+ const E = m + ((a - m) % 360 + 360) % 360;
149
+ if (t(c) && (yield nt(
150
+ [
151
+ { transform: t(c).style.transform },
152
+ { transform: `translateY(0px) rotateX(${E}deg) scale(1)` }
153
+ ],
154
+ { duration: 420, easing: "cubic-bezier(.55,0,.75,.4)" }
155
+ )), q) return;
156
+ Ce(E), u && y(K, !0), h(!1);
157
+ } finally {
158
+ X === d && (X = null), q || at();
159
+ }
160
+ }), it = () => {
161
+ y(K, !1), h(!1);
162
+ }, Le = (e) => {
163
+ t(c) && (s == null || s.cancel(), s = t(c).animate(
164
+ [
165
+ { transform: `translateY(0px) rotateX(${e}deg) scale(1)` },
166
+ {
167
+ transform: `translateY(0px) rotateX(${N}deg) scale(1)`
168
+ }
169
+ ],
170
+ {
171
+ duration: 320,
172
+ easing: "cubic-bezier(.22,.61,.32,1)",
173
+ fill: "forwards"
174
+ }
175
+ ), s.onfinish = () => {
176
+ s == null || s.cancel(), s = null, G(N, 1), t(c) && (t(c).style.animation = ""), y(H, !1);
177
+ });
178
+ }, rt = (e) => {
179
+ t(ge) && (V = !0, Q = !1, ye = e.clientY, he = 0, ee = N, s == null || s.cancel(), t(c) && (t(c).style.animation = "none"), y(H, !0));
180
+ }, De = (e) => {
181
+ if (!V || h()) return;
182
+ const a = ye - e.clientY;
183
+ he = a, Math.abs(a) > 4 && (Q = !0), G(ee + a * 1.1, 1 + Math.min(Math.abs(a) / 400, 0.12));
184
+ }, Ye = (e) => {
185
+ if (!V) return;
186
+ V = !1;
187
+ const a = ye - e.clientY;
188
+ if (Math.abs(a) > Bt) {
189
+ le(ee + a * 1.1);
190
+ return;
191
+ }
192
+ Le(ee + a * 1.1);
193
+ }, Oe = () => {
194
+ V && (V = !1, Q = !1, Le(ee + he * 1.1));
195
+ }, ot = () => {
196
+ if (Q) {
197
+ Q = !1;
198
+ return;
199
+ }
200
+ le();
201
+ };
202
+ Pt(() => (window.addEventListener("pointermove", De), window.addEventListener("pointerup", Ye), window.addEventListener("pointercancel", Oe), () => {
203
+ q = !0, X == null || X.abort(), clearTimeout(Pe), clearTimeout(me), window.removeEventListener("pointermove", De), window.removeEventListener("pointerup", Ye), window.removeEventListener("pointercancel", Oe), s == null || s.cancel();
204
+ }));
205
+ var lt = {
206
+ get program() {
207
+ return T();
208
+ },
209
+ set program(e = null) {
210
+ T(e), L();
211
+ },
212
+ get endpoint() {
213
+ return z();
214
+ },
215
+ set endpoint(e = null) {
216
+ z(e), L();
217
+ },
218
+ get session() {
219
+ return I();
220
+ },
221
+ set session(e = null) {
222
+ I(e), L();
223
+ },
224
+ get isAvailable() {
225
+ return _();
226
+ },
227
+ set isAvailable(e = !1) {
228
+ _(e), L();
229
+ },
230
+ get spinResults() {
231
+ return D();
232
+ },
233
+ set spinResults(e = null) {
234
+ D(e), L();
235
+ },
236
+ get spinActive() {
237
+ return h();
238
+ },
239
+ set spinActive(e = !1) {
240
+ h(e), L();
241
+ },
242
+ get remainingTimesLoading() {
243
+ return oe();
244
+ },
245
+ set remainingTimesLoading(e = !1) {
246
+ oe(e), L();
247
+ },
248
+ get onFlip() {
249
+ return pe();
250
+ },
251
+ set onFlip(e = () => {
252
+ }) {
253
+ pe(e), L();
254
+ }
255
+ }, ze = aa(), we = Ke(ze), He = R(we), w = R(He);
256
+ let Ue;
257
+ var Ne = R(w);
258
+ ue(Ne, (e) => y(k, e), () => t(k));
259
+ var ce = v(Ne, 2), Ve = v(R(ce), 2);
260
+ ue(Ve, (e) => y(U, e), () => t(U));
261
+ var Xe = v(Ve, 2), ct = A(Xe), dt = v(Xe, 2), _t = A(dt);
262
+ F(ce), ue(ce, (e) => y(c, e), () => t(c));
263
+ var ut = v(ce, 2);
264
+ {
265
+ var vt = (e) => {
266
+ var a = Wt(), n = Ke(a);
267
+ let o;
268
+ var l = v(R(n), 2), u = A(l, !0);
269
+ Xt(2), F(n);
270
+ var p = v(n, 2);
271
+ let b;
272
+ B(
273
+ (d) => {
274
+ o = Ae(n, 1, "coin-royale__drag-hint", null, o, {
275
+ "coin-royale__drag-hint--hidden": t(H) || h()
276
+ }), S(u, d), b = Ae(p, 0, "coin-royale__finger-cue", null, b, {
277
+ "coin-royale__finger-cue--hidden": t(H) || h()
278
+ });
279
+ },
280
+ [() => i()("dragToFlip")]
281
+ ), Y(e, a);
282
+ };
283
+ ve(ut, (e) => {
284
+ _() && e(vt);
285
+ });
286
+ }
287
+ F(w), ue(w, (e) => y(P, e), () => t(P));
288
+ var ft = v(w, 2);
289
+ {
290
+ var pt = (e) => {
291
+ var a = Kt(), n = R(a), o = A(n, !0), l = v(n, 2), u = A(l, !0);
292
+ F(a), B(
293
+ (p, b) => {
294
+ S(o, p), S(u, b);
295
+ },
296
+ [
297
+ () => i()("nextAvailable"),
298
+ () => i()("countdown", {
299
+ values: {
300
+ days: t(W).days,
301
+ hours: t(W).hours,
302
+ minutes: t(W).minutes,
303
+ seconds: t(W).seconds
304
+ }
305
+ })
306
+ ]
307
+ ), Y(e, a);
308
+ }, mt = (e) => {
309
+ var a = Qt(), n = R(a), o = A(n, !0), l = v(n, 2), u = A(l, !0), p = v(l, 2), b = A(p, !0);
310
+ F(a), B(
311
+ (d, x, m) => {
312
+ S(o, d), S(u, x), S(b, m);
313
+ },
314
+ [
315
+ () => i()("timeoutTitle"),
316
+ () => i()("timeoutDescription"),
317
+ () => i()("close")
318
+ ]
319
+ ), ie("click", p, it), Y(e, a);
320
+ };
321
+ ve(ft, (e) => {
322
+ _() ? t(K) && e(mt, 1) : e(pt);
323
+ });
324
+ }
325
+ F(He), F(we);
326
+ var qe = v(we, 2);
327
+ {
328
+ var gt = (e) => {
329
+ var a = ta(), n = R(a), o = v(n), l = R(o), u = v(l, 2);
330
+ {
331
+ var p = (d) => {
332
+ var x = ea();
333
+ Y(d, x);
334
+ }, b = (d) => {
335
+ var x = Lt();
336
+ B(() => {
337
+ var m, te, ae, g;
338
+ return S(x, (g = (te = (m = T()) == null ? void 0 : m.current) == null ? void 0 : te.remainingTimes) != null ? g : (ae = T()) == null ? void 0 : ae.remainingTimes);
339
+ }), Y(d, x);
340
+ };
341
+ ve(u, (d) => {
342
+ oe() ? d(p) : d(b, -1);
343
+ });
344
+ }
345
+ F(o), F(a), B(
346
+ (d) => {
347
+ S(n, `${d != null ? d : ""} `), $(l, "src", tt);
348
+ },
349
+ [() => i()("remainingFlips")]
350
+ ), Y(e, a);
351
+ };
352
+ ve(qe, (e) => {
353
+ _() && e(gt);
354
+ });
355
+ }
356
+ var be = v(qe, 2), yt = A(be, !0);
357
+ B(
358
+ (e, a) => {
359
+ Ue = Ae(w, 1, "coin-royale__flip-zone", null, Ue, {
360
+ "coin-royale__flip-zone--disabled": !_(),
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);
363
+ },
364
+ [() => i()("flipCoin"), () => i()("flipCoin")]
365
+ ), ie("pointerdown", w, rt), ie("click", w, ot), ie("keydown", w, (e) => {
366
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), le());
367
+ }), ie("click", be, () => le()), Y(f, ze);
368
+ var ht = zt(lt);
369
+ return re(), ht;
370
+ }
371
+ Ft(["pointerdown", "click", "keydown"]);
372
+ It(
373
+ na,
374
+ {
375
+ program: {},
376
+ endpoint: {},
377
+ session: {},
378
+ isAvailable: {},
379
+ spinResults: {},
380
+ spinActive: {},
381
+ remainingTimesLoading: {},
382
+ onFlip: {}
383
+ },
384
+ [],
385
+ [],
386
+ { mode: "open" }
387
+ );
388
+ export {
389
+ na as C
390
+ };
@@ -0,0 +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;