1import{j as e}from"./app-C1iegf7Q.js";import{b as c,H as _,L as k}from"./inertia-BpyZy4w-.js";import{u as C,W as D,D as E,a as I}from"./document-canvas-DXwi1o4d.js";import{R as S}from"./types-DLz3dvCT.js";import{C as A}from"./case-shell-EPUgGCr1.js";import{W as M}from"./workspace-layout-Cg9ak8v1.js";import{A as O}from"./arrow-left-DCX0fhKH.js";import{M as U}from"./message-square-E9C1K8Gx.js";import{D as b}from"./download-CXbkSkxk.js";import{P as j}from"./pen-line-DxMOfwPU.js";/* empty css */import"./sheet-DNayBxlr.js";import"./index-BewtL6Hn.js";import"./index-Dc_FVRD7.js";import"./index-CGXdj8xB.js";import"./index-C_n-C52S.js";import"./index-CL12STDK.js";import"./index-XydtsrKA.js";import"./index-BDqbV96p.js";import"./index-Cja0wFUH.js";import"./Combination-Cr5kvm8y.js";import"./index-B1PKR-s8.js";import"./utils-BiuKVCuu.js";import"./x-DQSeRCcH.js";import"./createLucideIcon-wqc1LSWg.js";import"./history-29VTm3ac.js";import"./paperclip-Cc7CaGPI.js";import"./check-0O-UND6N.js";import"./circle-alert-D8tEThd5.js";import"./chevron-down-B1YaU0K5.js";import"./document-builder-5UH2XUUr.js";import"./trash-2-CrI9a2Po.js";import"./loader-circle-C_KBZAGS.js";import"./sparkles-C0aC1RHI.js";import"./image-plus-Drz-1lbN.js";import"./plus-BJl-aJiX.js";import"./triangle-alert-C7AVwNi-.js";import"./index-DJlprK4q.js";import"./index-DV0GpYST.js";import"./index-B9qJRYKv.js";import"./link-DKPEjeqT.js";import"./list-BgP0xxm1.js";import"./mobile-chrome-C0ug21w9.js";import"./shield-alert-CGX6PHoz.js";import"./menu-BR3Nc3Gr.js";import"./message-circle-c43k_fjC.js";import"./app-logo-Dz0wogSq.js";import"./logo-light-DU4bWymm.js";import"./flash-toast-C6O0iVL1.js";import"./info-D2ZN_yLm.js";import"./circle-x-Bp6Mbpgt.js";import"./circle-check-BMWvzPMx.js";import"./site-announcement-fVSM8f3a.js";import"./use-funnel-tracking-DZvQDmiU.js";import"./journey-labels-D75PCX0v.js";import"./bell-BvDZckLh.js";import"./button-BE4q1_FS.js";import"./file-text-XcQuIA-l.js";import"./mail-Dwbp3545.js";import"./house-XJaf3ukP.js";import"./briefcase-CaOXuslt.js";import"./users-BCcupCXV.js";import"./calendar-check-Qh7pLIha.js";import"./layout-grid-PlAvcMDs.js";import"./book-open-DVFlG_9t.js";import"./calendar-days-CT1ztEQ-.js";import"./circle-help-CLje27Z2.js";function Ke({case:n,document:t,asks:w,viewer:l}){const{comments:o,count:d,reload:u}=C(n.uuid,t.id),[v,a]=c.useState(!1),m=t.review_status?S[t.review_status]:null,x=[t.version>1?`Version ${t.version}`:null,t.updated_at?`Updated ${t.updated_at}`:null].filter(Boolean),[p,N]=c.useState(null);function h(s,r){const i=p===s?null:s;N(i),i!==null&&(r==="text"&&a(!0),window.setTimeout(()=>{window.document.getElementById(r==="text"?`comment-${s}`:`anchor-${s}`)?.scrollIntoView({behavior:"smooth",block:"center"})},r==="text"?120:0))}const y=c.useMemo(()=>{const s=new Map;return(o??[]).forEach(r=>{const i=r.anchor;if(!i||i.state==="orphaned"||i.item===null||i.start===null||i.end===null||r.resolved)return;const g=s.get(i.item)??[];g.push({commentId:r.id,awaiting:r.awaiting_answer,start:i.start,end:i.end}),s.set(i.item,g)}),s},[o]),f=e.jsxs(e.Fragment,{children:[e.jsx(_,{title:[t.name,n.title].filter(Boolean).join(" · ")}),e.jsx("div",{className:"sticky top-0 z-10 border-b border-line bg-bg/90 backdrop-blur",children:e.jsxs("div",{className:"mx-auto flex w-full max-w-2xl items-center justify-between gap-3 px-4 py-3 sm:px-6",children:[e.jsxs(k,{href:`/cases/${n.uuid}?tab=documents`,className:"inline-flex min-w-0 items-center gap-1.5 text-sm text-ink-2 no-underline hover:text-ink",children:[e.jsx(O,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"truncate",children:"All documents"})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>a(!0),className:"flex items-center gap-1.5 rounded-md px-2 py-1.5 text-sm font-medium text-ink-2 hover:bg-bg-2 hover:text-ink",children:[e.jsx(U,{className:"h-3.5 w-3.5"}),d>0?d:"Comment"]}),e.jsxs("a",{href:t.download_url,className:"flex items-center gap-1.5 rounded-md px-2 py-1.5 text-sm font-medium text-ink-2 no-underline hover:bg-bg-2 hover:text-ink",children:[e.jsx(b,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Download"})]})]})]})}),e.jsxs("div",{className:"mx-auto w-full max-w-2xl px-4 pt-8 pb-16 sm:px-6",children:[e.jsx("h1",{className:"m-0 font-display text-2xl font-semibold tracking-display text-ink",children:t.name}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-2 gap-y-1",children:[m&&e.jsx("span",{className:`rounded-full px-2 py-0.5 text-2xs font-medium ${m.className}`,children:l.is_specialist?m.specialist:m.client}),x.length>0&&e.jsx("span",{className:"text-2xs text-ink-3",children:x.join(" · ")})]}),e.jsx("div",{className:"mt-6",children:e.jsx(D,{reviewNotes:t.review_notes,asks:w,caseUuid:n.uuid,canResolveAsks:l.can_resolve_asks,commentsAwaiting:(o??[]).filter(s=>s.awaiting_answer&&!s.resolved).length,findings:(o??[]).filter(s=>s.author_role==="agent"&&!s.resolved).length,onOpenComments:()=>a(!0)})}),e.jsx("div",{className:"mt-6",children:t.sections.length===0?e.jsxs("article",{className:"rounded-card border border-line bg-surface px-5 py-7 sm:px-8 sm:py-9",children:[e.jsx("p",{className:"m-0 text-sm text-ink-3",children:"This is a file rather than something written here, so there is nothing to lay out on the page. Download it to read it. Anything said about it stays here."}),e.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[e.jsxs("a",{href:t.download_url,className:"inline-flex items-center gap-1.5 rounded-md bg-ink px-3 py-2 text-sm font-semibold text-white no-underline hover:opacity-90",children:[e.jsx(b,{className:"h-3.5 w-3.5"}),"Download the file"]}),t.derived_url?e.jsxs("a",{href:t.derived_url,className:"inline-flex items-center gap-1.5 rounded-md border border-line bg-surface px-3 py-2 text-sm font-semibold text-ink no-underline hover:bg-bg-2",children:[e.jsx(j,{className:"h-3.5 w-3.5"}),"Open our version"]}):t.edit_url&&e.jsxs("a",{href:t.edit_url,className:"inline-flex items-center gap-1.5 rounded-md border border-line bg-surface px-3 py-2 text-sm font-semibold text-ink no-underline hover:bg-bg-2",children:[e.jsx(j,{className:"h-3.5 w-3.5"}),"Edit with the document editor"]})]}),t.edit_url&&!t.derived_url&&e.jsx("p",{className:"m-0 mt-3 text-xs text-ink-3",children:"Editing writes a new document and leaves this file as it is."})]}):e.jsx(E,{canWrite:!1,title:t.name,sections:t.sections.map(s=>({heading:s.heading,text:s.text})),marks:y,selectedMarkId:p,onSelectMark:s=>h(s,"text"),askAbout:{caseUuid:n.uuid,documentId:t.id},onCommented:u,busyKey:null,onSectionChange:()=>{},onUpload:()=>{},onRemove:()=>{}})})]}),e.jsx(I,{caseUuid:n.uuid,documentId:t.id,comments:o,count:d,reload:u,open:v,onOpenChange:a,trigger:!1,selectedId:p,onSelectComment:s=>h(s,"card")})]});return l.is_specialist?e.jsx(M,{activeCaseUuid:n.uuid,mode:"specialist",children:f}):e.jsx(A,{caseTitle:n.title,children:f})}export{Ke 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.