1import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-C21x__mS.js";import{a as n,c as r,s as i}from"./react-intl-DlKP8ATg.js";import{t as a}from"./jsx-runtime-BdxMnOeJ.js";import"./store-BKpYtGn4.js";import{o,s}from"./typed_functions-Whap35TF.js";import{D as c,E as l,L as u}from"./accounts_typed-AgBHJ2f3.js";import{r as d}from"./navigation_focus_target-B65hNV9H.js";import{t as f}from"./close-DIPoUQpY.js";import{t as p}from"./loading_indicator-eceYQNAM.js";import{t as m}from"./icon_button-DfNtv8BJ.js";import{n as h}from"./bundle_column_error-Dc3rL_yE.js";import{c as g,n as _,o as v,r as y}from"./collection_preview_card-BEHkYLQ_.js";import"./form_fields-W-m7nFkb.js";import{t as b}from"./toggle_field-BH1KQwCE.js";import{n as x}from"./useAccountId-B-0VumhZ.js";import{c as S,s as C}from"./collection_list_item-CSFDXV-y.js";var w=e(t()),T={wrapper:`_feat_collection_adder_collection_toggle__wrapper`},E=a(),D=({collection:e,checked:t,disabled:n,subtitle:r,onChange:i})=>{let a=(0,w.useId)(),o=`${a}-toggle`,s=`${a}-info`;return(0,E.jsx)(g,{className:T.wrapper,icon:(0,E.jsx)(_,{accountIds:e.items.map(e=>e.account_id),sensitive:e.sensitive}),sideContent:(0,E.jsx)(b,{id:o,checked:t,disabled:n,onChange:i,"aria-describedby":s}),children:(0,E.jsx)(v,{as:`label`,htmlFor:o,subtitle:r??(0,E.jsx)(y,{collection:e,withTimestamp:!1,withAuthorHandle:!1}),children:e.name})})},O={newCollection:`_feat_collection_adder__newCollection`},k=i({close:{id:`lightbox.close`,defaultMessage:`Close`}}),A=({collection:e,account:t})=>{let r=o(),[i,a]=(0,w.useState)(!1),s=e.items.find(e=>e.account_id===t.id),c=!!s,d=(0,w.useCallback)(async n=>{a(!0),n?await r(l({collectionId:e.id,accountId:t.id})):s&&await r(u({collectionId:e.id,itemId:s.id})),a(!1)},[t.id,e.id,s,r]),f=(0,w.useCallback)(e=>{d(e.target.checked)},[d]),p=!c&&e.item_count>=25;return(0,E.jsx)(D,{collection:e,disabled:i||p,subtitle:p?(0,E.jsx)(n,{id:`collections.search_accounts_max_reached`,defaultMessage:`You have added the maximum number of accounts`}):null,checked:c,onChange:f},e.id)},j=({accountId:e,onClose:t})=>{let i=r(),a=(0,w.useId)(),l=s(t=>t.accounts.get(e)),u=x(),{collections:g,status:_}=S(u),v=o(),y=(0,w.useCallback)(()=>{l&&v(c.reset({account_id:l.id,state:l.feature_approval.current_user===`manual`?`pending`:`accepted`})),t()},[l,v,t]);return(0,E.jsxs)(`div`,{className:`modal-root__modal dialog-modal`,children:[(0,E.jsxs)(`div`,{className:`dialog-modal__header`,children:[(0,E.jsx)(m,{className:`dialog-modal__header__close`,title:i.formatMessage(k.close),icon:`times`,iconComponent:f,onClick:t}),(0,E.jsx)(d,{as:`h1`,id:a,className:`dialog-modal__header__title`,children:(0,E.jsx)(n,{id:`collections.add_to_collection`,defaultMessage:`Add {name} to collections`,values:{name:(0,E.jsxs)(`strong`,{children:[`@`,l?.acct]})}})})]}),(0,E.jsx)(`div`,{className:`dialog-modal__content`,children:(0,E.jsx)(`div`,{className:`lists-scrollable`,role:`group`,"aria-labelledby":a,children:_===`loading`||!l?(0,E.jsx)(p,{}):g.length===0?(0,E.jsx)(h,{title:(0,E.jsx)(n,{id:`empty_column.collections_self`,defaultMessage:`You have not created any collections yet.`}),message:(0,E.jsx)(n,{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,E.jsx)(C,{compact:!0,onClick:y})}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`div`,{className:O.newCollection,children:(0,E.jsx)(C,{secondary:!0,onClick:y,children:(0,E.jsx)(n,{id:`collections.create_new_collection`,defaultMessage:`Create new collection`})})}),g.map(e=>(0,E.jsx)(A,{collection:e,account:l},e.id))]})})})]})};export{j as CollectionAdder}; 2//# sourceMappingURL=collection_adder-CZKVeGGs.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.