2026-07-20 16:05:17 +00:00
|
|
|
// Module ID: 217
|
2026-07-29 08:29:29 +00:00
|
|
|
// Function ID: 218
|
2026-07-20 16:05:17 +00:00
|
|
|
// Name: _isNativeReflectConstruct
|
2026-07-29 08:29:29 +00:00
|
|
|
// Dependencies: [109, 41, 42, 93, 95, 98, 209, 218, 38, 200, 203, 212, 206, 220, 133, 221, 205, 132]
|
2026-07-20 16:05:17 +00:00
|
|
|
|
|
|
|
|
// Module 217 (_isNativeReflectConstruct)
|
2026-08-24 06:08:38 +00:00
|
|
|
import _modDef38 from "module_38" /* 38 */;
|
|
|
|
|
import _inheritsDefault from "_inherits" /* 98 */;
|
|
|
|
|
import dispatchDefault from "dispatch" /* 132 */;
|
|
|
|
|
import BlobManagerDefault from "BlobManager" /* 200 */;
|
|
|
|
|
import BlobDefault from "Blob" /* 203 */;
|
|
|
|
|
import NativeEventEmitterDefault from "NativeEventEmitter" /* 209 */;
|
|
|
|
|
import WebSocketModuleDefault from "WebSocketModule" /* 218 */;
|
|
|
|
|
import closure_4 from "_objectWithoutProperties" /* 109 */;
|
|
|
|
|
import closure_5 from "_classCallCheck" /* 41 */;
|
|
|
|
|
import closure_6 from "_possibleConstructorReturn" /* 93 */;
|
|
|
|
|
import closure_7 from "_getPrototypeOf" /* 95 */;
|
|
|
|
|
import importDefaultResult from "_createClass" /* 42 */;
|
2026-07-23 10:11:24 +00:00
|
|
|
|
2026-07-29 08:29:29 +00:00
|
|
|
const WebSocket = arg1;
|
2026-07-20 16:05:17 +00:00
|
|
|
function _isNativeReflectConstruct() {
|
2026-07-29 08:29:29 +00:00
|
|
|
try {
|
|
|
|
|
const _Boolean = Boolean;
|
|
|
|
|
const call = valueOf.call;
|
|
|
|
|
const _Reflect = Reflect;
|
|
|
|
|
const _Boolean2 = Boolean;
|
|
|
|
|
if (typeof call === "unknown") {
|
|
|
|
|
let callResult = valueOf();
|
|
|
|
|
} else {
|
|
|
|
|
callResult = call(constructResult);
|
|
|
|
|
}
|
2026-08-24 06:08:38 +00:00
|
|
|
closure_0 = !callResult;
|
|
|
|
|
_isNativeReflectConstruct = function _isNativeReflectConstruct() {
|
2026-07-29 08:29:29 +00:00
|
|
|
return closure_0;
|
2026-08-24 06:08:38 +00:00
|
|
|
};
|
2026-07-29 08:29:29 +00:00
|
|
|
return _isNativeReflectConstruct();
|
|
|
|
|
} catch (err) {
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
|
|
|
|
}
|
2026-07-23 10:11:24 +00:00
|
|
|
let closure_3 = ["headers"];
|
2026-08-24 06:08:38 +00:00
|
|
|
let closure_9 = 0;
|
2026-07-29 08:29:29 +00:00
|
|
|
class WebSocket {
|
|
|
|
|
constructor(arg0, arg1, arg2) {
|
|
|
|
|
self = this;
|
2026-08-24 06:08:38 +00:00
|
|
|
tmp3 = closure_5(this, WebSocket);
|
|
|
|
|
tmp4 = closure_7;
|
|
|
|
|
obj = closure_7(WebSocket);
|
|
|
|
|
tmp5 = closure_6;
|
2026-07-29 08:29:29 +00:00
|
|
|
if (_isNativeReflectConstruct()) {
|
|
|
|
|
tmp7 = globalThis;
|
|
|
|
|
_Reflect = Reflect;
|
|
|
|
|
constructResult = Reflect.construct(obj, [], tmp4(self).constructor);
|
|
|
|
|
} else {
|
|
|
|
|
constructResult = obj.apply(self, undefined);
|
|
|
|
|
}
|
|
|
|
|
tmp5Result = tmp5(self, constructResult);
|
|
|
|
|
tmp5Result.CONNECTING = 0;
|
|
|
|
|
tmp5Result.OPEN = 1;
|
|
|
|
|
tmp5Result.CLOSING = 2;
|
|
|
|
|
tmp5Result.CLOSED = 3;
|
|
|
|
|
tmp5Result.readyState = 0;
|
|
|
|
|
tmp5Result.url = global;
|
|
|
|
|
tmp8 = arg1;
|
2026-08-04 21:03:28 +00:00
|
|
|
if (typeof arg1 === "string") {
|
2026-07-29 08:29:29 +00:00
|
|
|
items = [];
|
|
|
|
|
items[0] = arg1;
|
|
|
|
|
tmp8 = items;
|
|
|
|
|
}
|
|
|
|
|
obj = importDefault;
|
|
|
|
|
if (!importDefault) {
|
|
|
|
|
obj = {};
|
|
|
|
|
}
|
|
|
|
|
headers = obj.headers;
|
|
|
|
|
if (undefined === headers) {
|
|
|
|
|
headers = {};
|
|
|
|
|
}
|
2026-08-24 06:08:38 +00:00
|
|
|
tmp9 = closure_4(obj, closure_3);
|
2026-07-29 08:29:29 +00:00
|
|
|
tmp10 = tmp9;
|
|
|
|
|
if (tmp9) {
|
2026-08-04 21:03:28 +00:00
|
|
|
tmp10 = typeof tmp9.origin === "string";
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
|
|
|
|
if (tmp10) {
|
|
|
|
|
tmp11 = globalThis;
|
|
|
|
|
_console = console;
|
|
|
|
|
str = "Specifying `origin` as a WebSocket connection option is deprecated. Include it under `headers` instead.";
|
|
|
|
|
warnResult = console.warn("Specifying `origin` as a WebSocket connection option is deprecated. Include it under `headers` instead.");
|
|
|
|
|
headers.origin = tmp9.origin;
|
|
|
|
|
str2 = "origin";
|
|
|
|
|
delete tmp2[tmp];
|
|
|
|
|
}
|
|
|
|
|
if (Object.keys(tmp9).length > 0) {
|
|
|
|
|
_console2 = console;
|
|
|
|
|
_Object = Object;
|
|
|
|
|
keys = Object.keys(tmp9);
|
|
|
|
|
str3 = "`, `";
|
|
|
|
|
str4 = "Unrecognized WebSocket connection option(s) `";
|
|
|
|
|
str5 = "`. Did you mean to put these under `headers`?";
|
|
|
|
|
warnResult1 = console.warn(`Unrecognized WebSocket connection option(s) \`${obj5.join("`, `")}\`. Did you mean to put these under \`headers\`?`);
|
|
|
|
|
}
|
|
|
|
|
tmp14 = tmp8;
|
|
|
|
|
if (!Array.isArray(tmp8)) {
|
|
|
|
|
tmp14 = null;
|
|
|
|
|
}
|
|
|
|
|
tmp15 = new require("NativeEventEmitter")(null);
|
|
|
|
|
tmp5Result._eventEmitter = tmp15;
|
2026-08-24 06:08:38 +00:00
|
|
|
tmp16 = +closure_9;
|
|
|
|
|
closure_9 = tmp16 + 1;
|
2026-07-29 08:29:29 +00:00
|
|
|
tmp5Result._socketId = tmp16;
|
|
|
|
|
_registerEventsResult = tmp5Result._registerEvents();
|
|
|
|
|
obj6 = require("WebSocketModule");
|
|
|
|
|
obj1 = { headers };
|
|
|
|
|
connectResult = obj6.connect(global, tmp14, obj1, tmp5Result._socketId);
|
|
|
|
|
return tmp5Result;
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-08-24 06:08:38 +00:00
|
|
|
_inheritsDefault(WebSocket, dispatchDefault);
|
2026-07-29 08:29:29 +00:00
|
|
|
let items = [
|
|
|
|
|
{
|
|
|
|
|
key: "binaryType",
|
|
|
|
|
get() {
|
|
|
|
|
return this._binaryType;
|
|
|
|
|
},
|
|
|
|
|
set(_binaryType) {
|
|
|
|
|
if ("blob" !== _binaryType) {
|
|
|
|
|
if ("arraybuffer" !== _binaryType) {
|
|
|
|
|
const _Error = Error;
|
2026-08-24 06:08:38 +00:00
|
|
|
error = new Error("binaryType must be either 'blob' or 'arraybuffer'");
|
2026-07-29 08:29:29 +00:00
|
|
|
throw error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const self = this;
|
|
|
|
|
if (!tmp2) {
|
2026-08-24 06:08:38 +00:00
|
|
|
_modDef38(BlobManagerDefault.isAvailable, "Native module BlobModule is required for blob support");
|
2026-07-29 08:29:29 +00:00
|
|
|
if ("blob" === _binaryType) {
|
|
|
|
|
let tmp3Result = tmp3(200);
|
|
|
|
|
tmp3Result.addWebSocketHandler(self._socketId);
|
|
|
|
|
} else {
|
|
|
|
|
tmp3Result = tmp3(200);
|
|
|
|
|
const result = tmp3Result.removeWebSocketHandler(self._socketId);
|
|
|
|
|
}
|
2026-08-24 06:08:38 +00:00
|
|
|
const tmp5 = _modDef38;
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
|
|
|
|
self._binaryType = _binaryType;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: "close",
|
|
|
|
|
value: function close(arg0, arg1) {
|
|
|
|
|
const self = this;
|
|
|
|
|
if (tmp) {
|
|
|
|
|
self.readyState = self.CLOSING;
|
|
|
|
|
self._close(arg0, arg1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: "send",
|
2026-08-04 21:03:28 +00:00
|
|
|
value: function send(str) {
|
2026-07-29 08:29:29 +00:00
|
|
|
const self = this;
|
|
|
|
|
if (this.readyState === this.CONNECTING) {
|
|
|
|
|
const _Error2 = Error;
|
2026-08-24 06:08:38 +00:00
|
|
|
error = new Error("INVALID_STATE_ERR");
|
2026-07-29 08:29:29 +00:00
|
|
|
throw error;
|
2026-08-24 06:08:38 +00:00
|
|
|
} else if (str instanceof BlobDefault) {
|
2026-07-29 08:29:29 +00:00
|
|
|
let tmp16Result = tmp16(38);
|
|
|
|
|
tmp16Result(tmp16(200).isAvailable, "Native module BlobModule is required for blob support");
|
|
|
|
|
tmp16Result = tmp16(200);
|
2026-08-04 21:03:28 +00:00
|
|
|
tmp16Result.sendOverSocket(str, self._socketId);
|
|
|
|
|
} else if (typeof str !== "string") {
|
2026-07-29 08:29:29 +00:00
|
|
|
const _ArrayBuffer = ArrayBuffer;
|
2026-08-04 21:03:28 +00:00
|
|
|
if (!(str instanceof ArrayBuffer)) {
|
2026-07-29 08:29:29 +00:00
|
|
|
const _ArrayBuffer2 = ArrayBuffer;
|
2026-08-04 21:03:28 +00:00
|
|
|
if (!ArrayBuffer.isView(str)) {
|
2026-07-29 08:29:29 +00:00
|
|
|
const _Error = Error;
|
|
|
|
|
const error1 = new Error("Unsupported data type");
|
|
|
|
|
throw error1;
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-08-04 21:03:28 +00:00
|
|
|
tmp16(218).sendBinary(tmp16(212)(str), self._socketId);
|
2026-07-29 08:29:29 +00:00
|
|
|
const tmp16Result1 = tmp16(218);
|
|
|
|
|
} else {
|
2026-08-04 21:03:28 +00:00
|
|
|
tmp16(218).send(str, self._socketId);
|
2026-07-29 08:29:29 +00:00
|
|
|
const tmp16Result2 = tmp16(218);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: "ping",
|
|
|
|
|
value: function ping() {
|
|
|
|
|
if (this.readyState === this.CONNECTING) {
|
|
|
|
|
const _Error = Error;
|
2026-08-24 06:08:38 +00:00
|
|
|
error = new Error("INVALID_STATE_ERR");
|
2026-07-29 08:29:29 +00:00
|
|
|
throw error;
|
|
|
|
|
} else {
|
2026-08-24 06:08:38 +00:00
|
|
|
WebSocketModuleDefault.ping(tmp._socketId);
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: "_close",
|
2026-08-04 21:03:28 +00:00
|
|
|
value: function _close(num, str) {
|
|
|
|
|
num = 1000;
|
|
|
|
|
str = "";
|
2026-07-29 08:29:29 +00:00
|
|
|
const self = this;
|
2026-08-24 06:08:38 +00:00
|
|
|
WebSocketModuleDefault.close(num, str, this._socketId);
|
|
|
|
|
let isAvailable = BlobManagerDefault.isAvailable;
|
2026-07-29 08:29:29 +00:00
|
|
|
if (isAvailable) {
|
|
|
|
|
isAvailable = "blob" === self._binaryType;
|
|
|
|
|
}
|
|
|
|
|
if (isAvailable) {
|
2026-08-24 06:08:38 +00:00
|
|
|
const result = BlobManagerDefault.removeWebSocketHandler(self._socketId);
|
|
|
|
|
const tmpResult = BlobManagerDefault;
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: "_unregisterEvents",
|
|
|
|
|
value: function _unregisterEvents() {
|
|
|
|
|
const _subscriptions = this._subscriptions;
|
|
|
|
|
const item = _subscriptions.forEach((remove) => remove.remove());
|
|
|
|
|
this._subscriptions = [];
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: "_registerEvents",
|
|
|
|
|
value: function _registerEvents() {
|
|
|
|
|
const self = this;
|
|
|
|
|
const _eventEmitter = this._eventEmitter;
|
|
|
|
|
const items = [
|
|
|
|
|
_eventEmitter.addListener("websocketMessage", (id) => {
|
|
|
|
|
let dispatchEventResult = id;
|
|
|
|
|
let obj = self;
|
|
|
|
|
if (id.id === self._socketId) {
|
|
|
|
|
({ data, type } = dispatchEventResult);
|
|
|
|
|
if ("binary" === type) {
|
2026-08-24 06:08:38 +00:00
|
|
|
data = closure_1_1(closure_1_2[12]).toByteArray(dispatchEventResult.data).buffer;
|
|
|
|
|
const obj3 = closure_1_1(closure_1_2[12]);
|
2026-07-29 08:29:29 +00:00
|
|
|
} else if ("blob" === type) {
|
2026-08-24 06:08:38 +00:00
|
|
|
data = closure_1_1(closure_1_2[9]).createFromOptions(dispatchEventResult.data);
|
|
|
|
|
const obj2 = closure_1_1(closure_1_2[9]);
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
|
|
|
|
obj = { data: null, raw_length: null };
|
|
|
|
|
obj[0] = data;
|
|
|
|
|
obj[1] = dispatchEventResult.raw_length;
|
2026-08-24 06:08:38 +00:00
|
|
|
const tmp11 = new closure_1_1(closure_1_2[13])("message", obj);
|
2026-07-29 08:29:29 +00:00
|
|
|
dispatchEventResult = obj.dispatchEvent(tmp11);
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
,
|
|
|
|
|
,
|
|
|
|
|
|
|
|
|
|
];
|
|
|
|
|
const _eventEmitter2 = this._eventEmitter;
|
|
|
|
|
items[1] = _eventEmitter2.addListener("websocketOpen", (id) => {
|
|
|
|
|
if (id.id === self._socketId) {
|
|
|
|
|
obj.readyState = obj.OPEN;
|
|
|
|
|
obj.protocol = id.protocol;
|
2026-08-24 06:08:38 +00:00
|
|
|
const tmp5 = new closure_1_1(closure_1_2[14])("open");
|
2026-07-29 08:29:29 +00:00
|
|
|
obj.dispatchEvent(tmp5);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
const _eventEmitter3 = this._eventEmitter;
|
|
|
|
|
items[2] = _eventEmitter3.addListener("websocketClosed", (id) => {
|
|
|
|
|
let obj = self;
|
|
|
|
|
if (id.id === self._socketId) {
|
|
|
|
|
obj.readyState = obj.CLOSED;
|
|
|
|
|
obj = { code: null, reason: null };
|
|
|
|
|
({ code: obj2[0], reason: obj2[1] } = id);
|
2026-08-24 06:08:38 +00:00
|
|
|
const tmp6 = new closure_1_1(closure_1_2[15])("close", obj);
|
2026-07-29 08:29:29 +00:00
|
|
|
obj.dispatchEvent(tmp6);
|
|
|
|
|
obj._unregisterEvents();
|
|
|
|
|
obj.close();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
const _eventEmitter4 = this._eventEmitter;
|
|
|
|
|
items[3] = _eventEmitter4.addListener("websocketFailed", (id) => {
|
|
|
|
|
let obj = self;
|
|
|
|
|
if (id.id === self._socketId) {
|
|
|
|
|
obj.readyState = obj.CLOSED;
|
2026-08-24 06:08:38 +00:00
|
|
|
const tmp5 = new closure_1_1(closure_1_2[14])("error");
|
2026-07-29 08:29:29 +00:00
|
|
|
obj.dispatchEvent(tmp5);
|
|
|
|
|
obj = { code: 1006, reason: null };
|
|
|
|
|
obj[1] = id.message;
|
2026-08-24 06:08:38 +00:00
|
|
|
const tmp11 = new closure_1_1(closure_1_2[15])("close", obj);
|
2026-07-29 08:29:29 +00:00
|
|
|
obj.dispatchEvent(tmp11);
|
|
|
|
|
obj._unregisterEvents();
|
|
|
|
|
obj.close();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this._subscriptions = items;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: "onclose",
|
|
|
|
|
get() {
|
|
|
|
|
return WebSocket(205).getEventHandlerAttribute(this, "close");
|
|
|
|
|
},
|
2026-08-04 21:03:28 +00:00
|
|
|
set(fn) {
|
|
|
|
|
const result = WebSocket(205).setEventHandlerAttribute(this, "close", fn);
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: "onerror",
|
|
|
|
|
get() {
|
|
|
|
|
return WebSocket(205).getEventHandlerAttribute(this, "error");
|
|
|
|
|
},
|
2026-08-04 21:03:28 +00:00
|
|
|
set(fn) {
|
|
|
|
|
const result = WebSocket(205).setEventHandlerAttribute(this, "error", fn);
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: "onmessage",
|
|
|
|
|
get() {
|
|
|
|
|
return WebSocket(205).getEventHandlerAttribute(this, "message");
|
|
|
|
|
},
|
2026-08-04 21:03:28 +00:00
|
|
|
set(fn) {
|
|
|
|
|
const result = WebSocket(205).setEventHandlerAttribute(this, "message", fn);
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: "onopen",
|
|
|
|
|
get() {
|
|
|
|
|
return WebSocket(205).getEventHandlerAttribute(this, "open");
|
|
|
|
|
},
|
2026-08-04 21:03:28 +00:00
|
|
|
set(fn) {
|
|
|
|
|
const result = WebSocket(205).setEventHandlerAttribute(this, "open", fn);
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
const importDefaultResultResult = importDefaultResult(WebSocket, items);
|
|
|
|
|
importDefaultResultResult.CONNECTING = 0;
|
|
|
|
|
importDefaultResultResult.OPEN = 1;
|
|
|
|
|
importDefaultResultResult.CLOSING = 2;
|
|
|
|
|
importDefaultResultResult.CLOSED = 3;
|
2026-07-20 16:05:17 +00:00
|
|
|
|
2026-07-29 08:29:29 +00:00
|
|
|
export default importDefaultResultResult;
|