New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ray-streaming

Package Overview
Dependencies
Maintainers
1
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ray-streaming - npm Package Compare versions

Comparing version 2.4.0 to 2.4.1

2

package.json
{
"name": "ray-streaming",
"license": "MIT",
"version": "2.4.0",
"version": "2.4.1",
"author": "Kitsch <xc648593557@gmail.com>",

@@ -6,0 +6,0 @@ "description": "RayStreaming WebRTC implement",

@@ -15,2 +15,2 @@ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("webrtc-adapter");var e=require("rxjs"),t=require("rxjs/webSocket"),n=require("rxjs/operators");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=i(require("resize-observer-polyfill")),r=function(){return r=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)};

PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */function a(e,t,n,i){return new(n||(n=Promise))((function(o,r){function a(e){try{c(i.next(e))}catch(e){r(e)}}function s(e){try{c(i.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))}function s(e,t){var n,i,o,r,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(r){return function(s){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(o=2&r[0]?i.return:r[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,r[1])).done)return o;switch(i=0,o&&(r=[2&r[0],o.value]),r[0]){case 0:case 1:o=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,i=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]<o[3])){a.label=r[1];break}if(6===r[0]&&a.label<o[1]){a.label=o[1],o=r;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(r);break}o[2]&&a.ops.pop(),a.trys.pop();continue}r=t.call(e,a)}catch(e){r=[6,e],i=0}finally{n=o=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,s])}}}function c(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}var u=Object.freeze({EnableLog:!1,AFKTimerGap:1e4});var p=function(e){return new DataView(e).getUint8(0)};function h(e,t,n){void 0===t&&(t=1),void 0===n&&(n="");var i,o=new DataView(e);return(i=e.byteLength-t,Object.keys(Array.from({length:i})).map((function(e){return Number(e)}))).map((function(e){return String.fromCharCode(o.getUint8(e+t))})).join(n)}function l(e){for(var t,n=new Array,i=0;i<e.length;i++)(t=e.charCodeAt(i))>=65536&&t<=1114111?(n.push(t>>18&7|240),n.push(t>>12&63|128),n.push(t>>6&63|128),n.push(63&t|128)):t>=2048&&t<=65535?(n.push(t>>12&15|224),n.push(t>>6&63|128),n.push(63&t|128)):t>=128&&t<=2047?(n.push(t>>6&31|192),n.push(63&t|128)):n.push(255&t);return n}function d(e,t){void 0===t&&(t=!1);var n=e.target,i=n.getBoundingClientRect(),o=i.left,r=i.top,a=e.clientX,s=e.clientY,c=e.movementY,u=e.movementX,p=n.clientHeight,h=n.clientWidth,l=n.videoHeight,d=n.videoWidth;return{x:Math.min(Math.max(a-o,0),h)*((t?d:65535)/h),y:Math.min(Math.max(s-r,0),p)*((t?l:65535)/p),dx:u*((t?d:32767)/h),dy:c*((t?l:32767)/p)}}var f=function(){function e(e,t){this.x=e,this.y=t}return e.fromTouch=function(t){return new e(t.pageX,t.pageY)},e}();function m(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function v(e){var t=c(Array.from(e[0].targetTouches),2),n=t[0],i=t[1],o=c(Array.from(e[1].targetTouches),2),r=o[0],a=o[1];return m(f.fromTouch(r),f.fromTouch(a))-m(f.fromTouch(n),f.fromTouch(i))}function y(e){var t=c(e,2),n=t[0],i=t[1],o=i.targetTouches[0].clientX-n.targetTouches[0].clientX,r=i.targetTouches[0].clientY-n.targetTouches[0].clientY;return{target:n.target,clientX:n.targetTouches[0].clientX,clientY:n.targetTouches[0].clientY,movementX:o,movementY:r}}function b(e){var t=e.target.getBoundingClientRect(),n=t.left,i=t.top,o=t.right,r=t.bottom,a=e.clientY,s=e.clientX,c=Math.abs(i-a),u=Math.abs(r-a),p=Math.abs(n-s),h=Math.abs(o-s);switch(Math.min(c,u,p,h)){case p:return{target:e.target,clientX:0,clientY:a,movementY:0,movementX:0};case c:return{target:e.target,clientX:s,clientY:0,movementY:0,movementX:0};default:return{target:e.target,clientX:s,clientY:a,movementY:0,movementX:0}}}var g,w,x,T,E,k,M,D,B=new(function(){function e(){this.APINameMap="exitFullscreen"in document?{requestFullscreen:"requestFullscreen",exitFullscreen:"exitFullscreen",fullscreenElement:"fullscreenElement",fullscreenEnabled:"fullscreenEnabled",fullscreenchange:"fullscreenchange"}:"webkitExitFullscreen"in document?{requestFullscreen:"webkitRequestFullscreen",exitFullscreen:"webkitExitFullscreen",fullscreenElement:"webkitFullscreenElement",fullscreenEnabled:"webkitFullscreenEnabled",fullscreenchange:"webkitfullscreenchange"}:{requestFullscreen:"mozRequestFullScreen",exitFullscreen:"mozCancelFullScreen",fullscreenElement:"mozFullScreenElement",fullscreenEnabled:"mozFullScreenEnabled",fullscreenchange:"mozfullscreenchange"}}return Object.defineProperty(e.prototype,"isFullscreen",{get:function(){return Boolean(document[this.APINameMap.fullscreenElement])},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"element",{get:function(){return document[this.APINameMap.fullscreenElement]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEnabled",{get:function(){return Boolean(document[this.APINameMap.fullscreenEnabled])},enumerable:!1,configurable:!0}),e.prototype.request=function(e,t){var n=this;return new Promise((function(i,o){var r=function(){screen.orientation.lock("landscape-primary"),document.removeEventListener(n.APINameMap.fullscreenchange,r),n.off(r),"keyboard"in navigator&&"lock"in navigator.keyboard&&navigator.keyboard.lock(["KeyW","Escape","KeyN","KeyT","MetaLeft"]),i()};n.on(r);var a=(e||document.documentElement)[n.APINameMap.requestFullscreen](t);a instanceof Promise&&a.then(r).catch(o)}))},e.prototype.exit=function(){var e=this;return new Promise((function(t,n){if(e.isFullscreen){var i=function(){e.off(i),t()};e.on(i);var o=document[e.APINameMap.exitFullscreen]();o instanceof Promise&&o.then(i).catch(n)}else t()}))},e.prototype.toggle=function(e,t){return this.isFullscreen?this.exit():this.request(e,t)},e.prototype.on=function(e){document.addEventListener(this.APINameMap.fullscreenchange,e)},e.prototype.off=function(e){document.removeEventListener(this.APINameMap.fullscreenchange,e)},e}()),P=function(){function e(){this.timer=NaN,this.idleTime=0}return e.prototype.reset=function(){this.idleTime=0},e.prototype.start=function(){var e=this;this.timer=window.setInterval((function(){e.idleTime+=1e3}),1e3)},e.prototype.clear=function(){window.clearInterval(this.timer)},e}(),S=function(){var e=this;this.promise=new Promise((function(t,n){e.resolve=t,e.reject=n}))},A=function(){function e(e,t,n,i){void 0===e&&(e=""),void 0===t&&(t=!0),void 0===n&&(n=0),void 0===i&&(i=0),this.base64=e,this.show=t,this.x=n,this.y=i}return e.parse=function(t){var n=new DataView(t),i=n.getUint32(1),o=n.getUint32(5),r=n.getUint32(9),a=n.getUint32(13),s=n.getUint32(17),c=n.getUint32(21),u=n.getUint8(29);if(0===r||0===a)return new e("",!!u,-i,-o);if(1===s&&4===c)return new e("",!!u,-i,-o);var p=document.createElement("canvas"),h=p.getContext("2d");p.width=r,p.height=a;var l=h.createImageData(r,a),d=l.data;d.set(new Uint8ClampedArray(t,30));for(var f=0;f<d.length;f+=4){var m=d[f];d[f]=d[f+2],d[f+2]=m}return h.putImageData(l,0,0),new e(p.toDataURL(),!!u,i,o)},e}(),L=function(){var e=this;this.listeners=[],this.listenersOncer=[],this.on=function(t){return e.listeners.push(t),{dispose:function(){return e.off(t)}}},this.once=function(t){e.listenersOncer.push(t)},this.off=function(t){var n=e.listeners.indexOf(t);n>-1&&e.listeners.splice(n,1)},this.offAll=function(){e.listenersOncer=[],e.listeners=[]},this.emit=function(t){e.listeners.forEach((function(e){return e(t)})),e.listenersOncer.forEach((function(e){return e(t)})),e.listenersOncer=[]},this.pipe=function(t){return e.on((function(e){return t.emit(e)}))}},C=function(){function e(){this.currentID=0,this.executeMap=new Map}return e.prototype.obtainID=function(){return this.currentID>=65535?this.currentID=0:++this.currentID},e.prototype.trigger=function(e,t){this.executeMap.has(e)&&(this.executeMap.get(e).resolve(t),this.executeMap.delete(e))},e.prototype.order=function(e){var t=this.obtainID();return this.executeMap.set(t,e),t},e}(),R=function(){function e(e,t){var n=this;void 0===t&&(t=function(){}),this.target=e,this.onExit=t,this.cursor=new A,this.handleVisibilityChange=function(){"visible"!==document.visibilityState||n.cursor.show||n.target.requestPointerLock()},this.handlePointerLockError=function(){document.addEventListener("click",(function(){n.cursor.show||n.target.requestPointerLock()}),{once:!0})},this.handlePointerLockChange=function(){n.isPointerLocking||n.cursor.show||B.isFullscreen||n.onExit()},e.requestPointerLock=e.requestPointerLock||e.mozRequestPointerLock||e.webkitRequestPointerLock,document.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock,document.addEventListener("pointerlockchange",this.handlePointerLockChange),document.addEventListener("pointerlockerror",this.handlePointerLockError),document.addEventListener("visibilitychange",this.handleVisibilityChange)}return e.prototype.destory=function(){this.target.style.cursor="default",document.removeEventListener("pointerlockerror",this.handlePointerLockChange),document.removeEventListener("pointerlockchange",this.handlePointerLockError),document.removeEventListener("visibilitychange",this.handleVisibilityChange)},e.prototype.setCursor=function(e){var t=this;if(this.cursor=e,e.show?document.exitPointerLock():this.target.requestPointerLock(),e.base64){var n=document.createElement("img");n.src=e.base64,n.onload=function(){if(n.width>32||n.height>32){var i=function(e){var t=document.createElement("canvas"),n=e.width>32?32:e.width,i=e.height>32?32:e.height;t.width=n,t.height=i;var o=t.getContext("2d");return null==o||o.drawImage(e,0,0,n,i),t.toDataURL()}(n);t.target.style.cursor="url(".concat(i,") ").concat(e.x," ").concat(e.y,", auto")}else t.target.style.cursor="url(".concat(e.base64,") ").concat(e.x," ").concat(e.y,", auto")}}else this.target.style.cursor="none"},Object.defineProperty(e.prototype,"isPointerLocking",{get:function(){return(document.pointerLockElement||document.mozPointerLockElement||document.webkitPointerLockElement)===this.target},enumerable:!1,configurable:!0}),e}();exports.EventType=void 0,(g=exports.EventType||(exports.EventType={}))[g.MouseMoveStandardization=0]="MouseMoveStandardization",g[g.MouseButton=1]="MouseButton",g[g.WheelScroll=2]="WheelScroll",g[g.Keyboard=3]="Keyboard",g[g.WinTouch=4]="WinTouch",g[g.MobileTouch=5]="MobileTouch",g[g.MobileCustom=6]="MobileCustom",g[g.URLIntercept=7]="URLIntercept",g[g.CaretVisible=8]="CaretVisible",g[g.TextInput=9]="TextInput",g[g.MobileKeys=10]="MobileKeys",g[g.Gamepad=11]="Gamepad",g[g.CursorData=12]="CursorData",g[g.MouseMoveNormalization=13]="MouseMoveNormalization",g[g.EventDelay=14]="EventDelay",g[g.EchoData=15]="EchoData",g[g.KickOutController=16]="KickOutController",g[g.ScreenshotParams=17]="ScreenshotParams",g[g.ClipboardData=18]="ClipboardData",g[g.WebRTCPluginsMSG=125]="WebRTCPluginsMSG",g[g.WebRTCForwardRSP=126]="WebRTCForwardRSP",g[g.WebRTCForwardREQ=127]="WebRTCForwardREQ",exports.ImageResultValue=void 0,(w=exports.ImageResultValue||(exports.ImageResultValue={}))[w.Failure=0]="Failure",w[w.Success=1]="Success",w[w.Portion=2]="Portion",exports.ImageStoreFormat=void 0,(x=exports.ImageStoreFormat||(exports.ImageStoreFormat={}))[x.Clipboard=0]="Clipboard",x[x.FileBMP=1]="FileBMP",x[x.FilePNG=2]="FilePNG",x[x.BinaryBMP=3]="BinaryBMP",x[x.BinaryPNG=4]="BinaryPNG",exports.MouseButtonType=void 0,(T=exports.MouseButtonType||(exports.MouseButtonType={}))[T.ButtonLeft=1]="ButtonLeft",T[T.ButtonMiddle=2]="ButtonMiddle",T[T.ButtonRight=3]="ButtonRight",T[T.ButtonX1=4]="ButtonX1",T[T.ButtonX2=5]="ButtonX2",exports.TouchType=void 0,(E=exports.TouchType||(exports.TouchType={}))[E.TouchDown=0]="TouchDown",E[E.TouchUpdate=1]="TouchUpdate",E[E.TouchUp=2]="TouchUp",exports.MoveType=void 0,(k=exports.MoveType||(exports.MoveType={}))[k.Absolute=0]="Absolute",k[k.Relative=1]="Relative",k[k.Passive=2]="Passive",k[k.Unknow=3]="Unknow",exports.GamepadType=void 0,(M=exports.GamepadType||(exports.GamepadType={}))[M.GamepadXbox=0]="GamepadXbox",exports.GamepadXboxButton=void 0,(D=exports.GamepadXboxButton||(exports.GamepadXboxButton={}))[D.GamepadXboxButtonDpadUp=1]="GamepadXboxButtonDpadUp",D[D.GamepadXboxButtonDpadDown=2]="GamepadXboxButtonDpadDown",D[D.GamepadXboxButtonDpadLeft=4]="GamepadXboxButtonDpadLeft",D[D.GamepadXboxButtonDpadRight=8]="GamepadXboxButtonDpadRight",D[D.GamepadXboxButtonStart=16]="GamepadXboxButtonStart",D[D.GamepadXboxButtonBack=32]="GamepadXboxButtonBack",D[D.GamepadXboxButtonLeftThumb=64]="GamepadXboxButtonLeftThumb",D[D.GamepadXboxButtonRightThumb=128]="GamepadXboxButtonRightThumb",D[D.GamepadXboxButtonLeftShoulder=256]="GamepadXboxButtonLeftShoulder",D[D.GamepadXboxButtonRightShoulder=512]="GamepadXboxButtonRightShoulder",D[D.GamepadXboxButtonA=4096]="GamepadXboxButtonA",D[D.GamepadXboxButtonB=8192]="GamepadXboxButtonB",D[D.GamepadXboxButtonX=16384]="GamepadXboxButtonX",D[D.GamepadXboxButtonY=32768]="GamepadXboxButtonY";var U,I,X=new Map([[0,exports.MouseButtonType.ButtonLeft],[1,exports.MouseButtonType.ButtonMiddle],[2,exports.MouseButtonType.ButtonRight],[3,exports.MouseButtonType.ButtonX1],[4,exports.MouseButtonType.ButtonX2]]),z=function(){function e(e,t){void 0===t&&(t=0),this.data=e,this.id=t}return e.prototype.dumps=function(){var e=new DataView(new ArrayBuffer(3+this.data.length)),t=0;e.setUint8(t,exports.EventType.WebRTCForwardREQ),t++,e.setUint16(t,this.id),t+=2;for(var n=0;n<this.data.length;n++)e.setUint8(t,this.data.charCodeAt(n)),t+=1;return e.buffer},e}(),G=function(){function e(e){this.timestamp=e}return e.prototype.dumps=function(){var e=new DataView(new ArrayBuffer(5));return e.setUint8(0,exports.EventType.EchoData),e.setUint32(1,this.timestamp),e.buffer},e.decode=function(t){return new e(new DataView(t).getUint32(1))},e}(),F=function(){function e(e,t,n,i,o,r){void 0===o&&(o=exports.MoveType.Passive),void 0===r&&(r=exports.EventType.MouseMoveStandardization),this.x=e,this.y=t,this.dx=n,this.dy=i,this.move=o,this.eventType=r}return e.prototype.dumps=function(){u.EnableLog;var e=new ArrayBuffer(10),t=new DataView(e);return t.setUint8(0,this.eventType),t.setUint8(1,+this.move),t.setUint16(2,this.x),t.setUint16(4,this.y),t.setUint16(6,this.dx),t.setUint16(8,this.dy),e},e}(),j=function(){function e(e,t){this.mouseButtonType=e,this.down=t}return e.prototype.dumps=function(){u.EnableLog;var e=new ArrayBuffer(3),t=new DataView(e);return t.setUint8(0,exports.EventType.MouseButton),t.setUint8(1,+this.down),t.setUint8(2,this.mouseButtonType),e},e.formMouseEvent=function(t,n){if(!X.has(t.button))throw new Error("[Event] unsupport button type");return new e(X.get(t.button),n)},e}(),O=function(){function e(e,t){this.step=e,this.forward=t}return e.prototype.dumps=function(){u.EnableLog;var e=new ArrayBuffer(4),t=new DataView(e);return t.setUint8(0,exports.EventType.WheelScroll),t.setUint8(1,+this.forward),t.setUint16(2,this.step),e},e.fromPinchZoom=function(t){return new e(Math.abs(t),1===Math.sign(t))},e.fromWheelEvent=function(t){var n=Math.abs(t.deltaX),i=Math.abs(t.deltaY),o=!!i,r=-1===Math.sign(o?t.deltaY:t.deltaX);return new e(o?Math.sign(i):Math.sign(n),r)},e.fromTouchDeltaY=function(t){return new e(1,t<0)},e}(),Q=function(){function e(e,t,n,i,o,r,a,s){this.keycode=e,this.alt=t,this.shift=n,this.ctrl=i,this.nlock=o,this.clock=r,this.slock=a,this.down=s}return e.prototype.dumps=function(){u.EnableLog;var e=new ArrayBuffer(9),t=new DataView(e);return t.setUint8(0,exports.EventType.Keyboard),t.setUint8(1,+this.down),t.setUint8(2,+this.nlock),t.setUint8(3,+this.clock),t.setUint8(4,+this.slock),t.setUint8(5,+this.shift),t.setUint8(6,+this.ctrl),t.setUint8(7,+this.alt),t.setUint8(8,+this.keycode),e},e.fromKeyboardEvent=function(t,n){return new e(t.keyCode,t.altKey,t.shiftKey,t.ctrlKey,t.getModifierState("NumLock"),t.getModifierState("CapsLock"),t.getModifierState("ScrollLock"),n)},e}(),Z=function(){function e(e,t){this.touchType=e,this.touchList=t}return e.prototype.dumps=function(){u.EnableLog;var e=new ArrayBuffer(4+8*this.touchList.length),t=new DataView(e);t.setUint8(0,exports.EventType.WinTouch),t.setUint8(1,this.touchType),t.setUint16(2,this.touchList.length);var n=4;return this.touchList.forEach((function(e){t.setUint16(n,e.x),n+=2,t.setUint16(n,e.y),n+=2,t.setUint32(n,e.id),n+=4})),e},e}(),H=function(){function e(e,t){this.id=e,this.success=t}return e.fromDataChannel=function(t){var n=new DataView(t);return new e(n.getUint16(1),!!n.getUint8(3))},e}(),N=function(){function e(e,t){void 0===t&&(t=!1),this.payload=e,this.reserve=t}return e.prototype.dumps=function(){u.EnableLog;var e=l(this.payload),t=new DataView(new ArrayBuffer(4+e.length));return t.setUint8(0,exports.EventType.TextInput),t.setUint8(1,+this.reserve),t.setUint16(2,e.length),e.forEach((function(e,n){return t.setUint8(n+4,e)})),t.buffer},e}(),Y=function(){function e(e,t,n,i,o,r,a,s,c){void 0===e&&(e=exports.GamepadType.GamepadXbox),void 0===t&&(t=0),this.gamepadType=e,this.gamepadUser=t,this.buttons=n,this.leftTrigger=i,this.rightTrigger=o,this.leftThumbX=r,this.leftThumbY=a,this.rightThumbX=s,this.rightThumbY=c}return e.prototype.dumps=function(){var e=new DataView(new ArrayBuffer(16));return e.setUint8(0,exports.EventType.Gamepad),e.setUint8(1,this.gamepadType),e.setUint16(2,this.gamepadUser),e.setUint16(4,this.buttons),e.setUint8(6,this.leftTrigger),e.setUint8(7,this.rightTrigger),e.setInt16(8,this.leftThumbX),e.setInt16(10,this.leftThumbY),e.setInt16(12,this.rightThumbX),e.setInt16(14,this.rightThumbY),e.buffer},e}(),W=function(){function e(e,t,n,i,o,r,a,s,c,u){void 0===e&&(e=BigInt((new Date).getTime())),void 0===t&&(t=0),void 0===n&&(n=0),void 0===i&&(i=0),void 0===o&&(o=1920),void 0===r&&(r=1080),void 0===a&&(a=0),void 0===s&&(s=exports.ImageStoreFormat.BinaryPNG),void 0===c&&(c=exports.ImageResultValue.Failure),void 0===u&&(u=new ArrayBuffer(0)),this.timestamp=e,this.index=t,this.left=n,this.top=i,this.width=o,this.height=r,this.size=a,this.format=s,this.result=c,this.payload=u}return e.prototype.dumps=function(){var e=new DataView(new ArrayBuffer(35));return e.setUint8(0,exports.EventType.ScreenshotParams),e.setBigUint64(1,this.timestamp),e.setUint32(9,this.index),e.setUint32(13,this.left),e.setUint32(17,this.top),e.setUint32(21,this.width),e.setUint32(25,this.height),e.setUint32(29,0),e.setUint8(33,this.format),e.setUint8(34,this.result),e.buffer},e.parse=function(t){var n=new DataView(t);return new e(n.getBigUint64(1),n.getUint32(9),n.getUint32(13),n.getUint32(17),n.getUint32(21),n.getUint32(25),n.getUint32(29),n.getUint8(33),n.getUint8(34),t.slice(35))},e}();!function(e){e[e.Text=0]="Text",e[e.Image=1]="Image",e[e.QTText=2]="QTText",e[e.QTImage=3]="QTImage",e[e.unsupported=4]="unsupported"}(U||(U={})),function(e){e[e.None=0]="None",e[e.LZ4=1]="LZ4",e[e.ZLIB=2]="ZLIB",e[e.Unknow=3]="Unknow"}(I||(I={}));var J,K=function(){function e(e,t,n,i){void 0===t&&(t=0),void 0===n&&(n=U.Text),void 0===i&&(i=I.None),this.payload=e,this.size=t,this.dataType=n,this.compressType=i}return e.prototype.dumps=function(){var e=l(this.payload),t=new DataView(new ArrayBuffer(7+e.length));return t.setUint8(0,exports.EventType.ClipboardData),t.setUint32(1,e.length+2),t.setUint8(5,this.dataType),t.setUint8(6,this.compressType),e.forEach((function(e,n){return t.setUint8(n+7,e)})),t.buffer},e.parse=function(t){var n=new DataView(t),i=n.getUint32(1)-2,o=n.getUint8(5),r=n.getUint8(6),a="";return o===U.Text&&r===I.None&&(a=h(t,7)),new e(a,i,o,r)},e}();exports.MobileTouchActionType=void 0,(J=exports.MobileTouchActionType||(exports.MobileTouchActionType={}))[J.ActionDown=0]="ActionDown",J[J.ActionUp=1]="ActionUp",J[J.ActionMove=2]="ActionMove",J[J.ActionCancel=3]="ActionCancel",J[J.ActionPointerDown=5]="ActionPointerDown",J[J.ActionPointerUp=6]="ActionPointerUp";var q,V,_=function(){function e(e,t,n,i){this.action=e,this.pointerId=t,this.x=n,this.y=i}return e.prototype.dumps=function(){var e=new DataView(new ArrayBuffer(17));return e.setUint8(0,exports.EventType.MobileTouch),e.setInt32(1,this.action),e.setInt32(5,this.pointerId),e.setInt32(9,this.x),e.setInt32(13,this.y),e.buffer},e}();exports.MobileKeysActionType=void 0,(q=exports.MobileKeysActionType||(exports.MobileKeysActionType={}))[q.ActionDown=0]="ActionDown",q[q.ActionUp=1]="ActionUp",exports.MobileKeysKeycode=void 0,(V=exports.MobileKeysKeycode||(exports.MobileKeysKeycode={}))[V.KeycodeHome=3]="KeycodeHome",V[V.KeycodeBack=4]="KeycodeBack",V[V.KeycodeAppSwitch=187]="KeycodeAppSwitch";var $=function(){function e(e,t){this.action=e,this.keycode=t}return e.prototype.dumps=function(){var e=new DataView(new ArrayBuffer(3));return e.setUint8(0,exports.EventType.MobileKeys),e.setUint8(1,this.action),e.setUint8(2,this.keycode),e.buffer},e}(),ee=function(){function i(e,n,i,o,r,a,s){var c=this;void 0===i&&(i="all"),void 0===o&&(o=2e3),void 0===r&&(r=5e3),void 0===a&&(a=4e3),void 0===s&&(s=!0),this.url=e,this.iceServers=n,this.iceTransportPolicy=i,this.minBitrate=o,this.maxBitrate=r,this.startBitrate=a,this.enableAFK=s,this.event={connect:new L,afk:new L,open:new L,close:new L,queue:new L,ready:new L,endCandidate:new L,cursor:new L,disconnect:new L,receivedLink:new L,receivedVideo:new L,dataChannelConnected:new L,interaction:new L,occupy:new L,kick:new L,networkChanged:new L,echo:new L,screenshot:new L,screenshotData:new L,kickOut:new L,clientInfo:new L,clipboard:new L},this.token="",this.afk=new P,this.tan=new C,this.ready=!1,this.token=e.split("/").pop(),this.pc=new RTCPeerConnection({iceServers:n,iceTransportPolicy:i}),this.setupPeerConnection(),this.dc=this.pc.createDataChannel("sendChannel"),this.dc.binaryType="arraybuffer",this.setupDataChannel(),this.subject=t.webSocket({url:e,closeObserver:{next:function(e){return c.event.close.emit(e)}},openObserver:{next:function(e){return c.event.open.emit(e)}}}),this.setupSigning()}return i.prototype.setupSigning=function(){var e=this;this.subject.subscribe({next:function(t){switch(t.action){case"connect":e.event.connect.emit(t);break;case"sdpOffer":e.pc.setRemoteDescription(new RTCSessionDescription(t.data)),e.pc.createAnswer().then((function(t){e.pc.setLocalDescription(t),e.subject.next({action:"sdpAnswer",data:t})}));break;case"candidate":e.pc.addIceCandidate(new RTCIceCandidate(t.data));break;case"sdpAnswer":e.pc.setRemoteDescription(new RTCSessionDescription(t.data));break;case"ready":e.ready||(e.ready=!0,e.linkStart(),e.event.ready.emit(t));break;case"queue":e.event.queue.emit(t.data.queueNum);break;case"peerDisconnected":e.event.disconnect.emit(t.message);break;case"operateOverTime":e.event.afk.emit(e.afk.idleTime);break;case"unready":try{e.subject.next({action:"verify",data:{token:e.token}})}catch(e){}break;case"hangUp":e.hangUp();break;case"occupy":e.event.occupy.emit("connection occupied!");break;case"kick":e.event.kick.emit(t.message),e.destory();break;case"clientInfo":e.event.clientInfo.emit(t.data)}},error:function(t){e.event.disconnect.emit(t)},complete:function(){}})},i.prototype.setupPeerConnection=function(){var e=this;this.pc.onicecandidate=function(t){t.candidate?e.subject.next({action:"candidate",data:t.candidate}):e.event.endCandidate.emit(t)},this.pc.ontrack=function(t){e.event.receivedVideo.emit(t.streams[0])},this.pc.oniceconnectionstatechange=function(){"disconnected"===e.pc.iceConnectionState&&e.event.networkChanged.emit(e.url)}},i.prototype.setupDataChannel=function(){var t=this,i=e.fromEvent(this.dc,"close");this.dc.onopen=function(o){e.interval(3e4).pipe(n.takeUntil(i)).subscribe((function(e){return t.subject.next({action:"heartbeat"})})),t.enableAFK&&(t.afk.start(),e.interval(u.AFKTimerGap).pipe(n.takeUntil(i)).subscribe((function(e){return t.subject.next({action:"afk",data:{idleTime:t.afk.idleTime}})}))),t.event.dataChannelConnected.emit(o)};var o=e.fromEvent(this.dc,"message").pipe(n.takeUntil(i),n.tap((function(e){})),n.map((function(e){return e.data})),n.share());o.pipe(n.filter((function(e){return p(e)===exports.EventType.CursorData})),n.map((function(e){return A.parse(e)}))).subscribe((function(e){return t.event.cursor.emit(e)})),o.pipe(n.filter((function(e){return p(e)===exports.EventType.KickOutController})),n.map((function(e){return h(e,1)}))).subscribe((function(e){return t.event.kickOut.emit(e)})),o.pipe(n.filter((function(e){return p(e)===exports.EventType.URLIntercept})),n.map((function(e){return h(e,8)}))).subscribe((function(e){return t.event.receivedLink.emit(e)})),o.pipe(n.filter((function(e){return p(e)===exports.EventType.WebRTCForwardREQ})),n.map((function(e){return h(e,1)}))).subscribe((function(e){return t.event.interaction.emit(e)}));var r=o.pipe(n.filter((function(e){return p(e)===exports.EventType.ScreenshotParams})),n.map((function(e){return W.parse(e)})),n.share());r.subscribe((function(e){return t.event.screenshotData.emit(e.payload.byteLength)})),r.pipe(n.buffer(r.pipe(n.filter((function(e){return e.result===exports.ImageResultValue.Success})))),n.filter((function(e){return 0!==e.length})),n.map((function(e){return e.map((function(e){return e.payload}))})),n.map((function(e){return new Blob(e,{type:"image/png"})}))).subscribe((function(e){return t.event.screenshot.emit(e)})),o.pipe(n.filter((function(e){return p(e)===exports.EventType.WebRTCForwardRSP})),n.map((function(e){return H.fromDataChannel(e)}))).subscribe((function(e){return t.tan.trigger(e.id,e.success)})),o.pipe(n.filter((function(e){return p(e)===exports.EventType.ClipboardData})),n.map((function(e){return K.parse(e)}))).subscribe((function(e){return t.event.clipboard.emit(e.payload)})),o.pipe(n.filter((function(e){return[exports.EventType.EchoData,exports.EventType.EventDelay].includes(p(e))})),n.map((function(e){return G.decode(e)}))).subscribe((function(e){var n=e.timestamp;return t.event.echo.emit(~~performance.now()-n)})),this.dc.onerror=function(e){},this.dc.onclose=function(e){}},i.prototype.linkStart=function(){var e=this;this.pc.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0}).then((function(t){e.pc.setLocalDescription(t),t.sdp=t.sdp.replace(/(a=fmtp:\d+ .*level-asymmetry-allowed=.*)\r\n/gm,"$1;x-google-start-bitrate=".concat(e.startBitrate,";x-google-max-bitrate=").concat(e.maxBitrate,";x-google-min-bitrate=").concat(e.minBitrate,"\r\n")),e.subject.next({action:"sdpOffer",data:t})}))},i.prototype.hangUp=function(){this.ready=!1,this.dc.close(),this.pc.close(),this.afk.clear(),this.pc=new RTCPeerConnection({iceServers:this.iceServers,iceTransportPolicy:this.iceTransportPolicy}),this.setupPeerConnection(),this.dc=this.pc.createDataChannel("sendChannel"),this.dc.binaryType="arraybuffer",this.setupDataChannel()},i.prototype.controlAuthority=function(e){return a(this,void 0,void 0,(function(){return s(this,(function(t){return this.subject.next({action:"controlAuthority",data:{token:e}}),[2]}))}))},i.prototype.changeBandwidth=function(e,t,n){n&&t?this.subject.next({action:"setBitrate",data:{min_bitrate:n,max_bitrate:t,cur_bitrate:e}}):this.subject.next({action:"setBitrate",data:{min_bitrate:e,max_bitrate:e,cur_bitrate:e}})},i.prototype.exit=function(){this.subject.closed||this.subject.next({action:"exit"})},i.prototype.emitUIInteraction=function(e){var t=new S,n=this.tan.order(t);return this.send(new z(e,n).dumps()),t.promise},i.prototype.echo=function(){this.send(new G(~~performance.now()).dumps())},i.prototype.screenshot=function(e){var t=void 0===e?{}:e,n=t.index,i=void 0===n?0:n,o=t.left,r=void 0===o?0:o,a=t.top,s=void 0===a?0:a,c=t.width,u=void 0===c?1920:c,p=t.height,h=void 0===p?1080:p;this.send(new W(void 0,i,r,s,u,h).dumps())},i.prototype.clipboard=function(e){this.send(new K(e).dumps())},i.prototype.send=function(e,t){if(void 0===t&&(t=!1),"open"!==this.dc.readyState)throw new Error("send message before DataChannel open");this.enableAFK&&t&&this.afk.reset(),"string"==typeof e||e instanceof Blob||ArrayBuffer,this.dc.send(e)},i.prototype.destory=function(){this.dc.close(),this.pc.close(),this.afk.clear(),this.subject.unsubscribe(),Object.entries(this.event).forEach((function(e){return c(e,2)[1].offAll()}))},i}(),te=function(){function e(e,t,n){var i=this;void 0===t&&(t=function(){}),void 0===n&&(n=!0),this.hostElement=e,this.canResize=!1,this.top=0,this.left=0,this.width=0,this.height=0,this.intervalID=NaN,this.onPlayHandler=[],this.resizePlayer=function(){i.canResize&&(i.hostElement.clientWidth<i.videoElement.videoWidth||i.hostElement.clientHeight<i.videoElement.videoHeight?i.resizePlayerStyleToFillWindow():i.resizePlayerStyleToActualSize())},this.onPlayHandler.push(t),this.overlayElement=document.createElement("div"),this.overlayElement.style.cssText="\n color: white;\n font-size: 1.8em;\n width: 100%;\n height: 100%;\n display: flex;\n position: absolute;\n background-color: rgba(51, 51, 51, 0.7);\n justify-content: center;\n align-items: center;\n ",this.playerElement=document.createElement("div"),this.playerElement.style.cssText="\n width: 100%;\n height: 100%;\n position: relative;\n background-color: black;\n ",this.videoElement=document.createElement("video"),this.videoElement.style.cssText="\n width: 100%;\n height: 100%;\n position: absolute;\n touch-action: none;\n ",this.videoElement.muted=!0,this.videoElement.playsInline=!0,this.videoElement.autoplay=!0,this.videoElement.addEventListener("loadedmetadata",(function(e){i.intervalID=window.setInterval((function(){i.isBlackScreen()||(i.canResize=!0,i.hidePlayOverlay(),i.resizePlayer(),window.clearInterval(i.intervalID),i.onPlayHandler.forEach((function(e){return e()})))}),500),i.videoElement.play().catch((function(){return i.showPlayOverlay()}))})),this.playerElement.appendChild(this.videoElement),this.playerElement.appendChild(this.overlayElement),e.appendChild(this.playerElement),new o.default(this.resizePlayer).observe(e);var r=this;n&&(document.body.addEventListener("mousedown",(function e(){r.videoElement.muted=!1,document.body.removeEventListener("mousedown",e)})),window.navigator.userAgent.indexOf("Chrome")>-1?document.body.addEventListener("touchend",(function e(){r.videoElement.muted=!1,document.body.removeEventListener("touchend",e)})):document.body.addEventListener("touchstart",(function e(){r.videoElement.muted=!1,document.body.removeEventListener("touchstart",e)})))}return Object.defineProperty(e.prototype,"videoAspectRatio",{get:function(){return this.videoElement.videoHeight/this.videoElement.videoWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hostAspectRatio",{get:function(){return this.hostElement.clientHeight/this.hostElement.clientWidth},enumerable:!1,configurable:!0}),e.prototype.registerOnPlay=function(e){this.onPlayHandler.push(e)},e.prototype.isBlackScreen=function(){var e,t=document.createElement("canvas"),n=t.getContext("2d");return t.width=this.videoElement.videoWidth/100,t.height=this.videoElement.videoHeight/100,n.drawImage(this.videoElement,0,0,t.width,t.height),!t.width||(null===(e=n.getImageData(0,0,t.width,t.height))||void 0===e?void 0:e.data).every((function(e){return 0===e||1===e||255===e}))},e.prototype.resizePlayerStyleToFillWindow=function(){this.videoAspectRatio?this.hostAspectRatio<this.videoAspectRatio?(this.height=this.hostElement.clientHeight,this.width=Math.floor(this.height/this.videoAspectRatio),this.left=Math.floor(.5*(this.hostElement.clientWidth-this.width)),this.top=0):(this.width=this.hostElement.clientWidth,this.height=Math.floor(this.width*this.videoAspectRatio),this.top=Math.floor(.5*(this.hostElement.clientHeight-this.height)),this.left=0):(this.width=this.hostElement.clientWidth,this.height=this.hostElement.clientHeight,this.top=0,this.left=0),this.applyStyleToPlayer()},e.prototype.resizePlayerStyleToActualSize=function(){this.width=this.videoElement.videoWidth,this.height=this.videoElement.videoHeight,this.top=Math.floor(.5*(this.hostElement.clientHeight-this.height)),this.left=Math.floor(.5*(this.hostElement.clientWidth-this.width)),this.applyStyleToPlayer()},e.prototype.applyStyleToPlayer=function(){this.playerElement.style.top="".concat(this.top,"px"),this.playerElement.style.left="".concat(this.left,"px"),this.playerElement.style.width="".concat(this.width,"px"),this.playerElement.style.height="".concat(this.height,"px")},e.prototype.destory=function(){var e;this.intervalID&&window.clearInterval(this.intervalID),this.playerElement.contains(this.videoElement)&&this.playerElement.removeChild(this.videoElement),this.playerElement.contains(this.overlayElement)&&this.playerElement.removeChild(this.overlayElement),null===(e=this.playerElement.parentNode)||void 0===e||e.removeChild(this.playerElement)},e.prototype.showTextOverlay=function(e){var t=document.createElement("div");t.innerHTML=e,this.setOverlay(t)},e.prototype.showPlayOverlay=function(){var e=this,t=document.createElement("img");t.id="play-button",t.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPEAAAD5CAYAAAD2mNNkAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMjHxIGmVAAASgklEQVR4Xu2dC7BdVX2HqUCCIRASCPjAFIQREBRBBSRYbFOt8lIrFUWRF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dqZ5GH0EkzoDMa4pnJ3ea0T07TOAezvnlBaTqRZlA6qTyQhDdrm1fhBXgwGl5pJnROQ7yW6jlvwvtefAZuXppKpJmUTitrp80p9Zn1zQ8uTSTSbOisfQ9xps2pkJ/wPhe3K00j0g7otH0N8f34dXwfHo0W2ZZ2QuftY4izPDKnabwIH4Ee/yrthQ7clxBnldUP8BJ8MSa87uuV9kNH7nqIc4ZVwvshfCkuQ8Mr3YEO3dUQZ4nkD/HDmFKfe5SPLNIt6NxdDHHC+xF8BabsiSOvdBc6eJdCfBtehglvimz7rFe6Dx29CyHOQo0r8NWYOr0W2Zb+QIdva4izRDLPeldi6vSm1OfC8rFE+gMdv40hznu+GlMhfz/cEj0OR/oJnb9NIc57vQZPxCehI69ICUbTydnN1+LJmPAuKW9fRAhEk0OcZ73XYw6hOwg9v1lkKgSjqSHO5oRT8TdwKbq+WWQ6CEeTQpw7zlmocTqmTm/Ob7bomMiGICRNCHGmzT/BszClPjPyuspKZDYQlkmH+Mf4t7gct0enzSJzgdBMKsQJ70X4VHTkFRkUwlN3iFM54YN4KG6LHkQnMgyEqK4Q51nvpZjwZuQ1vCKjgDDVEeIr8XBMeL3bLDJKCNW4QpyR9zo8ArdBb1iJjAPCNeoQJ7ypFngszkc3JoiME0I2qhDnWW8Kjv0xujFBpC4I3DAhzgqrHESXUp/Z0/uQ8rIiUhcEb5AQJ7z34TfwJNy5vJyI1A0BnG2IE9yYsiffwTfizuh3XpFJQghnE+J83014v4upkL8r+qhIpAkQxg2FOOHNzzNtPhf3REdekSZRQjqVTJtzguSNeD4eWH5dRJoGAZ0a4rvxm3ghrkCnzSJNhpBWIc7/plpgwpudRZ7dLNIGCOvtJbwX42G4uPxIRNoAoU2d3iNxUflPItIaNtnk/wEGBoMdpECGHAAAAABJRU5ErkJggg==",t.alt="Start Streaming",this.setOverlay(t,(function(){e.hidePlayOverlay()}))},e.prototype.hidePlayOverlay=function(){this.clearOverlay(),this.overlayElement.style.display="none"},e.prototype.clearOverlay=function(){for(;this.overlayElement.lastChild;)this.overlayElement.removeChild(this.overlayElement.lastChild)},e.prototype.setOverlay=function(e,t){if(this.clearOverlay(),this.overlayElement.appendChild(e),this.overlayElement.style.display="flex",t){var n=this;this.overlayElement.addEventListener("click",(function e(i){t(i),n.overlayElement.removeEventListener("click",e)}))}},e}(),ne=function(){function t(){}return t.createDefaultEventStream=function(t,i){t.addEventListener("contextmenu",(function(e){return e.preventDefault()}));var o=e.fromEvent(t,"mousedown").pipe(n.tap((function(e){return e.preventDefault()})),n.map((function(e){return j.formMouseEvent(e,!0).dumps()}))),a=e.fromEvent(t,"mouseup").pipe(n.tap((function(e){return e.preventDefault()})),n.map((function(e){return j.formMouseEvent(e,!1).dumps()}))),s=e.fromEvent(t,"mousemove").pipe(n.tap((function(e){return e.preventDefault()})),n.map((function(e){return d(e,i.mouseNormalizeType===exports.EventType.MouseMoveStandardization)})),n.map((function(e){var t=e.x,n=e.y,o=e.dx,r=e.dy;return new F(t,n,o,r,i.mouseMoveType,i.mouseNormalizeType).dumps()}))),c=e.fromEvent(t,"mouseleave").pipe(n.map(b),n.map((function(e){return d(e,i.mouseNormalizeType===exports.EventType.MouseMoveStandardization)})),n.map((function(e){var t=e.x,n=e.y,o=e.dx,r=e.dy;return new F(t,n,o,r,i.mouseMoveType,i.mouseNormalizeType).dumps()}))),u=e.fromEvent(t,"wheel",{passive:!1}).pipe(n.tap((function(e){return e.preventDefault()})),n.map((function(e){return O.fromWheelEvent(e).dumps()})));function p(e,t){var n=t===exports.TouchType.TouchUpdate?"touches":"changedTouches";return new Z(t,function(e,t){var n=e.target,i=n.videoWidth,o=n.videoHeight,r=n.clientHeight,a=n.clientWidth,s=n.getBoundingClientRect(),c=s.left,u=s.top;return t.map((function(e){var t=e.clientX,n=e.clientY;return{x:i/a*(t-c),y:o/r*(n-u),id:e.identifier}}))}(e,Array.from(e[n]))).dumps()}var h=e.fromEvent(t,"touchend"),l=e.fromEvent(t,"touchmove",{passive:!1}),f=e.fromEvent(t,"touchstart",{passive:!1}),m=e.fromEvent(t,"touchcancel");return{wheelStream:u,mouseupStream:a,mousedownStream:o,mousemoveStream:s,zoomStream:l.pipe(n.tap((function(e){return e.preventDefault()})),n.takeUntil(e.merge(h,m)),n.throttleTime(100),n.filter((function(e){return 2===e.targetTouches.length})),n.pairwise(),n.map(v),n.map((function(e){return O.fromPinchZoom(e/10).dumps()})),n.repeat()),startBufferStream:e.iif((function(){return i.fakeMouseWithTouch}),f.pipe(n.tap((function(e){return e.preventDefault()})),n.concatMap((function(t){return e.of((n=d({target:t.target,clientX:t.targetTouches[0].clientX,clientY:t.targetTouches[0].clientY,movementX:0,movementY:0},i.mouseNormalizeType===exports.EventType.MouseMoveStandardization),o=n.x,r=n.y,a=n.dx,s=n.dy,new F(o,r,a,s,i.mouseMoveType,i.mouseNormalizeType).dumps()),new j(3===t.targetTouches.length?exports.MouseButtonType.ButtonMiddle:i.fakeTouchType,!0).dumps());var n,o,r,a,s}))),f.pipe(n.tap((function(e){return e.preventDefault()})),n.map((function(e){return p(e,exports.TouchType.TouchDown)})))),moveBufferStream:e.iif((function(){return i.fakeMouseWithTouch}),l.pipe(n.tap((function(e){return e.preventDefault()})),n.takeUntil(e.merge(h,m)),n.filter((function(e){return 1===e.targetTouches.length||3===e.targetTouches.length})),n.pairwise(),n.map(y),n.map((function(e){return function(e,t,n){var i=e.movementX,o=e.movementY;return r(r({},e),{movementX:i*t,movementY:o*n})}(e,i.touchDeltaXSensitivity,i.touchDeltaYSensitivity)})),n.map((function(e){return d(e,i.mouseNormalizeType===exports.EventType.MouseMoveStandardization)})),n.map((function(e){var t=e.x,n=e.y,o=e.dx,r=e.dy;return new F(t,n,o,r,i.mouseMoveType,i.mouseNormalizeType).dumps()})),n.repeat()),l.pipe(n.tap((function(e){return e.preventDefault()})),n.map((function(e){return p(e,exports.TouchType.TouchUpdate)})))),endBufferStream:e.iif((function(){return i.fakeMouseWithTouch}),e.merge(h,m).pipe(n.tap((function(e){return e.preventDefault()})),n.mapTo(new j(i.fakeTouchType,!1).dumps())),e.merge(h,m).pipe(n.tap((function(e){return e.preventDefault()})),n.map((function(e){return p(e,exports.TouchType.TouchUp)})))),leaveStream:c}},t.createGamepadStream=function(){return e.interval(0,e.animationFrameScheduler).pipe(n.map((function(e){return navigator.getGamepads()[0]})),n.filter((function(e){return!!e})),n.map((function(e){var t=c(e.axes.map((function(e){return 32767*e})),4),n=t[0],i=t[1],o=t[2],r=t[3],a=255*e.buttons[6].value,s=255*e.buttons[7].value;return new Y(exports.GamepadType.GamepadXbox,0,0,a,s,n,-i,o,-r).dumps()})))},t.createClipboardStream=function(t){return e.fromEvent(t,"focus").pipe(n.mergeMap((function(){return new Promise((function(e){return navigator.clipboard.readText().then(e).catch((function(){return e("")}))}))})),n.map((function(e){return new K(e).dumps()})))},t.createKeyboardStream=function(t){t.tabIndex=-1;var i=function(){return t.focus()};return t.addEventListener("touchstart",i,{passive:!0}),t.addEventListener("mouseenter",i),t.addEventListener("click",i),{keydownStream:e.fromEvent(t,"keydown").pipe(n.tap((function(e){return e.preventDefault()})),n.map((function(e){return Q.fromKeyboardEvent(e,!0).dumps()}))),keyupStream:e.fromEvent(t,"keyup").pipe(n.tap((function(e){return e.preventDefault()})),n.map((function(e){return Q.fromKeyboardEvent(e,!1).dumps()})))}},t.createMobileStreamFromMouse=function(t){var i=e.fromEvent(t,"mouseup").pipe(n.map((function(e){var t=d(e,!0),n=t.x,i=t.y;return new _(exports.MobileTouchActionType.ActionUp,0,n,i).dumps()}))),o=e.fromEvent(t,"mousemove").pipe(n.map((function(e){var t=d(e,!0),n=t.x,i=t.y;return new _(exports.MobileTouchActionType.ActionMove,0,n,i).dumps()}))),r=e.fromEvent(t,"mousedown").pipe(n.map((function(e){var t=d(e,!0),n=t.x,i=t.y;return new _(exports.MobileTouchActionType.ActionDown,0,n,i).dumps()})));return e.merge(r,o,i)},t.attachMobileListener=function(t,i){return this.createMobileStreamFromMouse(t).pipe(n.takeUntil(e.fromEvent(i.dc,"close"))).subscribe((function(e){return i.send(e,!0)}))},t.attachListener=function(t,i,o,r){var a=void 0===r?{}:r,s=a.enableClipboard,c=void 0!==s&&s,u=a.enableGamepad,p=void 0!==u&&u,h=this.createDefaultEventStream(t,i),l=h.wheelStream,d=h.mouseupStream,f=h.mousedownStream,m=h.mousemoveStream,v=h.zoomStream,y=h.startBufferStream,b=h.moveBufferStream,g=h.endBufferStream,w=h.leaveStream,x=this.createKeyboardStream(t),T=x.keyupStream,E=x.keydownStream,k=e.merge(l,E,T,d,f,m,v,y,b,g,w);return c&&(k=e.merge(k,this.createClipboardStream(t))),p&&(k=e.merge(k,this.createGamepadStream())),k.pipe(n.takeUntil(e.fromEvent(o.dc,"close"))).subscribe((function(e){return o.send(e,!0)}))},t}(),ie=function(e,t,n,i,o,r){void 0===e&&(e=exports.EventType.MouseMoveStandardization),void 0===t&&(t=exports.MoveType.Passive),void 0===n&&(n=exports.MouseButtonType.ButtonLeft),void 0===i&&(i=!0),void 0===o&&(o=1),void 0===r&&(r=1),this.mouseNormalizeType=e,this.mouseMoveType=t,this.fakeTouchType=n,this.fakeMouseWithTouch=i,this.touchDeltaXSensitivity=o,this.touchDeltaYSensitivity=r},oe=function(){function t(){var e=this;this.latency=0,this.averageJitterBufferDelay=0,this.bytesReceivedPerMillisecond=0,this.headerBytesReceivedPerMillisecond=0,this.packetsLost=0,this.packetsReceived=0,this.framesReceived=0,this.framesDecoded=0,this.keyFramesDecoded=0,this.framesDropped=0,this.framesPerSecond=0,this.handleLatency=function(t){return e.latency=t}}return Object.defineProperty(t.prototype,"bitrate",{get:function(){return 8*(this.bytesReceivedPerMillisecond+this.headerBytesReceivedPerMillisecond)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"packetLossRate",{get:function(){return this.packetsReceived?this.packetsLost/(this.packetsLost+this.packetsReceived):0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"running",{get:function(){return!!this.statSub&&!!this.echoSub&&!!this.dispose},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasOffered",{get:function(){return!!this.connection},enumerable:!1,configurable:!0}),t.prototype.offer=function(e){this.connection=e,this.running&&this.scan()},t.prototype.scan=function(){var t,n=this;if(!this.connection)throw new Error("gather statistics before provide connection");var i=this.connection;null===(t=this.statSub)||void 0===t||t.unsubscribe(),this.echoSub&&(this.echoSub.unsubscribe(),this.connection.event.echo.off(this.handleLatency)),this.dispose=this.connection.event.echo.on(this.handleLatency).dispose,this.echoSub=e.interval(1e3).subscribe((function(){return"open"===i.dc.readyState&&i.echo()})),this.statSub=e.interval(1e3).pipe(e.mergeMap((function(){return e.from(i.pc.getStats())})),e.map((function(e){return function(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}([],c(e.values()),!1).find((function(e){return"inbound-rtp"===e.type&&"video"===e.kind}))})),e.pairwise(),e.map((function(e){var t,n,i,o,r,a,s,u=c(e,2),p=u[0],h=u[1];if(p&&h){var l=h.timestamp-p.timestamp,d=~~(1e3*(h.jitterBufferDelay-p.jitterBufferDelay)/(h.jitterBufferEmittedCount-p.jitterBufferEmittedCount));return{bytesReceivedPerMillisecond:~~((h.bytesReceived-p.bytesReceived)/l),headerBytesReceivedPerMillisecond:~~((h.headerBytesReceived-p.headerBytesReceived)/l),averageJitterBufferDelay:d,packetsLost:null!==(t=h.packetsLost)&&void 0!==t?t:0,packetsReceived:null!==(n=h.packetsReceived)&&void 0!==n?n:0,framesReceived:null!==(i=h.framesReceived)&&void 0!==i?i:0,framesDecoded:null!==(o=h.framesDecoded)&&void 0!==o?o:0,keyFramesDecoded:null!==(r=h.keyFramesDecoded)&&void 0!==r?r:0,framesDropped:null!==(a=h.framesDropped)&&void 0!==a?a:0,framesPerSecond:null!==(s=h.framesPerSecond)&&void 0!==s?s:0}}return{bytesReceivedPerMillisecond:0,headerBytesReceivedPerMillisecond:0,averageJitterBufferDelay:0,packetsLost:0,packetsReceived:0,framesReceived:0,framesDecoded:0,keyFramesDecoded:0,framesDropped:0,framesPerSecond:0}}))).subscribe((function(e){var t=e.headerBytesReceivedPerMillisecond,i=e.bytesReceivedPerMillisecond,o=e.averageJitterBufferDelay,r=e.packetsLost,a=e.packetsReceived,s=e.framesReceived,c=e.framesDecoded,u=e.keyFramesDecoded,p=e.framesDropped,h=e.framesPerSecond;n.bytesReceivedPerMillisecond=i,n.headerBytesReceivedPerMillisecond=t,n.packetsLost=r,n.packetsReceived=a,n.framesReceived=s,n.framesDecoded=c,n.keyFramesDecoded=u,n.framesDropped=p,n.framesPerSecond=h,n.averageJitterBufferDelay=o}))},t.prototype.report=function(){var e=this,t=e.latency,n=e.packetLossRate,i=e.bitrate,o=e.averageJitterBufferDelay,r=e.framesReceived,a=e.framesDecoded,s=e.keyFramesDecoded,c=e.framesDropped;return{fps:e.framesPerSecond,latency:t,bitrate:i,packetLossRate:n,averageJitterBufferDelay:o,framesReceived:r,framesDecoded:a,keyFramesDecoded:s,framesDropped:c}},t.prototype.toggle=function(){this.running?this.stop():this.scan()},t.prototype.stop=function(){var e,t;this.bytesReceivedPerMillisecond=0,this.headerBytesReceivedPerMillisecond=0,this.averageJitterBufferDelay=0,this.latency=0,this.packetsLost=0,this.packetsReceived=0,this.framesReceived=0,this.framesDecoded=0,this.keyFramesDecoded=0,this.framesDropped=0,this.framesPerSecond=0,null===(e=this.statSub)||void 0===e||e.unsubscribe(),this.statSub=void 0,null===(t=this.echoSub)||void 0===t||t.unsubscribe(),this.echoSub=void 0,this.dispose&&this.dispose(),this.dispose=void 0},t}();exports.ClipboardData=K,exports.Connection=ee,exports.EventData=G,exports.Gamepad=Y,exports.Helper=ne,exports.Keyboard=Q,exports.MobileKeys=$,exports.MobileTouch=_,exports.MouseButton=j,exports.MouseMove=F,exports.Player=te,exports.PointerManager=R,exports.Rivatuner=oe,exports.RunningState=ie,exports.Screenshot=W,exports.TextInput=N,exports.TouchSet=Z,exports.UIInteraction=z,exports.UIInteractionResponse=H,exports.WheelScroll=O,exports.screenfull=B;
***************************************************************************** */function a(e,t,n,i){return new(n||(n=Promise))((function(o,r){function a(e){try{c(i.next(e))}catch(e){r(e)}}function s(e){try{c(i.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))}function s(e,t){var n,i,o,r,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(r){return function(s){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(o=2&r[0]?i.return:r[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,r[1])).done)return o;switch(i=0,o&&(r=[2&r[0],o.value]),r[0]){case 0:case 1:o=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,i=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]<o[3])){a.label=r[1];break}if(6===r[0]&&a.label<o[1]){a.label=o[1],o=r;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(r);break}o[2]&&a.ops.pop(),a.trys.pop();continue}r=t.call(e,a)}catch(e){r=[6,e],i=0}finally{n=o=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,s])}}}function c(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}var u=Object.freeze({EnableLog:!1,AFKTimerGap:1e4});var p=function(e){return new DataView(e).getUint8(0)};function h(e,t,n){void 0===t&&(t=1),void 0===n&&(n="");var i,o=new DataView(e);return(i=e.byteLength-t,Object.keys(Array.from({length:i})).map((function(e){return Number(e)}))).map((function(e){return String.fromCharCode(o.getUint8(e+t))})).join(n)}function l(e){for(var t,n=new Array,i=0;i<e.length;i++)(t=e.charCodeAt(i))>=65536&&t<=1114111?(n.push(t>>18&7|240),n.push(t>>12&63|128),n.push(t>>6&63|128),n.push(63&t|128)):t>=2048&&t<=65535?(n.push(t>>12&15|224),n.push(t>>6&63|128),n.push(63&t|128)):t>=128&&t<=2047?(n.push(t>>6&31|192),n.push(63&t|128)):n.push(255&t);return n}function d(e,t){void 0===t&&(t=!1);var n=e.target,i=n.getBoundingClientRect(),o=i.left,r=i.top,a=e.clientX,s=e.clientY,c=e.movementY,u=e.movementX,p=n.clientHeight,h=n.clientWidth,l=n.videoHeight,d=n.videoWidth;return{x:Math.min(Math.max(a-o,0),h)*((t?d:65535)/h),y:Math.min(Math.max(s-r,0),p)*((t?l:65535)/p),dx:u*((t?d:32767)/h),dy:c*((t?l:32767)/p)}}var f=function(){function e(e,t){this.x=e,this.y=t}return e.fromTouch=function(t){return new e(t.pageX,t.pageY)},e}();function m(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function v(e){var t=c(Array.from(e[0].targetTouches),2),n=t[0],i=t[1],o=c(Array.from(e[1].targetTouches),2),r=o[0],a=o[1];return m(f.fromTouch(r),f.fromTouch(a))-m(f.fromTouch(n),f.fromTouch(i))}function y(e){var t=c(e,2),n=t[0],i=t[1],o=i.targetTouches[0].clientX-n.targetTouches[0].clientX,r=i.targetTouches[0].clientY-n.targetTouches[0].clientY;return{target:n.target,clientX:n.targetTouches[0].clientX,clientY:n.targetTouches[0].clientY,movementX:o,movementY:r}}function b(e){var t=e.target.getBoundingClientRect(),n=t.left,i=t.top,o=t.right,r=t.bottom,a=e.clientY,s=e.clientX,c=Math.abs(i-a),u=Math.abs(r-a),p=Math.abs(n-s),h=Math.abs(o-s);switch(Math.min(c,u,p,h)){case p:return{target:e.target,clientX:0,clientY:a,movementY:0,movementX:0};case c:return{target:e.target,clientX:s,clientY:0,movementY:0,movementX:0};default:return{target:e.target,clientX:s,clientY:a,movementY:0,movementX:0}}}var g,w,x,T,E,k,M,D,B=new(function(){function e(){this.APINameMap="exitFullscreen"in document?{requestFullscreen:"requestFullscreen",exitFullscreen:"exitFullscreen",fullscreenElement:"fullscreenElement",fullscreenEnabled:"fullscreenEnabled",fullscreenchange:"fullscreenchange"}:"webkitExitFullscreen"in document?{requestFullscreen:"webkitRequestFullscreen",exitFullscreen:"webkitExitFullscreen",fullscreenElement:"webkitFullscreenElement",fullscreenEnabled:"webkitFullscreenEnabled",fullscreenchange:"webkitfullscreenchange"}:{requestFullscreen:"mozRequestFullScreen",exitFullscreen:"mozCancelFullScreen",fullscreenElement:"mozFullScreenElement",fullscreenEnabled:"mozFullScreenEnabled",fullscreenchange:"mozfullscreenchange"}}return Object.defineProperty(e.prototype,"isFullscreen",{get:function(){return Boolean(document[this.APINameMap.fullscreenElement])},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"element",{get:function(){return document[this.APINameMap.fullscreenElement]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEnabled",{get:function(){return Boolean(document[this.APINameMap.fullscreenEnabled])},enumerable:!1,configurable:!0}),e.prototype.request=function(e,t){var n=this;return new Promise((function(i,o){var r=function(){screen.orientation.lock("landscape-primary"),document.removeEventListener(n.APINameMap.fullscreenchange,r),n.off(r),"keyboard"in navigator&&"lock"in navigator.keyboard&&navigator.keyboard.lock(["KeyW","Escape","KeyN","KeyT","MetaLeft"]),i()};n.on(r);var a=(e||document.documentElement)[n.APINameMap.requestFullscreen](t);a instanceof Promise&&a.then(r).catch(o)}))},e.prototype.exit=function(){var e=this;return new Promise((function(t,n){if(e.isFullscreen){var i=function(){e.off(i),t()};e.on(i);var o=document[e.APINameMap.exitFullscreen]();o instanceof Promise&&o.then(i).catch(n)}else t()}))},e.prototype.toggle=function(e,t){return this.isFullscreen?this.exit():this.request(e,t)},e.prototype.on=function(e){document.addEventListener(this.APINameMap.fullscreenchange,e)},e.prototype.off=function(e){document.removeEventListener(this.APINameMap.fullscreenchange,e)},e}()),P=function(){function e(){this.timer=NaN,this.idleTime=0}return e.prototype.reset=function(){this.idleTime=0},e.prototype.start=function(){var e=this;this.timer=window.setInterval((function(){e.idleTime+=1e3}),1e3)},e.prototype.clear=function(){window.clearInterval(this.timer)},e}(),S=function(){var e=this;this.promise=new Promise((function(t,n){e.resolve=t,e.reject=n}))},A=function(){function e(e,t,n,i){void 0===e&&(e=""),void 0===t&&(t=!0),void 0===n&&(n=0),void 0===i&&(i=0),this.base64=e,this.show=t,this.x=n,this.y=i}return e.parse=function(t){var n=new DataView(t),i=n.getUint32(1),o=n.getUint32(5),r=n.getUint32(9),a=n.getUint32(13),s=n.getUint32(17),c=n.getUint32(21),u=n.getUint8(32);if(0===r||0===a)return new e("",!!u,-i,-o);if(1===s&&4===c)return new e("",!!u,-i,-o);var p=document.createElement("canvas"),h=p.getContext("2d");p.width=r,p.height=a;var l=h.createImageData(r,a),d=l.data;d.set(new Uint8ClampedArray(t,34));for(var f=0;f<d.length;f+=4){var m=d[f];d[f]=d[f+2],d[f+2]=m}return h.putImageData(l,0,0),new e(p.toDataURL(),!!u,i,o)},e}(),L=function(){var e=this;this.listeners=[],this.listenersOncer=[],this.on=function(t){return e.listeners.push(t),{dispose:function(){return e.off(t)}}},this.once=function(t){e.listenersOncer.push(t)},this.off=function(t){var n=e.listeners.indexOf(t);n>-1&&e.listeners.splice(n,1)},this.offAll=function(){e.listenersOncer=[],e.listeners=[]},this.emit=function(t){e.listeners.forEach((function(e){return e(t)})),e.listenersOncer.forEach((function(e){return e(t)})),e.listenersOncer=[]},this.pipe=function(t){return e.on((function(e){return t.emit(e)}))}},C=function(){function e(){this.currentID=0,this.executeMap=new Map}return e.prototype.obtainID=function(){return this.currentID>=65535?this.currentID=0:++this.currentID},e.prototype.trigger=function(e,t){this.executeMap.has(e)&&(this.executeMap.get(e).resolve(t),this.executeMap.delete(e))},e.prototype.order=function(e){var t=this.obtainID();return this.executeMap.set(t,e),t},e}(),R=function(){function e(e,t){var n=this;void 0===t&&(t=function(){}),this.target=e,this.onExit=t,this.cursor=new A,this.handleVisibilityChange=function(){"visible"!==document.visibilityState||n.cursor.show||n.target.requestPointerLock()},this.handlePointerLockError=function(){document.addEventListener("click",(function(){n.cursor.show||n.target.requestPointerLock()}),{once:!0})},this.handlePointerLockChange=function(){n.isPointerLocking||n.cursor.show||B.isFullscreen||n.onExit()},e.requestPointerLock=e.requestPointerLock||e.mozRequestPointerLock||e.webkitRequestPointerLock,document.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock,document.addEventListener("pointerlockchange",this.handlePointerLockChange),document.addEventListener("pointerlockerror",this.handlePointerLockError),document.addEventListener("visibilitychange",this.handleVisibilityChange)}return e.prototype.destory=function(){this.target.style.cursor="default",document.removeEventListener("pointerlockerror",this.handlePointerLockChange),document.removeEventListener("pointerlockchange",this.handlePointerLockError),document.removeEventListener("visibilitychange",this.handleVisibilityChange)},e.prototype.setCursor=function(e){var t=this;if(this.cursor=e,e.show?document.exitPointerLock():this.target.requestPointerLock(),e.base64){var n=document.createElement("img");n.src=e.base64,n.onload=function(){if(n.width>32||n.height>32){var i=function(e){var t=document.createElement("canvas"),n=e.width>32?32:e.width,i=e.height>32?32:e.height;t.width=n,t.height=i;var o=t.getContext("2d");return null==o||o.drawImage(e,0,0,n,i),t.toDataURL()}(n);t.target.style.cursor="url(".concat(i,") ").concat(e.x," ").concat(e.y,", auto")}else t.target.style.cursor="url(".concat(e.base64,") ").concat(e.x," ").concat(e.y,", auto")}}else this.target.style.cursor="none"},Object.defineProperty(e.prototype,"isPointerLocking",{get:function(){return(document.pointerLockElement||document.mozPointerLockElement||document.webkitPointerLockElement)===this.target},enumerable:!1,configurable:!0}),e}();exports.EventType=void 0,(g=exports.EventType||(exports.EventType={}))[g.MouseMoveStandardization=0]="MouseMoveStandardization",g[g.MouseButton=1]="MouseButton",g[g.WheelScroll=2]="WheelScroll",g[g.Keyboard=3]="Keyboard",g[g.WinTouch=4]="WinTouch",g[g.MobileTouch=5]="MobileTouch",g[g.MobileCustom=6]="MobileCustom",g[g.URLIntercept=7]="URLIntercept",g[g.CaretVisible=8]="CaretVisible",g[g.TextInput=9]="TextInput",g[g.MobileKeys=10]="MobileKeys",g[g.Gamepad=11]="Gamepad",g[g.CursorData=12]="CursorData",g[g.MouseMoveNormalization=13]="MouseMoveNormalization",g[g.EventDelay=14]="EventDelay",g[g.EchoData=15]="EchoData",g[g.KickOutController=16]="KickOutController",g[g.ScreenshotParams=17]="ScreenshotParams",g[g.ClipboardData=18]="ClipboardData",g[g.WebRTCPluginsMSG=125]="WebRTCPluginsMSG",g[g.WebRTCForwardRSP=126]="WebRTCForwardRSP",g[g.WebRTCForwardREQ=127]="WebRTCForwardREQ",exports.ImageResultValue=void 0,(w=exports.ImageResultValue||(exports.ImageResultValue={}))[w.Failure=0]="Failure",w[w.Success=1]="Success",w[w.Portion=2]="Portion",exports.ImageStoreFormat=void 0,(x=exports.ImageStoreFormat||(exports.ImageStoreFormat={}))[x.Clipboard=0]="Clipboard",x[x.FileBMP=1]="FileBMP",x[x.FilePNG=2]="FilePNG",x[x.BinaryBMP=3]="BinaryBMP",x[x.BinaryPNG=4]="BinaryPNG",exports.MouseButtonType=void 0,(T=exports.MouseButtonType||(exports.MouseButtonType={}))[T.ButtonLeft=1]="ButtonLeft",T[T.ButtonMiddle=2]="ButtonMiddle",T[T.ButtonRight=3]="ButtonRight",T[T.ButtonX1=4]="ButtonX1",T[T.ButtonX2=5]="ButtonX2",exports.TouchType=void 0,(E=exports.TouchType||(exports.TouchType={}))[E.TouchDown=0]="TouchDown",E[E.TouchUpdate=1]="TouchUpdate",E[E.TouchUp=2]="TouchUp",exports.MoveType=void 0,(k=exports.MoveType||(exports.MoveType={}))[k.Absolute=0]="Absolute",k[k.Relative=1]="Relative",k[k.Passive=2]="Passive",k[k.Unknow=3]="Unknow",exports.GamepadType=void 0,(M=exports.GamepadType||(exports.GamepadType={}))[M.GamepadXbox=0]="GamepadXbox",exports.GamepadXboxButton=void 0,(D=exports.GamepadXboxButton||(exports.GamepadXboxButton={}))[D.GamepadXboxButtonDpadUp=1]="GamepadXboxButtonDpadUp",D[D.GamepadXboxButtonDpadDown=2]="GamepadXboxButtonDpadDown",D[D.GamepadXboxButtonDpadLeft=4]="GamepadXboxButtonDpadLeft",D[D.GamepadXboxButtonDpadRight=8]="GamepadXboxButtonDpadRight",D[D.GamepadXboxButtonStart=16]="GamepadXboxButtonStart",D[D.GamepadXboxButtonBack=32]="GamepadXboxButtonBack",D[D.GamepadXboxButtonLeftThumb=64]="GamepadXboxButtonLeftThumb",D[D.GamepadXboxButtonRightThumb=128]="GamepadXboxButtonRightThumb",D[D.GamepadXboxButtonLeftShoulder=256]="GamepadXboxButtonLeftShoulder",D[D.GamepadXboxButtonRightShoulder=512]="GamepadXboxButtonRightShoulder",D[D.GamepadXboxButtonA=4096]="GamepadXboxButtonA",D[D.GamepadXboxButtonB=8192]="GamepadXboxButtonB",D[D.GamepadXboxButtonX=16384]="GamepadXboxButtonX",D[D.GamepadXboxButtonY=32768]="GamepadXboxButtonY";var U,I,X=new Map([[0,exports.MouseButtonType.ButtonLeft],[1,exports.MouseButtonType.ButtonMiddle],[2,exports.MouseButtonType.ButtonRight],[3,exports.MouseButtonType.ButtonX1],[4,exports.MouseButtonType.ButtonX2]]),z=function(){function e(e,t){void 0===t&&(t=0),this.data=e,this.id=t}return e.prototype.dumps=function(){var e=new DataView(new ArrayBuffer(3+this.data.length)),t=0;e.setUint8(t,exports.EventType.WebRTCForwardREQ),t++,e.setUint16(t,this.id),t+=2;for(var n=0;n<this.data.length;n++)e.setUint8(t,this.data.charCodeAt(n)),t+=1;return e.buffer},e}(),G=function(){function e(e){this.timestamp=e}return e.prototype.dumps=function(){var e=new DataView(new ArrayBuffer(5));return e.setUint8(0,exports.EventType.EchoData),e.setUint32(1,this.timestamp),e.buffer},e.decode=function(t){return new e(new DataView(t).getUint32(1))},e}(),F=function(){function e(e,t,n,i,o,r){void 0===o&&(o=exports.MoveType.Passive),void 0===r&&(r=exports.EventType.MouseMoveStandardization),this.x=e,this.y=t,this.dx=n,this.dy=i,this.move=o,this.eventType=r}return e.prototype.dumps=function(){u.EnableLog;var e=new ArrayBuffer(10),t=new DataView(e);return t.setUint8(0,this.eventType),t.setUint8(1,+this.move),t.setUint16(2,this.x),t.setUint16(4,this.y),t.setUint16(6,this.dx),t.setUint16(8,this.dy),e},e}(),j=function(){function e(e,t){this.mouseButtonType=e,this.down=t}return e.prototype.dumps=function(){u.EnableLog;var e=new ArrayBuffer(3),t=new DataView(e);return t.setUint8(0,exports.EventType.MouseButton),t.setUint8(1,+this.down),t.setUint8(2,this.mouseButtonType),e},e.formMouseEvent=function(t,n){if(!X.has(t.button))throw new Error("[Event] unsupport button type");return new e(X.get(t.button),n)},e}(),O=function(){function e(e,t){this.step=e,this.forward=t}return e.prototype.dumps=function(){u.EnableLog;var e=new ArrayBuffer(4),t=new DataView(e);return t.setUint8(0,exports.EventType.WheelScroll),t.setUint8(1,+this.forward),t.setUint16(2,this.step),e},e.fromPinchZoom=function(t){return new e(Math.abs(t),1===Math.sign(t))},e.fromWheelEvent=function(t){var n=Math.abs(t.deltaX),i=Math.abs(t.deltaY),o=!!i,r=-1===Math.sign(o?t.deltaY:t.deltaX);return new e(o?Math.sign(i):Math.sign(n),r)},e.fromTouchDeltaY=function(t){return new e(1,t<0)},e}(),Q=function(){function e(e,t,n,i,o,r,a,s){this.keycode=e,this.alt=t,this.shift=n,this.ctrl=i,this.nlock=o,this.clock=r,this.slock=a,this.down=s}return e.prototype.dumps=function(){u.EnableLog;var e=new ArrayBuffer(9),t=new DataView(e);return t.setUint8(0,exports.EventType.Keyboard),t.setUint8(1,+this.down),t.setUint8(2,+this.nlock),t.setUint8(3,+this.clock),t.setUint8(4,+this.slock),t.setUint8(5,+this.shift),t.setUint8(6,+this.ctrl),t.setUint8(7,+this.alt),t.setUint8(8,+this.keycode),e},e.fromKeyboardEvent=function(t,n){return new e(t.keyCode,t.altKey,t.shiftKey,t.ctrlKey,t.getModifierState("NumLock"),t.getModifierState("CapsLock"),t.getModifierState("ScrollLock"),n)},e}(),Z=function(){function e(e,t){this.touchType=e,this.touchList=t}return e.prototype.dumps=function(){u.EnableLog;var e=new ArrayBuffer(4+8*this.touchList.length),t=new DataView(e);t.setUint8(0,exports.EventType.WinTouch),t.setUint8(1,this.touchType),t.setUint16(2,this.touchList.length);var n=4;return this.touchList.forEach((function(e){t.setUint16(n,e.x),n+=2,t.setUint16(n,e.y),n+=2,t.setUint32(n,e.id),n+=4})),e},e}(),H=function(){function e(e,t){this.id=e,this.success=t}return e.fromDataChannel=function(t){var n=new DataView(t);return new e(n.getUint16(1),!!n.getUint8(3))},e}(),N=function(){function e(e,t){void 0===t&&(t=!1),this.payload=e,this.reserve=t}return e.prototype.dumps=function(){u.EnableLog;var e=l(this.payload),t=new DataView(new ArrayBuffer(4+e.length));return t.setUint8(0,exports.EventType.TextInput),t.setUint8(1,+this.reserve),t.setUint16(2,e.length),e.forEach((function(e,n){return t.setUint8(n+4,e)})),t.buffer},e}(),Y=function(){function e(e,t,n,i,o,r,a,s,c){void 0===e&&(e=exports.GamepadType.GamepadXbox),void 0===t&&(t=0),this.gamepadType=e,this.gamepadUser=t,this.buttons=n,this.leftTrigger=i,this.rightTrigger=o,this.leftThumbX=r,this.leftThumbY=a,this.rightThumbX=s,this.rightThumbY=c}return e.prototype.dumps=function(){var e=new DataView(new ArrayBuffer(16));return e.setUint8(0,exports.EventType.Gamepad),e.setUint8(1,this.gamepadType),e.setUint16(2,this.gamepadUser),e.setUint16(4,this.buttons),e.setUint8(6,this.leftTrigger),e.setUint8(7,this.rightTrigger),e.setInt16(8,this.leftThumbX),e.setInt16(10,this.leftThumbY),e.setInt16(12,this.rightThumbX),e.setInt16(14,this.rightThumbY),e.buffer},e}(),W=function(){function e(e,t,n,i,o,r,a,s,c,u){void 0===e&&(e=BigInt((new Date).getTime())),void 0===t&&(t=0),void 0===n&&(n=0),void 0===i&&(i=0),void 0===o&&(o=1920),void 0===r&&(r=1080),void 0===a&&(a=0),void 0===s&&(s=exports.ImageStoreFormat.BinaryPNG),void 0===c&&(c=exports.ImageResultValue.Failure),void 0===u&&(u=new ArrayBuffer(0)),this.timestamp=e,this.index=t,this.left=n,this.top=i,this.width=o,this.height=r,this.size=a,this.format=s,this.result=c,this.payload=u}return e.prototype.dumps=function(){var e=new DataView(new ArrayBuffer(35));return e.setUint8(0,exports.EventType.ScreenshotParams),e.setBigUint64(1,this.timestamp),e.setUint32(9,this.index),e.setUint32(13,this.left),e.setUint32(17,this.top),e.setUint32(21,this.width),e.setUint32(25,this.height),e.setUint32(29,0),e.setUint8(33,this.format),e.setUint8(34,this.result),e.buffer},e.parse=function(t){var n=new DataView(t);return new e(n.getBigUint64(1),n.getUint32(9),n.getUint32(13),n.getUint32(17),n.getUint32(21),n.getUint32(25),n.getUint32(29),n.getUint8(33),n.getUint8(34),t.slice(35))},e}();!function(e){e[e.Text=0]="Text",e[e.Image=1]="Image",e[e.QTText=2]="QTText",e[e.QTImage=3]="QTImage",e[e.unsupported=4]="unsupported"}(U||(U={})),function(e){e[e.None=0]="None",e[e.LZ4=1]="LZ4",e[e.ZLIB=2]="ZLIB",e[e.Unknow=3]="Unknow"}(I||(I={}));var J,K=function(){function e(e,t,n,i){void 0===t&&(t=0),void 0===n&&(n=U.Text),void 0===i&&(i=I.None),this.payload=e,this.size=t,this.dataType=n,this.compressType=i}return e.prototype.dumps=function(){var e=l(this.payload),t=new DataView(new ArrayBuffer(7+e.length));return t.setUint8(0,exports.EventType.ClipboardData),t.setUint32(1,e.length+2),t.setUint8(5,this.dataType),t.setUint8(6,this.compressType),e.forEach((function(e,n){return t.setUint8(n+7,e)})),t.buffer},e.parse=function(t){var n=new DataView(t),i=n.getUint32(1)-2,o=n.getUint8(5),r=n.getUint8(6),a="";return o===U.Text&&r===I.None&&(a=h(t,7)),new e(a,i,o,r)},e}();exports.MobileTouchActionType=void 0,(J=exports.MobileTouchActionType||(exports.MobileTouchActionType={}))[J.ActionDown=0]="ActionDown",J[J.ActionUp=1]="ActionUp",J[J.ActionMove=2]="ActionMove",J[J.ActionCancel=3]="ActionCancel",J[J.ActionPointerDown=5]="ActionPointerDown",J[J.ActionPointerUp=6]="ActionPointerUp";var q,V,_=function(){function e(e,t,n,i){this.action=e,this.pointerId=t,this.x=n,this.y=i}return e.prototype.dumps=function(){var e=new DataView(new ArrayBuffer(17));return e.setUint8(0,exports.EventType.MobileTouch),e.setInt32(1,this.action),e.setInt32(5,this.pointerId),e.setInt32(9,this.x),e.setInt32(13,this.y),e.buffer},e}();exports.MobileKeysActionType=void 0,(q=exports.MobileKeysActionType||(exports.MobileKeysActionType={}))[q.ActionDown=0]="ActionDown",q[q.ActionUp=1]="ActionUp",exports.MobileKeysKeycode=void 0,(V=exports.MobileKeysKeycode||(exports.MobileKeysKeycode={}))[V.KeycodeHome=3]="KeycodeHome",V[V.KeycodeBack=4]="KeycodeBack",V[V.KeycodeAppSwitch=187]="KeycodeAppSwitch";var $=function(){function e(e,t){this.action=e,this.keycode=t}return e.prototype.dumps=function(){var e=new DataView(new ArrayBuffer(3));return e.setUint8(0,exports.EventType.MobileKeys),e.setUint8(1,this.action),e.setUint8(2,this.keycode),e.buffer},e}(),ee=function(){function i(e,n,i,o,r,a,s){var c=this;void 0===i&&(i="all"),void 0===o&&(o=2e3),void 0===r&&(r=5e3),void 0===a&&(a=4e3),void 0===s&&(s=!0),this.url=e,this.iceServers=n,this.iceTransportPolicy=i,this.minBitrate=o,this.maxBitrate=r,this.startBitrate=a,this.enableAFK=s,this.event={connect:new L,afk:new L,open:new L,close:new L,queue:new L,ready:new L,endCandidate:new L,cursor:new L,disconnect:new L,receivedLink:new L,receivedVideo:new L,dataChannelConnected:new L,interaction:new L,occupy:new L,kick:new L,networkChanged:new L,echo:new L,screenshot:new L,screenshotData:new L,kickOut:new L,clientInfo:new L,clipboard:new L},this.token="",this.afk=new P,this.tan=new C,this.ready=!1,this.token=e.split("/").pop(),this.pc=new RTCPeerConnection({iceServers:n,iceTransportPolicy:i}),this.setupPeerConnection(),this.dc=this.pc.createDataChannel("sendChannel"),this.dc.binaryType="arraybuffer",this.setupDataChannel(),this.subject=t.webSocket({url:e,closeObserver:{next:function(e){return c.event.close.emit(e)}},openObserver:{next:function(e){return c.event.open.emit(e)}}}),this.setupSigning()}return i.prototype.setupSigning=function(){var e=this;this.subject.subscribe({next:function(t){switch(t.action){case"connect":e.event.connect.emit(t);break;case"sdpOffer":e.pc.setRemoteDescription(new RTCSessionDescription(t.data)),e.pc.createAnswer().then((function(t){e.pc.setLocalDescription(t),e.subject.next({action:"sdpAnswer",data:t})}));break;case"candidate":e.pc.addIceCandidate(new RTCIceCandidate(t.data));break;case"sdpAnswer":e.pc.setRemoteDescription(new RTCSessionDescription(t.data));break;case"ready":e.ready||(e.ready=!0,e.linkStart(),e.event.ready.emit(t));break;case"queue":e.event.queue.emit(t.data.queueNum);break;case"peerDisconnected":e.event.disconnect.emit(t.message);break;case"operateOverTime":e.event.afk.emit(e.afk.idleTime);break;case"unready":try{e.subject.next({action:"verify",data:{token:e.token}})}catch(e){}break;case"hangUp":e.hangUp();break;case"occupy":e.event.occupy.emit("connection occupied!");break;case"kick":e.event.kick.emit(t.message),e.destory();break;case"clientInfo":e.event.clientInfo.emit(t.data)}},error:function(t){e.event.disconnect.emit(t)},complete:function(){}})},i.prototype.setupPeerConnection=function(){var e=this;this.pc.onicecandidate=function(t){t.candidate?e.subject.next({action:"candidate",data:t.candidate}):e.event.endCandidate.emit(t)},this.pc.ontrack=function(t){e.event.receivedVideo.emit(t.streams[0])},this.pc.oniceconnectionstatechange=function(){"disconnected"===e.pc.iceConnectionState&&e.event.networkChanged.emit(e.url)}},i.prototype.setupDataChannel=function(){var t=this,i=e.fromEvent(this.dc,"close");this.dc.onopen=function(o){e.interval(3e4).pipe(n.takeUntil(i)).subscribe((function(e){return t.subject.next({action:"heartbeat"})})),t.enableAFK&&(t.afk.start(),e.interval(u.AFKTimerGap).pipe(n.takeUntil(i)).subscribe((function(e){return t.subject.next({action:"afk",data:{idleTime:t.afk.idleTime}})}))),t.event.dataChannelConnected.emit(o)};var o=e.fromEvent(this.dc,"message").pipe(n.takeUntil(i),n.tap((function(e){})),n.map((function(e){return e.data})),n.share());o.pipe(n.filter((function(e){return p(e)===exports.EventType.CursorData})),n.map((function(e){return A.parse(e)}))).subscribe((function(e){return t.event.cursor.emit(e)})),o.pipe(n.filter((function(e){return p(e)===exports.EventType.KickOutController})),n.map((function(e){return h(e,1)}))).subscribe((function(e){return t.event.kickOut.emit(e)})),o.pipe(n.filter((function(e){return p(e)===exports.EventType.URLIntercept})),n.map((function(e){return h(e,8)}))).subscribe((function(e){return t.event.receivedLink.emit(e)})),o.pipe(n.filter((function(e){return p(e)===exports.EventType.WebRTCForwardREQ})),n.map((function(e){return h(e,1)}))).subscribe((function(e){return t.event.interaction.emit(e)}));var r=o.pipe(n.filter((function(e){return p(e)===exports.EventType.ScreenshotParams})),n.map((function(e){return W.parse(e)})),n.share());r.subscribe((function(e){return t.event.screenshotData.emit(e.payload.byteLength)})),r.pipe(n.buffer(r.pipe(n.filter((function(e){return e.result===exports.ImageResultValue.Success})))),n.filter((function(e){return 0!==e.length})),n.map((function(e){return e.map((function(e){return e.payload}))})),n.map((function(e){return new Blob(e,{type:"image/png"})}))).subscribe((function(e){return t.event.screenshot.emit(e)})),o.pipe(n.filter((function(e){return p(e)===exports.EventType.WebRTCForwardRSP})),n.map((function(e){return H.fromDataChannel(e)}))).subscribe((function(e){return t.tan.trigger(e.id,e.success)})),o.pipe(n.filter((function(e){return p(e)===exports.EventType.ClipboardData})),n.map((function(e){return K.parse(e)}))).subscribe((function(e){return t.event.clipboard.emit(e.payload)})),o.pipe(n.filter((function(e){return[exports.EventType.EchoData,exports.EventType.EventDelay].includes(p(e))})),n.map((function(e){return G.decode(e)}))).subscribe((function(e){var n=e.timestamp;return t.event.echo.emit(~~performance.now()-n)})),this.dc.onerror=function(e){},this.dc.onclose=function(e){}},i.prototype.linkStart=function(){var e=this;this.pc.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0}).then((function(t){e.pc.setLocalDescription(t),t.sdp=t.sdp.replace(/(a=fmtp:\d+ .*level-asymmetry-allowed=.*)\r\n/gm,"$1;x-google-start-bitrate=".concat(e.startBitrate,";x-google-max-bitrate=").concat(e.maxBitrate,";x-google-min-bitrate=").concat(e.minBitrate,"\r\n")),e.subject.next({action:"sdpOffer",data:t})}))},i.prototype.hangUp=function(){this.ready=!1,this.dc.close(),this.pc.close(),this.afk.clear(),this.pc=new RTCPeerConnection({iceServers:this.iceServers,iceTransportPolicy:this.iceTransportPolicy}),this.setupPeerConnection(),this.dc=this.pc.createDataChannel("sendChannel"),this.dc.binaryType="arraybuffer",this.setupDataChannel()},i.prototype.controlAuthority=function(e){return a(this,void 0,void 0,(function(){return s(this,(function(t){return this.subject.next({action:"controlAuthority",data:{token:e}}),[2]}))}))},i.prototype.changeBandwidth=function(e,t,n){n&&t?this.subject.next({action:"setBitrate",data:{min_bitrate:n,max_bitrate:t,cur_bitrate:e}}):this.subject.next({action:"setBitrate",data:{min_bitrate:e,max_bitrate:e,cur_bitrate:e}})},i.prototype.exit=function(){this.subject.closed||this.subject.next({action:"exit"})},i.prototype.emitUIInteraction=function(e){var t=new S,n=this.tan.order(t);return this.send(new z(e,n).dumps()),t.promise},i.prototype.echo=function(){this.send(new G(~~performance.now()).dumps())},i.prototype.screenshot=function(e){var t=void 0===e?{}:e,n=t.index,i=void 0===n?0:n,o=t.left,r=void 0===o?0:o,a=t.top,s=void 0===a?0:a,c=t.width,u=void 0===c?1920:c,p=t.height,h=void 0===p?1080:p;this.send(new W(void 0,i,r,s,u,h).dumps())},i.prototype.clipboard=function(e){this.send(new K(e).dumps())},i.prototype.send=function(e,t){if(void 0===t&&(t=!1),"open"!==this.dc.readyState)throw new Error("send message before DataChannel open");this.enableAFK&&t&&this.afk.reset(),"string"==typeof e||e instanceof Blob||ArrayBuffer,this.dc.send(e)},i.prototype.destory=function(){this.dc.close(),this.pc.close(),this.afk.clear(),this.subject.unsubscribe(),Object.entries(this.event).forEach((function(e){return c(e,2)[1].offAll()}))},i}(),te=function(){function e(e,t,n){var i=this;void 0===t&&(t=function(){}),void 0===n&&(n=!0),this.hostElement=e,this.canResize=!1,this.top=0,this.left=0,this.width=0,this.height=0,this.intervalID=NaN,this.onPlayHandler=[],this.resizePlayer=function(){i.canResize&&(i.hostElement.clientWidth<i.videoElement.videoWidth||i.hostElement.clientHeight<i.videoElement.videoHeight?i.resizePlayerStyleToFillWindow():i.resizePlayerStyleToActualSize())},this.onPlayHandler.push(t),this.overlayElement=document.createElement("div"),this.overlayElement.style.cssText="\n color: white;\n font-size: 1.8em;\n width: 100%;\n height: 100%;\n display: flex;\n position: absolute;\n background-color: rgba(51, 51, 51, 0.7);\n justify-content: center;\n align-items: center;\n ",this.playerElement=document.createElement("div"),this.playerElement.style.cssText="\n width: 100%;\n height: 100%;\n position: relative;\n background-color: black;\n ",this.videoElement=document.createElement("video"),this.videoElement.style.cssText="\n width: 100%;\n height: 100%;\n position: absolute;\n touch-action: none;\n ",this.videoElement.muted=!0,this.videoElement.playsInline=!0,this.videoElement.autoplay=!0,this.videoElement.addEventListener("loadedmetadata",(function(e){i.intervalID=window.setInterval((function(){i.isBlackScreen()||(i.canResize=!0,i.hidePlayOverlay(),i.resizePlayer(),window.clearInterval(i.intervalID),i.onPlayHandler.forEach((function(e){return e()})))}),500),i.videoElement.play().catch((function(){return i.showPlayOverlay()}))})),this.playerElement.appendChild(this.videoElement),this.playerElement.appendChild(this.overlayElement),e.appendChild(this.playerElement),new o.default(this.resizePlayer).observe(e);var r=this;n&&(document.body.addEventListener("mousedown",(function e(){r.videoElement.muted=!1,document.body.removeEventListener("mousedown",e)})),window.navigator.userAgent.indexOf("Chrome")>-1?document.body.addEventListener("touchend",(function e(){r.videoElement.muted=!1,document.body.removeEventListener("touchend",e)})):document.body.addEventListener("touchstart",(function e(){r.videoElement.muted=!1,document.body.removeEventListener("touchstart",e)})))}return Object.defineProperty(e.prototype,"videoAspectRatio",{get:function(){return this.videoElement.videoHeight/this.videoElement.videoWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hostAspectRatio",{get:function(){return this.hostElement.clientHeight/this.hostElement.clientWidth},enumerable:!1,configurable:!0}),e.prototype.registerOnPlay=function(e){this.onPlayHandler.push(e)},e.prototype.isBlackScreen=function(){var e,t=document.createElement("canvas"),n=t.getContext("2d");return t.width=this.videoElement.videoWidth/100,t.height=this.videoElement.videoHeight/100,n.drawImage(this.videoElement,0,0,t.width,t.height),!t.width||(null===(e=n.getImageData(0,0,t.width,t.height))||void 0===e?void 0:e.data).every((function(e){return 0===e||1===e||255===e}))},e.prototype.resizePlayerStyleToFillWindow=function(){this.videoAspectRatio?this.hostAspectRatio<this.videoAspectRatio?(this.height=this.hostElement.clientHeight,this.width=Math.floor(this.height/this.videoAspectRatio),this.left=Math.floor(.5*(this.hostElement.clientWidth-this.width)),this.top=0):(this.width=this.hostElement.clientWidth,this.height=Math.floor(this.width*this.videoAspectRatio),this.top=Math.floor(.5*(this.hostElement.clientHeight-this.height)),this.left=0):(this.width=this.hostElement.clientWidth,this.height=this.hostElement.clientHeight,this.top=0,this.left=0),this.applyStyleToPlayer()},e.prototype.resizePlayerStyleToActualSize=function(){this.width=this.videoElement.videoWidth,this.height=this.videoElement.videoHeight,this.top=Math.floor(.5*(this.hostElement.clientHeight-this.height)),this.left=Math.floor(.5*(this.hostElement.clientWidth-this.width)),this.applyStyleToPlayer()},e.prototype.applyStyleToPlayer=function(){this.playerElement.style.top="".concat(this.top,"px"),this.playerElement.style.left="".concat(this.left,"px"),this.playerElement.style.width="".concat(this.width,"px"),this.playerElement.style.height="".concat(this.height,"px")},e.prototype.destory=function(){var e;this.intervalID&&window.clearInterval(this.intervalID),this.playerElement.contains(this.videoElement)&&this.playerElement.removeChild(this.videoElement),this.playerElement.contains(this.overlayElement)&&this.playerElement.removeChild(this.overlayElement),null===(e=this.playerElement.parentNode)||void 0===e||e.removeChild(this.playerElement)},e.prototype.showTextOverlay=function(e){var t=document.createElement("div");t.innerHTML=e,this.setOverlay(t)},e.prototype.showPlayOverlay=function(){var e=this,t=document.createElement("img");t.id="play-button",t.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPEAAAD5CAYAAAD2mNNkAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMjHxIGmVAAASgklEQVR4Xu2dC7BdVX2HqUCCIRASCPjAFIQREBRBBSRYbFOt8lIrFUWRFqXWsT5wbItUqFWs0KqIMPKoYEWpRS06KDjS1BeVFkVQbCw+wCfiAwGhCKWP9PuZtU24uTe59zz22Y/vm/nGkXtz7jlrr9+sdfZea/03Wb169QtxGW62iYi0D8L7NbwYj8EdcdPyIxFpA4T2P/F/8Ua8CI/GhPnXyq+ISJMhrAlxxX9hRuYL8Sh8SPk1EWkqBHXdEFfcg6vw3fhs3Kb8uog0DQI6XYgr8rOvYsJ8OM4v/0xEmkIJ6ob4P8zIfANegCvQMIs0BQK5sRBXJMy/wIzM5+ByXFBeRkQmBUGcbYjX5S5MmM/AA3CL8nIiUjcEcJAQV9yBX8a/wSeiz5hF6obgDRPikGfMCfOX8DTcu7y0iNQBoRs2xBX/g3diwvwm3Kn8CREZJ4RtVCGuqMKcu9kn4xJ09ZfIuCBgow5xyJ3sTLNzAywrwF6J26NhFhk1BGscIV6XhPluvA6Pxx3KnxaRUUCoxh3iioQ5z5n/BY/FJeUtiMgwEKa6QlyRMN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uspKZDYQlkmH+Mf4t7gct0enzSJzgdBMKsQJ70X4VHTkFRkUwlN3iFM54YN4KG6LHkQnMgyEqK4Q51nvpZjwZuQ1vCKjgDDVEeIr8XBMeL3bLDJKCNW4QpyR9zo8ArdBb1iJjAPCNeoQJ7ypFngszkc3JoiME0I2qhDnWW8Kjv0xujFBpC4I3DAhzgqrHESXUp/Z0/uQ8rIiUhcEb5AQJ7z34TfwJNy5vJyI1A0BnG2IE9yYsiffwTfizuh3XpFJQghnE+J83014v4upkL8r+qhIpAkQxg2FOOHNzzNtPhf3REdekSZRQjqVTJtzguSNeD4eWH5dRJoGAZ0a4rvxm3ghrkCnzSJNhpBWIc7/plpgwpudRZ7dLNIGCOvtJbwX42G4uPxIRNoAoU2d3iNxUflPItIaNtnk/wEGBoMdpECGHAAAAABJRU5ErkJggg==",t.alt="Start Streaming",this.setOverlay(t,(function(){e.hidePlayOverlay()}))},e.prototype.hidePlayOverlay=function(){this.clearOverlay(),this.overlayElement.style.display="none"},e.prototype.clearOverlay=function(){for(;this.overlayElement.lastChild;)this.overlayElement.removeChild(this.overlayElement.lastChild)},e.prototype.setOverlay=function(e,t){if(this.clearOverlay(),this.overlayElement.appendChild(e),this.overlayElement.style.display="flex",t){var n=this;this.overlayElement.addEventListener("click",(function e(i){t(i),n.overlayElement.removeEventListener("click",e)}))}},e}(),ne=function(){function t(){}return t.createDefaultEventStream=function(t,i){t.addEventListener("contextmenu",(function(e){return e.preventDefault()}));var o=e.fromEvent(t,"mousedown").pipe(n.tap((function(e){return e.preventDefault()})),n.map((function(e){return j.formMouseEvent(e,!0).dumps()}))),a=e.fromEvent(t,"mouseup").pipe(n.tap((function(e){return e.preventDefault()})),n.map((function(e){return j.formMouseEvent(e,!1).dumps()}))),s=e.fromEvent(t,"mousemove").pipe(n.tap((function(e){return e.preventDefault()})),n.map((function(e){return d(e,i.mouseNormalizeType===exports.EventType.MouseMoveStandardization)})),n.map((function(e){var t=e.x,n=e.y,o=e.dx,r=e.dy;return new F(t,n,o,r,i.mouseMoveType,i.mouseNormalizeType).dumps()}))),c=e.fromEvent(t,"mouseleave").pipe(n.map(b),n.map((function(e){return d(e,i.mouseNormalizeType===exports.EventType.MouseMoveStandardization)})),n.map((function(e){var t=e.x,n=e.y,o=e.dx,r=e.dy;return new F(t,n,o,r,i.mouseMoveType,i.mouseNormalizeType).dumps()}))),u=e.fromEvent(t,"wheel",{passive:!1}).pipe(n.tap((function(e){return e.preventDefault()})),n.map((function(e){return O.fromWheelEvent(e).dumps()})));function p(e,t){var n=t===exports.TouchType.TouchUpdate?"touches":"changedTouches";return new Z(t,function(e,t){var n=e.target,i=n.videoWidth,o=n.videoHeight,r=n.clientHeight,a=n.clientWidth,s=n.getBoundingClientRect(),c=s.left,u=s.top;return t.map((function(e){var t=e.clientX,n=e.clientY;return{x:i/a*(t-c),y:o/r*(n-u),id:e.identifier}}))}(e,Array.from(e[n]))).dumps()}var h=e.fromEvent(t,"touchend"),l=e.fromEvent(t,"touchmove",{passive:!1}),f=e.fromEvent(t,"touchstart",{passive:!1}),m=e.fromEvent(t,"touchcancel");return{wheelStream:u,mouseupStream:a,mousedownStream:o,mousemoveStream:s,zoomStream:l.pipe(n.tap((function(e){return e.preventDefault()})),n.takeUntil(e.merge(h,m)),n.throttleTime(100),n.filter((function(e){return 2===e.targetTouches.length})),n.pairwise(),n.map(v),n.map((function(e){return O.fromPinchZoom(e/10).dumps()})),n.repeat()),startBufferStream:e.iif((function(){return i.fakeMouseWithTouch}),f.pipe(n.tap((function(e){return e.preventDefault()})),n.concatMap((function(t){return e.of((n=d({target:t.target,clientX:t.targetTouches[0].clientX,clientY:t.targetTouches[0].clientY,movementX:0,movementY:0},i.mouseNormalizeType===exports.EventType.MouseMoveStandardization),o=n.x,r=n.y,a=n.dx,s=n.dy,new F(o,r,a,s,i.mouseMoveType,i.mouseNormalizeType).dumps()),new j(3===t.targetTouches.length?exports.MouseButtonType.ButtonMiddle:i.fakeTouchType,!0).dumps());var n,o,r,a,s}))),f.pipe(n.tap((function(e){return e.preventDefault()})),n.map((function(e){return p(e,exports.TouchType.TouchDown)})))),moveBufferStream:e.iif((function(){return i.fakeMouseWithTouch}),l.pipe(n.tap((function(e){return e.preventDefault()})),n.takeUntil(e.merge(h,m)),n.filter((function(e){return 1===e.targetTouches.length||3===e.targetTouches.length})),n.pairwise(),n.map(y),n.map((function(e){return function(e,t,n){var i=e.movementX,o=e.movementY;return r(r({},e),{movementX:i*t,movementY:o*n})}(e,i.touchDeltaXSensitivity,i.touchDeltaYSensitivity)})),n.map((function(e){return d(e,i.mouseNormalizeType===exports.EventType.MouseMoveStandardization)})),n.map((function(e){var t=e.x,n=e.y,o=e.dx,r=e.dy;return new F(t,n,o,r,i.mouseMoveType,i.mouseNormalizeType).dumps()})),n.repeat()),l.pipe(n.tap((function(e){return e.preventDefault()})),n.map((function(e){return p(e,exports.TouchType.TouchUpdate)})))),endBufferStream:e.iif((function(){return i.fakeMouseWithTouch}),e.merge(h,m).pipe(n.tap((function(e){return e.preventDefault()})),n.mapTo(new j(i.fakeTouchType,!1).dumps())),e.merge(h,m).pipe(n.tap((function(e){return e.preventDefault()})),n.map((function(e){return p(e,exports.TouchType.TouchUp)})))),leaveStream:c}},t.createGamepadStream=function(){return e.interval(0,e.animationFrameScheduler).pipe(n.map((function(e){return navigator.getGamepads()[0]})),n.filter((function(e){return!!e})),n.map((function(e){var t=c(e.axes.map((function(e){return 32767*e})),4),n=t[0],i=t[1],o=t[2],r=t[3],a=255*e.buttons[6].value,s=255*e.buttons[7].value;return new Y(exports.GamepadType.GamepadXbox,0,0,a,s,n,-i,o,-r).dumps()})))},t.createClipboardStream=function(t){return e.fromEvent(t,"focus").pipe(n.mergeMap((function(){return new Promise((function(e){return navigator.clipboard.readText().then(e).catch((function(){return e("")}))}))})),n.map((function(e){return new K(e).dumps()})))},t.createKeyboardStream=function(t){t.tabIndex=-1;var i=function(){return t.focus()};return t.addEventListener("touchstart",i,{passive:!0}),t.addEventListener("mouseenter",i),t.addEventListener("click",i),{keydownStream:e.fromEvent(t,"keydown").pipe(n.tap((function(e){return e.preventDefault()})),n.map((function(e){return Q.fromKeyboardEvent(e,!0).dumps()}))),keyupStream:e.fromEvent(t,"keyup").pipe(n.tap((function(e){return e.preventDefault()})),n.map((function(e){return Q.fromKeyboardEvent(e,!1).dumps()})))}},t.createMobileStreamFromMouse=function(t){var i=e.fromEvent(t,"mouseup").pipe(n.map((function(e){var t=d(e,!0),n=t.x,i=t.y;return new _(exports.MobileTouchActionType.ActionUp,0,n,i).dumps()}))),o=e.fromEvent(t,"mousemove").pipe(n.map((function(e){var t=d(e,!0),n=t.x,i=t.y;return new _(exports.MobileTouchActionType.ActionMove,0,n,i).dumps()}))),r=e.fromEvent(t,"mousedown").pipe(n.map((function(e){var t=d(e,!0),n=t.x,i=t.y;return new _(exports.MobileTouchActionType.ActionDown,0,n,i).dumps()})));return e.merge(r,o,i)},t.attachMobileListener=function(t,i){return this.createMobileStreamFromMouse(t).pipe(n.takeUntil(e.fromEvent(i.dc,"close"))).subscribe((function(e){return i.send(e,!0)}))},t.attachListener=function(t,i,o,r){var a=void 0===r?{}:r,s=a.enableClipboard,c=void 0!==s&&s,u=a.enableGamepad,p=void 0!==u&&u,h=this.createDefaultEventStream(t,i),l=h.wheelStream,d=h.mouseupStream,f=h.mousedownStream,m=h.mousemoveStream,v=h.zoomStream,y=h.startBufferStream,b=h.moveBufferStream,g=h.endBufferStream,w=h.leaveStream,x=this.createKeyboardStream(t),T=x.keyupStream,E=x.keydownStream,k=e.merge(l,E,T,d,f,m,v,y,b,g,w);return c&&(k=e.merge(k,this.createClipboardStream(t))),p&&(k=e.merge(k,this.createGamepadStream())),k.pipe(n.takeUntil(e.fromEvent(o.dc,"close"))).subscribe((function(e){return o.send(e,!0)}))},t}(),ie=function(e,t,n,i,o,r){void 0===e&&(e=exports.EventType.MouseMoveStandardization),void 0===t&&(t=exports.MoveType.Passive),void 0===n&&(n=exports.MouseButtonType.ButtonLeft),void 0===i&&(i=!0),void 0===o&&(o=1),void 0===r&&(r=1),this.mouseNormalizeType=e,this.mouseMoveType=t,this.fakeTouchType=n,this.fakeMouseWithTouch=i,this.touchDeltaXSensitivity=o,this.touchDeltaYSensitivity=r},oe=function(){function t(){var e=this;this.latency=0,this.averageJitterBufferDelay=0,this.bytesReceivedPerMillisecond=0,this.headerBytesReceivedPerMillisecond=0,this.packetsLost=0,this.packetsReceived=0,this.framesReceived=0,this.framesDecoded=0,this.keyFramesDecoded=0,this.framesDropped=0,this.framesPerSecond=0,this.handleLatency=function(t){return e.latency=t}}return Object.defineProperty(t.prototype,"bitrate",{get:function(){return 8*(this.bytesReceivedPerMillisecond+this.headerBytesReceivedPerMillisecond)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"packetLossRate",{get:function(){return this.packetsReceived?this.packetsLost/(this.packetsLost+this.packetsReceived):0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"running",{get:function(){return!!this.statSub&&!!this.echoSub&&!!this.dispose},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasOffered",{get:function(){return!!this.connection},enumerable:!1,configurable:!0}),t.prototype.offer=function(e){this.connection=e,this.running&&this.scan()},t.prototype.scan=function(){var t,n=this;if(!this.connection)throw new Error("gather statistics before provide connection");var i=this.connection;null===(t=this.statSub)||void 0===t||t.unsubscribe(),this.echoSub&&(this.echoSub.unsubscribe(),this.connection.event.echo.off(this.handleLatency)),this.dispose=this.connection.event.echo.on(this.handleLatency).dispose,this.echoSub=e.interval(1e3).subscribe((function(){return"open"===i.dc.readyState&&i.echo()})),this.statSub=e.interval(1e3).pipe(e.mergeMap((function(){return e.from(i.pc.getStats())})),e.map((function(e){return function(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}([],c(e.values()),!1).find((function(e){return"inbound-rtp"===e.type&&"video"===e.kind}))})),e.pairwise(),e.map((function(e){var t,n,i,o,r,a,s,u=c(e,2),p=u[0],h=u[1];if(p&&h){var l=h.timestamp-p.timestamp,d=~~(1e3*(h.jitterBufferDelay-p.jitterBufferDelay)/(h.jitterBufferEmittedCount-p.jitterBufferEmittedCount));return{bytesReceivedPerMillisecond:~~((h.bytesReceived-p.bytesReceived)/l),headerBytesReceivedPerMillisecond:~~((h.headerBytesReceived-p.headerBytesReceived)/l),averageJitterBufferDelay:d,packetsLost:null!==(t=h.packetsLost)&&void 0!==t?t:0,packetsReceived:null!==(n=h.packetsReceived)&&void 0!==n?n:0,framesReceived:null!==(i=h.framesReceived)&&void 0!==i?i:0,framesDecoded:null!==(o=h.framesDecoded)&&void 0!==o?o:0,keyFramesDecoded:null!==(r=h.keyFramesDecoded)&&void 0!==r?r:0,framesDropped:null!==(a=h.framesDropped)&&void 0!==a?a:0,framesPerSecond:null!==(s=h.framesPerSecond)&&void 0!==s?s:0}}return{bytesReceivedPerMillisecond:0,headerBytesReceivedPerMillisecond:0,averageJitterBufferDelay:0,packetsLost:0,packetsReceived:0,framesReceived:0,framesDecoded:0,keyFramesDecoded:0,framesDropped:0,framesPerSecond:0}}))).subscribe((function(e){var t=e.headerBytesReceivedPerMillisecond,i=e.bytesReceivedPerMillisecond,o=e.averageJitterBufferDelay,r=e.packetsLost,a=e.packetsReceived,s=e.framesReceived,c=e.framesDecoded,u=e.keyFramesDecoded,p=e.framesDropped,h=e.framesPerSecond;n.bytesReceivedPerMillisecond=i,n.headerBytesReceivedPerMillisecond=t,n.packetsLost=r,n.packetsReceived=a,n.framesReceived=s,n.framesDecoded=c,n.keyFramesDecoded=u,n.framesDropped=p,n.framesPerSecond=h,n.averageJitterBufferDelay=o}))},t.prototype.report=function(){var e=this,t=e.latency,n=e.packetLossRate,i=e.bitrate,o=e.averageJitterBufferDelay,r=e.framesReceived,a=e.framesDecoded,s=e.keyFramesDecoded,c=e.framesDropped;return{fps:e.framesPerSecond,latency:t,bitrate:i,packetLossRate:n,averageJitterBufferDelay:o,framesReceived:r,framesDecoded:a,keyFramesDecoded:s,framesDropped:c}},t.prototype.toggle=function(){this.running?this.stop():this.scan()},t.prototype.stop=function(){var e,t;this.bytesReceivedPerMillisecond=0,this.headerBytesReceivedPerMillisecond=0,this.averageJitterBufferDelay=0,this.latency=0,this.packetsLost=0,this.packetsReceived=0,this.framesReceived=0,this.framesDecoded=0,this.keyFramesDecoded=0,this.framesDropped=0,this.framesPerSecond=0,null===(e=this.statSub)||void 0===e||e.unsubscribe(),this.statSub=void 0,null===(t=this.echoSub)||void 0===t||t.unsubscribe(),this.echoSub=void 0,this.dispose&&this.dispose(),this.dispose=void 0},t}();exports.ClipboardData=K,exports.Connection=ee,exports.EventData=G,exports.Gamepad=Y,exports.Helper=ne,exports.Keyboard=Q,exports.MobileKeys=$,exports.MobileTouch=_,exports.MouseButton=j,exports.MouseMove=F,exports.Player=te,exports.PointerManager=R,exports.Rivatuner=oe,exports.RunningState=ie,exports.Screenshot=W,exports.TextInput=N,exports.TouchSet=Z,exports.UIInteraction=z,exports.UIInteractionResponse=H,exports.WheelScroll=O,exports.screenfull=B;

@@ -15,2 +15,2 @@ import"webrtc-adapter";import{fromEvent as e,interval as t,merge as n,iif as i,of as o,animationFrameScheduler as r,mergeMap as a,from as s,map as c,pairwise as u}from"rxjs";import{webSocket as h}from"rxjs/webSocket";import{takeUntil as l,tap as d,map as f,share as p,filter as m,buffer as v,throttleTime as y,pairwise as b,repeat as w,concatMap as g,mapTo as k,mergeMap as E}from"rxjs/operators";import D from"resize-observer-polyfill";

PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var x=function(){return x=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},x.apply(this,arguments)};function T(e,t,n,i){return new(n||(n=Promise))((function(o,r){function a(e){try{c(i.next(e))}catch(e){r(e)}}function s(e){try{c(i.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))}function M(e,t){var n,i,o,r,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(r){return function(s){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(o=2&r[0]?i.return:r[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,r[1])).done)return o;switch(i=0,o&&(r=[2&r[0],o.value]),r[0]){case 0:case 1:o=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,i=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]<o[3])){a.label=r[1];break}if(6===r[0]&&a.label<o[1]){a.label=o[1],o=r;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(r);break}o[2]&&a.ops.pop(),a.trys.pop();continue}r=t.call(e,a)}catch(e){r=[6,e],i=0}finally{n=o=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,s])}}}function B(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}var P=Object.freeze({EnableLog:!1,AFKTimerGap:1e4});var S=function(e){return new DataView(e).getUint8(0)};function L(e,t,n){void 0===t&&(t=1),void 0===n&&(n="");var i,o=new DataView(e);return(i=e.byteLength-t,Object.keys(Array.from({length:i})).map((function(e){return Number(e)}))).map((function(e){return String.fromCharCode(o.getUint8(e+t))})).join(n)}function C(e){for(var t,n=new Array,i=0;i<e.length;i++)(t=e.charCodeAt(i))>=65536&&t<=1114111?(n.push(t>>18&7|240),n.push(t>>12&63|128),n.push(t>>6&63|128),n.push(63&t|128)):t>=2048&&t<=65535?(n.push(t>>12&15|224),n.push(t>>6&63|128),n.push(63&t|128)):t>=128&&t<=2047?(n.push(t>>6&31|192),n.push(63&t|128)):n.push(255&t);return n}function A(e,t){void 0===t&&(t=!1);var n=e.target,i=n.getBoundingClientRect(),o=i.left,r=i.top,a=e.clientX,s=e.clientY,c=e.movementY,u=e.movementX,h=n.clientHeight,l=n.clientWidth,d=n.videoHeight,f=n.videoWidth;return{x:Math.min(Math.max(a-o,0),l)*((t?f:65535)/l),y:Math.min(Math.max(s-r,0),h)*((t?d:65535)/h),dx:u*((t?f:32767)/l),dy:c*((t?d:32767)/h)}}var R=function(){function e(e,t){this.x=e,this.y=t}return e.fromTouch=function(t){return new e(t.pageX,t.pageY)},e}();function U(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function I(e){var t=B(Array.from(e[0].targetTouches),2),n=t[0],i=t[1],o=B(Array.from(e[1].targetTouches),2),r=o[0],a=o[1];return U(R.fromTouch(r),R.fromTouch(a))-U(R.fromTouch(n),R.fromTouch(i))}function X(e){var t=B(e,2),n=t[0],i=t[1],o=i.targetTouches[0].clientX-n.targetTouches[0].clientX,r=i.targetTouches[0].clientY-n.targetTouches[0].clientY;return{target:n.target,clientX:n.targetTouches[0].clientX,clientY:n.targetTouches[0].clientY,movementX:o,movementY:r}}function z(e){var t=e.target.getBoundingClientRect(),n=t.left,i=t.top,o=t.right,r=t.bottom,a=e.clientY,s=e.clientX,c=Math.abs(i-a),u=Math.abs(r-a),h=Math.abs(n-s),l=Math.abs(o-s);switch(Math.min(c,u,h,l)){case h:return{target:e.target,clientX:0,clientY:a,movementY:0,movementX:0};case c:return{target:e.target,clientX:s,clientY:0,movementY:0,movementX:0};default:return{target:e.target,clientX:s,clientY:a,movementY:0,movementX:0}}}var G,j,F,O,Q,Z,H,N,Y=new(function(){function e(){this.APINameMap="exitFullscreen"in document?{requestFullscreen:"requestFullscreen",exitFullscreen:"exitFullscreen",fullscreenElement:"fullscreenElement",fullscreenEnabled:"fullscreenEnabled",fullscreenchange:"fullscreenchange"}:"webkitExitFullscreen"in document?{requestFullscreen:"webkitRequestFullscreen",exitFullscreen:"webkitExitFullscreen",fullscreenElement:"webkitFullscreenElement",fullscreenEnabled:"webkitFullscreenEnabled",fullscreenchange:"webkitfullscreenchange"}:{requestFullscreen:"mozRequestFullScreen",exitFullscreen:"mozCancelFullScreen",fullscreenElement:"mozFullScreenElement",fullscreenEnabled:"mozFullScreenEnabled",fullscreenchange:"mozfullscreenchange"}}return Object.defineProperty(e.prototype,"isFullscreen",{get:function(){return Boolean(document[this.APINameMap.fullscreenElement])},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"element",{get:function(){return document[this.APINameMap.fullscreenElement]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEnabled",{get:function(){return Boolean(document[this.APINameMap.fullscreenEnabled])},enumerable:!1,configurable:!0}),e.prototype.request=function(e,t){var n=this;return new Promise((function(i,o){var r=function(){screen.orientation.lock("landscape-primary"),document.removeEventListener(n.APINameMap.fullscreenchange,r),n.off(r),"keyboard"in navigator&&"lock"in navigator.keyboard&&navigator.keyboard.lock(["KeyW","Escape","KeyN","KeyT","MetaLeft"]),i()};n.on(r);var a=(e||document.documentElement)[n.APINameMap.requestFullscreen](t);a instanceof Promise&&a.then(r).catch(o)}))},e.prototype.exit=function(){var e=this;return new Promise((function(t,n){if(e.isFullscreen){var i=function(){e.off(i),t()};e.on(i);var o=document[e.APINameMap.exitFullscreen]();o instanceof Promise&&o.then(i).catch(n)}else t()}))},e.prototype.toggle=function(e,t){return this.isFullscreen?this.exit():this.request(e,t)},e.prototype.on=function(e){document.addEventListener(this.APINameMap.fullscreenchange,e)},e.prototype.off=function(e){document.removeEventListener(this.APINameMap.fullscreenchange,e)},e}()),W=function(){function e(){this.timer=NaN,this.idleTime=0}return e.prototype.reset=function(){this.idleTime=0},e.prototype.start=function(){var e=this;this.timer=window.setInterval((function(){e.idleTime+=1e3}),1e3)},e.prototype.clear=function(){window.clearInterval(this.timer)},e}(),J=function(){var e=this;this.promise=new Promise((function(t,n){e.resolve=t,e.reject=n}))},K=function(){function e(e,t,n,i){void 0===e&&(e=""),void 0===t&&(t=!0),void 0===n&&(n=0),void 0===i&&(i=0),this.base64=e,this.show=t,this.x=n,this.y=i}return e.parse=function(t){var n=new DataView(t),i=n.getUint32(1),o=n.getUint32(5),r=n.getUint32(9),a=n.getUint32(13),s=n.getUint32(17),c=n.getUint32(21),u=n.getUint8(29);if(0===r||0===a)return new e("",!!u,-i,-o);if(1===s&&4===c)return new e("",!!u,-i,-o);var h=document.createElement("canvas"),l=h.getContext("2d");h.width=r,h.height=a;var d=l.createImageData(r,a),f=d.data;f.set(new Uint8ClampedArray(t,30));for(var p=0;p<f.length;p+=4){var m=f[p];f[p]=f[p+2],f[p+2]=m}return l.putImageData(d,0,0),new e(h.toDataURL(),!!u,i,o)},e}(),q=function(){var e=this;this.listeners=[],this.listenersOncer=[],this.on=function(t){return e.listeners.push(t),{dispose:function(){return e.off(t)}}},this.once=function(t){e.listenersOncer.push(t)},this.off=function(t){var n=e.listeners.indexOf(t);n>-1&&e.listeners.splice(n,1)},this.offAll=function(){e.listenersOncer=[],e.listeners=[]},this.emit=function(t){e.listeners.forEach((function(e){return e(t)})),e.listenersOncer.forEach((function(e){return e(t)})),e.listenersOncer=[]},this.pipe=function(t){return e.on((function(e){return t.emit(e)}))}},V=function(){function e(){this.currentID=0,this.executeMap=new Map}return e.prototype.obtainID=function(){return this.currentID>=65535?this.currentID=0:++this.currentID},e.prototype.trigger=function(e,t){this.executeMap.has(e)&&(this.executeMap.get(e).resolve(t),this.executeMap.delete(e))},e.prototype.order=function(e){var t=this.obtainID();return this.executeMap.set(t,e),t},e}(),_=function(){function e(e,t){var n=this;void 0===t&&(t=function(){}),this.target=e,this.onExit=t,this.cursor=new K,this.handleVisibilityChange=function(){"visible"!==document.visibilityState||n.cursor.show||n.target.requestPointerLock()},this.handlePointerLockError=function(){document.addEventListener("click",(function(){n.cursor.show||n.target.requestPointerLock()}),{once:!0})},this.handlePointerLockChange=function(){n.isPointerLocking||n.cursor.show||Y.isFullscreen||n.onExit()},e.requestPointerLock=e.requestPointerLock||e.mozRequestPointerLock||e.webkitRequestPointerLock,document.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock,document.addEventListener("pointerlockchange",this.handlePointerLockChange),document.addEventListener("pointerlockerror",this.handlePointerLockError),document.addEventListener("visibilitychange",this.handleVisibilityChange)}return e.prototype.destory=function(){this.target.style.cursor="default",document.removeEventListener("pointerlockerror",this.handlePointerLockChange),document.removeEventListener("pointerlockchange",this.handlePointerLockError),document.removeEventListener("visibilitychange",this.handleVisibilityChange)},e.prototype.setCursor=function(e){var t=this;if(this.cursor=e,e.show?document.exitPointerLock():this.target.requestPointerLock(),e.base64){var n=document.createElement("img");n.src=e.base64,n.onload=function(){if(n.width>32||n.height>32){var i=function(e){var t=document.createElement("canvas"),n=e.width>32?32:e.width,i=e.height>32?32:e.height;t.width=n,t.height=i;var o=t.getContext("2d");return null==o||o.drawImage(e,0,0,n,i),t.toDataURL()}(n);t.target.style.cursor="url(".concat(i,") ").concat(e.x," ").concat(e.y,", auto")}else t.target.style.cursor="url(".concat(e.base64,") ").concat(e.x," ").concat(e.y,", auto")}}else this.target.style.cursor="none"},Object.defineProperty(e.prototype,"isPointerLocking",{get:function(){return(document.pointerLockElement||document.mozPointerLockElement||document.webkitPointerLockElement)===this.target},enumerable:!1,configurable:!0}),e}();!function(e){e[e.MouseMoveStandardization=0]="MouseMoveStandardization",e[e.MouseButton=1]="MouseButton",e[e.WheelScroll=2]="WheelScroll",e[e.Keyboard=3]="Keyboard",e[e.WinTouch=4]="WinTouch",e[e.MobileTouch=5]="MobileTouch",e[e.MobileCustom=6]="MobileCustom",e[e.URLIntercept=7]="URLIntercept",e[e.CaretVisible=8]="CaretVisible",e[e.TextInput=9]="TextInput",e[e.MobileKeys=10]="MobileKeys",e[e.Gamepad=11]="Gamepad",e[e.CursorData=12]="CursorData",e[e.MouseMoveNormalization=13]="MouseMoveNormalization",e[e.EventDelay=14]="EventDelay",e[e.EchoData=15]="EchoData",e[e.KickOutController=16]="KickOutController",e[e.ScreenshotParams=17]="ScreenshotParams",e[e.ClipboardData=18]="ClipboardData",e[e.WebRTCPluginsMSG=125]="WebRTCPluginsMSG",e[e.WebRTCForwardRSP=126]="WebRTCForwardRSP",e[e.WebRTCForwardREQ=127]="WebRTCForwardREQ"}(G||(G={})),function(e){e[e.Failure=0]="Failure",e[e.Success=1]="Success",e[e.Portion=2]="Portion"}(j||(j={})),function(e){e[e.Clipboard=0]="Clipboard",e[e.FileBMP=1]="FileBMP",e[e.FilePNG=2]="FilePNG",e[e.BinaryBMP=3]="BinaryBMP",e[e.BinaryPNG=4]="BinaryPNG"}(F||(F={})),function(e){e[e.ButtonLeft=1]="ButtonLeft",e[e.ButtonMiddle=2]="ButtonMiddle",e[e.ButtonRight=3]="ButtonRight",e[e.ButtonX1=4]="ButtonX1",e[e.ButtonX2=5]="ButtonX2"}(O||(O={})),function(e){e[e.TouchDown=0]="TouchDown",e[e.TouchUpdate=1]="TouchUpdate",e[e.TouchUp=2]="TouchUp"}(Q||(Q={})),function(e){e[e.Absolute=0]="Absolute",e[e.Relative=1]="Relative",e[e.Passive=2]="Passive",e[e.Unknow=3]="Unknow"}(Z||(Z={})),function(e){e[e.GamepadXbox=0]="GamepadXbox"}(H||(H={})),function(e){e[e.GamepadXboxButtonDpadUp=1]="GamepadXboxButtonDpadUp",e[e.GamepadXboxButtonDpadDown=2]="GamepadXboxButtonDpadDown",e[e.GamepadXboxButtonDpadLeft=4]="GamepadXboxButtonDpadLeft",e[e.GamepadXboxButtonDpadRight=8]="GamepadXboxButtonDpadRight",e[e.GamepadXboxButtonStart=16]="GamepadXboxButtonStart",e[e.GamepadXboxButtonBack=32]="GamepadXboxButtonBack",e[e.GamepadXboxButtonLeftThumb=64]="GamepadXboxButtonLeftThumb",e[e.GamepadXboxButtonRightThumb=128]="GamepadXboxButtonRightThumb",e[e.GamepadXboxButtonLeftShoulder=256]="GamepadXboxButtonLeftShoulder",e[e.GamepadXboxButtonRightShoulder=512]="GamepadXboxButtonRightShoulder",e[e.GamepadXboxButtonA=4096]="GamepadXboxButtonA",e[e.GamepadXboxButtonB=8192]="GamepadXboxButtonB",e[e.GamepadXboxButtonX=16384]="GamepadXboxButtonX",e[e.GamepadXboxButtonY=32768]="GamepadXboxButtonY"}(N||(N={}));var $,ee,te=new Map([[0,O.ButtonLeft],[1,O.ButtonMiddle],[2,O.ButtonRight],[3,O.ButtonX1],[4,O.ButtonX2]]),ne=function(){function e(e,t){void 0===t&&(t=0),this.data=e,this.id=t}return e.prototype.dumps=function(){var e=new DataView(new ArrayBuffer(3+this.data.length)),t=0;e.setUint8(t,G.WebRTCForwardREQ),t++,e.setUint16(t,this.id),t+=2;for(var n=0;n<this.data.length;n++)e.setUint8(t,this.data.charCodeAt(n)),t+=1;return e.buffer},e}(),ie=function(){function e(e){this.timestamp=e}return e.prototype.dumps=function(){var e=new DataView(new ArrayBuffer(5));return e.setUint8(0,G.EchoData),e.setUint32(1,this.timestamp),e.buffer},e.decode=function(t){return new e(new DataView(t).getUint32(1))},e}(),oe=function(){function e(e,t,n,i,o,r){void 0===o&&(o=Z.Passive),void 0===r&&(r=G.MouseMoveStandardization),this.x=e,this.y=t,this.dx=n,this.dy=i,this.move=o,this.eventType=r}return e.prototype.dumps=function(){P.EnableLog;var e=new ArrayBuffer(10),t=new DataView(e);return t.setUint8(0,this.eventType),t.setUint8(1,+this.move),t.setUint16(2,this.x),t.setUint16(4,this.y),t.setUint16(6,this.dx),t.setUint16(8,this.dy),e},e}(),re=function(){function e(e,t){this.mouseButtonType=e,this.down=t}return e.prototype.dumps=function(){P.EnableLog;var e=new ArrayBuffer(3),t=new DataView(e);return t.setUint8(0,G.MouseButton),t.setUint8(1,+this.down),t.setUint8(2,this.mouseButtonType),e},e.formMouseEvent=function(t,n){if(!te.has(t.button))throw new Error("[Event] unsupport button type");return new e(te.get(t.button),n)},e}(),ae=function(){function e(e,t){this.step=e,this.forward=t}return e.prototype.dumps=function(){P.EnableLog;var e=new ArrayBuffer(4),t=new DataView(e);return t.setUint8(0,G.WheelScroll),t.setUint8(1,+this.forward),t.setUint16(2,this.step),e},e.fromPinchZoom=function(t){return new e(Math.abs(t),1===Math.sign(t))},e.fromWheelEvent=function(t){var n=Math.abs(t.deltaX),i=Math.abs(t.deltaY),o=!!i,r=-1===Math.sign(o?t.deltaY:t.deltaX);return new e(o?Math.sign(i):Math.sign(n),r)},e.fromTouchDeltaY=function(t){return new e(1,t<0)},e}(),se=function(){function e(e,t,n,i,o,r,a,s){this.keycode=e,this.alt=t,this.shift=n,this.ctrl=i,this.nlock=o,this.clock=r,this.slock=a,this.down=s}return e.prototype.dumps=function(){P.EnableLog;var e=new ArrayBuffer(9),t=new DataView(e);return t.setUint8(0,G.Keyboard),t.setUint8(1,+this.down),t.setUint8(2,+this.nlock),t.setUint8(3,+this.clock),t.setUint8(4,+this.slock),t.setUint8(5,+this.shift),t.setUint8(6,+this.ctrl),t.setUint8(7,+this.alt),t.setUint8(8,+this.keycode),e},e.fromKeyboardEvent=function(t,n){return new e(t.keyCode,t.altKey,t.shiftKey,t.ctrlKey,t.getModifierState("NumLock"),t.getModifierState("CapsLock"),t.getModifierState("ScrollLock"),n)},e}(),ce=function(){function e(e,t){this.touchType=e,this.touchList=t}return e.prototype.dumps=function(){P.EnableLog;var e=new ArrayBuffer(4+8*this.touchList.length),t=new DataView(e);t.setUint8(0,G.WinTouch),t.setUint8(1,this.touchType),t.setUint16(2,this.touchList.length);var n=4;return this.touchList.forEach((function(e){t.setUint16(n,e.x),n+=2,t.setUint16(n,e.y),n+=2,t.setUint32(n,e.id),n+=4})),e},e}(),ue=function(){function e(e,t){this.id=e,this.success=t}return e.fromDataChannel=function(t){var n=new DataView(t);return new e(n.getUint16(1),!!n.getUint8(3))},e}(),he=function(){function e(e,t){void 0===t&&(t=!1),this.payload=e,this.reserve=t}return e.prototype.dumps=function(){P.EnableLog;var e=C(this.payload),t=new DataView(new ArrayBuffer(4+e.length));return t.setUint8(0,G.TextInput),t.setUint8(1,+this.reserve),t.setUint16(2,e.length),e.forEach((function(e,n){return t.setUint8(n+4,e)})),t.buffer},e}(),le=function(){function e(e,t,n,i,o,r,a,s,c){void 0===e&&(e=H.GamepadXbox),void 0===t&&(t=0),this.gamepadType=e,this.gamepadUser=t,this.buttons=n,this.leftTrigger=i,this.rightTrigger=o,this.leftThumbX=r,this.leftThumbY=a,this.rightThumbX=s,this.rightThumbY=c}return e.prototype.dumps=function(){var e=new DataView(new ArrayBuffer(16));return e.setUint8(0,G.Gamepad),e.setUint8(1,this.gamepadType),e.setUint16(2,this.gamepadUser),e.setUint16(4,this.buttons),e.setUint8(6,this.leftTrigger),e.setUint8(7,this.rightTrigger),e.setInt16(8,this.leftThumbX),e.setInt16(10,this.leftThumbY),e.setInt16(12,this.rightThumbX),e.setInt16(14,this.rightThumbY),e.buffer},e}(),de=function(){function e(e,t,n,i,o,r,a,s,c,u){void 0===e&&(e=BigInt((new Date).getTime())),void 0===t&&(t=0),void 0===n&&(n=0),void 0===i&&(i=0),void 0===o&&(o=1920),void 0===r&&(r=1080),void 0===a&&(a=0),void 0===s&&(s=F.BinaryPNG),void 0===c&&(c=j.Failure),void 0===u&&(u=new ArrayBuffer(0)),this.timestamp=e,this.index=t,this.left=n,this.top=i,this.width=o,this.height=r,this.size=a,this.format=s,this.result=c,this.payload=u}return e.prototype.dumps=function(){var e=new DataView(new ArrayBuffer(35));return e.setUint8(0,G.ScreenshotParams),e.setBigUint64(1,this.timestamp),e.setUint32(9,this.index),e.setUint32(13,this.left),e.setUint32(17,this.top),e.setUint32(21,this.width),e.setUint32(25,this.height),e.setUint32(29,0),e.setUint8(33,this.format),e.setUint8(34,this.result),e.buffer},e.parse=function(t){var n=new DataView(t);return new e(n.getBigUint64(1),n.getUint32(9),n.getUint32(13),n.getUint32(17),n.getUint32(21),n.getUint32(25),n.getUint32(29),n.getUint8(33),n.getUint8(34),t.slice(35))},e}();!function(e){e[e.Text=0]="Text",e[e.Image=1]="Image",e[e.QTText=2]="QTText",e[e.QTImage=3]="QTImage",e[e.unsupported=4]="unsupported"}($||($={})),function(e){e[e.None=0]="None",e[e.LZ4=1]="LZ4",e[e.ZLIB=2]="ZLIB",e[e.Unknow=3]="Unknow"}(ee||(ee={}));var fe,pe=function(){function e(e,t,n,i){void 0===t&&(t=0),void 0===n&&(n=$.Text),void 0===i&&(i=ee.None),this.payload=e,this.size=t,this.dataType=n,this.compressType=i}return e.prototype.dumps=function(){var e=C(this.payload),t=new DataView(new ArrayBuffer(7+e.length));return t.setUint8(0,G.ClipboardData),t.setUint32(1,e.length+2),t.setUint8(5,this.dataType),t.setUint8(6,this.compressType),e.forEach((function(e,n){return t.setUint8(n+7,e)})),t.buffer},e.parse=function(t){var n=new DataView(t),i=n.getUint32(1)-2,o=n.getUint8(5),r=n.getUint8(6),a="";return o===$.Text&&r===ee.None&&(a=L(t,7)),new e(a,i,o,r)},e}();!function(e){e[e.ActionDown=0]="ActionDown",e[e.ActionUp=1]="ActionUp",e[e.ActionMove=2]="ActionMove",e[e.ActionCancel=3]="ActionCancel",e[e.ActionPointerDown=5]="ActionPointerDown",e[e.ActionPointerUp=6]="ActionPointerUp"}(fe||(fe={}));var me,ve,ye=function(){function e(e,t,n,i){this.action=e,this.pointerId=t,this.x=n,this.y=i}return e.prototype.dumps=function(){var e=new DataView(new ArrayBuffer(17));return e.setUint8(0,G.MobileTouch),e.setInt32(1,this.action),e.setInt32(5,this.pointerId),e.setInt32(9,this.x),e.setInt32(13,this.y),e.buffer},e}();!function(e){e[e.ActionDown=0]="ActionDown",e[e.ActionUp=1]="ActionUp"}(me||(me={})),function(e){e[e.KeycodeHome=3]="KeycodeHome",e[e.KeycodeBack=4]="KeycodeBack",e[e.KeycodeAppSwitch=187]="KeycodeAppSwitch"}(ve||(ve={}));var be=function(){function e(e,t){this.action=e,this.keycode=t}return e.prototype.dumps=function(){var e=new DataView(new ArrayBuffer(3));return e.setUint8(0,G.MobileKeys),e.setUint8(1,this.action),e.setUint8(2,this.keycode),e.buffer},e}(),we=function(){function n(e,t,n,i,o,r,a){var s=this;void 0===n&&(n="all"),void 0===i&&(i=2e3),void 0===o&&(o=5e3),void 0===r&&(r=4e3),void 0===a&&(a=!0),this.url=e,this.iceServers=t,this.iceTransportPolicy=n,this.minBitrate=i,this.maxBitrate=o,this.startBitrate=r,this.enableAFK=a,this.event={connect:new q,afk:new q,open:new q,close:new q,queue:new q,ready:new q,endCandidate:new q,cursor:new q,disconnect:new q,receivedLink:new q,receivedVideo:new q,dataChannelConnected:new q,interaction:new q,occupy:new q,kick:new q,networkChanged:new q,echo:new q,screenshot:new q,screenshotData:new q,kickOut:new q,clientInfo:new q,clipboard:new q},this.token="",this.afk=new W,this.tan=new V,this.ready=!1,this.token=e.split("/").pop(),this.pc=new RTCPeerConnection({iceServers:t,iceTransportPolicy:n}),this.setupPeerConnection(),this.dc=this.pc.createDataChannel("sendChannel"),this.dc.binaryType="arraybuffer",this.setupDataChannel(),this.subject=h({url:e,closeObserver:{next:function(e){return s.event.close.emit(e)}},openObserver:{next:function(e){return s.event.open.emit(e)}}}),this.setupSigning()}return n.prototype.setupSigning=function(){var e=this;this.subject.subscribe({next:function(t){switch(t.action){case"connect":e.event.connect.emit(t);break;case"sdpOffer":e.pc.setRemoteDescription(new RTCSessionDescription(t.data)),e.pc.createAnswer().then((function(t){e.pc.setLocalDescription(t),e.subject.next({action:"sdpAnswer",data:t})}));break;case"candidate":e.pc.addIceCandidate(new RTCIceCandidate(t.data));break;case"sdpAnswer":e.pc.setRemoteDescription(new RTCSessionDescription(t.data));break;case"ready":e.ready||(e.ready=!0,e.linkStart(),e.event.ready.emit(t));break;case"queue":e.event.queue.emit(t.data.queueNum);break;case"peerDisconnected":e.event.disconnect.emit(t.message);break;case"operateOverTime":e.event.afk.emit(e.afk.idleTime);break;case"unready":try{e.subject.next({action:"verify",data:{token:e.token}})}catch(e){}break;case"hangUp":e.hangUp();break;case"occupy":e.event.occupy.emit("connection occupied!");break;case"kick":e.event.kick.emit(t.message),e.destory();break;case"clientInfo":e.event.clientInfo.emit(t.data)}},error:function(t){e.event.disconnect.emit(t)},complete:function(){}})},n.prototype.setupPeerConnection=function(){var e=this;this.pc.onicecandidate=function(t){t.candidate?e.subject.next({action:"candidate",data:t.candidate}):e.event.endCandidate.emit(t)},this.pc.ontrack=function(t){e.event.receivedVideo.emit(t.streams[0])},this.pc.oniceconnectionstatechange=function(){"disconnected"===e.pc.iceConnectionState&&e.event.networkChanged.emit(e.url)}},n.prototype.setupDataChannel=function(){var n=this,i=e(this.dc,"close");this.dc.onopen=function(e){t(3e4).pipe(l(i)).subscribe((function(e){return n.subject.next({action:"heartbeat"})})),n.enableAFK&&(n.afk.start(),t(P.AFKTimerGap).pipe(l(i)).subscribe((function(e){return n.subject.next({action:"afk",data:{idleTime:n.afk.idleTime}})}))),n.event.dataChannelConnected.emit(e)};var o=e(this.dc,"message").pipe(l(i),d((function(e){})),f((function(e){return e.data})),p());o.pipe(m((function(e){return S(e)===G.CursorData})),f((function(e){return K.parse(e)}))).subscribe((function(e){return n.event.cursor.emit(e)})),o.pipe(m((function(e){return S(e)===G.KickOutController})),f((function(e){return L(e,1)}))).subscribe((function(e){return n.event.kickOut.emit(e)})),o.pipe(m((function(e){return S(e)===G.URLIntercept})),f((function(e){return L(e,8)}))).subscribe((function(e){return n.event.receivedLink.emit(e)})),o.pipe(m((function(e){return S(e)===G.WebRTCForwardREQ})),f((function(e){return L(e,1)}))).subscribe((function(e){return n.event.interaction.emit(e)}));var r=o.pipe(m((function(e){return S(e)===G.ScreenshotParams})),f((function(e){return de.parse(e)})),p());r.subscribe((function(e){return n.event.screenshotData.emit(e.payload.byteLength)})),r.pipe(v(r.pipe(m((function(e){return e.result===j.Success})))),m((function(e){return 0!==e.length})),f((function(e){return e.map((function(e){return e.payload}))})),f((function(e){return new Blob(e,{type:"image/png"})}))).subscribe((function(e){return n.event.screenshot.emit(e)})),o.pipe(m((function(e){return S(e)===G.WebRTCForwardRSP})),f((function(e){return ue.fromDataChannel(e)}))).subscribe((function(e){return n.tan.trigger(e.id,e.success)})),o.pipe(m((function(e){return S(e)===G.ClipboardData})),f((function(e){return pe.parse(e)}))).subscribe((function(e){return n.event.clipboard.emit(e.payload)})),o.pipe(m((function(e){return[G.EchoData,G.EventDelay].includes(S(e))})),f((function(e){return ie.decode(e)}))).subscribe((function(e){var t=e.timestamp;return n.event.echo.emit(~~performance.now()-t)})),this.dc.onerror=function(e){},this.dc.onclose=function(e){}},n.prototype.linkStart=function(){var e=this;this.pc.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0}).then((function(t){e.pc.setLocalDescription(t),t.sdp=t.sdp.replace(/(a=fmtp:\d+ .*level-asymmetry-allowed=.*)\r\n/gm,"$1;x-google-start-bitrate=".concat(e.startBitrate,";x-google-max-bitrate=").concat(e.maxBitrate,";x-google-min-bitrate=").concat(e.minBitrate,"\r\n")),e.subject.next({action:"sdpOffer",data:t})}))},n.prototype.hangUp=function(){this.ready=!1,this.dc.close(),this.pc.close(),this.afk.clear(),this.pc=new RTCPeerConnection({iceServers:this.iceServers,iceTransportPolicy:this.iceTransportPolicy}),this.setupPeerConnection(),this.dc=this.pc.createDataChannel("sendChannel"),this.dc.binaryType="arraybuffer",this.setupDataChannel()},n.prototype.controlAuthority=function(e){return T(this,void 0,void 0,(function(){return M(this,(function(t){return this.subject.next({action:"controlAuthority",data:{token:e}}),[2]}))}))},n.prototype.changeBandwidth=function(e,t,n){n&&t?this.subject.next({action:"setBitrate",data:{min_bitrate:n,max_bitrate:t,cur_bitrate:e}}):this.subject.next({action:"setBitrate",data:{min_bitrate:e,max_bitrate:e,cur_bitrate:e}})},n.prototype.exit=function(){this.subject.closed||this.subject.next({action:"exit"})},n.prototype.emitUIInteraction=function(e){var t=new J,n=this.tan.order(t);return this.send(new ne(e,n).dumps()),t.promise},n.prototype.echo=function(){this.send(new ie(~~performance.now()).dumps())},n.prototype.screenshot=function(e){var t=void 0===e?{}:e,n=t.index,i=void 0===n?0:n,o=t.left,r=void 0===o?0:o,a=t.top,s=void 0===a?0:a,c=t.width,u=void 0===c?1920:c,h=t.height,l=void 0===h?1080:h;this.send(new de(void 0,i,r,s,u,l).dumps())},n.prototype.clipboard=function(e){this.send(new pe(e).dumps())},n.prototype.send=function(e,t){if(void 0===t&&(t=!1),"open"!==this.dc.readyState)throw new Error("send message before DataChannel open");this.enableAFK&&t&&this.afk.reset(),"string"==typeof e||e instanceof Blob||ArrayBuffer,this.dc.send(e)},n.prototype.destory=function(){this.dc.close(),this.pc.close(),this.afk.clear(),this.subject.unsubscribe(),Object.entries(this.event).forEach((function(e){return B(e,2)[1].offAll()}))},n}(),ge=function(){function e(e,t,n){var i=this;void 0===t&&(t=function(){}),void 0===n&&(n=!0),this.hostElement=e,this.canResize=!1,this.top=0,this.left=0,this.width=0,this.height=0,this.intervalID=NaN,this.onPlayHandler=[],this.resizePlayer=function(){i.canResize&&(i.hostElement.clientWidth<i.videoElement.videoWidth||i.hostElement.clientHeight<i.videoElement.videoHeight?i.resizePlayerStyleToFillWindow():i.resizePlayerStyleToActualSize())},this.onPlayHandler.push(t),this.overlayElement=document.createElement("div"),this.overlayElement.style.cssText="\n color: white;\n font-size: 1.8em;\n width: 100%;\n height: 100%;\n display: flex;\n position: absolute;\n background-color: rgba(51, 51, 51, 0.7);\n justify-content: center;\n align-items: center;\n ",this.playerElement=document.createElement("div"),this.playerElement.style.cssText="\n width: 100%;\n height: 100%;\n position: relative;\n background-color: black;\n ",this.videoElement=document.createElement("video"),this.videoElement.style.cssText="\n width: 100%;\n height: 100%;\n position: absolute;\n touch-action: none;\n ",this.videoElement.muted=!0,this.videoElement.playsInline=!0,this.videoElement.autoplay=!0,this.videoElement.addEventListener("loadedmetadata",(function(e){i.intervalID=window.setInterval((function(){i.isBlackScreen()||(i.canResize=!0,i.hidePlayOverlay(),i.resizePlayer(),window.clearInterval(i.intervalID),i.onPlayHandler.forEach((function(e){return e()})))}),500),i.videoElement.play().catch((function(){return i.showPlayOverlay()}))})),this.playerElement.appendChild(this.videoElement),this.playerElement.appendChild(this.overlayElement),e.appendChild(this.playerElement),new D(this.resizePlayer).observe(e);var o=this;n&&(document.body.addEventListener("mousedown",(function e(){o.videoElement.muted=!1,document.body.removeEventListener("mousedown",e)})),window.navigator.userAgent.indexOf("Chrome")>-1?document.body.addEventListener("touchend",(function e(){o.videoElement.muted=!1,document.body.removeEventListener("touchend",e)})):document.body.addEventListener("touchstart",(function e(){o.videoElement.muted=!1,document.body.removeEventListener("touchstart",e)})))}return Object.defineProperty(e.prototype,"videoAspectRatio",{get:function(){return this.videoElement.videoHeight/this.videoElement.videoWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hostAspectRatio",{get:function(){return this.hostElement.clientHeight/this.hostElement.clientWidth},enumerable:!1,configurable:!0}),e.prototype.registerOnPlay=function(e){this.onPlayHandler.push(e)},e.prototype.isBlackScreen=function(){var e,t=document.createElement("canvas"),n=t.getContext("2d");return t.width=this.videoElement.videoWidth/100,t.height=this.videoElement.videoHeight/100,n.drawImage(this.videoElement,0,0,t.width,t.height),!t.width||(null===(e=n.getImageData(0,0,t.width,t.height))||void 0===e?void 0:e.data).every((function(e){return 0===e||1===e||255===e}))},e.prototype.resizePlayerStyleToFillWindow=function(){this.videoAspectRatio?this.hostAspectRatio<this.videoAspectRatio?(this.height=this.hostElement.clientHeight,this.width=Math.floor(this.height/this.videoAspectRatio),this.left=Math.floor(.5*(this.hostElement.clientWidth-this.width)),this.top=0):(this.width=this.hostElement.clientWidth,this.height=Math.floor(this.width*this.videoAspectRatio),this.top=Math.floor(.5*(this.hostElement.clientHeight-this.height)),this.left=0):(this.width=this.hostElement.clientWidth,this.height=this.hostElement.clientHeight,this.top=0,this.left=0),this.applyStyleToPlayer()},e.prototype.resizePlayerStyleToActualSize=function(){this.width=this.videoElement.videoWidth,this.height=this.videoElement.videoHeight,this.top=Math.floor(.5*(this.hostElement.clientHeight-this.height)),this.left=Math.floor(.5*(this.hostElement.clientWidth-this.width)),this.applyStyleToPlayer()},e.prototype.applyStyleToPlayer=function(){this.playerElement.style.top="".concat(this.top,"px"),this.playerElement.style.left="".concat(this.left,"px"),this.playerElement.style.width="".concat(this.width,"px"),this.playerElement.style.height="".concat(this.height,"px")},e.prototype.destory=function(){var e;this.intervalID&&window.clearInterval(this.intervalID),this.playerElement.contains(this.videoElement)&&this.playerElement.removeChild(this.videoElement),this.playerElement.contains(this.overlayElement)&&this.playerElement.removeChild(this.overlayElement),null===(e=this.playerElement.parentNode)||void 0===e||e.removeChild(this.playerElement)},e.prototype.showTextOverlay=function(e){var t=document.createElement("div");t.innerHTML=e,this.setOverlay(t)},e.prototype.showPlayOverlay=function(){var e=this,t=document.createElement("img");t.id="play-button",t.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPEAAAD5CAYAAAD2mNNkAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMjHxIGmVAAASgklEQVR4Xu2dC7BdVX2HqUCCIRASCPjAFIQREBRBBSRYbFOt8lIrFUWRFqXWsT5wbItUqFWs0KqIMPKoYEWpRS06KDjS1BeVFkVQbCw+wCfiAwGhCKWP9PuZtU24uTe59zz22Y/vm/nGkXtz7jlrr9+sdfZea/03Wb169QtxGW62iYi0D8L7NbwYj8EdcdPyIxFpA4T2P/F/8Ua8CI/GhPnXyq+ISJMhrAlxxX9hRuYL8Sh8SPk1EWkqBHXdEFfcg6vw3fhs3Kb8uog0DQ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VwvshfCkuQ8Mr3YEO3dUQZ4nkD/HDmFKfe5SPLNIt6NxdDHHC+xF8BabsiSOvdBc6eJdCfBtehglvimz7rFe6Dx29CyHOQo0r8NWYOr0W2Zb+QIdva4izRDLPeldi6vSm1OfC8rFE+gMdv40hznu+GlMhfz/cEj0OR/oJnb9NIc57vQZPxCehI69ICUbTydnN1+LJmPAuKW9fRAhEk0OcZ73XYw6hOwg9v1lkKgSjqSHO5oRT8TdwKbq+WWQ6CEeTQpw7zlmocTqmTm/Ob7bomMiGICRNCHGmzT/BszClPjPyuspKZDYQlkmH+Mf4t7gct0enzSJzgdBMKsQJ70X4VHTkFRkUwlN3iFM54YN4KG6LHkQnMgyEqK4Q51nvpZjwZuQ1vCKjgDDVEeIr8XBMeL3bLDJKCNW4QpyR9zo8ArdBb1iJjAPCNeoQJ7ypFngszkc3JoiME0I2qhDnWW8Kjv0xujFBpC4I3DAhzgqrHESXUp/Z0/uQ8rIiUhcEb5AQJ7z34TfwJNy5vJyI1A0BnG2IE9yYsiffwTfizuh3XpFJQghnE+J83014v4upkL8r+qhIpAkQxg2FOOHNzzNtPhf3REdekSZRQjqVTJtzguSNeD4eWH5dRJoGAZ0a4rvxm3ghrkCnzSJNhpBWIc7/plpgwpudRZ7dLNIGCOvtJbwX42G4uPxIRNoAoU2d3iNxUflPItIaNtnk/wEGBoMdpECGHAAAAABJRU5ErkJggg==",t.alt="Start Streaming",this.setOverlay(t,(function(){e.hidePlayOverlay()}))},e.prototype.hidePlayOverlay=function(){this.clearOverlay(),this.overlayElement.style.display="none"},e.prototype.clearOverlay=function(){for(;this.overlayElement.lastChild;)this.overlayElement.removeChild(this.overlayElement.lastChild)},e.prototype.setOverlay=function(e,t){if(this.clearOverlay(),this.overlayElement.appendChild(e),this.overlayElement.style.display="flex",t){var n=this;this.overlayElement.addEventListener("click",(function e(i){t(i),n.overlayElement.removeEventListener("click",e)}))}},e}(),ke=function(){function a(){}return a.createDefaultEventStream=function(t,r){t.addEventListener("contextmenu",(function(e){return e.preventDefault()}));var a=e(t,"mousedown").pipe(d((function(e){return e.preventDefault()})),f((function(e){return re.formMouseEvent(e,!0).dumps()}))),s=e(t,"mouseup").pipe(d((function(e){return e.preventDefault()})),f((function(e){return re.formMouseEvent(e,!1).dumps()}))),c=e(t,"mousemove").pipe(d((function(e){return e.preventDefault()})),f((function(e){return A(e,r.mouseNormalizeType===G.MouseMoveStandardization)})),f((function(e){var t=e.x,n=e.y,i=e.dx,o=e.dy;return new oe(t,n,i,o,r.mouseMoveType,r.mouseNormalizeType).dumps()}))),u=e(t,"mouseleave").pipe(f(z),f((function(e){return A(e,r.mouseNormalizeType===G.MouseMoveStandardization)})),f((function(e){var t=e.x,n=e.y,i=e.dx,o=e.dy;return new oe(t,n,i,o,r.mouseMoveType,r.mouseNormalizeType).dumps()}))),h=e(t,"wheel",{passive:!1}).pipe(d((function(e){return e.preventDefault()})),f((function(e){return ae.fromWheelEvent(e).dumps()})));function p(e,t){var n=t===Q.TouchUpdate?"touches":"changedTouches";return new ce(t,function(e,t){var n=e.target,i=n.videoWidth,o=n.videoHeight,r=n.clientHeight,a=n.clientWidth,s=n.getBoundingClientRect(),c=s.left,u=s.top;return t.map((function(e){var t=e.clientX,n=e.clientY;return{x:i/a*(t-c),y:o/r*(n-u),id:e.identifier}}))}(e,Array.from(e[n]))).dumps()}var v=e(t,"touchend"),E=e(t,"touchmove",{passive:!1}),D=e(t,"touchstart",{passive:!1}),T=e(t,"touchcancel");return{wheelStream:h,mouseupStream:s,mousedownStream:a,mousemoveStream:c,zoomStream:E.pipe(d((function(e){return e.preventDefault()})),l(n(v,T)),y(100),m((function(e){return 2===e.targetTouches.length})),b(),f(I),f((function(e){return ae.fromPinchZoom(e/10).dumps()})),w()),startBufferStream:i((function(){return r.fakeMouseWithTouch}),D.pipe(d((function(e){return e.preventDefault()})),g((function(e){return o((t=A({target:e.target,clientX:e.targetTouches[0].clientX,clientY:e.targetTouches[0].clientY,movementX:0,movementY:0},r.mouseNormalizeType===G.MouseMoveStandardization),n=t.x,i=t.y,a=t.dx,s=t.dy,new oe(n,i,a,s,r.mouseMoveType,r.mouseNormalizeType).dumps()),new re(3===e.targetTouches.length?O.ButtonMiddle:r.fakeTouchType,!0).dumps());var t,n,i,a,s}))),D.pipe(d((function(e){return e.preventDefault()})),f((function(e){return p(e,Q.TouchDown)})))),moveBufferStream:i((function(){return r.fakeMouseWithTouch}),E.pipe(d((function(e){return e.preventDefault()})),l(n(v,T)),m((function(e){return 1===e.targetTouches.length||3===e.targetTouches.length})),b(),f(X),f((function(e){return function(e,t,n){var i=e.movementX,o=e.movementY;return x(x({},e),{movementX:i*t,movementY:o*n})}(e,r.touchDeltaXSensitivity,r.touchDeltaYSensitivity)})),f((function(e){return A(e,r.mouseNormalizeType===G.MouseMoveStandardization)})),f((function(e){var t=e.x,n=e.y,i=e.dx,o=e.dy;return new oe(t,n,i,o,r.mouseMoveType,r.mouseNormalizeType).dumps()})),w()),E.pipe(d((function(e){return e.preventDefault()})),f((function(e){return p(e,Q.TouchUpdate)})))),endBufferStream:i((function(){return r.fakeMouseWithTouch}),n(v,T).pipe(d((function(e){return e.preventDefault()})),k(new re(r.fakeTouchType,!1).dumps())),n(v,T).pipe(d((function(e){return e.preventDefault()})),f((function(e){return p(e,Q.TouchUp)})))),leaveStream:u}},a.createGamepadStream=function(){return t(0,r).pipe(f((function(e){return navigator.getGamepads()[0]})),m((function(e){return!!e})),f((function(e){var t=B(e.axes.map((function(e){return 32767*e})),4),n=t[0],i=t[1],o=t[2],r=t[3],a=255*e.buttons[6].value,s=255*e.buttons[7].value;return new le(H.GamepadXbox,0,0,a,s,n,-i,o,-r).dumps()})))},a.createClipboardStream=function(t){return e(t,"focus").pipe(E((function(){return new Promise((function(e){return navigator.clipboard.readText().then(e).catch((function(){return e("")}))}))})),f((function(e){return new pe(e).dumps()})))},a.createKeyboardStream=function(t){t.tabIndex=-1;var n=function(){return t.focus()};return t.addEventListener("touchstart",n,{passive:!0}),t.addEventListener("mouseenter",n),t.addEventListener("click",n),{keydownStream:e(t,"keydown").pipe(d((function(e){return e.preventDefault()})),f((function(e){return se.fromKeyboardEvent(e,!0).dumps()}))),keyupStream:e(t,"keyup").pipe(d((function(e){return e.preventDefault()})),f((function(e){return se.fromKeyboardEvent(e,!1).dumps()})))}},a.createMobileStreamFromMouse=function(t){var i=e(t,"mouseup").pipe(f((function(e){var t=A(e,!0),n=t.x,i=t.y;return new ye(fe.ActionUp,0,n,i).dumps()}))),o=e(t,"mousemove").pipe(f((function(e){var t=A(e,!0),n=t.x,i=t.y;return new ye(fe.ActionMove,0,n,i).dumps()}))),r=e(t,"mousedown").pipe(f((function(e){var t=A(e,!0),n=t.x,i=t.y;return new ye(fe.ActionDown,0,n,i).dumps()})));return n(r,o,i)},a.attachMobileListener=function(t,n){return this.createMobileStreamFromMouse(t).pipe(l(e(n.dc,"close"))).subscribe((function(e){return n.send(e,!0)}))},a.attachListener=function(t,i,o,r){var a=void 0===r?{}:r,s=a.enableClipboard,c=void 0!==s&&s,u=a.enableGamepad,h=void 0!==u&&u,d=this.createDefaultEventStream(t,i),f=d.wheelStream,p=d.mouseupStream,m=d.mousedownStream,v=d.mousemoveStream,y=d.zoomStream,b=d.startBufferStream,w=d.moveBufferStream,g=d.endBufferStream,k=d.leaveStream,E=this.createKeyboardStream(t),D=E.keyupStream,x=E.keydownStream,T=n(f,x,D,p,m,v,y,b,w,g,k);return c&&(T=n(T,this.createClipboardStream(t))),h&&(T=n(T,this.createGamepadStream())),T.pipe(l(e(o.dc,"close"))).subscribe((function(e){return o.send(e,!0)}))},a}(),Ee=function(e,t,n,i,o,r){void 0===e&&(e=G.MouseMoveStandardization),void 0===t&&(t=Z.Passive),void 0===n&&(n=O.ButtonLeft),void 0===i&&(i=!0),void 0===o&&(o=1),void 0===r&&(r=1),this.mouseNormalizeType=e,this.mouseMoveType=t,this.fakeTouchType=n,this.fakeMouseWithTouch=i,this.touchDeltaXSensitivity=o,this.touchDeltaYSensitivity=r},De=function(){function e(){var e=this;this.latency=0,this.averageJitterBufferDelay=0,this.bytesReceivedPerMillisecond=0,this.headerBytesReceivedPerMillisecond=0,this.packetsLost=0,this.packetsReceived=0,this.framesReceived=0,this.framesDecoded=0,this.keyFramesDecoded=0,this.framesDropped=0,this.framesPerSecond=0,this.handleLatency=function(t){return e.latency=t}}return Object.defineProperty(e.prototype,"bitrate",{get:function(){return 8*(this.bytesReceivedPerMillisecond+this.headerBytesReceivedPerMillisecond)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"packetLossRate",{get:function(){return this.packetsReceived?this.packetsLost/(this.packetsLost+this.packetsReceived):0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"running",{get:function(){return!!this.statSub&&!!this.echoSub&&!!this.dispose},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasOffered",{get:function(){return!!this.connection},enumerable:!1,configurable:!0}),e.prototype.offer=function(e){this.connection=e,this.running&&this.scan()},e.prototype.scan=function(){var e,n=this;if(!this.connection)throw new Error("gather statistics before provide connection");var i=this.connection;null===(e=this.statSub)||void 0===e||e.unsubscribe(),this.echoSub&&(this.echoSub.unsubscribe(),this.connection.event.echo.off(this.handleLatency)),this.dispose=this.connection.event.echo.on(this.handleLatency).dispose,this.echoSub=t(1e3).subscribe((function(){return"open"===i.dc.readyState&&i.echo()})),this.statSub=t(1e3).pipe(a((function(){return s(i.pc.getStats())})),c((function(e){return function(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}([],B(e.values()),!1).find((function(e){return"inbound-rtp"===e.type&&"video"===e.kind}))})),u(),c((function(e){var t,n,i,o,r,a,s,c=B(e,2),u=c[0],h=c[1];if(u&&h){var l=h.timestamp-u.timestamp,d=~~(1e3*(h.jitterBufferDelay-u.jitterBufferDelay)/(h.jitterBufferEmittedCount-u.jitterBufferEmittedCount));return{bytesReceivedPerMillisecond:~~((h.bytesReceived-u.bytesReceived)/l),headerBytesReceivedPerMillisecond:~~((h.headerBytesReceived-u.headerBytesReceived)/l),averageJitterBufferDelay:d,packetsLost:null!==(t=h.packetsLost)&&void 0!==t?t:0,packetsReceived:null!==(n=h.packetsReceived)&&void 0!==n?n:0,framesReceived:null!==(i=h.framesReceived)&&void 0!==i?i:0,framesDecoded:null!==(o=h.framesDecoded)&&void 0!==o?o:0,keyFramesDecoded:null!==(r=h.keyFramesDecoded)&&void 0!==r?r:0,framesDropped:null!==(a=h.framesDropped)&&void 0!==a?a:0,framesPerSecond:null!==(s=h.framesPerSecond)&&void 0!==s?s:0}}return{bytesReceivedPerMillisecond:0,headerBytesReceivedPerMillisecond:0,averageJitterBufferDelay:0,packetsLost:0,packetsReceived:0,framesReceived:0,framesDecoded:0,keyFramesDecoded:0,framesDropped:0,framesPerSecond:0}}))).subscribe((function(e){var t=e.headerBytesReceivedPerMillisecond,i=e.bytesReceivedPerMillisecond,o=e.averageJitterBufferDelay,r=e.packetsLost,a=e.packetsReceived,s=e.framesReceived,c=e.framesDecoded,u=e.keyFramesDecoded,h=e.framesDropped,l=e.framesPerSecond;n.bytesReceivedPerMillisecond=i,n.headerBytesReceivedPerMillisecond=t,n.packetsLost=r,n.packetsReceived=a,n.framesReceived=s,n.framesDecoded=c,n.keyFramesDecoded=u,n.framesDropped=h,n.framesPerSecond=l,n.averageJitterBufferDelay=o}))},e.prototype.report=function(){var e=this,t=e.latency,n=e.packetLossRate,i=e.bitrate,o=e.averageJitterBufferDelay,r=e.framesReceived,a=e.framesDecoded,s=e.keyFramesDecoded,c=e.framesDropped;return{fps:e.framesPerSecond,latency:t,bitrate:i,packetLossRate:n,averageJitterBufferDelay:o,framesReceived:r,framesDecoded:a,keyFramesDecoded:s,framesDropped:c}},e.prototype.toggle=function(){this.running?this.stop():this.scan()},e.prototype.stop=function(){var e,t;this.bytesReceivedPerMillisecond=0,this.headerBytesReceivedPerMillisecond=0,this.averageJitterBufferDelay=0,this.latency=0,this.packetsLost=0,this.packetsReceived=0,this.framesReceived=0,this.framesDecoded=0,this.keyFramesDecoded=0,this.framesDropped=0,this.framesPerSecond=0,null===(e=this.statSub)||void 0===e||e.unsubscribe(),this.statSub=void 0,null===(t=this.echoSub)||void 0===t||t.unsubscribe(),this.echoSub=void 0,this.dispose&&this.dispose(),this.dispose=void 0},e}();export{pe as ClipboardData,we as Connection,ie as EventData,G as EventType,le as Gamepad,H as GamepadType,N as GamepadXboxButton,ke as Helper,j as ImageResultValue,F as ImageStoreFormat,se as Keyboard,be as MobileKeys,me as MobileKeysActionType,ve as MobileKeysKeycode,ye as MobileTouch,fe as MobileTouchActionType,re as MouseButton,O as MouseButtonType,oe as MouseMove,Z as MoveType,ge as Player,_ as PointerManager,De as Rivatuner,Ee as RunningState,de as Screenshot,he as TextInput,ce as TouchSet,Q as TouchType,ne as UIInteraction,ue as UIInteractionResponse,ae as WheelScroll,Y as screenfull};
***************************************************************************** */var x=function(){return x=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},x.apply(this,arguments)};function T(e,t,n,i){return new(n||(n=Promise))((function(o,r){function a(e){try{c(i.next(e))}catch(e){r(e)}}function s(e){try{c(i.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))}function M(e,t){var n,i,o,r,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(r){return function(s){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(o=2&r[0]?i.return:r[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,r[1])).done)return o;switch(i=0,o&&(r=[2&r[0],o.value]),r[0]){case 0:case 1:o=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,i=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]<o[3])){a.label=r[1];break}if(6===r[0]&&a.label<o[1]){a.label=o[1],o=r;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(r);break}o[2]&&a.ops.pop(),a.trys.pop();continue}r=t.call(e,a)}catch(e){r=[6,e],i=0}finally{n=o=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,s])}}}function B(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}var P=Object.freeze({EnableLog:!1,AFKTimerGap:1e4});var S=function(e){return new DataView(e).getUint8(0)};function L(e,t,n){void 0===t&&(t=1),void 0===n&&(n="");var i,o=new DataView(e);return(i=e.byteLength-t,Object.keys(Array.from({length:i})).map((function(e){return Number(e)}))).map((function(e){return String.fromCharCode(o.getUint8(e+t))})).join(n)}function C(e){for(var t,n=new Array,i=0;i<e.length;i++)(t=e.charCodeAt(i))>=65536&&t<=1114111?(n.push(t>>18&7|240),n.push(t>>12&63|128),n.push(t>>6&63|128),n.push(63&t|128)):t>=2048&&t<=65535?(n.push(t>>12&15|224),n.push(t>>6&63|128),n.push(63&t|128)):t>=128&&t<=2047?(n.push(t>>6&31|192),n.push(63&t|128)):n.push(255&t);return n}function A(e,t){void 0===t&&(t=!1);var n=e.target,i=n.getBoundingClientRect(),o=i.left,r=i.top,a=e.clientX,s=e.clientY,c=e.movementY,u=e.movementX,h=n.clientHeight,l=n.clientWidth,d=n.videoHeight,f=n.videoWidth;return{x:Math.min(Math.max(a-o,0),l)*((t?f:65535)/l),y:Math.min(Math.max(s-r,0),h)*((t?d:65535)/h),dx:u*((t?f:32767)/l),dy:c*((t?d:32767)/h)}}var R=function(){function e(e,t){this.x=e,this.y=t}return e.fromTouch=function(t){return new e(t.pageX,t.pageY)},e}();function U(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function I(e){var t=B(Array.from(e[0].targetTouches),2),n=t[0],i=t[1],o=B(Array.from(e[1].targetTouches),2),r=o[0],a=o[1];return U(R.fromTouch(r),R.fromTouch(a))-U(R.fromTouch(n),R.fromTouch(i))}function X(e){var t=B(e,2),n=t[0],i=t[1],o=i.targetTouches[0].clientX-n.targetTouches[0].clientX,r=i.targetTouches[0].clientY-n.targetTouches[0].clientY;return{target:n.target,clientX:n.targetTouches[0].clientX,clientY:n.targetTouches[0].clientY,movementX:o,movementY:r}}function z(e){var t=e.target.getBoundingClientRect(),n=t.left,i=t.top,o=t.right,r=t.bottom,a=e.clientY,s=e.clientX,c=Math.abs(i-a),u=Math.abs(r-a),h=Math.abs(n-s),l=Math.abs(o-s);switch(Math.min(c,u,h,l)){case h:return{target:e.target,clientX:0,clientY:a,movementY:0,movementX:0};case c:return{target:e.target,clientX:s,clientY:0,movementY:0,movementX:0};default:return{target:e.target,clientX:s,clientY:a,movementY:0,movementX:0}}}var G,j,F,O,Q,Z,H,N,Y=new(function(){function e(){this.APINameMap="exitFullscreen"in document?{requestFullscreen:"requestFullscreen",exitFullscreen:"exitFullscreen",fullscreenElement:"fullscreenElement",fullscreenEnabled:"fullscreenEnabled",fullscreenchange:"fullscreenchange"}:"webkitExitFullscreen"in document?{requestFullscreen:"webkitRequestFullscreen",exitFullscreen:"webkitExitFullscreen",fullscreenElement:"webkitFullscreenElement",fullscreenEnabled:"webkitFullscreenEnabled",fullscreenchange:"webkitfullscreenchange"}:{requestFullscreen:"mozRequestFullScreen",exitFullscreen:"mozCancelFullScreen",fullscreenElement:"mozFullScreenElement",fullscreenEnabled:"mozFullScreenEnabled",fullscreenchange:"mozfullscreenchange"}}return Object.defineProperty(e.prototype,"isFullscreen",{get:function(){return Boolean(document[this.APINameMap.fullscreenElement])},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"element",{get:function(){return document[this.APINameMap.fullscreenElement]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEnabled",{get:function(){return Boolean(document[this.APINameMap.fullscreenEnabled])},enumerable:!1,configurable:!0}),e.prototype.request=function(e,t){var n=this;return new Promise((function(i,o){var r=function(){screen.orientation.lock("landscape-primary"),document.removeEventListener(n.APINameMap.fullscreenchange,r),n.off(r),"keyboard"in navigator&&"lock"in navigator.keyboard&&navigator.keyboard.lock(["KeyW","Escape","KeyN","KeyT","MetaLeft"]),i()};n.on(r);var a=(e||document.documentElement)[n.APINameMap.requestFullscreen](t);a instanceof Promise&&a.then(r).catch(o)}))},e.prototype.exit=function(){var e=this;return new Promise((function(t,n){if(e.isFullscreen){var i=function(){e.off(i),t()};e.on(i);var o=document[e.APINameMap.exitFullscreen]();o instanceof Promise&&o.then(i).catch(n)}else t()}))},e.prototype.toggle=function(e,t){return this.isFullscreen?this.exit():this.request(e,t)},e.prototype.on=function(e){document.addEventListener(this.APINameMap.fullscreenchange,e)},e.prototype.off=function(e){document.removeEventListener(this.APINameMap.fullscreenchange,e)},e}()),W=function(){function e(){this.timer=NaN,this.idleTime=0}return e.prototype.reset=function(){this.idleTime=0},e.prototype.start=function(){var e=this;this.timer=window.setInterval((function(){e.idleTime+=1e3}),1e3)},e.prototype.clear=function(){window.clearInterval(this.timer)},e}(),J=function(){var e=this;this.promise=new Promise((function(t,n){e.resolve=t,e.reject=n}))},K=function(){function e(e,t,n,i){void 0===e&&(e=""),void 0===t&&(t=!0),void 0===n&&(n=0),void 0===i&&(i=0),this.base64=e,this.show=t,this.x=n,this.y=i}return e.parse=function(t){var n=new DataView(t),i=n.getUint32(1),o=n.getUint32(5),r=n.getUint32(9),a=n.getUint32(13),s=n.getUint32(17),c=n.getUint32(21),u=n.getUint8(32);if(0===r||0===a)return new e("",!!u,-i,-o);if(1===s&&4===c)return new e("",!!u,-i,-o);var h=document.createElement("canvas"),l=h.getContext("2d");h.width=r,h.height=a;var d=l.createImageData(r,a),f=d.data;f.set(new Uint8ClampedArray(t,34));for(var p=0;p<f.length;p+=4){var m=f[p];f[p]=f[p+2],f[p+2]=m}return l.putImageData(d,0,0),new e(h.toDataURL(),!!u,i,o)},e}(),q=function(){var e=this;this.listeners=[],this.listenersOncer=[],this.on=function(t){return e.listeners.push(t),{dispose:function(){return e.off(t)}}},this.once=function(t){e.listenersOncer.push(t)},this.off=function(t){var n=e.listeners.indexOf(t);n>-1&&e.listeners.splice(n,1)},this.offAll=function(){e.listenersOncer=[],e.listeners=[]},this.emit=function(t){e.listeners.forEach((function(e){return e(t)})),e.listenersOncer.forEach((function(e){return e(t)})),e.listenersOncer=[]},this.pipe=function(t){return e.on((function(e){return t.emit(e)}))}},V=function(){function e(){this.currentID=0,this.executeMap=new Map}return e.prototype.obtainID=function(){return this.currentID>=65535?this.currentID=0:++this.currentID},e.prototype.trigger=function(e,t){this.executeMap.has(e)&&(this.executeMap.get(e).resolve(t),this.executeMap.delete(e))},e.prototype.order=function(e){var t=this.obtainID();return this.executeMap.set(t,e),t},e}(),_=function(){function e(e,t){var n=this;void 0===t&&(t=function(){}),this.target=e,this.onExit=t,this.cursor=new K,this.handleVisibilityChange=function(){"visible"!==document.visibilityState||n.cursor.show||n.target.requestPointerLock()},this.handlePointerLockError=function(){document.addEventListener("click",(function(){n.cursor.show||n.target.requestPointerLock()}),{once:!0})},this.handlePointerLockChange=function(){n.isPointerLocking||n.cursor.show||Y.isFullscreen||n.onExit()},e.requestPointerLock=e.requestPointerLock||e.mozRequestPointerLock||e.webkitRequestPointerLock,document.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock,document.addEventListener("pointerlockchange",this.handlePointerLockChange),document.addEventListener("pointerlockerror",this.handlePointerLockError),document.addEventListener("visibilitychange",this.handleVisibilityChange)}return e.prototype.destory=function(){this.target.style.cursor="default",document.removeEventListener("pointerlockerror",this.handlePointerLockChange),document.removeEventListener("pointerlockchange",this.handlePointerLockError),document.removeEventListener("visibilitychange",this.handleVisibilityChange)},e.prototype.setCursor=function(e){var t=this;if(this.cursor=e,e.show?document.exitPointerLock():this.target.requestPointerLock(),e.base64){var n=document.createElement("img");n.src=e.base64,n.onload=function(){if(n.width>32||n.height>32){var i=function(e){var t=document.createElement("canvas"),n=e.width>32?32:e.width,i=e.height>32?32:e.height;t.width=n,t.height=i;var o=t.getContext("2d");return null==o||o.drawImage(e,0,0,n,i),t.toDataURL()}(n);t.target.style.cursor="url(".concat(i,") ").concat(e.x," ").concat(e.y,", auto")}else t.target.style.cursor="url(".concat(e.base64,") ").concat(e.x," ").concat(e.y,", auto")}}else this.target.style.cursor="none"},Object.defineProperty(e.prototype,"isPointerLocking",{get:function(){return(document.pointerLockElement||document.mozPointerLockElement||document.webkitPointerLockElement)===this.target},enumerable:!1,configurable:!0}),e}();!function(e){e[e.MouseMoveStandardization=0]="MouseMoveStandardization",e[e.MouseButton=1]="MouseButton",e[e.WheelScroll=2]="WheelScroll",e[e.Keyboard=3]="Keyboard",e[e.WinTouch=4]="WinTouch",e[e.MobileTouch=5]="MobileTouch",e[e.MobileCustom=6]="MobileCustom",e[e.URLIntercept=7]="URLIntercept",e[e.CaretVisible=8]="CaretVisible",e[e.TextInput=9]="TextInput",e[e.MobileKeys=10]="MobileKeys",e[e.Gamepad=11]="Gamepad",e[e.CursorData=12]="CursorData",e[e.MouseMoveNormalization=13]="MouseMoveNormalization",e[e.EventDelay=14]="EventDelay",e[e.EchoData=15]="EchoData",e[e.KickOutController=16]="KickOutController",e[e.ScreenshotParams=17]="ScreenshotParams",e[e.ClipboardData=18]="ClipboardData",e[e.WebRTCPluginsMSG=125]="WebRTCPluginsMSG",e[e.WebRTCForwardRSP=126]="WebRTCForwardRSP",e[e.WebRTCForwardREQ=127]="WebRTCForwardREQ"}(G||(G={})),function(e){e[e.Failure=0]="Failure",e[e.Success=1]="Success",e[e.Portion=2]="Portion"}(j||(j={})),function(e){e[e.Clipboard=0]="Clipboard",e[e.FileBMP=1]="FileBMP",e[e.FilePNG=2]="FilePNG",e[e.BinaryBMP=3]="BinaryBMP",e[e.BinaryPNG=4]="BinaryPNG"}(F||(F={})),function(e){e[e.ButtonLeft=1]="ButtonLeft",e[e.ButtonMiddle=2]="ButtonMiddle",e[e.ButtonRight=3]="ButtonRight",e[e.ButtonX1=4]="ButtonX1",e[e.ButtonX2=5]="ButtonX2"}(O||(O={})),function(e){e[e.TouchDown=0]="TouchDown",e[e.TouchUpdate=1]="TouchUpdate",e[e.TouchUp=2]="TouchUp"}(Q||(Q={})),function(e){e[e.Absolute=0]="Absolute",e[e.Relative=1]="Relative",e[e.Passive=2]="Passive",e[e.Unknow=3]="Unknow"}(Z||(Z={})),function(e){e[e.GamepadXbox=0]="GamepadXbox"}(H||(H={})),function(e){e[e.GamepadXboxButtonDpadUp=1]="GamepadXboxButtonDpadUp",e[e.GamepadXboxButtonDpadDown=2]="GamepadXboxButtonDpadDown",e[e.GamepadXboxButtonDpadLeft=4]="GamepadXboxButtonDpadLeft",e[e.GamepadXboxButtonDpadRight=8]="GamepadXboxButtonDpadRight",e[e.GamepadXboxButtonStart=16]="GamepadXboxButtonStart",e[e.GamepadXboxButtonBack=32]="GamepadXboxButtonBack",e[e.GamepadXboxButtonLeftThumb=64]="GamepadXboxButtonLeftThumb",e[e.GamepadXboxButtonRightThumb=128]="GamepadXboxButtonRightThumb",e[e.GamepadXboxButtonLeftShoulder=256]="GamepadXboxButtonLeftShoulder",e[e.GamepadXboxButtonRightShoulder=512]="GamepadXboxButtonRightShoulder",e[e.GamepadXboxButtonA=4096]="GamepadXboxButtonA",e[e.GamepadXboxButtonB=8192]="GamepadXboxButtonB",e[e.GamepadXboxButtonX=16384]="GamepadXboxButtonX",e[e.GamepadXboxButtonY=32768]="GamepadXboxButtonY"}(N||(N={}));var $,ee,te=new Map([[0,O.ButtonLeft],[1,O.ButtonMiddle],[2,O.ButtonRight],[3,O.ButtonX1],[4,O.ButtonX2]]),ne=function(){function e(e,t){void 0===t&&(t=0),this.data=e,this.id=t}return e.prototype.dumps=function(){var e=new DataView(new ArrayBuffer(3+this.data.length)),t=0;e.setUint8(t,G.WebRTCForwardREQ),t++,e.setUint16(t,this.id),t+=2;for(var n=0;n<this.data.length;n++)e.setUint8(t,this.data.charCodeAt(n)),t+=1;return e.buffer},e}(),ie=function(){function e(e){this.timestamp=e}return e.prototype.dumps=function(){var e=new DataView(new ArrayBuffer(5));return e.setUint8(0,G.EchoData),e.setUint32(1,this.timestamp),e.buffer},e.decode=function(t){return new e(new DataView(t).getUint32(1))},e}(),oe=function(){function e(e,t,n,i,o,r){void 0===o&&(o=Z.Passive),void 0===r&&(r=G.MouseMoveStandardization),this.x=e,this.y=t,this.dx=n,this.dy=i,this.move=o,this.eventType=r}return e.prototype.dumps=function(){P.EnableLog;var e=new ArrayBuffer(10),t=new DataView(e);return t.setUint8(0,this.eventType),t.setUint8(1,+this.move),t.setUint16(2,this.x),t.setUint16(4,this.y),t.setUint16(6,this.dx),t.setUint16(8,this.dy),e},e}(),re=function(){function e(e,t){this.mouseButtonType=e,this.down=t}return e.prototype.dumps=function(){P.EnableLog;var e=new ArrayBuffer(3),t=new DataView(e);return t.setUint8(0,G.MouseButton),t.setUint8(1,+this.down),t.setUint8(2,this.mouseButtonType),e},e.formMouseEvent=function(t,n){if(!te.has(t.button))throw new Error("[Event] unsupport button type");return new e(te.get(t.button),n)},e}(),ae=function(){function e(e,t){this.step=e,this.forward=t}return e.prototype.dumps=function(){P.EnableLog;var e=new ArrayBuffer(4),t=new DataView(e);return t.setUint8(0,G.WheelScroll),t.setUint8(1,+this.forward),t.setUint16(2,this.step),e},e.fromPinchZoom=function(t){return new e(Math.abs(t),1===Math.sign(t))},e.fromWheelEvent=function(t){var n=Math.abs(t.deltaX),i=Math.abs(t.deltaY),o=!!i,r=-1===Math.sign(o?t.deltaY:t.deltaX);return new e(o?Math.sign(i):Math.sign(n),r)},e.fromTouchDeltaY=function(t){return new e(1,t<0)},e}(),se=function(){function e(e,t,n,i,o,r,a,s){this.keycode=e,this.alt=t,this.shift=n,this.ctrl=i,this.nlock=o,this.clock=r,this.slock=a,this.down=s}return e.prototype.dumps=function(){P.EnableLog;var e=new ArrayBuffer(9),t=new DataView(e);return t.setUint8(0,G.Keyboard),t.setUint8(1,+this.down),t.setUint8(2,+this.nlock),t.setUint8(3,+this.clock),t.setUint8(4,+this.slock),t.setUint8(5,+this.shift),t.setUint8(6,+this.ctrl),t.setUint8(7,+this.alt),t.setUint8(8,+this.keycode),e},e.fromKeyboardEvent=function(t,n){return new e(t.keyCode,t.altKey,t.shiftKey,t.ctrlKey,t.getModifierState("NumLock"),t.getModifierState("CapsLock"),t.getModifierState("ScrollLock"),n)},e}(),ce=function(){function e(e,t){this.touchType=e,this.touchList=t}return e.prototype.dumps=function(){P.EnableLog;var e=new ArrayBuffer(4+8*this.touchList.length),t=new DataView(e);t.setUint8(0,G.WinTouch),t.setUint8(1,this.touchType),t.setUint16(2,this.touchList.length);var n=4;return this.touchList.forEach((function(e){t.setUint16(n,e.x),n+=2,t.setUint16(n,e.y),n+=2,t.setUint32(n,e.id),n+=4})),e},e}(),ue=function(){function e(e,t){this.id=e,this.success=t}return e.fromDataChannel=function(t){var n=new DataView(t);return new e(n.getUint16(1),!!n.getUint8(3))},e}(),he=function(){function e(e,t){void 0===t&&(t=!1),this.payload=e,this.reserve=t}return e.prototype.dumps=function(){P.EnableLog;var e=C(this.payload),t=new DataView(new ArrayBuffer(4+e.length));return t.setUint8(0,G.TextInput),t.setUint8(1,+this.reserve),t.setUint16(2,e.length),e.forEach((function(e,n){return t.setUint8(n+4,e)})),t.buffer},e}(),le=function(){function e(e,t,n,i,o,r,a,s,c){void 0===e&&(e=H.GamepadXbox),void 0===t&&(t=0),this.gamepadType=e,this.gamepadUser=t,this.buttons=n,this.leftTrigger=i,this.rightTrigger=o,this.leftThumbX=r,this.leftThumbY=a,this.rightThumbX=s,this.rightThumbY=c}return e.prototype.dumps=function(){var e=new DataView(new ArrayBuffer(16));return e.setUint8(0,G.Gamepad),e.setUint8(1,this.gamepadType),e.setUint16(2,this.gamepadUser),e.setUint16(4,this.buttons),e.setUint8(6,this.leftTrigger),e.setUint8(7,this.rightTrigger),e.setInt16(8,this.leftThumbX),e.setInt16(10,this.leftThumbY),e.setInt16(12,this.rightThumbX),e.setInt16(14,this.rightThumbY),e.buffer},e}(),de=function(){function e(e,t,n,i,o,r,a,s,c,u){void 0===e&&(e=BigInt((new Date).getTime())),void 0===t&&(t=0),void 0===n&&(n=0),void 0===i&&(i=0),void 0===o&&(o=1920),void 0===r&&(r=1080),void 0===a&&(a=0),void 0===s&&(s=F.BinaryPNG),void 0===c&&(c=j.Failure),void 0===u&&(u=new ArrayBuffer(0)),this.timestamp=e,this.index=t,this.left=n,this.top=i,this.width=o,this.height=r,this.size=a,this.format=s,this.result=c,this.payload=u}return e.prototype.dumps=function(){var e=new DataView(new ArrayBuffer(35));return e.setUint8(0,G.ScreenshotParams),e.setBigUint64(1,this.timestamp),e.setUint32(9,this.index),e.setUint32(13,this.left),e.setUint32(17,this.top),e.setUint32(21,this.width),e.setUint32(25,this.height),e.setUint32(29,0),e.setUint8(33,this.format),e.setUint8(34,this.result),e.buffer},e.parse=function(t){var n=new DataView(t);return new e(n.getBigUint64(1),n.getUint32(9),n.getUint32(13),n.getUint32(17),n.getUint32(21),n.getUint32(25),n.getUint32(29),n.getUint8(33),n.getUint8(34),t.slice(35))},e}();!function(e){e[e.Text=0]="Text",e[e.Image=1]="Image",e[e.QTText=2]="QTText",e[e.QTImage=3]="QTImage",e[e.unsupported=4]="unsupported"}($||($={})),function(e){e[e.None=0]="None",e[e.LZ4=1]="LZ4",e[e.ZLIB=2]="ZLIB",e[e.Unknow=3]="Unknow"}(ee||(ee={}));var fe,pe=function(){function e(e,t,n,i){void 0===t&&(t=0),void 0===n&&(n=$.Text),void 0===i&&(i=ee.None),this.payload=e,this.size=t,this.dataType=n,this.compressType=i}return e.prototype.dumps=function(){var e=C(this.payload),t=new DataView(new ArrayBuffer(7+e.length));return t.setUint8(0,G.ClipboardData),t.setUint32(1,e.length+2),t.setUint8(5,this.dataType),t.setUint8(6,this.compressType),e.forEach((function(e,n){return t.setUint8(n+7,e)})),t.buffer},e.parse=function(t){var n=new DataView(t),i=n.getUint32(1)-2,o=n.getUint8(5),r=n.getUint8(6),a="";return o===$.Text&&r===ee.None&&(a=L(t,7)),new e(a,i,o,r)},e}();!function(e){e[e.ActionDown=0]="ActionDown",e[e.ActionUp=1]="ActionUp",e[e.ActionMove=2]="ActionMove",e[e.ActionCancel=3]="ActionCancel",e[e.ActionPointerDown=5]="ActionPointerDown",e[e.ActionPointerUp=6]="ActionPointerUp"}(fe||(fe={}));var me,ve,ye=function(){function e(e,t,n,i){this.action=e,this.pointerId=t,this.x=n,this.y=i}return e.prototype.dumps=function(){var e=new DataView(new ArrayBuffer(17));return e.setUint8(0,G.MobileTouch),e.setInt32(1,this.action),e.setInt32(5,this.pointerId),e.setInt32(9,this.x),e.setInt32(13,this.y),e.buffer},e}();!function(e){e[e.ActionDown=0]="ActionDown",e[e.ActionUp=1]="ActionUp"}(me||(me={})),function(e){e[e.KeycodeHome=3]="KeycodeHome",e[e.KeycodeBack=4]="KeycodeBack",e[e.KeycodeAppSwitch=187]="KeycodeAppSwitch"}(ve||(ve={}));var be=function(){function e(e,t){this.action=e,this.keycode=t}return e.prototype.dumps=function(){var e=new DataView(new ArrayBuffer(3));return e.setUint8(0,G.MobileKeys),e.setUint8(1,this.action),e.setUint8(2,this.keycode),e.buffer},e}(),we=function(){function n(e,t,n,i,o,r,a){var s=this;void 0===n&&(n="all"),void 0===i&&(i=2e3),void 0===o&&(o=5e3),void 0===r&&(r=4e3),void 0===a&&(a=!0),this.url=e,this.iceServers=t,this.iceTransportPolicy=n,this.minBitrate=i,this.maxBitrate=o,this.startBitrate=r,this.enableAFK=a,this.event={connect:new q,afk:new q,open:new q,close:new q,queue:new q,ready:new q,endCandidate:new q,cursor:new q,disconnect:new q,receivedLink:new q,receivedVideo:new q,dataChannelConnected:new q,interaction:new q,occupy:new q,kick:new q,networkChanged:new q,echo:new q,screenshot:new q,screenshotData:new q,kickOut:new q,clientInfo:new q,clipboard:new q},this.token="",this.afk=new W,this.tan=new V,this.ready=!1,this.token=e.split("/").pop(),this.pc=new RTCPeerConnection({iceServers:t,iceTransportPolicy:n}),this.setupPeerConnection(),this.dc=this.pc.createDataChannel("sendChannel"),this.dc.binaryType="arraybuffer",this.setupDataChannel(),this.subject=h({url:e,closeObserver:{next:function(e){return s.event.close.emit(e)}},openObserver:{next:function(e){return s.event.open.emit(e)}}}),this.setupSigning()}return n.prototype.setupSigning=function(){var e=this;this.subject.subscribe({next:function(t){switch(t.action){case"connect":e.event.connect.emit(t);break;case"sdpOffer":e.pc.setRemoteDescription(new RTCSessionDescription(t.data)),e.pc.createAnswer().then((function(t){e.pc.setLocalDescription(t),e.subject.next({action:"sdpAnswer",data:t})}));break;case"candidate":e.pc.addIceCandidate(new RTCIceCandidate(t.data));break;case"sdpAnswer":e.pc.setRemoteDescription(new RTCSessionDescription(t.data));break;case"ready":e.ready||(e.ready=!0,e.linkStart(),e.event.ready.emit(t));break;case"queue":e.event.queue.emit(t.data.queueNum);break;case"peerDisconnected":e.event.disconnect.emit(t.message);break;case"operateOverTime":e.event.afk.emit(e.afk.idleTime);break;case"unready":try{e.subject.next({action:"verify",data:{token:e.token}})}catch(e){}break;case"hangUp":e.hangUp();break;case"occupy":e.event.occupy.emit("connection occupied!");break;case"kick":e.event.kick.emit(t.message),e.destory();break;case"clientInfo":e.event.clientInfo.emit(t.data)}},error:function(t){e.event.disconnect.emit(t)},complete:function(){}})},n.prototype.setupPeerConnection=function(){var e=this;this.pc.onicecandidate=function(t){t.candidate?e.subject.next({action:"candidate",data:t.candidate}):e.event.endCandidate.emit(t)},this.pc.ontrack=function(t){e.event.receivedVideo.emit(t.streams[0])},this.pc.oniceconnectionstatechange=function(){"disconnected"===e.pc.iceConnectionState&&e.event.networkChanged.emit(e.url)}},n.prototype.setupDataChannel=function(){var n=this,i=e(this.dc,"close");this.dc.onopen=function(e){t(3e4).pipe(l(i)).subscribe((function(e){return n.subject.next({action:"heartbeat"})})),n.enableAFK&&(n.afk.start(),t(P.AFKTimerGap).pipe(l(i)).subscribe((function(e){return n.subject.next({action:"afk",data:{idleTime:n.afk.idleTime}})}))),n.event.dataChannelConnected.emit(e)};var o=e(this.dc,"message").pipe(l(i),d((function(e){})),f((function(e){return e.data})),p());o.pipe(m((function(e){return S(e)===G.CursorData})),f((function(e){return K.parse(e)}))).subscribe((function(e){return n.event.cursor.emit(e)})),o.pipe(m((function(e){return S(e)===G.KickOutController})),f((function(e){return L(e,1)}))).subscribe((function(e){return n.event.kickOut.emit(e)})),o.pipe(m((function(e){return S(e)===G.URLIntercept})),f((function(e){return L(e,8)}))).subscribe((function(e){return n.event.receivedLink.emit(e)})),o.pipe(m((function(e){return S(e)===G.WebRTCForwardREQ})),f((function(e){return L(e,1)}))).subscribe((function(e){return n.event.interaction.emit(e)}));var r=o.pipe(m((function(e){return S(e)===G.ScreenshotParams})),f((function(e){return de.parse(e)})),p());r.subscribe((function(e){return n.event.screenshotData.emit(e.payload.byteLength)})),r.pipe(v(r.pipe(m((function(e){return e.result===j.Success})))),m((function(e){return 0!==e.length})),f((function(e){return e.map((function(e){return e.payload}))})),f((function(e){return new Blob(e,{type:"image/png"})}))).subscribe((function(e){return n.event.screenshot.emit(e)})),o.pipe(m((function(e){return S(e)===G.WebRTCForwardRSP})),f((function(e){return ue.fromDataChannel(e)}))).subscribe((function(e){return n.tan.trigger(e.id,e.success)})),o.pipe(m((function(e){return S(e)===G.ClipboardData})),f((function(e){return pe.parse(e)}))).subscribe((function(e){return n.event.clipboard.emit(e.payload)})),o.pipe(m((function(e){return[G.EchoData,G.EventDelay].includes(S(e))})),f((function(e){return ie.decode(e)}))).subscribe((function(e){var t=e.timestamp;return n.event.echo.emit(~~performance.now()-t)})),this.dc.onerror=function(e){},this.dc.onclose=function(e){}},n.prototype.linkStart=function(){var e=this;this.pc.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0}).then((function(t){e.pc.setLocalDescription(t),t.sdp=t.sdp.replace(/(a=fmtp:\d+ .*level-asymmetry-allowed=.*)\r\n/gm,"$1;x-google-start-bitrate=".concat(e.startBitrate,";x-google-max-bitrate=").concat(e.maxBitrate,";x-google-min-bitrate=").concat(e.minBitrate,"\r\n")),e.subject.next({action:"sdpOffer",data:t})}))},n.prototype.hangUp=function(){this.ready=!1,this.dc.close(),this.pc.close(),this.afk.clear(),this.pc=new RTCPeerConnection({iceServers:this.iceServers,iceTransportPolicy:this.iceTransportPolicy}),this.setupPeerConnection(),this.dc=this.pc.createDataChannel("sendChannel"),this.dc.binaryType="arraybuffer",this.setupDataChannel()},n.prototype.controlAuthority=function(e){return T(this,void 0,void 0,(function(){return M(this,(function(t){return this.subject.next({action:"controlAuthority",data:{token:e}}),[2]}))}))},n.prototype.changeBandwidth=function(e,t,n){n&&t?this.subject.next({action:"setBitrate",data:{min_bitrate:n,max_bitrate:t,cur_bitrate:e}}):this.subject.next({action:"setBitrate",data:{min_bitrate:e,max_bitrate:e,cur_bitrate:e}})},n.prototype.exit=function(){this.subject.closed||this.subject.next({action:"exit"})},n.prototype.emitUIInteraction=function(e){var t=new J,n=this.tan.order(t);return this.send(new ne(e,n).dumps()),t.promise},n.prototype.echo=function(){this.send(new ie(~~performance.now()).dumps())},n.prototype.screenshot=function(e){var t=void 0===e?{}:e,n=t.index,i=void 0===n?0:n,o=t.left,r=void 0===o?0:o,a=t.top,s=void 0===a?0:a,c=t.width,u=void 0===c?1920:c,h=t.height,l=void 0===h?1080:h;this.send(new de(void 0,i,r,s,u,l).dumps())},n.prototype.clipboard=function(e){this.send(new pe(e).dumps())},n.prototype.send=function(e,t){if(void 0===t&&(t=!1),"open"!==this.dc.readyState)throw new Error("send message before DataChannel open");this.enableAFK&&t&&this.afk.reset(),"string"==typeof e||e instanceof Blob||ArrayBuffer,this.dc.send(e)},n.prototype.destory=function(){this.dc.close(),this.pc.close(),this.afk.clear(),this.subject.unsubscribe(),Object.entries(this.event).forEach((function(e){return B(e,2)[1].offAll()}))},n}(),ge=function(){function e(e,t,n){var i=this;void 0===t&&(t=function(){}),void 0===n&&(n=!0),this.hostElement=e,this.canResize=!1,this.top=0,this.left=0,this.width=0,this.height=0,this.intervalID=NaN,this.onPlayHandler=[],this.resizePlayer=function(){i.canResize&&(i.hostElement.clientWidth<i.videoElement.videoWidth||i.hostElement.clientHeight<i.videoElement.videoHeight?i.resizePlayerStyleToFillWindow():i.resizePlayerStyleToActualSize())},this.onPlayHandler.push(t),this.overlayElement=document.createElement("div"),this.overlayElement.style.cssText="\n color: white;\n font-size: 1.8em;\n width: 100%;\n height: 100%;\n display: flex;\n position: absolute;\n background-color: rgba(51, 51, 51, 0.7);\n justify-content: center;\n align-items: center;\n ",this.playerElement=document.createElement("div"),this.playerElement.style.cssText="\n width: 100%;\n height: 100%;\n position: relative;\n background-color: black;\n ",this.videoElement=document.createElement("video"),this.videoElement.style.cssText="\n width: 100%;\n height: 100%;\n position: absolute;\n touch-action: none;\n ",this.videoElement.muted=!0,this.videoElement.playsInline=!0,this.videoElement.autoplay=!0,this.videoElement.addEventListener("loadedmetadata",(function(e){i.intervalID=window.setInterval((function(){i.isBlackScreen()||(i.canResize=!0,i.hidePlayOverlay(),i.resizePlayer(),window.clearInterval(i.intervalID),i.onPlayHandler.forEach((function(e){return e()})))}),500),i.videoElement.play().catch((function(){return i.showPlayOverlay()}))})),this.playerElement.appendChild(this.videoElement),this.playerElement.appendChild(this.overlayElement),e.appendChild(this.playerElement),new D(this.resizePlayer).observe(e);var o=this;n&&(document.body.addEventListener("mousedown",(function e(){o.videoElement.muted=!1,document.body.removeEventListener("mousedown",e)})),window.navigator.userAgent.indexOf("Chrome")>-1?document.body.addEventListener("touchend",(function e(){o.videoElement.muted=!1,document.body.removeEventListener("touchend",e)})):document.body.addEventListener("touchstart",(function e(){o.videoElement.muted=!1,document.body.removeEventListener("touchstart",e)})))}return Object.defineProperty(e.prototype,"videoAspectRatio",{get:function(){return this.videoElement.videoHeight/this.videoElement.videoWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hostAspectRatio",{get:function(){return this.hostElement.clientHeight/this.hostElement.clientWidth},enumerable:!1,configurable:!0}),e.prototype.registerOnPlay=function(e){this.onPlayHandler.push(e)},e.prototype.isBlackScreen=function(){var e,t=document.createElement("canvas"),n=t.getContext("2d");return t.width=this.videoElement.videoWidth/100,t.height=this.videoElement.videoHeight/100,n.drawImage(this.videoElement,0,0,t.width,t.height),!t.width||(null===(e=n.getImageData(0,0,t.width,t.height))||void 0===e?void 0:e.data).every((function(e){return 0===e||1===e||255===e}))},e.prototype.resizePlayerStyleToFillWindow=function(){this.videoAspectRatio?this.hostAspectRatio<this.videoAspectRatio?(this.height=this.hostElement.clientHeight,this.width=Math.floor(this.height/this.videoAspectRatio),this.left=Math.floor(.5*(this.hostElement.clientWidth-this.width)),this.top=0):(this.width=this.hostElement.clientWidth,this.height=Math.floor(this.width*this.videoAspectRatio),this.top=Math.floor(.5*(this.hostElement.clientHeight-this.height)),this.left=0):(this.width=this.hostElement.clientWidth,this.height=this.hostElement.clientHeight,this.top=0,this.left=0),this.applyStyleToPlayer()},e.prototype.resizePlayerStyleToActualSize=function(){this.width=this.videoElement.videoWidth,this.height=this.videoElement.videoHeight,this.top=Math.floor(.5*(this.hostElement.clientHeight-this.height)),this.left=Math.floor(.5*(this.hostElement.clientWidth-this.width)),this.applyStyleToPlayer()},e.prototype.applyStyleToPlayer=function(){this.playerElement.style.top="".concat(this.top,"px"),this.playerElement.style.left="".concat(this.left,"px"),this.playerElement.style.width="".concat(this.width,"px"),this.playerElement.style.height="".concat(this.height,"px")},e.prototype.destory=function(){var e;this.intervalID&&window.clearInterval(this.intervalID),this.playerElement.contains(this.videoElement)&&this.playerElement.removeChild(this.videoElement),this.playerElement.contains(this.overlayElement)&&this.playerElement.removeChild(this.overlayElement),null===(e=this.playerElement.parentNode)||void 0===e||e.removeChild(this.playerElement)},e.prototype.showTextOverlay=function(e){var t=document.createElement("div");t.innerHTML=e,this.setOverlay(t)},e.prototype.showPlayOverlay=function(){var e=this,t=document.createElement("img");t.id="play-button",t.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPEAAAD5CAYAAAD2mNNkAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMjHxIGmVAAASgklEQVR4Xu2dC7BdVX2HqUCCIRASCPjAFIQREBRBBSRYbFOt8lIrFUWRFqXWsT5wbItUqFWs0KqIMPKoYEWpRS06KDjS1BeVFkVQbCw+wCfiAwGhCKWP9PuZtU24uTe59zz22Y/vm/nGkXtz7jlrr9+sdfZea/03Wb169QtxGW62iYi0D8L7NbwYj8EdcdPyIxFpA4T2P/F/8Ua8CI/GhPnXyq+ISJMhrAlxxX9hRuYL8Sh8SPk1EWkqBHXdEFfcg6vw3fhs3Kb8uog0DQI6XYgr8rOvYsJ8OM4v/0xEmkIJ6ob4P8zIfANegCvQMIs0BQK5sRBXJMy/wIzM5+ByXFBeRkQmBUGcbYjX5S5MmM/AA3CL8nIiUjcEcJAQV9yBX8a/wSeiz5hF6obgDRPikGfMCfOX8DTcu7y0iNQBoRs2xBX/g3diwvwm3Kn8CREZJ4RtVCGuqMKcu9kn4xJ09ZfIuCBgow5xyJ3sTLNzAywrwF6J26NhFhk1BGscIV6XhPluvA6Pxx3KnxaRUUCoxh3iioQ5z5n/BY/FJeUtiMgwEKa6QlyRMN+Hn8Hn4ZblrYjIIBCiukMc8p25Ws6ZMD+zvB0RmS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FRkUwlN3iFM54YN4KG6LHkQnMgyEqK4Q51nvpZjwZuQ1vCKjgDDVEeIr8XBMeL3bLDJKCNW4QpyR9zo8ArdBb1iJjAPCNeoQJ7ypFngszkc3JoiME0I2qhDnWW8Kjv0xujFBpC4I3DAhzgqrHESXUp/Z0/uQ8rIiUhcEb5AQJ7z34TfwJNy5vJyI1A0BnG2IE9yYsiffwTfizuh3XpFJQghnE+J83014v4upkL8r+qhIpAkQxg2FOOHNzzNtPhf3REdekSZRQjqVTJtzguSNeD4eWH5dRJoGAZ0a4rvxm3ghrkCnzSJNhpBWIc7/plpgwpudRZ7dLNIGCOvtJbwX42G4uPxIRNoAoU2d3iNxUflPItIaNtnk/wEGBoMdpECGHAAAAABJRU5ErkJggg==",t.alt="Start Streaming",this.setOverlay(t,(function(){e.hidePlayOverlay()}))},e.prototype.hidePlayOverlay=function(){this.clearOverlay(),this.overlayElement.style.display="none"},e.prototype.clearOverlay=function(){for(;this.overlayElement.lastChild;)this.overlayElement.removeChild(this.overlayElement.lastChild)},e.prototype.setOverlay=function(e,t){if(this.clearOverlay(),this.overlayElement.appendChild(e),this.overlayElement.style.display="flex",t){var n=this;this.overlayElement.addEventListener("click",(function e(i){t(i),n.overlayElement.removeEventListener("click",e)}))}},e}(),ke=function(){function a(){}return a.createDefaultEventStream=function(t,r){t.addEventListener("contextmenu",(function(e){return e.preventDefault()}));var a=e(t,"mousedown").pipe(d((function(e){return e.preventDefault()})),f((function(e){return re.formMouseEvent(e,!0).dumps()}))),s=e(t,"mouseup").pipe(d((function(e){return e.preventDefault()})),f((function(e){return re.formMouseEvent(e,!1).dumps()}))),c=e(t,"mousemove").pipe(d((function(e){return e.preventDefault()})),f((function(e){return A(e,r.mouseNormalizeType===G.MouseMoveStandardization)})),f((function(e){var t=e.x,n=e.y,i=e.dx,o=e.dy;return new oe(t,n,i,o,r.mouseMoveType,r.mouseNormalizeType).dumps()}))),u=e(t,"mouseleave").pipe(f(z),f((function(e){return A(e,r.mouseNormalizeType===G.MouseMoveStandardization)})),f((function(e){var t=e.x,n=e.y,i=e.dx,o=e.dy;return new oe(t,n,i,o,r.mouseMoveType,r.mouseNormalizeType).dumps()}))),h=e(t,"wheel",{passive:!1}).pipe(d((function(e){return e.preventDefault()})),f((function(e){return ae.fromWheelEvent(e).dumps()})));function p(e,t){var n=t===Q.TouchUpdate?"touches":"changedTouches";return new ce(t,function(e,t){var n=e.target,i=n.videoWidth,o=n.videoHeight,r=n.clientHeight,a=n.clientWidth,s=n.getBoundingClientRect(),c=s.left,u=s.top;return t.map((function(e){var t=e.clientX,n=e.clientY;return{x:i/a*(t-c),y:o/r*(n-u),id:e.identifier}}))}(e,Array.from(e[n]))).dumps()}var v=e(t,"touchend"),E=e(t,"touchmove",{passive:!1}),D=e(t,"touchstart",{passive:!1}),T=e(t,"touchcancel");return{wheelStream:h,mouseupStream:s,mousedownStream:a,mousemoveStream:c,zoomStream:E.pipe(d((function(e){return e.preventDefault()})),l(n(v,T)),y(100),m((function(e){return 2===e.targetTouches.length})),b(),f(I),f((function(e){return ae.fromPinchZoom(e/10).dumps()})),w()),startBufferStream:i((function(){return r.fakeMouseWithTouch}),D.pipe(d((function(e){return e.preventDefault()})),g((function(e){return o((t=A({target:e.target,clientX:e.targetTouches[0].clientX,clientY:e.targetTouches[0].clientY,movementX:0,movementY:0},r.mouseNormalizeType===G.MouseMoveStandardization),n=t.x,i=t.y,a=t.dx,s=t.dy,new oe(n,i,a,s,r.mouseMoveType,r.mouseNormalizeType).dumps()),new re(3===e.targetTouches.length?O.ButtonMiddle:r.fakeTouchType,!0).dumps());var t,n,i,a,s}))),D.pipe(d((function(e){return e.preventDefault()})),f((function(e){return p(e,Q.TouchDown)})))),moveBufferStream:i((function(){return r.fakeMouseWithTouch}),E.pipe(d((function(e){return e.preventDefault()})),l(n(v,T)),m((function(e){return 1===e.targetTouches.length||3===e.targetTouches.length})),b(),f(X),f((function(e){return function(e,t,n){var i=e.movementX,o=e.movementY;return x(x({},e),{movementX:i*t,movementY:o*n})}(e,r.touchDeltaXSensitivity,r.touchDeltaYSensitivity)})),f((function(e){return A(e,r.mouseNormalizeType===G.MouseMoveStandardization)})),f((function(e){var t=e.x,n=e.y,i=e.dx,o=e.dy;return new oe(t,n,i,o,r.mouseMoveType,r.mouseNormalizeType).dumps()})),w()),E.pipe(d((function(e){return e.preventDefault()})),f((function(e){return p(e,Q.TouchUpdate)})))),endBufferStream:i((function(){return r.fakeMouseWithTouch}),n(v,T).pipe(d((function(e){return e.preventDefault()})),k(new re(r.fakeTouchType,!1).dumps())),n(v,T).pipe(d((function(e){return e.preventDefault()})),f((function(e){return p(e,Q.TouchUp)})))),leaveStream:u}},a.createGamepadStream=function(){return t(0,r).pipe(f((function(e){return navigator.getGamepads()[0]})),m((function(e){return!!e})),f((function(e){var t=B(e.axes.map((function(e){return 32767*e})),4),n=t[0],i=t[1],o=t[2],r=t[3],a=255*e.buttons[6].value,s=255*e.buttons[7].value;return new le(H.GamepadXbox,0,0,a,s,n,-i,o,-r).dumps()})))},a.createClipboardStream=function(t){return e(t,"focus").pipe(E((function(){return new Promise((function(e){return navigator.clipboard.readText().then(e).catch((function(){return e("")}))}))})),f((function(e){return new pe(e).dumps()})))},a.createKeyboardStream=function(t){t.tabIndex=-1;var n=function(){return t.focus()};return t.addEventListener("touchstart",n,{passive:!0}),t.addEventListener("mouseenter",n),t.addEventListener("click",n),{keydownStream:e(t,"keydown").pipe(d((function(e){return e.preventDefault()})),f((function(e){return se.fromKeyboardEvent(e,!0).dumps()}))),keyupStream:e(t,"keyup").pipe(d((function(e){return e.preventDefault()})),f((function(e){return se.fromKeyboardEvent(e,!1).dumps()})))}},a.createMobileStreamFromMouse=function(t){var i=e(t,"mouseup").pipe(f((function(e){var t=A(e,!0),n=t.x,i=t.y;return new ye(fe.ActionUp,0,n,i).dumps()}))),o=e(t,"mousemove").pipe(f((function(e){var t=A(e,!0),n=t.x,i=t.y;return new ye(fe.ActionMove,0,n,i).dumps()}))),r=e(t,"mousedown").pipe(f((function(e){var t=A(e,!0),n=t.x,i=t.y;return new ye(fe.ActionDown,0,n,i).dumps()})));return n(r,o,i)},a.attachMobileListener=function(t,n){return this.createMobileStreamFromMouse(t).pipe(l(e(n.dc,"close"))).subscribe((function(e){return n.send(e,!0)}))},a.attachListener=function(t,i,o,r){var a=void 0===r?{}:r,s=a.enableClipboard,c=void 0!==s&&s,u=a.enableGamepad,h=void 0!==u&&u,d=this.createDefaultEventStream(t,i),f=d.wheelStream,p=d.mouseupStream,m=d.mousedownStream,v=d.mousemoveStream,y=d.zoomStream,b=d.startBufferStream,w=d.moveBufferStream,g=d.endBufferStream,k=d.leaveStream,E=this.createKeyboardStream(t),D=E.keyupStream,x=E.keydownStream,T=n(f,x,D,p,m,v,y,b,w,g,k);return c&&(T=n(T,this.createClipboardStream(t))),h&&(T=n(T,this.createGamepadStream())),T.pipe(l(e(o.dc,"close"))).subscribe((function(e){return o.send(e,!0)}))},a}(),Ee=function(e,t,n,i,o,r){void 0===e&&(e=G.MouseMoveStandardization),void 0===t&&(t=Z.Passive),void 0===n&&(n=O.ButtonLeft),void 0===i&&(i=!0),void 0===o&&(o=1),void 0===r&&(r=1),this.mouseNormalizeType=e,this.mouseMoveType=t,this.fakeTouchType=n,this.fakeMouseWithTouch=i,this.touchDeltaXSensitivity=o,this.touchDeltaYSensitivity=r},De=function(){function e(){var e=this;this.latency=0,this.averageJitterBufferDelay=0,this.bytesReceivedPerMillisecond=0,this.headerBytesReceivedPerMillisecond=0,this.packetsLost=0,this.packetsReceived=0,this.framesReceived=0,this.framesDecoded=0,this.keyFramesDecoded=0,this.framesDropped=0,this.framesPerSecond=0,this.handleLatency=function(t){return e.latency=t}}return Object.defineProperty(e.prototype,"bitrate",{get:function(){return 8*(this.bytesReceivedPerMillisecond+this.headerBytesReceivedPerMillisecond)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"packetLossRate",{get:function(){return this.packetsReceived?this.packetsLost/(this.packetsLost+this.packetsReceived):0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"running",{get:function(){return!!this.statSub&&!!this.echoSub&&!!this.dispose},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasOffered",{get:function(){return!!this.connection},enumerable:!1,configurable:!0}),e.prototype.offer=function(e){this.connection=e,this.running&&this.scan()},e.prototype.scan=function(){var e,n=this;if(!this.connection)throw new Error("gather statistics before provide connection");var i=this.connection;null===(e=this.statSub)||void 0===e||e.unsubscribe(),this.echoSub&&(this.echoSub.unsubscribe(),this.connection.event.echo.off(this.handleLatency)),this.dispose=this.connection.event.echo.on(this.handleLatency).dispose,this.echoSub=t(1e3).subscribe((function(){return"open"===i.dc.readyState&&i.echo()})),this.statSub=t(1e3).pipe(a((function(){return s(i.pc.getStats())})),c((function(e){return function(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}([],B(e.values()),!1).find((function(e){return"inbound-rtp"===e.type&&"video"===e.kind}))})),u(),c((function(e){var t,n,i,o,r,a,s,c=B(e,2),u=c[0],h=c[1];if(u&&h){var l=h.timestamp-u.timestamp,d=~~(1e3*(h.jitterBufferDelay-u.jitterBufferDelay)/(h.jitterBufferEmittedCount-u.jitterBufferEmittedCount));return{bytesReceivedPerMillisecond:~~((h.bytesReceived-u.bytesReceived)/l),headerBytesReceivedPerMillisecond:~~((h.headerBytesReceived-u.headerBytesReceived)/l),averageJitterBufferDelay:d,packetsLost:null!==(t=h.packetsLost)&&void 0!==t?t:0,packetsReceived:null!==(n=h.packetsReceived)&&void 0!==n?n:0,framesReceived:null!==(i=h.framesReceived)&&void 0!==i?i:0,framesDecoded:null!==(o=h.framesDecoded)&&void 0!==o?o:0,keyFramesDecoded:null!==(r=h.keyFramesDecoded)&&void 0!==r?r:0,framesDropped:null!==(a=h.framesDropped)&&void 0!==a?a:0,framesPerSecond:null!==(s=h.framesPerSecond)&&void 0!==s?s:0}}return{bytesReceivedPerMillisecond:0,headerBytesReceivedPerMillisecond:0,averageJitterBufferDelay:0,packetsLost:0,packetsReceived:0,framesReceived:0,framesDecoded:0,keyFramesDecoded:0,framesDropped:0,framesPerSecond:0}}))).subscribe((function(e){var t=e.headerBytesReceivedPerMillisecond,i=e.bytesReceivedPerMillisecond,o=e.averageJitterBufferDelay,r=e.packetsLost,a=e.packetsReceived,s=e.framesReceived,c=e.framesDecoded,u=e.keyFramesDecoded,h=e.framesDropped,l=e.framesPerSecond;n.bytesReceivedPerMillisecond=i,n.headerBytesReceivedPerMillisecond=t,n.packetsLost=r,n.packetsReceived=a,n.framesReceived=s,n.framesDecoded=c,n.keyFramesDecoded=u,n.framesDropped=h,n.framesPerSecond=l,n.averageJitterBufferDelay=o}))},e.prototype.report=function(){var e=this,t=e.latency,n=e.packetLossRate,i=e.bitrate,o=e.averageJitterBufferDelay,r=e.framesReceived,a=e.framesDecoded,s=e.keyFramesDecoded,c=e.framesDropped;return{fps:e.framesPerSecond,latency:t,bitrate:i,packetLossRate:n,averageJitterBufferDelay:o,framesReceived:r,framesDecoded:a,keyFramesDecoded:s,framesDropped:c}},e.prototype.toggle=function(){this.running?this.stop():this.scan()},e.prototype.stop=function(){var e,t;this.bytesReceivedPerMillisecond=0,this.headerBytesReceivedPerMillisecond=0,this.averageJitterBufferDelay=0,this.latency=0,this.packetsLost=0,this.packetsReceived=0,this.framesReceived=0,this.framesDecoded=0,this.keyFramesDecoded=0,this.framesDropped=0,this.framesPerSecond=0,null===(e=this.statSub)||void 0===e||e.unsubscribe(),this.statSub=void 0,null===(t=this.echoSub)||void 0===t||t.unsubscribe(),this.echoSub=void 0,this.dispose&&this.dispose(),this.dispose=void 0},e}();export{pe as ClipboardData,we as Connection,ie as EventData,G as EventType,le as Gamepad,H as GamepadType,N as GamepadXboxButton,ke as Helper,j as ImageResultValue,F as ImageStoreFormat,se as Keyboard,be as MobileKeys,me as MobileKeysActionType,ve as MobileKeysKeycode,ye as MobileTouch,fe as MobileTouchActionType,re as MouseButton,O as MouseButtonType,oe as MouseMove,Z as MoveType,ge as Player,_ as PointerManager,De as Rivatuner,Ee as RunningState,de as Screenshot,he as TextInput,ce as TouchSet,Q as TouchType,ne as UIInteraction,ue as UIInteractionResponse,ae as WheelScroll,Y as screenfull};

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc