import{_ as x}from"./state-editor.vue-jjwoeqcv.js";import{p as b,P as i,a1 as e,F as $,ae as N,S as d,a2 as a,U as B,a4 as w,Q as h,q as k,ag as F,R as _,a3 as o,u as O,aa as P,a9 as R}from"./vendor/json-editor-vue-llkaejaf.js";import{_ as V}from"./nsection-block-n909in7j.js";import{f as E,_ as j}from"./m6q5jxyf.js";import{_ as A}from"./help-fab.vue-m3loez22.js";import"./data-schema-button.vue-htzfoue4.js";import"./nicon-title.vue-dsf9ygne.js";import"./vendor/unocss-mvzv9iuf.js";import"./vendor/shiki-kdj4mcqm.js";const G={key:0,flex:"~ col gap-1"},H={key:1,mt2:"",px4:"",italic:"",op35:""},K=b({__name:"StateGroup",props:{state:{},revision:{},prefix:{default:""}},setup(f){return(t,n)=>{const c=x;return e(),i("div",null,[t.state&&Object.keys(t.state).length>0?(e(),i("div",G,[(e(!0),i($,null,N(t.state,(s,r)=>(e(),d(c,{key:r,revision:t.revision,state:s,name:r.startsWith(t.prefix)?r.slice(t.prefix.length):r},{actions:a(l=>[B(t.$slots,"actions",w({ref_for:!0},l))]),_:2},1032,["revision","state","name"]))),128))])):(e(),i("div",H," No data "))])}}}),T={class:"markdown-body"},q={__name:"payload",setup(f,{expose:t}){return t({frontmatter:{}}),(c,s)=>(e(),i("div",T,s[0]||(s[0]=[h("h1",null,"State & Async Data",-1),h("p",null,"// TODO",-1)])))}},L={key:0},tt=b({__name:"payload",setup(f){const t=E(),n=k(()=>t.value?.nuxt.payload),c=k(()=>t.value?.revision.value);async function s(r){await t.value?.nuxt.hooks.callHookParallel("app:data:refresh",r)}return(r,l)=>{const m=K,p=V,v=j,S=x,g=q,D=A,C=F("tooltip");return e(),i($,null,[O(t)?(e(),i("div",L,[o(p,{icon:"carbon-data-set",text:"State",description:"Keyed state from `useState`",padding:!1},{default:a(()=>[o(m,{state:n.value.state,revision:c.value,prefix:"$s"},null,8,["state","revision"])]),_:1}),o(p,{icon:"carbon-data-blob",text:"Data",description:"Keyed state from `useAsyncData`",padding:!1},{actions:a(()=>[o(v,{n:"xs primary","self-start":"",icon:"i-carbon-recycle",onClick:l[0]||(l[0]=y=>s())},{default:a(()=>l[1]||(l[1]=[R(" Re-fetch all data ")])),_:1})]),default:a(()=>[o(m,{state:n.value.data,revision:c.value},{actions:a(({isOpen:y,name:u})=>[y&&u?P((e(),d(v,{key:0,title:`Re-fetch '${u}'`,icon:"carbon-recycle",border:!1,onClick:Q=>s([u])},null,8,["title","onClick"])),[[C,`Re-fetch '${u}'`,void 0,{bottom:!0}]]):_("",!0)]),_:1},8,["state","revision"])]),_:1}),n.value.functions&&Object.keys(n.value.functions).length?(e(),d(p,{key:0,icon:"carbon-function",text:"Functions",description:"State for functions"},{default:a(()=>[o(S,{"ml--6":"",state:n.value.functions,revision:c.value},null,8,["state","revision"])]),_:1})):_("",!0)])):_("",!0),o(D,null,{default:a(()=>[o(g)]),_:1})],64)}}});export{tt as default};
