import{_ as k}from"./state-editor.vue-j3haepux.js";import{p as x,I as i,a2 as e,F as $,af as N,U as d,a3 as a,V as B,a5 as V,R as h,q as b,ah as w,S as _,a4 as o,u as F,ab as O,aa as R}from"./vendor/json-editor-vue-g7zhhq6q.js";import{_ as E}from"./nsection-block-x8dothd4.js";import{f as P,_ as j}from"./f1cbvne4.js";import{_ as A}from"./help-fab.vue-gswykw6o.js";import"./data-schema-button.vue-oxz1jnzv.js";import"./nicon-title.vue-g35plvi8.js";import"./vendor/unocss-hvn0t0zz.js";import"./vendor/shiki-hjqm7vcp.js";const G={key:0,flex:"~ col gap-1"},H={key:1,mt2:"",px4:"",italic:"",op35:""},K=x({__name:"StateGroup",props:{state:{},revision:{},prefix:{default:""}},setup(f){return(t,n)=>{const c=k;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",V({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)])))}},I={key:0},tt=x({__name:"payload",setup(f){const t=P(),n=b(()=>t.value?.nuxt.payload),c=b(()=>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=E,v=j,S=k,g=q,D=A,C=w("tooltip");return e(),i($,null,[F(t)?(e(),i("div",I,[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?O((e(),d(v,{key:0,title:`Re-fetch '${u}'`,icon:"carbon-recycle",border:!1,onClick:L=>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};
