chordia-ui 3.6.6 → 3.6.7
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.
- package/dist/components/UpdatedInteractionDetails.cjs.js +4 -4
- package/dist/components/UpdatedInteractionDetails.cjs.js.map +1 -1
- package/dist/components/UpdatedInteractionDetails.es.js +722 -672
- package/dist/components/UpdatedInteractionDetails.es.js.map +1 -1
- package/dist/components/performance.cjs.js +2 -0
- package/dist/components/performance.cjs.js.map +1 -0
- package/dist/components/performance.es.js +718 -0
- package/dist/components/performance.es.js.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +40 -38
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
- package/src/components/UpdatedInteractionDetails/UpdatedInteractionContext.jsx +56 -19
- package/src/components/UpdatedInteractionDetails/UpdatedInteractionDetails.jsx +12 -0
- package/src/components/index.js +3 -0
- package/src/components/performance/PerformancePanel.jsx +773 -0
- package/src/components/performance/index.js +1 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("react"),p=require("lucide-react"),lt=require("../UpdatedInteractionRecording.cjs.js"),A={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)"},Qt={effective:"Effective",strong:"Strong",needs_improvement:"Needs Improvement",mixed:"Mixed"},Ue="updated-coaching-synthesis-keyframes";function Jt(){if(typeof document>"u"||document.getElementById(Ue))return;const t=document.createElement("style");t.id=Ue,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
|
|
10
|
+
`,document.head.appendChild(t)}function Xt({overall:t}){const i=Qt[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:A.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:A.strong,strokeWidth:1.5}),e.jsx("span",{style:{fontSize:13,fontWeight:600,color:A.strong,fontFamily:"var(--font-sans)",lineHeight:1.2},children:i})]})]})}function Ut({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:A.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:A.quoteLine}}),e.jsxs("div",{style:{fontSize:14,fontWeight:400,color:A.quoteText,fontFamily:"var(--font-sans)",lineHeight:1.5},children:["“",n,"”"]})]})]})}function et({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:A.iconBg,flexShrink:0},children:t}),e.jsx("span",{style:{fontSize:16,fontWeight:600,color:A.strong,fontFamily:"var(--font-sans)",lineHeight:"normal"},children:i})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:24},children:n.map((l,s)=>e.jsx(Ut,{item:l},s))})]})}const at=({data:t,loading:i,error:n})=>{var g,x;if(d.useEffect(()=>{Jt()},[]),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||[],s=t.improvements||[],o=typeof t.one_liner=="string"?t.one_liner:((p=t.one_liner)==null?void 0:p.text)||"",h=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(x.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"})]}),o&&e.jsx("div",{style:{fontSize:14,fontWeight:500,color:_.strong,fontFamily:"var(--font-sans)",lineHeight:1.5},children:o}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:16,justifyContent:"space-between"},children:[h&&e.jsx("div",{style:{fontSize:14,fontWeight:400,color:_.muted,fontFamily:"var(--font-sans)",lineHeight:1.5,flex:1},children:h}),t.overall&&e.jsx(Vt,{overall:t.overall})]}),(l.length>0||s.length>0)&&e.jsxs("div",{style:{display:"flex",gap:24,paddingTop:24,borderTop:`1px solid ${_.absent}`},children:[e.jsx(Xe,{icon:e.jsx(x.TrendingUp,{size:14,color:_.strong,strokeWidth:1.5}),label:"Key Strengths",items:l}),e.jsx(Xe,{icon:e.jsx(x.Lightbulb,{size:14,color:_.strong,strokeWidth:1.5}),label:"Improvements",items:s})]})]})};function Qt(t){const i=Math.floor(t/60),n=Math.round(t%60);return`${i}:${n.toString().padStart(2,"0")}`}const Jt={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},at=({meta:t={},callPurpose:i={},classification:n={},dimensions:l=[],outcomeQuality:s="Neutral",onMoreDetails:o,moreDetails:h=[],resolutionOutcome:p,customerIntent:y})=>{const[S,v]=c.useState(!1),w=c.useRef(null),a=t.duration_seconds!=null?Qt(t.duration_seconds):null,j=t.message_count,k=i.interaction_driver,C=n.interaction_paradigm,I=f=>l.find($=>($.key||"").toLowerCase().includes(f)),T=I("resolution_outcome"),b=I("customer_intent"),D=I("outcome_quality"),z=f=>f?f.replace(/_/g," ").replace(/\b\w/g,$=>$.toUpperCase()):null,L=s!=="Neutral"?s:D?z(D.value):s,R=p??(T?z(T.value):null),B=y??(b?z(b.value):null),m=new Set(["resolution_outcome","customer_intent","outcome_quality"].map(f=>`dim.${f}`)),g=l.filter(f=>!m.has(f.key)),d=[],H=[[a!=null?{label:"Duration",value:a}:null,j!=null?{label:"Messages",value:j}:null],[k!=null?{label:"Driver",value:k}:null,C!=null?{label:"Paradigm",value:C}:null]];for(let f=0;f<g.length;f+=2){const $=g[f]?{label:g[f].display_name||g[f].label||g[f].key,value:z(g[f].value)}:null,Z=g[f+1]?{label:g[f+1].display_name||g[f+1].label||g[f+1].key,value:z(g[f+1].value)}:null;H.push([$,Z])}H.push([{label:"Outcome Quality",value:L},{isMoreDetails:!0}]),H.forEach(f=>d.push(f));const U=[R!=null&&{label:"Resolution Outcome",value:R},B!=null&&{label:"Customer Intent",value:B},...h||[]].filter(Boolean);c.useEffect(()=>{if(!S)return;const f=$=>{w.current&&!w.current.contains($.target)&&v(!1)};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[S]);const q=f=>e.jsxs("div",{style:Jt,children:[e.jsx("span",{style:{color:"var(--Grey-Strong, #2E3236)",whiteSpace:"nowrap",flexShrink:0},children:f.label}),e.jsx("span",{style:{color:"var(--Grey-Muted, #808183)",textAlign:"right",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:f.value})]},f.label),V=()=>e.jsxs("div",{onClick:()=>{v(f=>!f),o&&!S&&o()},style:{display:"flex",alignItems:"center",gap:6,padding:"8px 8px 12px 8px",cursor:"pointer",fontFamily:"var(--font-sans)",borderBottom:"1px solid var(--Grey-absent, #D9D9D9)"},children:[e.jsx("span",{style:{color:"var(--Grey-Strong, #2E3236)",fontSize:13,fontWeight:500,lineHeight:"normal"},children:"More Details"}),S?e.jsx(x.ChevronUp,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}):e.jsx(x.ChevronDown,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5})]},"more-details");return e.jsxs("div",{ref:w,style:{display:"flex",flexDirection:"column",alignSelf:"stretch",gap:0,position:"relative",overflow:"visible"},children:[d.map((f,$)=>{var Z;return e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:24,alignSelf:"stretch"},children:[e.jsx("div",{style:et,children:f[0]&&!f[0].isMoreDetails?q(f[0]):e.jsx("div",{style:{flex:1}})}),e.jsx("div",{style:et,children:f[1]&&!f[1].isMoreDetails?q(f[1]):(Z=f[1])!=null&&Z.isMoreDetails?V():e.jsx("div",{style:{flex:1}})})]},$)}),S&&U.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"}),U.map(f=>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:f.label}),e.jsx("span",{style:{color:"var(--Grey-Muted, #808183)",fontSize:13,fontStyle:"normal",fontWeight:400,lineHeight:"120%",textAlign:"right"},children:f.value})]},f.label))]})]})},W={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))"},A=1.2,tt=3,nt=t=>t!=null?Math.round(t*100)+"%":"—",it=t=>{if(t==null)return"—";const i=(t*100).toFixed(1);return t>0?`+${i}pp`:`${i}pp`},dt=({outcomeLift:t,driverLabels:i=[]})=>{var a;if(!t||t.lift==null)return null;const n=t.p_expected,l=t.p_full,s=t.lift_raw??(l!=null&&n!=null?l-n:null),o=t.lift,h=(a=t.interpretation)!=null&&a.lift_band?t.interpretation.lift_band.replace(/_/g," "):o>=0?"Positive":"Negative",p=h.charAt(0).toUpperCase()+h.slice(1),S=/negative/i.test(h)?x.ThumbsDown:x.ThumbsUp,v=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 ${W.absent}`,background:W.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:W.strong,fontFamily:"var(--font-sans)",lineHeight:A},children:"Agent Lift Analysis"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontFamily:"var(--font-sans)"},children:[e.jsx("span",{style:{fontSize:13,fontWeight:400,color:W.strong,lineHeight:A},children:"vs. Average Agent:"}),e.jsx("span",{style:{fontSize:14,fontWeight:600,color:W.strong,lineHeight:A},children:it(o)}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,paddingLeft:8,borderLeft:`1px solid ${W.absent}`},children:[e.jsx(S,{size:14,color:W.strong}),e.jsx("span",{style:{fontSize:13,fontWeight:600,color:W.strong,lineHeight:A},children:p})]})]})]}),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:W.muted,fontFamily:"var(--font-sans)",lineHeight:A},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:W.strong,fontFamily:"var(--font-sans)",lineHeight:A,whiteSpace:"nowrap"},children:"Expected Outcome"}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:W.muted,fontFamily:"var(--font-sans)",lineHeight:A,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 ${W.absent}`,flex:1,minWidth:0},children:[e.jsx("span",{style:{fontSize:28,fontWeight:400,color:W.muted,fontFamily:"var(--font-sans)",lineHeight:A},children:it(s)}),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:W.strong,fontFamily:"var(--font-sans)",lineHeight:A,whiteSpace:"nowrap"},children:"Agent Impact"}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:W.muted,fontFamily:"var(--font-sans)",lineHeight:A,textAlign:"left"},children:"Behavior-driven change"})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,alignItems:"flex-start",paddingLeft:24,borderLeft:`1px solid ${W.absent}`,flex:1,minWidth:0},children:[e.jsx("span",{style:{fontSize:28,fontWeight:400,color:W.strong,fontFamily:"var(--font-sans)",lineHeight:A},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:W.strong,fontFamily:"var(--font-sans)",lineHeight:A,whiteSpace:"nowrap"},children:"Predicted Outcome"}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:W.muted,fontFamily:"var(--font-sans)",lineHeight:A,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:W.strong,fontFamily:"var(--font-sans)",lineHeight:A},children:"Key Drivers"}),e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[v.map((j,k)=>e.jsx("div",{style:{display:"flex",padding:8,alignItems:"center",justifyContent:"center",borderRadius:4,border:`1px solid ${W.absent}`,background:W.white},children:e.jsx("span",{style:{fontSize:12,fontWeight:400,color:W.strong,fontFamily:"var(--font-sans)",lineHeight:A,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:200},children:j})},k)),w>0&&e.jsx("div",{style:{display:"flex",padding:8,alignItems:"center",justifyContent:"center",borderRadius:4,border:`1px solid ${W.absent}`,background:W.white},children:e.jsxs("span",{style:{fontSize:12,fontWeight:400,color:W.strong,fontFamily:"var(--font-sans)",lineHeight:A,whiteSpace:"nowrap"},children:["+ ",w]})})]})]})]})},rt=({children:t,size:i=28,onClick:n,title:l})=>{const[s,o]=c.useState(!1);return e.jsx("div",{title:l,onClick:n,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),style:{display:"flex",alignItems:"center",justifyContent:"center",width:i,height:i,borderRadius:9999,background:s?"var(--surface-hover, #F3F7F7)":"transparent",cursor:"pointer",flexShrink:0,transition:"background 0.15s"},children:t})},ct=({signals:t={signals:[],present_count:0,total_signals_evaluated:0},expandedSignals:i=new Set,toggleSignal:n=()=>{},playEvidence:l=()=>{},highlightTurns:s=()=>{},onShowInTranscript:o=()=>{},timelinePlaying:h=!1,currentTimeSeconds:p=0})=>{const y=(t==null?void 0:t.signals)??[],S=(t==null?void 0:t.present_count)??y.length,v=a=>{const j=Math.floor(a/6e4),k=Math.floor(a%6e4/1e3);return`${j.toString().padStart(2,"0")}:${k.toString().padStart(2,"0")}`},w=a=>h&&a.start_ms!=null&&p*1e3>=a.start_ms&&p*1e3<=(a.end_ms??a.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(x.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:[S," 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((a,j)=>{var T,b,D;const k=a.key??a.id??j,C=i.has(k),I=((T=a.observations)==null?void 0:T.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:[a.display_name||((b=a.key)==null?void 0:b.replace(/_/g," ")),I>0&&e.jsxs("span",{style:{fontWeight:600,color:"var(--text-dark, #0B0A0A)",marginLeft:6},children:["(",I,")"]})]}),C?e.jsx(x.ChevronUp,{size:20,color:"#767473"}):e.jsx(x.ChevronDown,{size:20,color:"#767473"})]}),C&&((D=a.observations)==null?void 0:D.length)>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",alignSelf:"stretch",gap:0},children:a.observations.map((z,L)=>{var R,B,m;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:z.reason||z.explanation}),((B=(R=z.evidence)==null?void 0:R[0])==null?void 0:B.start_ms)!=null&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.jsx(rt,{size:28,title:"Show in transcript",onClick:g=>{g.stopPropagation(),o(z.evidence[0].start_ms)},children:e.jsx(x.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:v(z.evidence[0].start_ms)})]})]}),(m=z.evidence)==null?void 0:m.map((g,d)=>{const H=g.start_ms!=null&&g.end_ms!=null;return g.text&&e.jsxs("div",{onClick:U=>{U.stopPropagation(),H&&l(g)},onMouseEnter:()=>s(g.turn_ids??[]),onMouseLeave:()=>s([]),style:{display:"flex",alignItems:"center",gap:8,padding:"8px 0",cursor:H?"pointer":"default"},children:[H&&e.jsx(rt,{size:28,children:w(g)?e.jsx(x.PauseCircle,{size:17,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}):e.jsx(x.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:["“",g.text,"”"]})]},d)})]},z.key??L)})})]},k)})]})]})},N={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)"},Xt=({score:t=4,minScore:i=0,maxScore:n=5})=>{const v=Number(t),w=Number.isFinite(v)?Math.min(Math.max(v,i),n):i,a=n>i?(w-i)/(n-i)*5:0,j=180/5,k=T=>{const b=T*Math.PI/180;return{x:121.5+85*Math.cos(b),y:123-85*Math.sin(b)}},C=(T,b)=>{const D=k(T),z=k(b),L=T-b>180?1:0;return`M ${D.x} ${D.y} A 85 85 0 ${L} 1 ${z.x} ${z.y}`},I=2;return e.jsx("svg",{width:"100%",viewBox:"0 0 243 130",fill:"none",style:{maxWidth:243},children:Array.from({length:5},(T,b)=>{const D=180-b*j-(b>0?I/2:0),z=180-(b+1)*j+(b<5-1?I/2:0),L=Math.max(0,Math.min(1,a-b)),R=C(D,z);return e.jsxs("g",{children:[e.jsx("path",{d:R,stroke:N.track,strokeWidth:30,strokeLinecap:"butt",fill:"none"}),L>0&&e.jsx("path",{d:R,stroke:N.strong,strokeWidth:30,strokeLinecap:"butt",fill:"none",pathLength:1,strokeDasharray:`${L} 1`})]},b)})})},en=({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},(s,o)=>{const h=Math.max(0,Math.min(1,l-o));return e.jsx("div",{style:{width:22,height:6,borderRadius:1,background:N.track,overflow:"hidden"},children:h>0&&e.jsx("div",{style:{width:`${h*100}%`,height:"100%",background:N.strong}})},o)})})},tn={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"},nn=({text:t,children:i})=>{const[n,l]=c.useState(!1),s=c.useRef(null),[o,h]=c.useState({top:0,left:0}),p=()=>{if(s.current){const y=s.current.getBoundingClientRect();h({top:y.top-8,left:y.left+y.width/2})}l(!0)};return e.jsxs("div",{ref:s,style:{position:"relative",display:"inline-flex"},onMouseEnter:p,onMouseLeave:()=>l(!1),children:[i,n&&e.jsx("div",{style:{position:"fixed",top:o.top,left:o.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})})]})},rn=({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:N.strong,fontFamily:"var(--font-sans)",lineHeight:"normal"},children:t}),e.jsx(nn,{text:tn[t]||t,children:e.jsx(x.Info,{size:14,color:N.infoIcon,strokeWidth:1,style:{cursor:"pointer"}})})]}),e.jsx(en,{value:i,maxValue:n})]}),ft=({score:t=4,minScore:i=0,maxScore:n=5,predictedScore:l=4,predictedLabel:s="Predicted Objective",description:o="",legends:h=[{label:"CSAT",value:3},{label:"Resolution",value:4},{label:"Process Adherence",value:5},{label:"Communication",value:3}]})=>{const p=Number(t),y=Number.isFinite(p)?Math.min(Math.max(p,i),n):i,S=y.toFixed(1);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",padding:24,borderRadius:8,border:`1px solid ${N.absent}`,background:N.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:N.strong,fontFamily:"var(--font-sans)",lineHeight:1.2},children:"Interaction Quality"}),e.jsx("span",{style:{fontSize:14,fontWeight:400,color:N.muted,fontFamily:"var(--font-sans)",lineHeight:"normal"},children:o})]}),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(Xt,{score:t,minScore:i,maxScore:n}),(()=>{const a=-(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(${a}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:N.strong,fontFamily:"var(--font-sans)",lineHeight:1,textAlign:"center",marginTop:8},children:S}),e.jsx("div",{style:{fontSize:15,fontWeight:500,color:N.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:N.strong,fontFamily:"var(--font-sans)",lineHeight:1.2,textAlign:"left"},children:"Interaction Quality Index"}),e.jsx("div",{style:{width:"100%",height:1,background:N.absent}}),h.map((v,w)=>e.jsx(rn,{label:v.label,value:v.value},w))]})]})]})},gt=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},sn=t=>{var l,s,o,h,p,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)??((s=t.user)==null?void 0:s.userRole)??((o=t.user)==null?void 0:o.user_role)??((h=t.profile)==null?void 0:h.role)??((p=t.profile)==null?void 0:p.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},ht=t=>{if(!t)return"#6B7C93";const i=sn(t);return gt(i)||t.color||"#6B7C93"},me=t=>(t||"").split(" ").map(i=>i[0]).join("").toUpperCase()||"U",on=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))},ln=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 s=new Date().getTime()-n.getTime(),o=Math.floor(s/6e4),h=Math.floor(s/36e5);if(o<1)return"Just now";if(o<60)return`${o} min`;if(h<24)return`${h} h`;const p=Math.floor(h/24);return p===1?"1 day":`${p} days`}catch{return t}},pt=({name:t,initials:i,color:n,avatar:l,size:s=36})=>l?e.jsx("img",{src:l,alt:t,style:{width:s,height:s,borderRadius:"50%",objectFit:"cover",flexShrink:0}}):e.jsx("div",{style:{width:s,height:s,borderRadius:"50%",background:n||"#6B7C93",color:"#FFF",display:"flex",alignItems:"center",justifyContent:"center",fontSize:s<=32?"10px":"11px",fontWeight:650,flexShrink:0,fontFamily:"var(--default-font-family)",letterSpacing:"0.02em"},title:t,children:i||me(t)}),an=({comment:t,isReply:i=!1,isConsecutive:n=!1,onReply:l,onSendReply:s,onEdit:o,onDelete:h,onMenuClick:p,showReply:y=!0})=>{var de,ce;const[S,v]=c.useState(!1),[w,a]=c.useState(!1),[j,k]=c.useState(!1),[C,I]=c.useState(""),[T,b]=c.useState(!1),[D,z]=c.useState(""),[L,R]=c.useState(!1),B=c.useRef(null),m=c.useRef(null),g=c.useRef(null),d=t.author||{},H=d.name||t.author_name||"Unknown",U=d.initials||me(H),q=d.role||t.author_role,V=d.color||gt(q)||"#6B7C93",f=d.avatar||t.avatar,$=t.timestamp||t.created_at,Z=ln($),Q=on($),ve=!!(t.isEdited||t.is_edited||t.edited),je=Array.isArray(t.content)?t.content:[t.content||t.text||""];return c.useEffect(()=>{if(!w)return;const r=O=>{B.current&&!B.current.contains(O.target)&&a(!1)};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[w]),c.useEffect(()=>{const r=m.current;if(!r)return;r.style.height="auto";const O=140;r.style.height=Math.min(r.scrollHeight,O)+"px",r.style.overflowY=r.scrollHeight>O?"auto":"hidden"},[C,j]),c.useEffect(()=>{const r=g.current;if(!r)return;r.style.height="auto";const O=140;r.style.height=Math.min(r.scrollHeight,O)+"px",r.style.overflowY=r.scrollHeight>O?"auto":"hidden"},[D,T]),e.jsxs("div",{onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!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(pt,{name:H,initials:U,color:V,avatar:f}),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:H}),e.jsx("span",{style:{fontSize:12,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:"150%",fontFamily:"var(--default-font-family)"},children:Z}),ve&&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:B,children:[e.jsx("button",{type:"button",onClick:()=>a(r=>!r),style:{padding:2,border:"none",background:"transparent",cursor:"pointer",borderRadius:4,display:"flex",alignItems:"center",justifyContent:"center",opacity:S||w?1:0,transition:"opacity 0.15s",flexShrink:0},children:e.jsx(x.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:()=>{a(!1),b(!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"}),o&&e.jsx("button",{type:"button",disabled:!Q,onClick:()=>{if(!Q)return;a(!1);const r=Array.isArray(t.content)?t.content.join(`
|
|
16
|
-
`):t.content||t.text||"";z(r),b(!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"}),h&&e.jsx("button",{type:"button",onClick:()=>{a(!1),R(!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"})]})]})]}),T?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:["“"," ",((de=t.author)==null?void 0:de.name)||"Unknown"]}),e.jsx("button",{type:"button",onClick:()=>b(!1),style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0},children:e.jsx(x.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:g,value:D,onChange:r=>z(r.target.value),onKeyDown:r=>{if(r.key==="Enter"){if(r.metaKey||r.ctrlKey||r.shiftKey)return;r.preventDefault(),D.trim()&&(o==null||o({...t,content:D.trim(),isEdited:!0}),b(!1))}r.key==="Escape"&&b(!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:()=>{D.trim()&&(o==null||o({...t,content:D.trim(),isEdited:!0}),b(!1))},disabled:!D.trim(),style:{display:"flex",padding:"6px 16px",justifyContent:"center",alignItems:"center",fontSize:13,fontWeight:600,color:D.trim()?"var(--Grey-White, #FFF)":"var(--Grey-Muted, #808183)",background:D.trim()?"var(--Grey-Strong, #2E3236)":"var(--grey-light, #e9e8e8a1)",border:"none",borderRadius:6,cursor:D.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:je.map((r,O)=>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"},children:r},O))}),L&&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:()=>{R(!1),h==null||h(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:()=>R(!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&&!j&&!L&&e.jsxs("button",{type:"button",onClick:()=>{b(!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(x.CornerDownRight,{size:20,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),"Reply"]}),j&&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:["“"," ",((ce=t.author)==null?void 0:ce.name)||"Unknown"]}),e.jsx("button",{type:"button",onClick:()=>{I(""),k(!1)},style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0},children:e.jsx(x.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:m,value:C,onChange:r=>I(r.target.value),onKeyDown:r=>{if(r.key==="Enter"){if(r.metaKey||r.ctrlKey||r.shiftKey)return;r.preventDefault(),C.trim()&&(s==null||s({content:C.trim(),parentId:t.id}),I(""),k(!1))}r.key==="Escape"&&(I(""),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()&&(s==null||s({content:C.trim(),parentId:t.id}),I(""),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"})]})]})]})]})},dn=({currentUser:t,onSubmit:i})=>{const[n,l]=c.useState(""),[s,o]=c.useState(!1),h=c.useRef(null);c.useEffect(()=>{const a=h.current;if(!a)return;a.style.height="auto";const j=140;a.style.height=Math.min(a.scrollHeight,j)+"px",a.style.overflowY=a.scrollHeight>j?"auto":"hidden"},[n]);const p=()=>{const a=n.trim();a&&(i==null||i(a),l(""))},y=a=>{if(a.key==="Enter"){if(a.metaKey||a.ctrlKey||a.shiftKey)return;a.preventDefault(),p()}},S=(t==null?void 0:t.initials)||me(t==null?void 0:t.name),v=ht(t),w=t==null?void 0:t.avatar;return e.jsxs("div",{style:{display:"flex",gap:16,alignItems:"flex-start"},children:[e.jsx(pt,{name:t==null?void 0:t.name,initials:S,color:v,avatar:w}),e.jsx("div",{style:{flex:1,padding:12,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:24,borderRadius:8,border:s?"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:h,value:n,onChange:a=>l(a.target.value),onFocus:()=>o(!0),onBlur:()=>o(!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:p,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"})]})})]})},ut=({comment:t,depth:i=0,isConsecutive:n=!1,onReply:l,onSendReply:s,onEdit:o,onDelete:h,onMenuClick:p})=>{const y=t.replies&&t.replies.length>0,S=!y;return e.jsxs(c.Fragment,{children:[e.jsx("div",{style:{paddingLeft:i>0?Math.min(i*32,128):0},children:e.jsx(an,{comment:t,isReply:i>0,isConsecutive:n,onReply:l,onSendReply:s,onEdit:o,onDelete:h,onMenuClick:p,showReply:S})}),y&&t.replies.map(v=>e.jsx(ut,{comment:v,depth:i+1,onReply:l,onSendReply:s,onEdit:o,onDelete:h,onMenuClick:p},v.id))]})},xt=({comments:t=[],totalComments:i,children:n,onSendComment:l,onReply:s,onSendReply:o,onEdit:h,onDelete:p,onMenuClick:y,onMarkResolved:S,currentUser:v,isResolved:w=!1})=>{const[a,j]=c.useState([]),[k,C]=c.useState(!1),I=c.useMemo(()=>{const m=new Set(t.map(d=>d.id)),g=a.filter(d=>!m.has(d.id));return[...t,...g]},[t,a]);c.useEffect(()=>{const m=new Set(t.map(g=>g.id));j(g=>g.filter(d=>!m.has(d.id)))},[t]);const T=c.useMemo(()=>{if(!v)return{name:"You",initials:"YO",color:"#6B7C93"};const m=v.name||"You",g=v.initials||me(m),d=ht(v);return{...v,name:m,initials:g,color:d}},[v]),b=async({content:m,parentId:g})=>{if(o){C(!0);try{await o({content:m,parentId:g})}finally{C(!1)}}else{const d={id:`temp-${Date.now()}`,author:T,content:m,timestamp:"Just now",parentId:g,isOptimistic:!0};j(H=>[...H,d])}},D=async m=>{if(l){C(!0);try{await l(m)}finally{C(!1)}}else{const g={id:`temp-${Date.now()}`,author:T,content:m,timestamp:"Just now",isOptimistic:!0};j(d=>[...d,g])}},z=m=>{j(g=>g.map(d=>d.id===m.id?{...d,content:m.content,isEdited:!0}:d)),h==null||h(m)},L=m=>{j(g=>g.filter(d=>d.id!==m.id)),p==null||p(m)},R=c.useMemo(()=>{const m={};I.forEach(d=>{d.parentId&&(m[d.parentId]||(m[d.parentId]=[]),m[d.parentId].push(d))});const g=d=>({...d,replies:(m[d.id]||[]).map(g)});return I.filter(d=>!d.parentId).map(g)},[I]),B=i??I.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(x.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(x.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:[B," Comment",B!==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(x.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"})]}):S?e.jsxs("button",{type:"button",onClick:S,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(x.CircleCheck,{size:16,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.5}),"Mark as Resolved"]}):null]}),I.length>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:0,marginBottom:24,maxHeight:600,overflowY:I.length>6?"auto":"visible"},children:R.map((m,g)=>{var V,f;const d=g>0?R[g-1]:null,H=((V=d==null?void 0:d.author)==null?void 0:V.name)||(d==null?void 0:d.author_name),U=((f=m.author)==null?void 0:f.name)||m.author_name,q=d&&H===U&&(!d.replies||d.replies.length===0);return e.jsx(ut,{comment:m,depth:0,isConsecutive:!!q,onReply:s,onSendReply:b,onEdit:z,onDelete:L,onMenuClick:y},m.id)})}),I.length>0&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:16,marginLeft:48},children:[e.jsx(x.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(dn,{currentUser:T,onSubmit:D})]}),e.jsx("div",{style:{flex:1,minWidth:0},children:n})]})]})},st=({children:t,size:i=28,onClick:n,title:l})=>{const[s,o]=c.useState(!1);return e.jsx("div",{title:l,onClick:n,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),style:{display:"flex",alignItems:"center",justifyContent:"center",width:i,height:i,borderRadius:9999,background:s?"var(--surface-hover, #F3F7F7)":"transparent",cursor:"pointer",flexShrink:0,transition:"background 0.15s"},children:t})},cn=t=>{const i=Math.floor(t/6e4),n=Math.floor(t%6e4/1e3);return`${i.toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}`},fn=({item:t,isLast:i,onPlayEvidence:n,onShowInTranscript:l,timelinePlaying:s,currentTimeSeconds:o})=>{var a;const h=(a=t.signal_refs)==null?void 0:a.map(j=>{const k=j.display_name||j.signal_key||"",C=j.confidence!=null?` (${Math.round(j.confidence*100)}%)`:"";return k+C}).join(", "),p=t.start_ms??t.startMs,y=t.end_ms??t.endMs,S=p!=null,v=(o??0)*1e3,w=s&&S&&v>=p&&v<=(y??p+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:[h&&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:h}),S&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.jsx(st,{size:28,title:w?"Pause":"Play evidence",onClick:()=>n==null?void 0:n({start_ms:p,end_ms:y}),children:w?e.jsx(x.PauseCircle,{size:17,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1}):e.jsx(x.PlayCircle,{size:17,color:"var(--Grey-Muted, #808183)",strokeWidth:1})}),e.jsx(st,{size:28,title:"Show in transcript",onClick:()=>l==null?void 0:l(p),children:e.jsx(x.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:cn(p)})]})]})]})},yt=({items:t=[],guidanceCount:i,loading:n=!1,onPlayEvidence:l,onShowInTranscript:s,timelinePlaying:o=!1,currentTimeSeconds:h=0})=>{const p=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(x.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:[p," Item",p!==1?"s":""]})]}),t.map((y,S)=>e.jsx(fn,{item:y,isLast:S===t.length-1,onPlayEvidence:l,onShowInTranscript:s,timelinePlaying:o,currentTimeSeconds:h},S))]})},ne=({text:t,children:i})=>{const[n,l]=c.useState(!1),s=c.useRef(null),[o,h]=c.useState({top:0,left:0});if(!t)return i;const p=()=>{if(s.current){const y=s.current.getBoundingClientRect();h({top:y.bottom+6,left:y.left+y.width/2})}l(!0)};return e.jsxs("div",{ref:s,style:{position:"relative",display:"inline-flex"},onMouseEnter:p,onMouseLeave:()=>l(!1),children:[i,n&&e.jsx("div",{style:{position:"fixed",top:o.top,left:o.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})})]})},gn=[{key:"overview",label:"Overview"},{key:"coaching",label:"Coaching Summary"},{key:"signals",label:"Signals & Recording"},{key:"comments",label:"Feedback"}],hn=({title:t="Wheel Stud Replacement Enquiry",onBack:i,data:n,coachingData:l,coachingLoading:s=!1,audioUrl:o,audioRef:h,currentTimeSeconds:p,timelinePlaying:y,playbackRate:S,timelineSegments:v,onSeek:w,onTogglePlay:a,onSeekBack:j,onSeekForward:k,onSetPlaybackRate:C,agentName:I,agentFullName:T,customerName:b,customerFullName:D,transcript:z,activeTurnIndex:L,turnObservations:R,highlightedTurns:B,onTurnPlayPause:m,onPlayEvidence:g,onHighlightTurns:d,callPurpose:H,classification:U,outcomeQuality:q,resolutionOutcome:V,customerIntent:f,interactionId:$,moreDetails:Z,compassScore:Q,compassMaxScore:ve=5,predictedCsat:je,predictedLabel:de="Predicted Objective",compassLegends:ce,customerSessions:r,customerSessionCount:O,onSessionClick:Ie,onViewAllSessions:De,prevSessionDesc:ze,prevSessionDisabled:J=!1,nextSessionDesc:Ge,nextSessionDisabled:X=!1,onPreviousSession:fe,onNextSession:ge,comments:Me=[],guidance:mt=[],currentUser:vt,onSendComment:jt,onSendReply:bt,onReply:St,onEdit:kt,onDelete:wt,onMenuClick:Ct,onMarkResolved:Ft,commentsResolved:Wt})=>{var Ze;const[be,he]=c.useState("overview"),[It,Ee]=c.useState(new Set),[Te,Se]=c.useState(!1),[Re,He]=c.useState(null),[_e,Ae]=c.useState(!1),[Le,Dt]=c.useState(0),[Be,zt]=c.useState(!1),ee=c.useRef(null),pe=c.useRef(null),ke=c.useRef(null),re=c.useRef(null),we=c.useRef(null),Gt={overview:pe,coaching:ke,signals:re,comments:we},se=c.useRef(null),Ce=c.useRef(!1);c.useEffect(()=>{const u=se.current;if(!u)return;const G=["overview","coaching","signals","comments"],M=[pe,ke,re,we],E=(P=>{let te=P.parentElement;for(;te;){const{overflow:ye,overflowY:ie}=window.getComputedStyle(te);if(/(auto|scroll)/.test(ye+ie))return te;te=te.parentElement}return null})(u),K=()=>{var ye;if(Ce.current)return;let P=G[0];for(let ie=M.length-1;ie>=0;ie--){const Qe=M[ie].current;if(!Qe)continue;if(Qe.getBoundingClientRect().top<=150){P=G[ie];break}}he(P);const te=((ye=pe.current)==null?void 0:ye.getBoundingClientRect().top)??Number.POSITIVE_INFINITY;zt(te<=150)};return u.addEventListener("scroll",K,{passive:!0}),E&&E!==u&&E.addEventListener("scroll",K,{passive:!0}),window.addEventListener("scroll",K,{passive:!0,capture:!0}),K(),()=>{u.removeEventListener("scroll",K),E&&E!==u&&E.removeEventListener("scroll",K),window.removeEventListener("scroll",K,{capture:!0})}},[]);const $e=c.useRef(null),Mt=u=>{var M;he(u),Ce.current=!0,$e.current=u;const G=(M=Gt[u])==null?void 0:M.current;if(G){const F=se.current;if(F&&F.scrollHeight>F.clientHeight){const E=F.getBoundingClientRect().top,P=G.getBoundingClientRect().top-E+F.scrollTop-16;F.scrollTo({top:P,behavior:"smooth"})}else{const E=G.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:E,behavior:"smooth"})}}setTimeout(()=>{Ce.current=!1,$e.current=null},1200)},Ne=r||[],Pe=u=>{he("signals");const G=re.current;if(G){const F=se.current;if(F&&F.scrollHeight>F.clientHeight){const E=F.getBoundingClientRect().top,P=G.getBoundingClientRect().top-E+F.scrollTop-16;F.scrollTo({top:P,behavior:"smooth"})}else{const E=G.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:E,behavior:"smooth"})}}const M=u/1e3;setTimeout(()=>{var F;(F=ee.current)!=null&&F.scrollToTranscript&&ee.current.scrollToTranscript(M)},220)},Oe=u=>{he("signals");const G=re.current;if(G){const F=se.current;if(F&&F.scrollHeight>F.clientHeight){const E=F.getBoundingClientRect().top,P=G.getBoundingClientRect().top-E+F.scrollTop-16;F.scrollTo({top:P,behavior:"smooth"})}else{const E=G.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:E,behavior:"smooth"})}}const M=(u==null?void 0:u.start_ms)??(u==null?void 0:u.startMs);setTimeout(()=>{var F,E;if(M!=null&&((F=ee.current)!=null&&F.scrollToTranscript)&&ee.current.scrollToTranscript(M/1e3),g)g(u);else if(M!=null&&((E=ee.current)!=null&&E.seekTo)){ee.current.seekTo(M/1e3),Ae(!0),Dt(M/1e3);const P=(u.end_ms??u.endMs??M+5e3)-M;setTimeout(()=>Ae(!1),P)}},220)},Et=u=>{d&&d(u)},Tt=u=>{Ee(G=>{const M=new Set(G);return M.has(u)?M.delete(u):M.add(u),M})},Rt=(n==null?void 0:n.blocks)||[],oe=u=>{var G;return((G=Rt.find(M=>M.block_id===u))==null?void 0:G.payload)||{}},Y=oe("interaction-metadata"),le=oe("interaction-context"),ue=oe("interaction-signals"),Ht=oe("interaction-outcome-lift"),_t=oe("interaction-dimensions").dimensions||[],At=le.call_purpose||{},Lt=le.classification||{},Ye=Y||{},Ke=H||At||{},Bt=U||Lt||{},Ue=Ht||{},$t=(Ue.driver_signal_keys||[]).map(u=>u.replace(/^sig\./,"").replace(/_/g," ")),Nt=l||null,Pt=(Ze=ue==null?void 0:ue.signals)!=null&&Ze.length?ue:{present_count:0,total_signals_evaluated:0,signals:[]},qe=mt||[],Fe=I||Y.agent_name||Y.agent||le.agent_name||"Agent",Ot=T||Y.agent_full_name||Y.agent_name||Fe,ae=b||Y.customer_name||Y.customer||le.customer_name||"Customer",Ve=D||Y.customer_full_name||Y.customer_name||ae,We=O??Ne.length,xe=Y.created_dt||(n==null?void 0:n.created_dt)||le.created_dt||"",Yt=xe?new Date(/Z$|[+-]\d{2}:\d{2}$/.test(xe)?xe:xe+"Z").toLocaleString():"",Kt=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(x.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}),(fe||ge)&&!Be&&e.jsxs("div",{style:{display:"flex",alignItems:"center",flexShrink:0},children:[e.jsx(ne,{text:ze,children:e.jsxs("button",{onClick:J?void 0:fe,disabled:J,style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",background:"none",border:"none",cursor:J?"default":"pointer",opacity:J?.4:1},children:[e.jsx(x.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 Session"})]})}),e.jsx("div",{style:{width:1,height:20,background:"var(--Grey-absent, #D9D9D9)",flexShrink:0}}),e.jsx(ne,{text:Ge,children:e.jsxs("button",{onClick:X?void 0:ge,disabled:X,style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",background:"none",border:"none",cursor:X?"default":"pointer",opacity:X?.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 Session"}),e.jsx(x.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:gn.map(u=>e.jsx("button",{onClick:()=>Mt(u.key),style:{display:"flex",padding:16,alignItems:"center",gap:10,background:"none",border:"none",borderBottom:be===u.key?"3px solid var(--Grey-Strong, #2E3236)":"3px solid transparent",cursor:"pointer",fontSize:15,fontWeight:be===u.key?500:400,color:be===u.key?"var(--Grey-Strong, #2E3236)":"var(--Grey-Muted, #808183)",whiteSpace:"nowrap",transition:"border-color 0.2s ease, color 0.2s ease"},children:u.label},u.key))}),(fe||ge)&&Be&&e.jsxs("div",{style:{display:"flex",alignItems:"center",flexShrink:0},children:[e.jsx(ne,{text:ze,children:e.jsxs("button",{onClick:J?void 0:fe,disabled:J,style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",background:"none",border:"none",cursor:J?"default":"pointer",opacity:J?.4:1},children:[e.jsx(x.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 Session"})]})}),e.jsx("div",{style:{width:1,height:20,background:"var(--Grey-absent, #D9D9D9)",flexShrink:0}}),e.jsx(ne,{text:Ge,children:e.jsxs("button",{onClick:X?void 0:ge,disabled:X,style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",background:"none",border:"none",cursor:X?"default":"pointer",opacity:X?.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 Session"}),e.jsx(x.ArrowRight,{size:16,color:"var(--Neutral-800, #323232)",strokeWidth:1.5})]})})]})]})}),e.jsxs("div",{ref:se,style:{padding:24,flex:1,overflowY:"auto"},children:[e.jsxs("div",{ref:pe,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(x.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(x.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:Yt})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"8px 0"},children:[e.jsx(x.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:Kt})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,paddingLeft:16,borderLeft:"1px solid var(--Grey-absent, #D9D9D9)"},children:[e.jsx(ne,{text:Ot,children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"8px 0",cursor:"pointer"},children:[e.jsx(x.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:Fe})]})}),e.jsx(x.Repeat,{size:16,color:"var(--color-input-border, #ACACAD)",strokeWidth:1.5}),We>1?e.jsxs("div",{style:{position:"relative"},children:[e.jsx(ne,{text:Ve,children:e.jsxs("button",{onClick:()=>Se(u=>!u),style:{display:"flex",alignItems:"center",gap:4,padding:"8px 0",background:"none",border:"none",cursor:"pointer"},children:[e.jsx(x.CircleUser,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),e.jsxs("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2},children:[ae," (",We," Sessions)"]}),Te?e.jsx(x.ChevronUp,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}):e.jsx(x.ChevronDown,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5})]})}),Te&&e.jsxs("div",{style:{position:"absolute",top:"100%",right:0,marginTop:4,width:264,background:"var(--Grey-White, #FFF)",borderRadius:4,border:"1px solid var(--Grey-absent, #D9D9D9)",boxShadow:"0 4px 16px rgba(0,0,0,0.12)",zIndex:50,overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8,padding:16},children:[e.jsx(x.CircleUser,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5,style:{marginTop:2,flexShrink:0}}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[e.jsx("span",{style:{fontSize:16,fontWeight:600,color:"var(--Grey-Strong, #2E3236)",lineHeight:1},children:ae}),e.jsxs("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:1},children:[We," Sessions in past"]})]})]}),Ne.slice(0,5).map((u,G)=>e.jsxs("div",{onClick:()=>{Ie&&Ie(u),Se(!1)},onMouseEnter:()=>He(G),onMouseLeave:()=>He(null),style:{display:"flex",width:264,padding:"12px 16px",justifyContent:"space-between",alignItems:"center",background:Re===G?"var(--surface-hover, #F3F7F7)":"var(--Grey-White, #FFF)",borderTop:"1px solid var(--Grey-absent, #D9D9D9)",cursor:"pointer",boxSizing:"border-box",transition:"background 0.15s"},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[e.jsx("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",lineHeight:1},children:u.title}),e.jsx("span",{style:{fontSize:12,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:1},children:u.date})]}),Re===G&&e.jsx(x.ExternalLink,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1,style:{flexShrink:0}})]},u.id||G)),e.jsx("div",{style:{padding:16,borderTop:"1px solid var(--Grey-absent, #D9D9D9)",display:"flex",justifyContent:"center"},children:e.jsxs("button",{onClick:()=>{De&&De(),Se(!1)},style:{display:"flex",height:32,padding:"16px 16px 16px 12px",justifyContent:"center",alignItems:"center",gap:6,background:"var(--Grey-White, #FFF)",border:"1px solid var(--Grey-absent, #D9D9D9)",borderRadius:10,cursor:"pointer"},children:[e.jsx(x.History,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:14,fontWeight:600,color:"var(--Grey-Strong, #2E3236)"},children:"View All Sessions"})]})})]})]}):e.jsx(ne,{text:Ve,children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"8px 0",cursor:"pointer"},children:[e.jsx(x.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:ae})]})})]})]})]}),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(ft,{score:Q??.5,minScore:0,maxScore:ve,predictedScore:je??.5,predictedLabel:de,legends:ce})}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch",justifyContent:"flex-end",gap:24,flex:1,minWidth:0},children:[e.jsx(at,{meta:Ye,callPurpose:Ke,classification:Bt,outcomeQuality:q||"Neutral",dimensions:_t,resolutionOutcome:V,customerIntent:f,interactionId:$??Y.interaction_id,moreDetails:Z}),e.jsx(dt,{outcomeLift:Ue,driverLabels:$t})]})]})]}),e.jsx("div",{ref:ke,style:{paddingTop:24},children:e.jsx(lt,{data:s?null:Nt,loading:s})}),e.jsxs("div",{ref:re,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(x.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(ct,{signals:Pt,expandedSignals:It,toggleSignal:Tt,playEvidence:Oe,highlightTurns:Et,onShowInTranscript:Pe,timelinePlaying:y||_e,currentTimeSeconds:p??Le})}),e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(ot.UpdatedInteractionRecording,{ref:ee,audioUrl:o,durationSeconds:Ye.duration_seconds,audioRef:h,agentName:Fe,customerName:ae,currentTimeSeconds:p,timelinePlaying:y,playbackRate:S,timelineSegments:v,onSeek:w,onTogglePlay:a,onSeekBack:j,onSeekForward:k,onSetPlaybackRate:C,transcript:z,activeTurnIndex:L,turnObservations:R,highlightedTurns:B,onTurnPlayPause:m,setExpandedSignals:Ee})})]})]}),e.jsx("div",{ref:we,style:{paddingTop:24},children:e.jsx(xt,{comments:Me,totalComments:Me.length,currentUser:vt,onSendComment:jt||(()=>{}),onSendReply:bt||(()=>{}),onReply:St||(()=>{}),onEdit:kt||(()=>{}),onDelete:wt||(()=>{}),onMenuClick:Ct||(()=>{}),onMarkResolved:Ft||(()=>{}),isResolved:Wt,children:e.jsx(yt,{items:qe,guidanceCount:qe.length,onPlayEvidence:Oe,onShowInTranscript:Pe,timelinePlaying:y||_e,currentTimeSeconds:p??Le})})})]})]})};exports.UpdatedInteractionRecording=ot.UpdatedInteractionRecording;exports.UpdatedCoachingSynthesisCard=lt;exports.UpdatedCompassScore=ft;exports.UpdatedGuidance=yt;exports.UpdatedInteractionContext=at;exports.UpdatedInteractionDetails=hn;exports.UpdatedInteractionScores=dt;exports.UpdatedInteractionSignals=ct;exports.UpdatedThreads=xt;
|
|
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:A.muted,fontWeight:500,textAlign:"center"},children:"Synthesizing coaching summary..."})]})]});if(n)return e.jsx("div",{style:{fontSize:14,color:A.muted},children:"Unable to generate coaching summary."});if(!t)return null;const l=t.strengths||[],s=t.improvements||[],o=typeof t.one_liner=="string"?t.one_liner:((g=t.one_liner)==null?void 0:g.text)||"",f=typeof t.context=="string"?t.context:((x=t.context)==null?void 0:x.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:A.accent,strokeWidth:2}),e.jsx("span",{style:{fontSize:16,fontWeight:600,color:A.strong,fontFamily:"var(--font-sans)",lineHeight:1.2,textTransform:"uppercase"},children:"Coaching Summary"})]}),o&&e.jsx("div",{style:{fontSize:14,fontWeight:500,color:A.strong,fontFamily:"var(--font-sans)",lineHeight:1.5},children:o}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:16,justifyContent:"space-between"},children:[f&&e.jsx("div",{style:{fontSize:14,fontWeight:400,color:A.muted,fontFamily:"var(--font-sans)",lineHeight:1.5,flex:1},children:f}),t.overall&&e.jsx(Xt,{overall:t.overall})]}),(l.length>0||s.length>0)&&e.jsxs("div",{style:{display:"flex",gap:24,paddingTop:24,borderTop:`1px solid ${A.absent}`},children:[e.jsx(et,{icon:e.jsx(p.TrendingUp,{size:14,color:A.strong,strokeWidth:1.5}),label:"Key Strengths",items:l}),e.jsx(et,{icon:e.jsx(p.Lightbulb,{size:14,color:A.strong,strokeWidth:1.5}),label:"Improvements",items:s})]})]})};function en(t){const i=Math.floor(t/60),n=Math.round(t%60);return`${i}:${n.toString().padStart(2,"0")}`}const tn={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)"},tt={display:"flex",flexDirection:"column",flex:"1 0 0",gap:0,minWidth:0},dt=({meta:t={},callPurpose:i={},classification:n={},dimensions:l=[],outcomeQuality:s="Neutral",onMoreDetails:o,moreDetails:f=[],resolutionOutcome:g,customerIntent:x,canShowEditButton:W=!1,onEditInteraction:v})=>{const[S,a]=d.useState(!1),j=d.useRef(null),k=t.duration_seconds!=null?en(t.duration_seconds):null,w=t.message_count,z=i.interaction_driver,T=n.interaction_paradigm,b=h=>l.find(_=>(_.key||"").toLowerCase().includes(h)),I=b("resolution_outcome"),M=b("customer_intent"),L=b("outcome_quality"),H=h=>h?h.replace(/_/g," ").replace(/\b\w/g,_=>_.toUpperCase()):null,P=s!=="Neutral"?s:L?H(L.value):s,m=g??(I?H(I.value):null),y=x??(M?H(M.value):null),c=new Set(["resolution_outcome","customer_intent","outcome_quality"].map(h=>`dim.${h}`)),D=l.filter(h=>!c.has(h.key)),V=[],Z=[[k!=null?{label:"Duration",value:k}:null,w!=null?{label:"Messages",value:w}:null],[z!=null?{label:"Driver",value:z}:null,T!=null?{label:"Paradigm",value:T}:null]];for(let h=0;h<D.length;h+=2){const _=D[h]?{label:D[h].display_name||D[h].label||D[h].key,value:H(D[h].value)}:null,X=D[h+1]?{label:D[h+1].display_name||D[h+1].label||D[h+1].key,value:H(D[h+1].value)}:null;Z.push([_,X])}Z.push([{label:"Outcome Quality",value:P},{isMoreDetails:!0}]),Z.forEach(h=>V.push(h));const Q=[m!=null&&{label:"Resolution Outcome",value:m},y!=null&&{label:"Customer Intent",value:y},...f||[]].filter(Boolean);d.useEffect(()=>{if(!S)return;const h=_=>{j.current&&!j.current.contains(_.target)&&a(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[S]);const J=h=>e.jsxs("div",{style:tn,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),re=()=>e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,padding:"8px 8px 12px 8px",fontFamily:"var(--font-sans)",borderBottom:"1px solid var(--Grey-absent, #D9D9D9)"},children:[e.jsxs("button",{onClick:()=>{a(h=>!h),o&&!S&&o()},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)"},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})]}),W&&e.jsxs("button",{onClick:v||(()=>{}),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:j,style:{display:"flex",flexDirection:"column",alignSelf:"stretch",gap:0,position:"relative",overflow:"visible"},children:[V.map((h,_)=>{var X;return e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:24,alignSelf:"stretch"},children:[e.jsx("div",{style:tt,children:h[0]&&!h[0].isMoreDetails?J(h[0]):e.jsx("div",{style:{flex:1}})}),e.jsx("div",{style:tt,children:h[1]&&!h[1].isMoreDetails?J(h[1]):(X=h[1])!=null&&X.isMoreDetails?re():e.jsx("div",{style:{flex:1}})})]},_)}),S&&Q.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"}),Q.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))]})]})},F={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,nt=3,it=t=>t!=null?Math.round(t*100)+"%":"—",rt=t=>{if(t==null)return"—";const i=(t*100).toFixed(1);return t>0?`+${i}pp`:`${i}pp`},ct=({outcomeLift:t,driverLabels:i=[]})=>{var a;if(!t||t.lift==null)return null;const n=t.p_expected,l=t.p_full,s=t.lift_raw??(l!=null&&n!=null?l-n:null),o=t.lift,f=(a=t.interpretation)!=null&&a.lift_band?t.interpretation.lift_band.replace(/_/g," "):o>=0?"Positive":"Negative",g=f.charAt(0).toUpperCase()+f.slice(1),W=/negative/i.test(f)?p.ThumbsDown:p.ThumbsUp,v=i.slice(0,nt),S=i.length-nt;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",padding:24,gap:24,borderRadius:8,border:`1px solid ${F.absent}`,background:F.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:F.strong,fontFamily:"var(--font-sans)",lineHeight:N},children:"Agent Lift Analysis"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontFamily:"var(--font-sans)"},children:[e.jsx("span",{style:{fontSize:13,fontWeight:400,color:F.strong,lineHeight:N},children:"vs. Average Agent:"}),e.jsx("span",{style:{fontSize:14,fontWeight:600,color:F.strong,lineHeight:N},children:rt(o)}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,paddingLeft:8,borderLeft:`1px solid ${F.absent}`},children:[e.jsx(W,{size:14,color:F.strong}),e.jsx("span",{style:{fontSize:13,fontWeight:600,color:F.strong,lineHeight:N},children:g})]})]})]}),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:F.muted,fontFamily:"var(--font-sans)",lineHeight:N},children:it(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:F.strong,fontFamily:"var(--font-sans)",lineHeight:N,whiteSpace:"nowrap"},children:"Expected Outcome"}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:F.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 ${F.absent}`,flex:1,minWidth:0},children:[e.jsx("span",{style:{fontSize:28,fontWeight:400,color:F.muted,fontFamily:"var(--font-sans)",lineHeight:N},children:rt(s)}),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:F.strong,fontFamily:"var(--font-sans)",lineHeight:N,whiteSpace:"nowrap"},children:"Agent Impact"}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:F.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 ${F.absent}`,flex:1,minWidth:0},children:[e.jsx("span",{style:{fontSize:28,fontWeight:400,color:F.strong,fontFamily:"var(--font-sans)",lineHeight:N},children:it(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:F.strong,fontFamily:"var(--font-sans)",lineHeight:N,whiteSpace:"nowrap"},children:"Predicted Outcome"}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:F.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:F.strong,fontFamily:"var(--font-sans)",lineHeight:N},children:"Key Drivers"}),e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[v.map((j,k)=>e.jsx("div",{style:{display:"flex",padding:8,alignItems:"center",justifyContent:"center",borderRadius:4,border:`1px solid ${F.absent}`,background:F.white},children:e.jsx("span",{style:{fontSize:12,fontWeight:400,color:F.strong,fontFamily:"var(--font-sans)",lineHeight:N,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:200},children:j})},k)),S>0&&e.jsx("div",{style:{display:"flex",padding:8,alignItems:"center",justifyContent:"center",borderRadius:4,border:`1px solid ${F.absent}`,background:F.white},children:e.jsxs("span",{style:{fontSize:12,fontWeight:400,color:F.strong,fontFamily:"var(--font-sans)",lineHeight:N,whiteSpace:"nowrap"},children:["+ ",S]})})]})]})]})},st=({children:t,size:i=28,onClick:n,title:l})=>{const[s,o]=d.useState(!1);return e.jsx("div",{title:l,onClick:n,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),style:{display:"flex",alignItems:"center",justifyContent:"center",width:i,height:i,borderRadius:9999,background:s?"var(--surface-hover, #F3F7F7)":"transparent",cursor:"pointer",flexShrink:0,transition:"background 0.15s"},children:t})},ft=({signals:t={signals:[],present_count:0,total_signals_evaluated:0},expandedSignals:i=new Set,toggleSignal:n=()=>{},playEvidence:l=()=>{},highlightTurns:s=()=>{},onShowInTranscript:o=()=>{},timelinePlaying:f=!1,currentTimeSeconds:g=0})=>{const x=(t==null?void 0:t.signals)??[],W=(t==null?void 0:t.present_count)??x.length,v=a=>{const j=Math.floor(a/6e4),k=Math.floor(a%6e4/1e3);return`${j.toString().padStart(2,"0")}:${k.toString().padStart(2,"0")}`},S=a=>f&&a.start_ms!=null&&g*1e3>=a.start_ms&&g*1e3<=(a.end_ms??a.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:[x.length===0&&e.jsx("div",{style:{padding:"8px 0",fontSize:14,color:"var(--Grey-Muted, #808183)"},children:"No signals detected."}),x.map((a,j)=>{var T,b,I;const k=a.key??a.id??j,w=i.has(k),z=((T=a.observations)==null?void 0:T.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:[a.display_name||((b=a.key)==null?void 0:b.replace(/_/g," ")),z>0&&e.jsxs("span",{style:{fontWeight:600,color:"var(--text-dark, #0B0A0A)",marginLeft:6},children:["(",z,")"]})]}),w?e.jsx(p.ChevronUp,{size:20,color:"#767473"}):e.jsx(p.ChevronDown,{size:20,color:"#767473"})]}),w&&((I=a.observations)==null?void 0:I.length)>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",alignSelf:"stretch",gap:0},children:a.observations.map((M,L)=>{var H,P,m;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}),((P=(H=M.evidence)==null?void 0:H[0])==null?void 0:P.start_ms)!=null&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.jsx(st,{size:28,title:"Show in transcript",onClick:y=>{y.stopPropagation(),o(M.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:v(M.evidence[0].start_ms)})]})]}),(m=M.evidence)==null?void 0:m.map((y,c)=>{const D=y.start_ms!=null&&y.end_ms!=null;return y.text&&e.jsxs("div",{onClick:V=>{V.stopPropagation(),D&&l(y)},onMouseEnter:()=>s(y.turn_ids??[]),onMouseLeave:()=>s([]),style:{display:"flex",alignItems:"center",gap:8,padding:"8px 0",cursor:D?"pointer":"default"},children:[D&&e.jsx(st,{size:28,children:S(y)?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:["“",y.text,"”"]})]},c)})]},M.key??L)})})]},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)"},nn=({score:t=4,minScore:i=0,maxScore:n=5})=>{const v=Number(t),S=Number.isFinite(v)?Math.min(Math.max(v,i),n):i,a=n>i?(S-i)/(n-i)*5:0,j=180/5,k=T=>{const b=T*Math.PI/180;return{x:121.5+85*Math.cos(b),y:123-85*Math.sin(b)}},w=(T,b)=>{const I=k(T),M=k(b),L=T-b>180?1:0;return`M ${I.x} ${I.y} A 85 85 0 ${L} 1 ${M.x} ${M.y}`},z=2;return e.jsx("svg",{width:"100%",viewBox:"0 0 243 130",fill:"none",style:{maxWidth:243},children:Array.from({length:5},(T,b)=>{const I=180-b*j-(b>0?z/2:0),M=180-(b+1)*j+(b<5-1?z/2:0),L=Math.max(0,Math.min(1,a-b)),H=w(I,M);return e.jsxs("g",{children:[e.jsx("path",{d:H,stroke:$.track,strokeWidth:30,strokeLinecap:"butt",fill:"none"}),L>0&&e.jsx("path",{d:H,stroke:$.strong,strokeWidth:30,strokeLinecap:"butt",fill:"none",pathLength:1,strokeDasharray:`${L} 1`})]},b)})})},rn=({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},(s,o)=>{const f=Math.max(0,Math.min(1,l-o));return e.jsx("div",{style:{width:22,height:6,borderRadius:1,background:$.track,overflow:"hidden"},children:f>0&&e.jsx("div",{style:{width:`${f*100}%`,height:"100%",background:$.strong}})},o)})})},sn={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"},on=({text:t,children:i})=>{const[n,l]=d.useState(!1),s=d.useRef(null),[o,f]=d.useState({top:0,left:0}),g=()=>{if(s.current){const x=s.current.getBoundingClientRect();f({top:x.top-8,left:x.left+x.width/2})}l(!0)};return e.jsxs("div",{ref:s,style:{position:"relative",display:"inline-flex"},onMouseEnter:g,onMouseLeave:()=>l(!1),children:[i,n&&e.jsx("div",{style:{position:"fixed",top:o.top,left:o.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})})]})},ln=({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(on,{text:sn[t]||t,children:e.jsx(p.Info,{size:14,color:$.infoIcon,strokeWidth:1,style:{cursor:"pointer"}})})]}),e.jsx(rn,{value:i,maxValue:n})]}),gt=({score:t=4,minScore:i=0,maxScore:n=5,predictedScore:l=4,predictedLabel:s="Predicted Objective",description:o="",legends:f=[{label:"CSAT",value:3},{label:"Resolution",value:4},{label:"Process Adherence",value:5},{label:"Communication",value:3}]})=>{const g=Number(t),x=Number.isFinite(g)?Math.min(Math.max(g,i),n):i,W=x.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:o})]}),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(nn,{score:t,minScore:i,maxScore:n}),(()=>{const a=-(180-(n>i?(x-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(${a}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}}),f.map((v,S)=>e.jsx(ln,{label:v.label,value:v.value},S))]})]})]})},ht=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},an=t=>{var l,s,o,f,g,x;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)??((s=t.user)==null?void 0:s.userRole)??((o=t.user)==null?void 0:o.user_role)??((f=t.profile)==null?void 0:f.role)??((g=t.profile)==null?void 0:g.userRole)??((x=t.profile)==null?void 0:x.user_role);return typeof n=="string"?n:Array.isArray(n)?n.join(" "):n&&typeof n=="object"&&(n.name||n.value||n.label)||null},pt=t=>{if(!t)return"#6B7C93";const i=an(t);return ht(i)||t.color||"#6B7C93"},je=t=>(t||"").split(" ").map(i=>i[0]).join("").toUpperCase()||"U",dn=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))},cn=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 s=new Date().getTime()-n.getTime(),o=Math.floor(s/6e4),f=Math.floor(s/36e5);if(o<1)return"Just now";if(o<60)return`${o} min`;if(f<24)return`${f} h`;const g=Math.floor(f/24);return g===1?"1 day":`${g} days`}catch{return t}},ut=({name:t,initials:i,color:n,avatar:l,size:s=36})=>l?e.jsx("img",{src:l,alt:t,style:{width:s,height:s,borderRadius:"50%",objectFit:"cover",flexShrink:0}}):e.jsx("div",{style:{width:s,height:s,borderRadius:"50%",background:n||"#6B7C93",color:"#FFF",display:"flex",alignItems:"center",justifyContent:"center",fontSize:s<=32?"10px":"11px",fontWeight:650,flexShrink:0,fontFamily:"var(--default-font-family)",letterSpacing:"0.02em"},title:t,children:i||je(t)}),fn=({comment:t,isReply:i=!1,isConsecutive:n=!1,onReply:l,onSendReply:s,onEdit:o,onDelete:f,onMenuClick:g,showReply:x=!0})=>{var fe,ge;const[W,v]=d.useState(!1),[S,a]=d.useState(!1),[j,k]=d.useState(!1),[w,z]=d.useState(""),[T,b]=d.useState(!1),[I,M]=d.useState(""),[L,H]=d.useState(!1),P=d.useRef(null),m=d.useRef(null),y=d.useRef(null),c=t.author||{},D=c.name||t.author_name||"Unknown",V=c.initials||je(D),Z=c.role||t.author_role,Q=c.color||ht(Z)||"#6B7C93",J=c.avatar||t.avatar,re=t.timestamp||t.created_at,h=cn(re),_=dn(re),X=!!(t.isEdited||t.is_edited||t.edited),be=Array.isArray(t.content)?t.content:[t.content||t.text||""];return d.useEffect(()=>{if(!S)return;const r=Y=>{P.current&&!P.current.contains(Y.target)&&a(!1)};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[S]),d.useEffect(()=>{const r=m.current;if(!r)return;r.style.height="auto";const Y=140;r.style.height=Math.min(r.scrollHeight,Y)+"px",r.style.overflowY=r.scrollHeight>Y?"auto":"hidden"},[w,j]),d.useEffect(()=>{const r=y.current;if(!r)return;r.style.height="auto";const Y=140;r.style.height=Math.min(r.scrollHeight,Y)+"px",r.style.overflowY=r.scrollHeight>Y?"auto":"hidden"},[I,T]),e.jsxs("div",{onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!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(ut,{name:D,initials:V,color:Q,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:D}),e.jsx("span",{style:{fontSize:12,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:"150%",fontFamily:"var(--default-font-family)"},children:h}),X&&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:P,children:[e.jsx("button",{type:"button",onClick:()=>a(r=>!r),style:{padding:2,border:"none",background:"transparent",cursor:"pointer",borderRadius:4,display:"flex",alignItems:"center",justifyContent:"center",opacity:W||S?1:0,transition:"opacity 0.15s",flexShrink:0},children:e.jsx(p.Ellipsis,{size:24,color:"var(--Grey-Muted, #808183)"})}),S&&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:()=>{a(!1),b(!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"}),o&&e.jsx("button",{type:"button",disabled:!_,onClick:()=>{if(!_)return;a(!1);const r=Array.isArray(t.content)?t.content.join(`
|
|
16
|
+
`):t.content||t.text||"";M(r),b(!0),k(!1)},style:{display:"flex",width:"100%",padding:"10px 16px",alignItems:"center",border:"none",background:"transparent",cursor:_?"pointer":"not-allowed",fontSize:13,fontWeight:400,color:_?"var(--Grey-Strong, #2E3236)":"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",lineHeight:"150%",textAlign:"left",opacity:_?1:.5},onMouseEnter:r=>{_&&(r.currentTarget.style.background="var(--surface-hover, #F3F7F7)")},onMouseLeave:r=>{r.currentTarget.style.background="transparent"},children:"Edit"}),f&&e.jsx("button",{type:"button",onClick:()=>{a(!1),H(!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"})]})]})]}),T?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:["“"," ",((fe=t.author)==null?void 0:fe.name)||"Unknown"]}),e.jsx("button",{type:"button",onClick:()=>b(!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:y,value:I,onChange:r=>M(r.target.value),onKeyDown:r=>{if(r.key==="Enter"){if(r.metaKey||r.ctrlKey||r.shiftKey)return;r.preventDefault(),I.trim()&&(o==null||o({...t,content:I.trim(),isEdited:!0}),b(!1))}r.key==="Escape"&&b(!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:()=>{I.trim()&&(o==null||o({...t,content:I.trim(),isEdited:!0}),b(!1))},disabled:!I.trim(),style:{display:"flex",padding:"6px 16px",justifyContent:"center",alignItems:"center",fontSize:13,fontWeight:600,color:I.trim()?"var(--Grey-White, #FFF)":"var(--Grey-Muted, #808183)",background:I.trim()?"var(--Grey-Strong, #2E3236)":"var(--grey-light, #e9e8e8a1)",border:"none",borderRadius:6,cursor:I.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:be.map((r,Y)=>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"},children:r},Y))}),L&&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:()=>{H(!1),f==null||f(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:()=>H(!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"})]}),x&&l&&!j&&!L&&e.jsxs("button",{type:"button",onClick:()=>{b(!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"]}),j&&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:["“"," ",((ge=t.author)==null?void 0:ge.name)||"Unknown"]}),e.jsx("button",{type:"button",onClick:()=>{z(""),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:m,value:w,onChange:r=>z(r.target.value),onKeyDown:r=>{if(r.key==="Enter"){if(r.metaKey||r.ctrlKey||r.shiftKey)return;r.preventDefault(),w.trim()&&(s==null||s({content:w.trim(),parentId:t.id}),z(""),k(!1))}r.key==="Escape"&&(z(""),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:()=>{w.trim()&&(s==null||s({content:w.trim(),parentId:t.id}),z(""),k(!1))},disabled:!w.trim(),style:{display:"flex",height:28,padding:"8px 12px",justifyContent:"center",alignItems:"center",gap:8,fontSize:13,fontWeight:600,color:w.trim()?"var(--Grey-White, #FFF)":"var(--Grey-Muted, #808183)",background:w.trim()?"var(--Neutral-850, #272727)":"var(--grey-light, #e9e8e8a1)",border:"none",borderRadius:10,cursor:w.trim()?"pointer":"not-allowed",fontFamily:"var(--default-font-family)",lineHeight:"150%"},children:"Post"})]})]})]})]})},gn=({currentUser:t,onSubmit:i})=>{const[n,l]=d.useState(""),[s,o]=d.useState(!1),f=d.useRef(null);d.useEffect(()=>{const a=f.current;if(!a)return;a.style.height="auto";const j=140;a.style.height=Math.min(a.scrollHeight,j)+"px",a.style.overflowY=a.scrollHeight>j?"auto":"hidden"},[n]);const g=()=>{const a=n.trim();a&&(i==null||i(a),l(""))},x=a=>{if(a.key==="Enter"){if(a.metaKey||a.ctrlKey||a.shiftKey)return;a.preventDefault(),g()}},W=(t==null?void 0:t.initials)||je(t==null?void 0:t.name),v=pt(t),S=t==null?void 0:t.avatar;return e.jsxs("div",{style:{display:"flex",gap:16,alignItems:"flex-start"},children:[e.jsx(ut,{name:t==null?void 0:t.name,initials:W,color:v,avatar:S}),e.jsx("div",{style:{flex:1,padding:12,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:24,borderRadius:8,border:s?"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:f,value:n,onChange:a=>l(a.target.value),onFocus:()=>o(!0),onBlur:()=>o(!1),onKeyDown:x,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:g,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"})]})})]})},xt=({comment:t,depth:i=0,isConsecutive:n=!1,onReply:l,onSendReply:s,onEdit:o,onDelete:f,onMenuClick:g})=>{const x=t.replies&&t.replies.length>0,W=!x;return e.jsxs(d.Fragment,{children:[e.jsx("div",{style:{paddingLeft:i>0?Math.min(i*32,128):0},children:e.jsx(fn,{comment:t,isReply:i>0,isConsecutive:n,onReply:l,onSendReply:s,onEdit:o,onDelete:f,onMenuClick:g,showReply:W})}),x&&t.replies.map(v=>e.jsx(xt,{comment:v,depth:i+1,onReply:l,onSendReply:s,onEdit:o,onDelete:f,onMenuClick:g},v.id))]})},yt=({comments:t=[],totalComments:i,children:n,onSendComment:l,onReply:s,onSendReply:o,onEdit:f,onDelete:g,onMenuClick:x,onMarkResolved:W,currentUser:v,isResolved:S=!1})=>{const[a,j]=d.useState([]),[k,w]=d.useState(!1),z=d.useMemo(()=>{const m=new Set(t.map(c=>c.id)),y=a.filter(c=>!m.has(c.id));return[...t,...y]},[t,a]);d.useEffect(()=>{const m=new Set(t.map(y=>y.id));j(y=>y.filter(c=>!m.has(c.id)))},[t]);const T=d.useMemo(()=>{if(!v)return{name:"You",initials:"YO",color:"#6B7C93"};const m=v.name||"You",y=v.initials||je(m),c=pt(v);return{...v,name:m,initials:y,color:c}},[v]),b=async({content:m,parentId:y})=>{if(o){w(!0);try{await o({content:m,parentId:y})}finally{w(!1)}}else{const c={id:`temp-${Date.now()}`,author:T,content:m,timestamp:"Just now",parentId:y,isOptimistic:!0};j(D=>[...D,c])}},I=async m=>{if(l){w(!0);try{await l(m)}finally{w(!1)}}else{const y={id:`temp-${Date.now()}`,author:T,content:m,timestamp:"Just now",isOptimistic:!0};j(c=>[...c,y])}},M=m=>{j(y=>y.map(c=>c.id===m.id?{...c,content:m.content,isEdited:!0}:c)),f==null||f(m)},L=m=>{j(y=>y.filter(c=>c.id!==m.id)),g==null||g(m)},H=d.useMemo(()=>{const m={};z.forEach(c=>{c.parentId&&(m[c.parentId]||(m[c.parentId]=[]),m[c.parentId].push(c))});const y=c=>({...c,replies:(m[c.id]||[]).map(y)});return z.filter(c=>!c.parentId).map(y)},[z]),P=i??z.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:[P," Comment",P!==1?"s":""]}),S?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]}),z.length>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:0,marginBottom:24,maxHeight:600,overflowY:z.length>6?"auto":"visible"},children:H.map((m,y)=>{var Q,J;const c=y>0?H[y-1]:null,D=((Q=c==null?void 0:c.author)==null?void 0:Q.name)||(c==null?void 0:c.author_name),V=((J=m.author)==null?void 0:J.name)||m.author_name,Z=c&&D===V&&(!c.replies||c.replies.length===0);return e.jsx(xt,{comment:m,depth:0,isConsecutive:!!Z,onReply:s,onSendReply:b,onEdit:M,onDelete:L,onMenuClick:x},m.id)})}),z.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(gn,{currentUser:T,onSubmit:I})]}),e.jsx("div",{style:{flex:1,minWidth:0},children:n})]})]})},ot=({children:t,size:i=28,onClick:n,title:l})=>{const[s,o]=d.useState(!1);return e.jsx("div",{title:l,onClick:n,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),style:{display:"flex",alignItems:"center",justifyContent:"center",width:i,height:i,borderRadius:9999,background:s?"var(--surface-hover, #F3F7F7)":"transparent",cursor:"pointer",flexShrink:0,transition:"background 0.15s"},children:t})},hn=t=>{const i=Math.floor(t/6e4),n=Math.floor(t%6e4/1e3);return`${i.toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}`},pn=({item:t,isLast:i,onPlayEvidence:n,onShowInTranscript:l,timelinePlaying:s,currentTimeSeconds:o})=>{var a;const f=(a=t.signal_refs)==null?void 0:a.map(j=>{const k=j.display_name||j.signal_key||"",w=j.confidence!=null?` (${Math.round(j.confidence*100)}%)`:"";return k+w}).join(", "),g=t.start_ms??t.startMs,x=t.end_ms??t.endMs,W=g!=null,v=(o??0)*1e3,S=s&&W&&v>=g&&v<=(x??g+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:[f&&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:f}),W&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.jsx(ot,{size:28,title:S?"Pause":"Play evidence",onClick:()=>n==null?void 0:n({start_ms:g,end_ms:x}),children:S?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(ot,{size:28,title:"Show in transcript",onClick:()=>l==null?void 0:l(g),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:hn(g)})]})]})]})},mt=({items:t=[],guidanceCount:i,loading:n=!1,onPlayEvidence:l,onShowInTranscript:s,timelinePlaying:o=!1,currentTimeSeconds:f=0})=>{const g=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:[g," Item",g!==1?"s":""]})]}),t.map((x,W)=>e.jsx(pn,{item:x,isLast:W===t.length-1,onPlayEvidence:l,onShowInTranscript:s,timelinePlaying:o,currentTimeSeconds:f},W))]})},ie=({text:t,children:i})=>{const[n,l]=d.useState(!1),s=d.useRef(null),[o,f]=d.useState({top:0,left:0});if(!t)return i;const g=()=>{if(s.current){const x=s.current.getBoundingClientRect();f({top:x.bottom+6,left:x.left+x.width/2})}l(!0)};return e.jsxs("div",{ref:s,style:{position:"relative",display:"inline-flex"},onMouseEnter:g,onMouseLeave:()=>l(!1),children:[i,n&&e.jsx("div",{style:{position:"fixed",top:o.top,left:o.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})})]})},un=[{key:"overview",label:"Overview"},{key:"coaching",label:"Coaching Summary"},{key:"signals",label:"Signals & Recording"},{key:"comments",label:"Feedback"}],xn=({title:t="Wheel Stud Replacement Enquiry",onBack:i,data:n,coachingData:l,coachingLoading:s=!1,audioUrl:o,audioRef:f,currentTimeSeconds:g,timelinePlaying:x,playbackRate:W,timelineSegments:v,onSeek:S,onTogglePlay:a,onSeekBack:j,onSeekForward:k,onSetPlaybackRate:w,agentName:z,agentFullName:T,customerName:b,customerFullName:I,transcript:M,activeTurnIndex:L,turnObservations:H,highlightedTurns:P,onTurnPlayPause:m,onPlayEvidence:y,onHighlightTurns:c,callPurpose:D,classification:V,outcomeQuality:Z,resolutionOutcome:Q,customerIntent:J,interactionId:re,moreDetails:h,compassScore:_,compassMaxScore:X=5,predictedCsat:be,predictedLabel:fe="Predicted Objective",compassLegends:ge,customerSessions:r,customerSessionCount:Y,onSessionClick:De,onViewAllSessions:ze,prevSessionDesc:Ge,prevSessionDisabled:U=!1,nextSessionDesc:Me,nextSessionDisabled:ee=!1,onPreviousSession:he,onNextSession:pe,comments:Ee=[],guidance:vt=[],currentUser:B,onSendComment:jt,onSendReply:bt,onReply:St,onEdit:kt,onEditInteraction:wt,onDelete:Ct,onMenuClick:Ft,onMarkResolved:Wt,commentsResolved:It})=>{var Je;const[Se,ue]=d.useState("overview"),[Dt,Re]=d.useState(new Set),[Te,ke]=d.useState(!1),[He,_e]=d.useState(null),[Ae,Le]=d.useState(!1),[Be,zt]=d.useState(0),[Ne,Gt]=d.useState(!1),te=d.useRef(null),xe=d.useRef(null),we=d.useRef(null),oe=d.useRef(null),Ce=d.useRef(null),Mt={overview:xe,coaching:we,signals:oe,comments:Ce},le=d.useRef(null),Fe=d.useRef(!1);d.useEffect(()=>{const u=le.current;if(!u)return;const G=["overview","coaching","signals","comments"],E=[xe,we,oe,Ce],R=(O=>{let ne=O.parentElement;for(;ne;){const{overflow:ve,overflowY:se}=window.getComputedStyle(ne);if(/(auto|scroll)/.test(ve+se))return ne;ne=ne.parentElement}return null})(u),q=()=>{var ve;if(Fe.current)return;let O=G[0];for(let se=E.length-1;se>=0;se--){const Xe=E[se].current;if(!Xe)continue;if(Xe.getBoundingClientRect().top<=150){O=G[se];break}}ue(O);const ne=((ve=xe.current)==null?void 0:ve.getBoundingClientRect().top)??Number.POSITIVE_INFINITY;Gt(ne<=150)};return u.addEventListener("scroll",q,{passive:!0}),R&&R!==u&&R.addEventListener("scroll",q,{passive:!0}),window.addEventListener("scroll",q,{passive:!0,capture:!0}),q(),()=>{u.removeEventListener("scroll",q),R&&R!==u&&R.removeEventListener("scroll",q),window.removeEventListener("scroll",q,{capture:!0})}},[]);const $e=d.useRef(null),Et=u=>{var E;ue(u),Fe.current=!0,$e.current=u;const G=(E=Mt[u])==null?void 0:E.current;if(G){const C=le.current;if(C&&C.scrollHeight>C.clientHeight){const R=C.getBoundingClientRect().top,O=G.getBoundingClientRect().top-R+C.scrollTop-16;C.scrollTo({top:O,behavior:"smooth"})}else{const R=G.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:R,behavior:"smooth"})}}setTimeout(()=>{Fe.current=!1,$e.current=null},1200)},Pe=r||[],Oe=u=>{ue("signals");const G=oe.current;if(G){const C=le.current;if(C&&C.scrollHeight>C.clientHeight){const R=C.getBoundingClientRect().top,O=G.getBoundingClientRect().top-R+C.scrollTop-16;C.scrollTo({top:O,behavior:"smooth"})}else{const R=G.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:R,behavior:"smooth"})}}const E=u/1e3;setTimeout(()=>{var C;(C=te.current)!=null&&C.scrollToTranscript&&te.current.scrollToTranscript(E)},220)},Ye=u=>{ue("signals");const G=oe.current;if(G){const C=le.current;if(C&&C.scrollHeight>C.clientHeight){const R=C.getBoundingClientRect().top,O=G.getBoundingClientRect().top-R+C.scrollTop-16;C.scrollTo({top:O,behavior:"smooth"})}else{const R=G.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:R,behavior:"smooth"})}}const E=(u==null?void 0:u.start_ms)??(u==null?void 0:u.startMs);setTimeout(()=>{var C,R;if(E!=null&&((C=te.current)!=null&&C.scrollToTranscript)&&te.current.scrollToTranscript(E/1e3),y)y(u);else if(E!=null&&((R=te.current)!=null&&R.seekTo)){te.current.seekTo(E/1e3),Le(!0),zt(E/1e3);const O=(u.end_ms??u.endMs??E+5e3)-E;setTimeout(()=>Le(!1),O)}},220)},Rt=u=>{c&&c(u)},Tt=u=>{Re(G=>{const E=new Set(G);return E.has(u)?E.delete(u):E.add(u),E})},Ht=(n==null?void 0:n.blocks)||[],ae=u=>{var G;return((G=Ht.find(E=>E.block_id===u))==null?void 0:G.payload)||{}},K=ae("interaction-metadata"),de=ae("interaction-context"),ye=ae("interaction-signals"),_t=ae("interaction-outcome-lift"),At=ae("interaction-dimensions").dimensions||[],Lt=de.call_purpose||{},Bt=de.classification||{},Ke=K||{},qe=D||Lt||{},Nt=V||Bt||{},Ve=_t||{},$t=(Ve.driver_signal_keys||[]).map(u=>u.replace(/^sig\./,"").replace(/_/g," ")),Pt=l||null,Ot=(Je=ye==null?void 0:ye.signals)!=null&&Je.length?ye:{present_count:0,total_signals_evaluated:0,signals:[]},Ze=vt||[],We=z||K.agent_name||K.agent||de.agent_name||"Agent",Yt=T||K.agent_full_name||K.agent_name||We,ce=b||K.customer_name||K.customer||de.customer_name||"Customer",Qe=I||K.customer_full_name||K.customer_name||ce,Kt=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(),qt=/(admin|superadmin|administrator)/.test(Kt),Ie=Y??Pe.length,me=K.created_dt||(n==null?void 0:n.created_dt)||de.created_dt||"",Vt=me?new Date(/Z$|[+-]\d{2}:\d{2}$/.test(me)?me:me+"Z").toLocaleString():"",Zt=qe.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}),(he||pe)&&!Ne&&e.jsxs("div",{style:{display:"flex",alignItems:"center",flexShrink:0},children:[e.jsx(ie,{text:Ge,children:e.jsxs("button",{onClick:U?void 0:he,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 Session"})]})}),e.jsx("div",{style:{width:1,height:20,background:"var(--Grey-absent, #D9D9D9)",flexShrink:0}}),e.jsx(ie,{text:Me,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("span",{style:{color:"var(--Neutral-800, #323232)",fontSize:13,fontWeight:400,lineHeight:"24px",fontFamily:"var(--default-font-family)",whiteSpace:"nowrap"},children:"Next Session"}),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:un.map(u=>e.jsx("button",{onClick:()=>Et(u.key),style:{display:"flex",padding:16,alignItems:"center",gap:10,background:"none",border:"none",borderBottom:Se===u.key?"3px solid var(--Grey-Strong, #2E3236)":"3px solid transparent",cursor:"pointer",fontSize:15,fontWeight:Se===u.key?500:400,color:Se===u.key?"var(--Grey-Strong, #2E3236)":"var(--Grey-Muted, #808183)",whiteSpace:"nowrap",transition:"border-color 0.2s ease, color 0.2s ease"},children:u.label},u.key))}),(he||pe)&&Ne&&e.jsxs("div",{style:{display:"flex",alignItems:"center",flexShrink:0},children:[e.jsx(ie,{text:Ge,children:e.jsxs("button",{onClick:U?void 0:he,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 Session"})]})}),e.jsx("div",{style:{width:1,height:20,background:"var(--Grey-absent, #D9D9D9)",flexShrink:0}}),e.jsx(ie,{text:Me,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("span",{style:{color:"var(--Neutral-800, #323232)",fontSize:13,fontWeight:400,lineHeight:"24px",fontFamily:"var(--default-font-family)",whiteSpace:"nowrap"},children:"Next Session"}),e.jsx(p.ArrowRight,{size:16,color:"var(--Neutral-800, #323232)",strokeWidth:1.5})]})})]})]})}),e.jsxs("div",{ref:le,style:{padding:24,flex:1,overflowY:"auto"},children:[e.jsxs("div",{ref:xe,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:Vt})]}),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:Zt})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,paddingLeft:16,borderLeft:"1px solid var(--Grey-absent, #D9D9D9)"},children:[e.jsx(ie,{text:Yt,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:We})]})}),e.jsx(p.Repeat,{size:16,color:"var(--color-input-border, #ACACAD)",strokeWidth:1.5}),Ie>1?e.jsxs("div",{style:{position:"relative"},children:[e.jsx(ie,{text:Qe,children:e.jsxs("button",{onClick:()=>ke(u=>!u),style:{display:"flex",alignItems:"center",gap:4,padding:"8px 0",background:"none",border:"none",cursor:"pointer"},children:[e.jsx(p.CircleUser,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),e.jsxs("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2},children:[ce," (",Ie," Sessions)"]}),Te?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})]})}),Te&&e.jsxs("div",{style:{position:"absolute",top:"100%",right:0,marginTop:4,width:264,background:"var(--Grey-White, #FFF)",borderRadius:4,border:"1px solid var(--Grey-absent, #D9D9D9)",boxShadow:"0 4px 16px rgba(0,0,0,0.12)",zIndex:50,overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8,padding:16},children:[e.jsx(p.CircleUser,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5,style:{marginTop:2,flexShrink:0}}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[e.jsx("span",{style:{fontSize:16,fontWeight:600,color:"var(--Grey-Strong, #2E3236)",lineHeight:1},children:ce}),e.jsxs("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:1},children:[Ie," Sessions in past"]})]})]}),Pe.slice(0,5).map((u,G)=>e.jsxs("div",{onClick:()=>{De&&De(u),ke(!1)},onMouseEnter:()=>_e(G),onMouseLeave:()=>_e(null),style:{display:"flex",width:264,padding:"12px 16px",justifyContent:"space-between",alignItems:"center",background:He===G?"var(--surface-hover, #F3F7F7)":"var(--Grey-White, #FFF)",borderTop:"1px solid var(--Grey-absent, #D9D9D9)",cursor:"pointer",boxSizing:"border-box",transition:"background 0.15s"},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[e.jsx("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",lineHeight:1},children:u.title}),e.jsx("span",{style:{fontSize:12,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:1},children:u.date})]}),He===G&&e.jsx(p.ExternalLink,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1,style:{flexShrink:0}})]},u.id||G)),e.jsx("div",{style:{padding:16,borderTop:"1px solid var(--Grey-absent, #D9D9D9)",display:"flex",justifyContent:"center"},children:e.jsxs("button",{onClick:()=>{ze&&ze(),ke(!1)},style:{display:"flex",height:32,padding:"16px 16px 16px 12px",justifyContent:"center",alignItems:"center",gap:6,background:"var(--Grey-White, #FFF)",border:"1px solid var(--Grey-absent, #D9D9D9)",borderRadius:10,cursor:"pointer"},children:[e.jsx(p.History,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:14,fontWeight:600,color:"var(--Grey-Strong, #2E3236)"},children:"View All Sessions"})]})})]})]}):e.jsx(ie,{text:Qe,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:ce})]})})]})]})]}),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(gt,{score:_??.5,minScore:0,maxScore:X,predictedScore:be??.5,predictedLabel:fe,legends:ge})}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch",justifyContent:"flex-end",gap:24,flex:1,minWidth:0},children:[e.jsx(dt,{meta:Ke,callPurpose:qe,classification:Nt,outcomeQuality:Z||"Neutral",dimensions:At,resolutionOutcome:Q,customerIntent:J,interactionId:re??K.interaction_id,moreDetails:h,canShowEditButton:qt,onEditInteraction:wt}),e.jsx(ct,{outcomeLift:Ve,driverLabels:$t})]})]})]}),e.jsx("div",{ref:we,style:{paddingTop:24},children:e.jsx(at,{data:s?null:Pt,loading:s})}),e.jsxs("div",{ref:oe,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(ft,{signals:Ot,expandedSignals:Dt,toggleSignal:Tt,playEvidence:Ye,highlightTurns:Rt,onShowInTranscript:Oe,timelinePlaying:x||Ae,currentTimeSeconds:g??Be})}),e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(lt.UpdatedInteractionRecording,{ref:te,audioUrl:o,durationSeconds:Ke.duration_seconds,audioRef:f,agentName:We,customerName:ce,currentTimeSeconds:g,timelinePlaying:x,playbackRate:W,timelineSegments:v,onSeek:S,onTogglePlay:a,onSeekBack:j,onSeekForward:k,onSetPlaybackRate:w,transcript:M,activeTurnIndex:L,turnObservations:H,highlightedTurns:P,onTurnPlayPause:m,setExpandedSignals:Re})})]})]}),e.jsx("div",{ref:Ce,style:{paddingTop:24},children:e.jsx(yt,{comments:Ee,totalComments:Ee.length,currentUser:B,onSendComment:jt||(()=>{}),onSendReply:bt||(()=>{}),onReply:St||(()=>{}),onEdit:kt||(()=>{}),onDelete:Ct||(()=>{}),onMenuClick:Ft||(()=>{}),onMarkResolved:Wt||(()=>{}),isResolved:It,children:e.jsx(mt,{items:Ze,guidanceCount:Ze.length,onPlayEvidence:Ye,onShowInTranscript:Oe,timelinePlaying:x||Ae,currentTimeSeconds:g??Be})})})]})]})};exports.UpdatedInteractionRecording=lt.UpdatedInteractionRecording;exports.UpdatedCoachingSynthesisCard=at;exports.UpdatedCompassScore=gt;exports.UpdatedGuidance=mt;exports.UpdatedInteractionContext=dt;exports.UpdatedInteractionDetails=xn;exports.UpdatedInteractionScores=ct;exports.UpdatedInteractionSignals=ft;exports.UpdatedThreads=yt;
|
|
17
17
|
//# sourceMappingURL=UpdatedInteractionDetails.cjs.js.map
|