import{_ as g}from"./ncode-block.vue-bvtirmea.js";import{I as C,e as S}from"./er2hcepb.js";import{k as w,j as x,l as B,w as N,Q as a,S as n,U as s,F as d,ab as $,Y as i,a5 as V,a0 as u,$ as v,a6 as m,u as T,M as h,W as r}from"./vendor/json-editor-vue-gv8v06ez.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"},Q=w({__name:"CodeSnippets",props:{codeSnippets:{},eventType:{}},setup(f){const l=f,e=x(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,$(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:j=>e.value=t},[s("div",{class:i(t===e.value?"":"op30"),"font-mono":""},V(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:v(()=>o[2]||(o[2]=[m(" Copy ")])),_:1}),e.value?.docs?(a(),h(c,{key:0,to:e.value.docs,target:"_blank",icon:"carbon-catalog"},{default:v(()=>o[3]||(o[3]=[m(" Docs ")])),_:1},8,["to"])):r("",!0)])],64)):r("",!0)])):r("",!0)}}});export{Q as _};
