import{_ as h}from"./state-editor.vue-mhycrlv1.js";import{k as $,Q as e,S as i,F as x,ab as N,M as d,$ as a,V as B,a1 as V,U as k,l as b,ae as w,u as F,a0 as o,W as _,a6 as O,a8 as E}from"./vendor/json-editor-vue-e8m4tbbs.js";import{_ as P}from"./nsection-block-gb154p2g.js";import{Q as R,e as j}from"./co7as50x.js";import{_ as A}from"./help-fab.vue-bfsnw6i2.js";import"./nicon-title.vue-mo7ee5ag.js";import"./vendor/unocss-fbcdcfn2.js";import"./vendor/shiki-enrzjv18.js";const G={key:0,flex:"~ col gap-1"},H={key:1,mt2:"",px4:"",italic:"",op35:""},K=$({__name:"StateGroup",props:{state:{},revision:{},prefix:{default:""}},setup(f){return(t,n)=>{const c=h;return e(),i("div",null,[t.state&&Object.keys(t.state).length>0?(e(),i("div",G,[(e(!0),i(x,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 "))])}}}),Q={class:"markdown-body"},T={__name:"payload",setup(f,{expose:t}){return t({frontmatter:{}}),(c,s)=>(e(),i("div",Q,s[0]||(s[0]=[k("h1",null,"State & Async Data",-1),k("p",null,"// TODO",-1)])))}},W={key:0},Z=$({__name:"payload",setup(f){const t=R(),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=P,v=j,S=h,g=T,D=A,C=w("tooltip");return e(),i(x,null,[F(t)?(e(),i("div",W,[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]=[O(" Re-fetch all data ")])),_:1})]),default:a(()=>[o(m,{state:n.value.data,revision:c.value},{actions:a(({isOpen:y,name:u})=>[y&&u?E((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{Z as default};
