import{_ as x}from"./Bn0Th_SW.js";import{d as $,o as e,m as r,F as b,n as B,h as f,j as a,aa as w,ay as F,k as S,am as O,a as k,a2 as V,f as o,i as n,p as u,v as j,I as E,_ as P}from"./CAAfHP_R.js";import{_ as R}from"./DrETHS_h.js";import{_ as A}from"./C90a2Mbv.js";import"./Cx373ZJy.js";import"./DROQPQ1U.js";import"./SV1FZgNA.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(m){return(t,s)=>{const c=x;return e(),r("div",null,[t.state&&Object.keys(t.state).length>0?(e(),r("div",G,[(e(!0),r(b,null,B(t.state,(l,i)=>(e(),f(c,{key:i,revision:t.revision,state:l,name:i.startsWith(t.prefix)?i.slice(t.prefix.length):i},{actions:a(_=>[w(t.$slots,"actions",F({ref_for:!0},_))]),_:2},1032,["revision","state","name"]))),128))])):(e(),r("div",H," No data "))])}}}),T={class:"markdown-body"},I=S("h1",null,"State & Async Data",-1),L=S("p",null,"// TODO",-1),W=[I,L],q={__name:"payload",setup(m,{expose:t}){return t({frontmatter:{}}),(c,l)=>(e(),r("div",T,W))}},z=q,J={key:0},ot=$({__name:"payload",setup(m){const t=O(),s=k(()=>t.value?.nuxt.payload),c=k(()=>t.value?.revision.value);async function l(i){await t.value?.nuxt.hooks.callHookParallel("app:data:refresh",i)}return(i,_)=>{const v=K,d=R,h=P,g=x,D=z,C=A,N=V("tooltip");return e(),r(b,null,[o(t)?(e(),r("div",J,[n(d,{icon:"carbon-data-set",text:"State",description:"Keyed state from `useState`",padding:!1},{default:a(()=>[n(v,{state:o(s).state,revision:o(c),prefix:"$s"},null,8,["state","revision"])]),_:1}),n(d,{icon:"carbon-data-blob",text:"Data",description:"Keyed state from `useAsyncData`",padding:!1},{actions:a(()=>[n(h,{n:"xs primary","self-start":"",icon:"i-carbon-recycle",onClick:_[0]||(_[0]=y=>l())},{default:a(()=>[j(" Re-fetch all data ")]),_:1})]),default:a(()=>[n(v,{state:o(s).data,revision:o(c)},{actions:a(({isOpen:y,name:p})=>[y&&p?E((e(),f(h,{key:0,title:`Re-fetch '${p}'`,icon:"carbon-recycle",border:!1,onClick:M=>l([p])},null,8,["title","onClick"])),[[N,`Re-fetch '${p}'`,void 0,{bottom:!0}]]):u("",!0)]),_:1},8,["state","revision"])]),_:1}),o(s).functions&&Object.keys(o(s).functions).length?(e(),f(d,{key:0,icon:"carbon-function",text:"Functions",description:"State for functions"},{default:a(()=>[n(g,{"ml--6":"",state:o(s).functions,revision:o(c)},null,8,["state","revision"])]),_:1})):u("",!0)])):u("",!0),n(C,null,{default:a(()=>[n(D)]),_:1})],64)}}});export{ot as default};
