import{_ as g}from"./ncode-block.vue-lex5o4lv.js";import{a as C,_ as S}from"./f1cbvne4.js";import{p as x,n as w,q as B,w as N,I as n,S as r,a2 as a,R as s,F as d,af as V,a4 as i,U as $,u as T,a3 as u,aa as v,Y as m,a9 as h}from"./vendor/json-editor-vue-g7zhhq6q.js";const D={key:0,relative:"","n-code-block":""},E={flex:"~ wrap","w-full":""},F=["onClick"],L={flex:"~ gap-2",px3:"",pb3:"",n:"sm primary"},U=x({__name:"CodeSnippets",props:{codeSnippets:{},eventType:{}},setup(f){const l=f,e=w(l.codeSnippets[0]),_=C(),b=B(()=>e.value?.lang||"text");return N(()=>{l.codeSnippets.includes(e.value)||(e.value=l.codeSnippets[0])}),(p,o)=>{const k=g,c=S;return p.codeSnippets.length?(a(),n("div",D,[s("div",E,[(a(!0),n(d,null,V(p.codeSnippets,(t,y)=>(a(),n("button",{key:y,px4:"",py2:"",border:"r base",hover:"bg-active",class:m(t===e.value?"":"border-b"),onClick:R=>e.value=t},[s("div",{class:m(t===e.value?"":"op30"),"font-mono":""},h(t.name),3)],10,F))),128)),o[1]||(o[1]=s("div",{border:"b base","flex-auto":""},null,-1))]),e.value?(a(),n(d,{key:0},[i(k,{code:e.value.code,lang:b.value,lines:!1,"w-full":"","of-auto":"",p3:""},null,8,["code","lang"]),s("div",L,[i(c,{icon:"carbon-copy",onClick:o[0]||(o[0]=t=>T(_)(e.value.code,p.eventType||`code-snippet-${e.value.name}`))},{default:u(()=>o[2]||(o[2]=[v(" Copy ")])),_:1}),e.value?.docs?(a(),$(c,{key:0,to:e.value.docs,target:"_blank",icon:"carbon-catalog"},{default:u(()=>o[3]||(o[3]=[v(" Docs ")])),_:1},8,["to"])):r("",!0)])],64)):r("",!0)])):r("",!0)}}});export{U as _};
