(0,s.__)("<span>←</span> Less","activitypub"),{span:(0,c.createElement)("span",{className:"wp-block-query-pagination-previous-arrow is-arrow-arrow","aria-hidden":"true"})}),O=(0,o.createInterpolateElement)(/* translators: arrow for next followers link *//* translators: arrow for next followers link */
(0,s.__)("More <span>→</span>","activitypub"),{span:(0,c.createElement)("span",{className:"wp-block-query-pagination-next-arrow is-arrow-arrow","aria-hidden":"true"})}),P=(e,a)=>{b(e),x(a),h(Math.ceil(a/t))};return(0,c.useEffect)((()=>{if(d&&1===N)returnP(d.followers,d.total);conste=function(e,t,a,r){constn=`/${g}/actors/${e}/followers`,l={per_page:t,order:a,page:r,context:"full"};return(0,v.addQueryArgs)(n,l)}(w,t,a,N);u()({path:e}).then((e=>P(e.orderedItems,e.totalItems))).catch((()=>{}))}),[w,t,a,N,d]),(0,c.createElement)("div",{className:"activitypub-follower-block "+i},(0,c.createElement)("h3",null,r),(0,c.createElement)("ul",null,f&&f.map((e=>(0,c.createElement)("li",{key:e.url},(0,c.createElement)(_,{...e,followLinks:p}))))),y>1&&(0,c.createElement)(m,{page:N,perPage:t,total:k,pageClick:S,nextLabel:O,prevLabel:C,compact:"is-style-compact"===i}))}function_({name:e,icon:t,url:a,preferredUsername:r,followLinks:n=!0}){consto=`@${r}`,i={};returnn||(i.onClick=e=>e.preventDefault()),(0,c.createElement)(l.ExternalLink,{className:"activitypub-link",href:a,title:o,...i},(0,c.createElement)("img",{width:"40",height:"40",src:t.url,className:"avatar activitypub-avatar",alt:e}),(0,c.createElement)("span",{className:"activitypub-actor"},(0,c.createElement)("strong",{className:"activitypub-name"},e),(0,c.createElement)("span",{className:"sep"},"/"),(0,c.createElement)("span",{className:"activitypub-handle"},o)))}consth=window.wp.data,k=window._activityPubOptions?.enabled;(0,e.registerBlockType)("activitypub/followers",{edit:function({attributes:e,setAttributes:t}){const{order:a,per_page:n,selectedUser:c,title:p}=e,u=(0,i.useBlockProps)(),[v,d]=(0,o.useState)(1),w=[{label:(0,s.__)("New to old","activitypub"),value:"desc"},{label:(0,s.__)("Old to new","activitypub"),value:"asc"}],f=function(){conste=k?.users?(0,h.useSelect)((e=>e("core").getUsers({who:"authors"}))):[];return(0,o.useMemo)((()=>{if(!e)return[];constt=k?.site?[{label:(0,s.__)("Whole Site","activitypub"),value:"site"}]:[];returne.reduce(((e,t)=>(e.push({label:t.name,value:`${t.id}`}),e)),t)}),[e])}(),b=e=>a=>{d(1),t({[e]:a})};return(0,o.useEffect)((()=>{f.length&&(f.find((({value:e})=>e===c))||t({selectedUser:f[0].value}))}),[c,f]),(0,r.jsxs)("div",{...u,children:[(0,r.jsx)(i.InspectorControls,{children:(0,r.jsxs)(l.PanelBody,{title:(0,s.__)("Followers Options","activitypub"),children:[(0,r.jsx)(l.TextControl,{label:(0,s.__)("Title","activitypub"),help:(0,s.__)("Title to display above the list of followers. Blank for none.","activitypub"),value:p,onChange:e=>t({title:e})}),f.length>1&&(0,r.jsx)(l.SelectControl,{label:(0,s.__)("Select User","activitypub"),value:c,options:f,onChange:b("selectedUser")}),(0,r.jsx)(l.SelectControl,{label:(0,s.__)("Sort","activitypub"),value:a,options:w,onChange:b("order")}),(0,r.jsx)(l.RangeControl,{label:(0,s.__)("Number of Followers","activitypub"),value:n,onChange:b("per_page"),min:1,max:10})]})},"setting"),(0,r.jsx)(y,{...e,page:v,setPage:d,followLinks:!1})]})},save:()=>null,icon:n})})()})();