chordia-ui 3.8.2 → 3.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("react"),u=require("lucide-react"),ot=require("../UpdatedInteractionRecording.cjs.js"),Jt=require("../SideDrawer.cjs.js"),_={strong:"var(--Grey-Strong, #2E3236)",muted:"var(--Grey-Muted, #808183)",absent:"var(--Grey-absent, #D9D9D9)",accent:"var(--rail-orange, #C98A5A)",itemText:"var(--text-item, #3F3F3F)",quoteLine:"var(--border-warm, #B2AEA8)",quoteText:"var(--text-subtle-warm, #767473)",iconBg:"var(--surface-hover, #F3F7F7)"},Xt={effective:"Effective",strong:"Strong",needs_improvement:"Needs Improvement",mixed:"Mixed"},Xe="updated-coaching-synthesis-keyframes";function Ut(){if(typeof document>"u"||document.getElementById(Xe))return;const t=document.createElement("style");t.id=Xe,t.textContent=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),f=require("react"),p=require("lucide-react"),ot=require("../UpdatedInteractionRecording.cjs.js"),Jt=require("../SideDrawer.cjs.js"),_={strong:"var(--Grey-Strong, #2E3236)",muted:"var(--Grey-Muted, #808183)",absent:"var(--Grey-absent, #D9D9D9)",accent:"var(--rail-orange, #C98A5A)",itemText:"var(--text-item, #3F3F3F)",quoteLine:"var(--border-warm, #B2AEA8)",quoteText:"var(--text-subtle-warm, #767473)",iconBg:"var(--surface-hover, #F3F7F7)"},Xt={effective:"Effective",strong:"Strong",needs_improvement:"Needs Improvement",mixed:"Mixed"},Xe="updated-coaching-synthesis-keyframes";function Ut(){if(typeof document>"u"||document.getElementById(Xe))return;const t=document.createElement("style");t.id=Xe,t.textContent=`
2
2
  @keyframes updated-coaching-shimmer {
3
3
  0% { background-position: -200% 0; }
4
4
  100% { background-position: 200% 0; }
@@ -7,11 +7,11 @@
7
7
  0%, 100% { opacity: 0.4; }
8
8
  50% { opacity: 1; }
9
9
  }
10
- `,document.head.appendChild(t)}function en({overall:t}){const i=Xt[t]||(t?t.replace(/_/g," "):"");return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.jsx("span",{style:{fontSize:13,fontWeight:400,color:_.strong,fontFamily:"var(--font-sans)",lineHeight:1.2},children:"Overall:"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx(u.ThumbsUp,{size:14,color:_.strong,strokeWidth:1.5}),e.jsx("span",{style:{fontSize:13,fontWeight:600,color:_.strong,fontFamily:"var(--font-sans)",lineHeight:1.2},children:i})]})]})}function tn({item:t}){const i=typeof t=="string"?t:(t==null?void 0:t.text)||"",n=typeof t=="object"?t==null?void 0:t.quote:null;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[e.jsx("div",{style:{fontSize:14,fontWeight:600,color:_.itemText,fontFamily:"var(--font-sans)",lineHeight:1.5},children:i}),n&&e.jsxs("div",{style:{display:"flex",gap:10},children:[e.jsx("div",{style:{width:1,flexShrink:0,alignSelf:"stretch",background:_.quoteLine}}),e.jsxs("div",{style:{fontSize:14,fontWeight:400,color:_.quoteText,fontFamily:"var(--font-sans)",lineHeight:1.5},children:["“",n,"”"]})]})]})}function Ue({icon:t,label:i,items:n}){return!n||n.length===0?null:e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:16,borderRadius:12},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:9999,background:_.iconBg,flexShrink:0},children:t}),e.jsx("span",{style:{fontSize:16,fontWeight:600,color:_.strong,fontFamily:"var(--font-sans)",lineHeight:"normal"},children:i})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:24},children:n.map((l,o)=>e.jsx(tn,{item:l},o))})]})}const st=({data:t,loading:i,error:n})=>{var h,y;if(c.useEffect(()=>{Ut()},[]),i)return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:`
10
+ `,document.head.appendChild(t)}function en({overall:t}){const i=Xt[t]||(t?t.replace(/_/g," "):"");return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.jsx("span",{style:{fontSize:13,fontWeight:400,color:_.strong,fontFamily:"var(--font-sans)",lineHeight:1.2},children:"Overall:"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx(p.ThumbsUp,{size:14,color:_.strong,strokeWidth:1.5}),e.jsx("span",{style:{fontSize:13,fontWeight:600,color:_.strong,fontFamily:"var(--font-sans)",lineHeight:1.2},children:i})]})]})}function tn({item:t}){const i=typeof t=="string"?t:(t==null?void 0:t.text)||"",n=typeof t=="object"?t==null?void 0:t.quote:null;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[e.jsx("div",{style:{fontSize:14,fontWeight:600,color:_.itemText,fontFamily:"var(--font-sans)",lineHeight:1.5},children:i}),n&&e.jsxs("div",{style:{display:"flex",gap:10},children:[e.jsx("div",{style:{width:1,flexShrink:0,alignSelf:"stretch",background:_.quoteLine}}),e.jsxs("div",{style:{fontSize:14,fontWeight:400,color:_.quoteText,fontFamily:"var(--font-sans)",lineHeight:1.5},children:["“",n,"”"]})]})]})}function Ue({icon:t,label:i,items:n}){return!n||n.length===0?null:e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:16,borderRadius:12},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:9999,background:_.iconBg,flexShrink:0},children:t}),e.jsx("span",{style:{fontSize:16,fontWeight:600,color:_.strong,fontFamily:"var(--font-sans)",lineHeight:"normal"},children:i})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:24},children:n.map((o,l)=>e.jsx(tn,{item:o},l))})]})}const lt=({data:t,loading:i,error:n})=>{var u,y;if(f.useEffect(()=>{Ut()},[]),i)return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:`
11
11
  @keyframes coaching-spinner-spin {
12
12
  from { transform: rotate(0deg); }
13
13
  to { transform: rotate(360deg); }
14
14
  }
15
- `}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:12,padding:"48px 24px"},children:[e.jsxs("svg",{width:48,height:48,viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{animation:"coaching-spinner-spin 1.2s linear infinite"},children:[e.jsx("path",{d:"M43 24C43 26.4951 42.5086 28.9658 41.5537 31.271C40.5989 33.5762 39.1993 35.6707 37.435 37.435C35.6707 39.1993 33.5762 40.5989 31.271 41.5537C28.9658 42.5086 26.4951 43 24 43C21.5049 43 19.0342 42.5086 16.729 41.5537C14.4238 40.5989 12.3293 39.1993 10.565 37.435C8.80066 35.6707 7.40113 33.5762 6.44629 31.271C5.49145 28.9658 5 26.4951 5 24",stroke:"#F3E7C7",strokeWidth:"4",strokeLinecap:"round"}),e.jsx("path",{d:"M12 24C12 22.4241 12.3104 20.8637 12.9134 19.4078C13.5165 17.9519 14.4004 16.629 15.5147 15.5147C16.629 14.4004 17.9519 13.5165 19.4078 12.9134C20.8637 12.3104 22.4241 12 24 12C25.5759 12 27.1363 12.3104 28.5922 12.9134C30.0481 13.5165 31.371 14.4004 32.4853 15.5147C33.5996 16.629 34.4835 17.9519 35.0866 19.4078C35.6896 20.8637 36 22.4241 36 24",stroke:"#00A66E",strokeWidth:"4",strokeLinecap:"round"}),e.jsx("path",{d:"M20 24C20 24.5253 20.1035 25.0454 20.3045 25.5307C20.5055 26.016 20.8001 26.457 21.1716 26.8284C21.543 27.1999 21.984 27.4945 22.4693 27.6955C22.9546 27.8965 23.4747 28 24 28C24.5253 28 25.0454 27.8965 25.5307 27.6955C26.016 27.4945 26.457 27.1999 26.8284 26.8284C27.1999 26.457 27.4945 26.016 27.6955 25.5307C27.8965 25.0454 28 24.5253 28 24",stroke:"#F3E7C7",strokeWidth:"4",strokeLinecap:"round"})]}),e.jsx("span",{style:{fontSize:14,color:_.muted,fontWeight:500,textAlign:"center"},children:"Synthesizing coaching summary..."})]})]});if(n)return e.jsx("div",{style:{fontSize:14,color:_.muted},children:"Unable to generate coaching summary."});if(!t)return null;const l=t.strengths||[],o=t.improvements||[],a=typeof t.one_liner=="string"?t.one_liner:((h=t.one_liner)==null?void 0:h.text)||"",g=typeof t.context=="string"?t.context:((y=t.context)==null?void 0:y.text)||"";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,background:"#FFF"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(u.ShieldCheck,{size:20,color:_.accent,strokeWidth:2}),e.jsx("span",{style:{fontSize:16,fontWeight:600,color:_.strong,fontFamily:"var(--font-sans)",lineHeight:1.2,textTransform:"uppercase"},children:"Coaching Summary"})]}),a&&e.jsx("div",{style:{fontSize:14,fontWeight:500,color:_.strong,fontFamily:"var(--font-sans)",lineHeight:1.5},children:a}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:16,justifyContent:"space-between"},children:[g&&e.jsx("div",{style:{fontSize:14,fontWeight:400,color:_.muted,fontFamily:"var(--font-sans)",lineHeight:1.5,flex:1},children:g}),t.overall&&e.jsx(en,{overall:t.overall})]}),(l.length>0||o.length>0)&&e.jsxs("div",{style:{display:"flex",gap:24,paddingTop:24,borderTop:`1px solid ${_.absent}`},children:[e.jsx(Ue,{icon:e.jsx(u.TrendingUp,{size:14,color:_.strong,strokeWidth:1.5}),label:"Key Strengths",items:l}),e.jsx(Ue,{icon:e.jsx(u.Lightbulb,{size:14,color:_.strong,strokeWidth:1.5}),label:"Improvements",items:o})]})]})};function nn(t){const i=Math.floor(t/60),n=Math.round(t%60);return`${i}:${n.toString().padStart(2,"0")}`}const rn={display:"flex",justifyContent:"space-between",padding:"8px 8px 12px 8px",alignItems:"center",gap:24,fontFamily:"var(--font-sans)",fontSize:13,fontWeight:400,lineHeight:"normal",borderBottom:"1px solid var(--Grey-absent, #D9D9D9)"},et={display:"flex",flexDirection:"column",flex:"1 0 0",gap:0,minWidth:0},lt=({meta:t={},callPurpose:i={},classification:n={},dimensions:l=[],outcomeQuality:o="Neutral",onMoreDetails:a,moreDetails:g=[],resolutionOutcome:h,customerIntent:y,location:I,canShowEditButton:j=!1,onEditInteraction:W})=>{const[s,b]=c.useState(!1),k=c.useRef(null),C=t.duration_seconds!=null?nn(t.duration_seconds):null,D=t.message_count,H=i.interaction_driver,S=n.interaction_paradigm,F=p=>l.find(O=>(O.key||"").toLowerCase().includes(p)),M=F("resolution_outcome"),A=F("customer_intent"),T=F("location"),N=F("outcome_quality"),x=p=>p?p.replace(/_/g," ").replace(/\b\w/g,O=>O.toUpperCase()):null,m=o!=="Neutral"?o:N?x(N.value):o,d=h??(M?x(M.value):null),L=y??(A?x(A.value):null),Q=I??(T?x(T.value):null),ne=new Set(["resolution_outcome","customer_intent","location","outcome_quality"].map(p=>`dim.${p}`)),R=l.filter(p=>!ne.has(p.key)),J=[],U=[[C!=null?{label:"Duration",value:C}:null,D!=null?{label:"Messages",value:D}:null],[H!=null?{label:"Driver",value:H}:null,S!=null?{label:"Paradigm",value:S}:null]];for(let p=0;p<R.length;p+=2){const O=R[p]?{label:R[p].display_name||R[p].label||R[p].key,value:x(R[p].value)}:null,X=R[p+1]?{label:R[p+1].display_name||R[p+1].label||R[p+1].key,value:x(R[p+1].value)}:null;U.push([O,X])}U.push([{label:"Outcome Quality",value:m},{isMoreDetails:!0}]),U.forEach(p=>J.push(p));const se=[d!=null&&{label:"Resolution Outcome",value:d},L!=null&&{label:"Customer Intent",value:L},Q!=null&&{label:"Location",value:Q},...g||[]].filter(Boolean);c.useEffect(()=>{if(!s)return;const p=O=>{k.current&&!k.current.contains(O.target)&&b(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);const q=p=>e.jsxs("div",{style:rn,children:[e.jsx("span",{style:{color:"var(--Grey-Strong, #2E3236)",whiteSpace:"nowrap",flexShrink:0},children:p.label}),e.jsx("span",{style:{color:"var(--Grey-Muted, #808183)",textAlign:"right",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:p.value})]},p.label),de=()=>e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,padding:"8px 8px 12px 8px",fontFamily:"var(--font-sans)",borderBottom:"none",minHeight:33},children:[e.jsxs("button",{onClick:()=>{b(p=>!p),a&&!s&&a()},style:{display:"flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",padding:0,color:"var(--Grey-Strong, #2E3236)",fontSize:13,fontWeight:500,lineHeight:"normal",fontFamily:"var(--font-sans)",whiteSpace:"nowrap",flexShrink:0},children:[e.jsx("span",{children:"More Details"}),s?e.jsx(u.ChevronUp,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}):e.jsx(u.ChevronDown,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5})]}),j&&e.jsxs("button",{onClick:W||(()=>{}),style:{display:"flex",alignItems:"center",gap:6,padding:"5px 12px",background:"var(--Grey-White, #FFF)",border:"1px solid var(--Grey-absent, #D9D9D9)",borderRadius:12,color:"var(--Grey-Strong, #2E3236)",fontSize:13,fontWeight:500,lineHeight:"normal",fontFamily:"var(--font-sans)",cursor:"pointer",flexShrink:0},children:[e.jsx(u.Pencil,{size:15,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:13,lineHeight:"normal"},children:"Edit"})]})]},"more-details");return e.jsxs("div",{ref:k,style:{display:"flex",flexDirection:"column",alignSelf:"stretch",gap:0,position:"relative",overflow:"visible"},children:[J.map((p,O)=>{var X;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24,alignSelf:"stretch",flexWrap:"nowrap"},children:[e.jsx("div",{style:et,children:p[0]&&!p[0].isMoreDetails?q(p[0]):e.jsx("div",{style:{flex:1}})}),e.jsx("div",{style:et,children:p[1]&&!p[1].isMoreDetails?q(p[1]):(X=p[1])!=null&&X.isMoreDetails?de():e.jsx("div",{style:{flex:1}})})]},O)}),s&&se.length>0&&e.jsxs("div",{style:{position:"absolute",top:"100%",right:0,marginTop:4,display:"flex",width:340,flexDirection:"column",alignItems:"flex-start",borderRadius:4,border:"1px solid var(--Grey-absent, #D9D9D9)",background:"var(--Grey-White, #FFF)",boxShadow:"-2px 2px 2px 0 rgba(0, 0, 0, 0.25)",overflow:"hidden",fontFamily:"var(--font-sans)",zIndex:50},children:[e.jsx("div",{style:{padding:"12px 16px",fontSize:13,fontWeight:600,color:"var(--Grey-Strong, #2E3236)",borderBottom:"1px solid var(--Grey-absent, #D9D9D9)",alignSelf:"stretch"},children:"More details"}),se.map(p=>e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px 16px",gap:24,fontSize:13,fontWeight:400,lineHeight:"normal",borderBottom:"1px solid var(--Grey-absent, #D9D9D9)",alignSelf:"stretch"},children:[e.jsx("span",{style:{color:"var(--Grey-Strong, #2E3236)",whiteSpace:"nowrap",flexShrink:0},children:p.label}),e.jsx("span",{style:{color:"var(--Grey-Muted, #808183)",fontSize:13,fontStyle:"normal",fontWeight:400,lineHeight:"120%",textAlign:"right"},children:p.value})]},p.label))]})]})},G={strong:"var(--Grey-Strong, #2E3236)",muted:"var(--Grey-Muted, #808183)",absent:"var(--Grey-absent, #D9D9D9)",white:"var(--Grey-White, #FFF)",cardBg:"var(--surface-warm-40, rgba(243, 241, 229, 0.40))"},P=1.2,tt=3,nt=t=>t!=null?Math.round(t*100)+"%":"—",on=t=>{if(t==null)return"—";const i=(t*100).toFixed(1);return t>0?`+${i}pp`:`${i}pp`},at=({outcomeLift:t,driverLabels:i=[]})=>{var s;if(!t||t.lift==null)return null;const n=t.p_expected,l=t.p_full,o=t.lift_raw??(l!=null&&n!=null?l-n:null),a=t.lift,g=(s=t.interpretation)!=null&&s.lift_band?t.interpretation.lift_band.replace(/_/g," "):a>=0?"Positive":"Negative",h=g.charAt(0).toUpperCase()+g.slice(1),I=/negative/i.test(g)?u.ThumbsDown:u.ThumbsUp,j=i.slice(0,tt),W=i.length-tt;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",padding:24,gap:24,borderRadius:8,border:`1px solid ${G.absent}`,background:G.cardBg,alignSelf:"stretch"},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:32},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:24,alignSelf:"stretch"},children:[e.jsx("span",{style:{fontSize:15,fontWeight:600,color:G.strong,fontFamily:"var(--font-sans)",lineHeight:P},children:"Agent Lift Analysis"}),e.jsx("div",{style:{display:"flex",alignItems:"center",gap:8,fontFamily:"var(--font-sans)"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,paddingLeft:8},children:[e.jsx(I,{size:14,color:G.strong}),e.jsx("span",{style:{fontSize:13,fontWeight:600,color:G.strong,lineHeight:P},children:h})]})})]}),e.jsxs("div",{style:{display:"flex",gap:24},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,alignItems:"flex-start",flex:1,minWidth:0},children:[e.jsx("span",{style:{fontSize:28,fontWeight:400,color:G.muted,fontFamily:"var(--font-sans)",lineHeight:P},children:nt(n)}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,alignItems:"flex-start",minHeight:48},children:[e.jsx("span",{style:{fontSize:13,fontWeight:400,color:G.strong,fontFamily:"var(--font-sans)",lineHeight:P,whiteSpace:"nowrap"},children:"Expected Outcome"}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:G.muted,fontFamily:"var(--font-sans)",lineHeight:P,textAlign:"left"},children:"Based on call type & difficulty"})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,alignItems:"flex-start",paddingLeft:24,borderLeft:`1px solid ${G.absent}`,flex:1,minWidth:0},children:[e.jsx("span",{style:{fontSize:28,fontWeight:400,color:G.muted,fontFamily:"var(--font-sans)",lineHeight:P},children:on(o)}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,alignItems:"flex-start",minHeight:48},children:[e.jsx("span",{style:{fontSize:13,fontWeight:400,color:G.strong,fontFamily:"var(--font-sans)",lineHeight:P,whiteSpace:"nowrap"},children:"Agent Impact"}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:G.muted,fontFamily:"var(--font-sans)",lineHeight:P,textAlign:"left"},children:"Behavior-driven change"})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,alignItems:"flex-start",paddingLeft:24,borderLeft:`1px solid ${G.absent}`,flex:1,minWidth:0},children:[e.jsx("span",{style:{fontSize:28,fontWeight:400,color:G.strong,fontFamily:"var(--font-sans)",lineHeight:P},children:nt(l)}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,alignItems:"flex-start",minHeight:48},children:[e.jsx("span",{style:{fontSize:13,fontWeight:600,color:G.strong,fontFamily:"var(--font-sans)",lineHeight:P,whiteSpace:"nowrap"},children:"Outcome"}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:G.muted,fontFamily:"var(--font-sans)",lineHeight:P,textAlign:"left"},children:"With agent behaviors"})]})]})]})]}),i.length>0&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,alignSelf:"stretch"},children:[e.jsx("span",{style:{fontSize:12,fontWeight:600,color:G.strong,fontFamily:"var(--font-sans)",lineHeight:P},children:"Key Drivers"}),e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[j.map((b,k)=>e.jsx("div",{style:{display:"flex",padding:8,alignItems:"center",justifyContent:"center",borderRadius:4,border:`1px solid ${G.absent}`,background:G.white},children:e.jsx("span",{style:{fontSize:12,fontWeight:400,color:G.strong,fontFamily:"var(--font-sans)",lineHeight:P,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:200},children:b})},k)),W>0&&e.jsx("div",{style:{display:"flex",padding:8,alignItems:"center",justifyContent:"center",borderRadius:4,border:`1px solid ${G.absent}`,background:G.white},children:e.jsxs("span",{style:{fontSize:12,fontWeight:400,color:G.strong,fontFamily:"var(--font-sans)",lineHeight:P,whiteSpace:"nowrap"},children:["+ ",W]})})]})]})]})},it=({children:t,size:i=28,onClick:n,title:l})=>{const[o,a]=c.useState(!1);return e.jsx("div",{title:l,onClick:n,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),style:{display:"flex",alignItems:"center",justifyContent:"center",width:i,height:i,borderRadius:9999,background:o?"var(--surface-hover, #F3F7F7)":"transparent",cursor:"pointer",flexShrink:0,transition:"background 0.15s"},children:t})},dt=({signals:t={signals:[],present_count:0,total_signals_evaluated:0},expandedSignals:i=new Set,toggleSignal:n=()=>{},playEvidence:l=()=>{},highlightTurns:o=()=>{},onShowInTranscript:a=()=>{},timelinePlaying:g=!1,currentTimeSeconds:h=0})=>{const y=(t==null?void 0:t.signals)??[],I=(t==null?void 0:t.present_count)??y.length,j=s=>{const b=Math.floor(s/6e4),k=Math.floor(s%6e4/1e3);return`${b.toString().padStart(2,"0")}:${k.toString().padStart(2,"0")}`},W=s=>g&&s.start_ms!=null&&h*1e3>=s.start_ms&&h*1e3<=(s.end_ms??s.start_ms+5e3);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",alignSelf:"stretch",width:"100%",gap:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,width:"100%"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:34,height:34,borderRadius:9999,background:"var(--surface-hover, #F3F7F7)",flexShrink:0},children:e.jsx(u.FileSignal,{size:20,color:"#2E3236",strokeWidth:1.5})}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flex:1},children:[e.jsx("span",{style:{fontSize:15,fontWeight:500,color:"var(--Grey-Strong, #2E3236)"},children:"Signals"}),e.jsxs("span",{style:{fontSize:14,fontWeight:500,color:"var(--Grey-Strong, #2E3236)"},children:[I," Signals Detected"]})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignSelf:"stretch",background:"var(--Grey-White, #FFF)",gap:8},children:[y.length===0&&e.jsx("div",{style:{padding:"8px 0",fontSize:14,color:"var(--Grey-Muted, #808183)"},children:"No signals detected."}),y.map((s,b)=>{var H,S,F;const k=s.key??s.id??b,C=i.has(k),D=((H=s.observations)==null?void 0:H.length)??0;return e.jsxs("div",{id:`signal-${k}`,style:{display:"flex",flexDirection:"column",width:"100%",gap:8},children:[e.jsxs("button",{onClick:()=>n(k),style:{display:"flex",padding:"8px 0",alignItems:"center",gap:12,alignSelf:"stretch",width:"100%",background:"none",border:"none",borderBottom:"1px solid var(--Grey-absent, #D9D9D9)",cursor:"pointer"},children:[e.jsxs("span",{style:{flex:1,textAlign:"left",fontSize:14,fontWeight:600,color:"var(--text-dark, #0B0A0A)",lineHeight:1.71},children:[s.display_name||((S=s.key)==null?void 0:S.replace(/_/g," ")),D>0&&e.jsxs("span",{style:{fontWeight:600,color:"var(--text-dark, #0B0A0A)",marginLeft:6},children:["(",D,")"]})]}),C?e.jsx(u.ChevronUp,{size:20,color:"#767473"}):e.jsx(u.ChevronDown,{size:20,color:"#767473"})]}),C&&((F=s.observations)==null?void 0:F.length)>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",alignSelf:"stretch",gap:0},children:s.observations.map((M,A)=>{var T,N,x;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignSelf:"stretch",gap:8},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"8px 0",justifyContent:"space-between"},children:[e.jsx("span",{style:{flex:1,fontSize:14,fontWeight:400,color:"var(--text-subtle-warm, #767473)",lineHeight:1.5},children:M.reason||M.explanation}),((N=(T=M.evidence)==null?void 0:T[0])==null?void 0:N.start_ms)!=null&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.jsx(it,{size:28,title:"Show in transcript",onClick:m=>{m.stopPropagation(),a(M.evidence[0].start_ms)},children:e.jsx(u.ScrollText,{size:16,color:"#808183",strokeWidth:1.5})}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:1.2,whiteSpace:"nowrap"},children:j(M.evidence[0].start_ms)})]})]}),(x=M.evidence)==null?void 0:x.map((m,d)=>{const L=m.start_ms!=null&&m.end_ms!=null;return m.text&&e.jsxs("div",{onClick:Q=>{Q.stopPropagation(),L&&l(m)},onMouseEnter:()=>o(m.turn_ids??[]),onMouseLeave:()=>o([]),style:{display:"flex",alignItems:"center",gap:8,padding:"8px 0",cursor:L?"pointer":"default"},children:[L&&e.jsx(it,{size:28,children:W(m)?e.jsx(u.PauseCircle,{size:17,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}):e.jsx(u.PlayCircle,{size:17,color:"var(--Grey-Muted, #808183)",strokeWidth:1})}),e.jsxs("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2},children:["“",m.text,"”"]})]},d)})]},M.key??A)})})]},k)})]})]})},$={strong:"var(--Grey-Strong, #2E3236)",muted:"var(--Grey-Muted, #808183)",absent:"var(--Grey-absent, #D9D9D9)",white:"var(--Grey-White, #FFF)",accent:"var(--rail-orange, #C98A5A)",track:"var(--rail-surface-2, #E3E1D7)",infoIcon:"var(--color-input-border, #ACACAD)"},sn=({score:t=4,minScore:i=0,maxScore:n=5})=>{const j=Number(t),W=Number.isFinite(j)?Math.min(Math.max(j,i),n):i,s=n>i?(W-i)/(n-i)*5:0,b=180/5,k=H=>{const S=H*Math.PI/180;return{x:121.5+85*Math.cos(S),y:123-85*Math.sin(S)}},C=(H,S)=>{const F=k(H),M=k(S),A=H-S>180?1:0;return`M ${F.x} ${F.y} A 85 85 0 ${A} 1 ${M.x} ${M.y}`},D=2;return e.jsx("svg",{width:"100%",viewBox:"0 0 243 130",fill:"none",style:{maxWidth:243},children:Array.from({length:5},(H,S)=>{const F=180-S*b-(S>0?D/2:0),M=180-(S+1)*b+(S<5-1?D/2:0),A=Math.max(0,Math.min(1,s-S)),T=C(F,M);return e.jsxs("g",{children:[e.jsx("path",{d:T,stroke:$.track,strokeWidth:30,strokeLinecap:"butt",fill:"none"}),A>0&&e.jsx("path",{d:T,stroke:$.strong,strokeWidth:30,strokeLinecap:"butt",fill:"none",pathLength:1,strokeDasharray:`${A} 1`})]},S)})})},ln=({value:t=0,maxValue:i=5})=>{const n=Number(t),l=Number.isFinite(n)?Math.min(Math.max(n,0),i):0;return e.jsx("div",{style:{display:"flex",gap:2},children:Array.from({length:i},(o,a)=>{const g=Math.max(0,Math.min(1,l-a));return e.jsx("div",{style:{width:22,height:6,borderRadius:1,background:$.track,overflow:"hidden"},children:g>0&&e.jsx("div",{style:{width:`${g*100}%`,height:"100%",background:$.strong}})},a)})})},an={CSAT:"Predicted Customer Satisfaction",Resolution:"Predicted Resolution: was the issue fully resolved?","Process Adherence":"Process Adherence: Did the agent follow procedures?",Communication:"Predicted Communication Quality: Clarity, Empathy, Professionalism"},dn=({text:t,children:i})=>{const[n,l]=c.useState(!1),o=c.useRef(null),[a,g]=c.useState({top:0,left:0}),h=()=>{if(o.current){const y=o.current.getBoundingClientRect();g({top:y.top-8,left:y.left+y.width/2})}l(!0)};return e.jsxs("div",{ref:o,style:{position:"relative",display:"inline-flex"},onMouseEnter:h,onMouseLeave:()=>l(!1),children:[i,n&&e.jsx("div",{style:{position:"fixed",top:a.top,left:a.left,transform:"translate(-50%, -100%)",display:"flex",width:"max-content",maxWidth:300,padding:10,alignItems:"center",borderRadius:4,border:"1px solid var(--Grey-absent, #D9D9D9)",background:"var(--Grey-Strong, #2E3236)",zIndex:9999,pointerEvents:"none"},children:e.jsx("span",{style:{color:"#FFF",fontSize:12,fontWeight:400,lineHeight:"140%"},children:t})})]})},cn=({label:t,value:i=0,maxValue:n=5})=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,padding:8,alignItems:"flex-start"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontSize:12,fontWeight:400,color:$.strong,fontFamily:"var(--font-sans)",lineHeight:"normal"},children:t}),e.jsx(dn,{text:an[t]||t,children:e.jsx(u.Info,{size:14,color:$.infoIcon,strokeWidth:1,style:{cursor:"pointer"}})})]}),e.jsx(ln,{value:i,maxValue:n})]}),ct=({score:t=4,minScore:i=0,maxScore:n=5,predictedScore:l=4,predictedLabel:o="Predicted Objective",description:a="",legends:g=[{label:"CSAT",value:3},{label:"Resolution",value:4},{label:"Process Adherence",value:5},{label:"Communication",value:3}]})=>{const h=Number(t),y=Number.isFinite(h)?Math.min(Math.max(h,i),n):i,I=y.toFixed(1);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",padding:24,borderRadius:8,border:`1px solid ${$.absent}`,background:$.white,alignSelf:"stretch",flex:1,gap:24},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[e.jsx("span",{style:{fontSize:15,fontWeight:600,color:$.strong,fontFamily:"var(--font-sans)",lineHeight:1.2},children:"Interaction Quality"}),e.jsx("span",{style:{fontSize:14,fontWeight:400,color:$.muted,fontFamily:"var(--font-sans)",lineHeight:"normal"},children:a})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:24,flex:1,overflow:"hidden"},children:[e.jsxs("div",{style:{position:"relative",maxWidth:243,minWidth:160,flex:"0 1 243px",flexDirection:"column",alignItems:"center",display:"flex"},children:[e.jsx(sn,{score:t,minScore:i,maxScore:n}),(()=>{const s=-(180-(n>i?(y-i)/(n-i):0)*180-45);return e.jsxs("svg",{width:"34",height:"35",viewBox:"0 0 34 35",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{marginTop:-24,transform:`rotate(${s}deg)`,transformOrigin:"center center"},children:[e.jsx("path",{d:"M16 25.2169C19.958 25.2169 23.1667 22.0083 23.1667 18.0503C23.1667 14.0922 19.958 10.8836 16 10.8836C12.042 10.8836 8.83334 14.0922 8.83334 18.0503C8.83334 22.0083 12.042 25.2169 16 25.2169Z",fill:"var(--rail-orange, #C98A5A)"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M30.4791 11.2328L33.4351 0L21.6888 3.09113C19.9212 2.41855 18.0036 2.05025 16 2.05025C7.16344 2.05025 0 9.2137 0 18.0503C0 26.8868 7.16344 34.0503 16 34.0503C24.8366 34.0503 32 26.8868 32 18.0503C32 15.6119 31.4546 13.301 30.4791 11.2328ZM16 30.5503C22.9036 30.5503 28.5 24.9538 28.5 18.0503C28.5 11.1467 22.9036 5.55025 16 5.55025C9.09644 5.55025 3.5 11.1467 3.5 18.0503C3.5 24.9538 9.09644 30.5503 16 30.5503Z",fill:"var(--rail-orange, #C98A5A)"})]})})(),e.jsx("div",{style:{fontSize:28,fontWeight:400,color:$.strong,fontFamily:"var(--font-sans)",lineHeight:1,textAlign:"center",marginTop:8},children:I}),e.jsx("div",{style:{fontSize:15,fontWeight:500,color:$.strong,fontFamily:"var(--font-sans)",lineHeight:1.2,textAlign:"center",marginTop:8},children:"Compass Score"})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,alignItems:"flex-start",justifyContent:"center",flex:1},children:[e.jsx("div",{style:{fontSize:15,fontWeight:500,color:$.strong,fontFamily:"var(--font-sans)",lineHeight:1.2,textAlign:"left"},children:"Interaction Quality Index"}),e.jsx("div",{style:{width:"100%",height:1,background:$.absent}}),g.map((j,W)=>e.jsx(cn,{label:j.label,value:j.value},W))]})]})]})},ft=t=>{if(!t)return null;const n=String(t).trim().toLowerCase().split(/[^a-z]+/).filter(Boolean);return n.includes("supervisor")?"var(--rail-compliance, #C98A5A)":n.includes("admin")||n.includes("administrator")||n.includes("superadmin")?"var(--rail-discovery, #5E88B0)":n.includes("agent")?"var(--rail-outcome, #6B7C93)":null},fn=t=>{var l,o,a,g,h,y;if(!t)return null;const i=t.role??t.userRole??t.user_role??t.author_role??t.roleName??t.role_name??t.userType??t.user_type??t.type;if(typeof i=="string")return i;if(Array.isArray(i))return i.join(" ");if(i&&typeof i=="object")return i.name||i.value||i.label||null;const n=((l=t.user)==null?void 0:l.role)??((o=t.user)==null?void 0:o.userRole)??((a=t.user)==null?void 0:a.user_role)??((g=t.profile)==null?void 0:g.role)??((h=t.profile)==null?void 0:h.userRole)??((y=t.profile)==null?void 0:y.user_role);return typeof n=="string"?n:Array.isArray(n)?n.join(" "):n&&typeof n=="object"&&(n.name||n.value||n.label)||null},gt=t=>{if(!t)return"#6B7C93";const i=fn(t);return ft(i)||t.color||"#6B7C93"},Se=t=>(t||"").split(" ").map(i=>i[0]).join("").toUpperCase()||"U",gn=t=>{if(!t||t==="Just now")return!0;if(/^\d{4}-\d{2}-\d{2}T/.test(t))try{const n=/Z$|[+-]\d{2}:\d{2}$/.test(t)?t:t+"Z",l=new Date(n);return Number.isNaN(l.getTime())?!1:Date.now()-l.getTime()<15*60*1e3}catch{return!1}const i=t.match(/^(\d+)\s*min/);return i?parseInt(i[1],10)<15:!(/\d+\s*h/.test(t)||/\d+\s*day/.test(t))},hn=t=>{if(!t)return"";if(!/^\d{4}-\d{2}-\d{2}T/.test(t))return t;try{const i=/Z$|[+-]\d{2}:\d{2}$/.test(t)?t:t+"Z",n=new Date(i);if(Number.isNaN(n.getTime()))return t;const o=new Date().getTime()-n.getTime(),a=Math.floor(o/6e4),g=Math.floor(o/36e5);if(a<1)return"Just now";if(a<60)return`${a} min`;if(g<24)return`${g} h`;const h=Math.floor(g/24);return h===1?"1 day":`${h} days`}catch{return t}},ht=({name:t,initials:i,color:n,avatar:l,size:o=36})=>l?e.jsx("img",{src:l,alt:t,style:{width:o,height:o,borderRadius:"50%",objectFit:"cover",flexShrink:0}}):e.jsx("div",{style:{width:o,height:o,borderRadius:"50%",background:n||"#6B7C93",color:"#FFF",display:"flex",alignItems:"center",justifyContent:"center",fontSize:o<=32?"10px":"11px",fontWeight:650,flexShrink:0,fontFamily:"var(--default-font-family)",letterSpacing:"0.02em"},title:t,children:i||Se(t)}),pn=({comment:t,isReply:i=!1,isConsecutive:n=!1,onReply:l,onSendReply:o,onEdit:a,onDelete:g,onMenuClick:h,showReply:y=!0})=>{var O,X;const[I,j]=c.useState(!1),[W,s]=c.useState(!1),[b,k]=c.useState(!1),[C,D]=c.useState(""),[H,S]=c.useState(!1),[F,M]=c.useState(""),[A,T]=c.useState(!1),N=c.useRef(null),x=c.useRef(null),m=c.useRef(null),d=t.author||{},L=d.name||t.author_name||"Unknown",Q=d.initials||Se(L),ne=d.role||t.author_role,R=d.color||ft(ne)||"#6B7C93",J=d.avatar||t.avatar,U=t.timestamp||t.created_at,se=hn(U),q=gn(U),de=!!(t.isEdited||t.is_edited||t.edited),p=Array.isArray(t.content)?t.content:[t.content||t.text||""];return c.useEffect(()=>{if(!W)return;const r=V=>{N.current&&!N.current.contains(V.target)&&s(!1)};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[W]),c.useEffect(()=>{const r=x.current;if(!r)return;r.style.height="auto";const V=140;r.style.height=Math.min(r.scrollHeight,V)+"px",r.style.overflowY=r.scrollHeight>V?"auto":"hidden"},[C,b]),c.useEffect(()=>{const r=m.current;if(!r)return;r.style.height="auto";const V=140;r.style.height=Math.min(r.scrollHeight,V)+"px",r.style.overflowY=r.scrollHeight>V?"auto":"hidden"},[F,H]),e.jsxs("div",{onMouseEnter:()=>j(!0),onMouseLeave:()=>j(!1),style:{display:"flex",paddingLeft:i?48:0,alignItems:"flex-start",gap:16,paddingTop:n?0:8,paddingBottom:8},children:[n?e.jsx("div",{style:{width:36,flexShrink:0}}):e.jsx(ht,{name:L,initials:Q,color:R,avatar:J}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:n?"flex-end":"space-between",marginBottom:n?0:6},children:[!n&&e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[e.jsx("span",{style:{fontSize:13,fontWeight:650,color:"var(--text-ink, #1E2125)",lineHeight:"150%",fontFamily:"var(--default-font-family)"},children:L}),e.jsx("span",{style:{fontSize:12,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:"150%",fontFamily:"var(--default-font-family)"},children:se}),de&&e.jsx("span",{style:{fontSize:12,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:"150%",fontFamily:"var(--default-font-family)"},children:"(Edited)"})]}),e.jsxs("div",{style:{position:"relative"},ref:N,children:[e.jsx("button",{type:"button",onClick:()=>s(r=>!r),style:{padding:2,border:"none",background:"transparent",cursor:"pointer",borderRadius:4,display:"flex",alignItems:"center",justifyContent:"center",opacity:I||W?1:0,transition:"opacity 0.15s",flexShrink:0},children:e.jsx(u.Ellipsis,{size:24,color:"var(--Grey-Muted, #808183)"})}),W&&e.jsxs("div",{style:{position:"absolute",top:"100%",right:0,marginTop:4,display:"flex",width:99,flexDirection:"column",alignItems:"flex-start",borderRadius:4,border:"1px solid var(--Grey-absent, #D9D9D9)",background:"var(--Grey-White, #FFF)",boxShadow:"-2px 2px 2px 0 rgba(0, 0, 0, 0.25)",zIndex:50,overflow:"hidden"},children:[l&&e.jsx("button",{type:"button",onClick:()=>{s(!1),S(!1),k(!0)},style:{display:"flex",width:"100%",padding:"10px 16px",alignItems:"center",border:"none",background:"transparent",cursor:"pointer",fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",fontFamily:"var(--default-font-family)",lineHeight:"150%",textAlign:"left"},onMouseEnter:r=>{r.currentTarget.style.background="var(--surface-hover, #F3F7F7)"},onMouseLeave:r=>{r.currentTarget.style.background="transparent"},children:"Reply"}),a&&e.jsx("button",{type:"button",disabled:!q,onClick:()=>{if(!q)return;s(!1);const r=Array.isArray(t.content)?t.content.join(`
16
- `):t.content||t.text||"";M(r),S(!0),k(!1)},style:{display:"flex",width:"100%",padding:"10px 16px",alignItems:"center",border:"none",background:"transparent",cursor:q?"pointer":"not-allowed",fontSize:13,fontWeight:400,color:q?"var(--Grey-Strong, #2E3236)":"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",lineHeight:"150%",textAlign:"left",opacity:q?1:.5},onMouseEnter:r=>{q&&(r.currentTarget.style.background="var(--surface-hover, #F3F7F7)")},onMouseLeave:r=>{r.currentTarget.style.background="transparent"},children:"Edit"}),g&&e.jsx("button",{type:"button",onClick:()=>{s(!1),T(!0)},style:{display:"flex",width:"100%",padding:"10px 16px",alignItems:"center",border:"none",background:"transparent",cursor:"pointer",fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",fontFamily:"var(--default-font-family)",lineHeight:"150%",textAlign:"left"},onMouseEnter:r=>{r.currentTarget.style.background="var(--surface-hover, #F3F7F7)"},onMouseLeave:r=>{r.currentTarget.style.background="transparent"},children:"Delete"})]})]})]}),H?e.jsxs("div",{style:{display:"flex",width:662,maxWidth:"100%",padding:"8px 12px 12px 12px",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:24,borderRadius:8,border:"1px solid var(--Grey-absent, #D9D9D9)",background:"var(--Grey-White, #FFF)",boxSizing:"border-box",marginTop:4},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:[e.jsxs("span",{style:{fontSize:13,fontWeight:600,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",lineHeight:"normal"},children:["“"," ",((O=t.author)==null?void 0:O.name)||"Unknown"]}),e.jsx("button",{type:"button",onClick:()=>S(!1),style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0},children:e.jsx(u.X,{size:20,color:"var(--Grey-Muted, #808183)"})})]}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-end",gap:8,width:"100%"},children:[e.jsx("textarea",{ref:m,value:F,onChange:r=>M(r.target.value),onKeyDown:r=>{if(r.key==="Enter"){if(r.metaKey||r.ctrlKey||r.shiftKey)return;r.preventDefault(),F.trim()&&(a==null||a({...t,content:F.trim(),isEdited:!0}),S(!1))}r.key==="Escape"&&S(!1)},autoFocus:!0,rows:1,style:{flex:1,padding:"10px 12px",fontSize:13,fontWeight:400,color:"var(--text-ink, #1E2125)",fontFamily:"var(--default-font-family)",lineHeight:"160%",border:"none",background:"transparent",outline:"none",boxSizing:"border-box",resize:"none",minHeight:24,maxHeight:140,overflowY:"hidden"}}),e.jsx("button",{type:"button",onClick:()=>{F.trim()&&(a==null||a({...t,content:F.trim(),isEdited:!0}),S(!1))},disabled:!F.trim(),style:{display:"flex",padding:"6px 16px",justifyContent:"center",alignItems:"center",fontSize:13,fontWeight:600,color:F.trim()?"var(--Grey-White, #FFF)":"var(--Grey-Muted, #808183)",background:F.trim()?"var(--Grey-Strong, #2E3236)":"var(--grey-light, #e9e8e8a1)",border:"none",borderRadius:6,cursor:F.trim()?"pointer":"not-allowed",fontFamily:"var(--default-font-family)",flexShrink:0,transition:"all 0.15s",lineHeight:"150%"},children:"Save"})]})]}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4,alignItems:"flex-start"},children:p.map((r,V)=>e.jsx("div",{style:{fontSize:13,fontWeight:400,color:"var(--text-ink, #1E2125)",lineHeight:"160%",fontFamily:"var(--default-font-family)",padding:"8px 12px",background:i?"var(--surface-hover, #F3F7F7)":"var(--surface-warm-40, rgba(243, 241, 229, 0.40))",borderRadius:8,wordBreak:"break-word",whiteSpace:"pre-wrap"},children:r},V))}),A&&e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8,marginTop:8,fontSize:13,fontFamily:"var(--default-font-family)"},children:[e.jsx("span",{style:{color:"var(--Grey-Muted, #808183)",fontWeight:400},children:"Confirm: delete this comment?"}),e.jsx("button",{type:"button",onClick:()=>{T(!1),g==null||g(t)},style:{background:"var(--grey-light, #e9e8e8a1)",border:"none",cursor:"pointer",fontSize:13,fontWeight:600,color:"var(--text-ink, #1E2125)",fontFamily:"var(--default-font-family)",padding:"4px 10px",borderRadius:6,transition:"background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.background="var(--Grey-absent, #D9D9D9)"},onMouseLeave:r=>{r.currentTarget.style.background="var(--grey-light, #e9e8e8a1)"},children:"Delete"}),e.jsx("button",{type:"button",onClick:()=>T(!1),style:{background:"none",border:"none",cursor:"pointer",fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",padding:"4px 10px",borderRadius:6,transition:"background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.background="var(--grey-light, #e9e8e8a1)"},onMouseLeave:r=>{r.currentTarget.style.background="none"},children:"Cancel"})]}),y&&l&&!b&&!A&&e.jsxs("button",{type:"button",onClick:()=>{S(!1),k(!0)},style:{display:"flex",alignItems:"center",gap:6,marginTop:8,padding:0,border:"none",background:"transparent",cursor:"pointer",fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",transition:"color 0.15s"},children:[e.jsx(u.CornerDownRight,{size:20,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),"Reply"]}),b&&e.jsxs("div",{style:{display:"flex",width:662,maxWidth:"100%",padding:"8px 12px 12px 12px",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:24,borderRadius:8,border:"1px solid var(--Grey-absent, #D9D9D9)",background:"var(--Grey-White, #FFF)",boxSizing:"border-box",marginTop:12},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,width:"100%"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:[e.jsxs("span",{style:{fontSize:13,fontWeight:600,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",lineHeight:"normal"},children:["“"," ",((X=t.author)==null?void 0:X.name)||"Unknown"]}),e.jsx("button",{type:"button",onClick:()=>{D(""),k(!1)},style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0},children:e.jsx(u.X,{size:20,color:"var(--Grey-Muted, #808183)"})})]}),e.jsx("div",{style:{display:"flex",height:36,padding:16,alignItems:"center",gap:5,borderRadius:"0 8px 8px 8px",background:"var(--Grey-Strong, #2E3236)",boxSizing:"border-box",width:"100%"},children:e.jsx("span",{style:{color:"var(--Grey-White, #FFF)",fontSize:13,fontWeight:400,fontFamily:"var(--default-font-family)",lineHeight:"normal",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Array.isArray(t.content)?t.content[0]:t.content})})]}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-end",gap:8,width:"100%"},children:[e.jsx("textarea",{ref:x,value:C,onChange:r=>D(r.target.value),onKeyDown:r=>{if(r.key==="Enter"){if(r.metaKey||r.ctrlKey||r.shiftKey)return;r.preventDefault(),C.trim()&&(o==null||o({content:C.trim(),parentId:t.id}),D(""),k(!1))}r.key==="Escape"&&(D(""),k(!1))},autoFocus:!0,placeholder:"Add a reply",rows:1,style:{flex:1,padding:"10px 12px",fontSize:13,fontWeight:400,color:"var(--text-ink, #1E2125)",fontFamily:"var(--default-font-family)",lineHeight:"160%",border:"none",background:"transparent",outline:"none",boxSizing:"border-box",resize:"none",minHeight:24,maxHeight:140,overflowY:"hidden"}}),e.jsx("button",{type:"button",onClick:()=>{C.trim()&&(o==null||o({content:C.trim(),parentId:t.id}),D(""),k(!1))},disabled:!C.trim(),style:{display:"flex",height:28,padding:"8px 12px",justifyContent:"center",alignItems:"center",gap:8,fontSize:13,fontWeight:600,color:C.trim()?"var(--Grey-White, #FFF)":"var(--Grey-Muted, #808183)",background:C.trim()?"var(--Neutral-850, #272727)":"var(--grey-light, #e9e8e8a1)",border:"none",borderRadius:10,cursor:C.trim()?"pointer":"not-allowed",fontFamily:"var(--default-font-family)",lineHeight:"150%"},children:"Post"})]})]})]})]})},un=({currentUser:t,onSubmit:i})=>{const[n,l]=c.useState(""),[o,a]=c.useState(!1),g=c.useRef(null);c.useEffect(()=>{const s=g.current;if(!s)return;s.style.height="auto";const b=140;s.style.height=Math.min(s.scrollHeight,b)+"px",s.style.overflowY=s.scrollHeight>b?"auto":"hidden"},[n]);const h=()=>{const s=n.trim();s&&(i==null||i(s),l(""))},y=s=>{if(s.key==="Enter"){if(s.metaKey||s.ctrlKey||s.shiftKey)return;s.preventDefault(),h()}},I=(t==null?void 0:t.initials)||Se(t==null?void 0:t.name),j=gt(t),W=t==null?void 0:t.avatar;return e.jsxs("div",{style:{display:"flex",gap:16,alignItems:"flex-start"},children:[e.jsx(ht,{name:t==null?void 0:t.name,initials:I,color:j,avatar:W}),e.jsx("div",{style:{flex:1,padding:12,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:24,borderRadius:8,border:o?"1px solid var(--Grey-Strong, #2E3236)":"1px solid var(--Grey-absent, #D9D9D9)",background:"var(--Grey-White, #FFF)",transition:"border-color 0.15s"},children:e.jsxs("div",{style:{display:"flex",alignItems:"flex-end",gap:8,width:"100%"},children:[e.jsx("textarea",{ref:g,value:n,onChange:s=>l(s.target.value),onFocus:()=>a(!0),onBlur:()=>a(!1),onKeyDown:y,placeholder:"Add feedback",rows:1,style:{flex:1,border:"none",outline:"none",resize:"none",fontSize:13,fontWeight:400,color:"var(--text-ink, #1E2125)",fontFamily:"var(--default-font-family)",lineHeight:"160%",background:"transparent",padding:0,minHeight:24,maxHeight:140,overflowY:"hidden"}}),e.jsx("button",{type:"button",onClick:h,disabled:!n.trim(),style:{display:"flex",padding:"6px 16px",justifyContent:"center",alignItems:"center",fontSize:13,fontWeight:600,color:n.trim()?"var(--Grey-White, #FFF)":"var(--Grey-Muted, #808183)",background:n.trim()?"var(--Grey-Strong, #2E3236)":"var(--grey-light, #e9e8e8a1)",border:"none",borderRadius:6,cursor:n.trim()?"pointer":"not-allowed",fontFamily:"var(--default-font-family)",transition:"all 0.15s",flexShrink:0,lineHeight:"150%"},children:"Post"})]})})]})},pt=({comment:t,depth:i=0,isConsecutive:n=!1,onReply:l,onSendReply:o,onEdit:a,onDelete:g,onMenuClick:h})=>{const y=t.replies&&t.replies.length>0,I=!y;return e.jsxs(c.Fragment,{children:[e.jsx("div",{style:{paddingLeft:i>0?Math.min(i*32,128):0},children:e.jsx(pn,{comment:t,isReply:i>0,isConsecutive:n,onReply:l,onSendReply:o,onEdit:a,onDelete:g,onMenuClick:h,showReply:I})}),y&&t.replies.map(j=>e.jsx(pt,{comment:j,depth:i+1,onReply:l,onSendReply:o,onEdit:a,onDelete:g,onMenuClick:h},j.id))]})},ut=({comments:t=[],totalComments:i,children:n,onSendComment:l,onReply:o,onSendReply:a,onEdit:g,onDelete:h,onMenuClick:y,onMarkResolved:I,currentUser:j,isResolved:W=!1})=>{const[s,b]=c.useState([]),[k,C]=c.useState(!1),D=c.useMemo(()=>{const x=new Set(t.map(d=>d.id)),m=s.filter(d=>!x.has(d.id));return[...t,...m]},[t,s]);c.useEffect(()=>{const x=new Set(t.map(m=>m.id));b(m=>m.filter(d=>!x.has(d.id)))},[t]);const H=c.useMemo(()=>{if(!j)return{name:"You",initials:"YO",color:"#6B7C93"};const x=j.name||"You",m=j.initials||Se(x),d=gt(j);return{...j,name:x,initials:m,color:d}},[j]),S=async({content:x,parentId:m})=>{if(a){C(!0);try{await a({content:x,parentId:m})}finally{C(!1)}}else{const d={id:`temp-${Date.now()}`,author:H,content:x,timestamp:"Just now",parentId:m,isOptimistic:!0};b(L=>[...L,d])}},F=async x=>{if(l){C(!0);try{await l(x)}finally{C(!1)}}else{const m={id:`temp-${Date.now()}`,author:H,content:x,timestamp:"Just now",isOptimistic:!0};b(d=>[...d,m])}},M=x=>{b(m=>m.map(d=>d.id===x.id?{...d,content:x.content,isEdited:!0}:d)),g==null||g(x)},A=x=>{b(m=>m.filter(d=>d.id!==x.id)),h==null||h(x)},T=c.useMemo(()=>{const x={};D.forEach(d=>{d.parentId&&(x[d.parentId]||(x[d.parentId]=[]),x[d.parentId].push(d))});const m=d=>({...d,replies:(x[d.id]||[]).map(m)});return D.filter(d=>!d.parentId).map(m)},[D]),N=i??D.length;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",background:"var(--Grey-White, #FFF)",width:"100%",fontFamily:"var(--default-font-family)"},children:[e.jsxs("div",{style:{display:"flex",height:40,paddingBottom:8,alignItems:"center",gap:8,alignSelf:"stretch"},children:[e.jsx(u.MessagesSquare,{size:24,color:"var(--rail-orange, #C98A5A)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:16,fontWeight:600,color:"var(--Grey-Strong, #2E3236)",textTransform:"uppercase",lineHeight:1.2},children:"Feedback & Guidance"})]}),e.jsx("div",{style:{width:"100%",height:1,background:"var(--Grey-absent, #D9D9D9)"}}),e.jsxs("div",{style:{display:"flex",gap:24,alignSelf:"stretch"},children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,paddingTop:16,paddingBottom:8},children:[e.jsx("div",{style:{width:34,height:34,borderRadius:9999,background:"var(--surface-hover, #F3F7F7)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(u.MessagesSquare,{style:{width:20,height:20,flexShrink:0},color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.5})}),e.jsx("span",{style:{fontSize:15,fontWeight:500,color:"var(--Grey-Strong, #2E3236)"},children:"Feedback"}),e.jsxs("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",lineHeight:"150%",marginLeft:"auto"},children:[N," Comment",N!==1?"s":""]}),W?e.jsxs("div",{style:{display:"inline-flex",height:32,padding:"12px 16px 12px 12px",justifyContent:"center",alignItems:"center",gap:8,borderRadius:10,background:"var(--Rail-Surface-2, #E3E1D7)",flexShrink:0},children:[e.jsx(u.Check,{size:16,color:"var(--Grey-Strong, #2E3236)",strokeWidth:2}),e.jsx("span",{style:{fontSize:13,fontWeight:500,color:"var(--Grey-Strong, #2E3236)",fontFamily:"var(--default-font-family)",lineHeight:"150%"},children:"Resolved"})]}):I?e.jsxs("button",{type:"button",onClick:I,style:{display:"flex",alignItems:"center",gap:8,padding:"8px 16px",fontSize:13,fontWeight:500,color:"var(--Grey-Strong, #2E3236)",background:"var(--Grey-White, #FFF)",border:"1px solid var(--Grey-absent, #D9D9D9)",borderRadius:20,cursor:"pointer",fontFamily:"var(--default-font-family)",transition:"background 0.15s",lineHeight:"150%",flexShrink:0},children:[e.jsx(u.CircleCheck,{size:16,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.5}),"Mark as Resolved"]}):null]}),D.length>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:0,marginBottom:24,maxHeight:600,overflowY:D.length>6?"auto":"visible"},children:T.map((x,m)=>{var R,J;const d=m>0?T[m-1]:null,L=((R=d==null?void 0:d.author)==null?void 0:R.name)||(d==null?void 0:d.author_name),Q=((J=x.author)==null?void 0:J.name)||x.author_name,ne=d&&L===Q&&(!d.replies||d.replies.length===0);return e.jsx(pt,{comment:x,depth:0,isConsecutive:!!ne,onReply:o,onSendReply:S,onEdit:M,onDelete:A,onMenuClick:y},x.id)})}),D.length>0&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:16,marginLeft:48},children:[e.jsx(u.Info,{size:16,color:"var(--Grey-Muted, #808183)"}),e.jsx("span",{style:{color:"var(--Grey-Muted, #808183)",fontSize:13,fontStyle:"normal",fontWeight:400,lineHeight:"normal"},children:"Comments can be edited within 15 minutes."})]}),k&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 0"},children:[e.jsx("div",{style:{width:16,height:16,border:"2px solid var(--Grey-absent, #D9D9D9)",borderTopColor:"var(--Grey-Strong, #2E3236)",borderRadius:"50%",animation:"spin 0.8s linear infinite"}}),e.jsx("span",{style:{fontSize:13,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)"},children:"Sending..."}),e.jsx("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"})]}),e.jsx(un,{currentUser:H,onSubmit:F})]}),e.jsx("div",{style:{flex:1,minWidth:0},children:n})]})]})},rt=({children:t,size:i=28,onClick:n,title:l})=>{const[o,a]=c.useState(!1);return e.jsx("div",{title:l,onClick:n,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),style:{display:"flex",alignItems:"center",justifyContent:"center",width:i,height:i,borderRadius:9999,background:o?"var(--surface-hover, #F3F7F7)":"transparent",cursor:"pointer",flexShrink:0,transition:"background 0.15s"},children:t})},xn=t=>{const i=Math.floor(t/6e4),n=Math.floor(t%6e4/1e3);return`${i.toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}`},yn=({item:t,isLast:i,onPlayEvidence:n,onShowInTranscript:l,timelinePlaying:o,currentTimeSeconds:a})=>{var s;const g=(s=t.signal_refs)==null?void 0:s.map(b=>{const k=b.display_name||b.signal_key||"",C=b.confidence!=null?` (${Math.round(b.confidence*100)}%)`:"";return k+C}).join(", "),h=t.start_ms??t.startMs,y=t.end_ms??t.endMs,I=h!=null,j=(a??0)*1e3,W=o&&I&&j>=h&&j<=(y??h+5e3);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,padding:"12px 0",borderBottom:i?"none":"1px solid var(--Grey-absent, #D9D9D9)"},children:[e.jsx("span",{style:{alignSelf:"stretch",fontSize:14,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",lineHeight:"150%"},children:t.title||t.detail||""}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[g&&e.jsx("span",{style:{fontSize:14,fontWeight:400,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",lineHeight:"150%",flex:1,minWidth:0},children:g}),I&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.jsx(rt,{size:28,title:W?"Pause":"Play evidence",onClick:()=>n==null?void 0:n({start_ms:h,end_ms:y}),children:W?e.jsx(u.PauseCircle,{size:17,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1}):e.jsx(u.PlayCircle,{size:17,color:"var(--Grey-Muted, #808183)",strokeWidth:1})}),e.jsx(rt,{size:28,title:"Show in transcript",onClick:()=>l==null?void 0:l(h),children:e.jsx(u.ScrollText,{size:16,color:"#808183",strokeWidth:1.5})}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:1.2,whiteSpace:"nowrap"},children:xn(h)})]})]})]})},xt=({items:t=[],guidanceCount:i,loading:n=!1,onPlayEvidence:l,onShowInTranscript:o,timelinePlaying:a=!1,currentTimeSeconds:g=0})=>{const h=i??t.length;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch",width:"100%"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,paddingTop:16,paddingBottom:8},children:[e.jsx("div",{style:{width:34,height:34,borderRadius:9999,background:"var(--surface-hover, #F3F7F7)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(u.Lightbulb,{style:{width:20,height:20,flexShrink:0},color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.5})}),e.jsx("span",{style:{fontSize:15,fontWeight:500,color:"var(--Grey-Strong, #2E3236)"},children:"Guidance"}),e.jsxs("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",lineHeight:"150%",marginLeft:"auto"},children:[h," Item",h!==1?"s":""]})]}),t.map((y,I)=>e.jsx(yn,{item:y,isLast:I===t.length-1,onPlayEvidence:l,onShowInTranscript:o,timelinePlaying:a,currentTimeSeconds:g},I))]})},oe=({text:t,children:i})=>{const[n,l]=c.useState(!1),o=c.useRef(null),[a,g]=c.useState({top:0,left:0});if(!t)return i;const h=()=>{if(o.current){const y=o.current.getBoundingClientRect();g({top:y.bottom+6,left:y.left+y.width/2})}l(!0)};return e.jsxs("div",{ref:o,style:{position:"relative",display:"inline-flex"},onMouseEnter:h,onMouseLeave:()=>l(!1),children:[i,n&&e.jsx("div",{style:{position:"fixed",top:a.top,left:a.left,transform:"translate(-50%, 0)",display:"flex",padding:10,alignItems:"center",borderRadius:4,border:"1px solid var(--Grey-absent, #D9D9D9)",background:"var(--Grey-Strong, #2E3236)",zIndex:9999,pointerEvents:"none",whiteSpace:"nowrap"},children:e.jsx("span",{style:{color:"#FFF",fontSize:12,fontWeight:400,lineHeight:"normal"},children:t})})]})},mn=[{key:"overview",label:"Overview"},{key:"coaching",label:"Coaching Summary"},{key:"signals",label:"Signals & Recording"},{key:"comments",label:"Feedback"}],vn=({title:t="Wheel Stud Replacement Enquiry",onBack:i,data:n,coachingData:l,coachingLoading:o=!1,audioUrl:a,audioRef:g,currentTimeSeconds:h,timelinePlaying:y,playbackRate:I,timelineSegments:j,onSeek:W,onTogglePlay:s,onSeekBack:b,onSeekForward:k,onSetPlaybackRate:C,agentName:D,agentFullName:H,customerName:S,customerFullName:F,transcript:M,activeTurnIndex:A,turnObservations:T,highlightedTurns:N,onTurnPlayPause:x,onPlayEvidence:m,onHighlightTurns:d,callPurpose:L,classification:Q,outcomeQuality:ne,resolutionOutcome:R,customerIntent:J,location:U,interactionId:se,moreDetails:q,compassScore:de,compassMaxScore:p=5,predictedCsat:O,predictedLabel:X="Predicted Objective",compassLegends:r,customerSessions:V,customerSessionCount:yt,onSessionClick:Ge,onViewAllSessions:Me,prevSessionDesc:Ee,prevSessionDisabled:ee=!1,nextSessionDesc:He,nextSessionDisabled:te=!1,onPreviousSession:pe,onNextSession:ue,comments:Re=[],guidance:mt=[],currentUser:B,onSendComment:vt,onSendReply:jt,onReply:bt,onEdit:St,onEditInteraction:wt,onDelete:kt,onMenuClick:Ct,onMarkResolved:Ft,commentsResolved:It})=>{var Qe;const[we,xe]=c.useState("overview"),[Wt,Te]=c.useState(new Set),[Dt,ye]=c.useState(!1),[zt,_e]=c.useState(null),[Ae,Le]=c.useState(!1),[Be,Gt]=c.useState(0),[Ne,Mt]=c.useState(!1),ie=c.useRef(null),me=c.useRef(null),ke=c.useRef(null),ce=c.useRef(null),Ce=c.useRef(null),Et={overview:me,coaching:ke,signals:ce,comments:Ce},fe=c.useRef(null),Fe=c.useRef(!1);c.useEffect(()=>{const f=fe.current;if(!f)return;const z=["overview","coaching","signals","comments"],v=[me,ke,ce,Ce],E=(K=>{let re=K.parentElement;for(;re;){const{overflow:be,overflowY:ae}=window.getComputedStyle(re);if(/(auto|scroll)/.test(be+ae))return re;re=re.parentElement}return null})(f),Z=()=>{var be;if(Fe.current)return;let K=z[0];for(let ae=v.length-1;ae>=0;ae--){const Je=v[ae].current;if(!Je)continue;if(Je.getBoundingClientRect().top<=150){K=z[ae];break}}xe(K);const re=((be=me.current)==null?void 0:be.getBoundingClientRect().top)??Number.POSITIVE_INFINITY;Mt(re<=150)};return f.addEventListener("scroll",Z,{passive:!0}),E&&E!==f&&E.addEventListener("scroll",Z,{passive:!0}),window.addEventListener("scroll",Z,{passive:!0,capture:!0}),Z(),()=>{f.removeEventListener("scroll",Z),E&&E!==f&&E.removeEventListener("scroll",Z),window.removeEventListener("scroll",Z,{capture:!0})}},[]);const Oe=c.useRef(null),Ht=f=>{var v;xe(f),Fe.current=!0,Oe.current=f;const z=(v=Et[f])==null?void 0:v.current;if(z){const w=fe.current;if(w&&w.scrollHeight>w.clientHeight){const E=w.getBoundingClientRect().top,K=z.getBoundingClientRect().top-E+w.scrollTop-16;w.scrollTo({top:K,behavior:"smooth"})}else{const E=z.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:E,behavior:"smooth"})}}setTimeout(()=>{Fe.current=!1,Oe.current=null},1200)},Ie=V||[],We=Ie.length>1,Pe=f=>{xe("signals");const z=ce.current;if(z){const w=fe.current;if(w&&w.scrollHeight>w.clientHeight){const E=w.getBoundingClientRect().top,K=z.getBoundingClientRect().top-E+w.scrollTop-16;w.scrollTo({top:K,behavior:"smooth"})}else{const E=z.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:E,behavior:"smooth"})}}const v=f/1e3;setTimeout(()=>{var w;(w=ie.current)!=null&&w.scrollToTranscript&&ie.current.scrollToTranscript(v)},220)},$e=f=>{xe("signals");const z=ce.current;if(z){const w=fe.current;if(w&&w.scrollHeight>w.clientHeight){const E=w.getBoundingClientRect().top,K=z.getBoundingClientRect().top-E+w.scrollTop-16;w.scrollTo({top:K,behavior:"smooth"})}else{const E=z.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:E,behavior:"smooth"})}}const v=(f==null?void 0:f.start_ms)??(f==null?void 0:f.startMs);setTimeout(()=>{var w,E;if(v!=null&&((w=ie.current)!=null&&w.scrollToTranscript)&&ie.current.scrollToTranscript(v/1e3),m)m(f);else if(v!=null&&((E=ie.current)!=null&&E.seekTo)){ie.current.seekTo(v/1e3),Le(!0),Gt(v/1e3);const K=(f.end_ms??f.endMs??v+5e3)-v;setTimeout(()=>Le(!1),K)}},220)},Rt=f=>{d&&d(f)},Tt=f=>{Te(z=>{const v=new Set(z);return v.has(f)?v.delete(f):v.add(f),v})},_t=(n==null?void 0:n.blocks)||[],ge=f=>{var z;return((z=_t.find(v=>v.block_id===f))==null?void 0:z.payload)||{}},Y=ge("interaction-metadata"),le=ge("interaction-context"),ve=ge("interaction-signals"),At=ge("interaction-outcome-lift"),Lt=ge("interaction-dimensions").dimensions||[],Bt=le.call_purpose||{},Nt=le.classification||{},Ye=Y||{},Ke=L||Bt||{},Ot=Q||Nt||{},qe=At||{},Pt=(qe.driver_signal_keys||[]).map(f=>f.replace(/^sig\./,"").replace(/_/g," ")),$t=l||null,Yt=(Qe=ve==null?void 0:ve.signals)!=null&&Qe.length?ve:{present_count:0,total_signals_evaluated:0,signals:[]},Ve=mt||[],De=D||Y.agent_name||Y.agent||le.agent_name||"Agent",Kt=H||Y.agent_full_name||Y.agent_name||De,he=S||Y.customer_name||Y.customer||le.customer_name||"Customer",Ze=F||Y.customer_full_name||Y.customer_name||he,qt=String((B==null?void 0:B.role)??(B==null?void 0:B.userRole)??(B==null?void 0:B.user_role)??(B==null?void 0:B.roleName)??(B==null?void 0:B.role_name)??"").toLowerCase(),Vt=/(admin|superadmin|administrator)/.test(qt),ze=yt??Ie.length,je=Y.created_dt||(n==null?void 0:n.created_dt)||le.created_dt||"",Zt=je?new Date(/Z$|[+-]\d{2}:\d{2}$/.test(je)?je:je+"Z").toLocaleString():"",Qt=Ke.interaction_direction==="inbound"?"Inbound":"Outbound";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",height:"100%",background:"var(--Grey-White, #FFF)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"18px 24px 0"},children:[e.jsx("button",{onClick:i,style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0,flexShrink:0},children:e.jsx(u.ArrowLeft,{size:24,color:"var(--Grey-Strong, #2E3236)"})}),e.jsx("div",{style:{width:1,height:28,background:"var(--Base-absent, #D9D9D9)"}}),e.jsx("h1",{style:{color:"var(--Grey-Strong, #2E3236)",fontSize:24,fontStyle:"normal",fontWeight:400,lineHeight:"normal",margin:0,flex:1},children:t}),(pe||ue)&&!Ne&&e.jsxs("div",{style:{display:"flex",alignItems:"center",flexShrink:0},children:[e.jsx(oe,{text:Ee,children:e.jsxs("button",{onClick:ee?void 0:pe,disabled:ee,style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",background:"none",border:"none",cursor:ee?"default":"pointer",opacity:ee?.4:1},children:[e.jsx(u.ArrowLeft,{size:16,color:"var(--Neutral-800, #323232)",strokeWidth:1.5}),e.jsx("span",{style:{color:"var(--Neutral-800, #323232)",fontSize:13,fontWeight:400,lineHeight:"24px",fontFamily:"var(--default-font-family)",whiteSpace:"nowrap"},children:"Previous Interaction"})]})}),e.jsx("div",{style:{width:1,height:20,background:"var(--Grey-absent, #D9D9D9)",flexShrink:0}}),e.jsx(oe,{text:He,children:e.jsxs("button",{onClick:te?void 0:ue,disabled:te,style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",background:"none",border:"none",cursor:te?"default":"pointer",opacity:te?.4:1},children:[e.jsx("span",{style:{color:"var(--Neutral-800, #323232)",fontSize:13,fontWeight:400,lineHeight:"24px",fontFamily:"var(--default-font-family)",whiteSpace:"nowrap"},children:"Next Interaction"}),e.jsx(u.ArrowRight,{size:16,color:"var(--Neutral-800, #323232)",strokeWidth:1.5})]})})]})]}),e.jsx("div",{style:{position:"sticky",top:68,zIndex:20,background:"var(--Grey-White, #FFF)"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16,background:"var(--Grey-White, #FFF)",borderBottom:"1px solid var(--Grey-Faint, #ACADAD)",padding:"0 24px",marginTop:8},children:[e.jsx("div",{style:{display:"flex",alignItems:"flex-start",minWidth:0},children:mn.map(f=>e.jsx("button",{onClick:()=>Ht(f.key),style:{display:"flex",padding:16,alignItems:"center",gap:10,background:"none",border:"none",borderBottom:we===f.key?"3px solid var(--Grey-Strong, #2E3236)":"3px solid transparent",cursor:"pointer",fontSize:15,fontWeight:we===f.key?500:400,color:we===f.key?"var(--Grey-Strong, #2E3236)":"var(--Grey-Muted, #808183)",whiteSpace:"nowrap",transition:"border-color 0.2s ease, color 0.2s ease"},children:f.label},f.key))}),(pe||ue)&&Ne&&e.jsxs("div",{style:{display:"flex",alignItems:"center",flexShrink:0},children:[e.jsx(oe,{text:Ee,children:e.jsxs("button",{onClick:ee?void 0:pe,disabled:ee,style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",background:"none",border:"none",cursor:ee?"default":"pointer",opacity:ee?.4:1},children:[e.jsx(u.ArrowLeft,{size:16,color:"var(--Neutral-800, #323232)",strokeWidth:1.5}),e.jsx("span",{style:{color:"var(--Neutral-800, #323232)",fontSize:13,fontWeight:400,lineHeight:"24px",fontFamily:"var(--default-font-family)",whiteSpace:"nowrap"},children:"Previous Interaction"})]})}),e.jsx("div",{style:{width:1,height:20,background:"var(--Grey-absent, #D9D9D9)",flexShrink:0}}),e.jsx(oe,{text:He,children:e.jsxs("button",{onClick:te?void 0:ue,disabled:te,style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",background:"none",border:"none",cursor:te?"default":"pointer",opacity:te?.4:1},children:[e.jsx("span",{style:{color:"var(--Neutral-800, #323232)",fontSize:13,fontWeight:400,lineHeight:"24px",fontFamily:"var(--default-font-family)",whiteSpace:"nowrap"},children:"Next Interaction"}),e.jsx(u.ArrowRight,{size:16,color:"var(--Neutral-800, #323232)",strokeWidth:1.5})]})})]})]})}),e.jsxs("div",{ref:fe,style:{padding:24,flex:1,overflowY:"auto"},children:[e.jsxs("div",{ref:me,style:{display:"flex",flexDirection:"column",justifyContent:"flex-end",alignItems:"flex-start",gap:24,alignSelf:"stretch"},children:[e.jsxs("div",{style:{display:"flex",height:40,alignItems:"center",gap:16,alignSelf:"stretch"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1},children:[e.jsx(u.ClipboardList,{size:24,color:"var(--rail-orange, #C98A5A)",strokeWidth:2}),e.jsx("span",{style:{fontSize:16,fontWeight:600,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2,textTransform:"uppercase"},children:"Overview"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,flexShrink:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"8px 0"},children:[e.jsx(u.CalendarDays,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",fontFamily:"var(--font-sans)",lineHeight:1.2},children:Zt})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"8px 0"},children:[e.jsx(u.PhoneIncoming,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",fontFamily:"var(--font-sans)",lineHeight:1.2},children:Qt})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,paddingLeft:16,borderLeft:"1px solid var(--Grey-absent, #D9D9D9)"},children:[e.jsx(oe,{text:Kt,children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"8px 0",cursor:"pointer"},children:[e.jsx(u.Headset,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",fontFamily:"var(--font-sans)",lineHeight:1.2},children:De})]})}),ze>1?e.jsx("div",{children:e.jsx(oe,{text:Ze,children:e.jsxs("button",{onClick:()=>ye(!0),style:{display:"flex",alignItems:"center",gap:16,padding:"0 16px",height:34,borderRadius:8,background:"var(--Rail-Surface-2, #E3E1D7)",border:"none",cursor:"pointer"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,minWidth:0},children:[e.jsx(u.CircleUser,{size:16,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.5}),e.jsxs("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2,whiteSpace:"nowrap"},children:[e.jsx("span",{style:{fontWeight:600},children:he})," ",e.jsxs("span",{children:["(",ze," Interactions)"]})]})]}),e.jsx(u.ChevronRight,{size:16,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.7})]})})}):e.jsx(oe,{text:Ze,children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"8px 0",cursor:"pointer"},children:[e.jsx(u.CircleUser,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2},children:he})]})})]})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"stretch",gap:24,alignSelf:"stretch"},children:[e.jsx("div",{style:{flex:1,minWidth:0,display:"flex"},children:e.jsx(ct,{score:de??.5,minScore:0,maxScore:p,predictedScore:O??.5,predictedLabel:X,legends:r})}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch",justifyContent:"flex-end",gap:24,flex:1,minWidth:0},children:[e.jsx(lt,{meta:Ye,callPurpose:Ke,classification:Ot,outcomeQuality:ne||"Neutral",dimensions:Lt,resolutionOutcome:R,customerIntent:J,location:U??Y.location??Y.location_name??le.location,interactionId:se??Y.interaction_id,moreDetails:q,canShowEditButton:Vt,onEditInteraction:wt}),e.jsx(at,{outcomeLift:qe,driverLabels:Pt})]})]})]}),e.jsx("div",{ref:ke,style:{paddingTop:24},children:e.jsx(st,{data:o?null:$t,loading:o})}),e.jsxs("div",{ref:ce,style:{display:"flex",flexDirection:"column",gap:16,alignSelf:"stretch",paddingTop:24},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(u.FileSignal,{size:24,color:"#C98A5A",strokeWidth:2}),e.jsx("span",{style:{fontSize:16,fontWeight:600,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2,textTransform:"uppercase"},children:"Signals & Recording"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:24,alignSelf:"stretch",paddingTop:16,borderTop:"1px solid #D9D9D9"},children:[e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(dt,{signals:Yt,expandedSignals:Wt,toggleSignal:Tt,playEvidence:$e,highlightTurns:Rt,onShowInTranscript:Pe,timelinePlaying:y||Ae,currentTimeSeconds:h??Be})}),e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(ot.UpdatedInteractionRecording,{ref:ie,audioUrl:a,durationSeconds:Ye.duration_seconds,audioRef:g,agentName:De,customerName:he,currentTimeSeconds:h,timelinePlaying:y,playbackRate:I,timelineSegments:j,onSeek:W,onTogglePlay:s,onSeekBack:b,onSeekForward:k,onSetPlaybackRate:C,transcript:M,activeTurnIndex:A,turnObservations:T,highlightedTurns:N,onTurnPlayPause:x,setExpandedSignals:Te})})]})]}),e.jsx("div",{ref:Ce,style:{paddingTop:24},children:e.jsx(ut,{comments:Re,totalComments:Re.length,currentUser:B,onSendComment:vt||(()=>{}),onSendReply:jt||(()=>{}),onReply:bt||(()=>{}),onEdit:St||(()=>{}),onDelete:kt||(()=>{}),onMenuClick:Ct||(()=>{}),onMarkResolved:Ft||(()=>{}),isResolved:It,children:e.jsx(xt,{items:Ve,guidanceCount:Ve.length,onPlayEvidence:$e,onShowInTranscript:Pe,timelinePlaying:y||Ae,currentTimeSeconds:h??Be})})})]}),e.jsx(Jt.SideDrawer,{open:Dt,onClose:()=>ye(!1),title:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[e.jsx("div",{style:{width:34,height:34,borderRadius:"50%",background:"var(--surface-hover, #F3F7F7)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(u.CircleUser,{size:20,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.7})}),e.jsx("div",{style:{minWidth:0},children:e.jsx("div",{style:{fontSize:16,fontWeight:600,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:he})})]}),subtitle:We?e.jsxs("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:1.5},children:[ze," Interactions"]}):null,width:470,height:"100vh",topOffset:70,footer:We?e.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:e.jsxs("button",{onClick:()=>{Me&&Me(),ye(!1)},style:{display:"flex",height:40,padding:"0 20px 0 18px",justifyContent:"center",alignItems:"center",gap:7,background:"var(--Grey-White, #FFF)",border:"1px solid var(--Grey-absent, #D9D9D9)",borderRadius:10,cursor:"pointer"},children:[e.jsx(u.History,{size:18,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:15,fontWeight:600,color:"var(--Grey-Strong, #2E3236)"},children:"View All Interactions"})]})}):null,children:e.jsx("div",{style:{borderTop:"1px solid var(--Grey-absent, #D9D9D9)",maxHeight:"100%",overflowY:"auto"},children:We?Ie.map((f,z)=>{const v=!!f.isCurrent,w=!v&&zt===z;return e.jsxs("div",{onClick:v?void 0:()=>{Ge&&Ge(f),ye(!1)},onMouseEnter:v?void 0:()=>_e(z),onMouseLeave:v?void 0:()=>_e(null),"aria-current":v?"page":void 0,style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,padding:"16px 12px",borderTop:z===0?"none":"1px solid var(--Grey-absent, #D9D9D9)",background:v?"#E3E1D7":w?"var(--surface-hover, #F3F7F7)":"var(--Grey-White, #FFF)",cursor:v?"default":"pointer",transition:"background 0.15s"},children:[e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{style:{fontSize:v?15:14,display:"flex",alignItems:"center",gap:6,fontWeight:v?500:400,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:f.title}),f.status&&e.jsxs("div",{style:{fontSize:13,color:"var(--Grey-Strong, #2E3236)",marginBottom:12,lineHeight:1.2},children:[e.jsx("span",{style:{fontWeight:400},children:"Location: "}),e.jsx("span",{style:{fontWeight:400,color:"var(--Grey-Muted, #808183)"},children:f.location})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,flexWrap:"wrap"},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:1.1},children:[e.jsx(u.CalendarDays,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.8}),f.date]}),(f.agent||f.agent_name)&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:1.1},children:[e.jsx(u.Headset,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.8}),f.agent||f.agent_name]})]})]}),!v&&w&&e.jsx(u.ExternalLink,{size:20,color:"var(--Grey-Muted, #808183)",strokeWidth:1.7,style:{flexShrink:0}})]},f.id||z)}):e.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:140,padding:"24px 12px",color:"var(--Grey-Muted, #808183)",fontSize:14,fontStyle:"italic",textAlign:"center"},children:"No other interactions available"})})})]})};exports.UpdatedInteractionRecording=ot.UpdatedInteractionRecording;exports.UpdatedCoachingSynthesisCard=st;exports.UpdatedCompassScore=ct;exports.UpdatedGuidance=xt;exports.UpdatedInteractionContext=lt;exports.UpdatedInteractionDetails=vn;exports.UpdatedInteractionScores=at;exports.UpdatedInteractionSignals=dt;exports.UpdatedThreads=ut;
15
+ `}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:12,padding:"48px 24px"},children:[e.jsxs("svg",{width:48,height:48,viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{animation:"coaching-spinner-spin 1.2s linear infinite"},children:[e.jsx("path",{d:"M43 24C43 26.4951 42.5086 28.9658 41.5537 31.271C40.5989 33.5762 39.1993 35.6707 37.435 37.435C35.6707 39.1993 33.5762 40.5989 31.271 41.5537C28.9658 42.5086 26.4951 43 24 43C21.5049 43 19.0342 42.5086 16.729 41.5537C14.4238 40.5989 12.3293 39.1993 10.565 37.435C8.80066 35.6707 7.40113 33.5762 6.44629 31.271C5.49145 28.9658 5 26.4951 5 24",stroke:"#F3E7C7",strokeWidth:"4",strokeLinecap:"round"}),e.jsx("path",{d:"M12 24C12 22.4241 12.3104 20.8637 12.9134 19.4078C13.5165 17.9519 14.4004 16.629 15.5147 15.5147C16.629 14.4004 17.9519 13.5165 19.4078 12.9134C20.8637 12.3104 22.4241 12 24 12C25.5759 12 27.1363 12.3104 28.5922 12.9134C30.0481 13.5165 31.371 14.4004 32.4853 15.5147C33.5996 16.629 34.4835 17.9519 35.0866 19.4078C35.6896 20.8637 36 22.4241 36 24",stroke:"#00A66E",strokeWidth:"4",strokeLinecap:"round"}),e.jsx("path",{d:"M20 24C20 24.5253 20.1035 25.0454 20.3045 25.5307C20.5055 26.016 20.8001 26.457 21.1716 26.8284C21.543 27.1999 21.984 27.4945 22.4693 27.6955C22.9546 27.8965 23.4747 28 24 28C24.5253 28 25.0454 27.8965 25.5307 27.6955C26.016 27.4945 26.457 27.1999 26.8284 26.8284C27.1999 26.457 27.4945 26.016 27.6955 25.5307C27.8965 25.0454 28 24.5253 28 24",stroke:"#F3E7C7",strokeWidth:"4",strokeLinecap:"round"})]}),e.jsx("span",{style:{fontSize:14,color:_.muted,fontWeight:500,textAlign:"center"},children:"Synthesizing coaching summary..."})]})]});if(n)return e.jsx("div",{style:{fontSize:14,color:_.muted},children:"Unable to generate coaching summary."});if(!t)return null;const o=t.strengths||[],l=t.improvements||[],a=typeof t.one_liner=="string"?t.one_liner:((u=t.one_liner)==null?void 0:u.text)||"",g=typeof t.context=="string"?t.context:((y=t.context)==null?void 0:y.text)||"";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,background:"#FFF"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(p.ShieldCheck,{size:20,color:_.accent,strokeWidth:2}),e.jsx("span",{style:{fontSize:16,fontWeight:600,color:_.strong,fontFamily:"var(--font-sans)",lineHeight:1.2,textTransform:"uppercase"},children:"Coaching Summary"})]}),a&&e.jsx("div",{style:{fontSize:14,fontWeight:500,color:_.strong,fontFamily:"var(--font-sans)",lineHeight:1.5},children:a}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:16,justifyContent:"space-between"},children:[g&&e.jsx("div",{style:{fontSize:14,fontWeight:400,color:_.muted,fontFamily:"var(--font-sans)",lineHeight:1.5,flex:1},children:g}),t.overall&&e.jsx(en,{overall:t.overall})]}),(o.length>0||l.length>0)&&e.jsxs("div",{style:{display:"flex",gap:24,paddingTop:24,borderTop:`1px solid ${_.absent}`},children:[e.jsx(Ue,{icon:e.jsx(p.TrendingUp,{size:14,color:_.strong,strokeWidth:1.5}),label:"Key Strengths",items:o}),e.jsx(Ue,{icon:e.jsx(p.Lightbulb,{size:14,color:_.strong,strokeWidth:1.5}),label:"Improvements",items:l})]})]})};function nn(t){const i=Math.floor(t/60),n=Math.round(t%60);return`${i}:${n.toString().padStart(2,"0")}`}const rn={display:"flex",justifyContent:"space-between",padding:"8px 8px 12px 8px",alignItems:"center",gap:24,fontFamily:"var(--font-sans)",fontSize:13,fontWeight:400,lineHeight:"normal",borderBottom:"1px solid var(--Grey-absent, #D9D9D9)"},et={display:"flex",flexDirection:"column",flex:"1 0 0",gap:0,minWidth:0},st=({meta:t={},callPurpose:i={},classification:n={},dimensions:o=[],outcomeQuality:l="Neutral",onMoreDetails:a,moreDetails:g=[],resolutionOutcome:u,customerIntent:y,location:W,canShowEditButton:j=!1,onEditInteraction:I})=>{const[s,b]=f.useState(!1),k=f.useRef(null),C=t.duration_seconds!=null?nn(t.duration_seconds):null,D=t.message_count,H=i.interaction_driver,S=n.interaction_paradigm,F=h=>o.find(P=>(P.key||"").toLowerCase().includes(h)),E=F("resolution_outcome"),A=F("customer_intent"),T=F("location"),O=F("outcome_quality"),x=h=>h?h.replace(/_/g," ").replace(/\b\w/g,P=>P.toUpperCase()):null,m=l!=="Neutral"?l:O?x(O.value):l,d=u??(E?x(E.value):null),L=y??(A?x(A.value):null),Q=W??(T?x(T.value):null),J=S!=null?x(S):null,X=new Set(["resolution_outcome","customer_intent","location","outcome_quality"].map(h=>`dim.${h}`)),R=o.filter(h=>!X.has(h.key)),te=[],ne=[[C!=null?{label:"Duration",value:C}:null,D!=null?{label:"Messages",value:D}:null],[H!=null?{label:"Driver",value:H}:null,Q!=null?{label:"Location",value:Q}:null]];for(let h=0;h<R.length;h+=2){const P=R[h]?{label:R[h].display_name||R[h].label||R[h].key,value:x(R[h].value)}:null,r=R[h+1]?{label:R[h+1].display_name||R[h+1].label||R[h+1].key,value:x(R[h+1].value)}:null;ne.push([P,r])}ne.push([{label:"Outcome Quality",value:m},{isMoreDetails:!0}]),ne.forEach(h=>te.push(h));const V=[d!=null&&{label:"Resolution Outcome",value:d},L!=null&&{label:"Customer Intent",value:L},J!=null&&{label:"Paradigm",value:J},...g||[]].filter(Boolean);f.useEffect(()=>{if(!s)return;const h=P=>{k.current&&!k.current.contains(P.target)&&b(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]);const le=h=>e.jsxs("div",{style:rn,children:[e.jsx("span",{style:{color:"var(--Grey-Strong, #2E3236)",whiteSpace:"nowrap",flexShrink:0},children:h.label}),e.jsx("span",{style:{color:"var(--Grey-Muted, #808183)",textAlign:"right",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:h.value})]},h.label),de=()=>e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,padding:"8px 8px 12px 8px",fontFamily:"var(--font-sans)",borderBottom:"none",minHeight:33},children:[e.jsxs("button",{onClick:()=>{b(h=>!h),a&&!s&&a()},style:{display:"flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",padding:0,color:"var(--Grey-Strong, #2E3236)",fontSize:13,fontWeight:500,lineHeight:"normal",fontFamily:"var(--font-sans)",whiteSpace:"nowrap",flexShrink:0},children:[e.jsx("span",{children:"More Details"}),s?e.jsx(p.ChevronUp,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}):e.jsx(p.ChevronDown,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5})]}),j&&e.jsxs("button",{onClick:I||(()=>{}),style:{display:"flex",alignItems:"center",gap:6,padding:"5px 12px",background:"var(--Grey-White, #FFF)",border:"1px solid var(--Grey-absent, #D9D9D9)",borderRadius:12,color:"var(--Grey-Strong, #2E3236)",fontSize:13,fontWeight:500,lineHeight:"normal",fontFamily:"var(--font-sans)",cursor:"pointer",flexShrink:0},children:[e.jsx(p.Pencil,{size:15,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:13,lineHeight:"normal"},children:"Edit"})]})]},"more-details");return e.jsxs("div",{ref:k,style:{display:"flex",flexDirection:"column",alignSelf:"stretch",gap:0,position:"relative",overflow:"visible"},children:[te.map((h,P)=>{var r;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24,alignSelf:"stretch",flexWrap:"nowrap"},children:[e.jsx("div",{style:et,children:h[0]&&!h[0].isMoreDetails?le(h[0]):e.jsx("div",{style:{flex:1}})}),e.jsx("div",{style:et,children:h[1]&&!h[1].isMoreDetails?le(h[1]):(r=h[1])!=null&&r.isMoreDetails?de():e.jsx("div",{style:{flex:1}})})]},P)}),s&&V.length>0&&e.jsxs("div",{style:{position:"absolute",top:"100%",right:0,marginTop:4,display:"flex",width:340,flexDirection:"column",alignItems:"flex-start",borderRadius:4,border:"1px solid var(--Grey-absent, #D9D9D9)",background:"var(--Grey-White, #FFF)",boxShadow:"-2px 2px 2px 0 rgba(0, 0, 0, 0.25)",overflow:"hidden",fontFamily:"var(--font-sans)",zIndex:50},children:[e.jsx("div",{style:{padding:"12px 16px",fontSize:13,fontWeight:600,color:"var(--Grey-Strong, #2E3236)",borderBottom:"1px solid var(--Grey-absent, #D9D9D9)",alignSelf:"stretch"},children:"More details"}),V.map(h=>e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px 16px",gap:24,fontSize:13,fontWeight:400,lineHeight:"normal",borderBottom:"1px solid var(--Grey-absent, #D9D9D9)",alignSelf:"stretch"},children:[e.jsx("span",{style:{color:"var(--Grey-Strong, #2E3236)",whiteSpace:"nowrap",flexShrink:0},children:h.label}),e.jsx("span",{style:{color:"var(--Grey-Muted, #808183)",fontSize:13,fontStyle:"normal",fontWeight:400,lineHeight:"120%",textAlign:"right"},children:h.value})]},h.label))]})]})},M={strong:"var(--Grey-Strong, #2E3236)",muted:"var(--Grey-Muted, #808183)",absent:"var(--Grey-absent, #D9D9D9)",white:"var(--Grey-White, #FFF)",cardBg:"var(--surface-warm-40, rgba(243, 241, 229, 0.40))"},N=1.2,tt=3,nt=t=>t!=null?Math.round(t*100)+"%":"—",on=t=>{if(t==null)return"—";const i=(t*100).toFixed(1);return t>0?`+${i}pp`:`${i}pp`},at=({outcomeLift:t,driverLabels:i=[]})=>{var s;if(!t||t.lift==null)return null;const n=t.p_expected,o=t.p_full,l=t.lift_raw??(o!=null&&n!=null?o-n:null),a=t.lift,g=(s=t.interpretation)!=null&&s.lift_band?t.interpretation.lift_band.replace(/_/g," "):a>=0?"Positive":"Negative",u=g.charAt(0).toUpperCase()+g.slice(1),W=/negative/i.test(g)?p.ThumbsDown:p.ThumbsUp,j=i.slice(0,tt),I=i.length-tt;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",padding:24,gap:24,borderRadius:8,border:`1px solid ${M.absent}`,background:M.cardBg,alignSelf:"stretch"},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:32},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:24,alignSelf:"stretch"},children:[e.jsx("span",{style:{fontSize:15,fontWeight:600,color:M.strong,fontFamily:"var(--font-sans)",lineHeight:N},children:"Agent Lift Analysis"}),e.jsx("div",{style:{display:"flex",alignItems:"center",gap:8,fontFamily:"var(--font-sans)"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,paddingLeft:8},children:[e.jsx(W,{size:14,color:M.strong}),e.jsx("span",{style:{fontSize:13,fontWeight:600,color:M.strong,lineHeight:N},children:u})]})})]}),e.jsxs("div",{style:{display:"flex",gap:24},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,alignItems:"flex-start",flex:1,minWidth:0},children:[e.jsx("span",{style:{fontSize:28,fontWeight:400,color:M.muted,fontFamily:"var(--font-sans)",lineHeight:N},children:nt(n)}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,alignItems:"flex-start",minHeight:48},children:[e.jsx("span",{style:{fontSize:13,fontWeight:400,color:M.strong,fontFamily:"var(--font-sans)",lineHeight:N,whiteSpace:"nowrap"},children:"Expected Outcome"}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:M.muted,fontFamily:"var(--font-sans)",lineHeight:N,textAlign:"left"},children:"Based on call type & difficulty"})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,alignItems:"flex-start",paddingLeft:24,borderLeft:`1px solid ${M.absent}`,flex:1,minWidth:0},children:[e.jsx("span",{style:{fontSize:28,fontWeight:400,color:M.muted,fontFamily:"var(--font-sans)",lineHeight:N},children:on(l)}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,alignItems:"flex-start",minHeight:48},children:[e.jsx("span",{style:{fontSize:13,fontWeight:400,color:M.strong,fontFamily:"var(--font-sans)",lineHeight:N,whiteSpace:"nowrap"},children:"Agent Impact"}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:M.muted,fontFamily:"var(--font-sans)",lineHeight:N,textAlign:"left"},children:"Behavior-driven change"})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,alignItems:"flex-start",paddingLeft:24,borderLeft:`1px solid ${M.absent}`,flex:1,minWidth:0},children:[e.jsx("span",{style:{fontSize:28,fontWeight:400,color:M.strong,fontFamily:"var(--font-sans)",lineHeight:N},children:nt(o)}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,alignItems:"flex-start",minHeight:48},children:[e.jsx("span",{style:{fontSize:13,fontWeight:600,color:M.strong,fontFamily:"var(--font-sans)",lineHeight:N,whiteSpace:"nowrap"},children:"Outcome"}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:M.muted,fontFamily:"var(--font-sans)",lineHeight:N,textAlign:"left"},children:"With agent behaviors"})]})]})]})]}),i.length>0&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,alignSelf:"stretch"},children:[e.jsx("span",{style:{fontSize:12,fontWeight:600,color:M.strong,fontFamily:"var(--font-sans)",lineHeight:N},children:"Key Drivers"}),e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[j.map((b,k)=>e.jsx("div",{style:{display:"flex",padding:8,alignItems:"center",justifyContent:"center",borderRadius:4,border:`1px solid ${M.absent}`,background:M.white},children:e.jsx("span",{style:{fontSize:12,fontWeight:400,color:M.strong,fontFamily:"var(--font-sans)",lineHeight:N,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:200},children:b})},k)),I>0&&e.jsx("div",{style:{display:"flex",padding:8,alignItems:"center",justifyContent:"center",borderRadius:4,border:`1px solid ${M.absent}`,background:M.white},children:e.jsxs("span",{style:{fontSize:12,fontWeight:400,color:M.strong,fontFamily:"var(--font-sans)",lineHeight:N,whiteSpace:"nowrap"},children:["+ ",I]})})]})]})]})},it=({children:t,size:i=28,onClick:n,title:o})=>{const[l,a]=f.useState(!1);return e.jsx("div",{title:o,onClick:n,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),style:{display:"flex",alignItems:"center",justifyContent:"center",width:i,height:i,borderRadius:9999,background:l?"var(--surface-hover, #F3F7F7)":"transparent",cursor:"pointer",flexShrink:0,transition:"background 0.15s"},children:t})},dt=({signals:t={signals:[],present_count:0,total_signals_evaluated:0},expandedSignals:i=new Set,toggleSignal:n=()=>{},playEvidence:o=()=>{},highlightTurns:l=()=>{},onShowInTranscript:a=()=>{},timelinePlaying:g=!1,currentTimeSeconds:u=0})=>{const y=(t==null?void 0:t.signals)??[],W=(t==null?void 0:t.present_count)??y.length,j=s=>{const b=Math.floor(s/6e4),k=Math.floor(s%6e4/1e3);return`${b.toString().padStart(2,"0")}:${k.toString().padStart(2,"0")}`},I=s=>g&&s.start_ms!=null&&u*1e3>=s.start_ms&&u*1e3<=(s.end_ms??s.start_ms+5e3);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",alignSelf:"stretch",width:"100%",gap:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,width:"100%"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:34,height:34,borderRadius:9999,background:"var(--surface-hover, #F3F7F7)",flexShrink:0},children:e.jsx(p.FileSignal,{size:20,color:"#2E3236",strokeWidth:1.5})}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flex:1},children:[e.jsx("span",{style:{fontSize:15,fontWeight:500,color:"var(--Grey-Strong, #2E3236)"},children:"Signals"}),e.jsxs("span",{style:{fontSize:14,fontWeight:500,color:"var(--Grey-Strong, #2E3236)"},children:[W," Signals Detected"]})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignSelf:"stretch",background:"var(--Grey-White, #FFF)",gap:8},children:[y.length===0&&e.jsx("div",{style:{padding:"8px 0",fontSize:14,color:"var(--Grey-Muted, #808183)"},children:"No signals detected."}),y.map((s,b)=>{var H,S,F;const k=s.key??s.id??b,C=i.has(k),D=((H=s.observations)==null?void 0:H.length)??0;return e.jsxs("div",{id:`signal-${k}`,style:{display:"flex",flexDirection:"column",width:"100%",gap:8},children:[e.jsxs("button",{onClick:()=>n(k),style:{display:"flex",padding:"8px 0",alignItems:"center",gap:12,alignSelf:"stretch",width:"100%",background:"none",border:"none",borderBottom:"1px solid var(--Grey-absent, #D9D9D9)",cursor:"pointer"},children:[e.jsxs("span",{style:{flex:1,textAlign:"left",fontSize:14,fontWeight:600,color:"var(--text-dark, #0B0A0A)",lineHeight:1.71},children:[s.display_name||((S=s.key)==null?void 0:S.replace(/_/g," ")),D>0&&e.jsxs("span",{style:{fontWeight:600,color:"var(--text-dark, #0B0A0A)",marginLeft:6},children:["(",D,")"]})]}),C?e.jsx(p.ChevronUp,{size:20,color:"#767473"}):e.jsx(p.ChevronDown,{size:20,color:"#767473"})]}),C&&((F=s.observations)==null?void 0:F.length)>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",alignSelf:"stretch",gap:0},children:s.observations.map((E,A)=>{var T,O,x;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignSelf:"stretch",gap:8},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"8px 0",justifyContent:"space-between"},children:[e.jsx("span",{style:{flex:1,fontSize:14,fontWeight:400,color:"var(--text-subtle-warm, #767473)",lineHeight:1.5},children:E.reason||E.explanation}),((O=(T=E.evidence)==null?void 0:T[0])==null?void 0:O.start_ms)!=null&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.jsx(it,{size:28,title:"Show in transcript",onClick:m=>{m.stopPropagation(),a(E.evidence[0].start_ms)},children:e.jsx(p.ScrollText,{size:16,color:"#808183",strokeWidth:1.5})}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:1.2,whiteSpace:"nowrap"},children:j(E.evidence[0].start_ms)})]})]}),(x=E.evidence)==null?void 0:x.map((m,d)=>{const L=m.start_ms!=null&&m.end_ms!=null;return m.text&&e.jsxs("div",{onClick:Q=>{Q.stopPropagation(),L&&o(m)},onMouseEnter:()=>l(m.turn_ids??[]),onMouseLeave:()=>l([]),style:{display:"flex",alignItems:"center",gap:8,padding:"8px 0",cursor:L?"pointer":"default"},children:[L&&e.jsx(it,{size:28,children:I(m)?e.jsx(p.PauseCircle,{size:17,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}):e.jsx(p.PlayCircle,{size:17,color:"var(--Grey-Muted, #808183)",strokeWidth:1})}),e.jsxs("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2},children:["“",m.text,"”"]})]},d)})]},E.key??A)})})]},k)})]})]})},$={strong:"var(--Grey-Strong, #2E3236)",muted:"var(--Grey-Muted, #808183)",absent:"var(--Grey-absent, #D9D9D9)",white:"var(--Grey-White, #FFF)",accent:"var(--rail-orange, #C98A5A)",track:"var(--rail-surface-2, #E3E1D7)",infoIcon:"var(--color-input-border, #ACACAD)"},ln=({score:t=4,minScore:i=0,maxScore:n=5})=>{const j=Number(t),I=Number.isFinite(j)?Math.min(Math.max(j,i),n):i,s=n>i?(I-i)/(n-i)*5:0,b=180/5,k=H=>{const S=H*Math.PI/180;return{x:121.5+85*Math.cos(S),y:123-85*Math.sin(S)}},C=(H,S)=>{const F=k(H),E=k(S),A=H-S>180?1:0;return`M ${F.x} ${F.y} A 85 85 0 ${A} 1 ${E.x} ${E.y}`},D=2;return e.jsx("svg",{width:"100%",viewBox:"0 0 243 130",fill:"none",style:{maxWidth:243},children:Array.from({length:5},(H,S)=>{const F=180-S*b-(S>0?D/2:0),E=180-(S+1)*b+(S<5-1?D/2:0),A=Math.max(0,Math.min(1,s-S)),T=C(F,E);return e.jsxs("g",{children:[e.jsx("path",{d:T,stroke:$.track,strokeWidth:30,strokeLinecap:"butt",fill:"none"}),A>0&&e.jsx("path",{d:T,stroke:$.strong,strokeWidth:30,strokeLinecap:"butt",fill:"none",pathLength:1,strokeDasharray:`${A} 1`})]},S)})})},sn=({value:t=0,maxValue:i=5})=>{const n=Number(t),o=Number.isFinite(n)?Math.min(Math.max(n,0),i):0;return e.jsx("div",{style:{display:"flex",gap:2},children:Array.from({length:i},(l,a)=>{const g=Math.max(0,Math.min(1,o-a));return e.jsx("div",{style:{width:22,height:6,borderRadius:1,background:$.track,overflow:"hidden"},children:g>0&&e.jsx("div",{style:{width:`${g*100}%`,height:"100%",background:$.strong}})},a)})})},an={CSAT:"Predicted Customer Satisfaction",Resolution:"Predicted Resolution: was the issue fully resolved?","Process Adherence":"Process Adherence: Did the agent follow procedures?",Communication:"Predicted Communication Quality: Clarity, Empathy, Professionalism"},dn=({text:t,children:i})=>{const[n,o]=f.useState(!1),l=f.useRef(null),[a,g]=f.useState({top:0,left:0}),u=()=>{if(l.current){const y=l.current.getBoundingClientRect();g({top:y.top-8,left:y.left+y.width/2})}o(!0)};return e.jsxs("div",{ref:l,style:{position:"relative",display:"inline-flex"},onMouseEnter:u,onMouseLeave:()=>o(!1),children:[i,n&&e.jsx("div",{style:{position:"fixed",top:a.top,left:a.left,transform:"translate(-50%, -100%)",display:"flex",width:"max-content",maxWidth:300,padding:10,alignItems:"center",borderRadius:4,border:"1px solid var(--Grey-absent, #D9D9D9)",background:"var(--Grey-Strong, #2E3236)",zIndex:9999,pointerEvents:"none"},children:e.jsx("span",{style:{color:"#FFF",fontSize:12,fontWeight:400,lineHeight:"140%"},children:t})})]})},cn=({label:t,value:i=0,maxValue:n=5})=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,padding:8,alignItems:"flex-start"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontSize:12,fontWeight:400,color:$.strong,fontFamily:"var(--font-sans)",lineHeight:"normal"},children:t}),e.jsx(dn,{text:an[t]||t,children:e.jsx(p.Info,{size:14,color:$.infoIcon,strokeWidth:1,style:{cursor:"pointer"}})})]}),e.jsx(sn,{value:i,maxValue:n})]}),ct=({score:t=4,minScore:i=0,maxScore:n=5,predictedScore:o=4,predictedLabel:l="Predicted Objective",description:a="",legends:g=[{label:"CSAT",value:3},{label:"Resolution",value:4},{label:"Process Adherence",value:5},{label:"Communication",value:3}]})=>{const u=Number(t),y=Number.isFinite(u)?Math.min(Math.max(u,i),n):i,W=y.toFixed(1);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",padding:24,borderRadius:8,border:`1px solid ${$.absent}`,background:$.white,alignSelf:"stretch",flex:1,gap:24},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[e.jsx("span",{style:{fontSize:15,fontWeight:600,color:$.strong,fontFamily:"var(--font-sans)",lineHeight:1.2},children:"Interaction Quality"}),e.jsx("span",{style:{fontSize:14,fontWeight:400,color:$.muted,fontFamily:"var(--font-sans)",lineHeight:"normal"},children:a})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:24,flex:1,overflow:"hidden"},children:[e.jsxs("div",{style:{position:"relative",maxWidth:243,minWidth:160,flex:"0 1 243px",flexDirection:"column",alignItems:"center",display:"flex"},children:[e.jsx(ln,{score:t,minScore:i,maxScore:n}),(()=>{const s=-(180-(n>i?(y-i)/(n-i):0)*180-45);return e.jsxs("svg",{width:"34",height:"35",viewBox:"0 0 34 35",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{marginTop:-24,transform:`rotate(${s}deg)`,transformOrigin:"center center"},children:[e.jsx("path",{d:"M16 25.2169C19.958 25.2169 23.1667 22.0083 23.1667 18.0503C23.1667 14.0922 19.958 10.8836 16 10.8836C12.042 10.8836 8.83334 14.0922 8.83334 18.0503C8.83334 22.0083 12.042 25.2169 16 25.2169Z",fill:"var(--rail-orange, #C98A5A)"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M30.4791 11.2328L33.4351 0L21.6888 3.09113C19.9212 2.41855 18.0036 2.05025 16 2.05025C7.16344 2.05025 0 9.2137 0 18.0503C0 26.8868 7.16344 34.0503 16 34.0503C24.8366 34.0503 32 26.8868 32 18.0503C32 15.6119 31.4546 13.301 30.4791 11.2328ZM16 30.5503C22.9036 30.5503 28.5 24.9538 28.5 18.0503C28.5 11.1467 22.9036 5.55025 16 5.55025C9.09644 5.55025 3.5 11.1467 3.5 18.0503C3.5 24.9538 9.09644 30.5503 16 30.5503Z",fill:"var(--rail-orange, #C98A5A)"})]})})(),e.jsx("div",{style:{fontSize:28,fontWeight:400,color:$.strong,fontFamily:"var(--font-sans)",lineHeight:1,textAlign:"center",marginTop:8},children:W}),e.jsx("div",{style:{fontSize:15,fontWeight:500,color:$.strong,fontFamily:"var(--font-sans)",lineHeight:1.2,textAlign:"center",marginTop:8},children:"Compass Score"})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,alignItems:"flex-start",justifyContent:"center",flex:1},children:[e.jsx("div",{style:{fontSize:15,fontWeight:500,color:$.strong,fontFamily:"var(--font-sans)",lineHeight:1.2,textAlign:"left"},children:"Interaction Quality Index"}),e.jsx("div",{style:{width:"100%",height:1,background:$.absent}}),g.map((j,I)=>e.jsx(cn,{label:j.label,value:j.value},I))]})]})]})},ft=t=>{if(!t)return null;const n=String(t).trim().toLowerCase().split(/[^a-z]+/).filter(Boolean);return n.includes("supervisor")?"var(--rail-compliance, #C98A5A)":n.includes("admin")||n.includes("administrator")||n.includes("superadmin")?"var(--rail-discovery, #5E88B0)":n.includes("agent")?"var(--rail-outcome, #6B7C93)":null},fn=t=>{var o,l,a,g,u,y;if(!t)return null;const i=t.role??t.userRole??t.user_role??t.author_role??t.roleName??t.role_name??t.userType??t.user_type??t.type;if(typeof i=="string")return i;if(Array.isArray(i))return i.join(" ");if(i&&typeof i=="object")return i.name||i.value||i.label||null;const n=((o=t.user)==null?void 0:o.role)??((l=t.user)==null?void 0:l.userRole)??((a=t.user)==null?void 0:a.user_role)??((g=t.profile)==null?void 0:g.role)??((u=t.profile)==null?void 0:u.userRole)??((y=t.profile)==null?void 0:y.user_role);return typeof n=="string"?n:Array.isArray(n)?n.join(" "):n&&typeof n=="object"&&(n.name||n.value||n.label)||null},gt=t=>{if(!t)return"#6B7C93";const i=fn(t);return ft(i)||t.color||"#6B7C93"},Se=t=>(t||"").split(" ").map(i=>i[0]).join("").toUpperCase()||"U",gn=t=>{if(!t||t==="Just now")return!0;if(/^\d{4}-\d{2}-\d{2}T/.test(t))try{const n=/Z$|[+-]\d{2}:\d{2}$/.test(t)?t:t+"Z",o=new Date(n);return Number.isNaN(o.getTime())?!1:Date.now()-o.getTime()<15*60*1e3}catch{return!1}const i=t.match(/^(\d+)\s*min/);return i?parseInt(i[1],10)<15:!(/\d+\s*h/.test(t)||/\d+\s*day/.test(t))},hn=t=>{if(!t)return"";if(!/^\d{4}-\d{2}-\d{2}T/.test(t))return t;try{const i=/Z$|[+-]\d{2}:\d{2}$/.test(t)?t:t+"Z",n=new Date(i);if(Number.isNaN(n.getTime()))return t;const l=new Date().getTime()-n.getTime(),a=Math.floor(l/6e4),g=Math.floor(l/36e5);if(a<1)return"Just now";if(a<60)return`${a} min`;if(g<24)return`${g} h`;const u=Math.floor(g/24);return u===1?"1 day":`${u} days`}catch{return t}},ht=({name:t,initials:i,color:n,avatar:o,size:l=36})=>o?e.jsx("img",{src:o,alt:t,style:{width:l,height:l,borderRadius:"50%",objectFit:"cover",flexShrink:0}}):e.jsx("div",{style:{width:l,height:l,borderRadius:"50%",background:n||"#6B7C93",color:"#FFF",display:"flex",alignItems:"center",justifyContent:"center",fontSize:l<=32?"10px":"11px",fontWeight:650,flexShrink:0,fontFamily:"var(--default-font-family)",letterSpacing:"0.02em"},title:t,children:i||Se(t)}),pn=({comment:t,isReply:i=!1,isConsecutive:n=!1,onReply:o,onSendReply:l,onEdit:a,onDelete:g,onMenuClick:u,showReply:y=!0})=>{var h,P;const[W,j]=f.useState(!1),[I,s]=f.useState(!1),[b,k]=f.useState(!1),[C,D]=f.useState(""),[H,S]=f.useState(!1),[F,E]=f.useState(""),[A,T]=f.useState(!1),O=f.useRef(null),x=f.useRef(null),m=f.useRef(null),d=t.author||{},L=d.name||t.author_name||"Unknown",Q=d.initials||Se(L),J=d.role||t.author_role,X=d.color||ft(J)||"#6B7C93",R=d.avatar||t.avatar,te=t.timestamp||t.created_at,ne=hn(te),V=gn(te),le=!!(t.isEdited||t.is_edited||t.edited),de=Array.isArray(t.content)?t.content:[t.content||t.text||""];return f.useEffect(()=>{if(!I)return;const r=Z=>{O.current&&!O.current.contains(Z.target)&&s(!1)};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[I]),f.useEffect(()=>{const r=x.current;if(!r)return;r.style.height="auto";const Z=140;r.style.height=Math.min(r.scrollHeight,Z)+"px",r.style.overflowY=r.scrollHeight>Z?"auto":"hidden"},[C,b]),f.useEffect(()=>{const r=m.current;if(!r)return;r.style.height="auto";const Z=140;r.style.height=Math.min(r.scrollHeight,Z)+"px",r.style.overflowY=r.scrollHeight>Z?"auto":"hidden"},[F,H]),e.jsxs("div",{onMouseEnter:()=>j(!0),onMouseLeave:()=>j(!1),style:{display:"flex",paddingLeft:i?48:0,alignItems:"flex-start",gap:16,paddingTop:n?0:8,paddingBottom:8},children:[n?e.jsx("div",{style:{width:36,flexShrink:0}}):e.jsx(ht,{name:L,initials:Q,color:X,avatar:R}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:n?"flex-end":"space-between",marginBottom:n?0:6},children:[!n&&e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[e.jsx("span",{style:{fontSize:13,fontWeight:650,color:"var(--text-ink, #1E2125)",lineHeight:"150%",fontFamily:"var(--default-font-family)"},children:L}),e.jsx("span",{style:{fontSize:12,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:"150%",fontFamily:"var(--default-font-family)"},children:ne}),le&&e.jsx("span",{style:{fontSize:12,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:"150%",fontFamily:"var(--default-font-family)"},children:"(Edited)"})]}),e.jsxs("div",{style:{position:"relative"},ref:O,children:[e.jsx("button",{type:"button",onClick:()=>s(r=>!r),style:{padding:2,border:"none",background:"transparent",cursor:"pointer",borderRadius:4,display:"flex",alignItems:"center",justifyContent:"center",opacity:W||I?1:0,transition:"opacity 0.15s",flexShrink:0},children:e.jsx(p.Ellipsis,{size:24,color:"var(--Grey-Muted, #808183)"})}),I&&e.jsxs("div",{style:{position:"absolute",top:"100%",right:0,marginTop:4,display:"flex",width:99,flexDirection:"column",alignItems:"flex-start",borderRadius:4,border:"1px solid var(--Grey-absent, #D9D9D9)",background:"var(--Grey-White, #FFF)",boxShadow:"-2px 2px 2px 0 rgba(0, 0, 0, 0.25)",zIndex:50,overflow:"hidden"},children:[o&&e.jsx("button",{type:"button",onClick:()=>{s(!1),S(!1),k(!0)},style:{display:"flex",width:"100%",padding:"10px 16px",alignItems:"center",border:"none",background:"transparent",cursor:"pointer",fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",fontFamily:"var(--default-font-family)",lineHeight:"150%",textAlign:"left"},onMouseEnter:r=>{r.currentTarget.style.background="var(--surface-hover, #F3F7F7)"},onMouseLeave:r=>{r.currentTarget.style.background="transparent"},children:"Reply"}),a&&e.jsx("button",{type:"button",disabled:!V,onClick:()=>{if(!V)return;s(!1);const r=Array.isArray(t.content)?t.content.join(`
16
+ `):t.content||t.text||"";E(r),S(!0),k(!1)},style:{display:"flex",width:"100%",padding:"10px 16px",alignItems:"center",border:"none",background:"transparent",cursor:V?"pointer":"not-allowed",fontSize:13,fontWeight:400,color:V?"var(--Grey-Strong, #2E3236)":"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",lineHeight:"150%",textAlign:"left",opacity:V?1:.5},onMouseEnter:r=>{V&&(r.currentTarget.style.background="var(--surface-hover, #F3F7F7)")},onMouseLeave:r=>{r.currentTarget.style.background="transparent"},children:"Edit"}),g&&e.jsx("button",{type:"button",onClick:()=>{s(!1),T(!0)},style:{display:"flex",width:"100%",padding:"10px 16px",alignItems:"center",border:"none",background:"transparent",cursor:"pointer",fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",fontFamily:"var(--default-font-family)",lineHeight:"150%",textAlign:"left"},onMouseEnter:r=>{r.currentTarget.style.background="var(--surface-hover, #F3F7F7)"},onMouseLeave:r=>{r.currentTarget.style.background="transparent"},children:"Delete"})]})]})]}),H?e.jsxs("div",{style:{display:"flex",width:662,maxWidth:"100%",padding:"8px 12px 12px 12px",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:24,borderRadius:8,border:"1px solid var(--Grey-absent, #D9D9D9)",background:"var(--Grey-White, #FFF)",boxSizing:"border-box",marginTop:4},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:[e.jsxs("span",{style:{fontSize:13,fontWeight:600,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",lineHeight:"normal"},children:["“"," ",((h=t.author)==null?void 0:h.name)||"Unknown"]}),e.jsx("button",{type:"button",onClick:()=>S(!1),style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0},children:e.jsx(p.X,{size:20,color:"var(--Grey-Muted, #808183)"})})]}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-end",gap:8,width:"100%"},children:[e.jsx("textarea",{ref:m,value:F,onChange:r=>E(r.target.value),onKeyDown:r=>{if(r.key==="Enter"){if(r.metaKey||r.ctrlKey||r.shiftKey)return;r.preventDefault(),F.trim()&&(a==null||a({...t,content:F.trim(),isEdited:!0}),S(!1))}r.key==="Escape"&&S(!1)},autoFocus:!0,rows:1,style:{flex:1,padding:"10px 12px",fontSize:13,fontWeight:400,color:"var(--text-ink, #1E2125)",fontFamily:"var(--default-font-family)",lineHeight:"160%",border:"none",background:"transparent",outline:"none",boxSizing:"border-box",resize:"none",minHeight:24,maxHeight:140,overflowY:"hidden"}}),e.jsx("button",{type:"button",onClick:()=>{F.trim()&&(a==null||a({...t,content:F.trim(),isEdited:!0}),S(!1))},disabled:!F.trim(),style:{display:"flex",padding:"6px 16px",justifyContent:"center",alignItems:"center",fontSize:13,fontWeight:600,color:F.trim()?"var(--Grey-White, #FFF)":"var(--Grey-Muted, #808183)",background:F.trim()?"var(--Grey-Strong, #2E3236)":"var(--grey-light, #e9e8e8a1)",border:"none",borderRadius:6,cursor:F.trim()?"pointer":"not-allowed",fontFamily:"var(--default-font-family)",flexShrink:0,transition:"all 0.15s",lineHeight:"150%"},children:"Save"})]})]}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4,alignItems:"flex-start"},children:de.map((r,Z)=>e.jsx("div",{style:{fontSize:13,fontWeight:400,color:"var(--text-ink, #1E2125)",lineHeight:"160%",fontFamily:"var(--default-font-family)",padding:"8px 12px",background:i?"var(--surface-hover, #F3F7F7)":"var(--surface-warm-40, rgba(243, 241, 229, 0.40))",borderRadius:8,wordBreak:"break-word",whiteSpace:"pre-wrap"},children:r},Z))}),A&&e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8,marginTop:8,fontSize:13,fontFamily:"var(--default-font-family)"},children:[e.jsx("span",{style:{color:"var(--Grey-Muted, #808183)",fontWeight:400},children:"Confirm: delete this comment?"}),e.jsx("button",{type:"button",onClick:()=>{T(!1),g==null||g(t)},style:{background:"var(--grey-light, #e9e8e8a1)",border:"none",cursor:"pointer",fontSize:13,fontWeight:600,color:"var(--text-ink, #1E2125)",fontFamily:"var(--default-font-family)",padding:"4px 10px",borderRadius:6,transition:"background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.background="var(--Grey-absent, #D9D9D9)"},onMouseLeave:r=>{r.currentTarget.style.background="var(--grey-light, #e9e8e8a1)"},children:"Delete"}),e.jsx("button",{type:"button",onClick:()=>T(!1),style:{background:"none",border:"none",cursor:"pointer",fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",padding:"4px 10px",borderRadius:6,transition:"background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.background="var(--grey-light, #e9e8e8a1)"},onMouseLeave:r=>{r.currentTarget.style.background="none"},children:"Cancel"})]}),y&&o&&!b&&!A&&e.jsxs("button",{type:"button",onClick:()=>{S(!1),k(!0)},style:{display:"flex",alignItems:"center",gap:6,marginTop:8,padding:0,border:"none",background:"transparent",cursor:"pointer",fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",transition:"color 0.15s"},children:[e.jsx(p.CornerDownRight,{size:20,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),"Reply"]}),b&&e.jsxs("div",{style:{display:"flex",width:662,maxWidth:"100%",padding:"8px 12px 12px 12px",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:24,borderRadius:8,border:"1px solid var(--Grey-absent, #D9D9D9)",background:"var(--Grey-White, #FFF)",boxSizing:"border-box",marginTop:12},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,width:"100%"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:[e.jsxs("span",{style:{fontSize:13,fontWeight:600,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",lineHeight:"normal"},children:["“"," ",((P=t.author)==null?void 0:P.name)||"Unknown"]}),e.jsx("button",{type:"button",onClick:()=>{D(""),k(!1)},style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0},children:e.jsx(p.X,{size:20,color:"var(--Grey-Muted, #808183)"})})]}),e.jsx("div",{style:{display:"flex",height:36,padding:16,alignItems:"center",gap:5,borderRadius:"0 8px 8px 8px",background:"var(--Grey-Strong, #2E3236)",boxSizing:"border-box",width:"100%"},children:e.jsx("span",{style:{color:"var(--Grey-White, #FFF)",fontSize:13,fontWeight:400,fontFamily:"var(--default-font-family)",lineHeight:"normal",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Array.isArray(t.content)?t.content[0]:t.content})})]}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-end",gap:8,width:"100%"},children:[e.jsx("textarea",{ref:x,value:C,onChange:r=>D(r.target.value),onKeyDown:r=>{if(r.key==="Enter"){if(r.metaKey||r.ctrlKey||r.shiftKey)return;r.preventDefault(),C.trim()&&(l==null||l({content:C.trim(),parentId:t.id}),D(""),k(!1))}r.key==="Escape"&&(D(""),k(!1))},autoFocus:!0,placeholder:"Add a reply",rows:1,style:{flex:1,padding:"10px 12px",fontSize:13,fontWeight:400,color:"var(--text-ink, #1E2125)",fontFamily:"var(--default-font-family)",lineHeight:"160%",border:"none",background:"transparent",outline:"none",boxSizing:"border-box",resize:"none",minHeight:24,maxHeight:140,overflowY:"hidden"}}),e.jsx("button",{type:"button",onClick:()=>{C.trim()&&(l==null||l({content:C.trim(),parentId:t.id}),D(""),k(!1))},disabled:!C.trim(),style:{display:"flex",height:28,padding:"8px 12px",justifyContent:"center",alignItems:"center",gap:8,fontSize:13,fontWeight:600,color:C.trim()?"var(--Grey-White, #FFF)":"var(--Grey-Muted, #808183)",background:C.trim()?"var(--Neutral-850, #272727)":"var(--grey-light, #e9e8e8a1)",border:"none",borderRadius:10,cursor:C.trim()?"pointer":"not-allowed",fontFamily:"var(--default-font-family)",lineHeight:"150%"},children:"Post"})]})]})]})]})},un=({currentUser:t,onSubmit:i})=>{const[n,o]=f.useState(""),[l,a]=f.useState(!1),g=f.useRef(null);f.useEffect(()=>{const s=g.current;if(!s)return;s.style.height="auto";const b=140;s.style.height=Math.min(s.scrollHeight,b)+"px",s.style.overflowY=s.scrollHeight>b?"auto":"hidden"},[n]);const u=()=>{const s=n.trim();s&&(i==null||i(s),o(""))},y=s=>{if(s.key==="Enter"){if(s.metaKey||s.ctrlKey||s.shiftKey)return;s.preventDefault(),u()}},W=(t==null?void 0:t.initials)||Se(t==null?void 0:t.name),j=gt(t),I=t==null?void 0:t.avatar;return e.jsxs("div",{style:{display:"flex",gap:16,alignItems:"flex-start"},children:[e.jsx(ht,{name:t==null?void 0:t.name,initials:W,color:j,avatar:I}),e.jsx("div",{style:{flex:1,padding:12,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:24,borderRadius:8,border:l?"1px solid var(--Grey-Strong, #2E3236)":"1px solid var(--Grey-absent, #D9D9D9)",background:"var(--Grey-White, #FFF)",transition:"border-color 0.15s"},children:e.jsxs("div",{style:{display:"flex",alignItems:"flex-end",gap:8,width:"100%"},children:[e.jsx("textarea",{ref:g,value:n,onChange:s=>o(s.target.value),onFocus:()=>a(!0),onBlur:()=>a(!1),onKeyDown:y,placeholder:"Add feedback",rows:1,style:{flex:1,border:"none",outline:"none",resize:"none",fontSize:13,fontWeight:400,color:"var(--text-ink, #1E2125)",fontFamily:"var(--default-font-family)",lineHeight:"160%",background:"transparent",padding:0,minHeight:24,maxHeight:140,overflowY:"hidden"}}),e.jsx("button",{type:"button",onClick:u,disabled:!n.trim(),style:{display:"flex",padding:"6px 16px",justifyContent:"center",alignItems:"center",fontSize:13,fontWeight:600,color:n.trim()?"var(--Grey-White, #FFF)":"var(--Grey-Muted, #808183)",background:n.trim()?"var(--Grey-Strong, #2E3236)":"var(--grey-light, #e9e8e8a1)",border:"none",borderRadius:6,cursor:n.trim()?"pointer":"not-allowed",fontFamily:"var(--default-font-family)",transition:"all 0.15s",flexShrink:0,lineHeight:"150%"},children:"Post"})]})})]})},pt=({comment:t,depth:i=0,isConsecutive:n=!1,onReply:o,onSendReply:l,onEdit:a,onDelete:g,onMenuClick:u})=>{const y=t.replies&&t.replies.length>0,W=!y;return e.jsxs(f.Fragment,{children:[e.jsx("div",{style:{paddingLeft:i>0?Math.min(i*32,128):0},children:e.jsx(pn,{comment:t,isReply:i>0,isConsecutive:n,onReply:o,onSendReply:l,onEdit:a,onDelete:g,onMenuClick:u,showReply:W})}),y&&t.replies.map(j=>e.jsx(pt,{comment:j,depth:i+1,onReply:o,onSendReply:l,onEdit:a,onDelete:g,onMenuClick:u},j.id))]})},ut=({comments:t=[],totalComments:i,children:n,onSendComment:o,onReply:l,onSendReply:a,onEdit:g,onDelete:u,onMenuClick:y,onMarkResolved:W,currentUser:j,isResolved:I=!1})=>{const[s,b]=f.useState([]),[k,C]=f.useState(!1),D=f.useMemo(()=>{const x=new Set(t.map(d=>d.id)),m=s.filter(d=>!x.has(d.id));return[...t,...m]},[t,s]);f.useEffect(()=>{const x=new Set(t.map(m=>m.id));b(m=>m.filter(d=>!x.has(d.id)))},[t]);const H=f.useMemo(()=>{if(!j)return{name:"You",initials:"YO",color:"#6B7C93"};const x=j.name||"You",m=j.initials||Se(x),d=gt(j);return{...j,name:x,initials:m,color:d}},[j]),S=async({content:x,parentId:m})=>{if(a){C(!0);try{await a({content:x,parentId:m})}finally{C(!1)}}else{const d={id:`temp-${Date.now()}`,author:H,content:x,timestamp:"Just now",parentId:m,isOptimistic:!0};b(L=>[...L,d])}},F=async x=>{if(o){C(!0);try{await o(x)}finally{C(!1)}}else{const m={id:`temp-${Date.now()}`,author:H,content:x,timestamp:"Just now",isOptimistic:!0};b(d=>[...d,m])}},E=x=>{b(m=>m.map(d=>d.id===x.id?{...d,content:x.content,isEdited:!0}:d)),g==null||g(x)},A=x=>{b(m=>m.filter(d=>d.id!==x.id)),u==null||u(x)},T=f.useMemo(()=>{const x={};D.forEach(d=>{d.parentId&&(x[d.parentId]||(x[d.parentId]=[]),x[d.parentId].push(d))});const m=d=>({...d,replies:(x[d.id]||[]).map(m)});return D.filter(d=>!d.parentId).map(m)},[D]),O=i??D.length;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",background:"var(--Grey-White, #FFF)",width:"100%",fontFamily:"var(--default-font-family)"},children:[e.jsxs("div",{style:{display:"flex",height:40,paddingBottom:8,alignItems:"center",gap:8,alignSelf:"stretch"},children:[e.jsx(p.MessagesSquare,{size:24,color:"var(--rail-orange, #C98A5A)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:16,fontWeight:600,color:"var(--Grey-Strong, #2E3236)",textTransform:"uppercase",lineHeight:1.2},children:"Feedback & Guidance"})]}),e.jsx("div",{style:{width:"100%",height:1,background:"var(--Grey-absent, #D9D9D9)"}}),e.jsxs("div",{style:{display:"flex",gap:24,alignSelf:"stretch"},children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,paddingTop:16,paddingBottom:8},children:[e.jsx("div",{style:{width:34,height:34,borderRadius:9999,background:"var(--surface-hover, #F3F7F7)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(p.MessagesSquare,{style:{width:20,height:20,flexShrink:0},color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.5})}),e.jsx("span",{style:{fontSize:15,fontWeight:500,color:"var(--Grey-Strong, #2E3236)"},children:"Feedback"}),e.jsxs("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",lineHeight:"150%",marginLeft:"auto"},children:[O," Comment",O!==1?"s":""]}),I?e.jsxs("div",{style:{display:"inline-flex",height:32,padding:"12px 16px 12px 12px",justifyContent:"center",alignItems:"center",gap:8,borderRadius:10,background:"var(--Rail-Surface-2, #E3E1D7)",flexShrink:0},children:[e.jsx(p.Check,{size:16,color:"var(--Grey-Strong, #2E3236)",strokeWidth:2}),e.jsx("span",{style:{fontSize:13,fontWeight:500,color:"var(--Grey-Strong, #2E3236)",fontFamily:"var(--default-font-family)",lineHeight:"150%"},children:"Resolved"})]}):W?e.jsxs("button",{type:"button",onClick:W,style:{display:"flex",alignItems:"center",gap:8,padding:"8px 16px",fontSize:13,fontWeight:500,color:"var(--Grey-Strong, #2E3236)",background:"var(--Grey-White, #FFF)",border:"1px solid var(--Grey-absent, #D9D9D9)",borderRadius:20,cursor:"pointer",fontFamily:"var(--default-font-family)",transition:"background 0.15s",lineHeight:"150%",flexShrink:0},children:[e.jsx(p.CircleCheck,{size:16,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.5}),"Mark as Resolved"]}):null]}),D.length>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:0,marginBottom:24,maxHeight:600,overflowY:D.length>6?"auto":"visible"},children:T.map((x,m)=>{var X,R;const d=m>0?T[m-1]:null,L=((X=d==null?void 0:d.author)==null?void 0:X.name)||(d==null?void 0:d.author_name),Q=((R=x.author)==null?void 0:R.name)||x.author_name,J=d&&L===Q&&(!d.replies||d.replies.length===0);return e.jsx(pt,{comment:x,depth:0,isConsecutive:!!J,onReply:l,onSendReply:S,onEdit:E,onDelete:A,onMenuClick:y},x.id)})}),D.length>0&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:16,marginLeft:48},children:[e.jsx(p.Info,{size:16,color:"var(--Grey-Muted, #808183)"}),e.jsx("span",{style:{color:"var(--Grey-Muted, #808183)",fontSize:13,fontStyle:"normal",fontWeight:400,lineHeight:"normal"},children:"Comments can be edited within 15 minutes."})]}),k&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 0"},children:[e.jsx("div",{style:{width:16,height:16,border:"2px solid var(--Grey-absent, #D9D9D9)",borderTopColor:"var(--Grey-Strong, #2E3236)",borderRadius:"50%",animation:"spin 0.8s linear infinite"}}),e.jsx("span",{style:{fontSize:13,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)"},children:"Sending..."}),e.jsx("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"})]}),e.jsx(un,{currentUser:H,onSubmit:F})]}),e.jsx("div",{style:{flex:1,minWidth:0},children:n})]})]})},rt=({children:t,size:i=28,onClick:n,title:o})=>{const[l,a]=f.useState(!1);return e.jsx("div",{title:o,onClick:n,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),style:{display:"flex",alignItems:"center",justifyContent:"center",width:i,height:i,borderRadius:9999,background:l?"var(--surface-hover, #F3F7F7)":"transparent",cursor:"pointer",flexShrink:0,transition:"background 0.15s"},children:t})},xn=t=>{const i=Math.floor(t/6e4),n=Math.floor(t%6e4/1e3);return`${i.toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}`},yn=({item:t,isLast:i,onPlayEvidence:n,onShowInTranscript:o,timelinePlaying:l,currentTimeSeconds:a})=>{var s;const g=(s=t.signal_refs)==null?void 0:s.map(b=>{const k=b.display_name||b.signal_key||"",C=b.confidence!=null?` (${Math.round(b.confidence*100)}%)`:"";return k+C}).join(", "),u=t.start_ms??t.startMs,y=t.end_ms??t.endMs,W=u!=null,j=(a??0)*1e3,I=l&&W&&j>=u&&j<=(y??u+5e3);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,padding:"12px 0",borderBottom:i?"none":"1px solid var(--Grey-absent, #D9D9D9)"},children:[e.jsx("span",{style:{alignSelf:"stretch",fontSize:14,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",lineHeight:"150%"},children:t.title||t.detail||""}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[g&&e.jsx("span",{style:{fontSize:14,fontWeight:400,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",lineHeight:"150%",flex:1,minWidth:0},children:g}),W&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.jsx(rt,{size:28,title:I?"Pause":"Play evidence",onClick:()=>n==null?void 0:n({start_ms:u,end_ms:y}),children:I?e.jsx(p.PauseCircle,{size:17,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1}):e.jsx(p.PlayCircle,{size:17,color:"var(--Grey-Muted, #808183)",strokeWidth:1})}),e.jsx(rt,{size:28,title:"Show in transcript",onClick:()=>o==null?void 0:o(u),children:e.jsx(p.ScrollText,{size:16,color:"#808183",strokeWidth:1.5})}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:1.2,whiteSpace:"nowrap"},children:xn(u)})]})]})]})},xt=({items:t=[],guidanceCount:i,loading:n=!1,onPlayEvidence:o,onShowInTranscript:l,timelinePlaying:a=!1,currentTimeSeconds:g=0})=>{const u=i??t.length;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch",width:"100%"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,paddingTop:16,paddingBottom:8},children:[e.jsx("div",{style:{width:34,height:34,borderRadius:9999,background:"var(--surface-hover, #F3F7F7)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(p.Lightbulb,{style:{width:20,height:20,flexShrink:0},color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.5})}),e.jsx("span",{style:{fontSize:15,fontWeight:500,color:"var(--Grey-Strong, #2E3236)"},children:"Guidance"}),e.jsxs("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",lineHeight:"150%",marginLeft:"auto"},children:[u," Item",u!==1?"s":""]})]}),t.map((y,W)=>e.jsx(yn,{item:y,isLast:W===t.length-1,onPlayEvidence:o,onShowInTranscript:l,timelinePlaying:a,currentTimeSeconds:g},W))]})},oe=({text:t,children:i})=>{const[n,o]=f.useState(!1),l=f.useRef(null),[a,g]=f.useState({top:0,left:0});if(!t)return i;const u=()=>{if(l.current){const y=l.current.getBoundingClientRect();g({top:y.bottom+6,left:y.left+y.width/2})}o(!0)};return e.jsxs("div",{ref:l,style:{position:"relative",display:"inline-flex"},onMouseEnter:u,onMouseLeave:()=>o(!1),children:[i,n&&e.jsx("div",{style:{position:"fixed",top:a.top,left:a.left,transform:"translate(-50%, 0)",display:"flex",padding:10,alignItems:"center",borderRadius:4,border:"1px solid var(--Grey-absent, #D9D9D9)",background:"var(--Grey-Strong, #2E3236)",zIndex:9999,pointerEvents:"none",whiteSpace:"nowrap"},children:e.jsx("span",{style:{color:"#FFF",fontSize:12,fontWeight:400,lineHeight:"normal"},children:t})})]})},mn=[{key:"overview",label:"Overview"},{key:"coaching",label:"Coaching Summary"},{key:"signals",label:"Signals & Recording"},{key:"comments",label:"Feedback"}];function vn(t,i){const n=(t==null?void 0:t.direction)??(t==null?void 0:t.interaction_direction)??(t==null?void 0:t.call_direction)??i;if(n==null||n==="")return null;const o=String(n).toLowerCase().trim();return o==="outbound"||o.startsWith("outbound")?"outbound":o==="inbound"||o.startsWith("inbound")?"inbound":null}const jn=({title:t="Wheel Stud Replacement Enquiry",onBack:i,data:n,coachingData:o,coachingLoading:l=!1,audioUrl:a,audioRef:g,currentTimeSeconds:u,timelinePlaying:y,playbackRate:W,timelineSegments:j,onSeek:I,onTogglePlay:s,onSeekBack:b,onSeekForward:k,onSetPlaybackRate:C,agentName:D,agentFullName:H,customerName:S,customerFullName:F,transcript:E,activeTurnIndex:A,turnObservations:T,highlightedTurns:O,onTurnPlayPause:x,onPlayEvidence:m,onHighlightTurns:d,callPurpose:L,classification:Q,outcomeQuality:J,resolutionOutcome:X,customerIntent:R,location:te,interactionId:ne,moreDetails:V,compassScore:le,compassMaxScore:de=5,predictedCsat:h,predictedLabel:P="Predicted Objective",compassLegends:r,customerSessions:Z,customerSessionCount:yt,onSessionClick:Me,onViewAllSessions:Ee,prevSessionDesc:He,prevSessionDisabled:U=!1,nextSessionDesc:Re,nextSessionDisabled:ee=!1,onPreviousSession:pe,onNextSession:ue,comments:Te=[],guidance:mt=[],currentUser:B,onSendComment:vt,onSendReply:jt,onReply:bt,onEdit:St,onEditInteraction:wt,onDelete:kt,onMenuClick:Ct,onMarkResolved:Ft,commentsResolved:Wt})=>{var Qe;const[we,xe]=f.useState("overview"),[It,_e]=f.useState(new Set),[Dt,ye]=f.useState(!1),[zt,Ae]=f.useState(null),[Le,Be]=f.useState(!1),[Oe,Gt]=f.useState(0),[Pe,Mt]=f.useState(!1),ie=f.useRef(null),me=f.useRef(null),ke=f.useRef(null),ce=f.useRef(null),Ce=f.useRef(null),Et={overview:me,coaching:ke,signals:ce,comments:Ce},fe=f.useRef(null),Fe=f.useRef(!1);f.useEffect(()=>{const c=fe.current;if(!c)return;const z=["overview","coaching","signals","comments"],v=[me,ke,ce,Ce],G=(q=>{let re=q.parentElement;for(;re;){const{overflow:be,overflowY:ae}=window.getComputedStyle(re);if(/(auto|scroll)/.test(be+ae))return re;re=re.parentElement}return null})(c),K=()=>{var be;if(Fe.current)return;let q=z[0];for(let ae=v.length-1;ae>=0;ae--){const Je=v[ae].current;if(!Je)continue;if(Je.getBoundingClientRect().top<=150){q=z[ae];break}}xe(q);const re=((be=me.current)==null?void 0:be.getBoundingClientRect().top)??Number.POSITIVE_INFINITY;Mt(re<=150)};return c.addEventListener("scroll",K,{passive:!0}),G&&G!==c&&G.addEventListener("scroll",K,{passive:!0}),window.addEventListener("scroll",K,{passive:!0,capture:!0}),K(),()=>{c.removeEventListener("scroll",K),G&&G!==c&&G.removeEventListener("scroll",K),window.removeEventListener("scroll",K,{capture:!0})}},[]);const Ne=f.useRef(null),Ht=c=>{var v;xe(c),Fe.current=!0,Ne.current=c;const z=(v=Et[c])==null?void 0:v.current;if(z){const w=fe.current;if(w&&w.scrollHeight>w.clientHeight){const G=w.getBoundingClientRect().top,q=z.getBoundingClientRect().top-G+w.scrollTop-16;w.scrollTo({top:q,behavior:"smooth"})}else{const G=z.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:G,behavior:"smooth"})}}setTimeout(()=>{Fe.current=!1,Ne.current=null},1200)},We=Z||[],Ie=We.length>1,$e=c=>{xe("signals");const z=ce.current;if(z){const w=fe.current;if(w&&w.scrollHeight>w.clientHeight){const G=w.getBoundingClientRect().top,q=z.getBoundingClientRect().top-G+w.scrollTop-16;w.scrollTo({top:q,behavior:"smooth"})}else{const G=z.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:G,behavior:"smooth"})}}const v=c/1e3;setTimeout(()=>{var w;(w=ie.current)!=null&&w.scrollToTranscript&&ie.current.scrollToTranscript(v)},220)},Ye=c=>{xe("signals");const z=ce.current;if(z){const w=fe.current;if(w&&w.scrollHeight>w.clientHeight){const G=w.getBoundingClientRect().top,q=z.getBoundingClientRect().top-G+w.scrollTop-16;w.scrollTo({top:q,behavior:"smooth"})}else{const G=z.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:G,behavior:"smooth"})}}const v=(c==null?void 0:c.start_ms)??(c==null?void 0:c.startMs);setTimeout(()=>{var w,G;if(v!=null&&((w=ie.current)!=null&&w.scrollToTranscript)&&ie.current.scrollToTranscript(v/1e3),m)m(c);else if(v!=null&&((G=ie.current)!=null&&G.seekTo)){ie.current.seekTo(v/1e3),Be(!0),Gt(v/1e3);const q=(c.end_ms??c.endMs??v+5e3)-v;setTimeout(()=>Be(!1),q)}},220)},Rt=c=>{d&&d(c)},Tt=c=>{_e(z=>{const v=new Set(z);return v.has(c)?v.delete(c):v.add(c),v})},_t=(n==null?void 0:n.blocks)||[],ge=c=>{var z;return((z=_t.find(v=>v.block_id===c))==null?void 0:z.payload)||{}},Y=ge("interaction-metadata"),se=ge("interaction-context"),ve=ge("interaction-signals"),At=ge("interaction-outcome-lift"),Lt=ge("interaction-dimensions").dimensions||[],Bt=se.call_purpose||{},Ot=se.classification||{},Ke=Y||{},De=L||Bt||{},Pt=Q||Ot||{},qe=At||{},Nt=(qe.driver_signal_keys||[]).map(c=>c.replace(/^sig\./,"").replace(/_/g," ")),$t=o||null,Yt=(Qe=ve==null?void 0:ve.signals)!=null&&Qe.length?ve:{present_count:0,total_signals_evaluated:0,signals:[]},Ve=mt||[],ze=D||Y.agent_name||Y.agent||se.agent_name||"Agent",Kt=H||Y.agent_full_name||Y.agent_name||ze,he=S||Y.customer_name||Y.customer||se.customer_name||"Customer",Ze=F||Y.customer_full_name||Y.customer_name||he,qt=String((B==null?void 0:B.role)??(B==null?void 0:B.userRole)??(B==null?void 0:B.user_role)??(B==null?void 0:B.roleName)??(B==null?void 0:B.role_name)??"").toLowerCase(),Vt=/(admin|superadmin|administrator)/.test(qt),Ge=yt??We.length,je=Y.created_dt||(n==null?void 0:n.created_dt)||se.created_dt||"",Zt=je?new Date(/Z$|[+-]\d{2}:\d{2}$/.test(je)?je:je+"Z").toLocaleString():"",Qt=De.interaction_direction==="inbound"?"Inbound":"Outbound";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",height:"100%",background:"var(--Grey-White, #FFF)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"18px 24px 0"},children:[e.jsx("button",{onClick:i,style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0,flexShrink:0},children:e.jsx(p.ArrowLeft,{size:24,color:"var(--Grey-Strong, #2E3236)"})}),e.jsx("div",{style:{width:1,height:28,background:"var(--Base-absent, #D9D9D9)"}}),e.jsx("h1",{style:{color:"var(--Grey-Strong, #2E3236)",fontSize:24,fontStyle:"normal",fontWeight:400,lineHeight:"normal",margin:0,flex:1},children:t}),(pe||ue)&&!Pe&&e.jsxs("div",{style:{display:"flex",alignItems:"center",flexShrink:0},children:[e.jsx(oe,{text:He,children:e.jsxs("button",{onClick:U?void 0:pe,disabled:U,style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",background:"none",border:"none",cursor:U?"default":"pointer",opacity:U?.4:1},children:[e.jsx(p.ArrowLeft,{size:16,color:"var(--Neutral-800, #323232)",strokeWidth:1.5}),e.jsx("span",{style:{color:"var(--Neutral-800, #323232)",fontSize:13,fontWeight:400,lineHeight:"24px",fontFamily:"var(--default-font-family)",whiteSpace:"nowrap"},children:"Previous Interaction"})]})}),e.jsx("div",{style:{width:1,height:20,background:"var(--Grey-absent, #D9D9D9)",flexShrink:0}}),e.jsx(oe,{text:Re,children:e.jsxs("button",{onClick:ee?void 0:ue,disabled:ee,style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",background:"none",border:"none",cursor:ee?"default":"pointer",opacity:ee?.4:1},children:[e.jsx("span",{style:{color:"var(--Neutral-800, #323232)",fontSize:13,fontWeight:400,lineHeight:"24px",fontFamily:"var(--default-font-family)",whiteSpace:"nowrap"},children:"Next Interaction"}),e.jsx(p.ArrowRight,{size:16,color:"var(--Neutral-800, #323232)",strokeWidth:1.5})]})})]})]}),e.jsx("div",{style:{position:"sticky",top:68,zIndex:20,background:"var(--Grey-White, #FFF)"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16,background:"var(--Grey-White, #FFF)",borderBottom:"1px solid var(--Grey-Faint, #ACADAD)",padding:"0 24px",marginTop:8},children:[e.jsx("div",{style:{display:"flex",alignItems:"flex-start",minWidth:0},children:mn.map(c=>e.jsx("button",{onClick:()=>Ht(c.key),style:{display:"flex",padding:16,alignItems:"center",gap:10,background:"none",border:"none",borderBottom:we===c.key?"3px solid var(--Grey-Strong, #2E3236)":"3px solid transparent",cursor:"pointer",fontSize:15,fontWeight:we===c.key?500:400,color:we===c.key?"var(--Grey-Strong, #2E3236)":"var(--Grey-Muted, #808183)",whiteSpace:"nowrap",transition:"border-color 0.2s ease, color 0.2s ease"},children:c.label},c.key))}),(pe||ue)&&Pe&&e.jsxs("div",{style:{display:"flex",alignItems:"center",flexShrink:0},children:[e.jsx(oe,{text:He,children:e.jsxs("button",{onClick:U?void 0:pe,disabled:U,style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",background:"none",border:"none",cursor:U?"default":"pointer",opacity:U?.4:1},children:[e.jsx(p.ArrowLeft,{size:16,color:"var(--Neutral-800, #323232)",strokeWidth:1.5}),e.jsx("span",{style:{color:"var(--Neutral-800, #323232)",fontSize:13,fontWeight:400,lineHeight:"24px",fontFamily:"var(--default-font-family)",whiteSpace:"nowrap"},children:"Previous Interaction"})]})}),e.jsx("div",{style:{width:1,height:20,background:"var(--Grey-absent, #D9D9D9)",flexShrink:0}}),e.jsx(oe,{text:Re,children:e.jsxs("button",{onClick:ee?void 0:ue,disabled:ee,style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",background:"none",border:"none",cursor:ee?"default":"pointer",opacity:ee?.4:1},children:[e.jsx("span",{style:{color:"var(--Neutral-800, #323232)",fontSize:13,fontWeight:400,lineHeight:"24px",fontFamily:"var(--default-font-family)",whiteSpace:"nowrap"},children:"Next Interaction"}),e.jsx(p.ArrowRight,{size:16,color:"var(--Neutral-800, #323232)",strokeWidth:1.5})]})})]})]})}),e.jsxs("div",{ref:fe,style:{padding:24,flex:1,overflowY:"auto"},children:[e.jsxs("div",{ref:me,style:{display:"flex",flexDirection:"column",justifyContent:"flex-end",alignItems:"flex-start",gap:24,alignSelf:"stretch"},children:[e.jsxs("div",{style:{display:"flex",height:40,alignItems:"center",gap:16,alignSelf:"stretch"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1},children:[e.jsx(p.ClipboardList,{size:24,color:"var(--rail-orange, #C98A5A)",strokeWidth:2}),e.jsx("span",{style:{fontSize:16,fontWeight:600,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2,textTransform:"uppercase"},children:"Overview"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,flexShrink:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"8px 0"},children:[e.jsx(p.CalendarDays,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",fontFamily:"var(--font-sans)",lineHeight:1.2},children:Zt})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"8px 0"},children:[e.jsx(p.PhoneIncoming,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",fontFamily:"var(--font-sans)",lineHeight:1.2},children:Qt})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,paddingLeft:16,borderLeft:"1px solid var(--Grey-absent, #D9D9D9)"},children:[e.jsx(oe,{text:Kt,children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"8px 0",cursor:"pointer"},children:[e.jsx(p.Headset,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",fontFamily:"var(--font-sans)",lineHeight:1.2},children:ze})]})}),Ge>1?e.jsx("div",{children:e.jsx(oe,{text:Ze,children:e.jsxs("button",{onClick:()=>ye(!0),style:{display:"flex",alignItems:"center",gap:16,padding:"0 16px",height:34,borderRadius:8,background:"var(--Rail-Surface-2, #E3E1D7)",border:"none",cursor:"pointer"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,minWidth:0},children:[e.jsx(p.CircleUser,{size:16,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.5}),e.jsxs("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2,whiteSpace:"nowrap"},children:[e.jsx("span",{style:{fontWeight:600},children:he})," ",e.jsxs("span",{children:["(",Ge," Interactions)"]})]})]}),e.jsx(p.ChevronRight,{size:16,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.7})]})})}):e.jsx(oe,{text:Ze,children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"8px 0",cursor:"pointer"},children:[e.jsx(p.CircleUser,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2},children:he})]})})]})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"stretch",gap:24,alignSelf:"stretch"},children:[e.jsx("div",{style:{flex:1,minWidth:0,display:"flex"},children:e.jsx(ct,{score:le??.5,minScore:0,maxScore:de,predictedScore:h??.5,predictedLabel:P,legends:r})}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch",justifyContent:"flex-end",gap:24,flex:1,minWidth:0},children:[e.jsx(st,{meta:Ke,callPurpose:De,classification:Pt,outcomeQuality:J||"Neutral",dimensions:Lt,resolutionOutcome:X,customerIntent:R,location:te??Y.location??Y.location_name??se.location,interactionId:ne??Y.interaction_id,moreDetails:V,canShowEditButton:Vt,onEditInteraction:wt}),e.jsx(at,{outcomeLift:qe,driverLabels:Nt})]})]})]}),e.jsx("div",{ref:ke,style:{paddingTop:24},children:e.jsx(lt,{data:l?null:$t,loading:l})}),e.jsxs("div",{ref:ce,style:{display:"flex",flexDirection:"column",gap:16,alignSelf:"stretch",paddingTop:24},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(p.FileSignal,{size:24,color:"#C98A5A",strokeWidth:2}),e.jsx("span",{style:{fontSize:16,fontWeight:600,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2,textTransform:"uppercase"},children:"Signals & Recording"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:24,alignSelf:"stretch",paddingTop:16,borderTop:"1px solid #D9D9D9"},children:[e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(dt,{signals:Yt,expandedSignals:It,toggleSignal:Tt,playEvidence:Ye,highlightTurns:Rt,onShowInTranscript:$e,timelinePlaying:y||Le,currentTimeSeconds:u??Oe})}),e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(ot.UpdatedInteractionRecording,{ref:ie,audioUrl:a,durationSeconds:Ke.duration_seconds,audioRef:g,agentName:ze,customerName:he,currentTimeSeconds:u,timelinePlaying:y,playbackRate:W,timelineSegments:j,onSeek:I,onTogglePlay:s,onSeekBack:b,onSeekForward:k,onSetPlaybackRate:C,transcript:E,activeTurnIndex:A,turnObservations:T,highlightedTurns:O,onTurnPlayPause:x,setExpandedSignals:_e})})]})]}),e.jsx("div",{ref:Ce,style:{paddingTop:24},children:e.jsx(ut,{comments:Te,totalComments:Te.length,currentUser:B,onSendComment:vt||(()=>{}),onSendReply:jt||(()=>{}),onReply:bt||(()=>{}),onEdit:St||(()=>{}),onDelete:kt||(()=>{}),onMenuClick:Ct||(()=>{}),onMarkResolved:Ft||(()=>{}),isResolved:Wt,children:e.jsx(xt,{items:Ve,guidanceCount:Ve.length,onPlayEvidence:Ye,onShowInTranscript:$e,timelinePlaying:y||Le,currentTimeSeconds:u??Oe})})})]}),e.jsx(Jt.SideDrawer,{open:Dt,onClose:()=>ye(!1),title:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[e.jsx("div",{style:{width:34,height:34,borderRadius:"50%",background:"var(--surface-hover, #F3F7F7)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(p.CircleUser,{size:20,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.7})}),e.jsx("div",{style:{minWidth:0},children:e.jsx("div",{style:{fontSize:16,fontWeight:600,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:he})})]}),subtitle:Ie?e.jsxs("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:1.5},children:[Ge," Interactions"]}):null,width:470,height:"100vh",topOffset:70,footer:Ie?e.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:e.jsxs("button",{onClick:()=>{Ee&&Ee(),ye(!1)},style:{display:"flex",height:40,padding:"0 20px 0 18px",justifyContent:"center",alignItems:"center",gap:7,background:"var(--Grey-White, #FFF)",border:"1px solid var(--Grey-absent, #D9D9D9)",borderRadius:10,cursor:"pointer"},children:[e.jsx(p.History,{size:18,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:15,fontWeight:600,color:"var(--Grey-Strong, #2E3236)"},children:"View All Interactions"})]})}):null,children:e.jsx("div",{style:{borderTop:"1px solid var(--Grey-absent, #D9D9D9)",maxHeight:"100%",overflowY:"auto"},children:Ie?We.map((c,z)=>{const v=!!c.isCurrent,w=!v&&zt===z,G=vn(c,De.interaction_direction),K=G==="outbound"?p.PhoneOutgoing:p.PhoneIncoming;return e.jsxs("div",{onClick:v?void 0:()=>{Me&&Me(c),ye(!1)},onMouseEnter:v?void 0:()=>Ae(z),onMouseLeave:v?void 0:()=>Ae(null),"aria-current":v?"page":void 0,style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,padding:"16px 12px",borderTop:z===0?"none":"1px solid var(--Grey-absent, #D9D9D9)",background:v?"#E3E1D7":w?"var(--surface-hover, #F3F7F7)":"var(--Grey-White, #FFF)",cursor:v?"default":"pointer",transition:"background 0.15s"},children:[e.jsxs("div",{style:{minWidth:0},children:[e.jsxs("div",{style:{fontSize:v?15:14,display:"flex",alignItems:"center",gap:6,fontWeight:v?500:400,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[G&&e.jsx(K,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5,style:{flexShrink:0},"aria-hidden":!0}),e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",minWidth:0},children:c.title})]}),c.status&&e.jsxs("div",{style:{fontSize:13,color:"var(--Grey-Strong, #2E3236)",marginBottom:12,lineHeight:1.2},children:[e.jsx("span",{style:{fontWeight:400},children:"Location: "}),e.jsx("span",{style:{fontWeight:400,color:"var(--Grey-Muted, #808183)"},children:c.location})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,flexWrap:"wrap"},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:1.1},children:[e.jsx(p.CalendarDays,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.8}),c.date]}),(c.agent||c.agent_name)&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:1.1},children:[e.jsx(p.Headset,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.8}),c.agent||c.agent_name]})]})]}),!v&&w&&e.jsx(p.ExternalLink,{size:20,color:"var(--Grey-Muted, #808183)",strokeWidth:1.7,style:{flexShrink:0}})]},c.id||z)}):e.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:140,padding:"24px 12px",color:"var(--Grey-Muted, #808183)",fontSize:14,fontStyle:"italic",textAlign:"center"},children:"No other interactions available"})})})]})};exports.UpdatedInteractionRecording=ot.UpdatedInteractionRecording;exports.UpdatedCoachingSynthesisCard=lt;exports.UpdatedCompassScore=ct;exports.UpdatedGuidance=xt;exports.UpdatedInteractionContext=st;exports.UpdatedInteractionDetails=jn;exports.UpdatedInteractionScores=at;exports.UpdatedInteractionSignals=dt;exports.UpdatedThreads=ut;
17
17
  //# sourceMappingURL=UpdatedInteractionDetails.cjs.js.map