Emperor_Shun_Reading/public/dist/assets/SocketServer-e72728e3.js

2 lines
41 KiB
JavaScript
Raw Permalink Normal View History

2024-08-22 08:50:01 +00:00
import{_ as t,b as e,o as s,c as n,f as i,e as r,w as o,t as a,a as h,h as c,p as u,k as p}from"./index-f69ca7de.js";const l=Object.create(null);l.open="0",l.close="1",l.ping="2",l.pong="3",l.message="4",l.upgrade="5",l.noop="6";const d=Object.create(null);Object.keys(l).forEach((t=>{d[l[t]]=t}));const f={type:"error",data:"parser error"},y="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),g="function"==typeof ArrayBuffer,m=t=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,b=({type:t,data:e},s,n)=>y&&e instanceof Blob?s?n(e):v(e,n):g&&(e instanceof ArrayBuffer||m(e))?s?n(e):v(new Blob([e]),n):n(l[t]+(e||"")),v=(t,e)=>{const s=new FileReader;return s.onload=function(){const t=s.result.split(",")[1];e("b"+(t||""))},s.readAsDataURL(t)};function w(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let k;const _="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",E="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let Kt=0;Kt<64;Kt++)E[_.charCodeAt(Kt)]=Kt;const A="function"==typeof ArrayBuffer,O=(t,e)=>{if("string"!=typeof t)return{type:"message",data:R(t,e)};const s=t.charAt(0);if("b"===s)return{type:"message",data:T(t.substring(1),e)};return d[s]?t.length>1?{type:d[s],data:t.substring(1)}:{type:d[s]}:f},T=(t,e)=>{if(A){const s=(t=>{let e,s,n,i,r,o=.75*t.length,a=t.length,h=0;"="===t[t.length-1]&&(o--,"="===t[t.length-2]&&o--);const c=new ArrayBuffer(o),u=new Uint8Array(c);for(e=0;e<a;e+=4)s=E[t.charCodeAt(e)],n=E[t.charCodeAt(e+1)],i=E[t.charCodeAt(e+2)],r=E[t.charCodeAt(e+3)],u[h++]=s<<2|n>>4,u[h++]=(15&n)<<4|i>>2,u[h++]=(3&i)<<6|63&r;return c})(t);return R(s,e)}return{base64:!0,data:t}},R=(t,e)=>"blob"===e?t instanceof Blob?t:new Blob([t]):t instanceof ArrayBuffer?t:t.buffer,C=String.fromCharCode(30);function B(){return new TransformStream({transform(t,e){!function(t,e){y&&t.data instanceof Blob?t.data.arrayBuffer().then(w).then(e):g&&(t.data instanceof ArrayBuffer||m(t.data))?e(w(t.data)):b(t,!1,(t=>{k||(k=new TextEncoder),e(k.encode(t))}))}(t,(s=>{const n=s.length;let i;if(n<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,n);else if(n<65536){i=new Uint8Array(3);const t=new DataView(i.buffer);t.setUint8(0,126),t.setUint16(1,n)}else{i=new Uint8Array(9);const t=new DataView(i.buffer);t.setUint8(0,127),t.setBigUint64(1,BigInt(n))}t.data&&"string"!=typeof t.data&&(i[0]|=128),e.enqueue(i),e.enqueue(s)}))}})}let S;function N(t){return t.reduce(((t,e)=>t+e.length),0)}function x(t,e){if(t[0].length===e)return t.shift();const s=new Uint8Array(e);let n=0;for(let i=0;i<e;i++)s[i]=t[0][n++],n===t[0].length&&(t.shift(),n=0);return t.length&&n<t[0].length&&(t[0]=t[0].slice(n)),s}function L(t){if(t)return function(t){for(var e in L.prototype)t[e]=L.prototype[e];return t}(t)}L.prototype.on=L.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},L.prototype.once=function(t,e){function s(){this.off(t,s),e.apply(this,arguments)}return s.fn=e,this.on(t,s),this},L.prototype.off=L.prototype.removeListener=L.prototype.removeAllListeners=L.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var s,n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var i=0;i<n.length;i++)if((s=n[i])===e||s.fn===e){n.splice(i,1);break}return 0===n.length&&delete this._callbacks["$"+t],this},L.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),s=this._callbacks["$"+t],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(s){n=0;for(var i=(s=s.slice(0)).length;n<i;++n)s[n].apply(this,e)}return this},L.prototype.emitReserved=L.prototype.emit,L.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},L.prototype.hasL