import*as e from"@wordpress/interactivity";const t=e,a=t.withSyncEvent??(e=>e);!function(){const{actions:e}=(0,t.store)("activitypub/following",{state:{get paginationText(){const{page:e,pages:a}=(0,t.getContext)();return`${e} / ${a}`},get disablePreviousLink(){const{page:e}=(0,t.getContext)();return e<=1},get disableNextLink(){const{page:e,pages:a}=(0,t.getContext)();return e>=a}},actions:{async fetchItems(){const e=(0,t.getContext)(),{userId:a,page:n,perPage:r,order:o,endpoint:s}=e,{apiFetch:g,url:i}=window.wp;e.isLoading=!0;try{const{namespace:c}=(0,t.getConfig)(),p=i.addQueryArgs(`/${c}/actors/${a}/${s}`,{context:"full",per_page:r,order:o,page:n}),{orderedItems:l,totalItems:d}=await g({path:p});e.items=l.map(e=>({handle:"@"+e.webfinger,icon:e.icon,name:e.name||e.preferredUsername,url:e.url||e.id})),e.total=d,e.pages=Math.ceil(d/r)}catch(e){console.error(`Error fetching ${s}:`,e)}finally{e.isLoading=!1}},previousPage:a(a=>{a.preventDefault();const n=(0,t.getContext)();n.page>1&&(n.page--,e.fetchItems())}),nextPage:a(a=>{a.preventDefault();const n=(0,t.getContext)();n.page