import{d as h,a as k,R as y,c as d,m as c,x as I,e as n,f as o,s as w,F as O,k as L,J as x,z as p,g as R,w as T,E as b,T as v}from"./vue.BxlDVA1H.js";import{J as B}from"./index.lP_uh0LI.js";const E={class:"layout-padding layout-padding-unset layout-iframe"},P={class:"layout-padding-auto layout-padding-view"},S=["src","data-url"],V=h({name:"layoutIframeView"}),F=h({...V,props:{refreshKey:{type:String,default:()=>""},name:{type:String,default:()=>"slide-right"},list:{type:Array,default:()=>[]}},setup(f){const i=f,l=k(),r=y(),g=d(()=>i.list.filter(e=>{var t,s,a;if((t=e.meta)!=null&&t.isIframeOpen){const m=((s=e.meta)==null?void 0:s.isLink)||"";m.includes("{{token}}")&&(e.meta.isLink=m.replace("{{token}}",B.cookie.get("token")))}return(a=e.meta)==null?void 0:a.isIframeOpen})),_=d(()=>r.path),u=(e,t)=>{x(()=>{if(!l.value)return!1;l.value.forEach(s=>{s.dataset.url===e&&(s.onload=()=>{var a;(a=t.meta)!=null&&a.isIframeOpen&&t.meta.loading&&(t.meta.loading=!1)})})})};return c(()=>r.fullPath,e=>{const t=i.list.find(s=>s.path===e);if(!t)return!1;t.meta.isIframeOpen||(t.meta.isIframeOpen=!0),u(e,t)},{immediate:!0}),c(()=>i.refreshKey,()=>{const e=i.list.find(t=>t.path===r.path);if(!e)return!1;e.meta.isIframeOpen&&(e.meta.isIframeOpen=!1),setTimeout(()=>{e.meta.isIframeOpen=!0,e.meta.loading=!0,u(r.fullPath,e)})},{deep:!0}),(e,t)=>{const s=I("loading");return o(),n("div",E,[w("div",P,[(o(!0),n(O,null,L(g.value,a=>p((o(),n("div",{class:"w100",key:a.path,"element-loading-background":"white"},[R(v,{name:f.name,mode:"out-in"},{default:T(()=>[p((o(),n("iframe",{src:a.meta.isLink,key:a.path,frameborder:"0",height:"100%",width:"100%",style:{position:"absolute"},"data-url":a.path,ref_for:!0,ref_key:"iframeRef",ref:l},null,8,S)),[[b,_.value===a.path]])]),_:2},1032,["name"])])),[[s,a.meta.loading]])),128))])])}}});export{F as default};
