earthsdk3-ue 3.3.0-beta.2 → 3.3.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/earthsdk3-ue.iife.js +3 -3
- package/dist/earthsdk3-ue.js +288 -288
- package/dist/earthsdk3-ue.umd.cjs +2 -2
- package/dist/types/ESUeViewer/ESUeViewer.d.ts +20 -260
- package/dist/types/ESUeViewer/ESUeViewer.d.ts.map +1 -1
- package/dist/types/ESUeViewer/inner/ReactProps.d.ts +2 -102
- package/dist/types/ESUeViewer/inner/ReactProps.d.ts.map +1 -1
- package/dist/types/ESUeViewer/uemsg/CallUeFuncs.d.ts +3 -3
- package/dist/types/ESUeViewer/uemsg/CallUeFuncs.d.ts.map +1 -1
- package/dist/types/ESUeViewer/uemsg/UeFuncsType.d.ts +1 -0
- package/dist/types/ESUeViewer/uemsg/UeFuncsType.d.ts.map +1 -1
- package/dist/types/UeObjects/base/UeESGeoVector/index.d.ts +3 -21
- package/dist/types/UeObjects/base/UeESGeoVector/index.d.ts.map +1 -1
- package/dist/types/UeObjects/base/UeESLocalVector/index.d.ts +3 -21
- package/dist/types/UeObjects/base/UeESLocalVector/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeES3DTileset/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeES3DTileset/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESAlarm/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESAlarm/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESApertureEffect/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESApertureEffect/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESAreaMeasurement/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESAreaMeasurement/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESBlastParticleSystem/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESBlastParticleSystem/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESBoxClipping/index.d.ts +2 -2
- package/dist/types/UeObjects/general/UeESBoxClipping/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESCameraView/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESCameraView/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESCameraVisibleRange/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESCameraVisibleRange/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESCar/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESCar/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESClassification/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESClassification/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESClippingPlane/index.d.ts +2 -2
- package/dist/types/UeObjects/general/UeESClippingPlane/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESDataMesh/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESDataMesh/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESDatasmithRuntimeModel/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESDatasmithRuntimeModel/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESDirectionMeasurement/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESDirectionMeasurement/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESDistanceMeasurement/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESDistanceMeasurement/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESDynamicWater/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESDynamicWater/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESEntityCluster/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESEntityCluster/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESExcavate/index.d.ts +5 -23
- package/dist/types/UeObjects/general/UeESExcavate/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESFireParticleSystem/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESFireParticleSystem/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESForestTileset/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESForestTileset/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESGaussianSplatting/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESGaussianSplatting/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESGeoDiv/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESGeoDiv/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESGeoExtrudedPolygon/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESGeoExtrudedPolygon/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESGeoJson/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESGeoJson/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESGeoLineString/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESGeoLineString/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESGeoPolygon/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESGeoPolygon/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESGeoRectangle/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESGeoRectangle/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESGeoWater/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESGeoWater/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESGltfModel/index.d.ts +2 -2
- package/dist/types/UeObjects/general/UeESGltfModel/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESHeightMeasurement/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESHeightMeasurement/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESHuman/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESHuman/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESHumanPoi/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESHumanPoi/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESImageLabel/index.d.ts +2 -2
- package/dist/types/UeObjects/general/UeESImageLabel/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESImageryLayer/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESImageryLayer/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESLevelRuntimeModel/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESLevelRuntimeModel/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESLocalCircle/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESLocalCircle/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESLocalPolygon/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESLocalPolygon/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESLocalPolygonZ/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESLocalPolygonZ/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESLocalRectangle/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESLocalRectangle/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESLocalSkyBox/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESLocalSkyBox/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESLocationMeasurement/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESLocationMeasurement/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESMsTileset/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESMsTileset/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESNavigator/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESNavigator/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESPath/index.d.ts +4 -22
- package/dist/types/UeObjects/general/UeESPath/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESPipeFence/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESPipeFence/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESPipeline/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESPipeline/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESPipeserTileset/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESPipeserTileset/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESPit/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESPit/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESPoi2D/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESPoi2D/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESPoi3D/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESPoi3D/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESPoiTileset/index.d.ts +2 -2
- package/dist/types/UeObjects/general/UeESPoiTileset/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESPolygonFence/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESPolygonFence/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESPolygonFlattenedPlane/index.d.ts +5 -23
- package/dist/types/UeObjects/general/UeESPolygonFlattenedPlane/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESPolygonWithHole/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESPolygonWithHole/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESRtsFeatureEditing/index.d.ts +3 -3
- package/dist/types/UeObjects/general/UeESRtsFeatureEditing/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESRtsTileset/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESRtsTileset/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESSeparateFoliage/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESSeparateFoliage/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESSkylineAnalysis/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESSkylineAnalysis/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESStaticMesh/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESStaticMesh/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESSubmergingAnalysis/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESSubmergingAnalysis/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESSunshineAnalysis/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESSunshineAnalysis/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESSurfaceAreaMeasurement/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESSurfaceAreaMeasurement/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESTerrainLayer/index.d.ts +2 -2
- package/dist/types/UeObjects/general/UeESTerrainLayer/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESTextLabel/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESTextLabel/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESUEWidget/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESUEWidget/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESUnrealActor/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESUnrealActor/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESVideoFusion/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESVideoFusion/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESViewShed/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESViewShed/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESViewerStatusBar/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESViewerStatusBar/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESVisibilityAnalysis/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESVisibilityAnalysis/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESVolumeMeasurement/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESVolumeMeasurement/index.d.ts.map +1 -1
- package/dist/types/UeObjects/general/UeESWidget/index.d.ts +1 -1
- package/dist/types/UeObjects/general/UeESWidget/index.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -88,7 +88,7 @@ Msg: ${e}`;console.warn(t)}};u.verboseLogLevel=5,function(r){r.LIST_STREAMERS="l
|
|
|
88
88
|
void main() {
|
|
89
89
|
gl_FragColor = texture2D(u_image, v_texCoord);
|
|
90
90
|
}
|
|
91
|
-
`}}class Ja{static deepCopyGamepad(A){return JSON.parse(JSON.stringify({buttons:A.buttons.map(e=>JSON.parse(JSON.stringify({pressed:e.pressed,touched:e.touched}))),axes:A.axes}))}}class qd{constructor(A){this.toStreamerMessagesProvider=A,this.controllers=[]}updateStatus(A,e,t){if(A.gamepad){const n=e.getPose(A.gripSpace,t);if(!n)return;let s=0;A.profiles.includes("htc-vive")?s=1:A.profiles.includes("oculus-touch")&&(s=2),this.toStreamerMessagesProvider.toStreamerHandlers.get("XRSystem")([s]);let i=2;switch(A.handedness){case"left":i=0;break;case"right":i=1}const o=n.transform.matrix,a=[];for(let d=0;d<16;d++)a[d]=new Float32Array([o[d]])[0];this.toStreamerMessagesProvider.toStreamerHandlers.get("XRControllerTransform")([a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15],i]),this.controllers[i]===void 0&&(this.controllers[i]={prevState:void 0,currentState:void 0,id:void 0},this.controllers[i].prevState=Ja.deepCopyGamepad(A.gamepad)),this.controllers[i].currentState=Ja.deepCopyGamepad(A.gamepad);const l=this.controllers[i],c=l.currentState,h=l.prevState;for(let d=0;d<c.buttons.length;d++){const B=c.buttons[d],g=h.buttons[d];B.pressed?this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonPressed")([i,d,g.pressed?1:0]):!B.pressed&&g.pressed&&this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonReleased")([i,d,0]),B.touched&&!B.pressed?this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonPressed")([i,3,g.touched?1:0]):!B.touched&&g.touched&&this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonReleased")([i,3,0])}for(let d=0;d<c.axes.length;d++)this.toStreamerMessagesProvider.toStreamerHandlers.get("XRAnalog")([i,d,c.axes[d]]);this.controllers[i].prevState=c}}}class za{constructor(A){this.xrSession=null,this.webRtcController=A,this.xrControllers=[],this.xrGamepadController=new qd(this.webRtcController.streamMessageController),this.onSessionEnded=new EventTarget,this.onSessionStarted=new EventTarget,this.onFrame=new EventTarget}xrClicked(){this.xrSession?this.xrSession.end():navigator.xr.requestSession("immersive-vr").then(A=>{this.onXrSessionStarted(A)})}onXrSessionEnded(){u.Log(u.GetStackTrace(),"XR Session ended"),this.xrSession=null,this.onSessionEnded.dispatchEvent(new Event("xrSessionEnded"))}onXrSessionStarted(A){u.Log(u.GetStackTrace(),"XR Session started"),this.xrSession=A,this.xrSession.addEventListener("end",()=>{this.onXrSessionEnded()});const e=document.createElement("canvas");this.gl=e.getContext("webgl2",{xrCompatible:!0}),this.xrSession.updateRenderState({baseLayer:new XRWebGLLayer(this.xrSession,this.gl)});const t=this.gl.createShader(this.gl.VERTEX_SHADER);this.gl.shaderSource(t,Xa.vertexShader()),this.gl.compileShader(t);const n=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(n,Xa.fragmentShader()),this.gl.compileShader(n);const s=this.gl.createProgram();this.gl.attachShader(s,t),this.gl.attachShader(s,n),this.gl.linkProgram(s),this.gl.useProgram(s),this.positionLocation=this.gl.getAttribLocation(s,"a_position"),this.texcoordLocation=this.gl.getAttribLocation(s,"a_texCoord"),this.positionBuffer=this.gl.createBuffer(),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.positionBuffer),this.gl.enableVertexAttribArray(this.positionLocation);const i=this.gl.createTexture();this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.NEAREST),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.NEAREST),this.texcoordBuffer=this.gl.createBuffer(),this.resolutionLocation=this.gl.getUniformLocation(s,"u_resolution"),this.offsetLocation=this.gl.getUniformLocation(s,"u_offset"),A.requestReferenceSpace("local").then(o=>{this.xrRefSpace=o,this.xrSession.requestAnimationFrame((a,l)=>this.onXrFrame(a,l))}),this.onSessionStarted.dispatchEvent(new Event("xrSessionStarted"))}onXrFrame(A,e){const t=e.getViewerPose(this.xrRefSpace);if(t){const n=t.transform.matrix,s=[];for(let o=0;o<16;o++)s[o]=new Float32Array([n[o]])[0];this.webRtcController.streamMessageController.toStreamerHandlers.get("XRHMDTransform")([s[0],s[4],s[8],s[12],s[1],s[5],s[9],s[13],s[2],s[6],s[10],s[14],s[3],s[7],s[11],s[15]]);const i=this.xrSession.renderState.baseLayer;this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,i.framebuffer),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,this.webRtcController.videoPlayer.getVideoElement()),this.render(this.webRtcController.videoPlayer.getVideoElement())}this.webRtcController.config.isFlagEnabled(U.XRControllerInput)&&this.xrSession.inputSources.forEach((n,s,i)=>{this.xrGamepadController.updateStatus(n,e,this.xrRefSpace)},this),this.xrSession.requestAnimationFrame((n,s)=>this.onXrFrame(n,s)),this.onFrame.dispatchEvent(new ya({time:A,frame:e}))}render(A){if(!this.gl)return;const e=this.xrSession.renderState.baseLayer;let t,n,s,i,o;this.gl.viewport(0,0,e.framebufferWidth,e.framebufferHeight),this.gl.uniform4f(this.offsetLocation,1,1,0,0),this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array([0,0,A.videoWidth,0,0,A.videoHeight,0,A.videoHeight,A.videoWidth,0,A.videoWidth,A.videoHeight]),this.gl.STATIC_DRAW),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.texcoordBuffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),this.gl.STATIC_DRAW),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.positionBuffer),t=2,n=this.gl.FLOAT,s=!1,i=0,o=0,this.gl.vertexAttribPointer(this.positionLocation,t,n,s,i,o),this.gl.enableVertexAttribArray(this.texcoordLocation),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.texcoordBuffer),t=2,n=this.gl.FLOAT,s=!1,i=0,o=0,this.gl.vertexAttribPointer(this.texcoordLocation,t,n,s,i,o),this.gl.uniform2f(this.resolutionLocation,A.videoWidth,A.videoHeight);const a=this.gl.TRIANGLES;o=0,this.gl.drawArrays(a,o,6)}static isSessionSupported(A){return navigator.xr?navigator.xr.isSessionSupported(A):new Promise(()=>!1)}}class jd{constructor(A){this.editTextButton=null,this.hiddenInput=null,"ontouchstart"in document.documentElement&&this.createOnScreenKeyboardHelpers(A)}unquantizeAndDenormalizeUnsigned(A,e){return null}createOnScreenKeyboardHelpers(A){this.hiddenInput||(this.hiddenInput=document.createElement("input"),this.hiddenInput.id="hiddenInput",this.hiddenInput.maxLength=0,A.appendChild(this.hiddenInput)),this.editTextButton||(this.editTextButton=document.createElement("button"),this.editTextButton.id="editTextButton",this.editTextButton.innerHTML="edit text",A.appendChild(this.editTextButton),this.editTextButton.classList.add("hiddenState"),this.editTextButton.addEventListener("touchend",e=>{this.hiddenInput.focus(),e.preventDefault()}))}showOnScreenKeyboard(A){if(A.showOnScreenKeyboard){this.editTextButton.classList.remove("hiddenState");const e=this.unquantizeAndDenormalizeUnsigned(A.x,A.y);this.editTextButton.style.top=e.y.toString()+"px",this.editTextButton.style.left=(e.x-40).toString()+"px"}else this.editTextButton.classList.add("hiddenState"),this.hiddenInput.blur()}}class Au{constructor(A,e){this._showActionOrErrorOnDisconnect=!0,this.allowConsoleCommands=!1,this.config=A,e!=null&&e.videoElementParent&&(this._videoElementParent=e.videoElementParent),this._eventEmitter=new Ia,this.configureSettings(),this.setWebRtcPlayerController(new Wa(this.config,this)),this.onScreenKeyboardHelper=new jd(this.videoElementParent),this.onScreenKeyboardHelper.unquantizeAndDenormalizeUnsigned=(t,n)=>this._webRtcController.requestUnquantizedAndDenormalizeUnsigned(t,n),this._activateOnScreenKeyboard=t=>this.onScreenKeyboardHelper.showOnScreenKeyboard(t),this._webXrController=new za(this._webRtcController)}get videoElementParent(){return this._videoElementParent||(this._videoElementParent=document.createElement("div"),this._videoElementParent.id="videoElementParent"),this._videoElementParent}configureSettings(){this.config._addOnSettingChangedListener(U.IsQualityController,A=>{A!==!0||this._webRtcController.isQualityController||this._webRtcController.sendRequestQualityControlOwnership()}),this.config._addOnSettingChangedListener(U.AFKDetection,A=>{this._webRtcController.setAfkEnabled(A)}),this.config._addOnSettingChangedListener(U.MatchViewportResolution,()=>{this._webRtcController.videoPlayer.updateVideoStreamSize()}),this.config._addOnSettingChangedListener(U.HoveringMouseMode,A=>{this.config.setFlagLabel(U.HoveringMouseMode,`Control Scheme: ${A?"Hovering":"Locked"} Mouse`),this._webRtcController.setMouseInputEnabled(this.config.isFlagEnabled(U.MouseInput))}),this.config._addOnSettingChangedListener(U.KeyboardInput,A=>{this._webRtcController.setKeyboardInputEnabled(A)}),this.config._addOnSettingChangedListener(U.MouseInput,A=>{this._webRtcController.setMouseInputEnabled(A)}),this.config._addOnSettingChangedListener(U.TouchInput,A=>{this._webRtcController.setTouchInputEnabled(A)}),this.config._addOnSettingChangedListener(U.GamepadInput,A=>{this._webRtcController.setGamePadInputEnabled(A)}),this.config._addOnNumericSettingChangedListener(D.MinQP,A=>{u.Log(u.GetStackTrace(),"-------- Sending MinQP --------",7),this._webRtcController.sendEncoderMinQP(A),u.Log(u.GetStackTrace(),"-------------------------------------------",7)}),this.config._addOnNumericSettingChangedListener(D.MaxQP,A=>{u.Log(u.GetStackTrace(),"-------- Sending encoder settings --------",7),this._webRtcController.sendEncoderMaxQP(A),u.Log(u.GetStackTrace(),"-------------------------------------------",7)}),this.config._addOnNumericSettingChangedListener(D.WebRTCMinBitrate,A=>{u.Log(u.GetStackTrace(),"-------- Sending web rtc settings --------",7),this._webRtcController.sendWebRTCMinBitrate(1e3*A),u.Log(u.GetStackTrace(),"-------------------------------------------",7)}),this.config._addOnNumericSettingChangedListener(D.WebRTCMaxBitrate,A=>{u.Log(u.GetStackTrace(),"-------- Sending web rtc settings --------",7),this._webRtcController.sendWebRTCMaxBitrate(1e3*A),u.Log(u.GetStackTrace(),"-------------------------------------------",7)}),this.config._addOnNumericSettingChangedListener(D.WebRTCFPS,A=>{u.Log(u.GetStackTrace(),"-------- Sending web rtc settings --------",7),this._webRtcController.sendWebRTCFps(A),u.Log(u.GetStackTrace(),"-------------------------------------------",7)}),this.config._addOnOptionSettingChangedListener(V.PreferredCodec,A=>{this._webRtcController&&this._webRtcController.setPreferredCodec(A)}),this.config._registerOnChangeEvents(this._eventEmitter)}_activateOnScreenKeyboard(A){throw new Error("Method not implemented.")}_onInputControlOwnership(A){this._inputController=A}setWebRtcPlayerController(A){this._webRtcController=A,this._webRtcController.setPreferredCodec(this.config.getSettingOption(V.PreferredCodec).selected),this._webRtcController.resizePlayerStyle(),this.checkForAutoConnect()}connect(){this._eventEmitter.dispatchEvent(new Ba),this._webRtcController.connectToSignallingServer()}reconnect(){this._eventEmitter.dispatchEvent(new wa),this._webRtcController.restartStreamAutomatically()}disconnect(){this._eventEmitter.dispatchEvent(new fa),this._webRtcController.close()}play(){this._onStreamLoading(),this._webRtcController.playStream()}checkForAutoConnect(){this.config.isFlagEnabled(U.AutoConnect)&&(this._onWebRtcAutoConnect(),this._webRtcController.connectToSignallingServer())}_onWebRtcAutoConnect(){this._eventEmitter.dispatchEvent(new sa),this._showActionOrErrorOnDisconnect=!0}_onWebRtcSdp(){this._eventEmitter.dispatchEvent(new na)}_onStreamLoading(){this._eventEmitter.dispatchEvent(new ga)}_onDisconnect(A){this._webRtcController.getDisconnectMessageOverride()!=""&&this._webRtcController.getDisconnectMessageOverride()!==void 0&&this._webRtcController.getDisconnectMessageOverride()!=null&&(A=this._webRtcController.getDisconnectMessageOverride(),this._webRtcController.setDisconnectMessageOverride("")),this._eventEmitter.dispatchEvent(new la({eventString:A,showActionOrErrorOnDisconnect:this._showActionOrErrorOnDisconnect})),this._showActionOrErrorOnDisconnect==0&&(this._showActionOrErrorOnDisconnect=!0)}_onWebRtcConnecting(){this._eventEmitter.dispatchEvent(new ia)}_onWebRtcConnected(){this._eventEmitter.dispatchEvent(new oa)}_onWebRtcFailed(){this._eventEmitter.dispatchEvent(new aa)}_onVideoInitialized(){this._eventEmitter.dispatchEvent(new ha),this._videoStartTime=Date.now()}_onLatencyTestResult(A){this._eventEmitter.dispatchEvent(new Ua({latencyTimings:A}))}_onVideoStats(A){this._videoStartTime&&this._videoStartTime!==void 0||(this._videoStartTime=Date.now()),A.handleSessionStatistics(this._videoStartTime,this._inputController,this._webRtcController.videoAvgQp),this._eventEmitter.dispatchEvent(new Fa({aggregatedStats:A}))}_onVideoEncoderAvgQP(A){this._eventEmitter.dispatchEvent(new ra({avgQP:A}))}_onInitialSettings(A){var e;this._eventEmitter.dispatchEvent(new Ea({settings:A})),A.PixelStreamingSettings&&(this.allowConsoleCommands=(e=A.PixelStreamingSettings.AllowPixelStreamingCommands)!==null&&e!==void 0&&e,this.allowConsoleCommands===!1&&u.Info(u.GetStackTrace(),"-AllowPixelStreamingCommands=false, sending arbitrary console commands from browser to UE is disabled."));const t=this.config.useUrlParams,n=new URLSearchParams(window.location.search);A.EncoderSettings&&(this.config.setNumericSetting(D.MinQP,t&&n.has(D.MinQP)?Number.parseInt(n.get(D.MinQP)):A.EncoderSettings.MinQP),this.config.setNumericSetting(D.MaxQP,t&&n.has(D.MaxQP)?Number.parseInt(n.get(D.MaxQP)):A.EncoderSettings.MaxQP)),A.WebRTCSettings&&(this.config.setNumericSetting(D.WebRTCMinBitrate,t&&n.has(D.WebRTCMinBitrate)?Number.parseInt(n.get(D.WebRTCMinBitrate)):A.WebRTCSettings.MinBitrate/1e3),this.config.setNumericSetting(D.WebRTCMaxBitrate,t&&n.has(D.WebRTCMaxBitrate)?Number.parseInt(n.get(D.WebRTCMaxBitrate)):A.WebRTCSettings.MaxBitrate/1e3),this.config.setNumericSetting(D.WebRTCFPS,t&&n.has(D.WebRTCFPS)?Number.parseInt(n.get(D.WebRTCFPS)):A.WebRTCSettings.FPS))}_onQualityControlOwnership(A){this.config.setFlagEnabled(U.IsQualityController,A)}_onPlayerCount(A){this._eventEmitter.dispatchEvent(new Sa({count:A}))}requestLatencyTest(){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.sendLatencyTest(),!0)}requestShowFps(){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.sendShowFps(),!0)}requestIframe(){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.sendIframeRequest(),!0)}emitUIInteraction(A){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.emitUIInteraction(A),!0)}emitCommand(A){return!(!this._webRtcController.videoPlayer.isVideoReady()||!this.allowConsoleCommands&&"ConsoleCommand"in A||(this._webRtcController.emitCommand(A),0))}emitConsoleCommand(A){return!(!this.allowConsoleCommands||!this._webRtcController.videoPlayer.isVideoReady()||(this._webRtcController.emitConsoleCommand(A),0))}addResponseEventListener(A,e){this._webRtcController.responseController.addResponseEventListener(A,e)}removeResponseEventListener(A){this._webRtcController.responseController.removeResponseEventListener(A)}dispatchEvent(A){return this._eventEmitter.dispatchEvent(A)}addEventListener(A,e){this._eventEmitter.addEventListener(A,e)}removeEventListener(A,e){this._eventEmitter.removeEventListener(A,e)}toggleXR(){this.webXrController.xrClicked()}setSignallingUrlBuilder(A){this._webRtcController.signallingUrlBuilder=A}get webSocketController(){return this._webRtcController.webSocketController}get webXrController(){return this._webXrController}}H.Dz,H.g$,H.Lt,H.Q9,H.qf,H.hV,H.z$,H.J0;var Ya=H.De;H.$C,H.al,H._W,H.tz,H.Nu,H.zg,H.vp;var pe=H.vU;H.wF,H.rv,H.Nh,H.ss,H.qW,H.QL,H.cf,H.eM;var $a=H.Yd;H.iM,H.qy,H.ce;var Za=H.sK;H.Ok,H.q5;var qa=H.g;H.xl,H.I,H.bx,H.dD,H.Ib,H.Az,H.Iw,H.qY,H.db,H.mR,H.Tn,H.rV,H.gh,H.Mi,H.j,H.YB,H.i5;var eu=H.x_;H.Am,H.eR,H.r8,H.u3,H.vd,H.iV,H.jZ,H.SW,H.ZH,H.Ni,H.lh,H.bq,H.$f,H.eu,H.Ax,H.Mc;const tu={Response:1},Ur={UIInteraction:50,MouseWheel:75};class ru extends w.HasOwner{constructor(e,t){super(e);C(this,"_processResponseFn",e=>this.esUeViewer.processResponse(e));C(this,"_inner");this._uri=t,this._inner=new WebSocket(this._uri),this.d(()=>{this._inner.close()}),this._innerInit()}get esUeViewer(){return this.owner}get uri(){return this._uri}get inner(){return this._inner}_innerInit(){this.inner.onmessage=e=>{if(this.isDestroyed())return;let t=new FileReader;t.onload=n=>{if(this.isDestroyed())return;let s=n.target.result,i=new Uint32Array(s),o=0;if(i[0]===tu.Response){o+=4;let a=i[o/4];o+=4;for(let l=0;l<a;l++){let c=i[o/4];o+=4;let h=new TextDecoder("utf-8").decode(s.slice(o,o+c));o+=c,this._processResponseFn(h)}}},t.readAsArrayBuffer(e.data)},this.inner.onopen=()=>{this.isDestroyed()||(console.warn("earthsdk message websocket server connected:",this.uri),console.log("%c[EarthSDK websocket open]","background: #a6ec99; color: black","open"),this.owner.dispatchEvent(new CustomEvent("esmsgwsopen",{detail:"websocket open"})))},this._inner.onclose=e=>{this.isDestroyed()||(console.log("%c[EarthSDK websocket close ]","background: red; color: black","error"),this.owner.dispatchEvent(new CustomEvent("error",{detail:"websocket close"})))},this._inner.onerror=e=>{this.isDestroyed()||(console.log("%c[EarthSDK websocket error ]","background: red; color: black","error"),this.owner.dispatchEvent(new CustomEvent("error",{detail:"websocket error"})))}}sendInputData(e){const t=this.inner;if(t.readyState!==WebSocket.OPEN)return;const s=new Uint8Array(e)[0];if(s>=Ur.UIInteraction&&s<=Ur.MouseWheel){const i=new ArrayBuffer(e.byteLength+4);return new DataView(i).setUint32(0,e.byteLength,!0),new Uint8Array(i,4).set(new Uint8Array(e)),t.send(new DataView(i)),!0}else return!1}emitDescriptorWithString(e,t){let n=new TextEncoder().encode(t),s=new DataView(new ArrayBuffer(3+n.length)),i=0;s.setUint8(i,e),i++,s.setUint16(i,n.length,!0),i+=2;for(let o=0;o<n.length;o++)s.setUint8(i,n[o]),i+=1;try{this.sendInputData(s.buffer)}catch(o){console.error(`data.buffer.size: ${s.buffer.byteLength} 独立通道 sendInputData error: ${o}`,o)}}destroyImpl(){this._inner&&this._inner.close()}}window.g_emitDescriptor_maxBytes=3e4;let nu=-1;$a.SetLoggerVerbosity(1);class su extends w.Destroyable{constructor(e,t){super();C(this,"_eventTarget",new EventTarget);C(this,"debug",!1);C(this,"uiInteractionCallbacks",new Map);C(this,"_pixelStream");C(this,"_esMsgWsWrapper");this._domOrDomId=e,this._options=t;const n=typeof this._domOrDomId=="string"?document.getElementById(this._domOrDomId):this._domOrDomId;if(!n)throw new Error(`ESUEViewer container${this._domOrDomId} error!`);console.log(`PSUEViewer init _options ${this._options}`);const{url:s,esmsgWsUri:i}=this._options;this._pixelStream=this._initPixelStream(n,s),this.d(()=>{this._pixelStream.disconnect()}),this._handerPixelStreamEvent(),this._esMsgWsWrapper=this._initEsMsgWsWrapper(i);const o=this;if(o.esMsgWsWrapper){const a=o.webRtcController.sendMessageController.dataChannelSender.sendData;o.webRtcController.sendMessageController.dataChannelSender.constructor.prototype.sendData=function(l){o.esMsgWsWrapper?o.esMsgWsWrapper.sendInputData(l):a.call(this,l)}}}get eventTarget(){return this._eventTarget}addEventListener(e,t,n){return this.eventTarget.addEventListener(e,t,n)}removeEventListener(e,t,n){return this.eventTarget.removeEventListener(e,t,n)}dispatchEvent(e){return this.eventTarget.dispatchEvent(e)}_initPixelStream(e,t){const n=new Ya({initialSettings:{AutoPlayVideo:!0,AutoConnect:!0,StartVideoMuted:!1,SuppressBrowserKeys:!1,[eu.SignallingServerUrl]:t}});return n.setFlagEnabled(pe.BrowserSendOffer,!1),n.setFlagEnabled(pe.HoveringMouseMode,!0),n.setFlagEnabled(pe.MatchViewportResolution,!0),n.setNumericSetting(Za.MaxReconnectAttempts,0),new qa(n,{videoElementParent:e})}get pixelStream(){return this._pixelStream}_initEsMsgWsWrapper(e){return e?this.dv(new ru(this,e)):void 0}get esMsgWsWrapper(){return this._esMsgWsWrapper}get esWebSocketReady(){var e;return((e=this.esMsgWsWrapper)==null?void 0:e.inner.readyState)===1}_handerPixelStreamEvent(){this.pixelStream.addEventListener("videoInitialized",()=>{console.log("%c[EarthSDK webrtc videoInitialized]","background: #a6ec99; color: black","videoInitialized"),this.dispatchEvent(new CustomEvent("videoinited",{detail:"videoinited"}))}),this.pixelStream.addEventListener("webRtcFailed",()=>{this.isDestroyed()||(console.log("%c[EarthSDK webRtc webRtcFailed]","background: red; color: black","webRtcFailed"),this.dispatchEvent(new CustomEvent("error",{detail:"webRtcFailed"})),this.pixelStream.disconnect())}),this.pixelStream.addEventListener("webRtcDisconnected",()=>{this.isDestroyed()||(console.log("%c[EarthSDK webRtc webRtcDisconnected]","background: red; color: black","webRtcDisconnected"),this.dispatchEvent(new CustomEvent("error",{detail:"webRtcDisconnected"})),this.pixelStream.disconnect())}),this.pixelStream.addEventListener("webRtcConnected",()=>{this.isDestroyed()||(console.log("%c[EarthSDK webrtc webRtcConnected]","background: #a6ec99; color: black","webRtcConnected"),this.dispatchEvent(new CustomEvent("webRtcConnected",{detail:"webRtcConnected"})))}),this.pixelStream.addResponseEventListener("esueviewer",e=>{this.processResponse(e)})}resolveCallback(e){let t={};try{t=JSON.parse(e)}catch{return!1}let n=t.callid;if(typeof n!="string"||!this.uiInteractionCallbacks.has(n))return!1;let s=this.uiInteractionCallbacks.get(n);return typeof s!="function"?!1:(s(t),this.uiInteractionCallbacks.delete(n),!0)}processResponse(e){if(this.debug??!1)try{const t=JSON.parse(e);if(t.ers=t.ers&&t.ers.filter(n=>n.et!=="mouseMoveEvent"),!(t.ers&&t.ers.length>0||t.frs&&t.frs.length>0))return;console.group("%cUE => JS"," background-color:#006EFF;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(t,void 0,"")}`," border:1px dashed #006EFF;border-radius:5px;padding:10px;line-height:25px;color:#006EFF;"),console.groupEnd()}catch(t){console.error(`processResponse(${e}) error: ${t}`,t)}this.resolveCallback(e)||this.dispatchEvent(new CustomEvent("ueevent",{detail:e}))}emitUIInteraction(e,t){typeof t=="function"&&(e.callid=w.createGuid(),this.uiInteractionCallbacks.set(e.callid,t)),this.pixelStream.emitUIInteraction(e)}get webRtcController(){return this.pixelStream._webRtcController}emitUIInteractionForBigData(e,t){typeof t=="function"&&(e.callid=w.createGuid(),this.uiInteractionCallbacks.set(e.callid,t));const n=JSON.stringify(e),s=window.g_emitDescriptor_maxBytes,i=n.length,o=++nu;if(this.esMsgWsWrapper){if(i<s){this.esMsgWsWrapper.emitDescriptorWithString(Ur.UIInteraction,`${o}-0/1-`+n);return}const a=Math.ceil(i/s)|0;[...new Array(a).keys()].map(c=>n.slice(c*s,(c+1)*s)).forEach((c,h)=>{this.esMsgWsWrapper&&this.esMsgWsWrapper.emitDescriptorWithString(Ur.UIInteraction,`${o}-${h}/${a}-`+c)})}}emitCommand(e){this.pixelStream.emitCommand(e)}getVideoSize(){const e=this.webRtcController.videoPlayer.getVideoElement();return{width:e.videoWidth,height:e.videoHeight}}resizeUEVideo(e,t){let n={Resolution:{Width:e,Height:t}};console.log(`resizeUEVideo emitCommand ${e} ${t} begin`),this.emitCommand(n)}}class iu extends w.Destroyable{constructor(e,t,n){super();C(this,"_instance");C(this,"_event",this.dv(new w.Event));this._container=e,this._wsuri=t,this._esmsgWsUri=n,this._instance=this.dv(new su(this._container,{url:this._wsuri,esmsgWsUri:this._esmsgWsUri})),this.instanceInit()}get webSocketReady(){return this._instance.esWebSocketReady}get event(){return this._event}get debug(){return this._instance.debug}set debug(e){this._instance.debug=e}instanceInit(){if("addEventListener"in this._instance){["esmsgwsopen","error","videoinited","ueevent","webRtcConnected"].forEach(t=>{const n=s=>{this._event.emit(t,s.detail)};this._instance.addEventListener(t,n),this.dispose(()=>this._instance.removeEventListener(t,n))});return}this.dispose(this._instance.errorEvent.disposableOn(e=>{this._event.emit("error",e.detail)})),this.dispose(this._instance.webRtcConnectedEvent.disposableOn(e=>{this._event.emit("webRtcConnected",e.detail)})),this.dispose(this._instance.videoinitedEvent.disposableOn(e=>{this._event.emit("videoinited",e.detail)})),this.dispose(this._instance.ueevent.disposableOn(e=>{this._event.emit("ueevent",e.detail)}))}emitUIInteractionForBigData(e,t){return new Promise((n,s)=>{const i=(...o)=>{n(o),t&&t(...o)};try{this._instance.emitUIInteractionForBigData(e,i)}catch(o){console.warn(`emitUIInteraction发生错误:${o}`),s(o)}})}getVideoSize(){return this._instance.getVideoSize()}resize(e,t){this._instance.resizeUEVideo(e,t)}}class ou extends Ve{constructor(e,t,n,s){super();C(this,"_esueViewerWrapper");C(this,"_ueFuncResultWithIdsEvent",this.dv(new w.Event));C(this,"_ueFuncWithIdAndResultCallbacks",[]);C(this,"_waitingUeFuncIdAndResultCallbacks",new Map);C(this,"_waitingUeCalls",new Set);C(this,"_ueEvent",this.dv(new w.Event));C(this,"_errorEvent",this.dv(new w.Event));C(this,"_readyEvent",this.dv(new w.Event));C(this,"_esmsgwsopen",this.dv(w.react(!1)));C(this,"_videoinited",this.dv(w.react(!1)));C(this,"_webRtcConnected",this.dv(w.react(!1)));this._ueViewer=s,console.log("CSTMPSViewer init ! 以官方像素流 + 独立通信的模式启动!");const i=this._ueViewer;this._esueViewerWrapper=this.dv(new iu(e,t,n));const o=this._esueViewerWrapper;{const B=()=>o.debug=i.debug??!1;B(),this.d(i.debugChanged.don(B))}let a=!1;{const B=()=>{if(a)return;const g=o.webSocketReady;if(this.videoinited&&this.webRtcConnected&&g){console.log("%c[EarthSDK: esmsgWebSocket && videoinited && webRtcConnected]","background: #a6ec99; color: black");const f={eventType:"init",params:{}};o.emitUIInteractionForBigData(f),this._readyEvent.emit(),a=!0}};this.d(this.videoinitedChanged.don(()=>{B()})),this.d(this.webRtcConnectedChanged.don(()=>{B()})),this.d(this.esmsgwsopenChanged.don(()=>{B()}))}this.d(o.event.don((B,g)=>{if(B==="error")this._errorEvent.emit(g);else if(B==="ueevent"){const f=JSON.parse(g);if(f.t==="cr"){const m=f;if(m.frs&&this._ueFuncResultWithIdsEvent.emit(m.frs),m.ers)for(let F of m.ers)this._ueEvent.emit(F)}}else B==="webRtcConnected"?this.webRtcConnected=!0:B==="videoinited"?this.videoinited=!0:B==="esmsgwsopen"&&(this.esmsgwsopen=!0)}));{const B=this.dv(w.createAnimateFrame());let g,f;B.start(()=>{if(g!==e.offsetWidth||f!==e.offsetHeight){if(g=e.offsetWidth,f=e.offsetHeight,g===void 0||f===void 0||!Number.isFinite(g)||!Number.isFinite(f)||g<0||f<0){console.warn(`lastWidth === undefined || lastHeight === undefined || !Number.isFinite(lastWidth) || !Number.isFinite(lastHeight) || lastWidth < 0 || lastHeight < 0 ${g} ${f}`);return}o.resize(g,f),console.log(`resize: ${g} ${f}`)}})}this.d(this._ueFuncResultWithIdsEvent.don(B=>{for(const g of B){const f=this._waitingUeFuncIdAndResultCallbacks.get(g.fid);f&&(this._waitingUeFuncIdAndResultCallbacks.delete(g.fid),f.resultCallback(g.r))}}));let l=0;const c=B=>{const g={n:l++,tt:Date.now(),t:"c",fs:B};this._waitingUeCalls.add(g),i.debug&&(console.group("%cxe2 => ue"," background-color:green;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(g,void 0,"")}`," border:1px dashed green;border-radius:5px;padding:10px;line-height:25px;color:green;"),console.groupEnd()),this._esueViewerWrapper.emitUIInteractionForBigData(g,()=>{this._waitingUeCalls.delete(g)})},h=()=>{if(!a||this._ueFuncWithIdAndResultCallbacks.length===0)return;const B=this._ueFuncWithIdAndResultCallbacks.map(([g])=>g);for(const[g,f]of this._ueFuncWithIdAndResultCallbacks)this._waitingUeFuncIdAndResultCallbacks.set(g.fid,f);this._ueFuncWithIdAndResultCallbacks.length=0;{const g=window.g_emitDescriptor_maxBytes,f=B.map(L=>({f:L,s:JSON.stringify(L).length}));let m=f.length,F=0,Q=0,y=[];do{do{const{f:L,s:T}=f[F];if(y.push(L),++F,Q+T>g||y.length>=20)break}while(F<m);y.length>0&&(i.debug&&console.log(`传送${y.length}条消息...`),c([...y]),y.length=0,Q=0)}while(F<m)}};this.dv(w.createInterval()).start(h,50),this.d(()=>console.log("UeCloudViewer正在销毁..."))}get esueViewerWrapper(){return this._esueViewerWrapper}get errorEvent(){return this._errorEvent}get readyEvent(){return this._readyEvent}get esmsgwsopen(){return this._esmsgwsopen.value}set esmsgwsopen(e){this._esmsgwsopen.value=e}get esmsgwsopenChanged(){return this._esmsgwsopen.changed}get videoinited(){return this._videoinited.value}set videoinited(e){this._videoinited.value=e}get videoinitedChanged(){return this._videoinited.changed}get webRtcConnected(){return this._webRtcConnected.value}set webRtcConnected(e){this._webRtcConnected.value=e}get webRtcConnectedChanged(){return this._webRtcConnected.changed}resize(e,t){this.esueViewerWrapper.resize(e,t)}callUeFunc(e){return new Promise(t=>{const s={fid:w.createGuid(),...e};this._ueFuncWithIdAndResultCallbacks.push([s,{timeStamp:Date.now(),ueFunc:e,resultCallback:t}])})}disposableOnUeEvent(e,t){(this._ueViewer.debug??!1)&&console.log(`disposableOnUeEvent from UeCloudViewer, type:${e}`);const n=w.createGuid();this.callUeFunc({f:"addEventListener",p:{et:e,eid:n}});const s=()=>{this.callUeFunc({f:"removeEventListener",p:{eid:n}})},i=this._ueEvent.don(o=>{o.et===e&&o.eid===n&&t(o)});return()=>{i(),s()}}}function au(r){let A="";const e=new Uint8Array(r),t=e.length;for(let n=0;n<t;n++)A+=String.fromCharCode(e[n]);return btoa(A)}const lu=r=>{const A={type:"input",inputdata:au(r)};return JSON.stringify(A)};function cu(r){return typeof r=="string"?document.getElementById(r):r}window.g_emitDescriptor_maxBytes=3e4,console.log("全局可设置消息体最大字节, window.g_emitDescriptor_maxBytes 默认 30000 。");let du=-1;$a.SetLoggerVerbosity(1);class uu extends w.Destroyable{constructor(e,t){super();C(this,"debug",!1);C(this,"_error",this.dv(new w.Event));C(this,"_connected",this.dv(new w.Event));C(this,"_ueevent",this.dv(new w.Event));C(this,"_pixelStream");C(this,"uiInteractionCallbacks",new Map);this._container=e,this._option=t;const n=new Ya({initialSettings:{HoveringMouse:!0,AutoPlayVideo:!0,AutoConnect:!0,StartVideoMuted:!1,SuppressBrowserKeys:!1,ss:this._option.ws},useUrlParams:!0});n.setFlagEnabled(pe.BrowserSendOffer,!1),n.setFlagEnabled(pe.HoveringMouseMode,!0),n.setFlagEnabled(pe.MatchViewportResolution,!0),n.setNumericSetting(Za.MaxReconnectAttempts,0),this._pixelStream=new qa(n,{videoElementParent:this.container}),this.d(()=>{this._pixelStream.disconnect()});{const s=this.pixelStream.webSocketController.webSocket,i=this._pixelStream._webRtcController.sendMessageController.dataChannelSender.sendData;this._pixelStream._webRtcController.sendMessageController.dataChannelSender.constructor.prototype.sendData=function(o){s?s.send(lu(o)):i.call(this,o)}}{const s=i=>{const o=this._pixelStream._webRtcController.mouseController;setTimeout(()=>{const a=o.coordinateConverter.normalizeAndQuantizeUnsigned(i.offsetX,i.offsetY),c=o.toStreamerMessagesProvider.toStreamerHandlers.get("MouseUp");c&&c([i.button,a.x,a.y]),i.preventDefault()})};this.container.addEventListener("dblclick",s),this.d(()=>{this.container.removeEventListener("dblclick",s)})}["error","close","open"].forEach(i=>{const o=()=>{this.isDestroyed()||(i==="open"?this.connected.emit("webSocketOpen"):i==="close"?this.error.emit("webSocketClose"):i==="error"&&this.error.emit("webSocketError"))};this.pixelStream.webSocketController.webSocket.addEventListener(i,o),this.d(()=>{this.pixelStream.webSocketController.webSocket.removeEventListener(i,o)})}),["videoInitialized","webRtcConnected","webRtcDisconnected","webRtcFailed"].forEach(i=>{const o=()=>{this.isDestroyed()||(i==="webRtcConnected"||i==="videoInitialized"?this.connected.emit(i):(i==="webRtcDisconnected"||i==="webRtcFailed")&&(this.error.emit(i),this.pixelStream.disconnect()))};this.pixelStream.addEventListener(i,o),this.d(()=>{this.pixelStream.removeEventListener(i,o)})}),this.pixelStream.addResponseEventListener("handle_responses",s=>{this.processResponse(s)}),this.d(()=>{this.pixelStream.removeResponseEventListener("handle_responses")})}get error(){return this._error}get connected(){return this._connected}get ueevent(){return this._ueevent}get container(){return cu(this._container)}get pixelStream(){return this._pixelStream}get webSocketReady(){return this.pixelStream.webSocketController.webSocket.readyState===1}processResponse(e){if(this.debug??!1)try{const t=JSON.parse(e);console.group("%cUE => JS"," background-color:#006EFF;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(t,void 0,"")}`," border:1px dashed #006EFF;border-radius:5px;padding:10px;line-height:25px;color:#006EFF;"),console.groupEnd()}catch(t){console.error(`processResponse(${e}) error: ${t}`,t)}this.resolveCallback(e)||this.ueevent.emit(e)}emitUIInteractionForBigData(e,t){typeof t=="function"&&(e.callid=w.createGuid(),this.uiInteractionCallbacks.set(e.callid,t));const n=JSON.stringify(e),s=window.g_emitDescriptor_maxBytes??3e4,i=n.length,o=++du;if(i<s){const c={type:"earthsdk",time:new Date().getTime(),params:`${o}-0/1-`+n};this.sendData(JSON.stringify(c));return}const a=Math.ceil(i/s)|0;[...new Array(a).keys()].map(c=>n.slice(c*s,(c+1)*s)).forEach((c,h)=>{const d={type:"earthsdk",time:new Date().getTime(),params:`${o}-${h}/${a}-`+c};this.sendData(JSON.stringify(d))})}sendData(e){this.pixelStream.webSocketController.webSocket.send(e)}resolveCallback(e){let t={};try{t=JSON.parse(e)}catch{return!1}let n=t.callid;if(typeof n!="string"||!this.uiInteractionCallbacks.has(n))return!1;let s=this.uiInteractionCallbacks.get(n);return typeof s!="function"?!1:(s(t),this.uiInteractionCallbacks.delete(n),!0)}getVideoSize(){const e=this._pixelStream._webRtcController.videoPlayer.getVideoElement();return{width:e.videoWidth,height:e.videoHeight}}emitCommand(e){this.pixelStream.emitCommand(e)}emitUIInteraction(){console.log("emitUIInteraction 像素流初始化"),this.pixelStream.emitUIInteraction("像素流初始化")}resizeUEVideo(e,t){const n={Resolution:{Width:e,Height:t}};console.log(`resizeUEVideo emitCommand ${e} ${t} begin`),this.emitCommand(n)}}class hu extends w.Destroyable{constructor(e,t,n){super();C(this,"_instance");C(this,"_event",this.dv(new w.Event));this._container=e,this._wsuri=t,this._esmsgWsUri=n,this._instance=this.dv(new uu(this._container,{ws:this._wsuri})),this.d(this._instance.connected.don(s=>{this._event.emit(s,s),console.log(`%c[EarthSDK] ${s}`,"background: #a6ec99; color: black")})),this.d(this._instance.error.don(s=>{this._event.emit("errorEvent",s),console.log(`%c[EarthSDK] ${s}`,"background: red; color: black")})),this.d(this._instance.ueevent.don(s=>{this._event.emit("ueevent",s)}))}get instance(){return this._instance}get event(){return this._event}get debug(){return this._instance.debug}set debug(e){this._instance.debug=e}emitUIInteractionForBigData(e,t){return new Promise((n,s)=>{const i=(...o)=>{n(o),t&&t(...o)};try{this._instance.emitUIInteractionForBigData(e,i)}catch(o){console.warn(`emitUIInteraction发生错误:${o}`),s(o)}})}getVideoSize(){return this._instance.getVideoSize()}resize(e,t){this._instance.resizeUEVideo(e,t)}}class gu extends Ve{constructor(e,t,n,s){super();C(this,"_videoInitialized",this.dv(w.react(!1)));C(this,"_webRtcConnected",this.dv(w.react(!1)));C(this,"_webSocketOpen",this.dv(w.react(!1)));C(this,"_ue5ViewerWrapper");C(this,"_ueFuncResultWithIdsEvent",this.dv(new w.Event));C(this,"_ueFuncWithIdAndResultCallbacks",[]);C(this,"_waitingUeFuncIdAndResultCallbacks",new Map);C(this,"_waitingUeCalls",new Set);C(this,"_ueEvent",this.dv(new w.Event));C(this,"_errorEvent",this.dv(new w.Event));C(this,"_readyEvent",this.dv(new w.Event));this._ueViewer=s,console.log("INNPSViewer init ! 以内置信令服务器模式启动!");const i=this._ueViewer,o=this.dv(new hu(e,t,n));this._ue5ViewerWrapper=o;{const d=()=>o.debug=i.debug??!1;d(),this.d(i.debugChanged.don(d))}{let d=!1;const B=this.dv(w.createNextAnimateFrameEvent(this._videoInitialized.changed,this._webRtcConnected.changed,this._webSocketOpen.changed));this.d(B.don(()=>{if(d)return;const g=this._ue5ViewerWrapper.instance.webSocketReady;if(this.videoInitialized&&this.webRtcConnected&&g){this._ue5ViewerWrapper.instance.emitUIInteraction(),this._readyEvent.emit(),d=!0,console.log("%c[EarthSDK videoInitialized && webRtcConnected && webSocketReady]","background: #a6ec99; color: black");const f={eventType:"init",params:{}};this._ue5ViewerWrapper.emitUIInteractionForBigData(f)}else console.warn("webSocketReady",g),d=!1}))}this.d(o.event.don((d,B)=>{if(d==="errorEvent")this._errorEvent.emit(B);else if(d==="videoInitialized")this._videoInitialized.value=!0;else if(d==="webRtcConnected")this._webRtcConnected.value=!0;else if(d==="webSocketOpen")this._webSocketOpen.value=!0;else if(d==="ueevent"){const g=JSON.parse(B);if(g.t==="cr"){const f=g;if(f.frs&&this._ueFuncResultWithIdsEvent.emit(f.frs),f.ers)for(let m of f.ers)this._ueEvent.emit(m)}}}));{const d=this.dv(w.createAnimateFrame());let B,g,f;d.start(()=>{if(B!==e.offsetWidth||g!==e.offsetHeight||f!==i.resolutionScale){if(B=e.offsetWidth,g=e.offsetHeight,B===void 0||g===void 0||!Number.isFinite(B)||!Number.isFinite(g)||B<0||g<0){console.warn(`lastWidth === undefined || lastHeight === undefined || !Number.isFinite(lastWidth) || !Number.isFinite(lastHeight) || lastWidth < 0 || lastHeight < 0 ${B} ${g}`);return}f=i.resolutionScale,o.resize(B/f,g/f)}})}this.d(this._ueFuncResultWithIdsEvent.don(d=>{for(const B of d){const g=this._waitingUeFuncIdAndResultCallbacks.get(B.fid);g&&(this._waitingUeFuncIdAndResultCallbacks.delete(B.fid),g.resultCallback(B.r))}}));let a=0;const l=d=>{const B={n:a++,tt:Date.now(),t:"c",fs:d};this._waitingUeCalls.add(B),i.debug&&(console.group("%cxe2 => ue"," background-color:green;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(B,void 0,"")}`," border:1px dashed green;border-radius:5px;padding:10px;line-height:25px;color:green;"),console.groupEnd()),this._ue5ViewerWrapper.emitUIInteractionForBigData(B,()=>{this._waitingUeCalls.delete(B)})},c=()=>{if(!this._ue5ViewerWrapper.instance.webSocketReady||this._ueFuncWithIdAndResultCallbacks.length===0)return;const B=this._ueFuncWithIdAndResultCallbacks.map(([g])=>g);for(const[g,f]of this._ueFuncWithIdAndResultCallbacks)this._waitingUeFuncIdAndResultCallbacks.set(g.fid,f);this._ueFuncWithIdAndResultCallbacks.length=0;{const g=window.g_emitDescriptor_maxBytes,f=B.map(L=>({f:L,s:JSON.stringify(L).length}));let m=f.length,F=0,Q=0,y=[];do{do{const{f:L,s:T}=f[F];if(y.push(L),++F,Q+T>g||y.length>=20)break}while(F<m);y.length>0&&(i.debug&&console.log(`传送${y.length}条消息...`),l([...y]),y.length=0,Q=0)}while(F<m)}};this.dv(w.createInterval()).start(c,50),this.d(()=>console.log("UeCloudViewer正在销毁..."))}get videoInitialized(){return this._videoInitialized.value}get webRtcConnected(){return this._webRtcConnected.value}get webSocketOpen(){return this._webSocketOpen.value}get ue5ViewerWrapper(){return this._ue5ViewerWrapper}get errorEvent(){return this._errorEvent}get readyEvent(){return this._readyEvent}resize(e,t){this.ue5ViewerWrapper.resize(e,t)}callUeFunc(e){return new Promise(t=>{const s={fid:w.createGuid(),...e};this._ueFuncWithIdAndResultCallbacks.push([s,{timeStamp:Date.now(),ueFunc:e,resultCallback:t}])})}disposableOnUeEvent(e,t){const n=w.createGuid();this.callUeFunc({f:"addEventListener",p:{et:e,eid:n}});const s=()=>{this.callUeFunc({f:"removeEventListener",p:{eid:n}})},i=this._ueEvent.don(o=>{o.et===e&&o.eid===n&&t(o)});return()=>{i(),s()}}}class Bu extends w.Destroyable{constructor(e,t,n,s){super();C(this,"_onRuntimeInitialized",this.dv(new w.Event));C(this,"_vIframe",null);this._ueViewer=s;const i=this._ueViewer;{const o=document.createElement("iframe");this._vIframe=o,o.style.cssText="width: 100%; height: 100%; margin: 0; padding: 0; border: none; outline: none;",e.appendChild(o),this.d(()=>{o&&e.removeChild(o)});const a=p.ESSceneObject.getStrFromEnv(n+`/web/${t}.html`);o.src=a,o.onload=()=>{const l=o.contentWindow;if(!l){console.error("iframeWindow is null");return}console.log("iwindow.Module",l.Module),l.Module.onRuntimeInitialized=()=>{this._onRuntimeInitialized.emit(),i.setStatus("Created"),i.setStatusLog("创建成功"),l.Module.UE4_resizeCanvas(),l.console.log("创建成功__________________________________________")}}}}get onRuntimeInitialized(){return this._onRuntimeInitialized}get vIframe(){return this._vIframe}}const ja=typeof TextDecoder<"u"?new TextDecoder:void 0,fu=(r,A=0,e=NaN)=>{const t=A+e;let n=A;for(;r[n]&&!(n>=t);)++n;if(n-A>16&&r.buffer&&ja)return ja.decode(r.subarray(A,n));let s="";for(;A<n;){var i=r[A++];if(!(i&128)){s+=String.fromCharCode(i);continue}var o=r[A++]&63;if((i&224)==192){s+=String.fromCharCode((i&31)<<6|o);continue}var a=r[A++]&63;if((i&240)==224?i=(i&15)<<12|o<<6|a:((i&248)!=240&&console.warn("Invalid UTF-8 leading byte encountered when deserializing a UTF-8 string in wasm memory to a JS string!"),i=(i&7)<<18|o<<12|a<<6|r[A++]&63),i<65536)s+=String.fromCharCode(i);else{var l=i-65536;s+=String.fromCharCode(55296|l>>10,56320|l&1023)}}return s};class wu extends w.Destroyable{constructor(A,e,t){super();{const n=()=>{const a=Qn(e);e.setGlobalProperty(a)};n();const s=mr(),i=[];s.forEach(a=>{const l=e[a+"Changed"];i.push(l)});const o=this.dv(w.createNextAnimateFrameEvent(...i));this.d(o.don(n))}this.d(e.propChanged.don(n=>{if(n.objId==="")try{Object.keys(n.props).forEach(s=>{const i=n.props[s]===null?void 0:n.props[s];e[s]=i})}catch(s){console.error("ueViewer propChanged:"+s)}})),e.useCustomInteraction=!1,this.dv(new p.ViewerCustomInteraction(e,A)),this.dv(new w.ObjResettingWithEvent(e.statusUpdateIntervalChanged,n=>{if((e.statusUpdateInterval??.5)===0)return;const i=new w.Destroyable;return i.d(t.disposableOnUeEvent("statusUpdate",o=>{e.statusUpdateEvent.emit(o)})),i})),this.dv(new w.ObjResettingWithEvent(e.propChangedListeningChanged,()=>{if(!(e.propChangedListening??!0))return;const s=new w.Destroyable;return s.d(t.disposableOnUeEvent("propChanged",i=>{e.propChanged.emit(i)})),s})),this.dv(new w.ObjResettingWithEvent(e.objectEventListeningChanged,()=>{if(!(e.objectEventListening??!0))return;const s=new w.Destroyable;return s.d(t.disposableOnUeEvent("objectEvent",i=>{e.objectEvent.emit(i)})),s})),this.dv(new w.ObjResettingWithEvent(e.widgetEventListeningChanged,()=>{if(!(e.widgetEventListening??!0))return;const s=new w.Destroyable;return s.d(t.disposableOnUeEvent("widgetEvent",i=>{e.widgetEvent.emit(i)})),s})),this.dv(new w.ObjResettingWithEvent(e.speechRecognitionListeningChanged,()=>{if(!(e.speechRecognitionListening??!0))return;const s=new w.Destroyable;return s.d(t.disposableOnUeEvent("speechRecognition",i=>{e.speechRecognition.emit(i)})),s})),this.dv(new w.ObjResettingWithEvent(e.customMessageListeningChanged,()=>{if(!(e.customMessageListening??!0))return;const s=new w.Destroyable;return s.d(t.disposableOnUeEvent("customMessage",i=>{e.customMessage.emit(i)})),s})),this.dv(new w.ObjResettingWithEvent(e.editingEventListeningChanged,()=>{if(!(e.editingEventListening??!0))return;const s=new w.Destroyable;return s.d(t.disposableOnUeEvent("editingEvent",i=>{i.objectIDs=i.objectIDs.map(o=>{var a;return((a=p.ESSceneObject.getSceneObjById(o))==null?void 0:a.parentID)??o}),e.editingEvent.emit(i)})),s}))}}let pu=-1;class Cu extends Ve{constructor(e,t,n="${earthsdk3-ue-h5-assets-script-dir}",s){super();C(this,"_ueFuncResultWithIdsEvent",this.dv(new w.Event));C(this,"_ueFuncWithIdAndResultCallbacks",[]);C(this,"_waitingUeFuncIdAndResultCallbacks",new Map);C(this,"_waitingUeCalls",new Map);C(this,"_ueEvent",this.dv(new w.Event));this._ueViewer=s;const i=this._ueViewer,o=this.dv(new Bu(e,t,n,i));let a=!1,l=null;this.d(o.onRuntimeInitialized.don(()=>{var B;if(a=!0,(B=o==null?void 0:o.vIframe)!=null&&B.contentWindow){l=o.vIframe.contentWindow;const g=o.vIframe.contentWindow.document.getElementById("mainarea");g?this.dv(new wu(g,i,this)):console.error("h5Container is null")}else{console.error("iframeWindow is null");return}l.UE_JSHTML5Communication?l.UE_JSHTML5Communication.UESendMessageToJS=g=>{try{const f=fu(l.HEAPU8,g),m=JSON.parse(f);if(i.debug&&(console.group("%cUE => JS"," background-color:#006EFF;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(m,void 0,"")}`," border:1px dashed #006EFF;border-radius:5px;padding:10px;line-height:25px;color:#006EFF;"),console.groupEnd()),m.t==="cr"){const F=m;if(F.frs&&this._ueFuncResultWithIdsEvent.emit(F.frs),F.ers)for(let Q of F.ers)this._ueEvent.emit(Q)}m.callid&&this._waitingUeCalls.has(m.callid)&&(this._waitingUeCalls.delete(m.callid),console.log(`waitingUeCalls.delete:${m.callid} end`))}catch(f){console.error("UE_JSHTML5Communication.UESendMessageToJS error:",f)}}:console.error("UE_JSHTML5Communication UESendMessageToJS not found")})),this.dispose(this._ueFuncResultWithIdsEvent.disposableOn(B=>{for(const g of B){const f=this._waitingUeFuncIdAndResultCallbacks.get(g.fid);f&&(this._waitingUeFuncIdAndResultCallbacks.delete(g.fid),f(g.r))}}));let c=0;const h=()=>{if(!a||!l||!l.UE_JSHTML5Communication||!l.UE_JSHTML5Communication.JSSendMessageToUE||this._ueFuncWithIdAndResultCallbacks.length===0)return;const B=this._ueFuncWithIdAndResultCallbacks.map(([T])=>T),g={n:c++,tt:Date.now(),t:"c",fs:B,callid:w.createGuid()};for(const[T,E]of this._ueFuncWithIdAndResultCallbacks)this._waitingUeFuncIdAndResultCallbacks.set(T.fid,E);this._ueFuncWithIdAndResultCallbacks.length=0,this._waitingUeCalls.set(g.callid,g),i.debug&&(console.group("%cxe2 => ue"," background-color:green;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(g,void 0,"")}`," border:1px dashed green;border-radius:5px;padding:10px;line-height:25px;color:green;"),console.groupEnd());const f=JSON.stringify(g),m=window.g_emitDescriptor_maxBytes??3e4,F=f.length,Q=++pu;if(F<m){const T=`${Q}-0/1-`+f;l.UE_JSHTML5Communication.JSSendMessageToUE(T);return}const y=Math.ceil(F/m)|0;[...new Array(y).keys()].map(T=>f.slice(T*m,(T+1)*m)).forEach((T,E)=>{const R=`${Q}-${E}/${y}-`+T;l.UE_JSHTML5Communication.JSSendMessageToUE(R)})};this.dv(w.createInterval()).start(h,50)}processResponse(e){if(this._ueViewer.debug??!1)try{const t=JSON.parse(e);console.group("%cUE => JS"," background-color:#006EFF;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(t,void 0,"")}`," border:1px dashed #006EFF;border-radius:5px;padding:10px;line-height:25px;color:#006EFF;"),console.groupEnd()}catch(t){console.error(`processResponse(${e}) error: ${t}`,t)}}callUeFunc(e){return new Promise(t=>{const s={fid:w.createGuid(),...e};this._ueFuncWithIdAndResultCallbacks.push([s,t])})}disposableOnUeEvent(e,t){const n=w.createGuid();this.callUeFunc({f:"addEventListener",p:{et:e,eid:n}});const s=()=>{this.callUeFunc({f:"removeEventListener",p:{eid:n}})},i=this._ueEvent.disposableOn(o=>{o.et===e&&o.eid===n&&((this._ueViewer.debug??!1)&&console.log(`callback, type:${e} eid:${n} ueEvent:${JSON.stringify(o)}`),t(o))});return()=>{i(),s()}}}let vu=-1;class mu extends Ve{constructor(e,t){super();C(this,"_ueFuncResultWithIdsEvent",this.dv(new w.Event));C(this,"_ueFuncWithIdAndResultCallbacks",[]);C(this,"_waitingUeFuncIdAndResultCallbacks",new Map);C(this,"_waitingUeCalls",new Set);C(this,"_ueEvent",this.dv(new w.Event));this._ueViewer=t;const n=this._ueViewer;let s=!1;const i={eventType:"init",params:{}};window.ue.es.oncommand(JSON.stringify(i)),s=!0,window.calljs=(c,h)=>{if(n.debug&&console.log(`calljs eventName:${c} eventDetailStr:${h}`),c==="ueevent"||c==="commanFinish")try{const d=JSON.parse(h);if(d.t==="cr"){const B=d;if(B.frs&&this._ueFuncResultWithIdsEvent.emit(B.frs),B.ers)for(let g of B.ers)this._ueEvent.emit(g)}}catch(d){console.error(d)}},this.dispose(this._ueFuncResultWithIdsEvent.disposableOn(c=>{for(const h of c){const d=this._waitingUeFuncIdAndResultCallbacks.get(h.fid);d&&(this._waitingUeFuncIdAndResultCallbacks.delete(h.fid),d(h.r))}}));let o=0;const a=()=>{if(!s||this._ueFuncWithIdAndResultCallbacks.length===0)return;const c=this._ueFuncWithIdAndResultCallbacks.map(([B])=>B),h={n:o++,tt:Date.now(),t:"c",fs:c};for(const[B,g]of this._ueFuncWithIdAndResultCallbacks)this._waitingUeFuncIdAndResultCallbacks.set(B.fid,g);this._ueFuncWithIdAndResultCallbacks.length=0,this._waitingUeCalls.add(h),n.debug&&(console.group("%cxe2 => ue"," background-color:green;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(h,void 0,"")}`," border:1px dashed green;border-radius:5px;padding:10px;line-height:25px;color:green;"),console.groupEnd());const d=++vu;window.ue.es.oncommand(`${d}-0/1-`+JSON.stringify(h)).then(()=>{this._waitingUeCalls.delete(h)})};this.dv(w.createInterval()).start(a,50)}callUeFunc(e){return new Promise(t=>{const s={fid:w.createGuid(),...e};this._ueFuncWithIdAndResultCallbacks.push([s,t])})}disposableOnUeEvent(e,t){const n=w.createGuid();this.callUeFunc({f:"addEventListener",p:{et:e,eid:n}});const s=()=>{this.callUeFunc({f:"removeEventListener",p:{eid:n}})},i=this._ueEvent.disposableOn(o=>{o.et===e&&o.eid===n&&((this._ueViewer.debug??!1)&&console.log(`callback, type:${e} eid:${n} ueEvent:${JSON.stringify(o)}`),t(o))});return()=>{i(),s()}}}class Fu extends w.Destroyable{constructor(A,e){super();{const t=()=>{const o=Qn(A);A.setGlobalProperty(o)};t();const n=mr(),s=[];n.forEach(o=>{const a=A[o+"Changed"];s.push(a)});const i=this.dv(w.createNextAnimateFrameEvent(...s));this.d(i.don(t))}this.d(A.propChanged.don(t=>{if(t.objId==="")try{Object.keys(t.props).forEach(n=>{const s=t.props[n]===null?void 0:t.props[n];A[n]=s})}catch(n){console.error("ueViewer propChanged:"+n)}})),this.dv(new w.ObjResettingWithEvent(A.statusUpdateIntervalChanged,t=>{if((A.statusUpdateInterval??.5)===0)return;const s=new w.Destroyable;return s.d(e.disposableOnUeEvent("statusUpdate",i=>{A.statusUpdateEvent.emit(i)})),s})),this.dv(new w.ObjResettingWithEvent(A.propChangedListeningChanged,()=>{if(!(A.propChangedListening??!0))return;const n=new w.Destroyable;return n.d(e.disposableOnUeEvent("propChanged",s=>{A.propChanged.emit(s)})),n})),this.dv(new w.ObjResettingWithEvent(A.objectEventListeningChanged,()=>{if(!(A.objectEventListening??!0))return;const n=new w.Destroyable;return n.d(e.disposableOnUeEvent("objectEvent",s=>{A.objectEvent.emit(s)})),n})),this.dv(new w.ObjResettingWithEvent(A.widgetEventListeningChanged,()=>{if(!(A.widgetEventListening??!0))return;const n=new w.Destroyable;return n.d(e.disposableOnUeEvent("widgetEvent",s=>{A.widgetEvent.emit(s)})),n})),this.dv(new w.ObjResettingWithEvent(A.speechRecognitionListeningChanged,()=>{if(!(A.speechRecognitionListening??!0))return;const n=new w.Destroyable;return n.d(e.disposableOnUeEvent("speechRecognition",s=>{A.speechRecognition.emit(s)})),n})),this.dv(new w.ObjResettingWithEvent(A.customMessageListeningChanged,()=>{if(!(A.customMessageListening??!0))return;const n=new w.Destroyable;return n.d(e.disposableOnUeEvent("customMessage",s=>{A.customMessage.emit(s)})),n})),this.dv(new w.ObjResettingWithEvent(A.editingEventListeningChanged,()=>{if(!(A.editingEventListening??!0))return;const n=new w.Destroyable;return n.d(e.disposableOnUeEvent("editingEvent",s=>{s.objectIDs=s.objectIDs.map(i=>{var o;return((o=p.ESSceneObject.getSceneObjById(i))==null?void 0:o.parentID)??i}),A.editingEvent.emit(s)})),n}))}}class Qu extends w.Destroyable{constructor(A,e,t){super();{const s=()=>{const l=Qn(e);e.setGlobalProperty(l)};s();const i=mr(),o=[];i.forEach(l=>{const c=e[l+"Changed"];o.push(c)});const a=this.dv(w.createNextAnimateFrameEvent(...o));this.d(a.don(s))}this.d(e.propChanged.don(s=>{if(s.objId==="")try{Object.keys(s.props).forEach(i=>{const o=s.props[i]===null?void 0:s.props[i];e[i]=o})}catch(i){console.error("ueViewer propChanged:"+i)}}));const n=document.createElement("div");n.style.width="100%",n.style.height="100%",n.style.position="absolute",n.style.overflow="hidden",n.style.top="0",n.style.left="0",n.style.zIndex="0",n.style.backgroundColor="rgba(255,0,0,0)",n.setAttribute("masker","大屏顶层div,用于模拟鼠标事件和控制UE鼠标事件是否生效"),A.appendChild(n),this.d(()=>{n&&A&&A.removeChild(n)});{const s=(l,c)=>{window.ue.esinput.setinterceptevent(c),l.preventDefault()},i=l=>{s(l,!1)},o=l=>{s(l,!0)},a=l=>{s(l,!1)};n.addEventListener("mouseenter",i),n.addEventListener("mouseleave",o),n.addEventListener("mousemove",a),this.d(()=>{n.removeEventListener("mouseenter",i),n.removeEventListener("mouseleave",o),n.removeEventListener("mousemove",a)})}e.useCustomInteraction=!1,this.dv(new p.ViewerCustomInteraction(e,n)),this.dv(new w.ObjResettingWithEvent(e.statusUpdateIntervalChanged,s=>{if((e.statusUpdateInterval??.5)===0)return;const o=new w.Destroyable;return o.d(t.disposableOnUeEvent("statusUpdate",a=>{e.statusUpdateEvent.emit(a)})),o})),this.dv(new w.ObjResettingWithEvent(e.propChangedListeningChanged,()=>{if(!(e.propChangedListening??!0))return;const i=new w.Destroyable;return i.d(t.disposableOnUeEvent("propChanged",o=>{e.propChanged.emit(o)})),i})),this.dv(new w.ObjResettingWithEvent(e.objectEventListeningChanged,()=>{if(!(e.objectEventListening??!0))return;const i=new w.Destroyable;return i.d(t.disposableOnUeEvent("objectEvent",o=>{e.objectEvent.emit(o)})),i})),this.dv(new w.ObjResettingWithEvent(e.widgetEventListeningChanged,()=>{if(!(e.widgetEventListening??!0))return;const i=new w.Destroyable;return i.d(t.disposableOnUeEvent("widgetEvent",o=>{e.widgetEvent.emit(o)})),i})),this.dv(new w.ObjResettingWithEvent(e.speechRecognitionListeningChanged,()=>{if(!(e.speechRecognitionListening??!0))return;const i=new w.Destroyable;return i.d(t.disposableOnUeEvent("speechRecognition",o=>{e.speechRecognition.emit(o)})),i})),this.dv(new w.ObjResettingWithEvent(e.customMessageListeningChanged,()=>{if(!(e.customMessageListening??!0))return;const i=new w.Destroyable;return i.d(t.disposableOnUeEvent("customMessage",o=>{e.customMessage.emit(o)})),i})),this.dv(new w.ObjResettingWithEvent(e.editingEventListeningChanged,()=>{if(!(e.editingEventListening??!0))return;const i=new w.Destroyable;return i.d(t.disposableOnUeEvent("editingEvent",o=>{o.objectIDs=o.objectIDs.map(a=>{var l;return((l=p.ESSceneObject.getSceneObjById(a))==null?void 0:l.parentID)??a}),e.editingEvent.emit(o)})),i}))}}class Uu extends w.Destroyable{constructor(e,t,n){super();C(this,"_reconnectEvent",this.dv(new w.Event));const s=(a,l)=>a.hasOwnProperty(l);let i=0,o;if(this.d(()=>{o&&clearTimeout(o)}),window.ue&&window.ue.es)if(window.ue.esinput){n.setStatus("Creating"),console.log("存在(window.ue && window.ue.es && window.ue.esinput 需要适配新版ESWebView 鼠标穿透), 开始创建UeFalseCloudViewer..."),n.setStatusLog("开始创建本地视口...");const a=this.dv(new mu(e,n));this.d(()=>n.viewer=void 0),n.viewer=a,n.setStatus("Created"),n.setStatusLog("本地视口创建成功!"),this.dv(new Qu(e,n,a))}else n.setStatus("Error"),n.setStatusLog("请升级 ESWebView !");else if(s(t.options,"ws")||s(t.options,"uri")&&s(t.options,"app")){n.setStatus("Creating"),n.setStatusLog("开始创建云渲染视口...");let a;this.d(()=>{n.setStatus("Raw"),n.setStatusLog(""),e&&a&&e.removeChild(a)&&(a=void 0)});const l=this.dv(w.createProcessingFromAsyncFunc(async c=>{n.viewer&&!n.viewer.isDestroyed()&&n.viewer.destroy(),n.viewer=void 0,a&&e.removeChild(a)&&(a=void 0),a=document.createElement("div"),a.setAttribute("earthsdk3-ue","earthsdk3-ue-videoContainer"),a.style.cssText="position:relative; height: 100%;width:100%;",e.appendChild(a);let h,d,B;if(s(t.options,"ws")){const{ws:F,esmsg:Q,uselnternalSignallingServer:y}=t.options;h=F,d=Q,B=y??!1}if(s(t.options,"uri")&&s(t.options,"app")){const{offsetWidth:F,offsetHeight:Q}=a;let{uri:y,app:L,token:T}=t.options;y.endsWith("/")||(y+="/");const E=T?`?essstoken=${T}`:"",R=`/${L}/${F??1920}/${Q??1080}`+E;console.log(`请求信令服务器: ${y}instance${R}`);const K=await c.promise(fetch(`${y}instance${R}`,{method:"GET"})),M=await c.promise(K.json());if(M&&M.status!=="ok"){n.setStatus("Error"),n.setStatusLog(`信令服务器请求失败 ${M.status}`),this._reconnectEvent.emit(void 0);return}else{console.log(`信令服务器请求成功! ${JSON.stringify(M,void 0," ")}`),await w.sleep(2e3);const{server:W,esmsg:iA,instanceId:uA,useInternalSignallingServer:G}=M;if(!uA){n.setStatus("Error"),n.setStatusLog("检查信令服务器版本,返回数据错误! "),console.log("信令服务器返回数据错误!不包含instanceId!请升级到 ESSS V3.0+ 版本!"),this._reconnectEvent.emit(void 0);return}h=W,d=iA,B=G??!1,n.esssResponse=M}}const g=this.dv(B?new gu(a,h,d,n):new ou(a,h,d,n));this.d(()=>n.viewer=void 0),this.d(g.errorEvent.don(F=>{const Q=`[${F}]:像素流连接错误!`;n.setStatus("Error"),n.setStatusLog(Q),this._reconnectEvent.emit(g)})),await c.promise(new Promise(F=>this.d(g.readyEvent.donce(F)))),n.setStatus("Created"),n.setStatusLog("云渲染视口创建成功!"),i=0,o&&clearTimeout(o),o=void 0;const{offsetWidth:f,offsetHeight:m}=a;g.resize(f*window.devicePixelRatio,m*window.devicePixelRatio),n.viewer=g,this.d(()=>n.viewer=void 0),this.dv(new Fu(n,g))}));l.start(),this.d(this._reconnectEvent.don(c=>{o===void 0&&(c&&!c.isDestroyed()&&c.destroy(),n.viewer&&!n.viewer.isDestroyed()&&n.viewer.destroy(),n.viewer=void 0,n.autoReconnect&&(n.setStatus("Reconnecting"),n.setStatusLog("正在尝试重新连接..."),i=i+5e3>3e4?3e4:i+5e3,console.warn(`间隔:${i/1e3}s,正在尝试重新连接...`),o=window.setTimeout(()=>{l.restart()},i)))})),this.d(l.errorEvent.don(c=>{n.setStatus("Error"),n.setStatusLog("云渲染视口创建失败!"),console.warn("云渲染视口创建失败!",c),this._reconnectEvent.emit(void 0)}))}else if(s(t.options,"project")){const a=t,l=a.options.project,c=a.options.baseUrl;n.setStatus("Creating"),n.setStatusLog("下载编译中...");const h=this.dv(new Cu(e,l,c,n));n.viewer=h,this.d(()=>n.viewer=void 0)}else n.setStatus("Error"),n.setStatusLog("视口创建失败!"),console.warn("视口创建失败: 参数错误!")}}const se=class se extends p.ESViewer{constructor(e){super(e);C(this,"_viewer",this.dv(w.react(void 0)));C(this,"_esssResponse");C(this,"_speechRecognition",this.dv(new w.Event));C(this,"_propChanged",this.dv(new w.Event));C(this,"_objectEvent",this.dv(new w.Event));C(this,"_widgetEvent",this.dv(new w.Event));C(this,"_customMessage",this.dv(new w.Event));C(this,"_statusUpdateEvent",this.dv(new w.Event));C(this,"_statusUpdateEventdon",(()=>{this.d(this.statusUpdateEvent.don(e=>{this._statusInfo.fps=e.FPS??0,this._statusInfo.length=e.length??0,this._statusInfo.position=e.position??[0,0,0],this._statusInfo.rotation=e.rotation??[0,0,0]}))})());if(e.type!=="ESUeViewer")throw new Error("option.type must be ESUeViewer");const t=e;this.d(this._viewer.changed.don(()=>{this.viewerChanged.emit(this.viewer)})),this.dv(new w.ObjResettingWithEvent(this.subContainerChanged,()=>{if(this.setStatus("Raw"),this.setStatusLog(""),!!this.subContainer)return new Uu(this.subContainer,t,this)}))}get defaultProps(){return se.createDefaultProps()}set viewer(e){this._viewer.value=e}get viewer(){return this._viewer.value}get esssResponse(){return this._esssResponse}set esssResponse(e){this._esssResponse=e}get speechRecognition(){return this._speechRecognition}get propChanged(){return this._propChanged}get objectEvent(){return this._objectEvent}get widgetEvent(){return this._widgetEvent}get customMessage(){return this._customMessage}get statusUpdateEvent(){return this._statusUpdateEvent}async uePositionToLonLatAlt(e){if(!this.viewer){console.warn("UEPositionToLonLatAlt: viewer is undefined");return}return await Co(this.viewer,e)}async changeNavigationMode(e){if(!this.viewer){console.warn("ChangeNavigationMode: viewer is undefined");return}const t=await TA(this.viewer,e);return t&&!t.error&&(this._navigationMode.value=e.mode),t}async resetWithCurrentCamera(e){if(!this.viewer){console.warn("resetWithCurrentCamera: viewer is undefined");return}return await En(this.viewer,e)}async getAllSocketNamesByActorTag(e){if(!this.viewer){console.warn("GetAllSocketNamesByActorTag: viewer is undefined");return}return await vo(this.viewer,e)}async getBoundSphere(e){if(!this.viewer){console.warn("getBoundSphere: viewer is undefined");return}return await Fo(this.viewer,e)}async getBoundSphereWithChildren(e){if(!this.viewer){console.warn("getBoundSphereWithChildren: viewer is undefined");return}return await Qo(this.viewer,e)}async getStrokeMaterialParamInfo(e){if(!this.viewer){console.warn("GetStrokeMaterialParamInfo: viewer is undefined");return}return await Uo(this.viewer,e)}async getFillMaterialParamInfo(e){if(!this.viewer){console.warn("getFillMaterialParamInfo: viewer is undefined");return}return await Eo(this.viewer,e)}async getGlobalProperty(e){if(!this.viewer){console.warn("getGlobalProperty: viewer is undefined");return}return await yo(this.viewer,e)}async getObjectByInfo(e){if(!this.viewer){console.warn("GetObjectByInfo: viewer is undefined");return}return await So(this.viewer,e)}async defaultCameraFlyIn(e=1){if(!this.viewer){console.warn("DefaultCameraFlyIn: viewer is undefined");return}return await Zi(this.viewer,e)}async startVoice(){if(!this.viewer){console.warn("startVoice:viewer is undefined");return}return await qi(this.viewer)}async stopVoice(){if(!this.viewer){console.warn("startVoice:viewer is undefined");return}return await ji(this.viewer)}async mountPakFiles(e){if(!this.viewer){console.warn("mountPakFiles:viewer is undefined");return}return await Ao(this.viewer,e)}async generateMemReport(){if(!this.viewer){console.warn("generateMemReport:viewer is undefined");return}return await eo(this.viewer)}async quit(){if(!this.viewer){console.warn("Quit: viewer is undefined");return}return await co(this.viewer)}async bindActorByTag(e,t){if(!this.viewer){console.warn("BindActorByTag: viewer is undefined");return}return await Io(this.viewer,e,t)}async restoreOriginalScene(){if(!this.viewer){console.warn("RestoreOriginalScene: viewer is undefined");return}return await To(this.viewer)}async unBindActorByID(e){if(!this.viewer){console.warn("UnBindActorByID: viewer is undefined");return}return await Ho(this.viewer,e)}async unBindActorByTag(e){if(!this.viewer){console.warn("UnBindActorByTag: viewer is undefined");return}return await Lo(this.viewer,e)}async createActorByClass(e,t){if(!this.viewer){console.warn("CreateActorByClass: viewer is undefined");return}return await bo(this.viewer,e,t)}async bind3DTilesetByTag(e,t){if(!this.viewer){console.warn("Bind3DTilesetByTag: viewer is undefined");return}return await Mo(this.viewer,e,t)}async unBind3DTilesetByTag(e){if(!this.viewer){console.warn("UnBind3DTilesetByTag: viewer is undefined");return}return await Do(this.viewer,e)}async unBind3DTilesetById(e){if(!this.viewer){console.warn("UnBind3DTilesetById: viewer is undefined");return}return await Ro(this.viewer,e)}async bindImageryByTag(e,t,n){if(!this.viewer){console.warn("BindImageryByTag: viewer is undefined");return}return await Po(this.viewer,e,t,n)}async unBindImageryByTag(e,t){if(!this.viewer){console.warn("UnBindImageryByTag: viewer is undefined");return}return await Ko(this.viewer,e,t)}async unBindImageryById(e){if(!this.viewer){console.warn("UnBindImageryById: viewer is undefined");return}return await xo(this.viewer,e)}async getIdByComponentNameAndHitItem(e,t,n){if(!this.viewer){console.warn("GetIdByComponentNameAndHitItem: viewer is undefined");return}return await ko(this.viewer,e,t,n)}async getCameraRelativeHeight(e="ECC_Visibility"){if(!this.viewer){console.warn("GetCameraRelativeHeight: viewer is undefined");return}return await Go(this.viewer,e)}async saveStringToFile(e,t,n){if(!this.viewer){console.warn("SaveStringToFile: viewer is undefined");return}return await No(this.viewer,e,t,n)}async highlightActorByTag(e,t=!0){if(!this.viewer){console.warn("HighlightActorByTag: viewer is undefined");return}return await _o(this.viewer,e,t)}async sendCustomMessage(e){if(!this.viewer){console.warn("SendCustomMessage: viewer is undefined");return}return await Vo(this.viewer,e)}async getStatus(){if(!this.viewer){console.warn("GetStatus:viewer is undefined");return}return await Oo(this.viewer)}async getTilesetMaterialIDList(){if(!this.viewer){console.warn("GetTilesetMaterialIDList:viewer is undefined");return}return await zo(this.viewer)}async pick(e,t,n){if(!this.viewer)return;let s=e;if(e&&window.ue&&this.container){const[i,o]=e,{x:a,y:l}=this.container.getBoundingClientRect();s=[a+i,l+o]}return await uo(this.viewer,s,t,n)}async pickPosition(e){if(!this.viewer)return;let t=e;if(e&&window.ue&&this.container){const[n,s]=e,{x:i,y:o}=this.container.getBoundingClientRect();t=[i+n,o+s]}return await ho(this.viewer,t)}async quickPickPosition(e){return await this.pickPosition(e)}async flyIn(e,t=[0,0,0],n=1,s="default"){if(!this.viewer)return;const i=await xe(this.viewer,void 0,e,t,n,s);if(i)return i.endType===0&&console.warn(`flyTo:flyTo is end! endType:${i.endType}`),i.endType===1&&console.warn(`flyTo:飞行中断! endType:${i.endType}`),i}async flyTo(e,t,n="default"){if(!this.viewer)return;const s=await Be(this.viewer,void 0,void 0,e,t,n);if(s)return s.endType===0&&console.warn(`flyTo:flyTo is end! endType:${s.endType}`),s.endType===1&&console.warn(`flyTo:飞行中断! endType:${s.endType}`),s}flyToBoundingSphere(e,t,n=1){const s=[[e[0],e[1],0],[e[0],e[3],0],[e[2],e[3],0],[e[2],e[1],0]],i=p.getGeoBoundingSphereFromPositions(s);if(!i)return;const{center:o,radius:a}=i,l={distance:t??a,heading:0,pitch:-90,flyDuration:n,hDelta:0,pDelta:0};this.flyTo(l,o)}getCurrentCameraInfo(){const{position:e,rotation:t}=this._statusInfo;return{position:e,rotation:t}}getLengthInPixel(){return this._statusInfo.length}async changeToWalk(e,t=4.2){if(!this.viewer)return;const n={mode:"Walk",position:e,jumpZVelocity:t},s=await TA(this.viewer,n);return s&&!s.error&&(this._navigationMode.value=n.mode),s}async changeToMap(){if(!this.viewer)return;const e={mode:"Map"},t=await TA(this.viewer,e);return t&&!t.error&&(this._navigationMode.value=e.mode),t}async changeToRotateGlobe(e=38,t=1e7,n=60){if(!this.viewer)return;const s={mode:"RotateGlobe",latitude:e,height:t,cycleTime:n},i=await TA(this.viewer,s);return i&&!i.error&&(this._navigationMode.value=s.mode),i}async changeToLine(e,t=10,n=10,s=!0,i=10,o="auto"){if(!this.viewer)return;const a={mode:"Line",geoLineStringId:e,speed:t,heightOffset:n,loop:s,turnRateDPS:i,lineMode:o},l=await TA(this.viewer,a);return l&&!l.error&&(this._navigationMode.value=a.mode),l}async changeToUserDefined(e){if(!this.viewer)return;const t={mode:"UserDefined",userDefinedPawn:e},n=await TA(this.viewer,t);return n&&!n.error&&(this._navigationMode.value=t.mode),n}async changeToRotatePoint(e,t=5e4,n=60,s=0,i=-30){if(!this.viewer)return;const o={mode:"RotatePoint",position:e,distance:t,orbitPeriod:n,heading:s,pitch:i},a=await TA(this.viewer,o);return a&&!a.error&&(this._navigationMode.value=o.mode),a}async changeToFollow(e,t=0,n=0,s=-30,i=!0){if(!this.viewer)return;const o={mode:"Follow",objectId:e,distance:t,heading:n,pitch:s,relativeRotation:i},a=await TA(this.viewer,o);return a&&!a.error&&(this._navigationMode.value=o.mode),a}getFPS(){return this._statusInfo.fps}async getVersion(){const e=window.g_XE3CopyRights??{};if(!this.viewer)return e;const t=await mo(this.viewer);return e.esforue=t,e}async getHeightByLonLat(e,t,n="ECC_Visibility"){if(!this.viewer)return null;const s=await go(this.viewer,e,t,n);return s&&s.height!==void 0?s.height:null}async getHeightsByLonLats(e,t="ECC_Visibility"){return this.viewer?await Bo(this.viewer,e,t):void 0}async capture(e=64,t=64){return this.viewer?await fo(this.viewer,e,t):void 0}async partialCapture(e,t=[64,64]){if(!this.viewer){console.warn("partialCapture:viewer is undefined");return}return await wo(this.viewer,e,t)}async lonLatAltToScreenPosition(e){if(!this.viewer)return;const t=await po(this.viewer,e);return t&&[t.X,t.Y]}async setGlobalProperty(e){if(this.viewer)return await lo(this.viewer,e)}async startEditing(e,t,n){n=Object.assign({useKeyToSwitch:!0,callSource:"outer"},n);const s=e.combinationClass?e.getMainClass():e;if(!s||!this.viewer||t==null)return;const i=Array.isArray(t)?[...t]:[t];return s.editingID=`${n.callSource}_${w.createGuid()}`,await Wo(this.viewer,s.id,s.editingID,i,n.useKeyToSwitch)}async stopEditing(){if(this.viewer)return await Xo(this.viewer)}async moveObjects(e){if(!this.viewer)return;const t=[],n=w.createGuid();for(let s=0;s<e.length;s++){const i=e[s],o=i.combinationClass?i.getMainClass():i;o.editingID=n,o&&t.push(o.id)}if(t.length!==0)return await Jo(this.viewer,t,n)}getProperties(){return[...super.getProperties()]}};C(se,"type",se.register("ESUeViewer",se)),C(se,"defaults",{...od});let LA=se;(r=>{r.createDefaultProps=()=>({...p.ESViewer.createDefaultProps(),...Yi(),resolutionScale:1,autoReconnect:!1,propChangedListening:void 0,objectEventListening:void 0,widgetEventListening:void 0,speechRecognitionListening:void 0,customMessageListening:void 0})})(LA||(LA={})),w.extendClassProps(LA.prototype,LA.createDefaultProps);class jA extends p.EngineObject{constructor(A,e){super(A,e);const t=e.viewer;if(t&&(A.combinationClass||this.d(this.createdEvent.don(()=>{const n=this.constructor.propValFuncs,s=A.defaultProps,i=Object.keys(s).filter(d=>n[d]!==null);i.push(...this.constructor.forceUeUpdateProps);const o=A.constructor.defaults,a={val:{}},l=[];for(let d of i){const B=d+"Changed",g=A[B];l.push(g);const f=n[d];if(f===null)throw console.error("vf === null error"),new Error("vf === null error");const m=()=>{const F=A[d]??o[d];let Q=f?f(F,this,e,A):F;if(Q===void 0){console.warn(`UE自动更新的属性,不应该为undefined! 属性名:${d} 对象名:${A.name} 对象id: ${A.id}`);return}a.val[d]=Q};m(),this.d(g.don(m))}const c=()=>{t.callUeFunc({f:"update",p:{id:A.id,...a.val}}),a.val={}},h=this.dv(w.createNextAnimateFrameEvent(...l));this.d(h.don(c)),this.d(A.createdEvent.don(c)),this.d(A.flushEvent.don(()=>h.flush()))})),!A.combinationClass)){let n=!1;this.d(()=>{n&&Un(t,A.id)}),t.callUeFunc({f:"create",p:{type:A.typeName,id:A.id}}).then(()=>{n=!0,A.createdEvent.emit()}).catch(s=>console.error(s))}}}C(jA,"propValFuncs",{ref:null,devTags:null,extras:null,execOnceFuncStr:null,updateFuncStr:null,toDestroyFuncStr:null}),C(jA,"forceUeUpdateProps",[]);class lA extends jA{constructor(A,e){super(A,e);const t=e.viewer;t&&(this.d(A.flyToEvent.don(n=>{Be(t,A.id,n)})),this.d(A.flyInEvent.don(n=>{var s,i;xe(t,A.id,(s=A.flyInParam)==null?void 0:s.position,(i=A.flyInParam)==null?void 0:i.rotation,n??1)})),this.d(A.calcFlyToParamEvent.don(()=>{$A(t,A.id)})),this.d(A.calcFlyInParamEvent.don(()=>{const n=e.getCurrentCameraInfo();if(!n)return;const{position:s,rotation:i}=n;A.flyInParam={position:s,rotation:i,flyDuration:1}})),this.d(e.propChanged.don(n=>{n.objId===A.id&&Object.keys(n.props).forEach(s=>{const i=n.props[s]===null?void 0:n.props[s];A[s]=i})})))}}class x extends lA{constructor(A,e){super(A,e);const t=e.viewer;if(!t)return;const n=()=>{A.editing||t.callUeFunc({f:"update",p:{id:A.id,position:A.position,rotation:A.rotation}})},s=this.dv(w.createNextAnimateFrameEvent(A.positionChanged,A.rotationChanged,A.editingChanged));this.d(s.don(()=>{setTimeout(n,0)})),this.d(A.smoothMoveEvent.don((a,l)=>{_e(t,A.id,a,l)})),this.d(A.smoothMoveWithRotationEvent.don((a,l,c)=>{ke(t,A.id,a,l,c)})),this.d(A.smoothMoveOnGroundEvent.don((a,l,c,h)=>{Ge(t,A.id,a,l,h,c)})),this.d(A.smoothMoveWithRotationOnGroundEvent.don((a,l,c,h,d)=>{Ne(t,A.id,a,l,c,h,d)})),this.d(A.smoothMoveKeepPitchEvent.don(async(a,l)=>{const c=await t.callUeFunc({f:"SmoothMoveKeepPitch",p:{id:A.id,Destination:a,Time:l}});c.error&&console.error("SmoothMoveKeepPitch:",c.error)})),this.d(A.automaticLandingEvent.don(a=>{const l=[A.position[0],A.position[1]];e.getHeightByLonLat(A.position[0],A.position[1],"Visibility").then(c=>{c!==null&&(A.position=[...l,c],A.collision=a)})}));const i=async(a,l,c,h)=>{const{viewer:d}=a;if(!d){console.error("SmoothMoveRelatively: ueViewer.viewer is undefined");return}const B=await d.callUeFunc({f:"SmoothMoveRelatively",p:{id:l,RelativePosition:c,Time:h}});return B.error&&console.error("SmoothMoveRelatively:",B.error),B};this.d(A.smoothMoveRelativelyEvent.don((a,l)=>{i(e,A.id,a,l)}));const o=async(a,l,c,h,d)=>{const{viewer:B}=a;if(!B){console.error("SmoothMoveRelativelyWithRotation: ueViewer.viewer is undefined");return}const g=await B.callUeFunc({f:"SmoothMoveRelativelyWithRotation",p:{id:l,RelativePosition:c,NewRotation:h,Time:d}});return g.error&&console.error("SmoothMoveRelativelyWithRotation:",g.error),g};this.d(A.smoothMoveRelativelyWithRotationEvent.don((a,l,c)=>{o(e,A.id,a,l,c)}))}}class rA extends lA{constructor(A,e){super(A,e);const t=e.viewer;if(!t)return;const n=()=>{A.editing||t.callUeFunc({f:"update",p:{id:A.id,points:A.points}})},s=this.dv(w.createNextAnimateFrameEvent(A.pointsChanged,A.editingChanged));this.d(s.don(()=>{setTimeout(n,0)}))}}C(rA,"propValFuncs",{...lA.propValFuncs,pointStyle:A=>({...A,materialParams:JSON.stringify(A.materialParams??{})}),strokeStyle:A=>({...A,materialParams:JSON.stringify(A.materialParams??{})}),fillStyle:A=>({...A,materialParams:JSON.stringify(A.materialParams??{})})});class UA extends x{constructor(A,e){super(A,e),e.viewer&&this.d(e.widgetEvent.don(n=>{if(n.objId!==A.id)return;const{type:s,add:i}=n;A.widgetEvent.emit({type:s,add:i})}))}}class Kn extends x{constructor(A,e){super(A,e),e.viewer}}C(Kn,"propValFuncs",{...x.propValFuncs,pointStyle:A=>({...A,materialParams:JSON.stringify(A.materialParams??{})}),strokeStyle:A=>({...A,materialParams:JSON.stringify(A.materialParams??{})}),fillStyle:A=>({...A,materialParams:JSON.stringify(A.materialParams??{})})});class Er extends Kn{constructor(A,e){super(A,e),e.viewer}}const Al=r=>{switch(r){case 0:return"成功绑定";case 1:return"解绑之前的内容,成功绑定";case 2:return"没搜索到ActorTag,无法绑定";case 3:return"搜索到ActorTag但对应的Actor不是3dTileset,无法绑定";default:return"未知错误"}},ht=class ht extends p.EngineObject{constructor(e,t){super(e,t);C(this,"_styleColor",this.dv(w.react([])));C(this,"_styleVisable",this.dv(w.react([])));const n=t.viewer;if(!n){console.warn("UeES3DTileset: viewer is undefined!");return}let s,i;const o=async()=>{!s&&!i||await n.callUeFunc({f:"update",p:{id:e.id,url:e.url,show:e.show,collision:e.collision,allowPicking:e.allowPicking,flyToParam:e.flyToParam??p.ESVisualObject.defaults.flyToParam,flyInParam:e.flyInParam??p.ESVisualObject.defaults.flyInParam,highlightID:e.highlightID,highlightColor:e.highlightColor,highlight:e.highlight,materialMode:e.materialMode,maximumScreenSpaceError:e.maximumScreenSpaceError,colorMode:Reflect.has(e,"colorMode")?e.colorMode:void 0,offset:e.offset,rotation:e.rotation,cacheBytes:e.cacheBytes,colorBlendMode:e.colorBlendMode,materialOverrideMap:e.materialOverrideMap}})},a=this.dv(w.createNextAnimateFrameEvent(e.urlChanged,e.showChanged,e.flyToParamChanged,e.flyInParamChanged,e.collisionChanged,e.allowPickingChanged,e.highlightIDChanged,e.highlightColorChanged,e.highlightChanged,e.materialModeChanged,e.maximumScreenSpaceErrorChanged,e.offsetChanged,e.rotationChanged,e.cacheBytesChanged,e.colorBlendModeChanged,e.materialOverrideMapChanged));o(),this.d(a.don(o)),Reflect.has(e,"colorMode")&&this.d(e.colorModeChanged.don(()=>o()));const l=this.dv(w.react(void 0));{const h=this.dv(w.createNextAnimateFrameEvent(e.actorTagChanged,e.urlChanged)),d=()=>{e.actorTag?l.value={type:"ActorTag",actorTag:e.actorTag}:e.url?l.value={type:"CreatedUrl",url:e.url}:l.value=void 0,e.editing=!1};d(),this.d(h.don(d))}const c=async()=>{const{id:h}=e;if(s!==void 0){s=void 0;try{const d=await t.unBind3DTilesetById(h);if(!d)return;if(d.error!==""){console.warn(`UeES3DTileset UnBind3DTilesetById: ${d.error}`);return}}catch(d){console.warn(`UeES3DTileset UnBind3DTilesetById: ${d}`);return}}if(i!==void 0){i=void 0;try{const d=await n.callUeFunc({f:"destroy",p:{id:h}});if(!d)return;if(d.error!==""){console.warn(`UeES3DTileset Destroy: ${d.error}`);return}}catch(d){console.warn(`UeES3DTileset Destroy: ${d}`);return}}};this.d(()=>{c()});{const h=this.dv(w.createProcessingFromAsyncFunc(async B=>{if(l.value===void 0){await B.promise(c());return}if(l.value.type==="ActorTag"){const{actorTag:g}=l.value;if(s!==g&&await B.promise(c()),s!==void 0||g===void 0)return;try{s=g;const f=await B.promise(t.bind3DTilesetByTag(e.id,g));if(!f)return;if(f.error!==""){console.warn(`UeES3DTileset Bind3DTilesetByTag: ${f.error}`);return}if(f.re.type!==0)if(f.re.type===1)console.warn(`UeES3DTileset Bind3DTilesetByTag: ${Al(f.re.type)}`);else{console.warn(`UeES3DTileset Bind3DTilesetByTag: ${Al(f.re.type)}`);return}}catch(f){console.warn(`UeES3DTileset Bind3DTilesetByTag: ${f}`);return}}else if(l.value.type==="CreatedUrl"){const{url:g}=l.value;if(g!==i&&await c(),i!==void 0||g===void 0)return;try{i=g;const f=await B.promise(n.callUeFunc({f:"create",p:{type:e.typeName,id:e.id}}));if(!f)return;if(f.error!==""){console.warn(`UeES3DTileset create: ${f.error}`);return}}catch(f){console.warn(`UeES3DTileset create: ${f}`);return}}await B.promise(o())})),d=async()=>{h.restart()};d(),this.d(l.changed.don(d))}this.d(e.refreshTilesetEvent.don(()=>{$i(n,e.id)})),this.d(e.flyToEvent.don(async(h,d)=>{if(!s&&!i)return;const B=await Be(n,e.id,h);let g="over";B===void 0?g="error":B.endType===0?g="over":B.endType===1&&(g="cancelled"),e.flyOverEvent.emit(d,g,t)})),this.d(e.calcFlyToParamEvent.don(()=>{!s&&!i||$A(n,e.id)})),this.d(e.calcFlyInParamEvent.don(async()=>{if(!s&&!i||!t.actived)return;const h=await t.getCurrentCameraInfo();if(!h)return;const{position:d,rotation:B}=h;e.flyInParam={position:d,rotation:B,flyDuration:1}})),this.d(t.propChanged.don(h=>{!s&&!i||h.objId===e.id&&Object.keys(h.props).forEach(d=>{const B=h.props[d]===null?void 0:h.props[d];e[d]=B})})),this.d(t.objectEvent.don(h=>{!s&&!i||h.id!==e.id||h.type!=="3DTilesetReady"||e.tilesetReady.emit(h.p)}));{const h=async(f,m)=>{if(!s&&!i)return;const F=await n.callUeFunc({f:"SetFeatureColor",p:{id:e.id,featureName:f,json:m}});if(F&&F.error!==""){console.warn(`UeES3DTileset SetFeatureColor: ${F.error}`);return}},d=async(f,m)=>{if(!s&&!i)return;const F=await n.callUeFunc({f:"SetFeatureVisable",p:{id:e.id,featureName:f,json:m}});if(F&&F.error!==""){console.warn(`UeES3DTileset SetFeatureVisable: ${F.error}`);return}},B=async()=>{if(!s&&!i)return;const f=await n.callUeFunc({f:"ResetFeatureStyle",p:{id:e.id}});if(f&&f.error!==""){console.warn(`UeES3DTileset ResetFeatureStyle: ${f.error}`);return}},g=async f=>{if(!s&&!i)return;const m=await n.callUeFunc({f:"SetFeatureStyle",p:{id:e.id,json:f}});if(m&&m.error!==""){console.warn(`UeES3DTileset SetFeatureStyle: ${m.error}`);return}};this.d(e.setFeatureColorEvent.don((f,m)=>{const F=[...this.styleColor,...m];this.styleColor=[...F],h(f,F)})),this.d(e.setFeatureVisableEvent.don((f,m)=>{const F=[...this.styleVisable,...m];this.styleVisable=[...F],d(f,F)})),this.d(e.resetFeatureStyleEvent.don(()=>{B(),this.styleColor=[],this.styleVisable=[]})),this.d(e.setFeatureStyleEvent.don(f=>{g(f)}))}{const h=async()=>{if(!s&&!i){e._featureTableResultEvent.emit(void 0);return}try{const d=await n.callUeFunc({f:"GetFeatureTable",p:{id:e.id}});d.error!==""&&console.warn(`UeES3DTileset GetFeatureTable: ${d.error}`),e._featureTableResultEvent.emit(d.re.table)}catch(d){console.warn(`UeES3DTileset GetFeatureTable: ${d}`),e._featureTableResultEvent.emit(void 0)}};this.d(e.getFeatureTableEvent.don(()=>{h()}))}{const h=async()=>{if(!s&&!i){e.getMaterialNameListEvent.emit(void 0);return}try{const d=await n.callUeFunc({f:"GetMaterialNameList",p:{id:e.id}});d.error!==""&&console.warn(`UeES3DTileset GetMaterialNameList: ${d.error}`),e.getMaterialNameListEvent.emit(d.re.materialNameList)}catch(d){console.warn(`UeES3DTileset GetMaterialNameList: ${d}`),e.getMaterialNameListEvent.emit(void 0)}};this.ad(e.getMaterialNameListEvent.don(d=>{d=="start"&&h()}))}}get styleColor(){return this._styleColor.value}set styleColor(e){this._styleColor.value=e}get styleVisable(){return this._styleVisable.value}set styleVisable(e){this._styleVisable.value=e}};C(ht,"type",ht.register("ESUeViewer",p.ES3DTileset.type,ht));let yr=ht;const el=r=>{switch(r){case 0:return"成功绑定";case 1:return"解绑之前的内容,成功绑定";case 2:return"没搜索到ActorTag,无法绑定";case 3:return"搜索到ActorTag对应的Actor是地形,无法绑定";case 4:return"没搜索到ComponentTag,无法绑定";default:return"未知错误"}},gt=class gt extends p.EngineObject{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}let n,s;const i=this.dv(w.react(void 0)),o=this.ad(w.reactJson(""));{const h=()=>{if(typeof A.url=="string")o.value=p.ESSceneObject.context.getStrFromEnv(A.url);else{const d=A.url;d.url=p.ESSceneObject.context.getStrFromEnv(d.url),o.value=d}};h(),this.ad(A.urlChanged.don(h))}const a=async()=>{if(!n&&!s)return;let h=A.targetID??p.ESImageryLayer.defaults.targetID;if(h&&h!=""){const d=p.ESSceneObject.getSceneObject(h);h=d?d.getMainClass().id:h}await t.callUeFunc({f:"update",p:{id:A.id,show:A.show??!0,rectangle:A.rectangle??[-180,-90,180,90],collision:A.collision??!0,allowPicking:A.allowPicking??!1,flyToParam:A.flyToParam??p.ESVisualObject.defaults.flyToParam,flyInParam:A.flyInParam??p.ESVisualObject.defaults.flyInParam,url:o.value??"",zIndex:A.zIndex??0,maximumLevel:A.maximumLevel??p.ESImageryLayer.defaults.maximumLevel,minimumLevel:A.minimumLevel??p.ESImageryLayer.defaults.minimumLevel,options:A.options??p.ESImageryLayer.defaults.options,targetID:h,opacity:A.opacity??p.ESImageryLayer.defaults.opacity,splitDirection:A.splitDirection??p.ESImageryLayer.defaults.splitDirection}})},l=this.dv(w.createNextAnimateFrameEvent(A.showChanged,o.changed,A.flyToParamChanged,A.flyInParamChanged,A.zIndexChanged,A.collisionChanged,A.allowPickingChanged,A.maximumLevelChanged,A.minimumLevelChanged,A.rectangleChanged,A.optionsChanged,A.targetIDChanged,A.opacityChanged,A.splitDirectionChanged));this.d(l.don(a));const c=async()=>{const{id:h}=A;if(n!==void 0){n=void 0;try{const d=await e.unBindImageryById(h);if(!d)return;if(d.error!==""){console.warn(`UeESImageryLayer UnImageryByID: ${d.error}`);return}}catch(d){console.warn(`UeESImageryLayer UnImageryByID promise: ${d}`);return}}if(s!==void 0){s=void 0;try{const d=await t.callUeFunc({f:"destroy",p:{id:h,test:"UeESImageryLayer"}});if(!d)return;if(d.error!==""){console.warn(`UeESImageryLayer Destroy: ${d.error}`);return}}catch(d){console.warn(`UeESImageryLayer Destroy promise: ${d}`);return}}};this.d(()=>{c()});{const h=this.dv(w.createProcessingFromAsyncFunc(async B=>{if(i.value===void 0){await B.promise(c());return}if(i.value.type==="ActorTag"){const{actorTag:g,componentTag:f}=i.value;if(n!==g&&await B.promise(c()),n!==void 0||g===void 0)return;try{n=g;const m=await B.promise(e.bindImageryByTag(A.id,g,f));if(!m)return;if(m.error!==""){console.warn(`ESImageryLayer BindImageryByTag: ${m.error}`);return}if(m.re.type!==0)if(m.re.type===1)console.warn(`ESImageryLayer BindImageryByTag: ${el(m.re.type)}`);else{console.warn(`ESImageryLayer BindImageryByTag: ${el(m.re.type)}`);return}}catch(m){console.warn(`ESImageryLayer BindImageryByTag promise: ${m}`);return}}else if(i.value.type==="CreatedUrl"){const{url:g}=i.value;if(g!==s&&await B.promise(c()),s!==void 0||g===void 0)return;try{s=g;const f=await B.promise(t.callUeFunc({f:"create",p:{type:"ESImageryLayer",id:A.id}}));if(!f)return;if(f.error!==""){console.warn(`ESImageryLayer create: ${f.error}`);return}}catch{console.warn("ESImageryLayer create: create promise error");return}}await B.promise(a())})),d=async()=>{h.restart()};d(),this.d(i.changed.don(d))}{const h=this.dv(w.createNextAnimateFrameEvent(A.actorTagChanged,o.changed,A.componentTagChanged)),d=()=>{A.actorTag&&A.componentTag?i.value={type:"ActorTag",actorTag:A.actorTag,componentTag:A.componentTag}:o.value?i.value={type:"CreatedUrl",url:o.value}:i.value=void 0};d(),this.d(h.don(d))}this.d(A.flyToEvent.don(async(h,d)=>{if(!n&&!s)return;const B=await Be(t,A.id,h);let g="over";B===void 0?g="error":B.endType===0?g="over":B.endType===1&&(g="cancelled"),A.flyOverEvent.emit(d,g,e)})),this.d(A.flyInEvent.don(async(h,d)=>{var f,m;if(!n&&!s)return;const B=await xe(t,A.id,(f=A.flyInParam)==null?void 0:f.position,(m=A.flyInParam)==null?void 0:m.rotation,h??1);let g="over";B===void 0?g="error":B.endType===0?g="over":B.endType===1&&(g="cancelled"),A.flyOverEvent.emit(d,g,e)})),this.d(A.calcFlyToParamEvent.don(()=>{!n&&!s||$A(t,A.id)})),this.d(A.calcFlyInParamEvent.don(async()=>{if(!e.actived)return;const h=await e.getCurrentCameraInfo();if(!h)return;const{position:d,rotation:B}=h;A.flyInParam={position:d,rotation:B,flyDuration:1}})),this.d(e.propChanged.don(h=>{!n&&!s||h.objId===A.id&&Object.keys(h.props).forEach(d=>{const B=h.props[d]===null?void 0:h.props[d];A[d]=B})}))}};C(gt,"type",gt.register("ESUeViewer",p.ESImageryLayer.type,gt));let xn=gt;const ie=class ie extends lA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(ie,"type",ie.register("ESUeViewer",p.ESTerrainLayer.type,ie)),C(ie,"forceUeUpdateProps",[...lA.forceUeUpdateProps,"url"]),C(ie,"propValFuncs",{...lA.propValFuncs,url:A=>typeof A=="string"?p.ESSceneObject.context.getStrFromEnv(A):(A.url=p.ESSceneObject.context.getStrFromEnv(A.url),A),czmMaxzoom:null,czmMinzoom:null});let kn=ie;const Bt=class Bt extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Bt,"type",Bt.register("ESUeViewer",p.ESAlarm.type,Bt));let Gn=Bt;const ft=class ft extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(ft,"type",ft.register("ESUeViewer",p.ESApertureEffect.type,ft));let Nn=ft;const wt=class wt extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(wt,"type",wt.register("ESUeViewer",p.ESGeoPolygon.type,wt));let cA=wt;const pt=class pt extends cA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}const n=()=>{let i=p.ESAreaMeasurement.defaults.fillStyle;try{i={...A.fillStyle??p.ESAreaMeasurement.defaults.fillStyle}}catch(o){console.error("ESAreaMeasurement fillStyle 属性类型错误!",o),i={...p.ESAreaMeasurement.defaults.fillStyle}}i.materialParams=JSON.stringify(i.materialParams),t.callUeFunc({f:"update",p:{id:A.id,stroked:A.stroked??p.ESAreaMeasurement.defaults.stroked,fillStyle:i,filled:A.filled??p.ESAreaMeasurement.defaults.filled}}),console.log(i)},s=this.dv(w.createNextAnimateFrameEvent(A.fillStyleChanged,A.strokedChanged,A.filledChanged));this.d(s.don(n)),this.d(A.createdEvent.don(n))}};C(pt,"type",pt.register("ESUeViewer",p.ESAreaMeasurement.type,pt));let _n=pt;const Ct=class Ct extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Ct,"type",Ct.register("ESUeViewer",p.ESBlastParticleSystem.type,Ct));let Vn=Ct;const Le=class Le extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is underfined!");return}}};C(Le,"type",Le.register("ESUeViewer",p.ESBoxClipping.type,Le)),C(Le,"propValFuncs",{...x.propValFuncs,targetID:A=>{if(!A)return;const e=p.ESSceneObject.getSceneObject(A);return e?e.getMainClass().id:A}});let On=Le;const vt=class vt extends x{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.dispose(A.flyInEvent.don((n,s,i="default")=>{const{id:o,duration:a,position:l,rotation:c}=A;xe(t,o,l,c,a??n,i)})),this.dispose(A.resetWithCurrentCameraEvent.don(()=>{En(t,A.id)})),this.dispose(A.captureEvent.don((n,s)=>{e.capture(n,s).then(o=>{o&&(A.thumbnail=o)})}))}};C(vt,"type",vt.register("ESUeViewer",p.ESCameraView.type,vt));let Wn=vt;const mt=class mt extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(mt,"type",mt.register("ESUeViewer",p.ESCameraVisibleRange.type,mt));let Xn=mt;const Ft=class Ft extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Ft,"type",Ft.register("ESUeViewer",p.ESCar.type,Ft));let Jn=Ft;const Qt=class Qt extends rA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}const n=()=>{let i=p.ESClassification.defaults.fillStyle;try{i={...A.fillStyle??p.ESClassification.defaults.fillStyle}}catch(o){console.error("ESClassification fillStyle 属性类型错误!",o),i={...p.ESClassification.defaults.fillStyle}}i.materialParams=JSON.stringify(i.materialParams),t.callUeFunc({f:"update",p:{id:A.id,filled:A.filled??p.ESClassification.defaults.filled,fillStyle:i}})},s=this.dv(w.createNextAnimateFrameEvent(A.fillStyleChanged,A.filledChanged));this.d(s.don(n)),this.d(A.createdEvent.don(n))}};C(Qt,"type",Qt.register("ESUeViewer",p.ESClassification.type,Qt));let zn=Qt;const be=class be extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is underfined!");return}}};C(be,"type",be.register("ESUeViewer",p.ESClippingPlane.type,be)),C(be,"propValFuncs",{...x.propValFuncs,targetID:A=>{if(!A)return;const e=p.ESSceneObject.getSceneObject(A);return e?e.getMainClass().id:A}});let Yn=be;const Ut=class Ut extends x{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}const n=this.ad(w.reactJson(""));{const o=()=>{if(typeof A.url=="string")n.value=p.ESSceneObject.context.getStrFromEnv(A.url??p.ESDataMesh.defaults.url);else{const a=A.url;a.url=p.ESSceneObject.context.getStrFromEnv(a.url??p.ESDataMesh.defaults.url),n.value=a}};o(),this.ad(A.urlChanged.don(o))}const s=()=>{const o=A.colorStops??p.ESDataMesh.defaults.colorStops;t.callUeFunc({f:"update",p:{id:A.id,url:n.value??p.ESDataMesh.defaults.url,currentTime:A.currentTime??p.ESDataMesh.defaults.currentTime,minPropValue:A.minPropValue??p.ESDataMesh.defaults.minPropValue,maxPropValue:A.maxPropValue??p.ESDataMesh.defaults.maxPropValue,colorStops:JSON.stringify(o)}})},i=this.dv(w.createNextAnimateFrameEvent(n.changed,A.currentTimeChanged,A.minPropValueChanged,A.maxPropValueChanged,A.colorStopsChanged));this.d(i.don(s)),this.d(A.createdEvent.don(s))}};C(Ut,"type",Ut.register("ESUeViewer",p.ESDataMesh.type,Ut));let $n=Ut;const Et=class Et extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Et,"type",Et.register("ESUeViewer",p.ESDatasmithRuntimeModel.type,Et));let Zn=Et;const yt=class yt extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(yt,"type",yt.register("ESUeViewer",p.ESDirectionMeasurement.type,yt));let qn=yt;const St=class St extends rA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}const n=()=>{let i;try{i={...A.strokeStyle??p.ESDistanceMeasurement.defaults.strokeStyle}}catch(o){console.error("ESDistanceMeasurement strokeStyle 属性类型错误!",o),i={...p.ESDistanceMeasurement.defaults.strokeStyle}}t.callUeFunc({f:"update",p:{id:A.id,strokeStyle:i}})},s=this.dv(w.createNextAnimateFrameEvent(A.strokeStyleChanged));this.d(s.don(n)),this.d(A.createdEvent.don(n))}};C(St,"type",St.register("ESUeViewer",p.ESDistanceMeasurement.type,St));let jn=St;const It=class It extends Er{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(It,"type",It.register("ESUeViewer",p.ESLocalPolygon.type,It));let Sr=It;const Tt=class Tt extends Sr{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Tt,"type",Tt.register("ESUeViewer",p.ESDynamicWater.type,Tt));let As=Tt;const Ht=class Ht extends lA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}this.d(e.widgetEvent.don(n=>{if(n.objId!==A.id)return;const{type:s,properties:i}=n;A.widgetEvent.emit({type:s,properties:i})}))}};C(Ht,"type",Ht.register("ESUeViewer",p.ESEntityCluster.type,Ht));let es=Ht;const Me=class Me extends cA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Me,"type",Me.register("ESUeViewer",p.ESExcavate.type,Me)),C(Me,"propValFuncs",{...cA.propValFuncs,targetID:A=>{if(!A)return;const e=p.ESSceneObject.getSceneObject(A);return e?e.getMainClass().id:A}});let ts=Me;const Lt=class Lt extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Lt,"type",Lt.register("ESUeViewer",p.ESFireParticleSystem.type,Lt));let rs=Lt;const bt=class bt extends lA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}const n=this.ad(w.reactJson(""));{const o=()=>{if(typeof A.url=="string")n.value=p.ESSceneObject.context.getStrFromEnv(A.url);else{const a=A.url;a.url=p.ESSceneObject.context.getStrFromEnv(a.url),n.value=a}};o(),this.ad(A.urlChanged.don(o))}const s=()=>{t.callUeFunc({f:"update",p:{id:A.id,url:n.value??p.ESForestTileset.defaults.url,treeTypes:A.treeTypes??p.ESForestTileset.defaults.treeTypes,xiaoBanWidget:A.xiaoBanWidget??p.ESForestTileset.defaults.xiaoBanWidgetDefault,youShiSZ:A.youShiSZ??p.ESForestTileset.defaults.youShiSZ,diLei:A.diLei??p.ESForestTileset.defaults.diLei,senLinLB:A.senLinLB??p.ESForestTileset.defaults.senLinLB,labelMaterial:A.labelMaterial??p.ESForestTileset.defaults.labelMaterial,heightOffset:A.heightOffset??p.ESForestTileset.defaults.heightOffset}})},i=this.dv(w.createNextAnimateFrameEvent(n.changed,A.treeTypesChanged,A.xiaoBanWidgetChanged,A.youShiSZChanged,A.diLeiChanged,A.senLinLBChanged,A.labelMaterialChanged,A.heightOffsetChanged));this.d(i.don(s)),this.d(A.createdEvent.don(s))}};C(bt,"type",bt.register("ESUeViewer",p.ESForestTileset.type,bt));let ns=bt;/*!
|
|
91
|
+
`}}class Ja{static deepCopyGamepad(A){return JSON.parse(JSON.stringify({buttons:A.buttons.map(e=>JSON.parse(JSON.stringify({pressed:e.pressed,touched:e.touched}))),axes:A.axes}))}}class qd{constructor(A){this.toStreamerMessagesProvider=A,this.controllers=[]}updateStatus(A,e,t){if(A.gamepad){const n=e.getPose(A.gripSpace,t);if(!n)return;let s=0;A.profiles.includes("htc-vive")?s=1:A.profiles.includes("oculus-touch")&&(s=2),this.toStreamerMessagesProvider.toStreamerHandlers.get("XRSystem")([s]);let i=2;switch(A.handedness){case"left":i=0;break;case"right":i=1}const o=n.transform.matrix,a=[];for(let d=0;d<16;d++)a[d]=new Float32Array([o[d]])[0];this.toStreamerMessagesProvider.toStreamerHandlers.get("XRControllerTransform")([a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15],i]),this.controllers[i]===void 0&&(this.controllers[i]={prevState:void 0,currentState:void 0,id:void 0},this.controllers[i].prevState=Ja.deepCopyGamepad(A.gamepad)),this.controllers[i].currentState=Ja.deepCopyGamepad(A.gamepad);const l=this.controllers[i],c=l.currentState,h=l.prevState;for(let d=0;d<c.buttons.length;d++){const B=c.buttons[d],g=h.buttons[d];B.pressed?this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonPressed")([i,d,g.pressed?1:0]):!B.pressed&&g.pressed&&this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonReleased")([i,d,0]),B.touched&&!B.pressed?this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonPressed")([i,3,g.touched?1:0]):!B.touched&&g.touched&&this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonReleased")([i,3,0])}for(let d=0;d<c.axes.length;d++)this.toStreamerMessagesProvider.toStreamerHandlers.get("XRAnalog")([i,d,c.axes[d]]);this.controllers[i].prevState=c}}}class za{constructor(A){this.xrSession=null,this.webRtcController=A,this.xrControllers=[],this.xrGamepadController=new qd(this.webRtcController.streamMessageController),this.onSessionEnded=new EventTarget,this.onSessionStarted=new EventTarget,this.onFrame=new EventTarget}xrClicked(){this.xrSession?this.xrSession.end():navigator.xr.requestSession("immersive-vr").then(A=>{this.onXrSessionStarted(A)})}onXrSessionEnded(){u.Log(u.GetStackTrace(),"XR Session ended"),this.xrSession=null,this.onSessionEnded.dispatchEvent(new Event("xrSessionEnded"))}onXrSessionStarted(A){u.Log(u.GetStackTrace(),"XR Session started"),this.xrSession=A,this.xrSession.addEventListener("end",()=>{this.onXrSessionEnded()});const e=document.createElement("canvas");this.gl=e.getContext("webgl2",{xrCompatible:!0}),this.xrSession.updateRenderState({baseLayer:new XRWebGLLayer(this.xrSession,this.gl)});const t=this.gl.createShader(this.gl.VERTEX_SHADER);this.gl.shaderSource(t,Xa.vertexShader()),this.gl.compileShader(t);const n=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(n,Xa.fragmentShader()),this.gl.compileShader(n);const s=this.gl.createProgram();this.gl.attachShader(s,t),this.gl.attachShader(s,n),this.gl.linkProgram(s),this.gl.useProgram(s),this.positionLocation=this.gl.getAttribLocation(s,"a_position"),this.texcoordLocation=this.gl.getAttribLocation(s,"a_texCoord"),this.positionBuffer=this.gl.createBuffer(),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.positionBuffer),this.gl.enableVertexAttribArray(this.positionLocation);const i=this.gl.createTexture();this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.NEAREST),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.NEAREST),this.texcoordBuffer=this.gl.createBuffer(),this.resolutionLocation=this.gl.getUniformLocation(s,"u_resolution"),this.offsetLocation=this.gl.getUniformLocation(s,"u_offset"),A.requestReferenceSpace("local").then(o=>{this.xrRefSpace=o,this.xrSession.requestAnimationFrame((a,l)=>this.onXrFrame(a,l))}),this.onSessionStarted.dispatchEvent(new Event("xrSessionStarted"))}onXrFrame(A,e){const t=e.getViewerPose(this.xrRefSpace);if(t){const n=t.transform.matrix,s=[];for(let o=0;o<16;o++)s[o]=new Float32Array([n[o]])[0];this.webRtcController.streamMessageController.toStreamerHandlers.get("XRHMDTransform")([s[0],s[4],s[8],s[12],s[1],s[5],s[9],s[13],s[2],s[6],s[10],s[14],s[3],s[7],s[11],s[15]]);const i=this.xrSession.renderState.baseLayer;this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,i.framebuffer),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,this.webRtcController.videoPlayer.getVideoElement()),this.render(this.webRtcController.videoPlayer.getVideoElement())}this.webRtcController.config.isFlagEnabled(U.XRControllerInput)&&this.xrSession.inputSources.forEach((n,s,i)=>{this.xrGamepadController.updateStatus(n,e,this.xrRefSpace)},this),this.xrSession.requestAnimationFrame((n,s)=>this.onXrFrame(n,s)),this.onFrame.dispatchEvent(new ya({time:A,frame:e}))}render(A){if(!this.gl)return;const e=this.xrSession.renderState.baseLayer;let t,n,s,i,o;this.gl.viewport(0,0,e.framebufferWidth,e.framebufferHeight),this.gl.uniform4f(this.offsetLocation,1,1,0,0),this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array([0,0,A.videoWidth,0,0,A.videoHeight,0,A.videoHeight,A.videoWidth,0,A.videoWidth,A.videoHeight]),this.gl.STATIC_DRAW),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.texcoordBuffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),this.gl.STATIC_DRAW),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.positionBuffer),t=2,n=this.gl.FLOAT,s=!1,i=0,o=0,this.gl.vertexAttribPointer(this.positionLocation,t,n,s,i,o),this.gl.enableVertexAttribArray(this.texcoordLocation),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.texcoordBuffer),t=2,n=this.gl.FLOAT,s=!1,i=0,o=0,this.gl.vertexAttribPointer(this.texcoordLocation,t,n,s,i,o),this.gl.uniform2f(this.resolutionLocation,A.videoWidth,A.videoHeight);const a=this.gl.TRIANGLES;o=0,this.gl.drawArrays(a,o,6)}static isSessionSupported(A){return navigator.xr?navigator.xr.isSessionSupported(A):new Promise(()=>!1)}}class jd{constructor(A){this.editTextButton=null,this.hiddenInput=null,"ontouchstart"in document.documentElement&&this.createOnScreenKeyboardHelpers(A)}unquantizeAndDenormalizeUnsigned(A,e){return null}createOnScreenKeyboardHelpers(A){this.hiddenInput||(this.hiddenInput=document.createElement("input"),this.hiddenInput.id="hiddenInput",this.hiddenInput.maxLength=0,A.appendChild(this.hiddenInput)),this.editTextButton||(this.editTextButton=document.createElement("button"),this.editTextButton.id="editTextButton",this.editTextButton.innerHTML="edit text",A.appendChild(this.editTextButton),this.editTextButton.classList.add("hiddenState"),this.editTextButton.addEventListener("touchend",e=>{this.hiddenInput.focus(),e.preventDefault()}))}showOnScreenKeyboard(A){if(A.showOnScreenKeyboard){this.editTextButton.classList.remove("hiddenState");const e=this.unquantizeAndDenormalizeUnsigned(A.x,A.y);this.editTextButton.style.top=e.y.toString()+"px",this.editTextButton.style.left=(e.x-40).toString()+"px"}else this.editTextButton.classList.add("hiddenState"),this.hiddenInput.blur()}}class Au{constructor(A,e){this._showActionOrErrorOnDisconnect=!0,this.allowConsoleCommands=!1,this.config=A,e!=null&&e.videoElementParent&&(this._videoElementParent=e.videoElementParent),this._eventEmitter=new Ia,this.configureSettings(),this.setWebRtcPlayerController(new Wa(this.config,this)),this.onScreenKeyboardHelper=new jd(this.videoElementParent),this.onScreenKeyboardHelper.unquantizeAndDenormalizeUnsigned=(t,n)=>this._webRtcController.requestUnquantizedAndDenormalizeUnsigned(t,n),this._activateOnScreenKeyboard=t=>this.onScreenKeyboardHelper.showOnScreenKeyboard(t),this._webXrController=new za(this._webRtcController)}get videoElementParent(){return this._videoElementParent||(this._videoElementParent=document.createElement("div"),this._videoElementParent.id="videoElementParent"),this._videoElementParent}configureSettings(){this.config._addOnSettingChangedListener(U.IsQualityController,A=>{A!==!0||this._webRtcController.isQualityController||this._webRtcController.sendRequestQualityControlOwnership()}),this.config._addOnSettingChangedListener(U.AFKDetection,A=>{this._webRtcController.setAfkEnabled(A)}),this.config._addOnSettingChangedListener(U.MatchViewportResolution,()=>{this._webRtcController.videoPlayer.updateVideoStreamSize()}),this.config._addOnSettingChangedListener(U.HoveringMouseMode,A=>{this.config.setFlagLabel(U.HoveringMouseMode,`Control Scheme: ${A?"Hovering":"Locked"} Mouse`),this._webRtcController.setMouseInputEnabled(this.config.isFlagEnabled(U.MouseInput))}),this.config._addOnSettingChangedListener(U.KeyboardInput,A=>{this._webRtcController.setKeyboardInputEnabled(A)}),this.config._addOnSettingChangedListener(U.MouseInput,A=>{this._webRtcController.setMouseInputEnabled(A)}),this.config._addOnSettingChangedListener(U.TouchInput,A=>{this._webRtcController.setTouchInputEnabled(A)}),this.config._addOnSettingChangedListener(U.GamepadInput,A=>{this._webRtcController.setGamePadInputEnabled(A)}),this.config._addOnNumericSettingChangedListener(D.MinQP,A=>{u.Log(u.GetStackTrace(),"-------- Sending MinQP --------",7),this._webRtcController.sendEncoderMinQP(A),u.Log(u.GetStackTrace(),"-------------------------------------------",7)}),this.config._addOnNumericSettingChangedListener(D.MaxQP,A=>{u.Log(u.GetStackTrace(),"-------- Sending encoder settings --------",7),this._webRtcController.sendEncoderMaxQP(A),u.Log(u.GetStackTrace(),"-------------------------------------------",7)}),this.config._addOnNumericSettingChangedListener(D.WebRTCMinBitrate,A=>{u.Log(u.GetStackTrace(),"-------- Sending web rtc settings --------",7),this._webRtcController.sendWebRTCMinBitrate(1e3*A),u.Log(u.GetStackTrace(),"-------------------------------------------",7)}),this.config._addOnNumericSettingChangedListener(D.WebRTCMaxBitrate,A=>{u.Log(u.GetStackTrace(),"-------- Sending web rtc settings --------",7),this._webRtcController.sendWebRTCMaxBitrate(1e3*A),u.Log(u.GetStackTrace(),"-------------------------------------------",7)}),this.config._addOnNumericSettingChangedListener(D.WebRTCFPS,A=>{u.Log(u.GetStackTrace(),"-------- Sending web rtc settings --------",7),this._webRtcController.sendWebRTCFps(A),u.Log(u.GetStackTrace(),"-------------------------------------------",7)}),this.config._addOnOptionSettingChangedListener(V.PreferredCodec,A=>{this._webRtcController&&this._webRtcController.setPreferredCodec(A)}),this.config._registerOnChangeEvents(this._eventEmitter)}_activateOnScreenKeyboard(A){throw new Error("Method not implemented.")}_onInputControlOwnership(A){this._inputController=A}setWebRtcPlayerController(A){this._webRtcController=A,this._webRtcController.setPreferredCodec(this.config.getSettingOption(V.PreferredCodec).selected),this._webRtcController.resizePlayerStyle(),this.checkForAutoConnect()}connect(){this._eventEmitter.dispatchEvent(new Ba),this._webRtcController.connectToSignallingServer()}reconnect(){this._eventEmitter.dispatchEvent(new wa),this._webRtcController.restartStreamAutomatically()}disconnect(){this._eventEmitter.dispatchEvent(new fa),this._webRtcController.close()}play(){this._onStreamLoading(),this._webRtcController.playStream()}checkForAutoConnect(){this.config.isFlagEnabled(U.AutoConnect)&&(this._onWebRtcAutoConnect(),this._webRtcController.connectToSignallingServer())}_onWebRtcAutoConnect(){this._eventEmitter.dispatchEvent(new sa),this._showActionOrErrorOnDisconnect=!0}_onWebRtcSdp(){this._eventEmitter.dispatchEvent(new na)}_onStreamLoading(){this._eventEmitter.dispatchEvent(new ga)}_onDisconnect(A){this._webRtcController.getDisconnectMessageOverride()!=""&&this._webRtcController.getDisconnectMessageOverride()!==void 0&&this._webRtcController.getDisconnectMessageOverride()!=null&&(A=this._webRtcController.getDisconnectMessageOverride(),this._webRtcController.setDisconnectMessageOverride("")),this._eventEmitter.dispatchEvent(new la({eventString:A,showActionOrErrorOnDisconnect:this._showActionOrErrorOnDisconnect})),this._showActionOrErrorOnDisconnect==0&&(this._showActionOrErrorOnDisconnect=!0)}_onWebRtcConnecting(){this._eventEmitter.dispatchEvent(new ia)}_onWebRtcConnected(){this._eventEmitter.dispatchEvent(new oa)}_onWebRtcFailed(){this._eventEmitter.dispatchEvent(new aa)}_onVideoInitialized(){this._eventEmitter.dispatchEvent(new ha),this._videoStartTime=Date.now()}_onLatencyTestResult(A){this._eventEmitter.dispatchEvent(new Ua({latencyTimings:A}))}_onVideoStats(A){this._videoStartTime&&this._videoStartTime!==void 0||(this._videoStartTime=Date.now()),A.handleSessionStatistics(this._videoStartTime,this._inputController,this._webRtcController.videoAvgQp),this._eventEmitter.dispatchEvent(new Fa({aggregatedStats:A}))}_onVideoEncoderAvgQP(A){this._eventEmitter.dispatchEvent(new ra({avgQP:A}))}_onInitialSettings(A){var e;this._eventEmitter.dispatchEvent(new Ea({settings:A})),A.PixelStreamingSettings&&(this.allowConsoleCommands=(e=A.PixelStreamingSettings.AllowPixelStreamingCommands)!==null&&e!==void 0&&e,this.allowConsoleCommands===!1&&u.Info(u.GetStackTrace(),"-AllowPixelStreamingCommands=false, sending arbitrary console commands from browser to UE is disabled."));const t=this.config.useUrlParams,n=new URLSearchParams(window.location.search);A.EncoderSettings&&(this.config.setNumericSetting(D.MinQP,t&&n.has(D.MinQP)?Number.parseInt(n.get(D.MinQP)):A.EncoderSettings.MinQP),this.config.setNumericSetting(D.MaxQP,t&&n.has(D.MaxQP)?Number.parseInt(n.get(D.MaxQP)):A.EncoderSettings.MaxQP)),A.WebRTCSettings&&(this.config.setNumericSetting(D.WebRTCMinBitrate,t&&n.has(D.WebRTCMinBitrate)?Number.parseInt(n.get(D.WebRTCMinBitrate)):A.WebRTCSettings.MinBitrate/1e3),this.config.setNumericSetting(D.WebRTCMaxBitrate,t&&n.has(D.WebRTCMaxBitrate)?Number.parseInt(n.get(D.WebRTCMaxBitrate)):A.WebRTCSettings.MaxBitrate/1e3),this.config.setNumericSetting(D.WebRTCFPS,t&&n.has(D.WebRTCFPS)?Number.parseInt(n.get(D.WebRTCFPS)):A.WebRTCSettings.FPS))}_onQualityControlOwnership(A){this.config.setFlagEnabled(U.IsQualityController,A)}_onPlayerCount(A){this._eventEmitter.dispatchEvent(new Sa({count:A}))}requestLatencyTest(){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.sendLatencyTest(),!0)}requestShowFps(){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.sendShowFps(),!0)}requestIframe(){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.sendIframeRequest(),!0)}emitUIInteraction(A){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.emitUIInteraction(A),!0)}emitCommand(A){return!(!this._webRtcController.videoPlayer.isVideoReady()||!this.allowConsoleCommands&&"ConsoleCommand"in A||(this._webRtcController.emitCommand(A),0))}emitConsoleCommand(A){return!(!this.allowConsoleCommands||!this._webRtcController.videoPlayer.isVideoReady()||(this._webRtcController.emitConsoleCommand(A),0))}addResponseEventListener(A,e){this._webRtcController.responseController.addResponseEventListener(A,e)}removeResponseEventListener(A){this._webRtcController.responseController.removeResponseEventListener(A)}dispatchEvent(A){return this._eventEmitter.dispatchEvent(A)}addEventListener(A,e){this._eventEmitter.addEventListener(A,e)}removeEventListener(A,e){this._eventEmitter.removeEventListener(A,e)}toggleXR(){this.webXrController.xrClicked()}setSignallingUrlBuilder(A){this._webRtcController.signallingUrlBuilder=A}get webSocketController(){return this._webRtcController.webSocketController}get webXrController(){return this._webXrController}}H.Dz,H.g$,H.Lt,H.Q9,H.qf,H.hV,H.z$,H.J0;var Ya=H.De;H.$C,H.al,H._W,H.tz,H.Nu,H.zg,H.vp;var pe=H.vU;H.wF,H.rv,H.Nh,H.ss,H.qW,H.QL,H.cf,H.eM;var $a=H.Yd;H.iM,H.qy,H.ce;var Za=H.sK;H.Ok,H.q5;var qa=H.g;H.xl,H.I,H.bx,H.dD,H.Ib,H.Az,H.Iw,H.qY,H.db,H.mR,H.Tn,H.rV,H.gh,H.Mi,H.j,H.YB,H.i5;var eu=H.x_;H.Am,H.eR,H.r8,H.u3,H.vd,H.iV,H.jZ,H.SW,H.ZH,H.Ni,H.lh,H.bq,H.$f,H.eu,H.Ax,H.Mc;const tu={Response:1},Ur={UIInteraction:50,MouseWheel:75};class ru extends w.HasOwner{constructor(e,t){super(e);C(this,"_processResponseFn",e=>this.esUeViewer.processResponse(e));C(this,"_inner");this._uri=t,this._inner=new WebSocket(this._uri),this.d(()=>{this._inner.close()}),this._innerInit()}get esUeViewer(){return this.owner}get uri(){return this._uri}get inner(){return this._inner}_innerInit(){this.inner.onmessage=e=>{if(this.isDestroyed())return;let t=new FileReader;t.onload=n=>{if(this.isDestroyed())return;let s=n.target.result,i=new Uint32Array(s),o=0;if(i[0]===tu.Response){o+=4;let a=i[o/4];o+=4;for(let l=0;l<a;l++){let c=i[o/4];o+=4;let h=new TextDecoder("utf-8").decode(s.slice(o,o+c));o+=c,this._processResponseFn(h)}}},t.readAsArrayBuffer(e.data)},this.inner.onopen=()=>{this.isDestroyed()||(console.warn("earthsdk message websocket server connected:",this.uri),console.log("%c[EarthSDK websocket open]","background: #a6ec99; color: black","open"),this.owner.dispatchEvent(new CustomEvent("esmsgwsopen",{detail:"websocket open"})))},this._inner.onclose=e=>{this.isDestroyed()||(console.log("%c[EarthSDK websocket close ]","background: red; color: black","error"),this.owner.dispatchEvent(new CustomEvent("error",{detail:"websocket close"})))},this._inner.onerror=e=>{this.isDestroyed()||(console.log("%c[EarthSDK websocket error ]","background: red; color: black","error"),this.owner.dispatchEvent(new CustomEvent("error",{detail:"websocket error"})))}}sendInputData(e){const t=this.inner;if(t.readyState!==WebSocket.OPEN)return;const s=new Uint8Array(e)[0];if(s>=Ur.UIInteraction&&s<=Ur.MouseWheel){const i=new ArrayBuffer(e.byteLength+4);return new DataView(i).setUint32(0,e.byteLength,!0),new Uint8Array(i,4).set(new Uint8Array(e)),t.send(new DataView(i)),!0}else return!1}emitDescriptorWithString(e,t){let n=new TextEncoder().encode(t),s=new DataView(new ArrayBuffer(3+n.length)),i=0;s.setUint8(i,e),i++,s.setUint16(i,n.length,!0),i+=2;for(let o=0;o<n.length;o++)s.setUint8(i,n[o]),i+=1;try{this.sendInputData(s.buffer)}catch(o){console.error(`data.buffer.size: ${s.buffer.byteLength} 独立通道 sendInputData error: ${o}`,o)}}destroyImpl(){this._inner&&this._inner.close()}}window.g_emitDescriptor_maxBytes=3e4;let nu=-1;$a.SetLoggerVerbosity(1);class su extends w.Destroyable{constructor(e,t){super();C(this,"_eventTarget",new EventTarget);C(this,"debug",!1);C(this,"uiInteractionCallbacks",new Map);C(this,"_pixelStream");C(this,"_esMsgWsWrapper");this._domOrDomId=e,this._options=t;const n=typeof this._domOrDomId=="string"?document.getElementById(this._domOrDomId):this._domOrDomId;if(!n)throw new Error(`ESUEViewer container${this._domOrDomId} error!`);console.log(`PSUEViewer init _options ${this._options}`);const{url:s,esmsgWsUri:i}=this._options;this._pixelStream=this._initPixelStream(n,s),this.d(()=>{this._pixelStream.disconnect()}),this._handerPixelStreamEvent(),this._esMsgWsWrapper=this._initEsMsgWsWrapper(i);const o=this;if(o.esMsgWsWrapper){const a=o.webRtcController.sendMessageController.dataChannelSender.sendData;o.webRtcController.sendMessageController.dataChannelSender.constructor.prototype.sendData=function(l){o.esMsgWsWrapper?o.esMsgWsWrapper.sendInputData(l):a.call(this,l)}}}get eventTarget(){return this._eventTarget}addEventListener(e,t,n){return this.eventTarget.addEventListener(e,t,n)}removeEventListener(e,t,n){return this.eventTarget.removeEventListener(e,t,n)}dispatchEvent(e){return this.eventTarget.dispatchEvent(e)}_initPixelStream(e,t){const n=new Ya({initialSettings:{AutoPlayVideo:!0,AutoConnect:!0,StartVideoMuted:!1,SuppressBrowserKeys:!1,[eu.SignallingServerUrl]:t}});return n.setFlagEnabled(pe.BrowserSendOffer,!1),n.setFlagEnabled(pe.HoveringMouseMode,!0),n.setFlagEnabled(pe.MatchViewportResolution,!0),n.setNumericSetting(Za.MaxReconnectAttempts,0),new qa(n,{videoElementParent:e})}get pixelStream(){return this._pixelStream}_initEsMsgWsWrapper(e){return e?this.dv(new ru(this,e)):void 0}get esMsgWsWrapper(){return this._esMsgWsWrapper}get esWebSocketReady(){var e;return((e=this.esMsgWsWrapper)==null?void 0:e.inner.readyState)===1}_handerPixelStreamEvent(){this.pixelStream.addEventListener("videoInitialized",()=>{console.log("%c[EarthSDK webrtc videoInitialized]","background: #a6ec99; color: black","videoInitialized"),this.dispatchEvent(new CustomEvent("videoinited",{detail:"videoinited"}))}),this.pixelStream.addEventListener("webRtcFailed",()=>{this.isDestroyed()||(console.log("%c[EarthSDK webRtc webRtcFailed]","background: red; color: black","webRtcFailed"),this.dispatchEvent(new CustomEvent("error",{detail:"webRtcFailed"})),this.pixelStream.disconnect())}),this.pixelStream.addEventListener("webRtcDisconnected",()=>{this.isDestroyed()||(console.log("%c[EarthSDK webRtc webRtcDisconnected]","background: red; color: black","webRtcDisconnected"),this.dispatchEvent(new CustomEvent("error",{detail:"webRtcDisconnected"})),this.pixelStream.disconnect())}),this.pixelStream.addEventListener("webRtcConnected",()=>{this.isDestroyed()||(console.log("%c[EarthSDK webrtc webRtcConnected]","background: #a6ec99; color: black","webRtcConnected"),this.dispatchEvent(new CustomEvent("webRtcConnected",{detail:"webRtcConnected"})))}),this.pixelStream.addResponseEventListener("esueviewer",e=>{this.processResponse(e)})}resolveCallback(e){let t={};try{t=JSON.parse(e)}catch{return!1}let n=t.callid;if(typeof n!="string"||!this.uiInteractionCallbacks.has(n))return!1;let s=this.uiInteractionCallbacks.get(n);return typeof s!="function"?!1:(s(t),this.uiInteractionCallbacks.delete(n),!0)}processResponse(e){if(this.debug??!1)try{const t=JSON.parse(e);if(t.ers=t.ers&&t.ers.filter(n=>n.et!=="mouseMoveEvent"),!(t.ers&&t.ers.length>0||t.frs&&t.frs.length>0))return;console.group("%cUE => JS"," background-color:#006EFF;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(t,void 0,"")}`," border:1px dashed #006EFF;border-radius:5px;padding:10px;line-height:25px;color:#006EFF;"),console.groupEnd()}catch(t){console.error(`processResponse(${e}) error: ${t}`,t)}this.resolveCallback(e)||this.dispatchEvent(new CustomEvent("ueevent",{detail:e}))}emitUIInteraction(e,t){typeof t=="function"&&(e.callid=w.createGuid(),this.uiInteractionCallbacks.set(e.callid,t)),this.pixelStream.emitUIInteraction(e)}get webRtcController(){return this.pixelStream._webRtcController}emitUIInteractionForBigData(e,t){typeof t=="function"&&(e.callid=w.createGuid(),this.uiInteractionCallbacks.set(e.callid,t));const n=JSON.stringify(e),s=window.g_emitDescriptor_maxBytes,i=n.length,o=++nu;if(this.esMsgWsWrapper){if(i<s){this.esMsgWsWrapper.emitDescriptorWithString(Ur.UIInteraction,`${o}-0/1-`+n);return}const a=Math.ceil(i/s)|0;[...new Array(a).keys()].map(c=>n.slice(c*s,(c+1)*s)).forEach((c,h)=>{this.esMsgWsWrapper&&this.esMsgWsWrapper.emitDescriptorWithString(Ur.UIInteraction,`${o}-${h}/${a}-`+c)})}}emitCommand(e){this.pixelStream.emitCommand(e)}getVideoSize(){const e=this.webRtcController.videoPlayer.getVideoElement();return{width:e.videoWidth,height:e.videoHeight}}resizeUEVideo(e,t){let n={Resolution:{Width:e,Height:t}};console.log(`resizeUEVideo emitCommand ${e} ${t} begin`),this.emitCommand(n)}}class iu extends w.Destroyable{constructor(e,t,n){super();C(this,"_instance");C(this,"_event",this.dv(new w.Event));this._container=e,this._wsuri=t,this._esmsgWsUri=n,this._instance=this.dv(new su(this._container,{url:this._wsuri,esmsgWsUri:this._esmsgWsUri})),this.instanceInit()}get webSocketReady(){return this._instance.esWebSocketReady}get event(){return this._event}get debug(){return this._instance.debug}set debug(e){this._instance.debug=e}instanceInit(){if("addEventListener"in this._instance){["esmsgwsopen","error","videoinited","ueevent","webRtcConnected"].forEach(t=>{const n=s=>{this._event.emit(t,s.detail)};this._instance.addEventListener(t,n),this.dispose(()=>this._instance.removeEventListener(t,n))});return}this.dispose(this._instance.errorEvent.disposableOn(e=>{this._event.emit("error",e.detail)})),this.dispose(this._instance.webRtcConnectedEvent.disposableOn(e=>{this._event.emit("webRtcConnected",e.detail)})),this.dispose(this._instance.videoinitedEvent.disposableOn(e=>{this._event.emit("videoinited",e.detail)})),this.dispose(this._instance.ueevent.disposableOn(e=>{this._event.emit("ueevent",e.detail)}))}emitUIInteractionForBigData(e,t){return new Promise((n,s)=>{const i=(...o)=>{n(o),t&&t(...o)};try{this._instance.emitUIInteractionForBigData(e,i)}catch(o){console.warn(`emitUIInteraction发生错误:${o}`),s(o)}})}getVideoSize(){return this._instance.getVideoSize()}resize(e,t){this._instance.resizeUEVideo(e,t)}}class ou extends Ve{constructor(e,t,n,s){super();C(this,"_esueViewerWrapper");C(this,"_ueFuncResultWithIdsEvent",this.dv(new w.Event));C(this,"_ueFuncWithIdAndResultCallbacks",[]);C(this,"_waitingUeFuncIdAndResultCallbacks",new Map);C(this,"_waitingUeCalls",new Set);C(this,"_ueEvent",this.dv(new w.Event));C(this,"_errorEvent",this.dv(new w.Event));C(this,"_readyEvent",this.dv(new w.Event));C(this,"_esmsgwsopen",this.dv(w.react(!1)));C(this,"_videoinited",this.dv(w.react(!1)));C(this,"_webRtcConnected",this.dv(w.react(!1)));this._ueViewer=s,console.log("CSTMPSViewer init ! 以官方像素流 + 独立通信的模式启动!");const i=this._ueViewer;this._esueViewerWrapper=this.dv(new iu(e,t,n));const o=this._esueViewerWrapper;{const B=()=>o.debug=i.debug??!1;B(),this.d(i.debugChanged.don(B))}let a=!1;{const B=()=>{if(a)return;const g=o.webSocketReady;if(this.videoinited&&this.webRtcConnected&&g){console.log("%c[EarthSDK: esmsgWebSocket && videoinited && webRtcConnected]","background: #a6ec99; color: black");const f={eventType:"init",params:{}};o.emitUIInteractionForBigData(f),this._readyEvent.emit(),a=!0}};this.d(this.videoinitedChanged.don(()=>{B()})),this.d(this.webRtcConnectedChanged.don(()=>{B()})),this.d(this.esmsgwsopenChanged.don(()=>{B()}))}this.d(o.event.don((B,g)=>{if(B==="error")this._errorEvent.emit(g);else if(B==="ueevent"){const f=JSON.parse(g);if(f.t==="cr"){const m=f;if(m.frs&&this._ueFuncResultWithIdsEvent.emit(m.frs),m.ers)for(let F of m.ers)this._ueEvent.emit(F)}}else B==="webRtcConnected"?this.webRtcConnected=!0:B==="videoinited"?this.videoinited=!0:B==="esmsgwsopen"&&(this.esmsgwsopen=!0)}));{const B=this.dv(w.createAnimateFrame());let g,f;B.start(()=>{if(g!==e.offsetWidth||f!==e.offsetHeight){if(g=e.offsetWidth,f=e.offsetHeight,g===void 0||f===void 0||!Number.isFinite(g)||!Number.isFinite(f)||g<0||f<0){console.warn(`lastWidth === undefined || lastHeight === undefined || !Number.isFinite(lastWidth) || !Number.isFinite(lastHeight) || lastWidth < 0 || lastHeight < 0 ${g} ${f}`);return}o.resize(g,f),console.log(`resize: ${g} ${f}`)}})}this.d(this._ueFuncResultWithIdsEvent.don(B=>{for(const g of B){const f=this._waitingUeFuncIdAndResultCallbacks.get(g.fid);f&&(this._waitingUeFuncIdAndResultCallbacks.delete(g.fid),f.resultCallback(g.r))}}));let l=0;const c=B=>{const g={n:l++,tt:Date.now(),t:"c",fs:B};this._waitingUeCalls.add(g),i.debug&&(console.group("%cxe2 => ue"," background-color:green;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(g,void 0,"")}`," border:1px dashed green;border-radius:5px;padding:10px;line-height:25px;color:green;"),console.groupEnd()),this._esueViewerWrapper.emitUIInteractionForBigData(g,()=>{this._waitingUeCalls.delete(g)})},h=()=>{if(!a||this._ueFuncWithIdAndResultCallbacks.length===0)return;const B=this._ueFuncWithIdAndResultCallbacks.map(([g])=>g);for(const[g,f]of this._ueFuncWithIdAndResultCallbacks)this._waitingUeFuncIdAndResultCallbacks.set(g.fid,f);this._ueFuncWithIdAndResultCallbacks.length=0;{const g=window.g_emitDescriptor_maxBytes,f=B.map(L=>({f:L,s:JSON.stringify(L).length}));let m=f.length,F=0,Q=0,y=[];do{do{const{f:L,s:T}=f[F];if(y.push(L),++F,Q+T>g||y.length>=20)break}while(F<m);y.length>0&&(i.debug&&console.log(`传送${y.length}条消息...`),c([...y]),y.length=0,Q=0)}while(F<m)}};this.dv(w.createInterval()).start(h,50),this.d(()=>console.log("UeCloudViewer正在销毁..."))}get esueViewerWrapper(){return this._esueViewerWrapper}get errorEvent(){return this._errorEvent}get readyEvent(){return this._readyEvent}get esmsgwsopen(){return this._esmsgwsopen.value}set esmsgwsopen(e){this._esmsgwsopen.value=e}get esmsgwsopenChanged(){return this._esmsgwsopen.changed}get videoinited(){return this._videoinited.value}set videoinited(e){this._videoinited.value=e}get videoinitedChanged(){return this._videoinited.changed}get webRtcConnected(){return this._webRtcConnected.value}set webRtcConnected(e){this._webRtcConnected.value=e}get webRtcConnectedChanged(){return this._webRtcConnected.changed}resize(e,t){this.esueViewerWrapper.resize(e,t)}callUeFunc(e){return new Promise(t=>{const s={fid:w.createGuid(),...e};this._ueFuncWithIdAndResultCallbacks.push([s,{timeStamp:Date.now(),ueFunc:e,resultCallback:t}])})}disposableOnUeEvent(e,t){(this._ueViewer.debug??!1)&&console.log(`disposableOnUeEvent from UeCloudViewer, type:${e}`);const n=w.createGuid();this.callUeFunc({f:"addEventListener",p:{et:e,eid:n}});const s=()=>{this.callUeFunc({f:"removeEventListener",p:{eid:n}})},i=this._ueEvent.don(o=>{o.et===e&&o.eid===n&&t(o)});return()=>{i(),s()}}}function au(r){let A="";const e=new Uint8Array(r),t=e.length;for(let n=0;n<t;n++)A+=String.fromCharCode(e[n]);return btoa(A)}const lu=r=>{const A={type:"input",inputdata:au(r)};return JSON.stringify(A)};function cu(r){return typeof r=="string"?document.getElementById(r):r}window.g_emitDescriptor_maxBytes=3e4,console.log("全局可设置消息体最大字节, window.g_emitDescriptor_maxBytes 默认 30000 。");let du=-1;$a.SetLoggerVerbosity(1);class uu extends w.Destroyable{constructor(e,t){super();C(this,"debug",!1);C(this,"_error",this.dv(new w.Event));C(this,"_connected",this.dv(new w.Event));C(this,"_ueevent",this.dv(new w.Event));C(this,"_pixelStream");C(this,"uiInteractionCallbacks",new Map);this._container=e,this._option=t;const n=new Ya({initialSettings:{HoveringMouse:!0,AutoPlayVideo:!0,AutoConnect:!0,StartVideoMuted:!1,SuppressBrowserKeys:!1,ss:this._option.ws},useUrlParams:!0});n.setFlagEnabled(pe.BrowserSendOffer,!1),n.setFlagEnabled(pe.HoveringMouseMode,!0),n.setFlagEnabled(pe.MatchViewportResolution,!0),n.setNumericSetting(Za.MaxReconnectAttempts,0),this._pixelStream=new qa(n,{videoElementParent:this.container}),this.d(()=>{this._pixelStream.disconnect()});{const s=this.pixelStream.webSocketController.webSocket,i=this._pixelStream._webRtcController.sendMessageController.dataChannelSender.sendData;this._pixelStream._webRtcController.sendMessageController.dataChannelSender.constructor.prototype.sendData=function(o){s?s.send(lu(o)):i.call(this,o)}}{const s=i=>{const o=this._pixelStream._webRtcController.mouseController;setTimeout(()=>{const a=o.coordinateConverter.normalizeAndQuantizeUnsigned(i.offsetX,i.offsetY),c=o.toStreamerMessagesProvider.toStreamerHandlers.get("MouseUp");c&&c([i.button,a.x,a.y]),i.preventDefault()})};this.container.addEventListener("dblclick",s),this.d(()=>{this.container.removeEventListener("dblclick",s)})}["error","close","open"].forEach(i=>{const o=()=>{this.isDestroyed()||(i==="open"?this.connected.emit("webSocketOpen"):i==="close"?this.error.emit("webSocketClose"):i==="error"&&this.error.emit("webSocketError"))};this.pixelStream.webSocketController.webSocket.addEventListener(i,o),this.d(()=>{this.pixelStream.webSocketController.webSocket.removeEventListener(i,o)})}),["videoInitialized","webRtcConnected","webRtcDisconnected","webRtcFailed"].forEach(i=>{const o=()=>{this.isDestroyed()||(i==="webRtcConnected"||i==="videoInitialized"?this.connected.emit(i):(i==="webRtcDisconnected"||i==="webRtcFailed")&&(this.error.emit(i),this.pixelStream.disconnect()))};this.pixelStream.addEventListener(i,o),this.d(()=>{this.pixelStream.removeEventListener(i,o)})}),this.pixelStream.addResponseEventListener("handle_responses",s=>{this.processResponse(s)}),this.d(()=>{this.pixelStream.removeResponseEventListener("handle_responses")})}get error(){return this._error}get connected(){return this._connected}get ueevent(){return this._ueevent}get container(){return cu(this._container)}get pixelStream(){return this._pixelStream}get webSocketReady(){return this.pixelStream.webSocketController.webSocket.readyState===1}processResponse(e){if(this.debug??!1)try{const t=JSON.parse(e);console.group("%cUE => JS"," background-color:#006EFF;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(t,void 0,"")}`," border:1px dashed #006EFF;border-radius:5px;padding:10px;line-height:25px;color:#006EFF;"),console.groupEnd()}catch(t){console.error(`processResponse(${e}) error: ${t}`,t)}this.resolveCallback(e)||this.ueevent.emit(e)}emitUIInteractionForBigData(e,t){typeof t=="function"&&(e.callid=w.createGuid(),this.uiInteractionCallbacks.set(e.callid,t));const n=JSON.stringify(e),s=window.g_emitDescriptor_maxBytes??3e4,i=n.length,o=++du;if(i<s){const c={type:"earthsdk",time:new Date().getTime(),params:`${o}-0/1-`+n};this.sendData(JSON.stringify(c));return}const a=Math.ceil(i/s)|0;[...new Array(a).keys()].map(c=>n.slice(c*s,(c+1)*s)).forEach((c,h)=>{const d={type:"earthsdk",time:new Date().getTime(),params:`${o}-${h}/${a}-`+c};this.sendData(JSON.stringify(d))})}sendData(e){this.pixelStream.webSocketController.webSocket.send(e)}resolveCallback(e){let t={};try{t=JSON.parse(e)}catch{return!1}let n=t.callid;if(typeof n!="string"||!this.uiInteractionCallbacks.has(n))return!1;let s=this.uiInteractionCallbacks.get(n);return typeof s!="function"?!1:(s(t),this.uiInteractionCallbacks.delete(n),!0)}getVideoSize(){const e=this._pixelStream._webRtcController.videoPlayer.getVideoElement();return{width:e.videoWidth,height:e.videoHeight}}emitCommand(e){this.pixelStream.emitCommand(e)}emitUIInteraction(){console.log("emitUIInteraction 像素流初始化"),this.pixelStream.emitUIInteraction("像素流初始化")}resizeUEVideo(e,t){const n={Resolution:{Width:e,Height:t}};console.log(`resizeUEVideo emitCommand ${e} ${t} begin`),this.emitCommand(n)}}class hu extends w.Destroyable{constructor(e,t,n){super();C(this,"_instance");C(this,"_event",this.dv(new w.Event));this._container=e,this._wsuri=t,this._esmsgWsUri=n,this._instance=this.dv(new uu(this._container,{ws:this._wsuri})),this.d(this._instance.connected.don(s=>{this._event.emit(s,s),console.log(`%c[EarthSDK] ${s}`,"background: #a6ec99; color: black")})),this.d(this._instance.error.don(s=>{this._event.emit("errorEvent",s),console.log(`%c[EarthSDK] ${s}`,"background: red; color: black")})),this.d(this._instance.ueevent.don(s=>{this._event.emit("ueevent",s)}))}get instance(){return this._instance}get event(){return this._event}get debug(){return this._instance.debug}set debug(e){this._instance.debug=e}emitUIInteractionForBigData(e,t){return new Promise((n,s)=>{const i=(...o)=>{n(o),t&&t(...o)};try{this._instance.emitUIInteractionForBigData(e,i)}catch(o){console.warn(`emitUIInteraction发生错误:${o}`),s(o)}})}getVideoSize(){return this._instance.getVideoSize()}resize(e,t){this._instance.resizeUEVideo(e,t)}}class gu extends Ve{constructor(e,t,n,s){super();C(this,"_videoInitialized",this.dv(w.react(!1)));C(this,"_webRtcConnected",this.dv(w.react(!1)));C(this,"_webSocketOpen",this.dv(w.react(!1)));C(this,"_ue5ViewerWrapper");C(this,"_ueFuncResultWithIdsEvent",this.dv(new w.Event));C(this,"_ueFuncWithIdAndResultCallbacks",[]);C(this,"_waitingUeFuncIdAndResultCallbacks",new Map);C(this,"_waitingUeCalls",new Set);C(this,"_ueEvent",this.dv(new w.Event));C(this,"_errorEvent",this.dv(new w.Event));C(this,"_readyEvent",this.dv(new w.Event));this._ueViewer=s,console.log("INNPSViewer init ! 以内置信令服务器模式启动!");const i=this._ueViewer,o=this.dv(new hu(e,t,n));this._ue5ViewerWrapper=o;{const d=()=>o.debug=i.debug??!1;d(),this.d(i.debugChanged.don(d))}{let d=!1;const B=this.dv(w.createNextAnimateFrameEvent(this._videoInitialized.changed,this._webRtcConnected.changed,this._webSocketOpen.changed));this.d(B.don(()=>{if(d)return;const g=this._ue5ViewerWrapper.instance.webSocketReady;if(this.videoInitialized&&this.webRtcConnected&&g){this._ue5ViewerWrapper.instance.emitUIInteraction(),this._readyEvent.emit(),d=!0,console.log("%c[EarthSDK videoInitialized && webRtcConnected && webSocketReady]","background: #a6ec99; color: black");const f={eventType:"init",params:{}};this._ue5ViewerWrapper.emitUIInteractionForBigData(f)}else console.warn("webSocketReady",g),d=!1}))}this.d(o.event.don((d,B)=>{if(d==="errorEvent")this._errorEvent.emit(B);else if(d==="videoInitialized")this._videoInitialized.value=!0;else if(d==="webRtcConnected")this._webRtcConnected.value=!0;else if(d==="webSocketOpen")this._webSocketOpen.value=!0;else if(d==="ueevent"){const g=JSON.parse(B);if(g.t==="cr"){const f=g;if(f.frs&&this._ueFuncResultWithIdsEvent.emit(f.frs),f.ers)for(let m of f.ers)this._ueEvent.emit(m)}}}));{const d=this.dv(w.createAnimateFrame());let B,g,f;d.start(()=>{if(B!==e.offsetWidth||g!==e.offsetHeight||f!==i.resolutionScale){if(B=e.offsetWidth,g=e.offsetHeight,B===void 0||g===void 0||!Number.isFinite(B)||!Number.isFinite(g)||B<0||g<0){console.warn(`lastWidth === undefined || lastHeight === undefined || !Number.isFinite(lastWidth) || !Number.isFinite(lastHeight) || lastWidth < 0 || lastHeight < 0 ${B} ${g}`);return}f=i.resolutionScale,o.resize(B/f,g/f)}})}this.d(this._ueFuncResultWithIdsEvent.don(d=>{for(const B of d){const g=this._waitingUeFuncIdAndResultCallbacks.get(B.fid);g&&(this._waitingUeFuncIdAndResultCallbacks.delete(B.fid),g.resultCallback(B.r))}}));let a=0;const l=d=>{const B={n:a++,tt:Date.now(),t:"c",fs:d};this._waitingUeCalls.add(B),i.debug&&(console.group("%cxe2 => ue"," background-color:green;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(B,void 0,"")}`," border:1px dashed green;border-radius:5px;padding:10px;line-height:25px;color:green;"),console.groupEnd()),this._ue5ViewerWrapper.emitUIInteractionForBigData(B,()=>{this._waitingUeCalls.delete(B)})},c=()=>{if(!this._ue5ViewerWrapper.instance.webSocketReady||this._ueFuncWithIdAndResultCallbacks.length===0)return;const B=this._ueFuncWithIdAndResultCallbacks.map(([g])=>g);for(const[g,f]of this._ueFuncWithIdAndResultCallbacks)this._waitingUeFuncIdAndResultCallbacks.set(g.fid,f);this._ueFuncWithIdAndResultCallbacks.length=0;{const g=window.g_emitDescriptor_maxBytes,f=B.map(L=>({f:L,s:JSON.stringify(L).length}));let m=f.length,F=0,Q=0,y=[];do{do{const{f:L,s:T}=f[F];if(y.push(L),++F,Q+T>g||y.length>=20)break}while(F<m);y.length>0&&(i.debug&&console.log(`传送${y.length}条消息...`),l([...y]),y.length=0,Q=0)}while(F<m)}};this.dv(w.createInterval()).start(c,50),this.d(()=>console.log("UeCloudViewer正在销毁..."))}get videoInitialized(){return this._videoInitialized.value}get webRtcConnected(){return this._webRtcConnected.value}get webSocketOpen(){return this._webSocketOpen.value}get ue5ViewerWrapper(){return this._ue5ViewerWrapper}get errorEvent(){return this._errorEvent}get readyEvent(){return this._readyEvent}resize(e,t){this.ue5ViewerWrapper.resize(e,t)}callUeFunc(e){return new Promise(t=>{const s={fid:w.createGuid(),...e};this._ueFuncWithIdAndResultCallbacks.push([s,{timeStamp:Date.now(),ueFunc:e,resultCallback:t}])})}disposableOnUeEvent(e,t){const n=w.createGuid();this.callUeFunc({f:"addEventListener",p:{et:e,eid:n}});const s=()=>{this.callUeFunc({f:"removeEventListener",p:{eid:n}})},i=this._ueEvent.don(o=>{o.et===e&&o.eid===n&&t(o)});return()=>{i(),s()}}}class Bu extends w.Destroyable{constructor(e,t,n,s){super();C(this,"_onRuntimeInitialized",this.dv(new w.Event));C(this,"_vIframe",null);this._ueViewer=s;const i=this._ueViewer;{const o=document.createElement("iframe");this._vIframe=o,o.style.cssText="width: 100%; height: 100%; margin: 0; padding: 0; border: none; outline: none;",e.appendChild(o),this.d(()=>{o&&e.removeChild(o)});const a=p.ESSceneObject.getStrFromEnv(n+`/web/${t}.html`);o.src=a,o.onload=()=>{const l=o.contentWindow;if(!l){console.error("iframeWindow is null");return}console.log("iwindow.Module",l.Module),l.Module.onRuntimeInitialized=()=>{this._onRuntimeInitialized.emit(),i.setStatus("Created"),i.setStatusLog("创建成功"),l.Module.UE4_resizeCanvas(),l.console.log("创建成功__________________________________________")}}}}get onRuntimeInitialized(){return this._onRuntimeInitialized}get vIframe(){return this._vIframe}}const ja=typeof TextDecoder<"u"?new TextDecoder:void 0,fu=(r,A=0,e=NaN)=>{const t=A+e;let n=A;for(;r[n]&&!(n>=t);)++n;if(n-A>16&&r.buffer&&ja)return ja.decode(r.subarray(A,n));let s="";for(;A<n;){var i=r[A++];if(!(i&128)){s+=String.fromCharCode(i);continue}var o=r[A++]&63;if((i&224)==192){s+=String.fromCharCode((i&31)<<6|o);continue}var a=r[A++]&63;if((i&240)==224?i=(i&15)<<12|o<<6|a:((i&248)!=240&&console.warn("Invalid UTF-8 leading byte encountered when deserializing a UTF-8 string in wasm memory to a JS string!"),i=(i&7)<<18|o<<12|a<<6|r[A++]&63),i<65536)s+=String.fromCharCode(i);else{var l=i-65536;s+=String.fromCharCode(55296|l>>10,56320|l&1023)}}return s};class wu extends w.Destroyable{constructor(A,e,t){super();{const n=()=>{const a=Qn(e);e.setGlobalProperty(a)};n();const s=mr(),i=[];s.forEach(a=>{const l=e[a+"Changed"];i.push(l)});const o=this.dv(w.createNextAnimateFrameEvent(...i));this.d(o.don(n))}this.d(e.propChanged.don(n=>{if(n.objId==="")try{Object.keys(n.props).forEach(s=>{const i=n.props[s]===null?void 0:n.props[s];e[s]=i})}catch(s){console.error("ueViewer propChanged:"+s)}})),e.useCustomInteraction=!1,this.dv(new p.ViewerCustomInteraction(e,A)),this.dv(new w.ObjResettingWithEvent(e.statusUpdateIntervalChanged,n=>{if((e.statusUpdateInterval??.5)===0)return;const i=new w.Destroyable;return i.d(t.disposableOnUeEvent("statusUpdate",o=>{e.statusUpdateEvent.emit(o)})),i})),this.dv(new w.ObjResettingWithEvent(e.propChangedListeningChanged,()=>{if(!(e.propChangedListening??!0))return;const s=new w.Destroyable;return s.d(t.disposableOnUeEvent("propChanged",i=>{e.propChanged.emit(i)})),s})),this.dv(new w.ObjResettingWithEvent(e.objectEventListeningChanged,()=>{if(!(e.objectEventListening??!0))return;const s=new w.Destroyable;return s.d(t.disposableOnUeEvent("objectEvent",i=>{e.objectEvent.emit(i)})),s})),this.dv(new w.ObjResettingWithEvent(e.widgetEventListeningChanged,()=>{if(!(e.widgetEventListening??!0))return;const s=new w.Destroyable;return s.d(t.disposableOnUeEvent("widgetEvent",i=>{e.widgetEvent.emit(i)})),s})),this.dv(new w.ObjResettingWithEvent(e.speechRecognitionListeningChanged,()=>{if(!(e.speechRecognitionListening??!0))return;const s=new w.Destroyable;return s.d(t.disposableOnUeEvent("speechRecognition",i=>{e.speechRecognition.emit(i)})),s})),this.dv(new w.ObjResettingWithEvent(e.customMessageListeningChanged,()=>{if(!(e.customMessageListening??!0))return;const s=new w.Destroyable;return s.d(t.disposableOnUeEvent("customMessage",i=>{e.customMessage.emit(i)})),s})),this.dv(new w.ObjResettingWithEvent(e.editingEventListeningChanged,()=>{if(!(e.editingEventListening??!0))return;const s=new w.Destroyable;return s.d(t.disposableOnUeEvent("editingEvent",i=>{i.objectIDs=i.objectIDs.map(o=>{var a;return((a=p.ESSceneObject.getSceneObjById(o))==null?void 0:a.parentID)??o}),e.editingEvent.emit(i)})),s}))}}let pu=-1;class Cu extends Ve{constructor(e,t,n="${earthsdk3-ue-h5-assets-script-dir}",s){super();C(this,"_ueFuncResultWithIdsEvent",this.dv(new w.Event));C(this,"_ueFuncWithIdAndResultCallbacks",[]);C(this,"_waitingUeFuncIdAndResultCallbacks",new Map);C(this,"_waitingUeCalls",new Map);C(this,"_ueEvent",this.dv(new w.Event));this._ueViewer=s;const i=this._ueViewer,o=this.dv(new Bu(e,t,n,i));let a=!1,l=null;this.d(o.onRuntimeInitialized.don(()=>{var B;if(a=!0,(B=o==null?void 0:o.vIframe)!=null&&B.contentWindow){l=o.vIframe.contentWindow;const g=o.vIframe.contentWindow.document.getElementById("mainarea");g?this.dv(new wu(g,i,this)):console.error("h5Container is null")}else{console.error("iframeWindow is null");return}l.UE_JSHTML5Communication?l.UE_JSHTML5Communication.UESendMessageToJS=g=>{try{const f=fu(l.HEAPU8,g),m=JSON.parse(f);if(i.debug&&(console.group("%cUE => JS"," background-color:#006EFF;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(m,void 0,"")}`," border:1px dashed #006EFF;border-radius:5px;padding:10px;line-height:25px;color:#006EFF;"),console.groupEnd()),m.t==="cr"){const F=m;if(F.frs&&this._ueFuncResultWithIdsEvent.emit(F.frs),F.ers)for(let Q of F.ers)this._ueEvent.emit(Q)}m.callid&&this._waitingUeCalls.has(m.callid)&&(this._waitingUeCalls.delete(m.callid),console.log(`waitingUeCalls.delete:${m.callid} end`))}catch(f){console.error("UE_JSHTML5Communication.UESendMessageToJS error:",f)}}:console.error("UE_JSHTML5Communication UESendMessageToJS not found")})),this.dispose(this._ueFuncResultWithIdsEvent.disposableOn(B=>{for(const g of B){const f=this._waitingUeFuncIdAndResultCallbacks.get(g.fid);f&&(this._waitingUeFuncIdAndResultCallbacks.delete(g.fid),f(g.r))}}));let c=0;const h=()=>{if(!a||!l||!l.UE_JSHTML5Communication||!l.UE_JSHTML5Communication.JSSendMessageToUE||this._ueFuncWithIdAndResultCallbacks.length===0)return;const B=this._ueFuncWithIdAndResultCallbacks.map(([T])=>T),g={n:c++,tt:Date.now(),t:"c",fs:B,callid:w.createGuid()};for(const[T,E]of this._ueFuncWithIdAndResultCallbacks)this._waitingUeFuncIdAndResultCallbacks.set(T.fid,E);this._ueFuncWithIdAndResultCallbacks.length=0,this._waitingUeCalls.set(g.callid,g),i.debug&&(console.group("%cxe2 => ue"," background-color:green;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(g,void 0,"")}`," border:1px dashed green;border-radius:5px;padding:10px;line-height:25px;color:green;"),console.groupEnd());const f=JSON.stringify(g),m=window.g_emitDescriptor_maxBytes??3e4,F=f.length,Q=++pu;if(F<m){const T=`${Q}-0/1-`+f;l.UE_JSHTML5Communication.JSSendMessageToUE(T);return}const y=Math.ceil(F/m)|0;[...new Array(y).keys()].map(T=>f.slice(T*m,(T+1)*m)).forEach((T,E)=>{const R=`${Q}-${E}/${y}-`+T;l.UE_JSHTML5Communication.JSSendMessageToUE(R)})};this.dv(w.createInterval()).start(h,50)}processResponse(e){if(this._ueViewer.debug??!1)try{const t=JSON.parse(e);console.group("%cUE => JS"," background-color:#006EFF;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(t,void 0,"")}`," border:1px dashed #006EFF;border-radius:5px;padding:10px;line-height:25px;color:#006EFF;"),console.groupEnd()}catch(t){console.error(`processResponse(${e}) error: ${t}`,t)}}callUeFunc(e){return new Promise(t=>{const s={fid:w.createGuid(),...e};this._ueFuncWithIdAndResultCallbacks.push([s,t])})}disposableOnUeEvent(e,t){const n=w.createGuid();this.callUeFunc({f:"addEventListener",p:{et:e,eid:n}});const s=()=>{this.callUeFunc({f:"removeEventListener",p:{eid:n}})},i=this._ueEvent.disposableOn(o=>{o.et===e&&o.eid===n&&((this._ueViewer.debug??!1)&&console.log(`callback, type:${e} eid:${n} ueEvent:${JSON.stringify(o)}`),t(o))});return()=>{i(),s()}}}let vu=-1;class mu extends Ve{constructor(e,t){super();C(this,"_ueFuncResultWithIdsEvent",this.dv(new w.Event));C(this,"_ueFuncWithIdAndResultCallbacks",[]);C(this,"_waitingUeFuncIdAndResultCallbacks",new Map);C(this,"_waitingUeCalls",new Set);C(this,"_ueEvent",this.dv(new w.Event));this._ueViewer=t;const n=this._ueViewer;let s=!1;const i={eventType:"init",params:{}};window.ue.es.oncommand(JSON.stringify(i)),s=!0,window.calljs=(c,h)=>{if(n.debug&&console.log(`calljs eventName:${c} eventDetailStr:${h}`),c==="ueevent"||c==="commanFinish")try{const d=JSON.parse(h);if(d.t==="cr"){const B=d;if(B.frs&&this._ueFuncResultWithIdsEvent.emit(B.frs),B.ers)for(let g of B.ers)this._ueEvent.emit(g)}}catch(d){console.error(d)}},this.dispose(this._ueFuncResultWithIdsEvent.disposableOn(c=>{for(const h of c){const d=this._waitingUeFuncIdAndResultCallbacks.get(h.fid);d&&(this._waitingUeFuncIdAndResultCallbacks.delete(h.fid),d(h.r))}}));let o=0;const a=()=>{if(!s||this._ueFuncWithIdAndResultCallbacks.length===0)return;const c=this._ueFuncWithIdAndResultCallbacks.map(([B])=>B),h={n:o++,tt:Date.now(),t:"c",fs:c};for(const[B,g]of this._ueFuncWithIdAndResultCallbacks)this._waitingUeFuncIdAndResultCallbacks.set(B.fid,g);this._ueFuncWithIdAndResultCallbacks.length=0,this._waitingUeCalls.add(h),n.debug&&(console.group("%cxe2 => ue"," background-color:green;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(h,void 0,"")}`," border:1px dashed green;border-radius:5px;padding:10px;line-height:25px;color:green;"),console.groupEnd());const d=++vu;window.ue.es.oncommand(`${d}-0/1-`+JSON.stringify(h)).then(()=>{this._waitingUeCalls.delete(h)})};this.dv(w.createInterval()).start(a,50)}callUeFunc(e){return new Promise(t=>{const s={fid:w.createGuid(),...e};this._ueFuncWithIdAndResultCallbacks.push([s,t])})}disposableOnUeEvent(e,t){const n=w.createGuid();this.callUeFunc({f:"addEventListener",p:{et:e,eid:n}});const s=()=>{this.callUeFunc({f:"removeEventListener",p:{eid:n}})},i=this._ueEvent.disposableOn(o=>{o.et===e&&o.eid===n&&((this._ueViewer.debug??!1)&&console.log(`callback, type:${e} eid:${n} ueEvent:${JSON.stringify(o)}`),t(o))});return()=>{i(),s()}}}class Fu extends w.Destroyable{constructor(A,e){super();{const t=()=>{const o=Qn(A);A.setGlobalProperty(o)};t();const n=mr(),s=[];n.forEach(o=>{const a=A[o+"Changed"];s.push(a)});const i=this.dv(w.createNextAnimateFrameEvent(...s));this.d(i.don(t))}this.d(A.propChanged.don(t=>{if(t.objId==="")try{Object.keys(t.props).forEach(n=>{const s=t.props[n]===null?void 0:t.props[n];A[n]=s})}catch(n){console.error("ueViewer propChanged:"+n)}})),this.dv(new w.ObjResettingWithEvent(A.statusUpdateIntervalChanged,t=>{if((A.statusUpdateInterval??.5)===0)return;const s=new w.Destroyable;return s.d(e.disposableOnUeEvent("statusUpdate",i=>{A.statusUpdateEvent.emit(i)})),s})),this.dv(new w.ObjResettingWithEvent(A.propChangedListeningChanged,()=>{if(!(A.propChangedListening??!0))return;const n=new w.Destroyable;return n.d(e.disposableOnUeEvent("propChanged",s=>{A.propChanged.emit(s)})),n})),this.dv(new w.ObjResettingWithEvent(A.objectEventListeningChanged,()=>{if(!(A.objectEventListening??!0))return;const n=new w.Destroyable;return n.d(e.disposableOnUeEvent("objectEvent",s=>{A.objectEvent.emit(s)})),n})),this.dv(new w.ObjResettingWithEvent(A.widgetEventListeningChanged,()=>{if(!(A.widgetEventListening??!0))return;const n=new w.Destroyable;return n.d(e.disposableOnUeEvent("widgetEvent",s=>{A.widgetEvent.emit(s)})),n})),this.dv(new w.ObjResettingWithEvent(A.speechRecognitionListeningChanged,()=>{if(!(A.speechRecognitionListening??!0))return;const n=new w.Destroyable;return n.d(e.disposableOnUeEvent("speechRecognition",s=>{A.speechRecognition.emit(s)})),n})),this.dv(new w.ObjResettingWithEvent(A.customMessageListeningChanged,()=>{if(!(A.customMessageListening??!0))return;const n=new w.Destroyable;return n.d(e.disposableOnUeEvent("customMessage",s=>{A.customMessage.emit(s)})),n})),this.dv(new w.ObjResettingWithEvent(A.editingEventListeningChanged,()=>{if(!(A.editingEventListening??!0))return;const n=new w.Destroyable;return n.d(e.disposableOnUeEvent("editingEvent",s=>{s.objectIDs=s.objectIDs.map(i=>{var o;return((o=p.ESSceneObject.getSceneObjById(i))==null?void 0:o.parentID)??i}),A.editingEvent.emit(s)})),n}))}}class Qu extends w.Destroyable{constructor(A,e,t){super();{const s=()=>{const l=Qn(e);e.setGlobalProperty(l)};s();const i=mr(),o=[];i.forEach(l=>{const c=e[l+"Changed"];o.push(c)});const a=this.dv(w.createNextAnimateFrameEvent(...o));this.d(a.don(s))}this.d(e.propChanged.don(s=>{if(s.objId==="")try{Object.keys(s.props).forEach(i=>{const o=s.props[i]===null?void 0:s.props[i];e[i]=o})}catch(i){console.error("ueViewer propChanged:"+i)}}));const n=document.createElement("div");n.style.width="100%",n.style.height="100%",n.style.position="absolute",n.style.overflow="hidden",n.style.top="0",n.style.left="0",n.style.zIndex="0",n.style.backgroundColor="rgba(255,0,0,0)",n.setAttribute("masker","大屏顶层div,用于模拟鼠标事件和控制UE鼠标事件是否生效"),A.appendChild(n),this.d(()=>{n&&A&&A.removeChild(n)});{const s=(l,c)=>{window.ue.esinput.setinterceptevent(c),l.preventDefault()},i=l=>{s(l,!1)},o=l=>{s(l,!0)},a=l=>{s(l,!1)};n.addEventListener("mouseenter",i),n.addEventListener("mouseleave",o),n.addEventListener("mousemove",a),this.d(()=>{n.removeEventListener("mouseenter",i),n.removeEventListener("mouseleave",o),n.removeEventListener("mousemove",a)})}e.useCustomInteraction=!1,this.dv(new p.ViewerCustomInteraction(e,n)),this.dv(new w.ObjResettingWithEvent(e.statusUpdateIntervalChanged,s=>{if((e.statusUpdateInterval??.5)===0)return;const o=new w.Destroyable;return o.d(t.disposableOnUeEvent("statusUpdate",a=>{e.statusUpdateEvent.emit(a)})),o})),this.dv(new w.ObjResettingWithEvent(e.propChangedListeningChanged,()=>{if(!(e.propChangedListening??!0))return;const i=new w.Destroyable;return i.d(t.disposableOnUeEvent("propChanged",o=>{e.propChanged.emit(o)})),i})),this.dv(new w.ObjResettingWithEvent(e.objectEventListeningChanged,()=>{if(!(e.objectEventListening??!0))return;const i=new w.Destroyable;return i.d(t.disposableOnUeEvent("objectEvent",o=>{e.objectEvent.emit(o)})),i})),this.dv(new w.ObjResettingWithEvent(e.widgetEventListeningChanged,()=>{if(!(e.widgetEventListening??!0))return;const i=new w.Destroyable;return i.d(t.disposableOnUeEvent("widgetEvent",o=>{e.widgetEvent.emit(o)})),i})),this.dv(new w.ObjResettingWithEvent(e.speechRecognitionListeningChanged,()=>{if(!(e.speechRecognitionListening??!0))return;const i=new w.Destroyable;return i.d(t.disposableOnUeEvent("speechRecognition",o=>{e.speechRecognition.emit(o)})),i})),this.dv(new w.ObjResettingWithEvent(e.customMessageListeningChanged,()=>{if(!(e.customMessageListening??!0))return;const i=new w.Destroyable;return i.d(t.disposableOnUeEvent("customMessage",o=>{e.customMessage.emit(o)})),i})),this.dv(new w.ObjResettingWithEvent(e.editingEventListeningChanged,()=>{if(!(e.editingEventListening??!0))return;const i=new w.Destroyable;return i.d(t.disposableOnUeEvent("editingEvent",o=>{o.objectIDs=o.objectIDs.map(a=>{var l;return((l=p.ESSceneObject.getSceneObjById(a))==null?void 0:l.parentID)??a}),e.editingEvent.emit(o)})),i}))}}class Uu extends w.Destroyable{constructor(e,t,n){super();C(this,"_reconnectEvent",this.dv(new w.Event));const s=(a,l)=>a.hasOwnProperty(l);let i=0,o;if(this.d(()=>{o&&clearTimeout(o)}),window.ue&&window.ue.es)if(window.ue.esinput){n.setStatus("Creating"),console.log("存在(window.ue && window.ue.es && window.ue.esinput 需要适配新版ESWebView 鼠标穿透), 开始创建UeFalseCloudViewer..."),n.setStatusLog("开始创建本地视口...");const a=this.dv(new mu(e,n));this.d(()=>n.viewer=void 0),n.viewer=a,n.setStatus("Created"),n.setStatusLog("本地视口创建成功!"),this.dv(new Qu(e,n,a))}else n.setStatus("Error"),n.setStatusLog("请升级 ESWebView !");else if(s(t.options,"ws")||s(t.options,"uri")&&s(t.options,"app")){n.setStatus("Creating"),n.setStatusLog("开始创建云渲染视口...");let a;this.d(()=>{n.setStatus("Raw"),n.setStatusLog(""),e&&a&&e.removeChild(a)&&(a=void 0)});const l=this.dv(w.createProcessingFromAsyncFunc(async c=>{n.viewer&&!n.viewer.isDestroyed()&&n.viewer.destroy(),n.viewer=void 0,a&&e.removeChild(a)&&(a=void 0),a=document.createElement("div"),a.setAttribute("earthsdk3-ue","earthsdk3-ue-videoContainer"),a.style.cssText="position:relative; height: 100%;width:100%;",e.appendChild(a);let h,d,B;if(s(t.options,"ws")){const{ws:F,esmsg:Q,uselnternalSignallingServer:y}=t.options;h=F,d=Q,B=y??!1}if(s(t.options,"uri")&&s(t.options,"app")){const{offsetWidth:F,offsetHeight:Q}=a;let{uri:y,app:L,token:T}=t.options;y.endsWith("/")||(y+="/");const E=T?`?essstoken=${T}`:"",R=`/${L}/${F??1920}/${Q??1080}`+E;console.log(`请求信令服务器: ${y}instance${R}`);const K=await c.promise(fetch(`${y}instance${R}`,{method:"GET"})),M=await c.promise(K.json());if(M&&M.status!=="ok"){n.setStatus("Error"),n.setStatusLog(`信令服务器请求失败 ${M.status}`),this._reconnectEvent.emit(void 0);return}else{console.log(`信令服务器请求成功! ${JSON.stringify(M,void 0," ")}`),await w.sleep(2e3);const{server:W,esmsg:iA,instanceId:uA,useInternalSignallingServer:G}=M;if(!uA){n.setStatus("Error"),n.setStatusLog("检查信令服务器版本,返回数据错误! "),console.log("信令服务器返回数据错误!不包含instanceId!请升级到 ESSS V3.0+ 版本!"),this._reconnectEvent.emit(void 0);return}h=W,d=iA,B=G??!1,n.esssResponse=M}}const g=this.dv(B?new gu(a,h,d,n):new ou(a,h,d,n));this.d(()=>n.viewer=void 0),this.d(g.errorEvent.don(F=>{const Q=`[${F}]:像素流连接错误!`;n.setStatus("Error"),n.setStatusLog(Q),this._reconnectEvent.emit(g)})),await c.promise(new Promise(F=>this.d(g.readyEvent.donce(F)))),n.setStatus("Created"),n.setStatusLog("云渲染视口创建成功!"),i=0,o&&clearTimeout(o),o=void 0;const{offsetWidth:f,offsetHeight:m}=a;g.resize(f*window.devicePixelRatio,m*window.devicePixelRatio),n.viewer=g,this.d(()=>n.viewer=void 0),this.dv(new Fu(n,g))}));l.start(),this.d(this._reconnectEvent.don(c=>{o===void 0&&(c&&!c.isDestroyed()&&c.destroy(),n.viewer&&!n.viewer.isDestroyed()&&n.viewer.destroy(),n.viewer=void 0,n.autoReconnect&&(n.setStatus("Reconnecting"),n.setStatusLog("正在尝试重新连接..."),i=i+5e3>3e4?3e4:i+5e3,console.warn(`间隔:${i/1e3}s,正在尝试重新连接...`),o=window.setTimeout(()=>{l.restart()},i)))})),this.d(l.errorEvent.don(c=>{n.setStatus("Error"),n.setStatusLog("云渲染视口创建失败!"),console.warn("云渲染视口创建失败!",c),this._reconnectEvent.emit(void 0)}))}else if(s(t.options,"project")){const a=t,l=a.options.project,c=a.options.baseUrl;n.setStatus("Creating"),n.setStatusLog("下载编译中...");const h=this.dv(new Cu(e,l,c,n));n.viewer=h,this.d(()=>n.viewer=void 0)}else n.setStatus("Error"),n.setStatusLog("视口创建失败!"),console.warn("视口创建失败: 参数错误!")}}const se=class se extends p.ESViewer{constructor(e){super(e);C(this,"_viewer",this.dv(w.react(void 0)));C(this,"_esssResponse");C(this,"_speechRecognition",this.dv(new w.Event));C(this,"_propChanged",this.dv(new w.Event));C(this,"_objectEvent",this.dv(new w.Event));C(this,"_widgetEvent",this.dv(new w.Event));C(this,"_customMessage",this.dv(new w.Event));C(this,"_statusUpdateEvent",this.dv(new w.Event));C(this,"_statusUpdateEventdon",(()=>{this.d(this.statusUpdateEvent.don(e=>{this._statusInfo.fps=e.FPS??0,this._statusInfo.length=e.length??0,this._statusInfo.position=e.position??[0,0,0],this._statusInfo.rotation=e.rotation??[0,0,0]}))})());if(e.type!=="ESUeViewer")throw new Error("option.type must be ESUeViewer");const t=e;this.d(this._viewer.changed.don(()=>{this.viewerChanged.emit(this.viewer)})),this.dv(new w.ObjResettingWithEvent(this.subContainerChanged,()=>{if(this.setStatus("Raw"),this.setStatusLog(""),!!this.subContainer)return new Uu(this.subContainer,t,this)}))}get defaultProps(){return se.createDefaultProps()}set viewer(e){this._viewer.value=e}get viewer(){return this._viewer.value}get esssResponse(){return this._esssResponse}set esssResponse(e){this._esssResponse=e}get speechRecognition(){return this._speechRecognition}get propChanged(){return this._propChanged}get objectEvent(){return this._objectEvent}get widgetEvent(){return this._widgetEvent}get customMessage(){return this._customMessage}get statusUpdateEvent(){return this._statusUpdateEvent}async uePositionToLonLatAlt(e){if(!this.viewer){console.warn("UEPositionToLonLatAlt: viewer is undefined");return}return await Co(this.viewer,e)}async changeNavigationMode(e){if(!this.viewer){console.warn("ChangeNavigationMode: viewer is undefined");return}const t=await TA(this.viewer,e);return t&&!t.error&&(this._navigationMode.value=e.mode),t}async resetWithCurrentCamera(e){if(!this.viewer){console.warn("resetWithCurrentCamera: viewer is undefined");return}return await En(this.viewer,e)}async getAllSocketNamesByActorTag(e){if(!this.viewer){console.warn("GetAllSocketNamesByActorTag: viewer is undefined");return}return await vo(this.viewer,e)}async getBoundSphere(e){if(!this.viewer){console.warn("getBoundSphere: viewer is undefined");return}return await Fo(this.viewer,e)}async getBoundSphereWithChildren(e){if(!this.viewer){console.warn("getBoundSphereWithChildren: viewer is undefined");return}return await Qo(this.viewer,e)}async getStrokeMaterialParamInfo(e){if(!this.viewer){console.warn("GetStrokeMaterialParamInfo: viewer is undefined");return}return await Uo(this.viewer,e)}async getFillMaterialParamInfo(e){if(!this.viewer){console.warn("getFillMaterialParamInfo: viewer is undefined");return}return await Eo(this.viewer,e)}async getGlobalProperty(e){if(!this.viewer){console.warn("getGlobalProperty: viewer is undefined");return}return await yo(this.viewer,e)}async getObjectByInfo(e){if(!this.viewer){console.warn("GetObjectByInfo: viewer is undefined");return}return await So(this.viewer,e)}async defaultCameraFlyIn(e=1){if(!this.viewer){console.warn("DefaultCameraFlyIn: viewer is undefined");return}return await Zi(this.viewer,e)}async startVoice(){if(!this.viewer){console.warn("startVoice:viewer is undefined");return}return await qi(this.viewer)}async stopVoice(){if(!this.viewer){console.warn("startVoice:viewer is undefined");return}return await ji(this.viewer)}async mountPakFiles(e){if(!this.viewer){console.warn("mountPakFiles:viewer is undefined");return}return await Ao(this.viewer,e)}async generateMemReport(){if(!this.viewer){console.warn("generateMemReport:viewer is undefined");return}return await eo(this.viewer)}async quit(){if(!this.viewer){console.warn("Quit: viewer is undefined");return}return await co(this.viewer)}async bindActorByTag(e,t){if(!this.viewer){console.warn("BindActorByTag: viewer is undefined");return}return await Io(this.viewer,e,t)}async restoreOriginalScene(){if(!this.viewer){console.warn("RestoreOriginalScene: viewer is undefined");return}return await To(this.viewer)}async unBindActorByID(e){if(!this.viewer){console.warn("UnBindActorByID: viewer is undefined");return}return await Ho(this.viewer,e)}async unBindActorByTag(e){if(!this.viewer){console.warn("UnBindActorByTag: viewer is undefined");return}return await Lo(this.viewer,e)}async createActorByClass(e,t){if(!this.viewer){console.warn("CreateActorByClass: viewer is undefined");return}return await bo(this.viewer,e,t)}async bind3DTilesetByTag(e,t){if(!this.viewer){console.warn("Bind3DTilesetByTag: viewer is undefined");return}return await Mo(this.viewer,e,t)}async unBind3DTilesetByTag(e){if(!this.viewer){console.warn("UnBind3DTilesetByTag: viewer is undefined");return}return await Do(this.viewer,e)}async unBind3DTilesetById(e){if(!this.viewer){console.warn("UnBind3DTilesetById: viewer is undefined");return}return await Ro(this.viewer,e)}async bindImageryByTag(e,t,n){if(!this.viewer){console.warn("BindImageryByTag: viewer is undefined");return}return await Po(this.viewer,e,t,n)}async unBindImageryByTag(e,t){if(!this.viewer){console.warn("UnBindImageryByTag: viewer is undefined");return}return await Ko(this.viewer,e,t)}async unBindImageryById(e){if(!this.viewer){console.warn("UnBindImageryById: viewer is undefined");return}return await xo(this.viewer,e)}async getIdByComponentNameAndHitItem(e,t,n){if(!this.viewer){console.warn("GetIdByComponentNameAndHitItem: viewer is undefined");return}return await ko(this.viewer,e,t,n)}async getCameraRelativeHeight(e="ECC_Visibility"){if(!this.viewer){console.warn("GetCameraRelativeHeight: viewer is undefined");return}return await Go(this.viewer,e)}async saveStringToFile(e,t,n){if(!this.viewer){console.warn("SaveStringToFile: viewer is undefined");return}return await No(this.viewer,e,t,n)}async highlightActorByTag(e,t=!0){if(!this.viewer){console.warn("HighlightActorByTag: viewer is undefined");return}return await _o(this.viewer,e,t)}async sendCustomMessage(e){if(!this.viewer){console.warn("SendCustomMessage: viewer is undefined");return}return await Vo(this.viewer,e)}async getStatus(){if(!this.viewer){console.warn("GetStatus:viewer is undefined");return}return await Oo(this.viewer)}async getTilesetMaterialIDList(){if(!this.viewer){console.warn("GetTilesetMaterialIDList:viewer is undefined");return}return await zo(this.viewer)}async pick(e,t,n){if(!this.viewer)return;let s=e;if(e&&window.ue&&this.container){const[i,o]=e,{x:a,y:l}=this.container.getBoundingClientRect();s=[a+i,l+o]}return await uo(this.viewer,s,t,n)}async pickPosition(e){if(!this.viewer)return;let t=e;if(e&&window.ue&&this.container){const[n,s]=e,{x:i,y:o}=this.container.getBoundingClientRect();t=[i+n,o+s]}return await ho(this.viewer,t)}async quickPickPosition(e){return await this.pickPosition(e)}async flyIn(e,t=[0,0,0],n=1,s="default"){if(!this.viewer)return;const i=await xe(this.viewer,void 0,e,t,n,s);if(i)return i.endType===0&&console.warn(`flyTo:flyTo is end! endType:${i.endType}`),i.endType===1&&console.warn(`flyTo:飞行中断! endType:${i.endType}`),i}async flyTo(e,t,n="default"){if(!this.viewer)return;const s=await Be(this.viewer,void 0,void 0,e,t,n);if(s)return s.endType===0&&console.warn(`flyTo:flyTo is end! endType:${s.endType}`),s.endType===1&&console.warn(`flyTo:飞行中断! endType:${s.endType}`),s}flyToBoundingSphere(e,t,n=1){const s=[[e[0],e[1],0],[e[0],e[3],0],[e[2],e[3],0],[e[2],e[1],0]],i=p.getGeoBoundingSphereFromPositions(s);if(!i)return;const{center:o,radius:a}=i,l={distance:t??a,heading:0,pitch:-90,flyDuration:n,hDelta:0,pDelta:0};this.flyTo(l,o)}getCurrentCameraInfo(){const{position:e,rotation:t}=this._statusInfo;return{position:e,rotation:t}}getLengthInPixel(){return this._statusInfo.length}async changeToWalk(e,t=4.2,n=1.6){if(!this.viewer)return;const s={mode:"Walk",position:e,jumpZVelocity:t,eyeHeight:n},i=await TA(this.viewer,s);return i&&!i.error&&(this._navigationMode.value=s.mode),i}async changeToMap(){if(!this.viewer)return;const e={mode:"Map"},t=await TA(this.viewer,e);return t&&!t.error&&(this._navigationMode.value=e.mode),t}async changeToRotateGlobe(e=38,t=1e7,n=60){if(!this.viewer)return;const s={mode:"RotateGlobe",latitude:e,height:t,cycleTime:n},i=await TA(this.viewer,s);return i&&!i.error&&(this._navigationMode.value=s.mode),i}async changeToLine(e,t=10,n=10,s=!0,i=10,o="auto"){if(!this.viewer)return;const a={mode:"Line",geoLineStringId:e,speed:t,heightOffset:n,loop:s,turnRateDPS:i,lineMode:o},l=await TA(this.viewer,a);return l&&!l.error&&(this._navigationMode.value=a.mode),l}async changeToUserDefined(e){if(!this.viewer)return;const t={mode:"UserDefined",userDefinedPawn:e},n=await TA(this.viewer,t);return n&&!n.error&&(this._navigationMode.value=t.mode),n}async changeToRotatePoint(e,t=5e4,n=60,s=0,i=-30){if(!this.viewer)return;const o={mode:"RotatePoint",position:e,distance:t,orbitPeriod:n,heading:s,pitch:i},a=await TA(this.viewer,o);return a&&!a.error&&(this._navigationMode.value=o.mode),a}async changeToFollow(e,t=0,n=0,s=-30,i=!0){if(!this.viewer)return;const o={mode:"Follow",objectId:e,distance:t,heading:n,pitch:s,relativeRotation:i},a=await TA(this.viewer,o);return a&&!a.error&&(this._navigationMode.value=o.mode),a}getFPS(){return this._statusInfo.fps}async getVersion(){const e=window.g_XE3CopyRights??{};if(!this.viewer)return e;const t=await mo(this.viewer);return e.esforue=t,e}async getHeightByLonLat(e,t,n="ECC_Visibility"){if(!this.viewer)return null;const s=await go(this.viewer,e,t,n);return s&&s.height!==void 0?s.height:null}async getHeightsByLonLats(e,t="ECC_Visibility"){return this.viewer?await Bo(this.viewer,e,t):void 0}async capture(e=64,t=64){return this.viewer?await fo(this.viewer,e,t):void 0}async partialCapture(e,t=[64,64]){if(!this.viewer){console.warn("partialCapture:viewer is undefined");return}return await wo(this.viewer,e,t)}async lonLatAltToScreenPosition(e){if(!this.viewer)return;const t=await po(this.viewer,e);return t&&[t.X,t.Y]}async setGlobalProperty(e){if(this.viewer)return await lo(this.viewer,e)}async startEditing(e,t,n){n=Object.assign({useKeyToSwitch:!0,callSource:"outer"},n);const s=e.combinationClass?e.getMainClass():e;if(!s||!this.viewer||t==null)return;const i=Array.isArray(t)?[...t]:[t];return s.editingID=`${n.callSource}_${w.createGuid()}`,await Wo(this.viewer,s.id,s.editingID,i,n.useKeyToSwitch)}async stopEditing(){if(this.viewer)return await Xo(this.viewer)}async moveObjects(e){if(!this.viewer)return;const t=[],n=w.createGuid();for(let s=0;s<e.length;s++){const i=e[s],o=i.combinationClass?i.getMainClass():i;o.editingID=n,o&&t.push(o.id)}if(t.length!==0)return await Jo(this.viewer,t,n)}getProperties(){return[...super.getProperties()]}};C(se,"type",se.register("ESUeViewer",se)),C(se,"defaults",{...od});let LA=se;(r=>{r.createDefaultProps=()=>({...p.ESViewer.createDefaultProps(),...Yi(),resolutionScale:1,autoReconnect:!1,propChangedListening:void 0,objectEventListening:void 0,widgetEventListening:void 0,speechRecognitionListening:void 0,customMessageListening:void 0})})(LA||(LA={})),w.extendClassProps(LA.prototype,LA.createDefaultProps);class jA extends p.EngineObject{constructor(A,e){super(A,e);const t=e.viewer;if(t&&(A.combinationClass||this.d(this.createdEvent.don(()=>{const n=this.constructor.propValFuncs,s=A.defaultProps,i=Object.keys(s).filter(d=>n[d]!==null);i.push(...this.constructor.forceUeUpdateProps);const o=A.constructor.defaults,a={val:{}},l=[];for(let d of i){const B=d+"Changed",g=A[B];l.push(g);const f=n[d];if(f===null)throw console.error("vf === null error"),new Error("vf === null error");const m=()=>{const F=A[d]??o[d];let Q=f?f(F,this,e,A):F;if(Q===void 0){console.warn(`UE自动更新的属性,不应该为undefined! 属性名:${d} 对象名:${A.name} 对象id: ${A.id}`);return}a.val[d]=Q};m(),this.d(g.don(m))}const c=()=>{t.callUeFunc({f:"update",p:{id:A.id,...a.val}}),a.val={}},h=this.dv(w.createNextAnimateFrameEvent(...l));this.d(h.don(c)),this.d(A.createdEvent.don(c)),this.d(A.flushEvent.don(()=>h.flush()))})),!A.combinationClass)){let n=!1;this.d(()=>{n&&Un(t,A.id)}),t.callUeFunc({f:"create",p:{type:A.typeName,id:A.id}}).then(()=>{n=!0,A.createdEvent.emit()}).catch(s=>console.error(s))}}}C(jA,"propValFuncs",{ref:null,devTags:null,extras:null,execOnceFuncStr:null,updateFuncStr:null,toDestroyFuncStr:null}),C(jA,"forceUeUpdateProps",[]);class lA extends jA{constructor(A,e){super(A,e);const t=e.viewer;t&&(this.d(A.flyToEvent.don(n=>{Be(t,A.id,n)})),this.d(A.flyInEvent.don(n=>{var s,i;xe(t,A.id,(s=A.flyInParam)==null?void 0:s.position,(i=A.flyInParam)==null?void 0:i.rotation,n??1)})),this.d(A.calcFlyToParamEvent.don(()=>{$A(t,A.id)})),this.d(A.calcFlyInParamEvent.don(()=>{const n=e.getCurrentCameraInfo();if(!n)return;const{position:s,rotation:i}=n;A.flyInParam={position:s,rotation:i,flyDuration:1}})),this.d(e.propChanged.don(n=>{n.objId===A.id&&Object.keys(n.props).forEach(s=>{const i=n.props[s]===null?void 0:n.props[s];A[s]=i})})))}}class x extends lA{constructor(A,e){super(A,e);const t=e.viewer;if(!t)return;const n=()=>{A.editing||t.callUeFunc({f:"update",p:{id:A.id,position:A.position,rotation:A.rotation}})},s=this.dv(w.createNextAnimateFrameEvent(A.positionChanged,A.rotationChanged,A.editingChanged));this.d(s.don(()=>{setTimeout(n,0)})),this.d(A.smoothMoveEvent.don((a,l)=>{_e(t,A.id,a,l)})),this.d(A.smoothMoveWithRotationEvent.don((a,l,c)=>{ke(t,A.id,a,l,c)})),this.d(A.smoothMoveOnGroundEvent.don((a,l,c,h)=>{Ge(t,A.id,a,l,h,c)})),this.d(A.smoothMoveWithRotationOnGroundEvent.don((a,l,c,h,d)=>{Ne(t,A.id,a,l,c,h,d)})),this.d(A.smoothMoveKeepPitchEvent.don(async(a,l)=>{const c=await t.callUeFunc({f:"SmoothMoveKeepPitch",p:{id:A.id,Destination:a,Time:l}});c.error&&console.error("SmoothMoveKeepPitch:",c.error)})),this.d(A.automaticLandingEvent.don(a=>{const l=[A.position[0],A.position[1]];e.getHeightByLonLat(A.position[0],A.position[1],"Visibility").then(c=>{c!==null&&(A.position=[...l,c],A.collision=a)})}));const i=async(a,l,c,h)=>{const{viewer:d}=a;if(!d){console.error("SmoothMoveRelatively: ueViewer.viewer is undefined");return}const B=await d.callUeFunc({f:"SmoothMoveRelatively",p:{id:l,RelativePosition:c,Time:h}});return B.error&&console.error("SmoothMoveRelatively:",B.error),B};this.d(A.smoothMoveRelativelyEvent.don((a,l)=>{i(e,A.id,a,l)}));const o=async(a,l,c,h,d)=>{const{viewer:B}=a;if(!B){console.error("SmoothMoveRelativelyWithRotation: ueViewer.viewer is undefined");return}const g=await B.callUeFunc({f:"SmoothMoveRelativelyWithRotation",p:{id:l,RelativePosition:c,NewRotation:h,Time:d}});return g.error&&console.error("SmoothMoveRelativelyWithRotation:",g.error),g};this.d(A.smoothMoveRelativelyWithRotationEvent.don((a,l,c)=>{o(e,A.id,a,l,c)}))}}class rA extends lA{constructor(A,e){super(A,e);const t=e.viewer;if(!t)return;const n=()=>{A.editing||t.callUeFunc({f:"update",p:{id:A.id,points:A.points}})},s=this.dv(w.createNextAnimateFrameEvent(A.pointsChanged,A.editingChanged));this.d(s.don(()=>{setTimeout(n,0)}))}}C(rA,"propValFuncs",{...lA.propValFuncs,pointStyle:A=>({...A,materialParams:JSON.stringify(A.materialParams??{})}),strokeStyle:A=>({...A,materialParams:JSON.stringify(A.materialParams??{})}),fillStyle:A=>({...A,materialParams:JSON.stringify(A.materialParams??{})})});class UA extends x{constructor(A,e){super(A,e),e.viewer&&this.d(e.widgetEvent.don(n=>{if(n.objId!==A.id)return;const{type:s,add:i}=n;A.widgetEvent.emit({type:s,add:i})}))}}class Kn extends x{constructor(A,e){super(A,e),e.viewer}}C(Kn,"propValFuncs",{...x.propValFuncs,pointStyle:A=>({...A,materialParams:JSON.stringify(A.materialParams??{})}),strokeStyle:A=>({...A,materialParams:JSON.stringify(A.materialParams??{})}),fillStyle:A=>({...A,materialParams:JSON.stringify(A.materialParams??{})})});class Er extends Kn{constructor(A,e){super(A,e),e.viewer}}const Al=r=>{switch(r){case 0:return"成功绑定";case 1:return"解绑之前的内容,成功绑定";case 2:return"没搜索到ActorTag,无法绑定";case 3:return"搜索到ActorTag但对应的Actor不是3dTileset,无法绑定";default:return"未知错误"}},ht=class ht extends p.EngineObject{constructor(e,t){super(e,t);C(this,"_styleColor",this.dv(w.react([])));C(this,"_styleVisable",this.dv(w.react([])));const n=t.viewer;if(!n){console.warn("UeES3DTileset: viewer is undefined!");return}let s,i;const o=async()=>{!s&&!i||await n.callUeFunc({f:"update",p:{id:e.id,url:e.url,show:e.show,collision:e.collision,allowPicking:e.allowPicking,flyToParam:e.flyToParam??p.ESVisualObject.defaults.flyToParam,flyInParam:e.flyInParam??p.ESVisualObject.defaults.flyInParam,highlightID:e.highlightID,highlightColor:e.highlightColor,highlight:e.highlight,materialMode:e.materialMode,maximumScreenSpaceError:e.maximumScreenSpaceError,colorMode:Reflect.has(e,"colorMode")?e.colorMode:void 0,offset:e.offset,rotation:e.rotation,cacheBytes:e.cacheBytes,colorBlendMode:e.colorBlendMode,materialOverrideMap:e.materialOverrideMap}})},a=this.dv(w.createNextAnimateFrameEvent(e.urlChanged,e.showChanged,e.flyToParamChanged,e.flyInParamChanged,e.collisionChanged,e.allowPickingChanged,e.highlightIDChanged,e.highlightColorChanged,e.highlightChanged,e.materialModeChanged,e.maximumScreenSpaceErrorChanged,e.offsetChanged,e.rotationChanged,e.cacheBytesChanged,e.colorBlendModeChanged,e.materialOverrideMapChanged));o(),this.d(a.don(o)),Reflect.has(e,"colorMode")&&this.d(e.colorModeChanged.don(()=>o()));const l=this.dv(w.react(void 0));{const h=this.dv(w.createNextAnimateFrameEvent(e.actorTagChanged,e.urlChanged)),d=()=>{e.actorTag?l.value={type:"ActorTag",actorTag:e.actorTag}:e.url?l.value={type:"CreatedUrl",url:e.url}:l.value=void 0,e.editing=!1};d(),this.d(h.don(d))}const c=async()=>{const{id:h}=e;if(s!==void 0){s=void 0;try{const d=await t.unBind3DTilesetById(h);if(!d)return;if(d.error!==""){console.warn(`UeES3DTileset UnBind3DTilesetById: ${d.error}`);return}}catch(d){console.warn(`UeES3DTileset UnBind3DTilesetById: ${d}`);return}}if(i!==void 0){i=void 0;try{const d=await n.callUeFunc({f:"destroy",p:{id:h}});if(!d)return;if(d.error!==""){console.warn(`UeES3DTileset Destroy: ${d.error}`);return}}catch(d){console.warn(`UeES3DTileset Destroy: ${d}`);return}}};this.d(()=>{c()});{const h=this.dv(w.createProcessingFromAsyncFunc(async B=>{if(l.value===void 0){await B.promise(c());return}if(l.value.type==="ActorTag"){const{actorTag:g}=l.value;if(s!==g&&await B.promise(c()),s!==void 0||g===void 0)return;try{s=g;const f=await B.promise(t.bind3DTilesetByTag(e.id,g));if(!f)return;if(f.error!==""){console.warn(`UeES3DTileset Bind3DTilesetByTag: ${f.error}`);return}if(f.re.type!==0)if(f.re.type===1)console.warn(`UeES3DTileset Bind3DTilesetByTag: ${Al(f.re.type)}`);else{console.warn(`UeES3DTileset Bind3DTilesetByTag: ${Al(f.re.type)}`);return}}catch(f){console.warn(`UeES3DTileset Bind3DTilesetByTag: ${f}`);return}}else if(l.value.type==="CreatedUrl"){const{url:g}=l.value;if(g!==i&&await c(),i!==void 0||g===void 0)return;try{i=g;const f=await B.promise(n.callUeFunc({f:"create",p:{type:e.typeName,id:e.id}}));if(!f)return;if(f.error!==""){console.warn(`UeES3DTileset create: ${f.error}`);return}}catch(f){console.warn(`UeES3DTileset create: ${f}`);return}}await B.promise(o())})),d=async()=>{h.restart()};d(),this.d(l.changed.don(d))}this.d(e.refreshTilesetEvent.don(()=>{$i(n,e.id)})),this.d(e.flyToEvent.don(async(h,d)=>{if(!s&&!i)return;const B=await Be(n,e.id,h);let g="over";B===void 0?g="error":B.endType===0?g="over":B.endType===1&&(g="cancelled"),e.flyOverEvent.emit(d,g,t)})),this.d(e.calcFlyToParamEvent.don(()=>{!s&&!i||$A(n,e.id)})),this.d(e.calcFlyInParamEvent.don(async()=>{if(!s&&!i||!t.actived)return;const h=await t.getCurrentCameraInfo();if(!h)return;const{position:d,rotation:B}=h;e.flyInParam={position:d,rotation:B,flyDuration:1}})),this.d(t.propChanged.don(h=>{!s&&!i||h.objId===e.id&&Object.keys(h.props).forEach(d=>{const B=h.props[d]===null?void 0:h.props[d];e[d]=B})})),this.d(t.objectEvent.don(h=>{!s&&!i||h.id!==e.id||h.type!=="3DTilesetReady"||e.tilesetReady.emit(h.p)}));{const h=async(f,m)=>{if(!s&&!i)return;const F=await n.callUeFunc({f:"SetFeatureColor",p:{id:e.id,featureName:f,json:m}});if(F&&F.error!==""){console.warn(`UeES3DTileset SetFeatureColor: ${F.error}`);return}},d=async(f,m)=>{if(!s&&!i)return;const F=await n.callUeFunc({f:"SetFeatureVisable",p:{id:e.id,featureName:f,json:m}});if(F&&F.error!==""){console.warn(`UeES3DTileset SetFeatureVisable: ${F.error}`);return}},B=async()=>{if(!s&&!i)return;const f=await n.callUeFunc({f:"ResetFeatureStyle",p:{id:e.id}});if(f&&f.error!==""){console.warn(`UeES3DTileset ResetFeatureStyle: ${f.error}`);return}},g=async f=>{if(!s&&!i)return;const m=await n.callUeFunc({f:"SetFeatureStyle",p:{id:e.id,json:f}});if(m&&m.error!==""){console.warn(`UeES3DTileset SetFeatureStyle: ${m.error}`);return}};this.d(e.setFeatureColorEvent.don((f,m)=>{const F=[...this.styleColor,...m];this.styleColor=[...F],h(f,F)})),this.d(e.setFeatureVisableEvent.don((f,m)=>{const F=[...this.styleVisable,...m];this.styleVisable=[...F],d(f,F)})),this.d(e.resetFeatureStyleEvent.don(()=>{B(),this.styleColor=[],this.styleVisable=[]})),this.d(e.setFeatureStyleEvent.don(f=>{g(f)}))}{const h=async()=>{if(!s&&!i){e._featureTableResultEvent.emit(void 0);return}try{const d=await n.callUeFunc({f:"GetFeatureTable",p:{id:e.id}});d.error!==""&&console.warn(`UeES3DTileset GetFeatureTable: ${d.error}`),e._featureTableResultEvent.emit(d.re.table)}catch(d){console.warn(`UeES3DTileset GetFeatureTable: ${d}`),e._featureTableResultEvent.emit(void 0)}};this.d(e.getFeatureTableEvent.don(()=>{h()}))}{const h=async()=>{if(!s&&!i){e.getMaterialNameListEvent.emit(void 0);return}try{const d=await n.callUeFunc({f:"GetMaterialNameList",p:{id:e.id}});d.error!==""&&console.warn(`UeES3DTileset GetMaterialNameList: ${d.error}`),e.getMaterialNameListEvent.emit(d.re.materialNameList)}catch(d){console.warn(`UeES3DTileset GetMaterialNameList: ${d}`),e.getMaterialNameListEvent.emit(void 0)}};this.ad(e.getMaterialNameListEvent.don(d=>{d=="start"&&h()}))}}get styleColor(){return this._styleColor.value}set styleColor(e){this._styleColor.value=e}get styleVisable(){return this._styleVisable.value}set styleVisable(e){this._styleVisable.value=e}};C(ht,"type",ht.register("ESUeViewer",p.ES3DTileset.type,ht));let yr=ht;const el=r=>{switch(r){case 0:return"成功绑定";case 1:return"解绑之前的内容,成功绑定";case 2:return"没搜索到ActorTag,无法绑定";case 3:return"搜索到ActorTag对应的Actor是地形,无法绑定";case 4:return"没搜索到ComponentTag,无法绑定";default:return"未知错误"}},gt=class gt extends p.EngineObject{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}let n,s;const i=this.dv(w.react(void 0)),o=this.ad(w.reactJson(""));{const h=()=>{if(typeof A.url=="string")o.value=p.ESSceneObject.context.getStrFromEnv(A.url);else{const d=A.url;d.url=p.ESSceneObject.context.getStrFromEnv(d.url),o.value=d}};h(),this.ad(A.urlChanged.don(h))}const a=async()=>{if(!n&&!s)return;let h=A.targetID??p.ESImageryLayer.defaults.targetID;if(h&&h!=""){const d=p.ESSceneObject.getSceneObject(h);h=d?d.getMainClass().id:h}await t.callUeFunc({f:"update",p:{id:A.id,show:A.show??!0,rectangle:A.rectangle??[-180,-90,180,90],collision:A.collision??!0,allowPicking:A.allowPicking??!1,flyToParam:A.flyToParam??p.ESVisualObject.defaults.flyToParam,flyInParam:A.flyInParam??p.ESVisualObject.defaults.flyInParam,url:o.value??"",zIndex:A.zIndex??0,maximumLevel:A.maximumLevel??p.ESImageryLayer.defaults.maximumLevel,minimumLevel:A.minimumLevel??p.ESImageryLayer.defaults.minimumLevel,options:A.options??p.ESImageryLayer.defaults.options,targetID:h,opacity:A.opacity??p.ESImageryLayer.defaults.opacity,splitDirection:A.splitDirection??p.ESImageryLayer.defaults.splitDirection}})},l=this.dv(w.createNextAnimateFrameEvent(A.showChanged,o.changed,A.flyToParamChanged,A.flyInParamChanged,A.zIndexChanged,A.collisionChanged,A.allowPickingChanged,A.maximumLevelChanged,A.minimumLevelChanged,A.rectangleChanged,A.optionsChanged,A.targetIDChanged,A.opacityChanged,A.splitDirectionChanged));this.d(l.don(a));const c=async()=>{const{id:h}=A;if(n!==void 0){n=void 0;try{const d=await e.unBindImageryById(h);if(!d)return;if(d.error!==""){console.warn(`UeESImageryLayer UnImageryByID: ${d.error}`);return}}catch(d){console.warn(`UeESImageryLayer UnImageryByID promise: ${d}`);return}}if(s!==void 0){s=void 0;try{const d=await t.callUeFunc({f:"destroy",p:{id:h,test:"UeESImageryLayer"}});if(!d)return;if(d.error!==""){console.warn(`UeESImageryLayer Destroy: ${d.error}`);return}}catch(d){console.warn(`UeESImageryLayer Destroy promise: ${d}`);return}}};this.d(()=>{c()});{const h=this.dv(w.createProcessingFromAsyncFunc(async B=>{if(i.value===void 0){await B.promise(c());return}if(i.value.type==="ActorTag"){const{actorTag:g,componentTag:f}=i.value;if(n!==g&&await B.promise(c()),n!==void 0||g===void 0)return;try{n=g;const m=await B.promise(e.bindImageryByTag(A.id,g,f));if(!m)return;if(m.error!==""){console.warn(`ESImageryLayer BindImageryByTag: ${m.error}`);return}if(m.re.type!==0)if(m.re.type===1)console.warn(`ESImageryLayer BindImageryByTag: ${el(m.re.type)}`);else{console.warn(`ESImageryLayer BindImageryByTag: ${el(m.re.type)}`);return}}catch(m){console.warn(`ESImageryLayer BindImageryByTag promise: ${m}`);return}}else if(i.value.type==="CreatedUrl"){const{url:g}=i.value;if(g!==s&&await B.promise(c()),s!==void 0||g===void 0)return;try{s=g;const f=await B.promise(t.callUeFunc({f:"create",p:{type:"ESImageryLayer",id:A.id}}));if(!f)return;if(f.error!==""){console.warn(`ESImageryLayer create: ${f.error}`);return}}catch{console.warn("ESImageryLayer create: create promise error");return}}await B.promise(a())})),d=async()=>{h.restart()};d(),this.d(i.changed.don(d))}{const h=this.dv(w.createNextAnimateFrameEvent(A.actorTagChanged,o.changed,A.componentTagChanged)),d=()=>{A.actorTag&&A.componentTag?i.value={type:"ActorTag",actorTag:A.actorTag,componentTag:A.componentTag}:o.value?i.value={type:"CreatedUrl",url:o.value}:i.value=void 0};d(),this.d(h.don(d))}this.d(A.flyToEvent.don(async(h,d)=>{if(!n&&!s)return;const B=await Be(t,A.id,h);let g="over";B===void 0?g="error":B.endType===0?g="over":B.endType===1&&(g="cancelled"),A.flyOverEvent.emit(d,g,e)})),this.d(A.flyInEvent.don(async(h,d)=>{var f,m;if(!n&&!s)return;const B=await xe(t,A.id,(f=A.flyInParam)==null?void 0:f.position,(m=A.flyInParam)==null?void 0:m.rotation,h??1);let g="over";B===void 0?g="error":B.endType===0?g="over":B.endType===1&&(g="cancelled"),A.flyOverEvent.emit(d,g,e)})),this.d(A.calcFlyToParamEvent.don(()=>{!n&&!s||$A(t,A.id)})),this.d(A.calcFlyInParamEvent.don(async()=>{if(!e.actived)return;const h=await e.getCurrentCameraInfo();if(!h)return;const{position:d,rotation:B}=h;A.flyInParam={position:d,rotation:B,flyDuration:1}})),this.d(e.propChanged.don(h=>{!n&&!s||h.objId===A.id&&Object.keys(h.props).forEach(d=>{const B=h.props[d]===null?void 0:h.props[d];A[d]=B})}))}};C(gt,"type",gt.register("ESUeViewer",p.ESImageryLayer.type,gt));let xn=gt;const ie=class ie extends lA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(ie,"type",ie.register("ESUeViewer",p.ESTerrainLayer.type,ie)),C(ie,"forceUeUpdateProps",[...lA.forceUeUpdateProps,"url"]),C(ie,"propValFuncs",{...lA.propValFuncs,url:A=>typeof A=="string"?p.ESSceneObject.context.getStrFromEnv(A):(A.url=p.ESSceneObject.context.getStrFromEnv(A.url),A),czmMaxzoom:null,czmMinzoom:null});let kn=ie;const Bt=class Bt extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Bt,"type",Bt.register("ESUeViewer",p.ESAlarm.type,Bt));let Gn=Bt;const ft=class ft extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(ft,"type",ft.register("ESUeViewer",p.ESApertureEffect.type,ft));let Nn=ft;const wt=class wt extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(wt,"type",wt.register("ESUeViewer",p.ESGeoPolygon.type,wt));let cA=wt;const pt=class pt extends cA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}const n=()=>{let i=p.ESAreaMeasurement.defaults.fillStyle;try{i={...A.fillStyle??p.ESAreaMeasurement.defaults.fillStyle}}catch(o){console.error("ESAreaMeasurement fillStyle 属性类型错误!",o),i={...p.ESAreaMeasurement.defaults.fillStyle}}i.materialParams=JSON.stringify(i.materialParams),t.callUeFunc({f:"update",p:{id:A.id,stroked:A.stroked??p.ESAreaMeasurement.defaults.stroked,fillStyle:i,filled:A.filled??p.ESAreaMeasurement.defaults.filled}}),console.log(i)},s=this.dv(w.createNextAnimateFrameEvent(A.fillStyleChanged,A.strokedChanged,A.filledChanged));this.d(s.don(n)),this.d(A.createdEvent.don(n))}};C(pt,"type",pt.register("ESUeViewer",p.ESAreaMeasurement.type,pt));let _n=pt;const Ct=class Ct extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Ct,"type",Ct.register("ESUeViewer",p.ESBlastParticleSystem.type,Ct));let Vn=Ct;const Le=class Le extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is underfined!");return}}};C(Le,"type",Le.register("ESUeViewer",p.ESBoxClipping.type,Le)),C(Le,"propValFuncs",{...x.propValFuncs,targetID:A=>{if(!A)return"";const e=p.ESSceneObject.getSceneObject(A);return e?e.getMainClass().id:A}});let On=Le;const vt=class vt extends x{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.dispose(A.flyInEvent.don((n,s,i="default")=>{const{id:o,duration:a,position:l,rotation:c}=A;xe(t,o,l,c,a??n,i)})),this.dispose(A.resetWithCurrentCameraEvent.don(()=>{En(t,A.id)})),this.dispose(A.captureEvent.don((n,s)=>{e.capture(n,s).then(o=>{o&&(A.thumbnail=o)})}))}};C(vt,"type",vt.register("ESUeViewer",p.ESCameraView.type,vt));let Wn=vt;const mt=class mt extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(mt,"type",mt.register("ESUeViewer",p.ESCameraVisibleRange.type,mt));let Xn=mt;const Ft=class Ft extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Ft,"type",Ft.register("ESUeViewer",p.ESCar.type,Ft));let Jn=Ft;const Qt=class Qt extends rA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}const n=()=>{let i=p.ESClassification.defaults.fillStyle;try{i={...A.fillStyle??p.ESClassification.defaults.fillStyle}}catch(o){console.error("ESClassification fillStyle 属性类型错误!",o),i={...p.ESClassification.defaults.fillStyle}}i.materialParams=JSON.stringify(i.materialParams),t.callUeFunc({f:"update",p:{id:A.id,filled:A.filled??p.ESClassification.defaults.filled,fillStyle:i}})},s=this.dv(w.createNextAnimateFrameEvent(A.fillStyleChanged,A.filledChanged));this.d(s.don(n)),this.d(A.createdEvent.don(n))}};C(Qt,"type",Qt.register("ESUeViewer",p.ESClassification.type,Qt));let zn=Qt;const be=class be extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is underfined!");return}}};C(be,"type",be.register("ESUeViewer",p.ESClippingPlane.type,be)),C(be,"propValFuncs",{...x.propValFuncs,targetID:A=>{if(!A)return"";const e=p.ESSceneObject.getSceneObject(A);return e?e.getMainClass().id:A}});let Yn=be;const Ut=class Ut extends x{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}const n=this.ad(w.reactJson(""));{const o=()=>{if(typeof A.url=="string")n.value=p.ESSceneObject.context.getStrFromEnv(A.url??p.ESDataMesh.defaults.url);else{const a=A.url;a.url=p.ESSceneObject.context.getStrFromEnv(a.url??p.ESDataMesh.defaults.url),n.value=a}};o(),this.ad(A.urlChanged.don(o))}const s=()=>{const o=A.colorStops??p.ESDataMesh.defaults.colorStops;t.callUeFunc({f:"update",p:{id:A.id,url:n.value??p.ESDataMesh.defaults.url,currentTime:A.currentTime??p.ESDataMesh.defaults.currentTime,minPropValue:A.minPropValue??p.ESDataMesh.defaults.minPropValue,maxPropValue:A.maxPropValue??p.ESDataMesh.defaults.maxPropValue,colorStops:JSON.stringify(o)}})},i=this.dv(w.createNextAnimateFrameEvent(n.changed,A.currentTimeChanged,A.minPropValueChanged,A.maxPropValueChanged,A.colorStopsChanged));this.d(i.don(s)),this.d(A.createdEvent.don(s))}};C(Ut,"type",Ut.register("ESUeViewer",p.ESDataMesh.type,Ut));let $n=Ut;const Et=class Et extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Et,"type",Et.register("ESUeViewer",p.ESDatasmithRuntimeModel.type,Et));let Zn=Et;const yt=class yt extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(yt,"type",yt.register("ESUeViewer",p.ESDirectionMeasurement.type,yt));let qn=yt;const St=class St extends rA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}const n=()=>{let i;try{i={...A.strokeStyle??p.ESDistanceMeasurement.defaults.strokeStyle}}catch(o){console.error("ESDistanceMeasurement strokeStyle 属性类型错误!",o),i={...p.ESDistanceMeasurement.defaults.strokeStyle}}t.callUeFunc({f:"update",p:{id:A.id,strokeStyle:i}})},s=this.dv(w.createNextAnimateFrameEvent(A.strokeStyleChanged));this.d(s.don(n)),this.d(A.createdEvent.don(n))}};C(St,"type",St.register("ESUeViewer",p.ESDistanceMeasurement.type,St));let jn=St;const It=class It extends Er{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(It,"type",It.register("ESUeViewer",p.ESLocalPolygon.type,It));let Sr=It;const Tt=class Tt extends Sr{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Tt,"type",Tt.register("ESUeViewer",p.ESDynamicWater.type,Tt));let As=Tt;const Ht=class Ht extends lA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}this.d(e.widgetEvent.don(n=>{if(n.objId!==A.id)return;const{type:s,properties:i}=n;A.widgetEvent.emit({type:s,properties:i})}))}};C(Ht,"type",Ht.register("ESUeViewer",p.ESEntityCluster.type,Ht));let es=Ht;const Me=class Me extends cA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Me,"type",Me.register("ESUeViewer",p.ESExcavate.type,Me)),C(Me,"propValFuncs",{...cA.propValFuncs,targetID:A=>{if(!A)return"";const e=p.ESSceneObject.getSceneObject(A);return e?e.getMainClass().id:A}});let ts=Me;const Lt=class Lt extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Lt,"type",Lt.register("ESUeViewer",p.ESFireParticleSystem.type,Lt));let rs=Lt;const bt=class bt extends lA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}const n=this.ad(w.reactJson(""));{const o=()=>{if(typeof A.url=="string")n.value=p.ESSceneObject.context.getStrFromEnv(A.url);else{const a=A.url;a.url=p.ESSceneObject.context.getStrFromEnv(a.url),n.value=a}};o(),this.ad(A.urlChanged.don(o))}const s=()=>{t.callUeFunc({f:"update",p:{id:A.id,url:n.value??p.ESForestTileset.defaults.url,treeTypes:A.treeTypes??p.ESForestTileset.defaults.treeTypes,xiaoBanWidget:A.xiaoBanWidget??p.ESForestTileset.defaults.xiaoBanWidgetDefault,youShiSZ:A.youShiSZ??p.ESForestTileset.defaults.youShiSZ,diLei:A.diLei??p.ESForestTileset.defaults.diLei,senLinLB:A.senLinLB??p.ESForestTileset.defaults.senLinLB,labelMaterial:A.labelMaterial??p.ESForestTileset.defaults.labelMaterial,heightOffset:A.heightOffset??p.ESForestTileset.defaults.heightOffset}})},i=this.dv(w.createNextAnimateFrameEvent(n.changed,A.treeTypesChanged,A.xiaoBanWidgetChanged,A.youShiSZChanged,A.diLeiChanged,A.senLinLBChanged,A.labelMaterialChanged,A.heightOffsetChanged));this.d(i.don(s)),this.d(A.createdEvent.don(s))}};C(bt,"type",bt.register("ESUeViewer",p.ESForestTileset.type,bt));let ns=bt;/*!
|
|
92
92
|
* html2canvas 1.4.1 <https://html2canvas.hertzen.com>
|
|
93
93
|
* Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
|
|
94
94
|
* Released under MIT License
|
|
@@ -109,10 +109,10 @@ Msg: ${e}`;console.warn(t)}};u.verboseLogLevel=5,function(r){r.LIST_STREAMERS="l
|
|
|
109
109
|
content: "" !important;
|
|
110
110
|
display: none !important;
|
|
111
111
|
}`,dw=function(r){uw(r,"."+$s+lw+Jc+`
|
|
112
|
-
.`+Zs+cw+Jc)},uw=function(r,A){var e=r.ownerDocument;if(e){var t=e.createElement("style");t.textContent=A,r.appendChild(t)}},zc=function(){function r(){}return r.getOrigin=function(A){var e=r._link;return e?(e.href=A,e.href=e.href,e.protocol+e.hostname+e.port):"about:blank"},r.isSameOrigin=function(A){return r.getOrigin(A)===r._origin},r.setContext=function(A){r._link=A.document.createElement("a"),r._origin=r.getOrigin(A.location.href)},r._origin="about:blank",r}(),hw=function(){function r(A,e){this.context=A,this._options=e,this._cache={}}return r.prototype.addImage=function(A){var e=Promise.resolve();return this.has(A)||(js(A)||ww(A))&&(this._cache[A]=this.loadImage(A)).catch(function(){}),e},r.prototype.match=function(A){return this._cache[A]},r.prototype.loadImage=function(A){return dA(this,void 0,void 0,function(){var e,t,n,s,i=this;return nA(this,function(o){switch(o.label){case 0:return e=zc.isSameOrigin(A),t=!qs(A)&&this._options.useCORS===!0&&eA.SUPPORT_CORS_IMAGES&&!e,n=!qs(A)&&!e&&!js(A)&&typeof this._options.proxy=="string"&&eA.SUPPORT_CORS_XHR&&!t,!e&&this._options.allowTaint===!1&&!qs(A)&&!js(A)&&!n&&!t?[2]:(s=A,n?[4,this.proxy(s)]:[3,2]);case 1:s=o.sent(),o.label=2;case 2:return this.context.logger.debug("Added image "+A.substring(0,256)),[4,new Promise(function(a,l){var c=new Image;c.onload=function(){return a(c)},c.onerror=l,(pw(s)||t)&&(c.crossOrigin="anonymous"),c.src=s,c.complete===!0&&setTimeout(function(){return a(c)},500),i._options.imageTimeout>0&&setTimeout(function(){return l("Timed out ("+i._options.imageTimeout+"ms) loading image")},i._options.imageTimeout)})];case 3:return[2,o.sent()]}})})},r.prototype.has=function(A){return typeof this._cache[A]<"u"},r.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},r.prototype.proxy=function(A){var e=this,t=this._options.proxy;if(!t)throw new Error("No proxy defined");var n=A.substring(0,256);return new Promise(function(s,i){var o=eA.SUPPORT_RESPONSE_TYPE?"blob":"text",a=new XMLHttpRequest;a.onload=function(){if(a.status===200)if(o==="text")s(a.response);else{var h=new FileReader;h.addEventListener("load",function(){return s(h.result)},!1),h.addEventListener("error",function(d){return i(d)},!1),h.readAsDataURL(a.response)}else i("Failed to proxy resource "+n+" with status code "+a.status)},a.onerror=i;var l=t.indexOf("?")>-1?"&":"?";if(a.open("GET",""+t+l+"url="+encodeURIComponent(A)+"&responseType="+o),o!=="text"&&a instanceof XMLHttpRequest&&(a.responseType=o),e._options.imageTimeout){var c=e._options.imageTimeout;a.timeout=c,a.ontimeout=function(){return i("Timed out ("+c+"ms) proxying "+n)}}a.send()})},r}(),gw=/^data:image\/svg\+xml/i,Bw=/^data:image\/.*;base64,/i,fw=/^data:image\/.*/i,ww=function(r){return eA.SUPPORT_SVG_DRAWING||!Cw(r)},qs=function(r){return fw.test(r)},pw=function(r){return Bw.test(r)},js=function(r){return r.substr(0,4)==="blob"},Cw=function(r){return r.substr(-3).toLowerCase()==="svg"||gw.test(r)},S=function(){function r(A,e){this.type=0,this.x=A,this.y=e}return r.prototype.add=function(A,e){return new r(this.x+A,this.y+e)},r}(),Ie=function(r,A,e){return new S(r.x+(A.x-r.x)*e,r.y+(A.y-r.y)*e)},Bn=function(){function r(A,e,t,n){this.type=1,this.start=A,this.startControl=e,this.endControl=t,this.end=n}return r.prototype.subdivide=function(A,e){var t=Ie(this.start,this.startControl,A),n=Ie(this.startControl,this.endControl,A),s=Ie(this.endControl,this.end,A),i=Ie(t,n,A),o=Ie(n,s,A),a=Ie(i,o,A);return e?new r(this.start,t,i,a):new r(a,o,s,this.end)},r.prototype.add=function(A,e){return new r(this.start.add(A,e),this.startControl.add(A,e),this.endControl.add(A,e),this.end.add(A,e))},r.prototype.reverse=function(){return new r(this.end,this.endControl,this.startControl,this.start)},r}(),CA=function(r){return r.type===1},vw=function(){function r(A){var e=A.styles,t=A.bounds,n=st(e.borderTopLeftRadius,t.width,t.height),s=n[0],i=n[1],o=st(e.borderTopRightRadius,t.width,t.height),a=o[0],l=o[1],c=st(e.borderBottomRightRadius,t.width,t.height),h=c[0],d=c[1],B=st(e.borderBottomLeftRadius,t.width,t.height),g=B[0],f=B[1],m=[];m.push((s+a)/t.width),m.push((g+h)/t.width),m.push((i+f)/t.height),m.push((l+d)/t.height);var F=Math.max.apply(Math,m);F>1&&(s/=F,i/=F,a/=F,l/=F,h/=F,d/=F,g/=F,f/=F);var Q=t.width-a,y=t.height-d,L=t.width-h,T=t.height-f,E=e.borderTopWidth,R=e.borderRightWidth,K=e.borderBottomWidth,M=e.borderLeftWidth,W=_(e.paddingTop,A.bounds.width),iA=_(e.paddingRight,A.bounds.width),uA=_(e.paddingBottom,A.bounds.width),G=_(e.paddingLeft,A.bounds.width);this.topLeftBorderDoubleOuterBox=s>0||i>0?O(t.left+M/3,t.top+E/3,s-M/3,i-E/3,k.TOP_LEFT):new S(t.left+M/3,t.top+E/3),this.topRightBorderDoubleOuterBox=s>0||i>0?O(t.left+Q,t.top+E/3,a-R/3,l-E/3,k.TOP_RIGHT):new S(t.left+t.width-R/3,t.top+E/3),this.bottomRightBorderDoubleOuterBox=h>0||d>0?O(t.left+L,t.top+y,h-R/3,d-K/3,k.BOTTOM_RIGHT):new S(t.left+t.width-R/3,t.top+t.height-K/3),this.bottomLeftBorderDoubleOuterBox=g>0||f>0?O(t.left+M/3,t.top+T,g-M/3,f-K/3,k.BOTTOM_LEFT):new S(t.left+M/3,t.top+t.height-K/3),this.topLeftBorderDoubleInnerBox=s>0||i>0?O(t.left+M*2/3,t.top+E*2/3,s-M*2/3,i-E*2/3,k.TOP_LEFT):new S(t.left+M*2/3,t.top+E*2/3),this.topRightBorderDoubleInnerBox=s>0||i>0?O(t.left+Q,t.top+E*2/3,a-R*2/3,l-E*2/3,k.TOP_RIGHT):new S(t.left+t.width-R*2/3,t.top+E*2/3),this.bottomRightBorderDoubleInnerBox=h>0||d>0?O(t.left+L,t.top+y,h-R*2/3,d-K*2/3,k.BOTTOM_RIGHT):new S(t.left+t.width-R*2/3,t.top+t.height-K*2/3),this.bottomLeftBorderDoubleInnerBox=g>0||f>0?O(t.left+M*2/3,t.top+T,g-M*2/3,f-K*2/3,k.BOTTOM_LEFT):new S(t.left+M*2/3,t.top+t.height-K*2/3),this.topLeftBorderStroke=s>0||i>0?O(t.left+M/2,t.top+E/2,s-M/2,i-E/2,k.TOP_LEFT):new S(t.left+M/2,t.top+E/2),this.topRightBorderStroke=s>0||i>0?O(t.left+Q,t.top+E/2,a-R/2,l-E/2,k.TOP_RIGHT):new S(t.left+t.width-R/2,t.top+E/2),this.bottomRightBorderStroke=h>0||d>0?O(t.left+L,t.top+y,h-R/2,d-K/2,k.BOTTOM_RIGHT):new S(t.left+t.width-R/2,t.top+t.height-K/2),this.bottomLeftBorderStroke=g>0||f>0?O(t.left+M/2,t.top+T,g-M/2,f-K/2,k.BOTTOM_LEFT):new S(t.left+M/2,t.top+t.height-K/2),this.topLeftBorderBox=s>0||i>0?O(t.left,t.top,s,i,k.TOP_LEFT):new S(t.left,t.top),this.topRightBorderBox=a>0||l>0?O(t.left+Q,t.top,a,l,k.TOP_RIGHT):new S(t.left+t.width,t.top),this.bottomRightBorderBox=h>0||d>0?O(t.left+L,t.top+y,h,d,k.BOTTOM_RIGHT):new S(t.left+t.width,t.top+t.height),this.bottomLeftBorderBox=g>0||f>0?O(t.left,t.top+T,g,f,k.BOTTOM_LEFT):new S(t.left,t.top+t.height),this.topLeftPaddingBox=s>0||i>0?O(t.left+M,t.top+E,Math.max(0,s-M),Math.max(0,i-E),k.TOP_LEFT):new S(t.left+M,t.top+E),this.topRightPaddingBox=a>0||l>0?O(t.left+Math.min(Q,t.width-R),t.top+E,Q>t.width+R?0:Math.max(0,a-R),Math.max(0,l-E),k.TOP_RIGHT):new S(t.left+t.width-R,t.top+E),this.bottomRightPaddingBox=h>0||d>0?O(t.left+Math.min(L,t.width-M),t.top+Math.min(y,t.height-K),Math.max(0,h-R),Math.max(0,d-K),k.BOTTOM_RIGHT):new S(t.left+t.width-R,t.top+t.height-K),this.bottomLeftPaddingBox=g>0||f>0?O(t.left+M,t.top+Math.min(T,t.height-K),Math.max(0,g-M),Math.max(0,f-K),k.BOTTOM_LEFT):new S(t.left+M,t.top+t.height-K),this.topLeftContentBox=s>0||i>0?O(t.left+M+G,t.top+E+W,Math.max(0,s-(M+G)),Math.max(0,i-(E+W)),k.TOP_LEFT):new S(t.left+M+G,t.top+E+W),this.topRightContentBox=a>0||l>0?O(t.left+Math.min(Q,t.width+M+G),t.top+E+W,Q>t.width+M+G?0:a-M+G,l-(E+W),k.TOP_RIGHT):new S(t.left+t.width-(R+iA),t.top+E+W),this.bottomRightContentBox=h>0||d>0?O(t.left+Math.min(L,t.width-(M+G)),t.top+Math.min(y,t.height+E+W),Math.max(0,h-(R+iA)),d-(K+uA),k.BOTTOM_RIGHT):new S(t.left+t.width-(R+iA),t.top+t.height-(K+uA)),this.bottomLeftContentBox=g>0||f>0?O(t.left+M+G,t.top+T,Math.max(0,g-(M+G)),f-(K+uA),k.BOTTOM_LEFT):new S(t.left+M+G,t.top+t.height-(K+uA))}return r}(),k;(function(r){r[r.TOP_LEFT=0]="TOP_LEFT",r[r.TOP_RIGHT=1]="TOP_RIGHT",r[r.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",r[r.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(k||(k={}));var O=function(r,A,e,t,n){var s=4*((Math.sqrt(2)-1)/3),i=e*s,o=t*s,a=r+e,l=A+t;switch(n){case k.TOP_LEFT:return new Bn(new S(r,l),new S(r,l-o),new S(a-i,A),new S(a,A));case k.TOP_RIGHT:return new Bn(new S(r,A),new S(r+i,A),new S(a,l-o),new S(a,l));case k.BOTTOM_RIGHT:return new Bn(new S(a,A),new S(a,A+o),new S(r+i,l),new S(r,l));case k.BOTTOM_LEFT:default:return new Bn(new S(a,l),new S(a-i,l),new S(r,A+o),new S(r,A))}},fn=function(r){return[r.topLeftBorderBox,r.topRightBorderBox,r.bottomRightBorderBox,r.bottomLeftBorderBox]},mw=function(r){return[r.topLeftContentBox,r.topRightContentBox,r.bottomRightContentBox,r.bottomLeftContentBox]},wn=function(r){return[r.topLeftPaddingBox,r.topRightPaddingBox,r.bottomRightPaddingBox,r.bottomLeftPaddingBox]},Fw=function(){function r(A,e,t){this.offsetX=A,this.offsetY=e,this.matrix=t,this.type=0,this.target=6}return r}(),pn=function(){function r(A,e){this.path=A,this.target=e,this.type=1}return r}(),Qw=function(){function r(A){this.opacity=A,this.type=2,this.target=6}return r}(),Uw=function(r){return r.type===0},Yc=function(r){return r.type===1},Ew=function(r){return r.type===2},$c=function(r,A){return r.length===A.length?r.some(function(e,t){return e===A[t]}):!1},yw=function(r,A,e,t,n){return r.map(function(s,i){switch(i){case 0:return s.add(A,e);case 1:return s.add(A+t,e);case 2:return s.add(A+t,e+n);case 3:return s.add(A,e+n)}return s})},Zc=function(){function r(A){this.element=A,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return r}(),qc=function(){function r(A,e){if(this.container=A,this.parent=e,this.effects=[],this.curves=new vw(this.container),this.container.styles.opacity<1&&this.effects.push(new Qw(this.container.styles.opacity)),this.container.styles.transform!==null){var t=this.container.bounds.left+this.container.styles.transformOrigin[0].number,n=this.container.bounds.top+this.container.styles.transformOrigin[1].number,s=this.container.styles.transform;this.effects.push(new Fw(t,n,s))}if(this.container.styles.overflowX!==0){var i=fn(this.curves),o=wn(this.curves);$c(i,o)?this.effects.push(new pn(i,6)):(this.effects.push(new pn(i,2)),this.effects.push(new pn(o,4)))}}return r.prototype.getEffects=function(A){for(var e=[2,3].indexOf(this.container.styles.position)===-1,t=this.parent,n=this.effects.slice(0);t;){var s=t.effects.filter(function(a){return!Yc(a)});if(e||t.container.styles.position!==0||!t.parent){if(n.unshift.apply(n,s),e=[2,3].indexOf(t.container.styles.position)===-1,t.container.styles.overflowX!==0){var i=fn(t.curves),o=wn(t.curves);$c(i,o)||n.unshift(new pn(o,6))}}else n.unshift.apply(n,s);t=t.parent}return n.filter(function(a){return Z(a.target,A)})},r}(),Ai=function(r,A,e,t){r.container.elements.forEach(function(n){var s=Z(n.flags,4),i=Z(n.flags,2),o=new qc(n,r);Z(n.styles.display,2048)&&t.push(o);var a=Z(n.flags,8)?[]:t;if(s||i){var l=s||n.styles.isPositioned()?e:A,c=new Zc(o);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var h=n.styles.zIndex.order;if(h<0){var d=0;l.negativeZIndex.some(function(g,f){return h>g.element.container.styles.zIndex.order?(d=f,!1):d>0}),l.negativeZIndex.splice(d,0,c)}else if(h>0){var B=0;l.positiveZIndex.some(function(g,f){return h>=g.element.container.styles.zIndex.order?(B=f+1,!1):B>0}),l.positiveZIndex.splice(B,0,c)}else l.zeroOrAutoZIndexOrTransformedOrOpacity.push(c)}else n.styles.isFloating()?l.nonPositionedFloats.push(c):l.nonPositionedInlineLevel.push(c);Ai(o,c,s?c:e,a)}else n.styles.isInlineLevel()?A.inlineLevel.push(o):A.nonInlineLevel.push(o),Ai(o,A,e,a);Z(n.flags,8)&&jc(n,a)})},jc=function(r,A){for(var e=r instanceof Vs?r.start:1,t=r instanceof Vs?r.reversed:!1,n=0;n<A.length;n++){var s=A[n];s.container instanceof Uc&&typeof s.container.value=="number"&&s.container.value!==0&&(e=s.container.value),s.listValue=dt(e,s.container.styles.listStyleType,!0),e+=t?-1:1}},Sw=function(r){var A=new qc(r,null),e=new Zc(A),t=[];return Ai(A,e,e,t),jc(A.container,t),e},Ad=function(r,A){switch(A){case 0:return vA(r.topLeftBorderBox,r.topLeftPaddingBox,r.topRightBorderBox,r.topRightPaddingBox);case 1:return vA(r.topRightBorderBox,r.topRightPaddingBox,r.bottomRightBorderBox,r.bottomRightPaddingBox);case 2:return vA(r.bottomRightBorderBox,r.bottomRightPaddingBox,r.bottomLeftBorderBox,r.bottomLeftPaddingBox);case 3:default:return vA(r.bottomLeftBorderBox,r.bottomLeftPaddingBox,r.topLeftBorderBox,r.topLeftPaddingBox)}},Iw=function(r,A){switch(A){case 0:return vA(r.topLeftBorderBox,r.topLeftBorderDoubleOuterBox,r.topRightBorderBox,r.topRightBorderDoubleOuterBox);case 1:return vA(r.topRightBorderBox,r.topRightBorderDoubleOuterBox,r.bottomRightBorderBox,r.bottomRightBorderDoubleOuterBox);case 2:return vA(r.bottomRightBorderBox,r.bottomRightBorderDoubleOuterBox,r.bottomLeftBorderBox,r.bottomLeftBorderDoubleOuterBox);case 3:default:return vA(r.bottomLeftBorderBox,r.bottomLeftBorderDoubleOuterBox,r.topLeftBorderBox,r.topLeftBorderDoubleOuterBox)}},Tw=function(r,A){switch(A){case 0:return vA(r.topLeftBorderDoubleInnerBox,r.topLeftPaddingBox,r.topRightBorderDoubleInnerBox,r.topRightPaddingBox);case 1:return vA(r.topRightBorderDoubleInnerBox,r.topRightPaddingBox,r.bottomRightBorderDoubleInnerBox,r.bottomRightPaddingBox);case 2:return vA(r.bottomRightBorderDoubleInnerBox,r.bottomRightPaddingBox,r.bottomLeftBorderDoubleInnerBox,r.bottomLeftPaddingBox);case 3:default:return vA(r.bottomLeftBorderDoubleInnerBox,r.bottomLeftPaddingBox,r.topLeftBorderDoubleInnerBox,r.topLeftPaddingBox)}},Hw=function(r,A){switch(A){case 0:return Cn(r.topLeftBorderStroke,r.topRightBorderStroke);case 1:return Cn(r.topRightBorderStroke,r.bottomRightBorderStroke);case 2:return Cn(r.bottomRightBorderStroke,r.bottomLeftBorderStroke);case 3:default:return Cn(r.bottomLeftBorderStroke,r.topLeftBorderStroke)}},Cn=function(r,A){var e=[];return CA(r)?e.push(r.subdivide(.5,!1)):e.push(r),CA(A)?e.push(A.subdivide(.5,!0)):e.push(A),e},vA=function(r,A,e,t){var n=[];return CA(r)?n.push(r.subdivide(.5,!1)):n.push(r),CA(e)?n.push(e.subdivide(.5,!0)):n.push(e),CA(t)?n.push(t.subdivide(.5,!0).reverse()):n.push(t),CA(A)?n.push(A.subdivide(.5,!1).reverse()):n.push(A),n},ed=function(r){var A=r.bounds,e=r.styles;return A.add(e.borderLeftWidth,e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth),-(e.borderTopWidth+e.borderBottomWidth))},vn=function(r){var A=r.styles,e=r.bounds,t=_(A.paddingLeft,e.width),n=_(A.paddingRight,e.width),s=_(A.paddingTop,e.width),i=_(A.paddingBottom,e.width);return e.add(t+A.borderLeftWidth,s+A.borderTopWidth,-(A.borderRightWidth+A.borderLeftWidth+t+n),-(A.borderTopWidth+A.borderBottomWidth+s+i))},Lw=function(r,A){return r===0?A.bounds:r===2?vn(A):ed(A)},bw=function(r,A){return r===0?A.bounds:r===2?vn(A):ed(A)},ei=function(r,A,e){var t=Lw(He(r.styles.backgroundOrigin,A),r),n=bw(He(r.styles.backgroundClip,A),r),s=Mw(He(r.styles.backgroundSize,A),e,t),i=s[0],o=s[1],a=st(He(r.styles.backgroundPosition,A),t.width-i,t.height-o),l=Dw(He(r.styles.backgroundRepeat,A),a,s,t,n),c=Math.round(t.left+a[0]),h=Math.round(t.top+a[1]);return[l,c,h,i,o]},Te=function(r){return N(r)&&r.value===Ue.AUTO},mn=function(r){return typeof r=="number"},Mw=function(r,A,e){var t=A[0],n=A[1],s=A[2],i=r[0],o=r[1];if(!i)return[0,0];if(Y(i)&&o&&Y(o))return[_(i,e.width),_(o,e.height)];var a=mn(s);if(N(i)&&(i.value===Ue.CONTAIN||i.value===Ue.COVER)){if(mn(s)){var l=e.width/e.height;return l<s!=(i.value===Ue.COVER)?[e.width,e.width/s]:[e.height*s,e.height]}return[e.width,e.height]}var c=mn(t),h=mn(n),d=c||h;if(Te(i)&&(!o||Te(o))){if(c&&h)return[t,n];if(!a&&!d)return[e.width,e.height];if(d&&a){var B=c?t:n*s,g=h?n:t/s;return[B,g]}var f=c?t:e.width,m=h?n:e.height;return[f,m]}if(a){var F=0,Q=0;return Y(i)?F=_(i,e.width):Y(o)&&(Q=_(o,e.height)),Te(i)?F=Q*s:(!o||Te(o))&&(Q=F/s),[F,Q]}var y=null,L=null;if(Y(i)?y=_(i,e.width):o&&Y(o)&&(L=_(o,e.height)),y!==null&&(!o||Te(o))&&(L=c&&h?y/t*n:e.height),L!==null&&Te(i)&&(y=c&&h?L/n*t:e.width),y!==null&&L!==null)return[y,L];throw new Error("Unable to calculate background-size for element")},He=function(r,A){var e=r[A];return typeof e>"u"?r[0]:e},Dw=function(r,A,e,t,n){var s=A[0],i=A[1],o=e[0],a=e[1];switch(r){case 2:return[new S(Math.round(t.left),Math.round(t.top+i)),new S(Math.round(t.left+t.width),Math.round(t.top+i)),new S(Math.round(t.left+t.width),Math.round(a+t.top+i)),new S(Math.round(t.left),Math.round(a+t.top+i))];case 3:return[new S(Math.round(t.left+s),Math.round(t.top)),new S(Math.round(t.left+s+o),Math.round(t.top)),new S(Math.round(t.left+s+o),Math.round(t.height+t.top)),new S(Math.round(t.left+s),Math.round(t.height+t.top))];case 1:return[new S(Math.round(t.left+s),Math.round(t.top+i)),new S(Math.round(t.left+s+o),Math.round(t.top+i)),new S(Math.round(t.left+s+o),Math.round(t.top+i+a)),new S(Math.round(t.left+s),Math.round(t.top+i+a))];default:return[new S(Math.round(n.left),Math.round(n.top)),new S(Math.round(n.left+n.width),Math.round(n.top)),new S(Math.round(n.left+n.width),Math.round(n.height+n.top)),new S(Math.round(n.left),Math.round(n.height+n.top))]}},Rw="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",td="Hidden Text",Pw=function(){function r(A){this._data={},this._document=A}return r.prototype.parseMetrics=function(A,e){var t=this._document.createElement("div"),n=this._document.createElement("img"),s=this._document.createElement("span"),i=this._document.body;t.style.visibility="hidden",t.style.fontFamily=A,t.style.fontSize=e,t.style.margin="0",t.style.padding="0",t.style.whiteSpace="nowrap",i.appendChild(t),n.src=Rw,n.width=1,n.height=1,n.style.margin="0",n.style.padding="0",n.style.verticalAlign="baseline",s.style.fontFamily=A,s.style.fontSize=e,s.style.margin="0",s.style.padding="0",s.appendChild(this._document.createTextNode(td)),t.appendChild(s),t.appendChild(n);var o=n.offsetTop-s.offsetTop+2;t.removeChild(s),t.appendChild(this._document.createTextNode(td)),t.style.lineHeight="normal",n.style.verticalAlign="super";var a=n.offsetTop-t.offsetTop+2;return i.removeChild(t),{baseline:o,middle:a}},r.prototype.getMetrics=function(A,e){var t=A+" "+e;return typeof this._data[t]>"u"&&(this._data[t]=this.parseMetrics(A,e)),this._data[t]},r}(),rd=function(){function r(A,e){this.context=A,this.options=e}return r}(),Kw=1e4,xw=function(r){FA(A,r);function A(e,t){var n=r.call(this,e,t)||this;return n._activeEffects=[],n.canvas=t.canvas?t.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),t.canvas||(n.canvas.width=Math.floor(t.width*t.scale),n.canvas.height=Math.floor(t.height*t.scale),n.canvas.style.width=t.width+"px",n.canvas.style.height=t.height+"px"),n.fontMetrics=new Pw(document),n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-t.x,-t.y),n.ctx.textBaseline="bottom",n._activeEffects=[],n.context.logger.debug("Canvas renderer initialized ("+t.width+"x"+t.height+") with scale "+t.scale),n}return A.prototype.applyEffects=function(e){for(var t=this;this._activeEffects.length;)this.popEffect();e.forEach(function(n){return t.applyEffect(n)})},A.prototype.applyEffect=function(e){this.ctx.save(),Ew(e)&&(this.ctx.globalAlpha=e.opacity),Uw(e)&&(this.ctx.translate(e.offsetX,e.offsetY),this.ctx.transform(e.matrix[0],e.matrix[1],e.matrix[2],e.matrix[3],e.matrix[4],e.matrix[5]),this.ctx.translate(-e.offsetX,-e.offsetY)),Yc(e)&&(this.path(e.path),this.ctx.clip()),this._activeEffects.push(e)},A.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},A.prototype.renderStack=function(e){return dA(this,void 0,void 0,function(){var t;return nA(this,function(n){switch(n.label){case 0:return t=e.element.container.styles,t.isVisible()?[4,this.renderStackContent(e)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},A.prototype.renderNode=function(e){return dA(this,void 0,void 0,function(){return nA(this,function(t){switch(t.label){case 0:if(Z(e.container.flags,16))debugger;return e.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(e)]:[3,3];case 1:return t.sent(),[4,this.renderNodeContent(e)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},A.prototype.renderTextWithLetterSpacing=function(e,t,n){var s=this;if(t===0)this.ctx.fillText(e.text,e.bounds.left,e.bounds.top+n);else{var i=_s(e.text);i.reduce(function(o,a){return s.ctx.fillText(a,o,e.bounds.top+n),o+s.ctx.measureText(a).width},e.bounds.left)}},A.prototype.createFontStyle=function(e){var t=e.fontVariant.filter(function(i){return i==="normal"||i==="small-caps"}).join(""),n=Vw(e.fontFamily).join(", "),s=nt(e.fontSize)?""+e.fontSize.number+e.fontSize.unit:e.fontSize.number+"px";return[[e.fontStyle,t,e.fontWeight,s,n].join(" "),n,s]},A.prototype.renderTextNode=function(e,t){return dA(this,void 0,void 0,function(){var n,s,i,o,a,l,c,h,d=this;return nA(this,function(B){return n=this.createFontStyle(t),s=n[0],i=n[1],o=n[2],this.ctx.font=s,this.ctx.direction=t.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",a=this.fontMetrics.getMetrics(i,o),l=a.baseline,c=a.middle,h=t.paintOrder,e.textBounds.forEach(function(g){h.forEach(function(f){switch(f){case 0:d.ctx.fillStyle=q(t.color),d.renderTextWithLetterSpacing(g,t.letterSpacing,l);var m=t.textShadow;m.length&&g.text.trim().length&&(m.slice(0).reverse().forEach(function(F){d.ctx.shadowColor=q(F.color),d.ctx.shadowOffsetX=F.offsetX.number*d.options.scale,d.ctx.shadowOffsetY=F.offsetY.number*d.options.scale,d.ctx.shadowBlur=F.blur.number,d.renderTextWithLetterSpacing(g,t.letterSpacing,l)}),d.ctx.shadowColor="",d.ctx.shadowOffsetX=0,d.ctx.shadowOffsetY=0,d.ctx.shadowBlur=0),t.textDecorationLine.length&&(d.ctx.fillStyle=q(t.textDecorationColor||t.color),t.textDecorationLine.forEach(function(F){switch(F){case 1:d.ctx.fillRect(g.bounds.left,Math.round(g.bounds.top+l),g.bounds.width,1);break;case 2:d.ctx.fillRect(g.bounds.left,Math.round(g.bounds.top),g.bounds.width,1);break;case 3:d.ctx.fillRect(g.bounds.left,Math.ceil(g.bounds.top+c),g.bounds.width,1);break}}));break;case 1:t.webkitTextStrokeWidth&&g.text.trim().length&&(d.ctx.strokeStyle=q(t.webkitTextStrokeColor),d.ctx.lineWidth=t.webkitTextStrokeWidth,d.ctx.lineJoin=window.chrome?"miter":"round",d.ctx.strokeText(g.text,g.bounds.left,g.bounds.top+l)),d.ctx.strokeStyle="",d.ctx.lineWidth=0,d.ctx.lineJoin="miter";break}})}),[2]})})},A.prototype.renderReplacedElement=function(e,t,n){if(n&&e.intrinsicWidth>0&&e.intrinsicHeight>0){var s=vn(e),i=wn(t);this.path(i),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(n,0,0,e.intrinsicWidth,e.intrinsicHeight,s.left,s.top,s.width,s.height),this.ctx.restore()}},A.prototype.renderNodeContent=function(e){return dA(this,void 0,void 0,function(){var t,n,s,i,o,a,Q,Q,l,c,h,d,L,B,g,T,f,m,F,Q,y,L,T;return nA(this,function(E){switch(E.label){case 0:this.applyEffects(e.getEffects(4)),t=e.container,n=e.curves,s=t.styles,i=0,o=t.textNodes,E.label=1;case 1:return i<o.length?(a=o[i],[4,this.renderTextNode(a,s)]):[3,4];case 2:E.sent(),E.label=3;case 3:return i++,[3,1];case 4:if(!(t instanceof mc))return[3,8];E.label=5;case 5:return E.trys.push([5,7,,8]),[4,this.context.cache.match(t.src)];case 6:return Q=E.sent(),this.renderReplacedElement(t,n,Q),[3,8];case 7:return E.sent(),this.context.logger.error("Error loading image "+t.src),[3,8];case 8:if(t instanceof Fc&&this.renderReplacedElement(t,n,t.canvas),!(t instanceof Qc))return[3,12];E.label=9;case 9:return E.trys.push([9,11,,12]),[4,this.context.cache.match(t.svg)];case 10:return Q=E.sent(),this.renderReplacedElement(t,n,Q),[3,12];case 11:return E.sent(),this.context.logger.error("Error loading svg "+t.svg.substring(0,255)),[3,12];case 12:return t instanceof Ic&&t.tree?(l=new A(this.context,{scale:this.options.scale,backgroundColor:t.backgroundColor,x:0,y:0,width:t.width,height:t.height}),[4,l.render(t.tree)]):[3,14];case 13:c=E.sent(),t.width&&t.height&&this.ctx.drawImage(c,0,0,t.width,t.height,t.bounds.left,t.bounds.top,t.bounds.width,t.bounds.height),E.label=14;case 14:if(t instanceof Os&&(h=Math.min(t.bounds.width,t.bounds.height),t.type===ln?t.checked&&(this.ctx.save(),this.path([new S(t.bounds.left+h*.39363,t.bounds.top+h*.79),new S(t.bounds.left+h*.16,t.bounds.top+h*.5549),new S(t.bounds.left+h*.27347,t.bounds.top+h*.44071),new S(t.bounds.left+h*.39694,t.bounds.top+h*.5649),new S(t.bounds.left+h*.72983,t.bounds.top+h*.23),new S(t.bounds.left+h*.84,t.bounds.top+h*.34085),new S(t.bounds.left+h*.39363,t.bounds.top+h*.79)]),this.ctx.fillStyle=q(Ec),this.ctx.fill(),this.ctx.restore()):t.type===cn&&t.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(t.bounds.left+h/2,t.bounds.top+h/2,h/4,0,Math.PI*2,!0),this.ctx.fillStyle=q(Ec),this.ctx.fill(),this.ctx.restore())),kw(t)&&t.value.length){switch(d=this.createFontStyle(s),L=d[0],B=d[1],g=this.fontMetrics.getMetrics(L,B).baseline,this.ctx.font=L,this.ctx.fillStyle=q(s.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=Nw(t.styles.textAlign),T=vn(t),f=0,t.styles.textAlign){case 1:f+=T.width/2;break;case 2:f+=T.width;break}m=T.add(f,0,0,-T.height/2+1),this.ctx.save(),this.path([new S(T.left,T.top),new S(T.left+T.width,T.top),new S(T.left+T.width,T.top+T.height),new S(T.left,T.top+T.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new lt(t.value,m),s.letterSpacing,g),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!Z(t.styles.display,2048))return[3,20];if(t.styles.listStyleImage===null)return[3,19];if(F=t.styles.listStyleImage,F.type!==0)return[3,18];Q=void 0,y=F.url,E.label=15;case 15:return E.trys.push([15,17,,18]),[4,this.context.cache.match(y)];case 16:return Q=E.sent(),this.ctx.drawImage(Q,t.bounds.left-(Q.width+10),t.bounds.top),[3,18];case 17:return E.sent(),this.context.logger.error("Error loading list-style-image "+y),[3,18];case 18:return[3,20];case 19:e.listValue&&t.styles.listStyleType!==-1&&(L=this.createFontStyle(s)[0],this.ctx.font=L,this.ctx.fillStyle=q(s.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",T=new bA(t.bounds.left,t.bounds.top+_(t.styles.paddingTop,t.bounds.width),t.bounds.width,tc(s.lineHeight,s.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new lt(e.listValue,T),s.letterSpacing,tc(s.lineHeight,s.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),E.label=20;case 20:return[2]}})})},A.prototype.renderStackContent=function(e){return dA(this,void 0,void 0,function(){var t,n,F,s,i,F,o,a,F,l,c,F,h,d,F,B,g,F,f,m,F;return nA(this,function(Q){switch(Q.label){case 0:if(Z(e.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(e.element)];case 1:Q.sent(),t=0,n=e.negativeZIndex,Q.label=2;case 2:return t<n.length?(F=n[t],[4,this.renderStack(F)]):[3,5];case 3:Q.sent(),Q.label=4;case 4:return t++,[3,2];case 5:return[4,this.renderNodeContent(e.element)];case 6:Q.sent(),s=0,i=e.nonInlineLevel,Q.label=7;case 7:return s<i.length?(F=i[s],[4,this.renderNode(F)]):[3,10];case 8:Q.sent(),Q.label=9;case 9:return s++,[3,7];case 10:o=0,a=e.nonPositionedFloats,Q.label=11;case 11:return o<a.length?(F=a[o],[4,this.renderStack(F)]):[3,14];case 12:Q.sent(),Q.label=13;case 13:return o++,[3,11];case 14:l=0,c=e.nonPositionedInlineLevel,Q.label=15;case 15:return l<c.length?(F=c[l],[4,this.renderStack(F)]):[3,18];case 16:Q.sent(),Q.label=17;case 17:return l++,[3,15];case 18:h=0,d=e.inlineLevel,Q.label=19;case 19:return h<d.length?(F=d[h],[4,this.renderNode(F)]):[3,22];case 20:Q.sent(),Q.label=21;case 21:return h++,[3,19];case 22:B=0,g=e.zeroOrAutoZIndexOrTransformedOrOpacity,Q.label=23;case 23:return B<g.length?(F=g[B],[4,this.renderStack(F)]):[3,26];case 24:Q.sent(),Q.label=25;case 25:return B++,[3,23];case 26:f=0,m=e.positiveZIndex,Q.label=27;case 27:return f<m.length?(F=m[f],[4,this.renderStack(F)]):[3,30];case 28:Q.sent(),Q.label=29;case 29:return f++,[3,27];case 30:return[2]}})})},A.prototype.mask=function(e){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(e.slice(0).reverse()),this.ctx.closePath()},A.prototype.path=function(e){this.ctx.beginPath(),this.formatPath(e),this.ctx.closePath()},A.prototype.formatPath=function(e){var t=this;e.forEach(function(n,s){var i=CA(n)?n.start:n;s===0?t.ctx.moveTo(i.x,i.y):t.ctx.lineTo(i.x,i.y),CA(n)&&t.ctx.bezierCurveTo(n.startControl.x,n.startControl.y,n.endControl.x,n.endControl.y,n.end.x,n.end.y)})},A.prototype.renderRepeat=function(e,t,n,s){this.path(e),this.ctx.fillStyle=t,this.ctx.translate(n,s),this.ctx.fill(),this.ctx.translate(-n,-s)},A.prototype.resizeImage=function(e,t,n){var s;if(e.width===t&&e.height===n)return e;var i=(s=this.canvas.ownerDocument)!==null&&s!==void 0?s:document,o=i.createElement("canvas");o.width=Math.max(1,t),o.height=Math.max(1,n);var a=o.getContext("2d");return a.drawImage(e,0,0,e.width,e.height,0,0,t,n),o},A.prototype.renderBackgroundImage=function(e){return dA(this,void 0,void 0,function(){var t,n,s,i,o,a;return nA(this,function(l){switch(l.label){case 0:t=e.styles.backgroundImage.length-1,n=function(c){var h,d,B,W,gA,BA,G,tA,K,g,W,gA,BA,G,tA,f,m,F,Q,y,L,T,E,R,K,M,W,iA,uA,G,tA,zA,gA,BA,de,IA,YA,ue,he,PA,ge,KA;return nA(this,function(Ke){switch(Ke.label){case 0:if(c.type!==0)return[3,5];h=void 0,d=c.url,Ke.label=1;case 1:return Ke.trys.push([1,3,,4]),[4,s.context.cache.match(d)];case 2:return h=Ke.sent(),[3,4];case 3:return Ke.sent(),s.context.logger.error("Error loading background-image "+d),[3,4];case 4:return h&&(B=ei(e,t,[h.width,h.height,h.width/h.height]),W=B[0],gA=B[1],BA=B[2],G=B[3],tA=B[4],K=s.ctx.createPattern(s.resizeImage(h,G,tA),"repeat"),s.renderRepeat(W,K,gA,BA)),[3,6];case 5:Qg(c)?(g=ei(e,t,[null,null,null]),W=g[0],gA=g[1],BA=g[2],G=g[3],tA=g[4],f=pg(c.angle,G,tA),m=f[0],F=f[1],Q=f[2],y=f[3],L=f[4],T=document.createElement("canvas"),T.width=G,T.height=tA,E=T.getContext("2d"),R=E.createLinearGradient(F,y,Q,L),Wl(c.stops,m).forEach(function(vr){return R.addColorStop(vr.stop,q(vr.color))}),E.fillStyle=R,E.fillRect(0,0,G,tA),G>0&&tA>0&&(K=s.ctx.createPattern(T,"repeat"),s.renderRepeat(W,K,gA,BA))):Ug(c)&&(M=ei(e,t,[null,null,null]),W=M[0],iA=M[1],uA=M[2],G=M[3],tA=M[4],zA=c.position.length===0?[Ss]:c.position,gA=_(zA[0],G),BA=_(zA[zA.length-1],tA),de=Cg(c,gA,BA,G,tA),IA=de[0],YA=de[1],IA>0&&YA>0&&(ue=s.ctx.createRadialGradient(iA+gA,uA+BA,0,iA+gA,uA+BA,IA),Wl(c.stops,IA*2).forEach(function(vr){return ue.addColorStop(vr.stop,q(vr.color))}),s.path(W),s.ctx.fillStyle=ue,IA!==YA?(he=e.bounds.left+.5*e.bounds.width,PA=e.bounds.top+.5*e.bounds.height,ge=YA/IA,KA=1/ge,s.ctx.save(),s.ctx.translate(he,PA),s.ctx.transform(1,0,0,ge,0,0),s.ctx.translate(-he,-PA),s.ctx.fillRect(iA,KA*(uA-PA)+PA,G,tA*KA),s.ctx.restore()):s.ctx.fill())),Ke.label=6;case 6:return t--,[2]}})},s=this,i=0,o=e.styles.backgroundImage.slice(0).reverse(),l.label=1;case 1:return i<o.length?(a=o[i],[5,n(a)]):[3,4];case 2:l.sent(),l.label=3;case 3:return i++,[3,1];case 4:return[2]}})})},A.prototype.renderSolidBorder=function(e,t,n){return dA(this,void 0,void 0,function(){return nA(this,function(s){return this.path(Ad(n,t)),this.ctx.fillStyle=q(e),this.ctx.fill(),[2]})})},A.prototype.renderDoubleBorder=function(e,t,n,s){return dA(this,void 0,void 0,function(){var i,o;return nA(this,function(a){switch(a.label){case 0:return t<3?[4,this.renderSolidBorder(e,n,s)]:[3,2];case 1:return a.sent(),[2];case 2:return i=Iw(s,n),this.path(i),this.ctx.fillStyle=q(e),this.ctx.fill(),o=Tw(s,n),this.path(o),this.ctx.fill(),[2]}})})},A.prototype.renderNodeBackgroundAndBorders=function(e){return dA(this,void 0,void 0,function(){var t,n,s,i,o,a,l,c,h=this;return nA(this,function(d){switch(d.label){case 0:return this.applyEffects(e.getEffects(2)),t=e.container.styles,n=!OA(t.backgroundColor)||t.backgroundImage.length,s=[{style:t.borderTopStyle,color:t.borderTopColor,width:t.borderTopWidth},{style:t.borderRightStyle,color:t.borderRightColor,width:t.borderRightWidth},{style:t.borderBottomStyle,color:t.borderBottomColor,width:t.borderBottomWidth},{style:t.borderLeftStyle,color:t.borderLeftColor,width:t.borderLeftWidth}],i=Gw(He(t.backgroundClip,0),e.curves),n||t.boxShadow.length?(this.ctx.save(),this.path(i),this.ctx.clip(),OA(t.backgroundColor)||(this.ctx.fillStyle=q(t.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(e.container)]):[3,2];case 1:d.sent(),this.ctx.restore(),t.boxShadow.slice(0).reverse().forEach(function(B){h.ctx.save();var g=fn(e.curves),f=B.inset?0:Kw,m=yw(g,-f+(B.inset?1:-1)*B.spread.number,(B.inset?1:-1)*B.spread.number,B.spread.number*(B.inset?-2:2),B.spread.number*(B.inset?-2:2));B.inset?(h.path(g),h.ctx.clip(),h.mask(m)):(h.mask(g),h.ctx.clip(),h.path(m)),h.ctx.shadowOffsetX=B.offsetX.number+f,h.ctx.shadowOffsetY=B.offsetY.number,h.ctx.shadowColor=q(B.color),h.ctx.shadowBlur=B.blur.number,h.ctx.fillStyle=B.inset?q(B.color):"rgba(0,0,0,1)",h.ctx.fill(),h.ctx.restore()}),d.label=2;case 2:o=0,a=0,l=s,d.label=3;case 3:return a<l.length?(c=l[a],c.style!==0&&!OA(c.color)&&c.width>0?c.style!==2?[3,5]:[4,this.renderDashedDottedBorder(c.color,c.width,o,e.curves,2)]:[3,11]):[3,13];case 4:return d.sent(),[3,11];case 5:return c.style!==3?[3,7]:[4,this.renderDashedDottedBorder(c.color,c.width,o,e.curves,3)];case 6:return d.sent(),[3,11];case 7:return c.style!==4?[3,9]:[4,this.renderDoubleBorder(c.color,c.width,o,e.curves)];case 8:return d.sent(),[3,11];case 9:return[4,this.renderSolidBorder(c.color,o,e.curves)];case 10:d.sent(),d.label=11;case 11:o++,d.label=12;case 12:return a++,[3,3];case 13:return[2]}})})},A.prototype.renderDashedDottedBorder=function(e,t,n,s,i){return dA(this,void 0,void 0,function(){var o,a,l,c,h,d,B,g,f,m,F,Q,y,L,T,E,T,E;return nA(this,function(R){return this.ctx.save(),o=Hw(s,n),a=Ad(s,n),i===2&&(this.path(a),this.ctx.clip()),CA(a[0])?(l=a[0].start.x,c=a[0].start.y):(l=a[0].x,c=a[0].y),CA(a[1])?(h=a[1].end.x,d=a[1].end.y):(h=a[1].x,d=a[1].y),n===0||n===2?B=Math.abs(l-h):B=Math.abs(c-d),this.ctx.beginPath(),i===3?this.formatPath(o):this.formatPath(a.slice(0,2)),g=t<3?t*3:t*2,f=t<3?t*2:t,i===3&&(g=t,f=t),m=!0,B<=g*2?m=!1:B<=g*2+f?(F=B/(2*g+f),g*=F,f*=F):(Q=Math.floor((B+f)/(g+f)),y=(B-Q*g)/(Q-1),L=(B-(Q+1)*g)/Q,f=L<=0||Math.abs(f-y)<Math.abs(f-L)?y:L),m&&(i===3?this.ctx.setLineDash([0,g+f]):this.ctx.setLineDash([g,f])),i===3?(this.ctx.lineCap="round",this.ctx.lineWidth=t):this.ctx.lineWidth=t*2+1.1,this.ctx.strokeStyle=q(e),this.ctx.stroke(),this.ctx.setLineDash([]),i===2&&(CA(a[0])&&(T=a[3],E=a[0],this.ctx.beginPath(),this.formatPath([new S(T.end.x,T.end.y),new S(E.start.x,E.start.y)]),this.ctx.stroke()),CA(a[1])&&(T=a[1],E=a[2],this.ctx.beginPath(),this.formatPath([new S(T.end.x,T.end.y),new S(E.start.x,E.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},A.prototype.render=function(e){return dA(this,void 0,void 0,function(){var t;return nA(this,function(n){switch(n.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=q(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),t=Sw(e),[4,this.renderStack(t)];case 1:return n.sent(),this.applyEffects([]),[2,this.canvas]}})})},A}(rd),kw=function(r){return r instanceof Sc||r instanceof yc?!0:r instanceof Os&&r.type!==cn&&r.type!==ln},Gw=function(r,A){switch(r){case 0:return fn(A);case 2:return mw(A);case 1:default:return wn(A)}},Nw=function(r){switch(r){case 1:return"center";case 2:return"right";case 0:default:return"left"}},_w=["-apple-system","system-ui"],Vw=function(r){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?r.filter(function(A){return _w.indexOf(A)===-1}):r},Ow=function(r){FA(A,r);function A(e,t){var n=r.call(this,e,t)||this;return n.canvas=t.canvas?t.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),n.options=t,n.canvas.width=Math.floor(t.width*t.scale),n.canvas.height=Math.floor(t.height*t.scale),n.canvas.style.width=t.width+"px",n.canvas.style.height=t.height+"px",n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-t.x,-t.y),n.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+t.width+"x"+t.height+" at "+t.x+","+t.y+") with scale "+t.scale),n}return A.prototype.render=function(e){return dA(this,void 0,void 0,function(){var t,n;return nA(this,function(s){switch(s.label){case 0:return t=Ns(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,e),[4,Ww(t)];case 1:return n=s.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=q(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(n,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},A}(rd),Ww=function(r){return new Promise(function(A,e){var t=new Image;t.onload=function(){A(t)},t.onerror=e,t.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(r))})},Xw=function(){function r(A){var e=A.id,t=A.enabled;this.id=e,this.enabled=t,this.start=Date.now()}return r.prototype.debug=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,Ir([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},r.prototype.getTime=function(){return Date.now()-this.start},r.prototype.info=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,Ir([this.id,this.getTime()+"ms"],A))},r.prototype.warn=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,Ir([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},r.prototype.error=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,Ir([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},r.instances={},r}(),Jw=function(){function r(A,e){var t;this.windowBounds=e,this.instanceName="#"+r.instanceCount++,this.logger=new Xw({id:this.instanceName,enabled:A.logging}),this.cache=(t=A.cache)!==null&&t!==void 0?t:new hw(this,A)}return r.instanceCount=1,r}(),zw=function(r,A){return A===void 0&&(A={}),Yw(r,A)};typeof window<"u"&&zc.setContext(window);var Yw=function(r,A){return dA(void 0,void 0,void 0,function(){var e,t,n,s,i,o,a,l,c,h,d,B,g,f,m,F,Q,y,L,T,R,E,R,K,M,W,iA,uA,G,tA,zA,gA,BA,de,IA,YA,ue,he,PA,ge;return nA(this,function(KA){switch(KA.label){case 0:if(!r||typeof r!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(e=r.ownerDocument,!e)throw new Error("Element is not attached to a Document");if(t=e.defaultView,!t)throw new Error("Document is not attached to a Window");return n={allowTaint:(K=A.allowTaint)!==null&&K!==void 0?K:!1,imageTimeout:(M=A.imageTimeout)!==null&&M!==void 0?M:15e3,proxy:A.proxy,useCORS:(W=A.useCORS)!==null&&W!==void 0?W:!1},s=is({logging:(iA=A.logging)!==null&&iA!==void 0?iA:!0,cache:A.cache},n),i={windowWidth:(uA=A.windowWidth)!==null&&uA!==void 0?uA:t.innerWidth,windowHeight:(G=A.windowHeight)!==null&&G!==void 0?G:t.innerHeight,scrollX:(tA=A.scrollX)!==null&&tA!==void 0?tA:t.pageXOffset,scrollY:(zA=A.scrollY)!==null&&zA!==void 0?zA:t.pageYOffset},o=new bA(i.scrollX,i.scrollY,i.windowWidth,i.windowHeight),a=new Jw(s,o),l=(gA=A.foreignObjectRendering)!==null&&gA!==void 0?gA:!1,c={allowTaint:(BA=A.allowTaint)!==null&&BA!==void 0?BA:!1,onclone:A.onclone,ignoreElements:A.ignoreElements,inlineImages:l,copyStyles:l},a.logger.debug("Starting document clone with size "+o.width+"x"+o.height+" scrolled to "+-o.left+","+-o.top),h=new Xc(a,r,c),d=h.clonedReferenceElement,d?[4,h.toIFrame(e,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return B=KA.sent(),g=Xs(d)||$f(d)?Eu(d.ownerDocument):Tr(a,d),f=g.width,m=g.height,F=g.left,Q=g.top,y=$w(a,d,A.backgroundColor),L={canvas:A.canvas,backgroundColor:y,scale:(IA=(de=A.scale)!==null&&de!==void 0?de:t.devicePixelRatio)!==null&&IA!==void 0?IA:1,x:((YA=A.x)!==null&&YA!==void 0?YA:0)+F,y:((ue=A.y)!==null&&ue!==void 0?ue:0)+Q,width:(he=A.width)!==null&&he!==void 0?he:Math.ceil(f),height:(PA=A.height)!==null&&PA!==void 0?PA:Math.ceil(m)},l?(a.logger.debug("Document cloned, using foreign object rendering"),R=new Ow(a,L),[4,R.render(d)]):[3,3];case 2:return T=KA.sent(),[3,5];case 3:return a.logger.debug("Document cloned, element located at "+F+","+Q+" with size "+f+"x"+m+" using computed rendering"),a.logger.debug("Starting DOM parsing"),E=Hc(a,d),y===E.styles.backgroundColor&&(E.styles.backgroundColor=DA.TRANSPARENT),a.logger.debug("Starting renderer for element at "+L.x+","+L.y+" with size "+L.width+"x"+L.height),R=new xw(a,L),[4,R.render(E)];case 4:T=KA.sent(),KA.label=5;case 5:return(!((ge=A.removeContainer)!==null&&ge!==void 0)||ge)&&(Xc.destroy(B)||a.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),a.logger.debug("Finished rendering"),[2,T]}})})},$w=function(r,A,e){var t=A.ownerDocument,n=t.documentElement?it(r,getComputedStyle(t.documentElement).backgroundColor):DA.TRANSPARENT,s=t.body?it(r,getComputedStyle(t.body).backgroundColor):DA.TRANSPARENT,i=typeof e=="string"?it(r,e):e===null?DA.TRANSPARENT:4294967295;return A===t.documentElement?OA(n)?OA(s)?i:s:n:i};const Mt=class Mt extends p.EngineObject{constructor(A,e){super(A,e),this.ad(new w.ObjResettingWithEvent(A.renderInUEChanged,()=>A.renderInUE?new sd(A,e):new nd(A,e)))}};C(Mt,"type",Mt.register("ESUeViewer",p.ESGeoDiv.type,Mt));let ti=Mt;class nd extends w.Destroyable{constructor(e,t){super();C(this,"_screenPosition",this.disposeVar(w.reactArrayWithUndefined(void 0)));const n=t.viewer;if(!n){console.warn("viewer is undefined!");return}const s=this.disposeVar(new p.ESTextLabel);s.parentID=e.id,e.mainClass=s,t.add(s),this.dispose(()=>t.delete(s)),s.show=!1,this.dispose(w.bind([s,"position"],[e,"position"])),this.dispose(w.bind([s,"rotation"],[e,"rotation"])),this.dispose(w.bind([s,"flyToParam"],[e,"flyToParam"])),this.dispose(w.bind([s,"flyInParam"],[e,"flyInParam"])),this.dispose(e.calcFlyToParamEvent.disposableOn(()=>{$A(n,s.id)})),this.dispose(e.calcFlyInParamEvent.disposableOn(async()=>{if(!t.actived)return;const a=await t.getCurrentCameraInfo();if(!a)return;const{position:l,rotation:c}=a;e.flyInParam={position:l,rotation:c,flyDuration:1}})),this.dispose(e.smoothMoveEvent.disposableOn((a,l)=>{_e(n,s.id,a,l)})),this.dispose(e.smoothMoveWithRotationEvent.disposableOn((a,l,c)=>{ke(n,s.id,a,l,c)})),this.dispose(e.smoothMoveOnGroundEvent.disposableOn((a,l,c,h)=>{Ge(n,s.id,a,l,h,c)})),this.dispose(e.smoothMoveWithRotationOnGroundEvent.disposableOn((a,l,c,h,d)=>{Ne(n,s.id,a,l,c,h,d)})),this.dispose(e.flyToEvent.disposableOn((a,l)=>{s.flyTo(a)})),this.dispose(e.flyInEvent.don(a=>{s.flyIn(a)}));const i=this._screenPosition,o=this.disposeVar(new p.ESCustomDiv);o.parentID=e.id,t.add(o),this.dispose(()=>t.delete(o)),this.dispose(w.bind([o,"allowPicking"],[e,"allowPicking"]));{const a=this.disposeVar(w.createAnimateFrame()),l=()=>{e.show?a.restart(void 0,async()=>{if(!e.position)return;const c=await t.lonLatAltToScreenPosition(e.position);if(!this.isDestroyed())if(!c)this._screenPosition.value=void 0;else{const[h,d]=c;h===-1&&d===-1?this._screenPosition.value=void 0:this._screenPosition.value=[h,d]}}):a.cancel()};l(),this.dispose(e.showChanged.disposableOn(l))}{const a=()=>class extends w.Destroyable{constructor(d,B,g){if(super(),this._subContainer=d,!g)return;if(!e.instanceClass)throw new Error("!sceneObject.instanceClass");const f=new w.PosFloatDiv,m=f.element;this._subContainer.appendChild(m),this.dispose(()=>this._subContainer.removeChild(m)),m.onclick=F=>{(e.allowPicking??!1)&&e.pickedEvent.emit(new p.ESJPickedResult({div:m,pointerEvent:F},e,void 0,void 0,void 0,[F.x,F.y]))};{const F=()=>{e.editing?m.children[0].style.pointerEvents="none":m.children[0].style.pointerEvents="all"};F(),this.d(e.editingChanged.don(F))}{const F=()=>{const y=e.show;i.value&&y?(f.show=!0,f.winPos=[...i.value]):(f.show=!1,f.winPos=[0,0])};F();const Q=this.disposeVar(w.createNextAnimateFrameEvent(e.showChanged,i.changed));this.dispose(Q.disposableOn(F))}{const F=()=>{const[Q,y]=e.anchor??p.ESGeoDiv.defaults.anchor;f.originRatioX=Q,f.originRatioY=y};F(),this.dispose(e.anchorChanged.disposableOn(F))}{const F=()=>{f.opacity=e.opacity??p.ESGeoDiv.defaults.opacity};F(),this.dispose(e.opacityChanged.disposableOn(F))}this.disposeVar(new e.instanceClass(f.contentDiv,e,g))}},l=()=>{try{e.instanceClass?o.instanceClass=a():o.instanceClass=void 0}catch(h){console.error(h)}};l();const c=this.dv(w.createNextAnimateFrameEvent(e.instanceClassChanged,e.opacityChanged,e.anchorChanged,e.editingChanged,e.showChanged,e.allowPickingChanged));this.d(c.don(l))}}get screenPosition(){return this._screenPosition.value}get screenPositionChanged(){return this._screenPosition.changed}set screenPosition(e){this._screenPosition.value=e}}class sd extends w.Destroyable{constructor(e,t){super();C(this,"_imageLabel");C(this,"_hasClassDivAndPos",{});this._imageLabel=this.dv(new p.ESImageLabel),this._imageLabel.isHoverZoom=!1,this._imageLabel.parentID=e.id;const n=t.viewer;if(!n){console.warn("viewer is undefined!");return}e.mainClass=this._imageLabel;const s=this._imageLabel;t.add(s),this.d(()=>t.delete(s));{const i=()=>{if(!n)return;if(!e.instanceClass)throw new Error("!sceneObject.instanceClass");const l=document.createElement("div"),c=this.dv(new e.instanceClass(l,e,t))._container;if(c.style.opacity=e.opacity.toString()??p.ESGeoDiv.defaults.opacity,c.style.position="fixed",c.style.zIndex="-1",c.style.top="0px",!document.body.contains(c)){document.body.appendChild(c);let d=c?c.querySelectorAll("*[class]"):[];for(let B=0;B<d.length;B++){const g=d[B];var h=g.getBoundingClientRect();this._hasClassDivAndPos[g.className]=[g.offsetLeft,g.offsetTop,g.offsetLeft+h.width,g.offsetTop+h.height]}}zw(c,{backgroundColor:null,allowTaint:!0,useCORS:!0,width:c.offsetWidth,height:c.offsetHeight,scale:1}).then(d=>{document.body.contains(c)&&document.body.removeChild(c),s.url=d.toDataURL(),s.show=e.show}).catch(()=>{document.body.contains(c)&&document.body.removeChild(c)})},o=()=>{try{e.instanceClass?i():(s.url="",s.show=!1)}catch(l){console.error(l)}};o();const a=this.dv(w.createNextAnimateFrameEvent(e.instanceClassChanged,e.opacityChanged));this.d(a.don(o))}{const i=()=>{s.show=e.show};s.show=!1,this.ad(e.showChanged.don(i))}this.d(w.track([s,"anchor"],[e,"anchor"])),this.d(w.bind([s,"position"],[e,"position"])),this.d(w.bind([s,"rotation"],[e,"rotation"])),this.d(w.bind([s,"flyToParam"],[e,"flyToParam"])),this.d(w.bind([s,"flyInParam"],[e,"flyInParam"])),this.d(w.bind([s,"allowPicking"],[e,"allowPicking"])),this.d(w.bind([s,"scale"],[e,"scale"])),this.d(w.track([s,"minVisibleDistance"],[e,"minVisibleDistance"])),this.d(w.track([s,"maxVisibleDistance"],[e,"maxVisibleDistance"])),this.ad(e.automaticLandingEvent.don(()=>{s.automaticLanding()})),this.d(t.widgetEvent.don(i=>{if(i.objId!==this._imageLabel.id)return;const{type:o,add:a}=i;if(o==="leftClick"&&a){const l=(a==null?void 0:a.classNames)??[],c=Object.keys(this._hasClassDivAndPos);for(let h=0;h<c.length;h++){const d=c[h];let B=this._hasClassDivAndPos[d];a&&a.mouseRelativePos&&a.mouseRelativePos[0]>=B[0]&&a.mouseRelativePos[0]<=B[2]&&a.mouseRelativePos[1]>=B[1]&&a.mouseRelativePos[1]<=B[3]&&l.push(d)}a.classNames=l}e.widgetEvent.emit({type:o,add:a})})),this.d(e.calcFlyToParamEvent.don(()=>{$A(n,s.id)})),this.d(e.calcFlyInParamEvent.don(()=>{const i=t.getCurrentCameraInfo();if(!i)return;const{position:o,rotation:a}=i;e.flyInParam={position:o,rotation:a,flyDuration:1}})),this.d(e.smoothMoveEvent.don((i,o)=>{_e(n,s.id,i,o)})),this.d(e.smoothMoveWithRotationEvent.don((i,o,a)=>{ke(n,s.id,i,o,a)})),this.d(e.smoothMoveOnGroundEvent.don((i,o,a,l)=>{Ge(n,s.id,i,o,l,a)})),this.d(e.smoothMoveWithRotationOnGroundEvent.don((i,o,a,l,c)=>{Ne(n,s.id,i,o,a,l,c)})),this.d(e.flyToEvent.don((i,o)=>{s.flyTo(i)})),this.d(e.flyInEvent.don(i=>{s.flyIn(i)}))}}const Dt=class Dt extends lA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.d(A.flyToFeatureIndexEvent.don((n,s)=>{t.callUeFunc({f:"flyToFeatureIndex",p:{id:A.id,index:n,duration:s}})})),this.d(A.flyToFeatureEvent.don((n,s,i)=>{t.callUeFunc({f:"flyToFeature",p:{id:A.id,key:n,value:s,duration:i}})}))}};C(Dt,"type",Dt.register("ESUeViewer",p.ESGeoJson.type,Dt));let ri=Dt;const Rt=class Rt extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Rt,"type",Rt.register("ESUeViewer",p.ESGeoLineString.type,Rt));let Fn=Rt;const Pt=class Pt extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Pt,"type",Pt.register("ESUeViewer",p.ESGeoRectangle.type,Pt));let ni=Pt;const Kt=class Kt extends cA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Kt,"type",Kt.register("ESUeViewer",p.ESGeoWater.type,Kt));let si=Kt;const oe=class oe extends x{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.d(A.setNodePositionEvent.don((n,s)=>{io(t,A.id,n,s)})),this.d(A.setNodeRotationEvent.don((n,s)=>{oo(t,A.id,n,s)})),this.d(A.setNodeScaleEvent.don((n,s)=>{ao(t,A.id,n,s)}))}};C(oe,"forceUeUpdateProps",[...x.forceUeUpdateProps,"url"]),C(oe,"propValFuncs",{...x.propValFuncs,url:A=>typeof A=="string"?p.ESSceneObject.context.getStrFromEnv(p.rpToap(A)):(A.url=p.ESSceneObject.context.getStrFromEnv(p.rpToap(A.url)),A),czmMaximumScale:null,czmMinimumPixelSize:null,czmNativeScale:null,czmColor:null}),C(oe,"type",oe.register("ESUeViewer",p.ESGltfModel.type,oe));let ii=oe;const xt=class xt extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(xt,"type",xt.register("ESUeViewer",p.ESHeightMeasurement.type,xt));let oi=xt;const kt=class kt extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}const n=async(i,o,a,l)=>{const{viewer:c}=i;if(!c){console.error("AIMoveTo: ueViewer.viewer is undefined");return}const h=await c.callUeFunc({f:"AIMoveTo",p:{id:o,Destination:a,Time:l}});return h.error&&console.error("AIMoveTo:",h.error),h};this.d(A.aiMoveToEvent.don((i,o)=>{n(e,A.id,i,o)}));const s=async(i,o)=>{const{viewer:a}=i;if(!a){console.error("StopAIMove: ueViewer.viewer is undefined");return}const l=await a.callUeFunc({f:"StopAIMove",p:{id:o}});return l.error&&console.error("StopAIMove:",l.error),l};this.d(A.stopAIMoveEvent.don(()=>{s(e,A.id)}))}};C(kt,"type",kt.register("ESUeViewer",p.ESHuman.type,kt));let ai=kt;const ae=class ae extends UA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}A.anchor=[.5,1]}};C(ae,"type",ae.register("ESUeViewer",p.ESImageLabel.type,ae)),C(ae,"forceUeUpdateProps",[...UA.forceUeUpdateProps,"url"]),C(ae,"propValFuncs",{...UA.propValFuncs,url:A=>typeof A=="string"?p.ESSceneObject.context.getStrFromEnv(p.rpToap(A)):(A.url=p.ESSceneObject.context.getStrFromEnv(p.rpToap(A.url)),A)});let li=ae;const Gt=class Gt extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Gt,"type",Gt.register("ESUeViewer",p.ESLevelRuntimeModel.type,Gt));let ci=Gt;const Nt=class Nt extends Er{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Nt,"type",Nt.register("ESUeViewer",p.ESLocalCircle.type,Nt));let di=Nt;const _t=class _t extends lA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(_t,"type",_t.register("ESUeViewer",p.ESLocalPolygonZ.type,_t));let ui=_t;const Vt=class Vt extends Er{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Vt,"type",Vt.register("ESUeViewer",p.ESLocalRectangle.type,Vt));let hi=Vt;const Ot=class Ot extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Ot,"type",Ot.register("ESUeViewer",p.ESLocalSkyBox.type,Ot));let gi=Ot;const Wt=class Wt extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Wt,"type",Wt.register("ESUeViewer",p.ESLocationMeasurement.type,Wt));let Bi=Wt;const Xt=class Xt extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Xt,"type",Xt.register("ESUeViewer",p.ESPipeFence.type,Xt));let fi=Xt;const Jt=class Jt extends Fn{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Jt,"type",Jt.register("ESUeViewer",p.ESPipeline.type,Jt));let wi=Jt;const zt=class zt extends yr{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.d(A.highlightFeatureEvent.don(n=>{const s=typeof n=="number"?n.toString():n;to(t,A.id,s)})),this.d(A.highlightFeatureAndFlyToEvent.don((n,s,i,o)=>{const a=typeof n=="number"?n.toString():n;ro(t,A.id,a,o??1)})),this.d(A.setLayerVisibleEvent.don((n,s)=>{let i="";typeof s!="string"?i=JSON.stringify(s):i=s,no(t,A.id,i)})),this.d(A.setLayerColorEvent.don((n,s)=>{let i="";typeof s!="string"?i=JSON.stringify(s):i=s,so(t,A.id,i)}))}};C(zt,"type",zt.register("ESUeViewer",p.ESPipeserTileset.type,zt));let pi=zt;const Yt=class Yt extends cA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Yt,"type",Yt.register("ESUeViewer",p.ESPit.type,Yt));let Ci=Yt;const $t=class $t extends UA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.ad(A.getInitialStyleEvent.don(async()=>{try{const n=await t.callUeFunc({f:"GetInitialStyle",p:{id:A.id}});n.error!=""&&console.error("getInitialStyleEvent:",n.error),A.initialStyle.value=structuredClone(n.re)}catch(n){console.error("getInitialStyleEvent:",n),A.initialStyle.value=void 0}}))}};C($t,"type",$t.register("ESUeViewer",p.ESPoi2D.type,$t));let vi=$t;const Zt=class Zt extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Zt,"type",Zt.register("ESUeViewer",p.ESPoi3D.type,Zt));let mi=Zt;const le=class le extends lA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(le,"type",le.register("ESUeViewer",p.ESPoiTileset.type,le)),C(le,"forceUeUpdateProps",[...lA.forceUeUpdateProps,"url"]),C(le,"propValFuncs",{...lA.propValFuncs,url:A=>typeof A=="string"?p.ESSceneObject.context.getStrFromEnv(A):(A.url=p.ESSceneObject.context.getStrFromEnv(A.url),A)});let Fi=le;const qt=class qt extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(qt,"type",qt.register("ESUeViewer",p.ESPolygonFence.type,qt));let Qi=qt;const De=class De extends cA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(De,"type",De.register("ESUeViewer",p.ESPolygonFlattenedPlane.type,De)),C(De,"propValFuncs",{...cA.propValFuncs,targetID:A=>{if(!A)return;const e=p.ESSceneObject.getSceneObject(A);return e?e.getMainClass().id:A}});let Ui=De;const jt=class jt extends cA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(jt,"type",jt.register("ESUeViewer",p.ESPolygonWithHole.type,jt));let Ei=jt;const Ar=class Ar extends jA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}this.d(()=>{A.ids=[]}),this.d(A.highlightInner3DtilesetEvent.don(n=>{n.highlight=!0})),this.d(A.removeHighlightInner3DtilesetEvent.don(n=>{n.highlight=!1}));{const n=o=>{o=o.toLocaleLowerCase();let a=[255,255,255,1];if(o.startsWith("#")){if(o.length===4){let l=parseInt(o[1]+o[1],16),c=parseInt(o[2]+o[2],16),h=parseInt(o[3]+o[3],16);a=[l,c,h,1]}else if(o.length===7){let l=parseInt(o.substring(1,3),16),c=parseInt(o.substring(3,5),16),h=parseInt(o.substring(5,7),16);a=[l,c,h,1]}}else if(o.startsWith("rgba")){let l=o.match(/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)$/);if(l){let c=parseInt(l[1]),h=parseInt(l[2]),d=parseInt(l[3]),B=parseFloat(l[4]);a=[c,h,d,B]}}else if(o.startsWith("rgb")){let l=o.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);if(l){let c=parseInt(l[1]),h=parseInt(l[2]),d=parseInt(l[3]);a=[c,h,d,1]}}else console.error("color类型只能为#rrggbb、#rgb、rgba(r,g,b,a)、rgb(r,g,b)");return[a[0]/255,a[1]/255,a[2]/255,a[3]]},s=()=>{const o=A.layerConfig;if(!o)return;const a=[];o.forEach(l=>{o.filter(h=>h.dataset==l.dataset).length==1?a.push({condition:[{field:"dataset",op:"==",value:l.dataset}],color:n(l.value.color??"rgb(255,255,255)"),show:l.value.visible}):a.push({condition:[{field:"layer",op:"==",value:l.layer},{field:"dataset",op:"==",value:l.dataset}],color:n(l.value.color??"rgb(255,255,255)"),show:l.value.visible})}),A.setFeatureStyle(a)};s();const i=this.dv(w.createNextAnimateFrameEvent(A.layerConfigChanged,A.colorBlendModeChanged));this.d(i.don(()=>{s()}))}}};C(Ar,"type",Ar.register("ESUeViewer",p.ESRtsTileset.type,Ar));let yi=Ar;const er=class er extends lA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}this.d(A.addTreesEvent.don(n=>{p.addTreesCallFunc(e,A.id,n)})),this.d(A.removeAllTreesEvent.don(()=>{p.removeAllTreesCallFunc(e,A.id)})),this.d(A.updateTreeParamsEvent.don(n=>{p.updateTreeParamsCallFunc(e,A.id,n)})),this.d(A.cutDownTreesEvent.don((n,s)=>{p.cutDownTreesCallFunc(e,A.id,n,s)})),this.d(A.growthSimulationEvent.don((n,s,i)=>{p.growthSimulationCallFunc(e,A.id,n,s,i)}))}};C(er,"type",er.register("ESUeViewer",p.ESSeparateFoliage.type,er));let Si=er;const tr=class tr extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(tr,"type",tr.register("ESUeViewer",p.ESSubmergingAnalysis.type,tr));let Ii=tr;const rr=class rr extends cA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.d(A.startEvent.don(()=>{t.callUeFunc({f:"Start",p:{id:A.id}})})),this.d(A.stopEvent.don(()=>{t.callUeFunc({f:"Stop",p:{id:A.id}})}))}};C(rr,"type",rr.register("ESUeViewer",p.ESSunshineAnalysis.type,rr));let Ti=rr;const nr=class nr extends cA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.d(A.startEvent.don(()=>{t.callUeFunc({f:"Start",p:{id:A.id}})}))}};C(nr,"type",nr.register("ESUeViewer",p.ESSurfaceAreaMeasurement.type,nr));let Hi=nr;const sr=class sr extends UA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(sr,"type",sr.register("ESUeViewer",p.ESTextLabel.type,sr));let Li=sr;const Re=class Re extends UA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.d(A.callFunctionEvent.don(async(n,s)=>{const i=await yn(t,A.id,n,s);A.__callFunctionResultEvent.emit(i)}))}};C(Re,"type",Re.register("ESUeViewer",p.ESUEWidget.type,Re)),C(Re,"propValFuncs",{...UA.propValFuncs,info:A=>JSON.stringify(A??{})});let bi=Re;const id=r=>{switch(r){case 0:return"成功绑定";case 1:return"解绑之前的内容,成功绑定";case 2:return"未搜索到ActorTag,无法绑定";case 3:return"搜索到ActorTag但对应的Actor不是场景原有的,而是新建的,无法绑定";case 4:return"搜索到ActorTag对应的Actor是地形或3DTileset,无法绑定";default:return"未知错误"}},Zw=r=>{switch(r){case 0:return"创建成功";case 1:return"未找到对应的资源,无法创建";case 2:return"Id与场景中现有的ActorTag重复,创建后可能出现问题,创建失败";default:return"未知错误"}},ir=class ir extends p.EngineObject{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn(`${A.id} UeESUnrealActor viewer is undefined!`);return}this.d(()=>{Un(t,A.id)});const n=async()=>{l()||await t.callUeFunc({f:"update",p:{id:A.id,name:A.name,show:A.show,rotation:A.rotation,flyToParam:A.flyToParam??p.ESVisualObject.defaults.flyToParam,flyInParam:A.flyInParam??p.ESVisualObject.defaults.flyInParam,highlight:A.highlight,collision:A.collision,scale:A.scale,minVisibleDistance:A.minVisibleDistance,maxVisibleDistance:A.maxVisibleDistance}})},s=this.dv(w.createNextAnimateFrameEvent(A.showChanged,A.nameChanged,A.rotationChanged,A.flyToParamChanged,A.flyInParamChanged,A.highlightChanged,A.collisionChanged,A.scaleChanged,A.minVisibleDistanceChanged,A.maxVisibleDistanceChanged));this.d(s.don(n)),this.d(A.flushEvent.don(()=>s.flush()));let i,o;const a=async()=>{l()||(await t.callUeFunc({f:"update",p:{id:A.id,position:A.position}}),(e.debug??!1)&&console.log(`updatePostion:${A.position},actorTag:${A.actorTag},actorClass:${A.actorClass}`))},l=()=>!i&&!o?(console.warn(`${A.id} 未绑定ActorTag或未创建ActorClass!`),!0):!1,c=async()=>{const{id:d}=A,B=await e.unBindActorByID(d);B&&B.error!==""&&console.warn(`${A.id} UeESUnrealActor UnBindActorByID: ${B.error}`),i=void 0;const g=await t.callUeFunc({f:"destroy",p:{id:d}});if(g&&g.error!==""){console.warn(`${A.id} UeESUnrealActor DestroyActorByID: ${g.error}`);return}o=void 0},h=this.dv(w.react({type:"ActorClass",actorClass:"default"}));{const d=this.dv(w.createNextAnimateFrameEvent(A.actorClassChanged,A.actorTagChanged)),B=async()=>{A.actorTag!==""?h.value={type:"ActorTag",actorTag:A.actorTag}:h.value={type:"ActorClass",actorClass:A.actorClass===""?"default":A.actorClass}};B(),this.d(d.don(B)),this.d(A.flushEvent.don(()=>d.flush()))}{const d=this.dv(w.createProcessingFromAsyncFunc(async g=>{if(await g.promise(c()),h.value.type==="ActorTag"){const{actorTag:f}=h.value;await g.promise(c());try{A.lastActorStatus="null";const m=await g.promise(e.bindActorByTag(A.id,f));if(!m)return;if(m.error!==""){console.warn(`${A.id} UeESUnrealActor BindActorByTag:${f},${m.error}`);return}if(m.re.type===0)A.lastActorStatus="bound",i=f;else if(m.re.type===1)A.lastActorStatus="bound",i=f,console.warn(`${A.id} UeESUnrealActor BindActorByTag:${f},${id(m.re.type)}`);else{i=void 0,console.warn(`${A.id} UeESUnrealActor BindActorByTag error:${f}, ${id(m.re.type)}`);return}}catch(m){console.warn(`${A.id} UeESUnrealActor BindActorByTag catch error:${f}, ${m}`);return}}else if(h.value.type==="ActorClass"){const{actorClass:f}=h.value;try{const m=await g.promise(e.createActorByClass(A.id,f));if(!m)return;if(m.error!==""){console.warn(`${A.id} UeESUnrealActor CreateActorByClass error :${f}, ${m.error}`);return}if(m.re.type===0)A.lastActorStatus="created",o=f;else{console.warn(`${A.id} UeESUnrealActor CreateActorByClass error type :${f},${Zw(m.re.type)}`);return}}catch(m){console.warn(`${A.id} UeESUnrealActor CreateActorByClass error catch :${f}, ${JSON.stringify(m)}`);return}}await g.promise(n()),await g.promise(a())})),B=async()=>{d.restart()};B(),this.d(h.changed.don(B))}this.d(A.positionChanged.don(a)),this.d(A.callFunctionEvent.don(async(d,B)=>{if(l()){A.__callFunctionResultEvent.emit(void 0);return}const g=await yn(t,A.id,d,B);A.__callFunctionResultEvent.emit(g)})),this.d(A.smoothMoveEvent.don((d,B)=>{l()||_e(t,A.id,d,B)})),this.d(A.smoothMoveWithRotationEvent.don((d,B,g)=>{l()||ke(t,A.id,d,B,g)})),this.d(A.smoothMoveOnGroundEvent.don((d,B,g,f)=>{l()||Ge(t,A.id,d,B,f,g)})),this.d(A.smoothMoveWithRotationOnGroundEvent.don((d,B,g,f,m)=>{l()||Ne(t,A.id,d,B,g,f,m)})),this.d(A.automaticLandingEvent.don(d=>{if(l())return;const B=[A.position[0],A.position[1]];e.getHeightByLonLat(A.position[0],A.position[1],"Visibility").then(g=>{g!==null&&(A.position=[...B,g],A.collision=d)})})),this.d(A.flyToEvent.don(async(d,B)=>{if(l())return;const g=await Be(t,A.id,d);let f="over";g===void 0?f="error":g.endType===0?f="over":g.endType===1&&(f="cancelled"),A.flyOverEvent.emit(B,f,e)})),this.d(A.calcFlyToParamEvent.don(()=>{l()||$A(t,A.id)})),this.d(A.calcFlyInParamEvent.don(async()=>{if(!e.actived)return;const d=await e.getCurrentCameraInfo();if(!d)return;const{position:B,rotation:g}=d;A.flyInParam={position:B,rotation:g,flyDuration:1}})),this.d(e.propChanged.don(d=>{l()||d.objId===A.id&&Object.keys(d.props).forEach(B=>{const g=d.props[B]===null?void 0:d.props[B];A[B]=g})}))}};C(ir,"type",ir.register("ESUeViewer",p.ESUnrealActor.type,ir));let Mi=ir;const or=class or extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(or,"type",or.register("ESUeViewer",p.ESVideoFusion.type,or));let Di=or;const ar=class ar extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(ar,"type",ar.register("ESUeViewer",p.ESViewShed.type,ar));let Ri=ar;const lr=class lr extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is underfined!");return}}};C(lr,"type",lr.register("ESUeViewer",p.ESVisibilityAnalysis.type,lr));let Pi=lr;const cr=class cr extends cA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.ad(w.track([A,"volume"],[A,"cutAndFillVolume"])),this.d(A.startEvent.don(()=>{t.callUeFunc({f:"Start",p:{id:A.id}})})),this.d(A.clearEvent.don(()=>{t.callUeFunc({f:"Clear",p:{id:A.id}})}))}};C(cr,"type",cr.register("ESUeViewer",p.ESVolumeMeasurement.type,cr));let Ki=cr;const Pe=class Pe extends UA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Pe,"type",Pe.register("ESUeViewer",p.ESWidget.type,Pe)),C(Pe,"propValFuncs",{...UA.propValFuncs,info:A=>JSON.stringify(A??{})});let xi=Pe;const dr=class dr extends p.EngineObject{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}A.poi.actorTag=A.human.id,A.poi.positionOffset=[0,0,A.poiOffsetHeight-.8],this.d(A.poiOffsetHeightChanged.don(()=>{A.poi.positionOffset=[0,0,A.poiOffsetHeight-.8]})),this.d(()=>{A.poi.actorTag=""})}};C(dr,"type",dr.register("ESUeViewer",p.ESHumanPoi.type,dr));let ki=dr;p.ESSceneObject.context.getStrFromEnv(p.ESNavigator.defaults.imgUrl);const ur=class ur extends p.EngineObject{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}const n=this.disposeVar(new p.ESCustomDiv);e.add(n),this.dispose(()=>e.delete(n)),this.dispose(w.track([n,"show"],[A,"show"])),n.instanceClass=class extends w.Destroyable{constructor(i,o,a){super(),this._subContainer=i;const l=document.createElement("div");this._subContainer.appendChild(l),this.dispose(()=>this._subContainer.removeChild(l));{const d=async()=>{const B=await e.getCurrentCameraInfo(),g=B==null?void 0:B.position,m=[...B==null?void 0:B.rotation];m[0]=360,e.flyIn(g,m)};l.addEventListener("click",d),l.style.cursor="pointer",this.dispose(()=>l.removeEventListener("click",d))}{const d=()=>{l.style.width=`${A.cssSize?A.cssSize:p.ESNavigator.defaults.cssSize}px`,l.style.height=`${A.cssSize?A.cssSize:p.ESNavigator.defaults.cssSize}px`};d(),A.dispose(A.cssSizeChanged.disposableOn(d))}l.style.position="fixed";{const d=()=>{l.style.top=`${A.cssPosition?A.cssPosition[0]:p.ESNavigator.defaults.cssPosition[0]}px`,l.style.right=`${A.cssPosition?A.cssPosition[1]:p.ESNavigator.defaults.cssPosition[1]}px`};d(),A.dispose(A.cssPositionChanged.disposableOn(d))}l.style.transition=" right 0.4s linear",l.style.cursor="pointer";const c=document.createElement("div");l.appendChild(c),this.dispose(()=>l.removeChild(c)),c.style.width="100%",c.style.height="100%",c.style.position="relative";const h=document.createElement("img");c.appendChild(h),this.dispose(()=>c.removeChild(h)),h.style.width="100%",h.style.height="100%",h.style.border="none";{const d=()=>h.src=A.imgUrl;d(),A.dispose(A.imgUrlChanged.disposableOn(d))}{const d=()=>{const m=-e.getCurrentCameraInfo().rotation[0];h.style.transform=`rotate(${m}deg)`};let B;const g=async()=>{d(),A.show?(l.style.display="block",B=setInterval(()=>{d()},1e3)):(l.style.display="none",clearInterval(B))};this.dispose(A.showChanged.disposableOn(g)),g(),this.dispose(()=>clearInterval(B))}h.style.transformOrigin="50% 50%"}}}};C(ur,"type",ur.register("ESUeViewer",p.ESNavigator.type,ur));let Gi=ur;const ce=class ce extends rA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}{const n=()=>{let s=A.materialMode==="blue"?"multipleArrows":A.materialMode==="purple"?"singleArrow":A.materialMode;t.callUeFunc({f:"update",p:{id:A.id,materialMode:s}})};this.dispose(A.materialModeChanged.disposableOn(n)),this.dispose(A.createdEvent.disposableOn(n))}}};C(ce,"type",ce.register("ESUeViewer",p.ESPath.type,ce)),C(ce,"forceUeUpdateProps",[...rA.forceUeUpdateProps]),C(ce,"propValFuncs",{...rA.propValFuncs,materialMode:null});let Ni=ce;async function qw(r){navigator.clipboard.writeText(r).then(function(){console.log("复制成功")},function(A){console.log("复制失败")})}const hr=class hr extends p.EngineObject{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}const n=this.disposeVar(new p.ESCustomDiv);e.add(n),this.dispose(()=>e.delete(n)),n.instanceClass=class extends w.Destroyable{constructor(i,o,a){if(super(),this._subContainer=i,!a||!(a instanceof LA))return;const l=document.createElement("div");this._subContainer.appendChild(l),this.dispose(()=>this._subContainer.removeChild(l)),l.style.width="100%",l.style.position="absolute",l.style.height=`${p.ESViewerStatusBar.defaults.height}px`,l.style.left="0",l.style.bottom="0",l.style.color="#fff",l.style.padding="0 20px 0 0",l.style.boxSizing="border-box",l.style.lineHeight=`${p.ESViewerStatusBar.defaults.height}px`,l.style.zIndex="100",l.style.alignContent="center",l.style.justifyContent="space-between";const c=document.createElement("span");l.appendChild(c),this.dispose(()=>l.removeChild(c));const h=document.createElement("span");c.appendChild(h),this.dispose(()=>c.removeChild(h));const d=document.createElement("span");c.appendChild(d),d.addEventListener("dblclick",function(){let g=d.innerHTML;g.startsWith("鼠标位置")&&(g=g.slice(5)),qw(g)}),d.style.cursor="pointer",this.dispose(()=>c.removeChild(d));const B=document.createElement("span");l.appendChild(B),this.dispose(()=>l.removeChild(B));{const g=()=>{l.style.height=(A.height??p.ESViewerStatusBar.defaults.height)+"px",l.style.lineHeight=(A.height??p.ESViewerStatusBar.defaults.height)+"px"};this.dispose(A.heightChanged.disposableOn(g)),g()}{const g=()=>{l.style.fontSize=(A.fontSize??p.ESViewerStatusBar.defaults.fontSize)+"px"};this.dispose(A.fontSizeChanged.disposableOn(g)),g()}{const g=()=>{A.bgColor?l.style.background=`rgba(${A.bgColor[0]*255},${A.bgColor[1]*255},${A.bgColor[2]*255},${A.bgColor[3]})`:l.style.background=`rgba(${p.ESViewerStatusBar.defaults.bgColor[0]},${p.ESViewerStatusBar.defaults.bgColor[1]},${p.ESViewerStatusBar.defaults.bgColor[2]},${p.ESViewerStatusBar.defaults.bgColor[3]})`};this.dispose(A.bgColorChanged.disposableOn(g)),g()}a.getVersion().then(g=>{g&&(B.innerText=`Ue 版本 : ${g[0]} `)}).catch(g=>{console.log(g)});{const g=()=>{let F="",Q="";F+=`帧率:${a.getFPS().toFixed(0)}FPS`,h.innerText=F;const y=e.getCurrentCameraInfo();F+=` 经度: ${y.position[0].toFixed(5)}° 纬度: ${y.position[1].toFixed(5)}° 高度: ${y.position[2].toFixed(2)}米 偏航角: ${y.rotation[0].toFixed(2)}° 俯仰角: ${y.rotation[1].toFixed(2)}° 翻滚角:${y.rotation[2].toFixed(2)}° `,h.innerText=F,e.pick().then(L=>{if(L){const{pickResult:T}=L;if(T&&T.position){const{position:E}=T;Q+=`鼠标位置:${E[0].toFixed(5)}° ${E[1].toFixed(5)}° ${E[2].toFixed(2)}m`}else Q+="暂时无法获取鼠标位置...";d.innerText=Q}}).catch(L=>{console.log(L)})};let f;const m=async()=>{g(),A.show?(l.style.display="flex",f=setInterval(()=>{g()},1e3)):(l.style.display="none",clearInterval(f))};this.dispose(A.showChanged.disposableOn(m)),m(),this.dispose(()=>clearInterval(f))}}}}};C(hr,"type",hr.register("ESUeViewer",p.ESViewerStatusBar.type,hr));let _i=hr;const gr=class gr extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(gr,"type",gr.register("ESUeViewer",p.ESGaussianSplatting.type,gr));let Vi=gr;const Br=class Br extends jA{constructor(e,t){super(e,t);C(this,"_es3DTileset",this.dv(new p.ES3DTileset));if(!t.viewer){console.warn("viewer is undefined!");return}this.es3DTileset.parentID=e.id,e.mainClass=this._es3DTileset;{const s=this._es3DTileset;t.add(s),this.dispose(()=>t.delete(s)),this.d(w.track([s,"allowPicking"],[e,"allowPicking"])),this.d(w.track([s,"collision"],[e,"collision"])),this.d(w.bind([s,"flyToParam"],[e,"flyToParam"])),this.d(w.bind([s,"flyToParam"],[e,"flyToParam"])),this.d(w.track([s,"url"],[e,"url"])),this.d(w.track([s,"actorTag"],[e,"actorTag"])),this.d(w.track([s,"materialMode"],[e,"materialMode"])),this.d(w.track([s,"highlight"],[e,"highlight"])),this.d(w.track([s,"maximumScreenSpaceError"],[e,"maximumScreenSpaceError"])),this.d(w.track([s,"highlightID"],[e,"highlightID"])),this.d(w.track([s,"highlightColor"],[e,"highlightColor"])),this.d(w.bind([s,"offset"],[e,"offset"])),this.d(w.bind([s,"rotation"],[e,"rotation"])),this.d(w.track([s,"czmImageBasedLightingFactor"],[e,"czmImageBasedLightingFactor"])),this.d(w.track([s,"czmLuminanceAtZenith"],[e,"czmLuminanceAtZenith"])),this.d(w.track([s,"czmMaximumMemoryUsage"],[e,"czmMaximumMemoryUsage"])),this.d(w.track([s,"czmClassificationType"],[e,"czmClassificationType"])),this.d(w.track([s,"czmStyleJson"],[e,"czmStyleJson"])),this.d(w.track([s,"czmBackFaceCulling"],[e,"czmBackFaceCulling"])),this.d(w.track([s,"czmDebugShowBoundingVolume"],[e,"czmDebugShowBoundingVolume"])),this.d(w.track([s,"czmDebugShowContentBoundingVolume"],[e,"czmDebugShowContentBoundingVolume"])),this.d(w.track([s,"colorBlendMode"],[e,"colorBlendMode"])),this.d(w.track([s,"cacheBytes"],[e,"cacheBytes"])),this.d(w.track([s,"clippingPlaneEnabled"],[e,"clippingPlaneEnabled"])),this.d(w.track([s,"unionClippingRegions"],[e,"unionClippingRegions"])),this.d(w.track([s,"clippingPlaneEdgeColor"],[e,"clippingPlaneEdgeColor"])),this.d(w.track([s,"clippingPlaneEdgeWidth"],[e,"clippingPlaneEdgeWidth"])),this.d(w.track([s,"materialParams"],[e,"materialParams"])),this.d(w.bind([s,"supportEdit"],[e,"supportEdit"])),this.d(w.bind([s,"clippingPlanesId"],[e,"clippingPlanesId"])),this.d(w.bind([s,"clippingPlaneIds"],[e,"clippingPlaneIds"])),this.d(w.bind([s,"flattenedPlaneId"],[e,"flattenedPlaneId"])),this.d(w.bind([s,"flattenedPlaneEnabled"],[e,"flattenedPlaneEnabled"])),this.d(w.bind([s,"clippingPlaneId"],[e,"clippingPlaneId"])),this.d(w.bind([s,"excavateId"],[e,"excavateId"]))}{const s=this._es3DTileset;this.d(e.refreshTilesetEvent.don(()=>{s.refreshTileset()})),this.d(e.highlightFeatureEvent.don((...i)=>{s.highlightFeature(...i)})),this.d(e.highlightFeatureAndFlyToEvent.don((...i)=>{s.highlightFeatureAndFlyTo(...i)})),this.d(e.setFeatureColorEvent.don((...i)=>{s.setFeatureColor(...i)})),this.d(e.setFeatureVisableEvent.don((...i)=>{s.setFeatureVisable(...i)})),this.d(e.resetFeatureStyleEvent.don((...i)=>{s.resetFeatureStyle(...i)})),this.d(e.flyInEvent.don((...i)=>{s.flyIn(i[0])})),this.d(e.flyToEvent.don((...i)=>{s.flyTo(i[0])})),this.d(e.calcFlyToParamEvent.don((...i)=>{s.calcFlyToParam(...i)})),this.d(e.calcFlyInParamEvent.don((...i)=>{s.calcFlyInParam(...i)}))}{const s=this._es3DTileset;this.d(s.tilesetReady.don(i=>{e.tilesetReady.emit(i)})),this.d(s.pickedEvent.don(i=>{i.assign({sceneObject:e}),e.pickedEvent.emit(i)}))}{const s=()=>{this.es3DTileset.show=e.show};s(),this.d(e.showChanged.don(()=>{s()}))}}get es3DTileset(){return this._es3DTileset}};C(Br,"type",Br.register("ESUeViewer",p.ESRtsFeatureEditing.type,Br));let Oi=Br;const fr=class fr extends jA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(fr,"type",fr.register("ESUeViewer",p.ESMsTileset.type,fr));let Wi=fr;const wr=class wr extends cA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}const n=()=>{t.callUeFunc({f:"update",p:{id:A.id,height:A.height??p.ESGeoExtrudedPolygon.defaults.height,extrudedHeight:A.extrudedHeight??p.ESGeoExtrudedPolygon.defaults.extrudedHeight,perPositionHeight:A.perPositionHeight??p.ESGeoExtrudedPolygon.defaults.perPositionHeight}})},s=this.disposeVar(w.createNextAnimateFrameEvent(A.heightChanged,A.extrudedHeightChanged,A.perPositionHeightChanged));this.dispose(s.disposableOn(n)),this.dispose(A.createdEvent.disposableOn(n))}};C(wr,"type",wr.register("ESUeViewer",p.ESGeoExtrudedPolygon.type,wr));let Xi=wr;const pr=class pr extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(pr,"type",pr.register("ESUeViewer",p.ESStaticMesh.type,pr));let Ji=pr;const Cr=class Cr extends rA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.d(A.startEvent.don(()=>{t.callUeFunc({f:"Start",p:{id:A.id}})})),this.d(A.clearEvent.don(()=>{t.callUeFunc({f:"Clear",p:{id:A.id}})}))}};C(Cr,"type",Cr.register("ESUeViewer",p.ESSkylineAnalysis.type,Cr));let zi=Cr;v.copyright=void 0;try{const r="earthsdk3-ue",A="3.3.0-beta.2",e="2025-08-01T01:05:00.000Z",t="北京西部世界科技有限公司",n="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",s="d3b8c9261a2043796ff8b5ebccd504535261d744",o=((Date.now()-17540103e5)/36e5).toFixed(1),a=`%c🌏 ${r}%c ${A}.${s.slice(0,8)}.${e} (距今${o}个小时)
|
|
112
|
+
.`+Zs+cw+Jc)},uw=function(r,A){var e=r.ownerDocument;if(e){var t=e.createElement("style");t.textContent=A,r.appendChild(t)}},zc=function(){function r(){}return r.getOrigin=function(A){var e=r._link;return e?(e.href=A,e.href=e.href,e.protocol+e.hostname+e.port):"about:blank"},r.isSameOrigin=function(A){return r.getOrigin(A)===r._origin},r.setContext=function(A){r._link=A.document.createElement("a"),r._origin=r.getOrigin(A.location.href)},r._origin="about:blank",r}(),hw=function(){function r(A,e){this.context=A,this._options=e,this._cache={}}return r.prototype.addImage=function(A){var e=Promise.resolve();return this.has(A)||(js(A)||ww(A))&&(this._cache[A]=this.loadImage(A)).catch(function(){}),e},r.prototype.match=function(A){return this._cache[A]},r.prototype.loadImage=function(A){return dA(this,void 0,void 0,function(){var e,t,n,s,i=this;return nA(this,function(o){switch(o.label){case 0:return e=zc.isSameOrigin(A),t=!qs(A)&&this._options.useCORS===!0&&eA.SUPPORT_CORS_IMAGES&&!e,n=!qs(A)&&!e&&!js(A)&&typeof this._options.proxy=="string"&&eA.SUPPORT_CORS_XHR&&!t,!e&&this._options.allowTaint===!1&&!qs(A)&&!js(A)&&!n&&!t?[2]:(s=A,n?[4,this.proxy(s)]:[3,2]);case 1:s=o.sent(),o.label=2;case 2:return this.context.logger.debug("Added image "+A.substring(0,256)),[4,new Promise(function(a,l){var c=new Image;c.onload=function(){return a(c)},c.onerror=l,(pw(s)||t)&&(c.crossOrigin="anonymous"),c.src=s,c.complete===!0&&setTimeout(function(){return a(c)},500),i._options.imageTimeout>0&&setTimeout(function(){return l("Timed out ("+i._options.imageTimeout+"ms) loading image")},i._options.imageTimeout)})];case 3:return[2,o.sent()]}})})},r.prototype.has=function(A){return typeof this._cache[A]<"u"},r.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},r.prototype.proxy=function(A){var e=this,t=this._options.proxy;if(!t)throw new Error("No proxy defined");var n=A.substring(0,256);return new Promise(function(s,i){var o=eA.SUPPORT_RESPONSE_TYPE?"blob":"text",a=new XMLHttpRequest;a.onload=function(){if(a.status===200)if(o==="text")s(a.response);else{var h=new FileReader;h.addEventListener("load",function(){return s(h.result)},!1),h.addEventListener("error",function(d){return i(d)},!1),h.readAsDataURL(a.response)}else i("Failed to proxy resource "+n+" with status code "+a.status)},a.onerror=i;var l=t.indexOf("?")>-1?"&":"?";if(a.open("GET",""+t+l+"url="+encodeURIComponent(A)+"&responseType="+o),o!=="text"&&a instanceof XMLHttpRequest&&(a.responseType=o),e._options.imageTimeout){var c=e._options.imageTimeout;a.timeout=c,a.ontimeout=function(){return i("Timed out ("+c+"ms) proxying "+n)}}a.send()})},r}(),gw=/^data:image\/svg\+xml/i,Bw=/^data:image\/.*;base64,/i,fw=/^data:image\/.*/i,ww=function(r){return eA.SUPPORT_SVG_DRAWING||!Cw(r)},qs=function(r){return fw.test(r)},pw=function(r){return Bw.test(r)},js=function(r){return r.substr(0,4)==="blob"},Cw=function(r){return r.substr(-3).toLowerCase()==="svg"||gw.test(r)},S=function(){function r(A,e){this.type=0,this.x=A,this.y=e}return r.prototype.add=function(A,e){return new r(this.x+A,this.y+e)},r}(),Ie=function(r,A,e){return new S(r.x+(A.x-r.x)*e,r.y+(A.y-r.y)*e)},Bn=function(){function r(A,e,t,n){this.type=1,this.start=A,this.startControl=e,this.endControl=t,this.end=n}return r.prototype.subdivide=function(A,e){var t=Ie(this.start,this.startControl,A),n=Ie(this.startControl,this.endControl,A),s=Ie(this.endControl,this.end,A),i=Ie(t,n,A),o=Ie(n,s,A),a=Ie(i,o,A);return e?new r(this.start,t,i,a):new r(a,o,s,this.end)},r.prototype.add=function(A,e){return new r(this.start.add(A,e),this.startControl.add(A,e),this.endControl.add(A,e),this.end.add(A,e))},r.prototype.reverse=function(){return new r(this.end,this.endControl,this.startControl,this.start)},r}(),CA=function(r){return r.type===1},vw=function(){function r(A){var e=A.styles,t=A.bounds,n=st(e.borderTopLeftRadius,t.width,t.height),s=n[0],i=n[1],o=st(e.borderTopRightRadius,t.width,t.height),a=o[0],l=o[1],c=st(e.borderBottomRightRadius,t.width,t.height),h=c[0],d=c[1],B=st(e.borderBottomLeftRadius,t.width,t.height),g=B[0],f=B[1],m=[];m.push((s+a)/t.width),m.push((g+h)/t.width),m.push((i+f)/t.height),m.push((l+d)/t.height);var F=Math.max.apply(Math,m);F>1&&(s/=F,i/=F,a/=F,l/=F,h/=F,d/=F,g/=F,f/=F);var Q=t.width-a,y=t.height-d,L=t.width-h,T=t.height-f,E=e.borderTopWidth,R=e.borderRightWidth,K=e.borderBottomWidth,M=e.borderLeftWidth,W=_(e.paddingTop,A.bounds.width),iA=_(e.paddingRight,A.bounds.width),uA=_(e.paddingBottom,A.bounds.width),G=_(e.paddingLeft,A.bounds.width);this.topLeftBorderDoubleOuterBox=s>0||i>0?O(t.left+M/3,t.top+E/3,s-M/3,i-E/3,k.TOP_LEFT):new S(t.left+M/3,t.top+E/3),this.topRightBorderDoubleOuterBox=s>0||i>0?O(t.left+Q,t.top+E/3,a-R/3,l-E/3,k.TOP_RIGHT):new S(t.left+t.width-R/3,t.top+E/3),this.bottomRightBorderDoubleOuterBox=h>0||d>0?O(t.left+L,t.top+y,h-R/3,d-K/3,k.BOTTOM_RIGHT):new S(t.left+t.width-R/3,t.top+t.height-K/3),this.bottomLeftBorderDoubleOuterBox=g>0||f>0?O(t.left+M/3,t.top+T,g-M/3,f-K/3,k.BOTTOM_LEFT):new S(t.left+M/3,t.top+t.height-K/3),this.topLeftBorderDoubleInnerBox=s>0||i>0?O(t.left+M*2/3,t.top+E*2/3,s-M*2/3,i-E*2/3,k.TOP_LEFT):new S(t.left+M*2/3,t.top+E*2/3),this.topRightBorderDoubleInnerBox=s>0||i>0?O(t.left+Q,t.top+E*2/3,a-R*2/3,l-E*2/3,k.TOP_RIGHT):new S(t.left+t.width-R*2/3,t.top+E*2/3),this.bottomRightBorderDoubleInnerBox=h>0||d>0?O(t.left+L,t.top+y,h-R*2/3,d-K*2/3,k.BOTTOM_RIGHT):new S(t.left+t.width-R*2/3,t.top+t.height-K*2/3),this.bottomLeftBorderDoubleInnerBox=g>0||f>0?O(t.left+M*2/3,t.top+T,g-M*2/3,f-K*2/3,k.BOTTOM_LEFT):new S(t.left+M*2/3,t.top+t.height-K*2/3),this.topLeftBorderStroke=s>0||i>0?O(t.left+M/2,t.top+E/2,s-M/2,i-E/2,k.TOP_LEFT):new S(t.left+M/2,t.top+E/2),this.topRightBorderStroke=s>0||i>0?O(t.left+Q,t.top+E/2,a-R/2,l-E/2,k.TOP_RIGHT):new S(t.left+t.width-R/2,t.top+E/2),this.bottomRightBorderStroke=h>0||d>0?O(t.left+L,t.top+y,h-R/2,d-K/2,k.BOTTOM_RIGHT):new S(t.left+t.width-R/2,t.top+t.height-K/2),this.bottomLeftBorderStroke=g>0||f>0?O(t.left+M/2,t.top+T,g-M/2,f-K/2,k.BOTTOM_LEFT):new S(t.left+M/2,t.top+t.height-K/2),this.topLeftBorderBox=s>0||i>0?O(t.left,t.top,s,i,k.TOP_LEFT):new S(t.left,t.top),this.topRightBorderBox=a>0||l>0?O(t.left+Q,t.top,a,l,k.TOP_RIGHT):new S(t.left+t.width,t.top),this.bottomRightBorderBox=h>0||d>0?O(t.left+L,t.top+y,h,d,k.BOTTOM_RIGHT):new S(t.left+t.width,t.top+t.height),this.bottomLeftBorderBox=g>0||f>0?O(t.left,t.top+T,g,f,k.BOTTOM_LEFT):new S(t.left,t.top+t.height),this.topLeftPaddingBox=s>0||i>0?O(t.left+M,t.top+E,Math.max(0,s-M),Math.max(0,i-E),k.TOP_LEFT):new S(t.left+M,t.top+E),this.topRightPaddingBox=a>0||l>0?O(t.left+Math.min(Q,t.width-R),t.top+E,Q>t.width+R?0:Math.max(0,a-R),Math.max(0,l-E),k.TOP_RIGHT):new S(t.left+t.width-R,t.top+E),this.bottomRightPaddingBox=h>0||d>0?O(t.left+Math.min(L,t.width-M),t.top+Math.min(y,t.height-K),Math.max(0,h-R),Math.max(0,d-K),k.BOTTOM_RIGHT):new S(t.left+t.width-R,t.top+t.height-K),this.bottomLeftPaddingBox=g>0||f>0?O(t.left+M,t.top+Math.min(T,t.height-K),Math.max(0,g-M),Math.max(0,f-K),k.BOTTOM_LEFT):new S(t.left+M,t.top+t.height-K),this.topLeftContentBox=s>0||i>0?O(t.left+M+G,t.top+E+W,Math.max(0,s-(M+G)),Math.max(0,i-(E+W)),k.TOP_LEFT):new S(t.left+M+G,t.top+E+W),this.topRightContentBox=a>0||l>0?O(t.left+Math.min(Q,t.width+M+G),t.top+E+W,Q>t.width+M+G?0:a-M+G,l-(E+W),k.TOP_RIGHT):new S(t.left+t.width-(R+iA),t.top+E+W),this.bottomRightContentBox=h>0||d>0?O(t.left+Math.min(L,t.width-(M+G)),t.top+Math.min(y,t.height+E+W),Math.max(0,h-(R+iA)),d-(K+uA),k.BOTTOM_RIGHT):new S(t.left+t.width-(R+iA),t.top+t.height-(K+uA)),this.bottomLeftContentBox=g>0||f>0?O(t.left+M+G,t.top+T,Math.max(0,g-(M+G)),f-(K+uA),k.BOTTOM_LEFT):new S(t.left+M+G,t.top+t.height-(K+uA))}return r}(),k;(function(r){r[r.TOP_LEFT=0]="TOP_LEFT",r[r.TOP_RIGHT=1]="TOP_RIGHT",r[r.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",r[r.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(k||(k={}));var O=function(r,A,e,t,n){var s=4*((Math.sqrt(2)-1)/3),i=e*s,o=t*s,a=r+e,l=A+t;switch(n){case k.TOP_LEFT:return new Bn(new S(r,l),new S(r,l-o),new S(a-i,A),new S(a,A));case k.TOP_RIGHT:return new Bn(new S(r,A),new S(r+i,A),new S(a,l-o),new S(a,l));case k.BOTTOM_RIGHT:return new Bn(new S(a,A),new S(a,A+o),new S(r+i,l),new S(r,l));case k.BOTTOM_LEFT:default:return new Bn(new S(a,l),new S(a-i,l),new S(r,A+o),new S(r,A))}},fn=function(r){return[r.topLeftBorderBox,r.topRightBorderBox,r.bottomRightBorderBox,r.bottomLeftBorderBox]},mw=function(r){return[r.topLeftContentBox,r.topRightContentBox,r.bottomRightContentBox,r.bottomLeftContentBox]},wn=function(r){return[r.topLeftPaddingBox,r.topRightPaddingBox,r.bottomRightPaddingBox,r.bottomLeftPaddingBox]},Fw=function(){function r(A,e,t){this.offsetX=A,this.offsetY=e,this.matrix=t,this.type=0,this.target=6}return r}(),pn=function(){function r(A,e){this.path=A,this.target=e,this.type=1}return r}(),Qw=function(){function r(A){this.opacity=A,this.type=2,this.target=6}return r}(),Uw=function(r){return r.type===0},Yc=function(r){return r.type===1},Ew=function(r){return r.type===2},$c=function(r,A){return r.length===A.length?r.some(function(e,t){return e===A[t]}):!1},yw=function(r,A,e,t,n){return r.map(function(s,i){switch(i){case 0:return s.add(A,e);case 1:return s.add(A+t,e);case 2:return s.add(A+t,e+n);case 3:return s.add(A,e+n)}return s})},Zc=function(){function r(A){this.element=A,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return r}(),qc=function(){function r(A,e){if(this.container=A,this.parent=e,this.effects=[],this.curves=new vw(this.container),this.container.styles.opacity<1&&this.effects.push(new Qw(this.container.styles.opacity)),this.container.styles.transform!==null){var t=this.container.bounds.left+this.container.styles.transformOrigin[0].number,n=this.container.bounds.top+this.container.styles.transformOrigin[1].number,s=this.container.styles.transform;this.effects.push(new Fw(t,n,s))}if(this.container.styles.overflowX!==0){var i=fn(this.curves),o=wn(this.curves);$c(i,o)?this.effects.push(new pn(i,6)):(this.effects.push(new pn(i,2)),this.effects.push(new pn(o,4)))}}return r.prototype.getEffects=function(A){for(var e=[2,3].indexOf(this.container.styles.position)===-1,t=this.parent,n=this.effects.slice(0);t;){var s=t.effects.filter(function(a){return!Yc(a)});if(e||t.container.styles.position!==0||!t.parent){if(n.unshift.apply(n,s),e=[2,3].indexOf(t.container.styles.position)===-1,t.container.styles.overflowX!==0){var i=fn(t.curves),o=wn(t.curves);$c(i,o)||n.unshift(new pn(o,6))}}else n.unshift.apply(n,s);t=t.parent}return n.filter(function(a){return Z(a.target,A)})},r}(),Ai=function(r,A,e,t){r.container.elements.forEach(function(n){var s=Z(n.flags,4),i=Z(n.flags,2),o=new qc(n,r);Z(n.styles.display,2048)&&t.push(o);var a=Z(n.flags,8)?[]:t;if(s||i){var l=s||n.styles.isPositioned()?e:A,c=new Zc(o);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var h=n.styles.zIndex.order;if(h<0){var d=0;l.negativeZIndex.some(function(g,f){return h>g.element.container.styles.zIndex.order?(d=f,!1):d>0}),l.negativeZIndex.splice(d,0,c)}else if(h>0){var B=0;l.positiveZIndex.some(function(g,f){return h>=g.element.container.styles.zIndex.order?(B=f+1,!1):B>0}),l.positiveZIndex.splice(B,0,c)}else l.zeroOrAutoZIndexOrTransformedOrOpacity.push(c)}else n.styles.isFloating()?l.nonPositionedFloats.push(c):l.nonPositionedInlineLevel.push(c);Ai(o,c,s?c:e,a)}else n.styles.isInlineLevel()?A.inlineLevel.push(o):A.nonInlineLevel.push(o),Ai(o,A,e,a);Z(n.flags,8)&&jc(n,a)})},jc=function(r,A){for(var e=r instanceof Vs?r.start:1,t=r instanceof Vs?r.reversed:!1,n=0;n<A.length;n++){var s=A[n];s.container instanceof Uc&&typeof s.container.value=="number"&&s.container.value!==0&&(e=s.container.value),s.listValue=dt(e,s.container.styles.listStyleType,!0),e+=t?-1:1}},Sw=function(r){var A=new qc(r,null),e=new Zc(A),t=[];return Ai(A,e,e,t),jc(A.container,t),e},Ad=function(r,A){switch(A){case 0:return vA(r.topLeftBorderBox,r.topLeftPaddingBox,r.topRightBorderBox,r.topRightPaddingBox);case 1:return vA(r.topRightBorderBox,r.topRightPaddingBox,r.bottomRightBorderBox,r.bottomRightPaddingBox);case 2:return vA(r.bottomRightBorderBox,r.bottomRightPaddingBox,r.bottomLeftBorderBox,r.bottomLeftPaddingBox);case 3:default:return vA(r.bottomLeftBorderBox,r.bottomLeftPaddingBox,r.topLeftBorderBox,r.topLeftPaddingBox)}},Iw=function(r,A){switch(A){case 0:return vA(r.topLeftBorderBox,r.topLeftBorderDoubleOuterBox,r.topRightBorderBox,r.topRightBorderDoubleOuterBox);case 1:return vA(r.topRightBorderBox,r.topRightBorderDoubleOuterBox,r.bottomRightBorderBox,r.bottomRightBorderDoubleOuterBox);case 2:return vA(r.bottomRightBorderBox,r.bottomRightBorderDoubleOuterBox,r.bottomLeftBorderBox,r.bottomLeftBorderDoubleOuterBox);case 3:default:return vA(r.bottomLeftBorderBox,r.bottomLeftBorderDoubleOuterBox,r.topLeftBorderBox,r.topLeftBorderDoubleOuterBox)}},Tw=function(r,A){switch(A){case 0:return vA(r.topLeftBorderDoubleInnerBox,r.topLeftPaddingBox,r.topRightBorderDoubleInnerBox,r.topRightPaddingBox);case 1:return vA(r.topRightBorderDoubleInnerBox,r.topRightPaddingBox,r.bottomRightBorderDoubleInnerBox,r.bottomRightPaddingBox);case 2:return vA(r.bottomRightBorderDoubleInnerBox,r.bottomRightPaddingBox,r.bottomLeftBorderDoubleInnerBox,r.bottomLeftPaddingBox);case 3:default:return vA(r.bottomLeftBorderDoubleInnerBox,r.bottomLeftPaddingBox,r.topLeftBorderDoubleInnerBox,r.topLeftPaddingBox)}},Hw=function(r,A){switch(A){case 0:return Cn(r.topLeftBorderStroke,r.topRightBorderStroke);case 1:return Cn(r.topRightBorderStroke,r.bottomRightBorderStroke);case 2:return Cn(r.bottomRightBorderStroke,r.bottomLeftBorderStroke);case 3:default:return Cn(r.bottomLeftBorderStroke,r.topLeftBorderStroke)}},Cn=function(r,A){var e=[];return CA(r)?e.push(r.subdivide(.5,!1)):e.push(r),CA(A)?e.push(A.subdivide(.5,!0)):e.push(A),e},vA=function(r,A,e,t){var n=[];return CA(r)?n.push(r.subdivide(.5,!1)):n.push(r),CA(e)?n.push(e.subdivide(.5,!0)):n.push(e),CA(t)?n.push(t.subdivide(.5,!0).reverse()):n.push(t),CA(A)?n.push(A.subdivide(.5,!1).reverse()):n.push(A),n},ed=function(r){var A=r.bounds,e=r.styles;return A.add(e.borderLeftWidth,e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth),-(e.borderTopWidth+e.borderBottomWidth))},vn=function(r){var A=r.styles,e=r.bounds,t=_(A.paddingLeft,e.width),n=_(A.paddingRight,e.width),s=_(A.paddingTop,e.width),i=_(A.paddingBottom,e.width);return e.add(t+A.borderLeftWidth,s+A.borderTopWidth,-(A.borderRightWidth+A.borderLeftWidth+t+n),-(A.borderTopWidth+A.borderBottomWidth+s+i))},Lw=function(r,A){return r===0?A.bounds:r===2?vn(A):ed(A)},bw=function(r,A){return r===0?A.bounds:r===2?vn(A):ed(A)},ei=function(r,A,e){var t=Lw(He(r.styles.backgroundOrigin,A),r),n=bw(He(r.styles.backgroundClip,A),r),s=Mw(He(r.styles.backgroundSize,A),e,t),i=s[0],o=s[1],a=st(He(r.styles.backgroundPosition,A),t.width-i,t.height-o),l=Dw(He(r.styles.backgroundRepeat,A),a,s,t,n),c=Math.round(t.left+a[0]),h=Math.round(t.top+a[1]);return[l,c,h,i,o]},Te=function(r){return N(r)&&r.value===Ue.AUTO},mn=function(r){return typeof r=="number"},Mw=function(r,A,e){var t=A[0],n=A[1],s=A[2],i=r[0],o=r[1];if(!i)return[0,0];if(Y(i)&&o&&Y(o))return[_(i,e.width),_(o,e.height)];var a=mn(s);if(N(i)&&(i.value===Ue.CONTAIN||i.value===Ue.COVER)){if(mn(s)){var l=e.width/e.height;return l<s!=(i.value===Ue.COVER)?[e.width,e.width/s]:[e.height*s,e.height]}return[e.width,e.height]}var c=mn(t),h=mn(n),d=c||h;if(Te(i)&&(!o||Te(o))){if(c&&h)return[t,n];if(!a&&!d)return[e.width,e.height];if(d&&a){var B=c?t:n*s,g=h?n:t/s;return[B,g]}var f=c?t:e.width,m=h?n:e.height;return[f,m]}if(a){var F=0,Q=0;return Y(i)?F=_(i,e.width):Y(o)&&(Q=_(o,e.height)),Te(i)?F=Q*s:(!o||Te(o))&&(Q=F/s),[F,Q]}var y=null,L=null;if(Y(i)?y=_(i,e.width):o&&Y(o)&&(L=_(o,e.height)),y!==null&&(!o||Te(o))&&(L=c&&h?y/t*n:e.height),L!==null&&Te(i)&&(y=c&&h?L/n*t:e.width),y!==null&&L!==null)return[y,L];throw new Error("Unable to calculate background-size for element")},He=function(r,A){var e=r[A];return typeof e>"u"?r[0]:e},Dw=function(r,A,e,t,n){var s=A[0],i=A[1],o=e[0],a=e[1];switch(r){case 2:return[new S(Math.round(t.left),Math.round(t.top+i)),new S(Math.round(t.left+t.width),Math.round(t.top+i)),new S(Math.round(t.left+t.width),Math.round(a+t.top+i)),new S(Math.round(t.left),Math.round(a+t.top+i))];case 3:return[new S(Math.round(t.left+s),Math.round(t.top)),new S(Math.round(t.left+s+o),Math.round(t.top)),new S(Math.round(t.left+s+o),Math.round(t.height+t.top)),new S(Math.round(t.left+s),Math.round(t.height+t.top))];case 1:return[new S(Math.round(t.left+s),Math.round(t.top+i)),new S(Math.round(t.left+s+o),Math.round(t.top+i)),new S(Math.round(t.left+s+o),Math.round(t.top+i+a)),new S(Math.round(t.left+s),Math.round(t.top+i+a))];default:return[new S(Math.round(n.left),Math.round(n.top)),new S(Math.round(n.left+n.width),Math.round(n.top)),new S(Math.round(n.left+n.width),Math.round(n.height+n.top)),new S(Math.round(n.left),Math.round(n.height+n.top))]}},Rw="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",td="Hidden Text",Pw=function(){function r(A){this._data={},this._document=A}return r.prototype.parseMetrics=function(A,e){var t=this._document.createElement("div"),n=this._document.createElement("img"),s=this._document.createElement("span"),i=this._document.body;t.style.visibility="hidden",t.style.fontFamily=A,t.style.fontSize=e,t.style.margin="0",t.style.padding="0",t.style.whiteSpace="nowrap",i.appendChild(t),n.src=Rw,n.width=1,n.height=1,n.style.margin="0",n.style.padding="0",n.style.verticalAlign="baseline",s.style.fontFamily=A,s.style.fontSize=e,s.style.margin="0",s.style.padding="0",s.appendChild(this._document.createTextNode(td)),t.appendChild(s),t.appendChild(n);var o=n.offsetTop-s.offsetTop+2;t.removeChild(s),t.appendChild(this._document.createTextNode(td)),t.style.lineHeight="normal",n.style.verticalAlign="super";var a=n.offsetTop-t.offsetTop+2;return i.removeChild(t),{baseline:o,middle:a}},r.prototype.getMetrics=function(A,e){var t=A+" "+e;return typeof this._data[t]>"u"&&(this._data[t]=this.parseMetrics(A,e)),this._data[t]},r}(),rd=function(){function r(A,e){this.context=A,this.options=e}return r}(),Kw=1e4,xw=function(r){FA(A,r);function A(e,t){var n=r.call(this,e,t)||this;return n._activeEffects=[],n.canvas=t.canvas?t.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),t.canvas||(n.canvas.width=Math.floor(t.width*t.scale),n.canvas.height=Math.floor(t.height*t.scale),n.canvas.style.width=t.width+"px",n.canvas.style.height=t.height+"px"),n.fontMetrics=new Pw(document),n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-t.x,-t.y),n.ctx.textBaseline="bottom",n._activeEffects=[],n.context.logger.debug("Canvas renderer initialized ("+t.width+"x"+t.height+") with scale "+t.scale),n}return A.prototype.applyEffects=function(e){for(var t=this;this._activeEffects.length;)this.popEffect();e.forEach(function(n){return t.applyEffect(n)})},A.prototype.applyEffect=function(e){this.ctx.save(),Ew(e)&&(this.ctx.globalAlpha=e.opacity),Uw(e)&&(this.ctx.translate(e.offsetX,e.offsetY),this.ctx.transform(e.matrix[0],e.matrix[1],e.matrix[2],e.matrix[3],e.matrix[4],e.matrix[5]),this.ctx.translate(-e.offsetX,-e.offsetY)),Yc(e)&&(this.path(e.path),this.ctx.clip()),this._activeEffects.push(e)},A.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},A.prototype.renderStack=function(e){return dA(this,void 0,void 0,function(){var t;return nA(this,function(n){switch(n.label){case 0:return t=e.element.container.styles,t.isVisible()?[4,this.renderStackContent(e)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},A.prototype.renderNode=function(e){return dA(this,void 0,void 0,function(){return nA(this,function(t){switch(t.label){case 0:if(Z(e.container.flags,16))debugger;return e.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(e)]:[3,3];case 1:return t.sent(),[4,this.renderNodeContent(e)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},A.prototype.renderTextWithLetterSpacing=function(e,t,n){var s=this;if(t===0)this.ctx.fillText(e.text,e.bounds.left,e.bounds.top+n);else{var i=_s(e.text);i.reduce(function(o,a){return s.ctx.fillText(a,o,e.bounds.top+n),o+s.ctx.measureText(a).width},e.bounds.left)}},A.prototype.createFontStyle=function(e){var t=e.fontVariant.filter(function(i){return i==="normal"||i==="small-caps"}).join(""),n=Vw(e.fontFamily).join(", "),s=nt(e.fontSize)?""+e.fontSize.number+e.fontSize.unit:e.fontSize.number+"px";return[[e.fontStyle,t,e.fontWeight,s,n].join(" "),n,s]},A.prototype.renderTextNode=function(e,t){return dA(this,void 0,void 0,function(){var n,s,i,o,a,l,c,h,d=this;return nA(this,function(B){return n=this.createFontStyle(t),s=n[0],i=n[1],o=n[2],this.ctx.font=s,this.ctx.direction=t.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",a=this.fontMetrics.getMetrics(i,o),l=a.baseline,c=a.middle,h=t.paintOrder,e.textBounds.forEach(function(g){h.forEach(function(f){switch(f){case 0:d.ctx.fillStyle=q(t.color),d.renderTextWithLetterSpacing(g,t.letterSpacing,l);var m=t.textShadow;m.length&&g.text.trim().length&&(m.slice(0).reverse().forEach(function(F){d.ctx.shadowColor=q(F.color),d.ctx.shadowOffsetX=F.offsetX.number*d.options.scale,d.ctx.shadowOffsetY=F.offsetY.number*d.options.scale,d.ctx.shadowBlur=F.blur.number,d.renderTextWithLetterSpacing(g,t.letterSpacing,l)}),d.ctx.shadowColor="",d.ctx.shadowOffsetX=0,d.ctx.shadowOffsetY=0,d.ctx.shadowBlur=0),t.textDecorationLine.length&&(d.ctx.fillStyle=q(t.textDecorationColor||t.color),t.textDecorationLine.forEach(function(F){switch(F){case 1:d.ctx.fillRect(g.bounds.left,Math.round(g.bounds.top+l),g.bounds.width,1);break;case 2:d.ctx.fillRect(g.bounds.left,Math.round(g.bounds.top),g.bounds.width,1);break;case 3:d.ctx.fillRect(g.bounds.left,Math.ceil(g.bounds.top+c),g.bounds.width,1);break}}));break;case 1:t.webkitTextStrokeWidth&&g.text.trim().length&&(d.ctx.strokeStyle=q(t.webkitTextStrokeColor),d.ctx.lineWidth=t.webkitTextStrokeWidth,d.ctx.lineJoin=window.chrome?"miter":"round",d.ctx.strokeText(g.text,g.bounds.left,g.bounds.top+l)),d.ctx.strokeStyle="",d.ctx.lineWidth=0,d.ctx.lineJoin="miter";break}})}),[2]})})},A.prototype.renderReplacedElement=function(e,t,n){if(n&&e.intrinsicWidth>0&&e.intrinsicHeight>0){var s=vn(e),i=wn(t);this.path(i),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(n,0,0,e.intrinsicWidth,e.intrinsicHeight,s.left,s.top,s.width,s.height),this.ctx.restore()}},A.prototype.renderNodeContent=function(e){return dA(this,void 0,void 0,function(){var t,n,s,i,o,a,Q,Q,l,c,h,d,L,B,g,T,f,m,F,Q,y,L,T;return nA(this,function(E){switch(E.label){case 0:this.applyEffects(e.getEffects(4)),t=e.container,n=e.curves,s=t.styles,i=0,o=t.textNodes,E.label=1;case 1:return i<o.length?(a=o[i],[4,this.renderTextNode(a,s)]):[3,4];case 2:E.sent(),E.label=3;case 3:return i++,[3,1];case 4:if(!(t instanceof mc))return[3,8];E.label=5;case 5:return E.trys.push([5,7,,8]),[4,this.context.cache.match(t.src)];case 6:return Q=E.sent(),this.renderReplacedElement(t,n,Q),[3,8];case 7:return E.sent(),this.context.logger.error("Error loading image "+t.src),[3,8];case 8:if(t instanceof Fc&&this.renderReplacedElement(t,n,t.canvas),!(t instanceof Qc))return[3,12];E.label=9;case 9:return E.trys.push([9,11,,12]),[4,this.context.cache.match(t.svg)];case 10:return Q=E.sent(),this.renderReplacedElement(t,n,Q),[3,12];case 11:return E.sent(),this.context.logger.error("Error loading svg "+t.svg.substring(0,255)),[3,12];case 12:return t instanceof Ic&&t.tree?(l=new A(this.context,{scale:this.options.scale,backgroundColor:t.backgroundColor,x:0,y:0,width:t.width,height:t.height}),[4,l.render(t.tree)]):[3,14];case 13:c=E.sent(),t.width&&t.height&&this.ctx.drawImage(c,0,0,t.width,t.height,t.bounds.left,t.bounds.top,t.bounds.width,t.bounds.height),E.label=14;case 14:if(t instanceof Os&&(h=Math.min(t.bounds.width,t.bounds.height),t.type===ln?t.checked&&(this.ctx.save(),this.path([new S(t.bounds.left+h*.39363,t.bounds.top+h*.79),new S(t.bounds.left+h*.16,t.bounds.top+h*.5549),new S(t.bounds.left+h*.27347,t.bounds.top+h*.44071),new S(t.bounds.left+h*.39694,t.bounds.top+h*.5649),new S(t.bounds.left+h*.72983,t.bounds.top+h*.23),new S(t.bounds.left+h*.84,t.bounds.top+h*.34085),new S(t.bounds.left+h*.39363,t.bounds.top+h*.79)]),this.ctx.fillStyle=q(Ec),this.ctx.fill(),this.ctx.restore()):t.type===cn&&t.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(t.bounds.left+h/2,t.bounds.top+h/2,h/4,0,Math.PI*2,!0),this.ctx.fillStyle=q(Ec),this.ctx.fill(),this.ctx.restore())),kw(t)&&t.value.length){switch(d=this.createFontStyle(s),L=d[0],B=d[1],g=this.fontMetrics.getMetrics(L,B).baseline,this.ctx.font=L,this.ctx.fillStyle=q(s.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=Nw(t.styles.textAlign),T=vn(t),f=0,t.styles.textAlign){case 1:f+=T.width/2;break;case 2:f+=T.width;break}m=T.add(f,0,0,-T.height/2+1),this.ctx.save(),this.path([new S(T.left,T.top),new S(T.left+T.width,T.top),new S(T.left+T.width,T.top+T.height),new S(T.left,T.top+T.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new lt(t.value,m),s.letterSpacing,g),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!Z(t.styles.display,2048))return[3,20];if(t.styles.listStyleImage===null)return[3,19];if(F=t.styles.listStyleImage,F.type!==0)return[3,18];Q=void 0,y=F.url,E.label=15;case 15:return E.trys.push([15,17,,18]),[4,this.context.cache.match(y)];case 16:return Q=E.sent(),this.ctx.drawImage(Q,t.bounds.left-(Q.width+10),t.bounds.top),[3,18];case 17:return E.sent(),this.context.logger.error("Error loading list-style-image "+y),[3,18];case 18:return[3,20];case 19:e.listValue&&t.styles.listStyleType!==-1&&(L=this.createFontStyle(s)[0],this.ctx.font=L,this.ctx.fillStyle=q(s.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",T=new bA(t.bounds.left,t.bounds.top+_(t.styles.paddingTop,t.bounds.width),t.bounds.width,tc(s.lineHeight,s.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new lt(e.listValue,T),s.letterSpacing,tc(s.lineHeight,s.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),E.label=20;case 20:return[2]}})})},A.prototype.renderStackContent=function(e){return dA(this,void 0,void 0,function(){var t,n,F,s,i,F,o,a,F,l,c,F,h,d,F,B,g,F,f,m,F;return nA(this,function(Q){switch(Q.label){case 0:if(Z(e.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(e.element)];case 1:Q.sent(),t=0,n=e.negativeZIndex,Q.label=2;case 2:return t<n.length?(F=n[t],[4,this.renderStack(F)]):[3,5];case 3:Q.sent(),Q.label=4;case 4:return t++,[3,2];case 5:return[4,this.renderNodeContent(e.element)];case 6:Q.sent(),s=0,i=e.nonInlineLevel,Q.label=7;case 7:return s<i.length?(F=i[s],[4,this.renderNode(F)]):[3,10];case 8:Q.sent(),Q.label=9;case 9:return s++,[3,7];case 10:o=0,a=e.nonPositionedFloats,Q.label=11;case 11:return o<a.length?(F=a[o],[4,this.renderStack(F)]):[3,14];case 12:Q.sent(),Q.label=13;case 13:return o++,[3,11];case 14:l=0,c=e.nonPositionedInlineLevel,Q.label=15;case 15:return l<c.length?(F=c[l],[4,this.renderStack(F)]):[3,18];case 16:Q.sent(),Q.label=17;case 17:return l++,[3,15];case 18:h=0,d=e.inlineLevel,Q.label=19;case 19:return h<d.length?(F=d[h],[4,this.renderNode(F)]):[3,22];case 20:Q.sent(),Q.label=21;case 21:return h++,[3,19];case 22:B=0,g=e.zeroOrAutoZIndexOrTransformedOrOpacity,Q.label=23;case 23:return B<g.length?(F=g[B],[4,this.renderStack(F)]):[3,26];case 24:Q.sent(),Q.label=25;case 25:return B++,[3,23];case 26:f=0,m=e.positiveZIndex,Q.label=27;case 27:return f<m.length?(F=m[f],[4,this.renderStack(F)]):[3,30];case 28:Q.sent(),Q.label=29;case 29:return f++,[3,27];case 30:return[2]}})})},A.prototype.mask=function(e){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(e.slice(0).reverse()),this.ctx.closePath()},A.prototype.path=function(e){this.ctx.beginPath(),this.formatPath(e),this.ctx.closePath()},A.prototype.formatPath=function(e){var t=this;e.forEach(function(n,s){var i=CA(n)?n.start:n;s===0?t.ctx.moveTo(i.x,i.y):t.ctx.lineTo(i.x,i.y),CA(n)&&t.ctx.bezierCurveTo(n.startControl.x,n.startControl.y,n.endControl.x,n.endControl.y,n.end.x,n.end.y)})},A.prototype.renderRepeat=function(e,t,n,s){this.path(e),this.ctx.fillStyle=t,this.ctx.translate(n,s),this.ctx.fill(),this.ctx.translate(-n,-s)},A.prototype.resizeImage=function(e,t,n){var s;if(e.width===t&&e.height===n)return e;var i=(s=this.canvas.ownerDocument)!==null&&s!==void 0?s:document,o=i.createElement("canvas");o.width=Math.max(1,t),o.height=Math.max(1,n);var a=o.getContext("2d");return a.drawImage(e,0,0,e.width,e.height,0,0,t,n),o},A.prototype.renderBackgroundImage=function(e){return dA(this,void 0,void 0,function(){var t,n,s,i,o,a;return nA(this,function(l){switch(l.label){case 0:t=e.styles.backgroundImage.length-1,n=function(c){var h,d,B,W,gA,BA,G,tA,K,g,W,gA,BA,G,tA,f,m,F,Q,y,L,T,E,R,K,M,W,iA,uA,G,tA,zA,gA,BA,de,IA,YA,ue,he,PA,ge,KA;return nA(this,function(Ke){switch(Ke.label){case 0:if(c.type!==0)return[3,5];h=void 0,d=c.url,Ke.label=1;case 1:return Ke.trys.push([1,3,,4]),[4,s.context.cache.match(d)];case 2:return h=Ke.sent(),[3,4];case 3:return Ke.sent(),s.context.logger.error("Error loading background-image "+d),[3,4];case 4:return h&&(B=ei(e,t,[h.width,h.height,h.width/h.height]),W=B[0],gA=B[1],BA=B[2],G=B[3],tA=B[4],K=s.ctx.createPattern(s.resizeImage(h,G,tA),"repeat"),s.renderRepeat(W,K,gA,BA)),[3,6];case 5:Qg(c)?(g=ei(e,t,[null,null,null]),W=g[0],gA=g[1],BA=g[2],G=g[3],tA=g[4],f=pg(c.angle,G,tA),m=f[0],F=f[1],Q=f[2],y=f[3],L=f[4],T=document.createElement("canvas"),T.width=G,T.height=tA,E=T.getContext("2d"),R=E.createLinearGradient(F,y,Q,L),Wl(c.stops,m).forEach(function(vr){return R.addColorStop(vr.stop,q(vr.color))}),E.fillStyle=R,E.fillRect(0,0,G,tA),G>0&&tA>0&&(K=s.ctx.createPattern(T,"repeat"),s.renderRepeat(W,K,gA,BA))):Ug(c)&&(M=ei(e,t,[null,null,null]),W=M[0],iA=M[1],uA=M[2],G=M[3],tA=M[4],zA=c.position.length===0?[Ss]:c.position,gA=_(zA[0],G),BA=_(zA[zA.length-1],tA),de=Cg(c,gA,BA,G,tA),IA=de[0],YA=de[1],IA>0&&YA>0&&(ue=s.ctx.createRadialGradient(iA+gA,uA+BA,0,iA+gA,uA+BA,IA),Wl(c.stops,IA*2).forEach(function(vr){return ue.addColorStop(vr.stop,q(vr.color))}),s.path(W),s.ctx.fillStyle=ue,IA!==YA?(he=e.bounds.left+.5*e.bounds.width,PA=e.bounds.top+.5*e.bounds.height,ge=YA/IA,KA=1/ge,s.ctx.save(),s.ctx.translate(he,PA),s.ctx.transform(1,0,0,ge,0,0),s.ctx.translate(-he,-PA),s.ctx.fillRect(iA,KA*(uA-PA)+PA,G,tA*KA),s.ctx.restore()):s.ctx.fill())),Ke.label=6;case 6:return t--,[2]}})},s=this,i=0,o=e.styles.backgroundImage.slice(0).reverse(),l.label=1;case 1:return i<o.length?(a=o[i],[5,n(a)]):[3,4];case 2:l.sent(),l.label=3;case 3:return i++,[3,1];case 4:return[2]}})})},A.prototype.renderSolidBorder=function(e,t,n){return dA(this,void 0,void 0,function(){return nA(this,function(s){return this.path(Ad(n,t)),this.ctx.fillStyle=q(e),this.ctx.fill(),[2]})})},A.prototype.renderDoubleBorder=function(e,t,n,s){return dA(this,void 0,void 0,function(){var i,o;return nA(this,function(a){switch(a.label){case 0:return t<3?[4,this.renderSolidBorder(e,n,s)]:[3,2];case 1:return a.sent(),[2];case 2:return i=Iw(s,n),this.path(i),this.ctx.fillStyle=q(e),this.ctx.fill(),o=Tw(s,n),this.path(o),this.ctx.fill(),[2]}})})},A.prototype.renderNodeBackgroundAndBorders=function(e){return dA(this,void 0,void 0,function(){var t,n,s,i,o,a,l,c,h=this;return nA(this,function(d){switch(d.label){case 0:return this.applyEffects(e.getEffects(2)),t=e.container.styles,n=!OA(t.backgroundColor)||t.backgroundImage.length,s=[{style:t.borderTopStyle,color:t.borderTopColor,width:t.borderTopWidth},{style:t.borderRightStyle,color:t.borderRightColor,width:t.borderRightWidth},{style:t.borderBottomStyle,color:t.borderBottomColor,width:t.borderBottomWidth},{style:t.borderLeftStyle,color:t.borderLeftColor,width:t.borderLeftWidth}],i=Gw(He(t.backgroundClip,0),e.curves),n||t.boxShadow.length?(this.ctx.save(),this.path(i),this.ctx.clip(),OA(t.backgroundColor)||(this.ctx.fillStyle=q(t.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(e.container)]):[3,2];case 1:d.sent(),this.ctx.restore(),t.boxShadow.slice(0).reverse().forEach(function(B){h.ctx.save();var g=fn(e.curves),f=B.inset?0:Kw,m=yw(g,-f+(B.inset?1:-1)*B.spread.number,(B.inset?1:-1)*B.spread.number,B.spread.number*(B.inset?-2:2),B.spread.number*(B.inset?-2:2));B.inset?(h.path(g),h.ctx.clip(),h.mask(m)):(h.mask(g),h.ctx.clip(),h.path(m)),h.ctx.shadowOffsetX=B.offsetX.number+f,h.ctx.shadowOffsetY=B.offsetY.number,h.ctx.shadowColor=q(B.color),h.ctx.shadowBlur=B.blur.number,h.ctx.fillStyle=B.inset?q(B.color):"rgba(0,0,0,1)",h.ctx.fill(),h.ctx.restore()}),d.label=2;case 2:o=0,a=0,l=s,d.label=3;case 3:return a<l.length?(c=l[a],c.style!==0&&!OA(c.color)&&c.width>0?c.style!==2?[3,5]:[4,this.renderDashedDottedBorder(c.color,c.width,o,e.curves,2)]:[3,11]):[3,13];case 4:return d.sent(),[3,11];case 5:return c.style!==3?[3,7]:[4,this.renderDashedDottedBorder(c.color,c.width,o,e.curves,3)];case 6:return d.sent(),[3,11];case 7:return c.style!==4?[3,9]:[4,this.renderDoubleBorder(c.color,c.width,o,e.curves)];case 8:return d.sent(),[3,11];case 9:return[4,this.renderSolidBorder(c.color,o,e.curves)];case 10:d.sent(),d.label=11;case 11:o++,d.label=12;case 12:return a++,[3,3];case 13:return[2]}})})},A.prototype.renderDashedDottedBorder=function(e,t,n,s,i){return dA(this,void 0,void 0,function(){var o,a,l,c,h,d,B,g,f,m,F,Q,y,L,T,E,T,E;return nA(this,function(R){return this.ctx.save(),o=Hw(s,n),a=Ad(s,n),i===2&&(this.path(a),this.ctx.clip()),CA(a[0])?(l=a[0].start.x,c=a[0].start.y):(l=a[0].x,c=a[0].y),CA(a[1])?(h=a[1].end.x,d=a[1].end.y):(h=a[1].x,d=a[1].y),n===0||n===2?B=Math.abs(l-h):B=Math.abs(c-d),this.ctx.beginPath(),i===3?this.formatPath(o):this.formatPath(a.slice(0,2)),g=t<3?t*3:t*2,f=t<3?t*2:t,i===3&&(g=t,f=t),m=!0,B<=g*2?m=!1:B<=g*2+f?(F=B/(2*g+f),g*=F,f*=F):(Q=Math.floor((B+f)/(g+f)),y=(B-Q*g)/(Q-1),L=(B-(Q+1)*g)/Q,f=L<=0||Math.abs(f-y)<Math.abs(f-L)?y:L),m&&(i===3?this.ctx.setLineDash([0,g+f]):this.ctx.setLineDash([g,f])),i===3?(this.ctx.lineCap="round",this.ctx.lineWidth=t):this.ctx.lineWidth=t*2+1.1,this.ctx.strokeStyle=q(e),this.ctx.stroke(),this.ctx.setLineDash([]),i===2&&(CA(a[0])&&(T=a[3],E=a[0],this.ctx.beginPath(),this.formatPath([new S(T.end.x,T.end.y),new S(E.start.x,E.start.y)]),this.ctx.stroke()),CA(a[1])&&(T=a[1],E=a[2],this.ctx.beginPath(),this.formatPath([new S(T.end.x,T.end.y),new S(E.start.x,E.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},A.prototype.render=function(e){return dA(this,void 0,void 0,function(){var t;return nA(this,function(n){switch(n.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=q(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),t=Sw(e),[4,this.renderStack(t)];case 1:return n.sent(),this.applyEffects([]),[2,this.canvas]}})})},A}(rd),kw=function(r){return r instanceof Sc||r instanceof yc?!0:r instanceof Os&&r.type!==cn&&r.type!==ln},Gw=function(r,A){switch(r){case 0:return fn(A);case 2:return mw(A);case 1:default:return wn(A)}},Nw=function(r){switch(r){case 1:return"center";case 2:return"right";case 0:default:return"left"}},_w=["-apple-system","system-ui"],Vw=function(r){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?r.filter(function(A){return _w.indexOf(A)===-1}):r},Ow=function(r){FA(A,r);function A(e,t){var n=r.call(this,e,t)||this;return n.canvas=t.canvas?t.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),n.options=t,n.canvas.width=Math.floor(t.width*t.scale),n.canvas.height=Math.floor(t.height*t.scale),n.canvas.style.width=t.width+"px",n.canvas.style.height=t.height+"px",n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-t.x,-t.y),n.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+t.width+"x"+t.height+" at "+t.x+","+t.y+") with scale "+t.scale),n}return A.prototype.render=function(e){return dA(this,void 0,void 0,function(){var t,n;return nA(this,function(s){switch(s.label){case 0:return t=Ns(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,e),[4,Ww(t)];case 1:return n=s.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=q(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(n,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},A}(rd),Ww=function(r){return new Promise(function(A,e){var t=new Image;t.onload=function(){A(t)},t.onerror=e,t.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(r))})},Xw=function(){function r(A){var e=A.id,t=A.enabled;this.id=e,this.enabled=t,this.start=Date.now()}return r.prototype.debug=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,Ir([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},r.prototype.getTime=function(){return Date.now()-this.start},r.prototype.info=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,Ir([this.id,this.getTime()+"ms"],A))},r.prototype.warn=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,Ir([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},r.prototype.error=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,Ir([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},r.instances={},r}(),Jw=function(){function r(A,e){var t;this.windowBounds=e,this.instanceName="#"+r.instanceCount++,this.logger=new Xw({id:this.instanceName,enabled:A.logging}),this.cache=(t=A.cache)!==null&&t!==void 0?t:new hw(this,A)}return r.instanceCount=1,r}(),zw=function(r,A){return A===void 0&&(A={}),Yw(r,A)};typeof window<"u"&&zc.setContext(window);var Yw=function(r,A){return dA(void 0,void 0,void 0,function(){var e,t,n,s,i,o,a,l,c,h,d,B,g,f,m,F,Q,y,L,T,R,E,R,K,M,W,iA,uA,G,tA,zA,gA,BA,de,IA,YA,ue,he,PA,ge;return nA(this,function(KA){switch(KA.label){case 0:if(!r||typeof r!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(e=r.ownerDocument,!e)throw new Error("Element is not attached to a Document");if(t=e.defaultView,!t)throw new Error("Document is not attached to a Window");return n={allowTaint:(K=A.allowTaint)!==null&&K!==void 0?K:!1,imageTimeout:(M=A.imageTimeout)!==null&&M!==void 0?M:15e3,proxy:A.proxy,useCORS:(W=A.useCORS)!==null&&W!==void 0?W:!1},s=is({logging:(iA=A.logging)!==null&&iA!==void 0?iA:!0,cache:A.cache},n),i={windowWidth:(uA=A.windowWidth)!==null&&uA!==void 0?uA:t.innerWidth,windowHeight:(G=A.windowHeight)!==null&&G!==void 0?G:t.innerHeight,scrollX:(tA=A.scrollX)!==null&&tA!==void 0?tA:t.pageXOffset,scrollY:(zA=A.scrollY)!==null&&zA!==void 0?zA:t.pageYOffset},o=new bA(i.scrollX,i.scrollY,i.windowWidth,i.windowHeight),a=new Jw(s,o),l=(gA=A.foreignObjectRendering)!==null&&gA!==void 0?gA:!1,c={allowTaint:(BA=A.allowTaint)!==null&&BA!==void 0?BA:!1,onclone:A.onclone,ignoreElements:A.ignoreElements,inlineImages:l,copyStyles:l},a.logger.debug("Starting document clone with size "+o.width+"x"+o.height+" scrolled to "+-o.left+","+-o.top),h=new Xc(a,r,c),d=h.clonedReferenceElement,d?[4,h.toIFrame(e,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return B=KA.sent(),g=Xs(d)||$f(d)?Eu(d.ownerDocument):Tr(a,d),f=g.width,m=g.height,F=g.left,Q=g.top,y=$w(a,d,A.backgroundColor),L={canvas:A.canvas,backgroundColor:y,scale:(IA=(de=A.scale)!==null&&de!==void 0?de:t.devicePixelRatio)!==null&&IA!==void 0?IA:1,x:((YA=A.x)!==null&&YA!==void 0?YA:0)+F,y:((ue=A.y)!==null&&ue!==void 0?ue:0)+Q,width:(he=A.width)!==null&&he!==void 0?he:Math.ceil(f),height:(PA=A.height)!==null&&PA!==void 0?PA:Math.ceil(m)},l?(a.logger.debug("Document cloned, using foreign object rendering"),R=new Ow(a,L),[4,R.render(d)]):[3,3];case 2:return T=KA.sent(),[3,5];case 3:return a.logger.debug("Document cloned, element located at "+F+","+Q+" with size "+f+"x"+m+" using computed rendering"),a.logger.debug("Starting DOM parsing"),E=Hc(a,d),y===E.styles.backgroundColor&&(E.styles.backgroundColor=DA.TRANSPARENT),a.logger.debug("Starting renderer for element at "+L.x+","+L.y+" with size "+L.width+"x"+L.height),R=new xw(a,L),[4,R.render(E)];case 4:T=KA.sent(),KA.label=5;case 5:return(!((ge=A.removeContainer)!==null&&ge!==void 0)||ge)&&(Xc.destroy(B)||a.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),a.logger.debug("Finished rendering"),[2,T]}})})},$w=function(r,A,e){var t=A.ownerDocument,n=t.documentElement?it(r,getComputedStyle(t.documentElement).backgroundColor):DA.TRANSPARENT,s=t.body?it(r,getComputedStyle(t.body).backgroundColor):DA.TRANSPARENT,i=typeof e=="string"?it(r,e):e===null?DA.TRANSPARENT:4294967295;return A===t.documentElement?OA(n)?OA(s)?i:s:n:i};const Mt=class Mt extends p.EngineObject{constructor(A,e){super(A,e),this.ad(new w.ObjResettingWithEvent(A.renderInUEChanged,()=>A.renderInUE?new sd(A,e):new nd(A,e)))}};C(Mt,"type",Mt.register("ESUeViewer",p.ESGeoDiv.type,Mt));let ti=Mt;class nd extends w.Destroyable{constructor(e,t){super();C(this,"_screenPosition",this.disposeVar(w.reactArrayWithUndefined(void 0)));const n=t.viewer;if(!n){console.warn("viewer is undefined!");return}const s=this.disposeVar(new p.ESTextLabel);s.parentID=e.id,e.mainClass=s,t.add(s),this.dispose(()=>t.delete(s)),s.show=!1,this.dispose(w.bind([s,"position"],[e,"position"])),this.dispose(w.bind([s,"rotation"],[e,"rotation"])),this.dispose(w.bind([s,"flyToParam"],[e,"flyToParam"])),this.dispose(w.bind([s,"flyInParam"],[e,"flyInParam"])),this.dispose(e.calcFlyToParamEvent.disposableOn(()=>{$A(n,s.id)})),this.dispose(e.calcFlyInParamEvent.disposableOn(async()=>{if(!t.actived)return;const a=await t.getCurrentCameraInfo();if(!a)return;const{position:l,rotation:c}=a;e.flyInParam={position:l,rotation:c,flyDuration:1}})),this.dispose(e.smoothMoveEvent.disposableOn((a,l)=>{_e(n,s.id,a,l)})),this.dispose(e.smoothMoveWithRotationEvent.disposableOn((a,l,c)=>{ke(n,s.id,a,l,c)})),this.dispose(e.smoothMoveOnGroundEvent.disposableOn((a,l,c,h)=>{Ge(n,s.id,a,l,h,c)})),this.dispose(e.smoothMoveWithRotationOnGroundEvent.disposableOn((a,l,c,h,d)=>{Ne(n,s.id,a,l,c,h,d)})),this.dispose(e.flyToEvent.disposableOn((a,l)=>{s.flyTo(a)})),this.dispose(e.flyInEvent.don(a=>{s.flyIn(a)}));const i=this._screenPosition,o=this.disposeVar(new p.ESCustomDiv);o.parentID=e.id,t.add(o),this.dispose(()=>t.delete(o)),this.dispose(w.bind([o,"allowPicking"],[e,"allowPicking"]));{const a=this.disposeVar(w.createAnimateFrame()),l=()=>{e.show?a.restart(void 0,async()=>{if(!e.position)return;const c=await t.lonLatAltToScreenPosition(e.position);if(!this.isDestroyed())if(!c)this._screenPosition.value=void 0;else{const[h,d]=c;h===-1&&d===-1?this._screenPosition.value=void 0:this._screenPosition.value=[h,d]}}):a.cancel()};l(),this.dispose(e.showChanged.disposableOn(l))}{const a=()=>class extends w.Destroyable{constructor(d,B,g){if(super(),this._subContainer=d,!g)return;if(!e.instanceClass)throw new Error("!sceneObject.instanceClass");const f=new w.PosFloatDiv,m=f.element;this._subContainer.appendChild(m),this.dispose(()=>this._subContainer.removeChild(m)),m.onclick=F=>{(e.allowPicking??!1)&&e.pickedEvent.emit(new p.ESJPickedResult({div:m,pointerEvent:F},e,void 0,void 0,void 0,[F.x,F.y]))};{const F=()=>{e.editing?m.children[0].style.pointerEvents="none":m.children[0].style.pointerEvents="all"};F(),this.d(e.editingChanged.don(F))}{const F=()=>{const y=e.show;i.value&&y?(f.show=!0,f.winPos=[...i.value]):(f.show=!1,f.winPos=[0,0])};F();const Q=this.disposeVar(w.createNextAnimateFrameEvent(e.showChanged,i.changed));this.dispose(Q.disposableOn(F))}{const F=()=>{const[Q,y]=e.anchor??p.ESGeoDiv.defaults.anchor;f.originRatioX=Q,f.originRatioY=y};F(),this.dispose(e.anchorChanged.disposableOn(F))}{const F=()=>{f.opacity=e.opacity??p.ESGeoDiv.defaults.opacity};F(),this.dispose(e.opacityChanged.disposableOn(F))}this.disposeVar(new e.instanceClass(f.contentDiv,e,g))}},l=()=>{try{e.instanceClass?o.instanceClass=a():o.instanceClass=void 0}catch(h){console.error(h)}};l();const c=this.dv(w.createNextAnimateFrameEvent(e.instanceClassChanged,e.opacityChanged,e.anchorChanged,e.editingChanged,e.showChanged,e.allowPickingChanged));this.d(c.don(l))}}get screenPosition(){return this._screenPosition.value}get screenPositionChanged(){return this._screenPosition.changed}set screenPosition(e){this._screenPosition.value=e}}class sd extends w.Destroyable{constructor(e,t){super();C(this,"_imageLabel");C(this,"_hasClassDivAndPos",{});this._imageLabel=this.dv(new p.ESImageLabel),this._imageLabel.isHoverZoom=!1,this._imageLabel.parentID=e.id;const n=t.viewer;if(!n){console.warn("viewer is undefined!");return}e.mainClass=this._imageLabel;const s=this._imageLabel;t.add(s),this.d(()=>t.delete(s));{const i=()=>{if(!n)return;if(!e.instanceClass)throw new Error("!sceneObject.instanceClass");const l=document.createElement("div"),c=this.dv(new e.instanceClass(l,e,t))._container;if(c.style.opacity=e.opacity.toString()??p.ESGeoDiv.defaults.opacity,c.style.position="fixed",c.style.zIndex="-1",c.style.top="0px",!document.body.contains(c)){document.body.appendChild(c);let d=c?c.querySelectorAll("*[class]"):[];for(let B=0;B<d.length;B++){const g=d[B];var h=g.getBoundingClientRect();this._hasClassDivAndPos[g.className]=[g.offsetLeft,g.offsetTop,g.offsetLeft+h.width,g.offsetTop+h.height]}}zw(c,{backgroundColor:null,allowTaint:!0,useCORS:!0,width:c.offsetWidth,height:c.offsetHeight,scale:1}).then(d=>{document.body.contains(c)&&document.body.removeChild(c),s.url=d.toDataURL(),s.show=e.show}).catch(()=>{document.body.contains(c)&&document.body.removeChild(c)})},o=()=>{try{e.instanceClass?i():(s.url="",s.show=!1)}catch(l){console.error(l)}};o();const a=this.dv(w.createNextAnimateFrameEvent(e.instanceClassChanged,e.opacityChanged));this.d(a.don(o))}{const i=()=>{s.show=e.show};s.show=!1,this.ad(e.showChanged.don(i))}this.d(w.track([s,"anchor"],[e,"anchor"])),this.d(w.bind([s,"position"],[e,"position"])),this.d(w.bind([s,"rotation"],[e,"rotation"])),this.d(w.bind([s,"flyToParam"],[e,"flyToParam"])),this.d(w.bind([s,"flyInParam"],[e,"flyInParam"])),this.d(w.bind([s,"allowPicking"],[e,"allowPicking"])),this.d(w.bind([s,"scale"],[e,"scale"])),this.d(w.track([s,"minVisibleDistance"],[e,"minVisibleDistance"])),this.d(w.track([s,"maxVisibleDistance"],[e,"maxVisibleDistance"])),this.ad(e.automaticLandingEvent.don(()=>{s.automaticLanding()})),this.d(t.widgetEvent.don(i=>{if(i.objId!==this._imageLabel.id)return;const{type:o,add:a}=i;if(o==="leftClick"&&a){const l=(a==null?void 0:a.classNames)??[],c=Object.keys(this._hasClassDivAndPos);for(let h=0;h<c.length;h++){const d=c[h];let B=this._hasClassDivAndPos[d];a&&a.mouseRelativePos&&a.mouseRelativePos[0]>=B[0]&&a.mouseRelativePos[0]<=B[2]&&a.mouseRelativePos[1]>=B[1]&&a.mouseRelativePos[1]<=B[3]&&l.push(d)}a.classNames=l}e.widgetEvent.emit({type:o,add:a})})),this.d(e.calcFlyToParamEvent.don(()=>{$A(n,s.id)})),this.d(e.calcFlyInParamEvent.don(()=>{const i=t.getCurrentCameraInfo();if(!i)return;const{position:o,rotation:a}=i;e.flyInParam={position:o,rotation:a,flyDuration:1}})),this.d(e.smoothMoveEvent.don((i,o)=>{_e(n,s.id,i,o)})),this.d(e.smoothMoveWithRotationEvent.don((i,o,a)=>{ke(n,s.id,i,o,a)})),this.d(e.smoothMoveOnGroundEvent.don((i,o,a,l)=>{Ge(n,s.id,i,o,l,a)})),this.d(e.smoothMoveWithRotationOnGroundEvent.don((i,o,a,l,c)=>{Ne(n,s.id,i,o,a,l,c)})),this.d(e.flyToEvent.don((i,o)=>{s.flyTo(i)})),this.d(e.flyInEvent.don(i=>{s.flyIn(i)}))}}const Dt=class Dt extends lA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.d(A.flyToFeatureIndexEvent.don((n,s)=>{t.callUeFunc({f:"flyToFeatureIndex",p:{id:A.id,index:n,duration:s}})})),this.d(A.flyToFeatureEvent.don((n,s,i)=>{t.callUeFunc({f:"flyToFeature",p:{id:A.id,key:n,value:s,duration:i}})}))}};C(Dt,"type",Dt.register("ESUeViewer",p.ESGeoJson.type,Dt));let ri=Dt;const Rt=class Rt extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Rt,"type",Rt.register("ESUeViewer",p.ESGeoLineString.type,Rt));let Fn=Rt;const Pt=class Pt extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Pt,"type",Pt.register("ESUeViewer",p.ESGeoRectangle.type,Pt));let ni=Pt;const Kt=class Kt extends cA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Kt,"type",Kt.register("ESUeViewer",p.ESGeoWater.type,Kt));let si=Kt;const oe=class oe extends x{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.d(A.setNodePositionEvent.don((n,s)=>{io(t,A.id,n,s)})),this.d(A.setNodeRotationEvent.don((n,s)=>{oo(t,A.id,n,s)})),this.d(A.setNodeScaleEvent.don((n,s)=>{ao(t,A.id,n,s)}))}};C(oe,"forceUeUpdateProps",[...x.forceUeUpdateProps,"url"]),C(oe,"propValFuncs",{...x.propValFuncs,url:A=>typeof A=="string"?p.ESSceneObject.context.getStrFromEnv(p.rpToap(A)):(A.url=p.ESSceneObject.context.getStrFromEnv(p.rpToap(A.url)),A),czmMaximumScale:null,czmMinimumPixelSize:null,czmNativeScale:null,czmColor:null}),C(oe,"type",oe.register("ESUeViewer",p.ESGltfModel.type,oe));let ii=oe;const xt=class xt extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(xt,"type",xt.register("ESUeViewer",p.ESHeightMeasurement.type,xt));let oi=xt;const kt=class kt extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}const n=async(i,o,a,l)=>{const{viewer:c}=i;if(!c){console.error("AIMoveTo: ueViewer.viewer is undefined");return}const h=await c.callUeFunc({f:"AIMoveTo",p:{id:o,Destination:a,Time:l}});return h.error&&console.error("AIMoveTo:",h.error),h};this.d(A.aiMoveToEvent.don((i,o)=>{n(e,A.id,i,o)}));const s=async(i,o)=>{const{viewer:a}=i;if(!a){console.error("StopAIMove: ueViewer.viewer is undefined");return}const l=await a.callUeFunc({f:"StopAIMove",p:{id:o}});return l.error&&console.error("StopAIMove:",l.error),l};this.d(A.stopAIMoveEvent.don(()=>{s(e,A.id)}))}};C(kt,"type",kt.register("ESUeViewer",p.ESHuman.type,kt));let ai=kt;const ae=class ae extends UA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}A.anchor=[.5,1]}};C(ae,"type",ae.register("ESUeViewer",p.ESImageLabel.type,ae)),C(ae,"forceUeUpdateProps",[...UA.forceUeUpdateProps,"url"]),C(ae,"propValFuncs",{...UA.propValFuncs,url:A=>typeof A=="string"?p.ESSceneObject.context.getStrFromEnv(p.rpToap(A)):(A.url=p.ESSceneObject.context.getStrFromEnv(p.rpToap(A.url)),A)});let li=ae;const Gt=class Gt extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Gt,"type",Gt.register("ESUeViewer",p.ESLevelRuntimeModel.type,Gt));let ci=Gt;const Nt=class Nt extends Er{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Nt,"type",Nt.register("ESUeViewer",p.ESLocalCircle.type,Nt));let di=Nt;const _t=class _t extends lA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(_t,"type",_t.register("ESUeViewer",p.ESLocalPolygonZ.type,_t));let ui=_t;const Vt=class Vt extends Er{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Vt,"type",Vt.register("ESUeViewer",p.ESLocalRectangle.type,Vt));let hi=Vt;const Ot=class Ot extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Ot,"type",Ot.register("ESUeViewer",p.ESLocalSkyBox.type,Ot));let gi=Ot;const Wt=class Wt extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Wt,"type",Wt.register("ESUeViewer",p.ESLocationMeasurement.type,Wt));let Bi=Wt;const Xt=class Xt extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Xt,"type",Xt.register("ESUeViewer",p.ESPipeFence.type,Xt));let fi=Xt;const Jt=class Jt extends Fn{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Jt,"type",Jt.register("ESUeViewer",p.ESPipeline.type,Jt));let wi=Jt;const zt=class zt extends yr{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.d(A.highlightFeatureEvent.don(n=>{const s=typeof n=="number"?n.toString():n;to(t,A.id,s)})),this.d(A.highlightFeatureAndFlyToEvent.don((n,s,i,o)=>{const a=typeof n=="number"?n.toString():n;ro(t,A.id,a,o??1)})),this.d(A.setLayerVisibleEvent.don((n,s)=>{let i="";typeof s!="string"?i=JSON.stringify(s):i=s,no(t,A.id,i)})),this.d(A.setLayerColorEvent.don((n,s)=>{let i="";typeof s!="string"?i=JSON.stringify(s):i=s,so(t,A.id,i)}))}};C(zt,"type",zt.register("ESUeViewer",p.ESPipeserTileset.type,zt));let pi=zt;const Yt=class Yt extends cA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Yt,"type",Yt.register("ESUeViewer",p.ESPit.type,Yt));let Ci=Yt;const $t=class $t extends UA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.ad(A.getInitialStyleEvent.don(async()=>{try{const n=await t.callUeFunc({f:"GetInitialStyle",p:{id:A.id}});n.error!=""&&console.error("getInitialStyleEvent:",n.error),A.initialStyle.value=structuredClone(n.re)}catch(n){console.error("getInitialStyleEvent:",n),A.initialStyle.value=void 0}}))}};C($t,"type",$t.register("ESUeViewer",p.ESPoi2D.type,$t));let vi=$t;const Zt=class Zt extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Zt,"type",Zt.register("ESUeViewer",p.ESPoi3D.type,Zt));let mi=Zt;const le=class le extends lA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(le,"type",le.register("ESUeViewer",p.ESPoiTileset.type,le)),C(le,"forceUeUpdateProps",[...lA.forceUeUpdateProps,"url"]),C(le,"propValFuncs",{...lA.propValFuncs,url:A=>typeof A=="string"?p.ESSceneObject.context.getStrFromEnv(A):(A.url=p.ESSceneObject.context.getStrFromEnv(A.url),A)});let Fi=le;const qt=class qt extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(qt,"type",qt.register("ESUeViewer",p.ESPolygonFence.type,qt));let Qi=qt;const De=class De extends cA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(De,"type",De.register("ESUeViewer",p.ESPolygonFlattenedPlane.type,De)),C(De,"propValFuncs",{...cA.propValFuncs,targetID:A=>{if(!A)return"";const e=p.ESSceneObject.getSceneObject(A);return e?e.getMainClass().id:A}});let Ui=De;const jt=class jt extends cA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(jt,"type",jt.register("ESUeViewer",p.ESPolygonWithHole.type,jt));let Ei=jt;const Ar=class Ar extends jA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}this.d(()=>{A.ids=[]}),this.d(A.highlightInner3DtilesetEvent.don(n=>{n.highlight=!0})),this.d(A.removeHighlightInner3DtilesetEvent.don(n=>{n.highlight=!1}));{const n=o=>{o=o.toLocaleLowerCase();let a=[255,255,255,1];if(o.startsWith("#")){if(o.length===4){let l=parseInt(o[1]+o[1],16),c=parseInt(o[2]+o[2],16),h=parseInt(o[3]+o[3],16);a=[l,c,h,1]}else if(o.length===7){let l=parseInt(o.substring(1,3),16),c=parseInt(o.substring(3,5),16),h=parseInt(o.substring(5,7),16);a=[l,c,h,1]}}else if(o.startsWith("rgba")){let l=o.match(/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)$/);if(l){let c=parseInt(l[1]),h=parseInt(l[2]),d=parseInt(l[3]),B=parseFloat(l[4]);a=[c,h,d,B]}}else if(o.startsWith("rgb")){let l=o.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);if(l){let c=parseInt(l[1]),h=parseInt(l[2]),d=parseInt(l[3]);a=[c,h,d,1]}}else console.error("color类型只能为#rrggbb、#rgb、rgba(r,g,b,a)、rgb(r,g,b)");return[a[0]/255,a[1]/255,a[2]/255,a[3]]},s=()=>{const o=A.layerConfig;if(!o)return;const a=[];o.forEach(l=>{o.filter(h=>h.dataset==l.dataset).length==1?a.push({condition:[{field:"dataset",op:"==",value:l.dataset}],color:n(l.value.color??"rgb(255,255,255)"),show:l.value.visible}):a.push({condition:[{field:"layer",op:"==",value:l.layer},{field:"dataset",op:"==",value:l.dataset}],color:n(l.value.color??"rgb(255,255,255)"),show:l.value.visible})}),A.setFeatureStyle(a)};s();const i=this.dv(w.createNextAnimateFrameEvent(A.layerConfigChanged,A.colorBlendModeChanged));this.d(i.don(()=>{s()}))}}};C(Ar,"type",Ar.register("ESUeViewer",p.ESRtsTileset.type,Ar));let yi=Ar;const er=class er extends lA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}this.d(A.addTreesEvent.don(n=>{p.addTreesCallFunc(e,A.id,n)})),this.d(A.removeAllTreesEvent.don(()=>{p.removeAllTreesCallFunc(e,A.id)})),this.d(A.updateTreeParamsEvent.don(n=>{p.updateTreeParamsCallFunc(e,A.id,n)})),this.d(A.cutDownTreesEvent.don((n,s)=>{p.cutDownTreesCallFunc(e,A.id,n,s)})),this.d(A.growthSimulationEvent.don((n,s,i)=>{p.growthSimulationCallFunc(e,A.id,n,s,i)}))}};C(er,"type",er.register("ESUeViewer",p.ESSeparateFoliage.type,er));let Si=er;const tr=class tr extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(tr,"type",tr.register("ESUeViewer",p.ESSubmergingAnalysis.type,tr));let Ii=tr;const rr=class rr extends cA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.d(A.startEvent.don(()=>{t.callUeFunc({f:"Start",p:{id:A.id}})})),this.d(A.stopEvent.don(()=>{t.callUeFunc({f:"Stop",p:{id:A.id}})}))}};C(rr,"type",rr.register("ESUeViewer",p.ESSunshineAnalysis.type,rr));let Ti=rr;const nr=class nr extends cA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.d(A.startEvent.don(()=>{t.callUeFunc({f:"Start",p:{id:A.id}})}))}};C(nr,"type",nr.register("ESUeViewer",p.ESSurfaceAreaMeasurement.type,nr));let Hi=nr;const sr=class sr extends UA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(sr,"type",sr.register("ESUeViewer",p.ESTextLabel.type,sr));let Li=sr;const Re=class Re extends UA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.d(A.callFunctionEvent.don(async(n,s)=>{const i=await yn(t,A.id,n,s);A.__callFunctionResultEvent.emit(i)}))}};C(Re,"type",Re.register("ESUeViewer",p.ESUEWidget.type,Re)),C(Re,"propValFuncs",{...UA.propValFuncs,info:A=>JSON.stringify(A??{})});let bi=Re;const id=r=>{switch(r){case 0:return"成功绑定";case 1:return"解绑之前的内容,成功绑定";case 2:return"未搜索到ActorTag,无法绑定";case 3:return"搜索到ActorTag但对应的Actor不是场景原有的,而是新建的,无法绑定";case 4:return"搜索到ActorTag对应的Actor是地形或3DTileset,无法绑定";default:return"未知错误"}},Zw=r=>{switch(r){case 0:return"创建成功";case 1:return"未找到对应的资源,无法创建";case 2:return"Id与场景中现有的ActorTag重复,创建后可能出现问题,创建失败";default:return"未知错误"}},ir=class ir extends p.EngineObject{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn(`${A.id} UeESUnrealActor viewer is undefined!`);return}this.d(()=>{Un(t,A.id)});const n=async()=>{l()||await t.callUeFunc({f:"update",p:{id:A.id,name:A.name,show:A.show,rotation:A.rotation,flyToParam:A.flyToParam??p.ESVisualObject.defaults.flyToParam,flyInParam:A.flyInParam??p.ESVisualObject.defaults.flyInParam,highlight:A.highlight,collision:A.collision,scale:A.scale,minVisibleDistance:A.minVisibleDistance,maxVisibleDistance:A.maxVisibleDistance}})},s=this.dv(w.createNextAnimateFrameEvent(A.showChanged,A.nameChanged,A.rotationChanged,A.flyToParamChanged,A.flyInParamChanged,A.highlightChanged,A.collisionChanged,A.scaleChanged,A.minVisibleDistanceChanged,A.maxVisibleDistanceChanged));this.d(s.don(n)),this.d(A.flushEvent.don(()=>s.flush()));let i,o;const a=async()=>{l()||(await t.callUeFunc({f:"update",p:{id:A.id,position:A.position}}),(e.debug??!1)&&console.log(`updatePostion:${A.position},actorTag:${A.actorTag},actorClass:${A.actorClass}`))},l=()=>!i&&!o?(console.warn(`${A.id} 未绑定ActorTag或未创建ActorClass!`),!0):!1,c=async()=>{const{id:d}=A,B=await e.unBindActorByID(d);B&&B.error!==""&&console.warn(`${A.id} UeESUnrealActor UnBindActorByID: ${B.error}`),i=void 0;const g=await t.callUeFunc({f:"destroy",p:{id:d}});if(g&&g.error!==""){console.warn(`${A.id} UeESUnrealActor DestroyActorByID: ${g.error}`);return}o=void 0},h=this.dv(w.react({type:"ActorClass",actorClass:"default"}));{const d=this.dv(w.createNextAnimateFrameEvent(A.actorClassChanged,A.actorTagChanged)),B=async()=>{A.actorTag!==""?h.value={type:"ActorTag",actorTag:A.actorTag}:h.value={type:"ActorClass",actorClass:A.actorClass===""?"default":A.actorClass}};B(),this.d(d.don(B)),this.d(A.flushEvent.don(()=>d.flush()))}{const d=this.dv(w.createProcessingFromAsyncFunc(async g=>{if(await g.promise(c()),h.value.type==="ActorTag"){const{actorTag:f}=h.value;await g.promise(c());try{A.lastActorStatus="null";const m=await g.promise(e.bindActorByTag(A.id,f));if(!m)return;if(m.error!==""){console.warn(`${A.id} UeESUnrealActor BindActorByTag:${f},${m.error}`);return}if(m.re.type===0)A.lastActorStatus="bound",i=f;else if(m.re.type===1)A.lastActorStatus="bound",i=f,console.warn(`${A.id} UeESUnrealActor BindActorByTag:${f},${id(m.re.type)}`);else{i=void 0,console.warn(`${A.id} UeESUnrealActor BindActorByTag error:${f}, ${id(m.re.type)}`);return}}catch(m){console.warn(`${A.id} UeESUnrealActor BindActorByTag catch error:${f}, ${m}`);return}}else if(h.value.type==="ActorClass"){const{actorClass:f}=h.value;try{const m=await g.promise(e.createActorByClass(A.id,f));if(!m)return;if(m.error!==""){console.warn(`${A.id} UeESUnrealActor CreateActorByClass error :${f}, ${m.error}`);return}if(m.re.type===0)A.lastActorStatus="created",o=f;else{console.warn(`${A.id} UeESUnrealActor CreateActorByClass error type :${f},${Zw(m.re.type)}`);return}}catch(m){console.warn(`${A.id} UeESUnrealActor CreateActorByClass error catch :${f}, ${JSON.stringify(m)}`);return}}await g.promise(n()),await g.promise(a())})),B=async()=>{d.restart()};B(),this.d(h.changed.don(B))}this.d(A.positionChanged.don(a)),this.d(A.callFunctionEvent.don(async(d,B)=>{if(l()){A.__callFunctionResultEvent.emit(void 0);return}const g=await yn(t,A.id,d,B);A.__callFunctionResultEvent.emit(g)})),this.d(A.smoothMoveEvent.don((d,B)=>{l()||_e(t,A.id,d,B)})),this.d(A.smoothMoveWithRotationEvent.don((d,B,g)=>{l()||ke(t,A.id,d,B,g)})),this.d(A.smoothMoveOnGroundEvent.don((d,B,g,f)=>{l()||Ge(t,A.id,d,B,f,g)})),this.d(A.smoothMoveWithRotationOnGroundEvent.don((d,B,g,f,m)=>{l()||Ne(t,A.id,d,B,g,f,m)})),this.d(A.automaticLandingEvent.don(d=>{if(l())return;const B=[A.position[0],A.position[1]];e.getHeightByLonLat(A.position[0],A.position[1],"Visibility").then(g=>{g!==null&&(A.position=[...B,g],A.collision=d)})})),this.d(A.flyToEvent.don(async(d,B)=>{if(l())return;const g=await Be(t,A.id,d);let f="over";g===void 0?f="error":g.endType===0?f="over":g.endType===1&&(f="cancelled"),A.flyOverEvent.emit(B,f,e)})),this.d(A.calcFlyToParamEvent.don(()=>{l()||$A(t,A.id)})),this.d(A.calcFlyInParamEvent.don(async()=>{if(!e.actived)return;const d=await e.getCurrentCameraInfo();if(!d)return;const{position:B,rotation:g}=d;A.flyInParam={position:B,rotation:g,flyDuration:1}})),this.d(e.propChanged.don(d=>{l()||d.objId===A.id&&Object.keys(d.props).forEach(B=>{const g=d.props[B]===null?void 0:d.props[B];A[B]=g})}))}};C(ir,"type",ir.register("ESUeViewer",p.ESUnrealActor.type,ir));let Mi=ir;const or=class or extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(or,"type",or.register("ESUeViewer",p.ESVideoFusion.type,or));let Di=or;const ar=class ar extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(ar,"type",ar.register("ESUeViewer",p.ESViewShed.type,ar));let Ri=ar;const lr=class lr extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is underfined!");return}}};C(lr,"type",lr.register("ESUeViewer",p.ESVisibilityAnalysis.type,lr));let Pi=lr;const cr=class cr extends cA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.ad(w.track([A,"volume"],[A,"cutAndFillVolume"])),this.d(A.startEvent.don(()=>{t.callUeFunc({f:"Start",p:{id:A.id}})})),this.d(A.clearEvent.don(()=>{t.callUeFunc({f:"Clear",p:{id:A.id}})}))}};C(cr,"type",cr.register("ESUeViewer",p.ESVolumeMeasurement.type,cr));let Ki=cr;const Pe=class Pe extends UA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(Pe,"type",Pe.register("ESUeViewer",p.ESWidget.type,Pe)),C(Pe,"propValFuncs",{...UA.propValFuncs,info:A=>JSON.stringify(A??{})});let xi=Pe;const dr=class dr extends p.EngineObject{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}A.poi.actorTag=A.human.id,A.poi.positionOffset=[0,0,A.poiOffsetHeight-.8],this.d(A.poiOffsetHeightChanged.don(()=>{A.poi.positionOffset=[0,0,A.poiOffsetHeight-.8]})),this.d(()=>{A.poi.actorTag=""})}};C(dr,"type",dr.register("ESUeViewer",p.ESHumanPoi.type,dr));let ki=dr;p.ESSceneObject.context.getStrFromEnv(p.ESNavigator.defaults.imgUrl);const ur=class ur extends p.EngineObject{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}const n=this.disposeVar(new p.ESCustomDiv);e.add(n),this.dispose(()=>e.delete(n)),this.dispose(w.track([n,"show"],[A,"show"])),n.instanceClass=class extends w.Destroyable{constructor(i,o,a){super(),this._subContainer=i;const l=document.createElement("div");this._subContainer.appendChild(l),this.dispose(()=>this._subContainer.removeChild(l));{const d=async()=>{const B=await e.getCurrentCameraInfo(),g=B==null?void 0:B.position,m=[...B==null?void 0:B.rotation];m[0]=360,e.flyIn(g,m)};l.addEventListener("click",d),l.style.cursor="pointer",this.dispose(()=>l.removeEventListener("click",d))}{const d=()=>{l.style.width=`${A.cssSize?A.cssSize:p.ESNavigator.defaults.cssSize}px`,l.style.height=`${A.cssSize?A.cssSize:p.ESNavigator.defaults.cssSize}px`};d(),A.dispose(A.cssSizeChanged.disposableOn(d))}l.style.position="fixed";{const d=()=>{l.style.top=`${A.cssPosition?A.cssPosition[0]:p.ESNavigator.defaults.cssPosition[0]}px`,l.style.right=`${A.cssPosition?A.cssPosition[1]:p.ESNavigator.defaults.cssPosition[1]}px`};d(),A.dispose(A.cssPositionChanged.disposableOn(d))}l.style.transition=" right 0.4s linear",l.style.cursor="pointer";const c=document.createElement("div");l.appendChild(c),this.dispose(()=>l.removeChild(c)),c.style.width="100%",c.style.height="100%",c.style.position="relative";const h=document.createElement("img");c.appendChild(h),this.dispose(()=>c.removeChild(h)),h.style.width="100%",h.style.height="100%",h.style.border="none";{const d=()=>h.src=A.imgUrl;d(),A.dispose(A.imgUrlChanged.disposableOn(d))}{const d=()=>{const m=-e.getCurrentCameraInfo().rotation[0];h.style.transform=`rotate(${m}deg)`};let B;const g=async()=>{d(),A.show?(l.style.display="block",B=setInterval(()=>{d()},1e3)):(l.style.display="none",clearInterval(B))};this.dispose(A.showChanged.disposableOn(g)),g(),this.dispose(()=>clearInterval(B))}h.style.transformOrigin="50% 50%"}}}};C(ur,"type",ur.register("ESUeViewer",p.ESNavigator.type,ur));let Gi=ur;const ce=class ce extends rA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}{const n=()=>{let s=A.materialMode==="blue"?"multipleArrows":A.materialMode==="purple"?"singleArrow":A.materialMode;t.callUeFunc({f:"update",p:{id:A.id,materialMode:s}})};this.dispose(A.materialModeChanged.disposableOn(n)),this.dispose(A.createdEvent.disposableOn(n))}}};C(ce,"type",ce.register("ESUeViewer",p.ESPath.type,ce)),C(ce,"forceUeUpdateProps",[...rA.forceUeUpdateProps]),C(ce,"propValFuncs",{...rA.propValFuncs,materialMode:null});let Ni=ce;async function qw(r){navigator.clipboard.writeText(r).then(function(){console.log("复制成功")},function(A){console.log("复制失败")})}const hr=class hr extends p.EngineObject{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}const n=this.disposeVar(new p.ESCustomDiv);e.add(n),this.dispose(()=>e.delete(n)),n.instanceClass=class extends w.Destroyable{constructor(i,o,a){if(super(),this._subContainer=i,!a||!(a instanceof LA))return;const l=document.createElement("div");this._subContainer.appendChild(l),this.dispose(()=>this._subContainer.removeChild(l)),l.style.width="100%",l.style.position="absolute",l.style.height=`${p.ESViewerStatusBar.defaults.height}px`,l.style.left="0",l.style.bottom="0",l.style.color="#fff",l.style.padding="0 20px 0 0",l.style.boxSizing="border-box",l.style.lineHeight=`${p.ESViewerStatusBar.defaults.height}px`,l.style.zIndex="100",l.style.alignContent="center",l.style.justifyContent="space-between";const c=document.createElement("span");l.appendChild(c),this.dispose(()=>l.removeChild(c));const h=document.createElement("span");c.appendChild(h),this.dispose(()=>c.removeChild(h));const d=document.createElement("span");c.appendChild(d),d.addEventListener("dblclick",function(){let g=d.innerHTML;g.startsWith("鼠标位置")&&(g=g.slice(5)),qw(g)}),d.style.cursor="pointer",this.dispose(()=>c.removeChild(d));const B=document.createElement("span");l.appendChild(B),this.dispose(()=>l.removeChild(B));{const g=()=>{l.style.height=(A.height??p.ESViewerStatusBar.defaults.height)+"px",l.style.lineHeight=(A.height??p.ESViewerStatusBar.defaults.height)+"px"};this.dispose(A.heightChanged.disposableOn(g)),g()}{const g=()=>{l.style.fontSize=(A.fontSize??p.ESViewerStatusBar.defaults.fontSize)+"px"};this.dispose(A.fontSizeChanged.disposableOn(g)),g()}{const g=()=>{A.bgColor?l.style.background=`rgba(${A.bgColor[0]*255},${A.bgColor[1]*255},${A.bgColor[2]*255},${A.bgColor[3]})`:l.style.background=`rgba(${p.ESViewerStatusBar.defaults.bgColor[0]},${p.ESViewerStatusBar.defaults.bgColor[1]},${p.ESViewerStatusBar.defaults.bgColor[2]},${p.ESViewerStatusBar.defaults.bgColor[3]})`};this.dispose(A.bgColorChanged.disposableOn(g)),g()}a.getVersion().then(g=>{g&&(B.innerText=`Ue 版本 : ${g[0]} `)}).catch(g=>{console.log(g)});{const g=()=>{let F="",Q="";F+=`帧率:${a.getFPS().toFixed(0)}FPS`,h.innerText=F;const y=e.getCurrentCameraInfo();F+=` 经度: ${y.position[0].toFixed(5)}° 纬度: ${y.position[1].toFixed(5)}° 高度: ${y.position[2].toFixed(2)}米 偏航角: ${y.rotation[0].toFixed(2)}° 俯仰角: ${y.rotation[1].toFixed(2)}° 翻滚角:${y.rotation[2].toFixed(2)}° `,h.innerText=F,e.pick().then(L=>{if(L){const{pickResult:T}=L;if(T&&T.position){const{position:E}=T;Q+=`鼠标位置:${E[0].toFixed(5)}° ${E[1].toFixed(5)}° ${E[2].toFixed(2)}m`}else Q+="暂时无法获取鼠标位置...";d.innerText=Q}}).catch(L=>{console.log(L)})};let f;const m=async()=>{g(),A.show?(l.style.display="flex",f=setInterval(()=>{g()},1e3)):(l.style.display="none",clearInterval(f))};this.dispose(A.showChanged.disposableOn(m)),m(),this.dispose(()=>clearInterval(f))}}}}};C(hr,"type",hr.register("ESUeViewer",p.ESViewerStatusBar.type,hr));let _i=hr;const gr=class gr extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(gr,"type",gr.register("ESUeViewer",p.ESGaussianSplatting.type,gr));let Vi=gr;const Br=class Br extends jA{constructor(e,t){super(e,t);C(this,"_es3DTileset",this.dv(new p.ES3DTileset));if(!t.viewer){console.warn("viewer is undefined!");return}this.es3DTileset.parentID=e.id,e.mainClass=this._es3DTileset;{const s=this._es3DTileset;t.add(s),this.dispose(()=>t.delete(s)),this.d(w.track([s,"allowPicking"],[e,"allowPicking"])),this.d(w.track([s,"collision"],[e,"collision"])),this.d(w.bind([s,"flyToParam"],[e,"flyToParam"])),this.d(w.bind([s,"flyToParam"],[e,"flyToParam"])),this.d(w.track([s,"url"],[e,"url"])),this.d(w.track([s,"actorTag"],[e,"actorTag"])),this.d(w.track([s,"materialMode"],[e,"materialMode"])),this.d(w.track([s,"highlight"],[e,"highlight"])),this.d(w.track([s,"maximumScreenSpaceError"],[e,"maximumScreenSpaceError"])),this.d(w.track([s,"highlightID"],[e,"highlightID"])),this.d(w.track([s,"highlightColor"],[e,"highlightColor"])),this.d(w.bind([s,"offset"],[e,"offset"])),this.d(w.bind([s,"rotation"],[e,"rotation"])),this.d(w.track([s,"czmImageBasedLightingFactor"],[e,"czmImageBasedLightingFactor"])),this.d(w.track([s,"czmLuminanceAtZenith"],[e,"czmLuminanceAtZenith"])),this.d(w.track([s,"czmMaximumMemoryUsage"],[e,"czmMaximumMemoryUsage"])),this.d(w.track([s,"czmClassificationType"],[e,"czmClassificationType"])),this.d(w.track([s,"czmStyleJson"],[e,"czmStyleJson"])),this.d(w.track([s,"czmBackFaceCulling"],[e,"czmBackFaceCulling"])),this.d(w.track([s,"czmDebugShowBoundingVolume"],[e,"czmDebugShowBoundingVolume"])),this.d(w.track([s,"czmDebugShowContentBoundingVolume"],[e,"czmDebugShowContentBoundingVolume"])),this.d(w.track([s,"colorBlendMode"],[e,"colorBlendMode"])),this.d(w.track([s,"cacheBytes"],[e,"cacheBytes"])),this.d(w.track([s,"clippingPlaneEnabled"],[e,"clippingPlaneEnabled"])),this.d(w.track([s,"unionClippingRegions"],[e,"unionClippingRegions"])),this.d(w.track([s,"clippingPlaneEdgeColor"],[e,"clippingPlaneEdgeColor"])),this.d(w.track([s,"clippingPlaneEdgeWidth"],[e,"clippingPlaneEdgeWidth"])),this.d(w.track([s,"materialParams"],[e,"materialParams"])),this.d(w.bind([s,"supportEdit"],[e,"supportEdit"])),this.d(w.bind([s,"clippingPlanesId"],[e,"clippingPlanesId"])),this.d(w.bind([s,"clippingPlaneIds"],[e,"clippingPlaneIds"])),this.d(w.bind([s,"flattenedPlaneId"],[e,"flattenedPlaneId"])),this.d(w.bind([s,"flattenedPlaneEnabled"],[e,"flattenedPlaneEnabled"])),this.d(w.bind([s,"clippingPlaneId"],[e,"clippingPlaneId"])),this.d(w.bind([s,"excavateId"],[e,"excavateId"]))}{const s=this._es3DTileset;this.d(e.refreshTilesetEvent.don(()=>{s.refreshTileset()})),this.d(e.highlightFeatureEvent.don((...i)=>{s.highlightFeature(...i)})),this.d(e.highlightFeatureAndFlyToEvent.don((...i)=>{s.highlightFeatureAndFlyTo(...i)})),this.d(e.setFeatureColorEvent.don((...i)=>{s.setFeatureColor(...i)})),this.d(e.setFeatureVisableEvent.don((...i)=>{s.setFeatureVisable(...i)})),this.d(e.resetFeatureStyleEvent.don((...i)=>{s.resetFeatureStyle(...i)})),this.d(e.flyInEvent.don((...i)=>{s.flyIn(i[0])})),this.d(e.flyToEvent.don((...i)=>{s.flyTo(i[0])})),this.d(e.calcFlyToParamEvent.don((...i)=>{s.calcFlyToParam(...i)})),this.d(e.calcFlyInParamEvent.don((...i)=>{s.calcFlyInParam(...i)}))}{const s=this._es3DTileset;this.d(s.tilesetReady.don(i=>{e.tilesetReady.emit(i)})),this.d(s.pickedEvent.don(i=>{i.assign({sceneObject:e}),e.pickedEvent.emit(i)}))}{const s=()=>{this.es3DTileset.show=e.show};s(),this.d(e.showChanged.don(()=>{s()}))}}get es3DTileset(){return this._es3DTileset}};C(Br,"type",Br.register("ESUeViewer",p.ESRtsFeatureEditing.type,Br));let Oi=Br;const fr=class fr extends jA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(fr,"type",fr.register("ESUeViewer",p.ESMsTileset.type,fr));let Wi=fr;const wr=class wr extends cA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}const n=()=>{t.callUeFunc({f:"update",p:{id:A.id,height:A.height??p.ESGeoExtrudedPolygon.defaults.height,extrudedHeight:A.extrudedHeight??p.ESGeoExtrudedPolygon.defaults.extrudedHeight,perPositionHeight:A.perPositionHeight??p.ESGeoExtrudedPolygon.defaults.perPositionHeight}})},s=this.disposeVar(w.createNextAnimateFrameEvent(A.heightChanged,A.extrudedHeightChanged,A.perPositionHeightChanged));this.dispose(s.disposableOn(n)),this.dispose(A.createdEvent.disposableOn(n))}};C(wr,"type",wr.register("ESUeViewer",p.ESGeoExtrudedPolygon.type,wr));let Xi=wr;const pr=class pr extends x{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};C(pr,"type",pr.register("ESUeViewer",p.ESStaticMesh.type,pr));let Ji=pr;const Cr=class Cr extends rA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.d(A.startEvent.don(()=>{t.callUeFunc({f:"Start",p:{id:A.id}})})),this.d(A.clearEvent.don(()=>{t.callUeFunc({f:"Clear",p:{id:A.id}})}))}};C(Cr,"type",Cr.register("ESUeViewer",p.ESSkylineAnalysis.type,Cr));let zi=Cr;v.copyright=void 0;try{const r="earthsdk3-ue",A="3.3.0-beta.3",e="2025-08-09T09:03:51.000Z",t="北京西部世界科技有限公司",n="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",s="9b45064f34fafac793b02811ef22c2f864141a12",o=((Date.now()-1754730231e3)/36e5).toFixed(1),a=`%c🌏 ${r}%c ${A}.${s.slice(0,8)}.${e} (距今${o}个小时)
|
|
113
113
|
%c${n?n+`
|
|
114
114
|
`:""}当前网站正在使用${r},此软件版权归${t}所有
|
|
115
|
-
`;v.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){return OWNERLINK_},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","
|
|
115
|
+
`;v.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){return OWNERLINK_},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","9b45064f34fafac793b02811ef22c2f864141a12")},get info(){return a},get date(){return"2025-08-09T09:03:51.000Z"},get author(){return"suplyang"},get version(){return"3.3.0-beta.3"},get name(){return"earthsdk3-ue"},get commitId(){return"9b45064f34fafac793b02811ef22c2f864141a12"},print(l=!1){!l&&window._xe2_no_copy_print||console.info(this.info,`
|
|
116
116
|
font-size: 18px;
|
|
117
117
|
font-weight: 1000;
|
|
118
118
|
line-height: 1;
|