PageSourceSearch

https://app.litmas.ai/_next/static/chunks/9414-21885681764c8d1e.js

js litmas.ai collected 2026-10-05 12:15:16 UTC 127,405 bytes, 1 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="25879acf-f383-4f77-8c4a-509a2d834c11",e._sentryDebugIdIdentifier="sentry-dbid-25879acf-f383-4f77-8c4a-509a2d834c11")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9414],{6178:(e,t,a)=>{function s(e,t){let a=null==e?void 0:e.mediaKind,s=Number(null==e?void 0:e.startMs),n=Number(null==e?void 0:e.endMs),l=null==t?"":String(t);return("video"===a||"audio"===a)&&l&&Number.isFinite(s)&&Number.isFinite(n)&&!(s<0)&&!(n<=s)?{documentId:l,startMs:s,endMs:n,..."string"==typeof e.sourceRevision?{sourceRevision:e.sourceRevision}:{},..."string"==typeof e.ingestionRevision?{ingestionRevision:e.ingestionRevision}:{}}:null}function n(e){return(null==e?void 0:e.mediaKind)==="video"||(null==e?void 0:e.mediaKind)==="audio"}function l(e){return String(null!=e?e:"").trim().replace(/^["“”]+/u,"").replace(/["“”]+$/u,"").trim()}a.d(t,{Cq:()=>l,bR:()=>n,rI:()=>s})},9648:(e,t,a)=>{a.d(t,{Ak:()=>o,IN:()=>s,OX:()=>l,tg:()=>r,xx:()=>c});let s={MTD:"MTD",MTD_RESPONSE:"MTD_RESPONSE",MTD_COUNTERCLAIMS:"MTD_COUNTERCLAIMS",MOTION_IN_LIMINE:"MOTION_IN_LIMINE",MOTION_STRIKE:"MOTION_STRIKE",MOTION_STRIKE_DEFENSES:"MOTION_STRIKE_DEFENSES",MOTION_COMPEL:"MOTION_COMPEL",MOTION_PROTECTIVE:"MOTION_PROTECTIVE",MOTION_RECONSIDERATION:"MOTION_RECONSIDERATION",MOTION_AMEND:"MOTION_AMEND",MOTION_EXTENSION:"MOTION_EXTENSION",MOTION_DEFAULT:"MOTION_DEFAULT",MOTION_OPPOSITION:"MOTION_OPPOSITION",CUSTOM_MOTION:"CUSTOM_MOTION",MSJ_RESPONSE:"MSJ_RESPONSE",DEMAND_LETTER:"DEMAND_LETTER",COMPLAINT:"COMPLAINT",FAMILY_PETITION_DISSOLUTION:"FAMILY_PETITION_DISSOLUTION",FAMILY_RFO_CUSTODY:"FAMILY_RFO_CUSTODY",FAMILY_RFO_CHILD_SUPPORT:"FAMILY_RFO_CHILD_SUPPORT",FAMILY_RFO_SPOUSAL_SUPPORT:"FAMILY_RFO_SPOUSAL_SUPPORT",FAMILY_DV_RESTRAINING_ORDER:"FAMILY_DV_RESTRAINING_ORDER",PROBATE_WILL_CONTEST:"PROBATE_WILL_CONTEST",PROBATE_TRUST_CONTEST:"PROBATE_TRUST_CONTEST",PROBATE_FIDUCIARY_SURCHARGE:"PROBATE_FIDUCIARY_SURCHARGE",PROBATE_ACCOUNTING_OBJECTION:"PROBATE_ACCOUNTING_OBJECTION",PROBATE_ELDER_FINANCIAL_ABUSE:"PROBATE_ELDER_FINANCIAL_ABUSE",BKY_RELIEF_FROM_STAY:"BKY_RELIEF_FROM_STAY",BKY_DISCHARGEABILITY_COMPLAINT:"BKY_DISCHARGEABILITY_COMPLAINT",BKY_OBJECTION_TO_DISCHARGE:"BKY_OBJECTION_TO_DISCHARGE",BKY_PREFERENCE_AVOIDANCE:"BKY_PREFERENCE_AVOIDANCE",BKY_FRAUDULENT_TRANSFER_AVOIDANCE:"BKY_FRAUDULENT_TRANSFER_AVOIDANCE",IP_PATENT_INFRINGEMENT_COMPLAINT:"IP_PATENT_INFRINGEMENT_COMPLAINT",IP_PATENT_DJ_NONINFRINGEMENT:"IP_PATENT_DJ_NONINFRINGEMENT",IP_PATENT_DJ_INVALIDITY:"IP_PATENT_DJ_INVALIDITY",IP_MARKMAN_BRIEF:"IP_MARKMAN_BRIEF",IP_PATENT_INFRINGEMENT_CONTENTIONS:"IP_PATENT_INFRINGEMENT_CONTENTIONS",IP_PATENT_INVALIDITY_CONTENTIONS:"IP_PATENT_INVALIDITY_CONTENTIONS",IP_COPYRIGHT_INFRINGEMENT_COMPLAINT:"IP_COPYRIGHT_INFRINGEMENT_COMPLAINT",IP_TRADEMARK_INFRINGEMENT_COMPLAINT:"IP_TRADEMARK_INFRINGEMENT_COMPLAINT",IP_TRADEMARK_DILUTION_COMPLAINT:"IP_TRADEMARK_DILUTION_COMPLAINT",IP_TRADEMARK_FALSE_DESIGNATION_COMPLAINT:"IP_TRADEMARK_FALSE_DESIGNATION_COMPLAINT",IP_TRADEMARK_ACPA_COMPLAINT:"IP_TRADEMARK_ACPA_COMPLAINT",IP_TRADEMARK_TRO_PI:"IP_TRADEMARK_TRO_PI",IP_DTSA_MISAPPROPRIATION_COMPLAINT:"IP_DTSA_MISAPPROPRIATION_COMPLAINT",IP_DTSA_TRO_PI:"IP_DTSA_TRO_PI",HABEAS_2241_PETITION:"HABEAS_2241_PETITION",HABEAS_2254_PETITION:"HABEAS_2254_PETITION",HABEAS_2255_MOTION:"HABEAS_2255_MOTION",HABEAS_TRAVERSE:"HABEAS_TRAVERSE",HABEAS_COA_BRIEF:"HABEAS_COA_BRIEF"},n={MTD:"Motion to Dismiss",MTD_RESPONSE:"Response to Motion to Dismiss",MTD_COUNTERCLAIMS:"Motion to Dismiss Counterclaims",MOTION_IN_LIMINE:"Motion in Limine (Daubert)",MOTION_STRIKE:"Motion to Strike",MOTION_STRIKE_DEFENSES:"Motion to Strike Affirmative Defenses",MOTION_COMPEL:"Motion to Compel Discovery",MOTION_PROTECTIVE:"Motion for Protective Order",MOTION_RECONSIDERATION:"Motion for Reconsideration",MOTION_AMEND:"Motion to Amend Pleading",MOTION_EXTENSION:"Motion for Extension of Time",MOTION_DEFAULT:"Motion for Default Judgment",MOTION_OPPOSITION:"Opposition to Motion",CUSTOM_MOTION:"Build Your Own Motion",MSJ_RESPONSE:"Response to Motion for Summary Judgment",DEMAND_LETTER:"Demand Letter",COMPLAINT:"Complaint",FAMILY_PETITION_DISSOLUTION:"Petition for Dissolution",FAMILY_RFO_CUSTODY:"RFO — Custody/Visitation",FAMILY_RFO_CHILD_SUPPORT:"RFO — Child Support",FAMILY_RFO_SPOUSAL_SUPPORT:"RFO — Spousal Support",FAMILY_DV_RESTRAINING_ORDER:"DV Restraining Order Request",PROBATE_WILL_CONTEST:"Will Contest",PROBATE_TRUST_CONTEST:"Trust Contest / \xa717200 Petition",PROBATE_FIDUCIARY_SURCHARGE:"Breach of Fiduciary Duty / Surcharge",PROBATE_ACCOUNTING_OBJECTION:"Objection to Account / Compel Accounting",PROBATE_ELDER_FINANCIAL_ABUSE:"Elder Financial Abuse (EADACPA)",BKY_RELIEF_FROM_STAY:"Motion for Relief from Automatic Stay",BKY_DISCHARGEABILITY_COMPLAINT:"Complaint to Determine Dischargeability",BKY_OBJECTION_TO_DISCHARGE:"Complaint Objecting to Discharge (\xa7727)",BKY_PREFERENCE_AVOIDANCE:"Preference Avoidance Complaint",BKY_FRAUDULENT_TRANSFER_AVOIDANCE:"Fraudulent Transfer Avoidance Complaint",IP_PATENT_INFRINGEMENT_COMPLAINT:"Patent Infringement Complaint",IP_PATENT_DJ_NONINFRINGEMENT:"Declaratory Judgment Complaint — Patent Non-Infringement",IP_PATENT_DJ_INVALIDITY:"Declaratory Judgment Complaint — Patent Invalidity",IP_MARKMAN_BRIEF:"Claim Construction (Markman) Brief",IP_PATENT_INFRINGEMENT_CONTENTIONS:"Patent Infringement Contentions",IP_PATENT_INVALIDITY_CONTENTIONS:"Patent Invalidity Contentions",IP_COPYRIGHT_INFRINGEMENT_COMPLAINT:"Copyright Infringement Complaint",IP_TRADEMARK_INFRINGEMENT_COMPLAINT:"Trademark Infringement Complaint",IP_TRADEMARK_DILUTION_COMPLAINT:"Trademark Dilution Complaint",IP_TRADEMARK_FALSE_DESIGNATION_COMPLAINT:"False Designation of Origin Complaint",IP_TRADEMARK_ACPA_COMPLAINT:"Anticybersquatting Consumer Protection Act Complaint",IP_TRADEMARK_TRO_PI:"Trademark TRO / Preliminary Injunction",IP_DTSA_MISAPPROPRIATION_COMPLAINT:"Trade Secret Misappropriation Complaint (DTSA)",IP_DTSA_TRO_PI:"Trade Secret TRO / Preliminary Injunction (DTSA)",HABEAS_2241_PETITION:"Petition for Writ of Habeas Corpus (\xa72241)",HABEAS_2254_PETITION:"Petition for Writ of Habeas Corpus (\xa72254)",HABEAS_2255_MOTION:"Motion to Vacate, Set Aside, or Correct Sentence (\xa72255)",HABEAS_TRAVERSE:"Traverse / Reply to Answer",HABEAS_COA_BRIEF:"Brief in Support of Certificate of Appealability"},l=["MSJ","MOTION_RECONSIDERATION","MOTION_COMPEL","MOTION_PROTECTIVE"],i={"Motions to Dismiss":["MTD","MTD_RESPONSE","MTD_COUNTERCLAIMS"],"Trial Motions":["MOTION_IN_LIMINE","MOTION_STRIKE","MOTION_STRIKE_DEFENSES"],"Case Management":["MOTION_AMEND","MOTION_EXTENSION","MOTION_DEFAULT"],General:["MOTION_OPPOSITION"],"Summary Judgment":["MSJ_RESPONSE"]};Object.entries(n).map(e=>
1{let[t,a]=e,s="Other";for(let[e,a]of Object.entries(i))if(a.includes(t)){s=e;break}return{value:t,label:a,category:s}});let o=Object.entries(i).map(e=>{let[t,a]=e;return{category:t,options:a.map(e=>({value:e,label:n[e]}))}}),r=e=>n[e]||e,c=[{value:s.DEMAND_LETTER,label:n.DEMAND_LETTER},{value:s.COMPLAINT,label:n.COMPLAINT}]},17208:(e,t,a)=>{a.d(t,{EA:()=>o,yo:()=>i});var s=a(5185),n=a(9648),l=a(48428);function i(e){let{data:t}=(0,l.kw)(e||"",{skip:!e});return(0,s.useMemo)(()=>{let e={};return(null==t?void 0:t.staticTypes)&&t.staticTypes.forEach(t=>{e[t.id]=t.name}),(null==t?void 0:t.customTypes)&&t.customTypes.forEach(t=>{e[t.id]=t.name}),t=>e[t]?e[t]:(0,n.tg)(t)},[t])}let o=(e,t)=>{if("CUSTOM_MOTION"===e.documentType){var a;if(null==(a=e.customMotionMetadata)?void 0:a.customMotionName)return e.customMotionMetadata.customMotionName;if(e.customMotionTypeId){let a=t("custom_".concat(e.customMotionTypeId));if(!a.startsWith("custom_"))return a}return"Custom Motion"}return t(e.documentType)}},45055:(e,t,a)=>{a.d(t,{u:()=>c});var s=a(60197),n=a(25122),l=a(86442),i=a(5185),o=a(647),r=a(50261);let c=e=>{let{documentId:t,fileName:a,onClose:c}=e,[d]=(0,r.zR)(),[u,m]=(0,i.useState)(null),[p,x]=(0,i.useState)(null),[g,h]=(0,i.useState)(a),[y,v]=(0,i.useState)(!1),[N,f]=(0,i.useState)(!0),[b,j]=(0,i.useState)(null);(0,i.useEffect)(()=>{let e=!1;return(async()=>{f(!0),j(null),m(null);try{var s,n,l;let i=await d(t),o=null==i||null==(s=i.data)?void 0:s.downloadUrl,r=(null==i||null==(n=i.data)?void 0:n.fileName)||a,c=null==i||null==(l=i.data)?void 0:l.contentType;if(!o)throw Error("Download URL unavailable");if(e)return;if(x(o),h(r),((e,t)=>{let a=(e||"").toLowerCase();return!!a.endsWith(".docx")||!a.endsWith(".doc")&&(t||"").toLowerCase().includes("officedocument.wordprocessing")})(r,c)){v(!0);let t=await fetch(o);if(!t.ok)throw Error("Failed to download document (".concat(t.status,")"));let a=await t.arrayBuffer();e||m(a)}else v(!1)}catch(t){e||j((null==t?void 0:t.message)||"Failed to load document")}finally{e||f(!1)}})(),()=>{e=!0}},[t,a,d]),(0,i.useEffect)(()=>{let e=e=>{"Escape"===e.key&&c()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[c]);let T=g||"Document preview";return(0,s.jsx)("div",{className:"fixed inset-0 z-[9999] flex flex-col bg-black/40 backdrop-blur-xs",children:(0,s.jsxs)("div",{className:"mx-auto my-6 flex h-[calc(100vh-3rem)] w-[95vw] max-w-6xl flex-col overflow-hidden rounded-lg bg-white shadow-xl",children:[(0,s.jsxs)("div",{className:"flex flex-shrink-0 items-center gap-3 border-b border-zinc-100 px-5 py-3",children:[(0,s.jsx)("span",{className:"flex-1 truncate text-sm font-semibold text-litmas-space-grey",title:T,children:T}),p&&(0,s.jsxs)("a",{href:p,download:g,className:"inline-flex items-center gap-1.5 text-sm text-blue-600 hover:underline",children:[(0,s.jsx)(n.A,{className:"h-4 w-4"}),"Download"]}),(0,s.jsx)("button",{type:"button",onClick:c,"aria-label":"Close",className:"rounded p-1 text-gray-500 hover:bg-gray-100",children:(0,s.jsx)(l.A,{className:"h-5 w-5"})})]}),(0,s.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden bg-gray-100",children:y?(0,s.jsx)(o.E,{docxBuffer:u,isLoading:N,error:b}):(0,s.jsx)("div",{className:"flex h-full items-center justify-center px-8 text-center text-gray-600",children:(0,s.jsx)("div",{children:N?(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"Preparing document…"}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{className:"font-medium",children:"Preview not available"}),(0,s.jsx)("p",{className:"mt-2 text-sm",children:b||"This file type can’t be previewed in the browser. Download it to view."}),p&&(0,s.jsx)("a",{href:p,download:g,className:"mt-3 inline-block text-sm text-blue-600 underline",children:"Download to view"})]})})})})]})})}},51203:(e,t,a)=>{a.d(t,{A:()=>I});var s=a(60197),n=a(57448),l=a(86442),i=a(5185),o=a(35216),r=a(89619),c=a(89121),d=a(64684),u=a(76998),m=a(86905),p=a(9648),x=a(48428);let g=e=>{let{selectedMotionTypes:t=[],onSelectionChange:a,disabled:n=!1,label:l="Select Motion Types",caseId:o,preSuitOnly:g=!1}=e,[h,y]=(0,i.useState)(""),{data:v,isLoading:N}=(0,x.kw)(o||"",{skip:!o||g}),f=(0,i.useMemo)(()=>
1{if(g)return[{category:"Pre-Suit",options:p.xx.map(e=>({value:e.value,label:e.label,isCustom:!1}))}];let e=(0,m.U)(v).map(e=>({category:e.label,options:e.options.map(e=>({value:e.value,label:e.label,isCustom:!1}))}));return(null==v?void 0:v.customTypes)&&v.customTypes.length>0?[...e,{category:"Custom Motions",options:v.customTypes.map(e=>({value:e.id,label:e.name,isCustom:!0,isReusable:e.isReusable}))}]:e},[v,g]),[b,j]=(0,i.useState)({});(0,i.useEffect)(()=>{j(e=>{let t={};return f.forEach(a=>{var s;t[a.category]=null==(s=e[a.category])||s}),t})},[f]);let T=(0,i.useMemo)(()=>{if(!h)return f;let e=h.toLowerCase();return f.map(t=>({...t,options:t.options.filter(t=>t.label.toLowerCase().includes(e)||t.value.toLowerCase().includes(e))})).filter(e=>e.options.length>0)},[h,f]),I=(0,i.useMemo)(()=>T.reduce((e,t)=>e+t.options.length,0),[T]);return(0,s.jsxs)("div",{className:"document-studio-motion-selector",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700",children:l}),(0,s.jsxs)("span",{className:"text-xs text-gray-500",children:[t.length," ","selected"]})]}),(0,s.jsx)("div",{className:"mb-3",children:(0,s.jsx)(d.pd,{type:"text",placeholder:"Search motion types...",value:h,onChange:e=>y(e.target.value),disabled:n,className:"w-full px-3 py-2 "})}),(0,s.jsxs)("div",{className:"flex gap-2 mb-3",children:[(0,s.jsx)(u.$,{type:"button",onClick:()=>{n||a(T.flatMap(e=>e.options.map(e=>e.value)))},disabled:n||t.length===I,className:"flex-1 px-3 py-1.5",children:"Select All"}),(0,s.jsx)(u.$,{type:"button",onClick:()=>{n||a([])},disabled:n||0===t.length,className:"flex-1 px-3 py-1.5 text-xs font-medium text-gray-600 bg-gray-50 rounded hover:bg-gray-100 disabled:opacity-50 disabled:cursor-not-allowed transition",children:"Clear All"})]}),(0,s.jsx)("div",{className:"max-h-96 overflow-y-auto border border-gray-200 rounded-md bg-white",children:N&&o?(0,s.jsx)("div",{className:"p-4 text-center text-sm text-gray-500",children:"Loading motion types..."}):0===T.length?(0,s.jsxs)("div",{className:"p-4 text-center text-sm text-gray-500",children:['No motion types found matching "',h,'"']}):T.map(e=>{let{category:l,options:i}=e;return(0,s.jsxs)("div",{className:"border-b border-gray-100 last:border-b-0",children:[(0,s.jsxs)(u.$,{type:"button",onClick:()=>(e=>{j(t=>({...t,[e]:!t[e]}))})(l),className:"w-full flex items-center justify-between px-3 py-2 bg-gray-50 hover:bg-gray-100 transition text-left",children:[(0,s.jsx)("span",{className:"text-xs font-semibold text-gray-700 uppercase tracking-wider",children:l}),(0,s.jsx)("svg",{className:"w-4 h-4 text-gray-500 transition-transform ".concat(b[l]?"transform rotate-180":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),b[l]&&(0,s.jsx)("div",{className:"divide-y divide-gray-100",children:i.map(e=>(0,s.jsxs)(d.dh,{htmlFor:"motion-type-".concat(e.value),className:"flex items-center px-4 font-normal py-2.5 hover:bg-blue-50 transition cursor-pointer w-full ".concat(n?"opacity-50 cursor-not-allowed":""," ").concat(t.includes(e.value)?"bg-blue-50":""),children:[(0,s.jsx)(d.Sc,{id:"motion-type-".concat(e.value),checked:t.includes(e.value),onCheckedChange:()=>(e=>{n||a(t.includes(e)?t.filter(t=>t!==e):[...t,e])})(e.value),disabled:n,className:"w-4 h-4"}),(0,s.jsx)("span",{className:"ml-3 text-sm text-gray-700 flex-1",children:e.label}),e.isCustom&&(0,s.jsx)("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs ".concat(e.isReusable?"bg-green-50 text-green-700":"bg-amber-50 text-amber-700"),children:e.isReusable?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.A,{className:"h-3 w-3"})," ","Reusable"]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.A,{className:"h-3 w-3"})," ","This Case"]})})]},e.value))})]},l)})}),t.length>0&&(0,s.jsxs)("div",{className:"mt-3 p-2 bg-blue-50 rounded text-xs text-blue-700",children:[(0,s.jsx)("span",{className:"font-medium",children:t.length})," ","motion type",1!==t.length?"s":""," ","selected"]})]})};var h=a(36370),y=a(17208),v=a(26435),N=a(88267),f=a(10176),b=a(27097),j=a(21613);let T={FACT:"fact",CITATION:"citation",STATUTE:"statute",MEMO:"draft",QUOTE:"quote"},I=e=>{let{caseId:t,resourceType:a,resourceId:r,citationId:c=null,usageId:d=null,quoteId:m=null,motionTypes:p=[],fallbackMotionType:x=null,onChanged:I,onOpenDetails:w,showDetail
1sButton:A=!0,showAddToDocumentTypes:C=!0,showDeleteFromCase:E=!1,deleteLabel:O,deleteDescription:_,restrictToMotionType:R=null,nestedDialogPriority:S=!1,className:D,compact:M=!1}=e,[P,L]=(0,i.useState)(!1),[k,F]=(0,i.useState)([]),[U,z]=(0,i.useState)([]),[B,H]=(0,i.useState)(null),[G,K]=(0,i.useState)(!1),[Y,V]=(0,i.useState)(!1),[W,$]=(0,i.useState)(!1),Q=(0,y.yo)(t),[q]=(0,b.qu)(),[J]=(0,b.z)(),[X]=(0,b.w6)(),[Z]=(0,f.tk)(),[ee]=(0,f.lM)(),[et]=(0,f.Tc)(),[ea]=(0,j.sA)(),[es]=(0,j.JR)(),[en]=(0,j.xM)(),[el]=(0,N.uo)(),[ei]=(0,N.rs)(),[eo]=(0,N.Ms)(),er=(0,i.useMemo)(()=>{let e=[...p];return x&&!e.includes(x)&&e.push(x),e},[x,p]);(0,i.useEffect)(()=>{z(er)},[er]),(0,i.useEffect)(()=>{P&&F(er)},[er,P]);let ec=(0,i.useMemo)(()=>R?U.filter(e=>e===R):U,[U,R]),ed="QUOTE"!==a&&!("CITATION"===a&&!c),eu=E&&("FACT"===a||"STATUTE"===a||"MEMO"===a),em=e=>{e.stopPropagation()},ep=(0,i.useCallback)(()=>{null==I||I()},[I]),ex=(0,i.useCallback)(async e=>{try{if(H(e),"FACT"===a)await J({factId:r,motionType:e}).unwrap(),o.oR.success("Removed from ".concat(Q(e)));else if("CITATION"===a){let a=await ee({caseId:t,citationId:c,motionType:e}).unwrap();(null==a?void 0:a.revertedToDraft)?o.oR.success("Removed from all document types; citation reverted to draft"):o.oR.success("Removed from ".concat(Q(e)))}else if("STATUTE"===a)await es({caseId:t,statuteId:r,motionType:e}).unwrap(),o.oR.success("Removed from ".concat(Q(e)));else{if("MEMO"!==a)return;await ei({memoId:r,motionType:e}).unwrap(),o.oR.success("Removed from ".concat(Q(e)))}z(t=>t.filter(t=>t!==e)),ep()}catch(e){var s,n;console.error("Failed to remove resource from motion type:",e),o.oR.error((null==e||null==(s=e.data)?void 0:s.message)||(null==e||null==(n=e.data)?void 0:n.error)||"Failed to update document type membership")}finally{H(null)}},[t,c,ep,ee,J,ei,es,Q,r,a]),eg=(0,i.useCallback)(async()=>{let e=k.filter(e=>!U.includes(e));if(0===e.length){(0,o.oR)("No new document types selected",{icon:"ℹ️"}),L(!1);return}try{if(K(!0),"FACT"===a)await q({factId:r,motionTypes:e}).unwrap();else if("CITATION"===a)await Z({caseId:t,citationId:c,contexts:e.map(e=>({type:"MOTION_TYPE",id:e}))}).unwrap();else if("STATUTE"===a)await ea({caseId:t,statuteId:r,motionTypes:e}).unwrap();else{if("MEMO"!==a)return;await el({memoId:r,motionTypes:e}).unwrap()}z(t=>[...new Set([...t,...e])]),L(!1),ep(),o.oR.success("Added to ".concat(e.length," document type").concat(1===e.length?"":"s"))}catch(e){var s,n;console.error("Failed to add resource to motion types:",e),o.oR.error((null==e||null==(s=e.data)?void 0:s.message)||(null==e||null==(n=e.data)?void 0:n.error)||"Failed to add to document types")}finally{K(!1)}},[q,el,ea,Z,t,c,U,ep,r,a,k]);(0,i.useCallback)(async()=>{try{if(V(!0),"FACT"===a)await X(r).unwrap(),o.oR.success("Fact deleted from case");else if("STATUTE"===a)await en({caseId:t,statuteId:r}).unwrap(),o.oR.success("Statute removed from case");else{if("MEMO"!==a)return;await eo(r).unwrap(),o.oR.success("Draft deleted from case")}ep()}catch(t){var e,s;console.error("Failed to delete resource from case:",t),o.oR.error((null==t||null==(e=t.data)?void 0:e.message)||(null==t||null==(s=t.data)?void 0:s.error)||"Failed to delete from case")}finally{V(!1)}},[t,X,eo,ep,en,r,a]),(0,i.useCallback)(async()=>{if(!d||!m)return void o.oR.error("Quote information missing");try{$(!0),await et({caseId:t,usageId:d,quoteId:m,isStarred:!1}).unwrap(),o.oR.success("Quote unstarred"),ep()}catch(t){var e,a;console.error("Failed to unstar quote:",t),o.oR.error((null==t||null==(e=t.data)?void 0:e.message)||(null==t||null==(a=t.data)?void 0:a.error)||"Failed to unstar quote")}finally{$(!1)}},[t,ep,m,et,d]);let eh=T[a];return(A&&w||C&&ed||"QUOTE"===a||eu||R&&ec.length,R&&"QUOTE"!==a)?0===ec.length?null:(0,s.jsx)("div",{className:(0,v.cn)("mt-2 flex justify-end",D),onClick:em,role:"presentation",children:(0,s.jsx)(u.$,{variant:"headless",size:M?"icon-circle-lg":"icon-circle-xl",className:"text-slate-400 hover:bg-red-50 hover:text-red-600",onClick:e=>{em(e),ex(R)},disabled:B===R,"aria-label":"Remove from ".concat(Q(R)),title:"Remove from ".concat(Q(R)),children:B===R?(0,s.jsx)(n.A,{className:"h-5 w-5 animate-spin"}):(0,s.jsx)(l.A,{className:"h-6 w-6"})})}):(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(h.lG,{open:P,onOpenChange:L,children:(0,s.jsxs)(h.Cf,{className:"max-w-2xl bg-white",priority:S,children:[(0,s.jsxs)(h.c7,{children:[(0,s.jsx)(h.L3,{children:"Manage document types"}),(0,s.jsxs)(h.rr,{children:["Add this"," ",eh," ","to more document types. Remove existing document types from the chips on the resource card."]})]}),(0,s.jsx)(g,{selectedMotionTypes:k,onSelectionChange:F,disabled:G,caseId:t}),(0,s.jsxs)(h.Es,{children:[(0,s.jsx)(u.$,{variant:"outline",onClick:()=>L(!1),children:"Cancel"}),(0,s.jsx)(u.$,{onClick:()=>void eg(),disabled:G,children:G?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save document types"})]})]})})})}},51727:(e,t,a)=>{function s(e,t){let a=document.createElement("a");a.href=e,a.download=t,a.rel="noopener",a.style.display="none",document.body.appendChild(a),a.click(),a.remove()}async function n(e,t){try{let a=await fetch(e,{cache:"no-store"});if(!a.ok)throw Error("Download failed (".concat(a.status,")"));let n=await a.blob();if(0===n.size)throw Error("Downloaded file is empty");let l=URL.createObjectURL(n);s(l,t),window.setTimeout(()=>URL.revokeObjectURL(l),1e3)}catch(a){console.error("Blob download failed; falling back to direct URL:",a),s(e,t)}}a.d(t,{O:()=>n})},53903:(e,t,a)=>{a.d(t,{R:()=>y});var s=a(60197),n=a(65632),l=a(86442),i=a(25122),o=a(5185),r=a(35216),c=a(51203),d=a(59414),u=a(69467),m=a(76998),p=a(36370),x=a(40666),g=a(51727),h=a(88267);let y=e=>{var t;let{memoId:a,caseId:y,title:v,onClose:N,onMemoUpdated:f,isOpen:b}=e,{guardTrialExport:j}=(0,x.n)(),[T,I]=(0,o.useState)(!1),{data:w,isLoading:A,error:C,refetch:E}=(0,h.YE)(a,{skip:!a}),[O]=(0,h.oz)(),_=(0,o.useCallback)(async()=>{j(async()=>
1{if(a)try{I(!0);let e=await O(a).unwrap();(null==e?void 0:e.downloadUrl)?(await (0,g.O)(e.downloadUrl,e.fileName||"Research_Memo.docx"),r.oR.success("Download started")):r.oR.error("Download URL not available")}catch(t){var e;console.error("Error downloading memo:",t),r.oR.error((null==t||null==(e=t.data)?void 0:e.message)||"Failed to download memo")}finally{I(!1)}})},[j,a,O]),R=()=>{setTimeout(N,200)};return(0,s.jsx)(p.lG,{open:b,onOpenChange:R,children:(0,s.jsxs)(p.Cf,{className:"rounded-lg shadow-xl max-w-2xl w-full max-h-[80vh] p-0 gap-0 flex flex-col",onOpenAutoFocus:e=>{e.preventDefault()},showCloseButton:!1,children:[(0,s.jsx)(p.c7,{className:"px-6 py-4 border-b border-gray-200",children:(0,s.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[(0,s.jsx)(n.A,{className:"w-5 h-5 text-blue-600 shrink-0"}),(0,s.jsx)("h2",{className:"text-xl font-semibold text-gray-900 truncate",children:v||(null==w?void 0:w.title)||"Memo Details"}),(0,s.jsx)("div",{className:"flex items-center gap-2 shrink-0",children:y&&a&&(0,s.jsx)(d.SE,{caseId:y,resourceType:"MEMO",resourceId:a,size:"md"})}),(0,s.jsx)(p.HM,{asChild:!0,children:(0,s.jsx)(m.$,{variant:"headless",onClick:R,className:"p-1 transition-colors rounded-md -mx-4 ml-auto",children:(0,s.jsx)(l.A,{className:"w-5 h-5"})})})]})}),(0,s.jsx)("div",{className:"flex-1 overflow-y-auto p-6",children:A?(0,s.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,s.jsx)(u.Q0,{})}):C?(0,s.jsxs)("div",{className:"text-center py-8",children:[(0,s.jsx)("p",{className:"text-red-600",children:"Failed to load memo details"}),(0,s.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:(null==C||null==(t=C.data)?void 0:t.message)||(null==C?void 0:C.message)||"Unknown error"})]}):w?(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsx)(c.A,{caseId:y,resourceType:"MEMO",resourceId:a,motionTypes:w.motionTypes,showDeleteFromCase:!0,onChanged:()=>{null==f||f(),E()},showDetailsButton:!1}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm font-medium text-gray-700 mb-1",children:"Type"}),(0,s.jsx)("span",{className:"text-sm text-gray-900",children:(e=>{switch(e){case"SUMMARY":return"Summary";case"RESEARCH_MEMO":return"Research Memo";case"CASE_ANALYSIS":return"Case Analysis";case"CUSTOM":return"Custom";default:return e}})(w.memoType)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm font-medium text-gray-700 mb-1",children:"Status"}),(0,s.jsx)("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ".concat((e=>{switch(null==e?void 0:e.toUpperCase()){case"COMPLETED":return"bg-green-100 text-green-800";case"PROCESSING":case"QUEUED":return"bg-blue-100 text-blue-800";case"ERROR":return"bg-red-100 text-red-800";default:return"bg-gray-100 text-gray-800"}})(w.status)),children:w.status})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm font-medium text-gray-700 mb-1",children:"Created"}),(0,s.jsx)("span",{className:"text-sm text-gray-900",children:w.createdAt?new Date(w.createdAt).toLocaleDateString():"N/A"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm font-medium text-gray-700 mb-1",children:"Word Count"}),(0,s.jsx)("span",{className:"text-sm text-gray-600",children:w.wordCount?"".concat(w.wordCount.toLocaleString()," words"):"N/A"})]})]}),"COMPLETED"===w.status&&(0,s.jsx)("div",{className:"pt-4 border-t border-gray-200",children:(0,s.jsx)(m.$,{onClick:_,disabled:T,className:"w-full px-4 py-3 flex items-center justify-center gap-2",children:T?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(u.Q0,{size:"sm",className:"border-white"}),(0,s.jsx)("span",{children:"Preparing Download..."})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.A,{className:"w-5 h-5"}),(0,s.jsx)("span",{children:"Download Memo (.docx)"})]})})}),"ERROR"===w.status&&w.errorMessage&&(0,s.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4",children:(0,s.jsxs)("p",{className:"text-sm text-red-800",children:[(0,s.jsx)("span",{className:"font-medium",children:"Error:"})," ",w.errorMessage]})}),(0,s.jsx)(c.A,{caseId:y,resourceType:"MEMO",resourceId:a,motionTypes:w.motionTypes,showDeleteFromCase:!0,onChanged:()=>{null==f||f(),E()}
1,showDetailsButton:!1,className:"mt-0"})]}):(0,s.jsx)("div",{className:"text-center py-8",children:(0,s.jsx)("p",{className:"text-gray-500",children:"No memo data available"})})}),(0,s.jsx)(p.Es,{className:"px-6 py-4 border-t border-gray-200 flex justify-end",children:(0,s.jsx)(p.HM,{asChild:!0,children:(0,s.jsx)(m.$,{variant:"secondary",onClick:R,className:"px-4 py-2",children:"Close"})})})]})})}},54137:(e,t,a)=>{a.r(t),a.d(t,{StatutePopup:()=>x});var s=a(60197),n=a(86442),l=a(66498),i=a(82883),o=a(5185),r=a(35216),c=a(59414),d=a(69467),u=a(76998),m=a(36370),p=a(21613);let x=e=>{let{statuteId:t,caseId:a,onClose:x,isOpen:g=!0}=e,[h,y]=(0,o.useState)(!1),[v,N]=(0,o.useState)(!1),{data:f,isLoading:b,error:j}=(0,p.g0)({caseId:a,statuteId:t},{skip:!t||!a}),T=(null==f?void 0:f.plaintextContent)||"",I=T.length>2e3,w=I&&!h?"".concat(T.substring(0,2e3),"..."):T,A=(null==f?void 0:f.lastUpdated)||(null==f?void 0:f.createdAt),C=(null==f?void 0:f.validatedAt)||(null==f?void 0:f.lastValidated),E=e=>e?new Date(e).toLocaleDateString():null,O=async()=>{if(T)try{await navigator.clipboard.writeText(T),N(!0),r.oR.success("Statute text copied to clipboard"),setTimeout(()=>N(!1),2e3)}catch(e){console.error("Failed to copy text:",e),r.oR.error("Failed to copy statute text")}},_=()=>{setTimeout(x,200)};return(0,s.jsx)(m.lG,{open:g,onOpenChange:_,children:(0,s.jsxs)(m.Cf,{priority:"elevated",className:"rounded-xl shadow-[0px_25px_50px_-12px_rgba(0,0,0,0.10)] sm:max-w-[520px] w-full max-h-[85vh] p-0 gap-0 flex flex-col max-md:pointer-coarse:top-auto max-md:pointer-coarse:bottom-0 max-md:pointer-coarse:left-0 max-md:pointer-coarse:translate-x-0 max-md:pointer-coarse:translate-y-0 max-md:pointer-coarse:max-w-none max-md:pointer-coarse:rounded-b-none max-md:pointer-coarse:rounded-t-2xl max-md:pointer-coarse:max-h-[85dvh] max-md:pointer-coarse:pb-[env(safe-area-inset-bottom)] outline outline-1 -outline-offset-1 outline-zinc-200",onOpenAutoFocus:e=>{e.preventDefault()},showCloseButton:!1,children:[(0,s.jsx)(m.c7,{className:"px-6 py-4 border-b border-zinc-100",children:(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)(m.L3,{className:"text-base font-medium text-zinc-950",children:"Statute Details"}),(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[a&&t&&(0,s.jsx)(c.SE,{caseId:a,resourceType:"STATUTE",resourceId:t,size:"sm"}),(0,s.jsx)("div",{className:"w-px h-4 bg-zinc-200"}),(0,s.jsx)(m.HM,{asChild:!0,children:(0,s.jsx)(u.$,{variant:"headless",onClick:_,className:"p-1 transition-colors rounded-md",children:(0,s.jsx)(n.A,{className:"w-4 h-4 text-litmas-space-grey"})})})]})]})}),(0,s.jsx)("div",{className:"flex-1 overflow-y-auto",children:b?(0,s.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,s.jsx)(d.Q0,{})}):(j?"Failed to fetch statute":null)?(0,s.jsx)("div",{className:"text-center py-8 px-6",children:(0,s.jsx)("p",{className:"text-red-600",children:"Failed to load statute details"})}):f?(0,s.jsxs)("div",{className:"px-6 py-5",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2.5",children:[f.jurisdictionKey&&(0,s.jsx)("span",{className:"inline-flex items-center rounded-[5px] bg-litmas-space-grey px-3 py-0.5 text-xs font-normal leading-4 text-white",children:f.jurisdictionKey}),(0,s.jsx)("span",{className:"text-3xl font-semibold leading-9 text-litmas-space-grey",children:f.citation})]}),(f.displayName||f.name)&&(0,s.jsx)("p",{className:"mt-2 text-xs leading-4 text-santas-grey",children:f.displayName||f.name}),(0,s.jsx)("div",{className:"h-px bg-zinc-100 my-5"}),f.plaintextContent&&(0,s.jsxs)("div",{children:[(0,s.jsx)("h4",{className:"text-xs leading-4 text-santas-grey",children:"STATUTE TEXT"}),(0,s.jsxs)("div",{className:"mt-3 rounded-2xl bg-chef-hat outline outline-1 -outline-offset-1 outline-zinc-200 p-4",children:[(0,s.jsx)("div",{className:"overflow-y-auto ".concat(h?"max-h-[600px]":"max-h-72"),children:(0,s.jsx)("pre",{className:"text-xs text-litmas-space-grey whitespace-pre-wrap font-sans leading-5",children:w})}),(0,s.jsxs)("div",{className:"mt-6 flex items-center justify-between gap-3",children:[(0,s.jsx)("div",{className:"flex items-center gap-3",children:I&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(u.$,{variant:"outline",size:"sm",onClick:()=>y(!h),children:h?"Show Less":"Read More"}),!h&&(0,s.jsxs)("span",{className:"text-xs text-santas-grey",children:["(",Math.round(T.length/1e3),"k characters total)"]})]})}),(0,s.jsx)(u.$,{variant:"outline",size:"sm",onClick:O,className:"gap-2",title:"Copy statute to clipboard",children:v?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.A,{className:"w-4 h-4 text-green-600"}),(0,s.jsx)("span",{children:"Copied!"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.A,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:"Copy Statute"})]})})]})]})]}),f.annotations&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"h-px bg-zinc-100 my-5"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h4",{className:"text-xs uppercase leading-3 tracking-wide text-zinc-400",children:"Annotations"}),(0,s.jsx)("div",{className:"mt-3 rounded-2xl bg-chef-hat outline outline-1 -outline-offset-1 outline-zinc-200 px-4 py-3",children:(0,s.jsx)("p",{className:"text-xs leading-4 tracking-tight text-litmas-space-grey",children:f.annotations})})]})]}),(A||C)&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"h-px bg-zinc-100 my-5"}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[A&&(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs uppercase leading-3 tracking-wide text-zinc-400",children:"Last Updated"}),(0,s.jsx)("p",{className:"mt-1 text-xs font-medium leading-4 tracking-tight text-zinc-700",children:E(A)})]}),C&&(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs uppercase leading-3 tracking-wide text-zinc-400",children:"Validated"}),(0,s.jsxs)("div",{className:"mt-1 flex items-center gap-1",children:[(0,s.jsx)("span",{className:"size-1.5 rounded-full bg-zinc-900"}),(0,s.jsx)("span",{className:"text-xs font-medium leading-4 tracking-tight text-zinc-700",children:E(C)})]})]})]})]})]}):(0,s.jsx)("div",{className:"text-center py-8 px-6",children:(0,s.jsx)("p",{className:"text-gray-500",children:"No statute data available"})})}),(0,s.jsxs)(m.Es,{className:"px-6 py-4 border-t border-zinc-100 flex justify-end gap-2",children:[(0,s.jsx)(u.$,{variant:"outline",onClick:()=>
1{if(!f)return;let e=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"),t='<!doctype html>\n<html>\n<head>\n<meta charset="utf-8" />\n<title>Statute Details</title>\n<style>\n  * { box-sizing: border-box; }\n  body { font-family: Inter, Arial, sans-serif; color: #100429; margin: 32px; }\n  h1 { font-size: 24px; font-weight: 600; margin: 0 0 4px; }\n  .sub { font-size: 13px; color: #9ca3af; margin: 0 0 24px; }\n  .label { font-size: 11px; letter-spacing: 0.02em; color: #9ca3af; text-transform: uppercase; margin: 24px 0 8px; }\n  .text { font-size: 12px; line-height: 1.6; white-space: pre-wrap; }\n</style>\n</head>\n<body>\n  <h1>'.concat(e(f.citation||""),"</h1>\n  ").concat(f.displayName||f.name?'<p class="sub">'.concat(e(f.displayName||f.name||""),"</p>"):"",'\n  <p class="label">Statute Text</p>\n  <div class="text">').concat(e(T),"</div>\n  ").concat(f.annotations?'<p class="label">Annotations</p><div class="text">'.concat(e(f.annotations),"</div>"):"","\n</body>\n</html>"),a=window.open("","_blank","width=820,height=1000");if(!a)return void r.oR.error("Please allow pop-ups to export this statute");a.document.open(),a.document.write(t),a.document.close(),a.focus(),a.onload=()=>{a.print()}},disabled:!f,children:"Export"}),(0,s.jsx)(m.HM,{asChild:!0,children:(0,s.jsx)(u.$,{onClick:_,children:"Close"})})]})]})})}},59414:(e,t,a)=>{a.d(t,{T1:()=>k,SE:()=>D});var s=a(60197),n=a(13331),l=a(23176),i=a(38146),o=a(65632),r=a(86442),c=a(48321),d=a(29986),u=a(48166),m=a(69464),p=a(12674),x=a(5185),g=a(92793),h=a(69387),y=a(53903),v=a(54137),N=a(29363),f=a(69467),b=a(76998),j=a(23342),T=a(8703),I=a(17208),w=a(29169),A=a(26435),C=a(43902),E=a(51203),O=a(78809),_=a(35216);let R={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6"},S={sm:"p-1",md:"p-1.5",lg:"p-2"};function D(e){let{caseId:t,resourceType:a,resourceId:n,isFavourite:l=!1,size:i="md",className:o,onToggle:r}=e,[c,{isLoading:u}]=(0,C.im)(),[m,p]=(0,x.useState)(l),g=async e=>{if(e.stopPropagation(),e.preventDefault(),u)return;let s=!m;p(s);try{let e=await c({caseId:t,resourceType:a,resourceId:String(n)}).unwrap();p(e.isFavourite),null==r||r(e.isFavourite),_.oR.success(e.isFavourite?"Added to favorites":"Removed from favorites")}catch(e){p(!s),_.oR.error("Failed to update favorite"),console.error("Failed to toggle favourite:",e)}};return(0,s.jsx)("button",{type:"button",onClick:g,disabled:u,className:(0,A.cn)("inline-flex items-center justify-center rounded-full transition-all duration-150","hover:bg-yellow-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-yellow-300 focus-visible:ring-offset-1",u&&"opacity-50 cursor-not-allowed",S[i],o),title:m?"Remove from favorites":"Add to favorites","aria-label":m?"Remove from favorites":"Add to favorites",children:(0,s.jsx)(d.A,{className:(0,A.cn)(R[i],"transition-all duration-150",m?"fill-yellow-400 text-yellow-400 scale-110":"fill-transparent text-litmas-space-grey hover:text-yellow-400",u&&"animate-pulse")})})}let M={FACT:{bgColor:"bg-blue-50",textColor:"text-blue-700",pillBg:"bg-blue-100",label:"Fact"},CITATION:{bgColor:"bg-indigo-50",textColor:"text-indigo-700",pillBg:"bg-indigo-100",label:"Citation"},STATUTE:{bgColor:"bg-purple-50",textColor:"text-purple-700",pillBg:"bg-purple-100",label:"Statute"},MEMO:{bgColor:"bg-amber-50",textColor:"text-amber-700",pillBg:"bg-amber-100",label:"Draft"}};function P(e){var t;let{item:a,caseId:n,onClick:l,isSelectable:i=!1,isSelected:o=!1,onToggleSelect:r,onActionComplete:c}=e,d=M[a.resourceType]||M.FACT;if(!d)return console.error("Unknown resourceType:",a.resourceType,a),null;let u=function(e){switch(e.resourceType){case"FACT":return e.content||"No content";case"CITATION":var t,a;return(null==(t=e.citationId)?void 0:t.caseName)||(null==(a=e.citationId)?void 0:a.shortCitation)||"Unknown citation";case"STATUTE":return e.displayName||e.citation||"Unknown statute";case"MEMO":return e.title||"Untitled memo";default:return"Unknown item"}}(a),m=function(e){var t,a;switch(e.resourceType){case"FACT":return(null==(t=e.evaluation)?void 0:t.materiality)?"Materiality: ".concat(e.evaluation.materiality):null;case"CITATION":let s=null==(a=e.citationId)?void 0:a.court;if(!s)return null;if("string"==typeof s)return s;return s.fullName||s.abbreviation||null;case"STATUTE":return e.citation||null;case"MEMO":return e.type?"Type: ".concat(e.type):null;default:return null}}(a),p=a.motionTypes||[],x="CITATION"===a.resourceType?null==(t=a.citationId)?void 0:t._id:void 0,g=u.length>120?"".concat(u.substring(0,120),"..."):u;return(0,s.jsx)("div",{className:(0,A.cn)("rounded-lg border border-gray-200 p-3 transition-all duration-150","hover:shadow-md hover:border-gray-300 cursor-pointer",d.bgColor),onClick:()=>null==l?void 0:l(a),role:"button",tabIndex:0,onKeyDown:e=>
1{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),null==l||l(a))},children:(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[i&&(0,s.jsx)("div",{onClick:e=>e.stopPropagation(),children:(0,s.jsx)(O.S,{checked:o,onCheckedChange:()=>null==r?void 0:r(a),className:"mt-1 data-[state=unchecked]:bg-white"})}),(0,s.jsx)("div",{onClick:e=>e.stopPropagation(),children:(0,s.jsx)(D,{caseId:n,resourceType:a.resourceType,resourceId:a._id,isFavourite:a.isFavourite,size:"sm"})}),(0,s.jsx)("span",{className:(0,A.cn)("inline-flex px-2 py-0.5 text-xs font-medium rounded shrink-0",d.pillBg,d.textColor),children:d.label}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm text-gray-900 leading-snug line-clamp-2",children:g}),m&&(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-1 truncate",children:m}),p.length>0&&(0,s.jsx)(E.A,{caseId:n,resourceType:a.resourceType,resourceId:a._id,citationId:x,usageId:"CITATION"===a.resourceType?a._id:void 0,motionTypes:p,onChanged:c,showDetailsButton:!1,showAddToDocumentTypes:!1,compact:!0})]})]})})}n.A,l.A,i.A,o.A;let L=[{value:"ALL",label:"All Types"},{value:"FACT",label:"Facts"},{value:"CITATION",label:"Citations"},{value:"STATUTE",label:"Statutes"},{value:"MEMO",label:"Drafts"}];function k(e){var t,a,n,l,i,o;let{caseId:E,isOpen:O,onClose:_,initialViewMode:R,selectionMode:S=!1,onAddToDocument:D}=e,[M,k]=(0,x.useState)(R||"document"),[U,z]=(0,x.useState)("ALL"),[B,H]=(0,x.useState)(""),[G,K]=(0,x.useState)(()=>new Set),[Y,V]=(0,x.useState)(()=>new Map),{isOnboarding:W,isNextStepVisible:$,currentStepId:Q,currentTour:q,completeOnboardingStep:J,startNextStep:X}=(0,w.z)(),[Z,ee]=(0,x.useState)(null),et=(0,I.yo)(E),ea=L.find(e=>e.value===U)||L[0],es=Y.size;(0,x.useEffect)(()=>{O&&R&&k(R)},[O,R]),(0,x.useEffect)(()=>{O||V(new Map)},[O]);let{data:en,isLoading:el,refetch:ei}=(0,C.nN)({caseId:E},{skip:!E||!O}),{data:eo,isLoading:er,refetch:ec}=(0,C.QJ)(E,{skip:!E||!O||"starred"!==M}),{data:ed,isLoading:eu,refetch:em}=(0,C.mB)(E,{skip:!E||!O||"document"!==M});(0,x.useEffect)(()=>{O&&E&&(ei(),"starred"===M?ec():em())},[O,E,M,ei,ec,em]);let ep=(0,x.useCallback)(e=>{K(t=>{let a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[]),ex=(0,x.useMemo)(()=>{if(!eo)return[];let e=[...eo.facts,...eo.citations,...eo.statutes,...eo.memos];if("ALL"!==U&&(e=e.filter(e=>e.resourceType===U)),B.trim()){let t=B.toLowerCase();e=e.filter(e=>F(e).toLowerCase().includes(t))}return e},[eo,U,B]),eg=(0,x.useCallback)(e=>{let t="".concat(e.resourceType,":").concat(e._id);V(a=>{let s=new Map(a);return s.has(t)?s.delete(t):s.set(t,e),s})},[]),eh=(0,x.useCallback)(e=>{ee(e)},[]),ey=(0,x.useCallback)(()=>{ei(),"starred"===M?ec():em()},[ec,em,ei,M]),ev=(0,x.useCallback)(()=>{ee(null)},[]),eN=(0,x.useMemo)(()=>ed?Object.keys(ed).sort():[],[ed]),ef=(0,x.useCallback)(e=>{if(!ed||!ed[e])return[];let t=ed[e],a=[...t.facts,...t.citations,...t.statutes,...t.memos];if("ALL"!==U&&(a=a.filter(e=>e.resourceType===U)),B.trim()){let e=B.toLowerCase();a=a.filter(t=>F(t).toLowerCase().includes(e))}return a},[ed,U,B]),eb=(0,x.useMemo)(()=>eN.filter(e=>ef(e).length>0),[eN,ef]),ej=(null==en||null==(t=en.favouriteCounts)?void 0:t.total)||0,eT=(0,x.useCallback)(async e=>{!e&&(V(new Map),_(),W&&Q===N.UT.RESEARCH&&q===N.ie.AI_ASSISTANT_CITATION_FAVORITES&&ej>0&&setTimeout(async()=>{await J({entryId:N.UT.RESEARCH}),X(N.ie.DOCUMENT_STUDIO)}))},[J,Q,q,ej,W,_,X]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(T.cj,{open:O,onOpenChange:eT,children:(0,s.jsxs)(T.h,{side:"right","aria-labelledby":"library-drawer-title",className:(0,A.cn)("w-full max-w-md bg-white shadow-xl sm:max-w-md","border-l-0 gap-0 [&>button]:hidden"),hideOverlay:W&&$,children:[(0,s.jsx)("div",{className:"shrink-0 border-b border-gray-200 p-4",children:(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)(T.qp,{id:"library-drawer-title",className:"text-lg font-semibold text-gray-900",children:"Case Library"}),(0,s.jsx)(T.kN,{asChild:!0,children:(0,s.jsx)("button",{type:"button",className:"p-1 rounded-full hover:bg-gray-100 transition-colors","aria-label":"Close drawer",children:(0,s.jsx)(r.A,{className:"h-5 w-5 text-gray-500"})})})]})}),(0,s.jsxs)("div",{className:"shrink-0 border-b border-gray-200 p-4 space-y-3",children:[(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsxs)(b.$,{variant:"document"===M?"default":"outline",size:"sm",onClick:()=>k("document"),className:"flex-1",children:[(0,s.jsx)(c.A,{className:"h-4 w-4 mr-1"}),"By Document"]}),(0,s.jsxs)(b.$,{variant:"starred"===M?"default":"outline",size:"sm",onClick:()=>k("starred"),className:"flex-1",children:[(0,s.jsx)(d.A,{className:"h-4 w-4 mr-1"}),"Starred (",ej,")"]})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsxs)("div",{className:"relative flex-1",children:[(0,s.jsx)(u.A,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,s.jsx)(j.p,{type:"text",placeholder:"Search items...",value:B,onChange:e=>H(e.target.value),className:"pl-8 h-10"})]}),(0,s.jsx)("div",{className:"min-w-28",children:(0,s.jsx)(f.MD,{options:L,value:ea,onChange:e=>{var t;return z(null!=(t=null==e?void 0:e.value)?t:"ALL")},placeholder:"All Types",isSearchable:!1,menuPortalTarget:null})})]})]}),(0,s.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:el||er||eu?(0,s.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,s.jsx)(f.Q0,{})}):"document"===M?0===eb.length?(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center h-32 text-center",children:[(0,s.jsx)("div",{className:"p-3 rounded-full bg-gray-100 mb-3",children:(0,s.jsx)(c.A,{className:"h-6 w-6 text-gray-400"})}),(0,s.jsx)("p",{className:"text-gray-500 text-sm",children:B||"ALL"!==U?"No items match your filters.":"No items assigned to document types yet."})]}):(0,s.jsx)("div",{className:"space-y-2",children:eb.map(e=>{let t=ef(e),a=G.has(e),n=t.length;return(0,s.jsxs)("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:[(0,s.jsxs)(b.$,{variant:"headless",onClick:()=>{ep(e)},className:"w-full flex items-center justify-between p-3 bg-gray-50 hover:bg-gray-100 transition-colors h-auto min-h-10",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[a?(0,s.jsx)(m.A,{className:"h-4 w-4 text-gray-500 shrink-0"}):(0,s.jsx)(p.A,{className:"h-4 w-4 text-gray-500 shrink-0"}),(0,s.jsx)(c.A,{className:"h-4 w-4 text-indigo-600 shrink-0"}),(0,s.jsx)("span",{className:"font-medium text-gray-900 text-left",children:et(e)})]}),(0,s.jsx)("span",{className:"text-sm text-gray-500 bg-white px-2 py-0.5 rounded-full border border-gray-200 whitespace-nowrap",children:"".concat(n," ").concat(1===n?"item":"items")})]}),a&&(0,s.jsx)("div",{className:"p-3 space-y-2 bg-white",children:t.map(t=>(0,s.jsx)(P,{item:t,caseId:E,onClick:eh,onActionComplete:ey,isSelected:Y.has("".concat(t.resourceType,":").concat(t._id)),onToggleSelect:eg},"".concat(e,"-").concat(t.resourceType,"-").concat(t._id)))})]},e)})}):0===ex.length?(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center h-32 text-center",children:[(0,s.jsx)("div",{className:"p-3 rounded-full bg-gray-100 mb-3",children:(0,s.jsx)(d.A,{className:"h-6 w-6 text-gray-400"})}),(0,s.jsx)("p",{className:"text-gray-500 text-sm",children:B||"ALL"!==U?"No starred items match your filters.":"No starred items yet. Click the star on items to add them here."})]}):(0,s.jsx)("div",{className:"space-y-3",children:ex.map(e=>(0,s.jsx)(P,{item:e,caseId:E,onClick:eh,onActionComplete:ey,isSelectable:S,isSelected:Y.has("".concat(e.resourceType,":").concat(e._id)),onToggleSelect:eg},"".concat(e.resourceType,"-").concat(e._id)))})}),(0,s.jsx)("div",{className:"shrink-0 border-t border-gray-200 p-4",children:S&&"starred"===M?(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)(b.$,{className:"w-full",onClick:()=>
1{S&&0!==es&&(null==D||D(Array.from(Y.values())),V(new Map),_())},disabled:0===es,children:["Add to Document (",es,")"]}),(0,s.jsx)("p",{className:"text-xs text-gray-500 text-center",children:0===es?"Select items to add to the current document.":"".concat(es," selected")})]}):(0,s.jsxs)("p",{className:"text-xs text-gray-500 text-center",children:["document"===M?"".concat(eb.length," document types"):"".concat(ex.length," starred items"),(B||"ALL"!==U)&&" (filtered)"]})})]})}),(0,s.jsx)(h.FactPopup,{factId:null!=(n=null==Z?void 0:Z._id)?n:"",caseId:E,onClose:ev,isOpen:(null==Z?void 0:Z.resourceType)==="FACT"}),(0,s.jsx)(g.CitationPopup,{citationId:null!=(l=null==Z||null==(a=Z.citationId)?void 0:a._id)?l:"",usageId:null==Z?void 0:Z._id,caseId:E,onClose:ev,isOpen:(null==Z?void 0:Z.resourceType)==="CITATION"}),(0,s.jsx)(v.StatutePopup,{statuteId:null!=(i=null==Z?void 0:Z._id)?i:"",caseId:E,onClose:ev,isOpen:(null==Z?void 0:Z.resourceType)==="STATUTE"}),(0,s.jsx)(y.R,{memoId:null!=(o=null==Z?void 0:Z._id)?o:"",caseId:E,onClose:ev,isOpen:(null==Z?void 0:Z.resourceType)==="MEMO"})]})}function F(e){let t=[];switch(e.resourceType){case"FACT":e.content&&t.push(e.content);break;case"CITATION":var a,s;(null==(a=e.citationId)?void 0:a.caseName)&&t.push(e.citationId.caseName),(null==(s=e.citationId)?void 0:s.citation)&&t.push(e.citationId.citation);break;case"STATUTE":e.displayName&&t.push(e.displayName),e.citation&&t.push(e.citation),e.plaintextContent&&t.push(e.plaintextContent);break;case"MEMO":e.title&&t.push(e.title),e.type&&t.push(e.type)}return e.motionTypes&&t.push(...e.motionTypes),t.join(" ")}},69387:(e,t,a)=>{a.r(t),a.d(t,{FactPopup:()=>j});var s=a(60197),n=a(86442),l=a(65632),i=a(5185),o=a(51684),r=a(73328),c=a(35216),d=a(45055),u=a(78701),m=a(59414),p=a(69467),x=a(76998),g=a(36370),h=a(6178),y=a(72993),v=a(50261),N=a(27097);let f=(0,i.lazy)(()=>Promise.all([a.e(3955),a.e(3250),a.e(3460)]).then(a.bind(a,25023)).then(e=>({default:e.ClipPopup}))),b=e=>{let{documentId:t,factId:a,evidenceIndex:n,factContent:l,evidenceHeader:i,onClose:o}=e,r=((null==i?void 0:i.fileName)||"").toLowerCase(),c=((null==i?void 0:i.documentType)||"").toLowerCase(),m=r.endsWith(".docx")||r.endsWith(".doc")||"docx"===c||"doc"===c||c.includes("word"),{data:g,isLoading:h,error:y}=(0,v.O_)({documentId:t,factId:a,evidenceIndex:n},{skip:!t||!a||void 0===n||m});if(m)return(0,s.jsx)(d.u,{documentId:t,fileName:null==i?void 0:i.fileName,onClose:o});if(h)return(0,s.jsx)("div",{className:"fixed inset-0 bg-black/30 backdrop-blur-xs flex items-center justify-center z-[10001]",children:(0,s.jsx)("div",{className:"bg-white rounded-lg p-6",children:(0,s.jsx)(p.gQ,{})})});if(y||!(null==g?void 0:g.viewUrl)){let e="Failed to load PDF document";if(y&&"data"in y&&y.data){let t=y.data;e=(null==t?void 0:t.message)||e}return(0,s.jsx)("div",{className:"fixed inset-0 bg-black/30 backdrop-blur-xs flex items-center justify-center z-[10001]",children:(0,s.jsxs)("div",{className:"bg-white rounded-lg p-6 max-w-md",children:[(0,s.jsx)("h3",{className:"text-lg font-semibold text-red-600 mb-2",children:"Error Loading PDF"}),(0,s.jsx)("p",{className:"text-gray-600 mb-4",children:e}),(0,s.jsx)(x.$,{variant:"secondary",onClick:o,className:"px-4 py-2",children:"Close"})]})})}return(0,s.jsx)(u.PDFViewer,{documentId:t,chunkUuid:g.chunkUuid||void 0,onClose:o,currentFactContent:l,targetPage:g.targetPage||null,viewUrl:g.viewUrl||null,evidenceHeader:i,stackAboveOtherDialogs:!0})},j=e=>{var t,a;let{factId:d,caseId:u,onClose:j,onFactUpdated:T,isOpen:I=!0}=e,[w,A]=(0,i.useState)(null),[C,E]=(0,i.useState)(null),{data:O,isLoading:_,error:R,refetch:S}=(0,N.Sz)({factId:d,includeDeleted:!0},{skip:!d}),D=(null==O?void 0:O.status)==="DELETED",[M]=(0,N.k2)(),P=(0,i.useCallback)(async(e,t)=>{if(d)try{await M({factId:d,evidenceIndex:e,formattedCitation:t}).unwrap(),T&&T(),S(),c.oR.success("Citation updated")}catch(e){console.error("Error updating citation:",e),c.oR.error("Failed to update citation")}},[d,M,T,S]),[L]=(0,v.An)(),k=(0,i.useCallback)(async(e,t)=>{if(e&&(null==t?void 0:t.trim()))try{await L({documentId:e,displayName:t.trim()}).unwrap(),T&&T(),S(),c.oR.success("Document renamed")}catch(e){console.error("Error renaming document:",e),c.oR.error("Failed to rename document")}},[L,T,S]),F=(0,r.wA)(),[U]=(0,N.Q7)(),z=(0,i.useCallback)(async(e,t,a)=>{if(d)try{await U({factId:d,evidenceIndex:e,...t}).unwrap(),T&&T(),S();let s=null!=a?"object"==typeof a?a._id:a:null;null!=s&&"string"==typeof s&&F(v.Ay.util.invalidateTags([{type:"Document",id:"view-evidence-".concat(s)}
1])),c.oR.success("Page numbers updated")}catch(e){console.error("Error updating page numbers:",e),c.oR.error("Failed to update page numbers")}},[d,U,T,S,F]),B=(0,i.useCallback)((e,t,a)=>{let s=(0,y.n)(t);s&&z(e,{lineNumbers:s},a)},[z]),H=()=>{setTimeout(j,200)},G=(0,i.useCallback)(()=>{var e,t;if(!O)return;let a=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"),s=(null==(e=O.temporal)?void 0:e.startDate)?new Date(O.temporal.startDate).toLocaleDateString():"",n=(O.supportingEvidence||[]).map((e,t)=>{var s,n,l,i,o,r,c;let d=(null==(s=e.documentId)?void 0:s.displayName)||(null==(n=e.documentId)?void 0:n.fileName)||"Unknown Document",u=(null==(i=e.documentId)||null==(l=i.documentType)?void 0:l.replace(/_/g," "))||"Unknown Type",m=e.formattedCitation?a(e.formattedCitation):"",p=(null==(o=e.pageNumbers)?void 0:o.length)?e.pageNumbers.join(", "):"",x=e.lineNumbers&&(null!=(r=e.lineNumbers.start)?r:0)>0?"".concat(null!=(c=e.lineNumbers.start)?c:"").concat(e.lineNumbers.end?"-".concat(e.lineNumbers.end):""):"",g=[m&&"<span><strong>Pincite</strong> ".concat(m,"</span>"),p&&"<span><strong>Page</strong> ".concat(a(p),"</span>"),x&&"<span><strong>Lines</strong> ".concat(a(x),"</span>")].filter(Boolean).join("");return'\n          <div class="card">\n            <div class="card-head"><span class="num">'.concat(t+1,'</span><span class="name">').concat(a(d),'</span><span class="badge">').concat(a(u),"</span></div>\n            ").concat(g?'<div class="meta">'.concat(g,"</div>"):"","\n            ").concat(e.extract?'<p class="extract">“'.concat(a(e.extract),"”</p>"):"","\n            ").concat(e.supportReason?'<p class="reason"><strong>Reasoning:</strong> '.concat(a(e.supportReason),"</p>"):"","\n          </div>")}).join(""),l='<!doctype html>\n<html>\n<head>\n<meta charset="utf-8" />\n<title>Case Fact Details</title>\n<style>\n  * { box-sizing: border-box; }\n  body { font-family: Inter, Arial, sans-serif; color: #100429; margin: 32px; }\n  h1 { font-size: 18px; font-weight: 600; margin: 0 0 24px; }\n  .label { font-size: 11px; letter-spacing: 0.02em; color: #9ca3af; text-transform: uppercase; margin: 0 0 8px; }\n  .statement { font-size: 14px; line-height: 1.5; margin: 0 0 12px; }\n  .date { font-size: 12px; color: #9ca3af; margin: 0 0 24px; }\n  hr { border: none; border-top: 1px solid #f4f4f5; margin: 24px 0; }\n  .card { border: 1px solid #e4e4e7; border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; page-break-inside: avoid; }\n  .card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }\n  .num { font-size: 12px; font-weight: 600; }\n  .name { flex: 1; font-size: 12px; font-weight: 500; }\n  .badge { font-size: 11px; color: #fff; background: #0f172a; border-radius: 5px; padding: 2px 10px; }\n  .meta { display: flex; flex-wrap: wrap; gap: 24px; font-size: 11px; color: #6b7280; margin-bottom: 8px; }\n  .meta strong { color: #9ca3af; font-weight: 400; }\n  .extract { font-size: 12px; line-height: 1.4; margin: 0 0 8px; }\n  .reason { font-size: 12px; line-height: 1.4; margin: 8px 0 0; padding-top: 8px; border-top: 1px solid #f4f4f5; }\n</style>\n</head>\n<body>\n  <h1>Case Fact Details</h1>\n  <p class="label">Fact Statement</p>\n  <p class="statement">'.concat(a(O.content||""),"</p>\n  ").concat(s?'<p class="date">Date: '.concat(a(s),"</p>"):"",'\n  <hr />\n  <p class="label">Supporting Evidence (').concat((null==(t=O.supportingEvidence)?void 0:t.length)||0,")</p>\n  ").concat(n,"\n</body>\n</html>"),i=window.open("","_blank","width=820,height=1000");if(!i)return void c.oR.error("Please allow pop-ups to export this fact");i.document.open(),i.document.write(l),i.document.close(),i.focus(),i.onload=()=>{i.print()}},[O]);return(0,s.jsxs)(s.Fragment,{children:[w&&(0,s.jsx)(i.Suspense,{fallback:null,children:(0,s.jsx)(f,{documentId:w.documentId,startMs:w.startMs,endMs:w.endMs,isCitedClip:!0,sourceRevision:w.sourceRevision,ingestionRevision:w.ingestionRevision,onClose:()=>A(null),priority:"detail"})}),(0,s.jsx)(g.lG,{open:I&&!C&&!w,onOpenChange:H,children:(0,s.jsxs)(g.Cf,{className:"rounded-xl shadow-[0px_25px_50px_-12px_rgba(0,0,0,0.10)] sm:max-w-[560px] w-full max-h-[85vh] p-0 gap-0 flex flex-col max-md:pointer-coarse:top-auto max-md:pointer-coarse:bottom-0 max-md:pointer-coarse:left-0 max-md:pointer-coarse:translate-x-0 max-md:pointer-coarse:translate-y-0 max-md:pointer-coarse:max-w-none max-md:pointer-coarse:rounded-b-none max-md:pointer-coarse:rounded-t-2xl max-md:pointer-coarse:max-h-[85dvh] max-md:pointer-coarse:pb-[env(safe-area-inset-bottom)] outline outline-1 -outline-offset-1 outline-zinc-200",onOpenAutoFocus:e=>{e.preventDefault()},showCloseButton:!1,priority:"elevated",children:[(0,s.jsx)(g.c7,{className:"px-6 py-4 border-b border-zinc-100",children:(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(g.L3,{className:"text-base font-medium text-zinc-950",children:"Case Fact Details"}),D&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium border border-amber-300 bg-amber-100 text-amber-800",children:"Deleted from Case"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)(m.SE,{caseId:u,resourceType:"FACT",resourceId:d,size:"sm"}),(0,s.jsx)("span",{className:"h-4 w-px bg-zinc-200"}),(0,s.jsx)(g.HM,{asChild:!0,children:(0,s.jsx)(x.$,{variant:"headless",onClick:H,className:"p-1 transition-colors rounded-md",children:(0,s.jsx)(n.A,{className:"w-4 h-4 text-litmas-space-grey"})})})]})]})}),(0,s.jsx)("div",{className:"flex-1 overflow-y-auto",children:_?(0,s.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,s.jsx)(p.Q0,{})}):R?(0,s.jsxs)("div",{className:"text-center py-8",children:[(0,s.jsx)("p",{className:"text-red-600",children:"Failed to load fact details"}),(0,s.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:(null==R||null==(t=R.data)?void 0:t.message)||(null==R?void 0:R.message)||"Unknown error"})]}):O?(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"px-6 pt-5",children:[(0,s.jsx)("p",{className:"text-xs text-santas-grey leading-4",children:"FACT STATEMENT"}),(0,s.jsx)("p",{className:"mt-3 text-sm text-litmas-space-grey leading-5",children:O.content}),D&&(0,s.jsx)("p",{className:"text-xs text-amber-700 mt-3",children:"This fact has been deleted from the case and will not be used in Evidence Mapper or AI retrieval."}),(null==(a=O.temporal)?void 0:a.startDate)&&(0,s.jsxs)("p",{className:"mt-4 text-xs text-santas-grey leading-4",children:["Date:"," ",new Date(O.temporal.startDate).toLocaleDateString()]}),(0,s.jsx)("div",{className:"mt-5 h-px bg-zinc-100"})]}),O.supportingEvidence&&O.supportingEvidence.length>0&&(0,s.jsxs)("div",{className:"px-6 pt-4 pb-2",children:[(0,s.jsxs)("p",{className:"text-xs text-santas-grey leading-4 mb-3",children:["SUPPORTING EVI
1DENCE (",O.supportingEvidence.length,")"]}),(0,s.jsx)("div",{className:"space-y-4",children:O.supportingEvidence.map((e,t)=>{var a,n,i,o,r,u,m;let g=e.documentId,y=(null==g?void 0:g._id)||g,v=(null==(a=e.documentId)?void 0:a.displayName)||(null==(n=e.documentId)?void 0:n.fileName)||"Unknown Document",N=(null==(o=e.documentId)||null==(i=o.documentType)?void 0:i.replace(/_/g," "))||"Unknown Type",f=e.lineNumbers&&(null!=(u=e.lineNumbers.start)?u:0)>0?"".concat(null!=(m=e.lineNumbers.start)?m:"").concat(e.lineNumbers.end?"-".concat(e.lineNumbers.end):""):"",b=()=>{let a=(0,h.rI)(e,y);if(a)return void A(a);if(y){var s;E({documentId:String(y),factId:d,evidenceIndex:t,factContent:O.content,evidenceHeader:{index:t+1,fileName:v,documentType:N,pincite:e.formattedCitation||"",page:(null==(s=e.pageNumbers)?void 0:s.length)?e.pageNumbers.join(", "):"",lines:f}})}else c.oR.error("Document ID not available")};return(0,s.jsxs)("div",{role:y?"button":void 0,tabIndex:y?0:void 0,"aria-label":y?"View source material for evidence ".concat(t+1):void 0,onClick:y?b:void 0,onKeyDown:y?e=>{e.target===e.currentTarget&&("Enter"===e.key||" "===e.key)&&(e.preventDefault(),b())}:void 0,className:"group/fact rounded-2xl outline outline-1 -outline-offset-1 outline-zinc-200 overflow-hidden transition-shadow hover:outline-litmas-petal-plush hover:shadow-[0px_0px_4px_0px_rgba(146,77,191,1.00)] ".concat(y?"cursor-pointer":""),children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 bg-chef-hat border-b border-zinc-100 px-4 py-2.5",children:[(0,s.jsx)("span",{className:"text-xs font-semibold text-litmas-space-grey tracking-tight",children:t+1}),(0,s.jsx)("span",{className:"flex-1 text-xs font-medium text-litmas-space-grey tracking-tight truncate",title:v,children:v}),(0,s.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-[5px] bg-slate-900 px-3 py-0.5 text-xs text-white whitespace-nowrap",children:[(0,s.jsx)(l.A,{className:"w-2.5 h-2.5"}),N]})]}),(0,s.jsxs)("div",{className:"px-4 py-3",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-x-6 gap-y-1 mb-5 text-[10px] leading-4",onClick:e=>e.stopPropagation(),children:[e.formattedCitation&&(0,s.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,s.jsx)("span",{className:"text-zinc-400",children:"Pincite"}),(0,s.jsx)(p.SE,{value:e.formattedCitation,onSave:e=>P(t,e),size:"sm",editIconClassName:"opacity-0 transition-opacity group-hover/fact:opacity-100 group-focus-within/fact:opacity-100"})]}),!(0,h.bR)(e)&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,s.jsx)("span",{className:"text-zinc-400",children:"Page"}),(0,s.jsx)(p.SE,{value:(null==(r=e.pageNumbers)?void 0:r.length)?e.pageNumbers.join(", "):"",onEdit:()=>c.oR.info("Please verify the PDF page number after you save."),onSave:a=>{let s=a.split(",").map(e=>Number.parseInt(e.trim(),10)).filter(e=>!Number.isNaN(e)&&e>0);s.length&&z(t,{pageNumbers:s},e.documentId)},placeholder:"e.g. 5",size:"sm",editIconClassName:"opacity-0 transition-opacity group-hover/fact:opacity-100 group-focus-within/fact:opacity-100"})]}),(0,s.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,s.jsx)("span",{className:"text-zinc-400",children:"Lines"}),(0,s.jsx)(p.SE,{value:f,onSave:a=>B(t,a,e.documentId),placeholder:"e.g. 15-15",size:"sm",editIconClassName:"opacity-0 transition-opacity group-hover/fact:opacity-100 group-focus-within/fact:opacity-100"})]})]})]}),e.extract&&(0,s.jsxs)("p",{className:"text-xs text-zinc-950 leading-4 tracking-tight",children:["“",(0,h.Cq)(e.extract),"”"]}),e.supportReason&&(0,s.jsx)("div",{className:"mt-3 pt-2 border-t border-zinc-100",children:(0,s.jsxs)("p",{className:"text-xs leading-4 tracking-tight",children:[(0,s.jsx)("span",{className:"font-medium text-litmas-space-grey",children:"Reasoning: "}),(0,s.jsx)("span",{className:"text-litmas-space-grey",children:e.supportReason})]})}),(0,s.jsx)("div",{className:"mt-3 flex justify-end",children:(0,s.jsx)(x.$,{variant:"outline",size:"sm",onClick:e=>{e.stopPropagation(),b()},disabled:!y,title:y?"View PDF at target page":"Document not available",children:"View source material"})})]})]},e._id||t)})})]})]}):(0,s.jsx)("div",{className:"text-center py-8",children:(0,s.jsx)("p",{className:"text-gray-500",children:"No fact data available"})})}),(0,s.jsxs)(g.Es,{className:"px-6 py-4 border-t border-zinc-100 flex justify-end gap-2",children:[(0,s.jsx)(x.$,{variant:"outline",onClick:G,disabled:!O,children:"Export"}),(0,s.jsx)(g.HM,{asChild:!0,children:(0,s.jsx)(x.$,{onClick:H,children:"Close"})})]})]})}),C&&"undefined"!=typeof document&&(0,o.createPortal)((0,s.jsx)(b,{documentId:C.documentId,factId:C.factId,evidenceIndex:C.evidenceIndex,factContent:C.factContent,evidenceHeader:C.evidenceHeader?{...C.evidenceHeader,onSaveFileName:e=>k(C.documentId,e),onSaveCitation:e=>P(C.evidenceIndex,e),onSavePage:e=>{let t=e.split(",").map(e=>Number.parseInt(e.trim(),10)).filter(e=>!Number.isNaN(e)&&e>0);t.length&&z(C.evidenceIndex,{pageNumbers:t},C.documentId)},onSaveLines:e=>B(C.evidenceIndex,e,C.documentId)}:C.evidenceHeader,onClose:()=>E(null)}),document.body)]})}},72993:(e,t,a)=>{a.d(t,{n:()=>s});function s(e){let t=e.split(/[-–—]/).map(e=>Number.parseInt(e.trim(),10)).filter(e=>!Number.isNaN(e)&&e>0);return t.length?{start:t[0],end:t.length>1?t[t.length-1]:t[0]}:null}},86905:(e,t,a)=>{a.d(t,{U:()=>n});var s=a(9648);function n(e){var t;return e?function(e){let t=new Map;for(let n of e){var a,s;let e=(null==(a=n.category)?void 0:a.trim())||"Other",l=null!=(s=t.get(e))?s:[];l.some(e=>e.value===n.id)||l.push({value:n.id,label:n.name||n.id}),t.set(e,l)}return Array.from(t,e=>
1{let[t,a]=e;return{label:t,options:a}})}(null!=(t=e.staticTypes)?t:[]):s.Ak.map(e=>({label:e.category,options:e.options.map(e=>({value:e.value,label:e.label}))}))}},92793:(e,t,a)=>{a.r(t),a.d(t,{CitationPopup:()=>eo});var s=a(60197),n=a(21835),l=a(74353),i=a(69464),o=a(86442),r=a(57448),c=a(91630),d=a(88079),u=a(67898),m=a(56772),p=a(23176),x=a(38146),g=a(24704),h=a(81382),y=a(55161),v=a(9365),N=a(65632),f=a(66498),b=a(82883),j=a(5185),T=a(35216);let I=e=>{let{type:t,explanation:a}=e,n=(()=>{switch(t){case"BINDING":case"BINDING_AUTHORITY":return{icon:"⚖️",label:"Binding Authority",bg:"bg-green-100",text:"text-green-800",border:"border-green-300"};case"PERSUASIVE":case"PERSUASIVE_AUTHORITY":return{icon:"\uD83D\uDCD8",label:"Persuasive Authority",bg:"bg-blue-100",text:"text-blue-800",border:"border-blue-300"};case"PERSUASIVE_SISTER":case"SISTER_JURISDICTION":return{icon:"\uD83D\uDD17",label:"Sister Jurisdiction",bg:"bg-indigo-100",text:"text-indigo-800",border:"border-indigo-300"};case"OUT_OF_STATE":case"NON_AUTHORITATIVE":return{icon:"\uD83C\uDF10",label:"Out-of-State Authority",bg:"bg-gray-100",text:"text-gray-700",border:"border-gray-300"};default:return null}})();return n?(0,s.jsxs)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg ".concat(n.bg," border ").concat(n.border),children:[(0,s.jsx)("span",{className:"text-lg mr-2",children:n.icon}),(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"font-medium ".concat(n.text),children:n.label}),a&&(0,s.jsx)("p",{className:"text-xs mt-0.5 ".concat(n.text," opacity-75"),children:a})]})]}):null};var w=a(51203),A=a(59414),C=a(40451),E=a(31321),O=a(71466),_=a(76998),R=a(36370),S=a(82435),D=a(55036);class M extends Error{constructor(e,t){super(t),this.status=e,this.name="OpinionFetchError"}}let P=new Map;async function L(e){var t;let a,s,n=String(e),l=P.get(n);if(l)return l;let i=function(e){var t,a;let s="/api/courtlistener/opinions/".concat(encodeURIComponent(e));if(null==(t=D.env.NEXT_PUBLIC_BACKEND_PREVIEW_TARGET)?void 0:t.trim())return s;let n=null==(a=D.env.NEXT_PUBLIC_BACKEND_URL)?void 0:a.trim().replace(/\/$/,"");return n?"".concat(n).concat(s):s}(n);try{a=await (0,S.t)(i,{method:"GET",headers:{Accept:"application/json"}})}catch(e){throw new M(0,"Network error while loading the opinion.")}if(!a.ok){if(404===a.status)throw new M(404,"Opinion not available.");throw new M(a.status,"Failed to load opinion (HTTP ".concat(a.status,")."))}try{s=await a.json()}catch(e){throw new M(a.status,"Received a malformed response from the server.")}let o=null!=(t=null==s?void 0:s.data)?t:s;if(!o||"string"!=typeof o.plainText)throw new M(a.status,"The opinion response was empty or malformed.");return P.set(n,o),o}let k={FOLLOWED:"bg-green-100 text-green-700",APPLIED:"bg-green-100 text-green-700",OVERRULED:"bg-red-100 text-red-700",REVERSED:"bg-red-100 text-red-700",VACATED:"bg-red-100 text-red-700",DISTINGUISHED:"bg-yellow-100 text-yellow-700",CRITICIZED:"bg-yellow-100 text-yellow-700",QUESTIONED:"bg-yellow-100 text-yellow-700"}
1,F=e=>{var t;let{context:a,onClose:n}=e,[l,i]=(0,j.useState)({status:"loading"}),[o,c]=(0,j.useState)(0),d=(0,j.useRef)(null),u=null==a?void 0:a.citingCaseId;(0,j.useEffect)(()=>{if(null==u)return;let e=P.get(String(u));if(e)return void i({status:"success",data:e});let t=!1;return i({status:"loading"}),L(u).then(e=>{t||i({status:"success",data:e})}).catch(e=>{if(t)return;let a=e instanceof M&&404===e.status;i({status:"error",message:e instanceof M?e.message:"Something went wrong while loading the opinion.",notFound:a})}),()=>{t=!0}},[u,o]),(0,j.useEffect)(()=>{"success"===l.status&&d.current&&(d.current.scrollTop=0)},[l.status,u]);let m=(0,j.useMemo)(()=>{if("success"!==l.status)return null;let{data:e}=l;return!function(e){let t=e.toLowerCase();return t.includes("html")||t.includes("xml")}(e.sourceColumn)?null:C.A.sanitize(e.plainText,{ADD_ATTR:["target","rel"]})},[l]),p=(0,j.useCallback)(()=>{c(e=>e+1)},[]),x=null!=a,g=(null==a?void 0:a.citingCaseName)||"Opinion",h=[null==a?void 0:a.court,function(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString()}(null==a?void 0:a.dateFiled)].filter(Boolean).join(" \xb7 "),y=null==a||null==(t=a.treatment)?void 0:t.toUpperCase();return(0,s.jsx)(R.lG,{open:x,onOpenChange:e=>!e&&n(),children:(0,s.jsxs)(R.Cf,{priority:"detail",showCloseButton:!0,className:"flex max-h-[90vh] w-full max-w-4xl flex-col gap-0 overflow-hidden p-0",children:[(0,s.jsxs)(R.c7,{className:"border-b border-zinc-100 px-6 py-4 pr-12 text-left",children:[(0,s.jsx)(R.L3,{className:"text-base font-semibold text-litmas-space-grey",children:g}),h&&(0,s.jsx)("p",{className:"text-xs text-santas-grey",children:h})]}),(0,s.jsxs)("div",{ref:d,className:"flex-1 overflow-y-auto px-6 py-5",children:[(y||(null==a?void 0:a.keyQuote)||(null==a?void 0:a.reasoning))&&(0,s.jsxs)("div",{className:"mb-5 rounded-xl bg-neutral-50 p-4 outline outline-1 -outline-offset-1 outline-zinc-200",children:[y&&(0,s.jsx)("span",{className:"inline-flex items-center rounded-[5px] px-3 py-0.5 text-xs leading-4 ".concat(k[y]||"bg-gray-100 text-gray-700"),children:y}),(null==a?void 0:a.keyQuote)&&(0,s.jsxs)("p",{className:"mt-2 text-xs italic leading-5 text-litmas-space-grey",children:["“",a.keyQuote,"”"]}),(null==a?void 0:a.reasoning)&&(0,s.jsx)("p",{className:"mt-2 text-xs leading-5 text-litmas-space-grey",children:a.reasoning})]}),"loading"===l.status&&(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-santas-grey",children:[(0,s.jsx)(r.A,{className:"mb-3 h-7 w-7 animate-spin text-litmas-liberal-lilac"}),(0,s.jsx)("p",{className:"text-sm",children:"Loading opinion…"})]}),"error"===l.status&&(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[l.notFound?(0,s.jsx)(N.A,{className:"mb-3 h-10 w-10 text-zinc-300"}):(0,s.jsx)(E.A,{className:"mb-3 h-10 w-10 text-red-300"}),(0,s.jsx)("p",{className:"text-sm font-medium text-litmas-space-grey",children:l.message}),!l.notFound&&(0,s.jsxs)(_.$,{variant:"outline",onClick:p,className:"mt-4 gap-2",children:[(0,s.jsx)(O.A,{className:"h-4 w-4"}),"Retry"]})]}),"success"===l.status&&(null!=m?(0,s.jsx)("div",{className:"cl-opinion text-sm leading-6 text-litmas-space-grey [&_a]:text-litmas-liberal-lilac [&_a]:underline",dangerouslySetInnerHTML:{__html:m}}):(0,s.jsx)("div",{className:"whitespace-pre-wrap text-sm leading-6 text-litmas-space-grey",children:l.data.plainText}))]})]})})};var U=a(69467),z=a(23342),B=a(43796),H=a(46707);function G(e){var t,a;return(null==(t=e.reporter)?void 0:t.volume)&&(null==(a=e.reporter)?void 0:a.name)?[e.reporter.volume,e.reporter.name,e.reporter.page].filter(Boolean).join(" "):e.citation||e.normalizedCitation||e.citationText||e.shortCite}function K(e){if(!e.goodLawAnalysis&&!e.goodLawStatus)return null;if(e.goodLawAnalysis){var t,a,s,n,l,i,o,r,c,d,u,m,p,x,g,h;let y=e.goodLawAnalysis.twoPassAnalysis||{},v=e.goodLawAnalysis.summary||{};return(null==(t=y.pass2Results)?void 0:t.assessment)||v.assessment||y.pass1Results&&0!==y.pass1Results.length?{assessment:(null==v?void 0:v.hasBeenOverruled)?"BAD_LAW":(null==(a=y.pass2Results)?void 0:a.assessment)||v.asse
1ssment,hasBeenOverruled:null==v?void 0:v.hasBeenOverruled,confidence:null!=(h=null!=(g=null==(s=y.pass2Results)?void 0:s.confidence)?g:v.confidence)?h:null,isGoodLaw:void 0!==v.isGoodLaw?v.isGoodLaw:(null==(n=y.pass2Results)?void 0:n.assessment)==="GOOD_LAW",indeterminate:!0===v.indeterminate||(null==(l=y.pass2Results)?void 0:l.indeterminate)===!0,needsVerification:!0===v.needsVerification||!0===v.indeterminate||(null==(i=y.pass2Results)?void 0:i.indeterminate)===!0,indicators:e.goodLawAnalysis.indicators||v.indicators||{citationCount:(null==(o=y.metadata)?void 0:o.citingCasesFound)||0,lastCitedDate:v.lastCitedDate},twoPassAnalysis:{metadata:{citingCasesAnalyzed:(null==(r=y.metadata)?void 0:r.citingCasesAnalyzed)||0,citingCasesFound:(null==(c=y.metadata)?void 0:c.citingCasesFound)||0,models:null==(d=y.metadata)?void 0:d.models},pass1Results:y.pass1Results||[],pass2Results:{overallReasoning:null==(u=y.pass2Results)?void 0:u.overallReasoning,keyFactors:(null==(m=y.pass2Results)?void 0:m.keyFactors)||[],assessment:null==(p=y.pass2Results)?void 0:p.assessment,confidence:null==(x=y.pass2Results)?void 0:x.confidence}}}:null}return e.goodLawStatus?{assessment:e.goodLawStatus.assessment,confidence:e.goodLawStatus.confidence,isGoodLaw:e.goodLawStatus.isGoodLaw,indicators:e.goodLawStatus.indicators,userOverride:e.goodLawStatus.userOverride,twoPassAnalysis:e.goodLawStatus.twoPassAnalysis}:null}var Y=a(29493),V=a(10176);let W=e=>e?e.replace(/\s*\(weighted\s+[\d.]+\)/gi,"").trim():e,$=e=>null==e?"":String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"),Q=e=>$(e).replace(/\r?\n/g,"<br />"),q=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Not available.";return'<p class="empty">'.concat($(e),"</p>")},J=e=>{let t=e.map(e=>null==e?"":String(e).trim()).filter(Boolean);return 0===t.length?q():"<ul>".concat(t.map(e=>"<li>".concat(Q(e),"</li>")).join(""),"</ul>")},X=e=>{let t=e.filter(e=>{let[,t]=e;return null!=t&&String(t).trim()});return 0===t.length?"":"<dl>".concat(t.map(e=>{let[t,a]=e;return"\n    <div>\n      <dt>".concat($(t),"</dt>\n      <dd>").concat(Q(a),"</dd>\n    </div>\n  ")}).join(""),"</dl>")},Z=(e,t)=>'\n  <div class="subsection">\n    <h3>'.concat($(e),"</h3>\n    ").concat(t,"\n  </div>\n"),ee=e=>"number"!=typeof e||Number.isNaN(e)?null:"".concat(Math.round(100*e),"%"),et={UNKNOWN:{label:"Unknown",abbr:"?",description:"Petition history not yet determined",bgColor:"bg-gray-100",textColor:"text-gray-700"},NO_PET:{label:"No Petition",abbr:"no pet.",description:"No petition for review was filed",bgColor:"bg-blue-100",textColor:"text-blue-700"},NO_PET_H:{label:"No Petition History",abbr:"no pet. h.",description:"No petition history available yet (case is recent)",bgColor:"bg-yellow-100",textColor:"text-yellow-700"},PET_DENIED:{label:"Petition Denied",abbr:"pet. denied",description:"Petition for review was denied by Texas Supreme Court",bgColor:"bg-green-100",textColor:"text-green-700"},PET_GRANTED:{label:"Petition Granted",abbr:"pet. granted",description:"Petition for review was granted - check Texas Supreme Court opinion",bgColor:"bg-orange-100",textColor:"text-orange-700"},PET_DISMISSED:{label:"Petition Dismissed",abbr:"pet. dismissed",description:"Petition for review was dismissed",bgColor:"bg-gray-100",textColor:"text-gray-600"},PET_WITHDRAWN:{label:"Petition Withdrawn",abbr:"pet. withdrawn",description:"Petitioner withdrew the petition for review",bgColor:"bg-gray-100",textColor:"text-gray-600"},PET_ABATED:{label:"Petition Abated",abbr:"pet. abated",description:"Petition for review was abated (temporarily suspended)",bgColor:"bg-yellow-100",textColor:"text-yellow-700"}},ea=Object.entries(et).filter(e=>{let[t]=e;return"UNKNOWN"!==t}).map(e=>{let[t,a]=e;return{value:t,label:"".concat(a.label," (").concat(a.abbr,")")}}),es={FOLLOWED:{bg:"bg-green-500",text:"text-green-700",label:"Followed"},APPLIED:{bg:"bg-green-400",text:"text-green-600",label:"Applied"},CITED:{bg:"bg-blue-400",text:"text-blue-600",label:"Cited"},DISCUSSED:{bg:"bg-blue-300",text:"text-blue-500",label:"Discussed"},MENTIONED:{bg:"bg-gray-400",text:"text-gray-600",label:"Mentioned"},DISTINGUISHED:{bg:"bg-yellow-400",text:"text-yellow-700",label:"Distinguished"},QUESTIONED:{bg:"bg-orange-400",text:"text-orange-600",label:"Questioned"},CRITICIZED:{bg:"bg-orange-500",text:"text-orange-700",label:"Criticized"},LIMITED:{bg:"bg-orange-300",text:"text-orange-500",label:"Limited"},OVERRULED:{bg:"bg-red-500",text:"text-red-700",label:"Overruled"},REVERSED:{bg:"bg-red-600",text:"text-red-800",label:"Reversed"},VACATED:{bg:"bg-red-400",text:"text-red-600",label:"Vacated"}},en={positive:{label:"Positive Treatment",icon:"✓",bgColor:"bg-green-50",borderColor:"border-green-200",textColor:"text-green-700",pillBg:"bg-green-100",pillText:"text-green-800",treatments:["FOLLOWED","APPLIED","AFFIRMED"]},neutral:{label:"Neutral Treatment",icon:"•",bgColor:"bg-blue-50",borderColor:"border-blue-200",textColor:"text-blue-700",pillBg:"bg-blue-100",pillText:"text-blue-800",treatments:["CITED","DISCUSSED","MENTIONED","EXPLAINED"]},cautionary:{label:"Cautionary Treatment",icon:"!",bgColor:"bg-yellow-50",borderColor:"border-yellow-200",textColor:"text-yellow-700",pillBg:"bg-yellow-100",pillText:"text-yellow-800",treatments:["DISTINGUISHED","QUESTIONED","CRITICIZED","LIMITED"]},negative:{label:"Negative Treatment",icon:"✗",bgColor:"bg-red-50",borderColor:"border-red-200",textColor:"text-red-700",pillBg:"bg-red-100",pillText:"text-red-800",treatments:["OVERRULED","REVERSED","VACATED","SUPERSEDED"]}},el={positive:{dot:"bg-get-up-and-go",outline:"outline-get-up-and-go",darkB
1adge:!1},neutral:{dot:"bg-lightish-blue",outline:"outline-lightish-blue",darkBadge:!1},cautionary:{dot:"bg-yellow-400",outline:"outline-yellow-400",darkBadge:!0},negative:{dot:"bg-red-500",outline:"outline-red-500",darkBadge:!0}},ei=e=>{let{title:t,count:a,open:n,onToggle:o,divider:r,children:c}=e;return(0,s.jsxs)("div",{className:r?"pt-4 border-t border-gray-200":void 0,children:[(0,s.jsxs)("button",{type:"button",onClick:o,className:"flex w-full items-center justify-between gap-2 text-left",children:[(0,s.jsxs)("span",{className:"text-xs uppercase tracking-wide text-litmas-shiner",children:[t,"number"==typeof a&&a>0&&(0,s.jsxs)("span",{className:"ml-1 lowercase text-litmas-shiner",children:["(",a,")"]})]}),n?(0,s.jsx)(l.A,{className:"w-3.5 h-3.5 text-black shrink-0"}):(0,s.jsx)(i.A,{className:"w-3.5 h-3.5 text-black shrink-0"})]}),n&&(0,s.jsx)("div",{className:"mt-3",children:c})]})},eo=e=>{var t,a,C,E,O,S,D,M,P,L,k,eo,er,ec,ed,eu,em,ep,ex,eg,eh,ey,ev,eN,ef,eb,ej,eT,eI,ew,eA,eC,eE,eO,e_,eR,eS,eD,eM,eP,eL,ek,eF,eU,ez,eB,eH,eG,eK,eY,eV,eW,e$,eQ,eq;let{citation:eJ,citationId:eX,caseId:eZ,usageId:e0,chatReferences:e1,onClose:e2,onCitationUpdated:e5,isOpen:e4=!0}
1=e,[e3,e6]=(0,j.useState)("overview"),[e7,e8]=(0,j.useState)(!1),[e9,te]=(0,j.useState)(null),[tt,ta]=(0,j.useState)([]),[ts,tn]=(0,j.useState)(null),[tl,ti]=(0,j.useState)(null),[to,tr]=(0,j.useState)(!1),[tc,td]=(0,j.useState)(!1),[tu,tm]=(0,j.useState)("split"),[tp,tx]=(0,j.useState)(!0),[tg,th]=(0,j.useState)(!1),[ty,tv]=(0,j.useState)(!1),[tN,tf]=(0,j.useState)({}),[tb,tj]=(0,j.useState)(null),[tT,tI]=(0,j.useState)(!1),[tw,tA]=(0,j.useState)(!1),[tC,tE]=(0,j.useState)(null),[tO,t_]=(0,j.useState)(""),[tR,tS]=(0,j.useState)(!1),tD=eX||(null==eJ?void 0:eJ._id)||(null==eJ?void 0:eJ.id)||"",{lastEvent:tM,connectionState:tP}=(0,H.oG)(tD,{enabled:to||e7}),{data:tL,isLoading:tk,error:tF,refetch:tU}=(0,V.jG)({citationId:tD,caseId:eZ},{skip:!tD,pollingInterval:to||tc||e7?2e3:0,refetchOnMountOrArgChange:!0}),[tz]=(0,V.uZ)(),[tB,{isLoading:tH}]=(0,V.R9)(),[tG,{isLoading:tK}]=(0,V.TY)(),{data:tY,isLoading:tV,refetch:tW}=(0,V.Fu)(tD,{skip:!tD}),[t$,{isLoading:tQ}]=(0,V.sF)(),[tq,{isLoading:tJ}]=(0,V.R0)(),{data:tX}=(0,V.dF)(eZ?{caseId:eZ}:n.hT),tZ=(0,j.useMemo)(()=>tM&&("citation_analysis_updated"===tM.type||"citation_good_law_updated"===tM.type)?{status:tM.analysisStatus||tM.status}:null,[tM]);(0,j.useEffect)(()=>{tM&&("citation_updated"===tM.type||"citation_good_law_updated"===tM.type||"citation_relevance_updated"===tM.type||"citation_analysis_updated"===tM.type)&&tU()},[tM,tU]);let t0=eJ||eX&&(null==e1||null==(t=e1.citations)?void 0:t[Number(eX)]),t1=function(e,t){var a,s,n,l,i,o,r,c,d,u,m,p;if(!e)return null;let x=(null==e?void 0:e.data)||e,g=(null==x?void 0:x.court)&&"Unknown Court"!==x.court?x.court:null==t?void 0:t.court,h=(null==x?void 0:x.courtName)&&"Unknown Court"!==x.courtName?null==x?void 0:x.courtName:null==t?void 0:t.courtName,y=x.year||x.yearDecided||(null==t?void 0:t.year)||(null==t?void 0:t.yearDecided),v=x.dateDecided||(null==t?void 0:t.dateDecided),N=g&&"object"==typeof g;return x.goodLawAnalysis||x.goodLawStatus,{id:x._id||x.id||x.citationId,caseName:x.caseName||x.citationName||((null==(a=x.caseCaption)?void 0:a.plaintiff)&&(null==(s=x.caseCaption)?void 0:s.defendant)?"".concat(x.caseCaption.plaintiff," v. ").concat(x.caseCaption.defendant):null)||"Unknown Case",citationText:G(x)||G(t)||"Citation not available",citation:G(x)||G(t)||"Citation not available",year:y||(v?new Date(v).getFullYear():null),court:N?g:h||g||"Unknown Court",courtName:N?(null==g?void 0:g.fullName)||(null==g?void 0:g.abbreviation):h||g||"Unknown Court",courtAbbreviation:N?null==g?void 0:g.abbreviation:null,jurisdiction:N?null==g?void 0:g.jurisdiction:null,courtLevel:N?null==g?void 0:g.level:null,state:N?null==g?void 0:g.state:null,federalCircuit:N?null==g?void 0:g.federalCircuit:null,district:N?null==g?void 0:g.district:null,summary:(null==(n=x.content)?void 0:n.summary)||x.summary,analysis:(null==(l=x.content)?void 0:l.analysis)||x.analysis||x.legalAnalysis,opinionText:(null==(i=x.content)?void 0:i.opinionText)||x.opinionText,holdings:(u=x).holdings&&Array.isArray(u.holdings)&&u.holdings.length>0?u.holdings:(null==(m=u.legalContent)?void 0:m.holdings)?u.legalContent.holdings:u.keyHoldings?Array.isArray(u.keyHoldings)?u.keyHoldings:[u.keyHoldings]:null,precedentialValue:x.precedentialValue||null,goodLawStatus:K(x),goodLawData:K(x),opinionAnalysis:function(e){var t,a;if(!e.opinionAnalysis)return null;let s=e.opinionAnalysis;return(null==(t=s.holdings)?void 0:t.length)||(null==(a=s.legalPrinciples)?void 0:a.length)||s.factsSummary?{holdings:s.holdings||[],legalPrinciples:s.legalPrinciples||[],factsSummary:s.factsSummary||void 0,proceduralHistory:s.proceduralHistory||void 0,dissents:s.dissents||void 0,relevantQuotes:s.relevantQuotes||void 0,topicTags:s.topicTags||void 0,analyzedAt:s.analyzedAt||void 0,model:s.model||void 0}:null}(x),authorityType:(null==(r=x.usageContext)||null==(o=r.authorityType)?void 0:o.type)||x.authorityType||null,authorityExplanation:(null==(d=x.usageContext)||null==(c=d.authorityType)?void 0:c.explanation)||x.authorityReason||null,justiaUrl:x.justiaUrl,googleScholarUrl:x.googleScholarUrl,externalIds:x.externalIds,dataSource:(p=x).__source?p.__source:p.court&&"object"==typeof p.court?"modern":p.citationName&&!p.reporter?"legacy":"unknown",hasFullData:N}}(tL||t0,eJ),t2=(null==t1?void 0:t1.courtName)==="U.S."?"U.S. Supreme Court":null==t1?void 0:t1.courtName,t5=[(null==t1?void 0:t1.summary)||(null==t1?void 0:t1.analysis),null==t1||null==(a=t1.holdings)?void 0:a.length,(null==t1||null==(E=t1.opinionAnalysis)||null==(C=E.legalPrinciples)?void 0:C.length)||(null==t1||null==(O=t1.opinionAnalysis)?void 0:O.factsSummary)||(null==t1||null==(S=t1.opinionAnalysis)?void 0:S.proceduralHistory)||(null==t1||null==(M=t1.opinionAnalysis)||null==(D=M.dissents)?void 0:D.length)||(null==t1||null==(L=t1.opinionAnalysis)||null==(P=L.topicTags)?void 0:P.length),null==t1?void 0:t1.courtName,null==tl||null==(k=tl.keyQuotes)?void 0:k.length].filter(
1Boolean).length,t4=(null==t1?void 0:t1.opinionText)?function(e,t){if(!e)return"";let{preserveNewlines:a=!0,decodeEntities:s=!0,maxLength:n=null}=t,l=e;return a&&(l=(l=(l=(l=l.replace(/<\/(p|div|blockquote|h[1-6])>/gi,"\n\n")).replace(/<br\s*\/?>/gi,"\n")).replace(/<li>/gi,"\n• ")).replace(/<\/li>/gi,"")),l=l.replace(/<[^>]*>/g,""),s&&(l=function(e){let t=e;for(let[e,a]of Object.entries({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&apos;":"'","&nbsp;":" ","&mdash;":"-","&ndash;":"–","&hellip;":"…","&sect;":"\xa7","&para;":"\xb6","&copy;":"\xa9","&reg;":"\xae","&trade;":"™","&bull;":"•","&middot;":"\xb7","&ldquo;":'"',"&rdquo;":'"',"&lsquo;":"'","&rsquo;":"'","&euro;":"€","&pound;":"\xa3","&yen;":"\xa5","&cent;":"\xa2"}))t=t.replace(RegExp(e,"gi"),a);return(t=t.replace(/&#(\d+);/g,(e,t)=>{try{return String.fromCharCode(Number.parseInt(t,10))}catch(t){return e}})).replace(/&#x([0-9a-f]+);/gi,(e,t)=>{try{return String.fromCharCode(Number.parseInt(t,16))}catch(t){return e}})}(l)),l=l.replace(/\n{3,}/g,"\n\n").replace(/[ \t]+/g," ").replace(/\n[ \t]+/g,"\n").split("\n").map(e=>e.trim()).join("\n").trim(),n&&l.length>n&&(l=function(e,t){let a=e.substring(0,t),s=a.lastIndexOf("."),n=a.lastIndexOf("!"),l=[s,n,a.lastIndexOf("?"),a.lastIndexOf("\n")].filter(e=>e>.7*t);if(l.length>0){let t=Math.max(...l);return"".concat(e.substring(0,t+1).trim(),"...")}let i=a.lastIndexOf(" ");return i>.8*t?"".concat(a.substring(0,i).trim(),"..."):"".concat(a.trim(),"...")}(l,n)),l}(t1.opinionText,{preserveNewlines:!0,maxLength:null}):null,t3=null==t1||null==(er=t1.goodLawData)||null==(eo=er.twoPassAnalysis)?void 0:eo.pass2Results,t6=(0,j.useMemo)(()=>{var e;return null!=(e=null==t3?void 0:t3.keyFactors)?e:[]},[t3]),t7=null==t3?void 0:t3.overallReasoning,t8=(0,j.useMemo)(()=>{var e,t,a;return null!=(a=null==t1||null==(t=t1.goodLawData)||null==(e=t.twoPassAnalysis)?void 0:e.pass1Results)?a:[]},[null==t1||null==(ed=t1.goodLawData)||null==(ec=ed.twoPassAnalysis)?void 0:ec.pass1Results]),t9=null!=(eq=null==t1||null==(ep=t1.goodLawData)||null==(em=ep.twoPassAnalysis)||null==(eu=em.metadata)?void 0:eu.citingCasesAnalyzed)?eq:t8.length,ae=(0,j.useMemo)(()=>{let e={};t8.forEach(t=>{let a=String((null==t?void 0:t.treatment)||"CITED").toUpperCase();(e[a]||(e[a]=[])).push(t)});let t=["negative","cautionary","neutral","positive"];return Object.entries(e).map(e=>{let[t,a]=e;return{treatment:t,items:a,category:(e=>{for(let[t,a]of Object.entries(en))if(a.treatments.includes(e))return t;return"neutral"})(t)}}).sort((e,a)=>t.indexOf(e.category)-t.indexOf(a.category))},[t8]),at=String((null==tL||null==(ex=tL.goodLawAnalysis)?void 0:ex.analysisStatus)||"").toUpperCase(),aa=String((null==tL||null==(eg=tL.citationUsage)?void 0:eg.relevanceAnalysisStatus)||"").toUpperCase(),as=!(null==t1||null==(eh=t1.goodLawData)?void 0:eh.assessment)&&["PENDING","PROCESSING"].includes(at),an=!tl&&"PENDING"===aa;(0,j.useEffect)(()=>{let e=!!e4&&(as||an);td(t=>t===e?t:e)},[e4,as,an]),(0,j.useEffect)(()=>{if(console.log("[CitationPopup] apiCitation received:",{hasApiCitation:!!tL,caseId:eZ,motionTypes:null==tL?void 0:tL.motionTypes,citationUsage:null==tL?void 0:tL.citationUsage}),null==tL?void 0:tL.citationUsage){let e=tL.citationUsage;tn(e.usageId),ti(e.relevance||null)}(null==tL?void 0:tL.motionTypes)&&(console.log("[CitationPopup] Setting currentMotionTypes from apiCitation:",tL.motionTypes),ta(tL.motionTypes))},[tL,eZ]),(0,j.useEffect)(()=>{if(tX&&tD&&!(null==tL?void 0:tL.citationUsage)){var e,t,a,s;let n=[...tX.confirmed||[],...tX.drafts||[]].find(e=>{var t,a;return(null==(t=e.citation)?void 0:t._id)===tD||(null==(a=e.citationUsage)?void 0:a.citationId)===tD});(null==n||null==(e=n.citationUsage)?void 0:e._id)&&(tn(n.citationUsage._id),ti((null==(a=n.citationUsage)||null==(t=a.usage)?void 0:t.relevance)||(null==(s=n.citationUsage)?void 0:s.relevance)||null)),!(null==tL?void 0:tL.motionTypes)&&(null==n?void 0:n.allContexts)&&ta(n.allContexts.filter(e=>{var t;return(null==(t=e.context)?void 0:t.type)==="MOTION_TYPE"}).map(e=>e.context.id||""))}},[tX,tD,tL]),(0,j.useEffect)(()=>
1{if(to){var e,t,a,s,n,l,i,o,r,c;let d=null==tL||null==(e=tL.citationUsage)?void 0:e.relevance,u=null==tL||null==(t=tL.citationUsage)?void 0:t.relevanceAnalysisStatus,m=null==tL||null==(a=tL.citationUsage)?void 0:a.relevanceAnalysisError;if(!u&&tX){let e=[...tX.confirmed||[],...tX.drafts||[]].find(e=>{var t,a;return(null==(t=e.citation)?void 0:t._id)===tD||(null==(a=e.citationUsage)?void 0:a.citationId)===tD});d=(null==e||null==(n=e.citationUsage)||null==(s=n.usage)?void 0:s.relevance)||(null==e||null==(l=e.citationUsage)?void 0:l.relevance),u=null==e||null==(o=e.citationUsage)||null==(i=o.usage)?void 0:i.relevanceAnalysisStatus,m=null==e||null==(c=e.citationUsage)||null==(r=c.usage)?void 0:r.relevanceAnalysisError}"COMPLETED"===u&&(null==d?void 0:d.score)!==void 0?(ti(d),tr(!1),T.oR.success("Case relevance analysis complete!")):"FAILED"===u&&(tr(!1),T.oR.error("Relevance analysis failed: ".concat(m||"Analysis failed")))}},[tL,tX,to,tD]),(0,j.useEffect)(()=>{tZ&&(console.log("Analysis status:",tZ),"COMPLETED"===tZ.status?(console.log("Good law analysis completed, refetching citation..."),tU(),e8(!1),te(null)):"FAILED"===tZ.status&&(console.error("Good law analysis failed"),e8(!1),te(null)))},[tZ,tU]);let al=(0,j.useCallback)(async()=>{if(console.log("Starting good law analysis for citation:",tD),!tD)return void console.error("Cannot analyze: citationId is undefined");try{console.log("Calling trigger API...",{citationId:tD,caseId:eZ});let e=await tz({citationId:tD,caseId:eZ}).unwrap();console.log("Trigger result:",e),e8(!0),te(tD)}catch(e){console.error("Error triggering good law analysis:",e),e8(!1)}},[tD,tz]),ai=(0,j.useCallback)(async()=>{if(!eZ||!tD)return void T.oR.error("Cannot re-analyze: Missing case or citation ID");console.log("[RelevanceAnalysis] Re-analyzing for:",{caseId:eZ,effectiveCitationId:tD});try{let e=await tG({caseId:eZ,citationId:tD}).unwrap();console.log("[RelevanceAnalysis] Re-analyze result:",e),e.success&&("COMPLETED"===e.status&&e.relevance?(ti(e.relevance),T.oR.success("Case relevance analysis complete!")):"PENDING"===e.status&&tr(!0))}catch(t){var e;console.error("[RelevanceAnalysis] Re-analyze error:",t),T.oR.error((null==t||null==(e=t.data)?void 0:e.message)||"Failed to start re-analysis")}},[eZ,tD,tG]),ao=(0,j.useCallback)(async()=>{if(!eZ||!tD)return void T.oR.error("Case ID and Citation ID are required");console.log("[RelevanceAnalysis] Starting analysis for:",{caseId:eZ,effectiveCitationId:tD});try{let e=await tG({caseId:eZ,citationId:tD}).unwrap();console.log("[RelevanceAnalysis] Result received:",e),e.success?(tn(e.citationUsageId),"COMPLETED"===e.status&&e.relevance?(ti(e.relevance),T.oR.success("Case relevance analysis complete!")):"PENDING"===e.status&&tr(!0),e.wasCreated&&(0,T.oR)("Citation added to case as draft",{icon:"ℹ️"})):(console.error("[RelevanceAnalysis] Analysis failed:",e.error||e.status),T.oR.error(e.error||"Failed to analyze relevance. Please try again."),e.citationUsageId&&tn(e.citationUsageId))}catch(t){var e;console.error("[RelevanceAnalysis] Caught error:",t),console.error("[RelevanceAnalysis] Error type:",typeof t),console.error("[RelevanceAnalysis] Error keys:",t?Object.keys(t):"null"),console.error("[RelevanceAnalysis] Error stringified:",JSON.stringify(t,null,2)),T.oR.error((null==t||null==(e=t.data)?void 0:e.message)||"Failed to analyze case relevance")}},[eZ,tD,tG]),ar=(0,j.useCallback)(async()=>{if(!tD)return void T.oR.error("Citation ID required");tS(!0);try{let e=await t$(tD).unwrap();if(e.success){if("COMPLETED"===e.status)T.oR.success("Texas petition history resolved!"),tW(),tS(!1);else if("PENDING"===e.status){(0,T.oR)("Resolving petition history... This may take a moment.",{icon:"⏳"});let e=setInterval(async()=>{var t,a;(null==(a=(await tW()).data)||null==(t=a.texasWritHistory)?void 0:t.status)!=="UNKNOWN"&&(clearInterval(e),tS(!1),T.oR.success("Texas petition history resolved!"))},3e3);setTimeout(()=>{clearInterval(e),tS(!1)},6e4)}}else tS(!1)}catch(t){var e;console.error("Error resolving Texas petition history:",t),T.oR.error((null==t||null==(e=t.data)?void 0:e.error)||"Failed to resolve petition history"),tS(!1)}},[tD,t$,tW]),ac=(0,j.useCallback)(async()=>
1{if(!tD||!tC)return void T.oR.error("Please select a status");try{(await tq({citationId:tD,status:tC,reason:tO||void 0}).unwrap()).success&&(T.oR.success("Petition history status updated"),tA(!1),tE(null),t_(""),tW())}catch(t){var e;console.error("Error updating Texas petition history:",t),T.oR.error((null==t||null==(e=t.data)?void 0:e.error)||"Failed to update petition history")}},[tD,tC,tO,tq,tW]),ad=(0,j.useCallback)(async()=>{if(t4)try{await navigator.clipboard.writeText(t4),tI(!0),setTimeout(()=>tI(!1),2e3)}catch(e){console.error("Failed to copy text:",e),T.oR.error("Failed to copy opinion text")}},[t4]),au=(0,j.useCallback)(()=>{var e,t,a;if(!t1)return;let s=document.createElement("iframe");s.style.position="absolute",s.style.width="0",s.style.height="0",s.style.border="none",s.style.visibility="hidden",document.body.appendChild(s);let n=s.contentDocument||(null==(e=s.contentWindow)?void 0:e.document);if(!n){document.body.removeChild(s),T.oR.error("Failed to prepare printable summary");return}n.open(),n.write((e=>{var t,a,s,n,l,i,o,r,c;let{citation:d,courtName:u,fullOpinionCleaned:m,relevanceData:p,keyFactors:x,overallReasoning:g,pass1Results:h}=e,y=d.caseName||d.name||"Citation Summary",v=Object.entries((null==(t=d.goodLawData)?void 0:t.treatmentCounts)&&Object.keys(d.goodLawData.treatmentCounts).length>0?d.goodLawData.treatmentCounts:(e=>{if(!(null==e?void 0:e.length))return{};let t={};return e.forEach(e=>{var a;let s=null==(a=e.treatment)?void 0:a.toUpperCase();s&&(t[s]=(t[s]||0)+1)}),t})(h)).map(e=>{let[t,a]=e;return"".concat(t.replace(/_/g," "),": ").concat(a)}),N=(d.holdings||[]).map(e=>"string"==typeof e?e:null==e?void 0:e.text).filter(Boolean),f=Array.isArray(null==p?void 0:p.keyQuotes)?p.keyQuotes:[],b=Array.isArray(null==p?void 0:p.distinctions)?p.distinctions:[],j=Array.isArray(null==p?void 0:p.elementRelevance)?p.elementRelevance:[],T=[X([["Citation",d.citationText||d.fullCitation||d.citation],["Court",u||d.courtName],["Year",d.year],["Authority",d.authorityType],["Authority Notes",d.authorityExplanation]]),Z("Key Holdings",J(N)),(null==(s=d.opinionAnalysis)||null==(a=s.legalPrinciples)?void 0:a.length)?Z("Legal Principles",J(d.opinionAnalysis.legalPrinciples)):"",d.summary||d.analysis?Z(d.summary?"Summary":"Legal Analysis","<p>".concat(Q(d.summary||d.analysis),"</p>")):"",(null==(n=d.opinionAnalysis)?void 0:n.factsSummary)?Z("Facts Snapshot","<p>".concat(Q(d.opinionAnalysis.factsSummary),"</p>")):"",(null==(l=d.opinionAnalysis)?void 0:l.proceduralHistory)?Z("Procedural History","<p>".concat(Q(d.opinionAnalysis.proceduralHistory),"</p>")):""].filter(Boolean).join(""),I=(0,Y.K)(null!=(c=d.goodLawData)?c:{}),w=(null==(i=d.goodLawData)?void 0:i.assessment)?[X([["Assessment","presumptive"===I.state?"".concat(d.goodLawData.assessment.replace("_"," ")," (presumptive, verify before relying on it)"):d.goodLawData.assessment.replace("_"," ")],["Confidence",I.showConfidence?ee(d.goodLawData.confidence):"Not established"],["Citing Cases Analyzed",null==(r=d.goodLawData.twoPassAnalysis)||null==(o=r.metadata)?void 0:o.citingCasesAnalyzed]]),I.caveat?Z("Verification Note","<p>".concat(Q(I.caveat),"</p>")):"",x.length>0?Z("Key Factors",J(x.map(e=>W(String(e))))):"",g?Z("Overall Reasoning","<p>".concat(Q(W(g)),"</p>")):"",v.length>0?Z("Treatment Counts",J(v)):"",h.length>0?Z("Citing Case Analysis",h.map(e=>{let t=e.citingCaseCitation||e.citingCaseName||"Citing case";return'\n                <div class="case-note">\n                  <strong>'.concat($(t),"</strong>\n                  ").concat(e.treatment?"<span>".concat($(e.treatment),"</span>"):"","\n                  ").concat(e.keyQuote?"<blockquote>".concat(Q(e.keyQuote),"</blockquote>"):"","\n                  ").concat(e.reasoning?"<p>".concat(Q(e.reasoning),"</p>"):"","\n                </div>\n              ")}).join("")):""].filter(Boolean).join(""):q("Good law analysis has not been run for this citation."),A=p?[X([["Strength",p.strength],["Score",ee(p.score)]]),p.explanation?Z("Why This Citation Matters","<p>".concat(Q(p.explanation),"</p>")):"",Z("Key Quotes",f.length>0?f.map(e=>"\n              <blockquote>\n                ".concat(Q(e.quote),"\n                ").concat(e.pinCite?"<cite>".concat(Q(((e,t,a)=>{if(!e||!t)return"";if(!a)return"".concat(e,", ").concat(t);let s=t.match(/^([^()]+)(\([^)]+\))$/);return s?"".concat(e,", ").concat(s[1],", ").concat(a).concat(s[2]):"".concat(e,", ").concat(t,", ").concat(a)})(d.caseName,d.citationText,e.pinCite)),"</cite>"):"","\n                ").concat(e.significance?"<p>".concat(Q(e.significance),"</p>"):"","\n              </blockquote>\n            ")).join(""):q("No case-specific quotes have been extracted yet.")),b.length>0?Z("Key Distinctions",b.map(e=>'\n            <div class="case-note">\n              <strong>'.concat($(e.factor),"</strong>\n              ").concat(e.impact?"<span>".concat($(e.impact),"</span>"):"","\n              <p>").concat(Q(e.explanation),"</p>\n            </div>\n          ")).join("")):"",j.length>0?Z("Relevance to Legal Elements",j.map(e=>'\n            <div class="case-note">\n              <strong>'.concat($(e.elementName),"</strong>\n              ").concat(e.support?"<span>
1".concat($(e.support),"</span>"):"","\n              <p>").concat(Q(e.explanation),"</p>\n            </div>\n          ")).join("")):""].filter(Boolean).join(""):q("Case relevance is not available for this citation."),C=m?"<pre>".concat($(m),"</pre>"):q("Full opinion text is not available for this citation.");return"\n    <!doctype html>\n    <html>\n      <head>\n        <title>".concat($(y),' - Citation Summary</title>\n        <style>\n          @page { size: letter; margin: 0.75in; }\n          * { box-sizing: border-box; }\n          body {\n            color: #111827;\n            font-family: Arial, Helvetica, sans-serif;\n            font-size: 11pt;\n            line-height: 1.45;\n            margin: 0;\n          }\n          header {\n            border-bottom: 2px solid #111827;\n            margin-bottom: 24px;\n            padding-bottom: 14px;\n          }\n          h1 {\n            font-size: 20pt;\n            line-height: 1.2;\n            margin: 0 0 8px;\n          }\n          .citation-line {\n            color: #374151;\n            font-family: "Courier New", monospace;\n            font-size: 10pt;\n            margin: 0;\n          }\n          section {\n            border-top: 1px solid #d1d5db;\n            margin-top: 20px;\n            padding-top: 16px;\n          }\n          h2 {\n            font-size: 15pt;\n            margin: 0 0 12px;\n          }\n          h3 {\n            font-size: 11.5pt;\n            margin: 0 0 6px;\n          }\n          .subsection {\n            break-inside: avoid;\n            margin: 12px 0;\n          }\n          dl {\n            display: grid;\n            grid-template-columns: 1fr 1fr;\n            gap: 8px 18px;\n            margin: 0 0 14px;\n          }\n          dt {\n            color: #6b7280;\n            font-size: 8.5pt;\n            font-weight: 700;\n            text-transform: uppercase;\n          }\n          dd {\n            margin: 2px 0 0;\n          }\n          ul {\n            margin: 0;\n            padding-left: 18px;\n          }\n          li {\n            margin: 4px 0;\n          }\n          p {\n            margin: 0 0 8px;\n          }\n          blockquote {\n            border-left: 3px solid #9ca3af;\n            break-inside: avoid;\n            margin: 8px 0;\n            padding-left: 12px;\n          }\n          blockquote cite {\n            color: #4b5563;\n            display: block;\n            font-size: 9.5pt;\n            font-style: normal;\n            margin-top: 6px;\n          }\n          .case-note {\n            border: 1px solid #e5e7eb;\n            break-inside: avoid;\n            margin: 8px 0;\n            padding: 10px;\n          }\n          .case-note > span {\n            color: #4b5563;\n            float: right;\n            font-size: 9pt;\n            font-weight: 700;\n          }\n          pre {\n            font-family: Arial, Helvetica, sans-serif;\n            white-space: pre-wrap;\n            word-break: break-word;\n          }\n          .empty {\n            color: #6b7280;\n            font-style: italic;\n          }\n        </style>\n      </head>\n      <body>\n        <header>\n          <h1>').concat($(y),'</h1>\n          <p class="citation-line">').concat($(d.citationText||d.fullCitation||d.citation||""),"</p>\n        </header>\n        <section>\n          <h2>Case Overview</h2>\n          ").concat(T||q(),"\n        </section>\n        <section>\n          <h2>Good Law Analysis</h2>\n          ").concat(w,"\n        </section>\n        <section>\n          <h2>Case Relevance</h2>\n          ").concat(A,"\n        </section>\n        <section>\n          <h2>Full Opinion</h2>\n          ").concat(C,"\n        </section>\n      </body>\n    </html>\n  ")})({citation:t1,courtName:t2,fullOpinionCleaned:t4,relevanceData:tl,keyFactors:t6,overallReasoning:t7,pass1Results:t8})),n.close(),null==(t=s.contentWindow)||t.focus(),null==(a=s.contentWindow)||a.print(),setTimeout(()=>{s.parentNode&&document.body.removeChild(s)},100)},[t1,t2,t4,t6,t7,t8,tl]),am=()=>{setTimeout(e2,200)},ap=tH||tK||to||an,ax=ts?ai:eZ?ao:void 0;return(0,s.jsx)(R.lG,{open:e4,onOpenChange:am,children:(0,s.jsxs)(R.Cf,{className:"rounded-xl shadow-[0px_25px_50px_-12px_rgba(0,0,0,0.10)] outline outline-1 -outline-offset-1 outline-zinc-200 max-w-[1076px] w-full max-h-[85vh] p-0 gap-0 flex flex-col max-md:pointer-coarse:top-auto max-md:pointer-coarse:bottom-0 max-md:pointer-coarse:left-0 max-md:pointer-coarse:translate-x-0 max-md:pointer-coarse:translate-y-0 max-md:pointer-coarse:max-w-none max-md:pointer-coarse:rounded-b-none max-md:pointer-coarse:rounded-t-2xl max-md:pointer-coarse:max-h-[85dvh] max-md:pointer-coarse:pb-[env(safe-area-inset-bottom)]",onOpenAutoFocus:e=>{e.preventDefault()},showCloseButton:!1,priority:"elevated",children:[(0,s.jsx)(R.c7,{className:"px-5 py-4 border-b border-zinc-100",children:(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsx)(R.L3,{className:"text-base font-medium text-zinc-950 truncate",children:(null==t1?void 0:t1.caseName)||"Loading..."}),(0,s.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[eZ&&(e0||ts)&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(A.SE,{caseId:eZ,resourceType:"CITATION",resourceId:String(e0||ts),size:"sm"}),(0,s.jsx)("span",{className:"h-4 w-px bg-zinc-200"})]}),(0,s.jsx)(R.HM,{asChild:!0,children:(0,s.jsx)(_.$,{variant:"headless",onClick:am,className:"size-7 flex items-center justify-center rounded-[10px] text-litmas-space-grey transition-colors hover:bg-zinc-100",children:(0,s.jsx)(o.A,{className:"w-4 h-4"})})})]})]})}),(0,s.jsxs)("div",{className:"px-5 pt-4 flex items-start justify-between gap-4",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(null==t1?void 0:t1.citationText)&&(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-tight text-mystical-shade/60 leading-4",children:t1.citationText}),(0,s.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[10px] tracking-tight text-litmas-space-grey leading-4",children:[t2&&(0,s.jsx)("span",{children:t2}),t2&&(null==t1?void 0:t1.year)&&(0,s.jsx)("span",{className:"text-zinc-300",children:"\xb7"}),(null==t1?void 0:t1.year)&&(0,s.jsx)("span",{children:t1.year}),t9>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"text-zinc-300",children:"\xb7"}),(0,s.jsxs)("span",{children:[t9," ",1===t9?"case":"cases"]})]})]})]}),(0,s.jsx)("div",{className:"shrink-0",children:e7||as?(0,s.jsxs)("div",{className:"inline-flex items-center gap-1.5 px-2 py-1 bg-blue-50 text-blue-700 rounded-[5px] text-[10px]",children:[(0,s.jsx)(r.A,{className:"w-3 h-3 animate-spin"}),(0,s.jsx)("span",{children:"Analyzing…"})]}):(null==t1||null==(ey=t1.goodLawData)?void 0:ey.assessment)?(()=>{var e,t;let a=(0,Y.K)(t1.goodLawData);return(0,s.jsxs)("div",{className:"flex w-28 flex-col items-center gap-[5px]",children:[(0,s.jsxs)("div",{className:"self-stretch inline-flex items-center justify-center gap-1 rounded-[5px] px-2 py-0.5 ".concat(a.badgeBg),children:[(0,s.jsx)(c.A,{className:"w-2.5 h-2.5 ".concat(a.badgeText)}),(0,s.jsxs)("span",{className:"text-[9px] uppercase tracking-tight leading-3 ".concat(a.badgeText),children:[(0,s.jsx)("span",{className:"font-bold",children:a.label}),a.showConfidence&&!(null==(e=t1.goodLawData)?void 0:e.hasBeenOverruled)&&(0,s.jsxs)("span",{className:"font-normal",children:[" ",Math.round((null!=(t=t1.goodLawData.confidence)?t:0)*100),"%"]})]})]}),t9>0&&(0,s.jsxs)("span",{className:"self-stretch text-center text-[10px] leading-4 tracking-tight text-treasured-wilderness",children:["(i.e. citing cases:"," ",t9,")"]})]})})():(0,s.jsx)(_.$,{variant:"outline",size:"sm",onClick:al,className:"h-7 text-xs",disabled:!tD,children:"Analyze Good Law"})})]}),(0,s.jsx)("div",{className:"px-5 pt-4",children:(0,s.jsx)("nav",{className:"flex items-center gap-10 border-b border-zinc-100","aria-label":"Tabs",children:[{id:"overview",label:"Overview",count:t5},{id:"goodlaw",label:"Good Law",count:void 0},{id:"opinion",label:"Full Opinion",count:void 0}].map(e=>(0,s.jsxs)(_.$,{variant:"headless",type:"button",onClick:()=>e6(e.id),className:"relative -mb-px pb-2.5 text-xs font-medium tracking-tight rounded-none transition-colors ".concat(e3===e.id?"text-litmas-shiner":"text-santas-grey hover:text-litmas-space-grey"),children:[e.label,"number"==typeof e.count&&e.count>0&&(0,s.jsx)("span",{className:"ml-1.5 inline-flex items-center justify-center rounded-full px-1.5 py-0.5 text-[10px] font-semibold leading-none transition-colors ".concat(e3===e.id?"bg-litmas-shiner text-white":"bg-zinc-100 text-santas-grey"),children:e.count}),e3===e.id&&(0,s.jsx)("span",{className:"absolute inset-x-0 -bottom-px h-0.5 bg-litmas-shiner rounded-full"})]},e.id))})}),(0,s.jsx)("div",{className:"flex-1 overflow-y-auto px-5 pt-5 pb-9",children:tk&&!t0?(0,s.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,s.jsxs)("div",{className:"flex flex-col items-center",children:[(0,s.jsx)(U.Q0,{}),(0,s.jsx)("p",{className:"text-sm text-gray-600 mt-2",children:"Loading citation details..."})]})}):tF&&!t1?(0,s.jsxs)("div",{className:"text-center py-8",children:[(0,s.jsx)("p",{className:"text-red-600",children:"Failed to load citation details"}),(0,s.jsx)("p",{className:"text-sm text-gray-500 mt-2",children:"Please try again later"})]}):t1?(0,s.jsxs)("div",{className:"space-y-6",children:[!tL&&t0&&(0,s.jsx)("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg px-3 py-2",children:(0,s.jsx)("p",{className:"text-xs text-yellow-800",children:"Showing cached citation data. Some features may be limited."})}
1),(0,s.jsx)(w.A,{caseId:eZ||"",resourceType:"CITATION",resourceId:e0||(null==tL||null==(ev=tL.citationUsage)?void 0:ev._id)||ts||"",citationId:tD,usageId:e0||(null==tL||null==(eN=tL.citationUsage)?void 0:eN._id)||ts||"",motionTypes:(null==tL?void 0:tL.motionTypes)||tt,onChanged:()=>{null==e5||e5(),tU()},showDetailsButton:!1}),"overview"===e3&&(0,s.jsxs)("div",{className:"space-y-6",children:[t1.authorityType&&(0,s.jsx)(I,{type:t1.authorityType,explanation:t1.authorityExplanation}),(0,s.jsx)("div",{className:"min-w-0",children:(0,s.jsxs)("div",{className:"min-w-0 space-y-5",children:[(t1.summary||t1.analysis)&&(0,s.jsxs)("section",{children:[(0,s.jsx)("h4",{className:"text-xs uppercase tracking-wide text-litmas-shiner mb-2",children:t1.summary?"Summary":"Legal Analysis"}),(0,s.jsx)("p",{className:"text-xs leading-6 text-litmas-space-grey whitespace-pre-wrap",children:t1.summary||t1.analysis})]}),t1.holdings&&t1.holdings.length>0&&(0,s.jsx)(ei,{title:"Case Holdings",count:t1.holdings.length,open:tp,onToggle:()=>tx(e=>!e),children:(0,s.jsx)("ol",{className:"space-y-4",children:t1.holdings.map((e,t)=>(0,s.jsxs)("li",{className:"flex items-start gap-2",children:[(0,s.jsxs)("span",{className:"text-xs font-semibold leading-5 text-santas-grey shrink-0",children:[t+1,"."]}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("span",{className:"text-xs leading-5 text-litmas-space-grey",children:"string"==typeof e?e:null==e?void 0:e.text}),"string"!=typeof e&&e.isPrimary&&(0,s.jsx)("span",{className:"ml-2 inline-flex items-center rounded-[5px] bg-litmas-shiner px-3 py-0.5 align-middle text-xs leading-4 text-white",children:"Primary"})]})]},t))})}),(0,s.jsxs)("div",{className:"rounded-2xl bg-[#F4F4F5] p-5 outline outline-1 -outline-offset-1 outline-zinc-200",children:[(0,s.jsx)("div",{className:"flex items-start justify-between gap-2",children:(0,s.jsx)("h4",{className:"text-xs font-medium uppercase tracking-wide leading-4 text-litmas-liberal-lilac",children:"Why this citation matters to your case"})}),(null==tl?void 0:tl.explanation)?(0,s.jsx)("p",{className:"mt-4 text-xs leading-6 text-litmas-space-grey",children:tl.explanation}):ap?(0,s.jsxs)("div",{className:"mt-4 flex items-center gap-2 text-xs text-mystical-shade",children:[(0,s.jsx)(r.A,{className:"w-3.5 h-3.5 animate-spin"}),"Analyzing relevance…"]}):(0,s.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,s.jsx)("p",{className:"text-xs leading-5 text-mystical-shade",children:eZ?"Analyze how relevant this citation is to your specific case based on your facts and legal elements.":"Open this citation within a case to analyze relevance."}),ax&&(0,s.jsxs)(_.$,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:ax,children:[(0,s.jsx)(d.A,{className:"w-3.5 h-3.5 mr-1"}),ts?"Analyze relevance":"Add to case & analyze"]})]})]}),(null==tl?void 0:tl.distinctions)&&tl.distinctions.length>0&&(0,s.jsxs)("div",{className:"rounded-2xl bg-gradient-to-br from-slate-900 to-gray-700 p-5",children:[(0,s.jsx)("h4",{className:"text-xs font-medium uppercase tracking-wide leading-3 text-litmas-petal-plush",children:"Key Distinctions"}),(0,s.jsx)("p",{className:"mt-1 text-[10px] leading-3 tracking-tight text-litmas-petal-plush/80",children:"Differences between this case and yours"}),(0,s.jsx)("div",{className:"mt-4 space-y-3",children:Object.entries(tl.distinctions.reduce((e,t)=>(e[t.impact]||(e[t.impact]=[]),e[t.impact].push(t),e),{})).map(e=>{let[t,a]=e,n="STRENGTHENS"===t,l="WEAKENS"===t;return(0,s.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,s.jsx)("span",{className:"inline-flex w-28 shrink-0 items-center justify-center rounded-[5px] px-3 py-0.5 text-xs font-medium leading-4 text-litmas-space-grey ".concat(n?"bg-green-200":l?"bg-litmas-petal-plush":"bg-zinc-200"),children:t}),(0,s.jsx)("span",{className:"w-px self-stretch bg-white/30"}),(0,s.jsx)("div",{className:"min-w-0 space-y-1",children:a.map((e,t)=>(0,s.jsx)("p",{className:"text-[11px] leading-4 text-white/70",children:e.explanation||e.factor},t))})]},t)})})]}),(null==tl?void 0:tl.elementRelevance)&&tl.elementRelevance.length>0&&(0,s.jsxs)("div",{className:"rounded-2xl bg-neutral-50 p-5 outline outline-1 -outline-offset-1 outline-zinc-200",children:[(0,s.jsx)("h4",{className:"text-xs font-medium uppercase tracking-wide leading-4 text-litmas-liberal-lilac",children:"Relevance to Legal Elements"}),(0,s.jsx)("div",{className:"mt-4 space-y-2.5",children:tl.elementRelevance.map((e,t)=>{let a="SUPPORTS"===e.support,n="WEAKENS"===e.support;return(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)("span",{className:"inline-flex w-20 shrink-0 items-center justify-center rounded-[5px] px-2 py-0.5 text-[10px] font-medium ".concat(a?"bg-green-100 text-green-800":n?"bg-red-100 text-red-800":"bg-zinc-200 text-litmas-space-grey"),children:e.support}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"text-xs font-medium text-litmas-space-grey",children:e.elementName}),e.explanation&&(0,s.jsx)("p",{className:"mt-0.5 text-[11px] leading-4 text-mystical-shade",children:e.explanation})]})]},t)})})]}),((null==(eb=t1.opinionAnalysis)||null==(ef=eb.legalPrinciples)?void 0:ef.length)||(null==(ej=t1.opinionAnalysis)?void 0:ej.factsSummary)||(null==(eT=t1.opinionAnalysis)?void 0:eT.proceduralHistory)||(null==(ew=t1.opinionAnalysis)||null==(eI=ew.dissents)?void 0:eI.length)||(null==(eC=t1.opinionAnalysis)||null==(eA=eC.topicTags)?void 0:eA.length))&&(0,s.jsx)(ei,{title:"AI Analysis",open:tg,onToggle:()=>th(e=>!e),divider:!0,children:(0,s.jsxs)("div",{className:"space-y-4",children:[(null==(eE=t1.opinionAnalysis)?void 0:eE.legalPrinciples)&&t1.opinionAnalysis.legalPrinciples.length>0&&(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs font-semibold text-litmas-space-grey mb-1.5",children:"Legal Principles"}),(0,s.jsx)("ul",{className:"space-y-1.5",children:t1.opinionAnalysis.legalPrinciples.map((e,t)=>(0,s.jsxs)("li",{className:"flex items-start gap-2 text-xs leading-5 text-litmas-space-grey",children:[(0,s.jsx)("span",{className:"text-litmas-shiner mt-0.5",children:"•"}),(0,s.jsx)("span",{children:e})]},t))})]}),(null==(eO=t1.opinionAnalysis)?void 0:eO.factsSummary)&&(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs font-semibold text-litmas-space-grey mb-1.5",children:"Facts Snapshot"}),(0,s.jsx)("p",{className:"text-xs leading-5 text-litmas-space-grey whitespace-pre-wrap",children:t1.opinionAnalysis.factsSummary})]}),(null==(e_=t1.opinionAnalysis)?void 0:e_.proceduralHistory)&&(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs font-semibold text-litmas-space-grey mb-1.5",children:"Procedural History"}),(0,s.jsx)("p",{className:"text-xs leading-5 text-litmas-space-grey whitespace-pre-wrap",children:t1.opinionAnalysis.proceduralHistory})]}),(null==(eR=t1.opinionAnalysis)?void 0:eR.dissents)&&t1.opinionAnalysis.dissents.length>0&&(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs font-semibold text-litmas-space-grey mb-1.5",children:"Dissenting Opinions"}),(0,s.jsx)("div",{className:"space-y-2",children:t1.opinionAnalysis.dissents.map((e,t)=>(0,s.jsxs)("div",{className:"rounded-lg bg-orange-50 border border-orange-200 p-3",children:[(0,s.jsx)("p",{className:"text-xs font-medium text-orange-800 mb-1",children:e.author}),(0,s.jsx)("p",{className:"text-xs leading-5 text-litmas-space-grey",children:e.summary})]},t))})]}),(null==(eS=t1.opinionAnalysis)?void 0:eS.topicTags)&&t1.opinionAnalysis.topicTags.length>0&&(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs font-semibold text-litmas-space-grey mb-1.5",children:"Topics"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:t1.opinionAnalysis.topicTags.map((e,t)=>(0,s.jsx)("span",{className:"inline-flex items-center rounded-full bg-zinc-100 px-3 py-1 text-xs text-litmas-space-grey",children:e},t))})]})]})}),(0,s.jsx)(ei,{title:"Additional Details",open:ty,onToggle:()=>tv(e=>!e),divider:!0,children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(u.A,{className:"w-4 h-4 text-zinc-400 mt-0.5 shrink-0"}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"text-xs font-semibold text-litmas-space-grey",children:"Court Details"}),(0,s.jsx)("p",{className:"text-xs text-mystical-shade",children:t1.courtName||"Court information not available"}),(0,s.jsxs)("div",{className:"text-[11px] text-santas-grey mt-1 space-y-0.5",children:[(t1.jurisdiction||t1.courtLevel)&&(0,s.jsxs)("p",{children:[t1.jurisdiction&&"".concat(t1.jurisdiction),t1.jurisdiction&&t1.courtLevel&&" • ",t1.courtLevel&&"".concat(t1.courtLevel)]}),t1.state&&(0,s.jsxs)("p",{children:["State:"," ",t1.state]}),t1.federalCircuit&&(0,s.jsxs)("p",{children:["Federal Circuit:"," ",t1.federalCircuit]}),t1.district&&(0,s.jsxs)("p",{children:["District:"," ",t1.district]})]})]})]}),(t1.justiaUrl||t1.googleScholarUrl)&&(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[t1.justiaUrl&&(0,s.jsxs)("a",{href:t1.justiaUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 rounded-md bg-green-100 px-3 py-1.5 text-xs font-medium text-green-700 transition-colors hover:bg-green-200",children:[(0,s.jsx)(m.A,{className:"w-3.5 h-3.5"}),"Justia"]}),t1.googleScholarUrl&&(0,s.jsxs)("a",{href:t1.googleScholarUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 rounded-md bg-purple-100 px-3 py-1.5 text-xs font-medium text-purple-700 transition-colors hover:bg-purple-200",children:[(0,s.jsx)(m.A,{className:"w-3.5 h-3.5"}),"Google Scholar"]})]}),(null==tY?void 0:tY.isTexasCourtOfAppeals)&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("h4",{className:"text-sm font-semibold text-gray-900 mb-3 flex items-center gap-2",children:[(0,s.jsx)(p.A,{className:"w-4 h-4 text-amber-600"}),"Texas Petition History",(0,s.jsx)("span",{className:"text-xs font-normal text-gray-500",children:"(Required for Greenbook citations)"})]}),tV?(0,s.jsxs)("div",{className:"flex items-center gap-2 text-gray-500",children:[(0,s.jsx)(r.A,{className:"w-4 h-4 animate-spin"}),(0,s.jsx)("span",{className:"text-sm",children:"Loading petition history..."})]}):(0,s.jsxs)("div",{className:"space-y-3",children:[(null==(eD=tY.texasWritHistory)?void 0:eD.status)&&(0,s.jsxs)("div",{className:"inline-flex items-center gap-2 px-3 py-2 rounded-lg ".concat((null==(eM=et[tY.texasWritHistory.status])?void 0:eM.bgColor)||"bg-gray-100"," ").concat((null==(eP=et[tY.texasWritHistory.status])?void 0:eP.textColor)||"text-gray-700"),children:[(0,s.jsx)("span",{className:"font-medium",children:(null==(eL=et[tY.texasWritHistory.status])?void 0:eL.label)||tY.texasWritHistory.status}),(0,s.jsxs)("span",{className:"text-sm opacity-75",children:["(",(null==(ek=et[tY.texasWritHistory.status])?void 0:ek.abbr)||tY.texasWritHistory.status.toLowerCase(),")"]}),tY.texasWritHistory.userOverride&&(0,s.jsx)("span",{className:"text-xs bg-white/50 px-1.5 py-0.5 rounded",children:"User Override"})]}),(null==(eF=tY.texasWritHistory)?void 0:eF.status)&&(0,s.jsx)("p",{className:"text-sm text-gray-600",children:null==(eU=et[tY.texasWritHistory.status])?void 0:eU.description}),(null==(ez=tY.texasWritHistory)?void 0:ez.analysisReasoning)&&(0,s.jsxs)("div",{className:"bg-slate-50 border border-slate-200 rounded-lg p-3",children:[(0,s.jsx)("p",{className:"text-xs text-gray-500 mb-1",children:"Analysis Notes:"}),(0,s.jsx)("p",{className:"text-sm text-gray-700",children:tY.texasWritHistory.analysisReasoning})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2 pt-2",children:[tY.needsResolution&&(0,s.jsx)(_.$,{variant:"outline",size:"sm",onClick:ar,disabled:tQ||tR,className:"text-sm",children:tQ||tR?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.A,{className:"w-4 h-4 mr-2 animate-spin"}),"Resolving..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(p.A,{className:"w-4 h-4 mr-2"}),"Resolve Petition History"]})}),!tY.needsResolution&&(null==(eB=tY.texasWritHistory)?void 0:eB.status)!=="UNKNOWN"&&(0,s.jsx)(_.$,{variant:"ghost",size:"sm",onClick:ar,disabled:tQ||tR,className:"text-sm text-gray-600",children:tQ||tR?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.A,{className:"w-4 h-4 mr-2 animate-spin"}),"Re-analyzing..."]}):"Re-analyze"}),(0,s.jsx)(_.$,{variant:"ghost",size:"sm",onClick:()=>tA(!tw),className:"text-sm text-gray-600",children:tw?"Cancel Override":"Manual Override"})]}),tw&&(0,s.jsxs)("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4 mt-3",children:[(0,s.jsx)("h5",{className:"text-sm font-medium text-amber-800 mb-3",children:"Set Petition History Status Manually"}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(B.J,{className:"text-xs text-gray-600 mb-1 block font-normal",children:"Status"}),(0,s.jsx)("div",{className:"w-full",children:(0,s.jsx)(U.MD,{value:ea.find(e=>e.value===tC)||null,onChange:e=>tE((null==e?void 0:e.value)||null),options:ea,placeholder:"Select status..."})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(B.J,{className:"text-xs text-gray-600 mb-1 block font-normal",children:"Reason (optional)"}),(0,s.jsx)(z.p,{type:"text",value:tO,onChange:e=>t_(e.target.value),placeholder:"e.g., Verified manually",className:"h-9"})]}),(0,s.jsx)(_.$,{onClick:ac,disabled:tJ||!tC,size:"sm",className:"w-full",children:tJ?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.A,{className:"w-4 h-4 mr-2 animate-spin"}),"Updating..."]}):"Save Override"})]})]}),(null==(eH=tY.texasWritHistory)?void 0:eH.status)==="UNKNOWN"&&(0,s.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-lg px-4 py-3",children:(0,s.jsxs)("p",{className:"text-sm text-red-700",children:["⚠️"," ",(0,s.jsx)("strong",{children:"Resolution Required:"})," ",'This Texas Court of Appeals citation cannot be used in Document Studio until its petition history is resolved. Click "Resolve Petition History" above.']})})]})]})]})})]})}),!(null==(eG=t1.holdings)?void 0:eG.length)&&!(null==(eY=t1.opinionAnalysis)||null==(eK=eY.legalPrinciples)?void 0:eK.length)&&!t1.summary&&(0,s.jsxs)("div",{className:"text-center py-8 text-santas-grey",children:[(0,s.jsx)(x.A,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),(0,s.jsx)("p",{className:"text-sm",children:"No holdings or legal principles available yet."}),(0,s.jsx)("p",{className:"text-xs mt-1",children:"Run Good Law analysis to extract key information."})]})]}),"goodlaw"===e3&&(0,s.jsx)("div",{className:"space-y-6",children:(null==(eV=t1.goodLawData)?void 0:eV.assessment)?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"overflow-hidden rounded-2xl outline outline-1 -outline-offset-1 outline-zinc-200 bg-gradient-to-br from-slate-900 to-gray-700",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3 p-5",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2.5",children:["good"===(0,Y.K)(t1.goodLawData).state?(0,s.jsx)(c.A,{className:"w-4 h-4 text-white shrink-0"}):(0,s.jsx)(g.A,{className:"w-4 h-4 text-white shrink-0"}),(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("span",{className:"text-[10px] font-bold uppercase tracking-wide leading-4 text-white",children:(0,Y.K)(t1.goodLawData).label}),null!=t1.goodLawData.confidence&&!(null==(eW=t1.goodLawData)?void 0:eW.hasBeenOverruled)&&(0,s.jsxs)("span",{className:"text-xl font-bold leading-7 text-white",children:[Math.round(100*t1.goodLawData.confidence),"%"]})]})]}),(0,s.jsx)(_.$,{variant:"headless",type:"button",onClick:al,disabled:e7,className:"h-9 rounded-lg border border-white/30 px-4 text-sm font-medium text-white transition-colors hover:bg-white/10 disabled:opacity-50",children:e7?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.A,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}),"Analyzing…"]}):"Re-analyze"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2 px-5 py-2.5",children:[(0,s.jsx)(h.A,{className:"w-2.5 h-2.5 text-litmas-petal-plush shrink-0"}),(0,s.jsx)("span",{className:"text-xs leading-4 tracking-tight text-litmas-petal-plush line-clamp-2",children:(()=>{let e=(0,Y.K)(t1.goodLawData).caveat,t=t7?W(t7):null;return e&&t?"".concat(e," ").concat(t):e||t||("GOOD_LAW"===t1.goodLawData.assessment?"No subsequent negative history found":"Review the citing-case analysis below")})()})]})]}),ae.length>0&&(0,s.jsxs)("div",{children:[
1(0,s.jsx)("h4",{className:"text-xs font-medium uppercase tracking-wide text-litmas-shiner mb-3",children:"Citing Case Analysis"}),(0,s.jsx)("div",{className:"space-y-5",children:ae.map(e=>{var t,a;let{treatment:n,items:o,category:r}=e,c=el[r],d=en[r].label,u=(null==(t=es[n])?void 0:t.label)||n,m=u.charAt(0).toUpperCase()+u.slice(1).toLowerCase(),p=null!=(a=tN[n])?a:"cautionary"!==r&&"negative"!==r;return(0,s.jsxs)("div",{children:[(0,s.jsxs)("button",{type:"button",onClick:()=>tf(e=>({...e,[n]:!p})),className:"flex w-full items-center gap-2 px-1 py-1 text-left",children:[(0,s.jsx)("span",{className:"size-1.5 rounded-full shrink-0 ".concat(c.dot)}),(0,s.jsxs)("span",{className:"text-xs leading-4 tracking-tight text-zinc-700",children:[d," ","-"," ",m," ","(",o.length,")"]}),p?(0,s.jsx)(i.A,{className:"ml-auto w-3 h-3 text-litmas-space-grey shrink-0"}):(0,s.jsx)(l.A,{className:"ml-auto w-3 h-3 text-litmas-space-grey shrink-0"})]}),!p&&(0,s.jsx)("div",{className:"mt-2 space-y-3",children:o.map((e,t)=>{let a=e.citingCaseName||e.citingCaseCitation||"Citing case",l=e.dateFiled?new Date(e.dateFiled).getFullYear():null,i=[e.court,l].filter(Boolean).join(" \xb7 "),o=e.reasoning||e.keyQuote,r=e.citingCaseId,d=e.citingCaseUrl||e.absoluteUrl||e.url||"https://scholar.google.com/scholar?q=".concat(encodeURIComponent(e.citingCaseCitation||e.citingCaseName||""));return(0,s.jsxs)("div",{className:"rounded-2xl bg-chef-hat p-4 outline outline-1 -outline-offset-1 ".concat(c.outline),children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"text-xs font-semibold leading-4 tracking-tight text-zinc-900",children:a}),i&&(0,s.jsx)("p",{className:"mt-0.5 text-[10px] leading-4 tracking-tight text-zinc-400",children:i})]}),(0,s.jsx)("span",{className:"shrink-0 inline-flex items-center rounded-[5px] px-3 py-0.5 text-xs leading-4 ".concat(c.darkBadge?"bg-slate-900 text-white":"bg-neutral-50 text-slate-900 outline outline-1 outline-zinc-200"),children:n})]}),o&&(0,s.jsx)("div",{className:"mt-3 border-t border-zinc-200 pt-2.5",children:(0,s.jsx)("p",{className:"text-xs leading-5 tracking-tight text-litmas-space-grey",children:o})}),(0,s.jsx)("div",{className:"mt-3 flex justify-end",children:null!=r&&""!==r?(0,s.jsx)(_.$,{variant:"headless",type:"button",onClick:()=>tj({citingCaseId:r,citingCaseName:e.citingCaseName,court:e.court,dateFiled:e.dateFiled,keyQuote:e.keyQuote,reasoning:e.reasoning,treatment:n}),className:"inline-flex h-9 items-center justify-center rounded-lg border border-blueberry-whip bg-white px-4 text-sm font-medium text-litmas-space-grey transition-colors hover:border-litmas-liberal-lilac hover:bg-chef-hat",children:"View Opinion"}):(0,s.jsx)("a",{href:d,target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-9 items-center justify-center rounded-lg border border-blueberry-whip bg-white px-4 text-sm font-medium text-litmas-space-grey transition-colors hover:border-litmas-liberal-lilac hover:bg-chef-hat",children:"View Opinion"})})]},t)})})]},n)})})]})]}):(0,s.jsxs)("div",{className:"text-center py-12",children:[(0,s.jsx)(c.A,{className:"w-12 h-12 mx-auto mb-4 text-zinc-300"}),(0,s.jsx)("h3",{className:"text-lg font-medium text-litmas-space-grey mb-2",children:"Good Law Status Not Analyzed"}),(0,s.jsx)("p",{className:"text-sm text-mystical-shade mb-6 max-w-md mx-auto",children:"Run analysis to check if this case is still good law by examining how it has been treated by subsequent courts."}),(0,s.jsx)(_.$,{onClick:al,disabled:e7||as||!tD,children:e7||as?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.A,{className:"w-4 h-4 mr-2 animate-spin"}),"Analyzing Good Law..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.A,{className:"w-4 h-4 mr-2"}),"Analyze Good Law Status"]})})]})}),"opinion"===e3&&(0,s.jsx)("div",{children:t4?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"hidden sm:flex justify-end gap-2",children:[(0,s.jsx)(_.$,{variant:"headless",type:"button",onClick:()=>tm("single"),"aria-label":"Single column",title:"Single column",className:"size-7 flex items-center justify-center rounded-md transition-colors ".concat("single"===tu?"text-litmas-liberal-lilac bg-litmas-liberal-lilac/10":"text-litmas-space-grey hover:bg-zinc-100"),children:(0,s.jsx)(y.A,{className:"w-4 h-4"})}),(0,s.jsx)(_.$,{variant:"headless",type:"button",onClick:()=>tm("split"),"aria-label":"Two columns",title:"Two columns",className:"size-7 flex items-center justify-center rounded-md transition-colors ".concat("split"===tu?"text-litmas-liberal-lilac bg-litmas-liberal-lilac/10":"text-litmas-space-grey hover:bg-zinc-100"),children:(0,s.jsx)(v.A,{className:"w-4 h-4"})})]}),(0,s.jsx)("div",{className:"sm:mt-4 whitespace-pre-wrap text-sm leading-6 text-litmas-space-grey ".concat("split"===tu?"sm:columns-2 sm:gap-12":""),children:t4})]}):(0,s.jsxs)("div",{className:"text-center py-12 text-santas-grey",children:[(0,s.jsx)(N.A,{className:"w-10 h-10 mx-auto mb-3 opacity-50"}),(0,s.jsx)("p",{children:"Full opinion text not available"})]})}
1),(0,s.jsx)(w.A,{caseId:eZ||"",resourceType:"CITATION",resourceId:e0||(null==tL||null==(e$=tL.citationUsage)?void 0:e$._id)||ts||"",citationId:tD,usageId:e0||(null==tL||null==(eQ=tL.citationUsage)?void 0:eQ._id)||ts||"",motionTypes:(null==tL?void 0:tL.motionTypes)||tt,onChanged:()=>{null==e5||e5(),tU()},showDetailsButton:!1,className:"mt-0"})]}):(0,s.jsx)("div",{className:"text-center py-8",children:(0,s.jsx)("p",{className:"text-gray-500",children:"No citation data available"})})}),(0,s.jsxs)(R.Es,{className:"px-5 ".concat("opinion"===e3?"py-5":"py-4"," border-t border-zinc-100 flex items-center justify-between gap-2 sm:justify-between"),children:[(0,s.jsx)("div",{children:"opinion"===e3&&t4&&(0,s.jsx)(_.$,{variant:"outline",onClick:ad,className:"gap-2",children:tT?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(f.A,{className:"w-4 h-4 text-green-600"}),"Copied!"]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(b.A,{className:"w-4 h-4"}),"Copy Opinion"]})})}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(_.$,{variant:"outline",onClick:au,disabled:!t1,children:"Export"}),(0,s.jsx)(R.HM,{asChild:!0,children:(0,s.jsx)(_.$,{onClick:am,children:"Close"})})]})]}),(0,s.jsx)(F,{context:tb,onClose:()=>tj(null)})]})})}}}]);

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.