![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /var/www/html/libs/absol-full/dist/js/ |
Upload File : |
/*** module: node_modules/absol/src/Network/RemoteThread.tpl ***/ module.exports = "function safeThrow(error) {\r\n setTimeout(function () {\r\n throw error;\r\n }, 0);\r\n}\r\n\r\nfunction EventEmitter() {\r\n if (!this._azar_extendEvents) {\r\n Object.defineProperty(this, '_azar_extendEvents', {\r\n enumerable: false,\r\n value: this._azar_extendEvents || { supported: {}, prioritize: {}, nonprioritize: {} }\r\n });\r\n Object.defineProperty(this, '__azar_force', {\r\n value: true,\r\n enumerable: false\r\n });\r\n }\r\n}\r\n\r\n\r\nEventEmitter.prototype.defineEvent = function (name) {\r\n if (name instanceof Array) {\r\n for (var i = 0; i < name.length; ++i)\r\n this._azar_extendEvents.supported[name[i]] = true;\r\n }\r\n else\r\n this._azar_extendEvents.supported[name] = true;\r\n return this;\r\n};\r\n\r\nEventEmitter.prototype.isSupportedEvent = function (name) {\r\n return true;\r\n};\r\n\r\n\r\nEventEmitter.prototype.emit = function (eventName, data) {\r\n this.fire.apply(this, arguments);\r\n};\r\n\r\nEventEmitter.prototype.fire = function (eventName, data) {\r\n var others = Array.prototype.slice.call(arguments, 1);\r\n if (this.isSupportedEvent(eventName)) {\r\n var listenerList;\r\n var i;\r\n if (this._azar_extendEvents.prioritize[eventName]) {\r\n listenerList = this._azar_extendEvents.prioritize[eventName].slice();\r\n for (i = 0; i < listenerList.length; ++i) {\r\n try {\r\n listenerList[i].wrappedCallback.apply(this, others);\r\n } catch (e) {\r\n safeThrow(e);\r\n }\r\n }\r\n }\r\n\r\n if (this._azar_extendEvents.nonprioritize[eventName]) {\r\n listenerList = this._azar_extendEvents.nonprioritize[eventName].slice();\r\n for (i = 0; i < listenerList.length; ++i) {\r\n try {\r\n listenerList[i].wrappedCallback.apply(this, others);\r\n } catch (e) {\r\n safeThrow(e);\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n if (this.dispatchEvent) {\r\n var event = new Event(eventName);\r\n data && Object.assign(event, data);\r\n this.dispatchEvent(event);\r\n }\r\n else\r\n throw new Error(\"Not support event \" + eventName);\r\n }\r\n return this;\r\n};\r\n\r\n\r\nEventEmitter.prototype.eventEmittorOnWithTime = function (isOnce, arg0, arg1, arg2) {\r\n if (typeof arg0 == 'object') {\r\n for (var key in arg0) {\r\n this.eventEmittorOnWithTime(isOnce, key, arg0[key]);\r\n }\r\n return this;\r\n }\r\n else {\r\n if (typeof arg1 == 'object') {\r\n return this.eventEmittorOnWithTime(isOnce, arg0, arg1.callback, arg1.cap);\r\n }\r\n else {\r\n var eventArr = this._azar_extendEvents[arg2 ? 'prioritize' : 'nonprioritize'][arg0] || [];\r\n var eventIndex = -1;\r\n for (var i = 0; i < eventArr.length; ++i) {\r\n if (eventArr[i].wrappedCallback == arg1) {\r\n eventIndex = i;\r\n break;\r\n }\r\n }\r\n if (eventIndex < 0) {\r\n var event = { isOnce: isOnce, eventName: arg0, callback: arg1, cap: !!arg2 };\r\n //wrappedCallback will be call\r\n if (isOnce) {\r\n event.wrappedCallback = function () {\r\n event.callback.apply(this, arguments);\r\n this.off(event.eventName, event.wrappedCallback, event.cap);\r\n };\r\n }\r\n else {\r\n event.wrappedCallback = event.callback;\r\n }\r\n\r\n if (!this.isSupportedEvent(arg0)) {\r\n if (this.addEventListener) {\r\n this.addEventListener(arg0, event.wrappedCallback, !!arg2);\r\n }\r\n else {\r\n this.attachEvent('on' + arg0, arg1, !!arg2);\r\n }\r\n }\r\n\r\n eventArr.push(event);\r\n this._azar_extendEvents[arg2 ? 'prioritize' : 'nonprioritize'][arg0] = eventArr;\r\n }\r\n else {\r\n console.warn(\"dupplicate event\");\r\n }\r\n\r\n }\r\n return this;\r\n }\r\n};\r\n\r\n\r\nEventEmitter.prototype.on = function (arg0, arg1, arg2) {\r\n this.eventEmittorOnWithTime(false, arg0, arg1, arg2);\r\n return this;\r\n};\r\n\r\n\r\nEventEmitter.prototype.once = function (arg0, arg1, arg2) {\r\n this.eventEmittorOnWithTime(true, arg0, arg1, arg2);\r\n return this;\r\n};\r\n\r\nEventEmitter.prototype.off = function (arg0, arg1, arg2) {\r\n if (typeof arg0 == 'object') {\r\n for (var key in arg0) {\r\n this.off(key, arg0[key]);\r\n }\r\n return this;\r\n }\r\n else {\r\n if (typeof arg1 == 'object') {\r\n return this.off(arg0, arg1.callback, arg1.cap);\r\n }\r\n else {\r\n var eventArr = this._azar_extendEvents[arg2 ? 'prioritize' : 'nonprioritize'][arg0] || [];\r\n var newEventArray = [];\r\n for (var i = 0; i < eventArr.length; ++i) {\r\n var event = eventArr[i];\r\n if (event.wrappedCallback == arg1) {\r\n //Dont add to newEventArray\r\n if (this.isSupportedEvent(arg0)) {\r\n }\r\n else {\r\n if (this.removeEventListener) {\r\n this.removeEventListener(event.eventName, event.wrappedCallback, !!event.cap);\r\n }\r\n else {\r\n this.detachEvent('on' + event.eventName, event.wrappedCallback, !!event.cap);\r\n }\r\n }\r\n }\r\n else {\r\n newEventArray.push(event);\r\n }\r\n }\r\n this._azar_extendEvents[arg2 ? 'prioritize' : 'nonprioritize'][arg0] = newEventArray;\r\n return this;\r\n }\r\n }\r\n\r\n};\r\n\r\n\r\nvar TYPE_WORKER = 'WORKER';\r\n\r\n/**\r\n *\r\n * @param {Worker|HTMLIFrameElement|WorkerGlobalScope|Window=} host\r\n */\r\nfunction IFrameBridge(host) {\r\n EventEmitter.call(this);\r\n /***\r\n *\r\n * @type {Worker|HTMLIFrameElement|WorkerGlobalScope|Window|WorkerGlobalScope|Window}\r\n */\r\n this.host = host || self;\r\n this.sender = null;\r\n this.receiver = null;\r\n this.origin = null;\r\n this.type = 'NOT_DETECT';\r\n this.id = \"UNSET\";\r\n\r\n this.sync = this._detectHost().then(() => this._attach());\r\n\r\n this.__azarResolveCallbacks = {};\r\n this.__azarRejectCallbacks = {};\r\n}\r\n\r\nIFrameBridge.prototype._detectHost = function () {\r\n this.type = TYPE_WORKER;\r\n this.sender = this.host;\r\n this.receiver = this.host;\r\n return Promise.resolve();\r\n};\r\n\r\n\r\nIFrameBridge.prototype._attach = function () {\r\n if (this.receiver.addEventListener) {\r\n this.receiver.addEventListener(\"message\", this.__azarMessageListener.bind(this), false);\r\n }\r\n else if (this.receiver.attachEvent) {\r\n this.receiver.attachEvent(\"onmessage\", this.__azarMessageListener.bind(this));\r\n }\r\n else {\r\n this.receiver.onmessage = this.__azarMessageListener.bind(this);\r\n }\r\n};\r\n\r\n\r\nIFrameBridge.getInstance = function () {\r\n if (!IFrameBridge.shareInstance) {\r\n var origin = location.origin;\r\n var rootOrigin = IFrameBridge.getParentUrl().match(/^(http|https):\\/\\/[^/]+/);\r\n if (rootOrigin) {\r\n rootOrigin = rootOrigin[0];\r\n }\r\n else {\r\n rootOrigin = origin;\r\n }\r\n\r\n // IFrameBridge.shareInstance = new IFrameBridge(self, rootOrigin == origin? undefined: \"*\" || rootOrigin );\r\n var host = self;\r\n IFrameBridge.shareInstance = new IFrameBridge(host, rootOrigin);\r\n }\r\n return IFrameBridge.shareInstance;\r\n};\r\n\r\n\r\nObject.defineProperties(IFrameBridge.prototype, Object.getOwnPropertyDescriptors(EventEmitter.prototype));\r\nIFrameBridge.prototype.constructor = IFrameBridge;\r\n\r\n\r\nIFrameBridge.getParentUrl = function () {\r\n var parentUrl = (window.location != window.parent.location)\r\n ? document.referrer\r\n : document.location.href;\r\n return parentUrl;\r\n};\r\n\r\nIFrameBridge.prototype.__azarMessageListener = function (event) {\r\n this.__azarHandleData(event.data);\r\n};\r\n\r\n\r\nIFrameBridge.prototype.__azarHandleData = function (data) {\r\n if (data.bridgeId !== this.id) return;\r\n if (data.type) {\r\n if (data.type == \"INVOKE\") {\r\n try {\r\n var result = this.__azarSelfInvoke(data.name, data.params);\r\n if (result && typeof result.then == 'function') {\r\n result.then(function (result) {\r\n this.__azarResolve(data.taskId, result);\r\n }.bind(this))\r\n .catch(function (err) {\r\n safeThrow(err);\r\n this.__azarResolve(data.taskId, null, err);\r\n }.bind(this));\r\n }\r\n else {\r\n this.__azarResolve(data.taskId, result);\r\n }\r\n } catch (err) {\r\n safeThrow(err);\r\n this.__azarResolve(data.taskId, null, err);\r\n }\r\n }\r\n else if (data.type == \"INVOKE_RESULT\") {\r\n if (this.__azarResolveCallbacks[data.taskId]) {\r\n if (data.error) {\r\n this.__azarRejectCallbacks[data.taskId](data.error);\r\n }\r\n else {\r\n this.__azarResolveCallbacks[data.taskId](data.result);\r\n }\r\n delete this.__azarResolveCallbacks[data.taskId];\r\n delete this.__azarRejectCallbacks[data.taskId];\r\n }\r\n }\r\n else if (data.type == \"EMIT\") {\r\n this.fire.apply(this, data.params);\r\n }\r\n else this.fire('message', data, this);\r\n }\r\n};\r\n\r\n\r\nIFrameBridge.prototype.__azarResolve = function (taskId, result, error) {\r\n var data = {\r\n type: \"INVOKE_RESULT\",\r\n taskId: taskId,\r\n result: result,\r\n error: error,\r\n bridgeId: this.id\r\n };\r\n\r\n if (this.origin) {\r\n this.sender.postMessage(data, this.origin);\r\n }\r\n else {\r\n this.sender.postMessage(data);\r\n }\r\n};\r\n\r\n\r\nIFrameBridge.prototype.__azarSelfInvoke = function (name, params) {\r\n if (typeof this[name] == 'function') {\r\n return this[name].apply(this, params);\r\n }\r\n else {\r\n return this[name];\r\n }\r\n};\r\n\r\n\r\nIFrameBridge.prototype.emit = function () {\r\n var params = [];\r\n params.push.apply(params, arguments);\r\n this.sync.then(function () {\r\n var data = {\r\n type: \"EMIT\",\r\n params: params,\r\n bridgeId: this.id\r\n };\r\n if (this.origin) {\r\n this.sender.postMessage(data, this.origin);\r\n }\r\n else {\r\n this.sender.postMessage(data);\r\n }\r\n }.bind(this));\r\n return this;\r\n};\r\n\r\n\r\nIFrameBridge.prototype.invoke = function (name) {\r\n var params = [];\r\n params.push.apply(params, arguments);\r\n params.shift();\r\n return this.sync.then(function () {\r\n var indent = randomIdent(32);\r\n var data = {\r\n type: 'INVOKE',\r\n params: params,\r\n taskId: indent,\r\n name: name,\r\n bridgeId: this.id\r\n };\r\n if (this.origin) {\r\n this.host.postMessage(data, this.origin);\r\n }\r\n else {\r\n this.host.postMessage(data);\r\n }\r\n return new Promise(function (resolve, reject) {\r\n this.__azarResolveCallbacks[indent] = resolve;\r\n this.__azarRejectCallbacks[indent] = reject;\r\n }.bind(this));\r\n }.bind(this));\r\n};\r\n\r\nIFrameBridge.prototype.importScriptURLs = function () {\r\n return this.invoke.apply(this, ['_receiveScriptURLs'].concat(Array.prototype.slice.call(arguments)));\r\n};\r\n\r\nIFrameBridge.prototype.importScript = function (code) {\r\n var blob = new Blob([code], { type: 'application/javascript' });\r\n var url = URL.createObjectURL(blob);\r\n return this.importScriptURLs(url);\r\n};\r\n\r\n\r\nIFrameBridge.prototype.createMethod = function (name, fx) {\r\n this[name] = function () {\r\n return this.invoke.apply(this, [name].concat(Array.prototype.slice.call(arguments)));\r\n };\r\n return this.invoke.apply(this, ['_receiveMethod', name, fx.toString()]);\r\n};\r\n\r\n\r\nIFrameBridge.prototype._receiveScriptURLs = function () {\r\n if (self.importScripts) {\r\n self.importScripts.apply(self, arguments);\r\n }\r\n};\r\n\r\n\r\nIFrameBridge.prototype._receiveMethod = function (name, code) {\r\n this[name] = (new Function('return ' + code))();\r\n};\r\n\r\n\r\nvar IFrameBridge_prototype_descriptors = Object.getOwnPropertyDescriptors(IFrameBridge.prototype);\r\ndelete IFrameBridge_prototype_descriptors.constructor;\r\n\r\nObject.defineProperties(self, IFrameBridge_prototype_descriptors);\r\nIFrameBridge.call(self, self);";