"use strict";(self.webpackChunkcrashlogic=self.webpackChunkcrashlogic||[]).push([[954],{6185:(e,t,n)=>{n.d(t,{Hp:()=>P,hd:()=>S,k:()=>g,oG:()=>A,p7:()=>B});var o=n(6345),r=n(6606),u=n(2663),a=n(342);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function c(e){for(var t=1;t0?h.current.betInfo[1].bet:h.current.bet,S-(2===h.current.winType?1:0),A),T=(0,r.multiplyWithPrecision)((B{n.r(t),n.d(t,{default:()=>G});var o=n(8416),r=n(5694),u=n(6606),a=n(1100),i=n.n(a),l=n(7156),c=n.n(l),s=n(6345),f=n(701),d=n(3953),p=n(8030),v=n(9234),b=n(8513),y=n(342),m=n(2663),h=n(6185);function g(e){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(e)}function S(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function B(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,o=new Array(t);n0),_e(e.isAutoBet&&e.autoBet>0),ke(e.autoBet),Ge(e.autoBet>0||e.autoCashout>1))}),[Z.pending,Z.current]),(0,o.useEffect)((function(){var e;L.enabled&&(null===(e=L.selected)||void 0===e?void 0:e.type)===s.BonusTypes.FreeBet&&null===Z.current&&null===Z.pending&&se(L.selected.bet)}),[L.enabled,null===(n=L.selected)||void 0===n?void 0:n.remainingCount,Z.pending,Z.current]),(0,o.useEffect)((function(){Te||D||(D=!0,m.xf||I("GalaxsysAutoPlay",{state:"finish",remainingCount:xe}))}),[Te]),(0,o.useEffect)((function(){R===_&&null!==Z.current&&Z.current.isAutoBet&&(ke(Z.current.autoBet),_e(Z.current.autoBet>0))}),[Z.current,R]),(0,o.useEffect)((function(){function e(e){var t,n;"emwindow"===(null==e||null===(t=e.data)||void 0===t?void 0:t.sender)&&"stopAutospins"===(null==e||null===(n=e.data)||void 0===n?void 0:n.name)&&(A(b.actions.updateStopAutoBets()),ke(0),_e(!1))}return window.addEventListener("message",e),m.xf||C("GalaxsysStopAutoPlay",(function(){A(b.actions.updateStopAutoBets()),ke(0),_e(!1)})),function(){window.removeEventListener("message",e),m.xf||O("GalaxsysStopAutoPlay")}}),[]),(0,o.useEffect)((function(){var e,t,n=Z.current||{};((null===(e=n.betInfo)||void 0===e||null===(e=e[0])||void 0===e?void 0:e.win)>0?(null===(t=n.betInfo)||void 0===t||null===(t=t[1])||void 0===t?void 0:t.bet)||0:n.bet)*(z-(2===n.winType?1:0))>=V&&ue.current&&R===N&&(ue.current=!1,A(b.actions.addNotification((0,u.getNotificationById)(H,998)))),R===_&&(ue.current=!0)}),[null===(a=Z.current)||void 0===a?void 0:a.bet,V,z,R]),(0,o.useEffect)((function(){!L.enabled&&xe>0&&(A(b.actions.cancelAutoBetData({index:g})),null===i()||void 0===i()||i().removeItem("pending_autobet_".concat(g)),null===i()||void 0===i()||i().removeItem("autobet_count_".concat(g)))}),[L.enabled]),(0,o.useEffect)((function(){var e;Te&&!Z.current&&(null===(e=ie.current)||void 0===e||e.focus())}),[Te]),(0,o.useEffect)((function(){var e;we&&!Z.current&&(null===(e=ae.current)||void 0===e||e.focus())}),[we]);var Fe=function(){var e=we?+(0,u.toNumberString)(ge):0;f.settings.playSound("bet");var t=(null==L?void 0:L.selected)||null,n=(t||{}).isGalaxsysBonus,o=(0,h.hd)(t);if(0!==e&&e<1.01)A(b.actions.addNotification((0,u.getNotificationById)(H,11)));else{if(m.xf&&q-me<0)return A(b.actions.addNotification((0,u.getNotificationById)(H,4))),void(q>=W&&se({value:W,validationValue:ce}));if(!me||meW)se({value:W,validationValue:ce});else{var a={gameId:J,activeGameId:m.N2,partnerId:m.y_,token:X,bet:me,combination:{autoCashout:e,isAutoBet:Te&&xe>0,index:g},betType:o,bonusId:(null==t?void 0:t.id)||0,autoBet:xe,index:g,isGalaxsysBonus:n};if(A(b.actions.addPendingStake(a)),R===_)if(m.xf)(0,r.batch)((function(){A(b.actions.addNotification((0,u.getNotificationById)(H,0))),A(b.actions.addDemoTicket({index:g}))}));else{A(b.actions.setPlayerPressed({index:g,pressed:!0}));var i=new y.Kb.AddStake(a);(0,d.requestToServer)(i)}}}},Ue=function(e){var t;if(M){var n=(null===(t=Z.current)||void 0===t?void 0:t.stakeId)||0;if(!n||m.xf){if(z<1.01)return void A(b.actions.addNotification((0,u.getNotificationById)(H,999)));A(b.actions.cashoutDemoTicket({index:g,cashoutType:e}))}else{A(b.actions.setPlayerPressed({index:g,pressed:!0,halfPressed:1===e}));var o=new y.Kb.StopStake({gameId:J,stakeId:n,ping:Q,token:X,index:g,cashoutType:e});(0,d.requestToServer)(o)}}},Re=function(){var e;if(M){f.settings.playSound("cancel");var t=(null==L?void 0:L.selected)||null,n=(0,h.hd)(t),o=(null===(e=Z.current)||void 0===e?void 0:e.stakeId)||0;if(Te&&!D&&(D=!0,m.xf||I("GalaxsysAutoPlay",{state:"finish",remainingCount:xe})),null===i()||void 0===i()||i().removeItem("pending_autobet_".concat(g)),null===i()||void 0===i()||i().removeItem("autobet_count_".concat(g)),!o||m.xf)A(b.actions.cancelMyTicket({index:g,stakeId:o}));else{A(b.actions.setPlayerPressed({index:g,pressed:!0}));var r=new y.Kb.CancelStake({gameId:J,stakeId:o,token:X,index:g,bet:+(0,u.toNumberString)(ce),betType:n});(0,d.requestToServer)(r)}}},Ke=(0,o.useCallback)((function(){Se(we?0:2.5),Ee(!we)}),[we]),Me=(0,o.useCallback)((function(){Te&&Le(),we&&Ke(),Ge((function(e){return e&&(null===i()||void 0===i()||i().removeItem("autobet_count_".concat(g)),null===i()||void 0===i()||i().removeItem("pending_autobet_".concat(g))),!e}))}),[De,Te,we]),Le=(0,o.useCallback)((function(){(R===_||R===N&&null===Z.current)&&Te&&Re(),_e((function(e){return e?(null===i()||void 0===i()||i().removeItem("autobet_count_".concat(g)),null===i()||void 0===i()||i().removeItem("pending_autobet_".concat(g)),ke(0)):ke(10),!e}))}),[L,R,Z.current,ce,Te,we,ge,g,ie.current,J]),qe=(0,o.useCallback)((function(e){return pe(+e)}),[]),He=(0,o.useCallback)((function(){A(b.actions.openPopup({name:p.BASE_POPUP_NAMES.KEYBOARD,args:{title:oe,getter:ce,setter:se,config:{extended:!0,dot:!0}}}))}),[ce]),Ye=(0,o.useCallback)((function(){A(b.actions.openPopup({name:p.BASE_POPUP_NAMES.KEYBOARD,args:{type:s.KEYBOARD_POPUP_NAMES.AUTO_CASHOUT,title:ne,getter:ge,setter:Se,config:{extended:!1,dot:!0}}}))}),[ge]),Je=(0,o.useCallback)((function(){A(b.actions.openPopup({name:p.BASE_POPUP_NAMES.KEYBOARD,args:{type:s.KEYBOARD_POPUP_NAMES.AUTO_BET,title:te,getter:xe,setter:ke,config:{extended:!1,dot:!1}}}))}),[xe]),Qe=(0,o.useMemo)((function(){return!(!Z.current&&!Z.pending)||""}),[Z]),Xe=P((null==Z||null===(l=Z.current)||void 0===l?void 0:l.betInfo)||[],2),$e=Xe[0],ze=Xe[1],Ze=null==$e?void 0:$e.win,et=null==ze?void 0:ze.win,tt=(0,h.Hp)({resources:H,bonuses:L,status:R,stake:Z,isFullCashout:ee,coefficient:z,maxWin:V,precision:F},S),nt=tt.type===E||tt.type===w&&!Te;return B(B({},tt),{},{buttonState:tt,info1Win:Ze,info2Win:et,isAuto:De,toggleAutoPart:Me,stake:Z,status:R,culture:m.TG,currencyId:K,precision:F,bonuses:L,quickBets:Y,disabled:Qe,disableAutobet:nt,cashoutRef:ae,autoCashout:ge,isAutoCashout:we,isAutoBet:Te,bet:ce,betRef:re,autoBetRef:ie,autoBet:xe,handleAutoCashoutChange:Ke,handleAutoBetChange:Le,handleQuickBetClick:qe,handleAllInClick:ye,handleDoubleBetClick:be,handleBetInputClick:He,handleAutoCashoutInputClick:Ye,handleAutoBetInputClick:Je,handlePartialCashout:function(){var e=me*z>V?y.AS.Full:y.AS.Partial;m.xf?z>1?Ue(e):A(b.actions.addNotification((0,u.getNotificationById)(H,999))):Ue(e)},handleButtonClick:function(e){var t;switch(e){case j:case T:Fe();break;case E:Ue((null===(t=Z.current)||void 0===t?void 0:t.betInfo[0].win)>0?y.AS.FullAfterPartial:y.AS.Full);break;case w:var n;Te&&null!==(n=Z.current)&&void 0!==n&&n.stakeId&&ke(xe+1),Re();break;default:Fe()}},handleIncrementBet:Ve,handleDecrementBet:We,handleBetInputChange:fe,handleBetInputKey:de,handleAutoCashoutInputChange:Be,handleAutoCashoutInputKey:Ae,handleAutoBetInputChange:Ce,handleAutoBetInputKey:Ie,resources:H})}}}]);