1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1494,1655,2502],{36767:function(t,e,n){n.r(e),n.d(e,{WebSocketContext:function(){return o},useWebSocketContext:function(){return s}});var i=n(2265);let o=(0,i.createContext)(void 0),s=()=>{let t=(0,i.useContext)(o);if(!t)throw Error("useWebSocketContext must be used within WebSocketProvider");return t}},29373:function(t,e,n){n.r(e),n.d(e,{WebSocketProvider:function(){return g}});var i=n(57437),o=n(68575),s=n(35447),c=n(2265),l=n(14086),r=n(29892);class a{setupVisibilityHandler(){this.visibilityHandler=()=>{if("visible"===document.visibilityState){var t;(null===(t=this.socket)||void 0===t?void 0:t.connected)||this.connect()}},document.addEventListener("visibilitychange",this.visibilityHandler)}static getInstance(){return a.instance||(a.instance=new a),a.instance}setUserId(t){var e;this.userId=t,(null===(e=this.socket)||void 0===e?void 0:e.connected)&&this.userId&&this.authenticate()}setAuthData(t,e,n){var i;this.userId=t,this.vipLevel=e,this.agentId=n,(null===(i=this.socket)||void 0===i?void 0:i.connected)&&this.userId&&this.authenticate()}configure(t){var e;this.config=t,this.pingInterval=null!==(e=t.pingInterval)&&void 0!==e?e:3e4}connect(){var t,e,n,i;if(this.isConnecting||(null===(t=this.socket)||void 0===t?void 0:t.connected))return this.socket;if(!(null===(e=this.config)||void 0===e?void 0:e.url)||!this.config.url.startsWith("http://")&&!this.config.url.startsWith("https://"))return null;if(this.socket){try{this.socket.removeAllListeners(),this.socket.disconnect()}catch(t){}this.socket=null}this.isConnecting=!0,this.shouldReconnect=!0;try{let t={path:"/socket.io",reconnection:!0,reconnectionAttempts:null!==(n=this.config.reconnectAttempts)&&void 0!==n?n:5,reconnectionDelay:null!==(i=this.config.reconnectInterval)&&void 0!==i?i:1e3,reconnectionDelayMax:5e3,timeout:2e4,transports:["websocket","polling"]};this.socket=(0,r.io)(this.config.url,t),this.socket.on("connect",()=>{var t,e;this.isConnecting=!1,this.userId&&this.authenticate(),this.startHeartbeat(),null===(e=this.config)||void 0===e||null===(t=e.onOpen)||void 0===t||t.call(e)}),this.socket.on("authenticated",t=>{var e,n;null===(n=this.config)||void 0===n||null===(e=n.onAuthenticated)||void 0===e||e.call(n,t)});let e=t=>{var e,n;let i=Array.isArray(t)?t[0]:t,o=i&&"object"==typeof i?i:{data:i};null===(n=this.config)||void 0===n||null===(e=n.onMessage)||void 0===e||e.call(n,{type:"LOGOUT",data:null!=o?o:{},timestamp:new Date})};this.socket.on("logout",e),this.socket.on("LOGOUT",e);let o=["UPDATEBALANCE","WITHDRAW_UPDATE","DEPOSIT_UPDATE","BONUS_CLAIMED","POPUPNOTIFICATION","POPUPNOTIFICATIONMODAL"];this.socket.on("notification",t=>{var e,n,i,s;let c={type:o.includes(t.type)?t.type:"NOTIFICATION",data:t,payload:{message:t.message,data:t},timestamp:t.timestamp?new Date(t.timestamp):new Date};c.id=t.id,c.userId=t.userId||"public",null===(n=this.config)||void 0===n||null===(e=n.onNotification)||void 0===e||e.call(n,t),null===(s=this.config)||void 0===s||null===(i=s.onMessage)||void 0===i||i.call(s,c)});let s=t=>{var e,n;let i=Array.isArray(t)?t[0]:t,o={type:"UPDATEBALANCE",data:i&&"object"==typeof i?i:{data:i},timestamp:new Date};null===(n=this.config)||void 0===n||null===(e=n.onMessage)||void 0===e||e.call(n,o)};this.socket.on("updatebalance",s),this.socket.on("UPDATEBALANCE",s),this.socket.on("popupnotification",t=>{var e,n,i,o;let s={type:"POPUPNOTIFICATION",data:t,payload:{message:t.message,data:t},timestamp:t.timestamp?new Date(t.timestamp):new Date};s.id=t.id,s.userId=t.userId||"public",null===(n=this.config)||void 0===n||null===(e=n.onNotification)||void 0===e||e.call(n,t),null===(o=this.config)||void 0===o||null===(i=o.onMessage)||void 0===i||i.call(o,s)});let c=t=>{var e,n;let i=Array.isArray(t)?t[0]:t;null===(n=this.config)||void 0===n||null===(e=n.onMessage)||void 0===e||e.call(n,{type:"WITHDRAW_UPDATE",data:i&&"object"==typeof i?i:{data:i},timestamp:new Date})};this.socket.on("withdrawupdate",c),this.socket.on("WITHDRAW_UPDATE",c);let l=t=>{var e,n;let i=Array.isArray(t)?t[0]:t;null===(n=this.config)||void 0===n||null===(e=n.onMessage)||void 0===e||e.call(n,{type:"DEPOSIT_UPDATE",data:i&&"object"==typeof i?i:{data:i},timestamp:new Date})};this.socket.on("depositupdate",l),this.socket.on("DEPOSIT_UPDATE",l);let a=t=>{var e,n;let i=Array.isArray(t)?t[0]:t;null===(n=this.config)||void 0===n||null===(e=n.onMessage)||void 0===e||e.call(n,{type:"BONUS_CLAIMED",data:i&&"object"==typeof i?i:{data:i},timestamp:new Date})};this.socket.on("bonusclaimed",a),this.socket.on("BONUS_CLAIMED",a),this.socket.on("popupnotificationmodal",t=>{var e,n,i,o;let s={type:"POPUPNOTIFICATIONMODAL",data:t,payload:{message:t.message,data:t},timestamp:t.timestamp?new Date(t.timestamp):new Date};s.id=t.id,s.userId=t.userId||"public",null===(n=this.config)||void 0===n||null===(e=n.onNotification)||void 0===e||e.call(n,t),null===(o=this.config)||void 0===o||null===(i=o.onMessage)||void 0===i||i.call(o,s)}),this.socket.on("announcement",t=>{var e,n,i,o;let s={type:"ANNOUNCEMENT",data:t,payload:{message:t.message,data:t},timestamp:t.timestamp?new Date(t.timestamp):new Date};s.id=t.id,s.userId="public",null===(n=this.config)||void 0===n||null===(e=n.onAnnouncement)||void 0===e||e.call(n,t),null===(o=this.config)||void 0===o||null===(i=o.onMessage)||void 0===i||i.call(o,s)}),this.socket.on("pong",t=>{var e,n;null===(n=this.config)||void 0===n||null===(e=n.onPong)||void 0===e||e.call(n,t)}),this.socket.on("disconnect",t=>{var e,n,i;this.isConnecting=!1,this.stopHeartbeat(),null===(n=this.config)||void 0===n||null===(e=n.onClose)||void 0===e||e.call(n,t),"io server disconnect"===t&&this.shouldReconnect&&(null===(i=this.socket)||void 0===i||i.connect())}),this.socket.on("error",t=>{var e,n;let i=(null==t?void 0:t.message)||("string"==typeof t?t:"Unknown error");this.isConnecting=!1,null===(n=this.config)||void 0===n||null===(e=n.onError)||void 0===e||e.call(n,{message:i})}),this.socket.on("connect_error",t=>{var e,n;this.isConnecting=!1,null===(n=this.config)||void 0===n||null===(e=n.onError)||void 0===e||e.call(n,{message:t.message})});let u=setTimeout(()=>{var t;(null===(t=this.socket)||void 0===t?void 0:t.connected)||this.isConnecting},1e4);return this.socket.on("connect",()=>{clearTimeout(u)}),this.socket}catch(t){return this.isConnecting=!1,null}}authenticate(){var t;if((null===(t=this.socket)||void 0===t?void 0:t.connected)&&this.userId)try{let t={userId:this.userId};void 0!==this.vipLevel&&(t.vipLevel=this.vipLevel),this.agentId&&(t.agentId=this.agentId),this.socket.emit("authenticate",t)}catch(t){}}disconnect(){if(this.shouldReconnect=!1,this.stopHeartbeat(),this.socket)try{this.socket.io.opts.reconnection=!1,this.socket.removeAllListeners(),this.socket.disconnect()}catch(t){}finally{this.socket=null}this.isConnecting=!1}sendMessage(t){var e;if(null===(e=this.socket)||void 0===e?void 0:e.connected)try{let e=t.type.toLowerCase()||"message";this.socket.emit(e,{...t,timestamp:new Date,userId:this.userId})}catch(t){}}getStatus(){return this.socket?this.socket.connected?"connected":this.socket.disconnected?"disconnected":"connecting":"disconnected"}startHeartbeat(){this.stopHeartbeat(),this.pingTimer=setInterval(()=>{var t;(null===(t=this.socket)||void 0===t?void 0:t.connected)&&this.socket.emit("ping")},this.pingInterval)}stopHeartbeat(){this.pingTimer&&(clearInterval(this.pingTimer),this.pingTimer=void 0)}constructor(){this.socket=null,this.isConnecting=!1,this.shouldReconnect=!0,this.pingInterval=3e4,this.setupVisibilityHandler()}}var u=n(20418);let d=t=>{var e;let n=(0,c.useRef)(a.getInstance()),i=(0,c.useRef)(null),{authenticated:r,fetchBalance:d}=(0,u.E)(),h=(0,o.v9)(t=>t.user.data),[v,g]=(0,c.useState)(!1),[f,p]=(0,c.useState)(null),[m,k]=(0,c.useState)(null),I=(0,c.useRef)(t),A=(0,c.useRef)(null);(0,c.useEffect)(()=>{I.current=t},[t]);let y=(0,c.useCallback)(()=>
1{if(!r||!(null==h?void 0:h._id)){k(Error("Authentication required"));return}if(!I.current.url){k(Error("Socket.IO URL not configured"));return}try{let t={...I.current,url:I.current.url,onMessage:t=>{var e,n,i,o,c,r,a,u;switch(p(t),t.type){case"LOGOUT":if(!function(t){let e=function(t){if(!t||"object"!=typeof t)return null;if("string"==typeof t.sessionId&&t.sessionId)return t.sessionId;if(t.data&&"object"==typeof t.data){let e=t.data;if("string"==typeof e.sessionId&&e.sessionId)return e.sessionId}return null}(t);if(!e)return!0;let n=(0,l.C$)();return!n||e===n}(t.data))break;(0,s.$9)(),localStorage.clear(),sessionStorage.clear(),window.location.href="/login";break;case"UPDATEBALANCE":case"WITHDRAW_UPDATE":case"DEPOSIT_UPDATE":case"BONUS_CLAIMED":A.current&&clearTimeout(A.current),A.current=setTimeout(()=>{A.current=null,d()},300);break;case"NOTIFICATION":null===(e=(n=I.current).onMessage)||void 0===e||e.call(n,t);break;case"ANNOUNCEMENT":null===(i=(o=I.current).onMessage)||void 0===i||i.call(o,t);break;case"POPUPNOTIFICATION":null===(c=(r=I.current).onMessage)||void 0===c||c.call(r,t);break;default:null===(a=(u=I.current).onMessage)||void 0===a||a.call(u,t)}},onError:t=>{var e,n;k(Error(t.message||"Socket.IO error occurred")),null===(e=(n=I.current).onError)||void 0===e||e.call(n,t)},onOpen:()=>{var t,e;g(!0),k(null),null===(t=(e=I.current).onOpen)||void 0===t||t.call(e)},onClose:t=>{var e,n;g(!1),null===(e=(n=I.current).onClose)||void 0===e||e.call(n,t)},onAuthenticated:()=>{g(!0),k(null)}};n.current.configure(t);let{vipLevel:e}=h.levelInfo,{agentId:o}=h;n.current.setAuthData(h._id,e,o);let c=n.current.connect();if(!c)throw Error("Failed to establish Socket.IO connection");i.current=c,c.connected?g(!0):g(!1)}catch(t){k(t instanceof Error?t:Error("Failed to connect"))}},[r,h,d]),b=(0,c.useCallback)(()=>{n.current.disconnect(),i.current=null,g(!1)},[]);return(0,c.useEffect)(()=>{let t=()=>{"visible"===document.visibilityState&&!v&&r&&(null==h?void 0:h._id)&&y()};return document.addEventListener("visibilitychange",t),()=>{document.removeEventListener("visibilitychange",t)}},[v,r,null==h?void 0:h._id,y]),(0,c.useEffect)(()=>{let t=i.current;if(!t){g(!1);return}g(t.connected);let e=()=>g(!0),n=()=>g(!1),o=()=>g(!0);return t.on("connect",e),t.on("disconnect",n),t.on("authenticated",o),()=>{t.off("connect",e),t.off("disconnect",n),t.off("authenticated",o)}},[null===(e=i.current)||void 0===e?void 0:e.id]),(0,c.useEffect)(()=>(r&&(null==h?void 0:h._id)?y():b(),()=>{A.current&&(clearTimeout(A.current),A.current=null),b()}),[r,null==h?void 0:h._id,y,b]),{isConnected:v,lastMessage:f,sendMessage:(0,c.useCallback)(t=>{n.current.sendMessage(t)},[]),error:m,connect:y,disconnect:b,setLastMessage:p}};var h=n(60834),v=n(36767);let g=t=>{let{children:e}=t,n=d({url:"https://wss.xyes.com",reconnectAttempts:5,reconnectInterval:1e3,pingInterval:3e4,onMessage:t=>{}});return(0,h.b)(),(0,i.jsx)(v.WebSocketContext.Provider,{value:n,children:e})}},60834:function(t,e,n){n.d(e,{b:function(){return s}});var i=n(2265),o=n(99376);let s=()=>{let t=(0,o.useSearchParams)().get("promotionCode");return(0,i.useEffect)(()=>{t&&(document.cookie="promotionCode=".concat(t,"; path=/; max-age=").concat(3600))},[t]),{getPromotionCode:()=>{var t;return(null===(t=document.cookie.split("; ").find(t=>t.startsWith("promotionCode=")))||void 0===t?void 0:t.split("=")[1])||""},setPromotionCode:t=>{document.cookie="promotionCode=".concat(t,"; path=/; max-age=").concat(3600)}}}},43161:function(t,e,n){n.d(e,{m:function(){return c}});var i=n(2265),o=n(60033),s=n(68575);let c=()=>{let{getLang:t}=(0,o.i)(),e=(0,s.v9)(t=>t.user.data);return{getLink:(0,i.useCallback)(n=>{let i=t()||(null==e?void 0:e.settings.language);if("en"!==String(i).toLowerCase()&&"en-us"!==String(i).toLowerCase()){let t;if(n){let e=n.startsWith("/")?n:"/".concat(n);t="/".concat(i).concat(e)}else t="/".concat(i);return t}return n?n.startsWith("/")?n:"/".concat(n):"/"},[t,null==e?void 0:e.settings.language])}}}}]);
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.