var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(v){var D=0;return function(){return D>>0,$jscomp.propertyToPolyfillSymbol[O]=$jscomp.IS_SYMBOL_NATIVE? $jscomp.global.Symbol(O):$jscomp.POLYFILL_PREFIX+I+"$"+O),$jscomp.defineProperty(E,$jscomp.propertyToPolyfillSymbol[O],{configurable:!0,writable:!0,value:D})))};$jscomp.initSymbol=function(){};$jscomp.iteratorPrototype=function(v){v={next:v};v[Symbol.iterator]=function(){return this};return v};$jscomp.underscoreProtoCanBeSet=function(){var v={a:!0},D={};try{return D.__proto__=v,D.a}catch(I){}return!1}; $jscomp.setPrototypeOf=$jscomp.TRUST_ES6_POLYFILLS&&"function"==typeof Object.setPrototypeOf?Object.setPrototypeOf:$jscomp.underscoreProtoCanBeSet()?function(v,D){v.__proto__=D;if(v.__proto__!==D)throw new TypeError(v+" is not extensible");return v}:null;$jscomp.makeIterator=function(v){var D="undefined"!=typeof Symbol&&Symbol.iterator&&v[Symbol.iterator];return D?D.call(v):$jscomp.arrayIterator(v)};$jscomp.generator={}; $jscomp.generator.ensureIteratorResultIsObject_=function(v){if(!(v instanceof Object))throw new TypeError("Iterator result "+v+" is not an object");};$jscomp.generator.Context=function(){this.isRunning_=!1;this.yieldAllIterator_=null;this.yieldResult=void 0;this.nextAddress=1;this.finallyAddress_=this.catchAddress_=0;this.finallyContexts_=this.abruptCompletion_=null}; $jscomp.generator.Context.prototype.start_=function(){if(this.isRunning_)throw new TypeError("Generator is already running");this.isRunning_=!0};$jscomp.generator.Context.prototype.stop_=function(){this.isRunning_=!1};$jscomp.generator.Context.prototype.jumpToErrorHandler_=function(){this.nextAddress=this.catchAddress_||this.finallyAddress_};$jscomp.generator.Context.prototype.next_=function(v){this.yieldResult=v}; $jscomp.generator.Context.prototype.throw_=function(v){this.abruptCompletion_={exception:v,isException:!0};this.jumpToErrorHandler_()};$jscomp.generator.Context.prototype.return=function(v){this.abruptCompletion_={return:v};this.nextAddress=this.finallyAddress_};$jscomp.generator.Context.prototype.jumpThroughFinallyBlocks=function(v){this.abruptCompletion_={jumpTo:v};this.nextAddress=this.finallyAddress_};$jscomp.generator.Context.prototype.yield=function(v,D){this.nextAddress=D;return{value:v}}; $jscomp.generator.Context.prototype.yieldAll=function(v,D){v=$jscomp.makeIterator(v);var I=v.next();$jscomp.generator.ensureIteratorResultIsObject_(I);if(I.done)this.yieldResult=I.value,this.nextAddress=D;else return this.yieldAllIterator_=v,this.yield(I.value,D)};$jscomp.generator.Context.prototype.jumpTo=function(v){this.nextAddress=v};$jscomp.generator.Context.prototype.jumpToEnd=function(){this.nextAddress=0}; $jscomp.generator.Context.prototype.setCatchFinallyBlocks=function(v,D){this.catchAddress_=v;void 0!=D&&(this.finallyAddress_=D)};$jscomp.generator.Context.prototype.setFinallyBlock=function(v){this.catchAddress_=0;this.finallyAddress_=v||0};$jscomp.generator.Context.prototype.leaveTryBlock=function(v,D){this.nextAddress=v;this.catchAddress_=D||0}; $jscomp.generator.Context.prototype.enterCatchBlock=function(v){this.catchAddress_=v||0;v=this.abruptCompletion_.exception;this.abruptCompletion_=null;return v};$jscomp.generator.Context.prototype.enterFinallyBlock=function(v,D,I){I?this.finallyContexts_[I]=this.abruptCompletion_:this.finallyContexts_=[this.abruptCompletion_];this.catchAddress_=v||0;this.finallyAddress_=D||0}; $jscomp.generator.Context.prototype.leaveFinallyBlock=function(v,D){D=this.finallyContexts_.splice(D||0)[0];if(D=this.abruptCompletion_=this.abruptCompletion_||D){if(D.isException)return this.jumpToErrorHandler_();void 0!=D.jumpTo&&this.finallyAddress_I&&(I=Math.max(I+O,0));Id?g:d},e)}return b(a,1)}function I(a){let b=a.length,c=Array(b),e;for(let d=0;de?e-48:(e&223)-65+10,c[d]=e;return c.reduce((d,h)=>16*d+h,0)}function E(a){if(void 0!=a){var b=[];if(/^(rgb|RGB)/.test(a)){a=a.replace(/(?:\(|\)|rgb|RGB)*/g,"").split(",");for(let c of a)b.push(Number((Number(c)/255).toFixed(1)))}else if(/^#/.test(a)){if(/^#[0-9A-F]{3}$/i.test(a)){let c= "#";a.replace(/[0-9A-F]/ig,function(e){c+=e+e});a=c}/^#[0-9A-F]{6}$/i.test(a)&&a.replace(/[0-9A-F]{2}/ig,function(c){c=I(c);b.push(Number((c/255).toFixed(1)))})}else a instanceof Array&&(b=a);3==b.length&&b.push(1);return b}}function O(a){if(void 0!=a){var b,c=D(a);2==c?b=[[a]]:3==c?b=[a]:4==c&&(b=a);if(b)for(let e of b)for(let d of e)for(let h of d)2==h.length&&h.push(0);return b}}function T(a){if(void 0!=a)return 1==D(a)?[a]:a}function F(a){return a instanceof Array?a:[a]}function K(a){let b=[]; if(a instanceof Array)for(let c in a)b[c]=a[c].toString();else b=[a.toString()];return b}function S(a){switch(typeof a){case "undefined":return!0;case "string":if(0===a.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g,"").length)return!0;break;case "boolean":if(!a)return!0;break;case "number":if(isNaN(a))return!0;break;case "object":if(null===a||0===a.length)return!0;for(var b in a)return!1;return!0}return!1}function pa(a,b){for(a=a.toString();a.length=q?(e=g,a.apply(h,d),c&&(clearTimeout(c),c=null)):c||(c=setTimeout(()=>{e=+new Date;c=null;a.apply(h,d)},q))}}function Ha(a){switch(a){case da.StartingProcess:return"starting process...";case da.CheckingBusy:return"checking...";case da.ProcessStartFailed:return"process start failed!";case da.ProcessStarted:return"process started";case da.LoadingProject:return"loading project...";case da.ProjectLoaded:return"project loaded"}}function wa(a){"string"===typeof a&&(a=document.getElementById(a)); return a}function Ia(a){return R.isIOSDevice&&R.isInWeixinBrowser?!1:a==sa.abnormal||a==sa.instance_disconnected}function aa(a,b){return void 0!==a&&null!==a?a:b}function xa(a){return a.keyCode===ea.Shift&&"ShiftRight"===a.code?ea.RightShift:a.keyCode===ea.Control&&"ControlRight"===a.code?ea.RightControl:a.keyCode===ea.Alt&&"AltRight"===a.code?ea.RightAlt:a.keyCode}var p={None:0,Camera_PlayAnimation:1,Camera_StopAnimation:2,Misc_EnterReportMode:3,Misc_ExitReportMode:4,Misc_SetDateTime:5,Camera_GetCamera:6, Camera_SetState:7,Camera_Set:8,Camera_LookAtBBox:9,Coord_World2Screen:10,Coord_Screen2World:11,InfoTree_SetVisibility:12,InfoTree_Show:13,InfoTree_Hide:14,InfoTree_EnableXRay:15,InfoTree_DisableXRay:16,TileLayer_Add:17,HeatMap_Add:18,HeatMap_Update:19,HeatMap_AddPoints:20,HeatMap_RemovePoints:21,HeatMap_Delete:22,HeatMap_Show:23,HeatMap_Hide:24,HeatMap_Focus:25,HighlightArea_Add:26,HighlightArea_Delete:27,HighlightArea_Update:28,Polygon3D_Add:29,Polygon3D_Delete:30,Misc_AddImageButton:31,Misc_DeleteImageButton:32, Misc_AddAnimatedImageButton:33,Settings_SetMainUIVisibility:34,Settings_SetMousePickMask:35,Tag_Add:36,Tag_Delete:37,Tag_Update:38,Tag_Clear:39,Tag_Focus:40,Beam_Add:41,Beam_Update:42,Beam_Delete:43,Beam_Clear:44,Beam_Focus:45,Beam_Show:350,Beam_Hide:351,Beam_ShowAll:352,Beam_HideAll:353,RadiationPoint_Add:46,RadiationPoint_Update:47,RadiationPoint_Delete:48,RadiationPoint_Clear:49,Polygon_Add:50,Polygon_Update:51,Polygon_Delete:52,Polygon_Clear:53,Polygon_Highlight:54,Polygon_StopHighlight:325,Polygon_Glow:55, Polygon_Focus:56,Tag_FocusAll:57,Tag_Show:58,Tag_Hide:59,Tag_ShowAll:60,Tag_HideAll:61,RadiationPoint_Focus:62,RadiationPoint_FocusAll:63,RadiationPoint_Show:64,RadiationPoint_Hide:65,RadiationPoint_ShowAll:66,RadiationPoint_HideAll:67,Polygon_Show:68,Polygon_Hide:69,Polygon3D_Update:70,Polygon3D_Clear:71,Polygon3D_Focus:72,Polygon3D_Show:73,Polygon3D_Hide:74,Polygon3D_Highlight:75,Polygon3D_Glow:76,Polygon3D_StopGlow:77,HighlightArea_Clear:78,HighlightArea_Focus:79,HighlightArea_Show:80,HighlightArea_Hide:81, Misc_GetVersion:82,TileLayer_Update:83,TileLayer_Delete:84,TileLayer_Focus:85,TileLayer_EnableXRay:86,TileLayer_DisableXRay:87,TileLayer_Show:88,TileLayer_Hide:89,Tag_Get:90,RadiationPoint_Get:91,Polygon_Get:92,Polygon3D_Get:93,HighlightArea_Get:94,TileLayer_Get:95,Beam_Get:96,HeatMap_Get:97,Settings_GetMapMode:98,Settings_SetMapMode:99,Settings_SetMapURL:100,Settings_SetWMTSLayerVisible:320,TileLayer_Actor_Show:101,TileLayer_Actor_Hide:102,TileLayer_Actor_Focus:103,TileLayer_Actor_Highlight:104, TileLayer_Actor_StopHightlight:105,CustomObject_Add:106,CustomObject_Update:107,CustomObject_Delete:108,CustomObject_Get:109,CustomObject_Focus:110,CustomObject_Show:111,CustomObject_Hide:112,CustomObject_SetTintColor:326,HeatMap_Clear:113,CustomTag_Clear:39,CustomTag_Delete:37,CustomTag_Focus:40,CustomTag_FocusAll:57,CustomTag_Show:58,CustomTag_Hide:59,CustomTag_ShowAll:60,CustomTag_HideAll:61,CustomTag_Add:114,CustomTag_Update:115,CustomTag_Get:116,Polyline_Add:117,Polyline_Update:118,Polyline_Delete:119, Polyline_Clear:120,Polyline_Focus:121,Polyline_Get:122,Polyline_Show:123,Polyline_Hide:124,Polyline_ShowAll:125,Polyline_HideAll:126,VideoProjection_Add:127,VideoProjection_Update:128,VideoProjection_Delete:129,VideoProjection_Show:130,VideoProjection_Hide:131,VideoProjection_Get:132,VideoProjection_Focus:133,Misc_PlayVideo:134,Misc_StopPlayVideo:135,Weather_SetParams:136,Weather_GetParams:137,Weather_SetDate:138,Weather_GetDate:139,ODLine_Add:140,ODLine_Update:141,ODLine_Delete:142,ODLine_Clear:143, ODLine_Focus:144,ODLine_Get:145,ODLine_Show:146,ODLine_Hide:147,ODLine_ShowAll:148,ODLine_HideAll:149,Misc_SetWindowResolution:150,Misc_CallBPFunction:151,Settings_SetHighlightColor:152,InfoTree_ShowByGroupId:153,InfoTree_HideByGroupId:154,InfoTree_HighlightByGroupId:155,InfoTree_DeleteByGroupId:156,EditHelper_Start:157,EditHelper_Quit:158,EditHelper_Finish:159,EditHelper_SetParam:160,Settings_SetFovX:161,TileLayer_Actor_ShowAll:162,TileLayer_Actor_HideAll:163,CameraTour_Add:164,CameraTour_Update:165, CameraTour_Play:166,CameraTour_Stop:167,CameraTour_Delete:168,Tag_PopupWindow_Show:169,Tag_PopupWindow_Hide:170,Tag_PopupWindow_ShowAll:171,Tag_PopupWindow_HideAll:172,Settings_SetOceanColor:173,Misc_ShowAllFoliages:174,Misc_HideAllFoliages:175,Tools_StartPolygonClip:176,Tools_StopClip:177,TileLayer_SetAllowClip:178,Panorama_Add:179,Panorama_Update:180,Panorama_Delete:181,Panorama_Clear:182,Panorama_Focus:183,Panorama_Get:184,Decal_Add:185,Decal_Update:186,Decal_Delete:187,Decal_Clear:188,Decal_Focus:189, Decal_FocusAll:190,Decal_Get:191,Misc_PlayMovie:192,Misc_StopMovie:193,Tools_SetMeasurement:194,Tools_StartMeasurement:195,Tools_StopMeasurement:196,Viewshed_Add:197,Viewshed_Update:198,Viewshed_Focus:199,Viewshed_Delete:200,Viewshed_Clear:201,Viewshed_Get:202,TileLayer_SetStyle:203,Tools_LineIntersect:204,Coord_PCS2GCS:205,Coord_GCS2PCS:206,DynamicWater_Add:207,DynamicWater_Update:208,DynamicWater_Focus:209,DynamicWater_Delete:210,DynamicWater_Clear:211,DynamicWater_Get:212,DynamicWater_Show:213, DynamicWater_Hide:214,Quit:215,TileLayer_Actor_Unhighlight:216,InfoTree_Get:217,Reset:218,SaveProject:225,CustomObject_Clear:219,CustomObject_Highlight:220,CustomObject_Unhighlight:221,CustomObject_StopHighlight:222,CustomObject_CallFunction:223,CustomObject_AddByTileLayer:224,Tools_StartPlaneClip:226,Tools_StopPlaneClip:228,Tools_StartVolumeClip:229,Tools_UpdateVolumeClip:230,Tools_StopVolumeClip:231,Tools_StartSkylineAnalysis:232,Tools_StopSkylineAnalysis:233,Tools_ExportSkyline:234,Tools_StartViewshedAnalysis:235, Tools_StopViewshedAnalysis:236,Camera_Move:237,TileLayer_SetCollision:238,TileLayer_Modifier_Add:239,TileLayer_Modifier_Update:240,TileLayer_Modifier_Delete:241,TileLayer_Modifier_Clear:242,Misc_StartProcess:243,Settings_SetCampassVisible:244,Tools_StartGeometryEdit:245,Tools_StopGeometryEdit:246,Settings_SetEnableInteract:247,Camera_PauseAnimation:248,Camera_ResumeAnimation:249,Settings_SetInteractiveMode:250,CameraTour_Pause:251,CameraTour_Resume:252,Settings_SetTerrainAlpha:253,CustomMesh_Add:254, CustomMesh_Delete:255,CustomMesh_Clear:256,CustomMesh_Update:257,CustomMesh_Get:258,CustomMesh_Focus:259,CustomMesh_Show:260,CustomMesh_Hide:261,CustomMesh_ShowAll:262,CustomMesh_HideAll:263,Settings_EnableCameraMovingEvent:264,Marker_Add:265,Marker_Update:266,Marker_Get:267,Marker_Delete:268,Marker_Clear:269,Marker_Focus:270,Marker_FocusAll:271,Marker_Show:272,Marker_Hide:273,Marker_ShowAll:274,Marker_HideAll:275,Marker_ShowPopupWindow:276,Marker_HidePopupWindow:277,Marker_ShowAllPopupWindow:278, Marker_HideAllPopupWindow:279,TileLayer_SetViewportVisible:280,TileLayer_GetObjectIDs:281,Polygon3D_StopHighlight:282,Tools_StartFloodFill:283,Tools_StopFloodFill:284,FloodFill_Add:285,FloodFill_Delete:286,FloodFill_Clear:287,FloodFill_Update:288,FloodFill_Get:289,FloodFill_Focus:290,FloodFill_Show:291,FloodFill_Hide:292,FloodFill_ShowAll:293,FloodFill_HideAll:294,Cesium3DTile_Add:295,Cesium3DTile_Delete:296,Cesium3DTile_Clear:297,Cesium3DTile_Update:298,Cesium3DTile_Get:299,Cesium3DTile_Focus:300, Cesium3DTile_Show:301,Cesium3DTile_Hide:302,Cesium3DTile_ShowAll:303,Cesium3DTile_HideAll:304,TileLayer_GetActorInfoFromDB:305,ShapeFileLayer_Add:306,ShapeFileLayer_Delete:307,ShapeFileLayer_Clear:308,ShapeFileLayer_Update:309,ShapeFileLayer_Get:310,ShapeFileLayer_Focus:311,ShapeFileLayer_Show:312,ShapeFileLayer_Hide:313,ShapeFileLayer_ShowAll:314,ShapeFileLayer_HideAll:315,ShapeFileLayer_OpenShapeFileLayer:316,Weather_SimulateTime:317,TileLayer_Actor_GetInfo:318,Camera_GetAnimationList:319,TileLayer_CutPolygon_Add:321, TileLayer_CutPolygon_Update:322,TileLayer_CutPolygon_Delete:323,TileLayer_CutPolygon_Clear:324,Marker3D_Add:327,Marker3D_Delete:328,Marker3D_Clear:329,Marker3D_Update:330,Marker3D_Get:331,Marker3D_Focus:332,Marker3D_Show:333,Marker3D_Hide:334,Marker3D_ShowAll:335,Marker3D_HideAll:336,Camera_GetAnimationImage:337,Tools_ReplaceTexture:338,Tools_RestoreTexture:339,Light_Add:340,Light_Delete:341,Light_Update:343,Light_Get:344,Light_Clear:342,Light_Focus:345,Light_Show:346,Light_Hide:347,Light_ShowAll:348, Light_HideAll:349,WaterMesh_Add:354,WaterMesh_Update:355,WaterMesh_Delete:356,WaterMesh_Clear:357,WaterMesh_Get:358,WaterMesh_Focus:359,WaterMesh_Show:360,WaterMesh_Hide:361,WaterMesh_ShowAll:362,WaterMesh_HideAll:363,CustomObject_StartMove:364,CustomObject_StopMove:365,CustomObject_OverrideMaterial:366,CustomObject_RestoreMaterial:367,Settings_SetReport:368,Settings_GetReport:369,Settings_SetControl:370,Settings_GetControl:371,Settings_SetPostProcess:372,Settings_GetPostProcess:373,Settings_SetCamera:374, Settings_GetCamera:375,CustomObject_SetViewportVisible:376,WaterFlowField_Add:377,WaterFlowField_Update:378,WaterFlowField_Delete:379,WaterFlowField_Clear:380,WaterFlowField_Get:381,WaterFlowField_Focus:382,WaterFlowField_Show:383,WaterFlowField_Hide:384,TileLayer_SetViewHeightRange:385,Tools_StartVisiblityAnalysis:386,Tools_StopVisiblityAnalysis:387,Tools_StartViewDomeAnalysis:388,Tools_StopViewDomeAnalysis:389,Tools_StartCutFillAnalysis:390,Tools_StopCutFillAnalysis:391,Tools_StartSunshineAnalysis:392, Tools_StopSunshineAnalysis:393,Tools_StartTerrainSlopeAnalysis:394,Tools_StopTerrainSlopeAnalysis:395,Tools_StartContourLineAnalysis:396,Tools_StopContourLineAnalysis:397,TileLayer_GetAllFlattenData:398,Marker_SetupPOIAttachment:399,HeatMap3D_Add:400,HeatMap3D_Update:401,HeatMap3D_Focus:402,HeatMap3D_Delete:403,HeatMap3D_Show:404,HeatMap3D_Hide:405,HeatMap3D_Get:406,HeatMap3D_Clear:407,ShapeFileLayer_HighlightFeature:408,ShapeFileLayer_UnHighlightFeature:409,ShapeFileLayer_FocusFeature:410,ShapeFileLayer_GetFeatureInfo:411, Misc_EnterMultiViewport:412,Misc_ExitMultiViewport:413,Misc_SetActivateMultiViewport:414,Misc_GetActivateMultiViewport:415,Panorama_Enter:416,Panorama_Exit:417,Panorama_Switch:418,VTPKService_Get:419,VTPKService_Set:420,SimulateTest__:421,Settings_CursorAutoSync:422,InfoTree_Focus:423,Marker_ShowByGroupId:424,Marker_HideByGroupId:425,Marker_DeleteByGroupId:426,ImageryLayer_Init:427,ImageryLayer_Add:428,Camera_LockBBox:429,Camera_UnLockBBox:430,Settings_SetWMTSLayerOpacity:431,Camera_EnterEarthCapture:432, Camera_ExitEarthCapture:433,Tools_AnalysisPopupAttributes:434,Tools_AnalysisCloseAttributes:435,ImageryLayer_Show:436,ImageryLayer_Hide:437,ImageryLayer_Delete:438,Settings_GetInteractiveMode:439,VideoProjection_Clear:440,Misc_UpdateMultiViewport:441,Misc_downloadPakFiles:442,Settings_SetCampassPosition:443,Polygon3D_ShowAll:444,Polygon3D_HideAll:445,GeoJSONLayer_Add:446,GeoJSONLayer_Show:447,GeoJSONLayer_Hide:448,GeoJSONLayer_Delete:449,Vehicle_Add:450,Vehicle_Update:451,Vehicle_AddWayPoints:452, Vehicle_ClearWayPoints:453,Vehicle_Focus:454,Vehicle_Show:455,Vehicle_Hide:456,Vehicle_Get:457,Vehicle_Delete:458,Vehicle_Clear:459,Vehicle_MoveTo:460,Misc_ConvexHull2D:461,HeatMap_AddVoxels:462,TileLayer_GetCollision:463,TileLayer_SetPointSize:464,Misc_QueryActorOrMaterial:465,CustomObject_StartGlow:466,CustomObject_StopGlow:467,Coord_Transform:468,RegisterJsCommunication:469,UnRegisterJsCommunication:470,Vehicle_CallBatchFunction:471,Camera_FlyAround:472,Marker3D_ShowByGroupId:473,Marker3D_HideByGroupId:474, Marker3D_DeleteByGroupId:475,Camera_EnterWorldAnimation:476,Camera_ExitWorldAnimation:477,TileLayer_SetDecalAttach:478,Command_End:1E4},ya=!1;(()=>{if(!ya){ya=!0;for(let a in p)p[p[a]]=a}})();const qa={MouseClick:1,MouseMove:2,MouseHover:4},ba={V1:1,V2:2,V3:4,V4:8,All:255};class Ja{constructor(a,b){this.id=a;this.visible=b}}class Ka{constructor(a,b,c,e){this.id=a.toString();this.coordinate=b;this.radius=c;this.heatValue=e}}class La{constructor(a,b,c,e,d,h,g,q,k,f,l,t,w,r){this.id=a.toString();this.coordinate= b;this.imagePath=c;this.imageSize=e;this.url=d;this.text=h;this.range=g||[1,1E5];this.showLine=!!q;this.textColor=k||[0,0,0,1];this.textBackgroundColor=f||[1,1,1,.85];this.textBorderColor=l||[0,0,0,0];this.textRange=t||1E5;this.hoverImagePath=w;this.autoHidePopupWindow=r||!0}}class Ma{constructor(a,b,c){this.url=a;this.width=b;this.height=c}}class Na{constructor(a,b,c,e,d,h,g,q){this.id=a.toString();this.coordinate=b;this.contentURL=c.url;this.contentSize=[c.width,c.height];this.popupURL=e.url;this.popupSize= [e.width,e.height];this.pivot=d;this.range=h;this.autoHidePopupWindow=g||!0;this.popupPos=q}}class Oa{constructor(a,b,c,e,d,h){this.id=a.toString();this.coordinates=O(b);this.color=E(c);this.heightRange=e;this.intensity=d;this.depthTest=h||!0}}class Pa{constructor(a,b,c,e,d,h,g,q){this.id=a.toString();this.x=b;this.y=c;this.width=e;this.height=d;this.normalImage=h;this.hoverImage=g;this.tooltip=q}}class Qa{constructor(a,b,c,e,d,h,g,q,k){this.id=a.toString();this.x=b;this.y=c;this.width=e;this.height= d;this.imageSequecePath=h;this.imageSequeceLength=g;this.loop=!!q;this.interactable=!!k}}class Ra{constructor(a,b,c,e,d,h,g){this.id=a.toString();this.duration=b;this.thickness=c;this.interval=e;this.velocity=d;this.color=E(h);this.coordinates=g}}class Sa{constructor(a,b,c,e,d,h){this.id=a.toString();this.coordinate=b;this.radius=c;this.rippleNumber=e;this.color=E(d);this.brightness=h}}class Ta{constructor(a,b,c,e,d,h,g,q){this.id=a.toString();this.style=b;this.coordinates=O(c);this.color=E(e);this.height= d;this.intensity=h;this.tillingX=g;this.tillingY=q}}class Ua{constructor(a,b,c,e,d,h,g,q,k,f){this.id=a.toString();this.color=E(b);this.coordinates=c;this.style=void 0==e?0:e;if(0>this.style||5this.style||10{this.isMainThreadBusy? this._callNextForTimeout(5E3):this.callNext()},a)}}class Q{constructor(a,b,c){this.int=a;this.type=b;this.colorProps=c;this._useBatchUpdate=!1;this._tempUpdateData=[]}_checkCommand(a){a=this.type+a;let b=p[a];void 0==b&&this.int.logWithColor("red",`Invalid command: ${a}`);return b}_convertFilePath(a){return this.int.resourcesPath?a.replace("@path:",this.int.resourcesPath+"/"):a}_processProps(a){a=F(a);for(var b of a)for(let e in b)"string"==typeof b[e]&&b[e].startsWith("@path:")&&(b[e]=this._convertFilePath(b[e])); for(let e of a)"string"!=typeof e.id&&(e.id=e.id.toString());if(this.colorProps){b=this.colorProps.split("|");for(var c of a)for(let e of b)c.hasOwnProperty(e)&&(c[e]=E(c[e]))}if(-1!=["Polygon","Polygon3D","HighlightArea","DynamicWater"].indexOf(this.type))for(let e of a)e.coordinates=O(e.coordinates);for(let e of a)e.hasOwnProperty("userData")&&(c=e.userData,this._isJsonString(c)&&(e.userData=c.replace(/"/g,"~!@~!@~!@")))}_isJsonString(a){try{return"string"===typeof a?(JSON.parse(a),!0):!1}catch(b){return!1}}_add(a, b){this._processProps(a);return this.int.call({command:this._checkCommand("_Add"),data:F(a)},b)}_update(a,b){this._processProps(a);return this.int.call({command:this._checkCommand("_Update"),data:F(a)},b)}_delete(a,b){return this.int.call({command:this._checkCommand("_Delete"),ids:K(a)},b)}_clear(a){return this.int.call0(this._checkCommand("_Clear"),a)}_get(a,b){return this.int.call({command:this._checkCommand("_Get"),ids:K(a)},b)}_focus(a,b,c,e,d){"function"==typeof c&&(d=c,c=void 0);"function"== typeof e&&(d=e,e=null);return this.int.call({command:this._checkCommand("_Focus"),ids:K(a),distance:b||0,flyTime:c,rotation:e},d)}_focusAll(a,b,c,e){"function"==typeof b&&(e=b,b=void 0);"function"==typeof c&&(e=c,c=null);return this.int.call({command:this._checkCommand("_FocusAll"),ids:[],distance:a||0,flyTime:b,rotation:c},e)}_show(a,b){return this.int.call({command:this._checkCommand("_Show"),ids:K(a)},b)}_showAll(a){return this.int.call0(this._checkCommand("_ShowAll"),a)}_hide(a,b){return this.int.call({command:this._checkCommand("_Hide"), ids:K(a)},b)}_hideAll(a){return this.int.call0(this._checkCommand("_HideAll"),a)}_updateOneProp(a,b,c,e){if(this._useBatchUpdate){e=!1;for(var d of this._tempUpdateData)if(d.id==a.toString()){e=!0;d[b]=c;break}e||(e={},e.id=a.toString(),e[b]=c,this._tempUpdateData.push(e))}else return d={},d.id=a.toString(),d[b]=c,this.update(d,e)}updateBegin(){this._useBatchUpdate=!0;this._tempUpdateData=[]}updateEnd(a){a=this.update(this._tempUpdateData,a);this._tempUpdateData=null;this._useBatchUpdate=!1;return a}test(){alert("test")}} class ib extends Q{constructor(a){super(a,"Beam","color")}add(a,b){return super._add(a,b)}update(a,b){return super._update(a,b)}delete(a,b){return super._delete(a,b)}clear(a){return super._clear(a)}focus(a,b,c,e,d){return super._focus(a,b,c,e,d)}show(a,b){return super._show(a,b)}hide(a,b){return super._hide(a,b)}showAll(a){return super._showAll(a)}hideAll(a){return super._hideAll(a)}get(a,b){return super._get(a,b)}setDuration(a,b,c){return super._updateOneProp(a,"duration",b,c)}setThickness(a,b,c){return super._updateOneProp(a, "thickness",b,c)}setInterval(a,b,c){return super._updateOneProp(a,"interval",b,c)}setVelocity(a,b,c){return super._updateOneProp(a,"velocity",b,c)}setColor(a,b,c){return super._updateOneProp(a,"color",E(b),c)}setCoordinates(a,b,c){return super._updateOneProp(a,"coordinates",b,c)}}class jb extends Q{constructor(a){super(a,"CameraTour")}add(a,b){return super._add(a,b)}update(a,b){return super._update(a,b)}delete(a,b){return super._delete(a,b)}play(a,b){return this.int.call({command:p.CameraTour_Play, ids:K(a)},b)}pause(a){return this.int.call0(p.CameraTour_Pause,a)}resume(a){return this.int.call0(p.CameraTour_Resume,a)}stop(a){return this.int.call({command:p.CameraTour_Stop},a)}setUserData(a,b,c){return super._updateOneProp(a,"userData",b,c)}setDuration(a,b,c){return super._updateOneProp(a,"duration",b,c)}setKeyFrames(a,b,c){return super._updateOneProp(a,"keyFrames",b,c)}setName(a,b,c){return super._updateOneProp(a,"name",b,c)}}class kb extends Q{constructor(a){super(a,"Cesium3DTile")}add(a,b){return super._add(a, b)}update(a,b){return super._update(a,b)}delete(a,b){return super._delete(a,b)}clear(a){return super._clear(a)}focus(a,b,c,e,d){return super._focus(a,b,c,e,d)}show(a,b){return super._show(a,b)}showAll(a){return super._showAll(a)}hide(a,b){return super._hide(a,b)}hideAll(a){return super._hideAll(a)}get(a,b){return super._get(a,b)}setTileURL(a,b,c){return super._updateOneProp(a,"tileURL",b,c)}}class lb extends Q{constructor(a){super(a,"CustomMesh","color")}add(a,b){return super._add(a,b)}update(a,b){return super._update(a, b)}delete(a,b){return super._delete(a,b)}clear(a){return super._clear(a)}focus(a,b,c,e,d){return super._focus(a,b,c,e,d)}show(a,b){return super._show(a,b)}hide(a,b){return super._hide(a,b)}get(a,b){return super._get(a,b)}setCoordinates(a,b,c){return super._updateOneProp(a,"coordinates",b,c)}setIndices(a,b,c){return super._updateOneProp(a,"indices",b,c)}setColor(a,b,c){return super._updateOneProp(a,"color",b,c)}}class mb extends Q{constructor(a){super(a,"CustomObject")}add(a,b){return super._add(a, b)}update(a,b){return super._update(a,b)}delete(a,b){return super._delete(a,b)}clear(a){return super._clear(a)}focus(a,b,c,e,d,h){"function"==typeof c&&(h=c,c=void 0);"function"==typeof e&&(h=e,e=null);"function"==typeof d&&(h=d,d=0);1a[3]||a[1]>a[4]||a[2]>a[5])return!1}else return!1;return!0}add(a,b,c,e,d,h,g,q,k,f,l){return this._checkBBox(b)? "undefined"==typeof d||"function"==typeof d?this.int.call({command:p.HeatMap_Add,id:a.toString(),bbox:b,range:c,data:F(e),style:-1},l):0==d?this.int.call({command:p.HeatMap_Add,id:a.toString(),bbox:b,range:c,data:F(e),style:0,textureSize:h,opacityMode:g,opacityRange:q,blur:k,colors:f},l):this.int.call({command:p.HeatMap_Add,id:a.toString(),bbox:b,range:c,data:F(e),style:-1},l):(this.int.logWithColor("red","Invalid bbox value"),!1)}update(a,b,c,e,d){a={command:p.HeatMap_Update,id:a.toString()};if(b){if(!this._checkBBox(b))return this.int.logWithColor("red", "Invalid bbox value"),!1;a.bbox=b}c&&(a.range=c);e&&(a.data=F(e));return this.int.call(a,d)}delete(a,b){return super._delete(a,b)}clear(a){return super._clear(a)}focus(a,b,c,e,d){return super._focus(a,b,c,e,d)}show(a,b){return super._show(a,b)}hide(a,b){return super._hide(a,b)}get(a,b){return super._get(a,b)}addPoints(a,b,c){return this.int.call({command:p.HeatMap_AddPoints,id:a,data:F(b)},c)}removePoints(a,b,c){return this.int.call({command:p.HeatMap_RemovePoints,id:a,pointIds:F(b)},c)}setRange(a, b,c){return this.int.call({command:p.HeatMap_Update,id:a,range:b},c)}setBBox(a,b,c){return this._checkBBox(b)?this.int.call({command:p.HeatMap_Update,id:a,bbox:b},c):(this.int.logWithColor("red","Invalid bbox value"),!1)}}class tb extends Q{constructor(a){super(a,"HeatMap3D")}_checkBBox(a){if(a instanceof Array){if(6!=a.length||a[0]>a[3]||a[1]>a[4]||a[2]>a[5])return!1}else return!1;return!0}add(a,b){return this.int.call({command:p.HeatMap3D_Add,data:F(a)},b)}addVoxels(a,b){return this.int.call({command:p.HeatMap_AddVoxels, data:F(a)},b)}update(a,b){return this.int.call({command:p.HeatMap3D_Update,data:F(a)},b)}delete(a,b){return super._delete(a,b)}clear(a){return super._clear(a)}focus(a,b,c,e,d){return super._focus(a,b,c,e,d)}show(a,b){return super._show(a,b)}hide(a,b){return super._hide(a,b)}get(a,b){return super._get(a,b)}setDisplayMode(a,b,c){return this.int.call({command:p.HeatMap3D_Update,id:a,displayMode:b},c)}}class ub extends Q{constructor(a){super(a,"HighlightArea","color")}add(a,b){return super._add(a,b)}update(a, b){return super._update(a,b)}delete(a,b){return super._delete(a,b)}clear(a){return super._clear(a)}focus(a,b,c,e,d){return super._focus(a,b,c,e,d)}show(a,b){return super._show(a,b)}hide(a,b){return super._hide(a,b)}get(a,b){return super._get(a,b)}setColor(a,b,c){return super._updateOneProp(a,"color",E(b),c)}setCoordinates(a,b,c){return super._updateOneProp(a,"coordinates",b,c)}setHeightRange(a,b,c){return super._updateOneProp(a,"heightRange",b,c)}setIntensity(a,b,c){return super._updateOneProp(a, "intensity",b,c)}setDepthTest(a,b,c){return super._updateOneProp(a,"depthTest",b,c)}}class vb extends Q{constructor(a){super(a,"ImageryLayer")}init(a,b){return this.int.call({command:p.ImageryLayer_Init,xmlPath:a.xmlUrl,layerName:a.layerName,tileMatrixName:a.tileMatrixName,ogcEPSG:a.ogcEPSG,cachePath:a.cachePath,mapMode:a.mapMode,renderMode:a.renderMode},b)}add(a,b){const c=this;return $jscomp.asyncExecutePromiseGeneratorFunction(function*(){return a instanceof Array?new Promise(e=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){let d; for(let h of a)if(d=yield c.addOne(h,b),0!=d.result){e(d);break}e(d)})):c.addOne(a,b)})}addOne(a,b){return this.int.call({command:p.ImageryLayer_Add,id:a.id,url:a.url,xmlPath:a.xmlPath,layerName:a.layerName,tileMatrixName:a.tileMatrixName,ogcEPSG:a.ogcEPSG},b)}show(a,b){return super._show(a,b)}hide(a,b){return super._hide(a,b)}delete(a,b){return super._delete(a,b)}}class wb extends Q{constructor(a){super(a,"Light","color")}add(a,b){return super._add(a,b)}update(a,b){return super._update(a,b)}delete(a, b){return super._delete(a,b)}clear(a){return super._clear(a)}focus(a,b,c,e,d){return super._focus(a,b,c,e,d)}show(a,b){return super._show(a,b)}showAll(a){return super._showAll(a)}hide(a,b){return super._hide(a,b)}hideAll(a){return super._hideAll(a)}get(a,b){return super._get(a,b)}}class xb extends Q{constructor(a){super(a,"Marker","fontColor|fontOutlineColor|textBackgroundColor|lineColor")}add(a,b){this._fixMarkerData(a);return super._add(a,b)}_fixMarkerProperty(a){a.textColor&&(a.fontColor=a.textColor); a.url&&(a.popupURL=a.url);a.dispalyMode&&(a.displayMode=a.dispalyMode);S(a.displayMode)&&(a.displayMode=4);a.popupURL&&!a.popupSize&&(a.popupSize=[600,400]);0==a.showLine&&(a.lineSize=[0,0]);1!=a.showLine||null!=a.lineSize&&void 0!=a.lineSize||(a.lineSize=[2,100]);4==a.displayMode&&0{za="zh"===a?"zh":"en";ta={};a="zh"==za;for(let b in Aa){let c=Aa[b];ta[b]=a?c[0]:c[1]}for(let b of H.onLanguageChangedCallbacks)"function"==typeof b&&b()};H.getString=a=>ta[a];class Mb{constructor(a){this.int=a;this._useOldDataFormat=!1}useOldDataFormat(a){this._useOldDataFormat=a||!0}get(a){return this.int.call0(p.Camera_GetCamera,a)}_setByArray(a,b,c){return this.set(a[0],a[1],a[2],a[3],a[4],b,c)}_setByObject(a,b,c){return this.set(a.x,a.y,a.z,a.pitch,a.yaw,b,c)}set(a,b,c,e,d, h,g){if(a instanceof Array&&5<=a.length)return this._setByArray(a,b,c);if("object"==typeof a&&a.hasOwnProperty("x"))return this._setByObject(a,b,c);"function"==typeof h&&(g=h,h=void 0);if(this._useOldDataFormat){let q=e;e=d;d=q}return this.int.call({command:p.Camera_Set,coordinate:[a,b,c],pitch:e||0,yaw:d||0,flyTime:h},g)}lookAt(a,b,c,e,d,h,g,q){"function"==typeof g&&(q=g,g=void 0);if(this._useOldDataFormat){let k=d;d=h;h=k}return this.int.call({command:p.Camera_Set,coordinate:[a,b,c],distance:e, pitch:d||0,yaw:h||0,flyTime:g},q)}lookAtBBox(a,b,c,e,d){"function"==typeof e&&(d=e,e=void 0);if(this._useOldDataFormat){let h=b;b=c;c=h}return this.int.call({command:p.Camera_LookAtBBox,bbox:a,pitch:b||0,yaw:c||0,flyTime:e},d)}playAnimation(a,b){return this.int.call({command:p.Camera_PlayAnimation,id:a},b)}stopAnimation(a){return this.int.call0(p.Camera_StopAnimation,a)}pauseAnimation(a){return this.int.call0(p.Camera_PauseAnimation,a)}resumeAnimation(a){return this.int.call0(p.Camera_ResumeAnimation, a)}getAnimationList(a){return this.int.call0(p.Camera_GetAnimationList,a)}getAnimationImage(a,b){return this.int.call({command:p.Camera_GetAnimationImage,name:a},b)}moveForward(a){return this.int.call({command:p.Camera_Move,moveForward:!0},a)}moveBackward(a){return this.int.call({command:p.Camera_Move,moveBackward:!0},a)}moveLeft(a){return this.int.call({command:p.Camera_Move,moveLeft:!0},a)}moveRight(a){return this.int.call({command:p.Camera_Move,moveRight:!0},a)}moveUp(a){return this.int.call({command:p.Camera_Move, moveUp:!0},a)}moveDown(a){return this.int.call({command:p.Camera_Move,moveDown:!0},a)}turnLeft(a){return this.int.call({command:p.Camera_Move,turnLeft:!0},a)}turnRight(a){return this.int.call({command:p.Camera_Move,turnRight:!0},a)}turnUp(a){return this.int.call({command:p.Camera_Move,turnUp:!0},a)}turnDown(a){return this.int.call({command:p.Camera_Move,turnDown:!0},a)}stop(a){return this.int.call({command:p.Camera_Move,stop:!0},a)}getEulerAngle(a,b){const c=360/(2*Math.PI);let e=b[0]-a[0],d=b[1]- a[1];return[Math.atan2(b[2]-a[2],Math.sqrt(e*e+d*d))*c,Math.atan2(e,d)*c-90,0]}lockByBBox(a,b){return this.int.call({command:p.Camera_LockBBox,bbox:a},b)}unlock(a){return this.int.call({command:p.Camera_UnLockBBox},a)}flyAround(a,b,c,e,d){return this.int.call({command:p.Camera_FlyAround,coordinate:a,rotation:b||[0,90,0],distance:c||1E3,time:e||10},d)}enterWorld(a){return this.int.call({command:p.Camera_ExitWorldAnimation},a)}exitWorld(a){return this.int.call({command:p.Camera_EnterWorldAnimation}, a)}}class Nb{constructor(a){this.int=a}screen2World(a,b,c){return this.int.call({command:p.Coord_Screen2World,screenPosition:[a,b]},c)}world2Screen(a,b,c,e){return this.int.call({command:p.Coord_World2Screen,worldlocation:[a,b,c]},e)}gcs2pcs(a,b,c){"function"==typeof b&&(c=b);S(b)&&(b=1);if(1==b)return this.int.call({command:p.Coord_GCS2PCS,coordinates:T(a)},c);2==b?this.transform(T(a),2,0,c):3==b?this.transform(T(a),3,0,c):console.error("\u672a\u77e5\u5750\u6807\u7cfb\u7c7b\u578b")}pcs2gcs(a,b,c){"function"== typeof b&&(c=b);S(b)&&(b=1);if(1==b)return this.int.call({command:p.Coord_PCS2GCS,coordinates:T(a)},c);2==b?this.transform(T(a),0,2,c):3==b?this.transform(T(a),0,3,c):console.error("\u672a\u77e5\u5750\u6807\u7cfb\u7c7b\u578b")}transform(a,b,c,e){return this.int.call({command:p.Coord_Transform,coordinates:T(a),src:b,dest:c},e)}}class Ob{constructor(a){this.int=a}start(a){return this.int.call0(p.EditHelper_Start,a)}cancel(a){return this.int.call0(p.EditHelper_Quit,a)}finish(a,b){return this.int.call({command:p.EditHelper_Finish, withOffset:a||!0},b)}setParam(a,b,c,e){return this.int.call({command:p.EditHelper_SetParam,lineType:a,buildType:b,color:E(c)},e)}}class Pb{constructor(a){this.int=a}setVisibility(a,b){return this.int.call({command:p.InfoTree_SetVisibility,layers:F(a)},b)}show(a,b){return this.int.call({command:p.InfoTree_Show,ids:K(a)},b)}hide(a,b){return this.int.call({command:p.InfoTree_Hide,ids:K(a)},b)}enableXRay(a,b,c){return this.int.call({command:p.InfoTree_EnableXRay,ids:F(a),color:E(b)},c)}disableXRay(a, b){return this.int.call({command:p.InfoTree_DisableXRay,ids:F(a)},b)}showByGroupId(a,b){return this.int.call({command:p.InfoTree_ShowByGroupId,ids:K(a)},b)}hideByGroupId(a,b){return this.int.call({command:p.InfoTree_HideByGroupId,ids:K(a)},b)}highlightByGroupId(a,b){return this.int.call({command:p.InfoTree_HighlightByGroupId,ids:K(a)},b)}deleteByGroupId(a,b){return this.int.call({command:p.InfoTree_DeleteByGroupId,ids:K(a)},b)}get(a){return this.int.call0(p.InfoTree_Get,a)}focus(a,b){return this.int.call({command:p.InfoTree_Focus, ids:K(a)},b)}}class Qb{constructor(a){this.int=a;this.apiVersion="5.4";this.apiVersionServer=""}isApiVersionMatched(){return"5.4"==this.apiVersionServer}addImageButtons(a,b){return this.int.call({command:p.Misc_AddImageButton,data:F(a)},b)}deleteImageButtons(a,b){return this.int.call({command:p.Misc_DeleteImageButton,ids:K(a)},b)}addAnimatedImageButtons(a,b){return this.int.call({command:p.Misc_AddAnimatedImageButton,data:F(a)},b)}setApiVersionReceived(a){this.int.onApiVersionReceived=a}playVideo(a, b,c,e,d,h,g){return this.int.call({command:p.Misc_PlayVideo,data:[{id:a.toString(),position:[b,c],size:[e,d],url:h}]},g)}stopPlayVideo(a,b){return this.int.call({command:p.Misc_StopPlayVideo,ids:K(a)},b)}playMovie(a,b,c){"function"==typeof b&&(c=b,b=!1);return this.int.call({command:p.Misc_PlayMovie,loop:b,url:a},c)}stopMovie(a){return this.int.call({command:p.Misc_StopMovie},a)}setWindowResolution(a,b,c){return this.int.call({command:p.Misc_SetWindowResolution,cx:a,cy:b,mode:0},c)}callBPFunction(a, b){return this.int.call({command:p.Misc_CallBPFunction,data:F(a)},b)}enterReportMode(a){return this.int.call0(p.Misc_EnterReportMode)}exitReportMode(a){return this.int.call0(p.Misc_ExitReportMode,a)}showAllFoliages(a){return this.int.call0(p.Misc_ShowAllFoliages,a)}hideAllFoliages(a){return this.int.call0(p.Misc_HideAllFoliages,a)}startProcess(a,b,c,e){"function"==typeof c&&(e=c,c=!0);return this.int.call({command:p.Misc_StartProcess,appName:a,commandLine:b,visible:c},e)}enterMultiViewportMode(a, b,c,e){if(null==b||void 0==b)b="#DEA309";if(null==c||void 0==c)c=2;return this.int.call({command:p.Misc_EnterMultiViewport,type:a,lineColor:E(b),lineThickness:c},e)}exitMultiViewportMode(a){return this.int.call({command:p.Misc_ExitMultiViewport},a)}setActiveViewport(a,b){return this.int.call({command:p.Misc_SetActivateMultiViewport,viewIndex:F(a)},b)}getActiveViewport(a){return this.int.call({command:p.Misc_GetActivateMultiViewport},a)}setMultiviewportInteractSync(a,b){this.setCameraFollow4Viewport(a, b)}setCameraFollow4Viewport(a,b){return this.int.call({command:p.Misc_UpdateMultiViewport,moverTogether:a},b)}downloadPakFiles(a,b){return this.int.call({command:p.Misc_downloadPakFiles,ids:F(a)},b)}getConvexPolygon(a,b){return this.int.call({command:p.Misc_ConvexHull2D,data:F(a)},b)}getMaterial(a,b){return this.int.call({command:p.Misc_QueryActorOrMaterial,idOrPaths:F(a)},b)}getBPFunction(a,b){return this.int.call({command:p.Misc_QueryActorOrMaterial,idOrPaths:F(a)},b)}startPolygonClip(a,b,c){return this.int.tools.startPolygonClip(a, b,c)}stopClip(a){return this.int.tools.stopClip(a)}playAnimation(a,b){return this.int.camera.playAnimation(a,b)}stopAnimation(a){return this.int.camera.stopAnimation(a)}setDateTime(a,b,c,e,d,h,g){return this.int.weather.setDateTime(a,b,c,e,d,h,g)}setQueryToolState(a,b){return this.int.call({"c.ommand":p.Settings_SetMousePickMask,mouseClick:a},b)}setCampassVisible(a,b){return this.int.settings.setCampassVisible(a,b)}setMainUIVisibility(a,b){return this.int.settings.setMainUIVisibility(a,b)}setMousePickMask(a, b){return this.int.settings.setMousePickMask(a,b)}}class Rb{constructor(a){this.int=a}setMapMode(a,b,c){b=b||{};return this.int.call({command:p.Settings_SetMapMode,mode:a,serviceType:b.serviceType||0,coordType:b.coordType||0,mapPoint:b.mapPoint||[0,0],longitude:b.longitude||0,latitude:b.latitude||0,cache:b.cache||":memory:",style:b.style||"mapbox://styles/mapbox/streets-v10",groundHeight:b.groundHeight||0,renderMode:b.renderMode||0,decalMode:b.decalMode||1,serverURL:b.serverURL,coordOrder:b.coordOrder, maxLevel:b.maxLevel},c)}getMapMode(a){return this.int.call0(p.Settings_GetMapMode,a)}setWMTSLayerVisible(a,b){this.setwmtsLayerVisible(a,b)}setwmtsLayerVisible(a,b){return this.int.call({command:p.Settings_SetWMTSLayerVisible,data:F(a)},b)}setWMTSLayerOpacity(a,b){return this.int.call({command:p.Settings_SetWMTSLayerOpacity,data:F(a)},b)}setMapURL(a,b){return this.int.call({command:p.Settings_SetMapURL,url:a},b)}highlightColor(a,b){return this.setHighlightColor(a,b)}setHighlightColor(a,b){return this.int.call({command:p.Settings_SetHighlightColor, color:E(a)},b)}setFovX(a,b){return this.int.call({command:p.Settings_SetFovX,value:a},b)}setOceanColor(a,b){return this.int.call({command:p.Settings_SetOceanColor,color:E(a)},b)}setEnableInteract(a,b){return this.int.call({command:p.Settings_SetEnableInteract,enableInteract:a},b)}setInteractiveMode(a,b){return this.int.call({command:p.Settings_SetInteractiveMode,mode:a},b)}getInteractiveMode(a){return this.int.call({command:p.Settings_GetInteractiveMode},a)}setCampassVisible(a,b){return this.int.call({command:p.Settings_SetCampassVisible, visible:a},b)}setCampassPosition(a,b,c){return this.int.call({command:p.Settings_SetCampassPosition,position:[a,b]},c)}restoreCampassPosition(a){this.setCampassPosition(-1,-1)}setMainUIVisibility(a,b){return this.int.call({command:p.Settings_SetMainUIVisibility,visible:a},b)}setMousePickMask(a,b){let c=!1,e=!1,d=!1;a&qa.MouseClick&&(c=!0);a&qa.MouseMove&&(e=!0);a&qa.MouseHover&&(d=!0);return this.int.call({command:p.Settings_SetMousePickMask,mouseClick:c,mouseMove:e,mouseHover:d},b)}setTerrainAlpha(a, b){return this.int.call({command:p.Settings_SetTerrainAlpha,alpha:a},b)}setEnableCameraMovingEvent(a,b,c){return this.int.call({command:p.Settings_EnableCameraMovingEvent,bEnable:a,monitorThreshold:b},c)}setLabelLayer(a,b){return this.int.call({command:p.VTPKService_Set,vtpk:a},b)}getLabelLayer(a){return this.int.call({command:p.VTPKService_Get},a)}removeLabelLayer(a){return this.int.call({command:p.VTPKService_Set,vtpk:""},a)}setRenderedCursorVisible(a,b){this.setCursorAutoSync(a,b)}setCursorAutoSync(a, b){return this.int.call({command:p.Settings_CursorAutoSync,useSoftwareCursor:a},b)}}class Sb{constructor(a){this.int=a}setReportMode(a,b,c,e){return this.int.call({command:p.Settings_SetReport,alignment:a,playMode:b,moveInOtherView:c},e)}getReportMode(a){return this.int.call({command:p.Settings_GetReport},a)}setControlMode(a,b,c,e,d){return this.int.call({command:p.Settings_SetControl,speed:a,yawSpeed:b,rotateSelf:c,useFemale:e},d)}getControlMode(a){return this.int.call({command:p.Settings_GetControl}, a)}setPostProcessMode(a,b){let c=1E3,e=1E3;0<=a.terrainGlobalAlpha&&1>=a.terrainGlobalAlpha&&(c=1E3*a.terrainGlobalAlpha);0<=a.osgbGlobalAlpha&&1>=a.osgbGlobalAlpha&&(e=1E3*a.osgbGlobalAlpha);return this.int.call({command:p.Settings_SetPostProcess,contrast:a.contrast,saturation:a.saturation,lensFlareIntensity:a.lensFlareIntensity,ambientIntensity:a.ambientIntensity,bloomIntensity:a.bloomIntensity,lutMode:a.lutMode,lutIntensity:a.lutIntensity,darkCorner:a.darkCorner,screenPercentage:a.screenPercentage, terrainGlobalAlpha:c,terrainGlobalLitStatus:a.terrainGlobalLitStatus,osgbGlobalLitStatus:a.osgbGlobalLitStatus,osgbGlobalAlpha:e,antiAliasing:a.antiAliasing,tonemapper:a.tonemapper,postProcessEffects:a.postProcessEffects,dofMode:a.dofMode,wireThickness:a.wireThickness,receiveDecalMode:a.receiveDecalMode},b)}getPostProcessMode(a){return this.int.call({command:p.Settings_GetPostProcess},a)}setCameraMode(a,b,c,e,d){e&&"function"==typeof e&&(d=e);return this.int.call({command:p.Settings_SetCamera,nearClipPlane:a, fovH:b,minCamHeight:c,maxCamHeight:e},d)}getCameraMode(a){return this.int.call({command:p.Settings_GetCamera},a)}setMapMode(a,b,c){b=b||{};return this.int.call({command:p.Settings_SetMapMode,mode:a,serviceType:b.serviceType||0,coordType:b.coordType||0,mapPoint:b.mapPoint||[0,0],longitude:b.longitude||0,latitude:b.latitude||0,cache:b.cache||":memory:",style:b.style||"mapbox://styles/mapbox/streets-v10",groundHeight:b.groundHeight||0,renderMode:b.renderMode||0,decalMode:b.decalMode||1,serverURL:b.serverURL, coordOrder:b.coordOrder,maxLevel:b.maxLevel},c)}getMapMode(a){return this.int.call0(p.Settings_GetMapMode,a)}}class Tb{constructor(a){this.int=a}startPolygonClip(a,b,c){return this.int.call({command:p.Tools_StartPolygonClip,data:F({id:"0",coordinates:O(a),toggleImageCut:b})},c)}startPlaneClip(a,b,c,e,d){return this.int.call({command:p.Tools_StartPlaneClip,location:a,rotation:b,isShowPlane:c,isEdit:e},d)}startVolumeClip(a,b,c,e,d,h){return this.int.call({command:p.Tools_StartVolumeClip,bbox:a,rotation:d, value:b,isShowPlane:c,isEdit:e},h)}updateVolumeClip(a,b,c,e,d,h){return this.int.call({command:p.Tools_UpdateVolumeClip,bbox:a,rotation:d,value:b,isShowPlane:c,isEdit:e},h)}stopClip(a){return this.stopPolygonClip(a)}stopPolygonClip(a){return this.int.call0(p.Tools_StopClip,a)}stopPlaneClip(a){return this.int.call({command:p.Tools_StopPlaneClip},a)}stopVolumeClip(a){return this.int.call({command:p.Tools_StopVolumeClip},a)}setMeasurement(a,b,c){b=b||{};return this.int.call({command:p.Tools_SetMeasurement, type:a,pointSize:b.pointSize,textSize:b.textSize,textColor:E(b.textColor),pointColor:E(b.pointColor),lineColor:E(b.lineColor),areaColor:E(b.areaColor),showCoordinateText:b.showCoordinateText},c)}startMeasurement(a){return this.int.call0(p.Tools_StartMeasurement,a)}stopMeasurement(a){return this.int.call0(p.Tools_StopMeasurement,a)}lineIntersect(a,b,c){return this.int.call({command:p.Tools_LineIntersect,data:[{start:a,end:b}],highPrecision:!1,returnDetails:!0},c)}linesIntersect(a,b,c,e){return this.int.call({command:p.Tools_LineIntersect, data:F(a),highPrecision:b,returnDetails:c},e)}startGeometryEdit(a,b,c){return this.int.call({command:p.Tools_StartGeometryEdit,id:a,type:b},c)}stopGeometryEdit(a){return this.int.call0(p.Tools_StopGeometryEdit,a)}startSkylineAnalysis(a,b){a=a||{};a.outlineColor&&(a.outlineColor=E(a.outlineColor));a.sceneColor&&(a.sceneColor=E(a.sceneColor));a.skylineColor&&(a.skylineColor=E(a.skylineColor));a.backgroundColor&&(a.backgroundColor=E(a.backgroundColor));if(a.tileLayers){a.tileLayers=F(a.tileLayers);for(let c of a.tileLayers)c.hasOwnProperty("color")&& (c.color=E(c.color))}a.command=p.Tools_StartSkylineAnalysis;return this.int.call(a,b)}stopSkylineAnalysis(a){return this.int.call0(p.Tools_StopSkylineAnalysis,a)}exportSkyline(a,b,c,e){c=c||{};c.skylineColor&&(c.skylineColor=E(c.skylineColor));c.backgroundColor&&(c.backgroundColor=E(c.backgroundColor));if(c.tileLayers){c.tileLayers=F(c.tileLayers);for(let d of c.tileLayer)d.hasOwnProperty("color")&&(d.color=E(d.color))}return this.int.call({command:p.Tools_ExportSkyline,path:a,size:b,skylineColor:c.skylineColor, backgroundColor:c.backgroundColor},e)}startViewshedAnalysis(a,b){a=a||{};a.visibleColor&&(a.visibleColor=E(a.visibleColor));a.invisibleColor&&(a.invisibleColor=E(a.invisibleColor));a.command=p.Tools_StartViewshedAnalysis;return this.int.call(a,b)}stopViewshedAnalysis(a){return this.int.call0(p.Tools_StopViewshedAnalysis,a)}startVisiblityAnalysis(a,b){a=a||{};a.visibleColor&&(a.visibleColor=E(a.visibleColor));a.invisibleColor&&(a.invisibleColor=E(a.invisibleColor));a.command=p.Tools_StartVisiblityAnalysis; return this.int.call(a,b)}stopVisiblityAnalysis(a){return this.int.call0(p.Tools_StopVisiblityAnalysis,a)}startViewDomeAnalysis(a,b){a=a||{};a.visibleColor&&(a.visibleColor=E(a.visibleColor));a.invisibleColor&&(a.invisibleColor=E(a.invisibleColor));a.command=p.Tools_StartViewDomeAnalysis;return this.int.call(a,b)}stopViewDomeAnalysis(a){return this.int.call0(p.Tools_StopViewDomeAnalysis,a)}startCutFillAnalysis(a,b){a=a||{};a.cutLineColor&&(a.cutLineColor=E(a.cutLineColor));a.fillLineColor&&(a.fillLineColor= E(a.fillLineColor));a.cutPointColor&&(a.cutPointColor=E(a.cutPointColor));a.fillPointColor&&(a.fillPointColor=E(a.fillPointColor));a.gridColor&&(a.gridColor=E(a.gridColor));a.command=p.Tools_StartCutFillAnalysis;return this.int.call(a,b)}stopCutFillAnalysis(a){return this.int.call0(p.Tools_StopCutFillAnalysis,a)}startSunshineAnalysis(a,b){var c=/^(0?[0-9]|1[0-9]|[2][0-3]):(0?[0-9]|[1-5][0-9])$/;if(null==a||void 0==a)console.error("\u53c2\u6570\u4e0d\u80fd\u4e3a\u7a7a");else{let e=a.startTime,d=a.endTime; if(null==e||""==e||null==d||""==d)console.error("\u65f6\u95f4\u53c2\u6570\u683c\u5f0f\u4e0d\u6b63\u786e");else if(e.match(c)&&d.match(c))if(e.split(":"))if(a.startHour=parseInt(e.split(":")[0]),a.startMinute=parseInt(e.split(":")[1]),d.split(":"))if(a.endHour=parseInt(d.split(":")[0]),a.endMinute=parseInt(d.split(":")[1]),a.startHour>a.endHour)console.error("\u5f00\u59cb\u65f6\u95f4\u4e0d\u80fd\u5927\u4e8e\u7ed3\u675f\u65f6\u95f4");else{if(a.startHour==a.endHour){if(a.startMinute==a.endMinute){console.error("\u5f00\u59cb\u65f6\u95f4\u4e0d\u80fd\u7b49\u4e8e\u7ed3\u675f\u65f6\u95f4"); return}if(a.startMinute>a.endMinute){console.error("\u5f00\u59cb\u65f6\u95f4\u4e0d\u80fd\u5927\u4e8e\u7ed3\u675f\u65f6\u95f4");return}}S(a.groundElevation)||(c=a.groundElevation,!isNaN(parseFloat(c))&&isFinite(c)&&(a.undersideHeight=a.groundElevation,delete a.groundElevation));a.command=p.Tools_StartSunshineAnalysis;return this.int.call(a,b)}else console.error("\u53c2\u6570endTime\u65f6\u95f4\u683c\u5f0f\u4e0d\u6b63\u786e");else console.error("\u53c2\u6570startTime\u65f6\u95f4\u683c\u5f0f\u4e0d\u6b63\u786e"); else console.error("\u65f6\u95f4\u53c2\u6570\u683c\u5f0f\u4e0d\u6b63\u786e")}}stopSunshineAnalysis(a){return this.int.call0(p.Tools_StopSunshineAnalysis,a)}startTerrainSlopeAnalysis(a,b){a.command=p.Tools_StartTerrainSlopeAnalysis;return this.int.call(a,b)}stopTerrainSlopeAnalysis(a){return this.int.call0(p.Tools_StopTerrainSlopeAnalysis,a)}startContourLineAnalysis(a,b){a.command=p.Tools_StartContourLineAnalysis;return this.int.call(a,b)}stopContourLineAnalysis(a){return this.int.call0(p.Tools_StopContourLineAnalysis, a)}startFloodFill(a,b){a=a||{};a.color&&(a.color=E(a.color));a.command=p.Tools_StartFloodFill;return this.int.call(a,b)}stopFloodFill(a){return this.int.call0(p.Tools_StopFloodFill,a)}replaceTextureByVideo(a,b,c){return this.int.call({command:p.Tools_ReplaceTexture,texturePackage:a,newTexture:b,type:1},c)}replaceTextureByImage(a,b,c){return this.int.call({command:p.Tools_ReplaceTexture,texturePackage:a,newTexture:b,type:2},c)}replaceTextureByUrl(a,b,c){return this.int.call({command:p.Tools_ReplaceTexture, texturePackage:a,newTexture:b,type:3},c)}restoreTexture(a,b){return this.int.call({command:p.Tools_RestoreTexture,ids:F(a)},b)}showPanel(a,b,c){this.showAnalysisPanel(a,b,c)}hidePanel(a){this.hideAnalysisPanel(a)}showAnalysisPanel(a,b,c){return this.int.call({command:p.Tools_AnalysisPopupAttributes,type:a,position:b},c)}hideAnalysisPanel(a){return this.int.call({command:p.Tools_AnalysisCloseAttributes},a)}}class Ub{constructor(a){this.int=a}getParams(a){return this.int.call0(p.Weather_GetParams,a)}_setParam(a, b){return this.int.call({command:p.Weather_SetParams,data:a},b)}setDateTime(a,b,c,e,d,h,g){return this.int.call({command:p.Weather_SetDate,year:a,month:b,day:c,hour:e,minute:d,daynightLoop:h},g)}getDateTime(a){return this.int.call0(p.Weather_GetDate,a)}simulateTime(a,b,c,e){let d=0,h=0,g=0,q=0;a instanceof Array?(0this.sendApi(c))}setHost(a,b){this.url=`ws://${a}:${b}`}connectWebSocket(){if(!this.player){this.log(`Connecting: ${this.url}`);if("undefined"==typeof window)this.websocket=new (require("ws"))(this.url);else{if(!("WebSocket"in window)){console.error("Not Support WebSocket!");return}this.websocket=new WebSocket(this.url)}this.websocket.onopen= ()=>this.onConnectionOpen();this.websocket.onmessage=a=>this.onConnectionMessage(a.data);this.websocket.onclose=a=>this.onConnectionClose(a);this.websocket.onerror=a=>this.onConnectionError(a)}}setEventCallback(a){this.options.onEvent=a}destroy(){this.isDestroyed=!0;this.player&&this.player.destroy();this.websocket&&(this.websocket.close(),this.websocket=null)}reset(a){return this.call0(p.Reset,a)}saveProject(a){return this.call0(p.SaveProject,a)}registerTick(a,b,c){b=b||{};"__execute__"!=a&&(b.func= "tick");this.call({command:p.RegisterJsCommunication,id:this.tickMarkerId,url:a,func:b.func,x:b.x||4,y:b.y||4,width:b.width||400,height:b.height||300,visible:b.visible||!1},c)}removeTick(a){this.call({command:p.UnRegisterJsCommunication,ids:[this.tickMarkerId]},a)}showTickWindow(a,b){this.isCalledInCEF?ue.dtspoi.showtickwindow(a):a?this.registerTick("__show__",{},b):this.registerTick("",{},b)}executeJsInTickPage(a,b){this.registerTick("__execute__",{func:a},b)}getVersion(){return"5.4.0508"}initInterface(){this.camera= new Mb(this);this.coord=new Nb(this);this.layers=this.infoTree=new Pb(this);this.ct=this.cameraTour=new jb(this);this.tl=this.tileLayer=new Hb(this);this.tag=new Gb(this);this.marker=new xb(this);this.marker3d=new yb(this);this.ctag=this.customTag=new nb(this);this.rp=this.radiationPoint=new Eb(this);this.cm=this.customMesh=new lb(this);this.wm=this.waterMesh=new Lb(this);this.waterFlowField=new Kb(this);this.wff=this.WaterFlowField;this.line=this.polyline=new Db(this);this.ol=this.odline=new zb(this); this.p3d=this.polygon3d=new Cb(this);this.polygon=new Bb(this);this.hm=this.heatmap=new sb(this);this.hm3d=this.heatmap3d=new tb(this);this.beam=new ib(this);this.ha=this.highlightArea=new ub(this);this.co=this.customObject=new mb(this);this.vp=this.videoProjection=new Jb(this);this.panorama=new Ab(this);this.decal=new ob(this);this.dw=this.dynamicWater=new pb(this);this.ff=this.floodFill=new qb(this);this.c3d=this.cesium3DTileset=new kb(this);this.shapeFile=this.shp=this.shapeFileLayer=new Fb(this); this.light=new wb(this);this.imagery=this.imageryLayer=new vb(this);this.geoJSON=this.geoJSONLayer=new rb(this);this.vc=this.vehicle=new Ib(this);this.misc=new Qb(this);this.tools=new Tb(this);this.settings=new Rb(this);this.weather=new Ub(this);this.eh=this.editHelper=new Ob(this);this.sp=this.settingsPanel=new Sb(this)}_getCallbackIndex(){return++this.callbackIndex}call0(a,b){return this.call({command:a},b)}call(a,b){if(!this.isConnected)return this.logWithColor("red","Not connected!"),b?void 0: Promise.reject("Not connected!");if(void 0==a.command||a.command==p.None)return this.logWithColor("red","command is undefined or None"),b?void 0:Promise.reject("command is undefined or None");a.timestamp=Date.now();a.callbackIndex=this._getCallbackIndex();a.__command=p[a.command]||"Unknown";a.__version=this.getVersion();null===b&&(a.__noResponse=!0);let c=a.command+"_"+a.callbackIndex;b&&"function"==typeof b&&(this.callbackMap[c]=b);if(this.isCalledInCEF&&null===b)return delete a.__noResponse,this.callbackMap[c]= null,this.sendApi(a),a;let e=JSON.stringify(a);this.log("");this.logWithColor("RoyalBlue",`Request: ${p[a.command]||"Unknown"}`,!0);this.logWithColor("green","\uff08"+(new Date(a.timestamp)).toLocaleTimeString()+"\uff09");this.logWithColor("gray",`${e}`);if(b||null===b)this.apiQueue.push(a);else return new Promise(d=>{this.callbackMap[c]=d;this.apiQueue.push(a)})}sendApi(a){this.isCalledInCEF?ue.dtspoi.execute(JSON.stringify(a)):this.player?this.player.sendApi(a):this.sendStringByWS(a)}sendStringByWS(a){if(a){a= JSON.stringify(a);var b=a.length;if(16777216>=b)this.websocket.send(a);else{var c=Math.ceil(b/16777216),e=[];for(let d=0;dthis.savedCamera=b.camera)}}onReady(){if("function"==typeof this.options.onReady)this.options.onReady();this.call({command:p.Misc_GetVersion});if(this.player)this.player.onApiReady()}log(a,b,c){if("function"==typeof this.options.onLog)this.options.onLog(a,b,c)}logWithColor(a,b,c){this.log(b,c,a)}onConnectionOpen(){this.isConnected=!0;this.logWithColor("blue","Connected!")}onConnectionClose(a){this.isConnected=!1;this.logWithColor("red",`Connection closed! code: ${a.code|| "-"}, reason: ${1006==a.code?H.getString("Disconnect"):a.reason||a.message||"-"}`);this.log("");this.logWithColor("SpringGreen","Reconnecting...");this.isDestroyed||this.player||this.connectWebSocket()}onConnectionError(a){console.error("WebSocket error observed")}onConnectionMessage(a,b){a=a.replace(/~!@~!@~!@/g,'\\"');this.log("");let c=null;try{c=JSON.parse(a)}catch(d){this.isCalledInCEF?(document.writeln(d.message),document.writeln("
"),document.writeln(a)):(console.error(d.message),this.log("Response: [Unknown]")); return}if(c.command==p.Misc_GetVersion){this.misc.apiVersionServer=c.version||c.versionType;if("5.4"!=this.misc.apiVersionServer){var e=H.getString("VersionMismatch").format("5.4",this.misc.apiVersionServer);console.warn(e);"undefined"!=typeof window&&alert(e)}if("function"==typeof this.options.onApiVersion)this.options.onApiVersion(this.misc.apiVersionServer)}if(c.command)this.apiQueue.callNext(c.callbackIndex),e=Date.now()-c.timestamp,this.logWithColor("RoyalBlue",`Response: ${p[c.command]||"Unknown"}`, !0),this.logWithColor("green",` (${H.getString("TimeConsuming")}${e}ms)`),this.logWithColor("gray",`${H.getString("RequestTime")}${(new Date(c.timestamp)).toLocaleTimeString()}`,!0),this.logWithColor("gray",` ${H.getString("ResponseTime")}${(new Date(Date.now())).toLocaleTimeString()}`,!0),this.logWithColor("gray",` ${H.getString("MessageLength")}${a.length}`),a=c.command+"_"+c.callbackIndex,(e=this.callbackMap[a])?(e(c),delete this.callbackMap[a]):null===e&&"function"===typeof tick_next&&tick_next(c, b);else if(c.eventtype)if(this.log("Response: Event"),"CompleteInitialization"==c.eventtype)this.log("The initialization is complete, now you can call the interfaces in onReady callback function."),this.initialCameraPosition=c.InitialCamera,c.ResourcesPath&&(this.resourcesPath=c.ResourcesPath,this.log("ResourcesPath:"+this.resourcesPath)),this.onReady();else if("NodeConfiguration"==c.eventtype)this.resourcesPath=c.ResourcesPath,this.log("ResourcesPath:"+this.resourcesPath);else if("MainThreadBusy"== c.eventtype)this.apiQueue.onMainThreadBusy(c),this.player&&this.player.onMainThreadBusy(c);else{if("function"==typeof this.options.onEvent)this.options.onEvent(c)}else this.log("Response: [Unknown]");b=JSON.stringify(c,(d,h)=>h instanceof Array?JSON.stringify(h):h,"\t").replace(/"\[/g,"[").replace(/\]"/g,"]").replace(/\\"/g,'"').replace(/""/g,'"');this.logWithColor("gray",b)}quit(){return this.call0(p.Quit)}test(a,b,c){return this.call({command:p.SimulateTest__,type:a,int32Val:b},c)}}const V={WS_Disconnected:0, WS_Connecting:1,WS_Connected:2,RTC_Opened:3,Video_LoadedMetaData:4,OnReady:5},da={StartingProcess:0,CheckingBusy:1,ConfirmBusy:2,ProcessStartFailed:3,ProcessStarted:4,LoadingProject:5,ProjectLoaded:6};class Vb{constructor(){"undefined"!=typeof navigator&&(this.isUnix="Mac68K"==navigator.platform||"MacPPC"==navigator.platform||"Macintosh"==navigator.platform||"MacIntel"==navigator.platform||-1!=navigator.platform.indexOf("Linux"),this.isChrome=-1!=navigator.userAgent.indexOf("Chrome"),this.isMobileDevice= /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent),this.isIOSDevice=/iPhone|iPad|iPod/i.test(navigator.userAgent),this.isSafari=/Safari/i.test(navigator.userAgent),this.isAndroidDevice=/Android/i.test(navigator.userAgent),this.isInWeixinBrowser)}fullscreen(a){a&&(a.requestFullscreen?a.requestFullscreen():a.mozRequestFullScreen?a.mozRequestFullScreen():a.msRequestFullscreen?a.msRequestFullscreen:a.webkitRequestFullscreen&&a.webkitRequestFullscreen())}exitFullscreen(){document.exitFullscreen? document.exitFullscreen():document.msExitFullscreen||(document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen())}isFullscreen(){return document.fullscreen||document.mozFullScreen||document.webkitIsFullScreen}isFunction(a){return"function"==typeof a}}var R=new Vb;const sa={abnormal:1006,invalid_message:1008,no_free_instance:1013,out_of_control:4E3,instance_disconnected:4001,instance_not_found:4002,instance_start_failed:4003,webrtc_connection_error:4004, one_client_allowed:4005,timeout:4006,iid_required:4007,locked:4008,invalid_project:4009,kicked:4100,syncing_data:4101,instance_killed_by_user:4102,invalid_password:4103,nodeservice_stopped:4105,instance_is_busy:4107,ip_not_authorized:4108,invalid_token:4109};aa.EMPTY_OBJECT=Object.freeze({});class ka{}ka.doParamsCompatibility=a=>{a.apiOptions=a.apiOptions||{};a.events=a.events||{};a.ui=a.ui||{};"undefined"!=typeof a.showMarker&&(a.showStatus=a.showMarker,delete a.showMarker);"undefined"!=typeof a.actionEventHander&& (a.onaction=a.actionEventHander,delete a.actionEventHander);"undefined"!=typeof a.useBuiltinCursor&&(a.useBuiltinCursors=a.useBuiltinCursor,delete a.useBuiltinCursor);"undefined"!=typeof a.keyEventReceiver&&(a.keyEventTarget=a.keyEventReceiver,delete a.keyEventReceiver);"undefined"!=typeof a.ui.debugTouchPanel&&(a.ui.debugEventsPanel=a.ui.debugTouchPanel,delete a.ui.debugTouchPanel);var b=(c,e)=>{let d=a[c];d&&(a.events[e]=d,delete a[c])};b("onclose","onConnClose");b("onloaded","onVideoLoaded");b("onvideostatus", "onRtcStatsReport");b("onaction","mouseKeyListener");b=(c,e)=>{let d=a.events.mouseKeyListener[c];d&&(a.events.mouseKeyListener[e]=d,delete a.events.mouseKeyListener[c])};a.events.mouseKeyListener&&(b("onmouseenter","onMouseEnter"),b("onmouseleave","onMouseLeave"),b("onmousemove","onMouseMove"),b("onmousedown","onMouseDown"),b("onmouseup","onMouseUp"),b("onkeydown","onKeyDown"),b("onkeyup","onKeyUp"),b("onkeypress","onKeyPress"));b=(c,e)=>{"undefined"!=typeof a[c]&&(a.ui[e]=a[c],delete a[c])};b("showStartupInfo", "startupInfo");b("showStatus","statusButton");b("showFullscreenButton","fullscreenButton");b("showHomeButton","homeButton");b("showTaskList","taskListBar")};ka.setDefaultParamValues=a=>{a.keyEventTarget=aa(a.keyEventTarget,"video");a.useBuiltinCursors=aa(a.useBuiltinCursors,!0);a.ui.startupInfo=aa(a.ui.startupInfo,!0);a.ui.statusIndicator=aa(a.ui.statusIndicator,!0);a.ui.statusButton=aa(a.ui.statusButton,!1);a.ui.fullscreenButton=aa(a.ui.fullscreenButton,!1);a.ui.homeButton=aa(a.ui.homeButton,!1); a.ui.taskListBar=aa(a.ui.taskListBar,1);a.ui.debugEventsPanel=aa(a.ui.debugEventsPanel,!1);a.offer=1};ka.processParams=a=>{ka.doParamsCompatibility(a);ka.setDefaultParamValues(a)};class Wb{constructor(a){this.options=a;this.checkParamsMap=new Map}resetInteractTimestamp(a){this.timeOfLastInteraction=a}connect(a){window.WebSocket=window.WebSocket||window.MozWebSocket;window.WebSocket?(this.websocket=new WebSocket(a),this.websocket.onopen=()=>{if(this.options.onopen)this.options.onopen();setInterval(()=> {this.timeOfLastInteraction&&this.send({type:"ping",time:this.timeOfLastInteraction})},3E3)},this.websocket.onmessage=b=>{if(b=JSON.parse(b.data)){switch(b.type){case "checkParamsResult":this.onCheckParamsResponse(b);return;case "detectResponse":this.send(b);return}if(this.options.onmessage)this.options.onmessage(b)}},this.websocket.onerror=b=>{if(this.options.onerror)this.options.onerror(b)},this.websocket.onclose=b=>{this.websocket=void 0;if(this.options.onclose)this.options.onclose(b)}):alert("Your browser does not support WebSocket")}isOpened(){return this.websocket&& 1===this.websocket.readyState}send(a){a&&this.isOpened()&&this.websocket.send(JSON.stringify(a))}close(a){console.log(`call SignallingConnection.close: ${a||" "}`);this.isOpened()&&(this.websocket.close(a),this.websocket=null)}sendReady(){this.send({type:"ready"})}sendCandidate(a){a.candidate&&a.candidate.candidate&&this.send({type:"iceCandidate",candidate:a.candidate})}sendOffer(a,b){this.send({type:"offer",sdp:a,hasVideo:b})}updateParams(a){this.send({type:"updateParams",data:a})}checkParams(a){a.timestamp= Date.now();return new Promise(b=>{this.checkParamsMap[a.timestamp]=b;this.send({type:"checkParams",data:a});this.timerOfCheckParams=setTimeout(()=>{let c=this.checkParamsMap[a.timestamp];c&&(delete this.checkParamsMap[a.timestamp],c(null))},1E3)})}onCheckParamsResponse(a){let b=this.checkParamsMap[a.timestamp];b&&(clearTimeout(this.timerOfCheckParams),delete this.checkParamsMap[a.timestamp],b(a))}}(function(a){"object"===typeof v&&"undefined"!==typeof module?module.exports=a():"function"===typeof define&& define.amd?define([],a):("undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:this).adapter=a()})(function(){return function(){function a(b,c,e){function d(q,k){if(!c[q]){if(!b[q]){var f="function"==typeof require&&require;if(!k&&f)return f(q,!0);if(h)return h(q,!0);k=Error("Cannot find module '"+q+"'");throw k.code="MODULE_NOT_FOUND",k;}k=c[q]={exports:{}};b[q][0].call(k.exports,function(l){return d(b[q][1][l]||l)},k,k.exports,a,b,c,e)}return c[q].exports} for(var h="function"==typeof require&&require,g=0;gl.version&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(r){var y=f.RTCPeerConnection.prototype[r],u=e({},r,function(){arguments[0]=new ("addIceCandidate"=== r?f.RTCIceCandidate:f.RTCSessionDescription)(arguments[0]);return y.apply(this,arguments)});f.RTCPeerConnection.prototype[r]=u[r]});var w=f.RTCPeerConnection.prototype.addIceCandidate;f.RTCPeerConnection.prototype.addIceCandidate=function(){return t||arguments[0]?78>l.version&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():w.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())}}};c.fixNegotiationNeeded=function(f){var l=k.detectBrowser(f);k.wrapPeerConnectionEvent(f, "negotiationneeded",function(t){var w=t.target;if(!(72>l.version||w.getConfiguration&&"plan-b"===w.getConfiguration().sdpSemantics)||"stable"===w.signalingState)return t})};var k=function(f){if(f&&f.__esModule)return f;var l={};if(null!=f)for(var t in f)Object.prototype.hasOwnProperty.call(f,t)&&(l[t]=f[t]);l.default=f;return l}(a("../utils.js"))},{"../utils.js":15,"./getdisplaymedia":4,"./getusermedia":5}],4:[function(a,b,c){Object.defineProperty(c,"__esModule",{value:!0});c.shimGetDisplayMedia= function(e,d){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||!e.navigator.mediaDevices||("function"!==typeof d?console.error("shimGetDisplayMedia: getSourceId argument is not a function"):e.navigator.mediaDevices.getDisplayMedia=function(h){return d(h).then(function(g){var q=h.video&&h.video.width,k=h.video&&h.video.height;h.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:g,maxFrameRate:h.video&&h.video.frameRate||3}};q&&(h.video.mandatory.maxWidth=q);k&& (h.video.mandatory.maxHeight=k);return e.navigator.mediaDevices.getUserMedia(h)})})}},{}],5:[function(a,b,c){Object.defineProperty(c,"__esModule",{value:!0});var e="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(g){return typeof g}:function(g){return g&&"function"===typeof Symbol&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g};c.shimGetUserMedia=function(g){var q=g&&g.navigator;if(q.mediaDevices){var k=d.detectBrowser(g),f=function(r){if("object"!==("undefined"=== typeof r?"undefined":e(r))||r.mandatory||r.optional)return r;var y={};Object.keys(r).forEach(function(u){if("require"!==u&&"advanced"!==u&&"mediaSource"!==u){var A="object"===e(r[u])?r[u]:{ideal:r[u]};void 0!==A.exact&&"number"===typeof A.exact&&(A.min=A.max=A.exact);var m=function(x,z){return x?x+z.charAt(0).toUpperCase()+z.slice(1):"deviceId"===z?"sourceId":z};if(void 0!==A.ideal){y.optional=y.optional||[];var n={};"number"===typeof A.ideal?(n[m("min",u)]=A.ideal,y.optional.push(n),n={},n[m("max", u)]=A.ideal):n[m("",u)]=A.ideal;y.optional.push(n)}void 0!==A.exact&&"number"!==typeof A.exact?(y.mandatory=y.mandatory||{},y.mandatory[m("",u)]=A.exact):["min","max"].forEach(function(x){void 0!==A[x]&&(y.mandatory=y.mandatory||{},y.mandatory[m(x,u)]=A[x])})}});r.advanced&&(y.optional=(y.optional||[]).concat(r.advanced));return y},l=function(r,y){if(61<=k.version)return y(r);if((r=JSON.parse(JSON.stringify(r)))&&"object"===e(r.audio)){var u=function(n,x,z){x in n&&!(z in n)&&(n[z]=n[x],delete n[x])}; r=JSON.parse(JSON.stringify(r));u(r.audio,"autoGainControl","googAutoGainControl");u(r.audio,"noiseSuppression","googNoiseSuppression");r.audio=f(r.audio)}if(r&&"object"===e(r.video)){var A=r.video.facingMode;A=A&&("object"===("undefined"===typeof A?"undefined":e(A))?A:{ideal:A});u=66>k.version;if(!(!A||"user"!==A.exact&&"environment"!==A.exact&&"user"!==A.ideal&&"environment"!==A.ideal||q.mediaDevices.getSupportedConstraints&&q.mediaDevices.getSupportedConstraints().facingMode&&!u)){delete r.video.facingMode; var m=void 0;if("environment"===A.exact||"environment"===A.ideal)m=["back","rear"];else if("user"===A.exact||"user"===A.ideal)m=["front"];if(m)return q.mediaDevices.enumerateDevices().then(function(n){n=n.filter(function(z){return"videoinput"===z.kind});var x=n.find(function(z){return m.some(function(B){return z.label.toLowerCase().includes(B)})});!x&&n.length&&m.includes("back")&&(x=n[n.length-1]);x&&(r.video.deviceId=A.exact?{exact:x.deviceId}:{ideal:x.deviceId});r.video=f(r.video);h("chrome: "+ JSON.stringify(r));return y(r)})}r.video=f(r.video)}h("chrome: "+JSON.stringify(r));return y(r)},t=function(r){return 64<=k.version?r:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError", ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[r.name]||r.name,message:r.message,constraint:r.constraint||r.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}};q.getUserMedia=function(r,y,u){l(r,function(A){q.webkitGetUserMedia(A,y,function(m){u&&u(t(m))})})}.bind(q);if(q.mediaDevices.getUserMedia){var w=q.mediaDevices.getUserMedia.bind(q.mediaDevices);q.mediaDevices.getUserMedia=function(r){return l(r,function(y){return w(y).then(function(u){if(y.audio&& !u.getAudioTracks().length||y.video&&!u.getVideoTracks().length)throw u.getTracks().forEach(function(A){A.stop()}),new DOMException("","NotFoundError");return u},function(u){return Promise.reject(t(u))})})}}}};var d=function(g){if(g&&g.__esModule)return g;var q={};if(null!=g)for(var k in g)Object.prototype.hasOwnProperty.call(g,k)&&(q[k]=g[k]);q.default=g;return q}(a("../utils.js")),h=d.log},{"../utils.js":15}],6:[function(a,b,c){Object.defineProperty(c,"__esModule",{value:!0});var e="function"=== typeof Symbol&&"symbol"===typeof Symbol.iterator?function(g){return typeof g}:function(g){return g&&"function"===typeof Symbol&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g};c.shimRTCIceCandidate=function(g){if(g.RTCIceCandidate&&!(g.RTCIceCandidate&&"foundation"in g.RTCIceCandidate.prototype)){var q=g.RTCIceCandidate;g.RTCIceCandidate=function(k){"object"===("undefined"===typeof k?"undefined":e(k))&&k.candidate&&0===k.candidate.indexOf("a=")&&(k=JSON.parse(JSON.stringify(k)),k.candidate= k.candidate.substr(2));if(k.candidate&&k.candidate.length){var f=new q(k);k=d.default.parseCandidate(k.candidate);var l=Object.assign(f,k);l.toJSON=function(){return{candidate:l.candidate,sdpMid:l.sdpMid,sdpMLineIndex:l.sdpMLineIndex,usernameFragment:l.usernameFragment}};return l}return new q(k)};g.RTCIceCandidate.prototype=q.prototype;h.wrapPeerConnectionEvent(g,"icecandidate",function(k){k.candidate&&Object.defineProperty(k,"candidate",{value:new g.RTCIceCandidate(k.candidate),writable:"false"}); return k})}};c.shimMaxMessageSize=function(g){if(g.RTCPeerConnection){var q=h.detectBrowser(g);"sctp"in g.RTCPeerConnection.prototype||Object.defineProperty(g.RTCPeerConnection.prototype,"sctp",{get:function(){return"undefined"===typeof this._sctp?null:this._sctp}});var k=function(r){if(!r||!r.sdp)return!1;r=d.default.splitSections(r.sdp);r.shift();return r.some(function(y){return(y=d.default.parseMLine(y))&&"application"===y.kind&&-1!==y.protocol.indexOf("SCTP")})},f=function(r){r=r.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/); if(null===r||2>r.length)return-1;r=parseInt(r[1],10);return r!==r?-1:r},l=function(r){var y=65536;"firefox"===q.browser&&(y=57>q.version?-1===r?16384:2147483637:60>q.version?57===q.version?65535:65536:2147483637);return y},t=function(r,y){var u=65536;"firefox"===q.browser&&57===q.version&&(u=65535);r=d.default.matchPrefix(r.sdp,"a=max-message-size:");0l.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+l.sctp.maxMessageSize+" bytes)");return t.apply(f,arguments)}}if(g.RTCPeerConnection&&"createDataChannel"in g.RTCPeerConnection.prototype){var k=g.RTCPeerConnection.prototype.createDataChannel; g.RTCPeerConnection.prototype.createDataChannel=function(){var f=k.apply(this,arguments);q(f,this);return f};h.wrapPeerConnectionEvent(g,"datachannel",function(f){q(f.channel,f.target);return f})}};c.shimConnectionState=function(g){if(g.RTCPeerConnection&&!("connectionState"in g.RTCPeerConnection.prototype)){var q=g.RTCPeerConnection.prototype;Object.defineProperty(q,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState}, enumerable:!0,configurable:!0});Object.defineProperty(q,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(k){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange);k&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=k)},enumerable:!0,configurable:!0});["setLocalDescription","setRemoteDescription"].forEach(function(k){var f=q[k]; q[k]=function(){this._connectionstatechangepoly||(this._connectionstatechangepoly=function(l){var t=l.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;var w=new Event("connectionstatechange",l);t.dispatchEvent(w)}return l},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly));return f.apply(this,arguments)}})}};c.removeAllowExtmapMixed=function(g){if(g.RTCPeerConnection){var q=h.detectBrowser(g);if(!("chrome"===q.browser&& 71<=q.version||"safari"===q.browser&&605<=q.version)){var k=g.RTCPeerConnection.prototype.setRemoteDescription;g.RTCPeerConnection.prototype.setRemoteDescription=function(f){f&&f.sdp&&-1!==f.sdp.indexOf("\na=extmap-allow-mixed")&&(f.sdp=f.sdp.split("\n").filter(function(l){return"a=extmap-allow-mixed"!==l.trim()}).join("\n"));return k.apply(this,arguments)}}}};var d=(b=a("sdp"))&&b.__esModule?b:{default:b},h=function(g){if(g&&g.__esModule)return g;var q={};if(null!=g)for(var k in g)Object.prototype.hasOwnProperty.call(g, k)&&(q[k]=g[k]);q.default=g;return q}(a("./utils"))},{"./utils":15,sdp:17}],7:[function(a,b,c){Object.defineProperty(c,"__esModule",{value:!0});c.shimGetDisplayMedia=c.shimGetUserMedia=void 0;var e=a("./getusermedia");Object.defineProperty(c,"shimGetUserMedia",{enumerable:!0,get:function(){return e.shimGetUserMedia}});var d=a("./getdisplaymedia");Object.defineProperty(c,"shimGetDisplayMedia",{enumerable:!0,get:function(){return d.shimGetDisplayMedia}});c.shimPeerConnection=function(k){var f=h.detectBrowser(k); if(k.RTCIceGatherer&&(k.RTCIceCandidate||(k.RTCIceCandidate=function(w){return w}),k.RTCSessionDescription||(k.RTCSessionDescription=function(w){return w}),15025>f.version)){var l=Object.getOwnPropertyDescriptor(k.MediaStreamTrack.prototype,"enabled");Object.defineProperty(k.MediaStreamTrack.prototype,"enabled",{set:function(w){l.set.call(this,w);var r=new Event("enabled");r.enabled=w;this.dispatchEvent(r)}})}!k.RTCRtpSender||"dtmf"in k.RTCRtpSender.prototype||Object.defineProperty(k.RTCRtpSender.prototype, "dtmf",{get:function(){void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=new k.RTCDtmfSender(this):"video"===this.track.kind&&(this._dtmf=null));return this._dtmf}});k.RTCDtmfSender&&!k.RTCDTMFSender&&(k.RTCDTMFSender=k.RTCDtmfSender);var t=(0,q.default)(k,f.version);k.RTCPeerConnection=function(w){w&&w.iceServers&&(w.iceServers=(0,g.filterIceServers)(w.iceServers,f.version),h.log("ICE servers after filtering:",w.iceServers));return new t(w)};k.RTCPeerConnection.prototype=t.prototype};c.shimReplaceTrack= function(k){!k.RTCRtpSender||"replaceTrack"in k.RTCRtpSender.prototype||(k.RTCRtpSender.prototype.replaceTrack=k.RTCRtpSender.prototype.setTrack)};var h=function(k){if(k&&k.__esModule)return k;var f={};if(null!=k)for(var l in k)Object.prototype.hasOwnProperty.call(k,l)&&(f[l]=k[l]);f.default=k;return f}(a("../utils")),g=a("./filtericeservers"),q=(a=a("rtcpeerconnection-shim"))&&a.__esModule?a:{default:a}},{"../utils":15,"./filtericeservers":8,"./getdisplaymedia":9,"./getusermedia":10,"rtcpeerconnection-shim":16}], 8:[function(a,b,c){Object.defineProperty(c,"__esModule",{value:!0});c.filterIceServers=function(d,h){var g=!1;d=JSON.parse(JSON.stringify(d));return d.filter(function(q){if(q&&(q.urls||q.url)){var k=q.urls||q.url;q.url&&!q.urls&&e.deprecated("RTCIceServer.url","RTCIceServer.urls");var f="string"===typeof k;f&&(k=[k]);k=k.filter(function(l){return 0===l.indexOf("stun:")?!1:(l=l.startsWith("turn")&&!l.startsWith("turn:[")&&l.includes("transport=udp"))&&!g?g=!0:l&&!g});delete q.url;q.urls=f?k[0]:k;return!!k.length}})}; var e=function(d){if(d&&d.__esModule)return d;var h={};if(null!=d)for(var g in d)Object.prototype.hasOwnProperty.call(d,g)&&(h[g]=d[g]);h.default=d;return h}(a("../utils"))},{"../utils":15}],9:[function(a,b,c){Object.defineProperty(c,"__esModule",{value:!0});c.shimGetDisplayMedia=function(e){"getDisplayMedia"in e.navigator&&e.navigator.mediaDevices&&!(e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices)&&(e.navigator.mediaDevices.getDisplayMedia=e.navigator.getDisplayMedia.bind(e.navigator))}}, {}],10:[function(a,b,c){Object.defineProperty(c,"__esModule",{value:!0});c.shimGetUserMedia=function(e){e=e&&e.navigator;var d=function(g){return{name:{PermissionDeniedError:"NotAllowedError"}[g.name]||g.name,message:g.message,constraint:g.constraint,toString:function(){return this.name}}},h=e.mediaDevices.getUserMedia.bind(e.mediaDevices);e.mediaDevices.getUserMedia=function(g){return h(g).catch(function(q){return Promise.reject(d(q))})}}},{}],11:[function(a,b,c){function e(k,f,l){f in k?Object.defineProperty(k, f,{value:l,enumerable:!0,configurable:!0,writable:!0}):k[f]=l;return k}Object.defineProperty(c,"__esModule",{value:!0});c.shimGetDisplayMedia=c.shimGetUserMedia=void 0;var d="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(k){return typeof k}:function(k){return k&&"function"===typeof Symbol&&k.constructor===Symbol&&k!==Symbol.prototype?"symbol":typeof k},h=a("./getusermedia");Object.defineProperty(c,"shimGetUserMedia",{enumerable:!0,get:function(){return h.shimGetUserMedia}}); var g=a("./getdisplaymedia");Object.defineProperty(c,"shimGetDisplayMedia",{enumerable:!0,get:function(){return g.shimGetDisplayMedia}});c.shimOnTrack=function(k){"object"===("undefined"===typeof k?"undefined":d(k))&&k.RTCTrackEvent&&"receiver"in k.RTCTrackEvent.prototype&&!("transceiver"in k.RTCTrackEvent.prototype)&&Object.defineProperty(k.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})};c.shimPeerConnection=function(k){var f=q.detectBrowser(k);if("object"=== ("undefined"===typeof k?"undefined":d(k))&&(k.RTCPeerConnection||k.mozRTCPeerConnection)){!k.RTCPeerConnection&&k.mozRTCPeerConnection&&(k.RTCPeerConnection=k.mozRTCPeerConnection);53>f.version&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(r){var y=k.RTCPeerConnection.prototype[r],u=e({},r,function(){arguments[0]=new ("addIceCandidate"===r?k.RTCIceCandidate:k.RTCSessionDescription)(arguments[0]);return y.apply(this,arguments)});k.RTCPeerConnection.prototype[r]= u[r]});if(68>f.version){var l=k.RTCPeerConnection.prototype.addIceCandidate;k.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?arguments[0]&&""===arguments[0].candidate?Promise.resolve():l.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())}}var t={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},w=k.RTCPeerConnection.prototype.getStats;k.RTCPeerConnection.prototype.getStats= function(){var r=Array.prototype.slice.call(arguments),y=r[1],u=r[2];return w.apply(this,[r[0]||null]).then(function(A){if(53>f.version&&!y)try{A.forEach(function(m){m.type=t[m.type]||m.type})}catch(m){if("TypeError"!==m.name)throw m;A.forEach(function(n,x){A.set(x,Object.assign({},n,{type:t[n.type]||n.type}))})}return A}).then(y,u)}}};c.shimSenderGetStats=function(k){if("object"===("undefined"===typeof k?"undefined":d(k))&&k.RTCPeerConnection&&k.RTCRtpSender&&!(k.RTCRtpSender&&"getStats"in k.RTCRtpSender.prototype)){var f= k.RTCPeerConnection.prototype.getSenders;f&&(k.RTCPeerConnection.prototype.getSenders=function(){var t=this,w=f.apply(this,[]);w.forEach(function(r){return r._pc=t});return w});var l=k.RTCPeerConnection.prototype.addTrack;l&&(k.RTCPeerConnection.prototype.addTrack=function(){var t=l.apply(this,arguments);t._pc=this;return t});k.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}};c.shimReceiverGetStats=function(k){if("object"===("undefined"=== typeof k?"undefined":d(k))&&k.RTCPeerConnection&&k.RTCRtpSender&&!(k.RTCRtpSender&&"getStats"in k.RTCRtpReceiver.prototype)){var f=k.RTCPeerConnection.prototype.getReceivers;f&&(k.RTCPeerConnection.prototype.getReceivers=function(){var l=this,t=f.apply(this,[]);t.forEach(function(w){return w._pc=l});return t});q.wrapPeerConnectionEvent(k,"track",function(l){l.receiver._pc=l.srcElement;return l});k.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}};c.shimRemoveStream= function(k){!k.RTCPeerConnection||"removeStream"in k.RTCPeerConnection.prototype||(k.RTCPeerConnection.prototype.removeStream=function(f){var l=this;q.deprecated("removeStream","removeTrack");this.getSenders().forEach(function(t){t.track&&f.getTracks().includes(t.track)&&l.removeTrack(t)})})};c.shimRTCDataChannel=function(k){k.DataChannel&&!k.RTCDataChannel&&(k.RTCDataChannel=k.DataChannel)};c.shimAddTransceiver=function(k){if("object"===("undefined"===typeof k?"undefined":d(k))&&k.RTCPeerConnection){var f= k.RTCPeerConnection.prototype.addTransceiver;f&&(k.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var l=arguments[1],t=l&&"sendEncodings"in l;t&&l.sendEncodings.forEach(function(y){if("rid"in y&&!/^[a-z0-9]{0,16}$/i.test(y.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in y&&!(1<=parseFloat(y.scaleResolutionDownBy)))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in y&&!(0<=parseFloat(y.maxFramerate)))throw new RangeError("max_framerate must be >= 0.0"); });var w=f.apply(this,arguments);if(t){var r=w.sender;t=r.getParameters();"encodings"in t||(t.encodings=l.sendEncodings,r.sendEncodings=l.sendEncodings,this.setParametersPromises.push(r.setParameters(t).then(function(){delete r.sendEncodings}).catch(function(){delete r.sendEncodings})))}return w})}};c.shimGetParameters=function(k){if("object"===("undefined"===typeof k?"undefined":d(k))&&k.RTCRtpSender){var f=k.RTCRtpSender.prototype.getParameters;f&&(k.RTCRtpSender.prototype.getParameters=function(){var l= f.apply(this,arguments);return"sendEncodings"in this?Object.assign({},{encodings:this.sendEncodings},l):l})}};c.shimCreateOffer=function(k){if("object"===("undefined"===typeof k?"undefined":d(k))&&k.RTCPeerConnection){var f=k.RTCPeerConnection.prototype.createOffer;k.RTCPeerConnection.prototype.createOffer=function(){var l=this,t=arguments;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(function(){return f.apply(l,t)}).finally(function(){l.setParametersPromises= []}):f.apply(this,arguments)}}};c.shimCreateAnswer=function(k){if("object"===("undefined"===typeof k?"undefined":d(k))&&k.RTCPeerConnection){var f=k.RTCPeerConnection.prototype.createAnswer;k.RTCPeerConnection.prototype.createAnswer=function(){var l=this,t=arguments;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(function(){return f.apply(l,t)}).finally(function(){l.setParametersPromises=[]}):f.apply(this,arguments)}}};var q=function(k){if(k&& k.__esModule)return k;var f={};if(null!=k)for(var l in k)Object.prototype.hasOwnProperty.call(k,l)&&(f[l]=k[l]);f.default=k;return f}(a("../utils"))},{"../utils":15,"./getdisplaymedia":12,"./getusermedia":13}],12:[function(a,b,c){Object.defineProperty(c,"__esModule",{value:!0});c.shimGetDisplayMedia=function(e,d){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||!e.navigator.mediaDevices||(e.navigator.mediaDevices.getDisplayMedia=function(h){if(!h||!h.video)return h=new DOMException("getDisplayMedia without video constraints is undefined"), h.name="NotFoundError",h.code=8,Promise.reject(h);!0===h.video?h.video={mediaSource:d}:h.video.mediaSource=d;return e.navigator.mediaDevices.getUserMedia(h)})}},{}],13:[function(a,b,c){Object.defineProperty(c,"__esModule",{value:!0});var e="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(h){return typeof h}:function(h){return h&&"function"===typeof Symbol&&h.constructor===Symbol&&h!==Symbol.prototype?"symbol":typeof h};c.shimGetUserMedia=function(h){var g=d.detectBrowser(h), q=h&&h.navigator;h=h&&h.MediaStreamTrack;q.getUserMedia=function(w,r,y){d.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia");q.mediaDevices.getUserMedia(w).then(r,y)};if(!(55=t&&parseInt(f[t],10)}function d(f){return"[object Object]"!==Object.prototype.toString.call(f)? f:Object.keys(f).reduce(function(l,t){var w="[object Object]"===Object.prototype.toString.call(f[t]),r=w?d(f[t]):f[t];w=w&&!Object.keys(r).length;if(void 0===r||w)return l;w=Object;var y=w.assign,u={};t in u?Object.defineProperty(u,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):u[t]=r;return y.call(w,l,u)},{})}function h(f,l,t){l&&!t.has(l.id)&&(t.set(l.id,l),Object.keys(l).forEach(function(w){w.endsWith("Id")?h(f,f.get(l[w]),t):w.endsWith("Ids")&&l[w].forEach(function(r){h(f,f.get(r),t)})}))} Object.defineProperty(c,"__esModule",{value:!0});var g="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(f){return typeof f}:function(f){return f&&"function"===typeof Symbol&&f.constructor===Symbol&&f!==Symbol.prototype?"symbol":typeof f};c.extractVersion=e;c.wrapPeerConnectionEvent=function(f,l,t){if(f.RTCPeerConnection){f=f.RTCPeerConnection.prototype;var w=f.addEventListener;f.addEventListener=function(y,u){if(y!==l)return w.apply(this,arguments);var A=function(m){(m=t(m))&& (u.handleEvent?u.handleEvent(m):u(m))};this._eventMap=this._eventMap||{};this._eventMap[l]||(this._eventMap[l]=new Map);this._eventMap[l].set(u,A);return w.apply(this,[y,A])};var r=f.removeEventListener;f.removeEventListener=function(y,u){if(y!==l||!this._eventMap||!this._eventMap[l]||!this._eventMap[l].has(u))return r.apply(this,arguments);var A=this._eventMap[l].get(u);this._eventMap[l].delete(u);0===this._eventMap[l].size&&delete this._eventMap[l];0===Object.keys(this._eventMap).length&&delete this._eventMap; return r.apply(this,[y,A])};Object.defineProperty(f,"on"+l,{get:function(){return this["_on"+l]},set:function(y){this["_on"+l]&&(this.removeEventListener(l,this["_on"+l]),delete this["_on"+l]);y&&this.addEventListener(l,this["_on"+l]=y)},enumerable:!0,configurable:!0})}};c.disableLog=function(f){return"boolean"!==typeof f?Error("Argument type: "+("undefined"===typeof f?"undefined":g(f))+". Please use a boolean."):(q=f)?"adapter.js logging disabled":"adapter.js logging enabled"};c.disableWarnings= function(f){if("boolean"!==typeof f)return Error("Argument type: "+("undefined"===typeof f?"undefined":g(f))+". Please use a boolean.");k=!f;return"adapter.js deprecation warnings "+(f?"disabled":"enabled")};c.log=function(){"object"!==("undefined"===typeof window?"undefined":g(window))||q||"undefined"!==typeof console&&"function"===typeof console.log&&console.log.apply(console,arguments)};c.deprecated=function(f,l){k&&console.warn(f+" is deprecated, please use "+l+" instead.")};c.detectBrowser=function(f){var l= f.navigator,t={browser:null,version:null};if("undefined"===typeof f||!f.navigator)return t.browser="Not a browser.",t;l.mozGetUserMedia?(t.browser="firefox",t.version=e(l.userAgent,/Firefox\/(\d+)\./,1)):l.webkitGetUserMedia||!1===f.isSecureContext&&f.webkitRTCPeerConnection&&!f.RTCIceGatherer?(t.browser="chrome",t.version=e(l.userAgent,/Chrom(e|ium)\/(\d+)\./,2)):l.mediaDevices&&l.userAgent.match(/Edge\/(\d+).(\d+)$/)?(t.browser="edge",t.version=e(l.userAgent,/Edge\/(\d+).(\d+)$/,2)):f.RTCPeerConnection&& l.userAgent.match(/AppleWebKit\/(\d+)\./)?(t.browser="safari",t.version=e(l.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=f.RTCRtpTransceiver&&"currentDirection"in f.RTCRtpTransceiver.prototype):t.browser="Not a supported browser.";return t};c.compactObject=d;c.walkStats=h;c.filterStats=function(f,l,t){var w=t?"outbound-rtp":"inbound-rtp",r=new Map;if(null===l)return r;var y=[];f.forEach(function(u){"track"===u.type&&u.trackIdentifier===l.id&&y.push(u)});y.forEach(function(u){f.forEach(function(A){A.type=== w&&A.trackId===u.id&&h(f,A,r)})});return r};var q=!0,k=!0},{}],16:[function(a,b,c){function e(l,t,w,r,y){t=f.writeRtpDescription(l.kind,t);t+=f.writeIceParameters(l.iceGatherer.getLocalParameters());t+=f.writeDtlsParameters(l.dtlsTransport.getLocalParameters(),"offer"===w?"actpass":y||"active");t+="a=mid:"+l.mid+"\r\n";t=l.rtpSender&&l.rtpReceiver?t+"a=sendrecv\r\n":l.rtpSender?t+"a=sendonly\r\n":l.rtpReceiver?t+"a=recvonly\r\n":t+"a=inactive\r\n";l.rtpSender&&(w=l.rtpSender._initialTrackId||l.rtpSender.track.id, l.rtpSender._initialTrackId=w,r="msid:"+(r?r.id:"-")+" "+w+"\r\n",t=t+("a="+r)+("a=ssrc:"+l.sendEncodingParameters[0].ssrc+" "+r),l.sendEncodingParameters[0].rtx&&(t+="a=ssrc:"+l.sendEncodingParameters[0].rtx.ssrc+" "+r,t+="a=ssrc-group:FID "+l.sendEncodingParameters[0].ssrc+" "+l.sendEncodingParameters[0].rtx.ssrc+"\r\n"));t+="a=ssrc:"+l.sendEncodingParameters[0].ssrc+" cname:"+f.localCName+"\r\n";l.rtpSender&&l.sendEncodingParameters[0].rtx&&(t+="a=ssrc:"+l.sendEncodingParameters[0].rtx.ssrc+" cname:"+ f.localCName+"\r\n");return t}function d(l,t){var w=!1;l=JSON.parse(JSON.stringify(l));return l.filter(function(r){if(r&&(r.urls||r.url)){var y=r.urls||r.url;r.url&&!r.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var u="string"===typeof y;u&&(y=[y]);y=y.filter(function(A){return 0!==A.indexOf("turn:")||-1===A.indexOf("transport=udp")||-1!==A.indexOf("turn:[")||w?0===A.indexOf("stun:")&&14393<=t&&-1===A.indexOf("?transport=udp"):w=!0});delete r.url;r.urls=u?y[0]:y;return!!y.length}})} function h(l,t){var w={codecs:[],headerExtensions:[],fecMechanisms:[]},r=function(u,A){u=parseInt(u,10);for(var m=0;mt&&m.recvEncodingParameters.forEach(function(B){delete B.rtx}), z.encodings=m.recvEncodingParameters.length?m.recvEncodingParameters:[{}],z.rtcp={compound:m.rtcpParameters.compound},m.rtcpParameters.cname&&(z.rtcp.cname=m.rtcpParameters.cname),m.sendEncodingParameters.length&&(z.rtcp.ssrc=m.sendEncodingParameters[0].ssrc),m.rtpReceiver.receive(z))};u.prototype.setLocalDescription=function(m){var n=this;if(-1===["offer","answer"].indexOf(m.type))return Promise.reject(k("TypeError",'Unsupported type "'+m.type+'"'));if(!g("setLocalDescription",m.type,n.signalingState)|| n._isClosed)return Promise.reject(k("InvalidStateError","Can not set local "+m.type+" in state "+n.signalingState));if("offer"===m.type){var x=f.splitSections(m.sdp);var z=x.shift();x.forEach(function(C,G){C=f.parseRtpParameters(C);n.transceivers[G].localCapabilities=C});n.transceivers.forEach(function(C,G){n._gather(C.mid,G)})}else if("answer"===m.type){x=f.splitSections(n._remoteDescription.sdp);z=x.shift();var B=0t&&(L.codecs=L.codecs.filter(function(X){return"rtx"!==X.name}));Z=N.sendEncodingParameters||[{ssrc:1001*(2*J+2)}];oa=!1;if("sendrecv"===P||"sendonly"===P){oa=!N.rtpReceiver;var ha=N.rtpReceiver|| new l.RTCRtpReceiver(N.dtlsTransport,U);if(oa){P=ha.track;if(!W||"-"!==W.stream)if(W){x[W.stream]||(x[W.stream]=new l.MediaStream,Object.defineProperty(x[W.stream],"id",{get:function(){return W.stream}}));Object.defineProperty(P,"id",{get:function(){return W.track}});var ja=x[W.stream]}else x.default||(x.default=new l.MediaStream),ja=x.default;ja&&(w(P,ja),N.associatedRemoteMediaStreams.push(ja));z.push([P,ha,ja])}}else N.rtpReceiver&&N.rtpReceiver.track&&(N.associatedRemoteMediaStreams.forEach(function(X){var Fa= X.getTracks().find(function(Xb){return Xb.id===N.rtpReceiver.track.id});Fa&&r(Fa,X)}),N.associatedRemoteMediaStreams=[]);N.localCapabilities=L;N.remoteCapabilities=Ba;N.rtpReceiver=ha;N.rtcpParameters=Da;N.sendEncodingParameters=Z;N.recvEncodingParameters=la;n._transceive(n.transceivers[J],!1,oa)}}});void 0===n._dtlsRole&&(n._dtlsRole="offer"===m.type?"active":"passive");n._remoteDescription={type:m.type,sdp:m.sdp};"offer"===m.type?n._updateSignalingState("have-remote-offer"):n._updateSignalingState("stable"); Object.keys(x).forEach(function(L){var J=x[L];if(J.getTracks().length){if(-1===n.remoteStreams.indexOf(J)){n.remoteStreams.push(J);var P=new Event("addstream");P.stream=J;l.setTimeout(function(){n._dispatchEvent("addstream",P)})}z.forEach(function(U){J.id===U[2].id&&y(n,U[0],U[1],[J])})}});z.forEach(function(L){L[2]||y(n,L[0],L[1],[])});l.setTimeout(function(){n&&n.transceivers&&n.transceivers.forEach(function(L){L.iceTransport&&"new"===L.iceTransport.state&&0x&&(C.wantReceive=!1)):"video"===C.kind&&(z--,0>z&&(C.wantReceive=!1))});0t&&(L.codecs=L.codecs.filter(function(J){return"rtx"!==J.name}));L.codecs.forEach(function(J){"H264"===J.name&&void 0===J.parameters["level-asymmetry-allowed"]&&(J.parameters["level-asymmetry-allowed"]="1");C.remoteCapabilities&&C.remoteCapabilities.codecs&&C.remoteCapabilities.codecs.forEach(function(P){J.name.toLowerCase()===P.name.toLowerCase()&&J.clockRate===P.clockRate&&(J.preferredPayloadType=P.payloadType)})}); L.headerExtensions.forEach(function(J){(C.remoteCapabilities&&C.remoteCapabilities.headerExtensions||[]).forEach(function(P){J.uri===P.uri&&(J.id=P.id)})});G=C.sendEncodingParameters||[{ssrc:1001*(2*G+1)}];M&&15019<=t&&"video"===Y&&!G[0].rtx&&(G[0].rtx={ssrc:G[0].ssrc+1});C.wantReceive&&(C.rtpReceiver=new l.RTCRtpReceiver(C.dtlsTransport,Y));C.localCapabilities=L;C.sendEncodingParameters=G});"max-compat"!==n._config.bundlePolicy&&(B+="a=group:BUNDLE "+n.transceivers.map(function(C){return C.mid}).join(" ")+ "\r\n");B+="a=ice-options:trickle\r\n";n.transceivers.forEach(function(C,G){B+=e(C,C.localCapabilities,"offer",C.stream,n._dtlsRole);B+="a=rtcp-rsize\r\n";!C.iceGatherer||"new"===n.iceGatheringState||0!==G&&n.usingBundle||(C.iceGatherer.getLocalCandidates().forEach(function(M){M.component=1;B+="a="+f.writeCandidate(M)+"\r\n"}),"completed"===C.iceGatherer.state&&(B+="a=end-of-candidates\r\n"))});m=new l.RTCSessionDescription({type:"offer",sdp:B});return Promise.resolve(m)};u.prototype.createAnswer= function(){var m=this;if(m._isClosed)return Promise.reject(k("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==m.signalingState&&"have-local-pranswer"!==m.signalingState)return Promise.reject(k("InvalidStateError","Can not call createAnswer in signalingState "+m.signalingState));var n=f.writeSessionBoilerplate(m._sdpSessionId,m._sdpSessionVersion++);m.usingBundle&&(n+="a=group:BUNDLE "+m.transceivers.map(function(B){return B.mid}).join(" ")+"\r\n");n+="a=ice-options:trickle\r\n"; var x=f.getMediaSections(m._remoteDescription.sdp).length;m.transceivers.forEach(function(B,C){if(!(C+1>x))if(B.rejected)"application"===B.kind?n="DTLS/SCTP"===B.protocol?n+"m=application 0 DTLS/SCTP 5000\r\n":n+("m=application 0 "+B.protocol+" webrtc-datachannel\r\n"):"audio"===B.kind?n+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n":"video"===B.kind&&(n+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"),n+="c=IN IP4 0.0.0.0\r\na=inactive\r\na=mid:"+B.mid+"\r\n";else{if(B.stream){var G; "audio"===B.kind?G=B.stream.getAudioTracks()[0]:"video"===B.kind&&(G=B.stream.getVideoTracks()[0]);G&&15019<=t&&"video"===B.kind&&!B.sendEncodingParameters[0].rtx&&(B.sendEncodingParameters[0].rtx={ssrc:B.sendEncodingParameters[0].ssrc+1})}C=h(B.localCapabilities,B.remoteCapabilities);!C.codecs.filter(function(M){return"rtx"===M.name.toLowerCase()}).length&&B.sendEncodingParameters[0].rtx&&delete B.sendEncodingParameters[0].rtx;n+=e(B,C,"answer",B.stream,m._dtlsRole);B.rtcpParameters&&B.rtcpParameters.reducedSize&& (n+="a=rtcp-rsize\r\n")}});var z=new l.RTCSessionDescription({type:"answer",sdp:n});return Promise.resolve(z)};u.prototype.addIceCandidate=function(m){var n=this,x;return m&&void 0===m.sdpMLineIndex&&!m.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise(function(z,B){if(n._remoteDescription)if(m&&""!==m.candidate){var C=m.sdpMLineIndex;if(m.sdpMid)for(var G=0;Gq&&(q=k.maxptime)});0d[h].length||"="!==d[h].charAt(1))return!1;return!0};"object"===typeof b&&(b.exports=e)},{}]},{},[1])(1)});class Yb{constructor(a){this.FrameDisplayDeltaTimeMs=this.BrowserReceiptTimeMs=this.UETransmissionTimeMs= this.UECaptureToSendMs=this.UEEncodeMs=this.UEReceiptTimeMs=this.TestStartTimeMs=null;this.onReady=a}reset(){this.FrameDisplayDeltaTimeMs=this.BrowserReceiptTimeMs=this.UETransmissionTimeMs=this.UEEncodeMs=this.UECaptureToSendMs=this.UEReceiptTimeMs=this.TestStartTimeMs=null}start(){this.reset();this.TestStartTimeMs=Date.now();if(this.onReady)this.onReady()}setUETimings(a){this.UEReceiptTimeMs=a.ReceiptTimeMs;this.UEEncodeMs=a.EncodeMs;this.UECaptureToSendMs=a.CaptureToSendMs;this.UETransmissionTimeMs= a.TransmissionTimeMs;this.BrowserReceiptTimeMs=Date.now();this.latencyTimingsReady()}setFrameDisplayDeltaTime(a){null==this.FrameDisplayDeltaTimeMs&&(this.FrameDisplayDeltaTimeMs=Math.round(a),this.latencyTimingsReady())}latencyTimingsReady(){if(this.BrowserReceiptTimeMs){var a=this.BrowserReceiptTimeMs-this.TestStartTimeMs,b=this.UECaptureToSendMs,c=this.UETransmissionTimeMs-this.UEReceiptTimeMs,e=a-c,d={latencyExcludingDecode:a,encodeLatency:this.UEEncodeMs.toFixed(1),uePixelStreamLatency:b.toFixed(1), ueTestDuration:c.toFixed(1),networkLatency:e.toFixed(1)};this.FrameDisplayDeltaTimeMs&&this.BrowserReceiptTimeMs&&(d.endToEndLatency=this.FrameDisplayDeltaTimeMs+e+("string"===typeof b?0:b),d.browserSideLatency=this.FrameDisplayDeltaTimeMs+(a-e-c),d.endToEndLatency=d.endToEndLatency.toFixed(1),d.browserSideLatency=d.browserSideLatency.toFixed(1));if(this.onReady)this.onReady(d)}}}class Zb{constructor(a){this.useStats=a.useStats;this.events=a.events;this.webRtcConfig=a.peerConnectionOptions||{};this.webRtcConfig.sdpSemantics= "unified-plan";this.tnClient=this.dcClient=this.pcClient=null;this.sdpConstraints={offerToReceiveAudio:0,offerToReceiveVideo:1,voiceActivityDetection:!1};this.dataChannelOptions={ordered:!0};this.lastStats={};this.playerId=0;this.latencyTestTimings=new Yb(this.events.onLatencyTimingsReady);this._bSendingAPI=!1;this._apiSendingQueue=[]}setVideo(a){this.video=a}logStartupInfo(a){if(this.events.onlog)this.events.onlog(a)}setupPeerConnection(){this.pcClient||(this.pcClient=new RTCPeerConnection(this.webRtcConfig), this.pcClient.addTransceiver("video",{direction:"recvonly"}),this.pcClient.onsignalingstatechange=a=>this.onStateChanged(a),this.pcClient.oniceconnectionstatechange=a=>this.onStateChanged(a),this.pcClient.onicegatheringstatechange=a=>this.onStateChanged(a),this.pcClient.ontrack=a=>this.events.ontrack(a),this.pcClient.onicecandidate=a=>this.events.onicecandidate(a),this.pcClient.ondatachannel=a=>{this.dcClient=a.channel;this.setupDataChannelCallbacks()})}close(){this.dcClient&&"open"==this.dcClient.readyState&& (this.dcClient.close(),this.dcClient=null);this.pcClient&&(this.pcClient.close(),this.pcClient=null);this.clearStatsTimer()}setupDataChannelCallbacks(){this.dcClient.binaryType="arraybuffer";this.dcClient.onopen=a=>{this.isDatachannelOpened=!0;if(this.events&&this.events.ondatachannelopen)this.events.ondatachannelopen(a);this.logStartupInfo("video: loading...")};this.dcClient.onclose=a=>{this.isDatachannelOpened=!1;this.clearStatsTimer();if(this.events&&this.events.ondatachannelclose)this.events.ondatachannelclose(a)}; this.dcClient.onerror=a=>{this.isDatachannelOpened=!1;this.logStartupInfo("channel error");if(this.events&&this.events.ondatachannelerror)this.events.ondatachannelerror(a)};this.dcClient.onmessage=a=>this.onDatachannelMessage(a)}createOffer(){this.close();this.setupPeerConnection();try{this.dcClient=this.pcClient.createDataChannel("cirrus",this.dataChannelOptions),this.setupDataChannelCallbacks(),this.logStartupInfo("channel created")}catch(a){this.logStartupInfo("no channel"),this.dcClient=null}this.pcClient.createOffer(this.sdpConstraints).then(a=> {a.sdp=a.sdp.replace("useinbandfec=1","useinbandfec=1;stereo=1;sprop-maxcapturerate=48000");this.pcClient.setLocalDescription(a);this.events.onOfferCreated(a)},()=>{this.logStartupInfo("couldn't create offer")})}onReceiveOffer(a){a=new RTCSessionDescription(a);this.setupPeerConnection();this.pcClient.setRemoteDescription(a).then(()=>{this.pcClient.createAnswer().then(b=>this.pcClient.setLocalDescription(b)).then(()=>{if(this.events.onAnswerCreated)this.events.onAnswerCreated(this.pcClient.currentLocalDescription)}).then(()=> {let b=this.pcClient.getReceivers();for(let c of b)c.playoutDelayHint=0}).catch(b=>console.error("createAnswer() failed:",b))});this.setupLiveStats()}onIceCandidate(a){a=new RTCIceCandidate(a);this.pcClient.addIceCandidate(a).then(b=>{this.logStartupInfo("candidate added")})}onReceiveAnswer(a){this.playerId=a.playerId;this.logStartupInfo(`received answer: ${this.playerId}`);a=new RTCSessionDescription(a);this.pcClient.setRemoteDescription(a);a=this.pcClient.getReceivers();for(let b of a)b.playoutDelayHint= 0;this.setupLiveStats()}setupLiveStats(){this.clearStatsTimer();this.useStats&&!this.aggregateStatsIntervalId&&(this.aggregateStatsIntervalId=setInterval(()=>{this.pcClient&&this.pcClient.getStats(null).then(a=>this.processLiveStats(a))},1E3))}onStateChanged(a){this.signalingState!=this.pcClient.signalingState&&(this.signalingState=this.pcClient.signalingState,this.logStartupInfo(`__signaling: ${this.signalingState}`));this.iceConnectionState!=this.pcClient.iceConnectionState&&(this.iceConnectionState= this.pcClient.iceConnectionState,this.logStartupInfo(`__ice_connection: ${this.iceConnectionState}`),"disconnected"!=this.iceConnectionState||this.isDatachannelOpened||this.logStartupInfo("\u8fde\u63a5\u5efa\u7acb\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u670d\u52a1\u5668\u7aef\u53e3\u8bbe\u7f6e"),"failed"!=this.iceConnectionState||this.isDatachannelOpened||this.logStartupInfo("\u8fde\u63a5\u5efa\u7acb\u5931\u8d25\uff0c\u65e0\u53ef\u7528\u7684\u5019\u9009\u8fde\u63a5"));this.iceGatheringState!=this.pcClient.iceGatheringState&& (this.iceGatheringState=this.pcClient.iceGatheringState,this.logStartupInfo(`__ice_gathering: ${this.iceGatheringState}`))}clearStatsTimer(){this.aggregateStatsIntervalId&&(clearInterval(this.aggregateStatsIntervalId),this.aggregateStatsIntervalId=void 0)}send(a){return this.dcClient&&"open"==this.dcClient.readyState?(this.dcClient.send(a),!0):!1}requestInitialSettings(){this.send((new Uint8Array([7])).buffer)}requestQualityControl(){this.send((new Uint8Array([1])).buffer)}sendEnableIntervalSendQP(a){this.send((new Uint8Array([11, a?1:0])).buffer)}_continueSendAPI(){if(0d){this.numOfEventCalls=0;let g=Math.ceil(c/d),q=[];for(var h=0;h{for(t=this.dcClient.bufferedAmount;kthis._continueSendAPI(),100);else if(t>l)break}},l=Math.max(8*e,1048576);this.dcClient.bufferedAmountLowThreshold=e;this.dcClient.onbufferedamountlow=t=>{this.numOfEventCalls++;f()};console.log(`sending api(command: ${a.command}) slices, count: ${g}`);f()}else{e=new DataView(new ArrayBuffer(4+2*c));d=0;e.setUint8(d,52);d++;e.setUint8(d,0);d++;e.setUint16(d,c,!0);d+=2;for(h=0;h{"inbound-rtp"!=c.type||c.isRemote||"video"!=c.mediaType&&!c.id.toLowerCase().includes("video")||(b.timestamp=c.timestamp,b.timestampStart=this.lastStats&&this.lastStats.timestampStart?this.lastStats.timestampStart:c.timestamp,b.bytesReceived=c.bytesReceived,b.packetsLost= c.packetsLost,b.framesDropped=c.framesDropped,b.framesPerSecond=c.framesPerSecond,b.framesReceived=c.framesReceived,b.framesDecoded=c.framesDecoded,b.keyFramesDecoded=c.keyFramesDecoded,b.frameWidth=c.frameWidth,b.frameHeight=c.frameHeight,this.lastStats&&(b.bitrate=8*(b.bytesReceived-this.lastStats.bytesReceived)/(b.timestamp-this.lastStats.timestamp)));"track"==c.type&&c.frameWidth&&(c.framesDropped&&(b.framesDropped=c.framesDropped),c.framesReceived&&(b.framesReceived=c.framesReceived),b.frameWidth= c.frameWidth,b.frameHeight=c.frameHeight);"candidate-pair"==c.type&&c.hasOwnProperty("currentRoundTripTime")&&0!=c.currentRoundTripTime&&(b.currentRoundTripTime=c.currentRoundTripTime)});this.lastStats.receiveToCompositeMs&&(b.receiveToCompositeMs=this.lastStats.receiveToCompositeMs,this.latencyTestTimings.setFrameDisplayDeltaTime(this.lastStats.receiveToCompositeMs));this.lastStats=b;this.events.onstats(this.lastStats)}onDatachannelMessage(a){var b=new Uint8Array(a.data);switch(b[0]){case 0:this.events.ondatachannelmessage("QualityControlOwnership", 1==b[1]);break;case 1:if((a=(new TextDecoder("utf-16")).decode(a.data.slice(1)))&&""!=a)this.events.ondatachannelmessage("ResponseAPI",a);break;case 101:b=b[1];a=(new TextDecoder("utf-8")).decode(a.data.slice(2));switch(b){case 0:this.events.ondatachannelmessage("ResponseAPI",a);break;case 1:this.reponse_api_json_string=a;break;case 2:this.reponse_api_json_string+=a;break;case 3:this.reponse_api_json_string+=a,this.events.ondatachannelmessage("ResponseAPI",this.reponse_api_json_string)}break;case 6:a= (new TextDecoder("utf-16")).decode(a.data.slice(1));a=JSON.parse(a);this.latencyTestTimings.setUETimings(a);break;case 7:a=(new TextDecoder("utf-16")).decode(a.data.slice(1));a=JSON.parse(a);if(a.Encoder)this.events.ondatachannelmessage("InitialSettings",a);break;case 5:this.events.ondatachannelmessage("VideoEncoderAvgQP",a)}}startLatencyTest(){this.video&&(this.latencyTestTimings.start(),this.sendDescriptor(6,{StartTime:this.latencyTestTimings.TestStartTimeMs}))}}class ia{constructor(a){this.player= a;this.uid=a.uid;this.container=a.container}appendElement(a){this.container.appendChild(a);this.setNeedReposUI()}removeElement(a){this.container.removeChild(a)}get(a){return wa(a+"_"+this.uid)}getValue(a){let b;return null==(b=this.get(a))?void 0:b.value}setValue(a,b){(a=this.get(a))&&(a.value=b)}setText(a,b){(a=this.get(a))&&(a.innerText=b)}setHtml(a,b){(a=this.get(a))&&(a.innerHTML=b)}resize(){this.player.resize()}setNeedReposUI(){this.player.bNeedReposUI=!0}}class $b extends ia{constructor(a){super(a); this.el=document.createElement("pre");this.el.id=`eventsPanel_${this.uid}`;this.el.className="__eventsPanel";this.el.oncontextmenu=new Function("return false");this.el.onselectstart=new Function("return false");this.appendElement(this.el)}destroy(){this.el&&(this.removeElement(this.el),this.el=null)}appendText(a){if(this.el){let b=this.el.innerText;b+=a+"\n";this.el.innerText=b;this.el.scrollTop=this.el.scrollHeight+100}}setPosition(a){a||(a=this.container.getBoundingClientRect());this.el&&(this.el.style.width= `${a.width}px`)}}class ca{}ca.Information='';ca.FullScreenEnter= ''; ca.FullScreenExit=''; ca.InitialCamera=''; class ac extends ia{constructor(a){super(a);this.create()}create(){if(!this.el){this.el=document.createElement("button");this.el.id=`fullscreeButton_${this.uid}`;this.el.className="__fullscreeButton";if(R.isIOSDevice||R.isSafari)this.el.style.backgroundSize="cover";this.el.innerHTML=ca.FullScreenEnter;this.el.title=H.getString("EnterFullscreen");this.el.oncontextmenu=new Function("return false");this.el.onselectstart=new Function("return false");this.el.onclick=()=>this.player.fullscreen=!this.player.fullscreen; this.el.onmousedown=a=>{1==a.button&&a.preventDefault()};this.appendElement(this.el);document.addEventListener("fullscreenchange",()=>{this.el.title=H.getString("ExitFullscreen");this.el.innerHTML=R.isFullscreen()?ca.FullScreenExit:ca.FullScreenEnter;this.player.resize()})}}destroy(){this.el&&(this.removeElement(this.el),this.el=null)}setPosition(a,b){a||(a=this.container.getBoundingClientRect());this.el&&(this.el.style.left=`${b?38:5}px`,this.el.style.top=`${a.height-32}px`)}}const ea={BackSpace:8, Shift:16,Control:17,Alt:18,RightShift:253,RightControl:254,RightAlt:255};class bc extends ia{constructor(a,b){super(a);this.video=null;this.useBuiltinCursors=b.useBuiltinCursors;this.keyEventTargetStr=b.keyEventTarget;this.keyEventTarget="document"==b.keyEventTarget?document:"none"==b.keyEventTarget?null:"video";this.callOnUserInteraction=()=>this.player.resetInteractTimestamp();this.fakeMouseWithTouches=!1;this.onMButtonDoubleClick=b.onMButtonDoubleClick;this.mouseKeyListener=b.mouseKeyListener; this.onActionEnable=!0;this.onEvents=b.onEvents;this.onVideoLoaded=b.onVideoLoaded;document.addEventListener("WeixinJSBridgeReady",()=>{R.isInWeixinBrowser=!0;this.video.play()});this.create()}isVideoLoaded(){return!!this._isVideoLoaded}create(){this.video&&this.destroy();this.video||(this.video=document.createElement("video"),this.video.id=`streamingVideo_${this.uid}`,this.video.style="position:absolute;",this.video.playsInline=!0,this.video.muted=!0,this.video.autoplay=!0,this.video.disablepictureinpicture= !0,"video"===this.keyEventTarget&&(this.video.tabIndex=1,this.keyEventTarget=this.video),this.appendElement(this.video),this.player.logStartupInfo("video element created"),this._isVideoLoaded=!1,this.video.addEventListener("loadedmetadata",()=>{this._isVideoLoaded=!0;this.video.onmouseenter({button:0,x:0,y:0});this.onVideoLoaded()},!0),this.setCursor());if("requestVideoFrameCallback"in HTMLVideoElement.prototype){const a=(b,c)=>{c.receiveTime&&c.expectedDisplayTime&&(this.rtc.lastStats.receiveToCompositeMs= c.presentationTime-c.receiveTime);this.video&&this.video.requestVideoFrameCallback(a)};this.video.requestVideoFrameCallback(a)}}setWebRtcPlayer(a){(!this.video||R.isAndroidDevice||R.isIOSDevice&&!R.isInWeixinBrowser)&&this.create();this.rtc=a;this.rtc.setVideo(this.video)}setActionEventEnabled(a){this.onActionEnable=a}destroy(){this.video&&(this.removeElement(this.video),this.video=null)}valid(){return!!this.video}videoWidth(){let a;return null==(a=this.video)?void 0:a.videoWidth}videoHeight(){let a; return null==(a=this.video)?void 0:a.videoHeight}clientWidth(){let a;return null==(a=this.video)?void 0:a.clientWidth}clientHeight(){let a;return null==(a=this.video)?void 0:a.clientHeight}setTrack(a){let b=a.streams[0];this.player.logStartupInfo("track: "+a.track.kind);"audio"==a.track.kind?(a=document.createElement("Audio"),a.autoplay=!0,a.srcObject=b,a.play(),this.player.logStartupInfo("audio element created")):"video"==a.track.kind&&this.video.srcObject!==b&&(this.video.srcObject=b)}setKeyEventTarget(a){this.keyEventTargetStr!= a&&(this.clearKeyboardEvents(),"video"==a?(this.video&&(this.video.tabIndex=1),this.keyEventTarget=this.video,this.video.focus()):"document"==a?(this.keyEventTarget=document,this.video.focus()):this.keyEventTarget&&(this.keyEventTarget=null),this.keyEventTargetStr=a,this.registerKeyboardEvents())}clearKeyboardEvents(){this.keyEventTarget&&(this.keyEventTarget.onkeydown=null,this.keyEventTarget.onkeyup=null,this.keyEventTarget.onkeypress=null)}registerKeyboardEvents(){this.keyEventTarget&&(this.keyEventTarget.onkeydown= a=>{112<=a.keyCode&&123>=a.keyCode||a.ctrlKey||this.sendKeydown(a);if(a.keyCode===ea.BackSpace)this.keyEventTarget.onkeypress({charCode:ea.BackSpace});this.callActionEventHander(5,a)},this.keyEventTarget.onkeyup=a=>{112<=a.keyCode&&123>=a.keyCode||a.ctrlKey||this.sendKeyup(a);this.callActionEventHander(6,a)},this.keyEventTarget.onkeypress=a=>{112<=a.keyCode&&123>=a.keyCode||this.sendKeypress(a);this.callActionEventHander(7,a)})}setCursor(){if(this.video)if(this.useBuiltinCursors)switch(this.mouseDownButton){case 0:this.video.setAttribute("class", "streamingVideoCursorPan");break;case 1:this.video.setAttribute("class","streamingVideoCursorMove");break;case 2:this.video.setAttribute("class","streamingVideoCursorRotate");break;default:this.video.setAttribute("class","streamingVideoCursorPointer")}else this.video.setAttribute("class","streamingVideoNoCursor")}callActionEventHander(a,b){if(this.mouseKeyListener&&this.onActionEnable)switch(a){case 0:if(R.isFunction(this.mouseKeyListener.onMouseEnter))this.mouseKeyListener.onMouseEnter(b);break; case 1:if(R.isFunction(this.mouseKeyListener.onMouseLeave))this.mouseKeyListener.onMouseLeave(b);break;case 2:if(R.isFunction(this.mouseKeyListener.onMouseMove))this.mouseKeyListener.onMouseMove(b);break;case 3:if(R.isFunction(this.mouseKeyListener.onMouseDown))this.mouseKeyListener.onMouseDown(b);break;case 4:if(R.isFunction(this.mouseKeyListener.onMouseUp))this.mouseKeyListener.onMouseUp(b);break;case 5:if(R.isFunction(this.mouseKeyListener.onKeyDown))this.mouseKeyListener.onKeyDown(b);break;case 6:if(R.isFunction(this.mouseKeyListener.onKeyUp))this.mouseKeyListener.onKeyUp(b); break;case 7:if(R.isFunction(this.mouseKeyListener.onKeyPress))this.mouseKeyListener.onKeyPress(b)}}isMiddleDoubleClick(a){if(1==a.button){if(this.lastMClickTimestamp&&200>a.timeStamp-this.lastMClickTimestamp)return!0;this.lastMClickTimestamp=a.timeStamp}else this.lastMClickTimestamp=void 0;return!1}registerMouseEvents(){this.video.onmouseenter=a=>{this.sendMouseEnter();a.buttons&1&&this.sendMouseDown(0,a.offsetX,a.offsetY);a.buttons&2&&this.sendMouseDown(2,a.offsetX,a.offsetY);a.buttons&4&&this.sendMouseDown(1, a.offsetX,a.offsetY);a.buttons&8&&this.sendMouseDown(3,a.offsetX,a.offsetY);a.buttons&16&&this.sendMouseDown(4,a.offsetX,a.offsetY);this.callActionEventHander(0,a)};this.video.onmouseleave=a=>{this.sendMouseLeave();a.buttons&1&&this.sendMouseUp(0,a.offsetX,a.offsetY);a.buttons&2&&this.sendMouseUp(2,a.offsetX,a.offsetY);a.buttons&4&&this.sendMouseUp(1,a.offsetX,a.offsetY);a.buttons&8&&this.sendMouseUp(3,a.offsetX,a.offsetYy);a.buttons&16&&this.sendMouseUp(4,a.offsetX,a.offsetY);this.callActionEventHander(1, a)};this.video.onmousemove=a=>{this.sendMouseMove(a.offsetX,a.offsetY,a.movementX,a.movementY);a.preventDefault();if(0==this.mouseDownButton||2==this.mouseDownButton)this.setCursor(),this.mouseDownButton=void 0;this.callActionEventHander(2,a)};this.video.onmousedown=a=>{this.keyEventTarget==this.video&&this.video.focus();this.sendMouseEnter();this.isMiddleDoubleClick(a)&&this.onMButtonDoubleClick?(this.onMButtonDoubleClick(a.offsetX,a.offsetY),a.preventDefault()):(this.mouseDownButton=a.button,this.sendMouseDown(a.button, a.offsetX,a.offsetY),a.preventDefault(),0!=a.button&&2!=a.button&&this.setCursor(),this.callActionEventHander(3,a))};this.video.onmouseup=a=>{this.mouseDownButton=void 0;this.sendMouseUp(a.button,a.offsetX,a.offsetY);a.preventDefault();this.setCursor();this.callActionEventHander(4,a)};this.video.oncontextmenu=a=>{a.preventDefault()};"onmousewheel"in this.video?this.video.addEventListener("mousewheel",a=>{this.sendMouseWheel(a.wheelDelta,a.offsetX,a.offsetY);a.preventDefault()},{passive:!1}):this.video.addEventListener("DOMMouseScroll", a=>{this.sendMouseWheel(-120*a.detail,a.offsetX,a.offsetY);a.preventDefault()},!1)}registerTouchEvents(){this.ongoingTouches=[];this.copyTouch=({identifier:b,clientX:c,clientY:e,force:d})=>({identifier:b,clientX:c,clientY:e,force:d});this.ongoingTouchIndexById=b=>{for(let c=0;c{let c=this.container.getBoundingClientRect(); if(void 0===a){let e=b.changedTouches[0];a={id:e.identifier,x:e.clientX-c.left,y:e.clientY-c.top};this.video.onmouseenter(b);this.sendMouseDown(0,a.x,a.y)}b.preventDefault()},{passive:!1});this.video.addEventListener("touchend",b=>{let c=this.container.getBoundingClientRect();for(let e=0;e{var c=this.container.getBoundingClientRect();for(var e=0;e{b.preventDefault();null==this||this.onEvents(`ongoingTouches: ${this.ongoingTouches.length}, touches: ${b.touches.length}, changedTouches: ${b.changedTouches.length}`);this.ongoingTouches.length>b.touches.length- b.changedTouches.length&&(this.onEvents&&this.onEvents(H.getString("TriggerSysTouch")),this.sendTouch(81,this.ongoingTouches),this.ongoingTouches=[]);b=b.changedTouches;for(let c=0;c{b.preventDefault();b=b.changedTouches;this.sendTouch(81,b);for(let c=0;c{b.preventDefault();this.sendTouch(82,b.touches)},{passive:!1})}resize(a){this.playerAspectRatio=this.container.clientHeight/this.container.clientWidth;this.videoAspectRatio=a?this.playerAspectRatio:this.videoHeight()/this.videoWidth()}normalizeAndQuantizeUnsigned(a,b){if(this.playerAspectRatio>this.videoAspectRatio){let c=this.playerAspectRatio/this.videoAspectRatio;a/=this.container.clientWidth;b=c*(b/this.container.clientHeight-.5)+.5}else a=this.videoAspectRatio/ this.playerAspectRatio*(a/this.container.clientWidth-.5)+.5,b/=this.container.clientHeight;return 0>a||1b||1this.videoAspectRatio){let c=this.playerAspectRatio/this.videoAspectRatio;a/=.5*this.container.clientWidth;b=c*b/(.5*this.container.clientHeight);return{x:32767*a,y:32767*b}}return{x:this.videoAspectRatio/this.playerAspectRatio*a/(.5*this.container.clientWidth)*32767, y:b/(.5*this.container.clientHeight)*32767}}sendTouch(a,b){this.callOnUserInteraction();var c=new DataView(new ArrayBuffer(2+10*b.length));c.setUint8(0,a);c.setUint8(1,b.length);let e=2,d=[];for(let h=0;hl?null==this||this.onEvents("can't figure out which touch to continue"):(c.setUint16(e,f.x,!0),e+=2,c.setUint16(e,f.y, !0),e+=2,c.setInt32(e,l,!0),e+=4,c.setUint8(e,255*g.force,!0),e+=1,c.setUint8(e,f.inRange?1:0,!0),e+=1,this.onEvents&&d.push(`{${l} (${parseInt(q)},${parseInt(k)})->(${parseInt(f.x)},${parseInt(f.y)}) ${255*g.force} ${f.inRange?1:0}}`))}this.rtc.send(c.buffer);this.onEvents&&(c="",80==a?c="start":82==a?c="move":81==a&&(c="end"),a=`[${c}] N${b.length} ${d.join(",")}}`,this.onEvents(a))}sendKeydown(a){this.callOnUserInteraction();let b=xa(a),c;null==(c=this.onEvents)||c.call(this,`Send KeyDown, Code:${b}, Repeat:${a.repeat}`); this.rtc.send((new Uint8Array([60,b,a.repeat])).buffer)}sendKeyup(a){this.callOnUserInteraction();a=xa(a);let b;null==(b=this.onEvents)||b.call(this,`Send KeyUp:${a}`);this.rtc.send((new Uint8Array([61,a])).buffer)}sendKeypress(a){this.callOnUserInteraction();var b;null==(b=this.onEvents)||b.call(this,`Send KeyPress:${a.charCode}`);b=new DataView(new ArrayBuffer(3));b.setUint8(0,62);b.setUint16(1,a.charCode,!0);this.rtc.send(b.buffer)}sendMouseEnter(){this.callOnUserInteraction();var a;null==(a=this.onEvents)|| a.call(this,"Send MouseEnter");a=new DataView(new ArrayBuffer(1));a.setUint8(0,70);this.rtc.send(a.buffer)}sendMouseLeave(){this.callOnUserInteraction();var a;null==(a=this.onEvents)||a.call(this,"Send MouseLeave");a=new DataView(new ArrayBuffer(1));a.setUint8(0,71);this.rtc.send(a.buffer)}sendMouseMove(a,b,c,e){this.callOnUserInteraction();if(this.normalizeAndQuantizeUnsigned){var d;null==(d=this.onEvents)||d.call(this,`Send MouseMove, X:${a}, Y:${b}, DeltaX:${c}, DeltaY:${e}`);a=this.normalizeAndQuantizeUnsigned(a, b);c=this.normalizeAndQuantizeSigned(c,e);e=new DataView(new ArrayBuffer(9));e.setUint8(0,74);e.setUint16(1,a.x,!0);e.setUint16(3,a.y,!0);e.setInt16(5,c.x,!0);e.setInt16(7,c.y,!0);this.rtc.send(e.buffer)}}sendMouseDown(a,b,c){this.callOnUserInteraction();if(this.normalizeAndQuantizeUnsigned){var e;null==(e=this.onEvents)||e.call(this,`Send MouseDown, Button:${a}, X:${b}, Y:${c}`);b=this.normalizeAndQuantizeUnsigned(b,c);c=new DataView(new ArrayBuffer(6));c.setUint8(0,72);c.setUint8(1,a);c.setUint16(2, b.x,!0);c.setUint16(4,b.y,!0);this.rtc.send(c.buffer)}}sendMouseUp(a,b,c){if(this.normalizeAndQuantizeUnsigned){var e;null==(e=this.onEvents)||e.call(this,`Send MouseUp, Button:${a}, X:${b}, Y:${c}`);b=this.normalizeAndQuantizeUnsigned(b,c);c=new DataView(new ArrayBuffer(6));c.setUint8(0,73);c.setUint8(1,a);c.setUint16(2,b.x,!0);c.setUint16(4,b.y,!0);this.rtc.send(c.buffer)}}sendMouseWheel(a,b,c){this.callOnUserInteraction();if(this.normalizeAndQuantizeUnsigned){var e;null==(e=this.onEvents)||e.call(this, `Send MouseWheel, Delta:${a}, X:${b}, Y:${c}`);b=this.normalizeAndQuantizeUnsigned(b,c);c=new DataView(new ArrayBuffer(7));c.setUint8(0,75);c.setInt16(1,a,!0);c.setUint16(3,b.x,!0);c.setUint16(5,b.y,!0);this.rtc.send(c.buffer)}}}class cc extends ia{constructor(a,b,c){super(a);this.updateConnectionCount(b);this.createButton(c)}createButton(a){if(!this.elButton){this.elButton=document.createElement("button");this.elButton.id=`liveStatusSwitchButton_${this.uid}`;this.elButton.innerHTML=ca.Information; this.elButton.title=a;this.elButton.className="__liveStatusSwitchButton";if(R.isIOSDevice||R.isSafari)this.elButton.style.backgroundSize="cover";this.elButton.oncontextmenu=new Function("return false");this.elButton.onselectstart=new Function("return false");this.elButton.onclick=()=>this.setPanelVisible();this.elButton.onmousedown=b=>{1==b.button&&b.preventDefault()};this.appendElement(this.elButton)}}createPanel(){if(!this.elPanel){var a=''+ ``+``+``+ ``+``+``+``+ ``+``+``+ ``+``+``+"
${H.getString("ConnInfo")}1-1${H.getString("Close")}
${H.getString("Duration")}00:00:00
${H.getString("Resolution")}1920 x 1080
${H.getString("Received")}0 kB
${H.getString("ReceivedFrames")}0
${H.getString("Dropped")}0 / 0
${H.getString("DecodingTime")}
${H.getString("DecodeFrames")}0 / 0
${H.getString("Bitrate")}-
${H.getString("FPS")}- / -
${H.getString("QP")}0
${H.getString("MaxQP")}
${H.getString("MaxBitrate")}
"; this.elPanel=document.createElement("div");this.elPanel.innerHTML=a;this.elPanel.id=`liveStatusPanel_${this.uid}`;this.elPanel.className="__liveStatusPanel __fadeinComp";this.elPanel.oncontextmenu=new Function("return false");this.elPanel.onselectstart=new Function("return false");this.appendElement(this.elPanel);this.get("i_hide_panel").onclick=()=>this.setPanelVisible();for(a=29;40>=a;a++)this.get("i_settings_maxQP").add(new Option(a,a));this.get("i_settings_maxQP").onchange=()=>{let b={encodeMaxQP:this.getValue("i_settings_maxQP")}; this.player.rtc.updateParams(b);this.player.signallingConnection.updateParams(b);this.get("i_settings_maxQP").blur()};for(a=10;100>=a;a+=5)this.get("i_settings_maxBitrate").add(new Option(a,a));this.get("i_settings_maxBitrate").onchange=()=>{let b={maxBitrate:this.getValue("i_settings_maxBitrate")};this.player.rtc.updateParams(b);this.player.signallingConnection.updateParams(b);this.get("i_settings_maxBitrate").blur()}}}setPosition(a){a||(a=this.container.getBoundingClientRect());this.elButton&&(this.elButton.style.top= `${a.height-32}px`);if(this.elPanel)if(this.customPosX&&this.customPosY)this.elPanel.style.left=this.customPosX+"px",this.elPanel.style.top=this.customPosY+"px";else{let b=this.elPanel.getBoundingClientRect();this.elPanel.style.left="5px";this.elPanel.style.top=`${a.height-b.height-42}px`}}destroy(){this.updateLatencyTestUI=!1;this.visible&&this.setPanelVisible();this.elPanel&&(this.removeElement(this.elPanel),this.elPanel=null);this.elButton&&(this.removeElement(this.elButton),this.elButton=null)}setPanelVisible(a, b){this.customPosX=a;this.customPosY=b;if(this.elPanel)if("none"==this.elPanel.style.display)this.updateConnectionCount(),this.elPanel.style.display="block",this.elPanel.className="__liveStatusPanel __fadeinComp",this.visible=!0,this.player.rtc.sendEnableIntervalSendQP(!0);else{this.elPanel.className="__liveStatusPanel __fadeoutComp";setTimeout(()=>{this.visible=!1;this.elPanel.style.display="none";this.player.rtc.sendEnableIntervalSendQP(!1);this.setNeedReposUI();this.resize()},500);return}else this.createPanel(), this.visible=!0,this.resize(),this.updateConnectionCount(),this.player.rtc.requestInitialSettings(),this.player.rtc.sendEnableIntervalSendQP(!0);this.setNeedReposUI();this.resize()}adjustMaxQP(a){return 18==a?(this.get("i_settings_maxQP")&&this.get("i_settings_maxQP").add(new Option(18,18)),18):0>a?40:0<=a&&29>a?29:40a?10:100e);d++)e/=1E3,c=b[d];this.setText("i_bytesReceived", this.formatNumber(e)+" "+c);this.setText("i_framesReceived",this.processValue(a.framesReceived));this.setText("i_framesDecoded",a.framesDecoded);this.setText("i_keyframesDecoded",this.processValue(a.keyFramesDecoded));this.updateVideoFramerate(this.formatNumber(a.framesPerSecond));this.updateBitrate(a.bitrate);this.setText("i_packetsLost",this.processValue(a.packetsLost));this.setText("i_frameDropped",this.processValue(a.framesDropped));this.setText("i_compositeTime",this.formatNumber(a.receiveToCompositeMs, 1))}}updateVideoFramerate(a){let b=this.get("i_framerateVideo");b.style.color=10>a?"red":20>a?"orange":"rgb(128,255,0)";b.innerText=a}updateBitrate(a){let b=this.get("i_bitrate");a?1E3a?"red":1E3>a?"orange":"rgb(128,255,0)",b.innerText=this.formatNumber(a)+" kbps"):b.innerText="-"}updateInitialSettings(a){let b=this.adjustMaxQP(a.Encoder.MaxQP);this.setValue("i_settings_maxQP",b);a=this.adjustMaxBitrate(a.WebRTC.MaxBitrate/ 1E3/1E3);this.setValue("i_settings_maxBitrate",a)}updateQPAndRenderFPS(a,b){let c=this.get("i_qp");c.style.color=35this.setVisible(!1),500)}setDelayClear(a){this.bDelayClear= a}log(a){if(this.el){if(this.bDelayClear)this.bDelayClear=!1,this.el.innerText=a+"\n";else{let b=this.el.innerText;b+=a+"\n";this.el.innerText=b}this.el.scrollTop=this.el.scrollHeight+100}}setPosition(a){a||(a=this.container.getBoundingClientRect());this.el&&(this.el.style.height=`${a.height-20}px`)}}class ec extends ia{constructor(a){super(a);this.create()}create(){this.el||(this.el=document.createElement("i"),this.el.id=`statusIndicator_${this.uid}`,this.el.className="__statusIndicator",this.appendElement(this.el))}destroy(){this.el&& (this.removeElement(this.el),this.el=null)}setStatus(a){let b="Red",c=this.get("statusIndicator");switch(a){case V.WS_Disconnected:b="Red";c&&(c.style.display="inline-block");break;case V.WS_Connecting:b="RGB(200,200,200)";break;case V.WS_Connected:b="Yellow";break;case V.RTC_Opened:b="RGB(0,128,255)";break;case V.OnReady:b="RGB(0,255,0)",this.hide()}this.lastStatus=a;c&&(c.style.backgroundColor=b)}hide(){let a=this.get("statusIndicator");a&&(a.style.display="none")}}class fc{constructor(){this.css("@keyframes __fadeoutframes {0%{opacity:1;} 100%{opacity:0;}}.__fadeoutComp {animation-duration:600ms; animation-name:__fadeoutframes;}@keyframes __fadeinframes {0%{opacity:0;} 100%{opacity:0.65;}}.__fadeinComp {animation-duration:100ms; animation-name:__fadeinframes;}@keyframes twinkling{0%{opacity:0;}100%{opacity:1;}}.__statusIndicator {position:absolute;display:block;left:5px;top:5px;width:6px;height:6px;border-radius:50%;background-color:red;animation:twinkling 0.25s infinite ease-in-out;}.__startupInfoPanel { position:absolute;left:3px;top:0px;width:400px;background-color:transparent !important;text-shadow:black 0.1em 0.1em 0.2em;color:white;font-family:Verdana;font-size:12px !important;overflow:auto;}.__liveStatusPanel {position:absolute;left:5px;top:10px;width:164px;height:300px;background-color:rgba(50,50,50,0.8);color:#00FF00;font-family:Verdana;font-size:10px;box-shadow:0px 0px 5px 5px rgba(200,200,200,0.5);-moz-border-radius:8px;-webkit-border-radius:8px;}.__liveStatusPanel a:link { color: rgb(0,255,128); text-decoration: none; }.__liveStatusPanel a:hover { color: yellow; background:transparent; }.__liveStatusPanel input {background:transparent; border:1px solid gray; color: #00FF00;}.__liveStatusPanel select {background:transparent; border:1px solid gray; color: #00FF00;}.__liveStatusPanel option {background:#333; color: #00FF00;}.__liveStatusSwitchButton{position:absolute;padding:0;left:6px;width:26px;height:26px;opacity:0.65;cursor:pointer;background-size:conver;}.__fullscreeButton {position:absolute;padding:0;left:38px;width:26px;height:26px;opacity:0.65;cursor:pointer;background-size:conver;}.__viewHomeButton {position:absolute;padding:0;left:70px;width:26px;height:26px;opacity:0.65;cursor:pointer;background-size:conver;}.__taskWaiting {position:absolute;z-index:30;text-align:center;padding-left:5px;text-shadow:black 0.1em 0.1em 0.2em;color:lime;font-family:Verdana;font-size:12px !important;overflow:hidden;display:none;}.__eventsPanel {position:absolute;left:3px;top:0px;width:600px;height:200px;background-color:rgba(64,64,64,0.5) !important;text-shadow:black 0.1em 0.1em 0.2em;color:white;font-family:Verdana;font-size:12px !important;overflow:auto;}.streamingVideoNoCursor {width:100%;height:100%;}.streamingVideoCursorMove {width:100%;height:100%;cursor:move;}.streamingVideoCursorPan {width:100%;height:100%;cursor:url(data:application/octet-stream;base64,AAACAAEAICAAAA8ADwCoDAAAFgAAACgAAAAgAAAAQAAAAAEAGAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////////////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////////////////////////8AAAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////8AAAD///////8AAAD///////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD////////////////////////////////////////////4B///+Af///AH///gA///wAP//8AB///gAf//8AH//+AB///gA///8k///////////////////////////////////////////////////////////////////////w==),auto;}.streamingVideoCursorPointer {width:100%;height:100%;cursor:url(data:application/octet-stream;base64,AAACAAEAICAAAA0ACACoDAAAFgAAACgAAAAgAAAAQAAAAAEAGAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////////////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////////////////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////////////////////////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////8AAAD///////8AAAD///////8AAAD///////8AAAD///////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////8AAAD///////8AAAD///////8AAAD///////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////8AAAD///////8AAAD///////8AAAAAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////8AAAD///////8AAAD///////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD////////////////////////////////////////////4B///+Af///AH///gA///wAP//8AB//+AAf//AAD//wAA//+AAP//4AD//+AF///gT///4f///+H////h////8////////////////////////////////////////w==),auto;}.streamingVideoCursorRotate {width:100%;height:100%;cursor:url(data:application/octet-stream;base64,AAACAAEAICAAAA8ADwCoDAAAFgAAACgAAAAgAAAAQAAAAAEAGAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////8AAAAAAAAAAAAAAAD///////////////////////////////////////8AAAAAAAAAAAAAAAD///////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////8AAAAAAAAAAAAAAAAAAAD///////////////////////////////////////////8AAAAAAAAAAAAAAAD///////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////////////////////////////8AAAAAAAAAAAAAAAD///////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////////////////////////////8AAAAAAAAAAAAAAAD///////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////////////////////8AAAD///8AAAAAAAAAAAAAAAD///////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////8AAAAAAAAAAAAAAAAAAAAAAAD///////8AAAD///////8AAAD///////8AAAAAAAAAAAAAAAAAAAAAAAD///////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD///////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD////////////////////////////////////////////4B///+Af///AH//hgAh/wwAMP4cABh+HgAYfh8AGH4eABh+HgA4eAck4BwP//A+H//4fz///P/////////////////////////////////////////////////////w==),auto;}")}css(a){let b= document.createElement("style");try{b.appendChild(document.createTextNode(a))}catch(c){b.styleSheet.cssText=a}(a=document.getElementsByTagName("head")[0])?a.appendChild(b):console.error("[Cloud] No head element found, cannot create css.")}}class gc extends ia{constructor(a){super(a);this.elContainer=document.createElement("div");this.elContainer.id=`taskWaiting_${this.uid}`;this.elContainer.className="__taskWaiting";this.elContainer.oncontextmenu=new Function("return false");this.elContainer.onselectstart= new Function("return false");this.appendElement(this.elContainer);this.elText=document.createElement("div");this.elText.style.marginBottom="15px";this.elText.innerText="dddd";this.elContainer.appendChild(this.elText);this.elButton=document.createElement("input");this.elButton.type="button";this.elButton.value=H.getString("RestartInstNow");this.elButton.onclick=()=>{this.player.setInstanceOptions({iid:this.player.options.iid,reset:!0})};this.elContainer.appendChild(this.elButton);H.onLanguageChangedCallbacks.push(()=> {this.elButton.value=H.getString("RestartInstNow")});this.setMode(0)}setMode(a){this._mode=a;0===a?this.elContainer.style.background="transparent":(this.elContainer.style.background="rgba(64,64,64,0.5)",this.elContainer.style.height="26px",this.elContainer.style.lineHeight="26px")}destroy(){this.elContainer&&(this.removeElement(this.elContainer),this.elContainer=null)}updateText(a){this.elText&&(this.elText.innerText=a,this.show())}show(){this.elContainer.className="__taskWaiting";this.elContainer.style.display= "block"}hide(){this.elContainer.className="__taskWaiting __fadeoutComp";setTimeout(()=>this.elContainer.style.display="none",500)}setPosition(a,b,c,e){if(this.elContainer)if(a||(a=this.container.getBoundingClientRect()),0==this._mode){var d=a.width/2-150;0>d&&(d=10);this.elContainer.style.left=d+"px";this.elContainer.style.top=a.height/2+"px"}else d=0,b&&d++,c&&d++,e&&d++,a=a.height-32,this.elContainer.style.left=(0==d?5:1==d?38:2==d?70:102)+"px",this.elContainer.style.top=a+"px"}}class hc extends ia{constructor(a){super(a); this.create()}create(){if(!this.el){var a=[];a.push(H.getString("LeftClickTip"));a.push(H.getString("RightClickTip"));a.push(H.getString("MiddleClickTip"));a=a.join("\n");this.el=document.createElement("button");this.el.id=`viewHomeButton_${this.uid}`;this.el.className="__viewHomeButton";if(R.isIOSDevice||R.isSafari)this.el.style.backgroundSize="cover";this.el.innerHTML=ca.InitialCamera;this.el.title=a;this.el.oncontextmenu=new Function("return false");this.el.onselectstart=new Function("return false"); this.el.onclick=b=>this.player.viewHome(0);this.el.onmousedown=b=>{0!=b.button&&this.player.viewHome(b.button);b.preventDefault()};this.appendElement(this.el)}}destroy(){this.el&&(this.removeElement(this.el),this.el=null)}setPosition(a,b,c){a||(a=this.container.getBoundingClientRect());if(this.el){let e=5;if(b&&c)e=70;else if(b||c)e=38;this.el.style.left=e+"px";this.el.style.top=`${a.height-32}px`}}}var va=0;class ic{constructor(a,b){if(a){this.host=a;this.options=b;ka.processParams(this.options); H.setLanguage();this.uid=++va;this.options.apiOptions.player=this;this.api=new ra(null,this.options.apiOptions);if(this.options.domId)if(a=wa(this.options.domId))this.container=document.createElement("div"),this.container.style="position:relative;width:100%;height:100%;",a.innerHTML="",a.appendChild(this.container);else if("loading"==document.readyState){console.error(H.getString("DomLoading"));return}if(this.hasVideo=!!this.container)this.styleManager=new fc,this.createWidgetsInConstructor(),this.canAdaptiveResolution= !1,this.lastResizeTime=Date.now(),this.orientationChangeTimeout=void 0;this.constructUrlAndConnect();this.resetInteractTimestamp()}else console.error("[DigitalTwinPlayer] The parameter `host` cannot be empty!")}constructUrlAndConnect(){this.logStartupInfo(`host: ${this.host}`);this.useHttps="https:"==location.protocol||this.options.useHttps;this.url=`${this.useHttps?"wss":"ws"}://${this.host}/player?hasVideo=${this.hasVideo}`;this.options.offer&&(this.url+="&offer=1");this.options.iid&&(this.url+= "&iid="+this.options.iid);this.options.pid&&(this.url+="&pid="+this.options.pid);this.options.password&&(this.url+="&password="+this.options.password);if("object"==typeof this.options.urlExtraInfo)for(let a in this.options.urlExtraInfo)this.url+="&"+a+"="+this.options.urlExtraInfo[a];this.options.reset&&(this.url+="&reset=1",this.options.reset=!1);setTimeout(()=>this.connectSignallingServer(),200)}callEvent(a,b,c){a=this.options.events[a];"function"==typeof a&&a(b,c)}getHost(){return this.host}getAPI(){return this.api}getInstanceInfo(){return this.paramInfo}getVideoElement(){let a; return null==(a=this.htmlVideo)?void 0:a.video}getVideoElementSize(){let a=this.getVideoElement();return{width:null==a?void 0:a.clientWidth,height:null==a?void 0:a.clientHeight}}getVideoStreamSize(){return{width:this.htmlVideo.videoWidth(),height:this.htmlVideo.videoHeight()}}getVideoSize(){return this.getVideoStreamSize()}screen2World(a,b,c){let e=this.getVideoElementSize(),d=this.getVideoStreamSize(),h=0,g=0,q=d.height/d.width;e.height/e.width>q?g=-(e.width*q-e.height)/2:h=-(e.height/q-e.width)/ 2;a=d.width/(e.width-2*h)*(a-h);b=d.height/(e.height-2*g)*(b-g);return this.getAPI().coord.screen2World(a,b,c)}world2Screen(a,b,c,e){const d=this;return $jscomp.asyncExecutePromiseGeneratorFunction(function*(){let h=yield __g.coord.world2Screen(a,b,c,e),g=d.getVideoElementSize(),q=d.getVideoStreamSize(),k=0,f=0,l=q.height/q.width;g.height/g.width>l?f=-(g.width*l-g.height)/2:k=-(g.height/l-g.width)/2;h.screenPosition=[h.screenPosition[0]/(q.width/(g.width-2*k))+k,h.screenPosition[1]/(q.height/(g.height- 2*f))+f];return h})}setResolution(a,b){if(this.streamerAdaptive){window.devicePixelRatio&&(a*=window.devicePixelRatio,b*=window.devicePixelRatio);if(4096this.streamerResX||b>this.streamerResY)&&(b=a/b,b>=this.streamerResX/this.streamerResY?(a=this.streamerResX,b=this.streamerResX/b):(a=this.streamerResY*b,b=this.streamerResY));a=Math.floor(a);b=Math.floor(b);var c=this.htmlVideo.videoWidth(), e=this.htmlVideo.videoHeight();if(a!=c&&a+1!=c&&a-1!=c||b!=e&&b+1!=e&&b-1!=e){if(this.lastWidth&&this.lastHeight&&(c=Math.abs(this.lastWidth-a),e=Math.abs(this.lastHeight-b),(0!=c||0!=e)&&4>c&&4>e))return;this.lastWidth=a;this.lastHeight=b;this.rtc&&this.rtc.updateRenderResolution(a,b);return[a,b]}}}destroy(a){console.log(`call DigitalTwinPlayer.destroy: ${a||" "}`);if(!this.isDestroyed){va--;this.isDestroyed=!0;this.destroyReason=a;var b;null==(b=this.rtc)||b.close();var c;null==(c=this.signallingConnection)|| c.close()}}setKeyEventTarget(a){let b;null==(b=this.htmlVideo)||b.setKeyEventTarget(a)}setKeyEventReceiver(a){this.setKeyEventTarget(a)}resize(){if(this.container){this.rect=this.container.getBoundingClientRect();if(this.bNeedReposUI||!this.oldRect||this.oldRect.width!=this.rect.width||this.oldRect.height!=this.rect.height){this.bNeedReposUI=!1;this.oldRect=this.rect;let b;null==(b=this.startupInfo)||b.setPosition(this.rect);let c;null==(c=this.liveStatus)||c.setPosition(this.rect);let e;null==(e= this.fullscreenButton)||e.setPosition(this.rect,this.options.ui.statusButton);let d;null==(d=this.homeButton)||d.setPosition(this.rect,this.options.ui.statusButton,this.options.ui.fullscreenButton);let h;null==(h=this.taskListBar)||h.setPosition(this.rect,this.options.ui.statusButton,this.options.ui.fullscreenButton,this.options.ui.homeButton)}if(this.htmlVideo.valid()){this.canAdaptiveResolution&&(console.warn("set res..."),this.setResolution(this.htmlVideo.clientWidth(),this.htmlVideo.clientHeight())); var a;null==(a=this.htmlVideo)||a.resize(this.streamerAdaptive&&this.canAdaptiveResolution)}}}setInstanceOptions(a){const b=this;return $jscomp.asyncExecutePromiseGeneratorFunction(function*(){var c=a.pid==b.options.pid&&a.iid==b.options.iid||!a.pid&&a.iid==b.options.iid||!a.iid&&a.pid==b.options.pid;if(c&&!a.reset)b.api.log("setInstanceOptions: no change.");else{if(!c){c=(!a.iid||a.iid==b.options.iid)&&a.pid!=b.options.pid;if(b.streamerLocked&&c){b.api.log(H.getString("CannotChangeProject"));return}c= yield b.signallingConnection.checkParams(a);if(null!==c){if(!1===c.iid){b.api.log(`iid(${a.iid})${H.getString("InstanceNotExist")}`);return}if(!1===c.pid){b.api.log(`pid(${a.pid})${H.getString("ProjectNotExist")}`);return}}}b.destroy();b.options.iid=a.iid;b.options.pid=a.pid;b.options.reset=a.reset;b.constructUrlAndConnect()}})}set fullscreen(a){a?R.fullscreen(this.container):R.exitFullscreen()}get fullscreen(){return!!document.fullscreenElement}setActionEventEnabled(a){let b;null==(b=this.htmlVideo)|| b.setActionEventEnabled(a)}onApiReady(){this.setStatus(V.OnReady);let a;null==(a=this.signallingConnection)||a.sendReady();1==this.options.ui.mainUI?this.api.settings.setMainUIVisibility(!0):0==this.options.ui.mainUI&&this.api.settings.setMainUIVisibility(!1);1==this.options.ui.campass?this.api.settings.setCampassVisible(!0):0==this.options.ui.campass&&this.api.settings.setCampassVisible(!1)}sendApi(a){if(a){let b;null==(b=this.rtc)||b.sendApi(a)}}onMainThreadBusy(a){if(1===a.busy){let b="BUSY! ", c=this.api.apiQueue.queueSize(),e=this.api.apiQueue.dataSize();0{if(Date.now()-this.timeOfLastInteraction> 6E4*this.kickOutInMinutes){let g=H.getString("DisconnectForIdle");this.destroy(g);console.warn(g);clearInterval(h)}},2E4)}this.nodeInfoArray=[`${H.getString("NodeInfo")}`];e&&this.nodeInfoArray.push(`\t${H.getString("Host")}`+e);c&&this.nodeInfoArray.push(`\t${H.getString("HostAddress")}`+c);b&&this.nodeInfoArray.push(`\t\u3000${H.getString("Project")}`+b);this.options.pid&&this.nodeInfoArray.push(`\t${H.getString("ProjectId")}`+this.options.pid);this.nodeInfoArray.push(`\t${H.getString("IID")}`+ this.options.iid);this.nodeInfoArray.push(`\t${H.getString("Adaptive")}`+this.streamerAdaptive);this.nodeInfoArray.push(`\t${H.getString("LimitMaxRes")}`+this.streamerLimitMaxResolution);this.nodeInfoArray.push(`\t${H.getString("Resolution")}${this.streamerResX}x${this.streamerResY}`);let d;null==(d=this.liveStatus)||d.updateButtonTip(this.nodeInfoArray.join("\n"));this.api.log(this.nodeInfoArray.join("\n\t"))}logStartupInfo(a){if(a){var b=new Date;a=`[${pa(b.getHours(),2)+":"+pa(b.getMinutes(),2)+ ":"+pa(b.getSeconds(),2)+"."+pa(b.getMilliseconds(),3)}] ${a}`;var c;null==(c=this.startupInfo)||c.log(a);1{let b;return null==(b=this.eventsPanel)? void 0:b.appendText(a)},onVideoLoaded:()=>{this.logStartupInfo("video: loadedmetadata");this.createWidgets();this.callEvent("onVideoLoaded");this.resize()},onMButtonDoubleClick:(a,b)=>{let c;null==(c=this.liveStatus)||c.setPanelVisible(a,b)}});this.options.ui.statusIndicator&&(this.statusIndicator=new ec(this));this.options.ui.startupInfo&&(this.startupInfo=new dc(this),this.logStartupInfo("sdk version: "+this.api.getVersion()),this.logStartupInfo("uid: "+this.uid));this.resizeObserver=new ResizeObserver(Ga(()=> this.resize(),500));this.resizeObserver.observe(this.container)}createWidgets(){this.options.ui.statusButton&&(this.liveStatus=new cc(this,this.playerCount,this.nodeInfoArray.join("\n")));this.options.ui.fullscreenButton&&(this.fullscreenButton=new ac(this));this.options.ui.homeButton&&(this.homeButton=new hc(this));this.taskListBar&&this.taskListBar.setMode(1)}destroyWidgets(){this.liveStatus&&(this.liveStatus.destroy(),this.liveStatus=null);this.fullscreenButton&&(this.fullscreenButton.destroy(), this.fullscreenButton=null);this.homeButton&&(this.homeButton.destroy(),this.homeButton=null);this.eventsPanel&&(this.eventsPanel.destroy(),this.eventsPanel=null);this.taskListBar&&(this.taskListBar.destroy(),this.taskListBar=null)}isQualityController(){return this.bQualityController}initWebRtcPlayer(a){H.setLanguage(a.language);this.rtc=new Zb({useStats:this.hasVideo&&(this.options.ui.statusButton||this.options.events.onRtcStatsReport),peerConnectionOptions:a.peerConnectionOptions,events:{onlog:b=> this.logStartupInfo(b),ontrack:b=>{let c;null==(c=this.htmlVideo)||c.setTrack(b)},onicecandidate:b=>{let c;return null==(c=this.signallingConnection)?void 0:c.sendCandidate(b)},onOfferCreated:b=>{let c;return null==(c=this.signallingConnection)?void 0:c.sendOffer(b.sdp,this.hasVideo)},onAnswerCreated:b=>{let c;return null==(c=this.signallingConnection)?void 0:c.send(b)},onstats:b=>{let c;null==(c=this.liveStatus)||c.updateWebRtcStats(b);this.callEvent("onRtcStatsReport",b)},ondatachannelopen:()=> {this.setStatus(V.RTC_Opened);this.hasVideo&&(this.rtc.requestQualityControl(),this.liveStatus&&this.rtc.requestInitialSettings());this.api.onConnectionOpen()},ondatachannelclose:b=>this.api.onConnectionClose(b),ondatachannelerror:b=>this.api.onConnectionClose(b.error),ondatachannelmessage:(b,c)=>{switch(b){case "ResponseAPI":this.api.onConnectionMessage(c);break;case "InitialSettings":let e;null==(e=this.liveStatus)||e.updateInitialSettings(c);break;case "VideoEncoderAvgQP":let d;if(null==(d=this.liveStatus)? 0:d.visible)b=(new TextDecoder("utf-16")).decode(c.data.slice(1)),(b=JSON.parse(b))&&this.liveStatus.updateQPAndRenderFPS(b.qp,b.renderFPS);break;case "QualityControlOwnership":this.bQualityController=c;let h;null==(h=this.liveStatus)||h.updatePlayerId()}}}});this.hasVideo&&this.htmlVideo.setWebRtcPlayer(this.rtc);this.logStartupInfo("setting up...");this.options.offer&&this.rtc.createOffer();this.hasVideo&&(this.htmlVideo.registerKeyboardEvents(),this.htmlVideo.registerMouseEvents(),this.htmlVideo.registerTouchEvents())}connectSignallingServer(){this.setStatus(V.WS_Connecting); this.signallingConnection=new Wb({onopen:()=>this.setStatus(V.WS_Connected),onclose:a=>this.handleSignallingClose(a),onerror:()=>{this.setStatus(V.WS_Disconnected)},onmessage:a=>{switch(a.type){case "config":this.initWebRtcPlayer(a);break;case "answer":this.playerId=a.playerId;this.rtc&&this.rtc.onReceiveAnswer(a);break;case "offer":this.playerId=a.playerId;this.rtc&&this.rtc.onReceiveOffer(a);break;case "iceCandidate":this.rtc&&this.rtc.onIceCandidate(a.candidate);break;case "paramInfo":this.receiveParamInfo(a); break;case "status":this.handleSignallingMessage_Status(a);break;case "playerCount":this.handleSignallingMessage_PlayerCount(a)}}});this.signallingConnection.connect(this.url)}handleSignallingClose(a){this.destroyWidgets();this.callEvent("onConnClose",a);this.startupInfo&&this.startupInfo.setVisible(!0);this.api.onConnectionClose(a);this.rtc&&this.rtc.close();let b="";this.isDestroyed?(b=H.getString("Destroyed"),b=this.destroyReason?b+(": "+this.destroyReason):b+"."):(b="closed: ",a.code&&(b+=a.code), a.reason?b+=" "+a.reason:1006==a.code&&(b+=" "+H.getString("Disconnect")));this.setStatus(V.WS_Disconnected,b);Ia(a.code)||this.destroy();this.isDestroyed||(this.logStartupInfo(H.getString("Reconnect5s")),this.startupInfo.setDelayClear(!0),setTimeout(()=>this.connectSignallingServer(),5E3));a.code==sa.instance_is_busy&&confirm(H.getString("RestartAndRetry"))&&this.setInstanceOptions({iid:this.busyIId,reset:!0})}handleSignallingMessage_Status(a){let b=Ha(a.state);b&&this.logStartupInfo(b);a.state=== da.StartFailed?(console.error(a.info),this.options.ui.startupInfo&&setTimeout(()=>alert(a.info),500)):a.state==da.ConfirmBusy&&(this.busyIId=a.info)}handleSignallingMessage_PlayerCount(a){this.playerCount=a.count;let b;null==(b=this.liveStatus)||b.updateConnectionCount(this.playerCount);(this.canAdaptiveResolution=1===a.count)&&this.resize()}}v.APIErrorCode={OK:0,InvalidParameters:1,InternalError:2,ResourceNotFound:3,AcpProjWKTNotSet:4,CoordinateConversionFailed:5,IDExists:6,InvalidRequestType:7, InvalidRequestString:8,NoCommand:9,DataTypeNotSupport:10,InvalidOperation:11,ProjectNotOpened:12,CodeMax:65535};v.ActionMode={None:0,Follow:1,FollowBehindAndAbove:2,FollowBehind:3,FollowAbove:4,FollowBellow:5,FollowLeft:6,FollowRight:7};v.AnimatedImageButtonData=Qa;v.BPFuncParamType={Bool:0,UInt8:1,Int32:2,Float:3,Double:4,String:5,Color:6,Vector2D:7,Vector:8,Rotator:9,IntArray:10,StringArray:11,VectorArray:12,Coordinate:13,CoordinateArray:14,FloatArray:15};v.BPFunctionData=db;v.BeamData=Ra;v.CameraTourData= fb;v.CameraTourKeyFrame=eb;v.CloudStatus=V;v.Color={LightPink:"RGB(255,182,193)",Pink:"RGB(255,192,203)",Crimson:"RGB(220,20,60)",LavenderBlush:"RGB(255,240,245)",PaleVioletRed:"RGB(219,112,147)",HotPink:"RGB(255,105,180)",DeepPink:"RGB(255,20,147)",MediumVioletRed:"RGB(199,21,133)",Orchid:"RGB(218,112,214)",Thistle:"RGB(216,191,216)",plum:"RGB(221,160,221)",Violet:"RGB(238,130,238)",Magenta:"RGB(255,0,255)",Fuchsia:"RGB(255,0,255)",DarkMagenta:"RGB(139,0,139)",Purple:"RGB(128,0,128)",MediumOrchid:"RGB(186,85,211)", DarkVoilet:"RGB(148,0,211)",DarkOrchid:"RGB(153,50,204)",Indigo:"RGB(75,0,130)",BlueViolet:"RGB(138,43,226)",MediumPurple:"RGB(147,112,219)",MediumSlateBlue:"RGB(123,104,238)",SlateBlue:"RGB(106,90,205)",DarkSlateBlue:"RGB(72,61,139)",Lavender:"RGB(230,230,250)",GhostWhite:"RGB(248,248,255)",Blue:"RGB(0,0,255)",MediumBlue:"RGB(0,0,205)",MidnightBlue:"RGB(25,25,112)",DarkBlue:"RGB(0,0,139)",Navy:"RGB(0,0,128)",RoyalBlue:"RGB(65,105,225)",CornflowerBlue:"RGB(100,149,237)",LightSteelBlue:"RGB(176,196,222)", LightSlateGray:"RGB(119,136,153)",SlateGray:"RGB(112,128,144)",DoderBlue:"RGB(30,144,255)",AliceBlue:"RGB(240,248,255)",SteelBlue:"RGB(70,130,180)",LightSkyBlue:"RGB(135,206,250)",SkyBlue:"RGB(135,206,235)",DeepSkyBlue:"RGB(0,191,255)",LightBLue:"RGB(173,216,230)",PowDerBlue:"RGB(176,224,230)",CadetBlue:"RGB(95,158,160)",Azure:"RGB(240,255,255)",LightCyan:"RGB(225,255,255)",PaleTurquoise:"RGB(175,238,238)",Cyan:"RGB(0,255,255)",Aqua:"RGB(212,242,231)",DarkTurquoise:"RGB(0,206,209)",DarkSlateGray:"RGB(47,79,79)", DarkCyan:"RGB(0,139,139)",Teal:"RGB(0,128,128)",MediumTurquoise:"RGB(72,209,204)",LightSeaGreen:"RGB(32,178,170)",Turquoise:"RGB(64,224,208)",Auqamarin:"RGB(127,255,170)",MediumAquamarine:"RGB(0,250,154)",MediumSpringGreen:"RGB(0,255,127)",MintCream:"RGB(245,255,250)",SpringGreen:"RGB(60,179,113)",SeaGreen:"RGB(46,139,87)",Honeydew:"RGB(240,255,240)",LightGreen:"RGB(144,238,144)",PaleGreen:"RGB(152,251,152)",DarkSeaGreen:"RGB(143,188,143)",LimeGreen:"RGB(50,205,50)",Lime:"RGB(0,255,0)",ForestGreen:"RGB(34,139,34)", Green:"RGB(0,128,0)",DarkGreen:"RGB(0,100,0)",Chartreuse:"RGB(127,255,0)",LawnGreen:"RGB(124,252,0)",GreenYellow:"RGB(173,255,47)",OliveDrab:"RGB(85,107,47)",Beige:"RGB(245,245,220)",LightGoldenrodYellow:"RGB(250,250,210)",Ivory:"RGB(255,255,240)",LightYellow:"RGB(255,255,224)",Yellow:"RGB(255,255,0)",Olive:"RGB(128,128,0)",DarkKhaki:"RGB(189,183,107)",LemonChiffon:"RGB(255,250,205)",PaleGodenrod:"RGB(238,232,170)",Khaki:"RGB(240,230,140)",Gold:"RGB(255,215,0)",Cornislk:"RGB(255,248,220)",GoldEnrod:"RGB(218,165,32)", FloralWhite:"RGB(255,250,240)",OldLace:"RGB(253,245,230)",Wheat:"RGB(245,222,179)",Moccasin:"RGB(255,228,181)",Orange:"RGB(255,165,0)",PapayaWhip:"RGB(255,239,213)",BlanchedAlmond:"RGB(255,235,205)",NavajoWhite:"RGB(255,222,173)",AntiqueWhite:"RGB(250,235,215)",Tan:"RGB(210,180,140)",BrulyWood:"RGB(222,184,135)",Bisque:"RGB(255,228,196)",DarkOrange:"RGB(255,140,0)",Linen:"RGB(250,240,230)",Peru:"RGB(205,133,63)",PeachPuff:"RGB(255,218,185)",SandyBrown:"RGB(244,164,96)",Chocolate:"RGB(210,105,30)", SaddleBrown:"RGB(139,69,19)",SeaShell:"RGB(255,245,238)",Sienna:"RGB(160,82,45)",LightSalmon:"RGB(255,160,122)",Coral:"RGB(255,127,80)",OrangeRed:"RGB(255,69,0)",DarkSalmon:"RGB(233,150,122)",Tomato:"RGB(255,99,71)",MistyRose:"RGB(255,228,225)",Salmon:"RGB(250,128,114)",Snow:"RGB(255,250,250)",LightCoral:"RGB(240,128,128)",RosyBrown:"RGB(188,143,143)",IndianRed:"RGB(205,92,92)",Red:"RGB(255,0,0)",Brown:"RGB(165,42,42)",FireBrick:"RGB(178,34,34)",DarkRed:"RGB(139,0,0)",Maroon:"RGB(128,0,0)",White:"RGB(255,255,255)", WhiteSmoke:"RGB(245,245,245)",Gainsboro:"RGB(220,220,220)",LightGrey:"RGB(211,211,211)",Silver:"RGB(192,192,192)",DarkGray:"RGB(169,169,169)",Gray:"RGB(128,128,128)",DimGray:"RGB(105,105,105)",Black:"RGB(0,0,0)"};v.CommandType=p;v.CustomObjectData=$a;v.CustomObjectData2=ab;v.CustomTagData=Na;v.DecalData=Ya;v.DigitalTwinAPI=ra;v.DigitalTwinPlayer=ic;v.DynamicWaterData=cb;v.HeatMapPointData=Ka;v.HighlightAreaData=Oa;v.ImageButtonData=Pa;v.LayerVisibleData=Ja;v.MapMode={Campass:0,SmallMap:1,BigMap:2}; v.MeasurementMode={Coordinate:1,Linear:2,Horizontal:3,Vertical:4,MultiPoint:5,TerrainArea:6};v.MousePickMask=qa;v.ODLineData=Va;v.PanelType={ViewshedAnalysis:0,SkylineAnalysis:1,ViewDomeAnalysis:2,VisiblityAnalysis:3,FloodFillAnalysis:4,SolarAnalysis:5,CutFillAnalysis:6,TerrainSlopeAnalysi:7,ContourLineAnalysis:8};v.PanoramaData=Xa;v.Polygon3DData=Ta;v.Polygon3DStyle={Wave:0,LoopLine:1,Gradual:2,DynamicGradual:3,WaveTransparent:4,WideWave:5,RotateArrow:6,RotateLine:7,RotateGradual:8,SingleColor:9, SingleColorWithLight:10};v.PolygonData=Wa;v.PolygonStyle={SingleColor:0,CirclePoint:1,Volumn:2,Gradual:3,DynamicGradual:4,WaveTransparent:5,WideWave:6,RotateArrow:7,RotateLine:8,RotateGradual:9,OnTerrain:10};v.PolylineData=Ua;v.PolylineStyle={Arrow:0,Arrow1:1,Flow:2,Beam:3,Normal:4,OnTerrain:5,DottedNormal:6,DottedCircle:7};v.RadiationPointData=Sa;v.RendererType={SimpleRenderer:0,UniqueValueRenderer:1,ClassBreaksRenderer:2};v.TagData=La;v.TileLayerActorData=fa;v.TileLayerData=Za;v.VERSION="5.4";v.VehicleViewMode= {FirstPerson:0,ThirdPerson:1};v.VideoProjectionData=bb;v.Viewport=ba;v.WaterFlowFieldStyle={HeatMap:0,Water:1};v.WebUIData=Ma;v.__onCefResponse=function(a,b){if(ua)ua.onConnectionMessage(a,b)};Object.defineProperty(v,"__esModule",{value:!0});return v}({}); (()=>{if("undefined"!=typeof module&&module.exports)module.exports=acapi;else if("function"==typeof define&&define.amd)define(function(){return acapi});else{window.AcApiVersion=acapi.VERSION;acapi.AirCityAPI=acapi.DigitalTwinAPI;acapi.AirCityPlayer=acapi.DigitalTwinPlayer;for(let v in acapi)"VERSION"!=v&&(window[v]=acapi[v]);acapi.DigitalTwinAPI.__onApiConstructed=v=>window.__g=v}})();