PageSourceSearch

https://lnkrs.app/assets/Index-C4EYSSAS.js

js lnkrs.app collected 2026-09-24 14:31:41 UTC 52,058 bytes, 7 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/welcomeConfettiColors-B-RNNCOM.js","assets/index-DsK5E-oE.js","assets/index-BrV_2fKw.css"])))=>i.map(i=>d[i]);
2import{c as hr,s as x,u as Pe,r as s,j as e,A as Rt,a as qt,b as Ut,d as $t,e as Ft,f as Gt,g as zt,h as Kt,i as Vt,D as Yt,k as Zt,l as Wt,m as Jt,n as dt,T as gr,L as br,o as Xe,S as _r,C as wr,p as vr,q as G,t as kr,v as Xt,w as Qt,x as er,y as yr,B as jr,z as Te,E as Dt,F as Ve,G as Ye,H as Ze,I as We,J as Br,K as Cr,M as Sr,X as Nr,P as Ir,N as Er,O as Dr,Q as Or,R as Lr,U as Tr,_ as Pr,V as Ar}from"./index-DsK5E-oE.js";import{c as Hr}from"./confetti.module-ONDKWxYZ.js";import{r as Mr,c as tr,h as Rr,B as Je}from"./BoardPrivateIcon-nmr_wxmd.js";import{u as qr,a as Ot,b as Ur,S as $r,I as Fr,R as Gr,c as Lt,N as Tt,B as zr,d as Kr,e as Vr,f as Yr,P as Zr,L as Wr,C as Jr,O as Xr}from"./LinkerBoard-KPskOEbj.js";import{s as Qr,S as es,C as ts,E as rs,P as ss,a as as,b as ns}from"./SearchResults-Bqi0kHG0.js";import{A as Pt}from"./ArrowDownIcon-BD7tCpVo.js";import{L as os}from"./Lock16Icon-Cehj_Qtw.js";import{E as At}from"./EditIcon-9P920K2K.js";import{D as is,a as ls}from"./DropMenuItem-QAq4Oiim.js";import{f as ds}from"./orgEmailBranding-BFJ0oU9B.js";import{d as cs}from"./brandAutoDetect-CStyFaGt.js";import{P as us}from"./imageOptimize-BG7Pdjzn.js";import{P as Ht,U as fs,F as Mt}from"./ProfileActivityTabs-DD7uKe0k.js";import{U as ms}from"./UpvotedLinksFeed-D6HczAXp.js";import"./countries-zARnHE6y.js";import"./Edit16Icon-CXy40-R9.js";import"./CategoryLinksPreviewList-CHParnWc.js";import"./dropdown-menu-DAJAr1TU.js";import"./domainName-B4BdNYq1.js";import"./link-sNUn2W22.js";import"./index-DJuJiTFH.js";import"./check-C--2CRA7.js";import"./AiSparkleIcon-ZzPPSXZp.js";import"./useProUsers-BXX5sejh.js";import"./UrlAutocomplete-BghtwGEU.js";import"./MoreIcon-B0YM_2Oa.js";import"./CopyIcon-C8HR1IJu.js";import"./PlayIcon-DEWAnjh3.js";import"./BackIcon-BGx7ufAt.js";import"./tabs-BR4OQEcM.js";import"./LinkMetaTooltip-CGx3b2pC.js";import"./ActivityComposerModalHost-B5Lpu6zA.js";import"./ExpandedNoteModal-B_dHpsLH.js";import"./ArrowLeftIcon-C4oMh8cB.js";import"./HuntermojiPicker-DKoeYNrH.js";import"./minus-CgfBq-ch.js";import"./trash-2-CYRRCZU9.js";import"./chevron-down-CdddVi2g.js";import"./minimizedNotes-CfTAoj28.js";import"./UpvoteButton-ozT9igSs.js";import"./dominantColor-CTp8tHjY.js";import"./tabCache-RGerLIup.js";import"./ActivityPostCard-io6XIxtA.js";import"./blackHoleCache-DarTFYsh.js";import"./AttachIcon-IolBTi8P.js";/**
3 * @license lucide-react v0.462.0 - ISC
4 *
5 * This source code is licensed under the ISC license.
6 * See the LICENSE file in the root directory of this source tree.
7 */const ps=hr("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);async function xs(g){const{data:f,error:_}=await x.from("boards").select("id, is_black_hole").eq("user_id",g).is("org_id",null);if(_)return!1;const O=(f??[]).filter(N=>!N.is_black_hole);if(O.length>1)return!1;if(O.length===0)return!0;const{data:C}=await x.from("categories").select("id").eq("board_id",O[0].id).is("deleted_at",null).limit(1);return(C??[]).length===0}async function hs(g){var _;const f=Mr();if(!f)return!1;try{const{data:O}=await x.from("boards").select("id, name, is_black_hole, order").eq("user_id",g).is("org_id",null).is("is_black_hole",!1),C=((_=(O??[])[0])==null?void 0:_.id)??null,N=[...f.boards].sort((t,P)=>t.order-P.order),c=new Map;for(let t=0;t<N.length;t++){const P=N[t];if(t===0&&C){c.set(P.id,C),await x.from("boards").update({name:P.name,is_private:P.isPrivate,text_transform:P.textTransform}).eq("id",C);continue}const{data:E,error:V}=await x.from("boards").insert({user_id:g,name:P.name,is_private:P.isPrivate,is_default:t===0,order:t,text_transform:P.textTransform}).select("id").single();if(V||!E)return!1;c.set(P.id,E.id)}for(const[t,P]of c){const E=f.categoriesByBoard[t]??[];if(E.length===0)continue;const V=E.map(S=>({id:crypto.randomUUID(),user_id:g,board_id:P,name:S.name,note:S.note??"",is_private:S.isPrivate,column:S.column,order:S.order,kind:S.kind??"links",view_mode:S.viewMode??"list"})),re=new Map(E.map((S,A)=>[S.id,V[A].id])),{error:X}=await x.from("categories").insert(V);if(X)return!1;const z=E.flatMap(S=>S.links.map((A,Z)=>({id:crypto.randomUUID(),category_id:re.get(S.id),user_id:g,url:A.url,title:A.title,is_private:A.isPrivate,order:Z,is_separator:A.isSeparator??!1,is_title:A.isTitle??!1,icon_url:A.iconUrl??null,icon_local_only:A.iconLocalOnly??!1})));if(z.length>0){const{error:S}=await x.from("links").insert(z);if(S)return!1}}return tr(),!0}catch{return!1}}function gs({userId:g,onImported:f}){const{t:_}=Pe(),[O,C]=s.useState(!1),[N,c]=s.useState(!1);s.useEffect(()=>{let E=!1;if(!(!g||!Rr()))return xs(g).then(V=>{!E&&V&&C(!0)}),()=>{E=!0}},[g]);const t=async()=>
7{if(!g)return;c(!0);const E=await hs(g);c(!1),C(!1),E&&(f==null||f())},P=()=>{tr(),C(!1)};return e.jsx(Rt,{open:O,onOpenChange:E=>N?null:C(E),children:e.jsxs(qt,{children:[e.jsxs(Ut,{children:[e.jsx($t,{children:_("demo.keep_title")}),e.jsx(Ft,{children:_("demo.keep_description")})]}),e.jsxs(Gt,{children:[e.jsx(zt,{disabled:N,onClick:P,children:_("demo.discard_cta")}),e.jsx(Kt,{disabled:N,onClick:t,children:_("demo.keep_cta")})]})]})})}function ct({className:g=""}){return e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:g,children:e.jsx("path",{d:"M7.00018 10.5334C9.63784 10.5335 11.3567 11.053 12.424 11.928C13.5266 12.8321 13.8 14.0016 13.8 14.9534V16.8H0.200378V14.9534C0.200383 14.0016 0.473642 12.8322 1.57635 11.928C2.64368 11.053 4.36251 10.5334 7.00018 10.5334ZM15.4055 10.7112C17.0831 10.9893 18.2117 11.5858 18.9133 12.4065C19.6171 13.2299 19.7999 14.1719 19.8 14.9534V16.8H15.2004V15.2004H18.2004V14.9534C18.2003 14.4159 18.0771 13.8897 17.6974 13.4456C17.3152 12.9984 16.5812 12.5276 15.1437 12.2893L14.3547 12.1584L14.6164 10.5803L15.4055 10.7112ZM7.00018 12.1331C4.52701 12.1331 3.24595 12.6284 2.591 13.1653C1.97172 13.673 1.79999 14.3128 1.79999 14.9534V15.1995H12.2004V14.9534C12.2004 14.3129 12.0285 13.673 11.4094 13.1653C10.7545 12.6284 9.47337 12.1331 7.00018 12.1331ZM7.00116 2.20044C8.9155 2.20073 10.468 3.75283 10.468 5.66724C10.4676 7.58138 8.91531 9.13374 7.00116 9.13403C5.08676 9.13403 3.53467 7.58156 3.53436 5.66724C3.53436 3.75265 5.08657 2.20044 7.00116 2.20044ZM13.0012 2.20044C14.9155 2.20073 16.467 3.75283 16.467 5.66724C16.4667 7.58138 14.9153 9.13374 13.0012 9.13403C12.7467 9.13403 12.4973 9.10556 12.257 9.05298L11.4758 8.88208L11.8176 7.31958L12.5988 7.49048C12.7275 7.51862 12.8625 7.53345 13.0012 7.53345C14.0317 7.53315 14.8671 6.69773 14.8674 5.66724C14.8674 4.63649 14.0318 3.80034 13.0012 3.80005C12.8624 3.80005 12.7275 3.81486 12.5988 3.84302L11.8176 4.01489L11.4758 2.45142L12.257 2.28052C12.4973 2.22794 12.7467 2.20044 13.0012 2.20044ZM7.00116 3.80005C5.97023 3.80005 5.13397 4.6363 5.13397 5.66724C5.13428 6.69791 5.97042 7.53345 7.00116 7.53345C8.03165 7.53316 8.86706 6.69773 8.86737 5.66724C8.86737 4.63648 8.03184 3.80034 7.00116 3.80005Z",fill:"currentColor"})})}function bs(g,f){const _=Date.now()-new Date(g).getTime(),O=Math.floor(_/6e4);if(O<1)return f("board_guests.time.just_now");if(O<60)return f("board_guests.time.minutes",{count:O});const C=Math.floor(O/60);if(C<24)return f("board_guests.time.hours",{count:C});const N=Math.floor(C/24);if(N<30)return f("board_guests.time.days",{count:N});const c=Math.floor(N/30);return f("board_guests.time.months",{count:c})}const _s=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function ws(g){return Array.from(new Set(g.split(/[\s,;]+/).map(f=>f.trim().toLowerCase()).filter(f=>f.length>0)))}function vs({open:g,onOpenChange:f,boardId:_,boardName:O,orgId:C,onCountChanged:N}){const{t:c}=Pe(),{limit:t}=Vt(),[P,E]=s.useState(null),V=P!==null,re=t("businessGuests"),X=P?1/0:re,z=!V||!Number.isFinite(X),[S,A]=s.useState(""),[Z,ce]=s.useState(!1),[R,_e]=s.useState([]),[ye,xe]=s.useState(!1),[k,je]=s.useState(null),[we,Q]=s.useState(null),[U,ee]=s.useState(""),[T,he]=s.useState(null),[ue,K]=s.useState(!1),Be=s.useRef(null),fe=s.useCallback(async()=>{const{data:a,error:j}=await x.rpc("list_board_guests",{_board_id:_});if(j)console.error(j),_e([]),N==null||N(0);else{const m=a??[];_e(m),N==null||N(m.length)}xe(!0)},[_,N]);s.useEffect(()=>{if(!g){A(""),_e([]),xe(!1),ee(""),K(!1),E(null);return}fe(),(async()=>
7{if(!C){E(!1);return}const{data:a}=await x.rpc("get_org_owner_user_id",{_org_id:C}),j=Array.isArray(a)&&a.length>0?a[0]:null,m=j==null?void 0:j.user_id;if(!m){E(!1);return}const{data:v}=await x.rpc("is_user_pro",{_user_id:m});E(!!v)})()},[g,fe,C]);const Ce=z?1/0:Math.max(0,X-R.length),se=async(a,j)=>{let m="the workspace";const{data:v}=await x.from("organizations").select("name").eq("id",C).maybeSingle();v!=null&&v.name&&(m=v.name);const L=await ds(C),{data:{session:H}}=await x.auth.getSession();let ne;if(H){const{data:J}=await x.from("profiles").select("name, surname").eq("user_id",H.user.id).eq("profile_type","personal").maybeSingle();ne=J?[J.name,J.surname].filter(Boolean).join(" "):void 0}const Y=`https://lnkrs.app/accept-invitation?id=${a}`;await x.functions.invoke("send-transactional-email",{body:{templateName:"org-invitation",recipientEmail:j,idempotencyKey:`board-guest-invite-${_}-${j}-${Date.now()}`,templateData:{orgName:m,inviterName:ne,orgLogoUrl:L.orgLogoUrl,orgBrandColor:L.orgBrandColor,invitationLink:Y}}})},le=s.useMemo(()=>ws(S),[S]),ae=async()=>{if(le.length===0){G.error(c("board_guests.errors.invalid_email"));return}const a=le.filter(q=>!_s.test(q)||q.length>255);if(a.length>0){G.error(c("board_guests.errors.invalid_emails_list",{emails:a.join(", ")}));return}const{data:{session:j}}=await x.auth.getSession();if(!j)return;const m=(j.user.email||"").toLowerCase(),v=new Set(R.map(q=>q.email.toLowerCase())),L=le.filter(q=>q!==m&&!v.has(q)),H=le.includes(m),ne=le.length-L.length-(H?1:0);if(L.length===0){H?G.error(c("board_guests.errors.self_invite")):G.error(c("board_guests.errors.already_invited"));return}if(!z&&L.length>Ce){G.error(c("board_guests.errors.limit_exceeded",{tried:L.length,remaining:Ce,max:X}));return}ce(!0);let Y=0,J=0;try{for(const q of L)try{await x.from("org_invitations").delete().eq("org_id",C).eq("email",q).not("accepted_at","is",null);const{data:te,error:n}=await x.from("org_invitations").insert({org_id:C,email:q,invited_by:j.user.id,role:"guest",board_id:_}).select("id").single();if(n||!te){J++;continue}await se(te.id,q),Y++}catch(te){console.error(te),J++}Y>0&&G.success(Y===1?c("board_guests.invitation_sent"):c("board_guests.invitations_sent",{count:Y})),J>0&&G.error(c("board_guests.errors.some_failed",{count:J})),(H||ne>0)&&G(c("board_guests.skipped_notice",{count:(H?1:0)+ne})),A(""),K(!1),fe()}finally{ce(!1)}},y=async a=>{if(a.kind!=="invite")return;const j=`resend:${a.id}`;Q(j);try{await x.from("org_invitations").update({created_at:new Date().toISOString()}).eq("id",a.id),await se(a.id,a.email),G.success(c("board_guests.invitation_resent")),fe()}catch(m){console.error(m),G.error(c("board_guests.errors.resend_failed"))}finally{Q(null)}},W=async a=>{const j=`${a.kind}:${a.id}`;je(j);try{if(a.kind==="invite"){const{error:m}=await x.from("org_invitations").delete().eq("id",a.id);if(m)throw m;G.success(c("board_guests.invitation_cancelled"))}else{const{data:m,error:v}=await x.rpc("remove_board_guest",{_board_id:_,_user_id:a.user_id});if(v||m!=null&&m.error)throw v||new Error("rpc");G.success(c("board_guests.guest_removed"))}fe()}catch(m){console.error(m),G.error(c("board_guests.errors.remove_failed"))}finally{je(null),he(null)}},ge=s.useMemo(()=>{const a=U.trim().toLowerCase();return[...a?R.filter(m=>{const v=`${m.name??""} ${m.surname??""}`.trim().toLowerCase();return m.email.toLowerCase().includes(a)||v.includes(a)}):R].sort((m,v)=>{if(m.kind!==v.kind)return m.kind==="access"?-1:1;const L=`${m.name??""} ${m.surname??""}`.trim()||m.email,H=`${v.name??""} ${v.surname??""}`.trim()||v.email;return L.localeCompare(H)})},[R,U]),$=!z&&R.length>=X,ve=Z||le.length===0||$,be=T?T.kind==="access"&&`${T.name??""} ${T.surname??""}`.trim()||T.email:"",Se=()=>{$||(K(!0),requestAnimationFrame(()=>{var a;return(a=Be.current)==null?void 0:a.focus()}))},de=()=>{K(!1),A("")};return e.jsxs(e.Fragment,{children:[e.jsx(Yt,{open:g,onOpenChange:f,children:e.jsxs(Zt,{onOpenAutoFocus:a=>a.preventDefault(),className:"sm:max-w-[480px] rounded-[12px] card-ring bg-card border-none p-0",children:[e.jsxs(Wt,{className:"px-6 pt-6 pb-0",children:[e.jsxs(Jt,{className:"flex items-center gap-2 text-lg font-semibold",children:[e.jsx(ct,{className:"w-5 h-5 text-muted-foreground"}),c("board_guests.title_users",{board:O})]}),e.jsx(dt,{className:"text-[14px] text-muted-foreground mt-1",children:e.jsx(gr,{i18nKey:"board_guests.scope_hint",values:{board:O},components:[e.jsx("span",{},"0"),e.jsx(br,{to:"/settings?section=members",onClick:()=>f(!1),className:"underline underline-offset-2 text-muted-foreground hover:text-foreground"},"1")]})}),V&&!z&&ye&&e.jsx(dt,{className:`text-sm mt-1 ${$?"text-amber-600 dar
7k:text-amber-500 font-medium":"text-muted-foreground"}`,children:c("board_guests.invite_count_subtitle",{used:R.length,max:X})})]}),e.jsxs("div",{className:"px-6 pb-6 space-y-4 pt-0",children:[ue?e.jsxs("div",{className:"rounded-[8px] bg-card p-2",style:{boxShadow:"0 0 0 2px var(--brand-focus, #5D4AFF)"},children:[e.jsx("textarea",{ref:Be,value:S,onChange:a=>A(a.target.value),onKeyDown:a=>{a.key==="Enter"&&(a.metaKey||a.ctrlKey)&&!ve&&(a.preventDefault(),ae()),a.key==="Escape"&&(a.preventDefault(),de())},rows:3,placeholder:c("board_guests.email_placeholder_multi"),className:"block w-full bg-transparent text-sm text-foreground outline-none resize-none px-1 py-1 min-h-[64px]"}),e.jsxs("div",{className:"flex items-center justify-between pt-1",children:[e.jsx("span",{className:"text-[11px] text-muted-foreground pl-1",children:c("board_guests.invite_hint")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:de,className:"text-sm text-muted-foreground font-light hover:text-foreground",children:c("common.cancel")}),e.jsxs("button",{onClick:ae,disabled:ve,className:"inline-flex h-8 items-center gap-2 rounded-[6px] bg-primary px-4 text-sm font-semibold text-primary-foreground disabled:opacity-50 cursor-pointer",children:[Z&&e.jsx("span",{"aria-hidden":"true",className:"inline-block h-3.5 w-3.5 animate-spin rounded-full border-2 border-current border-t-transparent"}),c("board_guests.invite")]})]})]})]}):e.jsx("button",{type:"button",onClick:Se,disabled:$,className:"input-ring w-full text-left rounded-[8px] bg-transparent h-12 px-4 text-sm text-muted-foreground outline-none cursor-text disabled:opacity-50 disabled:cursor-not-allowed",children:c("board_guests.email_placeholder_multi")}),ye?e.jsxs("div",{className:"space-y-2",children:[R.length>2&&e.jsxs("div",{className:"input-ring flex items-center gap-2 rounded-[6px] h-8 px-3",children:[e.jsx(_r,{className:"w-3.5 h-3.5 text-muted-foreground flex-shrink-0"}),e.jsx("input",{type:"text",value:U,onChange:a=>ee(a.target.value),placeholder:c("board_guests.search_placeholder"),className:"bg-transparent outline-none text-sm flex-1 min-w-0"})]}),e.jsx("div",{className:"rounded-[8px] card-ring bg-card overflow-hidden",children:e.jsx("div",{className:"max-h-[260px] overflow-y-auto",children:R.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 py-10 px-4",children:[e.jsx(ct,{className:"w-8 h-8 text-muted-foreground/40"}),e.jsx("p",{className:"text-sm text-muted-foreground text-center",children:c("board_guests.empty")})]}):ge.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-6",children:c("board_guests.no_results")}):ge.map((a,j)=>{var Y;const m=a.kind==="access"&&`${a.name??""} ${a.surname??""}`.trim()||a.email,v=`${a.kind}:${a.id}`,L=a.kind==="invite",H=`${a.kind}:${a.id}`,ne=`resend:${a.id}`;return e.jsxs("div",{className:`flex items-center justify-between px-3 py-2.5 ${j<ge.length-1?"border-b border-border/40":""}`,children:[e.jsxs("div",{className:"flex items-center gap-2.5 min-w-0 flex-1",children:[L?e.jsx("div",{className:"w-7 h-7 rounded-full bg-muted/50 flex items-center justify-center flex-shrink-0",children:e.jsx(wr,{className:"w-3.5 h-3.5 text-muted-foreground"})}):a.avatar_url?e.jsx("img",{src:a.avatar_url,alt:"",className:"w-7 h-7 rounded-full object-cover flex-shrink-0"}):e.jsx("div",{className:"w-7 h-7 rounded-full bg-muted flex items-center justify-center flex-shrink-0 text-[11px] font-semibold text-muted-foreground",children:(((Y=a.name)==null?void 0:Y[0])||a.email[0]||"?").toUpperCase()}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm truncate text-foreground leading-tight",children:m}),e.jsxs("div",{className:"text-xs text-muted-foreground truncate flex items-center gap-1.5 mt-0.5",children:[a.kind==="access"&&a.email!==m?e.jsx("span",{className:"truncate",children:a.email}):e.jsx("span",{className:"text-amber-600 dark:text-amber-500",children:c("board_guests.pending")}),L&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"opacity-50",children:"·"}),e.jsx("span",{children:bs(a.created_at,c)})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 ml-2",children:[L&&e.jsx("button",{onClick:()=>y(a),disabled:we===ne,className:"h-7 w-7 flex items-center justify-center rounded-[6px] text-muted-foreground hover:text-foreground hover:bg-primary/10 transition-colors disabled:opacity-50","aria-label":c("board_guests.resend_aria"),title:c("board_guests.resend_aria"),children:we===ne?e.jsx(Xe,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(ps,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>he(a),disabled:k===H,className:"h-7 w-7 flex items-center justify-center rounded-[6px] text-muted-foreground hover:text-foreground hover:bg-primary/10 transition-colors disabled:opacity-50","aria-label":c("board_guests.remove_aria"),title:c("board_guests.remove_aria"),children:k===H?e.jsx(Xe,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(vr,{})})]})]},v)})})})]}):e.jsx("div",{className:"flex items-center justify-center py-6",children:e.jsx(Xe,{className:"w-4 h-4 animate-spin text-muted-foreground"})})]})]})}),e.jsx(Rt,{open:!!T,onOpenChange:a=>!a&&he(null),children:e.jsxs(qt,{className:"rounded-[12px] card-ring bg-card border-none",children:[e.jsxs(Ut,{children:[e.jsx($t,{children:(T==null?void 0:T.kind)==="invite"?c("board_guests.confirm.cancel_title"):c("board_guests.confirm.remove_title")}),e.jsx(Ft,{children:(T==null?void 0:T.kind)==="invite"?c("board_guests.confirm.cancel_desc",{name:be}):c("board_guests.confirm.remove_desc",{name:be,board:O})})]}),e.jsxs(Gt,{children:[e.jsx(zt,{className:"rounded-[6px]",children:c("board_guests.confirm.cancel_bt
7n")}),e.jsx(Kt,{onClick:()=>T&&W(T),className:"rounded-[6px] bg-destructive text-destructive-foreground hover:bg-destructive/90",children:(T==null?void 0:T.kind)==="invite"?c("board_guests.confirm.cancel_confirm"):c("board_guests.confirm.remove_confirm")})]})]})})]})}function ks({boards:g,activeBoard:f,activeBoardId:_,categories:O,onSwitchBoard:C,onEditBoard:N,onAddBoard:c,onRenameBoard:t,onToggleBoardPrivate:P,onSetBoardTextTransform:E,onDeleteBoard:V,onReorderBoards:re,onImportCompleted:X,searchQuery:z,onSearchQueryChange:S,isSearchOpen:A,onSearchOpenChange:Z,isSaving:ce,isLoaded:R}){const[_e,ye]=s.useState(!1);s.useEffect(()=>{const r=o=>{const i=o.detail;ye(!!(i!=null&&i.isSaving))};return window.addEventListener("linkers:notes-saving",r),()=>window.removeEventListener("linkers:notes-saving",r)},[]);const xe=!!ce||_e,{t:k}=Pe("translation",{keyPrefix:"org_board_header"}),{t:je}=Pe("translation",{keyPrefix:"common"}),{t:we}=Pe("translation",{keyPrefix:"board"}),Q=qr(),[U,ee]=s.useState(!1),[T,he]=s.useState(!1),[ue,K]=s.useState(!1),[Be,fe]=s.useState(""),{prefs:Ce,update:se}=kr(),[le,ae]=s.useState(!1),[y,W]=s.useState(null),[ge,$]=s.useState(!1),[ve,be]=s.useState(!1);s.useState(!1);const[Se,de]=s.useState(!1),[a,j]=s.useState(null),[m,v]=s.useState(!1),[L,H]=s.useState(""),[ne,Y]=s.useState(""),[J,q]=s.useState({x:50,y:50,scale:1}),[te,n]=s.useState(""),[l,d]=s.useState(!1),[b,p]=s.useState(""),h=s.useRef(null),M=s.useRef(null),oe=s.useRef(null),F=s.useRef(null),[ie,Ne]=s.useState(!1),[rr,ut]=s.useState(!1),[ft,Qe]=s.useState(0),De=Ot(),et=De.currentUserRole==="owner",Ie=De.currentUserRole==="owner"||De.currentUserRole==="admin"||De.currentUserRole==="editor";s.useEffect(()=>{const r=()=>{Ie&&be(!0)};return window.addEventListener("linkers-open-new-board",r),()=>window.removeEventListener("linkers-open-new-board",r)},[Ie]),s.useEffect(()=>{if(!Ie)return;const r=o=>{const i=o.detail,u=i==null?void 0:i.boardId;if(!u)return;const w=g.find(B=>B.id===u);w&&(j(w),de(!0))};return window.addEventListener("linkers-open-edit-board",r),()=>window.removeEventListener("linkers-open-edit-board",r)},[g,Ie]);const I=Xt()||"",[tt,sr]=Qt(),{recheck:mt}=er();s.useEffect(()=>{const r=o=>{const i=o.detail;if((i==null?void 0:i.orgId)!==I)return;const u=i.brandColor||"";p(u),d(!0);try{const w=window.__orgBannerCache;for(const B of(w==null?void 0:w.keys())??[])B.startsWith(`${I}::`)&&(w==null||w.delete(B))}catch{}};return window.addEventListener("org-brand-color-changed",r),()=>window.removeEventListener("org-brand-color-changed",r)},[I]);const rt=tt.get("previewOffer"),pt=tt.get("previewOrg"),[ar,Ae]=s.useState(null),Ee=rt||ar,st=!!Ee&&!!I&&(!pt||pt===I),[Oe,He]=s.useState(null),[xt,Me]=s.useState(null),[Re,qe]=s.useState(!1),[ys,ht]=s.useState("");s.useEffect(()=>{const r=o=>{(o.metaKey||o.ctrlKey)&&o.key.toLowerCase()==="k"&&(o.preventDefault(),Z(!0),requestAnimationFrame(()=>{var i;return(i=F.current)==null?void 0:i.focus()}))};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[Z]),s.useEffect(()=>{if(!et||!_){Qe(0);return}let r=!1;return(async()=>{const{data:o}=await x.rpc("list_board_guests",{_board_id:_});r||Qe(Array.isArray(o)?o.length:0)})(),()=>{r=!0}},[et,_]),s.useEffect(()=>{if(rt||!I){Ae(null);return}let r=!1;return(async()=>{const{data:{user:o}}=await x.auth.getUser();if(!o||r)return;const i=(o.email||"").toLowerCase(),{data:u}=await x.from("org_ownership_transfers").select("id, expires_at").eq("org_id",I).eq("status","pending").or(`to_user_id.eq.${o.id},to_email.eq.${i}`).order("created_at",{ascending:!1}).limit(1).maybeSingle();r||(u&&(!u.expires_at||new Date(u.expires_at)>new Date)?Ae(u.id):Ae(null))})(),()=>{r=!0}},[I,rt]),s.useEffect(()=>{if(!st||!Ee){He(null),Me(null),ht("");return}let r=!1;return(async()=>{const{data:o}=await x.from("org_ownership_transfers").select("token, status").eq("id",Ee).maybeSingle();if(!r&&(o?(He(o.token),Me(o.status)):(He(null),Me("not_found")),I)){const{data:i}=await x.from("organizations").select("name").eq("id",I).maybeSingle();!r&&i&&ht(i.name||"")}})(),()=>{r=!0}},[st,Ee,I]);const gt=()=>
7{const r=new URLSearchParams(tt);r.delete("previewOffer"),r.delete("previewOrg"),sr(r,{replace:!0})},nr=async()=>{if(!Oe||Re)return;qe(!0);const{data:r,error:o}=await x.rpc("accept_ownership_transfer",{_token:Oe});qe(!1);const i=r;if(o||i!=null&&i.error){const u=i==null?void 0:i.error,w=i==null?void 0:i.status;G.error(u==="pro_evasion_blocked"?"You can't accept — you already own a free organization.":u==="transfer_expired"?"This offer has expired.":u==="email_mismatch"?"This offer was sent to a different email address.":u==="invalid_state"&&w==="rejected"?"You already declined this offer.":u==="invalid_state"&&w==="accepted"?"This offer has already been accepted.":u==="invalid_state"?"This offer is no longer available.":u==="not_found"?"This offer no longer exists.":"Couldn't accept the offer.");return}if(i!=null&&i.org_id)try{localStorage.setItem("active_org_id",i.org_id),localStorage.setItem("active_account_kind","org")}catch{}await mt(),gt(),G.success("You're now the owner")},or=async()=>{if(Re)return;qe(!0);let r=!1;if(Oe){const{data:u,error:w}=await x.rpc("reject_ownership_transfer",{_token:Oe}),B=u;r=!w&&!(B!=null&&B.error)}if(!r&&Ee){const{error:u}=await x.from("org_ownership_transfers").update({status:"rejected",responded_at:new Date().toISOString()}).eq("id",Ee);r=!u}if(qe(!1),!r){G.error("Couldn't decline the offer.");return}Me("rejected"),Ae(null),He(null),G.success("You declined the ownership offer");let o=!1;try{const{data:{user:u}}=await x.auth.getUser();if(u&&I){const{data:w}=await x.from("org_members").select("role").eq("org_id",I).eq("user_id",u.id).maybeSingle();o=!!w}}catch{}if(await mt(),o){gt();return}let i=null;try{const{data:{user:u}}=await x.auth.getUser();if(u){const{data:w}=await x.from("org_members").select("org_id").eq("user_id",u.id).limit(1);w&&w.length>0&&(i=w[0].org_id)}}catch{}try{i?(localStorage.setItem("active_org_id",i),localStorage.setItem("active_account_kind","org")):(localStorage.removeItem("active_org_id"),localStorage.setItem("active_account_kind","personal"))}catch{}window.location.assign("/")};s.useEffect(()=>{I&&(async()=>{var Et;const{data:{session:r}}=await x.auth.getSession(),o=((Et=r==null?void 0:r.user)==null?void 0:Et.id)??"anon",i=`${I}::${o}
7`,u=window.__orgBannerCache??new Map;window.__orgBannerCache=u;const w=u.get(i);if(w){H(w.url),Y(w.lqip),q(w.crop),n(w.gradient),p(w.brandColor),d(!0);return}let B=null;if(o!=="anon"){const{data:ke}=await x.from("org_member_banners").select("banner_url, banner_url_lqip, banner_crop, banner_gradient").eq("org_id",I).eq("user_id",o).maybeSingle();B=ke}if(!B){const{data:ke}=await x.from("org_member_banners").select("banner_url, banner_url_lqip, banner_crop, banner_gradient").eq("org_id",I).limit(1).maybeSingle();B=ke}const{data:xr}=await x.from("organizations").select("banner_gradient, brand_color, logo_url, avatar_url, website").eq("id",I).maybeSingle(),D=xr,Ct=(B==null?void 0:B.banner_url)||"",St=(B==null?void 0:B.banner_url_lqip)||"",Le=B==null?void 0:B.banner_crop,Nt=Le&&typeof Le.scale=="number"?{x:Le.x??50,y:Le.y??50,scale:Le.scale}:{x:50,y:50,scale:1},It=(B==null?void 0:B.banner_gradient)||(D==null?void 0:D.banner_gradient)||"";let Ke=(D==null?void 0:D.brand_color)||"";if(!Ke&&(D!=null&&D.logo_url||D!=null&&D.avatar_url||D!=null&&D.website))try{const ke=await cs({logoUrl:(D==null?void 0:D.logo_url)??null,avatarUrl:(D==null?void 0:D.avatar_url)??null,websiteUrl:(D==null?void 0:D.website)??null});ke&&(Ke=ke,x.from("organizations").update({brand_color:ke}).eq("id",I))}catch{}u.set(i,{url:Ct,lqip:St,crop:Nt,gradient:It,brandColor:Ke}),H(Ct),Y(St),q(Nt),n(It),p(Ke),d(!0)})()},[I]);const at=O.reduce((r,o)=>r+o.links.filter(i=>!i.isSeparator&&!i.isTitle).length,0);O.length>0;const[ir,Ue]=s.useState(null),[nt,lr]=s.useState(!1),me=ir??f,$e=g.filter(r=>r.id!==((me==null?void 0:me.id)??_)),pe=Ot(),bt=(()=>{if(!pe.isOrgMode||!pe.visitReady||!pe.previousBoardVisit||!pe.currentUserId)return 0;const r=new Date(pe.previousBoardVisit).getTime();let o=0;for(const i of O)for(const u of i.links)u.isSeparator||u.isTitle||!u.userId||!u.createdAt||u.userId!==pe.currentUserId&&(new Date(u.createdAt).getTime()<=r||pe.seenLinks.has(u.id)||o++);return o}
7)();s.useEffect(()=>{const r=o=>{h.current&&!h.current.contains(o.target)&&ee(!1),M.current&&!M.current.contains(o.target)&&(he(!1),K(!1),fe(""))};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[]),s.useEffect(()=>{ue&&oe.current&&oe.current.focus()},[ue]);const[_t,Fe]=s.useState(!1),dr=async()=>{const r=a??f;if(!r)return;const o=g.filter(u=>u.id!==r.id);he(!1),Ue(r),Fe(!0);let i=!1;if(r.id===_)i=at>0;else{const{data:u}=await x.from("categories").select("id").eq("board_id",r.id).is("deleted_at",null),w=(u??[]).map(B=>B.id);if(w.length>0){const{count:B}=await x.from("links").select("id",{count:"exact",head:!0}).in("category_id",w).eq("is_separator",!1).eq("is_title",!1).is("deleted_at",null);i=(B??0)>0}}lr(i),i&&o.length>0?W(o[0].id):W(null),ae(!0)},[cr,wt]=s.useState(!1),[vt,kt]=s.useState(null),ur=async r=>{if(!me)return;const o=me.name,i=me.id;kt(o),ae(!1),Fe(!1),de(!1),j(null),wt(!0);try{await V(i,r&&y?y:void 0)}finally{wt(!1),kt(null),Ue(null)}},[yt,ot]=s.useState(null),it=Ce.boards_sort,jt=Qr(g,it),{displayBoards:fr,dragBoardId:Ge,floatPos:lt,floatWidth:ze,floatHeight:Bt,handlePointerDown:mr,shouldSuppressClick:pr}=Ur(jt,re,{canReorder:()=>it==="manual",onBlockedReorder:r=>ot(r)});return e.jsxs("div",{className:"relative",style:{display:"contents"},children:[e.jsx("div",{className:"fixed top-0 left-0 right-0 z-50",children:e.jsx($r,{visible:xe})}),e.jsxs("div",{"data-linkers-header-zone":!0,className:"group/banner relative z-20 -mx-1 max-[1300px]:-mx-6 overflow-hidden",children:[(()=>{const r=!!te||!L;return e.jsx("div",{className:"rounded-[16px] max-[1300px]:rounded-none overflow-hidden relative",style:{aspectRatio:"7 / 1",background:"hsl(var(--muted))"},children:l&&e.jsx("div",{className:"absolute inset-0 animate-in fade-in duration-500",style:{background:r?yr({override:te,brandColor:b,fallbackId:I}):void 0},children:!r&&L&&e.jsx(jr,{imageUrl:L,lqipDataUri:ne||void 0,crop:J,parallax:!0})},`${L}::${te}::${b}`)})})(),e.jsx("button",{onClick:()=>v(!0),className:"absolute bottom-3 right-4 max-[1300px]:right-8 flex items-center justify-center rounded-[6px] h-6 w-6 shadow-[0_0_0_1px_var(--ring-base)] hover:shadow-[0_0_0_1px_var(--ring-strong)] transition-all duration-200 bg-card opacity-0 group-hover/banner:opacity-100",children:e.jsx(At,{})})]}),e.jsxs("div",{"data-board-toolbar":!0,className:"sticky top-0 z-[100] bg-card board-toolbar-row flex items-center justify-between py-[16px] px-[28px]",children:[e.jsx("div",{className:"flex items-center gap-3",children:z.trim()?e.jsx(es,{label:k("search_links")}):e.jsxs(e.Fragment,{children:[(g.length>1||Ie)&&e.jsxs("div",{className:"relative min-[1400px]:hidden",ref:h,children:[e.jsxs("button",{onClick:()=>ee(!U),className:`group flex items-center gap-[4px] transition-colors ${U?"text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[e.jsx(Te,{className:"w-[20px] h-[20px]"}),e.jsx("span",{className:"text-sm font-medium min-w-[8px]",children:g.length>0?g.length>1?`${Math.max(1,g.findIndex(r=>
7r.id===_)+1)}/${g.length}`:g.length:""}),e.jsx(Pt,{className:"w-[20px] h-[20px]"})]}),U&&e.jsxs("div",{className:"absolute -left-2 top-9 z-50 min-w-[280px] w-max rounded-[12px] dropdown-ring bg-card p-1 py-[8px] px-[8px]",style:Ge&&ze?{minWidth:Math.max(280,ze+16)}:void 0,children:[Ie&&e.jsxs(e.Fragment,{children:[e.jsx(is,{onClick:()=>{be(!0),ee(!1)},icon:e.jsx(us,{size:14}),children:we("new_board")}),e.jsx(ls,{})]}),fr.map((r,o)=>Ge===r.id?e.jsx("div",{"data-board-row":!0,"data-board-id":r.id,className:"rounded-[6px] border border-dashed border-muted-foreground/30 bg-muted/20",style:{height:Bt,width:ze}},r.id):e.jsxs("div",{"data-board-row":!0,"data-board-id":r.id,onPointerDown:u=>mr(u,o,r),onClick:()=>{pr()||(C(r.id),ee(!1))},style:{touchAction:"none"},className:"group flex w-full items-center gap-2 rounded-[6px] px-3 text-sm hover:bg-primary/20 py-[6px] cursor-pointer",children:[r.isPrivate?e.jsx(Je,{className:"w-[20px] h-[20px] opacity-50 flex-shrink-0"}):e.jsx(Te,{className:"w-[20px] h-[20px] opacity-50 flex-shrink-0"}),e.jsx("span",{className:"flex-1 text-left whitespace-nowrap",children:r.name}),e.jsxs("span",{className:"flex items-center justify-end gap-1 flex-shrink-0 w-[34px]",children:[e.jsx("span",{className:"flex items-center gap-1 group-hover:hidden",children:r.id===_&&e.jsx(Dt,{})}),e.jsx("button",{onClick:u=>{u.stopPropagation(),ee(!1),j(r),de(!0)},className:"hidden group-hover:flex h-5 w-5 items-center justify-center rounded-[4px] text-muted-foreground hover:text-foreground",children:e.jsx(At,{})})]})]},r.id)),Ge&&lt&&(()=>{const r=jt.find(o=>o.id===Ge);return r?e.jsxs("div",{style:{position:"fixed",left:lt.x,top:lt.y,width:ze,height:Bt,zIndex:9999,pointerEvents:"none"},className:"flex items-center gap-2 rounded-[6px] px-3 text-sm py-[6px] card-ring bg-card shadow-lg",children:[r.isPrivate?e.jsx(Je,{className:"w-[20px] h-[20px] opacity-50 flex-shrink-0"}):e.jsx(Te,{className:"w-[20px] h-[20px] opacity-50 flex-shrink-0"}),e.jsx("span",{className:"flex-1 text-left whitespace-nowrap",children:r.name})]}):null})()]})]}),e.jsx("button",{onClick:()=>{j(f),de(!0)},className:"text-base font-semibold text-foreground hover:text-foreground/80 transition-colors cursor-pointer",children:(f==null?void 0:f.name)??(R?k("general"):"")}),(f==null?void 0:f.isPrivate)&&e.jsx(os,{className:"w-4 h-4 text-muted-foreground"}),R&&at>0&&e.jsx("span",{className:"text-sm text-muted-foreground",children:k("links_count",{count:at})})]})}),e.jsx("div",{className:"flex items-center gap-2",children:st&&(xt==="pending"||xt===null)?e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-[13px] text-muted-foreground",children:"Ownership offer"}),e.jsx("button",{type:"button",onClick:or,disabled:Re,className:"inline-flex items-center justify-center h-8 px-3 rounded-[6px] bg-card text-foreground text-[13px] font-medium cursor-pointer shadow-[0_0_0_1px_var(--ring-base)] hover:shadow-[0_0_0_1px_var(--ring-strong)] transition-all disabled:opacity-50",children:"Reject"}),e.jsx("button",{type:"button",onClick:nr,disabled:Re||!Oe,className:"inline-flex items-center justify-center h-8 px-3 rounded-[6px] bg-primary text-primary-foreground text-[13px] font-semibold cursor-pointer hover:bg-primary/90 transition-all disabled:opacity-50",children:"Accept"})]}):e.jsxs(e.Fragment,{children:[Q?e.jsx(Ve,{delayDuration:300,children:e.jsxs(Ye,{children:[e.jsx(Ze,{asChild:!0,children:e.jsx("button",{onClick:r=>{r.currentTarget.blur(),Q.cycleGlobal()},"aria-label":k("collapse_toggle_aria"),className:"h-8 w-8 flex items-center justify-center rounded-[6px] text-muted-foreground hover:text-foreground shadow-[0_0_0_1px_transparent] hover:shadow-[0_0_0_1px_var(--ring-base)] transition-[box-shadow,color] duration-150",children:e.jsx("span",{className:"w-5 h-5 flex items-center justify-center",children:Q.globalMode==="peek-all"?e.jsx(ts,{className:"w-5 h-5"}):Q.globalMode==="collapse-all"?e.jsx(rs,{className:"w-5 h-5"}):e.jsx(ss,{className:"w-5 h-5"})})})}),e.jsx(We,{side:"top",sideOffset:8,className:"text-xs px-2 py-1 rounded-[6px]",children:Q.globalMode==="peek-all"?k("collapse_all"):Q.globalMode==="collapse-
7all"?k("expand_all"):k("peek_all")})]})}):null,e.jsx(Fr,{}),bt>0&&e.jsx(Ve,{delayDuration:300,children:e.jsxs(Ye,{children:[e.jsx(Ze,{asChild:!0,children:e.jsxs("button",{onClick:r=>{r.currentTarget.blur(),pe.markAllSeen()},"aria-label":k("mark_all_seen_aria"),className:"h-8 px-2 flex items-center gap-1.5 rounded-[6px] text-muted-foreground hover:text-foreground shadow-[0_0_0_1px_transparent] hover:shadow-[0_0_0_1px_var(--ring-base)] transition-all",children:[e.jsx("span",{className:"w-[7px] h-[7px] rounded-full",style:{backgroundColor:pe.brandColor||"hsl(var(--primary))"}}),e.jsx("span",{className:"text-xs font-medium tabular-nums",children:bt}),e.jsx(Br,{className:"w-[20px] h-[20px]"})]})}),e.jsx(We,{side:"top",sideOffset:8,className:"text-xs px-2 py-1 rounded-[6px]",children:k("mark_all_seen")})]})}),et&&_&&e.jsx(Ve,{delayDuration:300,children:e.jsxs(Ye,{children:[e.jsx(Ze,{asChild:!0,children:e.jsx("button",{onClick:r=>{r.currentTarget.blur(),ut(!0)},"aria-label":k("invite_guests_aria"),className:"h-8 px-2 flex items-center gap-1.5 rounded-[6px] text-muted-foreground hover:text-foreground shadow-[0_0_0_1px_transparent] hover:shadow-[0_0_0_1px_var(--ring-base)] transition-all",children:ft>0?e.jsxs(e.Fragment,{children:[e.jsx(ct,{className:"w-5 h-5"}),e.jsx("span",{className:"text-xs font-medium tabular-nums",children:ft})]}):e.jsx(Cr,{className:"w-5 h-5"})})}),e.jsx(We,{side:"top",sideOffset:8,className:"text-xs px-2 py-1 rounded-[6px]",children:k("invite_guests_aria")})]})}),e.jsx(Ve,{delayDuration:300,children:e.jsxs(Ye,{children:[e.jsx(Ze,{asChild:!0,children:e.jsx("button",{onClick:r=>{r.currentTarget.blur(),Ne(!0)},"aria-label":k("board_preferences_aria"),className:"h-8 w-8 flex items-center justify-center rounded-[6px] text-muted-foreground hover:text-foreground shadow-[0_0_0_1px_transparent] hover:shadow-[0_0_0_1px_var(--ring-base)] transition-all",children:e.jsx(Sr,{className:"w-5 h-5"})})}),e.jsx(We,{side:"top",sideOffset:8,className:"text-xs px-2 py-1 rounded-[6px]",children:k("board_preferences_aria")})]})}),e.jsxs("div",{className:`flex items-center input-ring rounded-[6px] h-8 transition-all cursor-text gap-[6px] px-[10px] pr-[8px] ${A||z?"w-[220px]":"w-[60px]"} pl-[8px]`,onClick:()=>{var r;return(r=F.current)==null?void 0:r.focus()},children:[e.jsx(as,{className:"w-5 h-5 text-muted-foreground flex-shrink-0"}),e.jsx("input",{ref:F,value:z,onChange:r=>S(r.target.value),onFocus:()=>Z(!0),onBlur:()=>{z.trim()||Z(!1)},onKeyDown:r=>{var o;r.key==="Escape"&&(r.preventDefault(),S(""),Z(!1),(o=F.current)==null||o.blur())},className:"bg-transparent text-sm outline-none border-none w-full min-w-0",placeholder:A?k("search_something"):""}),z.trim()&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs text-muted-foreground flex-shrink-0 select-none",children:"Esc"}),e.jsx("button",{onClick:()=>{var r;S(""),Z(!1),(r=F.current)==null||r.blur()},className:"text-muted-foreground hover:text-foreground flex-shrink-0 ml-0.5",children:e.jsx(Nr,{size:12})})]})]})]})})]}),e.jsx(Yt,{open:le,onOpenChange:r=>{ae(r),r||(Ue(null),W(null),Fe(!1))},children:e.jsxs(Zt,{className:"sm:max-w-[420px]",children:[e.jsxs(Wt,{children:[e.jsx(Jt,{children:k("delete_title",{name:(me==null?void 0:me.name)??""})}),e.jsx(dt,{children:k(nt?"delete_has_content":"delete_empty")})]}),nt&&$e.length>0&&e.jsxs(Gr,{value:y!==null?"move":"delete",onValueChange:r=>W(r==="move"?$e[0].id:null),className:"space-y-3 pt-1",children:[e.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[e.jsx(Lt,{value:"move"}),k("move_to_another")]}),y!==null&&(()=>{const r=$e.find(o=>o.id===y);return e.jsxs(Ir,{open:ge,onOpenChange:$,modal:!0,children:[e.jsx(Er,{asChild:!0,children:e.jsxs("button",{type:"button",className:"input-ring w-full rounded-[6px] bg-card h-9 px-3 text-sm flex items-center justify-between gap-2 outline-none",children:[e.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[r!=null&&r.isPrivate?e.jsx(Je,{className:"w-[20px] h-[20px] opacity-60 flex-shrink-0"}):e.jsx(Te,{className:"w-[20px] h-[20px] opacity-60 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:(r==null?void 0:r.name)??""})]}),e.jsx(Pt,{className:"w-[20px] h-[20px] opacity-60 flex-shrink-0"})]})}),e.jsx(Dr,{align:"start",sideOffset:6,className:"z-[700] p-[8px] rounded-[12px] dropdown-ring bg-card w-[var(--radix-popover-trigger-width)] min-w-[240px] max-h-[280px] overflow-y-auto",children:$e.map(o=>e.jsxs("button",{type:"button",onClick:()=>{W(o.id),$(!1)},className:"group flex w-full items-center gap-2 rounded-[6px] px-3 py-[6px] text-sm cursor-pointer hover:bg-primary/20 text-left",children:[o.isPrivate?e.jsx(Je,{className:"w-[20px] h-[20px] opacity-50 flex-shrink-0"}):e.jsx(Te,{className:"w-[20px] h-[20px] opacity-50 flex-shrink-0"}),e.jsx("span",{className:"flex-1 truncate",children:o.name}),o.id===y&&e.jsx(Dt,{})]},o.id))})]})})(),e.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[e.jsx(Lt,{value:"delete"}),k("delete_everything")]})]}),e.jsxs(Or,{className:"pt-2",children:[e.jsx("button",{onClick:()=>{ae(!1),Ue(null),W(null),Fe(!1)},className:"px-4 py-1.5 text-sm text-muted-foreground hover:text-foreground rounded-[6px]",children:je("cancel")}),e.jsx("button",{onClick:()=>ur(y!==null),className:"rounded-[6px] bg-primary px-4 py-1.5 text-sm font-semibold text-primary-foreground",children:k(y!==null&&nt?"move_and_delete":"delete")})]})]})}),e.jsx(Tt,{open:ve,onOpenChange:be,onCreateBoard:(r,o,i)=>c(r,o,i),hasDefaultBoard:g.some(r=>r.isDefault)}),e.jsx(Tt,{open:Se,onOpenChange:r=>{!r&&_t||(de(r),r||j(null))},onCreateBoard:()=>{},onEditBoard:(r,o,i)=>{a&&N(a.id,r,o,i)},onDelete:dr,editingBoard:a,hasDefaultBoard:g.some(r=>r.isDefault),deleting:_t}),I&&e.jsx(zr,{open:m,onOpenChange:v,entityId:I,target:"organization",currentBannerUrl:L,currentCrop:J,currentBannerGradient:te,fallbackBrandColor:b,onSaved:(r,o,i,u,w)=>{H(r),Y(w||""),q(o),typeof u=="string"&&n(u)}}),e.jsx(Kr,{open:ie,onOpenChange:Ne,activeBoard:f,onSetBoardTextTransform:E,accountKind:"business",userId:De.currentUserId??null,orgId:I||null,onImported:X}),I&&_&&e.jsx(vs,{open:rr,onOpenChange:ut,boardId:_,boardName:(f==null?void 0:f.name)??"",orgId:I,onCountChanged:Qe}),cr&&e.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/70 backdrop-blur-sm","aria-busy":"true","aria-live":"polite",children:e.jsxs("div",{className:"flex items-center gap-3 rounded-[12px] bg-card px-4 py-3 text-sm text-foreground",style:{boxShadow:"0 0 0 1px var(--ring-base), 0 8px 24px var(--ring-soft)"},children:[e.jsx(Xe,{className:"h-4 w-4 animate-spin text-foreground
7/70"}),e.jsx("span",{children:vt?`${k("deleting_board")} "${vt}"`:k("deleting_board")})]})}),e.jsx(Vr,{open:yt!==null,mode:it,onOpenChange:r=>{r||ot(null)},onConfirm:()=>{const r=yt;ot(null),r&&(async()=>(await se({boards_sort:"manual"}),await re(r)))()}})]})}function xa(){const g=Lr(),[f,_]=Qt();er();const[O,C]=s.useState(!1),[N,c]=s.useState(null),t=Yr(),{requirePro:P,ready:E,isPro:V}=Vt(),{activeVideoUrl:re,setVideoBoardId:X,setCurrentBoardId:z}=Tr(),[S,A]=s.useState(""),[Z,ce]=s.useState(!1),[R,_e]=s.useState(!1),[ye,xe]=s.useState([]),k=s.useRef(),[je,we]=s.useState(!1),Q="linkers-collapse-by-board",U=t.activeBoardId,ee=s.useCallback(()=>{try{const n=localStorage.getItem(Q);if(!n)return{};const l=JSON.parse(n);return l&&typeof l=="object"?l:{}}catch{return{}}},[]),T=s.useCallback(n=>{try{localStorage.setItem(Q,JSON.stringify(n))}catch{}},[]),[he,ue]=s.useState({}),[K,Be]=s.useState("expand-all"),[fe,Ce]=s.useState(null);if(U&&fe!==U){const l=ee()[U],d={};l&&Object.entries(l.map||{}).forEach(([b,p])=>{(p==="collapsed"||p==="peek"||p==="expanded")&&(d[b]=p)}),ue(d),Be(l&&(l.global==="expand-all"||l.global==="peek-all"||l.global==="collapse-all")?l.global:"expand-all"),Ce(U)}const se=s.useCallback((n,l)=>{if(!U)return;const d=ee();d[U]={map:n,global:l},T(d)},[U,ee,T]);s.useEffect(()=>{try{localStorage.removeItem("linkers-collapsed-categories"),localStorage.removeItem("linkers-global-collapse-mode"),localStorage.removeItem("linkers-collapse-snapshot")}catch{}},[]),s.useEffect(()=>{U&&(!t.categories||t.categories.length===0||ue(n=>{const l={...n};let d=!1;return t.categories.forEach(b=>{Object.prototype.hasOwnProperty.call(n,b.id)||K==="expand-all"||(K==="collapse-all"?(l[b.id]="collapsed",d=!0):K==="peek-all"&&(b.kind==="tasks"?Number.MAX_SAFE_INTEGER:b.links.filter(h=>!h.isSeparator||h.isTitle).length)>4&&(l[b.id]="peek",d=!0))}),d?(se(l,K),l):n}))},[t.categories,K,U,se]);const le=["Links","Black Hole","Activity","Following","Followers"],ae=f.get("tab"),y=ae&&le.includes(ae)?ae:"Links",[W,ge]=s.useState("all"),$=s.useCallback(n=>{n==="Links"?_({},{replace:!0}):_({tab:n},{replace:!0})},[_]),ve=!!Xt(),be=s.useCallback((n,l)=>{ue(d=>{const b=d[n],p=l??"expanded";if(b===p)return d;const h={...d};return h[n]=p,se(h,K),h})},[se,K]),Se=s.useCallback(()=>{Be(n=>{const l=n==="expand-all"?"peek-all":n==="peek-all"?"collapse-all":"expand-all";return ue(()=>{let d;return l==="expand-all"?d={}:l==="peek-all"?(d={},t.categories.forEach(b=>{(b.kind==="tasks"||b.links.filter(h=>!h.isSeparator||h.isTitle).length>4)&&(d[b.id]="peek")})):(d={},t.categories.forEach(b=>{d[b.id]="collapsed"})),se(d,l),d}),l})},[t.categories,se]),de=s.useMemo(()=>({cycleGlobal:Se,globalMode:K,hasSnapshot:!1}),[Se,K]);s.useEffect(()=>{x.auth.getSession().then(({data:{session:l}})=>{l?(C(!0),c(l.user.id)):g("/auth",{replace:!0})});const{data:{subscription:n}}=x.auth.onAuthStateChange((l,d)=>{d&&(C(!0),c(d.user.id))});return()=>n.unsubscribe()},[g]),s.useEffect(()=>{if(!O)return;let n=!1;return(async()=>{const{data:{session:l}}=await x.auth.getSession();if(!l||n)return;const{data:d}=await x.from("profiles").select("id, welcome_confetti_shown_at").eq("user_id",l.user.id).eq("profile_type","personal").maybeSingle();if(n||!d||d.welcome_confetti_shown_at)return;await x.from("profiles").update({welcome_confetti_shown_at:new Date().toISOString()}).eq("id",d.id);const{getWelcomeConfettiColors:b}=await Pr(async()=>{const{getWelcomeConfettiColors:F}=await import("./welcomeConfettiColors-B-RNNCOM.js");return{getWelcomeConfettiColors:F}},__vite__mapDeps([0,1,2])),p=b(),h=(F,ie)=>Hr({particleCount:120,spread:360,startVelocity:35,origin:{x:F,y:ie},colors:p,scalar:2.2,ticks:250}),M=(F,ie)=>F+Math.random()*(ie-F);[()=>h(.02,M(.35,.65)),()=>h(.98,M(.35,.65)),()=>h(M(.3,.7),.02)].sort(()=>Math.random()-.5).forEach((F,ie)=>{const Ne=ie===0?0:M(180,360)*ie;setTimeout(F,Ne)})})(),()=>{n=!0}},[O]);const a=s.useRef(null);s.useEffect(()=>{re&&re!==a.current&&t.activeBoardId&&X(t.activeBoardId),a.current=re},[re,t.activeBoardId,X]),s.useEffect(()=>{z(t.activeBoardId)},[t.activeBoardId,z]);const j=s.useCallback(n=>{if(!(y==="Black Hole"&&n.trim()&&E&&!V&&!P("blackHoleSearch"))){if
7(A(n),n.trim()&&we(!0),k.current&&clearTimeout(k.current),!n.trim()){xe([]),ce(!1);return}if(y==="Black Hole"){ce(!1);return}ce(!0),k.current=setTimeout(async()=>{const l=await t.searchAllBoards(n);xe(l),ce(!1)},300)}},[t.searchAllBoards,y,E,V,P]),m=s.useCallback(n=>{_e(n),n||(A(""),xe([]),we(!1))},[]),v=s.useRef(null),L=s.useCallback(n=>{var l,d,b;if($(n),m(!1),n==="Black Hole"&&t.blackHoleBoard)t.activeBoardId&&t.activeBoardId!==t.blackHoleBoard.id&&(v.current=t.activeBoardId),t.switchBoard(t.blackHoleBoard.id);else if((n==="Links"||n==="Activity"||n==="Followers"||n==="Following")&&t.blackHoleBoard&&t.activeBoardId===t.blackHoleBoard.id){const h=v.current&&v.current!==((l=t.blackHoleBoard)==null?void 0:l.id)?v.current:(b=(d=t.boards)==null?void 0:d[0])==null?void 0:b.id;v.current=null,h&&t.switchBoard(h)}},[m,t.blackHoleBoard,t.activeBoardId,t.switchBoard,t.boards]),H=s.useRef(!1);s.useEffect(()=>{if(H.current||!t.blackHoleBoard)return;f.get("tab")==="Black Hole"&&t.activeBoardId!==t.blackHoleBoard.id&&(t.activeBoardId&&(v.current=t.activeBoardId),t.switchBoard(t.blackHoleBoard.id)),H.current=!0},[t.blackHoleBoard,t.activeBoardId,t.switchBoard,f]),s.useEffect(()=>{t.blackHoleBoard&&t.activeBoardId&&t.activeBoardId!==t.blackHoleBoard.id&&(v.current=t.activeBoardId)},[t.activeBoardId,t.blackHoleBoard]),s.useEffect(()=>{t.blackHoleBoard&&H.current&&(y==="Activity"||y==="Followers"||y==="Following"||(t.activeBoardId===t.blackHoleBoard.id&&y!=="Black Hole"?$("Black Hole"):t.activeBoardId&&t.activeBoardId!==t.blackHoleBoard.id&&y==="Black Hole"&&$("Links")))},[t.activeBoardId,t.blackHoleBoard,y,t.boards]),s.useEffect(()=>{if(!R)return;const n=l=>{var d;l.key==="Escape"&&((d=document.activeElement)==null||d.blur(),m(!1))};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[R,m]),s.useEffect(()=>{const n=d=>{var p;const b=(p=d.detail)==null?void 0:p.boardId;b&&t.switchBoard&&t.switchBoard(b)};window.addEventListener("navigate-to-video-board",n);const l=sessionStorage.getItem("navigate_to_board");return l&&(sessionStorage.removeItem("navigate_to_board"),t.switchBoard(l)),()=>window.removeEventListener("navigate-to-video-board",n)},[t.switchBoard]),s.useEffect(()=>{const n=()=>{const p=t.boards;if(!p||p.length===0)return;const h=p.find(M=>M.isDefault&&!M.isBlackHole)??p.find(M=>!M.isBlackHole);h&&(h.id!==t.activeBoardId&&t.switchBoard(h.id),$("Links"))},l=f.get("__keepSlug");if(l){const p=new URLSearchParams(f);p.delete("__keepSlug");const h=p.get("b")==="default";h&&p.delete("b"),_(p,{replace:!0});try{const M=p.toString();window.history.replaceState(null,"",`/${l}${M?`?${M}`:""}`)}catch{}h&&n()}else if(f.get("b")==="default"){const p=new URLSearchParams(f);p.delete("b"),_(p,{replace:!0}),n()}window.addEventListener("logo-go-default-board",n);const d=()=>{const p=t.boards,h=t.blackHoleBoard;if(p&&h&&t.activeBoardId===h.id){const M=p.find(oe=>oe.isDefault&&!oe.isBlackHole)??p.find(oe=>!oe.isBlackHole);M&&t.switchBoard(M.id)}$("Links")};window.addEventListener("linkers-go-links-tab",d);const b=p=>{var oe,F,ie;const h=p.detail;!(h!=null&&h.boardId)||h.boardId===t.activeBoardId||!((oe=t.boards)!=null&&oe.some(Ne=>Ne.id===h.boardId)||((F=t.blackHoleBoard)==null?void 0:F.id)===h.boardId)||(t.switchBoard(h.boardId),$(((ie=t.blackHoleBoard)==null?void 0:ie.id)===h.boardId?"Black Hole":"Links"),window.dispatchEvent(new CustomEvent("linkers-active-board-changed")))};return window.addEventListener("linkers-switch-board",b),()=>{window.removeEventListener("logo-go-default-board",n),window.removeEventListener("linkers-go-links-tab",d),window.removeEventListener("linkers-switch-board",b)}},[t.boards,t.blackHoleBoard,t.activeBoardId,t.switchBoard,f,_,$]),s.useEffect(()=>{const n=l=>{if(!l.metaKey||l.key!=="ArrowDown"&&l.key!=="ArrowUp"||Ar(l.target)||y==="Black Hole")return;const d=t.boards;if(!d||d.length<2)return;l.preventDefault();const b=d.findIndex(h=>h.id===t.activeBoardId);let p;l.key==="ArrowDown"?p=b===-1?0:(b+1)%d.length:p=b<=0?d.length-1:b-1,t.switchBoard(d[p].id)};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[t.boards,t.activeBoardId,t.switchBoard,y]);const J=R&&je&&!(y==="Black Hole")&&!(y==="Following"||y==="Followers"),q=async(n,l)=>{await t.refreshAfterImport(l)},te=e.jsxs(e.Fragment,{children:[e.jsx(gs,{userId:N,onImported:()=>t.refreshAfterImport(null)}),ve?e.jsx(ks,{boards:t.boards,activeBoard:t.activeBoard,activeBoardId:t.activeBoardId,categories:t.categories,onSwitchBoard:t.switchBoard,onAddBoard:t.addBoard,onEditBoard:t.editBoard,onRenameBoard:t.renameBoard,onToggleBoardPrivate:t.toggleBoardPrivate,onSetBoardTextTransform:t.setBoardTextTransform,onDeleteBoard:t.deleteBoard,onReorderBoards:t.reorderBoards,onImportCompleted:q,searchQuery:S,onSearchQueryChange:j,isSearchOpen:R,onSearchOpenChange:m,isSaving:t.isSaving,isLoaded:t.loaded}):e.jsx(Zr,{boards:t.boards,activeBoard:t.activeBoard,activeBoardId:t.activeBoardId,categories:t.categories,blackHoleBoard:t.blackHoleBoard,activeTab:y,onTabChange:L,onSwitchBoard:t.switchBoard,onAddBoard:t.addBoard,onEditBoard:t.editBoard,onRenameBoard:t.renameBoard,onToggleBoardPrivate:t.toggleBoardPrivate,onSetBoardTextTransform:t.setBoardTextTransform,onDeleteBoard:t.deleteBoard,onReorderBoards:t.reorderBoards,onImportCompleted:q,searchQuery:S,onSearchQueryChange:j,isSearchOpen:R,onSearchOpenChange:m,isSaving:t.isSaving,isLoaded:t.loaded}),y==="Activity"?W==="upvotes"?e.jsxs("div",{className:"mx-auto flex w-full max-w-[760px] flex-col px-6 py-8 gap-[40px] pt-[40px] pb-[200px]",children:[e.jsx(Ht,{tab:W,onChange:ge,isOwn:!0}),e.jsx(ms,{userId:N??void 0})]}):e.jsx(fs,{userId:N,includeUpvotes:W==="all",header:e.jsx(Ht,{tab:W,onChange:ge,isOwn:!0})}):y==="Following"?e.jsx(Mt,{mode:"following"}):y==="Followers"?e.jsx(Mt,{mode:"followers"}):J?e.jsx(ns,{query:S,boardResults:ye,isSearching:Z,onNavigateToCategory:async(n,l)=>{var b;const d=(b=t.allBoards)==null?void 0:b.find(p=>p.id===n);d!=null&&d.isBlackHole?$("Black Hole"):$("Links"),m(!1),n!==t.activeBoardId&&await t.switchBoard(n),setTimeout(()=>{window.dispatchEvent(new CustomEvent("linkers-highlight-target",{detail:{boardId:n,categoryId:l}}))},100)}}):e.jsx(Wr,{boardHook:t,searchFilter:S,onTabChange:L,collapsedCategories:he,onCategoryCollapseChange:be})]});return e.jsx(Jr,{value:de,children:e.jsx("div",{className:"min-h-screen bg-card",style:{overflowX:"clip"},children:e.jsx("div",{className:"mx-auto w-full max-w-[var(--container-max)]",children:ve?e.jsx(Xr,{activeBoardId:t.activeBoardId,children:te}):te})})})}export{xa as default};

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.