import{B as e,Ot as t,_ as n,g as r,ot as i,pt as a,v as o,y as s}from"./vue.esm-bundler-DcNPjsgv.js";import{t as c}from"./copy-gf6ZBRHI.js";import{h as l,t as u}from"./js/plugin-main-js-file-B1a1bVnR.js";import{t as d}from"./useToast-CZEVnSNX.js";var f=l(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]);function p(){let e=d();async function t(t,n=`Copied to clipboard`){try{return await navigator.clipboard.writeText(t),e.success(n),!0}catch{try{let r=document.createElement(`textarea`);return r.value=t,r.style.position=`fixed`,r.style.opacity=`0`,document.body.appendChild(r),r.select(),document.execCommand(`copy`),document.body.removeChild(r),e.success(n),!0}catch{return e.error(`Failed to copy to clipboard`),!1}}}return{copy:t}}var m={class:`bmc-code`},h={key:0,class:`bmc-code__label`},g={class:`bmc-code__block`},_={class:`bmc-code__text`},v=u({__name:`CodeBlock`,props:{code:{type:String,required:!0},label:{type:String,default:``}},setup(l){let u=l,{copy:d}=p(),v=i(!1);async function y(){await d(u.code),v.value=!0,setTimeout(()=>{v.value=!1},2e3)}return(i,u)=>(e(),s(`div`,m,[l.label?(e(),s(`span`,h,t(l.label),1)):o(``,!0),r(`div`,g,[r(`code`,_,t(l.code),1),r(`button`,{class:`bmc-code__copy`,onClick:y,title:`Copy`},[v.value?(e(),n(a(f),{key:0,size:14})):(e(),n(a(c),{key:1,size:14}))])])]))}},[[`__scopeId`,`data-v-04de229c`]]);export{f as n,v as t};