Files
Lucky_Wheel/apps/client/dist/assets/wheel-classiccasinowheel-DHnlMe5J.js
T
2026-09-15 17:26:42 +03:30

2 lines
11 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{r as D,o as ue,c as P,w as de,d as pe,a as V,b,e as S,n as ne,u as I,F as oe,f as ae,t as me,g as ge,h as se}from"./vendor-vue-kYoPQr5S.js";const ie=["۰","۱","۲","۳","۴","۵","۶","۷","۸","۹"];function he(e){return e==null||typeof e=="object"&&e!==null&&"value"in e&&(e=e.value,e==null)||typeof e=="object"?"":String(e).replace(/[0-9]/g,m=>ie[+m]).replace(/[٠-٩]/g,m=>ie[m.charCodeAt(0)-1632])}var ye=(e=>(e.CLASSIC_CASINO="CLASSIC_CASINO",e.NEON_CYBER="NEON_CYBER",e.MINIMAL_FLAT="MINIMAL_FLAT",e.LUXURY_GOLD="LUXURY_GOLD",e.PLAYFUL_CARTOON="PLAYFUL_CARTOON",e.RUSTIC_WOOD="RUSTIC_WOOD",e.GALAXY_SPACE="GALAXY_SPACE",e.CANDY_LAND="CANDY_LAND",e.FIRE_FLAME="FIRE_FLAME",e.CRYSTAL_ICE="CRYSTAL_ICE",e))(ye||{});const F=D(localStorage.getItem("wheel_sound_enabled")!=="false");let O=null;function H(){if(!O){const e=window.AudioContext||window.webkitAudioContext;O=new e}return O.state==="suspended"&&O.resume(),O}let q=null;function Ae(e){if(!q||q.sampleRate!==e.sampleRate){const m=Math.ceil(e.sampleRate*.05);q=e.createBuffer(1,m,e.sampleRate);const h=q.getChannelData(0);for(let y=0;y<m;y++)h[y]=(Math.random()*2-1)*Math.exp(-y/(e.sampleRate*.015))}return q}function xe(){function e(){F.value=!F.value,localStorage.setItem("wheel_sound_enabled",String(F.value))}function m(n=.6){if(F.value)try{const f=H(),i=f.currentTime,a=Math.max(.05,Math.min(1,n)),g=.012+(1-a)*.008,d=f.createBufferSource();d.buffer=Ae(f);const s=f.createBiquadFilter();s.type="bandpass",s.frequency.value=2800+a*1200,s.Q.value=1.5;const t=f.createGain();t.gain.setValueAtTime(.18*a+.06,i),t.gain.exponentialRampToValueAtTime(.001,i+g),d.connect(s),s.connect(t),t.connect(f.destination),d.start(i),d.stop(i+g+.005);const o=f.createOscillator();o.type="triangle";const r=600+a*400;o.frequency.setValueAtTime(r,i),o.frequency.exponentialRampToValueAtTime(r*.3,i+.04);const l=f.createGain();l.gain.setValueAtTime(.1*a+.03,i),l.gain.exponentialRampToValueAtTime(.001,i+.04),o.connect(l),l.connect(f.destination),o.start(i),o.stop(i+.05)}catch{}}function h(){if(F.value)try{const n=H(),f=n.currentTime,i=[523.25,659.25,783.99,1046.5],a=.1;i.forEach((t,o)=>{const r=n.createOscillator();r.type="sine",r.frequency.value=t;const l=n.createOscillator();l.type="sine",l.frequency.value=t*2.01;const p=n.createGain(),A=f+o*a;p.gain.setValueAtTime(0,A),p.gain.linearRampToValueAtTime(.22,A+.03),p.gain.exponentialRampToValueAtTime(.001,A+.7);const c=n.createGain();c.gain.setValueAtTime(0,A),c.gain.linearRampToValueAtTime(.06,A+.03),c.gain.exponentialRampToValueAtTime(.001,A+.5),r.connect(p),l.connect(c),p.connect(n.destination),c.connect(n.destination),r.start(A),r.stop(A+.75),l.start(A),l.stop(A+.55)});const g=n.createOscillator();g.type="sine",g.frequency.value=2093;const d=n.createGain(),s=f+i.length*a+.05;d.gain.setValueAtTime(0,s),d.gain.linearRampToValueAtTime(.1,s+.01),d.gain.exponentialRampToValueAtTime(.001,s+.6),g.connect(d),d.connect(n.destination),g.start(s),g.stop(s+.65)}catch{}}function y(){if(F.value)try{const n=H(),f=n.currentTime;[{freq:311.13,duration:.28,delay:0,slide:!1},{freq:293.66,duration:.28,delay:.32,slide:!1},{freq:277.18,duration:.28,delay:.64,slide:!1},{freq:261.63,duration:1.45,delay:.98,slide:!0}].forEach(({freq:a,duration:g,delay:d,slide:s})=>{const t=f+d,o=t+g,r=n.createOscillator(),l=n.createOscillator();if(r.type="sawtooth",l.type="sawtooth",r.frequency.setValueAtTime(a,t),l.frequency.setValueAtTime(a*1.008,t),s){r.frequency.setValueAtTime(a,t),l.frequency.setValueAtTime(a*1.008,t),r.frequency.exponentialRampToValueAtTime(208,o),l.frequency.exponentialRampToValueAtTime(209,o);const u=n.createOscillator(),x=n.createGain();u.frequency.setValueAtTime(5.8,t),x.gain.setValueAtTime(0,t),x.gain.linearRampToValueAtTime(8.5,t+.4),u.connect(x),x.connect(r.frequency),x.connect(l.frequency),u.start(t),u.stop(o+.1)}const p=n.createBiquadFilter();p.type="lowpass",p.Q.value=4.8;const A=t+Math.min(.08,g*.28);p.frequency.setValueAtTime(280,t),p.frequency.exponentialRampToValueAtTime(s?1650:1450,A),p.frequency.exponentialRampToValueAtTime(s?300:360,o);const c=n.createGain();c.gain.setValueAtTime(.001,t),c.gain.linearRampToValueAtTime(.22,t+.03),s&&c.gain.setValueAtTime(.22,t+.65),c.gain.exponentialRampToValueAtTime(.001,o),r.connect(p),l.connect(p),p.connect(c),c.connect(n.destination),r.start(t),l.start(t),r.stop(o+.05),l.stop(o+.05)})}catch{}}return{soundEnabled:F,toggleSound:e,playTick:m,playWin:h,playNoPrize:y}}function Te(e){const{playTick:m}=xe(),h=D(0),y=D(0),n=D(!1),f=window.matchMedia("(prefers-reduced-motion: reduce)").matches;let i=null,a=null;function g(t){if(n.value)return;const o=e.segmentCount();if(o<=0)return;a!==null&&(cancelAnimationFrame(a),a=null),n.value=!0;const r=360/o,l=(Math.random()-.5)*(r*.4),A=(360-(t*r+r/2+l)%360)%360,c=f?1:7+Math.floor(Math.random()*3),u=f?.8:5.5,x=h.value%360,R=(A-x+360)%360,C=c*360+R,z=5.5/u,G=h.value,N=performance.now();let E=N,B=G;const w=360/(e.pegCount?e.pegCount():Math.max(24,o)),j=w*.38;let T=0,_=0,J=Math.floor((G%360+360)%360/w);function K(M){return 1-Math.exp(-z*M*u)}const ce=1/K(1);function W(M){const Y=(M-N)/1e3,k=Math.min(1,Y/u),L=Math.min(.04,Math.max(.001,(M-E)/1e3));E=M;let $;k>=1?$=1:$=K(k)*ce;const v=G+C*$,le=v-B;if(B=v,h.value=v,!f){const fe=le/L,X=Math.min(1,Math.max(0,fe/800)),ee=(v%w+w)%w,te=Math.floor((v%360+360)%360/w);if(te!==J){const U=Math.max(.12,Math.min(1,X*1.8+.15));m(U),_=-180*(.8+X*.5),J=te}if(ee>=w-j){const U=(ee-(w-j))/j,Z=(11+X*3.5)*Math.sin(U*(Math.PI/2));T=Math.max(T,Z),_=0}else{const Z=-1400*T-42*_;_+=Z*L,T+=_*L,T<-3&&(T=-3,_=-_*.3)}y.value=T}k<1?i=requestAnimationFrame(W):(h.value=G+C,n.value=!1,i=null,re(),e.onFinished&&e.onFinished())}function re(){let M=performance.now();function Y(k){const L=Math.min(.03,(k-M)/1e3);M=k;const v=-1e3*T-40*_;if(_+=v*L,T+=_*L,Math.abs(T)<.05&&Math.abs(_)<1){y.value=0,a=null;return}y.value=T,a=requestAnimationFrame(Y)}a=requestAnimationFrame(Y)}i=requestAnimationFrame(W)}ue(()=>{i!==null&&cancelAnimationFrame(i),a!==null&&cancelAnimationFrame(a)});const d=P(()=>({transform:`rotate(${h.value}deg)`,transformOrigin:"50% 50%",willChange:"transform"})),s=P(()=>({transform:`rotate(${y.value}deg)`,transformOrigin:"50% 12px",willChange:"transform"}));return{currentRotation:h,pointerAngle:y,pointerStyle:s,isSpinning:n,wheelStyle:d,spinTo:g}}function Q(e){return typeof e=="function"?e:()=>e.value}function _e(e){const m=Q(e.segments),h=Q(e.spinning),y=Q(e.targetSegmentIndex),n=e.radius??140,f=e.pegRadius??144,i=e.pegCount??24,{wheelStyle:a,pointerStyle:g,isSpinning:d,spinTo:s}=Te({segmentCount:()=>m().length,pegCount:()=>i,onFinished:e.onFinished});de([h,y],([c,u])=>{c&&u!==null&&u!==void 0&&!d.value&&s(u)},{flush:"post"});const t=P(()=>m().length),o=P(()=>t.value>0?360/t.value:0);function r(c){if(t.value<=1)return"";const u=150,x=150,R=(c*o.value-90)*(Math.PI/180),C=((c+1)*o.value-90)*(Math.PI/180),z=u+n*Math.cos(R),G=x+n*Math.sin(R),N=u+n*Math.cos(C),E=x+n*Math.sin(C),B=o.value>180?1:0;return`M ${u} ${x} L ${z} ${G} A ${n} ${n} 0 ${B} 1 ${N} ${E} Z`}function l(c){return`rotate(${c*o.value+o.value/2} 150 150)`}function p(c=i,u=f){return Array.from({length:c},(x,R)=>{const C=(R*(360/c)-90)*(Math.PI/180);return{x:150+u*Math.cos(C),y:150+u*Math.sin(C),index:R}})}const A=P(()=>p());return{wheelStyle:a,pointerStyle:g,isSpinning:d,spinTo:s,totalSegments:t,sliceAngle:o,getSlicePath:r,getTextRotation:l,pegs:A,makePegs:p}}function Se(e,m,h){return _e({segments:()=>e.segments,spinning:()=>e.spinning,targetSegmentIndex:()=>e.targetSegmentIndex,onFinished:m,...h})}const Ce={class:"relative w-full max-w-[340px] xs:max-w-[380px] sm:max-w-[420px] aspect-square mx-auto select-none"},we={class:"absolute inset-0 rounded-full shadow-[0_10px_35px_rgba(0,0,0,0.6)]",style:{background:"radial-gradient(circle, #ffe259 0%, #b8860b 60%, #543d03 100%)",padding:"10px"}},Me={class:"w-full h-full rounded-full border-4 border-amber-300 relative overflow-hidden bg-stone-900"},Re=["d","fill"],ve=["transform"],Ve={x:"150",y:"45","text-anchor":"middle",fill:"#ffffff","font-size":"11","font-weight":"700",class:"wheel-slice-text tracking-tight font-sans"},be=["href"],Fe=["cx","cy"],Ge=["cx","cy"],ke=["cx","cy"],Le={class:"absolute -top-3 left-1/2 -translate-x-1/2 z-20 pointer-events-none drop-shadow-[0_4px_8px_rgba(0,0,0,0.7)]"},Ie=pe({__name:"ClassicCasinoWheel",props:{segments:{},targetSegmentIndex:{},spinning:{type:Boolean}},emits:["spin-finished"],setup(e,{emit:m}){const h=e,y=m,{wheelStyle:n,pointerStyle:f,getSlicePath:i,getTextRotation:a,pegs:g}=Se(h,()=>y("spin-finished"),{radius:140,pegRadius:144});return(d,s)=>(V(),b("div",Ce,[S("div",we,[S("div",Me,[(V(),b("svg",{class:"w-full h-full",style:ne(I(n)),viewBox:"0 0 300 300"},[(V(!0),b(oe,null,ae(e.segments,(t,o)=>(V(),b("g",{key:t.id},[S("path",{d:I(i)(o),fill:t.color||(o%2===0?"#b91c1c":"#1e293b"),stroke:"#fbbf24","stroke-width":"1.5"},null,8,Re),S("g",{transform:I(a)(o)},[S("text",Ve,me(I(he)(t.title)),1),t.image?(V(),b("image",{key:0,href:t.image,x:"138",y:"54",width:"24",height:"24"},null,8,be)):ge("",!0)],8,ve)]))),128)),(V(!0),b(oe,null,ae(I(g),(t,o)=>(V(),b("g",{key:o},[S("circle",{cx:t.x,cy:t.y,r:"4.4",fill:"#1c1917",stroke:"#543d03","stroke-width":"0.8"},null,8,Fe),S("circle",{cx:t.x,cy:t.y,r:"3.5",fill:"url(#casinoStud3D)",stroke:"#fde047","stroke-width":"0.5"},null,8,Ge),S("circle",{cx:t.x-1,cy:t.y-1.1,r:"0.9",fill:"#ffffff",opacity:"0.85"},null,8,ke)]))),128)),s[0]||(s[0]=se('<circle cx="150" cy="150" r="32" fill="url(#casinoCenterGrad)" stroke="#fef08a" stroke-width="2.5"></circle><circle cx="150" cy="150" r="22" fill="#78350f" stroke="#fbbf24" stroke-width="1.5"></circle><text x="150" y="155" text-anchor="middle" font-size="16" fill="#fef08a">★</text><defs><radialGradient id="casinoCenterGrad" cx="40%" cy="40%" r="60%"><stop offset="0%" stop-color="#fff"></stop><stop offset="40%" stop-color="#fbbf24"></stop><stop offset="100%" stop-color="#92400e"></stop></radialGradient><radialGradient id="casinoStud3D" cx="35%" cy="30%" r="70%"><stop offset="0%" stop-color="#ffffff"></stop><stop offset="25%" stop-color="#fef08a"></stop><stop offset="65%" stop-color="#d97706"></stop><stop offset="100%" stop-color="#451a03"></stop></radialGradient></defs>',4))],4))])]),S("div",Le,[S("div",{style:ne(I(f)),class:"w-10 h-[46px] origin-[50%_12px] will-change-transform"},[...s[1]||(s[1]=[se('<svg width="40" height="46" viewBox="0 0 40 46" fill="none" class="overflow-visible"><path d="M20 46L6 14C4 10 7 4 12 4H28C33 4 36 10 34 14L20 46Z" fill="url(#pointerGold)" stroke="#ffffff" stroke-width="1.5"></path><path d="M20 41L9 14C8 11 10 7 13 7H27C30 7 32 11 31 14L20 41Z" fill="none" stroke="rgba(255,255,255,0.45)" stroke-width="0.9"></path><circle cx="20" cy="12" r="5.5" fill="#78350f" stroke="#fbbf24" stroke-width="1.2"></circle><circle cx="20" cy="12" r="4" fill="url(#rubyPinGrad)"></circle><circle cx="19" cy="10.8" r="1.2" fill="#ffffff" opacity="0.85"></circle><defs><linearGradient id="pointerGold" x1="0" y1="0" x2="1" y2="1"><stop offset="0%" stop-color="#fffbeb"></stop><stop offset="35%" stop-color="#fef08a"></stop><stop offset="70%" stop-color="#d97706"></stop><stop offset="100%" stop-color="#78350f"></stop></linearGradient><radialGradient id="rubyPinGrad" cx="35%" cy="35%" r="65%"><stop offset="0%" stop-color="#fca5a5"></stop><stop offset="40%" stop-color="#dc2626"></stop><stop offset="100%" stop-color="#7f1d1d"></stop></radialGradient></defs></svg>',1)])],4)])]))}}),Pe=Object.freeze(Object.defineProperty({__proto__:null,default:Ie},Symbol.toStringTag,{value:"Module"}));export{Pe as C,ye as W,xe as a,he as t,Se as u};