import{z as C,Q as N,f as S}from"./h48l6b7a.js";import{l as _,k as b,x as R,d as z,ae as M,R as i,U as d,V as u,Z as p,u as o,a6 as k,X as m,W as O,a3 as $,a4 as j,a9 as D,N as g,F as E,a2 as P,av as x,n as A}from"./vendor/json-editor-vue-hrh84odz.js";const F=["open"],J={flex:"~ gap2","select-none":"","items-center":"",px4:""},U={key:0,class:"bg-red:10 px5 py3 text-red"},X=_({__name:"StateEditor",props:{name:{},open:{type:Boolean},revision:{},state:{},readonly:{type:Boolean}},emits:["update:open"],setup(h,{emit:V}){const t=h,s=C(t,"open",V,{passive:!0}),w=N(),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}}R(()=>{f(),z(()=>[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 a in n)Array.isArray(n[a])?r[a]=n[a].slice():typeof n[a]=="object"&&n[a]!==null?v(n[a],r[a]):r[a]=n[a]}async function B(){f(),await A()}return(e,r)=>{const n=S,a=M("tooltip");return i(),d("div",{class:"state-editor-details",open:e.name?o(s):!0},[u("div",J,[e.name?(i(),d("button",{key:0,flex:"~","cursor-pointer":"","items-center":"",class:p(o(s)?"":"op50"),onClick:r[0]||(r[0]=y=>s.value=!o(s))},[u("div",{"i-carbon-chevron-right":"",transition:"",class:p(o(s)?"rotate-90 op0":"")},null,2),u("code",{px3:"",py1:"","font-mono":"",class:p(o(s)?"bg-[#8881] rounded-t":"rounded hover:bg-active")},k(e.name),3)],2)):m("",!0),O(e.$slots,"actions",$(j({isOpen:o(s),name:e.name,state:e.state}))),o(s)?D((i(),g(n,{key:1,title:"Refresh View",icon:"carbon-renew",border:!1,onClick:B},null,512)),[[a,"Refresh View",void 0,{bottom:!0}]]):m("",!0)]),o(s)||!e.name?(i(),d(E,{key:0},[c.value?(i(),d("div",U," Error: "+k(c.value),1)):(i(),g(o(x),P({key:1,modelValue:l.value,"onUpdate:modelValue":r[1]||(r[1]=y=>l.value=y)},e.$attrs,{class:["json-editor-vue",[o(w)==="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{X as _};
