"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("vue"),c={class:"iframe-webscoket"},i=["src"],d=o.defineComponent({name:"zv-scene-ue-shj"}),S=o.defineComponent({...d,props:{basicOption:{},sources:{},useEvents:{},uuid:{},isPreview:{type:Boolean}},emits:["on-message"],setup(s,{emit:r}){const n=s,a=r;return(t=>{o.onMounted(()=>{if(t.webSocketUrl)try{window.SHJSceneUEIframeWebscoket&&(window.SHJSceneUEIframeWebscoket.close(),window.SHJSceneUEIframeWebscoket=null),window.SHJSceneUEIframeWebscoket=new WebSocket(t.webSocketUrl),window.SHJSceneUEIframeWebscoket.onmessage=e=>{try{if(JSON.parse(e.data).type&&JSON.parse(e.data).type==="ping")return;if(!JSON.parse(e.data).data)throw new Error("");a("on-message",JSON.parse(e.data).data),window.SHJParseEvent(n.useEvents,"on-message",JSON.parse(e.data).data)}catch{}},window.SHJSceneUEIframeWebscoket.onopen=()=>{},window.SHJSceneUEIframeWebscoket.onerror=()=>{}}catch{}}),o.onBeforeUnmount(()=>{window.SHJSceneUEIframeWebscoket&&window.SHJSceneUEIframeWebscoket.close()})})(n.basicOption),(t,e)=>(o.openBlock(),o.createElementBlock("div",c,[o.createElementVNode("iframe",{src:t.basicOption.iframeUrl,sandbox:"allow-scripts allow-same-origin",style:{width:"100%",height:"100%",border:"0"}},null,8,i)]))}});exports.default=S;
