@vinay.kumar.ha/videosdk-ui-toolkit 2.3.5-1.5 → 2.3.5-1.7

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 (54) hide show
  1. package/dist/lib/annoter.min.js +3 -0
  2. package/dist/lib/audio.encode.wasm +0 -0
  3. package/dist/lib/audio.light.simd.wasm +0 -0
  4. package/dist/lib/audio.simd.wasm +0 -0
  5. package/dist/lib/audio_light_simd.min.js +2 -0
  6. package/dist/lib/audio_simd.min.js +2 -0
  7. package/dist/lib/graphics.min.js +2 -0
  8. package/dist/lib/js_audio_level_worklet_process.min.js +2 -0
  9. package/dist/lib/js_audio_level_worklet_process_light.min.js +2 -0
  10. package/dist/lib/js_audio_process.min.js +2 -0
  11. package/dist/lib/js_audio_processor_worklet.min.js +2 -0
  12. package/dist/lib/js_audio_worklet.min.js +2 -0
  13. package/dist/lib/js_audio_worklet_light_simd.min.js +2 -0
  14. package/dist/lib/js_audio_worklet_process.min.js +2 -0
  15. package/dist/lib/js_audio_worklet_simd.min.js +2 -0
  16. package/dist/lib/js_media.min.js +3 -0
  17. package/dist/lib/js_sharing_audio_worklet.min.js +2 -0
  18. package/dist/lib/manifest.json +338 -0
  19. package/dist/lib/mesh_thread.min.js +2 -0
  20. package/dist/lib/net.wasm +0 -0
  21. package/dist/lib/net_thread.min.js +2 -0
  22. package/dist/lib/pako.min.js +2 -0
  23. package/dist/lib/qrscanner.min.js +2 -0
  24. package/dist/lib/share_processor.min.js +2 -0
  25. package/dist/lib/sharing_m.min.js +3 -0
  26. package/dist/lib/sharing_mtsimd.min.js +3 -0
  27. package/dist/lib/sharing_s.min.js +2 -0
  28. package/dist/lib/sharing_simd.min.js +2 -0
  29. package/dist/lib/tp.min.js +2 -0
  30. package/dist/lib/tp.wasm +0 -0
  31. package/dist/lib/vb-resource/dualModel.bin +0 -0
  32. package/dist/lib/vb-resource/tf.min.js +18 -0
  33. package/dist/lib/vb.min.js +2 -0
  34. package/dist/lib/vb_worker.min.js +2 -0
  35. package/dist/lib/video.decode.js +1 -0
  36. package/dist/lib/video.decode.wasm +0 -0
  37. package/dist/lib/video.mt.js +1 -0
  38. package/dist/lib/video.mt.wasm +0 -0
  39. package/dist/lib/video.mtsimd.js +1 -0
  40. package/dist/lib/video.mtsimd.wasm +0 -0
  41. package/dist/lib/video.simd.js +1 -0
  42. package/dist/lib/video.simd.wasm +0 -0
  43. package/dist/lib/video_m.min.js +3 -0
  44. package/dist/lib/video_mtsimd.min.js +3 -0
  45. package/dist/lib/video_processor.min.js +2 -0
  46. package/dist/lib/video_s.min.js +2 -0
  47. package/dist/lib/video_share_mtsimd.min.js +3 -0
  48. package/dist/lib/video_simd.min.js +2 -0
  49. package/dist/lib/wasm_ssrc_stream_service_dynmod.min.js +2 -0
  50. package/dist/lib/webgpu_renderer_dynmod.min.js +2 -0
  51. package/dist/lib/wmsc.min.js +2 -0
  52. package/dist/videosdk-ui-toolkit.min.esm.js +1832 -1832
  53. package/dist/videosdk-ui-toolkit.min.umd.js +82 -82
  54. package/package.json +1 -1
@@ -0,0 +1,3 @@
1
+ /*! For license information please see js_media.min.js.LICENSE.txt */
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("disk-file-writer")):"function"==typeof define&&define.amd?define("JsMediaSDK_Instance",["disk-file-writer"],t):"object"==typeof exports?exports.JsMediaSDK_Instance=t(require("disk-file-writer")):e.JsMediaSDK_Instance=t(e["disk-file-writer"])}(self,(e=>(()=>{var t,i,r={8935:(e,t,i)=>{"use strict";function r(){return/\bCrOS\b/.test(navigator.userAgent)}function s(){var e,t;if(r())return!1;const i=((null==navigator?void 0:navigator.userAgent)||"").toLowerCase();if(/ipad|android(?!.*mobile)|tablet/i.test(i))return!0;const s=Math.min((null==(e=null==window?void 0:window.screen)?void 0:e.width)||0,(null==(t=null==window?void 0:window.screen)?void 0:t.height)||0),o="ontouchstart"in window||navigator.maxTouchPoints>0;return s>=600&&s<=1280&&o&&"orientation"in window}function o(){return!!(navigator.userAgent.match(/Android/i)||navigator.userAgent.match(/webOS/i)||navigator.userAgent.match(/iPhone/i)||/iPad/i.test(navigator.userAgent)||/Macintosh/i.test(navigator.userAgent)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>2||navigator.userAgent.match(/iPod/i)||navigator.userAgent.match(/BlackBerry/i)||navigator.userAgent.match(/Windows Phone/i))}i.d(t,{Cd:()=>Ye,D:()=>qe,D$:()=>ze,GN:()=>Be,GQ:()=>We,GY:()=>c,H8:()=>Ve,HR:()=>Ke,Pg:()=>s,Qf:()=>$e,R_:()=>m,U0:()=>Je,U4:()=>Ie,UP:()=>Oe,Xb:()=>o,Y9:()=>Ge,Z_:()=>He,Zs:()=>r,_J:()=>xe,bw:()=>l,cX:()=>p,gG:()=>Re,gi:()=>Ze,gm:()=>Le,hU:()=>Qe,j4:()=>et,j9:()=>it,lT:()=>ke,n_:()=>u,nr:()=>Ue,oI:()=>v,pb:()=>d,uF:()=>f,uw:()=>h,vb:()=>n,vk:()=>Fe,w_:()=>Xe,zG:()=>a,zQ:()=>tt,zX:()=>je});const a=()=>!!(navigator.maxTouchPoints&&navigator.maxTouchPoints>2)&&(/iPad/.test(navigator.platform)||/MacIntel/.test(navigator.platform)),n=()=>/MSFT Teams Android Room/i.test(navigator.userAgent),d=()=>{const e=null==window?void 0:window.meetingHost;return!!e&&"MSFT"===e.getHostState().vendorId&&!n()},c=()=>/GoogleMeetRoomDeviceWebViewApp/.test(navigator.userAgent),l=()=>/TESLA/.test(navigator.userAgent),h=()=>/(iPhone)/.test(navigator.userAgent),u=()=>/(iPad|iPhone)/g.test(navigator.userAgent),p=()=>navigator.platform.indexOf("Mac")>-1,f=()=>navigator.platform.indexOf("Win")>-1,m=async()=>{var e,t;if(-1!=navigator.userAgent.indexOf("WOW64"))return!0;if(null!=(e=null==navigator?void 0:navigator.userAgentData)&&e.getHighEntropyValues){const e=await(null==(t=null==navigator?void 0:navigator.userAgentData)?void 0:t.getHighEntropyValues(["wow64"]));return!(null==e||!e.wow64)}return!1},v=()=>/yealink/.test(navigator.userAgent.toLowerCase()),g=e=>"string"==typeof e,_=(e,t)=>{if(g(e))return e=C(/^\s\s*/,e),void 0===t?e:e.substring(0,500)},S=e=>g(e)?e.toLowerCase():e,A=(e,t)=>{if("object"==typeof e&&e.length>0){for(const i in e)if(S(e[i])==S(t))return!0;return!1}return!(!g(e)||!t)&&-1!==S(t).indexOf(S(e))},y=(e,t)=>{for(let i in t)if("object"==typeof t[i]&&t[i].length>0){for(let r=0;r<t[i].length;r++)if(A(t[i][r],e))return"?"===i?void 0:i}else if(A(t[i],e))return"?"===i?void 0:i;return"*"in t?t["*"]:e},C=(e,t)=>g(t)?t.replace(e,""):t,E=e=>g(e)&&C(/[^\d\.]/g,e).split(".")[0]||"",b=e=>g(e)&&C(/[^\d\.]/g,e).split(".")[1]||"",w=e=>/^\d/.test(String(e)),R=(e,t)=>{let i={};if(!e||!t)return{};let r,s,o,a,n,d,c=0;for(;c<t.length&&!n;){const l=t[c],h=t[c+1];for(r=0,s=0;r<l.length&&!n&&l[r];)if(n=l[r++].exec(e),n)for(i.matchRegex=String(l[r-1]),o=0;o<h.length;o++)d=n[++s],a=h[o],"object"==typeof a&&a.length>0?2===a.length?"function"==typeof a[1]?i[a[0]]=a[1](d):i[a[0]]=a[1]:3===a.length?"function"!=typeof a[1]||a[1].exec&&a[1].test?i[a[0]]=d?d.replace(a[1],a[2]):void 0:i[a[0]]=d?a[1](d,a[2]):void 0:4===a.length&&(i[a[0]]=d?a[3](d.replace(a[1],a[2])):void 0):i[a]=d||void 0;c+=2}return i||{}},T=e=>{const t=e.split(".");for(;t.length>1&&0===parseInt(t[t.length-1],10);)t.pop();return t.join(".")},I=e=>(e.name&&(e.name=e.name.replace(/chrome os/i,ve).replace(/macos/i,ge)),null!=e&&e.name&&be.includes(e.name.toLowerCase())&&(e.distributionName=e.name,e.name="Linux"),e),M="version",D="name",P="type",k="inapp",O="model",V="vendor",N="architecture",x="console",L="mobile",W="tablet",U="smarttv",B="wearable",F="xr",H="embedded",G="Amazon",j="Apple",K="ASUS",z="BlackBerry",q="Google",Y="Huawei",X="Lenovo",Q="Honor",J="LG",$="Microsoft",Z="Motorola",ee="Nvidia",te="OnePlus",ie="OPPO",re="Samsung",se="Sharp",oe="Sony",ae="Xiaomi",ne="Zebra",de="Chrome",ce="Chromecast",le="Firefox",he="Opera",ue="Facebook",pe="Sogou",fe="Mobile Safari",me=" Browser",ve="Chromium OS",ge="Mac OS",_e={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},Se=[[/\b(?:crmo|crios)\/([\w\.]+)/i],[M,[D,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[M,[D,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[D,M],[/opios[\/ ]+([\w\.]+)/i],[M,[D,he+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[M,[D,he+" GX"]],[/\bopr\/([\w\.]+)/i],[M,[D,he]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[M,[D,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[M,[D,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i,/(qwant(?:mobile|browser|app)?)\/([\d\.]+)/i],[D,M],[/quark(?:pc)?\/([-\w\.]+)/i],[M,[D,"Quark"]],[/\bddg\/([\w\.]+)/i],[M,[D,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[M,[D,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[M,[D,"WeChat"]],[/konqueror\/([\w\.]+)/i],[M,[D,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[M,[D,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[M,[D,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[M,[D,"Smart "+X+me]],[/(avast|avg)\/([\w\.]+)/i],[[D,/(.+)/,"$1 Secure"+me],M],[/\bfocus\/([\w\.]+)/i],[M,[D,le+" Focus"]],[/\bopt\/([\w\.]+)/i],[M,[D,he+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[M,[D,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[M,[D,"Dolphin"]],[/coast\/([\w\.]+)/i],[M,[D,he+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[M,[D,"MIUI"+me]],[/fxios\/([\w\.-]+)/i],[M,[D,""+le]],[/\bqihoobrowser\/?([\w\.]*)/i],[M,[D,"360"]],[/\b(qq)\/([\w\.]+)/i],[[D,/(.+)/,"$1Browser"],M],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[D,/(.+)/,"$1"+me],M],[/samsungbrowser\/([\w\.]+)/i],[M,[D,re+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[M,[D,pe+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[D,pe+" Mobile"],M],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[D,M],[/(lbbrowser|rekonq)/i],[D],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[M,D],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[D,ue],M,[P,k]],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(instagram|snapchat)[\/ ]([-\w\.]+)/i],[D,M,[P,k]],[/\bgsa\/([\w\.]+) .*safari\//i],[M,[D,"GSA"],[P,k]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[M,[D,"TikTok"],[P,k]],[/\[(linkedin)app\]/i],[D,[P,k]],[/(chromium)[\/ ]([-\w\.]+)/i],[D,M],[/headlesschrome(?:\/([\w\.]+)| )/i],[M,[D,de+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[D,de+" WebView"],M],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[M,[D,"Android"+me]],[/chrome\/([\w\.]+) mobile/i],[M,[D,"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[D,M],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[M,[D,fe]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[D,fe]],[/version\/([\w\.\,]+) .*(safari)/i],[M,D],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[D,[M,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[D,M],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[D,""+le],M],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[D,"Netscape"],M],[/(wolvic|librewolf)\/([\w\.]+)/i],[D,M],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[M,[D,le+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[D,[M,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[D,[M,/[^\d\.]+./,""]]],Ae=[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[O,[V,re],[P,W]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[O,[V,re],[P,L]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[O,[V,j],[P,L]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[O,[V,j],[P,W]],[/(macintosh);/i],[O,[V,j]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[O,[V,se],[P,L]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[O,[V,Q],[P,W]],[/honor([-\w ]+)[;\)]/i],[O,[V,Q],[P,L]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[O,[V,Y],[P,W]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[O,[V,Y],[P,L]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[O,/_/g," "],[V,ae],[P,W]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[O,/_/g," "],[V,ae],[P,L]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[O,[V,ie],[P,L]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[O,[V,y,{OnePlus:["304","403","203"],"*":ie}],[P,W]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[O,[V,"Vivo"],[P,L]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[O,[V,"Realme"],[P,L]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto(?! 360)[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[O,[V,Z],[P,L]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[O,[V,Z],[P,W]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[O,[V,J],[P,W]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv|watch)\w+)/i,/\blg-?([\d\w]+) bui/i],[O,[V,J],[P,L]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[O,[V,X],[P,W]],[/(nokia) (t[12][01])/i],[V,O,[P,W]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?(([-\w\.]*))/i],[[O,/_/g," "],[P,L],[V,"Nokia"]],[/(pixel (c|tablet))\b/i],[O,[V,q],[P,W]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[O,[V,q],[P,L]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[O,[V,oe],[P,L]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[O,"Xperia Tablet"],[V,oe],[P,W]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[O,[V,te],[P,L]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[O,[V,G],[P,W]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[O,/(.+)/g,"Fire Phone $1"],[V,G],[P,L]],[/(playbook);[-\w\),; ]+(rim)/i],[O,V,[P,W]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[O,[V,z],[P,L]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[O,[V,K],[P,W]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[O,[V,K],[P,L]],[/(nexus 9)/i],[O,[V,"HTC"],[P,W]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[V,[O,/_/g," "],[P,L]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[O,[V,"TCL"],[P,W]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[O,[V,"TCL"],[P,L]],[/(itel) ((\w+))/i],[[V,S],O,[P,y,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[O,[V,"Acer"],[P,W]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[O,[V,"Meizu"],[P,L]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[O,[V,"Ulefone"],[P,L]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[O,[V,"Energizer"],[P,L]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[O,[V,"Cat"],[P,L]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[O,[V,"Smartfren"],[P,L]],[/droid.+; (a(?:015|06[35]|142p?))/i],[O,[V,"Nothing"],[P,L]],[/(imo) (tab \w+)/i,/(infinix) (x1101b?)/i],[V,O,[P,W]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (hmd|imo) ([\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i,/(oppo) ?([\w ]+) bui/i],[V,O,[P,L]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[V,O,[P,W]],[/(surface duo)/i],[O,[V,$],[P,W]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[O,[V,"Fairphone"],[P,L]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[O,[V,ee],[P,W]],[/(sprint) (\w+)/i],[V,O,[P,L]],[/(kin\.[onetw]{3})/i],[[O,/\./g," "],[V,$],[P,L]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[O,[V,ne],[P,W]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[O,[V,ne],[P,L]],[/smart-tv.+(samsung)/i],[V,[P,U]],[/hbbtv.+maple;(\d+)/i],[[O,/^/,"SmartTV"],[V,re],[P,U]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[V,J],[P,U]],[/(apple) ?tv/i],[V,[O,j+" TV"],[P,U]],[/crkey.*devicetype\/chromecast/i],[[O,ce+" Third Generation"],[V,q],[P,U]],[/crkey.*devicetype\/([^/]*)/i],[[O,/^/,"Chromecast "],[V,q],[P,U]],[/fuchsia.*crkey/i],[[O,ce+" Nest Hub"],[V,q],[P,U]],[/crkey/i],[[O,ce],[V,q],[P,U]],[/droid.+aft(\w+)( bui|\))/i],[O,[V,G],[P,U]],[/(shield \w+ tv)/i],[O,[V,ee],[P,U]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[O,[V,se],[P,U]],[/(bravia[\w ]+)( bui|\))/i],[O,[V,oe],[P,U]],[/(mi(tv|box)-?\w+) bui/i],[O,[V,ae],[P,U]],[/Hbbtv.*(technisat) (.*);/i],[V,O,[P,U]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[V,_],[O,_],[P,U]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[O,[P,U]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[P,U]],[/(ouya)/i,/(nintendo) (\w+)/i],[V,O,[P,x]],[/droid.+; (shield)( bui|\))/i],[O,[V,ee],[P,x]],[/(playstation \w+)/i],[O,[V,oe],[P,x]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[O,[V,$],[P,x]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[O,[V,re],[P,B]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[V,O,[P,B]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[O,[V,ie],[P,B]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[O,[V,j],[P,B]],[/(opwwe\d{3})/i],[O,[V,te],[P,B]],[/(moto 360)/i],[O,[V,Z],[P,B]],[/(smartwatch 3)/i],[O,[V,oe],[P,B]],[/(g watch r)/i],[O,[V,J],[P,B]],[/droid.+; (wt63?0{2,3})\)/i],[O,[V,ne],[P,B]],[/droid.+; (glass) \d/i],[O,[V,q],[P,F]],[/(pico) (4|neo3(?: link|pro)?)/i],[V,O,[P,F]],[/; (quest( \d| pro)?)/i],[O,[V,ue],[P,F]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[V,[P,H]],[/(aeobc)\b/i],[O,[V,G],[P,H]],[/(homepod).+mac os/i],[O,[V,j],[P,H]],[/windows iot/i],[[P,H]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i],[O,[P,y,{mobile:"Mobile",xr:"VR","*":W}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[P,W]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[P,L]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[O,[V,"Generic"]]],ye=[[/microsoft (windows) (vista|xp)/i],[D,M],[/(windows (?:phone(?: os)?|mobile|iot))[\/ ]?([\d\.\w ]*)/i],[D,[M,y,_e]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[M,y,_e],[D,"Windows"]],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[M,/_/g,"."],[D,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[D,ge],[M,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[M,[D,ce+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[M,[D,ce+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[M,[D,ce+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[M,[D,ce+" Linux"]],[/crkey\/([\d\.]+)/i],[M,[D,ce]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[M,D],[/(ubuntu) ([\w\.]+) like android/i],[[D,/(.+)/,"$1 Touch"],M],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[D,M],[/\(bb(10);/i],[M,[D,z]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[M,[D,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[M,[D,le+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[M,[D,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[M,[D,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[D,ve],M],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[D,M],[/(sunos) ?([\w\.\d]*)/i],[[D,"Solaris"],M],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[D,M]],Ce=[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[N,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)\b/i],[[N,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[N,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[N,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[N,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[N,/ower/,"",S]],[/ sun4\w[;\)]/i],[[N,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[N,S]]],Ee=[[/windows.+ edge\/([\w\.]+)/i],[M,[D,"EdgeHTML"]],[/(arkweb)\/([\w\.]+)/i],[D,M],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[M,[D,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[D,M],[/ladybird\//i],[[D,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[M,D]],be=["ubuntu","kubuntu","xubuntu","lubuntu","nubuntu","debian","suse","opensuse","gentoo","arch","slackware","fedora","mandriva","centos","pclinuxos","red hat","zenwalk","linpus","raspbian","deepin","manjaro","elementary os","sabayon","linspire"],we=new class{constructor(){this.ua=navigator.userAgent}removeMatchRegex(e){if(!e.matchRegex)return e;const{matchRegex:t,...i}=e;return i}getDefaultResult(e){const t=(e=>{const t=R(e,Se);return null!=t&&t.version&&(t.major=E(String(t.version))||"",t.minor=b(String(t.version))||""),t})(e||this.ua),i=(a=e||this.ua,R(a,Ee)),r=(e=>{var t,i;const r=R(e,Ae);return!r.type&&null!=navigator&&navigator.userAgentData&&null!=(t=null==navigator?void 0:navigator.userAgentData)&&t.mobile&&(r.type=null==(i=null==navigator?void 0:navigator.userAgentData)?void 0:i.mobile),"Macintosh"==r.model&&navigator&&void 0!==(null==navigator?void 0:navigator.standalone)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&(r.model="iPad",r.type="tablet"),r})(e||this.ua),s=(e=>{var t,i;const r=R(e,ye);return!r.name&&null!=navigator&&navigator.userAgentData&&null!=(t=null==navigator?void 0:navigator.userAgentData)&&t.platform&&(r.name=null==(i=null==navigator?void 0:navigator.userAgentData)?void 0:i.platform),null!=r&&r.version&&w(null==r?void 0:r.version)&&(r.major=E(String(r.version))||"",r.minor=b(String(r.version))||""),I(r)})(e||this.ua),o=(e=>{const t=R(e,Ce);return t.architecture||(t.architecture=""),t})(e||this.ua);var a;return{ua:e||this.ua,browser:this.removeMatchRegex(t),device:this.removeMatchRegex(r),os:this.removeMatchRegex(s),cpu:this.removeMatchRegex(o),engine:this.removeMatchRegex(i)}}async getResult(e){const t=this.getDefaultResult(e);if(e||!this.isSupportUserAgentData())return t;let i={};try{i=await this.getHighEntropyValues()}catch(e){return{...t,error:e}}const r=this.handleBrowser(i,t.browser),s=this.handleDevice(i,t.device),o=this.handleOs(i,t.os),a=this.handleCpu(i,t.cpu),n=this.handleEngine(i,t.engine);return{ua:this.ua,browser:this.removeMatchRegex(r),device:this.removeMatchRegex(s),os:this.removeMatchRegex(o),cpu:this.removeMatchRegex(a),engine:this.removeMatchRegex(n),originHighEntropyValues:i}}isSupportUserAgentData(){return"object"==typeof navigator&&"userAgentData"in navigator}async getHighEntropyValues(){return this.isSupportUserAgentData()?await navigator.userAgentData.getHighEntropyValues(["brands","fullVersionList","mobile","model","platform","platformVersion","architecture","formFactors","bitness"]):{}}handleBrowser(e,t){let i=t||{};const r=e.fullVersionList||e.brands||void 0;let s="";if(r)for(let e in r){const t=r[e].brand;let o=r[e].version;if(!/not.a.brand/i.test(t)&&(!s||/chrom/i.test(s)&&"Chromium"!=t)){const e=y(t,{Chrome:"Google Chrome",Edge:"Microsoft Edge","Chrome WebView":"Android WebView","Chrome Headless":"HeadlessChrome"});s=e,i={name:e,version:o,major:o?E(o):"",minor:o?b(o):""}}}return i}handleEngine(e,t){let i=t||{};const r=e.fullVersionList||e.brands;if(r)for(let e in r){let t=r[e].brand,s=r[e].version;"Chromium"===t&&(i.version=s)}return i}handleDevice(e,t){const i=t||{};if(e.mobile&&(i.type="mobile"),e.model&&(i.model=e.model,!i.type||!i.vendor)){let t=R("droid 9; "+e.model+")",Ae);!i.type&&t.type&&(i.type=t.type),!i.vendor&&t.vendor&&(i.vendor=t.vendor)}"Macintosh"==i.model&&navigator&&void 0!==(null==navigator?void 0:navigator.standalone)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&(i.model="iPad",i.type="tablet");const r={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0};if(e.formFactors){let t;if("string"!=typeof e.formFactors)for(var s=0;!t&&s<e.formFactors.length;)t=y(e.formFactors[s++],r);else t=y(e.formFactors,r);t&&(i.type=t)}return i}handleOs(e,t){var i,r;const s=t||{};!s.name&&navigator.userAgentData&&null!=(i=navigator.userAgentData)&&i.platform&&(s.name=null==(r=navigator.userAgentData)?void 0:r.platform);const o=null==e?void 0:e.platform;if(o){let t=e.platformVersion;if(o.includes("win")&&t){const e=parseInt(E(t),10)||0;t=e>=13?"11":e>0?"10":"7"}s.name=o,s.version=t,t&&w(t)?(s.major=E(t)||"",s.minor=b(t)||""):(s.major="",s.minor="")}return I(s)}handleCpu(e,t){let i=t||{},r=e.architecture;return r&&(r&&"64"==e.bitness&&(r+="64"),i=R(r+";",Ce)),i}};let Re=we.getDefaultResult(),Te=!1;const Ie=async()=>{if(Te)return Re;try{if(we.isSupportUserAgentData()){const e=await we.getResult();Re=Object.assign({},e),Te=!0}}catch(e){return Te=!1,Promise.reject(e)}return Re},Me=()=>(null==Re?void 0:Re.os)||{},De=()=>{var e;return(null==(e=null==Re?void 0:Re.browser)?void 0:e.name)||""},Pe=()=>{var e;return(null==(e=null==Re?void 0:Re.os)?void 0:e.name)||""},ke=()=>{const e=De();return["IE","IEMobile"].includes(e)},Oe=()=>"Edge"===De(),Ve=()=>{const e=De();return["Chrome","Chrome Headless","Chrome WebView"].includes(e)},Ne=()=>"Chromium"===De(),xe=()=>Ve()||Ne(),Le=()=>{const e=De();return["Firefox","Firefox Focus","Firefox Reality","Iceweasel"].includes(e)},We=()=>{const e=De();return["Opera","Opera Coast","Opera GX","Opera Mini","Opera Mobi","Opera Tablet","Opera Touch"].includes(e)},Ue=()=>{var e;return null==(e=De().toLocaleLowerCase())?void 0:e.includes("safari")},Be=()=>{var e;const t=Pe();return/android/i.test(navigator.userAgent)||(null==(e=t.toLocaleLowerCase())?void 0:e.includes("android"))},Fe=()=>"webos"===Pe().toLowerCase(),He=()=>"Oculus Browser"===De(),Ge=()=>Ve()&&/windows/i.test(navigator.userAgent),je=()=>"OpenHarmony"===Pe(),Ke=()=>"HarmonyOS"===Pe()||je(),ze=(e,t)=>{if(e=(null==e?void 0:e.toString())||"",t=(null==t?void 0:t.toString())||"",!e&&t)return!1;if(e&&!t||e===t)return!0;const i=T(e),r=T(t),s=i.split("."),o=r.split("."),a=s.length,n=o.length,d=Math.min(n,a);for(let e=0;e<d;e++){const t=parseInt(s[e],10),i=parseInt(o[e],10);if(t!==i)return t>i}return a>=n},qe=(e,t="")=>{if(!t){const{version:e}=(null==Re?void 0:Re.browser)||{};t=e||""}return ze(t||"",e)},Ye=()=>{const{major:e}=Me();return e?parseInt(e,10):0},Xe=()=>{const{minor:e}=Me();return e?parseInt(e,10):0},Qe=(()=>{let e={vendor:"",renderInfo:"",isAstcSupported:!1,isWebGLContextInvalid:!0};const t={noCanvas:"",noContext:"",contextLost:"",noVendor:"",catchError:""};try{const i=document.createElement("canvas");if(!i)return t.noCanvas="Error: document.createElement return a null canvas!",{attrs:e,errorMsg:t};let r=i.getContext("webgl")||i.getContext("moz-webgl")||i.getContext("webkit-3d")||i.getContext("experimental-webgl");if(!r)return t.noContext=`Error: canvas.getContext fail, context:${r}, size:(${i.width},${i.height})`,{attrs:e,errorMsg:t};if(r){let s,o,a;e.isWebGLContextInvalid=!1,null!=r&&r.isContextLost()&&(t.contextLost=`Error: webgl context is lost, canvas(${i.width},${i.height})!`),Le()?(s=r.getParameter(r.RENDERER),o=r.getParameter(r.VENDOR)):(a=r.getExtension("WEBGL_debug_renderer_info"),s=r.getParameter(a.UNMASKED_RENDERER_WEBGL),o=r.getParameter(a.UNMASKED_VENDOR_WEBGL)),e.renderInfo=null==s?void 0:s.toLowerCase(),e.vendor=null==o?void 0:o.toLowerCase(),e.isAstcSupported=-1!==r.getSupportedExtensions().indexOf("WEBGL_compressed_texture_astc"),""==o&&(t.noVendor=`Error: vendor is null, debug:${a}, render:${a.UNMASKED_RENDERER_WEBGL}, vendor:${a.UNMASKED_VENDOR_WEBGL}, contextLost:${r.isContextLost()}!`)}}catch(e){t.catchError=e}return{attrs:e,errorMsg:t}})(),Je=()=>"Mac OS"===Pe()&&!a(),$e=()=>{try{return!(!Ue()||navigator.maxTouchPoints&&!(navigator.maxTouchPoints<=2)||Qe.attrs.isAstcSupported||!p())}catch{return!1}},Ze=()=>{var e;try{return!!((Ve()||Ne())&&(!navigator.maxTouchPoints||navigator.maxTouchPoints<=2)&&(null==(e=Qe.attrs.vendor)?void 0:e.indexOf("intel"))>-1&&p())}catch{return!1}},et=()=>$e()||Ze(),tt=()=>{const e=p()||Je();return Ue()&&e},it=()=>{var e;return(null==(e=null==navigator?void 0:navigator.platform)?void 0:e.indexOf("Linux"))>-1&&!r()&&!Be()}},1241:(e,t,i)=>{"use strict";i.d(t,{_:()=>r});const r=!1},3750:(e,t,i)=>{"use strict";i.d(t,{p:()=>n,E:()=>d});var r=i(2754),s=i(9415);class o{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this._unusedIds=[],this._nextId=e}generateNextId(){let e;return this._unusedIds.length>0?e=this._unusedIds.shift():(e=this._nextId,this._nextId+=1),e}release(e){this._unusedIds.push(e)}}class a{constructor(e){this._onmessage=null,this._messager=e}set onmessage(e){var t,i;null!==this._onmessage&&this._messager.removeEventListener("message",this._onmessage),this._messager.addEventListener("message",e),null===this._onmessage&&(null===(i=(t=this._messager).start)||void 0===i||i.call(t)),this._onmessage=e}postMessage(e,t){this._messager.postMessage(e,t)}close(){var e,t;null!==this._onmessage&&(this._messager.removeEventListener("message",this._onmessage),this._onmessage=null),null===(t=(e=this._messager).close)||void 0===t||t.call(e)}}class n{constructor(){this._connection=null}set connection(e){this._connection=e}get connection(){return(0,r.vA)(null!==this._connection),this._connection}}class d{constructor(e,t,i,r){this._idGenerator=new o(2),this._invokeHandlers={},this._invokeResults=new Set,this._resolveInvokeResultsSended=null,this._responseHandlers=new Map,this._notifyHandlers={},this._transferObjs=[],this._closed=!1,this._onClose=null,this._messager=new a(e),this._messager.onmessage=this._handleMessage.bind(this),this._logErrorFn=r,t&&(this.localPeerObject=t),i&&(this._proxyFuncs=i);const s=new Promise((e=>{this._resolveCloseSent=e})),n=new Promise((e=>{this._resolveCloseReceived=e}));Promise.all([s,n]).then((()=>{this._messager.close(),this._messager=null}))}set localPeerObject(e){let t;if(this._invokeHandlers={},e instanceof n){const i=Object.getPrototypeOf(e);t=Object.getOwnPropertyNames(i)}else t=Object.getOwnPropertyNames(e);const i=t.filter((t=>"function"==typeof e[t]&&"constructor"!==t&&!t.startsWith("_")));for(const t of i)this.expose(t,(function(){return e[t](...arguments)}));this._localPeerObject=e,e instanceof n&&(e.connection=this)}get localPeerObject(){return this._localPeerObject}get remotePeerProxy(){var e=this;if(this._remotePeerProxy)return this._remotePeerProxy;const t=new Map;return this._remotePeerProxy=new Proxy({},{get:(i,r,s)=>{var o;let a=null===(o=this._proxyFuncs)||void 0===o?void 0:o[r];return a||(a=t.get(r),a||(a=function(){for(var t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];return e.invoke(r,...i)},t.set(r,a),a))}}),this._remotePeerProxy}_logError(e,t){this._logErrorFn?this._logErrorFn(e,t):(0,s.B)().tracing.Log_Error(e,t)}transfer(e){return this._transferObjs.push(e),e}expose(e,t){this._invokeHandlers[e]=t}on(e,t){this._notifyHandlers[e]=t}notify(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];this._postRequest(1,e,i)}invoke(e){const t=this._idGenerator.generateNextId(),i=new Promise(((e,i)=>{this._responseHandlers.set(t,{resolve:e,reject:i})}));for(var r=arguments.length,s=new Array(r>1?r-1:0),o=1;o<r;o++)s[o-1]=arguments[o];return this._postRequest(t,e,s),i}_postRequest(e,t,i){if(this._closed)throw new Error("Can not postRequest after closed!!");try{this._messager.postMessage({id:e,name:t,args:i},this._transferObjs)}catch(e){(0,s.B)().tracing.Log_Error("[rpc] Error in postRequest",e)}this._transferObjs=[]}_postReponse(e,t){if(this._closed)throw new Error("Can not postReponse after closed!!");this._messager.postMessage({id:0,resId:e,response:t},this._transferObjs),this._transferObjs=[]}_serializeError(e){return e instanceof Error?{message:e.message,name:e.name,stack:e.stack}:e}_handleMessage(e){const t=e.data;if("id"in t)try{if(t.id<0)-1===t.id?(this._closePeerIfNeeded(t.reason),this._resolveCloseReceived()):(0,r.Yu)();else{if(0===t.id){const e=this._responseHandlers.get(t.resId);if(!e)return void this._logError("DualRPC.handleMessage: ".concat(t.resId," not found!"));const i=t.response;return"ret"in i?e.resolve(i.ret):"err"in i?(e.reject(i.err),this._logError("DualRPC.handleMessage err: ".concat(i.err))):(0,r.Yu)("Invalid Response"),this._responseHandlers.delete(t.resId),void this._idGenerator.release(t.resId)}if(1===t.id){try{const e=this._notifyHandlers[t.name];e&&e(...t.args)}catch(e){}return}{if((0,r.vA)(t.id>1),!(t.name in this._invokeHandlers))return void this._logError("DualRPC.handleMessage: ".concat(t.name," not registered!"));let e,i;try{const i=this._invokeHandlers[t.name];e=i(...t.args)}catch(e){i=e}if(i)return void this._postReponse(t.id,{err:this._serializeError(i)});if(!(e instanceof Promise)){try{this._postReponse(t.id,{ret:e})}catch(e){this._postReponse(t.id,{err:this._serializeError(e)})}return}this._invokeResults.add(e),e.then((e=>{this._postReponse(t.id,{ret:e})})).catch((e=>{this._postReponse(t.id,{err:this._serializeError(e)})})).finally((()=>{this._invokeResults.delete(e),this._resolveInvokeResultsSended&&0===this._invokeResults.size&&this._resolveInvokeResultsSended()}))}}}catch(e){this._logError("DualRPC.handleMessage err!!",e)}}_closePeerIfNeeded(e){this._closed||(this._closed=!0,this._onClose&&this._onClose(e),0===this._invokeResults.size?(this._messager.postMessage({id:-1,reason:e},[]),setTimeout((()=>{this._resolveCloseSent()}),10)):new Promise((e=>{this._resolveInvokeResultsSended=e})).then((()=>{this._messager.postMessage({id:-1,reason:e},[])})).then((()=>{setTimeout((()=>{this._resolveCloseSent()}),10)})))}close(e){this._closePeerIfNeeded(e)}set onClose(e){this._onClose=e}}},2484:(e,t,i)=>{"use strict";i.d(t,{n:()=>r});const r={AUDIO_BRIDGE_1:{index:1,default:15},AUDIO_BRIDGE_2:{index:2,default:1},HW_ENCODER_FOR_360P:{index:3,default:0,candidates:{ALL_PLATFORM:1}},WEBGL_CONTEXT_LOST_OPT:{index:4,default:0},RECEIVE_720P_ON_SAFARI:{index:5,default:0},MULTI_VIEW_ON_MOBILE:{index:8,default:0},CHROMEOS_AEC:{index:10,default:1},AUDIO_DENOISE:{index:11,default:1,candidates:{NO_CONFIG:0,SHOW_IN_PROFILE:1,DEFAULT_VALUE_GREATER_THAN_4_CORES:2,IOS:4,ANDROID:8}},VB_ON_FIREFOX:{index:12,default:0},ENABLE_DECODE_720P_ON_IOS:{index:15,default:1},UNIFIED_RENDER:{index:20,default:0},WEBGPU_RENDERER:{index:21,default:0},ORIGINAL_SOUND:{index:22,default:0},SEND_1080P_VIDEO:{index:24,default:0},SEND_1080P_VIDEO_SHARE:{index:25,default:0},VB_ON_SAFARI_17:{index:27,default:0},WEBGL2_RENDERER:{index:29,default:1},AUDIO_ECHO_DETECT:{index:31,default:0},UNIFIED_RENDER_ON_MOBILE:{index:34,default:0},WEBCODEC_DECODE_OPTION:{index:36,default:0},HW_WEBCODEC_ON_SAFARI:{index:37,default:1},HW_DECODE_FOR_360P:{index:38,default:0},WEBCODEC_ON_ANDROID_CHROME:{index:39,default:0},WEBCODEC_ENCODE_OPT_1ON1:{index:41,default:0},CAP_WEBCODEC_SUPPORT:{index:42,default:0},WEBRTC_STG:{index:43,default:0},WEBGL_CANVAS_OPTION_OPT:{index:44,default:1},DEFAULT_RENDERER:{index:45,default:3},WEB_TRANSPORT_CONTROL:{index:46,default:0},ENABLE_TP_RLB_WEBSOCKET:{index:47,default:0},ENABLE_TRANSFERABLE_RTC_DATACHANNEL:{index:48,default:1},ENABLE_WEBRTC_FEATURE:{index:49,default:0},WEBRTC_SMART_AUTO_STG_1:{index:50,default:0,candidates:{NO_CONFIG:0,MOB_ANDROID:1,MOB_IOS:2,DESKTOP:4,SAB_OFF_NO_OFFSCREENCANVAS_NO_GPU:8}},WEBRTC_SMART_AUTO_STG_2:{index:51,default:0,candidates:{NO_CONFIG:0,AUDIO_ON_BROWSER_32BIT:1,VIDEO_ON_BROWSER_32BIT:2,DESKTOP_LOW_PERF_DEVICE:4}},ENABLE_WEBRTC_TURN_SERVERS:{index:52,default:0},EXTRA_DEVICE_INTERVAL_ENUMERATE:{index:53,default:0,candidates:{DISABLE:0,ENABLE:1}},ENABLE_MEDIA_PROCESSOR:{index:54,default:0,candidates:{NONE:0,VIDEO_PROCESSOR:1,AUDIO_PROCESSOR:2,SHARE_PROCESSOR:4}},MOBILE_FORCE_AUTO_CHOOSE_AUDIO_DEVICE:{index:55,default:0,candidates:{DISABLE:0,IOS:1,ANDROID:2,ANDROID_EARPIECE:4}},WEBRTC_SMART_AUTO_STG_3:{index:57,default:0,candidates:{NO_CONFIG:0,WEBCODEC_NOT_SUPPORT:1}},WEBRTC_SMART_AUTO_STG_4:{index:58,default:0,candidates:{NO_CONFIG:0}},WASM_MOBILE_30FPS:{index:59,default:0},SUPPORT_ANNOTATION:{index:64,default:0,candidates:{VIEWER:1,PRESENTER:2}},ANDROID_WEBCODEC_CAP:{index:65,default:2,candidates:{DISABLE_ENCODER:1,DISABLE_DECODER:2}},HW_ENC_ENABLE_L1T1:{index:66,default:0,candidates:{DISABLE:0,ANDROID:1,CHROMEOS:2,HARMONY:4,ALL:8}},ENABLE_MESH:{index:67,default:0,candidates:{WEBNIAR:2,WITHSTUN:3,ALLOWTALK_ENABLE:64,WEBRTCAUDIO_MESH:128}},MESH_NODE:{index:68,default:11},SUPPORT_AV_SIMULTANEOUS_FALLBACK:{index:70,default:0,candidates:{DISABLE:0,ENABLE:1}},ENABLE_FALLBACK_WEBRTC_AUDIO_STG:{index:69,default:0,candidates:{DISABLE:0,ENABLE:1}},ENABLE_CLONE_AUDIO_STREAM:{index:71,default:0,candidates:{DISABLE:0,ENABLE:1}},ENABLE_TRANSFERABLE_MEDIA_STREAM_TRACK:{index:72,default:0,candidates:{DISABLE:0,ENABLE:1}},MULTISHARE_HIGH_FPS:{index:73,default:1},MULTISHARE_LOW_FPS:{index:74,default:0},ENABLE_SUBSCRIBE_VIDEO_NUMBER_CONTROL:{index:75,default:1,candidates:{DISABLE:0,ENABLE:1}},ENABLE_ADVANCED_FEATURE_ON_LOW_END:{index:76,default:0,candidates:{HW_WEBCODEC_ENCODE_360p:1}},ENABLE_FALLBACK_TO_TAG_RENDERER:{index:77,default:0,candidates:{NO_CONFIG:0,FALLBACK_TO_TAG_RENDERER_ON_CHROME:1,FALLBACK_TO_TAG_RENDERER_ON_SAFARI:2,FALLBACK_TO_TAG_RENDERER_ON_FIREFOX:4,LOWER_PERFORMANCE_DEVICE:8}},ENABLE_WASM_TAG_RENDERER:{index:78,default:0,candidates:{NO_CONFIG:0,TAG_RENDERER_ON_CHROME:1,TAG_RENDERER_ON_SAFARI:2,TAG_RENDERER_ON_FIREFOX:4}},IGNORE_WEBCODEC_WHITELIST:{index:79,default:0,candidates:{USE:0,IGNORE:1}},ENABLE_HW_ENC_RETRY:{index:80,default:0,candidates:{DISABLE:0,ENABLE:1}},ENABLE_FETCH_WITH_CACHE:{index:81,default:1,candidates:{DISABLE:0,ENABLE:1}},ENABLE_SUBSCRIBE_VIDEO_FullHD_CONTROL:{index:82,default:0,candidates:{DISABLE:0,ENABLE:1}},ENABLE_WEBRTC_AV_2_ON_FIREFOX:{index:83,default:0,candidates:{DISABLE:0,ENABLE_AUDIO:1,ENABLE_VIDEO:2}},ENABLE_WEBRTC_AUDIO_2_0:{index:85,default:0,candidates:{DISABLE:0,ENABLE:1}},ENABLE_WEBRTC_AUDIO_ON_SPECIAL_DEVICE:{index:86,default:0,candidates:{NO_SAB:1,LESS_TEST_BROWSER_FORCE_USE_WEBRTC:2}}}},5830:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});var r=i(385);const s=class{static read(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!e)return r.Ay.error("[ABOptionsReader] error in read(): options(".concat(e,") is invalid, ").concat(t,", ").concat(i,", ").concat(s)),s;const o=e.length;if(t<0||i<=0||t>o||t+i-1>o)return r.Ay.warn("[ABOptionsReader] error in read(): invalid parameters! opLen=".concat(o,", bitIndex=").concat(t,", readCount=").concat(i)),s;const a=o-t-i+1,n=o-t+1;try{const t=e.slice(a,n),i=parseInt(t,16);return isNaN(i)?s:i}catch(e){r.Ay.error("[ABOptionsReader] error in read()",e)}return s}static batchRead(e,t){const i=new Map;for(let r=0;r<t.length;r++){const{bitIndex:s,readCount:o=1,defaultVal:a=0}=t[r],n=this.read(e,s,o,a);i.set(s,n)}return i}}},3656:(e,t,i)=>{"use strict";i.d(t,{Lg:()=>d,Xe:()=>v,_G:()=>m,iG:()=>a,iK:()=>g,pg:()=>n,tu:()=>h});var r=i(7201),s=i.n(r),o=i(385);function a(e){this.name="CameraOccupiedError",this.message=e,this.stack=(new Error).stack}a.prototype=new Error;const n={EXCEPTION:-1,PERMISSION_RESET:-2,LOST_ACCESS:-3},d={INTERNAL_ERROR:-1,BROWSER_ERROR:1,UNSUPPORTED_BROWSER:2,UNSUPPORTED_THRESHOLD:3,PARAMATER_INVALID:4,INVALID_STATE:5,NOT_READY:6,MISSING_REQUIRED_PARAM:7,TIMEOUT:8,ALREADY_IN_PROGRESS:9,FREQUENCY_LIMITED:10},c=5e3,l=new Map;function h(){l.clear()}function u(e){var t;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"|";return e?s()(t=e.toString()).call(t,/[,,]/g,i):""}let p=null,f=null;function m(e){p=e}function v(e){f=e}function g(e,t){if(!function(e){const t=performance.now();return(!l.has(e)||t-l.get(e)>c)&&(l.set(e,t),!0)}(e))return;let i;try{i=u("object"==typeof t?JSON.stringify(t):t)}catch(e){i=u(t)}null==f||f("NEM-".concat(e,"-").concat(i)),o.Ay.error("NotifyUIError,event=".concat(e,",data=").concat(i)),null==p||p(e,t)}},6487:(e,t,i)=>{"use strict";i.d(t,{A:()=>f});var r=i(385),s=i(3647),o=i(9559),a=i(1265),n=i.n(a);function d(e){return e.split(".").map((e=>parseInt(e,10)||0))}function c(e,t){const i=d(e),r=d(t),s=Math.min(i.length,r.length);for(let e=0;e<s;e++){if(i[e]>r[e])return 1;if(i[e]<r[e])return-1}return 0}function l(e){const t=(e=n()(e).call(e)).match(/^([\[\(])\s*([^,]*)\s*,\s*([^\]\)]*)\s*([\]\)])$/);if(t){const[,e,i,r,s]=t;return{type:"range",startInclusive:"["===e,endInclusive:"]"===s,startVersion:i||null,endVersion:r||null}}const i=e.match(/^(!=|>=|<=|=|>|<)\s*(.+)$/);if(i){const[,e,t]=i;return{type:"compare",op:e,version:n()(t).call(t)}}return{type:"compare",op:"=",version:e}}function h(e,t,i){const r=c(e.version,t);switch(e.op){case"=":return 0===r;case"!=":return 0!==r;case">":return r<0;case">=":return r<=0;case"<":return r>0;case"<=":return r>=0;default:return!1}}function u(e,t,i){const{latestVersion:r="^"}=i,s=e.startVersion,o="^"===e.endVersion?r:e.endVersion,a=s?c(t,s):1,n=o?c(t,o):-1,d=!s||e.startInclusive?a>=0:a>0,l=!o||e.endInclusive?n<=0:n<0;return d&&l}function p(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e||""===e||!t||""===t)return!0;if(/^[\[\(].*[\]\)]$/.test(n()(e).call(e))){const r=l(e);return"range"===r.type&&u(r,t,i)}const r=e.split(",").map((e=>n()(e).call(e))).filter(Boolean);for(const e of r){const r=l(e);if("compare"===r.type?h(r,t):u(r,t,i))return!0}return!1}const f={isOnWebCodecWhitelist(e,t,i,s,o,a,n){if(""===e||void 0===e||void 0===t||""===t||!o)return!1;if(!s){const r=e.includes("arm"),s=t.includes("intel"),o=t.includes("amd"),a=t.includes("nvidia");return"encoder"===i?!r&&!!(s||o||a):!("decoder"!==i||r||!o&&(s?this.isInRangeOfGenerations("intel",t,1e3,4e3):a&&this.isLowerThanMinGeneration("nvidia",t,"600")))}for(let d=0;d<s.length;d++){const c=s[d],l="vendor"in c,h="model"in c,u="renderInfo"in c,f="blacklist"in c,m="mediaVersion"in c;let v="";l&&""!==c.vendor&&(v=c.vendor.toLowerCase());let g="";h&&""!==c.model&&(g=c.model.toLowerCase());let _="";u&&""!==c.renderInfo&&(_=c.renderInfo.toLowerCase());let S=null;f&&c.blacklist.length>0&&(S=c.blacklist);let A="";if(m&&""!==c.mediaVersion&&(A=c.mediaVersion.toLowerCase()),a){if(l&&""!==v&&e.includes(v)&&S&&this.isHitBlacklist(e,t,i,g,S,o,n))return!1}else{if(m&&""!==A&&!p(A,n))continue;if(l){if(""!==v&&e.includes(v))return""===g&&""===_&&!S||(!!(t===_||""!==_&&t.includes(_))||(""!==g&&t.includes(g)||""===g)&&(!S||!this.isHitBlacklist(e,t,i,g,S,o,n)))}else r.Ay.error("isOnWebCodecWhitelist() no vendor field in the json entry! entry:".concat(c))}}return!!a},isGPUProfileOnWebCodecWhitelist(e,t,i,s,o,a){if(!this.isOffscreenCanvasSupported())return r.Ay.log("isGPUProfileOnWebCodecWhitelist() OffscreenCanvas is not supported."),!1;try{const n=i.vendor,d=i.renderInfo,c=this.isOnWebCodecWhitelist(n,d,e,t,s,o,a);return c||r.Ay.directReport("isGPUProfileOnWebCodecWhitelist() isOnWhitelist:".concat(c,", vendor:").concat(n,", renderInfo:").concat(d,", codecType:").concat(e,", config:").concat(JSON.stringify(t),", ignoreWebCodecWhitelist:").concat(o,", pkgVersion:").concat(a)),c}catch(e){return!1}},readWebRTCVideoCodecConfig(e,t,i){var s,a,n,d;if(!e)return null;let c=(null===(s=null==t?void 0:t.browser)||void 0===s?void 0:s.name)||"",l=(null===(a=null==t?void 0:t.browser)||void 0===a?void 0:a.version)||"",h=o.Ay.getGpuInfo();const u={os:null==t?void 0:t.os.toLowerCase(),browserName:c.toLowerCase(),browserVersion:l.toLowerCase(),engineName:null===(n=null==t?void 0:t.engine)||void 0===n?void 0:n.name.toLowerCase(),engineVersion:null===(d=null==t?void 0:t.engine)||void 0===d?void 0:d.version.toLowerCase(),vendor:h.vendor.toLowerCase(),renderInfo:h.renderInfo.toLowerCase(),isAstcSupported:h.isAstcSupported};let f=null;for(const t of e){const s="mediaVersion"in t;let o="";if(s&&""!==t.mediaVersion&&(o=t.mediaVersion.toLowerCase()),s&&""!==o&&!p(o,i))continue;let a=!1;if(t.os&&""!==t.os&&!u.os.includes(t.os.toLowerCase()))continue;let n=!1,d=!1;if(t.browser&&t.browser.name&&""!==t.browser.name){if(!u.browserName.includes(t.browser.name.toLowerCase()))continue;if(u.browserName.includes("safari")?n=!0:u.browserName.includes("samsung internet")&&(d=!0),t.browser.versions&&t.browser.versions.length>0&&!t.browser.versions.some((e=>this.isBrowserVersionHitBlacklist(u.browserVersion,e,d,u.engineVersion))))continue}if((!t.vendor||""===t.vendor||u.vendor.includes(t.vendor.toLowerCase())||a&&n&&"intel"===t.vendor.toLowerCase()&&!u.isAstcSupported)&&(!t.renderInfo||""===t.renderInfo||u.renderInfo.includes(t.renderInfo.toLowerCase()))){try{if(t.config){let e=!1;"true"===t.config.preferSoftwareEncoder&&(e=!0);let i=!1;if("true"===t.config.preferSoftwareDecoder&&(i=!0),f={preferSoftwareCodec:{send:e,recv:i}},t.config.maxEncodingLayers){let e=parseInt(t.config.maxEncodingLayers);f.maxEncodingLayers=e}}}catch(t){r.Ay.error("readWebRTCVideoCodecConfig() videoCodecConfig:".concat(e),t)}if(f)break}}return f},evalWebRTCStrategy(e,t,i,o,a){var n,d,c,l,h,u,f,m;let v={stg:s.BH.DISABLED,errNo:s.Qb.UNKNOWN,errMsg:""};if(!i)return v.stg=s.BH.DISABLED,v.errNo=s.Qb.BROWSER_NOT_SPT,v.errMsg="webrtc is disabled(not supported by browser).",v;if(o===s.BH.DISABLED)return v.stg=s.BH.DISABLED,v.errNo=s.Qb.SUCCEED,v;if(!e||0==e.length)return v.stg=o,v.errNo=s.Qb.SUCCEED,v;const g={os:null===(n=t.os)||void 0===n?void 0:n.toLowerCase(),browserName:null===(d=t.browserName)||void 0===d?void 0:d.toLowerCase(),browserVersion:null===(c=t.browserVersion)||void 0===c?void 0:c.toLowerCase(),engineName:null===(l=t.engineName)||void 0===l?void 0:l.toLowerCase(),engineVersion:null===(h=t.engineVersion)||void 0===h?void 0:h.toLowerCase(),vendor:null===(u=t.vendor)||void 0===u?void 0:u.toLowerCase(),renderInfo:null===(f=t.renderInfo)||void 0===f?void 0:f.toLowerCase(),isAstcSupported:t.isAstcSupported,distributionName:null===(m=t.distributionName)||void 0===m?void 0:m.toLowerCase()},_=4096;for(const t of e){const e="mediaVersion"in t;let i="";if(e&&""!==t.mediaVersion&&(i=t.mediaVersion.toLowerCase()),e&&""!==i&&!p(i,a))continue;let o=0,n=!1;if(t.os&&""!==t.os){if(!g.os.includes(t.os.toLowerCase()))continue;if(g.os.includes("mac"))n=!0,o|=_;else if(g.os.includes("linux"))if(t.distributionName&&""!==t.distributionName){if(!g.distributionName.includes(t.distributionName.toLowerCase()))continue;o|=_}else o|=_;else o|=_}let d=!1,c=!1;if(t.browser&&t.browser.name&&""!==t.browser.name){if(!g.browserName.includes(t.browser.name.toLowerCase()))continue;if(g.browserName.includes("safari")?d=!0:g.browserName.includes("samsung internet")&&(c=!0),t.browser.versions&&t.browser.versions.length>0){if(!t.browser.versions.some((e=>this.isBrowserVersionHitBlacklist(g.browserVersion,e,c,g.engineVersion))))continue;o|=256}else o|=256}if(t.vendor&&""!==t.vendor)if(g.vendor.includes(t.vendor.toLowerCase()))o|=16;else{if(!n||!d||"intel"!==t.vendor.toLowerCase()||g.isAstcSupported)continue;o|=16}if(t.renderInfo&&""!==t.renderInfo){if(g.renderInfo!==t.renderInfo.toLowerCase()&&!g.renderInfo.includes(t.renderInfo.toLowerCase()))continue;o|=1}if(o>0)return v.stg=s.BH.DISABLED,v.errNo=s.Qb.DEVICE_ON_BLACKLIST,v.errMsg="webrtc is disabled(hit blacklist).",r.Ay.log("evalWebRTCStrategy() stg:".concat(JSON.stringify(v))),v}return v.stg=o,v.errNo=s.Qb.SUCCEED,v},isOnWebRTCWhitelist(e,t,i){var s,o;if(!t)return{isInWhitelist:!1,blacklist:null};r.Ay.directReport("isOnWebRTCWhitelist() deviceInfo=".concat(JSON.stringify(t)));const a={os:null===(s=t.os)||void 0===s?void 0:s.toLowerCase(),browserName:null===(o=t.browserName)||void 0===o?void 0:o.toLowerCase()};if(!e){const e=[{browserName:"chrome",os:["win","mac","ios","android","chromium os"]},{browserName:"edge",os:["win"]},{browserName:"safari",os:["mac","ios"]},{browserName:"mobile safari",os:["ios"]}].some((e=>e.browserName===a.browserName&&e.os.some((e=>a.os.includes(e)))));return r.Ay.log("isOnWebRTCWhitelist() no new whitelist configured. use old whitelist. isInWhitelist:".concat(e)),{isInWhitelist:e,blacklist:null}}const n=e.find((e=>p(e.mediaVersion,i)&&e.browser===a.browserName&&a.os.includes(e.os)));return{isInWhitelist:!!n,blacklist:(null==n?void 0:n.blacklist)||null}},isLowerThanMinGeneration(e,t,i){try{const r=e.toLowerCase(),s=t.toLowerCase(),o=parseInt(i);if("nvidia"===r){if(s.includes("geforce")){const e=s.indexOf("geforce gt ");if(parseInt(s.slice(e+11))<o)return!0}}else if("intel"===r&&s.includes("hd graphics")){const e=s.indexOf("hd graphics ");if(parseInt(s.slice(e+12))<o)return!0}return!1}catch(e){return r.Ay.error(e),!1}},isInRangeOfGenerations(e,t,i,s){try{const r=e.toLowerCase(),o=t.toLowerCase();if("intel"===r&&o.includes("hd graphics")){const e=o.indexOf("hd graphics "),t=parseInt(o.slice(e+12));if(t>i&&t<s)return!0}return!1}catch(e){return r.Ay.error(e),!1}},isOffscreenCanvasSupported:()=>"function"==typeof OffscreenCanvas,isHitBlacklist(e,t,i,s,o,a,n){if(!t||""===t||!a)return r.Ay.error("isHitBlacklist() targetRenderInfo is invalid"),!0;if(!o)return r.Ay.error("isHitBlacklist() an invalid blacklist configuration object"),!1;if("encoder"!==i&&"decoder"!==i&&"all"!==i)return r.Ay.error("isHitBlacklist() an invalid codecType(".concat(i,").")),!0;const d=s.toLowerCase();let c=!1;for(const s of o){const o="model"in s,l="codecType"in s,h="renderInfo"in s,u="minGeneration"in s,f="os"in s,m="osVersion"in s,v="mediaVersion"in s;let g=null;o&&""!==s.model&&(g=s.model.toLowerCase());let _=null;if(!l){r.Ay.warn("isHitBlacklist() miss codecType field in the configuration.");continue}if(_=s.codecType,"all"!==_&&"encoder"!==_&&"decoder"!==_){r.Ay.error("isHitBlacklist() codecType(".concat(_,") should be all/(empty)/encoder/decoder."));continue}let S=null;h&&""!==s.renderInfo&&(S=s.renderInfo.toLowerCase());let A=null;u&&(A=s.minGeneration);let y=null;f&&""!==s.os&&(y=s.os.toLowerCase());let C=null;m&&""!==s.osVersion&&(C=s.osVersion.toLowerCase());let E="";if(v&&""!==s.mediaVersion&&(E=s.mediaVersion.toLowerCase()),!v||""===E||p(E,n)){if(!o&&!h){if(!f||!y){r.Ay.warn("isHitBlacklist() invalid blacklist entry. entry:".concat(s));continue}if(y.includes(a.os.toLowerCase())){if(!m||!C){c=!0;break}if(this.isBrowserVersionHitBlacklist(a.osVersion,C)){c=!0;break}}}if(h&&""!==S&&(t===S||t.includes(S))&&("all"===_||_===i)){if(!f||!y){c=!0;break}if(y.includes(a.os.toLowerCase())){if(!m||!C){c=!0;break}if(this.isBrowserVersionHitBlacklist(a.osVersion,C)){c=!0;break}}}if(g)if(""!==d){if(g!==d){r.Ay.warn("isHitBlacklist() model(".concat(g,") in blacklist entry and model(").concat(d,") in whitelist should be same!"));continue}if("all"===_||_===i)if(A&&""!==A){if(this.isLowerThanMinGeneration(e,t,A)){if(!f||!y){c=!0;break}if(y.includes(a.os.toLowerCase())){if(!m||!C){c=!0;break}if(this.isBrowserVersionHitBlacklist(a.osVersion,C)){c=!0;break}}}}else{if(!f||!y){c=!0;break}if(y.includes(a.os.toLowerCase())){if(!m||!C){c=!0;break}if(this.isBrowserVersionHitBlacklist(a.osVersion,C)){c=!0;break}}}}else if(t.includes(g)&&("all"===_||_===i))if(A&&""!==A){if(this.isLowerThanMinGeneration(e,t,A)){if(!f||!y){c=!0;break}if(y.includes(a.os.toLowerCase())){if(!m||!C){c=!0;break}if(this.isBrowserVersionHitBlacklist(a.osVersion,C)){c=!0;break}}}}else{if(!f||!y){c=!0;break}if(y.includes(a.os.toLowerCase())){if(!m||!C){c=!0;break}if(this.isBrowserVersionHitBlacklist(a.osVersion,C)){c=!0;break}}}}}return c},isBrowserVersionHitBlacklist(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";if(!e||!t)return r.Ay.error("compareBrowserVersion() invalid parameters! browserVersion:".concat(e,", blacklistVersion:").concat(t)),!1;const o=[];if(i&&s)if(-1!==t.indexOf(":")){const[e,i]=t.split(":");""!==e&&o.push(e),""!==i&&o.push(i)}else o.push(t);else o.push(t);let a=!1;for(let t=0;t<o.length;t++){const i=o[t],s=i[0];let n=0;"<"==s?n=-1:"="==s?n=0:">"==s?n=1:(r.Ay.error("isBrowserVersionHitBlacklist() invalid operator! operator:".concat(s)),n=0);const d=i.slice(1),c=e.toString().split("."),l=d.toString().split("."),h=Math.min(c.length,l.length);for(let e=0;e<h;e++){const t=parseInt(c[e],10),i=parseInt(l[e],10);if(isNaN(t)||isNaN(i))r.Ay.error("Invalid version number detected!"),a=!1;else if(0!=n){if(-1==n){if(t<i){a=!0;break}if(t==i){a=!0;continue}a=!1;break}if(1==n){if(t>i){a=!0;break}if(t==i){a=!0;continue}a=!1;break}}else{if(t!==i){a=!1;break}a=!0}}if(!a)return!1}return a}}},6603:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});var r=function(e,t,i,r){return new(i||(i=Promise))((function(s,o){function a(e){try{d(r.next(e))}catch(e){o(e)}}function n(e){try{d(r.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,n)}d((r=r.apply(e,t||[])).next())}))};const s=new class{constructor(){this.init()}init(){return!0}enumerateDevices(){return r(this,void 0,void 0,(function*(){return navigator.mediaDevices.enumerateDevices()}))}getUserMedia(e){return r(this,void 0,void 0,(function*(){return navigator.mediaDevices.getUserMedia(e)}))}createPeerConnection(e){return new RTCPeerConnection(e)}createAudioElement(){return document.createElement("audio")}createVideoElement(){return document.createElement("video")}destroy(){}}},2754:(e,t,i)=>{"use strict";i.d(t,{HB:()=>n,KR:()=>d,Yu:()=>a,vA:()=>o});var r=i(1241),s=i(9415);const o=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(e)return;const i=new Error(t);if((0,s.B)().tracing.Log_Error("Assert: ".concat(t),i),r._)throw i},a=function(e){const t=new Error(e);if((0,s.B)().tracing.Log_Error("AssertWithFailed: ".concat(e),t),r._)throw t},n=function(){const e=new Error("Unreachable code reached!");if((0,s.B)().tracing.Log_Error("Unreachable!",e),r._)throw e},d=function(){const e=new Error("call abstract method!");if((0,s.B)().tracing.Log_Error("AbstractMethod!",e),r._)throw e}},3323:(e,t,i)=>{"use strict";i.d(t,{bQ:()=>s,ey:()=>a});var r=i(385);class s{constructor(e){this.options=Object.assign({analyserFrequent:100},e||{}),this.asnTime=performance.now(),this.audioStream=null,this.analyserNodeBufferDataArray=null,this.audioCtx=null,this.destinationNode=null,"function"==typeof AudioContext&&(this.audioCtx=new window.AudioContext,this.destinationNode=new MediaStreamAudioDestinationNode(this.audioCtx),this.initAnalyserNode()),this.lastUILevel=0}initAnalyserNode(){this.analyserNode=this.audioCtx.createAnalyser(),this.analyserNode.connect(this.destinationNode),this.analyserNode.fftSize=1024}setAudioStream(e){this.audioStream=e}start(){if(this.audioCtx)return this.getAnalyzingStatus()&&this.stop(),this.getDestroyedStatus()?Promise.reject(new Error("instance is destroyed already")):new Promise((e=>{this.setAnalyzingStatus(!0),this.sourceNode=this.audioCtx.createMediaStreamSource(this.audioStream),this.sourceNode.connect(this.analyserNode),this.resumeAudioCtx(),this.setAnalyzeInterval(),e(!0)}))}stop(){this.setAnalyzingStatus(!1),this.clearAnalyzeInterval()}destroy(){var e;this.stop(),this.analyserNode&&this.destinationNode&&this.analyserNode.disconnect(this.destinationNode),this.setDestroyedStatus(!0),null===(e=this.audioCtx)||void 0===e||e.suspend().finally((()=>{var e;return null===(e=this.audioCtx)||void 0===e?void 0:e.close()})),this.audioStream=null,this.analyserNodeBufferDataArray=null}analyserNodeIntervalCallback(){if(!this.analyserNodeBufferDataArray)return;this.analyserNode.getFloatTimeDomainData(this.analyserNodeBufferDataArray);let{sumRms:e,absMax:t}=function(e){let t=0,i=0;for(let r=0;r<e.length;r+=2){i+=e[r]*e[r];let s=Math.abs(e[r]);s>t&&(t=s)}return t=t>1?1:t,{sumRms:i/e.length/2,absMax:t}}(this.analyserNodeBufferDataArray);const i=a(t);i!==this.lastUILevel&&(this.lastUILevel=i,this.options.analyserCallback(i))}setAnalyzeInterval(){this.clearAnalyzeInterval();const e=this.analyserNode.fftSize;this.analyserNodeBufferDataArray=new Float32Array(e),this.analyserNodeTimer=window.setInterval(this.analyserNodeIntervalCallback.bind(this),this.options.analyserFrequent)}clearAnalyzeInterval(){this.analyserNodeTimer&&(window.clearInterval(this.analyserNodeTimer),this.analyserNodeTimer=null,this.analyserNodeBufferDataArray=null)}getAnalyzingStatus(){return!!this.isAnalyzing}setAnalyzingStatus(e){this.isAnalyzing=!!e}getDestroyedStatus(){return!!this.isDestroyed}setDestroyedStatus(e){this.isDestroyed=!!e}resumeAudioCtx(){"running"!==this.audioCtx.state&&this.audioCtx.resume().catch((e=>{r.Ay.error("audio-level audio context resume error: ",e)}))}}const o=[0,1,2,3,4,4,5,5,5,5,6,6,6,6,6,7,7,7,7,8,8,8,9,9,9,9,9,9,9,9,9,9,9];function a(e){if("number"!=typeof e||e<0||e>1)return-1;let t=Math.floor(32768*e/1e3);return 0==t&&e>250&&(t=1),o[t]}},5980:(e,t,i)=>{"use strict";i.d(t,{Ws:()=>a,fK:()=>r,n1:()=>o,qZ:()=>s});const r=306,s=202,o=512,a=288},9482:(e,t,i)=>{"use strict";i.d(t,{BX:()=>l,Go:()=>o,Tl:()=>n,Xt:()=>a,_c:()=>d,d:()=>c,is:()=>h,oB:()=>s,wd:()=>r});const r={ZOOM_CONNECTION_COMMAND:0,ZOOM_CONNECTION_AUDIO:1,ZOOM_CONNECTION_VIDEO:2,ZOOM_CONNECTION_SHARING_JPEG:3,ZOOM_CONNECTION_SHARING_VIDEO:4,ZOOM_CONNECTION_MEDIA_LOG:5,ZOOM_CONNECTION_SHARING_REMOTE_CONTROL:6,ZOOM_CONNECTION_UNKNOW:7},s={NET_WEBSOCKET:0,NET_DATACHANNEL:1,NET_WEBTRANSPORT:2},o={encode:1,decode:2},a={AUDIO:1,SHARING:2,VIDEO:3,MESH:4},n={UNKNOWN:0,WIN:1,MAC:2,PAD:3,MOBILE:4,CALL_IN:5,LINUX:6,WEB:7,CHROME:8},d={VIDEO_ENCODE:"0",VIDEO_DECODE:"1",AUDIO_ENCODE:"2",AUDIO_DECODE:"3",SHARING_ENCODE:"4",SHARING_DECODE:"5",WORKER_SERVICE:"6",COMMON:"7",NET:"net",MESH:"mesh"},c=(()=>{const e={};for(const t in d)e[d[t]]="WCL_"+t;return e})(),l={ComputerAudio_Null:0,ComputerAudio_Connecting:1,ComputerAudio_Connected:2,DesktopAudio_Null:0,DesktopAudio_Connecting:1,DesktopAudio_Connected:2},h={[d.AUDIO_ENCODE]:"audio.encode",[d.AUDIO_DECODE]:"audio.decode",[d.VIDEO_ENCODE]:"video.encode",[d.VIDEO_DECODE]:"video.decode",[d.SHARING_ENCODE]:"share.encode",[d.SHARING_DECODE]:"share.decode",[d.NET]:"net.thread",[d.MESH]:"mesh.thread"}},385:(e,t,i)=>{"use strict";i.d(t,{Ay:()=>a,ZN:()=>s,hZ:()=>o});const r="MEDIASDK_CACHE_INFO",s=e=>!(e&e-1),o=e=>e?"{E}".concat(e,"{/E}"):null,a=new class{constructor(){this._highFrequencyLogs={},this.fixVersion="",this.cacheLogStack=[],this.isFlushing=!1}setInstance(e,t){this._instance=e,this.fixVersion=t}getMessageFromErrorOrEvent(e,t){let i=e;return t instanceof ErrorEvent?(t.filename&&(i+=" File: ".concat(t.filename)),(t.lineno||t.colno)&&(i+=" Line: ".concat(t.lineno,":").concat(t.colno)),t.message&&(i+=" Message: ".concat(t.message)),t.error&&(i+="\nStack: ".concat(t.error.stack))):t instanceof Error?(t.message&&(i+=" Message: ".concat(t.message)),t.stack&&(i+=" Stack: ".concat(t.stack)),t.name&&(i+=" Name: ".concat(t.name)),t.constraint&&(i+=" Constraint: ".concat(t.constraint))):t instanceof CloseEvent?(t.code&&(i+=" Code: ".concat(t.code)),t.reason&&(i+=" Reason: ".concat(t.reason)),i+=" wasClean: ".concat(t.wasClean)):t instanceof DOMException?(t.message&&(i+=" Message: ".concat(t.message)),t.name&&(i+=" Name: ".concat(t.name))):i+=t?t.toString():"",i}_addCacheLog(e,t){this.cacheLogStack.length<100&&this.cacheLogStack.push({type:e,message:t})}flushCacheLog(){if(this._instance&&this.cacheLogStack.length>0&&!this.isFlushing){this.isFlushing=!0;let e="";this.cacheLogStack.forEach((t=>{let{type:i,message:{message:s="",tags:o=[]}}=t;const a=s?"".concat(o.join("|"),":").concat(s).concat("|----|"):"";switch(i){case"log":this._log(s,[...o,r]);break;case"warn":case"error":case"severityerror":case"directReport":e+=a}})),e&&this._directReport(e,[r]),this.cacheLogStack=[],this.isFlushing=!1}}log(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];this._instance?(this.flushCacheLog(),this._log(e,t)):this._addCacheLog("log",{message:e,tags:t})}warn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];e=this.getMessageFromErrorOrEvent(e,t),this._instance?(this.flushCacheLog(),this._warn(e,i)):this._addCacheLog("warn",{message:e,tags:i})}error(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];e=this.getMessageFromErrorOrEvent(e,t),this._highFrequencyLogs[e]?this._highFrequencyLogs[e]+=1:this._highFrequencyLogs[e]=1,s(this._highFrequencyLogs[e])&&(this._instance?(this.flushCacheLog(),this._error(e,i)):this._addCacheLog("error",{message:e,tags:i}))}severityerror(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];this._instance?(this.flushCacheLog(),this._severityerror(JSON.stringify(e),t)):this._addCacheLog("severityerror",{message:JSON.stringify(e),tags:t})}directReport(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["MEDIASDK_INFO"];var i;this._instance?(this.flushCacheLog(),null===(i=this._directReport)||void 0===i||i.call(this,e,t)):this._addCacheLog("directReport",{message:e,tags:t})}_log(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];this._instance&&this._instance.log(e,t)}_warn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];this._instance&&this._instance.warn(e,t)}_error(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];this._instance&&this._instance.error(e,[this.fixVersion,...t])}_severityerror(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];this._instance&&this._instance.error(e,t)}_directReport(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];var i,r;this._instance&&(null===(r=(i=this._instance).directReport)||void 0===r||r.call(i,{msg:e},t))}clearHighFrequencyLogs(){this._highFrequencyLogs={}}}},559:(e,t,i)=>{"use strict";i.d(t,{$8e:()=>ii,$MS:()=>Mt,$qV:()=>ir,$xb:()=>Wr,A3p:()=>E,A7G:()=>os,AL$:()=>Bt,AV$:()=>Ir,A_T:()=>ar,Abc:()=>Yr,Aew:()=>Ze,Ah8:()=>Or,AjI:()=>Pe,AmQ:()=>Ae,AoB:()=>qi,Azg:()=>or,BBN:()=>us,BJf:()=>sr,BSK:()=>Ii,BgG:()=>Ni,BqC:()=>r,Bse:()=>fr,CIY:()=>ei,CQt:()=>a,CXV:()=>qe,CY1:()=>Ft,CcD:()=>di,CpQ:()=>Be,DCT:()=>le,DjR:()=>Zt,E0n:()=>lt,ETO:()=>Vi,EUC:()=>Lt,EWx:()=>Ci,EYN:()=>ge,EcQ:()=>xr,Ev3:()=>It,Ewj:()=>Xt,Eym:()=>nr,FQb:()=>ur,FjO:()=>jr,Fjw:()=>Mr,Fxk:()=>Ti,G9o:()=>rr,GT7:()=>$,GtU:()=>ae,HIV:()=>ut,HKK:()=>d,HL3:()=>Gt,HOE:()=>ji,HVQ:()=>_t,HjG:()=>Hr,I6S:()=>br,I8$:()=>g,IQ_:()=>gi,IV3:()=>zr,IWn:()=>mt,IkA:()=>Oe,Ikw:()=>o,JoO:()=>Oi,Joy:()=>Vr,K3m:()=>Ge,K9M:()=>z,KYx:()=>te,KqK:()=>Li,LL7:()=>Fi,LYk:()=>Tr,L_m:()=>Qr,Lmp:()=>hs,M4w:()=>Ji,M5B:()=>k,M5F:()=>bt,M9W:()=>wi,MP_:()=>gt,Mhb:()=>A,N6$:()=>He,NPX:()=>qt,O06:()=>X,ONI:()=>$i,P79:()=>Se,PMP:()=>xe,PSY:()=>K,PcV:()=>Le,PgM:()=>Pr,Q$T:()=>wt,QQs:()=>it,Qc:()=>m,QoY:()=>s,QyH:()=>Ur,RJ8:()=>Ie,RmE:()=>x,SUv:()=>Re,ScD:()=>Pi,Sed:()=>R,Shw:()=>xt,TB5:()=>Ne,TRD:()=>dt,TSA:()=>Je,TaW:()=>Lr,Tbw:()=>ss,UFw:()=>Er,UGN:()=>C,USe:()=>fi,U_k:()=>Y,Ubu:()=>Jt,UsF:()=>Ve,UyE:()=>si,V36:()=>Ye,V5N:()=>ci,VeG:()=>ft,Vtx:()=>Ke,VxP:()=>ce,Vy5:()=>Tt,WCu:()=>Ar,WP5:()=>Br,Wcg:()=>Wt,X0s:()=>w,X10:()=>P,X1W:()=>ns,XDu:()=>Ot,XE6:()=>f,XHL:()=>fe,XYU:()=>Nr,XbU:()=>O,Y7X:()=>Pt,Y9c:()=>_r,YD4:()=>I,YG0:()=>dr,YTV:()=>F,Ya9:()=>Nt,ZFN:()=>tr,ZIm:()=>Q,ZSj:()=>zi,_7f:()=>be,_9I:()=>hi,_Gi:()=>n,_Nl:()=>se,_Zs:()=>v,a$m:()=>Ue,a1o:()=>Yi,a6z:()=>ai,aE$:()=>Z,aKW:()=>bi,aYB:()=>oe,ahr:()=>pr,bKC:()=>N,bSz:()=>M,bVv:()=>At,bW9:()=>$t,baF:()=>yt,bes:()=>er,bjn:()=>Di,bo2:()=>Si,cBD:()=>Ut,cJy:()=>H,cYb:()=>Vt,cjy:()=>Et,dUL:()=>Ui,dsK:()=>Mi,eEQ:()=>S,eI5:()=>Rt,eJx:()=>ke,eMN:()=>pi,ee7:()=>me,ekh:()=>ri,epV:()=>Dt,exH:()=>h,f8O:()=>q,fAR:()=>pe,fmn:()=>rt,fxd:()=>Fr,g$j:()=>ne,g8Z:()=>p,g9q:()=>li,gFh:()=>Ei,gh2:()=>wr,gle:()=>L,h73:()=>kt,hEQ:()=>rs,hG:()=>ls,hcn:()=>De,hd7:()=>Ct,hs:()=>_,i0n:()=>Ee,i3D:()=>Hi,i8:()=>de,i9k:()=>Xe,i9w:()=>Te,iDK:()=>J,iOs:()=>ht,iQY:()=>Dr,iyU:()=>yr,j4N:()=>T,jCp:()=>ve,jhI:()=>ni,kPo:()=>nt,kQe:()=>W,kqY:()=>hr,l8t:()=>$e,lA5:()=>Ri,lLs:()=>Xr,lOl:()=>Qe,lyw:()=>G,m1Q:()=>b,m7W:()=>D,mrR:()=>ps,msu:()=>qr,mxj:()=>Xi,n7n:()=>vt,nEg:()=>yi,nVA:()=>Cr,naM:()=>tt,npe:()=>Qt,oDm:()=>Ai,oFc:()=>st,oQY:()=>Wi,oUP:()=>kr,ovL:()=>ee,p4Z:()=>Zr,p8Y:()=>jt,pHx:()=>Bi,pOT:()=>l,pWm:()=>fs,pn7:()=>Ce,pvo:()=>ki,px:()=>Kt,qRr:()=>Gr,qUx:()=>_i,q_3:()=>Qi,qmK:()=>we,qnv:()=>re,qqH:()=>xi,qw$:()=>lr,r2c:()=>j,r4R:()=>vr,rME:()=>cs,rNn:()=>mi,rSS:()=>he,rV1:()=>es,raw:()=>Ki,rcl:()=>B,rje:()=>ze,rpL:()=>We,rt8:()=>mr,rwH:()=>je,s8N:()=>V,sCk:()=>et,sCw:()=>Zi,sfr:()=>ts,ssE:()=>at,t4x:()=>ot,tMo:()=>Kr,tN9:()=>St,tav:()=>y,tjY:()=>ti,tm0:()=>_e,u1v:()=>ue,ufC:()=>pt,uiF:()=>u,uiQ:()=>vi,uxR:()=>U,vIC:()=>as,vd4:()=>Rr,vjv:()=>cr,wIu:()=>Fe,wYI:()=>ie,wb7:()=>Jr,wk9:()=>c,x$W:()=>$r,x3x:()=>oi,xQc:()=>Sr,xlY:()=>ct,xzH:()=>is,yGo:()=>Ht,yHE:()=>ye,yJV:()=>Yt,zFT:()=>ui,zag:()=>gr,zby:()=>ds,zds:()=>Gi,ziT:()=>Me,zj1:()=>zt});const r=1,s=2,o=3,a=4,n=5,d=6,c=7,l=8,h=9,u=10,p=11,f=12,m=13,v=15,g=16,_=17,S=18,A=19,y=21,C=22,E=23,b=24,w=25,R=26,T=27,I=28,M=30,D=30.1,P=31,k=31.1,O=32,V=33,N=34,x=36,L=37,W=38,U=40,B=41,F=43,H=44,G=45,j=46,K=48,z=49,q=50,Y=51,X=52,Q=53,J=54,$=55,Z=57,ee=58,te=59,ie=60,re=61,se=62,oe=63,ae=64,ne=65,de=66,ce=70,le=71,he=72,ue=73,pe=74,fe=75,me=76,ve=77,ge=78,_e=79,Se=80,Ae=81,ye=82,Ce=83,Ee=84,be=85,we=86,Re=87,Te=90,Ie=91,Me=92,De=93,Pe=94,ke=96,Oe=97,Ve=98,Ne=99,xe=101,Le=100,We=102,Ue=103,Be=104,Fe=110,He=111,Ge=112,je=113,Ke=116,ze=117,qe=118,Ye=120,Xe=121,Qe=123,Je=124,$e=125,Ze=126,et=127,tt=128,it=129,rt=130,st=132,ot=133,at=135,nt=136,dt=137,ct=138,lt=139,ht=140,ut=145,pt=141,ft=142,mt=143,vt=150,gt=152,_t=153,St=156,At=158,yt=159,Ct=160,Et=161,bt=162,wt=163,Rt=164,Tt=165,It=166,Mt=1.1,Dt=1.2,Pt=1.3,kt=2,Ot=3,Vt=6,Nt=7,xt=8,Lt=9,Wt=10,Ut=11,Bt=12,Ft=13,Ht=14,Gt=15,jt=16,Kt=17,zt=18,qt=19,Yt=20,Xt=21,Qt=23,Jt=24,$t=25,Zt=26,ei=27,ti=28,ii=29,ri=30,si=31,oi=32,ai=33,ni=34,di=35,ci=36,li=37,hi=38,ui=39,pi=40,fi=209,mi=-1.1,vi=-1.2,gi=-1.3,_i=-2,Si=-3,Ai=-4,yi=-8,Ci=-9,Ei=-10,bi=-11,wi=-12,Ri=-14,Ti=-15,Ii=-20,Mi=-21,Di=-22,Pi=-28,ki=-27,Oi=-29,Vi=-31,Ni=-32,xi=-33,Li=-34,Wi=-35,Ui=-36,Bi=-37,Fi=-38,Hi=-39,Gi=-40,ji=-41,Ki=-44,zi=-45,qi=-51,Yi=-52,Xi=-53,Qi=-54,Ji=-55,$i=-60,Zi=-70,er=-129,tr=-130,ir=-136,rr=-137,sr=-138,or=-140,ar=0,nr=1,dr=2,cr="SHARING_PARAM_INFO_FROM_SOCKET",lr=24321,hr=24322,ur=24322,pr=24323,fr=24322,mr=4300,vr=4299,gr=7939,_r=32772,Sr=12303,Ar=12305,yr=16415,Cr=16417,Er=4167,br=4355,wr={ZOOM_CONNECTION_VIDEO_OFFER_RESPONSE_EVT:"ZOOM_CONNECTION_VIDEO_OFFER_RESPONSE_EVT",ZOOM_CONNECTION_AUDIO_OFFER_RESPONSE_EVT:"ZOOM_CONNECTION_AUDIO_OFFER_RESPONSE_EVT",END_MEDIA:"END_MEDIA",DESTROY:"DESTROY",DC_COMING_MESSAGE:"DC_COMING_MESSAGE",AUDIO_BRIDGE_WS_TOKEN:"AUDIO_BRIDGE_WS_TOKEN"},Rr=70,Tr=170,Ir=121,Mr="COMMON_QOS_DATA",Dr="AUDIO_QOS_DATA",Pr="VIDEO_QOS_DATA",kr="VIDEOSHARE_QOS_DATA",Or="NETWORK_QUALITY_CHANGE",Vr="NETWORK_QUALITY_CHANGE_AUDIO",Nr="NETWORK_QUALITY_CHANGE_SHARING",xr={VIDEO_ENCODE:"0",VIDEO_DECODE:"1",AUDIO_ENCODE:"2",AUDIO_DECODE:"3",SHARING_ENCODE:"4",SHARING_DECODE:"5"},Lr=66.5,Wr=66.6,Ur="ENABLE_REUSE_STREAM",Br="PRESET_MEDIA_CONSTRAINTS",Fr="DESTORY_REUSE_STREAM",Hr={FAIL:4},Gr="AUDIO_STREAM_MUTED",jr="AUDIO_STREAM_UNMUTED",Kr="VIDEO_STREAM_MUTED",zr="VIDEO_STREAM_UNMUTED",qr="EXPOSE_VB_FRAME",Yr="UNIFIED_VB_FRAME",Xr="UNIFIED_VB_STOP",Qr="UNIFIED_VB_PAUSE",Jr="UNIFIED_VB_ACK",$r="ANNO_UNDO_STATUS",Zr="ANNO_REDO_STATUS",es="ANNO_VIEWER_REQUEST_DRAW",ts={USER_DENIED:1,SYSTEM_DENIED:2,DEVICE_IN_USE:3,NO_DEVICE:4,UNKNOWN_REASON:5,OVERCONSTRAINED:6,USER_DISMISS:7},is={GRANTED_AUDIO_VIDEO:1,GRANTED_AUDIO:2,DENIED:3,EXCEPTION_FAILS:4,DISMISS:5,GRANTED_VIDEO:6,REQUESTING_AUDIO:7},rs={SELECT_TRANSLATION_LANGUAGE:6},ss=1128,os=1128.5,as=1190,ns=1178,ds=1176,cs=1177,ls=1128,hs=1130,us=1140,ps=4,fs=4305},6280:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});let r="object"==typeof localStorage&&localStorage.__islogdebug;const s=function(e){function t(){let e=[];return e.push(...arguments),e}!0===(arguments.length>1&&void 0!==arguments[1]&&arguments[1])&&(r=!0);var i=function(){r&&console.log(e,...t(arguments))};return["log","info","warn","error"].forEach((s=>{i[s]=function(){r&&console[s](e,...t(arguments))}})),i}},4543:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});var r=i(3224),s=i(2193);let o=r;i.n(s)()(r)&&(o=window.PubSub);let a=function(){};a.prototype={publish(){return o.publish.apply(this,arguments)},publishSync(){return o.publishSync.apply(this,arguments)},trigger(){return this.publish.apply(this,arguments)},triggerSync(){return this.publishSync.apply(this,arguments)},emit(){return this.publish.apply(this,arguments)},subscribe(){return o.subscribe.apply(this,arguments)},on(){return this.subscribe.apply(this,arguments)},unsubscribe(){return o.unsubscribe.apply(this,arguments)},clearAllSubscriptions(){o.clearAllSubscriptions()}};const n=new a},4468:(e,t,i)=>{"use strict";i.d(t,{C:()=>a,kY:()=>s,rE:()=>o,zu:()=>n});const r="13487",s=r,o="15.0.13487",a="Web-Media-EP-6.6.10",n="6.6.10.".concat(r)},5600:(e,t,i)=>{"use strict";i.d(t,{S_:()=>p,Yd:()=>c,fn:()=>u,r1:()=>h,r9:()=>d,y5:()=>l});var r=i(9407),s=i(559),o=i(385),a=i(3656);const n="function"!=typeof importScripts;function d(e){postMessage({status:r.Bi,data:e})}function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;n?o.Ay.error(e,t):h(e,t)}function l(e){n?o.Ay.directReport(e):u(e)}function h(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;var i,s;if(t instanceof Error||t instanceof ErrorEvent){const r=t;e+=" Code: "+(null==r?void 0:r.code)+" Message: "+(null==t?void 0:t.message)+" Stack: "+(null!==(s=null===(i=null==r?void 0:r.error)||void 0===i?void 0:i.stack)&&void 0!==s?s:null==r?void 0:r.stack),t=null}postMessage({status:r.AC,errorMessage:e,errorEvent:t})}function u(e){postMessage({status:r.AC,errorMessage:e,level:"low"})}function p(e){n?(0,a.iK)(s.AoB,e):postMessage({status:r.V_,where:e})}},9470:(e,t,i)=>{"use strict";i.d(t,{H0:()=>s,JF:()=>h,LZ:()=>a,PF:()=>u,b2:()=>d,cO:()=>l,i$:()=>n});var r=i(8935);const s=()=>r.gG.browser||{},o=(e,t)=>{const{version:i}=s();return"chrome"!==e&&"chromium"!==e||!((0,r._J)()||(0,r.UP)()||(0,r.GQ)())?!!{safari:(0,r.nr)(),edge:(0,r.UP)(),firefox:(0,r.gm)(),opera:(0,r.GQ)(),ie:(0,r.lT)()}[e]&&(0,r.D$)(i,String(t)):(0,r.D$)(i,String(t))},a=function(){return o("chrome",arguments.length>0&&void 0!==arguments[0]?arguments[0]:90)},n=e=>o("firefox",e),d=e=>o("safari",e);function c(e,t,i){const r=e.match(t);return r&&r.length>=i&&parseInt(r[i],10)}const l=()=>{if("undefined"==typeof window||!window.navigator)return{browser:"",version:""};const{major:e}=s(),t=parseInt(e,10);return(0,r._J)()?(0,r.n_)()?{browser:"safari",version:c(navigator.userAgent,/AppleWebKit\/(\d+)\./,1)}:{browser:"chrome",version:t}:(0,r.gm)()?{browser:"firefox",version:t}:(0,r.UP)()?{browser:"edge",version:t}:(0,r.nr)()?{browser:"safari",version:c(navigator.userAgent,/AppleWebKit\/(\d+)\./,1)}:{browser:"",version:""}},h=()=>{const{major:e}=s();return e?parseInt(e,10):"other"},u=()=>{var e,t,i,s,o,a;try{let n={osType:0,os:"",osVersion:"",distributionName:"",browser:{},kernel:{},device:{}};const d=Object.assign({},r.gG);"Chromium"===(null===(e=null==d?void 0:d.browser)||void 0===e?void 0:e.name)&&(d.browser.name="Chrome");let c="tablet"==(null===(t=null==d?void 0:d.device)||void 0===t?void 0:t.type)||(0,r.Pg)(),l="mobile"==(null===(i=null==d?void 0:d.device)||void 0===i?void 0:i.type)||(0,r.Xb)(),h=null===(s=null==d?void 0:d.os)||void 0===s?void 0:s.name,u=null===(o=null==d?void 0:d.os)||void 0===o?void 0:o.version,p=null===(a=null==d?void 0:d.os)||void 0===a?void 0:a.distributionName,f=0;if(c?f=4:l&&(f=1),!h){const e=navigator.userAgent.match(/\(([^;]+); OpenHarmony ([\d.]+)\)/);e&&e.length>2&&(h="OpenHarmony",u=e[2],"Tablet"===e[1]?f=4:"Phone"===e[1]&&(f=1))}return n.osType=f,n.osVersion=u,n.distributionName=p,n.browser=Object.assign({},d.browser),n.kernel=Object.assign({},d.engine),n.device=Object.assign({},d.device),n.os=h,navigator.userAgentData||((null==h?void 0:h.toLowerCase().includes("mac"))&&(c||l)&&(n.os="iOS"),(null==h?void 0:h.toLowerCase().includes("linux"))&&(c||l)&&(n.os="Android")),n}catch(e){return{}}}},9415:(e,t,i)=>{"use strict";let r;function s(e){r=e}i.d(t,{B:()=>o,d:()=>s});const o=()=>r},1223:(e,t,i)=>{"use strict";i.d(t,{A:()=>v});var r,s=i(129),o=i.n(s),a=i(9559),n=i(7080),d=i(2689),c=i(559),l=i(8935),h=i(385);!function(e){e[e.Video_90P=0]="Video_90P",e[e.Video_180P=1]="Video_180P",e[e.Video_360P=2]="Video_360P",e[e.Video_720P=3]="Video_720P",e[e.Video_1080P=4]="Video_1080P"}(r||(r={}));const u={[r.Video_90P]:"90p",[r.Video_180P]:"180p",[r.Video_360P]:"360p",[r.Video_720P]:"720p",[r.Video_1080P]:"1080p"};var p,f;!function(e){e[e.Low_End=0]="Low_End",e[e.High_End=1]="High_End"}(p||(p={})),function(e){e.IDLE="IDLE",e.MODE_A="MODE_A",e.MODE_B="MODE_B",e.MODE_C="MODE_C",e.MODE_D="MODE_D",e.PARTIAL_B="PARTIAL_B",e.PARTIAL_BC="PARTIAL_BC",e.PARTIAL_DC="PARTIAL_DC"}(f||(f={}));class m{static reset(){this.isEnable=!0,this.isWebRTC=!1,this.subscribeContrlMode=p.Low_End,this.userSubscribeMap=new Map,this.userOriginalSizeMap=new Map,this.maxSubscribeSize=(null===navigator||void 0===navigator?void 0:navigator.hardwareConcurrency)>=8?r.Video_1080P:r.Video_360P,this.isSupportSubscribeFullHD=!1,this.isRecoveryScheduled=!1,this.clearRecoveryTimerAndFlag()}static setIsWebRTC(e){this.isWebRTC=e,e&&(this.maxSubscribeSize=r.Video_1080P,this.setSubscribeContrlMode(!0))}static setIsEnable(e){this.isEnable=e}static setEnableSubscribeVideoSizeFullHD(e){n.A.add_monitor("SVFH: ".concat(e)),this.isSupportSubscribeFullHD=!!e}static setSubscribeContrlMode(e){let t;t=(0,l.GN)()||(0,l.n_)()?p.Low_End:this.isWebRTC||a.Ay.isSupportSharedArrayBuffer()&&e?p.High_End:p.Low_End,this.subscribeContrlMode=t,n.A.add_monitor("SVCS:".concat(t,"|").concat(this.isWebRTC))}static setMaxSubscribeSize(e){if(!this.isWebRTC){if(n.A.add_monitor("WMDS: ".concat(e)),this.isEnable&&e!==this.maxSubscribeSize&&e>=r.Video_720P&&this.userSubscribeMap.size>0){const e=Array.from(this.userSubscribeMap.entries()).filter((e=>{let[t,i]=e;return i>=r.Video_720P})).map((e=>{let[t,i]=e;return{id:t,size:i,bOn:!1}}));e.length>0&&this.sendSubscribeVideoMsgToRWG(e)}this.maxSubscribeSize=e}}static groupByUserVideoSize(e){const t={};for(const[i,r]of this.userSubscribeMap.entries())i!==e&&(t[r]||(t[r]=[]),t[r].push({id:i,size:r}));return t}static getAvailableSizeForLowEnd(e,t){var i,s,o;const a=this.groupByUserVideoSize(e),n=(null===(i=a[r.Video_1080P])||void 0===i?void 0:i.length)||0,d=(null===(s=a[r.Video_720P])||void 0===s?void 0:s.length)||0,c=(null===(o=a[r.Video_360P])||void 0===o?void 0:o.length)||0;if(t===r.Video_180P||t===r.Video_90P)return t;let l;return l=n>=1?"MODE_A":d>=1?"MODE_B":c>=4?"MODE_C":c>0&&c<4?"PARTIAL_C":"IDLE","IDLE"===l?t:"MODE_A"===l||"MODE_B"===l||"MODE_C"===l?r.Video_180P:"PARTIAL_C"===l&&t>=r.Video_360P?r.Video_360P:r.Video_180P}static getAvailableSizeForHighEnd(e,t){var i,s,o;const a=this.groupByUserVideoSize(e),n=(null===(i=a[r.Video_1080P])||void 0===i?void 0:i.length)||0,d=(null===(s=a[r.Video_720P])||void 0===s?void 0:s.length)||0,c=(null===(o=a[r.Video_360P])||void 0===o?void 0:o.length)||0;if(t===r.Video_180P||t===r.Video_90P)return t;let l;return l=n>=1?f.MODE_A:d>=2&&c>=2?f.MODE_B:1===d&&c>=4?f.MODE_C:0===d&&c>=8?f.MODE_D:d>=2?f.PARTIAL_B:1===d&&c<4?f.PARTIAL_BC:0===d&&c>0&&c<8?f.PARTIAL_DC:f.IDLE,this.handleHighEndState(l,t,c)}static handleHighEndState(e,t,i){switch(e){case f.IDLE:return t;case f.MODE_A:case f.MODE_B:case f.MODE_C:case f.MODE_D:return r.Video_180P;case f.PARTIAL_B:return r.Video_360P;case f.PARTIAL_BC:return i<=2&&t>=r.Video_720P?r.Video_720P:r.Video_360P;case f.PARTIAL_DC:return t>=r.Video_720P?i<=4?r.Video_720P:r.Video_360P:t===r.Video_360P?r.Video_360P:r.Video_180P;default:return r.Video_180P}}static getActualSubscribeSize(e){return e!==r.Video_1080P||this.maxSubscribeSize!==r.Video_720P||this.isWebRTC?Math.min(this.maxSubscribeSize,e):e}static calculateSubscribeSize(e,t){if(this.userSubscribeMap.has(e)&&t<=this.userSubscribeMap.get(e))return[t,this.getActualSubscribeSize(t)];const i=this.subscribeContrlMode===p.High_End?this.getAvailableSizeForHighEnd(e,t):this.getAvailableSizeForLowEnd(e,t);return t!==i&&this.showWarningMessage(t,i),[i,this.getActualSubscribeSize(i)]}static getCalculateSubscribeSizeResult(e){return e.map((e=>{const[t,i]=this.calculateSubscribeSize(e.id,e.size);return this.userSubscribeMap.set(e.id,t),this.userOriginalSizeMap.set(e.id,e.size),Object.assign(Object.assign({},e),{size:i})}))}static tryRecoverDowngradedSubscriptions(e){if(0===this.userSubscribeMap.size)return;const t=[],i=[];for(const[e,t]of this.userSubscribeMap.entries()){const r=this.userOriginalSizeMap.get(e);void 0!==r&&r>t&&i.push({id:e,originalSize:r,currentSize:t})}if(0!==i.length){o()(i).call(i,((e,t)=>t.originalSize-e.originalSize));for(const e of i){if(e.originalSize<=r.Video_180P)continue;const i=this.subscribeContrlMode===p.High_End?this.getAvailableSizeForHighEnd(e.id,e.originalSize):this.getAvailableSizeForLowEnd(e.id,e.originalSize);if(i>e.currentSize){this.userSubscribeMap.set(e.id,i);const r=this.getActualSubscribeSize(i);t.push({id:e.id,size:r,bOn:!1})}}t.length>0&&(h.Ay.log("MediaSDK_Sub_Control_Recovery: downgradedUserList: ".concat(JSON.stringify(i),", recoveryList: ").concat(JSON.stringify(t))),this.isWebRTC?e&&Array.isArray(t)&&t.length>0&&(n.A.add_monitor("WMSC_UI_S_V_R: ".concat((0,a.iD)(JSON.stringify(t)))),e.sendMessageToWMSC({type:"NOTIFY_SDK_SUBSCRIBE_VIDEO",data:t})):this.sendSubscribeVideoMsgToRWG(t))}}static clearRecoveryTimerAndFlag(){window.clearTimeout(this.recoveryTimer),this.recoveryTimer=null,this.isRecoveryScheduled=!1}static scheduleRecovery(e){this.isEnable&&(this.clearRecoveryTimerAndFlag(),this.recoveryTimer=window.setTimeout((()=>{this.isRecoveryScheduled||(this.isRecoveryScheduled=!0,this.tryRecoverDowngradedSubscriptions(e))}),2e3))}static subscribeVideo(e,t){let i=this.preprocessingSubscribeVideo(e);this.isEnable&&(this.clearRecoveryTimerAndFlag(),i=this.getCalculateSubscribeSizeResult(i)),h.Ay.log("MediaSDK_Sub_Control_Pre_Sub, FullHD: ".concat(this.isSupportSubscribeFullHD," | strategy: ").concat(this.subscribeContrlMode,", isWebRTC:").concat(this.isWebRTC,", maxSubscribeSize: ").concat(this.maxSubscribeSize,", orgin: ").concat(JSON.stringify(e),", calculate: ").concat(JSON.stringify(i))),this.isWebRTC?(n.A.add_monitor("WMSC_UI_S_V: ".concat((0,a.iD)(JSON.stringify(i)))),t&&Array.isArray(i)&&i.length>0&&t.sendMessageToWMSC({type:"NOTIFY_SDK_SUBSCRIBE_VIDEO",data:i})):this.sendSubscribeVideoMsgToRWG(i),this.scheduleRecovery(t)}static unSubscribeVideo(e,t){this.isEnable&&(this.clearRecoveryTimerAndFlag(),e.forEach((e=>{this.userSubscribeMap.delete(e.id),this.userOriginalSizeMap.delete(e.id)}))),Array.isArray(e)&&e.length>0&&(this.isWebRTC?(n.A.add_monitor("WMSC_UI_UNS_V: ".concat((0,a.iD)(JSON.stringify(e)))),t&&Array.isArray(e)&&e.length>0&&t.sendMessageToWMSC({type:"NOTIFY_SDK_UNSUBSCRIBE_VIDEO",data:e})):this.sendUnsubscribeVideoMsgToRWG(e)),this.scheduleRecovery(t)}static sendSubscribeVideoMsgToRWG(e){h.Ay.log("MediaSDK_Sub_Control_Subscrbe:".concat(JSON.stringify(e))),Array.isArray(e)&&e.length>0&&d.A.sendMessageToRwg(c.yJV,{evt:c.xQc,body:{subInfoList:e}})}static sendUnsubscribeVideoMsgToRWG(e){h.Ay.log("MediaSDK_Sub_Control_Unsubscrbe:".concat(JSON.stringify(e))),Array.isArray(e)&&e.length>0&&d.A.sendMessageToRwg(c.yJV,{evt:c.WCu,body:{subIDList:e}})}static showWarningMessage(e,t){e!==t&&console.warn("Warning: For a better experience, your subscribe size ".concat(u[e]," has been downgraded to ").concat(u[t]))}static isEnablePSL(){return!!(null===d.A||void 0===d.A?void 0:d.A.pslVideoId)}static preprocessingSubscribeVideo(e){return e.forEach((e=>{let t=e.size;this.isSupportSubscribeFullHD||this.isEnablePSL()||(t=Math.min(t,r.Video_720P)),this.isWebRTC||((0,l.bw)()||(0,l.vk)()?t=Math.min(this.maxSubscribeSize,t,r.Video_360P):t===r.Video_1080P&&this.maxSubscribeSize===r.Video_720P||(t=Math.min(this.maxSubscribeSize,t))),e.size=t})),e}static getUserSubscribeMap(){return this.userSubscribeMap}}m.isEnable=!0,m.isWebRTC=!1,m.userSubscribeMap=new Map,m.userOriginalSizeMap=new Map,m.maxSubscribeSize=(null===navigator||void 0===navigator?void 0:navigator.hardwareConcurrency)>=8?r.Video_1080P:r.Video_360P,m.subscribeContrlMode=p.Low_End,m.recoveryTimer=null,m.isRecoveryScheduled=!1,m.isSupportSubscribeFullHD=!1;const v=m},5999:(e,t,i)=>{"use strict";var r;i.d(t,{Mr:()=>o,f7:()=>s,xv:()=>a,zu:()=>r}),function(e){e.MainAudio="MainAudio",e.ShareAudio="ShareAudio",e.MainVideo="MainVideo",e.ShareVideo="ShareVideo"}(r||(r={}));const s={Track:"Track",CodecsChange:"CodecsChange",SignalingStateChange:"SignalingStateChange",IceConnectionStateChange:"IceConnectionStateChange",ConnectionStateChange:"ConnectionStateChange",NegotiationNeeded:"NegotiationNeeded",IceGatheringStateChange:"IceGatheringStateChange",IceCandidateError:"IceCandidateError",StatsReport:"StatsReport",LocalCandidateStats:"LocalCandidateStats",RemoteCandidateStats:"RemoteCandidateStats",CandidatePairStats:"CandidatePairStats",TransportStats:"TransportStats",MediaSourceStats:"MediaSourceStats",OutboundRtpStats:"OutboundRtpStats",RemoteInboundRtpStats:"RemoteInboundRtpStats",InboundRtpStats:"InboundRtpStats",RemoteOutboundRtpStats:"RemoteOutboundRtpStats"},o=1e3;function a(e){switch(e){case r.MainAudio:case r.ShareAudio:return"audio";case r.MainVideo:case r.ShareVideo:return"video";default:return}}},7162:(e,t,i)=>{"use strict";i.d(t,{A:()=>Ao});var r=i(6984),s=i.n(r),o=i(9558),a=i(9559),n=i(559),d=i(2689),c=i(385),l=i(5738),h=i(3656),u=i(6280),p=i(4543),f=i(1882),m=i.n(f),v=i(7857),g=i(7350),_=i.n(g),S=i(8023),A=i.n(S),y=i(31),C=i.n(y),E=i(9482);function b(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,r)}return i}const w=(0,u.A)("sdk.remoteControl");function R(e){let t=this;this.dom=e.dom,this.socketURL=e.socketURL,this.meetingID=e.meetingID,this.condID=e.condID,this.blobSocket=null;let i=this._keyMouseEventHandler.bind(this);this.keyMouseEventHandler=function(e){t.keyMouseFilters(e).then((e=>{i(e)}))},this.keyMouseEventHandlerThrottle=_()((function(e){t.keyMouseEventHandler(e)}),1e3/24),this.pasteOnDocument=this._pasteOnDocument.bind(this),this.copyOnDocument=this._copyOnDocument.bind(this),this.cutOnDocument=this._cutOnDocument.bind(this),this.focus=this._focus.bind(this),this.PUBSUB_SHARING_PARAM_INFO_TOKEN=null,this.preventDefault=this._preventDefault.bind(this),this.browserBlurEventHandler=this._browserBlurEventHandler.bind(this),this.positionMap={canvas:{offsetX:0,offsetY:0},src:{x:0,y:0,w:0,h:0,scaleWidth:0,scaleHeight:0},dst:{x:0,y:0,w:0,h:0}},this.blockedKeyboardEventOfPaste=[],this.keydownupMergeRemoveMap={},this.keyMouseEventHandlerFilter_every_keyup_must_have_keydown_before_Map={},this.PASTE_MAX_BYTE_LENGTH=64e3,this.currentMousePositionProps={clientX:0,clientY:0,x2video:0,y2video:0},this.isControllerNow=!0,this.remoteOS=E.Tl.UNKNOWN,this.localOS=this.getLocalOS(),this._blockedCopyKeyboardList=[],this.maxSleep=500}R.prototype={start(){return new Promise((async(e,t)=>{try{w("remote control start"),this.modifyDom(),this.bindEvent(),this.subscribeSharingWidthOrHeightChange(),await this.connectSocket(),this.sendPostionPDU(),this.socketBlobMessageHandler(),e(!0)}catch(e){t(e)}}))},destroy(){return new Promise(((e,t)=>{try{w("destroy remote control"),this.unbindEvent(),this.uncheckAndClearKeydownupMergeRemoveMap(),this.destroySocket(),p.A.unsubscribe(this.PUBSUB_SHARING_PARAM_INFO_TOKEN),e(!0)}catch(t){w(t),e(!1)}}))},modifyDom(){try{this.dom.setAttribute("tabindex","0"),this.dom.focus()}catch(e){}},_focus(){this.dom.focus()},getLocalOS(){let e=i.g.navigator.platform;return/win/i.test(e)?E.Tl.WIN:/mac/i.test(e)?E.Tl.MAC:E.Tl.UNKNOWN},setIsControlerNow(e){this.isControllerNow=e},blobSocketCheckAndSend(e){this.isControllerNow&&this.blobSocket.send(e)},isKeyboardEvent:e=>!!e&&e.type&&-1!==["keydown","keyup"].indexOf(e.type.toLowerCase()),isThisKeyIgnoreCase:(e,t)=>e.key&&e.key.toLowerCase()==t.toLowerCase(),async _copyOnDocument(e){if(!this.isFocusNow())return;let t=this._blockedCopyKeyboardList;"done"!=t[t.length-1]&&(this._blockedCopyKeyboardList=[],this._blockedCopyKeyboardList.push("done"),w("copyOnDocument",e),this.processMonitorCtrlMetaWithKey("c"))},async _cutOnDocument(e){this.isFocusNow()&&(w("_cutOnDocument",e),this.processMonitorCtrlMetaWithKey("x"))},processMonitorCtrlMetaWithKey(e){let t=this.remoteOS===E.Tl.MAC,i={t:"keydown",event_type:1,repeat:!1,alt:!1,shift:!1,capslock:!1,numlock:!0,pduType:85,ctrl:!t,super:t},r=Object.assign({},i,{charCode:0,keyCode:t?91:17,key:t?"Meta":"Control"}),s=Object.assign({},i,{charCode:e.charCodeAt(0),keyCode:e.toUpperCase().charCodeAt(0),key:e}),o=Object.assign({},r,{input_event_type:0}),a=(Object.assign({},r,{input_event_type:2}),Object.assign({},s,{input_event_type:0})),n=(Object.assign({},s,{input_event_type:2}),Object.assign({},r,{t:"keyup",ctrl:!1,super:!1,input_event_type:1})),d=Object.assign({},s,{t:"keyup",ctrl:!1,super:t,input_event_type:1});(t?[o,a,d,n]:[o,a,n,d]).forEach((e=>{this.processEvent(e)}))},isFocusNow(){return this.dom===document.activeElement},async _pasteOnDocument(e){if(this.isFocusNow()){let t=(e.clipboardData||window.clipboardData).getData("text");w("_pasteOnDocument",t);let i=[];for(let e=0;e<t.length;e++){let r=t[e],s=C().encode(r);for(let e=0;e<s.length;e++)i.push(s.charCodeAt(e))}let r=new ArrayBuffer(8+i.length),s=new Uint8Array(r),o=new DataView(r,4,4),a=new Uint8Array(r,8);s[0]=87,o.setUint32(0,i.length,!0);for(let e=0;e<i.length;e++)a[e]=i[e];i.length>this.PASTE_MAX_BYTE_LENGTH?(this.triggerPasteTextLengthOverflow(),this.dropAllEventFromBlockedKeyboardEventOfPaste()):(this.blobSocketCheckAndSend(r),this.processMonitorCtrlMetaWithKey("v"))}},onReturnCopiedText(e){!this._onReturnCopiedText_list&&(this._onReturnCopiedText_list=[]),this._onReturnCopiedText_list.push(e)},triggerReturnCopiedText(e){this._onReturnCopiedText_list&&this._onReturnCopiedText_list.forEach((t=>t(e)))},onPasteTextLengthOverflow(e){!this._onPasteTextLengthOverflow_list&&(this._onPasteTextLengthOverflow_list=[]),this._onPasteTextLengthOverflow_list.push(e)},triggerPasteTextLengthOverflow(){this._onPasteTextLengthOverflow_list&&this._onPasteTextLengthOverflow_list.forEach((e=>e()))},dropAllEventFromBlockedKeyboardEventOfPaste(){this.blockedKeyboardEventOfPaste=[]},createParamsFromKeyboardEvent:e=>({key:e.key,code:e.code,shiftKey:e.shiftKey,altKey:e.altKey,repeat:e.repeat,charCode:e.charCode,keyCode:e.keyCode,which:e.which,ctrlKey:e.ctrlKey,metaKey:e.metaKey}),sendAllEventFromBlockedKeyboardEventOfPaste(){for(w("blockedKeyboardEventOfPaste.length",this.blockedKeyboardEventOfPaste.length);this.blockedKeyboardEventOfPaste.length>0;){let e=this.blockedKeyboardEventOfPaste.shift();this._keyMouseEventHandler(e)}},_preventDefault(e){if(-1!==["keydown","keyup"].indexOf(e.type)){let t=["v","c","x"];for(let i=0;i<t.length;i++)if(e.ctrlKey^e.metaKey&&this.isThisKeyIgnoreCase(e,t[i]))return}e.preventDefault()},subscribeSharingWidthOrHeightChange(){let e=this;this.PUBSUB_SHARING_PARAM_INFO_TOKEN=p.A.on(n.vjv,((t,i)=>{w("subscribeSharingWidthOrHeightChange",i.body),e.positionMap.dst.w=i.body.logicWidth,e.positionMap.dst.h=i.body.logicHeight,e.positionMap.src.w=i.body.logicWidth,e.positionMap.src.h=i.body.logicHeight,e.sendPostionPDU()}))},setDstWidthAndHeight(e,t){if(!e||!t)throw new Error("the value of destination sharing video width/height are not correct");this.positionMap.dst.w=e,this.positionMap.dst.h=t},setSrcWidthAndHeight(e,t){if(!e||!t)throw new Error("the value of source sharing video width/height are not correct");this.positionMap.src.w=e,this.positionMap.src.h=t},setSrcWidthAndHeightAndSendPDU(e,t){if(!e||!t)throw new Error("the value of source sharing video width/height are not correct");this.positionMap.src.w!==e&&this.positionMap.src.h!==t&&(this.setSrcWidthAndHeight(e,t),this.sendPostionPDU())},setSrcOffsetXYAndSendPDU(e,t){e=Math.floor(e),t=Math.floor(t),this.positionMap.canvas.offsetX===e&&this.positionMap.canvas.offsetY===t||(this.setSrcOffsetXY(e,t),this.sendPostionPDU())},setSrcScaleWidthAndHeight(e,t){if(!e||!t)throw new Error("the value of source sharing video scaleWidth/scaleHeight are not correct");this.positionMap.src.scaleWidth=e,this.positionMap.src.scaleHeight=t},setSrcOffsetXY(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=Math.floor(e),r=Math.floor(t);if(!A()(i)&&!A()(r))throw new Error("the value of source offset x or y is not correct");this.positionMap.canvas.offsetX=i,this.positionMap.canvas.offsetY=r},sendPostionPDU(){let e=new ArrayBuffer(36),t=new Uint8Array(e),i=new DataView(e,4),r=new DataView(e,20);t[0]=82,i.setInt32(0,this.positionMap.src.x,!0),i.setInt32(4,this.positionMap.src.y,!0),i.setInt32(8,this.positionMap.src.w,!0),i.setInt32(12,this.positionMap.src.h,!0),r.setInt32(0,this.positionMap.dst.x,!0),r.setInt32(4,this.positionMap.dst.y,!0),r.setInt32(8,this.positionMap.dst.w,!0),r.setInt32(12,this.positionMap.dst.h,!0),w("send position pdu");try{this.blobSocket.send(e)}catch(e){}},unbindEvent(){let e=this,t=this.dom;t.removeEventListener("click",e.focus),t.removeEventListener("keydown",e.keyMouseEventHandler),t.removeEventListener("keyup",e.keyMouseEventHandler),document.removeEventListener("paste",e.pasteOnDocument),document.removeEventListener("copy",e.copyOnDocument),document.removeEventListener("cut",e.cutOnDocument),t.removeEventListener("contextmenu",e.preventDefault),t.removeEventListener("wheel",e.preventDefault),t.removeEventListener("dblclick",e.preventDefault),t.removeEventListener("keydown",e.preventDefault),t.removeEventListener("keyup",e.preventDefault),t.removeEventListener("dblclick",e.keyMouseEventHandler),t.removeEventListener("mousedown",e.keyMouseEventHandler),t.removeEventListener("mouseup",e.keyMouseEventHandler),t.removeEventListener("mousemove",e.keyMouseEventHandlerThrottle),t.removeEventListener("wheel",e.keyMouseEventHandler),window.removeEventListener("blur",e.browserBlurEventHandler)},bindEvent(){let e=this,t=this.dom;w("dom",t),t.addEventListener("click",e.focus),t.addEventListener("keydown",e.keyMouseEventHandler),t.addEventListener("keyup",e.keyMouseEventHandler),document.addEventListener("paste",e.pasteOnDocument),document.addEventListener("copy",e.copyOnDocument),document.addEventListener("cut",e.cutOnDocument),t.addEventListener("contextmenu",e.preventDefault),t.addEventListener("wheel",e.preventDefault),t.addEventListener("dblclick",e.preventDefault),t.addEventListener("keydown",e.preventDefault),t.addEventListener("keyup",e.preventDefault),t.addEventListener("dblclick",e.keyMouseEventHandler),t.addEventListener("mousedown",e.keyMouseEventHandler),t.addEventListener("mouseup",e.keyMouseEventHandler),t.addEventListener("mousemove",e.keyMouseEventHandlerThrottle),t.addEventListener("wheel",e.keyMouseEventHandler),window.addEventListener("blur",e.browserBlurEventHandler)},recordCurrentMousePosition(e){try{let t=this.positionMap,i=e.clientX,r=e.clientY;Object.assign(this.currentMousePositionProps,{clientX:i,clientY:r,x2video:i-t.canvas.offsetX,y2video:r-t.canvas.offsetY})}catch(e){}},resolvePosition(e){let t=e.clientX,i=e.clientY,r=this.positionMap;return t-=r.canvas.offsetX,i-=r.canvas.offsetY,t*=r.dst.w/r.src.scaleWidth,i*=r.dst.h/r.src.scaleHeight,t=Math.floor(t),i=Math.floor(i),{x:t,y:i}},generateBuffer(e){if(void 0!==e.key&&!/^[\x00-\x7F]*$/.test(e.key))throw new Error("params.key must only contain ascii character");let t=8;84===(e=Object.assign({v:0,x:0,y:0,dx:0,dy:0,repeat:0},e)).pduType&&(t+=4);let i=new ArrayBuffer(t),r=new Uint8Array(i),s=new DataView(i,4),o=new DataView(i,4);if(r[0]=e.pduType,r[1]=63&e.input_event_type,83===e.pduType)s.setUint16(0,e.x,!0),s.setUint16(2,e.y,!0);else if(84===e.pduType)o.setInt16(0,e.x,!0),o.setInt16(2,e.y,!0),o.setInt16(4,e.dx,!0),o.setInt16(6,e.dy,!0);else if(85===e.pduType){let t=new DataView(i,4),s=new DataView(i,6),o=new Uint8Array(i,2);t.setUint16(0,e.keyCode,!0),s.setUint16(0,e.charCode,!0);let a={shift:1,capslock:2,ctrl:4,alt:8,numlock:16,super:32},n=0;Object.keys(a).forEach((t=>{!0===e[t]&&(n+=a[t])})),o[0]=n,e.repeat&&(r[1]=32|r[1])}return i},processEvent(e){this.blobSocket&&this.blobSocketCheckAndSend(this.generateBuffer(e))},debug(e){let t=[],i={};t=85===e.pduType?["t","keyCode","charCode","key"]:["t","x","y","dx","dy","input_event_type"],t.forEach((t=>{i[t]=e[t]})),w("debug",JSON.stringify(i))},blockedPasteKeyboard(e){let t=this;return new Promise(((i,r)=>{t.isKeyboardEvent(e)&&t.isPasteEvent(e)?t.blockedKeyboardEventOfPaste.push(e):i(e)}))},isPasteEvent(e){let t=this.isThisKeyIgnoreCase(e,"v");return!!(e.ctrlKey^e.metaKey&&t)},isCopyEvent(e){let t=this.isThisKeyIgnoreCase(e,"c");return!!(e.ctrlKey^e.metaKey&&t)},isCutEvent(e){let t=this.isThisKeyIgnoreCase(e,"x");return!!(e.ctrlKey^e.metaKey&&t)},returnNewEventByTransformCtrlKeyOrCommandKey(e){let t=this.createParamsFromKeyboardEvent(e);switch(this.remoteOS){case E.Tl.WIN:Object.assign(t,{ctrlKey:!0,metaKey:!1});break;case E.Tl.MAC:Object.assign(t,{ctrlKey:!1,metaKey:!0});case E.Tl.UNKNOWN:}return new e.constructor(e.type,t)},transformCtrlCAndCommandC(e){let t=this;return new Promise(((i,r)=>{this.isKeyboardEvent(e)&&(e.ctrlKey||e.metaKey)&&t.isThisKeyIgnoreCase(e,"c")?(t.createParamsFromKeyboardEvent(e),i(t.returnNewEventByTransformCtrlKeyOrCommandKey(e))):i(e)}))},keyMouseEventHandlerFilter_MatainKeyDownUpMergeMap(e){return new Promise(((t,i)=>{try{this.isKeyboardEvent(e)&&e.key&&("keydown"!==e.type||e.repeat||(this.keydownupMergeRemoveMap[e.key]={t:+new Date,e}),"keydown"===e.type&&e.repeat&&delete this.keydownupMergeRemoveMap[e.key],"keyup"===e.type&&delete this.keydownupMergeRemoveMap[e.key])}catch(e){w.error(e)}t(e)}))},_browserBlurEventHandler(){this._checkAndClearKeydownupMergeRemoveMap(this.maxSleep,!0)},checkAndClearKeydownupMergeRemoveMap(){let e=this;this.checkAndClearKeydownupMergeRemoveMapInterval=setInterval((()=>{e._checkAndClearKeydownupMergeRemoveMap(this.maxSleep)}),100)},_checkAndClearKeydownupMergeRemoveMap(e,t){let i=this.keydownupMergeRemoveMap;Object.keys(i).forEach((r=>{let s=i[r];if(+new Date-s.t>=e||t){let e=new s.e.constructor("keyup",s.e);try{this._keyMouseEventHandler(e)}catch(e){}delete this.keydownupMergeRemoveMap[r]}}))},uncheckAndClearKeydownupMergeRemoveMap(){this._checkAndClearKeydownupMergeRemoveMap(0),clearInterval(this.checkAndClearKeydownupMergeRemoveMapInterval)},keyMouseFilters(e){return new Promise(((t,i)=>{t(e)})).then((e=>this.blockedPasteKeyboard(e))).then((e=>this.blockedCopyKeyboard(e))).then((e=>this.blockedCutKeyboard(e))).then((e=>this.keyMouseEventHandlerFilter_MatainKeyDownUpMergeMap(e))).then((e=>this.blockedSomeKeyboardEventNotHaveKeydownBefore(e))).then((e=>this.keyMouseEventHandlerFilter_EVERY_KEYUP_MUST_HAVE_KEYDOWN_BEFORE(e)))},blockedSingleMetaKey(e){return new Promise(((t,i)=>{this.isKeyboardEvent(e)&&e.key&&(/command/i.test(e.key)||/meta/i.test(e.key)||/control/i.test(e.key))&&!e.shiftKey&&!e.altKey&&e.ctrlKey^e.metaKey||t(e)}))},blockedCutKeyboard(e){let t=this;return new Promise(((i,r)=>{t.isKeyboardEvent(e)&&t.isCutEvent(e)||i(e)}))},blockedCopyKeyboard(e){let t=this;return new Promise(((i,r)=>{t.isKeyboardEvent(e)&&t.isCopyEvent(e)?t._blockedCopyKeyboardList.push(e):i(e)}))},blockedSomeKeyboardEventNotHaveKeydownBefore(e){return new Promise(((t,i)=>{if(this.isKeyboardEvent(e)&&e.key){let t=!1;if(["x","c","v"].forEach((i=>{this.isThisKeyIgnoreCase(e,i)&&(t=!0)})),"keyup"===e.type&&t&&!this.keyMouseEventHandlerFilter_every_keyup_must_have_keydown_before_Map[e.key])return}t(e)}))},keyMouseEventHandlerFilter_EVERY_KEYUP_MUST_HAVE_KEYDOWN_BEFORE(e){return new Promise(((t,i)=>{try{if(this.isKeyboardEvent(e)&&e.key&&("keydown"===e.type&&(this.keyMouseEventHandlerFilter_every_keyup_must_have_keydown_before_Map[e.key]=e),"keyup"===e.type)){let t=!!this.keyMouseEventHandlerFilter_every_keyup_must_have_keydown_before_Map[e.key];delete this.keyMouseEventHandlerFilter_every_keyup_must_have_keydown_before_Map[e.key];let i=!1;if(["meta"].forEach((t=>{this.isThisKeyIgnoreCase(e,t)&&(i=!0)})),!t&&!i){w.warn("keyup trigger, but no keydown before");let t=new e.constructor("keydown",e);this._keyMouseEventHandler(t)}}}catch(e){w.error(e)}t(e)}))},_keyMouseEventHandler(e){this.isKeyboardEvent(e)&&w("_keyMouseEventHandler keyboard",e);let t={},i={keydown:0,keyup:1,keychar:2},r={mousemove:0,mousedown:{left:1,right:4,middle:7},mouseup:{left:2,right:5,middle:8},mouseleftdbldown:3,mouserightdbldown:6,wheel:10},s=e.getModifierState?function(t){return e.getModifierState(t)}:function(e,t){return t},o=0,a=e.key&&1===e.key.length;if(-1!==["keydown","keyup"].indexOf(e.type))t.event_type=1,o=85,void 0!==i[e.type]&&(t.input_event_type=i[e.type]);else{if(-1===["mousedown","mouseup","mousemove","wheel","click","dblclick","contextmenu"].indexOf(e.type))return void w.warn("the event type cannot be handled");{t.event_type=0,this.recordCurrentMousePosition(e);let i=this.resolvePosition(e);if(Object.assign(t,{x:i.x,y:i.y}),o="wheel"===e.type?84:83,void 0!==r[e.type]&&(t.input_event_type=r[e.type]),-1!==["mousedown","mouseup"].indexOf(e.type)){let i;switch(e.button){case 0:default:i="left";break;case 1:i="middle";break;case 2:i="right"}t.input_event_type=r[e.type][i]}-1!==["dblclick"].indexOf(e.type)&&(t.input_event_type=r.mouseleftdbldown)}}if("wheel"===e.type){let i={deltaX:"dx",deltaY:"dy"};Object.keys(i).forEach((r=>{e[r]&&(t[i[r]]=e[r]>0?-100:100)}))}const n=this.ctrlMetaConvert({keyCode:e.keyCode,key:e.key,ctrlKey:e.ctrlKey,metaKey:e.metaKey});if(Object.assign(t,{t:e.type,pduType:o,keyCode:n.keyCode,charCode:a?e.key.charCodeAt(0):0,key:n.key,repeat:e.repeat,ctrl:n.ctrlKey,alt:e.altKey,super:n.metaKey,shift:e.shiftKey,capslock:s("CapsLock",!1),numlock:s("NumLock",!1)}),this.isKeyboardEvent(e)&&w("processEvent",JSON.stringify(t)),this.processEvent(t),t.input_event_type==r.mouseleftdbldown){let e=function(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?b(Object(i),!0).forEach((function(t){(0,v.A)(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):b(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}({},t);e.input_event_type=r.mouseup.left,this.processEvent(e)}},ctrlMetaConvert(e){const t=e.metaKey,i=e.ctrlKey;return(this.remoteOS===E.Tl.MAC&&this.localOS===E.Tl.WIN||this.remoteOS===E.Tl.WIN&&this.localOS===E.Tl.MAC)&&e.key&&(/Meta/i.test(e.key)?(e.ctrlKey=!0,e.keyCode=17,e.metaKey=i,e.key="Control"):/Control/i.test(e.key)&&(e.metaKey=!0,e.keyCode=91,e.ctrlKey=t,e.key="Meta")),e},isCapslock(e){var t=e.keyCode,i=e.key,r=e.shiftKey;return!!/[a-zA-Z]/.test(i)&&(i.charCodeAt(0)!==t?!r:r)},async stop(){this.blobSocket&&this.blobSocket.close(),this.blobSocket=null},async connectSocket(){var e=await this.createBlobSocket("".concat(this.socketURL,"/wc/media/").concat(this.meetingID,"?type=r&mode=2&cid=").concat(this.condID));return e.binaryType="blob",this.blobSocket=e,!0},socketBlobMessageHandler(){if(this.blobSocket){let e=this;this.blobSocket.addEventListener("message",(async function(t){let i=t.data,r=await a.Ay.readBlobAsBuffer(i,i.size),s=new Int8Array(r),o=s[0];if(88===o&&e.isControllerNow){let t=i.slice(8),r=await a.Ay.readBlob(t),o=s[4];w("COPY_TEXT_FROM_RWG",r,o),e.triggerReturnCopiedText({data:r,x:e.currentMousePositionProps.x2video,y:e.currentMousePositionProps.y2video})}0===o&&e.blobSocket.send(r)}))}},destroySocket(){try{this.blobSocket.close(),this.blobSocket=null}catch(e){w("destroySocket",e)}},createBlobSocket:e=>new Promise(((t,i)=>{var r=new WebSocket(e);r.addEventListener("open",(()=>{})),r.addEventListener("message",(e=>{try{let i=JSON.parse(e.data);0===i.evt&&i.body&&t(r)}catch(e){}})),r.addEventListener("error",(e=>{i(e)})),r.addEventListener("close",(()=>{i(new Error("socket close"))}))})),setRemoteOS(e){void 0!==e&&(this.remoteOS=e)}};const T=R;var I=i(3812),M=i.n(I),D=i(7080),P=i(2710),k=i(6687),O=i(2614),V=i(9710),N=i(3903),x=i(6603);const L=(0,u.A)("sdk.rtcUtil");let W=!1;class U{constructor(e,t,i,r,s){(0,v.A)(this,"reconnectRTCPeerConnectionLSS",(()=>{this.enableTCP?this.reconnectCount<this.reconnectMax&&this.reconnectCountBetweenCloseAndOpenAndSetTo0WhenDCOpen<this.reconnectMax&&(L("".concat(this.dataChannelLabel," reconnect reconnectTotalCount : ").concat(this.reconnectCount,"; reconnectCountBetweenCloseAndOpenAndSetTo0WhenDCOpen : ").concat(this.reconnectCountBetweenCloseAndOpenAndSetTo0WhenDCOpen,", reconnectMax : ").concat(this.reconnectMax)),this.reconnectCount+=1,this.reconnectCountBetweenCloseAndOpenAndSetTo0WhenDCOpen+=1,this.isRecover||d.A.Notify_APPUI(n.Lmp,{dataChannelCanOpen:W,type:this.connectionType===E.Xt.AUDIO?"a":"v"}),this.isRecover=!0,setTimeout((()=>{this.initConnection(this.connectionID,this.dataChannelLabel)}),1e3*Math.pow(2,this.reconnectCountBetweenCloseAndOpenAndSetTo0WhenDCOpen))):this.reconnectCount<this.reconnectMax&&this.reconnectCountBetweenCloseAndOpenAndSetTo0WhenDCOpen<this.retryCount?(L("".concat(this.dataChannelLabel," reconnect reconnectTotalCount : ").concat(this.reconnectCount,"; reconnectCountBetweenCloseAndOpenAndSetTo0WhenDCOpen : ").concat(this.reconnectCountBetweenCloseAndOpenAndSetTo0WhenDCOpen,", reconnectMax : ").concat(this.reconnectMax)),this.reconnectCount+=1,setTimeout((()=>{this.initConnection(this.connectionID,this.dataChannelLabel)}),this.retryInterval),this.reconnectCountBetweenCloseAndOpenAndSetTo0WhenDCOpen+=1):d.A.Notify_APPUI(n.Lmp,{dataChannelCanOpen:W,type:this.connectionType===E.Xt.AUDIO?"a":"v"})})),this.isLSSPlayer=i,this.isLSSPlayer&&(this.retryCount=r&&r.retryCount||2,this.retryTimeout=r&&r.retryTimeout||2e3,this.retryInterval=r&&r.retryInterval||0,this.enableTCP=s,this.isRecover=!1),this.rtcPeerConnection=null,this.dataChannel=null,this.id=Date.now()<<3|t,this.dataChannelLabel=null,this.datachannelcloselistener=null,this.datachannelopenlistener=null,this.rtcPeerConnectionCreatedListener=null,this.reconnectCount=0,this.reconnectMax=10,this.reconnectCountBetweenCloseAndOpenAndSetTo0WhenDCOpen=0,this.connectionID=null,this.pubSubTokenList=[],this.isForceClosed=!1,this.reconnectRTCPeerConnectionThrottle=_()((()=>{this.reconnectRTCPeerConnection()}),2e3),this.timeoutThenCloseInterval=null,this.userid=null,this.connectionType=t,this.dataChannelStatus="",this.delaycloseTimeout=0,this.delaycloseid_=0,this.netmgr=e,this.supportTransferDatachanel=!0,this.port=0}setUserid(e){this.userid=e}isSupportDataChannel(){return!!window.RTCDataChannel}iceClosed(e){this.isForceClosed||(L("rtcPeerConnection.iceClosed",e),this._close(!0),this._clear())}async initConnection(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"ZoomWebclientVideoDataChannel";D.A.add_monitor("DCCONN"),this.isSupportDataChannel()?(this.dataChannelLabel=t,this.connectionID=e,this.rtcPeerConnection=x.A.createPeerConnection({iceCandidatePoolSize:1}),this.rtcPeerConnection.addEventListener("iceconnectionstatechange",(e=>{if(this.isForceClosed)return;let t=this.rtcPeerConnection;if("failed"!==t.iceConnectionState&&"closed"!==t.iceConnectionState||(L("".concat(this.dataChannelLabel," iceconnectionstatechange"),t.iceConnectionState),D.A.add_monitor("ICECONNSTATECHANGE:"+this.dataChannelLabel),this.iceClosed(),this.delaycloseid_&&(clearTimeout(this.delaycloseid_),this.delaycloseid_=0)),"disconnected"===t.iceConnectionState&&!this.delaycloseid_){let e=this;this.delaycloseid_=setTimeout((()=>{e.delaycloseid_=0,e.iceClosed()}),e.delaycloseTimeout)}"connected"===t.iceConnectionState&&(t.getStats().then((e=>{e.forEach((t=>{this.parserPCPort(e,t)}))})),this.delaycloseid_&&(clearTimeout(this.delaycloseid_),this.delaycloseid_=0))})),await this.netmgr.ready()?(this._createDataChannel(this.netmgr),await this.rtcPeerConnection.createOffer().then((async t=>(L("original offer",JSON.stringify(t)),t.sdp=t.sdp.replace(/a=ice-ufrag:.+/g,"a=ice-ufrag:".concat(e)),L("modified offer",t),this.rtcPeerConnection.setLocalDescription(t)))).then((()=>{this.rtcPeerConnectionCreatedListener.call(null,this.rtcPeerConnection)}))):Promise.reject("net thread init error")):D.A.add_monitor("DCUNSUPPORT")}_close(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];D.A.add_monitor("RTCPeerConnUtil.CLOSE");try{this._closeDataChannel(),this.rtcPeerConnection&&this.rtcPeerConnection.close()}catch(e){c.Ay.error("Error when closing RTCPeerConnection",e)}finally{this.dataChannel=null,this.rtcPeerConnection=null,e&&this.datachannelcloselistener&&this.datachannelcloselistener(null),this.sendDataChannelStatusMonitorLog(),this.reconnectRTCPeerConnectionThrottle()}}forceClose(){D.A.add_monitor("DCFORCECLOSE:"+this.dataChannelLabel),L("forceClose : "+this.dataChannelLabel),this.isForceClosed=!0,this._close(!0),this._clear()}resetDataChannelTransfered(e){this.netmgr=e,this._close(!0),this._clear()}isDestroyed(){return this.isForceClosed}_clear(){this.timeoutThenCloseInterval&&clearTimeout(this.timeoutThenCloseInterval),this.timeoutThenCloseInterval=0,this.datachannelcloselistener=null,this.datachannelopenlistener=null,this.pubSubTokenList.forEach((e=>{p.A.unsubscribe(e)})),this.pubSubTokenList=[]}onConnectionCreated(e){this.rtcPeerConnectionCreatedListener=e}reconnectRTCPeerConnection(){this.isForceClosed||(this.isLSSPlayer?this.reconnectRTCPeerConnectionLSS():this.reconnectCount<this.reconnectMax&&this.reconnectCountBetweenCloseAndOpenAndSetTo0WhenDCOpen<this.reconnectMax&&(L("".concat(this.dataChannelLabel," reconnect reconnectTotalCount : ").concat(this.reconnectCount,"; reconnectCountBetweenCloseAndOpenAndSetTo0WhenDCOpen : ").concat(this.reconnectCountBetweenCloseAndOpenAndSetTo0WhenDCOpen,", reconnectMax : ").concat(this.reconnectMax)),this.reconnectCount+=1,this.reconnectCountBetweenCloseAndOpenAndSetTo0WhenDCOpen+=1,setTimeout((()=>{this.initConnection(this.connectionID,this.dataChannelLabel)}),1e3*Math.pow(2,this.reconnectCountBetweenCloseAndOpenAndSetTo0WhenDCOpen))))}oneSingleLineLog(e){setTimeout((()=>{D.A.send_instant_monitor(),D.A.add_monitor(e),D.A.send_instant_monitor()}),0)}checkEmptyUserIdAndResendMonitor(e){e&&this.userid!=e&&(this.setUserid(e),this.sendDataChannelStatusMonitorLog())}sendDataChannelStatusMonitorLog(){this.userid&&("OPEN"===this.dataChannelStatus?(D.A.add_monitor("DCOPEN:"+this.dataChannelLabel),this.oneSingleLineLog("".concat(P.fT,",").concat(this.userid,",").concat(this.connectionType,",DCOPEN,").concat(P.fT))):"CLOSED"===this.dataChannelStatus&&(D.A.add_monitor("DCCLOSE:"+this.dataChannelLabel),this.oneSingleLineLog("".concat(P.fT,",").concat(this.userid,",").concat(this.connectionType,",DCCLOSE,").concat(P.fT))))}_closeDataChannel(){if(this.dataChannel)try{this.dataChannelStatus="CLOSED",this.dataChannel.close()}catch(e){c.Ay.error("Error when trying to close existing RTCDataChannel",e)}finally{this.dataChannel=null}}_createDataChannel(e){this._closeDataChannel();let t=this.rtcPeerConnection.createDataChannel(this.dataChannelLabel,{ordered:!1,reliable:!1,maxRetransmits:0});const i=e.isUseTransferRTC()?e.getWorker():null;t.binaryType="arraybuffer";let r="".concat(this.id,"-").concat(Math.floor(performance.now())),s=new k.h(r,this.connectionType,t,i,"",e);this.connectionType==E.Xt.VIDEO?s.transportlists=[V.vK.VIDEO_NETRTC]:s.transportlists=[V.vK.AUDIO_NETRTC],s.report_monitor_func=(e,t)=>{D.A.add_monitor("".concat(e,":").concat(t))},s.open(),s.onopen((e=>{(0,O.uB)(s),this.datachannelopenlistener&&this.datachannelopenlistener(e),this.reconnectCountBetweenCloseAndOpenAndSetTo0WhenDCOpen=0,clearTimeout(this.timeoutThenCloseInterval),this.dataChannelStatus="OPEN",this.sendDataChannelStatusMonitorLog(),this.isLSSPlayer&&(W=!0,d.A.Notify_APPUI(n.hG),this.isRecover&&this.enableTCP&&(this.isRecover=!1,d.A.Notify_APPUI(n.BBN,{type:this.connectionType===E.Xt.AUDIO?"a":"v"})))})),s.onclose((e=>{(0,O.np)(s),this._ondatachannelclosed(e)})),s.onerror((e=>{(0,O.np)(s);const t=e.error||{};c.Ay.warn("WebRTC DataChannel ".concat(this.dataChannelLabel," received error with errorDetail: ").concat(t.errorDetail),t),clearTimeout(this.timeoutThenCloseInterval),D.A.add_monitor("DCERROR","".concat(this.dataChannelLabel,": ").concat(t.message,", error detail: ").concat(t.errorDetail)),L("dataChannel.onerror",e)})),this.dataChannel=s}_ondatachannelclosed(e){"CLOSED"!=this.dataChannelStatus&&(clearTimeout(this.timeoutThenCloseInterval),L("dataChannel.onclose",e),this.dataChannelStatus="CLOSED",this.datachannelcloselistener&&this.datachannelcloselistener(e),this._close(),this._clear())}onDataChannelClose(e){this.datachannelcloselistener=e}onDataChannelOpen(e){this.datachannelopenlistener=e}waitForAnswerFromRWG(e){let t=this;return new Promise(((i,r)=>{let s=p.A.on(e,((e,s)=>{t.isDestroyed()&&r(),i(s)}));this.pubSubTokenList.push(s)}))}setRemoteDescription(e){L("setRemoteDescription",e),this.rtcPeerConnection.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e.sdp}))}closeIfTimeout(){clearTimeout(this.timeoutThenCloseInterval),this.timeoutThenCloseInterval=setTimeout((()=>{L("closeIfTimeout"),this._close()}),this.isLSSPlayer?this.retryTimeout:1e4)}addIceCandidate(e){this.rtcPeerConnection.addIceCandidate(new RTCIceCandidate({candidate:e,sdpMLineIndex:0,sdpMid:"0"}))}parserPCPort(e,t){let i=0;if("candidate-pair"===t.type){const r=e.get(t.remoteCandidateId);t.selected&&r&&(i=r.port)}else if("transport"===t.type&&t.selectedCandidatePairId){let r=e.get(t.selectedCandidatePairId);const s=e.get(r.remoteCandidateId);s&&(i=s.port)}i&&i!=this.port&&(this.port=i,c.Ay.directReport("".concat(this.dataChannelLabel,"dataChannel port: ").concat(i)))}resetRtc(e){this.supportTransferDatachanel=e,this._close(!0),this._clear()}}var B=i(3647),F=i(9407),H=i(3578),G=i(5169),j=i(5723),K=i(5980);function z(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,r)}return i}function q(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?z(Object(i),!0).forEach((function(t){(0,v.A)(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):z(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}const Y=function(e,t){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:16/9;if(!e||!t)return null;const r=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:0)||0,s=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)||0;if(e/t>i){const o=t*i;return{width:o,height:t,left:Math.round((e-o)/2)+r,top:0+s}}{const o=e/i;return{width:e,height:o,left:0+r,top:Math.round((t-o)/2)+s}}};function X(e,t,i){function r(e,t){return Math.min("px"===e.unit?e.value/t:e.value/100,.5)}return{radius_lb_x:r(e.topLeft.x,t),radius_lb_y:r(e.topLeft.y,i),radius_lt_x:r(e.bottomLeft.x,t),radius_lt_y:r(e.bottomLeft.y,i),radius_rb_x:r(e.topRight.x,t),radius_rb_y:r(e.topRight.y,i),radius_rt_x:r(e.bottomRight.x,t),radius_rt_y:r(e.bottomRight.y,i)}}const Q={radius_lb_x:0,radius_lb_y:0,radius_lt_x:0,radius_lt_y:0,radius_rb_x:0,radius_rb_y:0,radius_rt_x:0,radius_rt_y:0};function J(e){this.Notify_APPUI=e.Notify_APPUI,this.isSupportOffscreenCanvas=e.isSupportOffscreenCanvas,this.jsMediaEngine=e.jsMediaEngine,this.threadNumbs=e.videodecodethreadnumb,this.globalTracingLogger=e.globalTracingLogger,this.monitorLoggerFn=e.monitorLoggerFn,this.renderManager=e.renderManager,this.isLSSPlayer=e.isLSSPlayer,this.waterMarkCanvas=null,this.videoRenderLevel=10,this.videoRenderLevelCount=1,this.renderPeriodTotal=100,this.renderPeriodCount=0,this.renderPeriodTotalFps=0,this.renderPeriodFpsCount=0,this.lastRenderAudioTimeStamp=0,this.videoBufEmptyCount=0,this.videoBufCount=0,this.videoRenderMaxLevel=15,this.timestamp=0,this.audioPlayTime=0,this.videoTimestamp=0,this.videoWaterMarkName="",this.isCreateVideoWaterMark=!1,this.isWaterMarkRepeatedEnable=!1,this.waterMarkOpacity=.15,this.currentactive=0,this.audioPlaySsrc=0,this.currentVideoHeight=0,this.currentVideoWidth=0,this.videoRenderArray=[],this.WaterMarkRGBA=new H.A,this.vMonitorCount=0,this.videoQueue=new G.$8,this.timestart=0,this.rendingFlag=!0,this.rAFID=0,this.rAFIDBack=null,this.prevRequestAnimationTimestap=0,this.retryRequestAnimationStep=2,this.ssrcDisplayMap=new Map,this.ssrcHaddataMap=new Map,this.zoneLastRenderedMap=new Map,this.ssrcCurrentRenderingMap=new Map,this.pauseSet=new Set,this.canvasToLocalDisplay=new Map,this.canvasIdSet=new Set,this.selfvideossrc=0,this.localVideoPtr=0,this.sabBuffer=0,this.localvideossrc=0,this.encodedVideoSharedArrayBufferUint8Array=null,this.encodedVideoSharedArrayBufferUint16Array=null,this.encodedVideoSharedArrayWasmMemory=null,this.startCaptureVideo=!1,this.clearColor=new Uint8Array(4),this.videorendercanvas=null,this.keyrender=null,this.renderIndex=0,this.activeSpeakssrc=0,this.renderMode=0,this.intervalHandle,this.croppingParams={top:0,left:0,height:1,width:1},this.coordinate={x:0,y:0,width:640,height:360},this.bWebglContextLostProtectingMap=new Map,this.ismirror=!1,this.firstFrameMap=new Map,this.lfTimeStamp=0,this.activeFps=0,this.lastActiveSSRC=0,this.disableOriginalRatio=!1,this.onStopDrawCallback=e.onStopDrawCallback,this.onReStoreCallback=e.onReStoreCallback,this.videoRenderWGLFSTOP=!1}J.prototype.clearUseridRender=function(e,t,i,r){let s=e[0],o=s.display;if(o)if(!r&&o.setWatermarkFlag(0),this.renderMode)o.clearCanvas(t);else{let e=s.ssrc;if(!o||!t)return;this.croppingParams.top=0,this.croppingParams.left=0,this.croppingParams.height=1,this.croppingParams.width=1,this.clearColor[0]=255*t.R,this.clearColor[1]=255*t.G,this.clearColor[2]=255*t.B,this.clearColor[3]=255*t.A;const r=this.renderManager.getRendererProvider().isWebGLRendererType(),a=this.renderManager.getRendererProvider().isWebGL2RendererType(),n=this.renderManager.getRendererProvider().isWebGPURendererType();if(r||a){let e=this.canvasToLocalDisplay.get(s.canvas);if(!e)return;e.setVideoMode(P.rK),e.colorRange=0,e.setFillMode(1,1),e.setRoundedCornerRadius(Q),e.updateSelfVideoTextures(1,1,this.clearColor,this.croppingParams,!0),void 0===i&&((i={}).x=s.x,i.y=s.y,i.width=s.width,i.height=s.height),e.drawSelfVideo(i,!0)}else if(n){if(!o)return;o.setVideoMode(P.rK),o.setColorRange(0),o.setFillMode(1,1),o.setRoundedCornerRadius(Q),o.updateSelfVideoTextures(1,1,this.clearColor,this.croppingParams,!0),void 0===i&&((i={}).x=s.x,i.y=s.y,i.width=s.width,i.height=s.height),o.drawSelfVideo(i,!0)}let d=this;this.ssrcDisplayMap.forEach((function(t,i){let s,o;d.selfvideossrc&&i==d.Get_Logical_SSrc(d.selfvideossrc)&&(s=!0),i==d.Get_Logical_SSrc(e)&&(o=!0),t.forEach((e=>{if(!e.haddata||o)return;let t=e.display;d.coordinate.x=e.x,d.coordinate.y=e.y,d.coordinate.width=e.width,d.coordinate.height=e.height,t&&(!o||r&&a?t.getVideoMode()!=P.kh&&(-1==[P.rK,P.hd].indexOf(t.getVideoMode())&&s?t.drawSelfVideo(d.coordinate,!1,d.ismirror):s?t.drawRemoteVideo(d.coordinate,d.ismirror):t.drawRemoteVideo(d.coordinate)):(t.drawSelfVideo(d.coordinate,!0),this.isLSSPlayer&&d.firstFrameMap.get(e.ssrc)&&d.firstFrameMap.delete(e.ssrc)))}))})),this.renderManager.renderFor(B.gz.VIDEO)}},J.prototype.Set_Render_Array_rAF=function(e){if(this.videoRenderArray=e,this.ssrcDisplayMap.clear(),this.ssrcHaddataMap.clear(),this.videoRenderArray.length>0)for(let e=0;e<this.videoRenderArray.length;e++){let t=this.ssrcDisplayMap.get(this.Get_Logical_SSrc(this.videoRenderArray[e].ssrc));t?t.push(this.videoRenderArray[e]):(t=[],t.push(this.videoRenderArray[e]),this.ssrcDisplayMap.set(this.Get_Logical_SSrc(this.videoRenderArray[e].ssrc),t),this.ssrcHaddataMap.set(this.Get_Logical_SSrc(this.videoRenderArray[e].ssrc),!1))}},J.prototype.Set_Render_Array=function(e,t){this.renderMode?this.Set_Render_Array_IntervalMode(e,t):this.Set_Render_Array_rAF(e)},J.prototype.ClearQueue=function(){this.videoQueue&&this.videoQueue.ClearQueue(),this.currentVideoHeight=0,this.currentVideoWidth=0},J.prototype.Put_Video_Into_Buffer=function(e){if(this.videoQueue){var t=this.videoQueue.GetQueue(e.ssrc);if(t||(t=this.videoQueue.AddQueue(e.ssrc)),t.enqueue(e),this.videoQueue&&this.videoQueue.ssrcInfo){var i=e.ssrc>>10;this.videoQueue.ssrcInfo.UpdateSSRCInfo(i,e.ntptime)}for(var r=this.videoQueue.GetQueueLength(e.ssrc)-10;r>=0;)r--}},J.prototype.Update_RemoteVideo_Texture=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(this.Check_Request_Animation(),t)if(e&&i){let t=this.Get_Logical_SSrc(i),a=this.FindVideoRenderListFromMap(i);if(!a.length)return void this.renderManager.destroyUnusedVideoFrame(e);let n=this,d=o&&(1==r||3==r);this.ssrcHaddataMap.set(t,!0),s?(this.croppingParams.top=s.y,this.croppingParams.left=s.x,this.croppingParams.height=s.height,this.croppingParams.width=s.width):(this.croppingParams.top=e.visibleRect?0:e.cropTop,this.croppingParams.left=e.visibleRect?0:e.cropLeft,this.croppingParams.height=e.visibleRect?e.visibleRect.height:e.cropHeight,this.croppingParams.width=e.visibleRect?e.visibleRect.width:e.cropWidth);let{width:c,height:l}=e.visibleRect||{};if(c&&l||(l=this.croppingParams.height,c=this.croppingParams.width),d){let e=l;l=c,c=e,e=this.croppingParams.height,this.croppingParams.height=this.croppingParams.width,this.croppingParams.width=e}o&&(r=0),this.canvasIdSet.clear(),a&&a.forEach((t=>{t.haddata=!0;let i=t.display;n.coordinate.x=t.x,n.coordinate.y=t.y,n.coordinate.width=t.width,n.coordinate.height=t.height;let s=!(i&&i.reuse&&t.rendercanvasID&&this.canvasIdSet.has(t.rendercanvasID));i&&(i.setVideoMode(P.rK),n.Should_Update_Watermark(i,t.width,t.height,t.width,t.height)&&n.Update_Display_Watermark(i,t.width,t.height,t.width,t.height),e&&i.updateRemoteVideoTexturesImageBitmap(c,l,e,n.croppingParams,r,s),this.canvasIdSet.add(t.rendercanvasID))}))}else this.renderManager.destroyUnusedVideoFrame(e);else{if(e&&e.ssrc){let t=this.Get_Logical_SSrc(e.ssrc);if(this.isLSSPlayer&&this.pauseSet.has(t+" "+e.zone))return;let i,r=this.FindVideoRenderListFromMap(e.ssrc);if(!r.length)return e.yuvdataptr&&Module._free(e.yuvdataptr),void this.renderManager.destroyUnusedVideoFrame(e);let s=!1,o=this;this.ssrcHaddataMap.set(t,!0);let a=e;this.croppingParams.top=a.r_y,this.croppingParams.left=a.r_x,this.croppingParams.height=a.r_h,this.croppingParams.width=a.r_w,i=a,i.enableMultiDecodeVideoWithoutSAB?i.yuvdata=i.data:i.yuvdata=(0,j.Wp)().subarray(i.yuvdataptr,i.yuvdataptr+i.yuvlength),!i.yuvdata.length||i.yuvdata.length!=i.width*i.height*3/2||this.croppingParams.top<0||this.croppingParams.left<0||this.croppingParams.left+this.croppingParams.width>i.width||this.croppingParams.top+this.croppingParams.height>i.height||r&&(this.canvasIdSet.clear(),r.forEach((e=>{e.haddata=!0;let r=e.display;o.coordinate.x=e.x,o.coordinate.y=e.y,o.coordinate.width=e.width,o.coordinate.height=e.height;let a=!(r&&r.reuse&&e.rendercanvasID&&this.canvasIdSet.has(e.rendercanvasID));r&&(r.setVideoMode(P.Wp),this.Should_Update_Watermark(r,e.width,e.height,e.width,e.height)&&this.Update_Display_Watermark(r,e.width,e.height,e.width,e.height),i&&(this.isLSSPlayer&&this.ssrcCurrentRenderingMap.set(t,i),r.updateRemoteVideoTextures(i.width,i.height,o.croppingParams,i.yuvdata,i.rotation,i.yuv_limited,o.coordinate,s,a)),this.canvasIdSet.add(e.rendercanvasID))})))}else this.renderManager.destroyUnusedVideoFrame(e);e.yuvdataptr&&Module._free(e.yuvdataptr)}},J.prototype.Set_Cropping_Mode=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.disableOriginalRatio=!!e},J.prototype.Update_Cropping_Params=function(){if(this.disableOriginalRatio){const e=Y(this.croppingParams.width,this.croppingParams.height,this.croppingParams.left,this.croppingParams.top);e&&(this.croppingParams=q(q({},this.croppingParams),e))}},J.prototype.Update_SelfVideo_Texture=function(e,t,i,r){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:P.rK,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0;if(o?(this.croppingParams.top=o.top,this.croppingParams.left=o.left,this.croppingParams.width=o.width,this.croppingParams.height=o.height):(this.croppingParams.top=0,this.croppingParams.left=0,this.croppingParams.height=t,this.croppingParams.width=e),this.renderMode){let o=0;this.canvasIdSet.clear();const n=this.FindVideoRenderList(r);for(;o<n.length;o++){this.coordinate.x=n[o].x,this.coordinate.y=n[o].y,this.coordinate.width=n[o].width,this.coordinate.height=n[o].height,this.Update_Cropping_Params(),n[o].display.setVideoMode(s);const{display:r,width:d,height:c}=n[o];this.Should_Update_Watermark(r,d,c,d,c)&&this.Update_Display_Watermark(r,d,c,d,c);let l=!(r&&r.reuse&&n[o].rendercanvasID&&this.canvasIdSet.has(n[o].rendercanvasID));-1!==[P.rK,P.hd].indexOf(s)?(n[o].display.updateSelfVideoTextures(e,t,i,this.croppingParams,l,a),n[o].enableMultiDecodeVideoWithoutSAB?n[o].firstFrame=!0:n[o].display.drawSelfVideo(this.coordinate,!1,this.ismirror)):(n[o].display.updateRemoteVideoTextures(e,t,this.croppingParams,i,a,0,this.coordinate,!1,l),n[o].enableMultiDecodeVideoWithoutSAB?n[o].firstFrame=!0:n[o].display.drawRemoteVideo(this.coordinate,this.ismirror)),this.canvasIdSet.add(n[o].rendercanvasID)}this.renderManager.renderFor(B.gz.VIDEO)}else if(i&&r){let o=this.FindVideoRenderListFromMap(r);this.ssrcHaddataMap.set(r,!0);let n=this;o.length&&(this.canvasIdSet.clear(),o.forEach((r=>{r.haddata=!0,n.coordinate.x=r.x,n.coordinate.y=r.y,n.coordinate.width=r.width,n.coordinate.height=r.height,n.Update_Cropping_Params();let o=r.display,d=!(o&&o.reuse&&r.rendercanvasID&&this.canvasIdSet.has(r.rendercanvasID));o&&(o.setVideoMode(s),n.Should_Update_Watermark(o,r.width,r.height,r.width,r.height)&&n.Update_Display_Watermark(o,r.width,r.height,r.width,r.height),-1!==[P.rK,P.hd].indexOf(s)?o.updateSelfVideoTextures(e,t,i,n.croppingParams,d,a):o.updateRemoteVideoTextures(e,t,n.croppingParams,i,a,!0,n.coordinate,!1,d),this.canvasIdSet.add(r.rendercanvasID))})),this.renderManager.renderFor(B.gz.VIDEO))}},J.prototype.Draw_Send_Video_Img=function(e,t,i,r){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:P.rK,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.Update_SelfVideo_Texture(t,i,e,r,s,o)},J.prototype.setMirrorMyVideoOption=function(e){this.ismirror=e},J.prototype.Start_Draw=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return this.rendingFlag=!0,this.renderMode=e,e?t?(this.intervalHandle=setInterval(this.JsMediaSDK_VideoRender_interval.bind(this),t),this.intervalHandle):null:(function(e){if(e)te=e}(this),this.Start_Request_Animation_Frame())},J.prototype.Stop_Draw=function(){this.rendingFlag=!1,this.renderMode?clearInterval(this.intervalHandle):this.Stop_Request_Animation_Frame()},J.prototype.contextLostCallback=function(e){let t=e.currentTarget.canvasId;Z&&(0,j.O6)(t),e.preventDefault()},J.prototype.contextRestoredCallback=function(e){let t=e.currentTarget,i=t.canvasId,r=t.callback;this.Restored_From_Context_Lost(t,t,i,this.Log_Error.bind(this),r),this.onReStoreCallback&&this.onReStoreCallback(this),Z&&(0,j.br)(i)},J.prototype.webGLContextLostProtect=function(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;t&&t!==e&&(t.contextLostHandler&&t.removeEventListener("webglcontextlost",t.contextLostHandler),t.contextRestoredHandler&&t.removeEventListener("webglcontextrestored",t.contextRestoredHandler)),e&&!this.bWebglContextLostProtectingMap.get(e)&&(e.canvasId=i,e.callback=r,this.renderMode||((t=this.bWebglContextLostProtectingMap.get(i))&&(t.removeEventListener("webglcontextlost",t.contextLostHandler),t.removeEventListener("webglcontextrestored",t.contextRestoredHandler)),this.bWebglContextLostProtectingMap.set(i,e),e.contextLostHandler=this.contextLostCallback.bind(this),e.contextRestoredHandler=this.contextRestoredCallback.bind(this),e.addEventListener("webglcontextlost",e.contextLostHandler,{capture:!1}),e.addEventListener("webglcontextrestored",e.contextRestoredHandler,{capture:!1})))},J.prototype._Replace_Video_Render_Array_From_Context_LOST=function(e){let{canvas:t,oldCanvas:i,newDisplayMap:r}=e;for(let e=0;e<this.videoRenderArray.length;e++)if(this.videoRenderArray[e].canvas===i||this.videoRenderArray[e].canvas===t){i!==t&&(this.videoRenderArray[e].canvas=t);const o=this.videoRenderArray[e].display.getFillMode();var s;this.videoRenderArray[e].display=r?r.get(this.videoRenderArray[e].display.getTextureIndex()):this._Create_WebGL_Canvas({videoRenderArrayIndex:e,canvas:t,canvasId:this.videoRenderArray[e].rendercanvasID}),o&&this.videoRenderArray[e].display&&this.videoRenderArray[e].display.setFillMode(o,this.videoRenderArray[e].display.getFillModeForResolution()),this.videoRenderArray[e].borderRadius&&(null===(s=this.videoRenderArray[e].display)||void 0===s||s.setRoundedCornerRadius(this.videoRenderArray[e].borderRadius))}},J.prototype.Restored_From_Context_Lost=function(e,t,i,r){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;if(this.renderMode)this._Replace_Video_Render_Array_From_Context_LOST({canvas:e,oldCanvas:t});else{const o=this.renderManager.onRestoredFromContextLost(i,e,t,this.threadNumbs,r,this.canvasToLocalDisplay);o&&(this.ssrcDisplayMap.forEach(((i,r)=>{i.forEach((i=>{if(i.haddata=!1,i.canvas===t){t!==e&&(i.canvas=e);let r=i.display;i.display=o.get(r.getTextureIndex())}}))})),this._Replace_Video_Render_Array_From_Context_LOST({canvas:e,oldCanvas:t,newDisplayMap:o}),null==s||s({canvas:e,oldCanvas:t,newDisplayMap:o}),this.rendingFlag&&this.Start_Request_Animation_Frame())}},J.prototype.Replace_Canvas=function(e,t){let i=null;this.bWebglContextLostProtectingMap.forEach(((e,r)=>{r===t&&(i=e)})),i!=e&&(this.bWebglContextLostProtectingMap.delete(t),this.webGLContextLostProtect(e,i,t),this.Restored_From_Context_Lost(e,i,t,this.Log_Error.bind(this))),this.isSupportOffscreenCanvas&&(this.waterMarkCanvas||this.videorendercanvas)&&(this.waterMarkCanvas=this.videorendercanvas=new OffscreenCanvas(640,360))},J.prototype.Get_Display=function(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const s=this.renderManager.getRendererProvider().isWebGLRendererType(),o=this.renderManager.getRendererProvider().isWebGL2RendererType();return(s||o)&&this.webGLContextLostProtect(e,null,t,r),this.renderManager.getVideoRenderDisplay(e,t,this.threadNumbs,this.Log_Error.bind(this),this.canvasToLocalDisplay)},J.prototype.GiveBack_Display=function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=e[0];i&&i.display&&this.renderManager.recycleRenderDisplay(i.canvas,i.display,t)},J.prototype.Get_Logical_SSrc=function(e){return e?e>>10<<10:-1},J.prototype.Set_LocalVideo_Ptr=function(e){e&&(this.localVideoPtr=e)},J.prototype.Set_LocalVideo_Buffer=function(e){e&&(this.encodedVideoSharedArrayWasmMemory=e,this.sabBuffer=e.buffer,this.encodedVideoSharedArrayBufferUint8Array=new Uint8Array(this.sabBuffer),this.encodedVideoSharedArrayBufferUint16Array=new Uint16Array(this.sabBuffer))},J.prototype.Set_LocalVideo_SSRC=function(e){e&&(this.localvideossrc=e,this.selfvideossrc=e)},J.prototype.Draw_LocalVideo=function(){if(this.localVideoPtr&&this.sabBuffer&&this.localvideossrc){this.encodedVideoSharedArrayWasmMemory&&this.encodedVideoSharedArrayWasmMemory.buffer!=this.sabBuffer&&(this.encodedVideoSharedArrayBufferUint8Array=new Uint8Array(this.encodedVideoSharedArrayWasmMemory.buffer),this.encodedVideoSharedArrayBufferUint16Array=new Uint16Array(this.encodedVideoSharedArrayWasmMemory.buffer),this.sabBuffer=this.encodedVideoSharedArrayWasmMemory.buffer);let e=Atomics.load(this.encodedVideoSharedArrayBufferUint8Array,this.localVideoPtr),t=Atomics.load(this.encodedVideoSharedArrayBufferUint8Array,this.localVideoPtr+1),i=!0;if(e==t&&(i=!1),e-t==1&&(e=(e+1)%P.DG),i){let t=0,i=this.encodedVideoSharedArrayBufferUint16Array[this.localVideoPtr/2+(4+(P.g$+4+8+2)*e)/2],r=this.encodedVideoSharedArrayBufferUint16Array[this.localVideoPtr/2+(4+(P.g$+4+8+2)*e+2)/2],s=this.encodedVideoSharedArrayBufferUint16Array[this.localVideoPtr/2+(4+(P.g$+4+8+2)*e+4)/2],o=this.encodedVideoSharedArrayBufferUint16Array[this.localVideoPtr/2+(4+(P.g$+4+8+2)*e+6)/2],a=this.encodedVideoSharedArrayBufferUint16Array[this.localVideoPtr/2+(4+(P.g$+4+8+2)*e+8)/2],n=this.encodedVideoSharedArrayBufferUint16Array[this.localVideoPtr/2+(4+(P.g$+4+8+2)*e+10)/2],d=this.encodedVideoSharedArrayBufferUint16Array[this.localVideoPtr/2+(4+(P.g$+4+8+2)*e+12)/2],c=255&d,l=d>>8&255;t=c&&c!==P.hd?i*r*3/2:i*r*4,this.croppingParams.top=s,this.croppingParams.left=o,this.croppingParams.height=n,this.croppingParams.width=a;let h=this.encodedVideoSharedArrayBufferUint8Array.subarray(this.localVideoPtr+4+(P.g$+4+8+2)*e+4+8+2,this.localVideoPtr+4+(P.g$+4+8+2)*e+4+8+2+t);this.Update_SelfVideo_Texture(i,r,h,this.Get_Logical_SSrc(this.localvideossrc),c,this.croppingParams,l),Atomics.store(this.encodedVideoSharedArrayBufferUint8Array,this.localVideoPtr,(e+1)%P.DG)}}},J.prototype.Update_LocalVideo=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.localvideossrc;if(this.renderMode){let s=0,o=0,a=!1,n=this.FindVideoRenderList(r),d=i&&(1==t||3==t);for(;o<n.length;o++){a=!0;let r=e;this.croppingParams.top=r.visibleRect?0:r.cropTop,this.croppingParams.left=r.visibleRect?0:r.cropLeft,this.croppingParams.height=r.visibleRect?d?r.visibleRect.width:r.visibleRect.height:r.cropHeight,this.croppingParams.width=r.visibleRect?d?r.visibleRect.height:r.visibleRect.width:r.cropWidth,this.coordinate.x=n[o].x,this.coordinate.y=n[o].y,this.coordinate.width=n[o].width,this.coordinate.height=n[o].height,this.Update_Cropping_Params(),n[o].display.setVideoMode(s);const{display:c,width:l,height:h}=n[o];0!=l&&0!=h&&(this.Should_Update_Watermark(c,l,h,l,h)&&this.Update_Display_Watermark(c,l,h,l,h),-1!==[P.rK,P.hd].indexOf(s)&&(n[o].display.updateRemoteVideoTexturesImageBitmap(this.croppingParams.width,this.croppingParams.height,r,this.croppingParams,i?0:t),n[o].enableMultiDecodeVideoWithoutSAB?n[o].firstFrame=!0:n[o].display.drawSelfVideo(this.coordinate,!1,this.ismirror)))}a||this.renderManager.destroyUnusedVideoFrame(e)}else this.Update_RemoteVideo_Texture(e,!0,r,t,null,i)},J.prototype.Set_Capture_Video_Flag=function(e){this.startCaptureVideo=e},J.prototype.Get_Capture_Video_Flag=function(){return this.startCaptureVideo},J.prototype.FindVideoRender=function(e){if(!e)return null;for(let t=0;t<this.videoRenderArray.length;t++)if(this.videoRenderArray[t].ssrc&&this.videoRenderArray[t].ssrc>>10==e>>10)return this.videoRenderArray[t];return null},J.prototype.FindVideoRenderList=function(e){let t=this.isActiveSeakerSsrc(e),i=this.FindVideoRender(P.$K),r=[e>>10];t&&i&&r.push(P.$K>>10);let s=[];for(let e=0;e<this.videoRenderArray.length;e++)this.videoRenderArray[e].ssrc&&r.includes(this.videoRenderArray[e].ssrc>>10)&&s.push(this.videoRenderArray[e]);return s},J.prototype.FindVideoRenderListFromMap=function(e){let t=this.isActiveSeakerSsrc(e),i=[...this.ssrcDisplayMap.get(this.Get_Logical_SSrc(e))||[]];if(t){let e=this.ssrcDisplayMap.get(this.Get_Logical_SSrc(P.$K))||[];i.push(...e)}return i},J.prototype.JsMediaSDK_VideoRender_interval=function(){this.startCaptureVideo&&this.Draw_LocalVideo();let e=this.FindVideoRender(P.$K),t=this.FindVideoRender(this.activeSpeakssrc);if(0!=this.videoRenderArray.length){for(let r=0;r<this.videoRenderArray.length;r++){const s=this.videoRenderArray[r];if(this.isLSSPlayer&&this.pauseSet.has(s.ssrc+" "+s.zone))return;const{display:o,canvas:a,enableMultiDecodeVideoWithoutSAB:d,ssrc:c,isMyself:l}=s;var i=null;if(s==e&&t)continue;let h=c;s!=e||t||(h=this.activeSpeakssrc);let u=[s];if(s==t&&e&&u.push(e),this.isActiveSsrcVideo(h)){let e=Date.now();if(this.jsMediaEngine){let e=this.jsMediaEngine.Get_Video_SSRC_Latest_Time();this.timestamp=e.currentSSRCTime,this.audioPlayTime=e.audioPlayTime}this.calPacingTime(e),e-this.timestart<this.pacingTime&&e-this.timestart>0||(i=this.Get_Decoded_Video_Frame(this.Get_Logical_SSrc(h)),this.timestart=e)}else i=this.Get_Decoded_Video_Frame(this.Get_Logical_SSrc(h));if(i){let e;this.isActiveSsrcVideo(h)&&(this.videoTimestamp=i.ntptime),e=i.yuvdata instanceof j.Tm?i.yuvdata.yuvdata:i.yuvdata,this.croppingParams.top=i.r_y,this.croppingParams.left=i.r_x,this.croppingParams.height=i.r_h,this.croppingParams.width=i.r_w;const t=i.width>i.height&&(1===i.rotation||3===i.rotation)||i.width<i.height&&1!==i.rotation&&3!==i.rotation,r=t?i.height:i.width,s=t?i.width:i.height,{width:o,height:l}=a;if(this.currentVideoHeight==this.croppingParams.height&&this.currentVideoWidth==this.croppingParams.width||(this.Notify_APPUI?this.Notify_APPUI(n.XDu,{width:this.croppingParams.width,height:this.croppingParams.height}):postMessage({status:F.Rk,width:this.croppingParams.width,height:this.croppingParams.height}),this.currentVideoHeight=this.croppingParams.height,this.currentVideoWidth=this.croppingParams.width),e.length==i.width*i.height*3/2&&i.r_x>=0&&i.r_y>=0&&i.r_x+i.r_w<=i.width&&i.r_y+i.r_h<=i.height){8400==this.vMonitorCount&&(this.jsMediaEngine?this.jsMediaEngine.Send_Render_Monitor_Log("VDGLM"):postMessage({status:F.Zc,data:"VDGLW"}),this.vMonitorCount=0),this.vMonitorCount++;let t=this;u.forEach((a=>{a.display&&(t.Should_Update_Watermark(a.display,r,s,o,l)&&t.Update_Display_Watermark(a.display,r,s,o,l),d?a.display&&(a.display.setVideoMode(P.Wp),this.isLSSPlayer&&this.ssrcCurrentRenderingMap.set(c,i),a.display.updateRemoteVideoTextures(i.width,i.height,t.croppingParams,e,i.rotation,i.yuv_limited,a),a.firstFrame=!0):(a.display.setVideoMode(P.Wp),this.isLSSPlayer&&this.ssrcCurrentRenderingMap.set(c,i),a.display.drawNextOutputPictureFrame(i.width,i.height,t.croppingParams,e,i.rotation,i.yuv_limited,a)))}))}else this.Log_Error("Invalid YUV data: ".concat(i.r_x," ").concat(i.r_y," ").concat(i.r_w," ").concat(i.r_h," ").concat(i.width," ").concat(i.height));i.yuvdata instanceof j.Tm&&i.yuvdata.recycle()}d&&u.forEach((e=>{if(d&&e.firstFrame){const{x:t,y:i,width:r,height:s}=e,o={x:t,y:i,width:r,height:s};if(l)e.display.drawSelfVideo(o);else{if(this.isLSSPlayer){this.firstFrameMap.get(e.ssrc)||(this.firstFrameMap.set(e.ssrc,!0),this.Notify_APPUI?this.Notify_APPUI(n.vIC,{ssrc:e.ssrc,params:e.display.croppingParams}):postMessage({status:"FIRST_FRAME",ssrc:e.ssrc,params:e.display.croppingParams}));const t=this.ssrcCurrentRenderingMap.get(e.ssrc);e.display.drawRemoteVideo(o),t&&this.zoneLastRenderedMap.set(e.ssrc+" "+e.zone,t)}e.display.drawRemoteVideo(o)}}}))}this.renderManager.renderFor(B.gz.VIDEO)}},J.prototype.Get_Decoded_Video_Frame=function(e){if(this.videoQueue){var t=this.videoQueue.GetQueue(e);return t?t.dequeue():null}},J.prototype.Set_SSRC_Latest_Time_Stamp=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.timestamp!==e&&"number"==typeof e&&e&&(this.timestamp=e,this.audioPlaySsrc=t,this.audioPlayTime=Date.now())},J.prototype.Get_Decoded_Video_Buffer_Length=function(e){return this.videoQueue?this.videoQueue.GetQueueLength(e):0},J.prototype.Get_SSRC_VIDEO_FPS=function(e){if(e>>=10,this.videoQueue&&this.videoQueue.ssrcInfo){var t=this.videoQueue.ssrcInfo.GetSSRCFpsInfo(e);if(t)return Math.round(t)}return 0},J.prototype.Change_Current_SSRC=function(e){this.currentactive=e,this.ClearQueue()},J.prototype.Set_Render_Array_IntervalMode=function(e,t){if(this.videoRenderArray=e,this.isLSSPlayer&&this.ssrcDisplayMap.clear(),this.renderMode&&this.videoRenderArray.length>0)for(let e=0;e<this.videoRenderArray.length;e++){const s=this.videoRenderArray[e];var i;if(t){if(!s.display){if(s.enableMultiDecodeVideoWithoutSAB=t,s.display=this.Get_Display(s.canvas,s.canvas.id),s.display&&s.display.setFillMode(s.fillMode,s.fillModeForResolution),this.isLSSPlayer){let e=this.ssrcDisplayMap.get(this.Get_Logical_SSrc(s.ssrc));e||(e=[]),e.push(s),this.ssrcDisplayMap.set(this.Get_Logical_SSrc(s.ssrc),e)}var r;s.borderRadius&&(null===(r=s.display)||void 0===r||r.setRoundedCornerRadius(s.borderRadius))}}else this.renderManager.getRendererProvider().isWebGPURendererType()?s.display=this.Get_Display(s.canvas,s.rendercanvasID):s.display=this._Create_WebGL_Canvas({videoRenderArrayIndex:e,canvas:s.canvas,canvasId:s.rendercanvasID}),s.borderRadius&&(null===(i=s.display)||void 0===i||i.setRoundedCornerRadius(s.borderRadius)),this.webGLContextLostProtect(s.canvas,void 0,s.rendercanvasID)}},J.prototype._Create_WebGL_Canvas=function(e){let{videoRenderArrayIndex:t,canvas:i,canvasId:r}=e;const s={forceNoGL:void 0,contextOptions:{webglcontextlostCallback:this.webglcontextlostCallback.bind(this),webglcontextrestoredCallback:this.webglcontextrestoredCallback.bind(this),params:{videoRenderArrayIndex:t,canvas:i,canvasId:r}},webGLResources:void 0,initMask:!1};return this.renderManager.createWebGLVideoRenderDisplay(i,r,0,s)},J.prototype.webglcontextlostCallback=function(e,t){let{canvas:i,canvasId:r}=t;e.preventDefault()},J.prototype.webglcontextrestoredCallback=function(e,t){var i,r;let{videoRenderArrayIndex:s,canvas:o,canvasId:a}=t;var n;(!this.videoRenderArray||s>=(null===(i=this.videoRenderArray)||void 0===i?void 0:i.length))&&this.Log_Error("videoRenderArray:".concat(this.videoRenderArray,", length:").concat(null===(n=this.videoRenderArray)||void 0===n?void 0:n.length)),this.renderMode&&s<(null===(r=this.videoRenderArray)||void 0===r?void 0:r.length)&&(this.videoRenderArray[s].display=this._Create_WebGL_Canvas({videoRenderArrayIndex:s,canvas:o,canvasId:a}),this.Set_Render_Array(this.videoRenderArray))},J.prototype.ClearQueue=function(){try{let e=this.videoQueue.ssrcQueueMap;for(let[t,i]of e)for(;!i.isEmpty();){let e=i.dequeue();e.yuvdata&&e.yuvdata instanceof j.Tm&&e.yuvdata.recycle()}}catch(e){this.Log_Error("Exception during VideoRender.ClearQueue",e)}this.videoQueue&&this.videoQueue.ClearQueue(),this.currentVideoHeight=0,this.currentVideoWidth=0},J.prototype.Set_WaterMark_Info=function(e){let{waterMarkCanvas:t,isCreateVideoWaterMark:i,videoWaterMarkName:r,watermarkOpacity:s,watermarkRepeated:o,watermarkPosition:a}=e;this.waterMarkCanvas=t||this.videorendercanvas,this.isCreateVideoWaterMark=i,this.videoWaterMarkName=r,void 0!==o&&(this.isWaterMarkRepeatedEnable=!!o),void 0!==s&&(this.waterMarkOpacity=s),void 0!==a&&(this.watermarkPosition=a)},J.prototype.Set_WaterMark_Flag=function(e){if(this.videoRenderArray.length>0)for(let t=0;t<this.videoRenderArray.length;t++){const{display:i}=this.videoRenderArray[t];i.setWatermarkFlag(e?1:0)}},J.prototype.Should_Watermark_Repeated=function(e,t){return this.isWaterMarkRepeatedEnable&&e>K.fK&&t>K.qZ};const $=function(e,t){if(e<640&&e){const i=640/e;e=640,t=Math.round(t*i)}return{width:e,height:t}};J.prototype.Update_Display_Watermark=function(e,t,i,r,s){const o=this.Should_Watermark_Repeated(r,s);this.waterMarkCanvas||this.videorendercanvas||(this.videorendercanvas=this.isSupportOffscreenCanvas?new OffscreenCanvas(640,360):null);const a=r<K.n1||s<K.Ws?16:this.watermarkPosition,n=this.waterMarkCanvas||this.videorendercanvas;if("function"==typeof OffscreenCanvas&&n instanceof OffscreenCanvas&&OffscreenCanvasRenderingContext2D&&!OffscreenCanvasRenderingContext2D.prototype.measureText)return;const d=$(t,i);t=d.width,i=d.height;const c=o?this.WaterMarkRGBA.Get_Repeated_WaterMarkRGBA({canvas:n,name:this.videoWaterMarkName,width:t,height:i,opacity:this.waterMarkOpacity,position:a}):this.WaterMarkRGBA.Get_WaterMarkRGBA({canvas:n,name:this.videoWaterMarkName,width:t,height:i,opacity:this.waterMarkOpacity,position:a});e.updateWatermark(t,i,c)},J.prototype.Should_Update_Watermark=function(e,t,i,r,s){if(!this.isCreateVideoWaterMark)return!1;let o=!1;const a=$(t,i);a.width===e.getWatermarkWidth()&&a.height===e.getWatermarkHeight()||(o=!0);const n=this.Should_Watermark_Repeated(r,s);e.isSetWatermark()||(o=!0),n!==e.isWatermarkRepeated()&&(o=!0,e.setWatermarkRepeated(n)),this.waterMarkOpacity&&this.waterMarkOpacity!==e.getWatermarkOpacity()&&(o=!0,e.setWatermarkOpacity(this.waterMarkOpacity),this.waterMarkOpacity=e.getWatermarkOpacity());const d=t<K.n1||i<K.Ws?16:this.watermarkPosition;return d!==e.getWatermarkPosition()&&(o=!0,e.setWatermarkPosition(d),this.watermarkPosition=e.getWatermarkPosition()),o},J.prototype.calCulateActiveFps=function(e){this.activeFps&&e>=this.lfTimeStamp?this.activeFps=500/(e-this.lfTimeStamp)+this.activeFps/2:this.lfTimeStamp&&(this.activeFps=1e3/(e-this.lfTimeStamp))},J.prototype.Put_Video_Data_Queue=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:30;if(this.videoQueue){var i=this.videoQueue.GetQueue(e.ssrc);if(i||(i=this.videoQueue.AddQueue(e.ssrc)),i.enqueue(e),(this.Get_Logical_SSrc(this.currentactive)==this.Get_Logical_SSrc(e.ssrc)||this.Get_Logical_SSrc(this.audioPlaySsrc)==this.Get_Logical_SSrc(e.ssrc))&&(this.lfTimeStamp&&this.calCulateActiveFps(e.ntptime),this.lfTimeStamp=e.ntptime),this.lastActiveSSRC!=e.ssrc&&(this.lfTimeStamp=0,this.activeFps=0),this.lastActiveSSRC=e.ssrc,this.videoQueue&&this.videoQueue.ssrcInfo){var r=e.ssrc>>10;this.videoQueue.ssrcInfo.UpdateSSRCInfo(r,e.ntptime)}for(var s=this.videoQueue.GetQueueLength(e.ssrc)-t;s>=0;){let t=this.Get_Decoded_Video_Frame(e.ssrc);t.yuvdata instanceof j.Tm&&t.yuvdata.recycle(),s--}}else e.yuvdata&&e.yuvdata instanceof j.Tm&&e.yuvdata.recycle()},J.prototype.Clear_OffScreenCanvas=function(e){e.contextLostHandler&&(e.removeEventListener("webglcontextlost",e.contextLostHandler),e.contextLostHandler=null),e.contextRestoredHandler&&(e.removeEventListener("webglcontextrestored",e.contextRestoredHandler),e.contextRestoredHandler=null),e.width=1,e.height=1},J.prototype.Zoom_Render=function(e){},J.prototype.Decode_Ssrc=function(e){return this.ssrcDisplayMap.has(this.Get_Logical_SSrc(e))||this.Get_Logical_SSrc(e)==this.Get_Logical_SSrc(this.selfvideossrc)};const Z="undefined"==typeof window;function ee(e){let t=Date.now(),i=te;if(t-ie<30&&t-ie>0)i.Start_Request_Animation_Frame(e);else if(ie=t,i.rendingFlag){try{i.startCaptureVideo&&i.localVideoPtr&&i.Draw_LocalVideo(),i.ssrcDisplayMap.forEach((function(e,r){if(r!=i.Get_Logical_SSrc(P.$K)||!i.ssrcDisplayMap.has(i.Get_Logical_SSrc(i.activeSpeakssrc)))if(r==i.Get_Logical_SSrc(P.$K)&&(r=i.activeSpeakssrc),i.isActiveSsrcVideo(r))if(i.calPacingTime(t),t-i.timestart<i.pacingTime);else{i.timestart=t;let e=i.Get_Decoded_Video_Frame(i.Get_Logical_SSrc(r));e&&(i.Update_RemoteVideo_Texture(e),i.videoTimestamp=e.ntptime)}else{let e=i.Get_Decoded_Video_Frame(i.Get_Logical_SSrc(r));e&&i.Update_RemoteVideo_Texture(e)}})),i._render()}catch(e){i.Log_Error("Exception while rendering video",e)}i.Start_Request_Animation_Frame(e)}else i.rAFID&&i.Stop_Request_Animation_Frame()}var te;J.prototype.Check_Request_Animation=function(){Z&&this.rendingFlag&&this.prevRequestAnimationTimestap&&performance.now()-this.prevRequestAnimationTimestap>2e3&&!this.rAFIDBack&&(postMessage({status:F.vr,data:"WCL_M,RCIF"}),this.rAFID&&(cancelAnimationFrame(this.rAFID),this.rAFID=0),this.rAFIDBack=setInterval(ee.bind(null,!0),30))},J.prototype.Start_Request_Animation_Frame=function(e,t){if(!e&&this.rAFIDBack&&this.Stop_Request_Animation_Frame_Backup(),!this.rAFIDBack)return t||(this.retryRequestAnimationStep=2),this.prevRequestAnimationTimestap=performance.now(),this.rAFID=requestAnimationFrame(ee),this.rAFID},J.prototype.Stop_Request_Animation_Frame_Backup=function(){this.rAFIDBack&&(clearInterval(this.rAFIDBack),this.rAFIDBack=null)},J.prototype.Stop_Request_Animation_Frame=function(){this.rAFID&&cancelAnimationFrame(this.rAFID),this.rAFID=0,this.prevRequestAnimationTimestap=0,this.retryRequestAnimationStep=2,this.Stop_Request_Animation_Frame_Backup()},J.prototype.Add_Pause=function(e){this.pauseSet.add(e.ssrc+" "+e.zone)},J.prototype.Remove_Pause=function(e){const t=e.ssrc+" "+e.zone;this.pauseSet.has(t)&&this.pauseSet.delete(t)},J.prototype.Zoom_Render_Paused=function(e){if(this.pauseSet.has(e.ssrc+" "+e.zone)&&this.zoneLastRenderedMap.get(e.ssrc+" "+e.zone)){let t=this.ssrcDisplayMap.get(this.Get_Logical_SSrc(e.ssrc));t[0].x=e.x,t[0].y=e.y,t[0].width=e.width,t[0].height=e.height}this.Draw_Last_Frame()},J.prototype.Draw_Last_Frame=function(){for(const e of this.pauseSet.values()){const[t]=e.split(" "),i=this.zoneLastRenderedMap.get(e);if(i){let e=this.ssrcDisplayMap.get(this.Get_Logical_SSrc(t));const r=e&&e[0]&&e[0].display||null;if(r){const t=e[0];r.setVideoMode(P.Wp),this.Should_Update_Watermark(r,t.width,t.height,t.width,t.height)&&this.Update_Display_Watermark(r,t.width,t.height,t.width,t.height),r.updateRemoteVideoTextures(i.width,i.height,{top:i.r_y,left:i.r_x,height:i.r_h,width:i.r_w},i.yuvdata,i.rotation,i.yuv_limited,t),r.drawRemoteVideo({x:e[0].x,y:e[0].y,width:e[0].width,height:e[0].height})}}}},J.prototype.Log_Error=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.globalTracingLogger?this.globalTracingLogger.error(e,t):(0,j.r1)(e,t)},J.prototype._render=function(){let e=this;e.ssrcDisplayMap.forEach((function(t,i){const r=e.isSelfVideo(i);t.forEach((t=>{var i;let s=t.display;if(s&&(null!==(i=s.isAvaiable)&&void 0!==i&&i.call(s)||setTimeout((()=>{var e;null===(e=s.restoreContext)||void 0===e||e.call(s)}),5),t.haddata&&s.getVideoMode()!=P.kh))if(e.coordinate.x=t.x,e.coordinate.y=t.y,e.coordinate.width=t.width,e.coordinate.height=t.height,r&&-1!==[P.rK,P.hd].indexOf(s.getVideoMode()))s.drawSelfVideo(e.coordinate,!1,e.ismirror);else if(r)s.drawRemoteVideo(e.coordinate,e.ismirror);else{if(e.isLSSPlayer){e.firstFrameMap.get(t.ssrc)||(e.firstFrameMap.set(t.ssrc,!0),e.Notify_APPUI?e.Notify_APPUI(n.vIC,{ssrc:t.ssrc,params:t.display.croppingParams}):postMessage({status:"FIRST_FRAME",ssrc:t.ssrc,params:t.display.croppingParams}));const i=e.ssrcCurrentRenderingMap.get(t.ssrc);i&&e.zoneLastRenderedMap.set(t.ssrc+" "+t.zone,i)}s.drawRemoteVideo(e.coordinate)}}))})),e.renderManager.renderFor(B.gz.VIDEO)},J.prototype._singleRender=function(){let e=this;this.videoRenderArray.forEach((t=>{const{x:i,y:r,width:s,ssrc:o,height:a,enableMultiDecodeVideoWithoutSAB:n}=t,d=t.display,c=e.isSelfVideo(o),l={x:i,y:r,width:s,height:a};n?c?d.drawSelfVideo(l):d.drawRemoteVideo(l):d.drawNextOutputPictureFrame(d.getTextureWidth(),d.getTextureHeight(),d.getCroppingParams(),null,d.getRotation(),void 0,l,!1)}))},J.prototype.calPacingTime=function(e){if(this.pacingTime=30,this.activeFps>=1&&this.activeFps<=40&&(this.pacingTime=1e3/this.activeFps),this.timestamp&&this.videoTimestamp){let t=this.timestamp+e-this.audioPlayTime,i=this.videoTimestamp+this.pacingTime-t,r=this.currentactive?this.currentactive:this.audioPlaySsrc,s=this.videoQueue.GetQueueLength(this.Get_Logical_SSrc(r));i>65&&i<1e4&&s>=1&&(this.pacingTime=1.5*this.pacingTime),i<-65&&(this.pacingTime=1*this.pacingTime/2)}else this.timestamp||(this.pacingTime>150?this.pacingTime=1*this.pacingTime/2:this.pacingTime=this.pacingTime-10)},J.prototype.getRenderManager=function(){return this.renderManager},J.prototype.cleanup=function(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.renderManager.cleanup(e,t,i)},J.prototype.setActiveSpeakerSsrc=function(e){this.activeSpeakssrc=e},J.prototype.getActiveSpeakerSsrc=function(e){return this.activeSpeakssrc},J.prototype.isActiveSeakerSsrc=function(e){return this.activeSpeakssrc&&this.activeSpeakssrc>>10==e>>10},J.prototype.isActiveSsrcVideo=function(e){let t=e>>10;return t==this.currentactive>>10||t==this.audioPlaySsrc>>10},J.prototype.clearDraw=function(e){e&&(this.clearColor[0]=255*e.R,this.clearColor[1]=255*e.G,this.clearColor[2]=255*e.B,this.clearColor[3]=255*e.A)},J.prototype.isSelfVideo=function(e){return!!this.selfvideossrc&&(this.Get_Logical_SSrc(e)==this.Get_Logical_SSrc(this.selfvideossrc)||this.isActiveSeakerSsrc(this.selfvideossrc)&&e>>10==P.$K>>10)},J.prototype.reDraw=function(){this.renderMode?this._singleRender():this._render()},J.prototype.getUserIdVideo=function(e){let t=null,i=e==P.$K||this.isActiveSeakerSsrc(e);for(let r=0;r<this.videoRenderArray.length;r++){const s=this.videoRenderArray[r];if(s.ssrc>>10==e>>10||i&&s.ssrc==P.$K){const{width:e,height:i}=s;(!t||e*i>t.width*t.height)&&(t=s)}}if(!t||!t.display)return null;const r=t.canvas,s=t.rendercanvasID;let o=t.display.getTextureWidth(),a=t.display.getTextureHeight(),n=t.display.getRotation(),d=t.display.getViewPosition();if(1==n||3==n){let e=o;o=a,a=e}const{x:c,y:l,width:h,height:u}=t;let p=h,f=u,m=Math.floor(h*d[1]),v=Math.floor(u*d[0]);p=h-2*m,f=u-2*v;let g=r.height-u-l+v,_=c+m;return a=Math.floor(Math.min(f,a)),o=Math.floor(a*p/f),{canvasId:s,canvas:r,options:{x:_,y:g,width:p,height:f,displayWidth:o,displayHeight:a}}};var ie=0;const re=J;var se=i(456);function oe(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,r)}return i}function ae(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?oe(Object(i),!0).forEach((function(t){(0,v.A)(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):oe(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}const ne=8294400;function de(e,t){let i=e>>10;return t&&(i|=1<<23),i}function ce(e){this.Notify_APPUI=e.Notify_APPUI,this.PubSub=e.PubSub,this.jsMediaEngine=e.jsMediaEngine,this.globalTracingLogger=e.globalTracingLogger,this.renderManager=e.renderManager,this.currentshareactive=0,this.isFromMainSession=0,this.sharingWidthAndHeightInfo={logicHeight:0,logicWidth:0},this.isCreateSharingWaterMark=!1,this.sharingWaterMarkName="",this.isWaterMarkRepeatedEnable=!1,this.waterMarkOpacity=.15,this.WaterMarkRGBA=new H.A,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=P.sm,this.SharingRenderInterval=0,this.RAFhealthCheckInterval=0,this.RAFLastTime=0,this.brefresh=!1,this.statisticObj=null,this.renderarray=new Map,this.sharingCanvasMap=new Map,this.mMonitorCount=0,this.canvasLogicSize=new Map,this.canvasrealSize=new Map}ce.prototype.Start_Draw=function(){return this.requestAnimation=!0,this.Start_Request_Animation_Frame()},ce.prototype.Stop_Draw=function(){return this.requestAnimation=!1,this.lRTimeStamp=0,this.cATimeStamp=0,this.Stop_Request_Animation_Frame()},ce.prototype.Start_Request_Animation_Frame=function(){return this.rAFID=requestAnimationFrame(this.requestF),this.rAFID},ce.prototype.Stop_Request_Animation_Frame=function(){this.rAFID&&(cancelAnimationFrame(this.rAFID),this.rAFID=0)},ce.prototype.No_Bindthis_RAF=function(){let e=performance.now();this.RAFLastTime=e,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()},ce.prototype.addRender=function(e,t,i,r,s,o){let a=this.sharingCanvasMap.get(s);if(!a&&r&&this.sharingCanvasMap.set(s,r),!(r=r||a))return!1;r!=a&&a&&r&&this.replaceCanvas(s,r);const n=s||"0";this.canvasLogicSize.has(n)||this.UpdateCanvasSize(n,r.width,r.height,!1);const d=de(e,i),c=this.renderarray.get(d);if(c){if(c.canvasId==s)return c.logicViewPort=o,c.viewport=o,c.zone=t,o&&this.updateViewPort(ae({ssrc:e,zone:t,ismainSession:i},o)),!1;this.removeRender(c.ssrc,c.zone,c.ismainSession)}r.canvasId=s;let l=this.renderManager.getRenderDisplay(r,s,10,this.Log_Error.bind(this),null);return!!l&&(this.renderarray.set(d,{ssrc:e,zone:t,ismainSession:i,display:l,logicViewPort:o,viewport:o,canvas:r,canvasId:s,renderInfo:{xratio:1,yratio:1,logic_w:0,logic_h:0,real_w:0,real_h:0},screenQueue:new se.A,mouseQueue:new se.A}),o&&this.updateViewPort(ae({ssrc:e,zone:t,ismainSession:i},o)),this.renderarray.size>1&&(this.sharingWidthAndHeightInfo={logicHeight:0,logicWidth:0}),!0)},ce.prototype.getRender=function(e,t,i){if(null!=t){const i=de(e,t);return this.renderarray.get(i)}return Array.from(this.renderarray.values()).find((t=>t.ssrc>>10==e>>10))},ce.prototype.removeRender=function(e,t,i){var r,s;const o=this.getRender(e,i);if(!o||o.zone!=t)return!1;const a=de(o.ssrc,o.ismainSession);this.renderarray.delete(a);try{for(;!o.screenQueue.isEmpty();){let e=o.screenQueue.dequeue();e.yuvdata&&e.yuvdata instanceof j.Tm&&e.yuvdata.recycle(),e.dataptr&&Module._free(e.dataptr)}o.mouseQueue.clear()}catch(e){console.error("<<<< error",e)}null===(r=o.display)||void 0===r||null===(s=r.clearDisplay)||void 0===s||s.call(r),this.renderManager.recycleRenderDisplay(o.canvas,o.display,!1)},ce.prototype.removeAllRender=function(){let e=[];this.renderarray.forEach(((t,i)=>{e.push(t)})),e.forEach((e=>{this.removeRender(e.ssrc,e.zone,e.ismainSession)}))},ce.prototype.updateViewPort=function(e){const{ssrc:t,zone:i,isFromMainSession:r,rgba:s}=e,{x:o,y:a,width:n,height:d}=e,c=this.getRender(t,r);if(null!=c&&c.viewport&&(null==c?void 0:c.zone)==i){var l;const e=c.canvasId||"0",t=(null===(l=this.canvasrealSize.get(e))||void 0===l?void 0:l.ratio)||1;c.logicViewPort={x:o,y:a,width:n,height:d},c.viewport={x:Math.floor(o*t),y:Math.floor(a*t),width:Math.floor(n*t),height:Math.floor(d*t)}}},ce.prototype._deleteOldCanvas=function(e,t){let i=[];return this.renderarray.forEach(((e,r)=>{e.canvasId==t&&i.push(e)})),i.forEach((e=>{this.removeRender(e.ssrc,e.zone,e.ismainSession)})),i},ce.prototype.isHasRender=function(){return!!this.renderarray.size},ce.prototype.isSharingCanvas=function(e){return!!this.sharingCanvasMap.get(e)},ce.prototype.replaceCanvas=function(e,t){const i=this.sharingCanvasMap.get(e);if(i==t)return;let r=this._deleteOldCanvas(null,e);this.sharingCanvasMap.delete(e),this.renderManager.clearOffscreenCanvas(i),t?(this.sharingCanvasMap.set(e,t),r.forEach((i=>{const{ssrc:r,zone:s,ismainSession:o,viewport:a}=i;this.addRender(r,s,o,t,e,a)}))):(this.canvasLogicSize.delete(e),this.canvasrealSize.delete(e))},ce.prototype.No_Bindthis_Interval=function(){let e=performance.now();this.calPacingTime(e),e-this.timestart>this.pacingtime&&(this.timestart=e,this.JsMediaSDK_SharingRender())},ce.prototype.calPacingTime=function(e){this.pacingtime=30,this.sharingFps&&this.sharingFps>0&&this.sharingFps<100&&(this.pacingtime=1e3/this.sharingFps);let t=this.Get_Current_QueueLength();if(this.cATimeStamp&&this.lRTimeStamp){let i=this.cATimeStamp+e-this.asTime;this.vaTimeDelta=this.lRTimeStamp+this.pacingtime-i,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)},ce.prototype.render_monitor_log=function(e){this.jsMediaEngine?this.jsMediaEngine.Send_Render_Monitor_Log(e):postMessage({status:F.SG,data:e})},ce.prototype.JsMediaSDK_SharingRender=function(){var e;if(!this.renderarray.size)return;null===(e=this.statisticObj)||void 0===e||e.sample();const t=this.brefresh||Array.from(this.renderarray.values()).some((e=>e.screenQueue.getLength()||e.mouseQueue.getLength()));this.brefresh=!1,this.renderarray.forEach(((e,i)=>{var r;const{display:s,screenQueue:o,mouseQueue:a,canvas:n}=e,d=e.ssrc>>10<<10;var c;if(!1===(null===(r=s.isAvaiable)||void 0===r?void 0:r.call(s)))return void(null===(c=s.restoreContext)||void 0===c||c.call(s));const l=o.dequeue(),h=a.dequeue();var u=e.viewport;if(u||(u={x:0,y:0,width:null==n?void 0:n.width,height:null==n?void 0:n.height}),h){const{xratio:t,yratio:i}=e.renderInfo,r=h.r_x*t,o=h.r_y*i,a=h.width*t,n=h.height*i;s.updateCursor(h.width,h.height,h.buffer,h.sync_id),s.updateCursorPosInfo(1,r,o,a,n),++this.mMonitorCount%3e3==0&&this.render_monitor_log("SDSBM")}if(l){let t,i;this.lRTimeStamp=Math.max(l.ntptime,this.lRTimeStamp),l.yuvdata instanceof j.Tm?(t=l.yuvdata.yuvdata,i=l.yuvdata):(t=l.yuvdata,i=null);var p=l.logic_h,f=l.logic_w,m=l.r_h,v=l.r_w;e.renderInfo.xratio=v/f,e.renderInfo.yratio=m/p;const r={top:l.r_x,left:l.r_y,height:l.r_h,width:l.r_w},o=u.width,a=u.height;this.Should_Update_Watermark(s,o,a)&&this.Update_Display_Watermark(s,o,a),s.drawNextOutputPictureFrame(l.width,l.height,r,t,null,l.yuv_limited,u),i&&i.recycle(),l.dataptr&&Module._free(l.dataptr)}else if(t&&s.isHasWholeFrame()){const e=u.width,t=u.height;this.Should_Update_Watermark(s,e,t)&&this.Update_Display_Watermark(s,e,t),s.drawNextOutputPictureFrame(s.getTextureWidth(),s.getTextureHeight(),s.getCroppingParams(),null,null,!0,u,!1)}this.UpdateSharingLogicWidthHeightInfo(d,e.canvasId,e.renderInfo,!1)})),t&&this.renderManager.renderFor(B.gz.SHARE)},ce.prototype.setOnlyAcceptUISize=function(e){this.bOnlyAcceptUISize=e},ce.prototype.updateOffscreenCanvasSize=function(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];const o=this.renderarray.size;if(void 0===e&&o>1&&(this.render_monitor_log("UASCANVASERROR:".concat(o)),this.Log_Error("Error updating OffscreenCanvas size > 1 canvasId is null")),!this.bOnlyAcceptUISize||r)try{this.UpdateCanvasSize(e,t,i,s,r),this.brefresh=!0}catch(e){this.Log_Error("Error updating OffscreenCanvas size",e)}},ce.prototype.UpdateCanvasSize=function(e,t,i,r,s){var o;let a=[],n=Array.from(this.renderarray.values());for(let t=0;t<n.length;t++){const i=n[t];i.canvasId!=e&&void 0!==e||a.push(i)}if(void 0===e&&1!=a.length)return;const d=e||"0";this.canvasLogicSize.set(d,{width:t,height:i});const c="undefined"!=typeof DedicatedWorkerGlobalScope;let l={width:t,height:i,ratio:1};if(t*i>ne&&c){const e=Math.sqrt(ne/(t*i));l.width=Math.round(t*e),l.height=Math.round(i*e),l.ratio=e}this.canvasrealSize.set(d,l);const{width:h,height:u,ratio:p}=l;a.forEach((e=>{const t=null==e?void 0:e.logicViewPort;if(!s||!t)return;const{x:i,y:r,width:o,height:a}=t;e.viewport={x:Math.floor(i*p),y:Math.floor(r*p),width:Math.floor(o*p),height:Math.floor(a*p)}}));const f=null===(o=a[0])||void 0===o?void 0:o.canvas;var m;f&&f instanceof OffscreenCanvas&&(f.width!=h||f.height!=u)&&(f.width=h,f.height=u,null===(m=a[0].display)||void 0===m||m.resizeCanvasTo(h,u),r&&(this.brefresh=!0,this.JsMediaSDK_SharingRender()))},ce.prototype.Change_Current_SSRC=function(e,t){this.currentshareactive=e,this.isFromMainSession=t;const i=de(e,t),r=this.renderarray.get(i);this.firstFrameForIOS=!1,r&&this.UpdateUserSharingInfo(r)},ce.prototype.Set_WaterMark_Info=function(e){let{waterMarkCanvas:t,isCreateSharingWaterMark:i,sharingWaterMarkName:r,watermarkOpacity:s,watermarkRepeated:o,watermarkPosition:a}=e;this.Replace_WaterMark_Canvas(t),this.isCreateSharingWaterMark=i,this.sharingWaterMarkName=r,void 0!==o&&(this.isWaterMarkRepeatedEnable=!!o),void 0!==s&&(this.waterMarkOpacity=s),void 0!==a&&(this.watermarkPosition=a),this.renderarray.forEach(((e,t)=>{var i;null===(i=e.display)||void 0===i||i.setWatermarkFlag(this.isCreateSharingWaterMark?1:0)}))},ce.prototype.Replace_WaterMark_Canvas=function(e){this.waterMarkCanvas=e},ce.prototype.Should_Watermark_Repeated=function(e,t){return this.isWaterMarkRepeatedEnable&&e>K.fK&&t>K.qZ};const le=function(e,t){if(e<640&&e){const i=640/e;e=640,t=Math.round(t*i)}return{width:e,height:t}};ce.prototype.Update_Display_Watermark=function(e,t,i){if("function"==typeof OffscreenCanvas&&this.waterMarkCanvas instanceof OffscreenCanvas&&OffscreenCanvasRenderingContext2D&&!OffscreenCanvasRenderingContext2D.prototype.measureText)return;const r=t<K.n1||i<K.Ws?16:this.watermarkPosition,s=this.Should_Watermark_Repeated(t,i),o=le(t,i);t=o.width,i=o.height;const a=s?this.WaterMarkRGBA.Get_Repeated_WaterMarkRGBA({canvas:this.waterMarkCanvas,name:this.sharingWaterMarkName,width:t,height:i,opacity:this.waterMarkOpacity,position:r}):this.WaterMarkRGBA.Get_WaterMarkRGBA({canvas:this.waterMarkCanvas,name:this.sharingWaterMarkName,width:t,height:i,opacity:this.waterMarkOpacity,position:r});e.updateWatermark(t,i,a)},ce.prototype.Should_Update_Watermark=function(e,t,i){if(!this.isCreateSharingWaterMark)return!1;let r=!1;const s=le(t,i);s.width===e.getWatermarkWidth()&&s.height===e.getWatermarkHeight()||(r=!0);const o=this.Should_Watermark_Repeated(t,i);e.isSetWatermark()||(r=!0),o!==e.isWatermarkRepeated()&&(r=!0,e.setWatermarkRepeated(o)),this.waterMarkOpacity&&this.waterMarkOpacity!==e.getWatermarkOpacity()&&(r=!0,e.setWatermarkOpacity(this.waterMarkOpacity),this.waterMarkOpacity=e.getWatermarkOpacity());const a=t<K.n1||i<K.Ws?16:this.watermarkPosition;return a!==e.getWatermarkPosition()&&(r=!0,e.setWatermarkPosition(a),this.watermarkPosition=e.getWatermarkPosition()),r},ce.prototype.Put_Sharing_Data_From_Queue=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:50;const i=de(e.ssrc,e.isFromMainSession);let r=this.renderarray.get(i);if(!r)return e.yuvdata instanceof j.Tm&&e.yuvdata.recycle(),void(e.dataptr&&Module._free(e.dataptr));this.firstFrameForIOS||e.ssrc>>10!=this.currentshareactive>>10||(this.firstFrameForIOS=!0,this.Notify_APPUI?this.Notify_APPUI(n.jhI,this.currentshareactive):postMessage({status:F.Vd,ssrc:this.currentshareactive})),this.brefresh=!0,r.screenQueue.enqueue(e);const s=e.ntptime-this.lfTimeStamp;this.lfTimeStamp&&s>0&&(this.sharingFps?this.sharingFps=500/s+this.sharingFps/2:this.sharingFps=1e3/s),this.sharingFps!=1/0&&this.sharingFps||(this.sharingFps=20),this.lfTimeStamp=e.ntptime;var o=r.screenQueue.getLength()-t;for(this.maxQueueLength=t;o>=0;){let e=r.screenQueue.dequeue();e.yuvdata instanceof j.Tm&&e.yuvdata.recycle(),e.dataptr&&Module._free(e.dataptr),o--}const a=r.renderInfo;a.real_h==e.r_h&&a.real_w==e.r_w&&a.logic_h==e.logic_h&&a.logic_w==e.logic_w||(a.real_h=e.r_h,a.real_w=e.r_w,a.logic_h=e.logic_h,a.logic_w=e.logic_w,this.UpdateUserSharingInfo(r))},ce.prototype.UpdateUserSharingInfo=function(e){const t=e.ssrc>>10<<10,i=e.renderInfo;if(0==i.logic_w||0==i.logic_h)return;const r=1==this.renderarray.size;this.Notify_APPUI?this.Notify_APPUI(n.cYb,{body:{nodeid:t,absHeight:i.real_h,absWidth:i.real_w,height:i.logic_h,width:i.logic_w,logicHeight:i.logic_h,logicWidth:i.logic_w}}):(postMessage({status:F.Rm,logicWidth:i.logic_w,logicHeight:i.logic_h,absHeight:i.real_h,absWidth:i.real_w,nodeid:t,updateRemoteInfo:r}),r&&this.updateOffscreenCanvasSize(e.canvasId,i.logic_w,i.logic_h,!1,!0))},ce.prototype.UpdateSharingLogicWidthHeightInfo=function(e,t,i,r){const s=1==this.renderarray.size,{logic_h:o,logic_w:a,real_w:d,real_h:c}=i;!s||this.sharingWidthAndHeightInfo.logicWidth==a&&this.sharingWidthAndHeightInfo.logicHeight==o||(this.updateOffscreenCanvasSize(t,a,o,!1,r),this.PubSub?PubSub.publish(n.vjv,{body:{width:a,height:o,logicWidth:a,logicHeight:o,absWidth:d,absHeight:c}}):postMessage({status:F.Rm,logicWidth:a,logicHeight:o,absWidth:d,absHeight:c,nodeid:e,updateRemoteInfo:s}),this.sharingWidthAndHeightInfo.logicWidth=a,this.sharingWidthAndHeightInfo.logicHeight=o)},ce.prototype.Put_Mouse_Data_Into_Queue=function(e){const t=de(e.ssrc,e.isFromMainSession);let i=this.renderarray.get(t);if(i){i.mouseQueue.enqueue(e);for(var r=i.mouseQueue.getLength()-10;r>=0;)i.mouseQueue.dequeue(),r--}},ce.prototype.Get_Current_QueueLength=function(){var e=de(this.currentshareactive,this.isFromMainSession);let t=this.renderarray.get(e);return t?t.screenQueue.getLength():0},ce.prototype.SetcATimeStamp=function(e){this.cATimeStamp=e,this.asTime=performance.now()},ce.prototype.Log_Error=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.globalTracingLogger?this.globalTracingLogger.error(e,t):(0,j.r1)(e,t)},ce.prototype.Log_DT=function(e){this.globalTracingLogger?this.globalTracingLogger.directReport(e):(0,j.fn)(e)},ce.prototype.setMode=function(e){this.Stop_Draw2(),this.renderMode=e},ce.prototype.Start_Draw2=function(e){var t;null===(t=this.statisticObj)||void 0===t||t.start(),this.renderMode?(this.SharingRenderInterval&&(clearInterval(this.SharingRenderInterval),this.SharingRenderInterval=0),this.SharingRenderInterval=setInterval((()=>{this.No_Bindthis_Interval()}),20)):(this.Start_Draw(),this.startRAFHealthCheck())},ce.prototype.Stop_Draw2=function(e){var t;null===(t=this.statisticObj)||void 0===t||t.stop(),this.renderMode?this.SharingRenderInterval&&(clearInterval(this.SharingRenderInterval),this.SharingRenderInterval=0):(this.Stop_Draw(),this.stopRAFHealthCheck())},ce.prototype.startRAFHealthCheck=function(){this.RAFLastTime=performance.now(),this.RAFhealthCheckInterval=setInterval((()=>{let e=performance.now();!this.renderMode&&e-this.RAFLastTime>2e3&&(this.Stop_Draw2(),this.setMode(P.hS),this.Start_Draw2(),this.Log_DT("Sharing RAF Failed"))}),2e3)},ce.prototype.stopRAFHealthCheck=function(){this.RAFLastTime=0,this.RAFhealthCheckInterval&&clearInterval(this.RAFhealthCheckInterval)},ce.prototype.reDraw=function(){this.brefresh=!0,this.JsMediaSDK_SharingRender()},ce.prototype.getUserIdVideo=function(e,t){const i=this.getRender(e,t),{canvasId:r,display:s,canvas:o,viewport:a}=i;if(!o||!s)return null;if(a){const{x:e,y:t,width:i,height:s}=a;return{canvasId:r,canvas:o,options:{x:e,y:t,width:i,height:s,displayWidth:i,displayHeight:s}}}const{width:n,height:d}=o;return{canvasId:r,canvas:o,options:{x:0,y:0,width:n,height:d,displayWidth:n,displayHeight:d}}};const he=ce;var ue=i(4895),pe=i(3485),fe=i(4865);class me{static async init(e,t){if(!window.navigator.hid||!window.navigator.hid.requestDevice)return!1;const i=this.webHid=new ve((e=>{switch(e.eventName){case"ondevicehookswitch":d.A.Notify_APPUI_SAFE(n.$8e,"on"===e.hookStatus);break;case"ondevicemuteswitch":D.A.add_monitor("HID_STATUS_CHANGE: ".concat(e.isMute)),d.A.Notify_APPUI_SAFE(n.tjY,e.isMute)}}));return await i.open({label:e,muted:t,hookStatus:"off"})}static sendReport(e,t){switch(e){case"hookswitch":this.webHid.sendDeviceReport({command:t?"offHook":"onHook"});break;case"mute":this.webHid.sendDeviceReport({command:t?"muteOn":"muteOff"})}}static async destroy(){await this.webHid.close()}}class ve{constructor(e){this.deviceUsage={mute:{usageId:524297,usageName:"Mute"},offHook:{usageId:524311,usageName:"Off Hook"},ring:{usageId:524312,usageName:"Ring"},hookSwitch:{usageId:720928,usageName:"Hook Switch"},phoneMute:{usageId:720943,usageName:"Phone Mute"}},this.deviceCommand={outputReport:{mute:{reportId:0,usageOffset:-1},offHook:{reportId:0,usageOffset:-1},ring:{reportId:0,itemIndex:-1}},inputReport:{hookSwitch:{reportId:0,usageOffset:-1,isAbsolute:!1},phoneMute:{reportId:0,usageOffset:-1,isAbsolute:!1}}},this.device=null,this.inputReportRetFunc=e}getHexByte(e){let t=Number(e).toString(16);for(;t.length<2;)t="0"+t;return t}getHexByteStr(e){let t="";for(let i=0;i<e.byteLength;++i)t+=this.getHexByte(e.getUint8(i))+" ";return t}parseDeviceDescriptors(){try{if(this.outputEventGenerators=new Map,!this.device||!this.device.collections)return;let e=this.device.collections.find((e=>11===e.usagePage));if(!e||0===Object.keys(e).length)return;if(e.inputReports&&!this.parseInputReports(e.inputReports))return!1;if(e.outputReports)return!!this.parseOutputReports(e.outputReports)}catch(e){console.error("parseDeviceDescriptors error:"+JSON.stringify(e,null," "))}}parseInputReports(e){return e.forEach((e=>{if(!e.items.length||void 0===e.reportId)return;let t=0;e.items.forEach((i=>{void 0!==i.usages&&void 0!==i.reportSize&&void 0!==i.reportCount&&void 0!==i.isAbsolute&&(i.usages.forEach(((r,s)=>{switch(r){case this.deviceUsage.hookSwitch.usageId:this.deviceCommand.inputReport.hookSwitch={reportId:e.reportId,usageOffset:t+s*i.reportSize,isAbsolute:i.isAbsolute};break;case this.deviceUsage.phoneMute.usageId:this.deviceCommand.inputReport.phoneMute={reportId:e.reportId,usageOffset:t+s*i.reportSize,isAbsolute:i.isAbsolute}}})),t+=i.reportCount*i.reportSize)}))})),0!==this.deviceCommand.inputReport.phoneMute.reportData&&0!==this.deviceCommand.inputReport.hookSwitch}parseOutputReports(e){let t,i,r;e.forEach((e=>{if(!e.items.length||void 0===e.reportId)return;let t=0,i=new Map;e.items.forEach((r=>{void 0!==r.usages&&void 0!==r.reportSize&&void 0!==r.reportCount&&(r.usages.forEach(((s,o)=>{switch(s){case this.deviceUsage.mute.usageId:this.deviceCommand.outputReport.mute={reportId:e.reportId,usageOffset:t+o*r.reportSize},i.set(s,t+o*r.reportSize);break;case this.deviceUsage.offHook.usageId:this.deviceCommand.outputReport.offHook={reportId:e.reportId,usageOffset:t+o*r.reportSize},i.set(s,t+o*r.reportSize);break;case this.deviceUsage.ring.usageId:this.deviceCommand.outputReport.ring={reportId:e.reportId,usageOffset:t+o*r.reportSize},i.set(s,t+o*r.reportSize)}})),t+=r.reportCount*r.reportSize)}));let r=t;for(let[e,t]of i)this.outputEventGenerators[e]=e=>{let i=new Uint8Array(r/8);if(t>=0&&e){let e=Math.trunc(t/8),r=t%8;i[e]=1<<r}return i}}));for(let e in this.outputEventGenerators){let s=this.getHexByte(e);s="0x0"+s,this.deviceUsage.mute.usageId===Number(s)?t=this.outputEventGenerators[this.deviceUsage.mute.usageId]:this.deviceUsage.offHook.usageId===Number(s)?r=this.outputEventGenerators[this.deviceUsage.offHook.usageId]:this.deviceUsage.ring.usageId===Number(s)&&(i=this.outputEventGenerators[this.deviceUsage.ring.usageId])}return!!(t||i||r)}async open(e){const t=await navigator.hid.getDevices();if(t.length&&(this.device=t.find((t=>e.label.includes(t.productName)))),!this.device){let t=[];try{t=await navigator.hid.requestDevice({filters:[{usagePage:11}]})}catch(e){c.Ay.error("hid requestDevice error")}t.length&&(this.device=t.find((t=>e.label.includes(t.productName))))}if(!this.device)return!1;try{return this.device.opened&&await this.device.close(),await this.device.open(),!!this.parseDeviceDescriptors()&&(this.device.oninputreport=await this.handleInputReport.bind(this),this.resetState({muted:e.muted,hookStatus:e.hookStatus}),!0)}catch(e){console.error("error content:"+e)}}async close(){try{if(this.resetState({muted:!1,hookStatus:"on"}),!this.device)return;this.device&&this.device.opened&&await this.device.close(),this.device.oninputreport=null,this.device=null}catch(e){console.error(e)}}resetState(e){let{muted:t,hookStatus:i}=e;this.device&&this.device.opened&&(this.device.hookStatus=i,this.device.muted=t,this.device.ring=!1,this.sendDeviceReport({command:"off"===i?"offHook":"onHook"}),this.sendDeviceReport({command:t?"muteOn":"muteOff"}))}async sendDeviceReport(e){if(!(e&&e.command&&this.device&&this.device.opened))return;if("muteOn"===e.command||"muteOff"===e.command){if(!this.outputEventGenerators[this.deviceUsage.mute.usageId])return}else if("onHook"===e.command||"offHook"===e.command){if(!this.outputEventGenerators[this.deviceUsage.offHook.usageId])return}else if(("onRing"===e.command||"offRing"===e.command)&&!this.outputEventGenerators[this.deviceUsage.ring.usageId])return;let t,i,r,s,o,a,n,d,c,l=0,h=null;switch(e.command){case"muteOn":case"muteOff":l=this.deviceCommand.outputReport.mute.reportId;break;case"onHook":case"offHook":l=this.deviceCommand.outputReport.offHook.reportId;break;case"onRing":case"offRing":l=this.deviceCommand.outputReport.ring.reportId;break;default:return}if(0!=l){if(i=this.device.muted,"off"===this.device.hookStatus)t=!0;else{if("on"!==this.device.hookStatus)return;t=!1}switch(r=this.device.ring,e.command){case"muteOn":o=!0;break;case"muteOff":o=!1;break;case"onHook":s=!1;break;case"offHook":s=!0;break;case"onRing":a=!0;break;case"offRing":a=!1;break;default:return}if(this.outputEventGenerators[this.deviceUsage.mute.usageId]&&(d=void 0===o?this.outputEventGenerators[this.deviceUsage.mute.usageId](i):this.outputEventGenerators[this.deviceUsage.mute.usageId](o)),this.outputEventGenerators[this.deviceUsage.offHook.usageId]&&(n=void 0===s?this.outputEventGenerators[this.deviceUsage.offHook.usageId](t):this.outputEventGenerators[this.deviceUsage.offHook.usageId](s)),this.outputEventGenerators[this.deviceUsage.ring.usageId]&&(c=void 0===a?this.outputEventGenerators[this.deviceUsage.ring.usageId](r):this.outputEventGenerators[this.deviceUsage.ring.usageId](a)),l===this.deviceCommand.outputReport.mute.reportId)if(null===h)h=new Uint8Array(d);else for(const[e,t]of d.entries())h[e]|=t;if(l===this.deviceCommand.outputReport.offHook.reportId)if(null===h)h=new Uint8Array(n);else for(const[e,t]of n.entries())h[e]|=t;if(l===this.deviceCommand.outputReport.ring.reportId)if(null===h)h=new Uint8Array(c);else for(const[e,t]of c.entries())h[e]|=t;switch(await this.device.sendReport(l,h),e.command){case"muteOn":this.device.muted=!0;break;case"muteOff":this.device.muted=!1;break;case"onHook":this.device.hookStatus="on";break;case"offHook":this.device.hookStatus="off";break;case"onRing":this.device.ring=!0;break;case"offRing":this.device.ring=!1}}}async sendReplyReport(e,t,i){let r,s,o,a,n=0;if(this.deviceCommand.outputReport.offHook.reportId===this.deviceCommand.outputReport.mute.reportId||e===this.deviceCommand.inputReport.hookSwitch.reportId?n=this.deviceCommand.outputReport.offHook.reportId:e===this.deviceCommand.inputReport.phoneMute.reportId&&(n=this.deviceCommand.outputReport.mute.reportId),this.device&&this.device.opened&&0!==n&&void 0!==t&&void 0!==i){if(this.deviceCommand.outputReport.offHook.reportId===this.deviceCommand.outputReport.mute.reportId){s=this.outputEventGenerators[this.deviceUsage.mute.usageId](i),o=this.outputEventGenerators[this.deviceUsage.offHook.usageId](t),r=new Uint8Array(o);for(const[e,t]of s.entries())r[e]|=t}else n===this.deviceCommand.outputReport.offHook.reportId?(o=this.outputEventGenerators[this.deviceUsage.offHook.usageId](t),r=new Uint8Array(o)):n===this.deviceCommand.outputReport.mute.reportId?(s=this.outputEventGenerators[this.deviceUsage.mute.usageId](i),r=new Uint8Array(s)):n===this.deviceCommand.outputReport.ring.reportId&&(a=this.outputEventGenerators[this.deviceUsage.mute.usageId](i),r=new Uint8Array(a));await this.device.sendReport(n,r)}}handleInputReport(e){let t=this;try{const{data:i,device:r,reportId:s}=e;if(0===s)return;let o=t.deviceCommand.inputReport;if(s!==o.hookSwitch.reportId&&s!==o.phoneMute.reportId)return;let a=!1,n=!1,d=new Uint8Array(i.buffer),c=!0;if(s===o.hookSwitch.reportId){let e=o.hookSwitch,r=Math.trunc(e.usageOffset/8),s=e.usageOffset%8,n=!!(i.getUint8(r)&1<<s);o.hookSwitch.isAbsolute?"on"===t.device.hookStatus&&n?(t.device.hookStatus="off",a=!0):"off"!==t.device.hookStatus||n||(t.device.hookStatus="on",a=!0):n&&(t.device.hookStatus="off"===t.device.hookStatus?"on":"off",a=!0)}if(t.device.muted,s===o.phoneMute.reportId){let e=o.phoneMute,r=Math.trunc(e.usageOffset/8),s=e.usageOffset%8,a=!!(i.getUint8(r)&1<<s);o.phoneMute.isAbsolute?t.device.muted!=a&&(t.device.muted=a,n=!0):a&&(t.device.muted=!t.device.muted,n=!0)}let l={productName:r.productName,reportId:t.getHexByte(s),reportData:d};if(a&&(l.eventName="ondevicehookswitch",l.hookStatus=t.device.hookStatus),n&&(l.eventName="ondevicemuteswitch",l.isMute=t.device.muted),t.inputReportRetFunc&&t.inputReportRetFunc(l),c&&(a||n)){let e;if("off"===this.device.hookStatus)e=!0;else{if("on"!==this.device.hookStatus)return;e=!1}t.sendReplyReport(s,e,t.device.muted)}}catch(e){console.error(e)}}}var ge=i(3323),_e=i(6206),Se=i.n(_e);const Ae={[E._c.AUDIO_ENCODE]:"audioEncodeInitInstance",[E._c.AUDIO_DECODE]:"audioDecInitInstance",[E._c.VIDEO_ENCODE]:"videoInitInstance",[E._c.VIDEO_DECODE]:"videoDecInitInstance",[E._c.SHARING_ENCODE]:"sharingEncInitInstance",[E._c.SHARING_DECODE]:"sharingDecInitInstance"};class ye{constructor(){this.logWriterMap=window.logWriterMap=new Map,this.inited=!1}async init(){this.inited||(this.inited=!0,Object.values(E._c).forEach((async e=>{const t=await async function(){const e=new _e.FileWriter({maxDaysToKeepFile:1,fileSizeQuota:10485760});return new Promise((t=>{e.on("initOK",(()=>{t(e)}))}))}();this.logWriterMap.set(e,t),await d.A[Ae[e]].waitforInitSuccess();const i=t.createMessagePort();(0,l.pushMessageToWorker)(e,i,"local_log_port",!0,!0),t.startWriteNormalLogFile({filenamePrefix:E.is[e],filenameExtension:".log",timestamp:!1,newLine:!1}),t.on("startWriteNormalLogFileReady",(()=>{(0,l.pushMessageToWorker)(e,null,"local_log_ready",!1,!0)}))})))}saveLogFileByWorkerType(e){const t=this.logWriterMap.get(e);t&&t.saveLog()}saveAllLogFiles(){Se().selectSaveDir().then((()=>{Object.values(E._c).forEach((e=>{Se().saveLog({filenamePrefix:E.is[e],filenameExtension:".log"})}))}))}}var Ce=i(242);class Ee{constructor(){this.timeMap=new Map,this.baseTime=0,this.totalTime=0}flushTimeMap(){const e=performance.now(),t=this.timeMap.get(this.status)||0,i=e-this.baseTime;this.timeMap.set(this.status,t+i),this.baseTime=e,this.totalTime+=i}start(e){this.status=e,this.baseTime=performance.now()}update(e){e!==this.status&&(this.flushTimeMap(),this.status=e)}end(){this.flushTimeMap();const e={};for(const[t,i]of this.timeMap)e[String(t)]=Number((i/this.totalTime*100).toFixed(2));return e}}class be{constructor(){this.pressureLevel={nominal:0,fair:1,serious:2,critical:3},this.pressureStatisticHelper=new Ee,this.observer=new PressureObserver((e=>{this.result=this.pressureLevel[e[0].state],this.pressureStatisticHelper.update(e[0].state)}))}init(){this.initPromise=this.observer.observe("cpu").then((()=>{this.pressureStatisticHelper.start("nominal")})).catch((e=>{(a.Ay.isWindows()||a.Ay.isMac()||a.Ay.isChromeOS())&&c.Ay.warn("ComputePressure observe error: ",e)})).finally((()=>{this.initPromise=null}))}destroy(){if(this.initPromise)this.initPromise.then((()=>{this.observer.unobserve("cpu");const e=this.pressureStatisticHelper.end();c.Ay.log("CPU pressure report: ".concat(JSON.stringify(e)))}));else{this.observer.unobserve("cpu");const e=this.pressureStatisticHelper.end();c.Ay.log("CPU pressure report: ".concat(JSON.stringify(e)))}}getPressureLevel(){return this.result}}(0,v.A)(be,"isSupportComputePressure",(()=>"function"==typeof PressureObserver));var we=i(2601),Re=i.n(we),Te=i(2754),Ie=i(5600);function Me(e,t){const i=Math.pow(10,t);return Math.floor(e*i)/i}function De(e,t){const i=Math.pow(10,t);return Math.ceil(e*i)/i}var Pe=i(879);const ke={mgr:null,config:ue.X,capabilities:Pe.f,userAgent:pe.l,tracing:{add_monitor(e){(0,Ie.r9)(e)},globaltracing_error(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;(0,Ie.r1)(e,t)},Log_Error(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;(0,Ie.Yd)(e,t)},Log_DT(e){(0,Ie.y5)(e)}},graphics:{create_webgl_context_failed_monitor(e){(0,Ie.S_)(e)},calculateUVCoord:(e,t,i,r)=>function(e,t,i,r){if(!e||!t||!i)return null;const s=t.width/t.height;let o=t.width,a=t.height;if(t.width>e.width||t.height>e.height){const i=e.width/t.width,r=e.height/t.height,s=Math.min(i,r);o*=s,a*=s}let n=0,d=0;e.width/e.height>s?(d=Math.floor(e.height/a)*a,n=Math.floor(d*s/o)*o,n>e.width&&(n=Math.floor(e.width/o)*o,d=Math.floor(n/s/a)*a)):(n=Math.floor(e.width/o)*o,d=Math.floor(n/s/a)*a,d>e.height&&(d=Math.floor(e.height/a)*a,n=Math.floor(d*s/o)*o));let c=0,l=0,h=0,u=0,p={x:l,y:c,w:h,h:u};r==B.vL?(c=1-(c+(a-1)/e.height),l=t.left/e.width,u=1-t.top/e.height,h=l+o/e.width,p.x=l,p.y=1-u,p.w=h,p.h=1-c):r==B.mN?(l=1-(c+(a-1)/e.height),h=1-t.top/e.height,c=t.left/e.width,u=l+o/e.width):r==B.G7?(c=t.top/e.height,l=t.left/e.width,u=c+(a-1)/e.height,h=l+o/e.width):r==B.Ur&&(l=t.top/e.height,h=c+(a-1)/e.height,c=t.left/e.width,u=l+o/e.width);let f=[],m=[{x:h,y:u},{x:h,y:c},{x:l,y:c},{x:h,y:u},{x:l,y:u},{x:l,y:c}];for(let e=0;e<m.length;++e){let t={u:m[e].x,v:m[e].y};f.push(t)}let v=[];for(let e=0;e<f.length;++e){let t=f[e];v.push(t.u),v.push(t.v)}return{uvCoords:v,uvRect:p}}(e,t,i,r),calculateUVCoordsForMultiView:(e,t,i,r,s,o)=>function(e,t,i,r,s,o){let a=0,n=0,d=0,c=0,l={x:n,y:a,w:d,h:c};if(e){const e=s==B.mN||s==B.Ur?t.height/t.width:t.width/t.height,o=r.left||0,l=r.top||0;if(r.width/r.height>e){const t=r.height*e;a=l/i.height,n=(Math.round((r.width-t)/2)+o)/i.width,c=a+(r.height-1)/i.height,d=n+t/i.width}else{const t=r.width/e;a=(Math.round((r.height-t)/2)+l)/i.height,n=o/i.width,c=a+(t-1)/i.height,d=n+r.width/i.width}s==B.vL?(a=1-(a+(r.height-1)/i.height),n=r.left/i.width,c=1-r.top/i.height,d=n+r.width/i.width):s==B.mN?(n=1-(a+(r.height-1)/i.height),d=1-r.top/i.height,a=r.left/i.width,c=n+r.width/i.width):s==B.G7?(a=r.top/i.height,n=r.left/i.width,c=a+(r.height-1)/i.height,d=n+r.width/i.width):s==B.Ur&&(n=r.top/i.height,d=a+(r.height-1)/i.height,a=r.left/i.width,c=n+r.width/i.width)}else{const e=r.width/r.height;let t=r.width,o=r.height;if(r.width>i.width||r.height>i.height){const e=i.width/r.width,s=i.height/r.height,a=Math.min(e,s);t*=a,o*=a}let h=0,u=0;i.width/i.height>e?(u=Math.floor(i.height/o)*o,h=Math.floor(u*e/t)*t,h>i.width&&(h=Math.floor(i.width/t)*t,u=Math.floor(h/e/o)*o)):(h=Math.floor(i.width/t)*t,u=Math.floor(h/e/o)*o,u>i.height&&(u=Math.floor(i.height/o)*o,h=Math.floor(u*e/t)*t)),s==B.vL?(a=1-(a+(o-1)/i.height),n=r.left/i.width,c=1-r.top/i.height,d=n+t/i.width,l.x=n,l.y=1-c,l.w=d,l.h=1-a,r.height>r.width&&(n=De(n,2),d=Me(d,2))):s==B.mN?(n=1-(a+(o-1)/i.height),d=1-r.top/i.height,a=r.left/i.width,c=n+t/i.width):s==B.G7?(a=r.top/i.height,n=r.left/i.width,c=a+(o-1)/i.height,d=n+t/i.width):s==B.Ur&&(n=r.top/i.height,d=a+(o-1)/i.height,a=r.left/i.width,c=n+t/i.width)}let h=[],u=[{x:d,y:c},{x:d,y:a},{x:n,y:a},{x:d,y:c},{x:n,y:c},{x:n,y:a}];for(let e=0;e<u.length;++e){let t=null;if(o){let i=-1*Math.abs(u[e].x);u[e].x=i,t={u:u[e].x+1,v:u[e].y}}else t={u:u[e].x,v:u[e].y};h.push(t)}let p=[];for(let e=0;e<h.length;++e){let t=h[e];p.push(t.u),p.push(t.v)}return{uvCoords:p,uvRect:l}}(e,t,i,r,s,o),calculateRenderRect:(e,t)=>function(e,t){let i=0,r=0,s=0,o=0;const a=t.width/t.height;return e.width/e.height>a?(r=e.height,i=r*a,s=(e.width-i)/2,o=0):(i=e.width,r=i/a,s=0,o=(e.height-r)/2),i<=e.canvas.width&&(s=(e.canvas.width-i)/2),r<=e.canvas.height&&(o=(e.canvas.height-r)/2),{x:s,y:o,width:i,height:r}}(e,t),evalCroppingRect:(e,t)=>function(e,t){if(!e||null==t)throw new Error("evalCroppingRect() invalid parameters!");return t===B.mN||t===B.Ur?{top:e.top,left:e.left,width:e.height,height:e.width}:e}(e,t)},assertion:{assert(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";(0,Te.vA)(e,t)},assertWithFailed(e){(0,Te.Yu)(e)},abstractMethod(){(0,Te.KR)()},unreachable(){(0,Te.HB)()}}},Oe=new class{constructor(){this.moduleCache=new Map,Re().__dyn_modules__={}}loadModuleFromBlob(e,t,i){if(this.moduleCache.has(e))return this.moduleCache.get(e);this.moduleCache.set(e,void 0);try{let r;const o=s().createObjectURL(t);return(0,Te.vA)("function"==typeof importScripts),importScripts(o),r=Re().__dyn_modules__[e],r&&"function"==typeof r.init&&(r.init(ke,i),this.moduleCache.set(e,r)),r}catch(t){(0,Ie.Yd)("[DynModuleMgr] loadModuleFromBlob Error: ".concat(e),t)}}getModule(e){return this.moduleCache.get(e)||void 0}};function Ve(e,t,i){Ne(e,t),t.set(e,i)}function Ne(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function xe(e,t,i){return e.set(We(e,t),i),i}function Le(e,t){return e.get(We(e,t))}function We(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Ue=new WeakMap,Be=new WeakMap,Fe=new WeakMap,He=new WeakMap,Ge=new WeakSet;function je(){return!0}function Ke(){if(Le(Fe,this)){let e={};return e.architecture=Le(Fe,this).architecture,e.vendor=Le(Fe,this).vendor,e}return null}async function ze(){if(!navigator.gpu)return xe(Ue,this,B.W5.NOT_SUPPORTED),!1;const e=await navigator.gpu.requestAdapter();return e?await e.requestDevice()?("function"==typeof e.requestAdapterInfo?(xe(Fe,this,await e.requestAdapterInfo()),Le(Fe,this)&&console.log("adapter info: ".concat(Le(Fe,this).architecture,", ").concat(Le(Fe,this).vendor))):"info"in e&&xe(Fe,this,e.info),xe(Ue,this,B.W5.AVAILABLE),!0):(xe(Ue,this,B.W5.CANNOT_REQ_DEVICE),!1):(xe(Ue,this,B.W5.CANNOT_REQ_ADAPTER),!1)}function qe(e){if(!e)return!1;const t=e.vendor;return-1!==B.O$.indexOf(t)}function Ye(e,t,i){return Xe.produce(e,t,i)}class Xe{static produce(e,t,i){let r=null;return e===B.h3.WEBGPU&&(r=Oe.getModule("webgpu_renderer_dynmod").exports.createWebGPURenderer(t,i)),r}}const Qe=class{constructor(){var e;Ne(this,e=Ge),e.add(this),Ve(this,Ue,B.W5.AVAILABLE),Ve(this,Be,B.h3.WEBGL),Ve(this,Fe,null),Ve(this,He,new Map)}async evaluate(e){if(xe(Be,this,B.h3.WEBGL),!We(Ge,this,je).call(this))return Le(Be,this);if(!e.allowedOnTargetPlatforms)return Le(Be,this);if(!e.allowedOnTargetBrowsers)return Le(Be,this);if(!await We(Ge,this,ze).call(this))return Le(Be,this);const t=We(Ge,this,Ke).call(this);if(!We(Ge,this,qe).call(this,t))return Le(Be,this);let i=new OffscreenCanvas(1,1);return i.getContext("webgpu")?(i=null,xe(Be,this,B.h3.WEBGPU),Le(Be,this)):(i=null,Le(Be,this))}acquireRenderer(e,t){let i=null;return arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&Le(He,this).clear(),Le(He,this).has(e)&&(i=Le(He,this).get(e),i&&(e&&(i.setCanvas(e),i.initialize(e)),t&&i.setDevice(t.acquireGPUDevice()))),null==i&&(i=We(Ge,this,Ye).call(this,Le(Be,this),e,t),i&&Le(He,this).set(e,i)),i}rendererReinitialize(){if(Le(He,this))for(const[e,t]of Le(He,this))t&&t.initialize(e)}rendererUnconfigureGPUContext(){if(Le(He,this))for(const[e,t]of Le(He,this))t&&t.unconfigureGPUContext()}getRendererType(){return Le(Be,this)}loadRenderModuleFromBlob(e,t){t&&(e===B.h3.WEBGPU?Oe.loadModuleFromBlob("webgpu_renderer_dynmod",t):(0,Te.Yu)("Invalid render module for ".concat(e)))}setRendererType(e){xe(Be,this,e)}isWebGPURendererType(){return Le(Be,this)===B.h3.WEBGPU}isWebGLRendererType(){return Le(Be,this)===B.h3.WEBGL}isWebGL2RendererType(){return Le(Be,this)===B.h3.WEBGL_2}cleanup(){for(const[e,t]of Le(He,this))t&&t.cleanup();Le(He,this).clear()}};function Je(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var $e=new WeakSet;function Ze(e){e.forEach((e=>{e.consumePendingGPUEvents()}))}function et(e){return!e||0==e.length||-1==e.findIndex((e=>!!e&&(!!e.getTextureLayerByZIndex(B.x0.VS_BASE)&&e.isRenderingStateReady())))}const tt=class{constructor(){var e,t;(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e=this,t=$e),t.add(e)}render(e,t){e?e.isGPUDeviceReady()?t&&0!=t.length?(Je($e,this,Ze).call(this,t),Je($e,this,et).call(this,t)||e.render(t)):(0,j.r9)("WGPU RendererController_render() displays are not available!"):(0,j.r9)("WGPU RendererController_render() GPU device is not ready!"):(0,j.r9)("WGPU RendererController_render() renderer is not attached!")}};var it=i(9415);function rt(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,r)}return i}function st(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?rt(Object(i),!0).forEach((function(t){(0,v.A)(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):rt(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}let ot=new Map,at=[];function nt(e){e.preventDefault()}function dt(e,t,i,r,s,o,a){let n=arguments.length>7&&void 0!==arguments[7]&&arguments[7];this.canvasElement=e,this.canvasID=t,this.contextOptions=s,this.textureindex=i||0,this.initmask=!!a,this.isEnableCanvasAlphaChannel=n,dt.prototype.ROTATION_CLOCK0=0,dt.prototype.ROTATION_CLOCK90=1,dt.prototype.ROTATION_CLOCK180=2,dt.prototype.ROTATION_CLOCK270=3,this.webGLResources=o,o||(this.initContextGL(),this.contextGL&&(this.webGLContextLostProtect(),this.contextGL.isContextLost()&&this.restoreContext())),this.webglVertexPos=[0,0,0,0],this.webglTexturePos=[0,0,0,0],this.vertexPos=[0,0,0,0],this.texturePos=[0,0,0,0],this.reinit(o);var d=new ArrayBuffer(4);this.dummpyCursor=new Uint8Array(d),this.dummpyWaterMark=new Uint8Array(d),this.cursorWidth=0,this.cursorHeight=0,this.hasCursor=0,this.lastcursorSyncId=-1,this.hasWaterMark=0,this.watermarkOpacity=.15,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.viewWidth=0,this.viewHeight=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=P.kh,this.rotation=this.ROTATION_CLOCK0,this.fillMode=0,this.fillModeForResolution=0,this.viewPostion=null,this.enable_rounded_corner=0,this.radius_lt_x=0,this.radius_lt_y=0,this.radius_lb_x=0,this.radius_lb_y=0,this.radius_rt_x=0,this.radius_rt_y=0,this.radius_rb_x=0,this.radius_rb_y=0,this.aa_width=B.ru,this.viewport_rect=null}dt.prototype.isLocalDisplay=function(){return 0==this.textureindex},dt.prototype.reinit=function(e){if(this.webGLResources=e,!this.contextGL||this.contextGL.isContextLost()||this.contextGL.glInitSucceed||this.webGLResources){if(this.webGLResources&&this.webGLResources.contextgl&&!this.webGLResources.contextgl.isContextLost()){this.contextGL=this.webGLResources.contextgl,this.shaderProgram=this.webGLResources.program,this.vertexPosBuffer=this.webGLResources.vBuffer,this.texturePosBuffer=this.webGLResources.tBuffer,this.webglTexturePos=this.webGLResources.webglTexturePos,this.webglVertexPos=this.webGLResources.webglVertexPos,this.initTextures(!1);let e=this.contextGL.getError();this.contextGL.glInitSucceed=e!=this.contextGL.NO_ERROR&&e!=this.contextGL.CONTEXT_LOST_WEBGL?0:1}}else{this.initProgram(),this.initmask?this.initTextures(!1):this.initTextures(!0),this.initBuffers();let e=this.contextGL.getError();this.contextGL.glInitSucceed=e!=this.contextGL.NO_ERROR&&e!=this.contextGL.CONTEXT_LOST_WEBGL?0:1}},dt.prototype.webGLContextLostSimulate=function(){const e=(0,j.px)(this.contextGL,"WEBGL_lose_context");null==e||e.loseContext()},dt.prototype.restoreContext=function(){if(this.contextGL)try{var e,t;null!==(e=this.canvasElement)&&void 0!==e&&e.loseContextExtension&&!this.canvasElement.restoreTimeoutId&&this.contextGL.isContextLost()&&(this.canvasElement.restoreTimeoutId=setTimeout((()=>{this.canvasElement.reportcontextloss||(this.canvasElement.reportcontextloss=!0,(0,j.S_)("WebGLRestoreTimeout")),this.canvasElement.restoreTimeoutId=0}),1500),null===(t=this.canvasElement)||void 0===t||t.loseContextExtension.restoreContext())}catch(e){(0,j.Yd)("webgl restoreContext exception",e)}},dt.prototype.webgGLContextLostCallback=function(e){(0,j.fn)("webglcontextlost event: canvas listener size=".concat(at.length,", canvas id: ").concat(this.canvasID,", , ids:").concat(at.join())),e.preventDefault(),this.contextGL.glInitSucceed=0,this.contextOptions&&this.contextOptions.webglcontextlostCallback&&this.contextOptions.webglcontextlostCallback(e,this.contextOptions.params)},dt.prototype.removeEventListener=function(e,t){if(e&&t){e.restoreTimeoutId&&(clearTimeout(e.restoreTimeoutId),e.restoreTimeoutId=void 0),e.removeEventListener("webglcontextlost",t.contextLostHandler),e.removeEventListener("webglcontextrestored",t.contextRestoredHandler);const i=at.indexOf(this.canvasID);at.splice(i,1),ot.delete(e)}},dt.prototype.webGLContextRestoredCallback=function(e){var t,i;(0,j.fn)("webglcontextrestored event from canvas id: ".concat(this.canvasID)),this.canvasElement.restoreTimeoutId&&(clearTimeout(this.canvasElement.restoreTimeoutId),this.canvasElement.restoreTimeoutId=void 0),this.webglVertexPos=[0,0,0,0],this.webglTexturePos=[0,0,0,0],this.reinit(),null===(t=this.contextOptions)||void 0===t||null===(i=t.webglcontextrestoredCallback)||void 0===i||i.call(t,e,this.contextOptions.params)},dt.prototype.webGLContextLostProtect=function(){this.canvasElement&&!this.canvasElement.loseContextExtension&&(this.canvasElement.loseContextExtension=(0,j.px)(this.contextGL,"WEBGL_lose_context"));let e=this.canvasElement,t=ot.get(e);t&&this.removeEventListener(e,t),ot.set(e,this),this.contextLostHandler=this.webgGLContextLostCallback.bind(this),this.contextRestoredHandler=this.webGLContextRestoredCallback.bind(this),e.addEventListener("webglcontextlost",this.contextLostHandler,{capture:!1}),e.addEventListener("webglcontextrestored",this.contextRestoredHandler,{capture:!1}),-1===at.indexOf(this.canvasID)&&(at.push(this.canvasID),at.length>4&&(0,j.fn)("webglcanvas listener size=".concat(at.length,", ids:").concat(at.join())))},dt.prototype.isWebGL=function(){return this.contextGL},dt.prototype.isAvaiable=function(){return this.contextGL&&!this.contextGL.isContextLost()&&this.contextGL.glInitSucceed},dt.prototype.initContextGL=function(){for(var e,t,i,r=this.canvasElement,s=null,o=["webgl","experimental-webgl","moz-webgl","webkit-3d"],a=0;!s&&a<o.length;){var n=o[a];try{if((0,it.B)().config.isEnableCanvasCtxOptionsOpt()){let e={depth:!1,stencil:!1,antialias:!1,alpha:this.isEnableCanvasAlphaChannel};if(this.contextOptions){let t=st(st({},this.contextOptions),e);s=r.getContext(n,t)}else s=r.getContext(n,e)}else s=this.contextOptions?r.getContext(n,this.contextOptions):r.getContext(n)}catch(e){s=null}s&&"function"==typeof s.getParameter||(s=null),++a}if(this.contextGL=s,!s||s.isContextLost())return(0,j.Yd)("Failed when trying to get WebGLContext on canvas(".concat(null===(e=this.canvasElement)||void 0===e?void 0:e.width,",").concat(null===(t=this.canvasElement)||void 0===t?void 0:t.height,"), gl=").concat(s,", lost=").concat(null===(i=s)||void 0===i?void 0:i.isContextLost())),void(0,j.S_)("InitWebGLFail");s.glInitSucceed=0},dt.prototype.initProgram=function(){var e=this.contextGL,t=e.createShader(e.VERTEX_SHADER);e.shaderSource(t,"\n attribute vec4 vertexPos;\n attribute vec4 texturePos;\n attribute vec4 masktexturePos;\n varying vec2 textureCoord;\n varying vec2 masktextureCoord;\n\n void main() {\n gl_Position = vertexPos;\n textureCoord = texturePos.xy;\n masktextureCoord = masktexturePos.xy;\n }\n "),e.compileShader(t),e.getShaderParameter(t,e.COMPILE_STATUS)||e.isContextLost()||(0,j.fn)("webgl Vertex shader failed to compile: "+e.getShaderInfoLog(t));var i=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(i,"\n precision highp float;\n varying highp vec2 textureCoord;\n varying highp vec2 masktextureCoord;\n\n uniform sampler2D ySampler;\n uniform sampler2D uSampler;\n uniform sampler2D vSampler;\n uniform sampler2D cursorSampler;\n uniform sampler2D waterMarkSampler;\n uniform sampler2D previewVideoSampler;\n uniform sampler2D maskSampler;\n\n uniform vec4 cursorInfo;\n uniform int onlyRGBA;\n uniform int bgraMode;\n uniform int colorRange;\n uniform int waterMarkFlag;\n uniform int cursorFlag;\n uniform int yuvmode;\n\n const int MAX_ELLIPSE_COUNT = 10;\n uniform int maskFlag; // 0: mask disabled; 1: mask enabled;\n uniform int maskMode; // 0: static mask; 1: dynamic mask;\n uniform vec4 uEllipses[MAX_ELLIPSE_COUNT]; // each ellipse contains (cx, cy, rx, ry) 4-coords\n uniform int uEllipseCount; // how many ellipses will draw\n\n // rounded corner feature in gl shader\n uniform float u_enable_rounded_corner;\n uniform float u_radius_lt_x;\n uniform float u_radius_lt_y;\n uniform float u_radius_lb_x;\n uniform float u_radius_lb_y;\n uniform float u_radius_rt_x;\n uniform float u_radius_rt_y;\n uniform float u_radius_rb_x;\n uniform float u_radius_rb_y;\n uniform float u_aa_width;\n uniform vec4 u_viewport_rect;\n\n const mat4 YUV2RGB_L = mat4(\n 1.1643828125, 0, 1.59602734375, -0.87078515625,\n 1.1643828125, -0.39176171875, -0.81296875, 0.52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1\n );\n\n const mat4 YUV2RGB_F = mat4(\n 1.0, 0, 1.402, -0.701,\n 1.0, -0.34413, -0.71414, 0.529135,\n 1.0, 1.772, 0, -0.886,\n 0, 0, 0, 1\n );\n\n void main(void) {\n vec4 c;\n if (waterMarkFlag != 1) {\n if (onlyRGBA == 0) {\n highp float y = texture2D(ySampler, textureCoord).r;\n highp float u;\n highp float v;\n\n if (yuvmode == 1) {\n u = texture2D(uSampler, textureCoord).r;\n v = texture2D(vSampler, textureCoord).r;\n } else {\n u = texture2D(uSampler, textureCoord).r;\n v = texture2D(uSampler, textureCoord).a;\n }\n\n if (colorRange == 0) {\n c = vec4(y, u, v, 1) * YUV2RGB_L;\n } else {\n c = vec4(y, u, v, 1) * YUV2RGB_F;\n }\n\n if (cursorFlag == 1) {\n if (cursorInfo.z > 0.0 &&\n textureCoord.x >= cursorInfo.x &&\n textureCoord.y >= cursorInfo.y &&\n textureCoord.x < cursorInfo.x + cursorInfo.z &&\n textureCoord.y < cursorInfo.y + cursorInfo.w) {\n\n vec2 cursorCoord = textureCoord - cursorInfo.xy;\n cursorCoord /= cursorInfo.zw;\n vec4 cursor = texture2D(cursorSampler, cursorCoord);\n c = c * (1.0 - cursor.a) + cursor * cursor.a;\n }\n }\n } else {\n c = texture2D(previewVideoSampler, textureCoord);\n if (bgraMode == 1) {\n c = vec4(c.b, c.g, c.r, c.a);\n }\n }\n } else {\n c = texture2D(waterMarkSampler, textureCoord);\n if (c.r == 0.0 && c.g == 0.0 && c.b == 0.0) {\n c.a = 0.0;\n }\n }\n\n if (maskFlag == 1 && waterMarkFlag != 1) {\n vec4 mask = texture2D(maskSampler, masktextureCoord);\n if (maskMode == 0) {\n // -- handle static mask --\n if (mask.r != 0.0 || mask.g != 0.0 || mask.b != 0.0) {\n c = mask * mask.a + c * (1.0 - mask.a);\n }\n } else if (maskMode == 1) {\n // -- handle dynamic mask --\n bool inEllipse = false; // variable for checking whether the pixel to be drawn hits ellipse\n for (int i = 0; i < MAX_ELLIPSE_COUNT; i++) {\n if (i > uEllipseCount) break;\n\n vec2 ellipseCenter = uEllipses[i].xy;\n vec2 ellipseRadii = uEllipses[i].zw;\n vec2 ellipsePos = masktextureCoord - ellipseCenter;\n\n float ellipseEq = (ellipsePos.x * ellipsePos.x) / (ellipseRadii.x * ellipseRadii.x) +\n (ellipsePos.y * ellipsePos.y) / (ellipseRadii.y * ellipseRadii.y);\n if (ellipseEq <= 1.0) {\n // the pixel in the ellipse range\n inEllipse = true;\n break;\n }\n }\n\n if (inEllipse) {\n c = mask * mask.a + c * (1.0 - mask.a);\n }\n }\n }\n\n if (waterMarkFlag != 1) {\n c.a = 1.0;\n }\n\n if (u_enable_rounded_corner < 0.5) {\n gl_FragColor = c;\n return;\n }\n\n // step 1: viewport coordinate mapping\n // convert the fragment coordinate(canvas coordinate) to the viewport coordinate\n // for example, a viewport={x: 100, y: 100, w: 200, h: 160}, a fragCoord.xy={x:120, y: 120}\n // we can get the pos={x: 20, y: 20}\n vec2 pos = gl_FragCoord.xy - u_viewport_rect.xy;\n vec2 viewportSize = u_viewport_rect.zw;\n\n // convert the normalized radius to pixel value\n float r_lt_x = u_radius_lt_x * viewportSize.x;\n float r_lt_y = u_radius_lt_y * viewportSize.y;\n float r_rt_x = u_radius_rt_x * viewportSize.x;\n float r_rt_y = u_radius_rt_y * viewportSize.y;\n float r_lb_x = u_radius_lb_x * viewportSize.x;\n float r_lb_y = u_radius_lb_y * viewportSize.y;\n float r_rb_x = u_radius_rb_x * viewportSize.x;\n float r_rb_y = u_radius_rb_y * viewportSize.y;\n\n // step 2: calculate the rounded corner mask (as alpha)\n float alpha = 1.0;\n\n // --- calculation of the left-top corner ---\n // Condition: if (pos.x < r_lt_x && pos.y < r_lt_y)\n float in_lt = (1.0 - step(r_lt_x, pos.x)) * (1.0 - step(r_lt_y, pos.y));\n // the circle center of the left-top corner in pixel coordinate\n vec2 center_lt = vec2(r_lt_x, r_lt_y);\n // calculate and normalize the distance between the fragment and the center\n vec2 diff_lt = (pos - center_lt) / vec2(r_lt_x, r_lt_y);\n float normDist_lt = length(diff_lt);\n // smoothstep function is used to calculate the alpha value\n float mask_lt = 1.0 - smoothstep(1.0 - u_aa_width, 1.0, normDist_lt);\n float final_lt = mix(1.0, mask_lt, in_lt);\n\n // --- calculation of the right-top corner ---\n float in_rt = (1.0 - step(r_rt_x, viewportSize.x - pos.x)) * (1.0 - step(r_rt_y, pos.y));\n vec2 center_rt = vec2(viewportSize.x - r_rt_x, r_rt_y);\n vec2 diff_rt = (pos - center_rt) / vec2(r_rt_x, r_rt_y);\n float normDist_rt = length(diff_rt);\n float mask_rt = 1.0 - smoothstep(1.0 - u_aa_width, 1.0, normDist_rt);\n float final_rt = mix(1.0, mask_rt, in_rt);\n\n // --- calculation of the left-bottom corner ---\n float in_lb = (1.0 - step(r_lb_x, pos.x)) * (1.0 - step(r_lb_y, viewportSize.y - pos.y));\n vec2 center_lb = vec2(r_lb_x, viewportSize.y - r_lb_y);\n vec2 diff_lb = (pos - center_lb) / vec2(r_lb_x, r_lb_y);\n float normDist_lb = length(diff_lb);\n float mask_lb = 1.0 - smoothstep(1.0 - u_aa_width, 1.0, normDist_lb);\n float final_lb = mix(1.0, mask_lb, in_lb);\n\n // --- calculation of the right-bottom corner ---\n float in_rb = (1.0 - step(r_rb_x, viewportSize.x - pos.x)) * (1.0 - step(r_rb_y, viewportSize.y - pos.y));\n vec2 center_rb = vec2(viewportSize.x - r_rb_x, viewportSize.y - r_rb_y);\n vec2 diff_rb = (pos - center_rb) / vec2(r_rb_x, r_rb_y);\n float normDist_rb = length(diff_rb);\n float mask_rb = 1.0 - smoothstep(1.0 - u_aa_width, 1.0, normDist_rb);\n float final_rb = mix(1.0, mask_rb, in_rb);\n\n // Get the minimum value from the four corners (to ensure that if any corner requires transparency it is applied)\n float finalAlpha = min(min(final_lt, final_rt), min(final_lb, final_rb));\n\n // Final output color\n gl_FragColor = vec4(c.rgb, c.a * finalAlpha);\n }\n"),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)||e.isContextLost()||(0,j.fn)("webgl Fragment shader failed to compile: "+e.getShaderInfoLog(i));var r=e.createProgram();e.attachShader(r,t),e.attachShader(r,i),e.linkProgram(r),e.getProgramParameter(r,e.LINK_STATUS)||e.isContextLost()||(0,j.fn)("webgl Program failed to compile: "+e.getProgramInfoLog(r)),e.useProgram(r),this.shaderProgram=r},dt.prototype.initBuffers=function(){var e=this.contextGL,t=this.shaderProgram,i=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,i),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 r=e.getAttribLocation(t,"vertexPos");e.enableVertexAttribArray(r),e.vertexAttribPointer(r,2,e.FLOAT,!1,0,0),this.vertexPosBuffer=i;var s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),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 o=e.getAttribLocation(t,"texturePos");if(e.enableVertexAttribArray(o),e.vertexAttribPointer(o,2,e.FLOAT,!1,0,0),this.initmask&&!this.masktexturePosBuffer){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]),e.STATIC_DRAW);var n=e.getAttribLocation(t,"masktexturePos");e.enableVertexAttribArray(n),e.vertexAttribPointer(n,2,e.FLOAT,!1,0,0),this.masktexturePosBuffer=a}this.texturePosBuffer=s},dt.prototype.initTextures=function(e){var t=this.contextGL,i=this.shaderProgram;t.pixelStorei(t.UNPACK_ALIGNMENT,1);var r=this.initTexture();this.yTextureRef=r,this.oyTextureRef=r;var s=this.initTexture();this.uTextureRef=s,this.ouTextureRef=s;var o=this.initTexture();this.vTextureRef=o,this.ovTextureRef=o,e&&this.BindTextures(P.Wp),this.waterMarkTextureRef=this.initTexture();var a=t.getUniformLocation(i,"waterMarkSampler");t.uniform1i(a,P.GV),this.waterMarkSamplerRef=a;var n=this.initTexture(),d=t.getUniformLocation(i,"cursorSampler");if(t.uniform1i(d,P.Yy),this.cursorTextureRef=n,this.cursorSamplerRef=d,this.cursorInfoRef=t.getUniformLocation(i,"cursorInfo"),this.initmask){t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,1);var c=this.initTexture(),l=t.getUniformLocation(i,"maskSampler");t.uniform1i(l,P.Gk),this.maskTextureRef=c}this.colorRangeRef=t.getUniformLocation(i,"colorRange"),this.onlyRGBARef=t.getUniformLocation(i,"onlyRGBA"),this.bgraModeRef=t.getUniformLocation(i,"bgraMode"),this.waterMarkFlagRef=t.getUniformLocation(i,"waterMarkFlag"),this.maskFlagRef=t.getUniformLocation(i,"maskFlag"),this.cursorFlagRef=t.getUniformLocation(i,"cursorFlag"),this.yuvmodeRef=t.getUniformLocation(i,"yuvmode"),this.ul_enable_rounded_corner=t.getUniformLocation(i,"u_enable_rounded_corner"),this.ul_radius_lt_x=t.getUniformLocation(i,"u_radius_lt_x"),this.ul_radius_lt_y=t.getUniformLocation(i,"u_radius_lt_y"),this.ul_radius_lb_x=t.getUniformLocation(i,"u_radius_lb_x"),this.ul_radius_lb_y=t.getUniformLocation(i,"u_radius_lb_y"),this.ul_radius_rt_x=t.getUniformLocation(i,"u_radius_rt_x"),this.ul_radius_rt_y=t.getUniformLocation(i,"u_radius_rt_y"),this.ul_radius_rb_x=t.getUniformLocation(i,"u_radius_rb_x"),this.ul_radius_rb_y=t.getUniformLocation(i,"u_radius_rb_y"),this.ul_aa_width=t.getUniformLocation(i,"u_aa_width"),this.ul_viewport_rect=t.getUniformLocation(i,"u_viewport_rect")},dt.prototype.BindTextures=function(e){var t=this.contextGL,i=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==P.Wp){let e=t.getUniformLocation(i,"ySampler");t.uniform1i(e,0);let r=t.getUniformLocation(i,"uSampler");t.uniform1i(r,1);let s=t.getUniformLocation(i,"vSampler");t.uniform1i(s,2)}else if(this.isRGBAMode(e)){let e=t.getUniformLocation(i,"previewVideoSampler");t.uniform1i(e,0);let r=t.getUniformLocation(i,"ySampler");t.uniform1i(r,0);let s=t.getUniformLocation(i,"uSampler");t.uniform1i(s,0);let o=t.getUniformLocation(i,"vSampler");t.uniform1i(o,0)}else if(e==P.pn){let e=t.getUniformLocation(i,"ySampler");t.uniform1i(e,0);let r=t.getUniformLocation(i,"uSampler");t.uniform1i(r,1);let s=t.getUniformLocation(i,"vSampler");t.uniform1i(s,0)}let r=t.getUniformLocation(i,"previewVideoSampler");t.uniform1i(r,0);let s=t.getUniformLocation(i,"maskSampler");this.initmask?(t.activeTexture(t.TEXTURE0+P.Gk),t.bindTexture(t.TEXTURE_2D,this.maskTextureRef),t.uniform1i(s,P.Gk)):t.uniform1i(s,0);let o=t.getUniformLocation(i,"cursorSampler");t.uniform1i(o,0);let a=t.getUniformLocation(this.shaderProgram,"waterMarkSampler");t.uniform1i(a,P.GV)},dt.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},dt.prototype.clearDisplay=function(){var e=this.contextGL;e&&(e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT))},dt.prototype.cleanup=function(){let e=this.canvasElement,t=ot.get(e);if(t&&this.removeEventListener(e,t),e.defaultContextLostHandler||(e.defaultContextLostHandler=nt,e.addEventListener("webglcontextlost",nt,{capture:!1})),this.cleanupRoundedCornerRadius(),this.isAvaiable()){var i=this.contextGL;i.deleteProgram(this.program),i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,null),i.activeTexture(i.TEXTURE1),i.bindTexture(i.TEXTURE_2D,null),i.activeTexture(i.TEXTURE2),i.bindTexture(i.TEXTURE_2D,null),i.activeTexture(i.TEXTURE3),i.bindTexture(i.TEXTURE_2D,null),i.activeTexture(i.TEXTURE4),i.bindTexture(i.TEXTURE_2D,null),i.activeTexture(i.TEXTURE5),i.bindTexture(i.TEXTURE_2D,null),i.bindBuffer(i.ARRAY_BUFFER,null),i.deleteTexture(this.yTextureRef),i.deleteTexture(this.uTextureRef),i.deleteTexture(this.vTextureRef),i.deleteTexture(this.cursorTextureRef),i.deleteTexture(this.waterMarkTextureRef),i.deleteBuffer(this.vertexPosBuffer),i.deleteBuffer(this.texturePosBuffer),this.maskTextureRef&&i.deleteTexture(this.maskTextureRef),this.masktexturePosBuffer&&i.deleteBuffer(this.masktexturePosBuffer),i.glInitSucceed=0}},dt.prototype.updataVertexInfoForSharing=function(){const[e,t,i,r]=this.vertexPos,s=this.webglVertexPos[0],o=this.webglVertexPos[3];if(e!=s||o!=r){this.webglVertexPos[0]=e,this.webglVertexPos[1]=t,this.webglVertexPos[2]=i,this.webglVertexPos[3]=r;var a=new Float32Array([i,t,e,t,i,r,e,r,1,1,-1,1,1,-1,-1,-1]),n=this.contextGL;n.bindBuffer(n.ARRAY_BUFFER,this.vertexPosBuffer),n.bufferData(n.ARRAY_BUFFER,a,n.DYNAMIC_DRAW)}},dt.prototype.updateTextureInfoForSharing=function(){const[e,t,i,r]=this.texturePos,s=this.webglTexturePos[0],o=this.webglTexturePos[3];if(e!=s||o!=r){this.webglTexturePos[0]=e,this.webglTexturePos[1]=t,this.webglTexturePos[2]=i,this.webglTexturePos[3]=r;var a=new Float32Array([i,t,e,t,i,r,e,r,1,0,0,0,1,1,0,1]),n=this.contextGL;n.bindBuffer(n.ARRAY_BUFFER,this.texturePosBuffer),n.bufferData(n.ARRAY_BUFFER,a,n.DYNAMIC_DRAW)}},dt.prototype.updateVertexInfoForMultiView=function(e,t,i,r,s){var o,a,n,d,c=this.contextGL;if(this.isUseFillMode({width:i,height:r,rotation:s}))o=0,a=0,n=1,d=1;else{var l=s==this.ROTATION_CLOCK90||s==this.ROTATION_CLOCK270?r:i,h=s==this.ROTATION_CLOCK90||s==this.ROTATION_CLOCK270?i:r,u=l/h*t;u>e?(o=0,n=1,d=1-(a=(t-h/l*e)/2/t)):(a=0,d=1,n=1-(o=(e-u)/2/e))}o=2*o-1,n=2*n-1,a=1-2*a,d=1-2*d;var p=new Float32Array([n,a,o,a,n,d,o,d,1,1,-1,1,1,-1,-1,-1]);this.viewPostion=p,c.bindBuffer(c.ARRAY_BUFFER,this.vertexPosBuffer),c.bufferData(c.ARRAY_BUFFER,p,c.DYNAMIC_DRAW)},dt.prototype.getViewPosition=function(){let e=[0,0,1,1];if(!this.viewPostion)return e;const t=this.viewPostion[0],i=this.viewPostion[1],r=this.viewPostion[2],s=this.viewPostion[5];return e[0]=(1-i)/2,e[1]=(1+r)/2,e[2]=(1-s)/2,e[3]=(1+t)/2,e},dt.prototype.updateTextureInfoForMultiView=function(e,t,i,r,s,o,a){var n,d,c,l,h=this.contextGL;if(this.isUseFillMode({width:i.width,height:i.height,rotation:r})){const s=r==this.ROTATION_CLOCK90||r==this.ROTATION_CLOCK270?a/o:o/a,h=i.left||0,u=i.top||0;if(i.width/i.height>s){const r=i.height*s;n=u/t,d=(Math.round((i.width-r)/2)+h)/e,c=(u+i.height)/t,l=d+r/e}else{const r=i.width/s;c=(n=(Math.round((i.height-r)/2)+u)/t)+r/t,l=(d=h/e)+i.width/e}}else n=De(i.top/t,2),d=De(i.left/e,2),c=Me((i.top+i.height)/t,2),l=Me((i.width+i.left)/e,2);var u=[d,n,l,n,l,c,d,c];r==this.ROTATION_CLOCK90&&(u.unshift(u[6],u[7]),u=u.slice(0,8)),r==this.ROTATION_CLOCK180&&(u.unshift(u[4],u[5],u[6],u[7]),u=u.slice(0,8)),r==this.ROTATION_CLOCK270&&(u.push(u[0],u[1]),u=u.slice(2,10));var p=u[0],f=u[1];if(u[0]=u[2],u[1]=u[3],u[2]=p,u[3]=f,s)if(r==this.ROTATION_CLOCK90||r==this.ROTATION_CLOCK270){let e=u[1];u[1]=u[3],u[3]=e,e=u[5],u[5]=u[7],u[7]=e}else u[0]=1-u[0],u[2]=1-u[2],u[4]=1-u[4],u[6]=1-u[6];var m=new Float32Array([...u,1,0,0,0,1,1,0,1]);h.bindBuffer(h.ARRAY_BUFFER,this.texturePosBuffer),h.bufferData(h.ARRAY_BUFFER,m,h.DYNAMIC_DRAW)},dt.prototype.drawNextOutputPictureFrame=function(e,t,i,r,s){let o=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],a=arguments.length>6?arguments[6]:void 0,n=!(arguments.length>7&&void 0!==arguments[7])||arguments[7];if(!this.isAvaiable())return;var d=this.contextGL,c=this.yTextureRef,l=this.uTextureRef,h=this.vTextureRef;d.enable(d.BLEND),d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA),s=s||this.ROTATION_CLOCK0;var u=(i=i||{top:0,left:0,width:e,height:t}).width!=this.croppingParams.width||i.height!=this.croppingParams.height,p=(i.top!=this.croppingParams.top||(i.left,this.croppingParams.left),a.width!=this.viewWidth||a.height!=this.viewHeight),f=(e!=this.textureWidth||this.textureHeight,s!=this.picRotation);(u||p||f)&&function(e,t,i,r,s){let o=s.width,a=s.height;var n,d,c,l,h=r==e.ROTATION_CLOCK90||r==e.ROTATION_CLOCK270?i:t,u=r==e.ROTATION_CLOCK90||r==e.ROTATION_CLOCK270?t:i,p=h/u*a;p>o?(n=0,c=1,l=1-(d=(a-u/h*o)/2/a)):(d=0,l=1,c=1-(n=(o-p)/2/o)),n=parseFloat((2*n-1).toFixed(3)),c=parseFloat((2*c-1).toFixed(3)),d=parseFloat((1-2*d).toFixed(3)),l=parseFloat((1-2*l).toFixed(3)),e.vertexPos=[n,d,c,l]}(this,i.width,i.height,s,a),this.updataVertexInfoForSharing(),function(e,t,i,r,s){var o=r.top/i,a=r.left/t,n=(r.top+r.height)/i,d=(r.left+r.width)/t,c=[a,o,d,o,d,n,a,n];s==e.ROTATION_CLOCK90&&(c.unshift(c[6],c[7]),c=c.slice(0,8)),s==e.ROTATION_CLOCK180&&(c.unshift(c[4],c[5],c[6],c[7]),c=c.slice(0,8)),s==e.ROTATION_CLOCK270&&(c.push(c[0],c[1]),c=c.slice(2));var l=c[0],h=c[1];c[0]=c[2],c[1]=c[3],c[2]=l,c[3]=h;var u=new Float32Array([...c,1,0,0,0,1,1,0,1]),p=e.contextGL;p.bindBuffer(p.ARRAY_BUFFER,e.texturePosBuffer),p.bufferData(p.ARRAY_BUFFER,u,p.DYNAMIC_DRAW)}(this,e,t,i,s);let m=o?0:1;m!=this.colorRange&&(d.uniform1i(this.colorRangeRef,m),this.colorRange=m),d.viewport(a.x,a.y,a.width,a.height),this.viewport_rect||(this.viewport_rect=new Float32Array(4)),this.viewport_rect.set([a.x,a.y,a.width,a.height],0),d.uniform4fv(this.ul_viewport_rect,this.viewport_rect),d.uniform1i(this.onlyRGBARef,0),d.uniform1i(this.yuvmodeRef,P.Wp),Object.assign(this.croppingParams,i),this.textureWidth=e,this.textureHeight=t,this.picRotation=s,this.viewWidth=a.width,this.viewHeight=a.height;var v=r,g=e*t;if(d.activeTexture(d.TEXTURE0),d.bindTexture(d.TEXTURE_2D,c),n){var _=v.subarray(0,g);d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE,e,t,0,d.LUMINANCE,d.UNSIGNED_BYTE,_)}var S=e/2*t/2;if(d.activeTexture(d.TEXTURE1),d.bindTexture(d.TEXTURE_2D,l),n){var A=v.subarray(g,g+S);d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE,e/2,t/2,0,d.LUMINANCE,d.UNSIGNED_BYTE,A)}var y=S;if(d.activeTexture(d.TEXTURE2),d.bindTexture(d.TEXTURE_2D,h),n){var C=v.subarray(g+S,g+S+y);d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE,e/2,t/2,0,d.LUMINANCE,d.UNSIGNED_BYTE,C)}d.activeTexture(d.TEXTURE0+P.Yy),d.bindTexture(d.TEXTURE_2D,this.cursorTextureRef),this.hasCursor?d.uniform1i(this.cursorFlagRef,1):n&&d.texImage2D(d.TEXTURE_2D,0,d.RGBA,1,1,0,d.RGBA,d.UNSIGNED_BYTE,this.dummpyCursor),d.uniform4f(this.cursorInfoRef,this.cx,this.cy,this.cw,this.ch),this.render(),this.hasWholeFrame=1},dt.prototype.updateCursor=function(e,t,i,r){if(this.isAvaiable()){var s=this.contextGL;e<=0||t<=0||!i||i.length!=e*t*4||r!=this.lastcursorSyncId&&(this.lastcursorSyncId=r,s.activeTexture(s.TEXTURE0+P.Yy),s.bindTexture(s.TEXTURE_2D,this.cursorTextureRef),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,e,t,0,s.RGBA,s.UNSIGNED_BYTE,i),this.cursorWidth=e,this.cursorHeight=t,this.hasCursor=1)}},dt.prototype.updateCursorPosInfo=function(e,t,i,r,s){if(e&&this.hasCursor){let e=t/this.croppingParams.width,o=i/this.croppingParams.height,a=r/this.croppingParams.width,n=s/this.croppingParams.height;this.cx=e,this.cy=o,this.cw=a,this.ch=n}else this.cx=0,this.cy=0,this.cw=0,this.ch=0},dt.prototype.isHasWholeFrame=function(){return this.hasWholeFrame},dt.prototype.updateWatermark=function(e,t,i){if(this.isAvaiable()){var r=this.contextGL;e<=0||t<=0||!i||i.length!=e*t*4||(this.hasWaterMark=1,this.watermarkWidth=e,this.watermarkHeight=t,r.activeTexture(r.TEXTURE0+P.GV),r.bindTexture(r.TEXTURE_2D,this.waterMarkTextureRef),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,this.watermarkWidth,this.watermarkHeight,0,r.RGBA,r.UNSIGNED_BYTE,i))}},dt.prototype.drawWatermark=function(){if(this.isAvaiable()){var e=this.contextGL;this.isSetWatermark()&&this.watermarkWidth&&this.watermarkHeight&&(e.uniform1i(this.waterMarkFlagRef,1),e.activeTexture(e.TEXTURE0+P.GV),e.bindTexture(e.TEXTURE_2D,this.waterMarkTextureRef),e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.drawArrays(e.TRIANGLE_STRIP,4,4))}},dt.prototype.drawRoundedCorner=function(){if(this.isAvaiable()){var e=this.contextGL;e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.uniform1f(this.ul_enable_rounded_corner,this.enable_rounded_corner),e.uniform1f(this.ul_radius_lt_x,this.radius_lt_x),e.uniform1f(this.ul_radius_lt_y,this.radius_lt_y),e.uniform1f(this.ul_radius_lb_x,this.radius_lb_x),e.uniform1f(this.ul_radius_lb_y,this.radius_lb_y),e.uniform1f(this.ul_radius_rt_x,this.radius_rt_x),e.uniform1f(this.ul_radius_rt_y,this.radius_rt_y),e.uniform1f(this.ul_radius_rb_x,this.radius_rb_x),e.uniform1f(this.ul_radius_rb_y,this.radius_rb_y),e.uniform1f(this.ul_aa_width,this.aa_width)}},dt.prototype.cleanupRoundedCornerRadius=function(){this.enable_rounded_corner=0,this.radius_lt_x=0,this.radius_lt_y=0,this.radius_lb_x=0,this.radius_lb_y=0,this.radius_rt_x=0,this.radius_rt_y=0,this.radius_rb_x=0,this.radius_rb_y=0,this.aa_width=B.ru,this.viewport_rect=null},dt.prototype.render=function(){if(this.isAvaiable()){var e=this.contextGL;this.drawRoundedCorner(),e.uniform1i(this.waterMarkFlagRef,0),e.drawArrays(e.TRIANGLE_STRIP,0,4),this.drawWatermark()}},dt.prototype.clear=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.hasCursor=0,this.watermarkHeight=0,this.watermarkWidth=0,this.watermarkRepeated=!1,this.hasWholeFrame=0,this.lastcursorSyncId=-1,this.cleanupRoundedCornerRadius(),e&&this.clearCanvas({R:0,G:0,B:0,A:0})},dt.prototype.clearCanvas=function(e){if(this.cleanupRoundedCornerRadius(),this.isAvaiable()){var t=this.contextGL;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)}},dt.prototype.isRGBAMode=function(e){return-1!==[P.rK,P.hd].indexOf(e)},dt.prototype.updateRemoteVideoTextures=function(e,t,i,r,s){let o=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],a=arguments.length>6?arguments[6]:void 0,n=!(arguments.length>8&&void 0!==arguments[8])||arguments[8];if(!this.isAvaiable())return;var d=this.contextGL,c=this.yTextureRef,l=this.uTextureRef,h=this.vTextureRef;d.enable(d.BLEND),d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);const u=this.isRGBAMode(this.videoMode);if(e<=0||t<=0||!r||!r.length||r.length!=e*t*3/2&&!u||i&&(i.top<0||i.left<0||i.left+i.width>e||i.top+i.height>t))return!1;let p=o?0:1;if(this.colorRange=p,this.rotation=s,Object.assign(this.croppingParams,i),this.textureWidth=e,this.textureHeight=t,this.viewWidth=a.width,this.viewHeight=a.height,!n)return;if(d.bindTexture(d.TEXTURE_2D,c),u)return void d.texImage2D(d.TEXTURE_2D,0,d.RGBA,e,t,0,d.RGBA,d.UNSIGNED_BYTE,r);var f=r,m=e*t,v=f.subarray(0,m);d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE,e,t,0,d.LUMINANCE,d.UNSIGNED_BYTE,v);let g=0,_=0;this.videoMode==P.Wp?(g=e/2*t/2,_=g):this.videoMode==P.pn&&(g=e*t/2,_=0);var S=f.subarray(m,m+g);if(d.bindTexture(d.TEXTURE_2D,l),_){d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE,e/2,t/2,0,d.LUMINANCE,d.UNSIGNED_BYTE,S);var A=f.subarray(m+g,m+g+_);d.bindTexture(d.TEXTURE_2D,h),d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE,e/2,t/2,0,d.LUMINANCE,d.UNSIGNED_BYTE,A)}else d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE_ALPHA,e/2,t/2,0,d.LUMINANCE_ALPHA,d.UNSIGNED_BYTE,S);return!0},dt.prototype.updateRemoteVideoTexturesImageBitmap=function(e,t,i,r,s){let o=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];if(e<=0||t<=0||!i)return;if(!this.isAvaiable())return;var a=this.contextGL;if(this.textureWidth=e,this.textureHeight=t,Number.isNaN(s)||(this.rotation=s),Object.assign(this.croppingParams,r),!o)return;a.bindTexture(a.TEXTURE_2D,this.yTextureRef);const n=a.RGBA,d=a.RGBA,c=a.UNSIGNED_BYTE;a.texImage2D(a.TEXTURE_2D,0,n,d,c,i)},dt.prototype.updateSelfMaskImage=function(e,t,i){if(!(e<=0||t<=0)&&i&&i.length==e*t*4&&this.isAvaiable()){var r=this.contextGL;r.bindTexture(r.TEXTURE_2D,this.maskTextureRef),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,e,t,0,r.RGBA,r.UNSIGNED_BYTE,i)}},dt.prototype.VideoFlip=function(){if(this.isAvaiable()){var e=this.contextGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1)}},dt.prototype.drawRemoteVideo=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.isAvaiable())return;var i=this.contextGL;let r=this.isRGBAMode(this.videoMode)?1:0;i.uniform1i(this.colorRangeRef,this.colorRange),this.setUniformFlag(r,this.hasCursor,this.videoMode),this.initmask&&i.uniform1i(this.maskFlagRef,1),this.updateTextureInfoForMultiView(this.textureWidth,this.textureHeight,this.croppingParams,this.rotation,t,e.width,e.height),i.viewport(e.x,e.y,e.width,e.height),this.viewport_rect||(this.viewport_rect=new Float32Array(4)),this.viewport_rect.set([e.x,e.y,e.width,e.height],0),i.uniform4fv(this.ul_viewport_rect,this.viewport_rect),this.updateVertexInfoForMultiView(e.width,e.height,this.croppingParams.width,this.croppingParams.height,this.rotation),this.BindTextures(this.videoMode),i.enable(i.BLEND),i.blendFunc(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA),this.render()},dt.prototype.readPixelsSyncRequest=function(e,t,i,r){if(this.isAvaiable()){var s,o=this.contextGL;return this.destination&&this.destination.length==i*r*4||(this.destination=new Uint8Array(i*r*4)),s=this.destination,o.flush(),o.readPixels(e,t,i,r,o.RGBA,o.UNSIGNED_BYTE,s),s}},dt.prototype.updateSelfVideoTextures=function(e,t,i,r){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(!(e<=0||t<=0)&&i&&i.length%4==0&&this.isAvaiable()){var a=this.contextGL;this.textureWidth=e,this.textureHeight=t,this.rotation=o,Object.assign(this.croppingParams,r),s&&(a.bindTexture(a.TEXTURE_2D,this.yTextureRef),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,e,t,0,a.RGBA,a.UNSIGNED_BYTE,i))}},dt.prototype.drawSelfVideo=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.isAvaiable()){var r=this.contextGL;this.setUniformFlag(1,this.hasCursor,this.videoMode),this.updateTextureInfoForMultiView(this.textureWidth,this.textureHeight,this.croppingParams,this.rotation,i,e.width,e.height),r.viewport(e.x,e.y,e.width,e.height),this.viewport_rect||(this.viewport_rect=new Float32Array(4)),this.viewport_rect.set([e.x,e.y,e.width,e.height],0),r.uniform4fv(this.ul_viewport_rect,this.viewport_rect),t?(r.enable(r.BLEND),r.blendFunc(r.ZERO,r.ZERO),this.updateVertexInfoForMultiView(e.width,e.height,e.width,e.height,this.ROTATION_CLOCK0)):(r.enable(r.BLEND),r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA),this.updateVertexInfoForMultiView(e.width,e.height,this.croppingParams.width,this.croppingParams.height,this.rotation)),this.BindTextures(P.rK),this.render()}},dt.prototype.isSetWatermark=function(){return this.hasWaterMark},dt.prototype.setWatermarkFlag=function(e){this.hasWaterMark=e,e||(this.setWatermarkRepeated(!1),this.setWatermarkOpacity(),this.setWatermarkPosition(16))},dt.prototype.setUniformFlag=function(e,t,i){if(this.isAvaiable()){var r=this.contextGL;r.uniform1i(this.onlyRGBARef,e),r.uniform1i(this.bgraModeRef,e&&i===P.hd?1:0),r.uniform1i(this.cursorFlagRef,t),e||r.uniform1i(this.yuvmodeRef,i)}},dt.prototype.setVideoMode=function(e){this.videoMode=e},dt.prototype.getVideoMode=function(e){return this.videoMode},dt.prototype.setWatermarkRepeated=function(e){this.watermarkRepeated=e},dt.prototype.isWatermarkRepeated=function(){return!!this.watermarkRepeated},dt.prototype.setWatermarkOpacity=function(e){this.watermarkOpacity=e||.15},dt.prototype.getWatermarkOpacity=function(){return this.watermarkOpacity},dt.prototype.setWatermarkPosition=function(e){this.watermarkPosition=e||16},dt.prototype.getWatermarkPosition=function(){return this.watermarkPosition},dt.prototype.setMultiView=function(e){return this.isMultiView=e},dt.prototype.getRepeatedWatermarkUniformValue=function(){return this.isMultiView?30:7},dt.prototype.getRepeatedWatermarkTextureValue=function(e){return this.isMultiView?e.TEXTURE30:e.TEXTURE7},dt.prototype.setFillMode=function(){let 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},dt.prototype.getFillMode=function(){return this.fillMode},dt.prototype.getFillModeForResolution=function(){return this.fillModeForResolution},dt.prototype.getTextureIndex=function(){return this.textureindex},dt.prototype.getTextureWidth=function(){return this.textureWidth},dt.prototype.getTextureHeight=function(){return this.textureHeight},dt.prototype.getRotation=function(){return this.rotation},dt.prototype.getCroppingParams=function(){return this.croppingParams},dt.prototype.getIndex=function(){return this.textureindex},dt.prototype.getWatermarkWidth=function(){return this.watermarkWidth},dt.prototype.getWatermarkHeight=function(){return this.watermarkHeight},dt.prototype.getWatermarkOpacity=function(){return this.watermarkOpacity},dt.prototype.getAttachedCanvas=function(){return this.canvasElement},dt.prototype.getCanvasId=function(){return this.canvasID},dt.prototype.resizeCanvasTo=function(e,t){this.contextGL.canvas.width=e,this.contextGL.canvas.height=t},dt.prototype.isUseFillMode=function(e){let{width:t,height:i,rotation:r}=e;if(!this.fillMode)return!1;if(!this.fillModeForResolution)return!0;if(!t||!i)return!1;const s=r===this.ROTATION_CLOCK90||r==this.ROTATION_CLOCK270?i/t:t/i;return(Array.isArray(this.fillModeForResolution)?this.fillModeForResolution:[this.fillModeForResolution]).some((e=>Math.abs(s-e)<.01))},dt.prototype.setRoundedCornerRadius=function(e){e?(this.radius_lt_x=e.radius_lt_x,this.radius_lt_y=e.radius_lt_y,this.radius_lb_x=e.radius_lb_x,this.radius_lb_y=e.radius_lb_y,this.radius_rt_x=e.radius_rt_x,this.radius_rt_y=e.radius_rt_y,this.radius_rb_x=e.radius_rb_x,this.radius_rb_y=e.radius_rb_y,0===this.radius_lt_x&&0===this.radius_lt_y&&0===this.radius_lb_x&&0===this.radius_lb_y&&0===this.radius_rt_x&&0===this.radius_rt_y&&0===this.radius_rb_x&&0===this.radius_rb_y?this.enable_rounded_corner=0:this.enable_rounded_corner=1):this.enable_rounded_corner=0},dt.prototype.setAntialiasWidth=function(e){(e<=0||e>=1)&&(e=B.ru),this.aa_width=e};const ct=dt;class lt{getVideoRenderDisplay(e,t,i,r,s){throw new Error("getVideoRenderDisplay() should be implemented by subclass.")}getRenderDisplay(e,t,i){throw new Error("getRenderDisplay() should be implemented by subclass.")}createVideoRenderDisplay(e,t,i){throw new Error("createVideoRenderDisplay() should be implemented by subclass.")}}function ht(e,t,i){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function ut(e,t){return e.get(ft(e,t))}function pt(e,t,i){return e.set(ft(e,t),i),i}function ft(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var mt=new WeakMap,vt=new WeakMap;class gt extends lt{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),ht(this,mt,new Map),ht(this,vt,!1),pt(vt,this,e)}setCanvasAlphaChannelEnability(e){pt(vt,this,e)}createVideoRenderDisplay(e,t,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,s=null,o=null,a=null,n=!1;return r&&(s=r.forceNoGL,o=r.contextOptions,a=r.webGLResources,n=r.initMask),new ct(e,t,i,s,o,a,n,ut(vt,this))}getVideoRenderDisplay(e,t,i,r){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=ut(mt,this).get(e);if(!o){let r=[];o=[r,[]],ut(mt,this).set(e,o);let a=new ct(e,t,0,void 0,void 0,void 0,void 0,ut(vt,this));a.setMultiView(!0),s&&s.set(e,a);let n=1;for(;n<=i;n++){const i=new ct(e,t,n,void 0,void 0,{program:a.shaderProgram,contextgl:a.contextGL,vBuffer:a.vertexPosBuffer,tBuffer:a.texturePosBuffer,waterMarkTextureRef:a.waterMarkTextureRef,repeatedWaterMarkTextureRef:a.repeatedWaterMarkTextureRef},void 0,ut(vt,this));i.setMultiView(!0),r.push(i)}}let a,n=ut(mt,this).get(e),d=n[0],c=n[1];if(n&&d[0]&&(a=d.pop(),c.push(a)),!a){const e=n?"".concat(n.length):"undefined",t=d?"".concat(d.length):"undefined";r("No Display obtained from VideoRender.Get_Display. canvasRenderArray:".concat(e," unusedRenderArray:").concat(t))}return a}onWebglContextLostForMulti(e,t){const{canvas:i}=t;let r=ut(mt,this).get(i);var[s,o,a]=r;[...s,...o].forEach((e=>e.clear()))}onRestoredFromLostForMulti(e,t){if(!t)return;const{canvas:i}=t;let r=ut(mt,this).get(i);var[s,o,a]=r;const n=[...s,...o];let d=n.find((e=>e.isLocalDisplay()));d.webglVertexPos=[0,0,0,0],d.webglTexturePos=[0,0,0,0],a.args={program:d.shaderProgram,contextgl:d.contextGL,vBuffer:d.vertexPosBuffer,tBuffer:d.texturePosBuffer,webglVertexPos:d.webglVertexPos,webglTexturePos:d.webglTexturePos},n.forEach((e=>{e!=d&&e.reinit(a.args)}))}getRenderDisplay(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=ut(mt,this).get(e);if(!r){let s=[],o={canvasId:t,size:1,args:{}};r=[s,[],o],ut(mt,this).set(e,r);const a={webglcontextlostCallback:this.onWebglContextLostForMulti.bind(this),webglcontextrestoredCallback:this.onRestoredFromLostForMulti.bind(this),params:{canvas:e,rendercanvasID:t}};let n=new ct(e,t,0,void 0,a,void 0,void 0,ut(vt,this));i&&i.set(e,n),s.push(n),o.args={program:n.shaderProgram,contextgl:n.contextGL,vBuffer:n.vertexPosBuffer,tBuffer:n.texturePosBuffer,webglVertexPos:n.webglVertexPos,webglTexturePos:n.webglTexturePos}}if(!r[0].length){const i=new ct(e,t,r[2].size,void 0,void 0,r[2].args,void 0,ut(vt,this));r[2].size++,r[0].push(i)}let s=r[0].pop();return r[1].push(s),s}recycleRenderDisplay(e,t,i){t.setWatermarkFlag(0),t.setVideoMode(P.kh),t.clear(i);let r=ut(mt,this).get(e);if(r){let e=r[0],i=r[1];i&&i.some((function(e,r){if(e===t)return i.splice(r,1),!0})),e.push(t)}}onRestoredFromContextLost(e,t,i,r,s){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,a=ut(mt,this).get(i);(!a||a.length<2)&&s("canvasRenderArray:".concat(a,", length:").concat(null==a?void 0:a.length));let n=o.get(t);if(n){n.reinit();for(let e=0;e<(null==a?void 0:a.length);e++)a[e].forEach((e=>{null==e||e.reinit({program:n.shaderProgram,contextgl:n.contextGL,vBuffer:n.vertexPosBuffer,tBuffer:n.texturePosBuffer,waterMarkTextureRef:n.waterMarkTextureRef,repeatedWaterMarkTextureRef:n.repeatedWaterMarkTextureRef})}));return i!==t&&(ut(mt,this).delete(i),ut(mt,this).set(t,a),o&&(o.delete(i),o.set(t,n))),null}}getRenderDisplayMap(){return ut(mt,this)}cleanup(e,t){var i;null==t||null===(i=t.cleanup)||void 0===i||i.call(t,null);for(const[e,t]of ut(mt,this)){const e=t[0],i=t[1];for(const t of e)t.cleanup();for(const e of i)e.cleanup()}pt(mt,this,new Map)}cleanupByCanvas(e){if(ut(mt,this).get(e)){let t=ut(mt,this).get(e);if(t){let i=t[0],r=t[1];r.forEach((function(e){var t;null==e||null===(t=e.cleanup)||void 0===t||t.call(e)})),i.forEach((function(e){var t;null==e||null===(t=e.cleanup)||void 0===t||t.call(e)})),i=[],r=[],ut(mt,this).delete(e)}}else{var t,i;null===(t=e.display)||void 0===t||null===(i=t.cleanup)||void 0===i||i.call(t)}}}function _t(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,r)}return i}function St(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?_t(Object(i),!0).forEach((function(t){(0,v.A)(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):_t(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}let At=new Map,yt=[];function Ct(e){e.preventDefault()}function Et(e,t,i,r,s,o,a){let n=arguments.length>7&&void 0!==arguments[7]&&arguments[7];this.canvasElement=e,this.canvasID=t,this.contextOptions=s,this.textureindex=i||0,this.initmask=!!a,this.isEnableCanvasAlphaChannel=n,Et.prototype.ROTATION_CLOCK0=0,Et.prototype.ROTATION_CLOCK90=1,Et.prototype.ROTATION_CLOCK180=2,Et.prototype.ROTATION_CLOCK270=3,this.webGLResources=o,o||(this.initContextGL(),this.contextGL&&(this.webGLContextLostProtect(),this.contextGL.isContextLost()&&this.restoreContext())),this.webglVertexPos=[0,0,0,0],this.webglTexturePos=[0,0,0,0],this.vertexPos=[0,0,0,0],this.texturePos=[0,0,0,0],this.reinit(o);var d=new ArrayBuffer(4);this.dummpyCursor=new Uint8Array(d),this.dummpyWaterMark=new Uint8Array(d),this.cursorWidth=0,this.cursorHeight=0,this.hasCursor=0,this.lastcursorSyncId=-1,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.viewWidth=0,this.viewHeight=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=P.kh,this.rotation=this.ROTATION_CLOCK0,this.fillMode=0,this.fillModeForResolution=0,this.viewPostion=null,this.enable_rounded_corner=0,this.radius_lt_x=0,this.radius_lt_y=0,this.radius_lb_x=0,this.radius_lb_y=0,this.radius_rt_x=0,this.radius_rt_y=0,this.radius_rb_x=0,this.radius_rb_y=0,this.aa_width=B.ru,this.uv_rect=null}Et.prototype.isLocalDisplay=function(){return 0==this.textureindex},Et.prototype.reinit=function(e){if(this.webGLResources=e,!this.contextGL||this.contextGL.isContextLost()||this.contextGL.glInitSucceed||this.webGLResources){if(this.webGLResources&&this.webGLResources.contextgl&&!this.webGLResources.contextgl.isContextLost()){this.contextGL=this.webGLResources.contextgl,this.shaderProgram=this.webGLResources.program,this.vertexPosBuffer=this.webGLResources.vBuffer,this.texturePosBuffer=this.webGLResources.tBuffer,this.webglTexturePos=this.webGLResources.webglTexturePos,this.webglVertexPos=this.webGLResources.webglVertexPos,this.initTextures(!1);let e=this.contextGL.getError();this.contextGL.glInitSucceed=e!=this.contextGL.NO_ERROR&&e!=this.contextGL.CONTEXT_LOST_WEBGL?0:1}}else{this.initProgram(),this.initmask?this.initTextures(!1):this.initTextures(!0),this.initBuffers();let e=this.contextGL.getError();this.contextGL.glInitSucceed=e!=this.contextGL.NO_ERROR&&e!=this.contextGL.CONTEXT_LOST_WEBGL?0:1}},Et.prototype.webGLContextLostSimulate=function(){let e="undefined"==typeof window?self:window;e.webGLEXTSimulate=e.webGLEXTSimulate||[],e.webGLEXTSimulate.push((0,j.px)(this.contextGL,"WEBGL_lose_context"))},Et.prototype.restoreContext=function(){if(this.contextGL)try{var e;null!==(e=this.canvasElement)&&void 0!==e&&e.loseContextExtension&&!this.canvasElement.restoreTimeoutId&&this.contextGL.isContextLost()&&(this.canvasElement.restoreTimeoutId=setTimeout((()=>{this.canvasElement.reportcontextloss||(this.canvasElement.reportcontextloss=!0,(0,j.S_)("WebGL2RestoreTimeout")),this.canvasElement.restoreTimeoutId=0}),1500),this.canvasElement.loseContextExtension.restoreContext())}catch(e){(0,j.Yd)("webgl restoreContext exception2",e)}},Et.prototype.webgGLContextLostCallback=function(e){(0,j.fn)("webglcontextlost2 event: canvas listener size=".concat(yt.length,", canvas id: ").concat(this.canvasID,", , ids:").concat(yt.join())),e.preventDefault(),this.contextGL.glInitSucceed=0,this.contextOptions&&this.contextOptions.webglcontextlostCallback&&this.contextOptions.webglcontextlostCallback(e,this.contextOptions.params)},Et.prototype.removeEventListener=function(e,t){if(e&&t){e.restoreTimeoutId&&(clearTimeout(e.restoreTimeoutId),e.restoreTimeoutId=void 0),e.removeEventListener("webglcontextlost",t.contextLostHandler),e.removeEventListener("webglcontextrestored",t.contextRestoredHandler);const i=yt.indexOf(this.canvasID);yt.splice(i,1),At.delete(e)}},Et.prototype.webGLContextRestoredCallback=function(e){var t,i;(0,j.fn)("webglcontextrestored2 event from canvas id: ".concat(this.canvasID)),this.canvasElement.restoreTimeoutId&&(clearTimeout(this.canvasElement.restoreTimeoutId),this.canvasElement.restoreTimeoutId=void 0),this.webglVertexPos=[0,0,0,0],this.webglTexturePos=[0,0,0,0],this.reinit(),null===(t=this.contextOptions)||void 0===t||null===(i=t.webglcontextrestoredCallback)||void 0===i||i.call(t,e,this.contextOptions.params)},Et.prototype.webGLContextLostProtect=function(){this.canvasElement&&!this.canvasElement.loseContextExtension&&(this.canvasElement.loseContextExtension=(0,j.px)(this.contextGL,"WEBGL_lose_context"));let e=this.canvasElement,t=At.get(e);t&&this.removeEventListener(e,t),At.set(e,this),this.contextLostHandler=this.webgGLContextLostCallback.bind(this),this.contextRestoredHandler=this.webGLContextRestoredCallback.bind(this),e.addEventListener("webglcontextlost",this.contextLostHandler,{capture:!1}),e.addEventListener("webglcontextrestored",this.contextRestoredHandler,{capture:!1}),-1===yt.indexOf(this.canvasID)&&(yt.push(this.canvasID),yt.length>4&&(0,j.fn)("webgl2canvas listener size=".concat(yt.length,", ids:").concat(yt.join())))},Et.prototype.isWebGL2=function(){return this.contextGL},Et.prototype.isAvaiable=function(){return this.contextGL&&!this.contextGL.isContextLost()&&this.contextGL.glInitSucceed},Et.prototype.initContextGL=function(){for(var e,t,i,r=this.canvasElement,s=null,o=["webgl2"],a=0;!s&&a<o.length;){var n=o[a];try{if((0,it.B)().config.isEnableCanvasCtxOptionsOpt()){let e={depth:!1,stencil:!1,antialias:!1,alpha:this.isEnableCanvasAlphaChannel};if(this.contextOptions){let t=St(St({},this.contextOptions),e);s=r.getContext(n,t)}else s=r.getContext(n,e)}else s=this.contextOptions?r.getContext(n,this.contextOptions):r.getContext(n)}catch(e){s=null}s&&"function"==typeof s.getParameter||(s=null),++a}if(this.contextGL=s,!s||s.isContextLost())return(0,j.Yd)("Failed when trying to get WebGLContext2 on canvas(".concat(null===(e=this.canvasElement)||void 0===e?void 0:e.width,",").concat(null===(t=this.canvasElement)||void 0===t?void 0:t.height,"), gl=").concat(s,", lost=").concat(null===(i=s)||void 0===i?void 0:i.isContextLost())),void(0,j.S_)("initWebGL2Fail");s.glInitSucceed=0},Et.prototype.initProgram=function(){var e=this.contextGL,t=e.createShader(e.VERTEX_SHADER);e.shaderSource(t,"#version 300 es\n in vec4 vertexPos;\n in vec4 texturePos;\n in vec4 masktexturePos;\n out vec2 textureCoord;\n out vec2 masktextureCoord;\n\n void main() {\n gl_Position = vertexPos;\n textureCoord = texturePos.xy;\n masktextureCoord = masktexturePos.xy;\n }\n "),e.compileShader(t),e.getShaderParameter(t,e.COMPILE_STATUS)||e.isContextLost()||(0,j.fn)("webgl2 Vertex shader failed to compile: "+e.getShaderInfoLog(t));var i=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(i,"#version 300 es\n precision highp float;\n\n in highp vec2 textureCoord;\n in highp vec2 masktextureCoord;\n uniform sampler2D ySampler;\n uniform sampler2D uSampler;\n uniform sampler2D vSampler;\n uniform sampler2D cursorSampler;\n uniform sampler2D waterMarkSampler;\n uniform sampler2D previewVideoSampler;\n uniform sampler2D maskSampler;\n uniform vec4 cursorInfo;\n uniform int onlyRGBA;\n uniform int bgraMode;\n uniform int colorRange;\n uniform int waterMarkFlag;\n uniform int cursorFlag;\n uniform int maskFlag;\n uniform int yuvmode;\n\n // rounded corner feature in gl shader\n uniform float u_enable_rounded_corner;\n uniform float u_radius_lt_x;\n uniform float u_radius_lt_y;\n uniform float u_radius_lb_x;\n uniform float u_radius_lb_y;\n uniform float u_radius_rt_x;\n uniform float u_radius_rt_y;\n uniform float u_radius_rb_x;\n uniform float u_radius_rb_y;\n uniform float u_aa_width;\n uniform vec4 u_viewport_rect;\n\n const mat4 YUV2RGB_L = mat4(\n 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1\n );\n\n const mat4 YUV2RGB_F = mat4(\n 1.0, 0, 1.402, -.701,\n 1.0, -.34413, -.71414, .529135,\n 1.0, 1.772, 0, -.886,\n 0, 0, 0, 1\n );\n\n out vec4 outputColor;\n\n void main(void) {\n vec4 c;\n if (waterMarkFlag != 1) {\n if (onlyRGBA == 0) {\n highp float y = texture(ySampler, textureCoord).r;\n highp float u;\n highp float v;\n if (yuvmode == 1) {\n u = texture(uSampler, textureCoord).r;\n v = texture(vSampler, textureCoord).r;\n } else {\n u = texture(uSampler, textureCoord).r;\n v = texture(uSampler, textureCoord).a;\n }\n\n if (colorRange == 0) {\n c = vec4(y, u, v, 1) * YUV2RGB_L;\n } else {\n c = vec4(y, u, v, 1) * YUV2RGB_F;\n }\n\n if (cursorFlag == 1) {\n if (cursorInfo.z > 0.0 && textureCoord.x >= cursorInfo.x && textureCoord.y >= cursorInfo.y &&\n textureCoord.x < cursorInfo.x+cursorInfo.z && textureCoord.y < cursorInfo.y+cursorInfo.w) {\n vec2 cursorCoord = textureCoord - cursorInfo.xy;\n cursorCoord /= cursorInfo.zw;\n vec4 cursor = texture(cursorSampler, cursorCoord);\n c = c*(1.0-cursor.a) + cursor*cursor.a;\n }\n }\n } else {\n c = texture(previewVideoSampler, textureCoord);\n if (bgraMode == 1) {\n c = vec4(c.b, c.g, c.r, c.a);\n }\n }\n }\n\n if (waterMarkFlag == 1) {\n c = texture(waterMarkSampler, textureCoord);\n if (c.r == 0.0 && c.g == 0.0 && c.b == 0.0) {\n c.a = 0.0;\n }\n }\n\n if (maskFlag == 1 && waterMarkFlag != 1) {\n vec4 mask = texture(maskSampler, masktextureCoord);\n if (mask.r != 0.0 || mask.g != 0.0 || mask.b != 0.0) {\n c = mask * mask.a + c * (1.0 - mask.a);\n }\n }\n\n if (waterMarkFlag != 1) {\n c.a = 1.0;\n }\n\n if (u_enable_rounded_corner < 0.5) {\n outputColor = c;\n return;\n }\n\n // step 1: viewport coordinate mapping\n // convert the fragment coordinate(canvas coordinate) to the viewport coordinate\n // for example, a viewport={x: 100, y: 100, w: 200, h: 160}, a fragCoord.xy={x:120, y: 120}\n // we can get the pos={x: 20, y: 20}\n vec2 pos = gl_FragCoord.xy - u_viewport_rect.xy;\n vec2 viewportSize = u_viewport_rect.zw;\n\n // convert the normalized radius to pixel value\n float r_lt_x = u_radius_lt_x * viewportSize.x;\n float r_lt_y = u_radius_lt_y * viewportSize.y;\n float r_rt_x = u_radius_rt_x * viewportSize.x;\n float r_rt_y = u_radius_rt_y * viewportSize.y;\n float r_lb_x = u_radius_lb_x * viewportSize.x;\n float r_lb_y = u_radius_lb_y * viewportSize.y;\n float r_rb_x = u_radius_rb_x * viewportSize.x;\n float r_rb_y = u_radius_rb_y * viewportSize.y;\n\n // step 2: calculate the rounded corner mask (as alpha)\n float alpha = 1.0;\n\n // --- calculation of the left-top corner ---\n // Condition: if (pos.x < r_lt_x && pos.y < r_lt_y)\n float in_lt = (1.0 - step(r_lt_x, pos.x)) * (1.0 - step(r_lt_y, pos.y));\n // the circle center of the left-top corner in pixel coordinate\n vec2 center_lt = vec2(r_lt_x, r_lt_y);\n // calculate and normalize the distance between the fragment and the center\n vec2 diff_lt = (pos - center_lt) / vec2(r_lt_x, r_lt_y);\n float normDist_lt = length(diff_lt);\n // smoothstep function is used to calculate the alpha value\n float mask_lt = 1.0 - smoothstep(1.0 - u_aa_width, 1.0, normDist_lt);\n float final_lt = mix(1.0, mask_lt, in_lt);\n\n // --- calculation of the right-top corner ---\n float in_rt = (1.0 - step(r_rt_x, viewportSize.x - pos.x)) * (1.0 - step(r_rt_y, pos.y));\n vec2 center_rt = vec2(viewportSize.x - r_rt_x, r_rt_y);\n vec2 diff_rt = (pos - center_rt) / vec2(r_rt_x, r_rt_y);\n float normDist_rt = length(diff_rt);\n float mask_rt = 1.0 - smoothstep(1.0 - u_aa_width, 1.0, normDist_rt);\n float final_rt = mix(1.0, mask_rt, in_rt);\n\n // --- calculation of the left-bottom corner ---\n float in_lb = (1.0 - step(r_lb_x, pos.x)) * (1.0 - step(r_lb_y, viewportSize.y - pos.y));\n vec2 center_lb = vec2(r_lb_x, viewportSize.y - r_lb_y);\n vec2 diff_lb = (pos - center_lb) / vec2(r_lb_x, r_lb_y);\n float normDist_lb = length(diff_lb);\n float mask_lb = 1.0 - smoothstep(1.0 - u_aa_width, 1.0, normDist_lb);\n float final_lb = mix(1.0, mask_lb, in_lb);\n\n // --- calculation of the right-bottom corner ---\n float in_rb = (1.0 - step(r_rb_x, viewportSize.x - pos.x)) * (1.0 - step(r_rb_y, viewportSize.y - pos.y));\n vec2 center_rb = vec2(viewportSize.x - r_rb_x, viewportSize.y - r_rb_y);\n vec2 diff_rb = (pos - center_rb) / vec2(r_rb_x, r_rb_y);\n float normDist_rb = length(diff_rb);\n float mask_rb = 1.0 - smoothstep(1.0 - u_aa_width, 1.0, normDist_rb);\n float final_rb = mix(1.0, mask_rb, in_rb);\n\n // step 3: Get the minimum value from the four corners (to ensure that if any corner requires transparency it is applied)\n float finalAlpha = min(min(final_lt, final_rt), min(final_lb, final_rb));\n\n // step 4: Final output color\n outputColor = vec4(c.rgb, c.a * finalAlpha);\n }\n "),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)||e.isContextLost()||(0,j.fn)("webgl2 Fragment shader failed to compile: "+e.getShaderInfoLog(i));var r=e.createProgram();e.attachShader(r,t),e.attachShader(r,i),e.linkProgram(r),e.getProgramParameter(r,e.LINK_STATUS)||e.isContextLost()||(0,j.fn)("webgl2 Program failed to compile: "+e.getProgramInfoLog(r)),e.useProgram(r),this.shaderProgram=r},Et.prototype.initBuffers=function(){var e=this.contextGL,t=this.shaderProgram,i=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,i),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 r=e.getAttribLocation(t,"vertexPos");e.enableVertexAttribArray(r),e.vertexAttribPointer(r,2,e.FLOAT,!1,0,0),this.vertexPosBuffer=i;var s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),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 o=e.getAttribLocation(t,"texturePos");if(e.enableVertexAttribArray(o),e.vertexAttribPointer(o,2,e.FLOAT,!1,0,0),this.initmask&&!this.masktexturePosBuffer){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]),e.STATIC_DRAW);var n=e.getAttribLocation(t,"masktexturePos");e.enableVertexAttribArray(n),e.vertexAttribPointer(n,2,e.FLOAT,!1,0,0),this.masktexturePosBuffer=a}this.texturePosBuffer=s},Et.prototype.initTextures=function(e){var t=this.contextGL,i=this.shaderProgram;t.pixelStorei(t.UNPACK_ALIGNMENT,1);var r=this.initTexture();this.yTextureRef=r,this.oyTextureRef=r;var s=this.initTexture();this.uTextureRef=s,this.ouTextureRef=s;var o=this.initTexture();this.vTextureRef=o,this.ovTextureRef=o,e&&this.BindTextures(P.Wp),this.waterMarkTextureRef=this.initTexture();var a=t.getUniformLocation(i,"waterMarkSampler");t.uniform1i(a,P.GV),this.waterMarkSamplerRef=a;var n=this.initTexture(),d=t.getUniformLocation(i,"cursorSampler");if(t.uniform1i(d,P.Yy),this.cursorTextureRef=n,this.cursorSamplerRef=d,this.cursorInfoRef=t.getUniformLocation(i,"cursorInfo"),this.initmask){t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,1);var c=this.initTexture(),l=t.getUniformLocation(i,"maskSampler");t.uniform1i(l,P.Gk),this.maskTextureRef=c}this.colorRangeRef=t.getUniformLocation(i,"colorRange"),this.onlyRGBARef=t.getUniformLocation(i,"onlyRGBA"),this.bgraModeRef=t.getUniformLocation(i,"bgraMode"),this.waterMarkFlagRef=t.getUniformLocation(i,"waterMarkFlag"),this.maskFlagRef=t.getUniformLocation(i,"maskFlag"),this.cursorFlagRef=t.getUniformLocation(i,"cursorFlag"),this.yuvmodeRef=t.getUniformLocation(i,"yuvmode"),this.ul_enable_rounded_corner=t.getUniformLocation(i,"u_enable_rounded_corner"),this.ul_radius_lt_x=t.getUniformLocation(i,"u_radius_lt_x"),this.ul_radius_lt_y=t.getUniformLocation(i,"u_radius_lt_y"),this.ul_radius_lb_x=t.getUniformLocation(i,"u_radius_lb_x"),this.ul_radius_lb_y=t.getUniformLocation(i,"u_radius_lb_y"),this.ul_radius_rt_x=t.getUniformLocation(i,"u_radius_rt_x"),this.ul_radius_rt_y=t.getUniformLocation(i,"u_radius_rt_y"),this.ul_radius_rb_x=t.getUniformLocation(i,"u_radius_rb_x"),this.ul_radius_rb_y=t.getUniformLocation(i,"u_radius_rb_y"),this.ul_aa_width=t.getUniformLocation(i,"u_aa_width"),this.ul_viewport_rect=t.getUniformLocation(i,"u_viewport_rect")},Et.prototype.BindTextures=function(e){var t=this.contextGL,i=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==P.Wp){let e=t.getUniformLocation(i,"ySampler");t.uniform1i(e,0);let r=t.getUniformLocation(i,"uSampler");t.uniform1i(r,1);let s=t.getUniformLocation(i,"vSampler");t.uniform1i(s,2)}else if(this.isRGBAMode(e)){let e=t.getUniformLocation(i,"previewVideoSampler");t.uniform1i(e,0);let r=t.getUniformLocation(i,"ySampler");t.uniform1i(r,0);let s=t.getUniformLocation(i,"uSampler");t.uniform1i(s,0);let o=t.getUniformLocation(i,"vSampler");t.uniform1i(o,0)}else if(e==P.pn){let e=t.getUniformLocation(i,"ySampler");t.uniform1i(e,0);let r=t.getUniformLocation(i,"uSampler");t.uniform1i(r,1);let s=t.getUniformLocation(i,"vSampler");t.uniform1i(s,0)}let r=t.getUniformLocation(i,"previewVideoSampler");t.uniform1i(r,0);let s=t.getUniformLocation(i,"maskSampler");this.initmask?(t.activeTexture(t.TEXTURE0+P.Gk),t.bindTexture(t.TEXTURE_2D,this.maskTextureRef),t.uniform1i(s,P.Gk)):t.uniform1i(s,0);let o=t.getUniformLocation(i,"cursorSampler");t.uniform1i(o,0);let a=t.getUniformLocation(this.shaderProgram,"waterMarkSampler");t.uniform1i(a,P.GV)},Et.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},Et.prototype.clearDisplay=function(){var e=this.contextGL;e&&(e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT))},Et.prototype.cleanup=function(){let e=this.canvasElement,t=At.get(e);if(t&&this.removeEventListener(e,t),e.defaultContextLostHandler||(e.defaultContextLostHandler=Ct,e.addEventListener("webglcontextlost",Ct,{capture:!1})),this.cleanupRoundedCornerRadius(),this.isAvaiable()){var i=this.contextGL;i.deleteProgram(this.program),i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,null),i.activeTexture(i.TEXTURE1),i.bindTexture(i.TEXTURE_2D,null),i.activeTexture(i.TEXTURE2),i.bindTexture(i.TEXTURE_2D,null),i.activeTexture(i.TEXTURE3),i.bindTexture(i.TEXTURE_2D,null),i.activeTexture(i.TEXTURE4),i.bindTexture(i.TEXTURE_2D,null),i.activeTexture(i.TEXTURE5),i.bindTexture(i.TEXTURE_2D,null),i.deleteTexture(this.yTextureRef),i.deleteTexture(this.uTextureRef),i.deleteTexture(this.vTextureRef),i.deleteTexture(this.cursorTextureRef),i.deleteTexture(this.waterMarkTextureRef),i.bindBuffer(i.ARRAY_BUFFER,null),i.deleteBuffer(this.vertexPosBuffer),i.deleteBuffer(this.texturePosBuffer),this.maskTextureRef&&i.deleteTexture(this.maskTextureRef),this.masktexturePosBuffer&&i.deleteBuffer(this.masktexturePosBuffer),i.glInitSucceed=0}},Et.prototype.updateVertexInfoForSharing=function(){const[e,t,i,r]=this.vertexPos,s=this.webglVertexPos[0],o=this.webglVertexPos[3];if(e!=s||o!=r){this.webglVertexPos[0]=e,this.webglVertexPos[1]=t,this.webglVertexPos[2]=i,this.webglVertexPos[3]=r;var a=new Float32Array([i,t,e,t,i,r,e,r,1,1,-1,1,1,-1,-1,-1]),n=this.contextGL;n.bindBuffer(n.ARRAY_BUFFER,this.vertexPosBuffer),n.bufferData(n.ARRAY_BUFFER,a,n.DYNAMIC_DRAW)}},Et.prototype.updateTextureInfoForSharing=function(){const[e,t,i,r]=this.texturePos,s=this.webglTexturePos[0],o=this.webglTexturePos[3];if(e!=s||o!=r){this.webglTexturePos[0]=e,this.webglTexturePos[1]=t,this.webglTexturePos[2]=i,this.webglTexturePos[3]=r;var a=new Float32Array([i,t,e,t,i,r,e,r,1,0,0,0,1,1,0,1]),n=this.contextGL;n.bindBuffer(n.ARRAY_BUFFER,this.texturePosBuffer),n.bufferData(n.ARRAY_BUFFER,a,n.DYNAMIC_DRAW)}},Et.prototype.updateVertexInfoForMultiView=function(e,t,i,r,s){var o,a,n,d,c=this.contextGL;if(this.isUseFillMode({width:i,height:r,rotation:s}))o=0,a=0,n=1,d=1;else{var l=s==this.ROTATION_CLOCK90||s==this.ROTATION_CLOCK270?r:i,h=s==this.ROTATION_CLOCK90||s==this.ROTATION_CLOCK270?i:r,u=l/h*t;u>e?(o=0,n=1,d=1-(a=(t-h/l*e)/2/t)):(a=0,d=1,n=1-(o=(e-u)/2/e))}o=2*o-1,n=2*n-1,a=1-2*a,d=1-2*d;var p=new Float32Array([n,a,o,a,n,d,o,d,1,1,-1,1,1,-1,-1,-1]);this.viewPostion=p,c.bindBuffer(c.ARRAY_BUFFER,this.vertexPosBuffer),c.bufferData(c.ARRAY_BUFFER,p,c.DYNAMIC_DRAW)},Et.prototype.updateTextureInfoForMultiView=function(e,t,i,r,s,o,a){var n,d,c,l,h=this.contextGL;if(this.isUseFillMode({width:i.width,height:i.height,rotation:r})){const s=r==this.ROTATION_CLOCK90||r==this.ROTATION_CLOCK270?a/o:o/a,h=i.left||0,u=i.top||0;if(i.width/i.height>s){const r=i.height*s;n=u/t,d=(Math.round((i.width-r)/2)+h)/e,c=(u+i.height)/t,l=d+r/e}else{const r=i.width/s;c=(n=(Math.round((i.height-r)/2)+u)/t)+r/t,l=(d=h/e)+i.width/e}}else n=De(i.top/t,2),d=De(i.left/e,2),c=Me((i.top+i.height)/t,2),l=Me((i.width+i.left)/e,2);var u=[d,n,l,n,l,c,d,c];r==this.ROTATION_CLOCK90&&(u.unshift(u[6],u[7]),u=u.slice(0,8)),r==this.ROTATION_CLOCK180&&(u.unshift(u[4],u[5],u[6],u[7]),u=u.slice(0,8)),r==this.ROTATION_CLOCK270&&(u.push(u[0],u[1]),u=u.slice(2,10));var p=u[0],f=u[1];if(u[0]=u[2],u[1]=u[3],u[2]=p,u[3]=f,s)if(r==this.ROTATION_CLOCK90||r==this.ROTATION_CLOCK270){let e=u[1];u[1]=u[3],u[3]=e,e=u[5],u[5]=u[7],u[7]=e}else u[0]=1-u[0],u[2]=1-u[2],u[4]=1-u[4],u[6]=1-u[6];var m=new Float32Array([...u,1,0,0,0,1,1,0,1]);h.bindBuffer(h.ARRAY_BUFFER,this.texturePosBuffer),h.bufferData(h.ARRAY_BUFFER,m,h.DYNAMIC_DRAW)},Et.prototype.getViewPosition=function(){let e=[0,0,1,1];if(!this.viewPostion)return e;const t=this.viewPostion[0],i=this.viewPostion[1],r=this.viewPostion[2],s=this.viewPostion[5];return e[0]=(1-i)/2,e[1]=(1+r)/2,e[2]=(1-s)/2,e[3]=(1+t)/2,e},Et.prototype.drawNextOutputPictureFrame=function(e,t,i,r,s){let o=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],a=arguments.length>6?arguments[6]:void 0,n=!(arguments.length>7&&void 0!==arguments[7])||arguments[7];if(!this.isAvaiable())return;var d=this.contextGL,c=this.yTextureRef,l=this.uTextureRef,h=this.vTextureRef;d.enable(d.BLEND),d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA),s=s||this.ROTATION_CLOCK0;var u=(i=i||{top:0,left:0,width:e,height:t}).width!=this.croppingParams.width||i.height!=this.croppingParams.height,p=(i.top!=this.croppingParams.top||(i.left,this.croppingParams.left),a.width!=this.viewWidth||a.height!=this.viewHeight),f=(e!=this.textureWidth||this.textureHeight,s!=this.picRotation);(u||p||f)&&function(e,t,i,r,s){e.contextGL;let o=s.width,a=s.height;var n,d,c,l,h=r==e.ROTATION_CLOCK90||r==e.ROTATION_CLOCK270?i:t,u=r==e.ROTATION_CLOCK90||r==e.ROTATION_CLOCK270?t:i,p=h/u*a;p>o?(n=0,c=1,l=1-(d=(a-u/h*o)/2/a)):(d=0,l=1,c=1-(n=(o-p)/2/o)),n=parseFloat((2*n-1).toFixed(3)),c=parseFloat((2*c-1).toFixed(3)),d=parseFloat((1-2*d).toFixed(3)),l=parseFloat((1-2*l).toFixed(3)),e.vertexPos=[n,d,c,l]}(this,i.width,i.height,s,a),this.updateVertexInfoForSharing(),function(e,t,i,r,s){var o=r.top/i,a=r.left/t,n=(r.height+r.top)/i,d=(r.left+r.width)/t,c=[a,o,d,o,d,n,a,n];s==e.ROTATION_CLOCK90&&(c.unshift(c[6],c[7]),c=c.slice(0,8)),s==e.ROTATION_CLOCK180&&(c.unshift(c[4],c[5],c[6],c[7]),c=c.slice(0,8)),s==e.ROTATION_CLOCK270&&(c.push(c[0],c[1]),c=c.slice(2));var l=c[0],h=c[1];c[0]=c[2],c[1]=c[3],c[2]=l,c[3]=h;var u=new Float32Array([...c,1,0,0,0,1,1,0,1]),p=e.contextGL;p.bindBuffer(p.ARRAY_BUFFER,e.texturePosBuffer),p.bufferData(p.ARRAY_BUFFER,u,p.DYNAMIC_DRAW)}(this,e,t,i,s);let m=o?0:1;m!=this.colorRange&&(d.uniform1i(this.colorRangeRef,m),this.colorRange=m),d.viewport(a.x,a.y,a.width,a.height),this.viewport_rect||(this.viewport_rect=new Float32Array(4)),this.viewport_rect.set([a.x,a.y,a.width,a.height],0),d.uniform4fv(this.ul_viewport_rect,this.viewport_rect),d.uniform1i(this.onlyRGBARef,0),d.uniform1i(this.yuvmodeRef,P.Wp),Object.assign(this.croppingParams,i),this.textureWidth=e,this.textureHeight=t,this.picRotation=s,this.viewWidth=a.width,this.viewHeight=a.height;var v=r,g=e*t;if(d.activeTexture(d.TEXTURE0),d.bindTexture(d.TEXTURE_2D,c),n){var _=v.subarray(0,g);d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE,e,t,0,d.LUMINANCE,d.UNSIGNED_BYTE,_)}var S=e/2*t/2;if(d.activeTexture(d.TEXTURE1),d.bindTexture(d.TEXTURE_2D,l),n){var A=v.subarray(g,g+S);d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE,e/2,t/2,0,d.LUMINANCE,d.UNSIGNED_BYTE,A)}var y=S;if(d.activeTexture(d.TEXTURE2),d.bindTexture(d.TEXTURE_2D,h),n){var C=v.subarray(g+S,g+S+y);d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE,e/2,t/2,0,d.LUMINANCE,d.UNSIGNED_BYTE,C)}d.activeTexture(d.TEXTURE0+P.Yy),d.bindTexture(d.TEXTURE_2D,this.cursorTextureRef),d.uniform1i(this.cursorSamplerRef,P.Yy),this.hasCursor?d.uniform1i(this.cursorFlagRef,1):n&&d.texImage2D(d.TEXTURE_2D,0,d.RGBA,1,1,0,d.RGBA,d.UNSIGNED_BYTE,this.dummpyCursor),d.uniform4f(this.cursorInfoRef,this.cx,this.cy,this.cw,this.ch),this.render(),this.hasWholeFrame=1},Et.prototype.updateCursor=function(e,t,i,r){if(this.isAvaiable()){var s=this.contextGL;e<=0||t<=0||!i||i.length!=e*t*4||r!=this.lastcursorSyncId&&(this.lastcursorSyncId=r,s.activeTexture(s.TEXTURE0+P.Yy),s.bindTexture(s.TEXTURE_2D,this.cursorTextureRef),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,e,t,0,s.RGBA,s.UNSIGNED_BYTE,i),this.cursorWidth=e,this.cursorHeight=t,this.hasCursor=1)}},Et.prototype.updateCursorPosInfo=function(e,t,i,r,s){if(e&&this.hasCursor){let e=t/this.croppingParams.width,o=i/this.croppingParams.height,a=r/this.croppingParams.width,n=s/this.croppingParams.height;this.cx=e,this.cy=o,this.cw=a,this.ch=n}else this.cx=0,this.cy=0,this.cw=0,this.ch=0},Et.prototype.isHasWholeFrame=function(){return this.hasWholeFrame},Et.prototype.updateWatermark=function(e,t,i){if(this.isAvaiable()){var r=this.contextGL;e<=0||t<=0||!i||i.length!=e*t*4||(this.hasWaterMark=1,this.watermarkWidth=e,this.watermarkHeight=t,r.activeTexture(r.TEXTURE0+P.GV),r.bindTexture(r.TEXTURE_2D,this.waterMarkTextureRef),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,this.watermarkWidth,this.watermarkHeight,0,r.RGBA,r.UNSIGNED_BYTE,i))}},Et.prototype.drawWatermark=function(){if(this.isAvaiable()){var e=this.contextGL;this.isSetWatermark()&&this.watermarkWidth&&this.watermarkHeight&&(e.uniform1i(this.waterMarkFlagRef,1),e.activeTexture(e.TEXTURE0+P.GV),e.bindTexture(e.TEXTURE_2D,this.waterMarkTextureRef),e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.drawArrays(e.TRIANGLE_STRIP,4,4))}},Et.prototype.drawRoundedCorner=function(){if(this.isAvaiable()){var e=this.contextGL;e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.uniform1f(this.ul_enable_rounded_corner,this.enable_rounded_corner),e.uniform1f(this.ul_radius_lt_x,this.radius_lt_x),e.uniform1f(this.ul_radius_lt_y,this.radius_lt_y),e.uniform1f(this.ul_radius_lb_x,this.radius_lb_x),e.uniform1f(this.ul_radius_lb_y,this.radius_lb_y),e.uniform1f(this.ul_radius_rt_x,this.radius_rt_x),e.uniform1f(this.ul_radius_rt_y,this.radius_rt_y),e.uniform1f(this.ul_radius_rb_x,this.radius_rb_x),e.uniform1f(this.ul_radius_rb_y,this.radius_rb_y),e.uniform1f(this.ul_aa_width,this.aa_width)}},Et.prototype.cleanupRoundedCornerRadius=function(){this.enable_rounded_corner=0,this.radius_lt_x=0,this.radius_lt_y=0,this.radius_lb_x=0,this.radius_lb_y=0,this.radius_rt_x=0,this.radius_rt_y=0,this.radius_rb_x=0,this.radius_rb_y=0,this.aa_width=B.ru,this.viewport_rect=null},Et.prototype.render=function(){if(this.isAvaiable()){var e=this.contextGL;this.drawRoundedCorner(),e.uniform1i(this.waterMarkFlagRef,0),e.drawArrays(e.TRIANGLE_STRIP,0,4),this.drawWatermark()}},Et.prototype.clear=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.hasCursor=0,this.watermarkHeight=0,this.watermarkWidth=0,this.watermarkRepeated=!1,this.hasWholeFrame=0,this.lastcursorSyncId=-1,this.cleanupRoundedCornerRadius(),e&&this.clearCanvas({R:0,G:0,B:0,A:0})},Et.prototype.clearCanvas=function(e){if(this.cleanupRoundedCornerRadius(),this.isAvaiable()){var t=this.contextGL;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)}},Et.prototype.isRGBAMode=function(e){return-1!==[P.rK,P.hd].indexOf(e)},Et.prototype.updateRemoteVideoTextures=function(e,t,i,r,s){let o=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],a=arguments.length>6?arguments[6]:void 0,n=!(arguments.length>8&&void 0!==arguments[8])||arguments[8];if(!this.isAvaiable())return;var d=this.contextGL,c=this.yTextureRef,l=this.uTextureRef,h=this.vTextureRef;d.enable(d.BLEND),d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);const u=this.isRGBAMode(this.videoMode);if(e<=0||t<=0||!r||!r.length||r.length!=e*t*3/2&&!u||i&&(i.top<0||i.left<0||i.left+i.width>e||i.top+i.height>t))return!1;let p=o?0:1;if(this.colorRange=p,this.rotation=s,Object.assign(this.croppingParams,i),this.textureWidth=e,this.textureHeight=t,this.viewWidth=a.width,this.viewHeight=a.height,!n)return;if(d.bindTexture(d.TEXTURE_2D,c),u)return void d.texImage2D(d.TEXTURE_2D,0,d.RGBA,e,t,0,d.RGBA,d.UNSIGNED_BYTE,r);var f=r,m=e*t,v=f.subarray(0,m);d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE,e,t,0,d.LUMINANCE,d.UNSIGNED_BYTE,v);let g=0,_=0;this.videoMode==P.Wp?(g=e/2*t/2,_=g):this.videoMode==P.pn&&(g=e*t/2,_=0);var S=f.subarray(m,m+g);if(d.bindTexture(d.TEXTURE_2D,l),_){d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE,e/2,t/2,0,d.LUMINANCE,d.UNSIGNED_BYTE,S);var A=f.subarray(m+g,m+g+_);d.bindTexture(d.TEXTURE_2D,h),d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE,e/2,t/2,0,d.LUMINANCE,d.UNSIGNED_BYTE,A)}else d.texImage2D(d.TEXTURE_2D,0,d.LUMINANCE_ALPHA,e/2,t/2,0,d.LUMINANCE_ALPHA,d.UNSIGNED_BYTE,S);return!0},Et.prototype.updateRemoteVideoTexturesImageBitmap=function(e,t,i,r,s){let o=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];if(e<=0||t<=0||!i)return;if(!this.isAvaiable())return;var a=this.contextGL;if(this.textureWidth=e,this.textureHeight=t,Number.isNaN(s)||(this.rotation=s),Object.assign(this.croppingParams,r),!o)return;a.bindTexture(a.TEXTURE_2D,this.yTextureRef);const n=a.RGBA,d=a.RGBA,c=a.UNSIGNED_BYTE;a.texImage2D(a.TEXTURE_2D,0,n,d,c,i)},Et.prototype.updateSelfMaskImage=function(e,t,i){if(!(e<=0||t<=0)&&i&&i.length==e*t*4&&this.isAvaiable()){var r=this.contextGL;r.bindTexture(r.TEXTURE_2D,this.maskTextureRef),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,e,t,0,r.RGBA,r.UNSIGNED_BYTE,i)}},Et.prototype.VideoFlip=function(){if(this.isAvaiable()){var e=this.contextGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1)}},Et.prototype.drawRemoteVideo=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.isAvaiable())return;var i=this.contextGL;let r=this.isRGBAMode(this.videoMode)?1:0;i.uniform1i(this.colorRangeRef,this.colorRange),this.setUniformFlag(r,this.hasCursor,this.videoMode),this.initmask&&i.uniform1i(this.maskFlagRef,1),this.updateTextureInfoForMultiView(this.textureWidth,this.textureHeight,this.croppingParams,this.rotation,t,e.width,e.height),i.viewport(e.x,e.y,e.width,e.height),this.viewport_rect||(this.viewport_rect=new Float32Array(4)),this.viewport_rect.set([e.x,e.y,e.width,e.height],0),i.uniform4fv(this.ul_viewport_rect,this.viewport_rect),this.updateVertexInfoForMultiView(e.width,e.height,this.croppingParams.width,this.croppingParams.height,this.rotation),this.BindTextures(this.videoMode),i.enable(i.BLEND),i.blendFunc(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA),this.render()},Et.prototype.readPixelsSyncRequest=function(e,t,i,r){if(this.isAvaiable()){var s,o=this.contextGL;return this.destination&&this.destination.length==i*r*4||(this.destination=new Uint8Array(i*r*4)),s=this.destination,o.flush(),o.readPixels(e,t,i,r,o.RGBA,o.UNSIGNED_BYTE,s),s}},Et.prototype.updateSelfVideoTextures=function(e,t,i,r){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(!(e<=0||t<=0)&&i&&i.length%4==0&&this.isAvaiable()){var a=this.contextGL;this.textureWidth=e,this.textureHeight=t,this.rotation=o,Object.assign(this.croppingParams,r),s&&(a.bindTexture(a.TEXTURE_2D,this.yTextureRef),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,e,t,0,a.RGBA,a.UNSIGNED_BYTE,i))}},Et.prototype.drawSelfVideo=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.isAvaiable()){var r=this.contextGL;this.setUniformFlag(1,this.hasCursor,this.videoMode),this.updateTextureInfoForMultiView(this.textureWidth,this.textureHeight,this.croppingParams,this.rotation,i,e.width,e.height),r.viewport(e.x,e.y,e.width,e.height),this.viewport_rect||(this.viewport_rect=new Float32Array(4)),this.viewport_rect.set([e.x,e.y,e.width,e.height],0),r.uniform4fv(this.ul_viewport_rect,this.viewport_rect),t?(r.enable(r.BLEND),r.blendFunc(r.ZERO,r.ZERO),this.updateVertexInfoForMultiView(e.width,e.height,e.width,e.height,this.ROTATION_CLOCK0)):(r.enable(r.BLEND),r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA),this.updateVertexInfoForMultiView(e.width,e.height,this.croppingParams.width,this.croppingParams.height,this.rotation)),this.BindTextures(P.rK),this.render()}},Et.prototype.isSetWatermark=function(){return this.hasWaterMark},Et.prototype.setWatermarkFlag=function(e){this.hasWaterMark=e,e||(this.setWatermarkRepeated(!1),this.setWatermarkOpacity(),this.setWatermarkPosition(16))},Et.prototype.setUniformFlag=function(e,t,i){if(this.isAvaiable()){var r=this.contextGL;r.uniform1i(this.onlyRGBARef,e),r.uniform1i(this.bgraModeRef,e&&i===P.hd?1:0),r.uniform1i(this.cursorFlagRef,t),e||r.uniform1i(this.yuvmodeRef,i)}},Et.prototype.setVideoMode=function(e){this.videoMode=e},Et.prototype.getVideoMode=function(e){return this.videoMode},Et.prototype.setWatermarkRepeated=function(e){this.watermarkRepeated=e},Et.prototype.isWatermarkRepeated=function(){return!!this.watermarkRepeated},Et.prototype.setWatermarkOpacity=function(e){this.watermarkOpacity=e||.15},Et.prototype.getWatermarkOpacity=function(){return this.watermarkOpacity},Et.prototype.setWatermarkPosition=function(e){this.watermarkPosition=e||16},Et.prototype.getWatermarkPosition=function(){return this.watermarkPosition},Et.prototype.setMultiView=function(e){return this.isMultiView=e},Et.prototype.getRepeatedWatermarkUniformValue=function(){return this.isMultiView?30:7},Et.prototype.getRepeatedWatermarkTextureValue=function(e){return this.isMultiView?e.TEXTURE30:e.TEXTURE7},Et.prototype.setFillMode=function(){let 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},Et.prototype.getFillMode=function(){return this.fillMode},Et.prototype.getFillModeForResolution=function(){return this.fillModeForResolution},Et.prototype.getTextureIndex=function(){return this.textureindex},Et.prototype.getIndex=function(){return this.textureindex},Et.prototype.getWatermarkWidth=function(){return this.watermarkWidth},Et.prototype.getWatermarkHeight=function(){return this.watermarkHeight},Et.prototype.getTextureWidth=function(){return this.textureWidth},Et.prototype.getTextureHeight=function(){return this.textureHeight},Et.prototype.getRotation=function(){return this.rotation},Et.prototype.getCroppingParams=function(){return this.croppingParams},Et.prototype.getWatermarkOpacity=function(){return this.watermarkOpacity},Et.prototype.getAttachedCanvas=function(){return this.canvasElement},Et.prototype.getCanvasId=function(){return this.canvasID},Et.prototype.resizeCanvasTo=function(e,t){this.contextGL.canvas.width=e,this.contextGL.canvas.height=t},Et.prototype.isUseFillMode=function(e){let{width:t,height:i,rotation:r}=e;if(!this.fillMode)return!1;if(!this.fillModeForResolution)return!0;if(!t||!i)return!1;const s=r===this.ROTATION_CLOCK90||r==this.ROTATION_CLOCK270?i/t:t/i;return(Array.isArray(this.fillModeForResolution)?this.fillModeForResolution:[this.fillModeForResolution]).some((e=>Math.abs(s-e)<.01))},Et.prototype.setRoundedCornerRadius=function(e){e?(this.radius_lt_x=e.radius_lt_x,this.radius_lt_y=e.radius_lt_y,this.radius_lb_x=e.radius_lb_x,this.radius_lb_y=e.radius_lb_y,this.radius_rt_x=e.radius_rt_x,this.radius_rt_y=e.radius_rt_y,this.radius_rb_x=e.radius_rb_x,this.radius_rb_y=e.radius_rb_y,0===this.radius_lt_x&&0===this.radius_lt_y&&0===this.radius_lb_x&&0===this.radius_lb_y&&0===this.radius_rt_x&&0===this.radius_rt_y&&0===this.radius_rb_x&&0===this.radius_rb_y?this.enable_rounded_corner=0:this.enable_rounded_corner=1):this.enable_rounded_corner=0},Et.prototype.setAntialiasWidth=function(e){(e<=0||e>=1)&&(e=B.ru),this.aa_width=e};const bt=Et;function wt(e,t,i){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function Rt(e,t){return e.get(It(e,t))}function Tt(e,t,i){return e.set(It(e,t),i),i}function It(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var Mt=new WeakMap,Dt=new WeakMap;class Pt extends lt{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),wt(this,Mt,new Map),wt(this,Dt,!1),Tt(Dt,this,e)}setCanvasAlphaChannelEnability(e){Tt(Dt,this,e)}createVideoRenderDisplay(e,t,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,s=null,o=null,a=null,n=!1;return r&&(s=r.forceNoGL,o=r.contextOptions,a=r.webGLResources,n=r.initMask),new bt(e,t,i,s,o,a,n,Rt(Dt,this))}getVideoRenderDisplay(e,t,i,r){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=Rt(Mt,this).get(e);if(!o){let r=[];o=[r,[]],Rt(Mt,this).set(e,o);let a=new bt(e,t,0,void 0,void 0,void 0,void 0,Rt(Dt,this));a.setMultiView(!0),s&&s.set(e,a);let n=1;for(;n<=i;n++){const i=new bt(e,t,n,void 0,void 0,{program:a.shaderProgram,contextgl:a.contextGL,vBuffer:a.vertexPosBuffer,tBuffer:a.texturePosBuffer,waterMarkTextureRef:a.waterMarkTextureRef,repeatedWaterMarkTextureRef:a.repeatedWaterMarkTextureRef},void 0,void 0,Rt(Dt,this));i.setMultiView(!0),r.push(i)}}let a,n=Rt(Mt,this).get(e),d=n[0],c=n[1];if(n&&d[0]&&(a=d.pop(),c.push(a)),!a){const e=n?"".concat(n.length):"undefined",t=d?"".concat(d.length):"undefined";r("No Display obtained from VideoRender.Get_Display. canvasRenderArray:".concat(e," unusedRenderArray:").concat(t))}return a}onWebglContextLostForMulti(e,t){const{canvas:i}=t;let r=Rt(Mt,this).get(i);var[s,o,a]=r;[...s,...o].forEach((e=>e.clear()))}onRestoredFromLostForMulti(e,t){if(!t)return;const{canvas:i}=t;let r=Rt(Mt,this).get(i);var[s,o,a]=r;const n=[...s,...o];let d=n.find((e=>e.isLocalDisplay()));d.webglVertexPos=[0,0,0,0],d.webglTexturePos=[0,0,0,0],a.args={program:d.shaderProgram,contextgl:d.contextGL,vBuffer:d.vertexPosBuffer,tBuffer:d.texturePosBuffer,webglVertexPos:d.webglVertexPos,webglTexturePos:d.webglTexturePos},n.forEach((e=>{e!=d&&e.reinit(a.args)}))}getRenderDisplay(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=Rt(Mt,this).get(e);if(!r){let s=[],o={canvasId:t,size:1,args:{}};r=[s,[],o],Rt(Mt,this).set(e,r);const a={webglcontextlostCallback:this.onWebglContextLostForMulti.bind(this),webglcontextrestoredCallback:this.onRestoredFromLostForMulti.bind(this),params:{canvas:e,rendercanvasID:t}};let n=new bt(e,t,0,void 0,a,void 0,void 0,Rt(Dt,this));i&&i.set(e,n),s.push(n),o.args={program:n.shaderProgram,contextgl:n.contextGL,vBuffer:n.vertexPosBuffer,tBuffer:n.texturePosBuffer,webglVertexPos:n.webglVertexPos,webglTexturePos:n.webglTexturePos}}if(!r[0].length){const i=new bt(e,t,r[2].size,void 0,void 0,r[2].args,void 0,Rt(Dt,this));r[2].size++,r[0].push(i)}let s=r[0].pop();return r[1].push(s),s}recycleRenderDisplay(e,t,i){t.setWatermarkFlag(0),t.setVideoMode(P.kh),t.clear(i);let r=Rt(Mt,this).get(e);if(r){let e=r[0],i=r[1];i&&i.some((function(e,r){if(e===t)return i.splice(r,1),!0})),e.push(t)}}onRestoredFromContextLost(e,t,i,r,s){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,a=Rt(Mt,this).get(i);(!a||a.length<2)&&s("canvasRenderArray:".concat(a,", length:").concat(null==a?void 0:a.length));let n=o.get(t);if(n){n.reinit();for(let e=0;e<(null==a?void 0:a.length);e++)a[e].forEach((e=>{null==e||e.reinit({program:n.shaderProgram,contextgl:n.contextGL,vBuffer:n.vertexPosBuffer,tBuffer:n.texturePosBuffer,waterMarkTextureRef:n.waterMarkTextureRef,repeatedWaterMarkTextureRef:n.repeatedWaterMarkTextureRef})}));return i!==t&&(Rt(Mt,this).delete(i),Rt(Mt,this).set(t,a),o&&(o.delete(i),o.set(t,n))),null}}getRenderDisplayMap(){return Rt(Mt,this)}cleanup(e,t){var i;null==t||null===(i=t.cleanup)||void 0===i||i.call(t);for(const[e,t]of Rt(Mt,this)){const e=t[0],i=t[1];for(const t of e)t.cleanup();for(const e of i)e.cleanup()}Tt(Mt,this,new Map)}cleanupByCanvas(e){if(Rt(Mt,this).get(e)){let t=Rt(Mt,this).get(e);if(t){let i=t[0],r=t[1];r.forEach((function(e){var t;null==e||null===(t=e.cleanup)||void 0===t||t.call(e)})),i.forEach((function(e){var t;null==e||null===(t=e.cleanup)||void 0===t||t.call(e)})),i=[],r=[],Rt(Mt,this).delete(e)}}else{var t,i;null===(t=e.display)||void 0===t||null===(i=t.cleanup)||void 0===i||i.call(t)}}}function kt(e,t,i){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function Ot(e,t){return e.get(Nt(e,t))}function Vt(e,t,i){return e.set(Nt(e,t),i),i}function Nt(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var xt=new WeakMap,Lt=new WeakMap,Wt=new WeakMap,Ut=new WeakMap,Bt=new WeakMap;const Ft=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];kt(this,xt,null),kt(this,Lt,null),kt(this,Wt,null),kt(this,Ut,null),kt(this,Bt,!1),Vt(Bt,this,e)}setGPUResourceMgrGetter(e){Vt(Ut,this,e)}isEnableCanvasAlphaChannel(){return Ot(Bt,this)}setCanvasAlphaChannelEnability(e){Vt(Bt,this,e),Ot(xt,this)&&Ot(xt,this).setCanvasAlphaChannelEnability(e),Ot(Lt,this)&&Ot(Lt,this).setCanvasAlphaChannelEnability(e)}getWebGLRenderDisplayMgr(){return Ot(xt,this)||(Vt(xt,this,new gt(Ot(Bt,this))),(0,j.r9)("[Render] getWebGLRenderDisplayMgr")),Ot(xt,this)}getWebGL2RenderDisplayMgr(){return Ot(Lt,this)||Vt(Lt,this,new Pt(Ot(Bt,this))),Ot(Lt,this)}getWebGPURenderDisplayMgr(){if(!Ot(Wt,this)){const e=Oe.getModule("webgpu_renderer_dynmod");Vt(Wt,this,e.exports.createWebGPURenderDisplayMgr()),Ot(Wt,this).setGPUResourceMgrGetter(Ot(Ut,this).call(this,B.h3.WEBGPU))}return Ot(Wt,this)}getRenderDisplayMgr(e){switch(e){case B.h3.WEBGL:return this.getWebGLRenderDisplayMgr();case B.h3.WEBGL_2:return this.getWebGL2RenderDisplayMgr();case B.h3.WEBGPU:return this.getWebGPURenderDisplayMgr();case B.h3.VIDEO_TAG:return(0,Te.Yu)("VIDEO_TAG has no RenderDisplayMgr!"),null;default:return null}}getVideoRenderDisplay(e,t,i,r,s){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,n=this.getRenderDisplayMgr(e).getVideoRenderDisplay(t,i,r,s,a);return n&&e===B.h3.WEBGPU&&(n.addRenderer(o),n.attachCanvas(t,i),n.setGPUResMgr(Ot(Ut,this).call(this,e))),n}getRenderDisplay(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=this.getRenderDisplayMgr(e).getRenderDisplay(t,i,s);return o&&e===B.h3.WEBGPU&&(o.addRenderer(r),o.attachCanvas(t,i),o.setGPUResMgr(Ot(Ut,this).call(this,e))),o}createVideoRenderDisplay(e,t,i,r){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,a=this.getRenderDisplayMgr(e).createVideoRenderDisplay(t,i,r,s,o);return a&&e===B.h3.WEBGPU&&(a.addRenderer(s),a.attachCanvas(t,i),a.setGPUResMgr(Ot(Ut,this).call(this,e))),a}recycleRenderDisplay(e,t,i,r){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];switch(e){case B.h3.WEBGPU:Ot(Wt,this)&&Ot(Wt,this).recycleRenderDisplay(i,r,s);break;case B.h3.WEBGL:Ot(xt,this)&&Ot(xt,this).recycleRenderDisplay(t,i,s);break;case B.h3.WEBGL_2:Ot(Lt,this)&&Ot(Lt,this).recycleRenderDisplay(t,i,s);break;case B.h3.VIDEO_TAG:(0,Te.Yu)("VIDEO_TAG has no display")}}collectInUseRenderDisplays(e,t){let i=null;return e===B.h3.WEBGPU&&Ot(Wt,this)&&(i=Ot(Wt,this).collectInUseRenderDisplays(t)),i}collectInUseRenderDisplaysByCanvas(e,t,i){let r=null;return e===B.h3.WEBGPU&&Ot(Wt,this)&&(r=Ot(Wt,this).collectInUseRenderDisplaysByCanvas(t,i)),r}getRenderDisplayMap(e,t){if(e===B.h3.WEBGL){if(Ot(xt,this))return Ot(xt,this).getRenderDisplayMap()}else if(e===B.h3.WEBGPU){if(Ot(Wt,this))return Ot(Wt,this).getRenderDisplayMap(t)}else if(e===B.h3.WEBGL_2&&Ot(Lt,this))return Ot(Lt,this).getRenderDisplayMap(t);return null}onRestoredFromContextLost(e,t,i,r,s){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;return Ot(xt,this)?Ot(xt,this).onRestoredFromContextLost(e,t,i,r,s,o):Ot(Lt,this)?Ot(Lt,this).onRestoredFromContextLost(e,t,i,r,s,o):null}cleanup(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];null!==Ot(xt,this)&&Ot(xt,this).cleanup(e,t),Ot(Lt,this)&&Ot(Lt,this).cleanup(e,t),null!==Ot(Wt,this)&&Ot(Wt,this).cleanup(t,i)}cleanupByCanvas(e){null!==Ot(xt,this)&&Ot(xt,this).cleanupByCanvas(e),null!==Ot(Lt,this)&&Ot(Lt,this).cleanupByCanvas(e),null!==Ot(Wt,this)&&Ot(Wt,this).cleanupByCanvas(e)}};function Ht(e,t,i){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function Gt(e,t){return e.get(Kt(e,t))}function jt(e,t,i){return e.set(Kt(e,t),i),i}function Kt(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}var zt=new WeakMap,qt=new WeakMap,Yt=new WeakMap,Xt=new WeakMap,Qt=new WeakMap;const Jt=class{constructor(e){Ht(this,zt,""),Ht(this,qt,new Qe),Ht(this,Yt,new Ft),Ht(this,Xt,new tt),Ht(this,Qt,null),jt(zt,this,e),Gt(Yt,this).setGPUResourceMgrGetter((()=>this.getWebGPUResMgr()))}isEnableCanvasAlphaChannel(){return Gt(Yt,this).isEnableCanvasAlphaChannel()}setCanvasAlphaChannelEnability(e){Gt(Yt,this).setCanvasAlphaChannelEnability(e)}async evalRendererType(e){const t=await Gt(qt,this).evaluate(e);console.log("[RenderManager] rendererType is ".concat(t))}getVideoRenderDisplay(e,t,i,r){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;const o=Gt(qt,this).getRendererType(),a=Gt(qt,this).acquireRenderer(e,this.getWebGPUResMgr(o));return Gt(Yt,this).getVideoRenderDisplay(o,e,t,i,r,a,s)}getRenderDisplay(e,t,i,r){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;const o=Gt(qt,this).getRendererType(),a=Gt(qt,this).acquireRenderer(e,Gt(Qt,this));return Gt(Yt,this).getRenderDisplay(o,e,t,a,s)}createWebGLVideoRenderDisplay(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return Gt(qt,this).isWebGL2RendererType()?Gt(Yt,this).getWebGL2RenderDisplayMgr().createVideoRenderDisplay(e,t,i,null,r):Gt(qt,this).isWebGLRendererType()?Gt(Yt,this).getWebGLRenderDisplayMgr().createVideoRenderDisplay(e,t,i,null,r):((0,Te.Yu)("Can not create webgl display!!"),null)}createVideoRenderDisplay(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const s=Gt(qt,this).getRendererType(),o=Gt(qt,this).acquireRenderer(e,this.getWebGPUResMgr(s));return Gt(Yt,this).createVideoRenderDisplay(s,e,t,i,o,r)}recycleRenderDisplay(e,t,i){const r=Gt(qt,this).getRendererType();Gt(Yt,this).recycleRenderDisplay(r,e,t,this.getWebGPUResMgr(r),i)}renderFor(e){if(Gt(qt,this).isWebGPURendererType()){const t=Gt(qt,this).getRendererType(),i=Gt(Yt,this).collectInUseRenderDisplays(t,e);i&&i.forEach((e=>{const i=Gt(qt,this).acquireRenderer(e.canvas,this.getWebGPUResMgr(t));Gt(Xt,this).render(i,e.renderDisplays)}))}}renderWith(e){if(Gt(qt,this).isWebGPURendererType()){const t=e.getAttachedCanvas();if(t){const i=Gt(qt,this).getRendererType(),r=Gt(qt,this).acquireRenderer(t,this.getWebGPUResMgr(i)),s=[];s.push(e),Gt(Xt,this).render(r,s)}}}getRenderDisplayMap(e){const t=Gt(qt,this).getRendererType();return Gt(Yt,this).getRenderDisplayMap(t,e)}onRestoredFromContextLost(e,t,i,r,s){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;return Gt(qt,this).isWebGLRendererType()||Gt(qt,this).isWebGL2RendererType()?Gt(Yt,this).onRestoredFromContextLost(e,t,i,r,s,o):null}destroyUnusedVideoFrame(e){"undefined"!=typeof VideoFrame&&e instanceof VideoFrame&&Gt(qt,this).isWebGPURendererType()&&e.close()}getRendererProvider(){return Gt(qt,this)}getRenderDisplayManager(){return Gt(Yt,this)}getWebGPUResMgr(e){if(Gt(Qt,this))return Gt(Qt,this);if(e===B.h3.WEBGPU){const e=Oe.getModule("webgpu_renderer_dynmod");jt(Qt,this,e.exports.createWebGPUResManager()),Gt(Qt,this).addRendererProviderModule(Gt(qt,this)),Gt(Qt,this).setLabel(Gt(zt,this))}return Gt(Qt,this)}cleanup(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];Gt(qt,this)&&Gt(qt,this).cleanup(),Gt(Yt,this)&&Gt(Yt,this).cleanup(e,t,i),i||Gt(Qt,this)&&Gt(Qt,this).cleanup()}clearOffscreenCanvas(e){Gt(Yt,this)&&Gt(Yt,this).cleanupByCanvas(e)}};var $t,Zt=i(9693),ei=i(6487),ti=i(5830),ii=i(2484);!function(e){e.VB_INIT_SUCCESS="VB_INIT_SUCCESS",e.VB_INIT_FAILED="VB_INIT_FAILED",e.VB_GENERATED_FRAME="VB_GENERATED_FRAME",e.VB_SEND_FRAME="VB_SEND_FRAME",e.VB_UPDATE_BG="VB_UPDATE_BG",e.VB_PREDICT_DONE="VB_PREDICT_DONE",e.VB_MODEL_READY="VB_MODEL_READY",e.VB_FREE_MEMORY="VB_FREE_MEMORY",e.VB_VIDEO_FORMAT_UNSUPPORTED="VB_VIDEO_FORMAT_UNSUPPORTED",e.VB_WORKER_INIT="VB_WORKER_INIT",e.VB_WORKER_ERROR="VB_WORKER_ERROR",e.VB_RENDER_CANVAS="VB_RENDER_CANVAS",e.VB_RENDER_FRAME="VB_RENDER_FRAME",e.VB_START="VB_START",e.VB_REQUEST_FRAME="VB_REQUEST_FRAME",e.VB_TOGGLE_VB="VB_TOGGLE_VB",e.VB_STOP="VB_STOP",e.VB_MIRROR="VB_MIRROR",e.VB_GENERATE_STREAM="VB_GENERATE_STREAM",e.VB_STOP_STREAM="VB_STOP_STREAM",e.VB_CHANGE_STREAM_CANVAS_SIZE="VB_CHANGE_STREAM_CANVAS_SIZE",e.VB_GENERATE_FIRST_FRAME="VB_GENERATE_FIRST_FRAME",e.VB_UPDATE_STATS="VB_UPDATE_STATS",e.VB_UPDATE_NEED_FRAME="VB_UPDATE_NEED_FRAME",e.VB_UPDATE_FRAME_RATE="VB_UPDATE_FRAME_RATE",e.VB_RESOLUTION_CHANGE="VB_RESOLUTION_CHANGE",e.VB_GLOBAL_TRACING_LOG="VB_GLOBAL_TRACING_LOG"}($t||($t={}));class ri{constructor(e,t){this.isMirror=!1,this.display=new ct(e,t,0,void 0,{preserveDrawingBuffer:!1},void 0,!1,!1)}renderFrame(e,t,i,r){if(this.display){let s={x:0,y:0,width:this.display.canvasElement.width,height:this.display.canvasElement.height};this.display.updateRemoteVideoTextures(e,t,r,i,0,!0,s,!1),this.display.drawRemoteVideo(s,this.isMirror)}}render(e){return t=this,i=void 0,s=function*(){let t=P.rK;if("data_ptr"in e){const{data:t,format_width:i,format_height:r,valid_x:s,valid_y:o,valid_width:a,valid_height:n}=e;let d={top:o,left:s,width:a,height:n};this.display.setVideoMode(P.Wp),this.renderFrame(i,r,t,d)}else if(self.VideoFrame&&e instanceof VideoFrame){const{format:i,visibleRect:r}=e;if(i&&r){if("I420"===i||"I420A"===i)t=P.Wp;else if("NV12"===i)t=P.pn;else{if("BGRA"!==i)return void(this.onUnsupportedFrame&&this.onUnsupportedFrame(i));t=P.hd}const{width:s,height:o}=r,a=new Uint8Array(e.allocationSize()),n={top:0,left:0,width:s,height:o};this.display.setVideoMode(t);try{yield e.copyTo(a),this.renderFrame(s,o,a,n)}catch(e){}e.close()}}else if(e instanceof ImageData){const{width:t,height:i}=e,r={top:0,left:0,width:t,height:i};this.display.setVideoMode(P.rK),this.renderFrame(t,i,e.data,r)}},new((r=void 0)||(r=Promise))((function(e,o){function a(e){try{d(s.next(e))}catch(e){o(e)}}function n(e){try{d(s.throw(e))}catch(e){o(e)}}function d(t){var i;t.done?e(t.value):(i=t.value,i instanceof r?i:new r((function(e){e(i)}))).then(a,n)}d((s=s.apply(t,i||[])).next())}));var t,i,r,s}updateSize(e,t){this.display.canvasElement.width=e,this.display.canvasElement.height=t}setMirror(e){this.isMirror=e}}class si{constructor(){this.timer3s=null,this.timer10s=null,this.isVBPredictDone=!1,this.inited=!1}start(){this.inited=!0,this.clear(),this.timer3s=setTimeout((()=>{this.isVBPredictDone||this.ontimeout3s()}),3e3),this.timer10s=setTimeout((()=>{this.isVBPredictDone||this.ontimeout10s()}),1e4)}clear(){clearTimeout(this.timer3s),clearTimeout(this.timer10s),this.timer3s=null,this.timer10s=null}}var oi=i(6654),ai=i(8935),ni=function(e,t,i,r){return new(i||(i=Promise))((function(s,o){function a(e){try{d(r.next(e))}catch(e){o(e)}}function n(e){try{d(r.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,n)}d((r=r.apply(e,t||[])).next())}))};class di{constructor(e){this.isVBReady=!1,this.videoStream=null,this.isVBInitializing=!1,this.receiveTimer=null,this.msgChannel=null,this.isEnabled=!0,this.trackProcessor=null,this.isVBRunning=!1,this.frameRate=24,this.isStreamEnabled=!1,this.destoryed=!1,this._needFrame=!1,this._backend="",this.isMetadataLoaded=!1,this.isCapturing=!1,this.isReportVideoFrameError=!1,this.shouldStopCapture=!1,this.enableFetchWithCache=1,this.globalTracingLogger=null;const{canvas:t,canvasID:i,bgImage:r,cdnPath:s,enableFetchWithCache:o,globalTracingLogger:a}=e,n=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(i[r[s]]=e[r[s]])}return i}(e,["canvas","canvasID","bgImage","cdnPath","enableFetchWithCache","globalTracingLogger"]);if(void 0!==o&&(this.enableFetchWithCache=o),a&&(this.globalTracingLogger=a),this.cdnPath=s||di.cdnPath,!this.cdnPath)throw new Error("VB module: cdnPath is not provided");this.vbWorkerUrl="".concat(this.cdnPath,"/vb_worker.min.js"),this.initParam=n,this._needFrame=n.needFrame,t&&(this.cvsEle="string"==typeof t?document.querySelector("#".concat(t)):t),r&&(this.bgImage=r),this.handle_message_from_vb_worker=this.handle_message_from_vb_worker.bind(this);const d=navigator.userAgent.toLocaleLowerCase();this.isSafari=d.includes("safari")&&!d.includes("chrome")&&!d.includes("chromium"),this.vbLoadingTimer=new si,this.handleLoadMetadata=this.handleLoadMetadata.bind(this),this.stats={fps:0,receivingFps:0,receivedFrames:0,generatedFrames:0,width:0,height:0}}set needFrame(e){this._needFrame=e,this.postMessage({cmd:$t.VB_UPDATE_NEED_FRAME,payload:e})}get needFrame(){return this._needFrame}get backend(){return this._backend}set ontimeout3s(e){this.vbLoadingTimer.ontimeout3s=e}set ontimeout10s(e){this.vbLoadingTimer.ontimeout10s=e}static isSupportVB(){return ni(this,void 0,void 0,(function*(){try{return navigator.hardwareConcurrency&&navigator.hardwareConcurrency>2&&"function"==typeof OffscreenCanvas}catch(e){return!1}}))}sendCanvas(){if(this.cvsEle){const e=this.cvsEle.transferControlToOffscreen();this.postMessage({cmd:$t.VB_RENDER_CANVAS,payload:e},[e])}}generateVBStream(){if(this.vbTrackGenerator){const e=this.vbTrackGenerator.writable;this.postMessage({cmd:$t.VB_GENERATE_STREAM,payload:e},[e])}else if(this.streamCanvas)if(this.isSafari){const e=this.streamCanvas.transferControlToOffscreen();this.postMessage({cmd:$t.VB_GENERATE_STREAM,payload:e},[e])}else this.streamRender=new ri(this.streamCanvas,di.VB_STREAM_CANVAS),this.postMessage({cmd:$t.VB_GENERATE_STREAM})}initialize(){return this.isVBReady?Promise.resolve():(this.isVBInitializing||((0,oi.T)({enabled:!!this.enableFetchWithCache,reportLog:e=>{var t;null===(t=this.globalTracingLogger)||void 0===t||t.directReport("FetchCache: ".concat(JSON.stringify(e)))},resourcePath:this.cdnPath}),this.isVBInitializing=!0,this.vbLoadingTimer.isVBPredictDone=!1,this.initPromise=new Promise(((e,t)=>ni(this,void 0,void 0,(function*(){this.initReject=t,this.initResolve=e;try{const e=yield(0,oi.A)(this.vbWorkerUrl);if(e.ok){const t=yield e.arrayBuffer();if(this.destoryed)return;const i=s().createObjectURL(new Blob([t]));this.worker=new Worker(i,{name:di.VB_WORKER_NAME}),this.worker.addEventListener("message",this.handle_message_from_vb_worker),this.postMessage({cmd:$t.VB_WORKER_INIT,payload:Object.assign(Object.assign({renderUserAgentInfo:(0,it.B)().userAgent.info(),renderCapabilitiesDesc:(0,it.B)().capabilities.desc(),renderConfigDesc:(0,it.B)().config.desc()},this.initParam),{cdnPath:this.cdnPath,enableFetchWithCache:this.enableFetchWithCache})}),this.sendCanvas(),s().revokeObjectURL(i)}else{const{url:i,status:r}=e;this.isVBInitializing=!1,t("Fetch worker file failed. url: ".concat(i,", status: ").concat(r))}}catch(e){this.isVBInitializing=!1,t(e)}}))))),this.initPromise)}send_frame(e){this.isVBReady&&("format"in e?this.postMessage({cmd:$t.VB_SEND_FRAME,payload:e},[e]):this.postMessage({cmd:$t.VB_SEND_FRAME,payload:e},[e.data.buffer]))}Crop_Mask_Bg_16V9(){let e,t,i,r=0,s=16/9,o=this.bgImage.width,a=this.bgImage.height;return s*a>=o?(i=o,r=o/s,e=0,t=(a-r)/2):(i=a*s,r=a,e=(o-i)/2,t=0),{sx:e,sy:t,sw:i,sh:r}}set_background_image(e){if(this.bgImage=e,!this.isVBReady)return!1;const t=this.Crop_Mask_Bg_16V9();let i,r,s,o,a,n;i=t.sx,r=t.sy,s=t.sw,o=t.sh,s>1920?(a=1920,n=1080):(a=s,n=o),this.bgConvertCanvas||(this.bgConvertCanvas=new OffscreenCanvas(a,n)),this.bgConvertCanvas.width=a,this.bgConvertCanvas.height=n;let d=null;try{d=this.bgConvertCanvas.getContext("2d",{willReadFrequently:!0})}catch(e){}finally{d||(d=this.bgConvertCanvas.getContext("2d"))}if(!d)return!1;d.drawImage(e,i,r,s,o,0,0,this.bgConvertCanvas.width,this.bgConvertCanvas.height);let c=d.getImageData(0,0,this.bgConvertCanvas.width,this.bgConvertCanvas.height);return this.postMessage({cmd:$t.VB_UPDATE_BG,payload:c}),"close"in e&&e.close(),!0}set_background_blur(){this.isVBReady&&this.postMessage({cmd:$t.VB_UPDATE_BG,payload:"blur"})}handle_message_from_vb_worker(e){var t;const{cmd:i}=e.data;switch(di.EXTERNAL_EVENTS.has(i)&&(i!==$t.VB_GENERATED_FRAME||this._needFrame)&&this.callback&&this.callback(e.data),i){case $t.VB_MODEL_READY:this.vbLoadingTimer.start();break;case $t.VB_PREDICT_DONE:{const{payload:t}=e.data;this.vbLoadingTimer.isVBPredictDone=!0,this.vbLoadingTimer.clear(),this._backend=t;break}case $t.VB_INIT_FAILED:{const{payload:t}=e.data;this.isVBInitializing=!1,this.initReject(t);break}case $t.VB_INIT_SUCCESS:this.isVBReady=!0,this.isVBInitializing=!1,this.bgImage&&this.set_background_image(this.bgImage),this.generateVBStream(),this.initResolve();break;case $t.VB_REQUEST_FRAME:if(this.updateConstraints(),this.captureVideoEle&&this.isVideoPlaying(this.captureVideoEle))if(window.VideoFrame){if(this.isMetadataLoaded)try{const e=new VideoFrame(this.captureVideoEle,{timestamp:1e3*performance.now()});this.send_frame(e),e.close()}catch(e){this.callback&&!this.isReportVideoFrameError&&(this.callback({cmd:$t.VB_WORKER_ERROR,payload:e}),this.isReportVideoFrameError=!0)}}else if(this.captureCtx){this.captureCtx.drawImage(this.captureVideoEle,0,0);const e=this.captureCtx.getImageData(0,0,this.captureVideoEle.videoWidth,this.captureVideoEle.videoHeight);this.streamRender&&this.isStreamEnabled&&!this.isEnabled&&this.streamRender.render(e),this.send_frame(e)}break;case $t.VB_GENERATED_FRAME:{const t=e.data.payload,{data_ptr:i}=t;this.streamRender&&this.isStreamEnabled&&this.streamRender.render(t),i&&this.freeMemory(i);break}case $t.VB_UPDATE_STATS:this.stats=e.data.payload;break;case $t.VB_RESOLUTION_CHANGE:{const{width:t,height:i}=e.data.payload;this.stats.width=t,this.stats.height=i;break}case $t.VB_GLOBAL_TRACING_LOG:{const{payload:i}=e.data;null===(t=this.globalTracingLogger)||void 0===t||t.directReport("FetchCache: ".concat(i));break}}}onMessage(e){this.callback=e}createCaptureEle(){window.MediaStreamTrackProcessor||(this.captureVideoEle=document.querySelector("#".concat(di.VB_CAPTURE_VIDEO)),this.captureVideoEle||(this.captureVideoEle=document.createElement("video"),this.captureVideoEle.autoplay=!0,this.captureVideoEle.playsInline=!0,this.captureVideoEle.id=di.VB_CAPTURE_VIDEO,this.captureVideoEle.style.position="fixed",this.captureVideoEle.style.width="1px",this.captureVideoEle.style.height="1px",this.captureVideoEle.style.bottom="0px",this.captureVideoEle.style.right="0px",this.captureVideoEle.muted=!0,document.body.appendChild(this.captureVideoEle)),this.captureCanvas||window.VideoFrame||(this.captureCanvas=document.createElement("canvas"),this.captureCtx=this.captureCanvas.getContext("2d")))}isVideoPlaying(e){return(e.paused||e.ended)&&e.play(),e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>2}postMessage(e,t){var i,r;t?null===(i=this.worker)||void 0===i||i.postMessage(e,t):null===(r=this.worker)||void 0===r||r.postMessage(e)}updateStreamCanvasSize(e,t){this.streamCanvas&&(this.isSafari?this.postMessage({cmd:$t.VB_CHANGE_STREAM_CANVAS_SIZE,payload:{width:e,height:t}}):(this.streamCanvas.width=e,this.streamCanvas.height=t))}updateConstraints(){const e=this.videoStream.getVideoTracks()[0],{width:t,height:i,frameRate:r}=e.getSettings();t&&i&&(!this.streamCanvas||t===this.streamCanvas.width&&i===this.streamCanvas.height||this.updateStreamCanvasSize(t,i),this.captureCanvas&&(t!==this.captureCanvas.width&&(this.captureCanvas.width=t),i!==this.captureCanvas.height&&(this.captureCanvas.height=i))),r&&this.frameRate!=Math.min(r,24)&&(this.frameRate=Math.min(r,24),this.postMessage({cmd:$t.VB_UPDATE_FRAME_RATE,payload:this.frameRate}))}captureVideo(e){return ni(this,void 0,void 0,(function*(){if(this.shouldStopCapture=!1,this.isVBReady||this.isVBInitializing?this.isVBInitializing&&(yield this.initPromise):yield this.initialize(),this.shouldStopCapture)return this.shouldStopCapture=!1,Promise.reject("The capture was stopped");if(this.isCapturing)return Promise.reject("Capture is already started");let t=!0;if("id"in e){if(!e.active)return Promise.reject("stream is not active");this.videoStream&&this.videoStream.id===e.id?t=!1:(this.videoStream&&this.stopCapture(),this.videoStream=e)}else if(this.videoStream&&this.captureConf===e)t=!1;else{this.videoStream&&this.stopCapture(),this.isCapturing=!0;try{this.videoStream=yield navigator.mediaDevices.getUserMedia(Object.assign(Object.assign({},e),{audio:!1})),this.captureConf=e,this.isCapturing=!1}catch(e){return this.isCapturing=!1,Promise.reject(e)}}if(this.createCaptureEle(),t){let e;if(!(e=this.videoStream.getVideoTracks()[0]))return Promise.reject("No video track in stream");{const t=e.getSettings(),{width:i=0,height:r=0,frameRate:s=24}=t;if(this.updateStreamCanvasSize(i,r),this.frameRate=Math.min(s,24),window.MediaStreamTrackProcessor){this.trackProcessor=new window.MediaStreamTrackProcessor({track:e});const t=this.trackProcessor.readable;this.postMessage({cmd:$t.VB_START,payload:{videoStream:t,frameRate:this.frameRate}},[t])}else this.captureVideoEle&&(this.isMetadataLoaded=!1,this.captureVideoEle.addEventListener("loadedmetadata",this.handleLoadMetadata),this.captureVideoEle.srcObject=this.videoStream,this.captureVideoEle.play(),this.captureCanvas&&(this.captureCanvas.width=i,this.captureCanvas.height=r),this.postMessage({cmd:$t.VB_START,payload:{frameRate:this.frameRate}}))}}else{if(this.isVBRunning)return;this.videoStream.getVideoTracks()[0].enabled=!0,this.captureVideoEle&&this.captureVideoEle.play(),this.postMessage({cmd:$t.VB_START})}return this.isVBRunning=!0,this.shouldStopCapture?(this.stopCapture(),this.shouldStopCapture=!1,Promise.reject("The capture was stopped")):void 0}))}stopCapture(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.videoStream?(this.postMessage({cmd:$t.VB_STOP,payload:e}),this.captureVideoEle&&this.captureVideoEle.pause(),this.videoStream&&e&&(this.videoStream.getTracks().forEach((e=>{e.stop()})),this.videoStream=null),this.isVBRunning=!1):this.shouldStopCapture=!0}setMirror(e){this.postMessage({cmd:$t.VB_MIRROR,payload:e})}freeMemory(e){this.isVBReady&&this.postMessage({cmd:$t.VB_FREE_MEMORY,payload:e})}startReceiveMode(e){return e&&(this.captureConf=e),this.msgChannel||(this.msgChannel=new MessageChannel,this.msgChannel.port1.onmessage=e=>{var t;const{type:i,frame:r}=e.data;this.receiveTimer&&clearTimeout(this.receiveTimer),i===n.Abc&&r?(null===(t=this.msgChannel)||void 0===t||t.port1.postMessage({type:n.wb7}),this.isEnabled?(this.isVBRunning&&this.stopCapture(),this.renderFrame(r)):r.close(),this.isSafari||(this.receiveTimer=setTimeout((()=>{this.captureConf&&!this.isVBRunning&&this.captureVideo(this.captureConf)}),1e3))):i!==n.L_m&&i!==n.lLs||(this.captureConf&&!this.isVBRunning&&this.captureVideo(this.captureConf),i===n.lLs&&this.msgChannel&&(this.msgChannel.port1.onmessage=null,this.msgChannel=null))}),this.msgChannel.port2}enable(){this.postMessage({cmd:$t.VB_TOGGLE_VB,payload:!0}),this.isEnabled=!0}disable(){this.postMessage({cmd:$t.VB_TOGGLE_VB,payload:!1}),this.isEnabled=!1,!this.isVBRunning&&this.msgChannel&&this.captureConf&&(this.captureVideo(this.captureConf).catch((e=>{})),clearTimeout(this.receiveTimer))}renderFrame(e){return ni(this,void 0,void 0,(function*(){this.postMessage({cmd:$t.VB_RENDER_FRAME,payload:e}),"close"in e&&e.close()}))}destory(){this.destoryed=!0,this.stopCapture(),this.vbLoadingTimer.clear(),this.msgChannel&&(this.msgChannel.port2.onmessage=null),this.captureVideoEle&&document.body.removeChild(this.captureVideoEle),this.worker&&(this.worker.removeEventListener("message",this.handle_message_from_vb_worker),this.worker.terminate())}createStream(){if(this.isStreamEnabled=!0,this.vbStream)return this.postMessage({cmd:$t.VB_GENERATE_STREAM}),this.vbStream;if(window.MediaStreamTrackGenerator)this.vbTrackGenerator=new MediaStreamTrackGenerator({kind:"video"}),this.vbStream=new MediaStream([this.vbTrackGenerator]);else{if(this.streamCanvas=document.createElement("canvas"),this.videoStream){const e=this.videoStream.getVideoTracks()[0];if(e){const{width:t=0,height:i=0}=e.getSettings();this.streamCanvas.width=t,this.streamCanvas.height=i}}(0,ai.gm)()?this.vbStream=this.streamCanvas.captureStream():this.vbStream=this.streamCanvas.captureStream(24)}const e=this.vbStream.getVideoTracks()[0];return e&&(e.getStats=()=>this.stats),this.isVBReady&&this.generateVBStream(),this.vbStream}stopStream(){this.vbStream&&(this.isStreamEnabled=!1,this.postMessage({cmd:$t.VB_STOP_STREAM}))}handleLoadMetadata(){this.isMetadataLoaded=!0,this.captureVideoEle.removeEventListener("loadedmetadata",this.handleLoadMetadata)}}di.VB_WORKER_NAME="vb_worker",di.VB_CAPTURE_VIDEO="VB_CAPTURE_VIDEO",di.VB_STREAM_CANVAS="VB_STREAM_CANVAS",di.EXTERNAL_EVENTS=new Set([$t.VB_GENERATED_FRAME,$t.VB_INIT_FAILED,$t.VB_INIT_SUCCESS,$t.VB_MODEL_READY,$t.VB_PREDICT_DONE,$t.VB_VIDEO_FORMAT_UNSUPPORTED,$t.VB_WORKER_ERROR,$t.VB_GENERATE_FIRST_FRAME,$t.VB_RESOLUTION_CHANGE]);const ci=di;if(document){const e=document.currentScript;if(e){const t=e.src;if(t){let e=t.indexOf("/vb.min.js");-1!==e&&(di.cdnPath=t.substring(0,e))}}}var li,hi,ui,pi,fi,mi,vi,gi,_i=i(3404);!function(e){e.ADD_VIDEO_PORT="add_video_port",e.ADD_SHADOW_PORT="add_shadow_port",e.ADD_VIDEO_PROCESSOR="add_video_processor",e.PROCESSOR_READY="processor_ready",e.PROCESSOR_ERROR="processor_error"}(li||(li={})),function(e){e.ADD_SHARE_PORT="add_share_port",e.ADD_SHADOW_PORT="add_shadow_port",e.ADD_SHARE_PROCESSOR="add_share_processor",e.ADD_SHARE_ENCODE_PORT="add_share_encode_port",e.PROCESSOR_READY="processor_ready",e.PROCESSOR_ERROR="processor_error"}(hi||(hi={})),function(e){e.INIT_PROCESSOR="init_processor",e.UNINIT_PROCESSOR="uninit_processor",e.INIT_OUTPUT_CANVAS="init_output_canvas",e.OUTPUT_WRITABLE_STREAM="output_writable_stream",e.INPUT_READABLE_STREAM="input_readable_stream",e.FRAME_DATA="frame_data",e.START_REQUEST_FRAME="start_request_frame",e.STOP_REQUEST_FRAME="stop_request_frame",e.REQUEST_FRAME="request_frame",e.FRAME_CALLBACK="frame_callback",e.RESOLUTION_CHANGE="RESOLUTION_CHANGE",e.PROCESSOR_WORKER_ERROR="PROCESSOR_WORKER_ERROR",e.PROCESSOR_STOP_COMPLETE="PROCESSOR_STOP_COMPLETE"}(ui||(ui={})),pi||(pi={});class Si{constructor(e,t,i){this.port=e,this.name=t,this.VideoFrameNeeded=i}setStream(e){const t=e.getVideoTracks()[0],i=t.getSettings(),{frameRate:r=24}=i;this.trackProcessor=new MediaStreamTrackProcessor({track:t});const s=this.trackProcessor.readable;this.port.postMessage({cmd:ui.INPUT_READABLE_STREAM,frameRate:Math.min(r,24),readableStream:s,processorName:this.name},[s]),this.port.postMessage({cmd:ui.START_REQUEST_FRAME,frameRate:r,processorName:this.name,VideoFrameNeeded:this.VideoFrameNeeded})}removeStream(){this.port.postMessage({cmd:ui.STOP_REQUEST_FRAME,processorName:this.name})}destroy(){this.removeStream()}}class Ai{constructor(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this.port=e,this.name=t,this.isIOSDevice=i,this.VideoFrameNeeded=r,this.onMessage=e=>{if(e.data.cmd===ui.REQUEST_FRAME&&this.captureVideoEleLoaded){let e=this.captureVideoEle.videoWidth,t=this.captureVideoEle.videoHeight;if(e<=0||t<=0)return;this.isIOSDevice&&(this.captureCanvasEle.width=e,this.captureCanvasEle.height=t,this.captureCanvasEleCtx.drawImage(this.captureVideoEle,0,0,e,t));const i=new VideoFrame(this.isIOSDevice?this.captureCanvasEle:this.captureVideoEle,{timestamp:1e3*performance.now()});this.port.postMessage({cmd:ui.FRAME_DATA,frame:i,processorName:this.name}),i.close()}},this.port.addEventListener("message",this.onMessage)}createCaptureVideoElement(e){this.captureVideoEle=document.querySelector("#video-processor-video"),this.captureVideoEle||(this.captureVideoEle=document.createElement("video"),this.captureVideoEle.autoplay=!0,this.captureVideoEle.playsInline=!0,this.captureVideoEle.id="video-processor-video",this.captureVideoEle.style.position="fixed",this.captureVideoEle.style.width="1px",this.captureVideoEle.style.height="1px",this.captureVideoEle.style.bottom="0px",this.captureVideoEle.style.right="0px",this.captureVideoEle.muted=!0,document.body.appendChild(this.captureVideoEle)),this.isIOSDevice&&!this.captureCanvasEle&&(this.captureCanvasEle=document.createElement("canvas"),this.captureCanvasEleCtx=this.captureCanvasEle.getContext("2d")),this.captureVideoEle.srcObject=e,this.captureVideoEle.addEventListener("loadedmetadata",(()=>{this.captureVideoEleLoaded=!0})),this.captureVideoEle.play()}setStream(e){const t=e.getVideoTracks()[0].getSettings(),{frameRate:i=24}=t;this.createCaptureVideoElement(e),this.port.postMessage({cmd:ui.START_REQUEST_FRAME,frameRate:Math.min(i,24),processorName:this.name,VideoFrameNeeded:this.VideoFrameNeeded})}removeStream(){this.port.postMessage({cmd:ui.STOP_REQUEST_FRAME,processorName:this.name})}destroy(){this.port.removeEventListener("message",this.onMessage)}}class yi{constructor(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this.port=e,this.name=t,this.isIOSDevice=i,this.VideoFrameNeeded=r,this.onMessage=e=>{if(e.data.cmd===ui.REQUEST_FRAME&&this.captureVideoEleLoaded){let e=this.captureVideoEle.videoWidth,t=this.captureVideoEle.videoHeight;if(e<=0||t<=0)return;this.isIOSDevice&&(this.captureCanvasEle.width=e,this.captureCanvasEle.height=t,this.captureCanvasEleCtx.drawImage(this.captureVideoEle,0,0,e,t));const i=new VideoFrame(this.isIOSDevice?this.captureCanvasEle:this.captureVideoEle,{timestamp:1e3*performance.now()});this.port.postMessage({cmd:ui.FRAME_DATA,frame:i,processorName:this.name}),i.close()}},this.port.addEventListener("message",this.onMessage)}createCaptureVideoElement(e){this.captureVideoEle=document.querySelector("#share-processor-video"),this.captureVideoEle||(this.captureVideoEle=document.createElement("video"),this.captureVideoEle.autoplay=!0,this.captureVideoEle.playsInline=!0,this.captureVideoEle.id="share-processor-video",this.captureVideoEle.style.position="fixed",this.captureVideoEle.style.width="1px",this.captureVideoEle.style.height="1px",this.captureVideoEle.style.bottom="0px",this.captureVideoEle.style.right="0px",this.captureVideoEle.muted=!0,document.body.appendChild(this.captureVideoEle)),this.isIOSDevice&&!this.captureCanvasEle&&(this.captureCanvasEle=document.createElement("canvas"),this.captureCanvasEleCtx=this.captureCanvasEle.getContext("2d")),this.captureVideoEle.srcObject=e,this.captureVideoEle.addEventListener("loadedmetadata",(()=>{this.captureVideoEleLoaded=!0})),this.captureVideoEle.play()}setStream(e){const t=e.getVideoTracks()[0].getSettings(),{frameRate:i=24}=t;this.createCaptureVideoElement(e),this.port.postMessage({cmd:ui.START_REQUEST_FRAME,frameRate:Math.min(i,24),processorName:this.name,VideoFrameNeeded:this.VideoFrameNeeded})}removeStream(){this.port.postMessage({cmd:ui.STOP_REQUEST_FRAME,processorName:this.name})}destroy(){this.port.removeEventListener("message",this.onMessage)}}class Ci{constructor(e,t){this.trackGenerator=new MediaStreamTrackGenerator({kind:"video"});const i=this.trackGenerator.writable;e.postMessage({cmd:ui.OUTPUT_WRITABLE_STREAM,writableStream:i,processorName:t},[i]),this.stream=new MediaStream([this.trackGenerator])}getStream(){return this.stream}}class Ei{constructor(e,t,i){this.canvas=document.createElement("canvas"),this.canvas.width=1,this.canvas.height=1,this.stream=this.canvas.captureStream(24),i?i.canCanvasAsOffscreenAfterCaptureStream?this.offScreenCanvas=this.canvas.transferControlToOffscreen():this.offScreenCanvas=null:this.offScreenCanvas=this.canvas.transferControlToOffscreen()}getOutputCanvas(){return this.offScreenCanvas}getStream(){return this.stream}getStreamingCanvas(){return this.canvas}}class bi{constructor(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this.processorName=e,this.port=t,this.isIOSDevice=i,this.VideoFrameNeeded=r,this.frameCallback=null,this.callback=null,this.onMessage=e=>{var t,i;e.data.cmd===ui.FRAME_CALLBACK?null===(t=this.frameCallback)||void 0===t||t.call(this,e.data.frame):null===(i=this.callback)||void 0===i||i.call(this,e.data.cmd,e.data.data)},this.port.start(),this.port.addEventListener("message",this.onMessage);const s=this.getOutPutCanvas();s?this.port.postMessage({cmd:ui.INIT_OUTPUT_CANVAS,canvas:s,processorName:e},[s]):this.port.postMessage({cmd:ui.INIT_OUTPUT_CANVAS,processorName:e})}init(){this.port.postMessage({cmd:ui.INIT_PROCESSOR,processorName:this.processorName})}addCallback(e){this.callback=e}removeCallback(){this.callback=null}uninit(){this.port.postMessage({cmd:ui.UNINIT_PROCESSOR,processorName:this.processorName}),this.port.removeEventListener("message",this.onMessage)}getOutPutCanvas(){return null}getStream(){throw new Error("Method not implemented.")}setStream(e){throw new Error("Method not implemented.")}removeStream(){}onFrame(e){throw new Error("Method not implemented.")}addFrameCallback(e){throw new Error("Method not implemented.")}removeFrameCallback(){}}class wi extends bi{constructor(e,t){super(e,t),this.processorName=e,this.port=t}onFrame(e){this.port.postMessage({cmd:ui.FRAME_DATA,frame:e,processorName:this.processorName})}addFrameCallback(e){this.frameCallback=e}removeFrameCallback(){this.frameCallback=null}}class Ri extends wi{constructor(e,t){super(e,t),this.processorName=e,this.port=t}onFrame(e){}}class Ti extends bi{constructor(e,t,i,r){super(e,t,i,r),this.processorName=e,this.port=t,this.isIOSDevice=i,this.VideoFrameNeeded=r,this.initGenerator()}initGenerator(){this.originGenerator||(this.originGenerator="function"==typeof MediaStreamTrackProcessor?new Si(this.port,this.processorName,this.VideoFrameNeeded):new Ai(this.port,this.processorName,this.isIOSDevice,this.VideoFrameNeeded)),this.targetGenerator||(this.targetGenerator="function"==typeof MediaStreamTrackGenerator?new Ci(this.port,this.processorName):new Ei(this.port,this.processorName))}uninit(){var e,t,i,r;null===(t=null===(e=this.originGenerator)||void 0===e?void 0:e.destroy)||void 0===t||t.call(e),null===(r=null===(i=this.targetGenerator)||void 0===i?void 0:i.destroy)||void 0===r||r.call(i),super.uninit()}getOutPutCanvas(){var e,t;return this.initGenerator(),null===(t=(e=this.targetGenerator).getOutputCanvas)||void 0===t?void 0:t.call(e)}getStream(){return this.targetGenerator.getStream()}setStream(e){this.originGenerator.setStream(e)}removeStream(){this.originGenerator.removeStream()}addFrameCallback(e){this.frameCallback=e}}class Ii{static hasProcessor(){return this.videoProcessorAgentMap.size>0}static hasMediaStreamFrameProcessor(){return[...this.videoProcessorAgentMap.values()].some((e=>e instanceof Ti))}static addFrameCallback(e,t){this.frameCallbackMap.set(e,t),this.getProcessor(e)&&this.getProcessor(e).addFrameCallback(t)}static addCallback(e,t){this.callbackMap.set(e,t),this.getProcessor(e)&&this.getProcessor(e).addCallback(t)}static onFrame(e){for(const t of this.videoProcessorAgentMap.values())t.onFrame(e)}static getStream(){return[...this.videoProcessorAgentMap.values()].pop().getStream()}static setStream(e){for(const t of this.videoProcessorAgentMap.values())t.setStream(e)}static removeStream(){for(const e of this.videoProcessorAgentMap.values())e.removeStream()}static getProcessor(e){return this.videoProcessorAgentMap.get(e)}static startProcessor(e,t){t.init();const i=this.frameCallbackMap.get(e);i&&t.addFrameCallback(i);const r=this.callbackMap.get(e);r&&t.addCallback(r),this.videoProcessorAgentMap.set(e,t)}static stopProcessor(e){const t=this.getProcessor(e);t&&(t.removeFrameCallback(),t.removeCallback(),this.frameCallbackMap.delete(e),this.callbackMap.delete(e),t.removeStream(),t.uninit()),this.videoProcessorAgentMap.delete(e)}static resetProcessorManager(){for(const e of this.videoProcessorAgentMap.keys())this.stopProcessor(e)}}Ii.videoProcessorAgentMap=new Map,Ii.frameCallbackMap=new Map,Ii.callbackMap=new Map,function(e){e[e.Unknow=0]="Unknow",e[e.MediaCommand=1]="MediaCommand",e[e.P2PControl=2]="P2PControl",e[e.MeshControl=3]="MeshControl"}(fi||(fi={})),function(e){e[e.normal=0]="normal",e[e.child=1]="child",e[e.parent=2]="parent",e[e.invalid=31]="invalid"}(mi||(mi={})),function(e){e[e.bridge=0]="bridge",e[e.setRole=1]="setRole",e[e.connectTestParams=2]="connectTestParams",e[e.reportConnectedSet=3]="reportConnectedSet",e[e.notifyChildParentLeave=4]="notifyChildParentLeave",e[e.notifyParentChildLeave=5]="notifyParentChildLeave",e[e.availableParents=6]="availableParents",e[e.updateNodeStatus=7]="updateNodeStatus",e[e.joinSuccess=8]="joinSuccess",e[e.kickChild=9]="kickChild",e[e.leaveParent=10]="leaveParent",e[e.subscriptionMap=11]="subscriptionMap",e[e.channelopt=12]="channelopt",e[e.joinSuccessConfirm=13]="joinSuccessConfirm",e[e.registerMeshNode=14]="registerMeshNode",e[e.meshAllowTalk=15]="meshAllowTalk",e[e.statInfo=16]="statInfo",e[e.adapt=17]="adapt",e[e.refershConnectParams=18]="refershConnectParams",e[e.joinConnectedSetConfirm=19]="joinConnectedSetConfirm",e[e.registerMeshNodeResult=20]="registerMeshNodeResult",e[e.meshSigType=21]="meshSigType",e[e.meshSigKey=22]="meshSigKey",e[e.mediaAccess=23]="mediaAccess",e[e.unknown=1e3]="unknown"}(vi||(vi={})),function(e){e[e.Unknow=0]="Unknow",e[e.Offer=1]="Offer",e[e.Answer=2]="Answer"}(gi||(gi={}));var Mi=i(129),Di=i.n(Mi),Pi=function(e,t,i,r){return new(i||(i=Promise))((function(s,o){function a(e){try{d(r.next(e))}catch(e){o(e)}}function n(e){try{d(r.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,n)}d((r=r.apply(e,t||[])).next())}))};const ki={iceServers:[{urls:"stun:vdic157.zoomdev.us:3478"}]};class Oi{constructor(e,t){this.remoteices=[],this.localices=[],this.peerId=e,this.label=t,this._readystatus=Oi.CONNECTING}get ready(){return this._ready}get readystatus(){return this._readystatus}set onopen(e){this._onopen=e}get onopen(){return this._onopen}set onclose(e){this._onclose=e}get onclose(){return this._onclose}_p2pchannelclose(){var e,t,i,r,s,o;let a=this._readystatus;this._readystatus!=Oi.OPEN&&this._readystatus!=Oi.CLOSED&&this.resolveObj(!1),this._readystatus=Oi.CLOSED,a!=Oi.CLOSED&&(null===(e=this._onclose)||void 0===e||e.call(this,null));try{null===(t=this.channel)||void 0===t||t.onopen((()=>{})),null===(i=this.channel)||void 0===i||i.onmessage((()=>{})),null===(r=this.channel)||void 0===r||r.onclose((()=>{})),null===(s=this.channel)||void 0===s||s.close(),this.channel=null}catch(e){}try{this.pc.onicecandidate=null,this.pc.ondatachannel=null,this.pc.onconnectionstatechange=null,this.pc.oniceconnectionstatechange=null,null===(o=this.pc)||void 0===o||o.close(),this.pc=null}catch(e){}this._onclose=null,this._onopen=null}_p2pchannelopen(){var e;let t=this._readystatus;this._readystatus!=Oi.OPEN&&this._readystatus!=Oi.CLOSED&&(this._readystatus=Oi.OPEN,this.resolveObj(!0)),t!=Oi.OPEN&&(null===(e=this._onopen)||void 0===e||e.call(this,null))}init(e){const{runthread:t,signal:i,timeout:r,offer:s}=e,o=this.peerId,a=this.label;let n=Object.assign({},ki);n.iceServers=e.stunServers||[];const d=x.A.createPeerConnection(n);this.pc=d,this._ready=new Promise(((e,r)=>Pi(this,void 0,void 0,(function*(){this.resolveObj=e;let r=(null==t?void 0:t.isUseTransferRTC())?t.getWorker():null;const n=e=>{this.channel=new k.h(o,E.Xt.MESH,e.channel,r,"MESH",t),this.channel.transportlists=[V.vK.MESH_NETRTC],this.channel.onopen(this._p2pchannelopen.bind(this)),this.channel.onclose(this._p2pchannelclose.bind(this)),this.channel.open()};try{d.onicecandidate=e=>{let t={type:"candidate",candidate:null,peerId:o,label:a};if(e.candidate){const{candidate:i,sdpMid:r,sdpMLineIndex:s}=e.candidate;t.candidate={candidate:i,sdpMid:r,sdpMLineIndex:s},this.localices.push(e.candidate.type)}this._readystatus!=Oi.CLOSED&&i(o,t)};var c={peerId:o,label:a};if(s){d.ondatachannel=n,d.setRemoteDescription(s);let e=yield d.createAnswer();d.setLocalDescription(e),Object.assign(c,{answer:e,type:"answer"})}else{const e={ordered:!0,maxRetransmits:3};let t=d.createDataChannel(a,e);t.binaryType="arraybuffer",n({channel:t});let i=yield d.createOffer();d.setLocalDescription(i),Object.assign(c,{offer:i,type:"offer"})}this._readystatus!=Oi.CLOSED&&i(o,c)}catch(e){this._p2pchannelclose()}}))));const c=void 0!==d.connectionState,l=this,h=["closed","failed"],u=()=>{const e=d.connectionState||d.iceConnectionState,t="connected"==e;l._readystatus!=Oi.OPEN||t||(h.includes(e)?l._p2pchannelclose():setTimeout((()=>{u()}),5e3))};c?d.onconnectionstatechange=u:d.oniceconnectionstatechange=u,r&&setTimeout((()=>{this._readystatus==Oi.CONNECTING&&this._p2pchannelclose()}),r)}signalMsg(e){if(this._readystatus!=Oi.CONNECTING)return;const t=e.type;if("answer"==t&&this.pc.setRemoteDescription(e.answer),"candidate"==t&&(this.pc.addIceCandidate(e.candidate),e.candidate)){let t=new RTCIceCandidate(e.candidate);this.remoteices.push(t.type)}}close(){this._p2pchannelclose()}getStatus(){return Pi(this,void 0,void 0,(function*(){let e="error";if(this._readystatus==Oi.OPEN){let t=yield this.pc.getStats();t.forEach((i=>{if("transport"===i.type&&i.selectedCandidatePairId){const r=t.get(i.selectedCandidatePairId),s=t.get(r.remoteCandidateId),o=t.get(r.localCandidateId);e="".concat(s.candidateType,"|").concat(o.candidateType)}}))}return"".concat(e,"-").concat(this.localices.join("|"),"-").concat(this.remoteices.join("|"))}))}startRttProde(){return Pi(this,void 0,void 0,(function*(){var e,t;if(!(null===(e=this.channel)||void 0===e?void 0:e.isTransfered())&&(null===(t=this.channel)||void 0===t?void 0:t.isReady())){const e=10,t=268435455,i=Array(e).fill(0);let r=0;const s=()=>{var o;const a=r,n=(Date.now()&t)>>>0;i[a]=n;let d=new Uint8Array(1e3);d[0]=0,d[1]=a,d[4]=n>>24&255,d[5]=n>>16&255,d[6]=n>>8&255,d[7]=255&n,null===(o=this.channel)||void 0===o||o.send(d),r++,r<e&&setTimeout(s,10)};this.channel.onmessage((e=>{const r=new Uint8Array(e.data),s=r[1],o=5+((Date.now()&t)>>>0),a=r[4]<<24|r[5]<<16|r[6]<<8|r[7];o>i[s]&&a==i[s]&&(i[s]=o-a)}));let o=new Promise(((t,r)=>{setTimeout((()=>{let r=0,s=268435455,o=0,a=0;for(let t=0;t<e;t++){const e=i[t];e>3e3||(e>r&&(r=e),e<s&&(s=e),o+=e,a++)}const n=a>7?Math.round(o/a):1e4,d="MESHTESTRTT:".concat(n,"|").concat(r,"|").concat(s,"|").concat(a);t({ok:n<100,msg:d})}),1e3)}));return s(),yield o}return Promise.resolve({ok:!1})}))}static create(e){const{peerId:t,label:i}=e;let r=new Oi(t,i);return r.init(e),r}}Oi.OPEN=1,Oi.CONNECTING=2,Oi.CLOSED=3;var Vi=function(e,t,i,r){return new(i||(i=Promise))((function(s,o){function a(e){try{d(r.next(e))}catch(e){o(e)}}function n(e){try{d(r.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,n)}d((r=r.apply(e,t||[])).next())}))};const Ni=1e4,xi="ONLYSELF";class Li{constructor(e){this.timeoutid=-1,this.defered=new a.cY,this.id=performance.now(),this.worker=e}setResult(e){this.defered.resolve(e)}start(){return Vi(this,void 0,void 0,(function*(){var e;-1==this.timeoutid&&(this.timeoutid=window.setTimeout((()=>{this.defered.resolve(-1)}),5e3));const t={command:Zt.MESH_RTTPRODE,id:this.id};return null===(e=this.worker)||void 0===e||e.postMessage(t),yield this.defered.promise}))}}class Wi{constructor(e,t,i,r,s){this.cid=e,this.nodeid=t,this.role=i,this.initrole=r,this.stunServers=s,this.meshThread=null,this.workers={},this.testsidfaillist=new Map,this.parentbadlist=[],this.childconnectedlasted=0,this.maxconnectedcount=3,this.connectdcount=0,this.isdestory=!1,this.sid=null,this.monitorLog=()=>{},this.signatureInfo=null,this.availablePeerlist=new Set,this.changeSidTimeoutId=0,this.childCIdList=[],this.parentCid=null,this.refreshSidcount=0,this.pcMap=new Map,this.cid=e,this.nodeid=t,this.role=i,this.preRole=i,this.initrole=r,this._ready=new Promise(((e,t)=>{this.ready_resolve=e}))}isDestory(){return this.isdestory}setMonitorLog(e){this.monitorLog=e}get ready(){return this._ready}sendMeshBypassMessage(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};d.A.sendMessageToRwg(n.yJV,{evt:4366,seq:1,body:{type:fi.MeshControl,data:Object.assign({cmdType:e},t)}})}onMessage(e,t){if(!this.isDestory()){switch(e){case vi.bridge:{const{srcID:e,dstID:i,bridgeData:r}=t;if(i!==this.cid)return;const{peerId:s,type:o}=r;if("answer"==o){const e=this.pcMap.get(s);e&&e.signalMsg(r)}else if("offer"==o)this.onRemoteP2PChannel(e,r);else if("candidate"==o){const e=this.pcMap.get(s);e&&e.signalMsg(r)}}break;case vi.connectTestParams:this.connectTest(t.params);break;case vi.setRole:this.changeRole(t.role);break;case vi.joinConnectedSetConfirm:{let{sid:e,confirm:i}=t;i||(this.monitorLog("JOINSIDF"),this.tryOtherSid(!0,5e3));break}}this._onMessage(e,t)}}sendBridgeMessage(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.sendMeshBypassMessage(vi.bridge,{srcID:this.cid,dstID:e,bridgeData:t})}addBadParent(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=e=>this.parentbadlist.findIndex((t=>e==t.cid)),r=i(e);let s={cid:e,count:1,status:0};-1!=r?(s=this.parentbadlist[r],s.count++):this.parentbadlist.push(s),t&&setTimeout((()=>{const t=i(e);this.parentbadlist[t].status=1}),3*s.count*60*1e3)}isBadParent(e){return-1!=this.parentbadlist.findIndex((t=>e==t.cid&&0==t.status))}isTestFailedNode(e,t,i){const r=this.testsidfaillist.get(e);return!(!r||""!=r.cid)||r&&r.cid==t&&r.mediaAccess==i}addTestFailedNode(e,t,i){let r=this.testsidfaillist.get(e);r?(r.cid=t,r.mediaAccess=i):this.testsidfaillist.set(e,{sid:e,cid:t,mediaAccess:i})}connectTest(e){return Vi(this,void 0,void 0,(function*(){var t;const i=e;let r=0,s=xi;for(const{sid:e,cid:a,mediaAccess:n}of i){if(this.isTestFailedNode(e,a,!!n))continue;const i="test",d="".concat(null===(t=this.cid)||void 0===t?void 0:t.slice(0,7),"-").concat(i,"-").concat(Date.now()),c=(e,t)=>{this.sendBridgeMessage(a,t)},l=this.stunServers,h={peerId:d,label:i,signal:c,timeout:Ni,stunServers:l};r++;var o=Oi.create(h);this.pcMap.set(d,o),o.onclose=()=>{this.pcMap.delete(d)};let u=yield o.ready,p=yield o.getStatus();if(this.monitorLog("MESHCANDIDATE:".concat(p)),u&&this.availablePeerlist.add(a),!u){this.addTestFailedNode(e,a,!!n);continue}const{ok:f,msg:m}=(yield o.startRttProde())||{};if(this.monitorLog("".concat(m)),f){this.sendMeshBypassMessage(vi.reportConnectedSet,{sid:e}),s=e,setTimeout((()=>{o.close()}),5e3);break}this.addTestFailedNode(e,a,!!n),o.close()}if(this.sid!=s){const e=s==xi?"":s;this.sendMeshBypassMessage(vi.reportConnectedSet,{sid:e}),this.sid=s}if(this.monitorLog("MESHSIDTEST:".concat(r,":").concat(this.sid!=xi)),s==xi){const e=r>0?18e4:3e5;this.tryOtherSid(!1,e)}}))}onRemoteP2PChannel(e,t){const{peerId:i,label:r,offer:s}=t;this.monitorLog("MESHREMOTE:".concat(i,":").concat(r));const o="mesh"==r,{mesh:a}=this.workers,n=o?a:null,d=this.stunServers,c={peerId:i,label:r,signal:(t,i)=>{this.sendBridgeMessage(e,i)},timeout:Ni,stunServers:d,runthread:n,offer:s},l=Oi.create(c);this.pcMap.set(i,l);const h=t.nodeid;l.onopen=()=>{if(this.pcMap.has(i)){if(o||this.availablePeerlist.add(e),o&&this.role==mi.parent&&this._onChildConnect(e,h,i),o&&this.role!=mi.parent&&(this.monitorLog("MESHDOWNGRADE"),l.close()),!o){const e=l.channel;null==e||e.onmessage((t=>{const i=new Uint8Array(t.data);null==e||e.send(i)}))}}else l.close()},l.onclose=()=>{this.pcMap.delete(i),o&&this._onChildDisConnect(e,i)}}isInSid(){return!!this.sid&&(this.sid!=xi||this.inMeshing())}inMeshing(){const e=!!this.parentCid&&this.role==mi.child,t=0!=this.childCIdList.length&&this.role==mi.parent;return e||t}mediaAccessChange(e){e&&!this.isInSid()&&(this.testsidfaillist=new Map,this.parentbadlist=[],this.sendMeshBypassMessage(vi.refershConnectParams,{}))}inRefreshing(){return!!this.changeSidTimeoutId}tryOtherSid(e,t){this.changeSidTimeoutId||(this.changeSidTimeoutId=setTimeout((()=>{if(this.changeSidTimeoutId=0,!(this.refreshSidcount>10||this.inMeshing()||this.isDestory())){if(++this.refreshSidcount>10)return;e&&(this.sid=""),this.sendMeshBypassMessage(vi.refershConnectParams,{}),this.monitorLog("MESHSIDCHANGE")}}),t))}}class Ui extends Wi{constructor(e){const{cid:t,nodeid:i,role:r,initrole:s,stunServers:o}=e;super(t,i,r,s,o),this.points=0,this.maxLoad=10,this.audioWorker=null,this.videoWorker=null,this.preParentCiud=null,this.netThread=null,this.rttProde=null,this.badNetChild=0,this.reportLoad=0,this.enableAllowTalk=!1,this.selfAllowTalk=!1,this.signatureInfo=e.signatureInfo,this.points=e.initpoints,this.maxLoad=e.initnodes,this.enableAllowTalk=e.enableAllowTalk,setInterval((()=>{this.updateDevicePoints()}),1e4)}_resolvePromise(e){this.ready_resolve&&this.ready_resolve(e),this.ready_resolve=null}_onMessage(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};switch(e){case vi.notifyParentChildLeave:this.onChildLeave(t.cid);break;case vi.subscriptionMap:this._MeshControlleOptInfo("subInfo",t.info);break;case vi.channelopt:this._MeshControlleOptInfo("channelOpt",t.info);break;case vi.notifyChildParentLeave:this.onParentLeave();break;case vi.availableParents:this.connect(t.params);break;case vi.meshAllowTalk:this.allowTalk(t);break;case vi.joinSuccessConfirm:this.joinSuccessConfirm(t);break;case vi.meshSigKey:this.signatureInfo.mmrsigkey=t.recipe,this.setSignature();break;case vi.meshSigType:this.signatureInfo.type=t.type,this.signatureInfo.meetinguuid=t.confID,this.setSignature()}}_onNetThread(e){var t;const{status:i}=e.data;switch(i){case F.KA:{const{id:t,value:i}=e.data;t==this.rttProde.id&&this.rttProde.setResult(i);break}case F.qi:{const i=e.data.data;i.oldRole=this.preRole,i.udid=this.cid;const r=a.Ay.getOSInfo();i.os=null===(t=null==r?void 0:r.browser)||void 0===t?void 0:t.name,this.preRole=i.newRole,i.newRole==mi.child?i.parentUdid=this.parentCid||this.preParentCiud:i.newRole==mi.parent&&(i.childNode=this.childCIdList.length,i.childNodesUdid=this.childCIdList.map((e=>e.cid))),this.parentCid||i.newRole!=mi.child||(i.newRole=mi.normal),this.sendMeshBypassMessage(vi.statInfo,{info:i})}}}_onMeshThread(e){var t;const{status:i}=e.data;switch(i){case F.$U:{const{cid:t,nodeid:i,session_type:r,sub_mode_limit:s}=e.data;this.monitorLog("MESHADAPT_LIMIT:".concat(i,":").concat(s)),this.sendMeshBypassMessage(vi.adapt,{childCid:t,session_type:r,sub_mode_limit:s});break}case F.U2:{const{cid:t,nodeid:i,peerId:r,reason:s}=e.data;this.monitorLog("MESHKICK_CHILD:".concat(i,":").concat(s)),this.badNetChild++,setTimeout((()=>{this.badNetChild--}),3e4*this.badNetChild),this.kickChild(t);const o=this.pcMap.get(r);null==o||o.close();break}case F.qi:{const i=e.data.data;i.oldRole=this.preRole,i.udid=this.cid;const r=a.Ay.getOSInfo();i.os=null===(t=null==r?void 0:r.browser)||void 0===t?void 0:t.name,this.preRole=i.newRole,i.newRole==mi.parent&&(i.childNode=this.childCIdList.length,i.childNodesUdid=this.childCIdList.map((e=>e.cid))),i.childNode||(i.newRole,mi.normal),this.sendMeshBypassMessage(vi.statInfo,{info:i});break}}}_MeshControlleOptInfo(e,t){var i,r;let s=(0,j.CH)(t);const o={command:Zt.MESH_CONTROL_IFNO,type:e,info:s},a=null===(i=this.netThread)||void 0===i?void 0:i.getWorker(),n=null===(r=this.meshThread)||void 0===r?void 0:r.getWorker();null==a||a.postMessage(o),null==n||n.postMessage(o)}updateDevicePoints(){let e=this.maxLoad-this.childCIdList.length-this.badNetChild;if(this.enableAllowTalk||!this.selfAllowTalk||(e=-1),e!=this.reportLoad){this.reportLoad=e;const t=this.enableAllowTalk||!this.selfAllowTalk;this.sendMeshBypassMessage(vi.updateNodeStatus,{points:t?this.points:0,curLoad:this.childCIdList.length,freeLoad:e,availablePeer:this.availablePeerlist.size})}}kickChild(e){this.sendMeshBypassMessage(vi.kickChild,{childCid:e})}onChildLeave(e){this.monitorLog("MESHCHILDLEAVE"),this.updateDevicePoints();let t=this.childCIdList.findIndex((t=>t.cid==e));if(-1!=t){const{cid:e,peerId:i}=this.childCIdList[t],r=this.pcMap.get(i);null==r||r.close(),r&&this._onChildDisConnect(e,i)}0==this.childCIdList.length&&this.role==mi.parent&&this.tryOtherSid(!1,18e4)}onDestroy(){this.monitorLog("MESHDESTORY"),this.netThread=null,this.isdestory=!0,this.role==mi.child&&this.sendMeshBypassMessage(vi.leaveParent),this._resolvePromise(!1);try{Array.from(this.pcMap.keys()).forEach((e=>{let t=this.pcMap.get(e);t.onopen=()=>{},t.onclose=()=>{},null==t||t.close(),this.pcMap.delete(e)}))}catch(e){c.Ay.error("mesh destory error",e)}}closeMeshPc(){this.parentCid=null;try{this.parentCid=null,Array.from(this.pcMap.keys()).forEach((e=>{let t=this.pcMap.get(e);"mesh"==t.label&&(this.pcMap.delete(e),t.onopen=()=>{},t.onclose=()=>{},null==t||t.close())}))}catch(e){c.Ay.error("mesh destory error",e)}}testExitChild(){this.notifyDecodeRoleChange(mi.normal);let e=this.pcMap.keys();Array.from(e).forEach((e=>{let t=this.pcMap.get(e);null==t||t.close(),this.pcMap.delete(e)}))}setWorkerThread(e){return Vi(this,void 0,void 0,(function*(){this.workers=e;try{const{net:e,mesh:t,audio:i,video:r}=this.workers||{};if(e&&(yield e.ready(),this.netThread=e),this.audioWorker=i,this.videoWorker=r,t&&!this.meshThread&&this.initrole==mi.parent){if(yield t.init(),yield t.ready(),!t.getWorker())return void this._resolvePromise(!1);this.meshThread=t}if(this.isDestory())return;this.changeRole(this.role),t.onmessage=this._onMeshThread.bind(this),e.onmessage=this._onNetThread.bind(this),this._resolvePromise(!0)}catch(e){this._resolvePromise(!1),c.Ay.error("mesh init error",e)}}))}changeRole(e){return Vi(this,void 0,void 0,(function*(){var t;this.monitorLog("MESHSETROLE:".concat(e));const i=this.role==mi.normal||this.role==mi.invalid;this.role==e||i||(this.notifyDecodeRoleChange(mi.normal),this.closeMeshPc()),this.role=e,yield this.ready;const r={command:Zt.SET_MESH_ROLE,data:e},s=null===(t=this.meshThread)||void 0===t?void 0:t.getWorker();null==s||s.postMessage(r)}))}allowTalk(e){var t,i;const{allow:r,isSelf:s}=e;this.monitorLog("ALLOWTALK:".concat(r,",").concat(s)),s&&(this.selfAllowTalk=r);const o={command:Zt.MESH_ALLOW_TALK,allow:r,isSelf:s},{net:a}=this.workers||{};null===(t=null==a?void 0:a.getWorker())||void 0===t||t.postMessage(o),null===(i=this.audioWorker)||void 0===i||i.postMessage(o),this.setSignature(!0,!1,!1),this.selfAllowTalk&&!this.enableAllowTalk&&(this.notifyDecodeRoleChange(mi.normal),this.closeMeshPc())}connect(e){return Vi(this,void 0,void 0,(function*(){if(!this.enableAllowTalk&&this.selfAllowTalk)return;if(this.parentCid)return;let t=e.filter((e=>{let{cid:t,freeLoad:i}=e;return!this.isBadParent(t)&&i>0}));Di()(t).call(t,((e,t)=>t.match===e.match?t.freeLoad-e.freeLoad:t.match-e.match));const i=t.slice(0,3).map((e=>e.cid));if(this.parentCid||0==i.length&&this.inRefreshing())return;if(0==i.length){const e=this.isInSid();return e&&this.addTestFailedNode(this.sid,"",!1),void(e&&this.tryOtherSid(!0,3e5))}this.preParentCiud=this.parentCid,this.parentCid=i[0];const r=this.parentCid;setTimeout((()=>Vi(this,void 0,void 0,(function*(){const{net:e}=this.workers,t=null==e?void 0:e.getWorker(),i={command:Zt.MESH_CREATE_MESHRTC};null==t||t.postMessage(i);let s=yield this._connect(r);if(!s)return;this.connectdcount++,s.onopen=e=>Vi(this,void 0,void 0,(function*(){this.childconnectedlasted=performance.now(),(0,O.uB)(s.channel);let e=!0;e=yield this.prodeRTT();const t=this.pcMap.has(s.peerId);if(this.monitorLog("MESHJOIN:".concat(e&&t)),!e||!t)return setTimeout((()=>{s.close()}),0),this.parentCid="",void this.monitorLog("MESHCLOSE:".concat(e,"|").concat(t));this.sendMeshBypassMessage(vi.joinSuccess,{parentCid:r})})),s.onclose=e=>{this.pcMap.delete(s.peerId);const t=this.parentCid==r;if(t&&(this.monitorLog("MESHLEAVE"),this.notifyDecodeRoleChange(mi.normal),this.sendMeshBypassMessage(vi.leaveParent,{parentCid:r})),this.parentCid=null,(0,O.np)(s.channel),!t)return void this.addBadParent(r);let i=performance.now();i<=this.childconnectedlasted+15e3?this.addBadParent(r):i-this.childconnectedlasted>3e5?this.connectdcount=0:this.connectdcount=1},(yield s.ready)||this.addBadParent(r);let o=yield s.getStatus();this.monitorLog("MESHCANDIDATE:".concat(o))}))),5e3*this.connectdcount)}))}_connect(e){return Vi(this,void 0,void 0,(function*(){var t;if(!(yield this.ready)||this.isDestory())return null;const i="".concat(null===(t=this.cid)||void 0===t?void 0:t.slice(0,7),"-mesh-").concat(Date.now()),{net:r}=this.workers,s=this.stunServers,o={peerId:i,label:"mesh",signal:(t,i)=>{i.nodeid=this.nodeid,this.sendBridgeMessage(e,i)},timeout:Ni,stunServers:s,runthread:r},a=Oi.create(o);return this.pcMap.set(i,a),a}))}onParentLeave(){this.monitorLog("MESHPARENLEAVE"),this.role==mi.child&&(this.notifyDecodeRoleChange(mi.normal),this.tryOtherSid(!1,18e4))}_onChildConnect(e,t,i){var r;const s={command:Zt.MESH_CHILD_OPT,opt:"add",cid:e,nodeid:t,peerId:i},o=null===(r=this.meshThread)||void 0===r?void 0:r.getWorker();null==o||o.postMessage(s),this.childCIdList.push({cid:e,peerId:i})}_onChildDisConnect(e,t){var i;let r=this.childCIdList.findIndex((t=>t.cid==e));if(-1!=r){this.childCIdList.splice(r,1);const s={command:Zt.MESH_CHILD_OPT,opt:"remove",cid:e,nodeid:1,peerId:t},o=null===(i=this.meshThread)||void 0===i?void 0:i.getWorker();null==o||o.postMessage(s),0==this.childCIdList.length&&this.notifyDecodeRoleChange(mi.normal),this.kickChild(e),this.monitorLog("MESHCHILDNUM:".concat(this.childCIdList.length))}}notifyDecodeRoleChange(e){var t,i,r;const s={command:Zt.SET_MESH_ROLE,data:e},o=null===(t=this.netThread)||void 0===t?void 0:t.getWorker();null==o||o.postMessage(s),null===(i=this.audioWorker)||void 0===i||i.postMessage(s),null===(r=this.videoWorker)||void 0===r||r.postMessage(s),e==mi.child&&this.setSignature()}joinSuccessConfirm(e){const{confirm:t,childCid:i,parentCid:r}=e;if(this.monitorLog("MESHJOINCONFIRM:".concat(t)),!t)return;if(this.role==mi.child&&r==this.parentCid)return void this.notifyDecodeRoleChange(this.role);const s=this.childCIdList.findIndex((e=>e.cid==i));this.role==mi.parent&&-1!=s&&(this.notifyDecodeRoleChange(mi.parent),this.monitorLog("MESHCHILDNUM:".concat(this.childCIdList.length)))}prodeRTT(){return Vi(this,void 0,void 0,(function*(){const{net:e}=this.workers;this.rttProde=new Li(e.getWorker());const t=yield this.rttProde.start();return-1!=t&&t<=100}))}setSignature(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const{type:r,meetinguuid:s,mmrsigkey:o}=this.signatureInfo,{video:a,audio:n,share:d}=this.workers;if(this.role!=mi.child)return;if(0!=r&&!s)return;if(2==r&&!o)return;this.monitorLog("MESHSIGNINFO:".concat(r,":").concat(null==o?void 0:o.length,":").concat(null==s?void 0:s.length));const c=Object.assign({command:Zt.MESH_SIGN_INFO},this.signatureInfo);t&&(null==a||a.postMessage(Object.assign({appid:3},c))),i&&(null==d||d.postMessage(Object.assign({appid:2},c))),e&&(null==n||n.postMessage(Object.assign({appid:1},c)))}}const Bi={type:0,meetinguuid:null,mmrsigkey:null};class Fi{static createAgent(e,t,i,r){const s={cid:t,nodeid:i,role:e,initrole:Fi.role,initpoints:Fi.initpoints,stunServers:(null==r?void 0:r.map((e=>({urls:e}))))||[],signatureInfo:this.signatureInfo,initnodes:this.initnodes,enableAllowTalk:this.enableAllowTalk};this.meshAgent=new Ui(s)}static setInitRole(e,t,i,r,s){Fi.role=e,Fi.initpoints=t,Fi.sdkId=i,Fi.initnodes=r,Fi.enableAllowTalk=s}static reportInitPoints(){const e=Fi.role,t=Fi.initpoints;d.A.sendMessageToRwg(n.yJV,{evt:4366,seq:1,body:{type:fi.MeshControl,data:{cmdType:vi.updateNodeStatus,points:t,curLoad:0,freeLoad:e==mi.parent?3:0}}})}static registerMeshNote(e){d.A.sendMessageToRwg(n.yJV,{evt:4366,seq:1,body:{type:fi.MeshControl,data:{cmdType:vi.registerMeshNode,allowMedia:e}}})}static mediaAccessStatus(e){d.A.sendMessageToRwg(n.yJV,{evt:4366,seq:1,body:{type:fi.MeshControl,data:{cmdType:vi.mediaAccess,allowMedia:e}}}),this.meshAgent&&e&&this.meshAgent.mediaAccessChange(e)}static getAgent(){return this.meshAgent}static destroy(){this.role=mi.invalid,this.signatureInfo=Object.assign({},Bi),this.meshAgent&&this.meshAgent.onDestroy(),this.meshAgent=null}}Fi.role=mi.invalid,Fi.initpoints=0,Fi.initnodes=0,Fi.sdkId=0,Fi.enableAllowTalk=!1,Fi.haslicense=!0,Fi.signatureInfo=Object.assign({},Bi);var Hi=i(7355),Gi=i(8516),ji=i(1265),Ki=i.n(ji);function zi(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,r)}return i}function qi(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?zi(Object(i),!0).forEach((function(t){(0,v.A)(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):zi(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}class Yi{static checkCaptureNeedDeviceFallback(e,t){return!(!a.Ay.isMobileForceAutoChooseAudioDeviceEnable()||!e||!e.audioSource||"NotAllowedError"!=t.name||"No AVAudioSessionCaptureDevice device"!=t.message||(e.audioSource=null,0))}static draftAudioConstraints(e){var t,i,r;let s=e.audioCapture?{audioSource:e.audioCapture?e.audioCapture.AudioSelectValue:null,enableOriginalSound:"originalSound"===(null===(t=e.audioCapture)||void 0===t||null===(t=t.audioProfile)||void 0===t?void 0:t.currentSelect),enableStereo:"originalSound"===(null===(i=e.audioCapture)||void 0===i||null===(i=i.audioProfile)||void 0===i?void 0:i.currentSelect)&&(null===(r=e.audioCapture)||void 0===r||null===(r=r.audioProfile)||void 0===r||null===(r=r.originalSound)||void 0===r?void 0:r.stereo),isSupportBrowserAec:e.isSupportBrowserAec,disableAudioAGC:e.disableAudioAGC,disableNoiseSuppression:e.disableNoiseSuppression,retry:e.audioCapture.retry}:null,o=this.checkForceChangeMicDeviceIdRequired();return o&&(s||(s={}),s.audioSource=o.deviceId),s}static checkForceChangeMicDeviceIdRequired(){if(!a.Ay.isMobileForceAutoChooseAudioDeviceEnable())return null;if(a.Ay.isIphoneOrIpadBrowser()){const e=Ce.A.getDeviceListFromCache().filter((e=>"audioinput"==e.kind));return e.length>1?{deviceId:e.filter((e=>!e.label.match(/iPhone/))).pop().deviceId}:{deviceId:void 0}}if(a.Ay.isAndroidBrowser()){const e=Ce.A.getMicDeviceIdByLabel("Wired headset"),t=Ce.A.getMicDeviceIdByLabel("USB audio"),i=Ce.A.getMicDeviceIdByLabel("Bluetooth headset");return e?{deviceId:e}:t?{deviceId:t}:i?{deviceId:i}:{deviceId:void 0}}return null}static isMobileNeedRecaptureAfterDeviceChange(e,t,i){if(a.Ay.isMobileForceAutoChooseAudioDeviceEnable()){if(a.Ay.isAndroidBrowser()&&Ce.A.isDeviceChanged(t.filter((e=>"audioinput"==e.kind)),i.filter((e=>"audioinput"==e.kind))))return{result:!0,reason:"android recapture"};if(a.Ay.isIphoneOrIpadBrowser()){if(!this.isCaptureHealthy(e.getMediaStreamController()))return{result:!0,reason:"capture not healthy"};if(t.filter((e=>"audioinput"==e.kind&&""==e.label)).length)return{result:!0,reason:"permission grant"};if(t.filter((e=>"audioinput"==e.kind)).length>i.filter((e=>"audioinput"==e.kind)).length)return{result:!0,reason:"device disconnect"}}}return{result:!1}}static isCaptureHealthy(e){let t=e.getAudioStream();if(t){let e=t.getAudioTracks();if(e.length&&"live"==e[0].readyState&&0==e[0].muted)return!0}return!1}static async isSelectedDeviceExistAsync(){let e=!1;return(await Ce.A.getDeviceListAsync()).forEach((t=>{var i;"audioinput"==t.kind&&(null===(i=t.label)||void 0===i||null===(i=i.replace(/\(\w+:\w+\)|,/gi,""))||void 0===i?void 0:Ki()(i).call(i))==Ce.A.getMicLabel()&&t.deviceId==Ce.A.getMicId()&&(e=!0)})),e}static async captureFromEarpiece(e){if(a.Ay.isMobileForceAutoChooseAudioDeviceEnable()&&a.Ay.isAndroidForceEarpiceCaptureEnable()&&a.Ay.isAndroidBrowser()&&a.Ay.browser.isChromeOrEdge&&!Ce.A.isPreviewMode){const i=Ce.A.getMicDeviceIdByLabel("Headset earpiece");if(i&&null!==Ce.A&&void 0!==Ce.A&&Ce.A.onlyHasBInDeviceOnAndroid()){var t;c.Ay.directReport("force capture audio from headset earpiece on Android");let r=await x.A.getUserMedia(qi(qi({},e),{},{audio:qi(qi({},e.audio),{},{deviceId:i})}));null===(t=r)||void 0===t||t.getAudioTracks().forEach((e=>{e.stop()})),r=null}}}static async captureAudioStreamWithRetry(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];try{return await Yi.captureFromEarpiece(e),await x.A.getUserMedia(e)}catch(r){if("OverconstrainedError"!==r.name||!i)return Promise.reject(r);try{const t=await x.A.getUserMedia(qi(qi({},e),{},{audio:{deviceId:e.audio.deviceId}}));return c.Ay.directReport("capture audio stream successfully after remove 3A constraints"),t}catch(i){if("OverconstrainedError"!==i.name||t)return Promise.reject(i);try{const t=await x.A.getUserMedia(qi(qi({},e),{},{audio:!0}));return c.Ay.directReport("capture audio stream successfully after remove all audio constraints"),t}catch(e){return Promise.reject(e)}}}}}async function Xi(e,t){let i=e;if(i.audioCapture&&t){!async function(e,t,i){e.enableHID&&(e.hidAvalible&&(await me.destroy(),e.hidAvalible=!1),t&&(e.hidAvalible=await me.init(t,i)))}(i,t.microphoneLabel,t.defaultMuted),i.getMediaStreamController().destoryAudioMediaStream(),l.Notify_Audio_Encode_Thread({command:Zt.START_AUDIO_CAPTURE,value:!1});try{i.isCaputureNodeConnect=!1,d.A.ComputerAudioStatus=E.BX.ComputerAudio_Connecting,t.audioProfile=i.audioCapture.audioProfile,i.audioCapture=t,i.audioCtx&&i.audioCtx.sampleRate!=i.sampleRate&&(i.sampleRate=i.audioCtx.sampleRate,l.Modify_Audio_SampleRate(i.sampleRate)),i.Start_Audio_Capture(),l.Reset_Aec(),i.audioMicSetErrorCnt=0}catch(e){i.notifyUISetMicError({currentMic:Ce.A.getMicId(),reason:"".concat(e.message)}),i.JsMediaSDK_Log(e)}}}let Qi=null;function Ji(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=Ce.A.getMicDeviceIdByLabel(t);if(null==r)return c.Ay.log("[Audio] track label changed, but device not found, later check, old:"+e+", new: "+t),i<=5?(clearTimeout(Qi),void(Qi=setTimeout((()=>{Ji(e,t,++i)}),1e3))):c.Ay.error("[Audio] track label changed, but device not found exceed 5 secs old:"+e+", new: "+t);c.Ay.log("[Audio] iOS/iPadOS track label change detected old:"+e+", new: "+t),Ce.A.reportUsingMicDevice(r,t,0,!0),d.A.Notify_APPUI(n.Ubu,{microphoneDeviceId:r,isPassive:!0})}var $i;!function(e){e.INIT_PROCESSOR="__init_zoom_audio_processor__",e.UNINIT_PROCESSOR="__uninit_zoom_audio_processor__"}($i||($i={}));class Zi{static get audioProcessorCtx(){return this._audioProcessorCtx||(this._audioProcessorCtx=new AudioContext),this._audioProcessorCtx}static resumeCtx(){"suspended"===Zi.audioProcessorCtx.state&&Zi.audioProcessorCtx.resume().catch((e=>{c.Ay.error("audioProcessorCtx resume fail",e)}))}static hasProcessor(){return this.activeProcessorList.length>0}static getStream(){return this.processedStream}static setStream(e){this.stream=e,this.audioWorkletNodeMap.size>0&&this.updateProcessedStream()}static removeStream(){this.stream=null,this.processedStream=null}static cleanNodes(){this.newInputNode&&(this.newInputNode.disconnect(),this.newInputNode=null),this.newDestNode&&(this.newDestNode.disconnect(),this.newDestNode=null),this.activeProcessorList.forEach((e=>{const t=this.audioWorkletNodeMap.get(e);t&&t.disconnect()}))}static updateProcessedStream(){this.stream?(this.cleanNodes(),this.resumeCtx(),this.newInputNode=this.audioProcessorCtx.createMediaStreamSource(this.stream),this.newDestNode=this.audioProcessorCtx.createMediaStreamDestination(),this.activeProcessorList.reduce(((e,t)=>{const i=this.audioWorkletNodeMap.get(t);return i?e.connect(i):e}),this.newInputNode).connect(this.newDestNode),this.processedStream=this.newDestNode.stream):(this.cleanNodes(),this.processedStream=null,this.audioProcessorCtx.suspend())}static addProcessor(e,t){t.port.start(),this.audioWorkletNodeMap.set(e,t)}static startProcessor(e){var t;null===(t=this.audioWorkletNodeMap.get(e))||void 0===t||t.port.postMessage({cmd:$i.INIT_PROCESSOR,processorName:e}),this.activeProcessorList.push(e),this.updateProcessedStream()}static stopProcessor(e){var t;null===(t=this.audioWorkletNodeMap.get(e))||void 0===t||t.port.postMessage({cmd:$i.UNINIT_PROCESSOR,processorName:e}),this.activeProcessorList=this.activeProcessorList.filter((t=>t!==e)),this.updateProcessedStream()}static resetProcessorManager(){for(const[e,t]of this.audioWorkletNodeMap.entries())this.activeProcessorList.includes(e)&&this.stopProcessor(e),t&&(t.disconnect(),t.port.close());this.removeStream(),this.activeProcessorList=[]}}Zi._audioProcessorCtx=null,Zi.stream=null,Zi.processedStream=null,Zi.audioWorkletNodeMap=new Map,Zi.activeProcessorList=[];var er=i(4666);class tr{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3e3;if(!e)throw new Error("audioTrack is required");this.track=e,this.interval=t,this._callback=null,this._lastLabel=e.label,this._timer=null,this._stopped=!1,this.track.addEventListener("ended",this._handleTrackEnded.bind(this)),this.start()}onChange(e){this._callback=e}start(){this._timer||this._stopped||this._tick()}stop(){this._timer&&(clearTimeout(this._timer),this._timer=null)}destroy(){this.stop(),this.track&&this.track.removeEventListener("ended",this._handleTrackEnded.bind(this)),this.track=null,this._callback=null,this._lastLabel="",this._stopped=!0}_tick(){if(this._stopped||!this.track)return;const e=this.track.label;e!==this._lastLabel&&("function"==typeof this._callback&&this._callback(this._lastLabel,e),this._lastLabel=e),this._timer=setTimeout((()=>this._tick()),this.interval)}_handleTrackEnded(){this.destroy()}}class ir{constructor(e,t,i,r){this.resolvefn=()=>{},this.name=e,this.promise=new Promise(((e,t)=>{this.resolvefn=e})),this.isSafar=t,this.listenerfn=this._listener.bind(this),this.workerErrListener=this._workerError.bind(this),this.supportTransferRTC=!1,this.worker=null,this.useTransferRTC=!0,this.channels=[],this.wasmUrl=r,this.pathUrl=i,this.monitorFunc=()=>{},this.onmessage=e=>{}}_workerError(e){var t;if(null!==(t=e.message)&&void 0!==t&&t.includes("RuntimeError:")){const t=e.target;this.monitorFunc("".concat(this.name,"WORKERERR")),c.Ay.error("worker error",e),t==this.worker&&this._reinit()}}_listener(e){const t=e.data,{status:i,data:r,cmd:s}=e.data;switch(i){case F.Yx:this.supportTransferRTC=r;break;case F.wQ:(0,l.downloadWASMAndPostToWorker)(t.url,this.worker,this.name);break;case F.hz:{this.monitorFunc("".concat(this.name,"READY")),this.resolvefn&&this.resolvefn(!0),this.resolvefn=null;var o=this.useTransferRTC;this.worker.postMessage({command:Zt.INIT_THREAD,useTransferRTC:o,isSafar:this.isSafar});const e=this.name;let t=V.m3.dataTransportMgr,i=!1;null!=t&&t.refs&&e in t.refs&&((0,O.L)(e),i=!0),(0,O.Eg)(this.worker,this.name),(0,N.CV)(this.worker,this.name),i&&(c.Ay.error("net worker type ".concat(e," has exited")),this.monitorFunc("".concat(e,"REPLACE")));break}case F.Gg:this.resolvefn&&this.resolvefn(!1),this.resolvefn=null,this.monitorFunc("".concat(this.name,"FAILED"));break;case F.ef:case F.Bi:this.monitorFunc(r)}this.channels.forEach((t=>{t.mesagelistener(e)})),this.onmessage(e)}_reinit(){this.close(),this.promise=new Promise(((e,t)=>{this.resolvefn=e})),this.init()}setMonitorLog(e){this.monitorFunc=e}setPathAnsWasm(e,t){this.pathUrl=e,this.wasmUrl=t}async init(){if(this.thread||!this.resolvefn)return!1;const e={workerJsFileUrl:this.pathUrl,workerWasmFileUrl:this.wasmUrl};this.thread=(0,l.CreateThreadWorker)(this.name,e),this.worker=await this.thread.create(),this.worker&&null!=this.resolvefn&&(this.worker.addEventListener("message",this.listenerfn),this.worker.addEventListener("error",this.workerErrListener))}setUseTransferRTC(e){const t=!!this.useTransferRTC;this.useTransferRTC=e;const i=this.useTransferRTC,r=this.isSafar,s={command:Zt.INIT_THREAD,useTransferRTC:i,isSafar:r};this.worker&&null==this.resolvefn&&this.worker.postMessage(s),t&&t!=!!e&&c.Ay.directReport("transferdatachannel supported false")}isSupportTransferRTC(){return this.supportTransferRTC}close(){(0,O.L)(this.name),(0,N.vJ)(this.name),this.resolvefn&&this.resolvefn(!1),this.resolvefn=null;let e=this.thread;this.thread=null;let t=this.worker;this.worker=null;let i=this.channels;this.channels=[],t&&(t.removeEventListener("message",this.listenerfn),t.removeEventListener("error",this.workerErrListener));try{i.forEach((e=>{e.close()}))}catch(e){console.error("close channel error",e)}null==e||e.destroy()}getWorker(){return this.worker}isUseTransferRTC(){return this.useTransferRTC&&this.supportTransferRTC}async ready(){return!!this.promise&&await this.promise}addRTCChannel(e){-1==this.channels.indexOf(e)&&this.channels.push(e)}removeRTCChannel(e){let t=this.channels.indexOf(e);-1!=t&&this.channels.splice(t,1)}}class rr{constructor(){this._handlers={}}on(e,t){this._handlers[e]||(this._handlers[e]=new Set),this._handlers[e].add(t)}once(e,t){var i=this;const r=function(){return i.off(e,r),t(...arguments)};this.on(e,r)}off(e,t){var i;null===(i=this._handlers[e])||void 0===i||i.delete(t)}emit(e){const t=this._handlers[e];if(t){for(var i=arguments.length,r=new Array(i>1?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];for(const e of t)try{e(...r)}catch(e){}}}}const sr=new class extends rr{constructor(){super(...arguments),this._consumedSsrcs=new Map,this._localVideoSsrc=-1,this._activeSpeakerSsrc=-1}getSsrcKind(e,t){if(e===P.$K)return"active-speaker";switch(t){case"vb":return"local";case"sharing":return"sharing";case"normal":return sr.isLocalVideoSsrc(e)?"local":"remote";default:(0,Te.Yu)("Invalid render mode")}}getLogicalSSrc(e){return e===P.$K?P.$K:e>>10<<10}consumeSsrc(e){if(-1===e)return;e=this.getLogicalSSrc(e);let t=this._consumedSsrcs.get(e);t?(t+=1,this._consumedSsrcs.set(e,t)):this._consumedSsrcs.set(e,1)}unconsumeSsrc(e){if(-1===e)return;if(e=this.getLogicalSSrc(e),!this._consumedSsrcs.has(e))return;let t=this._consumedSsrcs.get(e);if(t&&t>1)return t-=1,void this._consumedSsrcs.set(e,t);this._consumedSsrcs.delete(e)}ssrcEquals(e,t){return this.getLogicalSSrc(e)===this.getLogicalSSrc(t)}_inConsumedSsrcs(e){return this._consumedSsrcs.has(this.getLogicalSSrc(e))}isConsumedSsrc(e){return-1!==e&&(!!this._inConsumedSsrcs(e)||!(!this.isActiveSeakerSsrc(e)||!this._inConsumedSsrcs(P.$K))||this.isLocalVideoSsrc(e))}getActiveSpeakerSsrc(){return this._activeSpeakerSsrc}setActiveSpeakerSsrc(e){e!==this._activeSpeakerSsrc&&this.emit("activeSpeakerSsrcChange",e),this._activeSpeakerSsrc=e}isActiveSeakerSsrc(e){return-1!==e&&-1!==this._activeSpeakerSsrc&&(e===P.$K||this.ssrcEquals(e,this._activeSpeakerSsrc))}getLocalVideoSsrc(){return this._localVideoSsrc}setLocalVideoSsrc(e){this._localVideoSsrc=e}isLocalVideoSsrc(e){return-1!==e&&-1!==this._localVideoSsrc&&(e===P.$K&&(e=this._activeSpeakerSsrc),this.ssrcEquals(e,this._localVideoSsrc))}hasRemoteSsrc(){return 0!=this._consumedSsrcs.size&&(1!=this._consumedSsrcs.size||!(this._inConsumedSsrcs(0)||this._inConsumedSsrcs(this._localVideoSsrc)||this._inConsumedSsrcs(P.$K)&&this.isActiveSeakerSsrc(this._localVideoSsrc)))}};var or=i(3021);class ar extends rr{constructor(){super(...arguments),this._enabled=!0}get enabled(){return this._enabled}set enabled(e){this._enabled=e}}class nr extends ar{constructor(e){super(),this._renderTarget=null,this._setCursorCanvas=e}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,e?this._setCursorCanvas(this._renderTarget.transferControlToOffscreen()):this._setCursorCanvas(null)}updateCursorPosition(e){this.enabled&&this.emit("cursorMove",e)}}class dr extends ar{updateVideoRotation(e){this.enabled&&this.emit("videoRotationChange",e)}updateVideoMirrorState(e){this.enabled&&this.emit("videoMirrorChange",e)}updateVideoSize(e,t){this.enabled&&this.emit("videoSizeChange",e,t)}}class cr{constructor(e,t){this._lastProcessor=null,this._streamMode=(0,it.B)().config.getAVStreamMode(),this._kind=e,this._source=t,this._lastProcessor=null,this._pipeResult=new Promise(((e,t)=>{this._resolvePipeResult=e,this._rejectPipeResult=t}))}close(){this._source.remotePeerProxy.close()}_createTrackGenerator(){return"video"===this._kind?new MediaStreamTrackGenerator({kind:"video"}):"audio"===this._kind?new MediaStreamTrackGenerator({kind:"audio"}):void(0,Te.Yu)()}_linkTo(e){if("writable-stream"===this._streamMode){const t=this._lastProcessor?this._lastProcessor:this._source,i=this._createTrackGenerator(),r=new MediaStreamTrackProcessor({track:i}).readable,s=i.writable;t.remotePeerProxy.provideOutputStream(t.transfer(s)).then((e=>{this._rejectPipeResult(e)})),e.remotePeerProxy.provideInputStream(e.transfer(r)).then((e=>{this._rejectPipeResult(e)}))}else(this._lastProcessor?this._lastProcessor:this._source).remotePeerProxy.accquireOutputTrack().then((t=>{e.remotePeerProxy.provideInputTrack(e.transfer(t))})).catch((e=>{this._rejectPipeResult(e)}))}pipeThough(e){return this._linkTo(e),this._lastProcessor=e,this}pipeTo(e){return this._linkTo(e),this._pipeResult}pipeToMediaStream(e){const t=this._lastProcessor?this._lastProcessor:this._source;if("writable-stream"===this._streamMode){let i=this._createTrackGenerator();e.addTrack(i);const r=new MediaStreamTrackEvent("addtrackEx",{track:i});e.dispatchEvent(r),i.addEventListener("ended",(()=>{e.removeTrack(i),this._resolvePipeResult()})),t.remotePeerProxy.provideOutputStream(t.transfer(i.writable)).catch((e=>{this._rejectPipeResult(e)}))}else t.remotePeerProxy.accquireOutputTrack().then((t=>{e.addTrack(t);const i=new MediaStreamTrackEvent("addtrackEx",{track:t});e.dispatchEvent(i),t.addEventListener("ended",(()=>{e.removeTrack(t),this._resolvePipeResult()}))})).catch((e=>{this._rejectPipeResult(e)}));return this._pipeResult}}var lr=function(e,t,i,r){return new(i||(i=Promise))((function(s,o){function a(e){try{d(r.next(e))}catch(e){o(e)}}function n(e){try{d(r.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,n)}d((r=r.apply(e,t||[])).next())}))};class hr extends Error{constructor(e){super(e),this.name="SsrcStreamError"}}const ur=new Map,pr=new Map;class fr extends rr{constructor(e,t,i,r){let s,o;super(),this.mediaStream=new MediaStream,this.metaTrack=new dr,this._cursorTrack=null,this._status="idle",this._playPromise=null,this.ssrc=e,this.ssrcKind=t,this._desiredSize=i,this._readyPromise=new Promise(((e,t)=>{s=e,o=t})),this._impl=new gr({stream:this,setCursorTrack:e=>{(0,Te.vA)(null===this._cursorTrack),this._cursorTrack=e,this.emit("addCursorTrack",e)},onStreamStart:()=>{this.status="streaming",s()},onStreamError:e=>{this.status="error",o()}}),"sharing"===t?pr.set(sr.getLogicalSSrc(e),this._impl):ur.set(sr.getLogicalSSrc(e),this._impl),r&&(this.renderTarget=r.renderTarget,r.autoPlay&&this.play())}get desiredSize(){return this._desiredSize}get status(){return this._status}set status(e){const t=this._status;this._status=e,this.emit("statusChange",t,this._status)}get ready(){return this._readyPromise}get cursorTrack(){return this._cursorTrack}play(){switch(this._status){case"idle":return this.status="preparing",this._playPromise=this._impl.play(),this._readyPromise;case"preparing":case"streaming":return this._readyPromise;case"stopped":throw new hr("Stopped stream can not restart!");default:throw new hr("Errored stream can not restart!")}}_rejectStopped(){const e=Promise.reject("Stream has been stopped!");return e.catch((()=>{})),e}stop(){switch(this.metaTrack.enabled=!1,this.cursorTrack&&(this.cursorTrack.enabled=!1),this._status){case"idle":Promise.resolve().then((()=>{this.status="stopped",this._readyPromise=this._rejectStopped()}));break;case"preparing":case"streaming":"sharing"===this.ssrcKind?pr.delete(sr.getLogicalSSrc(this.ssrc)):ur.delete(sr.getLogicalSSrc(this.ssrc)),this._playPromise.finally((()=>{this._impl.stop().then((()=>{this.status="stopped",this._readyPromise=this._rejectStopped()})).catch((e=>{this.status="error"}))}))}}updateDesiredSize(e){this._desiredSize=e,this._impl.updateDesiredSize(e)}}const mr=new class{changeVideoWatermarkInfo(e){for(const t of ur.values())t.updateWatermarkInfo(e)}changeSharingWatermarkInfo(e){for(const t of pr.values())t.updateWatermarkInfo(e)}captureVideo(e){const t=(arguments.length>1&&void 0!==arguments[1]&&arguments[1]?pr:ur).get(sr.getLogicalSSrc(e));return null==t?void 0:t.captureVideo()}};class vr{constructor(e){this._context=e}get stream(){return this._context.stream}}class gr extends vr{constructor(){super(...arguments),this._lastWaterMarkInfo=null,this._localPipe=null,this._remotePipe=null,this._sharingPipe=null,this._currentPipe=null,this._cursorTrack=null,this._handleActiveSpeakerSsrcChange=null,this._started=!1,this._stopped=!1}get currentPipe(){return this._currentPipe}_selectService(e,t){if(0===e.length)return void(0,Te.Yu)("No ssrc stream service");let i=e.filter((e=>e.constraints.includes(t))).map((e=>e.serviceId));return i.length>0?((0,Te.vA)(1===i.length),i[0]):(i=e.filter((e=>e.constraints.includes("default"))).map((e=>e.serviceId)),(0,Te.vA)(1===i.length),i[0])}_shouldAddWatermark(){const e=(0,it.B)().config;return"sharing"===this._context.stream.ssrcKind?e.isSharingHasWaterMark():e.isVideoHasWaterMark()}_createStreamServicePipe(e,t,i){return lr(this,void 0,void 0,(function*(){const r=this._context.stream,s=yield or.D.acquireService("builtin/WasmSsrcStreamService",{serviceParams:{ssrc:e,ssrcKind:t,desiredSize:r.desiredSize},selectService:e=>this._selectService(e,t)}),o=new cr("video",s);let a=null;if(this._shouldAddWatermark()){const e=(0,it.B)().config,t="sharing"!==r.ssrcKind?e.getVideoWatermarkInfo():e.getSharingWatermarkInfo();a=yield or.D.acquireService("graphics/VideoRasterService",{serviceParams:{cssDisplaySize:r.desiredSize,options:{waterMarkInfo:t}}})}const n={streamingConnection:s,rasterConnection:a,avStreamPipe:o};return s.on("cursorMove",(e=>{null===this._cursorTrack&&(this._cursorTrack=new nr((e=>{const t=e?s.transfer(e):null;s.remotePeerProxy.setCursorCanvas(t)})),this._context.setCursorTrack(this._cursorTrack)),this._cursorTrack.updateCursorPosition(e)})),s.on("videoRotationChange",(e=>{if(a)n.lastRotationState="rot0",a.remotePeerProxy.updateVideoRotation(e);else{const t=e.isRotationInFrame?"rot0":e.rotationState;n.lastRotationState=t,i.choosed&&r.metaTrack.updateVideoRotation(t)}})),s.on("videoMirrorChange",(e=>{a?(n.lastMirrorState=!1,a.remotePeerProxy.updateVideoMirrorState(e)):(n.lastMirrorState=e,i.choosed&&r.metaTrack.updateVideoMirrorState(e))})),a?a.on("videoSizeChange",((e,t)=>{n.lastVideoSize={width:e,height:t},i.choosed&&r.metaTrack.updateVideoSize(e,t)})):s.on("videoSizeChange",((e,t)=>{n.lastVideoSize={width:e,height:t},i.choosed&&r.metaTrack.updateVideoSize(e,t)})),s.on("streamStart",(()=>{this._started||(this._context.onStreamStart(),this._started=!0)})),a&&o.pipeThough(a),n}))}_getPipeTrack(e){let t,i;const r=new Promise(((e,r)=>{t=e,i=r})),s=new MediaStream;return s.addEventListener("addtrackEx",(e=>{t(e.track)})),e.pipeToMediaStream(s).catch((e=>{i(e)})),r}_buildPipe(){return lr(this,void 0,void 0,(function*(){this._destroyPipe();const e=this._context.stream;for(const t of e.mediaStream.getVideoTracks())e.mediaStream.removeTrack(t);if(e.ssrc!==P.$K){const t=yield this._createStreamServicePipe(e.ssrc,e.ssrcKind,{choosed:!0});switch(t.avStreamPipe.pipeToMediaStream(this._context.stream.mediaStream).catch((()=>{})),e.ssrcKind){case"local":this._localPipe=t;break;case"remote":this._remotePipe=t;break;case"sharing":this._sharingPipe=t;break;default:(0,Te.Yu)()}this._currentPipe=t}else{const t={choosed:!1},i=this._createStreamServicePipe(P.$K,"local",t),r={choosed:!1},s=this._createStreamServicePipe(P.$K,"remote",r),[o,a]=yield Promise.all([i,s]),n=this._getPipeTrack(o.avStreamPipe),d=this._getPipeTrack(a.avStreamPipe),[c,l]=yield Promise.all([n,d]);let h;this._localPipe=o,this._remotePipe=a;const u=i=>{let s;sr.isLocalVideoSsrc(i)?"local"!==h&&(e.mediaStream.removeTrack(l),e.mediaStream.addTrack(c),h="local",r.choosed=!1,t.choosed=!0,s=o,this._currentPipe=o):"remote"!==h&&(e.mediaStream.removeTrack(c),e.mediaStream.addTrack(l),h="remote",t.choosed=!1,r.choosed=!0,s=a,this._currentPipe=a),s&&(void 0!==s.lastMirrorState&&e.metaTrack.updateVideoMirrorState(s.lastMirrorState),void 0!==s.lastRotationState&&e.metaTrack.updateVideoRotation(s.lastRotationState),void 0!==s.lastVideoSize&&e.metaTrack.updateVideoSize(s.lastVideoSize.width,s.lastVideoSize.height))};u(sr.getActiveSpeakerSsrc()),this._handleActiveSpeakerSsrcChange=u,sr.on("activeSpeakerSsrcChange",this._handleActiveSpeakerSsrcChange)}}))}play(){return lr(this,void 0,void 0,(function*(){(0,Te.vA)(!this._stopped,"Can not play stopped ssrc stream!"),yield this._buildPipe()}))}_destroyStreamServicePipe(e){e.avStreamPipe.close(),e.streamingConnection.close(),e.rasterConnection&&e.rasterConnection.close()}_destroyPipe(){this._localPipe&&(this._destroyStreamServicePipe(this._localPipe),this._localPipe=null),this._remotePipe&&(this._destroyStreamServicePipe(this._remotePipe),this._remotePipe=null),this._sharingPipe&&(this._destroyStreamServicePipe(this._sharingPipe),this._sharingPipe=null),this._currentPipe=null,this._handleActiveSpeakerSsrcChange&&(sr.off("activeSpeakerSsrcChange",this._handleActiveSpeakerSsrcChange),this._handleActiveSpeakerSsrcChange=null)}_rebuildPipe(){this._destroyPipe(),this._buildPipe()}stop(){return lr(this,void 0,void 0,(function*(){this._stopped=!0,this._destroyPipe(),this._cursorTrack=null}))}_updatePipeDesiredSize(e,t){e.streamingConnection.remotePeerProxy.updateDesiredSize(t),e.rasterConnection&&e.rasterConnection.remotePeerProxy.updateCssDisplaySize(t)}updateDesiredSize(e){this._localPipe&&this._updatePipeDesiredSize(this._localPipe,e),this._remotePipe&&this._updatePipeDesiredSize(this._remotePipe,e),this._sharingPipe&&this._updatePipeDesiredSize(this._sharingPipe,e)}updateWatermarkInfo(e){const t=this._lastWaterMarkInfo&&this._lastWaterMarkInfo.enable;if((e&&e.enable)!==t&&(this._rebuildPipe(),e.enable)){const e=this._context.stream;e.metaTrack.updateVideoMirrorState(!1),e.metaTrack.updateVideoRotation("rot0")}this._lastWaterMarkInfo=e,this._localPipe&&this._localPipe.rasterConnection&&this._localPipe.rasterConnection.remotePeerProxy.updateWatermarkInfo(e),this._remotePipe&&this._remotePipe.rasterConnection&&this._remotePipe.rasterConnection.remotePeerProxy.updateWatermarkInfo(e),this._sharingPipe&&this._sharingPipe.rasterConnection&&this._sharingPipe.rasterConnection.remotePeerProxy.updateWatermarkInfo(e)}captureVideo(){var e,t;const i=this.stream.renderTarget;if(i&&this.currentPipe)return{renderTarget:i,info:{mirror:null!==(e=this.currentPipe.lastMirrorState)&&void 0!==e&&e,rotation:null!==(t=this.currentPipe.lastRotationState)&&void 0!==t?t:"rot0"}}}}var _r=i(9470),Sr=i(9102),Ar=i(1223);class yr{constructor(e){this.maxfps=5,this.maxCapablity=1,this.videomodeCapablity=2,this.renderlist=[],this.sourcelist=[],this.currentcapablity=0,this.decodeSizeCallbackfn=e,this.timeoutid=0,this.maxSize=4}setMaxRenderSize(e){this.maxSize=e}setMaxCapablity(e){e<1&&(fp=1),e>30&&(e=30),this.maxfps=e}decodeCapability(e,t,i){i?this.videomodeCapablity=t:this.maxCapablity=t,this.evaluateDecodeSize()}evaluateDecodeSize(){let e=this.currentcapablity;if(1==this.renderlist.length){const{ssrc:t,ismain:i}=this.renderlist[0],r=this.sourcelist.find((e=>e.ssrc>>10==t>>10&&i==i));e=null!=r&&r.videomode?this.videomodeCapablity:this.maxCapablity}else this.renderlist.length>1&&(e=Math.min(Math.floor(this.maxfps/(5*this.renderlist.length)),this.maxCapablity));e!=this.currentcapablity&&(this.currentcapablity=e,this.decodeSizeCallbackfn(this.renderlist[0].ssrc,this.renderlist[0].ismain,e))}triggerEvaluate(){this.timeoutid||(this.timeoutid=setTimeout((()=>{this.timeoutid=0,this.evaluateDecodeSize()}),1e3))}addSource(e,t,i){let r=this.sourcelist.findIndex((i=>i.ssrc>>10==e>>10&&i.ismain==t));-1==r?this.sourcelist.push({ssrc:e,ismain:t,videomode:i}):this.sourcelist[r].videomode=i;const s=this.renderlist.find((i=>i.ssrc>>10==e>>10&&i.ismain==t));s&&(s.videomode=i)}rmSource(e,t){let i=this.sourcelist.findIndex((i=>i.ssrc>>10==e>>10&&i.ismain==t));-1!=i&&this.sourcelist.splice(i,1)}addRender(e,t,i){let r=this.renderlist.findIndex((r=>r.ssrc>>10==e>>10&&r.ismain==t&&r.zone==i));if(-1==r&&this.renderlist.length>=this.maxSize)throw new Error("current platform not support ".concat(this.maxSize," sharing render"));-1==r&&(this.renderlist.push({ssrc:e,ismain:t,zone:i}),this.triggerEvaluate())}rmRender(e,t,i){if(!e)return void(this.renderlist=[]);let r=this.renderlist.findIndex((r=>r.ssrc>>10==e>>10&&r.ismain==t&&r.zone==i));-1!=r&&(this.renderlist.splice(r,1),this.renderlist.length&&this.triggerEvaluate())}}class Cr{constructor(){this.status="pending",this.promise=new Promise(((e,t)=>{this.reject=e=>(this.status="rejected",t(e)),this.resolve=t=>(this.status="fullfilled",e(t))})),this.then=this.promise.then,this.catch=this.promise.catch}}var Er=function(e,t,i,r){return new(i||(i=Promise))((function(s,o){function a(e){try{d(r.next(e))}catch(e){o(e)}}function n(e){try{d(r.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,n)}d((r=r.apply(e,t||[])).next())}))};class br{constructor(e,t,i){this.processorName=e,this.port=t,this.config=i,this.frameCallback=null,this.callback=null,this._config=null,this.onMessage=e=>{var t,i,r,s;if(e.data.cmd===ui.FRAME_CALLBACK)if(this.frameCallback)this.frameCallback(e.data.frame);else if(this instanceof wr)if(this.getOutPutCanvas())null===(i=e.data.frame)||void 0===i||i.close();else{const i=e.data.frame;if(i instanceof VideoFrame){const r=i.displayWidth,s=i.displayHeight,o=this.getTargetGenerator();if(o instanceof Ei){const e=o.getStreamingCanvas();e.width!==r&&(e.width=r),e.height!==s&&(e.height=s);const t=e.getContext("2d");if(!t)return console.error("cannot get canvas context!"),void i.close();createImageBitmap(i).then((e=>{t.clearRect(0,0,r,s),t.drawImage(e,0,0,r,s),e.close(),i.close()})).catch((e=>{console.error("failed in rendering frame! e:",e),i.close()}))}else null===(t=e.data.frame)||void 0===t||t.close()}}else null===(r=e.data.frame)||void 0===r||r.close();else e.data.cmd===ui.PROCESSOR_STOP_COMPLETE?this instanceof wr&&this.resolveEndCompleteDeferred():null===(s=this.callback)||void 0===s||s.call(this,e.data.cmd,e.data.data)},this.port.start(),this.port.addEventListener("message",this.onMessage),this._config=i;const r=this.getOutPutCanvas();r?this.port.postMessage({cmd:ui.INIT_OUTPUT_CANVAS,canvas:r,processorName:e},[r]):this.port.postMessage({cmd:ui.INIT_OUTPUT_CANVAS,processorName:e})}init(){this.port.postMessage({cmd:ui.INIT_PROCESSOR,processorName:this.processorName})}addCallback(e){this.callback=e}removeCallback(){this.callback=null}uninit(){this.port.postMessage({cmd:ui.UNINIT_PROCESSOR,processorName:this.processorName}),this.port.removeEventListener("message",this.onMessage)}getOutPutCanvas(){return null}getConfig(){return this._config}getStream(){throw new Error("Method not implemented.")}setStream(e){throw new Error("Method not implemented.")}removeStream(){return Er(this,void 0,void 0,(function*(){}))}onFrame(e){throw new Error("Method not implemented.")}addFrameCallback(e){throw new Error("Method not implemented.")}removeFrameCallback(){}}class wr extends br{constructor(e,t,i){super(e,t,i),this.processorName=e,this.port=t,this.endCompleteDeferred=null,this.initGenerator()}initGenerator(){var e;const t=this.getConfig(),i=null!==(e=null==t?void 0:t.needFixedCaptureRate)&&void 0!==e?e:void 0;this.originGenerator||(this.originGenerator=!0===i?new yi(this.port,this.processorName,!1,!0):"function"==typeof MediaStreamTrackProcessor?new Si(this.port,this.processorName,!0):new yi(this.port,this.processorName,!1,!0)),this.targetGenerator||(this.targetGenerator=!0===i?new Ei(this.port,this.processorName,t):"function"==typeof MediaStreamTrackGenerator?new Ci(this.port,this.processorName):new Ei(this.port,this.processorName,t))}uninit(){var e,t,i,r;null===(t=null===(e=this.originGenerator)||void 0===e?void 0:e.destroy)||void 0===t||t.call(e),null===(r=null===(i=this.targetGenerator)||void 0===i?void 0:i.destroy)||void 0===r||r.call(i),super.uninit()}getOutPutCanvas(){var e,t;return this.initGenerator(),null===(t=(e=this.targetGenerator).getOutputCanvas)||void 0===t?void 0:t.call(e)}getStream(){return this.targetGenerator.getStream()}setStream(e){this.originGenerator.setStream(e)}removeStream(){return Er(this,void 0,void 0,(function*(){this.originGenerator.removeStream(),this.endCompleteDeferred||(this.endCompleteDeferred=new Cr),yield this.endCompleteDeferred.promise}))}resolveEndCompleteDeferred(){this.endCompleteDeferred&&this.endCompleteDeferred.resolve(),this.endCompleteDeferred=null}addFrameCallback(e){this.frameCallback=e}getTargetGenerator(){return this.targetGenerator}}var Rr=function(e,t,i,r){return new(i||(i=Promise))((function(s,o){function a(e){try{d(r.next(e))}catch(e){o(e)}}function n(e){try{d(r.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,n)}d((r=r.apply(e,t||[])).next())}))};class Tr{static hasProcessor(){return this.shareProcessorAgentMap.size>0}static isProcessorStarted(e){return this.shareProcessorAgentMap.has(e)}static setProcessorOptions(e,t){this.shareProcessorOptionsMap.set(e,t)}static getProcessorOptions(e){return this.shareProcessorOptionsMap.get(e)}static hasMediaStreamFrameProcessor(){return[...this.shareProcessorAgentMap.values()].some((e=>e instanceof wr))}static addFrameCallback(e,t){this.shareFrameCallbackMap.set(e,t),this.getProcessor(e)&&this.getProcessor(e).addFrameCallback(t)}static addCallback(e,t){this.shareCallbackMap.set(e,t),this.getProcessor(e)&&this.getProcessor(e).addCallback(t)}static getProcessor(e){return this.shareProcessorAgentMap.get(e)}static onFrame(e){for(const t of this.shareProcessorAgentMap.values())t.onFrame(e)}static getStream(){return[...this.shareProcessorAgentMap.values()].pop().getStream()}static setStream(e){for(const t of this.shareProcessorAgentMap.values())t.setStream(e)}static removeStream(){return Rr(this,void 0,void 0,(function*(){const e=[];for(const t of this.shareProcessorAgentMap.values())e.push(t.removeStream());yield Promise.all(e)}))}static startProcessor(e,t){t.init();const i=this.shareFrameCallbackMap.get(e);i&&t.addFrameCallback(i);const r=this.shareCallbackMap.get(e);r&&t.addCallback(r),this.shareProcessorAgentMap.set(e,t)}static stopProcessor(e){return Rr(this,void 0,void 0,(function*(){const t=this.getProcessor(e);t&&(t.removeFrameCallback(),t.removeCallback(),this.shareFrameCallbackMap.delete(e),this.shareCallbackMap.delete(e),this.shareProcessorOptionsMap.delete(e),yield t.removeStream(),t.uninit()),this.shareProcessorAgentMap.delete(e)}))}static resetProcessorManager(){for(const e of this.shareFrameCallbackMap.keys())this.stopProcessor(e)}}function Ir(e,t,i){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,i)}function Mr(e,t){return e.get(Pr(e,t))}function Dr(e,t,i){return e.set(Pr(e,t),i),i}function Pr(e,t,i){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}Tr.shareProcessorAgentMap=new Map,Tr.shareProcessorOptionsMap=new Map,Tr.shareFrameCallbackMap=new Map,Tr.shareCallbackMap=new Map;var kr=new WeakMap,Or=new WeakMap,Vr=new WeakMap,Nr=new WeakMap,xr=new WeakMap;const Lr=class{constructor(){Ir(this,kr,null),Ir(this,Or,null),Ir(this,Vr,null),Ir(this,Nr,null),Ir(this,xr,null)}bindRawStream(e){if(!e)throw new Error("ShareStreamScheduler setRawStream(): stream is null");Dr(Or,this,e)}bindShareProcessorStream(e){if(!e)throw new Error("ShareStreamScheduler setShareProcessorStream(): stream is null");Dr(Vr,this,e)}bindAnnotationStream(e){if(!e)throw new Error("ShareStreamScheduler setAnnotationStream(): stream is null");Dr(Nr,this,e)}getRawStream(){return Mr(Or,this)}getShareProcessorStream(){return Mr(Vr,this)}getAnnotationStream(){return Mr(Nr,this)}getCurrentStream(){return Mr(kr,this)}getAnnotationRawStream(){return Mr(xr,this)}switchToRawShareStream(){if(!Mr(Or,this))throw new Error("ShareStreamScheduler switchToRawShareStream(): rawStream is not set");Dr(kr,this,Mr(Or,this)),Dr(xr,this,Mr(Or,this))}switchToShareProcessorStream(){if(!Mr(Vr,this))throw new Error("ShareStreamScheduler switchToShareProcessorStream(): shareProcessorStream is not set");Dr(kr,this,Mr(Vr,this)),Dr(xr,this,Mr(Vr,this))}switchToAnnotationStream(){if(!Mr(Nr,this))throw new Error("ShareStreamScheduler switchToAnnotationStream(): annotationStream is not set");Dr(xr,this,Mr(kr,this)),Dr(kr,this,Mr(Nr,this))}unbindRawStream(){Dr(Or,this,null)}unbindShareProcessorStream(){Dr(Vr,this,null)}unbindAnnotationStream(){Dr(Nr,this,null)}unbindAnnotationRawStream(){Dr(xr,this,null)}cleanCurrentStream(){Dr(kr,this,null)}isShareProcessorStream(e){var t;return e&&e.id===(null===(t=Mr(Vr,this))||void 0===t?void 0:t.id)}isRawShareStream(e){var t;return e&&e.id===(null===(t=Mr(Or,this))||void 0===t?void 0:t.id)}};var Wr,Ur;!function(e){e[e.ADD_RENDER_VIDEO=1]="ADD_RENDER_VIDEO",e[e.STOP_RENDER_VIDEO=2]="STOP_RENDER_VIDEO",e[e.START_SHARING=23]="START_SHARING",e[e.STOP_SHARING=24]="STOP_SHARING",e[e.ZOOM_SHARING=140]="ZOOM_SHARING",e[e.START_SHARE_PREVIEW=37]="START_SHARE_PREVIEW",e[e.STOP_SHARE_PREVIEW=38]="STOP_SHARE_PREVIEW",e[e.SWITCH_CANVAS_FOR_VIDEO_CAPTURE=25]="SWITCH_CANVAS_FOR_VIDEO_CAPTURE",e[e.UPDATE_SHARING_DECODE_PARAM=44]="UPDATE_SHARING_DECODE_PARAM",e[e.UPDATE_CANVAS_SIZE=46]="UPDATE_CANVAS_SIZE",e[e.ZOOM_RENDER=48]="ZOOM_RENDER",e[e.UPDATE_SETTING_CANVAS_SIZE=52]="UPDATE_SETTING_CANVAS_SIZE",e[e.REMOVE_EXPIRED_CANVAS=76]="REMOVE_EXPIRED_CANVAS",e[e.WEBGL_LOST_REPLACE_CANVAS=77]="WEBGL_LOST_REPLACE_CANVAS",e[e.UPDATE_VIDEO_QUALITY=78]="UPDATE_VIDEO_QUALITY",e[e.SEND_RENDER_LOG=79]="SEND_RENDER_LOG",e[e.ADD_VIDEO_VB_SETTING_DOM=102]="ADD_VIDEO_VB_SETTING_DOM",e[e.REMOVE_VIDEO_VB_SETTING_DOM=103]="REMOVE_VIDEO_VB_SETTING_DOM",e[e.UPDATE_BORDER_RADIUS=104]="UPDATE_BORDER_RADIUS"}(Wr||(Wr={})),function(e){e[e.WEBGL_LOST_IN_MULTI_VIEW=-32]="WEBGL_LOST_IN_MULTI_VIEW",e[e.MOBILE_CAPTURE_DEVICE_CHANGE=135]="MOBILE_CAPTURE_DEVICE_CHANGE",e[e.SELF_PREVIEW_WATERMARK_CHANGE=139]="SELF_PREVIEW_WATERMARK_CHANGE",e[e.ADD_PSL_MIX_SHARE_INFO=141]="ADD_PSL_MIX_SHARE_INFO",e[e.REMOVE_PSL_MIX_SHARE_INFO=142]="REMOVE_PSL_MIX_SHARE_INFO",e[e.UPDATE_PSL_MIX_SHARE_INFO=143]="UPDATE_PSL_MIX_SHARE_INFO",e[e.SHARING_FIRST_DECODE_FRAME_RECEIVED_SSRC=70]="SHARING_FIRST_DECODE_FRAME_RECEIVED_SSRC"}(Ur||(Ur={}));const Br="default-sesssion-key";var Fr,Hr,Gr,jr,Kr,zr;!function(e){e.Video="video",e.Share="share",e.Preview="preview"}(Fr||(Fr={})),function(e){e.DEFAULT="",e.MAIN="main"}(Hr||(Hr={})),function(e){e.Video_90P="0",e.Video_180P="1",e.Video_360P="2",e.Video_720P="3",e.Video_1080P="4"}(Gr||(Gr={})),function(e){e[e.Unknown=0]="Unknown",e[e.VideoTag=1]="VideoTag",e[e.WebGL=2]="WebGL",e[e.WebGL2=3]="WebGL2",e[e.WebGPU=4]="WebGPU"}(jr||(jr={})),function(e){e.Debounce="debounce",e.Throttle="throttle",e.None="none"}(Kr||(Kr={})),function(e){e[e.None=0]="None",e[e.PreviewVideoRender=1]="PreviewVideoRender",e[e.SharingRender=2]="SharingRender",e[e.WasmVideoRender=3]="WasmVideoRender",e[e.WebRTCVideoRender=4]="WebRTCVideoRender",e[e.VBCanvasRender=5]="VBCanvasRender",e[e.VBVideoRender=6]="VBVideoRender",e[e.SharePreviewRender=7]="SharePreviewRender",e[e.NormalSsrcStreamRender=8]="NormalSsrcStreamRender",e[e.SharingSsrcStreamRender=9]="SharingSsrcStreamRender",e[e.VBSsrcStreamRender=10]="VBSsrcStreamRender",e[e.InsideCanvasRender=11]="InsideCanvasRender",e[e.InsideVideoTagRender=12]="InsideVideoTagRender",e[e.CanvasSubRender=13]="CanvasSubRender",e[e.SsrcStreamSubRender=14]="SsrcStreamSubRender"}(zr||(zr={}));const qr=new class{constructor(){this.state={mediaSDK:void 0,mediaSDKInstanceMap:new Map,tagName:"video-player",renderCountMap:new Map},this.onceMap=new WeakMap,this.subscribers=[]}get(e){return this.state[e]}dispatch(e,t,i){t&&Object.assign(this.state,t),e&&this.notifySubscribers(e,i)}subscribe(e){return this.subscribers.push(e),()=>{const t=this.subscribers.indexOf(e);-1!==t&&this.subscribers.splice(t,1)}}once(e,t){this.onceMap.set(t,{event:e,unSubscribe:this.subscribe(t)})}notifySubscribers(e,t){const i=[];this.subscribers.forEach((r=>{r(e,this.state,t);const s=this.onceMap.get(r);if(s){const{event:t,unSubscribe:o}=s;t===e&&(i.push(o),this.onceMap.delete(r))}})),i.forEach((e=>e()))}};function Yr(e,t,i,r,s,o=!1){const a=document.createElement("canvas");a.id=r;const n=os(a,e,t);return s(`VPISC:${window.devicePixelRatio},${n}`),a.style.position="absolute",a.style.left="0px",a.style.top="0px",a.style.width=e+"px",a.width=e*as(a),a.style.height=t+"px",a.height=t*as(a),a.style.zIndex=i,o||(a.style.pointerEvents="none",a.ariaHidden="true"),a}function Xr(e,t,i=!0,r=window,s){null==s||s("VPACE:"+(null==e?void 0:e.id)+":"+(r!==window));const o=()=>{if(e){qr.dispatch("resize",void 0,e.id),os(e,t.clientWidth,t.clientHeight),i&&[Wr.UPDATE_CANVAS_SIZE,Wr.UPDATE_SHARING_DECODE_PARAM].forEach((i=>{var r,s;null===(s=Zr(null===(r=null==t?void 0:t.getSessionId)||void 0===r?void 0:r.call(t)))||void 0===s||s.Notify_MeidaSDK(i,{width:t.clientWidth*as(e),height:t.clientHeight*as(e),canvas:e})})),e.style.width=t.clientWidth+"px",e.style.height=t.clientHeight+"px";try{e.width=t.clientWidth*as(e),e.height=t.clientHeight*as(e)}catch(e){}}},a=ts(o,300),n=function(e){let t,i=0;return function(...r){const s=Date.now(),o=s-i;!i||o>=300?(e(...r),i=s):t||(t=setTimeout((()=>{e(...r),i=Date.now(),t=null}),300-o))}}(o),d=()=>{var e;switch((null===(e=null==t?void 0:t.getResizeStrategy)||void 0===e?void 0:e.call(t))||Kr.Debounce){case Kr.Debounce:a();break;case Kr.Throttle:n();break;case Kr.None:o();break;default:a()}},c=matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`),l=new r.ResizeObserver(d);return c.addEventListener("change",d),l.observe(t),()=>{null==s||s("VPRCE:"+(null==e?void 0:e.id)+":"+(r!==window)),function(e){ss.delete(e)}(e),null==l||l.disconnect(),c.removeEventListener("change",d)}}function Qr(e,t){Object.defineProperties(e,t.reduce(((t,i)=>(t[i]={get:()=>e.getAttribute(i),set:t=>{t?e.setAttribute(i,t):e.removeAttribute(i)}},t)),{}))}function Jr(e,t){Object.entries(t).forEach((([t,i])=>{e.getAttribute(t)||e.setAttribute(t,i)}))}function $r(e,t){const i=e.getAttribute(t);return!(!i||"true"!==i)}function Zr(e=Br){var t;return null===(t=qr.get("mediaSDKInstanceMap").get(e))||void 0===t?void 0:t()}function es(){if("function"==typeof crypto.randomUUID)return crypto.randomUUID();let e=(new Date).getTime(),t=performance&&performance.now&&1e3*performance.now()||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(i=>{let r=16*Math.random();return e>0?(r=(e+r)%16|0,e=Math.floor(e/16)):(r=(t+r)%16|0,t=Math.floor(t/16)),("x"===i?r:3&r|8).toString(16)}))}function ts(e,t){let i;return function(...r){clearTimeout(i),i=setTimeout((()=>{e(...r)}),t)}}function is(e,t){const i=Object.keys(e),r=Object.keys(t);if(i.length!==r.length)return!1;for(const r of i){const i=e[r],s=t[r];if("object"==typeof i&&"object"==typeof s){if(!is(i,s))return!1}else if(i!==s)return!1}return!0}function rs(e){return!e||"0"===e}const ss=new Map;function os(e,t,i){const r=t>=2*window.screen.width||i>=2*window.screen.height?1:window.devicePixelRatio,s=ss.get(e);return ss.set(e,r),s&&s!==r&&qr.dispatch("scale",void 0,e.id),r}function as(e){return e&&ss.get(e)||window.devicePixelRatio}function ns(e,t){t&&(null==e||e.Notify_MeidaSDK(Wr.SEND_RENDER_LOG,{message:t}))}function ds(e,t){const i=qr.get("renderCountMap"),r=i.get(e)||0;i.set(e,t?r+1:r-1)}function cs(){return window.self!==window.top?window.top:window.self}function ls(e){const t=e=>{const t=e.match(/^(\d+(?:\.\d+)?)(px|%)?$/);return t?{value:parseFloat(t[1]),unit:t[2]||"px"}:{value:0,unit:"px"}},i=e.split(/[\s\/]+/).filter((e=>e));let r=[],s=[];e.includes("/")?[r,s]=e.split("/").map((e=>e.trim().split(/\s+/))):(r=[...i],s=[...i]);const o=e=>{switch(e.length){case 1:return[e[0],e[0],e[0],e[0]];case 2:return[e[0],e[1],e[0],e[1]];case 3:return[e[0],e[1],e[2],e[1]];case 4:return e;default:return["0","0","0","0"]}},[a,n,d,c]=o(r).map(t),[l,h,u,p]=o(s).map(t);return{topLeft:{x:a,y:l},topRight:{x:n,y:h},bottomRight:{x:d,y:u},bottomLeft:{x:c,y:p}}}function hs(e,t,i=!0){e&&t&&(i?(e.style.left=100*t.left+"%",e.style.top=100*t.top+"%",e.style.width=100*t.width+"%",e.style.height=100*t.height+"%"):(e.style.left=`${t.left}px`,e.style.top=`${t.top}px`,e.style.width=`${t.width}px`,e.style.height=`${t.height}px`))}function us(e,t){if(!e||!t)return{left:0,top:0,bottom:0,right:0,width:0,height:0};const{left:i,top:r,bottom:s,right:o,width:a,height:n}=e.getBoundingClientRect(),d=t.getBoundingClientRect();return{left:i-d.left,top:r-d.top,bottom:d.bottom-s,right:d.right-o,width:a,height:n}}const ps=[];for(let e=0;e<=1;e+=.01)ps.push(e);function fs(e,t,i={}){const{wrapper:r=document.documentElement}=i,s=i.strategy===Kr.None?t:ts(t,300);let o,a;const n=(i=.9999999,a=!1)=>{o&&(o.disconnect(),o=null);const{top:d,left:c,width:l,height:h,right:u,bottom:p}=us(e,r);if(!l||!h)return void t({hide:!0,cross:!1,width:0,height:0,top:0,left:0,bottom:0,right:0});const f=d<0||p<0||c<0||u<0;const m=((e,t,i,r,s,o)=>e<=0&&e+o<=0||t<=0&&t+o<=0||i<=0&&i+s<=0||r<=0&&r+s<=0)(d,p,c,u,l,h),v={root:r,threshold:f?ps:i};f||(v.rootMargin=`${-d}px ${-u}px ${-p}px ${-c}px`);let g=!0,_=!0;a&&(_=!1),t({hide:m,cross:f,top:d,left:c,width:l,height:h,bottom:p,right:u}),s({hide:m,cross:f,top:d,left:c,width:l,height:h,bottom:p,right:u},!0),o=new IntersectionObserver((([e])=>{if(0===e.intersectionRatio)return _?n(.9999999,!0):void 0;if(i!==e.intersectionRatio){if(!g)return n();n(0===e.intersectionRatio?1e-7:e.intersectionRatio)}1===e.intersectionRatio&&f&&n(),g=!1}),v),o.observe(e)};return n(),a=new ResizeObserver((()=>n())),a.observe(e),()=>{null==o||o.disconnect(),o=null,null==a||a.disconnect(),a=null}}class ms{constructor(e,t){var i;if(this.getRenderParams=t,this.el=document.createElement("div"),this.position=null,this.id="",this.srcObject=null,this.removePositionObserve=null,this.viewId=`${qr.get("tagName")}-${es()}`,this.borderRadius=null,this.getSDK=()=>{var e,t;return Zr(null===(t=null===(e=this.container)||void 0===e?void 0:e.getSessionId)||void 0===t?void 0:t.call(e))},!e)throw new Error(`The ${qr.get("tagName")} must have a ${qr.get("tagName")}-container as its ancestor element.`);this.container=e,this.el.style.width="100%",this.el.style.height="100%",this.debounceUpdateVideoPosition=(null===(i=null==e?void 0:e.getResizeStrategy)||void 0===i?void 0:i.call(e))!==Kr.None?ts(this.updateVideoPosition.bind(this),300):this.updateVideoPosition.bind(this)}getElement(){return this.el}init(e){(null==e?void 0:e.borderRadius)&&(this.borderRadius=null==e?void 0:e.borderRadius),this.removeSubscribe=qr.subscribe(((e,t,i)=>{i===this.getCanvas().id&&("resize"===e?(this.updateVideoPosition(),setTimeout((()=>{this.updateVideoPosition()}),300)):"scale"===e&&ns(this.getSDK(),`VPSC:${as(this.getCanvas())}`))}))}getCanvas(){return this.container.getCanvas()}initObservePosition(){var e,t;this.stopObservePosition(),this.removePositionObserve=fs(this.el,((e,t)=>{t?setTimeout((()=>{this.updateVideoPosition()}),300):this.debounceUpdateVideoPosition(e)}),{wrapper:this.container,strategy:(null===(t=null===(e=this.container)||void 0===e?void 0:e.getResizeStrategy)||void 0===t?void 0:t.call(e))||Kr.Debounce})}stopObservePosition(){this.removePositionObserve&&(this.removePositionObserve(),this.removePositionObserve=null)}getCurrentPosition(e){return this.transformRectToPosition(us(e,this.container))}transformRectToPosition(e){const{left:t,width:i,height:r,bottom:s,top:o}=e,a=as(this.getCanvas());return{x:t*a,y:s*a,width:i*a,height:r*a,left:t*a,bottom:s*a,top:o*a}}playVideo(e){this.initObservePosition(),"string"==typeof e?this.id=e:this.srcObject=e;const t=this.getCurrentPosition(this.el);this.addRender(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),{canvas:this.getCanvas(),zone:this.viewId,userId:Number(this.id),ssrc:Number(this.id)}),this.getRenderParams()),this.srcObject?{srcObject:this.srcObject}:{}),this.borderRadius?{borderRadius:this.borderRadius}:{})),this.position=t}updateVideoPosition(e){if(!this.id&&!this.srcObject)return;const t=this.transformRectToPosition(e||us(this.el,this.container));this.position&&is(t,this.position)||(this.zoomRender(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),{userId:Number(this.id),canvas:this.getCanvas(),RGBA:this.container.getRGBA(),zone:this.viewId}),this.getRenderParams()),this.srcObject?{srcObject:this.srcObject}:{}),this.borderRadius?{borderRadius:this.borderRadius}:{})),this.position=t)}stopVideo(){this.stopObservePosition(),(this.id||this.srcObject)&&this.position&&((this.id||this.srcObject)&&this.stopRender(Object.assign(Object.assign(Object.assign(Object.assign({},this.position),{userId:Number(this.id),canvas:this.getCanvas(),RGBA:this.container.getRGBA(),zone:this.viewId}),this.getRenderParams()),this.srcObject?{srcObject:this.srcObject}:{})),this.position=null,this.id="",this.srcObject=null)}updateVideoQuality(e){var t;this.id&&(null===(t=this.getSDK())||void 0===t||t.Notify_MeidaSDK(Wr.UPDATE_VIDEO_QUALITY,{userId:this.id,videoQuality:e}))}updateBorderRadius(e){var t;this.borderRadius=e,this.id&&(null===(t=this.getSDK())||void 0===t||t.Notify_MeidaSDK(Wr.UPDATE_BORDER_RADIUS,{userId:Number(this.id),zone:this.viewId,data:e}))}refresh(){this.debounceUpdateVideoPosition()}destroy(){var e;this.borderRadius=null,this.stopVideo(),null===(e=this.removeSubscribe)||void 0===e||e.call(this)}}class vs{constructor(e){this.container=e,this.id="",this.srcObject=null,this.viewId=`${qr.get("tagName")}-${es()}`,this.getSDK=()=>{var e,t;return Zr(null===(t=null===(e=this.container)||void 0===e?void 0:e.getSessionId)||void 0===t?void 0:t.call(e))},this.el=this.createVideoElement()}createVideoElement(){var e;let t=null===(e=this.getSDK())||void 0===e?void 0:e.createRedirVideoElement(!0);return t||(t=document.createElement("video")),t.style.width="100%",t.style.height="100%",t.style.borderRadius="inherit",t.setAttribute("autoplay","true"),t.setAttribute("muted","true"),t.muted=!0,t.setAttribute("playsinline","true"),t}replaceVideoElement(e){const t=this.createVideoElement();e.replaceWith(t),setTimeout((()=>{e.srcObject=null}),50),this.el=t}getElement(){return this.el}init(){}playVideo(e){"string"==typeof e?this.id=e:this.srcObject=e,this.addRender(Object.assign({id:this.id,zone:this.viewId,userId:Number(this.id),videodom:this.el},this.srcObject?{srcObject:this.srcObject}:{}))}stopVideo(){var e;(this.id||this.srcObject)&&(this.stopRender(Object.assign({id:this.id,zone:this.viewId,userId:Number(this.id),videodom:this.el},this.srcObject?{srcObject:this.srcObject}:{})),(null===(e=this.getSDK())||void 0===e?void 0:e.getWebRTCFlag())&&this.replaceVideoElement(this.el),this.id="",this.srcObject=null)}updateVideoQuality(e){}destroy(){this.stopVideo()}}class gs{constructor(e){this.container=e,this.id="",this.srcObject=null,this.getSDK=()=>{var e,t;return Zr(null===(t=null===(e=this.container)||void 0===e?void 0:e.getSessionId)||void 0===t?void 0:t.call(e))},this.resizeObserver=new ResizeObserver((([e])=>{this.onResize(this.el,e.target.clientWidth,e.target.clientHeight);try{this.el.width=e.target.clientWidth,this.el.height=e.target.clientHeight}catch(e){}})),this.el=document.createElement("canvas"),this.el.id=es(),this.el.style.borderRadius="inherit",this.el.style.width="100%",this.el.style.height="100%"}getElement(){return this.el}onResize(e,t,i){var r;null===(r=this.getSDK())||void 0===r||r.Notify_MeidaSDK(Wr.UPDATE_SETTING_CANVAS_SIZE,{canvas:e,width:t,height:i})}init(){this.el.parentElement&&(this.el.width=this.el.parentElement.clientWidth,this.el.height=this.el.parentElement.clientHeight,this.resizeObserver.observe(this.el.parentElement))}playVideo(e){"string"==typeof e?this.id=e:this.srcObject=e,this.addRender({id:this.id,canvas:this.el})}stopVideo(){(this.id||this.srcObject)&&(this.stopRender({id:this.id,canvas:this.el}),this.id="",this.srcObject=null)}updateVideoQuality(e){}destroy(){var e,t,i;this.stopVideo(),this.resizeObserver.disconnect(),null===(i=Zr(null===(t=null===(e=this.container)||void 0===e?void 0:e.getSessionId)||void 0===t?void 0:t.call(e)))||void 0===i||i.Notify_MeidaSDK(Wr.REMOVE_EXPIRED_CANVAS,{canvasId:this.el.id})}}const _s=3e3;class Ss{constructor(e,t,i){this.id="",this.srcObject=null,this.viewId=`${qr.get("tagName")}-${es()}`,this.ssrcStream=null,this.videoElement=null,this.cursorElement=null,this.hasCursorLayer=!1,this.cursorTransform={tx:0,ty:0,scale:1},this.mirrorState=!1,this.rotation="rot0",this.scale=1,this.containerCssWidth=void 0,this.containerCssHeight=void 0,this.videoWidth=void 0,this.videoHeight=void 0,this.monitorVideoPlayQualityTimeout=null,this.lastTotalVideoFrames=0,this.lastDroppedVideoFrames=0,this.lastRenderedVideoFrames=0,this.noRenderedVideoFramesDuration=0,this.getSDK=()=>{var e,t;return Zr(null===(t=null===(e=this.container)||void 0===e?void 0:e.getSessionId)||void 0===t?void 0:t.call(e))},this.container=e,this.getRenderParams=t,this.renderMode=i,this.containerElement=this.createDivElement(),this.resizeObserver=new ResizeObserver((([e])=>{this.containerCssWidth=e.target.clientWidth,this.containerCssHeight=e.target.clientHeight,this.ssrcStream&&this.ssrcStream.updateDesiredSize({width:this.containerCssWidth,height:this.containerCssHeight}),"rot90"!==this.rotation&&"rot270"!==this.rotation||this._doRotateVideoContent(this.rotation),this.hasCursorLayer&&this._updateCursorTransform()}))}init(){}destroy(){this.stopVideo()}createDivElement(){const e=document.createElement("div");return e.style.width="100%",e.style.height="100%",e.style.borderRadius="inherit",e}getElement(){return this.containerElement}getAnnoCanvas(){var e;return null===(e=this.container)||void 0===e?void 0:e.getAnnoCanvas()}getPreviewCanvas(){var e;return null===(e=this.container)||void 0===e?void 0:e.getPreviewCanvas()}getLocalShareCanvas(){var e;return null===(e=this.container)||void 0===e?void 0:e.getLocalShareCanvas()}monitorVideoPlayQuality(){var e;const t=this.videoElement.getVideoPlaybackQuality(),i=t.totalVideoFrames-t.droppedVideoFrames;if(i===this.lastRenderedVideoFrames){this.noRenderedVideoFramesDuration+=_s;const i=t.totalVideoFrames-this.lastTotalVideoFrames,r=t.droppedVideoFrames-this.lastDroppedVideoFrames;return null===(e=this.getSDK())||void 0===e||e.base.tracing.Log_Error(`[vtagq] No video frames rendered, id = ${this.id}, duration = ${this.noRenderedVideoFramesDuration}s, totalFrames = ${i}, droppedFrames = ${r}`),void this.stopMonitorVideoPlayQuality()}this.lastTotalVideoFrames=t.totalVideoFrames,this.lastDroppedVideoFrames=t.droppedVideoFrames,this.lastRenderedVideoFrames=i,this.noRenderedVideoFramesDuration=0,this.monitorVideoPlayQualityTimeout=setTimeout((()=>{this.monitorVideoPlayQuality()}),_s)}startMonitorVideoPlayQuality(){this.monitorVideoPlayQualityTimeout||(this.lastRenderedVideoFrames=0,this.monitorVideoPlayQualityTimeout=setTimeout((()=>{this.monitorVideoPlayQuality()}),_s))}stopMonitorVideoPlayQuality(){this.monitorVideoPlayQualityTimeout&&(clearTimeout(this.monitorVideoPlayQualityTimeout),this.monitorVideoPlayQualityTimeout=null,this.lastTotalVideoFrames=0,this.lastDroppedVideoFrames=0,this.lastRenderedVideoFrames=0,this.noRenderedVideoFramesDuration=0)}playVideo(e){this.stopVideo(),"string"==typeof e?this.id=e:this.srcObject=e;let t=0;"vb"!==this.renderMode&&(t=Number(this.id));const i=getComputedStyle(this.getElement()),r=parseFloat(i.width),s=parseFloat(i.height);this.addVideoElement(),this.ssrcStream=this.createSsrcStream(t,this.videoElement,{width:r,height:s}),this.videoElement.srcObject=this.ssrcStream.mediaStream,this.startMonitorVideoPlayQuality(),this.resizeObserver.observe(this.containerElement),this.addRender(Object.assign(Object.assign({id:this.id,x:0,y:0,width:r,height:s,left:0,top:0,bottom:s,canvas:this.containerElement,zone:this.viewId,userId:Number(this.id),ssrc:Number(this.id)},this.getRenderParams()),this.srcObject?{srcObject:this.srcObject}:{}))}stopVideo(){var e;if(!this.id&&!this.srcObject)return;const t=getComputedStyle(this.getElement()),i=parseFloat(t.width),r=parseFloat(t.height);this.clear(),this.stopRender(Object.assign(Object.assign({id:this.id,x:0,y:0,width:i,height:r,left:0,top:0,bottom:r,userId:Number(this.id),canvas:this.containerElement,RGBA:null===(e=this.container)||void 0===e?void 0:e.getRGBA(),zone:this.viewId},this.getRenderParams()),this.srcObject?{srcObject:this.srcObject}:{})),this.id="",this.srcObject=null}updateVideoQuality(e){}clear(){this.removeVideoElement(),this.removeCursorElement(),this.resizeObserver.disconnect(),this.containerCssWidth=void 0,this.containerCssHeight=void 0,this.ssrcStream&&(this.ssrcStream.stop(),this.ssrcStream=null)}addVideoElement(){this.removeVideoElement();const e=document.createElement("video");e.style.width="100%",e.style.height="100%",e.style.borderRadius="inherit",e.setAttribute("autoplay","true"),e.setAttribute("muted","true"),e.muted=!0,e.setAttribute("playsinline","true"),this.containerElement.appendChild(e);const t=getComputedStyle(this.containerElement);this.containerCssWidth=parseFloat(t.width),this.containerCssHeight=parseFloat(t.height),this.videoElement=e}removeVideoElement(){if(null===this.videoElement)return;this.videoElement.remove();const e=this.videoElement;setTimeout((()=>{e.srcObject=null}),50),this.videoElement=null,this.stopMonitorVideoPlayQuality()}addCursorElement(){this.removeCursorElement();const e=document.createElement("canvas");return e.style.borderRadius="inherit",e.style.width="100%",e.style.height="100%",e.style.position="absolute",e.style.visibility="hidden",this.containerElement.appendChild(e),this.cursorElement=e,this.hasCursorLayer=!0,this._updateCursorTransform(),e}removeCursorElement(){const e=this.cursorElement;null!==e&&(e.remove(),this.cursorElement=null,this.hasCursorLayer=!1)}createSsrcStream(e,t,i){const r=this.getSDK().createSsrcStreamWithRender(e,t,this.renderMode,i);return r.on("addCursorTrack",(e=>{this.addCursorElement(),r.cursorTrack.renderTarget=this.cursorElement,e.on("cursorMove",(e=>{this.onCursorMove(e)}))})),r.metaTrack.on("videoRotationChange",(e=>{this.handleVideoRotated(e)})),r.metaTrack.on("videoMirrorChange",(e=>{this.handleMirrorStateChanged(e)})),r.metaTrack.on("videoSizeChange",((e,t)=>{this.handleVideoSizeChanged(e,t)})),r}_updateCursorTransform(){this.videoWidth&&this.containerCssWidth&&(this.cursorTransform.scale=this.containerCssWidth/this.videoWidth)}onCursorMove(e){if(!this.videoWidth||!this.containerCssWidth)return;this.getSDK().base.assertion.assert(null!==this.cursorElement);const t=this.cursorElement;t.style.visibility="visible";const i=this.cursorTransform.scale;t.style.top=e.y*i+"px",t.style.left=e.x*i+"px",t.style.width=e.width*i+"px",t.style.height=e.height*i+"px"}_doRotateVideoContent(e){const t={rot0:0,rot90:90,rot180:180,rot270:270}[e];this.getSDK().base.assertion.assert(null!==this.videoElement);const i=this.videoElement;let r=i.style.transform;const s=`rotate(${t}deg)`;r.includes("rotate")?r=r.replace(/rotate\([0-9]+(deg)?\)/,s):r+=` ${s}`,i.style.transform=r,i.style.transformOrigin="center";let o=1;if(("rot90"===e||"rot270"===e)&&this.videoWidth&&this.videoHeight){const e=this.videoHeight/this.videoWidth,t=this.containerCssWidth,i=this.containerCssHeight;if(o=i/t,t>i){const r=e/(i/t);r>1&&(o*=r)}else{const r=e/(t/i);r>1&&(o/=r)}}const a=this.mirrorState?-1:1;this._scaleVideoContent(a*o,o),this.scale=o,this.rotation=e}handleVideoRotated(e){this.rotation!==e&&this._doRotateVideoContent(e)}handleMirrorStateChanged(e){const t=e?-1:1,i=this.scale;this._scaleVideoContent(t*i,i),this.mirrorState=e}_scaleVideoContent(e,t){this.getSDK().base.assertion.assert(null!==this.videoElement);const i=this.videoElement;let r=i.style.transform;const s=`scaleX(${e})`;r.includes("scaleX")?r=r.replace(/scaleX\(-?([0-9]+(\.[0-9]*)?)\)/,s):r+=s;const o=`scaleY(${t})`;r.includes("scaleY")?r=r.replace(/scaleY\(-?([0-9]+(\.[0-9]*)?)\)/,o):r+=o,i.style.transform=r,i.style.transformOrigin="center"}handleVideoSizeChanged(e,t){this.videoWidth===e&&this.videoHeight===t||(this.videoWidth=e,this.videoHeight=t,"rot90"!==this.rotation&&"rot270"!==this.rotation||this._doRotateVideoContent(this.rotation),this.hasCursorLayer&&this._updateCursorTransform())}}class As extends Ss{constructor(e,t){super(e,t,"normal"),this.renderType=zr.NormalSsrcStreamRender}addRender({width:e,height:t,x:i,y:r,canvas:s,zone:o,userId:a,left:n,bottom:d,top:c,fillMode:l,videoQuality:h}){var u;null===(u=this.getSDK())||void 0===u||u.Notify_MeidaSDK(Wr.ADD_RENDER_VIDEO,{width:e,height:t,x:i,y:r,canvas:s,zone:o,userId:a,left:n,bottom:d,top:c,fillMode:l,videoQuality:h})}stopRender({width:e,height:t,x:i,y:r,userId:s,canvas:o,doNotClean:a,RGBA:n,zone:d,left:c,bottom:l,top:h,videoQuality:u}){var p;null===(p=this.getSDK())||void 0===p||p.Notify_MeidaSDK(Wr.STOP_RENDER_VIDEO,{width:e,height:t,x:i,y:r,userId:s,canvas:o,doNotClean:a,RGBA:n,zone:d,left:c,bottom:l,top:h,videoQuality:u})}}class ys extends Ss{constructor(e,t){super(e,t,"sharing"),this.renderType=zr.SharingSsrcStreamRender}addRender({width:e,height:t,canvas:i,ssrc:r}){var s,o;null===(s=this.getSDK())||void 0===s||s.Notify_MeidaSDK(Wr.START_SHARING,Object.assign({width:e,height:t,canvas:i,ssrc:r,annoCanvas:this.getAnnoCanvas(),annoPresenterCanvas:this.getPreviewCanvas(),localShareCanvas:this.getLocalShareCanvas()},null===(o=this.getRenderParams)||void 0===o?void 0:o.call(this)))}stopRender({canvas:e}){var t;null===(t=this.getSDK())||void 0===t||t.Notify_MeidaSDK(Wr.STOP_SHARING,{canvas:e})}}class Cs extends Ss{constructor(e,t){super(e,t,"vb"),this.renderType=zr.VBSsrcStreamRender}addRender({id:e,canvas:t}){var i;null===(i=this.getSDK())||void 0===i||i.Notify_MeidaSDK(Wr.ADD_VIDEO_VB_SETTING_DOM,{id:e,canvas:t})}stopRender({id:e,canvas:t}){var i;null===(i=this.getSDK())||void 0===i||i.Notify_MeidaSDK(Wr.REMOVE_VIDEO_VB_SETTING_DOM,{id:e,canvas:t})}}class Es{constructor(e){this.container=e,this.canvasId="video-player-canvas-"+es(),this.removePositionObserve=null,this.viewId=`${qr.get("tagName")}-${es()}`,this.el=document.createElement("div"),this.id="",this.getSDK=()=>{var e,t;return Zr(null===(t=null===(e=this.container)||void 0===e?void 0:e.getSessionId)||void 0===t?void 0:t.call(e))},this.resizeObserver=new ResizeObserver((([e])=>{this.resizeCanvas(e.target.clientWidth,e.target.clientHeight)})),this.el.style.width="100%",this.el.style.height="100%"}resizeCanvas(e,t){this.id&&(this.zoomRender({width:e*as(this.canvas),height:t*as(this.canvas),canvas:this.canvas,zone:this.viewId,x:0,y:0,ssrc:Number(this.id)}),this.onResize(this.canvas,Math.round(e),Math.round(t)))}updateCanvasPosition(e,t,i,r,s=!0){hs(this.canvas,{width:Math.round(e),height:Math.round(t),left:Math.round(i),top:Math.round(r)},s)}getElement(){return this.el}init(){this.el.parentElement&&this.resizeObserver.observe(this.el.parentElement)}get canvas(){return this.container.getCanvasById(this.canvasId)}initObservePosition(){this.stopObservePosition(),this.removePositionObserve=fs(this.el,((e,t)=>{t||this.updateCanvasPosition(e.width,e.height,e.left,e.top,!1)}),{wrapper:this.container,strategy:Kr.None})}stopObservePosition(){this.removePositionObserve&&(this.removePositionObserve(),this.removePositionObserve=null)}playVideo(e){this.initObservePosition(),this.id=e,this.addRender({canvas:this.canvas,width:this.el.clientWidth*as(this.canvas),height:this.el.clientHeight*as(this.canvas),x:0,y:0,ssrc:Number(this.id),zone:this.viewId}),this.resizeCanvas(this.el.clientWidth,this.el.clientHeight)}stopVideo(){this.id&&(this.stopRender({canvas:this.canvas,ssrc:Number(this.id),zone:this.viewId}),this.updateCanvasPosition(0,0,0,0),this.resizeCanvas(0,0),this.id="")}updateVideoQuality(e){}destroy(){this.stopVideo(),this.resizeObserver.disconnect(),this.stopObservePosition()}}class bs extends ms{constructor(){super(...arguments),this.renderType=zr.WasmVideoRender}addRender({width:e,height:t,x:i,y:r,canvas:s,zone:o,userId:a,left:n,bottom:d,top:c,fillMode:l,videoQuality:h}){var u;this.getSDK()&&(ds(this.container,!0),function(e){var t,i;const r=qr.get("renderCountMap").get(e)||0,s=(null===(i=null===(t=null===JsMediaSDK_Instance||void 0===JsMediaSDK_Instance?void 0:JsMediaSDK_Instance.util)||void 0===t?void 0:t.getMaxCountRender)||void 0===i?void 0:i.call(t))||25,o=r>=0&&r<=s,a=qr.get("tagName");o||console.error(`In your environment, the maximum number of ${a} that can be accommodated in each ${a}-container is ${s}. The current number has exceeded this limit, which may cause video rendering issues.`)}(this.container)),null===(u=this.getSDK())||void 0===u||u.Notify_MeidaSDK(Wr.ADD_RENDER_VIDEO,{width:e,height:t,x:i,y:r,canvas:s,zone:o,userId:a,left:n,bottom:d,top:c,fillMode:l,videoQuality:h})}zoomRender({width:e,height:t,x:i,y:r,userId:s,canvas:o,RGBA:a,zone:n,left:d,bottom:c,top:l}){var h;null===(h=this.getSDK())||void 0===h||h.Notify_MeidaSDK(Wr.ZOOM_RENDER,{width:e,height:t,x:i,y:r,userId:s,canvas:o,RGBA:a,zone:n,left:d,bottom:c,top:l})}stopRender({width:e,height:t,x:i,y:r,userId:s,canvas:o,doNotClean:a,RGBA:n,zone:d,left:c,bottom:l,top:h,videoQuality:u}){var p;this.getSDK()&&ds(this.container,!1),null===(p=this.getSDK())||void 0===p||p.Notify_MeidaSDK(Wr.STOP_RENDER_VIDEO,{width:e,height:t,x:i,y:r,userId:s,canvas:o,doNotClean:a,RGBA:n,zone:d,left:c,bottom:l,top:h,videoQuality:u})}}class ws extends vs{constructor(){super(...arguments),this.renderType=zr.WebRTCVideoRender}addRender({userId:e,videodom:t,zone:i}){var r;null===(r=this.getSDK())||void 0===r||r.Notify_MeidaSDK(Wr.ADD_RENDER_VIDEO,{userId:e,videodom:t,zone:i})}stopRender({userId:e,videodom:t,zone:i}){var r;null===(r=this.getSDK())||void 0===r||r.Notify_MeidaSDK(Wr.STOP_RENDER_VIDEO,{userId:e,videodom:t,zone:i})}}class Rs extends ms{constructor(){super(...arguments),this.ismain=!1,this.renderType=zr.SharingRender}getAnnoCanvas(){var e;return null===(e=this.container)||void 0===e?void 0:e.getAnnoCanvas()}getPreviewCanvas(){var e;return null===(e=this.container)||void 0===e?void 0:e.getPreviewCanvas()}getLocalShareCanvas(){return this.container.getLocalShareCanvas()}addRender({x:e,y:t,width:i,height:r,userId:s,canvas:o,isFromMainSession:a,zone:n}){var d;this.ismain=!!a,null===(d=this.getSDK())||void 0===d||d.Notify_MeidaSDK(Wr.START_SHARING,{width:i,height:r,x:e,y:t,ssrc:s,isFromMainSession:a,canvas:o,zone:n,annoCanvas:this.getAnnoCanvas()})}zoomRender({x:e,y:t,width:i,height:r,userId:s,canvas:o,zone:a,RGBA:n,isFromMainSession:d}){var c;null===(c=this.getSDK())||void 0===c||c.Notify_MeidaSDK(Wr.ZOOM_SHARING,{width:i,height:r,x:e,y:t,ssrc:s,zone:a,canvas:o,RGBA:n,isFromMainSession:d})}stopRender({canvas:e,userId:t,zone:i,isFromMainSession:r}){var s;null===(s=this.getSDK())||void 0===s||s.Notify_MeidaSDK(Wr.STOP_SHARING,{canvas:e,ssrc:t,zone:i,isFromMainSession:this.ismain})}}class Ts extends ms{constructor(){super(...arguments),this.renderType=zr.SharePreviewRender}getAnnoCanvas(){var e;return null===(e=this.container)||void 0===e?void 0:e.getAnnoCanvas()}getPreviewCanvas(){var e;return null===(e=this.container)||void 0===e?void 0:e.getPreviewCanvas()}getLocalShareCanvas(){return this.container.getLocalShareCanvas()}addRender({canvas:e}){var t;null===(t=this.getSDK())||void 0===t||t.Notify_MeidaSDK(Wr.START_SHARE_PREVIEW,{annoPresenterCanvas:this.getPreviewCanvas(),localShareCanvas:this.getLocalShareCanvas()})}zoomRender(){}stopRender({canvas:e}){var t;null===(t=this.getSDK())||void 0===t||t.Notify_MeidaSDK(Wr.STOP_SHARE_PREVIEW,{})}}class Is extends vs{constructor(){super(...arguments),this.renderType=zr.PreviewVideoRender}addRender({userId:e,videodom:t}){var i,r;null===(i=this.getSDK())||void 0===i||i.Notify_MeidaSDK(Wr.SWITCH_CANVAS_FOR_VIDEO_CAPTURE,[t]),null===(r=this.getSDK())||void 0===r||r.Notify_MeidaSDK(Wr.ADD_RENDER_VIDEO,{userId:e,videodom:t})}stopRender({userId:e,videodom:t}){var i;null===(i=this.getSDK())||void 0===i||i.Notify_MeidaSDK(Wr.STOP_RENDER_VIDEO,{userId:e,videodom:t})}}class Ms extends vs{constructor(){super(...arguments),this.renderType=zr.VBVideoRender}addRender({id:e,videodom:t}){var i;null===(i=this.getSDK())||void 0===i||i.Notify_MeidaSDK(Wr.ADD_VIDEO_VB_SETTING_DOM,{id:e,videodom:t})}stopRender({id:e,videodom:t}){var i;null===(i=this.getSDK())||void 0===i||i.Notify_MeidaSDK(Wr.REMOVE_VIDEO_VB_SETTING_DOM,{id:e,videodom:t})}}class Ds extends gs{constructor(){super(...arguments),this.renderType=zr.VBCanvasRender}addRender({id:e,canvas:t}){var i;null===(i=this.getSDK())||void 0===i||i.Notify_MeidaSDK(Wr.ADD_VIDEO_VB_SETTING_DOM,{id:e,canvas:t})}stopRender({id:e,canvas:t}){var i;null===(i=this.getSDK())||void 0===i||i.Notify_MeidaSDK(Wr.REMOVE_VIDEO_VB_SETTING_DOM,{id:e,canvas:t})}}class Ps extends Es{constructor(e){super(e),this.renderType=zr.CanvasSubRender,this.canvasId="sub-render-canvas"}onResize(e,t,i){var r;os(e,t,i);try{e.width=t*as(e),e.height=i*as(e)}catch(e){}null===(r=this.getSDK())||void 0===r||r.Notify_MeidaSDK(Wr.UPDATE_SHARING_DECODE_PARAM,{canvas:e,width:t*as(e),height:i*as(e)})}addRender({x:e,y:t,width:i,height:r,ssrc:s,canvas:o,zone:a}){var n;null===(n=this.getSDK())||void 0===n||n.Notify_MeidaSDK(Wr.START_SHARING,{width:i,height:r,x:e,y:t,ssrc:s,canvas:o,zone:a})}zoomRender({width:e,height:t,canvas:i,zone:r,x:s,y:o,ssrc:a}){var n;null===(n=this.getSDK())||void 0===n||n.Notify_MeidaSDK(Wr.ZOOM_SHARING,{width:e,height:t,x:s,y:o,ssrc:a,zone:r,canvas:i})}stopRender({canvas:e,ssrc:t,zone:i}){var r;null===(r=this.getSDK())||void 0===r||r.Notify_MeidaSDK(Wr.STOP_SHARING,{canvas:e,ssrc:t,zone:i})}}class ks extends ys{constructor(){super(...arguments),this.renderType=zr.SsrcStreamSubRender}getAnnoCanvas(){}getPreviewCanvas(){}getLocalShareCanvas(){}}class Os{static VERTEX_SHADER="\n attribute vec2 position;\n varying vec2 texCoord;\n\n void main() {\n texCoord = (position + 1.0) * 0.5;\n // gl_Position = vec4(position, 0.0, 1.0);\n gl_Position = vec4(position.x, -position.y, 0.0, 1.0);\n }\n ";static FRAGMENT_SHADER="\n precision mediump float;\n varying vec2 texCoord;\n uniform sampler2D videoTexture;\n\n void main() {\n gl_FragColor = texture2D(videoTexture, texCoord);\n }\n ";constructor(){}preview(e,t,i){const r=t.getContext("webgl"),s=this.#e(r,Os.VERTEX_SHADER,Os.FRAGMENT_SHADER),o=r.getAttribLocation(s,"position"),a=r.getUniformLocation(s,"videoTexture");r.useProgram(s);const n=this.#t(r);r.bindBuffer(r.ARRAY_BUFFER,n),r.enableVertexAttribArray(o),r.vertexAttribPointer(o,2,r.FLOAT,!1,0,0),this.frame({glContext:r,program:s,positionAttributeLocation:o,textureLocation:a,positionBuffer:n,viewport:i,source:e})}frame(e){const t=e.glContext;e.glContext.clearColor(0,0,0,1),e.glContext.clear(e.glContext.COLOR_BUFFER_BIT),e.glContext.viewport(e.viewport.x,e.viewport.y,e.viewport.w,e.viewport.h),e.glContext.enable(e.glContext.DEPTH_TEST);const i=e.glContext.createTexture();t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,i),t.uniform1i(e.textureLocation,0),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e.source),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),e.glContext.drawArrays(e.glContext.TRIANGLE_STRIP,0,4),requestAnimationFrame((()=>this.frame(e)))}#e(e,t,i){const r=this.#i(e,e.VERTEX_SHADER,t),s=this.#i(e,e.FRAGMENT_SHADER,i);let o=e.createProgram();return e.attachShader(o,r),e.attachShader(o,s),e.linkProgram(o),o}#i(e,t,i){const r=e.createShader(t);return e.shaderSource(r,i),e.compileShader(r),r}#t(e){const t=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,t),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,null),t}}const Vs=Os;class Ns{static VERTEX_SHADER="#version 300 es\n in vec2 position;\n out vec2 texCoord;\n\n void main() {\n texCoord = (position + 1.0) * 0.5;\n gl_Position = vec4(position.x, -position.y, 0.0, 1.0);\n }\n ";static FRAGMENT_SHADER="#version 300 es\n precision mediump float;\n in vec2 texCoord;\n uniform sampler2D videoTexture;\n out vec4 fragColor;\n\n void main() {\n fragColor = texture(videoTexture, texCoord);\n }\n ";constructor(){}preview(e,t,i){const r=t.getContext("webgl2"),s=this.#e(r,Ns.VERTEX_SHADER,Ns.FRAGMENT_SHADER),o=r.getAttribLocation(s,"position"),a=r.getUniformLocation(s,"videoTexture");r.useProgram(s);const n=this.#t(r);r.bindBuffer(r.ARRAY_BUFFER,n),r.enableVertexAttribArray(o),r.vertexAttribPointer(o,2,r.FLOAT,!1,0,0),this.frame({glContext:r,program:s,positionAttributeLocation:o,textureLocation:a,positionBuffer:n,viewport:i,source:e})}frame(e){const t=e.glContext;e.glContext.clearColor(0,0,0,1),e.glContext.clear(e.glContext.COLOR_BUFFER_BIT),e.glContext.viewport(e.viewport.x,e.viewport.y,e.viewport.w,e.viewport.h),e.glContext.enable(e.glContext.DEPTH_TEST);const i=e.glContext.createTexture();t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,i),t.uniform1i(e.textureLocation,0),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e.source),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),e.glContext.drawArrays(e.glContext.TRIANGLE_STRIP,0,4),requestAnimationFrame((()=>this.frame(e)))}#e(e,t,i){const r=this.#i(e,e.VERTEX_SHADER,t),s=this.#i(e,e.FRAGMENT_SHADER,i);let o=e.createProgram();return e.attachShader(o,r),e.attachShader(o,s),e.linkProgram(o),o}#i(e,t,i){const r=e.createShader(t);return e.shaderSource(r,i),e.compileShader(r),r}#t(e){const t=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,t),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,null),t}}const xs=Ns;class Ls{static VERTEX_SHADER="\n struct VertexOutput {\n @builtin(position) Position: vec4<f32>,\n @location(0) uv: vec2<f32>,\n }\n\n @vertex\n fn vert_main(@builtin(vertex_index) VertexIndex: u32) -> VertexOutput {\n var pos = array<vec2<f32>, 6>(\n vec2<f32>( 1.0, 1.0),\n vec2<f32>( 1.0, -1.0),\n vec2<f32>(-1.0, -1.0),\n vec2<f32>( 1.0, 1.0),\n vec2<f32>(-1.0, -1.0),\n vec2<f32>(-1.0, 1.0)\n );\n\n var uv = array<vec2<f32>, 6>(\n vec2<f32>(1.0, 0.0),\n vec2<f32>(1.0, 1.0),\n vec2<f32>(0.0, 1.0),\n vec2<f32>(1.0, 0.0),\n vec2<f32>(0.0, 1.0),\n vec2<f32>(0.0, 0.0)\n );\n\n var output : VertexOutput;\n output.Position = vec4<f32>(pos[VertexIndex], 0.0, 1.0);\n output.uv = uv[VertexIndex];\n return output;\n }\n ";static FRAG_SHADER_VF="\n @group(0) @binding(0) var mySampler: sampler;\n @group(0) @binding(1) var vfTexture: texture_external;\n\n @fragment\n fn frag_main(@location(0) uv : vec2<f32>) -> @location(0) vec4<f32> {\n var color0: vec4<f32> = textureSampleBaseClampToEdge(vfTexture, mySampler, uv);\n return color0;\n }\n ";constructor(){}async preview(e,t,i){if(!e||!t||!i)throw new Error("Invalid arguments: source, target, or viewport is missing");const r=await navigator.gpu.requestAdapter(),s=await r.requestDevice(),o=navigator.gpu.getPreferredCanvasFormat(),a=t.getContext("webgpu");a.configure({device:s,format:o,alphaMode:"opaque"});const n=s.createSampler({}),d=s.createRenderPipeline({layout:"auto",vertex:{module:s.createShaderModule({code:Ls.VERTEX_SHADER}),entryPoint:"vert_main"},fragment:{module:s.createShaderModule({code:Ls.FRAG_SHADER_VF}),entryPoint:"frag_main",targets:[{format:o}]},primitive:{topology:"triangle-list"}}),c={device:s,context:a,pipeline:d,sampler:n,source:e,viewport:i};this.frame(c)}frame(e){const t=e.device.createCommandEncoder(),i={colorAttachments:[{view:e.context.getCurrentTexture().createView(),loadOp:"clear",storeOp:"store"}]},r=t.beginRenderPass(i);r.setPipeline(e.pipeline);const s=e.device.createBindGroup({layout:e.pipeline.getBindGroupLayout(0),entries:[{binding:0,resource:e.sampler},{binding:1,resource:e.device.importExternalTexture({source:e.source})}]});r.setBindGroup(0,s),r.setViewport(e.viewport.x,e.viewport.y,e.viewport.w,e.viewport.h,0,1),r.draw(6),r.end(),e.device.queue.submit([t.finish()]),requestAnimationFrame((()=>this.frame(e)))}}const Ws=Ls;class Us{constructor(){}preview(e,t,i,r){let s=null;1==e?i.srcObject=t:2==e?(s=new Vs,s.preview(t,i,r)):3==e?(s=new xs,s.preview(t,i,r)):4==e&&(s=new Ws,s.preview(t,i,r))}static getInstance(){return Us.instance||(Us.instance=new Us),Us.instance}}const Bs=Us;class Fs extends ms{constructor(){super(...arguments),this.renderType=zr.InsideCanvasRender,this.rendersProxy=Bs.getInstance(),this.videoSource=null}createSource(e,t,i){return r=this,s=void 0,a=function*(){const r=document.createElement("video");return r.width=t,r.height=i,r.loop=!0,r.autoplay=!0,r.muted=!0,r.srcObject=e,yield r.play(),r},new((o=void 0)||(o=Promise))((function(e,t){function i(e){try{d(a.next(e))}catch(e){t(e)}}function n(e){try{d(a.throw(e))}catch(e){t(e)}}function d(t){var r;t.done?e(t.value):(r=t.value,r instanceof o?r:new o((function(e){e(r)}))).then(i,n)}d((a=a.apply(r,s||[])).next())}));var r,s,o,a}addRender(e){e.renderType&&e.srcObject&&!this.videoSource&&(this.videoSource&&(this.videoSource=null),this.createSource(e.srcObject,e.width,e.height).then((t=>{this.videoSource=t,this.rendersProxy.preview(e.renderType,this.videoSource,e.canvas,{x:e.x,y:e.renderType===jr.WebGPU?e.top:e.y,w:e.width,h:e.height})})))}zoomRender(e){e.renderType&&this.videoSource&&(this.videoSource.width!==e.width&&(this.videoSource.width=e.width),this.videoSource.height!==e.height&&(this.videoSource.height=e.height))}stopRender(e){e.renderType&&this.videoSource&&(this.videoSource.srcObject=null,this.videoSource=null)}}class Hs extends vs{constructor(){super(...arguments),this.renderType=zr.InsideVideoTagRender,this.rendersProxy=Bs.getInstance()}addRender(e){e.srcObject&&e.videodom&&this.rendersProxy.preview(jr.VideoTag,e.srcObject,e.videodom)}stopRender(e){e.videodom.srcObject=null}}const Gs="node-id",js="media-type",Ks="video-quality",zs="share-source",qs="fill-mode",Ys="stop-no-clean",Xs="refresh-key";class Qs extends HTMLElement{static get observedAttributes(){return[Gs,js,Ks,Xs,zs]}constructor(){super(),this.container=null,this.subRenderList=[],this.borderRadius=null,this._srcObject=null,this.innerContainer=null,Qr(this,Qs.customAttributes),this.getRenderParams=this.getParsedParams.bind(this),this.callback=(e,t)=>{var i,r,s;e===Ur.MOBILE_CAPTURE_DEVICE_CHANGE&&t===this.getAttribute(Gs)&&this.initRender(),e===Ur.SELF_PREVIEW_WATERMARK_CHANGE&&this.getAttribute(Gs)&&(null===(i=this.getCurrentMediaSDK())||void 0===i?void 0:i.isSelfUser(this.getAttribute(Gs)))&&this.initRender(),e!==Ur.ADD_PSL_MIX_SHARE_INFO&&e!==Ur.UPDATE_PSL_MIX_SHARE_INFO||this.getAttribute(js)===Fr.Share||!(null===(s=null===(r=this.getCurrentMediaSDK())||void 0===r?void 0:r.isPslVideo)||void 0===s?void 0:s.call(r,this.getAttribute(Gs)))||t&&this.initPslMixShareSubRender(t),e===Ur.REMOVE_PSL_MIX_SHARE_INFO&&this.subRenderList.length>0&&this.removePslMixShareSubRender(t.shared_source_id),e===Ur.SHARING_FIRST_DECODE_FRAME_RECEIVED_SSRC&&this.subRenderList.forEach((e=>{var i,r;e.source===t.ssrc&&(null===(i=e.render)||void 0===i||i.init(),null===(r=e.render)||void 0===r||r.playVideo(String(e.source)),e.isRendered=!0,setTimeout((()=>{hs(e.element,e.position)}),1e3))}))}}initPslMixShareSubRender(e){var t;const{rect_x_norm:i,rect_y_norm:r,rect_cx_norm:s,rect_cy_norm:o}=e,a=e.shared_source_id;let n=this.subRenderList.find((e=>e.source===a));if(n){if(n.position&&n.position.left===i&&n.position.top===r&&n.position.width===s&&n.position.height===o)return;n.position={left:i,top:r,width:s,height:o}}else n={source:a,position:{left:i,top:r,width:s,height:o}},n.render=this.createSubRender(this.getRenderContext()),n.element=function(e){const t=document.createElement("div");return t.style.position="absolute",t.style.zIndex="1000",e&&t.appendChild(e),t}(n.render.getElement()),null===(t=this.innerContainer)||void 0===t||t.appendChild(n.element),this.subRenderList.push(n);this.subRenderList.forEach((e=>{var t,i,r,s;(null===(i=null===(t=this.getCurrentMediaSDK())||void 0===t?void 0:t.isShareFirstFrameReceived)||void 0===i?void 0:i.call(t,e.source))&&(null===(r=e.render)||void 0===r||r.init(),null===(s=e.render)||void 0===s||s.playVideo(String(e.source)),e.isRendered=!0),e.isRendered&&hs(e.element,e.position)}))}removePslMixShareSubRender(e){var t,i;const r=this.subRenderList.findIndex((t=>t.source===e));-1!==r&&(null===(t=this.subRenderList[r].render)||void 0===t||t.destroy(),null===(i=this.subRenderList[r].element)||void 0===i||i.remove(),this.subRenderList.splice(r,1))}initRender(){var e,t,i,r,s,o,a;if(this.render&&(this.render.destroy(),this.subRenderList.forEach((e=>{var t,i;null===(t=e.render)||void 0===t||t.destroy(),null===(i=e.element)||void 0===i||i.remove()}))),null===(e=this.getContainer())||void 0===e?void 0:e.useInsideRender())return this.render=this.createInsideRender(),this.shadowRoot&&(this.shadowRoot.innerHTML="",this.shadowRoot.appendChild(this.render.getElement())),this.render.init({borderRadius:this.borderRadius}),void(this.srcObject&&this.render.playVideo(this.srcObject));const n=this.getRenderContext(),d=this.getExpectedRenderConstructor(n);if(this.render=new d(n.container,n.renderParams),this.getCurrentMediaSDK()&&this.render){const e=this.subRenderList.map((e=>{var t;return null===(t=e.render)||void 0===t?void 0:t.renderType}));ns(this.getCurrentMediaSDK(),`VPREN:${this.render.renderType}${this.subRenderList.length>0?` PSLREN:${e.join(",")}`:""}`)}this.innerContainer&&(this.innerContainer.innerHTML="",this.render&&this.innerContainer.appendChild(this.render.getElement())),null===(t=this.render)||void 0===t||t.init({borderRadius:this.borderRadius});const c=this.getAttribute(Gs);if(!rs(c)){if(null===(r=null===(i=this.getCurrentMediaSDK())||void 0===i?void 0:i.isPslVideo)||void 0===r?void 0:r.call(i,c)){const e=null===(o=null===(s=this.getCurrentMediaSDK())||void 0===s?void 0:s.getPslMixShareInfo)||void 0===o?void 0:o.call(s);e&&this.initPslMixShareSubRender(e)}null===(a=this.render)||void 0===a||a.playVideo(c)}}get srcObject(){return this._srcObject}set srcObject(e){var t,i,r,s;!this._srcObject&&e?null===(t=this.render)||void 0===t||t.playVideo(e):this._srcObject&&e?(null===(i=this.render)||void 0===i||i.stopVideo(),null===(r=this.render)||void 0===r||r.playVideo(e)):this._srcObject&&(null===(s=this.render)||void 0===s||s.stopVideo()),this._srcObject=e}getContainer(){return this.container||(this.container=this.closest(`${qr.get("tagName")}-container`)),this.container}getCurrentMediaSDK(){var e,t;return Zr(null===(t=null===(e=this.getContainer())||void 0===e?void 0:e.getSessionId)||void 0===t?void 0:t.call(e))}getParsedParams(){var e,t;return{fillMode:$r(this,qs),doNotClean:$r(this,Ys),isFromMainSession:"main"===this.getAttribute(zs),videoQuality:this.getAttribute(Ks),renderType:null!==(t=null===(e=this.getContainer())||void 0===e?void 0:e.getInsideRenderType())&&void 0!==t?t:jr.Unknown}}connectedCallback(){var e;this.style.display||(this.style.display="block"),this.innerContainer||(this.innerContainer=function(){const e=document.createElement("div");return e.style.width="100%",e.style.height="100%",e.style.position="relative",e.style.borderRadius="inherit",e}(),this.appendChild(this.innerContainer)),Jr(this,Qs.defaultValues),this.initRender(),null===(e=this.getCurrentMediaSDK())||void 0===e||e.addCallback(this.callback),this.removeSubscribe=qr.subscribe(((e,t,i)=>{var r,s,o,a;"failover"===e&&i===((null===(s=null===(r=this.getContainer())||void 0===r?void 0:r.getSessionId)||void 0===s?void 0:s.call(r))||Br)&&(this.initRender(),rs(this.getAttribute(Gs))||null===(o=this.render)||void 0===o||o.playVideo(this.getAttribute(Gs)),this.srcObject&&(null===(a=this.render)||void 0===a||a.playVideo(this.srcObject)))})),this.removeStyleListener=function(e,t){let i=null;const r=()=>{let r=getComputedStyle(e).borderRadius;r&&"0px"!==r&&"0%"!==r?(i=r,t(ls(r))):i&&(t(ls("0%")),i=null)};r();const s=new MutationObserver((()=>r()));return s.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{s.disconnect()}}(this,(e=>{var t,i;this.borderRadius=e,e&&(null===(i=null===(t=this.render)||void 0===t?void 0:t.updateBorderRadius)||void 0===i||i.call(t,e))}))}disconnectedCallback(){var e,t,i,r;null===(e=this.removeSubscribe)||void 0===e||e.call(this),null===(t=this.removeStyleListener)||void 0===t||t.call(this),null===(i=this.render)||void 0===i||i.destroy(),this.subRenderList.forEach((e=>{var t,i;null===(t=e.render)||void 0===t||t.destroy(),null===(i=e.element)||void 0===i||i.remove()})),this.callback&&(null===(r=this.getCurrentMediaSDK())||void 0===r||r.removeCallback(this.callback))}shouldUpdateRender(){var e;return(null===(e=this.render)||void 0===e?void 0:e.constructor)!==this.getExpectedRenderConstructor(this.getRenderContext())}attributeChangedCallback(e,t,i){var r,s,o,a,n,d,c,l,h;if(this.render)switch(e){case Gs:if(this.shouldUpdateRender()&&this.initRender(),rs(t)||this.render.stopVideo(),rs(i)||this.render.playVideo(i),(null===(s=null===(r=this.getCurrentMediaSDK())||void 0===r?void 0:r.isPslVideo)||void 0===s?void 0:s.call(r,t))&&this.removePslMixShareSubRender(Number(t)),null===(a=null===(o=this.getCurrentMediaSDK())||void 0===o?void 0:o.isPslVideo)||void 0===a?void 0:a.call(o,i)){const e=null===(d=null===(n=this.getCurrentMediaSDK())||void 0===n?void 0:n.getPslMixShareInfo)||void 0===d?void 0:d.call(n);e&&this.initPslMixShareSubRender(e)}break;case zs:case js:this.initRender();break;case Ks:null===(c=this.render)||void 0===c||c.updateVideoQuality(i);break;case Xs:rs(i)||null===(h=null===(l=this.render)||void 0===l?void 0:l.refresh)||void 0===h||h.call(l)}}createInsideRender(){var e;const t=null===(e=this.getContainer())||void 0===e?void 0:e.getInsideRenderType();if(t===jr.VideoTag)return new Hs(this.getContainer());if([jr.WebGL,jr.WebGL2,jr.WebGPU].includes(t))return new Fs(this.getContainer(),this.getRenderParams);throw new Error(`Unsupported inside render type: ${t}`)}getRenderContext(){var e,t;const i=this.getCurrentMediaSDK(),r=this.getAttribute(Gs);return{mediaType:this.getAttribute(js),nodeId:r,shareSource:this.getAttribute(zs),isWebRTC:null==i?void 0:i.getWebRTCFlag(),wasmRenderingMethod:null===(e=null==i?void 0:i.getWasmRenderingMethod)||void 0===e?void 0:e.call(i),isPreviewVideotag:r&&(null==i?void 0:i.isPreviewVideotag(r)),isSharePreviewVideotag:r&&"main"!==this.getAttribute(zs)&&(null===(t=null==i?void 0:i.isSharePreviewVideotag)||void 0===t?void 0:t.call(i,r)),container:this.getContainer(),renderParams:this.getRenderParams}}getExpectedRenderConstructor(e){const{mediaType:t,isWebRTC:i,isSharePreviewVideotag:r,isPreviewVideotag:s,wasmRenderingMethod:o}=e;if(t===Fr.Preview)return i?Ms:"video-tag"===o?Cs:Ds;if(t===Fr.Share)return r?Ts:"video-tag"===o?ys:Rs;if(t===Fr.Video)return i?ws:s?Is:"video-tag"===o?As:bs;throw new Error(`Unsupported media type: ${t}`)}createSubRender(e){return new("video-tag"===e.wasmRenderingMethod?ks:Ps)(e.container,e.renderParams)}}Qs.customAttributes=[Gs,js,Ks,zs,qs,Ys,Xs],Qs.defaultValues={[Gs]:"",[js]:Fr.Video};const Js="session-id",$s="z-index",Zs="inside-render",eo="label";class to extends HTMLElement{static get observedAttributes(){return[Js,$s,Zs]}get pipWindow(){var e,t;return"documentPictureInPicture"in window&&function(){const e=cs();try{return!!(null==e?void 0:e.location.origin)}catch(e){return!1}}()&&(null===(t=null===(e=cs())||void 0===e?void 0:e.documentPictureInPicture)||void 0===t?void 0:t.window)||void 0}constructor(){super(),this.canvasId="video-player-canvas-"+(this.getAttribute(eo)?`${this.getAttribute(eo)}-`:"")+es(),this.needInitCanvas=!1,this.canvasMap={},this.canvasKeys=["annoCanvas","previewCanvas","localShareCanvas"],this.needInitCanvasMap={annoCanvas:!1,previewCanvas:!1,localShareCanvas:!1},this.listenerList=[],this.pipListenerList=[],this.callback=null,Qr(this,to.customAttributes);const e=this.attachShadow({mode:"open"}),t=document.createElement("slot");this.appendCanvas=(i,r=t)=>{e.insertBefore(i,r)},e.appendChild(t)}connectedCallback(){this.style.display||(this.style.display="block"),this.style.position||(this.style.position="relative"),Jr(this,to.defaultValues),this.needInitCanvas&&this.initCanvasEvents(),this.canvasKeys.forEach((e=>{if(this.needInitCanvasMap[e]){const t=this[e];t&&this.initCanvasListenerList(t)}})),this.removeSubscribe=qr.subscribe(((e,t,i)=>{"failover"===e&&i===(this.getSessionId()||Br)&&(this.replaceCanvas(),this.initCanvasEvents(),this.canvasKeys.forEach((e=>{const t=this[e];t&&this.initCanvasListenerList(t)})))}))}removeFromShadowRoot(e){if(!this.shadowRoot)return;let t=e;for(;t;){if(null===t.parentNode)return;if(t.parentNode===this.shadowRoot)break;t=t.parentNode}t.remove()}disconnectedCallback(){var e,t,i,r;null===(e=this.removeListener)||void 0===e||e.call(this),this.resetPIPListener(),this.listenerList.length&&this.listenerList.forEach((e=>e())),null===(t=this.removeSubscribe)||void 0===t||t.call(this),this.canvas&&(null===(i=Zr(this.getSessionId()))||void 0===i||i.Notify_MeidaSDK(Wr.REMOVE_EXPIRED_CANVAS,{canvasId:this.canvasId}),this.canvas.remove(),this.canvas=void 0),this.canvasMap&&(Object.values(this.canvasMap).forEach((e=>{var t;null===(t=Zr(this.getSessionId()))||void 0===t||t.Notify_MeidaSDK(Wr.REMOVE_EXPIRED_CANVAS,{canvasId:e.id}),e.remove()})),this.canvasMap={}),this.canvasKeys.forEach((e=>{const t=this[e];t&&(this.removeFromShadowRoot(t),this[e]=void 0)})),this.callback&&(null===(r=Zr(this.getSessionId()))||void 0===r||r.removeCallback(this.callback))}attributeChangedCallback(e,t,i){e===$s&&this.canvas&&i&&(this.canvas.style.zIndex=i)}adoptedCallback(){ns(this.getCurrentMediaSDK(),"VPADOP:"+!!this.pipWindow),this.pipWindow?this.canvas&&(this.resetPIPListener(),this.removePIPListener=Xr(this.canvas,this,!0,this.pipWindow,(e=>ns(this.getCurrentMediaSDK(),e))),this.canvasKeys.forEach((e=>{const t=this[e];t&&this.pipListenerList.push(Xr(t,this,!1,this.pipWindow))}))):this.resetPIPListener()}resetPIPListener(){var e;null===(e=this.removePIPListener)||void 0===e||e.call(this),this.removePIPListener=void 0,this.pipListenerList.length&&this.pipListenerList.forEach((e=>e())),this.pipListenerList=[]}initCanvasListenerList(e){this.listenerList.push(Xr(e,this,!1)),this.pipWindow&&this.pipListenerList.push(Xr(e,this,!1,this.pipWindow))}createCanvas(){this.getCurrentMediaSDK()&&ns(this.getCurrentMediaSDK(),"VPCC"),this.canvas=Yr(this.clientWidth,this.clientHeight,this.getAttribute($s)||"",this.canvasId,(e=>ns(this.getCurrentMediaSDK(),e))),this.appendCanvas(this.canvas),this.isConnected?this.initCanvasEvents():this.needInitCanvas=!0}createPreviewCanvas(){this.getCurrentMediaSDK()&&ns(this.getCurrentMediaSDK(),"VPCC"),this.previewCanvas=Yr(this.clientWidth,this.clientHeight,this.getAttribute($s)||"",this.canvasId+"-anno-presenter",(e=>ns(this.getCurrentMediaSDK(),e))),this.appendCanvas(this.previewCanvas)}createLocalShareCanvas(){this.getCurrentMediaSDK()&&ns(this.getCurrentMediaSDK(),"VPCC"),this.localShareCanvas=Yr(this.clientWidth,this.clientHeight,this.getAttribute($s)||"",this.canvasId+"-local-share",(e=>ns(this.getCurrentMediaSDK(),e))),this.appendCanvas(this.localShareCanvas),this.isConnected?this.initCanvasListenerList(this.localShareCanvas):this.needInitCanvasMap.localShareCanvas=!0}createAnnoCanvas(){this.annoCanvas=Yr(this.clientWidth,this.clientHeight,this.getAttribute($s)||"",this.canvasId+"-anno",(e=>ns(this.getCurrentMediaSDK(),e))),this.appendCanvas(this.annoCanvas),this.isConnected?this.initCanvasListenerList(this.annoCanvas):this.needInitCanvasMap.annoCanvas=!0}initCanvasEvents(){var e;this.removeListener=Xr(this.canvas,this,!0,window,(e=>ns(this.getCurrentMediaSDK(),e))),this.pipWindow&&(this.removePIPListener=Xr(this.canvas,this,!0,this.pipWindow,(e=>ns(this.getCurrentMediaSDK(),e)))),this.callback=(e,t)=>{var i,r;e===Ur.WEBGL_LOST_IN_MULTI_VIEW&&t.replaceCanvas&&t.canvasId===(null===(i=this.canvas)||void 0===i?void 0:i.id)&&(this.replaceCanvas(),null===(r=Zr(this.getSessionId()))||void 0===r||r.Notify_MeidaSDK(Wr.WEBGL_LOST_REPLACE_CANVAS,{canvasId:this.canvasId,canvas:this.canvas}))},null===(e=this.getCurrentMediaSDK())||void 0===e||e.addCallback(this.callback)}replaceCanvas(){var e;if(this.getCurrentMediaSDK()&&ns(this.getCurrentMediaSDK(),"VPRC"),this.canvas){null===(e=this.removeListener)||void 0===e||e.call(this);const t=Yr(this.clientWidth,this.clientHeight,this.getAttribute($s)||"",this.canvasId,(e=>ns(this.getCurrentMediaSDK(),e)));this.removeListener=Xr(t,this,!0,window,(e=>ns(this.getCurrentMediaSDK(),e))),this.pipWindow&&(this.removePIPListener=Xr(this.canvas,this,!0,this.pipWindow,(e=>ns(this.getCurrentMediaSDK(),e)))),this.shadowRoot&&this.shadowRoot.replaceChild(t,this.canvas),this.canvas=t}if(this.annoCanvas){const e=Yr(this.clientWidth,this.clientHeight,this.getAttribute($s)||"",this.canvasId+"anno",(e=>ns(this.getCurrentMediaSDK(),e)));this.shadowRoot&&this.shadowRoot.replaceChild(e,this.annoCanvas),this.annoCanvas=e}}getResizeStrategy(){return this.getAttribute("resize-strategy")||Kr.Debounce}getCanvas(){return this.canvas||this.createCanvas(),this.canvas}createCanvasById(e){const t=Yr(this.clientWidth,this.clientHeight,this.getAttribute($s)||"",e,(e=>ns(this.getCurrentMediaSDK(),e)));this.appendCanvas(t),this.canvasMap[e]=t}getCanvasById(e){return this.canvasMap[e]||this.createCanvasById(e),this.canvasMap[e]}getPreviewCanvas(){return this.previewCanvas||this.createPreviewCanvas(),this.previewCanvas}getLocalShareCanvas(){return this.localShareCanvas||this.createLocalShareCanvas(),this.localShareCanvas}getAnnoCanvas(){return this.annoCanvas||this.createAnnoCanvas(),this.annoCanvas}useInsideRender(){return null!==this.getAttribute(Zs)&&void 0!==this.getAttribute(Zs)&&"false"!==this.getAttribute(Zs)&&"0"!==this.getAttribute(Zs)}getInsideRenderType(){return Number(this.getAttribute("inside-render-type"))}getSessionId(){return this.getAttribute(Js)||void 0}getCurrentMediaSDK(){return Zr(this.getSessionId())}getRGBA(){return function(e){let t=0,i=0,r=0,s=0;if("r"===e[0])if("a"===e[3]){const o=e.slice(5,-1).split(",").map((e=>parseInt(e.trim(),10)));t=o[0],i=o[1],r=o[2],s=o[3]}else{const s=e.slice(4,-1).split(",").map((e=>parseInt(e.trim(),10)));t=s[0],i=s[1],r=s[2]}else if("#"===e[0]){let s=e.slice(1);3===s.length&&(s=s.split("").map((e=>e.repeat(2))).join(""));const o=parseInt(s,16);t=o>>16&255,i=o>>8&255,r=255&o}return{R:t/255,G:i/255,B:r/255,A:s}}(getComputedStyle(this).getPropertyValue("background-color"))}}to.customAttributes=[],to.defaultValues={};var io=i(9310);class ro{constructor(){let{enable:e=!1,interval:t=1e3,computePressureManager:i=null,reportFunc:r=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.userId=0,this.enabled=e,this.interval=t,this.computePressureManager=i,this.reportFunc=r,this.timer=null,this.monitorInterval=5e3,this.monitorTimer=null,this.cpuRecords=[],this.maxCpuRecords=12,this.enabled&&this.start()}startMonitor(){this.computePressureManager&&!this.monitorTimer&&(this.monitorTimer=setInterval((()=>{var e;const t=null!==(e=this.computePressureManager.getPressureLevel())&&void 0!==e?e:"";if(this.cpuRecords.push(t),this.cpuRecords.length>=this.maxCpuRecords){const e=this.cpuRecords.filter((e=>"number"==typeof e&&!isNaN(e)));let t="",i="",r="";if(e.length>0){let s=e[0],o=e[0],a=e[0];for(let t=0;t<e.length;t++){const i=e[t];i<s&&(s=i),i>o&&(o=i),a+=i}t=s,i=o,r=(a/e.length).toFixed(1)}const s="WCL_SYS_INFO,".concat(this.userId,",{[CPU]},").concat(t,",").concat(r,",").concat(i,",").concat(this.cpuRecords.join(","),",{[END]}");this.cpuRecords=[],D.A.send_monitor_directly(s)}}),this.monitorInterval))}stopMonitor(){this.monitorTimer&&(clearInterval(this.monitorTimer),this.monitorTimer=null,this.cpuRecords=[])}collectSystemState(){var e;const t=null===(e=this.computePressureManager)||void 0===e?void 0:e.getPressureLevel();if(void 0!==t)return{cpu_usage:{system_cpu_pressure_level:t}}}report(){const e=this.collectSystemState();var t;e&&(null===(t=this.reportFunc)||void 0===t||t.call(this,e))}start(){this.timer||(this.timer=setInterval((()=>this.report()),this.interval),this.enabled=!0)}stop(){this.timer&&(clearInterval(this.timer),this.timer=null),this.enabled=!1}setInterval(e){this.interval=e}setUserId(e){this.userId=e}}var so,oo=i(4468),ao=function(e,t,i,r){return new(i||(i=Promise))((function(s,o){function a(e){try{d(r.next(e))}catch(e){o(e)}}function n(e){try{d(r.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,n)}d((r=r.apply(e,t||[])).next())}))},no=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(i[r[s]]=e[r[s]])}return i};const co=null===(so=document.currentScript)||void 0===so?void 0:so.src,lo=new class{constructor(){this._isReuseStreamEnabled=!1,this._isStreamInReuseMap=new Map,this.presetedConstraints={audioConstraints:null,videoConstraints:null,audioTimer:null,videoTimer:null},this._deprecatedStream={audio:[],video:[]},this._captureVideoDeferred=null,this._iOSAudioDeviceLabelMonitor=null,this.audioConstraints=null,this._audioStream=null,this.isCaptureAudioInProgress=!1,this.audioCaptureElapsedTime=0,this.videoConstraints=null,this.videoStream=null,this.videoStreamTrack=null,this.captureVideoTimer=null,this.checkVideoStreamActiveTimer=null,this.isCaptureVideoInProgress=!1,this.isCapturingAudioFromDefault=!1,this.cachedUpgradeVideoConstraints={width:0,height:0,frameRate:0,aspectRatio:void 0},this._streamProcessAbility=void 0,this.mediaStreamTrackProcessor=null,this.reableStream=null,this.isSupportFullHD=!1,this.facingMode=P.HE,this.VBMFlag=!1,this.webrtcAudio=null,this.webrtcFlag=!1,this.processedStream=null,this.vbStream=null,this.vb=null,this.isVBEnabled=!1,this.updateVideoStream=null,this.isCaptureAudioFromFile=!1,this.blockUpgradeCapture={},this.videoCaptureSuccessHandler=null,this.videoCaptureFailedHandler=null,this.receivedVideoConstraints=null,this.onVBResolutionChange=null,this.mediaSDKCDNPath="",this.hardcodeconstraints=!1}get audioStream(){return this._audioStream}set audioStream(e){Zi.setStream(e),this._audioStream=e}get streamProcessAbility(){return void 0===this._streamProcessAbility&&(this._streamProcessAbility={isSupportMediaStreamTrackProcessor:a.Ay.isSupportMediaStreamTrackProcessor()}),this._streamProcessAbility}enableReuseStream(e){this._isReuseStreamEnabled=!!e}_updateStreamInReuse(e,t){t?this._isStreamInReuseMap.set(e,!0):this._isStreamInReuseMap.delete(e)}_isStreamInReuse(e){return!!this._isStreamInReuseMap.get(e)}presetConstraints(e){let{audioConstraints:t,videoConstraints:i}=e;t&&(this.presetedConstraints.audioConstraints=this._getAudioConstraints(t)),i&&(this.presetedConstraints.videoConstraints=this._getVideoConstraints(i))}_clearPresetConstraints(){this.presetedConstraints.audioConstraints=null,this.presetedConstraints.videoConstraints=null}_getPresetAudioConstraints(){const{audioConstraints:e}=this.presetedConstraints;return this._clearPresetConstraints(),!(!e||this.audioStream||this.isCaptureAudioInProgress)&&e}_getPresetVideoConstraints(){const{videoConstraints:e}=this.presetedConstraints;return this._clearPresetConstraints(),!(!e||this.videoStream||this.isCaptureVideoInProgress)&&e}_pushDeprecatedStream(e){let{audioStream:t=null,videoStream:i=null}=e;t&&this._deprecatedStream.audio.push(t),i&&this._deprecatedStream.video.push(i)}_destoryDeprecatedStream(e){let{audio:t=null,video:i=null}=e;t&&(this._deprecatedStream.audio.forEach((e=>{try{this._destoryStream(e)}catch(e){c.Ay.error("Error when destroying deprecated audio stream",e)}})),this._deprecatedStream.audio=[]),i&&(this._deprecatedStream.video.forEach((e=>{try{this._destoryStream(e)}catch(e){c.Ay.error("Error when destroying deprecated video stream",e)}})),this._deprecatedStream.video=[])}setStreamProcessAbility(e){let{isSupportMediaStreamTrackProcessor:t}=e;this._streamProcessAbility=Object.assign(Object.assign({},this._streamProcessAbility),void 0!==t?{isSupportMediaStreamTrackProcessor:t}:{})}_isFileInputAudioSource(e){return e&&(e.audio instanceof HTMLVideoElement||e.audio instanceof HTMLAudioElement)}_getAudioConstraints(e){let{audioSource:t,enableOriginalSound:i,enableStereo:r}=e;if(t instanceof HTMLVideoElement||t instanceof HTMLAudioElement)return{audio:t};let s=null;return a.Ay.getOSInfo(),s={deviceId:t?{exact:t}:a.Ay.isSupportDefaultDeviceId()?{exact:"default"}:void 0,autoGainControl:a.Ay.isSupportAudioAGC()&&!i,noiseSuppression:a.Ay.isSupportAudioNS()&&!i,latency:0,echoCancellation:a.Ay.isSupportAudioAEC()&&!r,channelCount:2,sampleRate:48e3},s}_isSameAudioConstraintsAsPrev(e){return!(this._isFileInputAudioSource(e)||!this.audioConstraints||!(0,a.bD)(this.audioConstraints,e)||!this.audioStream||!this._isStreamHasAudio(this.audioStream))}_destoryStream(e){let{audioOnly:t=!1,videoOnly:i=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e&&!a.Ay.audioToMediaStreamMananger.isAudioFileStream(e)){let r=[];r=t?e.getAudioTracks():i?e.getVideoTracks():e.getTracks(),r.forEach((e=>{e.stop()}))}}_isStreamHasAudio(e){const t=e.getAudioTracks();return t&&t.length>0}_isStreamHasVideo(e){const t=e.getVideoTracks();return t&&t.length>0}destoryAudioMediaStream(){this.audioStream?(this._isFileInputAudioSource(this.audioConstraints)&&a.Ay.audioToMediaStreamMananger.stopCapture(),this._isReuseStreamEnabled?this._updateStreamInReuse(this.audioStream,!0):(this._updateStreamInReuse(this.audioStream,!1),this._destoryStream(this.audioStream),this._destroyIOSAudioDeviceMonitor(),this.audioStream=null,this.audioConstraints=null,this.audioCaptureElapsedTime=0,this._destoryDeprecatedStream({audio:!0}))):this._destoryDeprecatedStream({audio:!0}),this.enableReuseStream(!1)}shouldCaptureAudio(){return!this.audioStream||this._isStreamInReuse(this.audioStream)}muteUnmuteAudioMediaStream(e){this.audioStream&&(this.audioStream.getAudioTracks()||[]).forEach((t=>{t.enabled=!e}))}_storeAudioStream(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e&&(ho("audio stream is ok"),this.destoryAudioMediaStream(),this.audioStream=e,this.audioConstraints=t,i&&this._setPresetAudioStreamAutoStopTimer())}_setPresetAudioStreamAutoStopTimer(){this._clearPresetAudioStreamAutoStopTimer(),this.presetedConstraints.audioTimer=setTimeout((()=>{this.destoryAudioMediaStream()}),1e4)}_clearPresetAudioStreamAutoStopTimer(){this.presetedConstraints.audioTimer&&(clearTimeout(this.presetedConstraints.audioTimer),this.presetedConstraints.audioTimer=null)}addAudioTrackSettingsMonitor(e,t){const i=null==e?void 0:e.getSettings();D.A.add_monitor(t+":"+(null==i?void 0:i.channelCount)+":"+(null==i?void 0:i.echoCancellation)+":"+(null==i?void 0:i.autoGainControl)+":"+(null==i?void 0:i.noiseSuppression))}_addIOSAudioDeviceMonitor(e){a.Ay.isIphoneOrIpadSafari()&&(this._destroyIOSAudioDeviceMonitor(),this._iOSAudioDeviceLabelMonitor=new tr(e),this._iOSAudioDeviceLabelMonitor.onChange(Ji))}_destroyIOSAudioDeviceMonitor(){this._iOSAudioDeviceLabelMonitor&&(this._iOSAudioDeviceLabelMonitor.destroy(),this._iOSAudioDeviceLabelMonitor=null)}_handleAudioCaptureSuccess(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this._clearPresetAudioStreamAutoStopTimer(),r||this._storeAudioStream(e,t),this._updateStreamInReuse(e,!1);let s=e.getAudioTracks()[0];s?(D.A.add_monitor("ATRS:"+s.readyState+":"+s.id),D.A.add_monitor("ATMS:"+s.muted+":"+s.id),this.addAudioTrackSettingsMonitor(s,"NormalAudioCapture"),s.onended=()=>ao(this,void 0,void 0,(function*(){if(!(yield Ce.A.hasPermission("microphone")))return D.A.add_monitor("ATRS:"+s.readyState+":"+s.id+":-R"),void(0,h.iK)(n.UyE,h.pg.PERMISSION_RESET);(yield Yi.isSelectedDeviceExistAsync())?((0,h.iK)(n.UyE,h.pg.EXCEPTION),D.A.add_monitor("ATRS:"+s.readyState+":"+s.id+":-L")):D.A.add_monitor("ATRS:"+s.readyState+":"+s.id+":-I")})),s.muted?(d.A.Notify_APPUI_SAFE(n.qRr,P.ON),this.webrtcAudio&&(this.webrtcAudio.isMutedBySystem=!0)):(d.A.Notify_APPUI_SAFE(n.FjO),this.webrtcAudio&&(this.webrtcAudio.isMutedBySystem=!1)),s.onmute=()=>{D.A.add_monitor("ATMS:"+s.muted+":"+s.id);const e=this.audioStream.getAudioTracks()[0];e&&e.id===s.id&&(this.webrtcAudio&&(this.webrtcAudio.isMutedBySystem=!0),d.A.Notify_APPUI_SAFE(n.qRr,P.Mm))},s.onunmute=()=>{D.A.add_monitor("ATMS:"+s.muted+":"+s.id);const e=this.audioStream.getAudioTracks()[0];e&&e.id===s.id&&(this.webrtcAudio&&(this.webrtcAudio.muted||this.webrtcAudio.unmute(),this.webrtcAudio.isMutedBySystem=!1),d.A.Notify_APPUI_SAFE(n.FjO))},this._addIOSAudioDeviceMonitor(s)):D.A.add_monitor("TN"),i(e)}_genAudioStream(e){try{const t=e.getAudioTracks();return 0===t.length?null:new MediaStream(t)}catch(t){return c.Ay.warn("_genAudioStream",t),this._destoryStream(e,{videoOnly:!0}),e}}_genVideoStream(e){try{const t=e.getVideoTracks();return 0===t.length?null:new MediaStream(t)}catch(t){return c.Ay.warn("_genVideoStream",t),this._destoryStream(e,{audioOnly:!0}),e}}_splitAudioStream(e,t,i,r){const{audio:s,video:o}=t;if(o&&this._isStreamHasVideo(e)){const t=this._genAudioStream(e),a=this._genVideoStream(e);return t?this._handleAudioCaptureSuccess(t,s,i):r(new Error("audio stream do not contains audio track ")),void(a&&(this.videoStream?this._pushDeprecatedStream({videoStream:a}):(this._updateStreamInReuse(a,!0),this._storeVideoStream(a,o,!0))))}this._handleAudioCaptureSuccess(e,s,i)}_captureFileInputAudioStream(e){return ao(this,void 0,void 0,(function*(){const{audio:t}=e;try{if(!(yield new Promise(((e,i)=>{t.currentTime>0&&!t.paused&&!t.ended&&e(!0);const r=()=>{e(!0),t.removeEventListener("timeupdate",r)};t.addEventListener("timeupdate",r),setTimeout((()=>i(!1)),1e4)}))))throw new Error("audio file playing failed");return a.Ay.audioToMediaStreamMananger.startCapture(t)}catch(e){console.error(e);const t=new Error("capture stream from file input souce failed");throw t.name="FileInputSouceError",t}}))}startCaptureAudio(e){return ao(this,arguments,void 0,(function(e){var t=this;let{audioConstraints:i,successHandler:r,errorHandler:s}=e;return function*(){var e,o,n;t.enableReuseStream(!1);const l=!!i&&t._getAudioConstraints(i),h=t._isFileInputAudioSource(l);t.isCaptureAudioFromFile=h;const u=t._isSameAudioConstraintsAsPrev(l),p=t._getPresetVideoConstraints();if(t._clearPresetAudioStreamAutoStopTimer(),u)return t.audioCaptureElapsedTime=-2,void t._handleAudioCaptureSuccess(t.audioStream,l,r,!0);const f={audio:l,video:h?null:p};t.isCaptureAudioInProgress=!0;let m=Date.now();a.Ay.isIphoneOrIpadSafari()&&(t._captureVideoDeferred&&(yield t._captureVideoDeferred.promise),t._captureVideoDeferred=new a.cY),t.destoryAudioMediaStream(),null===(e=t.webrtcAudio)||void 0===e||e.setAudioStreamCloning(null),D.A.add_monitor("RGUMA"),document.removeEventListener("visibilitychange",uo),t.isCapturingAudioFromDefault="default"===(null===(o=null==f?void 0:f.audio)||void 0===o?void 0:o.deviceId)||!(null===(n=null==f?void 0:f.audio)||void 0===n?void 0:n.deviceId),(h?t._captureFileInputAudioStream(l):Yi.captureAudioStreamWithRetry(f,t.isCapturingAudioFromDefault,i.retry)).then((e=>{if(d.A.ComputerAudioStatus===E.BX.ComputerAudio_Null)return c.Ay.log("getUserMedia successfully but UI has called leave audio"),void e.getAudioTracks().forEach((e=>{e.stop()}));t.audioCaptureElapsedTime=Date.now()-m,t._splitAudioStream(e,f,r,s)})).catch((e=>{var t;d.A.ComputerAudioStatus!==E.BX.ComputerAudio_Null?(h||Ce.A.updateSelectedMicDevices((null===(t=l.deviceId)||void 0===t?void 0:t.exact)||"default","getUsermedia failed",Date.now()-m,!1),s(e)):c.Ay.log("getUserMedia failed but UI has called leave audio")})).finally((()=>{var e;t.isCaptureAudioInProgress=!1,t._captureVideoDeferred&&t._captureVideoDeferred.resolve(),null===(e=t.webrtcAudio)||void 0===e||e.triggerPlayerHealthCheck(P.vr.CAPTURE_AUDIO)}))}()}))}_isFileInputVideoSource(e){return e&&e.video instanceof HTMLVideoElement}isUsingFileInputVideoSource(){return this._isFileInputVideoSource(this.videoConstraints)}_getFileInputSourceSize(e,t){const i=[90,180,360,720];return t||(t=360),t>720&&(t=720),t<90&&(t=90),-1===i.indexOf(t)&&i.some(((e,r)=>e>t&&(t=(e+i[r-1])/2<t?e:i[r-1],!0))),{width:16/9*t,height:t}}_removeMaxInVideoConstraints(e){return a.Ay.browser.isFirefox?(e.width&&"object"==typeof e.width&&delete e.width.max,e.height&&"object"==typeof e.height&&delete e.height.max,e.frameRate&&"object"==typeof e.frameRate&&delete e.frameRate.max,e):e}_getVideoConstraints(e){let{videoSource:t,usingFacingMode:i,width:r,height:s,pan:o,tilt:n,zoom:d,fps:c}=e;if(t instanceof HTMLVideoElement)return Object.assign({video:t},r&&s?this._getFileInputSourceSize(r,s):{});let l={};const{width:h,height:u,frameRate:p,aspectRatio:f}=this.cachedUpgradeVideoConstraints,m=h>0&&u>0&&p>0;let v=P.Fw;c>=P.UW&&c<=P.O8&&(v=c);const g=m?p:v,_={max:P.Fw,ideal:g};let S=m?h:r||640,A=m?u:s||(i?480:360);(S>=1920&&!a.Ay.get1080pcapacity()||this.webrtcFlag&&S>=1280)&&(S=1280,A=720);const y={max:S,ideal:S},C={max:A,ideal:A},E=m?f:void 0;return i?["user","environment","left","right"].includes(t)?l={width:y,height:C,frameRate:_,aspectRatio:E,facingMode:{exact:t}}:t&&(l={width:y,height:C,frameRate:_,aspectRatio:E,deviceId:{exact:t}}):l={width:y,height:C,deviceId:t?{exact:t}:void 0,frameRate:_,aspectRatio:E,pan:o,tilt:n,zoom:d},this._removeMaxInVideoConstraints(l)}_getVideoIdealWidthHeightFramerate(e){let{videoSource:t,usingFacingMode:i,width:r,height:s,fps:o}=e;const a=[[1280,720],[640,360],[320,180]];if(t instanceof HTMLVideoElement)return!0;if(i)return!0;{const{width:e,height:t,frameRate:i}=this.cachedUpgradeVideoConstraints,n=e>0&&t>0&&i>0;let d=n?e:r||640,c=n?t:s||360,l=n?i:o||P.Fw,h=a.find((e=>320==e[0]||e[0]<d));return d=h[0],c=h[1],{width:{ideal:d},height:{ideal:c},frameRate:{ideal:l}}}}_updateVideoConstraints(e){return this.videoStreamTrack?"ended"===this.videoStreamTrack.readyState?this.recaptureVideoAfterVideoTrackEnded(e):this.videoStreamTrack.applyConstraints(e).catch((t=>{const{readyState:i}=this.videoStreamTrack;if(c.Ay.error("Applying video constraints failed: readyState: ".concat(i,", constraints: ").concat(JSON.stringify(e)),t),"ended"===this.videoStreamTrack.readyState){const{deviceId:e}=this.videoStreamTrack.getSettings();this.blockUpgradeCapture[e]=!0;const{width:t,height:i}=this.cachedUpgradeVideoConstraints;let r=Object.assign({},this.receivedVideoConstraints);t&&(r.width=t),i&&(r.height=i),this.recaptureVideoAfterVideoTrackEnded(r).catch((e=>{c.Ay.error("Recapture video failed: ",e),D.A.add_monitor("RECPF")}))}return Promise.reject(t)})):Promise.reject(new Error("video stream not exist! update video constraints failed"))}recaptureVideoAfterVideoTrackEnded(e){return this.destoryVideoMediaStream(),this.startCaptureVideo({videoConstraints:e,timeout:null})}changeVideoResolution(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(this.isUsingFileInputVideoSource()||this.hardcodeconstraints)return Promise.reject(new Error("Reject upgrade caputre, reason: using file input video source"));if(this.videoStreamTrack){if(e>=1920&&!this.isSupportFullHD&&(e=1280,t=720),this.videoStreamTrack.getSettings){let r=this.videoStreamTrack.getSettings();if(Math.abs(r.width-e)<50)return Promise.reject(new Error("Reject upgrade caputre, reason: width change less than 50"));if((e>r.width||t>r.height||i>r.frameRate)&&this.blockUpgradeCapture[r.deviceId])return Promise.reject(new Error("Reject upgrade caputre, reason: block upgrade capture"))}D.A.add_monitor("CCWidth"+e);let s=P.Fw;i>=P.UW&&i<=P.O8&&(s=i);const o={max:P.Fw,ideal:s},n={width:{max:e,ideal:e},height:{max:t,ideal:t},frameRate:o,aspectRatio:r?{ideal:16/9}:void 0},d=this._removeMaxInVideoConstraints(n);return D.A.add_monitor("UVCP:".concat((0,a.iD)(JSON.stringify(d)))),this._updateVideoConstraints(d).then((()=>{if(this.cachedUpgradeVideoConstraints={width:e,height:t,frameRate:d.frameRate.ideal,aspectRatio:d.aspectRatio},this.webrtcFlag&&this.isVideoStreamProcessed()){const e=this.videoStream.getVideoTracks()[0];if(e){const{width:t,height:i}=e.getSettings();return new Promise(((e,r)=>{const s=setTimeout((()=>{this.onVBResolutionChange=null,r(new Error("wmsc vb module upgrade resolution failed in 150ms"))}),150);this.onVBResolutionChange=r=>{r.width===t&&r.height===i&&(clearTimeout(s),this.onVBResolutionChange=null,e())}}))}return Promise.reject(new Error("upgrade video success but not video track"))}}))}return Promise.reject(new Error("video stream not exist! change video resolution failed"))}_isSameVideoConstraintsAsPrev(e){return!(this._isFileInputVideoSource(e)||!this.videoConstraints||!(0,a.bD)(this.videoConstraints,e)||!this.videoStream||!this._isStreamHasVideo(this.videoStream))}_clearCaptureVideoTimer(){this.captureVideoTimer&&(clearTimeout(this.captureVideoTimer),this.captureVideoTimer=null)}destoryVideoMediaStream(){this.videoStream?(this._isFileInputVideoSource(this.videoConstraints)&&a.Ay.videoToMediaStreamManager.stopCapture(),this.vbStream&&this.stopVBStream(),this.processedStream=null,this._isReuseStreamEnabled?this._updateStreamInReuse(this.videoStream,!0):(this._updateStreamInReuse(this.videoStream,!1),this._destoryStream(this.videoStream),this.videoStream=null,this.videoStreamTrack=null,this.videoConstraints=null,this._destoryDeprecatedStream({video:!0}))):this._destoryDeprecatedStream({video:!0}),this._isReuseStreamEnabled||this._clearCaptureVideoTimer(),this.enableReuseStream(!1),this.destoryVideoProcessor(),this._clearCheckVideoStreamActiveTimer()}shouldCaptureVideo(){if(this.videoStream){const e=this.videoStream.getVideoTracks()[0];((null==e?void 0:e.muted)||"ended"===(null==e?void 0:e.readyState))&&(D.A.add_monitor("DEVS-".concat(null==e?void 0:e.muted,"-").concat(null==e?void 0:e.readyState)),this.destoryVideoMediaStream())}return!this.videoStream||this._isStreamInReuse(this.videoStream)}_clearCheckVideoStreamActiveTimer(){this.checkVideoStreamActiveTimer&&(clearTimeout(this.checkVideoStreamActiveTimer),this.checkVideoStreamActiveTimer=null)}checkVideoStreamActive(){return new Promise(((e,t)=>{this._clearCheckVideoStreamActiveTimer(),this.checkVideoStreamActiveTimer=setTimeout((()=>{this.videoStream?!1===this.videoStream.active?t(new h.iG("VideoMediaStram.active equals false")):e(!0):t(!1)}),1e3)}))}destoryVideoProcessor(){this.streamProcessAbility.isSupportMediaStreamTrackProcessor&&(this.mediaStreamTrackProcessor=null,l.Notify_Video_Encode_Thread({command:"releaseStream"}),this.reableStream=null)}_createVideoProcessor(){this.videoStreamTrack?this.streamProcessAbility.isSupportMediaStreamTrackProcessor&&("function"==typeof MediaStreamTrackProcessor&&(this.mediaStreamTrackProcessor=new MediaStreamTrackProcessor({track:this.videoStreamTrack}),this.reableStream=this.mediaStreamTrackProcessor.readable),l.Notify_Video_Encode_Thread({command:"releaseStream"}),this.reableStream?l.Notify_Video_Encode_Thread_Transferable_Data("frameStream",this.reableStream,vo()):l.Notify_Video_Encode_Thread_Transferable_Data(Zt.VIDEO_TRACK,this.videoStreamTrack,vo(),!1),D.A.add_monitor("VCTP")):c.Ay.error("Video stream track does not exist - cannot create video processor")}_storeVideoStream(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e&&(ho("video stream is ok"),this.destoryVideoMediaStream(),this.videoStream=e,this.videoStreamTrack=this.videoStream.getVideoTracks()[0],this.videoConstraints=t,i&&this._setPresetVideoStreamAutoStopTimer())}_setPresetVideoStreamAutoStopTimer(){this._clearPresetVideoStreamAutoStopTimer(),this.presetedConstraints.videoTimer=setTimeout((()=>{this.destoryVideoMediaStream()}),1e4)}_clearPresetVideoStreamAutoStopTimer(){this.presetedConstraints.videoTimer&&(clearTimeout(this.presetedConstraints.videoTimer),this.presetedConstraints.videoTimer=null)}_handleVideoCaptureSuccess(e,t,i,r){let s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];this._clearPresetVideoStreamAutoStopTimer(),s||this._storeVideoStream(e,t),this.webrtcFlag||this._createVideoProcessor(),this._updateStreamInReuse(e,!1),this.isVBEnabled?this.startVBStream().then((()=>{i(e)})).catch((e=>{r(e)})):i(e)}getVideoCapabilities(){if(this.videoStream&&(this.videoStreamTrack||(this.videoStreamTrack=this.videoStream.getVideoTracks()[0]),this.videoStreamTrack)){if(this.videoStreamTrack.getCapabilities)return this.videoStreamTrack.getCapabilities()||{};if(this.videoStreamTrack.getSettings)return this.videoStreamTrack.getSettings()||{}}return{}}getAudioCapabilities(){let e=null,t=null;if(this.audioStream){let i=this.audioStream.getAudioTracks()[0];i&&(e=i.getSettings().deviceId,t=i.label)}return{deviceId:e,elapsed_time:this.audioCaptureElapsedTime,deviceLabel:t}}getAudioDeviceId(){return this.isCapturingAudioFromDefault?null:this.getAudioCapabilities().deviceId}_splitVideoStream(e,t,i,r){const{audio:s,video:o}=t;if(s&&this._isStreamHasAudio(e)){const t=this._genVideoStream(e),a=this._genAudioStream(e);return t?this._handleVideoCaptureSuccess(t,o,i,r):r(new Error("video stream do not contains video track ")),void(a&&(this.audioStream?this._pushDeprecatedStream({audioStream:a}):(this._updateStreamInReuse(a,!0),this._storeAudioStream(a,s,!0))))}this._handleVideoCaptureSuccess(e,o,i,r)}_captureFileInputVideoStream(e){return ao(this,void 0,void 0,(function*(){const{video:t}=e;try{if(!(yield new Promise(((e,i)=>{t.currentTime>0&&!t.paused&&!t.ended&&e(!0);const r=()=>{e(!0),t.removeEventListener("timeupdate",r)};t.addEventListener("timeupdate",r),setTimeout((()=>i(!1)),1e4)}))))throw new Error("video file playing failed");if(!e.width||!e.height){const{width:i,height:r}=this._getFileInputSourceSize(t.videoWidth,t.videoHeight);e.width=i,e.height=r}return a.Ay.videoToMediaStreamManager.startCapture(t,e.width,e.height)}catch(e){console.error(e);const t=new Error("capture stream from file input souce failed");throw t.name="FileInputSouceError",t}}))}startCaptureVideo(e){return ao(this,arguments,void 0,(function(e){var t=this;let{videoConstraints:i,timeout:r,successHandler:s=this.videoCaptureSuccessHandler,errorHandler:o=this.videoCaptureFailedHandler}=e;return function*(){var e,d,l,u,p,f,m,v,g;let _;t.videoCaptureSuccessHandler=s,t.videoCaptureFailedHandler=o,t.receivedVideoConstraints=i,t._captureVideoDeferred&&(yield t._captureVideoDeferred.promise),t.enableReuseStream(!1),i.customConstraints?(_=i.customConstraints,t.hardcodeconstraints=!0):(t.hardcodeconstraints=!1,_=!!i&&t._getVideoConstraints(i));const S=t._isFileInputVideoSource(_),A=t._isSameVideoConstraintsAsPrev(_),y=t._getPresetAudioConstraints();if(t._clearPresetVideoStreamAutoStopTimer(),D.A.add_monitor("STARTVIDEOCAPTURE:".concat(!!t._captureVideoDeferred,":").concat(A)),A)return void t._handleVideoCaptureSuccess(t.videoStream,_,s,o,!0);t.destoryVideoMediaStream();let C={audio:S?null:y,video:_};ho("try to getusermedia",C),D.A.add_monitor("VCFC: ".concat((0,a.iD)(JSON.stringify((0,a.MB)(C))),"|isFileInputVideoSource:").concat(S)),c.Ay.log("VCFC: ".concat(JSON.stringify((0,a.VC)(C)),"|isFileInputVideoSource:").concat(S));try{t.isCaptureVideoInProgress=!0;let A,y=!1;t._clearCaptureVideoTimer();const E=r||3e4;E&&(t.captureVideoTimer=setTimeout((()=>ao(t,void 0,void 0,(function*(){if(!A){const e=yield Ce.A.hasPermission("camera");if(e&&(D.A.add_monitor("CAMERANORES"),(0,h.iK)(n.x3x,h.pg.EXCEPTION)),r||e){y=!0;const e=new Error("GetUserMedia timeout");o(e)}}}))),E));let b=Date.now();if(S)A=yield t._captureFileInputVideoStream(_);else try{A=yield x.A.getUserMedia(C)}catch(e){let r=!0;if(t.hardcodeconstraints||"OverconstrainedError"!==(null==e?void 0:e.name))o(e);else{c.Ay.error("capture video OverconstrainedError"),r=t._getVideoIdealWidthHeightFramerate(i),r instanceof Object&&(r=Object.assign({},C.video,r));try{C=Object.assign({},C,{video:r}),D.A.add_monitor("CVCFC: ".concat((0,a.iD)(JSON.stringify((0,a.MB)(C))))),c.Ay.log("CVCFC: ".concat(JSON.stringify((0,a.VC)(C)))),A=yield x.A.getUserMedia(C),o(new Error("fallback OverconstrainedError success, ".concat(null==e?void 0:e.name,":").concat(null==e?void 0:e.message)),!0)}catch(e){o(e)}}}if(t._clearCaptureVideoTimer(),!A)return void o(new Error("capture error and return"),!0);{let i=A.getVideoTracks()[0];if(i&&i.getCapabilities){let r=i.getCapabilities();(null===(e=null==r?void 0:r.width)||void 0===e?void 0:e.max)>=1920&&(t.isSupportFullHD=!0)}let r=i.getSettings();const{width:s,height:o,frameRate:n,facingMode:h,deviceId:_,aspectRatio:S}=r||{};t.facingMode="user"===h?P.MJ:"environment"===h?P.uu:P.HE;const E={width:s,height:o,frameRate:n,facingMode:h,aspectRatio:S};D.A.add_monitor("CapturedVT: ".concat((0,a.iD)(JSON.stringify(E)))),c.Ay.log("CapturedVT: ".concat(JSON.stringify(Object.assign(Object.assign({},E),{deviceId:(0,c.hZ)(_)})))),(null===(l=null===(d=null==C?void 0:C.video)||void 0===d?void 0:d.height)||void 0===l?void 0:l.ideal)===o&&(null===(p=null===(u=null==C?void 0:C.video)||void 0===u?void 0:u.width)||void 0===p?void 0:p.ideal)===s||c.Ay.error("captured video resolution does not match the final video constraitns, finalConstraints: ".concat(null===(m=null===(f=null==C?void 0:C.video)||void 0===f?void 0:f.width)||void 0===m?void 0:m.ideal,"x").concat(null===(g=null===(v=null==C?void 0:C.video)||void 0===v?void 0:v.height)||void 0===g?void 0:g.ideal,", actual: ").concat(s,"x").concat(o));let w=i.label;if(y)return t._destoryStream(A),void Ce.A.updateSelectedCameraDevices(_,w,s,o,n,Date.now()-b,!1);Ce.A.updateSelectedCameraDevices(_,w,s,o,n,Date.now()-b,!0)}t._splitVideoStream(A,C,s,o)}catch(e){o(e)}finally{t.isCaptureVideoInProgress=!1}}()}))}playVideoStream(e){if(e){e.setAttribute("muted",""),e.setAttribute("playsinline","");try{e.srcObject=this.getProcessedVideoStream()}catch(t){e.src=s().createObjectURL(this.getProcessedVideoStream())}const t=e.play();return t?t.then((()=>{})).catch((e=>{if(!e.message.includes("The play() request was interrupted")&&!e.message.includes("The fetching process for the media resource was aborted"))throw c.Ay.warn("Video element playback failed",e),e})):Promise.resolve(void 0)}return Promise.reject(new Error("video dom node not provided!"))}removeVideoStream(e){e&&(!e.paused&&e.pause(),e.srcObject&&(e.srcObject=null),e.src&&(e.src=null))}destoryReuseStream(e){let{audio:t=!1,video:i=!1}=e;this.enableReuseStream(!1),t&&this.destoryAudioMediaStream(),i&&this.destoryVideoMediaStream()}initVB(e){return ao(this,void 0,void 0,(function*(){if(!this.vb){const e=this.mediaSDKCDNPath||co,t=e.substring(0,e.lastIndexOf("/"));let i;this.vb=new ci({cdnPath:t,enableFetchWithCache:d.A.enableFetchWithCache,globalTracingLogger:c.Ay}),this.vb.ontimeout3s=()=>{D.A.add_monitor("VBP3S"),d.A.Notify_APPUI(n.eJx,null)},this.vb.ontimeout10s=()=>{D.A.add_monitor("VBP10S"),d.A.Notify_APPUI(n.IkA,null)},this.vb.onMessage((e=>{const{cmd:t}=e;if(t===$t.VB_MODEL_READY)i=performance.now();else if(t===$t.VB_PREDICT_DONE){const t=performance.now()-i;D.A.add_monitor("VBPOK"+t),D.A.add_monitor("TFBE-"+e.payload)}else t===$t.VB_GENERATE_FIRST_FRAME&&this.isVBEnabled&&this.updateVideoStream?this.updateVideoStream(this.vbStream):t===$t.VB_WORKER_ERROR?("VB_VIDEOFRAME_COPYTO_ERROR"===e.payload.message&&(0,h.iK)(n.sCw),c.Ay.error("VB module error: ",e.payload)):t===$t.VB_RESOLUTION_CHANGE&&this.onVBResolutionChange&&this.onVBResolutionChange(e.payload)})),D.A.add_monitor("CWMSCVB")}this.updateVideoStream=e;try{yield this.vb.initialize(),d.A.Notify_APPUI(n.UsF,null)}catch(e){c.Ay.error("VB initialize failed",e),D.A.add_monitor("VBBEF");const{HjG:t}=n;d.A.Notify_APPUI(n.KqK,t.FAIL)}}))}changeVBImage(e){return ao(this,void 0,void 0,(function*(){if(this.isVBEnabled=!0,"blur"===e?this.vb.set_background_blur():this.vb.set_background_image(e)||c.Ay.error("WebRTC change VB background failed"),!this.vbStream&&this.videoStream)try{yield this.startVBStream()}catch(e){c.Ay.error("WebRTC startVBStream failed",e)}}))}startVBStream(){return this.videoStream.getVideoTracks()[0]?(this.vbStream=this.vb.createStream(),this.vb.captureVideo(this.videoStream)):Promise.reject("start vb stream fail")}stopVBStream(){this.vbStream=null,this.vb.stopCapture(!1)}disableVB(){this.isVBEnabled=!1,this.updateVideoStream&&this.updateVideoStream(this.videoStream),this.stopVBStream()}getVideoStream(){return this.videoStream}getProcessedVideoStream(){return this.processedStream?this.processedStream:this.isVBEnabled?this.vbStream:this.videoStream}isVideoStreamProcessed(){return this.getProcessedVideoStream()!=this.videoStream}getAudioStream(){return this.audioStream}isAudioCaptureProgressing(){return this.isCaptureAudioInProgress}adjustShareResUnder2K(e){return ao(this,void 0,void 0,(function*(){const{height:t,width:i}=e.getSettings(),r=Math.sqrt(t*i/3686400);if(r<=1)return;c.Ay.directReport("Adjust Share Res original size: ".concat(i,"x").concat(t));const s=Math.floor(t/r),o=Math.floor(i/r),a=e.getConstraints();a.height=s,a.width=o;try{yield e.applyConstraints(a);const t=e.getSettings();c.Ay.directReport("Adjust Share Res new size: ".concat(t.width,"x").concat(t.height))}catch(t){c.Ay.error("applyConstraints for share track failed",t),D.A.add_monitor("SVSTACF: ".concat(e.readyState))}}))}getScaledResolution(e,t){if(e>t&&e>2560){let i=e/2560,r=t/1440;return i>r?{w:2560,h:Math.floor(t/i)}:{w:Math.floor(e/r),h:1440}}return{w:e,h:t}}},ho=(0,u.A)("sdk");function uo(){document.hidden||(D.A.add_monitor("RE-CAPTURE"),d.A.Notify_APPUI_SAFE(n.hd7),document.removeEventListener("visibilitychange",uo))}let po=!1;try{po=!1}catch(e){}var fo=0;const mo=()=>{switch(window.orientation){case 0:fo=1;break;case 90:fo=2;break;case 180:fo=3;break;default:fo=0}l.Notify_Video_Encode_Thread({command:Zt.ROTATION_EVENT,data:vo()})},vo=()=>{if(null==window.orientation)return 0;let e=fo;return lo.isUsingFileInputVideoSource()&&(e=0),lo.facingMode==P.uu&&(2==fo?e=0:0==fo&&(e=2)),e};function go(e){let t=n.sfr.UNKNOWN_REASON,i="Unknown reason";return"NotAllowedError"===(null==e?void 0:e.name)?"Permission denied by system"===(null==e?void 0:e.message)?(t=n.sfr.SYSTEM_DENIED,i="Permission denied by system"):"Permission denied"===(null==e?void 0:e.message)||(null==e?void 0:e.message.includes("The request is not allowed by the user agent or the platform in the current context"))?(t=n.sfr.USER_DENIED,i="Permission denied by user"):"Permission dismissed"===e.message?(t=n.sfr.USER_DISMISS,i="Permission dismissed by user"):"No AVAudioSessionCaptureDevice device"===e.message&&(t=n.sfr.SYSTEM_DENIED,i="Device access denied by system or browser"):"NotFoundError"===(null==e?void 0:e.name)?"The object can not be found here."===e.message?(t=n.sfr.SYSTEM_DENIED,i="Permission denied by system"):"Requested device not found"===e.message&&(t=n.sfr.NO_DEVICE,i="No device found"):"NotReadableError"!==(null==e?void 0:e.name)&&"TrackStartError"!==(null==e?void 0:e.name)||"Device in use"!==(null==e?void 0:e.message)?"OverconstrainedError"===(null==e?void 0:e.name)&&(t=n.sfr.OVERCONSTRAINED,i="Constraint violation"):(t=n.sfr.DEVICE_IN_USE,i="Device in use"),{errorCode:t,errorMessage:i,error:e}}!function(){try{null===window||void 0===window||window.removeEventListener("orientationchange",mo),null===window||void 0===window||window.addEventListener("orientationchange",mo),mo()}catch(e){}}(),document.addEventListener("visibilitychange",(()=>{let e=a.Ay.getMachineCapability();D.A.add_monitor("page_visibility:".concat(document.visibilityState)),document.hidden?(e.unvisibilitycount++,e.visibility=!1):e.visibility=!0})),(0,O.qK)();const _o=[{bitIndex:ii.n.HW_ENCODER_FOR_360P.index,readCount:1,defaultVal:ii.n.HW_ENCODER_FOR_360P.default},{bitIndex:ii.n.WEBGPU_RENDERER.index,readCount:1,defaultVal:ii.n.WEBGPU_RENDERER.default},{bitIndex:ii.n.VB_ON_SAFARI_17.index,readCount:1,defaultVal:ii.n.VB_ON_SAFARI_17.default},{bitIndex:ii.n.WEBGL2_RENDERER.index,readCount:1,defaultVal:ii.n.WEBGL2_RENDERER.default},{bitIndex:ii.n.AUDIO_ECHO_DETECT.index,readCount:1,defaultVal:ii.n.AUDIO_ECHO_DETECT.default},{bitIndex:ii.n.WEBCODEC_DECODE_OPTION.index,readCount:1,defaultVal:ii.n.WEBCODEC_DECODE_OPTION.default},{bitIndex:ii.n.HW_WEBCODEC_ON_SAFARI.index,readCount:1,defaultVal:ii.n.HW_WEBCODEC_ON_SAFARI.default},{bitIndex:ii.n.HW_DECODE_FOR_360P.index,readCount:1,defaultVal:ii.n.HW_DECODE_FOR_360P.default},{bitIndex:ii.n.WEBCODEC_ON_ANDROID_CHROME.index,readCount:1,defaultVal:ii.n.WEBCODEC_ON_ANDROID_CHROME.default},{bitIndex:ii.n.WEBCODEC_ENCODE_OPT_1ON1.index,readCount:1,defaultVal:ii.n.WEBCODEC_ENCODE_OPT_1ON1.default},{bitIndex:ii.n.CAP_WEBCODEC_SUPPORT.index,readCount:1,defaultVal:ii.n.CAP_WEBCODEC_SUPPORT.default},{bitIndex:ii.n.WEBGL_CANVAS_OPTION_OPT.index,readCount:1,defaultVal:ii.n.WEBGL_CANVAS_OPTION_OPT.default},{bitIndex:ii.n.DEFAULT_RENDERER.index,readCount:1,defaultVal:ii.n.DEFAULT_RENDERER.default},{bitIndex:ii.n.WEB_TRANSPORT_CONTROL.index,readCount:1,defaultVal:ii.n.WEB_TRANSPORT_CONTROL.default},{bitIndex:ii.n.ENABLE_TP_RLB_WEBSOCKET.index,readCount:1,defaultVal:ii.n.ENABLE_TP_RLB_WEBSOCKET.default},{bitIndex:ii.n.ENABLE_TRANSFERABLE_RTC_DATACHANNEL.index,readCount:1,defaultVal:ii.n.ENABLE_TRANSFERABLE_RTC_DATACHANNEL.default},{bitIndex:ii.n.ENABLE_WEBRTC_TURN_SERVERS.index,readCount:1,defaultVal:ii.n.ENABLE_WEBRTC_TURN_SERVERS.default},{bitIndex:ii.n.EXTRA_DEVICE_INTERVAL_ENUMERATE.index,readCount:1,defaultVal:ii.n.EXTRA_DEVICE_INTERVAL_ENUMERATE.default},{bitIndex:ii.n.ENABLE_MEDIA_PROCESSOR.index,readCount:1,defaultVal:ii.n.ENABLE_MEDIA_PROCESSOR.default},{bitIndex:ii.n.MOBILE_FORCE_AUTO_CHOOSE_AUDIO_DEVICE.index,readCount:1,defaultVal:ii.n.MOBILE_FORCE_AUTO_CHOOSE_AUDIO_DEVICE.default},{bitIndex:ii.n.IGNORE_WEBCODEC_WHITELIST.index,readCount:1,defaultVal:ii.n.IGNORE_WEBCODEC_WHITELIST.default},{bitIndex:ii.n.SUPPORT_ANNOTATION.index,readCount:1,defaultVal:ii.n.SUPPORT_ANNOTATION.default},{bitIndex:ii.n.WASM_MOBILE_30FPS.index,readCount:1,defaultVal:ii.n.WASM_MOBILE_30FPS.default},{bitIndex:ii.n.ENABLE_WASM_TAG_RENDERER.index,readCount:1,defaultVal:ii.n.ENABLE_WASM_TAG_RENDERER.default},{bitIndex:ii.n.ENABLE_FALLBACK_TO_TAG_RENDERER.index,readCount:1,defaultVal:ii.n.ENABLE_FALLBACK_TO_TAG_RENDERER.default},{bitIndex:ii.n.ENABLE_WEBRTC_AUDIO_2_0.index,readCount:1,defaultVal:ii.n.ENABLE_WEBRTC_AUDIO_2_0.default},{bitIndex:ii.n.ENABLE_MESH.index,readCount:1,defaultVal:ii.n.ENABLE_MESH.default},{bitIndex:ii.n.MESH_NODE.index,readCount:1,defaultVal:ii.n.MESH_NODE.default},{bitIndex:ii.n.SUPPORT_AV_SIMULTANEOUS_FALLBACK.index,readCount:1,defaultVal:ii.n.SUPPORT_AV_SIMULTANEOUS_FALLBACK.default},{bitIndex:ii.n.ANDROID_WEBCODEC_CAP.index,readCount:1,defaultVal:ii.n.ANDROID_WEBCODEC_CAP.default},{bitIndex:ii.n.HW_ENC_ENABLE_L1T1.index,readCount:1,defaultVal:ii.n.HW_ENC_ENABLE_L1T1.default},{bitIndex:ii.n.ENABLE_TRANSFERABLE_MEDIA_STREAM_TRACK.index,readCount:1,defaultVal:ii.n.ENABLE_TRANSFERABLE_MEDIA_STREAM_TRACK.default},{bitIndex:ii.n.ENABLE_CLONE_AUDIO_STREAM.index,readCount:1,defaultVal:ii.n.ENABLE_CLONE_AUDIO_STREAM.default},{bitIndex:ii.n.MULTISHARE_HIGH_FPS.index,readCount:1,defaultVal:ii.n.MULTISHARE_HIGH_FPS.default},{bitIndex:ii.n.MULTISHARE_LOW_FPS.index,readCount:1,defaultVal:ii.n.MULTISHARE_LOW_FPS.default},{bitIndex:ii.n.ENABLE_SUBSCRIBE_VIDEO_NUMBER_CONTROL.index,readCount:1,defaultVal:ii.n.ENABLE_SUBSCRIBE_VIDEO_NUMBER_CONTROL.default},{bitIndex:ii.n.ENABLE_ADVANCED_FEATURE_ON_LOW_END.index,readCount:1,defaultVal:ii.n.ENABLE_ADVANCED_FEATURE_ON_LOW_END.default},{bitIndex:ii.n.ENABLE_FETCH_WITH_CACHE.index,readCount:1,defaultVal:ii.n.ENABLE_FETCH_WITH_CACHE.default},{bitIndex:ii.n.ENABLE_HW_ENC_RETRY.index,readCount:1,defaultVal:ii.n.ENABLE_HW_ENC_RETRY.default},{bitIndex:ii.n.ENABLE_SUBSCRIBE_VIDEO_FullHD_CONTROL.index,readCount:1,defaultVal:ii.n.ENABLE_SUBSCRIBE_VIDEO_FullHD_CONTROL.default}];(0,it.d)(ke),a.Ay.getDeviceListAsync=Ce.A.getDeviceListAsync.bind(Ce.A);class So{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t,r,s,o,l,u;if(this.videoProcessorWorkerInitPromise=null,this.shareProcessorWorkerInitPromise=null,d.A.timeOrigin||(d.A.timeOrigin=performance.timeOrigin),d.A.activeSdkInstances++,D.A.reset(),Sr.e.reset(),lo.webrtcFlag=!1,this._id=10*Date.now()+d.A.activeSdkInstances,this.publicRootPath="",null===(t=null==e?void 0:e.mediaSDKConfig)||void 0===t?void 0:t.mediaSDKCDNPath){const{mediaSDKCDNPath:t}=e.mediaSDKConfig,r=a.Ay.ensureTrailingSlash(t);i.p=r,this.publicRootPath=r}else{const e=null==co?void 0:co.indexOf("js_media.min.js");if(e){const t=null==co?void 0:co.substring(0,e);i.p=t,this.publicRootPath=t}else ho("could not locate mediaSDKCDNPath")}if(lo.mediaSDKCDNPath=this.publicRootPath,this.lateLoadedAssetsHash={},e.globalTracingLogger&&(c.Ay.setInstance(e.globalTracingLogger,oo.C),c.Ay.flushCacheLog()),c.Ay.clearHighFrequencyLogs(),Math.abs(d.A.timeOrigin+performance.now()-Date.now())>=500&&c.Ay.error("timeOrigin: ".concat(d.A.timeOrigin,", performance.now: ").concat(performance.now(),", Date.now: ").concat(Date.now())),this.isSupportThread="object"==typeof WebAssembly&&"function"==typeof Worker,!this.isSupportThread)throw new Error("Webassemly or worker is not supported on this browser");let p=d.A.sharedBuffer;d.A.reinit(this),p&&(d.A.sharedBuffer=p),this.localLog=null,po&&(this.localLog=new ye,this.localLog.init()),Ce.A.init({onChangeHandler:this.deviceChangeHandler.bind(this)}),this.isLSSPlayer=null===(r=null==e?void 0:e.platformMode)||void 0===r?void 0:r.isLSSPlayer,this.cid="",this.userId=0,this.selfPreviewVideotagList=[],this.sharingCanvasList=[],this.mainSharingCanvas=null,this.annoCanvas=null,this.annoPresenterCanvas=null,this.localShareCanvas=null,this.localShareVideoTag=null,this.localShareCanvasExt=null,this.audioCtx=null,this.sharePreviewVideo=null,this.sharePreviewCanvas=null,this.localShareCanvasWaiting=!1,this.sharingAudioCtx=null,this.webrtcAudioNode=null,this.sharingWebrtcAudioNode=null,this.videoRenderArray=[],this.videoCaptureValue=null,this.audioRenderArray=[],this.audioCapture=null,this.deviceInfo=new Map,this.display=[],this.sampleRate=null===(s=this.audioCtx)||void 0===s?void 0:s.sampleRate,this.videoRenderIntervalHandle=null,this.audioDomNode=null,this.audioSpeakerValue=null,this.audioSpeakerSetErrorCnt=0,this.audioMicSetErrorCnt=0,this.audionoderecordbuffersize=2048,this.lastresidual=null,this.currentactive=0,this.audioPlay=!1,this.sharingInterval=null,this.sharingIntervalTime=100,this.sharingDisplay=null,this.currentshareactive=0,this.activeSpeakerSsrc=0,this.videorenderinterval=30,this.waterMarkCanvas=null,this.videoCaptureHiddenCanvas=null,this.videoCaptureHiddenCanvasCtx=null,this.isSetCursor=!1,this.logon=!1,this.canvas=null,this.firstSetDelay=!0,this.isSelfViewWithVideo=!1,this.isSupportOffscreenCanvas=a.Ay.isSupportOffscreenCanvas(),this.isSupportVideoShare=a.Ay.isSupportVideoShareReceive()&&a.Ay.isSupportVideoShareSend(),this._isSupportMediaStreamTrackProcessor=void 0,this._isSupportVideoFrameOrBitmapCapture=void 0,this.isMultipleCanvasForMultipleView=0,this.isCaputureNodeConnect=!1,this.isSharingCaptureNodeConnect=!1,this.audioWorkletJsPath=null,this.isSupport2DCanvasDrawFrame=a.Ay.isSupport2DCanvasDrawFrame(),this.MaskImage=null,this.BgImage=null,this.bgCanvas=null,this.bgCanvasctx=null,this.isCurrentInMaskStatus=!1,this.isCurrentInNoVBPreviewStatus=!1,this.videoNoVBPreviewCanvas=null,this.videoNoVBPreviewCanvasctx=null,this.isVideoNoVBPreviewCanvasScaled=!1,this.maskCoordinate={dx:0,dy:0,dWidth:0,dHeight:0},this.VideoMaskSettingCanvas=null,this.VideoMaskSettingCanvasctx=null,this.PrevVideoMaskSettingCanvas=null,this.VideoMaskCanvasFillMode=0,this.isMaskSettingOn=!1,this.isMaskSettingStarted=!1,this.MaskData=null,this.MaskSettingVideo=null,this.ReadyCapureWidth=640,this.ReadyCapureHeight=360,this.bgImageCroppingParams={sx:0,sy:0,sw:0,sh:0},this.VideoVBSettingCanvas=null,this.isVBSettingOn=!1,this.sMonitorCaptureFrameCount=0,this.vMonitorCaptureFrameCount=0,this.isStartVideoCapture=!1,this.videoCaptureWidth=0,this.videoCaptureHeight=0,this.videoCaptureContext=null,this.isCreateVideoWaterMark=!1,this.videoWaterMarkName="",this.sharingWaterMarkName="",this.isCreateSharingWaterMark=!1,this.videoWaterMarkParams={},this.sharingWaterMarkParams={},this.isStartDesktopSharing=!1,this.desktopSharingValue=null,this.desktopCaptureContext=null,this.desktopSharingCaptureWidth=0,this.desktopSharingCaptureHeight=0,this.sharingCodecInfo={width:0,height:0},this.desktopSharingSend=!1,this.isdesktopCaptureLoadedmetadata=!1,this.captureVideoOutputCanvasDomList=[],this.captureVideoOutPutVideoDom=null,this.shareTrack=null,this.drawLocalShareInterval=200,this.drawLocalShareIntervalId=null,this.isVideoCaptureLoadedmetadata=!1,this.videoloadmetadataListener=null,this.videoloadedmetadatamonitor=null,this.loadedmetadatamtimeoutcount=0,this.mountoadedmetadatatime=0,this.VALUE_CACHE_FOR_START_CAPTURE_VIDEO={},this.vMonitorCount=0,this.sMonitorCount=0,this.mMonitorCount=0,this.sharingMediaStreamTrackProcessor,this.sharingFrameStream,this.isSendVideoOfflineCanvas=!1,d.A.mediaSDKHandle=this,this._preloadMeetingParam=null,this.is32bitbrowser=!1,this.flipSend=!0,this.mtu_size=0,this.VideoRenderObj=null,this.SharingRenderObj=null,this.rtcConnectionA=null,this.rtcConnectionB=null,this.isLocalP2PSupportedPromise=this.isLSSPlayer?Promise.resolve(!0):a.Ay.checkLocalP2PConnection(),this.isSupportBrowserAec=!0,this.sharingWidthAndHeightInfo={ctiveNodeID:0,height:0,logicHeight:0,logicWidth:0,width:0},this.remoteControl=null,this.isMirrorMyVideo=!1,this.isCanvasScaled=!1,this.isDestroy=!1,this.destoryPromise=null,this.rwgAgentMessageListenerWrapper=this.rwgAgentMessageListener.bind(this),this.bVideoDecodeUsingSAB=a.Ay.isSupportSharedArrayBuffer(),this.bVideoEncodeUsingSAB=a.Ay.isSupportSharedArrayBuffer(),this.bAudioEncodeUsingSAB=a.Ay.isSupportSharedArrayBuffer(),this.bAudioDecodeUsingSAB=a.Ay.isSupportSharedArrayBuffer(),this.videoDecodeRingBuffer=null,this.videoEncodeRingBuffer=null,this.audioDecodeRingBuffer=null,this.audioEncodeRingBuffer=null,this.bVideoEncodeMainThreadConsumerIntervalEnable=a.Ay.isIphoneOrIpadSafari(),this.isSupportOffscreenCanvasForVideoDecode=a.Ay.isSupportOffscreenCanvas(),this.isMultiView=!1,this.checkWorkletInterval=null,this.persistenceInfo=new _i.Y,this.lastRealRect={left:0,top:0,width:0,height:0},this.videodecodehardwareflag=null,this.videoencodehardwareflag=null,this.isEnableVideoDecodeHardWareThread=!1,this.hardwareflag=null,this.isEnableHardWareThread=!1,this.isTeslaMode=!1,this.useWebRTCAudio=!1,this.webrtcAudio=null,this.replaceCanvasMap={},this.hidAvalible=!1,this.enableHID=!1,this.audioInputLevel=null,this.captureAudioMuted=!1,this.setvideokk=!1,this.isStartWhiteboardSharing=!1,this.ZoomMonitor=D.A.add_monitor.bind(D.A),this.isLandScape=!1,this.captureSize=null,this.platformType=P.u7.DESKTOP,(0,h.Xe)(this.ZoomMonitor),this.wmscManager=null,this.webrtcConfig={userId:null,webrtcflag:!1,subscribeQosParamsData:{},currentReloadTimes:0,maxReloadTimes:6},this.allpromises=[],this.RenderInMain=P.p$,this.vcFlag=!1,this.waitingVcChannelReady=!1,be.isSupportComputePressure()&&(this.computePressureManager=new be),this.systemReporter=null,this.renderManager=new Jt("JsMediaSDK"),this.rendererType=-1,this.defaultRendererType=0,this.isWebGPUFeatureEnabled=!1,this.enableVBWasmBackend=0,this.isWebGL2FeatureEnabled=!1,this.isSsrcStreamEnabled=!1,this.isWebTransportAllowed=!0,this.mGPUBlacklist=null,this.mWebCodecConfig=null,this.webrtcVideoCodecConfig=null,this.isWebCodecEncoderOnWhitelist=!1,this.isWebCodecDecoderOnWhitelist=!1,this.checkWebCodecEncoderPromise,this.mediaProcessorConfig=0,this.mediaFeatureOptions="",this.isAnnotationEnabled=!1,this.isAnnotationPMEnabled=!1,this.shareAnnotationInited=!1,this.isWebRTCAudio2Enabled=!1,this.isVideoHD=!1,this.vbResource=null,this.vbSettingDomMap={},this.annotationModule=null,this.annotationMgr=null,this.localAnnoStarted=!1,this.fileAudioPlaybackTag=null,this.initVEPara=null,this.resolveVEwebrtcpromise=null,this.webrtcpromise=new Promise(((e,t)=>{this.resolveVEwebrtcpromise=e})),this.initVDPara=null,this.resolveVDwebrtcpromise=null,this.webrtcVDpromise=new Promise(((e,t)=>{this.resolveVDwebrtcpromise=e})),this.hadsetpropsbeforeinit=!1,this.networkerpath=null,this.dataChannelController=new O.xm,this.dataTransportController=new O.G1,this.dataChannelController.register(),this.dataTransportController.register(),(0,N.tK)(this),(0,N.Nd)(this.workrtHealthCheckReport.bind(this)),this.netThreadMgr=new ir("net",a.Ay.browser.isSafari),this.netThreadMgr.setMonitorLog(this.ZoomMonitor),this.netThreadMgr.setUseTransferRTC((0,a.Yu)()),this.meshThread=null,this.shareStreamScheduler=new Lr,this.processorMessagePort=null,this.shareProcessorMessagePort=null,this.shadowProcessorMessagePort=null,this.shareProcessorWorker=null,this.videoProcessorWorkerInitPromise=null,this.shareProcessorWorkerInitPromise=null,this.statisticsInterval=null,this.shareSubController=new yr(((e,t,i)=>{d.A.Notify_APPUI(n.zj1,{ssrc:e,size:i,fps:i}),D.A.add_monitor2("SDMS:".concat(i))})),this.playFailedTimeout=null,this.resumeWASMAudio=(()=>ao(this,void 0,void 0,(function*(){var e,t,i;c.Ay.directReport("user click screen and try to resume wasm audio");try{(null===(e=this.audioDomNode)||void 0===e?void 0:e.paused)&&(yield this.audioDomNode.play()),this.audioCtx&&"running"!==this.audioCtx.state&&(yield this.audioCtx.resume())}catch(e){c.Ay.error("Error occurs when try to resume audio play",e)}(null===(t=this.audioDomNode)||void 0===t?void 0:t.paused)||this.audioCtx&&"running"!==this.audioCtx.state?c.Ay.directReport("resume audio error, audioDom: ".concat(!(null===(i=this.audioDomNode)||void 0===i?void 0:i.paused),", audioCtx: ").concat(!this.audioCtx||"running"===this.audioCtx.state)):(this.playFailedTimeout&&(clearTimeout(this.playFailedTimeout),this.playFailedTimeout=null),d.A.Notify_APPUI_SAFE(n.raw,P.Fu),c.Ay.directReport("recover audio play success"),D.A.add_monitor("PAS"),document.body.removeEventListener("click",this.resumeWASMAudio))}))).bind(this),this.JsMediaSDK_PreLoad(e),(null==e?void 0:e.rwgAgent)&&this.setRWGAgent(e.rwgAgent),this.isVideoTagFrameAccessible=a.Ay.isSupportVideoFrame()&&((null===(o=a.Ay.browser)||void 0===o?void 0:o.isSafari)||(null===(l=a.Ay.browser)||void 0===l?void 0:l.isFirefox)||(null===(u=a.Ay.browser)||void 0===u?void 0:u.isChromeOrEdge));const f=null==e?void 0:e.useVideoPlayer;this.useVideoPlayer=void 0===f||f}JsMediaSDK_Log(e){c.Ay.error("Error in JsMediaSDK",e)}JsMediaSDK_PreLoad(e){var t,i,r,s;pe.l.init({browser:{brand:a.Ay.browserType.browser,version:a.Ay.browserType.version,isBlink:a.Ay.browserEngine.isBlink,isWebkit:a.Ay.browserEngine.isWebkit},sysinfo:a.Ay.getOSInfo(),gpuinfo:a.Ay.getGpuInfo(),browserVersionInfo:(0,_r.H0)(),isLowerPerformanceDevice:a.Ay.shouldEnableAdvancedFeatureOnLowEnd(),isSwiftShader:a.Ay.isUsingSwiftShader(),isMacIntelSafari:a.Ay.isMacIntelSafari()});const{enableMultiDecodeVideoWithoutSAB:o,enableVirtualBackgroundWithoutSAB:c,disableStreamingInstantiate:h,isVDIWebview:u,shouldKeepAVWhenFailover:p}=e||{};this.globalTracingLogger=e.globalTracingLogger,this.mid=e.mid,this.meetingNumber=e.meetingNumber,this.isSessionBranding=e.isSessionBranding,this.mediaSDKConfig=e.mediaSDKConfig,this.vbResource=[{type:"bin",path:"".concat(null===(t=this.mediaSDKConfig)||void 0===t?void 0:t.mediaSDKCDNPath,"/vb-resource/dualModel.bin")},{type:"js",path:"".concat(null===(i=this.mediaSDKConfig)||void 0===i?void 0:i.mediaSDKCDNPath,"/vb-resource/tf.min.js")}],this.platformMode=e.platformMode,this.isLSSPlayer&&(d.A.isLSSPlayer=this.isLSSPlayer,this.isSupportVideoShare=!1,this.audioCtx=(0,a.Bw)(),this.gainNode=this.audioCtx.createGain(),(0,a.SE)(this.audioCtx));let f=this.mediaSDKConfig.mediaSDKCDNPath;const m=e.callback;d.A.decoderinworkletOP=!0,d.A.isDesktopMode=this.platformMode.isDesktopMode,d.A.enableStreamingInstantiate=!h,d.A.enableMultiDecodeVideoWithoutSAB=o,d.A.enableVirtualBackgroundWithoutSAB=!0,this.isTeslaMode=!!this.platformMode.isTeslaMode,d.A.isGoogleMeetMode=this.platformMode.isGoogleMeetMode,d.A.isVDIWebview=u,d.A.shouldKeepAVWhenFailover=p,u&&(this.isSupportVideoShare=!1),d.A.isSupportVideoShare=this.isSupportVideoShare,f?(ue.X.setBaseScriptUrl(f),this.getFilePath=this.makFilePath(f,f)):(null===(r=this.publicRootPath)||void 0===r?void 0:r.endsWith("/"))?this.getFilePath=this.makFilePath(this.publicRootPath.slice(0,-1)):this.getFilePath=this.makFilePath(this.publicRootPath);let v=(null===(s=this.getFilePath)||void 0===s?void 0:s.call(this))||f,g={audioWorkletPath:v.audioWorkletPath,audioWorkletSIMDPath:a.Ay.isAudioWASMLight()?v.audioWorkletLightSIMDPath:v.audioWorkletSIMDPath,audioWorkletProcessPath:v.audioWorkletProcessPath,sharingAudioWorkletPath:v.sharingAudioWorkletPath,audioLevelWorkletPath:a.Ay.isAudioWASMLight()?v.audioLevelWorkletLightPath:v.audioLevelWorkletPath,audioWasm:v.audioWasm,audioSIMDWasm:a.Ay.isAudioWASMLight()?v.audioLightSIMDWasm:v.audioSIMDWasm};this.networkerpath=null==v?void 0:v.netThreadPath,this.iceServers=[],this.stunServers=[],this.setProps({callback:m,audioWorkletPath:g,fromPreload:!0}),this._preloadMeetingParam=v,l.Start_Monitor(this),this.handleUnloadEvent(),D.A.add_monitor("JSPLD"),l.Start_Recv_StatsMap_Clear_Handle(),this.computePressureManager&&this.computePressureManager.init(),this.systemReporter=new ro({computePressureManager:this.computePressureManager,reportFunc:e=>d.A.Notify_APPUI(n.Fjw,e)}),this.systemReporter.startMonitor();const _=null==v?void 0:v.netThreadPath,S=null==v?void 0:v.netWasm;this.netThreadMgr&&_&&S&&(this.netThreadMgr.setPathAnsWasm(_,S),this.netThreadMgr.init())}getWebRTCFlag(){return this.webrtcConfig&&this.webrtcConfig.webrtcflag}getWasmRenderingMethod(){switch(this.rendererType){case B.h3.WEBGL:return"webgl";case B.h3.WEBGPU:return"webgpu";case B.h3.WEBGL_2:return"webgl2";case B.h3.VIDEO_TAG:return"video-tag";default:return""}}createSsrcStreamWithRender(e,t,i,r){const s=sr.getSsrcKind(e,i);return new fr(e,s,r,{renderTarget:t,autoPlay:!0})}get base(){return ke}get isSupportMediaStreamTrackProcessor(){return void 0===this._isSupportMediaStreamTrackProcessor&&(this._isSupportMediaStreamTrackProcessor=a.Ay.isSupportMediaStreamTrackProcessor()),this._isSupportMediaStreamTrackProcessor}get isSupportVideoFrameOrBitmapCapture(){return void 0===this._isSupportVideoFrameOrBitmapCapture&&(this._isSupportVideoFrameOrBitmapCapture=a.Ay.isSupportVideoFrameOrBitmapCapture()),this._isSupportVideoFrameOrBitmapCapture}makFilePath(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return t||(t=e),function(){return e?{audioWorkerPath:"".concat(e,"/js_audio_process.min.js"),audioWorkletPath:"".concat(e,"/js_audio_worklet.min.js"),audioWorkletSIMDPath:"".concat(e,"/js_audio_worklet_simd.min.js"),audioWorkletLightSIMDPath:"".concat(e,"/js_audio_worklet_light_simd.min.js"),audioWorkletProcessPath:"".concat(e,"/js_audio_worklet_process.min.js"),audioWasm:"".concat(t,"/audio.encode.wasm"),mediaWorkerPath:"".concat(e,"/media.worker.js"),videoWorkerPath:"".concat(e,"/video_s.min.js"),videoMtWorkerPath:"".concat(e,"/video_m.min.js"),videoWasm:"".concat(t,"/video.decode.wasm"),videoMtWasm:"".concat(t,"/video.mt.wasm"),sharingWorkerPath:"".concat(e,"/sharing_s.min.js"),sharingMtWorkerPath:"".concat(e,"/sharing_m.min.js"),videoSIMDWorkerPath:"".concat(e,"/video_simd.min.js"),videoSIMDWasm:"".concat(t,"/video.simd.wasm"),sharingSIMDWorkerPath:"".concat(e,"/sharing_simd.min.js"),videoMSIMDWasm:"".concat(t,"/video.mtsimd.wasm"),sharingMSIMDWorkerPath:"".concat(e,"/sharing_mtsimd.min.js"),videoMSIMDWorkerPath:"".concat(e,"/video_mtsimd.min.js"),audioSIMDWorkletPath:"".concat(e,"/audio_simd.min.js"),audioLightSIMDWorkletPath:"".concat(e,"/audio_light_simd.min.js"),audioSIMDWasm:"".concat(t,"/audio.simd.wasm"),audioLightSIMDWasm:"".concat(t,"/audio.light.simd.wasm"),vsmiworkerpath:"".concat(e,"/video_share_mtsimd.min.js"),sharingAudioWorkletPath:"".concat(e,"/js_sharing_audio_worklet.min.js"),audioLevelWorkletPath:"".concat(e,"/js_audio_level_worklet_process.min.js"),audioLevelWorkletLightPath:"".concat(e,"/js_audio_level_worklet_process_light.min.js"),netThreadPath:"".concat(e,"/net_thread.min.js"),meshTread:"".concat(e,"/mesh_thread.min.js"),netWasm:"".concat(t,"/net.wasm")}:void 0}}isPreviewVideotag(e){return this.userId&&this.userId>>10==Number(e)>>10&&a.Ay.isSelfPreviewRenderWithVideo()}isSharePreviewVideotag(e){return this.userId&&this.userId>>10==Number(e)>>10}isSelfUser(e){return this.userId==e}isPslVideo(e){return Number(e)>>10==d.A.pslVideoId>>10}getPslMixShareInfo(){return d.A.pslMixShareInfo?d.A.pslMixShareInfo:null}isShareFirstFrameReceived(e){return d.A.shareFirstFrameMap.get(e)}recordSharingParamInfo(){let e=this;p.A.on(n.vjv,((t,i)=>{var r;Object.assign(e.sharingWidthAndHeightInfo,i.body),null===(r=e.annotationMgr)||void 0===r||r.updateRemoteSizeInfo(i.body)}))}setCallback(e){if(!m()(e))throw new Error("callback must be function");d.A._Notify_APPUI=e,(0,h._G)(d.A.Notify_APPUI_SAFE.bind(d.A))}addCallback(e){if(!m()(e))throw new Error("callback must be function");d.A._callbackList.push(e)}removeCallback(e){const t=d.A._callbackList.indexOf(e);-1!==t&&d.A._callbackList.splice(t,1)}doRenderConfig(e,t){var i;const r=null===(i=this.mediaSDKConfig)||void 0===i?void 0:i.webMediaBlockConfig;if(r)try{const e=JSON.parse(r),t=null==e?void 0:e.RenderConfig;t&&ue.X.setBlockConfig(t)}catch(e){}if(t){const e=ti.A.batchRead(t,_o),i=e.get(ii.n.DEFAULT_RENDERER.index);ue.X.setDefaultRendererType(i);const r=e.get(ii.n.WEBGL_CANVAS_OPTION_OPT.index);ue.X.setIsEnableCanvasCtxOptionsOpt(r);const s=e.get(ii.n.ENABLE_WASM_TAG_RENDERER.index);ue.X.setWasmTagRendererFlags(s);const o=e.get(ii.n.ENABLE_FALLBACK_TO_TAG_RENDERER.index);ue.X.setFallbackToTagRenderFlags(o)}ue.X.setCssPixelScale(window.devicePixelRatio),ue.X.markConfigDone(),this.isSsrcStreamEnabled=ue.X.canUseSsrcStream()}setProps(e){var t,i,r,s,o,l,h,u,p,f,m,v,g,_,S,A,y,C,E,b,w,R;this.hadsetpropsbeforeinit||(this.hadsetpropsbeforeinit=!e.fromPreload);let T=null===(t=null==this?void 0:this.mediaSDKConfig)||void 0===t?void 0:t.mediaFeatureOptions;this.mediaParams=e.mediaParams,d.A.mediaSDKCDNPath=null===(i=this.mediaSDKConfig)||void 0===i?void 0:i.mediaSDKCDNPath;const I=a.Ay.getOSInfo();if(e.meetingParams&&(this.meetingParams=e.meetingParams,this.meetingParams.isPreviewMode=e.isPreviewMode,this.meetingParams.meetingNumber=this.meetingParams.meetingNumber||this.meetingNumber,this.meetingParams.meetingId=this.meetingParams.confId),this.doRenderConfig(e,T),this.webrtcAudio2EnabledOnFT=null===(r=null==this?void 0:this.meetingParams)||void 0===r?void 0:r.webrtcAudio2EnabledOnFT,this.abTestStrategy=null===(s=null==this?void 0:this.meetingParams)||void 0===s?void 0:s.abTestStrategy,T&&(this.mediaFeatureOptions=T,this.isChromeWideAECEnabled=a.Ay.isSupportChromeWideAEC(this.mediaFeatureOptions),this.isPlayStereoAudioSupported=a.Ay.isSupportPlayStereo(this.mediaFeatureOptions)),Ce.A.setMediaOPConfig(this.mediaFeatureOptions),Ce.A.setPreviewMode(null===(o=this.meetingParams)||void 0===o?void 0:o.isPreviewMode),Ce.A.checkCanTurnOnDenoiseDirectly(),T){const e=ti.A.batchRead(T,_o);this.isWebGPUFeatureEnabled=!!e.get(ii.n.WEBGPU_RENDERER.index),this.enableVBWasmBackend=e.get(ii.n.VB_ON_SAFARI_17.index),this.isWebGL2FeatureEnabled=!!e.get(ii.n.WEBGL2_RENDERER.index),this.defaultRendererType=e.get(ii.n.DEFAULT_RENDERER.index),this.isWebTransportAllowed=!!e.get(ii.n.WEB_TRANSPORT_CONTROL.index);const t=e.get(ii.n.SUPPORT_ANNOTATION.index);this.isAnnotationEnabled=!!(t&ii.n.SUPPORT_ANNOTATION.candidates.VIEWER),this.isAnnotationPMEnabled=!!(this.isAnnotationEnabled&&t&ii.n.SUPPORT_ANNOTATION.candidates.PRESENTER),(e.get(ii.n.HW_ENCODER_FOR_360P.index)&ii.n.HW_ENCODER_FOR_360P.candidates.ALL_PLATFORM||e.get(ii.n.ENABLE_ADVANCED_FEATURE_ON_LOW_END.index)&ii.n.ENABLE_ADVANCED_FEATURE_ON_LOW_END.candidates.HW_WEBCODEC_ENCODE_360p&&a.Ay.shouldEnableAdvancedFeatureOnLowEnd())&&(d.A.enable360pHWEnc=!0),d.A.enableEchoDetection=e.get(ii.n.AUDIO_ECHO_DETECT.index),d.A.enableHADecOpt=e.get(ii.n.WEBCODEC_DECODE_OPTION.index),d.A.enableSafariHWCodec=e.get(ii.n.HW_WEBCODEC_ON_SAFARI.index),d.A.enable360pHWDec=e.get(ii.n.HW_DECODE_FOR_360P.index),d.A.enableOptCopyFrame=e.get(ii.n.WEBCODEC_ENCODE_OPT_1ON1.index),d.A.disableHWCodec=e.get(ii.n.CAP_WEBCODEC_SUPPORT.index),e.get(ii.n.WEBGL_CANVAS_OPTION_OPT.index),d.A.enableTransferDataChannel=e.get(ii.n.ENABLE_TRANSFERABLE_RTC_DATACHANNEL.index);const i=d.A.enableTransferDataChannel&&(0,a.Yu)();this.netThreadMgr.setUseTransferRTC(i),d.A.enableWebrtcTurnServer=e.get(ii.n.ENABLE_WEBRTC_TURN_SERVERS.index),d.A.mobileForceAutoChooseAudioDevice=e.get(ii.n.MOBILE_FORCE_AUTO_CHOOSE_AUDIO_DEVICE.index),d.A.enableCloneAudioStream=e.get(ii.n.ENABLE_CLONE_AUDIO_STREAM.index),d.A.enablemesh=e.get(ii.n.ENABLE_MESH.index),d.A.mesh_node=e.get(ii.n.MESH_NODE.index),this.mediaProcessorConfig=e.get(ii.n.ENABLE_MEDIA_PROCESSOR.index),this.ignoreWebCodecWhitelist=!!e.get(ii.n.IGNORE_WEBCODEC_WHITELIST.index),this.isWebRTCAudio2Enabled=!!e.get(ii.n.ENABLE_WEBRTC_AUDIO_2_0.index),d.A.supportAVSimultaneousFallback=e.get(ii.n.SUPPORT_AV_SIMULTANEOUS_FALLBACK.index);const r=e.get(ii.n.ANDROID_WEBCODEC_CAP.index);d.A.enableAndroidHWDec=!(r&ii.n.ANDROID_WEBCODEC_CAP.candidates.DISABLE_DECODER),d.A.enableAndroidHWEnc=!(r&ii.n.ANDROID_WEBCODEC_CAP.candidates.DISABLE_ENCODER);const s=e.get(ii.n.MULTISHARE_HIGH_FPS.index),o=e.get(ii.n.MULTISHARE_LOW_FPS.index);(null===navigator||void 0===navigator?void 0:navigator.hardwareConcurrency)>=8?this.shareSubController.setMaxCapablity(5*(s+1)):this.shareSubController.setMaxCapablity(5*(o+1));const n=e.get(ii.n.HW_ENC_ENABLE_L1T1.index);d.A.HWEncEnableL1T1=n;const l=e.get(ii.n.ENABLE_HW_ENC_RETRY.index);d.A.supportHWEncRetry=l;const h=e.get(ii.n.ENABLE_TRANSFERABLE_MEDIA_STREAM_TRACK.index);a.I4.setIsTransferableMediaStreamTrackEnabled(h);const u=e.get(ii.n.ENABLE_SUBSCRIBE_VIDEO_NUMBER_CONTROL.index);Ar.A.setIsEnable(u);const p=e.get(ii.n.ENABLE_SUBSCRIBE_VIDEO_FullHD_CONTROL.index);Ar.A.setEnableSubscribeVideoSizeFullHD(p),d.A.enableFetchWithCache=e.get(ii.n.ENABLE_FETCH_WITH_CACHE.index),this._isSupportMediaStreamTrackProcessor=a.Ay.isSupportMediaStreamTrackProcessor(),this._isSupportVideoFrameOrBitmapCapture=a.Ay.isSupportVideoFrameOrBitmapCapture(),lo.setStreamProcessAbility({isSupportMediaStreamTrackProcessor:this.isSupportMediaStreamTrackProcessor}),a.Ay.isAndroidBrowser()&&(d.A.enable360pHWDec=d.A.enableAndroidHWDec),c.Ay.directReport("setPropsBeforeInit, os:".concat(I.os,", version:").concat(I.osVersion,", enableSafariHWCodec:").concat(d.A.enableSafariHWCodec,", enable360pHWDec:").concat(d.A.enable360pHWDec,", enable360pHWEnc:").concat(d.A.enable360pHWEnc,", enableAndroidHWDec:").concat(d.A.enableAndroidHWDec,",enableAndroidHWEnc:").concat(d.A.enableAndroidHWEnc,", HWEncEnableL1T1:").concat(d.A.HWEncEnableL1T1,", enableOptCopyFrame:").concat(d.A.enableOptCopyFrame))}(0,oi.T)({enabled:!!d.A.enableFetchWithCache,reportLog(e){c.Ay.directReport("FetchCache: ".concat(JSON.stringify(e)))},resourcePath:null===(l=this.mediaSDKConfig)||void 0===l?void 0:l.mediaSDKCDNPath});const M=a.Ay.getGpuInfo();if(null===(h=null==this?void 0:this.mediaSDKConfig)||void 0===h?void 0:h.webMediaBlockConfig)try{const e=JSON.parse(this.mediaSDKConfig.webMediaBlockConfig);this.mGPUBlacklist=null==e?void 0:e.GPUBlacklist,this.mWebCodecConfig=null==e?void 0:e.WebCodecConfig,this.webrtcVideoCodecConfig=ei.A.readWebRTCVideoCodecConfig(null===(u=null==e?void 0:e.WebRTCConfig)||void 0===u?void 0:u.VideoCodecConfig,I,oo.zu),this.mWebCodecConfig?(this.isWebCodecEncoderOnWhitelist=ei.A.isGPUProfileOnWebCodecWhitelist("encoder",this.mWebCodecConfig,M,I,this.ignoreWebCodecWhitelist,oo.zu),this.isWebCodecDecoderOnWhitelist=ei.A.isGPUProfileOnWebCodecWhitelist("decoder",this.mWebCodecConfig,M,I,this.ignoreWebCodecWhitelist,oo.zu)):(this.isWebCodecEncoderOnWhitelist=0===a.Ay.AdapterWhiteListCheckForEncoder(),this.isWebCodecDecoderOnWhitelist=ei.A.isGPUProfileOnWebCodecWhitelist("decoder",void 0,M,I,this.ignoreWebCodecWhitelist,oo.zu))}catch(e){this.isWebCodecEncoderOnWhitelist=0===a.Ay.AdapterWhiteListCheckForEncoder(),this.isWebCodecDecoderOnWhitelist=ei.A.isGPUProfileOnWebCodecWhitelist("decoder",void 0,M,I,this.ignoreWebCodecWhitelist,oo.zu),""===this.mediaSDKConfig.webMediaBlockConfig?c.Ay.log("cannot read empty props.webMediaBlockConfig. encoder:".concat(this.isWebCodecEncoderOnWhitelist," decoder:").concat(this.isWebCodecDecoderOnWhitelist)):c.Ay.error("failed to read props.webMediaBlockConfig! config=".concat(null===(p=null==this?void 0:this.mediaSDKConfig)||void 0===p?void 0:p.webMediaBlockConfig," encoder:").concat(this.isWebCodecEncoderOnWhitelist," decoder:").concat(this.isWebCodecDecoderOnWhitelist))}else this.isWebCodecEncoderOnWhitelist=0===a.Ay.AdapterWhiteListCheckForEncoder(),this.isWebCodecDecoderOnWhitelist=ei.A.isGPUProfileOnWebCodecWhitelist("decoder",void 0,M,I,this.ignoreWebCodecWhitelist,oo.zu);void 0!==(null===(f=null==this?void 0:this.mediaParams)||void 0===f?void 0:f.rendererType)&&(this.rendererType=this.mediaParams.rendererType,this.handleRendererTypeInProps(this.rendererType,this.defaultRendererType,this.mGPUBlacklist).then((e=>{d.A.Notify_APPUI(n.zFT,e),this._updateRendererType(e.rendererType),c.Ay.log("handleRendererTypeInProps() final rendererType=".concat(e.rendererType," gpuBlacklist=").concat(JSON.stringify(this.mGPUBlacklist)))}))),D.A.add_monitor("props:".concat(T,":").concat(this.isWebGPUFeatureEnabled,":").concat(this.enableVBWasmBackend,":").concat(this.isWebGL2FeatureEnabled,":").concat(this.rendererType,":").concat(d.A.enableEchoDetection)),e.callback&&this.setCallback(e.callback),e.audioWorkletPath&&(this.audioWorkletJsPath=e.audioWorkletPath),(null===(m=null==this?void 0:this.meetingParams)||void 0===m?void 0:m.e2eEncrypt)?d.A.e2eencrypt=!0:d.A.e2eencrypt=!1;let k=null===(v=null==this?void 0:this.meetingParams)||void 0===v?void 0:v.enableWebtransport;this.isWebTransportAllowed||(k=!1),this._setWebtransportEnable({enable:k,webtransportPort:null===(g=null==this?void 0:this.meetingParams)||void 0===g?void 0:g.webtransportPort});let O=(0,a.Az)();if(O?O.uplimit>=800?d.A.uplimit=1e3*(O.uplimit-120):d.A.uplimit=0:d.A.uplimit||(d.A.uplimit=0),(null===(_=null==e?void 0:e.meetingParams)||void 0===_?void 0:_.webrtcMode)&P.Q9){const t=!0;lo.webrtcFlag=t,this.webrtcConfig.webrtcflag=t,(0,a.h)(t),Ar.A.setIsWebRTC(t),D.A.add_monitor("WMSC_webrtcMode:".concat(e.meetingParams.webrtcMode))}if(!e.fromPreload&&this.vbResource&&this.webrtcConfig.webrtcflag&&(a.I4.setIsSupportVirtualBackground(!(this.isTeslaMode||a.Ay.isAndroidBrowser()||a.Ay.isIphoneOrIpadBrowser()||a.Ay.isIpadOS()||this.platformMode.isMSTF)),a.I4.getIsSupportVirtualBackground()&&lo.initVB(this.updateWebRTCVideoStream.bind(this))),!1===this.isSessionBranding&&(d.A.enableCanvasAlphaChannel=!1),this.renderManager.setCanvasAlphaChannelEnability(d.A.enableCanvasAlphaChannel),(null===(S=null==this?void 0:this.meetingParams)||void 0===S?void 0:S.rwgToMediaSDKConfig)&&d.A.enableWebrtcTurnServer&&(this.iceServers=(null===(y=null===(A=null==this?void 0:this.meetingParams)||void 0===A?void 0:A.rwgToMediaSDKConfig)||void 0===y?void 0:y.iceServers)||[],null===(E=null===(C=this.webrtcAudio)||void 0===C?void 0:C.setIceServers)||void 0===E||E.call(C,this.iceServers)),(null===(b=null==this?void 0:this.meetingParams)||void 0===b?void 0:b.rwgToMediaSDKConfig)&&1&d.A.enablemesh&&(this.stunServers=(null===(R=null===(w=null==this?void 0:this.meetingParams)||void 0===w?void 0:w.rwgToMediaSDKConfig)||void 0===R?void 0:R.stunServers)||[]),this.meetingParams&&T){let e=!0,t=!0;this.meetingParams.webrtcMode&P.h&&(a.Ay.isWebRTCAudio2_0(T,this.meetingParams.mid,!0,this.webrtcAudio2EnabledOnFT,this.abTestStrategy)?t=!1:e=!1),this.meetingParams.webrtcMode&P.Q9&&(t=!1),e&&this.persistenceInfo.getAudioBridgeConnectivityInfo().checkWebRTCConnectivity(this.meetingParams,this.iceServers),t&&this.persistenceInfo.getWMSCConnectivityInfo().checkWebRTCConnectivity(this.meetingParams,this.iceServers)}}onRendererTypeSelected(){return ao(this,void 0,void 0,(function*(){const e=yield this.handleRendererTypeInProps(this.rendererType,this.defaultRendererType,this.mGPUBlacklist);d.A.Notify_APPUI(n.zFT,e),this.renderManager.getRendererProvider().setRendererType(e.rendererType),this._updateRendererType(e.rendererType)}))}_updateRendererType(e){this.renderManager.getRendererProvider().setRendererType(e),this.rendererType=e;const t=e===B.h3.VIDEO_TAG;if(ue.X.isUseSsrcStream()!==t){const e=Pe.f.supportVideoTagRenderer(),i=Pe.f.supportGraphicsAcceleration(),r=pe.l.isLowerPerformanceDevice(),s=ue.X.isEnableFallbackToTagRender(),o=ue.X.isEnableWasmTagRenderer();c.Ay.directReport("useSsrcStream:".concat(t,",\n supportTag: ").concat(e,",\n supportGl: ").concat(i,",\n lowerDevice: ").concat(r,",\n enableFallback: ").concat(s,",\n enableTag: ").concat(o,",\n preferredUseSsrcStream: ").concat(ue.X.preferredUseSsrcStream()))}ue.X.setIsUseSsrcStream(t)}handleRendererTypeInProps(e,t){return ao(this,arguments,void 0,(function(e,t){var i=this;let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return function*(){e!==B.h3.AUTO&&e!==B.h3.UNDEFINED&&e!==B.h3.WEBGL&&e!==B.h3.WEBGL_2&&e!==B.h3.WEBGPU&&e!==B.h3.VIDEO_TAG&&(e=B.h3.AUTO);let s=e,o=0;return e!==B.h3.AUTO&&e!==B.h3.UNDEFINED||(s=i.useVideoPlayer&&ue.X.preferredUseSsrcStream()?B.h3.VIDEO_TAG:t),(yield a.Ay.isRendererTypeSupported(s,i.isWebGPUFeatureEnabled,i.isWebGL2FeatureEnabled,i.isSsrcStreamEnabled,r,i.useVideoPlayer))||(o=1,s=yield a.Ay.evaluateRendererType(i.isWebGPUFeatureEnabled,i.isWebGL2FeatureEnabled,i.isSsrcStreamEnabled,r,i.useVideoPlayer)),{errNo:o,rendererType:s}}()}))}setRWGAgent(e){d.A.rwgAgent=e,this.addEventListenerForRWGAgent(e)}updateQosSubscription(e,t,i){var r,s;if(t===E._c.COMMON&&this.systemReporter)return this.systemReporter.setInterval(i),void(e?this.systemReporter.start():this.systemReporter.stop());if(this.useWebRTCAudio&&(t===E._c.AUDIO_DECODE||t===E._c.AUDIO_ENCODE))return void(null===(r=this.webrtcAudio)||void 0===r||r.updateQos({enable:e,workerType:t,pollingInterval:i}));const o=t===E._c.VIDEO_ENCODE||t===E._c.VIDEO_DECODE;if(this.webrtcConfig.webrtcflag&&o)this.wmscManager&&(null===(s=this.wmscManager)||void 0===s?void 0:s.isJoinRWGSuccess)?this.wmscManager.updateQosSubscription(e,t,i):this.webrtcConfig.subscribeQosParamsData[t]=[e,t,i];else{let r=!0;this.isSupportVideoShare&&(t==E._c.SHARING_DECODE&&(t=E._c.VIDEO_DECODE,r=!1),t==E._c.SHARING_ENCODE&&(t=E._c.VIDEO_ENCODE,r=!1));const s={enable:e,workerType:t,pollingInterval:i,isVideo:r};l.pushMessageToWorker(t,s,Zt.QOS_MONITORING,!1,this.isLSSPlayer)}}updateStatisticsSubscription(e,t){e?(this.statisticsInterval&&clearInterval(this.statisticsInterval),this.statisticsInterval=setInterval((()=>ao(this,void 0,void 0,(function*(){const[e,t]=yield Promise.all([this._getWebRtcStats(),Promise.resolve((0,a.mx)({isSendVideo:this.isStartVideoCapture,isSendAudio:d.A.ComputerAudioStatus===E.BX.ComputerAudio_Connected&&!this.captureAudioMuted,subscribedUserIds:Ar.A.getUserSubscribeMap(),activeSpeakerSsrc:this.activeSpeakerSsrc}))]),i=new Map;e&&e.size>0&&e.forEach(((e,t)=>{i.set(t,e)})),t&&t.size>0&&t.forEach(((e,t)=>{i.set(t,e)})),i&&i.size>0&&d.A.Notify_APPUI(n.USe,i)}))),t||1e3)):clearInterval(this.statisticsInterval),(0,a.B1)({enable:e,pollingInterval:t,isSupportVideoShare:this.isSupportVideoShare,isLSSPlayer:this.isLSSPlayer,pushMessageToWorker:l.pushMessageToWorker,pushMessageToAudioWorklet:l.pushMessageToAudioWorklet,Command:Zt,WORKER_TYPE:E._c})}addEventListenerForRWGAgent(e){e.on("message",this.rwgAgentMessageListenerWrapper)}rwgAgentMessageListener(e){if("string"!=typeof e.data)return;let t=JSON.parse(e.data);this.isDestroy||t.evt!==n.Bse||this.setRTCPeerConnectionDatachannelAnswer(t)}setRTCPeerConnectionDatachannelAnswer(e){if(e.evt===n.kqY||e.evt===n.FQb){if(ho("rwg answer",e),!e.answer)return;switch(e.answer.type){case E.wd.ZOOM_CONNECTION_VIDEO:p.A.trigger(n.gh2.ZOOM_CONNECTION_VIDEO_OFFER_RESPONSE_EVT,e);break;case E.wd.ZOOM_CONNECTION_AUDIO:p.A.trigger(n.gh2.ZOOM_CONNECTION_AUDIO_OFFER_RESPONSE_EVT,e)}}}initVideoDataChannel(e,t){return ao(this,void 0,void 0,(function*(){var i;if((null===(i=this.videoDataChannel)||void 0===i?void 0:i.connectionID)==e)return void(t&&this.videoDataChannel.checkEmptyUserIdAndResendMonitor(t));this.isInitVideoDataChannel=!1,this.videoDataChannel&&(this.videoDataChannel.forceClose(),c.Ay.error("video datachannel cid changed")),this.videoDataChannel=null,D.A.add_monitor("INITVDC"),ho("initVideoDataChannel",e);let r=new U(this.netThreadMgr,E.Xt.VIDEO,this.isLSSPlayer,this.mediaParams.udpPolicy,this.mediaParams.enableTCP);a.Ay.browser.isFirefox?r.delaycloseTimeout=15e3:r.delaycloseTimeout=5e3,r.setUserid(t),ho("rtc",r);let s=this;r.onConnectionCreated((e=>ao(this,void 0,void 0,(function*(){let t=e.localDescription;if(ho("localDesc",t),s.isDestroy)return;d.A.sendMessageToRwg(n.yJV,{evt:n.qw$,offer:{sdp:t.sdp,type:E.wd.ZOOM_CONNECTION_VIDEO}},!1);let i=yield r.waitForAnswerFromRWG(n.gh2.ZOOM_CONNECTION_VIDEO_OFFER_RESPONSE_EVT);if(ho("jsEvent.PUBSUB_EVT.ZOOM_CONNECTION_VIDEO_OFFER_RESPONSE_EVT",i),e!=r.rtcPeerConnection||r.isDestroyed())return;r.setRemoteDescription(i.answer),r.closeIfTimeout();let o=i.answer.sdp.match(/a=candidate:.+/)[0];ho("received candidate",o),o=o.replace(/^a=/,""),r.addIceCandidate(o),r.onDataChannelOpen((()=>{})),r.onDataChannelClose((()=>{l.CloseMediaNetSessionToRwg(E.wd.ZOOM_CONNECTION_VIDEO,E.oB.NET_DATACHANNEL)}))})))),r.initConnection(e).catch((e=>{ho.warn("initConnection",e),D.A.add_monitor("INITVDCERR",e.message)})),this.videoDataChannel=r}))}initAudioDataChannel(e,t){return ao(this,void 0,void 0,(function*(){var i,r;if((null===(i=this.audioDataChannel)||void 0===i?void 0:i.connectionID)==e)return void(t&&this.audioDataChannel.checkEmptyUserIdAndResendMonitor(t));this.isInitAudioDataChannel=!1,this.audioDataChannel&&(null===(r=this.audioDataChannel)||void 0===r||r.forceClose(),c.Ay.error("audio datachannel cid changed")),this.audioDataChannel=null,D.A.add_monitor("INITADC"),ho("initAudioDataChannel",e);let s=new U(this.netThreadMgr,E.Xt.AUDIO,this.isLSSPlayer,this.mediaParams.udpPolicy,this.mediaParams.enableTCP);a.Ay.browser.isFirefox?s.delaycloseTimeout=15e3:s.delaycloseTimeout=5e3,s.setUserid(t),ho("rtc",s);let o=this;s.onConnectionCreated((e=>ao(this,void 0,void 0,(function*(){let t=e.localDescription;if(o.isDestroy)return;ho("localDesc",t),d.A.sendMessageToRwg(n.yJV,{evt:n.qw$,offer:{sdp:t.sdp,type:E.wd.ZOOM_CONNECTION_AUDIO}},!1);let i=yield s.waitForAnswerFromRWG(n.gh2.ZOOM_CONNECTION_AUDIO_OFFER_RESPONSE_EVT);if(ho("answer",i),e!=s.rtcPeerConnection||s.isDestroyed())return;s.setRemoteDescription(i.answer),s.closeIfTimeout();let r=i.answer.sdp.match(/a=candidate:.+/)[0];ho("received candidate",r),r=r.replace(/^a=/,""),s.addIceCandidate(r),s.onDataChannelOpen((()=>{})),s.onDataChannelClose((()=>{l.CloseMediaNetSessionToRwg(E.wd.ZOOM_CONNECTION_AUDIO,E.oB.NET_DATACHANNEL)}))})))),s.initConnection(e,"ZoomWebclientAudioDataChannel").catch((e=>{ho.warn("initConnection",e),D.A.add_monitor("INITADCERR",e.message)})),this.audioDataChannel=s}))}init_Notify_APPUI(e,t){let i=l.MEDIA_INIT_SUCCESS_CALLBACK_METADATA[t],r=e?i.success:i.failed;d.A.Notify_APPUI(r,i.callbackDataValue)}_setWebtransportEnable(e){let{enable:t,webtransportPort:i}=e;t?(a.I4.setIsSupportWebtransport(!0),d.A.webtransportPort=i||8802):a.I4.setIsSupportWebtransport(!1)}_previewInitWebtransport(e){let{conId:t,meetingNumber:i,rwgHost:r,webtransportPort:s,workType:o}=e;if(this._setWebtransportEnable({enable:!0,webtransportPort:s}),a.I4.getIsSupportWebtransport()){const e=o===E._c.AUDIO_ENCODE,s=o===E._c.AUDIO_DECODE,a=o===E._c.VIDEO_ENCODE,n=o===E._c.VIDEO_DECODE,c=e||s,h=c?"a":"v",u=e||a?2:1,p="https://".concat(r,":").concat(d.A.webtransportPort,"/wc/media/").concat(i,"?type=").concat(h,"&cid=").concat(t),f="".concat(p,"&mode=").concat(u);c?l.Set_Audio_Web_Transport_Ip_Address(p):l.Set_Video_Web_Transport_Ip_Address(p);const m=d.A.SPECIAL_ID;let v="",g=null;e?(v="localAudioEncMGR",g=l.preserveMessageController.nameMap.CREATE_AUDIO_ENCODE_HANDLE_SUCCESS):s?(v="localAudioDecMGR",g=l.preserveMessageController.nameMap.CREATE_AUDIO_DECODE_HANDLE_SUCCESS):a?(v="localVideoEncMGR",g=l.preserveMessageController.nameMap.CREATE_VIDEO_ENCODE_HANDLE_SUCCESS):n&&(v="localVideoDecMGR",g=l.preserveMessageController.nameMap.CREATE_VIDEO_DECODE_HANDLE_SUCCESS);let _=d.A[v]&&d.A[v].map.get(m);_?_.postMessage({command:Zt.OPEN_WEBTRANSPORT,webtransportURL:f,_id:this._id}):l.preserveMessageController.enqueueMessage({name:g,handler:()=>{_=d.A[v].map.get(m),_.postMessage({command:Zt.OPEN_WEBTRANSPORT,webtransportURL:f,_id:this._id})},direction:l.preserveMessageController.direction.SDK_TO_SDK})}}_previewInitMediaWebsocket(e){let{websocketUrl:t,workType:i}=e;const r=d.A.SPECIAL_ID,s=i===E._c.AUDIO_ENCODE,o=i===E._c.AUDIO_DECODE,a=i===E._c.VIDEO_ENCODE,n=i===E._c.VIDEO_DECODE;s||o?l.Set_Audio_WebSocket_Ip_Address(t):l.Set_Video_WebSocket_Ip_Address(t);let c="",h=null,u=0;s?(u=2,c="localAudioEncMGR",h=l.preserveMessageController.nameMap.CREATE_AUDIO_ENCODE_HANDLE_SUCCESS):o?(u=5,c="localAudioDecMGR",h=l.preserveMessageController.nameMap.CREATE_AUDIO_DECODE_HANDLE_SUCCESS):a?(u=2,c="localVideoEncMGR",h=l.preserveMessageController.nameMap.CREATE_VIDEO_ENCODE_HANDLE_SUCCESS):n&&(u=5,c="localVideoDecMGR",h=l.preserveMessageController.nameMap.CREATE_VIDEO_DECODE_HANDLE_SUCCESS);let p=d.A[c]&&d.A[c].map.get(r);p?p.postMessage({command:Zt.OPEN_WEBSOCKET,websocket_ip_address:"".concat(t,"&mode=").concat(u)}):l.preserveMessageController.enqueueMessage({name:h,handler:()=>{p=d.A[c].map.get(r),p.postMessage({command:Zt.OPEN_WEBSOCKET,websocket_ip_address:"".concat(t,"&mode=").concat(u)})},direction:l.preserveMessageController.direction.SDK_TO_SDK})}previewInit(e){return ao(this,void 0,void 0,(function*(){let t,i,r,s,o,a,n,d,c;this.meetingParams&&this.meetingParams.cid==e.cid||(2&e.webrtcMode||(t=i={websocketUrl:"wss://".concat(e.rwgHost,"/wc/media/").concat(e.meetingNumber,"?type=v&cid=").concat(e.cid)}),1&e.webrtcMode||(r=s={websocketUrl:"wss://".concat(e.rwgHost,"/wc/media/").concat(e.meetingNumber,"?type=a&cid=").concat(e.cid)}),this.meetingParams&&(this.meetingParams.cid=e.cid,this.meetingParams.rwgHost=e.rwgHost)),o=!(2&e.webrtcMode||!(2&e.videoInitMode)),o&&(c={conId:e.cid}),a=!(1&e.webrtcMode||!(2&e.audioInitMode)),a&&(d={conId:e.cid}),n=e.webtransportPort,this.setupLocalPreview({videoEncodeMediaWss:t,videoDecodeMediaWss:i,audioDecodeMediaWss:r,audioEncodeMediaWss:s,videoDecode:o,audioDecode:a,webtransportPort:n,audioDataChannel:d,videoDataChannel:c})}))}setupLocalPreview(e){return ao(this,arguments,void 0,(function(e){var t=this;let{videoDecode:i=null,videoDataChannel:r=null,videoEncodeMediaWss:s=null,videoDecodeMediaWss:o=null,audioDecode:n=null,audioDataChannel:d=null,audioBridge:h=null,audioEncodeMediaWss:u=null,audioDecodeMediaWss:p=null,webtransportPort:f=null}=e,m=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return function*(){var e,v;if(!l.AssertMediaSdkNotDestory(t))return!1;if(i){let{urlParameters:r}=i||{};r=(null===(e=t.getFilePath)||void 0===e?void 0:e.call(t))||r;let s=yield a.Ay.isSDKSupportMultiThread(),o=yield a.Ay.isSDKSupportSIMD(),n=o&&s;yield t.onRendererTypeSelected();let d={};d.rendererType=t.rendererType,t.isSupportVideoShare&&(t.isSupportVideoShare=n),t.isSupportVideoShare?(d.workerJsFileUrl=r.vsmiworkerpath,d.workerWasmFileUrl=r.videoMSIMDWasm):n?(d.workerJsFileUrl=r.videoMSIMDWorkerPath,d.workerWasmFileUrl=r.videoMSIMDWasm):s?(d.workerJsFileUrl=r.videoMtWorkerPath,d.workerWasmFileUrl=r.videoMtWasm):o?(d.workerJsFileUrl=r.videoSIMDWorkerPath,d.workerWasmFileUrl=r.videoSIMDWasm):(d.workerJsFileUrl=r.videoWorkerPath,d.workerWasmFileUrl=r.videoWasm),d.integrityHelper=new a.gP(d.workerJsFileUrl,t.lateLoadedAssetsHash),l.previewController.resetVideoDecode(!0),l.initVideoDecode(d,t)}if(r&&(m||t.hadsetpropsbeforeinit)){const{conId:e,userid:i}=r;t.initVideoDataChannel(e,i)}if(s){const{websocketUrl:e}=s;t._previewInitMediaWebsocket({websocketUrl:e,workType:E._c.VIDEO_ENCODE})}if(o){const{websocketUrl:e}=o;t._previewInitMediaWebsocket({websocketUrl:e,workType:E._c.VIDEO_DECODE})}if(f){const{meetingNumber:e,rwgHost:i,cid:r}=t.meetingParams;t._previewInitWebtransport({conId:r,meetingNumber:e,rwgHost:i,webtransportPort:f,workType:E._c.VIDEO_ENCODE}),t._previewInitWebtransport({conId:r,meetingNumber:e,rwgHost:i,webtransportPort:f,workType:E._c.VIDEO_DECODE}),t._previewInitWebtransport({conId:r,meetingNumber:e,rwgHost:i,webtransportPort:f,workType:E._c.AUDIO_ENCODE}),t._previewInitWebtransport({conId:r,meetingNumber:e,rwgHost:i,webtransportPort:f,workType:E._c.AUDIO_DECODE})}if(n){let{urlParameters:e}=n||{};e=(null===(v=t.getFilePath)||void 0===v?void 0:v.call(t))||e;let i={};(yield a.Ay.isSDKSupportSIMD())?(i.workerJsFileUrl=e.audioSIMDWorkletPath,i.workerWasmFileUrl=e.audioSIMDWasm):(i.workerJsFileUrl=e.audioWorkerPath,i.workerWasmFileUrl=e.audioWasm),i.integrityHelper=new a.gP(i.workerJsFileUrl,t.lateLoadedAssetsHash),l.previewController.resetAudioDecode(!0),l.initAudioDecode(i,t)}if(d&&(m||t.hadsetpropsbeforeinit)){const{conId:e,userid:i}=d;t.initAudioDataChannel(e,i)}if(h){if(t.useWebRTCAudio=!0,!a.Ay.isSupportPeerConnection())return void c.Ay.error("no support peer connection");yield t.initWebRTCAudioInstance(Object.assign({},h)),lo.webrtcAudio=t.webrtcAudio}if(u){const{websocketUrl:e}=u;t._previewInitMediaWebsocket({websocketUrl:e,workType:E._c.AUDIO_ENCODE})}if(p){const{websocketUrl:e}=p;t._previewInitMediaWebsocket({websocketUrl:e,workType:E._c.AUDIO_DECODE})}m||t.hadsetpropsbeforeinit||c.Ay.directReport("previewinit before setprops")}()}))}previewUnInitRtcConnection(){var e,t;D.A.add_monitor("REINITRTC");try{null===(e=this.videoDataChannel)||void 0===e||e.forceClose(),null===(t=this.audioDataChannel)||void 0===t||t.forceClose()}catch(e){ho.error("clear rtcPeerConnectionList err",e)}finally{this.videoDataChannel=null,this.audioDataChannel=null}this.webrtcAudio&&(this.webrtcAudio.destroy(!1),this.webrtcAudio=null,lo.webrtcAudio=null);const i=d.A.SPECIAL_ID;[d.A.localVideoEncMGR&&d.A.localVideoEncMGR.map.get(i),d.A.localVideoDecMGR&&d.A.localVideoDecMGR.map.get(i),d.A.localAudioEncMGR&&d.A.localAudioEncMGR.map.get(i),d.A.localAudioDecMGR&&d.A.localAudioDecMGR.map.get(i)].forEach((e=>{e&&(e.postMessage({command:Zt.CLOSE_WEBSOCKET}),e.postMessage({command:Zt.CLOSE_WEBTRANSPORT,_id:this._id}))}))}doesSafariSupportWebcodec(){return!a.Ay.isMacIntelSafari()&&a.Ay.isAppleBrowserVersionHigherThan("17.5")&&Boolean(d.A.enableSafariHWCodec)}_enableHardWareDecode(){return!(d.A.disableHWCodec&P.ww)&&(a.Ay.isAndroidBrowser()?a.Ay.isChromiumVersionHigherThan(111)&&d.A.enableAndroidHWDec:a.Ay.isChromiumVersionHigherThan(95)||this.doesSafariSupportWebcodec())}_checkHardwareEncode(){return ao(this,arguments,void 0,(function(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return function*(){let i=(t,i,r)=>ao(e,void 0,void 0,(function*(){a.Ay.canReportHWEncConfig()&&(d.A.hwEncAddConIdx=t,c.Ay.directReport("_checkHardwareEncode: config="+t+", support="+i+", eowl="+r),a.Ay.didReportHWEncConfig()),d.A.hwEncAdditionalConfig=P.gg[t],d.A.supportHWEncRetry&&(d.A.supportHWEncRetry=yield a.Ay.IsSupportVideoEncodeHardwareAcceleration(d.A.hwEncRetryConfig))}));if(!(d.A.HWEncEnableL1T1&ii.n.HW_ENC_ENABLE_L1T1.candidates.ALL||a.Ay.isAndroidBrowser()&&d.A.HWEncEnableL1T1&ii.n.HW_ENC_ENABLE_L1T1.candidates.ANDROID||a.Ay.isChromeOS()&&d.A.HWEncEnableL1T1&ii.n.HW_ENC_ENABLE_L1T1.candidates.CHROMEOS)){const e=yield a.Ay.IsSupportVideoEncodeHardwareAcceleration(P.gg[0]);return yield i(0,e,t),e}for(let e=0;e<P.gg.length;e++){const r=yield a.Ay.IsSupportVideoEncodeHardwareAcceleration(P.gg[e]);if(d.A.hwEncAddConIdx=e,r)return yield i(e,r,t),!0}return yield i(d.A.hwEncAddConIdx,!1,t),!1}()}))}checkWebcodecEncodeOnce(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(i=()=>ao(this,void 0,void 0,(function*(){return yield this._checkHardwareEncode(t)})),function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return ao(e,void 0,void 0,(function*(){return this.checkWebCodecEncoderPromise||(this.checkWebCodecEncoderPromise=i.apply(this,r)),this.checkWebCodecEncoderPromise}))})();var i}initVideoEncode(){return ao(this,arguments,void 0,(function(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function*(){var i,r;let o=e.mediaParams.videoDecodeThreadNum,n=e.platformMode.isMSTF,c=e.mediaParams.isEnableHD,h=e.mediaParams.isEnableEncodingHW,u=t.wasmFlag,p=d.A.enable360pHWEnc;const{isPreviewMode:f,meetingNumber:m,rwgHost:v,userId:g,cid:_,webrtcMode:S}=e.meetingParams,A="wss://".concat(v,"/wc/media/").concat(m,"?type=v&cid=").concat(_);if((a.Ay.isAndroidBrowser()&&!a.Ay.isMTRAndroid()&&!a.Ay.isGoogleMeetAndroid()||a.Ay.isIphoneOrIpadBrowser())&&(p=!0,void 0===h&&(h=!0)),a.Ay.isAndroidBrowser()&&!a.Ay.isAndroidIntegrationWithSAB()?e.platformType=P.u7.ANDROID:a.Ay.isIphoneOrIpadBrowser()&&(e.platformType=P.u7.IPHONE),o=(0,a.OC)(),e.userId=g,!l.AssertMediaSdkNotDestory(e))return!1;if(D.A.add_monitor("INITVE-".concat(f)),e.webrtcConfig.webrtcflag&&!u)return e.initVEPara=t,e.resolveVEwebrtcpromise(!0),D.A.add_monitor("WMSC_INITVE"),d.A.hasUsedWebrtc=!0,e._initWMSC({rwgHost:v,cid:_,meetingNumber:m,workerType:E._c.VIDEO_ENCODE,userId:g,webrtcMode:S}).catch((()=>{}));e.setMultiView(o,d.A.enableMultiDecodeVideoWithoutSAB),ho("initVideoEncode"),Ce.A.setUserId(g),l.previewController.resetVideoEncode(f),e.is32bitbrowser=yield a.Ay.is32bitChrome();let y=yield a.Ay.isSDKSupportMultiThread();a.I4.setIsSupportVirtualBackground(!e.isTeslaMode&&!a.Ay.isAndroidBrowser()&&!a.Ay.isIphoneOrIpadBrowser()&&!a.Ay.isIpadOS()&&!n&&(y||d.A.enableVirtualBackgroundWithoutSAB));const C=a.I4.getIsSupportVirtualBackground()&&!e.webrtcConfig.webrtcflag;C&&e.vbResource&&l.prepareVBfile(e.vbResource);let b=yield a.Ay.isSDKSupportSIMD(),w=b&&y,R=!1,T=a.Ay.graphicName,I=!!T&&T.includes("amd");(a.Ay.isIphoneOrIpadBrowser()||a.Ay.isIpadOS()||navigator.hardwareConcurrency&&navigator.hardwareConcurrency>7||(yield a.Ay.VP9MachineDetect())&&I&&navigator.hardwareConcurrency&&navigator.hardwareConcurrency>=4)&&c&&(R=!0),(a.Ay.isIphoneOrIpadSafari()&&!a.Ay.isSupportVideoFrame()||a.Ay.isAndroidBrowser()&&(a.Ay.isAndroidVersionLessEqual(10)||a.Ay.isAndroidIntegrationWithSAB()))&&(R=!1),e.isSupportVideoShare&&(e.isSupportVideoShare=w),D.A.add_monitor("isMT: "+y),D.A.add_monitor("isenbaleHD: "+c),D.A.add_monitor("ENABLE720:"+R),D.A.add_monitor("ISVSV:"+e.isSupportVideoShare),D.A.add_monitor("graphicname: "+T),e.is32bitbrowser&&D.A.add_monitor("is32chrome: "+e.is32bitbrowser);let M=!(d.A.disableHWCodec&P.mV),k=M&&h,O=yield e.checkWebcodecEncodeOnce(e.isWebCodecEncoderOnWhitelist);y&&(c||p)&&(e.isSupportMediaStreamTrackProcessor&&a.Ay.isChromiumVersionHigherThan(95)&&(!a.Ay.isAndroidBrowser()||d.A.enableAndroidHWEnc)||e.doesSafariSupportWebcodec())&&e.isWebCodecEncoderOnWhitelist?(e.videoencodehardwareflag=M&&O,h=e.videoencodehardwareflag):(e.videoencodehardwareflag=!1,h=!1),D.A.add_monitor("EOWL:"+e.isWebCodecEncoderOnWhitelist),D.A.add_monitor("VIHD:"+e.videoencodehardwareflag),D.A.add_monitor("enableHW: "+h),D.A.add_monitor("L1T2: "+d.A.hwEncAddConIdx);let V=null===(i=e.getFilePath)||void 0===i?void 0:i.call(e),N={};if(e.isSupportVideoShare?(N.workerJsFileUrl=V.vsmiworkerpath,N.workerWasmFileUrl=V.videoMSIMDWasm):w?(N.workerJsFileUrl=V.videoMSIMDWorkerPath,N.workerWasmFileUrl=V.videoMSIMDWasm):y?(N.workerJsFileUrl=V.videoMtWorkerPath,N.workerWasmFileUrl=V.videoMtWasm):b?(N.workerJsFileUrl=V.videoSIMDWorkerPath,N.workerWasmFileUrl=V.videoSIMDWasm):(N.workerJsFileUrl=V.videoWorkerPath,N.workerWasmFileUrl=V.videoWasm),N.integrityHelper=new a.gP(N.workerJsFileUrl,e.lateLoadedAssetsHash),!f){let t=e.cid=new(s())(A).searchParams.get("cid"),i=new(s())(A).host;a.I4.getIsSupportWebtransport()&&l.Set_Video_Web_Transport_Ip_Address("https://".concat(i,":").concat(d.A.webtransportPort,"/wc/media/").concat(m,"?type=v&cid=").concat(t)),e.setupLocalPreview({videoDataChannel:{conId:t,userid:g}},!0)}let x=1,L=!1,W=!1;const U=C&&y;U&&h?(x=3,L=!0,W=!!k):U||h?(x=2,h&&(L=!0,W=!!k)):(e.isSupportVideoShare||y)&&(x=2);let B=L&&W&&R;a.Ay.set720pcapacity(B),D.A.add_monitor("CAPTURE720:"+B),D.A.add_monitor("VETNum:"+x),W=W&&(a.Ay.isChromiumVersionHigherThan(111)&&(!a.Ay.isAndroidBrowser()||d.A.enableAndroidHWEnc)||e.doesSafariSupportWebcodec()),yield e.onRendererTypeSelected(),D.A.add_monitor("SupportWebCodecEncode: "+W);let F={log:!1,confId:g,meetingid:"",meetingnumb:m,videodecodethreadnumb:o,isSupportMultiThread:y,videoencodethreadnumb:x,isSupportVirtualBackground:C,isSupportWebCodecEnocde:L,initWebCodecFlag:W,is360penablehwenc:p,enable720p:R,platformType:e.platformType,rendererType:e.rendererType,IsRenderInWorker:e.checkIsRenderInWorker()&&!a.I4.getIsRenderSelfVideoInEncodeWorker(!0),webrtcvideo:e.webrtcConfig.webrtcflag,MaskFlag:!!d.A.rwgAgent,isSafari:null===(r=a.Ay.browser)||void 0===r?void 0:r.isSafari};if(l.setVideoEngineInitProperties(A,F),!l.AssertMediaSdkNotDestory(e))return!1;if(yield l.initVideoEncode(N,e),d.A.extVBPort&&e.addVbReceiver(d.A.extVBPort),f||e.isDestroy)return;let H=e;e.allpromises.push(d.A.videoInitInstance.initSuccessPromise);let G=null;return e.bVideoDecodeUsingSAB&&!e.videoEncodeRingBuffer&&(y?(G=!0,e.videoEncodeRingBuffer=!0):(G=fe.N6.getStorageForCapacity(),e.videoEncodeRingBuffer=G)),yield d.A.videoInitInstance.initSuccessPromise.then((t=>!!l.AssertMediaSdkNotDestory(H)&&(t&&e.bVideoEncodeUsingSAB&&G&&l.pushMessageToWorker(E._c.VIDEO_ENCODE,{interval:e.bVideoEncodeMainThreadConsumerIntervalEnable,data:y?null:{buffer:G,offset:0,length:G.byteLength}},Zt.VIDEO_ENCODE_SAB,!1,!0),t))).then((t=>(D.A.add_monitor("INITVERET-".concat(H._id,"-").concat(t&&!H.isDestroy)),!!l.AssertMediaSdkNotDestory(H)&&(u||e.init_Notify_APPUI(t,E._c.VIDEO_ENCODE),l.preserveMessageController.subscribeMessage(l.preserveMessageController.nameMap.INIT_VIDEO_ENCODE_SUCCESS),l.setCachedUserNodeListToWorker(E._c.VIDEO_ENCODE),H.waitingVcChannelReady&&H.addChannelForVideo(),t))))}()}))}_initWMSC(e){return ao(this,void 0,void 0,(function*(){const t=new Date;return(0,a.DR)().then((i=>ao(this,[i],void 0,(function(i){var r=this;let{WMSCManager:s}=i;return function*(){var i;r.webrtcConfig.currentReloadTimes=0;const{rwgHost:o,cid:n,meetingNumber:d,workerType:h,userId:u,webrtcMode:p}=e;if(!n||!d||r.isDestroy){const e="WMSC_Stop_Init: ".concat(!!n,"|").concat(!!d,"|").concat(r.isDestroy);return D.A.add_monitor(e),Promise.reject(e)}const f=()=>ao(r,void 0,void 0,(function*(){if(!h)return;if(h===E._c.AUDIO_DECODE||h===E._c.AUDIO_ENCODE)return yield this.wmscManager.waitInitAudioSuccess(),void this.init_Notify_APPUI(!0,h);const e={[E._c.VIDEO_ENCODE]:l.preserveMessageController.nameMap.INIT_VIDEO_ENCODE_SUCCESS,[E._c.VIDEO_DECODE]:l.preserveMessageController.nameMap.INIT_VIDEO_DECODE_SUCCESS};this.init_Notify_APPUI(!0,h),l.preserveMessageController.subscribeMessage(e[h]),D.A.add_monitor("WMSC_".concat(e[h]))}));if(r.isDestroy){null===(i=r.wmscManager)||void 0===i||i.destroy();const e="WMSC_Destory_Init: ".concat(r.isDestroy);return D.A.add_monitor(e),Promise.reject(e)}if(!r.wmscManager||r.wmscManager.isDestroyed()||r.wmscManager.getConnectionId()!==n){r.wmscManager&&r.wmscManager.getConnectionId()!==n&&(c.Ay.error("WMSC_CID_Change: ".concat(r.wmscManager.getConnectionId(),"|").concat(n)),r.wmscManager.destroy());const e=new Date;D.A.add_monitor("WMSC_Load_Time: ".concat(e.getTime()-t.getTime()));const i=a.Ay.isWebRTCAudio2_0(r.mediaFeatureOptions,r.mid,!0,r.webrtcAudio2EnabledOnFT,r.abTestStrategy),l=p&(i?3:2),h="wss://".concat(o,"/wc/media/").concat(d,"?type=v&cid=").concat(n,"&mode=16"),f="WMSC_WSS_Init_Para: rwgHost:".concat(o,"|cid: ").concat(n,"|webrtcMode:").concat(p,"|useWebRTCAudio2_0:").concat(i,"|newMode:").concat(l);D.A.add_monitor(f),r.wmscManager=new s({webRTCWebSocketUrl:h,confId:n,nodeId:u,hdVideoEnabled:r.isVideoHD,mediaStreamController:lo,iceServers:r.iceServers,videoCodecConfig:r.webrtcVideoCodecConfig,webrtcMode:l,requestHandler:r.wmscRequestHandler.bind(r),probe:!1})}else r.wmscManager.setNodeId(u);if(!r.wmscManager.isJoinRWGSuccess)return r.wmscManager.waitJoinRWGSuccess().then((()=>ao(r,void 0,void 0,(function*(){if(yield f(),"{}"!==JSON.stringify(this.webrtcConfig.subscribeQosParamsData)){D.A.add_monitor("WMSC_Update_Qos_Subscription_Async");for(const e in this.webrtcConfig.subscribeQosParamsData){const t=this.webrtcConfig.subscribeQosParamsData[e];this.wmscManager.updateQosSubscription(...t)}this.webrtcConfig.subscribeQosParamsData={}}this.wmscManager.onActiveSpeakerChange(this.activeSpeakerSsrc)}))));yield f()}()})))).catch((t=>{if(c.Ay.error("WebRTC _initWMSC error:",t),"ChunkLoadError"===(null==t?void 0:t.name)){const{currentReloadTimes:i,maxReloadTimes:r}=this.webrtcConfig;if(i>=r){const e="WMSC_JS_LOAD_FAIL_FAILOVER";return c.Ay.error(e),d.A.Notify_APPUI(n.oQY),Promise.reject(e)}setTimeout((()=>(c.Ay.error("WMSCf_IMPORT_FAIL ".concat(this.webrtcConfig.currentReloadTimes),t),this.webrtcConfig.currentReloadTimes+=1,this._initWMSC(e))),1e3)}return Promise.reject(t)}))}))}initVideoDecode(){return ao(this,arguments,void 0,(function(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{wasmFlag:!1};return function*(){var i,r;let s=e.mediaParams.videoDecodeThreadNum,o=e.mediaParams.isEnableDecodingHW,n=t.wasmFlag;const{meetingNumber:h,rwgHost:u,userId:p,cid:f,webrtcMode:m}=e.meetingParams,v="wss://".concat(u,"/wc/media/").concat(h,"?type=v&cid=").concat(f);if(null===(i=e.systemReporter)||void 0===i||i.setUserId(p),(a.Ay.isAndroidBrowser()&&!a.Ay.isMTRAndroid()&&!a.Ay.isGoogleMeetAndroid()||a.Ay.isIphoneOrIpadBrowser())&&void 0===o&&(o=!0),e.userId=p,s=(0,a.OC)(),!l.AssertMediaSdkNotDestory(e))return!1;let g=e.platformType;a.Ay.isAndroidBrowser()&&!a.Ay.isAndroidIntegrationWithSAB()?g=P.u7.ANDROID:a.Ay.isIphoneOrIpadBrowser()&&(g=P.u7.IPHONE);let _=!1;if(e.webrtcConfig.webrtcflag&&!n)return D.A.add_monitor("WMSC_INITVD"),e.initVDPara=t,e.resolveVDwebrtcpromise(!0),d.A.hasUsedWebrtc=!0,e._initWMSC({rwgHost:u,cid:f,meetingNumber:h,workerType:E._c.VIDEO_DECODE,userId:p,webrtcMode:m}).then((()=>{d.A.webrtcVideoInited=!0})).catch((()=>{}));if(e.webrtcConfig.webrtcflag||n||!d.A.webrtcVideoInited||(d.A.webrtcVideoInited=!1,_=!0),D.A.add_monitor("INITVD-".concat(e.meetingParams.isPreviewMode)),e.meetingParams.isPreviewMode)return void e.setupLocalPreview({videoDecode:{},videoDataChannel:{conId:f},videoDecodeMediaWss:{websocketUrl:v}});l.previewController.resetVideoDecode(!1),ho("initVideoDecode"),D.A.add_monitor("DOWL:"+e.isWebCodecDecoderOnWhitelist),e.setMultiView(s,d.A.enableMultiDecodeVideoWithoutSAB),e.is32bitbrowser=yield a.Ay.is32bitChrome();let S=yield a.Ay.isSDKSupportMultiThread();e.codecDoAVSync=S;let A=yield a.Ay.isSDKSupportSIMD(),y=A&&S,C={};e.isEnableVideoDecodeHardWareThread=S&&e._enableHardWareDecode(),o&&e.isEnableVideoDecodeHardWareThread?(e.videodecodehardwareflag=yield a.Ay.IsSupportVideoDecodeHardwareAcceleration(d.A.enableHADecOpt),o=e.videodecodehardwareflag):o=!1,e.isSupportVideoShare&&(e.isSupportVideoShare=y),D.A.add_monitor("isMT:"+S),D.A.add_monitor("SIMD:"+A),D.A.add_monitor("VDHT:"+e.isEnableVideoDecodeHardWareThread),D.A.add_monitor("VDHW:"+e.videodecodehardwareflag),D.A.add_monitor("SupportWebCodecDecode:".concat(o));let b=null===(r=e.getFilePath)||void 0===r?void 0:r.call(e);e.isSupportVideoShare?(C.workerJsFileUrl=b.vsmiworkerpath,C.workerWasmFileUrl=b.videoMSIMDWasm):y?(C.workerJsFileUrl=b.videoMSIMDWorkerPath,C.workerWasmFileUrl=b.videoMSIMDWasm):S?(C.workerJsFileUrl=b.videoMtWorkerPath,C.workerWasmFileUrl=b.videoMtWasm):A?(C.workerJsFileUrl=b.videoSIMDWorkerPath,C.workerWasmFileUrl=b.videoSIMDWasm):(C.workerJsFileUrl=b.videoWorkerPath,C.workerWasmFileUrl=b.videoWasm),C.integrityHelper=new a.gP(C.workerJsFileUrl,e.lateLoadedAssetsHash),a.I4.getIsSupportWebtransport()&&l.Set_Video_Web_Transport_Ip_Address("https://".concat(u,":").concat(d.A.webtransportPort,"/wc/media/").concat(h,"?type=v&cid=").concat(f)),e.setupLocalPreview({videoDataChannel:{conId:f,userid:p}},!0);let w=o&&e.isEnableVideoDecodeHardWareThread&&s>1&&navigator.hardwareConcurrency&&navigator.hardwareConcurrency>=4;a.Ay.setsub1080pcapacity(w),yield e.onRendererTypeSelected();let R={log:!1,confId:p,meetingid:"",meetingnumb:h,videodecodethreadnumb:s,isFirefox:a.Ay.browser.isFirefox,isSupportMultiThread:S,isSupportOffscreenCanvas:e.isSupportOffscreenCanvas,isenablehw:o,isEnableVideoDecodeHardWareThread:e.isEnableVideoDecodeHardWareThread,isEnableHardWareThread:e.isEnableHardWareThread,isTeslaMode:e.isTeslaMode,logHost:e.mediaParams.logHost,hasLog:e.mediaParams.hasLog,enableTCP:e.mediaParams.enableTCP,platformType:g,rendererType:e.rendererType,isWebCodecDecoderOnWhitelist:e.isWebCodecDecoderOnWhitelist,webrtcvideo:e.webrtcConfig.webrtcflag,isLSSPlayer:e.isLSSPlayer};if(l.setVideoEngineInitProperties(v,R),!l.AssertMediaSdkNotDestory(e))return!1;if(yield l.initVideoDecode(C,e),!l.AssertMediaSdkNotDestory(e))return!1;let T=e;e.allpromises.push(d.A.videoDecInitInstance.initSuccessPromise);let I=null;return e.bVideoDecodeUsingSAB&&!e.videoDecodeRingBuffer&&(S?(I=!0,e.videoDecodeRingBuffer=!0):(I=fe.N6.getStorageForCapacity(),e.videoDecodeRingBuffer=I)),yield d.A.videoDecInitInstance.initSuccessPromise.then((t=>ao(e,void 0,void 0,(function*(){return!!l.AssertMediaSdkNotDestory(T)&&(t&&this.bVideoDecodeUsingSAB&&I&&l.pushMessageToWorker(E._c.VIDEO_DECODE,S?null:{buffer:I,offset:0,length:I.byteLength},Zt.VIDEO_DECODE_SAB_FROM_DATACHANNEL,!1,!0),t)})))).then((t=>(D.A.add_monitor("INITVDRET-".concat(T._id,"-").concat(t&&!T.isDestroy)),!!l.AssertMediaSdkNotDestory(T)&&(n||e.init_Notify_APPUI(t,E._c.VIDEO_DECODE),l.preserveMessageController.subscribeMessage(l.preserveMessageController.nameMap.INIT_VIDEO_DECODE_SUCCESS),l.setCachedUserNodeListToWorker(E._c.VIDEO_DECODE),T.waitingVcChannelReady&&T.addChannelForVideo(),t&&_&&c.Ay.directReport("video fallback to wasm successfully"),T.registerMeshNote(),t))))}()}))}initAudioEncode(){return ao(this,void 0,void 0,(function*(){var e;const{isPreviewMode:t,meetingNumber:i,rwgHost:r,userId:s,cid:o,webrtcMode:n,meetingId:c,abToken:h}=this.meetingParams;if(n&P.h)return void this.setupLocalPreview({audioBridge:{abToken:h,rwgHost:r,meetingNumber:i,userId:s,cid:o,webrtcMode:n,workerType:E._c.AUDIO_ENCODE}});const u="wss://".concat(r,"/wc/media/").concat(i,"?type=a&cid=").concat(o);if(this.userId=s,ho("initAudioEncode"),!l.AssertMediaSdkNotDestory(this))return!1;D.A.add_monitor("INITAE"),Ce.A.setUserId(s),l.previewController.resetAudioEncode(t),this.is32bitbrowser=yield a.Ay.is32bitChrome();let p={},f=yield a.Ay.isSDKSupportSIMD();const m=null===(e=this.getFilePath)||void 0===e?void 0:e.call(this);f?(p.workerJsFileUrl=m.audioSIMDWorkletPath,p.workerWasmFileUrl=m.audioSIMDWasm,a.Ay.isAudioWASMLight()&&(p.workerJsFileUrl=m.audioLightSIMDWorkletPath,p.workerWasmFileUrl=m.audioLightSIMDWasm)):(p.workerJsFileUrl=m.audioWorkerPath,p.workerWasmFileUrl=m.audioWasm),p.integrityHelper=new a.gP(p.workerJsFileUrl,this.lateLoadedAssetsHash),t||(a.I4.getIsSupportWebtransport()&&l.Set_Audio_Web_Transport_Ip_Address("https://".concat(r,":").concat(d.A.webtransportPort,"/wc/media/").concat(i,"?type=a&cid=").concat(o)),this.setupLocalPreview({audioDataChannel:{conId:o,userid:s}},!0)),this.audioCtx||(this.audioCtx=(0,a.Bw)());let v={sampleRate:this.audioCtx.sampleRate,userId:s,meetingId:c,meetingNumber:i};if(l.setAudioEngineInitProperties(u,v),!l.AssertMediaSdkNotDestory(this))return!1;if(yield l.initAudioEncode(p,this),t||this.isDestroy)return;let g=this;this.allpromises.push(d.A.audioEncodeInitInstance.initSuccessPromise);let _=null;return this.bAudioDecodeUsingSAB&&!this.audioEncodeRingBuffer&&(_=fe.N6.getStorageForCapacity(100),this.audioEncodeRingBuffer=_),yield d.A.audioEncodeInitInstance.initSuccessPromise.then((e=>!g.isDestroy&&(e&&this.bAudioEncodeUsingSAB&&_&&l.pushMessageToWorker(E._c.AUDIO_ENCODE,{buffer:_,offset:0,length:_.byteLength,bAudioEncodeMainThreadConsumerIntervalEnable:!1},Zt.AUDIO_ENCODE_SAB,!1,!0),e))).then((e=>(D.A.add_monitor("INITAERET-".concat(g._id,"-").concat(e&&!g.isDestroy)),!!l.AssertMediaSdkNotDestory(g)&&(this.init_Notify_APPUI(e,E._c.AUDIO_ENCODE),l.setCachedUserNodeListToWorker(E._c.AUDIO_ENCODE),e))))}))}initAudioDecode(){return ao(this,void 0,void 0,(function*(){var e,t;const{meetingNumber:i,rwgHost:r,userId:s,cid:o,webrtcMode:n,meetingId:h,isPreviewMode:u,abToken:p}=this.meetingParams;if(null===(e=this.systemReporter)||void 0===e||e.setUserId(s),n&P.h)return yield this.setupLocalPreview({audioBridge:{abToken:p,rwgHost:r,meetingNumber:i,userId:s,cid:o,webrtcMode:n,workerType:E._c.AUDIO_DECODE}}),void this.registerMeshNote();const f="wss://".concat(r,"/wc/media/").concat(i,"?type=a&cid=").concat(o);if(this.userId=s,!l.AssertMediaSdkNotDestory(this))return!1;if(D.A.add_monitor("INITAD-".concat(u)),u)return void this.setupLocalPreview({audioDecode:{},audioDataChannel:{conId:o},audioDecodeMediaWss:{websocketUrl:f}});l.previewController.resetAudioDecode(!1),ho("initAudioDecode"),Ce.A.setUserId(s);let m=!1;"WEBRTC 1.0"!==d.A.audioSolution&&"WEBRTC 2.0"!==d.A.audioSolution||(D.A.add_monitor("AudioFallback:".concat("WEBRTC 1.0"===d.A.audioSolution?"WebRTC1.0":"WebRTC2.0","toWASM")),m=!0),d.A.audioSolution="WASM",this.is32bitbrowser=yield a.Ay.is32bitChrome();let v={};const g=null===(t=this.getFilePath)||void 0===t?void 0:t.call(this);v.workerJsFileUrl=g.audioWorkerPath,v.workerWasmFileUrl=g.audioWasm,a.I4.getIsSupportWebtransport()&&l.Set_Audio_Web_Transport_Ip_Address("https://".concat(r,":").concat(d.A.webtransportPort,"/wc/media/").concat(i,"?type=a&cid=").concat(o)),this.setupLocalPreview({audioDataChannel:{conId:o,userid:s}},!0);let _=yield a.Ay.isSDKSupportMultiThread();(yield a.Ay.isSDKSupportSIMD())?(v.workerJsFileUrl=g.audioSIMDWorkletPath,v.workerWasmFileUrl=g.audioSIMDWasm,a.Ay.isAudioWASMLight()&&(v.workerJsFileUrl=g.audioLightSIMDWorkletPath,v.workerWasmFileUrl=g.audioLightSIMDWasm)):(v.workerJsFileUrl=g.audioWorkerPath,v.workerWasmFileUrl=g.audioWasm),v.integrityHelper=new a.gP(v.workerJsFileUrl,this.lateLoadedAssetsHash),this.audioCtx||(this.audioCtx=(0,a.Bw)(),this.isLSSPlayer&&(this.gainNode=this.audioCtx.createGain()));let S={sampleRate:this.audioCtx.sampleRate,userId:s,meetingId:h,meetingNumber:i,isSupportMultiThread:_,logHost:this.mediaParams.logHost,hasLog:this.mediaParams.hasLog,enableTCP:this.mediaParams.enableTCP,isLSSPlayer:this.isLSSPlayer};if(l.setAudioEngineInitProperties(f,S),!l.AssertMediaSdkNotDestory(this))return!1;if(yield l.initAudioDecode(v,this),!l.AssertMediaSdkNotDestory(this))return!1;let A=this;this.allpromises.push(d.A.audioDecInitInstance.initSuccessPromise);let y=null;return this.bAudioDecodeUsingSAB&&!this.audioDecodeRingBuffer&&(y=fe.N6.getStorageForCapacity(100),this.audioDecodeRingBuffer=y),yield d.A.audioDecInitInstance.initSuccessPromise.then((e=>ao(this,void 0,void 0,(function*(){return!A.isDestroy&&(D.A.add_monitor("ADIP"+!!e),e&&this.bAudioDecodeUsingSAB&&y&&(yield l.pushMessageToWorker(E._c.AUDIO_DECODE,{buffer:y,offset:0,length:y.byteLength},Zt.AUDIO_DECODE_SAB,!1,!0)),e)})))).then((e=>(D.A.add_monitor("INITADRET-".concat(A._id,"-").concat(e&&!A.isDestroy)),!!l.AssertMediaSdkNotDestory(A)&&(e&&m&&c.Ay.directReport("fallback to wasm solution successfully"),this.init_Notify_APPUI(e,E._c.AUDIO_DECODE),l.setCachedUserNodeListToWorker(E._c.AUDIO_DECODE),this.registerMeshNote(),e))))}))}initSharingDecode(){return ao(this,void 0,void 0,(function*(){var e;const{meetingNumber:t,rwgHost:i,userId:r,cid:s}=this.meetingParams,o="wss://".concat(i,"/wc/media/").concat(t,"?type=s&cid=").concat(s);if(!l.AssertMediaSdkNotDestory(this))return!1;D.A.add_monitor("INITSD");let n=yield a.Ay.isSDKSupportSIMD(),c=yield a.Ay.isSDKSupportMultiThread(),h=n&&c;this.isSupportVideoShare&&(this.isSupportVideoShare=h),this.is32bitbrowser=yield a.Ay.is32bitChrome();const u=this.platformType===P.u7.DESKTOP;if(!this.is32bitbrowser&&u&&n||(this.shareSubController.setMaxCapablity(5),this.shareSubController.setMaxRenderSize(2)),this.isSupportVideoShare&&this.webrtcConfig.webrtcflag)try{yield this.webrtcVDpromise,this.initVDPara.wasmFlag=!0,yield this.initVideoDecode(this.initVDPara)}catch(e){D.A.add_monitor("INITVDSDF")}if(this.userId=r,this.recordSharingParamInfo(),this.isSupportVideoShare){this.allpromises.push(d.A.sharingDecInitInstance.socketSuccessPromise);let e=this;return yield d.A.sharingDecInitInstance.handlerSuccessPromise,yield d.A.sharingDecInitInstance.socketSuccessPromise.then((t=>(D.A.add_monitor("INITSDRET-".concat(e._id,"-").concat(t&&!e.isDestroy)),!!l.AssertMediaSdkNotDestory(e)&&(this.init_Notify_APPUI(t,E._c.SHARING_DECODE),l.setCachedUserNodeListToWorker(E._c.SHARING_DECODE),this.registerMeshNote(),t))))}yield this.onRendererTypeSelected();let p=null===(e=this.getFilePath)||void 0===e?void 0:e.call(this),f={};h?(f.workerJsFileUrl=p.sharingMSIMDWorkerPath,f.workerWasmFileUrl=p.videoMSIMDWasm):c?(f.workerJsFileUrl=p.sharingMtWorkerPath,f.workerWasmFileUrl=p.videoMtWasm):n?(f.workerJsFileUrl=p.sharingSIMDWorkerPath,f.workerWasmFileUrl=p.videoSIMDWasm):(f.workerJsFileUrl=p.sharingWorkerPath,f.workerWasmFileUrl=p.videoWasm),f.integrityHelper=new a.gP(f.workerJsFileUrl,this.lateLoadedAssetsHash);let m={log:!1,userid:r,meetingid:"",meetingnumb:t,isSupportMultiThread:c,rendererType:this.rendererType,isWebCodecDecoderOnWhitelist:this.isWebCodecDecoderOnWhitelist};if(l.setSharingEngineInitProperties(o,m),!l.AssertMediaSdkNotDestory(this))return!1;if(yield l.initSharingDecode(f,this),!l.AssertMediaSdkNotDestory(this))return!1;this.allpromises.push(d.A.sharingDecInitInstance.initSuccessPromise);let v=this;return yield d.A.sharingDecInitInstance.initSuccessPromise.then((e=>(D.A.add_monitor("INITSDRET-".concat(v._id,"-").concat(e&&!v.isDestroy)),!!l.AssertMediaSdkNotDestory(v)&&(this.init_Notify_APPUI(e,E._c.SHARING_DECODE),l.setCachedUserNodeListToWorker(E._c.SHARING_DECODE),this.registerMeshNote(),e))))}))}initSharingEncode(){return ao(this,void 0,void 0,(function*(){var e;const{rwgHost:t,meetingNumber:i,userId:r,cid:s}=this.meetingParams,o="wss://".concat(t,"/wc/media/").concat(i,"?type=s&cid=").concat(s);D.A.add_monitor("INITSE");let c=yield a.Ay.isSDKSupportSIMD(),u=yield a.Ay.isSDKSupportMultiThread(),p=c&&u;if(this.isSupportVideoShare&&(this.isSupportVideoShare=p),this.isSupportVideoShare&&this.webrtcConfig.webrtcflag)try{yield this.webrtcpromise,this.initVEPara.wasmFlag=!0,yield this.initVideoEncode(this.initVEPara)}catch(e){D.A.add_monitor("INITVESEF")}if(this.userId=r,!l.AssertMediaSdkNotDestory(this))return!1;if(this.isSupportVideoShare){this.allpromises.push(d.A.sharingEncInitInstance.socketSuccessPromise);let e=this;return yield d.A.sharingEncInitInstance.handlerSuccessPromise,yield d.A.sharingEncInitInstance.socketSuccessPromise.then((t=>(D.A.add_monitor("INITSERET-".concat(e._id,"-").concat(t&&!e.isDestroy)),!!l.AssertMediaSdkNotDestory(e)&&(this.init_Notify_APPUI(t,E._c.SHARING_ENCODE),l.setCachedUserNodeListToWorker(E._c.SHARING_ENCODE),a.Ay.getGpuInfo().isWebGLContextInvalid&&!ue.X.isUseSsrcStream()&&(0,h.iK)(n.AoB,{reason:"WebGLContextInvalid"}),t))))}let f=null===(e=this.getFilePath)||void 0===e?void 0:e.call(this);this.is32bitbrowser=yield a.Ay.is32bitChrome(),yield this.onRendererTypeSelected();let m={};p?(m.workerJsFileUrl=f.sharingMSIMDWorkerPath,m.workerWasmFileUrl=f.videoMSIMDWasm):u?(m.workerJsFileUrl=f.sharingMtWorkerPath,m.workerWasmFileUrl=f.videoMtWasm):c?(m.workerJsFileUrl=f.sharingSIMDWorkerPath,m.workerWasmFileUrl=f.videoSIMDWasm):(m.workerJsFileUrl=f.sharingWorkerPath,m.workerWasmFileUrl=f.videoWasm),m.integrityHelper=new a.gP(m.workerJsFileUrl,this.lateLoadedAssetsHash);let v={log:!1,userid:r,meetingid:"",meetingnumb:i,isSupportMultiThread:u,rendererType:this.rendererType};if(l.setSharingEngineInitProperties(o,v),!l.AssertMediaSdkNotDestory(this))return!1;if(yield l.initSharingEncode(m,this),!l.AssertMediaSdkNotDestory(this))return!1;let g=this;return this.allpromises.push(d.A.sharingEncInitInstance.initSuccessPromise),yield d.A.sharingEncInitInstance.initSuccessPromise.then((e=>(D.A.add_monitor("INITSERET-".concat(g._id,"-").concat(e&&!g.isDestroy)),!!l.AssertMediaSdkNotDestory(g)&&(this.init_Notify_APPUI(e,E._c.SHARING_ENCODE),l.setCachedUserNodeListToWorker(E._c.SHARING_ENCODE),e))))}))}JsMediaSDK_UnInit(){l.Stop_Monitor(this),l.Stop_Recv_StatsMap_Clear_Handle(),this.videoRenderArray.length&&this.videoRenderArray.forEach((function(e){e.display&&(e.display.cleanup(),e.display=null)})),d.A._callbackList=[],d.A._Notify_APPUI=null,(0,h._G)(null)}StartAudioMediaCapture(){let e=Yi.draftAudioConstraints(this);lo.startCaptureAudio({audioConstraints:e,successHandler:this.handleAudioCapture.bind(this),errorHandler:t=>{Yi.checkCaptureNeedDeviceFallback(e,t)?(c.Ay.error("[Audio] checkCaptureNeedDeviceFallback, retrying..."),lo.startCaptureAudio({audioConstraints:e,successHandler:this.handleAudioCapture.bind(this),errorHandler:this.handleAudioError.bind(this)})):this.handleAudioError(t)}})}StartDesktopMediaCapture(){return ao(this,void 0,void 0,(function*(){if(this.desktopSharingValue.audioOnly){try{const e=yield navigator.mediaDevices.getUserMedia({audio:{deviceId:this.desktopSharingValue.deviceId?{exact:this.desktopSharingValue.deviceId}:a.Ay.browser.isChromeOrEdge?{exact:"default"}:void 0,echoCancellation:this.desktopSharingValue.echoCancellation,noiseSuppression:this.desktopSharingValue.noiseSuppression,autoGainControl:this.desktopSharingValue.autoGainControl,sampleRate:this.desktopSharingValue.sampleRate||48e3}});this.handleDesktopCapture(e,!0)}catch(e){this.handleCaptureError(e)}return}if(this.desktopSharingValue.sourceId){const e=this.desktopSharingValue.sourceId;try{const t=yield navigator.mediaDevices.getUserMedia({audio:!1,video:{mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:e}}});this.handleDesktopCapture(t)}catch(e){this.handleCaptureError(e)}return}const e=this.handleDesktopCapture.bind(this),t=this.handleCaptureError.bind(this);if(this.desktopSharingValue.share2ndCamera){const i=this.desktopSharingValue.share2ndCameraParams||{},r=i.VideoSelectValue,s=["user","environment","left","right"].includes(r),o=i.frameRate?{ideal:i.frameRate}:void 0;let n={width:i.width||640,height:i.height||360,frameRate:o};s?n.facingMode={exact:r}:n.deviceId=r?{exact:r}:void 0,this.desktopSharingValue.isCamFeedShare&&(a.Ay.isIphoneOrIpadBrowser()||a.Ay.isIpadOS())&&(this.desktopSharingValue.isCamFeedShareOniOS=!0);let d=!1;i.AudioSelectValue&&(d={noiseSuppression:null==i?void 0:i.noiseSuppression,autoGainControl:null==i?void 0:i.autoGainControl,echoCancellation:null==i?void 0:i.echoCancellation,sampleRate:i.sampleRate||48e3,deviceId:{exact:i.AudioSelectValue}});const c={video:n,audio:d};return void navigator.mediaDevices.getUserMedia(c).then(e,t)}const i=this.desktopSharingValue.videoParams,r=navigator.mediaDevices.getSupportedConstraints&&navigator.mediaDevices.getSupportedConstraints(),s=r&&!!r.displaySurface&&i&&i.displaySurface;if(navigator.mediaDevices.getDisplayMedia){let r=!(!a.Ay.isSupportSharedArrayBuffer()&&!this.webrtcAudio||!this.desktopSharingValue.showShareAudioOption)&&{autoGainControl:!1,noiseSuppression:!1,echoCancellation:!a.Ay.isSupportSharingStereo()},o=this.desktopSharingValue.videoParams||!0;s&&("object"==typeof o?o.displaySurface=i.displaySurface:"boolean"==typeof o&&(o={displaySurface:i.displaySurface}));let n=this.desktopSharingValue.otherParams,d=Object.assign({video:o,audio:r},n);navigator.mediaDevices.getDisplayMedia(d).then(e,t)}}))}StartVideoMediaCapture(){return ao(this,arguments,void 0,(function(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return function*(){const i=e.videoCaptureValue,r={encode:e.isStartVideoCapture,preview:e.isMaskSettingOn||e.isVBSettingOn};D.A.add_monitor("STARTVIDEOMEDIA:".concat(r.encode,":").concat(r.preview)),lo.startCaptureVideo({videoConstraints:e.videoCaptureValue?{videoSource:e.videoCaptureValue.VideoSelectValue,usingFacingMode:e.videoCaptureValue.usingFacingMode,width:e.videoCaptureValue.width,height:e.videoCaptureValue.height,pan:e.videoCaptureValue.pan,tilt:e.videoCaptureValue.tilt,zoom:e.videoCaptureValue.zoom,fps:e.videoCaptureValue.fps,customConstraints:e.videoCaptureValue.customConstraints}:null,timeout:e.videoCaptureValue?e.videoCaptureValue.timeout:null,successHandler:s=>ao(e,void 0,void 0,(function*(){var e,o,a;if(Ii.hasMediaStreamFrameProcessor()){Ii.removeStream(),Ii.setStream(s);const e=Ii.getStream();lo.processedStream=e}if(!l.AssertMediaSdkNotDestory(this,"videocapture"))return lo.enableReuseStream(!1),lo.destoryVideoMediaStream(),c.Ay.error("VideoCaptureException successed sdkinstance has destroyed"),void D.A.add_monitor("CVSBSDKD");if((null===(e=this.videoCaptureValue)||void 0===e?void 0:e.videoCtrl)===(null==i?void 0:i.videoCtrl)&&(this.videoCaptureValue=i),lo.videoConstraints){const{width:e,height:t}=lo.videoConstraints;e&&t&&(this.videoCaptureWidth=e instanceof Object?e.ideal:e,this.videoCaptureHeight=t instanceof Object?t.ideal:t)}let u=!1;try{const e=s.getVideoTracks()[0];if(D.A.add_monitor("WMSC_Stream_Capture_Success: ".concat(null==e?void 0:e.muted,"|").concat(null==e?void 0:e.readyState,"|").concat(s.active,"|").concat(!!(null===(o=this.videoCaptureValue)||void 0===o?void 0:o.videoCtrl))),e.onended=()=>ao(this,void 0,void 0,(function*(){if(!(yield Ce.A.hasPermission("camera")))return D.A.add_monitor("VTRS:"+e.readyState+"R"),void(0,h.iK)(n.x3x,h.pg.PERMISSION_RESET);let t=yield Ce.A.getDeviceListAsync(),i=!1;t.forEach((t=>{"videoinput"===t.kind&&t.deviceId===e.getSettings().deviceId&&(i=!0)})),i?(D.A.add_monitor("VTRS:"+e.readyState+"I"),(0,h.iK)(n.x3x,h.pg.EXCEPTION)):D.A.add_monitor("VTRS:"+e.readyState+"L"),l.Notify_Video_Encode_Thread({command:"healthCheck",op:P.FC.STOP,type:P.HX.VIDEO}),c.Ay.error("video media track ended")})),e.addEventListener("mute",(()=>ao(this,void 0,void 0,(function*(){D.A.add_monitor("VTMS:"+e.muted),this.videoCaptureValue&&(this.videoMuteTimeoutId=setTimeout((()=>{c.Ay.directReport("NotifyUIError,event=".concat(n.tMo,",data=").concat(!!this.videoCaptureValue)),d.A.Notify_APPUI_SAFE(n.tMo),this.videoMuteTimeoutId=0}),3e3),l.Notify_Video_Encode_Thread({command:"healthCheck",op:P.FC.PAUSE,type:P.HX.VIDEO})),(yield Ce.A.hasPermission("camera"))||(0,h.iK)(n.ONI,h.pg.LOST_ACCESS)})))),e.addEventListener("unmute",(()=>{D.A.add_monitor("VTMS:"+e.muted),this.webrtcConfig.webrtcflag&&this.wmscManager&&this.wmscManager.playAllVideoTag("videoTrackUnmute"),this.videoMuteTimeoutId?(clearTimeout(this.videoMuteTimeoutId),this.videoMuteTimeoutId=0):(c.Ay.directReport("NotifyUIError,event=".concat(n.IV3)),d.A.Notify_APPUI_SAFE(n.IV3)),l.Notify_Video_Encode_Thread({command:"healthCheck",op:P.FC.RESUME,type:P.HX.VIDEO})})),this.webrtcConfig.webrtcflag)if(this.wmscManager){t&&d.A.Notify_APPUI(n.ssE,this.userId);const e=lo.getProcessedVideoStream();(null===(a=this.wmscManager)||void 0===a?void 0:a.vbSettingVideoDom)&&(this.wmscManager.vbSettingVideoDom.srcObject=e),yield this.handleWebRTCVideoStream("streamCaptureSuccess",e),yield this.handleWebrtcVideoCapture(e),u=!0}else{const e="WMSC_Capture_Success_Handle_Fail:".concat(!!this.wmscManager,"|").concat(this.isStartVideoCapture,"|streamCaptureSuccess");D.A.add_monitor(e),c.Ay.error(e)}else yield this.handleWasmVideoCapture(s,r),u=!0;D.A.add_monitor("STARTVIDEORET:".concat(u,"|").concat(null==e?void 0:e.muted,"|").concat(s.active)),u&&(D.A.add_monitor("VCMS"),e.muted?(D.A.add_monitor("VTMS:"+e.muted),d.A.Notify_APPUI_SAFE(n.tMo)):(D.A.add_monitor("VTMS:"+e.muted),d.A.Notify_APPUI_SAFE(n.IV3)))}catch(e){this.handleVideoError(e)}})),errorHandler:function(t){let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e.handleVideoError(t,i)}})}()}))}Start_Audio_Play(){this.audioPlay=!0,d.A.AudioNode&&d.A.AudioNode.postCMD("startPlayAudio",null),l.UpdateAudioPlayStatus(!0)}Stop_Audio_Play(){l.UpdateAudioPlayStatus(!1),d.A.AudioNode&&d.A.AudioNode.postCMD("stopPlayAudio",null)}Remove_Audio_Play(){l.UpdateAudioPlayStatus(!1),this.audioPlay=!1,d.A.AudioNode&&d.A.AudioNode.postCMD("stopPlayAudio",null)}Meeting_Fail_Over(e,t){l.Meeting_Fail_Over(e,t)}Start_Desktop_Audio_Capture(){var e;let t=this.shareStreamScheduler.getRawStream();if(this.useWebRTCAudio)null===(e=this.webrtcAudio)||void 0===e||e.setStreamAsync(t,!0);else{let e=t.getAudioTracks();if(t&&e){var i=this.sharingAudioCtx.createMediaStreamSource(t);this.sharingWebrtcAudioNode=i,this.isSharingCaptureNodeConnect||(this.sharingWebrtcAudioNode.connect(d.A.SharingAudioNode),d.A.SharingAudioNode.postCMD("StartCaptureAudio",null),this.isSharingCaptureNodeConnect=!0)}}this.screenShareAudioPreviewElement&&this.screenShareAudioPreviewElement.play().catch((e=>{c.Ay.error("Screenshare audio preview play failed",e)}))}Start_Audio_Capture(){var e,t;if(lo.shouldCaptureAudio())this.StartAudioMediaCapture();else{if(lo.getAudioCapabilities().deviceId,this.audioInputLevel)return this.audioInputLevel.setAudioStream(lo.audioStream),this.captureAudioMuted||this.audioInputLevel.start(),void(d.A.ComputerAudioStatus===E.BX.ComputerAudio_Connecting&&(d.A.ComputerAudioStatus=E.BX.ComputerAudio_Connected,d.A.Notify_APPUI(n.Ubu,{microphoneDeviceId:lo.getAudioDeviceId()})));Zi.hasProcessor()&&Zi.resumeCtx();const r=Zi.hasProcessor()?Zi.getStream():lo.audioStream;if(this.useWebRTCAudio)return void(null===(e=this.webrtcAudio)||void 0===e||e.setStreamAsync(r).then((e=>{d.A.ComputerAudioStatus===E.BX.ComputerAudio_Connecting&&(d.A.ComputerAudioStatus=E.BX.ComputerAudio_Connected,d.A.Notify_APPUI(n.Ubu,{microphoneDeviceId:lo.getAudioDeviceId()}))})));if(d.A.AudioNode){this.webrtcAudioNode&&(this.webrtcAudioNode.disconnect(d.A.AudioNode),this.webrtcAudioNode=null);var i=this.audioCtx.createMediaStreamSource(r);this.webrtcAudioNode=i,this.webrtcAudioNode.connect(d.A.AudioNode),d.A.AudioNode.postCMD("StartCaptureAudio",null),l.Notify_Audio_Encode_Thread({command:Zt.START_AUDIO_CAPTURE,value:!0}),this.isCaputureNodeConnect=!0,"suspended"===this.audioCtx.state&&this.audioCtx.resume().catch((e=>{c.Ay.error("resume audio context error after capturing audio successfully",e)})),null===(t=this.audioDomNode)||void 0===t||t.play().catch((e=>{c.Ay.error("play audio error after capturing audio successfully",e)}))}d.A.ComputerAudioStatus===E.BX.ComputerAudio_Connecting&&(d.A.ComputerAudioStatus=E.BX.ComputerAudio_Connected,d.A.Notify_APPUI(n.Ubu,{microphoneDeviceId:lo.getAudioDeviceId()}))}}Stop_Audio_Capture(){l.Notify_Audio_Thread_Status(d.A.SPECIAL_ID,n.A_T)}_startVideoLoadedmetadataMonitor(e,t){var i;(null===(i=this.videoloadedmetadatamonitor)||void 0===i?void 0:i.stop)&&this.videoloadedmetadatamonitor.stop();let r=Math.min(P.Bb+5e3*this.loadedmetadatamtimeoutcount,3e4),s=setTimeout((()=>{var i;(null===(i=this.videoloadedmetadatamonitor)||void 0===i?void 0:i.id)!=t||this.isDestroy||((0,a.SI)(e),this.loadedmetadatamtimeoutcount++,this.videoloadedmetadatamonitor=null,e.readyState>=2?(this._videoloadedmetadata(t,{}),c.Ay.directReport("video is ready state no loadedmetadata callback")):(D.A.add_monitor("loadmetadatamtimeout:".concat(this.loadedmetadatamtimeoutcount)),this.handleVideoError(new Error("Video loadedmetadata timeout ".concat(this.loadedmetadatamtimeoutcount)))))}),r);this.videoloadedmetadatamonitor={id:t,stop:()=>{clearTimeout(s)}}}_addVideoLoadedmetadataListener(e){var t;if(!e)return void c.Ay.error("videodom is null");this.mountoadedmetadatatime=performance.now(),(null===(t=this.videoloadmetadataListener)||void 0===t?void 0:t.remove)&&(this.videoloadmetadataListener.remove(),this.videoloadmetadataListener=null);let i=Date.now();const r=this._videoloadedmetadata.bind(this,i);e.addEventListener("loadedmetadata",r),this.videoloadmetadataListener={id:i,remove:()=>{e.removeEventListener("loadedmetadata",r)}},this._startVideoLoadedmetadataMonitor(e,i)}_videoloadedmetadata(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;var i,r,s,o;if(this.videoloadmetadataListener){if(this.videoloadmetadataListener.id!=e)return;null===(i=this.videoloadmetadataListener)||void 0===i||i.remove(),this.videoloadmetadataListener=null}let a,h;(null===(r=this.videoloadedmetadatamonitor)||void 0===r?void 0:r.stop)&&(this.videoloadedmetadatamonitor.stop(),this.videoloadedmetadatamonitor=null);let u=this,p=null;if(t?(p=t.target||u.videoCaptureValue.videoCtrl,D.A.add_monitor("VIDEOLOADEDMETADATA:".concat(p==u.videoCaptureValue.videoCtrl))):D.A.add_monitor("VIDEOLOADEDMETADATA:".concat(!0)),!l.AssertMediaSdkNotDestory(u,"loadedmetadata"))return c.Ay.error("VideoCaptureException loadedmetadata JsMediaSDK instance destroyed"),lo.enableReuseStream(!1),void lo.destoryVideoMediaStream();u.isVideoCaptureLoadedmetadata&&c.Ay.warn("Video capture isVideoCaptureLoadedmetadata is true"),u.isVideoCaptureLoadedmetadata=!0,u.isSupportVideoFrameOrBitmapCapture?(a=u.videoCaptureWidth,h=u.videoCaptureHeight):(a=u.videoCaptureValue.videoCtrl.videoWidth,h=u.videoCaptureValue.videoCtrl.videoHeight,u.videoCaptureWidth=a,u.videoCaptureHeight=h,null===(s=u.captureVideoOutputCanvasDomList)||void 0===s||s.forEach((function(e){e.width=a,e.height=h}))),t&&this.startVideoCaptureSuccess(),null===(o=u.VideoRenderObj)||void 0===o||o.Set_LocalVideo_SSRC(u.videoCaptureValue.ssid),sr.setLocalVideoSsrc(u.videoCaptureValue.ssid),u.webrtcConfig.webrtcflag||(l.Notify_Video_Encode_Thread({command:"startVideoEncode",width:u.videoCaptureWidth,height:u.videoCaptureHeight,fps:u.videoCaptureValue.fps,ssid:u.videoCaptureValue.ssid,mtu_size:u.mtu_size,isSupportMediaStreamTrackProcessor:u.isSupportMediaStreamTrackProcessor,isSupportVideoFrame:this.isVideoTagFrameAccessible,isSupport2DCanvasDrawFrame:u.isSupport2DCanvasDrawFrame,disableOriginalRatio:!!u.videoCaptureValue.disableOriginalRatio}),l.Notify_Video_Decode_Thread({command:"startVideoEncode",ssid:u.videoCaptureValue.ssid,disableOriginalRatio:!!u.videoCaptureValue.disableOriginalRatio}),u.isSupportVideoShare||l.Notify_Sharing_Encode_Thread({command:"startVideoEncode"}),l.Notify_Video_Encode_Thread({command:"updateVideoPara",width:u.videoCaptureWidth,height:u.videoCaptureHeight,fps:u.GetVideoCaptureFps()})),u.lastRealRect.left=0,u.lastRealRect.top=0,u.lastRealRect.width=u.videoCaptureWidth,u.lastRealRect.height=u.videoCaptureHeight,d.A.Notify_APPUI(n.Shw,{width:a,height:h})}startVideoCaptureSuccess(){const{deviceId:e,pan:t=null,tilt:i=null,zoom:r=null,facingMode:s=null}=lo.getVideoCapabilities(),o={currentDeviceID:e,PTZRange:{pan:t,tilt:i,zoom:r},usingFacingMode:!1,VideoSelectValue:null},{usingFacingMode:c=!1}=this.VALUE_CACHE_FOR_START_CAPTURE_VIDEO;c&&(null==s?void 0:s.length)>0&&(o.usingFacingMode=!0,o.VideoSelectValue=s),D.A.add_monitor("START_VIDEO_CAPTURE_SUCCESS_Response:".concat((0,a.iD)(JSON.stringify(o)))),d.A.Notify_APPUI(n.EUC,o)}handleWebRTCVideoStream(e){return ao(this,arguments,void 0,(function(e){var t=this;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function*(){var r;if(!t.webrtcConfig.webrtcflag)return void D.A.add_monitor("WMSC_WebRTC_Flag_Error:".concat(e));const s=i||lo.getProcessedVideoStream();if(t.videoCaptureValue&&t.videoCaptureValue.videoCtrl&&(t.videoCaptureValue.videoCtrl.srcObject=s,lo.playVideoStream(t.videoCaptureValue.videoCtrl)),t.wmscManager&&s){if(t.wmscManager.updateSelfVideoStream(e,s),D.A.add_monitor("WMSC_Prepare_Send_streams:".concat(e,"|").concat(t.isStartVideoCapture)),t.isStartVideoCapture){const{width:e,height:i,frameRate:r}=lo.videoConstraints;let{width:s,height:o,fps:a,usingFacingMode:n}=t.videoCaptureValue;s&&o||(s=640,o=n?480:360);const d={width:(null==e?void 0:e.max)||(null==e?void 0:e.ideal)||s,height:(null==i?void 0:i.max)||(null==i?void 0:i.ideal)||o,frameRate:(null==r?void 0:r.max)||(null==r?void 0:r.ideal)||a};yield t.wmscManager.publishVideoStream(d)}}else D.A.add_monitor("WMSC_Send_Stream_Fail:".concat(!!t.wmscManager,"|").concat(!!s,"|").concat(!!(null===(r=t.videoCaptureValue)||void 0===r?void 0:r.videoCtrl),"|").concat(e))}()}))}render_self_video_wasm(){try{this.videoCaptureValue&&this.videoCaptureValue.videoCtrl&&!this.webrtcConfig.webrtcflag&&lo.playVideoStream(this.videoCaptureValue.videoCtrl),this.selfPreviewVideotagList&&this.selfPreviewVideotagList.length>0&&this.selfPreviewVideotagList.forEach((e=>{e&&lo.playVideoStream(e)}))}catch(e){c.Ay.error("Error trying to set srcObject of video tag",e)}}Start_Video_Capture(){if(!lo.shouldCaptureVideo()){var e=this;return new Promise(((t,i)=>{if(e.isSupportVideoFrameOrBitmapCapture?(e._videoloadedmetadata(null),e.render_self_video_wasm(),a.Ay.isSelfPreviewRenderWithVideo()&&e.isSupportVideoFrameOrBitmapCapture&&e.videoCaptureValue.videoCtrl&&!this.webrtcConfig.webrtcflag&&lo.playVideoStream(e.videoCaptureValue.videoCtrl),t(!0)):(e.isVideoCaptureLoadedmetadata&&(c.Ay.error("Video capture isVideoCaptureLoadedmetadata is true"),e.isVideoCaptureLoadedmetadata=!1),this._addVideoLoadedmetadataListener(e.videoCaptureValue.videoCtrl),lo.checkVideoStreamActive().then(t).catch(i),e.videoCaptureValue.videoCtrl&&!this.webrtcConfig.webrtcflag&&lo.playVideoStream(e.videoCaptureValue.videoCtrl)),this.webrtcConfig.webrtcflag)if(D.A.add_monitor("WMSC_Start_CAPTURE_REUSE_STREAM"),this.wmscManager)this.handleWebRTCVideoStream("reuseCaptureStream");else{const e="WMSC_Resuse_Stream_Fail:".concat(!!this.wmscManager,"|").concat(this.isStartVideoCapture,"|reuseCaptureStream");D.A.add_monitor(e),c.Ay.error(e)}D.A.add_monitor("STARTVIDEOSUCCESS"),(e.isSupportVideoFrameOrBitmapCapture||!e.isSupportVideoFrameOrBitmapCapture&&this.webrtcConfig.webrtcflag)&&this.startVideoCaptureSuccess()}))}this.StartVideoMediaCapture()}Stop_Video_Capture(){this.webrtcConfig.webrtcflag?(D.A.add_monitor("WMSC_Stop_Video_CAPTURE"),this.Stop_Video_Capture_for_webrtc()):this.Stop_Video_Capture_for_wasm(),this.isStartVideoCapture=!1,this.isVideoCaptureLoadedmetadata=!1,lo._clearCheckVideoStreamActiveTimer(),this.isMaskSettingOn||this.isVBSettingOn||this.isStartVideoCapture||(lo.destoryVideoMediaStream(),this.videoCaptureValue=null)}Stop_Video_Capture_for_wasm(){var e,t;if(l.Notify_Video_Encode_Thread({command:"stopVideoEncode"}),l.Notify_Video_Decode_Thread({command:"stopVideoEncode"}),l.Notify_Sharing_Encode_Thread({command:"stopVideoEncode"}),this.videoCaptureValue&&this.videoCaptureValue.videoCtrl&&!this.isMaskSettingOn&&!this.isVBSettingOn){let i=!1;if(this.videoloadmetadataListener&&(0,a.SI)(this.videoCaptureValue.videoCtrl),this.selfPreviewVideotagList.length&&this.selfPreviewVideotagList.forEach((e=>{e===this.videoCaptureValue.videoCtrl&&(i=!0),lo.removeVideoStream(e)})),i||lo.removeVideoStream(this.videoCaptureValue.videoCtrl),(null===(e=this.videoloadedmetadatamonitor)||void 0===e?void 0:e.stop)&&(this.videoloadedmetadatamonitor.stop(),this.videoloadedmetadatamonitor=null),null===(t=this.videoloadmetadataListener)||void 0===t?void 0:t.remove){this.videoloadmetadataListener.remove(),this.videoloadmetadataListener=null;let e=performance.now();e-this.mountoadedmetadatatime>5e3&&c.Ay.error("stop video capture but loadedmetadata not callback after ".concat(Math.round(e-this.mountoadedmetadatatime)," ms"))}}}Stop_Video_Capture_for_webrtc(){return ao(this,void 0,void 0,(function*(){var e,t;(null===(e=this.videoCaptureValue)||void 0===e?void 0:e.videoCtrl)&&lo.removeVideoStream(this.videoCaptureValue.videoCtrl),yield null===(t=this.wmscManager)||void 0===t?void 0:t.unpublishVideoStream()}))}Remove_Video_Capture(){lo.destoryVideoMediaStream(),this.videoCaptureValue=null,this.videoCaptureValue.videoCtrl&&this.videoCaptureValue.videoCtrl.pause()}Change_Video_Capture_Resolution(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var r;const s=this.platformType===P.u7.DESKTOP,o=null===(r=null===d.A||void 0===d.A?void 0:d.A.localVideoPara)||void 0===r?void 0:r.isSupportWebCodecEnocde;if(a.Ay.isIpadOS()&&!o)return void D.A.add_monitor("UVFR: 1");let h=!1;if((a.Ay.isIphoneOrIpadBrowser()||a.Ay.isIpadOS()||a.Ay.isAndroidBrowser()&&!a.Ay.isAndroidIntegrationWithSAB())&&(h=!0,i||(this.captureSize={width:e,height:t}),!this.isLandScape&&!o&&!i))return void D.A.add_monitor("UVFR: 2");if(e>=1920&&!s)return void D.A.add_monitor("UVFR: 3");const u=this.GetVideoCaptureFps();lo.changeVideoResolution(e,t,u,s).then((()=>{h||(this.ReadyCapureWidth=e,this.ReadyCapureHeight=t,this.videoCaptureWidth=e,this.videoCaptureHeight=t,d.A.Notify_APPUI(n.Shw,{width:e,height:t}),l.Notify_Video_Encode_Thread({command:"updateVideoPara",width:e,height:t,fps:this.GetVideoCaptureFps()}))})).catch((e=>{c.Ay.warn("change video resoltuion info:",e),D.A.add_monitor("UVFER:".concat(null==e?void 0:e.name,"-").concat(null==e?void 0:e.message))})),!lo.videoStreamTrack||this.isSupportMediaStreamTrackProcessor||this.isVideoTagFrameAccessible||this.webrtcConfig.webrtcflag||this.Process_Video()}Start_Whiteboard_Sharing(){return ao(this,void 0,void 0,(function*(){let e,t;const i=this.desktopSharingValue.canvas;this.whiteboardCanvas=i,this.isdesktopCaptureLoadedmetadata=!0,e=i.width,t=i.height,this.desktopSharingCaptureWidth=e,this.desktopSharingCaptureHeight=t,this.desktopCaptureContext=i.getContext("2d");let r={command:"startSharingEncode",width:e,height:t,fps:8,ssid:this.desktopSharingValue.ssid,isSupportMediaStreamTrackProcessor:!1,isWhiteboardSharing:!0};l.Notify_Video_Encode_Thread(r),this.isSupportVideoShare||l.Notify_Sharing_Encode_Thread(r)}))}Change_Sharing_Capture_Resolution(e){if(this.shareTrack){let t;console.log("change sharing capture resolution to",e),t=1==e?{video:!0,frameRate:5}:{width:1280,height:720,frameRate:24},this.shareTrack.applyConstraints(t)}}Start_Desktop_Sharing(){const e=this.shareStreamScheduler.getRawStream();if(e){var t=this;return new Promise(((i,r)=>{let o=function(i){return ao(this,void 0,void 0,(function*(){let i,r,s=t.shareStreamScheduler.getCurrentStream();if(s){var a=s.getVideoTracks()[0];yield lo.adjustShareResUnder2K(a);const c=Tr.hasMediaStreamFrameProcessor();if(c){const o=Tr.getStream();o&&(t.shareStreamScheduler.bindShareProcessorStream(o),t.shareStreamScheduler.switchToShareProcessorStream(),s=t.shareStreamScheduler.getCurrentStream(),a=s.getVideoTracks()[0],i=e.getVideoTracks()[0].getSettings().width,r=e.getVideoTracks()[0].getSettings().height,t.updateShareLivePreview(t.desktopSharingValue.video,s))}const h=!!t.desktopSharingValue.isCamFeedShareOniOS;if(t.isSupportMediaStreamTrackProcessor&&!h)"function"==typeof MediaStreamTrackProcessor?(t.sharingMediaStreamTrackProcessor=new MediaStreamTrackProcessor(a),t.sharingFrameStream=t.sharingMediaStreamTrackProcessor.readable,t.isSupportVideoShare?l.Notify_Sharing_Video_Encode_Thread_Transferable_Data("sharingframeStream",t.sharingFrameStream):l.Notify_Sharing_Encode_Thread_Transferable_Data("frameStream",t.sharingFrameStream)):l.Notify_Sharing_Encode_Thread_Transferable_Data(Zt.VIDEO_TRACK,a,!1),D.A.add_monitor("SCTP"),t.desktopSharingValue.video&&(i=c?i:t.desktopSharingValue.video.videoWidth,r=c?r:t.desktopSharingValue.video.videoHeight,t.desktopSharingCaptureWidth=i,t.desktopSharingCaptureHeight=r,t.desktopSharingValue.video.removeEventListener("loadedmetadata",o));else{if(t.isdesktopCaptureLoadedmetadata=!0,i=c?i:t.desktopSharingValue.video.videoWidth,r=c?r:t.desktopSharingValue.video.videoHeight,"function"!=typeof t.desktopSharingValue.canvas.getContext){const e=document.createElement("canvas");e.style.display="none",t.desktopSharingValue.canvas.parentNode.appendChild(e),t.desktopSharingValue.canvas=e}t.desktopSharingValue.canvas.width=i,t.desktopSharingValue.canvas.height=r,t.desktopSharingCaptureWidth=i,t.desktopSharingCaptureHeight=r,t.desktopCaptureContext=t.desktopSharingValue.canvas.getContext("2d"),t.desktopSharingValue.video.removeEventListener("loadedmetadata",o)}t.isSupportVideoShare?l.Notify_Sharing_Video_Encode_Thread({command:"startSharingEncode",width:i,height:r,fps:8,ssid:t.desktopSharingValue.ssid,isSupportMediaStreamTrackProcessor:t.isSupportMediaStreamTrackProcessor&&!h}):l.Notify_Sharing_Encode_Thread({command:"startSharingEncode",width:i,height:r,fps:8,ssid:t.desktopSharingValue.ssid,isSupportMediaStreamTrackProcessor:t.isSupportMediaStreamTrackProcessor&&!h}),d.A.Notify_APPUI(n.HL3,{width:i,height:r}),l.Notify_Video_Encode_Thread({command:"startsharingencode"})}else c.Ay.error("Start_Desktop_Sharing() no available stream when loadedmatadata called")}))};if(t.isSupportMediaStreamTrackProcessor?t.desktopSharingValue.video.addEventListener("loadedmetadata",o):(t.desktopSharingValue.video.addEventListener("loadedmetadata",o),t.desktopSharingValue.video.setAttribute("playsinline",""),t.desktopSharingValue.video.muted=!0),t.desktopSharingValue.video){try{t.desktopSharingValue.video.srcObject=e,t.desktopSharingValue.video.muted=!0}catch(i){t.desktopSharingValue.video.src=s().createObjectURL(e)}t.desktopSharingValue.video.play().catch((e=>{c.Ay.error("Screenshare video preview play failed",e)}))}d.A.isGoogleMeetMode&&e.getAudioTracks().length>0&&(t.screenShareAudioPreviewElement=new Audio,t.screenShareAudioPreviewElement.srcObject=e,t.screenShareAudioPreviewElement.setSinkId&&t.screenShareAudioPreviewElement.setSinkId(t.audioCtx.sinkId),t.screenShareAudioPreviewElement.play().catch((e=>{c.Ay.error("Screenshare audio preview play failed",e)}))),i(!0)}))}this.StartDesktopMediaCapture()}Process_Sharing(){return ao(this,void 0,void 0,(function*(){var e;if(!this.desktopSharingValue||!this.desktopSharingSend)return;let t,i,r,s,o=!(!this.localAnnoStarted||!this.localShareCanvas);if(this.isStartWhiteboardSharing)r=this.whiteboardCanvas,t=r.width,i=r.height;else if(r=this.desktopSharingValue.video,o)s=null===(e=this.localShareCanvas)||void 0===e?void 0:e.getContext("2d"),t=this.localShareCanvas.width,i=this.localShareCanvas.height;else if(this.shareStreamScheduler.isShareProcessorStream(this.shareStreamScheduler.getCurrentStream())){const e=this.shareStreamScheduler.getRawStream().getVideoTracks()[0].getSettings();t=e.width,i=e.height}else t=r.videoWidth,i=r.videoHeight;let a=lo.getScaledResolution(t,i);t=a.w,i=a.h,!o||this.localShareCanvas.width===t&&this.localShareCanvas.height===i||(this.localShareCanvas.width=t,this.localShareCanvas.height=i,this.annotationMgr.updateRemoteSizeInfo({width:t,height:i})),t==this.desktopSharingCaptureWidth&&i==this.desktopSharingCaptureHeight||(d.A.Notify_APPUI(n.HL3,{width:t,height:i}),this.desktopSharingCaptureWidth=t,this.desktopSharingCaptureHeight=i);try{if(this.isdesktopCaptureLoadedmetadata&&r){this.isStartWhiteboardSharing||(this.desktopSharingValue.canvas.width=t,this.desktopSharingValue.canvas.height=i);var h,u=this.desktopCaptureContext;!this.is32bitbrowser||this.flipSend?(this.isStartWhiteboardSharing||u.drawImage(r,0,0,t,i),h=s?s.getImageData(0,0,t,i):u.getImageData(0,0,t,i),1e3==this.sMonitorCaptureFrameCount&&(D.A.add_monitor2("SCFOK"),this.sMonitorCaptureFrameCount=0),this.sMonitorCaptureFrameCount++,l.Sharing_Encode_Frame(d.A.SPECIAL_ID,h.data,h.data.length,0,t,i),this.flipSend=!1):(this.flipSend=!0,l.Sharing_Encode_Frame(d.A.SPECIAL_ID,null,0,0,0,0))}}catch(e){c.Ay.error("An error occurred when trying to encode a sharing frame",e),D.A.add_monitor3("GIDF"),setTimeout((function(){l.Sharing_Encode_Frame(d.A.SPECIAL_ID,null,0,0,0,0)}),1e3)}}))}Update_Mask_Texture(e,t,i){if(this.VideoMaskSettingCanvas){try{"object"==typeof t&&t.ideal&&(t=t.ideal),"object"==typeof i&&i.ideal&&(i=i.ideal),this.bgCanvas&&this.bgCanvasctx||(this.bgCanvas=document.createElement("canvas"),this.bgCanvasctx=this.bgCanvas.getContext("2d")),this.bgCanvas.width==t&&this.bgCanvas.height==i||(this.bgCanvas.width=t,this.bgCanvas.height=i)}catch(e){c.Ay.error("Update_Mask_Texture, width=$".concat(JSON.stringify(t),", height=").concat(JSON.stringify(i),". "),e),t=this.bgCanvas.width,i=this.bgCanvas.height}if(this.bgCanvasctx.clearRect(0,0,t,i),this.MaskImage&&this.BgImage&&"blur"!==this.BgImage){if(e.dWidth>0&&e.dHeight>0&&this.VideoMaskSettingCanvas.width>0&&this.VideoMaskSettingCanvas.height>0&&t>0&&i>0){let r=e.dx/(this.VideoMaskSettingCanvas.width/t),s=e.dy/(this.VideoMaskSettingCanvas.height/i),o=e.dWidth/(this.VideoMaskSettingCanvas.width/t),a=e.dHeight/(this.VideoMaskSettingCanvas.height/i);this.bgCanvasctx.drawImage(this.MaskImage,r,s,o,a)}let r,s,o,a;this.bgCanvasctx.globalCompositeOperation="source-out",this.Crop_Mask_Bg_16V9(),r=this.bgImageCroppingParams.sx,s=this.bgImageCroppingParams.sy,o=this.bgImageCroppingParams.sw,a=this.bgImageCroppingParams.sh,this.bgCanvasctx.drawImage(this.BgImage,r,s,o,a,0,0,t,i)}}}Crop_Mask_Bg_16V9(){let e,t,i,r=0,s=16/9,o=this.BgImage.naturalWidth,a=this.BgImage.naturalHeight;s*a>=o?(i=o,r=o/s,e=0,t=(a-r)/2):(i=a*s,r=a,e=(o-i)/2,t=0),this.bgImageCroppingParams.sx=e,this.bgImageCroppingParams.sy=t,this.bgImageCroppingParams.sw=i,this.bgImageCroppingParams.sh=r}Draw_Mask_Frame(){if(!this.VideoMaskSettingCanvas)return;this.VideoMaskSettingCanvasctx||(this.VideoMaskSettingCanvasctx=this.VideoMaskSettingCanvas.getContext("2d"));const e=this.VideoMaskCanvasFillMode?Y(this.videoCaptureHiddenCanvas.width,this.videoCaptureHiddenCanvas.height,void 0,void 0,this.VideoMaskSettingCanvas.width/this.VideoMaskSettingCanvas.height):this.videoCaptureValue&&this.videoCaptureValue.disableOriginalRatio?Y(this.videoCaptureHiddenCanvas.width,this.videoCaptureHiddenCanvas.height):null;this.isMirrorMyVideo?(this.isCanvasScaled||(this.VideoMaskSettingCanvasctx.scale(-1,1),this.isCanvasScaled=!0),this.VideoMaskSettingCanvasctx.clearRect(0-this.VideoMaskSettingCanvas.width,0,this.VideoMaskSettingCanvas.width,this.VideoMaskSettingCanvas.height),this.VideoMaskSettingCanvasctx.drawImage(this.videoCaptureHiddenCanvas,...e?[e.left,e.top,e.width,e.height]:[],0-this.VideoMaskSettingCanvas.width,0,this.VideoMaskSettingCanvas.width,this.VideoMaskSettingCanvas.height)):(this.isCanvasScaled&&(this.VideoMaskSettingCanvasctx.setTransform(1,0,0,1,0,0),this.isCanvasScaled=!1),this.VideoMaskSettingCanvasctx.clearRect(0,0,this.VideoMaskSettingCanvas.width,this.VideoMaskSettingCanvas.height),this.VideoMaskSettingCanvasctx.drawImage(this.videoCaptureHiddenCanvas,...e?[e.left,e.top,e.width,e.height]:[],0,0,this.VideoMaskSettingCanvas.width,this.VideoMaskSettingCanvas.height))}Draw_No_VB_Preview_Frame(){if(!this.videoNoVBPreviewCanvas)return;this.videoNoVBPreviewCanvasctx||(this.videoNoVBPreviewCanvasctx=this.videoNoVBPreviewCanvas.getContext("2d"));const e=this.videoCaptureHiddenCanvas,t=this.videoNoVBPreviewCanvas.width,i=this.videoNoVBPreviewCanvas.height,r=e.width,s=e.height;let o,a,n;r/s>t/i?(o=t/r,a=0,n=(i-s*o)/2):(o=i/s,a=(t-r*o)/2,n=0),this.isMirrorMyVideo?(this.isVideoNoVBPreviewCanvasScaled||(this.videoNoVBPreviewCanvasctx.scale(-1,1),this.isVideoNoVBPreviewCanvasScaled=!0),this.videoNoVBPreviewCanvasctx.clearRect(0-this.videoNoVBPreviewCanvas.width,0,this.videoNoVBPreviewCanvas.width,this.videoNoVBPreviewCanvas.height),this.videoNoVBPreviewCanvasctx.drawImage(e,0,0,r,s,-a-r*o,n,r*o,s*o)):(this.isVideoNoVBPreviewCanvasScaled&&(this.videoNoVBPreviewCanvasctx.setTransform(1,0,0,1,0,0),this.isVideoNoVBPreviewCanvasScaled=!1),this.videoNoVBPreviewCanvasctx.clearRect(0,0,this.videoNoVBPreviewCanvas.width,this.videoNoVBPreviewCanvas.height),this.videoNoVBPreviewCanvasctx.drawImage(e,0,0,r,s,a,n,r*o,s*o))}DrawNoVBPreviewFromVideo(e){if(!this.videoNoVBPreviewCanvas)return;this.videoNoVBPreviewCanvasctx||(this.videoNoVBPreviewCanvasctx=this.videoNoVBPreviewCanvas.getContext("2d"));const t=e.videoWidth?e.videoWidth:640,i=e.videoHeight?e.videoHeight:360,r=this.videoNoVBPreviewCanvas.width,s=this.videoNoVBPreviewCanvas.height;let o,a,n;t/i>r/s?(o=r/t,a=0,n=(s-i*o)/2):(o=s/i,a=(r-t*o)/2,n=0),this.isMirrorMyVideo?(this.isVideoNoVBPreviewCanvasScaled||(this.videoNoVBPreviewCanvasctx.scale(-1,1),this.isVideoNoVBPreviewCanvasScaled=!0),this.videoNoVBPreviewCanvasctx.clearRect(0-this.videoNoVBPreviewCanvas.width,0,this.videoNoVBPreviewCanvas.width,this.videoNoVBPreviewCanvas.height),this.videoNoVBPreviewCanvasctx.drawImage(e,0,0,t,i,-a-t*o,n,t*o,i*o)):(this.isVideoNoVBPreviewCanvasScaled&&(this.videoNoVBPreviewCanvasctx.setTransform(1,0,0,1,0,0),this.isVideoNoVBPreviewCanvasScaled=!1),this.videoNoVBPreviewCanvasctx.clearRect(0,0,this.videoNoVBPreviewCanvas.width,this.videoNoVBPreviewCanvas.height),this.videoNoVBPreviewCanvasctx.drawImage(e,0,0,t,i,a,n,t*o,i*o))}GetVideoCaptureFps(){return this.videoCaptureValue&&this.videoCaptureValue.fps?this.videoCaptureValue.fps:P.Fw}Process_Video(){return ao(this,void 0,void 0,(function*(){if(this.isSupportMediaStreamTrackProcessor)return;if(!(this.videoCaptureValue&&this.isStartVideoCapture||this.isMaskSettingOn||this.isVBSettingOn))return;let e,t,i,r,s,o=this;i=this.videoCaptureWidth,r=this.videoCaptureHeight;const h=lo.isUsingFileInputVideoSource();if(this.isStartVideoCapture?s=this.videoCaptureValue.videoCtrl:(this.isMaskSettingOn||this.isVBSettingOn)&&(s=this.MaskSettingVideo),(0,a.qs)(s.srcObject))if((this.isVideoCaptureLoadedmetadata||this.isMaskSettingOn||this.isVBSettingOn)&&s&&s.readyState>=2){if((s.paused||s.ended)&&s.play().catch((e=>{c.Ay.error("Video capture video tag play failed",e)})),this.isSelfViewWithVideo&&this.platformType==P.u7.IPHONE){let e=null;try{let t=vo();e=new VideoFrame(s,{timestamp:1e3*performance.now()}),l.TransoferDataToVideoEncodeThread({command:"yuvVideoFrame",data:e,rotation:t},[e])||e.close()}catch(t){e&&e.close(),l.TransoferDataToVideoEncodeThread({command:"yuvVideoFrame"}),c.Ay.error("capture failed",t)}return}if(!o.isCurrentInMaskStatus&&o.isVideoTagFrameAccessible){let e=null;try{e=new VideoFrame(s,{timestamp:1e3*performance.now()});let t=vo(),i={command:"yuvVideoFrame",data:e,rotation:t};o.videoCaptureValue&&o.VideoRenderObj?(Ii.hasProcessor()||o.VideoRenderObj.Update_LocalVideo(e,t,!0),l.Notify_Video_Encode_Thread(i),e.close()):l.TransoferDataToVideoEncodeThread(i,[e])||e.close(),o.isVBSettingOn&&o.isCurrentInNoVBPreviewStatus&&o.DrawNoVBPreviewFromVideo(s)}catch(t){e&&e.close(),l.TransoferDataToVideoEncodeThread({command:"yuvVideoFrame"}),c.Ay.error("capture failed",t)}return}let p,f,m,v;if(e=s.videoWidth?s.videoWidth:640,t=s.videoHeight?s.videoHeight:360,e&&t&&(e!==i||t!==r)&&(ho("video width/height changed old => begin",i,r,e,t),d.A.Notify_APPUI(n.Shw,{width:e,height:t}),this.videoCaptureWidth=e,this.videoCaptureHeight=t,l.Notify_Video_Encode_Thread({command:"updateVideoPara",width:e,height:t,fps:o.GetVideoCaptureFps()})),(!(!o.isMaskSettingOn||o.videoCaptureValue&&o.videoCaptureValue.disableOriginalRatio)||o.MaskImage&&o.BgImage)&&o.isCurrentInMaskStatus&&o.isCurrentInNoVBPreviewStatus){let i=e/t*o.ReadyCapureHeight,r=t/e*o.ReadyCapureWidth;i>o.ReadyCapureWidth?(p=0,f=(o.ReadyCapureHeight-r)/2):(p=(o.ReadyCapureWidth-i)/2,f=0),m=o.ReadyCapureWidth-2*p,v=o.ReadyCapureHeight-2*f,o.videoCaptureHiddenCanvas.width=o.ReadyCapureWidth,o.videoCaptureHiddenCanvas.height=o.ReadyCapureHeight}else m=e,v=t,p=0,f=0,o.videoCaptureHiddenCanvas.width=e,o.videoCaptureHiddenCanvas.height=t;if(h?a.Ay.videoToMediaStreamManager.drawCanvas(o.videoCaptureHiddenCanvas,o.videoCaptureHiddenCanvasCtx,o.videoCaptureHiddenCanvas.width,o.videoCaptureHiddenCanvas.height):o.videoCaptureHiddenCanvasCtx.drawImage(s,0,0,e,t,p,f,m,v),o.isCurrentInMaskStatus&&(o.bgCanvas?o.videoCaptureHiddenCanvasCtx.drawImage(o.bgCanvas,0,0,o.videoCaptureHiddenCanvas.width,o.videoCaptureHiddenCanvas.height):o.Update_Mask_Texture(this.maskCoordinate,o.videoCaptureHiddenCanvas.width,o.videoCaptureHiddenCanvas.height),o.VideoMaskSettingCanvas&&o.Draw_Mask_Frame()),o.isCurrentInNoVBPreviewStatus&&o.videoNoVBPreviewCanvas&&o.Draw_No_VB_Preview_Frame(),o.isStartVideoCapture||o.isVBSettingOn){var u=o.videoCaptureHiddenCanvasCtx.getImageData(0,0,o.videoCaptureHiddenCanvas.width,o.videoCaptureHiddenCanvas.height);let e=u.data;o.lastRealRect.width==o.videoCaptureHiddenCanvas.width&&o.lastRealRect.height==o.videoCaptureHiddenCanvas.height||(o.lastRealRect.left=0,o.lastRealRect.top=0,o.lastRealRect.width=o.videoCaptureHiddenCanvas.width,o.lastRealRect.height=o.videoCaptureHiddenCanvas.height,l.Notify_Video_Encode_Thread({command:"updateVideoPara",width:o.lastRealRect.width,height:o.lastRealRect.height,fps:o.GetVideoCaptureFps()})),o.videoCaptureValue&&o.VideoRenderObj&&!o.isMultiView&&(u.data instanceof Uint8ClampedArray&&(e=new Uint8Array(u.data.buffer)),o.videoCaptureValue&&void 0!==o.videoCaptureValue.disableOriginalRatio&&o.VideoRenderObj.Set_Cropping_Mode(!!o.videoCaptureValue.disableOriginalRatio),o.VideoRenderObj.Draw_Send_Video_Img(e,o.videoCaptureHiddenCanvas.width,o.videoCaptureHiddenCanvas.height,o.videoCaptureValue.ssid,P.rK,o.lastRealRect)),3e3==o.vMonitorCaptureFrameCount&&(D.A.add_monitor2("VCFOK"),o.vMonitorCaptureFrameCount=0),o.vMonitorCaptureFrameCount++,l.Video_Encode_Frame(d.A.SPECIAL_ID,e,o.videoCaptureHiddenCanvas.width,o.lastRealRect.left,o.lastRealRect.top,u.width,u.height)}o.videoCaptureHiddenCanvasCtx.clearRect(0,0,o.videoCaptureHiddenCanvas.width,o.videoCaptureHiddenCanvas.height)}else l.TransoferDataToVideoEncodeThread({command:"yuvVideoFrame"});else l.TransoferDataToVideoEncodeThread({command:"yuvVideoFrame"})}))}Remove_Sharing_Audio_Capture(){var e;if(this.useWebRTCAudio)null===(e=this.webrtcAudio)||void 0===e||e.setStreamAsync(null,!0);else if(l.Notify_Audio_Encode_Thread({command:"changeAudioShare",isStart:!1}),d.A.ComputerAudioStatus==E.BX.ComputerAudio_Null&&l.addAudioMonitorLog.clear(),this.sharingWebrtcAudioNode&&d.A.SharingAudioNode){try{this.sharingWebrtcAudioNode.disconnect(d.A.SharingAudioNode)}catch(e){this.JsMediaSDK_Log(e)}this.sharingWebrtcAudioNode=null}}Remove_Audio_Capture(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(l.Notify_Audio_Thread_Status(d.A.SPECIAL_ID,n.YG0,e),d.A.DesktopAudioStatus==E.BX.DesktopAudio_Null&&l.addAudioMonitorLog.clear(),this.firstSetDelay=!0,this.webrtcAudioNode&&d.A.AudioNode){try{this.webrtcAudioNode.disconnect(d.A.AudioNode)}catch(e){this.JsMediaSDK_Log(e)}this.webrtcAudioNode=null}}Start_Video_Play(){this.videoRenderIntervalHandle||(this.videoRenderIntervalHandle=this.JsMediaSDK_VideoRenderInterval(this.videorenderinterval))}Stop_Video_Play(){this.UpdateVideoPlayStatus(!1),this.VideoRenderObj&&(this.VideoRenderObj.ClearQueue(),this.VideoRenderObj.Set_WaterMark_Info({waterMarkCanvas:this.waterMarkCanvas,isCreateVideoWaterMark:this.isCreateVideoWaterMark,videoWaterMarkName:this.videoWaterMarkName})),this.videoRenderIntervalHandle&&(this.VideoRenderObj.Stop_Draw.bind(this.VideoRenderObj)(),this.videoRenderIntervalHandle=null)}Remove_Video_Play(){this.UpdateVideoPlayStatus(!1),this.videoRenderIntervalHandle&&(clearInterval(this.videoRenderIntervalHandle),this.videoRenderIntervalHandle=null),l.Notify_Video_Decode_Thread({command:"removeVideoPlay"})}UpdateVideoPlayStatus(e){l.UpdateVideoPlayStatus(e)}EndMedia(){var e,t;try{d.A.rwgAgent&&d.A.rwgAgent.off("message",this.rwgAgentMessageListenerWrapper)}catch(e){c.Ay.error("rwgAgent.off error",e)}try{null===(e=this.videoDataChannel)||void 0===e||e.forceClose(),null===(t=this.audioDataChannel)||void 0===t||t.forceClose()}catch(e){c.Ay.error("clear rtcPeerConnectionList err",e)}finally{this.videoDataChannel=null,this.audioDataChannel=null}try{lo.enableReuseStream(!1),lo.destoryAudioMediaStream(),this.Remove_Audio_Play(),this.Remove_Audio_Capture(),this.Remove_Sharing_Audio_Capture(),this.checkWorkletInterval&&(clearInterval(this.checkWorkletInterval),this.checkWorkletInterval=null),this.Remove_Video_Play(),this.audioCtx&&(this.audioCtx.onstatechange=null,this.audioCtx.close(),this.audioCtx.onerror&&(this.audioCtx.onerror=null),this.audioCtx=null),this.sharingAudioCtx&&(this.sharingAudioCtx.close(),this.sharingAudioCtx=null),this.audioDomNode&&(this.audioDomNode=null)}catch(e){c.Ay.error("endMedia",e)}try{lo.enableReuseStream(!1),lo.destoryVideoMediaStream(),this.EndSharingMediaStream(),this.CloseBoringPeerConnection(),a.Ay.audioToMediaStreamMananger.destroy(!1)}catch(e){c.Ay.error("endMedia",e)}try{l.disableSocketReconnect()}catch(e){c.Ay.error("endMedia",e)}try{this.remoteControl&&this.remoteControl.destroy()}catch(e){c.Ay.error("endMedia",e)}}EndDesktopAudioMediaStream(){var e;let t=this.shareStreamScheduler.getRawStream();if(t){let i=t.getAudioTracks();i.length&&i.forEach((function(e){e.stop()})),this.desktopSharingValue.audioOnly&&!t.getVideoTracks().length&&this.shareStreamScheduler.unbindRawStream(),this.desktopSharingValue.audioOnly&&!(null===(e=this.desktopSharingMediaStreamRaw)||void 0===e?void 0:e.getVideoTracks().length)&&(this.desktopSharingMediaStreamRaw=null)}this.isStartDesktopSharing||(this.desktopSharingValue=null)}EndSharingMediaStream(){this.shareStreamScheduler.cleanCurrentStream(),this.shareStreamScheduler.unbindAnnotationRawStream();const e=this.shareStreamScheduler.getRawStream();e&&(e.getTracks().forEach((e=>e.stop())),this.shareStreamScheduler.unbindRawStream());const t=this.shareStreamScheduler.getAnnotationStream();t&&(t.getTracks().forEach((e=>e.stop())),this.shareStreamScheduler.unbindAnnotationStream()),Tr.hasMediaStreamFrameProcessor()&&Tr.removeStream(),window.WebQrscanner&&window.WebQrscanner.qrScanner.stop()}StopSharingCapture(){clearInterval(this.drawLocalShareIntervalId),this.EndSharingMediaStream(),this.desktopSharingSend=!1,this.isStartDesktopSharing&&(l.Notify_Video_Encode_Thread({command:"stopsharingencode"}),l.Notify_Sharing_Encode_Thread({command:"stopsharingencode"})),this.isStartDesktopSharing=!1,this.shareStreamScheduler.unbindRawStream(),this.shareStreamScheduler.cleanCurrentStream(),window.WebQrscanner&&window.WebQrscanner.qrScanner.stop(),this.desktopSharingValue=null}CloseBoringPeerConnection(){try{this.rtcConnectionB&&(this.rtcConnectionB.close(),this.rtcConnectionB=null),this.rtcConnectionA&&(this.rtcConnectionA.close(),this.rtcConnectionA=null)}catch(e){ho(e)}}UnMuteAudio(){l.Notify_Audio_Thread_Status(d.A.SPECIAL_ID,n.Eym),this.enableHID&&this.hidAvalible&&me.sendReport("mute",!1)}MuteAudio(){this.Stop_Audio_Capture(),this.enableHID&&this.hidAvalible&&me.sendReport("mute",!0)}selectComputerAudioSpeaker(e,t){return ao(this,void 0,void 0,(function*(){var i,r;let s="default"==e?"":e,o=null;return this.isChromeWideAECEnabled&&!this.audioDomNode?this.audioCtx&&(o=this.audioCtx):this.audioDomNode&&(o=this.audioDomNode),(yield Ce.A.hasValidOutputDevice(s))?((null===(i=this.fileAudioPlaybackTag)||void 0===i?void 0:i.setSinkId)&&this.fileAudioPlaybackTag.setSinkId(s).catch((e=>{c.Ay.error("set audio tag setSinkId error",e)})),this.useWebRTCAudio?void(null===(r=this.webrtcAudio)||void 0===r||r.changeSpeaker(e)):o?o.setSinkId?void o.setSinkId(s).then((()=>{Ce.A.updateSelectedSpeakerDevices((null==o?void 0:o.sinkId)||"default",Date.now()-t,!0),"suspended"===o.state&&(D.A.add_monitor("AUDIOCONTEXT:RESUME"),o.resume().catch((e=>{c.Ay.error("resume audio context failed when setSinkId",e)}))),d.A.Notify_APPUI(n.a6z,(null==o?void 0:o.sinkId)||"default"),this.audioSpeakerSetErrorCnt=0})).catch((e=>{c.Ay.error("An error occurred when trying to set the audio output device",e),D.A.add_monitor("AODF"),Ce.A.updateSelectedSpeakerDevices(s,Date.now()-t,!1),this.notifyUISetSpeakerError({currentSink:(null==o?void 0:o.sinkId)||"default",error:e,errorCode:h.Lg.BROWSER_ERROR,errorMessgae:"SetSinkId failed, error = ".concat(e.message)})})):(c.Ay.error("setSinkId is not supported"),void this.notifyUISetSpeakerError({currentSink:(null==o?void 0:o.sinkId)||"default",errorCode:h.Lg.UNSUPPORTED_BROWSER,errorMessgae:"SetSinkId is not supported."})):(D.A.add_monitor("NoAudioPlayer"),void this.notifyUISetSpeakerError({currentSink:(null==o?void 0:o.sinkId)||"default",errorCode:h.Lg.INTERNAL_ERROR,errorMessgae:"AudioPlayer does not exists."}))):(Ce.A.updateSelectedSpeakerDevices(s,0,!1),c.Ay.error("Selected output device ID is not available: ".concat(s)),void this.notifyUISetSpeakerError({currentSink:(null==o?void 0:o.sinkId)||"default",errorCode:(null==o?void 0:o.setSinkId)?h.Lg.PARAMATER_INVALID:h.Lg.UNSUPPORTED_BROWSER,errorMessgae:(null==o?void 0:o.setSinkId)?"Speaker device is not valid or exists.":"SetSinkId is not supported."}))}))}handleDesktopCapture(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;console.log("handleDesktopCapture, audioOnly: ".concat(t)),this.shareStreamScheduler.bindRawStream(e),this.shareStreamScheduler.switchToRawShareStream(),Tr.hasProcessor()&&(Tr.removeStream(),t||Tr.setStream(this.shareStreamScheduler.getRawStream())),this.sharingCodecInfo={width:0,height:0};const r=this.shareStreamScheduler.getCurrentStream();let s=r.getAudioTracks()[0];if(s?(lo.addAudioTrackSettingsMonitor(s,"DesktopAudioCapture"),t||"Tab audio"===s.label||s.label.includes("HDMI")||(d.A.shareSystemAudio=!0),Ce.A.updateShareAudioDevices(s.id,s.label),d.A.Notify_APPUI(n.npe,t),s.onended=function(){D.A.add_monitor("ATRS:"+s.readyState+":"+s.id+":-S")},s.onmute=function(){D.A.add_monitor("ATMS:"+s.muted+":"+s.id+":-S")},s.onunmute=function(){D.A.add_monitor("ATMS:"+s.muted+":"+s.id+":-S")}):d.A.Notify_APPUI(n.pvo,null),D.A.add_monitor("STYPE-".concat((0,a.B0)(null===(i=r.getVideoTracks()[0])||void 0===i?void 0:i.label))),!this.localShareCanvasWaiting)if(this.shareTrack=r.getVideoTracks()[0],this.shareTrack){D.A.add_monitor("OSTS"),this.shareTrack.onended=this.onShareStreamEnded.bind(this),this.Start_Desktop_Sharing();const{width:e,height:t,displaySurface:i}=this.shareTrack.getSettings();d.A.Notify_APPUI(n.p8Y,{width:e,height:t,displaySurface:i})}else c.Ay.error("shareTrack is null when share screen")}handleCaptureError(e){this.isDestroy||(this.handleGetDisplayMediaError("An error occurred when trying to capture sharing",e),this.StopSharingCapture(),D.A.add_monitor("SCCF"),"Permission denied by system"===e.message?d.A.Notify_APPUI(n.bjn,null):d.A.Notify_APPUI(n.BSK,null))}handleAudioCapture(){var e;if(this.isDestroy)return;let{deviceId:t,elapsed_time:i,deviceLabel:r}=lo.getAudioCapabilities();if(t&&i&&r&&Ce.A.updateSelectedMicDevices(t,r,i,!0),this.updateFileAudioPlaybackStream(lo.audioStream),this.useWebRTCAudio&&!this.audioInputLevel){const i=Zi.hasProcessor()?Zi.getStream():lo.audioStream;return null===(e=this.webrtcAudio)||void 0===e||e.setStreamAsync(i).then((e=>{d.A.ComputerAudioStatus===E.BX.ComputerAudio_Connecting&&(d.A.ComputerAudioStatus=E.BX.ComputerAudio_Connected,d.A.Notify_APPUI(n.Ubu,{microphoneDeviceId:lo.getAudioDeviceId()}))})),c.Ay.log("user grante audio capture"),void d.A.Notify_APPUI(n.h73,t)}if(!this.audioCtx&&!this.audioInputLevel)return c.Ay.log("no audio context when join computer audio"),d.A.ComputerAudioStatus=E.BX.ComputerAudio_Null,d.A.Notify_APPUI(n.Ubu,null),d.A.Notify_APPUI(n.pHx,null),void lo.destoryAudioMediaStream();c.Ay.log("user grante audio capture"),d.A.Notify_APPUI(n.h73,t),this.Start_Audio_Capture()}handleWasmVideoCapture(e,t){let i=this;return new Promise(((r,s)=>ao(this,void 0,void 0,(function*(){var o,a;if(!e)return s(new Error("no stream"));if(null!==(o=i.videoCaptureWidth)&&void 0!==o||(i.videoCaptureWidth=640),null!==(a=i.videoCaptureHeight)&&void 0!==a||(i.videoCaptureHeight=360),t.encode&&i.isStartVideoCapture){try{let e=yield i.Start_Video_Capture();r(e)}catch(e){c.Ay.error("media stream is ok, but start video capture fail",e),s(new Error("media stream is ok, but start video capture fail"))}i.isMaskSettingOn&&i.MaskSettingVideo&&lo.playVideoStream(i.MaskSettingVideo)}else if(t.preview&&(i.isMaskSettingOn||i.isVBSettingOn))try{let t=yield i.startMaskOrVBSettingVideoCapture(e);r(t)}catch(e){ho("startMaskOrVBSettingVideoCapture",e),s(new Error("media stream is ok, but start setting video capture fail"))}else i.isStartVideoCapture||lo.destoryVideoMediaStream()}))))}handleWebrtcVideoCapture(e){let t=this;return new Promise(((i,r)=>ao(this,void 0,void 0,(function*(){if(!e)return r(new Error("no stream"));if(t.isStartVideoCapture)this.startVideoCaptureSuccess(),i(!0);else if(t.isMaskSettingOn||t.isVBSettingOn)try{let r=yield t.startMaskOrVBSettingVideoCapture(e);i(r)}catch(e){ho("startMaskOrVBSettingVideoCapture",e),r(new Error("media stream is ok, but start setting video capture fail"))}else lo.destoryVideoMediaStream()}))))}startMaskOrVBSettingVideoCapture(e){return new Promise(((e,t)=>{try{if(this.isVBSettingOn)if(this.MaskSettingVideo){const e=lo.playVideoStream(this.MaskSettingVideo);e&&e.then((function(){d.A.Notify_APPUI(n.AjI,null)})).catch((function(e){t(new Error("media stream is ok, but video.play() fail")),c.Ay.error("An error occurred when trying to play video in Background Setting tab",e),D.A.add_monitor("VBVPF")}))}else d.A.Notify_APPUI(n.AjI,null);else if(this.isMaskSettingOn)if(this.MaskSettingVideo){const e=lo.playVideoStream(this.MaskSettingVideo);e&&e.then((function(){d.A.Notify_APPUI(n.i8,null)})).catch((function(e){t(new Error("media stream is ok, but video.play() fail")),c.Ay.error("An error occurred when trying to play video in Background Setting tab",e),D.A.add_monitor("MVPF")}))}else d.A.Notify_APPUI(n.i8,null);this.webrtcConfig.webrtcflag||(this.addChannelForVideo(),l.Notify_Video_Encode_Thread({command:"startvideointerval",width:this.videoCaptureValue.width,height:this.videoCaptureValue.height,ssid:this.videoCaptureValue.ssid,mtu_size:this.mtu_size,fps:this.GetVideoCaptureFps(),isSupportMediaStreamTrackProcessor:this.isSupportMediaStreamTrackProcessor,isSupport2DCanvasDrawFrame:this.isSupport2DCanvasDrawFrame,isVBSettingOn:this.isVBSettingOn,isMaskSettingOn:this.isMaskSettingOn,isSupportVideoFrame:this.isVideoTagFrameAccessible})),e(!0)}catch(e){c.Ay.error("Starting mask or virtual background failed",e),t(e)}}))}handleGetDisplayMediaError(e,t){const{name:i}=t,r={AbortError:"error",InvalidStateError:"error",NotAllowedError:"warn",NotFoundError:"warn",NotReadableError:"warn",OverconstrainedError:"warn",TypeError:"error"}[i]||"error";c.Ay[r](e,t)}handleGetUserMediaError(e,t){const{name:i}=t;c.Ay.error(e,t)}analyserCaptureReason(e){let t=go(e);"NotAllowedError"===(null==e?void 0:e.name)&&"hidden"===document.visibilityState&&(document.removeEventListener("visibilitychange",uo),document.addEventListener("visibilitychange",uo)),D.A.add_monitor("HADF: "+(null==e?void 0:e.name)+"-"+(null==t?void 0:t.errorCode)),d.A.Notify_APPUI(n.qUx,t)}handleAudioError(e){this.resumeAudioContextandPlayAudioTag(),this.handleGetUserMediaError("Error occurred when trying to capture audio",e),this.analyserCaptureReason(e),d.A.ComputerAudioStatus===E.BX.ComputerAudio_Connecting&&(d.A.ComputerAudioStatus=E.BX.ComputerAudio_Null,d.A.Notify_APPUI(n.Ubu,null),d.A.Notify_APPUI(n.pHx,null))}handleVideoError(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!l.AssertMediaSdkNotDestory(this,"videocaptureerror"))return void c.Ay.error("VideoCaptureException VideoError, JsMediaSDK instance destroyed",e);if(t)return D.A.add_monitor("GUMF"),void this.handleGetUserMediaError("Error occurred when trying to capture video with normal constraints",e);this.isMaskSettingStarted=!1,this.isCurrentInMaskStatus=!1,this.isCurrentInNoVBPreviewStatus=!1,ho("handleVideoError",e);let i=(null==e?void 0:e.name)||"other error",r="Error ".concat((null==e?void 0:e.message)||"");D.A.add_monitor("STARTVIDEOERR:".concat(i,"-").concat(r)),e instanceof h.iG||e.name&&-1!==["NotReadableError","SourceUnavailableError"].indexOf(e.name)?(D.A.add_monitor("COCPEF"),d.A.Notify_APPUI(n.EWx,e)):(D.A.add_monitor("HVDF"),d.A.Notify_APPUI(n.nEg,e)),this.handleGetUserMediaError("Error occurred when trying to capture video",e),this.Stop_Video_Capture()}chromeAecWorkAround(e){return ao(this,void 0,void 0,(function*(){if(D.A.add_monitor("ASCAEC"),this.rtcConnectionA||this.rtcConnectionB)return!1;let t,i,r=null,s=null,o=new MediaStream;r=x.A.createPeerConnection(null),s=x.A.createPeerConnection(null),r.onicecandidate=e=>e.candidate&&s.addIceCandidate(new RTCIceCandidate(e.candidate)),s.onicecandidate=e=>e.candidate&&r.addIceCandidate(new RTCIceCandidate(e.candidate)),s.ontrack=e=>{e.streams[0].getTracks().forEach((e=>{o.addTrack(e)}))},r.addStream(e),t=yield r.createOffer({offerVideo:!0,offerAudio:!0,offerToReceiveAudio:!1,offerToReceiveVideo:!1});let n=!1,d=null,c=null,l=a.Ay.getBrowserVersion();try{c=t.sdp,Number(l)>=104?(d=t.sdp.replace("SAVPF 111","SAVPF 100 111"),d=d.replace("a=rtpmap:111 opus/48000/2","a=rtpmap:100 L16/48000\na=rtpmap:111 opus/48000/2")):(d=t.sdp.replace("SAVPF 111","SAVPF 10 111"),d=d.replace("a=rtpmap:111 opus/48000/2","a=rtpmap:10 L16/48000\na=rtpmap:111 opus/48000/2")),t.sdp=d,yield r.setLocalDescription(t),yield s.setRemoteDescription(t)}catch(e){n=!0,t.sdp=c,yield r.setLocalDescription(t),yield s.setRemoteDescription(t)}return i=yield s.createAnswer(),n||(Number(l)>=104?(i.sdp=i.sdp.replace("SAVPF 111","SAVPF 100 111"),i.sdp=i.sdp.replace("a=rtpmap:111 opus/48000/2","a=rtpmap:100 L16/48000\na=rtpmap:111 opus/48000/2")):(i.sdp=i.sdp.replace("SAVPF 111","SAVPF 10 111"),i.sdp=i.sdp.replace("a=rtpmap:111 opus/48000/2","a=rtpmap:10 L16/48000\na=rtpmap:111 opus/48000/2"))),yield s.setLocalDescription(i),yield r.setRemoteDescription(i),this.rtcConnectionA=r,this.rtcConnectionB=s,o}))}switchCanvasForVideoCapture(e){var t=[].concat(e),i=t[0];if(this.captureVideoOutputCanvasDomList=t,this.videoCaptureValue.canvasCtrl=i,!this.isSupportVideoFrameOrBitmapCapture){var r=this.videoCaptureValue.videoCtrl.videoWidth,s=this.videoCaptureValue.videoCtrl.videoHeight;t.forEach((function(e){e.width=r,e.height=s})),this.videoCaptureValue.canvasCtrl.width=r,this.videoCaptureValue.canvasCtrl.height=s,this.videoCaptureContext=i.getContext("2d")}}switchVideoTagForVideoCapture(e){var t;if(!this.videoCaptureValue)return;if(e===this.videoCaptureValue.videoCtrl)return;(null===(t=this.videoloadmetadataListener)||void 0===t?void 0:t.remove)&&(this.videoloadmetadataListener.remove(),this.videoloadmetadataListener=null);const i=this.videoCaptureValue.videoCtrl;i&&!this.selfPreviewVideotagList.includes(i)&&lo.removeVideoStream(i),this.videoCaptureValue.videoCtrl=e,this.captureVideoOutPutVideoDom=e,this.isVideoCaptureLoadedmetadata||(c.Ay.warn("isVideoCaptureLoadedmetadata is false ,need to reloaded"),this._addVideoLoadedmetadataListener(e)),lo.playVideoStream(e)}CheckCurrentActiveSSRC(e){this.currentactive!=e&&(this.currentactive=e,d.A.CurrentSSRC=this.currentactive,d.A.decoderinworklet?d.A.AudioNode&&d.A.AudioNode.postCMD("currentSSRC",d.A.CurrentSSRC):l.Notify_Audio_Thread_CurrentSSRC(d.A.CurrentSSRC))}createVideoElement(){this.MaskSettingVideo||(this.videoCaptureValue&&this.videoCaptureValue.videoCtrl?this.MaskSettingVideo=this.videoCaptureValue.videoCtrl:(this.MaskSettingVideo=function(){let e=document.createElement("video");return e.setAttribute("muted",""),e.setAttribute("playsinline",""),e}(),a.Ay.browser.isSafari&&(this.MaskSettingVideo.setAttribute("style","position:fixed;top:-10000px;left:-10000px;"),document.body.appendChild(this.MaskSettingVideo))))}changeVideoRenderActiveSsrc(e){if(!this.webrtcConfig.webrtcflag)if(this.RenderInMain==P.u){var t=d.A.SPECIAL_ID;if(d.A.localVideoDecMGR){var i=d.A.localVideoDecMGR.map.get(t);if(i){var r={command:"CHANGE_CURRENT_ACTIVE_SSRC",ssrc:e};i.postMessage(r)}}}else this.RenderInMain==P.tD&&this.VideoRenderObj.Change_Current_SSRC(e)}addChannelForVideo(){var e,t;if(this.vcFlag)return;this.waitingVcChannelReady=!0;let i=d.A.SPECIAL_ID;if((null===(e=d.A.localVideoDecMGR)||void 0===e?void 0:e.map.get(i))&&(null===(t=d.A.localVideoEncMGR)||void 0===t?void 0:t.map.get(i))){this.waitingVcChannelReady=!1,this.vcFlag=!0;var r=new MessageChannel;l.Notify_Video_Thread_Msg_Channel(r,r)}}checkIsRenderInWorker(){return this.isMultiView||this.isSupportVideoFrameOrBitmapCapture||d.A.enableVirtualBackgroundWithoutSAB||(0,a.uF)()&&"undefined"!=typeof SharedArrayBuffer&&a.Ay.isSafariVersionHigherThan("17.5")||ue.X.isUseSsrcStream()}setMultiView(e,t){const i=e>1,r=(0,a.uF)(),s=!!a.Ay.isWebGL2Supported(this.isWebGL2FeatureEnabled),o="function"==typeof OffscreenCanvas;this.isMultiView=i&&(r||s||ue.X.isUseSsrcStream()),c.Ay.directReport("JsMediaSDK-SetMultiView() isMultiView:".concat(this.isMultiView||t,",\n docodeThreadNumber:").concat(e,",\n isWebGLSupported:").concat(r,",\n isWebGL2Supported:").concat(s,",\n supportVideoTagRenderer:").concat(Pe.f.supportVideoTagRenderer(),",\n isOffscreenCanvasSupported:").concat(o,",\n enableMultiDecodeVideoWithoutSAB:").concat(t))}start_capture_video_wasm(e){if(l.Update_Video_Encrpt(d.A.e2eencrypt),this.addChannelForVideo(),this.videoCaptureHiddenCanvas||this.isSupportVideoFrameOrBitmapCapture||(this.videoCaptureHiddenCanvas=a.Ay.isSupport2dOffscreenCanvas()?new OffscreenCanvas(640,360):document.createElement("canvas"),this.videoCaptureHiddenCanvasCtx=this.videoCaptureHiddenCanvas.getContext("2d")),!l.isVideoEncodeHandleReady())return ho.warn("not isVideoEncodeHandleReady so return"),void D.A.add_monitor("not isVideoEncodeHandleReady so return");if(D.A.add_monitor("STARTVIDEO:".concat(this.isStartVideoCapture)),this.isStartVideoCapture)c.Ay.warn("video capture is already started, do not call again.");else{if(this.VALUE_CACHE_FOR_START_CAPTURE_VIDEO=Object.assign({},e),this.isStartVideoCapture=!0,this.isSupportMediaStreamTrackProcessor){let t;t=e.canvas instanceof Array?e.canvas[0]:e.canvas,a.Ay.isSelfPreviewRenderWithVideo()&&this.isSupportVideoFrameOrBitmapCapture?(e.video?e.videoCtrl=(0,a.e5)(e.video).dom:this.selfPreviewVideotagList.length&&(e.videoCtrl=this.selfPreviewVideotagList[this.selfPreviewVideotagList.length-1]),this.isSelfViewWithVideo=!0):(this.MaskSettingVideo||this.createVideoElement(),e.videoCtrl=this.MaskSettingVideo)}else e.canvasCtrlList=[],e.canvasCtrl=this.videoCaptureHiddenCanvas,a.Ay.isSelfPreviewRenderWithVideo()&&(e.video||this.selfPreviewVideotagList.length)?(e.video?e.videoCtrl=(0,a.e5)(e.video).dom:this.selfPreviewVideotagList.length&&(e.videoCtrl=this.selfPreviewVideotagList[this.selfPreviewVideotagList.length-1]),this.isSelfViewWithVideo=!0):(a.Ay.browser.isSafari,this.MaskSettingVideo||this.createVideoElement(),e.videoCtrl=this.MaskSettingVideo);this.ReadyCapureWidth=e.width?e.width:640,this.ReadyCapureHeight=e.width?e.height:360,this.captureVideoOutPutVideoDom=e.videoCtrl,this.videoCaptureValue=e,this.videoCaptureValue.ssid&&(d.A.localSsrc=this.videoCaptureValue.ssid),this.Start_Video_Capture()}}start_capture_video_webrtc(e){D.A.add_monitor("STARTVIDEO:".concat(this.isStartVideoCapture)),this.isStartVideoCapture?c.Ay.warn("video capture is already started, do not call again."):(this.VALUE_CACHE_FOR_START_CAPTURE_VIDEO=Object.assign({},e),this.isStartVideoCapture=!0,e.videoCtrl=e.video?(0,a.e5)(e.video).dom:null,this.captureVideoOutPutVideoDom=e.videoCtrl,this.videoCaptureValue=e,this.videoCaptureValue.ssid&&(d.A.localSsrc=this.videoCaptureValue.ssid),this.wmscManager&&this.wmscManager.sendMessageToWMSC({type:"UPDATE_WMSC_PARAMS",data:{maxEncodingFramerate:this.videoCaptureValue.fps}}),this.Start_Video_Capture())}add_render_video_wasm(e){return ao(this,void 0,void 0,(function*(){var t,i,r,s,o,n,h=0;if(Object.assign(e,this.videoWaterMarkParams),void 0===e.isMyself&&(e.isMyself=this.userId&&this.userId>>10==e.userId>>10),a.Ay.isSelfPreviewRenderWithVideo()&&this.videoCaptureValue&&(0,a.XF)(parseInt(e.userId))==(0,a.XF)(this.videoCaptureValue.ssid)&&e.videodom)return lo.playVideoStream(e.videodom),this.selfPreviewVideotagList.includes(e.videodom)||this.selfPreviewVideotagList.push(e.videodom),null===(t=this.selfPreviewVideotagList)||void 0===t||t.forEach((e=>{this.mirrorVideoElement(e,this.isMirrorMyVideo)})),void(this.isSupportMediaStreamTrackProcessor&&!this.isSupportVideoFrameOrBitmapCapture||(this.videoCaptureValue.videoCtrl=e.videodom,this.isSelfViewWithVideo=!0));if(e.ssrc=e.userId,e.canvas=(0,a.e5)(e.canvas).dom,!e.canvas)return void c.Ay.error("ADDRENDERERR :".concat(e.userId,", canvas:").concat(e.canvas));const u=d.A.browserFeature;if(u){if(Gi.X.addRenderCanvas(e.canvas.id,e.canvas),e.x=Math.floor(e.x),e.y=Math.floor(e.y),e.width=Math.floor(e.width),e.height=Math.floor(e.height),this.isCreateVideoWaterMark=e.enableWaterMark,this.videoWaterMarkName=this.isCreateVideoWaterMark?e.waterMarkText:"",this.isMultiView||e.isMyself||this.CheckCurrentActiveSSRC(e.ssrc),this.isLSSPlayer&&this.VideoRenderObj&&this.VideoRenderObj.Remove_Pause(e),this.checkIsRenderInWorker()&&(u.isSupportOffScreenCanvasWebgl()||ue.X.isUseSsrcStream())){const t=a.I4.getIsRenderSelfVideoInEncodeWorker(d.A.localSsrc&&(0,a.XF)(e.ssrc)===(0,a.XF)(d.A.localSsrc)),r=t?d.A.localVideoEncMGR:d.A.localVideoDecMGR,s=d.A.SPECIAL_ID,o=null===(i=e.canvas)||void 0===i?void 0:i.id;this.replaceCanvasMap.videoDecodeCanvasIds||(this.replaceCanvasMap.videoDecodeCanvasIds=[]),this.replaceCanvasMap.videoEncodeCanvasIds||(this.replaceCanvasMap.videoEncodeCanvasIds=[]),t?-1===this.replaceCanvasMap.videoEncodeCanvasIds.indexOf(o)&&this.replaceCanvasMap.videoEncodeCanvasIds.push(o):-1===this.replaceCanvasMap.videoDecodeCanvasIds.indexOf(o)&&this.replaceCanvasMap.videoDecodeCanvasIds.push(o);try{if(r){const t=r.map.get(s);if(t){const i=e.canvas.transferControlToOffscreen();(0,a.uR)(this.getWebRTCFlag());const r={command:"renderOfflineCanvas",ssrc:e.ssrc,rendercanvasID:o,canvas:i,isCreateVideoWaterMark:this.isCreateVideoWaterMark,videoWaterMarkName:this.videoWaterMarkName,waterMarkText:e.waterMarkText,watermarkOpacity:e.watermarkOpacity,watermarkRepeated:e.watermarkRepeated,watermarkPosition:e.watermarkPosition,x:e.x,y:e.y,width:Math.round(e.width),height:Math.round(e.height),zone:e.zone,fillMode:e.fillMode,fillModeForResolution:e.fillModeForResolution,borderRadius:e.borderRadius};t.postMessage(r,[i])}}}catch(t){if(r){const t=r.map.get(s);if(t){const i={command:"renderOfflineCanvas",rendercanvasID:o,ssrc:e.ssrc,videoWaterMarkName:this.videoWaterMarkName,isCreateVideoWaterMark:this.isCreateVideoWaterMark,waterMarkText:e.waterMarkText,watermarkOpacity:e.watermarkOpacity,watermarkRepeated:e.watermarkRepeated,watermarkPosition:e.watermarkPosition,x:e.x,y:e.y,width:Math.round(e.width),height:Math.round(e.height),zone:e.zone,fillMode:e.fillMode,fillModeForResolution:e.fillModeForResolution,borderRadius:e.borderRadius};t.postMessage(i)}}}this.RenderInMain===P.p$&&(this.RenderInMain=P.u),this.currentactive&&this.changeVideoRenderActiveSsrc(this.currentactive)}else{e.isMyself||l.Notify_Video_Decode_Thread({command:"RenderInMain"});const t=null===(r=e.canvas)||void 0===r?void 0:r.id;if(this.videoRenderArray.length)for(h=0;h<this.videoRenderArray.length;h++)if(this.videoRenderArray[h].ssrc==e.ssrc&&this.videoRenderArray[h].zone==e.zone)return;if(e.rendercanvasID=t,e.borderRadius){const t=X(e.borderRadius,e.width,e.height);e.borderRadius=t,null===(s=e.display)||void 0===s||s.setRoundedCornerRadius(t)}this.videoRenderArray.push(e),this.VideoRenderObj||(this.VideoRenderObj=new re(Object.assign({},Object.assign(Object.assign({Notify_APPUI:d.A.Notify_APPUI.bind(d.A),isSupportOffscreenCanvas:!1,jsMediaEngine:l},d.A.enableMultiDecodeVideoWithoutSAB?{videodecodethreadnumb:P.yC}:{videodecodethreadnumb:(0,a.OC)()}),{globalTracingLogger:c.Ay,monitorLoggerFn:D.A.add_monitor,renderManager:this.renderManager,isLSSPlayer:this.isLSSPlayer}))),(null===(o=null==this?void 0:this.videoCaptureValue)||void 0===o?void 0:o.ssid)&&(null===(n=this.VideoRenderObj)||void 0===n||n.Set_LocalVideo_SSRC(this.videoCaptureValue.ssid),sr.setLocalVideoSsrc(this.videoCaptureValue.ssid))),this.activeSpeakerSsrc&&(this.VideoRenderObj.setActiveSpeakerSsrc(this.activeSpeakerSsrc),sr.setActiveSpeakerSsrc(this.activeSpeakerSsrc)),e.canvasList&&e.canvasList.forEach((t=>{this.videoRenderArray.push(Object.assign({},e,{canvas:t}))})),ho("Start_Video_Play"),this.Start_Video_Play();const i=d.A.enableMultiDecodeVideoWithoutSAB||a.Ay.isSupportMultiViewAPI();this.VideoRenderObj.Set_Render_Array(this.videoRenderArray,i),this.isCreateVideoWaterMark&&!this.waterMarkCanvas&&(this.waterMarkCanvas=document.createElement("canvas")),this.VideoRenderObj.Set_WaterMark_Info({waterMarkCanvas:this.waterMarkCanvas,isCreateVideoWaterMark:this.isCreateVideoWaterMark,videoWaterMarkName:this.videoWaterMarkName,watermarkOpacity:e.watermarkOpacity,watermarkRepeated:e.watermarkRepeated,watermarkPosition:e.watermarkPosition}),this.RenderInMain===P.p$&&(this.RenderInMain=P.tD),this.currentactive&&this.changeVideoRenderActiveSsrc(this.currentactive)}yield l.UpdateVideoPlayStatus(!0)}else c.Ay.error("video decode init not completed")}))}add_render_video_webrtc(e){return ao(this,void 0,void 0,(function*(){this.wmscManager&&this.wmscManager.sendMessageToWMSC({type:"NOTIFY_WMSC_VIDEO_TAG_MAPPING",data:Object.assign(Object.assign({},e),{action:"add"})})}))}stop_render_video_wasm(e){return ao(this,void 0,void 0,(function*(){var t;if(a.Ay.isSelfPreviewRenderWithVideo()&&e.videodom){const t=this.selfPreviewVideotagList.indexOf(e.videodom);t>=0&&(this.selfPreviewVideotagList.splice(t,1),this.videoCaptureValue&&this.videoCaptureValue.videoCtrl===e.videodom&&this.selfPreviewVideotagList.length?this.switchVideoTagForVideoCapture(this.selfPreviewVideotagList[this.selfPreviewVideotagList.length-1]):this.isStartVideoCapture||lo.removeVideoStream(e.videodom))}"string"!=typeof e.canvas&&(e.canvas=null===(t=e.canvas)||void 0===t?void 0:t.id),this.videoWaterMarkName="",this.isCreateVideoWaterMark=!1,e.ssrc=e.userId;const i=d.A.browserFeature;if(i){if(this.checkIsRenderInWorker()&&i.isSupportOffScreenCanvasWebgl()&&(a.I4.getIsRenderSelfVideoInEncodeWorker(d.A.localSsrc&&(0,a.XF)(e.ssrc)===(0,a.XF)(d.A.localSsrc))?l.Notify_Video_Encode_Thread:l.Notify_Video_Decode_Thread)({command:"stopVideoRender",ssrc:e.ssrc,canvas:e.canvas,RGBA:e.RGBA,doNotClean:e.doNotClean,x:e.x,y:e.y,zone:e.zone}),this.videoRenderArray.length)for(let t=0;t<this.videoRenderArray.length;t++)if(this.videoRenderArray[t].ssrc==e.ssrc&&this.videoRenderArray[t].zone==e.zone)if(this.isLSSPlayer)if(e.doNotClean)this.VideoRenderObj.Add_Pause(e),this.VideoRenderObj.Draw_Last_Frame();else{let i=this.videoRenderArray.splice(t,1);this.VideoRenderObj.clearUseridRender(i,e.RGBA),this.VideoRenderObj.Set_Render_Array(this.videoRenderArray,d.A.enableMultiDecodeVideoWithoutSAB),d.A.enableMultiDecodeVideoWithoutSAB&&this.VideoRenderObj.GiveBack_Display(i)}else{let i=this.videoRenderArray.splice(t,1);this.StopUserVideoRender(this.VideoRenderObj,i,e.RGBA,!e.doNotClean)}d.A.lastStatsLogs.videoRecvStats.delete((0,a.XF)(e.ssrc))}else c.Ay.error("video decode init not completed")}))}stop_render_video_webrtc(e){this.wmscManager&&this.wmscManager.sendMessageToWMSC({type:"NOTIFY_WMSC_VIDEO_TAG_MAPPING",data:Object.assign(Object.assign({},e),{action:"remove"})})}getAudioNode(){return this.isLSSPlayer&&this.gainNode?d.A.AudioNode.connect(this.gainNode):d.A.AudioNode}Notify_MeidaSDK(e,t){return ao(this,void 0,void 0,(function*(){var i,r,s,u,f,m,v,g,_,S,y,C,b,w,R,I,k,O,V,N,x,L,W,U,B,F,H,G,j,K,z,q,Y,Q,J,$,Z,ee,te,ie,se,oe,ae,ne,de,ce,le,pe,fe,ve,_e,Se,Ae,ye,Ee,be,we,Re,Te,Ie,Me,De,Pe,ke,Oe,Ve,Ne,xe,Le,We,Ue,Be;ho(e,t);var Fe=0;switch(D.A.add_monitor2("B"+e),e){case n.RJ8:{t.id&&this.vbSettingDomMap[t.id]&&Object.assign(t,this.vbSettingDomMap[t.id]);let e=this;var He,Ge;if(e.isVBSettingOn=!0,e.isCurrentInMaskStatus=!1,He=null!==(i=t.width)&&void 0!==i?i:640,Ge=null!==(r=t.height)&&void 0!==r?r:360,null!==(s=e.videoCaptureWidth)&&void 0!==s||(e.videoCaptureWidth=He),null!==(u=e.videoCaptureHeight)&&void 0!==u||(e.videoCaptureHeight=Ge),this.webrtcConfig.webrtcflag?t.videodom&&this.wmscManager&&(this.wmscManager.vbSettingVideoDom=t.videodom):l.Notify_Video_Encode_Thread({command:"StartVBSetting"}),D.A.add_monitor(t.bgdom?"VBON":"VBOFF"),t.bgdom)if(this.VBMFlag||(this.VBMFlag=!0,D.A.send_monitor_directly(P.QU)),"blur"==t.bgdom)this.webrtcConfig.webrtcflag?lo.changeVBImage("blur"):l.Notify_Video_Encode_Thread({command:"vbbgimagebitmap",data:t.bgdom});else{let i=(0,a.e5)(t.bgdom).dom;if(!i||!i.naturalWidth||!i.naturalHeight)return D.A.add_monitor("VBGF"),void d.A.Notify_APPUI(n.KqK,2);e.BgImage=i,createImageBitmap(i).then((e=>{this.webrtcConfig.webrtcflag?lo.changeVBImage(e):l.transportVBBgImageBitMap(e,"BgImage")})).catch((e=>{D.A.add_monitor("VBCF"),d.A.Notify_APPUI(n.KqK,2)}))}else this.webrtcConfig.webrtcflag?lo.isVBEnabled&&lo.disableVB():l.transportVBBgImageBitMap(null,"BgImage");if(t.canvas){const{id:i,dom:r}=(0,a.e5)(t.canvas);if(this.webrtcConfig.webrtcflag)this.wmscManager&&(this.wmscManager.vbSettingVideoDom=r);else if(!a.Ay.isSupportOffscreenCanvas()||a.Ay.browser.isSafari&&!a.Ay.isIphoneOrIpadBrowser()&&!a.Ay.isSafariVersionHigherThan("17.4"))e.isCurrentInNoVBPreviewStatus=!0,e.videoNoVBPreviewCanvas=r;else{if(e.VideoVBSettingCanvas=r,!e.VideoVBSettingCanvas||e.VideoVBSettingCanvas.width<=0||e.VideoVBSettingCanvas.height<=0)return D.A.add_monitor("VBCAF"),void d.A.Notify_APPUI(n.KqK,3);try{var je=e.VideoVBSettingCanvas.transferControlToOffscreen();l.transportSettingCanvas(je,"VBOfflineCanvas",i)}catch(e){l.transportSettingCanvas(null,"VBOfflineCanvas",i)}}}if(e.isSupportVideoFrameOrBitmapCapture||(e.createVideoElement(),e.videoCaptureHiddenCanvas||(e.videoCaptureHiddenCanvas=a.Ay.isSupport2dOffscreenCanvas()?new OffscreenCanvas(640,360):document.createElement("canvas"),e.videoCaptureHiddenCanvasCtx=e.videoCaptureHiddenCanvas.getContext("2d"))),lo.shouldCaptureVideo()){if(!l.isVideoEncodeHandleReady()&&!this.webrtcConfig.webrtcflag)return ho.warn("not isVideoEncodeHandleReady so return"),void D.A.add_monitor("not isVideoEncodeHandleReady so return");(null==t?void 0:t.fps)||(null===(f=e.videoCaptureValue)||void 0===f?void 0:f.fps)||(t.fps=P.Fw),e.videoCaptureValue?e.videoCaptureValue=Object.assign(e.videoCaptureValue,t):e.videoCaptureValue=t,e.videoCaptureValue.ssid&&(d.A.localSsrc=e.videoCaptureValue.ssid),e.StartVideoMediaCapture()}else e.MaskSettingVideo&&lo.playVideoStream(e.MaskSettingVideo)}break;case n.ziT:if(D.A.add_monitor(t.bgdom?"VBON":"VBOFF"),t.bgdom)if(this.VBMFlag||(this.VBMFlag=!0,D.A.send_monitor_directly(P.QU)),"blur"==t.bgdom)this.webrtcConfig.webrtcflag?lo.changeVBImage("blur"):l.Notify_Video_Encode_Thread({command:"vbbgimagebitmap",data:t.bgdom});else{let e=(0,a.e5)(t.bgdom).dom;if(!e||!e.width||!e.height)return D.A.add_monitor("VBGF"),void d.A.Notify_APPUI(n.KqK,2);this.BgImage=e,createImageBitmap(e).then((e=>{this.webrtcConfig.webrtcflag?lo.changeVBImage(e):l.transportVBBgImageBitMap(e,"BgImage")})).catch((e=>{D.A.add_monitor("VBCF"),d.A.Notify_APPUI(n.KqK,2)}))}else this.BgImage=null,this.webrtcConfig.webrtcflag?lo.isVBEnabled&&lo.disableVB():l.transportVBBgImageBitMap(null,"BgImage");break;case n.hcn:if((!a.Ay.isSupportOffscreenCanvas()||a.Ay.browser.isSafari&&!a.Ay.isSafariVersionHigherThan("17.4"))&&(this.isCurrentInNoVBPreviewStatus=!1,this.videoNoVBPreviewCanvas&&(this.videoNoVBPreviewCanvasctx&&(this.videoNoVBPreviewCanvasctx.setTransform(1,0,0,1,0,0),this.videoNoVBPreviewCanvasctx.clearRect(0,0,this.videoNoVBPreviewCanvas.width,this.videoNoVBPreviewCanvas.height),this.videoNoVBPreviewCanvasctx=null),this.videoNoVBPreviewCanvas=null),this.isVideoNoVBPreviewCanvasScaled=!1),this.isVBSettingOn=!1,t.isSwitch&&(this.isMaskSettingOn=!0,this.webrtcConfig.webrtcflag||l.Notify_Video_Encode_Thread({command:"StartMaskSetting",isSwitch:t.isSwitch,enabled:this.isSupportVideoFrameOrBitmapCapture})),this.webrtcConfig.webrtcflag){if(this.wmscManager){const{isConnected:e}=this.wmscManager.vbSettingVideoDom||{};e&&(this.wmscManager.vbSettingVideoDom.srcObject=null),this.wmscManager.vbSettingVideoDom=null}}else l.Notify_Video_Encode_Thread({command:"finishVBSetting"});this.isStartVideoCapture||this.isMaskSettingOn||this.Stop_Video_Capture(),this.MaskSettingVideo&&this.MaskSettingVideo.pause();break;case n.rpL:{const{id:e,canvas:i,videodom:r}=t;this.vbSettingDomMap[e]={canvas:i,videodom:r}}break;case n.a$m:{const{id:e,canvas:i,videodom:r}=t;delete this.vbSettingDomMap[e]}break;case n._Nl:{if(this.webrtcConfig.webrtcflag)return;if(this.isMaskSettingStarted)return;this.isMaskSettingStarted=!0;let e=this,i=0,r=0;e.isCurrentInMaskStatus=!0,e.isMaskSettingOn=!0,i=t.width?t.width:640,r=t.height?t.height:360,e.ReadyCapureWidth=i,e.ReadyCapureHeight=r,null!==(m=e.videoCaptureWidth)&&void 0!==m||(e.videoCaptureWidth=i),null!==(v=e.videoCaptureHeight)&&void 0!==v||(e.videoCaptureHeight=r);let s=0,o=0;if(t.canvas){const{dom:i,id:r}=(0,a.e5)(t.canvas);if(e.VideoMaskSettingCanvas=i,e.PrevVideoMaskSettingCanvas=e.VideoMaskSettingCanvas,e.replaceCanvasMap.videoMaskSettingCanvasId=r,!e.VideoMaskSettingCanvas||e.VideoMaskSettingCanvas.width<=0||e.VideoMaskSettingCanvas.height<=0)return void d.A.Notify_APPUI(n.qqH,3);s=t.originWidth||e.VideoMaskSettingCanvas.width,o=t.originHeight||e.VideoMaskSettingCanvas.height}if(t.maskdom){let i=(0,a.e5)(t.maskdom).dom;if(!i||!i.width||!i.height)return void d.A.Notify_APPUI(n.qqH,1);let r=1;0==s||0==o||s==e.VideoMaskSettingCanvas.width&&o==e.VideoMaskSettingCanvas.height||(r=Math.min(1*e.VideoMaskSettingCanvas.width/s,1*e.VideoMaskSettingCanvas.height/o)),e.MaskImage=i,e.maskCoordinate.dx=t.dx?Math.round(t.dx*r):e.maskCoordinate.dx,e.maskCoordinate.dy=t.dy?Math.round(t.dy*r):e.maskCoordinate.dy,e.maskCoordinate.dWidth=t.dWidth?Math.round(t.dWidth*r):e.maskCoordinate.dWidth,e.maskCoordinate.dHeight=t.dHeight?Math.round(t.dHeight*r):e.maskCoordinate.dHeight,e.isSupportVideoFrameOrBitmapCapture&&createImageBitmap(i).then((function(t){l.transportMaskImageBitMap(t,"MaskImage",e.maskCoordinate,e.videoCaptureWidth,e.videoCaptureHeight)})).catch((e=>{d.A.Notify_APPUI(n.qqH,1)}))}if(t.bgdom){let i=(0,a.e5)(t.bgdom).dom;if(!i||!i.naturalWidth||!i.naturalHeight)return D.A.add_monitor("VMGF"),void d.A.Notify_APPUI(n.qqH,2);e.BgImage=i,e.isSupportVideoFrameOrBitmapCapture&&createImageBitmap(i).then((function(e){l.transportBgImageBitMap(e,"BgImage")})).catch((e=>{D.A.add_monitor("VMCF"),d.A.Notify_APPUI(n.qqH,2)}))}if(e.isSupportVideoFrameOrBitmapCapture||e.createVideoElement(),this.VideoMaskCanvasFillMode=t.fillMode?1:0,l.Notify_Video_Encode_Thread({command:"StartMaskSetting",fillMode:this.VideoMaskCanvasFillMode,enabled:this.isSupportVideoFrameOrBitmapCapture}),lo.shouldCaptureVideo()){if(e.videoCaptureHiddenCanvas||e.isSupportVideoFrameOrBitmapCapture||(e.videoCaptureHiddenCanvas=a.Ay.isSupport2dOffscreenCanvas()?new OffscreenCanvas(640,360):document.createElement("canvas"),e.videoCaptureHiddenCanvasCtx=e.videoCaptureHiddenCanvas.getContext("2d")),!l.isVideoEncodeHandleReady())return ho.warn("not isVideoEncodeHandleReady so return"),void D.A.add_monitor("not isVideoEncodeHandleReady so return");e.videoCaptureValue?e.videoCaptureValue=Object.assign(e.videoCaptureValue,t):e.videoCaptureValue=t,e.videoCaptureValue.ssid&&(d.A.localSsrc=e.videoCaptureValue.ssid),e.StartVideoMediaCapture()}else e.MaskSettingVideo&&lo.playVideoStream(e.MaskSettingVideo),e.isMaskSettingOn&&d.A.Notify_APPUI(n.i8,null);if(e.isSupportVideoFrameOrBitmapCapture)try{let t=e.VideoMaskSettingCanvas.transferControlToOffscreen();l.transportSettingCanvas(t,"MaskOfflineCanvas",e.replaceCanvasMap.videoMaskSettingCanvasId)}catch(t){l.transportSettingCanvas(null,"MaskOfflineCanvas",e.replaceCanvasMap.videoMaskSettingCanvasId)}else e.Update_Mask_Texture(e.maskCoordinate,e.videoCaptureWidth,e.videoCaptureHeight)}break;case n.O06:{const{id:e,dom:i}=(0,a.e5)(t.canvas);if(this.isSupportVideoFrameOrBitmapCapture||this.VideoVBSettingCanvas){let i=d.A.SPECIAL_ID;if(d.A.localVideoEncMGR){var Ke=d.A.localVideoEncMGR.map.get(i);if(Ke){var ze={command:"update_setting_canvas_size",rendercanvasID:e,width:t.width,height:t.height};Ke.postMessage(ze)}}}else t.canvas=i,t.canvas&&(t.canvas.width=t.width,t.canvas.height=t.height);break}case n.aYB:if(this.webrtcConfig.webrtcflag)return;if(this.isSupportVideoFrameOrBitmapCapture)if(t.bgdom){let e=(0,a.e5)(t.bgdom).dom;if(!e||!e.width||!e.height)return void d.A.Notify_APPUI(n.qqH,2);this.BgImage=e,createImageBitmap(e).then((function(e){l.transportBgImageBitMap(e,"BgImage")})).catch((e=>{d.A.Notify_APPUI(n.qqH,2)}))}else this.BgImage=null,l.transportBgImageBitMap(null,"BgImage");else{if(t.bgdom){let e=(0,a.e5)(t.bgdom).dom;if(!e||!e.width||!e.height)return void d.A.Notify_APPUI(n.qqH,2);this.BgImage=e}else this.BgImage=null;this.Update_Mask_Texture(this.maskCoordinate,this.videoCaptureWidth,this.videoCaptureHeight)}break;case n.GtU:if(this.webrtcConfig.webrtcflag)return;if(this.maskCoordinate.dx=t.dx,this.maskCoordinate.dy=t.dy,this.maskCoordinate.dWidth=t.dWidth,this.maskCoordinate.dHeight=t.dHeight,this.isSupportVideoFrameOrBitmapCapture)if(t.maskdom){let e=(0,a.e5)(t.maskdom).dom;if(!e||!e.width||!e.height)return void d.A.Notify_APPUI(n.qqH,1);this.MaskImage=e;let i=this.maskCoordinate,r=this.videoCaptureWidth,s=this.videoCaptureHeight;createImageBitmap(e).then((function(e){l.transportMaskImageBitMap(e,"MaskImage",i,r,s)})).catch((e=>{d.A.Notify_APPUI(n.qqH,1)}))}else{this.MaskImage=null;let e=this.maskCoordinate,t=this.videoCaptureWidth,i=this.videoCaptureHeight;l.transportMaskImageBitMap(null,"MaskImage",e,t,i)}else{if(t.maskdom){let e=(0,a.e5)(t.maskdom).dom;if(!e||!e.width||!e.height)return void d.A.Notify_APPUI(n.qqH,1);this.MaskImage=e}else this.MaskImage=null;this.Update_Mask_Texture(this.maskCoordinate,this.videoCaptureWidth,this.videoCaptureHeight)}break;case n.g$j:if(this.webrtcConfig.webrtcflag)return;this.isMaskSettingStarted=!1,this.isMaskSettingOn=!1,this.BgImage||(this.isCurrentInMaskStatus=!1),t.isSwitch&&(this.isVBSettingOn=!0,l.Notify_Video_Encode_Thread({command:"StartVBSetting",isSwitch:t.isSwitch})),this.MaskSettingVideo&&this.MaskSettingVideo.pause(),this.VideoMaskSettingCanvas&&(this.VideoMaskSettingCanvasctx&&(this.VideoMaskSettingCanvasctx.setTransform(1,0,0,1,0,0),this.VideoMaskSettingCanvasctx.clearRect(0,0,this.VideoMaskSettingCanvas.width,this.VideoMaskSettingCanvas.height),this.VideoMaskSettingCanvasctx=null),this.VideoMaskSettingCanvas=null),this.isCanvasScaled=!1,l.Notify_Video_Encode_Thread({command:"finishMaskSetting"}),this.isStartVideoCapture||this.isVBSettingOn||this.Stop_Video_Capture();break;case n.XHL:this.isMirrorMyVideo=t.isMirrorMyVideo,this.webrtcConfig.webrtcflag?this.wmscManager&&this.wmscManager.mirrorSelfVideo(this.isMirrorMyVideo):(a.Ay.isSelfPreviewRenderWithVideo()&&(null===(g=this.selfPreviewVideotagList)||void 0===g||g.forEach((e=>{this.mirrorVideoElement(e,this.isMirrorMyVideo)}))),l.Notify_Video_Encode_Thread({command:"mirrorMyVideo",isMirrorMyVideo:this.isMirrorMyVideo}),this.isSupportOffscreenCanvas?(this.VideoRenderObj&&this.VideoRenderObj.setMirrorMyVideoOption(this.isMirrorMyVideo),l.Notify_Video_Decode_Thread({command:"mirrorMyVideo",isMirrorMyVideo:this.isMirrorMyVideo,isSupportOffscreenCanvas:this.isSupportOffscreenCanvas})):(this.VideoRenderObj||(this.VideoRenderObj=new re(Object.assign({},Object.assign(Object.assign({Notify_APPUI:d.A.Notify_APPUI.bind(d.A),isSupportOffscreenCanvas:!1,jsMediaEngine:l,globalTracingLogger:c.Ay,monitorLoggerFn:D.A.add_monitor},d.A.enableMultiDecodeVideoWithoutSAB?{videodecodethreadnumb:P.yC}:{}),{renderManager:this.renderManager,isLSSPlayer:this.isLSSPlayer}))),this.activeSpeakerSsrc&&(this.VideoRenderObj.setActiveSpeakerSsrc(this.activeSpeakerSsrc),sr.setActiveSpeakerSsrc(this.activeSpeakerSsrc))),this.VideoRenderObj.setMirrorMyVideoOption(this.isMirrorMyVideo)));break;case n.wIu:this.activeSpeakerSsrc=t.ssrc,this.webrtcConfig.webrtcflag?null===(_=this.wmscManager)||void 0===_||_.onActiveSpeakerChange(t.ssrc):(D.A.add_monitor("ACTIVESSRC:".concat(t.ssrc)),l.pushMessageToWorker(E._c.VIDEO_DECODE,{ssrc:t.ssrc},Zt.NEW_ACTIVE_SPEAKER_SSRC,!1,!0),l.pushMessageToWorker(E._c.VIDEO_ENCODE,{ssrc:t.ssrc},Zt.NEW_ACTIVE_SPEAKER_SSRC,!1,!0),this.RenderInMain==P.tD&&(null===(S=this.VideoRenderObj)||void 0===S||S.setActiveSpeakerSsrc(t.ssrc)),sr.setActiveSpeakerSsrc(t.ssrc),this.CheckCurrentActiveSSRC(t.ssrc));break;case n.K3m:D.A.add_monitor("CANCELACTIVE:".concat(t.ssrc)),l.Notify_Video_Decode_Thread({command:"cancelNewActiveSpeakerSsrcBefreCallback",ssrc:t.ssrc,haddata:t.haddata}),this.activeSpeakerSsrc=0;break;case n.tm0:D.A.add_monitor(t.message);break;case n.EYN:if(!d.A.rwgAgent)break;this.userId!=t.userId&&d.A.sendMessageToRwg(n.fmn,{evt:12303,seq:1,body:{subInfoList:[{id:Number(t.userId),size:Number(t.videoQuality),bOn:!1}]}});break;case n.BqC:if(D.A.add_monitor("ADDRENDER:".concat(t.userId)),this.webrtcConfig.webrtcflag){const e=parseInt(t.userId),i=null===(y=this.wmscManager)||void 0===y?void 0:y.isSelfVideo(e);if(1===e&&this.wmscManager&&this.wmscManager.setActiveSpeakerVideoDom(t.videodom),this.videoCaptureValue&&i){const e=lo.getProcessedVideoStream();return t.videodom.srcObject=e,this.wmscManager?this.wmscManager.addSelfVideoDom(t.zone,t.videodom):(c.Ay.error("WMSC_Self_Add_Render, ".concat(t.userId)),t.videodom.play().catch((()=>{c.Ay.error("WMSC_SV_ARP_F: ".concat(t.userId))}))),void(this.webrtcConfig.userId=parseInt(t.userId))}yield this.add_render_video_webrtc(t)}else yield this.add_render_video_wasm(t);break;case n.r2c:{const{id:e,dom:i}=(0,a.e5)(t.canvas),r=d.A.browserFeature;if(!r){c.Ay.error("video decode init not completed");break}if((0,a.i1)(t.width,t.height),this.checkIsRenderInWorker()&&r.isSupportOffScreenCanvasWebgl()){let i=d.A.SPECIAL_ID;var qe=null;if(d.A.localVideoEncMGR&&d.A.enableVirtualBackgroundWithoutSAB&&(qe=d.A.localVideoEncMGR.map.get(i)),d.A.localVideoDecMGR){let r=d.A.localVideoDecMGR.map.get(i);if(r){let i={command:"update_canvas_size",rendercanvasID:e,width:t.width,height:t.height};r.postMessage(i),qe&&qe.postMessage(i)}}}else t.canvas=i,t.canvas&&(t.canvas.width=t.width,t.canvas.height=t.height);this.UpdateVideoPlayStatus(!0)}break;case n.PSY:{D.A.add_monitor("ZOOMRENDER:".concat(t.userId)),"string"!=typeof t.canvas&&(t.canvas=t.canvas.id);const e=d.A.browserFeature;if(!e){c.Ay.error("video decode init not completed");break}if(this.checkIsRenderInWorker()&&e.isSupportOffScreenCanvasWebgl()){const e=a.I4.getIsRenderSelfVideoInEncodeWorker(d.A.localSsrc&&(0,a.XF)(t.userId)===(0,a.XF)(d.A.localSsrc));let i=d.A.SPECIAL_ID,r=null;if(e&&d.A.localVideoEncMGR?r=d.A.localVideoEncMGR.map.get(i):d.A.localVideoDecMGR&&(r=d.A.localVideoDecMGR.map.get(i)),r){let e={command:"zoomrender",ssrc:t.userId,x:t.x,y:t.y,width:Math.round(t.width),height:Math.round(t.height),canvas:t.canvas,zone:t.zone,RGBA:t.RGBA,isPaused:t.isPaused,borderRadius:t.borderRadius};r.postMessage(e)}}if(t.isPaused&&this.VideoRenderObj&&(t.ssrc=t.userId,this.VideoRenderObj.Zoom_Render_Paused(t)),this.videoRenderArray.length)for(Fe=0;Fe<this.videoRenderArray.length;Fe++)if(this.videoRenderArray[Fe].ssrc==t.userId&&this.videoRenderArray[Fe].zone==t.zone){if(this.isLSSPlayer){var Ye=[this.videoRenderArray[Fe]];this.VideoRenderObj&&this.VideoRenderObj.clearUseridRender(Ye,t.RGBA,void 0,t.isPaused)}if(this.videoRenderArray[Fe].x=t.x,this.videoRenderArray[Fe].y=t.y,this.videoRenderArray[Fe].width=t.width,this.videoRenderArray[Fe].height=t.height,t.borderRadius){const e=X(t.data,t.width,t.height);this.videoRenderArray[Fe].borderRadius=e,null===(C=this.videoRenderArray[Fe].display)||void 0===C||C.setRoundedCornerRadius(e)}}}break;case n.QoY:if(D.A.add_monitor("RMRENDER:".concat(t.userId)),this.webrtcConfig.webrtcflag){const e=parseInt(t.userId),i=null===(b=this.wmscManager)||void 0===b?void 0:b.isSelfVideo(e);if(1===e&&this.wmscManager&&(this.wmscManager.activeSpeakerVideoDom=null),i)return void(null===(w=this.wmscManager)||void 0===w||w.removeSelfVideoDom(t.zone));this.stop_render_video_webrtc(t)}else yield this.stop_render_video_wasm(t);break;case n.CpQ:{D.A.add_monitor("UPDATE_BORDER_RADIUS:".concat(t.userId));const e=d.A.browserFeature;if(!e){c.Ay.error("video decode init not completed");break}if(this.checkIsRenderInWorker()&&e.isSupportOffScreenCanvasWebgl()){const e=a.I4.getIsRenderSelfVideoInEncodeWorker(d.A.localSsrc&&(0,a.XF)(t.userId)===(0,a.XF)(d.A.localSsrc));let i=d.A.SPECIAL_ID,r=null;if(e&&d.A.localVideoEncMGR?r=d.A.localVideoEncMGR.map.get(i):d.A.localVideoDecMGR&&(r=d.A.localVideoDecMGR.map.get(i)),r){let e={command:"update_border_radius",ssrc:t.userId,zone:t.zone,borderRadius:t.data};r.postMessage(e)}}if(this.videoRenderArray.length)for(Fe=0;Fe<this.videoRenderArray.length;Fe++)if(this.videoRenderArray[Fe].ssrc==t.userId&&this.videoRenderArray[Fe].zone==t.zone){const e=X(t.data,this.videoRenderArray[Fe].width,this.videoRenderArray[Fe].height);this.videoRenderArray[Fe].borderRadius=e,null===(R=this.videoRenderArray[Fe].display)||void 0===R||R.setRoundedCornerRadius(e)}}break;case n.X0s:var Xe=null;if(a.Ay.isSelfPreviewRenderWithVideo()){let e;e=t instanceof Array?t[0]:t,Xe=e instanceof HTMLVideoElement?e:(0,a.e5)(e).dom}if(!this.videoCaptureValue)break;if(a.Ay.isSelfPreviewRenderWithVideo()&&Xe&&Xe instanceof HTMLVideoElement)this.switchVideoTagForVideoCapture(Xe);else{var Qe=[];t instanceof Array?Qe=t:Qe.push(t);var Je=this.videoCaptureValue.canvasCtrlList.filter((function(e){return-1!==Qe.indexOf(e.k)})).map((function(e){return e.dom}));this.switchCanvasForVideoCapture(Je)}break;case n.Ikw:{const{video:e=null,VideoSelectValue:i=""}=t,r=no(t,["video","VideoSelectValue"]);let s=!1;(0,a.uE)(i)&&(s=!0),D.A.add_monitor("SCVP: ".concat((0,a.iD)(JSON.stringify(r)),"|").concat(s?!!s:i,"|").concat(!!e)),(null==t?void 0:t.fps)||(t.fps=P.Fw),this.webrtcConfig.webrtcflag?this.start_capture_video_webrtc(t):this.start_capture_video_wasm(t)}break;case n.CQt:var $e=this;return new Promise(((e,t)=>{try{if(lo.isCaptureVideoInProgress)return d.A.Notify_APPUI(n.gFh,null),t(new Error("Too many calls : the device is opening camera now, cannot stop video capture"));$e.isStartVideoCapture&&$e.Stop_Video_Capture(),d.A.Notify_APPUI(n.Wcg,null),e(!0)}catch(e){d.A.Notify_APPUI(n.gFh,null),t(e)}d.A.extVBPort&&d.A.extVBPort.postMessage({type:n.L_m})}));case n._Gi:0==this.audioRenderArray.length&&(this.audioRenderArray.push(t),this.Start_Audio_Play());break;case n.HKK:if(this.audioRenderArray.length>0)for(this.Stop_Audio_Play(),Fe=0;Fe<this.audioRenderArray.length;Fe++)this.audioRenderArray[Fe].ssrc==t.ssrc&&this.audioRenderArray.splice(Fe,1);break;case n.lyw:yield l.pushMessageToWorker(E._c.AUDIO_DECODE,{bPause:t.bPause},Zt.PAUSE_OR_RESUME_AUDIO_DECODE,!1,!0);break;case n.wk9:this.captureAudioMuted=!1,this.audioInputLevel&&this.audioInputLevel.start(),this.useWebRTCAudio&&(null===(I=this.webrtcAudio)||void 0===I||I.unmute()),this.UnMuteAudio();break;case n.pOT:this.captureAudioMuted=!0,this.audioInputLevel&&this.audioInputLevel.stop(),this.useWebRTCAudio&&(null===(k=this.webrtcAudio)||void 0===k||k.mute()),this.MuteAudio();break;case n.n7n:this.startAnnotation(t,!0),c.Ay.directReport("Start Annotation with session: ".concat(t.presenterId));break;case n.tN9:this.stopAnnotation(t);break;case n.MP_:null===(O=this.annotationMgr)||void 0===O||O.onAnnotationActions(t);break;case n.HVQ:this.shareSessionId=t.shareSessionId,this.userName=t.userName,this.initAnnotatinPresenterSession();break;case n.A3p:{this.loadAnnotationModule(),t.canvas&&!this.sharingCanvasList.includes(t.canvas.id)&&this.sharingCanvasList.push(t.canvas.id),this.mainSharingCanvas=t.canvas,this.annoCanvas=t.annoCanvas,t.canvas&&t.annoCanvas&&(null===(V=this.annotationMgr)||void 0===V||V.updateCanvas({sharingMainCanvas:this.mainSharingCanvas,annoCanvas:this.annoCanvas})),Object.assign(t,this.sharingWaterMarkParams),this.isSupportVideoShare?l.Notify_Sharing_Video_Decode_Thread({command:Zt.START_SHARING_RENDER}):l.Notify_Sharing_Decode_Thread({command:Zt.START_SHARING_RENDER}),this.currentshareactive=t.ssrc,null==this.currentshareactive&&D.A.add_monitor2("SSRC");const{ssrc:e,isFromMainSession:i,zone:r=0}=t;if(this.shareSubController.addRender(e,!!i,r),this.isCreateSharingWaterMark=t.enableWaterMark,this.sharingWaterMarkName=this.isCreateSharingWaterMark?t.waterMarkText:"",t.canvas){Gi.X.addRenderCanvas(t.canvas.id,t.canvas);var Ze=void 0;if(null!=t.x&&null!=t.y&&null!=t.width&&null!=t.height&&((Ze={}).x=Math.floor(t.x),Ze.y=Math.floor(t.y),Ze.width=Math.floor(t.width),Ze.height=Math.floor(t.height)),this.isSupportOffscreenCanvas||ue.X.isUseSsrcStream()){this.RenderInMain===P.p$&&(this.RenderInMain=P.u);let e=d.A.SPECIAL_ID;this.replaceCanvasMap.sharingMainCanvasId=t.canvas.id;let i=null;this.isSupportVideoShare?d.A.localVideoDecMGR&&(i=d.A.localVideoDecMGR.map.get(e)):d.A.localSharingDecMGR&&(i=d.A.localSharingDecMGR.map.get(e));let s={command:Zt.SHARING_RENDER_CANVAS,canvas:null,rendercanvasID:this.replaceCanvasMap.sharingMainCanvasId,ssrc:this.currentshareactive,isCreateSharingWaterMark:this.isCreateSharingWaterMark,sharingWaterMarkName:this.sharingWaterMarkName,watermarkOpacity:t.watermarkOpacity,watermarkRepeated:t.watermarkRepeated,isFromMainSession:t.isFromMainSession,watermarkPosition:t.watermarkPosition,viewPort:Ze,zone:r};try{if(i){const e=t.canvas.transferControlToOffscreen();(0,a.uR)(this.getWebRTCFlag(),!0),(0,a.i1)(t.canvas.width,t.canvas.height),s.canvas=e,i.postMessage(s,[s.canvas])}}catch(e){i&&i.postMessage(s)}}else this.RenderInMain===P.p$&&(this.RenderInMain=P.tD),this.SharingRenderObj||(this.renderManager.setCanvasAlphaChannelEnability(d.A.enableCanvasAlphaChannel),this.SharingRenderObj=new he(Object.assign({},{Notify_APPUI:d.A.Notify_APPUI.bind(d.A),PubSub:p.A,jsMediaEngine:l,globalTracingLogger:c.Ay,renderManager:this.renderManager}))),this.SharingRenderObj.addRender(t.ssrc,t.zone||0,t.isFromMainSession,t.canvas,t.canvas.id,Ze),this.SharingRenderObj.Change_Current_SSRC(this.currentshareactive,t.isFromMainSession),this.isCreateSharingWaterMark&&!this.waterMarkCanvas&&(this.waterMarkCanvas=document.createElement("canvas")),this.SharingRenderObj.Set_WaterMark_Info({waterMarkCanvas:this.waterMarkCanvas,isCreateSharingWaterMark:this.isCreateSharingWaterMark,sharingWaterMarkName:this.sharingWaterMarkName,watermarkOpacity:t.watermarkOpacity,watermarkRepeated:t.watermarkRepeated,watermarkPosition:t.watermarkPosition}),this.sharingInterval||(this.sharingInterval=this.JsMediaSDK_SharingRenderInterval(this.sharingIntervalTime,t.isVideoShare),this.isCreateSharingWaterMark&&!this.waterMarkCanvas&&(this.waterMarkCanvas=document.createElement("canvas")),this.SharingRenderObj.Set_WaterMark_Info({waterMarkCanvas:this.waterMarkCanvas,isCreateSharingWaterMark:this.isCreateSharingWaterMark,sharingWaterMarkName:this.sharingWaterMarkName,watermarkOpacity:t.watermarkOpacity,watermarkRepeated:t.watermarkRepeated,watermarkPosition:t.watermarkPosition}),this.sharingInterval||(this.sharingInterval=this.JsMediaSDK_SharingRenderInterval(this.sharingIntervalTime,t.isVideoShare)),l.UpdateSharingPlayStatus(!0))}}break;case n.m1Q:{const{ssrc:e,zone:i=0,isFromMainSession:r}=t||{};if(d.A.shareFirstFrameMap.delete(e),this.shareSubController.rmRender(e,!!r,i),t.canvas){const e=this.sharingCanvasList.indexOf(t.canvas.id);-1!==e&&this.sharingCanvasList.splice(e,1)}else this.sharingCanvasList=[];const s={command:Zt.STOP_SHARING_RENDER,ssrc:e,zone:i,isFromMainSession:r};if(null==e&&0!=this.sharingCanvasList.length||(this.isSupportVideoShare?l.Notify_Sharing_Video_Decode_Thread(s):l.Notify_Sharing_Decode_Thread(s)),e&&(null===(N=this.SharingRenderObj)||void 0===N||N.removeRender(e,i,r)),0!==this.sharingCanvasList.length)return;null===(x=this.SharingRenderObj)||void 0===x||x.removeAllRender(),this.mainSharingCanvas=null,this.annoCanvas=null,l.UpdateSharingPlayStatus(!1),this.sharingInterval&&(clearInterval(this.sharingInterval),this.sharingInterval=0)}break;case n.iOs:{const e={command:Zt.ZOOM_SHARING_RENDER,width:Math.round(t.width),height:Math.round(t.height),x:t.x,y:t.y,ssrc:t.ssrc,isFromMainSession:t.isFromMainSession,zone:t.zone||0,RGBA:t.RGBA};this.isSupportVideoShare?l.Notify_Sharing_Video_Decode_Thread(e):l.Notify_Sharing_Decode_Thread(e),null===(L=this.SharingRenderObj)||void 0===L||L.updateViewPort(e);break}case n.cJy:{const{width:e,height:i,canvas:r}=t;if(r&&r.id&&!this.sharingCanvasList.includes(r.id)&&this.mainSharingCanvas!==r)return;const s={id:null==r?void 0:r.id,width:e,height:i};if(l.isSharingNotClearChromeVersion())return(0,a.i1)(e,i),ho("isSharingNotClearChromeVersion",l.isSharingNotClearChromeVersion());null===(W=this.annotationMgr)||void 0===W||W.updateAnnoCanvasSize({width:e,height:i}),this.isSupportVideoShare?l.Notify_Sharing_Video_Decode_Thread({command:Zt.SET_OFFSCREENCANVAS_WIDTH_HEIGHT,data:s}):yield l.pushMessageToWorker(E._c.SHARING_DECODE,s,Zt.SET_OFFSCREENCANVAS_WIDTH_HEIGHT,!1,!0);break}case n.exH:case n.uiF:break;case n.g8Z:{if(!t.AudioSelectValue)return void d.A.Notify_APPUI(n.G9o,n.g8Z);let e=Date.now();if(this.useWebRTCAudio)return void(null===(U=this.webrtcAudio)||void 0===U||U.changeSpeaker(t.AudioSelectValue));this.selectComputerAudioSpeaker(t.AudioSelectValue,e)}break;case n.i9k:Ce.A.changeDenoiseSwitch(t.switch);break;case n.Aew:{let e=null===(B=this.audioCapture)||void 0===B?void 0:B.audioProfile;if(!e)break;if(this.audioCapture.audioProfile=t,"backgroundNoiseSuppression"===t.currentSelect){if("backgroundNoiseSuppression"!==e.currentSelect){let e={command:"original_sound_switch",enable:!1,highfidelity:!1,stereo:!1};this.useWebRTCAudio?yield null===(F=this.webrtcAudio)||void 0===F?void 0:F.setAudioProfile(t):l.Notify_Audio_Encode_Thread(e),lo.destoryAudioMediaStream(),this.Start_Audio_Capture()}e.highBitrate!==t.highBitrate&&(this.useWebRTCAudio?yield null===(H=this.webrtcAudio)||void 0===H?void 0:H.setAudioProfile(t):l.Notify_Audio_Encode_Thread({command:"highBitrate",highBitrate:t.highBitrate?1:0}));let i="Zoom"===t.backgroundNoiseSuppression;Ce.A.changeDenoiseSwitch(i)}else{let i={command:"original_sound_switch",enable:!0,highfidelity:t.originalSound.highfidelity,stereo:t.originalSound.stereo};this.useWebRTCAudio?yield null===(G=this.webrtcAudio)||void 0===G?void 0:G.setAudioProfile(t):l.Notify_Audio_Encode_Thread(i),"originalSound"===e.currentSelect&&(null===(j=e.originalSound)||void 0===j?void 0:j.stereo)===t.originalSound.stereo||(lo.destoryAudioMediaStream(),this.Start_Audio_Capture())}}break;case n.XE6:{let e=Object.assign({},this.VALUE_CACHE_FOR_START_CAPTURE_VIDEO,t);if(!this.isSupportMediaStreamTrackProcessor){if(e.canvasCtrlList=[],e.canvas instanceof Array)for(let t=0;t<e.canvas.length;t++)e.canvasCtrlList.push({k:e.canvas[t],dom:(0,a.e5)(e.canvas[t]).dom});else e.canvasCtrlList.push({k:e.canvas,dom:(0,a.e5)(e.canvas).dom});e.canvasCtrl=e.canvasCtrlList[0].dom}e.videoCtrl=this.captureVideoOutPutVideoDom,(null===(K=this.videoloadmetadataListener)||void 0===K?void 0:K.remove)&&(this.videoloadmetadataListener.remove(),this.videoloadmetadataListener=null),this.isVideoCaptureLoadedmetadata=!1,lo.destoryVideoMediaStream(),this.videoCaptureValue=e,lo.removeVideoStream(this.videoCaptureValue.videoCtrl),this.StartVideoMediaCapture()}break;case n.K9M:{t.canvas&&(t.rendercanvasID=t.canvas);let e=Object.assign({},this.desktopSharingValue,t);this.EndSharingMediaStream(),this.desktopSharingValue=e,this.StartDesktopMediaCapture()}break;case n.QQs:this.EndSharingMediaStream(),this.desktopSharingValue=t,this.StartDesktopMediaCapture();break;case n.Qc:this.currentactive!=t.ssrc&&(this.currentactive=t.ssrc,d.A.CurrentSSRC=this.currentactive,this.changeVideoRenderActiveSsrc(this.currentactive)),l.Notify_Audio_Thread_CurrentSSRC(d.A.CurrentSSRC);break;case n.RmE:{this.currentshareactive!=t.ssrc&&(this.currentshareactive=t.ssrc);const e={command:Zt.UPDATE_SHARING_ACTIVE_SSRC,ssrc:t.ssrc,isFromMainSession:t.isFromMainSession};this.isSupportOffscreenCanvas?this.isSupportVideoShare?l.Notify_Sharing_Video_Decode_Thread(e):l.Notify_Sharing_Decode_Thread(e):(this.SharingRenderObj||(this.SharingRenderObj=new he(Object.assign({},{Notify_APPUI:d.A.Notify_APPUI.bind(d.A),PubSub:p.A,jsMediaEngine:l,globalTracingLogger:c.Ay,renderManager:this.renderManager}))),this.SharingRenderObj.Change_Current_SSRC(this.currentshareactive,t.isFromMainSession))}break;case n._Zs:this.Stop_Audio_Play();break;case n.I8$:this.Meeting_Fail_Over(t.audio_websocket_address,t.video_websocket_address);break;case n.hs:ho("jsEvent.END_MEDIA"),p.A.trigger(n.gh2.END_MEDIA),this.removeVbReceiver(),this.destroy().catch((e=>ho.error(e)));break;case n.eEQ:!async function(e,t,i){switch(t){case n.eEQ:{const{result:t,reason:r}=function(e){if(a.Ay.isMobileForceAutoChooseAudioDeviceEnable()){var t;if(e.getMediaStreamController().isAudioCaptureProgressing())return{result:!0,reason:"capture processing"};if(null!=e&&null!==(t=e.webrtcAudio)&&void 0!==t&&t.getHealthCheckFailedAndReset())return{result:!1,reason:"health check failed"};if(Yi.isCaptureHealthy(e.getMediaStreamController()))return{result:!0,reason:"capture healthy"}}return{result:!1}}(e);if(r&&c.Ay.log("[Audio] CHANGE_AUDIO_MIC ignored result=".concat(t,",").concat(r)),t)break;if(!i){d.A.Notify_APPUI(n.G9o,n.eEQ);break}await Xi(e,i);break}}}(this,e,t);break;case n.Mhb:t&&(l.Notify_Audio_Thread_Status(d.A.SPECIAL_ID,n.Eym),lo.destoryAudioMediaStream(),this.Remove_Audio_Capture(),this.audioCapture=t,this.Start_Audio_Capture(),l.Reset_Aec());break;case n.tav:if(lo.destoryAudioMediaStream(),document.removeEventListener("visibilitychange",uo),document.body.removeEventListener("click",this.resumeWASMAudio),this.setFileAudioPlaybackSwitch(!1),l.Notify_Audio_Encode_Thread({command:Zt.START_AUDIO_CAPTURE,value:!1}),this.audioCapture=null,this.captureAudioMuted=!1,this.hidAvalible&&(yield me.destroy(),this.hidAvalible=!1),d.A.ComputerAudioStatus=E.BX.ComputerAudio_Null,this.audioInputLevel)return this.audioInputLevel.destroy(),this.audioInputLevel=null,void d.A.Notify_APPUI(n.DjR,null);if(this.useWebRTCAudio)return this.webrtcAudio&&(this.webrtcAudio.isMutedBySystem=!1,this.webrtcAudio.enableBroadCastToBO(!1),this.webrtcAudio.leaveAudioWithoutDisconnect(P.qR)),void d.A.Notify_APPUI(n.DjR,null);if(d.A.ComputerAudioStatus===E.BX.ComputerAudio_Connecting)return void d.A.Notify_APPUI(n.DjR,null);this.Remove_Audio_Capture(),this.Remove_Audio_Play(),this.CloseBoringPeerConnection(),this.checkWorkletInterval&&(clearInterval(this.checkWorkletInterval),this.checkWorkletInterval=null);try{d.A.AudioNode&&(d.A.AudioNode.disconnect(),d.A.AudioNode.postCMD("stopWorklet",!0),d.A.AudioNode.port=null)}catch(e){ho("AudioNode.port",e)}d.A.AudioNode=null,d.A.workletWasmInitSuccess=!1,this.audioCtx&&(this.audioCtx.onstatechange=null,this.audioCtx.onerror&&(this.audioCtx.onerror=null),this.audioCtx.close(),this.isCaputureNodeConnect=!1),this.audioCtx=null,this.audioPlay=!1,this.audioDomNode=null,d.A.Notify_APPUI(n.DjR,null);break;case n.UGN:if(D.A.add_monitor("JCAA:"+t.checkAutoplay),this.enableHID=t.CaptureAudioInfo.enableHID,this.enableHID&&t.CaptureAudioInfo.microphoneLabel)try{this.hidAvalible=yield me.init(t.CaptureAudioInfo.microphoneLabel,t.CaptureAudioInfo.defaultMuted)}catch(e){c.Ay.log("auto connect hid fail"),d.A.Notify_APPUI(n.dUL,e)}if(d.A.ComputerAudioStatus=E.BX.ComputerAudio_Connecting,this.audioInputLevel&&(this.audioInputLevel.destroy(),this.audioInputLevel=null),t.isPreviewMode)return void(t.CaptureAudio?(this.audioCapture=t.CaptureAudioInfo,this.audioInputLevel=new ge.bQ({analyserCallback:e=>{d.A.Notify_APPUI_SAFE(n._9I,{value:e})}}),lo.shouldCaptureAudio()||d.A.Notify_APPUI(n.h73,null),this.Start_Audio_Capture()):(d.A.ComputerAudioStatus=E.BX.ComputerAudio_Connected,d.A.Notify_APPUI(n.Ubu,null)));if(!this.isSupportVideoShare&&this.isSupportOffscreenCanvas){var et=new MessageChannel;l.Notify_Video_Sharing_Msg_Channel(et,et)}if(this.useWebRTCAudio=!!t.audioBridge,this.useWebRTCAudio){Ce.A.setUserId(t.CaptureAudioInfo.ssrc);const{meetingNumber:e,rwgHost:i,userId:r,cid:s,webrtcMode:o,abToken:l}=this.meetingParams;if(yield this.setupLocalPreview({audioBridge:{abToken:l,rwgHost:i,meetingNumber:e,userId:r,cid:s,webrtcMode:o,isCapturingAudio:t.CaptureAudio,audioMode:P.qR,workerType:null}}),!this.webrtcAudio){this.isDestroy||c.Ay.error("webrtc audio instance is null after initialization");break}if(Ce.A.setWebRTCAudio(this.webrtcAudio),t.CaptureAudio?(this.audioCapture=t.CaptureAudioInfo,(null===(z=t.CaptureAudioInfo)||void 0===z?void 0:z.audioProfile)&&this.webrtcAudio.setAudioProfile(t.CaptureAudioInfo.audioProfile),this.Start_Audio_Capture()):(d.A.ComputerAudioStatus=E.BX.ComputerAudio_Connected,d.A.Notify_APPUI(n.Ubu,null)),a.Ay.isAndroidBrowser()||a.Ay.isQuestBrowser()||!a.Ay.browser.isChromeOrEdge&&!a.Ay.isFirefoxVersionHigherThan(116))Ce.A.updateSelectedSpeakerDevices("default",0,!0);else{let e=(null===(q=t.speakerInfo)||void 0===q?void 0:q.defaultDeviceId)?null===(Y=t.speakerInfo)||void 0===Y?void 0:Y.defaultDeviceId:"";this.selectComputerAudioSpeaker(e,Date.now())}return}try{this.Remove_Audio_Play(),this.Remove_Audio_Capture(),this.CloseBoringPeerConnection(),l.Notify_Audio_Thread_Status(d.A.SPECIAL_ID,n.Eym),this.isLSSPlayer||(this.audioCtx&&(this.audioCtx.close(),this.audioCtx.onerror&&(this.audioCtx.onerror=null),this.audioCtx=null,this.isCaputureNodeConnect=!1),this.audioCtx=(0,a.Bw)()),a.Ay.isChromiumVersionHigherThan(129)&&!this.audioCtx.onerror&&(this.audioCtx.onerror=()=>{D.A.add_monitor("AUDIOCONTEXT:ERROR")}),this.audioCtx.sampleRate!=this.sampleRate&&(this.sampleRate=this.audioCtx.sampleRate,l.Modify_Audio_SampleRate(this.sampleRate));const e=a.Ay.isSupportAudioAEC(),i=this.isChromeWideAECEnabled&&!d.A.shareSystemAudio,r=yield this.isLocalP2PSupportedPromise,s=e&&(i||r);this.bAudioDecodeUsingSAB&&D.A.add_monitor("ASSAB");let h=this,u=null,p=null;if(d.A.decoderinworklet?(yield a.Ay.isSDKSupportSIMD())?(u=this.audioWorkletJsPath.audioWorkletSIMDPath,p=this.audioWorkletJsPath.audioSIMDWasm):(u=this.audioWorkletJsPath.audioWorkletProcessPath,p=this.audioWorkletJsPath.audioWasm):u=this.audioWorkletJsPath.audioWorkletPath,this.isDestroy)return;let f=null;if(p&&(f=yield a.Ay.downloadAndCompileWebAssembly(p,"AudioWorklet",D.A,!a.Ay.browser.isSafari&&d.A.enableStreamingInstantiate)),yield(0,io.X6)(this.audioCtx.audioWorklet,u),d.A.AudioNode=new o.A(h.audioCtx,"zoomAudioWorklet",{processorOptions:{sharedBuffer:a.Ay.browser.isSafari&&d.A.sharedBuffer?d.A.sharedBuffer:null,userAgent:navigator.userAgent,audioDecodeChannelsNum:this.isPlayStereoAudioSupported?2:1,audioEncodeChannelsNum:a.Ay.isBrowserSupportStereo()?2:1,wasmModule:f},numberOfOutputs:1,outputChannelCount:[2]}),d.A.AudioNode.onprocessorerror=e=>{D.A.add_monitor("CWFIP"),c.Ay.error("Exception thrown in AudioWorkletProcessor",e)},a.Ay.browser.isSafari&&!d.A.sharedBuffer&&d.A.AudioNode.postCMD("diableSharedArrayBuffer"),d.A.decoderinworklet||d.A.AudioNode.postCMD("disableDecoderinworklet"),d.A.decoderinworklet&&(this.codecDoAVSync?d.A.AudioNode.postCMD("codecDoAVSync",!0):d.A.CurrentSSRC&&d.A.AudioNode.postCMD("currentSSRC",d.A.CurrentSSRC),d.A.AudioNode.postCMD("initData",{userid:t.CaptureAudioInfo.ssrc,meetingnumb:d.A.localAudioPara.meetingNumber,meetingid:d.A.localAudioPara.meetingId}),d.A.AudioNode.postCMD("audiowasm")),h.checkWorkletInterval&&(clearInterval(h.checkWorkletInterval),h.checkWorkletInterval=null),h.checkWorkletInterval=setInterval((()=>{d.A.AudioNode&&"running"===this.audioCtx.state&&d.A.AudioNode.postCMD("checkProcess",null)}),1e4),!a.Ay.browser.isChromeOrEdge||a.Ay.isAndroidBrowser()||a.Ay.isQuestBrowser())if(d.A.sharedBuffer&&d.A.AudioNode.postCMD("sharedBuffer",a.Ay.browser.isSafari?null:d.A.sharedBuffer),a.Ay.isAndroidBrowser()||a.Ay.isQuestBrowser()){let e=h.audioCtx.createMediaStreamDestination();h.getAudioNode().connect(e);let t=e.stream;s&&this.isSupportBrowserAec&&(t=yield h.chromeAecWorkAround(e.stream)),h.audioDomNode||(h.audioDomNode=new Audio),h.audioDomNode.srcObject=t,h.audioDomNode.play().catch((e=>{c.Ay.error("Audio play failed",e)}))}else if(a.Ay.browser.isFirefox&&a.Ay.isFirefoxVersionHigherThan(116)){let e=h.audioCtx.createMediaStreamDestination();h.getAudioNode().connect(e);let i=e.stream;h.audioDomNode||(h.audioDomNode=new Audio),h.audioDomNode.srcObject=i;let r=null,s=Date.now();r=t.speakerInfo&&t.speakerInfo.defaultDeviceId?t.speakerInfo.defaultDeviceId:"",this.selectComputerAudioSpeaker(r,s),h.audioDomNode.play().catch((e=>{c.Ay.error("Audio play failed",e)}))}else h.getAudioNode().connect(h.audioCtx.destination),Ce.A.updateSelectedSpeakerDevices("default",0,!0);else{let e;if(d.A.sharedBuffer&&d.A.AudioNode.postCMD("sharedBuffer",d.A.sharedBuffer),s&&!i){let t=h.audioCtx.createMediaStreamDestination();h.getAudioNode().connect(t),e=t.stream,e=yield h.chromeAecWorkAround(t.stream)}let r=null;r=t.speakerInfo&&t.speakerInfo.defaultDeviceId?t.speakerInfo.defaultDeviceId:"";let o=Date.now();e?(h.audioDomNode||(h.audioDomNode=new Audio),h.audioDomNode.srcObject=e,h.audioDomNode.play().catch((e=>{c.Ay.error("Audio play failed",e)}))):h.getAudioNode().connect(h.audioCtx.destination),h.selectComputerAudioSpeaker(r,o)}l.Notify_Audio_Decode_Thread({command:"stop_audio_incoming",stopPlayAudio:!1}),l.Notify_Audio_Encode_Thread({command:"startAudioEncode",ssid:t.CaptureAudioInfo.ssrc,audioMode:d.A.audioMode}),l.Update_Audio_Encrpt(d.A.e2eencrypt),d.A.ccSpeakingLang&&l.Notify_Audio_Thread_CC_Set_Lang(d.A.ccSpeakingLang);var tt=new MessageChannel,it=new MessageChannel,rt=new MessageChannel;if(d.A.AudioNode.port.postMessage({status:"encodeAudioPort"},[it.port2]),d.A.AudioNode.port.postMessage({status:"decodeAudioPort"},[tt.port1]),d.A.AudioNode.port.postMessage({status:"sampleRate",data:h.audioCtx.sampleRate}),l.Notify_Audio_Thread_Msg_Channel(tt,it,"decodeAudioPort","encodeAudioPort"),d.A.enableEchoDetection&&!d.A.sharedBuffer&&l.Notify_Audio_Thread_Msg_Channel(rt,rt,"audioWorkerPort","audioWorkerPort"),h.Start_Audio_Play(),this.isSupportOffscreenCanvasForVideoDecode){var st=new MessageChannel;l.Notify_Audio_Video_Thread_Msg_Channel(st),d.A.decoderinworklet?d.A.AudioNode.port.postMessage({status:"decodeVideoPort"},[st.port2]):l.Notify_Audio_Thread_Msg_Channel2(st)}if(t.CaptureAudio){h.audioCapture=t.CaptureAudioInfo;let e=t.CaptureAudioInfo.audioProfile;if(e)if("backgroundNoiseSuppression"===e.currentSelect){let t="Zoom"===e.backgroundNoiseSuppression;Ce.A.changeDenoiseSwitch(t),l.Notify_Audio_Encode_Thread({command:"highBitrate",highBitrate:e.highBitrate?1:0})}else{let t={command:"original_sound_switch",enable:!0,highfidelity:null===(Q=e.originalSound)||void 0===Q?void 0:Q.highfidelity,stereo:null===(J=e.originalSound)||void 0===J?void 0:J.stereo};this.useWebRTCAudio?yield null===($=this.webrtcAudio)||void 0===$?void 0:$.setAudioProfile(e):l.Notify_Audio_Encode_Thread(t)}h.Start_Audio_Capture(),this.firstSetDelay&&(this.firstSetDelay=!1,l.Reset_Aec())}else this.resumeAudioContextandPlayAudioTag(),d.A.ComputerAudioStatus=E.BX.ComputerAudio_Connected,d.A.Notify_APPUI(n.Ubu,null)}catch(e){c.Ay.error("join audio failed",e),d.A.ComputerAudioStatus=E.BX.ComputerAudio_Null,d.A.Notify_APPUI(n.Ubu,null),d.A.Notify_APPUI(n.pHx,null),ho.error(e),this.JsMediaSDK_Log(e)}break;case n.rSS:if(d.A.DesktopAudioStatus!==E.BX.DesktopAudio_Null)return void d.A.Notify_APPUI(n.bW9,null);if(d.A.DesktopAudioStatus=E.BX.DesktopAudio_Connecting,this.useWebRTCAudio=!!t.audioBridge,this.useWebRTCAudio){if(Ce.A.setUserId(t.CaptureAudioInfo.ssrc),this.webrtcAudio){const{meetingNumber:e,rwgHost:i,userId:r,cid:s,webrtcMode:o,abToken:a}=this.meetingParams;this.setupLocalPreview({audioBridge:{abToken:a,rwgHost:i,meetingNumber:e,userId:r,cid:s,webrtcMode:o,isCapturingAudio:t.CaptureAudio,audioMode:P.$t}})}return Ce.A.setWebRTCAudio(this.webrtcAudio),this.Start_Desktop_Audio_Capture(),d.A.DesktopAudioStatus=E.BX.DesktopAudio_Connected,void d.A.Notify_APPUI(n.bW9,null)}if(this.isChromeWideAECEnabled&&d.A.ComputerAudioStatus!=E.BX.ComputerAudio_Null&&!this.audioDomNode&&d.A.shareSystemAudio&&(yield this.isLocalP2PSupportedPromise)){d.A.AudioNode.disconnect();let e=this.audioCtx.createMediaStreamDestination();this.getAudioNode().connect(e);let t=e.stream;t=yield this.chromeAecWorkAround(e.stream),this.audioDomNode||(this.audioDomNode=new Audio),this.audioDomNode.srcObject=t;let i=Ce.A.speakerId,r=Date.now();this.selectComputerAudioSpeaker(i,r),this.audioDomNode.play().catch((e=>{c.Ay.error("Audio play failed",e)}))}try{l.Notify_Audio_Encode_Thread({command:"mute",bOn:n.Eym,sharing:!0}),this.sharingAudioCtx&&(this.sharingAudioCtx.close(),this.isSharingCaptureNodeConnect=!1);let e=a.Ay.getAudioContextConfigure();this.sharingAudioCtx=(0,a.gd)("MainSharing",e);let i=this,r=this.audioWorkletJsPath.sharingAudioWorkletPath;yield(0,io.X6)(this.sharingAudioCtx.audioWorklet,r),d.A.SharingAudioNode=new o.A(i.sharingAudioCtx,"zoomSharingAudioWorklet",{processorOptions:{sharingEncodeChannelsNum:a.Ay.isSupportSharingStereo()?2:1}}),d.A.sharedBuffer&&d.A.SharingAudioNode.postCMD("sharedBuffer",d.A.sharedBuffer);let s=new MessageChannel;d.A.SharingAudioNode.port.postMessage({status:"encodeAudioPort"},[s.port1]),l.Notify_Audio_Thread_Msg_Channel3(s),l.Notify_Audio_Encode_Thread({command:"startAudioEncode",ssid:t.CaptureAudioInfo.ssrc,samplerate:this.sharingAudioCtx.sampleRate,isSharing:!0,audioMode:d.A.audioMode,sharingEncodeChannelsNum:a.Ay.isSupportSharingStereo()?2:1}),l.Update_Audio_Encrpt(d.A.e2eencrypt),i.Start_Desktop_Audio_Capture()}catch(e){ho.error(e),this.JsMediaSDK_Log(e)}d.A.DesktopAudioStatus=E.BX.DesktopAudio_Connected,d.A.Notify_APPUI(n.bW9,null);break;case n.u1v:{if(d.A.DesktopAudioStatus!==E.BX.DesktopAudio_Connected)return void d.A.Notify_APPUI(n.CIY,null);let e=!1;if(t&&t.isPause&&(e=!0),e||this.EndDesktopAudioMediaStream(),this.Remove_Sharing_Audio_Capture(),this.useWebRTCAudio)null===(Z=this.webrtcAudio)||void 0===Z||Z.leaveAudioWithoutDisconnect(P.$t);else{if(this.isChromeWideAECEnabled&&this.audioDomNode){d.A.AudioNode.disconnect(),this.CloseBoringPeerConnection(),this.audioDomNode=null;let e="default"==Ce.A.speakerId?"":Ce.A.speakerId;this.getAudioNode().connect(this.audioCtx.destination);let t=Date.now();this.selectComputerAudioSpeaker(e,t)}try{d.A.SharingAudioNode&&(d.A.SharingAudioNode.postCMD("stopWorklet",!0),d.A.SharingAudioNode.port=null,d.A.SharingAudioNode.disconnect(),d.A.SharingAudioNode=null)}catch(e){ho("SharingAudioNode.port",e)}this.sharingAudioCtx&&(this.sharingAudioCtx.close(),this.isSharingCaptureNodeConnect=!1),this.sharingAudioCtx=null}null===(ee=this.screenShareAudioPreviewElement)||void 0===ee||ee.pause(),d.A.DesktopAudioStatus=E.BX.DesktopAudio_Null,d.A.Notify_APPUI(n.CIY,null)}break;case n.Sed:{ho("sdk start remote control 1");let e=this.sharingWidthAndHeightInfo,i=new T(Object.assign({dom:document},t));return this.remoteControl=i,ho("sharingInfo",e),i.setDstWidthAndHeight(e.logicWidth,e.logicHeight),i.setSrcWidthAndHeight(e.logicWidth,e.logicHeight),i.setSrcScaleWidthAndHeight(t.scaleWidth,t.scaleHeight),i.setSrcOffsetXY(t.srcOffsetX,t.srcOffsetY),i.setRemoteOS(t.os),i.start().then((e=>(d.A.Notify_APPUI(e?n.cBD:n.aKW),e&&(i.onPasteTextLengthOverflow((function(){d.A.Notify_APPUI(n.lA5)})),i.onReturnCopiedText((e=>{ho(e),d.A.Notify_APPUI(n.CY1,e)}))),e))).catch((e=>(ho(e),d.A.Notify_APPUI(n.aKW),c.Ay.error("An error occurred when trying to start remote control",e),D.A.add_monitor("RMCTF"),Promise.reject(e))))}case n.YD4:return this.remoteControl.destroy().then((e=>(d.A.Notify_APPUI(e?n.AL$:n.M9W),e)));case n.j4N:this.remoteControl&&(t.scaleWidth&&t.scaleHeight&&this.remoteControl.setSrcScaleWidthAndHeight(t.scaleWidth,t.scaleHeight),(A()(t.srcOffsetX)||A()(t.srcOffsetY))&&this.remoteControl.setSrcOffsetXYAndSendPDU(t.srcOffsetX,t.srcOffsetY),M()(t.isControllerNow)&&this.remoteControl.setIsControlerNow(t.isControllerNow),A()(t.os)&&this.remoteControl.setRemoteOS(t.os));break;case n.rcl:this.remoteControl&&this.remoteControl.sendPostionPDU();break;case n.gle:if(this.annoPresenterCanvas=t.annoPresenterCanvas,this.localShareCanvasExt=t.localShareCanvas,this.localShareCanvasWaiting){if(this.isSupportSharingTrackReader||this.isSupportMediaStreamTrackProcessor?(this.sharePreviewVideo&&(this.desktopSharingValue.canvas=this.sharePreviewVideo),this.sharePreviewVideo&&(this.desktopSharingValue.video=this.sharePreviewVideo)):(this.sharePreviewCanvas&&(this.desktopSharingValue.canvas=this.sharePreviewCanvas),this.sharePreviewVideo&&(this.desktopSharingValue.video=this.sharePreviewVideo)),this.shareTrack=this.shareStreamScheduler.getRawStream().getVideoTracks()[0],this.shareTrack){this.shareTrack.onended=this.onShareStreamEnded.bind(this),this.Start_Desktop_Sharing();const{width:e,height:t,displaySurface:i}=this.shareTrack.getSettings();d.A.Notify_APPUI(n.p8Y,{width:e,height:t,displaySurface:i})}else c.Ay.error("shareTrack is null when share screen");this.localShareCanvasWaiting=!1}this.shareAnnotationInited?this.localAnnoStarted&&(this.annoPresenterCanvas.width=this.localShareCanvas.width,this.annoPresenterCanvas.height=this.localShareCanvas.height,this.switchAnnoCanvasZIndex(this.annoCanvas,this.annoPresenterCanvas),null===(te=this.annotationMgr)||void 0===te||te.updateCanvas({sharingMainCanvas:this.localShareCanvasExt,annoCanvas:this.annoPresenterCanvas}),this.annoPresenterCanvas.style.visibility="hidden"):this.initShareAnnotation()&&this.startAnnotation({presenterId:this.shareSessionId,shareSessionId:this.shareSessionId});break;case n.kQe:this.sharePreviewVideo=null,this.sharePreviewCanvas=null;break;case n.bSz:if(this.loadAnnotationModule(),this.isSupportSharingTrackReader||this.isSupportMediaStreamTrackProcessor?(this.sharePreviewVideo&&(t.canvas=this.sharePreviewVideo),this.sharePreviewVideo&&(t.video=this.sharePreviewVideo)):(this.sharePreviewCanvas&&(t.canvas=this.sharePreviewCanvas),this.sharePreviewVideo&&(t.video=this.sharePreviewVideo)),this.localShareCanvasWaiting=!!t.hasPreview,this.flipSend=!0,this.isStartDesktopSharing)return;{l.Update_Sharing_Encrpt(d.A.e2eencrypt),this.isStartDesktopSharing=!0,this.desktopSharingSend=!0;const{dom:e,id:i}=(0,a.e5)(t.canvas);t.canvas&&(t.rendercanvasID=i),this.isSupportMediaStreamTrackProcessor?t.video=e:(t.video=(0,a.e5)(t.video).dom,t.canvas=e),this.desktopSharingValue=t,this.Start_Desktop_Sharing()}break;case n.X10:if(this.localShareCanvasWaiting=!1,this.flipSend=!0,d.A.shareSystemAudio=!1,!this.isStartDesktopSharing)return;this.desktopSharingSend=!1,this.StopSharingCapture(),this.stopAnnotation({presenterId:this.shareSessionId}),this.isSupportVideoShare?l.Update_Sharing_Video_Encode_Status({command:"stopsharing"}):l.Update_Sharing_Encode_Status({command:"stopsharing"});break;case n.XbU:if(this.flipSend=!0,!this.isStartDesktopSharing)return;this.desktopSharingSend=!1,this.isSupportVideoShare?l.Update_Sharing_Video_Encode_Status({command:"pause"}):l.Update_Sharing_Encode_Status({command:"pause"});break;case n.s8N:if(this.flipSend=!0,!this.isStartDesktopSharing)return;this.desktopSharingSend=!0,this.isSupportMediaStreamTrackProcessor||this.Process_Sharing(),this.isSupportVideoShare?l.Update_Sharing_Video_Encode_Status({command:"resume"}):l.Update_Sharing_Encode_Status({command:"resume"});break;case n.iDK:if(!window.WebQrscanner)return void console.error("qrScanner not loaded");D.A.add_monitor("QRSCAN:".concat(t.enable)),t.enable&&this.shareStreamScheduler.getRawStream()?window.WebQrscanner.qrScanner.start(this.desktopSharingValue.video,(e=>{d.A.Notify_APPUI_SAFE(n.GT7,e)}),(()=>{D.A.add_monitor("QRSCANTIMEOUT")})):window.WebQrscanner.qrScanner.stop();break;case n.m7W:{this.isStartWhiteboardSharing=!0;const{dom:e,id:i}=(0,a.e5)(t.canvas);if(t.canvas&&(t.rendercanvasID=i),this.isStartDesktopSharing)return;l.Update_Sharing_Encrpt(d.A.e2eencrypt),t.video=t.canvas=e,this.isStartDesktopSharing=!0,this.desktopSharingSend=!0,this.desktopSharingValue=t,this.Start_Whiteboard_Sharing()}break;case n.M5B:if(this.isStartWhiteboardSharing=!1,!this.isStartDesktopSharing)return;this.desktopSharingSend=!1,this.isStartDesktopSharing=!1,l.Update_Sharing_Encode_Status({command:"stopsharing"});break;case n.bKC:var ot=document.createElement("img");ot.src="chrome-extension://kgjfgplpablkjnlkjmjdecgdpfankdle/images/trash.png",ot.onload=function(){d.A.Notify_APPUI(n.px,!0)},ot.onerror=function(){d.A.Notify_APPUI(n.px,!1)};break;case n.uxR:if(t.evt===n.kqY||t.evt===n.FQb){if(ho("rwg answer from ui",t),!t.answer)return;switch(t.answer.type){case E.wd.ZOOM_CONNECTION_VIDEO:p.A.trigger(n.gh2.ZOOM_CONNECTION_VIDEO_OFFER_RESPONSE_EVT,t);break;case E.wd.ZOOM_CONNECTION_AUDIO:p.A.trigger(n.gh2.ZOOM_CONNECTION_AUDIO_OFFER_RESPONSE_EVT,t)}}else t.evt===n.r4R&&t.body&&t.body.token&&p.A.trigger(n.gh2.AUDIO_BRIDGE_WS_TOKEN,t.body.token);break;case n.X1W:l.updateCook(t.cook);break;case n.YTV:if(this.isLSSPlayer){l.setUserNodeListToWorker(t);break}l.setUserNodeListToWorker(t.userList),!this.setvideokk&&t.encryptKey&&(this.setvideokk=!0,l.pushMessageToWorker(E._c.VIDEO_DECODE,{KK:t.encryptKey},Zt.MAIN_KK,!1,!0),l.pushMessageToWorker(E._c.VIDEO_ENCODE,{KK:t.encryptKey},Zt.MAIN_KK,!1,!0));break;case n.ovL:D.A.add_monitor("AUIOD_INTERPRETATION_MUTE: ".concat(t.mute)),this.webrtcAudio?null===(se=(ie=this.webrtcAudio).interpretation_set_mute)||void 0===se||se.call(ie,t.mute):l.Notify_Audio_Thread_Interpretation_Mute(t.mute);break;case n.KYx:D.A.add_monitor("AUDIO_INTERPRETATION_SELECT_LANGUAGE: ".concat(t.lang)),this.webrtcAudio?null===(ae=(oe=this.webrtcAudio).interpretation_set_lang)||void 0===ae||ae.call(oe,t.lang):l.Notify_Audio_Thread_Interpretation_Set_Lang(t.lang);break;case n.wYI:D.A.add_monitor("AUDIO_INTERPRETATION_LIST_INFO: ".concat(JSON.stringify(t.interpreterList))),this.webrtcAudio?null===(de=(ne=this.webrtcAudio).interpretation_set_list)||void 0===de||de.call(ne,t.interpreterList):l.Notify_Audio_Thread_Interpretation_Set_Interpreter(t.interpreterList);break;case n.qnv:D.A.add_monitor("AUDIO_INTERPRETATION_ENABLE: ".concat(t.enable)),this.webrtcAudio?null===(le=(ce=this.webrtcAudio).interpretation_set_enable)||void 0===le||le.call(ce,t.enable):l.Notify_Audio_Thread_Interpretation_Enable(t.enable);break;case n.VxP:this.webrtcConfig.webrtcflag?this.wmscManager.sendMessageToWMSC({type:"UPDATE_WMSC_PARAMS",data:{preferSoftwareCodec:{recv:!t.enable}}}):(t.enable&&this.isEnableVideoDecodeHardWareThread&&(null!==this.videodecodehardwareflag||(this.videodecodehardwareflag=yield a.Ay.IsSupportVideoDecodeHardwareAcceleration(d.A.enableHADecOpt)),t.enable=this.videodecodehardwareflag),l.Notify_Video_Decode_Thread({command:"hwstatus",enable:t.enable}));break;case n.DCT:if(this.webrtcConfig.webrtcflag)this.wmscManager.sendMessageToWMSC({type:"UPDATE_WMSC_PARAMS",data:{preferSoftwareCodec:{send:!t.enable}}});else{if(d.A.disableHWCodec&P.mV)break;t.enable&&this.videoencodehardwareflag&&(a.Ay.isChromiumVersionHigherThan(111)||this.doesSafariSupportWebcodec())?t.enable=!0:t.enable=!1,l.Notify_Video_Encode_Thread({command:"hwstatus",enable:t.enable})}break;case"update_videohd_value":this.isVideoHD=!!(null==t?void 0:t.videohd),this.webrtcConfig.webrtcflag?this.wmscManager&&this.wmscManager.sendMessageToWMSC({type:"UPDATE_WMSC_PARAMS",data:{hdVideoEnabled:this.isVideoHD}}):(D.A.add_monitor("NoVideoHD:".concat(!this.isVideoHD)),!t.videohd&&this.videoencodehardwareflag&&(a.Ay.set720pcapacity(!1),D.A.add_monitor("CAPTURE720:"+!1),l.Notify_Video_Encode_Thread({command:"videohd",videohd:t.videohd})));break;case"update_videofullhd_value":D.A.add_monitor("UVFHD"+t.videofullhd),a.Ay.set1080pcapacity(t.videofullhd),l.Notify_Video_Encode_Thread({command:"videofullhd",videofullhd:t.videofullhd});break;case n.fAR:D.A.add_monitor("SET_DESKTOP_VOLUME: ".concat(t.userid,"-").concat(t.shareVolume,"-").concat(t.isFromMainSession,"-").concat(t.isSecondAudio)),this.useWebRTCAudio?null===(pe=this.webrtcAudio)||void 0===pe||pe.setShareVolumeLevel(t.userid,t.shareVolume,t.isFromMainSession):l.Notify_Audio_Decode_Thread({command:"setShareVolumeLevel",userid:t.userid,shareVolume:t.shareVolume,isFromMainSession:t.isFromMainSession,isSecondAudio:!!t.isSecondAudio});break;case n.P79:t.mediaActionType==n.EcQ.SHARING_DECODE&&(this.isSupportVideoShare?l.pushMessageToWorker(E._c.VIDEO_DECODE,t,Zt.USER_NODE_LIST_IN_MAIN_SESSION,!1,!0):l.pushMessageToWorker(E._c.SHARING_DECODE,t,Zt.USER_NODE_LIST_IN_MAIN_SESSION,!1,!0)),t.mediaActionType==n.EcQ.SHARING_ENCODE&&(this.isSupportVideoShare?l.pushMessageToWorker(E._c.VIDEO_ENCODE,t,Zt.USER_NODE_LIST_IN_MAIN_SESSION,!1,!0):l.pushMessageToWorker(E._c.SHARING_ENCODE,t,Zt.USER_NODE_LIST_IN_MAIN_SESSION,!1,!0)),t.mediaActionType==n.EcQ.AUDIO_DECODE&&l.pushMessageToWorker(E._c.AUDIO_DECODE,t,Zt.USER_NODE_LIST_IN_MAIN_SESSION,!1,!0);break;case n.AmQ:t.mediaActionType==n.EcQ.SHARING_DECODE&&(this.isSupportVideoShare?l.pushMessageToWorker(E._c.VIDEO_DECODE,t,Zt.UPDATE_MEDIA_PARAMS,!1,!0):l.pushMessageToWorker(E._c.SHARING_DECODE,t,Zt.UPDATE_MEDIA_PARAMS,!1,!0)),t.mediaActionType==n.EcQ.SHARING_ENCODE&&(this.isSupportVideoShare?l.pushMessageToWorker(E._c.VIDEO_ENCODE,t,Zt.UPDATE_MEDIA_PARAMS,!1,!0):l.pushMessageToWorker(E._c.SHARING_ENCODE,t,Zt.UPDATE_MEDIA_PARAMS,!1,!0)),t.mediaActionType==n.EcQ.AUDIO_DECODE&&l.pushMessageToWorker(E._c.AUDIO_DECODE,t,Zt.UPDATE_MEDIA_PARAMS,!1,!0);break;case n.yHE:{const{ssrc:e,isFromMainSession:i,videoMode:r}=t;this.shareSubController.addSource(e,!!i,r),this.isSupportVideoShare?l.pushMessageToWorker(E._c.VIDEO_DECODE,t,Zt.SHARING_ADD_REV_CHANNEL_TYPE,!1,!0):l.pushMessageToWorker(E._c.SHARING_DECODE,t,Zt.SHARING_ADD_REV_CHANNEL_TYPE,!1,!0)}break;case n.pn7:{const{ssrc:e,isFromMainSession:i}=t;this.shareSubController.rmSource(e,!!i),this.isSupportVideoShare?l.Notify_Sharing_Video_Decode_Thread({command:"SHARING_REMOVE_REV_CHANNEL_TYPE",data:t}):l.Notify_Sharing_Decode_Thread({command:"SHARING_REMOVE_REV_CHANNEL_TYPE",data:t})}break;case n.i0n:this.isSupportVideoShare?l.Notify_Sharing_Video_Decode_Thread({command:"BUILD_MS_CHANNEL_IN_BO",data:t}):l.Notify_Sharing_Decode_Thread({command:"BUILD_MS_CHANNEL_IN_BO",data:t});break;case n.i9w:{const{type:e}=t;e?e===E.Xt.VIDEO?this.SWITCH_VIDEO_WATER_MARK(t):e===E.Xt.SHARING&&this.SWITCH_SHARING_WATER_MARK(t):(this.SWITCH_VIDEO_WATER_MARK(t),this.SWITCH_SHARING_WATER_MARK(t))}break;case n.aE$:this.useWebRTCAudio?null===(fe=this.webrtcAudio)||void 0===fe||fe.set_CC_lang(t.lang):l.Notify_Audio_Thread_CC_Set_Lang(t.lang);break;case n._7f:l.Notify_Audio_Decode_Thread({command:"BUILD_MA_CHANNEL_IN_BO",data:t});break;case n.qmK:D.A.add_monitor("ESTB:"+t.enable),this.useWebRTCAudio?null===(ve=this.webrtcAudio)||void 0===ve||ve.enableShareToBO(t.enable):l.Notify_Audio_Encode_Thread({command:"ENABLE_SHARE_TO_BO",data:t.enable});break;case n.zby:t.data[0]==P.nV&&l.pushMessageToWorker(E._c.VIDEO_DECODE,t.data.buffer,void 0,!0,!0),t.data[0]==P.FW&&l.pushMessageToWorker(E._c.AUDIO_DECODE,t.data.buffer,void 0,!0,!0);break;case n.rME:this.gainNode.gain.value=Number(t);break;case n.SUv:D.A.add_monitor("EBTB:"+t.enable),this.useWebRTCAudio?null===(_e=this.webrtcAudio)||void 0===_e||_e.enableBroadCastToBO(t.enable):l.Notify_Audio_Encode_Thread({command:"ENABLE_BROADCAST_TO_BO",data:t.enable});break;case n.jCp:{let e=(0,a.e5)(t.canvasId).dom;if(t.canvas&&(e=t.canvas),!e)return;let i=null;const r=this.replaceCanvasMap.videoDecodeCanvasIds&&-1!==this.replaceCanvasMap.videoDecodeCanvasIds.indexOf(t.canvasId),s=this.replaceCanvasMap.videoEncodeCanvasIds&&-1!==this.replaceCanvasMap.videoEncodeCanvasIds.indexOf(t.canvasId);if(t.canvasId===this.replaceCanvasMap.videoMaskSettingCanvasId?i=d.A.localVideoEncMGR:t.canvasId===this.replaceCanvasMap.sharingMainCanvasId?i=this.isSupportVideoShare?d.A.localVideoDecMGR:d.A.localSharingDecMGR:t.canvasId===this.replaceCanvasMap.sharingPreviewCanvasId?i=d.A.localSharingEncMGR:(s||r)&&(i=s?d.A.localVideoEncMGR:d.A.localVideoDecMGR,this.lazyReplaceEncodeCanvasTimer&&(clearTimeout(this.lazyReplaceEncodeCanvasTimer),this.lazyReplaceEncodeCanvasTimer=null),this.lazyReplaceEncodeCanvasTimer=setTimeout((()=>{let e=d.A.localVideoEncMGR;if(e){let t=e.map.get(d.A.SPECIAL_ID);t&&t.postMessage({command:Zt.WEBGL_LOST_REPLACE_CANVAS})}let t=d.A.localSharingEncMGR;if(t){let e=t.map.get(d.A.SPECIAL_ID);e&&e.postMessage({command:Zt.WEBGL_LOST_REPLACE_CANVAS})}if(this.videoCaptureHiddenCanvas){const{width:e,height:t}=this.videoCaptureHiddenCanvas;a.Ay.isSupport2dOffscreenCanvas()?this.videoCaptureHiddenCanvas=new OffscreenCanvas(e,t):(this.videoCaptureHiddenCanvas=document.createElement("canvas"),this.videoCaptureHiddenCanvas.width=e,this.videoCaptureHiddenCanvas.height=t),this.videoCaptureHiddenCanvasCtx=this.videoCaptureHiddenCanvas.getContext("2d")}if(this.bgCanvas){const{width:e,height:t}=this.bgCanvas;this.bgCanvas=document.createElement("canvas"),this.bgCanvas.width=e,this.bgCanvas.height=t,this.bgCanvasctx=this.bgCanvas.getContext("2d"),!this.VideoMaskSettingCanvas&&this.PrevVideoMaskSettingCanvas?(this.VideoMaskSettingCanvas=this.PrevVideoMaskSettingCanvas,this.Update_Mask_Texture(this.maskCoordinate,this.videoCaptureHiddenCanvas.width,this.videoCaptureHiddenCanvas.height),this.VideoMaskSettingCanvas=null):this.Update_Mask_Texture(this.maskCoordinate,this.videoCaptureHiddenCanvas.width,this.videoCaptureHiddenCanvas.height)}}),500)),i)try{var at=e.transferControlToOffscreen(),nt=i.map.get(d.A.SPECIAL_ID);nt&&nt.postMessage({command:Zt.WEBGL_LOST_REPLACE_CANVAS,data:{canvasId:t.canvasId,canvas:at}},[at])}catch(e){}break}case n.PcV:D.A.add_monitor("CHIDE:"+t.enable),this.enableHID=t.enable,t.enable?(this.hidAvalible&&(yield me.destroy(),this.hidAvalible=!1),t.microphoneLabel&&(this.hidAvalible=yield me.init(t.microphoneLabel,t.defaultMuted))):this.hidAvalible&&(yield me.destroy(),this.hidAvalible=!1);break;case n.TB5:this.meetingParams.webrtcMode&P.Q9?null===(Se=this.wmscManager)||void 0===Se||Se.enableVideoObserver(t.enable,!t.fpsdisbale):l.Notify_Video_Decode_Thread({command:"ENABLE_VIDEO_OBSERVER",data:t.enable,enablefps:!t.fpsdisbale});break;case n.PMP:this.isAnnotationPMEnabled&&(2===t.mode?this.drawLocalShareInterval=70:3===t.mode?this.drawLocalShareInterval=40:this.drawLocalShareInterval=200,clearInterval(this.drawLocalShareIntervalId),this.localAnnoStarted&&(this.drawLocalShareIntervalId=setInterval((()=>{this.drawLocalAnnotationContent()}),this.drawLocalShareInterval))),l.Notify_Sharing_Encode_Thread({command:"SWITCH_SHARING_TYPE",data:t.mode}),l.Notify_Video_Encode_Thread({command:"SWITCH_SHARING_TYPE",data:t.mode});break;case n.f8O:D.A.add_monitor("SET_OTHER_AUDIO_VOLUME_LEVEL: ".concat(t.userId,"-").concat(t.volume)),this.useWebRTCAudio&&(null===(Ae=this.webrtcAudio)||void 0===Ae||Ae.setSpeechVolumeLevel(t.userId,t.volume)),d.A.decoderinworklet?d.A.AudioNode&&d.A.AudioNode.postCMD("setSpeechVolumeLevel",{userid:t.userId>>10,volume:t.volume}):l.Notify_Audio_Decode_Thread({command:"setSpeechVolumeLevel",userid:t.userId>>10,volume:t.volume});break;case n.U_k:this.useWebRTCAudio&&(null===(ye=this.webrtcAudio)||void 0===ye||ye.updateUserMuteUnmuteStatus(t));break;case n.ZIm:lo._updateVideoConstraints({advanced:[t]});break;case n.rwH:D.A.sendBaseTime(),this._SaveSystemInfo(),d.A.clearMessageToRwg(),null===D.A||void 0===D.A||D.A.add_monitor("INITSAB:".concat("undefined"!=typeof SharedArrayBuffer));break;case n.QyH:lo.enableReuseStream(t.enable);break;case n.WP5:lo.presetConstraints(t||{});break;case n.fxd:lo.destoryReuseStream({audio:t&&t.audio,video:t&&t.video});break;case n.V36:{let e={command:"WHITEBOARD_JOIN_MESSAGE",data:t.message,nodeId:t.nodeId,encryptKey:t.encryptKey,sn:t.sn,dcsId:t.dcsId,EncodedSn:t.EncodedSn};this.isSupportVideoShare?l.Notify_Sharing_Video_Encode_Thread(e):l.Notify_Sharing_Encode_Thread(e)}break;case n.lOl:D.A.add_monitor("STOP_INCOMING_AUDIO: ".concat(t)),this.useWebRTCAudio?null===(Ee=this.webrtcAudio)||void 0===Ee||Ee.stopIncomingAudio(t):d.A.decoderinworklet?l.Notify_Audio_Decode_Thread({command:"stop_audio_incoming",stopPlayAudio:t}):d.A.AudioNode&&d.A.AudioNode.postCMD("stop_audio_incoming",t);break;case n.TSA:if(this.isLandScape=t.isLandScape,!lo.videoStreamTrack)return;this.isLandScape&&this.captureSize&&this.Change_Video_Capture_Resolution(this.captureSize.width,this.captureSize.height);break;case n.l8t:this.localLog&&this.localLog.saveAllLogFiles();break;case n.sCk:if(lo&&lo.audioStream){let e=lo.audioStream.getAudioTracks()[0];e&&(e.muted||"live"!==e.readyState)&&(0,h.iK)(n.UyE,h.pg.EXCEPTION)}break;case n.ee7:{const e=d.A.localVideoDecMGR,i=d.A.localSharingDecMGR,r=d.A.localVideoEncMGR,s=d.A.SPECIAL_ID;[e,i,r].forEach((e=>{var i;const r=null===(i=null==e?void 0:e.map)||void 0===i?void 0:i.get(s);if(r){const e={command:Zt.REMOVE_EXPIRED_CANVAS,rendercanvasID:t.canvasId};r.postMessage(e)}})),(null===(be=this.SharingRenderObj)||void 0===be?void 0:be.isSharingCanvas(t.canvasId))&&this.SharingRenderObj.replaceCanvas(t.canvasId,null),Gi.X.rmCanvas(t.canvasId)}break;case n.oFc:Ar.A.subscribeVideo(t,this.wmscManager);break;case n.t4x:Ar.A.unSubscribeVideo(t,this.wmscManager);break;case n.kPo:D.A.add_monitor("HOLD:".concat(null==t?void 0:t.hold,":").concat(null==t?void 0:t.userid,":").concat(null==t?void 0:t.reinit)),!t.hold&&this.isSupportVideoShare&&(null===(we=d.A.sharingDecInitInstance)||void 0===we||we.resetHandleDeferred(),null===(Re=d.A.sharingEncInitInstance)||void 0===Re||Re.resetHandleDeferred()),t&&!t.userid&&(t.userid=this.userId),l.setMediaSessionHold(this,t),!t.hold&&t.userid&&(this.userId=t.userid),t.hold&&this.SessionHold(),d.A.videoEncodeSession=null,d.A.videoDecodeSession=null,d.A.sharingDecodeSession=null,d.A.sharingEncodeSession=null,d.A.audioDecodeSession=null,d.A.audioEncodeSession=null;break;case n.TRD:D.A.add_monitor("SET_ALL_SPEECH_VOLUME: ".concat(t)),d.A.decoderinworklet?d.A.workletWasmInitSuccess&&d.A.AudioNode?d.A.AudioNode.postCMD(Zt.SET_ALL_SPEECH_VOLUME,{volume:t}):d.A.workletMessageQueue.enqueue({command:Zt.SET_ALL_SPEECH_VOLUME,volume:t}):l.Notify_Audio_Decode_Thread({command:Zt.SET_ALL_SPEECH_VOLUME,volume:t});break;case n.xlY:D.A.add_monitor("ENABLE_FILE_AUDIO_PLAYBACK_LOCALLY: ".concat(t)),this.setFileAudioPlaybackSwitch(t);break;case n.naM:if((null===(Te=t.body.data)||void 0===Te?void 0:Te.evt)===n.Y9c){_i.q.set(this.mid,{hasSilkAudio:!0});const e=5*Math.random();setTimeout((()=>{c.Ay.directReport("silk meeting ,failover to AB"),d.A.Notify_APPUI(n.oQY,{audio:P.mz})}),e)}else{if((null===(Ie=null==t?void 0:t.body)||void 0===Ie?void 0:Ie.type)===fi.MeshControl)return void this.meshMessage(t.body);if(t.body.type===n.mrR){const{ssrc:e,lang_id:i}=t.body.data;null===(De=null===(Me=this.webrtcAudio)||void 0===Me?void 0:Me.updateUserLang)||void 0===De||De.call(Me,e,i)}else l.TransferCmdMsgToWorker(this,t)}break;case n.cjy:{const e=t||"both";yield this.handlePermissionRequest(e);break}case n.HIV:{const e=yield Ce.A.hasPermission("microphone"),t=yield Ce.A.hasPermission("camera"),i=e||t;Fi.role!=mi.invalid&&Fi.mediaAccessStatus(i);break}case n.eI5:d.A.pslVideoId=t.id,null===(Ne=null===(Ve=null===(Oe=null===(ke=null===(Pe=null===d.A||void 0===d.A?void 0:d.A.localVideoDecMGR)||void 0===Pe?void 0:Pe.map)||void 0===ke?void 0:ke.get)||void 0===Oe?void 0:Oe.call(ke,d.A.SPECIAL_ID))||void 0===Ve?void 0:Ve.postMessage)||void 0===Ne||Ne.call(Ve,{command:Zt.ADD_PSL_VIDEO,data:t.id});break;case n.Vy5:d.A.pslVideoId=0,null===(Be=null===(Ue=null===(We=null===(Le=null===(xe=null===d.A||void 0===d.A?void 0:d.A.localVideoDecMGR)||void 0===xe?void 0:xe.map)||void 0===Le?void 0:Le.get)||void 0===We?void 0:We.call(Le,d.A.SPECIAL_ID))||void 0===Ue?void 0:Ue.postMessage)||void 0===Be||Be.call(Ue,{command:Zt.REMOVE_PSL_VIDEO}),d.A.pslMixShareManager.clearPSLMixShareInfo();break;case n.Ev3:d.A.pslMixShareManager.handleShareStatus(t.shareSsrc,t);break;default:ho("CAN NOT HANDLE THE EVENT!")}}))}mirrorVideoElement(e,t){const i="rotateY(".concat(t?180:0,"deg)");let r=e.style.transform;-1!==r.indexOf("rotateY")?r=r.replace(/rotateY\([0-9]+(deg)?\)/,i):r+=" ".concat(i),e.style.transform=r}deviceChangeHandler(e,t){let{result:i,reason:r}=Yi.isMobileNeedRecaptureAfterDeviceChange(this,e,t);i&&(c.Ay.log("[deviceChangeHandler] isMobileNeedRecaptureAfterDeviceChange: ".concat(i,", ").concat(r)),D.A.add_monitor("MOBILE_AUDIO_RECAPTURE:".concat(i,",").concat(r)),Xi(this,this.audioCapture)),d.A.Notify_APPUI_SAFE(n.baF,t)}requestPermissionCallback(e){d.A.Notify_APPUI_SAFE(n.M5F,e)}setFileAudioPlaybackSwitch(e){e?(this.fileAudioPlaybackTag||(this.fileAudioPlaybackTag=new Audio),this.updateFileAudioPlaybackStream(lo.audioStream)):this.fileAudioPlaybackTag&&(this.fileAudioPlaybackTag.pause(),this.fileAudioPlaybackTag=null)}updateFileAudioPlaybackStream(e){var t;if(lo.isCaptureAudioFromFile){if(e&&this.fileAudioPlaybackTag){this.fileAudioPlaybackTag.srcObject!==e&&(this.fileAudioPlaybackTag.srcObject=e);const t="default"===Ce.A.speakerId||null===Ce.A.speakerId?"":Ce.A.speakerId;this.fileAudioPlaybackTag.setSinkId&&this.fileAudioPlaybackTag.sinkId!==t&&this.fileAudioPlaybackTag.setSinkId(t).catch((e=>{c.Ay.error("fileAudioPlaybackTag setSinkId error when update stream")})),this.fileAudioPlaybackTag.play().catch((e=>{c.Ay.error("self audio playback failed",e)}))}}else null===(t=this.fileAudioPlaybackTag)||void 0===t||t.pause()}SWITCH_VIDEO_WATER_MARK(e){this.videoWaterMarkParams=e;const{enableWaterMark:t,waterMarkText:i="",watermarkOpacity:r,watermarkRepeated:s,watermarkPosition:o}=e;d.A.hasWatermark!==e.enableWaterMark&&(d.A.hasWatermark=e.enableWaterMark,d.A.Notify_APPUI_SAFE(n.E0n));const c={enable:!!t,name:i,opacity:r,repeated:s,position:o};ue.X.setIsVideoHasWaterMark(!!t),ue.X.setVideoWatermarkInfo(c),mr.changeVideoWatermarkInfo(c),this.isCreateVideoWaterMark=!!t,this.videoWaterMarkName=this.isCreateVideoWaterMark?i:"",this.VideoRenderObj?(t?this.isCreateVideoWaterMark&&!this.waterMarkCanvas&&(this.waterMarkCanvas=document.createElement("canvas")):this.VideoRenderObj.Set_WaterMark_Flag(t),this.VideoRenderObj.Set_WaterMark_Info({waterMarkCanvas:this.waterMarkCanvas,isCreateVideoWaterMark:this.isCreateVideoWaterMark,videoWaterMarkName:this.videoWaterMarkName,watermarkOpacity:r,watermarkRepeated:s,watermarkPosition:o})):l.Notify_Video_Decode_Thread({command:"SWITCH_WATER_MARK_FLAG",isCreateVideoWaterMark:this.isCreateVideoWaterMark,videoWaterMarkName:this.videoWaterMarkName,watermarkOpacity:r,watermarkRepeated:s,watermarkPosition:o}),a.Ay.watermark.updateWaterMarkInfo(e)}SWITCH_SHARING_WATER_MARK(e){this.sharingWaterMarkParams=e;const{enableWaterMark:t,waterMarkText:i="",watermarkOpacity:r,watermarkRepeated:s,watermarkPosition:o}=e,a={enable:!!t,name:i,opacity:r,repeated:s,position:o};ue.X.setIsSharingHasWaterMark(!!t),ue.X.setSharingWatermarkInfo(a),mr.changeSharingWatermarkInfo(a),this.isCreateSharingWaterMark=!!t,this.sharingWaterMarkName=this.isCreateSharingWaterMark?i:"",this.SharingRenderObj?(t&&this.isCreateSharingWaterMark&&!this.waterMarkCanvas&&(this.waterMarkCanvas=document.createElement("canvas")),this.SharingRenderObj.Set_WaterMark_Info({waterMarkCanvas:this.waterMarkCanvas,isCreateSharingWaterMark:this.isCreateSharingWaterMark,sharingWaterMarkName:this.sharingWaterMarkName,watermarkOpacity:r,watermarkRepeated:s,watermarkPosition:o})):this.isSupportVideoShare?l.Notify_Sharing_Video_Decode_Thread({command:"SWITCH_SHARING_WATER_MARK_FLAG",isCreateSharingWaterMark:this.isCreateSharingWaterMark,sharingWaterMarkName:this.sharingWaterMarkName,watermarkOpacity:r,watermarkRepeated:s,watermarkPosition:o}):l.Notify_Sharing_Decode_Thread({command:"SWITCH_WATER_MARK_FLAG",isCreateSharingWaterMark:this.isCreateSharingWaterMark,sharingWaterMarkName:this.sharingWaterMarkName,watermarkOpacity:r,watermarkRepeated:s,watermarkPosition:o})}JsMediaSDK_VideoRenderInterval(e){return this.VideoRenderObj.Start_Draw.bind(this.VideoRenderObj)(P.hS,e)}JsMediaSDK_SharingRenderInterval(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];var i=this.SharingRenderObj.No_Bindthis_Interval.bind(this.SharingRenderObj);return setInterval(i,t?20:e)}getShareStreamInfo(){const e=this.shareStreamScheduler.getCurrentStream();if(!e)return null;const t=e.getVideoTracks();if(!t.length)return null;if(t[0].getSettings){let e=t[0].getSettings()||null;return e&&this.sharingCodecInfo.width&&this.sharingCodecInfo.height&&(e.width=this.sharingCodecInfo.width,e.height=this.sharingCodecInfo.height),e}return null}onUnload(e){var t;const i=this.rendererType==B.h3.WEBGPU;c.Ay.log("window.onunload:".concat(this._id,", webGPU:").concat(i)),D.A.add_monitor("window.onunload:".concat(this._id,", webGPU:").concat(i)),i&&this.destroy().catch((e=>{})),null===(t=this.webrtcAudio)||void 0===t||t.destroy(),this.webrtcAudio=null}handleUnloadEvent(){this.unloadHandler=this.onUnload.bind(this),window.addEventListener("unload",this.unloadHandler)}destroy(){return ao(this,void 0,void 0,(function*(){var e;ho("destroy"),window.removeEventListener("unload",this.unloadHandler),this.destoryPromise||(d.A.activeSdkInstances--,d.A.extVBPort&&d.A.extVBPort.postMessage({type:n.L_m}),(0,N.fw)(),(0,a.nT)(),(0,N.Nd)((()=>{})),(0,a.Sq)(),Fi.destroy(),this.netThreadMgr.close(),null===(e=this.meshThread)||void 0===e||e.close(),document.removeEventListener("visibilitychange",uo),Ar.A.reset(),this.isDestroy=!0,this.destoryPromise=new Promise(((e,t)=>ao(this,void 0,void 0,(function*(){var t,i;try{c.Ay.log("DelInstance:".concat(this._id)),d.A._callbackList=[],d.A.localVideoPara.VE=null,d.A.localVideoPara.VD=null,D.A.add_monitor("DelInstance:".concat(this._id)),(0,h._G)(null),this.wmscManager&&(this.wmscManager.destroy(),this.wmscManager=null),null===(t=this.annotationMgr)||void 0===t||t.destroy(),this.annotationMgr=null,this.StopSharingCapture(),clearInterval(this.drawLocalShareIntervalId);let e=this;l.Stop_Monitor(this),l.Stop_Recv_StatsMap_Clear_Handle(),p.A.clearAllSubscriptions(),l.preserveMessageController.clear(),d.A.destroyQueueMessageToRwg(),this.audioInputLevel&&(this.audioInputLevel.destroy(),this.audioInputLevel=null),this.webrtcAudio&&(this.webrtcAudio.destroy(!1),this.webrtcAudio=null,lo.webrtcAudio=null),this.EndMedia(),(0,O.tH)(),this.dataChannelController.unRegister(),this.dataTransportController.unRegister(),this.computePressureManager&&this.computePressureManager.destroy(),null===(i=this.systemReporter)||void 0===i||i.stopMonitor();let r=[d.A.localVideoDecMGR,d.A.localVideoEncMGR,d.A.localSharingDecMGR,d.A.localSharingEncMGR],s=[d.A.localAudioDecMGR,d.A.localAudioEncMGR],o=[d.A.sharingDecInitInstance,d.A.sharingEncInitInstance,d.A.videoDecInitInstance,d.A.videoInitInstance,d.A.audioDecInitInstance,d.A.audioEncodeInitInstance];l.closeAllPromiseObject(o),(0,h.tu)(),l.clearWorkerListener(r,s),d.A._Notify_APPUI=null;try{yield new Promise((function(t,i){let r=setTimeout((()=>t()),1e3);Promise.all(e.allpromises).finally((()=>{clearTimeout(r),t()}))}))}catch(e){console.error(e)}l.CloseMediaNetSessionToRwg(E.wd.ZOOM_CONNECTION_AUDIO,E.oB.NET_WEBTRANSPORT),l.CloseMediaNetSessionToRwg(E.wd.ZOOM_CONNECTION_VIDEO,E.oB.NET_WEBTRANSPORT),yield l.closeAllMedia(this,r,s),this.hidAvalible&&(yield me.destroy()),Ii.resetProcessorManager(),this.processorWorker&&(this.processorWorker.onmessage=null,this.processorWorker.terminate(),this.processorWorker=null),Zi.resetProcessorManager(),Tr.resetProcessorManager(),this.shareProcessorWorker&&(this.shareProcessorWorker.onmessage=null,this.shareProcessorWorker.terminate(),this.shareProcessorWorker=null),yield l.destroyAllWorkers(r,s)}catch(e){c.Ay.error("destroy instance ".concat(this._id," error"),e)}c.Ay.flushCacheLog(),e()}))))),yield this.destoryPromise}))}isWebGPURendererType(){return ao(this,void 0,void 0,(function*(){return(yield a.Ay.evaluateRendererType(this.isWebGPUFeatureEnabled,this.isWebGL2FeatureEnabled,this.isSsrcStreamEnabled,null,this.useVideoPlayer))==B.h3.WEBGPU}))}addVbReceiver(e){l.Notify_Video_Encode_Thread({command:"addExtVbReceiver"}),d.A.extVBPort&&(d.A.extVBPort.onmessage=null),d.A.extVBPort=e,d.A.frameReceived=0,d.A.frameSent=0,e.onmessage=e=>{const{type:t}=e.data;t===n.wb7&&d.A.frameReceived++},D.A.add_monitor("EVBA")}removeVbReceiver(){l.Notify_Video_Encode_Thread({command:"removeExtVbReceiver"}),d.A.extVBPort&&(d.A.extVBPort.postMessage({type:n.lLs}),d.A.extVBPort.onmessage=null,d.A.extVBPort=null),D.A.add_monitor("EVBR")}SessionHold(){if(!this.VideoRenderObj)return;let e=this.VideoRenderObj.clearColor.map((e=>e/255));for(;this.videoRenderArray.length>0;){let t=this.videoRenderArray.shift();this.StopUserVideoRender(this.VideoRenderObj,[t],e,!0)}}StopUserVideoRender(e,t,i,r){if(!e)return;r&&e.clearUseridRender(t,i);const s=d.A.enableMultiDecodeVideoWithoutSAB||a.Ay.isSupportMultiViewAPI();s&&e.GiveBack_Display(t),e.Set_Render_Array(this.videoRenderArray,s),0==this.videoRenderArray.length&&(l.Notify_Video_Decode_Thread({command:"stopVideoRender",MFlag:!0}),this.Stop_Video_Play())}_SaveSystemInfo(){try{D.A.add_monitor("JSBN:".concat(oo.kY,"|").concat(oo.C)),D.A.add_monitor("NewInstance:".concat(this._id,"|").concat(d.A.activeSdkInstances)),c.Ay.directReport("MediaSDK Version:".concat(oo.C)),l.saveBrowserInfo()}catch(e){ho(e)}}_isUsingWebRTCAudio(){return this.wmscManager&&this.wmscManager.getWMSCAudio()}updateWebRTCVideoStream(e){return ao(this,void 0,void 0,(function*(){var t;(null===(t=this.wmscManager)||void 0===t?void 0:t.vbSettingVideoDom)&&(this.wmscManager.vbSettingVideoDom.srcObject=e),this.isStartVideoCapture&&this.wmscManager.streamId!==e.id&&this.handleWebRTCVideoStream("fromVBModule",e)}))}clearCanvas(e){e&&e.getContext("2d").clearRect(0,0,e.width,e.height)}loadAnnotationModule(){this.isAnnotationEnabled&&!this.annotationModule&&(0,a.kA)().then((e=>{let{AnnotationMgr:t}=e;this.annotationModule=t})).catch((e=>{c.Ay.error("Failed to load AnnotationMgr",e)}))}onShareStreamEnded(){D.A.add_monitor("SSBB"),d.A.Notify_APPUI(n.Fxk,null),this.StopSharingCapture()}initShareAnnotation(){if(!this.isAnnotationPMEnabled||this.shareAnnotationInited)return!1;const e=document.createElement("div");return this.localShareCanvas=document.createElement("canvas"),this.localShareCanvas.style.visibility="hidden",e.appendChild(this.localShareCanvas),this.annoPresenterCanvas||(this.annoPresenterCanvas=document.createElement("canvas"),this.annoPresenterCanvas.style.visibility="hidden",e.appendChild(this.annoPresenterCanvas)),this.shareAnnotationInited=!0,!0}switchShareStreamForAnnotation(){return ao(this,void 0,void 0,(function*(){var e,t,i;const r=this.shareStreamScheduler.getRawStream();this.localShareVideoTag=document.createElement("video");const s=r.getVideoTracks()[0];s.onended=this.onShareStreamEnded.bind(this),yield lo.adjustShareResUnder2K(s);const{width:o,height:a}=s.getSettings();this.localShareVideoTag.width=o,this.localShareVideoTag.height=a,this.localShareCanvas.width=o,this.localShareCanvas.height=a,this.annoPresenterCanvas.width=o,this.annoPresenterCanvas.height=a,this.annoPresenterCanvas.style.pointerEvents="auto",this.localShareVideoTag.setAttribute("autoplay","true");const c=new MediaStream,l=this.shareStreamScheduler.getCurrentStream();let h=s;this.shareStreamScheduler.isShareProcessorStream(l)&&(h=l.getVideoTracks()[0]),c.addTrack(h),this.localShareVideoTag.srcObject=c,(null===(e=this.desktopSharingValue)||void 0===e?void 0:e.isCamFeedShare)&&(this.drawLocalShareInterval=40),this.drawLocalShareIntervalId=setInterval((()=>{this.drawLocalAnnotationContent()}),this.drawLocalShareInterval),this.annoPresenterCanvas.style.visibility="hidden",null===(t=this.annotationMgr)||void 0===t||t.updateRemoteSizeInfo({width:o,height:a});const u=this.localShareCanvas.captureStream((null===(i=this.desktopSharingValue)||void 0===i?void 0:i.isCamFeedShare)?15:25);this.shareStreamScheduler.bindAnnotationStream(u),this.shareStreamScheduler.switchToAnnotationStream(),this.localShareCanvasExt instanceof HTMLVideoElement&&(this.localShareCanvasExt.setAttribute("autoplay","true"),this.localShareCanvasExt.srcObject=u,this.localShareCanvasExt.play()),setTimeout((()=>{this.notifyEncodeMainWorkerShareStreamChanged(this.shareStreamScheduler.getCurrentStream()),D.A.add_monitor("SCTP"),this.desktopSharingValue&&this.desktopSharingValue.video&&this.updateShareLivePreview(this.desktopSharingValue.video,this.shareStreamScheduler.getCurrentStream())}),1e3),this.localShareVideoTag.onresize=e=>{var t;const{width:i,height:r}=s.getSettings();this.localShareVideoTag.width=i,this.localShareVideoTag.height=r,this.localShareCanvas.width=i,this.localShareCanvas.height=r,this.annoPresenterCanvas.width=i,this.annoPresenterCanvas.height=r,null===(t=this.annotationMgr)||void 0===t||t.updateRemoteSizeInfo({width:i,height:r}),d.A.Notify_APPUI(n.p8Y,{width:i,height:r})}}))}updateShareStreamForAnnotation(e){return ao(this,void 0,void 0,(function*(){if(!e)return void c.Ay.error("updateShareStreamForAnnotation(): stream is null!");const t=e.getVideoTracks()[0],i=new MediaStream;i.addTrack(t),this.localShareVideoTag.srcObject=i,clearInterval(this.drawLocalShareIntervalId),this.drawLocalShareIntervalId=setInterval((()=>{this.drawLocalAnnotationContent()}),this.drawLocalShareInterval);const r=this.shareStreamScheduler.getAnnotationStream();this.shareStreamScheduler.bindAnnotationStream(r),this.shareStreamScheduler.switchToAnnotationStream(),this.localShareCanvasExt instanceof HTMLVideoElement&&(this.localShareCanvasExt.setAttribute("autoplay","true"),this.localShareCanvasExt.srcObject=r,this.localShareCanvasExt.play()),D.A.add_monitor("SCTP"),this.desktopSharingValue.video&&this.updateShareLivePreview(this.desktopSharingValue.video,this.shareStreamScheduler.getCurrentStream())}))}initAnnotatinPresenterSession(){this.isAnnotationPMEnabled&&this.initShareAnnotation()&&this.startAnnotation({presenterId:this.shareSessionId,shareSessionId:this.shareSessionId})}startAnnotation(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.isAnnotationEnabled)return d.A.Notify_APPUI(n.ZFN,"Annotation feature is not enabled"),void c.Ay.error("Start Annotation but Annotation feature is disabled");const i=Object.prototype.hasOwnProperty.call(e,"isPresenter")?e.isPresenter:e.shareSessionId===e.presenterId;if(i&&!this.isAnnotationPMEnabled)return d.A.Notify_APPUI(n.ZFN,"Annotation feature is not enabled for presenter"),void c.Ay.error("Start Annotation as presenter but Annotation presenter feature is disabled");this.shareSessionId=e.shareSessionId||this.shareSessionId,this.userName=e.userName||this.userName,i&&!this.shareAnnotationInited&&this.initShareAnnotation(),this.mainSharingCanvas=e.canvas||this.mainSharingCanvas,this.annoCanvas=e.annoCanvas||this.annoCanvas,this.annoPresenterCanvas=e.annoPresenterCanvas||this.annoPresenterCanvas,this.localShareCanvasExt=e.localShareCanvas||this.localShareCanvasExt;let r=!0;if(i||this.mainSharingCanvas&&this.annoCanvas||(r=!1),i&&!this.annoPresenterCanvas&&(r=!1),r){if(i&&t&&!this.localAnnoStarted&&(this.switchShareStreamForAnnotation(),this.localAnnoStarted=!0),i?this.switchAnnoCanvasZIndex(this.annoCanvas,this.annoPresenterCanvas):this.switchAnnoCanvasZIndex(this.annoPresenterCanvas,this.annoCanvas),this.annotationMgr&&this.annotationMgr.getAppId()!==e.shareSessionId&&(this.annotationMgr.destroy(),this.annotationMgr=null),!this.annotationMgr){const r={appId:this.shareSessionId,userName:this.userName,presenterId:e.presenterId,isBOSession:e.isBOSession||!1,sharingMainCanvas:i?this.localShareCanvas:this.mainSharingCanvas,annoCanvas:i?this.annoPresenterCanvas:this.annoCanvas,remoteSizeInfo:this.getAnnoRemoteSizeInfo(i)};if(!this.annotationModule)return d.A.Notify_APPUI(n.ZFN,"Failed to load annotation module"),void c.Ay.error("AnnotationMgr module was not loaded");this.annotationMgr=new this.annotationModule(r),t&&D.A.add_monitor("ANNO_INIT")}this.annotationMgr.startAnnotation(e.presenterId),this.annotationMgr.updateCanvas({sharingMainCanvas:i?this.localShareCanvasExt?this.localShareCanvasExt:this.localShareCanvas:this.mainSharingCanvas,annoCanvas:i?this.annoPresenterCanvas:this.annoCanvas}),setTimeout((()=>{this.annotationMgr.updateRemoteSizeInfo(this.getAnnoRemoteSizeInfo(i))}),1e3),t&&d.A.Notify_APPUI(n.bVv)}else i&&t||(d.A.Notify_APPUI(n.ZFN,"Canvas is incorrect"),c.Ay.error("Start Annotation failed due to incorrect canvas"))}stopAnnotation(e){var t;this.isAnnotationEnabled&&(this.shareSessionId===e.presenterId?(this.clearCanvas(this.localShareCanvas),this.clearCanvas(this.annoPresenterCanvas),this.annoPresenterCanvas&&(this.annoPresenterCanvas.style.zIndex="1",this.annoPresenterCanvas.style.pointerEvents="none"),this.localAnnoStarted=!1,this.shareAnnotationInited=!1,this.annoPresenterCanvas=null,this.localShareCanvas=null,this.localShareVideoTag&&(this.localShareVideoTag.srcObject=null)):this.annoCanvas&&(this.annoCanvas.style.zIndex="1",this.annoCanvas.style.pointerEvents="none"),null===(t=this.annotationMgr)||void 0===t||t.stopAnnotation(e),c.Ay.directReport("Stop Annotation for session: ".concat(e.presenterId)))}onAnnotationPdu(e){this.annotationMgr&&this.annotationMgr.onRWGMessage(e)}sendAnnotationPdu(e,t){this.isSupportVideoShare?t?l.Notify_Sharing_Video_Encode_Thread(e):l.Notify_Sharing_Video_Decode_Thread(e):t?l.Notify_Sharing_Encode_Thread(e):l.Notify_Sharing_Decode_Thread(e)}drawLocalAnnotationContent(){var e,t,i;if(!this.localShareCanvas.width||!this.localShareCanvas.height){const e=this.shareStreamScheduler.getAnnotationRawStream().getVideoTracks()[0],{width:t,height:i}=e.getSettings();this.localShareCanvas.width=t,this.localShareCanvas.height=i}this.localShareVideoTag.paused&&this.localShareVideoTag.play().then((()=>{})).catch((e=>{ho.error("Failed to play local share video tag",e)}));const r=null===(e=this.localShareCanvas)||void 0===e?void 0:e.getContext("2d");try{null==r||r.drawImage(this.localShareVideoTag,0,0,this.localShareCanvas.width,this.localShareCanvas.height),null==r||r.drawImage(this.annoPresenterCanvas,0,0,this.localShareCanvas.width,this.localShareCanvas.height);const e=null===(i=null===(t=this.desktopSharingValue)||void 0===t?void 0:t.canvas)||void 0===i?void 0:i.id;this.localShareCanvasExt&&"function"==typeof this.localShareCanvasExt.getContext&&this.localShareCanvasExt.id!==e&&this.localShareCanvasExt.getContext("2d").drawImage(this.localShareCanvas,0,0,this.localShareCanvasExt.width,this.localShareCanvasExt.height)}catch(e){ho.error("Failed to draw local annotation content",e)}}onAnnoRenderRequired(){this.annoPresenterCanvas.width&&this.annoPresenterCanvas.height&&this.localAnnoStarted&&this.drawLocalAnnotationContent()}getAnnoRemoteSizeInfo(e){let t,i,r,s;if(e){const e=this.shareStreamScheduler.getAnnotationRawStream();if(e){const r=e.getVideoTracks()[0],s=null==r?void 0:r.getSettings();t=(null==s?void 0:s.width)||0,i=(null==s?void 0:s.height)||0}else t=0,i=0}else t=this.sharingWidthAndHeightInfo.width,i=this.sharingWidthAndHeightInfo.height,r=this.sharingWidthAndHeightInfo.absWidth,s=this.sharingWidthAndHeightInfo.absHeight;return{width:t,height:i,absWidth:r,absHeight:s}}switchAnnoCanvasZIndex(e,t){t.style.zIndex="3",t.style.pointerEvents="auto",e&&(e.style.zIndex="2")}beforeReportToGlobalTracing(){this.wmscManager&&this.wmscManager.reportWMSCPeerConnectionRawStats()}workrtHealthCheckReport(e,t){const i=l.GetMediaSession(e),r=null==i?void 0:i.checkInitSuccess();let s="WORKERZOMBIE:".concat(e,":").concat(r,":").concat(t,":").concat(document.hidden);D.A.add_monitor(s),c.Ay.directReport(s)}onSharingSizeChange(e){this.sharingCodecInfo.width=e.width,this.sharingCodecInfo.height=e.height}isEnableAutoJoinAudio(){return!(a.Ay.isMac()&&a.Ay.browser.isSafari&&!this.webrtcAudio&&!a.Ay.isSafariVersionHigherThan("18.0"))}notifyUISetSpeakerError(e){this.audioSpeakerSetErrorCnt++,c.Ay.error("setSinkId failed ".concat(this.audioSpeakerSetErrorCnt," times, current speaker ").concat(e.currentSink,", reason = ").concat(e.reason)),this.audioSpeakerSetErrorCnt<=3&&d.A.Notify_APPUI(n.dsK,e)}notifyUISetMicError(e){this.audioMicSetErrorCnt++,c.Ay.error("setSinkId failed ".concat(this.audioMicSetErrorCnt," times, current mic ").concat(e.currentMic,", reason = ").concat(e.reason)),this.audioMicSetErrorCnt<=3&&d.A.Notify_APPUI(n.HOE,e)}initVideoProcessorWorker(){return ao(this,void 0,void 0,(function*(){return this.videoProcessorWorkerInitPromise||(this.videoProcessorWorkerInitPromise=(()=>ao(this,void 0,void 0,(function*(){var e,t,i,r,o;if(!this.processorWorker){const n=this.publicRootPath||co,c=n.substring(0,n.lastIndexOf("/"))+"/video_processor.min.js",l=yield(0,oi.A)(c),h=yield l.arrayBuffer(),u=s().createObjectURL(new Blob([h],{type:"text/javascript"}));this.processorWorker=new Worker(u,{name:"video-processor"}),s().revokeObjectURL(u),this.processorWorker.addEventListener("message",(e=>{const t=e.data;t.cmd==ui.PROCESSOR_WORKER_ERROR&&D.A.add_monitor("PCWE"+t.data)}));const p=new MessageChannel;if(this.processorWorker.postMessage({command:li.ADD_VIDEO_PORT,data:p.port1},[p.port1]),this.webrtcConfig.webrtcflag||a.Ay.isSelfPreviewRenderWithVideo())this.processorMessagePort=p.port2;else if(null===(o=null===(r=null===(i=null===(t=null===(e=d.A.localVideoEncMGR)||void 0===e?void 0:e.map)||void 0===t?void 0:t.get)||void 0===i?void 0:i.call(t,d.A.SPECIAL_ID))||void 0===r?void 0:r.postMessage)||void 0===o||o.call(r,{command:"processor_message_port",data:p.port2},[p.port2]),!this.checkIsRenderInWorker()||a.I4.getIsRenderSelfVideoInEncodeWorker(!0)){const e=new MessageChannel;this.processorWorker.postMessage({command:li.ADD_SHADOW_PORT,data:e.port1},[e.port1]),this.shadowProcessorMessagePort=e.port2}}})))()),this.videoProcessorWorkerInitPromise}))}resumeAudioContextandPlayAudioTag(){var e,t,i,r;this.audioCtx&&!this.audioInputLevel&&((null===(e=this.audioDomNode)||void 0===e?void 0:e.paused)||"running"!==(null===(t=this.audioCtx)||void 0===t?void 0:t.state))&&(this.playFailedTimeout||(this.playFailedTimeout=setTimeout((()=>{d.A.Notify_APPUI_SAFE(n.raw,P.K_)}),1e3)),c.Ay.directReport("play audio failed: this.audioDomNode?.paused: ".concat(null===(i=this.audioDomNode)||void 0===i?void 0:i.paused,", this.audioCtx?.state: ").concat(null===(r=this.audioCtx)||void 0===r?void 0:r.state," ")),D.A.add_monitor("PAF"),document.body.removeEventListener("click",this.resumeWASMAudio),document.body.addEventListener("click",this.resumeWASMAudio))}initShareProcessorWorker(){return ao(this,void 0,void 0,(function*(){return this.shareProcessorWorkerInitPromise||(this.shareProcessorWorkerInitPromise=(()=>ao(this,void 0,void 0,(function*(){if(!this.shareProcessorWorker){const e=this.publicRootPath||co,t=e.substring(0,e.lastIndexOf("/"))+"/share_processor.min.js",i=yield(0,oi.A)(t),r=yield i.arrayBuffer(),o=s().createObjectURL(new Blob([r],{type:"text/javascript"}));this.shareProcessorWorker=new Worker(o,{name:"share-processor"}),s().revokeObjectURL(o),this.shareProcessorWorker.addEventListener("message",(e=>{const t=e.data;t.cmd==ui.PROCESSOR_WORKER_ERROR&&D.A.add_monitor("PCWE"+t.data)}));const a=new MessageChannel;this.shareProcessorWorker.postMessage({command:hi.ADD_SHARE_PORT,data:a.port1},[a.port1]),this.shareProcessorMessagePort=a.port2}})))()),this.shareProcessorWorkerInitPromise}))}processorInited(e,t){return new Promise((i=>{const r=s=>{s.data.name===e&&(s.data.cmd===li.PROCESSOR_READY||s.data.cmd===hi.PROCESSOR_READY?(i(!0),t.removeEventListener("message",r)):s.data.cmd!==li.PROCESSOR_ERROR&&s.data.cmd!==hi.PROCESSOR_READY||(i(!1),t.removeEventListener("message",r)))};try{t.addEventListener("message",r)}catch(e){console.error(e)}}))}addProcessor(e){return ao(this,arguments,void 0,(function(e){var t=this;let{url:i,name:r,type:o="video",options:n}=e;return function*(){if("video"===o&&a.Ay.isSupportVideoProcessor(t.mediaFeatureOptions)){yield t.initVideoProcessorWorker();const e=new MessageChannel;if(e.port1.start(),t.processorWorker.postMessage({url:i,name:r,command:li.ADD_VIDEO_PROCESSOR,port:e.port2,options:n},[e.port2]),yield t.processorInited(r,t.processorWorker))return{name:r,type:o,port:e.port1}}else if("audio"===o&&a.Ay.isSupportAudioProcessor(t.mediaFeatureOptions)){const e=t.publicRootPath||co,a=e.substring(0,e.lastIndexOf("/"))+"/js_audio_processor_worklet.min.js",d=yield(yield(0,oi.A)(a)).text(),c=yield(yield(0,oi.A)(i)).text(),l=s().createObjectURL(new Blob([d.replace("zoom-audio-processor-worklet",r)+"\n"+c],{type:"application/javascript"}));if(Zi.audioProcessorCtx){yield Zi.audioProcessorCtx.audioWorklet.addModule(l),s().revokeObjectURL(l);const e=new AudioWorkletNode(Zi.audioProcessorCtx,r,n);return Zi.addProcessor(r,e),{name:r,type:o,port:e.port}}}else if("share"===o&&a.Ay.isSupportShareProcessor(t.mediaFeatureOptions)){yield t.initShareProcessorWorker();const e=new MessageChannel;if(e.port1.start(),t.shareProcessorWorker.postMessage({url:i,name:r,command:hi.ADD_SHARE_PROCESSOR,port:e.port2,options:n},[e.port2]),yield t.processorInited(r,t.shareProcessorWorker))return Tr.setProcessorOptions(r,n),{name:r,type:o,port:e.port1}}return null}()}))}startProcessor(e){return ao(this,arguments,void 0,(function(e){var t=this;let{name:i,type:r}=e;return function*(){var e,s,o,h,u,p,f,m,v,g,_,S;if("video"===r&&a.Ay.isSupportVideoProcessor(t.mediaFeatureOptions))if(D.A.add_monitor("SPMV"),t.webrtcConfig.webrtcflag||a.Ay.isSelfPreviewRenderWithVideo()){if(Ii.addCallback(i,((e,t)=>{e==ui.RESOLUTION_CHANGE&&lo.onVBResolutionChange&&lo.onVBResolutionChange(t)})),Ii.addFrameCallback(i,(e=>{l.TransoferDataToVideoEncodeThread({command:"yuvVideoFrame",data:e,rotation:0},[e]),e.close()})),Ii.startProcessor(i,new Ti(i,t.processorMessagePort,t.platformType==P.u7.IPHONE,!t.webrtcConfig.webrtcflag)),lo.videoStream){Ii.removeStream(),Ii.setStream(lo.videoStream);const e=Ii.getStream();lo.processedStream=e,t.webrtcConfig.webrtcflag?t.updateWebRTCVideoStream(e):t.render_self_video_wasm()}null===(g=null===(v=null===(m=null===(f=null===(p=d.A.localVideoEncMGR)||void 0===p?void 0:p.map)||void 0===f?void 0:f.get)||void 0===m?void 0:m.call(f,d.A.SPECIAL_ID))||void 0===v?void 0:v.postMessage)||void 0===g||g.call(v,{command:Zt.PROCESS_VIDEO_IN_MAIN,flag:!0})}else null===(u=null===(h=null===(o=null===(s=null===(e=d.A.localVideoEncMGR)||void 0===e?void 0:e.map)||void 0===s?void 0:s.get)||void 0===o?void 0:o.call(s,d.A.SPECIAL_ID))||void 0===h?void 0:h.postMessage)||void 0===u||u.call(h,{command:"start_video_processor",name:i}),t.checkIsRenderInWorker()&&!a.I4.getIsRenderSelfVideoInEncodeWorker(!0)||(Ii.addFrameCallback(i,(e=>{var i;let r=vo();null===(i=t.VideoRenderObj)||void 0===i||i.Update_LocalVideo(e,r,!0),e.close()})),Ii.startProcessor(i,new Ri(i,t.shadowProcessorMessagePort)));else if("audio"===r&&a.Ay.isSupportAudioProcessor(t.mediaFeatureOptions)){D.A.add_monitor("SPMA"),Zi.startProcessor(i);const e=Zi.hasProcessor()?Zi.getStream():lo.audioStream;t.useWebRTCAudio?null===(_=t.webrtcAudio)||void 0===_||_.setStreamAsync(e).then((e=>{d.A.ComputerAudioStatus===E.BX.ComputerAudio_Connecting&&(d.A.ComputerAudioStatus=E.BX.ComputerAudio_Connected,d.A.Notify_APPUI(n.Ubu,{microphoneDeviceId:lo.getAudioDeviceId()}))})):d.A.AudioNode&&(t.webrtcAudioNode&&(t.webrtcAudioNode.disconnect(d.A.AudioNode),t.webrtcAudioNode=null),t.webrtcAudioNode=t.audioCtx.createMediaStreamSource(e),t.webrtcAudioNode.connect(d.A.AudioNode))}else if("share"===r&&a.Ay.isSupportShareProcessor(t.mediaFeatureOptions)){if(Tr.isProcessorStarted(i))return void c.Ay.log("startProcessor(type=share) processor(name:".concat(i,") is started before!"));D.A.add_monitor("SPMS"),Tr.addCallback(i,((e,t)=>{}));let e,r=Tr.getProcessorOptions(i);r&&"boolean"==typeof r.needFixedCaptureRate&&(e=!!r.needFixedCaptureRate);const s={canCanvasAsOffscreenAfterCaptureStream:!(null===(S=a.Ay.browser)||void 0===S?void 0:S.isFirefox),needFixedCaptureRate:e};Tr.startProcessor(i,new wr(i,t.shareProcessorMessagePort,s));const o=t.shareStreamScheduler.getRawStream();if(o&&!t.desktopSharingValue.audioOnly){yield Tr.removeStream(),Tr.setStream(o);const e=Tr.getStream();if(t.shareStreamScheduler.bindShareProcessorStream(e),t.localAnnoStarted&&t.shareStreamScheduler.getAnnotationStream())t.updateShareStreamForAnnotation(t.shareStreamScheduler.getShareProcessorStream());else{t.shareStreamScheduler.switchToShareProcessorStream();const e=t.shareStreamScheduler.getCurrentStream();t.notifyEncodeMainWorkerShareStreamChanged(e),D.A.add_monitor("SCTP"),t.updateShareLivePreview(t.desktopSharingValue.video,e)}}}}()}))}stopProcessor(e){return ao(this,arguments,void 0,(function(e){var t=this;let{name:i,type:r}=e;return function*(){var e,s,o,l,h,u,p,f,m,v,g,_,S,A,y;if("video"===r&&a.Ay.isSupportVideoProcessor(t.mediaFeatureOptions))D.A.add_monitor("EPMV"),t.webrtcConfig.webrtcflag||null===(h=null===(l=null===(o=null===(s=null===(e=d.A.localVideoEncMGR)||void 0===e?void 0:e.map)||void 0===s?void 0:s.get)||void 0===o?void 0:o.call(s,d.A.SPECIAL_ID))||void 0===l?void 0:l.postMessage)||void 0===h||h.call(l,{command:"stop_video_processor",name:i}),Ii.stopProcessor(i),!Ii.hasProcessor()&&lo.videoStream&&(lo.processedStream=null,t.webrtcConfig.webrtcflag?t.updateWebRTCVideoStream(lo.videoStream):t.render_self_video_wasm()),null===(v=null===(m=null===(f=null===(p=null===(u=d.A.localVideoEncMGR)||void 0===u?void 0:u.map)||void 0===p?void 0:p.get)||void 0===f?void 0:f.call(p,d.A.SPECIAL_ID))||void 0===m?void 0:m.postMessage)||void 0===v||v.call(m,{command:Zt.PROCESS_VIDEO_IN_MAIN,flag:!1});else if("audio"===r&&a.Ay.isSupportAudioProcessor(t.mediaFeatureOptions)){D.A.add_monitor("EPMA"),Zi.stopProcessor(i);const e=Zi.hasProcessor()?Zi.getStream():lo.audioStream;t.useWebRTCAudio?null===(g=t.webrtcAudio)||void 0===g||g.setStreamAsync(e).then((e=>{d.A.ComputerAudioStatus===E.BX.ComputerAudio_Connecting&&(d.A.ComputerAudioStatus=E.BX.ComputerAudio_Connected,d.A.Notify_APPUI(n.Ubu,{microphoneDeviceId:lo.getAudioDeviceId()}))})):d.A.AudioNode&&(t.webrtcAudioNode&&(t.webrtcAudioNode.disconnect(d.A.AudioNode),t.webrtcAudioNode=null),t.webrtcAudioNode=t.audioCtx.createMediaStreamSource(e),t.webrtcAudioNode.connect(d.A.AudioNode))}else if("share"===r&&a.Ay.isSupportShareProcessor(t.mediaFeatureOptions)){D.A.add_monitor("EPMS"),yield Tr.stopProcessor(i),t.shareStreamScheduler.unbindShareProcessorStream();const e=t.shareStreamScheduler.getAnnotationStream();if(t.localAnnoStarted||e){e&&(t.shareStreamScheduler.bindAnnotationStream(e),t.shareStreamScheduler.switchToAnnotationStream());const i=t.shareStreamScheduler.getRawStream();i&&t.updateShareStreamForAnnotation(i)}else t.shareStreamScheduler.getRawStream()?(t.shareStreamScheduler.switchToRawShareStream(),t.notifyEncodeMainWorkerShareStreamChanged(t.shareStreamScheduler.getCurrentStream()),t.updateShareLivePreview(t.desktopSharingValue.video,t.shareStreamScheduler.getCurrentStream())):c.Ay.log("stopProcessor() no active share stream found while stopping a share processor.");D.A.add_monitor("SCTP");const r=t.isSupportVideoShare?d.A.localVideoEncMGR:d.A.localSharingEncMGR;null===(y=null===(A=null===(S=null===(_=null==r?void 0:r.map)||void 0===_?void 0:_.get)||void 0===S?void 0:S.call(_,d.A.SPECIAL_ID))||void 0===A?void 0:A.postMessage)||void 0===y||y.call(A,{command:"stop_share_processor",name:i})}}()}))}ScreenShot(e,t,i){return new Promise(((i,r)=>ao(this,void 0,void 0,(function*(){var s,o,n;if(D.A.add_monitor("SCREENSHOT:".concat(e,":").concat(t)),"video"!=t&&"sharing"!=t)return void r("not support ".concat(t," type"));const c="video"==t,l=e>>10==this.userId>>10,h=(0,Hi.Ek)(),u=e>>10<<10,p=this.webrtcConfig.webrtcflag,f=ue.X.isUseSsrcStream(),m=this.isStartVideoCapture,v=(null===(s=this.selfPreviewVideotagList)||void 0===s?void 0:s.length)||0,g=l&&this.isSelfViewWithVideo;try{if((p||g)&&c){let t=null,s=!1,a=0;if(p?t=null===(n=null===(o=this.wmscManager)||void 0===o?void 0:o.getUserIdVideo(e))||void 0===n?void 0:n[0]:(t=m&&this.videoCaptureValue.videoCtrl,!t&&m&&v&&(t=this.selfPreviewVideotagList[v-1]),t||!this.isMaskSettingOn&&!this.isVBSettingOn||(t=this.MaskSettingVideo)),t){const e={x:0,y:0,width:t.videoWidth,height:t.videoHeight,mirror:s,rotation:a};let r=yield h.captureFromVideoTag(t,e);i(r)}else r("not found userid ".concat(e));return}if(f){let s=null,o=!1,a=0;const n=mr.captureVideo(u,"sharing"===t);if(n&&(s=n.renderTarget,o=n.info.mirror,a=(e=>{switch(e){case"rot0":return 0;case"rot90":return 1;case"rot180":return 2;case"rot270":return 3;default:return(0,it.B)().assertion.assertWithFailed(),0}})(n.info.rotation)),s){const e={x:0,y:0,width:s.videoWidth,height:s.videoHeight,mirror:o,rotation:a};let t=yield h.captureFromVideoTag(s,e);i(t)}else r("not found userid ".concat(e));return}const s=d.A.browserFeature;if("video"==t&&!this.checkIsRenderInWorker()||"sharing"==t&&!this.isSupportOffscreenCanvas||!s.isSupportOffScreenCanvasWebgl()){const s=c?this.VideoRenderObj:this.SharingRenderObj;if(!s)return void r("not ".concat(t," render"));const{canvas:o,options:a}=s.getUserIdVideo(u);if(!o)return void r("not found userid ".concat(e," render"));s.reDraw();let n=yield h.captureFromCanvas(o,a);return void i(n)}const _=a.I4.getIsRenderSelfVideoInEncodeWorker(l),S=h.createTask((e=>{let i={command:Zt.SCREENSHOT,ssrc:u,id:e,type:t},s=null;if(c){const e=_?d.A.localVideoEncMGR:d.A.localVideoDecMGR;s=null==e?void 0:e.map.get(0)}else{const e=this.isSupportVideoShare?d.A.localVideoDecMGR:d.A.localSharingDecMGR;s=null==e?void 0:e.map.get(0)}s?s.postMessage(i):r("no render")}));let A=yield S.get();i(A)}catch(e){r(e)}}))))}getMediaStreamController(){return lo}handlePermissionRequest(e){return ao(this,void 0,void 0,(function*(){let t=yield Ce.A.hasPermission("microphone"),i=yield Ce.A.hasPermission("camera");if(t&&i)return void this.requestPermissionCallback(n.xzH.GRANTED_AUDIO_VIDEO);const r="audio"==e;let s=setTimeout((()=>{d.A.Notify_APPUI_SAFE(n.Q$T),clearTimeout(s),s=null}),500);if(!r)try{let e=yield x.A.getUserMedia({audio:!0,video:!0});return e.getTracks().forEach((e=>e.stop())),e=null,s&&(clearTimeout(s),s=null),void this.requestPermissionCallback(n.xzH.GRANTED_AUDIO_VIDEO)}catch(e){}try{this.requestPermissionCallback(n.xzH.REQUESTING_AUDIO);let e=yield navigator.mediaDevices.getUserMedia({audio:!0});e.getTracks().forEach((e=>e.stop())),e=null,s&&(clearTimeout(s),s=null),this.requestPermissionCallback(n.xzH.GRANTED_AUDIO)}catch(e){s&&(clearTimeout(s),s=null);const{errorCode:t}=go(e);t===n.sfr.USER_DENIED?this.requestPermissionCallback(n.xzH.DENIED):t===n.sfr.USER_DISMISS?this.requestPermissionCallback(n.xzH.DISMISS):this.requestPermissionCallback(n.xzH.EXCEPTION_FAILS)}}))}initWebRTCAudioInstance(e){return ao(this,arguments,void 0,(function(e){var t=this;let{rwgHost:i,cid:r,meetingNumber:s,userId:o,isCapturingAudio:n,webrtcMode:l,workerType:h,audioMode:u,abToken:p}=e;return function*(){var e,f,m,v,g,_,S,A,y;d.A.hasUsedWebRTCAudio=!0;const C={jsPath:t.audioWorkletJsPath.audioLevelWorkletPath,wasmPath:a.Ay.isSupportAudioDenoise(t.mediaFeatureOptions)?t.audioWorkletJsPath.audioSIMDWasm:void 0};if(a.Ay.isWebRTCAudio2_0(t.mediaFeatureOptions,t.mid,!0,t.webrtcAudio2EnabledOnFT,t.abTestStrategy)){d.A.audioSolution="WEBRTC 2.0";try{yield t._initWMSC({rwgHost:i,cid:r,meetingNumber:s,workerType:h,userId:o,webrtcMode:l}),t.webrtcAudio=null===(g=t.wmscManager)||void 0===g?void 0:g.getWMSCAudio(),null===(_=t.webrtcAudio)||void 0===_||_.initconfig({recvOnly:!n,codecDoAVSync:t.codecDoAVSync,useWebRTCOnDesktop:d.A.isDesktopMode,workletPath:C}),n&&(null===(S=t.webrtcAudio)||void 0===S||S.setRecvOnly(!1,lo.audioStream)),null===(A=t.webrtcAudio)||void 0===A||A.setCodecDoAVSync(t.codecDoAVSync),yield null===(y=t.webrtcAudio)||void 0===y?void 0:y.join(!1,null,u)}catch(e){c.Ay.error("Init WMSC audio failed, due to: ",e)}}else{const s="wss://".concat(i,"/ab/signal?rwg=").concat(i,"&cid=").concat(r);if(t.webrtcAudio&&t.webrtcAudio.getConnectionId()!=r)try{t.webrtcAudio.destroy(!1),t.webrtcAudio=null,lo.webrtcAudio=null}catch(e){c.Ay.error("destory webrtc audio error",e)}t.webrtcAudio||(t.webrtcAudio=new er.default(r,o,s,!n,t.codecDoAVSync,d.A.isDesktopMode,C,((e,i)=>{var r,s;switch(e){case"destroy":null===(r=t.webrtcAudio)||void 0===r||r.destroy(),t.webrtcAudio=null;break;case"updateConnectionResult":{const e=null===(s=t.persistenceInfo)||void 0===s?void 0:s.getAudioBridgeConnectivityInfo();null==e||e.updateWebRTCConnectivityResult(i);break}}})),t.webrtcAudio.setIceServers(t.iceServers)),n&&(null===(e=t.webrtcAudio)||void 0===e||e.setRecvOnly(!1,lo.audioStream)),null===(f=t.webrtcAudio)||void 0===f||f.setCodecDoAVSync(t.codecDoAVSync),yield null===(m=t.webrtcAudio)||void 0===m?void 0:m.join(!1,p,u),h&&(yield null===(v=t.webrtcAudio)||void 0===v?void 0:v.getAudioPromise(h),t.init_Notify_APPUI(!0,h)),"WEBRTC 2.0"==d.A.audioSolution&&(D.A.add_monitor("AudioFallback:WebRTC2.0toWebRTC1.0"),c.Ay.directReport("audio fallback from webrtc 2.0 to 1.0 successfully")),d.A.audioSolution="WEBRTC 1.0"}}()}))}wmscRequestHandler(e,t){var i;switch(e){case"negotiationResult":{const e=null===(i=this.persistenceInfo)||void 0===i?void 0:i.getWMSCConnectivityInfo();null==e||e.updateWebRTCConnectivityResult(t);break}case"audioRecapture":Xi(this,this.audioCapture)}}registerMeshNote(){return ao(this,void 0,void 0,(function*(){var e,t,i;const r=2&d.A.enablemesh;if(!r)return;const s=l.GetMediaSession(E._c.VIDEO_DECODE),o=null==s?void 0:s.checkInitSuccess(),c=l.GetMediaSession(E._c.AUDIO_DECODE),h="WEBRTC 1.0"===d.A.audioSolution||"WEBRTC 2.0"===d.A.audioSolution,u=h||(null==c?void 0:c.checkInitSuccess()),p=8&d.A.enablemesh;if(h&&!p)return;const f=l.GetMediaSession(E._c.SHARING_DECODE);let m=!1;if(m=this.isSupportVideoShare?f.isSocketInitSuccess():f.checkInitSuccess(),!o||!u||!m)return;let v=(yield Ce.A.hasPermission("microphone"))||(yield Ce.A.hasPermission("camera")),g=yield null===(e=this.netThreadMgr)||void 0===e?void 0:e.ready();if(Fi.role!=mi.invalid&&Fi.sdkId==this._id||!g)return;const _=4&r,S=null===(t=a.Ay.browser)||void 0===t?void 0:t.isFirefox,A=this.netThreadMgr.isSupportTransferRTC(),y=navigator.hardwareConcurrency,C=null===(i=a.Ay.browser)||void 0===i?void 0:i.isChrome,b=yield a.Ay.is32bitChrome(),w=yield a.Ay.isSDKSupportMultiThread(),R=a.Ay.getOSInfo(),T=R&&0==R.osType;let I=mi.normal;if(b)return;I=!A||y<8||!w||!T||h||S?mi.child:mi.parent;let M=6;y>8&&(M+=1),y>12&&(M+=1),C&&(M+=1),v&&(M+=1);const D=I==mi.parent?M:0;Fi.registerMeshNote(!!v),Fi.setInitRole(I,D,this._id,d.A.mesh_node,Boolean(_)),Fi.haslicense&&(Fi.reportInitPoints(),v||S||d.A.Notify_APPUI_SAFE(n.eMN,"audio"))}))}meshMessage(e){return ao(this,void 0,void 0,(function*(){var t,i,r,s,o,c,h,u;const p=null!==(t=null==e?void 0:e.data)&&void 0!==t?t:{},{cmdType:f}=p,m=no(p,["cmdType"]);if([vi.meshSigKey,vi.meshSigType].includes(f)&&!Fi.getAgent())return f==vi.meshSigType&&(Fi.signatureInfo.type=m.type,Fi.signatureInfo.meetinguuid=m.confID),void(f==vi.meshSigKey&&(Fi.signatureInfo.mmrsigkey=m.recipe));if(Fi.haslicense||f==vi.registerMeshNodeResult)if(f!=vi.registerMeshNodeResult){if(!Fi.getAgent()){const e=m.role||mi.normal,t=this.userId>>10<<10,i=(null===(r=null==this?void 0:this.meetingParams)||void 0===r?void 0:r.cid)||this.cid;Fi.createAgent(e,i,t,this.stunServers),Fi.getAgent().setMonitorLog(this.ZoomMonitor);const n=l.GetWorkerTypeThread(E._c.AUDIO_DECODE),d=l.GetWorkerTypeThread(E._c.VIDEO_DECODE),p=this.isSupportVideoShare?d:l.GetWorkerTypeThread(E._c.SHARING_DECODE),f=this.netThreadMgr,v=null===(o=null===(s=this.getFilePath)||void 0===s?void 0:s.call(this))||void 0===o?void 0:o.meshTread,g=null===(h=null===(c=this.getFilePath)||void 0===c?void 0:c.call(this))||void 0===h?void 0:h.netWasm;null===(u=this.meshThread)||void 0===u||u.close();const _=new ir("mesh",a.Ay.browser.isSafari,v,g);this.meshThread=_,_.setMonitorLog(this.ZoomMonitor);const S={audio:n,video:d,net:f,mesh:_,share:p};Fi.getAgent().setWorkerThread(S)}Fi.getAgent()&&(yield Fi.getAgent().ready)&&Fi.getAgent().onMessage(f,m)}else{Fi.haslicense=m.success,Fi.haslicense&&Fi.reportInitPoints();const e=(yield Ce.A.hasPermission("microphone"))||(yield Ce.A.hasPermission("camera")),t=null===(i=a.Ay.browser)||void 0===i?void 0:i.isFirefox;e||!Fi.haslicense||t||d.A.Notify_APPUI(n.eMN,"audio")}}))}notifyEncodeMainWorkerShareStreamChanged(e){if(!e)return void c.Ay.error("notifyEncodeMainWorkerShareStreamChanged() stream is null");const t=e.getVideoTracks()[0];if(this.isSupportMediaStreamTrackProcessor&&!this.desktopSharingValue.isCamFeedShareOniOS)if("function"==typeof MediaStreamTrackProcessor)try{this.sharingMediaStreamTrackProcessor=new MediaStreamTrackProcessor(t),this.sharingFrameStream=this.sharingMediaStreamTrackProcessor.readable,this.isSupportVideoShare?l.Notify_Sharing_Video_Encode_Thread_Transferable_Data("sharingframeStream",this.sharingFrameStream):l.Notify_Sharing_Encode_Thread_Transferable_Data("frameStream",this.sharingFrameStream)}catch(e){console.error("[JsMediaSDK] Failed to acquire processor for track ".concat(t.id,":"),e),l.Notify_Sharing_Encode_Thread_Transferable_Data(Zt.VIDEO_TRACK,t,!1)}else l.Notify_Sharing_Encode_Thread_Transferable_Data(Zt.VIDEO_TRACK,t,!1)}updateShareLivePreview(e,t){if(e&&t){e.pause(),e.srcObject=null,e.setAttribute("playsinline",""),e.muted=!0;try{e.srcObject=t}catch(i){e.src=s().createObjectURL(t)}e.readyState>=HTMLMediaElement.HAVE_METADATA?i():e.addEventListener("loadedmetadata",i,{once:!0})}else c.Ay.error("updateShareLivePreview() failed due to invalid args! previewEl:".concat(e," stream:").concat(t));function i(){e.play().catch((e=>{c.Ay.error("Screenshare preview play failed",e)}))}}_getWebRtcStats(){return ao(this,void 0,void 0,(function*(){const e=new Map,t=new Map,i=new Set(["media-source","outbound-rtp","remote-inbound-rtp","inbound-rtp","remote-outbound-rtp"]);this.wmscManager&&e.set("AV01",yield this.wmscManager.getStats()),this.webrtcAudio instanceof er.default&&(e.set("AB01",yield this.webrtcAudio.getSendStats()),e.set("AB02",yield this.webrtcAudio.getRecvStats()));for(const[r,s]of e)if(s)for(const[e,o]of s){if(!i.has(o.type))continue;if("outbound-rtp"===o.type&&!o.bytesSent)continue;if("inbound-rtp"===o.type&&!o.bytesReceived)continue;const s="".concat(r,"_").concat(e);o.id=s,o.transportId&&(o.transportId="".concat(r,"_").concat(o.transportId)),o.localId&&(o.localId="".concat(r,"_").concat(o.localId)),o.remoteId&&(o.remoteId="".concat(r,"_").concat(o.remoteId)),o.codecId&&(o.codecId="".concat(r,"_").concat(o.codecId)),t.set(s,o)}if(t.size)return t}))}createRedirVideoElement(e){if(e)return document.createElement("video");x.A.createVideoElement()}}So.buildNumber=oo.kY,So.version=oo.rE,So.util=a.Ay,So.initVideoPlayer=function(e){var t;let i="video-player";e.tagName&&(i=e.tagName,qr.dispatch("",{tagName:e.tagName}),ns(null===(t=e.mediaSDK)||void 0===t?void 0:t.call(e),`VPTN:${i}`));const r=`${i}-container`,s=e.sessionId||es();return qr.get("renderCountMap").clear(),e.mediaSDK&&(qr.get("mediaSDKInstanceMap").set(Br,e.mediaSDK),qr.get("mediaSDKInstanceMap").set(s,e.mediaSDK)),e.failover&&qr.dispatch("failover",void 0,e.sessionId||Br),customElements.get(r)||customElements.define(r,to),customElements.get(i)||customElements.define(i,Qs),s},So.fixVersion=oo.C,So.pkgVersion=oo.zu;const Ao=So},3647:(e,t,i)=>{"use strict";i.d(t,{BH:()=>o,G7:()=>l,O$:()=>p,Qb:()=>a,Ur:()=>h,W5:()=>r,gz:()=>n,h3:()=>s,mN:()=>c,ru:()=>f,vL:()=>d,x0:()=>u});const r={AVAILABLE:0,NOT_SUPPORTED:1,CANNOT_REQ_ADAPTER:2,CANNOT_REQ_DEVICE:3},s={AUTO:-1,UNDEFINED:0,WEBGL:1,WEBGPU:2,WEBGL_2:3,VIDEO_TAG:4},o={DISABLED:0,ENABLED:1,AUTO:2},a={SUCCEED:0,UNKNOWN:-1,INVALID_ARG:-2,BROWSER_NOT_SPT:-3,DEVICE_ON_BLACKLIST:-4,INVALID_DEVICE_INFO:-5,UNKNOWN_SELECTION:-6,OTHER_EX:-7,DEVICE_NOT_ON_WHITELIST:-8,FEATURE_OPTION_DISABLED:-9,FORCE_SAME_AV_STRATEGY:-10},n={AVAILABLE:0,VIDEO:1,SHARE:2},d=0,c=1,l=2,h=3,u={VS_BASE:0,CURSOR:1,WATERMARK:2,MASK:3,END:4},p=["intel","nvidia","apple","amd","qualcomm","arm"],f=.005},9102:(e,t,i)=>{"use strict";i.d(t,{e:()=>A});var r=i(6984),s=i.n(r),o=i(1241),a=i(3750),n=i(2754),d=i(9407),c=i(385),l=i(9415),h=i(3021);class u{constructor(e,t){this._connection=null,this._services=[],this._registerPromise=null,this._serviceName=e,this._serviceCtor=t}register(e){if(null!==this._registerPromise)return;const t=new MessageChannel;this._connection=new a.E(t.port1,{requestPort:e=>{const t=this.accquirePort(e);return this._connection.transfer(t)}}),this._registerPromise=h.D.registerService(this._serviceName,h.D.transfer(t.port2),e)}unregister(){if(null===this._registerPromise)return;const e=this._connection;this._registerPromise.then((t=>{h.D.unregisterService(this._serviceName,t),e.close()})),this._connection=null,this._registerPromise=null}registerPromise(){return e=this,t=void 0,r=function*(){return this._registerPromise.then((e=>e>=0))},new((i=void 0)||(i=Promise))((function(s,o){function a(e){try{d(r.next(e))}catch(e){o(e)}}function n(e){try{d(r.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,n)}d((r=r.apply(e,t||[])).next())}));var e,t,i,r}accquirePort(e){const t=new MessageChannel,i=new this._serviceCtor(e);return new a.E(t.port1,i).onClose=()=>{this._services.splice(this._services.indexOf(i),1),i.closeService()},this._services.push(i),t.port2}close(){this.unregister();for(const e of this._services)e.closeService(),e.connection.close();this._services=[]}}class p{constructor(e,t){this._provider=null,this._serviceName=e,this._serviceCtor=t}exposed(){return null!==this._provider}exposeService(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._provider||(this._provider=new u(this._serviceName,this._serviceCtor)),t&&this._provider.register(e),this._provider}unexposeService(){this._provider&&this._provider.unregister()}}var f=i(5600),m=i(6654),v=function(e,t,i,r){return new(i||(i=Promise))((function(s,o){function a(e){try{d(r.next(e))}catch(e){o(e)}}function n(e){try{d(r.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,n)}d((r=r.apply(e,t||[])).next())}))};class g{constructor(){this.nextServiceId=0,this.serviceMap=new Map,this.loadingServiceModules=new Map,this.loadedServiceModules=new Set}clear(){for(const[e,t]of this.serviceMap)for(const{connection:e}of t)e.close();this.serviceMap.clear()}}let _=new g;class S extends h.k{closeService(){(0,n.HB)()}registerService(e,t,i){const r=_.nextServiceId++,s=new a.E(t),o=_.serviceMap.get(e),n={serviceId:r,connection:s,constraints:i};return o?o.push(n):_.serviceMap.set(e,[n]),r}unregisterService(e,t){const i=_.serviceMap.get(e);if(!i)return;const r=i.findIndex((e=>e.serviceId===t));i.splice(r,1)}_fetchBlob(e){return v(this,void 0,void 0,(function*(){const t=(0,l.B)().config.getBaseScriptUrl(),i="".concat(t,"/").concat(e,".min.js"),r=yield(0,m.A)(i),s=yield r.arrayBuffer();return new Blob([s],{type:"application/javascript"})}))}_loadServiceModule(e){return new Promise((t=>{this._fetchBlob(e).then((i=>{const r=s().createObjectURL(i);let n;n=o._?new Worker(r,{name:e}):new Worker(r),n.onerror=i=>{(0,f.Yd)("Load service ".concat(e,": worker error!!"),i),t(!1)},n.onmessage=e=>{const t=e.data;if(t.status===d.AC)if("low"==t.level)c.Ay.directReport("".concat(t.errorMessage));else{const e="Error from worker service: ".concat(t.errorMessage);-1==e.indexOf("E:H")&&c.Ay.error(e,t.errorEvent)}};const h=new a.E(n),u=(0,l.B)().config;return h.remotePeerProxy.load(h.transfer(A.exposeService().accquirePort()),{renderUserAgentInfo:(0,l.B)().userAgent.info(),renderCapabilitiesDesc:(0,l.B)().capabilities.desc(),renderConfigDesc:u.desc()})})).then((e=>{t(e)})).catch((i=>{(0,f.Yd)("Load service ".concat(e," error!!"),i),t(!1)}))}))}findService(e,t){return v(this,void 0,void 0,(function*(){let t=_,i=t.serviceMap.get(e);if(!i||0===i.length){const i=e.split("/");(0,n.vA)(2===i.length);const r=i[0];if((0,n.vA)("builtin"!==r),!(r in t.loadedServiceModules)){let e=t.loadingServiceModules.get(r);e?yield e:(e=this._loadServiceModule(r),t.loadingServiceModules.set(r,e),yield e,t.loadingServiceModules.delete(r),t.loadedServiceModules.add(r))}}return i=t.serviceMap.get(e),(0,n.vA)(i&&i.length>0,"Not Found ".concat(e," after service module loaded")),i.map((e=>({serviceId:e.serviceId,constraints:e.constraints})))}))}requestService(e,t,i){return v(this,void 0,void 0,(function*(){const r=_.serviceMap.get(e);if(!r||0===r.length)return;const s=r.find((e=>e.serviceId===t));if(!s)return void(0,n.Yu)("RequestService error: Can not find service ".concat(e,":").concat(t));const o=yield s.connection.invoke("requestPort",i);return this.connection.transfer(o)}))}}const A=new class extends p{constructor(){super("builtin/RegistryService",S)}exposeService(){const e=this.exposed(),t=super.exposeService(void 0,!1);if(!e){const e=t.accquirePort();h.D.setRegistryServicePort(e)}return t}unexposeService(){(0,n.HB)()}reset(){_.clear(),_=new g}}},3021:(e,t,i)=>{"use strict";i.d(t,{D:()=>a,k:()=>o});var r=i(3750),s=i(2754);class o extends r.p{}const a=new class{constructor(){this._connection=null}setRegistryServicePort(e){this._connection=new r.E(e)}transfer(e){return this._connection.transfer(e)}registerService(e,t,i){return this._connection.invoke("registerService",e,t,i)}unregisterService(e,t){this._connection.invoke("unregisterService",e,t)}findService(e){return this._connection.invoke("findService",e)}requestService(e,t,i){return this._connection.invoke("requestService",e,t,i)}acquireService(e,t){return i=this,o=void 0,d=function*(){const i=yield a.findService(e);let o;t&&t.selectService?o=t.selectService(i):1===i.length?o=i[0].serviceId:(0,s.Yu)("AcquireService Error: select service failed!");const n=yield a.requestService(e,o,t?t.serviceParams:void 0);return new r.E(n)},new((n=void 0)||(n=Promise))((function(e,t){function r(e){try{a(d.next(e))}catch(e){t(e)}}function s(e){try{a(d.throw(e))}catch(e){t(e)}}function a(t){var i;t.done?e(t.value):(i=t.value,i instanceof n?i:new n((function(e){e(i)}))).then(r,s)}a((d=d.apply(i,o||[])).next())}));var i,o,n,d}}},7205:(e,t,i)=>{"use strict";i.r(t);var r=i(6984),s=i.n(r),o=i(2601),a=i.n(o),n=i(9310);if(void 0!==a()){const e=a().__MEDIA_SDK_CHUNK_LOADER__||[];e.loadScript=function(e,t,i,r){console.log("[CustomChunkLoader] Loading chunk:",r,"from:",e),(0,n.XL)(e).then((e=>{const i=s().createObjectURL(e),r=document.createElement("script");let o;r.src=i;const a=e=>{r.onerror=r.onload=null,clearTimeout(o),r.parentNode&&r.parentNode.removeChild(r),s().revokeObjectURL(i),t&&t(e)};o=self.setTimeout((()=>{a({type:"timeout",target:r})}),3e3),r.onerror=a,r.onload=a,document.head.appendChild(r)}))},a().__MEDIA_SDK_CHUNK_LOADER__=e}},6654:(e,t,i)=>{"use strict";i.d(t,{A:()=>A,T:()=>S});var r=Object.defineProperty,s=(e,t,i)=>((e,t,i)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i)(e,"symbol"!=typeof t?t+"":t,i);const o=new class{constructor(){s(this,"_enabled",!1),s(this,"_reportLog",(()=>{})),s(this,"_cacheName",""),s(this,"_enableLocalDebugLog",!1),s(this,"_resourcePath","")}get enabled(){return this._enabled}set enabled(e){this._enabled=e}get reportLog(){return this._reportLog}set reportLog(e){this._reportLog=e}get cacheName(){return this._cacheName}set cacheName(e){this._cacheName=e}get enableLocalDebugLog(){return this._enableLocalDebugLog}set enableLocalDebugLog(e){this._enableLocalDebugLog=e}get resourcePath(){return this._resourcePath}set resourcePath(e){this._resourcePath=e}},a=(...e)=>{if(!o.enableLocalDebugLog)return;const t=e[0];console.log(`FWB | ${t} -`,...e.slice(1))},n=e=>{let t=`/${e.fileName}`;e.hash&&(t=`/${e.fileName}/${e.hash}`);const i=[];return e.cdnPath&&i.push(`v=${e.cdnPath}`),e.timestamp&&i.push(`t=${e.timestamp}`),i.length>0?`${t}?${i.join("&")}`:t},d=()=>o.cacheName,c=e=>"function"==typeof e,l=void 0!==self.caches&&void 0!==self.Cache&&!!(c(self.caches.open)&&c(self.caches.delete)&&c(self.Cache.prototype.match)&&c(self.Cache.prototype.put)&&c(self.Cache.prototype.delete)&&c(self.Cache.prototype.keys)),h=e=>new Promise((t=>setTimeout(t,e))),u=(e,t,i)=>Number.isInteger(null==i?void 0:i.maxRetries)&&(null==i?void 0:i.maxRetries)>1?(async(e,t,i)=>{let r;const s=null==i?void 0:i.maxRetries,o=(null==i?void 0:i.delayMs)??-1;for(let i=0;i<s;i++)try{const i=await self.fetch(e,t);if(!i.ok)throw new Error(`Fetch resource error: ${i.status}`);return i}catch(e){if(r=e,"AbortError"===(null==e?void 0:e.name))break;i<s-1&&o>=0&&await h(o)}throw r})(e,t,i):self.fetch(e,t),p=async({cdnPath:e,fileName:t,hash:i,size:r,fetchOptions:s,fetchCustomOptions:c})=>{try{const s=await(async(e,t)=>(async e=>{const t=await caches.open(d()),i=new URL(e,self.location.origin),r=await t.match(i,{ignoreSearch:!0});if(!r)throw new Error("Not Found");return r})(n({fileName:e,hash:t})))(t,i),c=s.url||"",l=c.slice(0,c.length-t.length-1);return a(`/${e}/${t}`,"get file from cache"),o.reportLog({isHitCache:!0,isCrossRelease:l!==e,fileName:t,hash:i,size:r}),s}catch{try{const l=await(async({cdnPath:e,fileName:t,hash:i,fetchOptions:r,fetchCustomOptions:s})=>{const o=`${e}/${t}`,c=await u(o,r,s),l=n({cdnPath:e,fileName:t,hash:i,timestamp:Date.now()});try{await(async(e,t)=>{try{const i=await caches.open(d()),r=new URL(e,self.location.origin);await i.put(r,t.clone())}catch(e){console.error("Failed to save to cache",e)}})(l,c)}catch(i){a(`/${e}/${t}`,"save to cache failed",i)}return c})({cdnPath:e,fileName:t,hash:i,fetchOptions:s,fetchCustomOptions:c});return a(`/${e}/${t}`,"get file from network"),o.reportLog({isHitCache:!1,isCrossRelease:!1,fileName:t,hash:i,size:r,cachedVersion:""}),l}catch(i){throw a(`/${e}/${t}`,"get file from network - Failed"),i}}},f={},m=async(e,t)=>{f[e]||(f[e]={}),a(`/${e}/${t}`,"start to get manifest");let i=f[e].manifest;return i?(a(`/${e}/${t}`,"get manifest from memory"),{manifest:i}):(i=await(async(e,t)=>{const i=f[e];if(null==i?void 0:i.manifest)return i.manifest;const r=await(async(e,t)=>{const i=`${e}/manifest.json`,r=f[e];let s=null==r?void 0:r.ongoingPromise;return s?(a(`/${e}/${t}`,"fetchManifest","existing fetch pending"),s):(s=fetch(i,{headers:{Accept:"application/json"}}).then((async i=>{if(a(`/${e}/${t}`,"fetchManifest","get response",i.status),f[e].lastResponseStatus=i.status,!i.ok)throw i;const r=await i.json();return f[e].manifest=r,a(`/${e}/${t}`,"fetchManifest","success"),r})).finally((()=>{f[e].ongoingPromise=void 0})),f[e].ongoingPromise=s,a(`/${e}/${t}`,"fetchManifest","send request"),s)})(e,t);return r})(e,t),a(`/${e}/${t}`,"get manifest from network"),{manifest:i})},v=async(e,t,i)=>{const r=((e,t)=>{if(!e.startsWith(t))return null;t.endsWith("/")&&(t=t.slice(0,-1));const i=e.slice(t.length+1);return i?{cdnPath:t,fileName:i}:null})(new URL(e.toString()).href,o.resourcePath);if(!r)return u(e,t,i);const{cdnPath:s,fileName:n}=r;a(`/${s}/${n}`,"get file request");let d=null;try{const{manifest:e}=await m(s,n);d=e,a(`/${s}/${n}`,"get manifest success")}catch{return a(`/${s}/${n}`,"get manifest failed => fallback to browser"),u(e,t,i)}const c=null==d?void 0:d[n];return(null==c?void 0:c.hash)?p({cdnPath:s,fileName:n,hash:c.hash,size:c.size,fetchOptions:t,fetchCustomOptions:i}):u(e,t,i)},g=e=>(o.enabled=e.enabled??!1,o.reportLog=e.reportLog??a,o.cacheName=e.cacheName??"zm-media",o.enableLocalDebugLog=e.enableLocalDebugLog??!1,o.resourcePath=e.resourcePath,l&&o.enabled&&o.resourcePath?v:u);let _;function S(e){_=g(Object.assign({enabled:!0,cacheName:"zm-media",reportLog(e){console.log("FetchCache",e)}},e))}self.setTimeout((async()=>{const e=d(),t=await caches.open(e);let i=[];try{i=await t.keys()}catch{return}const r=new Map;for(const e of i){const t=new URL(e.url),i=t.searchParams.get("t");if(!i)continue;const s=parseInt(i,10);if(isNaN(s))continue;const o=t.pathname.split("/").slice(0,-1).join("/");o&&(r.has(o)||r.set(o,[]),r.get(o).push({request:e,timestamp:s}))}for(const[e,i]of r){if(i.sort(((e,t)=>t.timestamp-e.timestamp)),i.length<=1)continue;let e=i.slice(2);i[0].timestamp-i[1].timestamp>5184e6&&(e=i.slice(1));for(const i of e){try{await t.delete(i.request)}catch{continue}a(`delete from cache: ${i.request.url}`)}}}),6e4);const A=(e,t)=>_&&"function"==typeof _?_(e,t):(console.log("initializeFetchWithCache not initialized: ",e),fetch(e,t))},9310:(e,t,i)=>{"use strict";i.d(t,{X6:()=>d,XL:()=>n});var r=i(6984),s=i.n(r),o=i(6654),a=function(e,t,i,r){return new(i||(i=Promise))((function(s,o){function a(e){try{d(r.next(e))}catch(e){o(e)}}function n(e){try{d(r.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,n)}d((r=r.apply(e,t||[])).next())}))};function n(e){return a(this,void 0,void 0,(function*(){const t=yield(0,o.A)(e);return yield t.blob()}))}function d(e,t){return a(this,void 0,void 0,(function*(){const i=yield n(t),r=s().createObjectURL(i);yield e.addModule(r),s().revokeObjectURL(r)}))}},4865:(e,t,i)=>{"use strict";i.d(t,{N6:()=>o,l8:()=>a});var r=i(456),s=i(385);class o{static getStorageForCapacity(){return new SharedArrayBuffer(8+((arguments.length>0&&void 0!==arguments[0]?arguments[0]:80)+1)*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1500))}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1500,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:e.byteLength,a=arguments.length>6?arguments[6]:void 0;this.offset=s,this._BYTES_PER_ELEMENT=t,this.capacity=(o-8)/t,this.usableCapacity=this.capacity-1,this.buf=e,this.write_ptr=new Uint32Array(this.buf,s,1),this.read_ptr=new Uint32Array(this.buf,s+4,1),this.storageUint8sByteOffset=s+8,this.storageUint8s=new Uint8Array(this.buf,this.storageUint8sByteOffset,o-8),this.byteLength=o,this.label=i,this.usingOneElementBuffer=r,a&&(this.wasmMemory=a),r&&(this.oneElementBuffer=new ArrayBuffer(t)),this.repushhander=0,this.repushlogcount=0,this.monitorpace=0}checkBuffer(){this.wasmMemory&&this.wasmMemory.buffer!=this.buf&&(this.buf=this.wasmMemory.buffer,this.storageUint8s=new Uint8Array(this.buf,this.storageUint8sByteOffset,this.byteLength-8))}enqueue(e){return this.available_write()>0&&this.push(e),{rd:Atomics.load(this.read_ptr,0),wr:Atomics.load(this.write_ptr,0)}}enqueueSafe(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;for(this.dataBuffer||(this.dataBuffer=new r.A);this.dataBuffer.getLength()>0&&this.available_write()>0;){let e=this.dataBuffer.dequeue();e&&this.push(e)}let o=this.dataBuffer.getLength();if(e){if(this.available_write()>0&&0==o)return this.push(e),!0;if(!t)return!1;this.dataBuffer.enqueue(e),++o}if(o>0&&!this.repushhander&&(this.repushhander=setTimeout((()=>{this.repushlogcount%10==0&&console.warn("<<< retry consume cache data"),this.repushlogcount++,this.repushhander=0,this.enqueueSafe(null)}),30)),o>=1e3&&(s.Ay.warn("Cached data in SAB reached critical value, will be cleared"),this.dataBuffer.clear(),i&&i("vqslclear")),o>0&&i){let e=performance.now();(!this.monitorpace||e-this.monitorpace>2e4)&&(this.monitorpace=e,i&&i("vqsl"+o))}return!0}push(e){return e instanceof Array?this._pushArray(e):this._push(e)}_pushArray(e){var t=Atomics.load(this.write_ptr,0);this.checkBuffer();let i=0;e.forEach((e=>{this.storageUint8s.set(e,t*this._BYTES_PER_ELEMENT+8+4+i),i+=e.byteLength})),new Uint32Array(this.buf,this.offset+t*this._BYTES_PER_ELEMENT+8,1)[0]=i;let r=(t+1)%this.capacity;return Atomics.store(this.write_ptr,0,r),!0}_push(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;let i=(t+1)%this.capacity;return Atomics.store(this.write_ptr,0,i),!0}addReadPtr(){var e=Atomics.load(this.read_ptr,0);Atomics.store(this.read_ptr,0,(e+1)%this.capacity)}dequeue(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var t=Atomics.load(this.read_ptr,0);this.checkBuffer();let i,r,s,o=new Uint32Array(this.buf,this.offset+t*this._BYTES_PER_ELEMENT+8,1);if(e){i=this.oneElementBuffer?new Uint8Array(this.oneElementBuffer,0,o[0]):new Uint8Array(o[0]);let e=new Uint8Array(this.storageUint8s.buffer,t*this._BYTES_PER_ELEMENT+8+4+this.storageUint8sByteOffset,i.byteLength);i.set(e,0)}else i=this.storageUint8s.subarray(t*this._BYTES_PER_ELEMENT+8+4,t*this._BYTES_PER_ELEMENT+8+4+o[0]),r=t*this._BYTES_PER_ELEMENT+8+4+this.storageUint8sByteOffset,s=t*this._BYTES_PER_ELEMENT+8+4+o[0]+this.storageUint8sByteOffset;return e&&Atomics.store(this.read_ptr,0,(t+1)%this.capacity),e?i:{bCopyData:e,uint8s:i,begin:r,end:s}}available_read(){var e=Atomics.load(this.read_ptr,0),t=Atomics.load(this.write_ptr,0);return this._available_read(e,t)}available_write(){var e=Atomics.load(this.read_ptr,0),t=Atomics.load(this.write_ptr,0);return this._available_write(e,t)}is_available_write(){var e=Atomics.load(this.read_ptr,0),t=Atomics.load(this.write_ptr,0);return this._is_available_write(e,t)}_available_read(e,t){return(t+this.capacity-e)%this.capacity}_available_write(e,t){return this.usableCapacity-this._available_read(e,t)}_is_available_write(e,t){return this._available_write(e,t)>0}_storage_capacity(){return this.capacity}}class a{constructor(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:50,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:80;if(!(e instanceof o))throw new Error("RingBuffer required");this.rb=e,this.dataCallback=t,this.interval=null,this.requestID=null,this.timeout_call=i,this.tick_lasted_time=0,this.timeoutMS=r,this.maxCount=s}setDataCallback(e){this.dataCallback=e}consume(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.interval||(this.bCopyData=t,this.interval=setInterval((()=>{let e=performance.now();if(this.timeout_call){if(0!=this.tick_lasted_time){let t=e-this.tick_lasted_time;t>=this.timeoutMS&&this.timeout_call(t,e)}this.tick_lasted_time=e}this._dequeue()}),e))}consumeAll(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.bCopyData=e,this._dequeue()}_dequeue(){let e=Math.min(this.rb.available_read(),this.maxCount);for(this.consoume_count=0;this.consoume_count<e;){this.consoume_count++;let e=this.rb.dequeue(this.bCopyData);this.dataCallback(e),this.bCopyData||this.rb.addReadPtr()}}_consumeForAnimationFrame(){this._dequeue(),this.requestID=requestAnimationFrame(this._consumeForAnimationFrame.bind(this))}consumeUsingRequestAnimationFrame(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.requestID||(this.bCopyData=e,this._consumeForAnimationFrame())}cancelConsume(){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}}},6687:(e,t,i)=>{"use strict";i.d(t,{h:()=>p,b:()=>h});var r=i(7857),s=i(7201),o=i.n(s),a=i(9549);function n(e){let t=e||{};this._samples=[],this._interval_id=0,this._lasted_update_time=0,this._lasted_group_time=0,this._enable=!1,this._interval_time=t.interval||3e4,this._customer_callback=t.report_call,this._tag=t.tag||"netreport",this._group_interval=t.group_interval||1e3,this._enable_advanced=t.advanced||!1,this._current_count=0,this._qos_report=new a.V_({tag:"jitter",interval:3e4,reportcallback:this._qos_report_timeout.bind(this)}),this._qos_report_samples=[],this._cureen_qos_report=0}n.prototype._qos_report_timeout=function(e,t,i,r){if(this._customer_callback){let s="".concat(e,",").concat(t,",").concat(i,",").concat(r);this._customer_callback(this._tag+"TimeOut",s)}},n.prototype._report=function(){let e=(new Date).getTime(),t="".concat(e,"-").concat(this._samples.length,"-").concat(this._samples),i="".concat(e,"-").concat(this._qos_report_samples.length,"-").concat(this._qos_report_samples);t=o()(t).call(t,",","|"),i=o()(i).call(i,",","|"),this._customer_callback?(this._customer_callback(this._tag,t),this._enable_advanced&&this._customer_callback(this._tag+"QOS",i)):console.error("tag:".concat(this._tag,",").concat(t))},n.prototype._group=function(){let e=performance.now();if(e>=this._lasted_group_time+1700){let t=Math.round((e-this._lasted_group_time)/1e3)-1;for(let e=0;e<t;e++)this._samples.push(-1)}this._lasted_group_time=e,this._samples.push(this._current_count),this._qos_report_samples.push(this._cureen_qos_report),this._cureen_qos_report=0,this._current_count=0,e>=this._lasted_update_time+this._interval_time&&(this._lasted_update_time=e,this._report(),this._samples=[],this._qos_report_samples=[])},n.prototype.start=function(){this._enable||(this._lasted_update_time=performance.now(),this._lasted_group_time=this._lasted_update_time,this._samples=[],this._current_count=0,this._qos_report_samples=[],this._cureen_qos_report=0,this._interval_id=setInterval(this._group.bind(this),this._group_interval),this._enable=!0)},n.prototype.stop=function(){this._enable&&(clearInterval(this._interval_id),this._interval_id=0,this._enable=!1)},n.prototype.sample=function(e){if(this._enable&&(this._current_count++,this._enable_advanced)){if(a.J0.IsQosReport(e))return void this._cureen_qos_report++;if(a.J0.IsVideoPkg(e)){let t=a.J0.GetQOSTime(e),i=performance.now();if(this._lasted_qos_ts){let e=i-this._lasted_sys_ts-(t-this._lasted_qos_ts);e>30&&this._qos_report.timeoutReport(e,i)}this._lasted_qos_ts=t,this._lasted_sys_ts=i,this._lasted_data=e}}};var d=i(9693),c=i(9482),l=i(9407);class h{constructor(e,t){this.type=e,this.transportlists=[],this.transfered=!!t,this.onmessage=()=>{}}send(){}isReady(){return!1}}class u{constructor(e,t){this.sendsize=0,this.dropsize=0,this.presamples={sendsize:0,drop:0,time:0,size:0,nosendcount:0,dckbps:0,updatetime:0,smoothsend:0},this.channel=t,this.id=0,this.wraper=e,this.overusetime=0}send(e){this.sendsize+=e}drop(e){this.dropsize+=e}setbuffer(e){const t=performance.now(),{sendsize:i,drop:r,size:s,time:o}=this.presamples,a=t-o,n=this.sendsize-i,d=this.dropsize-r,c=e-s;if(a>150&&n>5e3){const i=100*d/n,r=8e3*(n-d-c)/(a*(this.presamples.nosendcount+1)),s=8e3*n/a,o=8e3*(e+d+Math.max(c/2,0)),l=0==r?5e3:o/r;if(0==r?this.presamples.nosendcount++:(this.presamples.nosendcount=0,this.presamples.dckbps=r),0==this.presamples.smoothsend)this.presamples.smoothsend=s;else{const e=.5;this.presamples.smoothsend=e*this.presamples.smoothsend+s*(1-e)}i>10&&e>16384||a<500&&l>500?0==this.overusetime?this.overusetime=Math.min(250,a)/2:this.overusetime+=Math.min(250,a):e<16384&&l<100&&(this.overusetime=0);const h=r||this.presamples.dckbps/(this.presamples.nosendcount+1),u=h/this.presamples.smoothsend;if(this.overusetime>700&&u<.75&&t>this.presamples.updatetime+3e3){const e={status:1,dckbps:h,sendkbps:this.presamples.smoothsend,overusetime:this.overusetime,nosendcount:this.presamples.nosendcount};this.wraper._onbadnet(e),this.presamples.updatetime=t}this.presamples.sendsize=this.sendsize,this.presamples.drop=this.dropsize,this.presamples.size=e,this.presamples.time=t}}start(){this.id||(this.presamples.time=performance.now(),this.id=setInterval((()=>{let e=this.channel.bufferedAmount;this.setbuffer(e)}),100))}stop(){this.id&&(clearInterval(this.id),this.id=0)}}class p{constructor(e,t,i,r,s,o){this.id=e,this.tag=s||"",this.type=t,this.datachannel=i,this._recv_statistic=null,this.onmessageFn=()=>{},this.disconnectedFn=null,this.connectedFn=null,this._status=p.UNINIT,this.target_thread=r,this.transfered=!1,this._listener=null,this.transportlists=[],this._send_statistic=null,this.report_monitor_func=()=>{},this.bsuppend=!1,this.mgr=o,this.bufferIncreaseCount=0,this.lastBufferedAmount=0,this.highWaterMarkCount=0,this.sendcount=0,this.sendStatic=null,this.enableSendStatic=!1,this.onnetbadFn=e=>{}}isReady(){return this._status===p.CONNECTED}isTransfered(){return!!this.transfered}send(e){if(this.enableSendStatic){if(this.sendcount++,this.sendStatic.send(e.length),this.datachannel.bufferedAmount>65536)return void this.sendStatic.drop(e.length);if(this.datachannel.bufferedAmount>32768&&(this.sendcount%5==0||21==e[4]&&1==e[1]&&51==e[13]))return void this.sendStatic.drop(e.length)}this.datachannel.send(e),this._send_statistic.sample(!1)}open(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.target_thread)try{var t;return this.target_thread.postMessage({command:d.OPEN_DATACHANNEL,id:this.id,type:this.type,channel:this.datachannel,transportlists:this.transportlists,tag:this.tag},[this.datachannel]),this.transfered=!0,this.datachannel=null,void(null===(t=this.mgr)||void 0===t||t.addRTCChannel(this))}catch(e){this.target_thread=null}this._addEventListener(e)}close(){var e;null===(e=this.mgr)||void 0===e||e.removeRTCChannel(this);let t=this.disconnectedFn;this.transfered&&this.target_thread&&this.target_thread.postMessage({command:d.CLOSE_DATACHANNEL,id:this.id,type:this.type}),this._status!=p.DISCONNECT&&this._clear(),this._status=p.DISCONNECT,null==t||t()}onmessage(e){this.onmessageFn=e}onopen(e){this.connectedFn=e}onclose(e){this.disconnectedFn=e}onerror(e){this.errorFn=e}onbadnet(e){this.onnetbadFn=e||(e=>{})}_onbadnet(e){this.onnetbadFn(e)}_addEventListener(e){this.datachannel.onmessage=e?this._onmessage2.bind(this):this._onmessage.bind(this),this.datachannel.onopen=this._onopen.bind(this),this.datachannel.onclose=this._onclose.bind(this),this.datachannel.onclosing=this._onclose.bind(this),this.datachannel.onerror=this._onerror.bind(this),"open"==this.datachannel.readyState&&this._status==p.UNINIT&&this._onopen()}_onmessage2(e){this._status==p.UNINIT&&this._onopen(),this._recv_statistic.sample(!1),this.onmessageFn(e)}_onmessage(e){this._recv_statistic.sample(!1),this.onmessageFn(e)}_onopen(e){let t=this._status;if(this._status=p.CONNECTED,!this.transfered){const e=this.report_monitor_func;if(!this._send_statistic){const t=this.tag?this.tag+"_SEND":this.type==c.Xt.VIDEO?"VDCS":"ADCS";this._send_statistic=new n({tag:t,report_call:e})}if(!this._recv_statistic){const t=this.tag?this.tag+"_RECV":this.type==c.Xt.VIDEO?"VDCR":"ADCR";this._recv_statistic=new n({tag:t,report_call:e})}this._send_statistic.start(),this._recv_statistic.start(),this.enableSendStatic=this.type==c.Xt.VIDEO,this.sendStatic=new u(this,this.datachannel),this.enableSendStatic&&this.sendStatic.start()}var i;t!=p.CONNECTED&&(null===(i=this.connectedFn)||void 0===i||i.call(this))}_onerror(e){var t;null===(t=this.errorFn)||void 0===t||t.call(this,e),this._onclose(e)}_onclose(e){let t=this._status;this._status=p.DISCONNECT;let i=this.disconnectedFn;this._clear(),t!=p.DISCONNECT&&(null==i||i())}_clear(){var e,t,i;!this.transfered&&this.datachannel&&(this.datachannel.onmessage=null,this.datachannel.onopen=null,this.datachannel.onclose=null,this.datachannel.onclosing=null,this.datachannel.onerror=null),this.onmessageFn=null,this.connectedFn=null,this.disconnectedFn=null,this.errorFn=null;let r=this.datachannel;this.datachannel=null,null===(e=this._send_statistic)||void 0===e||e.stop(),null===(t=this._recv_statistic)||void 0===t||t.stop(),null===(i=this.sendStatic)||void 0===i||i.stop(),null==r||r.close()}mesagelistener(e){let t=e.data;if(t&&t.id==this.id)switch(t.cmd){case l.Lm:this._onclose();break;case l.hG:this._onopen();break;case l.Zk:this._onerror(t.ev);break;case l.vr:this.report_monitor_func(t.tag,t.data)}}}(0,r.A)(p,"UNINIT",0),(0,r.A)(p,"CONNECTED",1),(0,r.A)(p,"DISCONNECT",2)},5061:(e,t,i)=>{"use strict";i.d(t,{r:()=>r});const r={NO_THREAD:0,SELF_THREAD:1}},2614:(e,t,i)=>{"use strict";i.d(t,{G1:()=>A,qK:()=>h,xm:()=>S,uB:()=>v,Eg:()=>u,tH:()=>f,np:()=>g,L:()=>p});var r=i(9482),s=i(6687),o=i(7857),a=i(9710),n=i(5061);class d extends a.cS{constructor(){super()}TransportListChange(e,t){}TransportStatus(e,t,i){}DataChannelStatus(e,t){}}class c extends a.cS{constructor(e){super(),this.transportMap={},this.type=e.type,this.mgr=e,this.channellists=[],this.channelListeners=[]}addDataChannel(e){if(e instanceof s.h){if(-1==this.channellists.findIndex((t=>t==e))){this.channellists.push(e);try{this.mgr.checkTransport(e)}catch(e){console.error("addDataChannel error",e)}this.channelListeners.forEach((t=>{t.DataChannelStatus(e,!0)}))}}else console.error("channel must be a DataChannelWrapper")}TransportListChange(e,t){let i=this.getChannelByTransportType(e.type);if(t&&null!=i&&i.isReady()){let t=i.target_thread||n.r.SELF_THREAD;this.mgr.addTransportForTargetThread(e,t)}t||this.mgr.closeTransportForTargetThread(e),i&&this.channelListeners.forEach((r=>{r.TransportStatus(e,i,t)})),this.channelListeners.forEach((i=>{i.TransportListChange(e,t)}))}removeDataChannel(e){if(!(e instanceof s.h))return void console.error("channel must be a DataChannelWrapper");let t=this.channellists.indexOf(e);-1!==t&&this.channellists.splice(t,1),this.channelListeners.forEach((t=>{t.DataChannelStatus(e,!1)}))}addMediaChannelController(e){e instanceof d?-1==this.channelListeners.findIndex((t=>t==e))&&this.channelListeners.push(e):console.error("controller must be a MediaChannelController")}rmMediaChannelController(e){let t=this.channelListeners.findIndex((t=>t==e));-1!=t&&this.channelListeners.splice(t,1)}getChannelByTransportType(e){for(let t=0;t<this.channellists.length;t++){let i=this.channellists[t];if(i.isReady()&&i.transportlists.includes(e))return i}return null}reinit(){let e=this.channellists;this.channellists=[],e.forEach((e=>{e.isReady()&&(e.close(),this.channelListeners.forEach((t=>{t.DataChannelStatus(e,!1)})))}))}}(0,o.A)(c,"target",null);var l=i(1758);function h(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;try{const t="undefined"!=typeof DedicatedWorkerGlobalScope;if(a.m3.dataTransportMgr)return;let i=new l.H({type:t?l.H.THREAD_SUB:l.H.THREAD_MAIN,remote:t?self:null});a.m3.dataTransportMgr=i,i.monitorlogfn=e,c.target||(c.target=new c(i),i.addTransportListChangeListener(c.target)),t&&self.addEventListener("message",i._onrecvmainthreadlistener.bind(i))}catch(e){console.error("<<<< InitDataTransportModule",e)}}function u(e,t){try{const i="undefined"!=typeof DedicatedWorkerGlobalScope;if(!a.m3.dataTransportMgr&&!i)return void console.error("not InitDataTransportModule");let r=a.m3.dataTransportMgr;if(t in r.refs)return;let s=r._onrecvsubthreadlistener.bind(r,e);e.addEventListener("message",s);let o={worker:e,type:t,listener:s};r.refs[t]=o,r.checkTransportForThread()}catch(e){console.error("<<<< initTransportWorker",e)}}function p(e){try{const t="undefined"!=typeof DedicatedWorkerGlobalScope;if(!a.m3.dataTransportMgr&&!t)throw new Error("not InitDataTransportModule");let i=a.m3.dataTransportMgr;if(!(e in i.refs))return;let r=i.refs[e],s=r.worker;a.m3.dataTransportMgr.removeTransportByRemote(s),delete i.refs[e],r.worker.removeEventListener("message",r.listener)}catch(e){console.error("<<<< uninitWorker ",e)}}function f(){let e=a.m3.dataTransportMgr;Object.keys(e.refs).forEach((t=>{let i=e.refs[t];delete e.refs[t],i.worker.removeEventListener("message",i.listener)})),e.reinit(),c.target.reinit()}function m(e){return a.m3.dataTransportMgr.getTransportByType(e)}function v(e){if(!a.m3.dataTransportMgr)throw new Error("not InitDataTransportModule");c.target.addDataChannel(e)}function g(e){if(!a.m3.dataTransportMgr)throw new Error("not InitDataTransportModule");c.target.removeDataChannel(e)}class _ extends d{constructor(){super()}register(){if(!a.m3.dataTransportMgr)throw new Error("not InitDataTransportModule");c.target.addMediaChannelController(this)}unRegister(){if(!a.m3.dataTransportMgr)throw new Error("not InitDataTransportModule");c.target.rmMediaChannelController(this)}}class S extends _{constructor(){super()}TransportStatus(e,t,i){t&&this.DataChannelStatus(t,!0)}DataChannelStatus(e,t){let i=e;const{type:o}=e;e.transfered||(t||(i=new s.b(e.type,e.transfered)),o==r.Xt.VIDEO&&this.connectVideoSession(i),o==r.Xt.AUDIO&&this.connectAudioSession(i),o===r.Xt.MESH&&this.connectMeshPort(i))}connectVideoSession(e){let t=new a.Vk,i=m(a.vK.VIDEO_NETRTC)||t,r=(null==e?void 0:e.isReady())?a.tE.OPEN:a.tE.CLOSED;i.setStatus(r),e.onmessage((e=>{var t=new Uint8Array(e.data);i.send(t)})),i.onmessage=t=>{e.send(t)}}connectAudioSession(e){let t=new a.Vk,i=m(a.vK.AUDIO_NETRTC)||t,r=e.isReady()?a.tE.OPEN:a.tE.CLOSED;i.setStatus(r),e.onmessage((e=>{var t=new Uint8Array(e.data);i.send(t)})),i.onmessage=t=>{e.send(t)}}connectMeshPort(e){let t=new a.Vk,i=m(a.vK.MESH_NETRTC)||t,r=e.isReady()?a.tE.OPEN:a.tE.CLOSED;i.setStatus(r),e.onmessage((e=>{var t=new Uint8Array(e.data);i.send(t)})),i.onmessage=t=>{e.send(t)}}}class A extends _{constructor(){super(),this.videodecodeWorker=null,this.sharedecodeWorker=null,this.audiodecodeWorker=null,this.transportLists=[]}TransportListChange(e,t){const i=a.m3.dataTransportMgr;if(e.type==a.vK.MESHBRIDGEAUDIO){var s;const o=null===(s=i.refs[r._c.AUDIO_DECODE])||void 0===s?void 0:s.worker;o&&t&&i.addTransportForTargetThread(e,o),t||i.closeTransportForTargetThread(e)}if(e.type==a.vK.VIDEO_ENCODE||e.type==a.vK.VIDEO_DECODE||e.type==a.vK.SHARE_ENCODE||e.type==a.vK.SHARE_DECODE||e.type==a.vK.AUDIO_DECODE||e.type==a.vK.AUDIO_ENCODE||e.type==a.vK.MAUDIO_DECODE||e.type==a.vK.MSHARE_DECODE||e.type==a.vK.MESHBRIDGE){var o;const s=null===(o=i.refs[r._c.NET])||void 0===o?void 0:o.worker;s&&t&&i.addTransportForTargetThread(e,s),t||i.closeTransportForTargetThread(e)}}}},9710:(e,t,i)=>{"use strict";i.d(t,{Eb:()=>u,Vk:()=>m,cS:()=>p,m3:()=>f,tE:()=>h,vK:()=>c});var r=i(7857),s=i(9549),o=i(4865),a=i(9407),n=i(5061),d=i(1758);const c={AUDIO_ENCODE:4,AUDIO_DECODE:5,MAUDIO_DECODE:7,SHARE_ENCODE:8,SHARE_DECODE:9,MSHARE_DECODE:11,VIDEO_ENCODE:12,VIDEO_DECODE:13,AUDIO_NETRTC:64,VIDEO_NETRTC:128,MESH_NETRTC:256,CUSTOME_TYPE:1<<31,MESHBRIDGEAUDIO:1<<31|1,MESHBRIDGE:1<<31|2},l=e=>{};class h{constructor(){this.onmessage=l,this.status=h.CLOSED,this.onopen=l,this.onclose=l,this.onwer=null}send(e){}delete(){this.onmessage=l,this.onopen=l,this.onclose=l,this.close()}sendVideo(e,t){}sendWasm(e){}sendCommand(e){}open(){this.status=h.OPEN,this.onopen()}close(){this.status=h.CLOSED,this.onclose()}isReady(){return!1}}(0,r.A)(h,"OPEN",1),(0,r.A)(h,"CLOSED",2);class u extends h{constructor(){super({}),this.sab={},this.port=null,this.onmessage=l,this.sender=l,this.videoSender=l,this.reciver=l,this.wasmSender=l,this.oncommand=e=>{}}sendCommand(e){var t;null===(t=this.port)||void 0===t||t.postMessage({cmd:a.q3,data:e})}send(e){this.sender(e)}sendVideo(e,t){this.videoSender(e,t)}sendWasm(e){this.wasmSender(e)}delete(){try{var e,t;this.onmessage=l,this.sender=l,this.videoSender=l,this.reciver=l,this.wasmSender=l;let{consumer:i}=(null===(e=this.sab)||void 0===e?void 0:e.reciver)||{};null==i||i.setDataCallback(l),null==i||i.cancelConsume(),this.sab={},this.port&&(this.port.onmessage=l),null===(t=this.port)||void 0===t||t.close()}catch(e){}}open(){this.status!=h.OPEN||this.onopen()}close(){this.status=h.CLOSED,this.delete(),this.onclose()}_onmessage(e){let{cmd:t,data:i}=e.data;switch(t){case a.F4:this.reciver();break;case a.TE:this.onmessage(i,0);break;case a.nl:this.status=i,this.status==h.OPEN?this.onopen():this.onclose();break;case a.q3:this.oncommand(i)}}createSendAndReceive(){if(!this.port)return;let{sender:e,reciver:t}=this.sab,{sabqueue:i,interval:r}=e||{};i?r?(this.sender=e=>{i.enqueue(e)},this.wasmSender=e=>{i.enqueue(e)},this.videoSender=(e,t)=>{if(!i.enqueueSafe([e,t],!1)){let r=new Uint8Array(t.length+e.length);r.set(e,0),r.set(t,e.length),i.enqueueSafe(r)}}):(this.sender=e=>{i.enqueue(e),this.port.postMessage({cmd:a.F4})},this.wasmSender=e=>{i.enqueue(e),this.port.postMessage({cmd:a.F4})},this.videoSender=(e,t)=>{if(!i.enqueueSafe([e,t],!1)){let r=new Uint8Array(t.length+e.length);r.set(e,0),r.set(t,e.length),i.enqueueSafe(r)}this.port.postMessage({cmd:a.F4})}):(this.sender=e=>{this.port.postMessage({cmd:a.TE,data:e},[e.buffer])},this.wasmSender=e=>{let t=new Uint8Array(e.length);t.set(e,0),this.port.postMessage({cmd:a.TE,data:t},[t.buffer])},this.videoSender=(e,t)=>{let i=new Uint8Array(t.length+e.length);i.set(e,0),i.set(t,e.length),this.port.postMessage({cmd:a.TE,data:i},[i.buffer])});let{sabqueue:n,consumer:d,useCopy:c,interval:l,offset:h}=t||{};if(d&&(d.cancelConsume(),d=null),n){const e=c?e=>{this.onmessage(e,0)}:h?e=>{this.onmessage(e.uint8s,e.begin)}:e=>{this.onmessage(e.uint8s,0)};let i=null,r=f.dataTransportMgr.monitorlogfn;if(l&&r){var u;let e=new s.V_({tag:"WCL_M,VDRB"+(null===(u=this.onwer)||void 0===u?void 0:u.type),interval:1e4,reportcallback:v});i=e.timeoutReport.bind(e)}d=new o.l8(n,e,i),t.consumer=d,l?d.consume(l,c):this.reciver=()=>{d.consumeAll(c)}}}setMsgPort(e){e!=this.port&&(this.port&&(this.port.onmessage=l,this.port.close(),this.port=null),this.port=e,this.port&&(this._listeners||(this._listeners=this._onmessage.bind(this)),this.port.onmessage=this._listeners,this.createSendAndReceive()))}setSabBuffer(e,t){if(null!=e&&e.sab){let{sab:t,useCopy:i,interval:r,offset:s,length:a,useOneElement:n}=e,d=new o.N6(s>0?t.buffer:t,void 0,void 0,!!n,s,a,s>0?t:null);this.sab.sender={sabqueue:d,interval:r,useCopy:i,offset:s}}if(null!=t&&t.sab){var i;let{sab:e,useCopy:r,interval:s,offset:a,length:n,useOneElement:d}=t,c=new o.N6(a>0?e.buffer:e,void 0,void 0,!!d,a,n,a>0?e:null),{consumer:l}=(null===(i=this.sab)||void 0===i?void 0:i.reciver)||{};l&&(l.cancelConsume(),this.sab.reciver.consumer=null,this.sab.reciver.sabqueue=null),this.sab.reciver={sabqueue:c,interval:s,useCopy:r,offset:a}}this.createSendAndReceive()}setStatus(e){this.port?this.status!=e&&(this.status=e,this.port.postMessage({cmd:a.nl,data:e})):console.error("MsgQueueSocket not initialized")}}class p{constructor(){}TransportListChange(e,t){}}class f{constructor(e){this.onmessage=l,this.onopen=l,this.onclose=l,this.oncommand=l,this.type=e.type,this.id=e.id||Math.floor(performance.now())<<10|e.type,this.sock=e.sock||new h,this.mgr=e.mgr,this.sock.onmessage=this._onmessage.bind(this),this.sock.onclose=this._onclose.bind(this),this.sock.onopen=this._onopen.bind(this),this.sock.oncommand=this._oncommand.bind(this),this.sock.onwer=this,this.remote=e.remote,this.sabInfo=null,this.portInfo=null,this.target_thread=n.r.NO_THREAD,this.local=!!e.local,this.args=e.args,this._create()}_create(){let e=f.dataTransportMgr;e.createTransport(this),!this.local&&e&&e.mainThread&&e.type==d.H.THREAD_SUB&&e.createRemoteTransportRPC(this,e.mainThread)}_close(){let e=f.dataTransportMgr;const t=e.transportIsExit(this);!this.local&&t&&e.type==d.H.THREAD_SUB&&e.closeRemoteTransportRPC(this,e.mainThread),t&&e.closeTransport(this)}_oncommand(e){this.oncommand(e)}_onmessage(e,t){this.onmessage(e,t)}_onclose(){this.onclose()}_onopen(){this.onopen()}isReady(){return!0}send(e){this.sock.send(e)}sendCommand(e){this.sock.sendCommand(e)}sendVideo(e,t){this.sock.sendVideo(e,t)}sendWasmData(e){this.sock.sendWasm(e)}setSocket(e){let t=this.sock;this.sock=e,this.sock&&(this.sock.onwer=this,this.sock.onmessage=this._onmessage.bind(this),this.sock.onclose=this._onclose.bind(this),this.sock.onopen=this._onopen.bind(this)),t&&t.delete()}open(){this.sock.open()}close(){this._close(),this.sock.close()}setMsgPort(e){if(!(this.sock instanceof u))throw new Error("tansport sock is not a MsgQueueSocket");this.sock.setMsgPort(e)}setSabBuffer(e,t){if(!(this.sock instanceof u))throw new Error("tansport sock is not a MsgQueueSocket");this.sock.setSabBuffer(e,t)}setStatus(e){this.sock instanceof u&&this.sock.setStatus(e)}}(0,r.A)(f,"UDP",0),(0,r.A)(f,"TCP",1),(0,r.A)(f,"RLB_UDP",2),(0,r.A)(f,"dataTransportMgr",null);class m{constructor(e){this.sock=null,this.onmessage=l}isReady(){return!1}send(){}sendVideo(){}sendCommand(){}setStatus(e){}}function v(e,t,i,r){var s;null===(s=d.H.monitorlogfn)||void 0===s||s.call(d.H,e,"".concat(t,",").concat(i,",").concat(r))}},1758:(e,t,i)=>{"use strict";i.d(t,{H:()=>n});var r=i(7857),s=i(9407),o=i(9710),a=i(5061);class n{constructor(e){let t=e||{};this.type=t.type||n.THREAD_MAIN,this.refs={},this.transportlists=[],this.mainThread=t.remote,this.subthreadlistner=null,this.transportListeners=[],this.onRemoteTransportFn=()=>{}}_onrecvmainthreadlistener(e){let{cmd:t,transportId:i,data:r}=e.data,a=this.transportlists.find((e=>e.id===i));if(a||t==s.rl)switch(t){case s.rl:this.addRemoteTransport(e.data,null);break;case s.SK:a.setMsgPort(r||new o.Vk);break;case s.DT:a.setSabBuffer(e.data.sender,e.data.reciver);break;case s.tO:a.remote=null,this.removeTransport(a)}}_onrecvsubthreadlistener(e,t){let{cmd:i,transportId:r}=t.data,o=this.transportlists.find((e=>e.id===r));switch(i){case s.rl:this.addRemoteTransport(t.data,e);break;case s.DT:this.setSabBufferInfo(o,t.data.sender,t.data.reciver);break;case s.tO:o.remote==e&&(o.remote=null),this.removeTransport(o)}}createTransport(e){this.transportlists.push(e),setTimeout((()=>{this.transportListeners.forEach((t=>{t.TransportListChange(e,!0)}))}),0)}transportIsExit(e){return-1!=this.transportlists.indexOf(e)}closeTransport(e){let t=this.transportlists.indexOf(e);return-1!=t&&(this.transportlists.splice(t,1),setTimeout((()=>{this.transportListeners.forEach((t=>{t.TransportListChange(e,!1)}))}),0),!0)}createRemoteTransportRPC(e,t){let i={cmd:s.rl,transportType:e.type,transportId:e.id};e.portInfo?(i.port=e.portInfo,t.postMessage(i,[e.portInfo])):t.postMessage(i)}closeRemoteTransportRPC(e,t){t.postMessage({cmd:s.tO,transportType:e.type,transportId:e.id})}setRemoteTransportSABBUfferRPC(e,t){var i,r,o,a;(null!==(i=e.sabInfo)&&void 0!==i&&i.sender||null!==(r=e.sabInfo)&&void 0!==r&&r.reciver)&&t.postMessage({cmd:s.DT,transportId:e.id,sender:null===(o=e.sabInfo)||void 0===o?void 0:o.sender,reciver:null===(a=e.sabInfo)||void 0===a?void 0:a.reciver})}addRemoteTransport(e,t){let{transportId:i,port:r,transportType:s}=e,o=this.createMsgSocketTransport(s,i);var a;o.id=i,o.remote=t,o.portInfo=r,r?o.setMsgPort(o.portInfo):this.bindMessageChannel(o),r&&(null===(a=this.onRemoteTransportFn)||void 0===a||a.call(this,o))}removeTransport(e){-1!=this.transportlists.indexOf(e)&&(this.closeTransport(e),e.close(),e.remote&&this.closeRemoteTransportRPC(e,e.remote),this.closeTransportForTargetThread(e))}createMsgSocketTransport(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=null;return i=new o.m3({mgr:this,sock:new o.Eb,type:e,local:!0,id:t}),i}bindMessageChannel(e){if(this.type!=n.THREAD_MAIN)return void console.error("error this call only in main thread");let t=new MessageChannel;e.portInfo=t.port1,e.remote.postMessage({cmd:s.SK,transportId:e.id,data:t.port2},[t.port2])}setSabBufferInfo(e,t,i){this.type==n.THREAD_MAIN&&(e.sabInfo||(e.sabInfo={}),i&&(i.useCopy=!0),t&&(t.useCopy=!0),e.sabInfo={sender:t,reciver:i},e.target_thread!=a.r.NO_THREAD&&(e.target_thread!=a.r.SELF_THREAD?this.setRemoteTransportSABBUfferRPC(e,e.target_thread):e.setSabBuffer(t,i)))}removeTransportByRemote(e){let t=[];for(let i=0;i<this.transportlists.length;i++){let r=this.transportlists[i];r.remote===e&&t.push(r)}for(let e=0;e<t.length;e++)this.removeTransport(t[e])}reinit(){let e=[...this.transportlists];for(let t=0;t<e.length;t++)this.removeTransport(e[t])}getTransportByType(e){for(let t in this.transportlists){let i=this.transportlists[t],r=i.target_thread==a.r.SELF_THREAD;if(i.type==e&&r)return i}return null}addTransportListChangeListener(e){-1==this.transportListeners.indexOf(e)&&this.transportListeners.push(e)}remoteTransportListChangeListener(e){let t=this.transportListeners.indexOf(e);-1!=t&&this.transportListeners.splice(t,1)}checkTransport(e){this.transportlists.forEach((t=>{if(!e.transportlists.includes(t.type))return;let i=e.target_thread||a.r.SELF_THREAD;this.addTransportForTargetThread(t,i)}))}checkTransportForThread(){setTimeout((()=>{this.transportlists.forEach((e=>{this.transportListeners.forEach((t=>{t.TransportListChange(e,!0)}))}))}),0)}addTransportForTargetThread(e,t){const i=t;var r,s,o,d;e.target_thread!=i&&i!=a.r.NO_THREAD&&(this.type==n.THREAD_MAIN&&e.target_thread!=a.r.NO_THREAD&&e.target_thread!=i&&(this.closeTransportForTargetThread(e),this.bindMessageChannel(e)),e.target_thread=i,i!=a.r.SELF_THREAD?(this.createRemoteTransportRPC(e,i),this.setRemoteTransportSABBUfferRPC(e,i)):(e.portInfo&&e.setMsgPort(e.portInfo),(null!==(r=e.sabInfo)&&void 0!==r&&r.sender||null!==(s=e.sabInfo)&&void 0!==s&&s.reciver)&&e.setSabBuffer(null===(o=e.sabInfo)||void 0===o?void 0:o.sender,null===(d=e.sabInfo)||void 0===d?void 0:d.reciver)))}closeTransportForTargetThread(e){e.target_thread!=a.r.NO_THREAD&&e.target_thread!=a.r.SELF_THREAD&&this.type==n.THREAD_MAIN&&this.closeRemoteTransportRPC(e,e.target_thread),e.target_thread=a.r.NO_THREAD}}(0,r.A)(n,"THREAD_MAIN",1),(0,r.A)(n,"THREAD_SUB",2)},3404:(e,t,i)=>{"use strict";i.d(t,{Y:()=>d,q:()=>c});var r=i(2710),s=i(385);const o="audioBridge";class a{constructor(e){this.version=e}getWebRTCConnectivityResult(){const{time:e,result:t}=c.get("".concat(this.version,"Connectivity"))||{};return!1!==t?{time:e,result:!0}:{time:e,result:!1}}updateWebRTCConnectivityResult(e){const t=Date.now();c.set("".concat(this.version,"Connectivity"),{time:t,result:e})}checkWebRTCConnectivity(e,t){const{time:i=0,result:r=!0}=this.getWebRTCConnectivityResult();if(!(r||Date.now()-i<864e5))try{this.version===o?this.checkAudioBridgeConnectivity(e,t):this.checkWMSCConnectivity(e,t)}catch(e){s.Ay.error("error when check webrtc connectivity",e)}}async checkAudioBridgeConnectivity(e,t){let{rwgHost:r,cid:s,abToken:o}=e;const a="wss://".concat(r,"/ab/signal?rwg=").concat(r,"&cid=").concat(s),n=(await Promise.resolve().then(i.bind(i,4666))).default;this.webrtcInstance=new n(s,a,!1,!1,!1,void 0,((e,t)=>{var i;"updateConnectionResult"===e&&(this.updateWebRTCConnectivityResult(t),null===(i=this.webrtcInstance)||void 0===i||i.destroy(),this.webrtcInstance=null)}),!0),this.webrtcInstance.setIceServers(t),this.webrtcInstance.join(!1,o)}async checkWMSCConnectivity(e,t){let{rwgHost:s,cid:o,meetingNumber:a}=e;const{WMSCManager:n}=await i.e(557).then(i.bind(i,7378)),d="wss://".concat(s,"/wc/media/").concat(a,"?type=v&cid=").concat(o,"&mode=16&prob=1");this.webrtcInstance=new n({webRTCWebSocketUrl:d,confId:o,nodeId:0,hdVideoEnabled:!1,mediaStreamController:void 0,iceServers:t,videoCodecConfig:void 0,webrtcMode:r.h|r.Q9,requestHandler:(e,t)=>{this.updateWebRTCConnectivityResult(t),this.webrtcInstance.destroy(),this.webrtcInstance=null},probe:!0})}}class n{constructor(e){this.mediaType=e}getInfo(){try{return JSON.parse(localStorage.getItem("webcodec".concat(this.mediaType)))||{}}catch(e){return{}}}updateInfo(e,t){try{let i=this.getInfo(),{failed:r,total:s}=i.usedcount||{failed:0,total:0},{avgusedtime:o,usedmaxtime:a}=i.usedtime||{avgusedtime:0,usedmaxtime:0},{avgratio:n,maxratio:d}=i.ratio||{avgratio:0,maxratio:0},{avgdelay:c}=i.delay||{avgdelay:0};e.failed&&(r++,o=(3*o+e.elapsed)/4,a=e.elapsed>a?e.elapsed:a,i.usedtime=Object.assign(i.usedtime||{},{usedmaxtime:a,avgusedtime:o})),e.elapsed>31e3&&e.failed||s++,i.usedcount=Object.assign(i.usedcount||{},{failed:r,total:s}),e.outputIndex>3&&(c=(3*c+e.avgDelay)/4,i.delay=Object.assign(i.delay||{},{avgdelay:c})),e.inputIndex>5&&(n=(3*n+e.ratio)/4,d=e.ratio>d?e.ratio:d,i.ratio=Object.assign(i.ratio||{},{avgratio:n,maxratio:d}));let l=t.osVersion,h=t.browserVersion,u=t.sdkVersion;i.version={osVersion:l,browserVersion:h,sdbversion:u},localStorage.setItem("webcodec".concat(this.mediaType),JSON.stringify(i))}catch(e){s.Ay.error("<<< update localStorage error",e)}}}class d{constructor(){this.audioBridgeConnectivityInfo=new a(o),this.WMSCConnectivityInfo=new a("wmsc"),this.videoEncoderInfo=new n("videoencode"),this.videoDecoderInfo=new n("videodecode")}getAudioBridgeConnectivityInfo(){return this.audioBridgeConnectivityInfo}getWMSCConnectivityInfo(){return this.WMSCConnectivityInfo}getVideoEncoderInfo(){return this.videoEncoderInfo}getVideoDecoderInfo(){return this.videoDecoderInfo}}class c{static set(e,t){try{const i=JSON.stringify(t);localStorage.setItem(e,i)}catch(e){console.error("Failed to set localStorage:",e)}}static get(e){try{const t=localStorage.getItem(e);return t?JSON.parse(t):null}catch(e){return console.error("Failed to get localStorage:",e),null}}static remove(e){localStorage.removeItem(e)}static clear(){localStorage.clear()}static has(e){return null!==localStorage.getItem(e)}}},456:(e,t,i)=>{"use strict";function r(){this.a=[],this.b=0,this.residue=null}i.d(t,{A:()=>s}),r.prototype.getLength=function(){return this.a.length-this.b},r.prototype.isEmpty=function(){return 0==this.a.length},r.prototype.enqueue=function(e){this.a.push(e)},r.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},r.prototype.peek=function(){return 0<this.a.length?this.a[this.b]:void 0},r.prototype.clear=function(){this.a=[],this.b=0};const s=r},9407:(e,t,i)=>{"use strict";i.d(t,{$E:()=>S,$U:()=>Ie,$x:()=>G,AC:()=>B,AP:()=>ot,Ah:()=>oe,Bi:()=>R,Bm:()=>I,Cm:()=>re,D1:()=>se,DT:()=>_e,Eu:()=>Ee,F4:()=>ue,Fb:()=>v,Fe:()=>xe,Gg:()=>je,H4:()=>ne,HL:()=>K,HX:()=>ze,Ht:()=>rt,I:()=>u,Ji:()=>m,Jj:()=>Be,Jo:()=>ae,Jw:()=>o,KA:()=>De,KE:()=>Je,Ke:()=>qe,LG:()=>y,Lm:()=>le,M9:()=>$e,N:()=>We,NN:()=>Le,NO:()=>at,Os:()=>ye,Pp:()=>He,QT:()=>Ae,RN:()=>Ve,Rk:()=>O,Rm:()=>N,Rw:()=>p,SG:()=>x,SK:()=>Se,Sh:()=>j,T:()=>H,TE:()=>he,TK:()=>Ge,Tf:()=>tt,U2:()=>Me,UG:()=>ie,Ub:()=>Z,V_:()=>et,Vd:()=>$,Wr:()=>T,XY:()=>Pe,Xb:()=>be,Xd:()=>D,Xg:()=>E,Xk:()=>Q,Y:()=>ee,YQ:()=>C,YS:()=>J,YX:()=>Oe,Yx:()=>me,Zc:()=>V,Zk:()=>ce,_0:()=>ct,_Q:()=>L,aY:()=>Ze,av:()=>M,b5:()=>k,bC:()=>Xe,bq:()=>g,c:()=>a,dh:()=>l,eS:()=>nt,ef:()=>w,ex:()=>r,f9:()=>X,hA:()=>U,hG:()=>de,hd:()=>st,hz:()=>Te,iU:()=>d,jA:()=>it,l6:()=>h,lN:()=>n,my:()=>s,nl:()=>pe,oG:()=>ke,oU:()=>Ke,pJ:()=>Qe,q3:()=>fe,qi:()=>Re,rl:()=>ge,s6:()=>c,s8:()=>Fe,sY:()=>Y,sv:()=>A,t4:()=>Ne,tO:()=>ve,ty:()=>P,uL:()=>we,uP:()=>Ye,uf:()=>W,v7:()=>Ue,vP:()=>q,vr:()=>_,wQ:()=>b,wo:()=>Ce,x8:()=>F,xD:()=>z,xQ:()=>te,yC:()=>dt,zS:()=>f});const r=1,s=2,o=3,a=4,n=7,d=8,c=9,l=10,h=11,u=12,p=14,f=15,m=16,v=18,g=20,_=21,S=22,A=23,y=24,C=26,E=27,b=30,w=31,R=35,T=36,I=37,M=38,D=42,P=47,k=48,O=50,V=51,N=52,x=53,L=56,W=57,U=60,B=61,F=62,H=66.5,G=66.6,j=67,K=68,z=69,q=71,Y=72,X=73,Q=75,J=76,$=78,Z=105,ee=106,te=107,ie=108,re=109,se=120,oe=121,ae=122,ne=123,de=124,ce=125,le=126,he=127,ue=128,pe=129,fe=130,me=131,ve=132,ge=133,_e=135,Se=136,Ae=137,ye=138,Ce=139,Ee=140,be=141,we=151,Re=171,Te=194,Ie=199,Me=200,De=201,Pe=209,ke=202,Oe=203,Ve=204,Ne=205,xe=206,Le=207,We=208,Ue=-1,Be=-2,Fe=-3,He=-4,Ge=-5,je=-7,Ke=-8,ze=-9,qe=-10,Ye=-11,Xe=-12,Qe=-14,Je=-15,$e=-23,Ze=-26,et=-27,tt=-28,it=-35,rt=-36,st=-129,ot=-130,at=-131,nt=-137,dt=49,ct=79},9559:(e,t,i)=>{"use strict";i.d(t,{i1:()=>Ae,uR:()=>ye,cY:()=>he,XF:()=>ae,gP:()=>ue,Yu:()=>ke,uF:()=>oe,SI:()=>Se,_w:()=>Fe,qs:()=>_e,zV:()=>ge,I4:()=>ee,jo:()=>be,nT:()=>He,gd:()=>de,Bw:()=>ne,Gj:()=>Te,mx:()=>Le,bD:()=>fe,Ay:()=>le,VC:()=>Ue,B1:()=>We,kA:()=>ve,jK:()=>xe,B0:()=>Ne,OC:()=>Oe,DR:()=>me,Az:()=>Ve,uE:()=>Ce,Tv:()=>Re,MB:()=>Be,e5:()=>Ee,iD:()=>we,h:()=>Ie,SE:()=>pe,Sq:()=>Pe});var r=i(7026),s=i(7857),o=i(6984),a=i.n(o),n=(i(7855),i(7201)),d=i.n(n),c=function(e,t,i,r){return new(i||(i=Promise))((function(s,o){function a(e){try{d(r.next(e))}catch(e){o(e)}}function n(e){try{d(r.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,n)}d((r=r.apply(e,t||[])).next())}))};let l=function(){};l.prototype={threads:()=>c(void 0,void 0,void 0,(function*(){return e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]),c(void 0,void 0,void 0,(function*(){if(!WebAssembly.validate(e))return!1;try{return(new MessageChannel).port1.postMessage(new SharedArrayBuffer(1)),!0}catch(e){return!1}}));var e})),simd:()=>c(void 0,void 0,void 0,(function*(){return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,9,1,7,0,65,0,253,15,26,11]))}))};const h=new l;var u=i(3578),p=i(385),f=i(2689),m=i(3647),v=i(7080),g=function(e,t,i,r){return new(i||(i=Promise))((function(s,o){function a(e){try{d(r.next(e))}catch(e){o(e)}}function n(e){try{d(r.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,n)}d((r=r.apply(e,t||[])).next())}))};const S=new class{constructor(){this.sentinel=null,this.isSupport=()=>"wakeLock"in navigator&&"request"in navigator.wakeLock,this.requestWakeLock=()=>g(this,void 0,void 0,(function*(){return this.isSupport()?this.sentinel&&!this.sentinel.released?Promise.reject("wakeLock has requested"):(yield this.release(),document.addEventListener("visibilitychange",this.handleVisibilityChange),document.addEventListener("fullscreenchange",this.handleVisibilityChange),this.initWakeLock()):Promise.reject("wakeLock API not available")})),this.release=()=>g(this,void 0,void 0,(function*(){return this.isSupport()?this.sentinel?(document.removeEventListener("visibilitychange",this.handleVisibilityChange),document.removeEventListener("fullscreenchange",this.handleVisibilityChange),this.sentinel.release().then((()=>(this.sentinel=null,"WakeLock release success"))).catch((e=>(p.Ay.error("Error WakeLock release:",e),e)))):"WakeLock not exist":"wakeLock API not available"})),this.handleVisibilityChange=()=>{"visible"===document.visibilityState&&(!this.sentinel||this.sentinel&&this.sentinel.released)&&(this.sentinel=null,this.initWakeLock())},this.initWakeLock=()=>g(this,void 0,void 0,(function*(){try{return this.sentinel=yield navigator.wakeLock.request("screen"),this.sentinel}catch(e){return p.Ay.error("Error WakeLock request:",e),Promise.reject(e)}}))}};var A,y=i(6487),C=i(3404),E=i(5830),b=i(2484);!function(e){e.WEBASSEMBLY="wasm_av",e.WEBRTC_AV_1_0="webrtc_av_1.0",e.WEBRTC_AV_2_0="webrtc_av_2.0"}(A||(A={}));var w=i(2601),R=i.n(w),T=i(5512),I=i.n(T);function M(){return I()('(()=>{var t={2601:(t,r,e)=>{t.exports=e(4444)},3565:(t,r,e)=>{"use strict";var n=e(1960);t.exports=n},2671:(t,r,e)=>{"use strict";e(2344),t.exports=e(5951)},4444:(t,r,e)=>{"use strict";t.exports=e(214)},214:(t,r,e)=>{"use strict";e(397);var n=e(3565);t.exports=n},2159:(t,r,e)=>{"use strict";var n=e(2250),o=e(4640),s=TypeError;t.exports=function(t){if(n(t))return t;throw new s(o(t)+" is not a function")}},6624:(t,r,e)=>{"use strict";var n=e(6285),o=String,s=TypeError;t.exports=function(t){if(n(t))return t;throw new s(o(t)+" is not an object")}},5807:(t,r,e)=>{"use strict";var n=e(1907),o=n({}.toString),s=n("".slice);t.exports=function(t){return s(o(t),8,-1)}},1626:(t,r,e)=>{"use strict";var n=e(9447),o=e(4284),s=e(5817);t.exports=n?function(t,r,e){return o.f(t,r,s(1,e))}:function(t,r,e){return t[r]=e,t}},5817:t=>{"use strict";t.exports=function(t,r){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:r}}},2532:(t,r,e)=>{"use strict";var n=e(5951),o=Object.defineProperty;t.exports=function(t,r){try{o(n,t,{value:r,configurable:!0,writable:!0})}catch(e){n[t]=r}return r}},9447:(t,r,e)=>{"use strict";var n=e(8828);t.exports=!n((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},9552:(t,r,e)=>{"use strict";var n=e(5951),o=e(6285),s=n.document,i=o(s)&&o(s.createElement);t.exports=function(t){return i?s.createElement(t):{}}},6794:(t,r,e)=>{"use strict";var n=e(5951).navigator,o=n&&n.userAgent;t.exports=o?String(o):""},798:(t,r,e)=>{"use strict";var n,o,s=e(5951),i=e(6794),u=s.process,c=s.Deno,a=u&&u.versions||c&&c.version,p=a&&a.v8;p&&(o=(n=p.split("."))[0]>0&&n[0]<4?1:+(n[0]+n[1])),!o&&i&&(!(n=i.match(/Edge\\/(\\d+)/))||n[1]>=74)&&(n=i.match(/Chrome\\/(\\d+)/))&&(o=+n[1]),t.exports=o},1091:(t,r,e)=>{"use strict";var n=e(5951),o=e(6024),s=e(2361),i=e(2250),u=e(3846).f,c=e(7463),a=e(2046),p=e(8311),f=e(1626),l=e(9724);e(6128);var v=function(t){var r=function(e,n,s){if(this instanceof r){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,s)}return o(t,this,arguments)};return r.prototype=t.prototype,r};t.exports=function(t,r){var e,o,y,b,h,d,m,x,g,w=t.target,j=t.global,O=t.stat,S=t.proto,P=j?n:O?n[w]:n[w]&&n[w].prototype,T=j?a:a[w]||f(a,w,{})[w],k=T.prototype;for(b in r)o=!(e=c(j?b:w+(O?".":"#")+b,t.forced))&&P&&l(P,b),d=T[b],o&&(m=t.dontCallGetSet?(g=u(P,b))&&g.value:P[b]),h=o&&m?m:r[b],(e||S||typeof d!=typeof h)&&(x=t.bind&&o?p(h,n):t.wrap&&o?v(h):S&&i(h)?s(h):h,(t.sham||h&&h.sham||d&&d.sham)&&f(x,"sham",!0),f(T,b,x),S&&(l(a,y=w+"Prototype")||f(a,y,{}),f(a[y],b,h),t.real&&k&&(e||!k[b])&&f(k,b,h)))}},8828:t=>{"use strict";t.exports=function(t){try{return!!t()}catch(t){return!0}}},6024:(t,r,e)=>{"use strict";var n=e(1505),o=Function.prototype,s=o.apply,i=o.call;t.exports="object"==typeof Reflect&&Reflect.apply||(n?i.bind(s):function(){return i.apply(s,arguments)})},8311:(t,r,e)=>{"use strict";var n=e(2361),o=e(2159),s=e(1505),i=n(n.bind);t.exports=function(t,r){return o(t),void 0===r?t:s?i(t,r):function(){return t.apply(r,arguments)}}},1505:(t,r,e)=>{"use strict";var n=e(8828);t.exports=!n((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))},3930:(t,r,e)=>{"use strict";var n=e(1505),o=Function.prototype.call;t.exports=n?o.bind(o):function(){return o.apply(o,arguments)}},2361:(t,r,e)=>{"use strict";var n=e(5807),o=e(1907);t.exports=function(t){if("Function"===n(t))return o(t)}},1907:(t,r,e)=>{"use strict";var n=e(1505),o=Function.prototype,s=o.call,i=n&&o.bind.bind(s,s);t.exports=n?i:function(t){return function(){return s.apply(t,arguments)}}},5582:(t,r,e)=>{"use strict";var n=e(2046),o=e(5951),s=e(2250),i=function(t){return s(t)?t:void 0};t.exports=function(t,r){return arguments.length<2?i(n[t])||i(o[t]):n[t]&&n[t][r]||o[t]&&o[t][r]}},9367:(t,r,e)=>{"use strict";var n=e(2159),o=e(7136);t.exports=function(t,r){var e=t[r];return o(e)?void 0:n(e)}},5951:function(t,r,e){"use strict";var n=function(t){return t&&t.Math===Math&&t};t.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof e.g&&e.g)||n("object"==typeof this&&this)||function(){return this}()||Function("return this")()},9724:(t,r,e)=>{"use strict";var n=e(1907),o=e(9298),s=n({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,r){return s(o(t),r)}},3648:(t,r,e)=>{"use strict";var n=e(9447),o=e(8828),s=e(9552);t.exports=!n&&!o((function(){return 7!==Object.defineProperty(s("div"),"a",{get:function(){return 7}}).a}))},6946:(t,r,e)=>{"use strict";var n=e(1907),o=e(8828),s=e(5807),i=Object,u=n("".split);t.exports=o((function(){return!i("z").propertyIsEnumerable(0)}))?function(t){return"String"===s(t)?u(t,""):i(t)}:i},2250:t=>{"use strict";var r="object"==typeof document&&document.all;t.exports=void 0===r&&void 0!==r?function(t){return"function"==typeof t||t===r}:function(t){return"function"==typeof t}},7463:(t,r,e)=>{"use strict";var n=e(8828),o=e(2250),s=/#|\\.prototype\\./,i=function(t,r){var e=c[u(t)];return e===p||e!==a&&(o(r)?n(r):!!r)},u=i.normalize=function(t){return String(t).replace(s,".").toLowerCase()},c=i.data={},a=i.NATIVE="N",p=i.POLYFILL="P";t.exports=i},7136:t=>{"use strict";t.exports=function(t){return null==t}},6285:(t,r,e)=>{"use strict";var n=e(2250);t.exports=function(t){return"object"==typeof t?null!==t:n(t)}},7376:t=>{"use strict";t.exports=!0},5594:(t,r,e)=>{"use strict";var n=e(5582),o=e(2250),s=e(8280),i=e(1175),u=Object;t.exports=i?function(t){return"symbol"==typeof t}:function(t){var r=n("Symbol");return o(r)&&s(r.prototype,u(t))}},4284:(t,r,e)=>{"use strict";var n=e(9447),o=e(3648),s=e(8661),i=e(6624),u=e(470),c=TypeError,a=Object.defineProperty,p=Object.getOwnPropertyDescriptor,f="enumerable",l="configurable",v="writable";r.f=n?s?function(t,r,e){if(i(t),r=u(r),i(e),"function"==typeof t&&"prototype"===r&&"value"in e&&v in e&&!e[v]){var n=p(t,r);n&&n[v]&&(t[r]=e.value,e={configurable:l in e?e[l]:n[l],enumerable:f in e?e[f]:n[f],writable:!1})}return a(t,r,e)}:a:function(t,r,e){if(i(t),r=u(r),i(e),o)try{return a(t,r,e)}catch(t){}if("get"in e||"set"in e)throw new c("Accessors not supported");return"value"in e&&(t[r]=e.value),t}},3846:(t,r,e)=>{"use strict";var n=e(9447),o=e(3930),s=e(2574),i=e(5817),u=e(7374),c=e(470),a=e(9724),p=e(3648),f=Object.getOwnPropertyDescriptor;r.f=n?f:function(t,r){if(t=u(t),r=c(r),p)try{return f(t,r)}catch(t){}if(a(t,r))return i(!o(s.f,t,r),t[r])}},8280:(t,r,e)=>{"use strict";var n=e(1907);t.exports=n({}.isPrototypeOf)},2574:(t,r)=>{"use strict";var e={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,o=n&&!e.call({1:2},1);r.f=o?function(t){var r=n(this,t);return!!r&&r.enumerable}:e},581:(t,r,e)=>{"use strict";var n=e(3930),o=e(2250),s=e(6285),i=TypeError;t.exports=function(t,r){var e,u;if("string"===r&&o(e=t.toString)&&!s(u=n(e,t)))return u;if(o(e=t.valueOf)&&!s(u=n(e,t)))return u;if("string"!==r&&o(e=t.toString)&&!s(u=n(e,t)))return u;throw new i("Can\'t convert object to primitive value")}},2046:t=>{"use strict";t.exports={}},4239:(t,r,e)=>{"use strict";var n=e(7136),o=TypeError;t.exports=function(t){if(n(t))throw new o("Can\'t call method on "+t);return t}},6128:(t,r,e)=>{"use strict";var n=e(7376),o=e(5951),s=e(2532),i="__core-js_shared__",u=t.exports=o[i]||s(i,{});(u.versions||(u.versions=[])).push({version:"3.39.0",mode:n?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE",source:"https://github.com/zloirock/core-js"})},5816:(t,r,e)=>{"use strict";var n=e(6128);t.exports=function(t,r){return n[t]||(n[t]=r||{})}},9846:(t,r,e)=>{"use strict";var n=e(798),o=e(8828),s=e(5951).String;t.exports=!!Object.getOwnPropertySymbols&&!o((function(){var t=Symbol("symbol detection");return!s(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&n&&n<41}))},7374:(t,r,e)=>{"use strict";var n=e(6946),o=e(4239);t.exports=function(t){return n(o(t))}},9298:(t,r,e)=>{"use strict";var n=e(4239),o=Object;t.exports=function(t){return o(n(t))}},6028:(t,r,e)=>{"use strict";var n=e(3930),o=e(6285),s=e(5594),i=e(9367),u=e(581),c=e(6264),a=TypeError,p=c("toPrimitive");t.exports=function(t,r){if(!o(t)||s(t))return t;var e,c=i(t,p);if(c){if(void 0===r&&(r="default"),e=n(c,t,r),!o(e)||s(e))return e;throw new a("Can\'t convert object to primitive value")}return void 0===r&&(r="number"),u(t,r)}},470:(t,r,e)=>{"use strict";var n=e(6028),o=e(5594);t.exports=function(t){var r=n(t,"string");return o(r)?r:r+""}},4640:t=>{"use strict";var r=String;t.exports=function(t){try{return r(t)}catch(t){return"Object"}}},6499:(t,r,e)=>{"use strict";var n=e(1907),o=0,s=Math.random(),i=n(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+i(++o+s,36)}},1175:(t,r,e)=>{"use strict";var n=e(9846);t.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},8661:(t,r,e)=>{"use strict";var n=e(9447),o=e(8828);t.exports=n&&o((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},6264:(t,r,e)=>{"use strict";var n=e(5951),o=e(5816),s=e(9724),i=e(6499),u=e(9846),c=e(1175),a=n.Symbol,p=o("wks"),f=c?a.for||a:a&&a.withoutSetter||i;t.exports=function(t){return s(p,t)||(p[t]=u&&s(a,t)?a[t]:f("Symbol."+t)),p[t]}},2344:(t,r,e)=>{"use strict";var n=e(1091),o=e(5951);n({global:!0,forced:o.globalThis!==o},{globalThis:o})},397:(t,r,e)=>{"use strict";e(2344)},1960:(t,r,e)=>{"use strict";var n=e(2671);t.exports=n}},r={};function e(n){var o=r[n];if(void 0!==o)return o.exports;var s=r[n]={exports:{}};return t[n].call(s.exports,s,s.exports,e),s.exports}e.n=t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},e.d=(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),e.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r),(()=>{"use strict";var t=e(2601),r=e.n(t);r().onmessage=async function(){try{const t=await async function(){let t={};return t.supportVideoFrameInWorker="function"==typeof r().VideoFrame,t.supportVideoTrackGeneratorInWorker="function"==typeof r().VideoTrackGenerator,t.supportOffscreenCanvasInWorker="function"==typeof r().OffscreenCanvas,t.supportImageBitmapRenderingInWorker="function"==typeof r().ImageBitmapRenderingContext,t.supportTransferableTrackAcrossWork=(()=>{if("function"!=typeof r().VideoTrackGenerator)return!1;try{const t=(new VideoTrackGenerator).track;return(new MessageChannel).port1.postMessage(t,[t]),!0}catch(t){return!1}})(),t.supportsRequestAnimationFrameInWork="function"==typeof requestAnimationFrame,t.supportMediaStreamTrackProcessor="function"==typeof MediaStreamTrackProcessor,t}();self.postMessage({result:t}),self.close()}catch(t){self.postMessage({error:t.message}),self.close()}}})()})();\n',"Worker",{name:"zoom-helper"},void 0)}var D=i(879),P=i(559),k=i(3656),O=i(2710),V=i(6654),N=i(9482),x=i(4468),L=i(8935),W=i(9470),U=i(9415),B=i(1223),F=i(4895),H=i(5980);const G=["deviceId"],j=["deviceId"];function K(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,r)}return i}function z(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?K(Object(i),!0).forEach((function(t){(0,s.A)(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):K(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}const q={};let Y,X=!1,Q=!1;const J={[N._c.VIDEO_ENCODE]:{memory:null,used:!1},[N._c.VIDEO_DECODE]:{memory:null,used:!1}};let $=(0,W.cO)();const Z=new class{constructor(){(0,s.A)(this,"_remoteCapabilitiesDescPromise",null)}_testSupportTransferableStream(){try{const{writable:e}=new TransformStream;return(new MessageChannel).port1.postMessage(e,[e]),!0}catch(e){return!1}}_testSupportDrawWatermark(){try{if("function"==typeof OffscreenCanvas&&OffscreenCanvasRenderingContext2D&&!OffscreenCanvasRenderingContext2D.prototype.measureText)return!0}catch(e){return!1}}analyzeMainCapabilites(){let e={};try{e.supportGraphicsAcceleration=!le.getGpuInfo().isWebGLContextInvalid&&!le.isUsingSwiftShader()}catch(e){}return e.supportVideoFrame="function"==typeof R().VideoFrame,e.supportMediaStreamTrackGenerator="function"==typeof R().MediaStreamTrackGenerator,e.supportTransferableStream=this._testSupportTransferableStream(),e.supportDrawWatermark=this._testSupportDrawWatermark(),e}_analyzeInWorker(){return new Promise(((e,t)=>{const i=new M;i.onmessage=i=>{const{result:r,error:s}=i.data;s?t(new Error(s)):e(r)},i.onerror=e=>{t(e)},i.postMessage({})}))}analyzeRemoteCapabilities(){return this._remoteCapabilitiesDescPromise||(this._remoteCapabilitiesDescPromise=new Promise(((e,t)=>{this._analyzeInWorker().then((t=>{e(t)})).catch((e=>{t(e)}))}))),this._remoteCapabilitiesDescPromise}},ee=new class{constructor(){this._isSupportMultiThread=!1,this._isSupportSIMD=!1,this.inProgressPromise={checkSupportMultiThread:null,checkSupportSIMD:null},this._isSupportWebtransport=!1,this._isSupportVirtualBackground=!1,this._isTransferableMediaStreamTrackEnabled=!1,this._isSupportTransferableMediaStreamTrack=null}async checkIsSupportMultiThread(){if(!this.getIsSupportMultiThread())try{this.inProgressPromise.checkSupportMultiThread?await this.inProgressPromise.checkSupportMultiThread:(this.inProgressPromise.checkSupportMultiThread=h.threads(),this._setIsSupportMultiThread(await this.inProgressPromise.checkSupportMultiThread))}catch(e){this._setIsSupportMultiThread(!1)}}_setIsSupportMultiThread(e){this._isSupportMultiThread=e}getIsSupportMultiThread(){return this._isSupportMultiThread}async checkIsSupportSIMD(){if(!this.getIsSupportSIMD())try{this.inProgressPromise.checkSupportSIMD?await this.inProgressPromise.checkSupportSIMD:(this.inProgressPromise.checkSupportSIMD=h.simd(),this._setIsSupportSIMD(await this.inProgressPromise.checkSupportSIMD))}catch(e){this._setIsSupportSIMD(!1)}}_setIsSupportSIMD(e){this._isSupportSIMD=e}getIsSupportSIMD(){return this._isSupportSIMD}getIsSupportWebtransport(){return(0,W.LZ)(97)&&"function"==typeof WebTransport&&this._isSupportWebtransport}setIsSupportWebtransport(e){this._isSupportWebtransport=!!e}getIsSupportVirtualBackground(){const e=(0,W.LZ)(91)||(0,W.i$)(89)||(0,W.b2)(17.4);return navigator.hardwareConcurrency&&navigator.hardwareConcurrency>2&&e&&"function"==typeof OffscreenCanvas&&this._isSupportVirtualBackground}setIsSupportVirtualBackground(e){this._isSupportVirtualBackground=!!e}getIsRenderSelfVideoInEncodeWorker(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return!f.A.enableMultiDecodeVideoWithoutSAB&&e&&!this.getIsSupportMultiThread()&&this.getIsSupportVirtualBackground()}setIsTransferableMediaStreamTrackEnabled(e){this._isTransferableMediaStreamTrackEnabled=!!e}getIsSupportTransferableMediaStreamTrack(e){if(!this._isTransferableMediaStreamTrackEnabled&&!E.A.read(e,b.n.ENABLE_TRANSFERABLE_MEDIA_STREAM_TRACK.index,1,b.n.ENABLE_TRANSFERABLE_MEDIA_STREAM_TRACK.default))return!1;if(!ce.isAppleBrowserVersionHigherThan("18.5"))return!1;if(null===this._isSupportTransferableMediaStreamTrack)try{D.f.supportTransferableTrackAcrossWork(),this._isSupportTransferableMediaStreamTrack=!0}catch(e){this._isSupportTransferableMediaStreamTrack=!1}return this._isSupportTransferableMediaStreamTrack}};var te={capacity:void 0,capacity1080:!0,get capacityfor720(){return void 0!==this.capacity&&this.capacity},set capacityfor720(e){this.capacity=e},get capacityfor1080(){return void 0!==this.capacity1080&&this.capacity1080},set capacityfor1080(e){this.capacity1080=e}},ie={capacitydeco:void 0,get capacitydecofor1080(){return void 0!==this.capacitydeco&&this.capacitydeco},set capacitydecofor1080(e){this.capacitydeco=e}};const re=function(){if("function"!=typeof OffscreenCanvas)return!1;let e={isSupportWebgl:!1,isSupportWebgl2:!1};try{const t=new OffscreenCanvas(1,1);(t.getContext("webgl")||t.getContext("experimental-webgl")||t.getContext("moz-webgl")||t.getContext("webkit-3d"))&&(e.isSupportWebgl=!0)}catch(e){p.Ay.error("Error while get webglcontext:",e)}try{e.isSupportWebgl&&new OffscreenCanvas(1,1).getContext("webgl2")&&(e.isSupportWebgl2=!0)}catch(e){p.Ay.error("Error while get webglcontext2:",e)}return e}();var se=function(){let e=Object.assign({},re,L.hU.attrs);return e.cpu=navigator.hardwareConcurrency?navigator.hardwareConcurrency:0,e.VE=0,e.SE=0,e.VD=0,e.SD=0,e.SAB="undefined"!=typeof SharedArrayBuffer,e.errorMessage=null,e.visibility=!0,e.unvisibilitycount=0,e.time=0,e}();function oe(){return re.isSupportWebgl}function ae(e){return e?e>>10<<10:-1}function ne(){return de("Main",ce.getAudioContextConfigure())}function de(e){let t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return"function"!=typeof AudioContext?(p.Ay.error("Not Support AudioContext"),null):(p.Ay.log("Creating ".concat(e," AudioContext")),t=i?new AudioContext(i):new AudioContext,v.A.add_monitor("ACSC:Creating ".concat(e,":").concat(t.state)),t.onstatechange=()=>{p.Ay.log("".concat(e," AudioContext state changed to ").concat(t.state)),v.A.add_monitor("ACSC:".concat(e,":").concat(t.state))},t.onsinkchange=()=>{"object"==typeof t.sinkId&&"none"===t.sinkId.type?p.Ay.log("".concat(e," AudioContext - Audio changed to not play on any device")):p.Ay.log("".concat(e," AudioContext - Audio output device changed to ").concat(t.sinkId))},t)}const ce={async initAsyncJob(){try{var e,t,i,r,s,o;const a=await(0,L.U4)(),n=(null==a||null===(e=a.browser)||void 0===e?void 0:e.name)||"unknown",d=(null==a||null===(t=a.browser)||void 0===t?void 0:t.version)||"unknown";p.Ay.directReport("UAHBNV:".concat(d,"|").concat(n,",enableUAHelperHighAccurate success: ").concat(JSON.stringify(a))),v.A.add_monitor("UAHD:".concat(we(JSON.stringify(a)))),this.browserEngine={name:null==a||null===(i=a.engine)||void 0===i?void 0:i.name,version:null==a||null===(r=a.engine)||void 0===r?void 0:r.version,isBlink:"Blink"===(null==a||null===(s=a.engine)||void 0===s?void 0:s.name),isWebkit:"WebKit"===(null==a||null===(o=a.engine)||void 0===o?void 0:o.name)}}catch(e){p.Ay.error("enableUAHelperHighAccurate fail:",e)}try{Object.keys(L.hU.errorMsg).filter((e=>!!L.hU.errorMsg[e])).forEach((e=>{"catchError"===e?p.Ay.error("Error while get webgl context",L.hU.errorMsg[e]):p.Ay.error(L.hU.errorMsg[e])}))}catch(e){p.Ay.error("check Canvas_Render_Info fail:",e)}$=(0,W.cO)(),await ee.checkIsSupportMultiThread(),await D.f.analyze(Z);const a=await ce.IsSupportVideoDecodeHardwareAcceleration();B.A.setSubscribeContrlMode(a),Q=!!await this.is32bitChrome();try{Y=(0,L.Zs)()?await this.getBandWidth():null}catch(e){Y=null}},getOSInfo:()=>(0,W.PF)(),getGpuInfo:()=>L.hU.attrs,isUsingSwiftShader:()=>/SwiftShader/i.test(ce.getGpuInfo().renderInfo),isAndroidIntegrationWithSAB:()=>((0,L.vb)()||(0,L.GY)())&&"undefined"!=typeof SharedArrayBuffer,browserType:$,browser:{isFirefox:"firefox"===$.browser,isChromeOrEdge:"chrome"===$.browser||"edge"===$.browser,isSafari:"safari"===$.browser},browserEngine:{name:"",version:"",isBlink:!1,isWebkit:!1},isChromiumVersionHigherThan(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:90;return(0,W.LZ)(e)||this.browserEngine.isBlink&&(0,L.D$)(this.browserEngine.version,String(e))},isAppleBrowserVersionHigherThan(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"17.5";if(!this.browserEngine.isWebkit)return!1;if((0,L.nr)())return this.isSafariVersionHigherThan(e);{const{osVersion:t=""}=(0,W.PF)();return(0,L.D$)(t,e)}},isIphoneOrIpadSafari(){return this.isIphoneOrIpadBrowser()||this.isIpadOS()},isOpera65(){try{var e=navigator.userAgent.match(/OPR\/(\d+)\./);return!!(e&&Number(e[1])<66)}catch(e){return!1}},isOperaVersionHigherThan(e){try{var t=navigator.userAgent.match(/OPR\/(\d+)\./);return!!(t&&Number(t[1])>=e)}catch(e){return!1}},isOpera:L.GQ,isAndroidBrowser:()=>(0,L.GN)(),isAndroidVersionLessEqual(e){const{osVersion:t=""}=(0,W.PF)();if(!this.isAndroidBrowser()||!t)return!1;const i=t.toString().split(".");return parseInt(i[0])<=e},isQuestBrowser:L.Z_,isMacIntelSafari:L.Qf,isMacIntelChrome:L.gi,isIphoneBrowser:L.uw,isIphoneOrIpadBrowser:L.n_,isIpadOS:L.zG,isIpadOSNew:()=>navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&(/iPad/.test(navigator.platform)||/MacIntel/.test(navigator.platform)||/Intel Mac/.test(navigator.platform)),isChromeOS:L.Zs,isWindowsChrome:L.Y9,isTeslaMode:L.bw,isMac:L.cX,isWindows:L.uF,isLinux:L.j9,isMTRAndroid:L.vb,isGoogleMeetAndroid:L.GY,isMTRWindows:L.pb,is32bitChrome:L.R_,isChromeVersionHigherThan:W.LZ,isFirefoxVersionHigherThan:W.i$,isSafariVersionHigherThan:W.b2,getBrowserVersion:W.JF,isMobileDevice:L.Xb,isSupport2DCanvasDrawFrame(){return"function"==typeof MediaStreamTrackProcessor&&this.browser.isChromeOrEdge&&$.version>=104&&-1==navigator.appVersion.indexOf("Mac")},checkLocalP2PConnection:()=>new Promise((async(e,t)=>{function i(e){return new Promise(((t,i)=>{e.onconnectionstatechange=i=>{"connected"===e.connectionState&&t(!0)}}))}function r(e){e&&e.close()}let s,o,a=null,n=null,d=document.createElement("canvas");try{d.width=200,d.height=200,d.getContext("2d");let t=d.captureStream();if("function"!=typeof RTCPeerConnection)return void e(!1);if(a=new RTCPeerConnection,n=new RTCPeerConnection,a.onicecandidate=e=>{e.candidate&&n.addIceCandidate(new RTCIceCandidate(e.candidate))},n.onicecandidate=e=>{e.candidate&&a.addIceCandidate(new RTCIceCandidate(e.candidate))},Promise.all([i(a),i(n)]).then((()=>{e(!0),r(a),r(n)})),"function"!=typeof a.addStream)return void e(!1);await a.addStream(t),s=await a.createOffer(),await a.setLocalDescription(s),await n.setRemoteDescription(s),o=await n.createAnswer(),await n.setLocalDescription(o),await a.setRemoteDescription(o),setTimeout((()=>{e(!1),r(a),r(n)}),200)}catch(t){p.Ay.error("Error when trying to check for local RTC peer connection",t),e(!1)}})),getDocumentHandle:e=>document.getElementById(e),isSupportVideoFrame:()=>"undefined"!=typeof VideoFrame,isMobileSafariSupportVideoFrame(){return(this.isIphoneOrIpadBrowser()||this.isIpadOS()&&f.A.rwgAgent)&&this.isSupportVideoFrame()},isSelfPreviewRenderWithVideo(){return!f.A.hasWatermark&&(!!this.isMobileSafariSupportVideoFrame()||!ee.getIsSupportMultiThread()&&!ee.getIsSupportVirtualBackground()&&this.isSupportVideoFrameOrBitmapCapture()||this.isAndroidBrowser()&&!this.isAndroidIntegrationWithSAB())},isSupportNewWaitRoomFlow:()=>!0,isSupportChromeWideAEC(e){const t=!!E.A.read(e,10,1)&&this.isChromeOS()&&(0,W.LZ)(116);return(this.isMac()||this.isWindows()||this.isLinux())&&(0,W.LZ)(111)||t||f.A.isGoogleMeetMode},isSupportOpenMicWhenShareAudio(e){return this.isSupportChromeWideAEC(e)&&!f.A.shareSystemAudio},getAudioFeatureFlags:e=>e?4:12,isSupportShareMultiStream:()=>!0,isSupportVideoLTR:()=>!0,isSupportAudioBridgeAvsync:()=>!0,getAudioContextConfigure(){let e={};return(this.isChromiumVersionHigherThan(74)||this.isSafariVersionHigherThan(14.1))&&(e={sampleRate:48e3,latencyHint:.02}),e},download(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(q[e])return q[e];let i=new Promise((async(i,r)=>{let s={};t&&(s.integrity=t);for(let t=0;t<3;t++)try{let o=await(0,V.A)(e,s);if(null!=o&&o.ok){i(o.text()),t>0&&p.Ay.error("after ".concat(t," retry download js ").concat(e," successed "));break}2==t&&r("download failed ".concat(e," ").concat(null==o?void 0:o.status))}catch(e){2==t&&r(e)}}));return q[e]=i,i},async downloadAndCompileWebAssembly(e,t,i){let r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const s="".concat(e).concat(r);if(q[s])return q[s];let o=new Promise((async(s,o)=>{let a=null;i.add_monitor("CS".concat(t));for(let o=0;o<3;o++){try{if(r)a=await WebAssembly.compileStreaming((0,V.A)(e,{priority:"high"}));else{const t=await(0,V.A)(e,{priority:"high"});a=await t.arrayBuffer()}i.add_monitor("CE".concat(t))}catch(s){if("TypeError"===s.name)try{const t=await(0,V.A)(e,{priority:"high"}),i=await t.arrayBuffer();a=await WebAssembly.compile(i)}catch(s){2==o&&(i.add_monitor("".concat(r?"CF":"FF").concat(t)),p.Ay.error("Failed to download WASM file using compile: ".concat(e," for worker type: ").concat(t),s))}else 2==o&&p.Ay.error("Failed to download WASM file using ".concat(r?"compileStreaming":"fetch",": ").concat(e," for worker type: ").concat(t),s)}if(a)return s(a),void(o>0&&p.Ay.error("after ".concat(o," retry download wasm ").concat(e," successed ")))}o(new Error("Unable to download and compile WASM file: ".concat(e," for worker type: ").concat(t)))}));return q[s]=o,o},readBlob:e=>new Promise(((t,i)=>{var r=new FileReader;r.onload=function(){t(r.result)},r.readAsText(e)})),readBlobAsBuffer:e=>new Promise(((t,i)=>{var r=new FileReader;r.onload=function(e){t(e.target.result)},r.readAsArrayBuffer(e)})),lengthInUtf8Bytes(e){var t=encodeURIComponent(e).match(/%[89ABab]/g);return e.length+(t?t.length:0)},isLittleEndian(){let e=new ArrayBuffer(2),t=new Uint8Array(e),i=new Uint16Array(e);return t[0]=170,t[1]=187,48042===i[0]},sleep:e=>new Promise(((t,i)=>{setTimeout((()=>{t(!0)}),e)})),isSDKSupportMultiThread:async()=>(await ee.checkIsSupportMultiThread(),ee.getIsSupportMultiThread()),isAMDGraphic(){try{return this.graphicName.includes("amd")}catch(e){return!1}},graphicName:L.hU.attrs.renderInfo,graphicvendorname:L.hU.attrs.vendor,isGraphicShouldUseHardwareAccelerationDecode(){return!!X||!(!this.isAMDGraphic()||!this.isChromeOS())||!(this.isAMDGraphic()&&!this.isChromeOS())},VP9MachineDetect(){const e=navigator.mediaCapabilities.decodingInfo({type:"webrtc",video:{contentType:"video/vp9",bitrate:1e7,framerate:25,height:1920,width:1080}});return new Promise(((t,i)=>{e.then((e=>{e.supported||(p.Ay.log("video/vp9 codec isn't supported in software or hardware"),t(!1)),t(e.powerEfficient)})).catch((e=>{p.Ay.warn("Error when trying to determine support for VP9 codec",e),t(!1)}))}))},async IsSupportVideoDecodeHardwareAcceleration(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(X)return!0;if("function"!=typeof VideoDecoder||this.browser.isSafari&&!this.isAppleBrowserVersionHigherThan("17.5"))return!1;var t={codec:"avc1.640028",description:new Uint8Array([1,100,0,31,255,225,0,14,103,100,0,51,172,27,26,17,129,64,22,201,160,16,7,0,5,104,200,66,60,48,0,5,104,82,16,207,12,0,25,104,114,16,143,24,67,17,132,56,140,84,81,8,18,22,41,3,194,98,3,5,32,122,9,140,0,5,104,36,132,51,203,0,5,104,46,132,51,195,0,25,104,54,132,35,198,16,196,97,14,35,21,20,66,4,133,138,64,240,152,128,193,72,30,130,99,0,5,104,62,132,51,203]),codedWidth:1280,codedHeight:720,optimizeForLatency:!0,hardwareAcceleration:e?"no-preference":"prefer-hardware"};try{return!!(await VideoDecoder.isConfigSupported(t)).supported}catch(e){return!1}},async IsSupportVideoEncodeHardwareAcceleration(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:O.gg[0];if(X)return!0;if("function"!=typeof VideoEncoder||this.browser.isSafari&&!this.isAppleBrowserVersionHigherThan("17.5"))return!1;{let t=z(z({},{bitrate:15e5,width:1280,height:720,avc:{format:"annexb"},framerate:25,hardwareAcceleration:"no-preference",latencyMode:"realtime"}),e);return(await VideoEncoder.isConfigSupported(t)).supported}},isVideoEncoderPreconditionMatched(){return"function"==typeof VideoEncoder&&(!this.browser.isSafari||(0,W.b2)("17.5"))},isVideoDecoderPreconditionMatched(){return"function"==typeof VideoDecoder&&(!this.browser.isSafari||(0,W.b2)("17.5"))},AdapterWhiteListCheckForEncoder(){if(!oe())return-1;try{var e=L.hU.attrs.renderInfo,t=L.hU.attrs.vendor,i=e.toLowerCase(),r=t.includes("ARM"),s=(i.includes("amd"),i.includes("intel"));return i.includes("hd graphics"),i.includes("nvidia"),i.includes("geforce"),s?0:r?-1:0}catch(e){return 0}},async isSDKSupportSIMD(){if("object"!=typeof WebAssembly)return!1;if(this.browser.isChromeOrEdge){if(!($.version>=84))return!1;await ee.checkIsSupportSIMD()}else await ee.checkIsSupportSIMD();return ee.getIsSupportSIMD()},buffer2stringSplitByComma:e=>new Uint8Array(e).join(","),stringSplitByComma2Buffer(e){try{let t=e.split(",").map((e=>parseInt(e))),i=new ArrayBuffer(t.length),r=new Uint8Array(i);for(let e=0;e<t.length;e++)r[e]=t[e];return i}catch(e){return null}},removeDuplicates(e,t){let i=[];return e.forEach((e=>{let r=!1;for(let s=0;s<i.length;s++)if(!t.call(null,i[s],e)){r=!0;break}r||i.push(e)})),i},getIOSMajorVersion(){if(/iP(hone|od|ad)/.test(navigator.platform)){let e=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return parseInt(e[1],10)}return null},getMacSafariMajorVersion(){if(this.browser.isSafari){const e=navigator.userAgent.match(/Version\/([\d.]+)/);return e&&e[1]?parseFloat(e[1]):null}return null},isSupportDefaultDeviceId:()=>navigator.webkitGetUserMedia&&!(0,L.vk)()&&!(0,L.zX)(),getAudioConfigFromUserAgent(e){if(!(0,L.bw)())return!0;const t=new RegExp(" ".concat(e,":(\\d)")).exec(navigator.userAgent);return!t||!t[1]||"1"!==t[1]},isSupportAudioAGC(){return this.getAudioConfigFromUserAgent("agc")&&(!(0,L.vb)()||!(0,L.oI)())},isSupportAudioAEC(){return this.getAudioConfigFromUserAgent("aec")&&(!(0,L.vb)()||!(0,L.oI)())},isSupportAudioNS(){return!C.q.get("disableNS")&&this.getAudioConfigFromUserAgent("ns")&&(!(0,L.vb)()||!(0,L.oI)())},isSupportImageCapture:()=>!1,isSupportOffscreenCanvas:()=>oe(),isSupport2dOffscreenCanvas:()=>"function"==typeof OffscreenCanvas,isSupportVideoTrackReader:()=>!1,isSupportMediaStreamTrackProcessor:function(e){return("function"==typeof MediaStreamTrackProcessor||D.f.supportMediaStreamTrackProcessor()&&ee.getIsSupportTransferableMediaStreamTrack(e))&&(oe()||(0,U.B)().config.canUseSsrcStream())},isSupportVideoFrameOrBitmapCapture(){return this.isSupportMediaStreamTrackProcessor()},isSupportSharedArrayBuffer:()=>"undefined"!=typeof SharedArrayBuffer,async queryPTZPermisson(){try{return"granted"==(await navigator.permissions.query({name:"camera",panTiltZoom:!0})).state}catch(e){return p.Ay.error("Error when querying pan-tilt-zoom permission",e),!1}},isSupportCameraPan(){var e,t;return!(null===(e=navigator.mediaDevices)||void 0===e||null===(t=e.getSupportedConstraints)||void 0===t||null===(t=t.call(e))||void 0===t||!t.pan)},isSupportCameraTilt(){var e,t;return!(null===(e=navigator.mediaDevices)||void 0===e||null===(t=e.getSupportedConstraints)||void 0===t||null===(t=t.call(e))||void 0===t||!t.tilt)},isSupportCameraZoom(){var e,t;return!(null===(e=navigator.mediaDevices)||void 0===e||null===(t=e.getSupportedConstraints)||void 0===t||null===(t=t.call(e))||void 0===t||!t.zoom)},isSupportPTZ(){var e,t;const i=null===(e=navigator.mediaDevices)||void 0===e||null===(t=e.getSupportedConstraints)||void 0===t?void 0:t.call(e);return i&&i.pan&&i.tilt&&i.zoom},get720pcapacity:()=>te.capacityfor720,set720pcapacity(e){te.capacityfor720=e},get1080pcapacity:()=>te.capacity1080,set1080pcapacity(e){te.capacity1080=e},isSupportBrowserWebRTC:()=>!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia&&window.RTCPeerConnection),getsub1080pcapacity:()=>ie.capacitydecofor1080,setsub1080pcapacity(e){ie.capacitydecofor1080=e},isSupportMultiViewAPI(){var e;return(oe()||(0,U.B)().config.configDone()&&(0,U.B)().config.canUseSsrcStream())&&(null===(e=navigator)||void 0===e?void 0:e.hardwareConcurrency)>=2&&"function"==typeof requestAnimationFrame&&"function"==typeof SharedArrayBuffer},getMaxCountRender(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return void 0===t||void 0===i||t||this.isSupportMultiViewAPI()?(0,L.HR)()?1:null!==(e=navigator)&&void 0!==e&&e.hardwareConcurrency?navigator.hardwareConcurrency<4||(0,L.Xb)()?9:25:1:"object"==typeof i&&null!=i&&i.disableRenderLimits?25:"boolean"==typeof i&&i?4:1},checkAudioAutoPlay:()=>new Promise(((e,t)=>{let i=null,r=new ArrayBuffer(684),s=new Uint32Array(r);s.set([1179011410,676,1163280727,544501094,16,65539,16e3,64e3,2097156,1635017060,640],0);let o=new Blob([s],{type:"audio/wav"}),n=a().createObjectURL(o),d=new Audio(n);d.addEventListener("canplaythrough",(()=>{d.play().then((()=>{e(!0)})).catch((e=>{p.Ay.error("Unable to auto play audio",e),t(e)})).finally((()=>{a().revokeObjectURL(n),document.removeEventListener("visibilitychange",c),i&&(clearTimeout(i),i=null)}))})),d.load&&d.load();const c=()=>{"visible"===document.visibilityState?i=setTimeout((()=>{p.Ay.error("checkAudioAutoPlay did not complete within 5 second while the page was in the foreground"),document.removeEventListener("visibilitychange",c),i=null}),5e3):i&&(clearTimeout(i),i=null)};c(),document.addEventListener("visibilitychange",c)})),isSupportSendVideoFullHD(e){return!(navigator.hardwareConcurrency<8||!this.isSupportVideoShareSend()||!E.A.read(e,b.n.SEND_1080P_VIDEO.index,1))},isSupportSendVideoShareFullHD(e){return!(navigator.hardwareConcurrency<8||!this.isSupportVideoShareSend()||!E.A.read(e,b.n.SEND_1080P_VIDEO_SHARE.index,1))},isSupportVideoShare:()=>!0,hwEncConfigReported:!1,canReportHWEncConfig(){return!this.hwEncConfigReported},didReportHWEncConfig(){this.hwEncConfigReported=!0},isSupportVideoShareSend(){let e;return(0,W.cO)(),this.browser.isChromeOrEdge&&(e=this.getBrowserVersion()),!!this.isSupportSharedArrayBuffer()&&!(!this.browser.isChromeOrEdge||e&&e<=100||navigator.hardwareConcurrency<=2||this.isTeslaMode()||this.isAndroidBrowser()&&!this.isAndroidIntegrationWithSAB()||this.isIphoneOrIpadBrowser())},isSupportVideoShareReceive:()=>!0,getOption(e,t,i){try{let r=e.length;if(t>r)return 0;let s=e.slice(r-t-i+1,r-t+1);if(s)return parseInt(s,16)}catch(e){}return 0},async isSupportWebGPURender(e){const t=this.parseGPUBlacklist(e);return await this.evaluateRendererType(!0,!0,!1,t)==m.h3.WEBGPU},getMachineCapability(){var e,t,i,r,s,o,a;return se.VE=null===f.A||void 0===f.A||null===(e=f.A.localVideoPara)||void 0===e||null===(e=e.VE)||void 0===e?void 0:e.buffer.byteLength,se.VD=null===f.A||void 0===f.A||null===(t=f.A.localVideoPara)||void 0===t||null===(t=t.VD)||void 0===t?void 0:t.buffer.byteLength,se.SE=null===f.A||void 0===f.A||null===(i=f.A.localVideoPara)||void 0===i||null===(i=i.SE)||void 0===i?void 0:i.buffer.byteLength,se.SD=null===f.A||void 0===f.A||null===(r=f.A.localVideoPara)||void 0===r||null===(r=r.SD)||void 0===r?void 0:r.buffer.byteLength,se.dt=null===f.A||void 0===f.A||null===(s=f.A.localVideoPara)||void 0===s?void 0:s.videodecodethreadnumb,se.et=null===f.A||void 0===f.A||null===(o=f.A.localVideoPara)||void 0===o?void 0:o.videoencodethreadnumb,se.MT=null===f.A||void 0===f.A||null===(a=f.A.localVideoPara)||void 0===a?void 0:a.isSupportMultiThread,se.time=performance.now(),se},watermark:(()=>{const e=new u.A,t=document.createElement("canvas"),i={enableWaterMark:!1,waterMarkText:"",watermarkOpacity:0,watermarkRepeated:!1,watermarkPosition:void 0};return{getWaterMarkData(r){let{width:s,height:o}=r;if(!i.enableWaterMark)return null;const a=s<H.n1||o<H.Ws?16:i.watermarkPosition,n=i.watermarkRepeated&&s>H.fK&&o>H.qZ,d=function(e,t){if(e<640&&e){const i=640/e;e=640,t=Math.round(t*i)}return{width:e,height:t}}(s,o);return s=d.width,o=d.height,n?e.Get_Repeated_WaterMarkRGBA({canvas:t,name:i.waterMarkText,width:d.width,height:d.height,opacity:i.watermarkOpacity,position:a,convertToDataUrl:!0}):e.Get_WaterMarkRGBA({canvas:t,name:i.waterMarkText,width:d.width,height:d.height,opacity:i.watermarkOpacity,position:a,convertToDataUrl:!0})},updateWaterMarkInfo(e){Object.assign(i,e)}}})(),isSupportAudioWorklet(){return!("function"!=typeof AudioWorklet||ce.isIphoneOrIpadBrowser()&&!this.isSafariVersionHigherThan("17")&&!this.isChromeVersionHigherThan("130"))},isSupportAudioDenoise(e){if(!E.A.read(e,11,1)||"function"!=typeof AudioContext)return!1;if(this.browser.isChromeOrEdge&&this.getBrowserVersion()<=100)return!1;const t=WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,9,1,7,0,65,0,253,15,26,11]));if(!1===t)return!1;if(!0!==t)return p.Ay.error("WebAssembly.validate don't return a boolean"),!1;if(navigator.hardwareConcurrency<=2||this.isTeslaMode())return!1;if(this.isMTRAndroid()||(0,L.GY)())return!0;const i=this.canAudioDenoiseOnDirectly(e);return 1===i||0!==i},getAudioDenoiseDefaultValue(e){if(!this.isSupportAudioDenoise(e))return 0;const t=E.A.read(e,11,1);return navigator.hardwareConcurrency>4&&t&&t&b.n.AUDIO_DENOISE.candidates.DEFAULT_VALUE_GREATER_THAN_4_CORES?1:0},getAudioDenoiseModel(){return this.isMobileDevice()||4==this.getOSInfo().osType||this.isChromeOS()&&navigator.hardwareConcurrency<=4?O.cS.LIGHT_WEIGHT:O.cS.AUTO},canAudioDenoiseOnDirectly(e){if(!this.isSupportAudioWorklet())return 0;if(f.A.isDesktopMode)return-1;const t=E.A.read(e,11,1),i=t&b.n.AUDIO_DENOISE.candidates.ANDROID,r=t&b.n.AUDIO_DENOISE.candidates.IOS;return this.isAndroidBrowser()?i&&navigator.hardwareConcurrency>=8&&this.browser.isChromeOrEdge?1:0:this.isIphoneOrIpadBrowser()?r&&navigator.hardwareConcurrency>=4&&this.isAppleBrowserVersionHigherThan(17)?1:0:-1},isAudioWASMLight(){return this.getAudioDenoiseModel()==O.cS.LIGHT_WEIGHT},isSupportOriginalSound:e=>!!E.A.read(e,22,1),isSupportPlayStereo(e){return!!(this.browser.isFirefox||this.browser.isSafari||this.isSupportChromeWideAEC(e))},isBrowserSupportStereo(){return!this.browser.isSafari},isSupportShare2ndAudioDevice(e){return!(this.browser.isSafari||this.isIphoneOrIpadBrowser()||this.isAndroidBrowser()||!e&&(this.isMac()&&!(0,W.LZ)(126)||!this.isSupportSharedArrayBuffer()))},isSupportSharingStereo:()=>!1,isSupportVideoActiveChannel:()=>!0,async evaluateRendererType(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=m.h3.WEBGL;if(i){const e=(0,U.B)().config;await e.configDonePromise(),s&&e.canUseSsrcStream()&&(o=m.h3.VIDEO_TAG)}let a=null;const n=oe();ce.getGpuInfo().isWebGLContextInvalid||ce.isUsingSwiftShader()||(o=m.h3.WEBGL);try{if(this.isWebGL2Supported(t)?o=m.h3.WEBGL_2:p.Ay.log("evaluateRendererType() WebGL 2 is not supported."),!this.isSupportVideoFrame())return p.Ay.log("evaluateRendererType() WebGPU is not supported. (reason: VideoFrame is not supported)"),o;if(!(this.isMac()||this.isWindows()||this.isChromeOS()||this.isLinux()))return p.Ay.log("evaluateRendererType() WebGPU is not supported. (reason: unsupported platform)"),o;if(!(this.browser.isChromeOrEdge&&this.isChromeVersionHigherThan(119)||this.isOpera()&&this.isOperaVersionHigherThan(108)||this.browser.isChromeOrEdge&&(this.isLinux()||this.isAndroidBrowser())&&this.isChromeVersionHigherThan(121)))return p.Ay.log("evaluateRendererType() WebGPU is not supported. (reason: unmatched browser)"),o;if(!navigator.gpu)return o;const i=await navigator.gpu.requestAdapter();if(!i)return p.Ay.log("evaluateRendererType() WebGPU is not supported. (reason: no available adapter.)"),o;if(!await i.requestDevice())return p.Ay.log("evaluateRendererType() WebGPU is not supported. (reason: no available device.)"),o;let s;if("function"==typeof i.requestAdapterInfo?s=await i.requestAdapterInfo():"info"in i&&(s=i.info),!s)return p.Ay.log("evaluateRendererType() WebGPU is not supported. (reason: no available adapter info.)"),o;p.Ay.log("evaluateRendererType() GPUAdapterInfo: arch=".concat(s.architecture,", vendor=").concat(s.vendor));const d=this.queryDeviceProfile(s);if(!this.isGPUProfileOnWebGPUWhitelist(d,r))return o;if(n){if(a=new OffscreenCanvas(1,1),!a.getContext("webgpu"))return p.Ay.log("evaluateRendererType() WebGPU is not supported. (reason: no available GPUContext.)"),o;if(!this.isOpFeatureEnabled(e))return p.Ay.log("evaluateRendererType() WebGPU is not supported. (reason: WebGPU is not allowed for this account.)"),o;a=null,o=m.h3.WEBGPU}else p.Ay.log("evaluateRendererType() OffscreenCanvas is not supported while checking WebGPU.");return o}catch(e){return p.Ay.error("evaluateRendererType()",e),o}finally{a=null}},isOpFeatureEnabled:e=>1&e,queryDeviceProfile(e){if(e){let t={};return t.architecture=e.architecture,t.vendor=e.vendor,t}return null},isGPUProfileOnWebGPUWhitelist(e,t){if(!e)return!1;const i=e.vendor,r=e.architecture;return-1==m.O$.indexOf(i)?(p.Ay.log("isGPUProfileOnWebGPUWhitelist() vendor:".concat(i," arch:").concat(r," is not on the vendor whitelist!")),!1):null===t||!this.isHitGPUBlacklist(i,r,t)},isHitGPUBlacklist(e,t,i){if(""===e||void 0===e||void 0===t||void 0===i)return!1;for(let r=0;r<i.length;r++){const s=i[r];if(e.includes(s.vendor)&&t.includes(s.generations))return!0}return!1},parseGPUBlacklist(e){let t=null;if(e)try{const i=JSON.parse(e);t=null==i?void 0:i.GPUBlacklist}catch(t){p.Ay.error("parseGPUBlacklist() failed to read mediaBlockConfig! val=".concat(e))}return t},async getRendererTypeList(e,t){const i=this.parseGPUBlacklist(t),r=[{bitIndex:b.n.WEBGPU_RENDERER.index,readCount:1,defaultVal:b.n.WEBGPU_RENDERER.default},{bitIndex:b.n.WEBGL2_RENDERER.index,readCount:1,defaultVal:b.n.WEBGL2_RENDERER.default}],s=E.A.batchRead(e,r),o=!!s.get(b.n.WEBGPU_RENDERER.index),a=!!s.get(b.n.WEBGL2_RENDERER.index),n=await this.isWebGPUSupported(o,i),d=this.isWebGL2Supported(a),c=oe(),l=[],h=(0,U.B)().config;return await h.configDonePromise(),h.canUseSsrcStream()&&l.push({rendererType:m.h3.VIDEO_TAG,rendererName:"VideoTag"}),n&&l.push({rendererType:m.h3.WEBGPU,rendererName:"WebGPU"}),d&&l.push({rendererType:m.h3.WEBGL_2,rendererName:"WebGL2"}),c&&l.push({rendererType:m.h3.WEBGL,rendererName:"WebGL"}),l},evaluateWebRTCStrategy(e,t){var i,r,s,o;let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;e!==m.BH.DISABLED&&e!==m.BH.ENABLED&&e!==m.BH.AUTO&&(p.Ay.error("evaluateWebRTCStrategy() invalid webrtcSelection(".concat(e,") from caller.")),e=m.BH.AUTO);let d={shouldUseWebRTC:!1,errNo:m.Qb.UNKNOWN,errMsg:""};if(!this.isWebRTCFeatureEnabled(t))return d.shouldUseWebRTC=!1,d.errNo=m.Qb.FEATURE_OPTION_DISABLED,d.errMsg="webrtc is disabled(feature option is disabled).",d;const c=this.getOSInfo();let l=(null==c||null===(i=c.browser)||void 0===i?void 0:i.name)||"",h=(null==c||null===(r=c.browser)||void 0===r?void 0:r.version)||"",u=(null==c||null===(s=c.engine)||void 0===s?void 0:s.name)||"",v=(null==c||null===(o=c.engine)||void 0===o?void 0:o.version)||"",g=L.hU.attrs,_=g.vendor,S=(null==c?void 0:c.distributionName)||"";var C;(0,L.gm)()&&"mozilla"===_.toLowerCase()&&(_=null==c||null===(C=c.device)||void 0===C?void 0:C.vendor,_&&""!==_||(_=g.vendor));const w={os:null==c?void 0:c.os,osType:null==c?void 0:c.osType,browserName:l,browserVersion:h,engineName:u,engineVersion:v,vendor:_,renderInfo:g.renderInfo,isAstcSupported:g.isAstcSupported,distributionName:S};if(e===m.BH.DISABLED)return p.Ay.log("evaluateWebRTCStrategy() WebRTC is disabled by caller."),d.shouldUseWebRTC=!1,d.errNo=m.Qb.SUCCEED,d.errMsg="webrtc is disabled(disabled by caller).",d;let R=null==a?void 0:a.VideoWhitelist;const T=this.isSupportBrowserWebRTC();try{const i=y.A.isOnWebRTCWhitelist(R,w,x.zu);if(i.isInWhitelist){const r=y.A.evalWebRTCStrategy(i.blacklist,w,T,e,x.zu);d.errNo=r.errNo,d.errMsg=r.errMsg,r.stg==m.BH.ENABLED?d.shouldUseWebRTC=!0:r.stg==m.BH.DISABLED?d.shouldUseWebRTC=!1:r.stg==m.BH.AUTO?(f.A.hasWasmMemoryError&&!f.A.hasUsedWebrtc?(p.Ay.directReport("evaluateWebRTCStrategy() WASM memory error detected, fallback to WebRTC."),d.shouldUseWebRTC=!0):n?n===A.WEBASSEMBLY?d.shouldUseWebRTC=!1:n===A.WEBRTC_AV_2_0||n===A.WEBRTC_AV_1_0?d.shouldUseWebRTC=!0:(p.Ay.error("evaluateWebRTCStrategy() unknown abTestStrategy:".concat(n,", use default logic to decide.")),d.shouldUseWebRTC=!1):d.shouldUseWebRTC=this.isDefaultToUseWebRTC(t,w),!d.shouldUseWebRTC&&ee.getIsSupportMultiThread()&&(Fe(N._c.VIDEO_ENCODE,!0)&&Fe(N._c.VIDEO_DECODE,!0)||(d.shouldUseWebRTC=!0),d.shouldUseWebRTC&&p.Ay.directReport("WASMmemory allocate failed, fallback to WebRTC."))):(d.shouldUseWebRTC=!1,d.errNo=m.Qb.UNKNOWN_SELECTION,d.errMsg="webrtc is disabled(unknown selection type).",p.Ay.error("evaluateWebRTCStrategy() unknown WEBRTC_STG:".concat(r.stg)))}else d.shouldUseWebRTC=!1,d.errNo=m.Qb.DEVICE_NOT_ON_WHITELIST,d.errMsg="webrtc is disabled(not on the whitelist)."}catch(e){p.Ay.error("evaluateWebRTCStrategy() error:",e),d.shouldUseWebRTC=!1,d.errNo=m.Qb.OTHER_EX,d.errMsg="webrtc is disabled(unexpected error:".concat(e.errorMessage,").")}if(d.shouldUseWebRTC)try{var I,M;const e=null===(I=RTCRtpReceiver.getCapabilities("video"))||void 0===I||null===(I=I.codecs)||void 0===I?void 0:I.some((e=>{let{mimeType:t,sdpFmtpLine:i}=e;return"video/H264"===t&&-1!==(null==i?void 0:i.indexOf("packetization-mode=1"))})),t=null===(M=RTCRtpSender.getCapabilities("video"))||void 0===M||null===(M=M.codecs)||void 0===M?void 0:M.some((e=>{let{mimeType:t}=e;return"video/H264"===t}));e&&t||(d.shouldUseWebRTC=!1,d.errNo=m.Qb.BROWSER_NOT_SPT,d.errMsg="H.264 not supported: ".concat(e,"-").concat(t))}catch(e){p.Ay.error("evaluateWebRTCStrategy() failed to detect H.264 codec",e)}if(d.shouldUseWebRTC&&(0,L.gm)()){const e=!!(E.A.read(t,b.n.ENABLE_WEBRTC_AV_2_ON_FIREFOX.index,1,b.n.ENABLE_WEBRTC_AV_2_ON_FIREFOX.default)&b.n.ENABLE_WEBRTC_AV_2_ON_FIREFOX.candidates.ENABLE_VIDEO);d.shouldUseWebRTC=e}if(!d.shouldUseWebRTC){var D,P;const t=!(null===(D=J[N._c.VIDEO_ENCODE])||void 0===D||!D.memory),i=!(null===(P=J[N._c.VIDEO_DECODE])||void 0===P||!P.memory);p.Ay.directReport("evaluateWebRTCStrategy() stg=".concat(JSON.stringify(d),", isBrowserSupportWebRTC=").concat(T,", videoWhitelist=").concat(JSON.stringify(R),", selection=").concat(e,", abTestStrategy=").concat(n,", allocatedMemory={encode:").concat(t,",decode:").concat(i,"}"))}return d},isWebRTCFeatureEnabled(e){const t=E.A.read(e,b.n.ENABLE_WEBRTC_FEATURE.index,1,b.n.ENABLE_WEBRTC_FEATURE.default);return p.Ay.log("isWebRTCFeatureEnabled() optionVal:".concat(t)),!!t},getAnnotationCapability(e){const t=E.A.read(e,b.n.SUPPORT_ANNOTATION.index,1,b.n.SUPPORT_ANNOTATION.default),i=!!(t&b.n.SUPPORT_ANNOTATION.candidates.VIEWER),r=!!(t&b.n.SUPPORT_ANNOTATION.candidates.PRESENTER),s=i?r?2:1:0;return p.Ay.log("getAnnotationCapability() cap:".concat(s)),s},getWebRTCStrategyOptions(e){const t=E.A.read(e,b.n.WEBRTC_STG.index,1,b.n.WEBRTC_STG.default);p.Ay.log("getWebRTCStrategyOption() optionVal:".concat(t));const i=[];return Object.entries(m.BH).forEach((e=>{let[r,s]=e;const o={key:r,value:s,isDefault:!1};t===s&&(o.isDefault=!0),i.push(o)})),i},isDefaultToUseWebRTC(e,t){const i=[{bitIndex:b.n.WEBRTC_SMART_AUTO_STG_1.index,readCount:1,defaultVal:b.n.WEBRTC_SMART_AUTO_STG_1.default},{bitIndex:b.n.WEBRTC_SMART_AUTO_STG_2.index,readCount:1,defaultVal:b.n.WEBRTC_SMART_AUTO_STG_2.default},{bitIndex:b.n.WEBRTC_SMART_AUTO_STG_3.index,readCount:1,defaultVal:b.n.WEBRTC_SMART_AUTO_STG_3.default},{bitIndex:b.n.WEBRTC_SMART_AUTO_STG_4.index,readCount:1,defaultVal:b.n.WEBRTC_SMART_AUTO_STG_4.default}],r=E.A.batchRead(e,i),s=r.get(b.n.WEBRTC_SMART_AUTO_STG_1.index),o=r.get(b.n.WEBRTC_SMART_AUTO_STG_2.index),a=r.get(b.n.WEBRTC_SMART_AUTO_STG_3.index),n=!!(s&b.n.WEBRTC_SMART_AUTO_STG_1.candidates.SAB_OFF_NO_OFFSCREENCANVAS_NO_GPU),d=!!(o&b.n.WEBRTC_SMART_AUTO_STG_2.candidates.DESKTOP_LOW_PERF_DEVICE);if(n){if(!this.isSupportSharedArrayBuffer())return p.Ay.log("isDefaultToUseWebRTC() force WebRTC. reason: SharedArrayBuffer not support"),!0;if(!this.isSupport2dOffscreenCanvas())return p.Ay.log("isDefaultToUseWebRTC() force WebRTC. reason: OffscreenCanvas not support"),!0;if(t.renderInfo&&t.renderInfo.toLowerCase().includes("swiftshader"))return p.Ay.log("isDefaultToUseWebRTC() force WebRTC. reason: swiftshader"),!0}if(d&&0==t.osType&&this.isLowPerformanceDevice())return p.Ay.log("isDefaultToUseWebRTC() force WebRTC. reason: desktop low performance device (cores <= 4)"),!0;if(a&b.n.WEBRTC_SMART_AUTO_STG_3.candidates.WEBCODEC_NOT_SUPPORT&&!this.isVideoEncoderPreconditionMatched()&&!this.isVideoDecoderPreconditionMatched())return p.Ay.log("isDefaultToUseWebRTC() force WebRTC. reason: webcodec not support"),!0;if(o&b.n.WEBRTC_SMART_AUTO_STG_2.candidates.VIDEO_ON_BROWSER_32BIT&&Q)return p.Ay.log("isDefaultToUseWebRTC() force WebRTC. reason: 32-bit os/browser for video"),!0;const c=!!(s&b.n.WEBRTC_SMART_AUTO_STG_1.candidates.MOB_ANDROID)||!!(s&b.n.WEBRTC_SMART_AUTO_STG_1.candidates.MOB_IOS),l=!!(s&b.n.WEBRTC_SMART_AUTO_STG_1.candidates.DESKTOP);return!(!c&&!l||![{os:"android",flag:b.n.WEBRTC_SMART_AUTO_STG_1.candidates.MOB_ANDROID},{os:"ios",flag:b.n.WEBRTC_SMART_AUTO_STG_1.candidates.MOB_IOS},{os:"win",flag:b.n.WEBRTC_SMART_AUTO_STG_1.candidates.DESKTOP},{os:"mac",flag:b.n.WEBRTC_SMART_AUTO_STG_1.candidates.DESKTOP},{os:"chromium os",flag:b.n.WEBRTC_SMART_AUTO_STG_1.candidates.DESKTOP}].some((e=>{var i;let{os:r,flag:o}=e;return s&o&&(null===(i=t.os)||void 0===i?void 0:i.toLowerCase().includes(r))})))&&(p.Ay.log("isDefaultToUseWebRTC() force WebRTC. reason: force WebRTC on specific OS"),!0)},isWebGL2Supported:e=>"function"==typeof OffscreenCanvas&&e&&re.isSupportWebgl2,isWebGL2SupportedWhenOpEnabled:()=>re.isSupportWebgl2,async isWebGPUSupported(e,t){if(!e)return!1;if(!this.isSupportVideoFrame())return!1;if(!(this.isMac()||this.isWindows()||this.isChromeOS()||this.isLinux()))return!1;if(!(this.browser.isChromeOrEdge&&this.isChromeVersionHigherThan(119)||this.isOpera()&&this.isOperaVersionHigherThan(108)||this.browser.isChromeOrEdge&&(this.isLinux()||this.isAndroidBrowser())&&this.isChromeVersionHigherThan(121)))return!1;if(!navigator.gpu)return!1;const i=await navigator.gpu.requestAdapter();if(!i)return!1;if(!await i.requestDevice())return!1;let r;if("function"==typeof i.requestAdapterInfo?r=await i.requestAdapterInfo():"info"in i&&(r=i.info),!r)return!1;const s=this.queryDeviceProfile(r);if(!this.isGPUProfileOnWebGPUWhitelist(s,t))return p.Ay.log("isWebGPUSupported() hit blacklist! profile=".concat(JSON.stringify(s),", blacklist=").concat(JSON.stringify(t))),!1;let o=new OffscreenCanvas(1,1);return o.getContext("webgpu")?(o=null,!0):(o=null,!1)},async isRendererTypeSupported(e,t,i,r,s,o){return!(e<=m.h3.UNDEFINED||e>m.h3.VIDEO_TAG)&&(e===m.h3.WEBGL?oe():e===m.h3.WEBGL_2?this.isWebGL2Supported(i):e===m.h3.WEBGPU?await this.isWebGPUSupported(t,s):e===m.h3.VIDEO_TAG&&o&&r&&(0,U.B)().config.canUseSsrcStream())},videoToMediaStreamManager:(()=>{let e,t,i=document.createElement("canvas"),r=i.getContext("2d"),s=640,o=360;const a=navigator.hardwareConcurrency&&navigator.hardwareConcurrency<4?10:24,n=1e3/("chrome"===$.browser||"edge"===$.browser?a:10);let d=null,c=0,l=null;return{_draw(){if(!e)return;this.drawCanvas(i,r,s,o);const t=performance.now();if(c){const e=t-c;e>n?this._setFasterTimer():e<.8*n&&this._clearFastTimer()}c=t},_setFasterTimer(){d||(d=setInterval((()=>{e&&e.currentTime>0&&!e.paused&&!e.ended&&performance.now()-c>=n/2&&this.drawCanvas(i,r,s,o)}),n))},_clearFastTimer(){c=0,clearInterval(d),d=null},drawCanvas(t,i,r,s){t.width=r,t.height=s;let o=0,a=0;e.videoWidth/e.videoHeight>r/s?(a=e.videoHeight,o=r/s*a):(o=e.videoWidth,a=s/r*o),i.drawImage(e,(e.videoWidth-o)/2,(e.videoHeight-a)/2,o,a,0,0,r,s)},startCapture(r,n,d){return e=r,n&&d&&n/d==16/9&&(s=n,o=d),l&&e.removeEventListener("timeupdate",l),l=this._draw.bind(this),r.addEventListener("timeupdate",l),t=i.captureStream(a),t},stopCapture(){l&&e.removeEventListener("timeupdate",l),this._clearFastTimer(),t&&(t.getVideoTracks().forEach((e=>e.stop())),t=null),e=null},isSupported:()=>"function"==typeof HTMLCanvasElement.prototype.captureStream}})(),audioToMediaStreamMananger:(()=>{let e=null,t=null,i=null,r=null,s=null;return{startCapture(o){if(t||(t=de("File")),s&&o===s)e=s;else{this.destroy(),e=o,s=e,r=t.createMediaElementSource(e);const a=t.createMediaStreamDestination();r.connect(a),i=a.stream}return"suspended"!==t.state&&"interrupted"!==t.state||t.resume().catch((e=>{p.Ay.error("File audio context resume error: ",e)})),i},stopCapture(){t&&t.suspend(),e=null},destroy(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];r&&r.disconnect(),i&&(i.getAudioTracks().forEach((e=>e.stop())),i=null),s=null,r=null,!e&&t&&(t.close(),t=null)},isAudioFileStream:e=>e===i,isSupported:()=>"undefined"!=typeof AudioContext&&"function"==typeof AudioContext.prototype.createMediaStreamDestination&&"function"==typeof AudioContext.prototype.createMediaElementSource}})(),evaluateAudioStrategy(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:void 0;const a=this.calcuateAudioStrategyGroup(e,t,i,s,o,r,e),n=a.preferredStrategy;if(void 0!==o&&void 0===i){const i=this.audioABTestStgToValue(o);i!==n&&-1!==a.availableStrategies.indexOf(i)&&(a.preferredStrategy=i,1===a.preferredStrategy&&!0===s&&this.isWebRTCAudio2_0(e,t,!0,s,o)&&(a.preferredStrategy=3),p.Ay.directReport("evaluateAudioStrategy() override preferred strategy to ".concat(i," from audioABTestStrategy:").concat(o)))}const d=!!E.A.read(e,b.n.ENABLE_FALLBACK_WEBRTC_AUDIO_STG.index,1,b.n.ENABLE_FALLBACK_WEBRTC_AUDIO_STG.default);return d&&0===a.preferredStrategy&&!0===r&&(-1!=a.availableStrategies.indexOf(3)?a.preferredStrategy=3:-1!=a.availableStrategies.indexOf(1)?a.preferredStrategy=1:p.Ay.error("evaluateAudioStrategy() no available WebRTC audio strategies to use!")),p.Ay.directReport("evaluateAudioStrategy() group:".concat(JSON.stringify(a),", originPreferredStrategy:").concat(n,", isFallbackWebRTCAudioStgEnabled:").concat(d,", enforceSelect:").concat(i,", enabledOnFT:").concat(s,", videoUseWebRTC:").concat(r)),a.preferredStrategy},calcuateAudioStrategyGroup(e,t,i,r,s,o,a){var n;const d={preferredStrategy:-1,availableStrategies:[]};if(this.isEnforceWasmMachine(o,a))return s===A.WEBASSEMBLY&&!0!==r||p.Ay.log("calcuateAudioStrategyGroup() enforce WebAssembly audio even if abTestStrategy is ".concat(s," and enabledOnFT is ").concat(r)),d.preferredStrategy=0,d.availableStrategies.push(0),d;let c=0,l=c;if(!1!==r||s===A.WEBRTC_AV_2_0?l=3:(l=1,s===A.WEBASSEMBLY&&(l=0)),this.isMTRWindows())return c=0,d.preferredStrategy=c,d.availableStrategies.push(0),d;const h=E.A.read(e,1,2),u=this.isWebRTCAudio2_0(e,t,!0,r,s);if(this.isMTRAndroid())return 0===l?c=0:8&h?(c=u?3:1,d.availableStrategies.push(1),u&&d.availableStrategies.push(3)):c=0,d.preferredStrategy=c,d.availableStrategies.push(0),d;let m=null===(n=(0,W.PF)())||void 0===n?void 0:n.os;if((0,L.bw)()||(0,L.GN)()||(0,L.HR)()||(0,L.n_)()||"iOS"===m||f.A.hasAudioMemoryError&&!f.A.hasUsedWebRTCAudio||this.isLessTestBrowserUseWebRTCAudio(e)){const i=this.canUseWebRTCAudio2OnMobile(e,t,r,s);return c=i?3:1,d.preferredStrategy=c,d.availableStrategies.push(1),i&&d.availableStrategies.push(3),d}return 128&h||(u?De:Me)?(c=!0===i?u?3:1:!1===i||0===l?0:this.isDefaultAudioBridgeMachine(e,h,i)?3===l&&u?3:1:0,d.preferredStrategy=c,d.availableStrategies.push(0),d.availableStrategies.push(1),u&&d.availableStrategies.push(3),d):(-1===d.preferredStrategy&&(p.Ay.error("calculateAudioStrategyGroup() preferredStrategy is unknown! fallback to wasm!"),d.preferredStrategy=0,d.availableStrategies.length=0,d.availableStrategies.push(0)),d)},audioABTestStgToValue:e=>e===A.WEBRTC_AV_2_0?3:e===A.WEBRTC_AV_1_0?1:(A.WEBASSEMBLY,0),isEnforceWasmMachine(e,t){var i;if("undefined"==typeof RTCPeerConnection)return!0;if((0,L.Xb)())return!1;const r=this.getOSInfo();return!(!(null==r||null===(i=r.browser)||void 0===i||null===(i=i.name)||void 0===i?void 0:i.toLowerCase().includes("firefox"))&&!this.browser.isFirefox)&&!(E.A.read(t,b.n.ENABLE_WEBRTC_AV_2_ON_FIREFOX.index,1,b.n.ENABLE_WEBRTC_AV_2_ON_FIREFOX.default)&b.n.ENABLE_WEBRTC_AV_2_ON_FIREFOX.candidates.ENABLE_AUDIO)},isLessTestBrowserUseWebRTCAudio(e){const t=E.A.read(e,b.n.ENABLE_WEBRTC_AUDIO_ON_SPECIAL_DEVICE.index,1,b.n.ENABLE_WEBRTC_AUDIO_ON_SPECIAL_DEVICE.default);return(!((0,L.uF)()||(0,L.cX)()||(0,L.Zs)())||!((0,L.H8)()||(0,L.UP)()||(0,L.nr)()||(0,L.gm)()))&&t&b.n.ENABLE_WEBRTC_AUDIO_ON_SPECIAL_DEVICE.candidates.LESS_TEST_BROWSER_FORCE_USE_WEBRTC},isWebRTCAudio2_0(e,t,i,r,s){var o;const a=!1!==r,n=s===A.WEBRTC_AV_2_0;let d=a;d||n&&(d=s===A.WEBRTC_AV_2_0);const c=E.A.read(e,b.n.ENABLE_WEBRTC_AUDIO_2_0.index,1,b.n.ENABLE_WEBRTC_AUDIO_2_0.default),l=null===(o=C.q.get(t))||void 0===o?void 0:o.hasSilkAudio,h=i&&d&&c&&!l;return p.Ay.directReport("enabledOnFT:".concat(r,", abTestStrategy:").concat(s,", isWebRTCAudio2_0: ").concat(c,", hasSilk: ").concat(l,", isWebRTCAudio: ").concat(i,", preferToUseWebRTCAudio2:").concat(d)),h},canUseWebRTCAudio2OnMobile(e,t,i,r){var s;const o=!!E.A.read(e,b.n.ENABLE_WEBRTC_AUDIO_2_0.index,1,b.n.ENABLE_WEBRTC_AUDIO_2_0.default);if(!o)return p.Ay.log("canUseWebRTCAudio2OnMobile() a/b option for WebRTC audio 2.0 is disabled!"),!1;let a=!1;const n=!1!==i;a=!!n||r===A.WEBRTC_AV_2_0||o;const d=null===(s=C.q.get(t))||void 0===s?void 0:s.hasSilkAudio;return p.Ay.directReport("canUseWebRTCAudio2OnMobile() isWebRTCAudio2EnabledOnFT:".concat(n,", abTestStrategy:").concat(r,", isWebRTCAudio2Enabled:").concat(o,", hasSilk:").concat(d,", canUseWebRTCAudio2:").concat(a)),a&&!d},isDefaultAudioBridgeMachine(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(1===i)return!0;if(0===i)return!1;const r=E.A.read(e,b.n.WEBRTC_SMART_AUTO_STG_2.index,1,b.n.WEBRTC_SMART_AUTO_STG_2.default),s=E.A.read(e,b.n.ENABLE_WEBRTC_AUDIO_ON_SPECIAL_DEVICE.index,1,b.n.ENABLE_WEBRTC_AUDIO_ON_SPECIAL_DEVICE.default);if(r&b.n.WEBRTC_SMART_AUTO_STG_2.candidates.AUDIO_ON_BROWSER_32BIT&&Q)return!0;let o=this.getOSInfo();return o&&o.os&&o.browser?1==o.osType||"Windows"!==o.os&&4==o.osType?32&t:this.isSupportSharedArrayBuffer()?navigator.hardwareConcurrency>4?64&t:32&t:s&b.n.ENABLE_WEBRTC_AUDIO_ON_SPECIAL_DEVICE.candidates.NO_SAB:this.isLowPerformanceDevice()&&32&t||!this.isSupportSharedArrayBuffer()&&s&b.n.ENABLE_WEBRTC_AUDIO_ON_SPECIAL_DEVICE.candidates.NO_SAB},is32bitBrowser:()=>Q,requestScreenWakeLock:()=>S.requestWakeLock(),releaseScreenWakeLock:()=>S.release(),isSupportPeerConnection:()=>"function"==typeof RTCPeerConnection,getBandWidth:()=>new Promise(((e,t)=>{if(!(navigator&&navigator.managed&&navigator.managed.getManagedConfiguration))return e(null);navigator.managed.getManagedConfiguration(["BandwidthLimitUp","BandwidthLimitDown"]).then((t=>{const i={};if(!_.isNil(t)){const e=parseInt(t.BandwidthLimitUp,10),r=parseInt(t.BandwidthLimitDown,10);Number.isNaN(e)||(i.uplimit=e),Number.isNaN(r)||(i.downlimit=r)}return e(i)})).catch((e=>t(e)))})),isSupportVideoProcessor(e){const t=!!(E.A.read(e,b.n.ENABLE_MEDIA_PROCESSOR.index,1,b.n.ENABLE_MEDIA_PROCESSOR.default)&b.n.ENABLE_MEDIA_PROCESSOR.candidates.VIDEO_PROCESSOR);return this.isSupportOffscreenCanvas()&&this.isSupportVideoFrame()&&t},isSupportAudioProcessor:e=>!!(E.A.read(e,b.n.ENABLE_MEDIA_PROCESSOR.index,1,b.n.ENABLE_MEDIA_PROCESSOR.default)&b.n.ENABLE_MEDIA_PROCESSOR.candidates.AUDIO_PROCESSOR)&&"function"==typeof AudioWorklet,isSupportShareProcessor(e){const t=this.isSupportOffscreenCanvas(),i=this.isSupportVideoFrame(),r=!!(E.A.read(e,b.n.ENABLE_MEDIA_PROCESSOR.index,1,b.n.ENABLE_MEDIA_PROCESSOR.default)&b.n.ENABLE_MEDIA_PROCESSOR.candidates.SHARE_PROCESSOR);return p.Ay.log("isSupportShareProcessor() isSupportOffscreenCanvas:".concat(t,", isVideoFrameSupported:").concat(i,", isVideoProcessorEnabled:").concat(r)),t&&i&&r},isVideoProcessorEnabled:e=>!!(e&b.n.ENABLE_MEDIA_PROCESSOR.candidates.VIDEO_PROCESSOR),isMediaProcessorEnabled:e=>e>0,isSupportAudioHID(){return!(!window.navigator.hid||!window.navigator.hid.requestDevice||this.isChromeOS()||(0,L.UP)()&&!(0,L.D)("137.0.3296.16"))},isLowPerformanceDevice:()=>navigator.hardwareConcurrency<=4,shouldEnableAdvancedFeatureOnLowEnd:()=>navigator.hardwareConcurrency<4,isMobileForceAutoChooseAudioDeviceEnable(){if(f.A.isDesktopMode)return!1;let e={},t=b.n.MOBILE_FORCE_AUTO_CHOOSE_AUDIO_DEVICE;return void 0!==f.A.mobileForceAutoChooseAudioDevice?(e.android=f.A.mobileForceAutoChooseAudioDevice&t.candidates.ANDROID,e.ios=f.A.mobileForceAutoChooseAudioDevice&t.candidates.IOS):(e.android=t.default&t.candidates.ANDROID,e.ios=t.default&t.candidates.IOS),!(!(0,L.n_)()||!e.ios)||!(!(0,L.GN)()||!e.android)},isAndroidForceEarpiceCaptureEnable(){if(f.A.isDesktopMode)return!1;let e=!1,t=b.n.MOBILE_FORCE_AUTO_CHOOSE_AUDIO_DEVICE;return e=void 0!==f.A.mobileForceAutoChooseAudioDevice?f.A.mobileForceAutoChooseAudioDevice&t.candidates.ANDROID_EARPIECE:t.default&t.candidates.ANDROID_EARPIECE,(0,L.GN)()&&e},ensureTrailingSlash:e=>"string"==typeof e&&e.endsWith("/")?e:e+"/",isEnablePSLMixShare:()=>!(0,L.Xb)()},le=ce;function he(){let e=this;this.promise=new Promise((function(t,i){e.reject=i,e.resolve=t}))}class ue{constructor(e,t){this.scriptURL=e,this.lateLoadedAssetsHash=t}getIntegrity(){let e=function(e){return e.split("/").pop().split("?")[0].split("#")[0]}(this.scriptURL);return this.lateLoadedAssetsHash[e]||null}}function pe(e){if("suspended"!==e.state)return;const t=document.body,i=["touchstart","touchend","mousedown","mouseup","keyup","keydown"];function r(){e.resume().then(s).catch(s)}function s(){i.forEach((e=>t.removeEventListener(e,r)))}i.forEach((e=>t.addEventListener(e,r,!1)))}function fe(e,t){if(e===t)return!0;if(r(e)&&r(t)){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var i in e)if(!fe(e[i],t[i]))return!1;return!0}function r(e){return"object"==typeof e&&null!=e}}function me(){return i.e(557).then(i.bind(i,7378))}function ve(){return i.e(208).then(i.bind(i,7531))}function ge(e){const t=document.body,i=["click","contextmenu","auxclick","dblclick","mousedown","mouseup","touchend","keydown","keyup"];function r(){e()}return i.forEach((e=>t.addEventListener(e,r,!1))),function(){i.forEach((e=>t.removeEventListener(e,r)))}}function _e(e){let t=null==e?void 0:e.getVideoTracks();return!(null==t||!t.length||t[0].muted)}function Se(e){try{var t;let[i]=(null===(t=e.srcObject)||void 0===t?void 0:t.getVideoTracks())||[],r="VDom:".concat(e.ended,":").concat(e.paused,":").concat(e.readyState,",VTrack:").concat(null==i?void 0:i.muted,":").concat(null==i?void 0:i.readyState);v.A.add_monitor(r)}catch(e){p.Ay.error("RecordVideoState error",e)}}function Ae(e,t){(e<0||t<0||e>3e3||t>3e3)&&p.Ay.directReport("CANVASSIZE:".concat(e,"x").concat(t))}function ye(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(F.X.isUseSsrcStream()){const e="NotSupportExternalCanvasInVideoTagRenderer";(0,k.iK)(P.M4w,{reason:e}),p.Ay.directReport(e)}if(e&&!t){const e="NotSupportExternalCanvasInWebRTC";(0,k.iK)(P.q_3,{reason:e}),p.Ay.directReport(e)}}function Ce(e){if(!e)return!1;if("string"==typeof e)return!1;if(e.ownerDocument===window.document)return e instanceof HTMLElement;{var t;const i=null===(t=e.ownerDocument)||void 0===t||null===(t=t.defaultView)||void 0===t?void 0:t.HTMLElement;return!!i&&e instanceof i||e instanceof HTMLElement}}function Ee(e){const t={dom:null,id:""};if(e)if("string"==typeof e)t.dom=document.getElementById(e),t.id=e;else if(Ce(e)){var i;t.dom=e,t.id=null===(i=e.getAttribute)||void 0===i?void 0:i.call(e,"id")}else"transferControlToOffscreen"in e&&"function"==typeof e.transferControlToOffscreen&&(t.dom=e,t.id=e.id);return t}function be(){try{const e={safari:"15.0",firefox:"89",chrome:"91",edge:"91",opera:"77"},t={safari:"16.4",firefox:"105",chrome:"102",edge:"102",opera:"88"};let i=Object.assign({name:"",version:""},(0,W.PF)().browser);if(-1==Object.keys(e).findIndex((e=>{if(i.name.toLowerCase().includes(e))return i.name=e,!0})))return console.error("!!!!! For a better experience, please use Chrome (version >= 102) or Safari (version >= 16.4) browser "),void p.Ay.error("unkown browser info");(0,L.D$)(i.version,e[i.name])||(console.error("!!!! For a better experience, \n Chrome (version > ".concat(e.chrome," ,performance version > ").concat(t.chrome,") \n Safari (version > ").concat(e.safari," , performance version > ").concat(t.safari,") \n Firefox (version > ").concat(e.firefox," , performance version > ").concat(t.firefox,") \n Edge (version > ").concat(e.edge," , performance version > ").concat(t.edge," ) \n Opera (version > ").concat(e.opera," , performance version > ").concat(t.opera,") \n")),p.Ay.error("less than min version "))}catch(e){p.Ay.error("check browser version error",e)}}function we(e){var t;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"|";return e?d()(t=e.toString()).call(t,/[,,]/g,i):""}function Re(){try{const e=document.createElement("canvas");return!(!e.getContext("webgl")&&!e.getContext("experimental-webgl"))}catch(e){return!1}}function Te(e){const t=self.ZoomTPModule;return new(t&&t.ZoomTPWebSocket?t.ZoomTPWebSocket:WebSocket)(e)}function Ie(){X=arguments.length>0&&void 0!==arguments[0]&&arguments[0]}let Me=!0,De=!0;function Pe(){try{Me=(new C.Y).getAudioBridgeConnectivityInfo().getWebRTCConnectivityResult().result,De=(new C.Y).getWMSCConnectivityInfo().getWebRTCConnectivityResult().result}catch(e){p.Ay.error("updateAudioProbResult error",e),Me=!0,De=!0}}function ke(){try{return!!ce.isAppleBrowserVersionHigherThan("15")||!!ce.isChromiumVersionHigherThan(131)||!!ce.isFirefoxVersionHigherThan(144)}catch(e){return!1}}function Oe(){return ce.isSupportMultiViewAPI()||f.A.enableMultiDecodeVideoWithoutSAB?26:1}function Ve(){return Y}function Ne(e){let t;return e&&(e.includes("web")?t="web":e.includes("window")?t="window":e.includes("screen")&&(t="screen")),t||"UNKNOWN"}function xe(e,t){const i=e*t;return i<36864?0:i<129600?1:i<36e4?2:i<144e4?3:4}function Le(){let{isSendVideo:e=!1,isSendAudio:t=!1,subscribedUserIds:i,activeSpeakerSsrc:r}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const s=new Map,{lastStatsLogs:o}=f.A;if(e&&o.videoSendStats){const e=o.videoSendStats.nodeId||"unknown";s.set("video-encode-".concat(e),o.videoSendStats)}if(o.videoRecvStats&&o.videoRecvStats.size>0&&o.videoRecvStats.forEach(((e,t)=>{const o=e.nodeId||t;(o===r||i&&i.has(o))&&s.set("video-decode-".concat(o),e)})),o.sharingSendStats){const e=o.sharingSendStats.ssrc||"unknown";s.set("sharing-encode-".concat(e),o.sharingSendStats)}if(o.sharingRecvStats){const e=o.sharingRecvStats.ssrc||"unknown";s.set("sharing-decode-".concat(e),o.sharingRecvStats)}if(t&&o.audioSendStats){const e=o.audioSendStats.ssrc||"unknown";s.set("audio-encode-".concat(e),o.audioSendStats)}return o.audioRecvStats&&o.audioRecvStats.size>0&&o.audioRecvStats.forEach(((e,t)=>{if(e&&"object"==typeof e){const i=z({},e);delete i.updateTime,s.set("audio-decode-".concat(t),i)}else s.set("audio-decode-".concat(t),e)})),s}function We(e){let{enable:t,pollingInterval:i,isSupportVideoShare:r,isLSSPlayer:s,pushMessageToWorker:o,pushMessageToAudioWorklet:a,Command:n,WORKER_TYPE:d}=e;[d.VIDEO_ENCODE,d.VIDEO_DECODE,d.SHARING_ENCODE,d.SHARING_DECODE,d.AUDIO_ENCODE,d.AUDIO_DECODE].forEach((e=>{let a=!0,c=e;r?(e==d.SHARING_DECODE&&(c=d.VIDEO_DECODE,a=!1),e==d.SHARING_ENCODE&&(c=d.VIDEO_ENCODE,a=!1)):e!==d.VIDEO_ENCODE&&e!==d.VIDEO_DECODE||(a=!0),o(c,{enable:t,workerType:c,pollingInterval:i,isVideo:a},n.MEDIA_STATISTICS_MONITORING,!1,s||!0)})),a({enable:t},n.MEDIA_STATISTICS_MONITORING)}function Ue(e){if(!e)return e;const t=z({},e);return t.video&&"object"==typeof t.video&&t.video.deviceId&&(t.video=z(z({},t.video),{},{deviceId:(0,p.hZ)(JSON.stringify(t.video.deviceId))})),t.audio&&"object"==typeof t.audio&&t.audio.deviceId&&(t.audio=z(z({},t.audio),{},{deviceId:(0,p.hZ)(JSON.stringify(t.audio.deviceId))})),t}function Be(e){if(!e)return e;const t=z({},e);if(t.video&&"object"==typeof t.video&&t.video.deviceId){const e=t.video,{deviceId:i}=e,s=(0,r.A)(e,G);t.video=s}if(t.audio&&"object"==typeof t.audio&&t.audio.deviceId){const e=t.audio,{deviceId:i}=e,s=(0,r.A)(e,j);t.audio=s}return t}function Fe(e){var t,i;let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const s={[N._c.VIDEO_ENCODE]:{managerKey:"localVideoEncMGR",memoryKey:"VE",maxPagesOverride:32e3},[N._c.VIDEO_DECODE]:{managerKey:"localVideoDecMGR",memoryKey:"VD",maxPagesOverride:16384},[N._c.SHARING_ENCODE]:{managerKey:"localSharingEncMGR",memoryKey:"SE"},[N._c.SHARING_DECODE]:{managerKey:"localSharingDecMGR",memoryKey:"SD"}}[e];if(!s)return void p.Ay.error("SendWasmMemory: Unknown worker type ".concat(e));const{managerKey:o,memoryKey:a,maxPagesOverride:n}=s;let d,c=!1,l=ce.isIphoneOrIpadBrowser()||ce.isIpadOS()||ce.isGoogleMeetAndroid()||Q?4096:8192;const h=Q||!ce.isChromeVersionHigherThan(90)||ce.isChromeOS();if(f.A[a])c=!0,d=f.A[a];else{var u;if(null!==(u=J[e])&&void 0!==u&&u.memory&&!J[e].used)d=J[e].memory,v.A.add_monitor("SWM:Reuse:".concat(e));else if(n&&ce.isSupportVideoShareSend()&&!ce.isAndroidIntegrationWithSAB()&&(l=n),d=function(e,t){let i,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];try{i=new WebAssembly.Memory({initial:e,maximum:t,shared:!0})}catch(e){p.Ay.error("E:H Allocate WasmMemory Failed ".concat(t," ").concat(r),e),f.A.hasWasmMemoryError=!0,r||(0,k.iK)(P.a1o)}return i}(1024,l,r),r){if(!d)return;e!==N._c.VIDEO_ENCODE&&e!==N._c.VIDEO_DECODE||(J[e]={memory:d,used:!1},v.A.add_monitor("SWM:Alloc:".concat(e)))}h&&(f.A[a]=d)}if(f.A.localVideoPara&&(f.A.localVideoPara[a]=d),r)return d;!r&&c&&new Uint8Array(d.buffer).fill(0);const m=null===(t=f.A[o])||void 0===t||null===(t=t.map)||void 0===t?void 0:t.get(0);m?(m.postMessage({command:"wasmMemory",data:d}),null!==(i=J[e])&&void 0!==i&&i.memory&&(J[e].used=!0,v.A.add_monitor("SWM:Used:".concat(e)))):v.A.add_monitor("SWM:NoHandle:".concat(o))}function He(){v.A.add_monitor("CWAM:ClearAll"),Object.keys(J).forEach((e=>{J[e]={memory:null,used:!1}}))}Pe()},3903:(e,t,i)=>{"use strict";i.d(t,{CV:()=>c,Nd:()=>d,fw:()=>n,tK:()=>a,vJ:()=>l});var r=i(7857),s=i(9407),o=i(9693);function a(e){h.instance||(h.instance=new h),h.instance.start(e)}function n(){var e;null===(e=h.instance)||void 0===e||e.close()}function d(e){h.instance&&h.instance.setTimeoutCallback(e)}function c(e,t){h.instance&&h.instance.registerWorker(t,e)}function l(e){h.instance&&h.instance.unRegisterWorker(e)}class h{constructor(){this._interval=-1,this.monitorworkers={},this.timeoutcallbackfn=(e,t)=>{}}setTimeoutCallback(e){this.timeoutcallbackfn=e}registerWorker(e,t){if(e in this.monitorworkers){let t=this.monitorworkers[e];t.worker.removeEventListener("message",t.listener),delete this.monitorworkers[e]}let i={id:e,worker:t},r=this._recvheartbeat.bind(this,i);i.listener=r,i.lastedtimestamp=Date.now(),i.timeoutcount=0,i.worker.addEventListener("message",i.listener),this.monitorworkers[e]=i}unRegisterWorker(e){if(!(e in this.monitorworkers))return;let t=this.monitorworkers[e];delete this.monitorworkers[e],t.worker.removeEventListener("message",t.listener)}_recvheartbeat(e,t){let i=t.data;i.cmd===s.QT&&(e.lastedtimestamp=i.timestamp,e.timeoutcount=0)}start(e){const t="undefined"!=typeof DedicatedWorkerGlobalScope&&e&&e instanceof DedicatedWorkerGlobalScope;if(-1!=this._interval)return;if(t)return void(this._interval=setInterval((()=>{e.postMessage({cmd:s.QT,timestamp:Date.now()})}),h.INTREVAL_TIME_MS));const i=()=>{this._interval=setTimeout((()=>{i();let e=h.instance,t=Object.keys(e.monitorworkers),r=Date.now();t.forEach((t=>{let i=e.monitorworkers[t];i.timeoutcount>5?r-i.lastedtimestamp>h.HEART_TIMEOUT_MS&&(e.timeoutcallbackfn(i.id,r-i.lastedtimestamp),i.lastedtimestamp=r):(i.timeoutcount++,i.worker.postMessage({command:o.WORKER_HEARTBEAT}))}))}),h.INTREVAL_TIME_MS)};i()}close(){try{this._interval&&clearTimeout(this._interval),this._interval=-1,Object.keys(this.monitorworkers).forEach((e=>{let t=this.monitorworkers[e];delete this.monitorworkers[e],t.worker.removeEventListener("message",t.listener)}))}catch(e){}}}(0,r.A)(h,"INTREVAL_TIME_MS",3e3),(0,r.A)(h,"HEART_TIMEOUT_MS",15e3),(0,r.A)(h,"MAX_HEART_TIMEOUT_MS",3e4),(0,r.A)(h,"instance",null)},4497:(e,t,i)=>{i(7205);var r=i(7162).A;e.exports=r},242:(e,t,i)=>{"use strict";i.d(t,{A:()=>w});var r=i(129),s=i.n(r),o=i(1265),a=i.n(o),n=["headset","pods","buds","opencomm","arctis","mpow","hyperx cloud","zone wired","aeropex by aftershokz","plt focus","xiberia","pxc 550","tk-hs001","lifechat lx","cisco 56"],d=[["wh-","wf-","wi-"],["1000x","ch","xb","sp","h9","c2","c5","c6","c1","h8","c4","c3"]],c={jabra:["evolve","pro 900","pro 920","pro 93","pro 94","talk","biz","engage","elite","uc voice","link 180","link 2","link 860","link 850","link 400","blueparrott"],plantronics:["savi","blackwire","c5","c3","c4","c6","c7","bt","audio","da","encorepro","hw111n","gamecom","apu","voyager"],logitech:["h570","h820","h650","pro x"],sennheiser:["sc","mb","pc","sd","dect","g4me1","audio"],sony:["wh","wf","mdr"],bose:["qc","quiet","soundlink","soundsport","on-ear","nc"],beats:["fit","flex","power","solo","studio","mivi"],razer:["kraken","blackshark","barracuda","nari","hammerhead","opus"],yealink:["uh","wh","yh","cp"],soundcore:["life","liberty","spirit","strike"],addasound:["sr","epic"],jbl:["tune","quantum","live","wave","t450bt","c200","everest","c310"],epos:["impact","pc 8 usb","h3","adapt"],jlab:["go","bt","epic","studio"]};const l=function(e){if("string"!=typeof e)return!1;let t=e.toLowerCase();for(let e=0;e<n.length;e++){let i=n[e];if(t.includes(i))return!0}let i=Object.keys(c);for(let e=0;e<i.length;e++){let r=i[e];if(t.includes(r)){let e=c[r];for(let i=0;i<e.length;i++)if(t.includes(e[i]))return!0}}let r=d[0],s=d[1],o=!1;for(let e=0;e<r.length;e++)if(t.includes(r[e])){o=!0;break}if(o)for(let e=0;e<s.length;e++)if(t.includes(s[e]))return!0;return!1};var h=i(559),u=i(9559),p=i(2689),f=i(5738),m=i(385),v=i(2543),g=i(7080),_=i(8935),S=i(9470),A=i(6603);const y=/\(\w+:\w+\)|,/gi;function C(e,t){return e.kind===t.kind?e.deviceId===t.deviceId?0:e.deviceId>t.deviceId?1:-1:e.kind>t.kind?1:-1}function E(){this._deviceList=null,this._deviceDetectTimer=null,this._lastEnumDeviceTS=null,this.enumDevices=this.enumDevices.bind(this),this.checkCanTurnOnDenoiseDirectly=this.checkCanTurnOnDenoiseDirectly.bind(this),this.addChangeListener(),this.enumDevices()}E.prototype.init=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.micId=null,this.micLabel=null,this.speakerId=null,this.speakerLabel=null,this.pendingSpeakerId=null,this.cameraId=null,this.cameraLabel=null,this.startTime=Date.now(),this.userId=0,this.videoWidth=0,this.videoHeight=0,this._wmscAudio=!1,this.isUpdatingDevice=!1,this.denoiseSwitch=!1,this._onChangeCB=e.onChangeHandler,this.mediaOPConfig=null,this.isPreviewMode=!1},E.prototype.isSupportDeviceChange=function(){return!(u.Ay.isAndroidBrowser()&&!u.Ay.browser.isFirefox)},E.prototype.addChangeListener=function(){var e,t,i,r;this.isSupportDeviceChange()?(null===(e=navigator.mediaDevices)||void 0===e||null===(t=e.removeEventListener)||void 0===t||t.call(e,"devicechange",this.enumDevices),null===(i=navigator.mediaDevices)||void 0===i||null===(r=i.addEventListener)||void 0===r||r.call(i,"devicechange",this.enumDevices)):this.enableSelfDeviceDetect()},E.prototype.enableSelfDeviceDetect=function(){this.disableSelfDeviceDetect(),this._deviceDetectTimer=setInterval(this.enumDevices.bind(this),3e3)},E.prototype.disableSelfDeviceDetect=function(){this._deviceDetectTimer&&clearInterval(this._deviceDetectTimer)},E.prototype.isDeviceChanged=function(e,t){if(null===(e=e.slice()))return!0;if((t=t.slice()).length!=e.length)return!0;s()(e).call(e,C),s()(t).call(t,C);let i=0,r=0;for(;!(i>=t.length||r>=e.length);){if(e[r].deviceId!=t[i].deviceId)return!0;i++,r++}return!1},E.prototype.enumDevices=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return A.A.enumerateDevices().then((async t=>{t=await this.filterValidDevices(t);let i=!1;this.isSupportDeviceChange()&&e?(i=!0,this.reportAllDevicesMonitorLogs(t)):null==this._deviceList?this.reportAllDevicesMonitorLogs(t):!this.isSupportDeviceChange()&&this.isDeviceChanged(this._deviceList,t)&&(this.isGrantedDeviceList(this._deviceList,"microphone")&&(i=!0),this.reportAllDevicesMonitorLogs(t));let r=this._deviceList;return this._deviceList=t,this._lastEnumDeviceTS=Date.now(),i&&this.onDeviceChange(r,t),(0,u.bD)(r,t)||function(e){try{if(Array.isArray(e)){const t={cameras:[],microphones:[],speakers:[]};e.forEach((e=>{const{kind:i,deviceId:r,label:s}=e;"videoinput"===i?t.cameras.push({label:s,deviceId:r}):"audioinput"===i?t.microphones.push({label:s,deviceId:r}):"audiooutput"===i&&t.speakers.push({label:s,deviceId:r})})),m.Ay.log("DeviceManager EnumDevices List: ".concat((0,m.hZ)(JSON.stringify(t))))}}catch(e){m.Ay.error("logDeviceList error: ",e)}}(t),this._deviceList})).catch((e=>{m.Ay.error("MediaSDK catched error while enumerateDevice: ",e)}))},E.prototype.onDeviceChange=function(e,t){(0,v.isFunction)(this._onChangeCB)&&this._onChangeCB(e,t)},E.prototype.filterValidDevices=async function(e){let t=0,i=0;const r=await this.hasPermission("microphone"),s=e.filter((e=>{let r=e.label,s=e.deviceId;return"audioinput"===e.kind?(t++,!("communications"===s||/ZoomAudioDevice/i.test(r)||/Zoom-\S*/.test(r)||/CubebAggregateDevice\S*/.test(r)||/Microsoft Teams Audio/i.test(r))):"audiooutput"!==e.kind||(i++,!u.Ay.isSafariVersionHigherThan(18.4)&&(r&&""===s&&(e.deviceId="default"),"communications"!==s&&!/ZoomAudioDevice/i.test(r)&&!/Microsoft Teams Audio/i.test(r)))}));return r&&(t||g.A.add_monitor("NoAudioInput"),!i&&((0,S.b2)(18.4)||(0,S.i$)(116)||(0,_._J)()||(0,_.UP)())&&g.A.add_monitor("NoAudioOutput")),s},E.prototype.getDeviceListAsync=async function(){return await this.enumDevices()},E.prototype.getDeviceListFromCache=function(){return this._deviceList},E.prototype.reportAllDevicesMonitorLogs=function(e){e&&e.forEach((e=>{var t;if("audioinput"==e.kind)this.sendDeviceInfo(-1,1,this.getIndex(e.label),e.deviceId,null===(t=e.label)||void 0===t||null===(t=t.replace(y,""))||void 0===t?void 0:a()(t).call(t),!0);else if("audiooutput"==e.kind){var i;this.sendDeviceInfo(-1,0,this.getIndex(e.label),e.deviceId,null===(i=e.label)||void 0===i||null===(i=i.replace(y,""))||void 0===i?void 0:a()(i).call(i),!0)}else"videoinput"===e.kind&&this.sendCameraInfo(-1,0,0,e)}))},E.prototype.notifyDenoiseSetting=function(){if(u.Ay.isSupportAudioDenoise(this.mediaOPConfig)&&this.micId){if(this._wmscAudio)this._wmscAudio.changeDenoiseSwitch(this.denoiseSwitch,b.isHeadSet(),u.Ay.getAudioDenoiseModel());else{let e={command:"audio_denoise_switch",switch:this.denoiseSwitch,isHeadSet:b.isHeadSet(),model:u.Ay.getAudioDenoiseModel()};f.Notify_Audio_Encode_Thread(e)}g.A.add_monitor("DENOISE:".concat(this.denoiseSwitch?1:0,"-").concat(this.isHeadSet()?1:0))}},E.prototype.hasValidOutputDevice=async function(e){if(""===e)return!0;let t=(await this.getDeviceListAsync()).filter((e=>"audiooutput"===e.kind));return 0!==t.length&&t.filter((t=>t.deviceId===e)).length},E.prototype.onlyHasBInDeviceOnAndroid=function(){if(u.Ay.isAndroidBrowser()){const e=new Set(["Headset earpiece","Speakerphone"]);return this._deviceList.every((t=>"audioinput"!=t.kind||"default"===t.deviceId||e.has(t.label)))}},E.prototype.changeDenoiseSwitch=function(e){this.denoiseSwitch=e,this.notifyDenoiseSetting()},E.prototype.checkCanTurnOnDenoiseDirectly=function(){this.denoiseSwitch=1===u.Ay.canAudioDenoiseOnDirectly(this.mediaOPConfig)},E.prototype.setWebRTCAudio=function(e){this._wmscAudio=e},E.prototype.hasPermission=async function(e){try{return"granted"===(await navigator.permissions.query({name:e})).state}catch(t){let i=null;if("microphone"===e)i="audioinput";else{if("camera"!==e)return!1;i="videoinput"}let r=await A.A.enumerateDevices();for(const e of r)if(e.kind===i&&""===e.label)return!1;return!0}},E.prototype.setUserId=function(e){if("number"!=typeof e||Number.isNaN(e))return;const t=this.userId>>10<<10==e>>10<<10;this.userId=e,t||this.reportAllDevicesMonitorLogs(this._deviceList)},E.prototype.updateSelectedMicDevices=function(e,t,i,r){var s;t=null===(s=t)||void 0===s||null===(s=s.replace(y,""))||void 0===s?void 0:a()(s).call(s),r&&(this.micId=e,this.micLabel=t),this.notifyDenoiseSetting(),this.reportUsingMicDevice(e,t,i,r)},E.prototype.reportUsingMicDevice=function(e,t,i,r){this.sendDeviceInfo(i,1,this.getIndex(t),e,t,r,l(t))},E.prototype.updateShareAudioDevices=function(e,t){this.sendDeviceInfo(0,2,0,e,t,!0,!1)},E.prototype.updateSelectedSpeakerDevices=async function(e,t,i){e=e||"default";let r="default";(await this.getDeviceListAsync()).forEach((t=>{var i;"audiooutput"===t.kind&&t.deviceId===e&&(r=null===(i=t.label)||void 0===i||null===(i=i.replace(y,""))||void 0===i?void 0:a()(i).call(i))})),i&&(this.speakerId=e,this.speakerLabel=r),this.sendDeviceInfo(t,0,this.getIndex(this.speakerLabel),e,r,i,this.isHeadSet(!1))},E.prototype.updateSelectedCameraDevices=function(e,t,i,r,s,o,n){var d;this.cameraId=e,this.cameraLabel=null==t||null===(d=t.replace(y,""))||void 0===d?void 0:a()(d).call(d),this.videoWidth=i,this.videoHeight=r,this.videoFrameRate=s,this.sendCameraInfo(o,n,s)},E.prototype.isHeadSet=function(){let e=null;return e=arguments.length>0&&void 0!==arguments[0]&&!arguments[0]?this.speakerLabel:this.micLabel,l(e)},E.prototype.getIndex=function(e){return"default"==e?-1:"communications"==e?u.Ay.isMac()?0:-2:0},E.prototype.sendDeviceInfo=function(e,t,i,r,s,o,a){if(!this.userId)return;let n=null,d=Date.now()-this.startTime;n=-1==e?"WCL_AUDIOD-ALL,"+this.userId+","+t+","+i+","+s+","+r+","+o+","+e+",7,"+d+",1":"WCL_AUDIOD,"+this.userId+","+t+","+i+","+s+","+r+","+o+","+e+",7,"+d+",1,"+(o?1:0)+","+a,p.A.sendMessageToRwg(h.yGo,{evt:h.UFw,seq:1,body:{data:n}})},E.prototype.sendCameraInfo=function(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!this.userId||this.isUpdatingDevice)return;let s=null;s=-1===e?"WCL_CAMERA-ALL,"+this.userId+",0,"+r.label+","+t+","+e+",-1,0,0,-1,"+i+",-1,"+r.deviceId:"WCL_CAMERA,"+this.userId+",0,"+this.cameraLabel+","+t+","+e+",-1,"+this.videoWidth+","+this.videoHeight+",-1,"+i+","+-1,p.A.sendMessageToRwg(h.yGo,{evt:h.UFw,seq:1,body:{data:s}})},E.prototype.getMicId=function(){return this.micId},E.prototype.getMicLabel=function(){return this.micLabel},E.prototype.getSpeakerId=function(){return this.speakerId},E.prototype.getPendingSpeakerId=function(){return this.pendingSpeakerId},E.prototype.setPendingSpeakerId=function(e){this.pendingSpeakerId=e},E.prototype.clearPendingSpeakerId=function(){this.pendingSpeakerId=null},E.prototype.setMediaOPConfig=function(e){this.mediaOPConfig=e},E.prototype.setPreviewMode=function(e){this.isPreviewMode=e},E.prototype.getMicDeviceIdByLabel=function(e){var t;return null===(t=this._deviceList.find((t=>"audioinput"===t.kind&&t.label==e)))||void 0===t?void 0:t.deviceId},E.prototype.isGrantedDeviceList=function(e,t){if(!e||0===e.length)return!1;let i=null;if("microphone"===t)i="audioinput";else{if("camera"!==t)return!1;i="videoinput"}for(const t of e)if(t.kind===i&&""===t.label&&""===t.deviceId&&""===t.groupId)return!1;return!0};let b=new E;const w=b},5169:(e,t,i)=>{"use strict";i.d(t,{$8:()=>n,cI:()=>c,n:()=>p,nf:()=>d});var r=i(456);function s(){this.ssrcQueueMap=new Map,s.prototype.AddQueue=function(e){var t=new r.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.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 null!==t?t.getLength():0}}var o=function(){this.frames=0,this.ntp=new r.A};o.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,i=0,r=0,s=0,o=0;o<e;o++){var a=this.ntp.dequeue();0==a&&0==r?i++:0!=a?(s=0,0==r&&(r=a),t=a):0!=r&&t!=r&&0==a&&s++}return 0==t||t==r?0:e-i-s-1!=0?(t-r)/(e-i-s-1):0}}};var a=function(){this.ssrcInfoMap=new Map};function n(){this.ssrcQueueMap=new Map,this.ssrcInfo=new a,n.prototype.AddQueue=function(e){var t=new r.A;return this.ssrcQueueMap.set(e,t),t},n.prototype.DeleteQueue=function(e){this.ssrcQueueMap.delete(e)},n.prototype.GetQueue=function(e){return this.ssrcQueueMap.get(e)},n.prototype.ClearQueue=function(){this.ssrcQueueMap.clear()},n.prototype.GetQueueData=function(e){return this.ssrcQueueMap.get(e).dequeue()},n.prototype.PutQueueData=function(e,t){this.ssrcQueueMap.get(e).enqueue(t)},n.prototype.GetQueueLength=function(e){var t=this.ssrcQueueMap.get(e);return t?t.getLength():0},n.prototype.UpdateInfo=function(e,t){this.ssrcInfo.UpdateSSRCInfo(e,t)},n.prototype.GetFpsInfo=function(e){return this.ssrcInfo.GetSSRCFpsInfo(e)}}a.prototype={UpdateSSRCInfo:function(e,t){var i=this.ssrcInfoMap.get(e);i||(i=new o,this.ssrcInfoMap.set(e,i)),i.UpdateVideoInfo(t)},GetSSRCFpsInfo:function(e){var t=this.ssrcInfoMap.get(e);return t?t.GetVideoFpsInfo():0}};var d=function(){function e(e){let{sessionid:t}=e;this.map=new Map,this.AudioQueueMGR=new s,this.timemap=new Map,this.sessionid=t||0}return 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},e}();function c(e){let{sessionid:t}=e;this.sessionid=t||0,this.map=new Map,this.VideoQueueMGR=new n}c.prototype.Add=function(e,t){this.map.set(e,t)},c.prototype.Clear=function(){this.map.clear()},c.prototype.Keys=function(){return this.map.keys()};var l=function(){this.frames=0,this.ntp=new r.A};l.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,i=0,r=0,s=0,o=0;o<e;o++){var a=this.ntp.dequeue();0==a&&0==r?i++:0!=a?(s=0,0==r&&(r=a),t=a):0!=r&&t!=r&&0==a&&s++}return 0==t||t==r?0:e-i-s-1!=0?(t-r)/(e-i-s-1):0}}};var h=function(){this.ssrcInfoMap=new Map};function u(){this.ssrcQueueMap=new Map,this.ssrcInfo=new h,u.prototype.AddQueue=function(e){var t=new r.A;return this.ssrcQueueMap.set(e,t),t},u.prototype.DeleteQueue=function(e){this.ssrcQueueMap.delete(e)},u.prototype.GetQueue=function(e){return this.ssrcQueueMap.get(e)},u.prototype.ClearQueue=function(){this.ssrcQueueMap.clear()},u.prototype.GetQueueData=function(e){return this.ssrcQueueMap.get(e).dequeue()},u.prototype.PutQueueData=function(e,t){this.ssrcQueueMap.get(e).enqueue(t)},u.prototype.GetQueueLength=function(e){var t=this.ssrcQueueMap.get(e);return t?t.getLength():0},u.prototype.UpdateInfo=function(e,t){this.ssrcInfo.UpdateSSRCInfo(e,t)},u.prototype.GetFpsInfo=function(e){return this.ssrcInfo.GetSSRCFpsInfo(e)}}function p(e){let{sessionid:t}=e;this.map=new Map,this.sQueue=new r.A,this.SharingQueueMGR=new u,this.sessionid=t||0}h.prototype={UpdateSSRCInfo:function(e,t){var i=this.ssrcInfoMap.get(e);i||(i=new l,this.ssrcInfoMap.set(e,i)),i.UpdateSharingInfo(t)},GetSSRCFpsInfo:function(e){var t=this.ssrcInfoMap.get(e);return t?t.GetSharingFpsInfo():0}},p.prototype.Clear=function(){this.map.clear()},p.prototype.Keys=function(){return this.map.keys()},p.prototype.Add=function(e,t){this.map.set(e,t)},p.prototype.Get=function(e){return this.map.get(e)},p.prototype.PutData=function(e){e&&this.sQueue&&this.sQueue.enqueue(e)},p.prototype.GetData=function(){if(this.sQueue)return this.sQueue.dequeue()},p.prototype.ClearBuffer=function(){this.sQueue&&(this.sQueue=new r.A)}},2689:(e,t,i)=>{"use strict";i.d(t,{A:()=>A});var r=i(456),s=i(385),o=i(9559),a=i(6280);const n=(0,a.A)("sdk.init");class d{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.name=e,this.handler=null,this.wasm=null,this.socket=null,this.defered=new o.cY,this.initSuccessPromise=this.defered.promise,this.wasmDefered=new o.cY,this.wasmSuccessPromise=this.wasmDefered.promise,this.handlerDefered=new o.cY,this.handlerSuccessPromise=this.handlerDefered.promise,this.socketDefered=new o.cY,this.socketSuccessPromise=this.socketDefered.promise,Promise.all([this.wasmSuccessPromise,this.handlerSuccessPromise,this.socketSuccessPromise]).then((e=>{let t=e.every((e=>!0===e));this.defered.resolve(t),t||n.error(this.name,{handler:this.handler,wasm:this.wasm,socket:this.socket})}))}setHanderSuccess(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.handler=e,this.handlerDefered.resolve(e)}setWasmSuccess(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.wasm=e,this.wasmDefered.resolve(e)}setSocketSuccess(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.socket=e,this.socketDefered.resolve(e)}checkInitSuccess(){return this.handler&&this.wasm&&this.socket}isSocketInitSuccess(){return this.socket}waitforInitSuccess(){return this.initSuccessPromise}resetHandleDeferred(){this.setHanderSuccess(!0),this.handlerDefered=new o.cY,this.handlerSuccessPromise=this.handlerDefered.promise}}class c extends d{constructor(e){super(e)}}class l extends d{constructor(e){super(e)}}class h extends d{constructor(e){super(e)}}var u=i(9482),p=i(7080),f=i(2710),m=i(559),v=i(9693);class g{constructor(){this.subscribeSet=new Set,this.shareStatusMap=new Map,this.lastPSLMixShareInfo=null,this.pslMixShareInfo=null,this.isPSLVideoHighResolution=!1}checkPSLMixShareInfo(){var e;o.Ay.isEnablePSLMixShare()&&(this.pslMixShareInfo&&0!==this.pslMixShareInfo.shared_source_id&&this.shareStatusMap.has(this.pslMixShareInfo.shared_source_id)&&!0!==(null===(e=this.shareStatusMap.get(this.pslMixShareInfo.shared_source_id))||void 0===e?void 0:e.bVideoShare)&&!this.isPSLVideoHighResolution?this.lastPSLMixShareInfo&&this.lastPSLMixShareInfo.shared_source_id===this.pslMixShareInfo.shared_source_id?this.notifyUpdatePSL():this.notifyAddPSL():this.notifyRemovePSL())}handleShareStatus(e,t){this.shareStatusMap.has(e)?!1===t.bShareOn?this.shareStatusMap.delete(e):this.shareStatusMap.set(e,Object.assign(this.shareStatusMap.get(e),t)):this.shareStatusMap.set(e,t),this.checkPSLMixShareInfo()}handlePSLMixShareInfo(e){this.pslMixShareInfo=e,this.checkPSLMixShareInfo()}handlePSLVideoSizeChange(e){this.isPSLVideoHighResolution=e,this.checkPSLMixShareInfo()}clearPSLMixShareInfo(){this.pslMixShareInfo=null,this.checkPSLMixShareInfo()}notifyUpdatePSL(){A.Notify_APPUI_SAFE(m.IWn,this.pslMixShareInfo)}notifyAddPSL(){this.lastPSLMixShareInfo=this.pslMixShareInfo,this.subscribePSLMixShare(),A.Notify_APPUI_SAFE(m.ufC,this.pslMixShareInfo)}notifyRemovePSL(){var e,t,i,r;if(!this.lastPSLMixShareInfo||!this.lastPSLMixShareInfo.shared_source_id)return;const s=A.isSupportVideoShare?A.localVideoDecMGR:A.localSharingDecMGR;null===(r=null===(i=null===(t=null===(e=null==s?void 0:s.map)||void 0===e?void 0:e.get)||void 0===t?void 0:t.call(e,A.SPECIAL_ID))||void 0===i?void 0:i.postMessage)||void 0===r||r.call(i,{command:v.RESET_PSL_SHARING_FIRST_FRAME,message:{ssrc:this.lastPSLMixShareInfo.shared_source_id}}),A.shareFirstFrameMap.delete(this.lastPSLMixShareInfo.shared_source_id),this.unsubscribePSLMixShare(),A.Notify_APPUI_SAFE(m.VeG,this.lastPSLMixShareInfo),this.lastPSLMixShareInfo=null}subscribePSLMixShare(){this.subscribeSet.has(this.pslMixShareInfo.shared_source_id)||(this.subscribeSet.add(this.pslMixShareInfo.shared_source_id),A.sendMessageToRwg(m.yJV,{evt:m.iyU,body:{id:this.pslMixShareInfo.shared_source_id,size:1,bVideoShare:!1}}))}unsubscribePSLMixShare(){this.subscribeSet.has(this.lastPSLMixShareInfo.shared_source_id)&&(this.subscribeSet.delete(this.lastPSLMixShareInfo.shared_source_id),A.sendMessageToRwg(m.yJV,{evt:m.nVA,body:{id:this.lastPSLMixShareInfo.shared_source_id}}))}}const _=(0,a.A)("sdk.variables");function S(){this.crashCount=0,this.crashLastTime=0,this.AEW=null,this.ADW=null,this.AEWF=null,this.ADWF=null,this.VE=null,this.VD=null,this.SE=null,this.SD=null,this.VEMTimes=0,this.VEMEMERRTimes=0,this.VDMTimes=0,this.VDMEMERRTimes=0,this.SEMTimes=0,this.SDMTimes=0,this.extVBPort=null,this.frameSent=0,this.frameReceived=0,this.audioBridgeFailoverTimeList=[],this.audioBridgeFallback2Wasm=!1,this.browserFeaturedefer=new o.cY,this.browserFeature=null,this.timeOrigin=0,this.activeSdkInstances=0,this.isLSSPlayer=!1,this.isDesktopMode=!1,this.enableStreamingInstantiate=!1,this.enableMultiDecodeVideoWithoutSAB=!1,this.enableVirtualBackgroundWithoutSAB=!1,this.isGoogleMeetMode=!1,this.isVDIWebview=!1,this.mobileForceAutoChooseAudioDevice=!1,this.enableCloneAudioStream=!1,this.uplimit=0,this.webtransportPort=0,this.webrtcVideoInited=!1,this.hasUsedWebrtc=!1,this.hasUsedWebRTCAudio=!1,this.audioSolution="",this.hasWasmMemoryError=!1,this.hasAudioMemoryError=!1}S.prototype.initDB=function(){let e,t={},i=this;t.init=function(r){if(this.db_name=r.db_name,this.db_version=r.db_version,this.db_store_name=r.db_store_name,indexedDB){try{e=indexedDB.open(this.db_name,this.db_version)}catch(e){return s.Ay.error("Error opening IndexedDB",e),void(i.indexDbObject=null)}e.onerror=function(e){i.indexDbObject=null},e.onupgradeneeded=function(e){this.db=e.target.result,this.db.createObjectStore(t.db_store_name)},e.onsuccess=function(e){t.db=e.target.result,i.openIndexFlag=!0,i.indexDbObject.select("delay")}}else i.indexDbObject=null},t.put=function(e,i){try{var r=t.db.transaction(t.db_store_name,"readwrite").objectStore(t.db_store_name).put(e,i);r.onsuccess=function(){},r.onerror=function(e){s.Ay.error("Set Delay failed!",e)}}catch(e){s.Ay.error("IndexDb put Failed!",e)}},t.delete=function(i){e=t.db.transaction(t.db_store_name,"readwrite").objectStore(t.db_store_name).delete(i),e.onsuccess=function(){_("Delete the key:"+i)}},t.select=function(e){try{var r,o=t.db.transaction(t.db_store_name,"readwrite").objectStore(t.db_store_name);(r=e?o.get(e):o.getAll()).onsuccess=function(){i.audioDelay=r.result},r.onerror=function(){i.audioDelay=0}}catch(e){s.Ay.error("IndexDb Select Failed",e)}},t.clear=function(){t.db.transaction(t.db_store_name,"readwrite").objectStore(t.db_store_name).clear().onsuccess=function(){_("Clear the IndexDb Successfully")}},t.close=function(){t.db&&t.db.close()},this.indexDbObject=t,this.indexDbObject.init({db_name:"AEC",db_version:1,db_store_name:"delay"})},S.prototype.Notify_APPUI_SAFE=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];if("number"==typeof e||"string"==typeof e)i=arguments;else if(e!==this.instance)return;this._Notify_APPUI&&(_("Notify_APPUI_SAFE",i),this._Notify_APPUI.apply(this,i),this._callbackList.forEach((e=>e.apply(this,i))))},S.prototype.Notify_APPUI=S.prototype.Notify_APPUI_SAFE,S.prototype.queueMessageToRwg=function(e,t){this.rwgMessageList.push({jsEvent:e,message:t})},S.prototype.clearMessageToRwg=function(){p.A.startSend(),this.rwgConnectSuccess=!0,this.rwgMessageList.length>0&&(this.rwgAgent||this._Notify_APPUI)&&(this.rwgMessageList.forEach((e=>{let{jsEvent:t,message:i}=e;this.sendMessageToRwg(t,i,!1,!1)})),this.rwgMessageList=[])},S.prototype.destroyQueueMessageToRwg=function(){this.rwgConnectSuccess=!1,this.rwgMessageList=[]},S.prototype.sendMessageToRwg=function(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(this.rwgConnectSuccess&&(this.rwgAgent||this._Notify_APPUI)||!i){this.rwgConnectSuccess&&r&&this.clearMessageToRwg();try{this.rwgAgent?this.rwgAgent.sendMessageToRwg(t):this.Notify_APPUI_SAFE(e,t)}catch(e){s.Ay.error("Error sending message to RWG",e)}}else this.queueMessageToRwg(e,t)},S.prototype.reinit=function(e){this.instance=e,this.SPECIAL_ID=0,this._callbackList=[],this._Notify_APPUI=null,this.localAudioDecMGR=null,this.localVideoDecMGR=null,this.localAudioEncMGR=null,this.localVideoEncMGR=null,this.localSharingDecMGR=null,this.localMouseDecMGR=null,this.localSharingEncMGR=null,this.localAudioPara=null,this.localVideoPara={},this.localSharingPara=null,this.Audio_WebSocket_Ip_Address=null,this.Audio_Web_Transport_Ip_Address=null,this.Video_WebSocket_Ip_Address=null,this.Video_Web_Transport_Ip_Address=null,this.Sharing_WebSocket_Ip_Address=null,this.mediaSDKHandle=null,this.audio_pcm_queue=new r.A,this.int16Array=null,this.isInitialFailed=!1,this.isAudioEncodeWASMOK=!1,this.isAudioDecodeWASMOK=!1,this.isVideoEncodeWASMOK=!1,this.isVideoDecodeWASMOK=!1,this.isSharingDecodeWASMOK=!1,this.isSharingEncodeWASMOK=!1,this.audioEncWorkerPath="",this.audioDecWorkerPath="",this.videoDecWorkerPath="",this.videoEncWorkerPath="",this.sharingDecWorkerPath="",this.sharingEncWorkerPath="",this.audioEncodeSession=null,this.audioDecodeSession=null,this.videoDecodeSession=null,this.videoEncodeSession=null,this.sharingDecodeSession=null,this.sharingEncodeSession=null,this.isAudioEncodeThreadStart=!1,this.isAudioDecodeThreadStart=!1,this.isVideoDecodeThreadStart=!1,this.isSharingDecodeThreadStart=!1,this.isVideoEncodeThreadStart=!1,this.isSharingEncodeThreadStart=!1,this.isAudioPlayWork=!1,this.isVideoPlayWork=!1,this.isSharingPlayWork=!1,this.shareBufferSampleNumb=30,this.audioWasmInfo=null,this.initialSuccessNumb=0,this.TotalWaitEvent=0,this.audioPostInterval=null,this.sharedBuffer=null,this.decoderinworklet=null,this.decoderinworkletOP=null,this.shareSystemAudio=!1,this.indexDbObject=null,this.audioDelay=0,this.openIndexFlag=!1,this.audioBufferSize=o.Ay.browser.isFirefox?30:15,this.monitorIntervalHandle=null,this.recvStatsMapIntervalHandle=null,this.e2eencrypt=!1,this.AudioNode=null,this.SharingAudioNode=null,this.CurrentSSRC=0,this.CurrentSSRCTime=0,this.audioPlayTime=0,this.ccSpeakingLang=null,this.videoDecResponseText=null,this.videoEncResponseText=null,this.sharingDecodeResponse=null,this.sharingEncodeResponse=null,this.sharingDecInitInstance=new c(u._c.SHARING_DECODE),this.sharingEncInitInstance=new c(u._c.SHARING_ENCODE),this.videoDecInitInstance=new l(u._c.VIDEO_DECODE),this.videoInitInstance=new l(u._c.VIDEO_ENCODE),this.audioDecInitInstance=new h(u._c.AUDIO_DECODE),this.audioEncodeInitInstance=new h(u._c.AUDIO_ENCODE),this.audioDecodeResponse=null,this.audioEncodeResponse=null,this.ivObj={},this.userNodeList=[],this.rwgAgent=null,this.ComputerAudioStatus=u.BX.ComputerAudio_Null,this.DesktopAudioStatus=u.BX.DesktopAudio_Null,this.initDB(),this.resourceManager=null,this.vbarraybuffer=null,this.vbbin=null,this.vbjson=null,this.tfjsurl=null,this.afnbin=null,this.afnjson=null,this.basebin=null,this.basejson=null,this.workletMessageQueue=new r.A,this.workletWasmInitSuccess=!1,this.videoEncodeInitSuccess=null,this.vbPreloadSuccess=null,this.enableAduioBridge=!1,this.audioMode=-1,this.enableEchoDetection=0,this.enableHADecOpt=!1,this.enableSafariHWCodec=0,this.enable360pHWDec=!1,this.enable360pHWEnc=!1,this.enableAndroidHWDec=!1,this.enableAndroidHWEnc=!1,this.disableHWCodec=0,this.enableOptCopyFrame=0,this.enableTransferDataChannel=0,this.hwEncAdditionalConfig=f.gg[0],this.hwEncAddConIdx=0,this.HWEncEnableL1T1=0,this.supportHWEncRetry=!1,this.hwEncRetryConIdx=f.gg.length-1,this.hwEncRetryConfig=f.gg[f.gg.length-1],this.enableCanvasAlphaChannel=!0,this.enableWebrtcTurnServer=!1,this.enablemesh=0,this.mesh_node=0,this.supportAVSimultaneousFallback=!1,this.VEMTimes=0,this.VDMTimes=0,this.SEMTimes=0,this.SDMTimes=0,this.isPreviewMode={audioEncode:!1,audioDecode:!1,videoEncode:!1,videoDecode:!1},this.rwgConnectSuccess=!1,this.rwgMessageList=[],this.localSsrc=0,this.frameSent=0,this.frameReceived=0,this.shouldKeepAVWhenFailover={waitingRoom:!1},this.hasWatermark=!1,this.pslMixShareInfo=null,this.pslVideoId=0,this.isPSLVideoHighResolution=!1,this.lastStatsLogs={videoSendStats:null,videoRecvStats:new Map,sharingSendStats:null,sharingRecvStats:null,audioSendStats:null,audioRecvStats:new Map},this.enableFetchWithCache=1,this.mediaSDKCDNPath="",this.shareFirstFrameMap=new Map,this.pslMixShareManager=new g,this.isSupportVideoShare=!1};const A=new S},3578:(e,t,i)=>{"use strict";i.d(t,{A:()=>r});const r=class{_drawWatermarkWithShadow(e){let{ctx:t,textPos:i,opacity:r,name:s}=e;t.fillStyle="rgba(0, 0, 0, ".concat(r,")"),t.fillText(s,i.x,i.y),t.fillStyle="rgba(255, 255, 255, ".concat(r,")"),t.fillText(s,i.x+1,i.y+1)}_getTransformInfo(e){let t,{canvas:i,position:r}=e;if(1===r)t={x:i.width/2,y:0,rateRadio:0,maxWidth:i.width};else if(2===r)t={x:i.width/2,y:i.height,rateRadio:0,maxWidth:i.width};else if(4===r)t={x:0,y:i.height/2,rateRadio:Math.PI/2,maxWidth:i.height};else if(8===r)t={x:i.width,y:i.height/2,rateRadio:-Math.PI/2,maxWidth:i.height};else{const e=-21*Math.PI/180;t={x:i.width/2,y:i.height/2,rateRadio:e,maxWidth:Math.min(i.width/Math.cos(e),-i.height/Math.sin(e))}}return t.maxWidth>100&&(t.maxWidth-=50),t}_calcTextPos(e){let{position:t,ctx:i,name:r,textWidth:s}=e;const o=this._getPaddingWidth({ctx:i,position:t,name:r});return 1===t?{x:-s.width/2,y:o}:2===t||4===t||8===t?{x:-s.width/2,y:-o}:{x:-s.width/2,y:i.measureText(r[0]).width/2}}_getPaddingWidth(e){let{ctx:t,position:i,name:r}=e;return[1,2,4,8].includes(i)?32:t.measureText(r[0]).width}_setBaseLine(e){let{ctx:t,position:i}=e;t.textBaseline=1===i?"top":2===i||4===i||8===i?"bottom":"middle"}Get_WaterMarkRGBA(e){let{canvas:t,name:i,width:r,height:s,opacity:o=.15,position:a,convertToDataUrl:n=!1,transferToImage:d=!1}=e;if(!i||!r||!s)return;o=o||.15,r*=1,s*=1,t.width=r,t.height=s;let c=this._getTransformInfo({canvas:t,position:a});var l=t.getContext("2d");let h;if(l.clearRect(0,0,t.width,t.height),l.translate(c.x,c.y),l.rotate(c.rateRadio),this._setBaseLine({ctx:l,position:a}),l.lineWidth=1,l.imageSmoothingEnabled=!0,1==i.length){const e=c.maxWidth/i.length;l.font=e+"px 'Segoe UI'",h=l.measureText(i)}else{let e=16;for(l.font=e+"px 'Segoe UI'",h=l.measureText(i);h.width<c.maxWidth-2*this._getPaddingWidth({ctx:l,position:a,name:i});)e+=1,l.font=e+"px 'Segoe UI'",h=l.measureText(i);if(h.width>c.maxWidth-2*this._getPaddingWidth({ctx:l,position:a,name:i}))if(e>16)e-=1,l.font=e+"px 'Segoe UI'",h=l.measureText(i);else{const e=i;for(;i.length>5&&h.width>c.maxWidth-2*this._getPaddingWidth({ctx:l,position:a,name:i+"..."});)i=i.slice(0,i.length-1),h=l.measureText(i+"...");e!==i&&(i+="...")}}const u=this._calcTextPos({position:a,ctx:l,name:i,textWidth:h});var p;if(this._drawWatermarkWithShadow({ctx:l,name:i,opacity:o,textPos:u}),n)p=t.toDataURL();else if(d)p=t.transferToImageBitmap();else{var f=l.getImageData(0,0,l.canvas.width,l.canvas.height);p=new Uint8Array(f.data.buffer)}return l.rotate(-c.rateRadio),l.translate(-c.x,-c.y),p}Get_Repeated_WaterMarkRGBA(e){let{canvas:t,name:i,width:r,height:s,opacity:o=.15,position:a,convertToDataUrl:n=!1,transferToImage:d=!1}=e;if(!i||!r||!s)return;o=o||.15,r*=1,s*=1,t.width=r,t.height=s;const c=t.getContext("2d");c.clearRect(0,0,t.width,t.height),c.translate(r/2,s/2),c.rotate(-21*Math.PI/180),c.imageSmoothingEnabled=!0,c.font="".concat(32,"px 'Segoe UI'"),c.textBaseline="top";const l=c.measureText(i),h=.37*l.width;let u,p=0,f=-s;do{let e=p%2==0?h-r:-r;do{c.fillStyle="rgba(0, 0, 0, ".concat(o,")"),c.fillText(i,e,f),c.fillStyle="rgba(255, 255, 255, ".concat(o,")"),c.fillText(i,e+1,f+1),e+=l.width+h}while(e<r);f+=32+h,p++}while(f<s);if(n)u=t.toDataURL();else if(d)u=t.transferToImageBitmap();else{const e=c.getImageData(0,0,c.canvas.width,c.canvas.height);u=new Uint8Array(e.data.buffer)}return c.rotate(21*Math.PI/180),c.translate(-r/2,-s/2),u}}},7080:(e,t,i)=>{"use strict";i.d(t,{A:()=>d});var r=i(559),s=i(2689),o=i(385);const a={AEWF:"Audio encode WASM failed to download/compile",ADWF:"Audio decode WASM failed to download/compile",VDWF:"Video decode WASM failed to download/compile",VEWF:"Video encode WASM failed to download/compile",SEWF:"Sharing encode WASM failed to download/compile",SDWF:"Sharing decode WASM failed to download/compile",MWCGLF:"WebGL context failed to be restored",VCFF:"Captured video format is not supported",SHHF:"Initialization of sharing decode WASM failed",SDSF:"Sharing decode WebSocket failed to connect after 10 attempts",SEHF:"Initialization of sharing encode WASM failed",SESF:"Sharing encode WebSocket failed to connect after 10 attempts",ADHF:"Initialization of audio decode WASM failed",ADSF:"Audio decode WebSocket failed to connect after 10 attempts",AEHF:"Initialization of audio encode WASM failed",AESF:"Audio encode WebSocket failed to connect after 10 attempts",VDHF:"Initialization of video decode WASM failed",VDSF:"Video decode WebSocket failed to connect after 10 attempts",VEHF:"Initialization of video encode WASM failed",VESF:"Video encode WebSocket failed to connect after 10 attempts",INITVDCERR:"An error occurred when initializing video WebRTC DataChannel",INITADCERR:"An error occurred when initializing audio WebRTC DataChannel"},n=["VCAPTURE","VFCLOSE","VDCS","CPU","VDCR","ADCS","ADCR","VCFOK","VCTN","ABRTT"],d=function(){function e(){this.base_time=null,this.monitor="",this.last_get_monitor_time=0,this.checkIsNecessaryLogMap=new Map,this.highfrequencyerror=new Map,this.startSendLog=!1}return e.prototype={init:function(){this.base_time||(this.base_time=(new Date).getTime(),this.checkIsNecessaryLogMap=new Map,this.sendBaseTime())},sendBaseTime:function(){this.add_monitor("STARTMONITOR"+this.base_time)},need_to_flush_log:function(e){return e&&("F"==e[e.length-1]||"f"==e[e.length-1])&&this.startSendLog},append_to_monitor:function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e)try{const i=2e3;this.monitor&&this.monitor.length+e.length>i&&this.send_instant_monitor(),this.monitor?this.monitor+=e:this.monitor=e,t&&this.send_instant_monitor()}catch(e){o.Ay.error("Error when adding data to the monitor log",e)}},add_monitor:function(e,t){if(this.base_time||this.init(),e&&this.checkLogValidity(e))try{if(a[e]){let i=a[e];t&&(i="".concat(i,". Additional information: ").concat(t)),o.Ay.error(i)}let i=(new Date).getTime()-this.base_time,r=e+"("+Math.ceil(i)+")",s=this.need_to_flush_log(e);this.append_to_monitor(r,s)}catch(e){o.Ay.error("Error when adding data to the monitor log",e)}},get_monitor:function(){let e=this.monitor,t=(new Date).getTime();return null!=e&&(e.length>80||t-this.last_get_monitor_time>180)?(this.last_get_monitor_time=t,this.monitor=null,"WCL_M, "+e):""},get_instant_monitor:function(){let e=this.monitor;return this.monitor=null,e?"WCL_M, "+e:null},send_instant_monitor:function(){let e=this.get_instant_monitor();e&&s.A.sendMessageToRwg(r.yGo,{evt:r.UFw,seq:1,body:{data:e}})},send_monitor_directly:function(e){e&&this.checkLogValidity(e)&&s.A.sendMessageToRwg(r.yGo,{evt:r.UFw,seq:1,body:{data:e}})},add_monitor2(e){if(this.base_time||this.init(),e&&this.checkLogValidity(e)){let t=e+"("+((new Date).getTime()-this.base_time)+")";this.append_to_monitor(t)}},add_monitor3(e){this.base_time||this.init(),e&&this.checkLogValidity(e)&&(this.highfrequencyerror[e]?this.highfrequencyerror[e]+=1:this.highfrequencyerror[e]=1,(0,o.ZN)(this.highfrequencyerror[e])&&this.add_monitor(e,"Occurred ".concat(this.highfrequencyerror[e]," times")))},checkIsNecessaryExceptionLogAndReturnRepeatTimes(e){let t=!0,i=0;try{return this.checkIsNecessaryLogMap.get(e)&&this.checkIsNecessaryLogMap.get(e)%100!=0&&(t=!1),i=this.checkIsNecessaryLogMap.get(e),{isNecessary:t,repeatNumber:void 0===i?0:i}}catch(e){return{isNecessary:!0,repeatNumber:0}}finally{let t=this.checkIsNecessaryLogMap.get(e)||0;if(this.checkIsNecessaryLogMap.set(e,t+1),this.checkIsNecessaryLogMap.size>200){let e=Array.from(this.checkIsNecessaryLogMap.keys()).slice(0,20);console.log("delete log cache keys",e),e.forEach((e=>this.checkIsNecessaryLogMap.delete(e)))}}},reset(){this.base_time=null,this.last_get_monitor_time=0,this.monitor="",this.highfrequencyerror.clear()},startSend(){this.startSendLog=!0},checkLogValidity(e){return!!this.startSendLog||!n.some((t=>-1!==e.indexOf(t)))}},new e}()},8516:(e,t,i)=>{"use strict";i.d(t,{X:()=>s});var r=i(7857);class s{constructor(){}static addRenderCanvas(e,t){s.canvasMap.get(e)==t&&null!=t||s.canvasMap.set(e,t)}static getCanvas(e){return s.canvasMap.get(e)}static rmCanvas(e){s.canvasMap.delete(e)}}(0,r.A)(s,"canvasMap",new Map)},7355:(e,t,i)=>{"use strict";i.d(t,{Ek:()=>d});var r=i(7857);class s{constructor(){this.rotation=0,this.mirror=!1,this.fillmode=!1,this.context=null,this.canvas=null}initRender(e){this.canvas=e.canvas,this.context=this.canvas.getContext("2d",{alpha:!1}),this.canvas.width=e.width||1,this.canvas.height=e.height||1}drawFromCanvas(e,t){let i=this.context,r=this.canvas.height,s=this.canvas.width,o=t.x,a=t.y,n=t.width,d=t.height;i.drawImage(e,o,a,n,d,0,0,s,r)}draw(e,t){let i=this.context,r=this.canvas.height,s=this.canvas.width,o=0,a=0,n=t.width,d=t.height;if(1==this.rotation||3==this.rotation){let e=r;r=s,s=e}let c=s,l=r;this.fillmode?n*r>s*d?(c=Math.floor(r*n/d),o=s-c>>1):n*r<s*d&&(l=Math.floor(s*d/n),a=r-l>>1):n*r>s*d?(c=s,l=Math.floor(c*d/n),a=r-l>>1):n*r<s*d&&(l=r,c=Math.floor(l*n/d),o=s-c>>1),i.drawImage(e,o,a,c,l)}setRotation(e){this.rotation!=e&&(this.rotation=e,this._transform())}setMirror(e){let t=!!e;this.mirror!=t&&(this.mirror=t,this._transform())}setFillModel(e){let t=!!e;this.fillmode!=t&&(this.fillmode=t,this._transform())}setCanvasSize(e,t){this.canvas.width==e&&this.canvas.height==t||(this.canvas.width=e,this.canvas.height=t,this._transform())}_transform(){let e=this.context,t=this.canvas.width,i=this.canvas.height;switch(this.rotation){case 0:this.mirror?(e.setTransform(-1,0,0,1,0,0),e.translate(-t,0)):(e.setTransform(1,0,0,1,0,0),e.translate(0,0));break;case 1:this.mirror?e.setTransform(0,1,1,0,0,0):(e.setTransform(0,1,-1,0,0,0),e.translate(0,-t));break;case 2:this.mirror?(e.setTransform(1,0,0,-1,0,0),e.translate(0,-i)):(e.setTransform(-1,0,0,-1,0,0),e.translate(-t,-i));break;case 3:this.mirror?(e.setTransform(0,-1,-1,0,0,0),e.translate(-i,-t)):(e.setTransform(0,-1,1,0,0,0),e.translate(-i,0))}}}var o=i(8516);class a{constructor(e,t){this.id="screenshot_canvas_".concat(Date.now()),this.isoffscreencanvas=t,this.view=new s,this.view.initRender({canvas:e,width:1,height:1}),this.canvas=e,this.screenshottask=[]}_buildPNG(){return this.isoffscreencanvas?this.canvas.convertToBlob({type:"image/png"}):new Promise(((e,t)=>{try{this.canvas.toBlob((t=>{e(t)}))}catch(e){t(e)}}))}destroy(){this.view=null,this.canvas=null,this.screenshottask.forEach((e=>{e.cancel()})),this.screenshottask.clear()}async captureFromVideoTag(e,t){let i=t.width,r=t.height;return this.view.setMirror(t.mirror),this.view.setRotation(t.rotation),this.view.setCanvasSize(i,r),this.view.draw(e,t),await this._buildPNG()}async captureFromCanvas(e,t){const{displayWidth:i,displayHeight:r}=t;return this.view.setCanvasSize(i,r),this.view.setMirror(t.mirror),this.view.setRotation(t.rotation),this.view.drawFromCanvas(e,t),await this._buildPNG()}createTask(e){let t=new n(this);return this.screenshottask.push(t),t.run(e),t}async setTaskResult(e){let t=this.screenshottask.findIndex((t=>t.id==e.id));if(-1==t)return;let[i]=this.screenshottask.splice(t,1);try{if(!e.success)return void i.error("capture failed");let t=o.X.getCanvas(e.data.canvasId),r=await this.captureFromCanvas(t,e.data.options);i.setResult(r)}catch(e){i.error(e)}}}(0,r.A)(a,"target",null);class n{constructor(){this.resolve=null,this.reject=null,this.promise=null,this.id=Date.now(),this.ended=!1}error(e){this.ended||(this.ended=!0,this.reject(e))}cancel(){this.ended||(this.ended=!0,this.reject("cancel"))}setResult(e){this.ended||(this.ended=!0,this.resolve(e))}get(){return this.promise}run(e){let t=this;this.promise=new Promise(((i,r)=>{t.resolve=i,t.reject=r,e.call(null,t.id)}))}}function d(){if(!a.target){let e="function"==typeof OffscreenCanvas,t=null;t=e?new OffscreenCanvas(1,1):document.createElement("canvas"),a.target=new a(t,e)}return a.target}},4666:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>I});var r=i(9559),s=i(385),o=i(2689),a=i(559),n=i(4543),d=i(7080),c=i(5738),l=i(3323),h=i(2710),u=i(5999),p=i(9338),f=i(242),m=i(3472),v=i(9482),g=i(9373),_=i(3656),S=i(5723),A=i(8935),y=i(5803),C=i(6603);const E=!1;let b=E;const w=(e,t)=>{b===E&&d.A.add_monitor("AB"+e)},R=512,T={bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",iceServers:[],iceTransportPolicy:"all"};class I{constructor(e,t,i,r,s,o,a,n,d){this.callback=n,this.probe=d,b=!!d||E,this.publisherCandidate=[],this.subscriberCandidate=[],this.retry=0,this.retryPublish=0,this.cid=e,this.userId=t,this.wsUrl=i,this.audioPlayerMap=new Map,this.isRetrying=!1,this.recvOnly=!!r,this.audioStream=null,this.audioStreamCloning=null,this.shareAudioStream=null,this.monitorTimer=null,this.audioReportCount=0,this.monitorTimerDuration=1e3,this.monitorInfo={subscriber:{},publisher:{}},this.bitrateInfo={subscriber:{},publisher:{}},this.muted=!1,this.audioMuteStatus=new Map,this.ssrcUserIdMap=new Map,this.published=!1,this.joinAudioAfterConnect=!1,this.audioMode=h.DY,this.codecDoAVSync=!!s,this.normalAudioMap=new Map,this.shareAudioMap=new Map,this.audioProfile=h.yu,this.syncTimer=null,a&&!this.probe&&(this.webRTCWorkletManager=new p.v(this.setNormalAudioStream.bind(this),a)),this.hasPaused=!1,this.recoverAfter1s=null,this.playFailedTimeout=null,this.hasReportedPlayFailed=!1,this.useWebRTCOnDesktop=o,this.receiveAudioStatus=new Map,document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&this.triggerPlayerHealthCheck(h.vr.VISIBILITY_CHANGE)})),this.leaveTime=0,this.noPacketsCount=0,this.lastSentPackets=0,this.useIceServers=!1,this.iceServers=[],this.isAudioSentBytesZero=!1,this.healthCheckFailed=!1,this.audioSpeakerSetErrorCnt=0,this.publishPCPromise=new S.cY,this.subscribPCPromise=new S.cY,this.iceRestartTask=null,this.iceRestartTimeList=[],this.stopIncomingAudioFlag=!1,this.startDTLSTime=0,this._isMutedBySystem=!1,this.isAudioPlayerError=!1,this.audioPlayerErrorCounter=new Map,this.lastAudioTagCountAndStatusCheckTime=0,this.healthChecker=new y.A({webrtcAudio:this,onAudioEnergyReceivedCheckResult:this.onAudioEnergyReceivedCheckResult.bind(this)})}getAudioMode(){return this.audioMode}getAudioStream(){return this.getFinalSentAudioStream()}get isMutedBySystem(){return this._isMutedBySystem}set isMutedBySystem(e){this.webRTCWorkletManager&&(this.webRTCWorkletManager.isMutedBySystem=e),this._isMutedBySystem=e}setIceServers(e){this.iceServers=e||[]}setUseIceServers(e){this.useIceServers=e}triggerPlayerHealthCheckSuccessCallback(e){this.hasPaused=!1,this.playFailedTimeout&&(clearTimeout(this.playFailedTimeout),this.playFailedTimeout=null),this.hasReportedPlayFailed&&(s.Ay.directReport("triggerPlayerHealthCheck success-".concat(e)),this.notifyUIMessage(a.raw,h.Fu),this.hasReportedPlayFailed=!1)}triggerPlayerHealthCheckFailedCallback(e,t){this.hasPaused=!0,w("REA:".concat(e)),this.playFailedTimeout||(this.playFailedTimeout=setTimeout((()=>{s.Ay.error("Error when triggerPlayerHealthCheck-".concat(e,": "),t),this.notifyUIMessage(a.raw,h.K_),this.hasReportedPlayFailed=!0,this.playFailedTimeout=null}),1e3))}triggerPlayerHealthCheck(e){this._isMutedBySystem||this.hasPaused&&this.audioMode&&this.healthChecker._audioTagCountAndStatusMonitor(this.subscriber,this.audioPlayerMap,!1,this.triggerPlayerHealthCheckSuccessCallback.bind(this,e),this.triggerPlayerHealthCheckFailedCallback.bind(this,e))}handleAudioPlayerError(e){if(!this.audioMode||!e)return;const t=(this.audioPlayerErrorCounter.get(e)||0)+1;if(this.audioPlayerErrorCounter.set(e,t),this.isAudioPlayerError=!0,s.Ay.error("MEDIA_ELEMENT_ERROR: ".concat(e,"-").concat(t)),e==h.Rs.MEDIA_ERR_DECODE&&t<=3){const e=Array.from(this.audioPlayerMap.values());e.forEach((e=>{e.pause(),e.setSrcObject(null)})),e.forEach((e=>{e.setSrcObject(e.mediaStream)})),this.hasPaused=!0,this.triggerPlayerHealthCheck(h.vr.AUDIO_ERROR)}else(0,_.iK)(a.BJf)}onAudioEnergyReceivedCheckResult(e){e?(this.isAudioPlayerError=!1,s.Ay.directReport("HEALTH_CHECK_RESTORED:RECEIVE_AUDIO_ENERGY_ZERO"),w("HEALTH_CHECK_RESTORED:RECEIVE_AUDIO_ENERGY_ZERO")):(this.isAudioPlayerError=!1,s.Ay.directReport("HEALTH_CHECK_FAILED:RECEIVE_AUDIO_ENERGY_ZERO"),w("HEALTH_CHECK_FAILED:RECEIVE_AUDIO_ENERGY_ZERO"))}async reconnect(e){if(!this.isRetrying&&!this.isDestroyed){if(this.stopAVSyncTimer(),this.stopAudioQualityMonitorTimer(),this.destroySocketAndWebRtcConnect(!0),this.retry>=3)return this.isRetrying=!1,s.Ay.error("Audio Bridge failed to reconnect",e),void this.notifyUIMessage(a.ScD);this.isRetrying=!0,await r.Ay.sleep(1e3),this.isDestroyed||(w("JOIN"+this.retry),this.retry++,this.notifyUIMessage(a.JoO),await this.join(!0),this.isRetrying=!1)}}async join(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:h.DY;if(i===h.qR)try{var n,d,c;this.cleanUserEventListener||(this.cleanUserEventListener=(0,r.zV)((()=>{this.triggerPlayerHealthCheck(h.vr.USER_CLICK)}))),null===(n=this.webRTCWorkletManager)||void 0===n||n.createWebRTCWorklet(),null===(d=this.webRTCWorkletManager)||void 0===d||d.changeAudioStatus(!1,!1),null===(c=this.webRTCWorkletManager)||void 0===c||c.startCheckProcess()}catch(e){s.Ay.error("Error when creating webRTCWorklet",e)}var l;if(this.audioMode=this.audioMode|i,this.signal)return i!=h.DY&&(this.startAVSyncTimer(),this.startAudioQualityMonitorTimer(),(null===(l=this.signal.socket)||void 0===l?void 0:l.readyState)===WebSocket.OPEN&&this.signal.notify("audiostatus",{status:this.audioMode})),void(i===h.qR&&this.unmuteAllRemoteAudio());if(!e&&this.isRetrying)return void this.destroySocketAndWebRtcConnect(e);this.destroySocketAndWebRtcConnect(e),this.signal=new D,this.audioMode&&this.startAVSyncTimer();try{let e;t?e=t:(w("RTK"),o.A.sendMessageToRwg(a.NPX,{evt:a.rt8},!1),e=await this.waitForTokenFromRWG(a.gh2.AUDIO_BRIDGE_WS_TOKEN),w("TK")),this.signal.init("".concat(this.wsUrl,"&token=").concat(e,"&").concat(this.probe?"prob=1":"prob=0"))}catch(e){this.reconnect(e)}this.signal.onopen((async e=>{this.audioMode&&(this.signal.notify("audiostatus",{status:this.audioMode}),this.startAudioQualityMonitorTimer()),this.isOpen=!0,this.retryPublish=0,this.clearAudioPlayerMap(),await this.publish(),this.retry=0,this.audioMode&&this.notifyUIMessage(a.ETO)})),this.signal.onclose((e=>{!this.audioMode&&Date.now()-this.leaveTime>=15e3?(this.signal.destroy(),this.signal=null,this.reconnect(e)):(s.Ay.error("socket close, notify UI failover: "+h.dv),this.notifyUIMessage(a.oQY))})),this.signal.onerror((e=>{this.isOpen||s.Ay.error("Audio Bridge WebSocket open error"),!this.audioMode&&Date.now()-this.leaveTime>=15e3?(this.signal.destroy(),this.signal=null,this.reconnect(e)):(s.Ay.error("socket error, notify UI failover: "+h.BY),this.notifyUIMessage(a.oQY))})),this.signal.onmessage((e=>{if("closing"===e.method){let t=e.params.reason;if(t===h.c7?t="0"+(this.publisher.firstConnected?"1":"0"):t===h.y&&(t="1"+(this.subscriber.firstConnected?"1":"0")),("00"===t||"10"===t)&&this.iceServers.length&&!this.useIceServers)return this.setUseIceServers(!0),this.reconnect(t),!0;s.Ay.error("received closing from audioBridge, notify UI failover: "+t);const i="00"===t||"10"===t||this.isIceRestartOutofLimit();return this.notifyUIMessage(a.oQY,{audio:i?h.nm:0,video:0}),("00"==t||"10"==t)&&this.callback("updateConnectionResult",!1),this.callback("destroy"),!0}if("qos"===e.method){let t=e.params;return t.encoding=t.encoding===parseInt(v._c.AUDIO_ENCODE),t.sample_rate=48,t.rate=t.encoding?this.bitrateInfo.publisher.bitrate:this.bitrateInfo.subscriber.bitrate,this.notifyUIMessage(a.iQY,t),!0}return!1})),this.signal.notifyUImessage(this.notifyUIMessage.bind(this)),this.signal.on_notify("command",(e=>{const{data:t}=e||{};if(t)try{const e=JSON.parse(t),{evt:r,body:{reason:s=0,subReason:n=0}}=e||{};var i;if(r===a.zag)(null===(i=o.A.shouldKeepAVWhenFailover)||void 0===i?void 0:i.waitingRoom)&&5===s&&1===n||this.destroy(!1)}catch(e){}})),this.signal.UpdateNTP=(e,t,i,r)=>{i&R?this.shareAudioMap.set(i>>10,{ntptime:e,rtptime:t,abssrc:r,ssrc:i}):this.normalAudioMap.set(i>>10,{ntptime:e,rtptime:t,abssrc:r,ssrc:i})},this.publisher&&this.removeAudioSender();let p=Object.assign({},T);this.useIceServers&&(s.Ay.directReport("AB_USE_TURN"),p.iceServers=this.iceServers),this.publisher=C.A.createPeerConnection(p),this.subscriber=C.A.createPeerConnection(p),this.normalAudioSender=null,this.shareAudioSender=null,this.publisher.addTransceiver("audio",{direction:"sendrecv"}),this.publisher.addTransceiver("audio",{direction:"sendrecv"}),this.signal.onOffer=async e=>{w("RERSDP"),this.updateSsrcUserIdMap(e);try{await this.subscriber.setRemoteDescription(e)}catch(e){s.Ay.error("Error when set subscriber RemoteDescription",e)}this.subscriberCandidate.forEach((e=>this.subscriber.addIceCandidate(e))),this.subscriberCandidate=[];const t=await this.subscriber.createAnswer();(0,A.GN)()||(t.sdp=this.updateSdpCodecParameters(t.sdp,"opus",new Map([["stereo",1]]))),await this.subscriber.setLocalDescription(t),w("RELSDP"),await this.rpc("answer",{desc:t})},this.signal.onTrickle=async(e,t)=>{0==t?null!=this.subscriber.remoteDescription?(w("RERICE"),this.subscriber.addIceCandidate(e)):(w("RERICEF"),this.subscriberCandidate.push(e)):1==t?null!=this.publisher.remoteDescription?(w("SERICE"),this.publisher.addIceCandidate(e)):(w("SERICEF"),this.publisherCandidate.push(e)):s.Ay.error("Audio Bridge onTrickle error: role: ".concat(t,", candidate: ").concat(e))},this.publisher.onicecandidate=e=>{let{candidate:t}=e;w("SELICE"),this.signal.notify("trickle",{candidate:t,role:1})},this.publisher.onconnectionstatechange=async()=>{if(w("PCSC:"+this.publisher.connectionState),this.publisher){var e;const i=null===(e=this.publisher)||void 0===e?void 0:e.connectionState;if("disconnected"===i||"failed"===i)this.iceRestartTask||(this.iceRestartTask=setTimeout((async()=>{var e,t;"disconnected"!==(null===(e=this.publisher)||void 0===e?void 0:e.connectionState)&&"failed"!==(null===(t=this.publisher)||void 0===t?void 0:t.connectionState)||((0,_.iK)(a.ZSj,{mediaType:"audio"}),await this.publish(!0)),this.iceRestartTask=null}),5e3));else if("connected"===this.publisher.connectionState&&(this.publishPCPromise.resolve(),this.changeSDPAfterConnect&&(this.changeSDPAfterConnect=!1,this.resetOfferandAnswer()),this.notifyUIMessage(a.LYk,{mediaType:"audio"}),!this.publisher.firstConnected)){var t;this.publisher.firstConnected=!0,this.callback("updateConnectionResult",!0);const e=await(null===(t=this.publisher)||void 0===t?void 0:t.getStats()),{publisher:i}=this.monitorInfo;null==e||e.forEach((t=>{m.Ay.networkInfoStatisticsParse(e,t,i,"publisher")}))}}},this.subscriber.onicecandidate=e=>{let{candidate:t}=e;w("RELICE"),this.signal.notify("trickle",{candidate:t,role:0})},this.subscriber.ontrack=e=>{const t=e.streams[0],i=decodeURIComponent(t.id),r=i.match(/^(\d+)\+/),s=r?r[1]:-1;w("REVT-".concat(s)),e.track.onunmute=()=>{w("REVTP-".concat(s)),this.hasPaused=!0;let e=this.audioPlayerMap.get(i);var r;e?e.setStream(t):(e=new g.A({mediaStream:t,speakerId:f.A.pendingSpeakerId||f.A.speakerId,mediaType:u.zu.MainAudio,mid:0,nodeId:s,webrtcSSRC:this.getWebrtcSSRCBySSRC(null==i?void 0:i.split("+")[0]),streamValid:!0,errorCallback:e=>{this.handleAudioPlayerError(e)},pauseCallback:()=>{this.hasPaused=!0,this.healthChecker._audioTagCountAndStatusMonitor(this.subscriber,this.audioPlayerMap,!0,this.triggerPlayerHealthCheckSuccessCallback.bind(this,h.vr.PLAYER_ON_PAUSE),this.triggerPlayerHealthCheckFailedCallback.bind(this,h.vr.PLAYER_ON_PAUSE))},streamValidCallback:()=>{this.healthChecker._audioTagCountAndStatusMonitor(this.subscriber,this.audioPlayerMap,!0,this.triggerPlayerHealthCheckSuccessCallback.bind(this),this.triggerPlayerHealthCheckFailedCallback.bind(this,h.vr.STREAM_VALID))}}),this.audioPlayerMap.set(i,e),this.healthChecker.addRemoteAudio(null===(r=e)||void 0===r?void 0:r.getWebrtcSSRC())),this.healthChecker._audioTagCountAndStatusMonitor(this.subscriber,this.audioPlayerMap,!0,this.triggerPlayerHealthCheckSuccessCallback.bind(this,h.vr.NEW_STREAM),this.triggerPlayerHealthCheckFailedCallback.bind(this,h.vr.NEW_STREAM),!0),this.receiveAudioStatus.forEach(((e,t)=>{this.setShareVolumeLevel(t/10,e.volume,e.isFromMainSession,!1)})),(this.isDestroyed||this.stopIncomingAudioFlag)&&e.mute()},e.track.onmute=()=>{w("REVTM-".concat(s));const e=this.audioPlayerMap.get(i);this.healthChecker.removeRemoteAudio(null==e?void 0:e.getWebrtcSSRC()),e&&e.destroy(),this.audioPlayerMap.delete(i)}},this.subscriber.onconnectionstatechange=async()=>{var e;if(w("SCSC:"+this.subscriber.connectionState),"connected"===(null===(e=this.subscriber)||void 0===e?void 0:e.connectionState)&&(this.subscribPCPromise.resolve(),this.notifyUIMessage(a.LYk,{mediaType:"audio"}),!this.subscriber.firstConnected)){var t;this.subscriber.firstConnected=!0,this.callback("updateConnectionResult",!0);const e=await(null===(t=this.subscriber)||void 0===t?void 0:t.getStats()),{subscriber:i}=this.monitorInfo;null==e||e.forEach((t=>{m.Ay.networkInfoStatisticsParse(e,t,i,"subscriber")}))}}}notifyUIMessage(e,t){if(!this.probe&&o.A.Notify_APPUI){if(e===a.oQY){var i;if(o.A.audioBridgeFallback2Wasm)return s.Ay.directReport("audioBridge not failover again, ".concat(o.A.audioBridgeFailoverTimeList)),void o.A.Notify_APPUI(a.ScD);this.updateAudioBridgeFailoverTime(performance.now()),this.isFailoverOutofLimit()&&(o.A.audioBridgeFallback2Wasm=!0,s.Ay.directReport("audio bridge failover count out of limitation, ".concat(o.A.audioBridgeFailoverTimeList)),t={audio:h.nm,video:0}),o.A.supportAVSimultaneousFallback&&null!==(i=t)&&void 0!==i&&i.audio&&(s.Ay.directReport("both audio and video fallback to wasm"),t.video=1)}o.A.Notify_APPUI(e,t)}}async enableShareToBO(e){let t=null;try{t=await this.rpc("Enable_Share_To_BO",{enable:e})}catch(e){s.Ay.error("Error when enable share to BO",e)}t&&2==t.length?this.notifyUIMessage(a.CcD,{enable:t[1].enable}):this.notifyUIMessage(a.zds,{enable:e})}async enableBroadCastToBO(e){let t=null;try{t=await this.rpc("Enable_Broadcast_To_BO",{enable:e})}catch(e){s.Ay.error("Error when enable broadcast to bo",e)}t&&2==t.length?this.notifyUIMessage(a.g9q,{enable:t[1].enable}):this.notifyUIMessage(a.LL7,{enable:e})}leaveAudioWithoutDisconnect(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:h.DY;var t,i;this.audioMode=this.audioMode&~e,this.signal&&this.signal.notify("audiostatus",{status:this.audioMode}),e===h.qR?(this.setNormalAudioStream(null),this.stopIncomingAudioFlag=!1,this.muteAllRemoteAudio(),this.cleanUserEventListener&&(this.cleanUserEventListener(),this.cleanUserEventListener=null),this.playFailedTimeout&&(clearTimeout(this.playFailedTimeout),this.playFailedTimeout=null),this.hasReportedPlayFailed=!1,this.muted=!1,null===(t=this.webRTCWorkletManager)||void 0===t||t.changeAudioStatus(!1,!0),null===(i=this.webRTCWorkletManager)||void 0===i||i.stopCheckProcess()):e===h.$t&&this.setShareAudioStream(null),this.audioMode===h.DY&&(this.leaveTime=Date.now(),this.stopAudioQualityMonitorTimer(),this.stopAVSyncTimer())}async rpc(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(this.isDestroyed)return s.Ay.error("audioBridge instance is destroyed, method ".concat(e)),"";try{return this.signal?this.signal.call(e,t):(s.Ay.error("Audio Bridge RPC error: signal is not available,method: ".concat(e)),"")}catch(i){return s.Ay.error("Audio Bridge RPC error: method: ".concat(e,", params: ").concat(t),i),""}}async publish(e){if(!this.publisher||!this.isOpen)return;if(e){const e=performance.now();if(this.updateIceRestartTime(e),this.isIceRestartOutofLimit())return void s.Ay.error("ice restart times out of limit");this.retryPublish++}if(!e){if(this.published)return;this.published=!0}let t=await this.publisher.createOffer({iceRestart:!!e});t.sdp=this.changeOfferSDP(t.sdp),await this.publisher.setLocalDescription(t),this.uid||e||(this.uid=M()),w("SELSDP");const i=await(e?this.rpc("offer",{desc:this.publisher.localDescription}):this.rpc("join",{uid:this.uid,offer:this.publisher.localDescription}));if(i&&2===i.length){const e=i[1];if("answer"===e.type){var r;w("SERSDP"),e.sdp=this.changeOfferSDP(e.sdp),this.publisherAnswer=e;try{await this.publisher.setRemoteDescription(e)}catch(e){s.Ay.error("Error when set publisher RemoteDescription",e)}let t=this.publisher.getTransceivers();1===t.length?this.normalAudioSender=t[0].sender:2==t.length&&(t[0].mid<t[1].mid?(this.normalAudioSender=t[0].sender,this.shareAudioSender=t[1].sender):(this.normalAudioSender=t[1].sender,this.shareAudioSender=t[0].sender));const i=null===(r=this.normalAudioSender)||void 0===r?void 0:r.transport;null==i||i.addEventListener("statechange",(()=>{if("connecting"===i.state)this.startDTLSTime=performance.now();else if("connected"===i.state&&this.startDTLSTime){const e=performance.now()-this.startDTLSTime;this.startDTLSTime=0,w("DTLSTIME:".concat(e))}})),null==i||i.addEventListener("error",(e=>{s.Ay.error("error on DTLSTransport: ".concat(JSON.stringify(null==e?void 0:e.error)))})),this.setNormalAudioStream(this.audioStream),this.setShareAudioStream(this.shareAudioStream),this.publisherCandidate.forEach((e=>{this.publisher.addIceCandidate(e),w("SERICE")})),this.publisherCandidate=[]}}}async resetOfferandAnswer(){let e=await this.publisher.createOffer();if(e.sdp=this.changeOfferSDP(e.sdp),this.publisherAnswer){await this.publisher.setLocalDescription(e),this.publisherAnswer.sdp=this.changeOfferSDP(this.publisherAnswer.sdp);try{await this.publisher.setRemoteDescription(this.publisherAnswer)}catch(e){s.Ay.error("Error when reset offer and answer publisher RemoteDescription",e)}this.rpc("Set_AudioProfile",{audioProfile:this.audioProfile})}else s.Ay.log("publisher answer is null when reset offer and answer")}waitForTokenFromRWG(e){return new Promise(((t,i)=>{n.A.on(e,((e,i)=>{t(i)}))}))}updateSdpCodecParameters(e,t,i){try{let r=[];const s=e.split("\r\n"),o=new RegExp("^a=rtpmap:([0-9]+) ".concat(t,"/"));for(let e=0;e<s.length;e++){let t=s[e].match(o);t&&r.push(t[1])}if(r.length)for(let e=0;e<s.length;e++){let t=r.reduce(((t,i)=>s[e].match(new RegExp("^a=fmtp:".concat(i," (.*)")))||t),null);if(t){const r=new Map(t[1].split(";").map((e=>e.split("="))));i.forEach(((e,t)=>{e&&r.set(t,e)}));let o=s[e].match(/a=fmtp:(\d+)/)[0]+" ";for(const[e,t]of r)o+="".concat(e,"=").concat(t,";");o=o.slice(0,o.length-1),s[e]=o}}return s.join("\r\n")}catch(t){return s.Ay.error("Error when updateSdpCodecParameters",t),e}}changeOfferSDP(e){try{let t=e.split("m="),i=0,r=[];for(let e=1;e<t.length;e++){if(0===t[e].indexOf("audio")){i++;let s=t[e].match(/a=mid:(\d+)/);s&&r.push(s[1])}t[e]="m="+t[e]}if(1===i)return this.updateSdpCodecParameters(e,"opus",h.gC[this.audioProfile]);if(2!==i||2!=r.length)return s.Ay.error("Audio line invalid: "+i),s.Ay.error("mid line length invalid: "+r.length),e;let o="";for(let e=0;e<t.length;e++){if(t[e].startsWith("m=audio"))if(-1!=t[e].indexOf("mid:"+Math.min(r[0],r[1]))){if(t[e]=this.updateSdpCodecParameters(t[e],"opus",h.gC[this.audioProfile]),-1===t[e].indexOf("cname:Normal")){t[e]=t[e].replace(/a=ssrc:(.+) cname:/,"a=ssrc:$1 cname:Normal+");let i=t[e].match(/a=ssrc:(.+) cname:/);i&&i[1]&&(this.normalAudioSSRC=Number(i[1]))}}else t[e].indexOf("mid:"+Math.min(r[0],r[1]))&&(t[e]=this.updateSdpCodecParameters(t[e],"opus",h.gC[h.x_]),-1===t[e].indexOf("cname:Share")&&(t[e]=t[e].replace(/a=ssrc:(.+) cname:/,"a=ssrc:$1 cname:Share+")));o+=t[e]}return o}catch(t){return s.Ay.error("Error when changeOfferSDP",t),e}}setRecvOnly(e,t){this.recvOnly=!!e,this.recvOnly?this.setNormalAudioStream(null):t&&this.setNormalAudioStream(t)}setCodecDoAVSync(e){this.codecDoAVSync=e}getFinalSentAudioStream(){return this.webRTCWorkletManager&&this.webRTCWorkletManager.doingDenoise&&this.webRTCWorkletManager.getAudioStream()||this.audioStream}setNormalAudioStream(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]||(this.recvOnly?this.audioStream=null:this.audioStream=e),this.resetAudioTrackState(this.audioStream),this.setAudioStreamCloning(this.audioStream),this.webRTCWorkletManager&&(this.webRTCWorkletManager.doingDenoise?this.webRTCWorkletManager.setAudioStream(this.audioStream):this.webRTCWorkletManager.setAudioStream(this.audioStreamCloning||this.audioStream));let t=e;t=this.getFinalSentAudioStream(),t&&(this.muted?this.mute():this.unmute()),this.publishAudioStream(t,this.normalAudioSender,"PAT")}setShareAudioStream(e){this.shareAudioStream=e,this.publishAudioStream(this.shareAudioStream,this.shareAudioSender,"PAST")}publishAudioStream(e,t,i){this.isDestroyed||(t?e?e.getAudioTracks().forEach((e=>{s.Ay.log("publish track label: "+e.label),w("".concat(i,"-").concat(e.id)),t.replaceTrack(e).catch((t=>{w("".concat(i,"-Failed-").concat(e.id)),s.Ay.error("error publishing audio stream",t)}))})):(t.replaceTrack(null),w("".concat(i,"-null"))):w(i+"SE "))}mute(){this.muted=!0;let e=this.getFinalSentAudioStream();var t;e&&(w("SEVTP"),e.getAudioTracks().forEach((e=>{e.enabled=!1})),null===(t=this.webRTCWorkletManager)||void 0===t||t.changeAudioStatus(!0,!1))}unmute(){this.muted=!1;let e=this.getFinalSentAudioStream();var t;e&&(w("SEVTM"),e.getAudioTracks().forEach((e=>{e.enabled=!0})),null===(t=this.webRTCWorkletManager)||void 0===t||t.changeAudioStatus(!1,!1))}stopIncomingAudio(e){this.stopIncomingAudioFlag=!!e,e?this.muteAllRemoteAudio():this.unmuteAllRemoteAudio()}muteAllRemoteAudio(){for(const[e,t]of this.audioPlayerMap)t.mute()}unmuteAllRemoteAudio(){for(const[e,t]of this.audioPlayerMap)t.unmute();this.triggerPlayerHealthCheck(h.vr.UNMUTE_ALL)}setAudioStreamCloning(e){this.destroyAudioStream(this.audioStreamCloning),this.audioStreamCloning=null;try{if(!e)return;if(this.webRTCWorkletManager&&!this.webRTCWorkletManager.doingDenoise&&o.A.enableCloneAudioStream){this.audioStreamCloning=e.clone();let t=this.audioStreamCloning.getAudioTracks()[0];t&&(w("CATRS:"+t.readyState+":"+t.id),w("CATMS:"+t.muted+":"+t.id),w("CATES:"+t.enabled+":"+t.id))}}catch(e){s.Ay.error("Error when cloning audio stream, ",e)}}destroyAudioStream(e){e&&e.getTracks().forEach((e=>{e.stop()}))}setSpeechVolumeLevel(e,t){for(const[i,r]of this.audioPlayerMap){if(-1!==i.indexOf("OS"))continue;const s=Number(i.split("+")[0]||"0"),o=Number.isNaN(s)||!s?null:s>>10<<10;if(o&&o===e>>10<<10){r.setVolume(t);break}}}async changeSpeaker(e){let t,i=!0,r="",o=_.Lg.BROWSER_ERROR,n=Date.now(),d=[];f.A.setPendingSpeakerId(e);for(const[t,s]of this.audioPlayerMap){if(!1===s.isSupportSetSpeakerDevice()){i=!1,o=_.Lg.UNSUPPORTED_BROWSER,r="audioplayer.setSinkId is not supported on your device.",f.A.clearPendingSpeakerId();break}let t=s.setSpeakerDevicePromise(e);d.push(t)}try{await Promise.all(d)}catch(e){i=!1,t=e,r="Error when setting sink of audio player: "+e.message}if(i)this.audioSpeakerSetErrorCnt=0,this.notifyUIMessage(a.a6z,e||"default");else{this.audioSpeakerSetErrorCnt++;let e=f.A.getSpeakerId();s.Ay.error("setSinkId failed ".concat(this.audioSpeakerSetErrorCnt," times, current speaker ").concat(e,", errorMessgae = ").concat(r)),this.audioSpeakerSetErrorCnt<=3&&this.notifyUIMessage(a.dsK,{errorMessgae:r,currentSink:e,error:t,errorCode:o})}await f.A.updateSelectedSpeakerDevices(e,Date.now()-n,i),f.A.clearPendingSpeakerId()}setShareVolumeLevel(e,t,i){(!(arguments.length>3&&void 0!==arguments[3])||arguments[3])&&this.receiveAudioStatus.set(10*e+(i?1:0),{volume:t,isFromMainSession:i});let r=i?/(\d+)\+OS/:/(\d+)\+CS/;for(const[i,s]of this.audioPlayerMap){let o=i.match(r);o&&o.length>=2&&o[1]>>10===e&&o[1]&R&&(t?s.unmute():s.mute())}}async set_CC_lang(e){let t=null;try{t=await this.rpc("set_CC_lang",{lang:e})}catch(e){s.Ay.error("error when setting language",e)}t&&2===t.length?this.notifyUIMessage(a.V5N,t[1].lang):this.notifyUIMessage(a.i3D,e)}updateSsrcUserIdMap(e){if(e){const{sdp:t=""}=e,i=t.match(/a=ssrc:(.+) cname:(.+)/g);i&&i.forEach((e=>{const t=e.match(/a=ssrc:(.+) cname:(.+)/);if(t&&t[1]&&t[2]){const e=Number(t[2].split("+")[0]||"0"),i=Number.isNaN(e)||!e?null:e,r=Number(t[1]);this.ssrcUserIdMap.set(r,i)}}))}}getWebrtcSSRCBySSRC(e){for(const[t,i]of this.ssrcUserIdMap)if(i==e)return t;return null}updateUserMuteUnmuteStatus(e){const{update:t,remove:i}=e;t&&t.length>0&&t.forEach((e=>{const{userId:t,muted:i}=e;t&&this.audioMuteStatus.set(t>>10<<10,!!i)})),i&&i.length>0&&i.forEach((e=>{const{userId:t}=e;t&&this.audioMuteStatus.set(t>>10<<10,!0)}))}isUserMuted(e){const t=this.ssrcUserIdMap.get(e);if(!t||t&R)return!1;const i=this.audioMuteStatus.get(t>>10<<10);return void 0!==i&&!!i}_isAudioShareByWebRtcSSRC(e){return!!(this.ssrcUserIdMap.get(e)&R)}async setAudioProfile(e){if(this.audioMode!==h.qR&&this.audioMode!=h.$2)return;let t=this.audioProfile;"backgroundNoiseSuppression"===e.currentSelect?(e.highBitrate?this.audioProfile=h.$A:this.audioProfile=h.yu,f.A.changeDenoiseSwitch("Zoom"===e.backgroundNoiseSuppression)):(f.A.changeDenoiseSwitch(!1),e.originalSound.highfidelity&&e.originalSound.stereo?this.audioProfile=h.IA:e.originalSound.highfidelity?this.audioProfile=h.hc:e.originalSound.stereo?this.audioProfile=h.Hc:this.audioProfile=h.ej),t!==this.audioProfile&&(this.publisher&&"connected"===this.publisher.connectionState?await this.resetOfferandAnswer():this.changeSDPAfterConnect=!0)}resetAudioTrackState(e){e&&e.getAudioTracks().forEach((e=>{e.enabled=!0}))}clearAudioPlayerMap(){this.muteAllRemoteAudio();for(const[e,t]of this.audioPlayerMap)t.destroy();this.audioPlayerMap.clear(),this.audioMuteStatus.clear()}getAudioPlayer(e){if(e)for(const[t,i]of this.audioPlayerMap)if(t.includes(e))return this.audioPlayerMap.get(t)}updateIceRestartTime(e){if(this.iceRestartTimeList.length<=3)this.iceRestartTimeList.push(e);else{const t=Math.min(...this.iceRestartTimeList),i=this.iceRestartTimeList.indexOf(t);this.iceRestartTimeList[i]=e}}updateAudioBridgeFailoverTime(e){if(null!==o.A&&void 0!==o.A&&o.A.audioBridgeFailoverTimeList)if(o.A.audioBridgeFailoverTimeList.length<=2)o.A.audioBridgeFailoverTimeList.push(e);else{const t=Math.min(...o.A.audioBridgeFailoverTimeList),i=o.A.audioBridgeFailoverTimeList.indexOf(t);o.A.audioBridgeFailoverTimeList[i]=e}}isIceRestartOutofLimit(){return this.iceRestartTimeList.length>=4&&Math.max(...this.iceRestartTimeList)-Math.min(...this.iceRestartTimeList)<9e4}isFailoverOutofLimit(){return!(null===o.A||void 0===o.A||!o.A.audioBridgeFailoverTimeList)&&o.A.audioBridgeFailoverTimeList.length>=3&&Math.max(...o.A.audioBridgeFailoverTimeList)-Math.min(...o.A.audioBridgeFailoverTimeList)<4e4}removeAudioSender(){this.normalAudioSender&&(this.publisher.removeTrack(this.normalAudioSender),this.normalAudioSender=null),this.shareAudioSender&&(this.publisher.removeTrack(this.shareAudioSender),this.shareAudioSender=null)}destroySocketAndWebRtcConnect(e){this.published=!1;try{this.removeAudioSender()}catch(e){}this.iceRestartTask&&(clearTimeout(this.iceRestartTask),this.iceRestartTask=null),this.iceRestartTimeList=[],this.publisher&&(this.publisher.close(),this.publisher=null),this.subscriber&&(this.subscriber.close(),this.subscriber=null),this.isOpen=!1,e||(this.retry=0),this.retryPublish=0,this.signal&&(this.signal.destroy(),this.signal=null),this.ssrcUserIdMap.clear()}destroy(){w("DS"),this.isDestroyed=!0,this.cleanUserEventListener&&(this.cleanUserEventListener(),this.cleanUserEventListener=null),this.stopAudioQualityMonitorTimer(),this.stopAVSyncTimer(),this.webRTCWorkletManager&&(this.webRTCWorkletManager.destroy(),this.webRTCWorkletManager=null),this.setNormalAudioStream(null),this.setShareAudioStream(null),this.clearAudioPlayerMap(),this.destroySocketAndWebRtcConnect(),this.recvOnly=!1}startAudioQualityMonitorTimer(){this.audioReportCount=0,this.stopAudioQualityMonitorTimer(),this.monitorTimer=setInterval((()=>{this._publisherStatsParse(this.audioReportCount),this._subscriberStatsParse(this.audioReportCount),this.audioReportCount++}),this.monitorTimerDuration)}stopAudioQualityMonitorTimer(){var e,t,i,r,s,o;this.monitorTimer&&(clearInterval(this.monitorTimer),this.monitorTimer=null,this.audioReportCount=0,this.monitorInfo={subscriber:{port:null===(e=this.monitorInfo)||void 0===e||null===(e=e.subscriber)||void 0===e?void 0:e.port,protocol:null===(t=this.monitorInfo)||void 0===t||null===(t=t.subscriber)||void 0===t?void 0:t.protocol,candidateType:null===(i=this.monitorInfo)||void 0===i||null===(i=i.subscriber)||void 0===i?void 0:i.candidateType},publisher:{port:null===(r=this.monitorInfo)||void 0===r||null===(r=r.publisher)||void 0===r?void 0:r.port,protocol:null===(s=this.monitorInfo)||void 0===s||null===(s=s.publisher)||void 0===s?void 0:s.protocol,candidateType:null===(o=this.monitorInfo)||void 0===o||null===(o=o.publisher)||void 0===o?void 0:o.candidateType}},this.bitrateInfo={publisher:{},subscriber:{}})}async setStreamAsync(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?this.setShareAudioStream(e):this.setNormalAudioStream(e),new Promise(((e,t)=>{this.published?e(!0):this.publish().then((()=>{e(!1)}))}))}stopAVSyncTimer(){this.syncTimer&&(clearInterval(this.syncTimer),this.syncTimer=null)}syncSingleView(e,t){let i=0;if(t){let e=parseInt(t).toString(2),r=e.substring(0,e.length-32),s=e.substring(e.length-32,e.length);r=parseInt(r,2),s=parseInt(s,2),i=1e3*r+232.8*s/1e9}0==o.A.mediaSDKHandle.RenderInMain?e?(0,c.Notify_Sharing_Decode_Thread)({command:"audioTimestamp",data:i}):(0,c.Notify_Video_Decode_Thread)({command:"audioDecodeTime",status:0,data:i}):e?o.A.mediaSDKHandle.SharingRenderObj&&o.A.mediaSDKHandle.SharingRenderObj.SetcATimeStamp(i):o.A.CurrentSSRCTime!=i&&(o.A.CurrentSSRCTime=i,o.A.audioPlayTime=Date.now())}syncMultiView(e,t){let i=new ArrayBuffer(16),r=t.toString(2),s=parseInt(r.substring(0,r.length-32),2),o=parseInt(r.substring(r.length-32,r.length),2),a=new DataView(i);a.setUint32(0,e,!0),a.setUint32(4,o,!0),a.setUint32(8,s,!0),a.setUint32(12,Date.now(),!0);let n=new Uint8Array(i);(0,c.Notify_Video_Decode_Thread)({command:"audioDecodeTime",status:1,data:n})}startAVSyncTimer(){this.stopAVSyncTimer(),this.syncTimer=setInterval((()=>{if(!this.subscriber)return;let e=0;this.subscriber.getReceivers().forEach((t=>{t.getSynchronizationSources().forEach((t=>{if(e++,this.isUserMuted(t.source))return;let i=this.ssrcUserIdMap.get(t.source),r=null,a=this._isAudioShareByWebRtcSSRC(t.source);if(a){let e=this.shareAudioMap.get(i>>10);(null==e?void 0:e.abssrc)===t.source&&(r=e)}else r=this.normalAudioMap.get(i>>10);if(r){let e=r.ntptime,n=r.rtptime,d=o.A.timeOrigin+performance.now(),c=(d-t.timestamp)/1e3;Math.abs(c)>60&&(this._getSynchronizationSourcesTimestampInvalidDetected||s.Ay.error("[AB Audio] data.timestamp diff too large: ".concat(c,", now:").concat(d,", data.ts:").concat(t.timestamp)),c=0,this._getSynchronizationSourcesTimestampInvalidDetected=!0);let l=t.rtpTimestamp-n&4294967295,h=e+c*Math.pow(2,32)+l*Math.pow(2,32)/48e3;this.codecDoAVSync?this.syncMultiView(r.ssrc,h):(i>>10==o.A.CurrentSSRC>>10||a)&&t.source===r.abssrc&&this.syncSingleView(a,h)}}))})),0===e&&(this.syncSingleView(!1,0),this.syncSingleView(!0,0))}),500)}async _publisherStatsParse(e){var t,i;const r=e&&!(e%12),s=this.showQos&&!(e%1);if(!this.publisher)return;if(!r&&!s)return;const o=await this.publisher.getStats();if(!o)return;if(s&&m.Ay.outboundBitrateQosParse(o,this.bitrateInfo.publisher),!r)return;let a={};const{publisher:n}=this.monitorInfo;if(o.forEach((e=>{if("remote-inbound-rtp"===e.type)m.Ay.remoteInboundRTPStatisticParse(u.zu.MainAudio,e,this.audioMode,a,n);else if("outbound-rtp"===e.type)m.Ay.outboundRTPStatisticsParse(this.getUplinkMid2MediaType(e.ssrc),e,this.audioMode,a,n);else if("media-source"===e.type){let t=this.getFinalSentAudioStream();m.Ay.mediaSourceStatisticsParse(t,e,this.audioMode,a,n)}})),this.handleNetworkQuality(0,null===(t=a[u.zu.MainAudio])||void 0===t?void 0:t.rtt),this.handleNoAudioPackets(null===(i=a[u.zu.MainAudio])||void 0===i?void 0:i.packetsSent),this.webRTCWorkletManager&&a[u.zu.MainAudio]){const{resLevelR16Log:e,resLevelR16LogDenoise:t}=this.webRTCWorkletManager.getLevelR16Log();a[u.zu.MainAudio].audioLevelR16Str=e,a[u.zu.MainAudio].audioLevelR16DenoiseStr=t}m.Ay.audioSendQualityMonitor(a)}async _subscriberStatsParse(e){var t;if(!this.subscriber)return;const i=e&&!(e%12),r=!(e%1),s=this.showQos&&!(e%1);let o=!1;const a=performance.now();a-this.lastAudioTagCountAndStatusCheckTime>=5e3&&(o=!0,this.lastAudioTagCountAndStatusCheckTime=a),o&&this.healthChecker._audioTagCountAndStatusMonitor(this.subscriber,this.audioPlayerMap,!0,null,null);const n=await this.subscriber.getStats();if(!n)return;let d={ssrcMap:{}};s&&m.Ay.inboundBitrateQosParse(n,null===(t=this.bitrateInfo)||void 0===t?void 0:t.subscriber);let c=!1;const{subscriber:l}=this.monitorInfo;n.forEach((e=>{i&&(this._subscriberCandidatePairParse(e,d),c=!0),c=this._subscriberInboundRTPParse(e,d,l,r&&!i)||c})),i&&this.handleNetworkQuality(1,d.rtt),this.healthChecker.onCheck({downlinkStatInfo:d,isUpLink:!1}),c&&m.Ay.audioRecvQualityMonitor(d)}_subscriberCandidatePairParse(e,t){const{subscriber:i}=this.monitorInfo,{totalRoundTripTime:r,responsesReceived:s,type:o,state:a,nominated:n}=e;if("candidate-pair"===o&&"succeeded"===a&&n){i.prevStatInfo||(i.prevStatInfo={responsesReceived:s,totalRoundTripTime:r},i.ssrcMap={});const{prevStatInfo:e}=i;Object.assign(t,{rtt:Math.floor(1e3*(s===e.responsesReceived?0:(r-e.totalRoundTripTime)/(s-e.responsesReceived)))}),Object.assign(i.prevStatInfo,{totalRoundTripTime:r,responsesReceived:s})}}_subscriberInboundRTPParse(e,t,i,r){const{type:s}=e;let o;if("inbound-rtp"===s){var a;const{totalAudioEnergy:s,timestamp:n,jitterBufferDelay:d,jitterBufferEmittedCount:c,jitterBufferMinimumDelay:h,jitterBufferTargetDelay:u,ssrc:p,jitter:f,audioLevel:v,packetsLost:g,packetsDiscarded:_,packetsReceived:S,bytesReceived:A,concealedSamples:y,concealmentEvents:C,insertedSamplesForDeceleration:E,removedSamplesForAcceleration:b,silentConcealedSamples:w,nackCount:R,totalProcessingDelay:T}=e,I=this.ssrcUserIdMap.get(p);let M=0;if(M=null!==(a=this.getAudioPlayer(I))&&void 0!==a&&a.isPaused()?"x":l.ey(v),m.Ay.audioRecvQualityMonitor({key:"".concat(I),audioLevel:M,onlyAudioLevel:!0}),r)return!1;i.ssrcMap||(i.ssrcMap={});let D=i.ssrcMap[p];if(D){if(I){o=!0;const i=Math.sqrt((s-D.totalAudioEnergy)/(n-D.timestamp)).toFixed(4);let r=-1;"number"==typeof v&&(r=v.toFixed(4));const{aveJitterBufferDelay_ms:a,aveJitterBuffeTargetrDelay_ms:d,totalPacketsReceived_diff:c,packetsDiscarded_diff:l,insertedSamplesForDeceleration_diff:u,packetsLost_diff:g,concealedSamples_diff:_,removedSamplesForAcceleration_diff:S,silentConcealedSamples_diff:A,nackCount_diff:y,totalProcessingDelay_ms:E}=m.Ay.getDownlinkStatisticsRate(D,e);t.ssrcMap["".concat(I)]=Object.assign(t.ssrcMap["".concat(I)]||{},{aveAudioLevel:i<1e-4?0:i,audioLevel:r<1e-4?0:r,jitter:f,jitterBufferMinimumDelay:h,concealedSamples_diff:_,concealmentEvents:C,insertedSamplesForDeceleration_diff:u,removedSamplesForAcceleration_diff:S,silentConcealedSamples_diff:A,audioPausedStatus:this.getAudioPlayer(I)?this.getAudioPlayer(I).isPaused()?0:1:-1,audioVolume:this.getAudioPlayer(I)?this.getAudioPlayer(I).getVolume():-1,audioMutedStatus:this.getAudioPlayer(I)?this.getAudioPlayer(I).isMuted()?0:1:-1,totalAudioEnergy:s,aveJitterBufferDelay_ms:a,aveJitterBuffeTargetrDelay_ms:d,ssrc:p,totalPacketsReceived_diff:c,packetsDiscarded_diff:l,packetsLost_diff:g,isInterpreter:0,nackCount_diff:y,totalProcessingDelay_ms:E})}}else D=i.ssrcMap[p]={},o=!1;this.isUserMuted(p)||!this.ssrcUserIdMap.has(p)?i.ssrcMap[p]=null:Object.assign(D,{totalAudioEnergy:s,timestamp:n,jitterBufferDelay:d,jitterBufferEmittedCount:c,packetsLost:g,packetsReceived:S,bytesReceived:A,jitterBufferTargetDelay:u,insertedSamplesForDeceleration:E,packetsDiscarded:_,concealedSamples:y,removedSamplesForAcceleration:b,silentConcealedSamples:w,nackCount:R,totalProcessingDelay:T})}return o}getHealthCheckFailedAndReset(){return!!this.healthCheckFailed&&(this.healthCheckFailed=!1,!0)}handleNoAudioPackets(e){this.audioMode!=h.qR||!this.audioStream||this.muted||(e||0)-this.lastSentPackets!=0||this._isMutedBySystem?(this.audioMode==h.qR&&this.audioStream&&1==this.isAudioSentBytesZero&&(e||0)-this.lastSentPackets>0&&(w("HEALTH_CHECK_RESTORED:PACKETS_SENT_ZERO"),o.A.Notify_APPUI_SAFE(a.FjO)),this.isAudioSentBytesZero=!1,this.noPacketsCount=0,this.lastSentPackets=e||0):(this.noPacketsCount++,2===this.noPacketsCount&&0==this.isAudioSentBytesZero&&(w("HEALTH_CHECK_FAILED:PACKETS_SENT_ZERO"),(0,_.iK)(a.$qV,h.Mm),this.healthCheckFailed=!0,this.isAudioSentBytesZero=!0,this.noPacketsCount=0))}handleNetworkQuality(e,t){this.audioMode==h.qR&&this.audioStream&&t&&(t>5e3?o.A.Notify_APPUI_SAFE(a.Joy,{isUplink:0===e,networkLevel:h.tT.NET_QUALITY_VERY_BAD,bwLevel:h.LA.NET_BW_LEVEL_VERY_LOW}):t>2e3&&o.A.Notify_APPUI_SAFE(a.Joy,{isUplink:0===e,networkLevel:h.tT.NET_QUALITY_BAD,bwLevel:h.LA.NET_BW_LEVEL_LOW}))}changeDenoiseSwitch(e,t,i){var r;this.denoiseSwitch=e,null===(r=this.webRTCWorkletManager)||void 0===r||r.changeDenoiseSwitch(e,t,i)}updateQos(e){this.showQos=e.enable,this.signal&&this.signal.notify("qos",{enable:e.enable,encoding:parseInt(e.workerType),pollingInterval:e.pollingInterval})}getConnectionId(){return this.cid}getUplinkMid2MediaType(e){return e===this.normalAudioSSRC?u.zu.MainAudio:u.zu.ShareAudio}getAudioPromise(e){return e===v._c.AUDIO_DECODE?this.subscribPCPromise.promise:e===v._c.AUDIO_ENCODE?this.publishPCPromise.promise:void 0}async getSendStats(){var e;const t=await(null===(e=this.publisher)||void 0===e?void 0:e.getStats());for(const[e,i]of t)"outbound-rtp"!=i.type&&"remote-inbound-rtp"!==i.type||(i.nodeId=-1024&this.userId,i.isSharing=i.ssrc!==this.normalAudioSSRC);return t}async getRecvStats(){var e;const t=await(null===(e=this.subscriber)||void 0===e?void 0:e.getStats());for(const[e,i]of t)if("inbound-rtp"==i.type||"remote-outbound-rtp"===i.type){const e=this.ssrcUserIdMap.get(i.ssrc);i.nodeId=-1024&e,i.isSharing=!!(512&e)}return t}}function M(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))}function D(){this.onOffer,this.isDestroyed=!1,this.heartBeatDetection=null,this.onopen=function(e){this._onopen=e},this.onclose=function(e){this._onclose=e},this.onerror=function(e){this._onerror=e},this.onmessage=function(e){this._onmessage=e},this.notifyUImessage=function(e){this.notifyUIMessage=e},this.init=function(e){w("INIT: ".concat(e)),this.socket=window.audioBridgeSignal=(0,r.Gj)(e),this._notifyhandlers={},this.socket.addEventListener("open",(()=>{w("WSO"),this.lastMessageTimeStamp=performance.now(),this.socket.isRlb||(this.ping(),this.heartBeatDetection&&(clearTimeout(this.heartBeatDetection),this.heartBeatDetection=null),this.heartBeatDetection=setTimeout(function e(){var t;if(this.isDestroyed||1!==(null===(t=this.socket)||void 0===t?void 0:t.readyState))return;let i=performance.now()-this.lastMessageTimeStamp;i>32e3?(w("WST"),s.Ay.error("didn't reveive message from websocket in the last 30s, notify UI failover, duration: "+i),this.notifyUIMessage(a.oQY)):this.heartBeatDetection=setTimeout(e.bind(this),2e3)}.bind(this),2e3)),this._onopen&&this._onopen()})),this.socket.addEventListener("error",(e=>{this.isDestroyed||(s.Ay.directReport("Audio Bridge WebSocket received error"),w("WSE"),this._onerror&&this._onerror(e||!0))})),this.socket.addEventListener("close",(e=>{this.isDestroyed||(s.Ay.directReport("Audio Bridge WebSocket close"),w("WSC"),this._onclose&&this._onclose(e||!0))})),this.socket.addEventListener("message",(async e=>{this.lastMessageTimeStamp=performance.now();const t=JSON.parse(e.data);let i=!1;if(this._onmessage&&(i=this._onmessage(t)),!i)if("offer"===t.method)this.onOffer&&this.onOffer(t.params);else if("trickle"===t.method)this.onTrickle&&this.onTrickle(t.params.candidate,t.params.role);else if("rtcpsr"===t.method)this.UpdateNTP(t.params.ntptime,t.params.rtptime,t.params.ssrc,t.params.abssrc);else if("pong"===t.result){let e=parseInt(performance.now())-t.id;w("RTT: "+e)}else{const e=this._notifyhandlers[t.method];e&&e(t.params)}}))},this.on_notify=function(e,t){this._notifyhandlers[e]=t},this.notify=function(e,t,i){var r;this.isDestroyed?s.Ay.error("audioBridge instance is destroyed, method ".concat(e)):this.socket&&this.socket.readyState===WebSocket.OPEN?this.socket.send(JSON.stringify({method:e,params:t,id:i})):s.Ay.error("Websocket is not open: ".concat(this.socket.readyState,", ").concat(null===(r=this.socket)||void 0===r?void 0:r.url))},this.call=async function(e,t){const i=M();var r;if(this.socket&&this.socket.readyState===WebSocket.OPEN)return this.socket.send(JSON.stringify({method:e,params:t,id:i})),new Promise(((e,t)=>{const r=t=>{const s=JSON.parse(t.data);s.id===i&&(s.error?e(s):e(s.result),this.socket.removeEventListener("message",r))};this.socket.addEventListener("message",r)}));s.Ay.error("Websocket is not open: ".concat(this.socket.readyState,", ").concat(null===(r=this.socket)||void 0===r?void 0:r.url))},this.ping=()=>{this.notify("ping",{},parseInt(performance.now())),this.pingTimeout&&clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout((()=>{this.ping()}),1e4)},this.destroy=()=>{this.isDestroyed=!0,this.pingTimeout&&(clearTimeout(this.pingTimeout),this.pingTimeout=null),this.heartBeatDetection&&(clearTimeout(this.heartBeatDetection),this.heartBeatDetection=null),this.socket&&this.socket.close&&this.socket.close(3456,"close socket when destroy signal")}}},3472:(e,t,i)=>{"use strict";i.d(t,{Ay:()=>m,PV:()=>u,U1:()=>l,Yo:()=>c,_$:()=>p,lo:()=>d,py:()=>h});var r=i(7857),s=i(385),o=i(2710),a=i(7080),n=i(5999);const d=(e,t)=>a.A.add_monitor("AB"+e),c=(e,t)=>a.A.add_monitor("AB"+e);let l=()=>{},h=(e,t)=>s.Ay.error("[WMSC_Audio] ".concat(e),t),u=e=>s.Ay.log("[WMSC_Audio] ".concat(e)),p=e=>s.Ay.directReport("[WMSC_Audio] ".concat(e));function f(e,t){return"number"!=typeof e?0:parseFloat(e.toFixed(t)).toString()}class m{static getReportKeyFromSSRC(e,t){if(e)return t.ssrc.toString()===e?n.zu.MainAudio:n.zu.ShareAudio}static isAudioSharing(e){return e&o.$t}static isAudioStat(e){return"audio"===e.kind}static remoteInboundRTPStatisticParse(e,t,i,r,s){e&&(e!=n.zu.ShareAudio||this.isAudioSharing(i))&&void 0!==t.roundTripTime&&(r[e]||(r[e]={}),r[e].rtt=Math.floor(1e3*t.roundTripTime))}static outboundRTPStatisticsParse(e,t,i,r,s){if(!e)return;if(e==n.zu.ShareAudio&&!this.isAudioSharing(i))return;r[e]||(r[e]={});const{bytesSent:o,packetsSent:a,nackCount:d,retransmittedPacketsSent:c,targetBitrate:l}=t;s[e]||(s[e]={lastpacketsSent:0}),r[e].packetsSent_diff=(a||0)-(s[e].packetsSent||0),r[e].packetsSent=a,r[e].nackCount=d,r[e].retransmittedPacketsSent=c,r[e].targetBitrate=(l||0)/1e3+"k",s[e]={packetsSent:a}}static outboundBitrateQosParse(e,t){let i=0;e.forEach((e=>{if(this.isAudioStat(e)&&"outbound-rtp"===e.type){const{bytesSent:r,timestamp:s}=e,{lastBytesSent:o,lastTimestamp:a}=t[e.ssrc]||{};r&&s&&o&&a&&(i+=this.calculateBitrates(o,a,r,s)),t[e.ssrc]={lastBytesSent:r,lastTimestamp:s}}})),t.bitrate=i.toFixed(1)}static inboundBitrateQosParse(e,t){let i=0;e.forEach((e=>{if(this.isAudioStat(e)&&"inbound-rtp"===e.type){const{bytesReceived:r,timestamp:s}=e,{lastBytesReceived:o,lastTimestamp:a}=t[e.ssrc]||{};r&&s&&o&&a&&(i+=this.calculateBitrates(o,a,r,s)),t[e.ssrc]={lastBytesReceived:r,lastTimestamp:s}}})),t.bitrate=i.toFixed(1)}static calculateBitrates(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return e===i||parseInt(t)===parseInt(r)?0:8e3*(i-e)/(r-t)}static mediaSourceStatisticsParse(e,t,i,r,s){var o;let a=t.trackIdentifier==(null==e||null===(o=e.getAudioTracks()[0])||void 0===o?void 0:o.id)?n.zu.MainAudio:n.zu.ShareAudio;if(!a)return;if(a==n.zu.ShareAudio&&!this.isAudioSharing(i))return;r[a]||(r[a]={});const{echoReturnLoss:d,echoReturnLossEnhancement:c,totalAudioEnergy:l}=t;r[a].echoReturnLoss=f(d,5),r[a].echoReturnLossEnhancement=f(c,2),r[a].totalAudioEnergy=l}static networkInfoStatisticsParse(e,t,i,r){let o=0,a=null,n=null;if("candidate-pair"===t.type){const i=e.get(t.remoteCandidateId);t.selected&&i&&(o=i.port,a=i.protocol);const r=e.get(t.localCandidateId);t.selected&&r&&(n=r.candidateType)}else if("transport"===t.type&&t.selectedCandidatePairId){let i=e.get(t.selectedCandidatePairId);const r=e.get(i.remoteCandidateId);r&&(o=r.port,a=r.protocol);const s=e.get(i.localCandidateId);s&&(n=s.candidateType)}o&&a&&(o!==i.port||a!=i.protocol||n!=i.candidateType)&&(i.port=o,i.protocol=a,i.candidateType=n,s.Ay.directReport("".concat(r," port:").concat(o,", ").concat(r," protocol:").concat(a,", ").concat(r," localcandidateType:").concat(n)))}static getDownlinkStatisticsRate(e,t){const{jitterBufferDelay:i,jitterBufferEmittedCount:r,jitterBufferTargetDelay:s,packetsLost:o,packetsDiscarded:a,packetsReceived:n,insertedSamplesForDeceleration:d,concealedSamples:c,removedSamplesForAcceleration:l,silentConcealedSamples:h,nackCount:u,totalProcessingDelay:p}=t,f=this.calculateRate(e.totalProcessingDelay,e.jitterBufferEmittedCount,p,r),m=this.calculateRate(e.nackCount,0,u,1,1);return{aveJitterBufferDelay_ms:this.calculateRate(e.jitterBufferDelay,e.jitterBufferEmittedCount,i,r),aveJitterBuffeTargetrDelay_ms:this.calculateRate(e.jitterBufferTargetDelay,e.jitterBufferEmittedCount,s,r),totalPacketsReceived_diff:this.calculateRate(e.packetsReceived,0,n,1,1),packetsDiscarded_diff:this.calculateRate(e.packetsDiscarded,0,a,1,1),insertedSamplesForDeceleration_diff:this.calculateRate(e.insertedSamplesForDeceleration,0,d,48,1),packetsLost_diff:this.calculateRate(e.packetsLost,0,o,1,1),concealedSamples_diff:this.calculateRate(e.concealedSamples,0,c,48,1),removedSamplesForAcceleration_diff:this.calculateRate(e.removedSamplesForAcceleration,0,l,48,1),silentConcealedSamples_diff:this.calculateRate(e.silentConcealedSamples,0,h,48,1),nackCount_diff:m,totalProcessingDelay_ms:f}}static calculateRate(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return e===i||t===r?0:Number(((arguments.length>4&&void 0!==arguments[4]?arguments[4]:1e3)*(i-e)/(r-t)).toFixed(arguments.length>5&&void 0!==arguments[5]?arguments[5]:0))}static audioSendQualityMonitor(e){let t="",i="",r="";[n.zu.MainAudio,n.zu.ShareAudio].map((s=>{if(e[s]){const{rtt:a="",packetsSent_diff:d,audioLevelR16Str:c="",audioLevelR16DenoiseStr:l="",targetBitrate:h="",nackCount:u="",retransmittedPacketsSent:p="",echoReturnLoss:m="",echoReturnLossEnhancement:v="",totalAudioEnergy:g=""}=e[s];t+=c,i+=l||c;const _=s==n.zu.MainAudio?"":"[".concat(o.FP,"]");r+="".concat(_).concat(a||-1,"|").concat(d,"|").concat(h,"|").concat(u,"|").concat(p,"|").concat(m,"|").concat(v,"|").concat(f(g,5))}})),r="WCL_AB,UPLINK2,[SPEECH_R16],".concat(t,",").concat(i,",").concat(r),a.A.send_monitor_directly(r)}}(0,r.A)(m,"audioRecvQualityMonitor",(()=>{let e={},t=Date.now();return i=>{if(i.onlyAudioLevel)e[i.key]||(e[i.key]=[]),e[i.key].push(i.audioLevel);else{Object.keys(e).forEach((t=>{i.ssrcMap[t]&&(i.ssrcMap[t].zoomAudioLevel=e[t])}));const{rtt:r,ssrcMap:s}=i;let o="WCL_AB,DOWNLINK2,";Object.keys(s).forEach(((e,t,i)=>{const{zoomAudioLevel:a,concealedSamples_diff:n,insertedSamplesForDeceleration_diff:d,removedSamplesForAcceleration_diff:c,silentConcealedSamples_diff:l,audioPausedStatus:h,audioMutedStatus:u,audioVolume:p,aveJitterBufferDelay_ms:m,aveJitterBuffeTargetrDelay_ms:v,totalPacketsReceived_diff:g,packetsDiscarded_diff:_,packetsLost_diff:S,nackCount_diff:A,totalProcessingDelay_ms:y,isInterpreter:C,totalAudioEnergy:E}=s[e];o+="[".concat(e,"]|").concat(null==a?void 0:a.join(""),"|").concat(g,"|").concat(S,"|").concat(_,"|").concat(A,"|").concat(m,"|").concat(v,"|").concat(n,"|").concat(d,"|").concat(c,"|").concat(l,"|").concat(y,"|").concat(f(E,5),"|").concat(void 0===r?"-1":r,"|").concat(1==h?"":"0","|").concat(1==p?"":p,"|").concat(1==u?"":"0","|").concat(C),t!==i.length-1&&(o+="#")})),t=Date.now(),a.A.send_monitor_directly(o),e={}}}})())},9373:(e,t,i)=>{"use strict";i.d(t,{A:()=>l});var r=i(385),s=(i(3656),i(559),i(3472)),o=i(2710),a=i(8935),n=i(6603),d=i(9559);const c=[0,300,3e3];class l{constructor(){var e,t;let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{mediaStream:o,speakerId:a,pauseCallback:n,errorCallback:d,streamValidCallback:c,mediaType:l,nodeId:h,mid:u,mute:p,volume:f,isCurrentSession:m,webrtcSSRC:v,streamValid:g,isReceivingPacketFunc:_}=i;this._mediaType=l,this._mid=u,this._nodeId=h,this._webrtcSSRC=v,this._isCurrentSession=null==m||m,this._recoverPromise=0,this._lastCurrentTime=0,this._currentTimeStuck=!1,this.initInterpretationParams(),this.mediaStream=o,this.audioTag=this._createAudioTag(o),this.pauseCB=n,this.errorCB=d,this.muted=!1,this._playingLogCount=0,this._pauseLogCount=0,this._totalPlayingDuration=0,this._totalPausedDuration=0,this._audioLifecycleReportTimer=null,this._listenHandlePlaying=this._listenHandlePlaying.bind(this),this._listenHandlePause=this._listenHandlePause.bind(this),this._listenHandleCanPlay=this._listenHandleCanPlay.bind(this),this._listenHandleError=this._listenHandleError.bind(this),this._addListener(),document.documentElement.appendChild(this.audioTag),p&&this.mute(),null!=f&&this.setVolume(f),this.setSpeakerDevicePromise(a).catch((e=>{r.Ay.error("setsinkid failed when creating audio player, mid: ".concat(this._mid,", nodeId: ").concat(this._nodeId,", error code: ").concat(e.code,", error name: ").concat(e.name,", error message: ").concat(e.message,", deviceId: ").concat(a)),(0,s.lo)("SetSinkIdFailed-CreateAudioPlayer:".concat(this._mid,"-").concat(this._nodeId,"-").concat(e.code,"-").concat(e.name,"-").concat(e.message,":deviceId=").concat(a))})),this._isReceivingPacketFunc=_,this._streamValidCallback=c,this._streamValid=g,this._EVER_RECEIVE_PACKET_CHECK_INTERVAL=500,this._startStreamValidCheck(),this._lastStateChangeTimestamp=this._audioCreateTimestamp,this._isCurrentlyPlaying=!(null===(e=null===(t=this.audioTag)||void 0===t?void 0:t.paused)||void 0===e||e),this._startLifecycleReportTimer()}initInterpretationParams(){this._isInterpreter=!1,this._interpreterSpeakingCount=0,this._interpreterSpeakingStatus=o.g3}destroy(){this._removeListener(),this.pause();const e=performance.now();this._finalizePlaybackDurations(e),this._reportAudioLifecycle(e),this._stopLifecycleReportTimer(),this._stopStreamValidCheck(),this.setStream(null),this.audioTag&&(this.audioTag.remove(),this.audioTag=null)}onAssignedNodeId(e,t,i,r){this._nodeId>0||(this._mediaType=e,this._nodeId=t,this._isCurrentSession=i,this._webrtcSSRC=r,this._checkPlayerEverReceivedPacket())}getMediaType(){return this._mediaType}getNodeId(){return this._nodeId}getWebrtcSSRC(){return this._webrtcSSRC}getCurrentTime(){var e;return null===(e=this.audioTag)||void 0===e?void 0:e.currentTime}checkCurrentTime(){if(!(0,a.nr)())return;const e=this.getCurrentTime();e==this._lastCurrentTime?this.reportCurrentTimeIssue(!0,e):this.reportCurrentTimeIssue(!1),this._lastCurrentTime=e}reportCurrentTimeIssue(e,t){this._currentTimeStuck!=e&&(this._currentTimeStuck=e,e?r.Ay.directReport("[RTCAudioPlayer] ".concat(this._mediaType,"-").concat(this._mid,"-").concat(this._nodeId,"-").concat(this._webrtcSSRC," currentTime stop to change, ").concat(t)):r.Ay.directReport("[RTCAudioPlayer] ".concat(this._mediaType,"-").concat(this._mid,"-").concat(this._nodeId,"-").concat(this._webrtcSSRC," currentTime start to change")))}setLang(e){void 0===e&&(e=o.jw),this._lang=e}setInterpreter(e){this._isInterpreter=!!e,this.clearInterpreterSpeakingCount()}getLang(){return this._lang}isInterpreter(){return this._isInterpreter}getVADStatistics(){return{totalAudioEnergy:this._totalAudioEnergy||0,totalSamplesDuration:this._totalSamplesDuration||0}}setVADStatistics(e){let{totalAudioEnergy:t,totalSamplesDuration:i}=e;this._totalAudioEnergy=t,this._totalSamplesDuration=i}increaseInterpreterSpeakingCount(){this._interpreterSpeakingCount++,this._interpreterSpeakingCount>3&&(this._interpreterSpeakingCount=3)}decreaseInterpreterSpeakingCount(){this._interpreterSpeakingCount--,this._interpreterSpeakingCount<0&&(this._interpreterSpeakingCount=0)}clearInterpreterSpeakingCount(){this._interpreterSpeakingCount=0}isInterpreterSpeaking(){return this._interpreterSpeakingCount>=3?this._interpreterSpeakingStatus=o.sr:this._interpreterSpeakingCount<=0&&(this._interpreterSpeakingStatus=o.g3),!!this._interpreterSpeakingStatus}changeVolumeByInterpreter(e){(0,a.nr)()&&e<100?this.setVolume(0):this.setVolume(e)}_createAudioTag(e){const t=n.A.createAudioElement();return this._audioCreateTimestamp=performance.now(),(0,s.lo)("CREATE_AUDIO_TAG-".concat(this._mediaType,"-").concat(this._mid,"-").concat(this._nodeId,"-").concat(this._webrtcSSRC,"-").concat(document.visibilityState)),t.srcObject=e,t.autoplay=!0,t.controls=!1,t.muted=!1,t}_addListener(){this.audioTag&&(this.audioTag.addEventListener("playing",this._listenHandlePlaying),this.audioTag.addEventListener("pause",this._listenHandlePause),this.audioTag.addEventListener("canplay",this._listenHandleCanPlay),this.audioTag.addEventListener("error",this._listenHandleError))}_removeListener(){this.audioTag&&(this.audioTag.removeEventListener("playing",this._listenHandlePlaying),this.audioTag.removeEventListener("pause",this._listenHandlePause),this.audioTag.removeEventListener("canplay",this._listenHandleCanPlay),this.audioTag.removeEventListener("error",this._listenHandleError))}_listenHandlePlaying(){const e=performance.now();var t;this._updatePlaybackDurations(!0,e),this._playingTime=e,this._recoverPromise=null,this._playingLogCount++,this._playingLogCount<10&&(0,s.lo)("ASP:".concat(this._mediaType,"-").concat(this._mid,"-").concat(null!==(t=this._nodeId)&&void 0!==t?t:0,"-").concat(this._isCurrentSession))}_listenHandlePause(){const e=performance.now();var t;this._updatePlaybackDurations(!1,e),this.pauseTime=e,this._pauseLogCount++,this._pauseLogCount<10&&(0,s.lo)("APP:".concat(this._mediaType,"-").concat(this._mid,"-").concat(null!==(t=this._nodeId)&&void 0!==t?t:0,"-").concat(this._isCurrentSession,"-").concat(document.visibilityState)),"function"==typeof this.pauseCB&&this._streamValid&&this.pauseCB.call()}_listenHandleCanPlay(){(0,s.lo)("ACP:".concat(this._mediaType,"-").concat(this._mid))}_listenHandleError(){var e,t,i;let a=null===(e=this.audioTag)||void 0===e||null===(e=e.error)||void 0===e?void 0:e.code,n=null===(t=this.audioTag)||void 0===t||null===(t=t.error)||void 0===t?void 0:t.message;a||(a=o.Rs.MEDIA_ERR_UNKNOWN),"function"==typeof this.errorCB&&this.errorCB(a),r.Ay.error("RTCAudioPlayer tag error, ".concat(this._mediaType," mid=").concat(this._mid,", nodeId=").concat(null!==(i=this._nodeId)&&void 0!==i?i:0,": errorCode=").concat(a,", errorMessage=").concat(n)),(0,s.lo)("APE:".concat(this._mediaType,"-").concat(this._mid,"-").concat(a,"-").concat(n))}isPaused(){return this.audioTag?this.audioTag.paused:void 0}isMuted(){return this.audioTag?this.audioTag.muted:void 0}isSupportSetSpeakerDevice(){var e;return!(null===(e=this.audioTag)||void 0===e||!e.setSinkId)}setStream(e){this.mediaStream=e,this.setSrcObject(e)}setSrcObject(e){this.audioTag&&this.audioTag.srcObject!=e&&(this.audioTag.srcObject=e)}getAudioTrackId(){var e;return null===(e=this.mediaStream)||void 0===e||null===(e=e.getAudioTracks()[0])||void 0===e?void 0:e.id}destroyAudioStream(e){e&&e.getAudioTracks().forEach((e=>{e.stop()}))}play(){return this.audioTag&&this.audioTag.play()}pause(){return this.audioTag&&this.audioTag.pause()}mute(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]||(this.muted=!0),this.audioTag&&(this.audioTag.muted=!0)}unmute(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]||(this.muted=!1),this.audioTag&&!this.muted&&(this.audioTag.muted=!1)}setVolume(e){0===e?this.mute(!0):this.unmute(!0);const t=Math.min(Math.max(0,e),100)/100;this.audioTag&&(this.audioTag.volume=t)}getVolume(){return this.isMuted()?0:this.audioTag.volume}setStreamValid(){this._streamValid||(this._streamValid=!0,null==this||this._streamValidCallback())}_updatePlaybackDurations(e,t){if(this._isCurrentlyPlaying!==e){if(null!=this._lastStateChangeTimestamp){const e=Math.max(0,t-this._lastStateChangeTimestamp);this._isCurrentlyPlaying?this._totalPlayingDuration+=e:this._totalPausedDuration+=e}this._isCurrentlyPlaying=e,this._lastStateChangeTimestamp=t}}_finalizePlaybackDurations(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:performance.now();if(null==this._lastStateChangeTimestamp)return;const t=Math.max(0,e-this._lastStateChangeTimestamp);this._isCurrentlyPlaying?this._totalPlayingDuration+=t:this._totalPausedDuration+=t,this._lastStateChangeTimestamp=e}_reportAudioLifecycle(){var e,t,i;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:performance.now();if(!this._streamValid)return;const o=Math.max(0,r-(null!==(e=this._audioCreateTimestamp)&&void 0!==e?e:r)),a=Math.max(0,this._totalPlayingDuration),n=Math.max(0,this._totalPausedDuration),d="".concat(this._mediaType,"-").concat(this._mid,"-").concat(null!==(t=this._nodeId)&&void 0!==t?t:0,"-").concat(null!==(i=this._webrtcSSRC)&&void 0!==i?i:""),c=o.toFixed(0),l=a.toFixed(0)+"ms("+this._playingLogCount+")",h=n.toFixed(0)+"ms("+this._pauseLogCount+")";(0,s.lo)("AUDIO_TAG_REPORT-".concat(d,"-LIFE-").concat(c,"-PLAY-").concat(l,"-PAUSE-").concat(h))}_startLifecycleReportTimer(){this._audioLifecycleReportTimer||(this._audioLifecycleReportTimer=setInterval((()=>{const e=performance.now();this._finalizePlaybackDurations(e),this._reportAudioLifecycle(e)}),6e4))}_stopLifecycleReportTimer(){this._audioLifecycleReportTimer&&(clearInterval(this._audioLifecycleReportTimer),this._audioLifecycleReportTimer=null)}setSpeakerDevicePromise(e){return new Promise(((t,i)=>this.audioTag&&this.isSupportSetSpeakerDevice()&&e?this.audioTag.sinkId==e?t():void this.audioTag.setSinkId(e).then(t).catch((t=>{r.Ay.error("Error when setting sink of audio player:".concat(e),t),i(t)})):t()))}async tryToRecoverAudioWithRetry(){return this._recoverPromise||(this._recoverPromise=(async()=>{for(let e=0;e<c.length;e++){if(!this.isPaused())return!0;await d.Ay.sleep(c[e]);try{return await this.play(),!0}catch(t){if(!this._streamValid)return!0;if(e===c.length-1)throw r.Ay.error("recover ".concat(this._mediaType,"-").concat(this._mid,"-").concat(this._nodeId,"-").concat(this._webrtcSSRC," player failed after 3 times retry")),new Error(t)}}})()),this._recoverPromise}_startStreamValidCheck(){this._checkPlayerEverReceivedPacket()||(clearInterval(this._streamValidIntTimer),this._streamValidIntTimer=setInterval((()=>{this._checkPlayerEverReceivedPacket()&&(this._stopStreamValidCheck(),null==this||this._streamValidCallback())}),this._EVER_RECEIVE_PACKET_CHECK_INTERVAL))}_checkPlayerEverReceivedPacket(){return!!this._streamValid||(this._streamValid=null==this?void 0:this._isReceivingPacketFunc(this._mid),this._streamValid)}_stopStreamValidCheck(){clearInterval(this._streamValidIntTimer),this._streamValidIntTimer=null}}},9338:(e,t,i)=>{"use strict";i.d(t,{v:()=>f});var r=i(9559),s=i(5738),o=i(9558),a=i(385),n=i(7080),d=i(2689),c=i(559),l=i(2710),h=i(3472);class u{constructor(){this.historySpeech=[],this.speechCntInMute=0}reset(){this.historySpeech=[],this.speechCntInMute=0}webRtcVadAnalyze(e){if(++this.speechCntInMute<50)return!1;let t=this.historySpeech.length>0?this.historySpeech[0]:0;if(this.historySpeech.length>9&&this.historySpeech.splice(-1,1),t?this.historySpeech.splice(0,0,e>0):this.historySpeech.splice(0,0,e>1),this.historySpeech[0]){let e=0,t=0,i=0;if(this.historySpeech.forEach((r=>{e+=r,r?t++:(t>i&&(i=t),t=0)})),t>i&&(i=t),e>3&&i>1)return this.historySpeech.splice(0,this.historySpeech.length),this.speechCntInMute=0,!0}return!1}destroy(){this.historySpeech=[],this.speechCntInMute=0}}var p=i(9310);class f{constructor(e,t){this.workletPath=t||{},this.audioStream=null,this.audioCtx=null,this.webRTCWorkletNode=null,this.inputNode=null,this.outputNode=null,this.isDestroyed=!1,this.initAudioContext(),this.isCreatingWorklet=!1,this.setAudioStreamCallback=e,this.doingDenoise=!1,this.checkProcessInterval=null,this.audioStatus=-1,this.levelR16Log=[],this.levelR16LogDenoise=[],this.voiceDetection=new u,this.enableMuteReminder=!1,this._isMutedBySystem=!1}get isMutedBySystem(){return this._isMutedBySystem}set isMutedBySystem(e){this._isMutedBySystem=e}initAudioContext(){if(!this.audioCtx){let e=r.Ay.getAudioContextConfigure();if(this.audioCtx=(0,r.gd)("WebRTCInput",e),!this.audioCtx)return;this.audioCtx.onstatechange=()=>{var e,t;if(a.Ay.log("WebRTCInput AudioContext state changed to ".concat(null===(e=this.audioCtx)||void 0===e?void 0:e.state)),n.A.add_monitor("ACSC:WebRTCInput:".concat(null===(t=this.audioCtx)||void 0===t?void 0:t.state)),this.audioStream){const e=this.audioStream.getAudioTracks()[0];if(e){var i;const{muted:t}=e;1!==this.audioStatus&&2!==this.audioStatus||t||this.setAudioStreamCallback(null,!0),"running"===(null===(i=this.audioCtx)||void 0===i?void 0:i.state)&&t&&((0,h.Yo)("ACRM"),a.Ay.error("Audio context running when track muted"))}}},this.outputNode=this.audioCtx.createMediaStreamDestination(),this.resumeAudioCtx()}}async createWebRTCWorklet(){const e=r.Ay.isSupportAudioWorklet(),{jsPath:t,wasmPath:i}=this.workletPath;if(this.audioCtx&&t&&e&&!this.isCreatingWorklet){if(this.isCreatingWorklet=!0,!this.webRTCWorkletNode){try{await(0,p.X6)(this.audioCtx.audioWorklet,t)}catch(e){return a.Ay.error("Error when add webRTC worklet module",e),void(this.isCreatingWorklet=!1)}let e;if(i&&(e=await r.Ay.downloadAndCompileWebAssembly(i,"AudioWorklet",n.A,!r.Ay.browser.isSafari&&d.A.enableStreamingInstantiate)),this.isDestroyed)return a.Ay.log("webrtc manager has been destroyed before create audio worklet node"),void this.destroy();let s=r.Ay.isBrowserSupportStereo()?2:1;this.webRTCWorkletNode=new o.A(this.audioCtx,"webRTCWorklet",{processorOptions:{userAgent:navigator.userAgent,wasmModule:e,inputAudioChannel:s},numberOfOutputs:1,outputChannelCount:[2]}),this.webRTCWorkletNode.onprocessorerror=e=>{a.Ay.error("Exception thrown in WebRTC AudioWorkletProcessor",e)},this.webRTCWorkletNode.postCMD("audiowasm"),this.webRTCWorkletNode.port.addEventListener("message",(e=>{this.handleMessage(e)})),this.audioStream&&!this.inputNode&&(this.inputNode=this.audioCtx.createMediaStreamSource(this.audioStream),this.inputNode.connect(this.webRTCWorkletNode)),this.webRTCWorkletNode.connect(this.outputNode),"running"===this.audioCtx.state&&this.startCheckProcess(),a.Ay.log("create worklet successfully")}this.isCreatingWorklet=!1,this.webRTCWorkletNode.postCMD("clearBuffer"),this.resumeAudioCtx()}}handleMessage(e){var t=e.data;switch(t.status){case"AUDIO_LEVEL_R16":{if(1!=this.audioStatus&&2!=this.audioStatus)break;const e=t.level.toString(16);this.addAudioLevelLog(this.levelR16Log,e),this.levelR16Log.length>30&&this.levelR16Log.shift()}break;case"AUDIO_LEVEL_R16_DENOISE":{if(1!=this.audioStatus&&2!=this.audioStatus)break;const e=t.level.toString(16);this.addAudioLevelLog(this.levelR16LogDenoise,e),this.levelR16LogDenoise.length>30&&this.levelR16LogDenoise.shift()}break;case"WASM_INIT_SUCCESS":this.changeDenoiseSwitch(this.denoiseSwitch,this.isHeadSet,this.model);break;case"audio_process_changed":a.Ay.log("denoise switch changed"+t.data),this.doingDenoise=t.data,this.setAudioStreamCallback(null,!0);break;case"audio_process_underrun":var i,r;(null===(i=t.data)||void 0===i?void 0:i.level)===l.wI.SWITCH_TO_LIGHT_DENOISE?(a.Ay.error("audio process occurred underrun, switch denoise mode to light-weight"),(0,h.Yo)("AUDIO_PROCESS_UNDERRUN:SWITCH_LIGHT_DENOISE"),this.changeDenoiseSwitch(this.denoiseSwitch,this.isHeadSet,l.cS.LIGHT_WEIGHT)):(null===(r=t.data)||void 0===r?void 0:r.level)===l.wI.DISABLE_DENOISE&&(a.Ay.error("audio process occurred underrun, disable denoise"),(0,h.Yo)("AUDIO_PROCESS_UNDERRUN:DISABLE_DENOISE"),this.doingDenoise=!t.data,this.setAudioStreamCallback(null,!0),this.changeDenoiseSwitch(!1,!1));break;case c._9I:if(null!=t.data&&(d.A.Notify_APPUI_SAFE(c._9I,{value:t.data}),this.enableMuteReminder||this._isMutedBySystem)){var o;if(!(null===(o=this.voiceDetection)||void 0===o?void 0:o.webRtcVadAnalyze(t.data)))break;this.enableMuteReminder&&(null===d.A||void 0===d.A||d.A.Notify_APPUI_SAFE(c.AV$),this.enableMuteReminder=!1,(0,h.Yo)("SPEAKING_WHEN_MUTE")),this._isMutedBySystem&&(null===d.A||void 0===d.A||d.A.Notify_APPUI_SAFE(c.FjO),this._isMutedBySystem=!1,(0,h.Yo)("CAPTURING_WHEN_MUTED_BY_SYSTEM"))}break;case"SPEECH_LOG":s.addAudioMonitorLog.push({log:t.data.log,logSource:l.Qm})}}setAudioStream(e){this.audioStream=e,this.webRTCWorkletNode&&(this.inputNode&&(this.inputNode.disconnect(),this.inputNode=null),e&&(this.inputNode=this.audioCtx.createMediaStreamSource(this.audioStream),this.inputNode.connect(this.webRTCWorkletNode)))}getAudioStream(){var e;return this.outputNode&&this.webRTCWorkletNode&&this.doingDenoise&&"running"===(null===(e=this.audioCtx)||void 0===e?void 0:e.state)?this.outputNode.stream:null}changeDenoiseSwitch(e,t,i){this.denoiseSwitch=!!e,this.isHeadSet=!!t,this.model=i,this.webRTCWorkletNode&&this.webRTCWorkletNode.postCMD("audio_denoise_switch",{enable:this.denoiseSwitch,isHeadSet:this.isHeadSet,model:i})}getLevelR16Log(){const e=this.levelR16Log.join(""),t=this.levelR16LogDenoise.join("");return this.levelR16Log=[],this.levelR16LogDenoise=[],{resLevelR16Log:e,resLevelR16LogDenoise:t}}addAudioLevelLog(e,t){2==this.audioStatus?null==e||e.push("x"):null==e||e.push(t)}resumeAudioCtx(){var e,t;1!==this.audioStatus&&2!==this.audioStatus||"running"===(null===(e=this.audioCtx)||void 0===e?void 0:e.state)||"closed"===(null===(t=this.audioCtx)||void 0===t?void 0:t.state)||this.isCreatingWorklet||(this.startCheckProcess(),this.audioCtx.resume().catch((e=>{a.Ay.error("webRTC audioContext resume fail",e)})))}suspendAudioCtx(){var e;"suspended"===(null===(e=this.audioCtx)||void 0===e?void 0:e.state)||this.isCreatingWorklet||(this.stopCheckProcess(),this.audioCtx.suspend().catch((e=>{a.Ay.error("Error when suspend audio context",e)})))}changeAudioStatus(e,t){var i,r;t?(this.audioStatus=3,this.enableMuteReminder=!1,this._isMutedBySystem=!1,null===(i=this.voiceDetection)||void 0===i||i.reset(),this.suspendAudioCtx()):(2!==this.audioStatus&&e?this.enableMuteReminder=!0:e||(this.enableMuteReminder=!1),null===(r=this.voiceDetection)||void 0===r||r.reset(),this.audioStatus=e?2:1,this.resumeAudioCtx())}startCheckProcess(){this.stopCheckProcess(),this.webRTCWorkletNode&&(this.webRTCWorkletNode.postCMD("clearProcess",null),this.checkProcessInterval=setInterval((()=>{this.webRTCWorkletNode&&this.webRTCWorkletNode.postCMD("checkProcess",null)}),2e3))}stopCheckProcess(){this.checkProcessInterval&&(clearInterval(this.checkProcessInterval),this.checkProcessInterval=null)}destroy(){try{this.isDestroyed=!0,this.webRTCWorkletNode&&(this.webRTCWorkletNode.disconnect(),this.webRTCWorkletNode.postCMD("stopWorklet",!0),this.webRTCWorkletNode=null),this.inputNode&&(this.inputNode.disconnect(this.audioLevelNode),this.inputNode=null),this.outputNode&&(this.outputNode.disconnect(),this.outputNode=null),this.audioCtx&&"closed"!==this.audioCtx.state&&this.audioCtx.suspend().finally((()=>{this.audioCtx.close(),this.audioCtx=null})),this.audioStream=null,this.audioStatus=-1,this.levelR16Log=[],this.levelR16LogDenoise=[],this.voiceDetection.destroy(),this.voiceDetection=null,this.enableMuteReminder=!1,this._isMutedBySystem=!1,this.wasmModule=null,this.isCreatingWorklet=!1,(0,h.Yo)("DSALOK")}catch(e){(0,h.Yo)("DSALERR"),a.Ay.error("Error when destroy webRTC manager",e)}}}},5803:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});var r=i(385),s=i(2710),o=i(242),a=i(7080);class n{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.ENERGY_FREEZE_MAX_DURATION=1e4,this._previousTotalAudioEnergySent={total:0,changedTimestamp:0,failedCounter:0,recoveredCounter:0},this._isEnergySentCheckReported=!1,this._previousPacketSent={count:0,noPacketsCounter:0},this._isPacketSentBytesZero=!1,this._audioReceiveHealthMap=new Map,this._webrtcAudio=e.webrtcAudio,this._onAudioEnergySentCheckResult=e.onAudioEnergySentCheckResult,this._onPacketSentCheckResult=e.onPacketSentCheckResult,this._onAudioEnergyReceivedCheck=e.onAudioEnergyReceivedCheckResult,this._audioTagMismatchCounter=0,this._mismatchRetryTimer=null,this._MISMATCH_RETRY_DELAYS=[50,100,200],this._MISMATCH_THRESHOLD=3,this.onCheck=this.onCheck.bind(this),this.audioTagStatusCheckTimeout=null}get isPacketSentBytesZero(){return this._isPacketSentBytesZero}resetPacketSentCheck(){this._isPacketSentBytesZero=!1}addRemoteAudio(e){e&&(this._audioReceiveHealthMap.has(e)||this._audioReceiveHealthMap.set(e,{healthCounter:0,healthStatus:s.FD.UNCHECKED}))}removeRemoteAudio(e){e&&this._audioReceiveHealthMap.has(e)&&this._audioReceiveHealthMap.delete(e)}onCheck(e){let{uplinkPacketsSent:t,uplinkTotalAudioEnergy:i,downlinkStatInfo:r,isUplink:s}=e;var o;s?(this._checkPacketSent(t),null!==(o=this._webrtcAudio)&&void 0!==o&&o.doingDenoise||this._checkTotalAudioEnergySent(i)):this._checkReceivedEnergy(r)}_checkReceivedEnergy(e){if(this._webrtcAudio.getAudioMode()!=s.qR)return;if(0==this._audioReceiveHealthMap.size||!e)return;const t=null==e?void 0:e.ssrcMap;t&&(Object.keys(t).forEach((e=>{const{aveAudioLevel:i,ssrc:r}=t[e];let o=this._audioReceiveHealthMap.get(r);o&&(i>1e-4?(o.healthCounter>=1&&(o.healthStatus=s.FD.HEALTHY),o.healthCounter++):(0==o.healthCounter&&(o.healthStatus=s.FD.UNHEALTHY),o.healthCounter=0),this._audioReceiveHealthMap.set(r,o))})),this._checkReceivedHealthWhenAudioPlayerError())}_checkReceivedHealthWhenAudioPlayerError(){if(this._webrtcAudio.getAudioMode()!=s.qR)return;if(!this._webrtcAudio.isAudioPlayerError||0==this._audioReceiveHealthMap.size)return;let e=!0;for(const[i,r]of this._audioReceiveHealthMap){if(r.healthStatus==s.FD.HEALTHY){var t;e=!1,null===(t=this._onAudioEnergyReceivedCheck)||void 0===t||t.call(this,!0);break}if(r.healthStatus==s.FD.UNCHECKED){e=!1;break}}var i;e&&(null===(i=this._onAudioEnergyReceivedCheck)||void 0===i||i.call(this,!1))}async _isNotValidStateForCheckingAudioEnergy(){return 0==this._previousTotalAudioEnergySent.changedTimestamp||this._webrtcAudio.isMutedBySystem||"hidden"==document.visibilityState||!await o.A.hasPermission("microphone")}async _checkTotalAudioEnergySent(e){if(!e)return;const t=Math.floor(performance.now());if(this._webrtcAudio.getAudioMode()&s.qR&&0==this._webrtcAudio.isMuted){if(await this._isNotValidStateForCheckingAudioEnergy())return this._cacheTotalEnergy(e,t);const r=t-this._previousTotalAudioEnergySent.changedTimestamp;if(e!=this._previousTotalAudioEnergySent.total)this._previousTotalAudioEnergySent.failedCounter>0&&this._isEnergySentCheckReported&&(this._previousTotalAudioEnergySent.recoveredCounter++,this._onAudioEnergySentCheckResult(!0,e,r,this._previousTotalAudioEnergySent.recoveredCounter),this._isEnergySentCheckReported=!1),this._cacheTotalEnergy(e,t);else if(r>=this.ENERGY_FREEZE_MAX_DURATION){var i;this._previousTotalAudioEnergySent.failedCounter++,null===(i=this._onAudioEnergySentCheckResult)||void 0===i||i.call(this,!1,e,r,this._previousTotalAudioEnergySent.failedCounter),this._isEnergySentCheckReported=!0,this._cacheTotalEnergy(e,t)}}else this._cacheTotalEnergy(0,t)}_cacheTotalEnergy(e,t){this._previousTotalAudioEnergySent.total=e,this._previousTotalAudioEnergySent.changedTimestamp=t}_checkPacketSent(e){var t,i;this._webrtcAudio.getAudioMode()!=s.qR||!this._webrtcAudio.getAudioStream()||this._webrtcAudio.isMuted||(e||0)-this._previousPacketSent.count!=0||this._webrtcAudio.isMutedBySystem?(this._webrtcAudio.getAudioMode()==s.qR&&this._webrtcAudio.getAudioStream()&&1==this._isPacketSentBytesZero&&(e||0)-this._previousPacketSent.count>0&&(null===(t=this._onPacketSentCheckResult)||void 0===t||t.call(this,!0)),this._isPacketSentBytesZero=!1,this._previousPacketSent.noPacketsCounter=0,this._previousPacketSent.count=e||0):(this._previousPacketSent.noPacketsCounter++,2===this._previousPacketSent.noPacketsCounter&&0==this._isPacketSentBytesZero&&(null===(i=this._onPacketSentCheckResult)||void 0===i||i.call(this,!1),this._isPacketSentBytesZero=!0,this._previousPacketSent.noPacketsCounter=0))}_audioTagCountAndStatusMonitor(e,t,i,r,s){var o;let a=arguments.length>5&&void 0!==arguments[5]&&arguments[5],n=new Set;if(!(e=(null===(o=e)||void 0===o?void 0:o.pc)||e))return;e.getTransceivers().forEach((e=>{var t;const i=e.currentDirection;if("audio"===(null===(t=e.receiver)||void 0===t||null===(t=t.track)||void 0===t?void 0:t.kind)&&("recvonly"===i||!i&&"recvonly"===e.direction)){const t=e.receiver.track.id;e.receiver.track.id&&n.add(t)}}));const d=n.size,c=t.size;let l=!0;const h=[];for(const e of t.values()){e.isPaused()?i?h.push(e.tryToRecoverAudioWithRetry()):h.push(e.play()):e.checkCurrentTime();const t=e.getAudioTrackId();if(!t||!n.has(t)){l=!1;break}}Promise.all(h.filter(Boolean)).then((()=>{r&&r()})).catch((e=>{s&&s(e)})),d!==c&&(l=!1),l||a?l&&this._resetAudioTagMismatchState():this._handleAudioTagMismatch(e,t,i,r,s,d,c)}_handleAudioTagMismatch(e,t,i,s,o,n,d){if(this._audioTagMismatchCounter++,this._audioTagMismatchCounter<this._MISMATCH_THRESHOLD){const a=this._audioTagMismatchCounter-1,c=this._MISMATCH_RETRY_DELAYS[a]||this._MISMATCH_RETRY_DELAYS[this._MISMATCH_RETRY_DELAYS.length-1];r.Ay.directReport("[AudioHealthChecker] Audio tag count mismatch detected (attempt ".concat(this._audioTagMismatchCounter,"/").concat(this._MISMATCH_THRESHOLD,"), ")+"receiverCount=".concat(n,", audioPlayerCount=").concat(d,", ")+"scheduling retry in ".concat(c,"ms")),this._mismatchRetryTimer&&clearTimeout(this._mismatchRetryTimer),this._mismatchRetryTimer=setTimeout((()=>{r.Ay.directReport("[AudioHealthChecker] Executing quick retry check ".concat(this._audioTagMismatchCounter)),this._audioTagCountAndStatusMonitor(e,t,i,s,o,!1)}),c)}else a.A.add_monitor("AUDIO_TAG_COUNT_NOT_MATCH"),r.Ay.error("[AudioHealthChecker] Audio tag count not match after ".concat(this._audioTagMismatchCounter," consecutive checks, ")+"receiverCount=".concat(n,", audioPlayerCount=").concat(d)),this._resetAudioTagMismatchState()}_resetAudioTagMismatchState(){this._audioTagMismatchCounter>0&&(r.Ay.directReport("[AudioHealthChecker] Audio tag count mismatch resolved after ".concat(this._audioTagMismatchCounter," check(s)")),this._audioTagMismatchCounter=0),this._mismatchRetryTimer&&(clearTimeout(this._mismatchRetryTimer),this._mismatchRetryTimer=null)}}},5738:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Add_Audio_Decode_Thread:()=>Ue,Add_Video_Decode_Thread:()=>We,AssertMediaSdkNotDestory:()=>se,Clear_Decoded_Sharing_Frame:()=>Le,CloseMediaNetSessionToRwg:()=>re,CreateThreadWorker:()=>$t,GetMediaSession:()=>ei,GetWorkerTypeThread:()=>Zt,Get_SSRC_Latest_Time:()=>Be,Get_Video_SSRC_Latest_Time:()=>Fe,JsAudioEngine_UnInit:()=>Pe,JsSharingEngine_UnInit:()=>Oe,JsVideoEngine_UnInit:()=>ke,MEDIA_INIT_SUCCESS_CALLBACK_METADATA:()=>Yt,Meeting_Fail_Over:()=>He,MirrorSendVideo:()=>zt,Modify_Audio_SampleRate:()=>Ge,Notify_Audio_Decode_Thread:()=>dt,Notify_Audio_Encode_Thread:()=>nt,Notify_Audio_Thread_AEC_Status:()=>Ke,Notify_Audio_Thread_CC_Set_Lang:()=>lt,Notify_Audio_Thread_CurrentSSRC:()=>at,Notify_Audio_Thread_Interpretation_Enable:()=>ct,Notify_Audio_Thread_Interpretation_Mute:()=>ut,Notify_Audio_Thread_Interpretation_Set_Interpreter:()=>pt,Notify_Audio_Thread_Interpretation_Set_Lang:()=>ht,Notify_Audio_Thread_Msg_Channel:()=>ze,Notify_Audio_Thread_Msg_Channel2:()=>Xe,Notify_Audio_Thread_Msg_Channel3:()=>Qe,Notify_Audio_Thread_Status:()=>je,Notify_Audio_Video_Thread_Msg_Channel:()=>Je,Notify_Sharing_Decode_Thread:()=>ot,Notify_Sharing_Encode_Thread:()=>Tt,Notify_Sharing_Encode_Thread_Transferable_Data:()=>rt,Notify_Sharing_Video_Decode_Thread:()=>st,Notify_Sharing_Video_Encode_Thread:()=>Rt,Notify_Sharing_Video_Encode_Thread_Transferable_Data:()=>it,Notify_Video_Decode_Thread:()=>tt,Notify_Video_Encode_Thread:()=>$e,Notify_Video_Encode_Thread_Transferable_Data:()=>Ze,Notify_Video_Sharing_Msg_Channel:()=>Ye,Notify_Video_Thread_Msg_Channel:()=>qe,Put_Video_Frame_Buffer:()=>xe,Reset_Aec:()=>ft,Send_Render_Monitor_Log:()=>St,Set_Audio_WebSocket_Ip_Address:()=>Te,Set_Audio_Web_Transport_Ip_Address:()=>Ie,Set_Video_WebSocket_Ip_Address:()=>Me,Set_Video_Web_Transport_Ip_Address:()=>De,Sharing_Decode_Post_message:()=>pe,Sharing_Encode_Frame:()=>Ne,Sharing_Encode_Post_message:()=>fe,Start_Monitor:()=>gt,Start_Recv_StatsMap_Clear_Handle:()=>_t,Stop_Monitor:()=>At,Stop_Recv_StatsMap_Clear_Handle:()=>yt,TransferCmdMsgToWorker:()=>Jt,TransoferDataToVideoEncodeThread:()=>et,UpdateAudioPlayStatus:()=>Q,UpdateSharingPlayStatus:()=>$,UpdateVideoPlayStatus:()=>J,Update_Audio_Encrpt:()=>It,Update_Sharing_Encode_Status:()=>wt,Update_Sharing_Encrpt:()=>Et,Update_Sharing_Video_Encode_Status:()=>bt,Update_Video_Encrpt:()=>Ct,Video_Encode_Frame:()=>Ve,addAudioMonitorLog:()=>Ae,clearWorkerListener:()=>Pt,closeAllMedia:()=>kt,closeAllPromiseObject:()=>Dt,destroyAllWorkers:()=>Ot,disableSocketReconnect:()=>Mt,downloadWASMAndPostToWorker:()=>Se,initAudioDecode:()=>de,initAudioEncode:()=>ne,initAudioSharedBuffer:()=>Ee,initResourceManager:()=>Ut,initSharingDecode:()=>ce,initSharingEncode:()=>le,initVideoDecode:()=>ae,initVideoEncode:()=>te,isSharingNotClearChromeVersion:()=>qt,isVideoEncodeHandleReady:()=>Lt,prepareVBfile:()=>Ht,preserveMessageController:()=>Z,previewController:()=>ee,pushMessageToAudioWorklet:()=>xt,pushMessageToWorker:()=>Nt,saveBrowserInfo:()=>vt,setAudioEngineInitProperties:()=>we,setCachedUserNodeListToWorker:()=>q,setMediaSessionHold:()=>Xt,setSharingEngineInitProperties:()=>be,setUserNodeListToWorker:()=>Y,setVideoEngineInitProperties:()=>Re,transportBgImageBitMap:()=>Gt,transportMaskImageBitMap:()=>Kt,transportSettingCanvas:()=>Wt,transportVBBgImageBitMap:()=>jt,updateCook:()=>X});var r=i(7857),s=i(7026),o=i(6984),a=i.n(o),n=i(559),d=i(2710),c=i(9407),l=i(5169),h=i(9559),u=i(6280),p=i(385),f=i(4543),m=i(7080),v=i(9482),g=i(2689),_=i(3485),S=i(879),A=i(4895),y=i(9693),C=i(2614),E=i(3656),b=i(3903),w=i(7355),R=i(5723),T=i(3647),I=i(9102),M=i(1223),D=i(6654);const P=["name","messageParams","direction"],k=["status","cmd"],O=["status","cmd"],V=["status","cmd"],N=["status","cmd"];function x(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,r)}return i}function L(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?x(Object(i),!0).forEach((function(t){(0,r.A)(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):x(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}const W=(0,u.A)("sdk.engine"),{HjG:U}=n;async function B(e,t){let i,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=!1;switch(e){case v._c.VIDEO_ENCODE:i=g.A.videoEncResponseText,s=!0;break;case v._c.VIDEO_DECODE:i=g.A.videoDecResponseText,s=!0;break;case v._c.AUDIO_ENCODE:i=g.A.audioEncodeResponse;break;case v._c.AUDIO_DECODE:i=g.A.audioDecodeResponse;break;case v._c.SHARING_DECODE:i=g.A.sharingDecodeResponse,s=!0;break;case v._c.SHARING_ENCODE:i=g.A.sharingEncodeResponse,s=!0}i||(i=await F(t.workerJsFileUrl,t.integrityHelper));const o="wasmUrl = '"+t.workerWasmFileUrl+"';",a="var isZoomWasm32Bit = "+(s&&g.A.mediaSDKHandle.is32bitbrowser)+";",n="var nonsabVB = "+r+";";return i.replace(/self\.__wasmCodeDataEndFlag\s*=\s*1[;|,]/,o+a+n+"self.__wasmCodeDataEndFlag = 1;")}function F(e,t){let i=null;return t&&(i=t.getIntegrity()),h.Ay.download(e,i)}function H(e,t,i,r,s){return new Promise(((o,d)=>{!async function(e,t,i,r,s){if(s&&s.isDestroy)return m.A.add_monitor("ZIDX",r),W("WorkerType:".concat(r,";The relative SDK instance is destroy, don't start relative worker, avoid multiple same workers. "));let o,d={};if(v.d[r]&&Object.assign(d,{name:v.d[r]}),r==v._c.AUDIO_ENCODE?g.A.AEW&&(o=g.A.AEW):r==v._c.AUDIO_DECODE&&g.A.ADW&&(o=g.A.ADW),o)r==v._c.AUDIO_ENCODE?g.A.AEWF=!0:r==v._c.AUDIO_DECODE&&(g.A.ADWF=!0);else{const t=a().createObjectURL(new Blob([await B(r,e)]));if(o=new Worker(t,d),o.addEventListener("error",(e=>{if(e.message){if(e.message.includes("RuntimeError:")){let e=performance.now();e-g.A.crashLastTime>3e4&&(g.A.crashCount++,g.A.crashLastTime=e,(0,E.iK)(n.oQY,!g.A.hasUsedWebrtc&&g.A.hasWasmMemoryError?{video:2}:null),K("NOTIFY_UI_FAILOVER ".concat(g.A.crashCount)))}}else p.Ay.error("Error from ".concat(r)+(null==e?void 0:e.message))})),r===v._c.VIDEO_ENCODE){let i=t;g.A.mediaSDKHandle.is32bitbrowser&&(i=a().createObjectURL(new Blob([await B(r,e,!0)]))),o.postMessage({command:"WORKER_BOLB_URL",blobUrl:i})}g.A.mediaSDKHandle.is32bitbrowser&&(r==v._c.AUDIO_ENCODE?g.A.AEW=o:r==v._c.AUDIO_DECODE&&(g.A.ADW=o))}o&&o.postMessage({command:y.INIT_THREAD,workerType:r}),t&&t.call(i,o)}(e,(function(e){var s=g.A.SPECIAL_ID;t&&(m.A.add_monitor("WAM"+r),t.Add(s,e)),e.onmessage=e=>{i(e)},o()}),this,r,s)}))}function G(e,t){let i=t.data;i.status!==c.Os?i.status!=c.wo?[j,z].forEach((t=>{try{t.call(null,e,i)}catch(e){p.Ay.error("Error from allWorkersListener",e)}})):function(e){if(g.A.browserFeature)return;const t=new R.rm(e);g.A.browserFeature=t,g.A.browserFeaturedefer.resolve(t);const i=(0,h.uF)();!t.isSupportOffScreenCanvasWebgl()&&i&&p.Ay.directReport("disable webgl in worker")}(i.data):(0,w.Ek)().setTaskResult(i)}function j(e,t){-1!==[v._c.AUDIO_ENCODE,v._c.VIDEO_ENCODE,v._c.SHARING_ENCODE].indexOf(e)&&t.status===c._Q&&(W("allWorkersListener_AES_IV",e,t),g.A.Notify_APPUI_SAFE(n.Ewj,{workerType:e,iv:h.Ay.buffer2stringSplitByComma(t.data)}))}function K(e){let t=h.Ay.getMachineCapability();t.errorMessage=e,p.Ay.severityerror(t,["MEDIASDK_ERROR"])}function z(e,t){if(t.status===c.AC)if("low"==t.level)p.Ay.directReport("".concat(t.errorMessage));else{let i="Error from ".concat(e," worker: ").concat(t.errorMessage);-1!=i.indexOf("E:H")?K(i):p.Ay.error(i,t.errorEvent)}}function q(e){try{var t;null!==(t=g.A.userNodeList)&&void 0!==t&&t.length&&Nt(e,{userNodeList:g.A.userNodeList},y.SET_USER_NODE_LIST,!1,!1)}catch(t){p.Ay.error("Error when sending cached user node list to worker workerType "+e,t)}}function Y(e){let t=g.A.userNodeList||[],i=e.concat(t);g.A.userNodeList=h.Ay.removeDuplicates(i,((e,t)=>e.userid!==t.userid)),[v._c.AUDIO_ENCODE,v._c.AUDIO_DECODE,v._c.VIDEO_ENCODE,v._c.VIDEO_DECODE,v._c.SHARING_ENCODE,v._c.SHARING_DECODE].forEach((async e=>{let t;switch(e){case v._c.AUDIO_ENCODE:t=g.A.audioEncodeInitInstance;break;case v._c.AUDIO_DECODE:t=g.A.audioDecInitInstance;break;case v._c.VIDEO_ENCODE:t=g.A.videoInitInstance;break;case v._c.VIDEO_DECODE:t=g.A.videoDecInitInstance;break;case v._c.SHARING_ENCODE:t=g.A.sharingEncInitInstance;break;case v._c.SHARING_DECODE:t=g.A.sharingDecInitInstance}try{await t.waitforInitSuccess(),W("setUserNodeListToWorker init success",e),Nt(e,{userNodeList:g.A.userNodeList},y.SET_USER_NODE_LIST,!1,!0)}catch(e){p.Ay.error("Error when sending user node list to worker",e)}}))}function X(e){const t=new Uint8Array(e.length+12);t[0]=102,t[4]=2,t[8]=e.length,t.set(e,12,e.length),[v._c.AUDIO_ENCODE,v._c.AUDIO_DECODE,v._c.VIDEO_ENCODE,v._c.VIDEO_DECODE].forEach((async e=>{let i;switch(e){case v._c.AUDIO_DECODE:i=g.A.audioDecInitInstance;break;case v._c.VIDEO_DECODE:i=g.A.videoDecInitInstance}try{await i.waitforInitSuccess(),W("setUserNodeListToWorker init success",e),Nt(e,t,y.LSS_UPDATE_COOK,!1,!0)}catch(e){W(e)}}))}function Q(e){g.A.isAudioPlayWork=e}async function J(e){g.A.isVideoPlayWork=e,await Nt(v._c.VIDEO_DECODE,{isVideoPlayWork:e},"VideoPlayStatus",!1,!0)}function $(e){g.A.isSharingPlayWork=e}const Z=function(){const e={SDK_TO_WORKER:"SDK_TO_WORKER",SDK_TO_WORKER_WAIT_OK:"SDK_TO_WORKER_WAIT_OK",SDK_TO_APP:"SDK_TO_APP",SDK_TO_SDK:"SDK_TO_SDK"};return{nameMap:{INIT_VIDEO_ENCODE_SUCCESS:"INIT_VIDEO_ENCODE_SUCCESS",INIT_VIDEO_DECODE_SUCCESS:"INIT_VIDEO_DECODE_SUCCESS",CREATE_VIDEO_ENCODE_HANDLE_SUCCESS:"CREATE_VIDEO_ENCODE_HANDLE_SUCCESS",CREATE_VIDEO_DECODE_HANDLE_SUCCESS:"CREATE_VIDEO_DECODE_HANDLE_SUCCESS",CREATE_AUDIO_ENCODE_HANDLE_SUCCESS:"CREATE_AUDIO_ENCODE_HANDLE_SUCCESS",CREATE_AUDIO_DECODE_HANDLE_SUCCESS:"CREATE_AUDIO_DECODE_HANDLE_SUCCESS"},map:new Map,direction:e,clear(){this.map.clear()},subscribeMessage(t){const i=this.map.get(t);i&&(i.forEach((t=>{const{direction:i,messageParams:r,handler:s}=t;if(i===e.SDK_TO_APP)g.A.Notify_APPUI(...r);else if(i===e.SDK_TO_WORKER_WAIT_OK)Nt(...r);else if(i===e.SDK_TO_WORKER){const[e,t]=r,i=Vt(e);i&&i.postMessage(t)}else i===e.SDK_TO_SDK&&s&&s(r)})),this.map.delete(t))},enqueueMessage(e){let{name:t,messageParams:i=[],direction:r}=e,o=(0,s.A)(e,P);this.map.has(t)||this.map.set(t,[]),this.map.get(t).push(L({direction:r,messageParams:i||[]},o))}}}(),ee={resetAudioEncode:e=>{!e&&g.A.isPreviewMode.audioEncode&&(g.A.audioEncodeSession=null),g.A.isPreviewMode.audioEncode=!!e},resetAudioDecode:e=>{!e&&g.A.isPreviewMode.audioDecode&&(g.A.audioDecodeSession=null),g.A.isPreviewMode.audioDecode=!!e},resetVideoEncode:e=>{!e&&g.A.isPreviewMode.videoEncode&&(g.A.videoEncodeSession=null),g.A.isPreviewMode.videoEncode=!!e},resetVideoDecode:e=>{!e&&g.A.isPreviewMode.videoDecode&&(g.A.videoDecodeSession=null),g.A.isPreviewMode.videoDecode=!!e}};async function te(e,t){g.A.localVideoEncMGR||(g.A.localVideoEncMGR=new l.cI({sessionid:t._id})),ie(v._c.VIDEO_DECODE,g.A.localVideoEncMGR.sessionid,t._id),g.A.videoEncWorkerPath=e.workerJsFileUrl;let i=await F(e.workerJsFileUrl,e.integrityHelper);if(g.A.videoEncResponseText=i,!se(t))return!1;if(await async function(e,t,i,r){g.A.localVideoEncMGR&&(g.A.isVideoEncodeThreadStart||(g.A.isVideoEncodeThreadStart=!0,await H(r,g.A.localVideoEncMGR,_e,v._c.VIDEO_ENCODE,i)))}(0,0,t,e),!se(t,"Add_Video_Encode_Thread"))return p.Ay.error("Add_Video_Encode_Thread Worker Not Controled"),!1;let r=Zt(v._c.VIDEO_ENCODE);(0,C.Eg)(r,v._c.VIDEO_ENCODE),(0,b.CV)(r,v._c.VIDEO_ENCODE),Z.subscribeMessage(Z.nameMap.CREATE_VIDEO_ENCODE_HANDLE_SUCCESS),await async function(e){if(!g.A.localVideoEncMGR)return;if(await g.A.videoInitInstance.wasmSuccessPromise,!se(e))return;var t=g.A.localVideoEncMGR.map.get(g.A.SPECIAL_ID);let i=g.A.localVideoPara.confId||0;if(oe(g.A.videoEncodeSession,i)&&(g.A.videoEncodeSession=null),t&&!g.A.videoEncodeSession){g.A.videoEncodeSession={type:v._c.VIDEO_ENCODE,userId:i};var r;r="firefox"===h.Ay.browserType.browser?1080:1070,g.A.mediaSDKHandle.mtu_size=r;let s=null;await S.f.analyzedPromise();const o=await ue(g.A.localVideoPara.rendererType);let a,n;A.X.isUseSsrcStream()&&(a=I.e.exposeService().accquirePort(),n=await he("wasm_ssrc_stream_service_dynmod"));const d=a?[a]:[];let c=L(L({command:y.START_MEDIA,_id:e._id,websocket_ip_address:g.A.Video_WebSocket_Ip_Address?g.A.Video_WebSocket_Ip_Address+"&mode=2":void 0,confId:g.A.localVideoPara.confId,confKey:"",logon:g.A.localVideoPara.logon,sendvideo:!0,isChromeOrEdge:h.Ay.browser.isChromeOrEdge,isArmSafari:h.Ay.browserEngine.isWebkit&&("iOS"===h.Ay.getOSInfo().os||h.Ay.isMac())&&!h.Ay.isMacIntelSafari(),isFirefox:g.A.localVideoPara.isFirefox,mtu_size:r,meetingid:g.A.localVideoPara.meetingid,meetingnumb:g.A.localVideoPara.meetingnumb,videoencodethreadnumb:g.A.localVideoPara.videoencodethreadnumb,iv:s,videodecodethreadnumb:g.A.localVideoPara.videodecodethreadnumb,isSupportMultiThread:g.A.localVideoPara.isSupportMultiThread,isSupportVirtualBackground:g.A.localVideoPara.isSupportVirtualBackground,uplimit:g.A.uplimit,isSupportWebCodecEnocde:g.A.localVideoPara.isSupportWebCodecEnocde,initWebCodecFlag:g.A.localVideoPara.initWebCodecFlag,is360penablehwenc:g.A.enable360pHWEnc,is360penablehwdec:g.A.enable360pHWDec,enable720p:g.A.localVideoPara.enable720p,enableOptCopyFrame:g.A.enableOptCopyFrame,isPreviewMode:g.A.isPreviewMode.videoEncode},g.A.Video_Web_Transport_Ip_Address?{webtransportURL:g.A.Video_Web_Transport_Ip_Address+"&mode=2"}:{}),{},{platformType:g.A.localVideoPara.platformType,rendererType:g.A.localVideoPara.rendererType,rendererDynModBlob:o,graphicalname:h.Ay.graphicName,vendorname:h.Ay.graphicvendorname,enableMultiDecodeVideoWithoutSAB:!!g.A.enableMultiDecodeVideoWithoutSAB,IsRenderInWorker:g.A.localVideoPara.IsRenderInWorker,enableVBWasmBackend:e.enableVBWasmBackend,webrtcvideo:g.A.localVideoPara.webrtcvideo,isEnableCanvasAlphaChannel:g.A.enableCanvasAlphaChannel,renderUserAgentInfo:_.l.info(),renderCapabilitiesDesc:S.f.desc(),renderConfigDesc:A.X.desc(),MaskFlag:g.A.localVideoPara.MaskFlag,isSafari:!!g.A.localVideoPara.isSafari,isVDIWebview:g.A.isVDIWebview,currentTime:g.A.timeOrigin+performance.now(),registryServicePort:a,wasmSsrcStreamServiceDynmodBlob:n,hwEncAdditionalConfig:g.A.hwEncAdditionalConfig,hwEncAddConIdx:g.A.hwEncAddConIdx,enableFetchWithCache:g.A.enableFetchWithCache,mediaSDKCDNPath:g.A.mediaSDKCDNPath,supportHWEncRetry:g.A.supportHWEncRetry,hwEncRetryConIdx:g.A.hwEncRetryConIdx,hwEncRetryConfig:g.A.hwEncRetryConfig});t.postMessage(c,d),g.A.tfjsurl&&t.postMessage({command:"DOWNLOAD_JSON_FROM_MAIN_THREAD_OK",data:g.A.tfjsurl,type:"js"}),g.A.vbbin&&g.A.vbjson&&t.postMessage({command:"DOWNLOAD_JSON_FROM_MAIN_THREAD_OK",data:{bin:g.A.vbbin,json:g.A.vbjson},index:0}),g.A.afnbin&&g.A.afnjson&&(t.postMessage({command:"DOWNLOAD_JSON_FROM_MAIN_THREAD_OK",data:{bin:g.A.afnbin,json:g.A.afnjson},index:1}),g.A.basebin&&g.A.basejson&&t.postMessage({command:"DOWNLOAD_JSON_FROM_MAIN_THREAD_OK",data:{bin:g.A.basebin,json:g.A.basejson},index:2}))}}(t)}function ie(e,t,i){let r=t==i;return r||p.Ay.error("mediasdkInstance id ".concat(i," not equal media type ").concat(e," id ").concat(t)),r}function re(e,t){g.A.sendMessageToRwg(n.yJV,{evt:n.ahr,body:{flag:t,type:e}},!1)}function se(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return e.isDestroy&&p.Ay.log("mediasdkInstance id ".concat(e._id," is Destoryed from ").concat(t)),!e.isDestroy}function oe(e,t){return!(!e||e.userId>>10==t>>10||(e.userId&&p.Ay.error("mediasdk user changed media type ".concat(e.type," pre id ").concat(e.userId," now id ").concat(t)),0))}async function ae(e,t){g.A.localVideoDecMGR||(g.A.localVideoDecMGR=new l.cI({sessionid:t._id})),ie(v._c.VIDEO_DECODE,g.A.localVideoDecMGR.sessionid,t._id),g.A.videoDecWorkerPath=e.workerJsFileUrl;let i=await F(e.workerJsFileUrl,e.integrityHelper);if(!se(t))return!1;if(g.A.videoDecResponseText=i,await We(0,0,t,e),!se(t,"Add_Video_Decode_Thread"))return p.Ay.error("Add_Video_Decode_Thread Worker Not Controled"),!1;let r=Zt(v._c.VIDEO_DECODE);(0,C.Eg)(r,v._c.VIDEO_DECODE),(0,b.CV)(r,v._c.VIDEO_DECODE),Z.subscribeMessage(Z.nameMap.CREATE_VIDEO_DECODE_HANDLE_SUCCESS),await async function(e){if(g.A.isPreviewMode.videoDecode)return;if(!g.A.localVideoDecMGR)return;if(await g.A.videoDecInitInstance.wasmSuccessPromise,!se(e))return!1;var t=g.A.localVideoDecMGR.map.get(g.A.SPECIAL_ID);let i=g.A.localVideoPara.confId||0;if(oe(g.A.videoDecodeSession,i)&&(g.A.videoDecodeSession=null),t&&!g.A.videoDecodeSession){g.A.videoDecodeSession={type:v._c.VIDEO_DECODE,userId:i},await S.f.analyzedPromise();const r=await ue(g.A.localVideoPara.rendererType);let s,o;A.X.isUseSsrcStream()&&(s=I.e.exposeService().accquirePort(),o=await he("wasm_ssrc_stream_service_dynmod"));const a=s?[s]:[];let n=L(L({command:y.START_MEDIA,_id:e._id,websocket_ip_address:g.A.Video_WebSocket_Ip_Address?g.A.Video_WebSocket_Ip_Address+"&mode=5":void 0,confId:g.A.localVideoPara.confId,confKey:"",logon:g.A.localVideoPara.logon,mtu_size:0,meetingid:g.A.localVideoPara.meetingid,meetingnumb:g.A.localVideoPara.meetingnumb,videoencodethreadnumb:1,videodecodethreadnumb:g.A.localVideoPara.videodecodethreadnumb,isFirefox:g.A.localVideoPara.isFirefox,isSupportMultiThread:g.A.localVideoPara.isSupportMultiThread,isSupportOffscreenCanvas:g.A.localVideoPara.isSupportOffscreenCanvas,isenablehw:g.A.localVideoPara.isenablehw,isEnableVideoDecodeHardWareThread:g.A.localVideoPara.isEnableVideoDecodeHardWareThread,isEnableHardWareThread:g.A.localVideoPara.isEnableHardWareThread,isTeslaMode:g.A.localVideoPara.isTeslaMode,enableMultiDecodeVideoWithoutSAB:!!g.A.enableMultiDecodeVideoWithoutSAB,logHost:g.A.localVideoPara.logHost,hasLog:g.A.localVideoPara.hasLog,enableTCP:g.A.localVideoPara.enableTCP,isLSSPlayer:g.A.localVideoPara.isLSSPlayer},g.A.Video_Web_Transport_Ip_Address?{webtransportURL:g.A.Video_Web_Transport_Ip_Address+"&mode=1"}:{}),{},{graphicalname:h.Ay.graphicName,vendorname:h.Ay.graphicvendorname,platformType:g.A.localVideoPara.platformType,rendererType:g.A.localVideoPara.rendererType,rendererDynModBlob:r,isWebCodecDecoderOnWhitelist:g.A.localVideoPara.isWebCodecDecoderOnWhitelist,decHAOption:g.A.enableHADecOpt?"no-preference":void 0,is360penablehwenc:g.A.enable360pHWEnc,is360penablehwdec:g.A.enable360pHWDec,webrtcvideo:g.A.localVideoPara.webrtcvideo,isEnableCanvasAlphaChannel:g.A.enableCanvasAlphaChannel,renderUserAgentInfo:_.l.info(),renderCapabilitiesDesc:S.f.desc(),renderConfigDesc:A.X.desc(),isVDIWebview:g.A.isVDIWebview,registryServicePort:s,wasmSsrcStreamServiceDynmodBlob:o,pslVideoId:g.A.pslVideoId,enableFetchWithCache:g.A.enableFetchWithCache,mediaSDKCDNPath:g.A.mediaSDKCDNPath});t.postMessage(n,a)}}(t)}async function ne(e,t){if(await Ee(t.isPlayStereoAudioSupported,t.audioCtx.sampleRate),g.A.localAudioEncMGR||(g.A.localAudioEncMGR=new l.nf({sessionid:t._id})),ie(v._c.AUDIO_ENCODE,g.A.localAudioEncMGR.sessionid,t._id),g.A.audioEncWorkerPath=e.workerJsFileUrl,g.A.audioEncodeResponse=await F(e.workerJsFileUrl,e.integrityHelper),!se(t))return!1;if(await async function(e,t,i){g.A.isAudioEncodeThreadStart||(g.A.isAudioEncodeThreadStart=!0,await H(i,g.A.localAudioEncMGR,Ce,v._c.AUDIO_ENCODE,t))}(0,t,e),!se(t,"Add_Audio_Encode_Thread"))return p.Ay.error("Add_Audio_Encode_Thread Worker Not Controled"),!1;let i=Zt(v._c.AUDIO_ENCODE);(0,C.Eg)(i,v._c.AUDIO_ENCODE),(0,b.CV)(i,v._c.AUDIO_ENCODE),Z.subscribeMessage(Z.nameMap.CREATE_AUDIO_ENCODE_HANDLE_SUCCESS),await async function(e){if(!g.A.localAudioEncMGR)return void p.Ay.error("jsMediaEngineVariables.localAudioEncMGR is null when call Audio_Encode_Post_message");var t=g.A.localAudioEncMGR.map.get(g.A.SPECIAL_ID);if(g.A.AEWF&&t.postMessage({command:"RIWM"}),await g.A.audioEncodeInitInstance.wasmSuccessPromise,!se(e))return!1;let i=g.A.localAudioPara.userId||0;if(oe(g.A.audioEncodeSession,i)&&(g.A.audioEncodeSession=null),t&&!g.A.audioEncodeSession){g.A.audioEncodeSession={type:v._c.AUDIO_ENCODE,userId:i};let r=null,s=L(L({command:y.START_MEDIA,_id:e._id,websocket_ip_address:g.A.Audio_WebSocket_Ip_Address?g.A.Audio_WebSocket_Ip_Address+"&mode=2":void 0,sampleRate:g.A.localAudioPara.sampleRate,userid:g.A.localAudioPara.userId,encode:1,meetingid:g.A.localAudioPara.meetingId,meetingnumb:g.A.localAudioPara.meetingNumber,iv:r,shouldNotChangeSampleRate:h.Ay.browser.isFirefox||h.Ay.browser.isSafari,isSafari:h.Ay.browser.isSafari,isPreviewMode:g.A.isPreviewMode.audioEncode,audioEncodeChannelsNum:h.Ay.isBrowserSupportStereo()?2:1,audioDecodeChannelsNum:e.isPlayStereoAudioSupported?2:1},g.A.Audio_Web_Transport_Ip_Address?{webtransportURL:g.A.Audio_Web_Transport_Ip_Address+"&mode=2"}:{}),{},{currentTime:g.A.timeOrigin+performance.now()});if(t.postMessage(s),g.A.sharedBuffer){W("post audioEnc sab");try{t.postMessage({command:"sharedBuffer",data:g.A.sharedBuffer})}catch(e){t.postMessage({command:"sharedBuffer",data:g.A.sharedBuffer},[g.A.sharedBuffer])}}}}(t)}async function de(e,t){var i;if(await Ee(t.isPlayStereoAudioSupported,null===(i=t.audioCtx)||void 0===i?void 0:i.sampleRate),g.A.localAudioDecMGR||(g.A.localAudioDecMGR=new l.nf({sessionid:t._id})),ie(v._c.AUDIO_DECODE,g.A.localAudioDecMGR.sessionid,t._id),g.A.audioDecWorkerPath=e.workerJsFileUrl,g.A.audioDecodeResponse=await F(e.workerJsFileUrl,e.integrityHelper),"string"==typeof g.A.audioDecodeResponse?m.A.add_monitor("DAFL"+g.A.audioDecodeResponse.length):m.A.add_monitor("DAFF"),!se(t))return!1;if(await Ue(0,0,t,e),!se(t,"Add_Audio_Decode_Thread"))return p.Ay.error("Add_Audio_Decode_Thread Worker Not Controled"),!1;let r=Zt(v._c.AUDIO_DECODE);(0,C.Eg)(r,v._c.AUDIO_DECODE),(0,b.CV)(r,v._c.AUDIO_DECODE),Z.subscribeMessage(Z.nameMap.CREATE_AUDIO_DECODE_HANDLE_SUCCESS),m.A.add_monitor("ADTS"),await async function(e){if(g.A.isPreviewMode.audioDecode)return void m.A.add_monitor("ZISA");if(!g.A.localAudioDecMGR)return void p.Ay.warn("jsMediaEngineVariables.localAudioDecMGR is null when call Audio_Decode_Post_message");var t=g.A.localAudioDecMGR.map.get(g.A.SPECIAL_ID);if(g.A.ADWF&&t.postMessage({command:"RIWM"}),await g.A.audioDecInitInstance.wasmSuccessPromise,!se(e))return!0;let i=g.A.localAudioPara.userId||0;if(oe(g.A.audioDecodeSession,i)&&(g.A.audioDecodeSession=null),t&&!g.A.audioDecodeSession){g.A.audioDecodeSession={type:v._c.AUDIO_DECODE,userId:i};let r=L({command:y.START_MEDIA,_id:e._id,websocket_ip_address:g.A.Audio_WebSocket_Ip_Address?g.A.Audio_WebSocket_Ip_Address+"&mode=5":void 0,sampleRate:g.A.localAudioPara.sampleRate,userid:g.A.localAudioPara.userId,decode:1,meetingid:g.A.localAudioPara.meetingId,meetingnumb:g.A.localAudioPara.meetingNumber,isSafari:h.Ay.browser.isSafari,isSupportMultiThread:g.A.localAudioPara.isSupportMultiThread,decoderInWorklet:g.A.decoderinworklet,audioDecodeChannelsNum:e.isPlayStereoAudioSupported?2:1,logHost:g.A.localAudioPara.logHost,hasLog:g.A.localAudioPara.hasLog,enableTCP:g.A.localAudioPara.enableTCP,isLSSPlayer:g.A.localAudioPara.isLSSPlayer,shouldNotChangeSampleRate:h.Ay.browser.isFirefox||h.Ay.browser.isSafari},g.A.Audio_Web_Transport_Ip_Address?{webtransportURL:g.A.Audio_Web_Transport_Ip_Address+"&mode=1"}:{});if(m.A.add_monitor("ADSM"),t.postMessage(r),g.A.sharedBuffer){W("post audioDec sab");try{t.postMessage({command:"sharedBuffer",data:g.A.sharedBuffer})}catch(e){t.postMessage({command:"sharedBuffer",data:g.A.sharedBuffer},[g.A.sharedBuffer])}}}else m.A.add_monitor("ADSME"+!!t+!!g.A.audioDecodeSession)}(t)}async function ce(e,t){if(g.A.localSharingDecMGR||(g.A.localSharingDecMGR=new l.n({sessionid:t._id})),g.A.localMouseDecMGR||(g.A.localMouseDecMGR=new l.n({sessionid:t._id})),ie(v._c.SHARING_DECODE,g.A.localSharingDecMGR.sessionid,t._id),g.A.sharingDecWorkerPath=e.workerJsFileUrl,g.A.sharingDecodeResponse=await F(e.workerJsFileUrl,e.integrityHelper),!se(t))return!1;if(await async function(e,t){g.A.isSharingDecodeThreadStart||(g.A.isSharingDecodeThreadStart=!0,await H(t,g.A.localSharingDecMGR,me,v._c.SHARING_DECODE,e))}(t,e),!se(t,"Add_Sharing_Decode_Thread"))return p.Ay.error("Add_Sharing_Decode_Thread Worker Not Controled"),!1;let i=Zt(v._c.SHARING_DECODE);(0,C.Eg)(i,v._c.SHARING_DECODE),(0,b.CV)(i,v._c.SHARING_DECODE),await pe(t)}async function le(e,t){if(g.A.localSharingEncMGR||(g.A.localSharingEncMGR=new l.n({sessionid:t._id})),ie(v._c.SHARING_ENCODE,g.A.localSharingEncMGR.sessionid,t._id),g.A.sharingEncWorkerPath=e.workerJsFileUrl,g.A.sharingEncodeResponse=await F(e.workerJsFileUrl,e.integrityHelper),!se(t))return!1;if(await async function(e,t){if(e&&e.isDestroy)return W("WorkerType:sharingEnc;The relative SDK instance is destroy, don't start relative worker, avoid multiple same workers. ");g.A.isSharingEncodeThreadStart||(g.A.isSharingEncodeThreadStart=!0,await H(t,g.A.localSharingEncMGR,ve,v._c.SHARING_ENCODE,e))}(t,e),!se(t,"Add_Sharing_Encode_Thread"))return p.Ay.error("Add_Sharing_Encode_Thread Worker Not Controled"),!1;let i=Zt(v._c.SHARING_ENCODE);(0,b.CV)(i,v._c.SHARING_ENCODE),(0,C.Eg)(i,v._c.SHARING_ENCODE),await fe(t)}const he=async e=>{let t="".concat(e,".min.js");t="".concat(A.X.getBaseScriptUrl(),"/").concat(t);const i=await(0,D.A)(t),r=await i.arrayBuffer();return new Blob([r],{type:"application/javascript"})},ue=async e=>{if(e===T.h3.WEBGPU)return he("webgpu_renderer_dynmod")};async function pe(e){if(await g.A.sharingDecInitInstance.wasmSuccessPromise,!se(e))return!1;var t=g.A.localSharingDecMGR.Get(g.A.SPECIAL_ID);let i=g.A.localSharingPara.userid||0;if(oe(g.A.sharingDecodeSession,i)&&(g.A.sharingDecodeSession=null),t&&!g.A.sharingDecodeSession){g.A.sharingDecodeSession={type:v._c.SHARING_DECODE,userId:i},await S.f.analyzedPromise();const r=await ue(g.A.localSharingPara.rendererType);let s,o;A.X.isUseSsrcStream()&&(s=I.e.exposeService().accquirePort(),o=await he("wasm_ssrc_stream_service_dynmod"));const a=s?[s]:[];t.postMessage({command:y.START_MEDIA,_id:e._id,websocket_ip_address:g.A.Sharing_WebSocket_Ip_Address,confId:g.A.localSharingPara.userid,confKey:"",logon:g.A.localSharingPara.logon,meetingid:g.A.localSharingPara.meetingid,meetingnumb:g.A.localSharingPara.meetingnumb,multiThreadNum:1,isSafari:h.Ay.browser.isSafari,graphicalname:h.Ay.graphicName,vendorname:h.Ay.graphicvendorname,rendererType:g.A.localSharingPara.rendererType,rendererDynModBlob:r,isWebCodecDecoderOnWhitelist:g.A.localSharingPara.isWebCodecDecoderOnWhitelist,isEnableCanvasAlphaChannel:g.A.enableCanvasAlphaChannel,renderUserAgentInfo:_.l.info(),renderCapabilitiesDesc:S.f.desc(),renderConfigDesc:A.X.desc(),registryServicePort:s,wasmSsrcStreamServiceDynmodBlob:o},a)}}async function fe(e){if(await g.A.sharingEncInitInstance.wasmSuccessPromise,!se(e))return!1;var t=g.A.localSharingEncMGR.Get(g.A.SPECIAL_ID);let i=g.A.localSharingPara.userid||0;if(oe(g.A.sharingEncodeSession,i)&&(g.A.sharingEncodeSession=null),t&&!g.A.sharingEncodeSession){let r=1;m.A.add_monitor2("STN"+r);let s=null;g.A.sharingEncodeSession={type:v._c.SHARING_ENCODE,userId:i},await S.f.analyzedPromise();const o=await ue(g.A.localSharingPara.rendererType);let a,n;A.X.isUseSsrcStream()&&(a=I.e.exposeService().accquirePort(),n=await he("wasm_ssrc_stream_service_dynmod"));const d=a?[a]:[];t.postMessage({command:y.START_MEDIA,_id:e._id,encode:!0,websocket_ip_address:g.A.Sharing_WebSocket_Ip_Address,confId:g.A.localSharingPara.userid,confKey:"",logon:g.A.localSharingPara.logon,isChromeOrEdge:h.Ay.browser.isChromeOrEdge,meetingid:g.A.localSharingPara.meetingid,meetingnumb:g.A.localSharingPara.meetingnumb,multiThreadNum:1,isSafari:h.Ay.browser.isSafari,iv:s,uplimit:g.A.uplimit,graphicalname:h.Ay.graphicName,vendorname:h.Ay.graphicvendorname,rendererType:g.A.localSharingPara.rendererType,rendererDynModBlob:o,isEnableCanvasAlphaChannel:g.A.enableCanvasAlphaChannel,renderUserAgentInfo:_.l.info(),renderCapabilitiesDesc:S.f.desc(),renderConfigDesc:A.X.desc(),currentTime:g.A.timeOrigin+performance.now(),registryServicePort:a,wasmSsrcStreamServiceDynmodBlob:n},d)}}function me(e){var t=e.data;try{if(t.status===c.Rm)t.updateRemoteInfo&&f.A.publish(n.vjv,{body:{width:t.logicWidth,height:t.logicHeight,logicWidth:t.logicWidth,logicHeight:t.logicHeight,absWidth:t.absWidth,absHeight:t.absHeight}}),g.A.Notify_APPUI(n.cYb,{body:{nodeid:t.nodeid,width:t.logicWidth,height:t.logicHeight,logicWidth:t.logicWidth,logicHeight:t.logicHeight,absWidth:t.absWidth,absHeight:t.absHeight}});else if(t.status===c.Vd)g.A.Notify_APPUI(n.jhI,t.ssrc);else if(t.status===c.SG)m.A.add_monitor2(t.data);else if(t.status===c.xD)m.A.add_monitor("FSF"),g.A.Notify_APPUI(n.vd4,{ssrc:t.ssrc}),g.A.shareFirstFrameMap.set(t.ssrc,!0);else if(t.status===c.Wr)!function(e,t,i,r,s,o,a,n,d,c,l,h,u){if(g.A.isSharingPlayWork){var p={yuvdata:t,ntptime:i,ssrc:e,width:r,height:s,r_x:o,r_y:a,r_w:n,r_h:d,logic_w:c,logic_h:l,yuv_limited:h,isFromMainSession:u};g.A.mediaSDKHandle.SharingRenderObj.Put_Sharing_Data_From_Queue(p,15)}}(t.sharing_ssrc,t.data,t.sharing_timestamp,t.sharing_width,t.sharing_height,t.rendering_x,t.rendering_y,t.rendering_w,t.rendering_h,t.logic_w,t.logic_h,t.yuv_limited,t.isFromMainSession);else if(t.status===c.Bm)!function(e,t,i,r,s,o,a,n,d,c){if(g.A.isSharingPlayWork){var l={buffer:t,ntptime:i,ssrc:e,width:r,height:s,r_x:o,r_y:a,mLogic_w:n,mLogic_h:d,sync_id:c};g.A.mediaSDKHandle.SharingRenderObj.Put_Mouse_Data_Into_Queue(l)}}(t.mouse_ssrc,t.data,t.mouse_timestamp,t.mouse_width,t.mouse_height,t.mouse_x,t.mouse_y,t.mLogic_w,t.mLogic_h,t.sync_id);else if(t.status===c.av){var i;const{ssrc:e,size:r,videomode:s}=t;(null===(i=g.A.mediaSDKHandle)||void 0===i?void 0:i.shareSubController).decodeCapability(e,r,s)}else if(t.status===n.oUP){const e=L({encoding:!1},t.data);g.A.Notify_APPUI_SAFE(n.oUP,e)}else if(t.status===c.I)m.A.add_monitor("SDWS"),g.A.isSharingDecodeWASMOK=!0,g.A.sharingDecInitInstance.setWasmSuccess();else if(t.status===c.bC)m.A.add_monitor("SDWF",t.data),K("SDWF"),g.A.sharingDecInitInstance.setWasmSuccess(!1);else if(t.status===c.Ji||t.status===c.x8)m.A.add_monitor("SDHS"),g.A.sharingDecInitInstance.setHanderSuccess();else if(t.status===c.pJ)m.A.add_monitor("SHHF"),g.A.sharingDecInitInstance.setHanderSuccess(!1);else if(t.status===c.zS)m.A.add_monitor("SDSS"),g.A.sharingDecInitInstance.setSocketSuccess();else if(t.status===c.KE)m.A.add_monitor("SDSF"),g.A.sharingDecInitInstance.isSocketInitSuccess()&&(0,E.iK)(n.oDm,null),g.A.sharingDecInitInstance.setSocketSuccess(!1);else{if(t.status==c.vr)return void m.A.send_monitor_directly(t.data);if(t.status===c.wQ){let e=g.A.localSharingDecMGR.map.get(g.A.SPECIAL_ID);Se(t.url,e,v._c.SHARING_DECODE)}else if(t.status==c.ef)g.A.monitorSharingDecodeAPPInfo=t,m.A.send_monitor_directly(g.A.monitorSharingDecodeAPPInfo.data),g.A.monitorSharingDecodeAPPInfo=null;else if(t.status==c.Bi)m.A.add_monitor("SD"+t.data);else if(t.status==c.aY)m.A.add_monitor("MWGLF"),g.A.Notify_APPUI(n.BgG,{canvasId:t.canvasId,replaceCanvas:!!t.replaceCanvas});else if(t.status==c.Tf)m.A.add_monitor("MWGRF");else if("WFMO"==t.status)(0,h._w)(v._c.SHARING_DECODE);else if(t.status==c.jA)g.A.SDMTimes++<2&&(K(v._c.SHARING_DECODE+" Memory Allocate Failed"),m.A.add_monitor("SDMAF"),(0,E.iK)(n.a1o));else if(t.status==c.t4){const{status:e,cmd:i}=t,r=(0,s.A)(t,k);g.A.lastStatsLogs.sharingRecvStats=r}else t.status==c.uL?g.A.mediaSDKHandle.onAnnotationPdu(t.data):t.status==c.V_?(0,E.iK)(n.AoB,t.where):t.status===c.XY?g.A.Notify_APPUI_SAFE(n.XYU,{isUplink:t.isUplink,networkLevel:t.networkLevel,bwLevel:t.bwLevel,mediaType:3}):G(v._c.SHARING_DECODE,e)}}catch(e){p.Ay.error("Error in SharingDec_Listener",e)}}function ve(e){var t=e.data;try{if(t.status===c.I)m.A.add_monitor("SEWS"),g.A.isSharingEncodeWASMOK=!0,g.A.sharingEncInitInstance.setWasmSuccess();else if(t.status===c.bC)m.A.add_monitor("SEWF",t.data),K("SEWF"),g.A.sharingEncInitInstance.setWasmSuccess(!1);else if(t.status===c.Ji||t.status===c.x8)m.A.add_monitor("SEHS"),g.A.sharingEncInitInstance.setHanderSuccess();else if(t.status===c.pJ)m.A.add_monitor("SEHF"),g.A.sharingEncInitInstance.setHanderSuccess(!1);else if(t.status===c.zS)m.A.add_monitor("SESS"),g.A.sharingEncInitInstance.setSocketSuccess();else if(t.status===c.KE)m.A.add_monitor("SESF",t.data),g.A.sharingEncInitInstance.isSocketInitSuccess()&&(0,E.iK)(n.oDm,null),g.A.sharingEncInitInstance.setSocketSuccess(!1);else if(t.status==c.f9)m.A.add_monitor2("SCFOK");else if(t.status==c.Xk)m.A.add_monitor("SCFF"+t.format);else if(t.status==c.bq)g.A.mediaSDKHandle.Process_Sharing();else if(t.status==c.hA)g.A.mediaSDKHandle.Process_Sharing();else if(t.status==c.RN){const{status:e,cmd:i}=t,r=(0,s.A)(t,O);g.A.lastStatsLogs.sharingSendStats=r}else if(t.status===c.HL){var i;null===(i=g.A.mediaSDKHandle)||void 0===i||i.onSharingSizeChange(t),g.A.Notify_APPUI(n.HL3,{width:t.width,height:t.height})}else{if(t.status==c.vr)return void m.A.send_monitor_directly(t.data);if(t.status==c.wQ){let e=g.A.localSharingEncMGR.map.get(g.A.SPECIAL_ID);Se(t.url,e)}else if(t.status===n.oUP){const e=L({encoding:!0},t.data);g.A.Notify_APPUI_SAFE(n.oUP,e)}else t.status==c.ef?m.A.send_monitor_directly(t.data):t.status==c.Bi?m.A.add_monitor("SE"+t.data):t.status==c.aY?g.A.Notify_APPUI(n.BgG,{canvasId:t.canvasId,replaceCanvas:!!t.replaceCanvas}):t.status==c.D1?g.A.Notify_APPUI(n.ekh,{data:t.data}):"WFMO"==t.status?(0,h._w)(v._c.SHARING_ENCODE):t.status==c.hd?((0,E.iK)(n.bes,c.hd),p.Ay.error("Health Check Failed: ".concat(c.hd,", ").concat(t.videoType,",").concat(t.subforme,",").concat(t.hasRTPPackets))):t.status==c.jA?g.A.SEMTimes++<2&&(K(v._c.SHARING_ENCODE+" Memory Allocate Failed"),m.A.add_monitor("SEMAF"),(0,E.iK)(n.a1o)):t.status==c.uL?g.A.mediaSDKHandle.onAnnotationPdu(t.data):t.status==c.V_?(0,E.iK)(n.AoB,t.where):t.status===c.XY?g.A.Notify_APPUI_SAFE(n.XYU,{isUplink:t.isUplink,networkLevel:t.networkLevel,bwLevel:t.bwLevel,mediaType:3}):G(v._c.SHARING_ENCODE,e)}}catch(e){p.Ay.error("Error in SharingEnc_Listener",e)}}function ge(e){var t,i=e.data,r=!0;try{if("NewActiveSpeakerFirstframeCallback"===i.status)g.A.Notify_APPUI(n.N6$,{ssrc:i.ssrc});else if(i.status===c.Rk)g.A.Notify_APPUI(n.XDu,{width:i.width,height:i.height});else if(i.status===c.LG){let e=g.A.mediaSDKHandle.videoDecodeFrameBackSABRingBufferConsumer;e&&e.consumeAll(g.A.mediaSDKHandle.bVideoDecodeFrameBackSABRingBufferConsumeCopyData)}else if(i.status===c.Zc)m.A.add_monitor2(i.data);else if(i.status==c.aY)m.A.add_monitor("MWGLF"),g.A.Notify_APPUI(n.BgG,{canvasId:i.canvasId,replaceCanvas:!!i.replaceCanvas});else if(i.status==c.Tf)m.A.add_monitor("MWGRF");else if(i.status==c.V_)m.A.add_monitor("MWCGLF"),(0,E.iK)(n.AoB,i.where);else if(0===i.status)xe(i.video_ssrc,i.data,i.video_timestamp,i.video_width,i.video_height,i.rendering_x,i.rendering_y,i.rendering_w,i.rendering_h,i.rotation,i.yuv_limited);else if(i.status===c.lN)m.A.add_monitor("VDWS"),g.A.isVideoDecodeWASMOK=!0,g.A.videoDecInitInstance.setWasmSuccess(),g.A.isPreviewMode.videoDecode&&g.A.Notify_APPUI_SAFE(n.rje);else if(i.status===c.Fb){let e=i.size;i.ssrc&&g.A.Notify_APPUI(n.Ya9,{ssrc:i.ssrc,size:e}),M.A.setMaxSubscribeSize(e),m.A.add_monitor("VDMS:"+e)}else if(i.status===c.Gg)m.A.add_monitor("VDWF",i.data),K("VDWF"),g.A.videoDecInitInstance.setWasmSuccess(!1);else if(i.status===c.iU)m.A.add_monitor("VDHS"),g.A.videoDecInitInstance.setHanderSuccess();else if(i.status===c.oU)m.A.add_monitor("VDHF"),g.A.videoDecInitInstance.setHanderSuccess(!1);else if(i.status===c.s6)g.A.videoDecInitInstance.setSocketSuccess(),m.A.add_monitor("VDSS");else if(i.status===c.HX)m.A.add_monitor("VDSF"),g.A.videoDecInitInstance.isSocketInitSuccess()&&(0,E.iK)(n.oDm,null),g.A.videoDecInitInstance.setSocketSuccess(!1);else if(i.status===c.Ub)m.A.add_monitor("VDWPS");else if(i.status===c.Y)m.A.add_monitor("VDWPCLOSE"),re(v.wd.ZOOM_CONNECTION_VIDEO,v.oB.NET_WEBTRANSPORT);else if(i.status===c.UG)m.A.add_monitor("VDWSCLOSE");else if(i.status===c.xQ)m.A.add_monitor("VDTTP:"+i.type);else if(i.status==c.vr)m.A.send_monitor_directly(i.data),r=!1;else if(i.status==c.ef)r=!1,g.A.sendMessageToRwg(n.yGo,{evt:n.UFw,seq:1,body:{data:i.data}});else if(i.status==c.wQ){let e=g.A.localVideoDecMGR.map.get(g.A.SPECIAL_ID);Se(i.url,e,v._c.VIDEO_DECODE),r=!1}else if(i.status==c.Bi)r=!1,m.A.add_monitor("VD"+i.data);else if(i.status===c.T)g.A.Notify_APPUI_SAFE(n.TaW,i.data);else if(i.status===c.$x)g.A.Notify_APPUI_SAFE(n.$xb,i.data);else if(i.status===n.PgM){const e=L({encoding:!1},i.data);g.A.Notify_APPUI_SAFE(n.PgM,e)}else if("FIRST_VIDEO_FRAME"===i.status)g.A.Notify_APPUI_SAFE(n.Vtx),m.A.add_monitor("FVF");else if(i.status===c.Ah)g.A.Notify_APPUI_SAFE(n.Ah8,{isUplink:i.isUplink,networkLevel:i.networkLevel,bwLevel:i.bwLevel,mediaType:2});else if(i.status===c.yC)g.A.Notify_APPUI_SAFE(n.Tbw,i.data);else if(i.status===c._0){const e=i.data;let t=e[7]<<24|e[6]<<16|e[5]<<8|e[4];t>>>=0,t=t>>10<<10,g.A.Notify_APPUI_SAFE(n.A7G,{ssrc:t,data:i.data})}else if("FIRST_FRAME"===i.status)g.A.Notify_APPUI_SAFE(n.vIC,{ssrc:i.ssrc,params:i.params});else if("WFMO"==i.status)r=!1,(0,h._w)(v._c.VIDEO_DECODE);else if(i.status==c.x8)r=!0;else if(i.status==c.jA)r=!1,g.A.hasWasmMemoryError=!0,g.A.VDMTimes++<2&&(K(v._c.VIDEO_DECODE+" Memory Allocate Failed"),m.A.add_monitor("VDMAF"),(0,E.iK)(n.a1o));else if(i.status==c.Ht)g.A.VDMEMERRTimes++<2&&(m.A.add_monitor("VDMEMERR"),(0,E.iK)(n.oQY,g.A.hasUsedWebrtc?null:{video:2}));else if(i.status==c.YX){const{status:e,cmd:t}=i,r=(0,s.A)(i,V);r.nodeId=(0,h.XF)(r.nodeId),g.A.lastStatsLogs.videoRecvStats.set(r.nodeId,r)}else i.status==c.H4?Qt(i.data):i.status==c.Eu?g.A.pslMixShareManager.handlePSLMixShareInfo(i.data):i.status==c.Xb?g.A.pslMixShareManager.handlePSLVideoSizeChange(i.data):(i.status==c.AC&&(r=!1),G(v._c.VIDEO_DECODE,e))}catch(e){p.Ay.error("Error in VideoDec_Listener",e)}r&&null!==(t=g.A.mediaSDKHandle)&&void 0!==t&&t.isSupportVideoShare&&me(e)}function _e(e){var t,i=e.data,r=!0;if(i!==c.$E){try{if("VBPredictDone"===i.status)m.A.add_monitor("VBPOK"+i.predictCostTime),g.A.isPreviewMode.videoEncode&&Z.enqueueMessage({name:Z.nameMap.INIT_VIDEO_ENCODE_SUCCESS,messageParams:[n.UsF,null],direction:Z.direction.SDK_TO_APP}),g.A.Notify_APPUI(n.UsF,null);else if("VBPredictAbout3s"===i.status)m.A.add_monitor("VBP3S"),g.A.Notify_APPUI(n.eJx,null);else if("VBPredictAbout10s"===i.status)m.A.add_monitor("VBP10S"),g.A.Notify_APPUI(n.IkA,null);else if("vbInitializeFailed"===i.status)p.Ay.error("VB tensorflow backend initialize failed"),m.A.add_monitor("VBBEF"),g.A.Notify_APPUI(n.KqK,U.FAIL);else if(0===i.status);else if(i.status===c.dh||i.status===c.lN)m.A.add_monitor("VEWS"),g.A.isVideoEncodeWASMOK=!0,g.A.videoInitInstance.setWasmSuccess();else if(i.status===c.Ke)m.A.add_monitor("VEWF",i.data),K("VEWF"),g.A.videoInitInstance.setWasmSuccess(!1);else if(i.status===c.l6||c.iU===i.status)m.A.add_monitor("VEHS"),g.A.videoInitInstance.setHanderSuccess();else if(i.status===c.uP||c.oU===i.status)m.A.add_monitor("VEHF"),g.A.videoInitInstance.setHanderSuccess(!1);else if(c.s6===i.status)m.A.add_monitor("VESS"),g.A.videoInitInstance.setSocketSuccess();else if(i.status===c.HX)m.A.add_monitor("VESF"),g.A.videoInitInstance.isSocketInitSuccess()&&(0,E.iK)(n.oDm,null),g.A.videoInitInstance.setSocketSuccess(!1);else if(i.status===c.Ub)m.A.add_monitor("VEWPS");else if(i.status===c.Y)m.A.add_monitor("VEWPCLOSE");else if(i.status===c.UG)m.A.add_monitor("VEWSCLOSE");else if(i.status===c.xQ)m.A.add_monitor("VETTP:"+i.type);else if(i.status===c.Cm)m.A.add_monitor("VEHORS:"+i.type);else if(i.status===c.bq)g.A.mediaSDKHandle.Process_Video();else if(i.status===c.Sh)g.A.Notify_APPUI(n.Shw,{width:i.width,height:i.height});else if(i.status===c.vP)m.A.add_monitor("VCRC"+i.width),g.A.mediaSDKHandle.Change_Video_Capture_Resolution(i.width,i.height);else if(i.status==c.sY)m.A.add_monitor2("VCFOK");else if(i.status==c.YS)m.A.add_monitor("VCFF","format: ".concat(i.format));else{if(i.status==c.vr)return r=!1,void m.A.send_monitor_directly(i.data);if(i.status==c.ef)r=!1,m.A.send_monitor_directly(i.data);else if(i.status===c.wQ){let e=g.A.localVideoEncMGR.map.get(g.A.SPECIAL_ID);Se(i.url,e,v._c.VIDEO_ENCODE),r=!1}else if(i.status==c.Bi)r=!1,m.A.add_monitor("VE"+i.data);else if(i.status==c.ty){let e=g.A.SPECIAL_ID;if(g.A.localVideoDecMGR){var o=g.A.localVideoDecMGR.map.get(e);o&&o.postMessage({command:"encodedimagebitmapwasmptr",data:i.data,wasmMemory:i.wasmMemory})}else g.A.isPreviewMode.videoEncode&&Z.enqueueMessage({name:Z.nameMap.INIT_VIDEO_DECODE_SUCCESS,messageParams:[v._c.VIDEO_DECODE,{command:"encodedimagebitmapwasmptr",data:i.data,wasmMemory:i.wasmMemory}],direction:Z.direction.SDK_TO_WORKER})}else if(i.status===n.PgM){const e=L({encoding:!0},i.data);g.A.Notify_APPUI_SAFE(n.PgM,e)}else if(i.status===n.oUP){const e=L({encoding:!0},i.data);g.A.Notify_APPUI_SAFE(n.oUP,e)}else if(i.status==c.aY)m.A.add_monitor("MWGLF"),g.A.Notify_APPUI(n.BgG,{canvasId:i.canvasId,replaceCanvas:!!i.replaceCanvas});else if(i.status==c.Tf)m.A.add_monitor("MWGRF");else if(i.status===c.Xg)g.A.mediaSDKHandle.init_Notify_APPUI(!0,v._c.VIDEO_ENCODE);else if(i.status===c.Ah)g.A.Notify_APPUI_SAFE(n.Ah8,{isUplink:i.isUplink,networkLevel:i.networkLevel,bwLevel:i.bwLevel,mediaType:2});else if("WFMO"==i.status)r=!1,(0,h._w)(v._c.VIDEO_ENCODE);else if(i.status==c.AP)i.vberror?(0,E.iK)(n.Azg):(0,E.iK)(n.bes,c.AP),p.Ay.error("Health Check Failed: ".concat(c.AP,", ").concat(i.videoType,",").concat(i.subforme,",").concat(i.hasRTPPackets,",").concat(i.vberror));else if(i.status===n.msu){const{frame:e}=i,{frameSent:t,frameReceived:r}=g.A;g.A.extVBPort&&t===r?(g.A.extVBPort.postMessage({type:n.Abc,frame:e}),g.A.frameSent++):m.A.add_monitor("EVBOF-".concat(t-r)),e.close()}else if(i.status==c.x8)r=!0;else if(i.status==c.jA)r=!1,g.A.hasWasmMemoryError=!0,g.A.VEMTimes++<2&&(K(v._c.VIDEO_ENCODE+" Memory Allocate Failed"),m.A.add_monitor("VEMAF"),(0,E.iK)(n.a1o));else if(i.status==c.Ht)g.A.VEMEMERRTimes++<2&&(m.A.add_monitor("VEMEMERR"),(0,E.iK)(n.oQY,g.A.hasUsedWebrtc?null:{video:2}));else if(i.status==c.H4)Qt(i.data);else if(i.status==c.V_)(0,E.iK)(n.AoB,i.where);else if(i.status==c.eS);else if(i.status==c.oG){const{status:e,cmd:t}=i,r=(0,s.A)(i,N);g.A.lastStatsLogs.videoSendStats=r}else i.status==c.AC&&(r=!1),G(v._c.VIDEO_ENCODE,e)}}catch(e){p.Ay.error("Error in VideoEnc_Listener",e)}r&&null!==(t=g.A.mediaSDKHandle)&&void 0!==t&&t.isSupportVideoShare&&ve(e)}}function Se(e,t,i){h.Ay.downloadAndCompileWebAssembly(e,i,m.A,!h.Ay.browser.isSafari&&g.A.enableStreamingInstantiate).then((e=>{t.postMessage({command:"DOWNLOAD_WASM_FROM_MAIN_THREAD_OK",data:e})})).catch((e=>{t.postMessage({command:"DOWNLOAD_WASM_FROM_MAIN_THREAD_FAILED"})}))}const Ae=function(){let e={send:null,recv:null,decrpt:null},t=null,i=/(WCL_MCM_AUDIO.*?)(\{\[SPEECHINPUT_R16\]\}),(.*?),(.*?),(.*?),(.*?),(\{\[SEND\]\}.*?)(\{\[DENOISE\]\}.*?)\{\[CAPTURE\]\},(.*?),(\{\[AEC\]\},.*?),(\{\[END\]\})/,r=/(WCL_MCM_AUDIO.*?)(\{\[SPEECHOUTPUT_R16\]\},)(.*?),(\{\[NETWORK\]\}.*?)(\{\[RECEIVE\]\}.*?)\{\[RENDER\]\},(.*?),(.*?)(\{\[END\]\})/,s=/WCL_MCM_AUDIO_RECEIVE,(.*?)$/;return{push(i){let{log:r,logSource:s}=i;if(r&&this._isLogValid(r)){if(this._checkNeedReportImmediate(r,s))return s===d.Qm?this._sendWebRTCLog(r):this._report(r);if(s===d.js)e.send=r;else if(s===d.RP){if(r.includes("WCL_MCM_AUDIO_RECEIVE"))return void(e.decrpt=r);e.recv=r}else e.recv=r;this._clearTImer(),t=setTimeout(this._checkNeedReport.bind(this),2e3)}},_isLogValid:e=>!!(e.match("WCL_MCM_AUDIO")||e.match("JITTER")||e.match("DEVICE")||e.match("ORIGINAL_SOUND")||e.match("AUDIO_CODEC_EVENT")||e.match("AUDIOEVENT")||e.match("AUDIO_DEVICE_VOLUME")),_checkNeedReportImmediate:(e,t)=>t===d.Qm||!(e.match("SPEECHOUTPUT_R16")||e.match("SPEECHINPUT_R16")||e.match("WCL_MCM_AUDIO_RECEIVE")),_checkNeedReport(){const e=this._generateLog();e&&this._report(e)},_sendWebRTCLog(e){const{denoise:t,captureCounter:i}=this._parseSend(e);this._report("WCL_AB,"+t+"{[CAPTURTE]},"+i+",{[END]}")},_generateLog(){if(!e.send&&!e.recv)return null;const{inputputPrefix:t,speechInStr:i,speechInOutStr:r,denoiseInStr:s,denoiseOutStr:o,send:a,denoise:n,captureCounter:d,aec:c}=this._parseSend(e.send),{outputPrefix:l,speechOutStr:h,network:u,renderCounter:p,others:f}=this._parseRecv(e.recv),m=this._parseDecrpt(e.decrpt);this.recordEchoLog(c);const v=t||l,g="{[SPEECH_R16]},".concat(i,",").concat(r,",").concat(h,",").concat(s,",").concat(o,",").concat(c,",").concat(u,"{[RECEIVE2]},").concat(m,",").concat(f,"{[PROCESS]},").concat(d,",").concat(p,",").concat(a).concat(n,"{[END]}");return"".concat(v).concat(g)},recordEchoLog(e){let t=e.match(/-?\d+/g);t&&(parseInt(t[0])||parseInt(t[1]))&&p.Ay.directReport("echo captured: "+t[0]+": "+t[1])},_parseSend(e){const t=i.exec(e||"")||[];return{inputputPrefix:t[1]||"",speechInStr:t[3]||"",speechInOutStr:t[4]||"",denoiseInStr:t[5]||"",denoiseOutStr:t[6]||"",send:t[7]||"",denoise:t[8]||"",captureCounter:t[9]||"",aec:t[10]||""}},_parseRecv(e){const t=r.exec(e||"")||[];return{outputPrefix:t[1]||"",speechOutStr:t[3]||"",network:t[4]||"",receive:t[5]||"",renderCounter:t[6]||"",others:t[7]||""}},_parseDecrpt:e=>(s.exec(e||"")||[])[1]||"",_report(e){e&&g.A.sendMessageToRwg(n.yGo,{evt:n.UFw,seq:1,body:{data:e}})},_clearTImer(){clearTimeout(t),t=null},clear(){e={send:null,recv:null},this._clearTImer()}}}();function ye(e){var t=e.data;try{if(0===t.status)t.time?g.A.AudioNode&&g.A.AudioNode.postData("data",{ssrc:g.A.CurrentSSRC,data:t.data,time:t.time}):g.A.AudioNode&&g.A.AudioNode.postData("data",{ssrc:g.A.CurrentSSRC,data:t.data,time:null});else if(t.status===c.c||t.status===c.ex)m.A.add_monitor("ADWS"),g.A.isAudioDecodeWASMOK=!0,g.A.audioDecInitInstance.setWasmSuccess(),g.A.isPreviewMode.audioDecode&&g.A.Notify_APPUI_SAFE(n.CXV);else if(t.status===c.v7)m.A.add_monitor("ADWF",t.data),K("ADWF"),g.A.audioDecInitInstance.setWasmSuccess(!1);else if(t.status===c.my)m.A.add_monitor("ADHS"),g.A.audioDecInitInstance.setHanderSuccess();else if(t.status===c.Jj)m.A.add_monitor("ADHF"),g.A.audioDecInitInstance.setHanderSuccess(!1);else if(t.status===c.Jw)m.A.add_monitor("ADSS"),g.A.audioDecInitInstance.setSocketSuccess();else if(t.status===c.s8)m.A.add_monitor("ADSF"),g.A.audioDecInitInstance.isSocketInitSuccess()&&(0,E.iK)(n.bo2,null),g.A.audioDecInitInstance.setSocketSuccess(!1);else if(t.status===c.Ub)m.A.add_monitor("ADWPS");else if(t.status===c.Y)m.A.add_monitor("ADWPCLOSE"),re(v.wd.ZOOM_CONNECTION_AUDIO,v.oB.NET_WEBTRANSPORT);else if(t.status===c.UG)m.A.add_monitor("ADWSCLOSE");else if(t.status===c.xQ)m.A.add_monitor("ADTTP:"+t.type);else if(t.status==c.vr)m.A.send_monitor_directly(t.data);else if(t.status===c.wQ){let e=g.A.localAudioDecMGR.map.get(g.A.SPECIAL_ID);Se(t.url,e,v._c.AUDIO_DECODE)}else if(t.status==c.Bi)m.A.add_monitor("AD"+t.data);else if(t.status==c.uf)t.at&&g.A.CurrentSSRCTime!==t.at&&(g.A.CurrentSSRCTime=t.at,g.A.audioPlayTime=Date.now()),t.st&&g.A.mediaSDKHandle.SharingRenderObj&&g.A.mediaSDKHandle.SharingRenderObj.SetcATimeStamp(t.st);else if("multiCurrentTime"==t.status){if(g.A.localVideoDecMGR){var i=g.A.localVideoDecMGR.map.get(g.A.SPECIAL_ID);i&&i.postMessage({command:"audioDecodeTime",data:t.data,status:1})}}else if(t.status==c.Xd);else if(t.status===c.b5)Ae.push({log:t.data,logSource:d.RP});else if(t.status===n.iQY){const e=L({encoding:!1},t.data);g.A.Notify_APPUI_SAFE(n.iQY,e)}else if(t.status===c.yC)g.A.Notify_APPUI_SAFE(n.Tbw,t.data);else if(t.status===c.Jo)g.A.Notify_APPUI_SAFE(n.Joy,{isUplink:t.isUplink,networkLevel:t.networkLevel,bwLevel:t.bwLevel,mediaType:1});else if(t.status==c.jA)g.A.hasAudioMemoryError=!0,K(v._c.AUDIO_DECODE+" Memory Allocate Failed"),(0,E.iK)(n.a1o);else if(t.status===c.Ht)p.Ay.error("audio decode worker memory invalid"),g.A.hasAudioMemoryError?(0,E.iK)(n.a1o):(g.A.hasAudioMemoryError=!0,(0,E.iK)(n.oQY));else if(t.status===c.N){if(null!=t&&t.data){g.A.lastStatsLogs.audioRecvStats=g.A.lastStatsLogs.audioRecvStats||new Map;for(let[e,i]of g.A.lastStatsLogs.audioRecvStats){var r,s,o;i.timestamp=null===(r=t.data)||void 0===r?void 0:r.timestamp,i.jitter=null===(s=t.data)||void 0===s?void 0:s.jitter,i.roundTripTime=null===(o=t.data)||void 0===o?void 0:o.roundTripTime}}}else if(t.status===c.NN){if(null!=t&&t.data){var a;g.A.lastStatsLogs.audioRecvStats=g.A.lastStatsLogs.audioRecvStats||new Map;const e=null===(a=t.data)||void 0===a?void 0:a.ssrc;if(e){var l,h,u,f;let i=g.A.lastStatsLogs.audioRecvStats.get(e)||{};i.timestamp=null===(l=t.data)||void 0===l?void 0:l.timestamp,i.ssrc=null===(h=t.data)||void 0===h?void 0:h.ssrc,i.packetsLost=null===(u=t.data)||void 0===u?void 0:u.packetsLost,i.packetsReceived=null===(f=t.data)||void 0===f?void 0:f.packetsReceived,i.updateTime=performance.now(),g.A.lastStatsLogs.audioRecvStats.set(e,i)}}}else G(v._c.AUDIO_DECODE,e)}catch(e){p.Ay.error("Error in AudioDecodeListener",e)}}function Ce(e){if(g.A.localAudioDecMGR||g.A.isPreviewMode.audioEncode)try{let r=e.data;if(r.status===c.sv);else if(0==r.status){var t=g.A.SPECIAL_ID,i=g.A.localAudioDecMGR.map.get(t);i&&i.postMessage({command:"EncodedAudioFrame",data:r.data},[r.data.buffer])}else if(r.status==c.Xd);else if(r.status===c.c||r.status===c.ex)m.A.add_monitor("AEWS"),g.A.isAudioEncodeWASMOK=!0,g.A.audioEncodeInitInstance.setWasmSuccess();else if(r.status===c.Pp||r.status===c.v7)m.A.add_monitor("AEWF",r.data),K("AEWF"),g.A.audioEncodeInitInstance.setWasmSuccess(!1);else if(r.status===c.my)m.A.add_monitor("AEHS"),g.A.audioEncodeInitInstance.setHanderSuccess();else if(r.status===c.Jw)m.A.add_monitor("AESS"),g.A.audioEncodeInitInstance.setSocketSuccess();else if(r.status===c.s8)m.A.add_monitor("AESF"),g.A.audioEncodeInitInstance.isSocketInitSuccess()&&(0,E.iK)(n.bo2,null),g.A.audioEncodeInitInstance.setSocketSuccess(!1);else if(r.status===c.Jj)m.A.add_monitor("AEHF"),g.A.audioEncodeInitInstance.setHanderSuccess(!1);else if(r.status===c.TK)g.A.Notify_APPUI_SAFE(c.TK,null);else if(r.status===c.Ub)m.A.add_monitor("AEWPS");else if(r.status===c.Y)m.A.add_monitor("AEWPCLOSE");else if(r.status===c.UG)m.A.add_monitor("AEWSCLOSE");else if(r.status===c.xQ)m.A.add_monitor("AETTP:"+r.type);else if(r.status===c.Rw)g.A.indexDbObject.put(r.delay,"delay"),g.A.openIndexFlag&&g.A.indexDbObject.select("delay");else if(r.status===c.wQ){let e=g.A.localAudioEncMGR.map.get(g.A.SPECIAL_ID);Se(r.url,e,v._c.AUDIO_ENCODE)}else if(r.status==c.Bi)m.A.add_monitor("AE"+r.data);else if(r.status==c.M9);else if(r.status===c.b5)Ae.push({log:r.data,logSource:d.js});else if(r.status===n.iQY){const e=L({encoding:!0},r.data);g.A.Notify_APPUI_SAFE(n.iQY,e)}else r.status===c.YQ?g.A.mediaSDKHandle.init_Notify_APPUI(!0,v._c.AUDIO_ENCODE):r.status===n.AV$?g.A.Notify_APPUI_SAFE(n.AV$):r.status===n._9I?g.A.Notify_APPUI_SAFE(n._9I,{value:r.value}):r.status===c.Jo?g.A.Notify_APPUI_SAFE(n.Joy,{isUplink:r.isUplink,networkLevel:r.networkLevel,bwLevel:r.bwLevel,mediaType:1}):r.status==c.NO?((0,E.iK)(n.bes,c.NO),p.Ay.error("Health Check Failed: ".concat(c.NO,", ").concat(r.videoType,",").concat(r.subforme,",").concat(r.hasRTPPackets))):r.status==c.jA?(g.A.hasAudioMemoryError=!0,K(v._c.AUDIO_ENCODE+" Memory Allocate Failed"),(0,E.iK)(n.a1o)):r.status===c.Ht?(p.Ay.error("audio encode worker memory invalid"),g.A.hasAudioMemoryError?(0,E.iK)(n.a1o):(g.A.hasAudioMemoryError=!0,(0,E.iK)(n.oQY))):r.status===c.Fe?g.A.lastStatsLogs.audioSendStats=r.data:G(v._c.AUDIO_ENCODE,e)}catch(e){p.Ay.error("Error in AudioEnc_Listener",e)}}async function Ee(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:48e3;const i=h.Ay.browser.isSafari&&h.Ay.getMacSafariMajorVersion()<16;if(!g.A.sharedBuffer&&h.Ay.isSupportSharedArrayBuffer()&&!i){W("LP2PSP");let i=1;(h.Ay.browser.isFirefox||48e3===h.Ay.getAudioContextConfigure().sampleRate)&&(i=48);let r=640;r=h.Ay.isChromeVersionHigherThan(74)?960:t/100*2;let s=h.Ay.isBrowserSupportStereo()?2:1,o=e?2:1,a=h.Ay.isSupportSharingStereo()?2:1;g.A.sharedBuffer={inputState:new SharedArrayBuffer(24),inputBuffer:new SharedArrayBuffer(i*r*4*4*s),sharingInputState:new SharedArrayBuffer(24),sharingInputBuffer:new SharedArrayBuffer(i*r*4*4*a),outputState:new SharedArrayBuffer(24),outputBuffer:new SharedArrayBuffer(i*r*4*4*2),rtpBuffer:new SharedArrayBuffer(120008),echoState:g.A.enableEchoDetection?new SharedArrayBuffer(24):void 0,echoBuffer:g.A.enableEchoDetection?new SharedArrayBuffer(i*r*4*4*o):void 0}}m.A.add_monitor("INITSAB"+!!g.A.sharedBuffer),g.A.decoderinworklet=g.A.decoderinworkletOP&&!!g.A.sharedBuffer}function be(e,t){var i;g.A.localSharingPara?Object.assign(g.A.localSharingPara,t):g.A.localSharingPara=t,i=e,g.A.Sharing_WebSocket_Ip_Address=i}function we(e,t){g.A.localAudioPara?Object.assign(g.A.localAudioPara,t):g.A.localAudioPara=t,Te(e)}function Re(e,t){g.A.localVideoPara?Object.assign(g.A.localVideoPara,t):g.A.localVideoPara=t,Me(e)}function Te(e){g.A.Audio_WebSocket_Ip_Address=e}function Ie(e){g.A.Audio_Web_Transport_Ip_Address=e}function Me(e){g.A.Video_WebSocket_Ip_Address=e}function De(e){g.A.Video_Web_Transport_Ip_Address=e}function Pe(){!function(e){if(e=g.A.SPECIAL_ID,g.A.localAudioEncMGR){var t=g.A.localAudioEncMGR.map.get(e);t&&(t.postMessage({command:y.CLOSE_MEDIA}),g.A.localAudioEncMGR.map.delete(e)),g.A.audioEncodeSession=null}}(g.A.SPECIAL_ID),function(e){if(e=g.A.SPECIAL_ID,g.A.localAudioDecMGR){var t=g.A.localAudioDecMGR.map.get(g.A.SPECIAL_ID);t&&(t.postMessage({command:y.CLOSE_MEDIA}),g.A.localAudioDecMGR.map.delete(e)),g.A.audioDecodeSession=null}}(g.A.SPECIAL_ID),g.A.localAudioDecMGR=null,g.A.localAudioEncMGR=null}function ke(){!function(e){if(e=g.A.SPECIAL_ID,g.A.localVideoDecMGR){var t=g.A.localVideoDecMGR.map.get(e);t&&(t.postMessage({command:y.CLOSE_MEDIA}),g.A.localVideoDecMGR.map.delete(e)),g.A.videoDecodeSession=null}}(g.A.SPECIAL_ID),g.A.localVideoDecMGR=null,g.A.localVideoEncMGR=null}function Oe(){!function(){var e=g.A.SPECIAL_ID;if(g.A.localSharingDecMGR){var t=g.A.localSharingDecMGR.Get(e);t&&(t.postMessage({command:y.CLOSE_MEDIA}),g.A.localSharingDecMGR=null),g.A.isSharingDecodeThreadStart=!1}}()}function Ve(e,t,i,r,s,o,a){if(g.A.localVideoEncMGR){var n=g.A.localVideoEncMGR.map.get(e);if(n){var d={command:"encodeVideoFrame",data:t,stride:i,x:r,y:s,frame_width:o,frame_height:a,rotation:0};n.postMessage(d,[d.data.buffer])}}}function Ne(e,t,i,r,s,o){var a,n;if(n=null!==(a=g.A.mediaSDKHandle)&&void 0!==a&&a.isSupportVideoShare?g.A.localVideoEncMGR.map.get(e):g.A.localSharingEncMGR.map.get(e)){let e;t?(e={command:"encodeSharingFrame",data:t,width:s,height:o},n.postMessage(e,[e.data.buffer])):(e={command:"encodeSharingFrame"},n.postMessage(e))}}function xe(e,t,i,r,s,o,a,n,d,c,l){if(g.A.isVideoPlayWork){var h={yuvdata:t,ntptime:i,ssrc:e,width:r,height:s,r_x:o,r_y:a,r_w:n,r_h:d,rotation:c,yuv_limited:l};h.ssrc=h.ssrc>>10<<10,g.A.mediaSDKHandle.VideoRenderObj.Put_Video_Data_Queue(h,15)}}function Le(){return g.A.localSharingDecMGR?g.A.localSharingDecMGR.SharingQueueMGR.ClearQueue():g.A.localMouseDecMGR?g.A.localMouseDecMGR.SharingQueueMGR.ClearQueue():0}async function We(e,t,i,r){g.A.isVideoDecodeThreadStart||(g.A.isVideoDecodeThreadStart=!0,await H(r,g.A.localVideoDecMGR,ge,v._c.VIDEO_DECODE,i))}async function Ue(e,t,i,r){if(m.A.add_monitor("AADT"),i&&i.isDestroy)return m.A.add_monitor("ZID"),W("WorkerType:audioDec;The relative SDK instance is destroy, don't start relative worker, avoid multiple same workers. ");g.A.isAudioDecodeThreadStart||(g.A.isAudioDecodeThreadStart=!0,await H(r,g.A.localAudioDecMGR,ye,v._c.AUDIO_DECODE,i))}function Be(e){if(e>>=10,g.A.localAudioDecMGR){var t=g.A.localAudioDecMGR.GetSSRCTimeMap(e);return null===t?0:t}}function Fe(e){return{currentSSRCTime:g.A.CurrentSSRCTime,audioPlayTime:g.A.audioPlayTime}}function He(e,t){var i=g.A.SPECIAL_ID,r=g.A.localVideoDecMGR.map.get(i);r.postMessage({command:"failover",websocket_ip_address:t}),(r=g.A.localAudioDecMGR.map.get(i)).postMessage({command:"failover",websocket_ip_address:e})}function Ge(e){for(var t,i=g.A.SPECIAL_ID,r=g.A.audio_pcm_queue.dequeue();r;)r=g.A.audio_pcm_queue.dequeue();g.A.localAudioEncMGR&&(t=g.A.localAudioEncMGR.map.get(i))&&g.A.audioEncodeSession&&t.postMessage({command:"modifySampleRate",sampleRate:e}),g.A.localAudioDecMGR&&(t=g.A.localAudioDecMGR.map.get(i))&&g.A.audioDecodeSession&&t.postMessage({command:"modifySampleRate",sampleRate:e})}function je(e,t,i){if(e=g.A.SPECIAL_ID,g.A.localAudioDecMGR){const r=g.A.localAudioDecMGR.map.get(e);r&&r.postMessage({command:"mute",bOn:t,fakeLeave:i})}if(g.A.localAudioEncMGR){const r=g.A.localAudioEncMGR.map.get(e);r&&r.postMessage({command:"mute",bOn:t,fakeLeave:i})}}function Ke(e,t){if(e=g.A.SPECIAL_ID,g.A.localAudioDecMGR){const i=g.A.localAudioDecMGR.map.get(e);i&&i.postMessage({command:"AecFlag",flag:t})}if(g.A.localAudioEncMGR){const i=g.A.localAudioEncMGR.map.get(e);i&&i.postMessage({command:"AecFlag",flag:t})}}function ze(e,t,i,r){var s=g.A.SPECIAL_ID;if(g.A.localAudioDecMGR){const t=g.A.localAudioDecMGR.map.get(s);t&&t.postMessage({command:i},[e.port2])}if(g.A.localAudioEncMGR){const e=g.A.localAudioEncMGR.map.get(s);e&&e.postMessage({command:r},[t.port1])}}function qe(e,t){var i=g.A.SPECIAL_ID;if(g.A.localVideoDecMGR){let t=g.A.localVideoDecMGR.map.get(i);t&&t.postMessage({command:"decodeVideoPort"},[e.port1])}if(g.A.localVideoEncMGR){let e=g.A.localVideoEncMGR.map.get(i);e&&e.postMessage({command:"encodeVideoPort"},[t.port2])}}function Ye(e,t){var i=g.A.SPECIAL_ID;if(g.A.localVideoDecMGR){let t=g.A.localVideoDecMGR.map.get(i);t&&t.postMessage({command:"vsport"},[e.port1])}if(g.A.localSharingDecMGR){let e=g.A.localSharingDecMGR.map.get(i);e&&e.postMessage({command:"vsport"},[t.port2])}}function Xe(e){var t=g.A.SPECIAL_ID;if(g.A.localAudioDecMGR){var i=g.A.localAudioDecMGR.map.get(t);i&&i.postMessage({command:"decodeAudioPort2"},[e.port2])}}function Qe(e){var t=g.A.SPECIAL_ID;if(g.A.localAudioEncMGR){var i=g.A.localAudioEncMGR.map.get(t);i&&i.postMessage({command:"shareAudioDecodeAudioPort2"},[e.port2])}}function Je(e){var t=g.A.SPECIAL_ID;if(g.A.localVideoDecMGR){var i=g.A.localVideoDecMGR.map.get(t);i&&i.postMessage({command:"decodeVideoPortWithAudio",port:e.port1},[e.port1])}}function $e(e){var t=g.A.SPECIAL_ID;if(g.A.localVideoEncMGR){var i=g.A.localVideoEncMGR.map.get(t);i&&i.postMessage(e)}}function Ze(e,t,i){et({command:e,data:t,orientation:i},arguments.length>3&&void 0!==arguments[3]&&!arguments[3]?null:[t])}function et(e,t){let i=g.A.SPECIAL_ID;if(!g.A.localVideoEncMGR)return!1;let r=g.A.localVideoEncMGR.map.get(i);return!!r&&(r.postMessage(e,t),!0)}function tt(e){var t=g.A.SPECIAL_ID;if(g.A.localVideoDecMGR){var i=g.A.localVideoDecMGR.map.get(t);i&&i.postMessage(e)}}function it(e,t){var i=g.A.SPECIAL_ID;if(g.A.localVideoEncMGR){var r=g.A.localVideoEncMGR.map.get(i);r&&r.postMessage({command:e,data:t},[t])}}function rt(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];var r=g.A.SPECIAL_ID;if(g.A.localSharingEncMGR){var s=g.A.localSharingEncMGR.map.get(r);s&&s.postMessage({command:e,data:t},i?[t]:null)}}function st(e){if(g.A.localVideoDecMGR){var t=g.A.localVideoDecMGR.map.get(g.A.SPECIAL_ID);t&&t.postMessage(e)}}function ot(e){var t=g.A.SPECIAL_ID;if(g.A.localSharingDecMGR){var i=g.A.localSharingDecMGR.map.get(t);i&&i.postMessage(e)}}function at(e){var t=g.A.SPECIAL_ID;if(g.A.localAudioDecMGR){var i=g.A.localAudioDecMGR.map.get(t);i&&i.postMessage({command:"updateCurrentSSRC",SSRC:e})}}function nt(e){var t=g.A.SPECIAL_ID;if(g.A.localAudioEncMGR){var i=g.A.localAudioEncMGR.map.get(t);i&&i.postMessage(e)}}function dt(e){var t=g.A.SPECIAL_ID;if(g.A.localAudioDecMGR){var i=g.A.localAudioDecMGR.map.get(t);i&&i.postMessage(e)}}function ct(e){var t={command:"interpretation_enable",enable:e};nt(t),g.A.decoderinworklet?g.A.workletWasmInitSuccess&&g.A.AudioNode?g.A.AudioNode.postCMD("interpretation_enable",t):g.A.workletMessageQueue.enqueue(t):dt(t)}function lt(e){var t={command:"cc_set_lang",lang:e};g.A.ccSpeakingLang=e,nt(t)}function ht(e){var t={command:"interpretation_set_lang",lang:e};nt(t),g.A.decoderinworklet?g.A.workletWasmInitSuccess&&g.A.AudioNode?g.A.AudioNode.postCMD("interpretation_set_lang",t):g.A.workletMessageQueue.enqueue(t):dt(t)}function ut(e){var t={command:"interpretation_mute_origin",mute:e};nt(t),g.A.decoderinworklet?g.A.workletWasmInitSuccess&&g.A.AudioNode?g.A.AudioNode.postCMD("interpretation_mute_origin",t):g.A.workletMessageQueue.enqueue(t):dt(t)}function pt(e){var t={command:"interpretation_set_interpreter",interpreterList:e};nt(t),g.A.decoderinworklet?g.A.workletWasmInitSuccess&&g.A.AudioNode?g.A.AudioNode.postCMD("interpretation_set_interpreter",t):g.A.workletMessageQueue.enqueue(t):dt(t)}function ft(){var e=g.A.SPECIAL_ID;if(g.A.localAudioEncMGR){var t=g.A.localAudioEncMGR.map.get(e);t&&t.postMessage({command:"resetAec"})}}function mt(e){try{if(m.A&&e){let t=["ERR:",e.message,"f"].join(""),i=m.A.checkIsNecessaryExceptionLogAndReturnRepeatTimes(t);i.isNecessary?(W("error repeat ".concat(i.repeatNumber),t),m.A.add_monitor(t+"(repeat:".concat(i.repeatNumber,")"))):W("error but ignore",e.message)}}catch(e){W("_listenWindowErrorEvent error",e)}}function vt(){try{var e,t,i,r;const s=(null===(e=screen)||void 0===e?void 0:e.width)||0,o=(null===(t=screen)||void 0===t?void 0:t.height)||0;m.A.add_monitor("SCR:".concat(s,"x").concat(o)),m.A.add_monitor(["BSAGT:",navigator.userAgent].join("")),m.A.add_monitor("BSLITEND:"+(h.Ay.isLittleEndian()?1:0)),window.navigator.hardwareConcurrency&&m.A.add_monitor("OSCPUS:"+window.navigator.hardwareConcurrency);let a=h.Ay.getOSInfo();m.A.add_monitor("deviceType:".concat(a.osType,"|os_name:").concat(a.os,"|os_version:").concat(a.osVersion)),m.A.add_monitor("browser_name:".concat(null==a||null===(i=a.browser)||void 0===i?void 0:i.name,"|browser_version:").concat(null==a||null===(r=a.browser)||void 0===r?void 0:r.version)),(0,h.jo)()}catch(e){console.error("<<<<",e)}}function gt(e){m.A.init(),window.addEventListener("error",mt),g.A.monitorIntervalHandle=setInterval((function(){if(!m.A.startSendLog)return;let e=m.A.get_monitor();e&&m.A.send_monitor_directly(e)}),1e4)}function _t(){g.A.recvStatsMapIntervalHandle=setInterval((function(){if(!g.A.lastStatsLogs.audioRecvStats)return;const e=performance.now()-1e4;for(const[t,i]of g.A.lastStatsLogs.audioRecvStats)i.updateTime&&i.updateTime<e&&g.A.lastStatsLogs.audioRecvStats.delete(t)}),1e4)}function St(e){m.A.add_monitor2(e)}function At(e){window.removeEventListener("error",mt),clearInterval(g.A.monitorIntervalHandle),m.A.send_instant_monitor()}function yt(){clearInterval(g.A.recvStatsMapIntervalHandle)}function Ct(e){var t=g.A.SPECIAL_ID;if(g.A.localVideoEncMGR){var i=g.A.localVideoEncMGR.map.get(t);i&&i.postMessage({command:"ENCRYPT",encrypt:e})}}function Et(e){var t=g.A.SPECIAL_ID;if(g.A.localSharingEncMGR){var i=g.A.localSharingEncMGR.Get(t);i&&i.postMessage({command:"ENCRYPT",encrypt:e})}}function bt(e){if(g.A.localVideoEncMGR){var t=g.A.localVideoEncMGR.map.get(g.A.SPECIAL_ID);t&&t.postMessage(e)}}function wt(e){if(g.A.localSharingEncMGR){var t=g.A.localSharingEncMGR.map.get(g.A.SPECIAL_ID);t&&t.postMessage(e)}}function Rt(e){if(g.A.localVideoEncMGR){var t=g.A.localVideoEncMGR.map.get(g.A.SPECIAL_ID);t&&t.postMessage(e)}}function Tt(e){if(g.A.localSharingEncMGR){var t=g.A.localSharingEncMGR.map.get(g.A.SPECIAL_ID);t&&t.postMessage(e)}}function It(e){var t=g.A.SPECIAL_ID;if(g.A.localAudioEncMGR){var i=g.A.localAudioEncMGR.map.get(t);i&&i.postMessage({command:"ENCRYPT",encrypt:e})}}function Mt(){let e=g.A.SPECIAL_ID;[g.A.localAudioDecMGR,g.A.localAudioEncMGR,g.A.localVideoDecMGR,g.A.localVideoEncMGR,g.A.localSharingDecMGR,g.A.localSharingEncMGR].forEach((t=>{t&&t.map.get(e)&&t.map.get(e).postMessage({command:"SOCKET_RECONNECT",disable:!0})}))}function Dt(e){e.forEach((e=>{e&&(e.setHanderSuccess(!1),e.setSocketSuccess(!1),e.setWasmSuccess(!1))}))}function Pt(e,t){let i=g.A.SPECIAL_ID;e&&e.forEach((e=>{e&&e.map.get(i)&&(e.map.get(i).onmessage=null)})),t&&t.forEach((e=>{e&&e.map.get(i)&&(e.map.get(i).onmessage=null)}))}async function kt(e,t,i){let r=g.A.SPECIAL_ID,s=t;s.forEach((t=>{t&&t.map.get(r)&&t.map.get(r).postMessage({command:y.CLOSE_MEDIA,_id:e._id})})),s=i,s.forEach((t=>{t&&t.map.get(r)&&t.map.get(r).postMessage({command:y.CLOSE_MEDIA,_id:e._id})})),await h.Ay.sleep(1e3)}async function Ot(e,t){let i=g.A.SPECIAL_ID,r=e;r.forEach((e=>{e&&e.map.get(i)&&e.map.get(i).terminate()})),r=t,await h.Ay.is32bitChrome()||r.forEach((e=>{e&&e.map.get(i)&&e.map.get(i).terminate()}))}function Vt(e){let t;switch(e){case v._c.AUDIO_DECODE:t=g.A.localAudioDecMGR;break;case v._c.AUDIO_ENCODE:t=g.A.localAudioEncMGR;break;case v._c.VIDEO_DECODE:t=g.A.localVideoDecMGR;break;case v._c.VIDEO_ENCODE:t=g.A.localVideoEncMGR;break;case v._c.SHARING_DECODE:t=g.A.localSharingDecMGR;break;case v._c.SHARING_ENCODE:t=g.A.localSharingEncMGR}let i=g.A.SPECIAL_ID;return t&&t.map.get(i)?t.map.get(i):null}async function Nt(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:y.PUSH_MESSAGE_FROM_MAIN_TO_WORKER,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];s&&await async function(e){switch(e){case v._c.VIDEO_ENCODE:await g.A.videoInitInstance.initSuccessPromise;break;case v._c.VIDEO_DECODE:await g.A.videoDecInitInstance.initSuccessPromise;break;case v._c.AUDIO_ENCODE:await g.A.audioEncodeInitInstance.initSuccessPromise;break;case v._c.AUDIO_DECODE:await g.A.audioDecInitInstance.initSuccessPromise;break;case v._c.SHARING_ENCODE:await g.A.sharingEncInitInstance.initSuccessPromise;break;case v._c.SHARING_DECODE:await g.A.sharingDecInitInstance.initSuccessPromise;break;default:p.Ay.error("No matched worker type: ".concat(e))}}(e);let o=Vt(e);if(!o){if(!s)return W("worker handle not ready, drop!",e,t,i),!1;if(W.warn("worker handle not ready, waiting!",e,t,i),o=Vt(e),!o)return}return r?o.postMessage({command:i,data:t},[t]):o.postMessage({command:i,data:t}),!0}function xt(e,t){g.A.decoderinworklet&&(g.A.workletWasmInitSuccess&&g.A.AudioNode?g.A.AudioNode.postCMD(t,e):g.A.workletMessageQueue.enqueue({command:t,data:e}))}function Lt(){return null!==Vt(v._c.VIDEO_ENCODE)}function Wt(e,t,i){var r=g.A.SPECIAL_ID;if(g.A.localVideoEncMGR){var s=g.A.localVideoEncMGR.map.get(r);s&&(e?s.postMessage({command:t,canvas:e,rendercanvasID:i},[e]):s.postMessage({command:t,canvas:e,rendercanvasID:i}))}}function Ut(e){let t;return t=new e({storeOptions:{nameSpaceId:"vbFile"}}),new Promise(((e,i)=>{t.on("ready",(()=>{e(t)}))}))}function Bt(e){let t=new Uint8Array(e,0,12),i=new Uint8Array(e,12,32);window.crypto.subtle.importKey("raw",i,"AES-GCM",!0,["encrypt","decrypt"]).then((r=>{let s=t.length+i.length,o=new Uint32Array(e.slice(s,s+4))[0];s+=4;let a=e.slice(s,s+o);s+=o,o=new Uint32Array(e.slice(s,s+4))[0],s+=4;let n=new Uint8Array(e,s,o);s+=o,o=new Uint32Array(e.slice(s,s+4))[0],s+=4;let d=e.slice(s,s+o);s+=o,o=new Uint32Array(e.slice(s,s+4))[0],s+=4;let c=new Uint8Array(e,s,o);g.A.basebin=a,g.A.afnbin=d,Ft(c,r,t).then((e=>{g.A.afnjson=(new TextDecoder).decode(e);var t=g.A.SPECIAL_ID;if(g.A.localVideoEncMGR){var i=g.A.localVideoEncMGR.map.get(t);i&&g.A.afnbin&&g.A.afnjson&&i.postMessage({command:"DOWNLOAD_JSON_FROM_MAIN_THREAD_OK",data:{bin:g.A.afnbin,json:g.A.afnjson},index:1})}})),Ft(n,r,t).then((e=>{g.A.basejson=(new TextDecoder).decode(e);var t=g.A.SPECIAL_ID;if(g.A.localVideoEncMGR){var i=g.A.localVideoEncMGR.map.get(t);i&&g.A.basebin&&g.A.basejson&&i.postMessage({command:"DOWNLOAD_JSON_FROM_MAIN_THREAD_OK",data:{bin:g.A.basebin,json:g.A.basejson},index:2})}}))}))}function Ft(e,t,i){return window.crypto.subtle.decrypt({name:"AES-GCM",iv:i},t,e)}function Ht(e){for(let r=0;r<e.length;r++)if("js"==e[r].type){m.A.add_monitor("VDTF"),g.A.tfjsurl=e[r].path;var t=g.A.SPECIAL_ID;if(g.A.localVideoEncMGR){var i=g.A.localVideoEncMGR.map.get(t);i&&i.postMessage({command:"DOWNLOAD_JSON_FROM_MAIN_THREAD_OK",data:g.A.tfjsurl,type:"js"})}}else"bin"==e[r].type&&(0,D.A)(e[r].path).then((e=>{if(!e.ok)throw new Error("network issue");return e.arrayBuffer()})).then((t=>{m.A.add_monitor("VDBIN"),g.A.vbarraybuffer=t;try{e[r].path.indexOf("dual")>=0&&Bt(t)}catch(e){p.Ay.error("An error occurred when decrypting the virtual background file",e),m.A.add_monitor("VBDECRYPTF"),g.A.Notify_APPUI(n.KqK,U.FAIL)}})).catch((e=>{p.Ay.error("An error occurred when trying to obtain the virtual background file",e),m.A.add_monitor("VBFF"),g.A.Notify_APPUI(n.KqK,U.FAIL)}))}function Gt(e,t){var i=g.A.SPECIAL_ID;if(g.A.localVideoEncMGR){var r=g.A.localVideoEncMGR.map.get(i);r&&(e?r.postMessage({command:"maskandbgimagebitmap",imagename:t,data:e},[e]):r.postMessage({command:"maskandbgimagebitmap",imagename:t,data:e}))}}function jt(e,t){var i=g.A.SPECIAL_ID;if(g.A.localVideoEncMGR){var r=g.A.localVideoEncMGR.map.get(i);r&&(e?r.postMessage({command:"vbbgimagebitmap",imagename:t,data:e},[e]):r.postMessage({command:"vbbgimagebitmap",imagename:t,data:e}))}}function Kt(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var o=g.A.SPECIAL_ID;if(g.A.localVideoEncMGR){var a=g.A.localVideoEncMGR.map.get(o);a&&(e?a.postMessage({command:"maskandbgimagebitmap",imagename:t,data:e,maskCoordinate:i,width:r,height:s},[e]):a.postMessage({command:"maskandbgimagebitmap",imagename:t,data:e,maskCoordinate:i,width:r,height:s}))}}function zt(e){var t=g.A.SPECIAL_ID;if(g.A.localVideoDecMGR){var i=g.A.localVideoDecMGR.map.get(t);i&&i.postMessage(e)}}function qt(){try{return h.Ay.browser.isChromeOrEdge&&-1!==["85","86"].indexOf(h.Ay.getBrowserVersion())}catch(e){return W(e),!1}}const Yt={[v._c.VIDEO_ENCODE]:{success:n.$MS,failed:n.rNn,callbackDataValue:v.Go.encode},[v._c.VIDEO_DECODE]:{success:n.$MS,failed:n.rNn,callbackDataValue:v.Go.decode},[v._c.AUDIO_ENCODE]:{success:n.epV,failed:n.uiQ,callbackDataValue:v.Go.encode},[v._c.AUDIO_DECODE]:{success:n.epV,failed:n.uiQ,callbackDataValue:v.Go.decode},[v._c.SHARING_DECODE]:{success:n.Y7X,failed:n.IQ_,callbackDataValue:v.Go.decode},[v._c.SHARING_ENCODE]:{success:n.Y7X,failed:n.IQ_,callbackDataValue:v.Go.encode}};function Xt(e,t){let i=[v._c.AUDIO_ENCODE,v._c.AUDIO_DECODE,v._c.VIDEO_ENCODE,v._c.VIDEO_DECODE];e.isSupportVideoShare||i.push(v._c.SHARING_ENCODE,v._c.SHARING_DECODE),i.forEach((async e=>{Nt(e,t,y.HOLD,!1,!0)}))}function Qt(e){var t,i,r,s,o;let a=h.Ay.getOSInfo();e.cpu=(null===(t=navigator)||void 0===t?void 0:t.hardwareConcurrency)||1,e.deviceType=a.osType,e.osType=a.os,e.osVersion=a.osVersion,e.browserName=null===(i=a.browser)||void 0===i?void 0:i.name,e.browserVersion=null===(r=a.browser)||void 0===r?void 0:r.version;const n=h.Ay.getGpuInfo();e.gpuInfo=null==n?void 0:n.renderInfo,p.Ay.directReport(JSON.stringify(e));let d=null===g.A||void 0===g.A||null===(s=g.A.instance)||void 0===s?void 0:s.persistenceInfo;if(!d)return;let c=e.encode?d.getVideoEncoderInfo():d.getVideoDecoderInfo(),l={};l.osVersion=a.osVersion,l.browserVersion=null===(o=a.browser)||void 0===o?void 0:o.version,l.sdkVersion="13487",c.updateInfo(e,l)}function Jt(e,t){var i;const r=[[],[[v._c.AUDIO_ENCODE],[v._c.AUDIO_DECODE],[v._c.AUDIO_ENCODE,v._c.AUDIO_DECODE]],[[v._c.VIDEO_ENCODE],[v._c.VIDEO_DECODE],[v._c.VIDEO_ENCODE,v._c.VIDEO_DECODE]],[],[[v._c.SHARING_ENCODE],[v._c.SHARING_DECODE],[v._c.SHARING_ENCODE,v._c.SHARING_DECODE]]];let s=null===(i=t.body)||void 0===i?void 0:i.data;if(!s)return;let o=s.type,a=s.mode;e.isSupportVideoShare&&4==o&&(o=2);let n=r[o][a];n&&0!=n.length&&n.forEach((e=>{Nt(e,s,y.MEDIA_COMMAND,!1,!0)}))}function $t(e,t){let i=null,r=null;return{create:function(){return i||(i=new Promise((async(s,o)=>{try{const o=new Blob([await B(e,t)]),n=await o.arrayBuffer(),d=a().createObjectURL(new Blob([n]));let c=new Worker(d,e?{name:e}:void 0);if(!i)return c.terminate(),void s(null);r=c,s(c)}catch(e){s(null)}})),i)},destroy:function(){if(!r&&!i)return;let e=i;i=null,r=null,e&&e.then((e=>{null==e||e.terminate()}))}}}function Zt(e){return Vt(e)}function ei(e){let t=null;switch(e){case v._c.AUDIO_DECODE:t=g.A.audioDecInitInstance;break;case v._c.AUDIO_ENCODE:t=g.A.audioEncodeInitInstance;break;case v._c.VIDEO_DECODE:t=g.A.videoDecInitInstance;break;case v._c.VIDEO_ENCODE:t=g.A.videoInitInstance;break;case v._c.SHARING_DECODE:t=g.A.sharingDecInitInstance;break;case v._c.SHARING_ENCODE:t=g.A.sharingEncInitInstance}return t}},9558:(e,t,i)=>{"use strict";i.d(t,{A:()=>u});var r=i(5738),s=i(2689),o=i(7080),a=i(385),n=i(9407),d=i(2710),c=i(3656),l=i(559);i(9559);let h=null;if("function"==typeof AudioWorklet){class e extends AudioWorkletNode{constructor(e,t,i){super(e,t,i),this.port.onmessage=this.handleMessage.bind(this)}handleMessage(e){var t=e.data;switch(t.status){case"delay":if(s.A.localAudioDecMGR){var i=s.A.localAudioDecMGR.map.get(0);i&&i.postMessage({command:"delay"})}break;case n.uf:t.at&&(s.A.CurrentSSRCTime=t.at,s.A.audioPlayTime=Date.now()),t.st&&s.A.mediaSDKHandle.SharingRenderObj&&s.A.mediaSDKHandle.SharingRenderObj.SetcATimeStamp(t.st);break;case n.b5:r.addAudioMonitorLog.push({log:t.data,logSource:d.JT});break;case n.NN:if(null!=t&&t.data){var h;s.A.lastStatsLogs.audioRecvStats=s.A.lastStatsLogs.audioRecvStats||new Map;const e=null===(h=t.data)||void 0===h?void 0:h.ssrc;let i=s.A.lastStatsLogs.audioRecvStats.get(e)||{};var u,p,f,m;e&&(i.timestamp=null===(u=t.data)||void 0===u?void 0:u.timestamp,i.ssrc=null===(p=t.data)||void 0===p?void 0:p.ssrc,i.packetsLost=null===(f=t.data)||void 0===f?void 0:f.packetsLost,i.packetsReceived=null===(m=t.data)||void 0===m?void 0:m.packetsReceived,i.updateTime=performance.now(),s.A.lastStatsLogs.audioRecvStats.set(e,i))}break;case"MONITOR_LOG":o.A.add_monitor(t.data);break;case"UPDATE_MULTIVIEW_TIME":if(s.A.localVideoDecMGR){let e=s.A.localVideoDecMGR.map.get(0);e&&e.postMessage({command:"audioDecodeTime",data:t.data,status:1})}break;case"WASM_INIT_SUCCESS":for(o.A.add_monitor("DIWL"+t.data.audio_handle),s.A.workletWasmInitSuccess=!0;!s.A.workletMessageQueue.isEmpty();){let e=s.A.workletMessageQueue.dequeue();this.postCMD(e.command,e)}break;case"workletMessage":"error"===t.data.level&&a.Ay.error(t.data.message,t.data.data);break;case"WASM_INIT_FAILED":o.A.add_monitor("AWMAF"),s.A.hasAudioMemoryError?(0,c.iK)(l.a1o):(0,c.iK)(l.oQY),s.A.hasAudioMemoryError=!0;break;case"PROCESS_EXCEPTIONS":(0,c.iK)(l.mxj,t.data)}}postData(e,t){this.port.postMessage({status:e,data:t},[t.data.buffer])}postCMD(e,t){this.port.postMessage({status:e,data:t})}}h=e}const u=h},879:(e,t,i)=>{"use strict";i.d(t,{f:()=>o});var r=i(7857),s=i(2754);const o=new class{constructor(){(0,r.A)(this,"_platformDesc",{supportGraphicsAcceleration:!1,supportVideoFrame:!1,supportMediaStreamTrackGenerator:!1,supportTransferableStream:!1,supportDrawWatermark:!1,supportVideoFrameInWorker:!1,supportVideoTrackGeneratorInWorker:!1,supportOffscreenCanvasInWorker:!1,supportImageBitmapRenderingInWorker:!1,supportTransferableTrackAcrossWork:!1,supportsRequestAnimationFrameInWork:!1}),(0,r.A)(this,"_inferedDesc",{supportVideoTagRenderer:!1}),(0,r.A)(this,"_analyzing_promise",null),(0,r.A)(this,"_main_analyzed",!1),(0,r.A)(this,"_remote_analyzed",!1),(0,r.A)(this,"_analyzedPromise",void 0),(0,r.A)(this,"_resolveAnalyzedPromise",void 0),this._analyzedPromise=new Promise(((e,t)=>{this._resolveAnalyzedPromise=e}))}init(e){this._platformDesc=e.platform,this._inferedDesc=e.infered,this._main_analyzed=!0,this._remote_analyzed=!0,this._resolveAnalyzedPromise(this._remote_analyzed)}desc(){return{platform:this._platformDesc,infered:this._inferedDesc}}analyzed(){return this._remote_analyzed}analyzedPromise(){return this._analyzedPromise}_analyzeInferredCapabilites(){this._inferedDesc.supportVideoTagRenderer=this._platformDesc.supportVideoFrame&&this._platformDesc.supportVideoFrameInWorker&&(!0===this._platformDesc.supportMediaStreamTrackGenerator&&!0===this._platformDesc.supportTransferableStream||!0===this._platformDesc.supportVideoTrackGeneratorInWorker)}analyze(e){if(this._analyzing_promise)return this._analyzing_promise;const t=e.analyzeMainCapabilites();return Object.assign(this._platformDesc,t),this._main_analyzed=!0,this._analyzing_promise=new Promise(((t,i)=>{e.analyzeRemoteCapabilities().then((e=>{Object.assign(this._platformDesc,e),this._analyzeInferredCapabilites(),this._remote_analyzed=!0,this._resolveAnalyzedPromise(this._remote_analyzed),t(!0)})).catch((e=>{this._resolveAnalyzedPromise(this._remote_analyzed),t(!1)}))})),this._analyzing_promise}supportGraphicsAcceleration(){return(0,s.vA)(this._main_analyzed),this._platformDesc.supportGraphicsAcceleration}supportTransferableStream(){return(0,s.vA)(this._main_analyzed),this._platformDesc.supportTransferableStream}supportDrawWatermark(){return(0,s.vA)(this._main_analyzed),this._platformDesc.supportDrawWatermark}supportVideoTagRenderer(){return!!this._remote_analyzed&&this._inferedDesc.supportVideoTagRenderer}supportMediaStreamTrackGenerator(){return(0,s.vA)(this._main_analyzed),this._platformDesc.supportMediaStreamTrackGenerator}supportVideoTrackGeneratorInWorker(){return!!this._remote_analyzed&&this._platformDesc.supportVideoTrackGeneratorInWorker}supportTransferableTrackAcrossWork(){return!!this._remote_analyzed&&this._platformDesc.supportTransferableTrackAcrossWork}supportsRequestAnimationFrameInWork(){return!!this._remote_analyzed&&this._platformDesc.supportsRequestAnimationFrameInWork}supportMediaStreamTrackProcessor(){return!!this._remote_analyzed&&this._platformDesc.supportMediaStreamTrackProcessor}}},4895:(e,t,i)=>{"use strict";i.d(t,{X:()=>c});var r=i(7857),s=i(2484),o=i(879),a=i(3485),n=i(3647),d=i(9415);const c=new class{constructor(){(0,r.A)(this,"_desc",{blockConfig:void 0,defaultRendererType:n.h3.WEBGL,isEnableCanvasCtxOptionsOpt:!1,isEnableFallbackToTagRender:!1,isEnableWasmTagRenderer:!1,safariYuvPaddingFixVer:void 0,chromeYuvLeftTopPaddingFixVer:void 0,disableVideoTagOnEdge:void 0,preferredUseSsrcStream:void 0,canUseSsrcStream:void 0,isUseSsrcStream:!1,shouldCropWasmFrameOnPosMismatch:void 0,shouldCropWasmFrameOnSizeMismatchOnly:void 0,avStreamMode:void 0,baseScriptUrl:"",cssPixelScale:1,isVideoHasWaterMark:!1,isSharingHasWaterMark:!1,videoWatermarkInfo:void 0,sharingWatermarkInfo:void 0}),(0,r.A)(this,"_configDone",!1),(0,r.A)(this,"_configDonePromise",void 0),(0,r.A)(this,"_resolveConfigDonePromise",void 0),this._configDonePromise=new Promise(((e,t)=>{this._resolveConfigDonePromise=e}))}_tryResetDerivedConfigIfNeeded(){this._configDone&&(this._desc.canUseSsrcStream=void 0,this._desc.shouldCropWasmFrameOnPosMismatch=void 0,this._desc.shouldCropWasmFrameOnSizeMismatchOnly=void 0)}init(e){this._desc=e,this._configDone=!0}setBlockConfig(e){if(!e)return;this._desc.blockConfig=e;const t=e.safariYuvPaddingFixVer;t&&this.setSafariYuvPaddingFixVer(t);const i=e.chromeYuvLeftTopPaddingFixVer;i&&this.setChromeYuvLeftTopPaddingFixVer(i);const r=e.disableVideoTagOnEdge;"true"===r&&this.setDisableVideoTagOnEdge(r)}configDone(){return this._configDone}configDonePromise(){return this._configDonePromise}markConfigDone(){this._configDone=!0,this._resolveConfigDonePromise(!0)}desc(){return this._desc}preferredUseSsrcStream(){var e;return void 0!==this._desc.preferredUseSsrcStream?!!this._desc.preferredUseSsrcStream:this.canUseSsrcStream()?(this._desc.preferredUseSsrcStream=a.l.isOnWhitelist((null===(e=this._desc.blockConfig)||void 0===e?void 0:e.SsrcStreamPreferredWhitelist)||[]),this._desc.preferredUseSsrcStream):(this._desc.preferredUseSsrcStream=!1,!1)}defaultRendererType(){return this._desc.defaultRendererType}setDefaultRendererType(e){this._desc.defaultRendererType=e,this._tryResetDerivedConfigIfNeeded()}isEnableCanvasCtxOptionsOpt(){return this._desc.isEnableCanvasCtxOptionsOpt}setIsEnableCanvasCtxOptionsOpt(e){this._desc.isEnableCanvasCtxOptionsOpt=e,this._tryResetDerivedConfigIfNeeded()}isEnableWasmTagRenderer(){return this._desc.isEnableWasmTagRenderer}setWasmTagRendererFlags(e){let t=!1;a.l.isBlink()?(t=!!(e&s.n.ENABLE_WASM_TAG_RENDERER.candidates.TAG_RENDERER_ON_CHROME),a.l.isEdge()&&this._desc.disableVideoTagOnEdge&&(t=!1)):a.l.isWebkit()?t=!!(e&s.n.ENABLE_WASM_TAG_RENDERER.candidates.TAG_RENDERER_ON_SAFARI):a.l.isFirefox()&&(t=!!(e&s.n.ENABLE_WASM_TAG_RENDERER.candidates.TAG_RENDERER_ON_FIREFOX)),this._desc.isEnableWasmTagRenderer=t,this._tryResetDerivedConfigIfNeeded()}isEnableFallbackToTagRender(){return this._desc.isEnableFallbackToTagRender}setFallbackToTagRenderFlags(e){let t=!1;a.l.isBlink()?t=!!(e&s.n.ENABLE_FALLBACK_TO_TAG_RENDERER.candidates.FALLBACK_TO_TAG_RENDERER_ON_CHROME):a.l.isWebkit()?t=!!(e&s.n.ENABLE_FALLBACK_TO_TAG_RENDERER.candidates.FALLBACK_TO_TAG_RENDERER_ON_SAFARI):a.l.isFirefox()&&(t=!!(e&s.n.ENABLE_FALLBACK_TO_TAG_RENDERER.candidates.FALLBACK_TO_TAG_RENDERER_ON_FIREFOX)),t||a.l.isLowerPerformanceDevice()&&(t=!!(e&s.n.ENABLE_FALLBACK_TO_TAG_RENDERER.candidates.LOWER_PERFORMANCE_DEVICE)),this._desc.isEnableFallbackToTagRender=t,this._tryResetDerivedConfigIfNeeded()}canUseSsrcStream(){return!!this._configDone&&(void 0!==this._desc.canUseSsrcStream?this._desc.canUseSsrcStream:o.f.supportVideoTagRenderer()?o.f.supportGraphicsAcceleration()&&!a.l.isLowerPerformanceDevice()||!this.isEnableFallbackToTagRender()?this.isEnableWasmTagRenderer()?(this._desc.canUseSsrcStream=!0,this._desc.canUseSsrcStream):(this._desc.canUseSsrcStream=!1,!1):(this._desc.canUseSsrcStream=!0,this._desc.canUseSsrcStream):(this._desc.canUseSsrcStream=!1,!1))}isUseSsrcStream(){return this._desc.isUseSsrcStream}setIsUseSsrcStream(e){this._desc.isUseSsrcStream=e}setSafariYuvPaddingFixVer(e){"[object String]"===Object.prototype.toString.call(e)&&(this._desc.safariYuvPaddingFixVer=e)}setChromeYuvLeftTopPaddingFixVer(e){"[object String]"===Object.prototype.toString.call(e)&&(this._desc.chromeYuvLeftTopPaddingFixVer=e)}setDisableVideoTagOnEdge(e){this._desc.disableVideoTagOnEdge=e}_versionGreaterThan(e,t){const i=t.toString().split("."),r=e.toString().split("."),s=i.length,o=r.length,a=Math.min(s,o);for(let e=0;e<a;e++){const t=parseInt(i[e],10),s=parseInt(r[e],10);if(t!==s)return s>t}return o>=s}_logWasmFrameOnPosMismatch(e){(0,d.B)().tracing.Log_DT("[vtagq] WasmFrameOnPosMismatch: ".concat(e?"Crop":"No Crop"))}shouldCropWasmFrameOnPosMismatch(){return!!this._configDone&&(void 0!==this._desc.shouldCropWasmFrameOnPosMismatch?this._desc.shouldCropWasmFrameOnPosMismatch:this.isUseSsrcStream()?(this._desc.shouldCropWasmFrameOnPosMismatch=!0,a.l.isChrome()?this._desc.chromeYuvLeftTopPaddingFixVer&&this._versionGreaterThan(a.l.browserVersionInfo().chrome,this._desc.chromeYuvLeftTopPaddingFixVer)&&(this._desc.shouldCropWasmFrameOnPosMismatch=!1):a.l.isSafari()&&this._desc.safariYuvPaddingFixVer&&this._versionGreaterThan(a.l.browserVersionInfo().safari,this._desc.safariYuvPaddingFixVer)&&(this._desc.shouldCropWasmFrameOnPosMismatch=!1),this._logWasmFrameOnPosMismatch(this._desc.shouldCropWasmFrameOnPosMismatch),this._desc.shouldCropWasmFrameOnPosMismatch):(this._desc.shouldCropWasmFrameOnPosMismatch=!1,this._logWasmFrameOnPosMismatch(!1),!1))}_logWasmFrameOnSizeMismatch(e){(0,d.B)().tracing.Log_DT("[vtagq] WasmFrameOnSizeMismatch: ".concat(e?"Crop":"No Crop"))}shouldCropWasmFrameOnSizeMismatchOnly(){return!!this._configDone&&(void 0!==this._desc.shouldCropWasmFrameOnSizeMismatchOnly?this._desc.shouldCropWasmFrameOnSizeMismatchOnly:this.isUseSsrcStream()&&a.l.isWebkit()?(a.l.isSafari()&&this._desc.safariYuvPaddingFixVer&&this._versionGreaterThan(a.l.browserVersionInfo().safari,this._desc.safariYuvPaddingFixVer)?this._desc.shouldCropWasmFrameOnSizeMismatchOnly=!1:this._desc.shouldCropWasmFrameOnSizeMismatchOnly=!0,this._logWasmFrameOnSizeMismatch(this._desc.shouldCropWasmFrameOnSizeMismatchOnly),this._desc.shouldCropWasmFrameOnSizeMismatchOnly):(this._desc.shouldCropWasmFrameOnSizeMismatchOnly=!1,this._logWasmFrameOnSizeMismatch(!1),!1))}shouldCropWasmFrame(e,t,i){return!!this._configDone&&(e!=i.width||t!=i.height)&&(c.shouldCropWasmFrameOnSizeMismatchOnly()||c.shouldCropWasmFrameOnPosMismatch()&&(0!=i.x||0!=i.y))}getAVStreamMode(){return this._configDone?(void 0!==this._desc.avStreamMode||(o.f.supportTransferableStream()?this._desc.avStreamMode="writable-stream":o.f.supportTransferableTrackAcrossWork()?this._desc.avStreamMode="track":this._desc.avStreamMode="none"),this._desc.avStreamMode):"none"}getBaseScriptUrl(){return this._desc.baseScriptUrl}setBaseScriptUrl(e){this._desc.baseScriptUrl=e}getCssPixelScale(){return this._desc.cssPixelScale}setCssPixelScale(e){this._desc.cssPixelScale=e}isVideoHasWaterMark(){return this._desc.isVideoHasWaterMark}setIsVideoHasWaterMark(e){this._desc.isVideoHasWaterMark=e,this._tryResetDerivedConfigIfNeeded()}isSharingHasWaterMark(){return this._desc.isSharingHasWaterMark}setIsSharingHasWaterMark(e){this._desc.isSharingHasWaterMark=e,this._tryResetDerivedConfigIfNeeded()}getVideoWatermarkInfo(){return this._desc.videoWatermarkInfo}setVideoWatermarkInfo(e){this._desc.videoWatermarkInfo=e}getSharingWatermarkInfo(){return this._desc.sharingWatermarkInfo}setSharingWatermarkInfo(e){this._desc.sharingWatermarkInfo=e}}},3485:(e,t,i)=>{"use strict";i.d(t,{l:()=>a});var r=i(7857),s=i(1265),o=i.n(s);const a=new class{constructor(){(0,r.A)(this,"_info",void 0),this._info={browser:{brand:"",version:"",isBlink:!1,isWebkit:!1},sysinfo:{osType:"",os:"",osVersion:""},gpuinfo:{vendor:"",renderInfo:"",isAstcSupported:!1,isWebGLContextInvalid:!1},browserVersionInfo:{ie:"",edge:"",firefox:"",opera:"",chrome:"",safari:""},isLowerPerformanceDevice:!1,isSwiftShader:!1,isMacIntelSafari:!1},this._derived={gpuArchitecture:"unknown",normalizedOS:"",normalizedBrowser:""},this._updateDerivedInfo()}init(e){this._info=e,this._updateDerivedInfo()}info(){return this._info}browserInfo(){return this._info.browser}browserVersionInfo(){return this._info.browserVersionInfo}browserName(){var e;return null===(e=this._info.browser.brand)||void 0===e?void 0:e.toLocaleLowerCase()}isChrome(){var e;return"chrome"===(null===(e=this._info.browser.brand)||void 0===e?void 0:e.toLocaleLowerCase())}isSafari(){var e;return"safari"===(null===(e=this._info.browser.brand)||void 0===e?void 0:e.toLocaleLowerCase())}isFirefox(){var e;return"firefox"===(null===(e=this._info.browser.brand)||void 0===e?void 0:e.toLocaleLowerCase())}isEdge(){var e;return"edge"===(null===(e=this._info.browser.brand)||void 0===e?void 0:e.toLocaleLowerCase())}isBlink(){return this._info.browser.isBlink}isWebkit(){return this._info.browser.isWebkit}isLowerPerformanceDevice(){return!!this._info.isLowerPerformanceDevice}_updateDerivedInfo(){this._derived.normalizedOS=this._computeNormalizedOS(),this._derived.normalizedBrowser=this._computeNormalizedBrowser(),this._derived.gpuArchitecture=this._computeGPUArchitecture()}_computeGPUArchitecture(){var e,t;const i=(null===(e=this._info.gpuinfo)||void 0===e?void 0:e.vendor)||"",r=(null===(t=this._info.gpuinfo)||void 0===t?void 0:t.renderInfo)||"",s=i.toLowerCase(),a=r.toLowerCase(),n=e=>s.includes(e)||a.includes(e);if(this.isSafari())return this._info.isMacIntelSafari?"intel":"apple";if(n("intel"))return"intel";if(n("nvidia")||n("geforce"))return"nvidia";if(n("amd")||n("radeon")||n("ati"))return"amd";if(n("apple")||n("m1")||n("m2")||n("m3"))return"apple";if(n("qualcomm")||n("adreno"))return"qualcomm";if(n("mediatek")||n("mtk"))return"mediatek";if(n("mali"))return"mali";if(n("arm"))return"arm";if(s){var d;const e=o()(d=s.replace(/[^a-z0-9]+/g," ")).call(d).split(" ")[0];if(e)return e.toLowerCase()}return"unknown"}_computeNormalizedOS(){var e;const t=(null===(e=this._info.sysinfo)||void 0===e||null===(e=e.os)||void 0===e?void 0:e.toLowerCase())||"";return"ios"===t?"ios":t.includes("android")?"android":t.includes("chrome os")||t.includes("chromium os")?"chromeos":t.includes("mac")?"mac":t.includes("win")?"win":t.includes("linux")?"linux":t}_computeNormalizedBrowser(){var e,t;return(null===(e=this._info.browser)||void 0===e||null===(e=e.brand)||void 0===e||null===(t=e.toLocaleLowerCase)||void 0===t?void 0:t.call(e))||""}isOnWhitelist(e){if(!Array.isArray(e)||0===e.length)return!1;const t=this._derived.gpuArchitecture,i=this._derived.normalizedOS,r=this._derived.normalizedBrowser,s=!!this._info.isLowerPerformanceDevice,a=!!this._info.isSwiftShader;return e.some((e=>{var n;if("string"!=typeof e)return!1;const d=o()(e).call(e).toLowerCase();if("low-device"===d)return s;if("swift-shader"===d)return a;const[c,l,h]=d.split("/");if(!c||!l)return!1;const u=o()(c).call(c),p=o()(l).call(l),f=o()(n=h||"").call(n);return!(u&&u!==t||p&&!i.includes(p)&&!p.includes(i)||f&&f!==r)}))}}},9549:(e,t,i)=>{"use strict";function r(e){return e[0]<<24|e[1]<<16|e[2]<<8|e[3]}i.d(t,{J0:()=>s,V_:()=>o});const s={IsQosReport:function(e){return 21==e[4]&&0==e[13]},GetQOSSeq:function(e){!function(e){e[0],e[1]}(e.slice(17,19))},GetQOSTime:function(e){return 104==e[0]||16!=e[4]&&1!=e[5]?r(e.slice(19,23)):r(e.slice(15,19))},IsVideoPkg:function(e){return 103==e[0]}};class o{constructor(e){let t=e||{};this.last_report_time=0,this.timeout_count=0,this.interval_report_time=t.interval||3e3,this.tag=t.tag||"monitor",this.max_timeout=0,this.min_timeout=2147483647,this.reportcallback=t.reportcallback,this._timeoutid=0}_report(){this.reportcallback&&this.reportcallback(this.tag,Math.ceil(this.max_timeout),Math.ceil(this.min_timeout),this.timeout_count),this.timeout_count=0,this.max_timeout=0,this.min_timeout=2147483647}timeoutReport(e,t){if(this.timeout_count++,e>this.max_timeout&&(this.max_timeout=e),e<this.min_timeout&&(this.min_timeout=e),this._timeoutid)return;let i=this;this._timeoutid=setTimeout((()=>{i._report(),i._timeoutid=0}),this.interval_report_time)}}},9693:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ADD_PSL_VIDEO:()=>$,AUDIO_DECODE_SAB:()=>q,AUDIO_ENCODE_SAB:()=>z,CLOSE_DATACHANNEL:()=>D,CLOSE_MEDIA:()=>s,CLOSE_WEBSOCKET:()=>o,CLOSE_WEBTRANSPORT:()=>a,HOLD:()=>w,INIT_THREAD:()=>P,LSS_UPDATE_COOK:()=>te,MAIN_KK:()=>Q,MEDIA_COMMAND:()=>I,MEDIA_STATISTICS_MONITORING:()=>ee,MESH_ALLOW_TALK:()=>B,MESH_CHILD_OPT:()=>N,MESH_CONTROL_IFNO:()=>W,MESH_CREATE_MESHRTC:()=>L,MESH_DATA_BRIDGE:()=>x,MESH_RTTPRODE:()=>F,MESH_SIGN_INFO:()=>H,NEW_ACTIVE_SPEAKER_SSRC:()=>Y,OPEN_DATACHANNEL:()=>M,OPEN_WEBSOCKET:()=>n,OPEN_WEBTRANSPORT:()=>d,PAUSE_OR_RESUME_AUDIO_DECODE:()=>X,PROCESS_VIDEO_IN_MAIN:()=>k,PUSH_MESSAGE_FROM_MAIN_TO_WORKER:()=>c,QOS_MONITORING:()=>p,REMOVE_EXPIRED_CANVAS:()=>E,REMOVE_PSL_VIDEO:()=>Z,RESET_PSL_SHARING_FIRST_FRAME:()=>y,ROTATION_EVENT:()=>G,SCREENSHOT:()=>V,SET_ALL_SPEECH_VOLUME:()=>R,SET_MESH_ROLE:()=>U,SET_OFFSCREENCANVAS_WIDTH_HEIGHT:()=>A,SET_USER_NODE_LIST:()=>b,SHARING_ADD_REV_CHANNEL_TYPE:()=>J,SHARING_RENDER_CANVAS:()=>_,START_AUDIO_CAPTURE:()=>T,START_MEDIA:()=>r,START_SHARING_RENDER:()=>m,STOP_SHARING_RENDER:()=>g,UPDATE_DATACHANNEL_STATUS:()=>l,UPDATE_MEDIA_PARAMS:()=>h,UPDATE_SHARING_ACTIVE_SSRC:()=>S,USER_NODE_LIST_IN_MAIN_SESSION:()=>u,VIDEO_DECODE_SAB_FROM_DATACHANNEL:()=>K,VIDEO_ENCODE_SAB:()=>j,VIDEO_TRACK:()=>f,WEBGL_LOST_REPLACE_CANVAS:()=>C,WORKER_HEARTBEAT:()=>O,ZOOM_SHARING_RENDER:()=>v});const r=1,s=2,o=3,a=4,n=5,d=6,c=7,l=8,h=9,u=10,p=11,f=12,m=13,v=14,g=15,_=16,S=17,A=18,y=19,C=127,E=128,b=129,w=130,R=131,T=132,I=133,M=134,D=135,P=136,k=137,O=138,V=139,N=140,x=141,L=142,W=143,U=144,B=145,F=146,H=147,G=148,j=149,K=150,z=151,q=152,Y=153,X=154,Q=156,J=157,$=158,Z=159,ee=160,te=1147},5723:(e,t,i)=>{"use strict";i.d(t,{CH:()=>u,O6:()=>a,S_:()=>s.S_,Tm:()=>c,Wp:()=>o,Yd:()=>s.Yd,br:()=>n,cY:()=>d,fn:()=>s.fn,px:()=>h,r1:()=>s.r1,r9:()=>s.r9,rm:()=>p});var r=i(9407),s=i(5600);function o(){return self.GROWABLE_HEAP_U8?self.GROWABLE_HEAP_U8():Module.HEAPU8}function a(e){postMessage({status:r.aY,canvasId:e,replaceCanvas:!1})}function n(e){postMessage({status:r.Tf,canvasId:e})}function d(){let e=this;this.promise=new Promise((function(t,i){e.reject=i,e.resolve=t}))}class c{constructor(e){this.sharedBufferList=e}storeFlexible(e,t){let i=e.byteLength-this.sharedBufferList.bytesPerElement;if(i>0){let e=Math.floor(.1*this.sharedBufferList.bytesPerElement),r=i>e?i:e;if(r+this.sharedBufferList.bytesPerElement>t)return Promise.reject("too big, more than maxBytesPerElement");this.sharedBufferList.increaseBufferSize(r)}return this.store(e)}store(e){return this.sharedBufferList.get().then((t=>{try{return this.obj=t,t.uint8s.set(e,0),this.yuvdata=new Uint8Array(t.uint8s.buffer,0,e.byteLength),!0}finally{this.autoRecycle()}}))}storeSync(e){let 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)}autoRecycle(){this.autoRecycleInterval=setTimeout((()=>{console.log("autoRecycle",this.obj.index),this.recycle()}),5e3)}recycle(){try{this.autoRecycleInterval&&clearInterval(this.autoRecycleInterval),this.sharedBufferList.recycle(this.obj.index)}catch(e){(0,s.r1)("Error in YuvWrap.recycle: ".concat(e))}}}const l=["","MOZ_","OP_","WEBKIT_"];function h(e,t){for(var i=0;i<l.length;++i){var r=l[i]+t,s=e.getExtension(r);if(s)return s}}function u(e){return e&&"undefined"!=typeof atob?Uint8Array.from(atob(e),(e=>e.charCodeAt(0))):null}new Map,new class{constructor(){this.ssrcInfoMap=new Map,this.timer=null}updateSSRCInfo(e,t){this.ssrcInfoMap.has(e)||this.ssrcInfoMap.set(e,{firstTime:0,lastTime:0,frames:0,fps:0}),this._calculateFPS(e,t),this._removeZeroFPS()}_calculateFPS(e,t){const i=this.ssrcInfoMap.get(e);if(0===i.frames?i.firstTime=t:i.lastTime=t,i.frames+=1,i.frames>2&&i.frames%5==0&&i.lastTime-i.firstTime>=1e3){const t=Math.floor(1e3/((i.lastTime-i.firstTime)/(i.frames-1)));i.fps!==t&&(this._notifyFPS(e,t),i.fps=t),i.firstTime=i.lastTime,i.frames=1}}_removeZeroFPS(){let e=Date.now();this.ssrcInfoMap.forEach(((t,i)=>{const r=this.ssrcInfoMap.get(i);r&&r.lastTime&&e-r.lastTime>2e3&&(this.ssrcInfoMap.delete(i),this._notifyFPS(i,0))}))}_notifyFPS(e,t){postMessage({status:r.$x,data:{ssrc:e,fps:t}})}_checkIfNewFrameComing(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.timer=setTimeout((()=>{this._removeZeroFPS(),this.timer=null}),2500)}},new class{constructor(){this.ssrcInfoMap=new Map,this.timer=null}updateSSRCInfo(e,t){this.ssrcInfoMap.has(e)||this.ssrcInfoMap.set(e,{timeList:[],lastTime:0,fps:0}),this._calculateFPS(e,t),this._removeZeroFPS(),this._checkIfNewFrameComing()}_calculateFPS(e,t){const i=this.ssrcInfoMap.get(e);if(i.timeList.push(t),i.lastTime=t,i.timeList.length>2){const t=i.timeList[0],r=i.timeList[i.timeList.length-1];if(r-t>=1e3){const s=Math.floor(1e3/((r-t)/(i.timeList.length-1)));i.fps!==s&&(this._notifyFPS(e,s),i.fps=s),i.timeList=[]}}i.timeList.length>30&&(i.timeList=i.timeList.slice(i.timeList.length-30))}_removeZeroFPS(){this.ssrcInfoMap.forEach(((e,t)=>{const i=this.ssrcInfoMap.get(t);i&&Date.now()-i.lastTime>2e3&&(this.ssrcInfoMap.delete(t),this._notifyFPS(t,0))}))}_notifyFPS(e,t){postMessage({status:r.$x,data:{ssrc:e,fps:t}})}_checkIfNewFrameComing(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.timer=setTimeout((()=>{this._removeZeroFPS(),this.timer=null}),2500)}};class p{constructor(e){this.featurebit=e}isSupportOffScreenCanvas(){return 1&this.featurebit}isSupportOffScreenCanvasWebgl(){return 2&this.featurebit}isSupportMediaTrackProcessor(){return 4&this.featurebit}}},2710:(e,t,i)=>{"use strict";i.d(t,{$2:()=>M,$A:()=>F,$K:()=>P,$t:()=>I,BY:()=>K,Bb:()=>Z,DG:()=>y,DY:()=>R,FC:()=>re,FD:()=>se,FP:()=>te,FW:()=>r,Fu:()=>Ce,Fw:()=>S,GV:()=>f,Gk:()=>u,HE:()=>k,HX:()=>ie,Hc:()=>L,IA:()=>U,JT:()=>Q,K_:()=>ye,LA:()=>de,MJ:()=>O,Mm:()=>ae,O8:()=>g,ON:()=>oe,Q9:()=>le,QU:()=>q,Qm:()=>J,RP:()=>X,Rs:()=>fe,UW:()=>_,Wp:()=>c,Yy:()=>p,c7:()=>G,cS:()=>me,dv:()=>z,ej:()=>x,fT:()=>$,fo:()=>H,g$:()=>A,g3:()=>_e,gC:()=>ee,gg:()=>Ae,h:()=>ce,hS:()=>a,hc:()=>W,hd:()=>h,js:()=>Y,jw:()=>Se,kh:()=>n,mV:()=>m,mz:()=>ue,nV:()=>s,nm:()=>he,p$:()=>E,pn:()=>l,qR:()=>T,rK:()=>d,sm:()=>o,sr:()=>ge,tD:()=>w,tT:()=>ne,u:()=>b,u7:()=>C,uu:()=>V,vr:()=>pe,wI:()=>ve,ww:()=>v,x_:()=>B,y:()=>j,yC:()=>D,yu:()=>N});const r=108,s=104,o=0,a=1,n=-1,d=0,c=1,l=2,h=3,u=4,p=4,f=5,m=1,v=2,g=30,_=1,S=30,A=8294400,y=5,C={DESKTOP:0,MOBILE:1,ANDROID:2,IPHONE:3},E=-1,b=0,w=1,R=0,T=1,I=2,M=T+I,D=25,P=1,k=-1,O=0,V=1,N=0,x=1,L=2|x,W=4|x,U=L|W,B=8,F=16,H=32,G=3,j=107,K="101",z="102",q="WCL_M,isWebEnabled:1, isLocalEnabled:1, isSmartBkgnd:1, bkgType:2",Y=0,X=1,Q=2,J=3,$="{[WLCCONT]}",Z=1e4,ee={[N]:new Map([["useinbandfec",1],["maxaveragebitrate",48e3],["maxplaybackrate",24e3],["sprop-maxcapturerate",24e3],["sprop-stereo",null],["stereo",null]]),[x]:new Map([["useinbandfec",null],["maxaveragebitrate",96e3],["maxplaybackrate",48e3],["sprop-maxcapturerate",48e3],["sprop-stereo",1],["stereo",1]]),[L]:new Map([["useinbandfec",null],["maxaveragebitrate",96e3],["maxplaybackrate",48e3],["sprop-maxcapturerate",48e3],["sprop-stereo",1],["stereo",1]]),[W]:new Map([["useinbandfec",null],["maxaveragebitrate",128e3],["maxplaybackrate",48e3],["sprop-maxcapturerate",48e3],["sprop-stereo",1],["stereo",1]]),[U]:new Map([["useinbandfec",null],["maxaveragebitrate",128e3],["maxplaybackrate",48e3],["sprop-maxcapturerate",48e3],["sprop-stereo",1],["stereo",1]]),[B]:new Map([["useinbandfec",null],["maxaveragebitrate",96e3],["maxplaybackrate",48e3],["sprop-maxcapturerate",48e3]]),[F]:new Map([["useinbandfec",1],["maxaveragebitrate",64e3],["maxplaybackrate",24e3],["sprop-maxcapturerate",24e3],["sprop-stereo",null],["stereo",null]]),[H]:new Map([["stereo",1]])},te="SHARE",ie={VIDEO:0,SHARE:1},re={PAUSE:0,RESUME:1,STOP:2},se={UNCHECKED:-1,UNHEALTHY:0,HEALTHY:1},oe=!0,ae=!1,ne={NET_QUALITY_UNKNOWN:-1,NET_QUALITY_VERY_BAD:0,NET_QUALITY_BAD:1,NET_QUALITY_NOT_GOOD:2,NET_QUALITY_NORMAL:3,NET_QUALITY_GOOD:4,NET_QUALITY_EXCELLENT:5},de={NET_BW_LEVEL_UNKNOWN:-1,NET_BW_LEVEL_VERY_LOW:0,NET_BW_LEVEL_LOW:1,NET_BW_LEVEL_NORMAL:2},ce=1,le=2,he=1,ue=2,pe={NEW_STREAM:0,PLAYER_ON_PAUSE:1,VISIBILITY_CHANGE:2,USER_CLICK:3,UNMUTE_ALL:4,ASSIGNED_NODE_ID:5,CAPTURE_AUDIO:6,AUDIO_ERROR:7,STREAM_VALID:8},fe={MEDIA_ERR_ABORTED:1,MEDIA_ERR_NETWORK:2,MEDIA_ERR_DECODE:3,MEDIA_ERR_SRC_NOT_SUPPORTED:4,MEDIA_ERR_UNKNOWN:5},me={AUTO:3,LIGHT_WEIGHT:8},ve={SWITCH_TO_AUTO_DENOISE:0,SWITCH_TO_LIGHT_DENOISE:1,DISABLE_DENOISE:2},ge=1,_e=0,Se=10,Ae=[{codec:"avc1.640028",bitrateMode:"constant",scalabilityMode:"L1T2"},{codec:"avc1.640028",bitrateMode:"constant"},{codec:"avc1.640028"},{codec:"avc1.42e028"}],ye=!1,Ce=!0},5580:(e,t,i)=>{var r=i(6110)(i(9325),"DataView");e.exports=r},8223:(e,t,i)=>{var r=i(6110)(i(9325),"Map");e.exports=r},2804:(e,t,i)=>{var r=i(6110)(i(9325),"Promise");e.exports=r},6545:(e,t,i)=>{var r=i(6110)(i(9325),"Set");e.exports=r},1873:(e,t,i)=>{var r=i(9325).Symbol;e.exports=r},8303:(e,t,i)=>{var r=i(6110)(i(9325),"WeakMap");e.exports=r},2552:(e,t,i)=>{var r=i(1873),s=i(659),o=i(9350),a=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":a&&a in Object(e)?s(e):o(e)}},7534:(e,t,i)=>{var r=i(2552),s=i(346);e.exports=function(e){return s(e)&&"[object Arguments]"==r(e)}},5083:(e,t,i)=>{var r=i(1882),s=i(7296),o=i(3805),a=i(7473),n=/^\[object .+?Constructor\]$/,d=Function.prototype,c=Object.prototype,l=d.toString,h=c.hasOwnProperty,u=RegExp("^"+l.call(h).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!o(e)||s(e))&&(r(e)?u:n).test(a(e))}},4901:(e,t,i)=>{var r=i(2552),s=i(294),o=i(346),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,e.exports=function(e){return o(e)&&s(e.length)&&!!a[r(e)]}},8984:(e,t,i)=>{var r=i(5527),s=i(3650),o=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return s(e);var t=[];for(var i in Object(e))o.call(e,i)&&"constructor"!=i&&t.push(i);return t}},4128:(e,t,i)=>{var r=i(1800),s=/^\s+/;e.exports=function(e){return e?e.slice(0,r(e)+1).replace(s,""):e}},7301:e=>{e.exports=function(e){return function(t){return e(t)}}},5481:(e,t,i)=>{var r=i(9325)["__core-js_shared__"];e.exports=r},2459:(e,t,i)=>{var r="object"==typeof i.g&&i.g&&i.g.Object===Object&&i.g;e.exports=r},6110:(e,t,i)=>{var r=i(5083),s=i(392);e.exports=function(e,t){var i=s(e,t);return r(i)?i:void 0}},659:(e,t,i)=>{var r=i(1873),s=Object.prototype,o=s.hasOwnProperty,a=s.toString,n=r?r.toStringTag:void 0;e.exports=function(e){var t=o.call(e,n),i=e[n];try{e[n]=void 0;var r=!0}catch(e){}var s=a.call(e);return r&&(t?e[n]=i:delete e[n]),s}},5861:(e,t,i)=>{var r=i(5580),s=i(8223),o=i(2804),a=i(6545),n=i(8303),d=i(2552),c=i(7473),l="[object Map]",h="[object Promise]",u="[object Set]",p="[object WeakMap]",f="[object DataView]",m=c(r),v=c(s),g=c(o),_=c(a),S=c(n),A=d;(r&&A(new r(new ArrayBuffer(1)))!=f||s&&A(new s)!=l||o&&A(o.resolve())!=h||a&&A(new a)!=u||n&&A(new n)!=p)&&(A=function(e){var t=d(e),i="[object Object]"==t?e.constructor:void 0,r=i?c(i):"";if(r)switch(r){case m:return f;case v:return l;case g:return h;case _:return u;case S:return p}return t}),e.exports=A},392:e=>{e.exports=function(e,t){return null==e?void 0:e[t]}},7296:(e,t,i)=>{var r,s=i(5481),o=(r=/[^.]+$/.exec(s&&s.keys&&s.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";e.exports=function(e){return!!o&&o in e}},5527:e=>{var t=Object.prototype;e.exports=function(e){var i=e&&e.constructor;return e===("function"==typeof i&&i.prototype||t)}},3650:(e,t,i)=>{var r=i(4335)(Object.keys,Object);e.exports=r},6009:(e,t,i)=>{e=i.nmd(e);var r=i(2459),s=t&&!t.nodeType&&t,o=s&&e&&!e.nodeType&&e,a=o&&o.exports===s&&r.process,n=function(){try{return o&&o.require&&o.require("util").types||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=n},9350:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},4335:e=>{e.exports=function(e,t){return function(i){return e(t(i))}}},9325:(e,t,i)=>{var r=i(2459),s="object"==typeof self&&self&&self.Object===Object&&self,o=r||s||Function("return this")();e.exports=o},7473:e=>{var t=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return t.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},1800:e=>{var t=/\s/;e.exports=function(e){for(var i=e.length;i--&&t.test(e.charAt(i)););return i}},8221:(e,t,i)=>{var r=i(3805),s=i(124),o=i(9374),a=Math.max,n=Math.min;e.exports=function(e,t,i){var d,c,l,h,u,p,f=0,m=!1,v=!1,g=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function _(t){var i=d,r=c;return d=c=void 0,f=t,h=e.apply(r,i)}function S(e){var i=e-p;return void 0===p||i>=t||i<0||v&&e-f>=l}function A(){var e=s();if(S(e))return y(e);u=setTimeout(A,function(e){var i=t-(e-p);return v?n(i,l-(e-f)):i}(e))}function y(e){return u=void 0,g&&d?_(e):(d=c=void 0,h)}function C(){var e=s(),i=S(e);if(d=arguments,c=this,p=e,i){if(void 0===u)return function(e){return f=e,u=setTimeout(A,t),m?_(e):h}(p);if(v)return clearTimeout(u),u=setTimeout(A,t),_(p)}return void 0===u&&(u=setTimeout(A,t)),h}return t=o(t)||0,r(i)&&(m=!!i.leading,l=(v="maxWait"in i)?a(o(i.maxWait)||0,t):l,g="trailing"in i?!!i.trailing:g),C.cancel=function(){void 0!==u&&clearTimeout(u),f=0,d=p=c=u=void 0},C.flush=function(){return void 0===u?h:y(s())},C}},2428:(e,t,i)=>{var r=i(7534),s=i(346),o=Object.prototype,a=o.hasOwnProperty,n=o.propertyIsEnumerable,d=r(function(){return arguments}())?r:function(e){return s(e)&&a.call(e,"callee")&&!n.call(e,"callee")};e.exports=d},6449:e=>{var t=Array.isArray;e.exports=t},4894:(e,t,i)=>{var r=i(1882),s=i(294);e.exports=function(e){return null!=e&&s(e.length)&&!r(e)}},3812:(e,t,i)=>{var r=i(2552),s=i(346);e.exports=function(e){return!0===e||!1===e||s(e)&&"[object Boolean]"==r(e)}},1275:(e,t,i)=>{e=i.nmd(e);var r=i(9325),s=i(9935),o=t&&!t.nodeType&&t,a=o&&e&&!e.nodeType&&e,n=a&&a.exports===o?r.Buffer:void 0,d=(n?n.isBuffer:void 0)||s;e.exports=d},2193:(e,t,i)=>{var r=i(8984),s=i(5861),o=i(2428),a=i(6449),n=i(4894),d=i(1275),c=i(5527),l=i(7167),h=Object.prototype.hasOwnProperty;e.exports=function(e){if(null==e)return!0;if(n(e)&&(a(e)||"string"==typeof e||"function"==typeof e.splice||d(e)||l(e)||o(e)))return!e.length;var t=s(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(c(e))return!r(e).length;for(var i in e)if(h.call(e,i))return!1;return!0}},1882:(e,t,i)=>{var r=i(2552),s=i(3805);e.exports=function(e){if(!s(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},294:e=>{e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},8023:(e,t,i)=>{var r=i(2552),s=i(346);e.exports=function(e){return"number"==typeof e||s(e)&&"[object Number]"==r(e)}},3805:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},346:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},4394:(e,t,i)=>{var r=i(2552),s=i(346);e.exports=function(e){return"symbol"==typeof e||s(e)&&"[object Symbol]"==r(e)}},7167:(e,t,i)=>{var r=i(4901),s=i(7301),o=i(6009),a=o&&o.isTypedArray,n=a?s(a):r;e.exports=n},2543:function(e,t,i){var r;e=i.nmd(e),function(){var s,o="Expected a function",a="__lodash_hash_undefined__",n="__lodash_placeholder__",d=32,c=128,l=1/0,h=9007199254740991,u=NaN,p=4294967295,f=[["ary",c],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",d],["partialRight",64],["rearg",256]],m="[object Arguments]",v="[object Array]",g="[object Boolean]",_="[object Date]",S="[object Error]",A="[object Function]",y="[object GeneratorFunction]",C="[object Map]",E="[object Number]",b="[object Object]",w="[object Promise]",R="[object RegExp]",T="[object Set]",I="[object String]",M="[object Symbol]",D="[object WeakMap]",P="[object ArrayBuffer]",k="[object DataView]",O="[object Float32Array]",V="[object Float64Array]",N="[object Int8Array]",x="[object Int16Array]",L="[object Int32Array]",W="[object Uint8Array]",U="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",H=/\b__p \+= '';/g,G=/\b(__p \+=) '' \+/g,j=/(__e\(.*?\)|\b__t\)) \+\n'';/g,K=/&(?:amp|lt|gt|quot|#39);/g,z=/[&<>"']/g,q=RegExp(K.source),Y=RegExp(z.source),X=/<%-([\s\S]+?)%>/g,Q=/<%([\s\S]+?)%>/g,J=/<%=([\s\S]+?)%>/g,$=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Z=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ie=RegExp(te.source),re=/^\s+/,se=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ne=/,? & /,de=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ce=/[()=,{}\[\]\/\s]/,le=/\\(\\)?/g,he=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ue=/\w*$/,pe=/^[-+]0x[0-9a-f]+$/i,fe=/^0b[01]+$/i,me=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ge=/^(?:0|[1-9]\d*)$/,_e=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Se=/($^)/,Ae=/['\n\r\u2028\u2029\\]/g,ye="\\ud800-\\udfff",Ce="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Ee="\\u2700-\\u27bf",be="a-z\\xdf-\\xf6\\xf8-\\xff",we="A-Z\\xc0-\\xd6\\xd8-\\xde",Re="\\ufe0e\\ufe0f",Te="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ie="["+ye+"]",Me="["+Te+"]",De="["+Ce+"]",Pe="\\d+",ke="["+Ee+"]",Oe="["+be+"]",Ve="[^"+ye+Te+Pe+Ee+be+we+"]",Ne="\\ud83c[\\udffb-\\udfff]",xe="[^"+ye+"]",Le="(?:\\ud83c[\\udde6-\\uddff]){2}",We="[\\ud800-\\udbff][\\udc00-\\udfff]",Ue="["+we+"]",Be="\\u200d",Fe="(?:"+Oe+"|"+Ve+")",He="(?:"+Ue+"|"+Ve+")",Ge="(?:['’](?:d|ll|m|re|s|t|ve))?",je="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ke="(?:"+De+"|"+Ne+")?",ze="["+Re+"]?",qe=ze+Ke+"(?:"+Be+"(?:"+[xe,Le,We].join("|")+")"+ze+Ke+")*",Ye="(?:"+[ke,Le,We].join("|")+")"+qe,Xe="(?:"+[xe+De+"?",De,Le,We,Ie].join("|")+")",Qe=RegExp("['’]","g"),Je=RegExp(De,"g"),$e=RegExp(Ne+"(?="+Ne+")|"+Xe+qe,"g"),Ze=RegExp([Ue+"?"+Oe+"+"+Ge+"(?="+[Me,Ue,"$"].join("|")+")",He+"+"+je+"(?="+[Me,Ue+Fe,"$"].join("|")+")",Ue+"?"+Fe+"+"+Ge,Ue+"+"+je,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Pe,Ye].join("|"),"g"),et=RegExp("["+Be+ye+Ce+Re+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,it=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,st={};st[O]=st[V]=st[N]=st[x]=st[L]=st[W]=st[U]=st[B]=st[F]=!0,st[m]=st[v]=st[P]=st[g]=st[k]=st[_]=st[S]=st[A]=st[C]=st[E]=st[b]=st[R]=st[T]=st[I]=st[D]=!1;var ot={};ot[m]=ot[v]=ot[P]=ot[k]=ot[g]=ot[_]=ot[O]=ot[V]=ot[N]=ot[x]=ot[L]=ot[C]=ot[E]=ot[b]=ot[R]=ot[T]=ot[I]=ot[M]=ot[W]=ot[U]=ot[B]=ot[F]=!0,ot[S]=ot[A]=ot[D]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},nt=parseFloat,dt=parseInt,ct="object"==typeof i.g&&i.g&&i.g.Object===Object&&i.g,lt="object"==typeof self&&self&&self.Object===Object&&self,ht=ct||lt||Function("return this")(),ut=t&&!t.nodeType&&t,pt=ut&&e&&!e.nodeType&&e,ft=pt&&pt.exports===ut,mt=ft&&ct.process,vt=function(){try{return pt&&pt.require&&pt.require("util").types||mt&&mt.binding&&mt.binding("util")}catch(e){}}(),gt=vt&&vt.isArrayBuffer,_t=vt&&vt.isDate,St=vt&&vt.isMap,At=vt&&vt.isRegExp,yt=vt&&vt.isSet,Ct=vt&&vt.isTypedArray;function Et(e,t,i){switch(i.length){case 0:return e.call(t);case 1:return e.call(t,i[0]);case 2:return e.call(t,i[0],i[1]);case 3:return e.call(t,i[0],i[1],i[2])}return e.apply(t,i)}function bt(e,t,i,r){for(var s=-1,o=null==e?0:e.length;++s<o;){var a=e[s];t(r,a,i(a),e)}return r}function wt(e,t){for(var i=-1,r=null==e?0:e.length;++i<r&&!1!==t(e[i],i,e););return e}function Rt(e,t){for(var i=null==e?0:e.length;i--&&!1!==t(e[i],i,e););return e}function Tt(e,t){for(var i=-1,r=null==e?0:e.length;++i<r;)if(!t(e[i],i,e))return!1;return!0}function It(e,t){for(var i=-1,r=null==e?0:e.length,s=0,o=[];++i<r;){var a=e[i];t(a,i,e)&&(o[s++]=a)}return o}function Mt(e,t){return!(null==e||!e.length)&&Ut(e,t,0)>-1}function Dt(e,t,i){for(var r=-1,s=null==e?0:e.length;++r<s;)if(i(t,e[r]))return!0;return!1}function Pt(e,t){for(var i=-1,r=null==e?0:e.length,s=Array(r);++i<r;)s[i]=t(e[i],i,e);return s}function kt(e,t){for(var i=-1,r=t.length,s=e.length;++i<r;)e[s+i]=t[i];return e}function Ot(e,t,i,r){var s=-1,o=null==e?0:e.length;for(r&&o&&(i=e[++s]);++s<o;)i=t(i,e[s],s,e);return i}function Vt(e,t,i,r){var s=null==e?0:e.length;for(r&&s&&(i=e[--s]);s--;)i=t(i,e[s],s,e);return i}function Nt(e,t){for(var i=-1,r=null==e?0:e.length;++i<r;)if(t(e[i],i,e))return!0;return!1}var xt=Gt("length");function Lt(e,t,i){var r;return i(e,(function(e,i,s){if(t(e,i,s))return r=i,!1})),r}function Wt(e,t,i,r){for(var s=e.length,o=i+(r?1:-1);r?o--:++o<s;)if(t(e[o],o,e))return o;return-1}function Ut(e,t,i){return t==t?function(e,t,i){for(var r=i-1,s=e.length;++r<s;)if(e[r]===t)return r;return-1}(e,t,i):Wt(e,Ft,i)}function Bt(e,t,i,r){for(var s=i-1,o=e.length;++s<o;)if(r(e[s],t))return s;return-1}function Ft(e){return e!=e}function Ht(e,t){var i=null==e?0:e.length;return i?zt(e,t)/i:u}function Gt(e){return function(t){return null==t?s:t[e]}}function jt(e){return function(t){return null==e?s:e[t]}}function Kt(e,t,i,r,s){return s(e,(function(e,s,o){i=r?(r=!1,e):t(i,e,s,o)})),i}function zt(e,t){for(var i,r=-1,o=e.length;++r<o;){var a=t(e[r]);a!==s&&(i=i===s?a:i+a)}return i}function qt(e,t){for(var i=-1,r=Array(e);++i<e;)r[i]=t(i);return r}function Yt(e){return e?e.slice(0,hi(e)+1).replace(re,""):e}function Xt(e){return function(t){return e(t)}}function Qt(e,t){return Pt(t,(function(t){return e[t]}))}function Jt(e,t){return e.has(t)}function $t(e,t){for(var i=-1,r=e.length;++i<r&&Ut(t,e[i],0)>-1;);return i}function Zt(e,t){for(var i=e.length;i--&&Ut(t,e[i],0)>-1;);return i}var ei=jt({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),ti=jt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function ii(e){return"\\"+at[e]}function ri(e){return et.test(e)}function si(e){var t=-1,i=Array(e.size);return e.forEach((function(e,r){i[++t]=[r,e]})),i}function oi(e,t){return function(i){return e(t(i))}}function ai(e,t){for(var i=-1,r=e.length,s=0,o=[];++i<r;){var a=e[i];a!==t&&a!==n||(e[i]=n,o[s++]=i)}return o}function ni(e){var t=-1,i=Array(e.size);return e.forEach((function(e){i[++t]=e})),i}function di(e){var t=-1,i=Array(e.size);return e.forEach((function(e){i[++t]=[e,e]})),i}function ci(e){return ri(e)?function(e){for(var t=$e.lastIndex=0;$e.test(e);)++t;return t}(e):xt(e)}function li(e){return ri(e)?function(e){return e.match($e)||[]}(e):function(e){return e.split("")}(e)}function hi(e){for(var t=e.length;t--&&se.test(e.charAt(t)););return t}var ui=jt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),pi=function e(t){var i,r=(t=null==t?ht:pi.defaults(ht.Object(),t,pi.pick(ht,it))).Array,se=t.Date,ye=t.Error,Ce=t.Function,Ee=t.Math,be=t.Object,we=t.RegExp,Re=t.String,Te=t.TypeError,Ie=r.prototype,Me=Ce.prototype,De=be.prototype,Pe=t["__core-js_shared__"],ke=Me.toString,Oe=De.hasOwnProperty,Ve=0,Ne=(i=/[^.]+$/.exec(Pe&&Pe.keys&&Pe.keys.IE_PROTO||""))?"Symbol(src)_1."+i:"",xe=De.toString,Le=ke.call(be),We=ht._,Ue=we("^"+ke.call(Oe).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=ft?t.Buffer:s,Fe=t.Symbol,He=t.Uint8Array,Ge=Be?Be.allocUnsafe:s,je=oi(be.getPrototypeOf,be),Ke=be.create,ze=De.propertyIsEnumerable,qe=Ie.splice,Ye=Fe?Fe.isConcatSpreadable:s,Xe=Fe?Fe.iterator:s,$e=Fe?Fe.toStringTag:s,et=function(){try{var e=no(be,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ht.clearTimeout&&t.clearTimeout,ct=se&&se.now!==ht.Date.now&&se.now,lt=t.setTimeout!==ht.setTimeout&&t.setTimeout,ut=Ee.ceil,pt=Ee.floor,mt=be.getOwnPropertySymbols,vt=Be?Be.isBuffer:s,xt=t.isFinite,jt=Ie.join,fi=oi(be.keys,be),mi=Ee.max,vi=Ee.min,gi=se.now,_i=t.parseInt,Si=Ee.random,Ai=Ie.reverse,yi=no(t,"DataView"),Ci=no(t,"Map"),Ei=no(t,"Promise"),bi=no(t,"Set"),wi=no(t,"WeakMap"),Ri=no(be,"create"),Ti=wi&&new wi,Ii={},Mi=xo(yi),Di=xo(Ci),Pi=xo(Ei),ki=xo(bi),Oi=xo(wi),Vi=Fe?Fe.prototype:s,Ni=Vi?Vi.valueOf:s,xi=Vi?Vi.toString:s;function Li(e){if(Za(e)&&!Ha(e)&&!(e instanceof Fi)){if(e instanceof Bi)return e;if(Oe.call(e,"__wrapped__"))return Lo(e)}return new Bi(e)}var Wi=function(){function e(){}return function(t){if(!$a(t))return{};if(Ke)return Ke(t);e.prototype=t;var i=new e;return e.prototype=s,i}}();function Ui(){}function Bi(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=s}function Fi(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=p,this.__views__=[]}function Hi(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}function Gi(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}function ji(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}function Ki(e){var t=-1,i=null==e?0:e.length;for(this.__data__=new ji;++t<i;)this.add(e[t])}function zi(e){var t=this.__data__=new Gi(e);this.size=t.size}function qi(e,t){var i=Ha(e),r=!i&&Fa(e),s=!i&&!r&&za(e),o=!i&&!r&&!s&&dn(e),a=i||r||s||o,n=a?qt(e.length,Re):[],d=n.length;for(var c in e)!t&&!Oe.call(e,c)||a&&("length"==c||s&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||mo(c,d))||n.push(c);return n}function Yi(e){var t=e.length;return t?e[jr(0,t-1)]:s}function Xi(e,t){return Po(ws(e),sr(t,0,e.length))}function Qi(e){return Po(ws(e))}function Ji(e,t,i){(i!==s&&!Wa(e[t],i)||i===s&&!(t in e))&&ir(e,t,i)}function $i(e,t,i){var r=e[t];Oe.call(e,t)&&Wa(r,i)&&(i!==s||t in e)||ir(e,t,i)}function Zi(e,t){for(var i=e.length;i--;)if(Wa(e[i][0],t))return i;return-1}function er(e,t,i,r){return cr(e,(function(e,s,o){t(r,e,i(e),o)})),r}function tr(e,t){return e&&Rs(t,Dn(t),e)}function ir(e,t,i){"__proto__"==t&&et?et(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i}function rr(e,t){for(var i=-1,o=t.length,a=r(o),n=null==e;++i<o;)a[i]=n?s:wn(e,t[i]);return a}function sr(e,t,i){return e==e&&(i!==s&&(e=e<=i?e:i),t!==s&&(e=e>=t?e:t)),e}function or(e,t,i,r,o,a){var n,d=1&t,c=2&t,l=4&t;if(i&&(n=o?i(e,r,o,a):i(e)),n!==s)return n;if(!$a(e))return e;var h=Ha(e);if(h){if(n=function(e){var t=e.length,i=new e.constructor(t);return t&&"string"==typeof e[0]&&Oe.call(e,"index")&&(i.index=e.index,i.input=e.input),i}(e),!d)return ws(e,n)}else{var u=ho(e),p=u==A||u==y;if(za(e))return Ss(e,d);if(u==b||u==m||p&&!o){if(n=c||p?{}:po(e),!d)return c?function(e,t){return Rs(e,lo(e),t)}(e,function(e,t){return e&&Rs(t,Pn(t),e)}(n,e)):function(e,t){return Rs(e,co(e),t)}(e,tr(n,e))}else{if(!ot[u])return o?e:{};n=function(e,t,i){var r,s=e.constructor;switch(t){case P:return As(e);case g:case _:return new s(+e);case k:return function(e,t){var i=t?As(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.byteLength)}(e,i);case O:case V:case N:case x:case L:case W:case U:case B:case F:return ys(e,i);case C:return new s;case E:case I:return new s(e);case R:return function(e){var t=new e.constructor(e.source,ue.exec(e));return t.lastIndex=e.lastIndex,t}(e);case T:return new s;case M:return r=e,Ni?be(Ni.call(r)):{}}}(e,u,d)}}a||(a=new zi);var f=a.get(e);if(f)return f;a.set(e,n),on(e)?e.forEach((function(r){n.add(or(r,t,i,r,e,a))})):en(e)&&e.forEach((function(r,s){n.set(s,or(r,t,i,s,e,a))}));var v=h?s:(l?c?eo:Zs:c?Pn:Dn)(e);return wt(v||e,(function(r,s){v&&(r=e[s=r]),$i(n,s,or(r,t,i,s,e,a))})),n}function ar(e,t,i){var r=i.length;if(null==e)return!r;for(e=be(e);r--;){var o=i[r],a=t[o],n=e[o];if(n===s&&!(o in e)||!a(n))return!1}return!0}function nr(e,t,i){if("function"!=typeof e)throw new Te(o);return To((function(){e.apply(s,i)}),t)}function dr(e,t,i,r){var s=-1,o=Mt,a=!0,n=e.length,d=[],c=t.length;if(!n)return d;i&&(t=Pt(t,Xt(i))),r?(o=Dt,a=!1):t.length>=200&&(o=Jt,a=!1,t=new Ki(t));e:for(;++s<n;){var l=e[s],h=null==i?l:i(l);if(l=r||0!==l?l:0,a&&h==h){for(var u=c;u--;)if(t[u]===h)continue e;d.push(l)}else o(t,h,r)||d.push(l)}return d}Li.templateSettings={escape:X,evaluate:Q,interpolate:J,variable:"",imports:{_:Li}},Li.prototype=Ui.prototype,Li.prototype.constructor=Li,Bi.prototype=Wi(Ui.prototype),Bi.prototype.constructor=Bi,Fi.prototype=Wi(Ui.prototype),Fi.prototype.constructor=Fi,Hi.prototype.clear=function(){this.__data__=Ri?Ri(null):{},this.size=0},Hi.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Hi.prototype.get=function(e){var t=this.__data__;if(Ri){var i=t[e];return i===a?s:i}return Oe.call(t,e)?t[e]:s},Hi.prototype.has=function(e){var t=this.__data__;return Ri?t[e]!==s:Oe.call(t,e)},Hi.prototype.set=function(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=Ri&&t===s?a:t,this},Gi.prototype.clear=function(){this.__data__=[],this.size=0},Gi.prototype.delete=function(e){var t=this.__data__,i=Zi(t,e);return!(i<0||(i==t.length-1?t.pop():qe.call(t,i,1),--this.size,0))},Gi.prototype.get=function(e){var t=this.__data__,i=Zi(t,e);return i<0?s:t[i][1]},Gi.prototype.has=function(e){return Zi(this.__data__,e)>-1},Gi.prototype.set=function(e,t){var i=this.__data__,r=Zi(i,e);return r<0?(++this.size,i.push([e,t])):i[r][1]=t,this},ji.prototype.clear=function(){this.size=0,this.__data__={hash:new Hi,map:new(Ci||Gi),string:new Hi}},ji.prototype.delete=function(e){var t=oo(this,e).delete(e);return this.size-=t?1:0,t},ji.prototype.get=function(e){return oo(this,e).get(e)},ji.prototype.has=function(e){return oo(this,e).has(e)},ji.prototype.set=function(e,t){var i=oo(this,e),r=i.size;return i.set(e,t),this.size+=i.size==r?0:1,this},Ki.prototype.add=Ki.prototype.push=function(e){return this.__data__.set(e,a),this},Ki.prototype.has=function(e){return this.__data__.has(e)},zi.prototype.clear=function(){this.__data__=new Gi,this.size=0},zi.prototype.delete=function(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i},zi.prototype.get=function(e){return this.__data__.get(e)},zi.prototype.has=function(e){return this.__data__.has(e)},zi.prototype.set=function(e,t){var i=this.__data__;if(i instanceof Gi){var r=i.__data__;if(!Ci||r.length<199)return r.push([e,t]),this.size=++i.size,this;i=this.__data__=new ji(r)}return i.set(e,t),this.size=i.size,this};var cr=Ms(gr),lr=Ms(_r,!0);function hr(e,t){var i=!0;return cr(e,(function(e,r,s){return i=!!t(e,r,s)})),i}function ur(e,t,i){for(var r=-1,o=e.length;++r<o;){var a=e[r],n=t(a);if(null!=n&&(d===s?n==n&&!nn(n):i(n,d)))var d=n,c=a}return c}function pr(e,t){var i=[];return cr(e,(function(e,r,s){t(e,r,s)&&i.push(e)})),i}function fr(e,t,i,r,s){var o=-1,a=e.length;for(i||(i=fo),s||(s=[]);++o<a;){var n=e[o];t>0&&i(n)?t>1?fr(n,t-1,i,r,s):kt(s,n):r||(s[s.length]=n)}return s}var mr=Ds(),vr=Ds(!0);function gr(e,t){return e&&mr(e,t,Dn)}function _r(e,t){return e&&vr(e,t,Dn)}function Sr(e,t){return It(t,(function(t){return Xa(e[t])}))}function Ar(e,t){for(var i=0,r=(t=ms(t,e)).length;null!=e&&i<r;)e=e[No(t[i++])];return i&&i==r?e:s}function yr(e,t,i){var r=t(e);return Ha(e)?r:kt(r,i(e))}function Cr(e){return null==e?e===s?"[object Undefined]":"[object Null]":$e&&$e in be(e)?function(e){var t=Oe.call(e,$e),i=e[$e];try{e[$e]=s;var r=!0}catch(e){}var o=xe.call(e);return r&&(t?e[$e]=i:delete e[$e]),o}(e):function(e){return xe.call(e)}(e)}function Er(e,t){return e>t}function br(e,t){return null!=e&&Oe.call(e,t)}function wr(e,t){return null!=e&&t in be(e)}function Rr(e,t,i){for(var o=i?Dt:Mt,a=e[0].length,n=e.length,d=n,c=r(n),l=1/0,h=[];d--;){var u=e[d];d&&t&&(u=Pt(u,Xt(t))),l=vi(u.length,l),c[d]=!i&&(t||a>=120&&u.length>=120)?new Ki(d&&u):s}u=e[0];var p=-1,f=c[0];e:for(;++p<a&&h.length<l;){var m=u[p],v=t?t(m):m;if(m=i||0!==m?m:0,!(f?Jt(f,v):o(h,v,i))){for(d=n;--d;){var g=c[d];if(!(g?Jt(g,v):o(e[d],v,i)))continue e}f&&f.push(v),h.push(m)}}return h}function Tr(e,t,i){var r=null==(e=bo(e,t=ms(t,e)))?e:e[No(Yo(t))];return null==r?s:Et(r,e,i)}function Ir(e){return Za(e)&&Cr(e)==m}function Mr(e,t,i,r,o){return e===t||(null==e||null==t||!Za(e)&&!Za(t)?e!=e&&t!=t:function(e,t,i,r,o,a){var n=Ha(e),d=Ha(t),c=n?v:ho(e),l=d?v:ho(t),h=(c=c==m?b:c)==b,u=(l=l==m?b:l)==b,p=c==l;if(p&&za(e)){if(!za(t))return!1;n=!0,h=!1}if(p&&!h)return a||(a=new zi),n||dn(e)?Js(e,t,i,r,o,a):function(e,t,i,r,s,o,a){switch(i){case k:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case P:return!(e.byteLength!=t.byteLength||!o(new He(e),new He(t)));case g:case _:case E:return Wa(+e,+t);case S:return e.name==t.name&&e.message==t.message;case R:case I:return e==t+"";case C:var n=si;case T:var d=1&r;if(n||(n=ni),e.size!=t.size&&!d)return!1;var c=a.get(e);if(c)return c==t;r|=2,a.set(e,t);var l=Js(n(e),n(t),r,s,o,a);return a.delete(e),l;case M:if(Ni)return Ni.call(e)==Ni.call(t)}return!1}(e,t,c,i,r,o,a);if(!(1&i)){var f=h&&Oe.call(e,"__wrapped__"),A=u&&Oe.call(t,"__wrapped__");if(f||A){var y=f?e.value():e,w=A?t.value():t;return a||(a=new zi),o(y,w,i,r,a)}}return!!p&&(a||(a=new zi),function(e,t,i,r,o,a){var n=1&i,d=Zs(e),c=d.length;if(c!=Zs(t).length&&!n)return!1;for(var l=c;l--;){var h=d[l];if(!(n?h in t:Oe.call(t,h)))return!1}var u=a.get(e),p=a.get(t);if(u&&p)return u==t&&p==e;var f=!0;a.set(e,t),a.set(t,e);for(var m=n;++l<c;){var v=e[h=d[l]],g=t[h];if(r)var _=n?r(g,v,h,t,e,a):r(v,g,h,e,t,a);if(!(_===s?v===g||o(v,g,i,r,a):_)){f=!1;break}m||(m="constructor"==h)}if(f&&!m){var S=e.constructor,A=t.constructor;S==A||!("constructor"in e)||!("constructor"in t)||"function"==typeof S&&S instanceof S&&"function"==typeof A&&A instanceof A||(f=!1)}return a.delete(e),a.delete(t),f}(e,t,i,r,o,a))}(e,t,i,r,Mr,o))}function Dr(e,t,i,r){var o=i.length,a=o,n=!r;if(null==e)return!a;for(e=be(e);o--;){var d=i[o];if(n&&d[2]?d[1]!==e[d[0]]:!(d[0]in e))return!1}for(;++o<a;){var c=(d=i[o])[0],l=e[c],h=d[1];if(n&&d[2]){if(l===s&&!(c in e))return!1}else{var u=new zi;if(r)var p=r(l,h,c,e,t,u);if(!(p===s?Mr(h,l,3,r,u):p))return!1}}return!0}function Pr(e){return!(!$a(e)||(t=e,Ne&&Ne in t))&&(Xa(e)?Ue:me).test(xo(e));var t}function kr(e){return"function"==typeof e?e:null==e?id:"object"==typeof e?Ha(e)?Lr(e[0],e[1]):xr(e):hd(e)}function Or(e){if(!Ao(e))return fi(e);var t=[];for(var i in be(e))Oe.call(e,i)&&"constructor"!=i&&t.push(i);return t}function Vr(e,t){return e<t}function Nr(e,t){var i=-1,s=ja(e)?r(e.length):[];return cr(e,(function(e,r,o){s[++i]=t(e,r,o)})),s}function xr(e){var t=ao(e);return 1==t.length&&t[0][2]?Co(t[0][0],t[0][1]):function(i){return i===e||Dr(i,e,t)}}function Lr(e,t){return go(e)&&yo(t)?Co(No(e),t):function(i){var r=wn(i,e);return r===s&&r===t?Rn(i,e):Mr(t,r,3)}}function Wr(e,t,i,r,o){e!==t&&mr(t,(function(a,n){if(o||(o=new zi),$a(a))!function(e,t,i,r,o,a,n){var d=wo(e,i),c=wo(t,i),l=n.get(c);if(l)Ji(e,i,l);else{var h=a?a(d,c,i+"",e,t,n):s,u=h===s;if(u){var p=Ha(c),f=!p&&za(c),m=!p&&!f&&dn(c);h=c,p||f||m?Ha(d)?h=d:Ka(d)?h=ws(d):f?(u=!1,h=Ss(c,!0)):m?(u=!1,h=ys(c,!0)):h=[]:rn(c)||Fa(c)?(h=d,Fa(d)?h=vn(d):$a(d)&&!Xa(d)||(h=po(c))):u=!1}u&&(n.set(c,h),o(h,c,r,a,n),n.delete(c)),Ji(e,i,h)}}(e,t,n,i,Wr,r,o);else{var d=r?r(wo(e,n),a,n+"",e,t,o):s;d===s&&(d=a),Ji(e,n,d)}}),Pn)}function Ur(e,t){var i=e.length;if(i)return mo(t+=t<0?i:0,i)?e[t]:s}function Br(e,t,i){t=t.length?Pt(t,(function(e){return Ha(e)?function(t){return Ar(t,1===e.length?e[0]:e)}:e})):[id];var r=-1;t=Pt(t,Xt(so()));var s=Nr(e,(function(e,i,s){var o=Pt(t,(function(t){return t(e)}));return{criteria:o,index:++r,value:e}}));return function(e){var t=e.length;for(e.sort((function(e,t){return function(e,t,i){for(var r=-1,s=e.criteria,o=t.criteria,a=s.length,n=i.length;++r<a;){var d=Cs(s[r],o[r]);if(d)return r>=n?d:d*("desc"==i[r]?-1:1)}return e.index-t.index}(e,t,i)}));t--;)e[t]=e[t].value;return e}(s)}function Fr(e,t,i){for(var r=-1,s=t.length,o={};++r<s;){var a=t[r],n=Ar(e,a);i(n,a)&&Xr(o,ms(a,e),n)}return o}function Hr(e,t,i,r){var s=r?Bt:Ut,o=-1,a=t.length,n=e;for(e===t&&(t=ws(t)),i&&(n=Pt(e,Xt(i)));++o<a;)for(var d=0,c=t[o],l=i?i(c):c;(d=s(n,l,d,r))>-1;)n!==e&&qe.call(n,d,1),qe.call(e,d,1);return e}function Gr(e,t){for(var i=e?t.length:0,r=i-1;i--;){var s=t[i];if(i==r||s!==o){var o=s;mo(s)?qe.call(e,s,1):ns(e,s)}}return e}function jr(e,t){return e+pt(Si()*(t-e+1))}function Kr(e,t){var i="";if(!e||t<1||t>h)return i;do{t%2&&(i+=e),(t=pt(t/2))&&(e+=e)}while(t);return i}function zr(e,t){return Io(Eo(e,t,id),e+"")}function qr(e){return Yi(Un(e))}function Yr(e,t){var i=Un(e);return Po(i,sr(t,0,i.length))}function Xr(e,t,i,r){if(!$a(e))return e;for(var o=-1,a=(t=ms(t,e)).length,n=a-1,d=e;null!=d&&++o<a;){var c=No(t[o]),l=i;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(o!=n){var h=d[c];(l=r?r(h,c,d):s)===s&&(l=$a(h)?h:mo(t[o+1])?[]:{})}$i(d,c,l),d=d[c]}return e}var Qr=Ti?function(e,t){return Ti.set(e,t),e}:id,Jr=et?function(e,t){return et(e,"toString",{configurable:!0,enumerable:!1,value:Zn(t),writable:!0})}:id;function $r(e){return Po(Un(e))}function Zr(e,t,i){var s=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(i=i>o?o:i)<0&&(i+=o),o=t>i?0:i-t>>>0,t>>>=0;for(var a=r(o);++s<o;)a[s]=e[s+t];return a}function es(e,t){var i;return cr(e,(function(e,r,s){return!(i=t(e,r,s))})),!!i}function ts(e,t,i){var r=0,s=null==e?r:e.length;if("number"==typeof t&&t==t&&s<=2147483647){for(;r<s;){var o=r+s>>>1,a=e[o];null!==a&&!nn(a)&&(i?a<=t:a<t)?r=o+1:s=o}return s}return is(e,t,id,i)}function is(e,t,i,r){var o=0,a=null==e?0:e.length;if(0===a)return 0;for(var n=(t=i(t))!=t,d=null===t,c=nn(t),l=t===s;o<a;){var h=pt((o+a)/2),u=i(e[h]),p=u!==s,f=null===u,m=u==u,v=nn(u);if(n)var g=r||m;else g=l?m&&(r||p):d?m&&p&&(r||!f):c?m&&p&&!f&&(r||!v):!f&&!v&&(r?u<=t:u<t);g?o=h+1:a=h}return vi(a,4294967294)}function rs(e,t){for(var i=-1,r=e.length,s=0,o=[];++i<r;){var a=e[i],n=t?t(a):a;if(!i||!Wa(n,d)){var d=n;o[s++]=0===a?0:a}}return o}function ss(e){return"number"==typeof e?e:nn(e)?u:+e}function os(e){if("string"==typeof e)return e;if(Ha(e))return Pt(e,os)+"";if(nn(e))return xi?xi.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function as(e,t,i){var r=-1,s=Mt,o=e.length,a=!0,n=[],d=n;if(i)a=!1,s=Dt;else if(o>=200){var c=t?null:Ks(e);if(c)return ni(c);a=!1,s=Jt,d=new Ki}else d=t?[]:n;e:for(;++r<o;){var l=e[r],h=t?t(l):l;if(l=i||0!==l?l:0,a&&h==h){for(var u=d.length;u--;)if(d[u]===h)continue e;t&&d.push(h),n.push(l)}else s(d,h,i)||(d!==n&&d.push(h),n.push(l))}return n}function ns(e,t){return null==(e=bo(e,t=ms(t,e)))||delete e[No(Yo(t))]}function ds(e,t,i,r){return Xr(e,t,i(Ar(e,t)),r)}function cs(e,t,i,r){for(var s=e.length,o=r?s:-1;(r?o--:++o<s)&&t(e[o],o,e););return i?Zr(e,r?0:o,r?o+1:s):Zr(e,r?o+1:0,r?s:o)}function ls(e,t){var i=e;return i instanceof Fi&&(i=i.value()),Ot(t,(function(e,t){return t.func.apply(t.thisArg,kt([e],t.args))}),i)}function hs(e,t,i){var s=e.length;if(s<2)return s?as(e[0]):[];for(var o=-1,a=r(s);++o<s;)for(var n=e[o],d=-1;++d<s;)d!=o&&(a[o]=dr(a[o]||n,e[d],t,i));return as(fr(a,1),t,i)}function us(e,t,i){for(var r=-1,o=e.length,a=t.length,n={};++r<o;){var d=r<a?t[r]:s;i(n,e[r],d)}return n}function ps(e){return Ka(e)?e:[]}function fs(e){return"function"==typeof e?e:id}function ms(e,t){return Ha(e)?e:go(e,t)?[e]:Vo(gn(e))}var vs=zr;function gs(e,t,i){var r=e.length;return i=i===s?r:i,!t&&i>=r?e:Zr(e,t,i)}var _s=at||function(e){return ht.clearTimeout(e)};function Ss(e,t){if(t)return e.slice();var i=e.length,r=Ge?Ge(i):new e.constructor(i);return e.copy(r),r}function As(e){var t=new e.constructor(e.byteLength);return new He(t).set(new He(e)),t}function ys(e,t){var i=t?As(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}function Cs(e,t){if(e!==t){var i=e!==s,r=null===e,o=e==e,a=nn(e),n=t!==s,d=null===t,c=t==t,l=nn(t);if(!d&&!l&&!a&&e>t||a&&n&&c&&!d&&!l||r&&n&&c||!i&&c||!o)return 1;if(!r&&!a&&!l&&e<t||l&&i&&o&&!r&&!a||d&&i&&o||!n&&o||!c)return-1}return 0}function Es(e,t,i,s){for(var o=-1,a=e.length,n=i.length,d=-1,c=t.length,l=mi(a-n,0),h=r(c+l),u=!s;++d<c;)h[d]=t[d];for(;++o<n;)(u||o<a)&&(h[i[o]]=e[o]);for(;l--;)h[d++]=e[o++];return h}function bs(e,t,i,s){for(var o=-1,a=e.length,n=-1,d=i.length,c=-1,l=t.length,h=mi(a-d,0),u=r(h+l),p=!s;++o<h;)u[o]=e[o];for(var f=o;++c<l;)u[f+c]=t[c];for(;++n<d;)(p||o<a)&&(u[f+i[n]]=e[o++]);return u}function ws(e,t){var i=-1,s=e.length;for(t||(t=r(s));++i<s;)t[i]=e[i];return t}function Rs(e,t,i,r){var o=!i;i||(i={});for(var a=-1,n=t.length;++a<n;){var d=t[a],c=r?r(i[d],e[d],d,i,e):s;c===s&&(c=e[d]),o?ir(i,d,c):$i(i,d,c)}return i}function Ts(e,t){return function(i,r){var s=Ha(i)?bt:er,o=t?t():{};return s(i,e,so(r,2),o)}}function Is(e){return zr((function(t,i){var r=-1,o=i.length,a=o>1?i[o-1]:s,n=o>2?i[2]:s;for(a=e.length>3&&"function"==typeof a?(o--,a):s,n&&vo(i[0],i[1],n)&&(a=o<3?s:a,o=1),t=be(t);++r<o;){var d=i[r];d&&e(t,d,r,a)}return t}))}function Ms(e,t){return function(i,r){if(null==i)return i;if(!ja(i))return e(i,r);for(var s=i.length,o=t?s:-1,a=be(i);(t?o--:++o<s)&&!1!==r(a[o],o,a););return i}}function Ds(e){return function(t,i,r){for(var s=-1,o=be(t),a=r(t),n=a.length;n--;){var d=a[e?n:++s];if(!1===i(o[d],d,o))break}return t}}function Ps(e){return function(t){var i=ri(t=gn(t))?li(t):s,r=i?i[0]:t.charAt(0),o=i?gs(i,1).join(""):t.slice(1);return r[e]()+o}}function ks(e){return function(t){return Ot(Qn(Hn(t).replace(Qe,"")),e,"")}}function Os(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var i=Wi(e.prototype),r=e.apply(i,t);return $a(r)?r:i}}function Vs(e){return function(t,i,r){var o=be(t);if(!ja(t)){var a=so(i,3);t=Dn(t),i=function(e){return a(o[e],e,o)}}var n=e(t,i,r);return n>-1?o[a?t[n]:n]:s}}function Ns(e){return $s((function(t){var i=t.length,r=i,a=Bi.prototype.thru;for(e&&t.reverse();r--;){var n=t[r];if("function"!=typeof n)throw new Te(o);if(a&&!d&&"wrapper"==io(n))var d=new Bi([],!0)}for(r=d?r:i;++r<i;){var c=io(n=t[r]),l="wrapper"==c?to(n):s;d=l&&_o(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?d[io(l[0])].apply(d,l[3]):1==n.length&&_o(n)?d[c]():d.thru(n)}return function(){var e=arguments,r=e[0];if(d&&1==e.length&&Ha(r))return d.plant(r).value();for(var s=0,o=i?t[s].apply(this,e):r;++s<i;)o=t[s].call(this,o);return o}}))}function xs(e,t,i,o,a,n,d,l,h,u){var p=t&c,f=1&t,m=2&t,v=24&t,g=512&t,_=m?s:Os(e);return function c(){for(var S=arguments.length,A=r(S),y=S;y--;)A[y]=arguments[y];if(v)var C=ro(c),E=function(e,t){for(var i=e.length,r=0;i--;)e[i]===t&&++r;return r}(A,C);if(o&&(A=Es(A,o,a,v)),n&&(A=bs(A,n,d,v)),S-=E,v&&S<u){var b=ai(A,C);return Gs(e,t,xs,c.placeholder,i,A,b,l,h,u-S)}var w=f?i:this,R=m?w[e]:e;return S=A.length,l?A=function(e,t){for(var i=e.length,r=vi(t.length,i),o=ws(e);r--;){var a=t[r];e[r]=mo(a,i)?o[a]:s}return e}(A,l):g&&S>1&&A.reverse(),p&&h<S&&(A.length=h),this&&this!==ht&&this instanceof c&&(R=_||Os(R)),R.apply(w,A)}}function Ls(e,t){return function(i,r){return function(e,t,i,r){return gr(e,(function(e,s,o){t(r,i(e),s,o)})),r}(i,e,t(r),{})}}function Ws(e,t){return function(i,r){var o;if(i===s&&r===s)return t;if(i!==s&&(o=i),r!==s){if(o===s)return r;"string"==typeof i||"string"==typeof r?(i=os(i),r=os(r)):(i=ss(i),r=ss(r)),o=e(i,r)}return o}}function Us(e){return $s((function(t){return t=Pt(t,Xt(so())),zr((function(i){var r=this;return e(t,(function(e){return Et(e,r,i)}))}))}))}function Bs(e,t){var i=(t=t===s?" ":os(t)).length;if(i<2)return i?Kr(t,e):t;var r=Kr(t,ut(e/ci(t)));return ri(t)?gs(li(r),0,e).join(""):r.slice(0,e)}function Fs(e){return function(t,i,o){return o&&"number"!=typeof o&&vo(t,i,o)&&(i=o=s),t=un(t),i===s?(i=t,t=0):i=un(i),function(e,t,i,s){for(var o=-1,a=mi(ut((t-e)/(i||1)),0),n=r(a);a--;)n[s?a:++o]=e,e+=i;return n}(t,i,o=o===s?t<i?1:-1:un(o),e)}}function Hs(e){return function(t,i){return"string"==typeof t&&"string"==typeof i||(t=mn(t),i=mn(i)),e(t,i)}}function Gs(e,t,i,r,o,a,n,c,l,h){var u=8&t;t|=u?d:64,4&(t&=~(u?64:d))||(t&=-4);var p=[e,t,o,u?a:s,u?n:s,u?s:a,u?s:n,c,l,h],f=i.apply(s,p);return _o(e)&&Ro(f,p),f.placeholder=r,Mo(f,e,t)}function js(e){var t=Ee[e];return function(e,i){if(e=mn(e),(i=null==i?0:vi(pn(i),292))&&xt(e)){var r=(gn(e)+"e").split("e");return+((r=(gn(t(r[0]+"e"+(+r[1]+i)))+"e").split("e"))[0]+"e"+(+r[1]-i))}return t(e)}}var Ks=bi&&1/ni(new bi([,-0]))[1]==l?function(e){return new bi(e)}:nd;function zs(e){return function(t){var i=ho(t);return i==C?si(t):i==T?di(t):function(e,t){return Pt(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function qs(e,t,i,a,l,h,u,p){var f=2&t;if(!f&&"function"!=typeof e)throw new Te(o);var m=a?a.length:0;if(m||(t&=-97,a=l=s),u=u===s?u:mi(pn(u),0),p=p===s?p:pn(p),m-=l?l.length:0,64&t){var v=a,g=l;a=l=s}var _=f?s:to(e),S=[e,t,i,a,l,v,g,h,u,p];if(_&&function(e,t){var i=e[1],r=t[1],s=i|r,o=s<131,a=r==c&&8==i||r==c&&256==i&&e[7].length<=t[8]||384==r&&t[7].length<=t[8]&&8==i;if(!o&&!a)return e;1&r&&(e[2]=t[2],s|=1&i?0:4);var d=t[3];if(d){var l=e[3];e[3]=l?Es(l,d,t[4]):d,e[4]=l?ai(e[3],n):t[4]}(d=t[5])&&(l=e[5],e[5]=l?bs(l,d,t[6]):d,e[6]=l?ai(e[5],n):t[6]),(d=t[7])&&(e[7]=d),r&c&&(e[8]=null==e[8]?t[8]:vi(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=s}(S,_),e=S[0],t=S[1],i=S[2],a=S[3],l=S[4],!(p=S[9]=S[9]===s?f?0:e.length:mi(S[9]-m,0))&&24&t&&(t&=-25),t&&1!=t)A=8==t||16==t?function(e,t,i){var o=Os(e);return function a(){for(var n=arguments.length,d=r(n),c=n,l=ro(a);c--;)d[c]=arguments[c];var h=n<3&&d[0]!==l&&d[n-1]!==l?[]:ai(d,l);return(n-=h.length)<i?Gs(e,t,xs,a.placeholder,s,d,h,s,s,i-n):Et(this&&this!==ht&&this instanceof a?o:e,this,d)}}(e,t,p):t!=d&&33!=t||l.length?xs.apply(s,S):function(e,t,i,s){var o=1&t,a=Os(e);return function t(){for(var n=-1,d=arguments.length,c=-1,l=s.length,h=r(l+d),u=this&&this!==ht&&this instanceof t?a:e;++c<l;)h[c]=s[c];for(;d--;)h[c++]=arguments[++n];return Et(u,o?i:this,h)}}(e,t,i,a);else var A=function(e,t,i){var r=1&t,s=Os(e);return function t(){return(this&&this!==ht&&this instanceof t?s:e).apply(r?i:this,arguments)}}(e,t,i);return Mo((_?Qr:Ro)(A,S),e,t)}function Ys(e,t,i,r){return e===s||Wa(e,De[i])&&!Oe.call(r,i)?t:e}function Xs(e,t,i,r,o,a){return $a(e)&&$a(t)&&(a.set(t,e),Wr(e,t,s,Xs,a),a.delete(t)),e}function Qs(e){return rn(e)?s:e}function Js(e,t,i,r,o,a){var n=1&i,d=e.length,c=t.length;if(d!=c&&!(n&&c>d))return!1;var l=a.get(e),h=a.get(t);if(l&&h)return l==t&&h==e;var u=-1,p=!0,f=2&i?new Ki:s;for(a.set(e,t),a.set(t,e);++u<d;){var m=e[u],v=t[u];if(r)var g=n?r(v,m,u,t,e,a):r(m,v,u,e,t,a);if(g!==s){if(g)continue;p=!1;break}if(f){if(!Nt(t,(function(e,t){if(!Jt(f,t)&&(m===e||o(m,e,i,r,a)))return f.push(t)}))){p=!1;break}}else if(m!==v&&!o(m,v,i,r,a)){p=!1;break}}return a.delete(e),a.delete(t),p}function $s(e){return Io(Eo(e,s,Go),e+"")}function Zs(e){return yr(e,Dn,co)}function eo(e){return yr(e,Pn,lo)}var to=Ti?function(e){return Ti.get(e)}:nd;function io(e){for(var t=e.name+"",i=Ii[t],r=Oe.call(Ii,t)?i.length:0;r--;){var s=i[r],o=s.func;if(null==o||o==e)return s.name}return t}function ro(e){return(Oe.call(Li,"placeholder")?Li:e).placeholder}function so(){var e=Li.iteratee||rd;return e=e===rd?kr:e,arguments.length?e(arguments[0],arguments[1]):e}function oo(e,t){var i,r,s=e.__data__;return("string"==(r=typeof(i=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==i:null===i)?s["string"==typeof t?"string":"hash"]:s.map}function ao(e){for(var t=Dn(e),i=t.length;i--;){var r=t[i],s=e[r];t[i]=[r,s,yo(s)]}return t}function no(e,t){var i=function(e,t){return null==e?s:e[t]}(e,t);return Pr(i)?i:s}var co=mt?function(e){return null==e?[]:(e=be(e),It(mt(e),(function(t){return ze.call(e,t)})))}:fd,lo=mt?function(e){for(var t=[];e;)kt(t,co(e)),e=je(e);return t}:fd,ho=Cr;function uo(e,t,i){for(var r=-1,s=(t=ms(t,e)).length,o=!1;++r<s;){var a=No(t[r]);if(!(o=null!=e&&i(e,a)))break;e=e[a]}return o||++r!=s?o:!!(s=null==e?0:e.length)&&Ja(s)&&mo(a,s)&&(Ha(e)||Fa(e))}function po(e){return"function"!=typeof e.constructor||Ao(e)?{}:Wi(je(e))}function fo(e){return Ha(e)||Fa(e)||!!(Ye&&e&&e[Ye])}function mo(e,t){var i=typeof e;return!!(t=null==t?h:t)&&("number"==i||"symbol"!=i&&ge.test(e))&&e>-1&&e%1==0&&e<t}function vo(e,t,i){if(!$a(i))return!1;var r=typeof t;return!!("number"==r?ja(i)&&mo(t,i.length):"string"==r&&t in i)&&Wa(i[t],e)}function go(e,t){if(Ha(e))return!1;var i=typeof e;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=e&&!nn(e))||Z.test(e)||!$.test(e)||null!=t&&e in be(t)}function _o(e){var t=io(e),i=Li[t];if("function"!=typeof i||!(t in Fi.prototype))return!1;if(e===i)return!0;var r=to(i);return!!r&&e===r[0]}(yi&&ho(new yi(new ArrayBuffer(1)))!=k||Ci&&ho(new Ci)!=C||Ei&&ho(Ei.resolve())!=w||bi&&ho(new bi)!=T||wi&&ho(new wi)!=D)&&(ho=function(e){var t=Cr(e),i=t==b?e.constructor:s,r=i?xo(i):"";if(r)switch(r){case Mi:return k;case Di:return C;case Pi:return w;case ki:return T;case Oi:return D}return t});var So=Pe?Xa:md;function Ao(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||De)}function yo(e){return e==e&&!$a(e)}function Co(e,t){return function(i){return null!=i&&i[e]===t&&(t!==s||e in be(i))}}function Eo(e,t,i){return t=mi(t===s?e.length-1:t,0),function(){for(var s=arguments,o=-1,a=mi(s.length-t,0),n=r(a);++o<a;)n[o]=s[t+o];o=-1;for(var d=r(t+1);++o<t;)d[o]=s[o];return d[t]=i(n),Et(e,this,d)}}function bo(e,t){return t.length<2?e:Ar(e,Zr(t,0,-1))}function wo(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Ro=Do(Qr),To=lt||function(e,t){return ht.setTimeout(e,t)},Io=Do(Jr);function Mo(e,t,i){var r=t+"";return Io(e,function(e,t){var i=t.length;if(!i)return e;var r=i-1;return t[r]=(i>1?"& ":"")+t[r],t=t.join(i>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return wt(f,(function(i){var r="_."+i[0];t&i[1]&&!Mt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ne):[]}(r),i)))}function Do(e){var t=0,i=0;return function(){var r=gi(),o=16-(r-i);if(i=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(s,arguments)}}function Po(e,t){var i=-1,r=e.length,o=r-1;for(t=t===s?r:t;++i<t;){var a=jr(i,o),n=e[a];e[a]=e[i],e[i]=n}return e.length=t,e}var ko,Oo,Vo=(ko=ka((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(ee,(function(e,i,r,s){t.push(r?s.replace(le,"$1"):i||e)})),t}),(function(e){return 500===Oo.size&&Oo.clear(),e})),Oo=ko.cache,ko);function No(e){if("string"==typeof e||nn(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function xo(e){if(null!=e){try{return ke.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Lo(e){if(e instanceof Fi)return e.clone();var t=new Bi(e.__wrapped__,e.__chain__);return t.__actions__=ws(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Wo=zr((function(e,t){return Ka(e)?dr(e,fr(t,1,Ka,!0)):[]})),Uo=zr((function(e,t){var i=Yo(t);return Ka(i)&&(i=s),Ka(e)?dr(e,fr(t,1,Ka,!0),so(i,2)):[]})),Bo=zr((function(e,t){var i=Yo(t);return Ka(i)&&(i=s),Ka(e)?dr(e,fr(t,1,Ka,!0),s,i):[]}));function Fo(e,t,i){var r=null==e?0:e.length;if(!r)return-1;var s=null==i?0:pn(i);return s<0&&(s=mi(r+s,0)),Wt(e,so(t,3),s)}function Ho(e,t,i){var r=null==e?0:e.length;if(!r)return-1;var o=r-1;return i!==s&&(o=pn(i),o=i<0?mi(r+o,0):vi(o,r-1)),Wt(e,so(t,3),o,!0)}function Go(e){return null!=e&&e.length?fr(e,1):[]}function jo(e){return e&&e.length?e[0]:s}var Ko=zr((function(e){var t=Pt(e,ps);return t.length&&t[0]===e[0]?Rr(t):[]})),zo=zr((function(e){var t=Yo(e),i=Pt(e,ps);return t===Yo(i)?t=s:i.pop(),i.length&&i[0]===e[0]?Rr(i,so(t,2)):[]})),qo=zr((function(e){var t=Yo(e),i=Pt(e,ps);return(t="function"==typeof t?t:s)&&i.pop(),i.length&&i[0]===e[0]?Rr(i,s,t):[]}));function Yo(e){var t=null==e?0:e.length;return t?e[t-1]:s}var Xo=zr(Qo);function Qo(e,t){return e&&e.length&&t&&t.length?Hr(e,t):e}var Jo=$s((function(e,t){var i=null==e?0:e.length,r=rr(e,t);return Gr(e,Pt(t,(function(e){return mo(e,i)?+e:e})).sort(Cs)),r}));function $o(e){return null==e?e:Ai.call(e)}var Zo=zr((function(e){return as(fr(e,1,Ka,!0))})),ea=zr((function(e){var t=Yo(e);return Ka(t)&&(t=s),as(fr(e,1,Ka,!0),so(t,2))})),ta=zr((function(e){var t=Yo(e);return t="function"==typeof t?t:s,as(fr(e,1,Ka,!0),s,t)}));function ia(e){if(!e||!e.length)return[];var t=0;return e=It(e,(function(e){if(Ka(e))return t=mi(e.length,t),!0})),qt(t,(function(t){return Pt(e,Gt(t))}))}function ra(e,t){if(!e||!e.length)return[];var i=ia(e);return null==t?i:Pt(i,(function(e){return Et(t,s,e)}))}var sa=zr((function(e,t){return Ka(e)?dr(e,t):[]})),oa=zr((function(e){return hs(It(e,Ka))})),aa=zr((function(e){var t=Yo(e);return Ka(t)&&(t=s),hs(It(e,Ka),so(t,2))})),na=zr((function(e){var t=Yo(e);return t="function"==typeof t?t:s,hs(It(e,Ka),s,t)})),da=zr(ia),ca=zr((function(e){var t=e.length,i=t>1?e[t-1]:s;return i="function"==typeof i?(e.pop(),i):s,ra(e,i)}));function la(e){var t=Li(e);return t.__chain__=!0,t}function ha(e,t){return t(e)}var ua=$s((function(e){var t=e.length,i=t?e[0]:0,r=this.__wrapped__,o=function(t){return rr(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Fi&&mo(i)?((r=r.slice(i,+i+(t?1:0))).__actions__.push({func:ha,args:[o],thisArg:s}),new Bi(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(s),e}))):this.thru(o)})),pa=Ts((function(e,t,i){Oe.call(e,i)?++e[i]:ir(e,i,1)})),fa=Vs(Fo),ma=Vs(Ho);function va(e,t){return(Ha(e)?wt:cr)(e,so(t,3))}function ga(e,t){return(Ha(e)?Rt:lr)(e,so(t,3))}var _a=Ts((function(e,t,i){Oe.call(e,i)?e[i].push(t):ir(e,i,[t])})),Sa=zr((function(e,t,i){var s=-1,o="function"==typeof t,a=ja(e)?r(e.length):[];return cr(e,(function(e){a[++s]=o?Et(t,e,i):Tr(e,t,i)})),a})),Aa=Ts((function(e,t,i){ir(e,i,t)}));function ya(e,t){return(Ha(e)?Pt:Nr)(e,so(t,3))}var Ca=Ts((function(e,t,i){e[i?0:1].push(t)}),(function(){return[[],[]]})),Ea=zr((function(e,t){if(null==e)return[];var i=t.length;return i>1&&vo(e,t[0],t[1])?t=[]:i>2&&vo(t[0],t[1],t[2])&&(t=[t[0]]),Br(e,fr(t,1),[])})),ba=ct||function(){return ht.Date.now()};function wa(e,t,i){return t=i?s:t,t=e&&null==t?e.length:t,qs(e,c,s,s,s,s,t)}function Ra(e,t){var i;if("function"!=typeof t)throw new Te(o);return e=pn(e),function(){return--e>0&&(i=t.apply(this,arguments)),e<=1&&(t=s),i}}var Ta=zr((function(e,t,i){var r=1;if(i.length){var s=ai(i,ro(Ta));r|=d}return qs(e,r,t,i,s)})),Ia=zr((function(e,t,i){var r=3;if(i.length){var s=ai(i,ro(Ia));r|=d}return qs(t,r,e,i,s)}));function Ma(e,t,i){var r,a,n,d,c,l,h=0,u=!1,p=!1,f=!0;if("function"!=typeof e)throw new Te(o);function m(t){var i=r,o=a;return r=a=s,h=t,d=e.apply(o,i)}function v(e){var i=e-l;return l===s||i>=t||i<0||p&&e-h>=n}function g(){var e=ba();if(v(e))return _(e);c=To(g,function(e){var i=t-(e-l);return p?vi(i,n-(e-h)):i}(e))}function _(e){return c=s,f&&r?m(e):(r=a=s,d)}function S(){var e=ba(),i=v(e);if(r=arguments,a=this,l=e,i){if(c===s)return function(e){return h=e,c=To(g,t),u?m(e):d}(l);if(p)return _s(c),c=To(g,t),m(l)}return c===s&&(c=To(g,t)),d}return t=mn(t)||0,$a(i)&&(u=!!i.leading,n=(p="maxWait"in i)?mi(mn(i.maxWait)||0,t):n,f="trailing"in i?!!i.trailing:f),S.cancel=function(){c!==s&&_s(c),h=0,r=l=a=c=s},S.flush=function(){return c===s?d:_(ba())},S}var Da=zr((function(e,t){return nr(e,1,t)})),Pa=zr((function(e,t,i){return nr(e,mn(t)||0,i)}));function ka(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Te(o);var i=function(){var r=arguments,s=t?t.apply(this,r):r[0],o=i.cache;if(o.has(s))return o.get(s);var a=e.apply(this,r);return i.cache=o.set(s,a)||o,a};return i.cache=new(ka.Cache||ji),i}function Oa(e){if("function"!=typeof e)throw new Te(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}ka.Cache=ji;var Va=vs((function(e,t){var i=(t=1==t.length&&Ha(t[0])?Pt(t[0],Xt(so())):Pt(fr(t,1),Xt(so()))).length;return zr((function(r){for(var s=-1,o=vi(r.length,i);++s<o;)r[s]=t[s].call(this,r[s]);return Et(e,this,r)}))})),Na=zr((function(e,t){var i=ai(t,ro(Na));return qs(e,d,s,t,i)})),xa=zr((function(e,t){var i=ai(t,ro(xa));return qs(e,64,s,t,i)})),La=$s((function(e,t){return qs(e,256,s,s,s,t)}));function Wa(e,t){return e===t||e!=e&&t!=t}var Ua=Hs(Er),Ba=Hs((function(e,t){return e>=t})),Fa=Ir(function(){return arguments}())?Ir:function(e){return Za(e)&&Oe.call(e,"callee")&&!ze.call(e,"callee")},Ha=r.isArray,Ga=gt?Xt(gt):function(e){return Za(e)&&Cr(e)==P};function ja(e){return null!=e&&Ja(e.length)&&!Xa(e)}function Ka(e){return Za(e)&&ja(e)}var za=vt||md,qa=_t?Xt(_t):function(e){return Za(e)&&Cr(e)==_};function Ya(e){if(!Za(e))return!1;var t=Cr(e);return t==S||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!rn(e)}function Xa(e){if(!$a(e))return!1;var t=Cr(e);return t==A||t==y||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Qa(e){return"number"==typeof e&&e==pn(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=h}function $a(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Za(e){return null!=e&&"object"==typeof e}var en=St?Xt(St):function(e){return Za(e)&&ho(e)==C};function tn(e){return"number"==typeof e||Za(e)&&Cr(e)==E}function rn(e){if(!Za(e)||Cr(e)!=b)return!1;var t=je(e);if(null===t)return!0;var i=Oe.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i instanceof i&&ke.call(i)==Le}var sn=At?Xt(At):function(e){return Za(e)&&Cr(e)==R},on=yt?Xt(yt):function(e){return Za(e)&&ho(e)==T};function an(e){return"string"==typeof e||!Ha(e)&&Za(e)&&Cr(e)==I}function nn(e){return"symbol"==typeof e||Za(e)&&Cr(e)==M}var dn=Ct?Xt(Ct):function(e){return Za(e)&&Ja(e.length)&&!!st[Cr(e)]},cn=Hs(Vr),ln=Hs((function(e,t){return e<=t}));function hn(e){if(!e)return[];if(ja(e))return an(e)?li(e):ws(e);if(Xe&&e[Xe])return function(e){for(var t,i=[];!(t=e.next()).done;)i.push(t.value);return i}(e[Xe]());var t=ho(e);return(t==C?si:t==T?ni:Un)(e)}function un(e){return e?(e=mn(e))===l||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function pn(e){var t=un(e),i=t%1;return t==t?i?t-i:t:0}function fn(e){return e?sr(pn(e),0,p):0}function mn(e){if("number"==typeof e)return e;if(nn(e))return u;if($a(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=$a(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Yt(e);var i=fe.test(e);return i||ve.test(e)?dt(e.slice(2),i?2:8):pe.test(e)?u:+e}function vn(e){return Rs(e,Pn(e))}function gn(e){return null==e?"":os(e)}var _n=Is((function(e,t){if(Ao(t)||ja(t))Rs(t,Dn(t),e);else for(var i in t)Oe.call(t,i)&&$i(e,i,t[i])})),Sn=Is((function(e,t){Rs(t,Pn(t),e)})),An=Is((function(e,t,i,r){Rs(t,Pn(t),e,r)})),yn=Is((function(e,t,i,r){Rs(t,Dn(t),e,r)})),Cn=$s(rr),En=zr((function(e,t){e=be(e);var i=-1,r=t.length,o=r>2?t[2]:s;for(o&&vo(t[0],t[1],o)&&(r=1);++i<r;)for(var a=t[i],n=Pn(a),d=-1,c=n.length;++d<c;){var l=n[d],h=e[l];(h===s||Wa(h,De[l])&&!Oe.call(e,l))&&(e[l]=a[l])}return e})),bn=zr((function(e){return e.push(s,Xs),Et(On,s,e)}));function wn(e,t,i){var r=null==e?s:Ar(e,t);return r===s?i:r}function Rn(e,t){return null!=e&&uo(e,t,wr)}var Tn=Ls((function(e,t,i){null!=t&&"function"!=typeof t.toString&&(t=xe.call(t)),e[t]=i}),Zn(id)),In=Ls((function(e,t,i){null!=t&&"function"!=typeof t.toString&&(t=xe.call(t)),Oe.call(e,t)?e[t].push(i):e[t]=[i]}),so),Mn=zr(Tr);function Dn(e){return ja(e)?qi(e):Or(e)}function Pn(e){return ja(e)?qi(e,!0):function(e){if(!$a(e))return function(e){var t=[];if(null!=e)for(var i in be(e))t.push(i);return t}(e);var t=Ao(e),i=[];for(var r in e)("constructor"!=r||!t&&Oe.call(e,r))&&i.push(r);return i}(e)}var kn=Is((function(e,t,i){Wr(e,t,i)})),On=Is((function(e,t,i,r){Wr(e,t,i,r)})),Vn=$s((function(e,t){var i={};if(null==e)return i;var r=!1;t=Pt(t,(function(t){return t=ms(t,e),r||(r=t.length>1),t})),Rs(e,eo(e),i),r&&(i=or(i,7,Qs));for(var s=t.length;s--;)ns(i,t[s]);return i})),Nn=$s((function(e,t){return null==e?{}:function(e,t){return Fr(e,t,(function(t,i){return Rn(e,i)}))}(e,t)}));function xn(e,t){if(null==e)return{};var i=Pt(eo(e),(function(e){return[e]}));return t=so(t),Fr(e,i,(function(e,i){return t(e,i[0])}))}var Ln=zs(Dn),Wn=zs(Pn);function Un(e){return null==e?[]:Qt(e,Dn(e))}var Bn=ks((function(e,t,i){return t=t.toLowerCase(),e+(i?Fn(t):t)}));function Fn(e){return Xn(gn(e).toLowerCase())}function Hn(e){return(e=gn(e))&&e.replace(_e,ei).replace(Je,"")}var Gn=ks((function(e,t,i){return e+(i?"-":"")+t.toLowerCase()})),jn=ks((function(e,t,i){return e+(i?" ":"")+t.toLowerCase()})),Kn=Ps("toLowerCase"),zn=ks((function(e,t,i){return e+(i?"_":"")+t.toLowerCase()})),qn=ks((function(e,t,i){return e+(i?" ":"")+Xn(t)})),Yn=ks((function(e,t,i){return e+(i?" ":"")+t.toUpperCase()})),Xn=Ps("toUpperCase");function Qn(e,t,i){return e=gn(e),(t=i?s:t)===s?function(e){return tt.test(e)}(e)?function(e){return e.match(Ze)||[]}(e):function(e){return e.match(de)||[]}(e):e.match(t)||[]}var Jn=zr((function(e,t){try{return Et(e,s,t)}catch(e){return Ya(e)?e:new ye(e)}})),$n=$s((function(e,t){return wt(t,(function(t){t=No(t),ir(e,t,Ta(e[t],e))})),e}));function Zn(e){return function(){return e}}var ed=Ns(),td=Ns(!0);function id(e){return e}function rd(e){return kr("function"==typeof e?e:or(e,1))}var sd=zr((function(e,t){return function(i){return Tr(i,e,t)}})),od=zr((function(e,t){return function(i){return Tr(e,i,t)}}));function ad(e,t,i){var r=Dn(t),s=Sr(t,r);null!=i||$a(t)&&(s.length||!r.length)||(i=t,t=e,e=this,s=Sr(t,Dn(t)));var o=!($a(i)&&"chain"in i&&!i.chain),a=Xa(e);return wt(s,(function(i){var r=t[i];e[i]=r,a&&(e.prototype[i]=function(){var t=this.__chain__;if(o||t){var i=e(this.__wrapped__);return(i.__actions__=ws(this.__actions__)).push({func:r,args:arguments,thisArg:e}),i.__chain__=t,i}return r.apply(e,kt([this.value()],arguments))})})),e}function nd(){}var dd=Us(Pt),cd=Us(Tt),ld=Us(Nt);function hd(e){return go(e)?Gt(No(e)):function(e){return function(t){return Ar(t,e)}}(e)}var ud=Fs(),pd=Fs(!0);function fd(){return[]}function md(){return!1}var vd,gd=Ws((function(e,t){return e+t}),0),_d=js("ceil"),Sd=Ws((function(e,t){return e/t}),1),Ad=js("floor"),yd=Ws((function(e,t){return e*t}),1),Cd=js("round"),Ed=Ws((function(e,t){return e-t}),0);return Li.after=function(e,t){if("function"!=typeof t)throw new Te(o);return e=pn(e),function(){if(--e<1)return t.apply(this,arguments)}},Li.ary=wa,Li.assign=_n,Li.assignIn=Sn,Li.assignInWith=An,Li.assignWith=yn,Li.at=Cn,Li.before=Ra,Li.bind=Ta,Li.bindAll=$n,Li.bindKey=Ia,Li.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Ha(e)?e:[e]},Li.chain=la,Li.chunk=function(e,t,i){t=(i?vo(e,t,i):t===s)?1:mi(pn(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,n=0,d=r(ut(o/t));a<o;)d[n++]=Zr(e,a,a+=t);return d},Li.compact=function(e){for(var t=-1,i=null==e?0:e.length,r=0,s=[];++t<i;){var o=e[t];o&&(s[r++]=o)}return s},Li.concat=function(){var e=arguments.length;if(!e)return[];for(var t=r(e-1),i=arguments[0],s=e;s--;)t[s-1]=arguments[s];return kt(Ha(i)?ws(i):[i],fr(t,1))},Li.cond=function(e){var t=null==e?0:e.length,i=so();return e=t?Pt(e,(function(e){if("function"!=typeof e[1])throw new Te(o);return[i(e[0]),e[1]]})):[],zr((function(i){for(var r=-1;++r<t;){var s=e[r];if(Et(s[0],this,i))return Et(s[1],this,i)}}))},Li.conforms=function(e){return function(e){var t=Dn(e);return function(i){return ar(i,e,t)}}(or(e,1))},Li.constant=Zn,Li.countBy=pa,Li.create=function(e,t){var i=Wi(e);return null==t?i:tr(i,t)},Li.curry=function e(t,i,r){var o=qs(t,8,s,s,s,s,s,i=r?s:i);return o.placeholder=e.placeholder,o},Li.curryRight=function e(t,i,r){var o=qs(t,16,s,s,s,s,s,i=r?s:i);return o.placeholder=e.placeholder,o},Li.debounce=Ma,Li.defaults=En,Li.defaultsDeep=bn,Li.defer=Da,Li.delay=Pa,Li.difference=Wo,Li.differenceBy=Uo,Li.differenceWith=Bo,Li.drop=function(e,t,i){var r=null==e?0:e.length;return r?Zr(e,(t=i||t===s?1:pn(t))<0?0:t,r):[]},Li.dropRight=function(e,t,i){var r=null==e?0:e.length;return r?Zr(e,0,(t=r-(t=i||t===s?1:pn(t)))<0?0:t):[]},Li.dropRightWhile=function(e,t){return e&&e.length?cs(e,so(t,3),!0,!0):[]},Li.dropWhile=function(e,t){return e&&e.length?cs(e,so(t,3),!0):[]},Li.fill=function(e,t,i,r){var o=null==e?0:e.length;return o?(i&&"number"!=typeof i&&vo(e,t,i)&&(i=0,r=o),function(e,t,i,r){var o=e.length;for((i=pn(i))<0&&(i=-i>o?0:o+i),(r=r===s||r>o?o:pn(r))<0&&(r+=o),r=i>r?0:fn(r);i<r;)e[i++]=t;return e}(e,t,i,r)):[]},Li.filter=function(e,t){return(Ha(e)?It:pr)(e,so(t,3))},Li.flatMap=function(e,t){return fr(ya(e,t),1)},Li.flatMapDeep=function(e,t){return fr(ya(e,t),l)},Li.flatMapDepth=function(e,t,i){return i=i===s?1:pn(i),fr(ya(e,t),i)},Li.flatten=Go,Li.flattenDeep=function(e){return null!=e&&e.length?fr(e,l):[]},Li.flattenDepth=function(e,t){return null!=e&&e.length?fr(e,t=t===s?1:pn(t)):[]},Li.flip=function(e){return qs(e,512)},Li.flow=ed,Li.flowRight=td,Li.fromPairs=function(e){for(var t=-1,i=null==e?0:e.length,r={};++t<i;){var s=e[t];r[s[0]]=s[1]}return r},Li.functions=function(e){return null==e?[]:Sr(e,Dn(e))},Li.functionsIn=function(e){return null==e?[]:Sr(e,Pn(e))},Li.groupBy=_a,Li.initial=function(e){return null!=e&&e.length?Zr(e,0,-1):[]},Li.intersection=Ko,Li.intersectionBy=zo,Li.intersectionWith=qo,Li.invert=Tn,Li.invertBy=In,Li.invokeMap=Sa,Li.iteratee=rd,Li.keyBy=Aa,Li.keys=Dn,Li.keysIn=Pn,Li.map=ya,Li.mapKeys=function(e,t){var i={};return t=so(t,3),gr(e,(function(e,r,s){ir(i,t(e,r,s),e)})),i},Li.mapValues=function(e,t){var i={};return t=so(t,3),gr(e,(function(e,r,s){ir(i,r,t(e,r,s))})),i},Li.matches=function(e){return xr(or(e,1))},Li.matchesProperty=function(e,t){return Lr(e,or(t,1))},Li.memoize=ka,Li.merge=kn,Li.mergeWith=On,Li.method=sd,Li.methodOf=od,Li.mixin=ad,Li.negate=Oa,Li.nthArg=function(e){return e=pn(e),zr((function(t){return Ur(t,e)}))},Li.omit=Vn,Li.omitBy=function(e,t){return xn(e,Oa(so(t)))},Li.once=function(e){return Ra(2,e)},Li.orderBy=function(e,t,i,r){return null==e?[]:(Ha(t)||(t=null==t?[]:[t]),Ha(i=r?s:i)||(i=null==i?[]:[i]),Br(e,t,i))},Li.over=dd,Li.overArgs=Va,Li.overEvery=cd,Li.overSome=ld,Li.partial=Na,Li.partialRight=xa,Li.partition=Ca,Li.pick=Nn,Li.pickBy=xn,Li.property=hd,Li.propertyOf=function(e){return function(t){return null==e?s:Ar(e,t)}},Li.pull=Xo,Li.pullAll=Qo,Li.pullAllBy=function(e,t,i){return e&&e.length&&t&&t.length?Hr(e,t,so(i,2)):e},Li.pullAllWith=function(e,t,i){return e&&e.length&&t&&t.length?Hr(e,t,s,i):e},Li.pullAt=Jo,Li.range=ud,Li.rangeRight=pd,Li.rearg=La,Li.reject=function(e,t){return(Ha(e)?It:pr)(e,Oa(so(t,3)))},Li.remove=function(e,t){var i=[];if(!e||!e.length)return i;var r=-1,s=[],o=e.length;for(t=so(t,3);++r<o;){var a=e[r];t(a,r,e)&&(i.push(a),s.push(r))}return Gr(e,s),i},Li.rest=function(e,t){if("function"!=typeof e)throw new Te(o);return zr(e,t=t===s?t:pn(t))},Li.reverse=$o,Li.sampleSize=function(e,t,i){return t=(i?vo(e,t,i):t===s)?1:pn(t),(Ha(e)?Xi:Yr)(e,t)},Li.set=function(e,t,i){return null==e?e:Xr(e,t,i)},Li.setWith=function(e,t,i,r){return r="function"==typeof r?r:s,null==e?e:Xr(e,t,i,r)},Li.shuffle=function(e){return(Ha(e)?Qi:$r)(e)},Li.slice=function(e,t,i){var r=null==e?0:e.length;return r?(i&&"number"!=typeof i&&vo(e,t,i)?(t=0,i=r):(t=null==t?0:pn(t),i=i===s?r:pn(i)),Zr(e,t,i)):[]},Li.sortBy=Ea,Li.sortedUniq=function(e){return e&&e.length?rs(e):[]},Li.sortedUniqBy=function(e,t){return e&&e.length?rs(e,so(t,2)):[]},Li.split=function(e,t,i){return i&&"number"!=typeof i&&vo(e,t,i)&&(t=i=s),(i=i===s?p:i>>>0)?(e=gn(e))&&("string"==typeof t||null!=t&&!sn(t))&&!(t=os(t))&&ri(e)?gs(li(e),0,i):e.split(t,i):[]},Li.spread=function(e,t){if("function"!=typeof e)throw new Te(o);return t=null==t?0:mi(pn(t),0),zr((function(i){var r=i[t],s=gs(i,0,t);return r&&kt(s,r),Et(e,this,s)}))},Li.tail=function(e){var t=null==e?0:e.length;return t?Zr(e,1,t):[]},Li.take=function(e,t,i){return e&&e.length?Zr(e,0,(t=i||t===s?1:pn(t))<0?0:t):[]},Li.takeRight=function(e,t,i){var r=null==e?0:e.length;return r?Zr(e,(t=r-(t=i||t===s?1:pn(t)))<0?0:t,r):[]},Li.takeRightWhile=function(e,t){return e&&e.length?cs(e,so(t,3),!1,!0):[]},Li.takeWhile=function(e,t){return e&&e.length?cs(e,so(t,3)):[]},Li.tap=function(e,t){return t(e),e},Li.throttle=function(e,t,i){var r=!0,s=!0;if("function"!=typeof e)throw new Te(o);return $a(i)&&(r="leading"in i?!!i.leading:r,s="trailing"in i?!!i.trailing:s),Ma(e,t,{leading:r,maxWait:t,trailing:s})},Li.thru=ha,Li.toArray=hn,Li.toPairs=Ln,Li.toPairsIn=Wn,Li.toPath=function(e){return Ha(e)?Pt(e,No):nn(e)?[e]:ws(Vo(gn(e)))},Li.toPlainObject=vn,Li.transform=function(e,t,i){var r=Ha(e),s=r||za(e)||dn(e);if(t=so(t,4),null==i){var o=e&&e.constructor;i=s?r?new o:[]:$a(e)&&Xa(o)?Wi(je(e)):{}}return(s?wt:gr)(e,(function(e,r,s){return t(i,e,r,s)})),i},Li.unary=function(e){return wa(e,1)},Li.union=Zo,Li.unionBy=ea,Li.unionWith=ta,Li.uniq=function(e){return e&&e.length?as(e):[]},Li.uniqBy=function(e,t){return e&&e.length?as(e,so(t,2)):[]},Li.uniqWith=function(e,t){return t="function"==typeof t?t:s,e&&e.length?as(e,s,t):[]},Li.unset=function(e,t){return null==e||ns(e,t)},Li.unzip=ia,Li.unzipWith=ra,Li.update=function(e,t,i){return null==e?e:ds(e,t,fs(i))},Li.updateWith=function(e,t,i,r){return r="function"==typeof r?r:s,null==e?e:ds(e,t,fs(i),r)},Li.values=Un,Li.valuesIn=function(e){return null==e?[]:Qt(e,Pn(e))},Li.without=sa,Li.words=Qn,Li.wrap=function(e,t){return Na(fs(t),e)},Li.xor=oa,Li.xorBy=aa,Li.xorWith=na,Li.zip=da,Li.zipObject=function(e,t){return us(e||[],t||[],$i)},Li.zipObjectDeep=function(e,t){return us(e||[],t||[],Xr)},Li.zipWith=ca,Li.entries=Ln,Li.entriesIn=Wn,Li.extend=Sn,Li.extendWith=An,ad(Li,Li),Li.add=gd,Li.attempt=Jn,Li.camelCase=Bn,Li.capitalize=Fn,Li.ceil=_d,Li.clamp=function(e,t,i){return i===s&&(i=t,t=s),i!==s&&(i=(i=mn(i))==i?i:0),t!==s&&(t=(t=mn(t))==t?t:0),sr(mn(e),t,i)},Li.clone=function(e){return or(e,4)},Li.cloneDeep=function(e){return or(e,5)},Li.cloneDeepWith=function(e,t){return or(e,5,t="function"==typeof t?t:s)},Li.cloneWith=function(e,t){return or(e,4,t="function"==typeof t?t:s)},Li.conformsTo=function(e,t){return null==t||ar(e,t,Dn(t))},Li.deburr=Hn,Li.defaultTo=function(e,t){return null==e||e!=e?t:e},Li.divide=Sd,Li.endsWith=function(e,t,i){e=gn(e),t=os(t);var r=e.length,o=i=i===s?r:sr(pn(i),0,r);return(i-=t.length)>=0&&e.slice(i,o)==t},Li.eq=Wa,Li.escape=function(e){return(e=gn(e))&&Y.test(e)?e.replace(z,ti):e},Li.escapeRegExp=function(e){return(e=gn(e))&&ie.test(e)?e.replace(te,"\\$&"):e},Li.every=function(e,t,i){var r=Ha(e)?Tt:hr;return i&&vo(e,t,i)&&(t=s),r(e,so(t,3))},Li.find=fa,Li.findIndex=Fo,Li.findKey=function(e,t){return Lt(e,so(t,3),gr)},Li.findLast=ma,Li.findLastIndex=Ho,Li.findLastKey=function(e,t){return Lt(e,so(t,3),_r)},Li.floor=Ad,Li.forEach=va,Li.forEachRight=ga,Li.forIn=function(e,t){return null==e?e:mr(e,so(t,3),Pn)},Li.forInRight=function(e,t){return null==e?e:vr(e,so(t,3),Pn)},Li.forOwn=function(e,t){return e&&gr(e,so(t,3))},Li.forOwnRight=function(e,t){return e&&_r(e,so(t,3))},Li.get=wn,Li.gt=Ua,Li.gte=Ba,Li.has=function(e,t){return null!=e&&uo(e,t,br)},Li.hasIn=Rn,Li.head=jo,Li.identity=id,Li.includes=function(e,t,i,r){e=ja(e)?e:Un(e),i=i&&!r?pn(i):0;var s=e.length;return i<0&&(i=mi(s+i,0)),an(e)?i<=s&&e.indexOf(t,i)>-1:!!s&&Ut(e,t,i)>-1},Li.indexOf=function(e,t,i){var r=null==e?0:e.length;if(!r)return-1;var s=null==i?0:pn(i);return s<0&&(s=mi(r+s,0)),Ut(e,t,s)},Li.inRange=function(e,t,i){return t=un(t),i===s?(i=t,t=0):i=un(i),function(e,t,i){return e>=vi(t,i)&&e<mi(t,i)}(e=mn(e),t,i)},Li.invoke=Mn,Li.isArguments=Fa,Li.isArray=Ha,Li.isArrayBuffer=Ga,Li.isArrayLike=ja,Li.isArrayLikeObject=Ka,Li.isBoolean=function(e){return!0===e||!1===e||Za(e)&&Cr(e)==g},Li.isBuffer=za,Li.isDate=qa,Li.isElement=function(e){return Za(e)&&1===e.nodeType&&!rn(e)},Li.isEmpty=function(e){if(null==e)return!0;if(ja(e)&&(Ha(e)||"string"==typeof e||"function"==typeof e.splice||za(e)||dn(e)||Fa(e)))return!e.length;var t=ho(e);if(t==C||t==T)return!e.size;if(Ao(e))return!Or(e).length;for(var i in e)if(Oe.call(e,i))return!1;return!0},Li.isEqual=function(e,t){return Mr(e,t)},Li.isEqualWith=function(e,t,i){var r=(i="function"==typeof i?i:s)?i(e,t):s;return r===s?Mr(e,t,s,i):!!r},Li.isError=Ya,Li.isFinite=function(e){return"number"==typeof e&&xt(e)},Li.isFunction=Xa,Li.isInteger=Qa,Li.isLength=Ja,Li.isMap=en,Li.isMatch=function(e,t){return e===t||Dr(e,t,ao(t))},Li.isMatchWith=function(e,t,i){return i="function"==typeof i?i:s,Dr(e,t,ao(t),i)},Li.isNaN=function(e){return tn(e)&&e!=+e},Li.isNative=function(e){if(So(e))throw new ye("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Pr(e)},Li.isNil=function(e){return null==e},Li.isNull=function(e){return null===e},Li.isNumber=tn,Li.isObject=$a,Li.isObjectLike=Za,Li.isPlainObject=rn,Li.isRegExp=sn,Li.isSafeInteger=function(e){return Qa(e)&&e>=-9007199254740991&&e<=h},Li.isSet=on,Li.isString=an,Li.isSymbol=nn,Li.isTypedArray=dn,Li.isUndefined=function(e){return e===s},Li.isWeakMap=function(e){return Za(e)&&ho(e)==D},Li.isWeakSet=function(e){return Za(e)&&"[object WeakSet]"==Cr(e)},Li.join=function(e,t){return null==e?"":jt.call(e,t)},Li.kebabCase=Gn,Li.last=Yo,Li.lastIndexOf=function(e,t,i){var r=null==e?0:e.length;if(!r)return-1;var o=r;return i!==s&&(o=(o=pn(i))<0?mi(r+o,0):vi(o,r-1)),t==t?function(e,t,i){for(var r=i+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Wt(e,Ft,o,!0)},Li.lowerCase=jn,Li.lowerFirst=Kn,Li.lt=cn,Li.lte=ln,Li.max=function(e){return e&&e.length?ur(e,id,Er):s},Li.maxBy=function(e,t){return e&&e.length?ur(e,so(t,2),Er):s},Li.mean=function(e){return Ht(e,id)},Li.meanBy=function(e,t){return Ht(e,so(t,2))},Li.min=function(e){return e&&e.length?ur(e,id,Vr):s},Li.minBy=function(e,t){return e&&e.length?ur(e,so(t,2),Vr):s},Li.stubArray=fd,Li.stubFalse=md,Li.stubObject=function(){return{}},Li.stubString=function(){return""},Li.stubTrue=function(){return!0},Li.multiply=yd,Li.nth=function(e,t){return e&&e.length?Ur(e,pn(t)):s},Li.noConflict=function(){return ht._===this&&(ht._=We),this},Li.noop=nd,Li.now=ba,Li.pad=function(e,t,i){e=gn(e);var r=(t=pn(t))?ci(e):0;if(!t||r>=t)return e;var s=(t-r)/2;return Bs(pt(s),i)+e+Bs(ut(s),i)},Li.padEnd=function(e,t,i){e=gn(e);var r=(t=pn(t))?ci(e):0;return t&&r<t?e+Bs(t-r,i):e},Li.padStart=function(e,t,i){e=gn(e);var r=(t=pn(t))?ci(e):0;return t&&r<t?Bs(t-r,i)+e:e},Li.parseInt=function(e,t,i){return i||null==t?t=0:t&&(t=+t),_i(gn(e).replace(re,""),t||0)},Li.random=function(e,t,i){if(i&&"boolean"!=typeof i&&vo(e,t,i)&&(t=i=s),i===s&&("boolean"==typeof t?(i=t,t=s):"boolean"==typeof e&&(i=e,e=s)),e===s&&t===s?(e=0,t=1):(e=un(e),t===s?(t=e,e=0):t=un(t)),e>t){var r=e;e=t,t=r}if(i||e%1||t%1){var o=Si();return vi(e+o*(t-e+nt("1e-"+((o+"").length-1))),t)}return jr(e,t)},Li.reduce=function(e,t,i){var r=Ha(e)?Ot:Kt,s=arguments.length<3;return r(e,so(t,4),i,s,cr)},Li.reduceRight=function(e,t,i){var r=Ha(e)?Vt:Kt,s=arguments.length<3;return r(e,so(t,4),i,s,lr)},Li.repeat=function(e,t,i){return t=(i?vo(e,t,i):t===s)?1:pn(t),Kr(gn(e),t)},Li.replace=function(){var e=arguments,t=gn(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Li.result=function(e,t,i){var r=-1,o=(t=ms(t,e)).length;for(o||(o=1,e=s);++r<o;){var a=null==e?s:e[No(t[r])];a===s&&(r=o,a=i),e=Xa(a)?a.call(e):a}return e},Li.round=Cd,Li.runInContext=e,Li.sample=function(e){return(Ha(e)?Yi:qr)(e)},Li.size=function(e){if(null==e)return 0;if(ja(e))return an(e)?ci(e):e.length;var t=ho(e);return t==C||t==T?e.size:Or(e).length},Li.snakeCase=zn,Li.some=function(e,t,i){var r=Ha(e)?Nt:es;return i&&vo(e,t,i)&&(t=s),r(e,so(t,3))},Li.sortedIndex=function(e,t){return ts(e,t)},Li.sortedIndexBy=function(e,t,i){return is(e,t,so(i,2))},Li.sortedIndexOf=function(e,t){var i=null==e?0:e.length;if(i){var r=ts(e,t);if(r<i&&Wa(e[r],t))return r}return-1},Li.sortedLastIndex=function(e,t){return ts(e,t,!0)},Li.sortedLastIndexBy=function(e,t,i){return is(e,t,so(i,2),!0)},Li.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var i=ts(e,t,!0)-1;if(Wa(e[i],t))return i}return-1},Li.startCase=qn,Li.startsWith=function(e,t,i){return e=gn(e),i=null==i?0:sr(pn(i),0,e.length),t=os(t),e.slice(i,i+t.length)==t},Li.subtract=Ed,Li.sum=function(e){return e&&e.length?zt(e,id):0},Li.sumBy=function(e,t){return e&&e.length?zt(e,so(t,2)):0},Li.template=function(e,t,i){var r=Li.templateSettings;i&&vo(e,t,i)&&(t=s),e=gn(e),t=An({},t,r,Ys);var o,a,n=An({},t.imports,r.imports,Ys),d=Dn(n),c=Qt(n,d),l=0,h=t.interpolate||Se,u="__p += '",p=we((t.escape||Se).source+"|"+h.source+"|"+(h===J?he:Se).source+"|"+(t.evaluate||Se).source+"|$","g"),f="//# sourceURL="+(Oe.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++rt+"]")+"\n";e.replace(p,(function(t,i,r,s,n,d){return r||(r=s),u+=e.slice(l,d).replace(Ae,ii),i&&(o=!0,u+="' +\n__e("+i+") +\n'"),n&&(a=!0,u+="';\n"+n+";\n__p += '"),r&&(u+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=d+t.length,t})),u+="';\n";var m=Oe.call(t,"variable")&&t.variable;if(m){if(ce.test(m))throw new ye("Invalid `variable` option passed into `_.template`")}else u="with (obj) {\n"+u+"\n}\n";u=(a?u.replace(H,""):u).replace(G,"$1").replace(j,"$1;"),u="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+u+"return __p\n}";var v=Jn((function(){return Ce(d,f+"return "+u).apply(s,c)}));if(v.source=u,Ya(v))throw v;return v},Li.times=function(e,t){if((e=pn(e))<1||e>h)return[];var i=p,r=vi(e,p);t=so(t),e-=p;for(var s=qt(r,t);++i<e;)t(i);return s},Li.toFinite=un,Li.toInteger=pn,Li.toLength=fn,Li.toLower=function(e){return gn(e).toLowerCase()},Li.toNumber=mn,Li.toSafeInteger=function(e){return e?sr(pn(e),-9007199254740991,h):0===e?e:0},Li.toString=gn,Li.toUpper=function(e){return gn(e).toUpperCase()},Li.trim=function(e,t,i){if((e=gn(e))&&(i||t===s))return Yt(e);if(!e||!(t=os(t)))return e;var r=li(e),o=li(t);return gs(r,$t(r,o),Zt(r,o)+1).join("")},Li.trimEnd=function(e,t,i){if((e=gn(e))&&(i||t===s))return e.slice(0,hi(e)+1);if(!e||!(t=os(t)))return e;var r=li(e);return gs(r,0,Zt(r,li(t))+1).join("")},Li.trimStart=function(e,t,i){if((e=gn(e))&&(i||t===s))return e.replace(re,"");if(!e||!(t=os(t)))return e;var r=li(e);return gs(r,$t(r,li(t))).join("")},Li.truncate=function(e,t){var i=30,r="...";if($a(t)){var o="separator"in t?t.separator:o;i="length"in t?pn(t.length):i,r="omission"in t?os(t.omission):r}var a=(e=gn(e)).length;if(ri(e)){var n=li(e);a=n.length}if(i>=a)return e;var d=i-ci(r);if(d<1)return r;var c=n?gs(n,0,d).join(""):e.slice(0,d);if(o===s)return c+r;if(n&&(d+=c.length-d),sn(o)){if(e.slice(d).search(o)){var l,h=c;for(o.global||(o=we(o.source,gn(ue.exec(o))+"g")),o.lastIndex=0;l=o.exec(h);)var u=l.index;c=c.slice(0,u===s?d:u)}}else if(e.indexOf(os(o),d)!=d){var p=c.lastIndexOf(o);p>-1&&(c=c.slice(0,p))}return c+r},Li.unescape=function(e){return(e=gn(e))&&q.test(e)?e.replace(K,ui):e},Li.uniqueId=function(e){var t=++Ve;return gn(e)+t},Li.upperCase=Yn,Li.upperFirst=Xn,Li.each=va,Li.eachRight=ga,Li.first=jo,ad(Li,(vd={},gr(Li,(function(e,t){Oe.call(Li.prototype,t)||(vd[t]=e)})),vd),{chain:!1}),Li.VERSION="4.17.21",wt(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Li[e].placeholder=Li})),wt(["drop","take"],(function(e,t){Fi.prototype[e]=function(i){i=i===s?1:mi(pn(i),0);var r=this.__filtered__&&!t?new Fi(this):this.clone();return r.__filtered__?r.__takeCount__=vi(i,r.__takeCount__):r.__views__.push({size:vi(i,p),type:e+(r.__dir__<0?"Right":"")}),r},Fi.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),wt(["filter","map","takeWhile"],(function(e,t){var i=t+1,r=1==i||3==i;Fi.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:so(e,3),type:i}),t.__filtered__=t.__filtered__||r,t}})),wt(["head","last"],(function(e,t){var i="take"+(t?"Right":"");Fi.prototype[e]=function(){return this[i](1).value()[0]}})),wt(["initial","tail"],(function(e,t){var i="drop"+(t?"":"Right");Fi.prototype[e]=function(){return this.__filtered__?new Fi(this):this[i](1)}})),Fi.prototype.compact=function(){return this.filter(id)},Fi.prototype.find=function(e){return this.filter(e).head()},Fi.prototype.findLast=function(e){return this.reverse().find(e)},Fi.prototype.invokeMap=zr((function(e,t){return"function"==typeof e?new Fi(this):this.map((function(i){return Tr(i,e,t)}))})),Fi.prototype.reject=function(e){return this.filter(Oa(so(e)))},Fi.prototype.slice=function(e,t){e=pn(e);var i=this;return i.__filtered__&&(e>0||t<0)?new Fi(i):(e<0?i=i.takeRight(-e):e&&(i=i.drop(e)),t!==s&&(i=(t=pn(t))<0?i.dropRight(-t):i.take(t-e)),i)},Fi.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Fi.prototype.toArray=function(){return this.take(p)},gr(Fi.prototype,(function(e,t){var i=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Li[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Li.prototype[t]=function(){var t=this.__wrapped__,n=r?[1]:arguments,d=t instanceof Fi,c=n[0],l=d||Ha(t),h=function(e){var t=o.apply(Li,kt([e],n));return r&&u?t[0]:t};l&&i&&"function"==typeof c&&1!=c.length&&(d=l=!1);var u=this.__chain__,p=!!this.__actions__.length,f=a&&!u,m=d&&!p;if(!a&&l){t=m?t:new Fi(this);var v=e.apply(t,n);return v.__actions__.push({func:ha,args:[h],thisArg:s}),new Bi(v,u)}return f&&m?e.apply(this,n):(v=this.thru(h),f?r?v.value()[0]:v.value():v)})})),wt(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ie[e],i=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Li.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var s=this.value();return t.apply(Ha(s)?s:[],e)}return this[i]((function(i){return t.apply(Ha(i)?i:[],e)}))}})),gr(Fi.prototype,(function(e,t){var i=Li[t];if(i){var r=i.name+"";Oe.call(Ii,r)||(Ii[r]=[]),Ii[r].push({name:t,func:i})}})),Ii[xs(s,2).name]=[{name:"wrapper",func:s}],Fi.prototype.clone=function(){var e=new Fi(this.__wrapped__);return e.__actions__=ws(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=ws(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=ws(this.__views__),e},Fi.prototype.reverse=function(){if(this.__filtered__){var e=new Fi(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Fi.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,i=Ha(e),r=t<0,s=i?e.length:0,o=function(e,t,i){for(var r=-1,s=i.length;++r<s;){var o=i[r],a=o.size;switch(o.type){case"drop":e+=a;break;case"dropRight":t-=a;break;case"take":t=vi(t,e+a);break;case"takeRight":e=mi(e,t-a)}}return{start:e,end:t}}(0,s,this.__views__),a=o.start,n=o.end,d=n-a,c=r?n:a-1,l=this.__iteratees__,h=l.length,u=0,p=vi(d,this.__takeCount__);if(!i||!r&&s==d&&p==d)return ls(e,this.__actions__);var f=[];e:for(;d--&&u<p;){for(var m=-1,v=e[c+=t];++m<h;){var g=l[m],_=g.iteratee,S=g.type,A=_(v);if(2==S)v=A;else if(!A){if(1==S)continue e;break e}}f[u++]=v}return f},Li.prototype.at=ua,Li.prototype.chain=function(){return la(this)},Li.prototype.commit=function(){return new Bi(this.value(),this.__chain__)},Li.prototype.next=function(){this.__values__===s&&(this.__values__=hn(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?s:this.__values__[this.__index__++]}},Li.prototype.plant=function(e){for(var t,i=this;i instanceof Ui;){var r=Lo(i);r.__index__=0,r.__values__=s,t?o.__wrapped__=r:t=r;var o=r;i=i.__wrapped__}return o.__wrapped__=e,t},Li.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Fi){var t=e;return this.__actions__.length&&(t=new Fi(this)),(t=t.reverse()).__actions__.push({func:ha,args:[$o],thisArg:s}),new Bi(t,this.__chain__)}return this.thru($o)},Li.prototype.toJSON=Li.prototype.valueOf=Li.prototype.value=function(){return ls(this.__wrapped__,this.__actions__)},Li.prototype.first=Li.prototype.head,Xe&&(Li.prototype[Xe]=function(){return this}),Li}();ht._=pi,(r=function(){return pi}.call(t,i,t,e))===s||(e.exports=r)}.call(this)},124:(e,t,i)=>{var r=i(9325);e.exports=function(){return r.Date.now()}},9935:e=>{e.exports=function(){return!1}},7350:(e,t,i)=>{var r=i(8221),s=i(3805);e.exports=function(e,t,i){var o=!0,a=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return s(i)&&(o="leading"in i?!!i.leading:o,a="trailing"in i?!!i.trailing:a),r(e,t,{leading:o,maxWait:t,trailing:a})}},9374:(e,t,i)=>{var r=i(4128),s=i(3805),o=i(4394),a=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,d=/^0o[0-7]+$/i,c=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(o(e))return NaN;if(s(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=s(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var i=n.test(e);return i||d.test(e)?c(e.slice(2),i?2:8):a.test(e)?NaN:+e}},3224:function(e,t,i){e=i.nmd(e),function(i){"use strict";var r={};i.PubSub?(r=i.PubSub,console.warn("PubSub already loaded, using existing version")):(i.PubSub=r,function(e){var t={},i=-1;function r(e,t,i){try{e(t,i)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function s(e,t,i){e(t,i)}function o(e,i,o,a){var n,d=t[i],c=a?s:r;if(Object.prototype.hasOwnProperty.call(t,i))for(n in d)Object.prototype.hasOwnProperty.call(d,n)&&c(d[n],e,o)}function a(e){var i=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,i)&&function(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}(t[i]))}function n(e,t,i,r){var s=function(e,t,i){return function(){var r=String(e),s=r.lastIndexOf(".");for(o(e,e,t,i);-1!==s;)s=(r=r.substr(0,s)).lastIndexOf("."),o(e,r,t,i);o(e,"*",t,i)}}(e="symbol"==typeof e?e.toString():e,t,r);return!!function(e){for(var t=String(e),i=a(t)||a("*"),r=t.lastIndexOf(".");!i&&-1!==r;)r=(t=t.substr(0,r)).lastIndexOf("."),i=a(t);return i}(e)&&(!0===i?s():setTimeout(s,0),!0)}e.publish=function(t,i){return n(t,i,!1,e.immediateExceptions)},e.publishSync=function(t,i){return n(t,i,!0,e.immediateExceptions)},e.subscribe=function(e,r){if("function"!=typeof r)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var s="uid_"+String(++i);return t[e][s]=r,s},e.subscribeAll=function(t){return e.subscribe("*",t)},e.subscribeOnce=function(t,i){var r=e.subscribe(t,(function(){e.unsubscribe(r),i.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var i;for(i in t)Object.prototype.hasOwnProperty.call(t,i)&&0===i.indexOf(e)&&delete t[i]},e.countSubscriptions=function(e){var i,r,s=0;for(i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&0===i.indexOf(e)){for(r in t[i])s++;break}return s},e.getSubscriptions=function(e){var i,r=[];for(i in t)Object.prototype.hasOwnProperty.call(t,i)&&0===i.indexOf(e)&&r.push(i);return r},e.unsubscribe=function(i){var r,s,o,a="string"==typeof i&&(Object.prototype.hasOwnProperty.call(t,i)||function(e){var i;for(i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&0===i.indexOf(e))return!0;return!1}(i)),n=!a&&"string"==typeof i,d="function"==typeof i,c=!1;if(!a){for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(s=t[r],n&&s[i]){delete s[i],c=i;break}if(d)for(o in s)Object.prototype.hasOwnProperty.call(s,o)&&s[o]===i&&(delete s[o],c=!0)}return c}e.clearSubscriptions(i)}}(r)),void 0!==e&&e.exports&&(t=e.exports=r),t.PubSub=r,e.exports=t=r}("object"==typeof window&&window||this||i.g)},31:(e,t)=>{!function(e){var t,i,r,s=String.fromCharCode;function o(e){for(var t,i,r=[],s=0,o=e.length;s<o;)(t=e.charCodeAt(s++))>=55296&&t<=56319&&s<o?56320==(64512&(i=e.charCodeAt(s++)))?r.push(((1023&t)<<10)+(1023&i)+65536):(r.push(t),s--):r.push(t);return r}function a(e){if(e>=55296&&e<=57343)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value")}function n(e,t){return s(e>>t&63|128)}function d(e){if(!(4294967168&e))return s(e);var t="";return 4294965248&e?4294901760&e?4292870144&e||(t=s(e>>18&7|240),t+=n(e,12),t+=n(e,6)):(a(e),t=s(e>>12&15|224),t+=n(e,6)):t=s(e>>6&31|192),t+s(63&e|128)}function c(){if(r>=i)throw Error("Invalid byte index");var e=255&t[r];if(r++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function l(){var e,s;if(r>i)throw Error("Invalid byte index");if(r==i)return!1;if(e=255&t[r],r++,!(128&e))return e;if(192==(224&e)){if((s=(31&e)<<6|c())>=128)return s;throw Error("Invalid continuation byte")}if(224==(240&e)){if((s=(15&e)<<12|c()<<6|c())>=2048)return a(s),s;throw Error("Invalid continuation byte")}if(240==(248&e)&&(s=(7&e)<<18|c()<<12|c()<<6|c())>=65536&&s<=1114111)return s;throw Error("Invalid UTF-8 detected")}e.version="3.0.0",e.encode=function(e){for(var t=o(e),i=t.length,r=-1,s="";++r<i;)s+=d(t[r]);return s},e.decode=function(e){t=o(e),i=t.length,r=0;for(var a,n=[];!1!==(a=l());)n.push(a);return function(e){for(var t,i=e.length,r=-1,o="";++r<i;)(t=e[r])>65535&&(o+=s((t-=65536)>>>10&1023|55296),t=56320|1023&t),o+=s(t);return o}(n)}}(t)},5512:e=>{"use strict";e.exports=function(e,t,i,r){var s=self||window;try{try{var o;try{o=new s.Blob([e])}catch(t){(o=new(s.BlobBuilder||s.WebKitBlobBuilder||s.MozBlobBuilder||s.MSBlobBuilder)).append(e),o=o.getBlob()}var a=s.URL||s.webkitURL,n=a.createObjectURL(o),d=new s[t](n,i);return a.revokeObjectURL(n),d}catch(r){return new s[t]("data:application/javascript,".concat(encodeURIComponent(e)),i)}}catch(e){if(!r)throw Error("Inline worker is not supported");return new s[t](r,i)}}},6206:t=>{"use strict";t.exports=e},7855:(e,t,i)=>{e.exports=i(4106)},129:(e,t,i)=>{e.exports=i(1086)},1265:(e,t,i)=>{e.exports=i(4598)},6984:(e,t,i)=>{e.exports=i(9792)},2601:(e,t,i)=>{e.exports=i(4444)},7201:(e,t,i)=>{e.exports=i(3042)},3565:(e,t,i)=>{"use strict";var r=i(1960);e.exports=r},7358:(e,t,i)=>{"use strict";var r=i(6343);e.exports=r},1829:(e,t,i)=>{"use strict";var r=i(2222);e.exports=r},6040:(e,t,i)=>{"use strict";var r=i(8251);e.exports=r},5001:(e,t,i)=>{"use strict";var r=i(9563);e.exports=r},7264:(e,t,i)=>{"use strict";var r=i(4139);i(768),i(8549),i(7152),i(1372),e.exports=r},9692:(e,t,i)=>{"use strict";var r=i(7045);e.exports=r},5663:(e,t,i)=>{"use strict";var r=i(70);e.exports=r},1362:(e,t,i)=>{"use strict";i(9748);var r=i(1747);e.exports=r("Array","includes")},6429:(e,t,i)=>{"use strict";i(8559);var r=i(1747);e.exports=r("Array","reverse")},1263:(e,t,i)=>{"use strict";i(6737);var r=i(1747);e.exports=r("Array","sort")},2671:(e,t,i)=>{"use strict";i(2344),e.exports=i(5951)},6880:(e,t,i)=>{"use strict";var r=i(8280),s=i(1362),o=i(4378),a=Array.prototype,n=String.prototype;e.exports=function(e){var t=e.includes;return e===a||r(a,e)&&t===a.includes?s:"string"==typeof e||e===n||r(n,e)&&t===n.includes?o:t}},6823:(e,t,i)=>{"use strict";var r=i(8280),s=i(2017),o=String.prototype;e.exports=function(e){var t=e.replaceAll;return"string"==typeof e||e===o||r(o,e)&&t===o.replaceAll?s:t}},8059:(e,t,i)=>{"use strict";var r=i(8280),s=i(6429),o=Array.prototype;e.exports=function(e){var t=e.reverse;return e===o||r(o,e)&&t===o.reverse?s:t}},2757:(e,t,i)=>{"use strict";var r=i(8280),s=i(1263),o=Array.prototype;e.exports=function(e){var t=e.sort;return e===o||r(o,e)&&t===o.sort?s:t}},1042:(e,t,i)=>{"use strict";var r=i(8280),s=i(7511),o=String.prototype;e.exports=function(e){var t=e.trim;return"string"==typeof e||e===o||r(o,e)&&t===o.trim?s:t}},1926:(e,t,i)=>{"use strict";i(6750);var r=i(2046).Object,s=e.exports=function(e,t,i){return r.defineProperty(e,t,i)};r.defineProperty.sham&&(s.sham=!0)},4776:(e,t,i)=>{"use strict";i(4452);var r=i(2046);e.exports=r.Object.getOwnPropertySymbols},4378:(e,t,i)=>{"use strict";i(9770);var r=i(1747);e.exports=r("String","includes")},2017:(e,t,i)=>{"use strict";i(1398),i(1995),i(929);var r=i(1747);e.exports=r("String","replaceAll")},7511:(e,t,i)=>{"use strict";i(727);var r=i(1747);e.exports=r("String","trim")},3842:(e,t,i)=>{"use strict";i(8545),i(3643),i(4452),i(3997),i(5084),i(2596),i(5721),i(4954),i(4123),i(3377),i(2230),i(5344),i(1660),i(4610),i(3669),i(4810),i(3325),i(7024),i(8172),i(5205);var r=i(2046);e.exports=r.Symbol},1730:(e,t,i)=>{"use strict";i(9363),i(3643),i(7057),i(4954);var r=i(560);e.exports=r.f("iterator")},1661:(e,t,i)=>{"use strict";i(8537),i(3669);var r=i(560);e.exports=r.f("toPrimitive")},4444:(e,t,i)=>{"use strict";e.exports=i(214)},3042:(e,t,i)=>{"use strict";e.exports=i(9604)},214:(e,t,i)=>{"use strict";i(397);var r=i(3565);e.exports=r},3901:(e,t,i)=>{"use strict";var r=i(7358);e.exports=r},9604:(e,t,i)=>{"use strict";i(6038);var r=i(1829);e.exports=r},4997:(e,t,i)=>{"use strict";var r=i(6040);e.exports=r},913:(e,t,i)=>{"use strict";var r=i(5001);e.exports=r},2321:(e,t,i)=>{"use strict";var r=i(7264);i(3939),i(1785),i(1697),i(4664),i(3422),i(36),i(8703),i(6878),i(9671),i(359),e.exports=r},2231:(e,t,i)=>{"use strict";var r=i(9692);e.exports=r},9280:(e,t,i)=>{"use strict";var r=i(5663);e.exports=r},2159:(e,t,i)=>{"use strict";var r=i(2250),s=i(4640),o=TypeError;e.exports=function(e){if(r(e))return e;throw new o(s(e)+" is not a function")}},43:(e,t,i)=>{"use strict";var r=i(4018),s=String,o=TypeError;e.exports=function(e){if(r(e))return e;throw new o("Can't set "+s(e)+" as a prototype")}},2156:e=>{"use strict";e.exports=function(){}},9596:(e,t,i)=>{"use strict";var r=i(8280),s=TypeError;e.exports=function(e,t){if(r(t,e))return e;throw new s("Incorrect invocation")}},6624:(e,t,i)=>{"use strict";var r=i(6285),s=String,o=TypeError;e.exports=function(e){if(r(e))return e;throw new o(s(e)+" is not an object")}},1229:(e,t,i)=>{"use strict";var r=i(8311),s=i(3930),o=i(9298),a=i(6818),n=i(7812),d=i(5468),c=i(575),l=i(5543),h=i(300),u=i(3448),p=Array;e.exports=function(e){var t=o(e),i=d(this),f=arguments.length,m=f>1?arguments[1]:void 0,v=void 0!==m;v&&(m=r(m,f>2?arguments[2]:void 0));var g,_,S,A,y,C,E=u(t),b=0;if(!E||this===p&&n(E))for(g=c(t),_=i?new this(g):p(g);g>b;b++)C=v?m(t[b],b):t[b],l(_,b,C);else for(_=i?new this:[],y=(A=h(t,E)).next;!(S=s(y,A)).done;b++)C=v?a(A,m,[S.value,b],!0):S.value,l(_,b,C);return _.length=b,_}},4436:(e,t,i)=>{"use strict";var r=i(7374),s=i(4849),o=i(575),a=function(e){return function(t,i,a){var n=r(t),d=o(n);if(0===d)return!e&&-1;var c,l=s(a,d);if(e&&i!=i){for(;d>l;)if((c=n[l++])!=c)return!0}else for(;d>l;l++)if((e||l in n)&&n[l]===i)return e||l||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},726:(e,t,i)=>{"use strict";var r=i(8311),s=i(1907),o=i(6946),a=i(9298),n=i(575),d=i(6968),c=s([].push),l=function(e){var t=1===e,i=2===e,s=3===e,l=4===e,h=6===e,u=7===e,p=5===e||h;return function(f,m,v,g){for(var _,S,A=a(f),y=o(A),C=n(y),E=r(m,v),b=0,w=g||d,R=t?w(f,C):i||u?w(f,0):void 0;C>b;b++)if((p||b in y)&&(S=E(_=y[b],b,A),e))if(t)R[b]=S;else if(S)switch(e){case 3:return!0;case 5:return _;case 6:return b;case 2:c(R,_)}else switch(e){case 4:return!1;case 7:c(R,_)}return h?-1:s||l?l:R}};e.exports={forEach:l(0),map:l(1),filter:l(2),some:l(3),every:l(4),find:l(5),findIndex:l(6),filterReject:l(7)}},7171:(e,t,i)=>{"use strict";var r=i(8828),s=i(6264),o=i(798),a=s("species");e.exports=function(e){return o>=51||!r((function(){var t=[];return(t.constructor={})[a]=function(){return{foo:1}},1!==t[e](Boolean).foo}))}},7623:(e,t,i)=>{"use strict";var r=i(8828);e.exports=function(e,t){var i=[][e];return!!i&&r((function(){i.call(null,t||function(){return 1},1)}))}},3427:(e,t,i)=>{"use strict";var r=i(1907);e.exports=r([].slice)},4321:(e,t,i)=>{"use strict";var r=i(3427),s=Math.floor,o=function(e,t){var i=e.length;if(i<8)for(var a,n,d=1;d<i;){for(n=d,a=e[d];n&&t(e[n-1],a)>0;)e[n]=e[--n];n!==d++&&(e[n]=a)}else for(var c=s(i/2),l=o(r(e,0,c),t),h=o(r(e,c),t),u=l.length,p=h.length,f=0,m=0;f<u||m<p;)e[f+m]=f<u&&m<p?t(l[f],h[m])<=0?l[f++]:h[m++]:f<u?l[f++]:h[m++];return e};e.exports=o},4010:(e,t,i)=>{"use strict";var r=i(1793),s=i(5468),o=i(6285),a=i(6264)("species"),n=Array;e.exports=function(e){var t;return r(e)&&(t=e.constructor,(s(t)&&(t===n||r(t.prototype))||o(t)&&null===(t=t[a]))&&(t=void 0)),void 0===t?n:t}},6968:(e,t,i)=>{"use strict";var r=i(4010);e.exports=function(e,t){return new(r(e))(0===t?0:t)}},6818:(e,t,i)=>{"use strict";var r=i(6624),s=i(154);e.exports=function(e,t,i,o){try{return o?t(r(i)[0],i[1]):t(i)}catch(t){s(e,"throw",t)}}},5807:(e,t,i)=>{"use strict";var r=i(1907),s=r({}.toString),o=r("".slice);e.exports=function(e){return o(s(e),8,-1)}},3948:(e,t,i)=>{"use strict";var r=i(2623),s=i(2250),o=i(5807),a=i(6264)("toStringTag"),n=Object,d="Arguments"===o(function(){return arguments}());e.exports=r?o:function(e){var t,i,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=function(e,t){try{return e[t]}catch(e){}}(t=n(e),a))?i:d?o(t):"Object"===(r=o(t))&&s(t.callee)?"Arguments":r}},5735:(e,t,i)=>{"use strict";var r=i(6264)("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(i){try{return t[r]=!1,"/./"[e](t)}catch(e){}}return!1}},7382:(e,t,i)=>{"use strict";var r=i(8828);e.exports=!r((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},9550:e=>{"use strict";e.exports=function(e,t){return{value:e,done:t}}},1626:(e,t,i)=>{"use strict";var r=i(9447),s=i(4284),o=i(5817);e.exports=r?function(e,t,i){return s.f(e,t,o(1,i))}:function(e,t,i){return e[t]=i,e}},5817:e=>{"use strict";e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},5543:(e,t,i)=>{"use strict";var r=i(9447),s=i(4284),o=i(5817);e.exports=function(e,t,i){r?s.f(e,t,o(0,i)):e[t]=i}},9251:(e,t,i)=>{"use strict";var r=i(4284);e.exports=function(e,t,i){return r.f(e,t,i)}},8055:(e,t,i)=>{"use strict";var r=i(1626);e.exports=function(e,t,i,s){return s&&s.enumerable?e[t]=i:r(e,t,i),e}},2802:(e,t,i)=>{"use strict";var r=i(8055);e.exports=function(e,t,i){for(var s in t)i&&i.unsafe&&e[s]?e[s]=t[s]:r(e,s,t[s],i);return e}},2532:(e,t,i)=>{"use strict";var r=i(5951),s=Object.defineProperty;e.exports=function(e,t){try{s(r,e,{value:t,configurable:!0,writable:!0})}catch(i){r[e]=t}return t}},4535:(e,t,i)=>{"use strict";var r=i(4640),s=TypeError;e.exports=function(e,t){if(!delete e[t])throw new s("Cannot delete property "+r(t)+" of "+r(e))}},9447:(e,t,i)=>{"use strict";var r=i(8828);e.exports=!r((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},9552:(e,t,i)=>{"use strict";var r=i(5951),s=i(6285),o=r.document,a=s(o)&&s(o.createElement);e.exports=function(e){return a?o.createElement(e):{}}},8024:e=>{"use strict";var t=TypeError;e.exports=function(e){if(e>9007199254740991)throw t("Maximum allowed index exceeded");return e}},9287:e=>{"use strict";e.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},376:e=>{"use strict";e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},3440:(e,t,i)=>{"use strict";var r=i(6794).match(/firefox\/(\d+)/i);e.exports=!!r&&+r[1]},4328:(e,t,i)=>{"use strict";var r=i(6794);e.exports=/MSIE|Trident/.test(r)},6794:(e,t,i)=>{"use strict";var r=i(5951).navigator,s=r&&r.userAgent;e.exports=s?String(s):""},798:(e,t,i)=>{"use strict";var r,s,o=i(5951),a=i(6794),n=o.process,d=o.Deno,c=n&&n.versions||d&&d.version,l=c&&c.v8;l&&(s=(r=l.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!s&&a&&(!(r=a.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/))&&(s=+r[1]),e.exports=s},3786:(e,t,i)=>{"use strict";var r=i(6794).match(/AppleWebKit\/(\d+)\./);e.exports=!!r&&+r[1]},1091:(e,t,i)=>{"use strict";var r=i(5951),s=i(6024),o=i(2361),a=i(2250),n=i(3846).f,d=i(7463),c=i(2046),l=i(8311),h=i(1626),u=i(9724);i(6128);var p=function(e){var t=function(i,r,o){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(i);case 2:return new e(i,r)}return new e(i,r,o)}return s(e,this,arguments)};return t.prototype=e.prototype,t};e.exports=function(e,t){var i,s,f,m,v,g,_,S,A,y=e.target,C=e.global,E=e.stat,b=e.proto,w=C?r:E?r[y]:r[y]&&r[y].prototype,R=C?c:c[y]||h(c,y,{})[y],T=R.prototype;for(m in t)s=!(i=d(C?m:y+(E?".":"#")+m,e.forced))&&w&&u(w,m),g=R[m],s&&(_=e.dontCallGetSet?(A=n(w,m))&&A.value:w[m]),v=s&&_?_:t[m],(i||b||typeof g!=typeof v)&&(S=e.bind&&s?l(v,r):e.wrap&&s?p(v):b&&a(v)?o(v):v,(e.sham||v&&v.sham||g&&g.sham)&&h(S,"sham",!0),h(R,m,S),b&&(u(c,f=y+"Prototype")||h(c,f,{}),h(c[f],m,v),e.real&&T&&(i||!T[m])&&h(T,m,v)))}},8828:e=>{"use strict";e.exports=function(e){try{return!!e()}catch(e){return!0}}},6024:(e,t,i)=>{"use strict";var r=i(1505),s=Function.prototype,o=s.apply,a=s.call;e.exports="object"==typeof Reflect&&Reflect.apply||(r?a.bind(o):function(){return a.apply(o,arguments)})},8311:(e,t,i)=>{"use strict";var r=i(2361),s=i(2159),o=i(1505),a=r(r.bind);e.exports=function(e,t){return s(e),void 0===t?e:o?a(e,t):function(){return e.apply(t,arguments)}}},1505:(e,t,i)=>{"use strict";var r=i(8828);e.exports=!r((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},3930:(e,t,i)=>{"use strict";var r=i(1505),s=Function.prototype.call;e.exports=r?s.bind(s):function(){return s.apply(s,arguments)}},6833:(e,t,i)=>{"use strict";var r=i(9447),s=i(9724),o=Function.prototype,a=r&&Object.getOwnPropertyDescriptor,n=s(o,"name"),d=n&&"something"===function(){}.name,c=n&&(!r||r&&a(o,"name").configurable);e.exports={EXISTS:n,PROPER:d,CONFIGURABLE:c}},1871:(e,t,i)=>{"use strict";var r=i(1907),s=i(2159);e.exports=function(e,t,i){try{return r(s(Object.getOwnPropertyDescriptor(e,t)[i]))}catch(e){}}},2361:(e,t,i)=>{"use strict";var r=i(5807),s=i(1907);e.exports=function(e){if("Function"===r(e))return s(e)}},1907:(e,t,i)=>{"use strict";var r=i(1505),s=Function.prototype,o=s.call,a=r&&s.bind.bind(o,o);e.exports=r?a:function(e){return function(){return o.apply(e,arguments)}}},1747:(e,t,i)=>{"use strict";var r=i(5951),s=i(2046);e.exports=function(e,t){var i=s[e+"Prototype"],o=i&&i[t];if(o)return o;var a=r[e],n=a&&a.prototype;return n&&n[t]}},5582:(e,t,i)=>{"use strict";var r=i(2046),s=i(5951),o=i(2250),a=function(e){return o(e)?e:void 0};e.exports=function(e,t){return arguments.length<2?a(r[e])||a(s[e]):r[e]&&r[e][t]||s[e]&&s[e][t]}},3448:(e,t,i)=>{"use strict";var r=i(3948),s=i(9367),o=i(7136),a=i(3742),n=i(6264)("iterator");e.exports=function(e){if(!o(e))return s(e,n)||s(e,"@@iterator")||a[r(e)]}},300:(e,t,i)=>{"use strict";var r=i(3930),s=i(2159),o=i(6624),a=i(4640),n=i(3448),d=TypeError;e.exports=function(e,t){var i=arguments.length<2?n(e):t;if(s(i))return o(r(i,e));throw new d(a(e)+" is not iterable")}},6656:(e,t,i)=>{"use strict";var r=i(1907),s=i(1793),o=i(2250),a=i(5807),n=i(160),d=r([].push);e.exports=function(e){if(o(e))return e;if(s(e)){for(var t=e.length,i=[],r=0;r<t;r++){var c=e[r];"string"==typeof c?d(i,c):"number"!=typeof c&&"Number"!==a(c)&&"String"!==a(c)||d(i,n(c))}var l=i.length,h=!0;return function(e,t){if(h)return h=!1,t;if(s(this))return t;for(var r=0;r<l;r++)if(i[r]===e)return t}}}},9367:(e,t,i)=>{"use strict";var r=i(2159),s=i(7136);e.exports=function(e,t){var i=e[t];return s(i)?void 0:r(i)}},7703:(e,t,i)=>{"use strict";var r=i(1907),s=i(9298),o=Math.floor,a=r("".charAt),n=r("".replace),d=r("".slice),c=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,l=/\$([$&'`]|\d{1,2})/g;e.exports=function(e,t,i,r,h,u){var p=i+e.length,f=r.length,m=l;return void 0!==h&&(h=s(h),m=c),n(u,m,(function(s,n){var c;switch(a(n,0)){case"$":return"$";case"&":return e;case"`":return d(t,0,i);case"'":return d(t,p);case"<":c=h[d(n,1,-1)];break;default:var l=+n;if(0===l)return s;if(l>f){var u=o(l/10);return 0===u?s:u<=f?void 0===r[u-1]?a(n,1):r[u-1]+a(n,1):s}c=r[l-1]}return void 0===c?"":c}))}},5951:function(e,t,i){"use strict";var r=function(e){return e&&e.Math===Math&&e};e.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof i.g&&i.g)||r("object"==typeof this&&this)||function(){return this}()||Function("return this")()},9724:(e,t,i)=>{"use strict";var r=i(1907),s=i(9298),o=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return o(s(e),t)}},8530:e=>{"use strict";e.exports={}},2416:(e,t,i)=>{"use strict";var r=i(5582);e.exports=r("document","documentElement")},3648:(e,t,i)=>{"use strict";var r=i(9447),s=i(8828),o=i(9552);e.exports=!r&&!s((function(){return 7!==Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},6946:(e,t,i)=>{"use strict";var r=i(1907),s=i(8828),o=i(5807),a=Object,n=r("".split);e.exports=s((function(){return!a("z").propertyIsEnumerable(0)}))?function(e){return"String"===o(e)?n(e,""):a(e)}:a},2647:(e,t,i)=>{"use strict";var r=i(1907),s=i(2250),o=i(6128),a=r(Function.toString);s(o.inspectSource)||(o.inspectSource=function(e){return a(e)}),e.exports=o.inspectSource},4932:(e,t,i)=>{"use strict";var r,s,o,a=i(551),n=i(5951),d=i(6285),c=i(1626),l=i(9724),h=i(6128),u=i(2522),p=i(8530),f="Object already initialized",m=n.TypeError,v=n.WeakMap;if(a||h.state){var g=h.state||(h.state=new v);g.get=g.get,g.has=g.has,g.set=g.set,r=function(e,t){if(g.has(e))throw new m(f);return t.facade=e,g.set(e,t),t},s=function(e){return g.get(e)||{}},o=function(e){return g.has(e)}}else{var _=u("state");p[_]=!0,r=function(e,t){if(l(e,_))throw new m(f);return t.facade=e,c(e,_,t),t},s=function(e){return l(e,_)?e[_]:{}},o=function(e){return l(e,_)}}e.exports={set:r,get:s,has:o,enforce:function(e){return o(e)?s(e):r(e,{})},getterFor:function(e){return function(t){var i;if(!d(t)||(i=s(t)).type!==e)throw new m("Incompatible receiver, "+e+" required");return i}}}},7812:(e,t,i)=>{"use strict";var r=i(6264),s=i(3742),o=r("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(s.Array===e||a[o]===e)}},1793:(e,t,i)=>{"use strict";var r=i(5807);e.exports=Array.isArray||function(e){return"Array"===r(e)}},2250:e=>{"use strict";var t="object"==typeof document&&document.all;e.exports=void 0===t&&void 0!==t?function(e){return"function"==typeof e||e===t}:function(e){return"function"==typeof e}},5468:(e,t,i)=>{"use strict";var r=i(1907),s=i(8828),o=i(2250),a=i(3948),n=i(5582),d=i(2647),c=function(){},l=n("Reflect","construct"),h=/^\s*(?:class|function)\b/,u=r(h.exec),p=!h.test(c),f=function(e){if(!o(e))return!1;try{return l(c,[],e),!0}catch(e){return!1}},m=function(e){if(!o(e))return!1;switch(a(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return p||!!u(h,d(e))}catch(e){return!0}};m.sham=!0,e.exports=!l||s((function(){var e;return f(f.call)||!f(Object)||!f((function(){e=!0}))||e}))?m:f},7463:(e,t,i)=>{"use strict";var r=i(8828),s=i(2250),o=/#|\.prototype\./,a=function(e,t){var i=d[n(e)];return i===l||i!==c&&(s(t)?r(t):!!t)},n=a.normalize=function(e){return String(e).replace(o,".").toLowerCase()},d=a.data={},c=a.NATIVE="N",l=a.POLYFILL="P";e.exports=a},7136:e=>{"use strict";e.exports=function(e){return null==e}},6285:(e,t,i)=>{"use strict";var r=i(2250);e.exports=function(e){return"object"==typeof e?null!==e:r(e)}},4018:(e,t,i)=>{"use strict";var r=i(6285);e.exports=function(e){return r(e)||null===e}},7376:e=>{"use strict";e.exports=!0},2087:(e,t,i)=>{"use strict";var r=i(6285),s=i(5807),o=i(6264)("match");e.exports=function(e){var t;return r(e)&&(void 0!==(t=e[o])?!!t:"RegExp"===s(e))}},5594:(e,t,i)=>{"use strict";var r=i(5582),s=i(2250),o=i(8280),a=i(1175),n=Object;e.exports=a?function(e){return"symbol"==typeof e}:function(e){var t=r("Symbol");return s(t)&&o(t.prototype,n(e))}},154:(e,t,i)=>{"use strict";var r=i(3930),s=i(6624),o=i(9367);e.exports=function(e,t,i){var a,n;s(e);try{if(!(a=o(e,"return"))){if("throw"===t)throw i;return i}a=r(a,e)}catch(e){n=!0,a=e}if("throw"===t)throw i;if(n)throw a;return s(a),i}},7181:(e,t,i)=>{"use strict";var r=i(5116).IteratorPrototype,s=i(8075),o=i(5817),a=i(4840),n=i(3742),d=function(){return this};e.exports=function(e,t,i,c){var l=t+" Iterator";return e.prototype=s(r,{next:o(+!c,i)}),a(e,l,!1,!0),n[l]=d,e}},183:(e,t,i)=>{"use strict";var r=i(1091),s=i(3930),o=i(7376),a=i(6833),n=i(2250),d=i(7181),c=i(5972),l=i(9192),h=i(4840),u=i(1626),p=i(8055),f=i(6264),m=i(3742),v=i(5116),g=a.PROPER,_=a.CONFIGURABLE,S=v.IteratorPrototype,A=v.BUGGY_SAFARI_ITERATORS,y=f("iterator"),C="keys",E="values",b="entries",w=function(){return this};e.exports=function(e,t,i,a,f,v,R){d(i,t,a);var T,I,M,D=function(e){if(e===f&&N)return N;if(!A&&e&&e in O)return O[e];switch(e){case C:case E:case b:return function(){return new i(this,e)}}return function(){return new i(this)}},P=t+" Iterator",k=!1,O=e.prototype,V=O[y]||O["@@iterator"]||f&&O[f],N=!A&&V||D(f),x="Array"===t&&O.entries||V;if(x&&(T=c(x.call(new e)))!==Object.prototype&&T.next&&(o||c(T)===S||(l?l(T,S):n(T[y])||p(T,y,w)),h(T,P,!0,!0),o&&(m[P]=w)),g&&f===E&&V&&V.name!==E&&(!o&&_?u(O,"name",E):(k=!0,N=function(){return s(V,this)})),f)if(I={values:D(E),keys:v?N:D(C),entries:D(b)},R)for(M in I)(A||k||!(M in O))&&p(O,M,I[M]);else r({target:t,proto:!0,forced:A||k},I);return o&&!R||O[y]===N||p(O,y,N,{name:f}),m[t]=N,I}},5116:(e,t,i)=>{"use strict";var r,s,o,a=i(8828),n=i(2250),d=i(6285),c=i(8075),l=i(5972),h=i(8055),u=i(6264),p=i(7376),f=u("iterator"),m=!1;[].keys&&("next"in(o=[].keys())?(s=l(l(o)))!==Object.prototype&&(r=s):m=!0),!d(r)||a((function(){var e={};return r[f].call(e)!==e}))?r={}:p&&(r=c(r)),n(r[f])||h(r,f,(function(){return this})),e.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:m}},3742:e=>{"use strict";e.exports={}},575:(e,t,i)=>{"use strict";var r=i(3121);e.exports=function(e){return r(e.length)}},1176:e=>{"use strict";var t=Math.ceil,i=Math.floor;e.exports=Math.trunc||function(e){var r=+e;return(r>0?i:t)(r)}},2074:(e,t,i)=>{"use strict";var r=i(2087),s=TypeError;e.exports=function(e){if(r(e))throw new s("The method doesn't accept regular expressions");return e}},9538:(e,t,i)=>{"use strict";var r=i(9447),s=i(1907),o=i(3930),a=i(8828),n=i(2875),d=i(7170),c=i(2574),l=i(9298),h=i(6946),u=Object.assign,p=Object.defineProperty,f=s([].concat);e.exports=!u||a((function(){if(r&&1!==u({b:1},u(p({},"a",{enumerable:!0,get:function(){p(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},i=Symbol("assign detection"),s="abcdefghijklmnopqrst";return e[i]=7,s.split("").forEach((function(e){t[e]=e})),7!==u({},e)[i]||n(u({},t)).join("")!==s}))?function(e,t){for(var i=l(e),s=arguments.length,a=1,u=d.f,p=c.f;s>a;)for(var m,v=h(arguments[a++]),g=u?f(n(v),u(v)):n(v),_=g.length,S=0;_>S;)m=g[S++],r&&!o(p,v,m)||(i[m]=v[m]);return i}:u},8075:(e,t,i)=>{"use strict";var r,s=i(6624),o=i(2220),a=i(376),n=i(8530),d=i(2416),c=i(9552),l=i(2522),h="prototype",u="script",p=l("IE_PROTO"),f=function(){},m=function(e){return"<"+u+">"+e+"</"+u+">"},v=function(e){e.write(m("")),e.close();var t=e.parentWindow.Object;return e=null,t},g=function(){try{r=new ActiveXObject("htmlfile")}catch(e){}var e,t,i;g="undefined"!=typeof document?document.domain&&r?v(r):(t=c("iframe"),i="java"+u+":",t.style.display="none",d.appendChild(t),t.src=String(i),(e=t.contentWindow.document).open(),e.write(m("document.F=Object")),e.close(),e.F):v(r);for(var s=a.length;s--;)delete g[h][a[s]];return g()};n[p]=!0,e.exports=Object.create||function(e,t){var i;return null!==e?(f[h]=s(e),i=new f,f[h]=null,i[p]=e):i=g(),void 0===t?i:o.f(i,t)}},2220:(e,t,i)=>{"use strict";var r=i(9447),s=i(8661),o=i(4284),a=i(6624),n=i(7374),d=i(2875);t.f=r&&!s?Object.defineProperties:function(e,t){a(e);for(var i,r=n(t),s=d(t),c=s.length,l=0;c>l;)o.f(e,i=s[l++],r[i]);return e}},4284:(e,t,i)=>{"use strict";var r=i(9447),s=i(3648),o=i(8661),a=i(6624),n=i(470),d=TypeError,c=Object.defineProperty,l=Object.getOwnPropertyDescriptor,h="enumerable",u="configurable",p="writable";t.f=r?o?function(e,t,i){if(a(e),t=n(t),a(i),"function"==typeof e&&"prototype"===t&&"value"in i&&p in i&&!i[p]){var r=l(e,t);r&&r[p]&&(e[t]=i.value,i={configurable:u in i?i[u]:r[u],enumerable:h in i?i[h]:r[h],writable:!1})}return c(e,t,i)}:c:function(e,t,i){if(a(e),t=n(t),a(i),s)try{return c(e,t,i)}catch(e){}if("get"in i||"set"in i)throw new d("Accessors not supported");return"value"in i&&(e[t]=i.value),e}},3846:(e,t,i)=>{"use strict";var r=i(9447),s=i(3930),o=i(2574),a=i(5817),n=i(7374),d=i(470),c=i(9724),l=i(3648),h=Object.getOwnPropertyDescriptor;t.f=r?h:function(e,t){if(e=n(e),t=d(t),l)try{return h(e,t)}catch(e){}if(c(e,t))return a(!s(o.f,e,t),e[t])}},5407:(e,t,i)=>{"use strict";var r=i(5807),s=i(7374),o=i(4443).f,a=i(3427),n="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return n&&"Window"===r(e)?function(e){try{return o(e)}catch(e){return a(n)}}(e):o(s(e))}},4443:(e,t,i)=>{"use strict";var r=i(3045),s=i(376).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,s)}},7170:(e,t)=>{"use strict";t.f=Object.getOwnPropertySymbols},5972:(e,t,i)=>{"use strict";var r=i(9724),s=i(2250),o=i(9298),a=i(2522),n=i(7382),d=a("IE_PROTO"),c=Object,l=c.prototype;e.exports=n?c.getPrototypeOf:function(e){var t=o(e);if(r(t,d))return t[d];var i=t.constructor;return s(i)&&t instanceof i?i.prototype:t instanceof c?l:null}},8280:(e,t,i)=>{"use strict";var r=i(1907);e.exports=r({}.isPrototypeOf)},3045:(e,t,i)=>{"use strict";var r=i(1907),s=i(9724),o=i(7374),a=i(4436).indexOf,n=i(8530),d=r([].push);e.exports=function(e,t){var i,r=o(e),c=0,l=[];for(i in r)!s(n,i)&&s(r,i)&&d(l,i);for(;t.length>c;)s(r,i=t[c++])&&(~a(l,i)||d(l,i));return l}},2875:(e,t,i)=>{"use strict";var r=i(3045),s=i(376);e.exports=Object.keys||function(e){return r(e,s)}},2574:(e,t)=>{"use strict";var i={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,s=r&&!i.call({1:2},1);t.f=s?function(e){var t=r(this,e);return!!t&&t.enumerable}:i},9192:(e,t,i)=>{"use strict";var r=i(1871),s=i(6285),o=i(4239),a=i(43);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,i={};try{(e=r(Object.prototype,"__proto__","set"))(i,[]),t=i instanceof Array}catch(e){}return function(i,r){return o(i),a(r),s(i)?(t?e(i,r):i.__proto__=r,i):i}}():void 0)},4878:(e,t,i)=>{"use strict";var r=i(2623),s=i(3948);e.exports=r?{}.toString:function(){return"[object "+s(this)+"]"}},581:(e,t,i)=>{"use strict";var r=i(3930),s=i(2250),o=i(6285),a=TypeError;e.exports=function(e,t){var i,n;if("string"===t&&s(i=e.toString)&&!o(n=r(i,e)))return n;if(s(i=e.valueOf)&&!o(n=r(i,e)))return n;if("string"!==t&&s(i=e.toString)&&!o(n=r(i,e)))return n;throw new a("Can't convert object to primitive value")}},2046:e=>{"use strict";e.exports={}},5606:(e,t,i)=>{"use strict";var r=i(6624);e.exports=function(){var e=r(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t}},663:(e,t,i)=>{"use strict";var r=i(3930),s=i(9724),o=i(8280),a=i(5606),n=RegExp.prototype;e.exports=function(e){var t=e.flags;return void 0!==t||"flags"in n||s(e,"flags")||!o(n,e)?t:r(a,e)}},4239:(e,t,i)=>{"use strict";var r=i(7136),s=TypeError;e.exports=function(e){if(r(e))throw new s("Can't call method on "+e);return e}},2098:(e,t,i)=>{"use strict";var r=i(5951),s=i(9447),o=Object.getOwnPropertyDescriptor;e.exports=function(e){if(!s)return r[e];var t=o(r,e);return t&&t.value}},4840:(e,t,i)=>{"use strict";var r=i(2623),s=i(4284).f,o=i(1626),a=i(9724),n=i(4878),d=i(6264)("toStringTag");e.exports=function(e,t,i,c){var l=i?e:e&&e.prototype;l&&(a(l,d)||s(l,d,{configurable:!0,value:t}),c&&!r&&o(l,"toString",n))}},2522:(e,t,i)=>{"use strict";var r=i(5816),s=i(6499),o=r("keys");e.exports=function(e){return o[e]||(o[e]=s(e))}},6128:(e,t,i)=>{"use strict";var r=i(7376),s=i(5951),o=i(2532),a="__core-js_shared__",n=e.exports=s[a]||o(a,{});(n.versions||(n.versions=[])).push({version:"3.39.0",mode:r?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE",source:"https://github.com/zloirock/core-js"})},5816:(e,t,i)=>{"use strict";var r=i(6128);e.exports=function(e,t){return r[e]||(r[e]=t||{})}},1470:(e,t,i)=>{"use strict";var r=i(1907),s=i(5482),o=i(160),a=i(4239),n=r("".charAt),d=r("".charCodeAt),c=r("".slice),l=function(e){return function(t,i){var r,l,h=o(a(t)),u=s(i),p=h.length;return u<0||u>=p?e?"":void 0:(r=d(h,u))<55296||r>56319||u+1===p||(l=d(h,u+1))<56320||l>57343?e?n(h,u):r:e?c(h,u,u+2):l-56320+(r-55296<<10)+65536}};e.exports={codeAt:l(!1),charAt:l(!0)}},9156:(e,t,i)=>{"use strict";var r=i(1907),s=2147483647,o=/[^\0-\u007E]/,a=/[.\u3002\uFF0E\uFF61]/g,n="Overflow: input needs wider integers to process",d=RangeError,c=r(a.exec),l=Math.floor,h=String.fromCharCode,u=r("".charCodeAt),p=r([].join),f=r([].push),m=r("".replace),v=r("".split),g=r("".toLowerCase),_=function(e){return e+22+75*(e<26)},S=function(e,t,i){var r=0;for(e=i?l(e/700):e>>1,e+=l(e/t);e>455;)e=l(e/35),r+=36;return l(r+36*e/(e+38))},A=function(e){var t=[];e=function(e){for(var t=[],i=0,r=e.length;i<r;){var s=u(e,i++);if(s>=55296&&s<=56319&&i<r){var o=u(e,i++);56320==(64512&o)?f(t,((1023&s)<<10)+(1023&o)+65536):(f(t,s),i--)}else f(t,s)}return t}(e);var i,r,o=e.length,a=128,c=0,m=72;for(i=0;i<e.length;i++)(r=e[i])<128&&f(t,h(r));var v=t.length,g=v;for(v&&f(t,"-");g<o;){var A=s;for(i=0;i<e.length;i++)(r=e[i])>=a&&r<A&&(A=r);var y=g+1;if(A-a>l((s-c)/y))throw new d(n);for(c+=(A-a)*y,a=A,i=0;i<e.length;i++){if((r=e[i])<a&&++c>s)throw new d(n);if(r===a){for(var C=c,E=36;;){var b=E<=m?1:E>=m+26?26:E-m;if(C<b)break;var w=C-b,R=36-b;f(t,h(_(b+w%R))),C=l(w/R),E+=36}f(t,h(_(C))),m=S(c,y,g===v),c=0,g++}}c++,a++}return p(t,"")};e.exports=function(e){var t,i,r=[],s=v(m(g(e),a,"."),".");for(t=0;t<s.length;t++)i=s[t],f(r,c(o,i)?"xn--"+A(i):i);return p(r,".")}},5819:(e,t,i)=>{"use strict";var r=i(6833).PROPER,s=i(8828),o=i(6395);e.exports=function(e){return s((function(){return!!o[e]()||"​…᠎"!=="​…᠎"[e]()||r&&o[e].name!==e}))}},5993:(e,t,i)=>{"use strict";var r=i(1907),s=i(4239),o=i(160),a=i(6395),n=r("".replace),d=RegExp("^["+a+"]+"),c=RegExp("(^|[^"+a+"])["+a+"]+$"),l=function(e){return function(t){var i=o(s(t));return 1&e&&(i=n(i,d,"")),2&e&&(i=n(i,c,"$1")),i}};e.exports={start:l(1),end:l(2),trim:l(3)}},9846:(e,t,i)=>{"use strict";var r=i(798),s=i(8828),o=i(5951).String;e.exports=!!Object.getOwnPropertySymbols&&!s((function(){var e=Symbol("symbol detection");return!o(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},3467:(e,t,i)=>{"use strict";var r=i(3930),s=i(5582),o=i(6264),a=i(8055);e.exports=function(){var e=s("Symbol"),t=e&&e.prototype,i=t&&t.valueOf,n=o("toPrimitive");t&&!t[n]&&a(t,n,(function(e){return r(i,this)}),{arity:1})}},2595:(e,t,i)=>{"use strict";var r=i(5582),s=i(1907),o=r("Symbol"),a=o.keyFor,n=s(o.prototype.valueOf);e.exports=o.isRegisteredSymbol||function(e){try{return void 0!==a(n(e))}catch(e){return!1}}},9197:(e,t,i)=>{"use strict";for(var r=i(5816),s=i(5582),o=i(1907),a=i(5594),n=i(6264),d=s("Symbol"),c=d.isWellKnownSymbol,l=s("Object","getOwnPropertyNames"),h=o(d.prototype.valueOf),u=r("wks"),p=0,f=l(d),m=f.length;p<m;p++)try{var v=f[p];a(d[v])&&n(v)}catch(e){}e.exports=function(e){if(c&&c(e))return!0;try{for(var t=h(e),i=0,r=l(u),s=r.length;i<s;i++)if(u[r[i]]==t)return!0}catch(e){}return!1}},4411:(e,t,i)=>{"use strict";var r=i(9846);e.exports=r&&!!Symbol.for&&!!Symbol.keyFor},4849:(e,t,i)=>{"use strict";var r=i(5482),s=Math.max,o=Math.min;e.exports=function(e,t){var i=r(e);return i<0?s(i+t,0):o(i,t)}},7374:(e,t,i)=>{"use strict";var r=i(6946),s=i(4239);e.exports=function(e){return r(s(e))}},5482:(e,t,i)=>{"use strict";var r=i(1176);e.exports=function(e){var t=+e;return t!=t||0===t?0:r(t)}},3121:(e,t,i)=>{"use strict";var r=i(5482),s=Math.min;e.exports=function(e){var t=r(e);return t>0?s(t,9007199254740991):0}},9298:(e,t,i)=>{"use strict";var r=i(4239),s=Object;e.exports=function(e){return s(r(e))}},6028:(e,t,i)=>{"use strict";var r=i(3930),s=i(6285),o=i(5594),a=i(9367),n=i(581),d=i(6264),c=TypeError,l=d("toPrimitive");e.exports=function(e,t){if(!s(e)||o(e))return e;var i,d=a(e,l);if(d){if(void 0===t&&(t="default"),i=r(d,e,t),!s(i)||o(i))return i;throw new c("Can't convert object to primitive value")}return void 0===t&&(t="number"),n(e,t)}},470:(e,t,i)=>{"use strict";var r=i(6028),s=i(5594);e.exports=function(e){var t=r(e,"string");return s(t)?t:t+""}},2623:(e,t,i)=>{"use strict";var r={};r[i(6264)("toStringTag")]="z",e.exports="[object z]"===String(r)},160:(e,t,i)=>{"use strict";var r=i(3948),s=String;e.exports=function(e){if("Symbol"===r(e))throw new TypeError("Cannot convert a Symbol value to a string");return s(e)}},4640:e=>{"use strict";var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},6499:(e,t,i)=>{"use strict";var r=i(1907),s=0,o=Math.random(),a=r(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+a(++s+o,36)}},4791:(e,t,i)=>{"use strict";var r=i(8828),s=i(6264),o=i(9447),a=i(7376),n=s("iterator");e.exports=!r((function(){var e=new URL("b?a=1&b=2&c=3","https://a"),t=e.searchParams,i=new URLSearchParams("a=1&a=2&b=3"),r="";return e.pathname="c%20d",t.forEach((function(e,i){t.delete("b"),r+=i+e})),i.delete("a",2),i.delete("b",void 0),a&&(!e.toJSON||!i.has("a",1)||i.has("a",2)||!i.has("a",void 0)||i.has("b"))||!t.size&&(a||!o)||!t.sort||"https://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[n]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("https://тест").host||"#%D0%B1"!==new URL("https://a#б").hash||"a1c3"!==r||"x"!==new URL("https://x",void 0).host}))},1175:(e,t,i)=>{"use strict";var r=i(9846);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},8661:(e,t,i)=>{"use strict";var r=i(9447),s=i(8828);e.exports=r&&s((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},4787:e=>{"use strict";var t=TypeError;e.exports=function(e,i){if(e<i)throw new t("Not enough arguments");return e}},551:(e,t,i)=>{"use strict";var r=i(5951),s=i(2250),o=r.WeakMap;e.exports=s(o)&&/native code/.test(String(o))},366:(e,t,i)=>{"use strict";var r=i(2046),s=i(9724),o=i(560),a=i(4284).f;e.exports=function(e){var t=r.Symbol||(r.Symbol={});s(t,e)||a(t,e,{value:o.f(e)})}},560:(e,t,i)=>{"use strict";var r=i(6264);t.f=r},6264:(e,t,i)=>{"use strict";var r=i(5951),s=i(5816),o=i(9724),a=i(6499),n=i(9846),d=i(1175),c=r.Symbol,l=s("wks"),h=d?c.for||c:c&&c.withoutSetter||a;e.exports=function(e){return o(l,e)||(l[e]=n&&o(c,e)?c[e]:h("Symbol."+e)),l[e]}},6395:e=>{"use strict";e.exports="\t\n\v\f\r                 \u2028\u2029\ufeff"},8545:(e,t,i)=>{"use strict";var r=i(1091),s=i(8828),o=i(1793),a=i(6285),n=i(9298),d=i(575),c=i(8024),l=i(5543),h=i(6968),u=i(7171),p=i(6264),f=i(798),m=p("isConcatSpreadable"),v=f>=51||!s((function(){var e=[];return e[m]=!1,e.concat()[0]!==e})),g=function(e){if(!a(e))return!1;var t=e[m];return void 0!==t?!!t:o(e)};r({target:"Array",proto:!0,arity:1,forced:!v||!u("concat")},{concat:function(e){var t,i,r,s,o,a=n(this),u=h(a,0),p=0;for(t=-1,r=arguments.length;t<r;t++)if(g(o=-1===t?a:arguments[t]))for(s=d(o),c(p+s),i=0;i<s;i++,p++)i in o&&l(u,p,o[i]);else c(p+1),l(u,p++,o);return u.length=p,u}})},9748:(e,t,i)=>{"use strict";var r=i(1091),s=i(4436).includes,o=i(8828),a=i(2156);r({target:"Array",proto:!0,forced:o((function(){return!Array(1).includes()}))},{includes:function(e){return s(this,e,arguments.length>1?arguments[1]:void 0)}}),a("includes")},9363:(e,t,i)=>{"use strict";var r=i(7374),s=i(2156),o=i(3742),a=i(4932),n=i(4284).f,d=i(183),c=i(9550),l=i(7376),h=i(9447),u="Array Iterator",p=a.set,f=a.getterFor(u);e.exports=d(Array,"Array",(function(e,t){p(this,{type:u,target:r(e),index:0,kind:t})}),(function(){var e=f(this),t=e.target,i=e.index++;if(!t||i>=t.length)return e.target=null,c(void 0,!0);switch(e.kind){case"keys":return c(i,!1);case"values":return c(t[i],!1)}return c([i,t[i]],!1)}),"values");var m=o.Arguments=o.Array;if(s("keys"),s("values"),s("entries"),!l&&h&&"values"!==m.name)try{n(m,"name",{value:"values"})}catch(e){}},8559:(e,t,i)=>{"use strict";var r=i(1091),s=i(1907),o=i(1793),a=s([].reverse),n=[1,2];r({target:"Array",proto:!0,forced:String(n)===String(n.reverse())},{reverse:function(){return o(this)&&(this.length=this.length),a(this)}})},6737:(e,t,i)=>{"use strict";var r=i(1091),s=i(1907),o=i(2159),a=i(9298),n=i(575),d=i(4535),c=i(160),l=i(8828),h=i(4321),u=i(7623),p=i(3440),f=i(4328),m=i(798),v=i(3786),g=[],_=s(g.sort),S=s(g.push),A=l((function(){g.sort(void 0)})),y=l((function(){g.sort(null)})),C=u("sort"),E=!l((function(){if(m)return m<70;if(!(p&&p>3)){if(f)return!0;if(v)return v<603;var e,t,i,r,s="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:i=3;break;case 68:case 71:i=4;break;default:i=2}for(r=0;r<47;r++)g.push({k:t+r,v:i})}for(g.sort((function(e,t){return t.v-e.v})),r=0;r<g.length;r++)t=g[r].k.charAt(0),s.charAt(s.length-1)!==t&&(s+=t);return"DGBEFHACIJK"!==s}}));r({target:"Array",proto:!0,forced:A||!y||!C||!E},{sort:function(e){void 0!==e&&o(e);var t=a(this);if(E)return void 0===e?_(t):_(t,e);var i,r,s=[],l=n(t);for(r=0;r<l;r++)r in t&&S(s,t[r]);for(h(s,function(e){return function(t,i){return void 0===i?-1:void 0===t?1:void 0!==e?+e(t,i)||0:c(t)>c(i)?1:-1}}(e)),i=n(s),r=0;r<i;)t[r]=s[r++];for(;r<l;)d(t,r++);return t}})},8537:()=>{},2344:(e,t,i)=>{"use strict";var r=i(1091),s=i(5951);r({global:!0,forced:s.globalThis!==s},{globalThis:s})},9721:(e,t,i)=>{"use strict";var r=i(1091),s=i(5582),o=i(6024),a=i(3930),n=i(1907),d=i(8828),c=i(2250),l=i(5594),h=i(3427),u=i(6656),p=i(9846),f=String,m=s("JSON","stringify"),v=n(/./.exec),g=n("".charAt),_=n("".charCodeAt),S=n("".replace),A=n(1..toString),y=/[\uD800-\uDFFF]/g,C=/^[\uD800-\uDBFF]$/,E=/^[\uDC00-\uDFFF]$/,b=!p||d((function(){var e=s("Symbol")("stringify detection");return"[null]"!==m([e])||"{}"!==m({a:e})||"{}"!==m(Object(e))})),w=d((function(){return'"\\udf06\\ud834"'!==m("\udf06\ud834")||'"\\udead"'!==m("\udead")})),R=function(e,t){var i=h(arguments),r=u(t);if(c(r)||void 0!==e&&!l(e))return i[1]=function(e,t){if(c(r)&&(t=a(r,this,f(e),t)),!l(t))return t},o(m,null,i)},T=function(e,t,i){var r=g(i,t-1),s=g(i,t+1);return v(C,e)&&!v(E,s)||v(E,e)&&!v(C,r)?"\\u"+A(_(e,0),16):e};m&&r({target:"JSON",stat:!0,arity:3,forced:b||w},{stringify:function(e,t,i){var r=h(arguments),s=o(b?R:m,null,r);return w&&"string"==typeof s?S(s,y,T):s}})},7024:(e,t,i)=>{"use strict";var r=i(5951);i(4840)(r.JSON,"JSON",!0)},8172:()=>{},6750:(e,t,i)=>{"use strict";var r=i(1091),s=i(9447),o=i(4284).f;r({target:"Object",stat:!0,forced:Object.defineProperty!==o,sham:!s},{defineProperty:o})},5264:(e,t,i)=>{"use strict";var r=i(1091),s=i(9846),o=i(8828),a=i(7170),n=i(9298);r({target:"Object",stat:!0,forced:!s||o((function(){a.f(1)}))},{getOwnPropertySymbols:function(e){var t=a.f;return t?t(n(e)):[]}})},3643:()=>{},5205:()=>{},1398:()=>{},1074:(e,t,i)=>{"use strict";var r=i(1091),s=i(1907),o=i(4849),a=RangeError,n=String.fromCharCode,d=String.fromCodePoint,c=s([].join);r({target:"String",stat:!0,arity:1,forced:!!d&&1!==d.length},{fromCodePoint:function(e){for(var t,i=[],r=arguments.length,s=0;r>s;){if(t=+arguments[s++],o(t,1114111)!==t)throw new a(t+" is not a valid code point");i[s]=t<65536?n(t):n(55296+((t-=65536)>>10),t%1024+56320)}return c(i,"")}})},9770:(e,t,i)=>{"use strict";var r=i(1091),s=i(1907),o=i(2074),a=i(4239),n=i(160),d=i(5735),c=s("".indexOf);r({target:"String",proto:!0,forced:!d("includes")},{includes:function(e){return!!~c(n(a(this)),n(o(e)),arguments.length>1?arguments[1]:void 0)}})},7057:(e,t,i)=>{"use strict";var r=i(1470).charAt,s=i(160),o=i(4932),a=i(183),n=i(9550),d="String Iterator",c=o.set,l=o.getterFor(d);a(String,"String",(function(e){c(this,{type:d,string:s(e),index:0})}),(function(){var e,t=l(this),i=t.string,s=t.index;return s>=i.length?n(void 0,!0):(e=r(i,s),t.index+=e.length,n(e,!1))}))},929:(e,t,i)=>{"use strict";var r=i(1091),s=i(3930),o=i(1907),a=i(4239),n=i(2250),d=i(7136),c=i(2087),l=i(160),h=i(9367),u=i(663),p=i(7703),f=i(6264),m=i(7376),v=f("replace"),g=TypeError,_=o("".indexOf),S=o("".replace),A=o("".slice),y=Math.max;r({target:"String",proto:!0},{replaceAll:function(e,t){var i,r,o,f,C,E,b,w,R,T,I=a(this),M=0,D="";if(!d(e)){if((i=c(e))&&(r=l(a(u(e))),!~_(r,"g")))throw new g("`.replaceAll` does not allow non-global regexes");if(o=h(e,v))return s(o,e,I,t);if(m&&i)return S(l(I),e,t)}for(f=l(I),C=l(e),(E=n(t))||(t=l(t)),b=C.length,w=y(1,b),R=_(f,C);-1!==R;)T=E?l(t(C,R,f)):p(C,f,R,[],void 0,t),D+=A(f,M,R)+T,M=R+b,R=R+w>f.length?-1:_(f,C,R+w);return M<f.length&&(D+=A(f,M)),D}})},1995:()=>{},727:(e,t,i)=>{"use strict";var r=i(1091),s=i(5993).trim;r({target:"String",proto:!0,forced:i(5819)("trim")},{trim:function(){return s(this)}})},3997:(e,t,i)=>{"use strict";i(366)("asyncIterator")},3674:(e,t,i)=>{"use strict";var r=i(1091),s=i(5951),o=i(3930),a=i(1907),n=i(7376),d=i(9447),c=i(9846),l=i(8828),h=i(9724),u=i(8280),p=i(6624),f=i(7374),m=i(470),v=i(160),g=i(5817),_=i(8075),S=i(2875),A=i(4443),y=i(5407),C=i(7170),E=i(3846),b=i(4284),w=i(2220),R=i(2574),T=i(8055),I=i(9251),M=i(5816),D=i(2522),P=i(8530),k=i(6499),O=i(6264),V=i(560),N=i(366),x=i(3467),L=i(4840),W=i(4932),U=i(726).forEach,B=D("hidden"),F="Symbol",H="prototype",G=W.set,j=W.getterFor(F),K=Object[H],z=s.Symbol,q=z&&z[H],Y=s.RangeError,X=s.TypeError,Q=s.QObject,J=E.f,$=b.f,Z=y.f,ee=R.f,te=a([].push),ie=M("symbols"),re=M("op-symbols"),se=M("wks"),oe=!Q||!Q[H]||!Q[H].findChild,ae=function(e,t,i){var r=J(K,t);r&&delete K[t],$(e,t,i),r&&e!==K&&$(K,t,r)},ne=d&&l((function(){return 7!==_($({},"a",{get:function(){return $(this,"a",{value:7}).a}})).a}))?ae:$,de=function(e,t){var i=ie[e]=_(q);return G(i,{type:F,tag:e,description:t}),d||(i.description=t),i},ce=function(e,t,i){e===K&&ce(re,t,i),p(e);var r=m(t);return p(i),h(ie,r)?(i.enumerable?(h(e,B)&&e[B][r]&&(e[B][r]=!1),i=_(i,{enumerable:g(0,!1)})):(h(e,B)||$(e,B,g(1,_(null))),e[B][r]=!0),ne(e,r,i)):$(e,r,i)},le=function(e,t){p(e);var i=f(t),r=S(i).concat(fe(i));return U(r,(function(t){d&&!o(he,i,t)||ce(e,t,i[t])})),e},he=function(e){var t=m(e),i=o(ee,this,t);return!(this===K&&h(ie,t)&&!h(re,t))&&(!(i||!h(this,t)||!h(ie,t)||h(this,B)&&this[B][t])||i)},ue=function(e,t){var i=f(e),r=m(t);if(i!==K||!h(ie,r)||h(re,r)){var s=J(i,r);return!s||!h(ie,r)||h(i,B)&&i[B][r]||(s.enumerable=!0),s}},pe=function(e){var t=Z(f(e)),i=[];return U(t,(function(e){h(ie,e)||h(P,e)||te(i,e)})),i},fe=function(e){var t=e===K,i=Z(t?re:f(e)),r=[];return U(i,(function(e){!h(ie,e)||t&&!h(K,e)||te(r,ie[e])})),r};c||(T(q=(z=function(){if(u(q,this))throw new X("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?v(arguments[0]):void 0,t=k(e),i=function(e){var r=void 0===this?s:this;r===K&&o(i,re,e),h(r,B)&&h(r[B],t)&&(r[B][t]=!1);var a=g(1,e);try{ne(r,t,a)}catch(e){if(!(e instanceof Y))throw e;ae(r,t,a)}};return d&&oe&&ne(K,t,{configurable:!0,set:i}),de(t,e)})[H],"toString",(function(){return j(this).tag})),T(z,"withoutSetter",(function(e){return de(k(e),e)})),R.f=he,b.f=ce,w.f=le,E.f=ue,A.f=y.f=pe,C.f=fe,V.f=function(e){return de(O(e),e)},d&&(I(q,"description",{configurable:!0,get:function(){return j(this).description}}),n||T(K,"propertyIsEnumerable",he,{unsafe:!0}))),r({global:!0,constructor:!0,wrap:!0,forced:!c,sham:!c},{Symbol:z}),U(S(se),(function(e){N(e)})),r({target:F,stat:!0,forced:!c},{useSetter:function(){oe=!0},useSimple:function(){oe=!1}}),r({target:"Object",stat:!0,forced:!c,sham:!d},{create:function(e,t){return void 0===t?_(e):le(_(e),t)},defineProperty:ce,defineProperties:le,getOwnPropertyDescriptor:ue}),r({target:"Object",stat:!0,forced:!c},{getOwnPropertyNames:pe}),x(),L(z,F),P[B]=!0},5084:()=>{},3313:(e,t,i)=>{"use strict";var r=i(1091),s=i(5582),o=i(9724),a=i(160),n=i(5816),d=i(4411),c=n("string-to-symbol-registry"),l=n("symbol-to-string-registry");r({target:"Symbol",stat:!0,forced:!d},{for:function(e){var t=a(e);if(o(c,t))return c[t];var i=s("Symbol")(t);return c[t]=i,l[i]=t,i}})},2596:(e,t,i)=>{"use strict";i(366)("hasInstance")},5721:(e,t,i)=>{"use strict";i(366)("isConcatSpreadable")},4954:(e,t,i)=>{"use strict";i(366)("iterator")},4452:(e,t,i)=>{"use strict";i(3674),i(3313),i(751),i(9721),i(5264)},751:(e,t,i)=>{"use strict";var r=i(1091),s=i(9724),o=i(5594),a=i(4640),n=i(5816),d=i(4411),c=n("symbol-to-string-registry");r({target:"Symbol",stat:!0,forced:!d},{keyFor:function(e){if(!o(e))throw new TypeError(a(e)+" is not a symbol");if(s(c,e))return c[e]}})},3377:(e,t,i)=>{"use strict";i(366)("matchAll")},4123:(e,t,i)=>{"use strict";i(366)("match")},2230:(e,t,i)=>{"use strict";i(366)("replace")},5344:(e,t,i)=>{"use strict";i(366)("search")},1660:(e,t,i)=>{"use strict";i(366)("species")},4610:(e,t,i)=>{"use strict";i(366)("split")},3669:(e,t,i)=>{"use strict";var r=i(366),s=i(3467);r("toPrimitive"),s()},4810:(e,t,i)=>{"use strict";var r=i(5582),s=i(366),o=i(4840);s("toStringTag"),o(r("Symbol"),"Symbol")},3325:(e,t,i)=>{"use strict";i(366)("unscopables")},768:(e,t,i)=>{"use strict";var r=i(6264),s=i(4284).f,o=r("metadata"),a=Function.prototype;void 0===a[o]&&s(a,o,{value:null})},397:(e,t,i)=>{"use strict";i(2344)},6038:(e,t,i)=>{"use strict";i(929)},8549:(e,t,i)=>{"use strict";i(366)("asyncDispose")},1697:(e,t,i)=>{"use strict";i(366)("customMatcher")},7152:(e,t,i)=>{"use strict";i(366)("dispose")},3939:(e,t,i)=>{"use strict";i(1091)({target:"Symbol",stat:!0},{isRegisteredSymbol:i(2595)})},3422:(e,t,i)=>{"use strict";i(1091)({target:"Symbol",stat:!0,name:"isRegisteredSymbol"},{isRegistered:i(2595)})},1785:(e,t,i)=>{"use strict";i(1091)({target:"Symbol",stat:!0,forced:!0},{isWellKnownSymbol:i(9197)})},36:(e,t,i)=>{"use strict";i(1091)({target:"Symbol",stat:!0,name:"isWellKnownSymbol",forced:!0},{isWellKnown:i(9197)})},8703:(e,t,i)=>{"use strict";i(366)("matcher")},6878:(e,t,i)=>{"use strict";i(366)("metadataKey")},1372:(e,t,i)=>{"use strict";i(366)("metadata")},4664:(e,t,i)=>{"use strict";i(366)("observable")},9671:(e,t,i)=>{"use strict";i(366)("patternMatch")},359:(e,t,i)=>{"use strict";i(366)("replaceAll")},2560:(e,t,i)=>{"use strict";i(9363);var r=i(9287),s=i(5951),o=i(4840),a=i(3742);for(var n in r)o(s[n],n),a[n]=a.Array},7105:(e,t,i)=>{"use strict";i(9363),i(1074);var r=i(1091),s=i(5951),o=i(2098),a=i(5582),n=i(3930),d=i(1907),c=i(9447),l=i(4791),h=i(8055),u=i(9251),p=i(2802),f=i(4840),m=i(7181),v=i(4932),g=i(9596),_=i(2250),S=i(9724),A=i(8311),y=i(3948),C=i(6624),E=i(6285),b=i(160),w=i(8075),R=i(5817),T=i(300),I=i(3448),M=i(9550),D=i(4787),P=i(6264),k=i(4321),O=P("iterator"),V="URLSearchParams",N=V+"Iterator",x=v.set,L=v.getterFor(V),W=v.getterFor(N),U=o("fetch"),B=o("Request"),F=o("Headers"),H=B&&B.prototype,G=F&&F.prototype,j=s.TypeError,K=s.encodeURIComponent,z=String.fromCharCode,q=a("String","fromCodePoint"),Y=parseInt,X=d("".charAt),Q=d([].join),J=d([].push),$=d("".replace),Z=d([].shift),ee=d([].splice),te=d("".split),ie=d("".slice),re=d(/./.exec),se=/\+/g,oe=/^[0-9a-f]+$/i,ae=function(e,t){var i=ie(e,t,t+2);return re(oe,i)?Y(i,16):NaN},ne=function(e){for(var t=0,i=128;i>0&&e&i;i>>=1)t++;return t},de=function(e){var t=null;switch(e.length){case 1:t=e[0];break;case 2:t=(31&e[0])<<6|63&e[1];break;case 3:t=(15&e[0])<<12|(63&e[1])<<6|63&e[2];break;case 4:t=(7&e[0])<<18|(63&e[1])<<12|(63&e[2])<<6|63&e[3]}return t>1114111?null:t},ce=function(e){for(var t=(e=$(e,se," ")).length,i="",r=0;r<t;){var s=X(e,r);if("%"===s){if("%"===X(e,r+1)||r+3>t){i+="%",r++;continue}var o=ae(e,r+1);if(o!=o){i+=s,r++;continue}r+=2;var a=ne(o);if(0===a)s=z(o);else{if(1===a||a>4){i+="�",r++;continue}for(var n=[o],d=1;d<a&&!(3+ ++r>t||"%"!==X(e,r));){var c=ae(e,r+1);if(c!=c){r+=3;break}if(c>191||c<128)break;J(n,c),r+=2,d++}if(n.length!==a){i+="�";continue}var l=de(n);null===l?i+="�":s=q(l)}}i+=s,r++}return i},le=/[!'()~]|%20/g,he={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},ue=function(e){return he[e]},pe=function(e){return $(K(e),le,ue)},fe=m((function(e,t){x(this,{type:N,target:L(e).entries,index:0,kind:t})}),V,(function(){var e=W(this),t=e.target,i=e.index++;if(!t||i>=t.length)return e.target=null,M(void 0,!0);var r=t[i];switch(e.kind){case"keys":return M(r.key,!1);case"values":return M(r.value,!1)}return M([r.key,r.value],!1)}),!0),me=function(e){this.entries=[],this.url=null,void 0!==e&&(E(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===X(e,0)?ie(e,1):e:b(e)))};me.prototype={type:V,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,i,r,s,o,a,d,c=this.entries,l=I(e);if(l)for(i=(t=T(e,l)).next;!(r=n(i,t)).done;){if(o=(s=T(C(r.value))).next,(a=n(o,s)).done||(d=n(o,s)).done||!n(o,s).done)throw new j("Expected sequence with length 2");J(c,{key:b(a.value),value:b(d.value)})}else for(var h in e)S(e,h)&&J(c,{key:h,value:b(e[h])})},parseQuery:function(e){if(e)for(var t,i,r=this.entries,s=te(e,"&"),o=0;o<s.length;)(t=s[o++]).length&&(i=te(t,"="),J(r,{key:ce(Z(i)),value:ce(Q(i,"="))}))},serialize:function(){for(var e,t=this.entries,i=[],r=0;r<t.length;)e=t[r++],J(i,pe(e.key)+"="+pe(e.value));return Q(i,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var ve=function(){g(this,ge);var e=x(this,new me(arguments.length>0?arguments[0]:void 0));c||(this.size=e.entries.length)},ge=ve.prototype;if(p(ge,{append:function(e,t){var i=L(this);D(arguments.length,2),J(i.entries,{key:b(e),value:b(t)}),c||this.length++,i.updateURL()},delete:function(e){for(var t=L(this),i=D(arguments.length,1),r=t.entries,s=b(e),o=i<2?void 0:arguments[1],a=void 0===o?o:b(o),n=0;n<r.length;){var d=r[n];if(d.key!==s||void 0!==a&&d.value!==a)n++;else if(ee(r,n,1),void 0!==a)break}c||(this.size=r.length),t.updateURL()},get:function(e){var t=L(this).entries;D(arguments.length,1);for(var i=b(e),r=0;r<t.length;r++)if(t[r].key===i)return t[r].value;return null},getAll:function(e){var t=L(this).entries;D(arguments.length,1);for(var i=b(e),r=[],s=0;s<t.length;s++)t[s].key===i&&J(r,t[s].value);return r},has:function(e){for(var t=L(this).entries,i=D(arguments.length,1),r=b(e),s=i<2?void 0:arguments[1],o=void 0===s?s:b(s),a=0;a<t.length;){var n=t[a++];if(n.key===r&&(void 0===o||n.value===o))return!0}return!1},set:function(e,t){var i=L(this);D(arguments.length,1);for(var r,s=i.entries,o=!1,a=b(e),n=b(t),d=0;d<s.length;d++)(r=s[d]).key===a&&(o?ee(s,d--,1):(o=!0,r.value=n));o||J(s,{key:a,value:n}),c||(this.size=s.length),i.updateURL()},sort:function(){var e=L(this);k(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,i=L(this).entries,r=A(e,arguments.length>1?arguments[1]:void 0),s=0;s<i.length;)r((t=i[s++]).value,t.key,this)},keys:function(){return new fe(this,"keys")},values:function(){return new fe(this,"values")},entries:function(){return new fe(this,"entries")}},{enumerable:!0}),h(ge,O,ge.entries,{name:"entries"}),h(ge,"toString",(function(){return L(this).serialize()}),{enumerable:!0}),c&&u(ge,"size",{get:function(){return L(this).entries.length},configurable:!0,enumerable:!0}),f(ve,V),r({global:!0,constructor:!0,forced:!l},{URLSearchParams:ve}),!l&&_(F)){var _e=d(G.has),Se=d(G.set),Ae=function(e){if(E(e)){var t,i=e.body;if(y(i)===V)return t=e.headers?new F(e.headers):new F,_e(t,"content-type")||Se(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),w(e,{body:R(0,b(i)),headers:R(0,t)})}return e};if(_(U)&&r({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return U(e,arguments.length>1?Ae(arguments[1]):{})}}),_(B)){var ye=function(e){return g(this,H),new B(e,arguments.length>1?Ae(arguments[1]):{})};H.constructor=ye,ye.prototype=H,r({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:ye})}}e.exports={URLSearchParams:ve,getState:L}},5042:()=>{},7649:()=>{},6299:(e,t,i)=>{"use strict";i(7105)},3604:()=>{},8669:(e,t,i)=>{"use strict";var r=i(1091),s=i(5582),o=i(8828),a=i(4787),n=i(160),d=i(4791),c=s("URL"),l=d&&o((function(){c.canParse()})),h=o((function(){return 1!==c.canParse.length}));r({target:"URL",stat:!0,forced:!l||h},{canParse:function(e){var t=a(arguments.length,1),i=n(e),r=t<2||void 0===arguments[1]?void 0:n(arguments[1]);try{return!!new c(i,r)}catch(e){return!1}}})},6909:(e,t,i)=>{"use strict";i(7057);var r,s=i(1091),o=i(9447),a=i(4791),n=i(5951),d=i(8311),c=i(1907),l=i(8055),h=i(9251),u=i(9596),p=i(9724),f=i(9538),m=i(1229),v=i(3427),g=i(1470).codeAt,_=i(9156),S=i(160),A=i(4840),y=i(4787),C=i(7105),E=i(4932),b=E.set,w=E.getterFor("URL"),R=C.URLSearchParams,T=C.getState,I=n.URL,M=n.TypeError,D=n.parseInt,P=Math.floor,k=Math.pow,O=c("".charAt),V=c(/./.exec),N=c([].join),x=c(1..toString),L=c([].pop),W=c([].push),U=c("".replace),B=c([].shift),F=c("".split),H=c("".slice),G=c("".toLowerCase),j=c([].unshift),K="Invalid scheme",z="Invalid host",q="Invalid port",Y=/[a-z]/i,X=/[\d+-.a-z]/i,Q=/\d/,J=/^0x/i,$=/^[0-7]+$/,Z=/^\d+$/,ee=/^[\da-f]+$/i,te=/[\0\t\n\r #%/:<>?@[\\\]^|]/,ie=/[\0\t\n\r #/:<>?@[\\\]^|]/,re=/^[\u0000-\u0020]+/,se=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,oe=/[\t\n\r]/g,ae=function(e){var t,i,r,s;if("number"==typeof e){for(t=[],i=0;i<4;i++)j(t,e%256),e=P(e/256);return N(t,".")}if("object"==typeof e){for(t="",r=function(e){for(var t=null,i=1,r=null,s=0,o=0;o<8;o++)0!==e[o]?(s>i&&(t=r,i=s),r=null,s=0):(null===r&&(r=o),++s);return s>i?r:t}(e),i=0;i<8;i++)s&&0===e[i]||(s&&(s=!1),r===i?(t+=i?":":"::",s=!0):(t+=x(e[i],16),i<7&&(t+=":")));return"["+t+"]"}return e},ne={},de=f({},ne,{" ":1,'"':1,"<":1,">":1,"`":1}),ce=f({},de,{"#":1,"?":1,"{":1,"}":1}),le=f({},ce,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),he=function(e,t){var i=g(e,0);return i>32&&i<127&&!p(t,e)?e:encodeURIComponent(e)},ue={ftp:21,file:null,http:80,https:443,ws:80,wss:443},pe=function(e,t){var i;return 2===e.length&&V(Y,O(e,0))&&(":"===(i=O(e,1))||!t&&"|"===i)},fe=function(e){var t;return e.length>1&&pe(H(e,0,2))&&(2===e.length||"/"===(t=O(e,2))||"\\"===t||"?"===t||"#"===t)},me=function(e){return"."===e||"%2e"===G(e)},ve={},ge={},_e={},Se={},Ae={},ye={},Ce={},Ee={},be={},we={},Re={},Te={},Ie={},Me={},De={},Pe={},ke={},Oe={},Ve={},Ne={},xe={},Le=function(e,t,i){var r,s,o,a=S(e);if(t){if(s=this.parse(a))throw new M(s);this.searchParams=null}else{if(void 0!==i&&(r=new Le(i,!0)),s=this.parse(a,null,r))throw new M(s);(o=T(new R)).bindURL(this),this.searchParams=o}};Le.prototype={type:"URL",parse:function(e,t,i){var s,o,a,n,d,c=this,l=t||ve,h=0,u="",f=!1,g=!1,_=!1;for(e=S(e),t||(c.scheme="",c.username="",c.password="",c.host=null,c.port=null,c.path=[],c.query=null,c.fragment=null,c.cannotBeABaseURL=!1,e=U(e,re,""),e=U(e,se,"$1")),e=U(e,oe,""),s=m(e);h<=s.length;){switch(o=s[h],l){case ve:if(!o||!V(Y,o)){if(t)return K;l=_e;continue}u+=G(o),l=ge;break;case ge:if(o&&(V(X,o)||"+"===o||"-"===o||"."===o))u+=G(o);else{if(":"!==o){if(t)return K;u="",l=_e,h=0;continue}if(t&&(c.isSpecial()!==p(ue,u)||"file"===u&&(c.includesCredentials()||null!==c.port)||"file"===c.scheme&&!c.host))return;if(c.scheme=u,t)return void(c.isSpecial()&&ue[c.scheme]===c.port&&(c.port=null));u="","file"===c.scheme?l=Me:c.isSpecial()&&i&&i.scheme===c.scheme?l=Se:c.isSpecial()?l=Ee:"/"===s[h+1]?(l=Ae,h++):(c.cannotBeABaseURL=!0,W(c.path,""),l=Ve)}break;case _e:if(!i||i.cannotBeABaseURL&&"#"!==o)return K;if(i.cannotBeABaseURL&&"#"===o){c.scheme=i.scheme,c.path=v(i.path),c.query=i.query,c.fragment="",c.cannotBeABaseURL=!0,l=xe;break}l="file"===i.scheme?Me:ye;continue;case Se:if("/"!==o||"/"!==s[h+1]){l=ye;continue}l=be,h++;break;case Ae:if("/"===o){l=we;break}l=Oe;continue;case ye:if(c.scheme=i.scheme,o===r)c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=v(i.path),c.query=i.query;else if("/"===o||"\\"===o&&c.isSpecial())l=Ce;else if("?"===o)c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=v(i.path),c.query="",l=Ne;else{if("#"!==o){c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=v(i.path),c.path.length--,l=Oe;continue}c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=v(i.path),c.query=i.query,c.fragment="",l=xe}break;case Ce:if(!c.isSpecial()||"/"!==o&&"\\"!==o){if("/"!==o){c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,l=Oe;continue}l=we}else l=be;break;case Ee:if(l=be,"/"!==o||"/"!==O(u,h+1))continue;h++;break;case be:if("/"!==o&&"\\"!==o){l=we;continue}break;case we:if("@"===o){f&&(u="%40"+u),f=!0,a=m(u);for(var A=0;A<a.length;A++){var y=a[A];if(":"!==y||_){var C=he(y,le);_?c.password+=C:c.username+=C}else _=!0}u=""}else if(o===r||"/"===o||"?"===o||"#"===o||"\\"===o&&c.isSpecial()){if(f&&""===u)return"Invalid authority";h-=m(u).length+1,u="",l=Re}else u+=o;break;case Re:case Te:if(t&&"file"===c.scheme){l=Pe;continue}if(":"!==o||g){if(o===r||"/"===o||"?"===o||"#"===o||"\\"===o&&c.isSpecial()){if(c.isSpecial()&&""===u)return z;if(t&&""===u&&(c.includesCredentials()||null!==c.port))return;if(n=c.parseHost(u))return n;if(u="",l=ke,t)return;continue}"["===o?g=!0:"]"===o&&(g=!1),u+=o}else{if(""===u)return z;if(n=c.parseHost(u))return n;if(u="",l=Ie,t===Te)return}break;case Ie:if(!V(Q,o)){if(o===r||"/"===o||"?"===o||"#"===o||"\\"===o&&c.isSpecial()||t){if(""!==u){var E=D(u,10);if(E>65535)return q;c.port=c.isSpecial()&&E===ue[c.scheme]?null:E,u=""}if(t)return;l=ke;continue}return q}u+=o;break;case Me:if(c.scheme="file","/"===o||"\\"===o)l=De;else{if(!i||"file"!==i.scheme){l=Oe;continue}switch(o){case r:c.host=i.host,c.path=v(i.path),c.query=i.query;break;case"?":c.host=i.host,c.path=v(i.path),c.query="",l=Ne;break;case"#":c.host=i.host,c.path=v(i.path),c.query=i.query,c.fragment="",l=xe;break;default:fe(N(v(s,h),""))||(c.host=i.host,c.path=v(i.path),c.shortenPath()),l=Oe;continue}}break;case De:if("/"===o||"\\"===o){l=Pe;break}i&&"file"===i.scheme&&!fe(N(v(s,h),""))&&(pe(i.path[0],!0)?W(c.path,i.path[0]):c.host=i.host),l=Oe;continue;case Pe:if(o===r||"/"===o||"\\"===o||"?"===o||"#"===o){if(!t&&pe(u))l=Oe;else if(""===u){if(c.host="",t)return;l=ke}else{if(n=c.parseHost(u))return n;if("localhost"===c.host&&(c.host=""),t)return;u="",l=ke}continue}u+=o;break;case ke:if(c.isSpecial()){if(l=Oe,"/"!==o&&"\\"!==o)continue}else if(t||"?"!==o)if(t||"#"!==o){if(o!==r&&(l=Oe,"/"!==o))continue}else c.fragment="",l=xe;else c.query="",l=Ne;break;case Oe:if(o===r||"/"===o||"\\"===o&&c.isSpecial()||!t&&("?"===o||"#"===o)){if(".."===(d=G(d=u))||"%2e."===d||".%2e"===d||"%2e%2e"===d?(c.shortenPath(),"/"===o||"\\"===o&&c.isSpecial()||W(c.path,"")):me(u)?"/"===o||"\\"===o&&c.isSpecial()||W(c.path,""):("file"===c.scheme&&!c.path.length&&pe(u)&&(c.host&&(c.host=""),u=O(u,0)+":"),W(c.path,u)),u="","file"===c.scheme&&(o===r||"?"===o||"#"===o))for(;c.path.length>1&&""===c.path[0];)B(c.path);"?"===o?(c.query="",l=Ne):"#"===o&&(c.fragment="",l=xe)}else u+=he(o,ce);break;case Ve:"?"===o?(c.query="",l=Ne):"#"===o?(c.fragment="",l=xe):o!==r&&(c.path[0]+=he(o,ne));break;case Ne:t||"#"!==o?o!==r&&("'"===o&&c.isSpecial()?c.query+="%27":c.query+="#"===o?"%23":he(o,ne)):(c.fragment="",l=xe);break;case xe:o!==r&&(c.fragment+=he(o,de))}h++}},parseHost:function(e){var t,i,r;if("["===O(e,0)){if("]"!==O(e,e.length-1))return z;if(t=function(e){var t,i,r,s,o,a,n,d=[0,0,0,0,0,0,0,0],c=0,l=null,h=0,u=function(){return O(e,h)};if(":"===u()){if(":"!==O(e,1))return;h+=2,l=++c}for(;u();){if(8===c)return;if(":"!==u()){for(t=i=0;i<4&&V(ee,u());)t=16*t+D(u(),16),h++,i++;if("."===u()){if(0===i)return;if(h-=i,c>6)return;for(r=0;u();){if(s=null,r>0){if(!("."===u()&&r<4))return;h++}if(!V(Q,u()))return;for(;V(Q,u());){if(o=D(u(),10),null===s)s=o;else{if(0===s)return;s=10*s+o}if(s>255)return;h++}d[c]=256*d[c]+s,2!=++r&&4!==r||c++}if(4!==r)return;break}if(":"===u()){if(h++,!u())return}else if(u())return;d[c++]=t}else{if(null!==l)return;h++,l=++c}}if(null!==l)for(a=c-l,c=7;0!==c&&a>0;)n=d[c],d[c--]=d[l+a-1],d[l+--a]=n;else if(8!==c)return;return d}(H(e,1,-1)),!t)return z;this.host=t}else if(this.isSpecial()){if(e=_(e),V(te,e))return z;if(t=function(e){var t,i,r,s,o,a,n,d=F(e,".");if(d.length&&""===d[d.length-1]&&d.length--,(t=d.length)>4)return e;for(i=[],r=0;r<t;r++){if(""===(s=d[r]))return e;if(o=10,s.length>1&&"0"===O(s,0)&&(o=V(J,s)?16:8,s=H(s,8===o?1:2)),""===s)a=0;else{if(!V(10===o?Z:8===o?$:ee,s))return e;a=D(s,o)}W(i,a)}for(r=0;r<t;r++)if(a=i[r],r===t-1){if(a>=k(256,5-t))return null}else if(a>255)return null;for(n=L(i),r=0;r<i.length;r++)n+=i[r]*k(256,3-r);return n}(e),null===t)return z;this.host=t}else{if(V(ie,e))return z;for(t="",i=m(e),r=0;r<i.length;r++)t+=he(i[r],ne);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"===this.scheme},includesCredentials:function(){return""!==this.username||""!==this.password},isSpecial:function(){return p(ue,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"===this.scheme&&1===t&&pe(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,i=e.username,r=e.password,s=e.host,o=e.port,a=e.path,n=e.query,d=e.fragment,c=t+":";return null!==s?(c+="//",e.includesCredentials()&&(c+=i+(r?":"+r:"")+"@"),c+=ae(s),null!==o&&(c+=":"+o)):"file"===t&&(c+="//"),c+=e.cannotBeABaseURL?a[0]:a.length?"/"+N(a,"/"):"",null!==n&&(c+="?"+n),null!==d&&(c+="#"+d),c},setHref:function(e){var t=this.parse(e);if(t)throw new M(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"===e)try{return new We(e.path[0]).origin}catch(e){return"null"}return"file"!==e&&this.isSpecial()?e+"://"+ae(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(S(e)+":",ve)},getUsername:function(){return this.username},setUsername:function(e){var t=m(S(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var i=0;i<t.length;i++)this.username+=he(t[i],le)}},getPassword:function(){return this.password},setPassword:function(e){var t=m(S(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var i=0;i<t.length;i++)this.password+=he(t[i],le)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?ae(e):ae(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,Re)},getHostname:function(){var e=this.host;return null===e?"":ae(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,Te)},getPort:function(){var e=this.port;return null===e?"":S(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""===(e=S(e))?this.port=null:this.parse(e,Ie))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+N(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,ke))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""===(e=S(e))?this.query=null:("?"===O(e,0)&&(e=H(e,1)),this.query="",this.parse(e,Ne)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!==(e=S(e))?("#"===O(e,0)&&(e=H(e,1)),this.fragment="",this.parse(e,xe)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var We=function(e){var t=u(this,Ue),i=y(arguments.length,1)>1?arguments[1]:void 0,r=b(t,new Le(e,!1,i));o||(t.href=r.serialize(),t.origin=r.getOrigin(),t.protocol=r.getProtocol(),t.username=r.getUsername(),t.password=r.getPassword(),t.host=r.getHost(),t.hostname=r.getHostname(),t.port=r.getPort(),t.pathname=r.getPathname(),t.search=r.getSearch(),t.searchParams=r.getSearchParams(),t.hash=r.getHash())},Ue=We.prototype,Be=function(e,t){return{get:function(){return w(this)[e]()},set:t&&function(e){return w(this)[t](e)},configurable:!0,enumerable:!0}};if(o&&(h(Ue,"href",Be("serialize","setHref")),h(Ue,"origin",Be("getOrigin")),h(Ue,"protocol",Be("getProtocol","setProtocol")),h(Ue,"username",Be("getUsername","setUsername")),h(Ue,"password",Be("getPassword","setPassword")),h(Ue,"host",Be("getHost","setHost")),h(Ue,"hostname",Be("getHostname","setHostname")),h(Ue,"port",Be("getPort","setPort")),h(Ue,"pathname",Be("getPathname","setPathname")),h(Ue,"search",Be("getSearch","setSearch")),h(Ue,"searchParams",Be("getSearchParams")),h(Ue,"hash",Be("getHash","setHash"))),l(Ue,"toJSON",(function(){return w(this).serialize()}),{enumerable:!0}),l(Ue,"toString",(function(){return w(this).serialize()}),{enumerable:!0}),I){var Fe=I.createObjectURL,He=I.revokeObjectURL;Fe&&l(We,"createObjectURL",d(Fe,I)),He&&l(We,"revokeObjectURL",d(He,I))}A(We,"URL"),s({global:!0,constructor:!0,forced:!a,sham:!o},{URL:We})},3487:(e,t,i)=>{"use strict";i(6909)},8670:(e,t,i)=>{"use strict";var r=i(1091),s=i(5582),o=i(4787),a=i(160),n=i(4791),d=s("URL");r({target:"URL",stat:!0,forced:!n},{parse:function(e){var t=o(arguments.length,1),i=a(e),r=t<2||void 0===arguments[1]?void 0:a(arguments[1]);try{return new d(i,r)}catch(e){return null}}})},4783:()=>{},1960:(e,t,i)=>{"use strict";var r=i(2671);e.exports=r},6343:(e,t,i)=>{"use strict";var r=i(6880);e.exports=r},2222:(e,t,i)=>{"use strict";var r=i(6823);e.exports=r},4106:(e,t,i)=>{"use strict";var r=i(8059);e.exports=r},1086:(e,t,i)=>{"use strict";var r=i(2757);e.exports=r},4598:(e,t,i)=>{"use strict";var r=i(1042);e.exports=r},8251:(e,t,i)=>{"use strict";var r=i(1926);e.exports=r},9563:(e,t,i)=>{"use strict";var r=i(4776);e.exports=r},4139:(e,t,i)=>{"use strict";var r=i(3842);i(2560),e.exports=r},7045:(e,t,i)=>{"use strict";var r=i(1730);i(2560),e.exports=r},70:(e,t,i)=>{"use strict";var r=i(1661);e.exports=r},9792:(e,t,i)=>{"use strict";var r=i(6908);e.exports=r},9076:(e,t,i)=>{"use strict";i(6299),i(5042),i(7649),i(3604);var r=i(2046);e.exports=r.URLSearchParams},6908:(e,t,i)=>{"use strict";i(9076),i(3487),i(8669),i(8670),i(4783);var r=i(2046);e.exports=r.URL},7857:(e,t,i)=>{"use strict";i.d(t,{A:()=>d});var r=i(4997),s=i(2321),o=i(2231);function a(e){return a="function"==typeof s&&"symbol"==typeof o?function(e){return typeof e}:function(e){return e&&"function"==typeof s&&e.constructor===s&&e!==s.prototype?"symbol":typeof e},a(e)}var n=i(9280);function d(e,t,i){return(t=function(e){var t=function(e){if("object"!=a(e)||!e)return e;var t=e[n];if(void 0!==t){var i=t.call(e,"string");if("object"!=a(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==a(t)?t:t+""}(t))in e?r(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}},7026:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var r=i(913),s=i(3901);function o(e,t){if(null==e)return{};var i,o,a=function(e,t){if(null==e)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(s(t).call(t,r))continue;i[r]=e[r]}return i}(e,t);if(r){var n=r(e);for(o=0;o<n.length;o++)i=n[o],s(t).call(t,i)||{}.propertyIsEnumerable.call(e,i)&&(a[i]=e[i])}return a}}},s={};function o(e){var t=s[e];if(void 0!==t)return t.exports;var i=s[e]={id:e,loaded:!1,exports:{}};return r[e].call(i.exports,i,i.exports,o),i.loaded=!0,i.exports}return o.m=r,o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var i in t)o.o(t,i)&&!o.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((t,i)=>(o.f[i](e,t),t)),[])),o.u=e=>({208:"annoter",404:"pako",557:"wmsc"}[e]+".min.js"),o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},i="JsMediaSDK_Instance:",o.l=(e,r,s,a)=>{if(t[e])t[e].push(r);else{var n,d;if(void 0!==s)for(var c=document.getElementsByTagName("script"),l=0;l<c.length;l++){var h=c[l];if(h.getAttribute("src")==e||h.getAttribute("data-webpack")==i+s){n=h;break}}n||(d=!0,(n=document.createElement("script")).charset="utf-8",n.timeout=120,o.nc&&n.setAttribute("nonce",o.nc),n.setAttribute("data-webpack",i+s),n.src=e),t[e]=[r];var u=(i,r)=>{n.onerror=n.onload=null,clearTimeout(p);var s=t[e];if(delete t[e],n.parentNode&&n.parentNode.removeChild(n),s&&s.forEach((e=>e(r))),i)return i(r)},p=setTimeout(u.bind(null,void 0,{type:"timeout",target:n}),12e4);n.onerror=u.bind(null,n.onerror),n.onload=u.bind(null,n.onload),d&&document.head.appendChild(n)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var i=t.getElementsByTagName("script");if(i.length)for(var r=i.length-1;r>-1&&(!e||!/^http(s?):/.test(e));)e=i[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{o.l=function(e,t,i,r){if("undefined"!=typeof globalThis&&globalThis.__MEDIA_SDK_CHUNK_LOADER__)globalThis.__MEDIA_SDK_CHUNK_LOADER__.loadScript(e,t,i,r);else{var s=document.createElement("script");s.src=e,s.onload=s.onerror=t,document.head.appendChild(s)}};var e={};o.f.j=function(t,i){var r=e[t];if(0!==r)if(r)i.push(r[2]);else{var s=new Promise((function(i,s){r=e[t]=[i,s];var a=o.p+o.u(t);o.l(a,(function(i){if(0!==e[t]){var r=new Error("Loading chunk "+t+" failed.");r.name="ChunkLoadError",e[t][1](r)}}),"chunk-"+t,t)}));i.push(r[2]=s)}};var t=function(t,i){var r,s,a=i[0],n=i[1],d=i[2],c=0;if(a.some((function(t){return 0!==e[t]}))){for(r in n)o.o(n,r)&&(o.m[r]=n[r]);d&&d(o)}for(t&&t(i);c<a.length;c++)s=a[c],e[s]&&e[s][0](),e[s]=0},i=self.__MEDIA_SDK_CHUNK_LOADER__=self.__MEDIA_SDK_CHUNK_LOADER__||[];i.forEach(t.bind(null,0)),i.push=t.bind(null,i.push.bind(i))})(),o(4497)})()));
3
+ //# sourceMappingURL=https://d1cdksi819e9z7.cloudfront.net/sourcemap/js_media.min.js-6754bc15703eed27bb73.map