import{j as o}from"./client-By3tlFYA.js";import{r as n,u as _,a as C}from"./index-TEHZzOO_.js";import{H as D}from"./Helmet-BG0DmkIY.js";import{S}from"./block-fill-d1A1-8Di.js";import{a as v,g as B}from"./api-C8Dh2R2O.js";import{C as L}from"./column-KuFpKGtG.js";import{C as y}from"./column_header-BfYOMHar.js";import{aJ as E,J as T}from"./status_quoted-DnIkn1ll.js";import{u as H}from"./useSelectableClick-DfiwdSfn.js";import{M as k}from"./message-CVkQtbZv.js";import{S as N}from"./scrollable_list-fGUhH9wV.js";import"./short_number-C9zm8Jg6.js";import"./numbers-BLyy7tyF.js";import"./index-DiPYjm3h.js";import"./ready-DpOgoWSg.js";import"./scroll-BygYx8ga.js";import"./index-DkCxcZFY.js";import"./add-CxOAEcXl.js";import"./chevron_left-tY77j9LU.js";import"./unfold_more-Dg1Ay52N.js";import"./relative_timestamp-BOUL06oe.js";import"./index-DUY7J2K7.js";import"./skeleton-CwYXpOUk.js";import"./load_locale-D22EJFIq.js";import"./index-Bw18u8Yg.js";import"./scroll_context-eOIVBCKW.js";import"./schedule_idle_task-CDh0madc.js";import"./load_more-CmJ411l4.js";const g=async s=>{const e=await v().request({method:"GET",url:s!=null?s:"/api/v1/domain_blocks"});return{domains:e.data,links:B(e)}},w=({domain:s})=>{const e=H(),m=n.useCallback(()=>{e(E(s))},[e,s]);return o.jsxs("div",{className:"domain",children:[o.jsx("div",{className:"domain__domain-name",children:o.jsx("strong",{children:s})}),o.jsx("div",{className:"domain__buttons",children:o.jsx(T,{onClick:m,children:o.jsx(k,{id:"account.unblock_domain_short",defaultMessage:"Unblock"})})})]})},u=C({heading:{id:"column.domain_blocks",defaultMessage:"Blocked domains"}}),co=({multiColumn:s})=>{const e=_(),[m,c]=n.useState([]),[f,a]=n.useState(!1),[d,l]=n.useState(),x=!!d,h=n.useRef(null);n.useEffect(()=>{a(!0),g().then(({domains:t,links:p})=>{const i=p.refs.find(r=>r.rel==="next");return a(!1),c(t),l(i==null?void 0:i.uri),""}).catch(()=>{a(!1)})},[a,c,l]);const b=n.useCallback(()=>{a(!0),g(d).then(({domains:t,links:p})=>{const i=p.refs.find(r=>r.rel==="next");return a(!1),c(r=>[...r,...t]),l(i==null?void 0:i.uri),""}).catch(()=>{a(!1)})},[a,c,l,d]),j=n.useCallback(()=>{var t;(t=h.current)==null||t.scrollTop()},[]),M=o.jsx(k,{id:"empty_column.domain_blocks",defaultMessage:"There are no blocked domains yet."});return o.jsxs(L,{bindToDocument:!s,ref:h,label:e.formatMessage(u.heading),children:[o.jsx(y,{icon:"ban",iconComponent:S,title:e.formatMessage(u.heading),onClick:j,multiColumn:s,showBackButton:!0}),o.jsx(N,{scrollKey:"domain_blocks",onLoadMore:b,hasMore:x,isLoading:f,showLoading:f&&m.length===0,emptyMessage:M,trackScroll:!s,bindToDocument:!s,children:m.map(t=>o.jsx(w,{domain:t},t))}),o.jsxs(D,{children:[o.jsx("title",{children:e.formatMessage(u.heading)}),o.jsx("meta",{name:"robots",content:"noindex"})]})]})};export{co as default};
//# sourceMappingURL=domain_blocks-index-C5TnonJS.js.map
