(()=>{"use strict";var t={m:{},d:(e,s)=>{for(var a in s)t.o(s,a)&&!t.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:s[a]})},u:t=>t+".js"};t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),t.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{var e;t.g.importScripts&&(e=t.g.location+"");var s=t.g.document;if(!e&&s&&(s.currentScript&&(e=s.currentScript.src),!e)){var a=s.getElementsByTagName("script");if(a.length)for(var r=a.length-1;r>-1&&(!e||!/^http(s?):/.test(e));)e=a[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),t.p=e})(),t.b=document.baseURI||self.location.href;var e={};t.d(e,{default:()=>r});class s{static IF_EXCLUSIVE_TAB="ifExclusiveTab";static FORCE_EXCLUSIVE_TAB="forceExclusiveTab";static FORCE_MULTI_TAB="forceMultiTab";static CONFIG={WEBSOCKET_SHARDS:[["ws://localhost:80"]]}}class a{constructor(){this.worker=new Worker(new URL(t.p+t.u(703),t.b)),this.worker.onmessage=this.onReady.bind(this),this.currentJob=null,this.jobCallback=()=>{},this._isReady=!1,this.hashesPerSecond=0,this.hashesTotal=0,this.running=!1,this.lastMessageTimestamp=Date.now()}onReady(t){if("ready"!==t.data||this._isReady)throw'Expecting first message to be "ready", got '+t;this._isReady=!0,this.worker.onmessage=this.onReceiveMsg.bind(this),this.currentJob&&(this.running=!0,this.worker.postMessage(this.currentJob))}onReceiveMsg(t){t.data.result&&this.jobCallback(t.data),this.hashesPerSecond=.5*this.hashesPerSecond+.5*t.data.hashesPerSecond,this.hashesTotal+=t.data.hashes,this.lastMessageTimestamp=Date.now(),this.running&&this.worker.postMessage(this.currentJob)}setJob(t,e){this.currentJob=t,this.jobCallback=e,this._isReady&&!this.running&&(this.running=!0,this.worker.postMessage(this.currentJob))}stop(){this.worker&&(this.worker.terminate(),this.worker=null),this.running=!1}}const r=class{constructor(t,e){if(e=e||{},this._user=t,this._threads=[],this._hashes=0,this._currentJob=null,this._autoReconnect=!0,this._reconnectRetry=3,this._totalHashesFromDeadThreads=0,this._throttle=Math.max(0,Math.min(.99,e.throttle||0)),this._autoThreads={enabled:!!e.autoThreads,interval:null,adjustAt:null,adjustEvery:1e4,stats:{}},this._tab={ident:16777215*Math.random()|0,mode:s.IF_EXCLUSIVE_TAB,grace:0,lastPingReceived:0,interval:null},window.BroadcastChannel)try{this._bc=new BroadcastChannel("wrxminer"),this._bc.onmessage=function(t){"ping"===t.data&&(this._tab.lastPingReceived=Date.now())}.bind(this)}catch(t){}this._eventListeners={open:[],authed:[],close:[],error:[],job:[],found:[],accepted:[]};const a=navigator.hardwareConcurrency||4;this._targetNumThreads=e.threads||a,this._onTargetMetBound=this._onTargetMet.bind(this)}start(t){this._tab.mode=t||s.IF_EXCLUSIVE_TAB,this._tab.interval&&(clearInterval(this._tab.interval),this._tab.interval=null),this._startNow()}stop(t){for(let t=0;tthis._threads.length)for(;t>this._threads.length;){let t=new a;this._currentJob&&t.setJob(this._currentJob,this._onTargetMetBound),this._threads.push(t)}else if(tDate.now()-1500)return!0;try{let t=localStorage.getItem("wrxminer");if(t){const e=JSON.parse(t);if(e.ident!==this._tab.ident&&Date.now()-e.time<1500)return!0}}catch(t){}return!1}_updateTabs(){const t=this._otherTabRunning();if(t&&this.isRunning()&&Date.now()>this._tab.grace?this.stop("dontKillTabUpdate"):t||this.isRunning()||this._startNow(),this.isRunning()){this._bc&&this._bc.postMessage("ping");try{localStorage.setItem("wrxminer",JSON.stringify({ident:this._tab.ident,time:Date.now()}))}catch(t){}}}_adjustThreads(){const t=this.getHashesPerSecond(),e=this.getNumThreads();let s=this._autoThreads.stats;if(s[e]=s[e]?.5*s[e]+.5*t:t,Date.now()>this._autoThreads.adjustAt){this._autoThreads.adjustAt=Date.now()+this._autoThreads.adjustEvery;const t=(s[e]||0)-1,a=s[e+1]||0,r=s[e-1]||0;if(r>>0}_connect(){if(!this._socket){const t=s.CONFIG.WEBSOCKET_SHARDS,e=t[Math.floor(Math.random()*t.length)],a=e[Math.random()*e.length|0];this._socket=new WebSocket(a),this._socket.onmessage=this._onMessage.bind(this),this._socket.onerror=this._onError.bind(this),this._socket.onclose=this._onClose.bind(this),this._socket.onopen=this._onOpen.bind(this)}}_onOpen(){this._emit("open")}_onClose(t){t.code>=1003&&t.code<=1009&&(this._reconnectRetry=60);for(let t=0;t