const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ConnectButton-DhBw5pgh.js","assets/index-CXyQ5sGC.js","assets/lodash-CQGrF3PQ.js","assets/index-D5c7CNr0.css","assets/index-Vmx-EkLq.js","assets/index-FnRUSmLt.js","assets/walletConnect-CiycSUBb.js","assets/index-WG0D2_vB.js","assets/ConnectButton-BV4d8IVp.css","assets/PaymentMethodsInfoContainer-CrfRlXyc.css","assets/LiveChatAdviser-sk6MOq69.js"])))=>i.map(i=>d[i]); var re=Object.defineProperty;var ce=(s,o,t)=>o in s?re(s,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[o]=t;var h=(s,o,t)=>ce(s,typeof o!="symbol"?o+"":o,t);import{b as J,r as m,u as P,i as R,j as e,L as $,aL as le,gB as ge,gC as me,cC as Q,_ as X,cL as Z,P as E,S,gl as ue,B as M,s as de,A as he,gg as pe,d as ee,f as W,el as fe,gb as xe,gc as K,a as _e,T as v,gD as je,gE as Ne,ge as Ce,gF as Y,eY as we,gj as be,ct as Le,c as Ie,C as A,gG as ve,bI as Ee,gH as Se,gI as ye,dP as Te}from"./index-CXyQ5sGC.js";import{n as ke}from"./lodash-CQGrF3PQ.js";import{u as se,t as ne,v as Ae}from"./index-FnRUSmLt.js";import{U as Re,S as Me}from"./UkRegulationElements-TbTIeQjP.js";import{u as Pe,F as Oe}from"./useFacialVerification-Dh63wxaL.js";const De=3e3,Fe=s=>J(s),Be=({close:s})=>{const[{loading:o,info:t},u]=m.useState({loading:!1,info:null}),d=P();return m.useEffect(function(){let a=!0;return u(i=>({...i,loading:!0})),R.get({},"get_client_last_session_info").then(({result:i,details:l})=>{a&&u(i===0?{loading:!1,info:{loginIp:l.LoginIP,sessionId:l.SessionId,startDate:l.StartTime,withdrawableBalance:l.WithdrawableBalance}}:p=>({...p,loading:!1}))}).catch(()=>{a&&(u(i=>({...i,loading:!1})),s())}),()=>{a=!1}},[s]),o?e.jsx($,{}):t?e.jsxs("div",{className:"login-info",children:[e.jsx("h3",{className:"casino-popup-title",children:d("Login Info")}),e.jsxs("p",{children:[e.jsx("span",{className:"login-info-text",children:d("Last Login Date")}),e.jsx("span",{className:"login-info-value",children:e.jsx(le,{seconds:t.startDate,preset:"datetimeShort"})})]}),e.jsxs("p",{children:[e.jsx("span",{className:"login-info-text",children:d("Last Login IP address")}),e.jsx("span",{className:"login-info-value",children:t.loginIp})]}),e.jsxs("p",{children:[e.jsx("span",{className:"login-info-text",children:d("Withdrawable Balance")}),e.jsx("span",{className:"login-info-value",children:t.withdrawableBalance})]}),e.jsxs("p",{children:[e.jsx("span",{className:"login-info-text",children:d("Session ID")}),e.jsx("span",{className:"login-info-value",children:t.sessionId})]})]}):null};class We{constructor({domain:o,address:t,statement:u="",uri:d,version:r,chainId:a,nonce:i,issuedAt:l=new Date().toISOString(),expirationTime:p,notBefore:N}){h(this,"domain");h(this,"address");h(this,"statement");h(this,"uri");h(this,"version");h(this,"chainId");h(this,"nonce");h(this,"issuedAt");h(this,"expirationTime");h(this,"notBefore");this.domain=o,this.address=t,this.statement=u,this.uri=d,this.version=r,this.chainId=a,this.nonce=i,this.issuedAt=l,this.expirationTime=p,this.notBefore=N}prepareMessage(){return`${this.domain} wants you to sign in with your Ethereum account: ${this.address} URI: ${this.uri} Version: ${this.version} Chain ID: ${this.chainId} Nonce: ${this.nonce} Issued At: ${this.issuedAt}`+(this.expirationTime?` Expiration Time: ${this.expirationTime}`:"")+(this.notBefore?` Not Before: ${this.notBefore}`:"")}}const $e="get_client_nonce",Ge="login_client_with_metamask",Ve="6e60a1be362a0c9e852bd1412759475a269cab4cd85e7df00c458f109c2cf0c9",Ue=()=>{const{chain:s}=se(),{address:o}=ne();return{getNonce:m.useCallback(()=>R.get({public_address:o},$e).then(({details:{Nonce:r},result:a,result_text:i})=>{if(a===0)return r;if(a!=="-1001")throw new Error(i??"")}).catch(r=>{throw r}),[o]),getMessage:(r,a=Ve)=>new We({nonce:a,address:o,issuedAt:r,version:"1",chainId:s==null?void 0:s.id,uri:window.location.origin,domain:window.location.host}),doLoginRequest:(r,a,i={})=>R.get({signature:r,version:"1",chain_id:s==null?void 0:s.id,issued_at:a,public_address:o,uri:window.location.origin,domain:window.location.host,...i},Ge).then(l=>(ge(),me(),l))}},ze=Q(()=>X(()=>import("./ConnectButton-DhBw5pgh.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),He=({onSucceed:s,onFailure:o})=>{const{chain:t}=se(),{address:u,isConnected:d}=ne(),{signMessageAsync:r}=Ae(),{restoreLogin:a}=m.useContext(Z),{doLoginRequest:i,getMessage:l,getNonce:p}=Ue(),N=P(),[f,y]=m.useState(!1),C=()=>{de.dispatchEvent("addComponentPopup",{component:"AuthPopup",props:{popupContentType:he.RegisterViaWallet}})},T=m.useCallback(j=>{a({auth_token:j}),s==null||s()},[s,a]),b=m.useRef({close:ke}),O=m.useCallback(()=>{!(t!=null&&t.id)||!u||(y(!0),p().then(j=>{if(!j)C();else{b.current=E.open({type:"info",title:"Info",content:"Please confirm from your Wallet mobile app or extension and make sure you have chosen the right network.",buttons:[{label:"Ok"}]});const L=new Date().toISOString(),D=l(L,j);return r({message:D.prepareMessage()}).then(k=>(b.current.close(),i(k,L).then(({details:{Token:I},result:F,result_text:x})=>{if(F===0)T(I);else throw new Error(x||S)}).catch(I=>{throw new Error(I.msg||S)}))).catch(()=>{throw new Error(ue)})}}).catch(j=>{b.current.close(),o(j)}).finally(()=>y(!1)))},[u,t==null?void 0:t.id,i,l,p,T,o,r]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"connect-via-wallet",children:d?f?e.jsx($,{size:"small"}):e.jsx(M,{className:"btn a-color",onClick:O,title:"Login via connected wallet"}):null}),e.jsxs("div",{className:"connect-button-wrapper",children:[e.jsx("p",{className:"connect-button-text",children:N("or")}),e.jsx(ze,{})]})]})},qe=[[[{element:"email",name:"email"}]]],Ke=({closePopup:s})=>{const o=P(),{formElements:t,handleChange:u,formIsValid:d}=J(qe),r=t.email,[a,i]=m.useState(!1),{checkForVerification:l}=Pe(Oe.WRONG_LOGIN_ATTEMPTS),p=N=>{N.preventDefault(),l(t.email.value).then(()=>{i(!0),R.get({email:t.email.value},"send_wrong_login_attempts_reset_code").then(f=>{if(f.result===0){E.open({type:"success",title:"Email successfully sent, please check your email",buttons:[{label:"ok",callBack:s}]},W.High);return}throw new Error(f.result_text||"")}).catch(f=>{E.open({type:"error",title:f.message||S},W.High)}).finally(()=>{i(!1),s()})})};return e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"casino-popup-content",children:o("Your account has been locked due to the failed login attempts. To restore the login you have to confirm it via email verification")}),e.jsxs("form",{onSubmit:p,children:[e.jsx("div",{className:"entrance-f-item-bc",children:e.jsx(pe,{onChange:u,...r})},r.name),e.jsxs("div",{className:"login-wrong-attempts-buttons",children:[e.jsx(M,{className:"btn a-color",type:ee.SUBMIT,disabled:a||!d,title:"Send"}),e.jsx(M,{className:"btn a-outline",onClick:s,title:"Cancel"})]})]})]})},Ye=Q(()=>X(()=>import("./LiveChatAdviser-sk6MOq69.js"),__vite__mapDeps([10,1,2,3]))),Je={contentId:"sign_in_banners",showLoader:!1},Qe=({onFailure:s,onSucceed:o,formConfig:t,contentManagerTargetType:u,onResetPasswordClick:d=()=>{},onResetUsernameClick:r=()=>{}})=>{var H,q;const{userAuthentication:{login:{showSocialIcons:a},registration:{enableForgetUsername:i},authPopupAsWidget:l},app:{italianLicence:p,getFormsConfigFromCms:N}}=A,{formElements:f,formConfigForCurrentStep:y,handleChange:C,formIsValid:T,getData:b,showCurrentStepErrors:O,setRules:j}=Fe(t),{allowed_confirm_types:L,enable_confirm_restrictions:D}=fe(),{getSMSConfirmationCode:k}=xe(K.Login),{login:I}=m.useContext(Z),{loginInProgress:F}=_e(),x=P(),[{message:G,errorClassName:V},U]=m.useState({message:""});m.useEffect(()=>{v.dispatchEvent("trackingEvent",{category:"Authorization",action:"Clicked Login"})},[]);const te=({status:c,details:n},g)=>{var w;switch(v.dispatchEvent("trackingEvent",{category:"Authorization",action:"Login",label:`${Se}. Code ${c}`}),s&&s(),c){case 2472:case 2474:case 2476:case 2481:k({error:(n==null?void 0:n.Key)??"Wrong SMS Code",prefilledCode:(w=g.additionalParams)==null?void 0:w.confirmation_code,username:g.username,...D&&L&&L.includes(K.Login)?{hasLoginRestrictionFromConfirmationSettings:!0}:{}}).then(_=>z({...g,...g.login_type?{radio_value:g.login_type}:{},additionalParams:{...g.additionalParams,..._}}));break;case 3115:ye.showLocationError((n==null?void 0:n.Key)??(n==null?void 0:n.Message)??S);break;case De:E.open(_=>({type:"warning",title:"Warning",Component:()=>e.jsx(Ke,{closePopup:_})}));break;default:U({message:(n==null?void 0:n.Key)||(n==null?void 0:n.Message)||S,...(n==null?void 0:n.errorClassName)&&{errorClassName:n.errorClassName}})}},oe=()=>{v.dispatchEvent("trackingEvent",{category:"Authorization",action:"Login",label:Te}),o&&o(),p&&E.open(c=>({Component:()=>e.jsx(Be,{close:c})}),W.High)},z=c=>I(c).then(()=>oe()).catch(n=>{te(n.data??{status:NaN,details:{Key:n.message,errorClassName:n.errorClassName}},c)}),ae=c=>{if(c.preventDefault(),v.dispatchEvent("trackingEvent",{category:"Authorization",action:"Clicked Login Submit"}),T){const{username:n,...g}=b();k({username:n}).then(w=>{z({...g,username:n.trim(),additionalParams:{...w}})})}else O()},B=c=>{c===0?(d(),v.dispatchEvent("trackingEvent",{category:"Authorization",action:"Clicked Forgot Password"})):r()},ie=m.useMemo(()=>{var c;return(c=f.username)!=null&&c.mask?"password":["username","password"]},[(H=f.username)==null?void 0:H.mask]);return je(j,ie,N),e.jsxs("form",{id:Ne,className:`entrance-form-bc login ${u===Ce.PANEL?"panel":"popup"}`,onSubmit:ae,"data-scroll-lock-scrollable":"",children:[e.jsxs("div",{className:"form-sign-bc",children:[e.jsx("div",{className:"sg-n-text-row-1-bc",dangerouslySetInnerHTML:{__html:x("Already have an account?")}}),e.jsx("div",{className:"sg-n-text-row-2-bc",dangerouslySetInnerHTML:{__html:x("Sign in, we are waiting for you")}}),y.map((c,n)=>e.jsx(m.Fragment,{children:c.map(({name:g})=>{const{type:w,..._}=f[g];switch(w){case"text":return e.jsx("div",{className:"entrance-f-item-bc",children:e.jsx(Ie,{onChange:C,..._})},g);case"select":return e.jsx("div",{className:"entrance-f-item-bc",children:e.jsx(Le,{onChange:C,..._})},g);case"password":return e.jsx("div",{className:"entrance-f-item-bc",children:e.jsx(be,{onChange:C,..._})},g);case"checkbox":return e.jsx("div",{className:"entrance-f-item-bc entrance-f-item-checkbox-bc",children:e.jsx(we,{onChange:C,..._})},g);case"info":return e.jsx("div",{className:"entrance-f-item-bc",children:e.jsx(Y,{..._})},g);default:return null}})},n)),G&&e.jsx(Y,{props:{content:G,html:!0},...V&&{className:V}}),e.jsx("div",{className:"entrance-form-actions-holder-bc login-ext-1",children:e.jsxs("div",{className:"entrance-form-action-item-bc right",children:[F?e.jsx($,{size:"small"}):e.jsx(M,{className:"btn a-color",type:ee.SUBMIT,title:"Sign in"}),A.app.walletConnect.enabled&&A.app.walletConnect.login&&e.jsx(He,{onSucceed:o,onFailure:c=>{s==null||s(),U({message:c.message})}})]})}),(q=A.app.ukLicense)!=null&&q.enabled?e.jsx(Re,{}):null,e.jsx(ve,{isAuthPopup:!0}),!l&&e.jsx("div",{className:"sg-n-forgot-password-text",children:e.jsx(e.Fragment,{children:e.jsx("div",{className:"sg-n-forgot-password-text",children:i?e.jsxs(e.Fragment,{children:[x("Forgot your "),e.jsxs("span",{onClick:()=>B(0),className:"sg-n-forgot-password",children:[x("password")," "]}),x("or")," ",e.jsx("span",{onClick:()=>B(1),className:"sg-n-forgot-password",children:x("username?")})]}):e.jsx("p",{className:"sg-n-forgot-password",onClick:()=>B(0),children:x("Forgot your password?")})})})})]}),e.jsx("div",{className:"form-sign-in-slider-wrapper",children:e.jsx(Ee,{settings:Je})}),a?e.jsx(Me,{}):null,!l&&e.jsx(Ye,{})]})},Xe=m.memo(Qe),as=Object.freeze(Object.defineProperty({__proto__:null,default:Xe},Symbol.toStringTag,{value:"Module"}));export{Xe as L,as as a,Ue as u};