import{_ as g}from"./ncode-block.vue-bazndqbc.js";import{J as C,f as S}from"./h48l6b7a.js";import{l as w,k as x,m as N,w as B,R as a,U as n,V as s,F as d,ac as V,Z as i,a6 as $,a1 as u,a0 as m,a7 as v,u as T,N as h,X as r}from"./vendor/json-editor-vue-hrh84odz.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"},X=w({__name:"CodeSnippets",props:{codeSnippets:{},eventType:{}},setup(f){const l=f,e=x(l.codeSnippets[0]),_=C(),b=N(()=>e.value?.lang||"text");return B(()=>{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:i(t===e.value?"":"border-b"),onClick:R=>e.value=t},[s("div",{class:i(t===e.value?"":"op30"),"font-mono":""},$(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},[u(k,{code:e.value.code,lang:b.value,lines:!1,"w-full":"","of-auto":"",p3:""},null,8,["code","lang"]),s("div",L,[u(c,{icon:"carbon-copy",onClick:o[0]||(o[0]=t=>T(_)(e.value.code,p.eventType||`code-snippet-${e.value.name}`))},{default:m(()=>o[2]||(o[2]=[v(" Copy ")])),_:1}),e.value?.docs?(a(),h(c,{key:0,to:e.value.docs,target:"_blank",icon:"carbon-catalog"},{default:m(()=>o[3]||(o[3]=[v(" Docs ")])),_:1},8,["to"])):r("",!0)])],64)):r("",!0)])):r("",!0)}}});export{X as _};
