PageSourceSearch

https://app.modulaw.ai/assets/FirmToolsClauses-CUjx3O6f.js

js modulaw.ai collected 2026-10-05 12:24:40 UTC 29,315 bytes, 1 lines download raw bytes

1import{j as e,d as Pe,r as d}from"./react-vendor--6IG9Yi5.js";import{a as k,ar as xe,as as we,ae as Ee,t as x,aS as Fe,cs as he,b0 as be,cO as Ie,bY as De,bc as Oe,a$ as Te,aw as ge,be as fe}from"./index-Bys9v8Oy.js";import{u as _e}from"./WorkspaceProvider-CMA7Xx7r.js";import{L as $e}from"./LoadingSpinner-CgvfwZE9.js";import{E as ke}from"./EmailRichTextEditor-DQoQIou6.js";import{C as Le}from"./ConfirmDeleteModal-uhg3g-3x.js";import{F as C,a as b,d as Re,c as je,b as Y,S as $}from"./FormKit-M7nq3u2k.js";import{R as Be}from"./Pager-DRjg4qG-.js";import{E as Me}from"./EmptyState-DQxNE3Pi.js";import{R as te,T as He}from"./ToolPage-CmG0q_Ae.js";import{P as qe}from"./ftTones-BW17ktdU.js";import{S as Je}from"./StatusMark-CgSsTy6g.js";import{S as We}from"./search-5xbG4TnZ.js";import{E as Ge}from"./eye-BttykgRs.js";import{P as ye}from"./Crumbs-BV6rsJeI.js";import{T as Ue}from"./trash-2-TyMGS6ci.js";import{w as ze}from"./caseManager-OVDOY9FX.js";import{S as ve}from"./sparkles-Dpj46NN4.js";import{P as Ye}from"./plus-CsRWXNbN.js";import{d as Ke,a6 as Qe}from"./entityLinks-G6VTF23F.js";import{b as Ve,a as Xe}from"./react-router-CEJpt0Xm.js";import"./redux-vendor-C8ygHAw9.js";import"./markdown-vendor-DxXj1xPu.js";import"./radix-vendor-Bx9qoP74.js";import"./tiptap-vendor-rePe3wTF.js";import"./recharts-vendor-DbKwtSaD.js";import"./query-vendor-B3TfXRMZ.js";import"./underline-C1RLFLSp.js";import"./link-2-NucERqyH.js";import"./list-bCItvvin.js";import"./list-ordered-kMtymWEy.js";import"./align-left-DMd-UNMs.js";import"./remove-formatting-BVrHaWiS.js";import"./align-justify-CHEK1gdl.js";import"./Profile-47aRZbdT.js";import"./RegionSelector-J8pu6DdI.js";import"./chevron-down-D1GOHrU_.js";import"./globe-CrRR96c-.js";import"./loader-circle-BoEmSqWb.js";import"./Navbar-Ciu7rFXq.js";import"./user-plus-sMSMsfjy.js";import"./Sheet-wPAIxRXX.js";import"./users-CQ-CzZAN.js";import"./message-square-BYMlhSAn.js";import"./file-text-CkVZzARM.js";import"./external-link-DwQlJHnq.js";import"./settings-96QGJ9C_.js";import"./refresh-cw-XXBufRLi.js";import"./log-out-DN61b5hG.js";import"./chevron-up-CGLVvSH1.js";import"./clock-D3q0dmOM.js";import"./send-DIZ2u80q.js";import"./timezones-GOLkth2k.js";import"./pen-CddalS1U.js";import"./triangle-alert-DOAIcbTG.js";import"./rotate-ccw-itAppeHd.js";import"./select-D0hSoEfN.js";import"./upload-Cxew1CrD.js";import"./circle-alert-DN3S2NFR.js";import"./minus-D3X8RWgn.js";import"./card-B55k6WzX.js";import"./user-minus-C__mwJ7-.js";import"./practiceGroupService-DWczRTjG.js";import"./PersonTrigger-DxVpjH3g.js";import"./shield-Hbi2T64o.js";import"./framer-vendor-D0YzQGxI.js";import"./download-CTaCJdWk.js";import"./Tabs-C5XG0a87.js";import"./copy-e3bh6ula.js";import"./circle-check-big-DAwZinLY.js";import"./gift-BSf_d1Bk.js";import"./circle-help-C0cc-4PN.js";import"./arrow-up-B2tGFNzf.js";import"./PageHeader-bCS8-ndi.js";/* empty css                  */import"./CaseList-DzizD7Zi.js";import"./caseService-B22-AP9R.js";import"./signedUpload-D2Lh7Ksk.js";import"./format-DKzr1nyd.js";import"./currency-CCsqnVDu.js";import"./tone-88yqxv1J.js";import"./processService-oWE3aHLC.js";import"./dnd-flow-vendor-CPW2ZduU.js";import"./WorkingHoursEditor-ExpExSpr.js";import"./fileType-DgRoTJ8C.js";import"./picture-in-picture-2-BhE50yJG.js";import"./list-checks-D6yKdJ4G.js";import"./agents-w1g1cqOH.js";import"./phone-off-D3usGXSG.js";import"./mic-off-CE_pq38N.js";import"./mic-Cyyhlw4a.js";import"./tooltip-BaG_xslg.js";import"./timerSocketService-dN5kco-_.js";import"./index-BCT6OVBj.js";import"./filter-DiSpzMPO.js";import"./arrow-right-CA79NlmX.js";import"./pen-line-Dl16HJHe.js";import"./type-CU7TXY3s.js";import"./useMyProcessGate-C5sWj5CM.js";const S="/api/case-manager";function A(s){return(s==null?void 0:s.data)!==void 0?s.data:s}const P={async list(s,u={}){const o=await k.get(`${S}/workspaces/${s}/clauses`,{params:u}),g=A(o.data);return Array.isArray(g)?g:[]},async getById(s,u){const o=await k.get(`${S}/workspaces/${s}/clauses/${u}`);return A(o.data)},async create(s,u){const o=await k.post(`${S}/workspaces/${s}/clauses`,u);return A(o.data)},async update(s,u,o){const g=await k.put(`${S}
1/workspaces/${s}/clauses/${u}`,o);return A(g.data)},async delete(s,u){const o=await k.delete(`${S}/workspaces/${s}/clauses/${u}`);return A(o.data)},async getFacets(s){const u=await k.get(`${S}/workspaces/${s}/clauses/facets`),o=A(u.data);return{categories:Array.isArray(o==null?void 0:o.categories)?o.categories:[],jurisdictions:Array.isArray(o==null?void 0:o.jurisdictions)?o.jurisdictions:[],tags:Array.isArray(o==null?void 0:o.tags)?o.tags:[]}},async suggest(s,u){const o=await k.post(`${S}/workspaces/${s}/clauses/suggest`,u);return A(o.data)}},se=({position:s,label:u})=>e.jsx(Je,{plain:!0,className:"kit-cell",tone:qe[s],label:u});function Ze({m:s}){const u=!!s.search||s.filterCount>0,o=e.jsxs("div",{className:"ft-filters",children:[e.jsxs("label",{className:"kit-search ft-search",children:[e.jsx(We,{width:15,height:15,"aria-hidden":!0}),e.jsx("input",{className:"ent-field",type:"search",value:s.search,onChange:a=>s.setSearch(a.target.value),placeholder:"Search names, wording and tags","aria-label":"Search clauses"})]}),e.jsxs("select",{className:"ent-field ft-filter",value:s.category,onChange:a=>s.setCategory(a.target.value),"aria-label":"Category",children:[e.jsx("option",{value:"",children:"All categories"}),s.facets.categories.map(a=>e.jsx("option",{value:a,children:a},a))]}),e.jsxs("select",{className:"ent-field ft-filter",value:s.jurisdiction,onChange:a=>s.setJurisdiction(a.target.value),"aria-label":"Jurisdiction",children:[e.jsx("option",{value:"",children:"All jurisdictions"}),s.facets.jurisdictions.map(a=>e.jsx("option",{value:a,children:a},a))]}),e.jsxs("select",{className:"ent-field ft-filter",value:s.position,onChange:a=>s.setPosition(a.target.value),"aria-label":"Position",children:[e.jsx("option",{value:"",children:"Any position"}),s.positions.map(a=>e.jsx("option",{value:a,children:s.positionLabels[a]},a))]}),s.filterCount>0&&e.jsx("button",{type:"button",className:"kit-link",onClick:s.clearFilters,children:"Clear filters"})]}),g=e.jsx(Be,{label:"Clauses",className:"ft-clauses",cols:"var(--ft-cols)",rows:s.clauses,rowKey:a=>String(a._id),rowLabel:a=>a.name,loading:s.loading,skeletonRows:6,onOpen:a=>s.setPreview(a),empty:e.jsx(Me,{compact:!0,className:"ft-empty",icon:e.jsx(ze,{width:22,height:22}),title:u?"No clauses match":"No clauses yet",body:u?"Try other words or clear the filters.":"Add the wording your firm has agreed on, so the team drafts from it.",action:u?s.filterCount>0?e.jsx("button",{type:"button",className:"ent-btn-ghost ent-btn-compact kit-btn",onClick:s.clearFilters,children:"Clear filters"}):void 0:e.jsx("button",{type:"button",className:"ent-btn ent-btn-compact kit-btn",onClick:s.openCreate,children:"New clause"})}),columns:[{key:"name",label:"Clause",render:a=>{const c=a.tags||[],h=[a.category,a.jurisdiction,c.length?c.slice(0,3).join(", ")+(c.length>3?` +${c.length-3}`:""):""].filter(Boolean);return e.jsxs("span",{className:"ft-name",children:[e.jsx("span",{className:"ft-name-main",children:a.name}),e.jsx("span",{className:"kit-meta ft-name-sub",children:h.map(E=>e.jsx("span",{children:E},E))}),e.jsx("span",{className:"ft-name-sub ft-narrow",children:e.jsx(se,{position:a.position,label:s.positionLabels[a.position]||a.position})})]})}},{key:"position",label:"Position",className:"ft-col-position",render:a=>e.jsx(se,{position:a.position,label:s.positionLabels[a.position]||a.position})},{key:"side",label:"Side",className:"ft-col-side",render:a=>e.jsx("span",{className:"kit-cell is-muted",children:s.sideLabels[a.partySide]||""})},{key:"acts",label:e.jsx("span",{className:"sr-only",children:"Actions"}),align:"end",className:"ft-col-acts",render:a=>e.jsxs("span",{className:"ft-acts",children:[e.jsx(te,{label:`Read ${a.name}`,onClick:()=>s.setPreview(a),children:e.jsx(Ge,{width:15,height:15,"aria-hidden":!0})}),e.jsx(te,{label:`Edit ${a.name}`,onClick:()=>s.openEdit(a),children:e.jsx(ye,{width:15,height:15,"aria-hidden":!0})}),e.jsx(te,{danger:!0,label:`Delete ${a.name}`,onClick:()=>s.askDelete(a._id),children:e.jsx(Ue,{width:15,height:15,"aria-hidden":!0})})]})}]}),n=s.draft,j=!!n.body.trim(),K=e.jsx(xe,{isOpen:s.editorOpen,onClose:s.closeEditor,title:s.editingId?"Edit clause":"New clause",maxWidth:"md:max-w-2xl",footer:e.jsxs("div",{className:"kit-dlg-foot",children:[e.jsx("button",{type:"button",className:"ent-btn-ghost ent-btn-compact kit-btn",disabled:s.saving,onClick:s.closeEditor,children:"Cancel"}),e.jsx("button",{type:"button",className:"ent-btn ent-btn-compact kit-btn",disabled:s.saving,onClick:s.save,children:s.saving?"Saving":s.editingId?"Save clause":"Add clause"})]}),children:e.jsxs("div",{className:"ft-form",children:[e.jsx(C,{label:"Name",htmlFor:"ft-c-name",required:!0,children:e.jsx(b,{id:"ft-c-name",placeholder:"Mutual indemnification, preferred",value:n.name,onChange:a=>s.setDraft(c=>({...c,name:a.target.value}))})}),e.jsxs(Re,{children:[e.jsx(C,{label:"Category",htmlFor:"ft-c-cat",required:!0,className:"sm:col-span-3",children:e.jsx(b,{id:"ft-c-cat",list:"ft-clause-categories",placeholder:"Indemnification",value:n.category,onChange:a=>s.setDraft(c=>({...c,category:a.target.value}))})}),e.jsx(C,{label:"Jurisdiction",htmlFor:"ft-c-jur",className:"sm:col-span-3",children:e.jsx(b,{id:"ft-c-jur",list:"ft-clause-jurisdictions",placeholder:"Nigeria, Delaware",value:n.jurisdiction,onChange:a=>s.setDraft(c=>({...c,jurisdiction:a.target.value}))})})]}),e.jsx("datalist",{id:"ft-clause-categories",children:s.facets.categories.map(a=>e.jsx("option",{value:a},a))}),e.jsx("datalist",{id:"ft-clause-jurisdictions",children:s.facets.jurisdictions.map(a=>e.jsx("option",{value:a},a))}),e.jsxs("div",{className:"ft-pair",children:[e.jsx(C,{label:"Position",children:e.jsx(je,{name:"Position",value:n.position,onChange:a=>s.setDraft(c=>({...c,position:a})),options:s.positions.map(a=>({value:a,label:s.positionLabels[a]}))})}),e.jsx(C,{label:"Party side",children:e.jsx(je,{name:"Party side",value:n.partySide,onCh
1ange:a=>s.setDraft(c=>({...c,partySide:a})),options:s.sides.map(a=>({value:a,label:s.sideLabels[a]}))})})]}),e.jsx(C,{label:"Tags",htmlFor:"ft-c-tags",hint:"Separate tags with commas.",children:e.jsx(b,{id:"ft-c-tags",placeholder:"SaaS, mutual, capped",value:n.tagsRaw,onChange:a=>s.setDraft(c=>({...c,tagsRaw:a.target.value}))})}),e.jsxs("div",{"data-slot":"form-field",className:"ft-clause-body",children:[e.jsxs("div",{className:"ft-label-row",children:[e.jsxs("span",{"data-slot":"form-label",children:["Wording",e.jsx("span",{"data-slot":"form-required","aria-hidden":"true",children:"*"})]}),e.jsxs("button",{type:"button",className:"kit-link","aria-expanded":s.aiOpen,onClick:()=>s.setAiOpen(a=>!a),children:[e.jsx(ve,{width:13,height:13,"aria-hidden":!0})," ",j?"Revise with AI":"Draft with AI"]})]}),s.aiOpen&&e.jsxs("div",{className:"ft-ai is-stacked",children:[e.jsx("p",{className:"kit-note",children:"AI uses the category, jurisdiction, position and side above. Add anything else it should know."}),e.jsx(Y,{rows:2,"aria-label":"Drafting instructions",placeholder:"Cap liability at 12 months of fees; carve out IP and confidentiality",value:s.aiHint,disabled:s.aiBusy,onChange:a=>s.setAiHint(a.target.value)}),e.jsxs("div",{className:"kit-dlg-foot",children:[!n.category.trim()&&e.jsx("span",{className:"kit-dlg-foot-note",children:"Set a category first."}),e.jsx("button",{type:"button",className:"ent-btn-ghost ent-btn-compact kit-btn",disabled:s.aiBusy,onClick:()=>{s.setAiOpen(()=>!1),s.setAiHint("")},children:"Cancel"}),e.jsxs("button",{type:"button",className:"ent-btn ent-btn-compact kit-btn",disabled:s.aiBusy||!n.category.trim(),onClick:s.generate,children:[e.jsx(ve,{width:14,height:14,"aria-hidden":!0})," ",s.aiBusy?"Drafting":j?"Revise":"Draft"]})]})]}),e.jsx(ke,{value:n.body,onChange:a=>s.setDraft(c=>({...c,body:a})),placeholder:"Paste the clause as the firm has agreed it"})]}),e.jsx(C,{label:"Internal notes",htmlFor:"ft-c-notes",hint:"Never inserted into a draft.",children:e.jsx(Y,{id:"ft-c-notes",rows:2,placeholder:"When to use it, who approved it, when it was last reviewed",value:n.notes,onChange:a=>s.setDraft(c=>({...c,notes:a.target.value}))})})]})}),l=s.preview,R=e.jsx(xe,{isOpen:!!l,onClose:()=>s.setPreview(null),title:(l==null?void 0:l.name)||"",eyebrow:l?e.jsx("span",{className:"kit-eyebrow",children:l.category}):void 0,maxWidth:"md:max-w-2xl",dismissOnOverlayClick:!0,footer:l?e.jsxs("div",{className:"kit-dlg-foot",children:[e.jsx("button",{type:"button",className:"ent-btn-ghost ent-btn-compact kit-btn",onClick:()=>s.setPreview(null),children:"Close"}),e.jsxs("button",{type:"button",className:"ent-btn ent-btn-compact kit-btn",onClick:()=>{const a=l;s.setPreview(null),s.openEdit(a)},children:[e.jsx(ye,{width:14,height:14,"aria-hidden":!0})," Edit"]})]}):void 0,children:l&&e.jsxs("div",{className:"ft-clause-read",children:[e.jsxs("div",{className:"kit-particulars ft-clause-facts",children:[e.jsx("span",{children:e.jsx(se,{position:l.position,label:s.positionLabels[l.position]||l.position})}),l.jurisdiction&&e.jsx("span",{children:l.jurisdiction}),l.partySide&&l.partySide!=="neutral"&&e.jsx("span",{children:s.sideLabels[l.partySide]}),(l.tags||[]).length>0&&e.jsx("span",{children:l.tags.join(", ")})]}),e.jsx("div",{className:"ft-prose ft-clause-text prose prose-sm dark:prose-invert max-w-none",dangerouslySetInnerHTML:{__html:we(l.body||"")}}),l.notes&&e.jsx("div",{className:"kit-callout",children:e.jsxs("span",{children:[e.jsx("b",{children:"Notes."})," ",l.notes]})})]})});return e.jsxs(He,{title:"Clause library",count:s.loading?void 0:s.clauses.length,countLabel:`${s.clauses.length} clauses`,intro:"Pre-approved language your team can drop into drafts, by category, jurisdiction and position.",actions:e.jsxs("button",{type:"button",className:"ent-btn ent-btn-compact kit-btn",onClick:s.openCreate,children:[e.jsx(Ye,{width:15,height:15,"aria-hidden":!0})," New clause"]}),head:o,onBack:s.onBack,className:"ft-cl",children:[g,K,R]})}const ae=["preferred","fallback","aggressive"],Ne=["our_side","counterparty","neutral"],L={preferred:"Preferred",fallback:"Fallback",aggressive:"Aggressive"},z={our_side:"Our side",counterparty:"Counterparty",neutral:"Neutral"},et={preferred:"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-300",fallback:"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300",aggressive:"bg-rose-100 text-rose-700 dark:bg-rose-900/40 dark:text-rose-300"},ie={name:"",category:"",jurisdiction:"",position:"preferred",partySide:"neutral",tagsRaw:"",body:"",notes:""},tt=()=>{const{workspaceId:s}=Ve(),u=Xe(),{activeWorkspace:o}
1=_e(),g=Ee(),n=s||(o==null?void 0:o._id),[j,K]=d.useState([]),[l,R]=d.useState(!0),[a,c]=d.useState(!1),[h,E]=d.useState(""),[y,B]=d.useState(""),[v,M]=d.useState(""),[N,H]=d.useState(""),[F,Ce]=d.useState({categories:[],jurisdictions:[],tags:[]}),[re,Q]=d.useState(!1),[I,V]=d.useState(null),[r,m]=d.useState(ie),[p,D]=d.useState(null),[X,q]=d.useState(null),[oe,O]=d.useState(!1),[Z,T]=d.useState(""),[_,ne]=d.useState(!1),le=d.useCallback(()=>{const t={};return h.trim()&&(t.q=h.trim()),y&&(t.category=y),v&&(t.jurisdiction=v),N&&(t.position=N),t},[h,y,v,N]),J=d.useCallback(async()=>{if(n){R(!0);try{const t=await P.list(n,le());K(t)}catch(t){const i=t instanceof Error?t.message:"Failed to load clauses";x.error(i)}finally{R(!1)}}},[n,le]),W=d.useCallback(async()=>{if(n)try{const t=await P.getFacets(n);Ce(t)}catch{}},[n]);d.useEffect(()=>{W()},[W]),d.useEffect(()=>{const t=setTimeout(()=>{J()},200);return()=>clearTimeout(t)},[J]);const{clear:Se}=Ke({param:Qe,openId:(p==null?void 0:p._id)||null,ready:!!n&&!l,onOpenFromUrl:t=>{const i=j.find(f=>String(f._id)===t);if(i){D(i);return}const w=()=>{x.error("That clause no longer exists or you no longer have access."),Se()};P.getById(n,t).then(f=>f!=null&&f._id?D(f):w()).catch(w)}}),ee=()=>{V(null),m(ie),Q(!0)},ce=t=>{V(t._id),m({name:t.name,category:t.category,jurisdiction:t.jurisdiction??"",position:t.position,partySide:t.partySide,tagsRaw:(t.tags??[]).join(", "),body:t.body,notes:t.notes??""}),Q(!0)},G=()=>{Q(!1),V(null),m(ie),O(!1),T("")},de=async()=>{if(!n)return;if(!r.name.trim())return x.error("Name is required");if(!r.category.trim())return x.error("Category is required");if(!r.body.trim())return x.error("Body is required");const t=r.tagsRaw.split(",").map(w=>w.trim()).filter(Boolean),i={name:r.name.trim(),category:r.category.trim(),jurisdiction:r.jurisdiction.trim(),position:r.position,partySide:r.partySide,tags:t,body:r.body,notes:r.notes.trim()};c(!0);try{I?(await P.update(n,I,i),x.success("Clause updated")):(await P.create(n,i),x.success("Clause created")),G(),J(),W()}catch(w){const f=w instanceof Error?w.message:"Save failed";x.error(f)}finally{c(!1)}},ue=async()=>{if(n){if(!r.category.trim())return x.error("Set a category first — the AI needs to know what kind of clause to draft.");ne(!0);try{const t=await P.suggest(n,{category:r.category.trim(),jurisdiction:r.jurisdiction.trim(),position:r.position,partySide:r.partySide,hint:Z.trim(),name:r.name.trim(),existingBody:r.body&&r.body.trim()?r.body:""});m(i=>({...i,name:i.name.trim()?i.name:(t==null?void 0:t.name)??i.name,body:(t==null?void 0:t.body)??i.body})),T(""),O(!1),x.success("Draft generated — review and edit before saving")}catch(t){const i=t instanceof Error?t.message:"AI draft failed";x.error(i)}finally{ne(!1)}}},Ae=async()=>{if(!(!n||!X))try{await P.delete(n,X),x.success("Clause deleted"),q(null),J(),W()}catch(t){const i=t instanceof Error?t.message:"Delete failed";x.error(i)}},pe=()=>u(`/case-manager/${n}/firm_tools`),U=d.useMemo(()=>(y?1:0)+(v?1:0)+(N?1:0),[y,v,N]),me=e.jsx(Le,{isOpen:!!X,title:"Delete clause?",message:"This clause will be permanently removed from the library. This cannot be undone.",onClose:()=>q(null),onConfirm:Ae});return g?e.jsxs(e.Fragment,{children:[e.jsx(Ze,{m:{onBack:pe,loading:l,clauses:j,facets:F,positions:ae,positionLabels:L,sides:Ne,sideLabels:z,search:h,setSearch:E,category:y,setCategory:B,jurisdiction:v,setJurisdiction:M,position:N,setPosition:H,filterCount:U,clearFilters:()=>{B(""),M(""),H("")},openCreate:ee,openEdit:ce,askDelete:q,preview:p,setPreview:D,editorOpen:re,editingId:I,closeEditor:G,draft:r,setDraft:m,saving:a,save:de,aiOpen:oe,setAiOpen:O,aiHint:Z,setAiHint:T,aiBusy:_,generate:ue}}),me]}):e.jsxs("div",{className:"p-6 max-w-6xl mx-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:pe,className:"text-muted-foreground hover:text-chambers-800 dark:hover:text-chambers-100","aria-label":"Back to firm tools",children:e.jsx(Fe,{})}),e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-semibold text-foreground flex items-center gap-2",children:[e.jsx(he,{className:"text-blue-500"}),"Clause library"]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Pre-approved language your team can drop into drafts."})]})]}),e.jsxs("button",{type:"button",onClick:ee,className:"inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-blue-600 hover:bg-blue-700 text-white text-sm font-medium",children:[e.jsx(be,{className:"text-xs"})," New clause"]})]}),e.jsxs("div",{className:"flex flex-wrap gap-3 mb-4",children:[e.jsxs("div",{className:"relative flex-1 min-w-[220px]",children:[e.jsx(Ie,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-chambers-400 text-sm"}),e.jsx(b,{type:"text",value:h,onChange:t=>E(t.target.value),placeholder:"Search clauses by name, body, or tag…",className:"pl-9 pr-3"})]}),e.jsxs($,{value:y,onChange:t=>B(t.target.value),children:[e.jsx("option",{value:"",children:"All categories"}),F.categories.map(t=>e.jsx("option",{value:t,children:t},t))]}
1),e.jsxs($,{value:v,onChange:t=>M(t.target.value),children:[e.jsx("option",{value:"",children:"All jurisdictions"}),F.jurisdictions.map(t=>e.jsx("option",{value:t,children:t},t))]}),e.jsxs($,{value:N,onChange:t=>H(t.target.value),children:[e.jsx("option",{value:"",children:"Any position"}),ae.map(t=>e.jsx("option",{value:t,children:L[t]},t))]}),U>0&&e.jsx("button",{type:"button",onClick:()=>{B(""),M(""),H("")},className:"text-xs text-chambers-500 hover:text-chambers-800 dark:hover:text-chambers-100 underline",children:"Clear filters"})]}),l?e.jsx("div",{className:"py-16 flex justify-center",children:e.jsx($e,{size:"large"})}):j.length===0?e.jsxs("div",{className:"rounded-xl border border-dashed border-border p-10 text-center",children:[e.jsx(he,{className:"mx-auto text-3xl text-chambers-400 mb-3"}),e.jsx("p",{className:"text-muted-foreground mb-3",children:h||U>0?"No clauses match your filters.":"No clauses yet. Add your first one to start building the firm library."}),!h&&U===0&&e.jsxs("button",{type:"button",onClick:ee,className:"inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-blue-600 hover:bg-blue-700 text-white text-sm",children:[e.jsx(be,{className:"text-xs"})," New clause"]})]}):e.jsx("div",{className:"grid gap-3",children:j.map(t=>{var i;return e.jsxs("div",{className:"flex items-start justify-between gap-4 p-4 rounded-lg border border-border bg-surface hover:border-blue-300 dark:hover:border-blue-600",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-1",children:[e.jsx("h3",{className:"font-medium text-foreground",children:t.name}),e.jsx("span",{className:`text-[10px] uppercase tracking-wider px-1.5 py-0.5 rounded ${et[t.position]}`,children:L[t.position]}),t.partySide&&t.partySide!=="neutral"&&e.jsx("span",{className:"text-[10px] uppercase tracking-wider px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:z[t.partySide]})]}),e.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[e.jsx("span",{children:t.category}),t.jurisdiction&&e.jsxs("span",{children:["• ",t.jurisdiction]}),((i=t.tags)==null?void 0:i.length)>0&&e.jsxs("span",{children:["• ",t.tags.slice(0,3).join(", "),t.tags.length>3&&` +${t.tags.length-3}`]})]})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx("button",{type:"button",onClick:()=>D(t),title:"Preview",className:"p-2 rounded text-chambers-500 hover:text-blue-600 hover:bg-blue-50 dark:hover:bg-blue-900/20",children:e.jsx(De,{})}),e.jsx("button",{type:"button",onClick:()=>ce(t),title:"Edit",className:"p-2 rounded text-chambers-500 hover:text-chambers-800 dark:hover:text-chambers-100 hover:bg-accent",children:e.jsx(Oe,{})}),e.jsx("button",{type:"button",onClick:()=>q(t._id),title:"Delete",className:"p-2 rounded text-chambers-500 hover:text-rose-600 hover:bg-rose-50 dark:hover:bg-rose-900/20",children:e.jsx(Te,{})})]})]},t._id)})}),re&&e.jsx("div",{className:"fixed inset-0 bg-black/40 z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-surface w-full max-w-2xl max-h-[90vh] rounded-xl shadow-lg flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:I?"Edit clause":"New clause"}),e.jsx("button",{type:"button",onClick:G,className:"text-chambers-500 hover:text-chambers-800 dark:hover:text-chambers-100","aria-label":"Close",children:e.jsx(ge,{})})]}),e.jsxs("div",{className:"px-5 py-4 overflow-y-auto space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-foreground mb-1.5",children:"Name"}),e.jsx(b,{type:"text",value:r.name,onChange:t=>m(i=>({...i,name:t.target.value})),placeholder:"e.g. Mutual indemnification (preferred)"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-foreground mb-1.5",children:"Category"}),e.jsx(b,{type:"text",list:"clause-categories",value:r.category,onChange:t=>m(i=>({...i,category:t.target.value})),placeholder:"e.g. Indemnification"}),e.jsx("datalist",{id:"clause-categories",children:F.categories.map(t=>e.jsx("option",{value:t},t))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-foreground mb-1.5",children:"Jurisdiction"}),e.jsx(b,{type:"text",list:"clause-jurisdictions",value:r.jurisdiction,onChange:t=>m(i=>({...i,jurisdiction:t.target.value})),placeholder:"e.g. Nigeria, Delaware"}),e.jsx("datalist",{id:"clause-jurisdictions",children:F.jurisdictions.map(t=>e.jsx("option",{value:t},t))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-foreground mb-1.5",children:"Position"}),e.jsx($,{value:r.position,onChange:t=>m(i=>({...i,position:t.target.value})),children:ae.map(t=>e.jsx("option",{value:t,children:L[t]},t))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-foreground mb-1.5",children:"Party side"}
1),e.jsx($,{value:r.partySide,onChange:t=>m(i=>({...i,partySide:t.target.value})),children:Ne.map(t=>e.jsx("option",{value:t,children:z[t]},t))})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-xs font-medium text-foreground mb-1.5",children:["Tags ",e.jsx("span",{className:"text-chambers-400",children:"(comma-separated)"})]}),e.jsx(b,{type:"text",value:r.tagsRaw,onChange:t=>m(i=>({...i,tagsRaw:t.target.value})),placeholder:"e.g. SaaS, mutual, capped"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("label",{className:"block text-xs font-medium text-foreground",children:"Clause body"}),e.jsxs("button",{type:"button",onClick:()=>O(t=>!t),className:"inline-flex items-center gap-1.5 text-xs text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",children:[e.jsx(fe,{className:"text-[10px]"}),r.body.trim()?"Revise with AI":"Generate with AI"]})]}),oe&&e.jsxs("div",{className:"mb-2 p-3 rounded-lg border border-blue-200 dark:border-blue-800/60 bg-blue-50 dark:bg-blue-950/20 space-y-2",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Uses the category, jurisdiction, position, and party side above. Add any extra drafting instructions:"}),e.jsx(Y,{value:Z,onChange:t=>T(t.target.value),rows:2,placeholder:"e.g. cap liability at 12 months of fees; include carve-outs for IP and confidentiality",disabled:_}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:()=>{O(!1),T("")},disabled:_,className:"px-3 py-1.5 text-xs rounded border border-border hover:bg-white dark:hover:bg-chambers-800",children:"Cancel"}),e.jsxs("button",{type:"button",onClick:ue,disabled:_||!r.category.trim(),title:r.category.trim()?void 0:"Set a category first",className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs rounded bg-blue-600 hover:bg-blue-700 disabled:bg-blue-300 text-white",children:[e.jsx(fe,{className:"text-[10px]"}),_?"Drafting…":r.body.trim()?"Revise":"Generate"]})]})]}),e.jsx(ke,{value:r.body,onChange:t=>m(i=>({...i,body:t})),placeholder:"Paste the canonical clause language…"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-xs font-medium text-foreground mb-1.5",children:["Notes ",e.jsx("span",{className:"text-chambers-400",children:"(internal — not inserted)"})]}),e.jsx(Y,{value:r.notes,onChange:t=>m(i=>({...i,notes:t.target.value})),rows:2,placeholder:"When to use, who approved, last reviewed…"})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 px-5 py-3 border-t border-border",children:[e.jsx("button",{type:"button",onClick:G,disabled:a,className:"px-4 py-2 text-sm rounded-lg border border-border hover:bg-accent",children:"Cancel"}),e.jsx("button",{type:"button",onClick:de,disabled:a,className:"px-4 py-2 text-sm rounded-lg bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white",children:a?"Saving…":I?"Save changes":"Create clause"})]})]})}),p&&e.jsx("div",{className:"fixed inset-0 bg-black/40 z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-surface w-full max-w-2xl max-h-[90vh] rounded-xl shadow-lg flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground truncate",children:p.name}),e.jsx("button",{type:"button",onClick:()=>D(null),className:"text-chambers-500 hover:text-chambers-800 dark:hover:text-chambers-100","aria-label":"Close",children:e.jsx(ge,{})})]}),e.jsxs("div",{className:"px-5 py-4 overflow-y-auto",children:[e.jsxs("div",{className:"flex flex-wrap gap-2 mb-3 text-xs text-muted-foreground",children:[e.jsx("span",{children:p.category}),p.jurisdiction&&e.jsxs("span",{children:["• ",p.jurisdiction]}),e.jsxs("span",{children:["• ",L[p.position]]}),p.partySide&&p.partySide!=="neutral"&&e.jsxs("span",{children:["• ",z[p.partySide]]})]}),e.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",dangerouslySetInnerHTML:{__html:we(p.body)}}),p.notes&&e.jsxs("div",{className:"mt-4 p-3 rounded bg-muted text-xs text-muted-foreground",children:[e.jsx("strong",{children:"Notes:"})," ",p.notes]})]})]})}),me]})},zs=Pe.memo(tt);export{zs as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.