1import{j as d}from"./app-C1iegf7Q.js";import{L as W,f}from"./inertia-BpyZy4w-.js";import{S as q}from"./seo-meta-BiuXzdeE.js";import{E as z}from"./evidence-builder-DOSzY-as.js";import{A as V}from"./app-layout-N5SYko6V.js";import{A as G}from"./arrow-left-DCX0fhKH.js";/* empty css */import"./document-canvas-DXwi1o4d.js";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"./download-CXbkSkxk.js";import"./message-square-E9C1K8Gx.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"./pen-line-DxMOfwPU.js";import"./markdown-renderer-CJUAlNY6.js";import"./video-embed-XSCcqTy1.js";import"./index-DnOwzyLg.js";import"./refresh-cw-Cog2DILh.js";import"./ellipsis-dh0qVsjB.js";import"./arrow-right-CQhEyoMD.js";import"./template-specimen-Dl-ug0G8.js";import"./info-D2ZN_yLm.js";import"./link-2-D0ZKUr8N.js";import"./image-vCg-0Xge.js";import"./button-BE4q1_FS.js";import"./unit-badge-B1FxxFNU.js";import"./dialog-DrkalYDs.js";import"./stamp-DioeSsh-.js";import"./file-text-XcQuIA-l.js";import"./zap-Bczke022.js";import"./gauge-DL0bVHaV.js";import"./eye-DoZffUO5.js";import"./upload-C1CGckSw.js";import"./message-square-plus-DhS9yu8k.js";import"./case-shell-EPUgGCr1.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"./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"./guest-nav-Dk8jWUwY.js";function m(){return document.querySelector('meta[name="csrf-token"]')?.content??""}function ge({case:i,criterion:a,guide:v,specimen:h,specimen_url:y,evidence_contract:w,evidence_options:g,proofs:S,min_items:j,document_id:s,can_write:x=!0,asks:C=[],can_resolve_asks:E=!1,review_notes:O=null,editing:A=null,headings_are_labels:T=!1,review_state:N=null,base_version:u=null,initial_items:$,versions:b,working_draft:k,editor_variant:F,profile_owner_name:D=null,criteria:_,moved_from:R,planned_document:L}){async function K({title:e,summary:r,context:o}){const t=await fetch(`/cases/${i.uuid}/draft-evidence-item`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-CSRF-TOKEN":m()},body:JSON.stringify({criterion:a.code,title:e,summary:r,context:o})}),n=await t.json().catch(()=>({}));if(!t.ok)throw new Error(n.message??"Could not create a safe draft.");return typeof n.narrative=="string"?n.narrative:null}async function P(e){const r=new FormData;r.append("document",e);const o=await fetch(`/cases/${i.uuid}/import-evidence`,{method:"POST",headers:{Accept:"application/json","X-CSRF-TOKEN":m()},body:r}),t=await o.json().catch(()=>({}));return o.ok&&Array.isArray(t.items)?{items:t.items,images:t.images??[]}:null}async function X(e,r,o){const t=new FormData;t.append("criterion",a.code),s!==null&&t.append("document_id",String(s)),t.append("context",r),u!==null&&t.append("base_version",String(u)),t.append("version_key",o.key),t.append("version_source",o.source),o.restoredFrom&&t.append("restored_from_key",o.restoredFrom),t.append("items",JSON.stringify(e.map(p=>({title:p.title,narrative:p.narrative})))),e.forEach((p,M)=>
1p.proofs.forEach(l=>l.file&&t.append(`files[${M}][]`,l.file)));const n=await fetch(`/cases/${i.uuid}/build-evidence`,{method:"POST",headers:{Accept:"application/json","X-CSRF-TOKEN":m()},body:t}),c=await n.json().catch(()=>({}));if(!n.ok||!c.redirect)return c.message??"Something went wrong. Please try again.";f.visit(c.redirect)}async function I(e,r,o){const t=await fetch(`/cases/${i.uuid}/review-document-draft`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-CSRF-TOKEN":m()},body:JSON.stringify({document_type:"evidence",version_key:o,criterion:a.code,context:r,sections:e.map(c=>({heading:c.title,text:c.narrative,proof_count:c.proofs.filter(p=>p.file||p.preview).length}))})}),n=await t.json().catch(()=>({}));if(!t.ok)throw new Error(n.message??"Could not review this draft just now.");return n}async function J(e){if(!(await fetch(`/cases/${i.uuid}/document-editor-working-draft`,{method:"PUT",headers:{"Content-Type":"application/json",Accept:"application/json","X-CSRF-TOKEN":m()},body:JSON.stringify({document_type:"evidence",context_key:a.code,version_key:e.key,source:e.source,restored_from_key:e.restoredFrom,items:e.items,editor_context:e.context})})).ok)throw new Error("Autosave failed")}async function B(){if(!(await fetch(`/cases/${i.uuid}/document-editor-working-draft`,{method:"DELETE",headers:{"Content-Type":"application/json",Accept:"application/json","X-CSRF-TOKEN":m()},body:JSON.stringify({document_type:"evidence",context_key:a.code})})).ok)throw new Error("Discard failed")}async function U(e){const r=await fetch(`/cases/${i.uuid}/documents/${s}/move-criterion`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-CSRF-TOKEN":m()},body:JSON.stringify({criterion:e})}),o=await r.json().catch(()=>({}));if(!r.ok||!o.redirect)return o.message??"Could not move this document.";f.visit(o.redirect)}return d.jsxs(V,{children:[d.jsx(q,{title:a.title,description:"An evidence document on your case.",url:`/cases/${i.uuid}/build-evidence`}),d.jsx("div",{className:"px-4 pt-6",children:d.jsxs(W,{href:`/cases/${i.uuid}?tab=documents&focus=${a.code.split(":").pop()}`,className:"inline-flex items-center gap-1.5 text-xs font-medium text-ink-2 hover:text-ink",children:[d.jsx(G,{size:14}),"Back to your case"]})}),d.jsx(z,{title:a.title,subtitle:"Add each contribution for this criterion. We draft its narrative, you add the screenshots that prove it, and it files onto your case as evidence for your specialist to review.",intro:v,plannedDocument:L??void 0,specimen:h,specimenUrl:y,evidenceContract:w,evidenceOptions:g,proofs:S,minItems:j,initialItems:$,metered:null,createLabel:"Save",creatingLabel:"Saving version...",onDraftItem:K,onCreate:X,onImport:P,onReview:I,reviewSuggestionBase:`/cases/${i.uuid}/document-draft-suggestions`,versions:b,versionBase:`/cases/${i.uuid}/document-editor-versions`,workingDraft:k,onAutosave:J,onDiscardDraft:B,downloadUrl:s!==null?`/cases/${i.uuid}/documents/${s}/download`:null,caseUuid:i.uuid,documentId:s,headingsAsLabels:T,canWrite:x,asks:C,canResolveAsks:E,reviewNotes:O,editing:A,reviewState:N,editorVariant:F,profileOwnerName:D,richNarrative:!0,criteria:_,movedFrom:R,onMoveCriterion:s!==null?U:void 0})]})}export{ge 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.