@irshat/robot-ui 1.10.38 → 1.10.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -598,4 +598,4 @@ function e(e){return e&&e.i&&Object.prototype.hasOwnProperty.call(e,"default")?e
|
|
|
598
598
|
background: rgba(0, 0, 0, 0);
|
|
599
599
|
backdrop-filter: blur(0rem);
|
|
600
600
|
}
|
|
601
|
-
`;function _c(){const e=J();return d.useEffect(()=>{e(hr(!0))},[]),s.jsx(yc,{})}const Sc={status:Gn.NOT_CONNECT,signals:[],candles:{}},Cc=gn({name:"websocket",initialState:Sc,reducers:{wsStatus:(e,t)=>{e.status=t.payload},pushSignal:(e,t)=>{e.signals.unshift(t.payload)},setSignalsHistory:(e,t)=>{e.signals=[...t.payload]},setCandles:(e,t)=>{e.candles=t.payload}}}),{wsStatus:Tc,pushSignal:Ac,setSignalsHistory:Ec,setCandles:Mc}=Cc.actions;var $c,jc={exports:{}};var Rc=function(){if($c)return jc.exports;$c=1;var e,t="object"==typeof Reflect?Reflect:null,n=t&&"function"==typeof t.apply?t.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};e=t&&"function"==typeof t.ownKeys?t.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var r=Number.isNaN||function(e){return e!=e};function i(){i.init.call(this)}jc.exports=i,jc.exports.once=function(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,o),r(n)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}p(e,t,o,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&p(e,"error",t,n)}(e,i,{once:!0})})},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var o=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function s(e){return void 0===e._maxListeners?i.defaultMaxListeners:e._maxListeners}function u(e,t,n,r){var i,o,u;if(a(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),u=o[t]),void 0===u)u=o[t]=n,++e._eventsCount;else if("function"==typeof u?u=o[t]=r?[n,u]:[u,n]:r?u.unshift(n):u.push(n),(i=s(e))>0&&u.length>i&&!u.warned){u.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+u.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=u.length,console&&console.warn}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function c(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=l.bind(r);return i.listener=n,r.wrapFn=i,i}function f(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):h(i,i.length)}function d(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function h(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function p(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,function i(o){r.once&&e.removeEventListener(t,i),n(o)})}}return Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=e}}),i.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},i.prototype.getMaxListeners=function(){return s(this)},i.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=o[e];if(void 0===u)return!1;if("function"==typeof u)n(u,this,t);else{var l=u.length,c=h(u,l);for(r=0;r<l;++r)n(c[r],this,t)}return!0},i.prototype.addListener=function(e,t){return u(this,e,t,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(e,t){return u(this,e,t,!0)},i.prototype.once=function(e,t){return a(t),this.on(e,c(this,e,t)),this},i.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,c(this,e,t)),this},i.prototype.removeListener=function(e,t){var n,r,i,o,s;if(a(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,s||t)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},i.prototype.listeners=function(e){return f(this,e,!0)},i.prototype.rawListeners=function(e){return f(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):d.call(e,t)},i.prototype.listenerCount=d,i.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]},jc.exports}();const Oc=e(Rc);const Lc=new class extends Oc{constructor(){super(),this._permit=!0,window.addEventListener("message",this._handleIframeMessage.bind(this),!1)}set lock(e){this._permit=e}R(e,t){try{const n=rr();n&&window.parent&&window.parent.postMessage({id:n,event:e,data:t},"*")}catch(n){}}_handleIframeMessage(e){try{if(!this._permit)return;const t=e.data;"object"==typeof t&&"id"in t&&t.id===rr()&&"event"in t&&"data"in t&&this.emit(t.event,t.data)}catch(t){}}};const Pc=((e={})=>{const t=new Map,n=new Map,{extra:r,onError:i=Vn}=e;Tn(i);const o=e=>(e=>(e.unsubscribe=()=>t.delete(e.id),t.set(e.id,e),t=>{e.unsubscribe(),t?.cancelActive&&Hn(e)}))(Bn(t,e)??zn(e));Pn(o,{withTypes:()=>o});const a=e=>{const n=Bn(t,e);return n&&(n.unsubscribe(),e.cancelActive&&Hn(n)),!!n};Pn(a,{withTypes:()=>a});const s=async(e,a,s,u)=>{const l=new AbortController,c=Fn(o,l.signal),f=[];try{e.pending.add(l),(e=>{const t=n.get(e)??0;n.set(e,t+1)})(e),await Promise.resolve(e.effect(a,Pn({},s,{getOriginalState:u,condition:(e,t)=>c(e,t).then(Boolean),take:c,delay:Ln(l.signal),pause:On(l.signal),extra:r,signal:l.signal,fork:Dn(l.signal,f),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==l&&($n(e,_n),n.delete(e))})},cancel:()=>{$n(l,_n),e.pending.delete(l)},throwIfCancelled:()=>{jn(l.signal)}})))}catch(d){d instanceof Cn||Qn(i,d,{raisedBy:"effect"})}finally{await Promise.all(f),$n(l,Sn),(e=>{const t=n.get(e)??1;1===t?n.delete(e):n.set(e,t-1)})(e),e.pending.delete(l)}},u=((e,t)=>()=>{for(const e of t.keys())Hn(e);e.clear()})(t,n);return{middleware:e=>n=>r=>{if(!de(r))return n(r);if(Un.match(r))return o(r.payload);if(Kn.match(r))return void u();if(Wn.match(r))return a(r.payload);let l=e.getState();const c=()=>{if(l===In)throw new Error(Zn(23));return l};let f;try{if(f=n(r),t.size>0){const n=e.getState(),o=Array.from(t.values());for(const t of o){let o=!1;try{o=t.predicate(r,n,l)}catch(d){o=!1,Qn(i,d,{raisedBy:"predicate"})}o&&s(t,r,e,c)}}}finally{l=In}return f},startListening:o,stopListening:a,clearListeners:u}})();Pc.startListening({actionCreator:wr,effect:e=>{if(e.payload){const e=ld.getState(),t=e.ui,n=e.api,r=n.account===er.REAL?n.minAmount:n.minAmountDemo,i=n.account===er.REAL?n.maxAmount:n.maxAmountDemo;if(t.amount<r)return ld.dispatch(dr({type:"warning",text:ns(t.localCode||"en","check_minAmount")})),void ld.dispatch(wr(!1));if(t.amount>i)return ld.dispatch(dr({type:"warning",text:ns(t.localCode||"en","check_maxAmount")})),void ld.dispatch(wr(!1));if(0===n.balance||n.balance<n.minAmount)return ld.dispatch(dr({type:"warning",text:ns(t.localCode||"en","no_balance",[n.symbol.concat(String(n.balance))])})),void ld.dispatch(wr(!1));if(t.amount>n.balance)return ld.dispatch(dr({type:"warning",text:ns(t.localCode||"en","insufficient_balance",[n.symbol.concat(String(t.amount))])})),void ld.dispatch(wr(!1));if(t.isTp&&t.tp<=n.balance)return ld.dispatch(dr({type:"warning",text:ns(t.localCode||"en","tp_err")})),void ld.dispatch(wr(!1));if(t.isSl&&t.sl>=n.balance)return ld.dispatch(dr({type:"warning",text:ns(t.localCode||"en","sl_err")})),void ld.dispatch(wr(!1));ld.dispatch(dr())}}}),Pc.startListening({actionCreator:Rr,effect:e=>{ld.getState()}}),Pc.startListening({actionCreator:pr,effect:e=>{Lc.R("23",e.payload)}}),Pc.startListening({actionCreator:mr,effect:e=>{Lc.R("22",e.payload)}}),Pc.startListening({actionCreator:gr,effect:(e,t)=>{e.payload&&t.dispatch(wr(!1))}}),Pc.startListening({actionCreator:hr,effect:(e,t)=>{e.payload&&Lc.R("24",e.payload)}});const Ic=Object.create(null);Ic.open="0",Ic.close="1",Ic.ping="2",Ic.pong="3",Ic.message="4",Ic.upgrade="5",Ic.noop="6";const Nc=Object.create(null);Object.keys(Ic).forEach(e=>{Nc[Ic[e]]=e});const Dc={type:"error",data:"parser error"},Fc="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),qc="function"==typeof ArrayBuffer,zc=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Bc=({type:e,data:t},n,r)=>Fc&&t instanceof Blob?n?r(t):Hc(t,r):qc&&(t instanceof ArrayBuffer||zc(t))?n?r(t):Hc(new Blob([t]),r):r(Ic[e]+(t||"")),Hc=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function Qc(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Uc;const Kc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wc="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let hd=0;hd<64;hd++)Wc[Kc.charCodeAt(hd)]=hd;const Vc="function"==typeof ArrayBuffer,Zc=(e,t)=>{if("string"!=typeof e)return{type:"message",data:Xc(e,t)};const n=e.charAt(0);if("b"===n)return{type:"message",data:Gc(e.substring(1),t)};return Nc[n]?e.length>1?{type:Nc[n],data:e.substring(1)}:{type:Nc[n]}:Dc},Gc=(e,t)=>{if(Vc){const n=(e=>{let t,n,r,i,o,a=.75*e.length,s=e.length,u=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);const l=new ArrayBuffer(a),c=new Uint8Array(l);for(t=0;t<s;t+=4)n=Wc[e.charCodeAt(t)],r=Wc[e.charCodeAt(t+1)],i=Wc[e.charCodeAt(t+2)],o=Wc[e.charCodeAt(t+3)],c[u++]=n<<2|r>>4,c[u++]=(15&r)<<4|i>>2,c[u++]=(3&i)<<6|63&o;return l})(e);return Xc(n,t)}return{base64:!0,data:e}},Xc=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,Yc=String.fromCharCode(30);function Jc(){return new TransformStream({transform(e,t){!function(e,t){Fc&&e.data instanceof Blob?e.data.arrayBuffer().then(Qc).then(t):qc&&(e.data instanceof ArrayBuffer||zc(e.data))?t(Qc(e.data)):Bc(e,!1,e=>{Uc||(Uc=new TextEncoder),t(Uc.encode(e))})}(e,n=>{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const e=new DataView(i.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{i=new Uint8Array(9);const e=new DataView(i.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&"string"!=typeof e.data&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let ef;function tf(e){return e.reduce((e,t)=>e+t.length,0)}function nf(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let i=0;i<t;i++)n[i]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function rf(e){if(e)return function(e){for(var t in rf.prototype)e[t]=rf.prototype[t];return e}(e)}rf.prototype.on=rf.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},rf.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},rf.prototype.off=rf.prototype.removeListener=rf.prototype.removeAllListeners=rf.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i<r.length;i++)if((n=r[i])===t||n.fn===t){r.splice(i,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},rf.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var i=(n=n.slice(0)).length;r<i;++r)n[r].apply(this,t)}return this},rf.prototype.emitReserved=rf.prototype.emit,rf.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},rf.prototype.hasListeners=function(e){return!!this.listeners(e).length};const of="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),af="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function sf(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}const uf=af.setTimeout,lf=af.clearTimeout;function cf(e,t){t.useNativeTimers?(e.setTimeoutFn=uf.bind(af),e.clearTimeoutFn=lf.bind(af)):(e.setTimeoutFn=af.setTimeout.bind(af),e.clearTimeoutFn=af.clearTimeout.bind(af))}function ff(e){return"string"==typeof e?function(e){let t=0,n=0;for(let r=0,i=e.length;r<i;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}(e):Math.ceil(1.33*(e.byteLength||e.size))}function df(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class hf extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class pf extends rf{constructor(e){super(),this.writable=!1,cf(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved("error",new hf(e,t,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=Zc(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=function(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}(e);return t.length?"?"+t:""}}class mf extends pf{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once("pollComplete",function(){--e||t()})),this.writable||(e++,this.once("drain",function(){--e||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const n=e.split(Yc),r=[];for(let i=0;i<n.length;i++){const e=Zc(n[i],t);if(r.push(e),"error"===e.type)break}return r})(e,this.socket.binaryType).forEach(e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)}),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((e,o)=>{Bc(e,!1,e=>{r[o]=e,++i===n&&t(r.join(Yc))})})})(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=df()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let gf=!1;try{gf="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(dd){}const vf=gf;function yf(){}class bf extends mf{constructor(e){if(super(e),"undefined"!=typeof location){const t="https:"===location.protocol;let n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",(e,t)=>{this.onError("xhr post error",e,t)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(e,t)=>{this.onError("xhr poll error",e,t)}),this.pollXhr=e}}let wf=class e extends rf{constructor(e,t,n){super(),this.createRequest=e,cf(this,n),this._opts=n,this._method=n.method||"GET",this._uri=t,this._data=void 0!==n.data?n.data:null,this._create()}_create(){var t;const n=sf(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&r.setRequestHeader(e,this._opts.extraHeaders[e])}}catch(i){}if("POST"===this._method)try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(i){}try{r.setRequestHeader("Accept","*/*")}catch(i){}null===(t=this._opts.cookieJar)||void 0===t||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var e;3===r.readyState&&(null===(e=this._opts.cookieJar)||void 0===e||e.parseCookies(r.getResponseHeader("set-cookie"))),4===r.readyState&&(200===r.status||1223===r.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof r.status?r.status:0)},0))},r.send(this._data)}catch(i){return void this.setTimeoutFn(()=>{this._onError(i)},0)}"undefined"!=typeof document&&(this._index=e.requestsCount++,e.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(t){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=yf,t)try{this._xhr.abort()}catch(n){}"undefined"!=typeof document&&delete e.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};if(wf.requestsCount=0,wf.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",kf);else if("function"==typeof addEventListener){addEventListener("onpagehide"in af?"pagehide":"unload",kf,!1)}function kf(){for(let e in wf.requests)wf.requests.hasOwnProperty(e)&&wf.requests[e].abort()}const xf=function(){const e=_f({xdomain:!1});return e&&null!==e.responseType}();function _f(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||vf))return new XMLHttpRequest}catch(n){}if(!t)try{return new(af[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(n){}}const Sf="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class Cf extends pf{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,n=Sf?{}:sf(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}catch(dd){return this.emitReserved("error",dd)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;Bc(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch(t){}r&&of(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=df()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const Tf=af.WebSocket||af.MozWebSocket;const Af={websocket:class extends Cf{createSocket(e,t,n){return Sf?new Tf(e,t,n):t?new Tf(e,t):new Tf(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends pf{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(dd){return this.emitReserved("error",dd)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=function(e,t){ef||(ef=new TextDecoder);const n=[];let r=0,i=-1,o=!1;return new TransformStream({transform(a,s){for(n.push(a);;){if(0===r){if(tf(n)<1)break;const e=nf(n,1);o=!(128&~e[0]),i=127&e[0],r=i<126?3:126===i?1:2}else if(1===r){if(tf(n)<2)break;const e=nf(n,2);i=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(2===r){if(tf(n)<8)break;const e=nf(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),o=t.getUint32(0);if(o>Math.pow(2,21)-1){s.enqueue(Dc);break}i=o*Math.pow(2,32)+t.getUint32(4),r=3}else{if(tf(n)<i)break;const e=nf(n,i);s.enqueue(Zc(o?e:ef.decode(e),t)),r=0}if(0===i||i>e){s.enqueue(Dc);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=Jc();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const i=()=>{n.read().then(({done:e,value:t})=>{e||(this.onPacket(t),i())}).catch(e=>{})};i();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&of(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}},polling:class extends bf{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=xf&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new wf(_f,this.uri(),e)}}},Ef=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Mf=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function $f(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=Ef.exec(e||""),o={},a=14;for(;a--;)o[Mf[a]]=i[a]||"";return-1!=n&&-1!=r&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=function(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||r.splice(0,1);"/"==t.slice(-1)&&r.splice(r.length-1,1);return r}(0,o.path),o.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}(0,o.query),o}const jf="function"==typeof addEventListener&&"function"==typeof removeEventListener,Rf=[];jf&&addEventListener("offline",()=>{Rf.forEach(e=>e())},!1);class Of extends rf{constructor(e,t){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(t=e,e=null),e){const n=$f(e);t.hostname=n.host,t.secure="https"===n.protocol||"wss"===n.protocol,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=$f(t.host).host);cf(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{const t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},n=e.split("&");for(let r=0,i=n.length;r<i;r++){let e=n[r].split("=");t[decodeURIComponent(e[0])]=decodeURIComponent(e[1])}return t}(this.opts.query)),jf&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Rf.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);const e=this.opts.rememberUpgrade&&Of.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",e=>this._onClose("transport close",e))}onOpen(){this.readyState="open",Of.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){const n=this.writeBuffer[t].data;if(n&&(e+=ff(n)),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,of(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket("message",e,t,n),this}send(e,t,n){return this._sendPacket("message",e,t,n),this}_sendPacket(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const i={type:e,data:t,options:n};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}_onError(e){if(Of.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),jf&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=Rf.indexOf(this._offlineEventListener);-1!==e&&Rf.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}Of.protocol=4;class Lf extends Of{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),n=!1;Of.priorWebsocketSuccess=!1;const r=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",e=>{if(!n)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;Of.priorWebsocketSuccess="websocket"===t.name,this.transport.pause(()=>{n||"closed"!==this.readyState&&(l(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}}))};function i(){n||(n=!0,l(),t.close(),t=null)}const o=e=>{const n=new Error("probe error: "+e);n.transport=t.name,i(),this.emitReserved("upgradeError",n)};function a(){o("transport closed")}function s(){o("socket closed")}function u(e){t&&e.name!==t.name&&i()}const l=()=>{t.removeListener("open",r),t.removeListener("error",o),t.removeListener("close",a),this.off("close",s),this.off("upgrading",u)};t.once("open",r),t.once("error",o),t.once("close",a),this.once("close",s),this.once("upgrading",u),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}}let Pf=class extends Lf{constructor(e,t={}){const n="object"==typeof e?e:t;(!n.transports||n.transports&&"string"==typeof n.transports[0])&&(n.transports=(n.transports||["polling","websocket","webtransport"]).map(e=>Af[e]).filter(e=>!!e)),super(e,n)}};const If="function"==typeof ArrayBuffer,Nf=Object.prototype.toString,Df="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Nf.call(Blob),Ff="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===Nf.call(File);function qf(e){return If&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||Df&&e instanceof Blob||Ff&&e instanceof File}function zf(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(zf(e[t]))return!0;return!1}if(qf(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return zf(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&zf(e[n]))return!0;return!1}function Bf(e){const t=[],n=e.data,r=e;return r.data=Hf(n,t),r.attachments=t.length,{packet:r,buffers:t}}function Hf(e,t){if(!e)return e;if(qf(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=Hf(e[r],t);return n}if("object"==typeof e&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=Hf(e[r],t));return n}return e}function Qf(e,t){return e.data=Uf(e.data,t),delete e.attachments,e}function Uf(e,t){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=Uf(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Uf(e[n],t));return e}const Kf=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Wf,Vf;(Vf=Wf||(Wf={}))[Vf.CONNECT=0]="CONNECT",Vf[Vf.DISCONNECT=1]="DISCONNECT",Vf[Vf.EVENT=2]="EVENT",Vf[Vf.ACK=3]="ACK",Vf[Vf.CONNECT_ERROR=4]="CONNECT_ERROR",Vf[Vf.BINARY_EVENT=5]="BINARY_EVENT",Vf[Vf.BINARY_ACK=6]="BINARY_ACK";function Zf(e){return"[object Object]"===Object.prototype.toString.call(e)}class Gf extends rf{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const n=t.type===Wf.BINARY_EVENT;n||t.type===Wf.BINARY_ACK?(t.type=n?Wf.EVENT:Wf.ACK,this.reconstructor=new Xf(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!qf(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const n={type:Number(e.charAt(0))};if(void 0===Wf[n.type])throw new Error("unknown packet type "+n.type);if(n.type===Wf.BINARY_EVENT||n.type===Wf.BINARY_ACK){const r=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const i=e.substring(r,t);if(i!=Number(i)||"-"!==e.charAt(t))throw new Error("Illegal attachments");n.attachments=Number(i)}if("/"===e.charAt(t+1)){const r=t+1;for(;++t;){if(","===e.charAt(t))break;if(t===e.length)break}n.nsp=e.substring(r,t)}else n.nsp="/";const r=e.charAt(t+1);if(""!==r&&Number(r)==r){const r=t+1;for(;++t;){const n=e.charAt(t);if(null==n||Number(n)!=n){--t;break}if(t===e.length)break}n.id=Number(e.substring(r,t+1))}if(e.charAt(++t)){const r=this.tryParse(e.substr(t));if(!Gf.isPayloadValid(n.type,r))throw new Error("invalid payload");n.data=r}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(t){return!1}}static isPayloadValid(e,t){switch(e){case Wf.CONNECT:return Zf(t);case Wf.DISCONNECT:return void 0===t;case Wf.CONNECT_ERROR:return"string"==typeof t||Zf(t);case Wf.EVENT:case Wf.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===Kf.indexOf(t[0]));case Wf.ACK:case Wf.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Xf{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=Qf(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Yf=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Gf,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==Wf.EVENT&&e.type!==Wf.ACK||!zf(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===Wf.EVENT?Wf.BINARY_EVENT:Wf.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==Wf.BINARY_EVENT&&e.type!==Wf.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=Bf(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},get PacketType(){return Wf},protocol:5},Symbol.toStringTag,{value:"Module"}));function Jf(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const ed=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class td extends rf{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Jf(e,"open",this.onopen.bind(this)),Jf(e,"packet",this.onpacket.bind(this)),Jf(e,"error",this.onerror.bind(this)),Jf(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var n,r,i;if(ed.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const o={type:Wf.EVENT,data:t,options:{}};if(o.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,n=t.pop();this._registerAckCallback(e,n),o.id=e}const a=null===(r=null===(n=this.io.engine)||void 0===n?void 0:n.transport)||void 0===r?void 0:r.writable,s=this.connected&&!(null===(i=this.io.engine)||void 0===i?void 0:i._hasPingExpired());return this.flags.volatile&&!a||(s?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var n;const r=null!==(n=this.flags.timeout)&&void 0!==n?n:this._opts.ackTimeout;if(void 0===r)return void(this.acks[e]=t);const i=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,new Error("operation has timed out"))},r),o=(...e)=>{this.io.clearTimeoutFn(i),t.apply(this,e)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((n,r)=>{const i=(e,t)=>e?r(e):n(t);i.withError=!0,t.push(i),this.emit(e,...t)})}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>{if(n!==this._queue[0])return;return null!==e?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...r)),n.pending=!1,this._drainQueue()}),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Wf.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Wf.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Wf.EVENT:case Wf.BINARY_EVENT:this.onevent(e);break;case Wf.ACK:case Wf.BINARY_ACK:this.onack(e);break;case Wf.DISCONNECT:this.ondisconnect();break;case Wf.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let n=!1;return function(...r){n||(n=!0,t.packet({type:Wf.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Wf.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const n of t)n.apply(this,e.data)}}}function nd(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}nd.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+n:e-n}return 0|Math.min(e,this.max)},nd.prototype.reset=function(){this.attempts=0},nd.prototype.setMin=function(e){this.ms=e},nd.prototype.setMax=function(e){this.max=e},nd.prototype.setJitter=function(e){this.jitter=e};class rd extends rf{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,cf(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(n=t.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new nd({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||Yf;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Pf(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=Jf(t,"open",function(){n.onopen(),e&&e()}),i=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},o=Jf(t,"error",i);if(!1!==this._timeout){const e=this._timeout,n=this.setTimeoutFn(()=>{r(),i(new Error("timeout")),t.close()},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(r),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Jf(e,"ping",this.onping.bind(this)),Jf(e,"data",this.ondata.bind(this)),Jf(e,"error",this.onerror.bind(this)),Jf(e,"close",this.onclose.bind(this)),Jf(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){of(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new td(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const n of t){if(this.nsps[n].active)return}this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),null===(n=this.engine)||void 0===n||n.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const id={};function od(e,t){"object"==typeof e&&(t=e,e=void 0);const n=function(e,t="",n){let r=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),r=$f(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const i=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+t,r.href=r.protocol+"://"+i+(n&&n.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),r=n.source,i=n.id,o=n.path,a=id[i]&&o in id[i].nsps;let s;return t.forceNew||t["force new connection"]||!1===t.multiplex||a?s=new rd(r,t):(id[i]||(id[i]=new rd(r,t)),s=id[i]),n.query&&!t.query&&(t.query=n.queryKey),s.socket(n.path,t)}Object.assign(od,{Manager:rd,Socket:td,io:od,connect:od});class ad extends Rc.EventEmitter{constructor(){super(...arguments),this.O=null,this.P=null}connect(e){try{this.P||(this.P=e,this.O=od(e,{transports:["websocket"],timeout:1e4,extraHeaders:{"X-Extension-Id":rr()||""}}),this.O?.on(Xn,()=>{this.emit(Xn)}),this.O?.on(Jn,()=>this.emit(Jn)),this.O?.on(Yn,e=>this.emit(Yn,e)),this.O?.onAny((e,t)=>{this.emit(e,t)}))}catch(t){}}send(e,t){this.O?.emit(e,t)}disconnect(){this.O?.disconnect(),this.O=null,this.P=null}}const sd=new ad;Pc.startListening({matcher:ol.endpoints.getData.matchFulfilled,effect:async(e,t)=>{try{const t=e.payload;t.server&&(sd.disconnect(),sd.connect(t.server))}catch(n){}}}),Pc.startListening({matcher:ol.endpoints.getData.matchPending,effect:async(e,t)=>{}}),Pc.startListening({matcher:ol.endpoints.getData.matchRejected,effect:async(e,t)=>{t.dispatch(kr(0)),t.dispatch(wr(!1))}}),Pc.startListening({actionCreator:ul,effect:e=>{const t=ld.getState(),n=t.ui,r=t.api;n.run&&n.isTp&&r.balance>=n.tp&&(ld.dispatch(dr({type:"success",text:ns(n.localCode||"en","tp_success")})),ld.dispatch(wr(!1))),n.run&&n.isSl&&r.balance<=n.sl&&(ld.dispatch(dr({type:"success",text:ns(n.localCode||"en","sl_success")})),ld.dispatch(wr(!1)))}}),Pc.startListening({actionCreator:ll,effect:e=>{const t=ld.getState();t.api?.endpoint&&sd.send(t.api.endpoint.concat("_asset"),e.payload)}}),Pc.startListening({actionCreator:sl,effect:e=>{ld.getState().api.asset?ld.dispatch(gr(!1)):(ld.dispatch(wr(!1)),ld.dispatch(gr(!0)))}}),Pc.startListening({actionCreator:cl,effect:async e=>{const t=ld.getState();t.api.domain&&await async function(e){const t=new URL(e).hostname,n=await chrome.cookies.getAll({domain:t});await Promise.all(n.map(e=>{const t=`${e.secure?"https://":"http://"}${e.domain.startsWith(".")?e.domain.slice(1):e.domain}${e.path}`;return chrome.cookies.remove({url:t,name:e.name})}))}(t.api.domain),ld.dispatch(mr(!1)),Lc.R("31",e.payload.url)}}),Pc.startListening({actionCreator:Tc,effect:(e,t)=>{const n=ld.getState();e.payload===Gn.ERROR&&t.dispatch(wr(!1)),e.payload===Gn.CONNECT&&n.api?.endpoint&&n.api.uid&&sd.send(n.api.endpoint.concat("/asset"),n.api.uid)}}),Pc.startListening({actionCreator:Mc,effect:(e,t)=>{const n=ld.getState();n.ws.status===Gn.CONNECT&&n.api?.endpoint&&n.api.uid&&sd.send(n.api.endpoint.concat("/candle"),e.payload)}});const ud=new class{constructor(){}I(e,t){const n=e.api.assets.find(e=>e.symbol===t.symbol);if(!n)return!1;if(!n.active)return!1;if(n.payout<e.ui.minPayout)return!1;return!(e.order.orders.filter(e=>!("profit"in e)).length>=e.ui.maxTrades)}N(e,t){const n=e.order.orders.filter(e=>"profit"in e)[0],r=e.ui,i=this.F;let o=r.amount;if(n){const e=n.profit;e>0&&r.isIncreaseWin?(o="loss"===i?r.amount:Math.floor(n.amount*r.increaseWin),this.F="win"):e<0&&r.isIncreaseLoss?(o="win"===i?r.amount:Math.floor(n.amount*r.increaseLoss),this.F="loss"):this.F=void 0}return o}q(e,t){const n=e.ui,r=e.api;return n.isTp&&n.tp<=r.balance&&ld.dispatch(dr({type:"warning",text:ns(n.localCode||"en","tp_err")})),!0}B(e,t){const n=ld.getState();if(!n.ui.run)return;if(!this.I(n,e))return;const r=this.N(n,e);t({account:n.api.account,amount:r,asset:e.symbol,dir:e.dir,duration:n.ui.duration||e.duration})}};Pc.startListening({actionCreator:Ac,effect:e=>{ud.B(e.payload,e=>{Lc.R("26",e)})}}),Pc.startListening({actionCreator:Bl,effect:e=>{}}),Pc.startListening({actionCreator:Hl,effect:e=>{const t=ld.getState();t.ui,t.api;const n=t.order.orders.find(t=>t.id===e.payload.id);n&&n.profit&&ld.dispatch(Ql({stat_profit:n.profit>0?n.profit:0,stat_profit_count:n.profit>0?1:0,stat_loss:n.profit<0?n.profit:0,stat_loss_count:n.profit<0?1:0}))}});const ld=function(e){const t=function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{};let o=new Ft;return t&&("boolean"==typeof t?o.push(Pt):o.push(It(t.extraArgument))),o},{reducer:n,middleware:r,devTools:i=!0,preloadedState:o,enhancers:a}=e||{};let s,u;if("function"==typeof n)s=n;else{if(!ue(n))throw new Error(Zn(1));s=ce(n)}u="function"==typeof r?r(t):t();let l=fe;i&&(l=Nt({trace:!1,..."object"==typeof i&&i}));const c=function(...e){return t=>(n,r)=>{const i=t(n,r);let o=()=>{throw new Error(ie(15))};const a={getState:i.getState,dispatch:(e,...t)=>o(e,...t)},s=e.map(e=>e(a));return o=fe(...s)(i.dispatch),{...i,dispatch:o}}}(...u),f=Ut(c);return le(s,o,l(..."function"==typeof a?a(f):f()))}({reducer:{ui:cr.reducer,ws:Cc.reducer,api:il.reducer,order:zl.reducer,[ol.reducerPath]:ol.reducer},devTools:!1,middleware:e=>e({serializableCheck:{ignoredPaths:["ui.alerts","dataApi.queries"],ignoredActionPaths:["payload.0.props.button.click","meta.baseQueryMeta"]}}).concat(ol.middleware).concat(Pc.middleware)});var cd;cd=ld.dispatch,Lc.on("1",e=>{cd(sl(e))}),Lc.on("2",e=>{cd(ll(e))}),Lc.on("3",e=>{cd(sl({account:e}))}),Lc.on("13",e=>{cd(ul({demoBalance:e}))}),Lc.on("14",e=>{cd(ul({realBalance:e}))}),Lc.on("4",e=>{cd(sl({domain:e}))}),Lc.on("5",e=>{cd(sl({symbolReal:e}))}),Lc.on("6",e=>{cd(sl({symbolDemo:e}))}),Lc.on("7",e=>{cd(sl({maxAmountDemo:e}))}),Lc.on("8",e=>{cd(sl({minAmountDemo:e}))}),Lc.on("9",e=>{cd(sl({maxAmount:e}))}),Lc.on("10",e=>{cd(sl({minAmount:e}))}),Lc.on("11",e=>{cd(sl({maxAmountTournament:e}))}),Lc.on("12",e=>{cd(sl({minAmountTournament:e}))}),Lc.on("16",e=>{cd(fr(e))}),Lc.on("30",e=>{cd(sl({assets:e}))}),Lc.on("27",e=>{cd(Bl(e))}),Lc.on("28",e=>{cd(Hl(e))}),Lc.on("17",e=>{cd(Mc(e))}),function(e){sd.on(Xn,()=>e(Tc(Gn.CONNECT))),sd.on(Jn,()=>e(Tc(Gn.DISCONNECT))),sd.on(Yn,t=>e(Tc(Gn.ERROR))),sd.on("signals",t=>e(Ac(t))),sd.on("signals_history",t=>e(Ec(t))),sd.on("asset",t=>e(sl({asset:t})))}(ld.dispatch);const fd=document.createElement("div");document.body.appendChild(fd),j.createRoot(fd).render(s.jsx(d.StrictMode,{children:s.jsx(W,{store:ld,children:s.jsx(pl,{children:s.jsx(is,{children:s.jsx(Ja,{children:s.jsx(_c,{})})})})})}));
|
|
601
|
+
`;function _c(){const e=J();return d.useEffect(()=>{e(hr(!0))},[]),s.jsx(yc,{})}const Sc={status:Gn.NOT_CONNECT,signals:[],candles:{}},Cc=gn({name:"websocket",initialState:Sc,reducers:{wsStatus:(e,t)=>{e.status=t.payload},pushSignal:(e,t)=>{e.signals.unshift(t.payload)},setSignalsHistory:(e,t)=>{e.signals=[...t.payload]},setCandles:(e,t)=>{e.candles=t.payload}}}),{wsStatus:Tc,pushSignal:Ac,setSignalsHistory:Ec,setCandles:Mc}=Cc.actions;var $c,jc={exports:{}};var Rc=function(){if($c)return jc.exports;$c=1;var e,t="object"==typeof Reflect?Reflect:null,n=t&&"function"==typeof t.apply?t.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};e=t&&"function"==typeof t.ownKeys?t.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var r=Number.isNaN||function(e){return e!=e};function i(){i.init.call(this)}jc.exports=i,jc.exports.once=function(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,o),r(n)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}p(e,t,o,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&p(e,"error",t,n)}(e,i,{once:!0})})},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var o=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function s(e){return void 0===e._maxListeners?i.defaultMaxListeners:e._maxListeners}function u(e,t,n,r){var i,o,u;if(a(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),u=o[t]),void 0===u)u=o[t]=n,++e._eventsCount;else if("function"==typeof u?u=o[t]=r?[n,u]:[u,n]:r?u.unshift(n):u.push(n),(i=s(e))>0&&u.length>i&&!u.warned){u.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+u.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=u.length,console&&console.warn}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function c(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=l.bind(r);return i.listener=n,r.wrapFn=i,i}function f(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):h(i,i.length)}function d(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function h(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function p(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,function i(o){r.once&&e.removeEventListener(t,i),n(o)})}}return Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=e}}),i.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},i.prototype.getMaxListeners=function(){return s(this)},i.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=o[e];if(void 0===u)return!1;if("function"==typeof u)n(u,this,t);else{var l=u.length,c=h(u,l);for(r=0;r<l;++r)n(c[r],this,t)}return!0},i.prototype.addListener=function(e,t){return u(this,e,t,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(e,t){return u(this,e,t,!0)},i.prototype.once=function(e,t){return a(t),this.on(e,c(this,e,t)),this},i.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,c(this,e,t)),this},i.prototype.removeListener=function(e,t){var n,r,i,o,s;if(a(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,s||t)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},i.prototype.listeners=function(e){return f(this,e,!0)},i.prototype.rawListeners=function(e){return f(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):d.call(e,t)},i.prototype.listenerCount=d,i.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]},jc.exports}();const Oc=e(Rc);const Lc=new class extends Oc{constructor(){super(),this._permit=!0,window.addEventListener("message",this._handleIframeMessage.bind(this),!1)}set lock(e){this._permit=e}R(e,t){try{const n=rr();n&&window.parent&&window.parent.postMessage({id:n,event:e,data:t},"*")}catch(n){}}_handleIframeMessage(e){try{if(!this._permit)return;const t=e.data;"object"==typeof t&&"id"in t&&t.id===rr()&&"event"in t&&"data"in t&&this.emit(t.event,t.data)}catch(t){}}};const Pc=((e={})=>{const t=new Map,n=new Map,{extra:r,onError:i=Vn}=e;Tn(i);const o=e=>(e=>(e.unsubscribe=()=>t.delete(e.id),t.set(e.id,e),t=>{e.unsubscribe(),t?.cancelActive&&Hn(e)}))(Bn(t,e)??zn(e));Pn(o,{withTypes:()=>o});const a=e=>{const n=Bn(t,e);return n&&(n.unsubscribe(),e.cancelActive&&Hn(n)),!!n};Pn(a,{withTypes:()=>a});const s=async(e,a,s,u)=>{const l=new AbortController,c=Fn(o,l.signal),f=[];try{e.pending.add(l),(e=>{const t=n.get(e)??0;n.set(e,t+1)})(e),await Promise.resolve(e.effect(a,Pn({},s,{getOriginalState:u,condition:(e,t)=>c(e,t).then(Boolean),take:c,delay:Ln(l.signal),pause:On(l.signal),extra:r,signal:l.signal,fork:Dn(l.signal,f),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==l&&($n(e,_n),n.delete(e))})},cancel:()=>{$n(l,_n),e.pending.delete(l)},throwIfCancelled:()=>{jn(l.signal)}})))}catch(d){d instanceof Cn||Qn(i,d,{raisedBy:"effect"})}finally{await Promise.all(f),$n(l,Sn),(e=>{const t=n.get(e)??1;1===t?n.delete(e):n.set(e,t-1)})(e),e.pending.delete(l)}},u=((e,t)=>()=>{for(const e of t.keys())Hn(e);e.clear()})(t,n);return{middleware:e=>n=>r=>{if(!de(r))return n(r);if(Un.match(r))return o(r.payload);if(Kn.match(r))return void u();if(Wn.match(r))return a(r.payload);let l=e.getState();const c=()=>{if(l===In)throw new Error(Zn(23));return l};let f;try{if(f=n(r),t.size>0){const n=e.getState(),o=Array.from(t.values());for(const t of o){let o=!1;try{o=t.predicate(r,n,l)}catch(d){o=!1,Qn(i,d,{raisedBy:"predicate"})}o&&s(t,r,e,c)}}}finally{l=In}return f},startListening:o,stopListening:a,clearListeners:u}})();Pc.startListening({actionCreator:wr,effect:e=>{if(e.payload){const e=ld.getState(),t=e.ui,n=e.api,r=n.account===er.REAL?n.minAmount:n.minAmountDemo,i=n.account===er.REAL?n.maxAmount:n.maxAmountDemo;if(t.amount<r)return ld.dispatch(dr({type:"warning",text:ns(t.localCode||"en","check_minAmount")})),void ld.dispatch(wr(!1));if(t.amount>i)return ld.dispatch(dr({type:"warning",text:ns(t.localCode||"en","check_maxAmount")})),void ld.dispatch(wr(!1));if(0===n.balance||n.balance<n.minAmount)return ld.dispatch(dr({type:"warning",text:ns(t.localCode||"en","no_balance",[n.symbol.concat(String(n.balance))])})),void ld.dispatch(wr(!1));if(t.amount>n.balance)return ld.dispatch(dr({type:"warning",text:ns(t.localCode||"en","insufficient_balance",[n.symbol.concat(String(t.amount))])})),void ld.dispatch(wr(!1));if(t.isTp&&t.tp<=n.balance)return ld.dispatch(dr({type:"warning",text:ns(t.localCode||"en","tp_err")})),void ld.dispatch(wr(!1));if(t.isSl&&t.sl>=n.balance)return ld.dispatch(dr({type:"warning",text:ns(t.localCode||"en","sl_err")})),void ld.dispatch(wr(!1));ld.dispatch(dr())}}}),Pc.startListening({actionCreator:Rr,effect:e=>{ld.getState()}}),Pc.startListening({actionCreator:pr,effect:e=>{Lc.R("23",e.payload)}}),Pc.startListening({actionCreator:mr,effect:e=>{Lc.R("22",e.payload)}}),Pc.startListening({actionCreator:gr,effect:(e,t)=>{e.payload&&t.dispatch(wr(!1))}}),Pc.startListening({actionCreator:hr,effect:(e,t)=>{e.payload&&Lc.R("24",e.payload)}});const Ic=Object.create(null);Ic.open="0",Ic.close="1",Ic.ping="2",Ic.pong="3",Ic.message="4",Ic.upgrade="5",Ic.noop="6";const Nc=Object.create(null);Object.keys(Ic).forEach(e=>{Nc[Ic[e]]=e});const Dc={type:"error",data:"parser error"},Fc="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),qc="function"==typeof ArrayBuffer,zc=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Bc=({type:e,data:t},n,r)=>Fc&&t instanceof Blob?n?r(t):Hc(t,r):qc&&(t instanceof ArrayBuffer||zc(t))?n?r(t):Hc(new Blob([t]),r):r(Ic[e]+(t||"")),Hc=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function Qc(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Uc;const Kc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wc="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let hd=0;hd<64;hd++)Wc[Kc.charCodeAt(hd)]=hd;const Vc="function"==typeof ArrayBuffer,Zc=(e,t)=>{if("string"!=typeof e)return{type:"message",data:Xc(e,t)};const n=e.charAt(0);if("b"===n)return{type:"message",data:Gc(e.substring(1),t)};return Nc[n]?e.length>1?{type:Nc[n],data:e.substring(1)}:{type:Nc[n]}:Dc},Gc=(e,t)=>{if(Vc){const n=(e=>{let t,n,r,i,o,a=.75*e.length,s=e.length,u=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);const l=new ArrayBuffer(a),c=new Uint8Array(l);for(t=0;t<s;t+=4)n=Wc[e.charCodeAt(t)],r=Wc[e.charCodeAt(t+1)],i=Wc[e.charCodeAt(t+2)],o=Wc[e.charCodeAt(t+3)],c[u++]=n<<2|r>>4,c[u++]=(15&r)<<4|i>>2,c[u++]=(3&i)<<6|63&o;return l})(e);return Xc(n,t)}return{base64:!0,data:e}},Xc=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,Yc=String.fromCharCode(30);function Jc(){return new TransformStream({transform(e,t){!function(e,t){Fc&&e.data instanceof Blob?e.data.arrayBuffer().then(Qc).then(t):qc&&(e.data instanceof ArrayBuffer||zc(e.data))?t(Qc(e.data)):Bc(e,!1,e=>{Uc||(Uc=new TextEncoder),t(Uc.encode(e))})}(e,n=>{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const e=new DataView(i.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{i=new Uint8Array(9);const e=new DataView(i.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&"string"!=typeof e.data&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let ef;function tf(e){return e.reduce((e,t)=>e+t.length,0)}function nf(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let i=0;i<t;i++)n[i]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function rf(e){if(e)return function(e){for(var t in rf.prototype)e[t]=rf.prototype[t];return e}(e)}rf.prototype.on=rf.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},rf.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},rf.prototype.off=rf.prototype.removeListener=rf.prototype.removeAllListeners=rf.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i<r.length;i++)if((n=r[i])===t||n.fn===t){r.splice(i,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},rf.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var i=(n=n.slice(0)).length;r<i;++r)n[r].apply(this,t)}return this},rf.prototype.emitReserved=rf.prototype.emit,rf.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},rf.prototype.hasListeners=function(e){return!!this.listeners(e).length};const of="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),af="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function sf(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}const uf=af.setTimeout,lf=af.clearTimeout;function cf(e,t){t.useNativeTimers?(e.setTimeoutFn=uf.bind(af),e.clearTimeoutFn=lf.bind(af)):(e.setTimeoutFn=af.setTimeout.bind(af),e.clearTimeoutFn=af.clearTimeout.bind(af))}function ff(e){return"string"==typeof e?function(e){let t=0,n=0;for(let r=0,i=e.length;r<i;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}(e):Math.ceil(1.33*(e.byteLength||e.size))}function df(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class hf extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class pf extends rf{constructor(e){super(),this.writable=!1,cf(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved("error",new hf(e,t,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=Zc(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=function(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}(e);return t.length?"?"+t:""}}class mf extends pf{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once("pollComplete",function(){--e||t()})),this.writable||(e++,this.once("drain",function(){--e||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const n=e.split(Yc),r=[];for(let i=0;i<n.length;i++){const e=Zc(n[i],t);if(r.push(e),"error"===e.type)break}return r})(e,this.socket.binaryType).forEach(e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)}),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((e,o)=>{Bc(e,!1,e=>{r[o]=e,++i===n&&t(r.join(Yc))})})})(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=df()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let gf=!1;try{gf="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(dd){}const vf=gf;function yf(){}class bf extends mf{constructor(e){if(super(e),"undefined"!=typeof location){const t="https:"===location.protocol;let n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",(e,t)=>{this.onError("xhr post error",e,t)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(e,t)=>{this.onError("xhr poll error",e,t)}),this.pollXhr=e}}let wf=class e extends rf{constructor(e,t,n){super(),this.createRequest=e,cf(this,n),this._opts=n,this._method=n.method||"GET",this._uri=t,this._data=void 0!==n.data?n.data:null,this._create()}_create(){var t;const n=sf(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&r.setRequestHeader(e,this._opts.extraHeaders[e])}}catch(i){}if("POST"===this._method)try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(i){}try{r.setRequestHeader("Accept","*/*")}catch(i){}null===(t=this._opts.cookieJar)||void 0===t||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var e;3===r.readyState&&(null===(e=this._opts.cookieJar)||void 0===e||e.parseCookies(r.getResponseHeader("set-cookie"))),4===r.readyState&&(200===r.status||1223===r.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof r.status?r.status:0)},0))},r.send(this._data)}catch(i){return void this.setTimeoutFn(()=>{this._onError(i)},0)}"undefined"!=typeof document&&(this._index=e.requestsCount++,e.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(t){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=yf,t)try{this._xhr.abort()}catch(n){}"undefined"!=typeof document&&delete e.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};if(wf.requestsCount=0,wf.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",kf);else if("function"==typeof addEventListener){addEventListener("onpagehide"in af?"pagehide":"unload",kf,!1)}function kf(){for(let e in wf.requests)wf.requests.hasOwnProperty(e)&&wf.requests[e].abort()}const xf=function(){const e=_f({xdomain:!1});return e&&null!==e.responseType}();function _f(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||vf))return new XMLHttpRequest}catch(n){}if(!t)try{return new(af[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(n){}}const Sf="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class Cf extends pf{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,n=Sf?{}:sf(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}catch(dd){return this.emitReserved("error",dd)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;Bc(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch(t){}r&&of(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=df()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const Tf=af.WebSocket||af.MozWebSocket;const Af={websocket:class extends Cf{createSocket(e,t,n){return Sf?new Tf(e,t,n):t?new Tf(e,t):new Tf(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends pf{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(dd){return this.emitReserved("error",dd)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=function(e,t){ef||(ef=new TextDecoder);const n=[];let r=0,i=-1,o=!1;return new TransformStream({transform(a,s){for(n.push(a);;){if(0===r){if(tf(n)<1)break;const e=nf(n,1);o=!(128&~e[0]),i=127&e[0],r=i<126?3:126===i?1:2}else if(1===r){if(tf(n)<2)break;const e=nf(n,2);i=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(2===r){if(tf(n)<8)break;const e=nf(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),o=t.getUint32(0);if(o>Math.pow(2,21)-1){s.enqueue(Dc);break}i=o*Math.pow(2,32)+t.getUint32(4),r=3}else{if(tf(n)<i)break;const e=nf(n,i);s.enqueue(Zc(o?e:ef.decode(e),t)),r=0}if(0===i||i>e){s.enqueue(Dc);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=Jc();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const i=()=>{n.read().then(({done:e,value:t})=>{e||(this.onPacket(t),i())}).catch(e=>{})};i();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&of(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}},polling:class extends bf{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=xf&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new wf(_f,this.uri(),e)}}},Ef=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Mf=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function $f(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=Ef.exec(e||""),o={},a=14;for(;a--;)o[Mf[a]]=i[a]||"";return-1!=n&&-1!=r&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=function(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||r.splice(0,1);"/"==t.slice(-1)&&r.splice(r.length-1,1);return r}(0,o.path),o.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}(0,o.query),o}const jf="function"==typeof addEventListener&&"function"==typeof removeEventListener,Rf=[];jf&&addEventListener("offline",()=>{Rf.forEach(e=>e())},!1);class Of extends rf{constructor(e,t){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(t=e,e=null),e){const n=$f(e);t.hostname=n.host,t.secure="https"===n.protocol||"wss"===n.protocol,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=$f(t.host).host);cf(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{const t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},n=e.split("&");for(let r=0,i=n.length;r<i;r++){let e=n[r].split("=");t[decodeURIComponent(e[0])]=decodeURIComponent(e[1])}return t}(this.opts.query)),jf&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Rf.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);const e=this.opts.rememberUpgrade&&Of.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",e=>this._onClose("transport close",e))}onOpen(){this.readyState="open",Of.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){const n=this.writeBuffer[t].data;if(n&&(e+=ff(n)),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,of(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket("message",e,t,n),this}send(e,t,n){return this._sendPacket("message",e,t,n),this}_sendPacket(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const i={type:e,data:t,options:n};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}_onError(e){if(Of.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),jf&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=Rf.indexOf(this._offlineEventListener);-1!==e&&Rf.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}Of.protocol=4;class Lf extends Of{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),n=!1;Of.priorWebsocketSuccess=!1;const r=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",e=>{if(!n)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;Of.priorWebsocketSuccess="websocket"===t.name,this.transport.pause(()=>{n||"closed"!==this.readyState&&(l(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}}))};function i(){n||(n=!0,l(),t.close(),t=null)}const o=e=>{const n=new Error("probe error: "+e);n.transport=t.name,i(),this.emitReserved("upgradeError",n)};function a(){o("transport closed")}function s(){o("socket closed")}function u(e){t&&e.name!==t.name&&i()}const l=()=>{t.removeListener("open",r),t.removeListener("error",o),t.removeListener("close",a),this.off("close",s),this.off("upgrading",u)};t.once("open",r),t.once("error",o),t.once("close",a),this.once("close",s),this.once("upgrading",u),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}}let Pf=class extends Lf{constructor(e,t={}){const n="object"==typeof e?e:t;(!n.transports||n.transports&&"string"==typeof n.transports[0])&&(n.transports=(n.transports||["polling","websocket","webtransport"]).map(e=>Af[e]).filter(e=>!!e)),super(e,n)}};const If="function"==typeof ArrayBuffer,Nf=Object.prototype.toString,Df="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Nf.call(Blob),Ff="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===Nf.call(File);function qf(e){return If&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||Df&&e instanceof Blob||Ff&&e instanceof File}function zf(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(zf(e[t]))return!0;return!1}if(qf(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return zf(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&zf(e[n]))return!0;return!1}function Bf(e){const t=[],n=e.data,r=e;return r.data=Hf(n,t),r.attachments=t.length,{packet:r,buffers:t}}function Hf(e,t){if(!e)return e;if(qf(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=Hf(e[r],t);return n}if("object"==typeof e&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=Hf(e[r],t));return n}return e}function Qf(e,t){return e.data=Uf(e.data,t),delete e.attachments,e}function Uf(e,t){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=Uf(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Uf(e[n],t));return e}const Kf=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Wf,Vf;(Vf=Wf||(Wf={}))[Vf.CONNECT=0]="CONNECT",Vf[Vf.DISCONNECT=1]="DISCONNECT",Vf[Vf.EVENT=2]="EVENT",Vf[Vf.ACK=3]="ACK",Vf[Vf.CONNECT_ERROR=4]="CONNECT_ERROR",Vf[Vf.BINARY_EVENT=5]="BINARY_EVENT",Vf[Vf.BINARY_ACK=6]="BINARY_ACK";function Zf(e){return"[object Object]"===Object.prototype.toString.call(e)}class Gf extends rf{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const n=t.type===Wf.BINARY_EVENT;n||t.type===Wf.BINARY_ACK?(t.type=n?Wf.EVENT:Wf.ACK,this.reconstructor=new Xf(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!qf(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const n={type:Number(e.charAt(0))};if(void 0===Wf[n.type])throw new Error("unknown packet type "+n.type);if(n.type===Wf.BINARY_EVENT||n.type===Wf.BINARY_ACK){const r=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const i=e.substring(r,t);if(i!=Number(i)||"-"!==e.charAt(t))throw new Error("Illegal attachments");n.attachments=Number(i)}if("/"===e.charAt(t+1)){const r=t+1;for(;++t;){if(","===e.charAt(t))break;if(t===e.length)break}n.nsp=e.substring(r,t)}else n.nsp="/";const r=e.charAt(t+1);if(""!==r&&Number(r)==r){const r=t+1;for(;++t;){const n=e.charAt(t);if(null==n||Number(n)!=n){--t;break}if(t===e.length)break}n.id=Number(e.substring(r,t+1))}if(e.charAt(++t)){const r=this.tryParse(e.substr(t));if(!Gf.isPayloadValid(n.type,r))throw new Error("invalid payload");n.data=r}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(t){return!1}}static isPayloadValid(e,t){switch(e){case Wf.CONNECT:return Zf(t);case Wf.DISCONNECT:return void 0===t;case Wf.CONNECT_ERROR:return"string"==typeof t||Zf(t);case Wf.EVENT:case Wf.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===Kf.indexOf(t[0]));case Wf.ACK:case Wf.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Xf{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=Qf(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Yf=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Gf,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==Wf.EVENT&&e.type!==Wf.ACK||!zf(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===Wf.EVENT?Wf.BINARY_EVENT:Wf.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==Wf.BINARY_EVENT&&e.type!==Wf.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=Bf(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},get PacketType(){return Wf},protocol:5},Symbol.toStringTag,{value:"Module"}));function Jf(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const ed=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class td extends rf{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Jf(e,"open",this.onopen.bind(this)),Jf(e,"packet",this.onpacket.bind(this)),Jf(e,"error",this.onerror.bind(this)),Jf(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var n,r,i;if(ed.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const o={type:Wf.EVENT,data:t,options:{}};if(o.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,n=t.pop();this._registerAckCallback(e,n),o.id=e}const a=null===(r=null===(n=this.io.engine)||void 0===n?void 0:n.transport)||void 0===r?void 0:r.writable,s=this.connected&&!(null===(i=this.io.engine)||void 0===i?void 0:i._hasPingExpired());return this.flags.volatile&&!a||(s?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var n;const r=null!==(n=this.flags.timeout)&&void 0!==n?n:this._opts.ackTimeout;if(void 0===r)return void(this.acks[e]=t);const i=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,new Error("operation has timed out"))},r),o=(...e)=>{this.io.clearTimeoutFn(i),t.apply(this,e)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((n,r)=>{const i=(e,t)=>e?r(e):n(t);i.withError=!0,t.push(i),this.emit(e,...t)})}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>{if(n!==this._queue[0])return;return null!==e?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...r)),n.pending=!1,this._drainQueue()}),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Wf.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Wf.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Wf.EVENT:case Wf.BINARY_EVENT:this.onevent(e);break;case Wf.ACK:case Wf.BINARY_ACK:this.onack(e);break;case Wf.DISCONNECT:this.ondisconnect();break;case Wf.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let n=!1;return function(...r){n||(n=!0,t.packet({type:Wf.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Wf.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const n of t)n.apply(this,e.data)}}}function nd(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}nd.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+n:e-n}return 0|Math.min(e,this.max)},nd.prototype.reset=function(){this.attempts=0},nd.prototype.setMin=function(e){this.ms=e},nd.prototype.setMax=function(e){this.max=e},nd.prototype.setJitter=function(e){this.jitter=e};class rd extends rf{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,cf(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(n=t.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new nd({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||Yf;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Pf(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=Jf(t,"open",function(){n.onopen(),e&&e()}),i=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},o=Jf(t,"error",i);if(!1!==this._timeout){const e=this._timeout,n=this.setTimeoutFn(()=>{r(),i(new Error("timeout")),t.close()},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(r),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Jf(e,"ping",this.onping.bind(this)),Jf(e,"data",this.ondata.bind(this)),Jf(e,"error",this.onerror.bind(this)),Jf(e,"close",this.onclose.bind(this)),Jf(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){of(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new td(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const n of t){if(this.nsps[n].active)return}this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),null===(n=this.engine)||void 0===n||n.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const id={};function od(e,t){"object"==typeof e&&(t=e,e=void 0);const n=function(e,t="",n){let r=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),r=$f(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const i=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+t,r.href=r.protocol+"://"+i+(n&&n.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),r=n.source,i=n.id,o=n.path,a=id[i]&&o in id[i].nsps;let s;return t.forceNew||t["force new connection"]||!1===t.multiplex||a?s=new rd(r,t):(id[i]||(id[i]=new rd(r,t)),s=id[i]),n.query&&!t.query&&(t.query=n.queryKey),s.socket(n.path,t)}Object.assign(od,{Manager:rd,Socket:td,io:od,connect:od});class ad extends Rc.EventEmitter{constructor(){super(...arguments),this.O=null,this.P=null}connect(e){try{this.P||(this.P=e,this.O=od(e,{transports:["websocket"],timeout:1e4,extraHeaders:{"X-Extension-Id":rr()||""}}),this.O?.on(Xn,()=>{this.emit(Xn)}),this.O?.on(Jn,()=>this.emit(Jn)),this.O?.on(Yn,e=>this.emit(Yn,e)),this.O?.onAny((e,t)=>{this.emit(e,t)}))}catch(t){}}send(e,t){this.O?.emit(e,t)}disconnect(){this.O?.disconnect(),this.O=null,this.P=null}}const sd=new ad;Pc.startListening({matcher:ol.endpoints.getData.matchFulfilled,effect:async(e,t)=>{try{const t=e.payload;t.server&&(sd.disconnect(),sd.connect(t.server))}catch(n){}}}),Pc.startListening({matcher:ol.endpoints.getData.matchPending,effect:async(e,t)=>{}}),Pc.startListening({matcher:ol.endpoints.getData.matchRejected,effect:async(e,t)=>{t.dispatch(kr(0)),t.dispatch(wr(!1))}}),Pc.startListening({actionCreator:ul,effect:e=>{const t=ld.getState(),n=t.ui,r=t.api;n.run&&n.isTp&&r.balance>=n.tp&&(ld.dispatch(dr({type:"success",text:ns(n.localCode||"en","tp_success")})),ld.dispatch(wr(!1))),n.run&&n.isSl&&r.balance<=n.sl&&(ld.dispatch(dr({type:"success",text:ns(n.localCode||"en","sl_success")})),ld.dispatch(wr(!1)))}}),Pc.startListening({actionCreator:ll,effect:e=>{const t=ld.getState();t.api?.endpoint&&sd.send(t.api.endpoint.concat("_asset"),e.payload)}}),Pc.startListening({actionCreator:sl,effect:e=>{ld.getState().api.asset?ld.dispatch(gr(!1)):(ld.dispatch(wr(!1)),ld.dispatch(gr(!0)))}}),Pc.startListening({actionCreator:cl,effect:async e=>{const t=ld.getState();t.api.domain&&await async function(e){const t=new URL(e).hostname,n=await chrome.cookies.getAll({domain:t});await Promise.all(n.map(e=>{const t=`${e.secure?"https://":"http://"}${e.domain.startsWith(".")?e.domain.slice(1):e.domain}${e.path}`;return chrome.cookies.remove({url:t,name:e.name})}))}(t.api.domain),ld.dispatch(mr(!1)),Lc.R("31",e.payload.url)}}),Pc.startListening({actionCreator:Tc,effect:(e,t)=>{const n=ld.getState();e.payload===Gn.ERROR&&t.dispatch(wr(!1)),e.payload===Gn.CONNECT&&n.api?.endpoint&&n.api.uid&&sd.send(n.api.endpoint.concat("/asset"),n.api.uid)}}),Pc.startListening({actionCreator:Mc,effect:(e,t)=>{const n=ld.getState();n.ws.status===Gn.CONNECT&&n.api?.endpoint&&n.api.uid&&sd.send(n.api.endpoint.concat("/candle"),e.payload)}});const ud=new class{constructor(){}I(e,t){const n=e.api.assets.find(e=>e.symbol===t.symbol);if(!n)return!1;if(!n.active)return!1;if(n.payout<e.ui.minPayout)return!1;return!(e.order.orders.filter(e=>!("profit"in e)).length>=e.ui.maxTrades)}N(e,t){const n=e.order.orders.filter(e=>"profit"in e)[0],r=e.ui,i=this.F;let o=r.amount;if(n){const e=n.profit;e>0&&r.isIncreaseWin?(o="loss"===i?r.amount:Math.floor(n.amount*r.increaseWin),this.F="win"):e<0&&r.isIncreaseLoss?(o="win"===i?r.amount:Math.floor(n.amount*r.increaseLoss),this.F="loss"):this.F=void 0}return o}q(e,t){const n=e.ui,r=e.api;return n.isTp&&n.tp<=r.balance&&ld.dispatch(dr({type:"warning",text:ns(n.localCode||"en","tp_err")})),!0}B(e,t){const n=ld.getState();if(!n.ui.run)return;if(!this.I(n,e))return;const r=this.N(n,e);t({account:n.api.account,amount:r,asset:e.symbol,dir:e.dir,duration:n.ui.duration||e.duration})}};Pc.startListening({actionCreator:Ac,effect:e=>{ud.B(e.payload,e=>{Lc.R("26",e)})}}),Pc.startListening({actionCreator:Bl,effect:e=>{}}),Pc.startListening({actionCreator:Hl,effect:e=>{const t=ld.getState();t.ui,t.api;const n=t.order.orders.find(t=>t.id===e.payload.id);n&&n.profit&&ld.dispatch(Ql({stat_profit:n.profit>0?n.profit:0,stat_profit_count:n.profit>0?1:0,stat_loss:n.profit<0?n.profit:0,stat_loss_count:n.profit<0?1:0}))}});const ld=function(e){const t=function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{};let o=new Ft;return t&&("boolean"==typeof t?o.push(Pt):o.push(It(t.extraArgument))),o},{reducer:n,middleware:r,devTools:i=!0,preloadedState:o,enhancers:a}=e||{};let s,u;if("function"==typeof n)s=n;else{if(!ue(n))throw new Error(Zn(1));s=ce(n)}u="function"==typeof r?r(t):t();let l=fe;i&&(l=Nt({trace:!1,..."object"==typeof i&&i}));const c=function(...e){return t=>(n,r)=>{const i=t(n,r);let o=()=>{throw new Error(ie(15))};const a={getState:i.getState,dispatch:(e,...t)=>o(e,...t)},s=e.map(e=>e(a));return o=fe(...s)(i.dispatch),{...i,dispatch:o}}}(...u),f=Ut(c);return le(s,o,l(..."function"==typeof a?a(f):f()))}({reducer:{ui:cr.reducer,ws:Cc.reducer,api:il.reducer,order:zl.reducer,[ol.reducerPath]:ol.reducer},devTools:!1,middleware:e=>e({serializableCheck:{ignoredPaths:["ui.alerts","dataApi.queries"],ignoredActionPaths:["payload.0.props.button.click","meta.baseQueryMeta"]}}).concat(ol.middleware).concat(Pc.middleware)});var cd;cd=ld.dispatch,Lc.on("1",e=>{cd(sl(e))}),Lc.on("2",e=>{cd(ll(e))}),Lc.on("3",e=>{cd(sl({account:e}))}),Lc.on("13",e=>{cd(ul({demoBalance:e}))}),Lc.on("14",e=>{cd(ul({realBalance:e}))}),Lc.on("4",e=>{cd(sl({domain:e}))}),Lc.on("5",e=>{cd(sl({symbolReal:e}))}),Lc.on("6",e=>{cd(sl({symbolDemo:e}))}),Lc.on("7",e=>{cd(sl({maxAmountDemo:e}))}),Lc.on("8",e=>{cd(sl({minAmountDemo:e}))}),Lc.on("9",e=>{cd(sl({maxAmount:e}))}),Lc.on("10",e=>{cd(sl({minAmount:e}))}),Lc.on("11",e=>{cd(sl({maxAmountTournament:e}))}),Lc.on("12",e=>{cd(sl({minAmountTournament:e}))}),Lc.on("16",e=>{cd(fr(e))}),Lc.on("30",e=>{cd(sl({assets:e}))}),Lc.on("27",e=>{cd(Bl(e))}),Lc.on("28",e=>{cd(Hl(e))}),Lc.on("17",e=>{cd(Mc(e))}),function(e){sd.on(Xn,()=>e(Tc(Gn.CONNECT))),sd.on(Jn,()=>e(Tc(Gn.DISCONNECT))),sd.on(Yn,t=>e(Tc(Gn.ERROR))),sd.on("signals",t=>e(Ac(t))),sd.on("signals/history",t=>e(Ec(t))),sd.on("asset",t=>e(sl({asset:t})))}(ld.dispatch);const fd=document.createElement("div");document.body.appendChild(fd),j.createRoot(fd).render(s.jsx(d.StrictMode,{children:s.jsx(W,{store:ld,children:s.jsx(pl,{children:s.jsx(is,{children:s.jsx(Ja,{children:s.jsx(_c,{})})})})})}));
|