1import{o as e,r as t}from"./chunk-CMxvf4Kt.js";import{n,t as r}from"./jsx-runtime-SsSjplwM.js";import{a as i,c as a,s as o}from"./react-intl-Cop388b4.js";import{b as s,g as c,l,m as u}from"./prop-types-BTvjt2rf.js";import{$ as d,A as f,E as p,J as m,M as h,Q as g,g as _,k as v,nt as y,x as b}from"./poll-DnT1-M6z.js";import{Pi as ee,ki as x,v as te}from"./render-Ba_suDLt.js";import{c as S,i as C,l as w,n as T,o as E,s as D,u as O}from"./react-router-BzQH59UT.js";import{c as ne}from"./redux-toolkit.modern-DmA8smPH.js";import{B as re,D as k,E as ie,F as ae,G as oe,K as se,L as ce,M as le,N as ue,V as A,k as de,z as fe}from"./accounts_typed-CffUl1H7.js";import{n as pe,o as j,s as M}from"./typed_functions-CyAHd4bl.js";import{t as me}from"./helmet-DcyqcM0_.js";import{n as he}from"./short_number-Coj2vPT7.js";import{c as ge,cn as N,f as P,l as _e,u as ve}from"./status_quoted-BX5g4uQr.js";import{t as ye}from"./classnames-CYxIelk8.js";import{i as be}from"./skip_links-BkSMjxFC.js";import{n as xe,r as Se,t as Ce}from"./utils-B468qXuV.js";import{i as we,l as Te}from"./account-mCnsBq-t.js";import{n as F}from"./bundle_column_error-DfooFAwB.js";import{t as Ee}from"./add-COFszs2T.js";import{a as De}from"./columns_area-DtfxaZn0.js";import{n as Oe,t as ke}from"./keyboard_arrow_up-6cXawH9y.js";import{n as Ae}from"./lists-CJIJPAqs.js";import{t as I}from"./callout-C4mu3oXM.js";import{n as L,r as je,t as R}from"./components-iOVcExQv.js";import{t as Me}from"./formatted_date-BMWzXdl7.js";import{n as Ne}from"./form_field_wrapper-BtY2Opll.js";import{d as Pe,f as Fe,l as Ie,m as Le,n as Re,p as ze,r as Be,u as Ve}from"./form_fields-Bsi9s-nk.js";import{n as He}from"./text_input_field-KVGwzHsO.js";import{n as Ue,t as We}from"./useAccountId-BASP8_ZZ.js";import{t as Ge}from"./useSearchTags-Bd7q444C.js";import{n as Ke,t as qe}from"./help-GJnrcBCz.js";import{n as Je,t as Ye}from"./account_list_item-BbKQxyE-.js";import{t as Xe}from"./not_signed_in_indicator-DCvbcXhc.js";import{t as Ze}from"./useSearchAccounts-DgsdOexp.js";import{t as Qe}from"./useSearchParam-DfnQmRI5.js";import{t as $e}from"./visibility_off-C9BTUzvv.js";import{n as et}
1from"./revoke_collection_inclusion_modal-aM-V9Yx0.js";var z=e(n()),B=r(),tt=({visibleItems:e,truncatedItems:t,toggleButton:n,renderListItem:r})=>{let i=(0,z.useId)(),a=`${i}-desc`,[o,s]=(0,z.useState)(!1),c=(0,z.useCallback)(()=>{s(e=>!e)},[]),l=t.length>0,u=e.length+ +!!l,f=u+(o?t.length:0);return(0,B.jsxs)(B.Fragment,{children:[e.map((t,n)=>r({item:t,index:n,totalListLength:f,isLastElement:n===e.length-1&&!l})),l&&(0,B.jsx)(R,{"aria-posinset":u,"aria-setsize":f,"aria-labelledby":i,"aria-describedby":a,children:(0,B.jsx)(P,{icon:n.icon&&(0,B.jsx)(d,{id:`toggle-icon`,icon:n.icon}),sideContent:(0,B.jsx)(d,{id:`open-status`,icon:o?ke:Oe}),children:(0,B.jsx)(_e,{id:i,subtitleId:a,"aria-expanded":o,onClick:c,subtitle:n.subtitle,children:n.title})})}),o&&t.map((e,n)=>r({item:e,index:u+n+1,totalListLength:f,isLastElement:n===t.length-1}))]})},nt=e=>(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,height:24,viewBox:`0 -960 960 960`,width:24,...e,children:(0,B.jsx)(`path`,{d:`M480-160q-33 0-56.5-23.5T400-240q0-33 23.5-56.5T480-320q33 0 56.5 23.5T560-240q0 33-23.5 56.5T480-160Zm0-240q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm0-240q-33 0-56.5-23.5T400-720q0-33 23.5-56.5T480-800q33 0 56.5 23.5T560-720q0 33-23.5 56.5T480-640Z`})}),V={header:`_feat_collections__header`,heading:`_feat_collections__heading`,listHeader:`_feat_collections__listHeader`,subHeading:`_feat_collections__subHeading`,maxCollectionsError:`_feat_collections__maxCollectionsError`,error:`_feat_collections__error`},H=({onClick:e})=>(0,B.jsxs)(he,{to:`/collections/new`,className:`button button--compact`,onClick:e,children:[(0,B.jsx)(d,{id:`plus`,icon:Ee}),(0,B.jsx)(i,{...J.newCollection})]}),rt=()=>(0,B.jsx)(F,{image:null,className:V.error,message:(0,B.jsx)(i,{id:`collections.error_loading_collections`,defaultMessage:`There was an error when trying to load these collections.`})});function U(e){let t=j();return(0,z.useEffect)(()=>{e&&t(ue({accountId:e}))},[t,e]),M(t=>fe(t,e,`createdBy`))}var it=()=>{let e=Ue(),t=We(),n=h(t),{collections:r,status:a}=U(t),o=r.length<Y,s=t===e,c=s&&a===`idle`&&o;return a===`error`||!t?(0,B.jsx)(rt,{}):a===`loading`?(0,B.jsx)(y,{}):r.length===0?s?(0,B.jsx)(F,{title:(0,B.jsx)(i,{id:`empty_column.account_featured_self.showcase_accounts`,defaultMessage:`Showcase your favorite accounts`}),message:(0,B.jsx)(i,{id:`empty_column.account_featured_self.showcase_accounts_desc`,defaultMessage:`Collections are curated lists of accounts to help others discover more of the Fediverse.`}),children:(0,B.jsx)(H,{})}):(0,B.jsx)(F,{title:(0,B.jsx)(i,{id:`empty_column.collections`,defaultMessage:`{acct} has not created any collections yet.`,values:{acct:(0,B.jsx)(p,{variant:`simple`,account:n})}})}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:V.listHeader,children:[(0,B.jsx)(`h2`,{className:V.subHeading,children:(0,B.jsx)(i,{id:`collections.list.collections_with_count`,defaultMessage:`{count, plural, one {# Collection} other {# Collections}}`,values:{count:r.length}})}),c&&(0,B.jsx)(H,{})]}),(0,B.jsxs)(L,{children:[s&&!o&&(0,B.jsx)(X,{className:V.maxCollectionsError}),r.map((e,t)=>(0,B.jsx)(Pt,{withTimestamp:!0,withAuthorHandle:!1,collection:e,positionInList:t+1,listSize:r.length},e.id))]})]})},W={header:`_collections_detail__header`,titleWithMenu:`_collections_detail__titleWithMenu`,titleWrapper:`_collections_detail__titleWrapper`,name:`_collections_detail__name`,authorNote:`_collections_detail__authorNote`,description:`_collections_detail__description`,headerButtonWrapper:`_collections_detail__headerButtonWrapper`,iconButton:`_collections_detail__iconButton`,sensitiveScreen:`_collections_detail__sensitiveScreen`,subheadingWithSelect:`_collections_detail__subheadingWithSelect`,selectWrapper:`_collections_detail__selectWrapper`,select:`_collections_detail__select`,columnSubheading:`_collections_detail__columnSubheading`},at=o({empty:{id:`collections.accounts.empty_title`,defaultMessage:`This collection is empty`}}),ot=pe([e=>e.accounts,(e,t)=>e.collections.collections[t??``]?.items],(e,t)=>(t??[]).map(t=>({...t,account:t.account_id?e.get(t.account_id):null})));function st(e,t){if(!t||t===`date_added`)return e;let n=[...e];switch(t){case`alphabetical`:return n.sort((e,t)=>
1{let n=e.account?.display_name??``,r=t.account?.display_name??``;return n.localeCompare(r)});case`last_active`:return n.sort((e,t)=>{let n=e.account?.last_status_at??``,r=t.account?.last_status_at??``;return new Date(r).getTime()-new Date(n).getTime()});case`most_followers`:return n.sort((e,t)=>{let n=e.account?.followers_count??0;return(t.account?.followers_count??0)-n});default:return e}}var ct=({collection:e})=>{let t=a(),n=et(e),r=(0,z.useRef)(null),o=e.account_id===s,{account_id:c,id:l}=e,u=M(e=>e.relationships),d=M(e=>ot(e,l)),[f,p]=Qe(`sort`,`date_added`),m=(0,z.useCallback)(e=>{p(e.target.value)},[p]),h=st(d,f),{visibleAccounts:g,hiddenAccounts:_}=(0,z.useMemo)(()=>{let e=[],t=[];return h.forEach(n=>{let{account:r,account_id:i}=n;if(!o&&!r)return;let a=i?u.get(i):null;a?.blocking||a?.muting?t.push(n):e.push(n)}),{visibleAccounts:e,hiddenAccounts:t}},[h,o,u]),v=(0,z.useCallback)(({relationship:e,accountId:t})=>!s||!e?(0,B.jsx)(Je,{accountId:t}):c===s&&(e.following||e.requested)?null:t===s?(0,B.jsx)(N,{secondary:!0,compact:!0,onClick:n,children:(0,B.jsx)(i,{id:`collections.detail.revoke_inclusion`,defaultMessage:`Remove me`})}):(0,B.jsx)(Je,{accountId:t}),[c,n]),y=(0,z.useCallback)(({item:e,index:t,totalListLength:n,isLastElement:r})=>(0,B.jsx)(R,{"aria-posinset":t+1,"aria-setsize":n,children:(0,B.jsx)(Ye,{accountId:e.account_id,withBorder:!r,badge:e.state===`pending`?(0,B.jsx)(Te,{}):null,renderButton:v})},e.id),[v]);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:W.subheadingWithSelect,children:[(0,B.jsx)(`h3`,{className:W.columnSubheading,tabIndex:-1,ref:r,children:(0,B.jsx)(i,{id:`collections.account_count`,defaultMessage:`{count, plural, one {# account} other {# accounts}}`,values:{count:e.item_count}})}),(0,B.jsxs)(Re,{label:(0,B.jsx)(i,{id:`collections.sort_by`,defaultMessage:`Sort by:`}),value:f,onChange:m,inputPlacement:`inline-end`,className:W.select,wrapperClassName:W.selectWrapper,children:[(0,B.jsx)(`option`,{value:`alphabetical`,children:(0,B.jsx)(i,{id:`collections.sort_alphabetical`,defaultMessage:`Alphabetical`})}),(0,B.jsx)(`option`,{value:`last_active`,children:(0,B.jsx)(i,{id:`collections.sort_last_active`,defaultMessage:`Last active`})}),(0,B.jsx)(`option`,{value:`most_followers`,children:(0,B.jsx)(i,{id:`collections.sort_most_followers`,defaultMessage:`Most followers`})}),(0,B.jsx)(`option`,{value:`date_added`,children:(0,B.jsx)(i,{id:`collections.sort_date_added`,defaultMessage:`Date added`})})]})]}),(0,B.jsx)(L,{emptyMessage:t.formatMessage(at.empty),children:(0,B.jsx)(tt,{visibleItems:g,truncatedItems:_,toggleButton:{icon:$e,title:(0,B.jsx)(i,{id:`collections.hidden_accounts_link`,defaultMessage:`{count, plural, one {# hidden account} other {# hidden accounts}}`,values:{count:_.length}}),subtitle:(0,B.jsx)(i,{id:`collections.hidden_accounts_description`,defaultMessage:`Youâve blocked or muted {count, plural, one {this user} other {these users}}`,values:{count:_.length}})},renderListItem:y})})]})},lt=t({AuthorNote:()=>dt,CollectionDetailPage:()=>_t,PendingNote:()=>G}),ut=o({loading:{id:`collections.detail.loading`,defaultMessage:`Loading collectionâ¦`},share:{id:`collections.detail.share`,defaultMessage:`Share this collection`}}),dt=({id:e})=>{let t=h(e),n=v(t,l);if(!t)return null;let r=(0,B.jsx)(he,{to:`/@${t.acct}`,"data-hover-card-account":t.id,children:n});return(0,B.jsx)(`p`,{className:W.authorNote,children:(0,B.jsx)(i,{id:`collections.by_account`,defaultMessage:`by {account_handle}`,values:{account_handle:r}})})},ft=({currentUserCollectionItem:e,collection:t})=>{let n=h(t.account_id),r=et(t);return(0,B.jsx)(I,{icon:b,title:(0,B.jsx)(i,{id:`collections.detail.you_are_in_this_collection`,defaultMessage:`You're featured in this collection`}),primaryLabel:(0,B.jsx)(i,{id:`collections.detail.revoke_inclusion`,defaultMessage:`Remove me`}),onPrimary:r,children:(0,B.jsx)(i,{id:`collections.detail.author_added_you_on_date`,defaultMessage:`{author} added you on {date}`,values:{author:(0,B.jsx)(p,{account:n,variant:`simple`}),date:(0,B.jsx)(Me,{value:e.created_at,day:`2-digit`,month:`short`,year:`numeric`})}})})},G=()=>(0,B.jsx)(I,{variant:`subtle`,icon:qe,title:(0,B.jsx)(i,{id:`collections.pending_accounts.title`,defaultMessage:`Why am I seeing pending accounts?`}),children:(0,B.jsx)(i,{id:`collections.pending_accounts.message`,defaultMessage:`Accounts may appear as pen
1ding when weâre awaiting a response from the user or their server. Only you can see pending accounts.`})}),pt=({onReveal:e})=>(0,B.jsx)(I,{variant:`warning`,title:(0,B.jsx)(i,{id:`collections.detail.sensitive_content`,defaultMessage:`Sensitive content`}),primaryLabel:(0,B.jsx)(i,{id:`content_warning.show_short`,defaultMessage:`Show`}),onPrimary:e,className:W.sensitiveScreen,children:(0,B.jsx)(i,{id:`collections.detail.sensitive_note`,defaultMessage:`The description and accounts may not be suitable for all viewers.`})}),mt=({collection:e,withDescription:t,headingRef:n})=>{let r=a(),{name:i,description:o,tag:c,account_id:l,items:u}=e,d=j(),f=D(),p=l===s,m=u.find(e=>e.account_id===s),h=!p&&!!m,_=(0,z.useCallback)(()=>{d(x({modalType:`SHARE_COLLECTION`,modalProps:{collection:e}}))},[e,d]),v=S(),y=v.state?.newCollection;(0,z.useEffect)(()=>{y&&(f.replace(v.pathname),_())},[f,_,y,v.pathname]);let b=u.some(e=>e.state===`pending`);return(0,B.jsxs)(`header`,{className:W.header,children:[(0,B.jsxs)(`div`,{className:W.titleWithMenu,children:[(0,B.jsxs)(`div`,{className:W.titleWrapper,children:[c&&(0,B.jsx)(we,{label:`#${c.name}`,icon:null}),(0,B.jsx)(`h2`,{className:W.name,ref:n,tabIndex:-1,children:i}),(0,B.jsx)(dt,{id:l})]}),(0,B.jsxs)(`div`,{className:W.headerButtonWrapper,children:[(0,B.jsx)(g,{iconComponent:Ke,icon:`share-icon`,title:r.formatMessage(ut.share),className:W.iconButton,onClick:_}),(0,B.jsx)(Q,{context:`collection`,collection:e,className:W.iconButton})]})]}),t&&o&&(0,B.jsx)(`p`,{className:W.description,children:o}),b&&(0,B.jsx)(G,{}),h&&(0,B.jsx)(ft,{currentUserCollectionItem:m,collection:e})]})};function ht({sensitive:e}){let t=(0,z.useRef)(null),[n,r]=(0,z.useState)(!e);return{isContentVisible:n,revealContent:(0,z.useCallback)(()=>{r(!0),setTimeout(()=>{t.current?.focus()},0)},[t]),postRevealFocusTargetRef:t}}var gt=({collection:e})=>{let{isContentVisible:t,revealContent:n,postRevealFocusTargetRef:r}=ht({sensitive:e.sensitive&&e.account_id!==s});return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(mt,{collection:e,headingRef:r,withDescription:t}),t?(0,B.jsx)(ct,{collection:e}):(0,B.jsx)(pt,{onReveal:n})]})},_t=({multiColumn:e})=>{let t=a(),n=j(),{id:r}=w(),i=M(e=>r?e.collections.collections[r]:void 0);(0,z.useEffect)(()=>{r&&n(le({collectionId:r}))},[n,r]);let o=i?.name??t.formatMessage(ut.loading);return(0,B.jsxs)(be,{bindToDocument:!e,label:o,children:[(0,B.jsx)(De,{showBackButton:!0,title:o,icon:`collection-icon`,iconComponent:Ae,multiColumn:e}),(0,B.jsx)(je,{children:i?(0,B.jsx)(gt,{collection:i}):(0,B.jsx)(y,{})}),(0,B.jsxs)(me,{children:[(0,B.jsx)(`title`,{children:o}),(0,B.jsx)(`meta`,{name:`robots`,content:`noindex`})]})]})},K={header:`_collections_editor__header`,step:`_collections_editor__step`,title:`_collections_editor__title`,description:`_collections_editor__description`,listHeading:`_collections_editor__listHeading`,form:`_collections_editor__form`,stickyFooter:`_collections_editor__stickyFooter`,formFieldStack:`_collections_editor__formFieldStack`,accountList:`_collections_editor__accountList`,suggestion:`_collections_editor__suggestion`,suggestionGroup:`_collections_editor__suggestionGroup`,maxCollectionsError:`_collections_editor__maxCollectionsError`},q=({step:e,title:t})=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:K.step,children:(0,B.jsx)(i,{id:`collections.create.steps`,defaultMessage:`Step {step}/{total}`,values:{step:e,total:2}})}),(0,B.jsx)(`h2`,{className:K.title,children:t})]}),vt=({accountId:e,pending:t,onRemove:n})=>{let r=(0,z.useCallback)(()=>{n(e)},[e,n]),a=(0,z.useCallback)(()=>(0,B.jsx)(N,{compact:!0,secondary:!0,onClick:r,children:(0,B.jsx)(i,{id:`collections.remove_account`,defaultMessage:`Remove`})}),[r]);return(0,B.jsx)(Ye,{accountId:e,badge:t&&(0,B.jsx)(Te,{}),renderButton:a})},yt=({id:e})=>{let t=h(e),n=v(t,l),r=Pe();return t?(0,B.jsx)(`li`,{...r,className:K.suggestion,children:(0,B.jsx)(P,{icon:(0,B.jsx)(f,{account:t,size:40}),children:(0,B.jsx)(ve,{subtitle:n,children:(0,B.jsx)(p,{account:t,variant:`simple`})})})}):null},bt=e=>(0,B.jsx)(yt,{id:e.id});function xt(e,t){let{available:n,mustFollow:r,disabled:i}=Object.groupBy(e,e=>Ce(e)?`available`:xe(e)&&!t.get(e.id)?.following?`mustFollow`:`disabled`);return{available:n,mustFollow:r,disabled:i}}var St=(e,t)=>
1{if(e===`available`)return null;let n,r;return e===`mustFollow`?(n=(0,B.jsx)(i,{id:`collections.suggestions.must_follow`,defaultMessage:`Must follow first`}),r=(0,B.jsx)(i,{id:`collections.suggestions.must_follow_desc`,defaultMessage:`These accounts review all follow requests. Followers can add them to collections.`})):(n=(0,B.jsx)(i,{id:`collections.suggestions.can_not_add`,defaultMessage:`Canât be added`}),r=(0,B.jsx)(i,{id:`collections.suggestions.can_not_add_desc`,defaultMessage:`These accounts may have opted out of discovery, or they might be on a server that doesnât support collections.`})),(0,B.jsx)(`li`,{role:`presentation`,children:(0,B.jsx)(P,{className:K.suggestionGroup,children:(0,B.jsx)(ve,{id:t,subtitle:r,children:n})})})},Ct=e=>e.id,wt=e=>!Ce(e),Tt=({collection:e})=>{let t=a(),n=j(),r=D(),{id:o,items:s}=e??{},c=!!o,l=M(e=>e.collections.editor.items),u=(0,z.useMemo)(()=>c?ae(s):l,[c,s,l]),d=u.some(e=>e.state===`pending`),[f,p]=(0,z.useState)(``),m=u.length>0,h=u.length===25,g=(0,z.useCallback)(e=>!!u.find(t=>t.account_id===e.id),[u]),{accounts:_,isLoading:v,searchAccounts:y,resetAccounts:b}=Ze({withRelationships:!0,withDefaultFollows:f===``,filterResults:e=>!g(e)}),ee=xt(_,M(e=>e.relationships)),x=(0,z.useCallback)(e=>{p(e.target.value),y(e.target.value)},[y]),te=(0,z.useCallback)(e=>{e.key===`Enter`&&e.preventDefault()},[]),S=(0,z.useCallback)(e=>{n(A({field:`items`,value:u.filter(t=>t.account_id!==e)}))},[u,n]),C=(0,z.useCallback)(e=>{g(e)||n(A({field:`items`,value:[...u,{account_id:e.id,state:e.feature_approval.current_user===`manual`?`pending`:`accepted`}]}))},[u,g,n]),w=(0,z.useCallback)(e=>{let r=s?.find(t=>t.account_id===e)?.id;r&&o&&window.confirm(t.formatMessage({id:`collections.confirm_account_removal`,defaultMessage:`Are you sure you want to remove this account from this collection?`}))&&n(ce({collectionId:o,itemId:r}))},[s,n,o,t]),T=(0,z.useCallback)(e=>{o&&!g(e)&&n(ie({collectionId:o,accountId:e.id}))},[n,o,g]),E=(0,z.useCallback)(e=>{c?w(e):S(e)},[c,w,S]),O=(0,z.useCallback)(e=>{c?T(e):C(e),p(``),b()},[C,T,c,b]),ne=(0,z.useCallback)(e=>{e.preventDefault(),o||r.push(`/collections/new/details`)},[o,r]),re=(0,z.useId)(),k=o?`h2`:`h3`;return(0,B.jsxs)(`form`,{onSubmit:ne,className:K.form,children:[(0,B.jsxs)(Le,{className:K.formFieldStack,children:[(0,B.jsxs)(`header`,{className:K.header,children:[!o&&(0,B.jsx)(q,{step:1,title:(0,B.jsx)(i,{id:`collections.create.accounts_title`,defaultMessage:`Who will you feature in this collection?`})}),d&&(0,B.jsx)(G,{}),(0,B.jsx)(Ie,{openOnFocus:!0,id:re,label:t.formatMessage({id:`collections.search_accounts_label`,defaultMessage:`Search for an account to add`}),value:h?``:f,onChange:x,onKeyDown:te,disabled:h,isLoading:v,items:ee,getItemId:Ct,getIsItemDisabled:wt,renderItem:bt,renderGroupTitle:St,onSelectItem:O,status:h?{variant:`warning`,message:t.formatMessage({id:`collections.search_accounts_max_reached`,defaultMessage:`You have added the maximum number of accounts`})}:null})]}),(0,B.jsxs)(`div`,{children:[m&&(0,B.jsx)(k,{className:K.listHeading,children:(0,B.jsx)(i,{id:`collections.hints.accounts_counter`,defaultMessage:`{count}/{max} accounts`,values:{count:u.length,max:25}})}),(0,B.jsx)(L,{className:K.accountList,emptyMessage:(0,B.jsx)(F,{title:(0,B.jsx)(i,{id:`collections.accounts.empty_editor_title`,defaultMessage:`No one is in this collection yet`}),message:(0,B.jsx)(i,{id:`collections.accounts.empty_description`,defaultMessage:`Add up to {count} accounts`,values:{count:25}})}),children:u.map(({account_id:e,state:t},n)=>(0,B.jsx)(R,{"aria-posinset":n,"aria-setsize":u.length,children:(0,B.jsx)(vt,{accountId:e,pending:t===`pending`,onRemove:E})},e))})]})]}),!c&&m&&(0,B.jsx)(`div`,{className:K.stickyFooter,children:(0,B.jsx)(N,{type:`submit`,children:o?(0,B.jsx)(i,{id:`lists.save`,defaultMessage:`Save`}):(0,B.jsx)(i,{id:`collections.continue`,defaultMessage:`Continue`})})})]})},Et=()=>{let e=j(),t=D(),{id:n,name:r,description:a,topic:o,language:s,discoverable:c,sensitive:l,items:u}=M(e=>e.collections.editor),d=(0,z.useCallback)(t=>{e(A({field:`name`,value:t.target.value}))},[e]),f=(0,z.useCallback)(t=>{e(A({field:`description`,value:t.target.value}))},[e]),p=(0,z.useCallback)(t=>{e(A({field:`discoverable`,value:t.target.value===`public`}))},[e]),m=(0,z.useCallback)(t=>{e(A({field:`sensitive`,value:t.target.checked}))},[e]),{acct:g}=h(Ue())??{};return(0,B.jsxs)(`form`,{onSubmit:(0,z.useCallback)(i=>{if(i.preventDefault(),n)e(re({payload:{id:n,name:r,description:a,tag_name:o||null,language:s||null,discoverable:c,sensitive:l}})).then(()=>{t.goBack()});else{let n={name:r,description:a,discoverable:c,sensitive:l,account_ids:u.map(e=>e.account_id)};s&&(n.language=s),o&&(n.tag_name=o),e(de({payload:n})).then(e=>{ne(e)&&(t.replace(`/@${g}/collections`),t.push(Se(e.payload.collection.id),{newCollection:!0}
1))})}},[n,r,a,o,c,s,l,e,t,u,g]),className:K.form,children:[(0,B.jsxs)(Le,{className:K.formFieldStack,children:[!n&&(0,B.jsx)(q,{step:2,title:(0,B.jsx)(i,{id:`collections.create.basic_details_title`,defaultMessage:`Basic details`})}),(0,B.jsx)(He,{required:!0,label:(0,B.jsx)(i,{id:`collections.collection_name`,defaultMessage:`Name`}),hint:(0,B.jsx)(i,{id:`collections.name_length_hint`,defaultMessage:`40 characters limit`}),value:r,onChange:d,maxLength:40}),(0,B.jsx)(ze,{required:!1,label:(0,B.jsx)(i,{id:`collections.collection_description`,defaultMessage:`Description`}),hint:(0,B.jsx)(i,{id:`collections.description_length_hint`,defaultMessage:`100 characters limit`}),value:a,onChange:f,maxLength:100}),(0,B.jsx)(Dt,{}),(0,B.jsx)(kt,{}),(0,B.jsxs)(Ne,{legend:(0,B.jsx)(i,{id:`collections.visibility_title`,defaultMessage:`Visibility`}),children:[(0,B.jsx)(Be,{label:(0,B.jsx)(i,{id:`collections.visibility_public`,defaultMessage:`Public`}),hint:(0,B.jsx)(i,{id:`collections.visibility_public_hint`,defaultMessage:`Discoverable in search results and other areas where recommendations appear.`}),value:`public`,checked:c,onChange:p}),(0,B.jsx)(Be,{label:(0,B.jsx)(i,{id:`collections.visibility_unlisted`,defaultMessage:`Unlisted`}),hint:(0,B.jsx)(i,{id:`collections.visibility_unlisted_hint`,defaultMessage:`Visible to anyone with a link. Hidden from search results and recommendations.`}),value:`unlisted`,checked:!c,onChange:p})]}),(0,B.jsx)(Ne,{legend:(0,B.jsx)(i,{id:`collections.content_warning`,defaultMessage:`Content warning`}),children:(0,B.jsx)(Fe,{label:(0,B.jsx)(i,{id:`collections.mark_as_sensitive`,defaultMessage:`Mark as sensitive`}),hint:(0,B.jsx)(i,{id:`collections.mark_as_sensitive_hint`,defaultMessage:`Hides the collection's description and accounts behind a content warning. The collection name will still be visible.`}),checked:l,onChange:m})})]}),(0,B.jsx)(`div`,{className:K.stickyFooter,children:(0,B.jsx)(N,{type:`submit`,children:n?(0,B.jsx)(i,{id:`lists.save`,defaultMessage:`Save`}):(0,B.jsx)(i,{id:`collections.create_collection`,defaultMessage:`Create collection`})})})]})},Dt=()=>{let e=a(),t=j(),{topic:n}=M(e=>e.collections.editor),{tags:r,isLoading:o,searchTags:s}=Ge({query:n}),c=(0,z.useCallback)(e=>{t(A({field:`topic`,value:se(e.target.value)})),s(e.target.value)},[t,s]),l=(0,z.useCallback)(e=>{t(A({field:`topic`,value:se(e.name)}))},[t]),u=(0,z.useMemo)(()=>oe(n),[n]),d=r.length===1&&r[0]?.id===`new`,f=!r.length||d;return(0,B.jsx)(Ie,{required:!1,icon:null,label:(0,B.jsx)(i,{id:`collections.collection_topic`,defaultMessage:`Topic`}),hint:(0,B.jsx)(i,{id:`collections.topic_hint`,defaultMessage:`Add a hashtag that helps others understand the main topic of this collection.`}),value:n,items:r,isLoading:o,renderItem:Ot,onSelectItem:l,onChange:c,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`,maxLength:40,status:u?{variant:`warning`,message:e.formatMessage({id:`collections.topic_special_chars_hint`,defaultMessage:`Special characters will be removed when saving`})}:void 0,suppressMenu:f})},Ot=e=>(0,B.jsx)(Ve,{children:e.label??`#${e.name}`}),kt=()=>{let e=j(),{language:t}=M(e=>e.collections.editor),n=(0,z.useCallback)(t=>{e(A({field:`language`,value:t.target.value}))},[e]);return(0,B.jsxs)(Re,{label:(0,B.jsx)(i,{id:`collections.collection_language`,defaultMessage:`Language`}),value:t,onChange:n,children:[(0,B.jsx)(`option`,{value:``,children:(0,B.jsx)(i,{id:`collections.collection_language_none`,defaultMessage:`None`})}),c?.map(([e,t,n])=>(0,B.jsxs)(`option`,{value:e,children:[n,` (`,t,`)`]},e))]})},At=t({CollectionEditorPage:()=>Mt,MaxCollectionsCallout:()=>X,messages:()=>J,userCollectionLimit:()=>Y}),J=o({create:{id:`collections.create_collection`,defaultMessage:`Create collection`},newCollection:{id:`collections.new_collection`,defaultMessage:`New collection`},editDetails:{id:`collections.edit_details`,defaultMessage:`Edit details`},manageAccounts:{id:`collections.manage_accounts`,defaultMessage:`Manage accounts`}});function jt(e){let{path:t}=O(),n=S();
1if(!e)return J.newCollection;if(E(n.pathname,{path:t,exact:!0}))return J.manageAccounts;if(E(n.pathname,{path:`${t}/details`}))return J.editDetails;throw Error(`No page title defined for route`)}var Y=u?.role?.collection_limit??0,Mt=({multiColumn:e})=>{let t=a(),n=j(),{accountId:r,signedIn:i}=m(),{id:o=null}=w(),{path:s}=O(),c=M(e=>o?e.collections.collections[o]:void 0),l=M(e=>e.collections.editor.id),u=!!o,{collections:d,status:f}=U(u?null:r),p=u&&!c||!u&&f===`loading`,h=i&&(u||d.length<Y);(0,z.useEffect)(()=>{o&&i&&n(le({collectionId:o}))},[n,o,i]),(0,z.useEffect)(()=>{o!==l&&n(k.reset())},[n,l,o]),(0,z.useEffect)(()=>{c&&n(k.init(c))},[n,c]);let g=t.formatMessage(jt(o));return(0,B.jsxs)(be,{bindToDocument:!e,label:g,children:[(0,B.jsx)(De,{title:g,icon:`list-ul`,iconComponent:Ae,multiColumn:e,showBackButton:!0}),(0,B.jsx)(`div`,{className:`scrollable`,children:p?(0,B.jsx)(y,{}):i?h?(0,B.jsxs)(C,{children:[(0,B.jsx)(T,{exact:!0,path:s,render:()=>(0,B.jsx)(Tt,{collection:c})}),(0,B.jsx)(T,{exact:!0,path:`${s}/details`,render:()=>(0,B.jsx)(Et,{})})]}):(0,B.jsx)(X,{className:K.maxCollectionsError}):(0,B.jsx)(Xe,{})}),(0,B.jsxs)(me,{children:[(0,B.jsx)(`title`,{children:g}),(0,B.jsx)(`meta`,{name:`robots`,content:`noindex`})]})]})},X=({className:e})=>(0,B.jsx)(I,{className:e,title:(0,B.jsx)(i,{id:`collections.maximum_collection_count_reached`,defaultMessage:`You have created the maximum number of collections`}),children:(0,B.jsx)(i,{id:`collections.maximum_collection_count_description`,defaultMessage:`Your server allows creation of up to {count} collections.`,values:{count:Y}})}),Z=o({view:{id:`collections.view_collection`,defaultMessage:`View collection`},share:{id:`collections.share_short`,defaultMessage:`Share`},copyLink:{id:`collections.copy_link`,defaultMessage:`Copy link`},copyLinkConfirmation:{id:`collections.copy_link_confirmation`,defaultMessage:`Copied collection link to clipboard`},delete:{id:`collections.delete_collection`,defaultMessage:`Delete collection`},report:{id:`collections.report_collection`,defaultMessage:`Report this collection`},blockOwner:{id:`collections.block_collection_owner`,defaultMessage:`Block account`},revoke:{id:`collections.revoke_collection_inclusion`,defaultMessage:`Remove myself from this collection`},more:{id:`status.more`,defaultMessage:`More`}}),Q=({collection:e,context:t,className:n})=>{let r=j(),i=a(),{id:o,name:c,account_id:l,items:u}=e,d=h(l),f=l===s,p=u.find(e=>e.account_id===s),m=(0,z.useCallback)(()=>{r(x({modalType:`SHARE_COLLECTION`,modalProps:{collection:e}}))},[e,r]),v=(0,z.useCallback)(()=>{r(x({modalType:`CONFIRM_DELETE_COLLECTION`,modalProps:{name:c,id:o}}))},[r,o,c]),y=(0,z.useCallback)(()=>{r(x({modalType:`REPORT_COLLECTION`,modalProps:{collection:e}}))},[e,r]),b=(0,z.useCallback)(()=>{r(te(d))},[d,r]),S=(0,z.useCallback)(()=>{r(x({modalType:`REVOKE_COLLECTION_INCLUSION`,modalProps:{collectionId:e.id,collectionItemId:p?.id}}))},[e.id,p?.id,r]);return(0,B.jsx)(_,{scrollKey:`collections`,items:(0,z.useMemo)(()=>{let n={text:i.formatMessage(Z.view),to:Se(o)},a=[{text:i.formatMessage(Z.share),action:m},{text:i.formatMessage(Z.copyLink),action:()=>{navigator.clipboard.writeText(e.url),r(ee({message:Z.copyLinkConfirmation}))}}];if(f){let e=[...a,null,{text:i.formatMessage(J.manageAccounts),to:`/collections/${o}/edit`},{text:i.formatMessage(J.editDetails),to:`/collections/${o}/edit/details`},null,{text:i.formatMessage(Z.delete),action:v,dangerous:!0}];return t===`list`?[n,...e]:e}else{let e=[n,...a,null];return p&&t!==`notifications`&&e.push({text:i.formatMessage(Z.revoke),action:S}),e.push({text:i.formatMessage(Z.report),action:y}),p&&e.push({text:i.formatMessage(Z.blockOwner),action:b}),e}},[i,o,m,f,e.url,r,v,t,p,y,S,b]),children:(0,B.jsx)(g,{icon:`menu-icon`,iconComponent:nt,title:i.formatMessage(Z.more),className:n})})},$={wrapper:`_collections_components_collection_list_item__wrapper`,wrapperWithoutBorder:`_collections_components_collection_list_item__wrapperWithoutBorder`,menuButton:`_collections_components_collection_list_item__menuButton`},Nt=e(ye()),Pt=({collection:e,withoutBorder:t,positionInList:n,listSize:r,className:i,...a})=>{let o=(0,z.useId)(),s=`${o}-title`,c=`${o}-info`;return(0,B.jsx)(R,{focusable:!0,"aria-labelledby":s,"aria-describedby":c,"aria-posinset":n,"aria-setsize":r,children:(0,B.jsx)(ge,{collection:e,className:(0,Nt.default)($.wrapper,t&&$.wrapperW
1ithoutBorder,i),sideContent:(0,B.jsx)(Q,{context:`list`,collection:e,className:$.menuButton}),titleId:s,subtitleId:c,...a})})};export{rt as a,U as c,lt as i,V as l,Q as n,it as o,At as r,H as s,Pt as t,tt as u}; 2//# sourceMappingURL=collection_list_item-DsBIeXAM.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.