PageSourceSearch

https://sharker.com/assets/LiveTrading-CeX-p_3B.js

js sharker.com collected 2026-10-09 00:25:34 UTC 97,521 bytes, 1 lines download raw bytes

1import{r,j as t,d as Nr,u as kr,b as vr,c as Cr}from"./vendor-react-PsPkEBkt.js";import{fR as fs,fS as wr,fT as jr,fU as us,fV as Er,fW as Rr,fX as $e,cF as Kn,fY as Wn,fZ as Ks,f_ as Lr,f$ as ms,g0 as Es,g1 as dn,bK as Ar,o as Tr,_ as Mr,g2 as Dr,g3 as Br,g4 as Ir,g5 as Pr,g6 as fn,g7 as $r,d as mn,g8 as Fr,g9 as Or,ga as Ur,gb as Kr}from"./index-BDRRllFS.js";import{I as Wr,f as pn}from"./vendor-ethers-D_NWdXvR.js";import{u as Hr,a as hn}from"./vendor-redux-DWtSRiNz.js";import{b7 as Fs,ay as Hn,r as Ws,b3 as Vr,b8 as zr,J as ps,aL as hs,aq as Gr,ar as qr,L as bs,b9 as Yr,a5 as bn,v as Xr,ba as Zr,b0 as Qr,X as Hs,bb as Jr,bc as ea,Q as ta,bd as sa,ax as xn,n as na,a1 as ra,be as aa,T as Vn,a0 as zn}from"./vendor-lucide-CvpfynNq.js";import{a as oa,h as pt,K as la,$ as ia,U as ca,G as ua}from"./vendor-charts-DXEeK3BO.js";import"./vendor-sentry-CV3e28oT.js";import"./vendor-tanstack-CKmQSGMc.js";import"./vendor-firebase-BK7lJc0x.js";const gn=9,da=5e3,fa=3e4,ma="event BetSettled(uint256 indexed betId, address indexed player, bytes32 indexed asset, string assetName, string partnerRef, uint8 priceDecimals, uint8 direction, uint32 timeframe, uint8 result, uint256 amount, uint256 payoutAmount, uint256 openPrice, uint256 closePrice, uint256 placedAt, uint256 openedAt, uint256 expiresAt, uint256 settledAt, uint8 treasuryStatusAtPlacement)",pa={1:"UP",2:"DOWN"},ha={0:"NONE",1:"WIN",2:"LOSE",3:"REFUND"};function ba(s){const e=Number(s);return Number.isFinite(e)&&e>0?10**e:1e8}async function xa(s){const e=jr(),n=new Wr([ma]),a=n.getEvent("BetSettled").topicHash,o=await e.getBlockNumber(),l=Math.max(0,o-da),c=(await e.getLogs({address:us,topics:[a],fromBlock:l,toBlock:o})).slice(-s).reverse(),m=[];for(const d of c){const y=n.parseLog(d);if(!y)continue;const u=y.args;Er(u.asset,u.priceDecimals);const _=ha[Number(u.result)]??"NONE";if(_==="NONE")continue;const S=ba(u.priceDecimals),p=Number(u.closePrice);m.push({id:u.betId.toString(),txHash:d.transactionHash??void 0,assetKey:Rr(u.asset),direction:pa[Number(u.direction)]??"UP",timeframe:Number(u.timeframe),amount:Number(pn(u.amount,gn)),payoutAmount:Number(pn(u.payoutAmount,gn)),openPrice:Number(u.openPrice)/S,closePrice:p>0?p/S:null,placedAt:Number(u.placedAt)*1e3,openedAt:Number(u.openedAt)*1e3,expiresAt:Number(u.expiresAt)*1e3,settledAt:Number(u.settledAt)*1e3,status:"SETTLED",result:_})}return m}const yn=wr(s=>xa(Number(s)),fa);function ga(s){const[e,n]=r.useState(()=>yn.peek(String(s))??[]);return r.useEffect(()=>{let a=!1;return yn.get(String(s)).then(o=>{a||n(o)}).catch(o=>{fs("recentSettlements",o)}),()=>{a=!0}},[s]),e}const Gn="lt_sound_effects_enabled",qn="lt_soundtrack_enabled",xs={effectsEnabled:!0,soundtrackEnabled:!1},Os="/assets/trading/audio",ya=`${Os}/soundtrack.wav`,Rs={click:"click.wav",placeBet:"place-bet.wav",win:"win.wav",lose:"lose.wav",refund:"refund.wav",suspended:"suspended.wav",resume:"resume.wav",cashout:"cashout.wav",jackpot:"jackpot.wav",error:"error.wav",autoStart:"auto-start.wav",autoStop:"auto-stop.wav"},Ls={click:.24,placeBet:.34,win:.34,lose:.3,refund:.32,suspended:.3,resume:.3,cashout:.34,jackpot:.34,error:.3,autoStart:.28,autoStop:.26},_n=(s,e)=>{if(typeof window>"u")return e;try{const n=window.localStorage.getItem(s);return n===null?e:n==="1"}catch{return e}},Sn=(s,e)=>{if(!(typeof window>"u"))try{window.localStorage.setItem(s,e?"1":"0")}catch{}},Yn=()=>({effectsEnabled:_n(Gn,xs.effectsEnabled),soundtrackEnabled:_n(qn,xs.soundtrackEnabled)}),_a=()=>typeof window>"u"?null:window;class Sa{ctx=null;graph=null;effectsEnabled=xs.effectsEnabled;soundtrackEnabled=xs.soundtrackEnabled;soundtrackTimer=null;soundtrackStep=0;soundtrackElement=null;effectElements={};effectBuffers={};effectLoads={};lastEventAt={};visibilityHandler=()=>{if(!(typeof document>"u")){if(document.hidden){this.stopSoundtrack();return}this.soundtrackEnabled&&this.startSoundtrack()}};constructor(e){this.effectsEnabled=e.effectsEnabled,this.soundtrackEnabled=e.soundtrackEnabled,typeof document<"u"&&document.addEventListener("visibilitychange",this.visibilityHandler)}setEffectsEnabled(e){this.effectsEnabled=e,Sn(Gn,e)}
1preload(){Object.keys(Rs).forEach(e=>{this.ensureEffectElement(e)?.load()}),this.ensureSoundtrackElement()?.load()}setSoundtrackEnabled(e){this.soundtrackEnabled=e,Sn(qn,e),e?this.startSoundtrack():this.stopSoundtrack()}stopSoundtrack(){this.soundtrackElement&&this.soundtrackElement.pause(),this.soundtrackTimer&&(window.clearInterval(this.soundtrackTimer),this.soundtrackTimer=null)}async resume(){const e=this.ensureContext();if(!(!e||e.state!=="suspended"))try{await e.resume()}catch{}}play(e){if(!this.effectsEnabled||typeof document<"u"&&document.hidden)return;const n=Date.now(),a=e==="click"?45:90;(this.lastEventAt[e]??0)+a>n||(this.lastEventAt[e]=n,!this.playAsset(e)&&this.playProcedural(e))}playProcedural(e){const n=this.ensureContext();if(!n)return;this.resume(),this.ensureGraph(n);const a=n.currentTime+.01;switch(e){case"click":this.playClick(a);break;case"placeBet":this.playPlaceBet(a);break;case"win":this.playWin(a);break;case"lose":this.playLose(a);break;case"refund":this.playRefund(a);break;case"suspended":this.playSuspended(a);break;case"resume":this.playResume(a);break;case"cashout":this.playCashout(a);break;case"jackpot":this.playJackpot(a);break;case"error":this.playError(a);break;case"autoStart":this.playAutoStart(a);break;case"autoStop":this.playAutoStop(a);break}}ensureContext(){if(this.ctx&&this.ctx.state!=="closed")return this.ctx;const e=_a(),n=e?.AudioContext??e?.webkitAudioContext;return n?(this.ctx=new n,this.graph=null,this.ctx):null}ensureGraph(e){if(this.graph)return this.graph;const n=e.createGain(),a=e.createGain(),o=e.createGain(),l=e.createBiquadFilter();return n.gain.value=.72,a.gain.value=.48,o.gain.value=.12,l.type="lowpass",l.frequency.value=1450,l.Q.value=.7,a.connect(n),o.connect(l),l.connect(n),n.connect(e.destination),this.graph={master:n,effects:a,music:o,musicFilter:l},this.graph}startSoundtrack(){typeof document<"u"&&document.hidden||this.startAssetSoundtrack()||this.startProceduralSoundtrack()}startProceduralSoundtrack(){const e=this.ensureContext();if(e){if(e.state==="suspended"){this.resume().then(()=>{e.state==="running"&&this.soundtrackEnabled&&this.startSoundtrack()});return}this.ensureGraph(e),!this.soundtrackTimer&&(this.scheduleSoundtrackBar(),this.soundtrackTimer=window.setInterval(()=>this.scheduleSoundtrackBar(),1800))}}playAsset(e){return this.playBufferedAsset(e)||this.playHtmlAudioAsset(e)?!0:(this.loadEffectBuffer(e),!1)}playBufferedAsset(e){const n=this.effectBuffers[e];if(!n)return!1;const a=this.ensureContext();if(!a)return!1;const o=this.ensureGraph(a),l=a.createBufferSource(),i=a.createGain();return this.resume(),l.buffer=n,i.gain.value=Ls[e]??.32,l.connect(i),i.connect(o.effects),l.start(a.currentTime+.005),!0}playHtmlAudioAsset(e){const n=this.ensureEffectElement(e);if(!n)return!1;const a=n.cloneNode(!0);a.volume=Ls[e]??.32;const o=a.play();return o&&o.catch(()=>this.playProcedural(e)),this.loadEffectBuffer(e),!0}startAssetSoundtrack(){const e=this.ensureSoundtrackElement();if(!e)return!1;e.loop=!0,e.volume=.16;const n=e.play();return n&&n.catch(()=>{this.soundtrackEnabled&&this.startProceduralSoundtrack()}),!0}ensureEffectElement(e){const n=Rs[e];if(!n||typeof Audio>"u")return null;if(!this.effectElements[e]){const a=new Audio(`${Os}/${n}`);a.preload="auto",a.volume=Ls[e]??.32,this.effectElements[e]=a}return this.effectElements[e]??null}ensureSoundtrackElement(){if(typeof Audio>"u")return null;if(!this.soundtrackElement){const e=new Audio(ya);e.preload="auto",e.loop=!0,e.volume=.16,this.soundtrackElement=e}return this.soundtrackElement}loadEffectBuffer(e){const n=Rs[e];if(!n)return Promise.resolve(null);if(this.effectBuffers[e])return Promise.resolve(this.effectBuffers[e]??null);if(this.effectLoads[e])return this.effectLoads[e]??Promise.resolve(null);const a=this.ensureContext();if(!a||typeof fetch>"u")return Promise.resolve(null);const o=fetch(`${Os}/${n}`).then(async l=>{if(!l.ok)throw new Error(`Failed to load audio asset: ${n}`);const i=await l.arrayBuffer(),c=await a.decodeAudioData(i.slice(0));return this.effectBuffers[e]=c,c}).catch(()=>null);return this.effectLoads[e]=o,o}scheduleSoundtrackBar(){if(!this.soundtrackEnabled)return;const e=this.ensureContext();if(!e)return;const n=this.ensureGraph(e),a=e.currentTime+.03,o=[[174.61,261.63,329.63],[196,293.66,392],[164.81,246.94,329.63],[220,277.18,369.99]],l=o[this.soundtrackStep%o.length];l.forEach((i,c)=>{this.tone({at:a+c*.08,duration:1.4,frequency:i,type:"sine",volume:.018,destination:n.music,attack:.22})}),this.tone({at:a+.9,duration:.5,frequency:l[2]*2,type:"triangle",volume:.008,destination:n.music,attack:.1}),this.soundtrackStep+=1}playClick(e){this.tone({at:e,duration:.055,frequency:880,endFrequency:1180,type:"triangle",volume:.028}),this.noise({at:e,duration:.025,volume:.018,filterFrequency:3200,filterType:"highpass"})}playPlaceBet(e){this.tone({at:e,duration:.08,frequency:172,endFrequency:112,type:"sine",volume:.05}),this.tone({at:e+.05,duration:.14,frequency:680,endFrequency:860,type:"triangle",volume:.05}),this.noise({at:e,duration:.12,volume:.018,filterFrequency:1800,filterType:"bandpass"})}
1playWin(e){[659.25,880,1174.66].forEach((n,a)=>{this.tone({at:e+a*.075,duration:.22,frequency:n,type:"triangle",volume:.052})}),this.noise({at:e+.06,duration:.26,volume:.014,filterFrequency:5200,filterType:"highpass"})}playLose(e){this.tone({at:e,duration:.18,frequency:392,endFrequency:247,type:"sine",volume:.046}),this.tone({at:e+.08,duration:.16,frequency:196,endFrequency:164,type:"triangle",volume:.022})}playRefund(e){this.noise({at:e,duration:.16,volume:.026,filterFrequency:1300,filterType:"bandpass",reverseEnvelope:!0}),this.tone({at:e+.12,duration:.2,frequency:523.25,endFrequency:659.25,type:"triangle",volume:.035})}playSuspended(e){this.tone({at:e,duration:.16,frequency:311.13,type:"sine",volume:.042}),this.tone({at:e+.18,duration:.18,frequency:233.08,type:"sine",volume:.034})}playResume(e){this.tone({at:e,duration:.11,frequency:440,endFrequency:660,type:"triangle",volume:.038}),this.tone({at:e+.09,duration:.18,frequency:880,type:"sine",volume:.026})}playCashout(e){this.playWin(e),this.tone({at:e+.22,duration:.24,frequency:1318.51,type:"triangle",volume:.042})}playJackpot(e){this.playWin(e),[1567.98,1318.51,1760].forEach((n,a)=>{this.tone({at:e+.24+a*.08,duration:.28,frequency:n,type:"triangle",volume:.05})}),this.noise({at:e+.18,duration:.42,volume:.02,filterFrequency:6200,filterType:"highpass"})}playError(e){this.tone({at:e,duration:.12,frequency:220,endFrequency:185,type:"sine",volume:.05}),this.tone({at:e+.12,duration:.12,frequency:196,endFrequency:174,type:"sine",volume:.04})}playAutoStart(e){this.tone({at:e,duration:.12,frequency:392,endFrequency:523.25,type:"triangle",volume:.034}),this.tone({at:e+.09,duration:.16,frequency:659.25,type:"triangle",volume:.032})}playAutoStop(e){this.tone({at:e,duration:.18,frequency:392,endFrequency:293.66,type:"sine",volume:.034})}tone({at:e,duration:n,frequency:a,endFrequency:o,type:l,volume:i,destination:c,attack:m=.012}){const d=this.ensureContext();if(!d)return;const y=this.ensureGraph(d),u=d.createOscillator(),_=d.createGain(),S=Math.max(d.currentTime,e),p=S+Math.min(m,n*.45),b=S+n;u.type=l,u.frequency.setValueAtTime(Math.max(1,a),S),o&&u.frequency.exponentialRampToValueAtTime(Math.max(1,o),b),_.gain.setValueAtTime(1e-4,S),_.gain.exponentialRampToValueAtTime(Math.max(1e-4,i),p),_.gain.exponentialRampToValueAtTime(1e-4,b),u.connect(_),_.connect(c??y.effects),u.start(S),u.stop(b+.03)}noise({at:e,duration:n,volume:a,filterFrequency:o,filterType:l,reverseEnvelope:i=!1}){const c=this.ensureContext();if(!c)return;const m=this.ensureGraph(c),d=Math.max(1,Math.floor(c.sampleRate*n)),y=c.createBuffer(1,d,c.sampleRate),u=y.getChannelData(0);for(let B=0;B<d;B+=1)u[B]=Math.random()*2-1;const _=c.createBufferSource(),S=c.createBiquadFilter(),p=c.createGain(),b=Math.max(c.currentTime,e),$=b+n,N=i?b+n*.75:b+n*.15;_.buffer=y,S.type=l,S.frequency.setValueAtTime(o,b),S.Q.value=.8,p.gain.setValueAtTime(1e-4,b),p.gain.exponentialRampToValueAtTime(Math.max(1e-4,a),N),p.gain.exponentialRampToValueAtTime(1e-4,$),_.connect(S),S.connect(p),p.connect(m.effects),_.start(b),_.stop($+.02)}}let As=null;const ze=()=>(As||(As=new Sa(Yn())),As);function Na(){const[s,e]=r.useState(Yn);r.useEffect(()=>{const S=ze();return S.preload(),S.setEffectsEnabled(s.effectsEnabled),S.setSoundtrackEnabled(s.soundtrackEnabled),()=>{S.stopSoundtrack()}},[s.effectsEnabled,s.soundtrackEnabled]);const n=r.useCallback(async()=>{await ze().resume()},[]),a=r.useCallback(()=>{e(S=>{const p=!S.effectsEnabled,b={...S,effectsEnabled:p},$=ze();return $.setEffectsEnabled(p),p&&($.resume(),$.play("resume")),b})},[]),o=r.useCallback(()=>{e(S=>{const p=!S.soundtrackEnabled,b={...S,soundtrackEnabled:p},$=ze();return $.resume(),$.setSoundtrackEnabled(p),$.play(p?"resume":"suspended"),b})},[]),l=r.useCallback(()=>{ze().play("click")},[]),i=r.useCallback(()=>{ze().play("placeBet")},[]),c=r.useCallback(S=>{const p=S==="WIN"?"win":S==="LOSE"?"lose":"refund";ze().play(p)},[]),m=r.useCallback(()=>{ze().play("autoStart")},[]),d=r.useCallback(()=>{ze().play("autoStop")},[]),y=r.useCallback(()=>{ze().play("error")},[]),u=r.useCallback(()=>{ze().play("suspended")},[]),_=r.useCallback(()=>{ze().play("resume")},[]);return{effectsEnabled:s.effectsEnabled,soundtrackEnabled:s.soundtrackEnabled,resume:n,toggleEffects:a,toggleSoundtrack:o,playClick:l,playPlaceBet:i,playSettle:c,playAutoTradeStart:m,playAutoTradeStop:d,playError:y,playSuspended:u,playResume:_}}function ka({betPoints:s,assetKey:e}){const[n,a]=r.useState(null),o=r.useRef(e);r.useEffect(()=>{o.current!==e&&(o.current=e,a(null))},[e]),r.useEffect(()=>{if(n===null||s.some(u=>u.betId&&String(u.betId)===n))return;const y=window.setTimeout(()=>{a(null)},3200);return()=>window.clearTimeout(y)},[s,n]);const l=r.useCallback(d=>{a(d)},[]),i=r.useCallback(d=>{a(d)},[]),c=r.useCallback(()=>{a(null)},[]),m=r.useMemo(()=>s.find(d=>d.betId&&String(d.betId)===n)??null,[s,n]);return{focusedBetId:n,focusedBet:m,positionViewport:null,focusBet:l,focusNewBet:i,clearFocus:c}}const va=[2,5,10,20,50];function Nn(s){return s>=60?`${s/60}m`:`${s}s`}function Ca({value:s,label:e,cls:n,selected:a,disabled:o,onSelect:l}){const i=r.useCallback(()=>l(s),[l,s]);return t.jsxs("button",{type:"button",disabled:o,onClick:i,className:`atDirBtn ${n} ${a?"isSelected":""}`,"aria-pressed":a,children:[s==="UP"&&t.jsx(ps,{size:11,strokeWidth:2.25}),s==="DOWN"&&t.jsx(hs,{size:11,strokeWidth:2.25}),s==="ALTERNATE"&&t.jsxs("span",{className:"atAltIcon",children:[t.jsx(ps,{size:9,strokeWidth:2.25,className:"optDirUp"}),t.jsx(hs,{size:9,strokeWidth:2.25,className:"optDirDown"})]}),t.jsx("span",{children:e})]})}const wa=r.memo(Ca);function ja({value:s,selected:e,disabled:n,onSelect:a}){const o=r.useCallback(()=>a(s),[a,s]);return t.jsx("button",{type:"button",disabled:n,onClick:o,className:`atCountBtn ${e?"isSelected":""}`,"aria-pressed":e,children:s})}const Ea=r.memo(ja);function Ra({isActive:s,onStart:e,onStop:n,timeframeSecs:a,betsPlaced:o,totalBets:l,lastDirection:i,nextBetAt:c=null,onInteract:m,direction:d,betCount:y,customCount:u,onChangeDirection:_,onChangeBetCount:S,onChangeCustomCount:p,forceExpanded:b=!1,headerActions:$}){const N=$e(),[B,R]=r.useState(!1),E=b||B,U=Kn(),V=s&&c&&c>U?Math.ceil((c-U)/1e3):null,le=r.useMemo(()=>[{value:"UP",label:N("lt_bet_btn_up"),cls:"optDirUp"},{value:"DOWN",label:N("lt_bet_btn_down"),cls:"optDirDown"},{value:"ALTERNATE",label:N("lt_auto_strategy_alternate"),cls:"optDirAlt"}],[N]),Q=u!==""?Math.max(1,parseInt(u)||1):y,X=s&&l>0?o/l*100:0,I=i==="UP"?"lastDirUp":i==="DOWN"?"lastDirDown":"lastDirAlt",se=d==="UP"?"startBtnUp":d==="DOWN"?"startBtnDown":"startBtnAlt",ee=r.useCallback(()=>{b||(m?.(),R(L=>!L))},[b,m]),k=r.useCallback(()=>{e({direction:d,totalBets:Q}),Wn()},[e,d,Q]),v=r.useCallback(L=>{m?.(),_(L)},[_,m]),M=r.useCallback(L=>{m?.(),S(L),p("")},[S,p,m]),z=r.useCallback(L=>{p(L.target.value)},[p]),K=N(d==="ALTERNATE"?"lt_auto_strategy_alternate":d==="UP"?"lt_bet_btn_up":"lt_bet_btn_down"),ce=t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"atHeaderLeft",children:[t.jsx(Fs,{size:13,className:s?"atIconActive":"atIconIdle",strokeWidth:2}),t.jsx("span",{className:"atTitle",children:N("lt_auto_title")}),s&&t.jsx("span",{className:"atRunningBadge",children:N("lt_auto_running")})]}),t.jsxs("span",{className:"atHeaderRight",children:[s&&t.jsxs("span",{className:`atProgressText ${I}`,children:[o,"/",l]}),!b&&(E?t.jsx(Hn,{size:14,className:"atChevron"}):t.jsx(Ws,{size:14,className:"atChevron"})),$]})]});return t.jsxs("section",{className:`autoTradePanel ${s?"isActive":""} ${b?"isLocked":""}`,"aria-label":N("lt_auto_title"),children:[b?t.jsx("div",{className:"atHeader atHeaderStatic",children:ce}):t.jsx("button",{type:"button",className:"atHeader",onClick:ee,"aria-expanded":E,children:ce}),s&&t.jsx("div",{className:"atProgressBar","aria-hidden":"true",children:t.jsx("div",{className:"atProgressBarFill",style:{width:`${X}%`}})}),s&&V!==null&&t.jsxs("div",{className:"atNextBet",role:"status","aria-live":"polite",children:[t.jsx(Vr,{size:11,strokeWidth:2.25}),t.jsx("span",{children:N("lt_auto_next_bet_in",{time:Nn(V)})})]}),E&&t.jsxs("div",{className:"atConfig",children:[t.jsxs("div",{className:"atField",children:[t.jsx("span",{className:"atLabel",children:N("lt_auto_strategy")}),t.jsx("div",{className:"atDirGrid",children:le.map(L=>t.jsx(wa,{value:L.value,label:L.label,cls:L.cls,selected:d===L.value,disabled:s,onSelect:v},L.value))})]}),t.jsxs("div",{className:"atField",children:[t.jsx("span",{className:"atLabel",children:N("lt_auto_max_bets")}),t.jsxs("div",{className:"atCountRow",children:[t.jsx("div",{className:"atCountList",children:va.map(L=>t.jsx(Ea,{value:L,selected:Q===L&&u==="",disabled:s,onSelect:M},L))}),t.jsxs("label",{className:`atCustomField ${u!==""?"isActive":""} ${s?"isLocked":""}`,children:[t.jsx("span",{className:"atCustomFieldKey",children:N("lt_custom_label")}),t.jsx("input",{id:"custom-count",name:"customCount",type:"number",min:1,max:999,disabled:s,value:u,onChange:z,placeholder:"—",className:"atCustomFieldInput","aria-label":N("lt_custom_label"),autoComplete:"off"})]})]})]}),t.jsxs("div",{className:"atIntervalRow",children:[t.jsx("span",{className:"atIntervalLabel",children:N("lt_auto_interval")}),t.jsx("span",{className:"atIntervalValue",children:Nn(a)})]}),s?t.jsxs("button",{type:"button",onClick:n,className:"atStopBtn",children:[t.jsx(zr,{size:12,fill:"currentColor",strokeWidth:0}),t.jsx("span",{children:N("lt_auto_stop")})]}):t.jsxs("button",{type:"button",onClick:k,className:`atStartBtn ${se}`,children:[t.jsx(Fs,{size:13,strokeWidth:2.25}),t.jsxs("span",{children:[N("lt_auto_start")," · ",Q," ",K]})]})]})]})}const kn=r.memo(Ra);function La({open:s,onClose:e,children:n}){const a=$e(),o=r.useCallback(()=>e(),[e]),l=r.useCallback(i=>{i.stopPropagation()},[]);return r.useEffect(()=>{if(!s)return;const i=m=>{m.key==="Escape"&&e()};document.addEventListener("keydown",i);const c=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",i),document.body.style.overflow=c}},[s,e]),s?t.jsx("div",{className:"atmBackdrop",onClick:o,role:"presentation",children:t.jsx("div",{className:"atmSheet",role:"dialog","aria-modal":"true","aria-label":a("lt_auto_title"),onClick:l,children:n})}):null}const Aa=r.memo(La),Ta=15,Ma=42,Da=18,Ba=90;function Ia({bet:s,t:e}){const n=Ks(s.assetKey),a=s.result==="WIN",o=s.result==="REFUND",l=a?s.payoutAmount-s.amount:o?0:-s.amount,i=s.direction==="UP"?"tickerDirUp":"tickerDirDown",c=a?"tickerResWin":o?"tickerResRefund":"tickerResLose",m=l>0?"tickerProfitPos":l<0?"tickerProfitNeg":"tickerProfitZero",d=l>0?"+":l<0?"−":"±",y=e(a?"lt_settlements_win":o?"lt_settlements_refund":"lt_settlements_lose");return t.jsxs("div",{className:"tickerCard",children:[t.jsx("span",{className:`tickerDirIcon ${i}`,"aria-hidden":"true",children:s.direction==="UP"?t.jsx(ps,{size:11,strokeWidth:2.25}):t.jsx(hs,{size:11,strokeWidth:2.25})}),t.jsx("span",{className:"tickerAsset",children:s.assetKey}),t.jsx("span",{className:"tickerTf",children:Lr(s.timeframe)}),t.jsxs("span",{className:"tickerPrices",children:[n.prefix,ms(s.openPrice,n.decimals),s.closePrice!==null&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"tickerArrow","aria-hidden":"true",children:"→"}),n.prefix,ms(s.closePrice,n.decimals)]})]}),t.jsx("span",{className:`tickerResult ${c}`,children:y}),t.jsxs("span",{className:`tickerProfit ${m}`,children:[d,Math.abs(l).toFixed(2)," G"]})]})}const Pa=r.memo(Ia);function $a({items:s,t:e,ariaHidden:n}){return t.jsx("div",{className:"tickerLane","aria-hidden":n||void 0,children:s.map(a=>t.jsx(Pa,{bet:a.bet,t:e},a.key))})}const vn=r.memo($a);function Fa({items:s}){const e=$e(),n=r.useRef(null),a=r.useMemo(()=>{const l=[];for(const i of s){if(l.length>=Ta)break;i.bet.openPrice>0&&i.bet.assetKey!=="?"&&l.push(i)}return l}
1,[s]),o=a.map(l=>l.key).join("|");return r.useLayoutEffect(()=>{const l=n.current;if(!l)return;const i=l.querySelector(".tickerLane");if(!i)return;const c=()=>{const d=i.scrollWidth;if(d<=0)return;const y=d/Ma,u=Math.max(Da,Math.min(Ba,y));l.style.setProperty("--ticker-duration",`${u.toFixed(2)}s`)};if(c(),typeof ResizeObserver>"u")return;const m=new ResizeObserver(c);return m.observe(i),()=>m.disconnect()},[o]),r.useEffect(()=>{const l=n.current;if(!l)return;const i=typeof document<"u"&&document.dir==="rtl";l.classList.toggle("isRtl",i)},[]),a.length===0?null:t.jsx("div",{ref:n,className:"settlementTicker","aria-label":e("lt_settlements_aria"),children:t.jsxs("div",{className:"tickerInner",children:[t.jsxs("div",{className:"tickerLabelPill",children:[t.jsxs("span",{className:"tickerLiveDot","aria-hidden":"true",children:[t.jsx("span",{className:"tickerLiveDotPing"}),t.jsx("span",{className:"tickerLiveDotCore"})]}),t.jsx("span",{className:"tickerLiveLabel",children:e("lt_settlements_live")})]}),t.jsxs("div",{className:"tickerScrollWrap",children:[t.jsx("div",{className:"tickerFadeStart"}),t.jsx("div",{className:"tickerFadeEnd"}),t.jsxs("div",{className:"tickerTrack",children:[t.jsx(vn,{items:a,t:e}),t.jsx(vn,{items:a,t:e,ariaHidden:!0})]})]})]})})}const Oa=r.memo(Fa),Cn=-1,Dt={sec:1,min:60,hr:3600},Ua=["sec","min","hr"];function Ts(s){return s>=Dt.hr?"hr":s>=Dt.min?"min":"sec"}function as(s,e){if(e==="sec")return String(Math.round(s));const n=s/Dt[e];return parseFloat(n.toFixed(2)).toString()}function Ms(s){const e=Math.max(0,Math.round(s)),n=Math.floor(e/3600),a=Math.floor(e%3600/60),o=e%60,l=i=>i.toString().padStart(2,"0");return n>0?`${l(n)}:${l(a)}:${l(o)}`:`${l(a)}:${l(o)}`}function wn(s,e){const n=s.trim();if(n==="")return null;if(n.includes(":")){const o=n.split(":").map(c=>c.trim());if(o.length<2||o.length>3||!o.every(c=>/^\d+$/.test(c)))return null;const l=o.map(Number);let i=0;if(l.length===3){const[c,m,d]=l;if(m>=60||d>=60)return null;i=c*3600+m*60+d}else{const[c,m]=l;if(m>=60)return null;i=c*60+m}return!Number.isFinite(i)||i<0?null:{seconds:i,mode:"composite"}}const a=Number(n);return!Number.isFinite(a)||a<0?null:{seconds:Math.round(a*Dt[e]),mode:"unit"}}const Ka=/[0-9.:]/;function Wa(s){return e=>{if(e.ctrlKey||e.metaKey||e.altKey||e.key.length!==1)return;if(!Ka.test(e.key)){e.preventDefault();return}const n=e.currentTarget.value??"";if(e.key==="."){(!s||n.includes(".")||n.includes(":"))&&e.preventDefault();return}e.key===":"&&((n.match(/:/g)??[]).length>=2||n.includes("."))&&e.preventDefault()}}function Ha(s){if(s<60)return`${s}s`;const e=s/60;return`${parseFloat(e.toFixed(2))}m`}function os(s){const e=Math.max(0,Math.round(s));if(e<60)return`${e}s`;const n=Math.floor(e/3600),a=Math.floor(e%3600/60),o=e%60;let l="";return n>0&&(l+=`${n}h`),a>0&&(l+=`${a}m`),o>0&&(l+=`${o}s`),l||`${e}s`}function Va({index:s,seconds:e,multiplier:n,selected:a,disabled:o,openBets:l,onSelect:i}){const c=r.useCallback(()=>{o||i(s)},[o,i,s]);return t.jsxs("button",{type:"button",onClick:c,disabled:o,className:`tfBtn ${a?"isSelected":""}`,"aria-pressed":a,children:[t.jsx("span",{className:"tfBtnDur",children:Ha(e)}),t.jsxs("span",{className:"tfBtnMult",children:[n.toFixed(2),"×"]}),l>0&&t.jsx("span",{className:"tfBtnBadge","aria-label":`${l} open bet${l===1?"":"s"}`,children:l>99?"99+":l})]})}const za=r.memo(Va);function Ga({timeframes:s,customTf:e,safeIdx:n,isCustomSelected:a,customSeconds:o,onSelectTimeframe:l,onSelectCustom:i,onChangeCustomSeconds:c,isPlacing:m,minBet:d,maxBet:y,showCurrentTfMeta:u,onInteract:_,openBetCounts:S,customOpenBetCount:p=0}){const b=$e(),$=!!e?.enabled,N=u&&d>0&&y>0,B=r.useCallback(()=>{m||i()},[m,i]);return t.jsxs("section",{className:"tfPanel","aria-label":b("lt_panel_timeframes"),children:[t.jsxs("header",{className:"tfHead",children:[t.jsx("span",{className:"tfTitle",children:b("lt_section_timeframe")}),N&&t.jsxs("span",{className:"tfRange",children:[t.jsxs("span",{className:"tfRangeChip",children:[t.jsx("span",{className:"tfRangeKey",children:b("lt_preset_min")}
1),t.jsx("span",{className:"tfRangeNum",children:d.toLocaleString()}),t.jsx("span",{className:"tfRangeUnit",children:"G"})]}),t.jsx("span",{className:"tfRangeSep","aria-hidden":"true",children:"–"}),t.jsxs("span",{className:"tfRangeChip",children:[t.jsx("span",{className:"tfRangeKey",children:b("lt_preset_max")}),t.jsx("span",{className:"tfRangeNum",children:y.toLocaleString()}),t.jsx("span",{className:"tfRangeUnit",children:"G"})]})]})]}),s.length===0&&!e?t.jsx("div",{className:"tfEmpty",children:b("lt_no_timeframes")}):t.jsxs("div",{className:"tfBar",children:[s.map((R,E)=>t.jsx(za,{index:E,seconds:R.seconds,multiplier:R.multiplier,selected:!a&&n===E,disabled:m,openBets:S?.get(R.seconds)??0,onSelect:l},R.seconds)),$&&e&&t.jsxs("button",{type:"button",onClick:B,disabled:m,className:`tfBtnCustom ${a?"isSelected":""}`,"aria-pressed":a,children:[t.jsx("span",{className:"tfBtnCustomLabel",children:b("lt_custom_label")}),t.jsxs("span",{className:"tfBtnCustomMult",children:[e.multiplier.toFixed(2),"×"]}),p>0&&t.jsx("span",{className:"tfBtnBadge","aria-label":`${p} open custom bet${p===1?"":"s"}`,children:p>99?"99+":p})]})]}),a&&e&&t.jsx(Xa,{customTf:e,customSeconds:o,onChangeCustomSeconds:c,isPlacing:m,onInteract:_})]})}const qa=r.memo(Ga);function Ya({customTf:s,customSeconds:e,onChangeCustomSeconds:n,isPlacing:a,onInteract:o}){const l=$e(),i=e??s.minSeconds,{minSeconds:c,maxSeconds:m}=s,[d,y]=r.useState(()=>Ts(i)),[u,_]=r.useState(!1),[S,p]=r.useState(!0);r.useEffect(()=>{S&&!u&&y(Ts(i))},[i,S,u]);const[b,$]=r.useState(!1),N=r.useRef(null),B=r.useRef(i),[R,E]=r.useState(()=>as(i,Ts(i)));r.useEffect(()=>{b||E(u?Ms(i):as(i,d))},[i,d,u,b]);const U=r.useMemo(()=>Ua.filter(v=>Dt[v]<=m),[m]),V=r.useCallback(v=>{a||(o?.(),_(!1),y(v),p(!1))},[a,o]),le=r.useCallback(()=>{a||(o?.(),_(!0),p(!1))},[a,o]),Q=r.useCallback(v=>{const M=Math.max(c,Math.min(m,Math.round(v)));n(M)},[c,m,n]),X=r.useCallback(v=>{const M=v.target.value,z=d!=="sec";let K=M.replace(/[^0-9.:]/g,"");const ce=K.includes(":");if(ce){K=K.replace(/\./g,"");const je=K.split(":");je.length>3&&(K=je.slice(0,3).join(":"))}else u?K=K.replace(/\./g,""):z?K=K.replace(/(\..*)\./g,"$1"):K=K.replace(/\./g,"");E(K),ce&&!u&&_(!0);const L=wn(K,d);if(!L)return;if(u||ce){L.mode==="composite"&&Q(L.seconds);return}L.mode==="unit"&&Q(L.seconds)},[d,u,Q]),I=r.useCallback(v=>{if(a)return;if(v.key==="Escape"){v.preventDefault(),Q(B.current),N.current?.blur();return}if(v.key==="Enter"){v.preventDefault(),N.current?.blur();return}if(v.key!=="ArrowUp"&&v.key!=="ArrowDown"){Wa(d!=="sec")(v);return}v.preventDefault();const M=v.key==="ArrowUp"?1:-1,z=v.altKey||v.metaKey||v.ctrlKey;let K;u?K=z?60:1:(K=Dt[d],z&&(K*=60)),v.shiftKey&&(K*=10);const ce=i+M*K,L=Math.max(c,Math.min(m,Math.round(ce)));Q(L),E(u?Ms(L):as(L,d))},[a,d,u,i,Q,c,m]),se=r.useCallback(()=>{if(a)return;o?.(),B.current=i,$(!0);const v=N.current;v&&requestAnimationFrame(()=>v.select?.())},[a,o,i]),ee=r.useCallback(()=>{$(!1),E(u?Ms(i):as(i,d))},[i,d,u]),k=r.useMemo(()=>{const v=R.trim();if(!v)return"ok";const M=wn(v,d);return M?M.seconds<c?"below":M.seconds>m?"above":"ok":"ok"},[R,d,c,m]);return t.jsxs("div",{className:"tfCustom",children:[t.jsxs("div",{className:"tfCustomRow",children:[t.jsxs("div",{className:"tfCustomUnitSeg",role:"group","aria-label":l("lt_custom_change_unit"),children:[U.map(v=>t.jsx("button",{type:"button",onClick:()=>V(v),disabled:a,className:`tfCustomUnitBtn ${!u&&v===d?"isSelected":""}`,"aria-pressed":!u&&v===d,children:l(`lt_custom_unit_${v}`)},v)),t.jsx("button",{type:"button",onClick:le,disabled:a,className:`tfCustomUnitBtn tfCustomUnitBtnComposite ${u?"isSelected":""}`,"aria-pressed":u,"aria-label":l("lt_custom_unit_composite_aria"),title:l("lt_custom_unit_composite_aria"),children:"h:m:s"})]}),t.jsx("input",{ref:N,id:"custom-duration",name:"customSeconds",type:"text",inputMode:u?"text":d==="sec"?"numeric":"decimal",value:R,onChange:X,onFocus:se,onBlur:ee,onKeyDown:I,disabled:a,className:"tfCustomInput","aria-label":l("lt_custom_duration"),"aria-describedby":"custom-duration-range","aria-invalid":k!=="ok",placeholder:u?"HH:MM:SS  e.g. 01:25:10":`${l(`lt_custom_unit_${d}`)}  ·  01:25:10`,autoComplete:"off",spellCheck:!1})]}),t.jsx("div",{id:"custom-duration-range",className:`tfCustomMeta ${k!=="ok"?"isWarn":""}`,role:k!=="ok"?"status":void 0,"aria-live":k!=="ok"?"polite":void 0,children:k==="below"?t.jsx("span",{className:"tfCustomMetaWarn",children:l("lt_custom_below_min",{min:os(c)})}):k==="above"?t.jsx("span",{className:"tfCustomMetaWarn",children:l("lt_custom_above_max",{max:os(m)})}):t.jsxs("span",{className:"tfCustomMetaRange",children:[t.jsx("span",{className:"tfCustomMetaKey",children:l("lt_custom_range_label")}),t.jsxs("span",{className:"tfCustomMetaValue",children:[os(c)," – ",os(m)]})]})})]})}
1const Xa=r.memo(Ya),Ds="All",Za="Crypto";function Qa({asset:s,index:e,isSelected:n,isPlacing:a,onSelect:o}){const l=$e(),i=Ks(s.assetKey,s.iconUrl),c=s.marketClosed,m=r.useCallback(()=>{c||o(e)},[o,e,c]),d=c?`${i.label} — ${l("lt_market_closed_title")}`:i.label,y=["mbItem"];return n&&y.push("isSelected"),c&&y.push("isClosed"),t.jsxs("button",{type:"button",role:"tab","aria-selected":n,"aria-disabled":c||void 0,onClick:m,disabled:a||c,title:d,className:y.join(" "),children:[i.icon?t.jsx("img",{src:i.icon,alt:"",className:"mbIcon",loading:"lazy",decoding:"async",width:20,height:20}):null,t.jsx("span",{className:"mbKey",children:i.displayKey}),c?t.jsx("span",{className:"mbClosedLabel","aria-hidden":"true",children:l("lt_market_closed")}):null]})}const Ja=r.memo(Qa);function Bs(s,e){const n=`lt_category_${s.toLowerCase()}`,a=e(n);return a===n?s:a}function eo({assets:s,effectiveAssetIdx:e,onSelectAsset:n,isPlacing:a,onInteract:o}){const l=$e(),i=r.useId(),c=r.useMemo(()=>{const p=Array.from(new Set(s.map(b=>b.category).filter(Boolean))).sort();return[Ds,...p]},[s]),[m,d]=r.useState(Za),y=r.useRef(null);r.useEffect(()=>{const p=s[e];!p||y.current===p.assetKey||(y.current=p.assetKey,p.category&&c.includes(p.category)&&d(p.category))},[s,c,e]);const u=c.includes(m)?m:Ds,_=r.useMemo(()=>u===Ds?s:s.filter(p=>p.category===u),[s,u]),S=r.useCallback(p=>{o?.(),d(p.target.value)},[o]);return t.jsxs("div",{className:"mbWrap",children:[t.jsx("div",{className:"mbCats",role:"tablist","aria-label":l("lt_panel_assets"),children:c.map(p=>{const b=p===u;return t.jsx("button",{type:"button",role:"tab","aria-selected":b,onClick:()=>{o?.(),d(p)},className:`mbCat ${b?"isSelected":""}`,children:Bs(p,l)},p)})}),t.jsxs("label",{className:"mbCatsSelect",children:[t.jsx("span",{className:"mbCatsSelectLabel",children:Bs(u,l)}),t.jsx(Ws,{size:14,className:"mbCatsSelectIcon","aria-hidden":"true"}),t.jsx("select",{id:i,value:u,onChange:S,"aria-label":l("lt_panel_assets"),className:"mbCatsSelectInput",children:c.map(p=>t.jsx("option",{value:p,children:Bs(p,l)},p))})]}),t.jsx("nav",{className:"mbBar","aria-label":l("lt_panel_assets"),role:"tablist",children:_.map(p=>{const b=s.indexOf(p);return t.jsx(Ja,{asset:p,index:b,isSelected:e===b,isPlacing:a,onSelect:n},p.assetKey)})})]})}const to=r.memo(eo),so=()=>{if(typeof window>"u")return!1;try{return window.matchMedia("(pointer: coarse)").matches||navigator.maxTouchPoints>0}catch{return!1}};function jn(){if(!(typeof navigator>"u")&&typeof navigator.vibrate=="function"&&so())try{navigator.vibrate(12)}catch{}}const no="(max-width: 600px)",Gt=typeof window<"u"?window.matchMedia(no):null,Us=new Set;if(Gt){const s=e=>{Us.forEach(n=>n(e.matches))};typeof Gt.addEventListener=="function"&&Gt.addEventListener("change",s)}function Xn(){const[s,e]=r.useState(()=>Gt?.matches??!1);return r.useEffect(()=>(Us.add(e),e(Gt?.matches??!1),()=>{Us.delete(e)}),[]),s}function ro(s){return s.toFixed(2).replace(/\.?0+$/,"")}function ao(s){const e=s.replace(/[^0-9.]/g,""),n=e.split(".");return n.length>2?`${n[0]}.${n.slice(1).join("")}`:e}function oo(s){return s>0?s:1}function lo({betAmount:s,onChangeAmount:e,minBet:n,maxBet:a,payoutMultiplier:o=null,placingDir:l,autoActive:i,canPlace:c,onPlace:m,onInteract:d,onPreviewDirection:y}){const u=$e(),_=Xn(),[S,p]=r.useState(null),b=r.useRef(null),$=r.useCallback(A=>{b.current&&clearTimeout(b.current),p(A),b.current=setTimeout(()=>p(null),220)},[]);r.useEffect(()=>()=>{b.current&&clearTimeout(b.current)},[]);const N=parseFloat(s)||0,B=s!==""&&n>0&&N<n,R=s!==""&&a>0&&N>a,E=B||R,U=l==="UP",V=l==="DOWN",le=!c||l!==null||i||E,Q=l!==null||i,X=!Q&&(s===""||N>(n>0?n:0)),I=!Q&&(a<=0||N<a),se=o&&o>0?`${o.toFixed(2)}x`:null,ee=r.useCallback(A=>{e(ao(A.target.value))},[e]),k=r.useCallback(A=>{d?.();const ne=oo(n),re=N>0?N:Math.max(n,0),ke=A>0&&N<=0?re:re+A*ne,he=n>0?n:0,Ee=a>0?a:Number.POSITIVE_INFINITY,Qe=Math.max(he,Math.min(Ee,ke));e(ro(Qe))},[a,n,N,e,d]),v=r.useCallback(()=>k(-1),[k]),M=r.useCallback(()=>k(1),[k]),z=r.useCallback(A=>{if(A.key==="-"||A.key==="e"||A.key==="E"){A.preventDefault();return}A.key==="ArrowUp"&&(A.preventDefault(),k(1)),A.key==="ArrowDown"&&(A.preventDefault(),k(-1))},[k]),K=r.useCallback(()=>{d?.(),e(String(n))},[n,e,d]),ce=r.useCallback(()=>{d?.(),e(String(a))},[a,e,d]),L=r.useCallback(()=>{jn(),d?.(),m("UP")},[d,m]),we=r.useCallback(()=>
1{jn(),d?.(),m("DOWN")},[d,m]),je=r.useCallback(()=>{le||y?.("UP")},[le,y]),De=r.useCallback(()=>{le||y?.("DOWN")},[le,y]),Ge=r.useCallback(()=>y?.(null),[y]);r.useEffect(()=>{if(_)return;const A=ne=>{if(ne.metaKey||ne.ctrlKey||ne.altKey||ne.shiftKey)return;const re=document.activeElement;if(re){const ke=re.tagName;if(ke==="INPUT"||ke==="TEXTAREA"||ke==="SELECT"||re.isContentEditable)return}switch(ne.key){case"ArrowLeft":!Q&&X&&(ne.preventDefault(),$("left"),v());break;case"ArrowRight":!Q&&I&&(ne.preventDefault(),$("right"),M());break;case"ArrowUp":le||(ne.preventDefault(),$("up"),L());break;case"ArrowDown":le||(ne.preventDefault(),$("down"),we());break}};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[_,Q,X,I,le,v,M,L,we,$]);const ue=B?u("lt_bet_amount_min_hint",{min:n.toLocaleString()}):R?u("lt_bet_amount_max_hint",{max:a.toLocaleString()}):null;return t.jsxs("section",{className:"bpPanel",children:[t.jsx("label",{htmlFor:"bet-amount",className:"bpTitle",children:u("lt_section_bet_amount")}),t.jsxs("div",{className:`bpInputBlock ${E?"isInvalid":""}`,children:[t.jsxs("div",{className:"bpQuickRow",children:[n>0&&t.jsx("button",{type:"button",onClick:K,className:"bpQuickLink bpQuickMin",children:u("lt_preset_min")}),a>0&&t.jsx("button",{type:"button",onClick:ce,className:"bpQuickLink bpQuickMax",children:u("lt_preset_max")})]}),t.jsx("button",{type:"button",onClick:v,disabled:!X,className:`bpAmountStep bpAmountStepMinus${S==="left"?" isKbdHit":""}`,"aria-label":u("lt_bet_amount_decrease"),"aria-keyshortcuts":"ArrowLeft",title:u("lt_bet_amount_decrease"),children:t.jsx(Gr,{size:13,strokeWidth:2.4})}),t.jsxs("div",{className:"bpInputWrap",children:[t.jsx("input",{id:"bet-amount",name:"betAmount",type:"text",inputMode:"decimal",value:s,onChange:ee,onKeyDown:z,placeholder:n>0?String(n):"0",className:"bpInput",autoComplete:"off","aria-invalid":E||void 0,"aria-describedby":ue?"bet-amount-hint":void 0}),t.jsx("span",{className:"bpInputUnit","aria-hidden":"true",children:"G"})]}),t.jsx("button",{type:"button",onClick:M,disabled:!I,className:`bpAmountStep bpAmountStepPlus${S==="right"?" isKbdHit":""}`,"aria-label":u("lt_bet_amount_increase"),"aria-keyshortcuts":"ArrowRight",title:u("lt_bet_amount_increase"),children:t.jsx(qr,{size:13,strokeWidth:2.4})})]}),ue&&t.jsx("p",{id:"bet-amount-hint",className:"bpInputHint",role:"alert",children:ue}),t.jsxs("div",{className:"bpActions",children:[t.jsxs("button",{type:"button",onClick:L,onMouseEnter:_?void 0:je,onMouseLeave:_?void 0:Ge,onFocus:_?void 0:je,onBlur:_?void 0:Ge,disabled:le,className:`bpBtn bpBtnUp${S==="up"?" isKbdHit":""}`,"aria-label":u("lt_bet_btn_up"),"aria-keyshortcuts":"ArrowUp",children:[U?t.jsx(bs,{size:14,className:"bpSpin"}):t.jsx(ps,{size:14,strokeWidth:2.25}),se&&t.jsx("span",{className:"bpBtnPayout",children:se}),t.jsx("span",{className:"bpBtnLabel",children:u(U?"lt_placing":"lt_bet_btn_up")})]}),t.jsxs("button",{type:"button",onClick:we,onMouseEnter:_?void 0:De,onMouseLeave:_?void 0:Ge,onFocus:_?void 0:De,onBlur:_?void 0:Ge,disabled:le,className:`bpBtn bpBtnDown${S==="down"?" isKbdHit":""}`,"aria-label":u("lt_bet_btn_down"),"aria-keyshortcuts":"ArrowDown",children:[V?t.jsx(bs,{size:14,className:"bpSpin"}):t.jsx(hs,{size:14,strokeWidth:2.25}),se&&t.jsx("span",{className:"bpBtnPayout",children:se}),t.jsx("span",{className:"bpBtnLabel",children:u(V?"lt_placing":"lt_bet_btn_down")})]})]}),!_&&t.jsxs("div",{className:"bpShortcutBar","aria-hidden":"true",children:[t.jsxs("div",{className:"bpShortcutHeading",children:[t.jsx(Yr,{size:11,strokeWidth:2.4}),t.jsx("span",{children:u("lt_kbd_shortcuts_heading")})]}),t.jsxs("div",{className:"bpShortcutRow",children:[t.jsxs("div",{className:"bpShortcutGroup",children:[t.jsx("span",{className:"bpShortcutLabel",children:u("lt_kbd_amount_label")}),t.jsxs("div",{className:"bpShortcutKeys",children:[t.jsx("kbd",{className:`bpKbd${S==="left"?" isHit":""}`,children:"←"}),t.jsx("kbd",{className:`bpKbd${S==="right"?" isHit":""}`,children:"→"})]})]}),t.jsx("span",{className:"bpShortcutDivider"}),t.jsxs("div",{className:"bpShortcutGroup",children:[t.jsx("span",{className:"bpShortcutLabel",children:u("lt_kbd_trade_label")}),t.jsxs("div",{className:"bpShortcutKeys",children:[t.jsx("kbd",{className:`bpKbd bpKbdUp${S==="up"?" isHit":""}`,children:"↑"}),t.jsx("kbd",{className:`bpKbd bpKbdDown${S==="down"?" isHit":""}`,children:"↓"})]})]})]})]})]})}const io=r.memo(lo),En=s=>`${s.slice(0,6)}…${s.slice(-4)}`;function co({className:s=""}){const e=$e();return t.jsxs("footer",{className:`bfFootnote ${s}`.trim(),children:[t.jsxs("span",{className:"bfItem",children:[e("lt_footer_contract"),t.jsxs("a",{href:`https://explorer.playblock.io/address/${us}`,target:"_blank",rel:"noopener noreferrer",className:"bfLink",title:us,children:[En(us),t.jsx(bn,{size:11})]})]}),t.jsx("span",{className:"bfDot","aria-hidden":"true",children:"•"}),t.jsxs("span",{className:"bfItem",children:[e("lt_footer_treasury"),t.jsxs("a",{href:`https://explorer.playblock.io/address/${Es}`,target:"_blank",rel:"noopener noreferrer",className:"bfLink",title:Es,children:[En(Es),t.jsx(bn,{size:11})]})]})]})}const uo=r.memo(co);
1function Wt(s){return s.toLocaleString("en-US",{maximumFractionDigits:0})}function fo(s,e){const n=s>0?s:dn.RED.max,a=e>0?e:dn.YELLOW.max;return{redCap:n,yellowCap:a}}function Is(s,e,n,a){return s==="RED"?e("lt_traffic_range_between",{min:Wt(0),max:Wt(n)}):s==="YELLOW"?e("lt_traffic_range_between",{min:Wt(n+1),max:Wt(a)}):e("lt_traffic_range_above",{min:Wt(a+1)})}const Zn=272,ls=8,Ht=12,mo=(s,e,n)=>{const{redCap:a,yellowCap:o}=fo(e,n);return{GREEN:{short:s("lt_traffic_green"),description:s("lt_traffic_green_desc"),range:Is("GREEN",s,a,o),cls:"tierTextGreen"},YELLOW:{short:s("lt_traffic_yellow"),description:s("lt_traffic_yellow_desc"),range:Is("YELLOW",s,a,o),cls:"tierTextYellow"},RED:{short:s("lt_traffic_red"),description:s("lt_traffic_red_desc"),range:Is("RED",s,a,o),cls:"tierTextRed"}}};function po(s,e){const n=window.innerWidth,a=window.innerHeight,o=Math.min(Zn,n-Ht*2),l=a-s.bottom-ls-Ht,i=s.top-ls-Ht,c=l>=e||l>=i?"below":"above",m=c==="below"?s.bottom+ls:s.top-ls-e;let d=s.right-o;const y=Ht,u=n-Ht-o;return d<y&&(d=y),d>u&&(d=u),{top:m,left:d,width:o,placement:c}}function ho({tier:s,redMaxBalance:e=0,yellowMaxBalance:n=0}){const a=$e(),[o,l]=r.useState(!1),i=r.useMemo(()=>mo(a,e,n),[a,e,n]),c=i[s],m=`${a("lt_traffic_title")}: ${c.short}`,d=r.useRef(null),y=r.useRef(null),[u,_]=r.useState(null),S=r.useCallback(()=>l(!0),[]),p=r.useCallback(()=>{l(!1),_(null)},[]),b=r.useCallback(()=>{const R=d.current,E=y.current;if(!R||!E)return;const U=R.getBoundingClientRect(),V=E.offsetHeight;_(po(U,V))},[]);r.useLayoutEffect(()=>{o&&b()},[o,b]),r.useEffect(()=>{if(!o)return;const R=()=>b(),E={capture:!0,passive:!0},U={passive:!0};return window.addEventListener("scroll",R,E),window.addEventListener("resize",R,U),()=>{window.removeEventListener("scroll",R,E),window.removeEventListener("resize",R,U)}},[o,b]);const $=["RED","YELLOW","GREEN"],N=u?{position:"fixed",top:`${u.top}px`,left:`${u.left}px`,width:`${u.width}px`}:{position:"fixed",top:0,left:0,width:`${Zn}px`,visibility:"hidden"},B=o&&typeof document<"u"?Nr.createPortal(t.jsxs("div",{ref:y,className:"trafficLightTooltip",role:"tooltip",style:N,"data-placement":u?.placement??"below",children:[t.jsx("p",{className:"tlTooltipTitle",children:a("lt_traffic_title")}),t.jsx("p",{className:"tlTooltipBody",children:a("lt_traffic_desc")}),t.jsx("div",{className:"tlTooltipDivider",children:$.map(R=>{const E=i[R],U=R===s;return t.jsxs("div",{className:`tlTooltipRow ${U?"isActive":""}`,children:[t.jsx("span",{className:`tlMiniDot tlDot-${R.toLowerCase()} ${U?"isActive":""}`}),t.jsxs("div",{className:"tlMiniBlock",children:[t.jsxs("span",{className:`tlMiniTitle ${E.cls}`,children:[E.short,U&&t.jsxs("span",{className:"tlMiniCurrent",children:[" — ",a("lt_traffic_current")]})]}),t.jsx("span",{className:"tlMiniRange",children:E.range}),t.jsx("span",{className:"tlMiniDesc",children:E.description})]})]},R)})})]}),document.body):null;return t.jsxs("div",{ref:d,className:"trafficLight",onMouseEnter:S,onMouseLeave:p,onFocus:S,onBlur:p,children:[t.jsxs("button",{type:"button",className:"tlBar","aria-label":m,title:c.short,children:[$.map(R=>t.jsx("span",{className:`tlLamp tlLamp-${R.toLowerCase()} ${R===s?"isActive":""}`,"aria-hidden":"true"},R)),t.jsx("span",{className:"tlInfoIcon","aria-hidden":"true",children:t.jsx(Xr,{size:10,strokeWidth:2.4})})]}),B]})}const bo=r.memo(ho);function xo(s){if(s.length===0)return[];const e=new Array(s.length),n=s[0];e[0]={time:n.time,open:(n.open+n.close)/2,close:(n.open+n.high+n.low+n.close)/4,high:n.high,low:n.low};for(let a=1;a<s.length;a++){const o=s[a],l=e[a-1],i=(o.open+o.high+o.low+o.close)/4,c=(l.open+l.close)/2,m=Math.max(o.high,c,i),d=Math.min(o.low,c,i);e[a]={time:o.time,open:c,high:m,low:d,close:i}}return e}const Qn=3e3,Rn=3e4,go=.42,yo=140,_o=560,So=280,No=1e-9,rt=5,Vs=3,zs=75,ko=420,vo=14,Co=48,wo=.18,Ln=168,jo=36,Eo=3,Ps=56,Ro=16;function Lo(s){const e=new Map;for(let n=0;n<s.length;n++)e.set(Number((s[n].time/1e3).toFixed(3)),s[n].price);return Array.from(e.entries()).sort((n,a)=>n[0]-a[0]).map(([n,a])=>({time:n,value:a}))}function Ao(s){const e=new Map;for(let n=0;n<s.length;n++){const a=s[n],o=Math.floor(a.time/1e3);e.set(o,{time:o,open:a.open,high:a.high,low:a.low,close:a.close})}return Array.from(e.values()).sort((n,a)=>n.time-a.time)}function An(s,e){const n=new Date(s*1e3),a=n.getHours().toString().padStart(2,"0"),o=n.getMinutes().toString().padStart(2,"0"),l=n.getSeconds();return e>=5?`${a}:${o}`:l===0?`${a}:${o}`:`:${l.toString().padStart(2,"0")}`}function Tn(s,e){const n=new Intl.NumberFormat("en-US",{minimumFractionDigits:s,maximumFractionDigits:s});return a=>`${e}${n.format(a)}`}function is(s){if(typeof s!="number"||!Number.isFinite(s))return"0";const e=Math.abs(s);return e>=1e6?`${(s/1e6).toFixed(2)}M`:e>=1e3?`${(s/1e3).toFixed(2)}K`:e>=100?s.toFixed(0):s.toFixed(2)}function Jn(s,e){return s.price>0&&(!s.expiresAt||s.expiresAt>e)}function To(s,e,n){if(!e)return null;const a=s.find(o=>o.betId&&String(o.betId)===e);return a&&Jn(a,n)?a:null}function Mo(s){return s.filter(e=>e.price>0).map(e=>`${e.betId??e.time}:${e.price}`).sort().join("|")}function er(s,e){if(s.length===0)return null;let n=0,a=s.length-1;for(;n<a;){const i=Math.floor((n+a)/2);s[i]<e?n=i+1:a=i}const o=s[n],l=n>0?s[n-1]:o;return Math.abs(l-e)<=Math.abs(o-e)?l:o}function cs(s,e,n){const a=s.timeScale().timeToCoordinate(e);if(a!==null)return a;const o=er(n,e);return o===null?null:s.timeScale().timeToCoordinate(o)}function Ne(s,e,n){return Math.min(Math.max(s,e),Math.max(e,n))}function tr(s,e){let n=null;const a=[];for(let o=e.length-1;o>=0;o--){const l=e[o],i=s.timeScale().timeToCoordinate(l);if(!(i===null||!Number.isFinite(i))){if(n){const c=n.time-l,m=n.coordinate-i;if(c>.01&&Math.abs(m)>.01&&a.push(Math.abs(m/c)),a.length>=12)break}n={time:l,coordinate:i}}}return a.length===0?null:(a.sort((o,l)=>o-l),a[Math.floor(a.length/2)])}function Mn(s,e){if(s.length===0||!Number.isFinite(e))return null;const n=Gs(s),a=s.length-1;if(e<=0)return s[0]+e*n;if(e>=a)return s[a]+(e-a)*n;const o=Math.floor(e),l=Math.ceil(e),i=s[o],c=s[l];return!Number.isFinite(i)||!Number.isFinite(c)?null:o===l?i:i+(c-i)*(e-o)}function sr(s,e,n){if(n<=0)return null;const a=s.timeScale().coordinateToLogical(0),o=s.timeScale().coordinateToLogical(n);if(a===null||o===null)return null;const l=Mn(e,Number(a)),i=Mn(e,Number(o));if(l===null||i===null)return null;const c=i-l;return c>0?n/c:null}function Do(s,e,n,a,o,l){const i=a/1e3,c=Math.max(0,i-n);if(c===0)return e;const m=sr(s,o,l)??tr(s,o);if(m!==null&&Number.isFinite(m)&&m>0)return e+c*m;
1const d=s.timeScale().timeToCoordinate(i);if(d!==null&&Number.isFinite(d)&&d>e)return d;const y=Gs(o),u=s.timeScale().coordinateToLogical(e);if(u!==null&&Number.isFinite(u)&&y>0){const _=s.timeScale().logicalToCoordinate(Number(u)+c/y);if(_!==null&&Number.isFinite(_))return _}return null}function Dn(s,e,n,a){const o=s.timeScale().timeToCoordinate(e);if(o!==null&&Number.isFinite(o))return o;if(n.length===0)return null;const l=n[n.length-1],i=s.timeScale().timeToCoordinate(l);if(e>l&&i!==null&&Number.isFinite(i)){const m=sr(s,n,a)??tr(s,n);if(m!==null&&Number.isFinite(m)&&m>0)return i+(e-l)*m}const c=er(n,e);return c===null?null:s.timeScale().timeToCoordinate(c)}function Bo(s,e){const n=Math.max(1,Math.ceil((s-e)/1e3));if(n<60)return`${n}s`;const a=Math.floor(n/60),o=n%60;return o===0?`${a}m`:`${a}m ${o}s`}function Io(s,e){if(e===null||!Number.isFinite(e))return rt;let n=rt;for(let a=0;a<s.length;a++){const o=s[a];if(o.price<=0||typeof o.expiresAt!="number"||!Number.isFinite(o.expiresAt))continue;const l=o.time/1e3,i=o.expiresAt/1e3,c=Math.max(0,i-l),m=i-e,d=Math.max(m,c)+Vs;n=Math.max(n,d)}return Ne(n,rt,zs)}function Po(s,e){if(!s||e===null||!Number.isFinite(e))return rt;const n=Math.max(rt,s.time/1e3-e+Vs);return Ne(n,rt,zs)}function $o(s){return typeof s!="number"||!Number.isFinite(s)||s<=0?rt:Ne(s+Vs,rt,zs)}function Vt(s,e,n,a){return Math.max(Io(s,e),Po(n,e),$o(a))}function Mt(s,e,n){let a=null,o=0;for(let l=0;l<s.length;l++){const i=s[l],c=e.get(i.betId);!c||n-c>Qn||(!a||c>o)&&(a=i,o=c)}return a}function Fo(s,e,n){for(let a=0;a<s.length;a++){const o=s[a];e.has(o.betId)||n-o.settledAt>Rn||e.set(o.betId,n)}e.forEach((a,o)=>{n-a>Rn&&e.delete(o)})}function Bn(s,e){const n=Math.max(64,e*go);return Math.min(s,n)}function In(s){return Ne(s*60*wo,vo,Co)}function Pn(s,e,n){const o=s+12,l=e-jo-110;if(l<o)return Ne(o,0,Math.max(0,n-40));const i=e-Ln;return Ne(i,o,Math.min(l,n-Ln))}function Oo(s,e){let n=0,a=s.length;for(;n<a;){const o=Math.floor((n+a)/2);s[o]<e?n=o+1:a=o}return n}function Gs(s){if(s.length<2)return 1;const e=Math.max(0,s.length-24),n=s[s.length-1]-s[e],a=s.length-1-e;return!Number.isFinite(n)||n<=0||a<=0?1:Math.max(.05,n/a)}function Uo(s){const e=Math.min(1,Math.max(0,s));return 1-Math.pow(1-e,3)}function $n(){return{chartType:null,intervalMins:null,futureSeconds:0,dataLen:0}}function zt(s,e,n,a,o,l,i){const c=l.chartType!==e,m=l.intervalMins!==n,d=l.dataLen===0,y=o>l.futureSeconds+Eo;!i&&!c&&!m&&!d&&!y||(Ko(s,e,n,a,o),l.chartType=e,l.intervalMins=n,l.futureSeconds=o,l.dataLen=a.length)}function Ko(s,e,n,a,o=rt){const l=a.length;if(l<=0){s.timeScale().scrollToRealTime();return}if(e==="line"){const d=a[l-1];if(!Number.isFinite(d)){s.timeScale().setVisibleLogicalRange({from:0,to:Math.max(0,l-1)});return}const y=Math.min(Oo(a,d-n*60),l-1),u=Math.max(o,In(n)),_=Math.max(2,Math.min(ko,Math.round(u/Gs(a)))),S=Math.max(y,l-1+_);s.timeScale().setVisibleLogicalRange({from:y,to:S});return}const i=12,c=Math.max(2,Math.round(In(n)/5)),m=Math.min(i,l);s.timeScale().setVisibleLogicalRange({from:l-m,to:l-1+c})}function Wo({chartType:s,linePoints:e,candles:n,decimals:a,pricePrefix:o,sessionHigh:l,sessionLow:i,currentPrice:c,betPoints:m,settledMarks:d,previewDirection:y,previewTfSeconds:u,previewAmount:_,previewPayoutAmount:S,focusedBetId:p,labels:b,canvasHandleRef:$,isMobile:N,chartIntervalMins:B,chartNowTick:R}){const E=r.useRef(null),U=r.useRef(null),V=r.useRef(null),le=r.useRef(null),Q=r.useRef(0),X=r.useRef(null),I=r.useRef(null),se=r.useRef(null),ee=r.useRef(B),k=r.useRef(B),v=r.useRef(null),M=r.useRef(null),z=r.useRef([]),K=r.useRef({decimals:a,pricePrefix:o,isMobile:N}),ce=r.useRef(m),L=r.useRef(d),we=r.useRef(c),je=r.useRef(y),De=r.useRef(u),Ge=r.useRef(_),ue=r.useRef(S),A=r.useRef(new Map),ne=r.useRef(p),re=r.useRef(s),ke=r.useRef(N),he=r.useRef(b),Ee=r.useRef([]),Qe=r.useRef(""),qt=r.useRef(""),Bt=r.useRef(null),Yt=r.useRef(null),Xt=r.useRef(null),It=r.useRef(null),Zt=r.useRef(null),Qt=r.useRef(null),Jt=r.useRef(null),ht=r.useRef(null),Pt=r.useRef(null),$t=r.useRef(null),es=r.useRef(null),it=r.useRef(new Map),ts=r.useRef(null),bt=r.useRef(null),Ke=r.useRef(null),ct=r.useRef(null),Be=r.useRef(()=>{}),ut=r.useRef(()=>{}),Je=r.useRef(null),Ie=r.useRef(null),We=r.useRef(null),qe=r.useRef(null),Ze=r.useRef($n());return ce.current=m,L.current=d,we.current=c,je.current=y,De.current=u,Ge.current=_,ue.current=S,ne.current=p,re.current=s,ke.current=N,he.current=b,r.useEffect(()=>{const w=E.current;if(!w)return;const q=K.current,C=oa(w,{layout:{background:{type:ia.Solid,color:"transparent"},textColor:"rgba(255, 255, 255, 0.55)",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:11,attributionLogo:!1},grid:{vertLines:{color:"rgba(255, 255, 255, 0.04)",style:pt.Dotted},horzLines:{color:"rgba(255, 255, 255, 0.05)",style:pt.Dotted}},crosshair:{mode:la.Magnet,vertLine:{color:"rgba(255, 255, 255, 0.32)",style:pt.Dashed,width:1},horzLine:{color:"rgba(255, 255, 255, 0.32)",style:pt.Dashed,width:1}},rightPriceScale:{borderColor:"rgba(255, 255, 255, 0.06)",scaleMargins:{top:.12,bottom:.12},visible:!0,autoScale:!0},timeScale:{borderColor:"rgba(255, 255, 255, 0.06)",timeVisible:!0,secondsVisible:!0,rightOffset:6,barSpacing:q.isMobile?6:8,minBarSpacing:.5,shiftVisibleRangeOnNewBar:!0,fixRightEdge:!1,tickMarkFormatter:ae=>An(ae,k.current)},width:w.clientWidth,height:w.clientHeight,handleScroll:{mouseWheel:!1,pressedMouseMove:!1,horzTouchDrag:!1,vertTouchDrag:!1},handleScale:{mouseWheel:!1,pinch:!1,axisPressedMouseMove:{time:!1,price:!1},axisDoubleClickReset:{time:!1,price:!1}},kineticScroll:{mouse:!1,touch:!1},localization:{priceFormatter:Tn(q.decimals,q.pricePrefix)}});U.current=C,C.timeScale().subscribeVisibleLogicalRangeChange(()=>{const ae=C.timeScale().getVisibleRange(),Y=ae?Number(ae.from):null,xe=ae?Number(ae.to):null;let Le="";if(Y!==null&&xe!==null){const H=Ee.current;for(let Pe=0;Pe<H.length;Pe++){const Ae=H[Pe],ge=Ae.time/1e3;ge>=Y&&ge<=xe&&(Le+=`${Ae.betId??`${Ae.time}:${Ae.price}`}|`)}}if(Le!==qt.current){qt.current=Le;try{V.current?.applyOptions({})}catch{}}Be.current()});const J=new ResizeObserver(()=>{C.applyOptions({width:w.clientWidth,height:w.clientHeight}),Be.current()});return J.observe(w),()=>{Ie.current!==null&&(cancelAnimationFrame(Ie.current),Ie.current=null),J.disconnect(),C.remove(),U.current=null,V.current=null,le.current=null,v.current=null,M.current=null,X.current=null,We.current=null,qe.current=null,Ze.current=$n()}},[]),r.useEffect(()=>{U.current?.applyOptions({localization:{priceFormatter:Tn(a,o)}})},[a,o]),r.useEffect(()=>{U.current?.applyOptions({timeScale:{barSpacing:N?6:8}}),Be.current()},[N]),r.useEffect(()=>{k.current=B,U.current?.applyOptions({timeScale:{tickMarkFormatter:w=>An(w,k.current)}})},[B]),r.useEffect(()=>{const w=U.current;if(!w)return;const q=s==="line"?"line":"candle";if(le.current!==q){V.current&&w.removeSeries(V.current);const _e=T=>{const Se=T();if(!Se?.priceRange||Ee.current.length===0)return Se;const de=U.current?.timeScale().getVisibleRange(),G=de?Number(de.from):null,F=de?Number(de.to):null,ye=ne.current;let{minValue:fe,maxValue:O}=Se.priceRange,Fe=!1;for(let et=0;et<Ee.current.length;et++){const ve=Ee.current[et];if(!(!!ye&&ve.betId===ye)&&G!==null&&F!==null){const Ye=ve.time/1e3;if(Ye<G||Ye>F)continue}ve.price<fe&&(fe=ve.price),ve.price>O&&(O=ve.price),Fe=!0}if(!Fe)return Se;const Re=Math.max(1e-9,O-fe)*.12;
1return{...Se,priceRange:{minValue:fe-Re,maxValue:O+Re}}};V.current=q==="line"?w.addSeries(ca,{topColor:"rgba(91, 143, 249, 0.32)",bottomColor:"rgba(12, 18, 36, 0.02)",lineColor:"#f4f7ff",lineWidth:2,priceLineVisible:!0,priceLineColor:"#ffffff",priceLineWidth:1,priceLineStyle:pt.Dotted,lastValueVisible:!0,crosshairMarkerVisible:!1,autoscaleInfoProvider:_e}):w.addSeries(ua,{upColor:"#4ade80",downColor:"#f87171",wickUpColor:"#22c55e",wickDownColor:"#ef4444",borderUpColor:"#22c55e",borderDownColor:"#ef4444",priceLineVisible:!0,priceLineColor:"#ffffff",priceLineWidth:1,priceLineStyle:pt.Dotted,lastValueVisible:!0,autoscaleInfoProvider:_e}),le.current=q,Q.current=0,X.current=null,I.current=null,We.current=null,qe.current=null}const C=V.current;if(!C)return;const J=se.current!==s,ae=ee.current!==B;(J||ae)&&(Q.current=0);const Y=s==="line"?Lo(e):Ao(s==="heikin"?xo(n):n);z.current=Y.map(_e=>_e.time);const xe=Q.current,Le=Y.length>0?Y[0].time:null,H=Y.length>0?Y[Y.length-1].time:null,Pe=Math.max(0,xe-1),Ae=Y[Pe]?.time,ge=xe>0&&Y.length>=xe&&Y.length-xe<=Ro&&Le===X.current&&(I.current===null||Ae===void 0||Ae>=I.current)&&(I.current===null||H===null||H>=I.current)&&!J&&!ae;if(Ie.current!==null&&(cancelAnimationFrame(Ie.current),Ie.current=null),ge&&q==="line"){const _e=C,T=Y.length-1,Se=Math.max(0,xe-1);if(Se<T){w.timeScale().applyOptions({shiftVisibleRangeOnNewBar:!1});for(let G=Se;G<T;G++)_e.update(Y[G]);w.timeScale().applyOptions({shiftVisibleRangeOnNewBar:!0})}const de=Y[T];if(de){const G=performance.now(),F=qe.current,ye=We.current?.value??de.value,fe=de.value-ye;if((window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1)||Math.abs(fe)<=No)_e.update(de),We.current=de;else{const Fe=F===null?So:G-F,Oe=Math.min(_o,Math.max(yo,Fe*.9)),Re=G;let et=0;const ve=tt=>{const Ye=Uo((tt-Re)/Oe),xt={time:de.time,value:ye+fe*Ye};_e.update(xt),We.current=xt;const D=Ye>=1;(D||tt-et>=32)&&(ut.current(),et=tt),D?(Ie.current=null,We.current=de):Ie.current=requestAnimationFrame(ve)};Ie.current=requestAnimationFrame(ve)}qe.current=G}}else if(ge)for(let _e=Math.max(0,xe-1);_e<Y.length;_e++)C.update(Y[_e]);else q==="line"?(C.setData(Y),We.current=Y[Y.length-1]??null,qe.current=performance.now()):(C.setData(Y),We.current=null,qe.current=null);return Q.current=Y.length,X.current=Le,I.current=H,zt(w,s,B,z.current,Vt(ce.current,H,Mt(L.current,A.current,Date.now()),De.current),Ze.current,!ge||J||ae),(!ge||J||ae)&&(se.current=s,ee.current=B),Be.current(),()=>{Ie.current!==null&&(cancelAnimationFrame(Ie.current),Ie.current=null)}},[n,B,s,e]),r.useEffect(()=>{const w=m.filter(J=>J.price>0).map(J=>({time:J.time,price:J.price,betId:J.betId})),q=Mo(m);if(Ee.current=w,q!==Qe.current){Qe.current=q;try{V.current?.applyOptions({})}catch{Qe.current=""}}const C=U.current;C&&zt(C,s,B,z.current,Vt(m,I.current,Mt(L.current,A.current,Date.now()),De.current),Ze.current,!1),Be.current()},[m,B,s]),r.useEffect(()=>{const w=Date.now();Fo(d,A.current,w);const q=Mt(d,A.current,w),C=U.current;if(C&&zt(C,s,B,z.current,Vt(ce.current,I.current,q,De.current),Ze.current,!1),Be.current(),!q)return;const J=A.current.get(q.betId)??w,ae=Math.max(0,Qn-(w-J)),Y=window.setTimeout(()=>{Be.current()},ae+80);return()=>window.clearTimeout(Y)},[B,s,d]),r.useEffect(()=>{const w=U.current;w&&zt(w,s,B,z.current,Vt(ce.current,I.current,Mt(L.current,A.current,Date.now()),u),Ze.current,!0),Be.current()},[y,u,B,s]),r.useEffect(()=>(ut.current=()=>{const w=U.current,q=V.current,C=Bt.current,J=Yt.current,ae=Xt.current,Y=It.current,xe=Zt.current,Le=Qt.current,H=Jt.current,Pe=ht.current,Ae=Pt.current,ge=$t.current,_e=es.current,T=ts.current,Se=bt.current,Te=Ke.current,de=ct.current;if(!w||!q||!C||!J||!ae||!Y||!xe||!Le||!H||!Pe||!Ae||!ge||!_e||!T||!Se||!Te||!de)return;const G=Date.now(),F=To(ce.current,ne.current,G),ye=ke.current,fe=Mt(L.current,A.current,G),O=w.paneSize(0);if(O.width<=0||O.height<=0){C.classList.remove("isVisible","hasActiveBet","hasPreview","hasEndLine","hasCountdown","hasPendingMark","hasWinMark","hasLoseMark","hasTieMark","dirUp","dirDown","isMobileOverlay"),T.classList.remove("isVisible"),_e.replaceChildren(),it.current.clear();return}const Fe=(D,W=null)=>{Ae.textContent=D,H.style.display=D?"":"none",C.classList.toggle("hasCountdown",W!==null&&D!==""),W===null?H.style.removeProperty("--bc-countdown-progress"):H.style.setProperty("--bc-countdown-progress",String(Ne(W,0,1)))};let Oe=!1;C.classList.toggle("isMobileOverlay",ye),C.classList.remove("hasPreview","hasPendingMark","hasWinMark","hasLoseMark","hasTieMar
1k");const Re=I.current,ve=(re.current==="line"?We.current:null)?.value??we.current;if(re.current==="line"&&Re!==null&&ve!==null&&Number.isFinite(ve)){const D=cs(w,Re,z.current),W=q.priceToCoordinate(ve);D!==null&&W!==null&&Number.isFinite(D)&&Number.isFinite(W)?(Oe=!0,T.classList.add("isVisible"),T.style.transform=`translate3d(${Ne(D,0,O.width)}px, ${Ne(W,0,O.height)}px, 0) translate(-50%, -50%)`):T.classList.remove("isVisible")}else T.classList.remove("isVisible");const tt=ne.current!==null,Ye=F?.betId?String(F.betId):"";{const D=ce.current.filter(ie=>Jn(ie,G)),W=new Set;for(let ie=0;ie<D.length;ie++){const P=D[ie],Z=P.betId?String(P.betId):`${P.time}-${P.price}-${P.direction}`,be=cs(w,P.time/1e3,z.current),me=q.priceToCoordinate(P.price);if(be===null||me===null||!Number.isFinite(be)||!Number.isFinite(me)||be<-8||be>O.width+8||me<-8||me>O.height+8)continue;let pe=it.current.get(Z);pe||(pe=document.createElement("span"),it.current.set(Z,pe),_e.appendChild(pe));const Xe=P.direction==="UP"?"bcBetOpenDot-up":"bcBetOpenDot-down",at=Z===Ye?" isFocused":"";pe.className=`bcBetOpenDot ${Xe}${at}`,pe.style.transform=`translate3d(${be}px, ${me}px, 0) translate(-50%, -50%)`,W.add(Z)}it.current.forEach((ie,P)=>{W.has(P)||(ie.remove(),it.current.delete(P))})}if(F){const D=cs(w,F.time/1e3,z.current),W=q.priceToCoordinate(F.price);if(D===null||W===null||!Number.isFinite(D)||!Number.isFinite(W))C.classList.remove("hasActiveBet","hasEndLine","dirUp","dirDown");else{const ie=O.width,P=O.height,Z=typeof F.expiresAt=="number"&&Number.isFinite(F.expiresAt)&&F.expiresAt>F.time?F.expiresAt:null,be=Z===null?ie:Do(w,D,F.time/1e3,Z,z.current,ie),me=Ne(be??ie,D,ie),pe=Math.max(0,me-D),Xe=ye?Bn(pe,ie):pe;if(W<-12||W>P+12)C.classList.remove("hasActiveBet","hasEndLine","dirUp","dirDown");else{const at=typeof F.amount=="number"?F.amount:0,dt=typeof F.payoutAmount=="number"?F.payoutAmount:0,Ce=F.direction==="UP",gt=Ce?0:W,yt=Ce?Math.max(0,W):Math.max(0,P-W),_t=Ce?W:0,St=Ce?Math.max(0,P-W):Math.max(0,W),Nt=Pn(D,me,ie),kt=Ne(me,0,ie),ft=ye?18:24,vt=Ne(kt,ft,ie-ft),st=Z!==null?Ps:10,ot=Math.max(st,P-40),Ct=Ce?st:ot,wt=Ce?ot:st;if(Oe=!0,C.classList.add("hasActiveBet"),C.classList.toggle("hasEndLine",Z!==null),C.classList.toggle("dirUp",Ce),C.classList.toggle("dirDown",!Ce),xe.style.transform=`translate3d(${D}px, ${W}px, 0)`,xe.style.width=`${Xe}px`,Le.style.transform=`translate3d(${kt}px, 0, 0)`,Le.style.height=`${P}px`,Z!==null){const Ue=G>=Z,Me=F.result==="WIN",jt=F.result==="LOSE",Et=F.result==="REFUND",ss=Ue?Me?he.current.win:jt?he.current.lose:Et?he.current.tie:"":Bo(Z,G),Ft=Ue?null:(Z-G)/Math.max(1,Z-F.time);C.classList.toggle("hasPendingMark",!Ue),C.classList.toggle("hasWinMark",Ue&&Me),C.classList.toggle("hasLoseMark",Ue&&jt),C.classList.toggle("hasTieMark",Ue&&Et),Fe(ss,Ft)}else Fe("",null),H.style.display="";H.style.transform=`translate3d(${vt}px, ${ye?7:9}px, 0) translateX(-50%)`,ge.style.transform=`translate3d(${D}px, ${W}px, 0) translate(-50%, -50%)`,J.style.transform=`translate3d(${D}px, ${gt}px, 0)`,J.style.width=`${pe}px`,J.style.height=`${yt}px`,ae.style.transform=`translate3d(${D}px, ${_t}px, 0)`,ae.style.width=`${pe}px`,ae.style.height=`${St}px`,ye||(Se.textContent=he.current.entryPrice(F.price),Se.style.transform=`translate3d(${D}px, ${W}px, 0) translate(calc(-100% - 0.5em), -50%)`),ye||(Te.style.visibility="",de.style.visibility="",Te.textContent=`+${is(dt)} G`,de.textContent=`-${is(at)} G`,Te.style.transform=`translate3d(${Nt}px, ${Ct}px, 0)`,de.style.transform=`translate3d(${Nt}px, ${wt}px, 0)`)}}}else{C.classList.remove("hasActiveBet","hasEndLine","dirUp","dirDown"),Te.style.visibility="",de.style.visibility="";const D=je.current,W=we.current;if(D&&Re!==null&&W!==null&&Number.isFinite(W)){const ie=cs(w,Re,z.current),P=q.priceToCoordinate(W);if(ie!==null&&P!==null&&Number.isFinite(ie)&&Number.isFinite(P)){const Z=D==="UP",be=O.width,me=O.height,pe=Ne(ie,0,be),Xe=De.current,at=typeof Xe=="number"&&Number.isFinite(Xe)&&Xe>0?Dn(w,Re+Xe,z.current,be):null,dt=Ne(at??be,pe,be),Ce=Math.max(0,dt-pe),gt=ye?Bn(Ce,be):Ce,yt=Ge.current??0,_t=ue.current??yt,St=Z?0:P,Nt=Z?Math.max(0,P):Math.max(0,me-P),kt=Z?P:0,ft=Z?Math.max(0,me-P):Math.max(0,P),vt=Pn(pe,dt,be),st=Ps,ot=Math.max(Ps,me-40),Ct=Z?st:ot,wt=Z?ot:st,Ue=Ne(pe+Math.min(Math.max(Ce*.5,36),160),26,be-26),Me=Z?Ne(Math.max(20,P*.38),20,Math.max(20,P-18)):Ne(P+Math.max(22,(me-P)*.42),Math.min(me-20,P+20),me-20);Oe=!0,C.classList.add("hasPreview"),C.classList.toggle("dirUp",Z),C.classList.toggle("dirDown",!Z),xe.style.transform=`translate3d(${pe}px, ${P}px, 0)`,xe.style.width=`${gt}px`,J.style.transform=`translate3d(${pe}px, ${St}px, 0)`,J.style.width=`${Ce}px`,J.style.height=`${Nt}px`,ae.style.transform=`translate3d(${pe}px, ${kt}px, 0)`,ae.style.width=`${Ce}px`,ae.style.height=`${ft}px`,Y.style.transform=`translate3d(${Ue}px, ${Me}px, 0) translate(-50%, -50%)`,ye||(Se.textContent=he.current.entryPrice(W),Se.style.transform=`translate3d(${pe}px, ${P}px, 0) translate(calc(-100% - 1.35em), -50%)`,Te.style.visibility="",de.style.visibility="",Te.textContent=`+${is(_t)} G`,de.textContent=`-${is(yt)} G`,Te.style.transform=`translate3d(${vt}px, ${Ct}px, 0)`,de.style.transform=`translate3d(${vt}px, ${wt}px, 0)`)}}}const xt=fe?String(fe.betId)===ne.current:!1;if(tt&&fe&&xt){const D=Dn(w,fe.time/1e3,z.current,O.width);if(D===null||!Number.isFinite(D))F||C.classList.remove("hasEndLine");else{const W=Ne(D,0,O.width),ie=ye?18:24,P=Ne(W,ie,O.width-ie),Z=fe.result==="WIN",be=fe.result==="LOSE",me=fe.result==="REFUND";Oe=!0,C.classList.add("hasEndLine"),C.classList.toggle("hasWinMark",Z),C.classList.toggle("hasLoseMark",be),C.classList.toggle("hasTieMar
1k",me),Le.style.transform=`translate3d(${W}px, 0, 0)`,Le.style.height=`${O.height}px`,Fe(Z?he.current.win:be?he.current.lose:he.current.tie,null),H.style.transform=`translate3d(${P}px, ${ye?7:9}px, 0) translateX(-50%)`}}C.classList.toggle("isVisible",Oe)},Be.current=()=>{Je.current===null&&(Je.current=requestAnimationFrame(()=>{Je.current=null,ut.current()}))},ut.current(),()=>{Je.current!==null&&(cancelAnimationFrame(Je.current),Je.current=null),Be.current=()=>{},ut.current=()=>{}}),[]),r.useEffect(()=>{Be.current()},[R]),r.useEffect(()=>{if(p===null){const w=Bt.current;w&&w.classList.remove("hasActiveBet","hasPreview","hasEndLine","hasCountdown","hasPendingMark","hasWinMark","hasLoseMark","hasTieMark","dirUp","dirDown"),A.current.clear()}Be.current()},[p]),r.useEffect(()=>{const w=V.current;if(!w)return;const q=(C,J,ae,Y)=>{if(!J){if(C.current){try{w.removePriceLine(C.current)}catch{C.current=null}C.current=null}return}const xe={price:ae,color:Y,lineWidth:1,lineStyle:pt.Dashed,axisLabelVisible:!1,title:""};C.current?C.current.applyOptions(xe):C.current=w.createPriceLine(xe)};q(v,!N&&l!==null,l??0,"rgba(147, 197, 253, 0.55)"),q(M,!N&&i!==null,i??0,"rgba(147, 197, 253, 0.55)")},[N,l,i]),r.useImperativeHandle($,()=>({resetZoom:()=>{const w=U.current;w&&zt(w,s,B,z.current,Vt(ce.current,I.current,Mt(L.current,A.current,Date.now()),De.current),Ze.current,!0)}}),[B,s]),t.jsxs("div",{className:"bcChartStage",children:[t.jsx("div",{ref:E,className:"bcChartHost"}),t.jsxs("div",{ref:Bt,className:"bcBetOverlay","aria-hidden":"true",children:[t.jsx("div",{ref:Yt,className:"bcBetZone bcBetZoneWin"}),t.jsx("div",{ref:Xt,className:"bcBetZone bcBetZoneLose"}),t.jsxs("div",{ref:It,className:"bcBetPreviewArrow",children:[t.jsx(Zr,{size:15,className:"bcBetPreviewArrowUp",strokeWidth:2.6}),t.jsx(Qr,{size:15,className:"bcBetPreviewArrowDown",strokeWidth:2.6})]}),t.jsx("div",{ref:Zt,className:"bcBetGuide"}),t.jsx("div",{ref:Qt,className:"bcBetEndLine"}),t.jsxs("div",{ref:Jt,className:"bcBetEndTag",children:[t.jsx("span",{ref:ht,className:"bcBetEndSpinner"}),t.jsx("span",{ref:Pt,className:"bcBetEndText"})]}),t.jsx("div",{ref:bt,className:"bcBetEntryTag"}),t.jsx("div",{ref:es,className:"bcBetOpenDots"}),t.jsx("div",{ref:$t,className:"bcBetDot"}),t.jsx("div",{ref:ts,className:"bcLineHead"}),t.jsx("div",{ref:Ke,className:"bcBetPayoutChip bcBetPayoutChipWin"}),t.jsx("div",{ref:ct,className:"bcBetPayoutChip bcBetPayoutChipLose"})]})]})}const Ho=r.memo(Wo),Vo=[1,5,10];function Fn(s,e){return s.toLocaleString("en-US",{minimumFractionDigits:e,maximumFractionDigits:e})}function zo({mins:s,selected:e,onSelect:n}){const a=r.useCallback(()=>n(s),[s,n]);return t.jsxs("button",{type:"button",onClick:a,className:`bcSegmentBtn ${e?"isSelected":""}`,"aria-pressed":e,children:[s,"m"]})}const Go=r.memo(zo);function qo({chartType:s,linePoints:e,candles:n,currentPrice:a,prevPrice:o,sessionDeltaPct:l,historyLoading:i,decimals:c=2,pricePrefix:m="",metaLabel:d,treasuryTier:y,config:u,chartIntervalMins:_,onChangeInterval:S,onChangeChartType:p,betPoints:b=[],settledMarks:$=[],waitingLineLabel:N,waitingCandleLabel:B,footerExtras:R,assetExtra:E,priceRowExtra:U,focusedBetId:V=null,previewTfSeconds:le=null,previewDirection:Q=null,previewAmount:X=null,previewPayoutAmount:I=null,onClearFocus:se,chartNowTick:ee}){const k=$e(),v=Xn(),M=l!==null&&l>=0,z=a!==null&&o!==null&&a!==o?a>o?"tickUp":"tickDown":"",K=r.useRef(null),ce=r.useRef(0);r.useEffect(()=>{const re=K.current;if(!re||!z||window.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return;const ke=performance.now();if(ke-ce.current<320)return;ce.current=ke,re.getAnimations?.().forEach(Qe=>Qe.cancel());const he=z==="tickUp",Ee=re.animate([{color:he?"#4ade80":"#f87171",textShadow:`0 0 0.75rem ${he?"rgba(74, 222, 128, 0.45)":"rgba(248, 113, 113, 0.45)"}`},{color:he?"#86efac":"#fca5a5",textShadow:`0 0 0.5rem ${he?"rgba(74, 222, 128, 0.2)":"rgba(248, 113, 113, 0.2)"}`,offset:.6},{color:"var(--lt-fg)",textShadow:"none"}],{duration:480,easing:"cubic-bezier(0.22, 1, 0.36, 1)"});return()=>Ee.cancel()},[a,z]);const{sessionHigh:L,sessionLow:we}=r.useMemo(()=>
1{if(e.length===0)return{sessionHigh:null,sessionLow:null};let re=e[0].price,ke=e[0].price;for(let he=1;he<e.length;he++){const Ee=e[he].price;Ee>re&&(re=Ee),Ee<ke&&(ke=Ee)}return{sessionHigh:re,sessionLow:ke}},[e]),je=r.useCallback(()=>p("line"),[p]),De=r.useCallback(()=>p("candle"),[p]),Ge=r.useMemo(()=>({entryPrice:re=>k("lt_chart_entry_price",{price:Fn(re,c)}),pending:k("lt_chart_marker_pending"),win:k("lt_chart_marker_win"),lose:k("lt_chart_marker_lose"),tie:k("lt_chart_marker_tie")}),[c,k]),ue=s==="line"?e.length===0:n.length===0,A=s==="line"?N:B,ne=Number(String(u.treasuryBalance??"0").replace(/,/g,""))||0;return t.jsxs("section",{className:"bcCard",children:[t.jsxs("header",{className:"bcHead",children:[t.jsxs("div",{className:"bcHeadMain",children:[t.jsxs("div",{className:"bcHeadAsset",children:[t.jsx("span",{className:"bcAssetLabel",children:d}),i&&t.jsx(bs,{size:11,className:"bcSpin"}),E]}),t.jsxs("div",{className:"bcPriceRow",children:[a!==null?t.jsxs("span",{ref:K,className:"bcPrice",children:[m,Fn(a,c)]}):t.jsxs("span",{className:"bcPrice bcPriceIdle","aria-label":k("lt_connecting"),children:[t.jsx("i",{}),t.jsx("i",{}),t.jsx("i",{})]}),l!==null&&t.jsxs("span",{className:`bcDelta ${M?"sessionPos":"sessionNeg"}`,children:[M?"+":"",l.toFixed(2),t.jsx("span",{className:"bcDeltaUnit",children:"%"})]}),U]})]}),t.jsxs("div",{className:"bcHeadRight",children:[t.jsx(bo,{tier:y,redMaxBalance:u.redMaxBalance,yellowMaxBalance:u.yellowMaxBalance}),u.treasuryBalance!==void 0&&t.jsxs("div",{className:"bcTreasuryInline",children:[t.jsx("span",{className:"bcTreasuryLabel",children:k("lt_treasury_label")}),t.jsxs("span",{className:"bcTreasuryValue",children:[t.jsx(Ar,{value:ne}),t.jsx("span",{className:"bcTreasuryUnit",children:"G"})]})]})]})]}),t.jsx("div",{className:"bcWrap",children:t.jsxs("div",{className:"bcInner",children:[t.jsx(Ho,{chartType:s,linePoints:e,candles:n,decimals:c,pricePrefix:m,sessionHigh:L,sessionLow:we,currentPrice:a,betPoints:b,settledMarks:$,previewDirection:Q,previewTfSeconds:le,previewAmount:X,previewPayoutAmount:I,focusedBetId:V,labels:Ge,isMobile:v,chartIntervalMins:_,chartNowTick:ee}),ue&&t.jsxs("div",{className:"chartEmpty",role:"status","aria-label":A,children:[t.jsx("div",{className:"chartEmptySheen","aria-hidden":"true"}),t.jsx("span",{className:"chartEmptyText",children:A})]})]})}),t.jsxs("footer",{className:"bcFoot",children:[t.jsx("div",{className:"bcSegment",children:Vo.map(re=>t.jsx(Go,{mins:re,selected:_===re,onSelect:S},re))}),!v&&V!==null&&se&&t.jsxs("button",{type:"button",className:"bcFootUnfocus",onClick:se,"aria-label":k("lt_history_unfocus_chart"),title:k("lt_history_unfocus_chart"),children:[t.jsx(Hs,{size:12,strokeWidth:2.4}),t.jsx("span",{className:"bcFootUnfocusLabel",children:k("lt_history_unfocus_chart")})]}),t.jsxs("div",{className:"bcSegment bcSegmentIcons",children:[t.jsx("button",{type:"button",onClick:je,className:`bcSegmentBtn bcSegmentIcon ${s==="line"?"isSelected":""}`,title:k("lt_chart_line"),"aria-label":k("lt_chart_line"),"aria-pressed":s==="line",children:t.jsx(Jr,{size:13})}),t.jsx("button",{type:"button",onClick:De,className:`bcSegmentBtn bcSegmentIcon ${s==="candle"?"isSelected":""}`,title:k("lt_chart_candle"),"aria-label":k("lt_chart_candle"),"aria-pressed":s==="candle",children:t.jsx(ea,{size:13})})]}),R]})]})}const Yo=r.memo(qo),Xo="wss://s17529.nyc1.piesocket.com/v3",Zo="mNFnije9u9rgDAPYglhoTHTYXhWcGCFmcOmgio2b",Qo=s=>`https://pda.playnance.com/rates/history?asset=${s}&range=5m`,$s=500;function Jo(s){const e=new Date(s),n=a=>String(a).padStart(2,"0");return`${n(e.getHours())}:${n(e.getMinutes())}:${n(e.getSeconds())}.${String(e.getMilliseconds()).padStart(3,"0")}`}function el({assetKey:s}){const e=$e(),[n,a]=r.useState([]),[o,l]=r.useState(!1),[i,c]=r.useState(!1),[m,d]=r.useState(!1),[y,u]=r.useState(0),_=r.useRef(null),S=r.useRef(null);r.useEffect(()=>{a([]),c(!1)},[s]),r.useEffect(()=>{m&&S.current?.close()},[m]);const p=()=>{a([]),d(!1),u(b=>b+1)};return r.useEffect(()=>{if(m)return;let b=!1,$=null,N=null;const B=250;let R=[],E=null,U=0;const V=()=>
1{if(E=null,b||R.length===0)return;const X=R;R=[],U=performance.now(),a(I=>{const se=I.concat(X);return se.length>$s?se.slice(-$s):se})},le=()=>{if(E!==null)return;const X=performance.now()-U;X>=B?E=requestAnimationFrame(V):E=window.setTimeout(()=>{E=requestAnimationFrame(V)},B-X)};a([]);const Q=()=>{if(b)return;const X=`${Xo}/dxfeed_rates_${s}?api_key=${Zo}`,I=new WebSocket(X);$=I,S.current=I,I.onmessage=se=>{if(!b)try{const ee=JSON.parse(se.data);let k=ee;if(typeof ee?.data=="string")try{k=JSON.parse(ee.data)}catch{k=ee}else ee?.data&&typeof ee.data=="object"&&(k=ee.data);const v=parseFloat(String(k?.price??"")),M=k?.timestamp,z=M?Number(M)<1e12?Number(M)*1e3:Number(M):Date.now();!isNaN(v)&&v>0&&(R.length>=$s&&R.shift(),R.push({timestamp:z,price:v,source:"live"}),le())}catch(ee){fs("rateOverlay.message",ee)}},I.onclose=()=>{b||(N=setTimeout(Q,2500))},I.onerror=()=>I.close()};return Q(),fetch(Qo(s)).then(X=>X.json()).then(X=>{if(b)return;const I=X?.points,ee=(Array.isArray(I)?I:[]).map(k=>({timestamp:Number(k.x??k.timestamp??0),price:parseFloat(String(k.y??k.price??"0")),source:"history"})).filter(k=>k.timestamp>0&&k.price>0).sort((k,v)=>k.timestamp-v.timestamp);a(k=>{const v=k.filter(K=>K.source==="live"),M=new Set(v.map(K=>K.timestamp));return[...ee.filter(K=>!M.has(K.timestamp)),...v]})}).catch(X=>fs("rateOverlay.history",X)),()=>{b=!0,E!==null&&(cancelAnimationFrame(E),clearTimeout(E),E=null),R=[],$?.close(),N&&clearTimeout(N)}},[s,y,m]),r.useEffect(()=>{!_.current||o||(_.current.scrollTop=0)},[n.length,o]),i?null:t.jsxs("div",{className:"rateDebugOverlay","data-collapsed":o||void 0,role:"region","aria-label":e("lt_debug_overlay_title",{asset:s}),children:[t.jsxs("div",{className:"rdoHeader",children:[t.jsxs("div",{className:"rdoTitleGroup",children:[t.jsx("span",{className:`rdoStatusDot ${m?"rdoStatusDotPaused":"rdoStatusDotLive"}`,"aria-hidden":"true"}),t.jsx("span",{className:"rdoTitle",children:e("lt_debug_overlay_title",{asset:s})}),t.jsxs("span",{className:"rdoCount",children:["(",n.length,")"]})]}),t.jsxs("div",{className:"rdoActions",children:[t.jsx("button",{type:"button",onClick:()=>m?p():d(!0),className:"rdoIconBtn","aria-label":e(m?"lt_debug_overlay_resume":"lt_debug_overlay_pause"),title:e(m?"lt_debug_overlay_resume":"lt_debug_overlay_pause"),children:m?t.jsx(ta,{size:13}):t.jsx(sa,{size:13})}),t.jsx("button",{type:"button",onClick:()=>l(b=>!b),className:"rdoIconBtn","aria-label":e(o?"lt_debug_overlay_expand":"lt_debug_overlay_collapse"),title:e(o?"lt_debug_overlay_expand":"lt_debug_overlay_collapse"),children:o?t.jsx(Hn,{size:14}):t.jsx(Ws,{size:14})}),t.jsx("button",{type:"button",onClick:()=>c(!0),className:"rdoIconBtn rdoIconBtnClose","aria-label":e("lt_debug_overlay_close"),title:e("lt_debug_overlay_close"),children:t.jsx(Hs,{size:14})})]})]}),!o&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"rdoColumns",children:[t.jsx("span",{className:"rdoColTs",children:e("lt_debug_overlay_col_ts")}),t.jsx("span",{className:"rdoColRate",children:e("lt_debug_overlay_col_rate")}),t.jsx("span",{className:"rdoColSrc",children:e("lt_debug_overlay_col_src")})]}),t.jsx("div",{ref:_,className:"rdoList",children:n.length===0?t.jsx("div",{className:"rdoEmpty",children:e("lt_debug_overlay_loading")}):n.slice().reverse().map((b,$)=>t.jsxs("div",{className:`rdoRow ${b.source==="live"?"rdoRowLive":""}`,children:[t.jsx("span",{className:"rdoCellTs",children:Jo(b.timestamp)}),t.jsx("span",{className:"rdoCellRate",children:b.price.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:5})}),t.jsx("span",{className:`rdoCellSrc ${b.source==="live"?"rdoCellSrcLive":""}`,children:b.source==="live"?e("lt_debug_overlay_src_live"):e("lt_debug_overlay_src_hist")})]},$))})]})]})}const tl=()=>{if(typeof window>"u")return!1;try{return new URLSearchParams(window.location.search).get("debug")==="rates"||window.localStorage?.getItem("lt_debug_rates")==="1"}catch{return!1}},On="/trading";function Un(s){return(()=>{try{return decodeURIComponent(s)}catch{return s}})().toLowerCase().replace(/[^a-z0-9]/g,"")}function ds(s){return s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||s.toLowerCase()}function sl(s,e){if(!e)return-1;const n=Un(e);return s.findIndex(a=>Un(a.assetKey)===n||ds(a.assetKey)===e.toLowerCase())}const nl={1:"WIN",2:"LOSE",3:"REFUND"},rl=["insufficient","exceeds balance","transfer amount exceeds","not enough","balance too low"],al=["user rejected","user denied","action_rejected"];function nr(s,e){if(!s)return!1;const n=s.toLowerCase();return e.some(a=>n.includes(a))}const ol=s=>nr(s,rl),ll=s=>nr(s,al);function il({label:s}){return t.jsxs("div",{className:"ltLoadingSkeleton",role:"status","aria-live":"polite","aria-label":s,children:[t.jsxs("div",{className:"ltSkelTop",children:[t.jsx("span",{className:"ltSkelPill ltSkelPillShort"}),t.jsx("span",{className:"ltSkelPill ltSkelPillLong"})]}),t.jsxs("div",{className:"ltSkelMarket",children:[t.jsx("span",{className:"ltSkelChip"}),t.jsx("span",{className:"ltSkelChip"}),t.jsx("span",{className:"ltSkelChip ltSkelChipMuted"})]}),t.jsxs("section",{className:"ltSkelCard",children:[t.jsxs("div",{className:"ltSkelHead",children:[t.jsxs("div",{className:"ltSkelQuote",children:[t.jsx("span",{className:"ltSkelLine ltSkelAsset"}),t.jsx("span",{className:"ltSkelLine ltSkelPrice"})]}),t.jsx("span",{className:"ltSkelTreasury"})]}),t.jsxs("div",{className:"ltSkelChart",children:[t.jsx(bs,{size:28,className:"ltSpin ltSpinPrimary"}),t.jsx("span",{className:"ltLoadingText",children:s})]}),t.jsxs("div",{className:"ltSkelControls",children:[t.jsx("span",{}),t.jsx("span",{}),t.jsx("span",{})]})]}),t.jsxs("section",{className:"ltSkelPanel",children:[t.jsx("span",{}),t.jsx("span",{}),t.jsx("span",{})]})]})}function cl(){const s=Hr(),e=kr(),n=vr(),{assetKey:a}=Cr(),o=$e(),l=hn(f=>f.wallet.walletAddress),i=hn(f=>f.wallet.gcoinBalance),c=!!l,m=r.useCallback(()=>{s(Tr())},[s]),{showSuccess:d,showError:y,showWarning:u,showInfo:_}=Mr(),S=Dr(),{config:p,loading:b,error:$,refreshTreasury:N,tierDrifted:B}=Br(),{placeBet:R,approveLiveTradingContract:E,isPlacing:U,error:V,errorScope:le}=Ir(),[Q,X]=r.useState(null),{effectsEnabled:I,soundtrackEnabled:se,resume:ee,toggleEffects:k,toggleSoundtrack:v,playClick:M,playPlaceBet:z,playSettle:K,playAutoTradeStart:ce,playAutoTradeStop:L,playError:we,playSuspended:je,playResume:De}=Na(),Ge=r.useMemo(()=>{const f={};for(const x of p?.assets??[])f[x.assetHash]=x.assetKey,f[x.assetHash.toLowerCase()]=x.assetKey;return f}
1,[p?.assets]),{openBets:ue,settledBets:A,settlingBets:ne,loading:re,settledLoading:ke,error:he,settledError:Ee,pagination:Qe,settledPagination:qt,goToPage:Bt,goToSettledPage:Yt,refresh:Xt,addOptimisticBet:It,configStale:Zt}=Pr(c?l??null:null,N,Ge,{watchConfig:!0}),Qt=r.useMemo(tl,[]),[Jt,ht]=r.useState([]),Pt=r.useRef(ue),$t=r.useRef(A);r.useEffect(()=>{Pt.current=ue},[ue]),r.useEffect(()=>{$t.current=A},[A]);const[es,it]=r.useState([]),ts=r.useCallback(f=>{const x=nl[f.result];if(!x)return;K(x),(x==="WIN"||x==="REFUND")&&setTimeout(()=>{S()},2e3);const g=[...Pt.current,...$t.current].find(Ve=>String(Ve.id)===String(f.betId)),h=g?.assetKey,oe=h?fn(h):void 0,te=g?.priceDecimals,nt=10**(Number.isFinite(te)&&te>0?te:Number.isFinite(oe)&&oe>0?oe:8);ht(Ve=>{if(Ve.some(js=>js.key===f.betId))return Ve;const At=f.closePrice?Number(f.closePrice)/nt:null,Tt=f.timestamp?f.timestamp*1e3:Date.now(),ws=g?{...g,result:x,closePrice:At??g.closePrice,settledAt:Tt,status:"SETTLED"}:{id:f.betId,assetKey:"?",direction:"UP",timeframe:0,amount:0,payoutAmount:0,openPrice:0,closePrice:At,placedAt:Date.now(),openedAt:Date.now(),expiresAt:Tt,settledAt:Tt,result:x,status:"SETTLED"};return[{key:f.betId,bet:ws},...Ve].slice(0,20)}),it(Ve=>{const At=f.timestamp?f.timestamp*1e3:Date.now();return[{id:String(f.betId),result:x,time:At},...Ve].slice(0,80)})},[]);$r(ts);const bt=ga(20);r.useEffect(()=>{bt.length!==0&&ht(f=>{const x=new Set(f.map(g=>String(g.key))),j=[];for(const g of bt)x.has(g.id)||(x.add(g.id),j.push({key:g.id,bet:g}));return j.length===0?f:[...f,...j].slice(0,30)})},[bt]),r.useEffect(()=>{ue.length===0&&A.length===0||ht(f=>{if(f.every(h=>h.bet.assetKey!=="?"))return f;const x=new Map;for(const h of ue)x.set(String(h.id),h);for(const h of A)x.set(String(h.id),h);let j=!1;const g=f.map(h=>{if(h.bet.assetKey!=="?")return h;const oe=x.get(String(h.key));return oe?(j=!0,{...h,bet:{...oe,result:h.bet.result,closePrice:h.bet.closePrice,settledAt:h.bet.settledAt}}):h});return j?g:f})},[ue,A]);const[Ke,ct]=r.useState(0),[Be,ut]=r.useState("line"),[Je,Ie]=r.useState(1),[We,qe]=r.useState(0),[Ze,w]=r.useState(null),[q,C]=r.useState(""),[J,ae]=r.useState([]),[Y,xe]=r.useState(null);r.useEffect(()=>{const f=new Set([...ue.filter(x=>x.status==="OPEN"&&x.openPrice>0).map(x=>String(x.id)),...A.map(x=>String(x.id)),...Array.from(ne.keys()).map(String)]);ae(x=>{if(x.length===0)return x;const j=x.filter(g=>!g.betId||!f.has(String(g.betId)));return j.length===x.length?x:j})},[ue,A,ne]);const Le=r.useRef(null);r.useEffect(()=>{if(!(!V||!le)&&V!==Le.current){if(Le.current=V,ll(V)){je(),_(o("lt_err_user_rejected"));return}if(ol(V)){we(),y(o("lt_err_insufficient_balance")),mn(s);return}we(),y(o(le==="approve"?"lt_err_approve_failed":"lt_err_bet_failed"))}},[V,le,s,we,je,y,_,o]);const H=r.useMemo(()=>p?.assets??[],[p]),Pe=!!p?.contractPaused,Ae=r.useRef(null);r.useEffect(()=>{if(Ae.current===null){Ae.current=Pe,Pe&&je();return}Ae.current!==Pe&&(Ae.current=Pe,Pe?je():De())},[Pe,De,je]);const ge=r.useMemo(()=>{if(H.length===0)return-1;const f=H.findIndex(x=>x.assetKey==="BTC");return f>=0?f:0},[H]),_e=r.useMemo(()=>H.length===0?0:Ke>=0&&Ke<H.length?Ke:ge>=0?ge:0,[H,Ke,ge]),T=H[_e]??null,Se=r.useMemo(()=>T?Ks(T.assetKey,T.iconUrl):null,[T]),Te=r.useRef(null);r.useEffect(()=>{if(H.length===0||ge<0)return;const f=a?.trim();if(Te.current)if(f&&f.toLowerCase()===Te.current.toLowerCase())Te.current=null;else return;if(!f){Ke!==ge&&ct(ge);return}const x=sl(H,f);if(x>=0){Ke!==x&&ct(x);return}Ke!==ge&&ct(ge);const j=H[ge],g=`${On}/${ds(j.assetKey)}`;n.pathname!==g&&e(`${g}${n.search}${n.hash}`,{replace:!0})},[H,ge,a,Ke,n.pathname,n.search,n.hash,e]);const de=p?.treasuryStatus??"GREEN",G=r.useMemo(()=>T?.timeframes??[],[T]),F=T?.customTimeframe??null,ye=We===Cn,fe=ye?0:Math.min(We,Math.max(0,G.length-1)),O=r.useMemo(()=>ye&&F?{seconds:Ze??F.minSeconds,payoutBps:F.payoutBps,multiplier:F.multiplier,minBet:G[0]?.minBet??0,maxBet:G[0]?.maxBet??0}:G[fe]??null,[ye,F,Ze,G,fe]),Fe=O?.minBet??0,Oe=O?.maxBet??0,Re=r.useMemo(()=>{const f=parseFloat(q);return Number.isFinite(f)&&f>0?f:null},[q]),et=r.useMemo(()=>
1{if(Re===null)return null;const f=O?.multiplier??0;return f>0?Re*f:Re},[Re,O?.multiplier]),ve=r.useRef(null);r.useEffect(()=>{const f=O?.minBet??0;f>0&&(C(String(ve.current??f)),ve.current=null)},[Ke,fe,O?.minBet]);const tt=r.useRef(!1);r.useEffect(()=>{if(tt.current||!G.length)return;const f=new URLSearchParams(n.search),x=f.get("tf"),j=G.findIndex(oe=>String(oe.seconds)===x);j>=0&&qe(j);const g=Number(f.get("amount"));if(Number.isFinite(g)&&g>0){const oe=G[j>=0?j:fe],te=Math.max(oe.minBet,Math.min(oe.maxBet,g));j>=0&&j!==fe&&(ve.current=te),C(String(te))}const h=f.get("dir");(h==="UP"||h==="DOWN")&&xe(h),tt.current=!0},[G,n.search,fe]);const{price:Ye,prevPrice:xt,linePoints:D,candles:W,historyLoading:ie,isAssetReady:P}=Fr(T,Je),Z=P?Ye:null;r.useEffect(()=>{if(!P||H.length<=1)return;const f=T?.assetKey??null,x=H.map(h=>h.assetKey).filter(h=>h!==f&&Or(h));if(x.length===0)return;const j=[];let g=!1;return x.forEach((h,oe)=>{const te=setTimeout(()=>{g||Ur(h,1)},250+oe*150);j.push(te)}),()=>{g=!0,j.forEach(clearTimeout)}},[P,H,T?.assetKey]);const be=r.useRef(Ye),me=r.useRef(O),pe=r.useRef(T),Xe=r.useRef(q),at=r.useRef(Fe),dt=r.useRef(Oe),Ce=r.useRef(i),gt=r.useRef(c);r.useEffect(()=>{be.current=Z,me.current=O,pe.current=T,Xe.current=q,at.current=Fe,dt.current=Oe,Ce.current=i,gt.current=c}),r.useEffect(()=>{if(!c)return;let f=!1,x;return E(void 0,()=>{f||(x=setTimeout(()=>{E()},1e3))}),()=>{f=!0,clearTimeout(x)}},[c,E]);const yt=Kn(),_t=r.useMemo(()=>{if(!T)return[];const f=ue.filter(h=>h.assetKey===T.assetKey&&h.status==="OPEN"&&h.openPrice>0).map(h=>{const oe=h.openedAt>0?h.openedAt:h.placedAt,te=h.expiresAt>0?h.expiresAt:oe+(h.timeframe>0?h.timeframe*1e3:0);return{price:h.openPrice,time:oe,direction:h.direction,betId:String(h.id),amount:h.amount,payoutAmount:h.payoutAmount,expiresAt:te,closePrice:h.closePrice,closeTime:h.closePrice!==null&&h.closePrice!==void 0?h.expiresAt>0?h.expiresAt:h.settledAt:null,result:h.result}}),x=new Set([...f.map(h=>String(h.betId)),...A.map(h=>String(h.id)),...Array.from(ne.keys()).map(String)]),j=J.filter(h=>(!h.betId||!x.has(String(h.betId)))&&h.direction&&h.price>0),g=new Map;for(const h of[...f,...j]){const oe=h.betId?String(h.betId):`${h.direction}-${h.time}-${h.price}`;g.has(oe)||g.set(oe,h)}return Array.from(g.values())},[ue,A,ne,T,J]),St=r.useMemo(()=>new Set(G.map(f=>f.seconds)),[G]),{openBetCountsByTf:Nt,customOpenBetCount:kt}=r.useMemo(()=>{const f=new Map;let x=0;const j=T?.assetKey;if(!j)return{openBetCountsByTf:f,customOpenBetCount:0};for(const g of ue){if(g.assetKey!==j||g.status!=="OPEN"&&g.status!=="PENDING")continue;const h=g.timeframe;St.has(h)?f.set(h,(f.get(h)??0)+1):x+=1}return{openBetCountsByTf:f,customOpenBetCount:x}},[ue,T?.assetKey,St]),{focusedBetId:ft,positionViewport:vt,focusBet:st,focusNewBet:ot,clearFocus:Ct}=ka({betPoints:_t,assetKey:T?.assetKey}),wt=r.useCallback(()=>{we(),y(o("lt_err_insufficient_balance")),mn(s)},[s,we,y,o]),Ue=r.useCallback(async f=>{if(!gt.current)return m(),!1;const x=be.current,j=me.current,g=pe.current,h=at.current,oe=dt.current;if(!x||!j||!g)return!1;const te=parseFloat(Xe.current);if(!te||te<=0)return!1;if(h>0&&te<h)return u(o("lt_err_min_bet",{min:h.toLocaleString()})),!1;if(oe>0&&te>oe)return u(o("lt_err_max_bet",{max:oe.toLocaleString()})),!1;const Kt=parseFloat(Ce.current??"0")||0;if(te>Kt)return wt(),!1;X(f),ee();try{const nt=await R({assetKey:g.assetKey,direction:f,timeframeSecs:j.seconds,amountG:te,estMultiplier:j.multiplier});if(!nt)return!1;z();const Ve=j.multiplier??0,At=Ve>0?te*Ve:te,Tt=Date.now(),ws=Tt+j.seconds*1e3;return ae(js=>{const _r={price:x,time:Tt,direction:f,betId:nt.betId,amount:te,payoutAmount:At,expiresAt:ws},Sr=String(nt.betId);return[...js.filter(un=>!un.betId||String(un.betId)!==Sr),_r]}),ot(String(nt.betId)),It(nt.bet),Wn(),d(o("lt_success_bet_placed",{amount:te.toLocaleString(),direction:f})),N(),S(),!0}finally{X(null)}},[m,ee,R,z,It,N,S,wt,d,u,ot,o]),[Me,jt]=r.useState(!1),[Et,ss]=r.useState(null),[Ft,gs]=r.useState(0),[qs,ys]=r.useState(null),[Ys,Ot]=r.useState(null),[Xs,Zs]=r.useState("UP"),[Qs,Js]=r.useState(5),[en,tn]=r.useState(""),[sn,ns]=r.useState(!1),rr=r.useCallback(()=>{M(),ns(!0)},[M]),nn=r.useCallback(()=>ns(!1),[]),He=r.useRef(null),Ut=r.useRef(0),mt=r.useRef(Me),rn=r.useRef(Ue);r.useEffect(()=>{mt.current=Me},[Me]),r.useEffect(()=>{rn.current=Ue},[Ue]);const Rt=r.useCallback((f,x=!1)=>{He.current&&clearTimeout(He.current),He.current=null;const j=mt.current;Ut.current=0,mt.current=!1,j&&L(),jt(!1),ss(null),gs(0),ys(null),Ot(null),!(!j||f)&&_(o(x?"lt_auto_aborted":"lt_auto_stopped"))},[L,_,o]),_s=r.useCallback(()=>Rt(!1),[Rt]),Ss=r.useCallback(f=>{const x=be.current,j=me.current;if(!x||!j)return;He.current&&clearTimeout(He.current),He.current=null,Ut.current=0,mt.current=!0,ee(),ce(),jt(!0),ss(f),gs(0),ys(null),Ot(null),_(o("lt_auto_started",{n:f.totalBets,direction:f.direction}));const g=te=>f.direction==="UP"?"UP":f.direction==="DOWN"?"DOWN":te%2===0?"UP":"DOW
1N",h=(me.current?.seconds??j.seconds)*1e3,oe=async()=>{if(!mt.current)return;const te=Ut.current,Kt=g(te);ys(Kt),Ot(null);const nt=await rn.current(Kt);if(!mt.current)return;if(!nt){Rt(!1,!0);return}if(Ut.current=te+1,gs(te+1),Ut.current>=f.totalBets){He.current&&clearTimeout(He.current),He.current=null,L(),jt(!1),Ot(null),d(o("lt_auto_completed",{n:f.totalBets}));return}const Ve=Date.now()+h;Ot(Ve),He.current=setTimeout(()=>{oe()},h)};oe()},[ee,ce,L,_,d,o,Rt]),ar=r.useCallback(f=>{Ss(f),ns(!1)},[Ss]),or=r.useCallback(()=>{_s(),ns(!1)},[_s]);r.useEffect(()=>()=>{He.current&&clearTimeout(He.current)},[]);const Ns=r.useRef(O?.seconds),ks=r.useRef(T?.assetKey);r.useEffect(()=>{const f=O?.seconds,x=T?.assetKey,j=Ns.current!==void 0&&Ns.current!==f,g=ks.current!==void 0&&ks.current!==x;mt.current&&(j||g)&&Rt(!0),Ns.current=f,ks.current=x},[O?.seconds,T?.assetKey,Rt]);const lr=r.useCallback(f=>{const x=H[f];if(!x)return;M(),Te.current=ds(x.assetKey),ct(f),qe(0),w(null);const j=`${On}/${ds(x.assetKey)}`;n.pathname!==j&&e(`${j}${n.search}${n.hash}`)},[H,n.hash,n.pathname,n.search,e,M]),ir=r.useCallback(f=>{M(),qe(f),w(null)},[M]),cr=r.useCallback(()=>{M(),qe(Cn),F&&w(f=>f??F.minSeconds)},[F,M]),ur=r.useCallback(()=>{M(),window.location.reload()},[M]),dr=r.useMemo(()=>{if(!T)return[];const f=Date.now()-3e4,x=[],j=[...ue,...A];for(const g of j)g.assetKey===T.assetKey&&(g.closePrice===null||g.closePrice===void 0||g.settledAt===null||g.settledAt===void 0||g.settledAt<f||g.result!=="WIN"&&g.result!=="LOSE"&&g.result!=="REFUND"||x.push({betId:String(g.id),direction:g.direction,result:g.result,price:g.closePrice,time:g.expiresAt>0?g.expiresAt:g.settledAt,settledAt:g.settledAt}));return x},[ue,A,T]),lt=r.useMemo(()=>{if(D.length===0)return{base:null,high:null,low:null,range:null};let f=D[0].price,x=D[0].price;for(let j=1;j<D.length;j++){const g=D[j].price;g>f&&(f=g),g<x&&(x=g)}return{base:D[0].price,high:f,low:x,range:f-x}},[D]),vs=Ye,fr=xt;if(b)return t.jsx(il,{label:o("lt_loading_config")});if($||!p)return t.jsxs("div",{className:"ltLoading",children:[t.jsx(xn,{size:36,className:"ltErrorIcon"}),t.jsx("p",{className:"ltErrorText",children:$??o("lt_failed_load_config")})]});if(p.contractPaused)return t.jsxs("div",{className:"ltLoading",children:[t.jsx(xn,{size:36,className:"ltPausedIcon"}),t.jsxs("p",{className:"ltErrorText",children:[t.jsx("strong",{children:o("lt_contract_paused_title")}),t.jsx("br",{}),o("lt_contract_paused_desc")]})]});const Lt=vs!==null&&lt.base!==null&&lt.base>0?(vs-lt.base)/lt.base*100:null,mr=G.length>0?Math.max(...G.map(f=>f.multiplier)):.01,rs=T?.assetHash?fn(T.assetHash):void 0,Cs=typeof rs=="number"&&Number.isFinite(rs)&&rs>0?rs:Se?.decimals??2,an=Se?.prefix??"",on=f=>f===null?o("lt_stats_empty"):`${an}${ms(f,Cs)}`,pr=Lt===null?o("lt_stats_empty"):`${Lt>=0?"+":""}${Lt.toFixed(2)}%`,hr=Lt===null?"bssMuted":Lt>=0?"bssPos":"bssNeg",br=!!Z&&!!O,xr=o("lt_chart_waiting_price"),gr=o("lt_chart_waiting_candle"),yr=c?t.jsxs("button",{type:"button",className:`bcAutoBtn ${Me?"isActive":""}`,onClick:rr,"aria-label":o(Me?"lt_auto_open_active":"lt_auto_open"),title:o(Me?"lt_auto_open_active":"lt_auto_open"),"aria-pressed":sn,children:[t.jsx(Fs,{size:13,strokeWidth:2.25}),t.jsx("span",{className:"bcAutoBtnLabel",children:o("lt_auto_title")}),Me&&t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"bcAutoBtnCount",children:[Ft,"/",Et?.totalBets??0]}),t.jsx("span",{className:"bcAutoBtnPulse","aria-hidden":"true"})]})]}):null,ln=t.jsxs("div",{className:"ltAudioControls","aria-label":o("lt_audio_controls"),children:[t.jsx("button",{type:"button",className:`ltAudioBtn ${I?"isActive":""}`,onClick:k,"aria-pressed":I,"aria-label":o(I?"lt_audio_effects_disable":"lt_audio_effects_enable"),title:o(I?"lt_audio_effects_disable":"lt_audio_effects_enable"),children:I?t.jsx(na,{size:14,strokeWidth:2.25}):t.jsx(ra,{size:14,strokeWidth:2.25})}),t.jsx("button",{type:"button",className:`ltAudioBtn ${se?"isActive":""}`,onClick:v,"aria-pressed":se,"aria-label":o(se?"lt_audio_soundtrack_disable":"lt_audio_soundtrack_enable"),title:o(se?"lt_audio_soundtrack_disable":"lt_audio_soundtrack_enable"),children:t.jsx(aa,{size:14,strokeWidth:2.25})})]}),cn=t.jsxs("span",{className:"bcAssetMaxPayout",children:[t.jsxs("span",{className:"ltHeroMetaAccent",children:[mr.toFixed(2),"×"]})," ",o("lt_hero_chip_label")]});return t.jsxs("div",{className:"liveTrading",children:[t.jsx(Oa,{items:Jt}),t.jsxs("div",{className:"ltTopBar",children:[t.jsx("header",{className:"ltHero",children:t.jsxs("div",{className:"ltHeroActions",children:[t.jsxs("div",{className:"ltHeroMeta",children:[t.jsx("span",{children:o("lt_page_title")}),t.jsx("span",{className:"ltHeroMetaSep","aria-hidden":"true"}),cn]}),ln]})}),t.jsx(to,{assets:H,effectiveAssetIdx:_e,onSelectAsset:lr,isPlacing:U,onInteract:M})]}),(Zt||B)&&t.jsxs("div",{className:"ltConfigStale",role:"alert",children:[t.jsx(Vn,{size:14,className:"bcsIcon","aria-hidden":"true"}),t.jsxs("div",{className:"bcsText",children:[t.jsx("strong",{className:"bcsTitle",children:o("lt_config_stale_title")}),t.jsx("span",{className:"bcsDesc",children:o("lt_config_stale_desc")})]}),t.jsxs("button",{type:"button",onClick:ur,className:"bcsBtn",children:[t.jsx(zn,{size:12,className:"bcsBtnIcon","aria-hidden":"true"}),o("lt_config_stale_refresh")]})]}),t.jsxs("div",{className:"ltGrid",children:[t.jsxs("div",{className:"ltColView",children:[t.jsx(Yo,{chartType:Be,linePoints:D,candles:W,currentPrice:vs,prevPrice:fr,sessionDeltaPct:Lt,historyLoading:ie,decimals:Cs,pricePrefix:an,metaLabel:Se?.label??T?.assetKey??"—",treasuryTier:de,config:p,chartIntervalMins:Je,onChangeInterval:Ie,onChangeChartType:ut,betPoints:_t,settlingBets:ne,waitingLineLabel:xr,waitingCandleLabel:gr,footerExtras:t.jsxs(t.Fragment,{children:[yr,ln]}),assetExtra:cn,assetKey:T?.assetKey??"unknown",settledMarks:dr,ghostSettles:es,previewTfSeconds:O?.seconds??null,previewDirection:Y,previewAmount:Re,previewPayoutAmount:et,focu
1sedBetId:ft,positionViewport:vt,onFocusBet:st,onClearFocus:Ct,chartNowTick:yt}),t.jsxs("aside",{className:"ltSessionStats","aria-label":o("lt_stats_aria"),children:[t.jsxs("div",{className:"bssIntro",children:[t.jsx("span",{className:"bssTitle",children:o("lt_stats_title")}),t.jsx("span",{className:"bssDesc",children:o("lt_stats_desc",{asset:Se?.label??T?.assetKey??"Market"})})]}),t.jsxs("div",{className:"bssGrid",children:[t.jsxs("div",{className:"bssCell",children:[t.jsx("span",{className:"bssLabel",children:o("lt_stats_high")}),t.jsx("span",{className:"bssValue",children:on(lt.high)})]}),t.jsxs("div",{className:"bssCell",children:[t.jsx("span",{className:"bssLabel",children:o("lt_stats_low")}),t.jsx("span",{className:"bssValue",children:on(lt.low)})]}),t.jsxs("div",{className:"bssCell",children:[t.jsx("span",{className:"bssLabel",children:o("lt_stats_range")}),t.jsx("span",{className:"bssValue bssMuted",children:lt.range===null?o("lt_stats_empty"):ms(lt.range,Cs)})]}),t.jsxs("div",{className:"bssCell",children:[t.jsx("span",{className:"bssLabel",children:o("lt_stats_change")}),t.jsx("span",{className:`bssValue ${hr}`,children:pr})]})]})]}),t.jsx(Kr,{isLoggedIn:c,onLogin:m,openBets:ue,settledBets:A,settlingBets:ne,loading:re,settledLoading:ke,error:he,settledError:Ee,refresh:Xt,pagination:Qe,settledPagination:qt,goToPage:Bt,goToSettledPage:Yt,focusedBetId:ft,onFocusBet:st,onClearFocus:Ct,focusAssetKey:T?.assetKey})]}),t.jsx("div",{className:"ltColControls",children:t.jsxs("div",{className:"ltRail",children:[t.jsx(qa,{timeframes:G,customTf:F,safeIdx:fe,isCustomSelected:ye,customSeconds:Ze,onSelectTimeframe:ir,onSelectCustom:cr,onChangeCustomSeconds:w,isPlacing:U,minBet:Fe,maxBet:Oe,showCurrentTfMeta:!!O,onInteract:M,openBetCounts:Nt,customOpenBetCount:kt}),t.jsx(io,{betAmount:q,onChangeAmount:C,minBet:Fe,maxBet:Oe,payoutMultiplier:O?.multiplier??null,placingDir:Q,autoActive:Me,canPlace:br,onPlace:Ue,onInteract:M,onPreviewDirection:xe}),c&&t.jsx(kn,{isActive:Me,onStart:Ss,onStop:_s,timeframeSecs:O?.seconds??60,betsPlaced:Ft,totalBets:Et?.totalBets??0,lastDirection:qs,nextBetAt:Ys,onInteract:M,direction:Xs,betCount:Qs,customCount:en,onChangeDirection:Zs,onChangeBetCount:Js,onChangeCustomCount:tn})]})})]}),t.jsx(uo,{className:"bfFootnotePage"}),c&&t.jsx(Aa,{open:sn,onClose:nn,children:t.jsx(kn,{isActive:Me,onStart:ar,onStop:or,timeframeSecs:O?.seconds??60,betsPlaced:Ft,totalBets:Et?.totalBets??0,lastDirection:qs,nextBetAt:Ys,onInteract:M,direction:Xs,betCount:Qs,customCount:en,onChangeDirection:Zs,onChangeBetCount:Js,onChangeCustomCount:tn,forceExpanded:!0,headerActions:t.jsx("button",{type:"button",className:"atmClose",onClick:nn,"aria-label":o("lt_auto_close"),title:o("lt_auto_close"),children:t.jsx(Hs,{size:14,strokeWidth:2.25})})})}),Qt&&T&&t.jsx(el,{assetKey:T.assetKey})]})}class ul extends r.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,n){fs("boundary",{error:e,componentStack:n.componentStack})}handleReload=()=>{typeof window<"u"&&window.location.reload()};render(){return this.state.hasError?t.jsxs("div",{className:"ltBoundary",role:"alert","aria-live":"assertive",children:[t.jsx(Vn,{size:32,className:"ltBoundaryIcon","aria-hidden":"true"}),t.jsx("h2",{className:"ltBoundaryTitle",children:this.props.title}),t.jsx("p",{className:"ltBoundaryBody",children:this.props.description}),t.jsxs("button",{type:"button",onClick:this.handleReload,className:"ltBoundaryBtn",children:[t.jsx(zn,{size:14,strokeWidth:2.25,"aria-hidden":"true"}),t.jsx("span",{children:this.props.reloadLabel})]})]}):this.props.children}}const Sl=()=>{const s=$e();return t.jsx("main",{className:"liveTradingPage",children:t.jsx("div",{className:"liveTradingPageInner",children:t.jsx(ul,{title:s("lt_boundary_title"),description:s("lt_boundary_description"),reloadLabel:s("lt_boundary_reload"),children:t.jsx(cl,{})})})})};export{Sl as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.