import{Ct as e,E as t,Mt as n,W as r,Y as i,_ as a,c as o,ct as s,d as c,dt as l,g as u,h as d,m as f,tn as p,v as m,w as h}from"./vendor/json-editor-vue-ddj4xtqm.js";import"./vendor/shiki-kunkft64.js";import{Gt as g,_,k as v,r as y}from"#entry";import{t as b}from"./nselect-cmll6q59.js";import{t as x}from"./nswitch-gqy4bgn3.js";import{t as S}from"./ndropdown-ef0253xr.js";import"./client-cbmkjf3j.js";import{t as C}from"./ncode-block-j2hcqwrp.js";import{t as w}from"./ndrawer-lh0r2gbb.js";import{n as T,t as E}from"./vendor/quicktype-core-f78dz8oi.js";var D=E(),O=T(),k={border:`b base`,flex:`~ items-center gap-2`,sticky:``,"left-0":``,"right-0":``,"top-0":``,"z-1":``,"bg-base":``,p3:``},A={key:0,flex:`~ items-center justify-center`,absolute:``,"bottom--1":``,"right--2":``,"h-4":``,"w-4":``,"rounded-full":``,"bg-lime:30":``,"text-8px":``},j={flex:`~ col`,"w-100":``,"of-auto":``,py2:``},M={"text-xs":``,capitalize:``,op75:``},N=t({__name:`DataSchemaDrawer`,setup(t){let T=y(),E=e(0),N=e(`TypeScript`),P=f(()=>O.all.find(e=>e.displayName===N.value)),F=e(P.value?.optionDefinitions.filter(e=>typeof e.defaultValue==`boolean`)),I=g(async()=>{if(E.value,!T.value)return``;let e=(0,D.jsonInputForTargetLanguage)(N.value);await e.addSource({name:T.value.name??`Data`,samples:[T.value.input]});let t=new D.InputData;return t.addInput(e),(await(0,D.quicktype)({inputData:t,lang:N.value,rendererOptions:F.value?.reduce((e,t)=>(e[t.name]=t.defaultValue,e),{})})).lines.join(`
`)}),L=f(()=>{let e=N.value.toLocaleLowerCase();return e.startsWith(`javascript`)?`javascript`:e.startsWith(`json`)?`json`:e.startsWith(`typescript`)?`typescript`:e});s(F,()=>{E.value++},{deep:!0}),s(N,()=>{F.value=P.value?.optionDefinitions.filter(e=>typeof e.defaultValue==`boolean`)});let R=_();function z(){R(I.value||``)}return(e,t)=>{let s=b,f=v,g=x,_=S,y=C,E=w;return P.value?(r(),u(c,{key:0,to:`body`},[h(E,{"model-value":!!n(T)?.input,"auto-close":``,"max-w-screen":``,"w-2xl":``,"n-code-block":``,onClose:t[2]||=e=>T.value=null},{default:l(()=>[d(`div`,k,[t[3]||=d(`p`,{"mr-2":``},` Schema `,-1),h(s,{modelValue:N.value,"onUpdate:modelValue":t[0]||=e=>N.value=e,n:`xs primary`},{default:l(()=>[(r(!0),m(o,null,i(n(O.all),e=>(r(),m(`option`,{key:e.displayName},p(e.displayName),1))),128))]),_:1},8,[`modelValue`]),F.value?.length?(r(),u(_,{key:0,n:`sm lime`},{trigger:l(({click:e})=>[h(f,{icon:`carbon-settings`,"h-full":``,onClick:t=>e()},null,8,[`onClick`]),F.value?(r(),m(`span`,A,p(F.value.length),1)):a(``,!0)]),default:l(()=>[d(`div`,j,[(r(!0),m(o,null,i(F.value,(e,t)=>(r(),u(g,{key:e.name,modelValue:F.value[t].defaultValue,"onUpdate:modelValue":e=>F.value[t].defaultValue=e,flex:`~ gap-2`,rounded:``,px2:``,py2:``},{default:l(()=>[d(`span`,M,p(e.description),1)]),_:2},1032,[`modelValue`,`onUpdate:modelValue`]))),128))])]),_:1})):a(``,!0),t[4]||=d(`div`,{"flex-auto":``},null,-1),h(f,{icon:`carbon-copy`,"mr-6":``,"h-full":``,onClick:t[1]||=e=>z()})]),n(I)?(r(),u(y,{key:0,lang:L.value,code:n(I)},null,8,[`lang`,`code`])):a(``,!0)]),_:1},8,[`model-value`])])):a(``,!0)}}}),P=Object.assign(N,{__name:`DataSchemaDrawer`});export{P as default};