UNPKG

@zoom/meetingsdk

Version:
1 lines 531 kB
!function(e){var t={};function r(i){if(t[i])return t[i].exports;var a=t[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,r),a.l=!0,a.exports}r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(i,a,function(t){return e[t]}.bind(null,a));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=56)}([function(e,t,r){var i=r(40),a=r(33);e.exports=function(e,t){var r=a(e,t,"get");return i(e,r)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){var i=r(41),a=r(33);e.exports=function(e,t,r){var s=a(e,t,"set");return i(e,s,r),r},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";r.d(t,"C",(function(){return i})),r.d(t,"j",(function(){return a})),r.d(t,"t",(function(){return s})),r.d(t,"k",(function(){return n})),r.d(t,"v",(function(){return o})),r.d(t,"x",(function(){return l})),r.d(t,"p",(function(){return h})),r.d(t,"s",(function(){return c})),r.d(t,"q",(function(){return u})),r.d(t,"r",(function(){return d})),r.d(t,"a",(function(){return f})),r.d(t,"b",(function(){return p})),r.d(t,"w",(function(){return g})),r.d(t,"g",(function(){return m})),r.d(t,"y",(function(){return v})),r.d(t,"z",(function(){return b})),r.d(t,"A",(function(){return _})),r.d(t,"B",(function(){return y})),r.d(t,"e",(function(){return w})),r.d(t,"d",(function(){return T})),r.d(t,"c",(function(){return x})),r.d(t,"f",(function(){return R})),r.d(t,"n",(function(){return E})),r.d(t,"o",(function(){return S})),r.d(t,"m",(function(){return M})),r.d(t,"l",(function(){return C})),r.d(t,"h",(function(){return A})),r.d(t,"u",(function(){return P})),r.d(t,"i",(function(){return k}));const i={AVAILABLE:0,NOT_SUPPORTED:1,CANNOT_REQ_ADAPTER:2,CANNOT_REQ_DEVICE:3},a={AUTO:-1,UNDEFINED:0,WEBGL:1,WEBGPU:2,WEBGL_2:3},s={AVAILABLE:0,VIDEO:1,SHARE:2},n={IDLE:0,PENDING:1,READY:2,RENDERING:3},o={UNKNOWN:-1,BASE_LAYER:0,BLEND_LAYER:1},l={UNKNOWN:-1,EXTERNAL_TEX:0,GPU_TEX_YUV:1,GPU_TEX_RGBA:2,CLEAR_COLOR:3},h=0,c=1,u=2,d=3,f=[{u:1,v:0},{u:1,v:1},{u:0,v:1},{u:1,v:0},{u:0,v:0},{u:0,v:1}],p=[{x:1,y:1},{x:1,y:-1},{x:-1,y:-1},{x:1,y:1},{x:-1,y:1},{x:-1,y:-1}],g={VS_BASE:0,CURSOR:1,WATERMARK:2,MASK:3,END:4},m=["intel","nvidia","apple","amd","qualcomm","arm"],v="\n struct VertexOutput {\n @builtin(position) Position: vec4<f32>,\n @location(0) uv: vec2<f32>,\n };\n \n struct FsUniforms {\n rotation: f32,\n };\n \n @group(0) @binding(0) var vfSampler: sampler;\n @group(0) @binding(1) var vfTexture: texture_external;\n @group(0) @binding(2) var<uniform> vertexUniforms: FsUniforms;\n \n @vertex\n fn vertex_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) vtxPos: vec2<f32>,\n @location(1) uvPos: vec2<f32>\n ) -> VertexOutput {\n \n var output: VertexOutput;\n output.Position = vec4<f32>(vtxPos, 0.0, 1.0);\n \n if (vertexUniforms.rotation == 0) {\n output.uv = vec2f(uvPos.x, 1 - uvPos.y); \n } else if (vertexUniforms.rotation == 1) {\n output.uv = vec2f(1 - uvPos.y, 1 - uvPos.x);\n } else if (vertexUniforms.rotation == 2) {\n output.uv = vec2f(uvPos.x, uvPos.y);\n } else if (vertexUniforms.rotation == 3) {\n output.uv = vec2f(uvPos.y, uvPos.x);\n } else {\n output.uv = uvPos;\n }\n \n return output;\n }\n \n @fragment\n fn fragment_main(@location(0) uv : vec2<f32>) -> @location(0) vec4<f32> {\n var color: vec4<f32> = textureSampleBaseClampToEdge(vfTexture, vfSampler, uv);\n return color;\n }\n ",b="\n struct VertexOutput {\n @builtin(position) Position: vec4<f32>,\n @location(0) uv: vec2<f32>,\n };\n \n @group(0) @binding(6) var<uniform> vertexUniforms: FsUniforms;\n \n @vertex\n fn vertex_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) vtxPos: vec2<f32>,\n @location(1) uvPos: vec2<f32>\n ) -> VertexOutput {\n \n var output: VertexOutput;\n output.Position = vec4<f32>(vtxPos, 0.0, 1.0);\n \n if (vertexUniforms.rotation == 0) {\n output.uv = vec2f(uvPos.x, 1 - uvPos.y); \n } else if (vertexUniforms.rotation == 1) {\n output.uv = vec2f(1 - uvPos.y, 1 - uvPos.x);\n } else if (vertexUniforms.rotation == 2) {\n output.uv = vec2f(uvPos.x, uvPos.y);\n } else if (vertexUniforms.rotation == 3) {\n output.uv = vec2f(uvPos.y, uvPos.x);\n } else {\n output.uv = uvPos;\n }\n \n return output;\n }\n \n struct FsUniforms {\n yuvMode: f32,\n colorRange: f32,\n rotation: f32,\n };\n \n @group(0) @binding(0) var yPlaneSampler: sampler;\n @group(0) @binding(1) var uvPlaneSampler: sampler;\n @group(0) @binding(2) var yPlaneTex: texture_2d<f32>;\n @group(0) @binding(3) var uPlaneTex: texture_2d<f32>;\n @group(0) @binding(4) var vPlaneTex: texture_2d<f32>;\n @group(0) @binding(5) var<uniform> uniforms: FsUniforms;\n // @group(0) @binding(7) var<storage, read_write> outputBuffer: array<f32>;\n \n @fragment\n fn fragment_main(@location(0) uv : vec2<f32>) -> @location(0) vec4<f32> {\n let y = textureSampleBaseClampToEdge(yPlaneTex, yPlaneSampler, uv).r;\n var u: f32;\n var v: f32;\n if (uniforms.yuvMode == 1) {\n u = textureSampleBaseClampToEdge(uPlaneTex, uvPlaneSampler, uv).r;\n v = textureSampleBaseClampToEdge(vPlaneTex, uvPlaneSampler, uv).r;\n } else {\n u = textureSampleBaseClampToEdge(uPlaneTex, uvPlaneSampler, uv).r;\n v = textureSampleBaseClampToEdge(uPlaneTex, uvPlaneSampler, uv).a;\n }\n \n const yuv2RGB_L = mat4x4(\n 1.1643835616, 0, 1.7927410714, -0.9729450750,\n 1.1643835616, -0.2132486143, -0.5329093286, 0.3014826655,\n 1.1643835616, 2.1124017857, 0, -1.1334022179,\n 0, 0, 0, 1\n );\n \n const yuv2RGB_F = mat4x4(\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 var color = vec4<f32>(y, u, v, 1.0);\n if (uniforms.colorRange == 0) {\n color = color * yuv2RGB_L;\n } else {\n color = color * yuv2RGB_F;\n }\n \n return color;\n }\n ",_="\n struct VertexOutput {\n @builtin(position) Position: vec4<f32>,\n @location(0) uv: vec2<f32>,\n };\n \n @group(0) @binding(5) var<uniform> vertexUniforms: FsUniforms;\n @vertex\n fn vertex_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) vtxPos: vec2<f32>,\n @location(1) uvPos: vec2<f32>\n ) -> VertexOutput {\n \n var output: VertexOutput;\n output.Position = vec4<f32>(vtxPos, 0.0, 1.0);\n \n if (vertexUniforms.rotation == 0) {\n output.uv = vec2f(uvPos.x, 1 - uvPos.y); \n } else if (vertexUniforms.rotation == 1) {\n output.uv = vec2f(1 - uvPos.y, 1 - uvPos.x);\n } else if (vertexUniforms.rotation == 2) {\n output.uv = vec2f(uvPos.x, uvPos.y);\n } else if (vertexUniforms.rotation == 3) {\n output.uv = vec2f(uvPos.y, uvPos.x);\n } else {\n output.uv = uvPos;\n }\n \n return output;\n }\n \n struct FsUniforms {\n yuvMode: f32,\n colorRange: f32,\n rotation: f32,\n };\n \n @group(0) @binding(0) var yPlaneSampler: sampler;\n @group(0) @binding(1) var uvPlaneSampler: sampler;\n @group(0) @binding(2) var yPlaneTex: texture_2d<f32>;\n @group(0) @binding(3) var uPlaneTex: texture_2d<f32>;\n @group(0) @binding(4) var<uniform> uniforms: FsUniforms;\n // @group(0) @binding(5) var<storage, read_write> outputBuffer: array<f32>;\n \n @fragment\n fn fragment_main(@location(0) uv : vec2<f32>) -> @location(0) vec4<f32> {\n let y = textureSampleBaseClampToEdge(yPlaneTex, yPlaneSampler, uv).r;\n var u: f32;\n var v: f32;\n u = textureSampleBaseClampToEdge(uPlaneTex, uvPlaneSampler, uv).r;\n v = textureSampleBaseClampToEdge(uPlaneTex, uvPlaneSampler, uv).g;\n \n const yuv2RGB_L = mat4x4(\n 1.1643835616, 0, 1.7927410714, -0.9729450750,\n 1.1643835616, -0.2132486143, -0.5329093286, 0.3014826655,\n 1.1643835616, 2.1124017857, 0, -1.1334022179,\n 0, 0, 0, 1\n );\n \n const yuv2RGB_F = mat4x4(\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 var color = vec4<f32>(y, u, v, 1.0);\n if (uniforms.colorRange == 0) {\n color = color * yuv2RGB_L;\n } else {\n color = color * yuv2RGB_F;\n }\n \n // outputBuffer[0] = y;\n // outputBuffer[1] = u;\n // outputBuffer[2] = v;\n // outputBuffer[3] = color.r;\n // outputBuffer[4] = color.g;\n // outputBuffer[5] = color.b;\n // outputBuffer[6] = color.a;\n \n return color;\n }\n ",y="\n @group(0) @binding(0) var watermarkSampler: sampler;\n @group(0) @binding(1) var watermarkTex: texture_2d<f32>;\n \n struct VertexOutput {\n @builtin(position) Position: vec4<f32>,\n @location(0) uv: vec2<f32>,\n };\n \n @vertex\n fn v_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) pos: vec2<f32>,\n @location(1) uvPos: vec2<f32>\n ) -> VertexOutput {\n \n var output: VertexOutput;\n output.Position = vec4<f32>(pos, 0.0, 1.0);\n output.uv = vec2f(uvPos.x, uvPos.y);\n return output;\n }\n \n @fragment\n fn f_main(@location(0) uv: vec2<f32>) -> @location(0) vec4<f32> {\n var color: vec4<f32> = textureSampleBaseClampToEdge(watermarkTex, watermarkSampler, uv);\n if (color.r == 0 && color.g == 0 && color.b == 0) {\n color.a = 0;\n }\n return color;\n }\n ",w="\n \n struct FsUniforms {\n cursorFlag: f32,\n cursorInfo: vec4f\n };\n \n @group(0) @binding(0) var cursorSampler: sampler;\n @group(0) @binding(1) var cursorTex: texture_2d<f32>;\n @group(0) @binding(2) var<uniform> uniforms: FsUniforms;\n \n struct VertexOutput {\n @builtin(position) Position: vec4<f32>,\n @location(0) uv: vec2<f32>,\n };\n \n @vertex\n fn v_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) pos: vec2<f32>,\n @location(1) uvPos: vec2<f32>\n ) -> VertexOutput {\n \n var output: VertexOutput;\n output.Position = vec4<f32>(pos, 0.0, 1.0);\n output.uv = vec2f(uvPos.x, 1 - uvPos.y);\n return output;\n }\n \n @fragment\n fn f_main(@location(0) uv: vec2<f32>) -> @location(0) vec4<f32> {\n var color: vec4<f32> = textureSampleBaseClampToEdge(cursorTex, cursorSampler, uv);\n // if (uniforms.cursorFlag == 1) {\n // if (uniforms.cursorInfo.z > 0.0 \n // && uv.x >= uniforms.cursorInfo.x\n // && uv.y >= uniforms.cursorInfo.y\n // && uv.x < uniforms.cursorInfo.x + uniforms.cursorInfo.z\n // && uv.y < uniforms.cursorInfo.y + uniforms.cursorInfo.w) {\n \n // var cursorCoord: vec2f = uv - uniforms.cursorInfo.xy;\n // cursorCoord = cursorCoord / uniforms.cursorInfo.zw;\n // var cursorColor: vec4<f32> = textureSampleBaseClampToEdge(cursorTex, cursorSampler, cursorCoord);\n // color = color * (1.0 - cursorColor.a) + cursorColor * cursorColor.a;\n // }\n // }\n \n return color;\n }\n ",T="\n @vertex\n fn v_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) vtxPos: vec2<f32>,\n ) -> @builtin(position) vec4<f32> {\n return vec4<f32>(vtxPos, 0.0, 1.0);\n }\n \n @fragment\n fn f_main() -> @location(0) vec4<f32> {\n return vec4(0.0, 0.0, 0.0, 1.0);\n }\n ",x="\n @vertex\n fn v_main(\n @builtin(vertex_index) VertexIndex: u32,\n @location(0) vtxPos: vec2<f32>,\n ) -> @builtin(position) vec4<f32> {\n return vec4<f32>(vtxPos, 0.0, 1.0);\n }\n \n struct ClearColorUniforms {\n clearColor: vec4<f32>,\n };\n \n @group(0) @binding(0) var<uniform> uniforms: ClearColorUniforms;\n @fragment\n fn f_main() -> @location(0) vec4<f32> {\n return uniforms.clearColor;\n }\n ",R={TEXTURE_BUFFER:0,VERTEX_BUFFER:1,TEXTURE:2},E={LOW:0,MEDIUM:1,HIGH:2,OVERUSE:3},S={LOW:6e4,MEDIUM:45e3,HIGH:3e4,OVERUSE:15e3},M=[60,120,180,360,540,720,1080,2160],C={VIDEO_FRAME:0,YUV_I420:1,YUV_NV12:2,RGBA_WATERMARK:3,RGBA_CURSOR:4,CLEAR_COLOR:5},A=6,P=[180,360,540,720,1080,2160],k=5},function(e,t,r){"use strict";var i=r(5),a=r(16);new Error;const s=new Map;function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"|";return e?e.toString().replaceAll(/[,,]/g,t):""}let o=null,l=null;function h(e,t){var r,i;if(!function(e){const t=performance.now();return(!s.has(e)||t-s.get(e)>5e3)&&(s.set(e,t),!0)}(e))return;let h;try{h=n("object"==typeof t?JSON.stringify(t):t)}catch(e){h=n(t)}null===(r=l)||void 0===r||r("NEM-".concat(e,"-").concat(h)),a.a.error("NotifyUIError,event=".concat(e,",data=").concat(h)),null===(i=o)||void 0===i||i(e,t)}var c=r(15);function u(){return self.GROWABLE_HEAP_I8?self.GROWABLE_HEAP_I8():Module.HEAP8}function d(){return self.GROWABLE_HEAP_U8?self.GROWABLE_HEAP_U8():Module.HEAPU8}function f(){return self.GROWABLE_HEAP_U16?self.GROWABLE_HEAP_U16():Module.HEAPU16}function p(){return self.GROWABLE_HEAP_U32?self.GROWABLE_HEAP_U32():Module.HEAPU32}function g(){return self.GROWABLE_HEAP_F32?self.GROWABLE_HEAP_F32():Module.HEAPF32}async function m(e,t){try{const r=await new Promise((e,t)=>{const r=i=>{let a=i.data;"DOWNLOAD_WASM_FROM_MAIN_THREAD_OK"===a.command?(w("DE"),self.removeEventListener("message",r),e(a.data)):"DOWNLOAD_WASM_FROM_MAIN_THREAD_FAILED"===a.command&&(self.removeEventListener("message",r),t(new Error("Failed to download WASM file: ".concat(wasmUrl," from main thread"))))};self.addEventListener("message",r),w("DS"),postMessage({status:i.E,url:wasmUrl})});let a=await WebAssembly.instantiate(r,e);a.instance?(self.wasmModuleToShare=a.module,t(a.instance)):(self.wasmModuleToShare=r,t(a))}catch(e){w("IF"),_("E:H Failed to download and instantiate WASM file: ".concat(wasmUrl),e)}}r.d(t,"d",(function(){return u})),r.d(t,"g",(function(){return d})),r.d(t,"e",(function(){return f})),r.d(t,"f",(function(){return p})),r.d(t,"c",(function(){return g})),r.d(t,"q",(function(){return m})),r.d(t,"i",(function(){return b})),r.d(t,"u",(function(){return _})),r.d(t,"t",(function(){return y})),r.d(t,"o",(function(){return w})),r.d(t,"n",(function(){return T})),r.d(t,"v",(function(){return x})),r.d(t,"w",(function(){return R})),r.d(t,"p",(function(){return E})),r.d(t,"s",(function(){return M})),r.d(t,"k",(function(){return C})),r.d(t,"m",(function(){return A})),r.d(t,"r",(function(){return L})),r.d(t,"l",(function(){return I})),r.d(t,"x",(function(){return G})),r.d(t,"b",(function(){return V})),r.d(t,"h",(function(){return F})),r.d(t,"y",(function(){return N})),r.d(t,"a",(function(){return j})),r.d(t,"j",(function(){return H}));const v="function"!=typeof importScripts;function b(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;v?a.a.error(e,t):_(e,t)}function _(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;var r,a,s,n;(t instanceof Error||t instanceof ErrorEvent)&&(e+=" Message: "+(null===(r=t)||void 0===r?void 0:r.message)+" Stack: "+(null!==(a=null===(s=t)||void 0===s||null===(s=s.error)||void 0===s?void 0:s.stack)&&void 0!==a?a:null===(n=t)||void 0===n?void 0:n.stack),t=null);postMessage({status:i.G,errorMessage:e,errorEvent:t})}function y(e){postMessage({status:i.G,errorMessage:e,level:"low"})}function w(e){postMessage({status:i.zb,data:e})}function T(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t)return t.postMessage({status:i.f,data:e});postMessage({status:i.f,data:e})}function x(e){postMessage({status:i.M,canvasId:e,replaceCanvas:!1})}function R(e){postMessage({status:i.N,canvasId:e})}function E(e){v?h(c.k,e):postMessage({status:i.Bb,where:e})}function S(){let e=this;this.promise=new Promise((function(t,r){e.reject=r,e.resolve=t}))}function M(e){let t;try{if(t=null==e?void 0:e.getContext("2d",{willReadFrequently:!0}),!t)throw new Error("getContext return null for willReadFrequently, canvas:".concat(e))}catch(r){t=null==e?void 0:e.getContext("2d")}return t||_("get2DContextFromCanvas return null"),t}class C{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15e5;this.uint8Map={},this.availableIndex=[],this.capacity=e,this.bytesPerElement=t,this.avaiableIndexMap={},this.deferedList=[];for(let r=0;r<e;r++)this.uint8Map[r]=new Uint8Array(t),this.availableIndex.push(r),this.avaiableIndexMap[r]=!0}increaseBufferSize(e){let t=this.bytesPerElement+e;this.bytesPerElement=t;for(let e=0;e<this.capacity;e++){let r=this.uint8Map[e],i=new Uint8Array(t);i.set(r,0),this.uint8Map[e]=i}}getCapacity(){return this.capacity}get(){if(this.availableIndex.length>0){let e=this.availableIndex.shift();return this.avaiableIndexMap[e]=!1,new Promise((t,r)=>{t({index:e,uint8s:this.uint8Map[e]})})}{let e=new S;return this.deferedList.push(e),e.promise}}getSync(){if(this.availableIndex.length>0){let e=this.availableIndex.shift();return this.avaiableIndexMap[e]=!1,{index:e,uint8s:this.uint8Map[e]}}return null}recycle(e){if(!0!==this.avaiableIndexMap[e]&&(this.avaiableIndexMap[e]=!0,this.availableIndex.push(e),this.deferedList.length>0)){this.deferedList.shift().resolve(this.get())}}}class A{constructor(e){this.sharedBufferList=e}storeFlexible(e,t){let r=e.byteLength-this.sharedBufferList.bytesPerElement;if(r>0){let e=Math.floor(.1*this.sharedBufferList.bytesPerElement),i=r>e?r:e;if(i+this.sharedBufferList.bytesPerElement>t)return Promise.reject("too big, more than maxBytesPerElement");this.sharedBufferList.increaseBufferSize(i)}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}catch(e){throw e}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){_("Error in YuvWrap.recycle: ".concat(e))}}}function P(e,t){t>=e.groupSize||(e.openStatusArray[t]?console.warn("group web transport index ".concat(t,", status reopene")):(e.openStatusArray[t]=!0,e.openedCount+=1,e.openedCount>1||e.params.onopen(e)))}function k(e,t){t>=e.groupSize||(e.openStatusArray[t]?(e.openStatusArray[t]=!1,e.openedCount>0&&(e.openedCount-=1,0==e.openedCount&&e.params.onclose(e))):console.warn("group web transport index ".concat(t,", not open")))}const O=["","MOZ_","OP_","WEBKIT_"];function L(e,t){for(var r=0;r<O.length;++r){var i=O[r]+t,a=e.getExtension(i);if(a)return a}}class I{constructor(e){this.params=e,this.label=this.params.label||"",this.id=this.params.id||0,this.groupSize=e.groupSize,this.openedCount=0,this.sendIndex=0,this.transportArray=[],this.openStatusArray=[];for(let e=0;e<this.groupSize;e++)this.transportArray.push(null),this.openStatusArray.push(!1)}async connect(){for(let e=0;e<this.groupSize;e++){let t=this.params.url;e>0&&(t+="&index="+e);let r={url:t,label:this.params.label,id:this.id,onmessage:this.params.onmessage,onopen:P,onclose:k,group:this,index:e},i=new U(r);await i.connect(),this.transportArray[e]=i}}send(e){if(!(this.openedCount<=0))for(let t=0;t<this.groupSize;t++){this.sendIndex+=1;let t=this.sendIndex%this.groupSize;if(this.transportArray[t]&&this.openStatusArray[t]){this.transportArray[t].send(e);break}}}forceClose(){for(let e=0;e<this.groupSize;e++)this.transportArray[e]&&this.transportArray[e].forceClose()}}class U{constructor(e){this.params=e,this.label=this.params.label||"",this.id=this.params.id||0,this.successfulConnectedCount=0,this.connectIndex=0,this.heartbeat=new Uint8Array([104,101,97,114,116,98,101,97,116]),this.transport=null,this.transport_ready=!1,this.isDestroyed=!1,this.inReading=!1,this.heartbeatStarted=!1,this.reader=null}async connect(){this.reconnect()}async reconnect(){if(this.isReconnectNow||this.isTimerExist||this.isDestroyed)return;this.isReconnectNow=!0,this.isTimerExist=!0;let e=Math.pow(2,this.connectIndex)-1;this.connectIndex+=1,setTimeout(async()=>{if(this.isDestroyed)return;this.isTimerExist=!1;let{url:e}=this.params,t=new WebTransport(e);this.transport=t,t.closed.then(()=>{this.reader=null,this.transport_ready=!1,this.params.onclose&&this.params.onclose(this.params.group,this.params.index)}).catch(e=>{this.reader=null,this.transport_ready=!1,this.params.onerror&&this.params.onerror(e),this.params.onclose(this.params.group,this.params.index),this.connectIndex<8&&this.reconnect()});try{if(this.isReconnectNow=!1,await t.ready,this.isDestroyed)return void this.close();this.transport_ready=!0,this.successfulConnectedCount++,t.datagrams.incomingMaxAge=1e3,t.datagrams.outgoingMaxAge=100,t.datagrams.incomingHighWaterMark=800,t.datagrams.outgoingHighWaterMark=800,this.writer=t.datagrams.writable.getWriter(),this.reader=t.datagrams.readable.getReader(),await this.writer.ready,this.params.onopen(this.params.group,this.params.index)}catch(e){return this.params.onerror&&this.params.onerror(e),void this.close()}this.startHeartbeat(),this.read()},1e3*e)}send(e){this.transport_ready&&this.writer.write(e)}async sendAwaitReady(e){this.transport_ready&&await this.writer.ready,this.transport_ready&&await this.writer.write(e)}async startHeartbeat(){if(!this.heartbeatStarted)for(this.heartbeatStarted=!0;;)try{await this.sleep(3e3),await this.sendAwaitReady(this.heartbeat)}catch(e){}}sleep(e){return new Promise(t=>setTimeout(t,e))}localTime(){let e=new Date;return"local time : "+e.getDate()+"/"+(e.getMonth()+1)+"/"+e.getFullYear()+" @ "+e.getHours()+":"+e.getMinutes()+":"+e.getSeconds()+" "}close(){try{this.transport_ready=!1,this.transport&&this.transport.close()}catch(e){}}forceClose(){this.isDestroyed||(this.isDestroyed=!0,this.close())}async read(){if(!this.inReading){for(this.inReading=!0;this.reader;)try{const{value:e,done:t}=await this.reader.read();if(t)break;this.params.onmessage(e)}catch(e){break}this.inReading=!1}}}const D=new Map,B=[90,180,360,720,1080],W=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 r=this.ssrcInfoMap.get(e);if(0===r.frames?r.firstTime=t:r.lastTime=t,r.frames+=1,r.frames>2&&r.frames%5==0&&r.lastTime-r.firstTime>=1e3){const t=Math.floor(1e3/((r.lastTime-r.firstTime)/(r.frames-1)));r.fps!==t&&(this._notifyFPS(e,t),r.fps=t),r.firstTime=r.lastTime,r.frames=1}}_removeZeroFPS(){let e=Date.now();this.ssrcInfoMap.forEach((t,r)=>{const i=this.ssrcInfoMap.get(r);i&&e-i.lastTime>2e3&&(this.ssrcInfoMap.delete(r),this._notifyFPS(r,0))})}_notifyFPS(e,t){postMessage({status:i.u,data:{ssrc:e,fps:t}})}_checkIfNewFrameComing(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.timer=setTimeout(()=>{this._removeZeroFPS(),this.timer=null},2500)}};function G(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const{r_w:a,r_h:s,rotation:n,ssrc:o}=e;let l=1==n||3==n,h=l?s:a,c=l?a:s;const u=o>>10<<10,d=B.reduce((e,t)=>Math.abs(e-c)>Math.abs(t-c)?t:e,B[0]),f=B.findIndex(e=>e===d);if(!D.get(u)||D.get(u).width!==h||D.get(u).height!==c){const e={width:h,height:c,ssrc:u,quality:f};D.set(u,e),r?r(e):postMessage({status:i.v,data:e})}t&&W.updateSSRCInfo(u,Date.now())}function V(e,t){return e&&t?Math.abs(e/t-4/3)<.01?2:Math.abs(e/t-16/9)<.01?3:1:1}function F(e,t,r,i,a){if(!a&&!i||1==e)return!1;let s=i&&t>=640,n=a&&t>=1280;return 2!=e||640==t&&480==r?s||n:((s||n)&&b("ratio is 4:3 but wencodec not supported width: ".concat(t,", height: ").concat(r)),!1)}function N(e,t){e?e.send(t):_("websocket is null",new Error("message type ".concat(t[0])))}function j(e){return e&&"undefined"!=typeof atob?Uint8Array.from(atob(e),e=>e.charCodeAt(0)):null}function H(e,t){return t&&(!e||e.websocketaddress!=t)}},function(e,t,r){"use strict";r.d(t,"y",(function(){return i})),r.d(t,"Y",(function(){return a})),r.d(t,"L",(function(){return s})),r.d(t,"K",(function(){return n})),r.d(t,"J",(function(){return o})),r.d(t,"v",(function(){return l})),r.d(t,"q",(function(){return h})),r.d(t,"r",(function(){return c})),r.d(t,"w",(function(){return u})),r.d(t,"x",(function(){return d})),r.d(t,"u",(function(){return f})),r.d(t,"X",(function(){return p})),r.d(t,"P",(function(){return g})),r.d(t,"Q",(function(){return m})),r.d(t,"O",(function(){return v})),r.d(t,"M",(function(){return b})),r.d(t,"s",(function(){return _})),r.d(t,"k",(function(){return y})),r.d(t,"n",(function(){return w})),r.d(t,"l",(function(){return T})),r.d(t,"m",(function(){return x})),r.d(t,"db",(function(){return R})),r.d(t,"B",(function(){return E})),r.d(t,"C",(function(){return S})),r.d(t,"W",(function(){return M})),r.d(t,"ab",(function(){return C})),r.d(t,"V",(function(){return A})),r.d(t,"Z",(function(){return P})),r.d(t,"N",(function(){return k})),r.d(t,"h",(function(){return O})),r.d(t,"g",(function(){return L})),r.d(t,"f",(function(){return I})),r.d(t,"A",(function(){return U})),r.d(t,"z",(function(){return D})),r.d(t,"S",(function(){return B})),r.d(t,"R",(function(){return W})),r.d(t,"e",(function(){return G})),r.d(t,"o",(function(){return V})),r.d(t,"T",(function(){return F})),r.d(t,"U",(function(){return N})),r.d(t,"G",(function(){return j})),r.d(t,"E",(function(){return H})),r.d(t,"H",(function(){return q})),r.d(t,"I",(function(){return X})),r.d(t,"F",(function(){return Y})),r.d(t,"bb",(function(){return z})),r.d(t,"c",(function(){return K})),r.d(t,"b",(function(){return Q})),r.d(t,"cb",(function(){return J})),r.d(t,"d",(function(){return Z})),r.d(t,"t",(function(){return $})),r.d(t,"D",(function(){return ee})),r.d(t,"p",(function(){return te})),r.d(t,"a",(function(){return re})),r.d(t,"j",(function(){return ie})),r.d(t,"i",(function(){return ae}));const i=1e3,a=5,s=43,n=44,o=45,l=0,h=1,c=146,u=2,d=7,f=9,p=17,g=10,m=11,v=12,b=102,_=107,y=0,w=1,T=2,x=3,R=65,E=0,S=1,M=-1,C=0,A=1,P=2,k=3,O=1,L=2,I=3,U={SESSION_TYPE_CONF:0,SESSION_TYPE_AUDIO:1,SESSION_TYPE_DESKSHARE:2,SESSION_TYPE_VIDEO:3,SESSION_TYPE_CHAT:4,SESSION_TYPE_TELEPHONE:5,SESSION_TYPE_ZC_PING:6,SESSION_TYPE_TOTAL_CNT:7},D={CONNECT_TYPE_UDP:0,CONNECT_TYPE_TCP:1},B=24,W=20,G=15,V=10,F=8294400,N=5,j=0,H=1,q=2,X=15,Y=5,z=400,K=7,Q=8,J={DESKTOP:0,MOBILE:1,ANDROID:2,IPHONE:3},Z={DESKTOP_SOURCE:0,UAC_SOURCE:1},$={SHARE_REMOTE_CONTROL_UAC_MOUSE:144,SHARE_REMOTE_CONTROL_UAC_JPEG_FRAME:145},ee=1,te=25,re=1,ie=(new Map([["useinbandfec",{value:1,operater:"add"}],["maxaveragebitrate",{value:48e3,operater:"add"}],["maxplaybackrate",{value:24e3,operater:"add"}],["sprop-maxcapturerate",{value:24e3,operater:"add"}],["sprop-stereo",{value:1,operater:"sub"}],["stereo",{value:1,operater:"sub"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:96e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:96e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:128e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:128e3,operater:"add"}],["maxplaybackrate",{value:48e3,operater:"add"}],["sprop-maxcapturerate",{value:48e3,operater:"add"}],["sprop-stereo",{value:1,operater:"add"}],["stereo",{value:1,operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"sub"}],["maxaveragebitrate",{value:"96000",operater:"add"}],["maxplaybackrate",{value:"48000",operater:"add"}],["sprop-maxcapturerate",{value:"48000",operater:"add"}]]),new Map([["useinbandfec",{value:1,operater:"add"}],["maxaveragebitrate",{value:64e3,operater:"add"}],["maxplaybackrate",{value:24e3,operater:"add"}],["sprop-maxcapturerate",{value:24e3,operater:"add"}],["sprop-stereo",{value:1,operater:"sub"}],["stereo",{value:1,operater:"sub"}]]),{VIDEO:0,SHARE:1}),ae={PAUSE:0,RESUME:1,STOP:2}},function(e,t,r){"use strict";r.d(t,"j",(function(){return i})),r.d(t,"h",(function(){return a})),r.d(t,"l",(function(){return s})),r.d(t,"sb",(function(){return n})),r.d(t,"qb",(function(){return o})),r.d(t,"ub",(function(){return l})),r.d(t,"Z",(function(){return h})),r.d(t,"d",(function(){return c})),r.d(t,"bb",(function(){return u})),r.d(t,"db",(function(){return d})),r.d(t,"D",(function(){return f})),r.d(t,"ob",(function(){return p})),r.d(t,"H",(function(){return g})),r.d(t,"Eb",(function(){return m})),r.d(t,"n",(function(){return v})),r.d(t,"vb",(function(){return b})),r.d(t,"E",(function(){return _})),r.d(t,"b",(function(){return y})),r.d(t,"zb",(function(){return w})),r.d(t,"S",(function(){return T})),r.d(t,"I",(function(){return x})),r.d(t,"T",(function(){return R})),r.d(t,"xb",(function(){return E})),r.d(t,"f",(function(){return S})),r.d(t,"nb",(function(){return M})),r.d(t,"mb",(function(){return C})),r.d(t,"eb",(function(){return A})),r.d(t,"X",(function(){return P})),r.d(t,"V",(function(){return k})),r.d(t,"a",(function(){return O})),r.d(t,"z",(function(){return L})),r.d(t,"Fb",(function(){return I})),r.d(t,"G",(function(){return U})),r.d(t,"wb",(function(){return D})),r.d(t,"v",(function(){return B})),r.d(t,"u",(function(){return W})),r.d(t,"t",(function(){return G})),r.d(t,"w",(function(){return V})),r.d(t,"U",(function(){return F})),r.d(t,"jb",(function(){return N})),r.d(t,"kb",(function(){return j})),r.d(t,"R",(function(){return H})),r.d(t,"hb",(function(){return q})),r.d(t,"ib",(function(){return X})),r.d(t,"F",(function(){return Y})),r.d(t,"r",(function(){return z})),r.d(t,"q",(function(){return K})),r.d(t,"y",(function(){return Q})),r.d(t,"p",(function(){return J})),r.d(t,"x",(function(){return Z})),r.d(t,"Cb",(function(){return $})),r.d(t,"O",(function(){return ee})),r.d(t,"P",(function(){return te})),r.d(t,"Ab",(function(){return re})),r.d(t,"C",(function(){return ie})),r.d(t,"B",(function(){return ae})),r.d(t,"A",(function(){return se})),r.d(t,"K",(function(){return ne})),r.d(t,"J",(function(){return oe})),r.d(t,"L",(function(){return le})),r.d(t,"o",(function(){return he})),r.d(t,"s",(function(){return ce})),r.d(t,"gb",(function(){return ue})),r.d(t,"fb",(function(){return de})),r.d(t,"Db",(function(){return fe})),r.d(t,"Q",(function(){return pe})),r.d(t,"i",(function(){return ge})),r.d(t,"g",(function(){return me})),r.d(t,"k",(function(){return ve})),r.d(t,"m",(function(){return be})),r.d(t,"rb",(function(){return _e})),r.d(t,"pb",(function(){return ye})),r.d(t,"tb",(function(){return we})),r.d(t,"Y",(function(){return Te})),r.d(t,"cb",(function(){return xe})),r.d(t,"ab",(function(){return Re})),r.d(t,"c",(function(){return Ee})),r.d(t,"M",(function(){return Se})),r.d(t,"Bb",(function(){return Me})),r.d(t,"N",(function(){return Ce})),r.d(t,"yb",(function(){return Ae})),r.d(t,"W",(function(){return Pe})),r.d(t,"lb",(function(){return ke})),r.d(t,"e",(function(){return Oe}));const i=1,a=2,s=3,n=7,o=8,l=9,h=12,c=14,u=15,d=16,f=18,p=20,g=21,m=24,v=26,b=27,_=30,y=31,w=35,T=36,x=37,R=38,E=47,S=48,M=50,C=51,A=52,P=53,k=54,O=56,L=57,I=60,U=61,D=62,B=66.5,W=66.6,G=67,V=68,F=69,N=71,j=72,H=73,q=75,X=76,Y=78,z=105,K=106,Q=107,J=108,Z=109,$=120,ee=121,te=122,re=123,ie=124,ae=125,se=126,ne=127,oe=128,le=129,he=132,ce=133,ue=135,de=136,fe=137,pe=151,ge=-1,me=-2,ve=-3,be=-5,_e=-7,ye=-8,we=-9,Te=-12,xe=-14,Re=-15,Ee=-23,Se=-26,Me=-27,Ce=-28,Ae=-35,Pe=-129,ke=-130,Oe=-131},function(e,t,r){"use strict";r.d(t,"e",(function(){return c})),r.d(t,"b",(function(){return d})),r.d(t,"d",(function(){return f})),r.d(t,"a",(function(){return p})),r.d(t,"c",(function(){return g}));var i=r(7),a=r.n(i),s=r(14),n=r(17),o=r(5),l=r(10),h=r(13);const c={AUDIO_DECODE:1,AUDIO_ENCODE:2,VIDEO_DECODE:4,VIDEO_ENCODE:8,SHARR_DECODE:16,SHARR_ENCODE:32},u=e=>{0};class d{constructor(){this.onmessage=u,this.status=d.CLOSED,this.onopen=u,this.onclose=u,this.onwer=null}send(e){}delete(){this.onmessage=u,this.onopen=u,this.onclose=u,this.close()}sendVideo(e,t){}sendWasm(e){}open(){this.status=d.OPEN,this.onopen()}close(){this.status=d.CLOSED,this.onclose()}}a()(d,"OPEN",1),a()(d,"CLOSED",2);class f extends d{constructor(){super({}),this.sab={},this.port=null,this.onmessage=u,this.sender=u,this.videoSender=u,this.reciver=u,this.wasmSender=u}send(e){this.sender(e)}sendVideo(e,t){this.videoSender(e,t)}sendWasm(e){this.wasmSender(e)}delete(){try{var e,t;this.onmessage=u,this.sender=u,this.videoSender=u,this.reciver=u,this.wasmSender=u;let{consumer:r}=(null===(e=this.sab)||void 0===e?void 0:e.reciver)||{};null==r||r.setDataCallback(u),null==r||r.cancelConsume(),this.sab={},this.port&&(this.port.onmessage=u),null===(t=this.port)||void 0===t||t.close()}catch(e){}}open(){this.status!=d.OPEN||this.onopen()}close(){this.status=d.CLOSED,this.delete(),this.onclose()}_onmessage(e){let{cmd:t,data:r}=e.data;switch(t){case o.J:this.reciver();break;case o.K:this.onmessage(r,0);break;case o.L:this.status=r,this.status==d.OPEN?this.onopen():this.onclose()}}createSendAndReceive(){if(!this.port)return;let{sender:e,reciver:t}=this.sab,{sabqueue:r,interval:i}=e||{};r?i?(this.sender=e=>{r.enqueue(e)},this.wasmSender=e=>{r.enqueue(e)},this.videoSender=(e,t)=>{if(!r.enqueueSafe([e,t],!1)){let i=new Uint8Array(t.length+e.length);i.set(e,0),i.set(t,e.length),r.enqueueSafe(i)}}):(this.sender=e=>{r.enqueue(e),this.port.postMessage({cmd:o.J})},this.wasmSender=e=>{r.enqueue(e),this.port.postMessage({cmd:o.J})},this.videoSender=(e,t)=>{if(!r.enqueueSafe([e,t],!1)){let i=new Uint8Array(t.length+e.length);i.set(e,0),i.set(t,e.length),r.enqueueSafe(i)}this.port.postMessage({cmd:o.J})}):(this.sender=e=>{this.port.postMessage({cmd:o.K,data:e},[e.buffer])},this.wasmSender=e=>{let t=new Uint8Array(e.length);t.set(e,0),this.port.postMessage({cmd:o.K,data:t},[t.buffer])},this.videoSender=(e,t)=>{let r=new Uint8Array(t.length+e.length);r.set(e,0),r.set(t,e.length),this.port.postMessage({cmd:o.K,data:r},[r.buffer])});let{sabqueue:a,consumer:l,useCopy:h,interval:c,offset:u}=t||{};if(l&&(l.cancelConsume(),l=null),a){const e=h?e=>{this.onmessage(e,0)}:u?e=>{this.onmessage(e.uint8s,e.begin)}:e=>{this.onmessage(e.uint8s,0)};let r=null,i=p.dataTransportMgr.monitorlogfn;if(c&&i){var d;let e=new s.b({tag:"WCL_M,VDRB"+(null===(d=this.onwer)||void 0===d?void 0:d.type),interval:1e4,reportcallback:m});r=e.timeoutReport.bind(e)}l=new n.a(a,e,r),t.consumer=l,c?l.consume(c,h):this.reciver=()=>{l.consumeAll(h)}}}setMsgPort(e){e!=this.port&&(this.port&&(this.port.onmessage=u,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:r,interval:i,offset:a,length:s,useOneElement:o}=e,l=new n.b(a>0?t.buffer:t,void 0,void 0,!!o,a,s,a>0?t:null);this.sab.sender={sabqueue:l,interval:i,useCopy:r,offset:a}}if(null!=t&&t.sab){var r;let{sab:e,useCopy:i,interval:a,offset:s,length:o,useOneElement:l}=t,h=new n.b(s>0?e.buffer:e,void 0,void 0,!!l,s,o,s>0?e:null),{consumer:c}=(null===(r=this.sab)||void 0===r?void 0:r.reciver)||{};c&&(c.cancelConsume(),this.sab.reciver.consumer=null,this.sab.reciver.sabqueue=null),this.sab.reciver={sabqueue:h,interval:a,useCopy:i,offset:s}}this.createSendAndReceive()}setStatus(e){this.port?this.status!=e&&(this.status=e,this.port.postMessage({cmd:o.L,data:e})):console.error("MsgQueueSocket not initialized")}}class p{constructor(e){this.onmessage=u,this.onopen=u,this.onclose=u,this.connect_type=e.connect_type||p.UDP,this.type=e.type,this.id=e.id||Math.floor(performance.now())<<10|e.type,this.sock=e.sock||new d,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.onwer=this,this.remote=e.remote,this.sabInfo=null,this.portInfo=null,this.target_thread=l.b.NO_THREAD,this.local=!!e.local,this._create()}_create(){let e=p.dataTransportMgr;e.transportlists.push(this),!this.local&&e&&e.mainThread&&e.type==h.a.THREAD_SUB&&e.createRemoteTransport(this,e.mainThread)}_close(){let e=p.dataTransportMgr,t=e.transportlists.indexOf(this);-1!=t&&e.transportlists.splice(t,1),!this.local&&e&&e.mainThread&&e.type==h.a.THREAD_SUB&&e.closeRemoteTransport(this,e.mainThread)}_onmessage(e,t){this.onmessage(e,t)}_onclose(){this.onclose()}_onopen(){this.onopen()}isReady(){return!0}send(e){this.sock.send(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 f))throw new Error("tansport sock is not a MsgQueueSocket");this.sock.setMsgPort(e)}setSabBuffer(e,t){if(!(this.sock instanceof f))throw new Error("tansport sock is not a MsgQueueSocket");this.sock.setSabBuffer(e,t)}setStatus(e){this.sock instanceof f&&this.sock.setStatus(e)}}a()(p,"UDP",0),a()(p,"TCP",1),a()(p,"RLB_UDP",2),a()(p,"dataTransportMgr",null);class g{constructor(e){this.sock=null,this.onmessage=u}isReady(){return!1}send(){u()}setStatus(e){0}}function m(e,t,r,i){var a;null===(a=h.a.monitorlogfn)||void 0===a||a.call(h.a,e,"".concat(t,",").concat(r,",").concat(i))}},function(e,t,r){var i=r(35);e.exports=function(e,t,r){return(t=i(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";r.d(t,"q",(function(){return i})),r.d(t,"b",(function(){return a})),r.d(t,"c",(function(){return s})),r.d(t,"d",(function(){return n})),r.d(t,"i",(function(){return o})),r.d(t,"j",(function(){return l})),r.d(t,"l",(function(){return h})),r.d(t,"r",(function(){return c})),r.d(t,"s",(function(){return u})),r.d(t,"t",(function(){return d})),r.d(t,"m",(function(){return f})),r.d(t,"o",(function(){return p})),r.d(t,"e",(function(){return g})),r.d(t,"n",(function(){return m})),r.d(t,"p",(function(){return v})),r.d(t,"g",(function(){return b})),r.d(t,"h",(function(){return _})),r.d(t,"a",(function(){return y})),r.d(t,"f",(function(){return w})),r.d(t,"k",(function(){return T}));const i=1,a=2,s=3,n=4,o=5,l=6,h=7,c=8,u=9,d=10,f=11,p=129,g=130,m=131,v=132,b=133,_=134,y=135,w=136,T=137},function(e,t,r){"use strict";r.d(t,"h",(function(){return s})),r.d(t,"e",(function(){return n})),r.d(t,"g",(function(){return o})),r.d(t,"f",(function(){return l})),r.d(t,"d",(function(){return h})),r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return u})),r.d(t,"c",(function(){return d}));var i=r(3),a=r(2);function s(e,t){const r=Math.pow(10,t);return Math.floor(e*r)/r}function n(e,t){const r=Math.pow(10,t);return Math.ceil(e*r)/r}function o(e,t,r){if(!e||t<0||r<0)throw new Error("isDimensionsOverMaxDimension2DSize() invalid parameters. res=".concat(e,", width=").concat(t,", height=").concat(r));let a=!1,s=0;const n=e.acquireGPUFeaturesHelper();return n&&(s=n.queryMaxTextureDimension2D(),s>0&&(a=t>s||r>s)),a&&(console.log("isDimensionsOverMaxDimension2DSize() w:".concat(t," h:").concat(r," max:").concat(s)),Object(i.o)("WGPU isDimensionsOverMaxDimension2DSize() w:".concat(t," h:").concat(r," max:").concat(s))),a}function l(e,t){if(!e||t<0)throw new Error("isBufferSizeOverMaxSize() invalid parameters. res=".concat(e,", bufferSize=").concat(t));let r=!1,a=0;const s=e.acquireGPUFeaturesHelper();return s&&(a=s.queryMaxBufferSize(),a>0&&(r=t>a)),r&&(console.log("isBufferSizeOverMaxSize() bufferSize:".concat(t," max:").concat(a)),Object(i.o)("isBufferSizeOverMaxSize() bufferSize:".concat(t," max:").concat(a))),r}function h(e,t){if(!e||null==t)throw new Error("evalCroppingRect() invalid parameters!");return t===a.s||t===a.r?{top:e.top,left:e.left,width:e.height,height:e.width}:e}function c(e,t){let r=0,i=0,a=0,s=0;const n=t.width/t.height;return e.width/e.height>n?(i=e.height,r=i*n,a=(e.width-r)/2,s=0):(r=e.width,i=r/n,a=0,s=(e.height-i)/2),r<=e.canvas.width&&(a=(e.canvas.width-r)/2),i<=e.canvas.height&&(s=(e.canvas.height-i)/2),{x:a,y:s,width:r,height:i}}function u(e,t,r,i){if(!e||!t||!r)return null;const s=t.width/t.height;let n=t.width,o=t.height;if(t.width>e.width||t.height>e.height){const r=e.width/t.width,i=e.height/t.height,a=Math.min(r,i);n*=a,o*=a}let l=0,h=0;e.width/e.height>s?(h=Math.floor(e.height/o)*o,l=Math.floor(h*s/n)*n,l>e.width&&(l=Math.floor(e.width/n)*n,h=Math.floor(l/s/o)*o)):(l=Math.floor(e.width/n)*n,h=Math.floor(l/s/o)*o,h>e.height&&(h=Math.floor(e.height/o)*o,l=Math.floor(h*s/n)*n));let c=0,u=0,d=0,f=0;i==a.p?(c=1-(c+(o-1)/e.height),u=t.left/e.width,f=1-t.top/e.height,d=u+n/e.width):i==a.s?(u=1-(c+(o-1)/e.height),d=1-t.top/e.height,c=t.left/e.width,f=u+n/e.width):i==a.q?(c=t.top/e.height,u=t.left/e.width,f=c+(o-1)/e.height,d=u+n/e.width):i==a.r&&(u=t.top/e.height,d=c+(o-1)/e.height,c=t.left/e.width,f=u+n/e.width);let p=[],g=[{x:d,y:f},{x:d,y:c},{x:u,y:c},{x:d,y:f},{x:u,y:f},{x:u,y:c}];for(let e=0;e<g.length;++e){let t={u:g[e].x,v:g[e].y};p.push(t)}let m=[];for(let e=0;e<p.length;++e){let t=p[e];m.push(t.u),m.push(t.v)}return m}function d(e,t,r,i,o,l){let h=0,c=0,u=0,d=0;if(e){const e=o==a.s||o==a.r?t.height/t.width:t.width/t.height,s=i.left||0,n=i.top||0;if(i.width/i.height>e){const t=i.height*e;h=n/r.height,c=(Math.round((i.width-t)/2)+s)/r.width,d=h+(i.height-1)/r.height,u=c+t/r.width}else{const t=i.width/e;h=(Math.round((i.height-t)/2)+n)/r.height,c=s/r.width,d=h+(t-1)/r.height,u=c+i.width/r.width}o==a.p?(h=1-(h+(i.height-1)/r.height),c=i.left/r.width,d=1-i.top/r.height,u=c+i.width/r.width):o==a.s?(c=1-(h+(i.height-1)/r.height),u=1-i.top/r.height,h=i.left/r.width,d=c+i.width/r.width):o==a.q?(h=i.top/r.height,c=i.left/r.width,d=h+(i.height-1)/r.height,u=c+i.width/r.width):o==a.r&&(c=i.top/r.height,u=h+(i.height-1)/r.height,h=i.left/r.width,d=c+i.width/r.width)}else{const e=i.width/i.height;let t=i.width,l=i.height;if(i.width>r.width||i.height>r.height){const e=r.width/i.width,a=r.height/i.height,s=Math.min(e,a);t*=s,l*=s}let f=0,p=0;r.width/r.height>e?(p=Math.floor(r.height/l)*l,f=Math.floor(p*e/t)*t,f>r.width&&(f=Math.floor(r.width/t)*t,p=Math.floor(f/e/l)*l)):(f=Math.floor(r.width/t)*t,p=Math.floor(f/e/l)*l,p>r.height&&(p=Math.floor(r.height/l)*l,f=Math.floor(p*e/t)*t)),o==a.p?(h=1-(h+(l-1)/r.height),c=i.left/r.width,d=1-i.top/r.height,u=c+t/r.width,i.height>i.width&&(c=n(c,2),u=s(u,2))):o==a.s?(c=1-(h+(l-1)/r.height),u=1-i.top/r.height,h=i.left/r.width,d=c+t/r.width):o==a.q?(h=i.top/r.height,c=i.left/r.width,d=h+(l-1)/r.height,u=c+t/r.width):o==a.r&&(c=i.top/r.height,u=h+(l-1)/r.height,h=i.left/r.width,d=c+t/r.width)}let f=[],p=[{x:u,y:d},{x:u,y:h},{x:c,y:h},{x:u,y:d},{x:c,y:d},{x:c,y:h}];for(let e=0;e<p.length;++e){let t=null;if(l){let r=-1*Math.abs(p[e].x);p[e].x=r,t={u:p[e].x+1,v:p[e].y}}else t={u:p[e].x,v:p[e].y};f.push(t)}let g=[];for(let e=0;e<f.length;++e){let t=f[e];g.push(t.u),g.push(t.v)}return g}},function(e,t,r){"use strict";r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return n}));var i=r(7),a=r.n(i);class s{constructor(){this.onmessage=()=>{}}addEventListener(){}close(){}}class n{constructor(e){this.transportMap={},this.netthreadworker=null,this.type=e.type,this.mgr=e,this.transportlistsChnagelinster=[]}addEventListener(e){-1==this.transportlistsChnagelinster.indexOf(e)&&this.transportlistsChnagelinster.push(e)}removeEventListener(e){let t=this.transportlistsChnagelinster.indexOf(e);-1!=t&&this.transportlistsChnagelinster.splice(t,1)}addTransport(e,t){e.id in this.transportMap||(this.transportMap[e.id]=e,this.transportlistsChnagelinster.forEach(r=>{r(e,t,1)}))}removeTransport(e){var t;let r=e.id;r in this.transportMap&&(delete this.transportMap[r],null===(t=e.sock)||void 0===t||t.close(),this.transportlistsChnagelinster.forEach(t=>{t(e,e.channel,0)}))}getTransportByType(e){for(let t in this.transportMap){let r=this.transportMap[t],i=r.target_thread==n.SELF_THREAD;if(r.type==e&&i)return r}return null}}a()(n,"NO_THREAD",0),a()(n,"SELF_THREAD",1)},function(e,t,r){"use strict";function i(){this.a=[],this.b=0,this.residue=null}i.prototype.getLength=function(){return this.a.length-this.b},i.prototype.isEmpty=function(){return 0==this.a.length},i.prototype.enqueue=function(e){this.a.push(e)},i.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},i.prototype.peek=function(){return 0<this.a.length?this.a[this.b]:void 0},i.prototype.clear=function(){this.a=[],this.b=0},t.a=i},function(e,t,r){"use strict";r.d(t,"a",(function(){return i})),r.d(t,"b",(function(){return a})),r.d(t,"c",(function(){return s}));const i={AUDIO:1,SHARING:2,VIDEO:3},a={VIDEO_ENCODE:"0",VIDEO_DECODE:"1",AUDIO_ENCODE:"2",AUDIO_DECODE:"3",SHARING_ENCODE:"4",SHARING_DECODE:"5"},s=((()=>{const e={};for(const t in a)e[a[t]]="WCL_"+t})(),{[a.AUDIO_ENCODE]:"audio.encode",[a.AUDIO_DECODE]:"audio.decode",[a.VIDEO_ENCODE]:"video.encode",[a.VIDEO_DECODE]:"video.decode",[a.SHARING_ENCODE]:"share.encode",[a.SHARING_DECODE]:"share.decode"})},function(e,t,r){"use strict";r.d(t,"b",(function(){return h})),r.d(t,"a",(function(){return c}));var i=r(7),a=r.n(i),s=r(5),n=r(10),o=r(6),l=r(22);function h(e,t,r){if(!e)return;let i=o.a.dataTransportMgr;i.type===c.THREAD_MAIN?(i.setSabBuffer(e,t,r),e.remote.postMessage({cmd:s.gb,transportId:e.id,sender:r,reciver:t})):(e.setSabBuffer(t,r),i.mainThread.postMessage({cmd:s.gb,transportId:e.id,sender:r,reciver:t}))}class c{constructor(e){let t=e||{};this.type=t.type||c.THREAD_MAIN,this.refs={},this.transportlists=[],this.mainThread=t.remote,this.subthreadlistner=null,this.channellists=[],this.mediadatachannel=new n.b(this)}_onrecvmainthreadlistener(e){let{cmd:t,transportId:r,data:i}=e.data,a=this.transportlists.find(e=>e.id===r);if(a||t==s.s)switch(t){case s.s:this.addRemoteTransport(e.data,null);break;case s.fb:a.setMsgPort(i||new n.a);break;case s.gb:a.setSabBuffer(e.data.sender,e.data.reciver);break;case s.o:a.remote=null,this.removeTransport(a)}}_onrecvsubthreadlistener(e,t){let{cmd:r,transportId:i,transportType:a}=t.data,n=this.transportlists.find(e=>e.id===i);switch(r){case s.s:this.addRemoteTransport(t.data,e);break;case s.gb:this.setSabBufferInfo(n,t.data.sender,t.data.reciver);break;case s.o:n.remote=null,this.removeTransport(n)}}createRemoteTransport(e,t){let r={cmd:s.s,transportType:e.type,transportId:e.id};e.portInfo?(r.port=e.portInfo,t.postMessage(r,[e.portInfo])):t.postMessage(r)}closeRemoteTransport(e,t){t.postMessage({cmd:s.o,transportType:e.type,transportId:e.id})}setRemoteTransportSABBUffer(e,t){var r,i,a,n;(null!==(r=e.sabInfo)&&void 0!==r&&r.sender||null!==(i=e.sabInfo)&&void 0!==i&&i.reciver)&&t.postMessage({cmd:s.gb,transportId:e.id,sender:null===(a=e.sabInfo)||void 0===a?void 0:a.sender,reciver:null===(n=e.sabInfo)||void 0===n?void 0:n.reciver})}addRemoteTransport(e,t){let{transportId:r,port:i,transportType:a}=e;let s=this.createMsgSocketTransport(a);s.id=r,s.remote=t,s.portInfo=i,i?s.setMsgPort(s.portInfo):this.bindMessageChannel(s),this.addTransport(s)}addTransport(e){let t=this.getChannelByTransportT