import{d as y,u as w,a as x,r as v,t as Q,c as g,b as E,o as S,e as s,f as t,g as e,Q as n,_ as B,w as a,h as N,i as u,j as P,k as A,l as I,m as J,n as L}from"./index-DTMcTdxe.js";import{u as T}from"./CodeEditor-Bsg_ZLfA.js";const j={class:"border-2 code-editor"},q={class:"code-editor__actions"},z={class:"inline-block"},D={class:"inline-block"},O=y({__name:"CodeEditor",props:{modelValue:{},commands:{},onPaste:{type:Function}},emits:["update:modelValue"],setup(_,{emit:m}){const l=_,f=m,o=w(),i=x(),r=v(null),{copyContent:p,beautifyEditorValue:h,collapseAll:b,expandAll:k}=T(r,{initialValue:Q(l,"modelValue"),commands:l.commands,emit:f,onPaste:l.onPaste}),d=g(()=>{if(l.modelValue==="")return!0;try{return JSON.parse(l.modelValue),!0}catch{return!1}});return(C,c)=>(S(),E("div",j,[s("div",{ref_key:"editor",ref:r,class:"full-width full-height"},null,512),s("div",q,[s("div",z,[t(n,{disable:!d.value,round:"",flat:"",dense:"",icon:"unfold_more",title:e(o)("shared.code_editor.actions.expand_all.title"),onClick:e(k)},null,8,["disable","title","onClick"]),t(n,{disable:!d.value,round:"",flat:"",dense:"",icon:"unfold_less",title:e(o)("shared.code_editor.actions.collapse_all.title"),onClick:e(b)},null,8,["disable","title","onClick"]),t(B,{round:"",flat:"",dense:"","custom-handler":e(p)},null,8,["custom-handler"])]),s("div",D,[t(n,{icon:"settings",round:"",flat:"",dense:""},{default:a(()=>[t(N,{style:{"white-space":"nowrap"},dense:"",anchor:"bottom right",self:"top end"},{default:a(()=>[t(u,null,{default:a(()=>[t(n,{disable:!d.value,title:e(o)("shared.code_editor.actions.beautify.title"),color:"dark-grey",class:"full-width",onClick:e(h)},{default:a(()=>[t(A,{dense:"",name:"auto_fix_normal"}),P(" "+I(e(o)("shared.code_editor.actions.beautify.text")),1)]),_:1},8,["disable","title","onClick"])]),_:1}),t(J),t(u,{dense:"",class:"q-py-sm"},{default:a(()=>[t(L,{modelValue:e(i).wrapLines,"onUpdate:modelValue":c[0]||(c[0]=V=>e(i).wrapLines=V),size:"32px",dense:"",label:e(o)("shared.code_editor.actions.wrap_lines.label"),title:e(o)("shared.code_editor.actions.wrap_lines.title")},null,8,["modelValue","label","title"])]),_:1})]),_:1})]),_:1})])])]))}});export{O as default};
//# sourceMappingURL=CodeEditor-Drbdpgyd.js.map
