"use strict";(self.webpackChunkOllana=self.webpackChunkOllana||[]).push([[961],{79961:(e,t,a)=>{a.r(t),a.d(t,{default:()=>k});var l=a(49963),s=a(2262),n=a(66252),o=a(3577),r=a(45383),i=a(43663),d=a(64220),u=a(18679),c=a(45209),y=a(73738),p=a(23732),g=a(47421),f=a(85523),h=a(64747);const m={key:0,class:"absolute bottom-0 left-0 z-10 flex h-6 w-full items-center px-2 text-xs text-gray-300"},v=(0,n._)("div",{class:"grow"},null,-1),k={__name:"SharedCodemirror",props:{lang:{type:String,default:"javascript"},modelValue:{type:String,default:""},readonly:{type:Boolean,default:!1},lineNumbers:{type:Boolean,default:!0},extensions:{type:[Object,Array],default:()=>[]},hideLang:Boolean},emits:["change","update:modelValue"],setup(e,{emit:t}){(0,l.useCssVars)((e=>({"39801a39":(0,s.SU)(h.h).whiteSpace})));const a=e,k=t;let x=null;const b={json:c.AV,javascript:u.eJ,html:d.dy,css:i.iv},S=(0,s.iH)(null),w=g.tk.updateListener.of((e=>{if(e.docChanged){e.state.sliceDoc(0,20);const t=e.state.doc.toString();k("change",t),k("update:modelValue",t)}})),V=Array.isArray(a.extensions)?a.extensions:[a.extensions],C=y.yy.create({doc:a.modelValue,extensions:[p.vk,f.Xy,w,b[a.lang]?.(),y.yy.tabSize.of(2),g.$f.of([r.oc]),y.yy.readOnly.of(a.readonly),...V]});return(0,n.YP)((()=>a.modelValue),(e=>{e!==x.state.doc.toString()&&x.dispatch({changes:{from:0,to:x.state.doc.length,insert:e}})})),(0,n.bv)((()=>{x=new g.tk({state:C,parent:S.value})})),(0,n.Jd)((()=>{x?.destroy()})),(t,a)=>((0,n.wg)(),(0,n.iD)("div",{ref_key:"containerEl",ref:S,class:(0,o.normalizeClass)([{"hide-gutters":!e.lineNumbers},"codemirror relative rounded-lg"])},[e.hideLang?(0,n.kq)("",!0):((0,n.wg)(),(0,n.iD)("div",m,[v,(0,n._)("span",null,(0,o.toDisplayString)(e.lang),1)]))],2))}}}}]);