PageSourceSearch

https://www.claritytext.com/assets/index-DT0YlN5u.js

js claritytext.com collected 2026-10-06 19:15:05 UTC 11,090 bytes, 1 lines download raw bytes

1import{r as m,b8 as A,g as Z,b as ee,d as I,f as B,j as e,af as te,h as M,B as i,e as R,v as se}from"./index-CEICSZH3.js";import{u as U}from"./useMutation-BoJf7Q0x.js";import{u as r}from"./index-9ekvDUEI.js";import{M as ae}from"./mobile-header-eIe7gFJ7.js";import{c as ie,d as re,M as V,b as H,T as le}from"./ThreadPanel-DK2Q4HrM.js";import{H as x}from"./Hint-C4bZ9M-u.js";import{L as ne}from"./lock-htDWsVwe.js";import{L as S}from"./loader-Bi0vqCr0.js";import{S as K}from"./resolve-link-previews-B6hSc7Q2.js";import{T as C}from"./trash-2-DX-dAXX9.js";import{A as ce}from"./arrow-left-BXumoHl3.js";import"./upload-0DzY66NM.js";import"./TiptapRenderer-BGH1zeIG.js";import"./marked.esm-CTUjwhkM.js";import"./index-CjV1Ku3_.js";import"./index-neggDRuG.js";import"./index-CzA8e4mu.js";import"./external-link-DYX4qQDa.js";import"./x-DIA7SGvz.js";import"./Avatar-DTnaPksM.js";import"./use-confirmation-modal-Dy7xSTws.js";import"./Dialog-k-DMaIjK.js";import"./index-BrNTAy6o.js";import"./index-NIl66QT_.js";import"./use-generate-upload-url-CfkJHgzx.js";import"./plus-FCOoRdDR.js";import"./formatDistanceToNow-B7rK7FfG.js";import"./differenceInMilliseconds-Ds9usTTZ.js";import"./chevron-right-w4SgVMu2.js";import"./check-CAzrrcvM.js";import"./use-mobile-Bgp70DVp.js";import"./sparkles-DfNlnjXV.js";import"./ToolTip-BhZ5x_WK.js";import"./index-hSFgIXJH.js";import"./DropDownMenu-Di0YDLnU.js";import"./index-CTmfg9iv.js";import"./index-D-1LxxNN.js";import"./Input-BYQ_I0qJ.js";import"./strikethrough-FStRjCdz.js";import"./heading-3-BlPPEJED.js";import"./chevron-down-BD1AWD-4.js";import"./link-D-HfZX8s.js";import"./PopOver-DjeW-Usj.js";import"./copy-DYVrDaQf.js";import"./pencil-CjhhY00D.js";import"./trash-B2nV89Px.js";function tt(){const[l,P]=m.useState(!1),[_,b]=m.useState(!1),[j,p]=m.useState(!1),[z,u]=m.useState(""),[w,D]=m.useState(!1),[y,v]=ie(1e3),{spaceId:c,threadId:N}=A.useParams(),{scrollToMessageId:T}=A.useSearch(),o=Z(),n=ee(I.spaces.threads.populateThreadPage,{threadId:N},{skipClientSideAuthCheck:!0}),t=n?.data?.thread,f=n?.data?.spaceVisibility,a=n?.data?.messageLocation??null,E=n?.isPending??!1,Y=n?.isError??!1,G=n?.isPending??!1,Q=n?.isPending??!1,{data:d}=re({spaceId:c}),{mutateAsync:q}=U({mutationFn:B(I.spaces.threads.deleteThread),onMutate:()=>{D(!0)},onSuccess:()=>{D(!1),r.success("Thread deleted successfully"),o(a?{to:"/space/$spaceId/channel/$channelId",params:{spaceId:c,channelId:a.channelId},search:se(a.messageId)}:{to:"/spaces"})},onError:()=>{r.error("Failed to delete thread")}}),{mutateAsync:J}=U({mutationFn:B(I.spaces.threads.updateThread),onSuccess:()=>{r.success("Thread updated successfully")},onError:()=>{r.error("Failed to update thread")}});m.useEffect(()=>{t&&!j&&u(t.titlePlainText||t.title||"")},[t,j]);const L=async()=>{try{v();const g=`${window.location.origin}/share/space/${c}/thread/${N}`;await navigator.clipboard.writeText(g),r.success("Thread link copied to clipboard!")}catch(s){console.error("Failed to copy thread URL:",s),r.error("Failed to copy link to clipboard")}},$=()=>{d&&p(!0)},F=async()=>{if(!t)return;if(!d){r.error("You must be logged in to edit thread titles"),p(!1),u(t.titlePlainText||t.title||"");return}const s=z.trim()||"Thread Title",g=t.titlePlainText||t.title||"Thread Title";if(s===g){p(!1);return}try{await J({threadId:t._id,title:s}),p(!1),r.success("Thread title updated")}catch{r.error("Failed to update thread title"),u(t.titlePlainText||t.title||"")}},O=()=>{u(t?.titlePlainText||t?.title||""),p(!1)},W=s=>{s.key==="Enter"?(s.preventDefault(),F()):s.key==="Escape"&&O()},X=async()=>{if(!(!t||!k))try{await q({threadId:t._id})}catch(s){console.error("Error deleting thread:",s)}},k=t&&d&&(t.createdBy===d._id||!!n?.data?.canManageSpaceChannels);if(Y&&!E)return e.jsx("div",{className:"flex items-center justify-center min-h-[100dvh] w-full p-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx(te,{className:"h-12 w-12 text-red-500 mx-auto mb-4"}),e.jsx("h1",{className:"text-xl font-semibold text-gray-900 mb-2",children:"Invalid Thread ID"}),e.jsx("p",{className:"text-gray-600 mb-4",children:"The thread ID in the URL is not val
1id or the thread doesn't exist."}),e.jsx("button",{type:"button",onClick:()=>o({to:"/space/$spaceId",params:{spaceId:c},search:M()}),className:"px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors",children:"Back to Space"})]})});if(f&&!f.isPublic&&!f.isMember)return e.jsx("div",{className:"flex items-center justify-center min-h-[100dvh] w-full p-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx(ne,{className:"h-12 w-12 text-gray-500 mx-auto mb-4"}),e.jsx("h1",{className:"text-xl font-semibold text-gray-900 mb-2",children:"Private Thread Forbidden"}),e.jsx("p",{className:"text-gray-600 mb-4",children:"This thread is in a private space. You need to be a member to view it."}),e.jsx("button",{type:"button",onClick:()=>o({to:"/spaces"}),className:"px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors",children:"Go to Spaces"})]})});if(E||G||Q)return e.jsx("div",{className:"flex items-center justify-center min-h-[100dvh] w-full p-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx(S,{className:"h-8 w-8 animate-spin text-blue-600 mx-auto mb-4"}),e.jsx("h1",{className:"text-xl font-semibold text-gray-900 mb-2",children:"Loading thread..."}),e.jsx("p",{className:"text-gray-600",children:"Please wait while we load the thread for you."})]})});if(t&&a&&f){const s=e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(x,{label:"Share thread",children:e.jsx(i,{variant:"ghost",size:"icon",onClick:()=>{(async()=>(await L(),v()))()},className:R("h-9 w-9 text-muted-foreground hover:text-foreground",y&&"text-emerald-400"),children:e.jsx(K,{className:`h-4 w-4 ${y?"text-green-600":""}`})})}),k&&e.jsx(x,{label:"Delete thread",children:e.jsx(i,{variant:"ghost",size:"icon",onClick:()=>b(!0),className:"h-9 w-9 text-red-600 hover:text-red-900",children:e.jsx(C,{className:"h-4 w-4"})})}),e.jsx(x,{label:l?"Minimize thread":"Maximize thread",children:e.jsx(i,{variant:"ghost",size:"icon",onClick:()=>P(!l),className:"h-9 w-9 text-gray-600 hover:text-gray-900",children:l?e.jsx(V,{className:"h-4 w-4"}):e.jsx(H,{className:"h-4 w-4"})})})]}),g=R("flex w-full flex-col overflow-hidden bg-white min-h-0",l?"absolute inset-0 z-50 h-full sm:fixed sm:inset-0 sm:z-50 sm:h-screen":"flex-1 h-full sm:static sm:h-screen");return e.jsxs("div",{className:g,children:[e.jsx("div",{className:"sm:hidden",children:e.jsx(ae,{title:t.titlePlainText||t.title||"Thread Title",subtitle:`In #${a.channelName||"channel"}`,backAction:()=>o({to:"/space/$spaceId/channel/$channelId",params:{spaceId:c,channelId:a.channelId},search:M()}),trailing:s})}),e.jsxs("div",{className:"hidden sm:flex group items-center justify-between gap-0.5 sm:gap-1 md:gap-2 p-1 md:p-2 border-b border-gray-200 bg-white sticky top-0 z-50 w-full",children:[e.jsxs("div",{className:"flex items-center gap-0.5 sm:gap-1 md:gap-2 min-w-0 flex-1",children:[e.jsxs(i,{variant:"ghost",size:"sm",onClick:()=>o({to:"/space/$spaceId/channel/$channelId",params:{spaceId:c,channelId:a.channelId},search:M()}),className:"flex items-center gap-0.5 sm:gap-1 text-gray-600 hover:text-gray-900 shrink-0 p-1 h-8 w-8 justify-center md:w-auto",children:[e.jsx(ce,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden lg:inline",children:l?"Minimize":"View Channel"})]}),e.jsx("div",{className:"h-4 w-px bg-gray-300 shrink-0 opacity-30 hidden sm:block"}),e.jsx("div",{className:"min-w-0 flex-1",children:j&&d?e.jsx("input",{ref:h=>{h&&setTimeout(()=>h.focus(),0)},type:"text",value:z,onChange:h=>u(h.target.value),onKeyDown:W,onBlur:F,className:"text-base md:text-lg font-semibold text-gray-900 bg-transparent border-b border-blue-500 focus:outline-none w-full"}):e.jsxs("div",{className:"flex flex-col",children:[d?e.jsx("button",{className:"text-base md:text-lg font-semibold text-foreground whitespace-normal text-left hover:text-primary transition-colors cursor-pointer",onClick:$,onKeyDown:h=>h.key==="Enter"&&$(),title:t.titlePlainText||t.title||"Thread Title",type:"button",children:t.titlePlainText||t.title||"Thread Title"}):e.jsx("div",{className:"text-base md:text-lg font-semibold text-gray-900 whitespace-normal",children:t.titlePlainText||t.title||"Thread Title"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["In #",a.channelName||"channel"]})]})})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx(x,{label:"Share thread",children:e.jsx(i,{variant:"ghost",size:"sm",onClick:()=>{(async()=>(await L(),v()))()},className:"h-7 w-7 sm:h-8 sm:w-8 p-0 text-gray-600 hover:text-gray-900 shrink-0 rounded",children:e.jsx(K,{className:`h-3 w-3 sm:h-4 sm:w-4 ${y?"text-green-600":""}`})})}),k&&e.jsx(x,{label:"Delete thread",children:e.jsx(i,{variant:"ghost",size:"sm",onClick:()=>b(!0),className:"h-7 w-7 sm:h-8 sm:w-8 p-0 text-red-600 hover:text-red-900 hover:bg-red-50 shrink-0 rounded",children:e.jsx(C,{className:"h-3 w-3 sm:h-4 sm:w-4"})})}),e.jsx(x,{label:l?"Minimize thread":"Maximize thread",children:e.jsx(i,{variant:"ghost",size:"sm",onClick:()=>P(!l),className:"h-7 w-7 sm:h-8 sm:w-8 p-0 text-gray-600 hover:text-gray-900 shrink-0 rounded",children:l?e.jsx(V,{className:"h-3 w-3 sm:h-4 sm:w-4"}):e.jsx(H,{className:"h-3 w-3 sm:h-4 sm:w-4"})})})]})]}),e.jsx("div",{className:"flex-1 overflow-hidden min-h-0 flex flex-col bg-background",children:e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(le,{threadId:N,channelId:a.channelId,spaceId:c,scrollToMessageId:T&&T.length===32?T:void 0})})}),_&&e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white rounded-lg p-6 max-w-md w-full mx-4 shadow-xl",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-10 h-10 bg-red-100 rounded-full flex items-center justify-center",children:e.jsx(C,{className:"h-5 w-5 text-red-600"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Delete Thread"}),e.jsx("p",{className:"text-sm text-gray-500",children:"This action cannot be undone!"})]})]}),e.jsx("p",{className:"text-gray-700 mb-6",children:"Are you sure you want to delete this thread?"}),e.jsxs("div",{className:"flex gap-3 justify-end",children:[e.jsx(i,{variant:"ghost",onClick:()=>b(!1),disabled:w,children:"Cancel"}),e.jsx(i,{variant:"destructive",onClick:X,disabled:w,className:"bg-red-600 hover:bg-red-700",children:w?e.jsxs(e.Fragment,{children:[e.jsx(S,{className:"h-4 w-4 animate-spin mr-2"}),"Deleting..."]}):"Delete"})]})]})})]})}return e.jsx("div",{className:"flex items-center justify-center min-h-[100dvh] w-full p-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx(S,{className:"h-8 w-8 animate-spin text-blue-600 mx-auto mb-4"}),e.jsx("h1",{className:"text-xl font-semibold text-gray-900 mb-2",children:"Loading..."}),e.jsx("p",{className:"text-gray-600",children:"Please wait."})]})})}export{tt as component};

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.