import{_ as b}from"./lee8zUTV.js";import{d as $,o as e,m as c,F as S,n as B,h as f,j as a,a8 as w,aw as F,k as h,ak as O,a as x,a0 as V,f as o,i as n,p as d,v as j,G as E,_ as G}from"./zEcrVex8.js";import{_ as P}from"./CtHtR2Xl.js";import{_ as R}from"./tPM_oRvF.js";import"./DzI09XCB.js";import"./BaYfQPWj.js";import"./3LqotSTl.js";import"./anMKTYBY.js";const A={key:0,flex:"~ col gap-1"},H={key:1,mt2:"",px4:"",italic:"",op35:""},K=$({__name:"StateGroup",props:{state:{},revision:{},prefix:{default:""}},setup(m){return(t,s)=>{const l=b;return e(),c("div",null,[t.state&&Object.keys(t.state).length>0?(e(),c("div",A,[(e(!0),c(S,null,B(t.state,(i,r)=>(e(),f(l,{key:r,revision:t.revision,state:i,name:r.startsWith(t.prefix)?r.slice(t.prefix.length):r},{actions:a(_=>[w(t.$slots,"actions",F({ref_for:!0},_))]),_:2},1032,["revision","state","name"]))),128))])):(e(),c("div",H," No data "))])}}}),T={class:"markdown-body"},L={__name:"payload",setup(m,{expose:t}){return t({frontmatter:{}}),(l,i)=>(e(),c("div",T,i[0]||(i[0]=[h("h1",null,"State & Async Data",-1),h("p",null,"// TODO",-1)])))}},W=L,q={key:0},tt=$({__name:"payload",setup(m){const t=O(),s=x(()=>t.value?.nuxt.payload),l=x(()=>t.value?.revision.value);async function i(r){await t.value?.nuxt.hooks.callHookParallel("app:data:refresh",r)}return(r,_)=>{const v=K,u=P,y=G,g=b,D=W,C=R,N=V("tooltip");return e(),c(S,null,[o(t)?(e(),c("div",q,[n(u,{icon:"carbon-data-set",text:"State",description:"Keyed state from `useState`",padding:!1},{default:a(()=>[n(v,{state:o(s).state,revision:o(l),prefix:"$s"},null,8,["state","revision"])]),_:1}),n(u,{icon:"carbon-data-blob",text:"Data",description:"Keyed state from `useAsyncData`",padding:!1},{actions:a(()=>[n(y,{n:"xs primary","self-start":"",icon:"i-carbon-recycle",onClick:_[0]||(_[0]=k=>i())},{default:a(()=>_[1]||(_[1]=[j(" Re-fetch all data ")])),_:1})]),default:a(()=>[n(v,{state:o(s).data,revision:o(l)},{actions:a(({isOpen:k,name:p})=>[k&&p?E((e(),f(y,{key:0,title:`Re-fetch '${p}'`,icon:"carbon-recycle",border:!1,onClick:z=>i([p])},null,8,["title","onClick"])),[[N,`Re-fetch '${p}'`,void 0,{bottom:!0}]]):d("",!0)]),_:1},8,["state","revision"])]),_:1}),o(s).functions&&Object.keys(o(s).functions).length?(e(),f(u,{key:0,icon:"carbon-function",text:"Functions",description:"State for functions"},{default:a(()=>[n(g,{"ml--6":"",state:o(s).functions,revision:o(l)},null,8,["state","revision"])]),_:1})):d("",!0)])):d("",!0),n(C,null,{default:a(()=>[n(D)]),_:1})],64)}}});export{tt as default};
