import{x as B,y as D,E as T,w as j,L}from"./element-plus.8e273e86.js";import{f as r,b as N}from"./index.2078eb25.js";import{u as U}from"./vue-clipboard3.e775fc74.js";import{d as $,r as F,b as R,af as S,o as u,c as d,U as t,L as a,u as m,j as i,T as K,a9 as P,K as q,a as p,R as z}from"./@vue.76ce7aa3.js";const A={class:"code-preview"},G={class:"flex",style:{height:"50vh"}},Q=$({__name:"code-preview",props:{modelValue:{type:Boolean},code:{}},emits:["update:modelValue"],setup(_,{emit:f}){const b=_,V=f,{toClipboard:g}=U(),n=F("index0"),h=async l=>{try{await g(l),r.msgSuccess("\u590D\u5236\u6210\u529F")}catch{r.msgError("\u590D\u5236\u5931\u8D25")}},s=R({get(){return b.modelValue},set(l){V("update:modelValue",l)}});return(l,e)=>{const v=S("highlightjs"),y=T,C=N,E=j,k=B,x=D,w=L;return u(),d("div",A,[t(w,{modelValue:m(s),"onUpdate:modelValue":e[1]||(e[1]=o=>i(s)?s.value=o:null),width:"900px",title:"\u4EE3\u7801\u9884\u89C8"},{default:a(()=>[t(x,{modelValue:m(n),"onUpdate:modelValue":e[0]||(e[0]=o=>i(n)?n.value=o:null)},{default:a(()=>[(u(!0),d(K,null,P(l.code,(o,c)=>(u(),q(k,{label:o.name,name:`index${c}`,key:c},{default:a(()=>[p("div",G,[t(y,{class:"flex-1"},{default:a(()=>[t(v,{autodetect:"",code:o.content},null,8,["code"])]),_:2},1024),p("div",null,[t(E,{onClick:H=>h(o.content),type:"primary",link:""},{icon:a(()=>[t(C,{name:"el-icon-CopyDocument"})]),default:a(()=>[e[2]||(e[2]=z(" \u590D\u5236 "))]),_:2},1032,["onClick"])])])]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])])}}});export{Q as _};
