import{b as w}from"./ViewLayoutSection.vue-jyo-hhqX.js";import{O as _,T as y,n as C,V as z,g as B}from"./ReferenceContentLoader-D7Cnl9bC.js";import{d as g,r as b,w as E,_ as I,j as m,o as s,i as o,b as u,n as c,h as f,q as p,p as l,bU as k,F as h}from"./index-BX34W763.js";import{A as V}from"./DocumentMobileHeader.vue-CXp3gXuT.js";import"./__vite-browser-external-D7Ct-6yo.js";const F={class:"flex h-full w-full flex-col gap-2 pt-8"},N={class:"flex min-h-8 items-center justify-between gap-2 pl-1.5"},j={class:"has-[:focus-visible]:bg-b-1 group relative z-1 flex flex-col rounded-lg"},U={class:"flex h-full min-h-[calc(1rem*4)] flex-col"},q={key:1,class:"text-c-3 flex h-full items-center justify-center rounded-lg border p-4"},A=g({__name:"MarkdownInput",props:{modelValue:{},environment:{},envVariables:{},workspace:{}},emits:["update:modelValue"],setup(x,{emit:n}){const d=n,t=b("preview"),r=b(null);E(t,a=>{a==="edit"&&I(()=>{r.value?.focus()})});const v=()=>{requestAnimationFrame(()=>{t.value="preview"})};return(a,e)=>(s(),m("div",F,[o("div",N,[e[5]||(e[5]=o("h3",{class:"font-bold"},"Description",-1)),t.value==="preview"?(s(),u(l(V),{key:0,class:"text-c-2 hover:text-c-1 flex items-center gap-2",size:"sm",type:"button",variant:"outlined",onClick:e[0]||(e[0]=i=>t.value="edit")},{default:f(()=>[p(l(k),{icon:"Pencil",size:"sm",thickness:"1.5"}),e[4]||(e[4]=o("span",null,"Edit",-1))]),_:1,__:[4]})):c("",!0)]),o("div",j,[o("div",U,[t.value==="preview"?(s(),m(h,{key:0},[a.modelValue&&a.modelValue.trim().length?(s(),m(h,{key:0},[a.modelValue?(s(),u(l(_),{key:0,class:"h-full flex-1 rounded border border-transparent p-1.5 hover:border-(--scalar-background-3)",value:a.modelValue,withImages:"",onDblclick:e[1]||(e[1]=i=>t.value="edit")},null,8,["value"])):c("",!0),e[6]||(e[6]=o("div",{class:"brightness-lifted bg-b-1 absolute inset-0 -z-1 hidden rounded group-hover:block group-has-[:focus-visible]:hidden"},null,-1))],64)):(s(),m("div",q,[p(l(V),{class:"hover:bg-b-2 hover:text-c-1 text-c-2 flex items-center gap-2",size:"sm",variant:"ghost",onClick:e[2]||(e[2]=i=>t.value="edit")},{default:f(()=>[p(l(k),{icon:"Pencil",size:"sm",thickness:"1.5"}),e[7]||(e[7]=o("span",null,"Write a description",-1))]),_:1,__:[7]})]))],64)):c("",!0),t.value==="edit"?(s(),u(y,{key:1,ref_key:"codeInputRef",ref:r,class:"h-full flex-1 border px-0.5 py-0",envVariables:a.envVariables,environment:a.environment,modelValue:a.modelValue,workspace:a.workspace,onBlur:v,"onUpdate:modelValue":e[3]||(e[3]=i=>d("update:modelValue",i))},null,8,["envVariables","environment","modelValue","workspace"])):c("",!0)])])]))}}),D=C(A,[["__scopeId","data-v-5997a667"]]),$=g({__name:"CollectionOverview",setup(x){const{activeCollection:n,activeEnvironment:d,activeEnvVariables:t,activeWorkspace:r}=z(),{collectionMutators:v}=B(),a=e=>{n.value&&v.edit(n.value.uid,"info.description",e)};return(e,i)=>(s(),u(w,null,{default:f(()=>[l(d)&&l(r)?(s(),u(D,{key:0,envVariables:l(t),environment:l(d),modelValue:l(n)?.info?.description??"",workspace:l(r),"onUpdate:modelValue":a},null,8,["envVariables","environment","modelValue","workspace"])):c("",!0)]),_:1}))}});export{$ as default};
