import{d as k,j as y}from"./icons-CbZw_MCi.js";import{d as p,o as l,c as s,p as B,q as n,b as g,a as h,t as C,B as M,F as w,ac as L,s as z,k as b}from"./index-p1BAR2Hc.js";import{_ as v}from"./_plugin-vue_export-helper-DlAUqK2U.js";const E=p({__name:"MediaLoadingState",props:{failed:{type:Boolean,default:!1},compact:{type:Boolean,default:!1},label:{default:"媒体加载中"},errorLabel:{default:"媒体加载失败"}},setup(e){return(c,f)=>(l(),s("div",{class:B(["media-loading-state",{failed:e.failed,compact:e.compact}])},[e.failed?(l(),n(g(k),{key:0,size:24,"stroke-width":1.7})):(l(),n(g(y),{key:1,class:"media-loading-spinner",size:26,"stroke-width":1.8})),h("span",null,C(e.failed?e.errorLabel:e.label),1)],2))}}),S=v(E,[["__scopeId","data-v-3e5d6686"]]),$=["src"],x=["src"],A=p({inheritAttrs:!1,__name:"LoadingMedia",props:{type:{},src:{},compact:{type:Boolean,default:!1},loadingLabel:{default:"媒体加载中"},errorLabel:{default:"媒体加载失败"}},emits:["load","loadeddata","error"],setup(e,{emit:c}){const f=e,d=c,r=b(!0),o=b(!1);M(()=>f.src,()=>{r.value=!0,o.value=!1},{immediate:!0});function m(a,t){r.value=!1,o.value=!1,d(t==="load"?"load":"loadeddata",a)}function u(a){r.value=!1,o.value=!0,d("error",a)}return(a,t)=>(l(),s(w,null,[e.type==="image"?(l(),s("img",L({key:0,class:"loading-media-element"},a.$attrs,{src:e.src,onLoad:t[0]||(t[0]=i=>m(i,"load")),onError:u}),null,16,$)):(l(),s("video",L({key:1,class:"loading-media-element"},a.$attrs,{src:e.src,onLoadeddata:t[1]||(t[1]=i=>m(i,"loadeddata")),onError:u}),null,16,x)),r.value||o.value?(l(),n(S,{key:2,failed:o.value,compact:e.compact,label:e.loadingLabel,"error-label":e.errorLabel},null,8,["failed","compact","label","error-label"])):z("",!0)],64))}}),V=v(A,[["__scopeId","data-v-33763ad1"]]);export{V as L,S as M};
