@watone/wt-cli
Version:
watone tools
1 lines • 267 kB
JavaScript
import{_ as bi}from"./_plugin-vue_export-helper-c27b6911.js";import{o as wi,f as xi,a as Si,c as Ei}from"./index-ad22e409.js";function et(n,t){for(var e=0;e<t.length;e++){const r=t[e];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in n)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(n,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}const Y=Object.create(null);Y.open="0";Y.close="1";Y.ping="2";Y.pong="3";Y.message="4";Y.upgrade="5";Y.noop="6";const Ve=Object.create(null);Object.keys(Y).forEach(n=>{Ve[Y[n]]=n});const Ai={type:"error",data:"parser error"},Li=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Ri=typeof ArrayBuffer=="function",Ti=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,Wr=({type:n,data:t},e,r)=>Li&&t instanceof Blob?e?r(t):_r(t,r):Ri&&(t instanceof ArrayBuffer||Ti(t))?e?r(t):_r(new Blob([t]),r):r(Y[n]+(t||"")),_r=(n,t)=>{const e=new FileReader;return e.onload=function(){const r=e.result.split(",")[1];t("b"+(r||""))},e.readAsDataURL(n)},dr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Se=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<dr.length;n++)Se[dr.charCodeAt(n)]=n;const ki=n=>{let t=n.length*.75,e=n.length,r,i=0,s,a,c,o;n[n.length-1]==="="&&(t--,n[n.length-2]==="="&&t--);const l=new ArrayBuffer(t),u=new Uint8Array(l);for(r=0;r<e;r+=4)s=Se[n.charCodeAt(r)],a=Se[n.charCodeAt(r+1)],c=Se[n.charCodeAt(r+2)],o=Se[n.charCodeAt(r+3)],u[i++]=s<<2|a>>4,u[i++]=(a&15)<<4|c>>2,u[i++]=(c&3)<<6|o&63;return l},Di=typeof ArrayBuffer=="function",Ur=(n,t)=>{if(typeof n!="string")return{type:"message",data:jr(n,t)};const e=n.charAt(0);return e==="b"?{type:"message",data:Mi(n.substring(1),t)}:Ve[e]?n.length>1?{type:Ve[e],data:n.substring(1)}:{type:Ve[e]}:Ai},Mi=(n,t)=>{if(Di){const e=ki(n);return jr(e,t)}else return{base64:!0,data:n}},jr=(n,t)=>{switch(t){case"blob":return n instanceof ArrayBuffer?new Blob([n]):n;case"arraybuffer":default:return n}},$r=String.fromCharCode(30),Bi=(n,t)=>{const e=n.length,r=new Array(e);let i=0;n.forEach((s,a)=>{Wr(s,!1,c=>{r[a]=c,++i===e&&t(r.join($r))})})},Oi=(n,t)=>{const e=n.split($r),r=[];for(let i=0;i<e.length;i++){const s=Ur(e[i],t);if(r.push(s),s.type==="error")break}return r},Kr=4;function D(n){if(n)return Hi(n)}function Hi(n){for(var t in D.prototype)n[t]=D.prototype[t];return n}D.prototype.on=D.prototype.addEventListener=function(n,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(t),this};D.prototype.once=function(n,t){function e(){this.off(n,e),t.apply(this,arguments)}return e.fn=t,this.on(n,e),this};D.prototype.off=D.prototype.removeListener=D.prototype.removeAllListeners=D.prototype.removeEventListener=function(n,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var e=this._callbacks["$"+n];if(!e)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var r,i=0;i<e.length;i++)if(r=e[i],r===t||r.fn===t){e.splice(i,1);break}return e.length===0&&delete this._callbacks["$"+n],this};D.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),e=this._callbacks["$"+n],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(e){e=e.slice(0);for(var r=0,i=e.length;r<i;++r)e[r].apply(this,t)}return this};D.prototype.emitReserved=D.prototype.emit;D.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]};D.prototype.hasListeners=function(n){return!!this.listeners(n).length};const W=(()=>typeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function zr(n,...t){return t.reduce((e,r)=>(n.hasOwnProperty(r)&&(e[r]=n[r]),e),{})}const Fi=W.setTimeout,Pi=W.clearTimeout;function tt(n,t){t.useNativeTimers?(n.setTimeoutFn=Fi.bind(W),n.clearTimeoutFn=Pi.bind(W)):(n.setTimeoutFn=W.setTimeout.bind(W),n.clearTimeoutFn=W.clearTimeout.bind(W))}const Ii=1.33;function Ni(n){return typeof n=="string"?Wi(n):Math.ceil((n.byteLength||n.size)*Ii)}function Wi(n){let t=0,e=0;for(let r=0,i=n.length;r<i;r++)t=n.charCodeAt(r),t<128?e+=1:t<2048?e+=2:t<55296||t>=57344?e+=3:(r++,e+=4);return e}class Ui extends Error{constructor(t,e,r){super(t),this.description=e,this.context=r,this.type="TransportError"}}class qr extends D{constructor(t){super(),this.writable=!1,tt(this,t),this.opts=t,this.query=t.query,this.socket=t.socket}onError(t,e,r){return super.emitReserved("error",new Ui(t,e,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const e=Ur(t,this.socket.binaryType);this.onPacket(e)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}}const Vr="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),xt=64,ji={};let pr=0,Fe=0,mr;function yr(n){let t="";do t=Vr[n%xt]+t,n=Math.floor(n/xt);while(n>0);return t}function Gr(){const n=yr(+new Date);return n!==mr?(pr=0,mr=n):n+"."+yr(pr++)}for(;Fe<xt;Fe++)ji[Vr[Fe]]=Fe;function Yr(n){let t="";for(let e in n)n.hasOwnProperty(e)&&(t.length&&(t+="&"),t+=encodeURIComponent(e)+"="+encodeURIComponent(n[e]));return t}function $i(n){let t={},e=n.split("&");for(let r=0,i=e.length;r<i;r++){let s=e[r].split("=");t[decodeURIComponent(s[0])]=decodeURIComponent(s[1])}return t}let Xr=!1;try{Xr=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Ki=Xr;function Jr(n){const t=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||Ki))return new XMLHttpRequest}catch{}if(!t)try{return new W[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function zi(){}const qi=function(){return new Jr({xdomain:!1}).responseType!=null}();class Vi extends qr{constructor(t){if(super(t),this.polling=!1,typeof location<"u"){const r=location.protocol==="https:";let i=location.port;i||(i=r?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||i!==t.port,this.xs=t.secure!==r}const e=t&&t.forceBase64;this.supportsBinary=qi&&!e}get name(){return"polling"}doOpen(){this.poll()}pause(t){this.readyState="pausing";const e=()=>{this.readyState="paused",t()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||e()})),this.writable||(r++,this.once("drain",function(){--r||e()}))}else e()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const e=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};Oi(t,this.socket.binaryType).forEach(e),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,Bi(t,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let t=this.query||{};const e=this.opts.secure?"https":"http";let r="";this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=Gr()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.opts.port&&(e==="https"&&Number(this.opts.port)!==443||e==="http"&&Number(this.opts.port)!==80)&&(r=":"+this.opts.port);const i=Yr(t),s=this.opts.hostname.indexOf(":")!==-1;return e+"://"+(s?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(i.length?"?"+i:"")}request(t={}){return Object.assign(t,{xd:this.xd,xs:this.xs},this.opts),new G(this.uri(),t)}doWrite(t,e){const r=this.request({method:"POST",data:t});r.on("success",e),r.on("error",(i,s)=>{this.onError("xhr post error",i,s)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(e,r)=>{this.onError("xhr poll error",e,r)}),this.pollXhr=t}}class G extends D{constructor(t,e){super(),tt(this,e),this.opts=e,this.method=e.method||"GET",this.uri=t,this.async=e.async!==!1,this.data=e.data!==void 0?e.data:null,this.create()}create(){const t=zr(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd,t.xscheme=!!this.opts.xs;const e=this.xhr=new Jr(t);try{e.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){e.setDisableHeaderCheck&&e.setDisableHeaderCheck(!0);for(let r in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(r)&&e.setRequestHeader(r,this.opts.extraHeaders[r])}}catch{}if(this.method==="POST")try{e.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{e.setRequestHeader("Accept","*/*")}catch{}"withCredentials"in e&&(e.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(e.timeout=this.opts.requestTimeout),e.onreadystatechange=()=>{e.readyState===4&&(e.status===200||e.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof e.status=="number"?e.status:0)},0))},e.send(this.data)}catch(r){this.setTimeoutFn(()=>{this.onError(r)},0);return}typeof document<"u"&&(this.index=G.requestsCount++,G.requests[this.index]=this)}onError(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}cleanup(t){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=zi,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete G.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}G.requestsCount=0;G.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",gr);else if(typeof addEventListener=="function"){const n="onpagehide"in W?"pagehide":"unload";addEventListener(n,gr,!1)}}function gr(){for(let n in G.requests)G.requests.hasOwnProperty(n)&&G.requests[n].abort()}const Zr=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,e)=>e(t,0))(),Pe=W.WebSocket||W.MozWebSocket,vr=!0,Gi="arraybuffer",Cr=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Yi extends qr{constructor(t){super(t),this.supportsBinary=!t.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const t=this.uri(),e=this.opts.protocols,r=Cr?{}:zr(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=vr&&!Cr?e?new Pe(t,e):new Pe(t):new Pe(t,e,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType||Gi,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let e=0;e<t.length;e++){const r=t[e],i=e===t.length-1;Wr(r,this.supportsBinary,s=>{const a={};try{vr&&this.ws.send(s)}catch{}i&&Zr(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){let t=this.query||{};const e=this.opts.secure?"wss":"ws";let r="";this.opts.port&&(e==="wss"&&Number(this.opts.port)!==443||e==="ws"&&Number(this.opts.port)!==80)&&(r=":"+this.opts.port),this.opts.timestampRequests&&(t[this.opts.timestampParam]=Gr()),this.supportsBinary||(t.b64=1);const i=Yr(t),s=this.opts.hostname.indexOf(":")!==-1;return e+"://"+(s?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(i.length?"?"+i:"")}check(){return!!Pe}}const Xi={websocket:Yi,polling:Vi},Ji=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Zi=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function St(n){const t=n,e=n.indexOf("["),r=n.indexOf("]");e!=-1&&r!=-1&&(n=n.substring(0,e)+n.substring(e,r).replace(/:/g,";")+n.substring(r,n.length));let i=Ji.exec(n||""),s={},a=14;for(;a--;)s[Zi[a]]=i[a]||"";return e!=-1&&r!=-1&&(s.source=t,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s.pathNames=Qi(s,s.path),s.queryKey=en(s,s.query),s}function Qi(n,t){const e=/\/{2,9}/g,r=t.replace(e,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function en(n,t){const e={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,s){i&&(e[i]=s)}),e}let ie=class extends D{constructor(t,e={}){super(),this.writeBuffer=[],t&&typeof t=="object"&&(e=t,t=null),t?(t=St(t),e.hostname=t.host,e.secure=t.protocol==="https"||t.protocol==="wss",e.port=t.port,t.query&&(e.query=t.query)):e.host&&(e.hostname=St(e.host).host),tt(this,e),this.secure=e.secure!=null?e.secure:typeof location<"u"&&location.protocol==="https:",e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.hostname=e.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=e.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=e.transports||["polling","websocket"],this.writeBuffer=[],this.prevBufferLen=0,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:!0},e),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=$i(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const e=Object.assign({},this.opts.query);e.EIO=Kr,e.transport=t,this.id&&(e.sid=this.id);const r=Object.assign({},this.opts.transportOptions[t],this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new Xi[t](r)}open(){let t;if(this.opts.rememberUpgrade&&ie.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else t=this.transports[0];this.readyState="opening";try{t=this.createTransport(t)}catch{this.transports.shift(),this.open();return}t.open(),this.setTransport(t)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.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))}probe(t){let e=this.createTransport(t),r=!1;ie.priorWebsocketSuccess=!1;const i=()=>{r||(e.send([{type:"ping",data:"probe"}]),e.once("packet",h=>{if(!r)if(h.type==="pong"&&h.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",e),!e)return;ie.priorWebsocketSuccess=e.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(u(),this.setTransport(e),e.send([{type:"upgrade"}]),this.emitReserved("upgrade",e),e=null,this.upgrading=!1,this.flush())})}else{const f=new Error("probe error");f.transport=e.name,this.emitReserved("upgradeError",f)}}))};function s(){r||(r=!0,u(),e.close(),e=null)}const a=h=>{const f=new Error("probe error: "+h);f.transport=e.name,s(),this.emitReserved("upgradeError",f)};function c(){a("transport closed")}function o(){a("socket closed")}function l(h){e&&h.name!==e.name&&s()}const u=()=>{e.removeListener("open",i),e.removeListener("error",a),e.removeListener("close",c),this.off("close",o),this.off("upgrading",l)};e.once("open",i),e.once("error",a),e.once("close",c),this.once("close",o),this.once("upgrading",l),e.open()}onOpen(){if(this.readyState="open",ie.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let t=0;const e=this.upgrades.length;for(;t<e;t++)this.probe(this.upgrades[t])}}onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this.resetPingTimeout(),this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let r=0;r<this.writeBuffer.length;r++){const i=this.writeBuffer[r].data;if(i&&(e+=Ni(i)),r>0&&e>this.maxPayload)return this.writeBuffer.slice(0,r);e+=2}return this.writeBuffer}write(t,e,r){return this.sendPacket("message",t,e,r),this}send(t,e,r){return this.sendPacket("message",t,e,r),this}sendPacket(t,e,r,i){if(typeof e=="function"&&(i=e,e=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const s={type:t,data:e,options:r};this.emitReserved("packetCreate",s),this.writeBuffer.push(s),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},e=()=>{this.off("upgrade",e),this.off("upgradeError",e),t()},r=()=>{this.once("upgrade",e),this.once("upgradeError",e)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}onError(t){ie.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(t,e){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",t,e),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const e=[];let r=0;const i=t.length;for(;r<i;r++)~this.transports.indexOf(t[r])&&e.push(t[r]);return e}};ie.protocol=Kr;function tn(n,t="",e){let r=n;e=e||typeof location<"u"&&location,n==null&&(n=e.protocol+"//"+e.host),typeof n=="string"&&(n.charAt(0)==="/"&&(n.charAt(1)==="/"?n=e.protocol+n:n=e.host+n),/^(https?|wss?):\/\//.test(n)||(typeof e<"u"?n=e.protocol+"//"+n:n="https://"+n),r=St(n)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const s=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+s+":"+r.port+t,r.href=r.protocol+"://"+s+(e&&e.port===r.port?"":":"+r.port),r}const rn=typeof ArrayBuffer=="function",nn=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,Qr=Object.prototype.toString,sn=typeof Blob=="function"||typeof Blob<"u"&&Qr.call(Blob)==="[object BlobConstructor]",on=typeof File=="function"||typeof File<"u"&&Qr.call(File)==="[object FileConstructor]";function Rt(n){return rn&&(n instanceof ArrayBuffer||nn(n))||sn&&n instanceof Blob||on&&n instanceof File}function Ge(n,t){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let e=0,r=n.length;e<r;e++)if(Ge(n[e]))return!0;return!1}if(Rt(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return Ge(n.toJSON(),!0);for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)&&Ge(n[e]))return!0;return!1}function an(n){const t=[],e=n.data,r=n;return r.data=Et(e,t),r.attachments=t.length,{packet:r,buffers:t}}function Et(n,t){if(!n)return n;if(Rt(n)){const e={_placeholder:!0,num:t.length};return t.push(n),e}else if(Array.isArray(n)){const e=new Array(n.length);for(let r=0;r<n.length;r++)e[r]=Et(n[r],t);return e}else if(typeof n=="object"&&!(n instanceof Date)){const e={};for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=Et(n[r],t));return e}return n}function ln(n,t){return n.data=At(n.data,t),delete n.attachments,n}function At(n,t){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<t.length)return t[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let e=0;e<n.length;e++)n[e]=At(n[e],t);else if(typeof n=="object")for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&(n[e]=At(n[e],t));return n}const hn=5;var w;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(w||(w={}));class cn{constructor(t){this.replacer=t}encode(t){return(t.type===w.EVENT||t.type===w.ACK)&&Ge(t)?this.encodeAsBinary({type:t.type===w.EVENT?w.BINARY_EVENT:w.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let e=""+t.type;return(t.type===w.BINARY_EVENT||t.type===w.BINARY_ACK)&&(e+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(e+=t.nsp+","),t.id!=null&&(e+=t.id),t.data!=null&&(e+=JSON.stringify(t.data,this.replacer)),e}encodeAsBinary(t){const e=an(t),r=this.encodeAsString(e.packet),i=e.buffers;return i.unshift(r),i}}class Tt extends D{constructor(t){super(),this.reviver=t}add(t){let e;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");e=this.decodeString(t);const r=e.type===w.BINARY_EVENT;r||e.type===w.BINARY_ACK?(e.type=r?w.EVENT:w.ACK,this.reconstructor=new un(e),e.attachments===0&&super.emitReserved("decoded",e)):super.emitReserved("decoded",e)}else if(Rt(t)||t.base64)if(this.reconstructor)e=this.reconstructor.takeBinaryData(t),e&&(this.reconstructor=null,super.emitReserved("decoded",e));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let e=0;const r={type:Number(t.charAt(0))};if(w[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===w.BINARY_EVENT||r.type===w.BINARY_ACK){const s=e+1;for(;t.charAt(++e)!=="-"&&e!=t.length;);const a=t.substring(s,e);if(a!=Number(a)||t.charAt(e)!=="-")throw new Error("Illegal attachments");r.attachments=Number(a)}if(t.charAt(e+1)==="/"){const s=e+1;for(;++e&&!(t.charAt(e)===","||e===t.length););r.nsp=t.substring(s,e)}else r.nsp="/";const i=t.charAt(e+1);if(i!==""&&Number(i)==i){const s=e+1;for(;++e;){const a=t.charAt(e);if(a==null||Number(a)!=a){--e;break}if(e===t.length)break}r.id=Number(t.substring(s,e+1))}if(t.charAt(++e)){const s=this.tryParse(t.substr(e));if(Tt.isPayloadValid(r.type,s))r.data=s;else throw new Error("invalid payload")}return r}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,e){switch(t){case w.CONNECT:return typeof e=="object";case w.DISCONNECT:return e===void 0;case w.CONNECT_ERROR:return typeof e=="string"||typeof e=="object";case w.EVENT:case w.BINARY_EVENT:return Array.isArray(e)&&e.length>0;case w.ACK:case w.BINARY_ACK:return Array.isArray(e)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class un{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const e=ln(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const fn=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Tt,Encoder:cn,get PacketType(){return w},protocol:hn},Symbol.toStringTag,{value:"Module"}));function K(n,t,e){return n.on(t,e),function(){n.off(t,e)}}const _n=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class ei extends D{constructor(t,e,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=e,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[K(t,"open",this.onopen.bind(this)),K(t,"packet",this.onpacket.bind(this)),K(t,"error",this.onerror.bind(this)),K(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...e){if(_n.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(e.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(e),this;const r={type:w.EVENT,data:e};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof e[e.length-1]=="function"){const a=this.ids++,c=e.pop();this._registerAckCallback(a,c),r.id=a}const i=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!i||!this.connected)||(this.connected?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r)),this.flags={},this}_registerAckCallback(t,e){var r;const i=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(i===void 0){this.acks[t]=e;return}const s=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let a=0;a<this.sendBuffer.length;a++)this.sendBuffer[a].id===t&&this.sendBuffer.splice(a,1);e.call(this,new Error("operation has timed out"))},i);this.acks[t]=(...a)=>{this.io.clearTimeoutFn(s),e.apply(this,[null,...a])}}emitWithAck(t,...e){const r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((i,s)=>{e.push((a,c)=>r?a?s(a):i(c):i(a)),this.emit(t,...e)})}_addToQueue(t){let e;typeof t[t.length-1]=="function"&&(e=t.pop());const r={id:this.ids++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...s)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),e&&e(i)):(this._queue.shift(),e&&e(null,...s)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(){if(this._queue.length===0)return;const t=this._queue[0];if(t.pending)return;t.pending=!0,t.tryCount++;const e=this.ids;this.ids=t.id,this.flags=t.flags,this.emit.apply(this,t.args),this.ids=e}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:w.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,e){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,e)}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case w.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.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 w.EVENT:case w.BINARY_EVENT:this.onevent(t);break;case w.ACK:case w.BINARY_ACK:this.onack(t);break;case w.DISCONNECT:this.ondisconnect();break;case w.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const e=t.data||[];t.id!=null&&e.push(this.ack(t.id)),this.connected?this.emitEvent(e):this.receiveBuffer.push(Object.freeze(e))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const e=this._anyListeners.slice();for(const r of e)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const e=this;let r=!1;return function(...i){r||(r=!0,e.packet({type:w.ACK,id:t,data:i}))}}onack(t){const e=this.acks[t.id];typeof e=="function"&&(e.apply(this,t.data),delete this.acks[t.id])}onconnect(t,e){this.id=t,this.recovered=e&&this._pid===e,this._pid=e,this.connected=!0,this.emitBuffered(),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:w.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const e=this._anyListeners;for(let r=0;r<e.length;r++)if(t===e[r])return e.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const e=this._anyOutgoingListeners;for(let r=0;r<e.length;r++)if(t===e[r])return e.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const e=this._anyOutgoingListeners.slice();for(const r of e)r.apply(this,t.data)}}}function ye(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}ye.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),e=Math.floor(t*this.jitter*n);n=Math.floor(t*10)&1?n+e:n-e}return Math.min(n,this.max)|0};ye.prototype.reset=function(){this.attempts=0};ye.prototype.setMin=function(n){this.ms=n};ye.prototype.setMax=function(n){this.max=n};ye.prototype.setJitter=function(n){this.jitter=n};class Lt extends D{constructor(t,e){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(e=t,t=void 0),e=e||{},e.path=e.path||"/socket.io",this.opts=e,tt(this,e),this.reconnection(e.reconnection!==!1),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor((r=e.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new ye({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(e.timeout==null?2e4:e.timeout),this._readyState="closed",this.uri=t;const i=e.parser||fn;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=e.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var e;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(e=this.backoff)===null||e===void 0||e.setMin(t),this)}randomizationFactor(t){var e;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(e=this.backoff)===null||e===void 0||e.setJitter(t),this)}reconnectionDelayMax(t){var e;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(e=this.backoff)===null||e===void 0||e.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new ie(this.uri,this.opts);const e=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=K(e,"open",function(){r.onopen(),t&&t()}),s=K(e,"error",a=>{r.cleanup(),r._readyState="closed",this.emitReserved("error",a),t?t(a):r.maybeReconnectOnOpen()});if(this._timeout!==!1){const a=this._timeout;a===0&&i();const c=this.setTimeoutFn(()=>{i(),e.close(),e.emit("error",new Error("timeout"))},a);this.opts.autoUnref&&c.unref(),this.subs.push(function(){clearTimeout(c)})}return this.subs.push(i),this.subs.push(s),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(K(t,"ping",this.onping.bind(this)),K(t,"data",this.ondata.bind(this)),K(t,"error",this.onerror.bind(this)),K(t,"close",this.onclose.bind(this)),K(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(e){this.onclose("parse error",e)}}ondecoded(t){Zr(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,e){let r=this.nsps[t];return r||(r=new ei(this,t,e),this.nsps[t]=r),this._autoConnect&&r.connect(),r}_destroy(t){const e=Object.keys(this.nsps);for(const r of e)if(this.nsps[r].active)return;this._close()}_packet(t){const e=this.encoder.encode(t);for(let r=0;r<e.length;r++)this.engine.write(e[r],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(t,e){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,e),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const e=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},e);this.opts.autoUnref&&r.unref(),this.subs.push(function(){clearTimeout(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const we={};function Ye(n,t){typeof n=="object"&&(t=n,n=void 0),t=t||{};const e=tn(n,t.path||"/socket.io"),r=e.source,i=e.id,s=e.path,a=we[i]&&s in we[i].nsps,c=t.forceNew||t["force new connection"]||t.multiplex===!1||a;let o;return c?o=new Lt(r,t):(we[i]||(we[i]=new Lt(r,t)),o=we[i]),e.query&&!t.query&&(t.query=e.queryKey),o.socket(e.path,t)}Object.assign(Ye,{Manager:Lt,Socket:ei,io:Ye,connect:Ye});var C=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ti={},kt={},Dt={},Mt={},Bt={},z={};Object.defineProperty(z,"__esModule",{value:!0});var dn=function(){function n(){this._listeners=[]}return Object.defineProperty(n.prototype,"event",{get:function(){var t=this;return this._event||(this._event=function(e){t._listeners.push(e);var r={dispose:function(){for(var i=0;i<t._listeners.length;i++)if(t._listeners[i]===e){t._listeners.splice(i,1);return}}};return r}),this._event},enumerable:!0,configurable:!0}),n.prototype.fire=function(t){for(var e=[],r=0;r<this._listeners.length;r++)e.push(this._listeners[r]);for(var r=0;r<e.length;r++)e[r].call(void 0,t)},n}();z.EventEmitter2=dn;Object.defineProperty(Bt,"__esModule",{value:!0});var lt=z,pn=function(){function n(t){this._maxLength=t,this.onDeleteEmitter=new lt.EventEmitter2,this.onInsertEmitter=new lt.EventEmitter2,this.onTrimEmitter=new lt.EventEmitter2,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}return Object.defineProperty(n.prototype,"onDelete",{get:function(){return this.onDeleteEmitter.event},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"onInsert",{get:function(){return this.onInsertEmitter.event},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"onTrim",{get:function(){return this.onTrimEmitter.event},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"maxLength",{get:function(){return this._maxLength},set:function(t){if(this._maxLength!==t){for(var e=new Array(t),r=0;r<Math.min(t,this.length);r++)e[r]=this._array[this._getCyclicIndex(r)];this._array=e,this._maxLength=t,this._startIndex=0}},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"length",{get:function(){return this._length},set:function(t){if(t>this._length)for(var e=this._length;e<t;e++)this._array[e]=void 0;this._length=t},enumerable:!0,configurable:!0}),n.prototype.get=function(t){return this._array[this._getCyclicIndex(t)]},n.prototype.set=function(t,e){this._array[this._getCyclicIndex(t)]=e},n.prototype.push=function(t){this._array[this._getCyclicIndex(this._length)]=t,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++},n.prototype.recycle=function(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]},Object.defineProperty(n.prototype,"isFull",{get:function(){return this._length===this._maxLength},enumerable:!0,configurable:!0}),n.prototype.pop=function(){return this._array[this._getCyclicIndex(this._length---1)]},n.prototype.splice=function(t,e){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];if(e){for(var s=t;s<this._length-e;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+e)];this._length-=e}for(var s=this._length-1;s>=t;s--)this._array[this._getCyclicIndex(s+r.length)]=this._array[this._getCyclicIndex(s)];for(var s=0;s<r.length;s++)this._array[this._getCyclicIndex(t+s)]=r[s];if(this._length+r.length>this._maxLength){var a=this._length+r.length-this._maxLength;this._startIndex+=a,this._length=this._maxLength,this.onTrimEmitter.fire(a)}else this._length+=r.length},n.prototype.trimStart=function(t){t>this._length&&(t=this._length),this._startIndex+=t,this._length-=t,this.onTrimEmitter.fire(t)},n.prototype.shiftElements=function(t,e,r){if(!(e<=0)){if(t<0||t>=this._length)throw new Error("start argument out of range");if(t+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(var i=e-1;i>=0;i--)this.set(t+i+r,this.get(t+i));var s=t+e+r-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(var i=0;i<e;i++)this.set(t+i+r,this.get(t+i))}},n.prototype._getCyclicIndex=function(t){return(this._startIndex+t)%this._maxLength},n}();Bt.CircularList=pn;var q={},Q={};Object.defineProperty(Q,"__esModule",{value:!0});function mn(n){return n>65535?(n-=65536,String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):String.fromCharCode(n)}Q.stringFromCodePoint=mn;function yn(n,t,e){t===void 0&&(t=0),e===void 0&&(e=n.length);for(var r="",i=t;i<e;++i){var s=n[i];s>65535?(s-=65536,r+=String.fromCharCode((s>>10)+55296)+String.fromCharCode(s%1024+56320)):r+=String.fromCharCode(s)}return r}Q.utf32ToString=yn;var gn=function(){function n(){this._interim=0}return n.prototype.clear=function(){this._interim=0},n.prototype.decode=function(t,e){var r=t.length;if(!r)return 0;var i=0,s=0;if(this._interim){var a=t.charCodeAt(s++);56320<=a&&a<=57343?e[i++]=(this._interim-55296)*1024+a-56320+65536:(e[i++]=this._interim,e[i++]=a),this._interim=0}for(var c=s;c<r;++c){var o=t.charCodeAt(c);if(55296<=o&&o<=56319){if(++c>=r)return this._interim=o,i;var a=t.charCodeAt(c);56320<=a&&a<=57343?e[i++]=(o-55296)*1024+a-56320+65536:(e[i++]=o,e[i++]=a);continue}e[i++]=o}return i},n}();Q.StringToUtf32=gn;var vn=function(){function n(){this.interim=new Uint8Array(3)}return n.prototype.clear=function(){this.interim.fill(0)},n.prototype.decode=function(t,e){var r=t.length;if(!r)return 0;var i=0,s,a,c,o,l=0,u=0;if(this.interim[0]){var h=!1,f=this.interim[0];f&=(f&224)===192?31:(f&240)===224?15:7;for(var _=0,d=void 0;(d=this.interim[++_]&63)&&_<4;)f<<=6,f|=d;for(var p=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,m=p-_;u<m;){if(u>=r)return 0;if(d=t[u++],(d&192)!==128){u--,h=!0;break}else this.interim[_++]=d,f<<=6,f|=d&63}h||(p===2?f<128?u--:e[i++]=f:p===3?f<2048||f>=55296&&f<=57343||(e[i++]=f):l<65536||l>1114111||(e[i++]=f)),this.interim.fill(0)}for(var x=r-4,g=u;g<r;){for(;g<x&&!((s=t[g])&128)&&!((a=t[g+1])&128)&&!((c=t[g+2])&128)&&!((o=t[g+3])&128);)e[i++]=s,e[i++]=a,e[i++]=c,e[i++]=o,g+=4;if(s=t[g++],s<128)e[i++]=s;else if((s&224)===192){if(g>=r)return this.interim[0]=s,i;if(a=t[g++],(a&192)!==128){g--;continue}if(l=(s&31)<<6|a&63,l<128){g--;continue}e[i++]=l}else if((s&240)===224){if(g>=r)return this.interim[0]=s,i;if(a=t[g++],(a&192)!==128){g--;continue}if(g>=r)return this.interim[0]=s,this.interim[1]=a,i;if(c=t[g++],(c&192)!==128){g--;continue}if(l=(s&15)<<12|(a&63)<<6|c&63,l<2048||l>=55296&&l<=57343)continue;e[i++]=l}else if((s&248)===240){if(g>=r)return this.interim[0]=s,i;if(a=t[g++],(a&192)!==128){g--;continue}if(g>=r)return this.interim[0]=s,this.interim[1]=a,i;if(c=t[g++],(c&192)!==128){g--;continue}if(g>=r)return this.interim[0]=s,this.interim[1]=a,this.interim[2]=c,i;if(o=t[g++],(o&192)!==128){g--;continue}if(l=(s&7)<<18|(a&63)<<12|(c&63)<<6|o&63,l<65536||l>1114111)continue;e[i++]=l}}return i},n}();Q.Utf8ToUtf32=vn;var ge={};Object.defineProperty(ge,"__esModule",{value:!0});ge.DEFAULT_COLOR=256;(function(n){var t=C&&C.__extends||function(){var o=function(l,u){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,f){h.__proto__=f}||function(h,f){for(var _ in f)f.hasOwnProperty(_)&&(h[_]=f[_])},o(l,u)};return function(l,u){o(l,u);function h(){this.constructor=l}l.prototype=u===null?Object.create(u):(h.prototype=u.prototype,new h)}}();Object.defineProperty(n,"__esModule",{value:!0});var e=Q,r=ge;n.DEFAULT_ATTR=0<<18|r.DEFAULT_COLOR<<9|256<<0,n.CHAR_DATA_ATTR_INDEX=0,n.CHAR_DATA_CHAR_INDEX=1,n.CHAR_DATA_WIDTH_INDEX=2,n.CHAR_DATA_CODE_INDEX=3,n.NULL_CELL_CHAR="",n.NULL_CELL_WIDTH=1,n.NULL_CELL_CODE=0,n.WHITESPACE_CELL_CHAR=" ",n.WHITESPACE_CELL_WIDTH=1,n.WHITESPACE_CELL_CODE=32;var i=3,s=function(){function o(){this.fg=0,this.bg=0}return o.toColorRGB=function(l){return[l>>>16&255,l>>>8&255,l&255]},o.fromColorRGB=function(l){return(l[0]&255)<<16|(l[1]&255)<<8|l[2]&255},o.prototype.clone=function(){var l=new o;return l.fg=this.fg,l.bg=this.bg,l},o.prototype.isInverse=function(){return this.fg&67108864},o.prototype.isBold=function(){return this.fg&134217728},o.prototype.isUnderline=function(){return this.fg&268435456},o.prototype.isBlink=function(){return this.fg&536870912},o.prototype.isInvisible=function(){return this.fg&1073741824},o.prototype.isItalic=function(){return this.bg&67108864},o.prototype.isDim=function(){return this.bg&134217728},o.prototype.getFgColorMode=function(){return this.fg&50331648},o.prototype.getBgColorMode=function(){return this.bg&50331648},o.prototype.isFgRGB=function(){return(this.fg&50331648)===50331648},o.prototype.isBgRGB=function(){return(this.bg&50331648)===50331648},o.prototype.isFgPalette=function(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432},o.prototype.isBgPalette=function(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432},o.prototype.isFgDefault=function(){return(this.fg&50331648)===0},o.prototype.isBgDefault=function(){return(this.bg&50331648)===0},o.prototype.getFgColor=function(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}},o.prototype.getBgColor=function(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}},o}();n.AttributeData=s,n.DEFAULT_ATTR_DATA=Object.freeze(new s);var a=function(o){t(l,o);function l(){var u=o!==null&&o.apply(this,arguments)||this;return u.content=0,u.fg=0,u.bg=0,u.combinedData="",u}return l.fromCharData=function(u){var h=new l;return h.setFromCharData(u),h},l.prototype.isCombined=function(){return this.content&2097152},l.prototype.getWidth=function(){return this.content>>22},l.prototype.getChars=function(){return this.content&2097152?this.combinedData:this.content&2097151?e.stringFromCodePoint(this.content&2097151):""},l.prototype.getCode=function(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151},l.prototype.setFromCharData=function(u){this.fg=u[n.CHAR_DATA_ATTR_INDEX],this.bg=0;var h=!1;if(u[n.CHAR_DATA_CHAR_INDEX].length>2)h=!0;else if(u[n.CHAR_DATA_CHAR_INDEX].length===2){var f=u[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=f&&f<=56319){var _=u[n.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=_&&_<=57343?this.content=(f-55296)*1024+_-56320+65536|u[n.CHAR_DATA_WIDTH_INDEX]<<22:h=!0}else h=!0}else this.content=u[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|u[n.CHAR_DATA_WIDTH_INDEX]<<22;h&&(this.combinedData=u[n.CHAR_DATA_CHAR_INDEX],this.content=2097152|u[n.CHAR_DATA_WIDTH_INDEX]<<22)},l.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},l}(s);n.CellData=a;var c=function(){function o(l,u,h){h===void 0&&(h=!1),this.isWrapped=h,this._combined={},this._data=new Uint32Array(l*i);for(var f=u||a.fromCharData([0,n.NULL_CELL_CHAR,n.NULL_CELL_WIDTH,n.NULL_CELL_CODE]),_=0;_<l;++_)this.setCell(_,f);this.length=l}return o.prototype.get=function(l){var u=this._data[l*i+0],h=u&2097151;return[this._data[l*i+1],u&2097152?this._combined[l]:h?e.stringFromCodePoint(h):"",u>>22,u&2097152?this._combined[l].charCodeAt(this._combined[l].length-1):h]},o.prototype.set=function(l,u){this._data[l*i+1]=u[n.CHAR_DATA_ATTR_INDEX],u[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[l]=u[1],this._data[l*i+0]=l|2097152|u[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[l*i+0]=u[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|u[n.CHAR_DATA_WIDTH_INDEX]<<22},o.prototype.getWidth=function(l){return this._data[l*i+0]>>22},o.prototype.hasWidth=function(l){return this._data[l*i+0]&12582912},o.prototype.getFg=function(l){return this._data[l*i+1]},o.prototype.getBg=function(l){return this._data[l*i+2]},o.prototype.hasContent=function(l){return this._data[l*i+0]&4194303},o.prototype.getCodePoint=function(l){var u=this._data[l*i+0];return u&2097152?this._combined[l].charCodeAt(this._combined[l].length-1):u&2097151},o.prototype.isCombined=function(l){return this._data[l*i+0]&2097152},o.prototype.getString=function(l){var u=this._data[l*i+0];return u&2097152?this._combined[l]:u&2097151?e.stringFromCodePoint(u&2097151):""},o.prototype.loadCell=function(l,u){var h=l*i;return u.content=this._data[h+0],u.fg=this._data[h+1],u.bg=this._data[h+2],u.content&2097152&&(u.combinedData=this._combined[l]),u},o.prototype.setCell=function(l,u){u.content&2097152&&(this._combined[l]=u.combinedData),this._data[l*i+0]=u.content,this._data[l*i+1]=u.fg,this._data[l*i+2]=u.bg},o.prototype.setCellFromCodePoint=function(l,u,h,f,_){this._data[l*i+0]=u|h<<22,this._data[l*i+1]=f,this._data[l*i+2]=_},o.prototype.addCodepointToCell=function(l,u){var h=this._data[l*i+0];h&2097152?this._combined[l]+=e.stri