@zoom/meetingsdk 3.0.0-rc

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/LICENSE.pdf +0 -0
  3. package/README.md +182 -0
  4. package/dist/css/bootstrap.css +5 -0
  5. package/dist/css/react-select.css +434 -0
  6. package/dist/fonts/glyphicons-halflings-regular.eot +0 -0
  7. package/dist/fonts/glyphicons-halflings-regular.svg +229 -0
  8. package/dist/fonts/glyphicons-halflings-regular.ttf +0 -0
  9. package/dist/fonts/glyphicons-halflings-regular.woff +0 -0
  10. package/dist/lib/audio/archival.mp3 +0 -0
  11. package/dist/lib/audio/incoming-msg-chime.mp3 +0 -0
  12. package/dist/lib/audio/m-entry.mp3 +0 -0
  13. package/dist/lib/audio/m-exit.mp3 +0 -0
  14. package/dist/lib/audio/m-wr.mp3 +0 -0
  15. package/dist/lib/audio/meeting_is_now_recorded.mp3 +0 -0
  16. package/dist/lib/audio/raise-hand-chime.mp3 +0 -0
  17. package/dist/lib/audio/recording_is_now_stopped.mp3 +0 -0
  18. package/dist/lib/audio/ring.mp3 +0 -0
  19. package/dist/lib/av/audio.encode.wasm +0 -0
  20. package/dist/lib/av/audio.simd.wasm +0 -0
  21. package/dist/lib/av/audio_simd.min.js +10 -0
  22. package/dist/lib/av/js_audio_process.min.js +10 -0
  23. package/dist/lib/av/js_audio_worklet.min.js +2 -0
  24. package/dist/lib/av/js_audio_worklet_process.min.js +25 -0
  25. package/dist/lib/av/js_audio_worklet_simd.min.js +25 -0
  26. package/dist/lib/av/js_media.min.js +2 -0
  27. package/dist/lib/av/js_sharing_audio_worklet.min.js +2 -0
  28. package/dist/lib/av/sharing_m.min.js +31 -0
  29. package/dist/lib/av/sharing_mtsimd.min.js +31 -0
  30. package/dist/lib/av/sharing_s.min.js +10 -0
  31. package/dist/lib/av/sharing_simd.min.js +10 -0
  32. package/dist/lib/av/vb-resource/dualModel.bin +0 -0
  33. package/dist/lib/av/vb-resource/tf.min.js +18 -0
  34. package/dist/lib/av/vb-resource/vbPreload.js +1 -0
  35. package/dist/lib/av/vb-resource/vbPreloadWorker.js +1 -0
  36. package/dist/lib/av/video.decode.wasm +0 -0
  37. package/dist/lib/av/video.mt.wasm +0 -0
  38. package/dist/lib/av/video.mtsimd.wasm +0 -0
  39. package/dist/lib/av/video.simd.wasm +0 -0
  40. package/dist/lib/av/video_m.min.js +31 -0
  41. package/dist/lib/av/video_mtsimd.min.js +31 -0
  42. package/dist/lib/av/video_s.min.js +10 -0
  43. package/dist/lib/av/video_share_mtsimd.min.js +31 -0
  44. package/dist/lib/av/video_simd.min.js +10 -0
  45. package/dist/lib/av/websipclient.min.js +1 -0
  46. package/dist/lib/image/SanFrancisco.jpg +0 -0
  47. package/dist/lib/image/animation-sprite.png +0 -0
  48. package/dist/lib/image/blur.png +0 -0
  49. package/dist/lib/image/earth.jpg +0 -0
  50. package/dist/lib/image/grass.jpg +0 -0
  51. package/dist/lib/image/mask-circle.png +0 -0
  52. package/dist/lib/image/mask-heart.png +0 -0
  53. package/dist/lib/image/mask-rectangle.png +0 -0
  54. package/dist/lib/image/notification.png +0 -0
  55. package/dist/lib/lang/de-DE.json +1727 -0
  56. package/dist/lib/lang/en-US.json +1727 -0
  57. package/dist/lib/lang/es-ES.json +1727 -0
  58. package/dist/lib/lang/fr-FR.json +1727 -0
  59. package/dist/lib/lang/id-ID.json +1727 -0
  60. package/dist/lib/lang/it-IT.json +1727 -0
  61. package/dist/lib/lang/jp-JP.json +1727 -0
  62. package/dist/lib/lang/ko-KO.json +1727 -0
  63. package/dist/lib/lang/nl-NL.json +1727 -0
  64. package/dist/lib/lang/pl-PL.json +1727 -0
  65. package/dist/lib/lang/pt-PT.json +1727 -0
  66. package/dist/lib/lang/ru-RU.json +1727 -0
  67. package/dist/lib/lang/tr-TR.json +1727 -0
  68. package/dist/lib/lang/vi-VN.json +1727 -0
  69. package/dist/lib/lang/zh-CN.json +1727 -0
  70. package/dist/lib/lang/zh-TW.json +1727 -0
  71. package/dist/lib/vendor/lodash.min.js +140 -0
  72. package/dist/lib/vendor/react-dom.min.js +239 -0
  73. package/dist/lib/vendor/react.min.js +32 -0
  74. package/dist/lib/vendor/redux-thunk.min.js +1 -0
  75. package/dist/lib/vendor/redux.min.js +1 -0
  76. package/dist/lib/webim.min.js +23 -0
  77. package/dist/ui/33f06.svg +647 -0
  78. package/dist/ui/zoomus-websdk-806.umd.min.js +1 -0
  79. package/dist/ui/zoomus-websdk-MobileReportProblemContent.umd.min.js +2 -0
  80. package/dist/ui/zoomus-websdk-ReportProblemContent.umd.min.js +2 -0
  81. package/dist/ui/zoomus-websdk-editor_de-DE.umd.min.js +1 -0
  82. package/dist/ui/zoomus-websdk-editor_es-ES.umd.min.js +1 -0
  83. package/dist/ui/zoomus-websdk-editor_fr-FR.umd.min.js +1 -0
  84. package/dist/ui/zoomus-websdk-editor_id-ID.umd.min.js +1 -0
  85. package/dist/ui/zoomus-websdk-editor_it-IT.umd.min.js +1 -0
  86. package/dist/ui/zoomus-websdk-editor_ja-JP.umd.min.js +1 -0
  87. package/dist/ui/zoomus-websdk-editor_ko-KR.umd.min.js +1 -0
  88. package/dist/ui/zoomus-websdk-editor_nl-NL.umd.min.js +1 -0
  89. package/dist/ui/zoomus-websdk-editor_pl-PL.umd.min.js +1 -0
  90. package/dist/ui/zoomus-websdk-editor_pt-PT.umd.min.js +1 -0
  91. package/dist/ui/zoomus-websdk-editor_ru-RU.umd.min.js +1 -0
  92. package/dist/ui/zoomus-websdk-editor_tr-TR.umd.min.js +1 -0
  93. package/dist/ui/zoomus-websdk-editor_vi-VN.umd.min.js +1 -0
  94. package/dist/ui/zoomus-websdk-editor_zh-CN.umd.min.js +1 -0
  95. package/dist/ui/zoomus-websdk-editor_zh-TW.umd.min.js +1 -0
  96. package/dist/ui/zoomus-websdk-icons.umd.min.js +1 -0
  97. package/dist/ui/zoomus-websdk-loginview.umd.min.js +1 -0
  98. package/dist/ui/zoomus-websdk-lottie-web.umd.min.js +1 -0
  99. package/dist/ui/zoomus-websdk-lottie.umd.min.js +1 -0
  100. package/dist/ui/zoomus-websdk-main-client.umd.min.js +2 -0
  101. package/dist/ui/zoomus-websdk-preview.umd.min.js +2 -0
  102. package/dist/ui/zoomus-websdk-zoommtgMain.umd.min.js +2 -0
  103. package/dist/zoom-meeting-3.0.0.min.js +2 -0
  104. package/dist/zoom-meeting-embedded-ES5.min.js +2 -0
  105. package/dist/zoomus-websdk-embedded.umd.min.js +2 -0
  106. package/dist/zoomus-websdk.umd.min.js +2 -0
  107. package/embedded.d.ts +1567 -0
  108. package/embedded.js +3 -0
  109. package/index.d.ts +2101 -0
  110. package/index.js +4 -0
  111. package/oss_attribution.txt +6432 -0
  112. package/package.json +53 -0
