chordia-ui 4.0.0 → 4.0.2
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 +465 -461
- package/dist/components/UpdatedInteractionDetails.es.js.map +1 -1
- package/package.json +1 -1
- package/src/components/UpdatedInteractionDetails/UpdatedInteractionDetails.jsx +9 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("react"),ye=require("../useMediaQuery.cjs.js"),a=require("lucide-react"),_t=require("../UpdatedInteractionRecording.cjs.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("react"),ye=require("../useMediaQuery.cjs.js"),a=require("lucide-react"),_t=require("../UpdatedInteractionRecording.cjs.js"),Gn=require("../AgentLiftAnalysisCard.cjs.js"),Hn=require("../SideDrawer.cjs.js"),$={strong:"var(--Grey-Strong, #2E3236)",muted:"var(--Grey-Muted, #808183)",absent:"var(--Grey-absent, #D9D9D9)",accent:"var(--rail-orange, #C98A5A)",itemText:"var(--text-item, #3F3F3F)",quoteLine:"var(--border-warm, #B2AEA8)",quoteText:"var(--text-subtle-warm, #767473)",iconBg:"var(--surface-hover, #F3F7F7)"},Rn={effective:"Effective",strong:"Strong",needs_improvement:"Needs Improvement",mixed:"Mixed"},kt="updated-coaching-synthesis-keyframes";function _n(){if(typeof document>"u"||document.getElementById(kt))return;const t=document.createElement("style");t.id=kt,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 En({overall:t}){const n={size:14,color:$.strong,strokeWidth:1.5};switch(t){case"strong":case"effective":return e.jsx(a.ArrowUp,{...n});case"needs_improvement":return e.jsx(a.ArrowDown,{...n});case"mixed":return e.jsx(a.ArrowLeftRight,{...n});default:return e.jsx(a.ThumbsUp,{...n})}}function Tn({overall:t}){const n=Rn[t]||(t?t.replace(/_/g," "):"");return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.jsx("span",{style:{fontSize:13,fontWeight:400,color:$.strong,fontFamily:"var(--font-sans)",lineHeight:1.2},children:"Overall:"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx(En,{overall:t}),e.jsx("span",{style:{fontSize:13,fontWeight:600,color:$.strong,fontFamily:"var(--font-sans)",lineHeight:1.2},children:n})]})]})}function An(t){if(t==null)return null;const n=String(t).trim();return!n||n.toLowerCase()==="null"||n.toLowerCase()==="undefined"?null:n}function Ln({item:t}){const n=typeof t=="string"?t:(t==null?void 0:t.text)||"",i=An(typeof t=="object"?t==null?void 0:t.quote:null);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[e.jsx("div",{style:{fontSize:14,fontWeight:600,color:$.itemText,fontFamily:"var(--font-sans)",lineHeight:1.5},children:n}),i&&e.jsxs("div",{style:{display:"flex",gap:10},children:[e.jsx("div",{style:{width:1,flexShrink:0,alignSelf:"stretch",background:$.quoteLine}}),e.jsxs("div",{style:{fontSize:14,fontWeight:400,color:$.quoteText,fontFamily:"var(--font-sans)",lineHeight:1.5},children:["“",i,"”"]})]})]})}function Ct({icon:t,label:n,items:i}){return!i||i.length===0?null:e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:16,borderRadius:12},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:9999,background:$.iconBg,flexShrink:0},children:t}),e.jsx("span",{style:{fontSize:16,fontWeight:600,color:$.strong,fontFamily:"var(--font-sans)",lineHeight:"normal"},children:n})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:24},children:i.map((l,o)=>e.jsx(Ln,{item:l},o))})]})}const Et=({data:t,loading:n,error:i})=>{var p,b;u.useEffect(()=>{_n()},[]);const l=ye.useMediaQuery("(max-width: 900px)");if(n)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(i)return e.jsx("div",{style:{fontSize:14,color:$.muted},children:"Unable to generate coaching summary."});if(!t)return null;const o=t.strengths||[],r=t.improvements||[],d=typeof t.one_liner=="string"?t.one_liner:((p=t.one_liner)==null?void 0:p.text)||"",f=typeof t.context=="string"?t.context:((b=t.context)==null?void 0:b.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(a.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"})]}),d&&e.jsx("div",{style:{fontSize:14,fontWeight:500,color:$.strong,fontFamily:"var(--font-sans)",lineHeight:1.5},children:d}),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:$.muted,fontFamily:"var(--font-sans)",lineHeight:1.5,flex:1},children:f}),t.overall&&e.jsx(En,{overall:t.overall})]}),(o.length>0||r.length>0)&&e.jsxs("div",{style:{display:"flex",flexDirection:l?"column":"row",gap:24,paddingTop:24,borderTop:`1px solid ${$.absent}`},children:[e.jsx(kt,{icon:e.jsx(a.TrendingUp,{size:14,color:$.strong,strokeWidth:1.5}),label:"Key Strengths",items:o}),e.jsx(kt,{icon:e.jsx(a.Lightbulb,{size:14,color:$.strong,strokeWidth:1.5}),label:"Improvements",items:r})]})]})};function Ln(t){const n=Math.floor(t/60),i=Math.round(t%60);return`${n}:${i.toString().padStart(2,"0")}`}const Bn={display:"flex",justifyContent:"space-between",padding:"16px 8px 12px 8px",alignItems:"center",gap:24,fontFamily:"var(--font-sans)",fontSize:13,fontWeight:400,lineHeight:"normal",borderBottom:"1px solid var(--Grey-absent, #D9D9D9)"};function Nn({text:t,style:n}){const i=u.useRef(null),[l,o]=u.useState(!1);return u.useEffect(()=>{const r=i.current;if(!r)return;const d=()=>o(r.scrollWidth>r.clientWidth);if(d(),typeof ResizeObserver>"u")return;const f=new ResizeObserver(d);return f.observe(r),()=>f.disconnect()},[t]),e.jsx("span",{ref:i,title:l&&t!=null?String(t):void 0,style:n,children:t})}const Ct={display:"flex",flexDirection:"column",flex:"1 0 0",gap:0,minWidth:0},Et=({meta:t={},callPurpose:n={},classification:i={},dimensions:l=[],outcomeQuality:o="Neutral",onMoreDetails:r,moreDetails:d=[],resolutionOutcome:f,customerIntent:p,location:b,interactionId:S,canShowEditButton:G=!1,onEditInteraction:g,flatView:k=!1})=>{const[w,I]=u.useState(!1),W=u.useRef(null),A=ye.useMediaQuery("(max-width: 640px)"),C=t.duration_seconds!=null?Ln(t.duration_seconds):null,D=t.message_count,R=n.interaction_driver,O=i.interaction_paradigm,N=h=>l.find(T=>(T.key||"").toLowerCase().includes(h)),K=N("resolution_outcome"),U=N("customer_intent"),E=N("location"),y=N("outcome_quality"),m=h=>h?h.replace(/_/g," ").replace(/\b\w/g,T=>T.toUpperCase()):null,x=o!=="Neutral"?o:y?m(y.value):o,ee=f??(K?m(K.value):null),ie=p??(U?m(U.value):null),re=b??(E?m(E.value):null),te=O!=null?m(O):null,se=new Set(["resolution_outcome","customer_intent","location","outcome_quality"].map(h=>`dim.${h}`)),L=l.filter(h=>!se.has(h.key)),me=[],ce=[[C!=null?{label:"Duration",value:C}:null,D!=null?{label:"Messages",value:D}:null],[R!=null?{label:"Driver",value:R}:null,re!=null?{label:"Location",value:re}:null]];for(let h=0;h<L.length;h+=2){const T=L[h]?{label:L[h].display_name||L[h].label||L[h].key,value:m(L[h].value)}:null,pe=L[h+1]?{label:L[h+1].display_name||L[h+1].label||L[h+1].key,value:m(L[h+1].value)}:null;ce.push([T,pe])}ce.push([{label:"Outcome Quality",value:x},{isMoreDetails:!0}]),ce.forEach(h=>me.push(h));const fe=[ee!=null&&{label:"Resolution Outcome",value:ee},ie!=null&&{label:"Customer Intent",value:ie},te!=null&&{label:"Paradigm",value:te},...d||[]].filter(Boolean),ue=[];if(k){const h=[C!=null&&{label:"Duration",value:C},D!=null&&{label:"Messages",value:D},R!=null&&{label:"Driver",value:R},re!=null&&{label:"Location",value:re},{label:"Outcome Quality",value:x},te!=null&&{label:"Paradigm",value:te},ee!=null&&{label:"Resolution Outcome",value:ee},ie!=null&&{label:"Customer Intent",value:ie},...L.map(T=>({label:T.display_name||T.label||T.key,value:m(T.value)})),...d||[],S!=null&&S!==""&&{label:"Number",value:S}].filter(Boolean);for(let T=0;T<h.length;T+=2)ue.push([h[T],h[T+1]||null])}const c=k?ue:me;u.useEffect(()=>{if(!w)return;const h=T=>{W.current&&!W.current.contains(T.target)&&I(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[w]);const Q=h=>e.jsxs("div",{style:Bn,children:[e.jsx("span",{style:{color:"var(--Grey-Strong, #2E3236)",whiteSpace:"nowrap",flexShrink:0},children:h.label}),e.jsx(Nn,{text:h.value,style:{color:"var(--Grey-Muted, #808183)",textAlign:"right",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,flex:1}})]},h.label),Te=()=>e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,padding:"16px 8px 12px 8px",fontFamily:"var(--font-sans)",borderBottom:"none",minHeight:33},children:[e.jsxs("button",{onClick:()=>{I(h=>!h),r&&!w&&r()},style:{display:"flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",padding:0,color:"var(--Grey-Strong, #2E3236)",fontSize:13,fontWeight:500,lineHeight:"normal",fontFamily:"var(--font-sans)",whiteSpace:"nowrap",flexShrink:0},children:[e.jsx("span",{children:"More Details"}),w?e.jsx(a.ChevronUp,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}):e.jsx(a.ChevronDown,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5})]}),G&&e.jsxs("button",{onClick:g||(()=>{}),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(a.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:W,style:{display:"flex",flexDirection:"column",alignSelf:"stretch",gap:0,position:"relative",overflow:"visible"},children:[c.map((h,T)=>{var pe;return e.jsxs("div",{style:{display:"flex",flexDirection:A?"column":"row",alignItems:A?"stretch":"center",gap:A?8:24,alignSelf:"stretch",flexWrap:"nowrap"},children:[e.jsx("div",{style:Ct,children:h[0]&&!h[0].isMoreDetails?Q(h[0]):e.jsx("div",{style:{flex:1}})}),e.jsx("div",{style:Ct,children:h[1]&&!h[1].isMoreDetails?Q(h[1]):(pe=h[1])!=null&&pe.isMoreDetails?Te():e.jsx("div",{style:{flex:1}})})]},T)}),!k&&w&&fe.length>0&&e.jsxs("div",{style:{position:"absolute",top:"100%",right:0,marginTop:4,display:"flex",width:340,maxWidth:"calc(100vw - 32px)",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"}),fe.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))]})]})},Ft=({children:t,size:n=28,onClick:i,title:l})=>{const[o,r]=u.useState(!1);return e.jsx("div",{title:l,onClick:i,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),style:{display:"flex",alignItems:"center",justifyContent:"center",width:n,height:n,borderRadius:9999,background:o?"var(--surface-hover, #F3F7F7)":"transparent",cursor:"pointer",flexShrink:0,transition:"background 0.15s"},children:t})},Tt=({signals:t={signals:[],present_count:0,total_signals_evaluated:0},expandedSignals:n=new Set,toggleSignal:i=()=>{},playEvidence:l=()=>{},highlightTurns:o=()=>{},onShowInTranscript:r=()=>{},timelinePlaying:d=!1,currentTimeSeconds:f=0})=>{const p=(t==null?void 0:t.signals)??[],b=(t==null?void 0:t.present_count)??p.length,S=g=>{const k=Math.floor(g/6e4),w=Math.floor(g%6e4/1e3);return`${k.toString().padStart(2,"0")}:${w.toString().padStart(2,"0")}`},G=g=>d&&g.start_ms!=null&&f*1e3>=g.start_ms&&f*1e3<=(g.end_ms??g.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(a.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:16,fontWeight:500,color:"var(--Grey-Strong, #2E3236)",fontFamily:"var(--default-font-family)"},children:"Signals"}),e.jsxs("span",{style:{fontSize:14,fontWeight:500,color:"var(--Grey-Strong, #2E3236)",fontFamily:"var(--default-font-family)"},children:[b," Signals Detected"]})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignSelf:"stretch",background:"var(--Grey-White, #FFF)",gap:8},children:[p.length===0&&e.jsx("div",{style:{padding:"8px 0",fontSize:14,color:"var(--Grey-Muted, #808183)"},children:"No signals detected."}),p.map((g,k)=>{var A,C,D;const w=g.key??g.id??k,I=n.has(w),W=((A=g.observations)==null?void 0:A.length)??0;return e.jsxs("div",{id:`signal-${w}`,style:{display:"flex",flexDirection:"column",width:"100%",gap:8},children:[e.jsxs("button",{onClick:()=>i(w),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:[g.display_name||((C=g.key)==null?void 0:C.replace(/_/g," ")),W>0&&e.jsxs("span",{style:{fontWeight:600,color:"var(--text-dark, #0B0A0A)",marginLeft:6},children:["(",W,")"]})]}),I?e.jsx(a.ChevronUp,{size:20,color:"#767473"}):e.jsx(a.ChevronDown,{size:20,color:"#767473"})]}),I&&((D=g.observations)==null?void 0:D.length)>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",alignSelf:"stretch",gap:0},children:g.observations.map((R,O)=>{var N,K,U;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:R.reason||R.explanation}),((K=(N=R.evidence)==null?void 0:N[0])==null?void 0:K.start_ms)!=null&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.jsx(Ft,{size:28,title:"Show in transcript",onClick:E=>{E.stopPropagation(),r(R.evidence[0].start_ms)},children:e.jsx(a.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:S(R.evidence[0].start_ms)})]})]}),(U=R.evidence)==null?void 0:U.map((E,y)=>{const m=E.start_ms!=null&&E.end_ms!=null;return E.text&&e.jsxs("div",{onClick:x=>{x.stopPropagation(),m&&l(E)},onMouseEnter:()=>o(E.turn_ids??[]),onMouseLeave:()=>o([]),style:{display:"flex",alignItems:"center",gap:8,padding:"8px 0",cursor:m?"pointer":"default"},children:[m&&e.jsx(Ft,{size:28,children:G(E)?e.jsx(a.PauseCircle,{size:17,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}):e.jsx(a.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:["“",E.text,"”"]})]},y)})]},R.key??O)})})]},w)})]})]})},q={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)"},Pn=({score:t=4,minScore:n=0,maxScore:i=5})=>{const S=Number(t),G=Number.isFinite(S)?Math.min(Math.max(S,n),i):n,g=i>n?(G-n)/(i-n)*5:0,k=180/5,w=A=>{const C=A*Math.PI/180;return{x:121.5+85*Math.cos(C),y:123-85*Math.sin(C)}},I=(A,C)=>{const D=w(A),R=w(C),O=A-C>180?1:0;return`M ${D.x} ${D.y} A 85 85 0 ${O} 1 ${R.x} ${R.y}`},W=2;return e.jsx("svg",{width:"100%",viewBox:"0 0 243 130",fill:"none",style:{maxWidth:243},children:Array.from({length:5},(A,C)=>{const D=180-C*k-(C>0?W/2:0),R=180-(C+1)*k+(C<5-1?W/2:0),O=Math.max(0,Math.min(1,g-C)),N=I(D,R);return e.jsxs("g",{children:[e.jsx("path",{d:N,stroke:q.track,strokeWidth:30,strokeLinecap:"butt",fill:"none"}),O>0&&e.jsx("path",{d:N,stroke:q.strong,strokeWidth:30,strokeLinecap:"butt",fill:"none",pathLength:1,strokeDasharray:`${O} 1`})]},C)})})},$n=({value:t=0,maxValue:n=5})=>{const i=Number(t),l=Number.isFinite(i)?Math.min(Math.max(i,0),n):0;return e.jsx("div",{style:{display:"flex",gap:2},children:Array.from({length:n},(o,r)=>{const d=Math.max(0,Math.min(1,l-r));return e.jsx("div",{style:{width:22,height:6,borderRadius:1,background:q.track,overflow:"hidden"},children:d>0&&e.jsx("div",{style:{width:`${d*100}%`,height:"100%",background:q.strong}})},r)})})},On={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"},Yn=({text:t,children:n})=>{const[i,l]=u.useState(!1),o=u.useRef(null),[r,d]=u.useState({top:0,left:0}),f=()=>{if(o.current){const p=o.current.getBoundingClientRect();d({top:p.top-8,left:p.left+p.width/2})}l(!0)};return e.jsxs("div",{ref:o,style:{position:"relative",display:"inline-flex"},onMouseEnter:f,onMouseLeave:()=>l(!1),children:[n,i&&e.jsx("div",{style:{position:"fixed",top:r.top,left:r.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})})]})},qn=({label:t,value:n=0,maxValue:i=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:q.strong,fontFamily:"var(--font-sans)",lineHeight:"normal"},children:t}),e.jsx(Yn,{text:On[t]||t,children:e.jsx(a.Info,{size:14,color:q.infoIcon,strokeWidth:1,style:{cursor:"pointer"}})})]}),e.jsx($n,{value:n,maxValue:i})]}),At=({score:t=4,minScore:n=0,maxScore:i=5,predictedScore:l=4,predictedLabel:o="Predicted Objective",description:r="",outcomePercent:d=null,legends:f=[{label:"CSAT",value:3},{label:"Resolution",value:4},{label:"Process Adherence",value:5},{label:"Communication",value:3}]})=>{const p=ye.useMediaQuery("(max-width: 640px)"),b=Number(t),S=Number.isFinite(b)?Math.min(Math.max(b,n),i):n,G=S.toFixed(1),g=G.endsWith(".0")?G.slice(0,-2):G;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",padding:24,borderRadius:8,border:`1px solid ${q.absent}`,background:q.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:q.strong,fontFamily:"var(--font-sans)",lineHeight:1.2},children:"Interaction Quality"}),e.jsx("span",{style:{fontSize:14,fontWeight:400,color:q.muted,fontFamily:"var(--font-sans)",lineHeight:"normal"},children:r})]}),e.jsxs("div",{style:{display:"flex",flexDirection:p?"column":"row",alignItems:"center",justifyContent:"center",gap:24,flex:1,overflow:p?"visible":"hidden"},children:[e.jsxs("div",{style:{position:"relative",maxWidth:243,minWidth:p?0:160,flex:p?"0 0 auto":"0 1 243px",width:p?"100%":void 0,flexDirection:"column",alignItems:"center",display:"flex"},children:[e.jsx(Pn,{score:t,minScore:n,maxScore:i}),(()=>{const I=-(180-(i>n?(S-n)/(i-n):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(${I}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.jsxs("div",{style:{fontSize:28,fontWeight:400,color:q.strong,fontFamily:"var(--font-sans)",lineHeight:1,textAlign:"center",marginTop:8,display:"flex",alignItems:"baseline",justifyContent:"center",gap:6},children:[e.jsx("span",{children:g}),d!=null&&e.jsxs("span",{style:{fontSize:16,color:q.muted,lineHeight:1},children:["(",d,"%)"]})]}),e.jsx("div",{style:{fontSize:15,fontWeight:500,color:q.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,width:p?"100%":void 0},children:[e.jsx("div",{style:{fontSize:15,fontWeight:500,color:q.strong,fontFamily:"var(--font-sans)",lineHeight:1.2,textAlign:"left"},children:"Interaction Quality Index"}),e.jsx("div",{style:{width:"100%",height:1,background:q.absent}}),f.map((k,w)=>e.jsx(qn,{label:k.label,value:k.value},w))]})]})]})},Lt=t=>{if(!t)return null;const i=String(t).trim().toLowerCase().split(/[^a-z]+/).filter(Boolean);return i.includes("supervisor")?"var(--rail-compliance, #C98A5A)":i.includes("admin")||i.includes("administrator")||i.includes("superadmin")?"var(--rail-discovery, #5E88B0)":i.includes("agent")?"var(--rail-outcome, #6B7C93)":null},Kn=t=>{var l,o,r,d,f,p;if(!t)return null;const n=t.role??t.userRole??t.user_role??t.author_role??t.roleName??t.role_name??t.userType??t.user_type??t.type;if(typeof n=="string")return n;if(Array.isArray(n))return n.join(" ");if(n&&typeof n=="object")return n.name||n.value||n.label||null;const i=((l=t.user)==null?void 0:l.role)??((o=t.user)==null?void 0:o.userRole)??((r=t.user)==null?void 0:r.user_role)??((d=t.profile)==null?void 0:d.role)??((f=t.profile)==null?void 0:f.userRole)??((p=t.profile)==null?void 0:p.user_role);return typeof i=="string"?i:Array.isArray(i)?i.join(" "):i&&typeof i=="object"&&(i.name||i.value||i.label)||null},Bt=t=>{if(!t)return"#6B7C93";const n=Kn(t);return Lt(n)||t.color||"#6B7C93"},Ee=t=>(t||"").split(" ").map(n=>n[0]).join("").toUpperCase()||"U",Qn=t=>{if(!t||t==="Just now")return!0;if(/^\d{4}-\d{2}-\d{2}T/.test(t))try{const i=/Z$|[+-]\d{2}:\d{2}$/.test(t)?t:t+"Z",l=new Date(i);return Number.isNaN(l.getTime())?!1:Date.now()-l.getTime()<15*60*1e3}catch{return!1}const n=t.match(/^(\d+)\s*min/);return n?parseInt(n[1],10)<15:!(/\d+\s*h/.test(t)||/\d+\s*day/.test(t))},Vn=t=>{if(!t)return"";if(!/^\d{4}-\d{2}-\d{2}T/.test(t))return t;try{const n=/Z$|[+-]\d{2}:\d{2}$/.test(t)?t:t+"Z",i=new Date(n);if(Number.isNaN(i.getTime()))return t;const o=new Date().getTime()-i.getTime(),r=Math.floor(o/6e4),d=Math.floor(o/36e5);if(r<1)return"Just now";if(r<60)return`${r} min`;if(d<24)return`${d} h`;const f=Math.floor(d/24);return f===1?"1 day":`${f} days`}catch{return t}},Nt=({name:t,initials:n,color:i,avatar:l,size:o=36})=>l?e.jsx("img",{src:l,alt:t,style:{width:o,height:o,borderRadius:"50%",objectFit:"cover",flexShrink:0}}):e.jsx("div",{style:{width:o,height:o,borderRadius:"50%",background:i||"#6B7C93",color:"#FFF",display:"flex",alignItems:"center",justifyContent:"center",fontSize:o<=32?"10px":"11px",fontWeight:650,flexShrink:0,fontFamily:"var(--default-font-family)",letterSpacing:"0.02em"},title:t,children:n||Ee(t)}),Zn=({comment:t,isReply:n=!1,isConsecutive:i=!1,onReply:l,onSendReply:o,onEdit:r,onDelete:d,onMenuClick:f,showReply:p=!0})=>{var fe,ue;const[b,S]=u.useState(!1),[G,g]=u.useState(!1),[k,w]=u.useState(!1),[I,W]=u.useState(""),[A,C]=u.useState(!1),[D,R]=u.useState(""),[O,N]=u.useState(!1),K=u.useRef(null),U=u.useRef(null),E=u.useRef(null),y=t.author||{},m=y.name||t.author_name||"Unknown",x=y.initials||Ee(m),ee=y.role||t.author_role,ie=y.color||Lt(ee)||"#6B7C93",re=y.avatar||t.avatar,te=t.timestamp||t.created_at,se=Vn(te),L=Qn(te),me=!!(t.isEdited||t.is_edited||t.edited),ce=Array.isArray(t.content)?t.content:[t.content||t.text||""];return u.useEffect(()=>{if(!G)return;const c=Q=>{K.current&&!K.current.contains(Q.target)&&g(!1)};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[G]),u.useEffect(()=>{const c=U.current;if(!c)return;c.style.height="auto";const Q=140;c.style.height=Math.min(c.scrollHeight,Q)+"px",c.style.overflowY=c.scrollHeight>Q?"auto":"hidden"},[I,k]),u.useEffect(()=>{const c=E.current;if(!c)return;c.style.height="auto";const Q=140;c.style.height=Math.min(c.scrollHeight,Q)+"px",c.style.overflowY=c.scrollHeight>Q?"auto":"hidden"},[D,A]),e.jsxs("div",{onMouseEnter:()=>S(!0),onMouseLeave:()=>S(!1),style:{display:"flex",paddingLeft:n?48:0,alignItems:"flex-start",gap:16,paddingTop:i?0:8,paddingBottom:8},children:[i?e.jsx("div",{style:{width:36,flexShrink:0}}):e.jsx(Nt,{name:m,initials:x,color:ie,avatar:re}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:i?"flex-end":"space-between",marginBottom:i?0:6},children:[!i&&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:m}),e.jsx("span",{style:{fontSize:12,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:"150%",fontFamily:"var(--default-font-family)"},children:se}),me&&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:K,children:[e.jsx("button",{type:"button",onClick:()=>g(c=>!c),style:{padding:2,border:"none",background:"transparent",cursor:"pointer",borderRadius:4,display:"flex",alignItems:"center",justifyContent:"center",opacity:b||G?1:0,transition:"opacity 0.15s",flexShrink:0},children:e.jsx(a.Ellipsis,{size:24,color:"var(--Grey-Muted, #808183)"})}),G&&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:()=>{g(!1),C(!1),w(!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:c=>{c.currentTarget.style.background="var(--surface-hover, #F3F7F7)"},onMouseLeave:c=>{c.currentTarget.style.background="transparent"},children:"Reply"}),r&&e.jsx("button",{type:"button",disabled:!L,onClick:()=>{if(!L)return;g(!1);const c=Array.isArray(t.content)?t.content.join(`
|
|
16
|
-
`):t.content||t.text||"";R(c),C(!0),w(!1)},style:{display:"flex",width:"100%",padding:"10px 16px",alignItems:"center",border:"none",background:"transparent",cursor:L?"pointer":"not-allowed",fontSize:13,fontWeight:400,color:L?"var(--Grey-Strong, #2E3236)":"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",lineHeight:"150%",textAlign:"left",opacity:L?1:.5},onMouseEnter:c=>{L&&(c.currentTarget.style.background="var(--surface-hover, #F3F7F7)")},onMouseLeave:c=>{c.currentTarget.style.background="transparent"},children:"Edit"}),d&&e.jsx("button",{type:"button",onClick:()=>{g(!1),N(!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:c=>{c.currentTarget.style.background="var(--surface-hover, #F3F7F7)"},onMouseLeave:c=>{c.currentTarget.style.background="transparent"},children:"Delete"})]})]})]}),A?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:()=>C(!1),style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0},children:e.jsx(a.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:E,value:D,onChange:c=>R(c.target.value),onKeyDown:c=>{if(c.key==="Enter"){if(c.metaKey||c.ctrlKey||c.shiftKey)return;c.preventDefault(),D.trim()&&(r==null||r({...t,content:D.trim(),isEdited:!0}),C(!1))}c.key==="Escape"&&C(!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()&&(r==null||r({...t,content:D.trim(),isEdited:!0}),C(!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:ce.map((c,Q)=>e.jsx("div",{style:{fontSize:13,fontWeight:400,color:"var(--text-ink, #1E2125)",lineHeight:"160%",fontFamily:"var(--default-font-family)",padding:"8px 12px",background:n?"var(--surface-hover, #F3F7F7)":"var(--surface-warm-40, rgba(243, 241, 229, 0.40))",borderRadius:8,wordBreak:"break-word",whiteSpace:"pre-wrap"},children:c},Q))}),O&&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:()=>{N(!1),d==null||d(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:c=>{c.currentTarget.style.background="var(--Grey-absent, #D9D9D9)"},onMouseLeave:c=>{c.currentTarget.style.background="var(--grey-light, #e9e8e8a1)"},children:"Delete"}),e.jsx("button",{type:"button",onClick:()=>N(!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:c=>{c.currentTarget.style.background="var(--grey-light, #e9e8e8a1)"},onMouseLeave:c=>{c.currentTarget.style.background="none"},children:"Cancel"})]}),p&&l&&!k&&!O&&e.jsxs("button",{type:"button",onClick:()=>{C(!1),w(!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(a.CornerDownRight,{size:20,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),"Reply"]}),k&&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:["“"," ",((ue=t.author)==null?void 0:ue.name)||"Unknown"]}),e.jsx("button",{type:"button",onClick:()=>{W(""),w(!1)},style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0},children:e.jsx(a.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:U,value:I,onChange:c=>W(c.target.value),onKeyDown:c=>{if(c.key==="Enter"){if(c.metaKey||c.ctrlKey||c.shiftKey)return;c.preventDefault(),I.trim()&&(o==null||o({content:I.trim(),parentId:t.id}),W(""),w(!1))}c.key==="Escape"&&(W(""),w(!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:()=>{I.trim()&&(o==null||o({content:I.trim(),parentId:t.id}),W(""),w(!1))},disabled:!I.trim(),style:{display:"flex",height:28,padding:"8px 12px",justifyContent:"center",alignItems:"center",gap:8,fontSize:13,fontWeight:600,color:I.trim()?"var(--Grey-White, #FFF)":"var(--Grey-Muted, #808183)",background:I.trim()?"var(--Neutral-850, #272727)":"var(--grey-light, #e9e8e8a1)",border:"none",borderRadius:10,cursor:I.trim()?"pointer":"not-allowed",fontFamily:"var(--default-font-family)",lineHeight:"150%"},children:"Post"})]})]})]})]})},Xn=({currentUser:t,onSubmit:n})=>{const[i,l]=u.useState(""),[o,r]=u.useState(!1),d=u.useRef(null);u.useEffect(()=>{const g=d.current;if(!g)return;g.style.height="auto";const k=140;g.style.height=Math.min(g.scrollHeight,k)+"px",g.style.overflowY=g.scrollHeight>k?"auto":"hidden"},[i]);const f=()=>{const g=i.trim();g&&(n==null||n(g),l(""))},p=g=>{if(g.key==="Enter"){if(g.metaKey||g.ctrlKey||g.shiftKey)return;g.preventDefault(),f()}},b=(t==null?void 0:t.initials)||Ee(t==null?void 0:t.name),S=Bt(t),G=t==null?void 0:t.avatar;return e.jsxs("div",{style:{display:"flex",gap:16,alignItems:"flex-start"},children:[e.jsx(Nt,{name:t==null?void 0:t.name,initials:b,color:S,avatar:G}),e.jsx("div",{style:{flex:1,padding:12,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:24,borderRadius:8,border:o?"1px solid var(--Grey-Strong, #2E3236)":"1px solid var(--Grey-absent, #D9D9D9)",background:"var(--Grey-White, #FFF)",transition:"border-color 0.15s"},children:e.jsxs("div",{style:{display:"flex",alignItems:"flex-end",gap:8,width:"100%"},children:[e.jsx("textarea",{ref:d,value:i,onChange:g=>l(g.target.value),onFocus:()=>r(!0),onBlur:()=>r(!1),onKeyDown:p,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:f,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)",transition:"all 0.15s",flexShrink:0,lineHeight:"150%"},children:"Post"})]})})]})},Pt=({comment:t,depth:n=0,isConsecutive:i=!1,onReply:l,onSendReply:o,onEdit:r,onDelete:d,onMenuClick:f})=>{const p=t.replies&&t.replies.length>0,b=!p;return e.jsxs(u.Fragment,{children:[e.jsx("div",{style:{paddingLeft:n>0?Math.min(n*32,128):0},children:e.jsx(Zn,{comment:t,isReply:n>0,isConsecutive:i,onReply:l,onSendReply:o,onEdit:r,onDelete:d,onMenuClick:f,showReply:b})}),p&&t.replies.map(S=>e.jsx(Pt,{comment:S,depth:n+1,onReply:l,onSendReply:o,onEdit:r,onDelete:d,onMenuClick:f},S.id))]})},$t=({comments:t=[],totalComments:n,children:i,onSendComment:l,onReply:o,onSendReply:r,onEdit:d,onDelete:f,onMenuClick:p,onMarkResolved:b,currentUser:S,isResolved:G=!1})=>{const[g,k]=u.useState([]),[w,I]=u.useState(!1),W=u.useMemo(()=>{const y=new Set(t.map(x=>x.id)),m=g.filter(x=>!y.has(x.id));return[...t,...m]},[t,g]);u.useEffect(()=>{const y=new Set(t.map(m=>m.id));k(m=>m.filter(x=>!y.has(x.id)))},[t]);const A=u.useMemo(()=>{if(!S)return{name:"You",initials:"YO",color:"#6B7C93"};const y=S.name||"You",m=S.initials||Ee(y),x=Bt(S);return{...S,name:y,initials:m,color:x}},[S]),C=async({content:y,parentId:m})=>{if(r){I(!0);try{await r({content:y,parentId:m})}finally{I(!1)}}else{const x={id:`temp-${Date.now()}`,author:A,content:y,timestamp:"Just now",parentId:m,isOptimistic:!0};k(ee=>[...ee,x])}},D=async y=>{if(l){I(!0);try{await l(y)}finally{I(!1)}}else{const m={id:`temp-${Date.now()}`,author:A,content:y,timestamp:"Just now",isOptimistic:!0};k(x=>[...x,m])}},R=y=>{k(m=>m.map(x=>x.id===y.id?{...x,content:y.content,isEdited:!0}:x)),d==null||d(y)},O=y=>{k(m=>m.filter(x=>x.id!==y.id)),f==null||f(y)},N=u.useMemo(()=>{const y={};W.forEach(x=>{x.parentId&&(y[x.parentId]||(y[x.parentId]=[]),y[x.parentId].push(x))});const m=x=>({...x,replies:(y[x.id]||[]).map(m)});return W.filter(x=>!x.parentId).map(m)},[W]),K=n??W.length,U=ye.useMediaQuery("(max-width: 900px)"),E=ye.useMediaQuery("(max-width: 640px)");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(a.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",flexDirection:U?"column":"row",gap:24,alignSelf:"stretch"},children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",flexWrap:E?"wrap":"nowrap",gap:E?10: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(a.MessagesSquare,{style:{width:20,height:20,flexShrink:0},color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.5})}),e.jsx("span",{style:{fontSize:16,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:[K," Comment",K!==1?"s":""]}),G?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(a.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"})]}):b?e.jsxs("button",{type:"button",onClick:b,style:{display:"flex",alignItems:"center",justifyContent:"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,...E?{width:"100%",order:1}:{}},children:[e.jsx(a.CircleCheck,{size:16,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.5}),"Mark as Resolved"]}):null]}),W.length>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:0,marginBottom:24,maxHeight:600,overflowY:W.length>6?"auto":"visible"},children:N.map((y,m)=>{var te,se;const x=m>0?N[m-1]:null,ee=((te=x==null?void 0:x.author)==null?void 0:te.name)||(x==null?void 0:x.author_name),ie=((se=y.author)==null?void 0:se.name)||y.author_name,re=x&&ee===ie&&(!x.replies||x.replies.length===0);return e.jsx(Pt,{comment:y,depth:0,isConsecutive:!!re,onReply:o,onSendReply:C,onEdit:R,onDelete:O,onMenuClick:p},y.id)})}),W.length>0&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:16,marginLeft:48},children:[e.jsx(a.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."})]}),w&&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(Xn,{currentUser:A,onSubmit:D})]}),e.jsx("div",{style:{flex:1,minWidth:0},children:i})]})]})},M={strong:"var(--Grey-Strong, #2E3236)",muted:"var(--Grey-Muted, #808183)",border:"var(--Grey-absent, #D9D9D9)",surfaceHover:"var(--surface-hover, #F3F7F7)",warmBorder:"var(--border-warm, #B2AEA8)",quoteText:"var(--text-subtle-warm, #767473)",toneGreen:"var(--state-present, #25A372)",toneAmber:"var(--rail-orange, #C98A5A)",toneRed:"var(--color-red-strong, #D04A4A)",impactPositiveBg:"rgba(37, 163, 114, 0.12)",impactPositiveInk:"var(--state-present, #25A372)",impactNegativeBg:"rgba(208, 74, 74, 0.12)",impactNegativeInk:"var(--color-red-strong, #D04A4A)"},Jn="var(--font-sans, 'Averta', ui-sans-serif, system-ui, sans-serif)",It=({children:t,size:n=24,onClick:i,title:l})=>{const[o,r]=u.useState(!1);return e.jsx("div",{title:l,onClick:i,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),style:{display:"flex",alignItems:"center",justifyContent:"center",width:n,height:n,borderRadius:9999,background:o?M.surfaceHover:"transparent",cursor:"pointer",flexShrink:0,transition:"background 0.15s"},children:t})},Un=t=>{const n=Math.floor(t/6e4),i=Math.floor(t%6e4/1e3);return`${n.toString().padStart(2,"0")}:${i.toString().padStart(2,"0")}`},ei=({icon:t})=>{const n={size:16,color:M.strong,strokeWidth:1.5};return t==="thumbs_down"?e.jsx(a.ArrowDown,{...n}):t==="focus"?e.jsx(a.Target,{...n}):e.jsx(a.ArrowUp,{...n})},ti=({label:t,direction:n})=>{if(!t)return null;const i=n==="negative"?a.ArrowDown:a.ArrowUp;return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,background:M.surfaceHover,color:M.strong,padding:"2px 8px",borderRadius:9999,fontSize:12,fontWeight:500,lineHeight:1.4,whiteSpace:"nowrap",flexShrink:0},children:[t,e.jsx(i,{size:12,color:M.strong,strokeWidth:2})]})},ni=({evidence:t,onPlayEvidence:n,onShowInTranscript:i,timelinePlaying:l,currentTimeSeconds:o})=>{const r=t.start_ms??t.startMs,d=t.end_ms??t.endMs,f=r!=null,p=(o??0)*1e3,b=l&&f&&p>=r&&p<=(d??r+5e3);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,paddingLeft:12,borderLeft:`2px solid ${M.warmBorder}`},children:[e.jsxs("span",{style:{fontSize:13,fontWeight:400,color:M.quoteText,lineHeight:1.5,fontStyle:"italic",wordBreak:"break-word"},children:["“",t.text,"”"]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,minHeight:24},children:[t.actor&&e.jsx("span",{style:{fontSize:12,fontWeight:500,color:M.muted,textTransform:"capitalize"},children:t.actor}),f&&e.jsxs(e.Fragment,{children:[e.jsx(It,{size:24,title:b?"Pause":"Play evidence",onClick:()=>n==null?void 0:n({start_ms:r,end_ms:d}),children:b?e.jsx(a.PauseCircle,{size:16,color:M.strong,strokeWidth:1.25}):e.jsx(a.PlayCircle,{size:16,color:M.muted,strokeWidth:1.25})}),e.jsx(It,{size:24,title:"Show in transcript",onClick:()=>i==null?void 0:i(r),children:e.jsx(a.ScrollText,{size:16,color:M.muted,strokeWidth:1.5})}),e.jsx("span",{style:{fontSize:12,fontWeight:400,color:M.muted,lineHeight:1.2,whiteSpace:"nowrap"},children:Un(r)})]})]})]})},ii=({signal:t,onPlayEvidence:n,onShowInTranscript:i,timelinePlaying:l,currentTimeSeconds:o})=>{const r=Array.isArray(t.evidence)?t.evidence:[],d=r.length>0,[f,p]=u.useState(!1);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[e.jsx(ti,{label:t.impact_label,direction:t.impact_direction}),d&&e.jsxs("button",{type:"button",onClick:()=>p(b=>!b),style:{display:"inline-flex",alignItems:"center",gap:2,background:"transparent",border:"none",padding:0,cursor:"pointer",fontSize:12,fontWeight:500,color:M.muted,fontFamily:"inherit"},children:[f?e.jsx(a.ChevronDown,{size:14,color:M.muted,strokeWidth:1.5}):e.jsx(a.ChevronRight,{size:14,color:M.muted,strokeWidth:1.5}),r.length," ",r.length===1?"quote":"quotes"]})]}),f&&d&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12,paddingTop:4},children:r.map((b,S)=>e.jsx(ni,{evidence:b,onPlayEvidence:n,onShowInTranscript:i,timelinePlaying:l,currentTimeSeconds:o},S))})]})},ri=({item:t,isLast:n,onPlayEvidence:i,onShowInTranscript:l,timelinePlaying:o,currentTimeSeconds:r})=>{const d=Array.isArray(t.signals)?t.signals:[];return e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:12,padding:"16px 16px",borderBottom:n?"none":`1px solid ${M.border}`},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:16,height:16,flexShrink:0,marginTop:2},children:e.jsx(ei,{icon:t.icon,tone:t.tone})}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,flex:1,minWidth:0},children:[e.jsx("span",{style:{fontFamily:Jn,fontSize:14,fontWeight:400,color:M.strong,lineHeight:"normal",wordBreak:"break-word"},children:t.title||""}),d.length>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:d.map((f,p)=>e.jsx(ii,{signal:f,onPlayEvidence:i,onShowInTranscript:l,timelinePlaying:o,currentTimeSeconds:r},f.signal_key||p))})]})]})},li=({summary:t})=>{if(!t||typeof t!="object")return null;const n=Number(t.focus_count)||0,i=Number(t.opportunity_count)||0,l=Number(t.excellence_count)||0;if(n+i+l===0)return null;const o=[{key:"excellence",label:"Excellence",count:l,Icon:a.ArrowUp,color:M.strong},{key:"opportunity",label:"Opportunity",count:i,Icon:a.ArrowDown,color:M.strong},{key:"focus",label:"Focus",count:n,Icon:a.Target,color:M.strong}].filter(r=>r.count>0);return e.jsx("div",{style:{display:"flex",alignItems:"center",gap:16,padding:"8px 16px",background:M.surfaceHover,borderRadius:8},children:o.map(({key:r,label:d,count:f,Icon:p,color:b})=>e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(p,{size:14,color:b,strokeWidth:1.75}),e.jsx("span",{style:{fontSize:13,fontWeight:600,color:M.strong,lineHeight:1.2},children:f}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:M.muted,lineHeight:1.2},children:d})]},r))})},oi=5,Ot=({items:t=[],summary:n,guidanceCount:i,loading:l=!1,onPlayEvidence:o,onShowInTranscript:r,timelinePlaying:d=!1,currentTimeSeconds:f=0})=>{const p=Array.isArray(t)?t.filter(Boolean).slice(0,oi):[],b=i??p.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:M.surfaceHover,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(a.Lightbulb,{style:{width:20,height:20,flexShrink:0},color:M.strong,strokeWidth:1.5})}),e.jsx("span",{style:{flex:1,fontSize:16,fontWeight:500,color:M.strong,lineHeight:1.2},children:"Guidance"}),e.jsxs("span",{style:{fontSize:14,fontWeight:500,color:M.strong,lineHeight:1.5,whiteSpace:"nowrap"},children:[b," Item",b!==1?"s":""]})]}),e.jsx(li,{summary:n}),p.map((S,G)=>e.jsx(ri,{item:S,isLast:G===p.length-1,onPlayEvidence:o,onShowInTranscript:r,timelinePlaying:d,currentTimeSeconds:f},G))]})},J={strong:"var(--Grey-Strong, #2E3236)",muted:"var(--Grey-Muted, #808183)",border:"var(--Grey-absent, #D9D9D9)",surface:"var(--Grey-White, #FFF)",surfaceHover:"var(--surface-hover, #F3F7F7)"},Re="var(--font-sans, 'Averta', ui-sans-serif, system-ui, sans-serif)",si=[{key:"lookup_hold",label:"Lookup",Icon:a.Search},{key:"formal_hold",label:"Hold",Icon:a.Pause},{key:"extended_hold",label:"Extended",Icon:a.Pause},{key:"transfer_hold",label:"Transfer",Icon:a.ArrowRightLeft},{key:"probable_hold",label:"Possible",Icon:a.CircleDashed},{key:"dead_air",label:"Dead air",Icon:a.MicOff}],ai=t=>{if(t==null||Number.isNaN(t))return"—";const n=Number(t);return Number.isFinite(n)?n>=1e3?`${(n/1e3).toFixed(1)}s`:`${Math.round(n)}ms`:"—"},di=t=>{if(t==null||Number.isNaN(t))return null;const n=Number(t);return Number.isFinite(n)?`${(n*100).toFixed(1)}%`:null},Xe=t=>{if(t==null||Number.isNaN(t))return null;const n=Number(t);return Number.isFinite(n)?n.toLocaleString():null},ci=({holdTypeCounts:t})=>{if(!t||typeof t!="object")return null;const n=si.map(i=>({...i,count:Number(t[i.key])||0})).filter(i=>i.count>0);return n.length===0?null:e.jsx("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:16,padding:"8px 16px",background:J.surfaceHover,borderRadius:8},children:n.map(({key:i,label:l,Icon:o,count:r})=>e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(o,{size:14,color:J.strong,strokeWidth:1.5}),e.jsx("span",{style:{fontFamily:Re,fontSize:13,fontWeight:600,color:J.strong,lineHeight:1.2},children:r}),e.jsx("span",{style:{fontFamily:Re,fontSize:13,fontWeight:400,color:J.muted,lineHeight:1.2},children:l})]},i))})},fi=({summary:t})=>{const n=Xe(t==null?void 0:t.stall_count);if(!n)return null;const i=di(t==null?void 0:t.stall_rate),l=Xe(t==null?void 0:t.stall_filler_count),o=Xe(t==null?void 0:t.stall_buying_time_count),r=[];return l&&r.push(`filler ${l}`),o&&r.push(`buying time ${o}`),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",fontFamily:Re,fontSize:13,lineHeight:1.4},children:[e.jsxs("span",{style:{fontWeight:500,color:J.strong},children:["Stalls: ",n,i?` (${i})`:""]}),r.length>0&&e.jsxs("span",{style:{color:J.muted},children:["· ",r.join(" · ")]})]})},Wt=({label:t,percentiles:n})=>{if(!n||typeof n!="object")return null;const i=[{key:"p50",label:"p50",value:n.p50},{key:"p75",label:"p75",value:n.p75},{key:"p95",label:"p95",value:n.p95},{key:"p99",label:"p99",value:n.p99}].filter(l=>l.value!=null);return i.length===0?null:e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:12,flexWrap:"wrap",fontFamily:Re,fontSize:13,lineHeight:1.4},children:[e.jsx("span",{style:{fontWeight:500,color:J.strong,minWidth:72},children:t}),i.map(l=>e.jsxs("span",{style:{color:J.muted},children:[e.jsx("span",{style:{fontWeight:500,color:J.strong},children:l.label})," ",ai(l.value)]},l.key))]})},ui=({summary:t})=>{if(!t||typeof t!="object")return null;const n=!!t.hold_type_counts&&Object.values(t.hold_type_counts).some(d=>Number(d)>0),i=(Number(t.stall_count)||0)>0,l=t.agent_response_percentiles_ms,o=t.customer_response_percentiles_ms,r=l&&Object.values(l).some(d=>d!=null)||o&&Object.values(o).some(d=>d!=null);return!n&&!i&&!r?null:e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch",gap:12,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:J.surfaceHover,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(a.AudioLines,{size:20,color:J.strong,strokeWidth:1.5})}),e.jsx("span",{style:{flex:1,fontFamily:"Varta, var(--font-sans, sans-serif)",fontSize:16,fontWeight:700,color:J.strong,lineHeight:1.2,whiteSpace:"nowrap"},children:"Talk Patterns"})]}),n&&e.jsx(ci,{holdTypeCounts:t.hold_type_counts}),(i||r)&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,padding:"12px 16px",border:`1px solid ${J.border}`,borderRadius:8},children:[i&&e.jsx(fi,{summary:t}),r&&e.jsxs(e.Fragment,{children:[e.jsx(Wt,{label:"Agent",percentiles:l}),e.jsx(Wt,{label:"Customer",percentiles:o})]})]})]})},le={strong:"var(--Grey-Strong, #2E3236)",muted:"var(--Grey-Muted, #808183)",border:"var(--Grey-absent, #D9D9D9)",surfaceHover:"var(--surface-hover, #F3F7F7)",iconAccent:"var(--rail-orange, #C98A5A)"},Ce="var(--font-sans, 'Averta', ui-sans-serif, system-ui, sans-serif)",Dt=t=>{if(t==null)return null;if(typeof t=="string")return{name:t,percent:null};const n=t.name??t.label??t.title??"";return n?{name:n,percent:t.percent!=null?t.percent:t.percentage!=null?t.percentage:null}:null},pi=t=>{if(t==null)return null;const n=Number(t);return Number.isFinite(n)?`${(Math.abs(n)<=1?n*100:n).toFixed(1)} %`:null},gi=({name:t,percent:n})=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"12px 0",borderBottom:`1px solid ${le.border}`,width:"100%"},children:[e.jsx("span",{style:{flex:1,minWidth:0,fontFamily:Ce,fontSize:13,fontWeight:400,color:le.strong,lineHeight:"24px",wordBreak:"break-word"},children:t}),n!=null&&e.jsx("span",{style:{fontFamily:Ce,fontSize:13,fontWeight:400,color:le.muted,lineHeight:"24px",whiteSpace:"nowrap",flexShrink:0},children:pi(n)})]}),zt=({title:t,items:n,initialVisibleCount:i})=>{const[l,o]=u.useState(!1);if(!n.length)return null;const r=Math.max(0,n.length-i),d=l?n:n.slice(0,i);return e.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:8},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"8px 0",width:"100%"},children:e.jsx("span",{style:{flex:1,minWidth:0,fontFamily:Ce,fontSize:15,fontWeight:600,color:le.strong,lineHeight:"24px",wordBreak:"break-word"},children:t})}),e.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%"},children:d.map((f,p)=>e.jsx(gi,{name:f.name,percent:f.percent},p))}),r>0&&e.jsxs("button",{type:"button",onClick:()=>o(f=>!f),style:{display:"inline-flex",alignItems:"center",gap:6,height:29,padding:"8px 0",background:"transparent",border:"none",cursor:"pointer",fontFamily:Ce,fontSize:13,fontWeight:600,color:le.strong,lineHeight:1.2,whiteSpace:"nowrap"},children:[l?"Show Less":`${r} More`,l?e.jsx(a.ChevronUp,{size:16,color:le.strong,strokeWidth:1.75}):e.jsx(a.ChevronDown,{size:16,color:le.strong,strokeWidth:1.75})]})]})},Yt=({products:t=[],services:n=[],title:i="Products & Services",productsTitle:l="Products Discussed",servicesTitle:o="Services Discussed",initialVisibleCount:r=4})=>{const d=(t||[]).map(Dt).filter(Boolean),f=(n||[]).map(Dt).filter(Boolean);return!d.length&&!f.length?null:e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch",gap:16,width:"100%",background:"var(--Grey-White, #FFF)"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",gap:16,height:40,borderBottom:`1px solid ${le.border}`,width:"100%"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:0},children:[e.jsx(a.ClipboardCheck,{size:24,color:le.iconAccent,strokeWidth:1.5}),e.jsx("span",{style:{fontFamily:Ce,fontSize:16,fontWeight:600,color:le.strong,lineHeight:1.2,textTransform:"uppercase",whiteSpace:"nowrap"},children:i})]})}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:24,flexWrap:"wrap",width:"100%"},children:[e.jsx(zt,{title:l,items:d,initialVisibleCount:r}),e.jsx(zt,{title:o,items:f,initialVisibleCount:r})]})]})},xe=({text:t,children:n})=>{const[i,l]=u.useState(!1),o=u.useRef(null),[r,d]=u.useState({top:0,left:0});if(!t)return n;const f=()=>{if(o.current){const p=o.current.getBoundingClientRect();d({top:p.bottom+6,left:p.left+p.width/2})}l(!0)};return e.jsxs("div",{ref:o,style:{position:"relative",display:"inline-flex"},onMouseEnter:f,onMouseLeave:()=>l(!1),children:[n,i&&e.jsx("div",{style:{position:"fixed",top:r.top,left:r.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})})]})},Mt=[{key:"overview",label:"Overview"},{key:"coaching",label:"Coaching Summary"},{key:"signals",label:"Signals & Recording"},{key:"comments",label:"Feedback"}];function hi(t){return/\bagent\b/.test(String(t??"").toLowerCase())}function xi(t){return/(admin|superadmin|administrator)/.test(String(t??"").toLowerCase())}function yi(t,n){const i=(t==null?void 0:t.direction)??(t==null?void 0:t.interaction_direction)??(t==null?void 0:t.call_direction)??n;if(i==null||i==="")return null;const l=String(i).toLowerCase().trim();return l==="outbound"||l.startsWith("outbound")?"outbound":l==="inbound"||l.startsWith("inbound")?"inbound":null}const mi=({title:t="Wheel Stud Replacement Enquiry",onBack:n,data:i,coachingData:l,coachingLoading:o=!1,audioUrl:r,audioRef:d,currentTimeSeconds:f,timelinePlaying:p,playbackRate:b,timelineSegments:S,onSeek:G,onTogglePlay:g,onSeekBack:k,onSeekForward:w,onSetPlaybackRate:I,agentName:W,agentFullName:A,customerName:C,customerFullName:D,transcript:R,activeTurnIndex:O,turnObservations:N,highlightedTurns:K,onTurnPlayPause:U,onPlayEvidence:E,onHighlightTurns:y,callPurpose:m,classification:x,outcomeQuality:ee,resolutionOutcome:ie,customerIntent:re,location:te,interactionId:se,moreDetails:L,compassScore:me,compassMaxScore:ce=5,predictedCsat:fe,predictedLabel:ue="Predicted Objective",compassLegends:c,customerSessions:Q,customerSessionCount:Te,onSessionClick:h,onViewAllSessions:T,prevSessionDesc:pe,prevSessionDisabled:ae=!1,nextSessionDesc:Je,nextSessionDisabled:de=!1,onPreviousSession:Fe,onNextSession:Ie,comments:Ue=[],guidance:qt=[],guidanceSummary:Kt,talkPatterns:Qt,productsServices:Z,productsDiscussed:Ae,servicesDiscussed:Le,currentUser:Y,onSendComment:Vt,onSendReply:Zt,onReply:Xt,onEdit:Jt,onEditInteraction:Ut,onDelete:en,onMenuClick:tn,onMarkResolved:nn,commentsResolved:rn})=>{var mt;const[Be,We]=u.useState("overview"),[ln,et]=u.useState(new Set),[on,De]=u.useState(!1),[sn,tt]=u.useState(null),[nt,it]=u.useState(!1),[rt,an]=u.useState(0),[lt,dn]=u.useState(!1),H=ye.useMediaQuery("(max-width: 640px)"),ge=u.useRef(null),Ne=u.useRef(null),ot=u.useRef(null),ze=u.useRef(null),st=u.useRef(null),at=u.useRef(null),dt={overview:Ne,coaching:ot,signals:ze,products:st,comments:at},Se=u.useRef(null),Pe=u.useRef(!1),ct=u.useMemo(()=>{const s=(Z==null?void 0:Z.products)??Ae??[],v=(Z==null?void 0:Z.services)??Le??[];return s.length>0||v.length>0},[Z,Ae,Le]),$e=u.useMemo(()=>{if(!ct)return Mt;const s=[];for(const v of Mt)v.key==="comments"&&s.push({key:"products",label:"Products & Services"}),s.push(v);return s},[ct]);u.useEffect(()=>{const s=Se.current;if(!s)return;const v=$e.map(P=>P.key),j=v.map(P=>dt[P]),z=(P=>{let ne=P.parentElement;for(;ne;){const{overflow:be,overflowY:oe}=window.getComputedStyle(ne);if(/(auto|scroll)/.test(be+oe))return ne;ne=ne.parentElement}return null})(s),B=()=>{var be;if(Pe.current)return;let P=v[0];for(let oe=j.length-1;oe>=0;oe--){const Ve=j[oe].current;if(!Ve)continue;if(Ve.getBoundingClientRect().top<=150){P=v[oe];break}}We(P);const ne=((be=Ne.current)==null?void 0:be.getBoundingClientRect().top)??Number.POSITIVE_INFINITY;dn(ne<=150)};return s.addEventListener("scroll",B,{passive:!0}),z&&z!==s&&z.addEventListener("scroll",B,{passive:!0}),window.addEventListener("scroll",B,{passive:!0,capture:!0}),B(),()=>{s.removeEventListener("scroll",B),z&&z!==s&&z.removeEventListener("scroll",B),window.removeEventListener("scroll",B,{capture:!0})}},[$e]);const ft=u.useRef(null),cn=s=>{var j;We(s),Pe.current=!0,ft.current=s;const v=(j=dt[s])==null?void 0:j.current;if(v){const F=Se.current;if(F&&F.scrollHeight>F.clientHeight){const z=F.getBoundingClientRect().top,P=v.getBoundingClientRect().top-z+F.scrollTop-16;F.scrollTo({top:P,behavior:"smooth"})}else{const z=v.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:z,behavior:"smooth"})}}setTimeout(()=>{Pe.current=!1,ft.current=null},1200)},Oe=Q||[],Ye=Oe.length>1,ut=s=>{We("signals");const v=ze.current;if(v){const F=Se.current;if(F&&F.scrollHeight>F.clientHeight){const z=F.getBoundingClientRect().top,P=v.getBoundingClientRect().top-z+F.scrollTop-16;F.scrollTo({top:P,behavior:"smooth"})}else{const z=v.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:z,behavior:"smooth"})}}const j=s/1e3;setTimeout(()=>{var F;(F=ge.current)!=null&&F.scrollToTranscript&&ge.current.scrollToTranscript(j)},220)},pt=s=>{We("signals");const v=ze.current;if(v){const F=Se.current;if(F&&F.scrollHeight>F.clientHeight){const z=F.getBoundingClientRect().top,P=v.getBoundingClientRect().top-z+F.scrollTop-16;F.scrollTo({top:P,behavior:"smooth"})}else{const z=v.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:z,behavior:"smooth"})}}const j=(s==null?void 0:s.start_ms)??(s==null?void 0:s.startMs);setTimeout(()=>{var F,z;if(j!=null&&((F=ge.current)!=null&&F.scrollToTranscript)&&ge.current.scrollToTranscript(j/1e3),E)E(s);else if(j!=null&&((z=ge.current)!=null&&z.seekTo)){ge.current.seekTo(j/1e3),it(!0),an(j/1e3);const P=(s.end_ms??s.endMs??j+5e3)-j;setTimeout(()=>it(!1),P)}},220)},fn=s=>{y&&y(s)},un=s=>{et(v=>{const j=new Set(v);return j.has(s)?j.delete(s):j.add(s),j})},pn=(i==null?void 0:i.blocks)||[],we=s=>{var v;return((v=pn.find(j=>j.block_id===s))==null?void 0:v.payload)||{}},X=we("interaction-metadata"),ve=we("interaction-context"),Me=we("interaction-signals"),gn=we("interaction-outcome-lift"),hn=we("interaction-dimensions").dimensions||[],xn=ve.call_purpose||{},yn=ve.classification||{},gt=X||{},Ge=m||xn||{},mn=x||yn||{},je=gn||{};(je.driver_signal_keys||[]).map(s=>s.replace(/^sig\./,"").replace(/_/g," "));const vn=l||null,jn=(mt=Me==null?void 0:Me.signals)!=null&&mt.length?Me:{present_count:0,total_signals_evaluated:0,signals:[]},ht=qt||[],qe=W||X.agent_name||X.agent||ve.agent_name||"Agent",bn=A||X.agent_full_name||X.agent_name||qe,ke=C||X.customer_name||X.customer||ve.customer_name||"Customer",xt=D||X.customer_full_name||X.customer_name||ke,yt=String((Y==null?void 0:Y.role)??(Y==null?void 0:Y.userRole)??(Y==null?void 0:Y.user_role)??(Y==null?void 0:Y.roleName)??(Y==null?void 0:Y.role_name)??"").toLowerCase(),Sn=xi(yt),Ke=hi(yt),Qe=Te??Oe.length,He=X.created_dt||(i==null?void 0:i.created_dt)||ve.created_dt||"",wn=He?new Date(/Z$|[+-]\d{2}:\d{2}$/.test(He)?He:He+"Z").toLocaleString():"",kn=Ge.interaction_direction==="inbound"?"Inbound":"Outbound";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",maxWidth:"100%",height:"100%",background:"var(--Grey-White, #FFF)",overflowX:H?"clip":void 0},children:[e.jsxs("div",{style:{display:"flex",flexDirection:H?"column":"row",alignItems:H?"stretch":"center",gap:12,padding:H?"16px 16px 0":"18px 24px 0"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,minWidth:0,...H?{order:2,width:"100%"}:{flex:1}},children:[e.jsx("button",{onClick:n,style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0,flexShrink:0},children:e.jsx(a.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||Ie)&&(H||!lt)&&e.jsxs("div",{style:{display:"flex",alignItems:"center",flexShrink:0,...H?{width:"100%",justifyContent:"space-between",order:1}:{}},children:[e.jsx(xe,{text:pe,children:e.jsxs("button",{onClick:ae?void 0:Fe,disabled:ae,style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",background:"none",border:"none",cursor:ae?"default":"pointer",opacity:ae?.4:1},children:[e.jsx(a.ArrowLeft,{size:16,color:"var(--Neutral-800, #323232)",strokeWidth:1.5}),e.jsx("span",{style:{color:"var(--Neutral-800, #323232)",fontSize:13,fontWeight:400,lineHeight:"24px",fontFamily:"var(--default-font-family)",whiteSpace:"nowrap"},children:"Previous Interaction"})]})}),e.jsx("div",{style:{width:1,height:20,background:"var(--Grey-absent, #D9D9D9)",flexShrink:0}}),e.jsx(xe,{text:Je,children:e.jsxs("button",{onClick:de?void 0:Ie,disabled:de,style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",background:"none",border:"none",cursor:de?"default":"pointer",opacity:de?.4:1},children:[e.jsx("span",{style:{color:"var(--Neutral-800, #323232)",fontSize:13,fontWeight:400,lineHeight:"24px",fontFamily:"var(--default-font-family)",whiteSpace:"nowrap"},children:"Next Interaction"}),e.jsx(a.ArrowRight,{size:16,color:"var(--Neutral-800, #323232)",strokeWidth:1.5})]})})]})]}),!H&&e.jsx("div",{style:{position:"sticky",top:0,zIndex:30,backgroundColor:"#FFFFFF",paddingTop:8,boxShadow:"0 4px 6px -4px rgba(0, 0, 0, 0.04)"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16,background:"#FFFFFF",borderBottom:"1px solid var(--Grey-Faint, #ACADAD)",padding:H?"0 16px":"0 24px"},children:[e.jsx("div",{className:"custom-thin-scrollbar-hidden",style:{display:"flex",alignItems:"flex-start",minWidth:0,overflowX:H?"auto":"visible"},children:$e.map(s=>e.jsx("button",{onClick:()=>cn(s.key),style:{display:"flex",padding:16,alignItems:"center",gap:10,flexShrink:0,background:"none",border:"none",borderBottom:Be===s.key?"3px solid var(--Grey-Strong, #2E3236)":"3px solid transparent",cursor:"pointer",fontSize:15,fontWeight:Be===s.key?500:400,color:Be===s.key?"var(--Grey-Strong, #2E3236)":"var(--Grey-Muted, #808183)",whiteSpace:"nowrap",transition:"border-color 0.2s ease, color 0.2s ease"},children:s.label},s.key))}),(Fe||Ie)&<&&e.jsxs("div",{style:{display:"flex",alignItems:"center",flexShrink:0},children:[e.jsx(xe,{text:pe,children:e.jsxs("button",{onClick:ae?void 0:Fe,disabled:ae,style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",background:"none",border:"none",cursor:ae?"default":"pointer",opacity:ae?.4:1},children:[e.jsx(a.ArrowLeft,{size:16,color:"var(--Neutral-800, #323232)",strokeWidth:1.5}),e.jsx("span",{style:{color:"var(--Neutral-800, #323232)",fontSize:13,fontWeight:400,lineHeight:"24px",fontFamily:"var(--default-font-family)",whiteSpace:"nowrap"},children:"Previous Interaction"})]})}),e.jsx("div",{style:{width:1,height:20,background:"var(--Grey-absent, #D9D9D9)",flexShrink:0}}),e.jsx(xe,{text:Je,children:e.jsxs("button",{onClick:de?void 0:Ie,disabled:de,style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",background:"none",border:"none",cursor:de?"default":"pointer",opacity:de?.4:1},children:[e.jsx("span",{style:{color:"var(--Neutral-800, #323232)",fontSize:13,fontWeight:400,lineHeight:"24px",fontFamily:"var(--default-font-family)",whiteSpace:"nowrap"},children:"Next Interaction"}),e.jsx(a.ArrowRight,{size:16,color:"var(--Neutral-800, #323232)",strokeWidth:1.5})]})})]})]})}),e.jsxs("div",{ref:Se,style:{padding:H?16:24,flex:1,overflowY:"auto",...H?{minWidth:0,overflowX:"hidden"}:{}},children:[e.jsxs("div",{ref:Ne,style:{display:"flex",flexDirection:"column",justifyContent:"flex-end",alignItems:"flex-start",gap:24,alignSelf:"stretch"},children:[e.jsxs("div",{style:{display:"flex",flexWrap:H?"wrap":"nowrap",height:H?"auto":40,alignItems:H?"flex-start":"center",gap:H?8:16,alignSelf:"stretch"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1},children:[e.jsx(a.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",flexDirection:"row",flexWrap:H?"wrap":"nowrap",alignItems:"center",gap:H?"8px 16px":16,flexShrink:0,...H?{width:"100%"}:{}},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"8px 0"},children:[e.jsx(a.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:wn})]}),(()=>{const s=Ge.interaction_direction==="outbound"?a.PhoneOutgoing:a.PhoneIncoming;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"8px 0"},children:[e.jsx(s,{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:kn})]})})(),e.jsxs("div",{style:{display:"flex",flexWrap:H?"wrap":"nowrap",alignItems:"center",gap:H?12:16,...H?{flexBasis:"100%",width:"100%"}:{paddingLeft:16,borderLeft:"1px solid var(--Grey-absent, #D9D9D9)"}},children:[e.jsx(xe,{text:bn,children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"8px 0",cursor:"pointer"},children:[e.jsx(a.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:qe})]})}),Qe>1?e.jsx("div",{children:e.jsx(xe,{text:xt,children:e.jsxs("button",{onClick:()=>De(!0),style:{display:"flex",alignItems:"center",gap:16,padding:"0 16px",height:34,borderRadius:8,background:"var(--Rail-Surface-2, #E3E1D7)",border:"none",cursor:"pointer"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,minWidth:0},children:[e.jsx(a.CircleUser,{size:16,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.5}),e.jsxs("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2,whiteSpace:"nowrap"},children:[e.jsx("span",{style:{fontWeight:600},children:ke})," ",e.jsxs("span",{children:["(",Qe," Interactions)"]})]})]}),e.jsx(a.ChevronRight,{size:16,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.7})]})})}):e.jsx(xe,{text:xt,children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"8px 0",cursor:"pointer"},children:[e.jsx(a.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:ke})]})})]})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:H?"column":"row",alignItems:"stretch",gap:24,alignSelf:"stretch"},children:[e.jsx("div",{style:{flex:1,minWidth:0,display:"flex"},children:e.jsx(At,{score:me??.5,minScore:0,maxScore:ce,predictedScore:fe??.5,predictedLabel:ue,legends:c,outcomePercent:(je==null?void 0:je.p_full)!=null?Math.round(je.p_full*100):null})}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch",justifyContent:Ke?"flex-start":"flex-end",gap:24,flex:1,minWidth:0},children:[e.jsx(Et,{meta:gt,callPurpose:Ge,classification:mn,outcomeQuality:ee||"Neutral",dimensions:hn,resolutionOutcome:ie,customerIntent:re,location:te??X.location??X.location_name??ve.location,interactionId:se??X.interaction_id,moreDetails:L,canShowEditButton:Sn,onEditInteraction:Ut,flatView:Ke}),!Ke&&(()=>{var bt,St;const s=je||{},v=s.difficulty,j=s.difficulty_band,F=s.p_expected,z=s.score_impact??F,B=s.lift_raw,P=s.lift_display,ne=(bt=s.interpretation)==null?void 0:bt.lift_band,be=s.p_full,oe=(St=s.interpretation)==null?void 0:St.description;if(!(v!=null||j!=null||B!=null||ne!=null||be!=null||oe!=null))return null;const Ze=(he,_e,zn)=>Math.max(_e,Math.min(zn,he)),Cn=v!=null?Ze((v-50)/50,-1,1):0,Fn=B!=null?Ze(B*3,-1,1):0,vt=z!=null?Math.round(z*100):null,jt=he=>{if(he)return String(he).split("_").map(_e=>_e.charAt(0).toUpperCase()+_e.slice(1).toLowerCase()).join(" ")},In=jt(j),Wn=jt(ne),Dn=(()=>{if(typeof P=="string"){const he=parseFloat(P.replace("%",""));if(Number.isFinite(he))return he}return B!=null?Math.round(B*100):null})();return e.jsx(Mn.AgentLiftAnalysisCard,{title:"Agent Lift Analysis",interactionDifficulty:{value:v!=null?Cn:null,label:In,sublabel:"Based on interaction type",footer:vt!=null?`${vt}% Score impact`:void 0},agentImpact:{value:B!=null?Fn:null,label:Wn,sublabel:oe,impactPercent:Dn,isLearning:String(ne??"").toLowerCase()==="learning"}})})()]})]})]}),e.jsx("div",{ref:ot,style:{paddingTop:24},children:e.jsx(Rt,{data:o?null:vn,loading:o})}),e.jsxs("div",{ref:ze,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(a.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",flexDirection:H?"column":"row",alignItems:H?"stretch":"flex-start",gap:24,alignSelf:"stretch",paddingTop:16,borderTop:"1px solid #D9D9D9"},children:[e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(Tt,{signals:jn,expandedSignals:ln,toggleSignal:un,playEvidence:pt,highlightTurns:fn,onShowInTranscript:ut,timelinePlaying:p||nt,currentTimeSeconds:f??rt})}),e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(_t.UpdatedInteractionRecording,{ref:ge,audioUrl:r,durationSeconds:gt.duration_seconds,audioRef:d,agentName:qe,customerName:ke,currentTimeSeconds:f,timelinePlaying:p,playbackRate:b,timelineSegments:S,onSeek:G,onTogglePlay:g,onSeekBack:k,onSeekForward:w,onSetPlaybackRate:I,transcript:R,activeTurnIndex:O,turnObservations:N,highlightedTurns:K,onTurnPlayPause:U,setExpandedSignals:et})})]})]}),(()=>{const s=(Z==null?void 0:Z.products)??Ae??[],v=(Z==null?void 0:Z.services)??Le??[];return!s.length&&!v.length?null:e.jsx("div",{ref:st,style:{paddingTop:24},children:e.jsx(Yt,{products:s,services:v})})})(),e.jsx("div",{ref:at,style:{paddingTop:24},children:e.jsxs($t,{comments:Ue,totalComments:Ue.length,currentUser:Y,onSendComment:Vt||(()=>{}),onSendReply:Zt||(()=>{}),onReply:Xt||(()=>{}),onEdit:Jt||(()=>{}),onDelete:en||(()=>{}),onMenuClick:tn||(()=>{}),onMarkResolved:nn||(()=>{}),isResolved:rn,children:[e.jsx(Ot,{items:ht,summary:Kt,guidanceCount:ht.length,onPlayEvidence:pt,onShowInTranscript:ut,timelinePlaying:p||nt,currentTimeSeconds:f??rt}),e.jsx(ui,{summary:Qt})]})})]}),e.jsx(Gn.SideDrawer,{open:on,onClose:()=>De(!1),title:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[e.jsx("div",{style:{width:34,height:34,borderRadius:"50%",background:"var(--surface-hover, #F3F7F7)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(a.CircleUser,{size:20,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.7})}),e.jsx("div",{style:{minWidth:0},children:e.jsx("div",{style:{fontSize:16,fontWeight:600,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:ke})})]}),subtitle:Ye?e.jsxs("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:1.5},children:[Qe," Interactions"]}):null,width:470,height:"100vh",topOffset:70,footer:Ye?e.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:e.jsxs("button",{onClick:()=>{T&&T(),De(!1)},style:{display:"flex",height:40,padding:"0 20px 0 18px",justifyContent:"center",alignItems:"center",gap:7,background:"var(--Grey-White, #FFF)",border:"1px solid var(--Grey-absent, #D9D9D9)",borderRadius:10,cursor:"pointer"},children:[e.jsx(a.History,{size:18,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:15,fontWeight:600,color:"var(--Grey-Strong, #2E3236)"},children:"View All Interactions"})]})}):null,children:e.jsx("div",{style:{borderTop:"1px solid var(--Grey-absent, #D9D9D9)",maxHeight:"100%",overflowY:"auto"},children:Ye?Oe.map((s,v)=>{const j=!!s.isCurrent,F=!j&&sn===v,z=yi(s,Ge.interaction_direction),B=z==="outbound"?a.PhoneOutgoing:a.PhoneIncoming;return e.jsxs("div",{onClick:j?void 0:()=>{h&&h(s),De(!1)},onMouseEnter:j?void 0:()=>tt(v),onMouseLeave:j?void 0:()=>tt(null),"aria-current":j?"page":void 0,style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,padding:"16px 12px",borderTop:v===0?"none":"1px solid var(--Grey-absent, #D9D9D9)",background:j?"#E3E1D7":F?"var(--surface-hover, #F3F7F7)":"var(--Grey-White, #FFF)",cursor:j?"default":"pointer",transition:"background 0.15s"},children:[e.jsxs("div",{style:{minWidth:0},children:[e.jsxs("div",{style:{fontSize:j?15:14,display:"flex",alignItems:"center",gap:6,fontWeight:j?500:400,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[z&&e.jsx(B,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5,style:{flexShrink:0},"aria-hidden":!0}),e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",minWidth:0},children:s.title})]}),s.status&&e.jsxs("div",{style:{fontSize:13,color:"var(--Grey-Strong, #2E3236)",marginBottom:12,lineHeight:1.2},children:[e.jsx("span",{style:{fontWeight:400},children:"Location: "}),e.jsx("span",{style:{fontWeight:400,color:"var(--Grey-Muted, #808183)"},children:s.location})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,flexWrap:"wrap"},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:1.1},children:[e.jsx(a.CalendarDays,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.8}),s.date]}),(s.agent||s.agent_name)&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:1.1},children:[e.jsx(a.Headset,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.8}),s.agent||s.agent_name]})]})]}),!j&&F&&e.jsx(a.ExternalLink,{size:20,color:"var(--Grey-Muted, #808183)",strokeWidth:1.7,style:{flexShrink:0}})]},s.id||v)}):e.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:140,padding:"24px 12px",color:"var(--Grey-Muted, #808183)",fontSize:14,fontStyle:"italic",textAlign:"center"},children:"No other interactions available"})})})]})},_={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))"},V=1.2,Gt=3,Ht=t=>t!=null?Math.round(t*100)+"%":"—",vi=t=>{if(t==null)return"—";const n=(t*100).toFixed(1);return t>0?`+${n}pp`:`${n}pp`},ji=({outcomeLift:t,driverLabels:n=[],showOutcomeOnly:i=!1})=>{var w;const l=ye.useMediaQuery("(max-width: 640px)");if(!t||t.lift==null)return null;const o=t.p_expected,r=t.p_full,d=t.lift_raw??(r!=null&&o!=null?r-o:null),f=t.lift,p=(w=t.interpretation)!=null&&w.lift_band?t.interpretation.lift_band.replace(/_/g," "):f>=0?"Positive":"Negative",b=p.charAt(0).toUpperCase()+p.slice(1),G=/negative/i.test(p)?a.ThumbsDown:a.ThumbsUp,g=n.slice(0,Gt),k=n.length-Gt;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",padding:24,gap:i?16:24,borderRadius:8,border:`1px solid ${_.absent}`,background:i?"#faf9f5":_.cardBg,alignSelf:"stretch"},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:i?24: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:_.strong,fontFamily:"var(--font-sans)",lineHeight:V},children:"Agent Lift Analysis"}),e.jsx("div",{style:{display:"flex",alignItems:"center",gap:8,fontFamily:"var(--font-sans)"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,paddingLeft:8},children:[e.jsx(G,{size:14,color:_.strong}),e.jsx("span",{style:{fontSize:13,fontWeight:600,color:_.strong,lineHeight:V},children:b})]})})]}),e.jsxs("div",{style:{display:"flex",flexDirection:l&&!i?"column":"row",alignItems:l&&!i?"stretch":"center",gap:l&&!i?16:24,...i?{justifyContent:"center",width:"100%"}:{}},children:[!i&&e.jsxs(e.Fragment,{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:_.muted,fontFamily:"var(--font-sans)",lineHeight:V},children:Ht(o)}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,alignItems:"flex-start",minHeight:48},children:[e.jsx("span",{style:{fontSize:13,fontWeight:400,color:_.strong,fontFamily:"var(--font-sans)",lineHeight:V,whiteSpace:"nowrap"},children:"Expected Outcome"}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:_.muted,fontFamily:"var(--font-sans)",lineHeight:V,textAlign:"left"},children:"Based on call type & difficulty"})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,alignItems:"flex-start",...l?{paddingTop:16,borderTop:`1px solid ${_.absent}`,width:"100%"}:{paddingLeft:24,borderLeft:`1px solid ${_.absent}`,flex:1,minWidth:0}},children:[e.jsx("span",{style:{fontSize:28,fontWeight:400,color:_.muted,fontFamily:"var(--font-sans)",lineHeight:V},children:vi(d)}),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:_.strong,fontFamily:"var(--font-sans)",lineHeight:V,whiteSpace:"nowrap"},children:"Agent Impact"}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:_.muted,fontFamily:"var(--font-sans)",lineHeight:V,textAlign:"left"},children:"Behavior-driven change"})]})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:i?"row":"column",gap:16,alignItems:i?"center":"flex-start",justifyContent:i?"center":void 0,...i?{}:l?{paddingTop:16,borderTop:`1px solid ${_.absent}`,width:"100%"}:{paddingLeft:24,borderLeft:`1px solid ${_.absent}`,flex:1,minWidth:0}},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",gap:4},children:e.jsx("span",{style:{fontSize:28,fontWeight:400,color:_.strong,fontFamily:"var(--font-sans)",lineHeight:V},children:Ht(r)})}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,alignItems:"flex-start",minHeight:i?void 0:48},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",gap:4},children:e.jsx("span",{style:{fontSize:13,fontWeight:i?400:600,color:_.strong,fontFamily:"var(--font-sans)",lineHeight:V,whiteSpace:"nowrap"},children:"Outcome"})}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:_.muted,fontFamily:"var(--font-sans)",lineHeight:V,textAlign:"left"},children:"With agent behaviors"})]})]})]})]}),n.length>0&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,alignSelf:"stretch"},children:[e.jsx("span",{style:{fontSize:12,fontWeight:600,color:_.strong,fontFamily:"var(--font-sans)",lineHeight:V},children:"Key Drivers"}),e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[g.map((I,W)=>e.jsx("div",{style:{display:"flex",padding:8,alignItems:"center",justifyContent:"center",borderRadius:4,border:`1px solid ${_.absent}`,background:_.white},children:e.jsx("span",{style:{fontSize:12,fontWeight:400,color:_.strong,fontFamily:"var(--font-sans)",lineHeight:V,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:200},children:I})},W)),k>0&&e.jsx("div",{style:{display:"flex",padding:8,alignItems:"center",justifyContent:"center",borderRadius:4,border:`1px solid ${_.absent}`,background:_.white},children:e.jsxs("span",{style:{fontSize:12,fontWeight:400,color:_.strong,fontFamily:"var(--font-sans)",lineHeight:V,whiteSpace:"nowrap"},children:["+ ",k]})})]})]})]})};exports.UpdatedInteractionRecording=_t.UpdatedInteractionRecording;exports.UpdatedCoachingSynthesisCard=Rt;exports.UpdatedCompassScore=At;exports.UpdatedGuidance=Ot;exports.UpdatedInteractionContext=Et;exports.UpdatedInteractionDetails=mi;exports.UpdatedInteractionScores=ji;exports.UpdatedInteractionSignals=Tt;exports.UpdatedProductsServices=Yt;exports.UpdatedThreads=$t;
|
|
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(i)return e.jsx("div",{style:{fontSize:14,color:$.muted},children:"Unable to generate coaching summary."});if(!t)return null;const o=t.strengths||[],r=t.improvements||[],d=typeof t.one_liner=="string"?t.one_liner:((p=t.one_liner)==null?void 0:p.text)||"",f=typeof t.context=="string"?t.context:((b=t.context)==null?void 0:b.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(a.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"})]}),d&&e.jsx("div",{style:{fontSize:14,fontWeight:500,color:$.strong,fontFamily:"var(--font-sans)",lineHeight:1.5},children:d}),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:$.muted,fontFamily:"var(--font-sans)",lineHeight:1.5,flex:1},children:f}),t.overall&&e.jsx(Tn,{overall:t.overall})]}),(o.length>0||r.length>0)&&e.jsxs("div",{style:{display:"flex",flexDirection:l?"column":"row",gap:24,paddingTop:24,borderTop:`1px solid ${$.absent}`},children:[e.jsx(Ct,{icon:e.jsx(a.TrendingUp,{size:14,color:$.strong,strokeWidth:1.5}),label:"Key Strengths",items:o}),e.jsx(Ct,{icon:e.jsx(a.Lightbulb,{size:14,color:$.strong,strokeWidth:1.5}),label:"Improvements",items:r})]})]})};function Bn(t){const n=Math.floor(t/60),i=Math.round(t%60);return`${n}:${i.toString().padStart(2,"0")}`}const Nn={display:"flex",justifyContent:"space-between",padding:"16px 8px 12px 8px",alignItems:"center",gap:24,fontFamily:"var(--font-sans)",fontSize:13,fontWeight:400,lineHeight:"normal",borderBottom:"1px solid var(--Grey-absent, #D9D9D9)"};function Pn({text:t,style:n}){const i=u.useRef(null),[l,o]=u.useState(!1);return u.useEffect(()=>{const r=i.current;if(!r)return;const d=()=>o(r.scrollWidth>r.clientWidth);if(d(),typeof ResizeObserver>"u")return;const f=new ResizeObserver(d);return f.observe(r),()=>f.disconnect()},[t]),e.jsx("span",{ref:i,title:l&&t!=null?String(t):void 0,style:n,children:t})}const Ft={display:"flex",flexDirection:"column",flex:"1 0 0",gap:0,minWidth:0},Tt=({meta:t={},callPurpose:n={},classification:i={},dimensions:l=[],outcomeQuality:o="Neutral",onMoreDetails:r,moreDetails:d=[],resolutionOutcome:f,customerIntent:p,location:b,interactionId:w,canShowEditButton:G=!1,onEditInteraction:g,flatView:k=!1})=>{const[S,I]=u.useState(!1),W=u.useRef(null),A=ye.useMediaQuery("(max-width: 640px)"),C=t.duration_seconds!=null?Bn(t.duration_seconds):null,D=t.message_count,_=n.interaction_driver,O=i.interaction_paradigm,N=h=>l.find(T=>(T.key||"").toLowerCase().includes(h)),K=N("resolution_outcome"),U=N("customer_intent"),E=N("location"),y=N("outcome_quality"),m=h=>h?h.replace(/_/g," ").replace(/\b\w/g,T=>T.toUpperCase()):null,x=o!=="Neutral"?o:y?m(y.value):o,ee=f??(K?m(K.value):null),ie=p??(U?m(U.value):null),re=b??(E?m(E.value):null),te=O!=null?m(O):null,se=new Set(["resolution_outcome","customer_intent","location","outcome_quality"].map(h=>`dim.${h}`)),L=l.filter(h=>!se.has(h.key)),me=[],fe=[[C!=null?{label:"Duration",value:C}:null,D!=null?{label:"Messages",value:D}:null],[_!=null?{label:"Driver",value:_}:null,re!=null?{label:"Location",value:re}:null]];for(let h=0;h<L.length;h+=2){const T=L[h]?{label:L[h].display_name||L[h].label||L[h].key,value:m(L[h].value)}:null,pe=L[h+1]?{label:L[h+1].display_name||L[h+1].label||L[h+1].key,value:m(L[h+1].value)}:null;fe.push([T,pe])}fe.push([{label:"Outcome Quality",value:x},{isMoreDetails:!0}]),fe.forEach(h=>me.push(h));const ae=[ee!=null&&{label:"Resolution Outcome",value:ee},ie!=null&&{label:"Customer Intent",value:ie},te!=null&&{label:"Paradigm",value:te},...d||[]].filter(Boolean),ue=[];if(k){const h=[C!=null&&{label:"Duration",value:C},D!=null&&{label:"Messages",value:D},_!=null&&{label:"Driver",value:_},re!=null&&{label:"Location",value:re},{label:"Outcome Quality",value:x},te!=null&&{label:"Paradigm",value:te},ee!=null&&{label:"Resolution Outcome",value:ee},ie!=null&&{label:"Customer Intent",value:ie},...L.map(T=>({label:T.display_name||T.label||T.key,value:m(T.value)})),...d||[],w!=null&&w!==""&&{label:"Number",value:w}].filter(Boolean);for(let T=0;T<h.length;T+=2)ue.push([h[T],h[T+1]||null])}const c=k?ue:me;u.useEffect(()=>{if(!S)return;const h=T=>{W.current&&!W.current.contains(T.target)&&I(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[S]);const Q=h=>e.jsxs("div",{style:Nn,children:[e.jsx("span",{style:{color:"var(--Grey-Strong, #2E3236)",whiteSpace:"nowrap",flexShrink:0},children:h.label}),e.jsx(Pn,{text:h.value,style:{color:"var(--Grey-Muted, #808183)",textAlign:"right",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,flex:1}})]},h.label),Ee=()=>e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,padding:"16px 8px 12px 8px",fontFamily:"var(--font-sans)",borderBottom:"none",minHeight:33},children:[e.jsxs("button",{onClick:()=>{I(h=>!h),r&&!S&&r()},style:{display:"flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",padding:0,color:"var(--Grey-Strong, #2E3236)",fontSize:13,fontWeight:500,lineHeight:"normal",fontFamily:"var(--font-sans)",whiteSpace:"nowrap",flexShrink:0},children:[e.jsx("span",{children:"More Details"}),S?e.jsx(a.ChevronUp,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}):e.jsx(a.ChevronDown,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5})]}),G&&e.jsxs("button",{onClick:g||(()=>{}),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(a.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:W,style:{display:"flex",flexDirection:"column",alignSelf:"stretch",gap:0,position:"relative",overflow:"visible"},children:[c.map((h,T)=>{var pe;return e.jsxs("div",{style:{display:"flex",flexDirection:A?"column":"row",alignItems:A?"stretch":"center",gap:A?8:24,alignSelf:"stretch",flexWrap:"nowrap"},children:[e.jsx("div",{style:Ft,children:h[0]&&!h[0].isMoreDetails?Q(h[0]):e.jsx("div",{style:{flex:1}})}),e.jsx("div",{style:Ft,children:h[1]&&!h[1].isMoreDetails?Q(h[1]):(pe=h[1])!=null&&pe.isMoreDetails?Ee():e.jsx("div",{style:{flex:1}})})]},T)}),!k&&S&&ae.length>0&&e.jsxs("div",{style:{position:"absolute",top:"100%",right:0,marginTop:4,display:"flex",width:340,maxWidth:"calc(100vw - 32px)",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"}),ae.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))]})]})},It=({children:t,size:n=28,onClick:i,title:l})=>{const[o,r]=u.useState(!1);return e.jsx("div",{title:l,onClick:i,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),style:{display:"flex",alignItems:"center",justifyContent:"center",width:n,height:n,borderRadius:9999,background:o?"var(--surface-hover, #F3F7F7)":"transparent",cursor:"pointer",flexShrink:0,transition:"background 0.15s"},children:t})},At=({signals:t={signals:[],present_count:0,total_signals_evaluated:0},expandedSignals:n=new Set,toggleSignal:i=()=>{},playEvidence:l=()=>{},highlightTurns:o=()=>{},onShowInTranscript:r=()=>{},timelinePlaying:d=!1,currentTimeSeconds:f=0})=>{const p=(t==null?void 0:t.signals)??[],b=(t==null?void 0:t.present_count)??p.length,w=g=>{const k=Math.floor(g/6e4),S=Math.floor(g%6e4/1e3);return`${k.toString().padStart(2,"0")}:${S.toString().padStart(2,"0")}`},G=g=>d&&g.start_ms!=null&&f*1e3>=g.start_ms&&f*1e3<=(g.end_ms??g.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(a.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:16,fontWeight:500,color:"var(--Grey-Strong, #2E3236)",fontFamily:"var(--default-font-family)"},children:"Signals"}),e.jsxs("span",{style:{fontSize:14,fontWeight:500,color:"var(--Grey-Strong, #2E3236)",fontFamily:"var(--default-font-family)"},children:[b," Signals Detected"]})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignSelf:"stretch",background:"var(--Grey-White, #FFF)",gap:8},children:[p.length===0&&e.jsx("div",{style:{padding:"8px 0",fontSize:14,color:"var(--Grey-Muted, #808183)"},children:"No signals detected."}),p.map((g,k)=>{var A,C,D;const S=g.key??g.id??k,I=n.has(S),W=((A=g.observations)==null?void 0:A.length)??0;return e.jsxs("div",{id:`signal-${S}`,style:{display:"flex",flexDirection:"column",width:"100%",gap:8},children:[e.jsxs("button",{onClick:()=>i(S),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:[g.display_name||((C=g.key)==null?void 0:C.replace(/_/g," ")),W>0&&e.jsxs("span",{style:{fontWeight:600,color:"var(--text-dark, #0B0A0A)",marginLeft:6},children:["(",W,")"]})]}),I?e.jsx(a.ChevronUp,{size:20,color:"#767473"}):e.jsx(a.ChevronDown,{size:20,color:"#767473"})]}),I&&((D=g.observations)==null?void 0:D.length)>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",alignSelf:"stretch",gap:0},children:g.observations.map((_,O)=>{var N,K,U;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:_.reason||_.explanation}),((K=(N=_.evidence)==null?void 0:N[0])==null?void 0:K.start_ms)!=null&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.jsx(It,{size:28,title:"Show in transcript",onClick:E=>{E.stopPropagation(),r(_.evidence[0].start_ms)},children:e.jsx(a.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:w(_.evidence[0].start_ms)})]})]}),(U=_.evidence)==null?void 0:U.map((E,y)=>{const m=E.start_ms!=null&&E.end_ms!=null;return E.text&&e.jsxs("div",{onClick:x=>{x.stopPropagation(),m&&l(E)},onMouseEnter:()=>o(E.turn_ids??[]),onMouseLeave:()=>o([]),style:{display:"flex",alignItems:"center",gap:8,padding:"8px 0",cursor:m?"pointer":"default"},children:[m&&e.jsx(It,{size:28,children:G(E)?e.jsx(a.PauseCircle,{size:17,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}):e.jsx(a.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:["“",E.text,"”"]})]},y)})]},_.key??O)})})]},S)})]})]})},q={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)"},$n=({score:t=4,minScore:n=0,maxScore:i=5})=>{const w=Number(t),G=Number.isFinite(w)?Math.min(Math.max(w,n),i):n,g=i>n?(G-n)/(i-n)*5:0,k=180/5,S=A=>{const C=A*Math.PI/180;return{x:121.5+85*Math.cos(C),y:123-85*Math.sin(C)}},I=(A,C)=>{const D=S(A),_=S(C),O=A-C>180?1:0;return`M ${D.x} ${D.y} A 85 85 0 ${O} 1 ${_.x} ${_.y}`},W=2;return e.jsx("svg",{width:"100%",viewBox:"0 0 243 130",fill:"none",style:{maxWidth:243},children:Array.from({length:5},(A,C)=>{const D=180-C*k-(C>0?W/2:0),_=180-(C+1)*k+(C<5-1?W/2:0),O=Math.max(0,Math.min(1,g-C)),N=I(D,_);return e.jsxs("g",{children:[e.jsx("path",{d:N,stroke:q.track,strokeWidth:30,strokeLinecap:"butt",fill:"none"}),O>0&&e.jsx("path",{d:N,stroke:q.strong,strokeWidth:30,strokeLinecap:"butt",fill:"none",pathLength:1,strokeDasharray:`${O} 1`})]},C)})})},On=({value:t=0,maxValue:n=5})=>{const i=Number(t),l=Number.isFinite(i)?Math.min(Math.max(i,0),n):0;return e.jsx("div",{style:{display:"flex",gap:2},children:Array.from({length:n},(o,r)=>{const d=Math.max(0,Math.min(1,l-r));return e.jsx("div",{style:{width:22,height:6,borderRadius:1,background:q.track,overflow:"hidden"},children:d>0&&e.jsx("div",{style:{width:`${d*100}%`,height:"100%",background:q.strong}})},r)})})},Yn={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"},qn=({text:t,children:n})=>{const[i,l]=u.useState(!1),o=u.useRef(null),[r,d]=u.useState({top:0,left:0}),f=()=>{if(o.current){const p=o.current.getBoundingClientRect();d({top:p.top-8,left:p.left+p.width/2})}l(!0)};return e.jsxs("div",{ref:o,style:{position:"relative",display:"inline-flex"},onMouseEnter:f,onMouseLeave:()=>l(!1),children:[n,i&&e.jsx("div",{style:{position:"fixed",top:r.top,left:r.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})})]})},Kn=({label:t,value:n=0,maxValue:i=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:q.strong,fontFamily:"var(--font-sans)",lineHeight:"normal"},children:t}),e.jsx(qn,{text:Yn[t]||t,children:e.jsx(a.Info,{size:14,color:q.infoIcon,strokeWidth:1,style:{cursor:"pointer"}})})]}),e.jsx(On,{value:n,maxValue:i})]}),Lt=({score:t=4,minScore:n=0,maxScore:i=5,predictedScore:l=4,predictedLabel:o="Predicted Objective",description:r="",outcomePercent:d=null,legends:f=[{label:"CSAT",value:3},{label:"Resolution",value:4},{label:"Process Adherence",value:5},{label:"Communication",value:3}]})=>{const p=ye.useMediaQuery("(max-width: 640px)"),b=Number(t),w=Number.isFinite(b)?Math.min(Math.max(b,n),i):n,G=w.toFixed(1),g=G.endsWith(".0")?G.slice(0,-2):G;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",padding:24,borderRadius:8,border:`1px solid ${q.absent}`,background:q.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:q.strong,fontFamily:"var(--font-sans)",lineHeight:1.2},children:"Interaction Quality"}),e.jsx("span",{style:{fontSize:14,fontWeight:400,color:q.muted,fontFamily:"var(--font-sans)",lineHeight:"normal"},children:r})]}),e.jsxs("div",{style:{display:"flex",flexDirection:p?"column":"row",alignItems:"center",justifyContent:"center",gap:24,flex:1,overflow:p?"visible":"hidden"},children:[e.jsxs("div",{style:{position:"relative",maxWidth:243,minWidth:p?0:160,flex:p?"0 0 auto":"0 1 243px",width:p?"100%":void 0,flexDirection:"column",alignItems:"center",display:"flex"},children:[e.jsx($n,{score:t,minScore:n,maxScore:i}),(()=>{const I=-(180-(i>n?(w-n)/(i-n):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(${I}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.jsxs("div",{style:{fontSize:28,fontWeight:400,color:q.strong,fontFamily:"var(--font-sans)",lineHeight:1,textAlign:"center",marginTop:8,display:"flex",alignItems:"baseline",justifyContent:"center",gap:6},children:[e.jsx("span",{children:g}),d!=null&&e.jsxs("span",{style:{fontSize:16,color:q.muted,lineHeight:1},children:["(",d,"%)"]})]}),e.jsx("div",{style:{fontSize:15,fontWeight:500,color:q.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,width:p?"100%":void 0},children:[e.jsx("div",{style:{fontSize:15,fontWeight:500,color:q.strong,fontFamily:"var(--font-sans)",lineHeight:1.2,textAlign:"left"},children:"Interaction Quality Index"}),e.jsx("div",{style:{width:"100%",height:1,background:q.absent}}),f.map((k,S)=>e.jsx(Kn,{label:k.label,value:k.value},S))]})]})]})},Bt=t=>{if(!t)return null;const i=String(t).trim().toLowerCase().split(/[^a-z]+/).filter(Boolean);return i.includes("supervisor")?"var(--rail-compliance, #C98A5A)":i.includes("admin")||i.includes("administrator")||i.includes("superadmin")?"var(--rail-discovery, #5E88B0)":i.includes("agent")?"var(--rail-outcome, #6B7C93)":null},Qn=t=>{var l,o,r,d,f,p;if(!t)return null;const n=t.role??t.userRole??t.user_role??t.author_role??t.roleName??t.role_name??t.userType??t.user_type??t.type;if(typeof n=="string")return n;if(Array.isArray(n))return n.join(" ");if(n&&typeof n=="object")return n.name||n.value||n.label||null;const i=((l=t.user)==null?void 0:l.role)??((o=t.user)==null?void 0:o.userRole)??((r=t.user)==null?void 0:r.user_role)??((d=t.profile)==null?void 0:d.role)??((f=t.profile)==null?void 0:f.userRole)??((p=t.profile)==null?void 0:p.user_role);return typeof i=="string"?i:Array.isArray(i)?i.join(" "):i&&typeof i=="object"&&(i.name||i.value||i.label)||null},Nt=t=>{if(!t)return"#6B7C93";const n=Qn(t);return Bt(n)||t.color||"#6B7C93"},_e=t=>(t||"").split(" ").map(n=>n[0]).join("").toUpperCase()||"U",Vn=t=>{if(!t||t==="Just now")return!0;if(/^\d{4}-\d{2}-\d{2}T/.test(t))try{const i=/Z$|[+-]\d{2}:\d{2}$/.test(t)?t:t+"Z",l=new Date(i);return Number.isNaN(l.getTime())?!1:Date.now()-l.getTime()<15*60*1e3}catch{return!1}const n=t.match(/^(\d+)\s*min/);return n?parseInt(n[1],10)<15:!(/\d+\s*h/.test(t)||/\d+\s*day/.test(t))},Zn=t=>{if(!t)return"";if(!/^\d{4}-\d{2}-\d{2}T/.test(t))return t;try{const n=/Z$|[+-]\d{2}:\d{2}$/.test(t)?t:t+"Z",i=new Date(n);if(Number.isNaN(i.getTime()))return t;const o=new Date().getTime()-i.getTime(),r=Math.floor(o/6e4),d=Math.floor(o/36e5);if(r<1)return"Just now";if(r<60)return`${r} min`;if(d<24)return`${d} h`;const f=Math.floor(d/24);return f===1?"1 day":`${f} days`}catch{return t}},Pt=({name:t,initials:n,color:i,avatar:l,size:o=36})=>l?e.jsx("img",{src:l,alt:t,style:{width:o,height:o,borderRadius:"50%",objectFit:"cover",flexShrink:0}}):e.jsx("div",{style:{width:o,height:o,borderRadius:"50%",background:i||"#6B7C93",color:"#FFF",display:"flex",alignItems:"center",justifyContent:"center",fontSize:o<=32?"10px":"11px",fontWeight:650,flexShrink:0,fontFamily:"var(--default-font-family)",letterSpacing:"0.02em"},title:t,children:n||_e(t)}),Xn=({comment:t,isReply:n=!1,isConsecutive:i=!1,onReply:l,onSendReply:o,onEdit:r,onDelete:d,onMenuClick:f,showReply:p=!0})=>{var ae,ue;const[b,w]=u.useState(!1),[G,g]=u.useState(!1),[k,S]=u.useState(!1),[I,W]=u.useState(""),[A,C]=u.useState(!1),[D,_]=u.useState(""),[O,N]=u.useState(!1),K=u.useRef(null),U=u.useRef(null),E=u.useRef(null),y=t.author||{},m=y.name||t.author_name||"Unknown",x=y.initials||_e(m),ee=y.role||t.author_role,ie=y.color||Bt(ee)||"#6B7C93",re=y.avatar||t.avatar,te=t.timestamp||t.created_at,se=Zn(te),L=Vn(te),me=!!(t.isEdited||t.is_edited||t.edited),fe=Array.isArray(t.content)?t.content:[t.content||t.text||""];return u.useEffect(()=>{if(!G)return;const c=Q=>{K.current&&!K.current.contains(Q.target)&&g(!1)};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[G]),u.useEffect(()=>{const c=U.current;if(!c)return;c.style.height="auto";const Q=140;c.style.height=Math.min(c.scrollHeight,Q)+"px",c.style.overflowY=c.scrollHeight>Q?"auto":"hidden"},[I,k]),u.useEffect(()=>{const c=E.current;if(!c)return;c.style.height="auto";const Q=140;c.style.height=Math.min(c.scrollHeight,Q)+"px",c.style.overflowY=c.scrollHeight>Q?"auto":"hidden"},[D,A]),e.jsxs("div",{onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),style:{display:"flex",paddingLeft:n?48:0,alignItems:"flex-start",gap:16,paddingTop:i?0:8,paddingBottom:8},children:[i?e.jsx("div",{style:{width:36,flexShrink:0}}):e.jsx(Pt,{name:m,initials:x,color:ie,avatar:re}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:i?"flex-end":"space-between",marginBottom:i?0:6},children:[!i&&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:m}),e.jsx("span",{style:{fontSize:12,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:"150%",fontFamily:"var(--default-font-family)"},children:se}),me&&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:K,children:[e.jsx("button",{type:"button",onClick:()=>g(c=>!c),style:{padding:2,border:"none",background:"transparent",cursor:"pointer",borderRadius:4,display:"flex",alignItems:"center",justifyContent:"center",opacity:b||G?1:0,transition:"opacity 0.15s",flexShrink:0},children:e.jsx(a.Ellipsis,{size:24,color:"var(--Grey-Muted, #808183)"})}),G&&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:()=>{g(!1),C(!1),S(!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:c=>{c.currentTarget.style.background="var(--surface-hover, #F3F7F7)"},onMouseLeave:c=>{c.currentTarget.style.background="transparent"},children:"Reply"}),r&&e.jsx("button",{type:"button",disabled:!L,onClick:()=>{if(!L)return;g(!1);const c=Array.isArray(t.content)?t.content.join(`
|
|
16
|
+
`):t.content||t.text||"";_(c),C(!0),S(!1)},style:{display:"flex",width:"100%",padding:"10px 16px",alignItems:"center",border:"none",background:"transparent",cursor:L?"pointer":"not-allowed",fontSize:13,fontWeight:400,color:L?"var(--Grey-Strong, #2E3236)":"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",lineHeight:"150%",textAlign:"left",opacity:L?1:.5},onMouseEnter:c=>{L&&(c.currentTarget.style.background="var(--surface-hover, #F3F7F7)")},onMouseLeave:c=>{c.currentTarget.style.background="transparent"},children:"Edit"}),d&&e.jsx("button",{type:"button",onClick:()=>{g(!1),N(!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:c=>{c.currentTarget.style.background="var(--surface-hover, #F3F7F7)"},onMouseLeave:c=>{c.currentTarget.style.background="transparent"},children:"Delete"})]})]})]}),A?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:["“"," ",((ae=t.author)==null?void 0:ae.name)||"Unknown"]}),e.jsx("button",{type:"button",onClick:()=>C(!1),style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0},children:e.jsx(a.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:E,value:D,onChange:c=>_(c.target.value),onKeyDown:c=>{if(c.key==="Enter"){if(c.metaKey||c.ctrlKey||c.shiftKey)return;c.preventDefault(),D.trim()&&(r==null||r({...t,content:D.trim(),isEdited:!0}),C(!1))}c.key==="Escape"&&C(!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()&&(r==null||r({...t,content:D.trim(),isEdited:!0}),C(!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:fe.map((c,Q)=>e.jsx("div",{style:{fontSize:13,fontWeight:400,color:"var(--text-ink, #1E2125)",lineHeight:"160%",fontFamily:"var(--default-font-family)",padding:"8px 12px",background:n?"var(--surface-hover, #F3F7F7)":"var(--surface-warm-40, rgba(243, 241, 229, 0.40))",borderRadius:8,wordBreak:"break-word",whiteSpace:"pre-wrap"},children:c},Q))}),O&&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:()=>{N(!1),d==null||d(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:c=>{c.currentTarget.style.background="var(--Grey-absent, #D9D9D9)"},onMouseLeave:c=>{c.currentTarget.style.background="var(--grey-light, #e9e8e8a1)"},children:"Delete"}),e.jsx("button",{type:"button",onClick:()=>N(!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:c=>{c.currentTarget.style.background="var(--grey-light, #e9e8e8a1)"},onMouseLeave:c=>{c.currentTarget.style.background="none"},children:"Cancel"})]}),p&&l&&!k&&!O&&e.jsxs("button",{type:"button",onClick:()=>{C(!1),S(!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(a.CornerDownRight,{size:20,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),"Reply"]}),k&&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:["“"," ",((ue=t.author)==null?void 0:ue.name)||"Unknown"]}),e.jsx("button",{type:"button",onClick:()=>{W(""),S(!1)},style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0},children:e.jsx(a.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:U,value:I,onChange:c=>W(c.target.value),onKeyDown:c=>{if(c.key==="Enter"){if(c.metaKey||c.ctrlKey||c.shiftKey)return;c.preventDefault(),I.trim()&&(o==null||o({content:I.trim(),parentId:t.id}),W(""),S(!1))}c.key==="Escape"&&(W(""),S(!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:()=>{I.trim()&&(o==null||o({content:I.trim(),parentId:t.id}),W(""),S(!1))},disabled:!I.trim(),style:{display:"flex",height:28,padding:"8px 12px",justifyContent:"center",alignItems:"center",gap:8,fontSize:13,fontWeight:600,color:I.trim()?"var(--Grey-White, #FFF)":"var(--Grey-Muted, #808183)",background:I.trim()?"var(--Neutral-850, #272727)":"var(--grey-light, #e9e8e8a1)",border:"none",borderRadius:10,cursor:I.trim()?"pointer":"not-allowed",fontFamily:"var(--default-font-family)",lineHeight:"150%"},children:"Post"})]})]})]})]})},Jn=({currentUser:t,onSubmit:n})=>{const[i,l]=u.useState(""),[o,r]=u.useState(!1),d=u.useRef(null);u.useEffect(()=>{const g=d.current;if(!g)return;g.style.height="auto";const k=140;g.style.height=Math.min(g.scrollHeight,k)+"px",g.style.overflowY=g.scrollHeight>k?"auto":"hidden"},[i]);const f=()=>{const g=i.trim();g&&(n==null||n(g),l(""))},p=g=>{if(g.key==="Enter"){if(g.metaKey||g.ctrlKey||g.shiftKey)return;g.preventDefault(),f()}},b=(t==null?void 0:t.initials)||_e(t==null?void 0:t.name),w=Nt(t),G=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:b,color:w,avatar:G}),e.jsx("div",{style:{flex:1,padding:12,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:24,borderRadius:8,border:o?"1px solid var(--Grey-Strong, #2E3236)":"1px solid var(--Grey-absent, #D9D9D9)",background:"var(--Grey-White, #FFF)",transition:"border-color 0.15s"},children:e.jsxs("div",{style:{display:"flex",alignItems:"flex-end",gap:8,width:"100%"},children:[e.jsx("textarea",{ref:d,value:i,onChange:g=>l(g.target.value),onFocus:()=>r(!0),onBlur:()=>r(!1),onKeyDown:p,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:f,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)",transition:"all 0.15s",flexShrink:0,lineHeight:"150%"},children:"Post"})]})})]})},$t=({comment:t,depth:n=0,isConsecutive:i=!1,onReply:l,onSendReply:o,onEdit:r,onDelete:d,onMenuClick:f})=>{const p=t.replies&&t.replies.length>0,b=!p;return e.jsxs(u.Fragment,{children:[e.jsx("div",{style:{paddingLeft:n>0?Math.min(n*32,128):0},children:e.jsx(Xn,{comment:t,isReply:n>0,isConsecutive:i,onReply:l,onSendReply:o,onEdit:r,onDelete:d,onMenuClick:f,showReply:b})}),p&&t.replies.map(w=>e.jsx($t,{comment:w,depth:n+1,onReply:l,onSendReply:o,onEdit:r,onDelete:d,onMenuClick:f},w.id))]})},Ot=({comments:t=[],totalComments:n,children:i,onSendComment:l,onReply:o,onSendReply:r,onEdit:d,onDelete:f,onMenuClick:p,onMarkResolved:b,currentUser:w,isResolved:G=!1})=>{const[g,k]=u.useState([]),[S,I]=u.useState(!1),W=u.useMemo(()=>{const y=new Set(t.map(x=>x.id)),m=g.filter(x=>!y.has(x.id));return[...t,...m]},[t,g]);u.useEffect(()=>{const y=new Set(t.map(m=>m.id));k(m=>m.filter(x=>!y.has(x.id)))},[t]);const A=u.useMemo(()=>{if(!w)return{name:"You",initials:"YO",color:"#6B7C93"};const y=w.name||"You",m=w.initials||_e(y),x=Nt(w);return{...w,name:y,initials:m,color:x}},[w]),C=async({content:y,parentId:m})=>{if(r){I(!0);try{await r({content:y,parentId:m})}finally{I(!1)}}else{const x={id:`temp-${Date.now()}`,author:A,content:y,timestamp:"Just now",parentId:m,isOptimistic:!0};k(ee=>[...ee,x])}},D=async y=>{if(l){I(!0);try{await l(y)}finally{I(!1)}}else{const m={id:`temp-${Date.now()}`,author:A,content:y,timestamp:"Just now",isOptimistic:!0};k(x=>[...x,m])}},_=y=>{k(m=>m.map(x=>x.id===y.id?{...x,content:y.content,isEdited:!0}:x)),d==null||d(y)},O=y=>{k(m=>m.filter(x=>x.id!==y.id)),f==null||f(y)},N=u.useMemo(()=>{const y={};W.forEach(x=>{x.parentId&&(y[x.parentId]||(y[x.parentId]=[]),y[x.parentId].push(x))});const m=x=>({...x,replies:(y[x.id]||[]).map(m)});return W.filter(x=>!x.parentId).map(m)},[W]),K=n??W.length,U=ye.useMediaQuery("(max-width: 900px)"),E=ye.useMediaQuery("(max-width: 640px)");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(a.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",flexDirection:U?"column":"row",gap:24,alignSelf:"stretch"},children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",flexWrap:E?"wrap":"nowrap",gap:E?10: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(a.MessagesSquare,{style:{width:20,height:20,flexShrink:0},color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.5})}),e.jsx("span",{style:{fontSize:16,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:[K," Comment",K!==1?"s":""]}),G?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(a.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"})]}):b?e.jsxs("button",{type:"button",onClick:b,style:{display:"flex",alignItems:"center",justifyContent:"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,...E?{width:"100%",order:1}:{}},children:[e.jsx(a.CircleCheck,{size:16,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.5}),"Mark as Resolved"]}):null]}),W.length>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:0,marginBottom:24,maxHeight:600,overflowY:W.length>6?"auto":"visible"},children:N.map((y,m)=>{var te,se;const x=m>0?N[m-1]:null,ee=((te=x==null?void 0:x.author)==null?void 0:te.name)||(x==null?void 0:x.author_name),ie=((se=y.author)==null?void 0:se.name)||y.author_name,re=x&&ee===ie&&(!x.replies||x.replies.length===0);return e.jsx($t,{comment:y,depth:0,isConsecutive:!!re,onReply:o,onSendReply:C,onEdit:_,onDelete:O,onMenuClick:p},y.id)})}),W.length>0&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:16,marginLeft:48},children:[e.jsx(a.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."})]}),S&&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(Jn,{currentUser:A,onSubmit:D})]}),e.jsx("div",{style:{flex:1,minWidth:0},children:i})]})]})},M={strong:"var(--Grey-Strong, #2E3236)",muted:"var(--Grey-Muted, #808183)",border:"var(--Grey-absent, #D9D9D9)",surfaceHover:"var(--surface-hover, #F3F7F7)",warmBorder:"var(--border-warm, #B2AEA8)",quoteText:"var(--text-subtle-warm, #767473)",toneGreen:"var(--state-present, #25A372)",toneAmber:"var(--rail-orange, #C98A5A)",toneRed:"var(--color-red-strong, #D04A4A)",impactPositiveBg:"rgba(37, 163, 114, 0.12)",impactPositiveInk:"var(--state-present, #25A372)",impactNegativeBg:"rgba(208, 74, 74, 0.12)",impactNegativeInk:"var(--color-red-strong, #D04A4A)"},Un="var(--font-sans, 'Averta', ui-sans-serif, system-ui, sans-serif)",Wt=({children:t,size:n=24,onClick:i,title:l})=>{const[o,r]=u.useState(!1);return e.jsx("div",{title:l,onClick:i,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),style:{display:"flex",alignItems:"center",justifyContent:"center",width:n,height:n,borderRadius:9999,background:o?M.surfaceHover:"transparent",cursor:"pointer",flexShrink:0,transition:"background 0.15s"},children:t})},ei=t=>{const n=Math.floor(t/6e4),i=Math.floor(t%6e4/1e3);return`${n.toString().padStart(2,"0")}:${i.toString().padStart(2,"0")}`},ti=({icon:t})=>{const n={size:16,color:M.strong,strokeWidth:1.5};return t==="thumbs_down"?e.jsx(a.ArrowDown,{...n}):t==="focus"?e.jsx(a.Target,{...n}):e.jsx(a.ArrowUp,{...n})},ni=({label:t,direction:n})=>{if(!t)return null;const i=n==="negative"?a.ArrowDown:a.ArrowUp;return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,background:M.surfaceHover,color:M.strong,padding:"2px 8px",borderRadius:9999,fontSize:12,fontWeight:500,lineHeight:1.4,whiteSpace:"nowrap",flexShrink:0},children:[t,e.jsx(i,{size:12,color:M.strong,strokeWidth:2})]})},ii=({evidence:t,onPlayEvidence:n,onShowInTranscript:i,timelinePlaying:l,currentTimeSeconds:o})=>{const r=t.start_ms??t.startMs,d=t.end_ms??t.endMs,f=r!=null,p=(o??0)*1e3,b=l&&f&&p>=r&&p<=(d??r+5e3);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,paddingLeft:12,borderLeft:`2px solid ${M.warmBorder}`},children:[e.jsxs("span",{style:{fontSize:13,fontWeight:400,color:M.quoteText,lineHeight:1.5,fontStyle:"italic",wordBreak:"break-word"},children:["“",t.text,"”"]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,minHeight:24},children:[t.actor&&e.jsx("span",{style:{fontSize:12,fontWeight:500,color:M.muted,textTransform:"capitalize"},children:t.actor}),f&&e.jsxs(e.Fragment,{children:[e.jsx(Wt,{size:24,title:b?"Pause":"Play evidence",onClick:()=>n==null?void 0:n({start_ms:r,end_ms:d}),children:b?e.jsx(a.PauseCircle,{size:16,color:M.strong,strokeWidth:1.25}):e.jsx(a.PlayCircle,{size:16,color:M.muted,strokeWidth:1.25})}),e.jsx(Wt,{size:24,title:"Show in transcript",onClick:()=>i==null?void 0:i(r),children:e.jsx(a.ScrollText,{size:16,color:M.muted,strokeWidth:1.5})}),e.jsx("span",{style:{fontSize:12,fontWeight:400,color:M.muted,lineHeight:1.2,whiteSpace:"nowrap"},children:ei(r)})]})]})]})},ri=({signal:t,onPlayEvidence:n,onShowInTranscript:i,timelinePlaying:l,currentTimeSeconds:o})=>{const r=Array.isArray(t.evidence)?t.evidence:[],d=r.length>0,[f,p]=u.useState(!1);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[e.jsx(ni,{label:t.impact_label,direction:t.impact_direction}),d&&e.jsxs("button",{type:"button",onClick:()=>p(b=>!b),style:{display:"inline-flex",alignItems:"center",gap:2,background:"transparent",border:"none",padding:0,cursor:"pointer",fontSize:12,fontWeight:500,color:M.muted,fontFamily:"inherit"},children:[f?e.jsx(a.ChevronDown,{size:14,color:M.muted,strokeWidth:1.5}):e.jsx(a.ChevronRight,{size:14,color:M.muted,strokeWidth:1.5}),r.length," ",r.length===1?"quote":"quotes"]})]}),f&&d&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12,paddingTop:4},children:r.map((b,w)=>e.jsx(ii,{evidence:b,onPlayEvidence:n,onShowInTranscript:i,timelinePlaying:l,currentTimeSeconds:o},w))})]})},li=({item:t,isLast:n,onPlayEvidence:i,onShowInTranscript:l,timelinePlaying:o,currentTimeSeconds:r})=>{const d=Array.isArray(t.signals)?t.signals:[];return e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:12,padding:"16px 16px",borderBottom:n?"none":`1px solid ${M.border}`},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:16,height:16,flexShrink:0,marginTop:2},children:e.jsx(ti,{icon:t.icon,tone:t.tone})}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,flex:1,minWidth:0},children:[e.jsx("span",{style:{fontFamily:Un,fontSize:14,fontWeight:400,color:M.strong,lineHeight:"normal",wordBreak:"break-word"},children:t.title||""}),d.length>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:d.map((f,p)=>e.jsx(ri,{signal:f,onPlayEvidence:i,onShowInTranscript:l,timelinePlaying:o,currentTimeSeconds:r},f.signal_key||p))})]})]})},oi=({summary:t})=>{if(!t||typeof t!="object")return null;const n=Number(t.focus_count)||0,i=Number(t.opportunity_count)||0,l=Number(t.excellence_count)||0;if(n+i+l===0)return null;const o=[{key:"excellence",label:"Excellence",count:l,Icon:a.ArrowUp,color:M.strong},{key:"opportunity",label:"Opportunity",count:i,Icon:a.ArrowDown,color:M.strong},{key:"focus",label:"Focus",count:n,Icon:a.Target,color:M.strong}].filter(r=>r.count>0);return e.jsx("div",{style:{display:"flex",alignItems:"center",gap:16,padding:"8px 16px",background:M.surfaceHover,borderRadius:8},children:o.map(({key:r,label:d,count:f,Icon:p,color:b})=>e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(p,{size:14,color:b,strokeWidth:1.75}),e.jsx("span",{style:{fontSize:13,fontWeight:600,color:M.strong,lineHeight:1.2},children:f}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:M.muted,lineHeight:1.2},children:d})]},r))})},si=5,Yt=({items:t=[],summary:n,guidanceCount:i,loading:l=!1,onPlayEvidence:o,onShowInTranscript:r,timelinePlaying:d=!1,currentTimeSeconds:f=0})=>{const p=Array.isArray(t)?t.filter(Boolean).slice(0,si):[],b=i??p.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:M.surfaceHover,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(a.Lightbulb,{style:{width:20,height:20,flexShrink:0},color:M.strong,strokeWidth:1.5})}),e.jsx("span",{style:{flex:1,fontSize:16,fontWeight:500,color:M.strong,lineHeight:1.2},children:"Guidance"}),e.jsxs("span",{style:{fontSize:14,fontWeight:500,color:M.strong,lineHeight:1.5,whiteSpace:"nowrap"},children:[b," Item",b!==1?"s":""]})]}),e.jsx(oi,{summary:n}),p.map((w,G)=>e.jsx(li,{item:w,isLast:G===p.length-1,onPlayEvidence:o,onShowInTranscript:r,timelinePlaying:d,currentTimeSeconds:f},G))]})},J={strong:"var(--Grey-Strong, #2E3236)",muted:"var(--Grey-Muted, #808183)",border:"var(--Grey-absent, #D9D9D9)",surface:"var(--Grey-White, #FFF)",surfaceHover:"var(--surface-hover, #F3F7F7)"},Re="var(--font-sans, 'Averta', ui-sans-serif, system-ui, sans-serif)",ai=[{key:"lookup_hold",label:"Lookup",Icon:a.Search},{key:"formal_hold",label:"Hold",Icon:a.Pause},{key:"extended_hold",label:"Extended",Icon:a.Pause},{key:"transfer_hold",label:"Transfer",Icon:a.ArrowRightLeft},{key:"probable_hold",label:"Possible",Icon:a.CircleDashed},{key:"dead_air",label:"Dead air",Icon:a.MicOff}],di=t=>{if(t==null||Number.isNaN(t))return"—";const n=Number(t);return Number.isFinite(n)?n>=1e3?`${(n/1e3).toFixed(1)}s`:`${Math.round(n)}ms`:"—"},ci=t=>{if(t==null||Number.isNaN(t))return null;const n=Number(t);return Number.isFinite(n)?`${(n*100).toFixed(1)}%`:null},Ze=t=>{if(t==null||Number.isNaN(t))return null;const n=Number(t);return Number.isFinite(n)?n.toLocaleString():null},fi=({holdTypeCounts:t})=>{if(!t||typeof t!="object")return null;const n=ai.map(i=>({...i,count:Number(t[i.key])||0})).filter(i=>i.count>0);return n.length===0?null:e.jsx("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:16,padding:"8px 16px",background:J.surfaceHover,borderRadius:8},children:n.map(({key:i,label:l,Icon:o,count:r})=>e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(o,{size:14,color:J.strong,strokeWidth:1.5}),e.jsx("span",{style:{fontFamily:Re,fontSize:13,fontWeight:600,color:J.strong,lineHeight:1.2},children:r}),e.jsx("span",{style:{fontFamily:Re,fontSize:13,fontWeight:400,color:J.muted,lineHeight:1.2},children:l})]},i))})},ui=({summary:t})=>{const n=Ze(t==null?void 0:t.stall_count);if(!n)return null;const i=ci(t==null?void 0:t.stall_rate),l=Ze(t==null?void 0:t.stall_filler_count),o=Ze(t==null?void 0:t.stall_buying_time_count),r=[];return l&&r.push(`filler ${l}`),o&&r.push(`buying time ${o}`),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",fontFamily:Re,fontSize:13,lineHeight:1.4},children:[e.jsxs("span",{style:{fontWeight:500,color:J.strong},children:["Stalls: ",n,i?` (${i})`:""]}),r.length>0&&e.jsxs("span",{style:{color:J.muted},children:["· ",r.join(" · ")]})]})},Dt=({label:t,percentiles:n})=>{if(!n||typeof n!="object")return null;const i=[{key:"p50",label:"p50",value:n.p50},{key:"p75",label:"p75",value:n.p75},{key:"p95",label:"p95",value:n.p95},{key:"p99",label:"p99",value:n.p99}].filter(l=>l.value!=null);return i.length===0?null:e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:12,flexWrap:"wrap",fontFamily:Re,fontSize:13,lineHeight:1.4},children:[e.jsx("span",{style:{fontWeight:500,color:J.strong,minWidth:72},children:t}),i.map(l=>e.jsxs("span",{style:{color:J.muted},children:[e.jsx("span",{style:{fontWeight:500,color:J.strong},children:l.label})," ",di(l.value)]},l.key))]})},pi=({summary:t})=>{if(!t||typeof t!="object")return null;const n=!!t.hold_type_counts&&Object.values(t.hold_type_counts).some(d=>Number(d)>0),i=(Number(t.stall_count)||0)>0,l=t.agent_response_percentiles_ms,o=t.customer_response_percentiles_ms,r=l&&Object.values(l).some(d=>d!=null)||o&&Object.values(o).some(d=>d!=null);return!n&&!i&&!r?null:e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch",gap:12,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:J.surfaceHover,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(a.AudioLines,{size:20,color:J.strong,strokeWidth:1.5})}),e.jsx("span",{style:{flex:1,fontFamily:"Varta, var(--font-sans, sans-serif)",fontSize:16,fontWeight:700,color:J.strong,lineHeight:1.2,whiteSpace:"nowrap"},children:"Talk Patterns"})]}),n&&e.jsx(fi,{holdTypeCounts:t.hold_type_counts}),(i||r)&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,padding:"12px 16px",border:`1px solid ${J.border}`,borderRadius:8},children:[i&&e.jsx(ui,{summary:t}),r&&e.jsxs(e.Fragment,{children:[e.jsx(Dt,{label:"Agent",percentiles:l}),e.jsx(Dt,{label:"Customer",percentiles:o})]})]})]})},le={strong:"var(--Grey-Strong, #2E3236)",muted:"var(--Grey-Muted, #808183)",border:"var(--Grey-absent, #D9D9D9)",surfaceHover:"var(--surface-hover, #F3F7F7)",iconAccent:"var(--rail-orange, #C98A5A)"},ke="var(--font-sans, 'Averta', ui-sans-serif, system-ui, sans-serif)",zt=t=>{if(t==null)return null;if(typeof t=="string")return{name:t,percent:null};const n=t.name??t.label??t.title??"";return n?{name:n,percent:t.percent!=null?t.percent:t.percentage!=null?t.percentage:null}:null},gi=t=>{if(t==null)return null;const n=Number(t);return Number.isFinite(n)?`${(Math.abs(n)<=1?n*100:n).toFixed(1)} %`:null},hi=({name:t,percent:n})=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"12px 0",borderBottom:`1px solid ${le.border}`,width:"100%"},children:[e.jsx("span",{style:{flex:1,minWidth:0,fontFamily:ke,fontSize:13,fontWeight:400,color:le.strong,lineHeight:"24px",wordBreak:"break-word"},children:t}),n!=null&&e.jsx("span",{style:{fontFamily:ke,fontSize:13,fontWeight:400,color:le.muted,lineHeight:"24px",whiteSpace:"nowrap",flexShrink:0},children:gi(n)})]}),Mt=({title:t,items:n,initialVisibleCount:i})=>{const[l,o]=u.useState(!1);if(!n.length)return null;const r=Math.max(0,n.length-i),d=l?n:n.slice(0,i);return e.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:8},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"8px 0",width:"100%"},children:e.jsx("span",{style:{flex:1,minWidth:0,fontFamily:ke,fontSize:15,fontWeight:600,color:le.strong,lineHeight:"24px",wordBreak:"break-word"},children:t})}),e.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%"},children:d.map((f,p)=>e.jsx(hi,{name:f.name,percent:f.percent},p))}),r>0&&e.jsxs("button",{type:"button",onClick:()=>o(f=>!f),style:{display:"inline-flex",alignItems:"center",gap:6,height:29,padding:"8px 0",background:"transparent",border:"none",cursor:"pointer",fontFamily:ke,fontSize:13,fontWeight:600,color:le.strong,lineHeight:1.2,whiteSpace:"nowrap"},children:[l?"Show Less":`${r} More`,l?e.jsx(a.ChevronUp,{size:16,color:le.strong,strokeWidth:1.75}):e.jsx(a.ChevronDown,{size:16,color:le.strong,strokeWidth:1.75})]})]})},qt=({products:t=[],services:n=[],title:i="Products & Services",productsTitle:l="Products Discussed",servicesTitle:o="Services Discussed",initialVisibleCount:r=4})=>{const d=(t||[]).map(zt).filter(Boolean),f=(n||[]).map(zt).filter(Boolean);return!d.length&&!f.length?null:e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch",gap:16,width:"100%",background:"var(--Grey-White, #FFF)"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",gap:16,height:40,borderBottom:`1px solid ${le.border}`,width:"100%"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:0},children:[e.jsx(a.ClipboardCheck,{size:24,color:le.iconAccent,strokeWidth:1.5}),e.jsx("span",{style:{fontFamily:ke,fontSize:16,fontWeight:600,color:le.strong,lineHeight:1.2,textTransform:"uppercase",whiteSpace:"nowrap"},children:i})]})}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:24,flexWrap:"wrap",width:"100%"},children:[e.jsx(Mt,{title:l,items:d,initialVisibleCount:r}),e.jsx(Mt,{title:o,items:f,initialVisibleCount:r})]})]})},xe=({text:t,children:n})=>{const[i,l]=u.useState(!1),o=u.useRef(null),[r,d]=u.useState({top:0,left:0});if(!t)return n;const f=()=>{if(o.current){const p=o.current.getBoundingClientRect();d({top:p.bottom+6,left:p.left+p.width/2})}l(!0)};return e.jsxs("div",{ref:o,style:{position:"relative",display:"inline-flex"},onMouseEnter:f,onMouseLeave:()=>l(!1),children:[n,i&&e.jsx("div",{style:{position:"fixed",top:r.top,left:r.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})})]})},Gt=[{key:"overview",label:"Overview"},{key:"coaching",label:"Coaching Summary"},{key:"signals",label:"Signals & Recording"},{key:"comments",label:"Feedback"}];function xi(t){return/\bagent\b/.test(String(t??"").toLowerCase())}function yi(t){return/(admin|superadmin|administrator)/.test(String(t??"").toLowerCase())}function mi(t,n){const i=(t==null?void 0:t.direction)??(t==null?void 0:t.interaction_direction)??(t==null?void 0:t.call_direction)??n;if(i==null||i==="")return null;const l=String(i).toLowerCase().trim();return l==="outbound"||l.startsWith("outbound")?"outbound":l==="inbound"||l.startsWith("inbound")?"inbound":null}const vi=({title:t="Wheel Stud Replacement Enquiry",onBack:n,data:i,coachingData:l,coachingLoading:o=!1,audioUrl:r,audioRef:d,currentTimeSeconds:f,timelinePlaying:p,playbackRate:b,timelineSegments:w,onSeek:G,onTogglePlay:g,onSeekBack:k,onSeekForward:S,onSetPlaybackRate:I,agentName:W,agentFullName:A,customerName:C,customerFullName:D,transcript:_,activeTurnIndex:O,turnObservations:N,highlightedTurns:K,onTurnPlayPause:U,onPlayEvidence:E,onHighlightTurns:y,callPurpose:m,classification:x,outcomeQuality:ee,resolutionOutcome:ie,customerIntent:re,location:te,interactionId:se,moreDetails:L,compassScore:me,compassMaxScore:fe=5,compassScorePct:ae=null,predictedCsat:ue,predictedLabel:c="Predicted Objective",compassLegends:Q,customerSessions:Ee,customerSessionCount:h,onSessionClick:T,onViewAllSessions:pe,prevSessionDesc:Xe,prevSessionDisabled:de=!1,nextSessionDesc:Je,nextSessionDisabled:ce=!1,onPreviousSession:Ce,onNextSession:Fe,comments:Ue=[],guidance:Kt=[],guidanceSummary:Qt,talkPatterns:Vt,productsServices:Z,productsDiscussed:Te,servicesDiscussed:Ae,currentUser:Y,onSendComment:Zt,onSendReply:Xt,onReply:Jt,onEdit:Ut,onEditInteraction:en,onDelete:tn,onMenuClick:nn,onMarkResolved:rn,commentsResolved:ln})=>{var vt;const[Le,Ie]=u.useState("overview"),[on,et]=u.useState(new Set),[sn,We]=u.useState(!1),[an,tt]=u.useState(null),[nt,it]=u.useState(!1),[rt,dn]=u.useState(0),[lt,cn]=u.useState(!1),H=ye.useMediaQuery("(max-width: 640px)"),ge=u.useRef(null),Be=u.useRef(null),ot=u.useRef(null),De=u.useRef(null),st=u.useRef(null),at=u.useRef(null),dt={overview:Be,coaching:ot,signals:De,products:st,comments:at},be=u.useRef(null),Ne=u.useRef(!1),ct=u.useMemo(()=>{const s=(Z==null?void 0:Z.products)??Te??[],v=(Z==null?void 0:Z.services)??Ae??[];return s.length>0||v.length>0},[Z,Te,Ae]),Pe=u.useMemo(()=>{if(!ct)return Gt;const s=[];for(const v of Gt)v.key==="comments"&&s.push({key:"products",label:"Products & Services"}),s.push(v);return s},[ct]);u.useEffect(()=>{const s=be.current;if(!s)return;const v=Pe.map(P=>P.key),j=v.map(P=>dt[P]),z=(P=>{let ne=P.parentElement;for(;ne;){const{overflow:je,overflowY:oe}=window.getComputedStyle(ne);if(/(auto|scroll)/.test(je+oe))return ne;ne=ne.parentElement}return null})(s),B=()=>{var je;if(Ne.current)return;let P=v[0];for(let oe=j.length-1;oe>=0;oe--){const Qe=j[oe].current;if(!Qe)continue;if(Qe.getBoundingClientRect().top<=150){P=v[oe];break}}Ie(P);const ne=((je=Be.current)==null?void 0:je.getBoundingClientRect().top)??Number.POSITIVE_INFINITY;cn(ne<=150)};return s.addEventListener("scroll",B,{passive:!0}),z&&z!==s&&z.addEventListener("scroll",B,{passive:!0}),window.addEventListener("scroll",B,{passive:!0,capture:!0}),B(),()=>{s.removeEventListener("scroll",B),z&&z!==s&&z.removeEventListener("scroll",B),window.removeEventListener("scroll",B,{capture:!0})}},[Pe]);const ft=u.useRef(null),fn=s=>{var j;Ie(s),Ne.current=!0,ft.current=s;const v=(j=dt[s])==null?void 0:j.current;if(v){const F=be.current;if(F&&F.scrollHeight>F.clientHeight){const z=F.getBoundingClientRect().top,P=v.getBoundingClientRect().top-z+F.scrollTop-16;F.scrollTo({top:P,behavior:"smooth"})}else{const z=v.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:z,behavior:"smooth"})}}setTimeout(()=>{Ne.current=!1,ft.current=null},1200)},$e=Ee||[],Oe=$e.length>1,ut=s=>{Ie("signals");const v=De.current;if(v){const F=be.current;if(F&&F.scrollHeight>F.clientHeight){const z=F.getBoundingClientRect().top,P=v.getBoundingClientRect().top-z+F.scrollTop-16;F.scrollTo({top:P,behavior:"smooth"})}else{const z=v.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:z,behavior:"smooth"})}}const j=s/1e3;setTimeout(()=>{var F;(F=ge.current)!=null&&F.scrollToTranscript&&ge.current.scrollToTranscript(j)},220)},pt=s=>{Ie("signals");const v=De.current;if(v){const F=be.current;if(F&&F.scrollHeight>F.clientHeight){const z=F.getBoundingClientRect().top,P=v.getBoundingClientRect().top-z+F.scrollTop-16;F.scrollTo({top:P,behavior:"smooth"})}else{const z=v.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:z,behavior:"smooth"})}}const j=(s==null?void 0:s.start_ms)??(s==null?void 0:s.startMs);setTimeout(()=>{var F,z;if(j!=null&&((F=ge.current)!=null&&F.scrollToTranscript)&&ge.current.scrollToTranscript(j/1e3),E)E(s);else if(j!=null&&((z=ge.current)!=null&&z.seekTo)){ge.current.seekTo(j/1e3),it(!0),dn(j/1e3);const P=(s.end_ms??s.endMs??j+5e3)-j;setTimeout(()=>it(!1),P)}},220)},un=s=>{y&&y(s)},pn=s=>{et(v=>{const j=new Set(v);return j.has(s)?j.delete(s):j.add(s),j})},gn=(i==null?void 0:i.blocks)||[],we=s=>{var v;return((v=gn.find(j=>j.block_id===s))==null?void 0:v.payload)||{}},X=we("interaction-metadata"),ve=we("interaction-context"),ze=we("interaction-signals"),hn=we("interaction-outcome-lift"),xn=we("interaction-dimensions").dimensions||[],yn=ve.call_purpose||{},mn=ve.classification||{},gt=X||{},Me=m||yn||{},vn=x||mn||{},ht=hn||{};(ht.driver_signal_keys||[]).map(s=>s.replace(/^sig\./,"").replace(/_/g," "));const jn=l||null,bn=(vt=ze==null?void 0:ze.signals)!=null&&vt.length?ze:{present_count:0,total_signals_evaluated:0,signals:[]},xt=Kt||[],Ye=W||X.agent_name||X.agent||ve.agent_name||"Agent",wn=A||X.agent_full_name||X.agent_name||Ye,Se=C||X.customer_name||X.customer||ve.customer_name||"Customer",yt=D||X.customer_full_name||X.customer_name||Se,mt=String((Y==null?void 0:Y.role)??(Y==null?void 0:Y.userRole)??(Y==null?void 0:Y.user_role)??(Y==null?void 0:Y.roleName)??(Y==null?void 0:Y.role_name)??"").toLowerCase(),Sn=yi(mt),qe=xi(mt),Ke=h??$e.length,Ge=X.created_dt||(i==null?void 0:i.created_dt)||ve.created_dt||"",kn=Ge?new Date(/Z$|[+-]\d{2}:\d{2}$/.test(Ge)?Ge:Ge+"Z").toLocaleString():"",Cn=Me.interaction_direction==="inbound"?"Inbound":"Outbound";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",maxWidth:"100%",height:"100%",background:"var(--Grey-White, #FFF)",overflowX:H?"clip":void 0},children:[e.jsxs("div",{style:{display:"flex",flexDirection:H?"column":"row",alignItems:H?"stretch":"center",gap:12,padding:H?"16px 16px 0":"18px 24px 0"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,minWidth:0,...H?{order:2,width:"100%"}:{flex:1}},children:[e.jsx("button",{onClick:n,style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0,flexShrink:0},children:e.jsx(a.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})]}),(Ce||Fe)&&(H||!lt)&&e.jsxs("div",{style:{display:"flex",alignItems:"center",flexShrink:0,...H?{width:"100%",justifyContent:"space-between",order:1}:{}},children:[e.jsx(xe,{text:Xe,children:e.jsxs("button",{onClick:de?void 0:Ce,disabled:de,style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",background:"none",border:"none",cursor:de?"default":"pointer",opacity:de?.4:1},children:[e.jsx(a.ArrowLeft,{size:16,color:"var(--Neutral-800, #323232)",strokeWidth:1.5}),e.jsx("span",{style:{color:"var(--Neutral-800, #323232)",fontSize:13,fontWeight:400,lineHeight:"24px",fontFamily:"var(--default-font-family)",whiteSpace:"nowrap"},children:"Previous Interaction"})]})}),e.jsx("div",{style:{width:1,height:20,background:"var(--Grey-absent, #D9D9D9)",flexShrink:0}}),e.jsx(xe,{text:Je,children:e.jsxs("button",{onClick:ce?void 0:Fe,disabled:ce,style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",background:"none",border:"none",cursor:ce?"default":"pointer",opacity:ce?.4:1},children:[e.jsx("span",{style:{color:"var(--Neutral-800, #323232)",fontSize:13,fontWeight:400,lineHeight:"24px",fontFamily:"var(--default-font-family)",whiteSpace:"nowrap"},children:"Next Interaction"}),e.jsx(a.ArrowRight,{size:16,color:"var(--Neutral-800, #323232)",strokeWidth:1.5})]})})]})]}),!H&&e.jsx("div",{style:{position:"sticky",top:0,zIndex:30,backgroundColor:"#FFFFFF",paddingTop:8,boxShadow:"0 4px 6px -4px rgba(0, 0, 0, 0.04)"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16,background:"#FFFFFF",borderBottom:"1px solid var(--Grey-Faint, #ACADAD)",padding:H?"0 16px":"0 24px"},children:[e.jsx("div",{className:"custom-thin-scrollbar-hidden",style:{display:"flex",alignItems:"flex-start",minWidth:0,overflowX:H?"auto":"visible"},children:Pe.map(s=>e.jsx("button",{onClick:()=>fn(s.key),style:{display:"flex",padding:16,alignItems:"center",gap:10,flexShrink:0,background:"none",border:"none",borderBottom:Le===s.key?"3px solid var(--Grey-Strong, #2E3236)":"3px solid transparent",cursor:"pointer",fontSize:15,fontWeight:Le===s.key?500:400,color:Le===s.key?"var(--Grey-Strong, #2E3236)":"var(--Grey-Muted, #808183)",whiteSpace:"nowrap",transition:"border-color 0.2s ease, color 0.2s ease"},children:s.label},s.key))}),(Ce||Fe)&<&&e.jsxs("div",{style:{display:"flex",alignItems:"center",flexShrink:0},children:[e.jsx(xe,{text:Xe,children:e.jsxs("button",{onClick:de?void 0:Ce,disabled:de,style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",background:"none",border:"none",cursor:de?"default":"pointer",opacity:de?.4:1},children:[e.jsx(a.ArrowLeft,{size:16,color:"var(--Neutral-800, #323232)",strokeWidth:1.5}),e.jsx("span",{style:{color:"var(--Neutral-800, #323232)",fontSize:13,fontWeight:400,lineHeight:"24px",fontFamily:"var(--default-font-family)",whiteSpace:"nowrap"},children:"Previous Interaction"})]})}),e.jsx("div",{style:{width:1,height:20,background:"var(--Grey-absent, #D9D9D9)",flexShrink:0}}),e.jsx(xe,{text:Je,children:e.jsxs("button",{onClick:ce?void 0:Fe,disabled:ce,style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",background:"none",border:"none",cursor:ce?"default":"pointer",opacity:ce?.4:1},children:[e.jsx("span",{style:{color:"var(--Neutral-800, #323232)",fontSize:13,fontWeight:400,lineHeight:"24px",fontFamily:"var(--default-font-family)",whiteSpace:"nowrap"},children:"Next Interaction"}),e.jsx(a.ArrowRight,{size:16,color:"var(--Neutral-800, #323232)",strokeWidth:1.5})]})})]})]})}),e.jsxs("div",{ref:be,style:{padding:H?16:24,flex:1,overflowY:"auto",...H?{minWidth:0,overflowX:"hidden"}:{}},children:[e.jsxs("div",{ref:Be,style:{display:"flex",flexDirection:"column",justifyContent:"flex-end",alignItems:"flex-start",gap:24,alignSelf:"stretch"},children:[e.jsxs("div",{style:{display:"flex",flexWrap:H?"wrap":"nowrap",height:H?"auto":40,alignItems:H?"flex-start":"center",gap:H?8:16,alignSelf:"stretch"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1},children:[e.jsx(a.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",flexDirection:"row",flexWrap:H?"wrap":"nowrap",alignItems:"center",gap:H?"8px 16px":16,flexShrink:0,...H?{width:"100%"}:{}},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"8px 0"},children:[e.jsx(a.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:kn})]}),(()=>{const s=Me.interaction_direction==="outbound"?a.PhoneOutgoing:a.PhoneIncoming;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"8px 0"},children:[e.jsx(s,{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:Cn})]})})(),e.jsxs("div",{style:{display:"flex",flexWrap:H?"wrap":"nowrap",alignItems:"center",gap:H?12:16,...H?{flexBasis:"100%",width:"100%"}:{paddingLeft:16,borderLeft:"1px solid var(--Grey-absent, #D9D9D9)"}},children:[e.jsx(xe,{text:wn,children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"8px 0",cursor:"pointer"},children:[e.jsx(a.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:Ye})]})}),Ke>1?e.jsx("div",{children:e.jsx(xe,{text:yt,children:e.jsxs("button",{onClick:()=>We(!0),style:{display:"flex",alignItems:"center",gap:16,padding:"0 16px",height:34,borderRadius:8,background:"var(--Rail-Surface-2, #E3E1D7)",border:"none",cursor:"pointer"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,minWidth:0},children:[e.jsx(a.CircleUser,{size:16,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.5}),e.jsxs("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2,whiteSpace:"nowrap"},children:[e.jsx("span",{style:{fontWeight:600},children:Se})," ",e.jsxs("span",{children:["(",Ke," Interactions)"]})]})]}),e.jsx(a.ChevronRight,{size:16,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.7})]})})}):e.jsx(xe,{text:yt,children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"8px 0",cursor:"pointer"},children:[e.jsx(a.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:Se})]})})]})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:H?"column":"row",alignItems:"stretch",gap:24,alignSelf:"stretch"},children:[e.jsx("div",{style:{flex:1,minWidth:0,display:"flex"},children:e.jsx(Lt,{score:me??.5,minScore:0,maxScore:fe,predictedScore:ue??.5,predictedLabel:c,legends:Q,outcomePercent:ae??null})}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch",justifyContent:qe?"flex-start":"flex-end",gap:24,flex:1,minWidth:0},children:[e.jsx(Tt,{meta:gt,callPurpose:Me,classification:vn,outcomeQuality:ee||"Neutral",dimensions:xn,resolutionOutcome:ie,customerIntent:re,location:te??X.location??X.location_name??ve.location,interactionId:se??X.interaction_id,moreDetails:L,canShowEditButton:Sn,onEditInteraction:en,flatView:qe}),!qe&&(()=>{var wt,St;const s=ht||{},v=s.difficulty,j=s.difficulty_band,F=s.p_expected,z=s.score_impact??F,B=s.lift_raw,P=s.lift_display,ne=(wt=s.interpretation)==null?void 0:wt.lift_band,je=s.p_full,oe=(St=s.interpretation)==null?void 0:St.description;if(!(v!=null||j!=null||B!=null||ne!=null||je!=null||oe!=null))return null;const Ve=(he,He,Mn)=>Math.max(He,Math.min(Mn,he)),Fn=v!=null?Ve((v-50)/50,-1,1):0,In=B!=null?Ve(B*3,-1,1):0,jt=z!=null?Math.round(z*100):null,bt=he=>{if(he)return String(he).split("_").map(He=>He.charAt(0).toUpperCase()+He.slice(1).toLowerCase()).join(" ")},Wn=bt(j),Dn=bt(ne),zn=(()=>{if(typeof P=="string"){const he=parseFloat(P.replace("%",""));if(Number.isFinite(he))return he}return B!=null?Math.round(B*100):null})();return e.jsx(Gn.AgentLiftAnalysisCard,{title:"Agent Lift Analysis",interactionDifficulty:{value:v!=null?Fn:null,label:Wn,sublabel:"Based on interaction type",footer:jt!=null?`${jt}% Score impact`:void 0},agentImpact:{value:B!=null?In:null,label:Dn,sublabel:oe,impactPercent:zn,isLearning:String(ne??"").toLowerCase()==="learning"}})})()]})]})]}),e.jsx("div",{ref:ot,style:{paddingTop:24},children:e.jsx(Et,{data:o?null:jn,loading:o})}),e.jsxs("div",{ref:De,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(a.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",flexDirection:H?"column":"row",alignItems:H?"stretch":"flex-start",gap:24,alignSelf:"stretch",paddingTop:16,borderTop:"1px solid #D9D9D9"},children:[e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(At,{signals:bn,expandedSignals:on,toggleSignal:pn,playEvidence:pt,highlightTurns:un,onShowInTranscript:ut,timelinePlaying:p||nt,currentTimeSeconds:f??rt})}),e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(_t.UpdatedInteractionRecording,{ref:ge,audioUrl:r,durationSeconds:gt.duration_seconds,audioRef:d,agentName:Ye,customerName:Se,currentTimeSeconds:f,timelinePlaying:p,playbackRate:b,timelineSegments:w,onSeek:G,onTogglePlay:g,onSeekBack:k,onSeekForward:S,onSetPlaybackRate:I,transcript:_,activeTurnIndex:O,turnObservations:N,highlightedTurns:K,onTurnPlayPause:U,setExpandedSignals:et})})]})]}),(()=>{const s=(Z==null?void 0:Z.products)??Te??[],v=(Z==null?void 0:Z.services)??Ae??[];return!s.length&&!v.length?null:e.jsx("div",{ref:st,style:{paddingTop:24},children:e.jsx(qt,{products:s,services:v})})})(),e.jsx("div",{ref:at,style:{paddingTop:24},children:e.jsxs(Ot,{comments:Ue,totalComments:Ue.length,currentUser:Y,onSendComment:Zt||(()=>{}),onSendReply:Xt||(()=>{}),onReply:Jt||(()=>{}),onEdit:Ut||(()=>{}),onDelete:tn||(()=>{}),onMenuClick:nn||(()=>{}),onMarkResolved:rn||(()=>{}),isResolved:ln,children:[e.jsx(Yt,{items:xt,summary:Qt,guidanceCount:xt.length,onPlayEvidence:pt,onShowInTranscript:ut,timelinePlaying:p||nt,currentTimeSeconds:f??rt}),e.jsx(pi,{summary:Vt})]})})]}),e.jsx(Hn.SideDrawer,{open:sn,onClose:()=>We(!1),title:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[e.jsx("div",{style:{width:34,height:34,borderRadius:"50%",background:"var(--surface-hover, #F3F7F7)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(a.CircleUser,{size:20,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.7})}),e.jsx("div",{style:{minWidth:0},children:e.jsx("div",{style:{fontSize:16,fontWeight:600,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Se})})]}),subtitle:Oe?e.jsxs("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:1.5},children:[Ke," Interactions"]}):null,width:470,height:"100vh",topOffset:70,footer:Oe?e.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:e.jsxs("button",{onClick:()=>{pe&&pe(),We(!1)},style:{display:"flex",height:40,padding:"0 20px 0 18px",justifyContent:"center",alignItems:"center",gap:7,background:"var(--Grey-White, #FFF)",border:"1px solid var(--Grey-absent, #D9D9D9)",borderRadius:10,cursor:"pointer"},children:[e.jsx(a.History,{size:18,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:15,fontWeight:600,color:"var(--Grey-Strong, #2E3236)"},children:"View All Interactions"})]})}):null,children:e.jsx("div",{style:{borderTop:"1px solid var(--Grey-absent, #D9D9D9)",maxHeight:"100%",overflowY:"auto"},children:Oe?$e.map((s,v)=>{const j=!!s.isCurrent,F=!j&&an===v,z=mi(s,Me.interaction_direction),B=z==="outbound"?a.PhoneOutgoing:a.PhoneIncoming;return e.jsxs("div",{onClick:j?void 0:()=>{T&&T(s),We(!1)},onMouseEnter:j?void 0:()=>tt(v),onMouseLeave:j?void 0:()=>tt(null),"aria-current":j?"page":void 0,style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,padding:"16px 12px",borderTop:v===0?"none":"1px solid var(--Grey-absent, #D9D9D9)",background:j?"#E3E1D7":F?"var(--surface-hover, #F3F7F7)":"var(--Grey-White, #FFF)",cursor:j?"default":"pointer",transition:"background 0.15s"},children:[e.jsxs("div",{style:{minWidth:0},children:[e.jsxs("div",{style:{fontSize:j?15:14,display:"flex",alignItems:"center",gap:6,fontWeight:j?500:400,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[z&&e.jsx(B,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5,style:{flexShrink:0},"aria-hidden":!0}),e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",minWidth:0},children:s.title})]}),s.status&&e.jsxs("div",{style:{fontSize:13,color:"var(--Grey-Strong, #2E3236)",marginBottom:12,lineHeight:1.2},children:[e.jsx("span",{style:{fontWeight:400},children:"Location: "}),e.jsx("span",{style:{fontWeight:400,color:"var(--Grey-Muted, #808183)"},children:s.location})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,flexWrap:"wrap"},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:1.1},children:[e.jsx(a.CalendarDays,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.8}),s.date]}),(s.agent||s.agent_name)&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:1.1},children:[e.jsx(a.Headset,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.8}),s.agent||s.agent_name]})]})]}),!j&&F&&e.jsx(a.ExternalLink,{size:20,color:"var(--Grey-Muted, #808183)",strokeWidth:1.7,style:{flexShrink:0}})]},s.id||v)}):e.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:140,padding:"24px 12px",color:"var(--Grey-Muted, #808183)",fontSize:14,fontStyle:"italic",textAlign:"center"},children:"No other interactions available"})})})]})},R={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))"},V=1.2,Ht=3,Rt=t=>t!=null?Math.round(t*100)+"%":"—",ji=t=>{if(t==null)return"—";const n=(t*100).toFixed(1);return t>0?`+${n}pp`:`${n}pp`},bi=({outcomeLift:t,driverLabels:n=[],showOutcomeOnly:i=!1})=>{var S;const l=ye.useMediaQuery("(max-width: 640px)");if(!t||t.lift==null)return null;const o=t.p_expected,r=t.p_full,d=t.lift_raw??(r!=null&&o!=null?r-o:null),f=t.lift,p=(S=t.interpretation)!=null&&S.lift_band?t.interpretation.lift_band.replace(/_/g," "):f>=0?"Positive":"Negative",b=p.charAt(0).toUpperCase()+p.slice(1),G=/negative/i.test(p)?a.ThumbsDown:a.ThumbsUp,g=n.slice(0,Ht),k=n.length-Ht;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",padding:24,gap:i?16:24,borderRadius:8,border:`1px solid ${R.absent}`,background:i?"#faf9f5":R.cardBg,alignSelf:"stretch"},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:i?24: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:R.strong,fontFamily:"var(--font-sans)",lineHeight:V},children:"Agent Lift Analysis"}),e.jsx("div",{style:{display:"flex",alignItems:"center",gap:8,fontFamily:"var(--font-sans)"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,paddingLeft:8},children:[e.jsx(G,{size:14,color:R.strong}),e.jsx("span",{style:{fontSize:13,fontWeight:600,color:R.strong,lineHeight:V},children:b})]})})]}),e.jsxs("div",{style:{display:"flex",flexDirection:l&&!i?"column":"row",alignItems:l&&!i?"stretch":"center",gap:l&&!i?16:24,...i?{justifyContent:"center",width:"100%"}:{}},children:[!i&&e.jsxs(e.Fragment,{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:R.muted,fontFamily:"var(--font-sans)",lineHeight:V},children:Rt(o)}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,alignItems:"flex-start",minHeight:48},children:[e.jsx("span",{style:{fontSize:13,fontWeight:400,color:R.strong,fontFamily:"var(--font-sans)",lineHeight:V,whiteSpace:"nowrap"},children:"Expected Outcome"}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:R.muted,fontFamily:"var(--font-sans)",lineHeight:V,textAlign:"left"},children:"Based on call type & difficulty"})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,alignItems:"flex-start",...l?{paddingTop:16,borderTop:`1px solid ${R.absent}`,width:"100%"}:{paddingLeft:24,borderLeft:`1px solid ${R.absent}`,flex:1,minWidth:0}},children:[e.jsx("span",{style:{fontSize:28,fontWeight:400,color:R.muted,fontFamily:"var(--font-sans)",lineHeight:V},children:ji(d)}),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:R.strong,fontFamily:"var(--font-sans)",lineHeight:V,whiteSpace:"nowrap"},children:"Agent Impact"}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:R.muted,fontFamily:"var(--font-sans)",lineHeight:V,textAlign:"left"},children:"Behavior-driven change"})]})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:i?"row":"column",gap:16,alignItems:i?"center":"flex-start",justifyContent:i?"center":void 0,...i?{}:l?{paddingTop:16,borderTop:`1px solid ${R.absent}`,width:"100%"}:{paddingLeft:24,borderLeft:`1px solid ${R.absent}`,flex:1,minWidth:0}},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",gap:4},children:e.jsx("span",{style:{fontSize:28,fontWeight:400,color:R.strong,fontFamily:"var(--font-sans)",lineHeight:V},children:Rt(r)})}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,alignItems:"flex-start",minHeight:i?void 0:48},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",gap:4},children:e.jsx("span",{style:{fontSize:13,fontWeight:i?400:600,color:R.strong,fontFamily:"var(--font-sans)",lineHeight:V,whiteSpace:"nowrap"},children:"Outcome"})}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:R.muted,fontFamily:"var(--font-sans)",lineHeight:V,textAlign:"left"},children:"With agent behaviors"})]})]})]})]}),n.length>0&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,alignSelf:"stretch"},children:[e.jsx("span",{style:{fontSize:12,fontWeight:600,color:R.strong,fontFamily:"var(--font-sans)",lineHeight:V},children:"Key Drivers"}),e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[g.map((I,W)=>e.jsx("div",{style:{display:"flex",padding:8,alignItems:"center",justifyContent:"center",borderRadius:4,border:`1px solid ${R.absent}`,background:R.white},children:e.jsx("span",{style:{fontSize:12,fontWeight:400,color:R.strong,fontFamily:"var(--font-sans)",lineHeight:V,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:200},children:I})},W)),k>0&&e.jsx("div",{style:{display:"flex",padding:8,alignItems:"center",justifyContent:"center",borderRadius:4,border:`1px solid ${R.absent}`,background:R.white},children:e.jsxs("span",{style:{fontSize:12,fontWeight:400,color:R.strong,fontFamily:"var(--font-sans)",lineHeight:V,whiteSpace:"nowrap"},children:["+ ",k]})})]})]})]})};exports.UpdatedInteractionRecording=_t.UpdatedInteractionRecording;exports.UpdatedCoachingSynthesisCard=Et;exports.UpdatedCompassScore=Lt;exports.UpdatedGuidance=Yt;exports.UpdatedInteractionContext=Tt;exports.UpdatedInteractionDetails=vi;exports.UpdatedInteractionScores=bi;exports.UpdatedInteractionSignals=At;exports.UpdatedProductsServices=qt;exports.UpdatedThreads=Ot;
|
|
17
17
|
//# sourceMappingURL=UpdatedInteractionDetails.cjs.js.map
|