import{J as A,E as d}from"./index-B5qe6yln.js";import{c as m}from"./useCompMetaLocalStore-eE-CBcE9.js";import{aD as g}from"./vendor-ui-DXwyveTF.js";import{u as O}from"./useVscodeOpen-Dx3IRL0P.js";import{v as h,aF as C,aM as w,ab as k,l as D,i as N,ax as v,g as B}from"./vendor-core-CzvSW5ae.js";import{c as F,b as G,I as o,a as W,e as b}from"./useMessage-CYVXvlqq.js";const $={class:"size-full"},x=["src"],J=h({__name:"index",props:{compType:{},version:{},compAttrs:{},iuid:{}},setup(f){const s=f,u=A(),n=F(!1,window.__GLOBAL_CONFIG__.subPort),{instanceUid:I,messageListener:T,sendMessageToTargetIframe:l}=b(),{addListener:i}=T(),{createIframeParams:E}=G(),{openCompPathInVscode:S,handlePath:L}=O(),P=g().value,p=C("iframe"),M=(()=>{const e={topOrigin:window.location.origin,userId:u.userId??"",instanceUid:[I.value,s.iuid].join(",")??"",compId:s.compAttrs?._id??"",isSfc:!0},t={params:E(e),isDark:P.toString()},a=new URLSearchParams(t).toString();return`${n}/${d.WEBSITE_PATH_ITEM}/${s.compType}?${a}`})();async function _(){const e=p.value?.contentWindow;if(e){const t=m(s.compAttrs?._id)(),{dep:a,depToFile:r}=t,c={item:s.compAttrs,dep:a,depToFile:r};l(e,o.ITEM_INIT_SET_LOCAL,c,n)}}return i(o.ITEM_INIT_GET_LOCAL,()=>{_()}),i(o.ITEM_SITE_PATH_GET,e=>{const t=m(e)(),{stopWatch:a,triggerCallback:r}=W(B(()=>t.detail.fullPath),()=>{const c=p.value?.contentWindow;c?l(c,o.ITEM_SITE_PATH_SET,L(t.detail.fullPath,1),n):a()});r(e)}),i(o.ACTION_OPEN_VSCODE_LOCAL,e=>{const a=m(e)().detail.fullPath;S(a,`./${d.COMP_CONFIG_FILENAME}`)}),w(()=>s.compAttrs,e=>{e&&_()}),(e,t)=>(k(),D("div",$,[N("iframe",{ref:"iframe",class:"size-full",src:v(M),frameborder:"0"},null,8,x)]))}});export{J as _};
