1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-_qZUzLyk.js","assets/index-BqMa9LX1.css"])))=>i.map(i=>d[i]); 2import{c as ve,a4 as Ae,d as i2,a as T,r as x,u as Se,au as l2,j as e,D as f0,L as Be,S as Ne,av as g0,t as o2,al as c2,ay as d2,az as u2,aA as x2,aj as v0,m as Ye,C as gt,aB as m2,aC as h2,aD as b0,aE as p2,aF as f2,aG as g2,ap as v2,y as Pe,X as y0,aH as b2,x as y2,aw as j2,ab as C2,aI as w2,aJ as _2,aK as N2,V as k2,aL as F2,aM as A2,ax as S2,aN as E2,ag as B2}from"./index-_qZUzLyk.js";import{a as I2}from"./index--Y-draln.js";import{d as M2,c as P2}from"./delta-CAOXFW88.js";import{r as T2,U as O2,R as L2,b as R2,a as D2}from"./reupload_loader-DOTiQ_5k.js";import{d as St,u as vt,s as $2,m as V2,a as G2,i as U2,b as Xe,g as dt,c as ut,e as H2,f as Et,S as Z2,h as xe,j as z2,k as K2,l as Ee,n as W2,o as be,p as ke,q as ye,r as Fe,t as j0,v as C0,w as w0,x as q2,y as Y2,z as Bt,A as X2,B as It,C as Q2,L as Ze,D as J2,E as ea,F as bt,G as _0,R as ta,H as aa,I as sa,Z as yt,J as N0,K as ra,M as na,N as ia,O as la,P as oa,Q as ze,T as ca,U as k0,V as da,W as ua,X as xa,Y as ma,_ as Mt,$ as F0,a0 as ha,a1 as A0,a2 as pa,a3 as fa,a4 as de,a5 as ga,a6 as va,a7 as ba,a8 as ya,a9 as ja,aa as Pt,ab as Ca,ac as wa,ad as S0,ae as _a,af as E0,ag as B0,ah as Na,ai as ka,aj as Fa}from"./AreaChart-XkTijKaI.js";import{A as Aa}from"./arrow-up-right-D_40phod.js";import{F as Sa}from"./file-text-CmbQhnLn.js";import{F as Qe,a as Ea,r as Tt,S as Ba}from"./TopicAnalysis-C33YXiO6.js";import{b as xt,i as Ia,a as Ma,M as Ot,t as tt}from"./signalTiers-BBQ6EzP3.js";import{b as Pa,c as Ta}from"./index-at5Nf3no.js";import{C as I0,a as M0}from"./chevron-right-CCgmTHk9.js";import{F as Oa,G as La}from"./FavourabilityBar-B55BtvBL.js";import{T as Ra}from"./trending-up-DqkcS9je.js";import{T as Da}from"./trending-down-BVR-s3jk.js";import{M as $a}from"./MarketInsightsModal-BDubjN18.js";import{I as Va,E as Ga}from"./InProgress-BL6BzgLh.js";import"./calendar-gray-bGK-6Nqf.js";import"./calendar-blue-B1KxmHXh.js";import"./index-DH0Yi2U2.js";import"./source-lng-DH8OT5Br.js";import"./minus-D5eif9lO.js";import"./SourceLanguageModal-Whi2eNkW.js";import"./FileSaver.min-yyFfgQbY.js";import"./document-C12kr-4w.js";import"./Overview-_x-OlqL9.js";import"./termscout-logo-white-BZoXmpk8.js";import"./acceleration_100-CzsvEu2U.js";import"./low-BdB0brpJ.js";/** 3 * @license lucide-react v0.525.0 - ISC 4 * 5 * This source code is licensed under the ISC license. 6 * See the LICENSE file in the root directory of this source tree. 7 */const Ua=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Ha=ve("ellipsis",Ua);/** 8 * @license lucide-react v0.525.0 - ISC 9 * 10 * This source code is licensed under the ISC license. 11 * See the LICENSE file in the root directory of this source tree. 12 */const Za=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["path",{d:"M12 18v-4",key:"q1q25u"}],["path",{d:"M16 18v-6",key:"15y0np"}]],za=ve("file-chart-column-increasing",Za);/** 13 * @license lucide-react v0.525.0 - ISC 14 * 15 * This source code is licensed under the ISC license. 16 * See the LICENSE file in the root directory of this source tree. 17 */const Ka=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Wa=ve("globe",Ka);/** 18 * @license lucide-react v0.525.0 - ISC 19 * 20 * This source code is licensed under the ISC license. 21 * See the LICENSE file in the root directory of this source tree. 22 */const qa=[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]],P0=ve("list-checks",qa);/** 23 * @license lucide-react v0.525.0 - ISC 24 * 25 * This source code is licensed under the ISC license. 26 * See the LICENSE file in the root directory of this source tree. 27 */const Ya=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],Xa=ve("lock",Ya);/** 28 * @license lucide-react v0.525.0 - ISC 29 * 30 * This source code is licensed under the ISC license. 31 * See the LICENSE file in the root directory of this source tree. 32 */const Qa=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Ja=ve("rotate-cw",Qa);/** 33 * @license lucide-react v0.525.0 - ISC 34 * 35 * This source code is licensed under the ISC license. 36 * See the LICENSE file in the root directory of this source tree. 37 */const es=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",ke
37y:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],Je=ve("shield-alert",es),ts="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAAmCAYAAACoPemuAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAGeSURBVHgB7ZaBcYMwDEVFrwOwQRkhG5RswAgegQ1gg7IBbNARmk6QEWADs4EqH+bqUFsGwxXa49/p2sTW5yEJB4BTp/6wEDGGI4rAmsPBEVCCg0o4kghIaDB5iKoRRKpbKPFbrQKFtQq9Q9U25HWnuECoKLmAQOnZaiZALUW+uqVbzIVRPQWVwBopGGNoxRo47aVusPbsUzOZWeG1SY6PAzs+UeWKmatc1dIt/5hcL+fMsrFiwF+0oHjXkTn2xEz+dA5HxdxFpcf0zWKYwQLR/s4BJriknFm7OAxbWAYmHT4Zl8RVSzgMEeZD1b6be7IlRlHUM74vju97nHF44vCUCsvSJ8UVQoTDwHOSHJylUnfc4NAtpmXH4Tio5sD9JlRirAsObhcoD1yrIfaBYuBwdygjr3RALXoxeJ6YCvrzSqEMzIOuo7jSMdKBX649vecYsgvtPzOzK2X4pA6fGpaKMZMY8C5laWe71GdsZeJY72e270GUo8Bu9G+qPCia0Da6KnaDvYU/34+C2riVIvODfipTGMpfhbTx1KlT/1Vf9xscGjPlbm8AAAAASUVORK5CYII=",as="data:image/svg+xml,%3csvg%20width='17'%20height='17'%20viewBox='0%200%2017%2017'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cmask%20id='mask0_3693_4108'%20style='mask-type:luminance'%20maskUnits='userSpaceOnUse'%20x='1'%20y='1'%20width='15'%20height='15'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M2.125%205.3125H14.875L14.1667%2014.875H2.83333L2.125%205.3125Z'%20fill='white'%20stroke='white'%20stroke-width='2'%20stroke-linejoin='round'/%3e%3cpath%20d='M5.66699%206.72917V2.125H11.3337V6.72917'%20stroke='white'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M5.66699%2012.0415H11.3337'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_3693_4108)'%3e%3cpath%20d='M0%200H17V17H0V0Z'%20fill='%239A9A9A'/%3e%3c/g%3e%3c/svg%3e",ss="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M4%2014.6668C3.44444%2014.6668%202.97222%2014.4724%202.58333%2014.0835C2.19444%2013.6946%202%2013.2224%202%2012.6668V10.6668H4V1.3335H14V12.6668C14%2013.2224%2013.8056%2013.6946%2013.4167%2014.0835C13.0278%2014.4724%2012.5556%2014.6668%2012%2014.6668H4ZM12%2013.3335C12.1889%2013.3335%2012.3473%2013.2695%2012.4753%2013.1415C12.6033%2013.0135%2012.6671%2012.8553%2012.6667%2012.6668V2.66683H5.33333V10.6668H11.3333V12.6668C11.3333%2012.8557%2011.3973%2013.0142%2011.5253%2013.1422C11.6533%2013.2702%2011.8116%2013.3339%2012%2013.3335ZM6%206.00016V4.66683H12V6.00016H6ZM6%208.00016V6.66683H12V8.00016H6Z'%20fill='%239A9A9A'/%3e%3c/svg%3e",rs="data:image/svg+xml,%3csvg%20width='17'%20height='17'%20viewBox='0%200%2017%2017'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M4.60417%207.7915L8.5%201.4165L12.3958%207.7915H4.60417ZM12.3958%2015.5832C11.5104%2015.5832%2010.7579%2015.2734%2010.1384%2014.6538C9.51882%2014.0343%209.20881%2013.2816%209.20833%2012.3957C9.20786%2011.5098%209.51787%2010.7573%2010.1384%2010.1382C10.7589%209.51913%2011.5114%209.20912%2012.3958%209.20817C13.2803%209.20723%2014.033%209.51724%2014.654%2010.1382C15.275%2010.7592%2015.5847%2011.5117%2015.5833%2012.3957C15.5819%2013.2797%2015.2721%2014.0324%2014.654%2014.6538C14.0359%2015.2753%2013.2831%2015.5851%2012.3958%2015.5832ZM2.125%2015.229V9.56234H7.79167V15.229H2.125Z'%20fill='%239A9A9A'/%3e%3c/svg%3e",ns="data:image/svg+xml,%3csvg%20width='17'%20height='17'%20viewBox='0%200%2017%2017'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M8.49967%206.375C7.93609%206.375%207.39559%206.59888%206.99707%206.9974C6.59856%207.39591%206.37467%207.93641%206.37467%208.5C6.37467%209.06358%206.59856%209.60409%206.99707%2010.0026C7.39559%2010.4011%207.93609%2010.625%208.49967%2010.625C9.06326%2010.625%209.60376%2010.4011%2010.0023%2010.0026C10.4008%209.60409%2010.6247%209.06358%2010.6247%208.5C10.6247%207.93641%2010.4008%207.39591%2010.0023%206.9974C9.60376%206.59888%209.06326%206.375%208.49967%206.375ZM8.49967%2012.0417C7.56037%2012.0417%206.65953%2011.6685%205.99534%2011.0043C5.33115%2010.3401%204.95801%209.43931%204.95801%208.5C4.95801%207.56069%205.33115%206.65985%205.99534%205.99566C6.65953%205.33147%207.56037%204.95833%208.49967%204.95833C9.43898
37%204.95833%2010.3398%205.33147%2011.004%205.99566C11.6682%206.65985%2012.0413%207.56069%2012.0413%208.5C12.0413%209.43931%2011.6682%2010.3401%2011.004%2011.0043C10.3398%2011.6685%209.43898%2012.0417%208.49967%2012.0417ZM8.49967%203.1875C4.95801%203.1875%201.93342%205.39042%200.708008%208.5C1.93342%2011.6096%204.95801%2013.8125%208.49967%2013.8125C12.0413%2013.8125%2015.0659%2011.6096%2016.2913%208.5C15.0659%205.39042%2012.0413%203.1875%208.49967%203.1875Z'%20fill='%239A9A9A'/%3e%3c/svg%3e",is="data:image/svg+xml,%3csvg%20width='15'%20height='15'%20viewBox='0%200%2015%2015'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M1.25%205.625C1.25%204.44625%201.25%203.8575%201.61625%203.49125C1.9825%203.125%202.57125%203.125%203.75%203.125H11.25C12.4288%203.125%2013.0175%203.125%2013.3837%203.49125C13.75%203.8575%2013.75%204.44625%2013.75%205.625C13.75%205.91937%2013.75%206.06687%2013.6588%206.15875C13.5669%206.25%2013.4187%206.25%2013.125%206.25H1.875C1.58062%206.25%201.43312%206.25%201.34125%206.15875C1.25%206.06687%201.25%205.91875%201.25%205.625ZM1.25%2011.25C1.25%2012.4288%201.25%2013.0175%201.61625%2013.3837C1.9825%2013.75%202.57125%2013.75%203.75%2013.75H11.25C12.4288%2013.75%2013.0175%2013.75%2013.3837%2013.3837C13.75%2013.0175%2013.75%2012.4288%2013.75%2011.25V8.125C13.75%207.83063%2013.75%207.68313%2013.6588%207.59125C13.5669%207.5%2013.4187%207.5%2013.125%207.5H1.875C1.58062%207.5%201.43312%207.5%201.34125%207.59125C1.25%207.68313%201.25%207.83125%201.25%208.125V11.25Z'%20fill='%239A9A9A'/%3e%3cpath%20d='M4.375%201.875V3.75M10.625%201.875V3.75'%20stroke='%239A9A9A'%20stroke-width='2'%20stroke-linecap='round'/%3e%3c/svg%3e",ls=t=>{if(!t)return"â";const a=new Date(t);return Number.isNaN(a.getTime())?"â":a.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})},os=()=>e.jsxs("div",{className:"bg-[#F8F8FF] animate-pulse px-6 pt-6 pb-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-6 mb-5",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-14 h-14 rounded-xl bg-gray-100"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-6 w-48 bg-gray-200 rounded"}),e.jsx("div",{className:"h-3 w-40 bg-gray-100 rounded"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"h-9 w-24 bg-gray-100 rounded-full"}),e.jsx("div",{className:"h-9 w-28 bg-gray-100 rounded-full"}),e.jsx("div",{className:"h-9 w-9 bg-gray-100 rounded-full"})]})]}),e.jsx("div",{className:"flex items-stretch bg-[#FEFEFE] border border-gray-200 rounded-lg divide-x divide-gray-200 overflow-hidden",children:[0,1,2,3,4].map(t=>e.jsx("div",{className:"flex-1 px-4 py-3",children:e.jsx("div",{className:"h-3 w-32 bg-gray-100 rounded"})},t))})]}),cs=({icon:t,label:a,value:s,valueIcon:r})=>e.jsxs("div",{className:"flex-1 inline-flex items-center justify-center gap-2 px-4 py-2.5 min-w-0",children:[t&&(typeof t=="string"?e.jsx("img",{src:t,alt:"",className:"w-3.5 h-3.5 flex-shrink-0"}):e.jsx(t,{className:"w-3.5 h-3.5 text-gray-400 flex-shrink-0"})),e.jsxs("span",{className:"text-[11px] text-gray-400 flex-shrink-0",children:[a,":"]}),e.jsxs("span",{className:"inline-flex items-center gap-1 text-[12px] font-semibold text-gray-800 min-w-0",children:[r&&e.jsx(r,{className:"w-3 h-3 text-gray-500 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:s})]})]}),ds=()=>{const{contractId:t}=Ae(),a=i2(),{documentOverviewResult:s,documentOverviewLoading:r}=T(M=>M.upload),[n,i]=x.useState(!1),l=x.useRef(null),[o,c]=x.useState(!1),[u,h]=x.useState(!1),[m,f]=x.useState(!1),y=s||{},v=y.lifecycle==="agreement"||m,g=x.useMemo(()=>({contract_id:t,primary_agreement:St(y.primary_agreement)||y.product_suite_name,template_name:y.template_name,vendor:y.product_suite_name}),[t,y.primary_agreement,y.product_suite_name,y.template_name]),j=Se(),p=T(
37M=>M.auth?.user?.tokens?.accessToken),C=T(M=>M.auth?.user?.tokens?.jwt),[F,A]=x.useState(!1);x.useEffect(()=>{if(!t)return;let M=!0;return l2(async()=>{const{fetchPlaybookList:U}=await import("./index-_qZUzLyk.js").then(L=>L.dI);return{fetchPlaybookList:U}},__vite__mapDeps([0,1])).then(({fetchPlaybookList:U})=>{j(U({contractId:t})).then(L=>{M&&A(Array.isArray(L?.payload)&&L.payload.length>0)})}),()=>{M=!1}},[j,t]);const I=s?.template_metadata?.lite===1,w=F&&!I,[E,V]=x.useState(null),[q,R]=x.useState(!!y.reupload_in_progress),$=x.useRef(null),D=q;x.useEffect(()=>{if(!D||!p||!t)return;let M=!1,U;const L=()=>{clearInterval(U),R(!1),$.current&&a(`/profile/${$.current}`)},me=async()=>{try{const le=await j(o2({authToken:p,contractId:t})).unwrap();if(M)return;V(le),le.in_progress||L()}catch{if(M)return;L()}};return me(),U=setInterval(me,1e4),()=>{M=!0,U&&clearInterval(U)}},[D,p,t,j,a]),x.useEffect(()=>{D||V(null)},[D]);const te=Math.max(0,Math.min(99,Math.round(E?.total_pct??0))),Z=E?.step_human||"Startingâ¦",X=x.useRef(null),[Q,ae]=x.useState(null),re=x.useRef(null),ne=()=>{clearTimeout(re.current),X.current&&ae(X.current.getBoundingClientRect())},ie=()=>{re.current=setTimeout(()=>ae(null),120)},J=M=>{h(!1),$.current=M||null,R(!0)};if(x.useEffect(()=>{if(!n)return;const M=U=>{l.current&&!l.current.contains(U.target)&&i(!1)};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[n]),r)return e.jsx(os,{});const O=s||{},z=!!O.is_public,Ce=[{icon:as,label:"Position",value:O.contract_position||"â"},{icon:ss,label:"Type",value:O.template_name||"â"},{icon:rs,label:"Category",value:O.category||"â"},{icon:is,label:"Last Analyzed",value:ls(O.last_updated)},{icon:ns,label:"Visibility",value:z?"Public":"Private",valueIcon:z?Wa:Xa}];return e.jsxs("div",{className:"bg-[#F8F8FF] px-6 pt-4 pb-1",children:[e.jsxs("div",{className:"flex items-start justify-between gap-6 mb-2 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-4 min-w-0",children:[e.jsx("div",{className:"w-14 h-14 rounded-xl border border-gray-200 bg-[#FEFEFE] flex items-center justify-center p-2 flex-shrink-0",children:e.jsx("img",{src:O.logo_url||f0,alt:"",className:"max-w-full max-h-full object-contain"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("h1",{className:"text-3xl font-semibold text-gray-900 truncate inline-flex items-center gap-2",children:[O.product_suite_name||"Untitled",O.primary_agreement_url&&e.jsx("a",{href:O.primary_agreement_url,target:"_blank",rel:"noopener noreferrer","aria-label":"View source agreement",className:"inline-flex text-gray-400 hover:text-[#0073FF] transition-colors",children:e.jsx(Aa,{className:"w-5 h-5",strokeWidth:2})})]}),e.jsx("div",{className:"text-smdd text-gray-500 truncate mt-0.5",children:St(O.primary_agreement)||""})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[!v&&e.jsx("button",{onClick:()=>c(!0),className:"inline-flex items-center justify-center px-5 py-2 rounded-full text-[13px] font-semibold text-white bg-gradient-to-b from-[#6EB0FF] to-[#0D71EF] shadow-sm hover:shadow-md transition-shadow cursor-pointer",children:"Approve"}),!v&&e.jsxs("div",{ref:X,onMouseEnter:D?ne:void 0,onMouseLeave:D?ie:void 0,className:"relative",children:[e.jsxs("button",{onClick:()=>!D&&h(!0),disabled:D,className:`relative overflow-hidden inline-flex items-center justify-center gap-1.5 px-5 py-2 rounded-full text-[13px] font-semibold cursor-pointer disabled:cursor-default ${D?"border border-[#0073FF]/40 bg-blue-50 text-[#0073FF] transition-colors":"border border-[#0772FD]/40 bg-[linear-gradient(to_top,_#B2D5FF,_25%,_#FFFFFF)] hover:bg-[linear-gradient(to_top,_#9EC9FF,_25%,_#FFFFFF)] text-[#0772FD] transition-colors"}`,children:[D&&e.jsx("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 bg-[linear-gradient(283.76deg,#8BB9F0_3.93%,#C8E1FF_50%,#2A88FF_96.07%)] transition-[width] duration-500 ease-out",style:{width:`${te}%`}}),D?e.jsxs("span",{className:"relative flex items-center justify-center gap-2 text-black",children:[e.jsx("img",{src:T2,alt:"",className:"w-4 h-4 animate-spin [animation-duration:2.5s
37]"}),"Reprocessing"]}):e.jsxs("span",{className:"relative inline-flex items-center gap-1.5",children:[e.jsx(O2,{className:"w-3.5 h-3.5"}),"Re-Upload"]})]}),D&&Q&&e.jsx(L2,{rect:Q,stepLabel:Z,progressPct:te,onMouseEnter:ne,onMouseLeave:ie})]}),e.jsxs("div",{className:"relative",ref:l,children:[e.jsx("button",{onClick:()=>i(M=>!M),"aria-label":"More actions",className:"inline-flex items-center justify-center w-9 h-9 rounded-full border border-gray-200 text-gray-500 bg-[#FEFEFE] hover:bg-gray-50 hover:text-gray-700 transition-colors cursor-pointer",children:e.jsx(Ha,{className:"w-4 h-4"})}),n&&e.jsxs("div",{className:"absolute right-0 top-full mt-1 w-56 bg-[#FEFEFE] border border-gray-200 rounded-md shadow-sm z-50 overflow-hidden",children:[e.jsxs(Be,{to:`/portfolio?tab=compare&compare_contract=${t}&compare_template=${O.template_id??""}&compare_template_name=${encodeURIComponent(O.template_name??"")}`,onClick:()=>i(!1),className:"flex items-center gap-2 px-3 py-3 text-xs text-gray-700 hover:bg-gray-50 transition-colors",children:[e.jsx(Sa,{className:"w-3.5 h-3.5 text-gray-400"}),"Comparable contracts"]}),e.jsxs(Be,{to:`/pre-cert/${t}`,onClick:()=>i(!1),className:"flex items-center gap-2 px-3 py-3 text-xs text-gray-700 hover:bg-gray-50 transition-colors border-t border-gray-100",children:[e.jsx(Ne,{className:"w-3.5 h-3.5 text-gray-400"}),"PreCert"]}),w&&e.jsxs(Be,{to:`/playbooks/${t}`,onClick:()=>i(!1),className:"flex items-center gap-2 px-3 py-3 text-xs text-gray-700 hover:bg-gray-50 transition-colors border-t border-gray-100",children:[e.jsx(P0,{className:"w-3.5 h-3.5 text-gray-400"}),"Playbooks"]}),e.jsxs(Be,{to:`/mini-cir/${t}`,onClick:()=>i(!1),className:"flex items-center gap-2 px-3 py-3 text-xs text-gray-700 hover:bg-gray-50 transition-colors border-t border-gray-100",children:[e.jsx(za,{className:"w-3.5 h-3.5 text-gray-400"}),"Mini Scorecard"]})]})]})]})]}),e.jsx("div",{className:"flex items-stretch bg-[#FEFEFE] border border-gray-200 rounded-lg divide-x divide-gray-200 overflow-hidden",children:Ce.map(M=>e.jsx(cs,{...M},M.label))}),o&&e.jsx(R2,{item:g,onClose:()=>c(!1),onSave:()=>{c(!1),f(!0),C&&t&&j(g0({authToken:C,contractId:t}))}}),u&&e.jsx(D2,{parentItem:g,onClose:()=>h(!1),onSuccess:J})]})},us="data:image/svg+xml,%3csvg%20width='29'%20height='29'%20viewBox='0%200%2029%2029'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12.5461%206.8295L11.3789%205.858C11.0533%205.58648%2010.6428%205.43769%2010.2189%205.4375H3.625C3.1443%205.4375%202.68328%205.62846%202.34337%205.96837C2.00346%206.30828%201.8125%206.7693%201.8125%207.25V21.75C1.8125%2022.2307%202.00346%2022.6917%202.34337%2023.0316C2.68328%2023.3715%203.1443%2023.5625%203.625%2023.5625H25.375C25.8557%2023.5625%2026.3167%2023.3715%2026.6566%2023.0316C26.9965%2022.6917%2027.1875%2022.2307%2027.1875%2021.75V9.0625C27.1875%208.58179%2026.9965%208.12078%2026.6566%207.78087C26.3167%207.44096%2025.8557%207.25%2025.375%207.25H13.7061C13.2822%207.24981%2012.8717%207.10102%2012.5461%206.8295Z'%20fill='%230373FC'/%3e%3cpath%20d='M17.0625%209.00004C15.3789%208.99835%2013.7281%209.46618%2012.2957%2010.351C10.8633%2011.2357%209.70597%2012.5024%208.95378%2014.0087C8.20158%2015.515%207.88431%2017.2012%208.03761%2018.8778C8.19091%2020.5545%208.80871%2022.1552%209.82159%2023.5H12.2775C11.1708%2022.5279%2010.3867%2021.2414%2010.0298%2019.8122C9.67292%2018.383%209.76021%2016.879%2010.28%2015.5006C10.7999%2014.1223%2011.7275%2012.9352%2012.9393%2012.0976C14.1511%2011.26%2015.5894%2010.8117%2017.0625%2010.8125C17.578%2010.8122%2018.092%2010.8669%2018.5959%2010.9757C19.2575%2010.5769%2019.9625%2010.16%2020.6622%209.75042C19.5278%209.25192%2018.3016%208.99632%2017.0625%209.00004ZM24.7512%2010.3739C24.7512%2010.3739%2015.9134%2014.0823%2014.4978%2015.4997C14.1613%2015.8363%2013.8943%2016.236%2013.7122%2016.6759C13.5301%2017.1157%2013.4364%2017.5871%2013.4365%2018.0632C13.4366%2018.5392%2013.5305%2019.0106%2013.7127%2019.4504C13.895%2019.8902%2014.1621%2020.2898%2014.4987%2020.6263C15.1787%2021.306%2016.1008%2021.6878%2017.0623%2021.6876C17.5383%2021.6875%2018.0097%2021.5937%2018.4495%2021.4114C18.8893%2021.2292%2019.2888%2020.9621%2019.6254%2020.6254C21.041%2019.2117%2024.7512%2010.3739%2024.7512%2010.3739ZM25.3275%2014.3669C24.956%2015.0284%2024.5482%2015.7425%2024.1313%2016.4766C24.2499%2016.997%2024.3107%2017.5288%2024.3125%2018.0625C24.3112%2019.0919%2024.0907%2020.1092%2023.6657%2021.0468C23.2407%2021.9843%2022.6209%2022.8206%2021.8475%2023.5H24.3017C25.4856%2021.9346%2026.1258%2020.0253%2026.125%2018.0625C26.1278%2016.7871%2025.8558%2015.526%2025.3275%2014.365'%20fill='%23BBDEFB'/%3e%3c/svg%3e",T0="data:image/svg+xml,%3csvg%20width='19'%20height='19'%20viewBox='0%200%2019%2019'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20opacity='0.4'%20d='M17.4173%2011.0835V9.34025C17.4173%207.25658%2017.4173%206.21395%2016.8077%205.53708C16.7518%205.47462%2016.6926%205.41516%2016.6304%205.35895C15.9535%204.75016%2014.9109%204.75016%2012.8272%204.75016H12.5312C11.6184%204.75016%2011.1616%204.75016%2010.7357%204.62904C10.5019%204.56222%2010.2767%204.46872%2010.0643%204.35037C9.67798%204.13583%209.35498%203.81204%208.70898%203.16683L8.27357%202.73141C8.05665%202.5145%207.94898%202.40683%207.83498%202.31183C7.34468%201.90542%206.74322%201.65629%206.10915%201.59695C5.9619%201.5835%205.80832%201.5835%205.50273%201.5835C4.80369%201.5835%204.45457%201.5835%204.16323%201.63891C3.53769%201.75705%202.96228%202.06098%202.51206%202.51105C2.06184%202.96113%201.75773%203.53645%201.6394%204.16195C1.58398%204.45408%201.58398%204.804%201.58398%205.50225V11.0835C1.58398%2014.0689%201.58398%2015.562%202.51182%2016.489C3.43965%2017.416%204.93194%2017.4168%207.91732%2017.4168H11.084C14.0694%2017.4168%2015.5624%2017.4168%2016.4895%2016.489C17.4165%2015.5612%2017.4173%2014.0689%2017.4173%2011.0835Z'%20fill='%230373FC'/%3e%3cpath%20d='M10.3607%209.22791L10.272%209.06866C9.92826%208.45069%209.75637%208.14307%209.49944%208.14307C9.24251%208.14307%209.07062%208.45069%208.72685%209.06866L8.63819%209.22791C8.54048%209.40343%208.49163%209.49029%208.41564%209.5482C8.33874%209.60611%208.24375%209.62782%208.05377%209.67035L7.88188%209.71016C7.21423%209.86126%206.8804%209.93635%206.80079%2010.1915C6.72118%2010.4467%206.94916%2010.7136%207.40421%2011.2456L7.52182%2011.3831C7.65119%2011.5342%207.71632%2011.6093%207.74527%2011.7034C7.77422%2011.7975%207.76427%2011.8979%207.74527%2012.0997L7.72718%2012.2834C7.65842%2012.9936%207.62405%2013.3492%207.83122%2013.5066C8.03929%2013.6641%208.35231%2013.5202%208.97744%2013.2325L9.13848%2013.1583C9.3167%2013.0769%209.40536%2013.0362%209.49944%2013.0362C9.59353%2013.0362%209.68219%2013.0769%209.8
376041%2013.1583L10.0214%2013.2325C10.6466%2013.5211%2010.9596%2013.6641%2011.1677%2013.5066C11.3757%2013.3492%2011.3405%2012.9936%2011.2717%2012.2834L11.2536%2012.0997C11.2346%2011.8979%2011.2247%2011.7975%2011.2536%2011.7034C11.2826%2011.6093%2011.3477%2011.5342%2011.4771%2011.3831L11.5947%2011.2456C12.0497%2010.7136%2012.2777%2010.4476%2012.1981%2010.1915C12.1185%209.93635%2011.7847%209.86126%2011.117%209.71016L10.9451%209.67035C10.7551%209.62782%2010.6601%209.60701%2010.5832%209.5482C10.5073%209.49029%2010.4584%209.40343%2010.3607%209.22791Z'%20fill='%230373FC'/%3e%3c/svg%3e",at=t=>t==null?null:Math.round(t),xs=t=>{const a=t?.low_cabs_clauses?.[0]?.contract_total_cabs_score??t?.unclear_low_cabs_clauses?.[0]?.contract_total_cabs_score;return a==null?null:Math.round(a>1?a:a*100)},st=[{key:"acceptability",label:"Acceptability",signalKey:"CABS Score",higherBetter:!0,get:t=>t.acceptability},{key:"acceleration",label:"Acceleration",signalKey:"Acceleration Score",higherBetter:!0,get:t=>t.acceleration},{key:"escalation",label:"Escalation",signalKey:"Escalation Score",higherBetter:!1,get:t=>t.escalation},{key:"friction",label:"Friction",signalKey:"Friction Score",higherBetter:!1,get:t=>t.friction}],Ke=(t,a,s)=>t==null?null:a?t:s-t,O0=(t,a,s,r)=>{const n=Ke(t,s,r),i=Ke(a,s,r);return n==null||i==null?null:n===i?"tie":n>i?"you":"them"},Lt=(t,a)=>t==null||a==null?null:t===a?"tie":t>a?"you":"them",ms=t=>t==null?"#e5e7eb":t<=3?"#6E6E72":t<=6?"#18A957":"#0D71EF",hs=t=>t==null?"â":`${Ea[t]?.percent??""}%`,ps=({children:t,className:a=""})=>e.jsx("span",{className:`text-[10px] font-mono uppercase tracking-[0.18em] text-gray-400 ${a}`,children:t}),Me=({src:t,className:a=""})=>e.jsx("div",{className:`rounded-md border border-gray-200 bg-white flex items-center justify-center p-1 flex-shrink-0 ${a}`,children:e.jsx("img",{src:t||f0,alt:"",className:"max-w-full max-h-full object-contain"})}),Rt=()=>e.jsx("span",{className:"inline-flex items-center justify-center w-4 h-4 rounded-full bg-[#0073FF] flex-shrink-0",children:e.jsx(gt,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),Dt=({label:t,you:a,them:s,max:r=100,higherBetter:n=!0,colorOf:i,format:l=o=>o??"â"})=>{const o=O0(a,s,n,r),c=Ke(a,n,r),u=Ke(s,n,r),h=c==null?0:c/r*100,m=u==null?0:u/r*100,f=o==="you",y=o==="them",v=a==null?"#e5e7eb":i(a),g=s==null?"#e5e7eb":i(s),j=y?.35:1,p=f?.35:1;return e.jsxs("div",{className:"py-2.5",children:[e.jsx(ps,{className:"block text-center truncate mb-1.5",children:t}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:`flex items-center justify-end gap-1 w-14 flex-shrink-0 text-sm tabular-nums ${f?"font-bold text-[#1A1A1A]":"text-gray-400"}`,children:[f&&e.jsx(Rt,{}),l(a)]}),e.jsxs("div",{className:"flex-1 relative flex items-center h-2.5",children:[e.jsx("div",{className:"flex-1 flex justify-end",children:e.jsx("div",{className:"h-2.5 rounded-l-full transition-all duration-500",style:{width:`${Math.max(0,Math.min(100,h))}%`,backgroundColor:v,opacity:j}})}),e.jsx("div",{className:"flex-1 flex justify-start",children:e.jsx("div",{className:"h-2.5 rounded-r-full transition-all duration-500",style:{width:`${Math.max(0,Math.min(100,m))}%`,backgroundColor:g,opacity:p}})}),e.jsx("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-2.5 h-2.5 rounded-full bg-white border border-gray-300 shadow-sm"})]}),e.jsxs("span",{className:`flex items-center gap-1 w-14 flex-shrink-0 text-sm tabular-nums ${y?"font-bold text-[#1A1A1A]":"text-gray-400"}`,children:[l(s),y&&e.jsx(Rt,{})]})]})]})},fs=({children:t})=>e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:"w-7 h-7 rounded-lg bg-[#EAF2FF] flex items-center justify-center flex-shrink-0",children:e.jsx("img",{src:M2,alt:"",className:"w-4 h-4"})}),e.jsx("span",{className:"text-mdd font-semibold text-[#1A1A1A]",children:t})]}),$t=({title:t,current:a,opponent:s})=>e.jsxs(e.Fragment,{children:[e.jsx(fs,{children:t}),e.jsx("div",{className:"-mx-6 mt-4 mb-4 border-t border-gray-200"}),e.jsx("div",{className:"flex items-center justify-between gap-3",children:[a,s].map(r=>e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(Me,{src:r.logo,className:"w-6 h-6"}),e.jsx("span",{className:"text-smd font-bold text-[#1A1A1A] truncate",children:r.name||"Untitled"})]},r.id))})]}),gs=({row:t,onSelect:a})=>e.jsxs("button",{onClick:()=>a(t.id),className:"group text-left border border-gray-200 rounded-xl bg-white p-4 hover:border-[#0073FF] hover:shadow-[0_4px_18px_0_rgba(13,113,239,0.14)] transition-all cursor-pointer flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx(Me,{src:t.logo,className:"w-10 h-10"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-900 truncate",children:t.name||"Untitled"}),t.agreement&&e.jsx("div",{className:"text-xs text-gray-500 truncate",children:t.agreement})]}),e.jsx(Ta,{className:"w-6 h-5 text-gray-300 group-hover:text-[#0073FF] group-hover:translate-x-0.5 transition-all flex-shrink-0"})]}),e.jsx("div",{className:"-mx-4 my-3 border-t border-gray-200"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[e.jsx("img",{src:T0,alt:"",className:"w-4 h-4 flex-shrink-0"}),e.jsx("span",{className:"text-sm font-semibold text-[#1A1A1A]",children:"Favorability"})]}),e.jsx(Qe,{ratingPercentile:t.ratingPercentile,size:"sm"})]}),e.jsx("div",{className:"mt-3 text-[11px] font-mono uppercase tracking-[0.18em] text-gray-500 group-hover:text-[#0073FF] transition-colors",children:"Compare head-to-head"})]}),Vt=({children:t})=>e.jsx("div",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-gray-400 mb-3",children:t}),Gt=({count:t,label:a,tone:s})=>e.jsxs("div",{className:"inline-flex items-center gap-2 pl-1.5 pr-3 py-0.5 rounded-full border border-gray-200 bg-white",children:[e.jsx("span",{className:`inline-flex items-center justify-center min-w-[26px] h-[26px] px-2 rounded-full text-xs font-bold tabular-nums ${s==="vendor"?"bg-rose-50 text-rose-500":"bg-emerald-50 text-emerald-600"}`,children:t}),e.jsx("span",{className:"text-sm text-gray-500",children:a})]}),vs=({current:t,opponent:a,signalsLoading:s,topics:r,topicsLoading:n,onBack:i})=>{const l=Lt(t.ratingPercentile,a.ratingPercentile),o=5,[c,u]=x.useState(0);x.useEffect(()=>u(0),[a.id]);const h=r||[],m=Math.ceil(h.length/o),f=c*o,y=h.slice(f,f+o),v=x.useMemo(()=>{const p={you:0,them:0,tie:0},C=F=>{F==="you"?p.you+=1:F==="them"?p.them+=1:F==="tie"&&(p.tie+=1)};return C(Lt(t.ratingPercentile,a.ratingPercentile)),st.forEach(F=>C(O0(F.get(t),F.get(a),F.higherBetter))),p},[t,a]),g=v.you>v.them?{text:`Your contract leads ${v.you}â${v.them}`,color:"text-[#0073FF]"}:v.them>v.you?{text:`${a.name||"Comparable"} leads ${v.them}â${v.you}`,color:"text-gray-700"}:{text:`Evenly matched ${v.you}â${v.them}`,color:"text-gray-500"},j=({row:p,align:C})=>{const F=C==="right";return e.jsxs("div",{className:`flex items-center gap-3 min-w-0 ${F?"flex-row-reverse":""}`,children:[e.jsx(Me,{src:p.logo,className:"w-12 h-12"}),e.jsxs("div",{className:`min-w-0 flex flex-col ${F?"items-end text-right":"items-start"}`,children:[e.jsx("span",{className:"px-2.5 py-0.5 rounded-full border border-gray-200 text-xsm font-semibold text-gray-400",children:p.isCurrent?"Your Contract":"Comparable"}),e.jsx("div",{className:"mt-1 text-mdd font-bold text-[#1A1A1A] truncate max-w-full",children:p.name||"Untitled"}),p.agreement&&e.jsx("div",{className:"text-sm text-gray-500 truncate max-w-full",children:p.agreement})]})]})};return e.jsxs(Ye.div,{initial:{opacity:0,y:8}
37,animate:{opacity:1,y:0},transition:{duration:.25,ease:"easeOut"},className:"h-full flex flex-col overflow-hidden px-6 py-8",children:[e.jsxs("button",{onClick:i,className:"self-start inline-flex items-center gap-1.5 px-4 py-2 rounded-full border border-gray-200 bg-white text-sm font-medium text-gray-400 hover:text-[#0073FF] hover:border-[#0073FF]/40 transition-colors cursor-pointer mb-4",children:[e.jsx(Pa,{className:"w-3.5 h-3.5"})," All Contracts"]}),e.jsxs("div",{className:"grid grid-rows-1 grid-cols-12 gap-3 flex-1 min-h-0",children:[e.jsxs("div",{className:"col-span-12 lg:col-span-5 flex flex-col gap-3 min-h-0 overflow-y-auto custom-scrollbar px-2",children:[e.jsxs("div",{className:"border border-gray-200 rounded-2xl bg-white p-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(j,{row:t,align:"left"})}),e.jsx("div",{className:"flex-shrink-0 w-11 h-11 rounded-full bg-[#EAF2FF] flex items-center justify-center",children:e.jsx("span",{className:"text-smd font-bold italic text-[#0073FF]",children:"VS"})}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(j,{row:a,align:"right"})})]}),e.jsxs("div",{className:"-mx-6 px-6 mt-4 pt-3 border-t border-gray-200 flex items-center justify-center gap-2",children:[e.jsx("span",{className:`text-sm font-semibold ${g.color}`,children:g.text}),v.tie>0&&e.jsxs("span",{className:"text-[11px] text-gray-400",children:["· ",v.tie," even"]})]})]}),e.jsxs("div",{className:"border border-gray-200 rounded-2xl bg-white p-6",children:[e.jsx(Vt,{children:"Favorability"}),e.jsx("div",{className:"-mx-6 border-t border-gray-200"}),e.jsx("div",{className:"grid grid-cols-2 -mb-6",children:[{row:t,won:l==="you"},{row:a,won:l==="them"}].map(({row:p,won:C},F)=>e.jsxs("div",{className:`pt-6 pb-6 ${F===1?"pl-6 border-l border-gray-200":"pr-6"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3 min-w-0",children:[e.jsx(Me,{src:p.logo,className:"w-7 h-7"}),e.jsx("span",{className:"text-smdd font-bold text-[#1A1A1A] truncate",children:p.name||"Untitled"}),C&&e.jsx("span",{className:"flex-shrink-0 w-4 h-4 rounded-full bg-[#0073FF] flex items-center justify-center",children:e.jsx(gt,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})})]}),e.jsx(Qe,{ratingPercentile:p.ratingPercentile,size:"sm"})]},p.id))})]}),e.jsxs("div",{className:"border border-gray-200 rounded-2xl bg-white p-6",children:[e.jsx(Vt,{children:"Rare Clauses"}),e.jsx("div",{className:"-mx-6 border-t border-gray-200"}),s?e.jsx("div",{className:"h-5 w-40 bg-gray-100 rounded animate-pulse mt-6"}):e.jsx("div",{className:"grid grid-cols-2 -mb-6",children:[t,a].map((p,C)=>e.jsxs("div",{className:`pt-6 pb-6 ${C===1?"pl-6 border-l border-gray-200":"pr-6"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4 min-w-0",children:[e.jsx(Me,{src:p.logo,className:"w-7 h-7"}),e.jsx("span",{className:"text-smdd font-bold text-[#1A1A1A] truncate",children:p.name||"Untitled"})]}),p.vendor==null&&p.customer==null?e.jsx("span",{className:"text-xs text-gray-300 font-mono",children:"No rare-clause data"}):e.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[e.jsx(Gt,{count:p.vendor??0,label:"Vendor",tone:"vendor"}),e.jsx(Gt,{count:p.customer??0,label:"Customer",tone:"customer"})]})]},p.id))})]})]}),e.jsxs("div",{className:"col-span-12 lg:col-span-7 flex flex-col gap-3 min-h-0 overflow-y-auto custom-scrollbar px-2",children:[e.jsxs("div",{className:"border border-gray-200 rounded-2xl bg-white p-6",children:[e.jsx($t,{title:"Signal-By-Signal Comparison",current:t,opponent:a}),s?e.jsx("div",{className:"space-y-5 py-3 animate-pulse",children:st.map(p=>e.jsxs("div",{children:[e.jsx("div",{className:"h-2.5 w-28 bg-gray-100 rounded mx-auto mb-2"}),e.jsx("div",{className:"h-2.5 bg-gray-100 rounded-full"})]},p.key))}):e.jsx("div",{className:"divide-y divide-gray-50",children:st.map(p=>e.jsx(Dt,{label:p.label,you:p.get(t),them:p.get(a),higherBetter:p.higherBetter,colorOf:C=>xt(p.signalKey,C)},p.key))})]}),e.jsxs("div",{className:"border border-gray-200 rounded-2xl bg-white p-6",children:[e.jsx($t,{title:"Topic-By-Topic Favorability",current:t,opponent:a}),n?e.jsx("div",{className:"space-y-5 py-3 animate-pulse",children:Array.from({length:5}).map((p,C)=>e.jsxs("div",{children:[e.jsx("div",{className:"h-2.5 w-28 bg-gray-100 rounded mx-auto mb-2"}),e.jsx("div",{className:"h-2.5 bg-gray-100 rounded-full"})]},C))}):h.length===0?e.jsx("div",{className:"py-6 text-center text-[11px] font-mono uppercase tracking-[0.18em] text-gray-300",children:"No topic data"}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"divide-y divide-gray-50",children:y.map((p,C)=>e.jsx(Dt,{label:p.topic,you:Tt(p.rating_a),them:Tt(p.rating_b),max:10,higherBetter:!0,colorOf:ms,format:hs},`${p.topic}-${f+C}`))}),m>1&&e.jsxs("div",{className:"-mx-6 px-6 flex items-center justify-center gap-4 pt-2 mt-1 border-t border-gray-200",children:[e.jsx("button",{onClick:()=>u(p=>Math.max(0,p-1)),disabled:c===0,className:"w-7 h-7 rounded-full border border-gray-200 flex items-center justify-center text-gray-500 hover:text-[#0073FF] hover:border-[#0073FF]/40 transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed","aria-label":"Previous topics",children:e.jsx(I0,{className:"w-4 h-4"})}),e.jsxs("span",{className:"text-[10px] font-mono uppercase tracking-[0.18em] text-gray-400 tabular-nums",children:[f+1,"â",Math.min(f+o,h.length)," of ",h.length]}),e.jsx("button",{onClick:()=>u(p=>Math.min(m-1,p+1)),disabled:c>=m-1,className:"w-7 h-7 rounded-full border border-gray-200 flex items-center justify-center text-gray-500 hover:text-[#0073FF] hover:border-[#0073FF]/40 transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed","aria-label":"More topics",children:e.jsx(M0,{className:"w-4 h-4"})})]})]})]})]})]})]})},bs=({current:t,opponents:a,loading:s,onSelect:r})=>e.jsxs(Ye.div,{initial:{opacity:0}
37,animate:{opacity:1},transition:{duration:.2},className:"h-full overflow-y-auto no-scrollbar px-6 py-8",children:[e.jsxs("div",{className:"mb-6",children:[e.jsxs("h2",{className:"text-xl font-bold text-[#1A1A1A] inline-flex items-center gap-2",children:[e.jsx("img",{src:us,alt:"",className:"w-7 h-9 flex-shrink-0"}),"Benchmark ",t?.name||"this contract"]}),e.jsx("p",{className:"text-sm text-gray-700",children:"Pick a comparable contract to see a side-by-side, signal-by-signal breakdown."})]}),a.length===0?e.jsx("div",{className:"py-16 text-center text-[11px] font-mono uppercase tracking-[0.18em] text-gray-300",children:s?"Loading comparable contractsâ¦":"No comparable contracts found"}):e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:a.map(n=>e.jsx(gs,{row:n,onSelect:r},n.id))}),s&&a.length>0&&e.jsx("div",{className:"mt-4 text-[10px] font-mono uppercase tracking-[0.18em] text-gray-400",children:"Refreshing â¦"})]}),ys=()=>{const{contractId:t}=Ae(),a=Se(),{documentOverviewResult:s}=T(g=>g.upload),{ComparableContractsTable:r}=T(g=>g.contractReview),n=T(g=>g.auth.user?.tokens?.jwt),i=T(g=>g.contracts.comparableMarketDeviations.byContractId),l=T(g=>g.contractReview.status?.isLoading),[o,c]=x.useState(null);x.useEffect(()=>{!s?.template_id||!t||a(c2({template_id:s.template_id,category_id:s.primary_category_id,contractId:t}))},[s?.template_id,s?.primary_category_id,t,a]);const u=T(d2(t,o));x.useEffect(()=>{!n||!o||([t,o].forEach(g=>{!g||i[g]?.data||i[g]?.loading||a(u2({contractId:g,limit:30,authToken:n}))}),!u.data&&!u.loading&&a(x2({contractId:t,to:o,authToken:n})))},[t,o,n,a]);const h=x.useMemo(()=>{const g=[],j=p=>({acceptability:xs(p),acceleration:at(p?.acceleration_signal?.overall_acceleration_score),escalation:at(p?.escalation_signal?.overall_escalation_score),friction:at(p?.friction_signal?.overall_friction_score)});if(s){const p=i[t]?.data;g.push({id:t,isCurrent:!0,logo:s.logo_url,name:s.product_suite_name,agreement:s.primary_agreement,ratingPercentile:s.rating_percentile,vendor:p?.party_a?.length,customer:p?.party_b?.length,...j(p)})}return(r||[]).forEach(p=>{if(!p?.contract_id||p.contract_id===t)return;const C=i[p.contract_id]?.data;g.push({id:p.contract_id,isCurrent:!1,logo:p.logo||p.logo_url,name:p.product_suite_name||p.company_name,agreement:p.primary_agreement,ratingPercentile:p.rating_percentile,vendor:C?.party_a?.length,customer:C?.party_b?.length,...j(C)})}),g},[s,r,i,t]),m=h.find(g=>g.isCurrent),f=h.filter(g=>!g.isCurrent),y=h.find(g=>g.id===o&&!g.isCurrent),v=!!y&&(!i[t]?.data||!i[y.id]?.data);return e.jsx("div",{className:"h-full overflow-hidden bg-[#F9F9FB]",children:e.jsx(v0,{mode:"wait",children:y&&m?e.jsx(vs,{current:m,opponent:y,signalsLoading:v,topics:u.data?.topics,topicsLoading:!u.data&&!u.error,onBack:()=>c(null)},"matchup"):e.jsx(bs,{current:m,opponents:f,loading:l,onSelect:c},"gallery")})})},js=t=>t==null?null:t*100,Cs={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" "},$e=t=>typeof t!="string"?t??"":t.replace(/&#x([0-9a-fA-F]+);/g,(a,s)=>String.fromCharCode(parseInt(s,16))).replace(/&#(\d+);/g,(a,s)=>String.fromCharCode(parseInt(s,10))).replace(/&(amp|lt|gt|quot|apos|nbsp);/g,(a,s)=>Cs[s]??""),ws=({percent:t})=>{const s="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831",r=t/100*2*Math.PI,n=18+15.9155*Math.sin(r),i=18-15.9155*Math.cos(r);return e.jsxs("svg",{viewBox:"0 0 36 36",className:"w-9 h-9 flex-shrink-0",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"adoptionRing",x1:"0",y1:"1",x2:"1",y2:"0",children:[e.jsx("stop",{offset:"0",stopColor:"#7CB2FF"}),e.jsx("stop",{offset:"1",stopColor:"#0173FF"})]})}),e.jsx("path",{d:s,fill:"none",stroke:"#E6EEF8",strokeWidth:"3.2"}),e.jsx("path",{d:s,fill:"none",stroke:"url(#adoptionRing)",strokeWidth:"3.2",strokeLinecap:"round",strokeDasharray:`${t}, 100`}),e.jsx("circle",{cx:n,cy:i,r:"1.4",fill:"#fff",stroke:"#0173FF",strokeWidth:"0.8"}),e.jsxs("text",{x:"18",y:"18",textAnchor:"middle",dominantBaseline:"central",fontSize:"8",fontWeight:"700",fill:"#0173FF",children:[t,"%"]})]})},_s=({row:t,isDealBreaker:a=!1})=>{const s=t.current||{},r=t.recommendation||{},n=r.market_share!=null?Math.round(js(r.market_share)):null,i=t.recommendation!=null,l=a&&!i,o=!!(r.display&&String(r.display).trim()),c=n!=null;return e.jsxs("div",{className:"border border-gray-200 rounded-2xl flex flex-col bg-white shadow-sm",children:[e.jsx("div",{className:"border-b border-gray-100 px-4 py-2",children:e.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-[0.18em] text-gray-400 truncate",children:$e(t.topic)})}),e.jsxs("div",{className:`px-4 py-2 space-y-1.5 ${c?"border-b border-gray-100":""}`,children:[l?e.jsx("p",{className:"text-[10px] text-gray-700 leading-snug min-w-0",children:$e(t.question)}):e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-[9px] uppercase tracking-[0.14em] text-gray-400 w-14 flex-shrink-0",children:"Currently"}),e.jsx("div",{className:"self-stretch w-px bg-gray-200 flex-shrink-0"}),e.jsxs("p",{className:"text-[10px] text-gray-600 leading-snug min-w-0",children:["â",$e(s.display),"â"]}
37)]}),o&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-[9px] uppercase tracking-[0.14em] text-gray-400 w-14 flex-shrink-0",children:"Ask for"}),e.jsx("div",{className:"self-stretch w-px bg-gray-200 flex-shrink-0"}),e.jsxs("p",{className:"text-[10px] text-gray-800 font-medium leading-snug min-w-0",children:["â",$e(r.display),"â"]})]})]}),c&&e.jsxs("div",{className:"px-4 py-2 flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[11px] font-bold text-gray-900",children:"Market Adoption"}),e.jsxs("p",{className:"text-[10px] text-gray-500 leading-snug mt-1",children:["Out of all the public contracts,"," ",e.jsxs("span",{className:"font-bold text-gray-700",children:[n,"%"]})," have this clause in their contract."]})]}),e.jsx(ws,{percent:n})]})]})},Ns="data:image/svg+xml,%3csvg%20width='26'%20height='26'%20viewBox='0%200%2026%2026'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_3929_212)'%3e%3cpath%20d='M17.6317%207.05522L14.2549%2010.145C13.7033%209.78243%2013.0466%209.61411%2012.3886%209.66669C11.7306%209.71927%2011.1089%209.98976%2010.6219%2010.4354C10.1349%2010.8809%209.81043%2011.4762%209.69975%2012.127C9.58908%2012.7777%209.69855%2013.4468%2010.0109%2014.0283L6.63399%2017.1181L7.64028%2018.2179L11.0171%2015.1281C11.5687%2015.4907%2012.2255%2015.659%2012.8834%2015.6064C13.5414%2015.5538%2014.1631%2015.2834%2014.6501%2014.8378C15.1371%2014.3922%2015.4616%2013.7969%2015.5723%2013.1462C15.6829%2012.4954%2015.5735%2011.8263%2015.2612%2011.2448L18.638%208.155L17.6317%207.05522Z'%20fill='%230373FC'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_3929_212'%3e%3crect%20width='17.8881'%20height='17.8881'%20fill='white'%20transform='translate(0%2012.0757)%20rotate(-42.4583)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",ks="data:image/svg+xml,%3csvg%20width='15'%20height='15'%20viewBox='0%200%2015%2015'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_3929_214)'%3e%3cpath%20d='M7.5%2013.125C10.6066%2013.125%2013.125%2010.6066%2013.125%207.5C13.125%204.3934%2010.6066%201.875%207.5%201.875C4.3934%201.875%201.875%204.3934%201.875%207.5C1.875%2010.6066%204.3934%2013.125%207.5%2013.125Z'%20stroke='%230373FC'%20stroke-width='2'/%3e%3cpath%20d='M11.25%2011.25L3.75%203.75'%20stroke='%230373FC'%20stroke-width='2'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_3929_214'%3e%3crect%20width='15'%20height='15'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",Fs="data:image/svg+xml,%3csvg%20width='14'%20height='14'%20viewBox='0%200%2014%2014'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M6.99935%201.1665C10.2211%201.1665%2012.8327%203.77809%2012.8327%206.99984C12.8327%2010.2216%2010.2211%2012.8332%206.99935%2012.8332C3.7776%2012.8332%201.16602%2010.2216%201.16602%206.99984C1.16602%203.77809%203.7776%201.1665%206.99935%201.1665ZM6.99935%203.49984C6.84464%203.49984%206.69627%203.5613%206.58687%203.67069C6.47747%203.78009%206.41602%203.92846%206.41602%204.08317V6.99984C6.41605%207.15453%206.47753%207.30288%206.58693%207.41225L8.33693%209.16225C8.44695%209.26851%208.5943%209.32731%208.74725%209.32598C8.9002%209.32465%209.04651%209.2633%209.15466%209.15515C9.26282%209.04699%209.32416%208.90069%209.32549%208.74774C9.32682%208.59479%209.26802%208.44744%209.16177%208.33742L7.58268%206.75834V4.08317C7.58268%203.92846%207.52122%203.78009%207.41183%203.67069C7.30243%203.5613%207.15406%203.49984%206.99935%203.49984Z'%20fill='%230373FC'/%3e%3c/svg%3e",As="data:image/svg+xml,%3csvg%20width='13'%20height='13'%20viewBox='0%200%2013%2013'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M6.50065%201.
370835C3.50903%201.0835%201.08398%203.50854%201.08398%206.50016C1.08398%209.49179%203.50903%2011.9168%206.50065%2011.9168C9.49228%2011.9168%2011.9173%209.49179%2011.9173%206.50016C11.9173%203.50854%209.49228%201.0835%206.50065%201.0835ZM7.04232%209.2085H5.95898V8.12516H7.04232V9.2085ZM7.04232%207.04183H5.95898L5.68815%203.79183H7.31315L7.04232%207.04183Z'%20fill='%230373FC'/%3e%3c/svg%3e",Ss="data:image/svg+xml,%3csvg%20width='15'%20height='12'%20viewBox='0%200%2015%2012'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20filter='url(%23filter0_d_3929_243)'%3e%3cpath%20d='M3.5625%200C3.01549%200%202.49089%200.217298%202.10409%200.604092C1.7173%200.990886%201.5%201.51549%201.5%202.0625V3H13.5V2.0625C13.5%201.51549%2013.2827%200.990886%2012.8959%200.604092C12.5091%200.217298%2011.9845%200%2011.4375%200H3.5625ZM13.5%203.75H1.5V6.9375C1.5%207.48451%201.7173%208.00911%202.10409%208.39591C2.49089%208.7827%203.01549%209%203.5625%209H11.4375C11.9845%209%2012.5091%208.7827%2012.8959%208.39591C13.2827%208.00911%2013.5%207.48451%2013.5%206.9375V3.75ZM10.125%206.75H11.625C11.7245%206.75%2011.8198%206.78951%2011.8902%206.85983C11.9605%206.93016%2012%207.02554%2012%207.125C12%207.22446%2011.9605%207.31984%2011.8902%207.39017C11.8198%207.46049%2011.7245%207.5%2011.625%207.5H10.125C10.0255%207.5%209.93016%207.46049%209.85983%207.39017C9.78951%207.31984%209.75%207.22446%209.75%207.125C9.75%207.02554%209.78951%206.93016%209.85983%206.85983C9.93016%206.78951%2010.0255%206.75%2010.125%206.75Z'%20fill='%230373FC'/%3e%3c/g%3e%3cdefs%3e%3cfilter%20id='filter0_d_3929_243'%20x='-2.5'%20y='0'%20width='20'%20height='17'%20filterUnits='userSpaceOnUse'%20color-interpolation-filters='sRGB'%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'/%3e%3cfeColorMatrix%20in='SourceAlpha'%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%20127%200'%20result='hardAlpha'/%3e%3cfeOffset%20dy='4'/%3e%3cfeGaussianBlur%20stdDeviation='2'/%3e%3cfeComposite%20in2='hardAlpha'%20operator='out'/%3e%3cfeColorMatrix%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200.25%200'/%3e%3cfeBlend%20mode='normal'%20in2='BackgroundImageFix'%20result='effect1_dropShadow_3929_243'/%3e%3cfeBlend%20mode='normal'%20in='SourceGraphic'%20in2='effect1_dropShadow_3929_243'%20result='shape'/%3e%3c/filter%3e%3c/defs%3e%3c/svg%3e",Es="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M4.66602%2010H5.99935C5.99935%2010.72%206.91268%2011.3333%207.99935%2011.3333C9.08602%2011.3333%209.99935%2010.72%209.99935%2010C9.99935%209.26667%209.30602%209%207.83935%208.64667C6.42602%208.29333%204.66602%207.85333%204.66602%206C4.66602%204.80667%205.64602%203.79333%206.99935%203.45333V2H8.99935V3.45333C10.3527%203.79333%2011.3327%204.80667%2011.3327%206H9.99935C9.99935%205.28%209.08602%204.66667%207.99935%204.66667C6.91268%204.66667%205.99935%205.28%205.99935%206C5.99935%206.73333%206.69268%207%208.15935%207.35333C9.57268%207.70667%2011.3327%208.14667%2011.3327%2010C11.3327%2011.1933%2010.3527%2012.2067%208.99935%2012.5467V14H6.99935V12.5467C5.64602%2012.2067%204.66602%2011.1933%204.66602%2010Z'%20fill='%230373FC'/%3e%3c/svg%3e",Bs="data:image/svg+xml,%3csvg%20width='14'%20height='14'%20viewBox='0%200%2014%2014'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M8.74935%202.33398H2.91602V10.5007C2.91602%2010.8101%203.03893%2011.1068%203.25772%2011.3256C3.47652%2011.5444%203.77326%2011.6673%204.08268%2011.6673H8.74935M9.33268%205.25065L11.0827%207.00065L9.33268%208.75065M11.0827%207.00065H5.24935'%20stroke='%230373FC'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",Is="data:image/svg+xml,%3csvg%20width='15'%20height='15'%20viewBox='0%200%2015%2015'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M7.5%202.5C8.16304%202.5%208.79893%202.76339%209.26777%203.23223C9.73661%203.70107%2010%204.33696%2010%205C10%205.66304%209.73661%206.29893%209.26777%206.76777C8.79893%207.23661%208.16304%207.5%207.5%207.5C6.83696%207.5%206.20107%207.23661%205.73223%206.76777C5.26339%206.29893%205%205.66304%205%205C5%204.33696%205.26339%203.70107%205.73223%203.23223C6.20107%202.76339%206.83696%202.5%207.5%202.5ZM7.5%208.75C10.2625%208.75%2012.5%209.86875%2012.5%2011.25V12.5H2.5V11.25C2.5%209.86875%204.7375%208.75%207.5%208.75Z'%20fill='%230373FC'/%3e%3c/svg%3e",Ut="/assets/vendor-liability-ceiling-DteD1c6N.svg",Ve="data:image/svg+xml,%3csvg%20width='11'%20height='11'%20viewBox='0%200%2011%2011'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M4.08333%200H0.583333C0.428624%200%200.280251%200.
370614581%200.170854%200.170854C0.0614581%200.280251%200%200.428624%200%200.583333V4.08333C0%204.23804%200.0614581%204.38642%200.170854%204.49581C0.280251%204.60521%200.428624%204.66667%200.583333%204.66667H4.08333C4.23804%204.66667%204.38642%204.60521%204.49581%204.49581C4.60521%204.38642%204.66667%204.23804%204.66667%204.08333V0.583333C4.66667%200.428624%204.60521%200.280251%204.49581%200.170854C4.38642%200.0614581%204.23804%200%204.08333%200ZM9.91667%205.83333H6.41667C6.26196%205.83333%206.11358%205.89479%206.00419%206.00419C5.89479%206.11358%205.83333%206.26196%205.83333%206.41667V9.91667C5.83333%2010.0714%205.89479%2010.2197%206.00419%2010.3291C6.11358%2010.4385%206.26196%2010.5%206.41667%2010.5H9.91667C10.0714%2010.5%2010.2197%2010.4385%2010.3291%2010.3291C10.4385%2010.2197%2010.5%2010.0714%2010.5%209.91667V6.41667C10.5%206.26196%2010.4385%206.11358%2010.3291%206.00419C10.2197%205.89479%2010.0714%205.83333%209.91667%205.83333ZM8.16667%200C6.87983%200%205.83333%201.0465%205.83333%202.33333C5.83333%203.62017%206.87983%204.66667%208.16667%204.66667C9.4535%204.66667%2010.5%203.62017%2010.5%202.33333C10.5%201.0465%209.4535%200%208.16667%200ZM2.33333%205.83333C1.0465%205.83333%200%206.87983%200%208.16667C0%209.4535%201.0465%2010.5%202.33333%2010.5C3.62017%2010.5%204.66667%209.4535%204.66667%208.16667C4.66667%206.87983%203.62017%205.83333%202.33333%205.83333Z'%20fill='%230373FC'/%3e%3c/svg%3e",Ht="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M13.066%206.3297C13.2957%206.99744%2013.3906%207.70415%2013.345%208.40883C13.2995%209.11351%2013.1144%209.80213%2012.8006%2010.4347C12.4869%2011.0673%2012.0506%2011.6313%2011.5171%2012.094C10.9836%2012.5566%2010.3636%2012.9087%209.69293%2013.1299C9.0223%2013.351%208.31443%2013.4368%207.61039%2013.3821C6.90636%2013.3275%206.22017%2013.1337%205.59165%2012.8118C4.96314%2012.4899%204.4048%2012.0464%203.94904%2011.507C3.49328%2010.9676%203.14916%2010.3431%202.93667%209.6697C2.51459%208.3321%202.63643%206.88206%203.27579%205.63365C3.91516%204.38523%205.02058%203.43893%206.35266%202.9997C7.68473%202.56047%209.13621%202.66366%2010.3927%203.28694C11.6493%203.91021%2012.6097%205.00338%2013.066%206.3297ZM11.99%208.29637C12.029%207.77239%2011.9643%207.24588%2011.7998%206.74688C11.6353%206.24788%2011.3741%205.78618%2011.0311%205.38812C10.6882%204.99007%2010.2702%204.66346%209.80099%204.42695C9.33181%204.19044%208.82064%204.04866%208.29667%204.0097C7.77269%203.97074%207.24618%204.03537%206.74718%204.19989C6.24818%204.36442%205.78647%204.62561%205.38842%204.96857C4.99037%205.31153%204.66376%205.72953%204.42725%206.19871C4.19074%206.66789%204.04896%207.17906%204.01%207.70304C3.93132%208.76125%204.27623%209.80738%204.96887%2010.6113C5.6615%2011.4152%206.64512%2011.911%207.70333%2011.9897C8.76155%2012.0684%209.80768%2011.7235%2010.6116%2011.0308C11.4155%2010.3382%2011.9113%209.35458%2011.99%208.29637Z'%20fill='%230373FC'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M8.00065%209.33301C8.35427%209.33301%208.69341%209.19253%208.94346%208.94248C9.19351%208.69243%209.33398%208.3533%209.33398%207.99967C9.33398%207.64605%209.19351%207.30691%208.94346%207.05687C8.69341%206.80682%208.35427%206.66634%208.00065%206.66634C7.64703%206.66634%207.30789%206.80682%207.05784%207.05687C6.80779%207.30691%206.66732%207.64605%206.66732%207.99967C6.66732%208.3533%206.80779%208.69243%207.05784%208.94248C7.30789%209.19253%207.64703%209.33301%208.00065%209.33301ZM8.00065%2010.6663C8.70789%2010.6663%209.38617%2010.3854%209.88627%209.88529C10.3864%209.38519%2010.6673%208.70692%2010.6673%207.99967C10.6673%207.29243%2010.3864%206.61415%209.88627%206.11406C9.38617%205.61396%208.70789%205.33301%208.00065%205.33301C7.29341%205.33301%206.61513%205.61396%206.11503%206.11406C5.61494%206.61415%205.33398%207.29243%205.33398%207.99967C5.33398%208.70692%205.61494%209.38519%206.11503%209.88529C6.61513%2010.3854%207.29341%2010.6663%208.00065%2010.6663ZM8.00065%201.33301C8.17746%201.33301%208.34703%201.40325%208.47205%201.52827C8.59708%201.65329%208.66732%201.82286%208.66732%201.99967V3.33301C8.66732%203.50982%208.59708%203.67939%208.47205%203.80441C8.34703%203.92944%208.17746%203.99967%208.00065%203.99967C7.82384%203.99967%207.65427%203.92944%207.52925%203.80441C7.40422%203.67939%207.33398%203.50982%207.33398%203.33301V1.99967C7.33398%201.82286%207.40422%201.65329%207.52925%201.52827C7.65427%201.40325%207.82384%201.33301%208.00065%201.33301ZM8.00065%2011.9997C8.17746%2011.9997%208.34703%2012.0699%208.47205%2012.1949C8.59708%2012.32%208.66732%2012.4895%208.66732%2012.6663V13.9997C8.66732%2014.1765%208.59708%2014.3461%208.47205%2014.4711C8.34703%2014.5961%208.17746%2014.6663%208.00065%2014.6663C7.82384%2014.6663%207.65427%2014.5961%207.52925%2014.4711C7.40422%2014.3461%207.33398%2014.1765%207.33398%2013.9997V12.6663C7.33398%2012.4895%207.40422%2012.32%207.52925%2012.1949C7.65427%2012.0699%207.82384%2011.9997%208.00065%2011.9997ZM14.6673%207.99967C14.6673%208.17649%2014.5971%208.34605%2014.4721%208.47108C14.347%208.5961%2014.1775%208.66634%2014.0007%208.66634H12.6673C12.4905%208.66634%2012.3209%208.5961%2012.1959%208.47108C12.0709%208.34605%2012.0007%208.17649%2012.0007%207.99967C12.0007%207.82286%2012.0709%207.65329%2012.1959%207.52827C12.3209%207.40325%2012.4905%207.33301%2012.6673%207.33301H14.0007C14.1775%207.33301%2014.347%207.40325%2014.4721%207.52827C14.5971%207.65329%2014.6673%207.82286%2014.6673%207.99967ZM4.00065%207.99967C4.00065%208.17649%203.93041%208.34605%203.80539%208.47108C3.68036%208.5961%203.5108%208.66634%203.33398%2
3708.66634H2.00065C1.82384%208.66634%201.65427%208.5961%201.52925%208.47108C1.40422%208.34605%201.33398%208.17649%201.33398%207.99967C1.33398%207.82286%201.40422%207.65329%201.52925%207.52827C1.65427%207.40325%201.82384%207.33301%202.00065%207.33301H3.33398C3.5108%207.33301%203.68036%207.40325%203.80539%207.52827C3.93041%207.65329%204.00065%207.82286%204.00065%207.99967Z'%20fill='%230373FC'/%3e%3c/svg%3e",Te=t=>{if(t==null)return null;const a=typeof t=="number"?t:parseFloat(t);return Number.isFinite(a)?a:null},Zt=t=>{const a=Te(t);return a==null?"â":Number.isInteger(a)?`${a}%`:`${a.toFixed(1)}%`},L0={annual_upfront:"Annual, upfront",quarterly:"Quarterly",monthly:"Monthly",usage_based:"Usage-based"},Ms={fees_paid_total:{headline:"Total Fees Paid",desc:"Capped at the total fees paid under the agreement.",tone:"neutral"},mutual_fees_paid:{headline:"Total Fees Paid",desc:"Capped at the total fees paid under the agreement.",tone:"neutral",mutual:!0},fees_paid_x_months:{headline:"Months of Fees",desc:"Capped at a set number of months of fees paid.",tone:"neutral"},fixed_amount:{headline:"Fixed Amount",desc:"Capped at a fixed amount stated in the contract.",tone:"neutral"},mutual_fixed_amount:{headline:"Fixed Amount",desc:"Capped at a fixed amount stated in the contract.",tone:"neutral",mutual:!0},uncapped:{headline:"Uncapped",desc:"No ceiling on vendor liability â favorable to the buyer.",tone:"green"},disclaimed:{headline:"Disclaimed",desc:"Vendor accepts no liability for damages.",tone:"red"}},Ps={green:{Icon:Ne,color:"text-emerald-600"},red:{Icon:Je,color:"text-red-600"},neutral:{Icon:Ne,color:"text-gray-400"}},Ts={ip_indemnification:"IP infringement",customer_indemnification:"Customer's indemnification",vendor_indemnification:"Vendor's indemnification",fee_obligations:"Fee obligations",fraud:"Fraud",gross_negligence:"Gross negligence",wilful_misconduct:"Willful misconduct",confidentiality:"Confidentiality",data_breach:"Data breach",bodily_injury:"Bodily injury / property damage"},rt=new Set(["data_breach","ip_indemnification"]),Os={ip:"IP (general)",patent:"Patent",copyright:"Copyright",trademark:"Trademark",trade_secret:"Trade secret",data_breach:"Data breach",gross_negligence:"Gross negligence",wilful_misconduct:"Willful misconduct",bodily_injury:"Bodily injury",property_damage:"Property damage"},ee=({children:t})=>e.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-gray-400 pr-10",children:t}),zt=({children:t,sub:a})=>e.jsxs("div",{className:"pt-3 pb-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"h-px flex-1 bg-gray-300"}),e.jsx("span",{className:"text-sm font-semibold uppercase tracking-[0.18em] text-gray-500 whitespace-nowrap",children:t}),e.jsx("span",{className:"h-px flex-1 bg-gray-300"})]}),a&&e.jsx("div",{className:"text-[11px] text-gray-400 mt-0.5 text-center",children:a})]}),ge=({icon:t,className:a="",imgClassName:s="w-[12px] h-[12px]"})=>e.jsx("span",{className:`absolute top-3 right-3 inline-flex items-center justify-center w-6 h-6 rounded-full bg-[#E8F2FF] ${a}`,children:e.jsx("img",{src:t,alt:"",className:`${s} object-contain`})}),Y=({children:t,className:a="",icon:s})=>e.jsxs("div",{className:`relative border border-gray-100 rounded-2xl bg-white p-4 shadow-sm ${a}`,children:[s&&e.jsx(ge,{icon:s}),t]}),R0=({children:t,sizeClass:a="text-xs"})=>e.jsx("span",{className:`inline-flex items-center px-2.5 py-1 rounded-full border border-gray-200 text-gray-600 font-medium whitespace-nowrap ${a}`,children:t}
37),D0=({tone:t="neutral",children:a})=>{const s={neutral:"bg-gray-100 text-gray-700",green:"bg-emerald-50 text-emerald-700",amber:"bg-amber-50 text-amber-800",red:"bg-red-50 text-red-700",blue:"bg-blue-50 text-blue-700"};return e.jsx("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[11px] font-semibold ${s[t]}`,children:a})},$0=t=>{if(t==null)return null;if(t<12)return{value:String(t),unit:t===1?"Month":"Months"};const a=t/12;return Number.isInteger(a)?{value:String(a),unit:a===1?"Year":"Years"}:{value:a.toFixed(1),unit:"Years"}},Kt="border border-gray-100 rounded-2xl bg-white p-4 shadow-sm",Wt=({data:t,layout:a="stacked"})=>{const[s,r]=x.useState(!1);if(!t)return null;const{initial_term_months:n,payment_terms_days:i,payment_frequency:l,non_cancelable_payment_obligations:o}=t;if(n==null&&i==null&&l==null&&o==null)return null;const u=$0(n),h=l?L0[l]||l:null;if(a==="stacked"){const v=o!=null,g=o===!0;return e.jsx("div",{className:"border border-gray-100 rounded-2xl bg-white shadow-sm overflow-hidden",children:e.jsxs("div",{className:"flex items-stretch divide-x divide-gray-100",children:[e.jsxs("div",{className:"relative flex-1 px-6 py-5",children:[e.jsx(ge,{icon:Ns,imgClassName:"w-[14px] h-[18px]"}),e.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-gray-400",children:"Initial Term"}),e.jsx("div",{className:"mt-3",children:u?e.jsxs("span",{className:"inline-flex items-baseline gap-1.5 px-5 py-3 rounded-xl bg-[#E8F2FF]",children:[e.jsx("span",{className:"text-2xl font-semibold text-[#0173FF] leading-none",children:u.value}),e.jsx("span",{className:"text-2xl font-semibold text-[#0173FF] leading-none",children:u.unit})]}):e.jsx("span",{className:"inline-block w-28 h-2.5 rounded-full bg-gray-200"})}),e.jsx("p",{className:"text-[13px] text-gray-600 leading-relaxed mt-3",children:"How long the buyer is committed to this vendor."})]}),v&&e.jsxs("div",{className:"relative flex-1 px-6 py-5",children:[e.jsx(ge,{icon:ks,imgClassName:"w-[11px] h-[11px]"}),e.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-gray-400",children:"Cancellation"}),e.jsx("div",{className:`text-3xl font-semibold leading-tight mt-3 ${g?"text-[#1A1A1A]":"text-emerald-600"}`,children:g?"Non-cancelable":"Cancellable"}),e.jsx("p",{className:"text-[13px] text-gray-600 leading-relaxed mt-3",children:g?"Fees are committed for the full term.":"The buyer can cancel fees before the term ends."})]})]})})}const m=[];h&&m.push({label:"Billing",value:h}),i!=null&&m.push({label:"Payment window",value:`${i} days`});const f=m.length>0,y=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs font-semibold text-gray-900 leading-none uppercase tracking-wider",children:"Initial term"}),e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("span",{className:"text-4xl font-semibold text-[#1A1A1A] leading-none",children:u?u.value:"â"}),e.jsx("span",{className:"text-base font-semibold text-gray-600 leading-none",children:u?u.unit:""})]}),o!=null&&e.jsx("span",{className:"text-[10px] text-gray-400 leading-none",children:o?"Non-cancelable":"Cancellable"})]});return f?e.jsx("div",{className:"h-full [perspective:1200px]",onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:e.jsxs(Ye.div,{className:"relative h-full [transform-style:preserve-3d]",animate:{rotateY:s?180:0},transition:{duration:.6,ease:"easeInOut"},children:[e.jsxs("div",{className:`${Kt} absolute inset-0 flex flex-col items-center justify-center gap-3 [backface-visibility:hidden]`,children:[e.jsx(Ja,{className:"absolute top-3 right-3 w-3.5 h-3.5 text-gray-300"}),y]}),e.jsx("div",{className:`${Kt} absolute inset-0 flex flex-col items-center justify-center gap-2.5 [backface-visibility:hidden] [transform:rotateY(180deg)]`,children:m.map(v=>e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider text-gray-500",children:v.label}),e.jsx("div",{className:"text-[9px] font-normal text-gray-500 mt-0.5",children:v.value})]},v.label))})]})}):e.jsx(Y,{className:"h-full",children:e.jsx("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:y})})},we=({value:t})=>e.jsxs("span",{className:"font-semibold text-gray-900",children:[t," days"]}),qt=({label:t,children:a})=>e.jsxs("div",{className:"py-3",children:[e.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-gray-400 mb-1.5",children:t}),e.jsx("p",{className:"text-[13px] text-gray-600 leading-relaxed",children:a})]}),Yt=({data:t,commitment:a,layout:s="stacked"})=>{if(!t)return null;
37const{auto_renewal_present:r,auto_renewal_length_months:n,customer_renewal_optout_notice_days:i,renewal_price_notice_days:l}=t;if(r==null)return null;if(r===!1)return e.jsxs(Y,{children:[e.jsx(ee,{children:"Auto-Renewal"}),e.jsx("div",{className:"mt-3",children:e.jsx(D0,{tone:"green",children:"No auto-renewal"})})]});const o=$0(n),c=i!=null,u=l!=null,h=a?.payment_frequency?L0[a.payment_frequency]||a.payment_frequency:null,m=a?.payment_terms_days??null,f=h!=null,y=m!=null,v=(c||u)&&{label:"Renewal Notice",body:c&&u?e.jsxs(e.Fragment,{children:["Cancel at least"," ",e.jsx(we,{value:i})," before renewal; price changes need"," ",e.jsx(we,{value:l})," notice."]}):c?e.jsxs(e.Fragment,{children:["Cancel at least"," ",e.jsx(we,{value:i})," before renewal to opt out."]}):e.jsxs(e.Fragment,{children:["Price changes require ",e.jsx(we,{value:l})," ","notice before renewal."]})},g=(f||y)&&{label:"Billing & Payment",body:f&&y?e.jsxs(e.Fragment,{children:["Fees are billed"," ",e.jsx("span",{className:"font-semibold text-gray-900",children:h}),"; invoices are due within ",e.jsx(we,{value:m})," of receipt."]}):f?e.jsxs(e.Fragment,{children:["Fees are billed"," ",e.jsx("span",{className:"font-semibold text-gray-900",children:h}),"."]}):e.jsxs(e.Fragment,{children:["Invoices are due within ",e.jsx(we,{value:m})," of receipt."]})};return s==="paired"?e.jsx(Y,{className:"h-full",children:e.jsxs("div",{className:"grid grid-cols-2 gap-6 h-full divide-x divide-gray-200",children:[e.jsxs("div",{className:"flex flex-col items-center pt-2",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-900 leading-none uppercase tracking-wider",children:"Auto-Renewal"}),e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-1",children:[e.jsx("span",{className:"text-4xl font-semibold text-[#1A1A1A] leading-none",children:o?o.value:"â"}),e.jsx("span",{className:"text-base font-semibold text-gray-600 leading-none",children:o?o.unit:"Months"})]})]}),e.jsxs("div",{className:"flex flex-col justify-center divide-y divide-gray-100 pl-6",children:[v&&e.jsx(qt,{label:v.label,children:v.body}),g&&e.jsx(qt,{label:g.label,children:g.body})]})]})}):e.jsx("div",{className:"border border-gray-100 rounded-2xl bg-white shadow-sm overflow-hidden",children:e.jsxs("div",{className:"flex items-stretch divide-x divide-gray-100",children:[e.jsxs("div",{className:"relative flex-1 flex flex-col items-start px-6 py-5",children:[e.jsx(ge,{icon:Fs}),e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-gray-400",children:"Auto-Renewal"}),e.jsx("div",{className:"flex-1 flex items-center",children:e.jsxs("span",{className:"inline-flex items-baseline gap-1.5 px-5 py-3 rounded-xl bg-[#E8F2FF]",children:[e.jsx("span",{className:"text-2xl font-semibold text-[#0173FF] leading-none",children:o?o.value:"â"}),e.jsx("span",{className:"text-2xl font-semibold text-[#0173FF] leading-none",children:o?o.unit:"Months"})]})})]}),v&&e.jsxs("div",{className:"relative flex-1 flex flex-col px-6 py-5",children:[e.jsx(ge,{icon:As}),e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-gray-400",children:v.label}),e.jsx("div",{className:"flex-1 flex items-center py-2",children:e.jsx("p",{className:"text-[13px] text-gray-600 leading-relaxed",children:v.body})})]}),g&&e.jsxs("div",{className:"relative flex-1 flex flex-col px-6 py-5",children:[e.jsx(ge,{icon:Ss}),e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-gray-400",children:g.label}),e.jsx("div",{className:"flex-1 flex items-center py-2",children:e.jsx("p",{className:"text-[13px] text-gray-600 leading-relaxed",children:g.body})})]})]})})},V0=({statements:t,wrap:a=!1})=>e.jsx(e.Fragment,{children:t.map((s,r)=>e.jsxs("div",{className:`flex gap-3 py-2 ${a?"items-start":"items-center"}`,children:[e.jsx("span",{className:"inline-flex items-center justify-center w-6 h-6 rounded-full bg-[#E8F2FF] text-[#0173FF] text-xs font-semibold flex-shrink-0",children:r+1}),e.jsx("span",{className:`flex-1 min-w-0 text-[13px] text-gray-700 ${a?"leading-relaxed":"truncate"}`,children:s})]},s))}),Ls=({data:t,autoRenewalPresent:a})=>{if(!t)return null;const{pricing_locked_during_initial_term:s,renewal_price_cap_pct:r,mid_term_price_increase_allowed:n,auto_tier_upgrade_present:i,late_fee_rate_pct:l}=t,o=Te(r),c=Te(l);
37if(s==null&&o==null&&n==null&&i==null&&c==null)return null;const h=a===!0&&o==null,m=[];return s!=null&&m.push(s?"Initial-term pricing is locked.":"Initial-term pricing is not locked."),n!=null&&m.push(n?"Mid-term price increases are allowed.":"No mid-term price increases."),i!=null&&m.push(i?"Usage can auto-upgrade your tier.":"No automatic tier upgrades."),c!=null&&m.push(`Late payments carry a ${Zt(l)} fee.`),e.jsx("div",{className:"h-full border border-gray-100 rounded-2xl bg-white shadow-sm overflow-hidden",children:e.jsxs("div",{className:"flex items-stretch h-full divide-x divide-gray-100",children:[e.jsxs("div",{className:"relative flex-1 flex flex-col items-start px-6 py-5",children:[e.jsx(ge,{icon:Es}),e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-gray-400",children:"Pricing Escalation"}),e.jsxs("div",{className:"flex-1 flex flex-col items-start justify-center gap-2",children:[o!=null?e.jsx("span",{className:"text-2xl font-semibold text-[#1A1A1A] leading-none",children:Zt(r)}):h?e.jsxs("span",{className:"inline-flex items-center gap-2 text-2xl font-semibold text-[#1A1A1A] leading-none",children:[e.jsx(Je,{className:"w-7 h-7 text-[#363D4F]",strokeWidth:1.75}),"Uncapped"]}):e.jsx("span",{className:"text-4xl font-semibold text-gray-300 leading-none",children:"â"}),e.jsx("span",{className:"text-sm font-semibold text-gray-600 leading-none",children:"Renewal cap"})]})]}),e.jsx("div",{className:"flex-1 flex flex-col justify-center px-6 py-5",children:m.length>0?e.jsx(V0,{statements:m}):e.jsx("p",{className:"text-[12px] text-gray-500 italic leading-relaxed py-2.5",children:"The contract doesn't address these pricing terms."})})]})})},Xt=({data:t})=>{if(!t)return null;const{customer_termination_for_convenience_allowed:a,vendor_termination_for_convenience_allowed:s,termination_for_cause_notice_days:r,cure_period_days:n,exit_fee_present:i,refund_unused_fees_on_cause_termination:l}=t;if(a==null&&s==null&&r==null&&n==null&&i==null&&l==null)return null;const c=a,u=s,h=r,m=n,f=[];return c!=null&&u!=null?f.push(c&&u?"Both parties can exit for convenience.":c?"Only buyer can exit for convenience.":u?"Only vendor can exit for convenience.":"Neither party can exit for convenience."):c!=null?f.push(c?"The buyer can exit for convenience.":"The buyer cannot exit for convenience."):u!=null&&f.push(u?"The vendor can exit for convenience.":"The vendor cannot exit for convenience."),h!=null&&m!=null?f.push(`${m} days to fix a breach; otherwise ${h} days' notice ends the contract.`):h!=null?f.push(`Terminating the contract over a breach needs ${h} days' notice.`):m!=null&&f.push(`A breach can be fixed within ${m} days to avoid termination.`),i!=null&&f.push(i?"An early-termination fee applies.":"No early-termination fee."),l!=null&&f.push(l?"Unused fees refunded on cause exit.":"Unused fees not refunded on cause exit."),e.jsxs(Y,{icon:Bs,children:[e.jsx(ee,{children:"Termination & Exit"}),e.jsx("div",{className:"mt-4",children:e.jsx(V0,{statements:f,wrap:!0})})]})},Qt=({data:t})=>{if(!t)return null;const a=t.customer_indemnification_present;if(a==null)return null;const s=a===!1,r=s?Ne:Je,n=s?"Not Indemnified":"Indemnifies Vendor",i=s?"The buyer has no duty to cover the vendor for claims.":"The buyer must cover the vendor for certain claims.";return e.jsxs(Y,{icon:Is,children:[e.jsx(ee,{children:"Buyer-Side Indemnification"}),e.jsxs("div",{className:"mt-4 flex items-center gap-2.5",children:[e.jsx(r,{className:"w-7 h-7 flex-shrink-0 text-[#363D4F]",strokeWidth:1.75}),e.jsx("span",{className:"text-mdd font-semibold text-[#1A1A1A] leading-none",children:n})]}),e.jsx("p",{className:"text-[13px] text-gray-600 leading-relaxed mt-3",children:i})]})},Jt=({data:t,layout:a="paired"})=>{if(!t)return null;const s=t.liability_cap_type;if(s==null)return null;const r=Ms[s]||{headline:s,desc:"",tone:"neutral"},{Icon:n}=Ps[r.tone],i=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(n,{className:"w-6 h-6 flex-shrink-0 text-[#363D4F]",strokeWidth:1.75}),e.jsx("span",{className:"text-xl font-semibold text-[#1A1A1A] leading-tight",children:r.headline}),r.mutual&&e.jsx("span",{className:"inline-block px-1.5 py-0.5 rounded bg-[#363D4F] text-white text-[9px] font-semibold uppercase tracking-wider",children:"Mutual"})]}),r.desc&&e.jsx("p",{className:"text-[13px] text-gray-600 leading-relaxed mt-3",children:r.desc})]});return a==="stacked"?e.jsxs(Y,{icon:Ut,children:[e.jsx(ee,{children:"Vendor Liability Ceiling"}),e.jsx("div",{className:"mt-3",children:i})]}):e.jsx(Y,{className:"h-full",icon:Ut,children:e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx(ee,{children:"Vendor Liability Ceiling"}),e.jsx("div",{className:"flex-1 flex flex-col justify-center mt-3",children:i})]})})},e0=({data:t,layout:a="paired"})=>{if(!t)return null;const s=t.liability_carve_outs;if(s==null)return null;const r=a==="stacked";if(s.length===0)return r?e.jsxs(Y,{icon:Ve,children:[e.jsx(ee,{children:"Uncapped Tail Risk"}),e.jsxs("div",{className:"mt-3 flex items-center gap-2.5",children:[e.jsx(Ne,{className:"w-6 h-6 flex-shrink-0 text-[#363D4F]",strokeWidth:1.75}),e.jsx("span",{className:"text-xl font-semibold text-[#1A1A1A] leading-tight",children:"All Damages Capped"})]}),e.jsx("p",{className:"text-[13px] text-gray-600 leading-relaxed mt-3",children:"No carve-outs â every liability is subject to the cap."})]}):e.jsxs(Y,{className:"h-full",icon:Ve,children:[e.jsx(ee,{children:"Uncapped Tail Risk"}),e.jsx("div",{className:"mt-3",children:e.jsx(D0,{tone:"green",children:"No carve-outs â all damages are capped"})})]});const i=[...s].sort((l,o)=>(rt.has(l)?0:1)-(rt.has(o)?0:1)).map(l=>e.jsx(R0,{emphasis:rt.has(l),sizeClass:"text-xsm",children:Ts[l]||l},l));return r?e.jsxs(Y,{icon:Ve,children:[e.jsx(ee,{children:"Uncapped Tail Risk"}),e.jsxs("div",{className:"mt-3 flex divide-x divide-gray-100",children:[e.jsxs("div",{className:"basis-2/5 min-w-0 pr-8 flex flex-col justify-center",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("span",{className:"flex items-center justify-center w-10 h-10 rounded-full bg-[#E8F2FF] flex-shrink-0",children:e.jsx("span",{className:"text-xl font-semibold text-[#0173FF] leading-none",children:s.length})}),e.jsx("span",{className:"text-base font-semibold text-[#1A1A1A]",children:"Categories Outside the Cap"})]}),e.jsx("p",{className:"text-[13px] text-gray-600 leading-relaxed mt-3",children:"These liabilities aren't subject to the cap."})]}),e.jsx("div",{className:"flex-1 min-w-0 pl-8 flex flex-wrap content-center gap-1.5",children:i})]})]}):e.jsxs(Y,{className:"h-full",icon:Ve,children:[e.jsx(ee,{children:"Uncapped Tail Risk"}),e.jsxs("div",{className:"mt-4 flex items-center gap-4",children:[e.jsx("span",{className:"flex items-center justify-center w-10 h-10 rounded-full bg-[#E8F2FF] flex-shrink-0",children:e.jsx("span",{className:"text-xl font-semibold text-[#0173FF] leading-none",children:s.length})}),e.jsx("span",{className:"text-base font-semibold text-[#1A1A1A]",children:"Categories Outside the Cap"})]}),e.jsx("div",{className:"mt-4 flex flex-wrap gap-1.5",children:i})]})},Rs=({data:t})=>{if(!t)return null;const a=t.vendor_indemnification_present;if(a==null)return null;if(a===!1)return e.jsxs(Y,{icon:Ht,children:[e.jsx(ee,{children:"Vendor Indemnification"}),e.jsxs("div",{className:"mt-3 flex items-center gap-2.5",children:[e.jsx(Je,{className:"w-6 h-6 flex-shrink-0 text-[#363D4F]",strokeWidth:1.75}),e.jsx("div",{className:"text-xl font-semibold text-[#1A1A1A] leading-tight",children:"No vend
37or defense"})]}),e.jsx("p",{className:"text-[13px] text-gray-600 leading-relaxed mt-3",children:"The vendor will not defend the buyer against third-party claims."})]});const s=t.vendor_indemnification_capped,r=t.vendor_indemnification_scope,n=Array.isArray(r)&&r.length>0;return e.jsxs(Y,{icon:Ht,children:[e.jsx(ee,{children:"Vendor Indemnification"}),e.jsxs("div",{className:"mt-3 flex divide-x divide-gray-100",children:[e.jsxs("div",{className:"basis-2/5 min-w-0 pr-8 flex flex-col justify-center",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(Ne,{className:"w-6 h-6 flex-shrink-0 text-[#363D4F]",strokeWidth:1.75}),e.jsx("span",{className:"text-xl font-semibold text-[#1A1A1A] leading-tight",children:"Vendor Defends Buyer"})]}),s!=null&&e.jsx("p",{className:"text-[13px] text-gray-600 leading-relaxed mt-3",children:s===!1?"Defense obligation is uncapped.":"Defense obligation is capped."})]}),n&&e.jsxs("div",{className:"flex-1 min-w-0 pl-8 flex flex-col justify-center",children:[e.jsx("div",{className:"text-base font-semibold text-[#1A1A1A] mb-3",children:"Covered Scope"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:r.map(i=>e.jsx(R0,{sizeClass:"text-xsm",children:Os[i]||i},i))})]})]})]})},Ds=({stake:t})=>{if(!t?.profile)return null;const a=t.profile,s=a.auto_renewal_mechanics?.auto_renewal_present,r=a.auto_renewal_mechanics,n=a.commitment_and_lockin,i=r?.customer_renewal_optout_notice_days!=null||r?.renewal_price_notice_days!=null,l=n?.payment_frequency!=null||n?.payment_terms_days!=null,o=s===!0&&i&&l,c={commitment:!!a.commitment_and_lockin&&!(a.commitment_and_lockin.initial_term_months==null&&a.commitment_and_lockin.payment_terms_days==null&&a.commitment_and_lockin.payment_frequency==null&&a.commitment_and_lockin.non_cancelable_payment_obligations==null),autoRenewal:a.auto_renewal_mechanics?.auto_renewal_present!=null,pricing:!!a.pricing_escalation&&!(a.pricing_escalation.pricing_locked_during_initial_term==null&&Te(a.pricing_escalation.renewal_price_cap_pct)==null&&a.pricing_escalation.mid_term_price_increase_allowed==null&&a.pricing_escalation.auto_tier_upgrade_present==null&&Te(a.pricing_escalation.late_fee_rate_pct)==null),exit:!!a.exit_friction&&!(a.exit_friction.customer_termination_for_convenience_allowed==null&&a.exit_friction.vendor_termination_for_convenience_allowed==null&&a.exit_friction.termination_for_cause_notice_days==null&&a.exit_friction.cure_period_days==null&&a.exit_friction.exit_fee_present==null&&a.exit_friction.refund_unused_fees_on_cause_termination==null),buyerIndem:a.buyer_side_indemnification?.customer_indemnification_present!=null,vendorCeiling:a.vendor_liability_ceiling?.liability_cap_type!=null,tailRisk:a.uncapped_tail_risk?.liability_carve_outs!=null,vendorIndem:a.vendor_indemnification?.vendor_indemnification_present!=null},u=c.commitment||c.autoRenewal||c.pricing||c.exit||c.buyerIndem,h=c.vendorCeiling||c.tailRisk||c.vendorIndem;return!u&&!h?null:e.jsxs("div",{className:"flex flex-col gap-3 pb-4",children:[u&&e.jsxs(e.Fragment,{children:[e.jsx(zt,{children:"Exposure To Vendor"}),o?e.jsxs(e.Fragment,{children:[c.commitment&&e.jsx(Wt,{data:a.commitment_and_lockin,layout:"stacked"}),c.autoRenewal&&e.jsx(Yt,{data:a.auto_renewal_mechanics,commitment:a.commitment_and_lockin,layout:"stacked"})]}):(c.commitment||c.autoRenewal)&&e.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[c.commitment&&e.jsx(Wt,{data:a.commitment_and_lockin,layout:"paired"}),c.autoRenewal&&e.jsx("div",{className:"col-span-3",children:e.jsx(Yt,{data:a.auto_renewal_mechanics,commitment:a.commitment_and_lockin,layout:"paired"})})]}),c.pricing&&e.jsx(Ls,{data:a.pricing_escalation,autoRenewalPresent:s}),c.exit&&c.buyerIndem?e.jsxs("div",{className:"grid grid-cols-2 gap-3 items-start",children:[e.jsx(Xt,{data:a.exit_friction}),e.jsx(Qt,{data:a.buyer_side_indemnification})]}):c.exit?e.jsx(Xt,{data:a.exit_friction}):c.buyerIndem?e.jsx(Qt,{data:a.buyer_side_indemnification}):null]}),h&&e.jsxs(e.Fragment,{children:[e.jsx(zt,{children:"Exposure From Vendor"}),(c.vendorCeiling||c.tailRisk)&&(c.vendorCeiling&&c.tailRisk?e.jsxs("div",{className:"grid grid-cols-5 ga
37p-3 items-stretch",children:[e.jsx("div",{className:"col-span-2",children:e.jsx(Jt,{data:a.vendor_liability_ceiling})}),e.jsx("div",{className:"col-span-3",children:e.jsx(e0,{data:a.uncapped_tail_risk,layout:"paired"})})]}):c.vendorCeiling?e.jsx(Jt,{data:a.vendor_liability_ceiling,layout:"stacked"}):e.jsx(e0,{data:a.uncapped_tail_risk,layout:"stacked"})),c.vendorIndem&&e.jsx(Rs,{data:a.vendor_indemnification})]})]})},$s="/assets/banner-CiV3SM8B.png",Vs={high:"High Negotiation Required",moderate:"Moderate Negotiation",low:"Low Negotiation"},Gs={high:"Revision Required",moderate:"Approve with Targeted Revision",low:"Approve with Some Revision"},Us=t=>{if(t==null)return null;const a=typeof t=="number"?t:parseFloat(t);return Number.isFinite(a)?a:null},Hs=t=>{const a=t?.profile;if(!a)return null;if(a.vendor_liability_ceiling?.liability_cap_type==="disclaimed"||a.buyer_side_indemnification?.customer_indemnification_present===!0||a.vendor_indemnification?.vendor_indemnification_present===!1)return"critical";let s=0;const r=a.auto_renewal_mechanics,n=a.pricing_escalation,i=a.exit_friction,l=a.commitment_and_lockin,o=a.uncapped_tail_risk?.liability_carve_outs||[];return r?.auto_renewal_present===!0&&Us(n?.renewal_price_cap_pct)==null&&s++,i?.vendor_termination_for_convenience_allowed===!0&&s++,n?.mid_term_price_increase_allowed===!0&&s++,l?.non_cancelable_payment_obligations===!0&&s++,o.length>=5&&s++,i?.exit_fee_present===!0&&s++,n?.auto_tier_upgrade_present===!0&&s++,s>=2?"concerning":null},Zs=(t,a)=>{if(!t)return null;const s=Hs(a);if(s==="critical")return"high";if(s==="concerning"){if(t==="low")return"moderate";if(t==="moderate")return"high"}return t},zs=({summary:t,reviewPath:a,stake:s})=>{const r=Zs(a,s);if(!r)return null;const n=Gs[r],i=Vs[r],l=[{value:t?.deal_breakers_count??0,label:"Deal Breakers"},{value:t?.market_favourites_count??0,label:"Market Favourites"},{value:t?.good_to_have_count??0,label:"Good to Have"}];return e.jsxs("div",{className:"relative rounded-2xl overflow-hidden text-white shadow-sm",style:{backgroundColor:"#3B82F6",backgroundImage:"linear-gradient(105deg, #2F6BF6 0%, #4E8BF8 55%, #6AA1FA 100%)"},children:[e.jsx("img",{src:$s,alt:"","aria-hidden":"true",className:"pointer-events-none absolute right-0 top-0 h-full w-auto object-cover object-right select-none",style:{maskImage:"linear-gradient(to right, transparent 0%, #000 40%)",WebkitMaskImage:"linear-gradient(to right, transparent 0%, #000 40%)"}}),e.jsxs("div",{className:"relative px-5 py-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-[0.18em] text-white/80",children:"Recommended Actions"}),e.jsx("span",{className:"px-3 py-1 rounded-full bg-white text-[9px] font-bold uppercase tracking-wider text-[#2F6BFF] shadow-sm whitespace-nowrap",children:i})]}),e.jsx("div",{className:"text-xl font-extrabold leading-tight mt-1.5 mb-5 max-w-[65%]",children:n}),e.jsx("div",{className:"flex items-start gap-6",children:l.map(({value:o,label:c})=>e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-white/15 flex items-center justify-center text-base font-extrabold leading-none",children:o}),e.jsx("div",{className:"text-[8px] font-semibold uppercase tracking-[0.12em] text-white/80 mt-2 whitespace-nowrap",children:c})]},c))})]})]})},t0=t=>new Set((t||[]).map(a=>a?.label_id).filter(Boolean)).size,Ks=()=>{const{data:t,loading:a}=T(n=>n.contracts.MarketDeviations),s=t0(t?.party_a),r=t0(t?.party_b);return e.jsx("div",{className:"border border-gray-200 rounded-lg overflow-hidden bg-gradient-to-br from-gray-50 to-white",children:e.jsxs("div",{className:"px-4 pt-3 pb-2",children:[e.jsx("div",{className:"text-lg font-bold text-gray-900 leading-tight mb-4",children:"Rare Clause Radar"}),a&&!t?e.jsx("div",{className:"h-12 bg-gray-100 rounded animate-pulse"}):e.jsxs("div",{className:"grid grid-cols-2 divide-x divide-gray-200",children:[e.jsxs("div",{className:"pr-4 flex flex-col items-center",children:[e.jsx("span",{className:"flex items-center justify-center w-14 h-14 roun
37ded-full bg-[#E8F2FF] text-2xl font-bold leading-none tabular-nums text-[#0173FF]",children:s}),e.jsx("span",{className:"text-xsm text-gray-500 leading-snug mt-2",children:"Favoring Vendor"})]}),e.jsxs("div",{className:"pl-4 flex flex-col items-center",children:[e.jsx("span",{className:"flex items-center justify-center w-14 h-14 rounded-full bg-[#E8F2FF] text-2xl font-bold leading-none tabular-nums text-[#0173FF]",children:r}),e.jsx("span",{className:"text-xsm text-gray-500 leading-snug mt-2",children:"Favoring Customer"})]})]})]})})},a0=[{key:"deal_breakers",label:"Deal Breakers",countKey:"deal_breakers_count"},{key:"market_favourites",label:"Market Supported Option",countKey:"market_favourites_count"},{key:"good_to_have",label:"Good to Have",countKey:"good_to_have_count"}],Ws=t=>t?(t.deal_breakers_count??0)>0?"high":(t.market_favourites_count??0)+(t.good_to_have_count??0)>3?"moderate":"low":null,Ge={text:"text-gray-700"},nt={text:"text-emerald-700"},Ie={text:"text-[#0D71EF]"},qs={0:{percent:100,label:"Vendor Favorable",...Ge},1:{percent:90,label:"Vendor Favorable",...Ge},2:{percent:80,label:"Vendor Favorable",...Ge},3:{percent:70,label:"Vendor Favorable",...Ge},4:{percent:60,label:"Balanced",...nt},5:{percent:50,label:"Balanced",...nt},6:{percent:60,label:"Balanced",...nt},7:{percent:70,label:"Customer Favorable",...Ie},8:{percent:80,label:"Customer Favorable",...Ie},9:{percent:90,label:"Customer Favorable",...Ie},10:{percent:100,label:"Customer Favorable",...Ie}},Ys=t=>t==null?null:t<=3?"Terms heavily favor the vendor â expect significant negotiation.":t===4?"Slightly vendor-leaning, but still in negotiable range.":t===5?"Balanced and fair terms for both parties.":t===6?"Slightly customer-leaning, with manageable vendor terms.":"Balanced, low-risk terms favorable to the customer.",Xs=({activeBucket:t,onSummary:a})=>{const{contractId:s}=Ae(),r=Se(),n=T(I=>I.auth.user?.tokens?.jwt),{documentOverviewResult:i}=T(I=>I.upload),{data:l,loading:o,error:c}=T(m2(s));x.useEffect(()=>{!s||!n||l||r(h2({contractId:s,authToken:n}))},[s,n,l,r]),x.useEffect(()=>{l&&a&&a(l.summary||null)},[l,a]);const u=l?.summary||null,h=Ws(u),m=l?.ContractPosition?.pct_more_favorable_than_this_position,f=m!=null?Math.round(100*Math.max(Math.min(1-m,.99),.01)):null,y=f!=null&&f>75,v=f!=null?y?100-f:f:null,g=f!=null?`${y?"Bottom":"Top"} ${v}%`:null,j=f!=null?f*2.4:96,p=I=>{if(I<=120){const E=I/120;return(1-E)*(1-E)*65+2*(1-E)*E*5+E*E*40}const w=(I-120)/120;return(1-w)*(1-w)*40+2*(1-w)*w*75+w*w*65},C=f!=null?p(j):32,F=y?"#ef4444":"#0173FF",A=y?"text-red-600":"text-[#0173FF]";return e.jsx("div",{className:"h-full overflow-hidden bg-[#F9F9FB]",children:e.jsxs("div",{className:"grid grid-cols-12 gap-x-8 px-6 pt-6 h-full",children:[e.jsx("aside",{className:"col-span-3 space-y-3 overflow-y-auto min-h-0 no-scrollbar",children:e.jsxs("div",{className:"flex flex-col gap-3 pb-3",children:[e.jsx("div",{className:"border border-gray-200 rounded-lg bg-white overflow-hidden",children:e.jsx("div",{className:"px-4 pt-3",children:g?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`text-2xl font-extrabold leading-none mb-2 ${A}`,children:g}),e.jsx("p",{className:"text-xs text-gray-500 leading-snug",children:"Among all public contracts in our database."}),e.jsxs("svg",{viewBox:"-12 -5 264 85",className:"w-full",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"bellfill",x1:"0",x2:"0",y1:"0",y2:"1",children:[e.jsx("stop",{offset:"0",stopColor:F,stopOpacity:"0.4"}),e.jsx("stop",{offset:"1",stopColor:F,stopOpacity:"0"})]})}),e.jsx("path",{d:"M0,65 Q60,5 120,40 T240,65 L240,70 L0,70 Z",fill:"url(#bellfill)"}),e.jsx("path",{d:"M0,65 Q60,5 120,40 T240,65",fill:"none",stroke:F,strokeWidth:"1.5"}),e.jsx("circle",{cx:j,cy:C,r:"5",fill:F}),e.jsx("circle",{cx:j,cy:C,r:"9",fill:"none",stroke:F,strokeOpacity:"0.3",strokeWidth:"2"})]})]}):e.jsxs("div",{className:"space-y-3 animate-pulse",children:[e.jsx("div",{className:"h-7 w-24 bg-gray-100 rounded"}),e.jsx("div",{className:"h-3 w-40 bg-gray-100 rounded"}),e.jsx("div",{className:"h-12 bg-gray-100 rounded"})]})})}),(()=>{const I=i?.rating_percentile,w=I!=null?qs[I]:{percent:0,label:"â",...Ie},E=Ys(I);return e.jsx("div",{className:"border border-gray-200 rounded-lg overflow-hidden bg-white",children:e.jsx("div",{className:"px-4 pt-3 pb-2",children:i?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`text-3xl font-bold leading-none mb-2 ${w.text}`,children:[w.percent,"%"]}),e.jsx("div",{className:"text-base font-bold text-gray-900 text-[12px] mb-1",children:w.label}),e.jsx(Oa,{ratingPercentile:I,size:"sm"}),E&&e.jsx("p",{className:"text-xs text-gray-600 leading-relaxed mt-2",children:E})]}):e.jsxs("div",{className:"space-y-2 animate-pulse",children:[e.jsx("div",{className:"h-9 w-24 bg-gray-100 rounded"}),e.jsx("div",{className:"h-3 w-32 bg-gray-100 rounded"}),e.jsx("div",{className:"h-4 bg-gray-100 rounded w-full mt-2"})]})})})})(),e.jsx(Ks,{})]})}),e.jsxs("div",{className:"col-span-6 space-y-3 overflow-y-auto min-h-0 custom-scrollbar px-2",children:[e.jsx(zs,{summary:u,reviewPath:h,stake:l?.Stake}),e.jsx(Ds,{stake:l?.Stake})]}),e.jsx("div",{className:"col-span-3 overflow-y-auto min-h-0 no-scrollbar",children:c?e.jsx("div",{className:"py-12 text-center text-[11px] font-mono uppercase tracking-[0.18em] text-gray-300",children:"Could not load insights"}):o||!l?e.jsx("div",{className:"flex flex-col gap-3",children:[0,1,2,3].map(I=>e.jsxs("div",{className:"border border-gray-200 rounded-2xl bg-white p-4 animate-pulse space-y-3",children:[e.jsx("div",{className:"h-3 w-24 bg-gray-100 rounded"}),e.jsx("div",{className:"h-4 w-3/4 bg-gray-100 rounded"}),e.jsx("div",{className:"h-3 w-full bg-gray-100 rounded"}),e.jsx("div",{className:"h-3 w-5/6 bg-gray-100 rounded"})]},I))}):(()=>{const w=[...l[t]||[]].sort((E,V)=>(E.weighted_score??0)-(V.weighted_score??0));return e.jsx(e.Fragment,{children:w.length===0?e.jsx("div",{className:"py-12 text-center text-[11px] font-mono uppercase tracking-[0.18em] text-gray-300",children:t==="deal_breakers"?"Looks great â this contract clears the buy-side playbook.":"No items in this bucket."}):e.jsx("div",{className:"flex flex-col gap-3",children:w.map((E,V)=>e.jsx("div",{children:e.jsx(_s,{row:E,isDealBreaker:t==="deal_breakers"})},`${E.question_id}-${V}`))})})})()})]})})};var We=t=>null;We.displayName="Cell";var G0=(t,a,s)=>{var r=vt();return(n,i)=>l=>{t?.(n,i,l),r($2({activeIndex:String(i),activeDataKey:a,activeCoordinate:n.tooltipPosition,activeGraphicalItemId:s}))}},U0=t=>{var a=vt();return(s,r)=>n=>{t?.(s,r,n),a(V2())}},H0=(t,a,s)=>{var r=vt();return(n,i)=>l=>{t?.(n,i,l),r(G2({activeIndex:String(i),activeDataKey:a,activeCoordinate:n.tooltipPosition,activeGraphicalItemId:s}))}},s0=(t,a,s)=>{var r=s??t;if(!Xe(r))return dt(r,a,0)},Qs=(t,a,s)=>{var r={},n=t.filter(U2),i=t.filter(u=>u.stackId==null),l=n.reduce((u,h)=>{var m=u[h.stackId];return m==null&&(m=[]),m.push(h),u[h.stackId]=m,u},r),o=Object.entries(l).map(u=>{var h,[m,f]=u,y=f.map(g=>g.dataKey),v=s0(a,s,(h=f[0])===null||h===void 0?void 0:h.barSize);return{stackId:m,dataKeys:y,barSize:v}}),c=i.map(u=>{var h=[u.dataKey].filter(f=>f!=null),m=s0(a,s,u.barSize);return{stackId:void 0,dataKeys:h,barSize:m}});return[...o,...c]};function r0(t,a){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);a&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),s.push.apply(s,r)}return s}function Ue(t){for(var a=1;a<arguments.length;a++){var s=arguments[a]!=null?arguments[a]:{};
37a%2?r0(Object(s),!0).forEach(function(r){Js(t,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):r0(Object(s)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(s,r))})}return t}function Js(t,a,s){return(a=er(a))in t?Object.defineProperty(t,a,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[a]=s,t}function er(t){var a=tr(t,"string");return typeof a=="symbol"?a:a+""}function tr(t,a){if(typeof t!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,a);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(t)}function ar(t,a,s,r,n){var i,l=r.length;if(!(l<1)){var o=dt(t,s,0,!0),c,u=[];if(ut((i=r[0])===null||i===void 0?void 0:i.barSize)){var h=!1,m=s/l,f=r.reduce((C,F)=>C+(F.barSize||0),0);f+=(l-1)*o,f>=s&&(f-=(l-1)*o,o=0),f>=s&&m>0&&(h=!0,m*=.9,f=l*m);var y=(s-f)/2>>0,v={offset:y-o,size:0};c=r.reduce((C,F)=>{var A,I={stackId:F.stackId,dataKeys:F.dataKeys,position:{offset:v.offset+v.size+o,size:h?m:(A=F.barSize)!==null&&A!==void 0?A:0}},w=[...C,I];return v=I.position,w},u)}else{var g=dt(a,s,0,!0);s-2*g-(l-1)*o<=0&&(o=0);var j=(s-2*g-(l-1)*o)/l;j>1&&(j>>=0);var p=ut(n)?Math.min(j,n):j;c=r.reduce((C,F,A)=>[...C,{stackId:F.stackId,dataKeys:F.dataKeys,position:{offset:g+(j+o)*A+(j-p)/2,size:p}}],u)}return c}}var sr=(t,a,s,r,n,i,l)=>{var o=Xe(l)?a:l,c=ar(s,r,n!==i?n:i,t,o);return n!==i&&c!=null&&(c=c.map(u=>Ue(Ue({},u),{},{position:Ue(Ue({},u.position),{},{offset:u.position.offset-n/2})}))),c},rr=(t,a)=>{var s=H2(a);if(!(!t||s==null||a==null)){var{stackId:r}=a;if(r!=null){var n=t[r];if(n){var{stackedData:i}=n;if(i)return i.find(l=>l.key===s)}}}},nr=(t,a)=>{if(!(t==null||a==null)){var s=t.find(r=>r.stackId===a.stackId&&a.dataKey!=null&&r.dataKeys.includes(a.dataKey));if(s!=null)return s.position}};function ir(t,a){return t&&typeof t=="object"&&"zIndex"in t&&typeof t.zIndex=="number"&&ut(t.zIndex)?t.zIndex:a}var lr="Invariant failed";function or(t,a){throw new Error(lr)}function mt(){return mt=Object.assign?Object.assign.bind():function(t){for(var a=1;a<arguments.length;a++){var s=arguments[a];for(var r in s)({}).hasOwnProperty.call(s,r)&&(t[r]=s[r])}return t},mt.apply(null,arguments)}function jt(t){return x.createElement(Z2,mt({shapeType:"rectangle",activeClassName:"recharts-active-bar",inActiveClassName:"recharts-inactive-bar"},t))}var cr=function(a){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return(r,n)=>{if(Et(a))return a;var i=Et(r)||Xe(r);return i?a(r,n):(i||or(),s)}},dr=(t,a,s)=>s,ur=(t,a)=>a,Oe=xe([C0,ur],(t,a)=>t.filter(s=>s.type==="bar").find(s=>s.id===a)),xr=xe([Oe],t=>t?.maxBarSize),mr=(t,a,s,r)=>r,hr=xe([Ee,C0,be,ye,dr],(t,a,s,r,n)=>a.filter(i=>t==="horizontal"?i.xAxisId===s:i.yAxisId===r).filter(i=>i.isPanorama===n).filter(i=>i.hide===!1).filter(i=>i.type==="bar")),pr=(t,a,s)=>{var r=Ee(t),n=be(t,a),i=ye(t,a);if(!(n==null||i==null))return r==="horizontal"?Bt(t,"yAxis",i,s):Bt(t,"xAxis",n,s)},fr=(t,a)=>{var s=Ee(t),r=be(t,a),n=ye(t,a);if(!(r==null||n==null))return s==="horizontal"?It(t,"xAxis",r):It(t,"yAxis",n)},gr=xe([hr,X2,fr],Qs),vr=(t,a,s)=>{var r,n,i=Oe(t,a);if(i==null)return 0;var l=be(t,a),o=ye(t,a);if(l==null||o==null)return 0;var c=Ee(t),u=w0(t),{maxBarSize:h}=i,m=Xe(h)?u:h,f,y;return c==="horizontal"?(f=ke(t,"xAxis",l,s),y=Fe(t,"xAxis",l,s)):(f=ke(t,"yAxis",o,s),y=Fe(t,"yAxis",o,s)),(r=(n=j0(f,y,!0))!==null&&n!==void 0?n:m)!==null&&r!==void 0?r:0},Z0=(t,a,s)=>{var r=Ee(t),n=be(t,a),i=ye(t,a);if(!(n==null||i==null)){var l,o;return r==="horizontal"?(l=ke(t,"xAxis",n,s),o=Fe(t,"xAxis",n,s)):(l=ke(t,"yAxis",i,s),o=Fe(t,"yAxis",i,s)),j0(l,o)}},br=xe([gr,w0,q2,Y2,vr,Z0,xr],sr),yr=(t,a,s)=>{var r=be(t,a);if(r!=null)return ke(t,"xAxis",r,s)},jr=(t,a,s)=>{var r=ye(t,a);if(r!=null)return ke(t,"yAxis",r,s)},Cr=(t,a,s)=>{var r=be(t,a);if(r!=null)return Fe(t,"xAxis",r,s)},wr=(t,a,s)=>{var r=ye(t,a);if(r!=null)return Fe(t,"yAxis",r,s)},_r=xe([br,Oe],nr),Nr=xe([pr,Oe],rr),kr=xe([z2,K2,yr,jr,Cr,wr,_r,Ee,W2,Z0,Nr,Oe,mr],(t,a,s,r,n,i,l,o,c,u,h,m,f)=>{var{chartData:y,dataStartIndex:v,dataEndIndex:g}=c;if(!(m==null||l==null||a==null||o!=="horizontal"&&o!=="vertical"||s==null||r==null||n==null||i==null||u==null)){var{data:j}=m,p;if(j!=null&&j.length>0?p=j:p=y?.slice(v,g+1),p!=null)return en({layout:o,barSettings:m,pos:l,parentViewBox:a,bandSize:u,xAxis:s,yAxis:r,xAxisTicks:n,yAxisTicks:i,stackedData:h,displayedData:p,offset:t,cells:f,dataStartIndex:v})}}),Fr=["index"];function ht(){return ht=Object.assign?Object.assign.bind():function(t){for(var a=1;a<arguments.length;a++){var s=arguments[a];for(var r in s)({}).hasOwnProperty.call(s,r)&&(t[r]=s[r])}return t},ht.apply(null,arguments)}function Ar(t,a){if(t==null)return{};var s,r,n=Sr(t,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)s=i[r],a.indexOf(s)===-1&&{}.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}
37function Sr(t,a){if(t==null)return{};var s={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(a.indexOf(r)!==-1)continue;s[r]=t[r]}return s}var z0=x.createContext(void 0),Er=t=>{var a=x.useContext(z0);if(a!=null)return a.stackId;if(t!=null)return Q2(t)},Br=(t,a)=>"recharts-bar-stack-clip-path-".concat(t,"-").concat(a),Ir=t=>{var a=x.useContext(z0);if(a!=null){var{stackId:s}=a;return"url(#".concat(Br(s,t),")")}},K0=t=>{var{index:a}=t,s=Ar(t,Fr),r=Ir(a);return x.createElement(Ze,ht({className:"recharts-bar-stack-layer",clipPath:r},s))},Mr=["onMouseEnter","onMouseLeave","onClick"],Pr=["value","background","tooltipPosition"],Tr=["id"],Or=["onMouseEnter","onClick","onMouseLeave"];function ue(){return ue=Object.assign?Object.assign.bind():function(t){for(var a=1;a<arguments.length;a++){var s=arguments[a];for(var r in s)({}).hasOwnProperty.call(s,r)&&(t[r]=s[r])}return t},ue.apply(null,arguments)}function n0(t,a){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);a&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),s.push.apply(s,r)}return s}function H(t){for(var a=1;a<arguments.length;a++){var s=arguments[a]!=null?arguments[a]:{};a%2?n0(Object(s),!0).forEach(function(r){Lr(t,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):n0(Object(s)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(s,r))})}return t}function Lr(t,a,s){return(a=Rr(a))in t?Object.defineProperty(t,a,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[a]=s,t}function Rr(t){var a=Dr(t,"string");return typeof a=="symbol"?a:a+""}function Dr(t,a){if(typeof t!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,a);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(t)}
37function qe(t,a){if(t==null)return{};var s,r,n=$r(t,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)s=i[r],a.indexOf(s)===-1&&{}.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function $r(t,a){if(t==null)return{};var s={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(a.indexOf(r)!==-1)continue;s[r]=t[r]}return s}var Vr=t=>{var{dataKey:a,name:s,fill:r,legendType:n,hide:i}=t;return[{inactive:i,dataKey:a,type:n,color:r,value:N0(s,a),payload:t}]},Gr=x.memo(t=>{var{dataKey:a,stroke:s,strokeWidth:r,fill:n,name:i,hide:l,unit:o,tooltipType:c,id:u}=t,h={dataDefinedOnItem:void 0,getPosition:na,settings:{stroke:s,strokeWidth:r,fill:n,dataKey:a,nameKey:void 0,name:N0(i,a),hide:l,type:c,color:n,unit:o,graphicalItemId:u}};return x.createElement(ra,{tooltipEntrySettings:h})});function Ur(t){var a=ze(F0),{data:s,dataKey:r,background:n,allOtherBarProps:i}=t,{onMouseEnter:l,onMouseLeave:o,onClick:c}=i,u=qe(i,Mr),h=G0(l,r,i.id),m=U0(o),f=H0(c,r,i.id);if(!n||s==null)return null;var y=ha(n);return x.createElement(yt,{zIndex:ir(n,bt.barBackground)},s.map((v,g)=>{var{value:j,background:p,tooltipPosition:C}=v,F=qe(v,Pr);if(!p)return null;var A=h(v,g),I=m(v,g),w=f(v,g),E=H(H(H(H(H({option:n,isActive:String(g)===a},F),{},{fill:"#eee"},p),y),A0(u,v,g)),{},{onMouseEnter:A,onMouseLeave:I,onClick:w,dataKey:r,index:g,className:"recharts-bar-background-rectangle"});return x.createElement(jt,ue({key:"background-bar-".concat(g)},E))}))}function Hr(t){var{showLabels:a,children:s,rects:r}=t,n=r?.map(i=>{var l={x:i.x,y:i.y,width:i.width,lowerWidth:i.width,upperWidth:i.width,height:i.height};return H(H({},l),{},{value:i.value,payload:i.payload,parentViewBox:i.parentViewBox,viewBox:l,fill:i.fill})});return x.createElement(va,{value:a?n:void 0},s)}function Zr(t){var{shape:a,activeBar:s,baseProps:r,entry:n,index:i,dataKey:l}=t,o=ze(F0),c=ze(ya),u=s&&String(n.originalDataIndex)===o&&(c==null||l===c),[h,m]=x.useState(!1),[f,y]=x.useState(!1);x.useEffect(()=>{var F;return u?(m(!0),F=requestAnimationFrame(()=>{y(!0)})):y(!1),()=>{cancelAnimationFrame(F)}},[u]);var v=x.useCallback(()=>{u||m(!1)},[u]),g=u&&f,j=u||h,p;u?s===!0?p=a:p=s:p=a;var C=x.createElement(jt,ue({},r,{name:String(r.name)},n,{isActive:g,option:p,index:i,dataKey:l,onTransitionEnd:v}));return j?x.createElement(yt,{zIndex:bt.activeBar},x.createElement(K0,{index:n.originalDataIndex},C)):C}function zr(t){var{shape:a,baseProps:s,entry:r,index:n,dataKey:i}=t;return x.createElement(jt,ue({},s,{name:String(s.name)},r,{isActive:!1,option:a,index:n,dataKey:i}))}function Kr(t){var a,{data:s,props:r}=t,n=(a=ba(r))!==null&&a!==void 0?a:{},{id:i}=n,l=qe(n,Tr),{shape:o,dataKey:c,activeBar:u}=r,{onMouseEnter:h,onClick:m,onMouseLeave:f}=r,y=qe(r,Or),v=G0(h,c,i),g=U0(f),j=H0(m,c,i);return s?x.createElement(x.Fragment,null,s.map((p,C)=>x.createElement(K0,ue({index:p.originalDataIndex,key:"rectangle-".concat(p?.x,"-").concat(p?.y,"-").concat(p?.value,"-").concat(C),className:"recharts-bar-rectangle"},A0(y,p,C),{onMouseEnter:v(p,C),onMouseLeave:g(p,C),onClick:j(p,C)}),u?x.createElement(Zr,{shape:o,activeBar:u,baseProps:l,entry:p,index:C,dataKey:c}):x.createElement(zr,{shape:o,baseProps:l,entry:p,index:C,dataKey:c})))):null}function Wr(t){var{props:a,previousRectanglesRef:s}=t,{data:r,layout:n,isAnimationActive:i,animationBegin:l,animationDuration:o,animationEasing:c,onAnimationEnd:u,onAnimationStart:h}=a,m=s.current,f=pa(a,"recharts-bar-"),[y,v]=x.useState(!1),g=!y,j=x.useCallback(()=>{typeof u=="function"&&u(),v(!1)},[u]),p=x.useCallback(()=>{typeof h=="function"&&h(),v(!0)},[h]);return x.createElement(Hr,{showLabels:g,rects:r},x.createElement(fa,{animationId:f,begin:l,duration:o,isActive:i,easing:c,onAnimationEnd:j,onAnimationStart:p,key:f},C=>{var F=C===1?r:r?.map((A,I)=>{var w=m&&m[I];if(w)return H(H({},A),{},{x:de(w.x,A.x,C),y:de(w.y,A.y,C),width:de(w.width,A.width,C),height:de(w.height,A.height,C)});if(n==="horizontal"){var E=de(0,A.height,C),V=de(A.stackedBarStart,A.y,C);return H(H({},A),{},{y:V,height:E})}var q=de(0,A.width,C),R=de(A.stackedBarStart,A.x,C);return H(H({},A),{},{width:q,x:R})});return C>0&&(s.current=F??null),F==null?null:x.createElement(Ze,null,x.createElement(Kr,{props:a,data:F}))}),x.createElement(ga,{label:a.label}),a.children)}function qr(t){var a=x.useRef(null);return x.createElement(Wr,{previousRectanglesRef:a,props:t})}var W0=0,Yr=(t,a)=>{var s=Array.isArray(t.value)?t.value[1]:t.value;return{x:t.x,y:t.y,value:s,errorVal:k0(t,a)}};class Xr extends x.PureComponent{render(){var{hide:a,data:s,dataKey:r,className:n,xAxisId:i,yAxisId:l,needClip:o,background:c,id:u}=this.props;if(a||s==null)return null;var h=da("recharts-bar",n),m=u;return x.createElement(Ze,{className:h,id:u},o&&x.createElement("defs",null,x.createElement(ua,{clipPathId:m,xAxisId:i,yAxisId:l})),x.createElement(Ze,{className:"recharts-bar-rectangles",clipPath:o?"url(#clipPath-".concat(m,")"):void 0},x.createElement(Ur,{data:s,dataKey:r,background:c,allOtherBarProps:this.props}),x.createElement(qr,this.props)))}}var Qr={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",background:!1,hide:!1,isAnimationActive:"auto",label:!1,legendT
37ype:"rect",minPointSize:W0,xAxisId:0,yAxisId:0,zIndex:bt.bar};function Jr(t){var{xAxisId:a,yAxisId:s,hide:r,legendType:n,minPointSize:i,activeBar:l,animationBegin:o,animationDuration:c,animationEasing:u,isAnimationActive:h}=t,{needClip:m}=ia(a,s),f=la(),y=_0(),v=oa(t.children,We),g=ze(C=>kr(C,t.id,y,v));if(f!=="vertical"&&f!=="horizontal")return null;var j,p=g?.[0];return p==null||p.height==null||p.width==null?j=0:j=f==="vertical"?p.height/2:p.width/2,x.createElement(ca,{xAxisId:a,yAxisId:s,data:g,dataPointFormatter:Yr,errorBarOffset:j},x.createElement(Xr,ue({},t,{layout:f,needClip:m,data:g,xAxisId:a,yAxisId:s,hide:r,legendType:n,minPointSize:i,activeBar:l,animationBegin:o,animationDuration:c,animationEasing:u,isAnimationActive:h})))}function en(t){var{layout:a,barSettings:{dataKey:s,minPointSize:r,hasCustomShape:n},pos:i,bandSize:l,xAxis:o,yAxis:c,xAxisTicks:u,yAxisTicks:h,stackedData:m,displayedData:f,offset:y,cells:v,parentViewBox:g,dataStartIndex:j}=t,p=a==="horizontal"?c:o,C=m?p.scale.domain():null,F=xa({numericAxis:p}),A=p.scale.map(F);return f.map((I,w)=>{var E,V,q,R,$,D;if(m){var te=m[w+j];if(te==null)return null;E=ma(te,C)}else E=k0(I,s),Array.isArray(E)||(E=[F,E]);var Z=cr(r,W0)(E[1],w);if(a==="horizontal"){var X,Q=c.scale.map(E[0]),ae=c.scale.map(E[1]);if(Q==null||ae==null)return null;V=Mt({axis:o,ticks:u,bandSize:l,offset:i.offset,entry:I,index:w}),q=(X=ae??Q)!==null&&X!==void 0?X:void 0,R=i.size;var re=Q-ae;if($=ja(re)?0:re,D={x:V,y:y.top,width:R,height:y.height},Math.abs(Z)>0&&Math.abs($)<Math.abs(Z)){var ne=Pt($||Z)*(Math.abs(Z)-Math.abs($));q-=ne,$+=ne}}else{var ie=o.scale.map(E[0]),J=o.scale.map(E[1]);if(ie==null||J==null)return null;if(V=ie,q=Mt({axis:c,ticks:h,bandSize:l,offset:i.offset,entry:I,index:w}),R=J-ie,$=i.size,D={x:y.left,y:q,width:y.width,height:$},Math.abs(Z)>0&&Math.abs(R)<Math.abs(Z)){var O=Pt(R||Z)*(Math.abs(Z)-Math.abs(R));R+=O}}if(V==null||q==null||R==null||$==null||!n&&(R===0||$===0))return null;var z=H(H({},I),{},{stackedBarStart:A,x:V,y:q,width:R,height:$,value:m?E:E[1],payload:I,background:D,tooltipPosition:{x:V+R/2,y:q+$/2},parentViewBox:g,originalDataIndex:w},v&&v[w]&&v[w].props);return z}).filter(Boolean)}function tn(t){var a=ea(t,Qr),s=Er(a.stackId),r=_0();return x.createElement(ta,{id:a.id,type:"bar"},n=>x.createElement(x.Fragment,null,x.createElement(aa,{legendPayload:Vr(a)}),x.createElement(Gr,{dataKey:a.dataKey,stroke:a.stroke,strokeWidth:a.strokeWidth,fill:a.fill,name:a.name,hide:a.hide,unit:a.unit,tooltipType:a.tooltipType,id:n}),x.createElement(sa,{type:"bar",id:n,data:void 0,xAxisId:a.xAxisId,yAxisId:a.yAxisId,zAxisId:0,dataKey:a.dataKey,stackId:s,hide:a.hide,barSize:a.barSize,minPointSize:a.minPointSize,maxBarSize:a.maxBarSize,isPanorama:r,hasCustomShape:a.shape!=null}),x.createElement(yt,{zIndex:a.zIndex},x.createElement(Jr,ue({},a,{id:n})))))}var q0=x.memo(tn,J2);q0.displayName="Bar";var an=["axis","item"],sn=x.forwardRef((t,a)=>x.createElement(Ca,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:an,tooltipPayloadSearcher:wa,categoricalChartProps:t,ref:a}));const rn={better:"#7FA38B",worse:"#C2888B",same:"#b8b8bb",unknown:"#d1d5db"},Ct=t=>rn[t]||"#d1d5db",nn={0:{percent:100,label:"Vendor Favorable"},1:{percent:90,label:"Vendor Favorable"},2:{percent:80,label:"Vendor Favorable"},3:{percent:70,label:"Vendor Favorable"},4:{percent:60,label:"Balanced Favoring Vendor"},5:{percent:50,label:"Balanced"},6:{percent:60,label:"Balanced Favoring Customer"},7:{percent:70,label:"Customer Favorable"},8:{percent:80,label:"Customer Favorable"},9:{percent:90,label:"Customer Favorable"},10:{percent:100,label:"Customer Favorable"}},wt=t=>t==null?"#9ca3af":t<=3?"#6E6E72":t<=6?"#18A957":"#0D71EF",Y0=t=>t==null?null:nn[Math.round(t)]||null,pt=t=>{const a=Number(t);return Number.isFinite(a)?a<=-80?0:a<=-60?1:a<=-40?2:a<=-20?3:a<=-10?4:a<10?5:a<20?6:a<40?7:a<60?8:a<80?9:10:null},i0=t=>{const a=Y0(pt(t));return a?`${a.percent}% ${a.label}`:null},ln=(t,a=1)=>t==null?"â":Number(t).toFixed(a),ft=t=>{if(!t)return"â";const a=new Date(t);return Number.isNaN(a.getTime())?t:a.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})},je=({children:t,className:a=""})=>e.jsx("div",{className:`text-sm font-mono uppercase tracking-[0.18em] text-gray-500 ${a}`,children:t}),on=({v:t,active:a,onClick:s})=>e.jsxs("button",{onClick:s,className:`block text-left px-5 py-3 transition-colors cursor-pointer ${a?"w-[calc(100%-0.5rem)] bg-blue-50":"w-full hover:bg-gray-50"}`,children:[e.jsxs("span",{className:`block text-smd mb-2 ${a?"text-[#0073FF] font-semibold":"text-gray-900 font-medium"}`,children:["Version ",t.version]}),t.rating_percentile!=null&&e.jsx(Qe,{ratingPercentile:t.rating_percentile,size:"sm"})]}),cn=({active:t,payload:a})=>{if(!t||!a?.length)return null;const s=a[0].payload,r=Y0(s.pct);return e.jsxs("div",{className:"rounded-lg bg-blue-50 px-3.5 py-2.5 shadow-sm",children:[e.jsxs("div",{className:"text-[10px] font-mono uppercase tracking-[0.18em] text-gray-400",children:["Version ",s.v]}),r?e.jsxs("div",{className:"text-xs font-semibold mt-0.5",style:{color:wt(s.pct)},children:[r.percent,"% ",r.label]}):e.jsx("div",{className:"text-xs text-gray-400 mt-0.5",children:"No rating"})]})},dn={"1.75":{text:"Vendor",color:"#6E6E72"},5:{text:"Balanced",color:"#18A957"},"8.25":{text:"Customer",color:"#0D71EF"}},un=({y:t,payload:a})=>{const s=dn[String(a.value)];return s?e.jsxs("g",{children:[e.jsx("circle",{cx:12,cy:t,r:4,fill:s.color}),e.jsx("text",{x:24,y:t,dy:4,textAnchor:"start",fontSize:11,fontWeight:500,fill:"#4b5563",children:s.text})]}):null},xn=({x:t,y:a,payload:s,fromV:r,toV:n})=>{const i=Number(String(s.value).replace(/v/i,"")),l=i===r||i===n;return e.jsx("text",{x:t,y:a,dy:12,textAnchor:"middle",fontSize:11,fontWeight:l?700:400,fill:l?"#1A1A1A":"#9ca3af",children:s.value})},mn=({points:t,top:a,height:s,payload:r})=>{if(!t?.length)return null;const n=t[0].x,i=r?.[0]?.payload?.pct,l=i==null?a:a+(1-i/10)*s;return e.jsx("line",{x1:n,x2:n,y1:l,y2:a+s,stroke:"#94a3b8",strokeWidth:1,strokeDasharray:"4 4"})},hn=({versions:t,fromV:a,toV:s})=>{const r=x.useMemo(()=>[...t].sort((i,l)=>i.version-l.version).map(i=>({v:i.version,label:`V${i.version}`,pct:i.rating_percentile!=null?Number(i.rating_percentile):null})),[t]),n=i=>{const{cx:l,cy:o,payload:c}=i;if(l==null||o==null||c.pct==null)return null;const u=wt(c.pct);return c.v===a||c.v===s?e.jsxs("g",{children:[e.jsx("circle",{cx:l,cy:o,r:11,fill:u,fillOpacity:.16}),e.jsx("circle",{cx:l,cy:o,r:5.5,fill:u,stroke:"#fff",strokeWidth:2})]},c.v):e.jsx("circle",{cx:l,cy:o,r:5,fill:u,stroke:"#fff",strokeWidth:1.5},c.v)};return e.jsxs("div",{className:"border border-gray-200 rounded-2xl bg-white p-5 shadow-sm",children:[e.jsx(je,{className:"mb-4",children:"Favorability Trajectory"}),e.jsx(S0,{width:"100%",height:220,children:e.jsxs(_a,{data:r,margin:{top:6,right:12,bottom:0,left:4}
37,children:[e.jsx(E0,{dataKey:"label",tickLine:!1,axisLine:{stroke:"#e5e7eb"},tick:e.jsx(xn,{fromV:a,toV:s}),padding:{left:18,right:18}}),e.jsx(B0,{domain:[0,10],ticks:[1.75,5,8.25],interval:0,tickLine:!1,axisLine:!1,width:100,tick:e.jsx(un,{})}),e.jsx(Na,{content:e.jsx(cn,{}),cursor:e.jsx(mn,{}),position:{y:8},offset:12}),e.jsx(ka,{type:"linear",dataKey:"pct",stroke:"#9ca3af",strokeWidth:2,fill:"none",dot:n,activeDot:!1,connectNulls:!0})]})})]})},pn={"CABS Score":"Acceptability"},He=t=>pn[t]||t,fn={"CABS Score":"Market acceptability","Acceleration Score":"Procurement speed","Escalation Score":"Escalation risk","Friction Score":"Negotiation friction"},l0={"Escalation Score":t=>t.replace(/\s*escalation risk$/i,"").trim(),"Friction Score":t=>t.replace(/\s*friction$/i,"").trim()},it=(t,a)=>a&&l0[t]?l0[t](a):a,o0={"CABS Score":{better:"Its terms are more market-acceptable than before. Expect smoother internal approvals and less counterparty pushback on substance.",worse:"Its terms drifted further from market norms. Expect more scrutiny and a higher chance of negotiation on the off-standard clauses.",same:"Acceptability stayed in the same bucket â the contract is no more or less aligned with market standards than the earlier version."},"Acceleration Score":{better:"This version should move through procurement faster, with fewer blockers to clear before signature.",worse:"This version is likely to move more slowly, with more issues to resolve before it can close.",same:"Procurement speed stayed in the same bucket â expect a similar time-to-signature as the earlier version."},"Escalation Score":{better:"This version is less likely to need senior legal or executive escalation, so it can take a lighter approval path.",worse:"This version is more likely to need senior legal or executive escalation, which adds review layers and delay.",same:"Escalation likelihood stayed in the same bucket â expect a similar level of senior review as before."},"Friction Score":{better:"Expect less negotiation back-and-forth to reach signature than the earlier version.",worse:"Expect more negotiation back-and-forth, with more clauses likely to be contested before signing.",same:"Negotiation friction stayed in the same bucket â a similar amount of back-and-forth is likely."}},gn=({x:t,y:a,width:s,value:r})=>{if(r==null)return null;const n=t+s/2,i=48,l=24,o=a-l-8;return e.jsxs("g",{children:[e.jsx("rect",{x:n-i/2,y:o,width:i,height:l,rx:12,fill:"#fff",stroke:"#e5e7eb"}),e.jsx("text",{x:n,y:o+l/2,textAnchor:"middle",dominantBaseline:"central",fontSize:12,fontWeight:700,fill:"#1A1A1A",children:ln(r)})]})},vn=({metrics:t,fromV:a,toV:s})=>{const r=x.useMemo(()=>t.filter(w=>w.metric!=="Overall Clarity"&&w.metric!=="Overall Rating"),[t]),[n,i]=x.useState(r[0]?.metric),[l,o]=x.useState(!1),[c,u]=x.useState(!1),h=x.useRef(null);x.useEffect(()=>{if(!l)return;const w=E=>{h.current&&!h.current.contains(E.target)&&o(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[l]),x.useEffect(()=>u(!1),[n]);const m=r.find(w=>w.metric===n)||r[0];if(!m)return null;const f=Ia(m.metric),y=f?Ma(m.metric,m.from,m.to):m.direction,v=f?Ot[m.metric].getTier(m.to):null,g=f?Ot[m.metric].getTier(m.from):null,j=f?tt(g):m.from_band,p=f?tt(v):m.to_band,C=j&&p&&j!==p,F=xt(m.metric,m.from),A=xt(m.metric,m.to),I=[{label:`Version ${a}`,value:m.from},{label:`Version ${s}`,value:m.to}];return e.jsxs("div",{className:"border border-gray-200 rounded-2xl bg-white shadow-sm p-6 h-full min-h-[460px] flex flex-col relative",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 mb-4",children:[e.jsx(je,{children:"Metric Comparison"}),e.jsxs("div",{className:"relative",ref:h,children:[e.jsxs("button",{onClick:()=>o(w=>!w),className:"inline-flex items-center gap-2 px-4 py-2 border border-gray-200 rounded-lg text-[13px] font-semibold text-gray-700 hover:border-gray-300 transition-colors cursor-pointer min-w-[160px] justify-between",children:[He(m.metric),e.jsx(Pe,{className:`w-4 h-4 flex-shrink-0 text-gray-400 transition-transform ${l?"rotate-180":""}`})]}),l&&e.jsx("div",{className:"absolute right-0 top-full mt-1 w-full bg-white border border-gray-200 rounded-lg shadow-sm z-20 p-1",children:r.map(w=>e.jsx("button",{onClick:()=>{i(w.metric),o(!1)},className:`w-full text-left px-3 py-2 rounded text-xs transition-colors cursor-pointer ${w.metric===m.metric?"bg-blue-50 text-[#0073FF] font-semibold":"text-gray-700 hover:bg-gray-50"}`,children:He(w.metric)},w.metric))})]})]}),e.jsx("div",{children:p?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-smd font-semibold text-[#1A1A1A] leading-relaxed",children:[fn[m.metric]||"This signal"," ",C?e.jsxs(e.Fragment,{children:["moved from"," ",e.jsx("span",{className:"font-semibold",style:{color:F},children:it(m.metric,j)})," ","to"," ",e.jsx("span",{className:"font-semibold",style:{color:A},children:it(m.metric,p)})]}):e.jsxs(e.Fragment,{children:["is"," ",e.jsx("span",{className:"font-semibold",style:{color:A},children:it(m.metric,p)})]}),"."]}),o0[m.metric]?.[y]&&e.jsxs("p",{className:"text-[12px] text-gray-600 leading-relaxed mt-1.5",children:[o0[m.metric][y],f&&v&&e.jsxs(e.Fragment,{children:[" ","Here are some"," ",e.jsx("button",{onClick:()=>u(!0),className:"font-semibold text-[#0073FF] underline underline-offset-2 hover:text-blue-700 cursor-pointer",children:"recommended procurement actions"}),"."]})]})]}):e.jsx("span",{className:"text-sm text-gray-300",children:"â"})}),e.jsx("div",{className:"flex-1 min-h-[110px] mt-3",children:e.jsx(S0,{width:"100%",height:"100%",children:e.jsxs(sn,{data:I,margin:{top:38,right:12,bottom:0,left:4},barCategoryGap:"40%",children:[e.jsx(E0,{dataKey:"label",tickLine:!1,axisLine
37:{stroke:"#e5e7eb"},tick:{fontSize:11,fill:"#9ca3af"}}),e.jsx(B0,{hide:!0,domain:[0,"auto"]}),e.jsxs(q0,{dataKey:"value",radius:[4,4,0,0],maxBarSize:80,isAnimationActive:!1,children:[e.jsx(We,{fill:F,fillOpacity:.55}),e.jsx(We,{fill:A}),e.jsx(Fa,{dataKey:"value",content:gn})]})]})})}),f&&v&&c&&e.jsx("div",{className:"fixed inset-0 bg-gray-900/50 flex items-center justify-center z-[10000] p-4",onClick:()=>u(!1),children:e.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl w-full max-w-xl mx-4 max-h-[80vh] overflow-hidden border-6 border-blue-200 flex flex-col",onClick:w=>w.stopPropagation(),children:[e.jsxs("div",{className:"relative p-8 pb-6 text-center flex-shrink-0",children:[e.jsx("button",{onClick:()=>u(!1),className:"absolute top-4 right-4 p-2 hover:bg-gray-100 rounded-full transition-colors cursor-pointer","aria-label":"Close",children:e.jsx(y0,{className:"w-5 h-5 text-gray-400"})}),e.jsx("h2",{className:"text-2xl font-semibold text-[#000034]",children:"Recommended Procurement Actions"}),e.jsxs("p",{className:"text-md text-gray-500 mt-2",children:["Suggested next steps to act on ",He(m.metric)," for Version ",s,"."]})]}),e.jsxs("div",{className:"px-6 pb-4 overflow-y-auto custom-scrollbar",children:[e.jsxs("div",{className:"mb-6 bg-white border border-gray-100 rounded-xl p-4 flex items-center gap-4 shadow-sm",children:[e.jsx("div",{className:"w-10 h-10 bg-blue-600 rounded-full flex items-center justify-center flex-shrink-0",children:e.jsx(P0,{className:"w-5 h-5 text-white"})}),e.jsxs("p",{className:"text-[#000034] text-sm leading-snug",children:[e.jsx("span",{className:"font-bold",children:He(m.metric)})," is"," ",e.jsx("span",{className:"font-bold",children:tt(v)})," on Version ",s,"."]})]}),e.jsx("div",{className:"space-y-3",children:v.points.map((w,E)=>e.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-4 shadow-sm flex gap-3",children:[e.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-full bg-blue-50 text-[#0073FF] text-[12px] font-bold flex-shrink-0",children:E+1}),e.jsx("p",{className:"text-sm text-gray-700 leading-relaxed",children:w})]},E))})]}),e.jsx("div",{className:"p-6 pt-4 flex justify-center flex-shrink-0",children:e.jsx("button",{onClick:()=>u(!1),className:"bg-gradient-to-b from-[#6EB0FF] to-[#0D71EF] text-white font-semibold text-sm rounded-full px-12 py-3 transition-colors duration-200 hover:opacity-90 cursor-pointer",children:"Done"})})]})})]})},c0=({rp:t,label:a})=>{const s=wt(t);return e.jsx("span",{className:"px-2 py-0.5 rounded-full text-[10px] font-semibold whitespace-nowrap",style:{color:s,backgroundColor:`${s}1A`},children:a||"â"})},bn=({direction:t,pct:a})=>{const s=t==="better"?Ra:Da,r=Ct(t);return e.jsxs("span",{className:"inline-flex items-center gap-1 px-1 py-0.5 rounded-full text-[11px] font-semibold flex-shrink-0",style:{color:r},children:[e.jsx(s,{className:"w-3 h-3"}),a,"%"]})},d0=256,yn=({t,maxAbs:a})=>{const s=x.useRef(null),[r,n]=x.useState(!1),[i,l]=x.useState(0),o=t.direction==="better",c=Math.round(Math.abs(t.rating_delta)),u=Math.min(Math.abs(t.rating_delta)/a,1),h=i0(t.rating_from),m=i0(t.rating_to),f=j=>{const p=s.current?.getBoundingClientRect();p&&l(j.clientX-p.left)},y=s.current?.offsetWidth??0,v=d0/2,g=Math.max(v,Math.min(i,y-v));return e.jsxs("div",{ref:s,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),onMouseMove:f,className:"group relative grid grid-cols-2 gap-3 items-center",children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("span",{className:"text-[12px] text-gray-700 truncate",children:t.topic}),e.jsx(bn,{direction:t.direction,pct:c})]}),e.jsxs("div",{className:"relative h-2.5",children:[e.jsx("div",{className:"absolute left-1/2 -translate-x-1/2 top-0 bottom-0 w-px bg-gray-200"}),e.jsx("div",{className:`absolute top-1/2 -translate-y-1/2 h-2 ${o?"left-1/2 rounded-r-full":"right-1/2 rounded-l-full"}`,style:{width:`${u*50}%`,backgroundColor:Ct(t.direction)}})]}),r&&e.jsx("div",{className:"pointer-events-none absolute bottom-full mb-2 z-30 -translate-x-1/2",style:{left:g}
37,children:e.jsxs("div",{className:"relative w-64 rounded-xl border border-gray-100 bg-white p-3.5 shadow-xl",children:[e.jsx("div",{className:"text-[12px] font-bold text-[#1A1A1A] mb-2",children:t.topic}),m&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-gray-400 w-7 flex-shrink-0",children:"From"}),e.jsx(c0,{rp:pt(t.rating_from),label:h})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-gray-400 w-7 flex-shrink-0",children:"To"}),e.jsx(c0,{rp:pt(t.rating_to),label:m})]})]}),e.jsx("div",{className:"absolute -bottom-1 w-2 h-2 rotate-45 bg-white border-r border-b border-gray-100",style:{left:`${Math.max(12,Math.min(i-(g-v),d0-12))}px`}})]})})]})},jn=({topics:t})=>{const a=x.useMemo(()=>t.filter(r=>r.direction==="better"||r.direction==="worse").slice(0,8),[t]);if(!a.length)return null;const s=Math.max(...a.map(r=>Math.abs(r.rating_delta)),1);return e.jsxs("div",{className:"border border-gray-200 rounded-2xl bg-white shadow-sm p-6 h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 mb-5",children:[e.jsx(je,{children:"Topic Movement"}),e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3.5 py-1.5 rounded-full border border-gray-200 text-[13px] font-semibold text-gray-700",children:[e.jsx("img",{src:T0,alt:"",className:"w-4 h-4"}),"Favorability"]})]}),e.jsx("div",{className:"flex-1 flex flex-col justify-center gap-3.5",children:a.map(r=>e.jsx(yn,{t:r,maxAbs:s},r.topic))})]})},Cn=[{key:"bad_for_buyer",label:"Worse for Buyer",tone:"worse"},{key:"good_for_buyer",label:"Better for Buyer",tone:"better"}],_e=t=>t?t.split(/\s*[+â¢Â·]\s*/).map(a=>a.trim()).filter(Boolean):[],wn=({e:t})=>{const a=_e(t.from_answer),s=_e(t.to_answer),r=new Set(a),n=new Set(s),i=s.filter(u=>!r.has(u)),l=a.filter(u=>!n.has(u)),o=i.length===0&&l.length===0,c=Ct(t.direction);return e.jsxs("div",{children:[e.jsx("div",{className:"text-[12px] font-semibold text-[#1A1A1A] leading-snug mb-1.5",children:t.question}),e.jsxs("div",{className:"space-y-1.5",children:[l.map((u,h)=>e.jsxs("div",{className:"flex gap-2 text-[12px] leading-relaxed text-gray-400",children:[e.jsx("span",{className:"flex-shrink-0 font-bold",children:"â"}),e.jsx("span",{className:"line-through decoration-gray-300",children:u})]},`r${h}`)),i.map((u,h)=>e.jsxs("div",{className:"flex gap-2 text-[12px] leading-relaxed",children:[e.jsx("span",{className:"flex-shrink-0 font-bold",style:{color:c},children:"+"}),e.jsx("span",{style:{color:c},children:u})]},`a${h}`)),o&&e.jsx("div",{className:"text-[12px] text-gray-600 leading-relaxed",children:t.to_answer||"â"})]})]})},_n=({changelog:t})=>{const[a,s]=x.useState("bad_for_buyer"),r=t?.[a]||[],n=x.useMemo(()=>{const o=new Map;return r.forEach(c=>{const u=c.topic||"â";o.has(u)||o.set(u,[]),o.get(u).push(c)}),[...o.entries()]},[r]),[i,l]=x.useState(null);return x.useEffect(()=>{l(n[0]?.[0]??null)},[a]),e.jsxs("div",{className:"border border-gray-200 rounded-2xl bg-white shadow-sm overflow-hidden",children:[e.jsxs("div",{className:"px-5 pt-5 pb-4",children:[e.jsx(je,{className:"mb-4",children:"Clause Changelog"}),e.jsx("div",{className:"flex items-center gap-3",children:Cn.map(o=>{const c=t?.counts?.[o.key]??(t?.[o.key]?.length||0),u=a===o.key;return e.jsxs("button",{onClick:()=>s(o.key),className:`px-6 py-2 rounded-full text-[13px] font-semibold transition-all cursor-pointer whitespace-nowrap ${u?"text-white bg-gradient-to-b from-[#6EB0FF] to-[#0D71EF] shadow-sm hover:shadow-md":"text-gray-600 border border-gray-200 bg-white hover:bg-gray-50"}`,children:[o.label," (",c,")"]},o.key)})})]}),e.jsx("div",{className:"border-t border-gray-200"}),r.length===0?e.jsx("div",{className:"px-5 py-10 text-center text-[11px] font-mono uppercase tracking-[0.18em] text-gray-300",children:"No clauses in this bucket"}):e.jsx("div",{className:"divide-y divide-gray-100",children:n.map(([o,c])=>{const u=i===o;return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>l(u?null:o),className:"w-full flex items-center justify-between gap-3 px-5 py-4 hover:bg-gray-50 transition-colors cursor-pointer text-left",children:[e.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[e.jsx("span",{className:"text-smd font-semibold text-gray-900 leading-snug",children:o}),e.jsx("span",{className:"inline-flex items-center justify-center min-w-[24px] h-5 px-2 rounded-full bg-blue-50 text-[#0073FF] text-[11px] font-semibold flex-shrink-0",children:c.length})]}),e.jsx("span",{className:"flex items-center justify-center w-7 h-7 rounded-full bg-gray-100 text-gray-500 flex-shrink-0",children:e.jsx(Pe,{className:`w-4 h-4 transition-transform ${u?"rotate-180":""}`})})]}),e.jsx(v0,{initial:!1,children:u&&e.jsx(Ye.div,{initial:{height:0,opacity:0}
37,animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.25,ease:"easeInOut"},className:"overflow-hidden",children:e.jsx("div",{className:"px-5 pb-2 divide-y divide-gray-100",children:c.map((h,m)=>e.jsx("div",{className:"py-3",children:e.jsx(wn,{e:h})},`${a}-${m}`))})},"content")})]},o)})})]})},u0=t=>{if(!t)return"â";const a=new Date(t);return Number.isNaN(a.getTime())?t:a.toLocaleDateString("en-US")},Nn=({it:t,resolved:a})=>e.jsxs("div",{className:"relative border border-gray-200 rounded-xl p-4",children:[e.jsx("span",{className:"absolute top-3 right-3 flex items-center justify-center w-6 h-6 rounded-xl bg-blue-50",children:a?e.jsx(gt,{className:"w-3.5 h-3.5 text-[#0073FF]",strokeWidth:3}):e.jsx(y0,{className:"w-3.5 h-3.5 text-[#0073FF]",strokeWidth:3})}),e.jsx(je,{className:"pr-8",children:t.topic}),e.jsx("div",{className:"text-xs font-medium text-[#1A1A1A] leading-snug mt-2 pr-8",children:t.headline||t.question}),t.favourability&&e.jsx("span",{className:"inline-flex items-center mt-3 px-3 py-1 rounded-full border border-gray-300 text-[11px] text-gray-500",children:t.favourability})]}),x0=({items:t,resolvedSet:a})=>e.jsx("div",{className:"flex-1 min-w-0 p-4 flex flex-col gap-3",children:t.length===0?e.jsx("div",{className:"text-[11px] text-gray-300 font-mono uppercase tracking-wider py-6 text-center",children:"None"}):t.map((s,r)=>e.jsx(Nn,{it:s,resolved:a?.has(`${s.topic}|${s.headline||s.question}`)},`${s.question}-${r}`))}),m0=({version:t,date:a})=>e.jsxs("div",{className:"flex-1 px-5 py-3 text-center",children:[e.jsxs("span",{className:"text-sm font-bold text-[#1A1A1A]",children:["Version ",t]}),e.jsx("span",{className:"text-gray-300 mx-2.5",children:"|"}),e.jsxs("span",{className:"text-xs text-gray-500",children:["Published:"," ",e.jsx("span",{className:"font-medium text-gray-700",children:a})]})]}),kn=({top3:t,changelog:a,fromV:s,toV:r,fromMeta:n,toMeta:i})=>{const l=x.useMemo(()=>{const c=new Set;return(a?.good_for_buyer||[]).forEach(u=>{const h=new Set(_e(u.to_answer));_e(u.from_answer).forEach(m=>{h.has(m)||c.add(`${u.topic}|${m}`)})}),c},[a]),o=x.useMemo(()=>{const c=new Set;return(a?.good_for_buyer||[]).forEach(u=>{const h=new Set(_e(u.from_answer));_e(u.to_answer).forEach(m=>{h.has(m)||c.add(`${u.topic}|${m}`)})}),c},[a]);return e.jsxs("div",{className:"border border-gray-200 rounded-2xl bg-white shadow-sm overflow-hidden",children:[e.jsx(je,{className:"px-5 pt-5",children:"Highest Impact Changes"}),e.jsx("div",{className:"px-5 pb-5 pt-3",children:e.jsxs("div",{className:"border border-gray-200 rounded-xl overflow-hidden",children:[e.jsxs("div",{className:"flex bg-blue-50 border-b border-gray-200",children:[e.jsx(m0,{version:s,date:u0(n?.done_date)}),e.jsx("div",{className:"w-px bg-gray-200"}),e.jsx(m0,{version:r,date:u0(i?.done_date)})]}),e.jsxs("div",{className:"flex",children:[e.jsx(x0,{items:t?.from||[],resolvedSet:l}),e.jsx("div",{className:"w-px bg-gray-200"}),e.jsx(x0,{items:t?.to||[],resolvedSet:o})]})]})})]})},Fn=({contractId:t,versions:a,fromV:s,toV:r})=>{const n=Se(),i=T(m=>m.auth.user?.tokens?.jwt),{data:l,loading:o,error:c}=T(f2(t,s,r));x.useEffect(()=>{!t||!i||s==null||r==null||s!==r&&(l||n(g2({contractId:t,from:s,to:r,authToken:i})))},[t,i,s,r,l,n]);const u=a.find(m=>m.version===s),h=a.find(m=>m.version===r);return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-xl font-bold text-[#1A1A1A] leading-none",children:["Version ",s]}),e.jsx("p",{className:"text-xs text-gray-400 mt-1.5",children:ft(u?.done_date)})]}),e.jsx("span",{className:"flex items-center justify-center w-11 h-11 rounded-full bg-blue-50 flex-shrink-0",children:e.jsx(v2,{className:"w-6 h-6 text-[#0073FF]",strokeWidth:2.75})}),e.jsxs("div",{children:[e.jsxs("h2",{className:"text-xl font-bold text-[#1A1A1A] leading-none",children:["Version ",r]}),e.jsx("p",{className:"text-xs text-gray-400 mt-1.5",children:ft(h?.done_date)})]})]}),c?e.jsx("div",{className:"py-16 text-center text-[11px] font-mono uppercase tracking-[0.18em] text-gray-300",children:"Could not load comparison"}):o||!l?e.jsx(An,{}):e.jsxs(e.Fragment,{children:[e.jsx(hn,{versions:a,fromV:s,toV:r}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 items-stretch",children:[Array.isArray(l.trajectory)&&l.trajectory.length>0&&e.jsx(vn,{metrics:l.trajectory,fromV:s,toV:r}),Array.isArray(l.topic_movement)&&e.jsx(jn,{topics:l.topic_movement})]}),l.clause_changelog&&e.jsx(_n,{changelog:l.clause_changelog}),l.top3&&e.jsx(kn,{top3:l.top3,changelog:l.clause_changelog,fromV:s,toV:r,fromMeta:u,toMeta:h})]})]})},An=()=>e.jsxs("div",{className:"space-y-4 animate-pulse",children:[e.jsx("div",{className:"h-52 bg-white border border-gray-200 rounded-lg"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx("div",{className:"h-32 bg-white border border-gray-200 rounded-lg"}),e.jsx("div",{className:"h-32 bg-white border border-gray-200 rounded-lg"})]}),e.jsx("div",{className:"h-64 bg-white border border-gray-200 rounded-lg"})]}),Sn=({v:t})=>e.jsxs("div",{children:[e.jsxs("h2",{className:"text-2xl font-bold text-[#1A1A1A]",children:["Version ",t.version]}),e.jsxs("p",{className:"text-sm text-gray-500 mt-1.5 mb-6",children:["Completed ",ft(t.done_date)]}),e.jsx("div",{className:"border border-gray-200 rounded-lg bg-white p-8 text-center",children:e.jsx("p",{className:"text-sm text-gray-500 leading-relaxed max-w-sm mx-auto",children:"This contract has a single version. Re-upload it to build a version history and unlock side-by-side comparison analytics."})})]}
37),En=({focusV:t,fromV:a,toV:s,onSelectFocus:r})=>{const{contractId:n}=Ae(),i=Se(),l=T(v=>v.auth.user?.tokens?.jwt),{data:o,loading:c,error:u}=T(b0(n));x.useEffect(()=>{!n||!l||o||i(p2({contractId:n,authToken:l}))},[n,l,o,i]);const h=o?.versions||[],m=x.useMemo(()=>[...h].sort((v,g)=>g.version-v.version),[h]);if(c||!o&&!u)return e.jsx("div",{className:"h-full flex items-center justify-center text-[11px] font-mono uppercase tracking-[0.18em] text-gray-300",children:"Loading versionsâ¦"});if(u)return e.jsx("div",{className:"h-full flex items-center justify-center text-[11px] font-mono uppercase tracking-[0.18em] text-gray-300",children:"Could not load analytics"});const f=h.length>=2,y=h.find(v=>v.version===t)||m[0];return e.jsxs("div",{className:"h-full flex gap-6 px-6 py-6 bg-[#F9F9FB] overflow-hidden",children:[e.jsxs("aside",{className:"w-[24%] min-w-[260px] flex-shrink-0 h-full bg-white border border-gray-200 rounded-2xl shadow-sm flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-5 pt-5 pb-4 border-b border-gray-200 flex-shrink-0",children:[e.jsx(je,{children:"Versions"}),e.jsxs("div",{className:"text-xl font-bold text-[#1A1A1A] mt-1.5 leading-none",children:[h.length," ",h.length===1?"Version":"Versions"]}),o?.only_one_version&&e.jsx("p",{className:"text-xs text-gray-500 mt-2 leading-relaxed",children:"No re-upload history yet â only v1 is available."})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto custom-scrollbar divide-y divide-gray-200",children:m.map(v=>e.jsx(on,{v,active:v.version===t,onClick:()=>r(v.version)},v.contract_id))})]}),e.jsx("div",{className:"flex-1 min-w-0 h-full overflow-y-auto custom-scrollbar pr-1",children:f?a!=null&&s!=null?e.jsx(Fn,{contractId:n,versions:h,fromV:a,toV:s}):e.jsx("div",{className:"h-full flex items-center justify-center text-[11px] font-mono uppercase tracking-[0.18em] text-gray-300",children:"Preparing comparisonâ¦"}):y?e.jsx(Sn,{v:y}):e.jsx("div",{className:"h-full flex items-center justify-center text-[11px] font-mono uppercase tracking-[0.18em] text-gray-300",children:"Select a version"})})]})},Bn="data:image/svg+xml,%3csvg%20width='383'%20height='383'%20viewBox='0%200%20383%20383'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20filter='url(%23filter0_i_2916_4056)'%3e%3cpath%20d='M328.497%20191.461C328.497%20267.146%20267.142%20328.5%20191.458%20328.5C115.773%20328.5%2054.4185%20267.146%2054.4185%20191.461C54.4185%20115.776%20115.773%2054.4219%20191.458%2054.4219C267.142%2054.4219%20328.497%20115.776%20328.497%20191.461ZM92.3002%20191.461C92.3002%20246.224%20136.695%20290.619%20191.458%20290.619C246.221%20290.619%20290.615%20246.224%20290.615%20191.461C290.615%20136.698%20246.221%2092.3036%20191.458%2092.3036C136.695%2092.3036%2092.3002%20136.698%2092.3002%20191.461Z'%20fill='%23F7F7F7'/%3e%3c/g%3e%3cpath%20d='M153.822%2079.5182C150.489%2069.6028%20139.667%2064.1526%20130.305%2068.8206C104.263%2081.8061%2082.8688%20102.836%2069.4638%20129.033C53.1651%20160.885%2049.97%20197.848%2060.5612%20232.024C71.1524%20266.2%2094.6898%20294.879%20126.144%20311.932C157.598%20328.985%20194.475%20333.06%20228.894%20323.286C263.312%20313.512%20292.544%20290.665%20310.341%20259.626C328.139%20228.587%20333.092%20191.818%20324.141%20157.176C315.19%20122.534%20293.045%2092.7666%20262.439%2074.2344C237.267%2058.9924%20208.013%2052.3445%20179.032%2054.9837C168.615%2055.9324%20162.272%2066.2566%20164.647%2076.4442C167.022%2086.6318%20177.238%2092.7699%20187.692%2092.3726C206.93%2091.6413%20226.116%2096.5256%20242.818%20106.639C264.964%20120.048%20280.987%20141.587%20287.463%20166.653C293.94%20191.719%20290.357%20218.323%20277.479%20240.782C264.601%20263.241%20243.45%20279.773%20218.546%20286.845C193.641%20293.917%20166.959%20290.969%20144.199%20278.63C121.44%20266.29%20104.409%20245.539%2096.7452%20220.811C89.0817%20196.082%2091.3936%20169.337%20103.187%20146.29C112.081%20128.908%20125.837%20114.669%20142.588%20105.181C151.69%20100.025%20157.156%2089.4335%20153.822%2079.5182Z'%20fill='url(%23paint0_linear_2916_4056)'/%3e%3ccircle%20cx='135.326'%20cy='86.8158'%20r='13.7211'%20stroke='white'%20stroke-width='5'/%3e%3cdefs%3e%3cfilter%20id='filter0_i_2916_4056'%20x='54.4185'%20y='54.4219'%20width='274.079'%20height='278.078'%20filterUnits='userSpaceOnUse'%20color-interpolation-filters='sRGB'%3e%3cfeFlood%20flood-opacity='0'%20result='Backgroun
37dImageFix'/%3e%3cfeBlend%20mode='normal'%20in='SourceGraphic'%20in2='BackgroundImageFix'%20result='shape'/%3e%3cfeColorMatrix%20in='SourceAlpha'%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%20127%200'%20result='hardAlpha'/%3e%3cfeOffset%20dy='4'/%3e%3cfeGaussianBlur%20stdDeviation='10'/%3e%3cfeComposite%20in2='hardAlpha'%20operator='arithmetic'%20k2='-1'%20k3='1'/%3e%3cfeColorMatrix%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200.1%200'/%3e%3cfeBlend%20mode='normal'%20in2='shape'%20result='effect1_innerShadow_2916_4056'/%3e%3c/filter%3e%3clinearGradient%20id='paint0_linear_2916_4056'%20x1='336.523'%20y1='157.84'%20x2='46.3946'%20y2='225.078'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%230373FC'/%3e%3cstop%20offset='1'%20stop-color='%2384BCFF'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",In="data:image/svg+xml,%3csvg%20width='383'%20height='383'%20viewBox='-3%20-3%20383%20383'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20filter='url(%23filter0_i_2916_4049)'%3e%3cpath%20d='M325.124%20188.089C325.124%20263.774%20263.769%20325.128%20188.085%20325.128C112.4%20325.128%2051.0454%20263.774%2051.0454%20188.089C51.0454%20112.404%20112.4%2051.0498%20188.085%2051.0498C263.769%2051.0498%20325.124%20112.404%20325.124%20188.089ZM88.9272%20188.089C88.9272%20242.852%20133.321%20287.247%20188.085%20287.247C242.848%20287.247%20287.242%20242.852%20287.242%20188.089C287.242%20133.326%20242.848%2088.9316%20188.085%2088.9316C133.321%2088.9316%2088.9272%20133.326%2088.9272%20188.089Z'%20fill='%23F7F7F7'/%3e%3c/g%3e%3cpath%20d='M109.902%2099.5735C102.977%2091.7334%2090.8881%2090.9173%2084.0768%2098.8567C66.6906%20119.123%2055.5087%20144.146%2052.1276%20170.91C47.9506%20203.973%2055.9646%20237.424%2074.6697%20265.005C93.3749%20292.586%20121.489%20312.405%20153.752%20320.755C186.014%20329.104%20220.214%20325.411%20249.95%20310.367C279.687%20295.323%20302.922%20269.959%20315.308%20239.021C327.694%20208.083%20328.383%20173.691%20317.244%20142.282C306.105%20110.874%20283.903%2084.6%20254.793%2068.3782C231.228%2055.247%20204.444%2049.4309%20177.817%2051.432C167.386%2052.2159%20160.881%2062.4386%20163.095%2072.6624C165.309%2082.8863%20175.427%2089.1851%20185.885%2088.953C203.409%2088.5641%20220.845%2092.8272%20236.353%20101.469C257.417%20113.207%20273.481%20132.218%20281.541%20154.944C289.601%20177.67%20289.103%20202.555%20280.14%20224.941C271.178%20247.327%20254.365%20265.68%20232.849%20276.565C211.333%20287.451%20186.587%20290.123%20163.243%20284.081C139.899%20278.04%20119.556%20263.699%20106.021%20243.742C92.4869%20223.786%2086.6883%20199.581%2089.7106%20175.658C91.9358%20158.044%2098.8304%20141.472%20109.525%20127.585C115.908%20119.297%20116.828%20107.414%20109.902%2099.5735Z'%20fill='url(%23paint0_linear_2916_4049)'/%3e%3ccircle%20cx='96.8486'%20cy='111.849'%20r='13.7211'%20stroke='white'%20stroke-width='5'/%3e%3cdefs%3e%3cfilter%20id='filter0_i_2916_4049'%20x='51.0454'%20y='51.0498'%20width='274.079'%20height='278.078'%20filterUnits='userSpaceOnUse'%20color-interpolation-filters='sRGB'%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'/%3e%3cfeBlend%20mode='normal'%20in='SourceGraphic'%20in2='BackgroundImageFix'%20result='shape'/%3e%3cfeColorMatrix%20in='SourceAlpha'%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%20127%200'%20result='hardAlpha'/%3e%3cfeOffset%20dy='4'/%3e%3cfeGaussianBlur%20stdDeviation='10'/%3e%3cfeComposite%20in2='hardAlpha'%20operator='arithmetic'%20k2='-1'%20k3='1'/%3e%3cfeColorMatrix%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200.1%200'/%3e%3cfeBlend%20mode='normal'%20in2='shape'%20result='effect1_innerShadow_2916_4049'/%3e%3c/filter%3e%3clinearGradient%20id='paint0_linear_2916_4049'%20x1='308.68'%20y1='100.73'%20x2='67.4924'%20y2='275.442'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%230373FC'/%3e%3cstop%20offset='1'%20stop-color='%2384BCFF'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",Mn="data:image/svg+xml,%3csvg%20width='383'%20height='383'%20viewBox='-40.5%20-40.5%20383%20383'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20filter='url(%23filter0_i_2916_4063)'%3e%3cpath%20d='M287.941%20150.906C287.941%20226.591%20226.587%20287.946%20150.902%20287.946C75.2174%20287.946%2013.8628%20226.591%2013.8628%20150.906C13.8
37628%2075.2218%2075.2174%2013.8672%20150.902%2013.8672C226.587%2013.8672%20287.941%2075.2218%20287.941%20150.906ZM51.7446%20150.906C51.7446%20205.67%2096.1389%20250.064%20150.902%20250.064C205.665%20250.064%20250.06%20205.67%20250.06%20150.906C250.06%2096.1433%20205.665%2051.7489%20150.902%2051.7489C96.1389%2051.7489%2051.7446%2096.1433%2051.7446%20150.906Z'%20fill='%23F7F7F7'/%3e%3c/g%3e%3cpath%20d='M42.7102%20103.561C33.1268%2099.3672%2021.8191%20103.719%2018.9859%20113.789C12.4763%20136.927%2012.1371%20161.486%2018.1693%20184.982C25.7794%20214.623%2043.0923%20240.865%2067.3489%20259.524C91.6055%20278.183%20121.41%20288.186%20152.012%20287.939C182.614%20287.691%20212.252%20277.208%20236.204%20258.159C260.156%20239.11%20277.042%20212.592%20284.172%20182.831C291.302%20153.07%20288.265%20121.779%20275.545%2093.9449C262.825%2066.1105%20241.154%2043.3348%20213.987%2029.2474C192.452%2018.0811%20168.446%2012.8829%20144.438%2014.0171C133.988%2014.5107%20127.202%2024.5485%20129.131%2034.8299C131.06%2045.1114%20140.998%2051.6891%20151.459%2051.7478C167.069%2051.8354%20182.532%2055.609%20196.549%2062.8769C216.206%2073.0701%20231.887%2089.55%20241.09%20109.69C250.294%20129.83%20252.492%20152.471%20247.333%20174.005C242.174%20195.54%20229.955%20214.727%20212.624%20228.51C195.294%20242.294%20173.848%20249.879%20151.705%20250.058C129.563%20250.237%20107.997%20242.999%2090.446%20229.498C72.8946%20215.997%2060.3675%20197.009%2054.8611%20175.562C50.9349%20160.269%2050.739%20144.353%2054.1677%20129.124C56.4653%20118.919%2052.2937%20107.754%2042.7102%20103.561Z'%20fill='url(%23paint0_linear_2916_4063)'/%3e%3ccircle%20cx='36.0678'%20cy='120.666'%20r='13.7211'%20stroke='white'%20stroke-width='5'/%3e%3cdefs%3e%3cfilter%20id='filter0_i_2916_4063'%20x='13.8628'%20y='13.8672'%20width='274.079'%20height='278.078'%20filterUnits='userSpaceOnUse'%20color-interpolation-filters='sRGB'%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'/%3e%3cfeBlend%20mode='normal'%20in='SourceGraphic'%20in2='BackgroundImageFix'%20result='shape'/%3e%3cfeColorMatrix%20in='SourceAlpha'%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%20127%200'%20result='hardAlpha'/%3e%3cfeOffset%20dy='4'/%3e%3cfeGaussianBlur%20stdDeviation='10'/%3e%3cfeComposite%20in2='hardAlpha'%20operator='arithmetic'%20k2='-1'%20k3='1'/%3e%3cfeColorMatrix%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200.1%200'/%3e%3cfeBlend%20mode='normal'%20in2='shape'%20result='effect1_innerShadow_2916_4063'/%3e%3c/filter%3e%3clinearGradient%20id='paint0_linear_2916_4063'%20x1='223.479'%20y1='20.8781'%20x2='78.3283'%20y2='280.93'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%230373FC'/%3e%3cstop%20offset='1'%20stop-color='%2384BCFF'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",Pn="data:image/svg+xml,%3csvg%20width='383'%20height='383'%20viewBox='-5%20-5%20383%20383'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20filter='url(%23filter0_i_2916_4069)'%3e%3cpath%20d='M323.153%20186.115C323.153%20261.8%20261.798%20323.155%20186.113%20323.155C110.429%20323.155%2049.0742%20261.8%2049.0742%20186.115C49.0742%20110.431%20110.429%2049.0762%20186.113%2049.0762C261.798%2049.0762%20323.153%20110.431%20323.153%20186.115ZM86.956%20186.115C86.956%20240.879%20131.35%20285.273%20186.113%20285.273C240.877%20285.273%20285.271%20240.879%20285.271%20186.115C285.271%20131.352%20240.877%2086.9579%20186.113%2086.9579C131.35%2086.9579%2086.956%20131.352%2086.956%20186.115Z'%20fill='%23F7F7F7'/%3e%3c/g%3e%3cpath%20d='M70.3112%20209.281C60.0536%20211.333%2053.2776%20221.377%2056.7232%20231.254C63.3926%20250.372%2074.2441%20267.853%2088.5769%20282.376C107.364%20301.412%20131.31%20314.535%20157.465%20320.126C183.619%20325.718%20210.838%20323.534%20235.766%20313.844C260.695%20304.154%20282.243%20287.381%20297.754%20265.593C313.265%20243.805%20322.062%20217.954%20323.059%20191.227C324.057%20164.5%20317.212%20138.065%20303.368%20115.181C289.524%2092.2978%20269.286%2073.9652%20245.149%2062.4438C226.735%2053.6538%20206.666%2049.1214%20186.418%2049.0767C175.957%2049.0536%20168.684%2058.7439%20170.102%2069.108C171.52%2079.4722%20181.122%2086.5329%20191.567%2087.1081C204.431%2087.8165%202
3717.095%2091.0286%20228.831%2096.6304C246.295%20104.967%20260.939%20118.232%20270.956%20134.79C280.973%20151.348%20285.926%20170.475%20285.204%20189.814C284.482%20209.153%20278.117%20227.858%20266.894%20243.623C255.67%20259.388%20240.079%20271.525%20222.041%20278.536C204.004%20285.548%20184.309%20287.128%20165.385%20283.082C146.46%20279.036%20129.133%20269.541%20115.539%20255.767C106.405%20246.511%2099.225%20235.595%2094.3454%20223.672C90.3833%20213.991%2080.5687%20207.229%2070.3112%20209.281Z'%20fill='url(%23paint0_linear_2916_4069)'/%3e%3ccircle%20cx='74.4325'%20cy='226.88'%20r='13.7211'%20stroke='white'%20stroke-width='5'/%3e%3cdefs%3e%3cfilter%20id='filter0_i_2916_4069'%20x='49.0742'%20y='49.0762'%20width='274.079'%20height='278.078'%20filterUnits='userSpaceOnUse'%20color-interpolation-filters='sRGB'%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'/%3e%3cfeBlend%20mode='normal'%20in='SourceGraphic'%20in2='BackgroundImageFix'%20result='shape'/%3e%3cfeColorMatrix%20in='SourceAlpha'%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%20127%200'%20result='hardAlpha'/%3e%3cfeOffset%20dy='4'/%3e%3cfeGaussianBlur%20stdDeviation='10'/%3e%3cfeComposite%20in2='hardAlpha'%20operator='arithmetic'%20k2='-1'%20k3='1'/%3e%3cfeColorMatrix%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200.1%200'/%3e%3cfeBlend%20mode='normal'%20in2='shape'%20result='effect1_innerShadow_2916_4069'/%3e%3c/filter%3e%3clinearGradient%20id='paint0_linear_2916_4069'%20x1='171.128'%20y1='37.9628'%20x2='201.103'%20y2='334.269'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%230373FC'/%3e%3cstop%20offset='1'%20stop-color='%2384BCFF'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",Tn="data:image/svg+xml,%3csvg%20width='383'%20height='383'%20viewBox='-4%20-4%20383%20383'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20filter='url(%23filter0_i_2916_4075)'%3e%3cpath%20d='M324.398%20187.351C324.398%20263.035%20263.043%20324.39%20187.359%20324.39C111.674%20324.39%2050.3193%20263.035%2050.3193%20187.351C50.3193%20111.666%20111.674%2050.3115%20187.359%2050.3115C263.043%2050.3115%20324.398%20111.666%20324.398%20187.351ZM88.2011%20187.351C88.2011%20242.114%20132.595%20286.508%20187.359%20286.508C242.122%20286.508%20286.516%20242.114%20286.516%20187.351C286.516%20132.588%20242.122%2088.1933%20187.359%2088.1933C132.595%2088.1933%2088.2011%20132.588%2088.2011%20187.351Z'%20fill='%23F7F7F7'/%3e%3c/g%3e%3cpath%20d='M100.037%20266.87C92.3017%20273.912%2091.668%20286.012%2099.7092%20292.703C112.845%20303.633%20127.954%20312.046%20144.282%20317.453C166.625%20324.851%20190.498%20326.371%20213.599%20321.864C236.7%20317.358%20258.251%20306.978%20276.175%20291.724C294.1%20276.47%20307.793%20256.856%20315.936%20234.773C324.08%20212.69%20326.398%20188.882%20322.668%20165.643C318.938%20142.404%20309.285%20120.517%20294.641%20102.092C279.996%2083.6663%20260.852%2069.3233%20239.054%2060.4449C223.125%2053.9569%20206.171%2050.5468%20189.084%2050.3319C178.624%2050.2002%20171.251%2059.8145%20172.562%2070.1928C173.873%2080.5711%20183.401%2087.7312%20193.839%2088.4147C204.422%2089.1076%20214.867%2091.4967%20224.764%2095.5281C240.537%20101.952%20254.388%20112.33%20264.985%20125.662C275.582%20138.995%20282.566%20154.831%20285.265%20171.646C287.964%20188.461%20286.286%20205.688%20280.394%20221.667C274.502%20237.645%20264.594%20251.837%20251.624%20262.874C238.655%20273.912%20223.061%20281.423%20206.346%20284.683C189.63%20287.944%20172.357%20286.845%20156.19%20281.491C146.044%20278.132%20136.549%20273.168%20128.05%20266.824C119.667%20260.567%20107.771%20259.827%20100.037%20266.87Z'%20fill='url(%23paint0_linear_2916_4075)'/%3e%3ccircle%20cx='112.466'%20cy='280.122'%20r='13.7211'%20stroke='white'%20stroke-width='5'/%3e%3cdefs%3e%3cfilter%20id='filter0_i_2916_4075'%20x='50.3193'%20y='50.3115'%20width='274.079'%20height='278.078'%20filterUnits='userSpaceOnUse'%20color-interpolation-filters='sRGB'%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'/%3e%3cfeBlend%20mode='normal'%20in='SourceGraphic'%20in2='Backgroun
37dImageFix'%20result='shape'/%3e%3cfeColorMatrix%20in='SourceAlpha'%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%20127%200'%20result='hardAlpha'/%3e%3cfeOffset%20dy='4'/%3e%3cfeGaussianBlur%20stdDeviation='10'/%3e%3cfeComposite%20in2='hardAlpha'%20operator='arithmetic'%20k2='-1'%20k3='1'/%3e%3cfeColorMatrix%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200.1%200'/%3e%3cfeBlend%20mode='normal'%20in2='shape'%20result='effect1_innerShadow_2916_4075'/%3e%3c/filter%3e%3clinearGradient%20id='paint0_linear_2916_4075'%20x1='98.1962'%20y1='68.0974'%20x2='276.525'%20y2='306.623'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%230373FC'/%3e%3cstop%20offset='1'%20stop-color='%2384BCFF'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",On="data:image/svg+xml,%3csvg%20width='383'%20height='383'%20viewBox='-35.5%20-35.5%20383%20383'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20filter='url(%23filter0_i_2916_4081)'%3e%3cpath%20d='M293.027%20155.991C293.027%20231.676%20231.672%20293.031%20155.988%20293.031C80.3028%20293.031%2018.9482%20231.676%2018.9482%20155.991C18.9482%2080.3067%2080.3028%2018.9521%20155.988%2018.9521C231.672%2018.9521%20293.027%2080.3067%20293.027%20155.991ZM56.83%20155.991C56.83%20210.755%20101.224%20255.149%20155.988%20255.149C210.751%20255.149%20255.145%20210.755%20255.145%20155.991C255.145%20101.228%20210.751%2056.8339%20155.988%2056.8339C101.224%2056.8339%2056.83%20101.228%2056.83%20155.991Z'%20fill='%23F7F7F7'/%3e%3c/g%3e%3cpath%20d='M137.724%20272.667C136.106%20283.002%20143.191%20292.83%20153.65%20293.009C166.499%20293.228%20179.347%20291.639%20191.811%20288.264C210.387%20283.233%20227.695%20274.347%20242.608%20262.182C257.521%20250.018%20269.705%20234.849%20278.366%20217.664C287.027%20200.478%20291.971%20181.66%20292.877%20162.437C293.782%20143.213%20290.628%20124.014%20283.621%20106.091C276.614%2088.1668%20265.909%2071.9199%20252.206%2058.4079C238.502%2044.8959%20222.106%2034.4217%20204.085%2027.6674C191.993%2023.1353%20179.352%2020.3462%20166.54%2019.3568C156.11%2018.5515%20148.132%2027.6705%20148.772%2038.1117C149.411%2048.5529%20158.458%2056.3122%20168.83%2057.6669C176.315%2058.6444%20183.684%2060.4759%20190.79%2063.1394C203.829%2068.0266%20215.693%2075.6054%20225.609%2085.3823C235.524%2095.1592%20243.269%20106.915%20248.34%20119.884C253.41%20132.853%20255.692%20146.745%20255.037%20160.655C254.382%20174.564%20250.804%2
370188.18%20244.537%20200.615C238.27%20213.05%20229.455%20224.026%20218.664%20232.828C207.873%20241.629%20195.35%20248.059%20181.909%20251.699C174.583%20253.683%20167.075%20254.814%20159.532%20255.084C149.078%20255.457%20139.342%20262.332%20137.724%20272.667Z'%20fill='url(%23paint0_linear_2916_4081)'/%3e%3ccircle%20cx='155.884'%20cy='274.752'%20r='13.7211'%20stroke='white'%20stroke-width='5'/%3e%3cdefs%3e%3cfilter%20id='filter0_i_2916_4081'%20x='18.9482'%20y='18.9521'%20width='274.079'%20height='278.078'%20filterUnits='userSpaceOnUse'%20color-interpolation-filters='sRGB'%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'/%3e%3cfeBlend%20mode='normal'%20in='SourceGraphic'%20in2='BackgroundImageFix'%20result='shape'/%3e%3cfeColorMatrix%20in='SourceAlpha'%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%20127%200'%20result='hardAlpha'/%3e%3cfeOffset%20dy='4'/%3e%3cfeGaussianBlur%20stdDeviation='10'/%3e%3cfeComposite%20in2='hardAlpha'%20operator='arithmetic'%20k2='-1'%20k3='1'/%3e%3cfeColorMatrix%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200.1%200'/%3e%3cfeBlend%20mode='normal'%20in2='shape'%20result='effect1_innerShadow_2916_4081'/%3e%3c/filter%3e%3clinearGradient%20id='paint0_linear_2916_4081'%20x1='11.7795'%20y1='118.875'%20x2='300.199'%20y2='193.103'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%230373FC'/%3e%3cstop%20offset='1'%20stop-color='%2384BCFF'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",Ln="data:image/svg+xml,%3csvg%20width='383'%20height='383'%20viewBox='-52%20-52%20383%20383'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20filter='url(%23filter0_i_149_2)'%3e%3cpath%20d='M2.12485%20139.167C2.12485%20214.851%2063.4794%20276.206%20139.164%20276.206C214.849%20276.206%20276.203%20214.851%20276.203%20139.167C276.203%2063.482%20214.849%202.12744%20139.164%202.12744C63.4794%202.12744%202.12485%2063.482%202.12485%20139.167ZM238.322%20139.167C238.322%20193.93%20193.927%20238.324%20139.164%20238.324C84.4009%20238.324%2040.0066%20193.93%2040.0066%20139.167C40.0066%2084.4035%2084.4009%2040.0092%20139.164%2040.0092C193.927%2040.0092%20238.322%2084.4035%20238.322%20139.167Z'%20fill='%23F7F7F7'/%3e%3c/g%3e%3cpath%20d='M137.319%2021.0805C137.155%2010.621%20145.539%201.87424%20155.922%203.15339C178.131%205.88976%20199.435%2014.0382%20217.907%2027.0066C241.57%2043.6199%20259.373%2067.292%20268.768%2094.636C278.162%20121.98%20278.668%20151.595%20270.212%20179.244C263.611%20200.826%20251.814%20220.348%20235.976%20236.156C228.572%20243.546%20216.582%20241.799%20210.283%20233.448V233.448C203.983%20225.097%20205.817%20213.32%20212.821%20205.55C222.472%20194.84%20229.726%20182.096%20233.986%20168.165C240.105%20148.159%20239.739%20126.73%20232.941%20106.945C226.144%2087.1597%20213.262%2070.0313%20196.14%2058.0104C184.217%2049.6394%20170.663%2044.0438%20156.467%2041.5281C146.167%2039.7026%20137.482%2031.5399%20137.319%2021.0805V21.0805Z'%20fill='url(%23paint0_linear_149_2)'/%3e%3ccircle%20cx='223.927'%20cy='221.927'%20r='13.7211'%20stroke='white'%20stroke-width='5'/%3e%3cdefs%3e%3cfilter%20id='filter0_i_149_2'%20x='2.12476'%20y='2.12744'%20width='274.079'%20height='278.078'%20filterUnits='userSpaceOnUse'%20color-interpolation-filters='sRGB'%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'/%3e%3cfeBlend%20mode='normal'%20in='SourceGraphic'%20in2='BackgroundImageFix'%20result='shape'/%3e%3cfeColorMatrix%20in='SourceAlpha'%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%20127%200'%20result='hardAlpha'/%3e%3cfeOffset%20dy='4'/%3e%3cfeGaussianBlur%20stdDeviation='10'/%3e%3cfeComposite%20in2='hardAlpha'%20operator='arithmetic'%20k2='-1'%20k3='1'/%3e%3cfeColorMatrix%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200.1%200'/%3e%3cfeBlend%20mode='normal'%20in2='shape'%20result='effect1_innerShadow_149_2'/%3e%3c/filter%3e%3clinearGradient%20id='paint0_linear_149_2'%20x1='275.276'%20y1='78.7703'%20x2='3.05253'%20y2='199.559'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%230373FC'/%3e%3cstop%20offset='1'%20stop-color='%2384BCFF'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",Rn="data:image/svg+xml,%3csvg%20width='383'%20height='383'%20viewBox='-52%20-52%20383%20383'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20filter='url(%23filter0_i_149_2)'%3e%3cpath%20d='M2.12485%20139.167C2.12485%20214.851%2063.4794%20276.206%20139.164%20276.206C214.849%20276.206%20276.203%20214.851%20276.203%20139.167C276.203%2063.482%20214.849%202.12744%20139.164%202.12744C63.4794%202.12744%202.12485%2063.482%202.12485%20139.167ZM238.322%20139.167C238.322%20193.93%20193.927%20238.324%20139.164%20238.324C84.4009%20238.324%2040.0066%20193.93%2040.0066%20139.167C40.0066%2084.4035%2084.4009%2040.0092%20139.164%2040.0092C193.927%2040.0092%20238.322%2084.4035%20238.322%20139.167Z'%20fill='%23F7F7F7'/%3e%3c/g%3e%3cpath%20d='M137.319%2021.0805C137.155%2010.621%20145.539%201.87435%20155.922%203.15351C170.976%205.00835%20185.663%209.35546%20199.368%2016.0577C218.764%2025.5429%20235.644%2039.4766%20248.632%2056.7234C261.621%2073.9701%20270.351%2094.0418%20274.11%20115.303C276.767%20130.326%20276.888%20145.642%20274.513%20160.623C272.875%20170.955%20262.153%20176.597%20252.146%20173.552V173.552C242.138%20170.506%20236.691%20159.905%20237.782%20149.501C238.743%20140.33%20238.424%20131.039%20236.807%20121.899C234.087%20106.515%20227.77%2091.9918%20218.372%2079.5125C208.974%2067.0333%20196.76%2056.9513%20182.726%2050.0881C174.387%2046.0101%20165.546%2043.1371%20156.467%2041.5281C146.166%2039.7028%20137.482%2031.5399%20137.319%2021.0805V21.0805Z'%20fill='url(%23paint0_linear_149_2)'/%3e%3ccircle%20cx='256.927'%20cy='156.927'%20r='13.7211'%20stroke='white'%20stroke-width='5'/%3e%3cdefs%3e%3cfilter%20id='filter0_i_149_2'%20x='2.12476'%20y='2.12744'%20width='274.079'%20height='278.078'%20filterUnits='userSpaceOnUse'%20color-interpolation-filters='sRGB'%3e%3cfeFlood%20flood-opacity='0'%20result='Backgroun
37dImageFix'/%3e%3cfeBlend%20mode='normal'%20in='SourceGraphic'%20in2='BackgroundImageFix'%20result='shape'/%3e%3cfeColorMatrix%20in='SourceAlpha'%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%20127%200'%20result='hardAlpha'/%3e%3cfeOffset%20dy='4'/%3e%3cfeGaussianBlur%20stdDeviation='10'/%3e%3cfeComposite%20in2='hardAlpha'%20operator='arithmetic'%20k2='-1'%20k3='1'/%3e%3cfeColorMatrix%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200.1%200'/%3e%3cfeBlend%20mode='normal'%20in2='shape'%20result='effect1_innerShadow_149_2'/%3e%3c/filter%3e%3clinearGradient%20id='paint0_linear_149_2'%20x1='275.276'%20y1='78.7703'%20x2='3.05253'%20y2='199.559'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%230373FC'/%3e%3cstop%20offset='1'%20stop-color='%2384BCFF'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",Dn="data:image/svg+xml,%3csvg%20width='383'%20height='383'%20viewBox='-52%20-52%20383%20383'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20filter='url(%23filter0_i_149_2)'%3e%3cpath%20d='M2.12485%20139.167C2.12485%20214.851%2063.4794%20276.206%20139.164%20276.206C214.849%20276.206%20276.203%20214.851%20276.203%20139.167C276.203%2063.482%20214.849%202.12744%20139.164%202.12744C63.4794%202.12744%202.12485%2063.482%202.12485%20139.167ZM238.322%20139.167C238.322%20193.93%20193.927%20238.324%20139.164%20238.324C84.4009%20238.324%2040.0066%20193.93%2040.0066%20139.167C40.0066%2084.4035%2084.4009%2040.0092%20139.164%2040.0092C193.927%2040.0092%20238.322%2084.4035%20238.322%20139.167Z'%20fill='%23F7F7F7'/%3e%3c/g%3e%3cpath%20d='M137.319%2021.0805C137.155%2010.621%20145.539%201.87424%20155.922%203.15339C178.153%205.89238%20199.476%2014.0538%20217.959%2027.0433C236.443%2040.0328%20251.346%2057.3299%20261.454%2077.3181C266.175%2086.653%20260.787%2097.5048%20250.89%20100.895V100.895C240.994%20104.284%20230.372%2098.879%20225.165%2089.8064C217.98%2077.2893%20208.11%2066.4226%20196.178%2058.0369C184.246%2049.6513%20170.678%2044.0465%20156.467%2041.5281C146.167%2039.7026%20137.482%2031.5399%20137.319%2021.0805V21.0805Z'%20fill='url(%23paint0_linear_149_2)'/%3e%3ccircle%20cx='244.927'%20cy='83.9267'%20r='13.7211'%20stroke='white'%20stroke-width='5'/%3e%3cdefs%3e%3cfilter%20id='filter0_i_149_2'%20x='2.12476'%20y='2.12744'%20width='274.079'%20height='278.078'%20filterUnits='userSpaceOnUse'%20color-interpolation-filters='sRGB'%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'/%3e%3cfeBlend%20mode='normal'%20in='SourceGraphic'%20in2='BackgroundImageFix'%20result='shape'/%3e%3cfeColorMatrix%20in='SourceAlpha'%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%20127%200'%20result='hardAlpha'/%3e%3cfeOffset%20dy='4'/%3e%3cfeGaussianBlur%20stdDeviation='10'/%3e%3cfeComposite%20in2='hardAlpha'%20operator='arithmetic'%20k2='-1'%20k3='1'/%3e%3cfeColorMatrix%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200.1%200'/%3e%3cfeBlend%20mode='normal'%20in2='shape'%20result='effect1_innerShadow_149_2'/%3e%3c/filter%3e%3clinearGradient%20id='paint0_linear_149_2'%20x1='275.276'%20y1='78.7703'%20x2='3.05253'%20y2='199.559'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%230373FC'/%3e%3cstop%20offset='1'%20stop-color='%2384BCFF'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",$n="data:image/svg+xml,%3csvg%20width='383'%20height='383'%20viewBox='-52%20-52%20383%20383'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20filter='url(%23filter0_i_149_2)'%3e%3cpath%20d='M2.12485%20139.167C2.12485%20214.851%2063.4794%20276.206%20139.164%20276.206C214.849%20276.206%20276.203%20214.851%20276.203%20139.167C276.203%2063.482%20214.849%202.12744%20139.164%202.12744C63.4794%202.12744%202.12485%2063.482%202.12485%20139.167ZM238.322%20139.167C238.322%20193.93%20193.927%20238.324%20139.164%20238.324C84.4009%20238.324%2040.0066%20193.93%2040.0066%20139.167C40.0066%2084.4035%2084.4009%2040.0092%20139.164%2040.0092C193.927%2040.0092%20238.322%2084.4035%20238.322%20139.167Z'%20fill='%23F7F7F7'/%3e%3c/g%3e%3cpath%20d='M137.319%2021.0805C137.155%2010.621%20145.539%201.87424%20155.922%203.1534C171.78%205.10726%20187.178%209.82054%20201.413%2017.0784C210.732%2021.8301%20212.783%2033.7713%20206.793%2042.3471V42.3471C200.803%2050.9228%20189.037%2052.8256%20179.48%2048.5726C172.124%2045.2989%20164.395%2042.9331%20156.467%2041.5281C146.167%2039.7027%20137.482%2031.5399%20137.319%2021.0805V21.0805Z'%20fill='url(%23paint0_linear_149_2)'/%3e%3ccircle%20cx='191.927'%20cy='32.9267'%20r='13.7211'%20stroke='white'%20stroke-width='5'/%3e%3cdefs%3e%3cfilter%20id='filter0_i_149_2'%20x='2.12476'%20y='2.12744'%20width='274.079'%20height='278.078'%20filterUnits='userSpaceOnUse'%20color-interpolation-filters='sRGB'%3e%3cfeFlood%20flood-opacity='0'%20result='Backgroun
37dImageFix'/%3e%3cfeBlend%20mode='normal'%20in='SourceGraphic'%20in2='BackgroundImageFix'%20result='shape'/%3e%3cfeColorMatrix%20in='SourceAlpha'%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%20127%200'%20result='hardAlpha'/%3e%3cfeOffset%20dy='4'/%3e%3cfeGaussianBlur%20stdDeviation='10'/%3e%3cfeComposite%20in2='hardAlpha'%20operator='arithmetic'%20k2='-1'%20k3='1'/%3e%3cfeColorMatrix%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200.1%200'/%3e%3cfeBlend%20mode='normal'%20in2='shape'%20result='effect1_innerShadow_149_2'/%3e%3c/filter%3e%3clinearGradient%20id='paint0_linear_149_2'%20x1='275.276'%20y1='78.7703'%20x2='3.05253'%20y2='199.559'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%230373FC'/%3e%3cstop%20offset='1'%20stop-color='%2384BCFF'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",Vn="data:image/svg+xml,%3csvg%20width='383'%20height='383'%20viewBox='-54%20-54%20383%20383'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20filter='url(%23filter0_i_149_2)'%3e%3cpath%20d='M9.15527e-05%20137.039C9.15527e-05%20212.724%2061.3547%20274.079%20137.039%20274.079C212.724%20274.079%20274.079%20212.724%20274.079%20137.039C274.079%2061.3546%20212.724%200%20137.039%200C61.3547%200%209.15527e-05%2061.3546%209.15527e-05%20137.039ZM236.197%20137.039C236.197%20191.802%20191.803%20236.197%20137.039%20236.197C82.2762%20236.197%2037.8819%20191.802%2037.8819%20137.039C37.8819%2082.2761%2082.2762%2037.8818%20137.039%2037.8818C191.803%2037.8818%20236.197%2082.2761%20236.197%20137.039Z'%20fill='%23F7F7F7'/%3e%3c/g%3e%3cpath%20d='M134.958%203.8744C134.925%201.7426%20136.626%20-0.018256%20138.758%200.00847902V0.00847902C140.89%200.0352141%20142.547%201.83818%20142.46%203.96847L141.189%2035.1706C141.126%2036.7121%20139.826%2037.9066%20138.283%2037.8873V37.8873C136.741%2037.8679%20135.47%2036.6411%20135.446%2035.0986L134.958%203.8744Z'%20fill='url(%23paint0_linear_149_2)'/%3e%3cdefs%3e%3cfilter%20id='filter0_i_149_2'%20x='0'%20y='0'%20width='274.079'%20height='278.078'%20filterUnits='userSpaceOnUse'%20color-interpolation-filters='sRGB'%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'/%3e%3cfeBlend%20mode='normal'%20in='SourceGraphic'%20in2='BackgroundImageFix'%20result='shape'/%3e%3cfeColorMatrix%20in='SourceAlpha'%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%20127%200'%20result='hardAlpha'/%3e%3cfeOffset%20dy='4'/%3e%3cfeGaussianBlur%20stdDeviation='10'/%3e%3cfeComposite%20in2='hardAlpha'%20operator='arithmetic'%20k2='-1'%20k3='1'/%3e%3cfeColorMatrix%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200.1%200'/%3e%3cfeBlend%20mode='normal'%20in2='shape'%20result='effect1_innerShadow_149_2'/%3e%3c/filter%3e%3clinearGradient%20id='paint0_linear_149_2'%20x1='273.152'%20y1='76.6429'%20x2='0.927777'%20y2='197.431'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%230373FC'/%3e%3cstop%20offset='1'%20stop-color='%2384BCFF'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",Gn={market_pick:"Market Supported Option",buyer_best:"Best Option",baseline_pick:"Company Standard","market_pick + buyer_best (same)":"Market Supported Option & Best Option"},h0={market_pick:"Most commonly accepted in the market.",buyer_best:"The most favorable option for the buyer.",baseline_pick:"Matches your company's baseline contract for this agreement type.","market_pick + buyer_best (same)":"Most commonly accepted, and the most favorable for the buyer."},Un=t=>t>=95?Bn:t>=85?In:t>=75?Mn:t>=65?Pn:t>=55?Tn:t>=45?On:t>=35?Ln:t>=25?Rn:t>=15?Dn:t>=5?$n:Vn,fe=t=>Math.abs(t)>1?t:t*100,lt=({label:t,value:a,description:s})=>{const r=a!=null,n=r?fe(a):0,i=Un(n),l=r?`${n.toFixed(0)}%`:"â";return e.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[10px] font-mono uppercase tracking-[0.18em] text-gray-400",children:t}),s&&e.jsx("p",{className:"text-[11px] text-gray-500 leading-snug mt-1.5 max-w-[16dvw]",children:s})]}),e.jsxs("div",{className:"relative flex-shrink-0 w-14 h-14",children:[r&&e.jsx("img",{src:i,alt:`${l} ${t}`,className:"w-14 h-14 object-contain"}),e.jsx("span",{className:"absolute inset-0 flex items-center justify-center text-[10px] font-bold text-[#0D71EF] leading-none",children:l})]})]})},Hn=({rec:t,isOpen:a,onToggle:s,isLast:r})=>{const n=Gn[t.kind]||"Suggested Option",i=t.also_baseline?`${n} & Company Standard`:n,l=t.also_baseline?`${h0[t.kind]||""} Also matches your company's baseline.`.trim():h0[t.kind];return e.jsxs("div",{className:`flex flex-col ${r?"":"border-b border-gray-100"} ${a?"flex-1 min-h-0":"flex-shrink-0"}`,children:[e.jsxs("button",{onClick:s,className:`w-full px-4 py-3 flex items-start gap-2 text-left cursor-pointer transition-colors flex-shrink-0 ${a?"":"hover:bg-gray-50"}`,children:[e.jsx(Pe,{className:`w-4 h-4 mt-0.5 flex-shrink-0 transition-all ${a?"text-[#0073FF]":"text-gray-400 -rotate-90"}`}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-900",children:i}),l&&e.jsx("div",{className:"text-[11px] text-gray-500 italic leading-snug mt-0.5",children:l})]})]}),a&&e.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto custom-scrollbar border-t border-gray-100",children:[e.jsx("div",{className:"px-4 py-3",children:e.jsx("p",{className:"text-[11px] text-gray-700 leading-relaxed font-mono whitespace-pre-wrap",children:t.display})}),Math.round(fe(t.market_share??0))>0&&e.jsx("div",{className:"border-t border-gray-100",children:e.jsx(lt,{label:"Market Adoption",value:t.market_share,description:e.jsxs(e.Fragment,{children:["Out of all the public contracts,",e.jsxs("span",{className:"font-semibold text-gray-700",children:[" ",fe(t.market_share).toFixed(0),"%"]})," ","have this clause in their contract."]})})}),(t.vendor_contract_count??0)>=3&&Math.round(fe(t.vendor_public_share??0))>0&&e.jsx("div",{className:"border-t border-gray-100",children:e.jsx(lt,{label:"Vendor Acceptance",value:t.vendor_public_share,description:t.market_share!=null?e.jsxs(e.Fragment,{children:["Vendor has accepted this clause in"," ",e.jsxs("span",{className:"font-semibold text-gray-700",children:[" ",fe(t.vendor_public_share).toFixed(0),"%"]})," ","of his public contracts."]}):null})}),(t.vendor_public_contract_count??0)>=3&&Math.round(fe(t.vendor_acceptance??0))>0&&e.jsx("div",{className:"border-t border-gray-100",children:e.jsx(lt,{label:"Acceptance Chance",value:t.vendor_acceptance,description:t.market_share!=null?e.jsxs(e.Fragment,{children:["You have a chance of"," ",e.jsxs("span",{className:"font-semibold text-gray-700",children:[" ",fe(t.vendor_acceptance).toFixed(0),"%"]})," ","to get this clause accepted."]}):null})})]})]})},Zn=({alternatives:t})=>
37{const a=t?.recommendations,[s,r]=x.useState(0);return x.useEffect(()=>{r(0)},[t]),!t||!Array.isArray(a)||a.length===0?null:e.jsx("div",{className:"flex flex-col h-full min-h-0",children:a.map((n,i)=>e.jsx(Hn,{rec:n,isOpen:s===i,onToggle:()=>r(l=>l===i?-1:i),isLast:i===a.length-1},i))})},p0=340,ot=320,zn=12,ct=8,Kn=({citation:t,anchorEl:a,onClose:s})=>{const r=x.useRef(null),[n,i]=x.useState({top:0,left:0,arrowTop:ot/2});x.useLayoutEffect(()=>{if(!a)return;const o=()=>{const c=a.getBoundingClientRect(),u=r.current?.offsetHeight||ot,h=Math.max(ct,c.left-p0-zn),m=c.top+c.height/2,f=Math.max(ct,Math.min(m-u/2,window.innerHeight-u-ct)),y=Math.max(16,Math.min(m-f,u-16));i({top:f,left:h,arrowTop:y})};return o(),window.addEventListener("scroll",o,!0),window.addEventListener("resize",o),()=>{window.removeEventListener("scroll",o,!0),window.removeEventListener("resize",o)}},[a,t]),x.useEffect(()=>{const o=u=>u.key==="Escape"&&s(),c=u=>{!r.current?.contains(u.target)&&!a?.contains(u.target)&&s()};return document.addEventListener("keydown",o),document.addEventListener("mousedown",c),()=>{document.removeEventListener("keydown",o),document.removeEventListener("mousedown",c)}},[s,a]),t.citations;const l={background:"linear-gradient(135deg, rgba(255,255,255,0.82) 0%, rgba(255,255,255,0.74) 50%, rgba(240,247,255,0.80) 100%)",backdropFilter:"blur(28px) saturate(180%)",WebkitBackdropFilter:"blur(28px) saturate(180%)"};return b2.createPortal(e.jsxs("div",{ref:r,role:"dialog",style:{top:n.top,left:n.left,width:p0,maxHeight:ot,...l},className:"fixed z-[10000] rounded-2xl border border-white/60 shadow-[0_8px_40px_0_rgba(31,38,135,0.20)] flex flex-col p-3",children:[e.jsx("span",{style:{top:n.arrowTop,right:"-11px",width:0,height:0,borderTop:"9px solid transparent",borderBottom:"9px solid transparent",borderLeft:"11px solid rgba(245,249,255,0.86)",filter:"drop-shadow(2px 0 2px rgba(31,38,135,0.10))"},className:"absolute -translate-y-1/2"}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto custom-scrollbar px-4 py-3",children:e.jsx("p",{className:"text-[12px] text-gray-800 leading-relaxed whitespace-pre-wrap",children:t.source_language})})]}),document.body)},Wn=({chips:t,counts:a})=>{const s=x.useRef(null),[r,n]=x.useState(!1),[i,l]=x.useState(!1),o=()=>{const u=s.current;u&&(n(u.scrollLeft>1),l(u.scrollLeft+u.clientWidth<u.scrollWidth-1))};x.useEffect(()=>{o()},[t.length]);const c=u=>h=>{h.stopPropagation(),s.current?.scrollBy({left:u*52,behavior:"smooth"})};return e.jsxs("div",{className:"flex items-center gap-0.5",children:[r&&e.jsx("span",{role:"button",onClick:c(-1),className:"flex-shrink-0 cursor-pointer text-gray-500 hover:text-gray-700",children:e.jsx(I0,{className:"w-3.5 h-3.5"})}),e.jsx("div",{ref:s,onScroll:o,className:"flex items-center gap-1 max-w-[74px] overflow-x-auto no-scrollbar",children:t.map(u=>e.jsx("span",{className:`inline-flex items-center justify-center w-[22px] h-[22px] flex-shrink-0 rounded-full text-white text-[10px] font-bold ${u.badge}`,children:a[u.key]},u.key))}),i&&e.jsx("span",{role:"button",onClick:c(1),className:"flex-shrink-0 cursor-pointer text-gray-500 hover:text-gray-700",children:e.jsx(M0,{className:"w-3.5 h-3.5"})})]})},qn=[{key:"vendor",chip:"bg-red-500",badge:"bg-[#918A8A]"},{key:"customer",chip:"bg-emerald-500",badge:"bg-blue-600"}],Yn=({activeTopicId:t,onSelect:a,matchCounts:s={},filterState:r={},filterPalette:n=qn})=>{const{contractId:i}=Ae(),{contractTopics:l}=T(c=>c.compare),o=x.useMemo(()=>{const c=l?.data?.[i]?.topics;return Array.isArray(c)?c.map(u=>{const h=Object.keys(u)[0],m=u[h];return m?{id:h,name:m.topic_name,percentile:m.rating_percentile}:null}).filter(Boolean):[]},[l?.data,i]);return o.length?e.jsx("aside",{className:"w-96 flex-shrink-0 flex flex-col min-h-0",children:e.jsxs("div",{className:"bg-[#FEFEFE] rounded-2xl border border-gray-200 flex-1 min-h-0 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"border-b border-gray-100 px-5 py-2 flex items-center justify-between flex-shrink-0",children:[e.jsx("span",{className:"text-md font-semibold text-gray-700",children:"Topics"}),e.jsx("span",{className:"inline-flex items-center justify-center min-w-[26px] h-6 px-4 roun
37ded-full bg-blue-100 text-blue-600 text-[11px] font-semibold",children:String(o.length).padStart(2,"0")})]}),e.jsx("div",{className:"overflow-y-auto flex-1 min-h-0 custom-scrollbar divide-y divide-gray-200",children:o.map((c,u)=>{const h=t===c.id,m=s?.[c.id]||{},f=n.filter(y=>r[y.key]&&(m[y.key]||0)>0);return e.jsxs("button",{onClick:()=>a?.(c.id),className:`block w-full text-left px-5 py-3 transition-colors cursor-pointer relative ${h?"bg-blue-50":"hover:bg-gray-50"}`,children:[f.length>0&&e.jsx("div",{className:"absolute top-3 right-3",children:e.jsx(Wn,{chips:f,counts:m})}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsxs("span",{className:`text-sm leading-tight flex-shrink-0 ${h?"text-[#0073FF]":"text-gray-500"}`,children:[u+1,"."]}),e.jsx("h3",{className:`text-sm leading-tight ${h?"text-[#0073FF] font-semibold":"text-gray-900 font-medium"}`,children:c.name})]}),e.jsx("div",{className:"mt-2 pl-6 pr-2",children:e.jsx(Qe,{ratingPercentile:c.percentile,size:"sm"})})]},c.id)})})]})}):e.jsx("aside",{className:"w-96 flex-shrink-0 h-full",children:e.jsxs("div",{className:"bg-[#FEFEFE] rounded-2xl border border-gray-200 h-full flex flex-col overflow-hidden animate-pulse",children:[e.jsxs("div",{className:"border-b border-gray-100 px-5 py-4 flex items-center justify-between",children:[e.jsx("div",{className:"h-3 w-16 bg-gray-100 rounded"}),e.jsx("div",{className:"h-5 w-7 bg-gray-100 rounded-full"})]}),e.jsx("div",{className:"divide-y divide-gray-100",children:[0,1,2,3].map(c=>e.jsxs("div",{className:"px-5 py-4 space-y-2",children:[e.jsx("div",{className:"h-4 w-40 bg-gray-100 rounded"}),e.jsx("div",{className:"h-2 w-24 bg-gray-100 rounded"}),e.jsx("div",{className:"h-1.5 w-full bg-gray-100 rounded-full"})]},c))})]})})},Xn=t=>{const a={};return t?.data?.forEach(s=>{s.is_answered!==0&&(a[s.subheading]||(a[s.subheading]={}),a[s.subheading][s.label_group]||(a[s.subheading][s.label_group]=[]),a[s.subheading][s.label_group].push(s))}),a},Qn=[{id:"insights",label:"Insights",iconSrc:ts,enabled:!0},{id:"comparison",label:"Benchmark",iconSrc:P2,enabled:!0},{id:"clauses",label:"Termsheet",icon:I2,enabled:!0},{id:"analytics",label:"Analytics",icon:F2,enabled:!0}],W=[{key:"vendor",group:"rare",label:"Favouring Vendor",dot:"bg-red-500",chip:"bg-red-500",btnActive:"bg-red-500 text-white",btnInactive:"bg-red-50 text-red-700 hover:bg-red-100",cardText:"text-[#918A8A]",cardGrad:"from-gray-200",cardBorder:"border-gray-300",badge:"bg-[#918A8A]"},{key:"customer",group:"rare",label:"Favouring Customer",dot:"bg-emerald-500",chip:"bg-emerald-500",btnActive:"bg-emerald-500 text-white",btnInactive:"bg-emerald-50 text-emerald-700 hover:bg-emerald-100",cardText:"text-blue-600",cardGrad:"from-blue-100",cardBorder:"border-blue-200",badge:"bg-blue-600"},{key:"escalation_high",group:"escalation",label:"High Escalation",dot:"bg-blue-500",chip:"bg-blue-500",btnActive:"bg-blue-500 text-white",btnInactive:"bg-blue-50 text-blue-700 hover:bg-blue-100",cardText:"text-[#E8916A]",cardGrad:"from-orange-100",cardBorder:"border-orange-200",badge:"bg-[#E8916A]"},{key:"escalation_unclear",group:"escalation",label:"Unclear Escalation",dot:"bg-amber-500",chip:"bg-amber-500",btnActive:"bg-amber-500 text-white",btnInactive:"bg-amber-50 text-amber-700 hover:bg-amber-100",cardText:"text-[#D9BCA3]",cardGrad:"from-amber-100",cardBorder:"border-amber-200",badge:"bg-[#D9BCA3]"},{key:"friction_high",group:"friction",label:"High Friction",dot:"bg-orange-500",chip:"bg-orange-500",btnActive:"bg-orange-500 text-white",btnInactive:"bg-orange-50 text-orange-700 hover:bg-orange-100",cardText:"text-[#C2888B]",cardGrad:"from-rose-100",cardBorder:"border-rose-200",badge:"bg-[#C2888B]"},{key:"friction_unclear",group:"friction",label:"Unclear Friction",dot:"bg-violet-500",chip:"bg-violet-500",btnActive:"bg-violet-500 text-white",btnInactive:"bg-violet-50 text-violet-700 hover:bg-violet-100",cardText:"text-[#FFB728]",cardGrad:"from-yellow-100",cardBorder:"border-amber-200",badge:"bg-[#FFB728]"}],Jn=[{key:"rare",label:"Rare Clauses"},{key:"escalation",label:"Escalation Signal"},{key:"friction",label:"Friction Signal"}],ei=[],ti=(t,a)=>{if(!a||!a.display)return t||null;const s=Array.isArray(t?.recommendations)?t.recommendations:[],r=o=>(o||"").replace(/\s+/g," ").trim().toLowerCase(),n=r(a.display),i=s.findIndex(o=>r(o.display)===n),l=i>=0?s.map((o,c)=>c===i?{...o,also_baseline:!0}:o):[...s,a];return{...t||{},recommendations:l}},Ei=()=>{const{contractId:t}=Ae(),a=Se(),[s,r]=y2(),n=s.get("tab")||"clauses",i=d=>{const b=new URLSearchParams(s);b.set("tab",d),r(b,{replace:!0})},o=T(d=>d.auth.user)?.tokens?.jwt,{documentOverviewResult:c}=T(d=>d.upload),{contractTopics:u}=T(d=>d.compare),{MarketDeviations:h}=T(d=>
37d.contracts),[m,f]=x.useState(null),[y,v]=x.useState(!0),g=x.useRef(null),[j,p]=x.useState(null),[C,F]=x.useState(null),[A,I]=x.useState(null),[w,E]=x.useState(()=>W.reduce((d,b)=>(d[b.key]=!1,d),{})),V=d=>E(b=>({...b,[d]:!b[d]})),q=d=>E(b=>{const _={...b};return W.forEach(S=>{S.group===d&&(_[S.key]=!1)}),_}),[R,$]=x.useState(!1),D=x.useRef(null),[te,Z]=x.useState(!1),X=x.useRef(null),[Q,ae]=x.useState(null),re=s.get("insights-bucket")||"deal_breakers",ne=d=>{const b=new URLSearchParams(s);b.set("insights-bucket",d),r(b,{replace:!0})};x.useEffect(()=>{if(!Q||s.get("insights-bucket"))return;const d=a0.find(b=>(Q[b.countKey]??0)>0);d&&ne(d.key)},[Q]);const{data:ie}=T(b0(t)),J=ie?.versions||ei,O=x.useMemo(()=>[...J].sort((d,b)=>b.version-d.version),[J]),[z,Ce]=x.useState({from:null,to:null});x.useEffect(()=>{if(O.length<2){Ce({from:null,to:O[0]?.version??null});return}const d=new Set(J.map(S=>S.version)),b=O[0].version,_=O[1].version;Ce(S=>{const k=S.to!=null&&d.has(S.to)?S.to:b;let N=S.from!=null&&d.has(S.from)?S.from:_;if(N===k){const B=O.find(P=>P.version!==k);N=B?B.version:N}return{from:N,to:k}})},[O]);const M=d=>{Ce(b=>{if(b.from!=null&&b.from!==d)return{from:b.from,to:d};const _=J.filter(k=>k.version<d).sort((k,N)=>N.version-k.version)[0],S=J.find(k=>k.version!==d);return{from:(_||S)?.version??null,to:d}})},U=z.from!=null&&z.to!=null?{lo:Math.min(z.from,z.to),hi:Math.max(z.from,z.to)}:{lo:null,hi:null},[L,me]=x.useState({citations:[],alternatives:null,loading:!1}),[le,Le]=x.useState(-1),[_t,Re]=x.useState(null);x.useEffect(()=>{Le(-1),Re(null)},[L.citations]);const[X0,Q0]=x.useState({}),[se,J0]=x.useState({}),[Nt,De]=x.useState({summaries:{},details:{}});x.useEffect(()=>{window.scrollTo(0,0)},[]),x.useEffect(()=>{let d=!0;const b=()=>{a(S2({authToken:o,contractId:t})).then(_=>{d&&(_.payload?f({status:_.payload.status,estimated_minutes_remaining:_.payload.estimated_minutes_remaining,percent_complete:_.payload.percent_complete}):_.error&&f({status:"Failed"}))})};if(t)return a(g0({authToken:o,contractId:t})).then(()=>{d&&v(!1)}),a(j2({authToken:o,contractId:t})),b(),m?.status==="In Progress"&&(g.current=setInterval(b,1e4)),()=>{d=!1,g.current&&(clearInterval(g.current),g.current=null)}},[t,a,m?.status,o]);const he=x.useMemo(()=>{if(!u?.data?.[t]?.topics)return{};const d={};return u.data[t].topics.forEach(b=>{const _=Object.keys(b)[0];d[_]=b[_].topic_name}),d},[u?.data,t]);x.useEffect(()=>{const d=Object.keys(he);d.length&&(!j||!he[j])&&p(d[0])},[he,j]),x.useEffect(()=>{t&&a(C2({contractId:t,limit:30}))},[t,a]),x.useEffect(()=>{if(!R)return;const d=b=>{D.current&&!D.current.contains(b.target)&&$(!1)};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[R]),x.useEffect(()=>{if(!te)return;const d=b=>{X.current&&!X.current.contains(b.target)&&Z(!1)};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[te]);const et=x.useMemo(()=>{const d=S=>new Set((S||[]).map(k=>k?.label_id).filter(Boolean)),b=h?.data?.escalation_signal,_=h?.data?.friction_signal;return{vendor:d(h?.data?.party_a),customer:d(h?.data?.party_b),escalation_high:d(b?.high_escalation_clauses),escalation_unclear:d(b?.unclear_clauses),friction_high:d(_?.high_friction_clauses),friction_unclear:d(_?.unclear_clauses)}},[h?.data?.party_a,h?.data?.party_b,h?.data?.escalation_signal?.high_escalation_clauses,h?.data?.escalation_signal?.unclear_clauses,h?.data?.friction_signal?.high_friction_clauses,h?.data?.friction_signal?.unclear_clauses]),e2=W.filter(d=>w[d.key]).length,kt=n==="clauses"?e2:0,t2=d=>W.filter(b=>w[b.key]&&et[b.key]?.has(d.label_id)).map(b=>b.key),Ft=x.useMemo(()=>{const d={};return Object.entries(se).forEach(([b,_])=>{const S=new Set,k={};Object.values(_?.details||{}).forEach(N=>
37{Object.entries(N).forEach(([B,P])=>{k[B]||(k[B]=new Set),P.forEach(G=>{S.add(G.label_id),k[B].add(G.label_id)})})}),d[b]={all:S,byGroup:k}}),d},[se]),At={vendor:h?.data?.party_a,customer:h?.data?.party_b,escalation_high:h?.data?.escalation_signal?.high_escalation_clauses,escalation_unclear:h?.data?.escalation_signal?.unclear_clauses,friction_high:h?.data?.friction_signal?.high_friction_clauses,friction_unclear:h?.data?.friction_signal?.unclear_clauses},a2=x.useMemo(()=>{const d={},b=()=>W.reduce((k,N)=>(k[N.key]=new Set,k),{}),_=(k,N)=>{(k||[]).forEach(B=>{const P=B?.topic_id,G=B?.label_id;if(P==null||G==null)return;const K=String(P),pe=Ft[K]?.all;pe&&!pe.has(G)||(d[K]||(d[K]=b()),d[K][N].add(G))})};W.forEach(k=>{w[k.key]&&_(At[k.key],k.key)});const S={};return Object.entries(d).forEach(([k,N])=>{S[k]=W.reduce((B,P)=>(B[P.key]=N[P.key].size,B),{})}),S},[h?.data?.party_a,h?.data?.party_b,h?.data?.escalation_signal?.high_escalation_clauses,h?.data?.escalation_signal?.unclear_clauses,h?.data?.friction_signal?.high_friction_clauses,h?.data?.friction_signal?.unclear_clauses,w,Ft]),s2=x.useMemo(()=>{if(!j)return{};const d=se[j]?.details;if(!d)return{};const b={};Object.entries(d).forEach(([B,P])=>{Object.values(P).forEach(G=>{G.forEach(K=>{K?.label_id!=null&&(b[K.label_id]=B)})})});const _={},S=()=>W.reduce((B,P)=>(B[P.key]=new Set,B),{}),k=(B,P)=>{(B||[]).forEach(G=>{if(String(G?.topic_id)!==String(j))return;const K=G?.label_id;if(K==null)return;const pe=b[K];pe&&(_[pe]||(_[pe]=S()),_[pe][P].add(K))})};W.forEach(B=>{w[B.key]&&k(At[B.key],B.key)});const N={};return Object.entries(_).forEach(([B,P])=>{N[B]=W.reduce((G,K)=>(G[K.key]=P[K.key].size,G),{})}),N},[h?.data?.party_a,h?.data?.party_b,h?.data?.escalation_signal?.high_escalation_clauses,h?.data?.escalation_signal?.unclear_clauses,h?.data?.friction_signal?.high_friction_clauses,h?.data?.friction_signal?.unclear_clauses,w,j,se]);x.useEffect(()=>{!j||se[j]||(De(d=>({...d,details:{...d.details,[j]:!0}})),a(w2({contract_id:t,topic_id:j})).then(d=>{const b=d?.payload,_=Xn(b||{}),S=Object.keys(_)[0];J0(k=>({...k,[j]:{details:_,expandedSection:S}}))}).catch(d=>console.error("Failed to fetch topic details:",d)).finally(()=>{De(d=>({...d,details:{...d.details,[j]:!1}}))}))},[j,t,a,se]),x.useEffect(()=>{if(!t||!Object.keys(he).length)return;let d=!0;return(async()=>{const _=Object.keys(he);De(S=>({...S,summaries:_.reduce((k,N)=>({...k,[N]:!0}),{})}));try{const S=_.map(async N=>{const B=await a(E2({contractId:t,topicId:N}));return{topicId:N,summary:B?.payload?.summary}}),k=await Promise.all(S);if(d){const N=k.reduce((B,{topicId:P,summary:G})=>({...B,[P]:G}),{});Q0(B=>({...B,...N}))}}catch(S){console.error("Error fetching summaries:",S)}finally{d&&De(S=>({...S,summaries:_.reduce((k,N)=>({...k,[N]:!1}),{})}))}})(),()=>{d=!1}},[t,he,a]);const oe=x.useMemo(()=>{const d=se[j]?.details;return d?Object.keys(d):[]},[se,j]);x.useEffect(()=>{if(!oe.length){C!==null&&F(null);return}oe.includes(C)||F(oe[0])},[oe,C]);const ce=x.useMemo(()=>{const d=se[j]?.details;if(!d||!C)return[];const b=d[C];return b?Object.values(b).flat():[]},[se,j,C]);x.useEffect(()=>{if(!A){me({citations:[],alternatives:null,loading:!1});return}me({citations:[],alternatives:null,loading:!0});let d=!0;const b=c?.parent_template_id||c?.template_id,_=A.question_id;return Promise.all([a(_2({contract_id:t,label_id:A.label_id})),b!=null&&_!=null?a(N2({template:b,question:_})):Promise.resolve(null)]).then(([S,k])=>{if(!d)return;const N=S?.payload?.data||{},B=k?.payload?.rec||null;me({citations:Array.isArray(N.citations)?N.citations:[],alternatives:ti(N.alternatives,B),loading:!1})}).catch(()=>{d&&me({citations:[],alternatives:null,loading:!1})}),()=>{d=!1}},[A,t,a,c]),x.useEffect(()=>{if(!ce.length){A!==null&&I(null);return}ce.find(b=>b.label_id===A?.label_id)||I(ce[0])},[ce,A]);const r2=d=>{A?.label_id!==d.label_id&&I(d)},n2=d=>{a(B2({labelId:d.label_id,templateId:c?.parent_template_id||c?.template_id,questionId:d.question_id,topicData:[d],showUnselectedData:d.selected===0,display_name:`${c?.product_suite_name} - ${c?.primary_agreement}`}))};return y||m===null?e.jsx(k2,{}):m.status==="In Progress"?e.jsx(Va,{contractId:t,estimatedMinutes:m.estimated_minutes_remaining,percentComplete:m.percent_complete}):m.status==="Failed"?e.jsx(Ga,{contractId:t}):e.jsxs("div",{className:"bg-[#FEFEFE] h-[calc(100vh-58px)] flex flex-col overflow-x-hidden",children:[e.jsx(ds,{}),e.jsxs("div",{className:"bg-[#F8F8FF] px-6 pt-3 flex items-center gap-4",children:[e.jsxs("div",{className:"flex-1 flex items-center justify-between pr-8",children:[Qn.filter(d=>d.enabled).map(d=>{const b=n===d.id,_=d.icon;return e.jsxs("button",{onClick:()=>i(d.id),className:`inline-flex items-center gap-2 px-[2.5dvw] py-2 rounded-full text-[13px] font-medium whitespace-nowrap transition-shadow cursor-pointer ${b?"bg-gradient-to-b from-[#6EB0FF] to-[#0D71EF] text-white shadow-sm hover:shadow-md":"bg-[#FEFEFE] text-gray-700 border border-gray-200 hover:border-gray-300"}`,children:[d.iconSrc?e.jsx("img",{src:d.iconSrc,alt:"",className:`w-4 h-4 ${b?"brightness-0 invert":"brightness-0"}`}):_&&e.jsx(_,{className:"w-4 h-4"}),d.label]},d.id)}),e.jsxs(Be,{to:`/signals/${t}`,className:"inline-flex items-center gap-2 px-[2.5dvw] py-2 rounded-full text-[13px] font-medium whitespace-nowrap transition-shadow cursor-pointer bg-[#FEFEFE] text-gray-700 border border-gray-200 hover:border-gray-300",children:[e.jsx(La,{className:"w-4 h-4"}),"Signals"]})]}),e.jsxs("div",{className:"w-[420px] flex-shrink-0 flex justify-end relative",ref:D,children:[e.jsxs("button",{onClick:()=>$(d=>!d),className:"inline-flex items-center gap-2 px-4 py-2 rounded-full text-[13px] font-medium text-gray-700 bg-[#FEFEFE] border border-gray-200 hover:border-gray-300 cursor-pointer transition-colors",children:[e.jsx(Ba,{className:"w-4 h-4 text-gray-500"}),"Filters",kt>0&&e.jsx("span",{className:"inline-flex items-center justify-center min-w-[18px] h-[18px] px-1 rounded-full bg-[#0772FD] text-white text-[10px] font-bold tracking-normal",children:kt}),e.jsx(Pe,{className:`w-4 h-4 text-gray-400 transition-transform ${R?"rotate-180":""}`})]}),R&&e.jsxs("div",{className:"absolute right-0 top-full mt-1 w-80 bg-[#FEFEFE] border border-gray-200 rounded-xl shadow-md z-50 p-4",children:[n==="clauses"&&e.jsx(e.Fragment,{children:Jn.map((d,b)=>{const _=W.filter(N=>N.group===d.key);
37if(!_.some(N=>(et[N.key]?.size||0)>0))return null;const k=_.some(N=>w[N.key]);return e.jsxs("div",{className:b>0?"mt-5":"",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.18em] text-gray-400",children:d.label}),k&&e.jsx("button",{onClick:()=>q(d.key),className:"text-[10px] font-semibold uppercase tracking-[0.18em] text-gray-400 hover:text-gray-700 cursor-pointer",children:"Clear"})]}),e.jsx("div",{className:"grid grid-cols-2 gap-2.5",children:_.map(N=>{const B=w[N.key],P=et[N.key]?.size||0;return e.jsxs("button",{onClick:()=>V(N.key),className:`relative rounded-lg border px-3 py-2.5 text-left transition-all cursor-pointer bg-gradient-to-t ${N.cardGrad} from-[-30%] to-white to-60% ${B?`shadow-sm ${N.cardBorder}`:"border-gray-200 hover:border-gray-300"}`,children:[B&&e.jsx("span",{className:"absolute top-2.5 right-2.5 w-2 h-2 rounded-full bg-emerald-500"}),e.jsx("div",{className:"text-[12px] font-medium text-gray-700 mb-0.5 pr-3",children:N.label}),e.jsx("div",{className:`text-2xl font-bold leading-none ${N.cardText}`,children:P})]},N.key)})})]},d.key)})}),n==="insights"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex items-center justify-between mb-1",children:e.jsx("span",{className:"text-sm font-mono uppercase tracking-[0.18em] text-gray-400 px-3",children:"Insights View"})}),e.jsx("div",{className:"flex flex-col gap-1",children:a0.map(d=>{const b=Q?.[d.countKey],_=re===d.key;return e.jsxs("button",{onClick:()=>ne(d.key),className:`flex items-center justify-between px-3 py-2.5 rounded-md text-sm transition-colors cursor-pointer ${_?"bg-blue-50 text-[#0073FF] font-semibold":"text-gray-700 hover:bg-gray-50"}`,children:[e.jsx("span",{children:d.label}),e.jsx("span",{className:`text-xs font-mono ${_?"text-[#0073FF]":"text-gray-400"}`,children:b??"â"})]},d.key)})})]}),n==="analytics"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex items-center justify-between mb-3",children:e.jsx("span",{className:"text-[10px] font-mono uppercase tracking-[0.18em] text-gray-400",children:"Compared Against"})}),O.length<2?e.jsx("div",{className:"py-4 text-center text-[10px] font-mono uppercase tracking-[0.18em] text-gray-300",children:"Only one version â nothing to compare"}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-wrap gap-1.5",children:J.filter(d=>d.version!==z.to).sort((d,b)=>
37d.version-b.version).map(d=>{const b=d.version===z.from;return e.jsxs("button",{onClick:()=>Ce(_=>({..._,from:d.version})),className:`px-2.5 py-1 rounded-md text-xs font-semibold border transition-colors cursor-pointer ${b?"bg-[#0073FF] text-white border-[#0073FF]":"bg-[#FEFEFE] text-gray-600 border-gray-200 hover:border-gray-300"}`,children:["v",d.version]},d.version)})}),e.jsxs("p",{className:"text-[10px] text-gray-400 mt-3 leading-relaxed",children:["Comparing"," ",e.jsxs("span",{className:"font-semibold text-gray-600",children:["v",U.lo]})," ","â"," ",e.jsxs("span",{className:"font-semibold text-gray-600",children:["v",U.hi]}),". Pick the focus version on the left."]})]})]}),n!=="clauses"&&n!=="insights"&&n!=="analytics"&&e.jsx("div",{className:"py-6 text-center text-[10px] font-mono uppercase tracking-[0.18em] text-gray-300",children:"No filters available"})]})]})]}),m.status==="Completed"&&n==="comparison"&&e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(ys,{})}),m.status==="Completed"&&n==="insights"&&e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:e.jsx(Xs,{activeBucket:re,onSummary:ae})}),m.status==="Completed"&&n==="analytics"&&e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:e.jsx(En,{focusV:z.to,fromV:U.lo,toV:U.hi,onSelectFocus:M})}),m.status==="Completed"&&n!=="clauses"&&n!=="comparison"&&n!=="insights"&&n!=="analytics"&&e.jsxs("div",{className:"flex-1 flex items-center justify-center text-[11px] font-mono uppercase tracking-[0.18em] text-gray-300",children:[n," â coming soon"]}),m.status==="Completed"&&n==="clauses"&&e.jsxs("div",{className:"flex-1 flex items-stretch gap-4 px-6 py-4 min-h-0 bg-[#F8F8FF] overflow-hidden",children:[e.jsx(Yn,{activeTopicId:j,onSelect:p,matchCounts:a2,filterState:w,filterPalette:W}),e.jsxs("div",{className:"flex-1 min-w-0 bg-[#FEFEFE] rounded-2xl border border-gray-200 flex flex-col overflow-hidden",children:[!j&&e.jsx("div",{className:"flex-1 flex items-center justify-center text-[11px] font-mono uppercase tracking-[0.18em] text-gray-300",children:"Select a topic to view clauses"}),j&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"px-6 pt-6 pb-5 border-b border-gray-100 flex-shrink-0",children:[e.jsx("h1",{className:"text-2xl font-semibold text-gray-900 mb-2",children:he[j]||"Unknown Topic"}),Nt.summaries[j]?e.jsxs("div",{className:"animate-pulse space-y-2",children:[e.jsx("div",{className:"h-3 bg-gray-100 rounded w-3/4"}),e.jsx("div",{className:"h-3 bg-gray-100 rounded w-full"}),e.jsx("div",{className:"h-3 bg-gray-100 rounded w-5/6"})]}):e.jsx("p",{className:"text-sm text-gray-600 leading-relaxed",children:X0[j]||"No summary available."})]}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto custom-scrollbar",children:[e.jsxs("div",{className:"px-6 pt-3 pb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"text-sm font-semibold text-gray-700",children:"Subgroups"}),oe.length>0&&e.jsx("span",{className:"inline-flex items-center justify-center min-w-[26px] h-6 px-4 rounded-full bg-blue-100 text-blue-600 text-[11px] font-semibold",children:String(oe.length).padStart(2,"0")})]}),Nt.details[j]?e.jsx("div",{className:"h-10 bg-gray-100 rounded-lg animate-pulse"}):oe.length>0?e.jsxs("div",{className:"relative w-[58%] max-w-sm",ref:X,children:[e.jsxs("button",{type:"button",onClick:()=>Z(d=>!d),className:"w-full flex items-center gap-3 text-sm text-gray-800 bg-[#FEFEFE] border border-gray-200 rounded-2xl pl-4 pr-3 py-2.5 focus:outline-none focus:ring-2 focus:ring-[#0073FF]/30 cursor-pointer",children:[e.jsx("span",{className:"flex-1 text-left truncate",children:C||"Select subgroup"}),e.jsx(A2,{className:`w-5 h-5 text-gray-400 flex-shrink-0 transition-transform ${te?"rotate-180":""}`})]}),te&&e.jsx("div",{className:"absolute left-0 top-full mt-1 min-w-full bg-[#FEFEFE] border border-gray-200 rounded-2xl shadow-sm z-50 max-h-44 overflow-y-auto custom-scrollbar",children:oe.map(d=>{const b=C===d,_=s2?.[d]||{},S=W.filter(k=>w[k.key]&&(_[k.key]||0)>0);return e.jsxs("button",{type:"button",onClick:()=>{F(d),Z(!1)},className:`w-full text-left px-4 py-2 flex items-center justify-between gap-3 transition-colors cursor-pointer ${b?"bg-blue-50 text-[#0073FF]":"text-gray-800 hover:bg-gray-50"}`,children:[e.jsx("span",{className:"text-sm truncate min-w-0",children:d}),S.length>0&&e.jsx("div",{className:"flex items-center gap-1 flex-shrink-0",children:S.map(k=>e.jsx("span",{className:`inline-flex items-center justify-center min-w-[18px] h-[18px] px-1 rounded-full text-white text-[10px] font-bold ${k.badge}`,children:_[k.key]},k.key))})]},d)})})]}):null]}),e.jsxs("div",{className:"px-6 pb-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3 flex-shrink-0",children:[e.jsx("span",{className:"text-sm font-semibold text-gray-700",children:"Clauses"}),ce.length>0&&e.jsx("span",{className:"inline-flex items-center justify-center min-w-[26px] h-6 px-4 roun
37ded-full bg-blue-100 text-blue-600 text-[11px] font-semibold",children:String(ce.length).padStart(2,"0")})]}),ce.length>0?e.jsx("div",{className:"flex flex-col gap-2",children:ce.map((d,b)=>{const _=d.selected===1?d.selected_display:d.selected===0?d.unselected_display:d.selected_display||d.unselected_display||"",S=A?.label_id===d.label_id,k=t2(d);return e.jsxs("div",{onClick:()=>r2(d),className:`flex items-start gap-3 rounded-xl border px-4 py-3 transition-all cursor-pointer w-full ${S?"border-transparent bg-blue-50 shadow-sm":"border-gray-200 bg-[#FEFEFE] hover:border-gray-300 hover:bg-gray-50/60 hover:shadow-sm"}`,children:[e.jsxs("span",{className:"font-mono text-[12px] mt-0.5 flex-shrink-0 inline-flex items-center gap-1.5 min-w-[28px] 'text-gray-400'",children:[b+1,".",k.length>0&&W.filter(N=>k.includes(N.key)).map(N=>e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${N.badge}`},N.key))]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[d.label_group&&e.jsx("div",{className:"text-[10px] font-mono uppercase tracking-[0.18em] text-gray-400 mb-1",children:d.label_group}),e.jsx("p",{className:"text-sm text-gray-800 leading-relaxed",children:_})]}),e.jsx("button",{onClick:N=>{N.stopPropagation(),n2(d)},"aria-label":"Open market analysis",title:"Market analysis",className:"flex-shrink-0 self-center w-8 h-8 inline-flex items-center justify-center rounded-md text-gray-400 hover:text-[#0073FF] hover:bg-blue-50 transition-colors cursor-pointer",children:e.jsx("svg",{viewBox:"0 0 22 22",fill:"none",className:"w-4 h-4",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M11.0003 2.0625C11.0003 1.88016 11.0727 1.7053 11.2017 1.57636C11.3306 1.44743 11.5055 1.375 11.6878 1.375C12.8615 1.375 14.0237 1.60618 15.108 2.05533C16.1924 2.50448 17.1776 3.16281 18.0076 3.99273C18.8375 4.82266 19.4958 5.80792 19.945 6.89227C20.3941 7.97661 20.6253 9.13881 20.6253 10.3125C20.6253 10.4948 20.5529 10.6697 20.4239 10.7986C20.295 10.9276 20.1201 11 19.9378 11H11.6878C11.5055 11 11.3306 10.9276 11.2017 10.7986C11.0727 10.6697 11.0003 10.4948 11.0003 10.3125V2.0625ZM9.6253 4.84275C9.6253 4.74725 9.60541 4.65279 9.56689 4.5654C9.52837 4.47801 9.47206 4.39961 9.40156 4.33518C9.33106 4.27076 9.2479 4.22173 9.1574 4.19123C9.0669 4.16072 8.97104 4.1494 8.87592 4.158C7.31454 4.30036 5.82604 4.88469 4.58479 5.84255C3.34354 6.80042 2.40094 8.09214 1.86739 9.56643C1.33385 11.0407 1.23145 12.6365 1.57219 14.1669C1.91294 15.6973 2.68272 17.0989 3.79137 18.2076C4.90002 19.3162 6.30162 20.086 7.83201 20.4267C9.3624 20.7675 10.9582 20.6651 12.4325 20.1315C13.9068 19.598 15.1985 18.6554 16.1564 17.4141C17.1142 16.1729 17.6986 14.6844 17.8409 13.123C17.8493 13.0281 17.8379 12.9325 17.8074 12.8423C17.7768 12.752 17.7279 12.6691 17.6637 12.5988C17.5994 12.5285 17.5212 12.4722 17.4341 12.4337C17.347 12.3952 17.2528 12.3752 17.1575 12.375H9.6253V4.84275Z",fill:"currentColor"})})})]},d.label_id??b)})}):e.jsx("div",{className:"flex items-center justify-center py-10 text-[11px] font-mono uppercase tracking-[0.18em] text-gray-300",children:"No clauses in this subgroup"})]})]})]})]}),e.jsxs("div",{className:"w-[420px] flex-shrink-0 flex flex-col gap-4 min-h-0",children:[e.jsxs("div",{className:"flex-shrink-0 max-h-[12rem] bg-[#FEFEFE] rounded-2xl border border-gray-200 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-5 py-3.5 border-b border-gray-100 flex items-center justify-between flex-shrink-0",children:[e.jsx("span",{className:"text-sm font-semibold text-gray-700",children:"Source Language"}),(()=>{if(!A||L.loading||L.citations.length===0)return null;const d=L.citations.filter(b=>b.source_language!=="Not addressed in the contract").length;return d===0?null:e.jsxs("span",{className:"inline-flex items-center justify-center px-2 py-0.5 rounded-full bg-blue-50 text-[#0073FF] text-[11px] font-semibold",children:[d," Cited"]})})()]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto no-scrollbar",children:A?L.loading?e.jsxs("div",{className:"p-4 space-y-3 animate-pulse",children:[e.jsx("div",{className:"h-3 bg-gray-100 rounded w-2/3"}),e.jsx("div",{className:"h-3 bg-gray-100 rounded w-full"}),e.jsx("div",{className:"h-3 bg-gray-100 rounded w-5/6"})]}):L.citations.length===0?e.jsx("div",{className:"p-4 text-[11px] font-mono uppercase tracking-[0.18em] text-gray-300 text-center",children:"No source language available"}):L.citations.map((d,b)=>{const _=le===b,S=b===L.citations.length-1,k=d.source_language==="Not addressed in the contract",N=d.citations||`Citation ${b+1}`,B=S?"":"border-b border-gray-100";return k?e.jsx("div",{className:`px-5 py-3 ${B}`,children:e.jsx("p",{className:"text-xs text-gray-500 italic leading-relaxed",children:"Contract is silent on this clause â nothing to cite."})},b):e.jsx("div",{className:B,children:e.jsxs("button",{type:"button",onClick:P=>{le===b?(Le(-1),Re(null)):(Le(b),Re(P.currentTarget))},className:`w-full px-5 py-3 flex items-start gap-2 text-left cursor-pointer transition-colors ${_?"bg-blue-50/40":"hover:bg-gray-50"}`,children:[e.jsx(Pe,{className:`w-4 h-4 mt-0.5 flex-shrink-0 transition-all ${_?"text-[#0073FF] -rotate-90":"text-gray-400 -rotate-90"}`}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("div",{className:"text-[12px] font-medium text-gray-700 truncate",children:N})})]})},b)}):e.jsx("div",{className:"flex items-center justify-center h-full p-8 text-[11px] font-mono uppercase tracking-[0.18em] text-gray-300 text-center",children:"Select a clause to view source"})})]}),A&&(L.loading||(L.alternatives?.recommendations?.length||0)>0)&&e.jsxs("div",{className:"min-h-0 bg-[#FEFEFE] rounded-2xl border border-gray-200 flex flex-col overflow-hidden",children:[e.jsx("div",{className:"px-5 py-3.5 border-b border-gray-100 flex-shrink-0",children:e.jsx("span",{className:"text-sm font-semibold text-gray-700",children:"Ask the Vendor for"})}),e.jsx("div",{className:"flex-1 min-h-0",children:L.loading?e.jsxs("div",{className:"p-4 space-y-3 animate-pulse",children:[e.jsx("div",{className:"h-3 bg-gray-100 rounded w-2/3"}),e.jsx("div",{className:"h-3 bg-gray-100 rounded w-full"})]}):e.jsx(Zn,{alternatives:L.alternatives})})]})]})]}),le>=0&&_t&&L.citations?.[le]&&e.jsx(Kn,{citation:L.citations[le],anch
37orEl:_t,onClose:()=>{Le(-1),Re(null)}}),e.jsx($a,{})]})};export{Ei 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.