moreShopAdmin/dist/admin/assets/socket.io-parser.4db37fe5.js

2 lines
5.6 KiB
JavaScript
Raw Normal View History

2024-11-08 17:23:40 +08:00
import{r as O}from"./@socket.io.573b606e.js";import{r as v}from"./debug.b392f131.js";var _={},y={},d={},g;function C(){if(g)return d;g=1,Object.defineProperty(d,"__esModule",{value:!0}),d.hasBinary=d.isBinary=void 0;const u=typeof ArrayBuffer=="function",E=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,a=Object.prototype.toString,N=typeof Blob=="function"||typeof Blob<"u"&&a.call(Blob)==="[object BlobConstructor]",p=typeof File=="function"||typeof File<"u"&&a.call(File)==="[object FileConstructor]";function n(e){return u&&(e instanceof ArrayBuffer||E(e))||N&&e instanceof Blob||p&&e instanceof File}d.isBinary=n;function i(e,o){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let f=0,B=e.length;f<B;f++)if(i(e[f]))return!0;return!1}if(n(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return i(e.toJSON(),!0);for(const f in e)if(Object.prototype.hasOwnProperty.call(e,f)&&i(e[f]))return!0;return!1}return d.hasBinary=i,d}var w;function k(){if(w)return y;w=1,Object.defineProperty(y,"__esModule",{value:!0}),y.reconstructPacket=y.deconstructPacket=void 0;const u=C();function E(n){const i=[],e=n.data,o=n;return o.data=a(e,i),o.attachments=i.length,{packet:o,buffers:i}}y.deconstructPacket=E;function a(n,i){if(!n)return n;if((0,u.isBinary)(n)){const e={_placeholder:!0,num:i.length};return i.push(n),e}else if(Array.isArray(n)){const e=new Array(n.length);for(let o=0;o<n.length;o++)e[o]=a(n[o],i);return e}else if(typeof n=="object"&&!(n instanceof Date)){const e={};for(const o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=a(n[o],i));return e}return n}function N(n,i){return n.data=p(n.data,i),delete n.attachments,n}y.reconstructPacket=N;function p(n,i){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<i.length)return i[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let e=0;e<n.length;e++)n[e]=p(n[e],i);else if(typeof n=="object")for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&(n[e]=p(n[e],i));return n}return y}var R;function S(){return R||(R=1,function(u){Object.defineProperty(u,"__esModule",{value:!0}),u.Decoder=u.Encoder=u.PacketType=u.protocol=void 0;const E=O,a=k(),N=C(),n=(0,v().default)("socket.io-parser"),i=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];u.protocol=5;var e;(function(c){c[c.CONNECT=0]="CONNECT",c[c.DISCONNECT=1]="DISCONNECT",c[c.EVENT=2]="EVENT",c[c.ACK=3]="ACK",c[c.CONNECT_ERROR=4]="CONNECT_ERROR",c[c.BINARY_EVENT=5]="BINARY_EVENT",c[c.BINARY_ACK=6]="BINARY_ACK"})(e=u.PacketType||(u.PacketType={}));class o{constructor(t){this.replacer=t}encode(t){return n("encoding packet %j",t),(t.type===e.EVENT||t.type===e.ACK)&&(0,N.hasBinary)(t)?this.encodeAsBinary({type:t.type===e.EVENT?e.BINARY_EVENT:e.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let r=""+t.type;return(t.type===e.BINARY_EVENT||t.type===e.BINARY_ACK)&&(r+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(r+=t.nsp+","),t.id!=null&&(r+=t.id),t.data!=null&&(r+=JSON.stringify(t.data,this.replacer)),n("encoded %j as %s",t,r),r}encodeAsBinary(t){const r=(0,a.deconstructPacket)(t),s=this.encodeAsString(r.packet),A=r.buffers;return A.unshift(s),A}}u.Encoder=o;function f(c){return Object.prototype.toString.call(c)==="[object Object]"}class B extends E.Emitter{constructor(t){super(),this.reviver=t}add(t){let r;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");r=this.decodeString(t);const s=r.type===e.BINARY_EVENT;s||r.type===e.BINARY_ACK?(r.type=s?e.EVENT:e.ACK,this.reconstructor=new m(r),r.attachments===0&&super.emitReserved("decoded",r)):super.emitReserved("decoded",r)}else if((0,N.isBinary)(t)||t.base64)if(this.reconstructor)r=this.reconstructor.takeBinaryData(t),r&&(this.reconstructor=null,super.emitReserved("decoded",r));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let r=0;const s={