import{_ as g}from"./ncode-block.vue-ctkw4rc7.js";import{a as C,_ as S}from"./nfr71ycs.js";import{p as x,n as w,q as B,w as N,J as n,U as r,a3 as a,S as s,F as d,ag as V,a5 as i,V as $,u as T,a4 as u,ab as v,Z as m,aa as h}from"./vendor/json-editor-vue-m9gzt21j.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(_){const l=_,e=w(l.codeSnippets[0]),f=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:q=>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(f)(e.value.code,p.eventType||`code-snippet-${e.value.name}`))},{default:u(()=>o[2]||(o[2]=[v(" Copy ")])),_:1,__:[2]}),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,__:[3]},8,["to"])):r("",!0)])],64)):r("",!0)])):r("",!0)}}});export{U as _};