@@ -0,0 +1,10 @@
1
+ !function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=52)}([function(e,t,r){"use strict";r.r(t),r.d(t,"Audio_Dec_WASM_OK",(function(){return n})),r.d(t,"Audio_Dec_Handle_OK",(function(){return a})),r.d(t,"Audio_Dec_WebSocket_OK",(function(){return i})),r.d(t,"Audio_Enc_WASM_OK",(function(){return o})),r.d(t,"Audio_Enc_Handle_OK",(function(){return s})),r.d(t,"Video_Dec_WASM_OK",(function(){return _})),r.d(t,"Video_Dec_Handle_OK",(function(){return u})),r.d(t,"Video_Dec_WebSocket_OK",(function(){return c})),r.d(t,"Video_Enc_WASM_OK",(function(){return h})),r.d(t,"Video_Enc_Handle_OK",(function(){return d})),r.d(t,"Sharing_Dec_WASM_OK",(function(){return l})),r.d(t,"Sharing_Dec_PICTURE",(function(){return f})),r.d(t,"AUDIO_DELAY",(function(){return p})),r.d(t,"Sharing_Dec_WebSocket_OK",(function(){return g})),r.d(t,"Sharing_Handle_OK",(function(){return m})),r.d(t,"Sharing_Data",(function(){return E})),r.d(t,"DECODE_MESSAGE",(function(){return v})),r.d(t,"Video_Capture_Tick",(function(){return T})),r.d(t,"MONITOR_MESSAGE",(function(){return y})),r.d(t,"SHARING_DECODE_MONITOR_MESSAGE",(function(){return S})),r.d(t,"WORKER_MAIN_VIDEO_ENCODE_RINGBUFFER_TICK",(function(){return b})),r.d(t,"WORKER_MAIN_AUDIO_ENCODE_RINGBUFFER_TICK",(function(){return R})),r.d(t,"WORKER_MAIN_VIDEO_DECODE_RINGBUFFER_TICK",(function(){return M})),r.d(t,"Audio_Encode_Preview_OK",(function(){return A})),r.d(t,"Video_Encode_Preview_OK",(function(){return w})),r.d(t,"QOS_MONITORING",(function(){return I})),r.d(t,"QOS_DEFAULT_POLLING_INTERVAL",(function(){return D})),r.d(t,"VIDEO_MONITOR_LOG_SECOENDS",(function(){return x})),r.d(t,"DOWNLOAD_WASM_FROM_MAIN_THREAD",(function(){return O})),r.d(t,"APP_TROUBLESHOOTING_INFO",(function(){return C})),r.d(t,"DELTA_D",(function(){return k})),r.d(t,"DELTA_C",(function(){return L})),r.d(t,"DELTA_S",(function(){return P})),r.d(t,"WCL_TROUBLESHOOTING_INFO",(function(){return U})),r.d(t,"SHARING_DATA_VIDEO_MODE",(function(){return N})),r.d(t,"MOUSE_DATA_VIDEO_MODE",(function(){return W})),r.d(t,"SHARING_DECODE_MESSAGE",(function(){return F})),r.d(t,"VIDEO_ENCODED_DATA",(function(){return B})),r.d(t,"VIDEO_DROP_RATIO_FROM_WCL",(function(){return G})),r.d(t,"VIDEO_DATA_DROP_RATIO",(function(){return H})),r.d(t,"AUDIO_ENCODED_DATA",(function(){return V})),r.d(t,"THREAD_STATE_IDLE",(function(){return q})),r.d(t,"THREAD_STATE_CREATING",(function(){return K})),r.d(t,"THREAD_STATE_CREATED",(function(){return j})),r.d(t,"THREAD_ENCODE_BUFFER",(function(){return Q})),r.d(t,"WASMPTR",(function(){return X})),r.d(t,"AUDIO_MONITOR_LOG",(function(){return Y})),r.d(t,"WhiteBoard_Video_Capture_Tick",(function(){return z})),r.d(t,"GLOBAL_TRACING_LOG",(function(){return J})),r.d(t,"Audio_Dec_WASM_FAILED",(function(){return Z})),r.d(t,"Audio_Dec_Handle_FAILED",(function(){return $})),r.d(t,"Audio_Dec_WebSocket_FAILED",(function(){return ee})),r.d(t,"Audio_Enc_WASM_FAILED",(function(){return te})),r.d(t,"Audio_Enc_Handle_FAILED",(function(){return re})),r.d(t,"Video_Dec_WASM_FAILED",(function(){return ne})),r.d(t,"Video_Dec_Handle_FAILED",(function(){return ae})),r.d(t,"Video_Dec_WebSocket_FAILED",(function(){return ie})),r.d(t,"Video_Enc_WASM_FAILED",(function(){return oe})),r.d(t,"Video_Enc_Handle_FAILED",(function(){return se})),r.d(t,"Sharing_Dec_WASM_FAILED",(function(){return _e})),r.d(t,"Audio_Mute",(function(){return ue})),r.d(t,"Sharing_Handle_FAILED",(function(){return ce})),r.d(t,"Sharing_Dec_WebSocket_FAILED",(function(){return he})),r.d(t,"AUDIO_CLIPPING",(function(){return de})),r.d(t,"MULTIVIEW_WEBGL_CONTEXT_LOST",(function(){return le})),r.d(t,"WEBGL_CONTEXT_CREATE_FAILED",(function(){return fe})),r.d(t,"MEDIA_VIDEO_REPORT_DROP_RATIO",(function(){return pe})),r.d(t,"MEDIA_S2C_KEEPALIVE",(function(){return ge})),r.d(t,"MEDIA_AUDIO_DATA",(function(){return me})),r.d(t,"MEDIA_AUDIO_RTCP",(function(){return Ee})),r.d(t,"MEDIA_VIDEO_DATA",(function(){return ve})),r.d(t,"MEDIA_VIDEO_RTCP",(function(){return Te})),r.d(t,"MEDIA_NTP_UPDATE",(function(){return ye})),r.d(t,"VIDEO_CAPTURER_RESOLUTION_360P",(function(){return Se})),r.d(t,"VIDEO_CAPTURER_RESOLUTION_720P",(function(){return be})),r.d(t,"CURRENT_VIDEO_RESOLUTION",(function(){return Re})),r.d(t,"VIDEO_RENDER_MONITOR_LOG",(function(){return Me})),r.d(t,"Sharing_Width_And_Height_Info",(function(){return Ae})),r.d(t,"SHARING_RENDER_MONITOR_LOG",(function(){return we})),r.d(t,"SHARING_GET_IMAGE_DATA_WRONG",(function(){return Ie})),r.d(t,"AES_GCM_IV_TO_WASM",(function(){return De})),r.d(t,"AES_GCM_IV_CALLBACK_FROM_WASM",(function(){return xe})),r.d(t,"CURRENT_SSRC_TIME",(function(){return Oe})),r.d(t,"CURRENT_DECODE_VIDEO_QUALITY",(function(){return Ce})),r.d(t,"CURRENT_DECODE_VIDEO_FPS",(function(){return ke})),r.d(t,"CURRENT_CAPTURE_VIDEO_WIDTH_HEIGHT",(function(){return Le})),r.d(t,"CURRENT_DESKTOP_SHARING_WIDTH_HEIGHT",(function(){return Pe})),r.d(t,"SHARING_FIRST_DECODE_FRAME_RECEIVED",(function(){return Ue})),r.d(t,"VIDEO_CAPTURER_RESOLUTION_CHANGE",(function(){return Ne})),r.d(t,"VIDEO_CAPTURE_FRAME_COUNT_STATISTIC",(function(){return We})),r.d(t,"SHARING_CAPTURE_FRAME_COUNT_STATISTIC",(function(){return Fe})),r.d(t,"UNSUPPORTED_SHARING_FORMAT",(function(){return Be})),r.d(t,"UNSUPPORTED_VIDEO_FORMAT",(function(){return Ge})),r.d(t,"FIRST_SHARING_FRAME_FOR_MOBILE",(function(){return He})),r.d(t,"VB_PTHREAD_MODEL_ALL_READY",(function(){return Ve})),r.d(t,"UPDATE_ENCRYPTION_GCM_MODEL_KEY",(function(){return qe})),r.d(t,"CONNECT_WEBTRANSPORT_OK",(function(){return Ke})),r.d(t,"CONNECT_WEBTRANSPORT_CLOSE",(function(){return je})),r.d(t,"CURRENT_MEDIA_DATA_TRANSPORT_TYPE",(function(){return Qe})),r.d(t,"CONNECT_WEBSOCKET_CLOSE",(function(){return Xe})),r.d(t,"CURRENT_ENCODED_TYPE",(function(){return Ye})),r.d(t,"WHITEBOARD_WORKER_MESSAGE",(function(){return ze})),r.d(t,"INTERPRETATION_ENABLE",(function(){return Je})),r.d(t,"INTERPRETATION_SET_LANG",(function(){return Ze})),r.d(t,"INTERPRETATION_MUTE",(function(){return $e})),r.d(t,"INTERPRETATION_SET_INTERPRETER",(function(){return et})),r.d(t,"serverHeartbeatMaxTimeoutSeconds",(function(){return tt})),r.d(t,"RQUEST_ANIMATION_MODE",(function(){return rt})),r.d(t,"SET_INTERVAL_MODE",(function(){return nt})),r.d(t,"VIDEO_INVALID",(function(){return at})),r.d(t,"VIDEO_RGBA",(function(){return it})),r.d(t,"VIDEO_I420",(function(){return ot})),r.d(t,"VIDEO_NV12",(function(){return st})),r.d(t,"VIDEO_BGRA",(function(){return _t})),r.d(t,"EVENT_ROLLBACK_BUFFER",(function(){return ut})),r.d(t,"EVENT_NEEDMORE_DATA",(function(){return ct})),r.d(t,"EVENT_CAPTURE_DATA",(function(){return ht})),r.d(t,"EVENT_CACHE_SIZE",(function(){return dt})),r.d(t,"WEBCODEC_ENCODE_OPEN_FLAG",(function(){return lt})),r.d(t,"VB_SIGNAL_TYPE_SET_BG",(function(){return ft})),r.d(t,"VB_SIGNAL_TYPE_SET_BLUR",(function(){return pt})),r.d(t,"QosSession",(function(){return gt})),r.d(t,"QosConnectType",(function(){return mt})),r.d(t,"MAX_VIDEO_CAPTURE_FPS",(function(){return Et})),r.d(t,"MIN_VIDEO_CAPTURE_FPS",(function(){return vt})),r.d(t,"VIDEO_CAPTURE_FPS",(function(){return Tt})),r.d(t,"VIDEO_CAPTURE_20FPS",(function(){return yt})),r.d(t,"DOWN_VIDEO_CAPTURE_FPS",(function(){return St})),r.d(t,"LOWER_VIDEO_CAPTURE_FPS",(function(){return bt})),r.d(t,"VIDEO_DATA_MAX_SIZE",(function(){return Rt})),r.d(t,"SHARING_NULL",(function(){return Mt})),r.d(t,"SHARING_NORMAL",(function(){return At})),r.d(t,"SHARING_VIDEO_MODE",(function(){return wt})),r.d(t,"SHARING_VIDEO_MODE_CAPTURED_FPS",(function(){return It})),r.d(t,"SHARING_NORMAL_MODE_CAPTURED_FPS",(function(){return Dt})),r.d(t,"VIDEO_RINGBUF_PKG_NUM",(function(){return xt})),r.d(t,"NETWORK_QUALITY_CHANGE",(function(){return Ot})),r.d(t,"ADDITIONNAL_MULTITHREAD_NUMBER_ENCODE_FOR_360P",(function(){return Ct})),r.d(t,"ADDITIONNAL_MULTITHREAD_NUMBER_ENCODE_FOR_720P",(function(){return kt})),r.d(t,"WCL_PLATFORM_TYPE",(function(){return Lt})),r.d(t,"RENDER_MODE_RAF",(function(){return Pt})),r.d(t,"RENDER_MODE_INTERVAL",(function(){return Ut}));var n=1,a=2,i=3,o=4,s=5,_=7,u=8,c=9,h=10,d=11,l=12,f=13,p=14,g=15,m=16,E=17,v=18,T=20,y=21,S=3021,b=22,R=23,M=24,A=26,w=27,I="QosMonitoring",D=1e3,x=5,O=30,C=31,k=32,L=33,P=34,U=35,N=36,W=37,F=38,B=39,G=40,H=41,V=42,q=43,K=44,j=45,Q=46,X=47,Y=48,z=60,J=61,Z=-1,$=-2,ee=-3,te=-4,re=-5,ne=-7,ae=-8,ie=-9,oe=-10,se=-11,_e=-12,ue=-13,ce=-14,he=-15,de=-23,le=-26,fe=-27,pe=100,ge=0,me=1,Ee=6,ve=2,Te=7,ye=9,Se=10,be=11,Re=50,Me=51,Ae=52,we=53,Ie=54,De=55,xe=56,Oe=57,Ce=66.5,ke=66.6,Le=67,Pe=68,Ue=69,Ne=71,We=72,Fe=73,Be=75,Ge=76,He=78,Ve=95,qe=102,Ke=105,je=106,Qe=107,Xe=108,Ye=109,ze=120,Je=0,Ze=1,$e=2,et=3,tt=65,rt=0,nt=1,at=-1,it=0,ot=1,st=2,_t=3,ut=0,ct=1,ht=2,dt=3,lt=!0,ft=0,pt=1,gt={SESSION_TYPE_CONF:0,SESSION_TYPE_AUDIO:1,SESSION_TYPE_DESKSHARE:2,SESSION_TYPE_VIDEO:3,SESSION_TYPE_CHAT:4,SESSION_TYPE_TELEPHONE:5,SESSION_TYPE_ZC_PING:6,SESSION_TYPE_TOTAL_CNT:7},mt={CONNECT_TYPE_UDP:0,CONNECT_TYPE_TCP:1},Et=30,vt=1,Tt=24,yt=20,St=15,bt=10,Rt=8294400,Mt=0,At=1,wt=2,It=15,Dt=5,xt=400,Ot="NETWORK_QUALITY_CHANGE",Ct=3,kt=7,Lt={DESKTOP:0,MOBILE:1,ANDROID:2,IPHONE:3},Pt=0,Ut=1},function(e,t,r){"use strict";r.d(t,"g",(function(){return d})),r.d(t,"e",(function(){return l})),r.d(t,"d",(function(){return f})),r.d(t,"i",(function(){return p})),r.d(t,"f",(function(){return g})),r.d(t,"h",(function(){return T})),r.d(t,"a",(function(){return S})),r.d(t,"c",(function(){return b})),r.d(t,"b",(function(){return A})),r.d(t,"j",(function(){return C}));var n=r(5),a=r.n(n),i=r(2),o=r.n(i),s=r(3),_=r.n(s),u=r(4),c=r.n(u),h=r(0);function d(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;postMessage({status:h.GLOBAL_TRACING_LOG,errorMessage:e,errorEvent:t})}function l(e){postMessage({status:h.WCL_TROUBLESHOOTING_INFO,data:e})}function f(e){postMessage({status:h.AUDIO_MONITOR_LOG,data:e})}function p(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];postMessage({status:h.MULTIVIEW_WEBGL_CONTEXT_LOST,canvasId:e,replaceCanvas:t})}function g(e){postMessage({status:h.WEBGL_CONTEXT_CREATE_FAILED,canvasId:e})}function m(e){return e.split("/").pop().split("?")[0].split("#")[0]}var E=0,v=!1;try{v=__ENABLE_LOG__}catch(e){}function T(e,t,r,n,a,i,o){var s,_,u,c;if(l("instantiateCachedURL"),a)u=i,c=o;else if(s=self.wasmSuccessEvent,_=self.wasmFailEvent,u=self.databaseName,c=self.databaseDataType,m(t).includes("audio")){var p={};p.databaseName=u,p.databaseDataType=c,p.dbVersion=e,p.url=t,postMessage({status:"AUDIO_WASM_INFO",data:p})}function g(e,t){return l("fetch_wasm"),function(e){var t=self;return new Promise((function(r,n){t.addEventListener("message",(function(e){var t=e.data;"DOWNLOAD_WASM_FROM_MAIN_THREAD_OK"===t.command&&(l("DE"),r(t.data)),"DOWNLOAD_WASM_FROM_MAIN_THREAD_FAILED"===t.command&&n(t.data)})),l("DS"),postMessage({status:h.DOWNLOAD_WASM_FROM_MAIN_THREAD,url:e})}))}(e)}function y(t){return l("fetchAndInstantiate"+t),new Promise((function(i,o){try{if(indexedDB&&!v){var s,_=void 0===IDBTransaction.READ_WRITE?"readwrite":IDBTransaction.READ_WRITE,h=indexedDB.open(u,e);h.onerror=function(e){l("request error");var n=indexedDB.deleteDatabase(u);n.onerror=function(e){l("rt error"),console.log("Error deleting database")},n.onsuccess=function(e){l("rt success"),console.log("Database deleted successfully")},i(!a&&g(t).then((function(e){l("CS");var t=WebAssembly.instantiate(e,r);return l("CE"),t})))},h.onsuccess=function(e){if(l("request success"),!(s=e.target.result).objectStoreNames.contains("file"))return a?void i(!1):void i(g(t).then((function(e){l("CS");var t=WebAssembly.instantiate(e,r);l("CE");try{s.objectStoreNames.contains("file")||indexedDB.deleteDatabase(u)}catch(e){}return t})));var o=s.transaction(["file"],_).objectStore("file").get(c);o.onsuccess=function(e){if(l("getRet success"),o.result&&!n){l("result ok");var u=e.target.result;if(a)return i(u);l("CS");var h=WebAssembly.instantiate(u,r);return l("CE"),i(h)}l("result null"),i(!a&&g(t).then((function(e){s.transaction(["file"],_).objectStore("file").put(e,c),l("CS");var t=WebAssembly.instantiate(e,r);return l("CE"),t})))},o.onerror=function(e){l("getRet error"),i(!a&&g(t).then((function(e){l("CS");var t=WebAssembly.instantiate(e,r);return l("CE"),t})))}},h.onupgradeneeded=function(e){var t;l("request upgradeneeded"),(t=e.target.result).objectStoreNames.contains("file")&&t.deleteObjectStore("file"),t.createObjectStore("file")}}else{if(l("indexedDB null"),a)return void i(!1);i(g(t).then((function(e){l("CS");var t=WebAssembly.instantiate(e,r);return l("CE"),t})))}}catch(e){if(f("error"),a)return void i(!1);i(g(t).then((function(e){l("CS");var t=WebAssembly.instantiate(e,r);return l("CE"),t})))}}))}function S(e){!function(e,t){var r=e.exports;Module.asm=r,registerTLSInit(Module.asm._emscripten_tls_init),wasmTable=Module.asm.__indirect_function_table,addOnInit(Module.asm.__wasm_call_ctors),wasmModule=t,ENVIRONMENT_IS_PTHREAD||removeRunDependency("wasm-instantiate")}(e.instance,e.module)}function b(e){var t;t=e.instance,e.module,Module.asm=t.exports,wasmMemory=Module.asm.memory,updateGlobalBufferAndViews(wasmMemory.buffer),wasmTable=Module.asm.__indirect_function_table,addOnInit(Module.asm.__wasm_call_ctors),removeRunDependency("wasm-instantiate")}return a?y(t):y(t).then((function(e){var r,n,a=m(t)||"";E=0,a.includes("video.mt")?S(e):a.includes("video")?b(e):(r=e.instance,n=r.exports,Module.asm=n,wasmTable=Module.asm.__indirect_function_table,addOnInit(Module.asm.__wasm_call_ctors),removeRunDependency("wasm-instantiate")),self.Fetch_WASM_OK=!0,postMessage({status:s})})).catch((function(n){d("Failed to instantiate WASM ".concat(t),n),n&&n instanceof WebAssembly.CompileError&&E<3?(E++,T(e,t,r,!0)):postMessage({status:_})}))}function y(){var e=this;this.promise=new Promise((function(t,r){e.reject=r,e.resolve=t}))}var S=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15e5;o()(this,e),this.uint8Map={},this.availableIndex=[],this.capacity=t,this.bytesPerElement=r,this.avaiableIndexMap={},this.deferedList=[];for(var n=0;n<t;n++)this.uint8Map[n]=new Uint8Array(r),this.availableIndex.push(n),this.avaiableIndexMap[n]=!0}return _()(e,[{key:"increaseBufferSize",value:function(e){var t=this.bytesPerElement+e;this.bytesPerElement=t;for(var r=0;r<this.capacity;r++){var n=this.uint8Map[r],a=new Uint8Array(t);a.set(n,0),this.uint8Map[r]=a}}},{key:"getCapacity",value:function(){return this.capacity}},{key:"get",value:function(){var e=this;if(this.availableIndex.length>0){var t=this.availableIndex.shift();return this.avaiableIndexMap[t]=!1,new Promise((function(r,n){r({index:t,uint8s:e.uint8Map[t]})}))}var r=new y;return this.deferedList.push(r),r.promise}},{key:"getSync",value:function(){if(this.availableIndex.length>0){var e=this.availableIndex.shift();return this.avaiableIndexMap[e]=!1,{index:e,uint8s:this.uint8Map[e]}}return null}},{key:"recycle",value:function(e){!0!==this.avaiableIndexMap[e]&&(this.avaiableIndexMap[e]=!0,this.availableIndex.push(e),this.deferedList.length>0&&this.deferedList.shift().resolve(this.get()))}}]),e}(),b=function(){function e(t){o()(this,e),this.sharedBufferList=t}return _()(e,[{key:"storeFlexible",value:function(e,t){var r=e.byteLength-this.sharedBufferList.bytesPerElement;if(r>0){var n=Math.floor(.1*this.sharedBufferList.bytesPerElement),a=r>n?r:n;if(a+this.sharedBufferList.bytesPerElement>t)return Promise.reject("too big, more than maxBytesPerElement");this.sharedBufferList.increaseBufferSize(a)}return this.store(e)}},{key:"store",value:function(e){var t=this;return this.sharedBufferList.get().then((function(r){try{return t.obj=r,r.uint8s.set(e,0),t.yuvdata=new Uint8Array(r.uint8s.buffer,0,e.byteLength),!0}catch(e){throw e}finally{t.autoRecycle()}}))}},{key:"storeSync",value:function(e){var t=this.sharedBufferList.getSync();return null!==t&&(this.obj=t,t.uint8s.set(e,0),this.yuvdata=new Uint8Array(t.uint8s.buffer,0,e.byteLength),!0)}},{key:"autoRecycle",value:function(){var e=this;this.autoRecycleInterval=setTimeout((function(){console.log("autoRecycle",e.obj.index),e.recycle()}),5e3)}},{key:"recycle",value:function(){try{this.autoRecycleInterval&&clearInterval(this.autoRecycleInterval),this.sharedBufferList.recycle(this.obj.index)}catch(e){d("Error in YuvWrap.recycle: ".concat(e))}}}]),e}();function R(e,t){t>=e.groupSize||(e.openStatusArray[t]=!0,e.openedCount+=1,e.openedCount>1||e.params.onopen(e))}function M(e,t){t>=e.groupSize||(e.openStatusArray[t]=!1,e.openedCount>0&&(e.openedCount-=1,0==e.openedCount&&e.params.onclose(e)))}var A=function(){function e(t){o()(this,e),this.params=t,this.label=this.params.label||"",this.groupSize=t.groupSize,this.openedCount=0,this.sendIndex=0,this.transportArray=[],this.openStatusArray=[];for(var r=0;r<this.groupSize;r++)this.transportArray.push(null),this.openStatusArray.push(!1)}var t;return _()(e,[{key:"connect",value:(t=a()(c.a.mark((function e(){var t,r,n,a;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=0;case 1:if(!(t<this.groupSize)){e.next=12;break}return r=this.params.url,t>0&&(r+="&index="+t),n={url:r,label:this.params.label,onmessage:this.params.onmessage,onopen:R,onclose:M,group:this,index:t},a=new w(n),e.next=8,a.connect();case 8:this.transportArray[t]=a;case 9:t++,e.next=1;break;case 12:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"send",value:function(e){if(!(this.openedCount<=0))for(var t=0;t<this.groupSize;t++){this.sendIndex+=1;var r=this.sendIndex%this.groupSize;if(this.transportArray[r]&&this.openStatusArray[r]){this.transportArray[r].send(e);break}}}},{key:"forceClose",value:function(){for(var e=0;e<this.groupSize;e++)this.transportArray[e]&&this.transportArray[e].forceClose()}}]),e}(),w=function(){function e(t){o()(this,e),this.params=t,this.label=this.params.label||"",this.successfulConnectedCount=0,this.connectIndex=0,this.heartbeat=new Uint8Array([104,101,97,114,116,98,101,97,116]),this.transport=null,this.transport_ready=!1,this.isDestroyed=!1}var t,r,n,i,s;return _()(e,[{key:"connect",value:(s=a()(c.a.mark((function e(){return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.reconnect();case 1:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"reconnect",value:(i=a()(c.a.mark((function e(){var t,r=this;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(this.isReconnectNow||this.isTimerExist||this.isDestroyed)){e.next=2;break}return e.abrupt("return");case 2:this.isReconnectNow=!0,this.isTimerExist=!0,t=Math.pow(2,this.connectIndex)-1,this.connectIndex+=1,setTimeout(a()(c.a.mark((function e(){var t,n;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!r.isDestroyed){e.next=2;break}return e.abrupt("return");case 2:return r.isTimerExist=!1,t=r.params.url,n=new WebTransport(t),r.transport=n,n.closed.then((function(){r.transport_ready=!1,r.params.onclose&&r.params.onclose(r.params.group,r.params.index)})).catch((function(e){r.transport_ready=!1,r.params.onerror&&r.params.onerror(e),r.params.onclose(r.params.group,r.params.index),r.connectIndex<8&&r.reconnect()})),e.prev=7,r.isReconnectNow=!1,e.next=11,n.ready;case 11:if(!r.isDestroyed){e.next=14;break}return r.close(),e.abrupt("return");case 14:return r.transport_ready=!0,r.successfulConnectedCount++,n.datagrams.incomingMaxAge=1e3,n.datagrams.outgoingMaxAge=100,n.datagrams.incomingHighWaterMark=800,n.datagrams.outgoingHighWaterMark=800,r.writer=n.datagrams.writable.getWriter(),r.reader=n.datagrams.readable.getReader(),e.next=24,r.writer.ready;case 24:r.params.onopen(r.params.group,r.params.index),e.next=32;break;case 27:return e.prev=27,e.t0=e.catch(7),r.params.onerror&&r.params.onerror(e.t0),r.close(),e.abrupt("return");case 32:r.startHeartbeat(),r.read();case 34:case"end":return e.stop()}}),e,null,[[7,27]])}))),1e3*t);case 7:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"send",value:function(e){this.writer.write(e)}},{key:"sendAwaitReady",value:(n=a()(c.a.mark((function e(t){return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.writer.ready;case 2:return e.next=4,this.writer.write(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"startHeartbeat",value:(r=a()(c.a.mark((function e(){return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=3,this.sleep(3e3);case 3:return e.next=5,this.sendAwaitReady(this.heartbeat);case 5:e.next=0;break;case 7:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"sleep",value:function(e){return new Promise((function(t){return setTimeout(t,e)}))}},{key:"localTime",value:function(){var e=new Date;return"local time : "+e.getDate()+"/"+(e.getMonth()+1)+"/"+e.getFullYear()+" @ "+e.getHours()+":"+e.getMinutes()+":"+e.getSeconds()+" "}},{key:"close",value:function(){this.transport_ready=!1,this.transport&&this.transport.close()}},{key:"forceClose",value:function(){this.isDestroyed=!0,this.close()}},{key:"read",value:(t=a()(c.a.mark((function e(){var t,r,n;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=this.reader;case 1:return e.next=4,t.read();case 4:if(r=e.sent,n=r.value,!r.done){e.next=9;break}return e.abrupt("break",12);case 9:this.params.onmessage(n),e.next=1;break;case 12:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),e}(),I=function(){function e(){o()(this,e),this.ssrcInfoMap=new Map,this.timer=null}return _()(e,[{key:"updateSSRCInfo",value:function(e,t){this.ssrcInfoMap.has(e)||this.ssrcInfoMap.set(e,{timeList:[],lastTime:0,fps:0}),this._calculateFPS(e,t),this._removeZeroFPS()}},{key:"_calculateFPS",value:function(e,t){var r=this.ssrcInfoMap.get(e);if(r.timeList.push(t),r.lastTime=t,r.timeList.length>2&&r.timeList.length%5==0){var n=r.timeList[0],a=r.timeList[r.timeList.length-1];if(a-n>=1e3){var i=Math.floor(1e3/((a-n)/(r.timeList.length-1)));r.fps!==i&&(this._notifyFPS(e,i),r.fps=i),r.timeList=[]}}r.timeList.length>30&&(r.timeList=r.timeList.slice(r.timeList.length-30))}},{key:"_removeZeroFPS",value:function(){var e=this;this.ssrcInfoMap.forEach((function(t,r){var n=e.ssrcInfoMap.get(r);n&&Date.now()-n.lastTime>2e3&&(e.ssrcInfoMap.delete(r),e._notifyFPS(r,0))}))}},{key:"_notifyFPS",value:function(e,t){postMessage({status:h.CURRENT_DECODE_VIDEO_FPS,data:{ssrc:e,fps:t}})}},{key:"_checkIfNewFrameComing",value:function(){var e=this;this.timer&&(clearTimeout(this.timer),this.timer=null),this.timer=setTimeout((function(){e._removeZeroFPS(),e.timer=null}),2500)}}]),e}(),D=new Map,x=[90,180,360,720],O=new I;function C(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=e.r_w,a=e.r_h,i=e.rotation,o=e.ssrc,s=1==i||3==i,_=s?a:n,u=s?n:a,c=o>>10<<10,d=x.reduce((function(e,t){return Math.abs(e-u)>Math.abs(t-u)?t:e}),x[0]),l=x.findIndex((function(e){return e===d}));if(!D.get(c)||D.get(c).width!==_||D.get(c).height!==u){var f={width:_,height:u,ssrc:c,quality:l};D.set(c,f),r?r(f):postMessage({status:h.CURRENT_DECODE_VIDEO_QUALITY,data:f})}t&&O.updateSSRCInfo(c,Date.now())}},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){var n=r(19);function a(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,n(a.key),a)}}e.exports=function(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){var n=r(28)();e.exports=n;try{regeneratorRuntime=n}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},function(e,t){function r(e,t,r,n,a,i,o){try{var s=e[i](o),_=s.value}catch(e){return void r(e)}s.done?t(_):Promise.resolve(_).then(n,a)}e.exports=function(e){return function(){var t=this,n=arguments;return new Promise((function(a,i){var o=e.apply(t,n);function s(e){r(o,a,i,s,_,"next",e)}function _(e){r(o,a,i,s,_,"throw",e)}s(void 0)}))}},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";function n(){this.a=[],this.b=0,this.residue=null}n.prototype.getLength=function(){return this.a.length-this.b},n.prototype.isEmpty=function(){return 0==this.a.length},n.prototype.enqueue=function(e){this.a.push(e)},n.prototype.dequeue=function(){if(0!=this.a.length){var e=this.a[this.b];return 2*++this.b>=this.a.length&&(this.a=this.a.slice(this.b),this.b=0),e}return null},n.prototype.peek=function(){return 0<this.a.length?this.a[this.b]:void 0},n.prototype.clear=function(){this.a=[],this.b=0},t.a=n},function(e,t,r){var n=r(19);e.exports=function(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return s})),r.d(t,"c",(function(){return _}));var n,a=r(7),i=r.n(a),o={VIDEO_ENCODE:"0",VIDEO_DECODE:"1",AUDIO_ENCODE:"2",AUDIO_DECODE:"3",SHARING_ENCODE:"4",SHARING_DECODE:"5"},s={SET_USER_NODE_LIST:"SET_USER_NODE_LIST"},_=(n={},i()(n,o.AUDIO_ENCODE,"audio.encode"),i()(n,o.AUDIO_DECODE,"audio.decode"),i()(n,o.VIDEO_ENCODE,"video.encode"),i()(n,o.VIDEO_DECODE,"video.decode"),i()(n,o.SHARING_ENCODE,"share.encode"),i()(n,o.SHARING_DECODE,"share.decode"),n)},function(e,t,r){"use strict";var n=r(12),a=r.n(n),i=r(0);function o(e,t,r,n,a,s){if(this.canvasElement=e,this.contextOptions=n,this.glInitSucceed=0,this.textureindex=t||0,this.texturestride=this.textureindex?3:s?4:6,this.initmask=s||!1,o.prototype.ROTATION_CLOCK0=0,o.prototype.ROTATION_CLOCK90=1,o.prototype.ROTATION_CLOCK180=2,o.prototype.ROTATION_CLOCK270=3,a?this.contextGL=a.contextgl:this.initContextGL(),this.contextGL){this.webGLContextLostProtect(),a?(this.shaderProgram=a.program,this.waterMarkTextureRef=a.waterMarkTextureRef,this.repeatedWaterMarkTextureRef=a.repeatedWaterMarkTextureRef,this.initTextures(!1),this.vertexPosBuffer=a.vBuffer,this.texturePosBuffer=a.tBuffer):(this.initProgram(),this.initmask?this.initTextures(!1):this.initTextures(!0),this.initBuffers());var _=new ArrayBuffer(4);this.dummpyCursor=new Uint8Array(_),this.dummpyWaterMark=new Uint8Array(_);var u=this.contextGL.getError();this.glInitSucceed=u!=this.contextGL.NO_ERROR&&u!=this.contextGL.CONTEXT_LOST_WEBGL?0:1,this.cursorWidth=0,this.cursorHeight=0,this.hasCursor=0,this.hasWaterMark=0,this.watermarkOpacity=.15,this.watermarkData=null,this.watermarkWidth=0,this.watermarkHeight=0,this.isMultiView=!1,this.hasWholeFrame=0,this.croppingParams={},this.croppingParams.top=0,this.croppingParams.left=0,this.croppingParams.width=0,this.croppingParams.height=0,this.textureWidth=0,this.textureHeight=0,this.canvasWidth=0,this.canvasHeight=0,this.picRotation=-1,this.bgColor=[0,0,0],this.cx=0,this.cy=0,this.cw=0,this.ch=0,this.colorRange=-1,this.videoMode=i.VIDEO_INVALID,this.rotation=this.ROTATION_CLOCK0,this.fillMode=0,this.fillModeForResolution=0}}function s(e,t,r,n){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=e.contextGL,o=i.canvas.width,s=i.canvas.height;a&&(o=a.width,s=a.height);var _,u,c,h,d=n==e.ROTATION_CLOCK90||n==e.ROTATION_CLOCK270?r:t,l=n==e.ROTATION_CLOCK90||n==e.ROTATION_CLOCK270?t:r,f=d/l*s,p=l/d*o;f>o?(_=0,c=1,h=1-(u=(s-p)/2/s)):(u=0,h=1,c=1-(_=(o-f)/2/o)),_=2*_-1,c=2*c-1,u=1-2*u,h=1-2*h;var g=new Float32Array([c,u,_,u,c,h,_,h,c,u,_,u,c,h,_,h]);i.bindBuffer(i.ARRAY_BUFFER,e.vertexPosBuffer),i.bufferData(i.ARRAY_BUFFER,g,i.DYNAMIC_DRAW)}function _(e,t,r,n,i){var o=e.contextGL,s=n.top/r,_=n.left/t,u=s+(n.height-1)/r,c=_+n.width/t,h=[_,s,c,s,c,u,_,u];i==e.ROTATION_CLOCK90&&(h.unshift(h[6],h[7]),h=h.slice(0,8)),i==e.ROTATION_CLOCK180&&(h.unshift(h[4],h[5],h[6],h[7]),h=h.slice(0,8)),i==e.ROTATION_CLOCK270&&(h.push(h[0],h[1]),h=h.slice(2));var d=h[0],l=h[1];h[0]=h[2],h[1]=h[3],h[2]=d,h[3]=l;var f=new Float32Array([].concat(a()(h),[1,0,0,0,1,1,0,1]));o.bindBuffer(o.ARRAY_BUFFER,e.texturePosBuffer),o.bufferData(o.ARRAY_BUFFER,f,o.DYNAMIC_DRAW)}o.prototype.webGLContextLostSimulate=function(){var e="undefined"==typeof window?self:window;e.webGLEXTSimulate=e.webGLEXTSimulate||[],e.webGLEXTSimulate.push(this.contextGL.getExtension("WEBGL_lose_context")),console.log("\n webGLEXTSimulate[0].loseContext()\n webGLEXTSimulate[0].restoreContext()\n ")},o.prototype.webGLContextLostProtect=function(){var e=this;if(this.contextOptions){var t=this.canvasElement;t.addEventListener("webglcontextlost",(function(t){console.log("webglcontextlost",t),t.preventDefault(),e.contextOptions&&e.contextOptions.webglcontextlostCallback&&e.contextOptions.webglcontextlostCallback(t,e.contextOptions.params)}),{capture:!1,once:!0}),t.addEventListener("webglcontextrestored",(function(t){console.log("webglcontextrestored",t),e.contextOptions&&e.contextOptions.webglcontextrestoredCallback&&e.contextOptions.webglcontextrestoredCallback(t,e.contextOptions.params)}),{capture:!1,once:!0})}},o.prototype.isWebGL=function(){return this.contextGL},o.prototype.initContextGL=function(){for(var e=this.canvasElement,t=null,r=["webgl","experimental-webgl","moz-webgl","webkit-3d"],n=0;!t&&n<r.length;){var a=r[n];try{t=this.contextOptions?e.getContext(a,this.contextOptions):e.getContext(a)}catch(e){t=null}t&&"function"==typeof t.getParameter||(t=null),++n}this.contextGL=t},o.prototype.initProgram=function(){var e=this.contextGL,t=["attribute vec4 vertexPos;","attribute vec4 texturePos;","attribute vec4 masktexturePos;","varying vec2 textureCoord;","varying vec2 masktextureCoord;","void main()","{","gl_Position = vertexPos;","textureCoord = texturePos.xy;","masktextureCoord = masktexturePos.xy;","}"].join("\n"),r=["precision highp float;","varying highp vec2 textureCoord;","varying highp vec2 masktextureCoord;","uniform sampler2D ySampler;","uniform sampler2D uSampler;","uniform sampler2D vSampler;","uniform sampler2D cursorSampler;","uniform sampler2D waterMarkSampler;","uniform sampler2D previewVideoSampler;","uniform sampler2D maskSampler;","uniform vec4 cursorInfo;","uniform int onlyRGBA;","uniform int bgraMode;","uniform int colorRange;","uniform int waterMarkFlag;","uniform int cursorFlag;","uniform int maskFlag;","uniform int yuvmode;","const mat4 YUV2RGB_L = mat4","(","1.1643828125, 0, 1.59602734375, -.87078515625,","1.1643828125, -.39176171875, -.81296875, .52959375,","1.1643828125, 2.017234375, 0, -1.081390625,","0, 0, 0, 1",");","const mat4 YUV2RGB_F = mat4","(","1.0, 0, 1.402, -.701,","1.0, -.34413, -.71414, .529135,","1.0, 1.772, 0, -.886,","0, 0, 0, 1",");","void main(void) {","vec4 c;","if(waterMarkFlag!=1) {","if(onlyRGBA==0){","highp float y = texture2D(ySampler, textureCoord).r;","highp float u;","highp float v;","if(yuvmode==1){","u = texture2D(uSampler, textureCoord).r;","v = texture2D(vSampler, textureCoord).r;","}","else{","u = texture2D(uSampler, textureCoord).r;","v = texture2D(uSampler, textureCoord).a;","}","if (colorRange == 0)","{"," c = vec4(y, u, v, 1) * YUV2RGB_L;","} else {"," c = vec4(y, u, v, 1) * YUV2RGB_F;","}","if(cursorFlag==1)","{","if (cursorInfo.z > 0.0 && textureCoord.x >= cursorInfo.x && textureCoord.y >= cursorInfo.y && "," textureCoord.x < cursorInfo.x+cursorInfo.z && textureCoord.y < cursorInfo.y+cursorInfo.w ){"," vec2 cursorCoord = textureCoord - cursorInfo.xy;"," cursorCoord /= cursorInfo.zw;"," vec4 cursor = texture2D(cursorSampler, cursorCoord);"," c = c*(1.0-cursor.a) + cursor*cursor.a;","}","}","}","else{"," c = texture2D(previewVideoSampler, textureCoord);","if(bgraMode==1)","{"," c = vec4(c.b, c.g, c.r, c.a);","}","}","}","if(waterMarkFlag==1)","{"," c = texture2D(waterMarkSampler, textureCoord);","if(c.r == 0.0 && c.g == 0.0 && c.b == 0.0){"," c.a = 0.0;","}","}","if(maskFlag==1 && waterMarkFlag!=1)","{","vec4 mask = texture2D(maskSampler, masktextureCoord);","if(mask.r != 0.0 || mask.g != 0.0 || mask.b != 0.0){","c = mask* mask.a+ c*(1.0-mask.a);","}","}","if (waterMarkFlag!=1){","c.a = 1.0;","}","gl_FragColor = c;","}"].join("\n"),n=e.createShader(e.VERTEX_SHADER);e.shaderSource(n,t),e.compileShader(n),e.getShaderParameter(n,e.COMPILE_STATUS)||e.isContextLost()||console.log("Vertex shader failed to compile: "+e.getShaderInfoLog(n));var a=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(a,r),e.compileShader(a),e.getShaderParameter(a,e.COMPILE_STATUS)||e.isContextLost()||console.log("Fragment shader failed to compile: "+e.getShaderInfoLog(a));var i=e.createProgram();e.attachShader(i,n),e.attachShader(i,a),e.linkProgram(i),e.getProgramParameter(i,e.LINK_STATUS)||e.isContextLost()||console.log("Program failed to compile: "+e.getProgramInfoLog(i)),e.useProgram(i),this.shaderProgram=i},o.prototype.initBuffers=function(){var e=this.contextGL,t=this.shaderProgram,r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,1,-1,1,1,-1,-1,-1,1,1,-1,1,1,-1,-1,-1]),e.STATIC_DRAW);var n=e.getAttribLocation(t,"vertexPos");e.enableVertexAttribArray(n),e.vertexAttribPointer(n,2,e.FLOAT,!1,0,0),this.vertexPosBuffer=r;var a=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,a),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1,1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var i=e.getAttribLocation(t,"texturePos");if(e.enableVertexAttribArray(i),e.vertexAttribPointer(i,2,e.FLOAT,!1,0,0),this.initmask&&!this.masktexturePosBuffer){var o=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,o),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var s=e.getAttribLocation(t,"masktexturePos");e.enableVertexAttribArray(s),e.vertexAttribPointer(s,2,e.FLOAT,!1,0,0),this.masktexturePosBuffer=o}this.texturePosBuffer=a},o.prototype.initTextures=function(e){var t=this.contextGL,r=this.shaderProgram;t.pixelStorei(t.UNPACK_ALIGNMENT,1);var n=this.initTexture();this.yTextureRef=n;var a=this.initTexture();this.uTextureRef=a;var o=this.initTexture();if(this.vTextureRef=o,e){this.BindTextures(i.VIDEO_I420);var s=this.initTexture(),_=t.getUniformLocation(r,"cursorSampler");t.uniform1i(_,this.textureindex*this.texturestride+3),this.cursorTextureRef=s;var u=this.initTexture(),c=t.getUniformLocation(r,"waterMarkSampler");t.uniform1i(c,4),this.waterMarkTextureRef=u;var h=this.initTexture();this.repeatedWaterMarkTextureRef=h;var d=this.initTexture(),l=t.getUniformLocation(r,"previewVideoSampler");t.uniform1i(l,this.textureindex*this.texturestride+5),this.previewVideoTextureRef=d;var f=t.getUniformLocation(r,"cursorInfo");this.cursorInfoRef=f}if(this.initmask){t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,1);var p=this.initTexture(),g=t.getUniformLocation(r,"maskSampler");t.uniform1i(g,this.textureindex*this.texturestride+6),this.maskTextureRef=p}var m=t.getUniformLocation(r,"colorRange");this.colorRangeRef=m,this.onlyRGBARef=t.getUniformLocation(r,"onlyRGBA"),this.bgraModeRef=t.getUniformLocation(r,"bgraMode"),this.waterMarkFlagRef=t.getUniformLocation(r,"waterMarkFlag"),this.maskFlagRef=t.getUniformLocation(r,"maskFlag"),this.cursorFlagRef=t.getUniformLocation(r,"cursorFlag"),this.yuvmodeRef=t.getUniformLocation(r,"yuvmode")},o.prototype.BindTextures=function(e){var t=this.contextGL,r=this.shaderProgram;if(t.pixelStorei(t.UNPACK_ALIGNMENT,1),t.activeTexture(t.TEXTURE0+0),t.bindTexture(t.TEXTURE_2D,this.yTextureRef),t.activeTexture(t.TEXTURE0+1),t.bindTexture(t.TEXTURE_2D,this.uTextureRef),t.activeTexture(t.TEXTURE0+2),t.bindTexture(t.TEXTURE_2D,this.vTextureRef),e==i.VIDEO_I420){var n=t.getUniformLocation(r,"ySampler");t.uniform1i(n,0);var a=t.getUniformLocation(r,"uSampler");t.uniform1i(a,1);var o=t.getUniformLocation(r,"vSampler");t.uniform1i(o,2)}else if(this.isRGBAMode(e)){var s=t.getUniformLocation(r,"previewVideoSampler");t.uniform1i(s,0);var _=t.getUniformLocation(r,"ySampler");t.uniform1i(_,0);var u=t.getUniformLocation(r,"uSampler");t.uniform1i(u,0);var c=t.getUniformLocation(r,"vSampler");t.uniform1i(c,0)}else if(e==i.VIDEO_NV12){var h=t.getUniformLocation(r,"ySampler");t.uniform1i(h,0);var d=t.getUniformLocation(r,"uSampler");t.uniform1i(d,1);var l=t.getUniformLocation(r,"vSampler");t.uniform1i(l,0)}var f=t.getUniformLocation(r,"previewVideoSampler");t.uniform1i(f,0);var p=t.getUniformLocation(r,"maskSampler");this.initmask?(t.activeTexture(t.TEXTURE0+6),t.bindTexture(t.TEXTURE_2D,this.maskTextureRef),t.uniform1i(p,6)):t.uniform1i(p,0);var g=t.getUniformLocation(r,"cursorSampler");t.uniform1i(g,0);var m=t.getUniformLocation(this.shaderProgram,"waterMarkSampler");t.uniform1i(m,0)},o.prototype.initTexture=function(){var e=this.contextGL,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),t},o.prototype.clearDisplay=function(){var e=this.contextGL;e&&(e.enable(e.BLEND),e.blendFunc(e.ZERO,e.ZERO)),this.render()},o.prototype.cleanup=function(){var e=this.contextGL;e&&this.glInitSucceed&&(e.deleteProgram(this.program),e.activeTexture(e.TEXTURE0+this.textureindex*this.texturestride),e.bindTexture(e.TEXTURE_2D,null),e.activeTexture(e.TEXTURE1+this.textureindex*this.texturestride),e.bindTexture(e.TEXTURE_2D,null),e.activeTexture(e.TEXTURE2+this.textureindex*this.texturestride),e.bindTexture(e.TEXTURE_2D,null),this.textureindex||this.initmask||(e.activeTexture(e.TEXTURE3+this.textureindex*this.texturestride),e.bindTexture(e.TEXTURE_2D,null),e.activeTexture(e.TEXTURE4+this.textureindex*this.texturestride),e.bindTexture(e.TEXTURE_2D,null),e.activeTexture(this.GetRepeatedWatermarkTextureValue(e)),e.bindTexture(e.TEXTURE_2D,null),e.activeTexture(e.TEXTURE5+this.textureindex*this.texturestride),e.bindTexture(e.TEXTURE_2D,null)),e.bindBuffer(e.ARRAY_BUFFER,null),e.deleteTexture(this.yTextureRef),e.deleteTexture(this.uTextureRef),e.deleteTexture(this.vTextureRef),this.textureindex||this.initmask||(e.deleteTexture(this.cursorTextureRef),e.deleteTexture(this.waterMarkTextureRef),e.deleteTexture(this.repeatedWaterMarkTextureRef),e.deleteTexture(this.previewVideoTextureRef),e.deleteBuffer(this.vertexPosBuffer),e.deleteBuffer(this.texturePosBuffer)),this.maskTextureRef&&e.deleteTexture(this.maskTextureRef),this.masktexturePosBuffer&&e.deleteBuffer(this.masktexturePosBuffer),this.contextGL=null,this.glInitSucceed=0)},o.prototype.drawNextOutputPicture=function(e,t,r,n){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=this.contextGL;i?this.drawNextOuptutPictureGL(e,t,r,n,a):this.drawNextOuptutPictureRGBA(e,t,r,n)},o.prototype.updateVertexInfoForMultiView=function(e,t,r,n,a){var i,o,s,_,u=this.contextGL;if(this.isUseFillMode({width:r,height:n,rotation:a}))i=0,o=0,s=1,_=1;else{var c=a==this.ROTATION_CLOCK90||a==this.ROTATION_CLOCK270?n:r,h=a==this.ROTATION_CLOCK90||a==this.ROTATION_CLOCK270?r:n,d=c/h*t;d>e?(i=0,s=1,_=1-(o=(t-h/c*e)/2/t)):(o=0,_=1,s=1-(i=(e-d)/2/e))}i=2*i-1,s=2*s-1,o=1-2*o,_=1-2*_;var l=new Float32Array([s,o,i,o,s,_,i,_,1,1,-1,1,1,-1,-1,-1]);u.bindBuffer(u.ARRAY_BUFFER,this.vertexPosBuffer),u.bufferData(u.ARRAY_BUFFER,l,u.DYNAMIC_DRAW)},o.prototype.updateTextureInfoForMultiView=function(e,t,r,n,i,o,s){var _,u,c,h,d=this.contextGL;if(this.isUseFillMode({width:r.width,height:r.height,rotation:n})){var l=n==this.ROTATION_CLOCK90||n==this.ROTATION_CLOCK270?s/o:o/s,f=r.left||0,p=r.top||0;if(r.width/r.height>l){var g=r.height*l;_=p/t,u=(Math.round((r.width-g)/2)+f)/e,c=_+(r.height-1)/t,h=u+g/e}else{var m=r.width/l;c=(_=(Math.round((r.height-m)/2)+p)/t)+(m-1)/t,h=(u=f/e)+r.width/e}}else _=r.top/t,u=r.left/e,c=_+(r.height-1)/t,h=u+r.width/e;var E=[u,_,h,_,h,c,u,c];n==this.ROTATION_CLOCK90&&(E.unshift(E[6],E[7]),E=E.slice(0,8)),n==this.ROTATION_CLOCK180&&(E.unshift(E[4],E[5],E[6],E[7]),E=E.slice(0,8)),n==this.ROTATION_CLOCK270&&(E.push(E[0],E[1]),E=E.slice(2));var v=E[0],T=E[1];E[0]=E[2],E[1]=E[3],E[2]=v,E[3]=T,i&&(E[0]=1-E[0],E[2]=1-E[2],E[4]=1-E[4],E[6]=1-E[6]);var y=new Float32Array([].concat(a()(E),[1,0,0,0,1,1,0,1]));d.bindBuffer(d.ARRAY_BUFFER,this.texturePosBuffer),d.bufferData(d.ARRAY_BUFFER,y,d.DYNAMIC_DRAW)},o.prototype.drawNextOuptutPictureGL=function(e,t,r,n,a){var o=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,c=this.contextGL;if(c&&this.glInitSucceed){this.texturePosBuffer;var h=this.yTextureRef,d=this.uTextureRef,l=this.vTextureRef;c.enable(c.BLEND),c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA),a=a||this.ROTATION_CLOCK0;var f=(r=r||{top:0,left:0,width:e,height:t}).width!=this.croppingParams.width||r.height!=this.croppingParams.height,p=r.top!=this.croppingParams.top||r.left!=this.croppingParams.left,g=c.canvas.width!=this.canvasWidth||c.canvas.height!=this.canvasHeight,m=e!=this.textureWidth||t!=this.textureHeight,E=a!=this.picRotation;(f||g||E)&&s(this,r.width,r.height,a,u),(f||p||m||E)&&_(this,e,t,r,a);var v=o?0:1;v!=this.colorRange&&(c.uniform1i(this.colorRangeRef,v),this.colorRange=v),u?c.viewport(u.x,u.y,u.width,u.height):c.viewport(0,0,c.canvas.width,c.canvas.height),c.uniform1i(this.onlyRGBARef,0),c.uniform1i(this.yuvmodeRef,i.VIDEO_I420),Object.assign(this.croppingParams,r),this.textureWidth=e,this.textureHeight=t,this.picRotation=a,this.canvasWidth=c.canvas.width,this.canvasHeight=c.canvas.height,c.clearColor(this.bgColor[0],this.bgColor[1],this.bgColor[2],255),c.clear(c.COLOR_BUFFER_BIT);var T=n,y=e*t,S=T.subarray(0,y);c.activeTexture(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,h),c.texImage2D(c.TEXTURE_2D,0,c.LUMINANCE,e,t,0,c.LUMINANCE,c.UNSIGNED_BYTE,S);var b=e/2*t/2,R=T.subarray(y,y+b);c.activeTexture(c.TEXTURE1),c.bindTexture(c.TEXTURE_2D,d),c.texImage2D(c.TEXTURE_2D,0,c.LUMINANCE,e/2,t/2,0,c.LUMINANCE,c.UNSIGNED_BYTE,R);var M=b,A=T.subarray(y+b,y+b+M);c.activeTexture(c.TEXTURE2),c.bindTexture(c.TEXTURE_2D,l),c.texImage2D(c.TEXTURE_2D,0,c.LUMINANCE,e/2,t/2,0,c.LUMINANCE,c.UNSIGNED_BYTE,A),c.activeTexture(c.TEXTURE3),c.bindTexture(c.TEXTURE_2D,this.cursorTextureRef),this.hasCursor?c.uniform1i(this.cursorFlagRef,1):c.texImage2D(c.TEXTURE_2D,0,c.RGBA,1,1,0,c.RGBA,c.UNSIGNED_BYTE,this.dummpyCursor),c.uniform4f(this.cursorInfoRef,this.cx,this.cy,this.cw,this.ch),c.activeTexture(c.TEXTURE5),c.bindTexture(c.TEXTURE_2D,this.previewVideoTextureRef),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,1,1,0,c.RGBA,c.UNSIGNED_BYTE,this.dummpyWaterMark);var w=c.getUniformLocation(this.shaderProgram,"maskSampler");c.uniform1i(w,5),this.render(),this.hasWholeFrame=1}},o.prototype.updateTextureBlock=function(e,t,r,n,a){var i=this.contextGL;if(i&&this.glInitSucceed){var o=a;if(!(!this.hasWholeFrame||e<=0||t<=0||r<0||n<0||r+e>this.textureWidth||n+t>this.textureHeight)&&a&&a.length==e*t*3/2){var s=this.yTextureRef,_=this.uTextureRef,u=this.vTextureRef,c=e*t,h=o.subarray(0,c);i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,s),i.texSubImage2D(i.TEXTURE_2D,0,r,n,e,t,i.LUMINANCE,i.UNSIGNED_BYTE,h);var d=e/2*t/2,l=o.subarray(c,c+d);i.activeTexture(i.TEXTURE1),i.bindTexture(i.TEXTURE_2D,_),i.texSubImage2D(i.TEXTURE_2D,0,r/2,n/2,e/2,t/2,i.LUMINANCE,i.UNSIGNED_BYTE,l);var f=d,p=o.subarray(c+d,c+d+f);i.activeTexture(i.TEXTURE2),i.bindTexture(i.TEXTURE_2D,u),i.texSubImage2D(i.TEXTURE_2D,0,r/2,n/2,e/2,t/2,i.LUMINANCE,i.UNSIGNED_BYTE,p)}}},o.prototype.updateCursor=function(e,t,r){var n=this.contextGL;n&&this.glInitSucceed&&(e<=0||t<=0||!r||r.length!=e*t*4||(n.activeTexture(n.TEXTURE3),n.bindTexture(n.TEXTURE_2D,this.cursorTextureRef),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,e,t,0,n.RGBA,n.UNSIGNED_BYTE,r),this.cursorWidth=e,this.cursorHeight=t,this.hasCursor=1))},o.prototype.updateWatherMark=function(e,t,r){this.contextGL&&this.glInitSucceed&&(e<=0||t<=0||!r||r.length!=e*t*4||(this.watermarkData=r,this.watermarkWidth=e,this.watermarkHeight=t,this.hasWaterMark=1))},o.prototype.drawWatermark=function(){var e=this.contextGL;if(this.IsSetWaterMark()&&this.watermarkData&&this.watermarkWidth&&this.watermarkHeight){e.uniform1i(this.waterMarkFlagRef,1),this.IsWatermarkRepeated()?(e.activeTexture(this.GetRepeatedWatermarkTextureValue(e)),e.bindTexture(e.TEXTURE_2D,this.repeatedWaterMarkTextureRef)):(e.activeTexture(e.TEXTURE4),e.bindTexture(e.TEXTURE_2D,this.waterMarkTextureRef)),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,this.watermarkWidth,this.watermarkHeight,0,e.RGBA,e.UNSIGNED_BYTE,this.watermarkData);var t=e.getUniformLocation(this.shaderProgram,"waterMarkSampler");e.uniform1i(t,this.IsWatermarkRepeated()?this.GetRepeatedWatermarkUniformValue():4),e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.drawArrays(e.TRIANGLE_STRIP,4,4)}},o.prototype.render=function(){var e=this.contextGL;e&&this.glInitSucceed&&(e.uniform1i(this.waterMarkFlagRef,0),e.drawArrays(e.TRIANGLE_STRIP,0,4),this.drawWatermark())},o.prototype.draw=function(e,t,r,n,a){var i=this.contextGL;if(i&&this.glInitSucceed&&!(!this.hasWholeFrame||e&&(n<0||a<0))){i.viewport(0,0,i.canvas.width,i.canvas.height);var o=this.yTextureRef,s=this.uTextureRef,_=this.vTextureRef,u=this.cursorTextureRef;if(i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,o),i.activeTexture(i.TEXTURE1),i.bindTexture(i.TEXTURE_2D,s),i.activeTexture(i.TEXTURE2),i.bindTexture(i.TEXTURE_2D,_),i.activeTexture(i.TEXTURE3),i.bindTexture(i.TEXTURE_2D,u),e&&this.hasCursor){var c=t/this.croppingParams.width,h=r/this.croppingParams.height,d=n/this.croppingParams.width,l=a/this.croppingParams.height;this.cx=c,this.cy=h,this.cw=d,this.ch=l,i.uniform4f(this.cursorInfoRef,c,h,d,l)}else i.uniform4f(this.cursorInfoRef,0,0,0,0);this.render()}},o.prototype.clear=function(){var e=this.contextGL;e&&this.glInitSucceed&&(e.clearColor(this.bgColor[0],this.bgColor[1],this.bgColor[2],255),e.clear(e.COLOR_BUFFER_BIT),this.hasWholeFrame=0,this.hasCursor=0)},o.prototype.clearCanvas=function(e){var t=this.contextGL;t&&this.glInitSucceed&&(e?t.clearColor(e.R,e.G,e.B,e.A):t.clearColor(this.bgColor[0],this.bgColor[1],this.bgColor[2],255),t.clear(t.COLOR_BUFFER_BIT))},o.prototype.drawNextOuptutPictureRGBA=function(e,t,r,n){var a=n,i=this.canvasElement.getContext("2d"),o=i.getImageData(0,0,e,t);o.data.set(a),i.putImageData(o,0,0)},o.prototype.isRGBAMode=function(e){return-1!==[i.VIDEO_RGBA,i.VIDEO_BGRA].indexOf(e)},o.prototype.UpdateRemoteVideoTextures=function(e,t,r,n,a){var o=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],s=this.contextGL;if(s&&this.glInitSucceed){var _=this.yTextureRef,u=this.uTextureRef,c=this.vTextureRef;s.enable(s.BLEND),s.blendFunc(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA);var h=this.isRGBAMode(this.videoMode);if(e<=0||t<=0||!n||!n.length||n.length!=e*t*3/2&&!h||r&&(r.top<0||r.left<0||r.left+r.width>e||r.top+r.height>t))return!1;var d=o?0:1;if(this.colorRange=d,this.rotation=a,Object.assign(this.croppingParams,r),this.textureWidth=e,this.textureHeight=t,this.canvasWidth=s.canvas.width,this.canvasHeight=s.canvas.height,s.bindTexture(s.TEXTURE_2D,_),!h){var l=n,f=e*t,p=l.subarray(0,f);s.texImage2D(s.TEXTURE_2D,0,s.LUMINANCE,e,t,0,s.LUMINANCE,s.UNSIGNED_BYTE,p);var g=0,m=0;this.videoMode==i.VIDEO_I420?m=g=e/2*t/2:this.videoMode==i.VIDEO_NV12&&(g=e*t/2,m=0);var E=l.subarray(f,f+g);if(s.bindTexture(s.TEXTURE_2D,u),m){s.texImage2D(s.TEXTURE_2D,0,s.LUMINANCE,e/2,t/2,0,s.LUMINANCE,s.UNSIGNED_BYTE,E);var v=l.subarray(f+g,f+g+m);s.bindTexture(s.TEXTURE_2D,c),s.texImage2D(s.TEXTURE_2D,0,s.LUMINANCE,e/2,t/2,0,s.LUMINANCE,s.UNSIGNED_BYTE,v)}else s.texImage2D(s.TEXTURE_2D,0,s.LUMINANCE_ALPHA,e/2,t/2,0,s.LUMINANCE_ALPHA,s.UNSIGNED_BYTE,E);return!0}s.texImage2D(s.TEXTURE_2D,0,s.RGBA,e,t,0,s.RGBA,s.UNSIGNED_BYTE,n)}},o.prototype.UpdateRemoteVideoTexturesImageBitmap=function(e,t,r,n,a){var i=this.contextGL;if(i&&this.glInitSucceed){if(e<=0||t<=0||!r)return;this.textureWidth=e,this.textureHeight=t,Number.isNaN(a)||(this.rotation=a),Object.assign(this.croppingParams,n),i.bindTexture(i.TEXTURE_2D,this.yTextureRef);var o=i.RGBA,s=i.RGBA,_=i.UNSIGNED_BYTE;i.texImage2D(i.TEXTURE_2D,0,o,s,_,r)}},o.prototype.updateSelfMaskImage=function(e,t,r){var n=this.contextGL;n&&this.glInitSucceed&&(e<=0||t<=0||!r||r.length!=e*t*4||(n.bindTexture(n.TEXTURE_2D,this.maskTextureRef),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,e,t,0,n.RGBA,n.UNSIGNED_BYTE,r)))},o.prototype.VideoFlip=function(){var e=this.contextGL;e&&this.glInitSucceed&&e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1)},o.prototype.DrawRemoteVideo=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.contextGL;if(r&&this.glInitSucceed){var n=this.isRGBAMode(this.videoMode)?1:0;r.uniform1i(this.colorRangeRef,this.colorRange),this.setUniformFlag(n,this.hasCursor,this.videoMode),this.initmask&&r.uniform1i(this.maskFlagRef,1),this.updateTextureInfoForMultiView(this.textureWidth,this.textureHeight,this.croppingParams,this.rotation,t,e.width,e.height),r.viewport(e.x,e.y,e.width,e.height),this.updateVertexInfoForMultiView(e.width,e.height,this.croppingParams.width,this.croppingParams.height,this.rotation),this.BindTextures(this.videoMode),r.enable(r.BLEND),r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA),this.render()}},o.prototype.readPixelsSyncRequest=function(e,t,r,n){var a,i=this.contextGL;return this.destination&&this.destination.length==r*n*4||(this.destination=new Uint8Array(r*n*4)),a=this.destination,i.flush(),i.readPixels(e,t,r,n,i.RGBA,i.UNSIGNED_BYTE,a),a},o.prototype.UpdateSelfVideoTextures=function(e,t,r,n){var a=this.contextGL;a&&this.glInitSucceed&&(e<=0||t<=0||!r||r.length%4!=0||(this.textureWidth=e,this.textureHeight=t,this.rotation=this.ROTATION_CLOCK0,Object.assign(this.croppingParams,n),a.bindTexture(a.TEXTURE_2D,this.yTextureRef),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,e,t,0,a.RGBA,a.UNSIGNED_BYTE,r)))},o.prototype.DrawSelfVideo=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=this.contextGL;n&&this.glInitSucceed&&(this.setUniformFlag(1,this.hasCursor,this.videoMode),this.updateTextureInfoForMultiView(this.textureWidth,this.textureHeight,this.croppingParams,this.rotation,r,e.width,e.height),n.viewport(e.x,e.y,e.width,e.height),t?(n.enable(n.BLEND),n.blendFunc(n.ZERO,n.ZERO),this.updateVertexInfoForMultiView(e.width,e.height,e.width,e.height,this.ROTATION_CLOCK0)):(n.enable(n.BLEND),n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA),this.updateVertexInfoForMultiView(e.width,e.height,this.croppingParams.width,this.croppingParams.height,this.rotation)),this.BindTextures(i.VIDEO_RGBA),this.render())},o.prototype.IsSetWaterMark=function(){return this.hasWaterMark},o.prototype.SetWaterMarkFlag=function(e){this.hasWaterMark=e,e||(this.SetWatermarkRepeated(!1),this.SetWatermarkOpacity(),this.SetWatermarkPosition(16))},o.prototype.setUniformFlag=function(e,t,r){var n=this.contextGL;n&&(n.uniform1i(this.onlyRGBARef,e),n.uniform1i(this.bgraModeRef,e&&r===i.VIDEO_BGRA?1:0),n.uniform1i(this.cursorFlagRef,t),e||n.uniform1i(this.yuvmodeRef,r))},o.prototype.SetVideoMode=function(e){this.videoMode=e},o.prototype.GetVideoMode=function(e){return this.videoMode},o.prototype.SetWatermarkRepeated=function(e){this.watermarkRepeated=e},o.prototype.IsWatermarkRepeated=function(){return!!this.watermarkRepeated},o.prototype.SetWatermarkOpacity=function(e){this.watermarkOpacity=e||.15},o.prototype.GetWatermarkOpacity=function(){return this.watermarkOpacity},o.prototype.SetWatermarkPosition=function(e){this.watermarkPosition=e||16},o.prototype.GetWatermarkPosition=function(){return this.watermarkPosition},o.prototype.SetMultiView=function(e){return this.isMultiView=e},o.prototype.GetRepeatedWatermarkUniformValue=function(){return this.isMultiView?30:7},o.prototype.GetRepeatedWatermarkTextureValue=function(e){return this.isMultiView?e.TEXTURE30:e.TEXTURE7},o.prototype.setFillMode=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.fillMode=e,this.fillModeForResolution=t},o.prototype.isUseFillMode=function(e){var t=e.width,r=e.height,n=e.rotation;if(!this.fillMode)return!1;if(!this.fillModeForResolution)return!0;if(!t||!r)return!1;var a=n===this.ROTATION_CLOCK90||n==this.ROTATION_CLOCK270?r/t:t/r;return(Array.isArray(this.fillModeForResolution)?this.fillModeForResolution:[this.fillModeForResolution]).some((function(e){return Math.abs(a-e)<.01}))},t.a=o},function(e,t,r){"use strict";var n=r(2),a=r.n(n),i=r(3),o=r.n(i),s=r(6),_=function(){function e(){a()(this,e),this._highFrequencyLogs={}}return o()(e,[{key:"setInstance",value:function(e){this._instance=e}},{key:"getMessageFromErrorOrEvent",value:function(e,t){var r=e;return t instanceof ErrorEvent?(t.filename&&(r+=" File: ".concat(t.filename)),(t.lineno||t.colno)&&(r+=" Line: ".concat(t.lineno,":").concat(t.colno)),t.message&&(r+=" Message: ".concat(t.message)),t.stack&&(r+="\nStack: ".concat(t.stack))):t instanceof Error?(t.fileName&&(r+=" File: ".concat(t.fileName)),(t.lineNumber||t.columnNumber)&&(r+=" Line: ".concat(t.lineNumber,":").concat(t.columnNumber)),t.message&&(r+=" Message: ".concat(t.message)),t.stack&&(r+=" Stack: ".concat(t.stack)),t.name&&(r+=" Name: ".concat(t.name)),t.constraint&&(r+=" Constraint: ".concat(t.constraint))):t instanceof CloseEvent&&(t.code&&(r+=" Code: ".concat(t.code)),t.reason&&(r+=" Reason: ".concat(t.reason)),r+=" wasClean: ".concat(t.wasClean)),r}},{key:"error",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e=this.getMessageFromErrorOrEvent(e,t),this._highFrequencyLogs[e]?this._highFrequencyLogs[e]+=1:this._highFrequencyLogs[e]=1;var r=u(this._highFrequencyLogs[e]);this._instance&&r&&this._instance.error(e)}},{key:"warn",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e=this.getMessageFromErrorOrEvent(e,t),this._instance&&this._instance.warn(e)}},{key:"log",value:function(e){this._instance&&this._instance.log(e)}}]),e}(),u=function(e){return 0==(e&e-1)},c=new _;r.d(t,"b",(function(){return h})),r.d(t,"a",(function(){return d})),r.d(t,"c",(function(){return l}));var h=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1500,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:t.byteLength,_=arguments.length>6?arguments[6]:void 0;a()(this,e),this.offset=o,this._BYTES_PER_ELEMENT=r,this.capacity=(s-8)/r,this.usableCapacity=this.capacity-1,this.buf=t,this.write_ptr=new Uint32Array(this.buf,o,1),this.read_ptr=new Uint32Array(this.buf,o+4,1),this.storageUint8sByteOffset=o+8,this.storageUint8s=new Uint8Array(this.buf,this.storageUint8sByteOffset,s-8),this.byteLength=s,this.label=n,this.usingOneElementBuffer=i,_&&(this.wasmMemory=_),i&&(this.oneElementBuffer=new ArrayBuffer(r)),this.repushhander=0,this.repushlogcount=0,this.monitorpace=0}return o()(e,[{key:"checkBuffer",value:function(){this.wasmMemory&&this.wasmMemory.buffer!=this.buf&&(console.log("buffer change"),this.buf=this.wasmMemory.buffer,this.storageUint8s=new Uint8Array(this.buf,this.storageUint8sByteOffset,this.byteLength-8))}},{key:"enqueue",value:function(e){return this.available_write()>0&&this.push(e),{rd:Atomics.load(this.read_ptr,0),wr:Atomics.load(this.write_ptr,0)}}},{key:"enqueueSafe",value:function(e){var t=this,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;for(this.dataBuffer||(this.dataBuffer=new s.a);this.dataBuffer.getLength()>0&&this.available_write()>0;){var a=this.dataBuffer.dequeue();a&&this.push(a)}var i=this.dataBuffer.getLength();if(e){if(this.available_write()>0&&0==i)return this.push(e),!0;if(!r)return!1;this.dataBuffer.enqueue(e),++i}if(i>0&&!this.repushhander&&(this.repushhander=setTimeout((function(){t.repushlogcount%10==0&&console.warn("<<< retry consume cache data"),t.repushlogcount++,t.repushhander=0,t.enqueueSafe(null)}),30)),i>=1e3&&(c.error("Cached data in SAB reached critical value, will be cleared"),this.dataBuffer.clear(),n("vqslclear")),i>0&&n){var o=performance.now();(!this.monitorpace||o-this.monitorpace>2e4)&&(this.monitorpace=o,n("vqsl"+i))}return!0}},{key:"push",value:function(e){return e instanceof Array?this._pushArray(e):this._push(e)}},{key:"_pushArray",value:function(e){var t=this,r=Atomics.load(this.write_ptr,0);this.checkBuffer();var n=0;e.forEach((function(e){t.storageUint8s.set(e,r*t._BYTES_PER_ELEMENT+8+4+n),n+=e.byteLength})),new Uint32Array(this.buf,this.offset+r*this._BYTES_PER_ELEMENT+8,1)[0]=n;var a=(r+1)%this.capacity;return Atomics.store(this.write_ptr,0,a),!0}},{key:"_push",value:function(e){var t=Atomics.load(this.write_ptr,0);this.checkBuffer(),this.storageUint8s.set(e,t*this._BYTES_PER_ELEMENT+8+4,e.byteLength),new Uint32Array(this.buf,this.offset+t*this._BYTES_PER_ELEMENT+8,1)[0]=e.byteLength;var r=(t+1)%this.capacity;return Atomics.store(this.write_ptr,0,r),!0}},{key:"addReadPtr",value:function(){var e=Atomics.load(this.read_ptr,0);Atomics.store(this.read_ptr,0,(e+1)%this.capacity)}},{key:"dequeue",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=Atomics.load(this.read_ptr,0);this.checkBuffer();var r,n,a,i=new Uint32Array(this.buf,this.offset+t*this._BYTES_PER_ELEMENT+8,1);if(e){r=this.oneElementBuffer?new Uint8Array(this.oneElementBuffer,0,i[0]):new Uint8Array(i[0]);var o=new Uint8Array(this.storageUint8s.buffer,t*this._BYTES_PER_ELEMENT+8+4+this.storageUint8sByteOffset,r.byteLength);r.set(o,0)}else r=this.storageUint8s.subarray(t*this._BYTES_PER_ELEMENT+8+4,t*this._BYTES_PER_ELEMENT+8+4+i[0]),n=t*this._BYTES_PER_ELEMENT+8+4+this.storageUint8sByteOffset,a=t*this._BYTES_PER_ELEMENT+8+4+i[0]+this.storageUint8sByteOffset;return e&&Atomics.store(this.read_ptr,0,(t+1)%this.capacity),e?r:{bCopyData:e,uint8s:r,begin:n,end:a}}},{key:"available_read",value:function(){var e=Atomics.load(this.read_ptr,0),t=Atomics.load(this.write_ptr,0);return this._available_read(e,t)}},{key:"available_write",value:function(){var e=Atomics.load(this.read_ptr,0),t=Atomics.load(this.write_ptr,0);return this._available_write(e,t)}},{key:"is_available_write",value:function(){var e=Atomics.load(this.read_ptr,0),t=Atomics.load(this.write_ptr,0);return this._is_available_write(e,t)}},{key:"_available_read",value:function(e,t){return(t+this.capacity-e)%this.capacity}},{key:"_available_write",value:function(e,t){return this.usableCapacity-this._available_read(e,t)}},{key:"_is_available_write",value:function(e,t){return this._available_write(e,t)>0}},{key:"_storage_capacity",value:function(){return this.capacity}}],[{key:"getStorageForCapacity",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:80,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1500,r=8+(e+1)*t;return new SharedArrayBuffer(r)}}]),e}(),d=function(){function e(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:50,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:80;if(a()(this,e),!(t instanceof h))throw new Error("RingBuffer required");this.rb=t,this.dataCallback=r,this.interval=null,this.requestID=null,this.timeout_call=n,this.tick_lasted_time=0,this.timeoutMS=i,this.maxCount=o}return o()(e,[{key:"consume",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.interval||(this.bCopyData=r,this.interval=setInterval((function(){var t=performance.now();if(e.timeout_call){if(0!=e.tick_lasted_time){var r=t-e.tick_lasted_time;r>=e.timeoutMS&&e.timeout_call(r,t)}e.tick_lasted_time=t}e._dequeue()}),t),console.log("consume interval ".concat(this.interval)))}},{key:"consumeAll",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.bCopyData=e,this._dequeue()}},{key:"_dequeue",value:function(){var e=Math.min(this.rb.available_read(),this.maxCount);for(this.consoume_count=0;this.consoume_count<e;){this.consoume_count++;var t=this.rb.dequeue(this.bCopyData);this.dataCallback(t),this.bCopyData||this.rb.addReadPtr()}}},{key:"_consumeForAnimationFrame",value:function(){this._dequeue(),this.requestID=requestAnimationFrame(this._consumeForAnimationFrame.bind(this))}},{key:"consumeUsingRequestAnimationFrame",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.requestID||(this.bCopyData=e,this._consumeForAnimationFrame())}},{key:"cancelConsume",value:function(){console.log("cancelConsume interval ".concat(this.interval," requestID ").concat(this.requestID)),this.tick_lasted_time=0,clearInterval(this.interval),this.requestID&&cancelAnimationFrame(this.requestID),this.interval=null,this.requestID=null}}]),e}(),l=function(){function e(){a()(this,e),this.timeStampKey="video_timestamp",this.keysList=["video_ssrc","video_width","video_height","rendering_x","rendering_y","rendering_w","rendering_h","rotation","yuv_limited"],this.bCopyData=null,this.begin=null,this.end=null}return o()(e,[{key:"setOBJ",value:function(e){this.obj=e,this.yuvUint8s=e.data}},{key:"setBuffer",value:function(e){!1===e.bCopyData?(this.objUint8s=e.uint8s,this.bCopyData=e.bCopyData,this.begin=e.begin,this.end=e.end):(this.objUint8s=e,this.bCopyData=!0,this.begin=0,this.end=e.byteLength)}},{key:"buffer2Obj",value:function(){var e=new Uint32Array(this.objUint8s.buffer,this.begin,9),t=new DataView(this.objUint8s.buffer,this.begin+40,16),r={};this.keysList.forEach((function(t,n){r[t]=e[n]})),r[this.timeStampKey]=Number(t.getBigUint64(0,!0));var n,a=Number(t.getBigUint64(8,!0)),i=new Uint8Array(this.objUint8s.buffer,this.begin+40+8+8,a);return n=(this.bCopyData,i),r.data=n,r}},{key:"obj2buffer",value:function(){var e=this,t=new Uint8Array(56),r=this.keysList,n=new Uint32Array(t.buffer,0,9),a=new DataView(t.buffer,40,16);return r.forEach((function(t,r){n[r]=e.obj[t]})),a.setBigUint64(0,BigInt(this.obj[this.timeStampKey]),!0),a.setBigUint64(8,BigInt(this.yuvUint8s.byteLength),!0),[t,this.yuvUint8s]}}]),e}()},function(e,t,r){"use strict";r.d(t,"b",(function(){return n})),r.d(t,"d",(function(){return a})),r.d(t,"c",(function(){return i})),r.d(t,"e",(function(){return o})),r.d(t,"f",(function(){return s})),r.d(t,"a",(function(){return _})),r.d(t,"h",(function(){return u})),r.d(t,"g",(function(){return c})),r.d(t,"i",(function(){return h}));var n=3,a=6,i=24,o="SHARING_PARAM_INFO_FROM_SOCKET",s=121,_="AUDIO_QOS_DATA",u="VIDEO_QOS_DATA",c="VIDEOSHARE_QOS_DATA",h={VIDEO_ENCODE:"0",VIDEO_DECODE:"1",AUDIO_ENCODE:"2",AUDIO_DECODE:"3",SHARING_ENCODE:"4",SHARING_DECODE:"5"}},function(e,t,r){var n=r(32),a=r(33),i=r(26),o=r(34);e.exports=function(e){return n(e)||a(e)||i(e)||o()},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";var n,a,i,o,s,_;function u(){}function c(e){var t=new Uint8Array(e.data);a&&o(t,a,i)}function h(e){}function d(e){}function l(e,t,r){a&&o(e,a,t,r)}function f(e,t,r,n,i){var o=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(s=n,_=i,e){r.meetingNumber=r.meetingNumber+"",r.meetingId=r.meetingId+"",a=o?e(r.userId,r.meetingNumber,r.meetingId,0,0,!1,0,!0):e(r.userId,r.meetingNumber,r.meetingId,0,0,0,!1,!1,!0);var u=s(r.encryptKey);return t(a,u,r.encryptKey.length,r.encryptType),_(u),a}return 0}function p(e,t,r,a){n=e(t,u,c,h,d),o=r,i=a}function g(e,t){if(a&&t.body){if(t.body.add)for(var r=0,n=t.body.add;r<n.length;r++){var i=s(n[r].sn);e(a,n[r].userid,i,n[r].sn.length),_(i)}t.body.remove}return!1}function m(e,t){return!!a&&(e(a,t.ssrc,t.streamIndex,t.videoMode),!0)}function E(e,t){return!!a&&(e(a,t.ssrc),!0)}function v(){return a}r.d(t,"h",(function(){return n})),r.d(t,"g",(function(){return l})),r.d(t,"d",(function(){return f})),r.d(t,"c",(function(){return p})),r.d(t,"b",(function(){return g})),r.d(t,"a",(function(){return m})),r.d(t,"f",(function(){return E})),r.d(t,"e",(function(){return v}))},function(e,t){function r(t){return e.exports=r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,r(t)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";r.d(t,"b",(function(){return s})),r.d(t,"a",(function(){return h}));var n=r(6);function a(){this.ssrcQueueMap=new Map,a.prototype.AddQueue=function(e){var t=new n.a;return this.ssrcQueueMap.set(e,t),t},a.prototype.DeleteQueue=function(e){this.ssrcQueueMap.delete(e)},a.prototype.GetQueue=function(e){return this.ssrcQueueMap.get(e)},a.prototype.GetQueueData=function(e){return this.ssrcQueueMap.get(e).dequeue()},a.prototype.PutQueueData=function(e,t){this.ssrcQueueMap.get(e).enqueue(t)},a.prototype.GetQueueLength=function(e){var t=this.ssrcQueueMap.get(e);return null!==t?t.getLength():0}}var i=function(){this.frames=0,this.ntp=new n.a};i.prototype={UpdateVideoInfo:function(e){this.frames++,this.ntp.getLength()>30&&this.ntp.dequeue(),this.ntp.enqueue(e)},GetVideoFpsInfo:function(){var e=this.ntp.getLength();if(!(e<5)){for(var t=0,r=0,n=0,a=0,i=0;i<e;i++){var o=this.ntp.dequeue();0==o&&0==n?r++:0!=o?(a=0,0==n&&(n=o),t=o):0!=n&&t!=n&&0==o&&a++}return 0==t||t==n?0:e-r-a-1!=0?(t-n)/(e-r-a-1):0}}};var o=function(){this.ssrcInfoMap=new Map};function s(){this.ssrcQueueMap=new Map,this.ssrcInfo=new o,s.prototype.AddQueue=function(e){var t=new n.a;return this.ssrcQueueMap.set(e,t),t},s.prototype.DeleteQueue=function(e){this.ssrcQueueMap.delete(e)},s.prototype.GetQueue=function(e){return this.ssrcQueueMap.get(e)},s.prototype.ClearQueue=function(){this.ssrcQueueMap.clear()},s.prototype.GetQueueData=function(e){return this.ssrcQueueMap.get(e).dequeue()},s.prototype.PutQueueData=function(e,t){this.ssrcQueueMap.get(e).enqueue(t)},s.prototype.GetQueueLength=function(e){var t=this.ssrcQueueMap.get(e);return t?t.getLength():0},s.prototype.UpdateInfo=function(e,t){this.ssrcInfo.UpdateSSRCInfo(e,t)},s.prototype.GetFpsInfo=function(e){return this.ssrcInfo.GetSSRCFpsInfo(e)}}o.prototype={UpdateSSRCInfo:function(e,t){var r=this.ssrcInfoMap.get(e);r||(r=new i,this.ssrcInfoMap.set(e,r)),r.UpdateVideoInfo(t)},GetSSRCFpsInfo:function(e){var t=this.ssrcInfoMap.get(e);return t?t.GetVideoFpsInfo():0}};!function(){function e(){this.map=new Map,this.AudioQueueMGR=new a,this.timemap=new Map}e.prototype.Add=function(e,t){this.map.set(e,t),this.AudioQueueMGR.AddQueue(e)},e.prototype.Clear=function(){this.map.clear()},e.prototype.Keys=function(){return this.map.keys()},e.prototype.UpdateSSRCTimeMap=function(e){this.timemap=e},e.prototype.GetSSRCTimeMap=function(e){return this.timemap?this.timemap.get(e):null}}();function _(){this.map=new Map,this.VideoQueueMGR=new s}_.prototype.Add=function(e,t){this.map.set(e,t)},_.prototype.Clear=function(){this.map.clear()},_.prototype.Keys=function(){return this.map.keys()};var u=function(){this.frames=0,this.ntp=new n.a};u.prototype={UpdateSharingInfo:function(e){this.frames++,this.ntp.getLength()>30&&this.ntp.dequeue(),this.ntp.enqueue(e)},GetSharingFpsInfo:function(){var e=this.ntp.getLength();if(!(e<5)){for(var t=0,r=0,n=0,a=0,i=0;i<e;i++){var o=this.ntp.dequeue();0==o&&0==n?r++:0!=o?(a=0,0==n&&(n=o),t=o):0!=n&&t!=n&&0==o&&a++}return 0==t||t==n?0:e-r-a-1!=0?(t-n)/(e-r-a-1):0}}};var c=function(){this.ssrcInfoMap=new Map};function h(){this.ssrcQueueMap=new Map,this.ssrcInfo=new c,h.prototype.AddQueue=function(e){var t=new n.a;return this.ssrcQueueMap.set(e,t),t},h.prototype.DeleteQueue=function(e){this.ssrcQueueMap.delete(e)},h.prototype.GetQueue=function(e){return this.ssrcQueueMap.get(e)},h.prototype.ClearQueue=function(){this.ssrcQueueMap.clear()},h.prototype.GetQueueData=function(e){return this.ssrcQueueMap.get(e).dequeue()},h.prototype.PutQueueData=function(e,t){this.ssrcQueueMap.get(e).enqueue(t)},h.prototype.GetQueueLength=function(e){var t=this.ssrcQueueMap.get(e);return t?t.getLength():0},h.prototype.UpdateInfo=function(e,t){this.ssrcInfo.UpdateSSRCInfo(e,t)},h.prototype.GetFpsInfo=function(e){return this.ssrcInfo.GetSSRCFpsInfo(e)}}function d(){this.map=new Map,this.sQueue=new n.a,this.SharingQueueMGR=new h}c.prototype={UpdateSSRCInfo:function(e,t){var r=this.ssrcInfoMap.get(e);r||(r=new u,this.ssrcInfoMap.set(e,r)),r.UpdateSharingInfo(t)},GetSSRCFpsInfo:function(e){var t=this.ssrcInfoMap.get(e);return t?t.GetSharingFpsInfo():0}},d.prototype.Clear=function(){this.map.clear()},d.prototype.Keys=function(){return this.map.keys()},d.prototype.Add=function(e,t){this.map.set(e,t)},d.prototype.Get=function(e){return this.map.get(e)},d.prototype.PutData=function(e){e&&this.sQueue&&this.sQueue.enqueue(e)},d.prototype.GetData=function(){if(this.sQueue)return this.sQueue.dequeue()},d.prototype.ClearBuffer=function(){this.sQueue&&(this.sQueue=new n.a)}},function(e,t,r){var n=r(29);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&n(e,t)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){function r(t){return e.exports=r=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.__esModule=!0,e.exports.default=e.exports,r(t)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},,function(e,t,r){var n=r(14).default,a=r(27);e.exports=function(e){var t=a(e,"string");return"symbol"===n(t)?t:String(t)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";r.d(t,"a",(function(){return g}));var n=r(16),a=r.n(n),i=r(21),o=r.n(i),s=r(17),_=r.n(s),u=r(2),c=r.n(u),h=r(3),d=r.n(h);r(8);function l(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=_()(e);if(t){var a=_()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return o()(this,r)}}var f=function(){function e(){c()(this,e),this.port=null,this.cache=[],this.stopCache=!1}return d()(e,[{key:"readyForLog",value:function(){}},{key:"sendLog",value:function(e){}},{key:"writeLog",value:function(e){var t=this;this.readyForLog()?(this.stopCache||(this.cache.forEach((function(e){return t.sendLog(e)})),this.clearCache()),this.sendLog(e)):this.stopCache||this.cache.push(e)}},{key:"clearCache",value:function(){this.stopCache=!0,this.cache=[]}},{key:"getTime",value:function(){var e=new Date;return e.getHours()+":"+e.getMinutes()+":"+e.getSeconds()+":"+e.getMilliseconds()}},{key:"getLogData",value:function(e,t,r){if(t){var n=new Uint8Array(r?t+1:t),a=Module.HEAP8.subarray(e+0,e+t);return n.set(a,0,t),r&&(n[t]=10),n}return e.data}},{key:"writeWasmLog",value:function(e,t){this.writeLog(this.getTime()),this.writeLog(this.getLogData(e,t)),this.writeLog("\n")}}]),e}(),p=function(e){a()(r,e);var t=l(r);function r(){var e;return c()(this,r),(e=t.call(this)).port=null,e.ready=!1,e}return d()(r,[{key:"init",value:function(){var e=this,t=0,r=function r(n){"local_log_port"===n.data.command?e.port||(e.port=n.data.data):"local_log_ready"===n.data.command&&(e.ready=!0,self.removeEventListener("message",r),clearTimeout(t),e.stopCache||(e.cache.forEach((function(t){return e.sendLog(t)})),e.clearCache()))};self.addEventListener("message",r),t=setTimeout((function(){self.removeEventListener("message",r),e.clearCache()}),6e4)}},{key:"readyForLog",value:function(){return!!this.port&&this.ready}},{key:"sendLog",value:function(e){this.port.postMessage(e)}}]),r}(f);function g(){var e=!1;try{e=__ENABLE_LOG__}catch(e){}return e?new p:null}},function(e,t,r){var n=r(14).default,a=r(30);e.exports=function(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return a(e)},e.exports.__esModule=!0,e.exports.default=e.exports},,function(e,t,r){var n=r(35),a=r(36),i=r(26),o=r(37);e.exports=function(e,t){return n(e)||a(e,t)||i(e,t)||o()},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";var n=r(2),a=r.n(n),i=r(3),o=r.n(i),s=function(){function e(){a()(this,e)}return o()(e,[{key:"_drawWatermarkWithShadow",value:function(e){var t=e.ctx,r=e.textPos,n=e.opacity,a=e.name;t.fillStyle="rgba(0, 0, 0, ".concat(n,")"),t.fillText(a,r.x,r.y),t.fillStyle="rgba(255, 255, 255, ".concat(n,")"),t.fillText(a,r.x+1,r.y+1)}},{key:"_getTransformInfo",value:function(e){var t,r=e.canvas,n=e.position;if(1===n)t={x:r.width/2,y:0,rateRadio:0,maxWidth:r.width};else if(2===n)t={x:r.width/2,y:r.height,rateRadio:0,maxWidth:r.width};else if(4===n)t={x:0,y:r.height/2,rateRadio:Math.PI/2,maxWidth:r.height};else if(8===n)t={x:r.width,y:r.height/2,rateRadio:-Math.PI/2,maxWidth:r.height};else{var a=-21*Math.PI/180;t={x:r.width/2,y:r.height/2,rateRadio:a,maxWidth:Math.min(r.width/Math.cos(a),-r.height/Math.sin(a))}}return t.maxWidth>100&&(t.maxWidth-=50),t}},{key:"_calcTextPos",value:function(e){var t=e.position,r=e.ctx,n=e.name,a=e.textWidth,i=this._getPaddingWidth({ctx:r,position:t,name:n});return 1===t?{x:-a.width/2,y:i}:2===t||4===t||8===t?{x:-a.width/2,y:-i}:{x:-a.width/2,y:r.measureText(n[0]).width/2}}},{key:"_getPaddingWidth",value:function(e){var t=e.ctx,r=e.position,n=e.name;return[1,2,4,8].includes(r)?32:t.measureText(n[0]).width}},{key:"_setBaseLine",value:function(e){var t=e.ctx,r=e.position;t.textBaseline=1===r?"top":2===r||4===r||8===r?"bottom":"middle"}},{key:"Get_WaterMarkRGBA",value:function(e){var t=e.canvas,r=e.name,n=e.width,a=e.height,i=e.opacity,o=void 0===i?.15:i,s=e.position,_=e.convertToDataUrl;if(r&&n&&a){o=o||.15;n*=1,a*=1,t.width=n,t.height=a;var u,c=this._getTransformInfo({canvas:t,position:s}),h=t.getContext("2d");if(h.clearRect(0,0,t.width,t.height),h.translate(c.x,c.y),h.rotate(c.rateRadio),this._setBaseLine({ctx:h,position:s}),h.lineWidth=1,h.imageSmoothingEnabled=!0,1==r.length){var d=c.maxWidth/r.length;h.font=d+"px 'Segoe UI'",u=h.measureText(r)}else{var l=16;for(h.font=l+"px 'Segoe UI'",u=h.measureText(r);u.width<c.maxWidth-2*this._getPaddingWidth({ctx:h,position:s,name:r});)l+=1,h.font=l+"px 'Segoe UI'",u=h.measureText(r);if(u.width>c.maxWidth-2*this._getPaddingWidth({ctx:h,position:s,name:r}))if(l>16)l-=1,h.font=l+"px 'Segoe UI'",u=h.measureText(r);else{for(var f=r;r.length>5&&u.width>c.maxWidth-2*this._getPaddingWidth({ctx:h,position:s,name:r+"..."});)r=r.slice(0,r.length-1),u=h.measureText(r+"...");f!==r&&(r+="...")}}var p,g=this._calcTextPos({position:s,ctx:h,name:r,textWidth:u});if(this._drawWatermarkWithShadow({ctx:h,name:r,opacity:o,textPos:g}),_)p=t.toDataURL();else{var m=h.getImageData(0,0,h.canvas.width,h.canvas.height);p=new Uint8Array(m.data.buffer)}return h.rotate(-c.rateRadio),h.translate(-c.x,-c.y),p}}},{key:"Get_Repeated_WaterMarkRGBA",value:function(e){var t=e.canvas,r=e.name,n=e.width,a=e.height,i=e.opacity,o=void 0===i?.15:i,s=(e.position,e.convertToDataUrl);if(r&&n&&a){o=o||.15;n*=1,a*=1,t.width=n,t.height=a;var _=t.getContext("2d");_.clearRect(0,0,t.width,t.height),_.translate(n/2,a/2),_.rotate(-21*Math.PI/180),_.imageSmoothingEnabled=!0;_.font="".concat(32,"px 'Segoe UI'"),_.textBaseline="top";var u,c=_.measureText(r),h=.37*c.width,d=0,l=-a;do{var f=d%2==0?h-n:-n;do{_.fillStyle="rgba(0, 0, 0, ".concat(o,")"),_.fillText(r,f,l),_.fillStyle="rgba(255, 255, 255, ".concat(o,")"),_.fillText(r,f+1,l+1),f+=c.width+h}while(f<n);l+=32+h,d++}while(l<a);if(s)u=t.toDataURL();else{var p=_.getImageData(0,0,_.canvas.width,_.canvas.height);u=new Uint8Array(p.data.buffer)}return _.rotate(21*Math.PI/180),_.translate(-n/2,-a/2),u}}}]),e}();t.a=s},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){var n=r(25);e.exports=function(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){var n=r(14).default;e.exports=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var a=r.call(e,t||"default");if("object"!==n(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){var n=r(14).default;function a(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */e.exports=a=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},r=Object.prototype,i=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},s="function"==typeof Symbol?Symbol:{},_=s.iterator||"@@iterator",u=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag";function h(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{h({},"")}catch(e){h=function(e,t,r){return e[t]=r}}function d(e,t,r,n){var a=t&&t.prototype instanceof p?t:p,i=Object.create(a.prototype),s=new I(n||[]);return o(i,"_invoke",{value:R(e,r,s)}),i}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=d;var f={};function p(){}function g(){}function m(){}var E={};h(E,_,(function(){return this}));var v=Object.getPrototypeOf,T=v&&v(v(D([])));T&&T!==r&&i.call(T,_)&&(E=T);var y=m.prototype=p.prototype=Object.create(E);function S(e){["next","throw","return"].forEach((function(t){h(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){var r;o(this,"_invoke",{value:function(a,o){function s(){return new t((function(r,s){!function r(a,o,s,_){var u=l(e[a],e,o);if("throw"!==u.type){var c=u.arg,h=c.value;return h&&"object"==n(h)&&i.call(h,"__await")?t.resolve(h.__await).then((function(e){r("next",e,s,_)}),(function(e){r("throw",e,s,_)})):t.resolve(h).then((function(e){c.value=e,s(c)}),(function(e){return r("throw",e,s,_)}))}_(u.arg)}(a,o,r,s)}))}return r=r?r.then(s,s):s()}})}function R(e,t,r){var n="suspendedStart";return function(a,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===a)throw i;return x()}for(r.method=a,r.arg=i;;){var o=r.delegate;if(o){var s=M(o,r);if(s){if(s===f)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var _=l(e,t,r);if("normal"===_.type){if(n=r.done?"completed":"suspendedYield",_.arg===f)continue;return{value:_.arg,done:r.done}}"throw"===_.type&&(n="completed",r.method="throw",r.arg=_.arg)}}}function M(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,M(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var a=l(n,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,f;var i=a.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function D(e){if(e){var t=e[_];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,n=function t(){for(;++r<e.length;)if(i.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return n.next=n}}return{next:x}}function x(){return{value:void 0,done:!0}}return g.prototype=m,o(y,"constructor",{value:m,configurable:!0}),o(m,"constructor",{value:g,configurable:!0}),g.displayName=h(m,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,h(e,c,"GeneratorFunction")),e.prototype=Object.create(y),e},t.awrap=function(e){return{__await:e}},S(b.prototype),h(b.prototype,u,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,a,i){void 0===i&&(i=Promise);var o=new b(d(e,r,n,a),i);return t.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},S(y),h(y,c,"Generator"),h(y,_,(function(){return this})),h(y,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=D,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(w),!e)for(var t in this)"t"===t.charAt(0)&&i.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,n){return o.type="throw",o.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=i.call(a,"catchLoc"),_=i.call(a,"finallyLoc");if(s&&_){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!_)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var a=n;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,f):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),w(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;w(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:D(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){function r(t,n){return e.exports=r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},e.exports.__esModule=!0,e.exports.default=e.exports,r(t,n)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";var n=r(23),a=r.n(n),i=r(11),o=r(0),s=r(24),_=r(15),u=r(1);function c(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return h(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return h(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw i}}}}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function d(e){this.Notify_APPUI=e.Notify_APPUI,this.PubSub=e.PubSub,this.jsMediaEngine=e.jsMediaEngine,this.globalTracingLogger=e.globalTracingLogger,this.currentshareactive=0,this.isFromMainSession=0,this.sharingWidthAndHeightInfo={logicHeight:0,logicWidth:0},this.currentSharingHeight=0,this.currentSharingWidth=0,this.currentSharingLogicHeight=0,this.currentSharingLogicWidth=0,this.isCreateSharingWaterMark=!1,this.sharingWaterMarkName="",this.isWaterMarkRepeatedEnable=!1,this.waterMarkOpacity=.15,this.SharingCanvasSizeInfo=null,this.Cursorx=null,this.Cursory=null,this.CursorWidth=null,this.CursorHeight=null,this.xratio=1,this.yratio=1,this.sharingDisplay=null,this.mouseQueue=new _.a,this.sharingQueue=new _.a,this.WaterMarkRGBA=new s.a,this.sMonitorCount=0,this.mMonitorCount=0,this.firstFrameForIOS=!1,this.timestart=0,this.asTime=0,this.rAFID=0,this.requestAnimation=!1,this.requestF=this.No_Bindthis_RAF.bind(this),this.cATimeStamp=0,this.lRTimeStamp=0,this.pacingtime=1,this.sharingFps=0,this.lfTimeStamp=0,this.maxQueueLength=0,this.vaTimeDelta=0,this.renderMode=o.RENDER_MODE_RAF,this.SharingRenderInterval=0}d.prototype.Start_Draw=function(){return this.requestAnimation=!0,this.Start_Request_Animation_Frame()},d.prototype.Stop_Draw=function(){return this.requestAnimation=!1,this.lRTimeStamp=0,this.cATimeStamp=0,this.Stop_Request_Animation_Frame()},d.prototype.Start_Request_Animation_Frame=function(){return this.rAFID=requestAnimationFrame(this.requestF),this.rAFID},d.prototype.Stop_Request_Animation_Frame=function(){this.rAFID&&(cancelAnimationFrame(this.rAFID),this.rAFID=0)},d.prototype.No_Bindthis_RAF=function(){var e=performance.now();this.requestAnimation?(this.calPacingTime(e),e-this.timestart>this.pacingtime&&(this.timestart=e,this.JsMediaSDK_SharingRender()),this.Start_Request_Animation_Frame()):this.Stop_Request_Animation_Frame()},d.prototype.No_Bindthis_Interval=function(){var e=performance.now();this.calPacingTime(e),e-this.timestart>this.pacingtime&&(this.timestart=e,this.JsMediaSDK_SharingRender())},d.prototype.calPacingTime=function(e){this.pacingtime=30,this.sharingFps&&this.sharingFps>0&&this.sharingFps<100&&(this.pacingtime=1e3/this.sharingFps);var t=this.Get_Current_QueueLength();if(this.cATimeStamp&&this.lRTimeStamp){var r=this.cATimeStamp+e-this.asTime;this.vaTimeDelta=this.lRTimeStamp+this.pacingtime-r,this.vaTimeDelta>65&&this.vaTimeDelta<1e4&&t>1&&(this.pacingtime=1.5*this.pacingtime),this.vaTimeDelta<-65&&(this.pacingtime=1*this.pacingtime/2)}else this.cATimeStamp||(this.pacingtime>150||t>20?this.pacingtime=1*this.pacingtime/2:this.pacingtime=this.pacingtime-10)},d.prototype.JsMediaSDK_SharingRender=function(){if(this.sharingDisplay){var e=this.Get_Decoded_Sharing_Frame(this.currentshareactive),t=this.Get_Decoded_Mouse_Frame(this.currentshareactive);if(e){var r,n;this.lRTimeStamp=e.ntptime,e.yuvdata instanceof u.c?(r=e.yuvdata.yuvdata,n=e.yuvdata):(r=e.yuvdata,n=null),this.sharingWidthAndHeightInfo.logicWidth==e.logic_w&&this.sharingWidthAndHeightInfo.logicHeight==e.logic_h||(this.PubSub?PubSub.publish(i.e,{body:{width:e.logic_w,height:e.logic_h,logicWidth:e.logic_w,logicHeight:e.logic_h}}):(postMessage({status:o.Sharing_Width_And_Height_Info,logicWidth:e.logic_w,logicHeight:e.logic_h}),this.updateOffscreenCanvasSize(e.logic_w,e.logic_h)),this.sharingWidthAndHeightInfo.logicWidth=e.logic_w,this.sharingWidthAndHeightInfo.logicHeight=e.logic_h);var a=e.logic_h,s=e.logic_w,_=e.r_h,c=e.r_w;this.xratio=c/s,this.yratio=_/a;var h={top:e.r_x,left:e.r_y,height:e.r_h,width:e.r_w};this.currentSharingHeight==e.r_h&&this.currentSharingWidth==e.r_w&&this.currentSharingLogicHeight==e.logic_h&&this.currentSharingLogicWidth==e.logic_w||(this.Notify_APPUI?this.Notify_APPUI(i.d,{body:{height:e.logic_h,width:e.logic_w,logicHeight:e.logic_h,logicWidth:e.logic_w}}):(postMessage({status:o.Sharing_Width_And_Height_Info,logicWidth:e.logic_w,logicHeight:e.logic_h}),this.updateOffscreenCanvasSize(e.logic_w,e.logic_h)),this.currentSharingHeight=e.r_h,this.currentSharingWidth=e.r_w,this.currentSharingLogicHeight=e.logic_h,this.currentSharingLogicWidth=e.logic_w);var d=this.SharingCanvasSizeInfo?this.SharingCanvasSizeInfo.width:e.r_w,l=this.SharingCanvasSizeInfo?this.SharingCanvasSizeInfo.height:e.r_h;this.Should_Update_Watermark(this.sharingDisplay,d,l)&&this.Update_Display_Watermark(this.sharingDisplay,d,l),3e3==this.sMonitorCount&&(this.jsMediaEngine?this.jsMediaEngine.Send_Render_Monitor_Log("SDIMM"):postMessage({status:o.SHARING_RENDER_MONITOR_LOG,data:"SDIMW"}),this.sMonitorCount=0),this.sMonitorCount++,this.sharingDisplay.drawNextOuptutPictureGL(e.width,e.height,h,r,null,e.yuv_limited),n&&n.recycle(),e.dataptr&&Module._free(e.dataptr)}t&&(this.Cursorx=t.r_x*this.xratio,this.Cursory=t.r_y*this.yratio,this.CursorWidth=t.width*this.xratio,this.CursorHeight=t.height*this.yratio,this.sharingDisplay.updateCursor(t.width,t.height,t.buffer),3e3==this.mMonitorCount&&(this.jsMediaEngine?this.jsMediaEngine.Send_Render_Monitor_Log("SDSBM"):postMessage({status:o.SHARING_RENDER_MONITOR_LOG,data:"SDSBW"}),this.mMonitorCount=0),this.mMonitorCount++,this.sharingDisplay.draw(1,this.Cursorx,this.Cursory,this.CursorWidth,this.CursorHeight))}},d.prototype.setOnlyAcceptUISize=function(e){this.bOnlyAcceptUISize=e},d.prototype.updateOffscreenCanvasSize=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.bOnlyAcceptUISize&&!r)return console.log("drop logic w/h");try{var n=this.sharingDisplay.canvasElement;n&&n instanceof OffscreenCanvas&&(n.width=e,n.height=t)}catch(e){this.Log_Error("Error updating OffscreenCanvas size",e)}},d.prototype.Set_Render_WebGL=function(e){this.sharingDisplay=e},d.prototype.Change_Current_SSRC=function(e,t){this.currentshareactive=e,this.currentSharingHeight=0,this.currentSharingWidth=0,this.currentSharingLogicHeight=0,this.currentSharingLogicWidth=0,this.isFromMainSession=t,this.firstFrameForIOS=!1,this.ClearQueue()},d.prototype.Set_WaterMark_Info=function(e){var t=e.waterMarkCanvas,r=e.isCreateSharingWaterMark,n=e.sharingWaterMarkName,a=e.watermarkOpacity,i=e.watermarkRepeated,o=e.watermarkPosition;r||(this.SharingCanvasSizeInfo=null),this.Replace_WaterMark_Canvas(t),this.isCreateSharingWaterMark=r,this.sharingWaterMarkName=n,void 0!==i&&(this.isWaterMarkRepeatedEnable=!!i),void 0!==a&&(this.waterMarkOpacity=a),void 0!==o&&(this.watermarkPosition=o)},d.prototype.Replace_WaterMark_Canvas=function(e){this.waterMarkCanvas=e},d.prototype.Set_WaterMark_Flag=function(e){this.sharingDisplay.SetWaterMarkFlag(e?1:0)},d.prototype.Should_Watermark_Repeated=function(e,t){return this.isWaterMarkRepeatedEnable&&e>306&&t>202};var l=function(e,t){if(e<640&&e){var r=640/e;e=640,t=Math.round(t*r)}return{width:e,height:t}};d.prototype.Update_Display_Watermark=function(e,t,r){if(!("function"==typeof OffscreenCanvas&&this.waterMarkCanvas instanceof OffscreenCanvas&&OffscreenCanvasRenderingContext2D)||OffscreenCanvasRenderingContext2D.prototype.measureText){var n=t<512||r<288?16:this.watermarkPosition,a=this.Should_Watermark_Repeated(t,r),i=l(t,r);t=i.width,r=i.height;var o=a?this.WaterMarkRGBA.Get_Repeated_WaterMarkRGBA({canvas:this.waterMarkCanvas,name:this.sharingWaterMarkName,width:t,height:r,opacity:this.waterMarkOpacity,position:n}):this.WaterMarkRGBA.Get_WaterMarkRGBA({canvas:this.waterMarkCanvas,name:this.sharingWaterMarkName,width:t,height:r,opacity:this.waterMarkOpacity,position:n});e.updateWatherMark(t,r,o)}},d.prototype.Should_Update_Watermark=function(e,t,r){if(!this.isCreateSharingWaterMark)return!1;var n=!1,a=l(t,r);a.width===e.watermarkWidth&&a.height===e.watermarkHeight||(n=!0);var i=this.Should_Watermark_Repeated(t,r);e.IsSetWaterMark()||(n=!0),i!==e.IsWatermarkRepeated()&&(n=!0,e.SetWatermarkRepeated(i)),this.waterMarkOpacity&&this.waterMarkOpacity!==e.GetWatermarkOpacity()&&(n=!0,e.SetWatermarkOpacity(this.waterMarkOpacity));var o=t<512||r<288?16:this.watermarkPosition;return o!==e.GetWatermarkPosition()&&(n=!0,e.SetWatermarkPosition(o)),n},d.prototype.Update_Sharing_Canvas_Size=function(e){var t=e.width,r=e.height;this.SharingCanvasSizeInfo={width:Math.round(t),height:Math.round(r)}},d.prototype.ClearQueue=function(){try{var e,t=c(this.sharingQueue.ssrcQueueMap);try{for(t.s();!(e=t.n()).done;)for(var r=a()(e.value,2),n=(r[0],r[1]);!n.isEmpty();){var i=n.dequeue();i.yuvdata&&i.yuvdata instanceof u.c&&i.yuvdata.recycle(),i.dataptr&&Module._free(i.dataptr)}}catch(e){t.e(e)}finally{t.f()}}catch(e){this.Log_Error("Exception from SharingRender.ClearQueue",e)}this.sharingQueue&&this.sharingQueue.ClearQueue(),this.mouseQueue&&this.mouseQueue.ClearQueue(),this.currentSharingHeight=0,this.currentSharingWidth=0,this.currentSharingLogicHeight=0,this.currentSharingLogicWidth=0},d.prototype.Get_Decoded_Sharing_Frame=function(e){if(this.sharingQueue){var t=this.GetLogicalSSRCPart(e,this.isFromMainSession),r=this.sharingQueue.GetQueue(t);return r?r.dequeue():null}},d.prototype.Get_Decoded_Mouse_Frame=function(e){if(this.mouseQueue){var t=this.GetLogicalSSRCPart(e,this.isFromMainSession),r=this.mouseQueue.GetQueue(t);return r?r.dequeue():null}},d.prototype.Put_Sharing_Data_From_Queue=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:50;if(this.sharingQueue){var r=this.GetLogicalSSRCPart(e.ssrc,e.isFromMainSession);this.firstFrameForIOS||r!=this.currentshareactive>>10||(this.firstFrameForIOS=!0,this.Notify_APPUI?this.Notify_APPUI(i.c,this.currentshareactive):postMessage({status:o.FIRST_SHARING_FRAME_FOR_MOBILE,ssrc:this.currentshareactive}));var n=this.sharingQueue.GetQueue(r);n||(n=this.sharingQueue.AddQueue(r)),n.enqueue(e),this.lfTimeStamp&&(this.sharingFps?this.sharingFps=500/(e.ntptime-this.lfTimeStamp)+this.sharingFps/2:this.sharingFps=1e3/(e.ntptime-this.lfTimeStamp)),this.sharingFps!=1/0&&this.sharingFps||(this.sharingFps=20),this.lfTimeStamp=e.ntptime;var a=this.sharingQueue.GetQueueLength(r),s=a-t;for(this.maxQueueLength=t;s>=0;){var _=this.Get_Decoded_Sharing_Frame(e.ssrc);_.yuvdata instanceof u.c&&_.yuvdata.recycle(),_.dataptr&&Module._free(_.dataptr),s--}}},d.prototype.Get_Current_QueueLength=function(){if(this.sharingQueue){var e=this.currentshareactive,t=this.GetLogicalSSRCPart(e,this.isFromMainSession);return this.sharingQueue.GetQueueLength(t)}},d.prototype.Put_Mouse_Data_Into_Queue=function(e){if(this.mouseQueue){var t=this.GetLogicalSSRCPart(e.ssrc,e.isFromMainSession),r=this.mouseQueue.GetQueue(t);r||(r=this.mouseQueue.AddQueue(t)),r.enqueue(e);for(var n=this.mouseQueue.GetQueueLength(t)-10;n>=0;)this.Get_Decoded_Mouse_Frame(e.ssrc),n--}},d.prototype.GetLogicalSSRCPart=function(e,t){var r=e>>10;return t&&(r|=1<<23),r},d.prototype.SetcATimeStamp=function(e){this.cATimeStamp=e,this.asTime=performance.now()},d.prototype.Log_Error=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.globalTracingLogger?this.globalTracingLogger.error(e,t):Object(u.g)(e,t)},d.prototype.setMode=function(e){this.Stop_Draw2(),this.mode=e},d.prototype.Start_Draw2=function(e){var t=this;this.mode?(this.SharingRenderInterval&&(clearInterval(this.SharingRenderInterval),this.SharingRenderInterval=0),this.SharingRenderInterval=setInterval((function(){t.No_Bindthis_Interval()}),20)):this.Start_Draw()},d.prototype.Stop_Draw2=function(e){this.mode?this.SharingRenderInterval&&(clearInterval(this.SharingRenderInterval),this.SharingRenderInterval=0):this.Stop_Draw()},t.a=d},function(e,t,r){var n=r(25);e.exports=function(e){if(Array.isArray(e))return n(e)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(e){if(Array.isArray(e))return e},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,i,o,s=[],_=!0,u=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;_=!1}else for(;!(_=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);_=!0);}catch(e){u=!0,a=e}finally{try{if(!_&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw a}}return s}},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports},,function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,"Channel_Agent",(function(){return Channel_Agent})),__webpack_require__.d(__webpack_exports__,"Open_Sharing_WebSocket_Connect",(function(){return Open_Sharing_WebSocket_Connect})),__webpack_require__.d(__webpack_exports__,"sharing_websocket_on_open",(function(){return sharing_websocket_on_open})),__webpack_require__.d(__webpack_exports__,"sharing_websocket_on_message",(function(){return sharing_websocket_on_message})),__webpack_require__.d(__webpack_exports__,"sharing_websocket_on_close",(function(){return sharing_websocket_on_close})),__webpack_require__.d(__webpack_exports__,"sharing_websocket_on_error",(function(){return sharing_websocket_on_error})),__webpack_require__.d(__webpack_exports__,"JsMediaSDK_Log",(function(){return JsMediaSDK_Log})),__webpack_require__.d(__webpack_exports__,"Recieve_Wb_Packet",(function(){return Recieve_Wb_Packet})),__webpack_require__.d(__webpack_exports__,"Send_Wb_Rtp_Packet",(function(){return Send_Wb_Rtp_Packet})),__webpack_require__.d(__webpack_exports__,"wcl_trace_log",(function(){return wcl_trace_log})),__webpack_require__.d(__webpack_exports__,"sharing_qos_monitor",(function(){return sharing_qos_monitor})),__webpack_require__.d(__webpack_exports__,"responseSharingQosData",(function(){return responseSharingQosData})),__webpack_require__.d(__webpack_exports__,"frame_callback",(function(){return frame_callback})),__webpack_require__.d(__webpack_exports__,"frame_callback_video_mode",(function(){return frame_callback_video_mode})),__webpack_require__.d(__webpack_exports__,"frame_callback_mouse_video_mode",(function(){return frame_callback_mouse_video_mode})),__webpack_require__.d(__webpack_exports__,"Send_Data",(function(){return Send_Data})),__webpack_require__.d(__webpack_exports__,"decode_callback",(function(){return decode_callback})),__webpack_require__.d(__webpack_exports__,"Sharing_Encode_Sending_Status",(function(){return Sharing_Encode_Sending_Status})),__webpack_require__.d(__webpack_exports__,"IsSupportMultiThread",(function(){return IsSupportMultiThread})),__webpack_require__.d(__webpack_exports__,"hardcodecpunumber",(function(){return hardcodecpunumber})),__webpack_require__.d(__webpack_exports__,"LimitWebCodecsEncoderTo360_js",(function(){return LimitWebCodecsEncoderTo360_js})),__webpack_require__.d(__webpack_exports__,"UserAgentIsTesla_js",(function(){return UserAgentIsTesla_js})),__webpack_require__.d(__webpack_exports__,"IsSupportMultiThreadForWebcodec",(function(){return IsSupportMultiThreadForWebcodec})),__webpack_require__.d(__webpack_exports__,"GetCscThreadNum",(function(){return GetCscThreadNum})),__webpack_require__.d(__webpack_exports__,"GetEncThreadNum",(function(){return GetEncThreadNum})),__webpack_require__.d(__webpack_exports__,"Sharing_Decode",(function(){return Sharing_Decode})),__webpack_require__.d(__webpack_exports__,"GetLogLevel_js",(function(){return GetLogLevel_js})),__webpack_require__.d(__webpack_exports__,"Send_Data_Codec",(function(){return Send_Data_Codec})),__webpack_require__.d(__webpack_exports__,"LOG_OUT",(function(){return LOG_OUT})),__webpack_require__.d(__webpack_exports__,"Utf8ArrayToStr",(function(){return Utf8ArrayToStr})),__webpack_require__.d(__webpack_exports__,"Write_App_Log",(function(){return Write_App_Log})),__webpack_require__.d(__webpack_exports__,"Pace_Sender",(function(){return Pace_Sender})),__webpack_require__.d(__webpack_exports__,"Compute_WebSocket_Speed",(function(){return Compute_WebSocket_Speed})),__webpack_require__.d(__webpack_exports__,"Compute_Capture_Delay",(function(){return Compute_Capture_Delay})),__webpack_require__.d(__webpack_exports__,"APP_Troubleshoting_Info",(function(){return APP_Troubleshoting_Info})),__webpack_require__.d(__webpack_exports__,"Sharing_Capture",(function(){return Sharing_Capture})),__webpack_require__.d(__webpack_exports__,"Update_WebSokcet_Speed",(function(){return Update_WebSokcet_Speed})),__webpack_require__.d(__webpack_exports__,"SAVE_IV",(function(){return SAVE_IV})),__webpack_require__.d(__webpack_exports__,"getWasmMemory",(function(){return getWasmMemory})),__webpack_require__.d(__webpack_exports__,"freeWasmMemory",(function(){return freeWasmMemory})),__webpack_require__.d(__webpack_exports__,"MCMMonitor_Sharing_LOG",(function(){return MCMMonitor_Sharing_LOG})),__webpack_require__.d(__webpack_exports__,"Send_Out_Qos",(function(){return Send_Out_Qos})),__webpack_require__.d(__webpack_exports__,"BigLog_js",(function(){return BigLog_js})),__webpack_require__.d(__webpack_exports__,"Set_Share_Mode_js",(function(){return Set_Share_Mode_js}));var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5),_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__),_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(4),_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__),_common_common__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(1),_common_consts__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(0),_inside_JsMediaBuffer__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(15),_common_WebGLCanvas__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(9),_inside_JsMediaSDK_SharingRender__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(31),_common_enums_CommonEnums__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(8),_common_jsEvent__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(11),_common_LogAgent__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(20),_common_ZoomSharedArrayBufferUtils__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__(10),_Sharing_SharingMaster__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__(13),sharing_encode,sharing_encode_uninit,sharing_try_analysis,sharing_try_analysis2,sharing_encode_init,sharing_set_data_encryption,sharing_pause_encode,sharing_stop_encode,sharing_resume_encode,sharing_set_websocket_speed,sharing_add_cooker_info,sharing_remove_cooker_info,get_sharing_meat_weight,set_sharing_encryption_key_directly,add_roster_info_directly,add_rev_channel,remove_rec_channel,update_sharing_uplink_bandwidth_limitation_by_server,request_sharing_qos_data,set_annotation_action;Object.keys(_common_consts__WEBPACK_IMPORTED_MODULE_3__).forEach((function(e){return self[e]=_common_consts__WEBPACK_IMPORTED_MODULE_3__[e]})),WebAssembly.instantiateStreaming=!1,self.wasmSuccessEvent=_common_consts__WEBPACK_IMPORTED_MODULE_3__.Sharing_Dec_WASM_OK,self.wasmFailEvent=_common_consts__WEBPACK_IMPORTED_MODULE_3__.Sharing_Dec_WASM_FAILED,self.databaseName="VIDEO_FILE",self.instantiateCachedURL=_common_common__WEBPACK_IMPORTED_MODULE_2__.h;var dcsIDMap=new Map,collectLogInterval,collect_sharing_monitor_info,startMonitorLogFlag=!1,ringBufferFlag=!1,sharingRTPRTCPnumb=0,change_connect_type,request_nack_t_periodically_for_qos,isDataChannelOpen,sharing_decode_ptr,sharing_qos_nack_interval,last_time_capture_sharing=0,data_length=0;self.onWasmModuleReady=function(){sharing_encode=Module.cwrap("_Sharing_Encode","number",["number","number","number","number","number","number"]),sharing_encode_uninit=Module.cwrap("_Sharing_Encode_Uninit","number",["number"]),sharing_try_analysis=Module.cwrap("_Sharing_Encode_Try_Analysis","number",["number","array","number"]),sharing_try_analysis2=Module.cwrap("_Sharing_Encode_Try_Analysis","number",["number","number","number"]),sharing_encode_init=Module.cwrap("_Sharing_Encode_Init","number",["number","string","string","number","number","number","boolean","boolean","boolean"]),sharing_set_data_encryption=Module.cwrap("_Sharing_Set_Data_Encryption","number",["number","number"]),request_sharing_qos_data=Module.cwrap("_Request_Sharing_Qos_Data","number",["number","boolean","boolean"]),sharing_pause_encode=Module.cwrap("_Sharing_Pause_Encode","number",["number"]),sharing_stop_encode=Module.cwrap("_Sharing_Stop_Encode","number",["number"]),sharing_resume_encode=Module.cwrap("_Sharing_Resume_Encode","number",["number"]),sharing_set_websocket_speed=Module.cwrap("_Sharing_Websocket_Speed","number",["number","number"]),sharing_add_cooker_info=Module.cwrap("_Add_Sharing_Cooker_info","number",["number","number","number","number"]),get_sharing_meat_weight=Module.cwrap("_Get_Sharing_Meat_Weight","number",["number"]),sharing_remove_cooker_info=Module.cwrap("_Remove_Sharing_Cooker_Info","number",["number","number"]),set_sharing_encryption_key_directly=Module.cwrap("_Set_Sharing_Encryption_Key_Directly","number",["number","number","number","number"]),add_roster_info_directly=Module.cwrap("_Add_Roster_Info_Directly","number",["number","number","number","number"]),add_rev_channel=Module.cwrap("_Add_Rev_Channel","number",["number","number","number","number"]),remove_rec_channel=Module.cwrap("_Remove_Rev_Channel","number",["number","number"]),update_sharing_uplink_bandwidth_limitation_by_server=Module.cwrap("_update_sharing_uplink_bandwidth_limitation_by_server","number",["number","number"]),set_annotation_action=Module.cwrap("_set_annotation_action","number",["number","number","number","number"]),collect_sharing_monitor_info=Module.cwrap("_collect_sharing_monitor_info","number",["number","boolean","boolean"]),change_connect_type=Module.cwrap("_Change_Connect_Type_For_Sharing","number",["number","number"]),request_nack_t_periodically_for_qos=Module.cwrap("_request_nack_t_periodically_for_sharing_qos","number",["number"])};var total_app_buffer_unsend_encoded_byte=0,peroid_start_time=null,peroid_total_amount=0,peroid_speed=0,last_peroid_speed=0,SEND_SPEED_DEFAULT=8e5,sharing_media_connect=null,sharing_media_connect_Debug=null,headerMap=new Map,stopDrawImage=!1,sharing_handle=null,decode_jpeg_data=null,decode_jpeg_width=null,decode_jpeg_height=null,imagBMap=new Map,isChromeOrEdge=!1,imageInterval=null,isSharingEncode=!1,can_I_capture_desktop=!1,last_encode_raw_frame=null,monitor_sharing_elapsed_compute_time=0,monitor_sharing_elapsed_write_time=0,monitor_sharing_last_time=0,monitor_sharing_first=!0,monitor_sharing_count=0,monitor_sharing_encoded_delta_frames=0,monitor_sharing_encoded_total_frames=0,monitor_stream_index=0,sharing_encode_width=0,sharing_encode_height=0,sharing_encode_total_frames=0,sharing_max_sub_for_me=0,sharing_max_encoding_time=0,sharing_min_encoding_time=0,sharing_avg_encoding_time=0,sharing_sdev_encoding_time=0,sharing_encode_encrypt=!1,sharing_buffer=new Queue,sharing_capture_interval=0,sharing_raw_data_width=0,sharing_raw_data_height=0,sharing_memory_ptr=0,sharingFrameDataBuffer,current_websocket_speed=0,monitor_sharing_send_buffer=0,monitor_sharingD_width=0,monitor_sharingD_height=0,monitor_sharing_max_size=1,monitor_sharing_sharer_ssrc=0,monitor_sharing_fps=0,monitor_sharing_avg_fps=0,monitor_sharing_min_fps=0,monitor_sharing_max_fps=0,monitor_sharing_encoded_min_fps=0,monitor_sharing_encoded_max_fps=0,monitor_sharing_encoded_avg_fps=0,monitor_sharing_encoded_fps=0,pdu_queue=new Queue,buffer_amount_queue=new Queue,Sending_Pace_Start=!1,Sending_Pace_Count=0,pace_start_time=0,pace_sender_interval=0,WEBSOCKET_THROTTLING=2e4,meetingnumb,meetingid,sharingDecQueue=new _inside_JsMediaBuffer__WEBPACK_IMPORTED_MODULE_4__.a,mouseDecQueue=new _inside_JsMediaBuffer__WEBPACK_IMPORTED_MODULE_4__.a,sharingRenderContext,currentshareactive,offscreenCanvasContext=null,offscreenCanvasId=null,isSupportOffscreenCanvas=!1,isSharingPlayWork=!1,sharingRenderInterval=null,isCreateSharingWaterMark=null,sharingWaterMarkName=null,waterMarkCanvasInWorker=null,SharingRenderObj=null,flipSend=!0,is32bitbrowser,sharingenczoomid,sharingencid,sharingGetIvInteval,isSendSharing=!1,lastIv,yview=null,uview=null,vview=null,canvasForVideoTrackReader,canvasContextForVideoTrackReader,pduBuffer=new Queue,threadState=THREAD_STATE_IDLE,isCreateWorkers=!1,multiThreadFlag=!1,multiThreadNum=1,isCloseThreads=!1,loadedThreadCount=0,dataFormat,isSupportVideoTrackReader,isSupportMediaStreamTrackProcessor,frameStream,frameReader,sMonitorCaptureFrameCount=0,isLogPrinted=!1,uplimit=0,keyAndrosterInfo,isFromMainSessionShare=!1,vsport;function Queue(){this.a=[],this.b=0,this.residue=null}function Channel_Agent(){function e(e){var t=null,r=_common_consts__WEBPACK_IMPORTED_MODULE_3__.serverHeartbeatMaxTimeoutSeconds,n=null,a=e.onmessage,i=e.onopen,o=e.onclose;e.onmessage=function(r){t=(new Date).getTime(),a.call(e,r)},e.onopen=function(a){t=(new Date).getTime(),function(){if(n)return;n=setInterval((function(){(new Date).getTime()-t>=1e3*r&&(clearInterval(n),n=null,e.socket.close())}),1e3)}(),i.call(e,a,e)},e.onclose=function(t){try{clearInterval(n)}catch(e){Object(_common_common__WEBPACK_IMPORTED_MODULE_2__.g)("WebSocket closed",e)}o.call(e,t,e)}}this.socket=null,this.onopen=null,this.onmessage=null,this.onerror=null,this.onclose=null,this.websocketaddress=null,this.startwebsocketreconnecttime=null,this.reconnect=null,this.connectIndex=0,this.activeclosewebsocket=!1,this.init=function(t,r,n,a,i){this.websocketaddress=t,this.onopen=r,this.onmessage=n,this.onerror=a,this.onclose=i,e(this)},this.connect=function(e,t,r,n,a){var i=this;Object(_common_common__WEBPACK_IMPORTED_MODULE_2__.e)("SB"),i.init(e,t,r,n,a),i.reconnect=function(){var e=this;if(!i.isReconnectNow&&!i.isTimerExist){i.isReconnectNow=!0,i.isTimerExist=!0;var t=Math.pow(2,i.connectIndex)-1;i.connectIndex+=1,setTimeout((function(){i.activeclosewebsocket||(i.isTimerExist=!1,i.startwebsocketreconnecttime=null,i.socket=new WebSocket(e.websocketaddress),i.socket.binaryType="arraybuffer",i.socket.onopen=function(e){i.isReconnectNow=!1,Object(_common_common__WEBPACK_IMPORTED_MODULE_2__.e)("SE"),i.startwebsocketreconnecttime=(new Date).getTime()/1e3,i.onopen(e)},i.socket.onmessage=function(e){i.onmessage(e)},i.socket.onerror=function(e){Object(_common_common__WEBPACK_IMPORTED_MODULE_2__.e)("SCLOSE"),i.socket.close()},i.socket.onclose=function(e){Object(_common_common__WEBPACK_IMPORTED_MODULE_2__.e)("SCLOSE"),i.isReconnectNow=!1,i.onclose(e),i.activeclosewebsocket||(i.connectIndex<10?i.reconnect():(postMessage({status:Sharing_Dec_WebSocket_FAILED}),console.log("NetWork is Bad, Don't to reconnect the serer!")))})}),1e3*t)}},i.reconnect()},this.send=function(e){isSendSharing||1!=sharing_media_connect.socket.readyState?(total_app_buffer_unsend_encoded_byte+=e.length,buffer_amount_queue.enqueue(e),Pace_Sender()):sharing_media_connect.socket.send(e)},this.close=function(){try{this.activeclosewebsocket=!0,this.socket.close()}catch(e){console.warn("force close",e)}}}function Open_Sharing_WebSocket_Connect(e,t,r,n,a){var i=new Channel_Agent;return i.connect(e,t,r,n,a),i}function sharing_websocket_on_open(){postMessage({status:Sharing_Dec_WebSocket_OK})}function sharing_websocket_on_message(e){var t=new Uint8Array(e.data);if(102!=t[0])if(0==t[0])sharing_media_connect&&sharing_media_connect.send(t);else if(sharing_handle)if(isSharingEncode){if(e.data instanceof ArrayBuffer){var r=new Uint8Array(e.data);pdu_queue.enqueue(r);for(var n=pdu_queue.dequeue();n;)sharing_try_analysis(sharing_handle,n,n.length),n=pdu_queue.dequeue()}}else Sharing_Decode(e.data);else if(e.data instanceof ArrayBuffer){var a=new Uint8Array(e.data);0!=a[0]&&pdu_queue.enqueue(a)}}function sharing_websocket_on_close(e){JsMediaSDK_Log("sharing_websocket_on_close")}function sharing_websocket_on_error(e){JsMediaSDK_Log("sharing_websocket_on_error")}function JsMediaSDK_Log(e){console.log(e)}function Recieve_Wb_Packet(e,t){var r=new Uint8Array(t),n=Module.HEAP8.subarray(e+0,e+t);r.set(n,0,t),postMessage({status:_common_consts__WEBPACK_IMPORTED_MODULE_3__.WHITEBOARD_WORKER_MESSAGE,data:r},[r.buffer])}function Send_Wb_Rtp_Packet(e,t,r){var n=new Uint8Array(r+8),a=Module.HEAP8.subarray(t+0,t+r);n.set(a,8),n[0]=109;var i=new Uint32Array(1);i[0]=e;var o=new Uint8Array(i.buffer);n.set(o,4),sharing_media_connect.socket.send(n)}function wcl_trace_log(e,t){logAgent&&logAgent.writeWasmLog(e,t)}Queue.prototype.getLength=function(){return this.a.length-this.b},Queue.prototype.isEmpty=function(){return 0==this.a.length},Queue.prototype.enqueue=function(e){this.a.push(e)},Queue.prototype.dequeue=function(){if(0!=this.a.length){var e=this.a[this.b];return 2*++this.b>=this.a.length&&(this.a=this.a.slice(this.b),this.b=0),e}return null},Queue.prototype.peek=function(){return 0<this.a.length?this.a[this.b]:void 0};var qosMonitorMGR={sharingqosIntervalId:0,sharingmonitorPanelFlag:!1,panelpollingInterval:0},sharing_pause=!0,supportedSharingFrameMaxBytes,maxSupportedSharingFrameMaxBytes,SharedBufferListObj;function sharing_qos_monitor(){qosMonitorMGR.sharingqosIntervalId&&clearInterval(qosMonitorMGR.sharingqosIntervalId),qosMonitorMGR.sharingmonitorPanelFlag&&(qosMonitorMGR.sharingqosIntervalId=setInterval((function(){if(isSendSharing&&!sharing_pause)request_sharing_qos_data(sharing_handle,!0);else if(!isSendSharing&&(!isSupportOffscreenCanvas||isSharingPlayWork)){var e=isFromMainSessionShare?_Sharing_SharingMaster__WEBPACK_IMPORTED_MODULE_11__.e():sharing_handle;e&&request_sharing_qos_data(e,!1)}}),qosMonitorMGR.panelpollingInterval||_common_consts__WEBPACK_IMPORTED_MODULE_3__.QOS_DEFAULT_POLLING_INTERVAL))}function responseSharingQosData(e,t,r,n,a,i,o){if(qosMonitorMGR.sharingmonitorPanelFlag){var s={width:e,height:t,fps:r,rtt:n,jitter:a,avg_loss:i,max_loss:o};postMessage({status:_common_jsEvent__WEBPACK_IMPORTED_MODULE_8__.g,data:s})}}function frame_callback(e,t,r,n){var a=Module.HEAP8.subarray(e+0,e+t);decode_jpeg_data=new Uint8Array(a),decode_jpeg_width=r,decode_jpeg_height=n}function InitSharingDecode(){supportedSharingFrameMaxBytes=32e5,maxSupportedSharingFrameMaxBytes=13271040,SharedBufferListObj=new _common_common__WEBPACK_IMPORTED_MODULE_2__.a(5,maxSupportedSharingFrameMaxBytes)}var canIReceiveFirstSharingFrameMap=new Map,as_render_lasted_time=0,as_render_fps_history=[0,0,0,0,0],as_render_resolution_histoy=[],as_render_hight=0;function as_render_statistic(){if(0==as_render_lasted_time)as_render_lasted_time=(new Date).getTime(),as_render_fps_history[0]++,as_render_hight=format_height,as_render_resolution_histoy.push(as_render_hight);else{var now=(new Date).getTime(),elapsed=(now-as_render_lasted_time)/1e3,sum=eval(as_render_fps_history.join("+"));elapsed>=5?(console.log("<<< elapsed %d s as render sum %d fps",elapsed,sum,as_render_fps_history,"hight",as_render_resolution_histoy),as_render_resolution_histoy=[format_height],as_render_fps_history=[1,0,0,0,0],as_render_lasted_time=now):(as_render_hight!=format_height&&(as_render_hight=format_height,as_render_resolution_histoy.push(as_render_hight)),as_render_fps_history[Math.floor(elapsed%5)]++)}}function frame_callback_video_mode(e,t,r,n,a,i,o,s,_,u,c,h,d,l){var f=!(l==sharing_handle);isFromMainSessionShare=f,canIReceiveFirstSharingFrameMap.get(n)||(canIReceiveFirstSharingFrameMap.set(n,!0),postMessage({status:SHARING_FIRST_DECODE_FRAME_RECEIVED,ssrc:n})),monitor_sharing_sharer_ssrc=n;for(var p=Module.HEAP8.subarray(e+0,e+t),g=Module.HEAPU8.subarray(r,r+8),m=0,E=0;E<8;E++)m+=g[E]*Math.pow(256,E);var v=n,T=a,y=i;if(monitor_sharingD_width=T,monitor_sharingD_height=y,isSupportOffscreenCanvas){if(!isSharingPlayWork)return;var S=new _common_common__WEBPACK_IMPORTED_MODULE_2__.c(SharedBufferListObj);if(S.storeSync(p)){var b={yuvdata:S,ntptime:m,ssrc:v,width:T,height:y,r_x:o,r_y:s,r_w:_,r_h:u,logic_w:c,logic_h:h,yuv_limited:d,isFromMainSession:f};SharingRenderObj&&SharingRenderObj.Put_Sharing_Data_From_Queue(b,5)}}else{var R=new Uint8Array(p);postMessage({status:SHARING_DATA_VIDEO_MODE,data:R,sharing_timestamp:m,sharing_ssrc:v,sharing_width:T,sharing_height:y,rendering_x:o,rendering_y:s,rendering_w:_,rendering_h:u,logic_w:c,logic_h:h,yuv_limited:d,isFromMainSession:f},[R.buffer])}}function frame_callback_mouse_video_mode(e,t,r,n,a,i,o,s,_,u,c,h){var d=new Uint8Array(t),l=Module.HEAP8.subarray(e+0,e+t);d.set(l,0,t);var f=n,p=a,g=i,m=!(h==sharing_handle);if(isSupportOffscreenCanvas){var E={type:"mouse_data",buffer:d,ntptime:r,ssrc:f,width:p,height:g,r_x:o,r_y:s,mLogic_w:_,mLogic_h:u,sync_id:c,isFromMainSession:m};SharingRenderObj&&SharingRenderObj.Put_Mouse_Data_Into_Queue(E)}else postMessage({status:MOUSE_DATA_VIDEO_MODE,data:d,mouse_timestamp:r,mouse_ssrc:f,mouse_width:p,mouse_height:g,mouse_x:o,mouse_y:s,mLogic_w:_,mLogic_h:u,sync_id:c,isFromMainSession:m},[d.buffer])}function Send_Data(e,t,r){var n=new Uint8Array(t),a=Module.HEAP8.subarray(e+0,e+t);n.set(a,0,t),r==sharing_handle?sharing_media_connect.send(n):_Sharing_SharingMaster__WEBPACK_IMPORTED_MODULE_11__.h.socket&&1==_Sharing_SharingMaster__WEBPACK_IMPORTED_MODULE_11__.h.socket.readyState&&_Sharing_SharingMaster__WEBPACK_IMPORTED_MODULE_11__.h.socket.send(n)}function decode_callback(e,t,r){monitor_sharing_max_size=t,postMessage({status:SHARING_DECODE_MESSAGE,ssrc:e,size:t,isFromMainSession:!(r==sharing_handle)})}function Sharing_Encode_Sending_Status(e,t,r,n,a){sharing_encode_width=e,sharing_encode_height=t,sharing_encode_total_frames=r,sharing_max_sub_for_me=n,monitor_stream_index=a,0==monitor_sharing_encoded_total_frames?(monitor_sharing_encoded_total_frames=r,monitor_sharing_encoded_delta_frames=0):(monitor_sharing_encoded_delta_frames+=r-monitor_sharing_encoded_total_frames,monitor_sharing_encoded_total_frames=r)}function MaybeCreateDecodeMultiThreadAndAnalysis(e,t,r,n){if(isSendSharing||++sharingRTPRTCPnumb%24e4==0&&postMessage({status:MONITOR_MESSAGE,data:"WCL_M,RTCPSN"+sharingRTPRTCPnumb}),t&&r){if(multiThreadFlag&&(77==e[0]||79==e[0])&&!isCreateWorkers){threadState=THREAD_STATE_CREATING;for(var a=0;a<multiThreadNum;a++)PThread.allocateUnusedWorker(),PThread.loadWasmModuleToWorker(PThread.unusedWorkers[a],(function(){++loadedThreadCount==multiThreadNum&&(threadState=THREAD_STATE_CREATED)}));isCreateWorkers=!0}if(threadState==THREAD_STATE_IDLE)n?sharing_try_analysis2(t,n,e.length):r(t,e,e.length);else if(threadState===THREAD_STATE_CREATING)pduBuffer.enqueue(e);else if(threadState===THREAD_STATE_CREATED){for(var i=pduBuffer.dequeue();i;)r(t,i,i.length),i=pduBuffer.dequeue();r(t,e,e.length)}}}function MaybeCreateEncodeMultiThread(e){if(multiThreadFlag&&!isCreateWorkers){threadState=THREAD_STATE_CREATING;for(var t=0;t<multiThreadNum;t++)PThread.allocateUnusedWorker(),PThread.loadWasmModuleToWorker(PThread.unusedWorkers[t],(function(){++loadedThreadCount==multiThreadNum&&(threadState=THREAD_STATE_CREATED,isCreateWorkers=!0,SharingEncodeInit(e))}))}}function SharingEncodeInit(e){if(!sharing_handle){var t,r=lastIv;t=r?r.length:0;var n;n=getWasmMemory(r),sharing_handle=sharing_encode_init(e.ssid,meetingnumb,meetingid,n,t,uplimit,!1,!0,!1),logAgent&&logAgent.init({workerType:_common_enums_CommonEnums__WEBPACK_IMPORTED_MODULE_7__.b.SHARING_ENCODE}),freeWasmMemory(n),sharing_handle?(keyAndrosterInfo&&Set_Enocding_Key_And_Roster(sharing_handle,keyAndrosterInfo.updateParams.userId,keyAndrosterInfo.updateParams.sn,keyAndrosterInfo.updateParams.encryptKey,keyAndrosterInfo.updateParams.encryptType),sharing_set_data_encryption(sharing_handle,sharing_encode_encrypt?1:0)):postMessage({status:Sharing_Handle_FAILED})}isSupportMediaStreamTrackProcessor?isSupportMediaStreamTrackProcessor&&frameReader&&(last_encode_raw_frame&&(last_encode_raw_frame=null),frameReader.read().then((function(e){var t=e.done,r=e.value;t?r&&r.close():sharingEncodeFrammeProcess({data:r})}))):postMessage({status:Video_Capture_Tick})}function IsSupportMultiThread(){return multiThreadFlag?1:0}function hardcodecpunumber(){return navigator.hardwareConcurrency||1}function LimitWebCodecsEncoderTo360_js(){return!1}function UserAgentIsTesla_js(){return!1}function IsSupportMultiThreadForWebcodec(){return 0}function GetCscThreadNum(){return 1}function GetEncThreadNum(){return 3}function Sharing_Decode(e){e instanceof ArrayBuffer&&MaybeCreateDecodeMultiThreadAndAnalysis(new Uint8Array(e),sharing_handle,sharing_try_analysis)}function GetLogLevel_js(){return 1}var sendsend=!1;function Send_Data_Codec(e,t){var r=new Uint8Array(t),n=Module.HEAP8.subarray(e+0,e+t);r.set(n,0,t)}function LOG_OUT(e,t){logAgent&&logAgent.writeWasmLog(e,t)}function Utf8ArrayToStr(e){var t,r,n,a,i,o;for(t="",n=e.length,r=0;r<n;)switch((a=e[r++])>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:t+=String.fromCharCode(a);break;case 12:case 13:i=e[r++],t+=String.fromCharCode((31&a)<<6|63&i);break;case 14:i=e[r++],o=e[r++],t+=String.fromCharCode((15&a)<<12|(63&i)<<6|(63&o)<<0)}return t}function Write_App_Log(){var e=" bufferAmount: "+sharing_media_connect.socket.bufferedAmount+", buffer queue length: "+buffer_amount_queue.getLength()+", unsend byte: "+(total_app_buffer_unsend_encoded_byte+peroid_total_amount)+", send delay"+Compute_Capture_Delay()+", websocket speed: "+current_websocket_speed+"\n";sharing_media_connect_Debug&&sharing_media_connect_Debug.send(e)}var lastTimestamp=0,duration=150;function Pace_Sender(){if(0!==lastTimestamp?(duration=performance.now()-lastTimestamp)>=150&&(lastTimestamp=performance.now()):lastTimestamp=performance.now(),!(sharing_media_connect.socket.bufferedAmount>WEBSOCKET_THROTTLING)){if(duration>=150&&can_I_capture_desktop&&(buffer_amount_queue.getLength()<=20&&current_websocket_speed>0&&sharing_avg_encoding_time&&sharing_avg_encoding_time>0&&1e3*(total_app_buffer_unsend_encoded_byte+WEBSOCKET_THROTTLING)/current_websocket_speed<sharing_avg_encoding_time||total_app_buffer_unsend_encoded_byte-WEBSOCKET_THROTTLING<0))can_I_capture_desktop=!can_I_capture_desktop,isSupportMediaStreamTrackProcessor&&frameReader?(last_encode_raw_frame&&(last_encode_raw_frame=null),frameReader.read().then((function(e){var t=e.done,r=e.value;if(t)console.log("Stream is done!!!");else{var n={data:r};1e3==sMonitorCaptureFrameCount&&(postMessage({status:_common_consts__WEBPACK_IMPORTED_MODULE_3__.SHARING_CAPTURE_FRAME_COUNT_STATISTIC}),sMonitorCaptureFrameCount=0),sMonitorCaptureFrameCount++,sharingEncodeFrammeProcess(n)}}))):last_encode_raw_frame?(Sharing_Capture(last_encode_raw_frame),last_encode_raw_frame=null):postMessage({status:Video_Capture_Tick});else{var e=performance.now();last_time_capture_sharing&&data_length&&sharing_memory_ptr&&e-last_time_capture_sharing>3e3&&(last_time_capture_sharing=e,sharing_encode(sharing_handle,sharing_memory_ptr,data_length,sharing_raw_data_width,sharing_raw_data_height,dataFormat))}if(buffer_amount_queue.getLength()>20&&!Sending_Pace_Start){Sending_Pace_Start=!0,Sending_Pace_Count=0;var t=new Int32Array(2),r=new Int8Array(t.buffer);r[0]=28,pace_start_time=(new Date).getTime(),t[1]=0,sharing_media_connect.socket.send(r)}if(Sending_Pace_Start&&20==Sending_Pace_Count){Sending_Pace_Start=!1;var n=new Int32Array(2),a=new Int8Array(n.buffer);a[0]=29,n[1]=(new Date).getTime()-pace_start_time,sharing_media_connect.socket.send(a)}for(var i=buffer_amount_queue.dequeue();i;){if(Sending_Pace_Count++,sharing_media_connect.socket.send(i),Compute_WebSocket_Speed(i),total_app_buffer_unsend_encoded_byte-=i.length,sharing_media_connect.socket.bufferedAmount>WEBSOCKET_THROTTLING)return void Write_App_Log();i=buffer_amount_queue.dequeue()}Write_App_Log()}}function Compute_WebSocket_Speed(e){var t;if(peroid_start_time){var r=(new Date).getTime()/1e3;if((t=r-peroid_start_time)>10){var n=peroid_total_amount-sharing_media_connect.socket.bufferedAmount;0==sharing_media_connect.socket.bufferedAmount?(last_peroid_speed=last_peroid_speed?.8*last_peroid_speed+.2*SEND_SPEED_DEFAULT:SEND_SPEED_DEFAULT,sharing_handle&&sharing_set_websocket_speed(sharing_handle,last_peroid_speed)):(monitor_sharing_send_buffer=n,peroid_speed=8*n/(1*t),last_peroid_speed=last_peroid_speed?.8*last_peroid_speed+.2*peroid_speed:SEND_SPEED_DEFAULT,sharing_handle&&sharing_set_websocket_speed(sharing_handle,last_peroid_speed)),peroid_total_amount-=n,peroid_start_time=r}}else peroid_total_amount=0,peroid_start_time=(new Date).getTime()/1e3,sharing_handle&&sharing_set_websocket_speed(sharing_handle,SEND_SPEED_DEFAULT);peroid_total_amount+=e.length}function Compute_Capture_Delay(){var e=total_app_buffer_unsend_encoded_byte+peroid_total_amount-WEBSOCKET_THROTTLING/2;return 0==current_websocket_speed||e<=0?0:current_websocket_speed>0?e/current_websocket_speed:void 0}function APP_Troubleshoting_Info(e,t){var r=new Uint8Array(t),n=Module.HEAP8.subarray(e+0,e+t);r.set(n,0,t),postMessage({status:APP_TROUBLESHOOTING_INFO,data:Utf8ArrayToStr(r)})}function Sharing_Capture(e){!isChromeOrEdge&&e?postMessage({status:Video_Capture_Tick,data:e.data},[e.data.buffer]):postMessage({status:Video_Capture_Tick})}function Update_WebSokcet_Speed(e){current_websocket_speed=current_websocket_speed?(current_websocket_speed+e)/2:e}function SAVE_IV(e,t){sharingGetIvInteval||(sharingGetIvInteval=setInterval((function(){sharing_handle&&get_sharing_meat_weight(sharing_handle)}),6e4));var r=new Uint8Array(t),n=Module.HEAP8.subarray(e+0,e+t);r.set(n,0,t),lastIv=r,postMessage({status:_common_consts__WEBPACK_IMPORTED_MODULE_3__.AES_GCM_IV_CALLBACK_FROM_WASM,data:r})}function getWasmMemory(e){if(!e)return 0;var t=Module._malloc(e.length);return Module.HEAPU8.subarray(t,t+e.length).set(e,0,e.length),t}function freeWasmMemory(e){e&&Module._free(e)}var enableReplaceCanvasWhenContextLost=!1;function webglcontextlostCallback(e,t){var r=t.canvas,n=t.rendercanvasID;enableReplaceCanvasWhenContextLost?(r.contextLostTimer&&(clearTimeout(r.contextLostTimer),r.contextLostTimer=null),r.contextLostTimer=setTimeout((function(){r.contextLostTimer=null,Object(_common_common__WEBPACK_IMPORTED_MODULE_2__.i)(n,!0)}),3e3)):Object(_common_common__WEBPACK_IMPORTED_MODULE_2__.i)(n)}function restoredFromContextLost(e,t){(sharingRenderContext=new _common_WebGLCanvas__WEBPACK_IMPORTED_MODULE_5__.a(e,0,void 0,{webglcontextlostCallback:webglcontextlostCallback,webglcontextrestoredCallback:webglcontextrestoredCallback,params:{canvas:e,rendercanvasID:t}})).contextGL||Object(_common_common__WEBPACK_IMPORTED_MODULE_2__.f)(t),SharingRenderObj.Set_Render_WebGL(sharingRenderContext)}function webglcontextrestoredCallback(e,t){var r=t.canvas,n=t.rendercanvasID;enableReplaceCanvasWhenContextLost?r.contextLostTimer&&(clearTimeout(r.contextLostTimer),r.contextLostTimer=null,Object(_common_common__WEBPACK_IMPORTED_MODULE_2__.i)(n,!0)):restoredFromContextLost(r,n)}function resizeCanvasTo1x1(){try{self.sharingRenderContext&&(self.sharingRenderContext.contextGL.canvas.width=1,self.sharingRenderContext.contextGL.canvas.height=1)}catch(e){console.log(e)}}function updateOffscreenCanvasSize(e){try{offscreenCanvasContext.canvas.width===e.width&&offscreenCanvasContext.canvas.height===e.height||(offscreenCanvasContext.canvas.width=e.width,offscreenCanvasContext.canvas.height=e.height)}catch(e){Object(_common_common__WEBPACK_IMPORTED_MODULE_2__.g)("Error when updating OffScreenCanvas size",e)}}function sharingEncodeFrammeProcess(e){return _sharingEncodeFrammeProcess.apply(this,arguments)}function _sharingEncodeFrammeProcess(){return(_sharingEncodeFrammeProcess=_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark((function e(t){var r,n,a,i,o,s,_,u,c,h,d,l,f,p,g,m,E;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(last_time_capture_sharing=performance.now(),pace_sender_interval||(100,multiThreadFlag&&50,pace_sender_interval=setInterval((function(){Pace_Sender()}),40)),threadState!=THREAD_STATE_IDLE&&threadState!=THREAD_STATE_CREATED){e.next=5;break}e.next=9;break;case 5:if(threadState!=THREAD_STATE_CREATING){e.next=9;break}return can_I_capture_desktop=!0,t.data&&(t.isSupportVideoTrackReader||isSupportMediaStreamTrackProcessor)&&("close"in(r=t.data)?r.close():r.destroy()),e.abrupt("return");case 9:if(n={data:null,width:0,height:0},!t||!t.data||!t.isSupportVideoTrackReader&&!isSupportMediaStreamTrackProcessor){e.next=60;break}if(a=t.data,o=0,_=0,c=0,h=0,d=0,l=0,f=0,"I420"!=a.format){e.next=39;break}if(2!=dataFormat&&(dataFormat=2),"copyTo"in a?(h=a.visibleRect.width,d=a.visibleRect.height,l=h,f=d,o=h*d,_=h*d/4,c=h*d/4,data_length=h*d*3/2):(i=a.planes[0],o=i.length,s=a.planes[1],_=s.length,u=a.planes[2],c=u.length,l=i.stride,f=i.rows,data_length=o+_+c),!sharing_handle){e.next=37;break}if(sharing_raw_data_width*sharing_raw_data_height!=l*f&&(postMessage({status:_common_consts__WEBPACK_IMPORTED_MODULE_3__.CURRENT_DESKTOP_SHARING_WIDTH_HEIGHT,width:l,height:f}),sharing_raw_data_width=l,sharing_raw_data_height=f,sharing_memory_ptr&&Module._free(sharing_memory_ptr),sharing_memory_ptr=Module._malloc(data_length)),!("copyTo"in a)){e.next=30;break}return yview=Module.HEAPU8.subarray(sharing_memory_ptr,sharing_memory_ptr+data_length),e.next=28,a.copyTo(yview);case 28:e.next=36;break;case 30:yview=Module.HEAPU8.subarray(sharing_memory_ptr,sharing_memory_ptr+o),uview=Module.HEAPU8.subarray(sharing_memory_ptr+o,sharing_memory_ptr+o+_),vview=Module.HEAPU8.subarray(sharing_memory_ptr+o+_,sharing_memory_ptr+o+_+c),i.readInto(yview),s.readInto(uview),u.readInto(vview);case 36:sharing_encode(sharing_handle,sharing_memory_ptr,data_length,sharing_raw_data_width,sharing_raw_data_height,dataFormat);case 37:e.next=57;break;case 39:if("NV12"!=a.format){e.next=56;break}if(3!=dataFormat&&(dataFormat=3),"copyTo"in a?(h=a.visibleRect.width,d=a.visibleRect.height,l=h,f=d,o=h*d,_=h*d/2,data_length=h*d*3/2):(i=a.planes[0],o=i.length,s=a.planes[1],_=s.length,l=i.stride,f=i.rows,data_length=o+_),sharing_raw_data_width*sharing_raw_data_height!=l*f&&(postMessage({status:_common_consts__WEBPACK_IMPORTED_MODULE_3__.CURRENT_DESKTOP_SHARING_WIDTH_HEIGHT,width:l,height:f}),sharing_raw_data_width=l,sharing_raw_data_height=f,sharing_memory_ptr&&Module._free(sharing_memory_ptr),sharing_memory_ptr=Module._malloc(data_length)),!("copyTo"in a)){e.next=49;break}return yview=Module.HEAPU8.subarray(sharing_memory_ptr,sharing_memory_ptr+data_length),e.next=47,a.copyTo(yview);case 47:e.next=53;break;case 49:yview=Module.HEAPU8.subarray(sharing_memory_ptr,sharing_memory_ptr+o),uview=Module.HEAPU8.subarray(sharing_memory_ptr+o,sharing_memory_ptr+o+_),i.readInto(yview),s.readInto(uview);case 53:sharing_encode(sharing_handle,sharing_memory_ptr,data_length,sharing_raw_data_width,sharing_raw_data_height,dataFormat),e.next=57;break;case 56:a.format&&(console.log("dataformat:",a.format,"is not supported"),isLogPrinted||(isLogPrinted=!0,postMessage({status:_common_consts__WEBPACK_IMPORTED_MODULE_3__.UNSUPPORTED_SHARING_FORMAT,format:a.format})));case 57:"close"in a?a.close():a.destroy(),e.next=61;break;case 60:if(t.isImageFromSharingFrame)canvasForVideoTrackReader||canvasContextForVideoTrackReader||(canvasForVideoTrackReader=new OffscreenCanvas(0,0),canvasContextForVideoTrackReader=canvasForVideoTrackReader.getContext("2d")),t.data&&t.data.width&&t.data.height&&(p=t.data,canvasContextForVideoTrackReader.canvas.width=p.width,canvasContextForVideoTrackReader.canvas.height=p.height,canvasContextForVideoTrackReader.drawImage(p,0,0,p.width,p.height,0,0,p.width,p.height),g=canvasContextForVideoTrackReader.getImageData(0,0,p.width,p.height),n={data:new Uint8Array(g.data),width:p.width,height:p.height},p.close());else if(t.isImage)try{!is32bitbrowser||flipSend?(updateOffscreenCanvasSize(m=t.data),offscreenCanvasContext.drawImage(m,0,0,m.width,m.height,0,0,m.width,m.height),E=offscreenCanvasContext.getImageData(0,0,m.width,m.height),n={data:new Uint8Array(E.data),width:m.width,height:m.height},flipSend=!1,m.close()):(flipSend=!0,n={data:null,width:0,height:0})}catch(e){Object(_common_common__WEBPACK_IMPORTED_MODULE_2__.g)("An error occurred when trying to encode a sharing frame",e),postMessage({status:_common_consts__WEBPACK_IMPORTED_MODULE_3__.SHARING_GET_IMAGE_DATA_WRONG})}else n=t;case 61:n&&n.data&&sharing_handle&&(sharing_raw_data_width*sharing_raw_data_height!=n.width*n.height&&(sharing_raw_data_width=n.width,sharing_raw_data_height=n.height,sharing_memory_ptr&&Module._free(sharing_memory_ptr),sharing_memory_ptr=Module._malloc(4*sharing_raw_data_width*sharing_raw_data_height)),1!=dataFormat&&(dataFormat=1),Module.HEAPU8.subarray(sharing_memory_ptr,sharing_memory_ptr+4*sharing_raw_data_width*sharing_raw_data_height).set(n.data,0,n.data.length),sharing_encode(sharing_handle,sharing_memory_ptr,n.data.length,sharing_raw_data_width,sharing_raw_data_height,dataFormat)),can_I_capture_desktop=!0,n&&n.data&&(last_encode_raw_frame=n);case 64:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Set_Enocding_Key_And_Roster(e,t,r,n,a){var i=getWasmMemory(n);set_sharing_encryption_key_directly(e,i,n.length,a),freeWasmMemory(i),i=getWasmMemory(r),add_roster_info_directly(e,t,i,r.length),freeWasmMemory(i)}function MCMMonitor_Sharing_LOG(e,t){var r=Module.HEAP8.subarray(e+0,e+t);postMessage({status:MONITOR_MESSAGE,data:Utf8ArrayToStr(r)})}function Send_Out_Qos(e,t,r,n,a,i,o){var s=new Uint8Array(r+4),_=Module.HEAPU8.subarray(t+0,t+r);s[0]=n,s[1]=a,o!=sharing_handle&&(s[1]=2|s[1]),s.set(_,4),isDataChannelOpen&&i?postMessage({status:_common_consts__WEBPACK_IMPORTED_MODULE_3__.VIDEO_ENCODED_DATA,data:s},[s.buffer]):1==sharing_media_connect.socket.readyState&&sharing_media_connect.socket.send(s)}function onMessageFromDataChannel(e,t){if(e){var r=t?e:new Uint8Array(e);2&r[1]?_Sharing_SharingMaster__WEBPACK_IMPORTED_MODULE_11__.g(r,sharing_try_analysis,t):MaybeCreateDecodeMultiThreadAndAnalysis(r,sharing_handle,sharing_try_analysis,t)}}function on_dc_or_webtransport_status_changed(){sharing_handle&&change_connect_type(sharing_handle,isDataChannelOpen?0:2)}function collectInfo(){collectLogInterval||(collectLogInterval=setInterval((function(){startMonitorLogFlag&&sharing_handle&&collect_sharing_monitor_info(sharing_handle,!!isSendSharing)}),1e3))}var logAgent=Object(_common_LogAgent__WEBPACK_IMPORTED_MODULE_9__.a)();function BigLog_js(){return!1}function Set_Share_Mode_js(e){console.log(">>> Set_Share_Mode_js")}function readVideoDecodeDataFromRingBuffer(e){e.bCopyData?onMessageFromDataChannel(e.buffer):onMessageFromDataChannel(e.uint8s,e.begin)}function InitRingBuffer(){var e=8+1500*(VIDEO_RINGBUF_PKG_NUM+1);if(null==sharing_decode_ptr){if(null==(sharing_decode_ptr=Module._malloc(e)))return void console.log("malloc failed");Atomics.store(GROWABLE_HEAP_U32().subarray(sharing_decode_ptr/4,sharing_decode_ptr/4+e),0,0),Atomics.store(GROWABLE_HEAP_U32().subarray(sharing_decode_ptr/4,sharing_decode_ptr/4+e),1,0)}self.videoRingBufferWriterDecode=new _common_ZoomSharedArrayBufferUtils__WEBPACK_IMPORTED_MODULE_10__.b(wasmMemory.buffer,void 0,"vddfd",void 0,sharing_decode_ptr,e,wasmMemory),self.videoRingBufferConsumer=new _common_ZoomSharedArrayBufferUtils__WEBPACK_IMPORTED_MODULE_10__.a(self.videoRingBufferWriterDecode,readVideoDecodeDataFromRingBuffer),self.postMessage({status:"SHARING_DECODE_PTR",data:wasmMemory,offset:sharing_decode_ptr,length:e}),self.videoRingBufferConsumer.consume(10,!1)}self.addEventListener("message",(function(e){var t=e.data;switch(t.command){case"startMedia":try{collectInfo();var r,n,a=t.iv;if(a&&(a=new Uint8Array(a)),a?(lastIv=a,n=a.length):n=0,r=getWasmMemory(a),meetingnumb=t.meetingnumb+"",meetingid=t.meetingid,multiThreadNum=t.multiThreadNum,uplimit=t.uplimit?t.uplimit:0,enableReplaceCanvasWhenContextLost=!!t.enableReplaceCanvasWhenContextLost,multiThreadNum>1&&(multiThreadFlag=!0),t.encode){isSendSharing=!0,sharingencid=t.confId,t.isChromeOrEdge&&(isChromeOrEdge=t.isChromeOrEdge),isSharingEncode=!0,postMessage({status:Sharing_Handle_OK});var i=t.websocket_ip_address.slice(0,t.websocket_ip_address.length-42)+"s"+t.websocket_ip_address.slice(t.websocket_ip_address.length-41,t.websocket_ip_address.length)+"&mode=2";sharing_media_connect=Open_Sharing_WebSocket_Connect(i,sharing_websocket_on_open,sharing_websocket_on_message,sharing_websocket_on_error,sharing_websocket_on_close)}else InitSharingDecode(),sharing_handle=sharing_encode_init(t.confId,meetingnumb,meetingid,r,n,uplimit,!1,!1,!0),logAgent&&logAgent.init({workerType:_common_enums_CommonEnums__WEBPACK_IMPORTED_MODULE_7__.b.SHARING_DECODE}),freeWasmMemory(r),sharing_handle?(postMessage({status:Sharing_Handle_OK}),sharing_media_connect=Open_Sharing_WebSocket_Connect(t.websocket_ip_address+"&mode=1",sharing_websocket_on_open,sharing_websocket_on_message,sharing_websocket_on_error,sharing_websocket_on_close)):postMessage({status:Sharing_Handle_FAILED})}catch(e){console.log(e)}break;case"closeMedia":stopDrawImage=!0,sharing_handle&&sharing_encode_uninit(sharing_handle),sharing_handle=null,close();break;case"updateSharingStatus":t.status?imageInterval=setInterval((function(){imagBMap.forEach((function(e,t){postMessage(e,[e.data.image.buffer.buffer]),imagBMap.delete(t)}))}),1e3):(clearInterval(imageInterval),headerMap.clear(),imagBMap.clear());break;case"ENCRYPT":sharing_encode_encrypt=t.encrypt,sharing_handle&&sharing_set_data_encryption(sharing_handle,sharing_encode_encrypt?1:0);break;case _common_consts__WEBPACK_IMPORTED_MODULE_3__.QOS_MONITORING:qosMonitorMGR.panelpollingInterval=t.data.pollingInterval,qosMonitorMGR.sharingmonitorPanelFlag=t.data.enable,sharing_qos_monitor();break;case"startSharingEncode":startMonitorLogFlag=!0,t.isSupportVideoTrackReader?(dataFormat=2,isSupportVideoTrackReader=!0):(dataFormat=1,isSupportVideoTrackReader=!1),isSupportMediaStreamTrackProcessor=!!t.isSupportMediaStreamTrackProcessor,multiThreadFlag&&threadState==THREAD_STATE_IDLE?MaybeCreateEncodeMultiThread(t):SharingEncodeInit(t),sharing_pause=!1;break;case"newSharingPara":if(t.data){var o=t.data;o.width=t.width,o.height=t.height,offscreenCanvasContext=o.getContext("2d"),offscreenCanvasId=t.rendercanvasID}flipSend=t.flipSend,is32bitbrowser=t.is32bitbrowser;break;case"frameStream":t.data&&(frameStream=t.data,frameReader=frameStream.getReader());break;case"encodeSharingFrame":t&&sharingEncodeFrammeProcess(t);break;case"pause":sharing_handle&&sharing_pause_encode(sharing_handle),can_I_capture_desktop=!1,flipSend=!0,lastTimestamp=0,sharing_pause=!0;break;case"stopsharing":sharingGetIvInteval&&(clearInterval(sharingGetIvInteval),sharingGetIvInteval=null),sharing_handle&&(buffer_amount_queue=new Queue),pace_sender_interval&&(clearInterval(pace_sender_interval),pace_sender_interval=0),can_I_capture_desktop=!1,total_app_buffer_unsend_encoded_byte=0,flipSend=!0,lastTimestamp=0,data_length=0,last_time_capture_sharing=0,isCloseThreads=!0,sharing_pause=!1,startMonitorLogFlag=!1,threadState!=THREAD_STATE_IDLE&&setTimeout((function(){isCloseThreads&&(PThread.terminateAllThreads(),isCreateWorkers=!1,threadState=THREAD_STATE_IDLE,loadedThreadCount=0,console.log("terminate multiple threads"))}),6e5);break;case"resume":sharing_handle&&sharing_resume_encode(sharing_handle),sharingEncodeFrammeProcess({data:null}),flipSend=!0,lastTimestamp=0,sharing_pause=!1;break;case"SOCKET_RECONNECT":self.IS_DISABLE_SOCKET_RECONNECT=!0===t.disable;break;case"SharingPlayStatus":isSharingPlayWork=t.isSharingPlayWork;break;case"sharingRenderCanvas":t.canvas&&(sharingRenderContext&&(sharingRenderContext.cleanup(),sharingRenderContext=null),sharingRenderContext=new _common_WebGLCanvas__WEBPACK_IMPORTED_MODULE_5__.a(t.canvas,0,void 0,{webglcontextlostCallback:webglcontextlostCallback,webglcontextrestoredCallback:webglcontextrestoredCallback,params:{canvas:t.canvas,rendercanvasID:t.rendercanvasID}}),self.sharingRenderContext=sharingRenderContext),isSharingPlayWork=!0,isSupportOffscreenCanvas=!0,isCreateSharingWaterMark=t.isCreateSharingWaterMark,sharingWaterMarkName=t.sharingWaterMarkName,currentshareactive=t.ssrc,waterMarkCanvasInWorker||(waterMarkCanvasInWorker=new OffscreenCanvas(0,0)),SharingRenderObj||(SharingRenderObj=new _inside_JsMediaSDK_SharingRender__WEBPACK_IMPORTED_MODULE_6__.a(Object.assign({},{Notify_APPUI:null,PubSub:null,jsMediaEngine:null})),self.SharingRenderObj=SharingRenderObj),sharingRenderContext&&SharingRenderObj.Set_Render_WebGL(sharingRenderContext),SharingRenderObj.Change_Current_SSRC(currentshareactive,t.isFromMainSession),SharingRenderObj.Set_WaterMark_Info({waterMarkCanvas:waterMarkCanvasInWorker,isCreateSharingWaterMark:isCreateSharingWaterMark,sharingWaterMarkName:sharingWaterMarkName,watermarkOpacity:t.watermarkOpacity,watermarkRepeated:t.watermarkRepeated,watermarkPosition:t.watermarkPosition}),sharingRenderInterval&&clearInterval(sharingRenderInterval);var s=SharingRenderObj.No_Bindthis_Interval.bind(SharingRenderObj);sharingRenderInterval=setInterval(s,50),self.sharingRenderInterval=sharingRenderInterval;break;case"stopSharingRender":startMonitorLogFlag=!1,SharingRenderObj&&SharingRenderObj.SetcATimeStamp(0),sharing_qos_nack_interval&&(clearInterval(sharing_qos_nack_interval),sharing_qos_nack_interval=0),resizeCanvasTo1x1(),sharingRenderInterval&&(clearInterval(sharingRenderInterval),sharingRenderInterval=null),isSharingPlayWork=!1,isCreateSharingWaterMark=!1,sharingWaterMarkName="",canIReceiveFirstSharingFrameMap=new Map,sharingRenderContext&&sharingRenderContext.clear(),SharingRenderObj&&(SharingRenderObj.SetcATimeStamp(0),SharingRenderObj.ClearQueue(),SharingRenderObj.Set_WaterMark_Info({waterMarkCanvas:waterMarkCanvasInWorker,isCreateSharingWaterMark:isCreateSharingWaterMark,sharingWaterMarkName:sharingWaterMarkName}));break;case"CHANGE_CURRENT_SHARING_ACTIVE_SSRC":currentshareactive=t.ssrc,SharingRenderObj||(SharingRenderObj=new _inside_JsMediaSDK_SharingRender__WEBPACK_IMPORTED_MODULE_6__.a(Object.assign({},{Notify_APPUI:null,PubSub:null,jsMediaEngine:null}))),SharingRenderObj.Change_Current_SSRC(currentshareactive,t.isFromMainSession);break;case _common_enums_CommonEnums__WEBPACK_IMPORTED_MODULE_7__.a.SET_USER_NODE_LIST:var _=t.data.userNodeList;_&&_.forEach((function(e){var t=parseInt(e.userid);if(e.bremove)sharing_handle&&sharing_remove_cooker_info(sharing_handle,t);else{var r=e.sn;if(16==r.length||32==r.length){var n=getWasmMemory(r);if(sharing_handle){var a=!1;isSendSharing&&sharingencid!=t||(a=!0),a&&sharing_add_cooker_info(sharing_handle,t,n,r.length)}freeWasmMemory(n),isSendSharing&&sharingencid==t&&(sharingenczoomid=r)}}}));break;case"SET_OFFSCREENCANVAS_WIDTH_HEIGHT":var u=t.data,c=u.width,h=u.height;SharingRenderObj&&(SharingRenderObj.setOnlyAcceptUISize(!0),SharingRenderObj.updateOffscreenCanvasSize(c,h,!0));break;case"BUILD_MS_CHANNEL_IN_BO":_Sharing_SharingMaster__WEBPACK_IMPORTED_MODULE_11__.c(Open_Sharing_WebSocket_Connect,t.data,MaybeCreateDecodeMultiThreadAndAnalysis,sharing_try_analysis);break;case"SHARING_REMOVE_REV_CHANNEL_TYPE":var d=t.data;d.isFromMainSession?_Sharing_SharingMaster__WEBPACK_IMPORTED_MODULE_11__.f(remove_rec_channel,d):sharing_handle&&remove_rec_channel(sharing_handle,d.ssrc);break;case"SHARING_ADD_REV_CHANNEL_TYPE":var l=t.data;l.isFromMainSession?_Sharing_SharingMaster__WEBPACK_IMPORTED_MODULE_11__.a(add_rev_channel,l):sharing_handle&&add_rev_channel(sharing_handle,l.ssrc,l.streamIndex,l.videoMode);break;case"UPDATE_MEDIA_PARAMS":var f=t.data;if(f.isFromMainSession)_Sharing_SharingMaster__WEBPACK_IMPORTED_MODULE_11__.d(sharing_encode_init,set_sharing_encryption_key_directly,f.updateParams,getWasmMemory,freeWasmMemory);else if(isSharingEncode)keyAndrosterInfo=f,sharing_handle&&Set_Enocding_Key_And_Roster(sharing_handle,keyAndrosterInfo.updateParams.userId,keyAndrosterInfo.updateParams.sn,keyAndrosterInfo.updateParams.encryptKey,keyAndrosterInfo.updateParams.encryptType);else if(sharing_handle){var p=getWasmMemory(f.updateParams.encryptKey);set_sharing_encryption_key_directly(sharing_handle,p,f.updateParams.encryptKey.length,f.updateParams.encryptType),freeWasmMemory(p)}break;case"USER_NODE_LIST_IN_MAIN_SESSION":var g=t.data;if(g.isFromMainSession)_Sharing_SharingMaster__WEBPACK_IMPORTED_MODULE_11__.b(add_roster_info_directly,g);else if(sharing_handle&&g.body){if(g.body.add)for(var m=0,E=g.body.add;m<E.length;m++){var v=getWasmMemory(E[m].sn);add_roster_info_directly(sharing_handle,E[m].userid,v,E[m].sn.length),freeWasmMemory(v)}g.body.remove}break;case"SWITCH_WATER_MARK_FLAG":SharingRenderObj&&(isCreateSharingWaterMark=t.isCreateSharingWaterMark,sharingWaterMarkName=t.sharingWaterMarkName||"",isCreateSharingWaterMark?waterMarkCanvasInWorker||(waterMarkCanvasInWorker=new OffscreenCanvas(0,0)):SharingRenderObj.Set_WaterMark_Flag(!1),SharingRenderObj.Set_WaterMark_Info({waterMarkCanvas:waterMarkCanvasInWorker,isCreateSharingWaterMark:isCreateSharingWaterMark,sharingWaterMarkName:sharingWaterMarkName,watermarkOpacity:t.watermarkOpacity,watermarkRepeated:t.watermarkRepeated,watermarkPosition:t.watermarkPosition}));break;case"UPDATE_SHARING_CANVAS_SIZE":SharingRenderObj&&SharingRenderObj.Update_Sharing_Canvas_Size({width:t.width,height:t.height});break;case"startVideoEncode":uplimit/=2,sharing_handle&&update_sharing_uplink_bandwidth_limitation_by_server(sharing_handle,uplimit);break;case"stopVideoEncode":uplimit*=2,sharing_handle&&update_sharing_uplink_bandwidth_limitation_by_server(sharing_handle,uplimit);break;case"WEBGL_LOST_REPLACE_CANVAS":var T=t.data||{},y=T.canvas,S=T.canvasId;if(y){S&&S===offscreenCanvasId?offscreenCanvasContext=y.getContext("2d"):isSendSharing||(restoredFromContextLost(y,S),SharingRenderObj&&waterMarkCanvasInWorker&&(waterMarkCanvasInWorker=new OffscreenCanvas(0,0),SharingRenderObj.Replace_WaterMark_Canvas(waterMarkCanvasInWorker)));break}isSendSharing&&(canvasForVideoTrackReader&&(canvasForVideoTrackReader=new OffscreenCanvas(0,0),canvasContextForVideoTrackReader=canvasForVideoTrackReader.getContext("2d")),offscreenCanvasContext&&offscreenCanvasId&&Object(_common_common__WEBPACK_IMPORTED_MODULE_2__.i)(offscreenCanvasId,!0));break;case"startSharingRender":startMonitorLogFlag=!0,sharing_qos_nack_interval||(sharing_qos_nack_interval=setInterval((function(){request_nack_t_periodically_for_qos(sharing_handle)}),50)),ringBufferFlag||(ringBufferFlag=!0,"function"==typeof SharedArrayBuffer&&wasmMemory.buffer instanceof SharedArrayBuffer&&InitRingBuffer());break;case"PUSH_MESSAGE_FROM_MAIN_TO_WORKER":onMessageFromDataChannel(t.data);break;case"UPDATE_DATACHANNEL_STATUS":isDataChannelOpen=t.data.isDataChannelOpen,on_dc_or_webtransport_status_changed();break;case"WHITEBOARD_JOIN_MESSAGE":if(sharing_handle||Set_Enocding_Key_And_Roster(sharing_handle=sharing_encode_init(t.nodeId,"1","1",0,0,0,!1,!0,!1),t.nodeId,t.sn,t.encryptKey,2),!dcsIDMap.get(t.dcsId)){dcsIDMap.set(t.dcsId,!0);var b=getWasmMemory(t.EncodedSn);add_roster_info_directly(sharing_handle,t.dcsId,b,t.EncodedSn.length),freeWasmMemory(b),sharing_set_data_encryption(sharing_handle,1)}if(sharing_handle){set_annotation_action(sharing_handle,0,t.dcsId,0);var R=getWasmMemory(t.data);set_annotation_action(sharing_handle,1,R,t.data.length),freeWasmMemory(R)}break;case"vsport":vsport&&(vsport.close(),vsport=null),(vsport=e.ports[0]).onmessage=function(e){SharingRenderObj&&SharingRenderObj.SetcATimeStamp(e.data)}}}))},,,,,,,,,,,,,function(e,t,r){"use strict";r.r(t);var n=r(39);self.databaseDataType="videosimd",Object.keys(n).forEach((function(e){return self[e]=n[e]}))}]);
2
+ //# sourceMappingURL=https://d1cdksi819e9z7.cloudfront.net/sourcemap/sharing_simd.min.js-b62ec8368cb3f6411f31.map
3
+ self.__wasmCodeDataEndFlag = 1;
4
+ var Module=typeof Module!=="undefined"?Module:{};
5
+ Module["onRuntimeInitialized"] = function(){
6
+
7
+ self.onWasmModuleReady();
8
+
9
+ }
10
+ var Module=typeof Module!="undefined"?Module:{};var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof importScripts=="function";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(scriptDirectory.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=title=>document.title=title}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var POINTER_SIZE=4;var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var noExitRuntime=Module["noExitRuntime"]||true;if(typeof WebAssembly!="object"){abort("no native wasm support detected")}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(text)}}var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):undefined;function UTF8ArrayToString(heapOrArray,idx,maxBytesToRead){var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i<str.length;++i){var u=str.charCodeAt(i);if(u>=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i<str.length;++i){var c=str.charCodeAt(i);if(c<=127){len++}else if(c<=2047){len+=2}else if(c>=55296&&c<=57343){len+=4;++i}else{len+=3}}return len}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module["HEAP8"]=HEAP8=new Int8Array(buf);Module["HEAP16"]=HEAP16=new Int16Array(buf);Module["HEAP32"]=HEAP32=new Int32Array(buf);Module["HEAPU8"]=HEAPU8=new Uint8Array(buf);Module["HEAPU16"]=HEAPU16=new Uint16Array(buf);Module["HEAPU32"]=HEAPU32=new Uint32Array(buf);Module["HEAPF32"]=HEAPF32=new Float32Array(buf);Module["HEAPF64"]=HEAPF64=new Float64Array(buf)}var INITIAL_MEMORY=Module["INITIAL_MEMORY"]||16777216;var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;if(!Module["noFSInit"]&&!FS.init.initialized)FS.init();FS.ignorePermissions=false;TTY.init();SOCKFS.root=FS.mount(SOCKFS,{},null);PIPEFS.root=FS.mount(PIPEFS,{},null);callRuntimeCallbacks(__ATINIT__)}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function getUniqueRunDependency(id){return id}function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);throw e}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith("file://")}var wasmBinaryFile;wasmBinaryFile="video.simd.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={"env":asmLibraryArg,"wasi_snapshot_preview1":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;wasmMemory=Module["asm"]["memory"];updateGlobalBufferAndViews(wasmMemory.buffer);wasmTable=Module["asm"]["__indirect_function_table"];addOnInit(Module["asm"]["__wasm_call_ctors"]);removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}function instantiateArrayBuffer(receiver){return instantiateCachedURL(821,wasmUrl,info);return {};getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&typeof fetch=="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);return false}}instantiateAsync();return{}}var tempDouble;var tempI64;var ASM_CONSTS={349340:($0,$1,$2)=>{js_info_from_wcl($0,$1,$2)},349374:$0=>{change_capture_resolution($0)},349409:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)=>{processed_capture_data_callback($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)},349486:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)=>{frame_callback($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)},349556:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)=>{frame_callback_webcodec($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)},349635:($0,$1)=>{decode_callback($0,$1)},349664:($0,$1,$2)=>{js_info_from_wcl($0,$1,$2)},349698:($0,$1,$2,$3)=>{Video_Controller_Encode_Data2($0,$1,$2,$3)},349746:($0,$1)=>{SAVE_IV($0,$1)},349764:($0,$1,$2,$3)=>{Video_Controller_Encode_Data($0,$1,$2,$3)},349811:($0,$1,$2,$3,$4,$5)=>{js_info_from_wcl_video_data($0,$1,$2,$3,$4,$5)},349868:$0=>{Exit_Thread($0)},349886:$0=>{Before_Create_Thread($0)},349916:($0,$1)=>{APP_Troubleshoting_Info($0,$1)},349950:($0,$1,$2)=>{network_quality_callback($0,$1,$2)},349990:($0,$1)=>{MCMMonitor_Video_LOG($0,$1)},350020:()=>{return Date.now()/1e3},350047:()=>{return Date.now()%1e3},350074:($0,$1)=>{send_data($0,$1)},350097:($0,$1,$2,$3,$4,$5,$6,$7)=>{responseVideoQosData($0,$1,$2,$3,$4,$5,$6,$7)},350152:($0,$1,$2,$3)=>{Monitor_Callback($0,$1,$2,$3)},350190:($0,$1,$2,$3)=>{Monitor_CallbackE($0,$1,$2,$3)},350229:($0,$1,$2,$3)=>{Monitor_CallbackD($0,$1,$2,$3)},350268:($0,$1)=>{SAVE_IV($0,$1)},350286:()=>{return Date.now()},350309:($0,$1)=>{Update_Required_Bandwidth($0,$1)},350345:$0=>{Update_Video_Hd_Info($0)},350375:($0,$1,$2,$3)=>{Send_Multi_Data($0,$1,$2,$3)},350409:($0,$1,$2)=>{SAVE_IV($0,$1,$2)},350431:($0,$1,$2)=>{Send_Data($0,$1,$2)},350455:($0,$1,$2,$3)=>{Send_Data($0,$1,$2,$3)},350483:($0,$1,$2)=>{Send_Data($0,$1,$2)},350507:($0,$1,$2)=>{APP_Troubleshoting_Info($0,$1,$2)},350545:($0,$1,$2,$3)=>{decode_callback($0,$1,$2,$3)},350582:($0,$1,$2,$3)=>{Send_Data($0,$1,$2,$3)},350613:($0,$1,$2)=>{Send_Data($0,$1,$2)},350640:($0,$1,$2,$3)=>{Send_Data($0,$1,$2,$3)},350670:($0,$1,$2)=>{Send_Data($0,$1,$2)},350697:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13)=>{frame_callback_video_mode($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13)},350788:($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)=>{frame_callback_mouse_video_mode($0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)},350875:($0,$1)=>{MCMMonitor_Sharing_LOG($0,$1)},350907:($0,$1,$2,$3,$4,$5,$6)=>{Send_Out_Qos($0,$1,$2,$3,$4,$5,$6)},350952:($0,$1)=>{Send_Data($0,$1)},350975:$0=>{Update_WebSokcet_Speed($0)},351007:($0,$1,$2,$3,$4,$5,$6,$7)=>{responseSharingQosData($0,$1,$2,$3,$4,$5,$6,$7)},351064:($0,$1,$2,$3,$4)=>{Sharing_Encode_Sending_Status($0,$1,$2,$3,$4)},351116:($0,$1,$2,$3)=>{Sharing_Encode_Codec_Info($0,$1,$2,$3)},351160:($0,$1)=>{SAVE_IV($0,$1)},351178:($0,$1,$2,$3)=>{Sharing_Decode_Channel_Change($0,$1,$2,$3)},351225:($0,$1)=>{Update_Required_Bandwidth($0,$1)},351261:($0,$1,$2)=>{Send_Wb_Rtp_Packet($0,$1,$2)},351292:($0,$1)=>{Recieve_Wb_Packet($0,$1)},351319:()=>{videoencode_create_helpthread()},351354:()=>{videocodec_create_helpthread()},351388:($0,$1)=>{console.error($0,$1)},351412:($0,$1)=>{LOG_OUT($0,$1)},351433:($0,$1)=>{wcl_trace_log($0,$1)}};function callRuntimeCallbacks(callbacks){while(callbacks.length>0){callbacks.shift()(Module)}}function withStackSave(f){var stack=stackSave();var ret=f();stackRestore(stack);return ret}function demangle(func){demangle.recursionGuard=(demangle.recursionGuard|0)+1;if(demangle.recursionGuard>1)return func;return withStackSave(function(){try{var s=func;if(s.startsWith("__Z"))s=s.substr(1);var len=lengthBytesUTF8(s)+1;var buf=stackAlloc(len);stringToUTF8(s,buf,len);var status=stackAlloc(4);var ret=___cxa_demangle(buf,0,0,status);if(HEAP32[status>>2]===0&&ret){return UTF8ToString(ret)}}catch(e){}finally{_free(ret);if(demangle.recursionGuard<2)--demangle.recursionGuard}return func})}function jsStackTrace(){var error=new Error;if(!error.stack){try{throw new Error}catch(e){error=e}if(!error.stack){return"(no stack trace available)"}}return error.stack.toString()}function demangleAll(text){var regex=/\b_Z[\w\d_]+/g;return text.replace(regex,function(x){var y=demangle(x);return x===y?x:y+" ["+x+"]"})}function _AdapterWhiteListCheck(){if(UserAgentIsTesla_js()){return 0}if(!IsSupportMultiThreadForWebcodec()){return-1}if(typeof OffscreenCanvas!="function"){return-1}var canvas=new OffscreenCanvas(1,1);var gl=canvas.getContext("webgl");if(!gl){return-1}var debugInfo=gl.getExtension("WEBGL_debug_renderer_info");var vendor=gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL);var renderer=gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);var renderer_info=renderer.toLowerCase();var bIsARM=vendor.includes("ARM");var bIsAMD=renderer_info.includes("amd");var bIsIntel=renderer_info.includes("intel");var bIsHdGpu=renderer_info.includes("hd graphics");var bIsUhdGpu=renderer_info.includes("uhd graphics");var bIsNvidia=renderer_info.includes("nvidia");var bIsGeForce=renderer_info.includes("geforce");var IntelGen=0;if(bIsIntel&&bIsHdGpu){const indexOfFirst=renderer_info.indexOf("hd graphics ");var newString=renderer_info.slice(indexOfFirst+12);IntelGen=parseInt(newString)}var GeForceGen=0;if(bIsNvidia&&bIsGeForce){const indexOfFirst=renderer_info.indexOf("geforce gt ");var newString=renderer_info.slice(indexOfFirst+11);GeForceGen=parseInt(newString)}if(bIsARM){return-1}if(bIsAMD){return 0}if(bIsNvidia&&bIsGeForce&&GeForceGen<600){return-1}if(bIsIntel&&bIsHdGpu&&(IntelGen==0||IntelGen>1e3&&IntelGen<4e3)){return-1}return 0}function _CloseVideoEncoder(id){CloseVideoEncoder_js(id)}function _CreateGltPlatform(){err("missing function: CreateGltPlatform");abort(-1)}function _DestroyGltPlatform(){err("missing function: DestroyGltPlatform");abort(-1)}function _GetEncoderState(id){return GetEncoderState_js(id)}function _GetLogLevel(){return GetLogLevel_js()}function _InitVideoDecoder(id,context){return InitVideoDecoder_js(id,context)}function _InitVideoEncoder(id,context){return InitVideoEncoder_js(id,context)}function _LimitWebCodecsEncoderTo360(){return LimitWebCodecsEncoderTo360_js()}function _Set_Share_Mode(flag){return Set_Share_Mode_js(flag)}function _UserAgentIsTesla(){return UserAgentIsTesla_js()}function _VideoDecoder(id,VclNalBuffer,vclBufferSize,NewIDR,vclNalCount){return VideoDecoder_js(id,VclNalBuffer,vclBufferSize,NewIDR,vclNalCount)}function _VideoDecoderConfigure(id,extradata,extraDataLen,Width,Height){return VideoDecoderConfigure_js(id,extradata,extraDataLen,Width,Height)}function _VideoEncoderConfigure(id,Bitrate,Framerate,Width,Height,bsBuffer){return VideoEncoderConfigure_js(id,Bitrate,Framerate,Width,Height,bsBuffer)}function _WebCodecsVideoEncoder(id,videoFrameId,NewIDR,rawData,dataLength){return VideoEncoder_js(id,videoFrameId,NewIDR,rawData,dataLength)}function __ZN11cpt_generic6thread4joinEv(){err("missing function: _ZN11cpt_generic6thread4joinEv");abort(-1)}function __ZN11cpt_generic6threadD1Ev(){err("missing function: _ZN11cpt_generic6threadD1Ev");abort(-1)}function __ZN5Nydus16CWCLWallRenderer14CreateInstanceEPvRKNS_9NydusRectEPPNS_13IWallRendererE(){err("missing function: _ZN5Nydus16CWCLWallRenderer14CreateInstanceEPvRKNS_9NydusRectEPPNS_13IWallRendererE");abort(-1)}function ___assert_fail(condition,filename,line,func){abort("Assertion failed: "+UTF8ToString(condition)+", at: "+[filename?UTF8ToString(filename):"unknown filename",line,func?UTF8ToString(func):"unknown function"])}function ___cxa_allocate_exception(size){return _malloc(size+24)+24}function ExceptionInfo(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24;this.set_type=function(type){HEAPU32[this.ptr+4>>2]=type};this.get_type=function(){return HEAPU32[this.ptr+4>>2]};this.set_destructor=function(destructor){HEAPU32[this.ptr+8>>2]=destructor};this.get_destructor=function(){return HEAPU32[this.ptr+8>>2]};this.set_refcount=function(refcount){HEAP32[this.ptr>>2]=refcount};this.set_caught=function(caught){caught=caught?1:0;HEAP8[this.ptr+12>>0]=caught};this.get_caught=function(){return HEAP8[this.ptr+12>>0]!=0};this.set_rethrown=function(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13>>0]=rethrown};this.get_rethrown=function(){return HEAP8[this.ptr+13>>0]!=0};this.init=function(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor);this.set_refcount(0);this.set_caught(false);this.set_rethrown(false)};this.add_ref=function(){var value=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=value+1};this.release_ref=function(){var prev=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=prev-1;return prev===1};this.set_adjusted_ptr=function(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr};this.get_adjusted_ptr=function(){return HEAPU32[this.ptr+16>>2]};this.get_exception_ptr=function(){var isPointer=___cxa_is_pointer_type(this.get_type());if(isPointer){return HEAPU32[this.excPtr>>2]}var adjusted=this.get_adjusted_ptr();if(adjusted!==0)return adjusted;return this.excPtr}}var exceptionLast=0;var uncaughtExceptionCount=0;function ___cxa_throw(ptr,type,destructor){var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;uncaughtExceptionCount++;throw ptr}var PATH={isAbs:path=>path.charAt(0)==="/",splitPath:filename=>{var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1)},normalizeArray:(parts,allowAboveRoot)=>{var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up;up--){parts.unshift("..")}}return parts},normalize:path=>{var isAbsolute=PATH.isAbs(path),trailingSlash=path.substr(-1)==="/";path=PATH.normalizeArray(path.split("/").filter(p=>!!p),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path},dirname:path=>{var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir},basename:path=>{if(path==="/")return"/";path=PATH.normalize(path);path=path.replace(/\/$/,"");var lastSlash=path.lastIndexOf("/");if(lastSlash===-1)return path;return path.substr(lastSlash+1)},join:function(){var paths=Array.prototype.slice.call(arguments);return PATH.normalize(paths.join("/"))},join2:(l,r)=>{return PATH.normalize(l+"/"+r)}};function getRandomDevice(){if(typeof crypto=="object"&&typeof crypto["getRandomValues"]=="function"){var randomBuffer=new Uint8Array(1);return()=>{crypto.getRandomValues(randomBuffer);return randomBuffer[0]}}else return()=>abort("randomDevice")}var PATH_FS={resolve:function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:FS.cwd();if(typeof path!="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){return""}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=PATH.isAbs(path)}resolvedPath=PATH.normalizeArray(resolvedPath.split("/").filter(p=>!!p),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."},relative:(from,to)=>{from=PATH_FS.resolve(from).substr(1);to=PATH_FS.resolve(to).substr(1);function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=="")break}var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i<length;i++){if(fromParts[i]!==toParts[i]){samePartsLength=i;break}}var outputParts=[];for(var i=samePartsLength;i<fromParts.length;i++){outputParts.push("..")}outputParts=outputParts.concat(toParts.slice(samePartsLength));return outputParts.join("/")}};function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}var TTY={ttys:[],init:function(){},shutdown:function(){},register:function(dev,ops){TTY.ttys[dev]={input:[],output:[],ops:ops};FS.registerDevice(dev,TTY.stream_ops)},stream_ops:{open:function(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43)}stream.tty=tty;stream.seekable=false},close:function(stream){stream.tty.ops.fsync(stream.tty)},fsync:function(stream){stream.tty.ops.fsync(stream.tty)},read:function(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.get_char){throw new FS.ErrnoError(60)}var bytesRead=0;for(var i=0;i<length;i++){var result;try{result=stream.tty.ops.get_char(stream.tty)}catch(e){throw new FS.ErrnoError(29)}if(result===undefined&&bytesRead===0){throw new FS.ErrnoError(6)}if(result===null||result===undefined)break;bytesRead++;buffer[offset+i]=result}if(bytesRead){stream.node.timestamp=Date.now()}return bytesRead},write:function(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.put_char){throw new FS.ErrnoError(60)}try{for(var i=0;i<length;i++){stream.tty.ops.put_char(stream.tty,buffer[offset+i])}}catch(e){throw new FS.ErrnoError(29)}if(length){stream.node.timestamp=Date.now()}return i}},default_tty_ops:{get_char:function(tty){if(!tty.input.length){var result=null;if(typeof window!="undefined"&&typeof window.prompt=="function"){result=window.prompt("Input: ");if(result!==null){result+="\n"}}else if(typeof readline=="function"){result=readline();if(result!==null){result+="\n"}}if(!result){return null}tty.input=intArrayFromString(result,true)}return tty.input.shift()},put_char:function(tty,val){if(val===null||val===10){out(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync:function(tty){if(tty.output&&tty.output.length>0){out(UTF8ArrayToString(tty.output,0));tty.output=[]}}},default_tty1_ops:{put_char:function(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync:function(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output,0));tty.output=[]}}}};function mmapAlloc(size){abort()}var MEMFS={ops_table:null,mount:function(mount){return MEMFS.createNode(null,"/",16384|511,0)},createNode:function(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}if(!MEMFS.ops_table){MEMFS.ops_table={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,allocate:MEMFS.stream_ops.allocate,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}}}var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={}}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=null}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream}node.timestamp=Date.now();if(parent){parent.contents[name]=node;parent.timestamp=node.timestamp}return node},getFileDataAsTypedArray:function(node){if(!node.contents)return new Uint8Array(0);if(node.contents.subarray)return node.contents.subarray(0,node.usedBytes);return new Uint8Array(node.contents)},expandFileStorage:function(node,newCapacity){var prevCapacity=node.contents?node.contents.length:0;if(prevCapacity>=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity<CAPACITY_DOUBLING_MAX?2:1.125)>>>0);if(prevCapacity!=0)newCapacity=Math.max(newCapacity,256);var oldContents=node.contents;node.contents=new Uint8Array(newCapacity);if(node.usedBytes>0)node.contents.set(oldContents.subarray(0,node.usedBytes),0)},resizeFileStorage:function(node,newSize){if(node.usedBytes==newSize)return;if(newSize==0){node.contents=null;node.usedBytes=0}else{var oldContents=node.contents;node.contents=new Uint8Array(newSize);if(oldContents){node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)))}node.usedBytes=newSize}},node_ops:{getattr:function(node){var attr={};attr.dev=FS.isChrdev(node.mode)?node.id:1;attr.ino=node.id;attr.mode=node.mode;attr.nlink=1;attr.uid=0;attr.gid=0;attr.rdev=node.rdev;if(FS.isDir(node.mode)){attr.size=4096}else if(FS.isFile(node.mode)){attr.size=node.usedBytes}else if(FS.isLink(node.mode)){attr.size=node.link.length}else{attr.size=0}attr.atime=new Date(node.timestamp);attr.mtime=new Date(node.timestamp);attr.ctime=new Date(node.timestamp);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr:function(node,attr){if(attr.mode!==undefined){node.mode=attr.mode}if(attr.timestamp!==undefined){node.timestamp=attr.timestamp}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup:function(parent,name){throw FS.genericErrors[44]},mknod:function(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename:function(old_node,new_dir,new_name){if(FS.isDir(old_node.mode)){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}}delete old_node.parent.contents[old_node.name];old_node.parent.timestamp=Date.now();old_node.name=new_name;new_dir.contents[new_name]=old_node;new_dir.timestamp=old_node.parent.timestamp;old_node.parent=new_dir},unlink:function(parent,name){delete parent.contents[name];parent.timestamp=Date.now()},rmdir:function(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.timestamp=Date.now()},readdir:function(node){var entries=[".",".."];for(var key in node.contents){if(!node.contents.hasOwnProperty(key)){continue}entries.push(key)}return entries},symlink:function(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink:function(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read:function(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i<size;i++)buffer[offset+i]=contents[position+i]}return size},write:function(stream,buffer,offset,length,position,canOwn){if(buffer.buffer===HEAP8.buffer){canOwn=false}if(!length)return 0;var node=stream.node;node.timestamp=Date.now();if(buffer.subarray&&(!node.contents||node.contents.subarray)){if(canOwn){node.contents=buffer.subarray(offset,offset+length);node.usedBytes=length;return length}else if(node.usedBytes===0&&position===0){node.contents=buffer.slice(offset,offset+length);node.usedBytes=length;return length}else if(position+length<=node.usedBytes){node.contents.set(buffer.subarray(offset,offset+length),position);return length}}MEMFS.expandFileStorage(node,position+length);if(node.contents.subarray&&buffer.subarray){node.contents.set(buffer.subarray(offset,offset+length),position)}else{for(var i=0;i<length;i++){node.contents[position+i]=buffer[offset+i]}}node.usedBytes=Math.max(node.usedBytes,position+length);return length},llseek:function(stream,offset,whence){var position=offset;if(whence===1){position+=stream.position}else if(whence===2){if(FS.isFile(stream.node.mode)){position+=stream.node.usedBytes}}if(position<0){throw new FS.ErrnoError(28)}return position},allocate:function(stream,offset,length){MEMFS.expandFileStorage(stream.node,offset+length);stream.node.usedBytes=Math.max(stream.node.usedBytes,offset+length)},mmap:function(stream,length,position,prot,flags){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43)}var ptr;var allocated;var contents=stream.node.contents;if(!(flags&2)&&contents.buffer===buffer){allocated=false;ptr=contents.byteOffset}else{if(position>0||position+length<contents.length){if(contents.subarray){contents=contents.subarray(position,position+length)}else{contents=Array.prototype.slice.call(contents,position,position+length)}}allocated=true;ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48)}HEAP8.set(contents,ptr)}return{ptr:ptr,allocated:allocated}},msync:function(stream,buffer,offset,length,mmapFlags){MEMFS.stream_ops.write(stream,buffer,0,length,offset,false);return 0}}};function asyncLoad(url,onload,onerror,noRunDep){var dep=!noRunDep?getUniqueRunDependency("al "+url):"";readAsync(url,arrayBuffer=>{assert(arrayBuffer,'Loading data file "'+url+'" failed (no arrayBuffer).');onload(new Uint8Array(arrayBuffer));if(dep)removeRunDependency(dep)},event=>{if(onerror){onerror()}else{throw'Loading data file "'+url+'" failed.'}});if(dep)addRunDependency(dep)}var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:(path,opts={})=>{path=PATH_FS.resolve(path);if(!path)return{path:"",node:null};var defaults={follow_mount:true,recurse_count:0};opts=Object.assign(defaults,opts);if(opts.recurse_count>8){throw new FS.ErrnoError(32)}var parts=path.split("/").filter(p=>!!p);var current=FS.root;var current_path="/";for(var i=0;i<parts.length;i++){var islast=i===parts.length-1;if(islast&&opts.parent){break}current=FS.lookupNode(current,parts[i]);current_path=PATH.join2(current_path,parts[i]);if(FS.isMountpoint(current)){if(!islast||islast&&opts.follow_mount){current=current.mounted.root}}if(!islast||opts.follow){var count=0;while(FS.isLink(current.mode)){var link=FS.readlink(current_path);current_path=PATH_FS.resolve(PATH.dirname(current_path),link);var lookup=FS.lookupPath(current_path,{recurse_count:opts.recurse_count+1});current=lookup.node;if(count++>40){throw new FS.ErrnoError(32)}}}}return{path:current_path,node:current}},getPath:node=>{var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?mount+"/"+path:mount+path}path=path?node.name+"/"+path:node.name;node=node.parent}},hashName:(parentid,name)=>{var hash=0;for(var i=0;i<name.length;i++){hash=(hash<<5)-hash+name.charCodeAt(i)|0}return(parentid+hash>>>0)%FS.nameTable.length},hashAddNode:node=>{var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node},hashRemoveNode:node=>{var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break}current=current.name_next}}},lookupNode:(parent,name)=>{var errCode=FS.mayLookup(parent);if(errCode){throw new FS.ErrnoError(errCode,parent)}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node}}return FS.lookup(parent,name)},createNode:(parent,name,mode,rdev)=>{var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node},destroyNode:node=>{FS.hashRemoveNode(node)},isRoot:node=>{return node===node.parent},isMountpoint:node=>{return!!node.mounted},isFile:mode=>{return(mode&61440)===32768},isDir:mode=>{return(mode&61440)===16384},isLink:mode=>{return(mode&61440)===40960},isChrdev:mode=>{return(mode&61440)===8192},isBlkdev:mode=>{return(mode&61440)===24576},isFIFO:mode=>{return(mode&61440)===4096},isSocket:mode=>{return(mode&49152)===49152},flagModes:{"r":0,"r+":2,"w":577,"w+":578,"a":1089,"a+":1090},modeStringToFlags:str=>{var flags=FS.flagModes[str];if(typeof flags=="undefined"){throw new Error("Unknown file open mode: "+str)}return flags},flagsToPermissionString:flag=>{var perms=["r","w","rw"][flag&3];if(flag&512){perms+="w"}return perms},nodePermissions:(node,perms)=>{if(FS.ignorePermissions){return 0}if(perms.includes("r")&&!(node.mode&292)){return 2}else if(perms.includes("w")&&!(node.mode&146)){return 2}else if(perms.includes("x")&&!(node.mode&73)){return 2}return 0},mayLookup:dir=>{var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate:(dir,name)=>{try{var node=FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete:(dir,name,isdir)=>{var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode}if(isdir){if(!FS.isDir(node.mode)){return 54}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10}}else{if(FS.isDir(node.mode)){return 31}}return 0},mayOpen:(node,flags)=>{if(!node){return 44}if(FS.isLink(node.mode)){return 32}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&512){return 31}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd:(fd_start=0,fd_end=FS.MAX_OPEN_FDS)=>{for(var fd=fd_start;fd<=fd_end;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStream:fd=>FS.streams[fd],createStream:(stream,fd_start,fd_end)=>{if(!FS.FSStream){FS.FSStream=function(){this.shared={}};FS.FSStream.prototype={};Object.defineProperties(FS.FSStream.prototype,{object:{get:function(){return this.node},set:function(val){this.node=val}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}},flags:{get:function(){return this.shared.flags},set:function(val){this.shared.flags=val}},position:{get:function(){return this.shared.position},set:function(val){this.shared.position=val}}})}stream=Object.assign(new FS.FSStream,stream);var fd=FS.nextfd(fd_start,fd_end);stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream:fd=>{FS.streams[fd]=null},chrdev_stream_ops:{open:stream=>{var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;if(stream.stream_ops.open){stream.stream_ops.open(stream)}},llseek:()=>{throw new FS.ErrnoError(70)}},major:dev=>dev>>8,minor:dev=>dev&255,makedev:(ma,mi)=>ma<<8|mi,registerDevice:(dev,ops)=>{FS.devices[dev]={stream_ops:ops}},getDevice:dev=>FS.devices[dev],getMounts:mount=>{var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push.apply(check,m.mounts)}return mounts},syncfs:(populate,callback)=>{if(typeof populate=="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err("warning: "+FS.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work")}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(mount=>{if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount:(type,opts,mountpoint)=>{var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}}var mount={type:type,opts:opts,mountpoint:mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount)}}return mountRoot},unmount:mountpoint=>{var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(28)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);Object.keys(FS.nameTable).forEach(hash=>{var current=FS.nameTable[hash];while(current){var next=current.name_next;if(mounts.includes(current.mount)){FS.destroyNode(current)}current=next}});node.mounted=null;var idx=node.mount.mounts.indexOf(mount);node.mount.mounts.splice(idx,1)},lookup:(parent,name)=>{return parent.node_ops.lookup(parent,name)},mknod:(path,mode,dev)=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name==="."||name===".."){throw new FS.ErrnoError(28)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},create:(path,mode)=>{mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir:(path,mode)=>{mode=mode!==undefined?mode:511;mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)},mkdirTree:(path,mode)=>{var dirs=path.split("/");var d="";for(var i=0;i<dirs.length;++i){if(!dirs[i])continue;d+="/"+dirs[i];try{FS.mkdir(d,mode)}catch(e){if(e.errno!=20)throw e}}},mkdev:(path,mode,dev)=>{if(typeof dev=="undefined"){dev=mode;mode=438}mode|=8192;return FS.mknod(path,mode,dev)},symlink:(oldpath,newpath)=>{if(!PATH_FS.resolve(oldpath)){throw new FS.ErrnoError(44)}var lookup=FS.lookupPath(newpath,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var newname=PATH.basename(newpath);var errCode=FS.mayCreate(parent,newname);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.symlink){throw new FS.ErrnoError(63)}return parent.node_ops.symlink(parent,newname,oldpath)},rename:(old_path,new_path)=>{var old_dirname=PATH.dirname(old_path);var new_dirname=PATH.dirname(new_path);var old_name=PATH.basename(old_path);var new_name=PATH.basename(new_path);var lookup,old_dir,new_dir;lookup=FS.lookupPath(old_path,{parent:true});old_dir=lookup.node;lookup=FS.lookupPath(new_path,{parent:true});new_dir=lookup.node;if(!old_dir||!new_dir)throw new FS.ErrnoError(44);if(old_dir.mount!==new_dir.mount){throw new FS.ErrnoError(75)}var old_node=FS.lookupNode(old_dir,old_name);var relative=PATH_FS.relative(old_path,new_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(28)}relative=PATH_FS.relative(new_path,old_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(55)}var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(old_node===new_node){return}var isdir=FS.isDir(old_node.mode);var errCode=FS.mayDelete(old_dir,old_name,isdir);if(errCode){throw new FS.ErrnoError(errCode)}errCode=new_node?FS.mayDelete(new_dir,new_name,isdir):FS.mayCreate(new_dir,new_name);if(errCode){throw new FS.ErrnoError(errCode)}if(!old_dir.node_ops.rename){throw new FS.ErrnoError(63)}if(FS.isMountpoint(old_node)||new_node&&FS.isMountpoint(new_node)){throw new FS.ErrnoError(10)}if(new_dir!==old_dir){errCode=FS.nodePermissions(old_dir,"w");if(errCode){throw new FS.ErrnoError(errCode)}}FS.hashRemoveNode(old_node);try{old_dir.node_ops.rename(old_node,new_dir,new_name)}catch(e){throw e}finally{FS.hashAddNode(old_node)}},rmdir:path=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,true);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.rmdir){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.rmdir(parent,name);FS.destroyNode(node)},readdir:path=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;if(!node.node_ops.readdir){throw new FS.ErrnoError(54)}return node.node_ops.readdir(node)},unlink:path=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,false);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.unlink){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.unlink(parent,name);FS.destroyNode(node)},readlink:path=>{var lookup=FS.lookupPath(path);var link=lookup.node;if(!link){throw new FS.ErrnoError(44)}if(!link.node_ops.readlink){throw new FS.ErrnoError(28)}return PATH_FS.resolve(FS.getPath(link.parent),link.node_ops.readlink(link))},stat:(path,dontFollow)=>{var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;if(!node){throw new FS.ErrnoError(44)}if(!node.node_ops.getattr){throw new FS.ErrnoError(63)}return node.node_ops.getattr(node)},lstat:path=>{return FS.stat(path,true)},chmod:(path,mode,dontFollow)=>{var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{mode:mode&4095|node.mode&~4095,timestamp:Date.now()})},lchmod:(path,mode)=>{FS.chmod(path,mode,true)},fchmod:(fd,mode)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}FS.chmod(stream.node,mode)},chown:(path,uid,gid,dontFollow)=>{var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{timestamp:Date.now()})},lchown:(path,uid,gid)=>{FS.chown(path,uid,gid,true)},fchown:(fd,uid,gid)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}FS.chown(stream.node,uid,gid)},truncate:(path,len)=>{if(len<0){throw new FS.ErrnoError(28)}var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:true});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}if(FS.isDir(node.mode)){throw new FS.ErrnoError(31)}if(!FS.isFile(node.mode)){throw new FS.ErrnoError(28)}var errCode=FS.nodePermissions(node,"w");if(errCode){throw new FS.ErrnoError(errCode)}node.node_ops.setattr(node,{size:len,timestamp:Date.now()})},ftruncate:(fd,len)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(28)}FS.truncate(stream.node,len)},utime:(path,atime,mtime)=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;node.node_ops.setattr(node,{timestamp:Math.max(atime,mtime)})},open:(path,flags,mode)=>{if(path===""){throw new FS.ErrnoError(44)}flags=typeof flags=="string"?FS.modeStringToFlags(flags):flags;mode=typeof mode=="undefined"?438:mode;if(flags&64){mode=mode&4095|32768}else{mode=0}var node;if(typeof path=="object"){node=path}else{path=PATH.normalize(path);try{var lookup=FS.lookupPath(path,{follow:!(flags&131072)});node=lookup.node}catch(e){}}var created=false;if(flags&64){if(node){if(flags&128){throw new FS.ErrnoError(20)}}else{node=FS.mknod(path,mode,0);created=true}}if(!node){throw new FS.ErrnoError(44)}if(FS.isChrdev(node.mode)){flags&=~512}if(flags&65536&&!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}if(!created){var errCode=FS.mayOpen(node,flags);if(errCode){throw new FS.ErrnoError(errCode)}}if(flags&512&&!created){FS.truncate(node,0)}flags&=~(128|512|131072);var stream=FS.createStream({node:node,path:FS.getPath(node),flags:flags,seekable:true,position:0,stream_ops:node.stream_ops,ungotten:[],error:false});if(stream.stream_ops.open){stream.stream_ops.open(stream)}if(Module["logReadFiles"]&&!(flags&1)){if(!FS.readFiles)FS.readFiles={};if(!(path in FS.readFiles)){FS.readFiles[path]=1}}return stream},close:stream=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream)}}catch(e){throw e}finally{FS.closeStream(stream.fd)}stream.fd=null},isClosed:stream=>{return stream.fd===null},llseek:(stream,offset,whence)=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70)}if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28)}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position},read:(stream,buffer,offset,length,position)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.read){throw new FS.ErrnoError(28)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write:(stream,buffer,offset,length,position,canOwn)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.write){throw new FS.ErrnoError(28)}if(stream.seekable&&stream.flags&1024){FS.llseek(stream,0,2)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesWritten=stream.stream_ops.write(stream,buffer,offset,length,position,canOwn);if(!seeking)stream.position+=bytesWritten;return bytesWritten},allocate:(stream,offset,length)=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(offset<0||length<=0){throw new FS.ErrnoError(28)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(!FS.isFile(stream.node.mode)&&!FS.isDir(stream.node.mode)){throw new FS.ErrnoError(43)}if(!stream.stream_ops.allocate){throw new FS.ErrnoError(138)}stream.stream_ops.allocate(stream,offset,length)},mmap:(stream,length,position,prot,flags)=>{if((prot&2)!==0&&(flags&2)===0&&(stream.flags&2097155)!==2){throw new FS.ErrnoError(2)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(2)}if(!stream.stream_ops.mmap){throw new FS.ErrnoError(43)}return stream.stream_ops.mmap(stream,length,position,prot,flags)},msync:(stream,buffer,offset,length,mmapFlags)=>{if(!stream.stream_ops.msync){return 0}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags)},munmap:stream=>0,ioctl:(stream,cmd,arg)=>{if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile:(path,opts={})=>{opts.flags=opts.flags||0;opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){throw new Error('Invalid encoding type "'+opts.encoding+'"')}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){ret=UTF8ArrayToString(buf,0)}else if(opts.encoding==="binary"){ret=buf}FS.close(stream);return ret},writeFile:(path,data,opts={})=>{opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data=="string"){var buf=new Uint8Array(lengthBytesUTF8(data)+1);var actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,undefined,opts.canOwn)}else if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn)}else{throw new Error("Unsupported data type")}FS.close(stream)},cwd:()=>FS.currentPath,chdir:path=>{var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.path},createDefaultDirectories:()=>{FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user")},createDefaultDevices:()=>{FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length});FS.mkdev("/dev/null",FS.makedev(1,3));TTY.register(FS.makedev(5,0),TTY.default_tty_ops);TTY.register(FS.makedev(6,0),TTY.default_tty1_ops);FS.mkdev("/dev/tty",FS.makedev(5,0));FS.mkdev("/dev/tty1",FS.makedev(6,0));var random_device=getRandomDevice();FS.createDevice("/dev","random",random_device);FS.createDevice("/dev","urandom",random_device);FS.mkdir("/dev/shm");FS.mkdir("/dev/shm/tmp")},createSpecialDirectories:()=>{FS.mkdir("/proc");var proc_self=FS.mkdir("/proc/self");FS.mkdir("/proc/self/fd");FS.mount({mount:()=>{var node=FS.createNode(proc_self,"fd",16384|511,73);node.node_ops={lookup:(parent,name)=>{var fd=+name;var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path}};ret.parent=ret;return ret}};return node}},{},"/proc/self/fd")},createStandardStreams:()=>{if(Module["stdin"]){FS.createDevice("/dev","stdin",Module["stdin"])}else{FS.symlink("/dev/tty","/dev/stdin")}if(Module["stdout"]){FS.createDevice("/dev","stdout",null,Module["stdout"])}else{FS.symlink("/dev/tty","/dev/stdout")}if(Module["stderr"]){FS.createDevice("/dev","stderr",null,Module["stderr"])}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1)},ensureErrnoError:()=>{if(FS.ErrnoError)return;FS.ErrnoError=function ErrnoError(errno,node){this.node=node;this.setErrno=function(errno){this.errno=errno};this.setErrno(errno);this.message="FS error"};FS.ErrnoError.prototype=new Error;FS.ErrnoError.prototype.constructor=FS.ErrnoError;[44].forEach(code=>{FS.genericErrors[code]=new FS.ErrnoError(code);FS.genericErrors[code].stack="<generic error, no stack>"})},staticInit:()=>{FS.ensureErrnoError();FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={"MEMFS":MEMFS}},init:(input,output,error)=>{FS.init.initialized=true;FS.ensureErrnoError();Module["stdin"]=input||Module["stdin"];Module["stdout"]=output||Module["stdout"];Module["stderr"]=error||Module["stderr"];FS.createStandardStreams()},quit:()=>{FS.init.initialized=false;for(var i=0;i<FS.streams.length;i++){var stream=FS.streams[i];if(!stream){continue}FS.close(stream)}},getMode:(canRead,canWrite)=>{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode},findObject:(path,dontResolveLastLink)=>{var ret=FS.analyzePath(path,dontResolveLastLink);if(!ret.exists){return null}return ret.object},analyzePath:(path,dontResolveLastLink)=>{try{var lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});path=lookup.path}catch(e){}var ret={isRoot:false,exists:false,error:0,name:null,path:null,object:null,parentExists:false,parentPath:null,parentObject:null};try{var lookup=FS.lookupPath(path,{parent:true});ret.parentExists=true;ret.parentPath=lookup.path;ret.parentObject=lookup.node;ret.name=PATH.basename(path);lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});ret.exists=true;ret.path=lookup.path;ret.object=lookup.node;ret.name=lookup.node.name;ret.isRoot=lookup.path==="/"}catch(e){ret.error=e.errno}return ret},createPath:(parent,path,canRead,canWrite)=>{parent=typeof parent=="string"?parent:FS.getPath(parent);var parts=path.split("/").reverse();while(parts.length){var part=parts.pop();if(!part)continue;var current=PATH.join2(parent,part);try{FS.mkdir(current)}catch(e){}parent=current}return current},createFile:(parent,name,properties,canRead,canWrite)=>{var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(canRead,canWrite);return FS.create(path,mode)},createDataFile:(parent,name,data,canRead,canWrite,canOwn)=>{var path=name;if(parent){parent=typeof parent=="string"?parent:FS.getPath(parent);path=name?PATH.join2(parent,name):parent}var mode=FS.getMode(canRead,canWrite);var node=FS.create(path,mode);if(data){if(typeof data=="string"){var arr=new Array(data.length);for(var i=0,len=data.length;i<len;++i)arr[i]=data.charCodeAt(i);data=arr}FS.chmod(node,mode|146);var stream=FS.open(node,577);FS.write(stream,data,0,data.length,0,canOwn);FS.close(stream);FS.chmod(node,mode)}return node},createDevice:(parent,name,input,output)=>{var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(!!input,!!output);if(!FS.createDevice.major)FS.createDevice.major=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open:stream=>{stream.seekable=false},close:stream=>{if(output&&output.buffer&&output.buffer.length){output(10)}},read:(stream,buffer,offset,length,pos)=>{var bytesRead=0;for(var i=0;i<length;i++){var result;try{result=input()}catch(e){throw new FS.ErrnoError(29)}if(result===undefined&&bytesRead===0){throw new FS.ErrnoError(6)}if(result===null||result===undefined)break;bytesRead++;buffer[offset+i]=result}if(bytesRead){stream.node.timestamp=Date.now()}return bytesRead},write:(stream,buffer,offset,length,pos)=>{for(var i=0;i<length;i++){try{output(buffer[offset+i])}catch(e){throw new FS.ErrnoError(29)}}if(length){stream.node.timestamp=Date.now()}return i}});return FS.mkdev(path,mode,dev)},forceLoadFile:obj=>{if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(typeof XMLHttpRequest!="undefined"){throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.")}else if(read_){try{obj.contents=intArrayFromString(read_(obj.url),true);obj.usedBytes=obj.contents.length}catch(e){throw new FS.ErrnoError(29)}}else{throw new Error("Cannot load without read() or XMLHttpRequest.")}},createLazyFile:(parent,name,url,canRead,canWrite)=>{function LazyUint8Array(){this.lengthKnown=false;this.chunks=[]}LazyUint8Array.prototype.get=function LazyUint8Array_get(idx){if(idx>this.length-1||idx<0){return undefined}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_cacheLength(){var xhr=new XMLHttpRequest;xhr.open("HEAD",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);var datalength=Number(xhr.getResponseHeader("Content-length"));var header;var hasByteServing=(header=xhr.getResponseHeader("Accept-Ranges"))&&header==="bytes";var usesGzip=(header=xhr.getResponseHeader("Content-Encoding"))&&header==="gzip";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=(from,to)=>{if(from>to)throw new Error("invalid range ("+from+", "+to+") or no bytes requested!");if(to>datalength-1)throw new Error("only "+datalength+" bytes available! programmer error!");var xhr=new XMLHttpRequest;xhr.open("GET",url,false);if(datalength!==chunkSize)xhr.setRequestHeader("Range","bytes="+from+"-"+to);xhr.responseType="arraybuffer";if(xhr.overrideMimeType){xhr.overrideMimeType("text/plain; charset=x-user-defined")}xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);if(xhr.response!==undefined){return new Uint8Array(xhr.response||[])}return intArrayFromString(xhr.responseText||"",true)};var lazyArray=this;lazyArray.setDataGetter(chunkNum=>{var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]=="undefined"){lazyArray.chunks[chunkNum]=doXHR(start,end)}if(typeof lazyArray.chunks[chunkNum]=="undefined")throw new Error("doXHR failed!");return lazyArray.chunks[chunkNum]});if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;out("LazyFiles on gzip forces download of the whole file when length is accessed")}this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true};if(typeof XMLHttpRequest!="undefined"){if(!ENVIRONMENT_IS_WORKER)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var lazyArray=new LazyUint8Array;Object.defineProperties(lazyArray,{length:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._length}},chunkSize:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url:url}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}Object.defineProperties(node,{usedBytes:{get:function(){return this.contents.length}}});var stream_ops={};var keys=Object.keys(node.stream_ops);keys.forEach(key=>{var fn=node.stream_ops[key];stream_ops[key]=function forceLoadLazyFile(){FS.forceLoadFile(node);return fn.apply(null,arguments)}});function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i<size;i++){buffer[offset+i]=contents[position+i]}}else{for(var i=0;i<size;i++){buffer[offset+i]=contents.get(position+i)}}return size}stream_ops.read=(stream,buffer,offset,length,position)=>{FS.forceLoadFile(node);return writeChunks(stream,buffer,offset,length,position)};stream_ops.mmap=(stream,length,position,prot,flags)=>{FS.forceLoadFile(node);var ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48)}writeChunks(stream,HEAP8,ptr,length,position);return{ptr:ptr,allocated:true}};node.stream_ops=stream_ops;return node},createPreloadedFile:(parent,name,url,canRead,canWrite,onload,onerror,dontCreateFile,canOwn,preFinish)=>{var fullname=name?PATH_FS.resolve(PATH.join2(parent,name)):parent;var dep=getUniqueRunDependency("cp "+fullname);function processData(byteArray){function finish(byteArray){if(preFinish)preFinish();if(!dontCreateFile){FS.createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}if(onload)onload();removeRunDependency(dep)}if(Browser.handledByPreloadPlugin(byteArray,fullname,finish,()=>{if(onerror)onerror();removeRunDependency(dep)})){return}finish(byteArray)}addRunDependency(dep);if(typeof url=="string"){asyncLoad(url,byteArray=>processData(byteArray),onerror)}else{processData(url)}},indexedDB:()=>{return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},DB_NAME:()=>{return"EM_FS_"+window.location.pathname},DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=()=>{out("creating db");var db=openRequest.result;db.createObjectStore(FS.DB_STORE_NAME)};openRequest.onsuccess=()=>{var db=openRequest.result;var transaction=db.transaction([FS.DB_STORE_NAME],"readwrite");var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var putRequest=files.put(FS.analyzePath(path).object.contents,path);putRequest.onsuccess=()=>{ok++;if(ok+fail==total)finish()};putRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror},loadFilesFromDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=onerror;openRequest.onsuccess=()=>{var db=openRequest.result;try{var transaction=db.transaction([FS.DB_STORE_NAME],"readonly")}catch(e){onerror(e);return}var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var getRequest=files.get(path);getRequest.onsuccess=()=>{if(FS.analyzePath(path).exists){FS.unlink(path)}FS.createDataFile(PATH.dirname(path),PATH.basename(path),getRequest.result,true,true,true);ok++;if(ok+fail==total)finish()};getRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror}};var SYSCALLS={DEFAULT_POLLMASK:5,calculateAt:function(dirfd,path,allowEmpty){if(PATH.isAbs(path)){return path}var dir;if(dirfd===-100){dir=FS.cwd()}else{var dirstream=SYSCALLS.getStreamFromFD(dirfd);dir=dirstream.path}if(path.length==0){if(!allowEmpty){throw new FS.ErrnoError(44)}return dir}return PATH.join2(dir,path)},doStat:function(func,path,buf){try{var stat=func(path)}catch(e){if(e&&e.node&&PATH.normalize(path)!==PATH.normalize(FS.getPath(e.node))){return-54}throw e}HEAP32[buf>>2]=stat.dev;HEAP32[buf+8>>2]=stat.ino;HEAP32[buf+12>>2]=stat.mode;HEAPU32[buf+16>>2]=stat.nlink;HEAP32[buf+20>>2]=stat.uid;HEAP32[buf+24>>2]=stat.gid;HEAP32[buf+28>>2]=stat.rdev;tempI64=[stat.size>>>0,(tempDouble=stat.size,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+40>>2]=tempI64[0],HEAP32[buf+44>>2]=tempI64[1];HEAP32[buf+48>>2]=4096;HEAP32[buf+52>>2]=stat.blocks;tempI64=[Math.floor(stat.atime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.atime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+56>>2]=tempI64[0],HEAP32[buf+60>>2]=tempI64[1];HEAPU32[buf+64>>2]=0;tempI64=[Math.floor(stat.mtime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.mtime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+72>>2]=tempI64[0],HEAP32[buf+76>>2]=tempI64[1];HEAPU32[buf+80>>2]=0;tempI64=[Math.floor(stat.ctime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.ctime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+88>>2]=tempI64[0],HEAP32[buf+92>>2]=tempI64[1];HEAPU32[buf+96>>2]=0;tempI64=[stat.ino>>>0,(tempDouble=stat.ino,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+104>>2]=tempI64[0],HEAP32[buf+108>>2]=tempI64[1];return 0},doMsync:function(addr,stream,len,flags,offset){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43)}if(flags&2){return 0}var buffer=HEAPU8.slice(addr,addr+len);FS.msync(stream,buffer,offset,len,flags)},varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret},getStreamFromFD:function(fd){var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);return stream}};function ___syscall__newselect(nfds,readfds,writefds,exceptfds,timeout){try{var total=0;var srcReadLow=readfds?HEAP32[readfds>>2]:0,srcReadHigh=readfds?HEAP32[readfds+4>>2]:0;var srcWriteLow=writefds?HEAP32[writefds>>2]:0,srcWriteHigh=writefds?HEAP32[writefds+4>>2]:0;var srcExceptLow=exceptfds?HEAP32[exceptfds>>2]:0,srcExceptHigh=exceptfds?HEAP32[exceptfds+4>>2]:0;var dstReadLow=0,dstReadHigh=0;var dstWriteLow=0,dstWriteHigh=0;var dstExceptLow=0,dstExceptHigh=0;var allLow=(readfds?HEAP32[readfds>>2]:0)|(writefds?HEAP32[writefds>>2]:0)|(exceptfds?HEAP32[exceptfds>>2]:0);var allHigh=(readfds?HEAP32[readfds+4>>2]:0)|(writefds?HEAP32[writefds+4>>2]:0)|(exceptfds?HEAP32[exceptfds+4>>2]:0);var check=function(fd,low,high,val){return fd<32?low&val:high&val};for(var fd=0;fd<nfds;fd++){var mask=1<<fd%32;if(!check(fd,allLow,allHigh,mask)){continue}var stream=SYSCALLS.getStreamFromFD(fd);var flags=SYSCALLS.DEFAULT_POLLMASK;if(stream.stream_ops.poll){flags=stream.stream_ops.poll(stream)}if(flags&1&&check(fd,srcReadLow,srcReadHigh,mask)){fd<32?dstReadLow=dstReadLow|mask:dstReadHigh=dstReadHigh|mask;total++}if(flags&4&&check(fd,srcWriteLow,srcWriteHigh,mask)){fd<32?dstWriteLow=dstWriteLow|mask:dstWriteHigh=dstWriteHigh|mask;total++}if(flags&2&&check(fd,srcExceptLow,srcExceptHigh,mask)){fd<32?dstExceptLow=dstExceptLow|mask:dstExceptHigh=dstExceptHigh|mask;total++}}if(readfds){HEAP32[readfds>>2]=dstReadLow;HEAP32[readfds+4>>2]=dstReadHigh}if(writefds){HEAP32[writefds>>2]=dstWriteLow;HEAP32[writefds+4>>2]=dstWriteHigh}if(exceptfds){HEAP32[exceptfds>>2]=dstExceptLow;HEAP32[exceptfds+4>>2]=dstExceptHigh}return total}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}var SOCKFS={mount:function(mount){Module["websocket"]=Module["websocket"]&&"object"===typeof Module["websocket"]?Module["websocket"]:{};Module["websocket"]._callbacks={};Module["websocket"]["on"]=function(event,callback){if("function"===typeof callback){this._callbacks[event]=callback}return this};Module["websocket"].emit=function(event,param){if("function"===typeof this._callbacks[event]){this._callbacks[event].call(this,param)}};return FS.createNode(null,"/",16384|511,0)},createSocket:function(family,type,protocol){type&=~526336;var streaming=type==1;if(streaming&&protocol&&protocol!=6){throw new FS.ErrnoError(66)}var sock={family:family,type:type,protocol:protocol,server:null,error:null,peers:{},pending:[],recv_queue:[],sock_ops:SOCKFS.websocket_sock_ops};var name=SOCKFS.nextname();var node=FS.createNode(SOCKFS.root,name,49152,0);node.sock=sock;var stream=FS.createStream({path:name,node:node,flags:2,seekable:false,stream_ops:SOCKFS.stream_ops});sock.stream=stream;return sock},getSocket:function(fd){var stream=FS.getStream(fd);if(!stream||!FS.isSocket(stream.node.mode)){return null}return stream.node.sock},stream_ops:{poll:function(stream){var sock=stream.node.sock;return sock.sock_ops.poll(sock)},ioctl:function(stream,request,varargs){var sock=stream.node.sock;return sock.sock_ops.ioctl(sock,request,varargs)},read:function(stream,buffer,offset,length,position){var sock=stream.node.sock;var msg=sock.sock_ops.recvmsg(sock,length);if(!msg){return 0}buffer.set(msg.buffer,offset);return msg.buffer.length},write:function(stream,buffer,offset,length,position){var sock=stream.node.sock;return sock.sock_ops.sendmsg(sock,buffer,offset,length)},close:function(stream){var sock=stream.node.sock;sock.sock_ops.close(sock)}},nextname:function(){if(!SOCKFS.nextname.current){SOCKFS.nextname.current=0}return"socket["+SOCKFS.nextname.current+++"]"},websocket_sock_ops:{createPeer:function(sock,addr,port){var ws;if(typeof addr=="object"){ws=addr;addr=null;port=null}if(ws){if(ws._socket){addr=ws._socket.remoteAddress;port=ws._socket.remotePort}else{var result=/ws[s]?:\/\/([^:]+):(\d+)/.exec(ws.url);if(!result){throw new Error("WebSocket URL must be in the format ws(s)://address:port")}addr=result[1];port=parseInt(result[2],10)}}else{try{var runtimeConfig=Module["websocket"]&&"object"===typeof Module["websocket"];var url="ws:#".replace("#","//");if(runtimeConfig){if("string"===typeof Module["websocket"]["url"]){url=Module["websocket"]["url"]}}if(url==="ws://"||url==="wss://"){var parts=addr.split("/");url=url+parts[0]+":"+port+"/"+parts.slice(1).join("/")}var subProtocols="binary";if(runtimeConfig){if("string"===typeof Module["websocket"]["subprotocol"]){subProtocols=Module["websocket"]["subprotocol"]}}var opts=undefined;if(subProtocols!=="null"){subProtocols=subProtocols.replace(/^ +| +$/g,"").split(/ *, */);opts=subProtocols}if(runtimeConfig&&null===Module["websocket"]["subprotocol"]){subProtocols="null";opts=undefined}var WebSocketConstructor;{WebSocketConstructor=WebSocket}ws=new WebSocketConstructor(url,opts);ws.binaryType="arraybuffer"}catch(e){throw new FS.ErrnoError(23)}}var peer={addr:addr,port:port,socket:ws,dgram_send_queue:[]};SOCKFS.websocket_sock_ops.addPeer(sock,peer);SOCKFS.websocket_sock_ops.handlePeerEvents(sock,peer);if(sock.type===2&&typeof sock.sport!="undefined"){peer.dgram_send_queue.push(new Uint8Array([255,255,255,255,"p".charCodeAt(0),"o".charCodeAt(0),"r".charCodeAt(0),"t".charCodeAt(0),(sock.sport&65280)>>8,sock.sport&255]))}return peer},getPeer:function(sock,addr,port){return sock.peers[addr+":"+port]},addPeer:function(sock,peer){sock.peers[peer.addr+":"+peer.port]=peer},removePeer:function(sock,peer){delete sock.peers[peer.addr+":"+peer.port]},handlePeerEvents:function(sock,peer){var first=true;var handleOpen=function(){Module["websocket"].emit("open",sock.stream.fd);try{var queued=peer.dgram_send_queue.shift();while(queued){peer.socket.send(queued);queued=peer.dgram_send_queue.shift()}}catch(e){peer.socket.close()}};function handleMessage(data){if(typeof data=="string"){var encoder=new TextEncoder;data=encoder.encode(data)}else{assert(data.byteLength!==undefined);if(data.byteLength==0){return}data=new Uint8Array(data)}var wasfirst=first;first=false;if(wasfirst&&data.length===10&&data[0]===255&&data[1]===255&&data[2]===255&&data[3]===255&&data[4]==="p".charCodeAt(0)&&data[5]==="o".charCodeAt(0)&&data[6]==="r".charCodeAt(0)&&data[7]==="t".charCodeAt(0)){var newport=data[8]<<8|data[9];SOCKFS.websocket_sock_ops.removePeer(sock,peer);peer.port=newport;SOCKFS.websocket_sock_ops.addPeer(sock,peer);return}sock.recv_queue.push({addr:peer.addr,port:peer.port,data:data});Module["websocket"].emit("message",sock.stream.fd)}if(ENVIRONMENT_IS_NODE){peer.socket.on("open",handleOpen);peer.socket.on("message",function(data,isBinary){if(!isBinary){return}handleMessage(new Uint8Array(data).buffer)});peer.socket.on("close",function(){Module["websocket"].emit("close",sock.stream.fd)});peer.socket.on("error",function(error){sock.error=14;Module["websocket"].emit("error",[sock.stream.fd,sock.error,"ECONNREFUSED: Connection refused"])})}else{peer.socket.onopen=handleOpen;peer.socket.onclose=function(){Module["websocket"].emit("close",sock.stream.fd)};peer.socket.onmessage=function peer_socket_onmessage(event){handleMessage(event.data)};peer.socket.onerror=function(error){sock.error=14;Module["websocket"].emit("error",[sock.stream.fd,sock.error,"ECONNREFUSED: Connection refused"])}}},poll:function(sock){if(sock.type===1&&sock.server){return sock.pending.length?64|1:0}var mask=0;var dest=sock.type===1?SOCKFS.websocket_sock_ops.getPeer(sock,sock.daddr,sock.dport):null;if(sock.recv_queue.length||!dest||dest&&dest.socket.readyState===dest.socket.CLOSING||dest&&dest.socket.readyState===dest.socket.CLOSED){mask|=64|1}if(!dest||dest&&dest.socket.readyState===dest.socket.OPEN){mask|=4}if(dest&&dest.socket.readyState===dest.socket.CLOSING||dest&&dest.socket.readyState===dest.socket.CLOSED){mask|=16}return mask},ioctl:function(sock,request,arg){switch(request){case 21531:var bytes=0;if(sock.recv_queue.length){bytes=sock.recv_queue[0].data.length}HEAP32[arg>>2]=bytes;return 0;default:return 28}},close:function(sock){if(sock.server){try{sock.server.close()}catch(e){}sock.server=null}var peers=Object.keys(sock.peers);for(var i=0;i<peers.length;i++){var peer=sock.peers[peers[i]];try{peer.socket.close()}catch(e){}SOCKFS.websocket_sock_ops.removePeer(sock,peer)}return 0},bind:function(sock,addr,port){if(typeof sock.saddr!="undefined"||typeof sock.sport!="undefined"){throw new FS.ErrnoError(28)}sock.saddr=addr;sock.sport=port;if(sock.type===2){if(sock.server){sock.server.close();sock.server=null}try{sock.sock_ops.listen(sock,0)}catch(e){if(!(e instanceof FS.ErrnoError))throw e;if(e.errno!==138)throw e}}},connect:function(sock,addr,port){if(sock.server){throw new FS.ErrnoError(138)}if(typeof sock.daddr!="undefined"&&typeof sock.dport!="undefined"){var dest=SOCKFS.websocket_sock_ops.getPeer(sock,sock.daddr,sock.dport);if(dest){if(dest.socket.readyState===dest.socket.CONNECTING){throw new FS.ErrnoError(7)}else{throw new FS.ErrnoError(30)}}}var peer=SOCKFS.websocket_sock_ops.createPeer(sock,addr,port);sock.daddr=peer.addr;sock.dport=peer.port;throw new FS.ErrnoError(26)},listen:function(sock,backlog){if(!ENVIRONMENT_IS_NODE){throw new FS.ErrnoError(138)}},accept:function(listensock){if(!listensock.server||!listensock.pending.length){throw new FS.ErrnoError(28)}var newsock=listensock.pending.shift();newsock.stream.flags=listensock.stream.flags;return newsock},getname:function(sock,peer){var addr,port;if(peer){if(sock.daddr===undefined||sock.dport===undefined){throw new FS.ErrnoError(53)}addr=sock.daddr;port=sock.dport}else{addr=sock.saddr||0;port=sock.sport||0}return{addr:addr,port:port}},sendmsg:function(sock,buffer,offset,length,addr,port){if(sock.type===2){if(addr===undefined||port===undefined){addr=sock.daddr;port=sock.dport}if(addr===undefined||port===undefined){throw new FS.ErrnoError(17)}}else{addr=sock.daddr;port=sock.dport}var dest=SOCKFS.websocket_sock_ops.getPeer(sock,addr,port);if(sock.type===1){if(!dest||dest.socket.readyState===dest.socket.CLOSING||dest.socket.readyState===dest.socket.CLOSED){throw new FS.ErrnoError(53)}else if(dest.socket.readyState===dest.socket.CONNECTING){throw new FS.ErrnoError(6)}}if(ArrayBuffer.isView(buffer)){offset+=buffer.byteOffset;buffer=buffer.buffer}var data;data=buffer.slice(offset,offset+length);if(sock.type===2){if(!dest||dest.socket.readyState!==dest.socket.OPEN){if(!dest||dest.socket.readyState===dest.socket.CLOSING||dest.socket.readyState===dest.socket.CLOSED){dest=SOCKFS.websocket_sock_ops.createPeer(sock,addr,port)}dest.dgram_send_queue.push(data);return length}}try{dest.socket.send(data);return length}catch(e){throw new FS.ErrnoError(28)}},recvmsg:function(sock,length){if(sock.type===1&&sock.server){throw new FS.ErrnoError(53)}var queued=sock.recv_queue.shift();if(!queued){if(sock.type===1){var dest=SOCKFS.websocket_sock_ops.getPeer(sock,sock.daddr,sock.dport);if(!dest){throw new FS.ErrnoError(53)}if(dest.socket.readyState===dest.socket.CLOSING||dest.socket.readyState===dest.socket.CLOSED){return null}throw new FS.ErrnoError(6)}throw new FS.ErrnoError(6)}var queuedLength=queued.data.byteLength||queued.data.length;var queuedOffset=queued.data.byteOffset||0;var queuedBuffer=queued.data.buffer||queued.data;var bytesRead=Math.min(length,queuedLength);var res={buffer:new Uint8Array(queuedBuffer,queuedOffset,bytesRead),addr:queued.addr,port:queued.port};if(sock.type===1&&bytesRead<queuedLength){var bytesRemaining=queuedLength-bytesRead;queued.data=new Uint8Array(queuedBuffer,queuedOffset+bytesRead,bytesRemaining);sock.recv_queue.unshift(queued)}return res}}};function getSocketFromFD(fd){var socket=SOCKFS.getSocket(fd);if(!socket)throw new FS.ErrnoError(8);return socket}function setErrNo(value){HEAP32[___errno_location()>>2]=value;return value}function inetNtop4(addr){return(addr&255)+"."+(addr>>8&255)+"."+(addr>>16&255)+"."+(addr>>24&255)}function inetNtop6(ints){var str="";var word=0;var longest=0;var lastzero=0;var zstart=0;var len=0;var i=0;var parts=[ints[0]&65535,ints[0]>>16,ints[1]&65535,ints[1]>>16,ints[2]&65535,ints[2]>>16,ints[3]&65535,ints[3]>>16];var hasipv4=true;var v4part="";for(i=0;i<5;i++){if(parts[i]!==0){hasipv4=false;break}}if(hasipv4){v4part=inetNtop4(parts[6]|parts[7]<<16);if(parts[5]===-1){str="::ffff:";str+=v4part;return str}if(parts[5]===0){str="::";if(v4part==="0.0.0.0")v4part="";if(v4part==="0.0.0.1")v4part="1";str+=v4part;return str}}for(word=0;word<8;word++){if(parts[word]===0){if(word-lastzero>1){len=0}lastzero=word;len++}if(len>longest){longest=len;zstart=word-longest+1}}for(word=0;word<8;word++){if(longest>1){if(parts[word]===0&&word>=zstart&&word<zstart+longest){if(word===zstart){str+=":";if(zstart===0)str+=":"}continue}}str+=Number(_ntohs(parts[word]&65535)).toString(16);str+=word<7?":":""}return str}function readSockaddr(sa,salen){var family=HEAP16[sa>>1];var port=_ntohs(HEAPU16[sa+2>>1]);var addr;switch(family){case 2:if(salen!==16){return{errno:28}}addr=HEAP32[sa+4>>2];addr=inetNtop4(addr);break;case 10:if(salen!==28){return{errno:28}}addr=[HEAP32[sa+8>>2],HEAP32[sa+12>>2],HEAP32[sa+16>>2],HEAP32[sa+20>>2]];addr=inetNtop6(addr);break;default:return{errno:5}}return{family:family,addr:addr,port:port}}function inetPton4(str){var b=str.split(".");for(var i=0;i<4;i++){var tmp=Number(b[i]);if(isNaN(tmp))return null;b[i]=tmp}return(b[0]|b[1]<<8|b[2]<<16|b[3]<<24)>>>0}function jstoi_q(str){return parseInt(str)}function inetPton6(str){var words;var w,offset,z;var valid6regx=/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i;var parts=[];if(!valid6regx.test(str)){return null}if(str==="::"){return[0,0,0,0,0,0,0,0]}if(str.startsWith("::")){str=str.replace("::","Z:")}else{str=str.replace("::",":Z:")}if(str.indexOf(".")>0){str=str.replace(new RegExp("[.]","g"),":");words=str.split(":");words[words.length-4]=jstoi_q(words[words.length-4])+jstoi_q(words[words.length-3])*256;words[words.length-3]=jstoi_q(words[words.length-2])+jstoi_q(words[words.length-1])*256;words=words.slice(0,words.length-2)}else{words=str.split(":")}offset=0;z=0;for(w=0;w<words.length;w++){if(typeof words[w]=="string"){if(words[w]==="Z"){for(z=0;z<8-words.length+1;z++){parts[w+z]=0}offset=z-1}else{parts[w+offset]=_htons(parseInt(words[w],16))}}else{parts[w+offset]=words[w]}}return[parts[1]<<16|parts[0],parts[3]<<16|parts[2],parts[5]<<16|parts[4],parts[7]<<16|parts[6]]}var DNS={address_map:{id:1,addrs:{},names:{}},lookup_name:function(name){var res=inetPton4(name);if(res!==null){return name}res=inetPton6(name);if(res!==null){return name}var addr;if(DNS.address_map.addrs[name]){addr=DNS.address_map.addrs[name]}else{var id=DNS.address_map.id++;assert(id<65535,"exceeded max address mappings of 65535");addr="172.29."+(id&255)+"."+(id&65280);DNS.address_map.names[addr]=name;DNS.address_map.addrs[name]=addr}return addr},lookup_addr:function(addr){if(DNS.address_map.names[addr]){return DNS.address_map.names[addr]}return null}};function getSocketAddress(addrp,addrlen,allowNull){if(allowNull&&addrp===0)return null;var info=readSockaddr(addrp,addrlen);if(info.errno)throw new FS.ErrnoError(info.errno);info.addr=DNS.lookup_addr(info.addr)||info.addr;return info}function ___syscall_connect(fd,addr,addrlen){try{var sock=getSocketFromFD(fd);var info=getSocketAddress(addr,addrlen);sock.sock_ops.connect(sock,info.addr,info.port);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_fcntl64(fd,cmd,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(cmd){case 0:{var arg=SYSCALLS.get();if(arg<0){return-28}var newStream;newStream=FS.createStream(stream,arg);return newStream.fd}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=SYSCALLS.get();stream.flags|=arg;return 0}case 5:{var arg=SYSCALLS.get();var offset=0;HEAP16[arg+offset>>1]=2;return 0}case 6:case 7:return 0;case 16:case 8:return-28;case 9:setErrNo(28);return-1;default:{return-28}}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_fstat64(fd,buf){try{var stream=SYSCALLS.getStreamFromFD(fd);return SYSCALLS.doStat(FS.stat,stream.path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_getcwd(buf,size){try{if(size===0)return-28;var cwd=FS.cwd();var cwdLengthInBytes=lengthBytesUTF8(cwd)+1;if(size<cwdLengthInBytes)return-68;stringToUTF8(cwd,buf,size);return cwdLengthInBytes}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_ioctl(fd,op,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(op){case 21509:case 21505:{if(!stream.tty)return-59;return 0}case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:{if(!stream.tty)return-59;return 0}case 21519:{if(!stream.tty)return-59;var argp=SYSCALLS.get();HEAP32[argp>>2]=0;return 0}case 21520:{if(!stream.tty)return-59;return-28}case 21531:{var argp=SYSCALLS.get();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-59;return 0}case 21524:{if(!stream.tty)return-59;return 0}default:return-28}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_lstat64(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.doStat(FS.lstat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_mkdirat(dirfd,path,mode){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);path=PATH.normalize(path);if(path[path.length-1]==="/")path=path.substr(0,path.length-1);FS.mkdir(path,mode,0);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_newfstatat(dirfd,path,buf,flags){try{path=SYSCALLS.getStr(path);var nofollow=flags&256;var allowEmpty=flags&4096;flags=flags&~6400;path=SYSCALLS.calculateAt(dirfd,path,allowEmpty);return SYSCALLS.doStat(nofollow?FS.lstat:FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?SYSCALLS.get():0;return FS.open(path,flags,mode).fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}var PIPEFS={BUCKET_BUFFER_SIZE:8192,mount:function(mount){return FS.createNode(null,"/",16384|511,0)},createPipe:function(){var pipe={buckets:[],refcnt:2};pipe.buckets.push({buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:0,roffset:0});var rName=PIPEFS.nextname();var wName=PIPEFS.nextname();var rNode=FS.createNode(PIPEFS.root,rName,4096,0);var wNode=FS.createNode(PIPEFS.root,wName,4096,0);rNode.pipe=pipe;wNode.pipe=pipe;var readableStream=FS.createStream({path:rName,node:rNode,flags:0,seekable:false,stream_ops:PIPEFS.stream_ops});rNode.stream=readableStream;var writableStream=FS.createStream({path:wName,node:wNode,flags:1,seekable:false,stream_ops:PIPEFS.stream_ops});wNode.stream=writableStream;return{readable_fd:readableStream.fd,writable_fd:writableStream.fd}},stream_ops:{poll:function(stream){var pipe=stream.node.pipe;if((stream.flags&2097155)===1){return 256|4}if(pipe.buckets.length>0){for(var i=0;i<pipe.buckets.length;i++){var bucket=pipe.buckets[i];if(bucket.offset-bucket.roffset>0){return 64|1}}}return 0},ioctl:function(stream,request,varargs){return 28},fsync:function(stream){return 28},read:function(stream,buffer,offset,length,position){var pipe=stream.node.pipe;var currentLength=0;for(var i=0;i<pipe.buckets.length;i++){var bucket=pipe.buckets[i];currentLength+=bucket.offset-bucket.roffset}assert(buffer instanceof ArrayBuffer||ArrayBuffer.isView(buffer));var data=buffer.subarray(offset,offset+length);if(length<=0){return 0}if(currentLength==0){throw new FS.ErrnoError(6)}var toRead=Math.min(currentLength,length);var totalRead=toRead;var toRemove=0;for(var i=0;i<pipe.buckets.length;i++){var currBucket=pipe.buckets[i];var bucketSize=currBucket.offset-currBucket.roffset;if(toRead<=bucketSize){var tmpSlice=currBucket.buffer.subarray(currBucket.roffset,currBucket.offset);if(toRead<bucketSize){tmpSlice=tmpSlice.subarray(0,toRead);currBucket.roffset+=toRead}else{toRemove++}data.set(tmpSlice);break}else{var tmpSlice=currBucket.buffer.subarray(currBucket.roffset,currBucket.offset);data.set(tmpSlice);data=data.subarray(tmpSlice.byteLength);toRead-=tmpSlice.byteLength;toRemove++}}if(toRemove&&toRemove==pipe.buckets.length){toRemove--;pipe.buckets[toRemove].offset=0;pipe.buckets[toRemove].roffset=0}pipe.buckets.splice(0,toRemove);return totalRead},write:function(stream,buffer,offset,length,position){var pipe=stream.node.pipe;assert(buffer instanceof ArrayBuffer||ArrayBuffer.isView(buffer));var data=buffer.subarray(offset,offset+length);var dataLen=data.byteLength;if(dataLen<=0){return 0}var currBucket=null;if(pipe.buckets.length==0){currBucket={buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:0,roffset:0};pipe.buckets.push(currBucket)}else{currBucket=pipe.buckets[pipe.buckets.length-1]}assert(currBucket.offset<=PIPEFS.BUCKET_BUFFER_SIZE);var freeBytesInCurrBuffer=PIPEFS.BUCKET_BUFFER_SIZE-currBucket.offset;if(freeBytesInCurrBuffer>=dataLen){currBucket.buffer.set(data,currBucket.offset);currBucket.offset+=dataLen;return dataLen}else if(freeBytesInCurrBuffer>0){currBucket.buffer.set(data.subarray(0,freeBytesInCurrBuffer),currBucket.offset);currBucket.offset+=freeBytesInCurrBuffer;data=data.subarray(freeBytesInCurrBuffer,data.byteLength)}var numBuckets=data.byteLength/PIPEFS.BUCKET_BUFFER_SIZE|0;var remElements=data.byteLength%PIPEFS.BUCKET_BUFFER_SIZE;for(var i=0;i<numBuckets;i++){var newBucket={buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:PIPEFS.BUCKET_BUFFER_SIZE,roffset:0};pipe.buckets.push(newBucket);newBucket.buffer.set(data.subarray(0,PIPEFS.BUCKET_BUFFER_SIZE));data=data.subarray(PIPEFS.BUCKET_BUFFER_SIZE,data.byteLength)}if(remElements>0){var newBucket={buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:data.byteLength,roffset:0};pipe.buckets.push(newBucket);newBucket.buffer.set(data)}return dataLen},close:function(stream){var pipe=stream.node.pipe;pipe.refcnt--;if(pipe.refcnt===0){pipe.buckets=null}}},nextname:function(){if(!PIPEFS.nextname.current){PIPEFS.nextname.current=0}return"pipe["+PIPEFS.nextname.current+++"]"}};function ___syscall_pipe(fdPtr){try{if(fdPtr==0){throw new FS.ErrnoError(21)}var res=PIPEFS.createPipe();HEAP32[fdPtr>>2]=res.readable_fd;HEAP32[fdPtr+4>>2]=res.writable_fd;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_poll(fds,nfds,timeout){try{var nonzero=0;for(var i=0;i<nfds;i++){var pollfd=fds+8*i;var fd=HEAP32[pollfd>>2];var events=HEAP16[pollfd+4>>1];var mask=32;var stream=FS.getStream(fd);if(stream){mask=SYSCALLS.DEFAULT_POLLMASK;if(stream.stream_ops.poll){mask=stream.stream_ops.poll(stream)}}mask&=events|8|16;if(mask)nonzero++;HEAP16[pollfd+6>>1]=mask}return nonzero}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_socket(domain,type,protocol){try{var sock=SOCKFS.createSocket(domain,type,protocol);return sock.stream.fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_stat64(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.doStat(FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}var nowIsMonotonic=true;function __emscripten_get_now_is_monotonic(){return nowIsMonotonic}function readI53FromI64(ptr){return HEAPU32[ptr>>2]+HEAP32[ptr+4>>2]*4294967296}function __gmtime_js(time,tmPtr){var date=new Date(readI53FromI64(time)*1e3);HEAP32[tmPtr>>2]=date.getUTCSeconds();HEAP32[tmPtr+4>>2]=date.getUTCMinutes();HEAP32[tmPtr+8>>2]=date.getUTCHours();HEAP32[tmPtr+12>>2]=date.getUTCDate();HEAP32[tmPtr+16>>2]=date.getUTCMonth();HEAP32[tmPtr+20>>2]=date.getUTCFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getUTCDay();var start=Date.UTC(date.getUTCFullYear(),0,1,0,0,0,0);var yday=(date.getTime()-start)/(1e3*60*60*24)|0;HEAP32[tmPtr+28>>2]=yday}function __isLeapYear(year){return year%4===0&&(year%100!==0||year%400===0)}var __MONTH_DAYS_LEAP_CUMULATIVE=[0,31,60,91,121,152,182,213,244,274,305,335];var __MONTH_DAYS_REGULAR_CUMULATIVE=[0,31,59,90,120,151,181,212,243,273,304,334];function __yday_from_date(date){var isLeapYear=__isLeapYear(date.getFullYear());var monthDaysCumulative=isLeapYear?__MONTH_DAYS_LEAP_CUMULATIVE:__MONTH_DAYS_REGULAR_CUMULATIVE;var yday=monthDaysCumulative[date.getMonth()]+date.getDate()-1;return yday}function __localtime_js(time,tmPtr){var date=new Date(readI53FromI64(time)*1e3);HEAP32[tmPtr>>2]=date.getSeconds();HEAP32[tmPtr+4>>2]=date.getMinutes();HEAP32[tmPtr+8>>2]=date.getHours();HEAP32[tmPtr+12>>2]=date.getDate();HEAP32[tmPtr+16>>2]=date.getMonth();HEAP32[tmPtr+20>>2]=date.getFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getDay();var yday=__yday_from_date(date)|0;HEAP32[tmPtr+28>>2]=yday;HEAP32[tmPtr+36>>2]=-(date.getTimezoneOffset()*60);var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dst=(summerOffset!=winterOffset&&date.getTimezoneOffset()==Math.min(winterOffset,summerOffset))|0;HEAP32[tmPtr+32>>2]=dst}function allocateUTF8(str){var size=lengthBytesUTF8(str)+1;var ret=_malloc(size);if(ret)stringToUTF8Array(str,HEAP8,ret,size);return ret}function __tzset_js(timezone,daylight,tzname){var currentYear=(new Date).getFullYear();var winter=new Date(currentYear,0,1);var summer=new Date(currentYear,6,1);var winterOffset=winter.getTimezoneOffset();var summerOffset=summer.getTimezoneOffset();var stdTimezoneOffset=Math.max(winterOffset,summerOffset);HEAPU32[timezone>>2]=stdTimezoneOffset*60;HEAP32[daylight>>2]=Number(winterOffset!=summerOffset);function extractZone(date){var match=date.toTimeString().match(/\(([A-Za-z ]+)\)$/);return match?match[1]:"GMT"}var winterName=extractZone(winter);var summerName=extractZone(summer);var winterNamePtr=allocateUTF8(winterName);var summerNamePtr=allocateUTF8(summerName);if(summerOffset<winterOffset){HEAPU32[tzname>>2]=winterNamePtr;HEAPU32[tzname+4>>2]=summerNamePtr}else{HEAPU32[tzname>>2]=summerNamePtr;HEAPU32[tzname+4>>2]=winterNamePtr}}function _abort(){abort("")}var readEmAsmArgsArray=[];function readEmAsmArgs(sigPtr,buf){readEmAsmArgsArray.length=0;var ch;buf>>=2;while(ch=HEAPU8[sigPtr++]){buf+=ch!=105&buf;readEmAsmArgsArray.push(ch==105?HEAP32[buf]:HEAPF64[buf++>>1]);++buf}return readEmAsmArgsArray}function runEmAsmFunction(code,sigPtr,argbuf){var args=readEmAsmArgs(sigPtr,argbuf);return ASM_CONSTS[code].apply(null,args)}function _emscripten_asm_const_int(code,sigPtr,argbuf){return runEmAsmFunction(code,sigPtr,argbuf)}function _emscripten_date_now(){return Date.now()}var _emscripten_get_now;_emscripten_get_now=()=>performance.now();function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num)}function getHeapMax(){return 2147483648}function emscripten_realloc_buffer(size){try{wasmMemory.grow(size-buffer.byteLength+65535>>>16);updateGlobalBufferAndViews(wasmMemory.buffer);return 1}catch(e){}}function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize=requestedSize>>>0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}let alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=emscripten_realloc_buffer(newSize);if(replacement){return true}}return false}var ENV={};function getExecutableName(){return thisProgram||"./this.program"}function getEnvStrings(){if(!getEnvStrings.strings){var lang=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8";var env={"USER":"web_user","LOGNAME":"web_user","PATH":"/","PWD":"/","HOME":"/home/web_user","LANG":lang,"_":getExecutableName()};for(var x in ENV){if(ENV[x]===undefined)delete env[x];else env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(x+"="+env[x])}getEnvStrings.strings=strings}return getEnvStrings.strings}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i<str.length;++i){HEAP8[buffer++>>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}function _environ_get(__environ,environ_buf){var bufSize=0;getEnvStrings().forEach(function(string,i){var ptr=environ_buf+bufSize;HEAPU32[__environ+i*4>>2]=ptr;writeAsciiToMemory(string,ptr);bufSize+=string.length+1});return 0}function _environ_sizes_get(penviron_count,penviron_buf_size){var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(function(string){bufSize+=string.length+1});HEAPU32[penviron_buf_size>>2]=bufSize;return 0}function _fd_close(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function doReadv(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.read(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr<len)break}return ret}function _fd_read(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doReadv(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function convertI32PairToI53Checked(lo,hi){return hi+2097152>>>0<4194305-!!lo?(lo>>>0)+hi*4294967296:NaN}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){try{var offset=convertI32PairToI53Checked(offset_low,offset_high);if(isNaN(offset))return 61;var stream=SYSCALLS.getStreamFromFD(fd);FS.llseek(stream,offset,whence);tempI64=[stream.position>>>0,(tempDouble=stream.position,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[newOffset>>2]=tempI64[0],HEAP32[newOffset+4>>2]=tempI64[1];if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function doWritev(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.write(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr}return ret}function _fd_write(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doWritev(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function __arraySum(array,index){var sum=0;for(var i=0;i<=index;sum+=array[i++]){}return sum}var __MONTH_DAYS_LEAP=[31,29,31,30,31,30,31,31,30,31,30,31];var __MONTH_DAYS_REGULAR=[31,28,31,30,31,30,31,31,30,31,30,31];function __addDays(date,days){var newDate=new Date(date.getTime());while(days>0){var leap=__isLeapYear(newDate.getFullYear());var currentMonth=newDate.getMonth();var daysInCurrentMonth=(leap?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR)[currentMonth];if(days>daysInCurrentMonth-newDate.getDate()){days-=daysInCurrentMonth-newDate.getDate()+1;newDate.setDate(1);if(currentMonth<11){newDate.setMonth(currentMonth+1)}else{newDate.setMonth(0);newDate.setFullYear(newDate.getFullYear()+1)}}else{newDate.setDate(newDate.getDate()+days);return newDate}}return newDate}function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}function _strftime(s,maxsize,format,tm){var tm_zone=HEAP32[tm+40>>2];var date={tm_sec:HEAP32[tm>>2],tm_min:HEAP32[tm+4>>2],tm_hour:HEAP32[tm+8>>2],tm_mday:HEAP32[tm+12>>2],tm_mon:HEAP32[tm+16>>2],tm_year:HEAP32[tm+20>>2],tm_wday:HEAP32[tm+24>>2],tm_yday:HEAP32[tm+28>>2],tm_isdst:HEAP32[tm+32>>2],tm_gmtoff:HEAP32[tm+36>>2],tm_zone:tm_zone?UTF8ToString(tm_zone):""};var pattern=UTF8ToString(format);var EXPANSION_RULES_1={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var rule in EXPANSION_RULES_1){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_1[rule])}var WEEKDAYS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];function leadingSomething(value,digits,character){var str=typeof value=="number"?value.toString():value||"";while(str.length<digits){str=character[0]+str}return str}function leadingNulls(value,digits){return leadingSomething(value,digits,"0")}function compareByDay(date1,date2){function sgn(value){return value<0?-1:value>0?1:0}var compare;if((compare=sgn(date1.getFullYear()-date2.getFullYear()))===0){if((compare=sgn(date1.getMonth()-date2.getMonth()))===0){compare=sgn(date1.getDate()-date2.getDate())}}return compare}function getFirstWeekStartDate(janFourth){switch(janFourth.getDay()){case 0:return new Date(janFourth.getFullYear()-1,11,29);case 1:return janFourth;case 2:return new Date(janFourth.getFullYear(),0,3);case 3:return new Date(janFourth.getFullYear(),0,2);case 4:return new Date(janFourth.getFullYear(),0,1);case 5:return new Date(janFourth.getFullYear()-1,11,31);case 6:return new Date(janFourth.getFullYear()-1,11,30)}}function getWeekBasedYear(date){var thisDate=__addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);var janFourthThisYear=new Date(thisDate.getFullYear(),0,4);var janFourthNextYear=new Date(thisDate.getFullYear()+1,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);if(compareByDay(firstWeekStartThisYear,thisDate)<=0){if(compareByDay(firstWeekStartNextYear,thisDate)<=0){return thisDate.getFullYear()+1}return thisDate.getFullYear()}return thisDate.getFullYear()-1}var EXPANSION_RULES_2={"%a":function(date){return WEEKDAYS[date.tm_wday].substring(0,3)},"%A":function(date){return WEEKDAYS[date.tm_wday]},"%b":function(date){return MONTHS[date.tm_mon].substring(0,3)},"%B":function(date){return MONTHS[date.tm_mon]},"%C":function(date){var year=date.tm_year+1900;return leadingNulls(year/100|0,2)},"%d":function(date){return leadingNulls(date.tm_mday,2)},"%e":function(date){return leadingSomething(date.tm_mday,2," ")},"%g":function(date){return getWeekBasedYear(date).toString().substring(2)},"%G":function(date){return getWeekBasedYear(date)},"%H":function(date){return leadingNulls(date.tm_hour,2)},"%I":function(date){var twelveHour=date.tm_hour;if(twelveHour==0)twelveHour=12;else if(twelveHour>12)twelveHour-=12;return leadingNulls(twelveHour,2)},"%j":function(date){return leadingNulls(date.tm_mday+__arraySum(__isLeapYear(date.tm_year+1900)?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,date.tm_mon-1),3)},"%m":function(date){return leadingNulls(date.tm_mon+1,2)},"%M":function(date){return leadingNulls(date.tm_min,2)},"%n":function(){return"\n"},"%p":function(date){if(date.tm_hour>=0&&date.tm_hour<12){return"AM"}return"PM"},"%S":function(date){return leadingNulls(date.tm_sec,2)},"%t":function(){return"\t"},"%u":function(date){return date.tm_wday||7},"%U":function(date){var days=date.tm_yday+7-date.tm_wday;return leadingNulls(Math.floor(days/7),2)},"%V":function(date){var val=Math.floor((date.tm_yday+7-(date.tm_wday+6)%7)/7);if((date.tm_wday+371-date.tm_yday-2)%7<=2){val++}if(!val){val=52;var dec31=(date.tm_wday+7-date.tm_yday-1)%7;if(dec31==4||dec31==5&&__isLeapYear(date.tm_year%400-1)){val++}}else if(val==53){var jan1=(date.tm_wday+371-date.tm_yday)%7;if(jan1!=4&&(jan1!=3||!__isLeapYear(date.tm_year)))val=1}return leadingNulls(val,2)},"%w":function(date){return date.tm_wday},"%W":function(date){var days=date.tm_yday+7-(date.tm_wday+6)%7;return leadingNulls(Math.floor(days/7),2)},"%y":function(date){return(date.tm_year+1900).toString().substring(2)},"%Y":function(date){return date.tm_year+1900},"%z":function(date){var off=date.tm_gmtoff;var ahead=off>=0;off=Math.abs(off)/60;off=off/60*100+off%60;return(ahead?"+":"-")+String("0000"+off).slice(-4)},"%Z":function(date){return date.tm_zone},"%%":function(){return"%"}};pattern=pattern.replace(/%%/g,"\0\0");for(var rule in EXPANSION_RULES_2){if(pattern.includes(rule)){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_2[rule](date))}}pattern=pattern.replace(/\0\0/g,"%");var bytes=intArrayFromString(pattern,false);if(bytes.length>maxsize){return 0}writeArrayToMemory(bytes,s);return bytes.length-1}function _strftime_l(s,maxsize,format,tm,loc){return _strftime(s,maxsize,format,tm)}function _zlt_tfjs_execute_afn(input_img,input_ref,input_msk,len,output_buffer){return execute_afn(input_img,input_ref,input_msk,len,output_buffer)}function _zlt_tfjs_execute_base_cls(input_buffer,len,output_buffer,output_len){return execute_base(input_buffer,len,output_buffer,output_len)}async function _zlt_tfjs_init(){}function _zoom_wcl_get_cpu_num(){return hardcodecpunumber()}function _zoom_wcl_get_csc_thread_num(){return 1}function _zoom_wcl_support_multi_thread(){return IsSupportMultiThread()}function getCFunc(ident){var func=Module["_"+ident];return func}function ccall(ident,returnType,argTypes,args,opts){var toC={"string":str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}return ret},"array":arr=>{var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType==="string"){return UTF8ToString(ret)}if(returnType==="boolean")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i<args.length;i++){var converter=toC[argTypes[i]];if(converter){if(stack===0)stack=stackSave();cArgs[i]=converter(args[i])}else{cArgs[i]=args[i]}}}var ret=func.apply(null,cArgs);function onDone(ret){if(stack!==0)stackRestore(stack);return convertReturnValue(ret)}ret=onDone(ret);return ret}function cwrap(ident,returnType,argTypes,opts){argTypes=argTypes||[];var numericArgs=argTypes.every(type=>type==="number"||type==="boolean");var numericRet=returnType!=="string";if(numericRet&&numericArgs&&!opts){return getCFunc(ident)}return function(){return ccall(ident,returnType,argTypes,arguments,opts)}}var FSNode=function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.mounted=null;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.node_ops={};this.stream_ops={};this.rdev=rdev};var readMode=292|73;var writeMode=146;Object.defineProperties(FSNode.prototype,{read:{get:function(){return(this.mode&readMode)===readMode},set:function(val){val?this.mode|=readMode:this.mode&=~readMode}},write:{get:function(){return(this.mode&writeMode)===writeMode},set:function(val){val?this.mode|=writeMode:this.mode&=~writeMode}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}});FS.FSNode=FSNode;FS.staticInit();var asmLibraryArg={"AdapterWhiteListCheck":_AdapterWhiteListCheck,"CloseVideoEncoder":_CloseVideoEncoder,"CreateGltPlatform":_CreateGltPlatform,"DestroyGltPlatform":_DestroyGltPlatform,"GetEncoderState":_GetEncoderState,"GetLogLevel":_GetLogLevel,"InitVideoDecoder":_InitVideoDecoder,"InitVideoEncoder":_InitVideoEncoder,"LimitWebCodecsEncoderTo360":_LimitWebCodecsEncoderTo360,"Set_Share_Mode":_Set_Share_Mode,"UserAgentIsTesla":_UserAgentIsTesla,"VideoDecoder":_VideoDecoder,"VideoDecoderConfigure":_VideoDecoderConfigure,"VideoEncoderConfigure":_VideoEncoderConfigure,"WebCodecsVideoEncoder":_WebCodecsVideoEncoder,"_ZN11cpt_generic6thread4joinEv":__ZN11cpt_generic6thread4joinEv,"_ZN11cpt_generic6threadD1Ev":__ZN11cpt_generic6threadD1Ev,"_ZN5Nydus16CWCLWallRenderer14CreateInstanceEPvRKNS_9NydusRectEPPNS_13IWallRendererE":__ZN5Nydus16CWCLWallRenderer14CreateInstanceEPvRKNS_9NydusRectEPPNS_13IWallRendererE,"__assert_fail":___assert_fail,"__cxa_allocate_exception":___cxa_allocate_exception,"__cxa_throw":___cxa_throw,"__syscall__newselect":___syscall__newselect,"__syscall_connect":___syscall_connect,"__syscall_fcntl64":___syscall_fcntl64,"__syscall_fstat64":___syscall_fstat64,"__syscall_getcwd":___syscall_getcwd,"__syscall_ioctl":___syscall_ioctl,"__syscall_lstat64":___syscall_lstat64,"__syscall_mkdirat":___syscall_mkdirat,"__syscall_newfstatat":___syscall_newfstatat,"__syscall_openat":___syscall_openat,"__syscall_pipe":___syscall_pipe,"__syscall_poll":___syscall_poll,"__syscall_socket":___syscall_socket,"__syscall_stat64":___syscall_stat64,"_emscripten_get_now_is_monotonic":__emscripten_get_now_is_monotonic,"_gmtime_js":__gmtime_js,"_localtime_js":__localtime_js,"_tzset_js":__tzset_js,"abort":_abort,"emscripten_asm_const_int":_emscripten_asm_const_int,"emscripten_date_now":_emscripten_date_now,"emscripten_get_now":_emscripten_get_now,"emscripten_memcpy_big":_emscripten_memcpy_big,"emscripten_resize_heap":_emscripten_resize_heap,"environ_get":_environ_get,"environ_sizes_get":_environ_sizes_get,"fd_close":_fd_close,"fd_read":_fd_read,"fd_seek":_fd_seek,"fd_write":_fd_write,"strftime":_strftime,"strftime_l":_strftime_l,"zlt_tfjs_execute_afn":_zlt_tfjs_execute_afn,"zlt_tfjs_execute_base_cls":_zlt_tfjs_execute_base_cls,"zlt_tfjs_init":_zlt_tfjs_init,"zoom_wcl_get_cpu_num":_zoom_wcl_get_cpu_num,"zoom_wcl_get_csc_thread_num":_zoom_wcl_get_csc_thread_num,"zoom_wcl_support_multi_thread":_zoom_wcl_support_multi_thread};var asm=createWasm();var ___wasm_call_ctors=Module["___wasm_call_ctors"]=function(){return(___wasm_call_ctors=Module["___wasm_call_ctors"]=Module["asm"]["__wasm_call_ctors"]).apply(null,arguments)};var _malloc=Module["_malloc"]=function(){return(_malloc=Module["_malloc"]=Module["asm"]["malloc"]).apply(null,arguments)};var __Video_Init=Module["__Video_Init"]=function(){return(__Video_Init=Module["__Video_Init"]=Module["asm"]["_Video_Init"]).apply(null,arguments)};var __Video_UnInit=Module["__Video_UnInit"]=function(){return(__Video_UnInit=Module["__Video_UnInit"]=Module["asm"]["_Video_UnInit"]).apply(null,arguments)};var __Video_Decode=Module["__Video_Decode"]=function(){return(__Video_Decode=Module["__Video_Decode"]=Module["asm"]["_Video_Decode"]).apply(null,arguments)};var __Change_Connect_Type=Module["__Change_Connect_Type"]=function(){return(__Change_Connect_Type=Module["__Change_Connect_Type"]=Module["asm"]["_Change_Connect_Type"]).apply(null,arguments)};var __Smooth_Send_For_Qos=Module["__Smooth_Send_For_Qos"]=function(){return(__Smooth_Send_For_Qos=Module["__Smooth_Send_For_Qos"]=Module["asm"]["_Smooth_Send_For_Qos"]).apply(null,arguments)};var __Video_Try_Analysis=Module["__Video_Try_Analysis"]=function(){return(__Video_Try_Analysis=Module["__Video_Try_Analysis"]=Module["asm"]["_Video_Try_Analysis"]).apply(null,arguments)};var __Video_Encode=Module["__Video_Encode"]=function(){return(__Video_Encode=Module["__Video_Encode"]=Module["asm"]["_Video_Encode"]).apply(null,arguments)};var __Video_Encode_YUV=Module["__Video_Encode_YUV"]=function(){return(__Video_Encode_YUV=Module["__Video_Encode_YUV"]=Module["asm"]["_Video_Encode_YUV"]).apply(null,arguments)};var __Video_VirtualBackground_Special_Action=Module["__Video_VirtualBackground_Special_Action"]=function(){return(__Video_VirtualBackground_Special_Action=Module["__Video_VirtualBackground_Special_Action"]=Module["asm"]["_Video_VirtualBackground_Special_Action"]).apply(null,arguments)};var __Qos_Sender_Send_Data_In_Main_Thread=Module["__Qos_Sender_Send_Data_In_Main_Thread"]=function(){return(__Qos_Sender_Send_Data_In_Main_Thread=Module["__Qos_Sender_Send_Data_In_Main_Thread"]=Module["asm"]["_Qos_Sender_Send_Data_In_Main_Thread"]).apply(null,arguments)};var __Video_Websocket_Speed=Module["__Video_Websocket_Speed"]=function(){return(__Video_Websocket_Speed=Module["__Video_Websocket_Speed"]=Module["asm"]["_Video_Websocket_Speed"]).apply(null,arguments)};var __Video_Start_Encode=Module["__Video_Start_Encode"]=function(){return(__Video_Start_Encode=Module["__Video_Start_Encode"]=Module["asm"]["_Video_Start_Encode"]).apply(null,arguments)};var __Video_Stop_Encode=Module["__Video_Stop_Encode"]=function(){return(__Video_Stop_Encode=Module["__Video_Stop_Encode"]=Module["asm"]["_Video_Stop_Encode"]).apply(null,arguments)};var __Request_Video_Qos_Data=Module["__Request_Video_Qos_Data"]=function(){return(__Request_Video_Qos_Data=Module["__Request_Video_Qos_Data"]=Module["asm"]["_Request_Video_Qos_Data"]).apply(null,arguments)};var __Video_Update_Format=Module["__Video_Update_Format"]=function(){return(__Video_Update_Format=Module["__Video_Update_Format"]=Module["asm"]["_Video_Update_Format"]).apply(null,arguments)};var __Video_Get_Sending_Status=Module["__Video_Get_Sending_Status"]=function(){return(__Video_Get_Sending_Status=Module["__Video_Get_Sending_Status"]=Module["asm"]["_Video_Get_Sending_Status"]).apply(null,arguments)};var __Video_Get_Encode_Codec_Info=Module["__Video_Get_Encode_Codec_Info"]=function(){return(__Video_Get_Encode_Codec_Info=Module["__Video_Get_Encode_Codec_Info"]=Module["asm"]["_Video_Get_Encode_Codec_Info"]).apply(null,arguments)};var __Video_Get_Decode_Codec_Info=Module["__Video_Get_Decode_Codec_Info"]=function(){return(__Video_Get_Decode_Codec_Info=Module["__Video_Get_Decode_Codec_Info"]=Module["asm"]["_Video_Get_Decode_Codec_Info"]).apply(null,arguments)};var __Video_Set_Data_Encryption=Module["__Video_Set_Data_Encryption"]=function(){return(__Video_Set_Data_Encryption=Module["__Video_Set_Data_Encryption"]=Module["asm"]["_Video_Set_Data_Encryption"]).apply(null,arguments)};var __Add_Video_Cooker_info=Module["__Add_Video_Cooker_info"]=function(){return(__Add_Video_Cooker_info=Module["__Add_Video_Cooker_info"]=Module["asm"]["_Add_Video_Cooker_info"]).apply(null,arguments)};var __Remove_Video_Cooker_Info=Module["__Remove_Video_Cooker_Info"]=function(){return(__Remove_Video_Cooker_Info=Module["__Remove_Video_Cooker_Info"]=Module["asm"]["_Remove_Video_Cooker_Info"]).apply(null,arguments)};var __Get_Video_Meat_Weight=Module["__Get_Video_Meat_Weight"]=function(){return(__Get_Video_Meat_Weight=Module["__Get_Video_Meat_Weight"]=Module["asm"]["_Get_Video_Meat_Weight"]).apply(null,arguments)};var __Set_Max_Receiving_Channel_Num=Module["__Set_Max_Receiving_Channel_Num"]=function(){return(__Set_Max_Receiving_Channel_Num=Module["__Set_Max_Receiving_Channel_Num"]=Module["asm"]["_Set_Max_Receiving_Channel_Num"]).apply(null,arguments)};var __update_sync_time=Module["__update_sync_time"]=function(){return(__update_sync_time=Module["__update_sync_time"]=Module["asm"]["_update_sync_time"]).apply(null,arguments)};var __release_video_receiving_channel=Module["__release_video_receiving_channel"]=function(){return(__release_video_receiving_channel=Module["__release_video_receiving_channel"]=Module["asm"]["_release_video_receiving_channel"]).apply(null,arguments)};var __change_hw_status=Module["__change_hw_status"]=function(){return(__change_hw_status=Module["__change_hw_status"]=Module["asm"]["_change_hw_status"]).apply(null,arguments)};var __rotate_video=Module["__rotate_video"]=function(){return(__rotate_video=Module["__rotate_video"]=Module["asm"]["_rotate_video"]).apply(null,arguments)};var __update_video_uplink_bandwidth_limitation_by_server=Module["__update_video_uplink_bandwidth_limitation_by_server"]=function(){return(__update_video_uplink_bandwidth_limitation_by_server=Module["__update_video_uplink_bandwidth_limitation_by_server"]=Module["asm"]["_update_video_uplink_bandwidth_limitation_by_server"]).apply(null,arguments)};var _free=Module["_free"]=function(){return(_free=Module["_free"]=Module["asm"]["free"]).apply(null,arguments)};var __create_vb_thread=Module["__create_vb_thread"]=function(){return(__create_vb_thread=Module["__create_vb_thread"]=Module["asm"]["_create_vb_thread"]).apply(null,arguments)};var __create_vb_no_sab_thread=Module["__create_vb_no_sab_thread"]=function(){return(__create_vb_no_sab_thread=Module["__create_vb_no_sab_thread"]=Module["asm"]["_create_vb_no_sab_thread"]).apply(null,arguments)};var __signal_vb_thread_blur=Module["__signal_vb_thread_blur"]=function(){return(__signal_vb_thread_blur=Module["__signal_vb_thread_blur"]=Module["asm"]["_signal_vb_thread_blur"]).apply(null,arguments)};var __signal_vb_thread_bg=Module["__signal_vb_thread_bg"]=function(){return(__signal_vb_thread_bg=Module["__signal_vb_thread_bg"]=Module["asm"]["_signal_vb_thread_bg"]).apply(null,arguments)};var __signal_vb_thread_video_yuv=Module["__signal_vb_thread_video_yuv"]=function(){return(__signal_vb_thread_video_yuv=Module["__signal_vb_thread_video_yuv"]=Module["asm"]["_signal_vb_thread_video_yuv"]).apply(null,arguments)};var __signal_vb_thread_video_rgba=Module["__signal_vb_thread_video_rgba"]=function(){return(__signal_vb_thread_video_rgba=Module["__signal_vb_thread_video_rgba"]=Module["asm"]["_signal_vb_thread_video_rgba"]).apply(null,arguments)};var __signal_vb_thread_close=Module["__signal_vb_thread_close"]=function(){return(__signal_vb_thread_close=Module["__signal_vb_thread_close"]=Module["asm"]["_signal_vb_thread_close"]).apply(null,arguments)};var __update_video_cropping_mode=Module["__update_video_cropping_mode"]=function(){return(__update_video_cropping_mode=Module["__update_video_cropping_mode"]=Module["asm"]["_update_video_cropping_mode"]).apply(null,arguments)};var __collect_video_monitor_info=Module["__collect_video_monitor_info"]=function(){return(__collect_video_monitor_info=Module["__collect_video_monitor_info"]=Module["asm"]["_collect_video_monitor_info"]).apply(null,arguments)};var __request_nack_t_periodically_for_qos=Module["__request_nack_t_periodically_for_qos"]=function(){return(__request_nack_t_periodically_for_qos=Module["__request_nack_t_periodically_for_qos"]=Module["asm"]["_request_nack_t_periodically_for_qos"]).apply(null,arguments)};var __Sharing_Encode_Init=Module["__Sharing_Encode_Init"]=function(){return(__Sharing_Encode_Init=Module["__Sharing_Encode_Init"]=Module["asm"]["_Sharing_Encode_Init"]).apply(null,arguments)};var __Sharing_Encode_Try_Analysis=Module["__Sharing_Encode_Try_Analysis"]=function(){return(__Sharing_Encode_Try_Analysis=Module["__Sharing_Encode_Try_Analysis"]=Module["asm"]["_Sharing_Encode_Try_Analysis"]).apply(null,arguments)};var __Sharing_Encode_Uninit=Module["__Sharing_Encode_Uninit"]=function(){return(__Sharing_Encode_Uninit=Module["__Sharing_Encode_Uninit"]=Module["asm"]["_Sharing_Encode_Uninit"]).apply(null,arguments)};var __Sharing_Encode=Module["__Sharing_Encode"]=function(){return(__Sharing_Encode=Module["__Sharing_Encode"]=Module["asm"]["_Sharing_Encode"]).apply(null,arguments)};var __Request_Sharing_Qos_Data=Module["__Request_Sharing_Qos_Data"]=function(){return(__Request_Sharing_Qos_Data=Module["__Request_Sharing_Qos_Data"]=Module["asm"]["_Request_Sharing_Qos_Data"]).apply(null,arguments)};var __Sharing_Set_Data_Encryption=Module["__Sharing_Set_Data_Encryption"]=function(){return(__Sharing_Set_Data_Encryption=Module["__Sharing_Set_Data_Encryption"]=Module["asm"]["_Sharing_Set_Data_Encryption"]).apply(null,arguments)};var __Get_Sharing_Sending_Status=Module["__Get_Sharing_Sending_Status"]=function(){return(__Get_Sharing_Sending_Status=Module["__Get_Sharing_Sending_Status"]=Module["asm"]["_Get_Sharing_Sending_Status"]).apply(null,arguments)};var __Get_Codec_Info=Module["__Get_Codec_Info"]=function(){return(__Get_Codec_Info=Module["__Get_Codec_Info"]=Module["asm"]["_Get_Codec_Info"]).apply(null,arguments)};var __Sharing_Pause_Encode=Module["__Sharing_Pause_Encode"]=function(){return(__Sharing_Pause_Encode=Module["__Sharing_Pause_Encode"]=Module["asm"]["_Sharing_Pause_Encode"]).apply(null,arguments)};var __Sharing_Resume_Encode=Module["__Sharing_Resume_Encode"]=function(){return(__Sharing_Resume_Encode=Module["__Sharing_Resume_Encode"]=Module["asm"]["_Sharing_Resume_Encode"]).apply(null,arguments)};var __Sharing_Stop_Encode=Module["__Sharing_Stop_Encode"]=function(){return(__Sharing_Stop_Encode=Module["__Sharing_Stop_Encode"]=Module["asm"]["_Sharing_Stop_Encode"]).apply(null,arguments)};var __Sharing_Websocket_Speed=Module["__Sharing_Websocket_Speed"]=function(){return(__Sharing_Websocket_Speed=Module["__Sharing_Websocket_Speed"]=Module["asm"]["_Sharing_Websocket_Speed"]).apply(null,arguments)};var __Add_Sharing_Cooker_info=Module["__Add_Sharing_Cooker_info"]=function(){return(__Add_Sharing_Cooker_info=Module["__Add_Sharing_Cooker_info"]=Module["asm"]["_Add_Sharing_Cooker_info"]).apply(null,arguments)};var __Remove_Sharing_Cooker_Info=Module["__Remove_Sharing_Cooker_Info"]=function(){return(__Remove_Sharing_Cooker_Info=Module["__Remove_Sharing_Cooker_Info"]=Module["asm"]["_Remove_Sharing_Cooker_Info"]).apply(null,arguments)};var __Get_Sharing_Meat_Weight=Module["__Get_Sharing_Meat_Weight"]=function(){return(__Get_Sharing_Meat_Weight=Module["__Get_Sharing_Meat_Weight"]=Module["asm"]["_Get_Sharing_Meat_Weight"]).apply(null,arguments)};var __Set_Sharing_Encryption_Key_Directly=Module["__Set_Sharing_Encryption_Key_Directly"]=function(){return(__Set_Sharing_Encryption_Key_Directly=Module["__Set_Sharing_Encryption_Key_Directly"]=Module["asm"]["_Set_Sharing_Encryption_Key_Directly"]).apply(null,arguments)};var __Add_Roster_Info_Directly=Module["__Add_Roster_Info_Directly"]=function(){return(__Add_Roster_Info_Directly=Module["__Add_Roster_Info_Directly"]=Module["asm"]["_Add_Roster_Info_Directly"]).apply(null,arguments)};var __Add_Rev_Channel=Module["__Add_Rev_Channel"]=function(){return(__Add_Rev_Channel=Module["__Add_Rev_Channel"]=Module["asm"]["_Add_Rev_Channel"]).apply(null,arguments)};var __Remove_Rev_Channel=Module["__Remove_Rev_Channel"]=function(){return(__Remove_Rev_Channel=Module["__Remove_Rev_Channel"]=Module["asm"]["_Remove_Rev_Channel"]).apply(null,arguments)};var __update_sharing_uplink_bandwidth_limitation_by_server=Module["__update_sharing_uplink_bandwidth_limitation_by_server"]=function(){return(__update_sharing_uplink_bandwidth_limitation_by_server=Module["__update_sharing_uplink_bandwidth_limitation_by_server"]=Module["asm"]["_update_sharing_uplink_bandwidth_limitation_by_server"]).apply(null,arguments)};var __collect_sharing_monitor_info=Module["__collect_sharing_monitor_info"]=function(){return(__collect_sharing_monitor_info=Module["__collect_sharing_monitor_info"]=Module["asm"]["_collect_sharing_monitor_info"]).apply(null,arguments)};var __set_annotation_action=Module["__set_annotation_action"]=function(){return(__set_annotation_action=Module["__set_annotation_action"]=Module["asm"]["_set_annotation_action"]).apply(null,arguments)};var __request_nack_t_periodically_for_sharing_qos=Module["__request_nack_t_periodically_for_sharing_qos"]=function(){return(__request_nack_t_periodically_for_sharing_qos=Module["__request_nack_t_periodically_for_sharing_qos"]=Module["asm"]["_request_nack_t_periodically_for_sharing_qos"]).apply(null,arguments)};var __Change_Connect_Type_For_Sharing=Module["__Change_Connect_Type_For_Sharing"]=function(){return(__Change_Connect_Type_For_Sharing=Module["__Change_Connect_Type_For_Sharing"]=Module["asm"]["_Change_Connect_Type_For_Sharing"]).apply(null,arguments)};var ___errno_location=Module["___errno_location"]=function(){return(___errno_location=Module["___errno_location"]=Module["asm"]["__errno_location"]).apply(null,arguments)};var _OnVideoFrameOutputCallback=Module["_OnVideoFrameOutputCallback"]=function(){return(_OnVideoFrameOutputCallback=Module["_OnVideoFrameOutputCallback"]=Module["asm"]["OnVideoFrameOutputCallback"]).apply(null,arguments)};var _OnEncodedVideoChunkOutputCallback=Module["_OnEncodedVideoChunkOutputCallback"]=function(){return(_OnEncodedVideoChunkOutputCallback=Module["_OnEncodedVideoChunkOutputCallback"]=Module["asm"]["OnEncodedVideoChunkOutputCallback"]).apply(null,arguments)};var _htons=Module["_htons"]=function(){return(_htons=Module["_htons"]=Module["asm"]["htons"]).apply(null,arguments)};var _ntohs=Module["_ntohs"]=function(){return(_ntohs=Module["_ntohs"]=Module["asm"]["ntohs"]).apply(null,arguments)};var stackSave=Module["stackSave"]=function(){return(stackSave=Module["stackSave"]=Module["asm"]["stackSave"]).apply(null,arguments)};var stackRestore=Module["stackRestore"]=function(){return(stackRestore=Module["stackRestore"]=Module["asm"]["stackRestore"]).apply(null,arguments)};var stackAlloc=Module["stackAlloc"]=function(){return(stackAlloc=Module["stackAlloc"]=Module["asm"]["stackAlloc"]).apply(null,arguments)};var ___cxa_demangle=Module["___cxa_demangle"]=function(){return(___cxa_demangle=Module["___cxa_demangle"]=Module["asm"]["__cxa_demangle"]).apply(null,arguments)};var ___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=function(){return(___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=Module["asm"]["__cxa_is_pointer_type"]).apply(null,arguments)};var dynCall_iijiiiiiiiiiii=Module["dynCall_iijiiiiiiiiiii"]=function(){return(dynCall_iijiiiiiiiiiii=Module["dynCall_iijiiiiiiiiiii"]=Module["asm"]["dynCall_iijiiiiiiiiiii"]).apply(null,arguments)};var dynCall_iijiiiiiiiiii=Module["dynCall_iijiiiiiiiiii"]=function(){return(dynCall_iijiiiiiiiiii=Module["dynCall_iijiiiiiiiiii"]=Module["asm"]["dynCall_iijiiiiiiiiii"]).apply(null,arguments)};var dynCall_iijiiiiiiiiiiii=Module["dynCall_iijiiiiiiiiiiii"]=function(){return(dynCall_iijiiiiiiiiiiii=Module["dynCall_iijiiiiiiiiiiii"]=Module["asm"]["dynCall_iijiiiiiiiiiiii"]).apply(null,arguments)};var dynCall_iij=Module["dynCall_iij"]=function(){return(dynCall_iij=Module["dynCall_iij"]=Module["asm"]["dynCall_iij"]).apply(null,arguments)};var dynCall_iiijii=Module["dynCall_iiijii"]=function(){return(dynCall_iiijii=Module["dynCall_iiijii"]=Module["asm"]["dynCall_iiijii"]).apply(null,arguments)};var dynCall_iiiiiiiiij=Module["dynCall_iiiiiiiiij"]=function(){return(dynCall_iiiiiiiiij=Module["dynCall_iiiiiiiiij"]=Module["asm"]["dynCall_iiiiiiiiij"]).apply(null,arguments)};var dynCall_iiij=Module["dynCall_iiij"]=function(){return(dynCall_iiij=Module["dynCall_iiij"]=Module["asm"]["dynCall_iiij"]).apply(null,arguments)};var dynCall_iiiiiijiji=Module["dynCall_iiiiiijiji"]=function(){return(dynCall_iiiiiijiji=Module["dynCall_iiiiiijiji"]=Module["asm"]["dynCall_iiiiiijiji"]).apply(null,arguments)};var dynCall_iiiiiiiiiiiij=Module["dynCall_iiiiiiiiiiiij"]=function(){return(dynCall_iiiiiiiiiiiij=Module["dynCall_iiiiiiiiiiiij"]=Module["asm"]["dynCall_iiiiiiiiiiiij"]).apply(null,arguments)};var dynCall_viiiiiij=Module["dynCall_viiiiiij"]=function(){return(dynCall_viiiiiij=Module["dynCall_viiiiiij"]=Module["asm"]["dynCall_viiiiiij"]).apply(null,arguments)};var dynCall_viji=Module["dynCall_viji"]=function(){return(dynCall_viji=Module["dynCall_viji"]=Module["asm"]["dynCall_viji"]).apply(null,arguments)};var dynCall_iiiiiiji=Module["dynCall_iiiiiiji"]=function(){return(dynCall_iiiiiiji=Module["dynCall_iiiiiiji"]=Module["asm"]["dynCall_iiiiiiji"]).apply(null,arguments)};var dynCall_iiiiijiji=Module["dynCall_iiiiijiji"]=function(){return(dynCall_iiiiijiji=Module["dynCall_iiiiijiji"]=Module["asm"]["dynCall_iiiiijiji"]).apply(null,arguments)};var dynCall_iiiiiiiiiiij=Module["dynCall_iiiiiiiiiiij"]=function(){return(dynCall_iiiiiiiiiiij=Module["dynCall_iiiiiiiiiiij"]=Module["asm"]["dynCall_iiiiiiiiiiij"]).apply(null,arguments)};var dynCall_iiiiiiiij=Module["dynCall_iiiiiiiij"]=function(){return(dynCall_iiiiiiiij=Module["dynCall_iiiiiiiij"]=Module["asm"]["dynCall_iiiiiiiij"]).apply(null,arguments)};var dynCall_ji=Module["dynCall_ji"]=function(){return(dynCall_ji=Module["dynCall_ji"]=Module["asm"]["dynCall_ji"]).apply(null,arguments)};var dynCall_jiiiiii=Module["dynCall_jiiiiii"]=function(){return(dynCall_jiiiiii=Module["dynCall_jiiiiii"]=Module["asm"]["dynCall_jiiiiii"]).apply(null,arguments)};var dynCall_jiji=Module["dynCall_jiji"]=function(){return(dynCall_jiji=Module["dynCall_jiji"]=Module["asm"]["dynCall_jiji"]).apply(null,arguments)};var dynCall_viijii=Module["dynCall_viijii"]=function(){return(dynCall_viijii=Module["dynCall_viijii"]=Module["asm"]["dynCall_viijii"]).apply(null,arguments)};var dynCall_iiiiij=Module["dynCall_iiiiij"]=function(){return(dynCall_iiiiij=Module["dynCall_iiiiij"]=Module["asm"]["dynCall_iiiiij"]).apply(null,arguments)};var dynCall_iiiiijj=Module["dynCall_iiiiijj"]=function(){return(dynCall_iiiiijj=Module["dynCall_iiiiijj"]=Module["asm"]["dynCall_iiiiijj"]).apply(null,arguments)};var dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=function(){return(dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=Module["asm"]["dynCall_iiiiiijj"]).apply(null,arguments)};Module["cwrap"]=cwrap;var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(args){args=args||arguments_;if(runDependencies>0){return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run();