import{y as B,S as C,e as _}from"./co7as50x.js";import{k as M,j as b,x as N,c as j,ae as O,Q as i,S as p,U as d,Y as u,u as a,a5 as k,W as m,V as R,a2 as $,a3 as z,a8 as D,M as g,F as E,a1 as P,av as x,n as A}from"./vendor/json-editor-vue-e8m4tbbs.js";const F=["open"],J={flex:"~ gap2","select-none":"","items-center":"",px4:""},U={key:0,class:"bg-red:10 px5 py3 text-red"},Y=M({__name:"StateEditor",props:{name:{},open:{type:Boolean},revision:{},state:{},readonly:{type:Boolean}},emits:["update:open"],setup(h,{emit:V}){const t=h,s=B(t,"open",V,{passive:!0}),S=C(),l=b(),c=b();function f(){c.value=void 0;try{t.state?l.value=JSON.parse(JSON.stringify(t.state||{})):(typeof t.state=="number"||typeof t.state!="string")&&(l.value=t.state)}catch(e){console.error(e),c.value=e}}N(()=>{f(),j(()=>[t.revision,t.state],e=>{typeof e!="number"&&typeof e!="string"?v(e,t.state):l.value=t.state},{deep:!0})});function v(e,r){const n=e[1];for(const o in n)Array.isArray(n[o])?r[o]=n[o].slice():typeof n[o]=="object"&&n[o]!==null?v(n[o],r[o]):r[o]=n[o]}async function w(){f(),await A()}return(e,r)=>{const n=_,o=O("tooltip");return i(),p("div",{class:"state-editor-details",open:e.name?a(s):!0},[d("div",J,[e.name?(i(),p("button",{key:0,flex:"~","cursor-pointer":"","items-center":"",class:u(a(s)?"":"op50"),onClick:r[0]||(r[0]=y=>s.value=!a(s))},[d("div",{"i-carbon-chevron-right":"",transition:"",class:u(a(s)?"rotate-90 op0":"")},null,2),d("code",{px3:"",py1:"","font-mono":"",class:u(a(s)?"bg-[#8881] rounded-t":"rounded hover:bg-active")},k(e.name),3)],2)):m("",!0),R(e.$slots,"actions",$(z({isOpen:a(s),name:e.name,state:e.state}))),a(s)?D((i(),g(n,{key:1,title:"Refresh View",icon:"carbon-renew",border:!1,onClick:w},null,512)),[[o,"Refresh View",void 0,{bottom:!0}]]):m("",!0)]),a(s)||!e.name?(i(),p(E,{key:0},[c.value?(i(),p("div",U," Error: "+k(c.value),1)):(i(),g(a(x),P({key:1,modelValue:l.value,"onUpdate:modelValue":r[1]||(r[1]=y=>l.value=y)},e.$attrs,{class:["json-editor-vue",[a(S)==="dark"?"jse-theme-dark":"",(e.name,"")]],"main-menu-bar":!1,"navigation-bar":!1,"status-bar":!1,"read-only":t.readonly,indentation:2,"tab-size":2}),null,16,["modelValue","class","read-only"]))],64)):m("",!0)],8,F)}}});export{Y as _};
