chordia-ui 3.3.2 → 3.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +4 -0
  2. package/dist/SmallButton.cjs.js +1 -1
  3. package/dist/SmallButton.cjs.js.map +1 -1
  4. package/dist/SmallButton.es.js +170 -162
  5. package/dist/SmallButton.es.js.map +1 -1
  6. package/dist/components/chat.cjs.js +8 -8
  7. package/dist/components/chat.cjs.js.map +1 -1
  8. package/dist/components/chat.es.js +329 -335
  9. package/dist/components/chat.es.js.map +1 -1
  10. package/dist/components/data.cjs.js +1 -1
  11. package/dist/components/data.cjs.js.map +1 -1
  12. package/dist/components/data.es.js +83 -80
  13. package/dist/components/data.es.js.map +1 -1
  14. package/dist/components/layout.cjs.js +1 -1
  15. package/dist/components/layout.cjs.js.map +1 -1
  16. package/dist/components/layout.es.js +3 -1
  17. package/dist/components/layout.es.js.map +1 -1
  18. package/dist/index.cjs2.js +1 -1
  19. package/dist/index.cjs2.js.map +1 -1
  20. package/dist/index.es2.js +4 -4
  21. package/dist/index.es2.js.map +1 -1
  22. package/dist/pages/interactionDetails.cjs.js +2 -2
  23. package/dist/pages/interactionDetails.cjs.js.map +1 -1
  24. package/dist/pages/interactionDetails.es.js +117 -123
  25. package/dist/pages/interactionDetails.es.js.map +1 -1
  26. package/package.json +1 -1
  27. package/src/components/chat/ChatHistoryPanel.jsx +3 -3
  28. package/src/components/chat/ChatInterface.jsx +14 -14
  29. package/src/components/common/MessageThread.jsx +19 -19
  30. package/src/components/data/DataTable.jsx +18 -15
  31. package/src/components/layout/SplitPane.jsx +2 -0
  32. package/src/components/login/LoginPage.jsx +4 -4
  33. package/src/components/primitives/SmallButton.jsx +14 -6
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Q=require("../SummarySection.cjs.js"),xe=require("../AgentLiftCard.cjs.js"),e=require("react/jsx-runtime"),p=require("react"),z=require("lucide-react"),ne=require("../SmallButton.cjs.js"),He=require("../SectionLabel.cjs.js");require("../sortable.esm.cjs.js");require("react-dom");require("recharts");require("../UploadInteraction.cjs.js");require("../colors.cjs.js");const Oe=require("../Timeline.cjs.js"),Fe="coaching-synthesis-keyframes";function Qe(){if(typeof document>"u"||document.getElementById(Fe))return;const n=document.createElement("style");n.id=Fe,n.textContent=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Q=require("../SummarySection.cjs.js"),ue=require("../AgentLiftCard.cjs.js"),e=require("react/jsx-runtime"),p=require("react"),z=require("lucide-react"),ne=require("../SmallButton.cjs.js"),He=require("../SectionLabel.cjs.js");require("../sortable.esm.cjs.js");require("react-dom");require("recharts");require("../UploadInteraction.cjs.js");require("../colors.cjs.js");const Oe=require("../Timeline.cjs.js"),We="coaching-synthesis-keyframes";function Qe(){if(typeof document>"u"||document.getElementById(We))return;const n=document.createElement("style");n.id=We,n.textContent=`
2
2
  @keyframes coaching-shimmer {
3
3
  0% { background-position: -200% 0; }
4
4
  100% { background-position: 200% 0; }
@@ -7,5 +7,5 @@
7
7
  0%, 100% { opacity: 0.4; }
8
8
  50% { opacity: 1; }
9
9
  }
10
- `,document.head.appendChild(n)}function $e({data:n,loading:o,error:s}){var w,T;if(p.useEffect(()=>{Qe()},[]),o)return e.jsxs("div",{style:{padding:"20px 0",display:"flex",flexDirection:"column",gap:12},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("div",{style:{width:6,height:6,borderRadius:"50%",background:"var(--rail-tone)",animation:"coaching-pulse 1.5s ease-in-out infinite"}}),e.jsx("span",{style:{fontSize:"var(--text-base)",color:"var(--rail-tone)",fontFamily:"var(--font-sans)",fontWeight:500},children:"Compass is synthesizing coaching insights…"})]}),[180,260,220].map((S,x)=>e.jsx("div",{style:{height:10,width:S,maxWidth:"100%",borderRadius:4,background:"linear-gradient(90deg, var(--hover-warm-subtle) 25%, var(--hover-warm) 50%, var(--hover-warm-subtle) 75%)",backgroundSize:"200% 100%",animation:"coaching-shimmer 1.8s ease-in-out infinite",animationDelay:`${x*.2}s`}},x))]});if(s)return e.jsx("div",{style:{padding:"16px 0",fontSize:"var(--text-base)",color:"var(--text-faint)",fontFamily:"var(--font-sans)"},children:"Unable to generate coaching summary."});if(!n)return null;const a=n.strengths||[],i=n.improvements||[],m=n.organizational||n.organizational_insights||[],b=typeof n.one_liner=="string"?n.one_liner:((w=n.one_liner)==null?void 0:w.text)||"",h=typeof n.context=="string"?n.context:((T=n.context)==null?void 0:T.text)||"";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14,fontFamily:"var(--font-sans)"},children:[b&&e.jsx("div",{style:{fontSize:"var(--text-lg)",fontWeight:600,color:"var(--text-strong)",lineHeight:1.4},children:b}),h&&e.jsx("div",{style:{fontSize:"var(--text-base)",color:"var(--text-muted)",lineHeight:1.45},children:h}),a.length>0&&e.jsx(Be,{icon:e.jsx(z.TrendingUp,{size:13}),label:"Strengths",color:"var(--rail-discovery)",items:a}),i.length>0&&e.jsx(Be,{icon:e.jsx(z.Lightbulb,{size:13}),label:"Improvements",color:"var(--rail-compliance)",items:i}),m.length>0&&e.jsx(Be,{icon:e.jsx(z.Building,{size:13}),label:"Organizational",color:"var(--rail-outcome)",items:m}),n.overall&&e.jsxs("div",{style:{fontSize:"var(--text-base)",color:"var(--text-faint)",fontStyle:"italic",marginTop:2},children:["Overall: ",n.overall.replace(/_/g," ")]})]})}function Be({icon:n,label:o,color:s,items:a}){return e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,marginBottom:6,color:s,fontSize:"var(--text-base)",fontWeight:650,letterSpacing:"0.04em"},children:[n,o]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:a.map((i,m)=>{const b=typeof i=="string"?i:(i==null?void 0:i.text)||"",h=typeof i=="object"?i==null?void 0:i.quote:null;return e.jsxs("div",{style:{paddingLeft:14},children:[e.jsxs("div",{style:{fontSize:"var(--text-base)",color:"var(--text-base)",lineHeight:1.4},children:["• ",b]}),h&&e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:4,marginTop:3,paddingLeft:8},children:[e.jsx(z.MessageSquareQuote,{size:10,style:{color:"var(--text-faint)",flexShrink:0,marginTop:2}}),e.jsxs("span",{style:{fontSize:"var(--text-base)",color:"var(--text-muted)",fontStyle:"italic",lineHeight:1.35},children:['"',h,'"']})]})]},m)})})]})}function Xe(n){const o=Math.floor(n/60),s=Math.round(n%60);return`${o}:${s.toString().padStart(2,"0")}`}function Ne({title:n,meta:o,callPurpose:s,classification:a,dimensions:i}){const m=s||{},b=a||{};return e.jsxs(ne.Card,{variant:"elevated",padding:"sm",children:[e.jsx("div",{style:{fontSize:"var(--text-md)",fontWeight:550,color:"var(--text-strong)",lineHeight:1.375,marginBottom:6},children:n}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:"4px 12px",fontSize:11,color:"var(--text-muted)"},children:[o.evaluated_dt&&e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"Date"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-base)"},children:new Date(o.evaluated_dt).toLocaleString()})]}),o.duration_seconds!=null&&e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"Duration"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-base)"},children:Xe(o.duration_seconds)})]}),o.message_count&&e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"Messages"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-base)"},children:o.message_count})]}),m.interaction_direction&&e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"Direction"}),e.jsx("div",{style:{color:"var(--text-base)"},children:m.interaction_direction})]}),m.interaction_driver&&e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"Driver"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-base)"},children:m.interaction_driver})]}),m.customer_intent&&e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"Intent"}),e.jsx("div",{style:{color:"var(--text-base)"},children:m.customer_intent})]}),b.interaction_paradigm&&e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"Paradigm"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-base)"},children:b.interaction_paradigm})]}),i.map((h,w)=>e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:10,color:"var(--text-faint)"},children:h.label||h.key}),e.jsx("div",{style:{fontSize:12,color:"var(--text-base)"},children:h.value})]},w))]}),o.session_id&&e.jsx("div",{style:{fontSize:10,color:"var(--text-faint)",fontFamily:"var(--font-mono)",marginTop:4,userSelect:"all"},children:o.session_id})]})}function Ue({scores:n}){return n!=null&&n.length?e.jsx(ne.DetailCard,{title:"Scores",children:e.jsx("div",{style:{display:"flex",gap:24,flexWrap:"wrap"},children:n.map((o,s)=>{const a=o.value!=null?Math.round(o.value):null;return e.jsxs("div",{style:{textAlign:"center",minWidth:48},children:[e.jsx("div",{style:{fontSize:20,fontWeight:700,color:"var(--text-ink)"},children:a??"—"}),e.jsx("div",{style:{fontSize:"var(--text-sm)",color:"var(--text-muted)",marginTop:2},children:o.label||o.key})]},s)})})}):null}const Me={outcome:{label:"Outcome",icon:e.jsx(z.Target,{size:12}),color:"var(--rail-outcome)"},process:{label:"Process & Protocol",icon:e.jsx(z.FileText,{size:12}),color:"var(--rail-discovery)"},compliance:{label:"Compliance",icon:e.jsx(z.Scale,{size:12}),color:"var(--rail-compliance)"},customer_friction:{label:"Customer Friction",icon:e.jsx(z.Zap,{size:12}),color:"var(--rail-coral)"},experience:{label:"Experience",icon:e.jsx(z.MessageSquare,{size:12}),color:"var(--rail-teal)"}},et={risk:{icon:e.jsx(z.Zap,{size:10}),color:"var(--rail-signal-churn)"},opportunity:{icon:e.jsx(z.Lightbulb,{size:10}),color:"var(--state-unknown)"},excellence:{icon:e.jsx(z.CheckCircle,{size:10}),color:"var(--rail-teal)"}};function qe({signals:n,expandedSignals:o,toggleSignal:s,playEvidence:a,timelinePlaying:i,currentTimeSeconds:m,highlightTurns:b,borderRadius:h}){var T;if(!((T=n==null?void 0:n.signals)!=null&&T.length))return null;const w=p.useMemo(()=>{const S={};for(const x of n.signals){const j=x.group||"experience";S[j]||(S[j]=[]),S[j].push(x)}return S},[n]);return e.jsx(ne.DetailCard,{title:`Signals (${n.present_count} present / ${n.total_signals_evaluated} evaluated)`,borderRadius:h,children:Object.entries(w).map(([S,x])=>{const j=Me[S]||Me.experience;return e.jsxs("div",{style:{marginBottom:10},children:[e.jsxs(He.SectionLabel,{style:{display:"flex",alignItems:"center",gap:4},children:[j.icon,e.jsx("span",{children:j.label})]}),e.jsx("div",{style:{marginTop:4,display:"flex",flexDirection:"column",gap:6},children:x.map((u,y)=>{var R,W,$;const _=u.display_name||u.key||"",F=(R=u.baseline)==null?void 0:R.delta,D=((W=u.observations)==null?void 0:W.length)>0,I=o.has(u.key);return e.jsxs("div",{id:`signal-${u.key}`,style:{border:"1px solid var(--border, rgba(52, 58, 64, 0.12))",borderRadius:"var(--radius-md, 8px)",background:"var(--paper, rgba(255, 255, 255, 0.98))",overflow:"hidden"},children:[e.jsxs("button",{type:"button",onClick:k=>{D&&(s(u.key),k.currentTarget.blur())},style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 10px",background:"transparent",borderTop:"1px solid transparent",borderRight:"1px solid transparent",borderLeft:"1px solid transparent",borderBottom:"1px solid var(--border, rgba(52, 58, 64, 0.08))",cursor:D?"pointer":"default"},title:[u.confidence!=null?`Confidence: ${Math.round(u.confidence*100)}%`:"",F!=null?`Δ baseline: ${F>0?"+":""}${(F*100).toFixed(1)}%`:""].filter(Boolean).join(" · "),children:[e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,whiteSpace:"nowrap"},children:[($=et[u.kind])==null?void 0:$.icon,e.jsx("span",{children:_}),D&&e.jsxs("span",{style:{marginLeft:4,fontSize:10,opacity:.6},children:["(",u.observations.length,")"]})]}),D&&e.jsx(z.ChevronDown,{size:14,style:{color:"var(--text-muted)",flexShrink:0,transform:I?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.16s ease"}})]}),I&&u.observations&&e.jsx("div",{style:{width:"100%",margin:"0 0 6px"},children:u.observations.map((k,q)=>{var G;return e.jsx("div",{style:{marginBottom:6},children:e.jsxs("div",{style:{display:"flex",borderRadius:"var(--radius-sm, 8px)",background:"var(--paper, #fff)",overflow:"hidden"},children:[e.jsx("div",{style:{width:3,background:j.color}}),e.jsxs("div",{style:{flex:1,fontSize:"var(--text-sm)",color:"var(--text-muted)",padding:"8px 12px"},children:[e.jsx("div",{style:{fontWeight:600,color:"var(--text-base)",marginBottom:3,fontSize:"var(--text-base)"},children:k.key||""}),e.jsx("div",{style:{marginBottom:6,lineHeight:1.4},children:k.reason||k.explanation||""}),(G=k.evidence)==null?void 0:G.map((Z,N)=>{const P=Z.start_ms,A=Z.end_ms;let H=!1;if(P!=null&&i){const O=P/1e3,M=A!=null?A/1e3:O+1,K=m??0;H=K>=O&&K<=M+.25}return e.jsx(xe.EvidenceItem,{ev:Z,isPlaying:H,railColor:j.color,onPlay:(O,M)=>a==null?void 0:a(O,M,Z.turn_ids),onHighlight:b},N)})]})]})},q)})})]},y)})})]},S)})})}const Pe={risk:{icon:e.jsx(z.Zap,{size:10}),color:"var(--rail-signal-churn)"},opportunity:{icon:e.jsx(z.Lightbulb,{size:10}),color:"var(--state-unknown)"},excellence:{icon:e.jsx(z.CheckCircle,{size:10}),color:"var(--rail-teal)"}};function Ke({guidance:n,playEvidence:o,timelinePlaying:s,currentTimeSeconds:a,highlightTurns:i,borderRadius:m}){var b;return(b=n==null?void 0:n.items)!=null&&b.length?e.jsx(ne.DetailCard,{title:`Guidance (${n.total_items} items)`,borderRadius:m,children:e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:n.items.map((h,w)=>{var x;const T=Pe[h.guidance_kind]||Pe.excellence,S=h.owner==="organization"?{bg:"color-mix(in srgb, var(--rail-discovery) 15%, transparent)",color:"var(--rail-discovery)",text:"ORG"}:h.owner==="shared"?{bg:"color-mix(in srgb, var(--state-unknown) 15%, transparent)",color:"var(--state-unknown)",text:"SHARED"}:{bg:"color-mix(in srgb, var(--rail-teal) 10%, transparent)",color:"var(--rail-teal)",text:"AGENT"};return e.jsxs("div",{style:{padding:"10px 12px",borderRadius:"var(--radius)",background:"var(--paper)",borderLeft:`3px solid ${T.color}`},children:[e.jsxs("div",{style:{fontSize:"var(--text-base)",color:"var(--text-strong)",display:"flex",alignItems:"center",gap:5,fontWeight:550},children:[T.icon," ",h.title||"",e.jsx("span",{style:{fontSize:9,padding:"1px 6px",borderRadius:8,marginLeft:4,background:S.bg,color:S.color,fontWeight:600},children:S.text})]}),h.detail&&e.jsx("div",{style:{fontSize:"var(--text-sm)",color:"var(--text-muted)",marginTop:4,lineHeight:1.4},children:h.detail}),(x=h.signal_refs)==null?void 0:x.map((j,u)=>{var y;return e.jsxs("div",{style:{marginTop:6},children:[e.jsxs("div",{style:{fontSize:10,color:"var(--text-muted)",fontWeight:600,marginBottom:3,display:"flex",alignItems:"center",gap:3},children:[e.jsx(z.CornerDownRight,{size:10})," ",j.display_name||j.signal_key,j.confidence!=null&&e.jsxs("span",{style:{fontWeight:400,opacity:.7},children:[" ","(",Math.round(j.confidence*100),"%)"]})]}),(y=j.evidence)==null?void 0:y.map((_,F)=>{const D=_.start_ms,I=_.end_ms;let R=!1;if(D!=null&&s){const W=D/1e3,$=I!=null?I/1e3:W+1,k=a??0;R=k>=W&&k<=$+.25}return e.jsx(xe.EvidenceItem,{ev:_,isPlaying:R,onPlay:(W,$)=>o==null?void 0:o(W,$,_.turn_ids),onHighlight:i},F)})]},u)})]},w)})})}):null}function Ye({nba:n}){const o=(n==null?void 0:n.recommendations)||(n==null?void 0:n.actions)||[];return o.length?e.jsx(ne.DetailCard,{title:"Next Best Actions",children:e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:o.slice(0,8).map((s,a)=>e.jsxs("div",{style:{fontSize:11,color:"var(--text-muted)",display:"flex",alignItems:"center",gap:4},children:[e.jsx(z.Target,{size:12})," ",e.jsx("strong",{style:{color:"var(--text-base)"},children:s.action||s.title||""}),s.rationale&&` — ${s.rationale}`]},a))})}):null}function Ge({audioUrl:n,timelineSegments:o,durationSeconds:s,currentTimeSeconds:a,timelinePlaying:i,playbackRate:m,onSeek:b,onTogglePlay:h,onSeekBack:w,onSeekForward:T,onSetPlaybackRate:S,audioRef:x}){return n?e.jsxs(ne.DetailCard,{title:"Recording",children:[e.jsx(Oe.Timeline,{segments:o,durationSeconds:s||0,currentTimeSeconds:a,onSeek:b,showControls:!0,hasRecording:!0,timelinePlaying:i,playbackRate:m,onTogglePlay:h,onSeekBack:w,onSeekForward:T,onSetPlaybackRate:S}),e.jsx("audio",{ref:x,preload:"none",style:{display:"none"},children:e.jsx("source",{src:n,type:"audio/mpeg"})})]}):null}function Ve({transcript:n,audioUrl:o,highlightedTurns:s,activeTurnIndex:a,timelinePlaying:i,turnObservations:m,setExpandedSignals:b,onTurnPlayPause:h}){var S;if(!((S=n==null?void 0:n.messages)!=null&&S.length))return null;const w=(x,j)=>{if(x==null)return;const u=F=>{const D=Math.floor(F/6e4),I=Math.floor(F%6e4/1e3);return`${D.toString().padStart(2,"0")}:${I.toString().padStart(2,"0")}`},y=u(x),_=j!=null?u(j):y;return`${y}–${_}`},T=n.messages.map((x,j)=>{var u,y;return{actor:x.actor==="agent"?((u=n.actor_map)==null?void 0:u.agent)||"Agent":((y=n.actor_map)==null?void 0:y.customer)||"Customer",actorType:x.actor==="agent"?"agent":"customer",text:x.text||"",timeRange:w(x.start??x.start_ms,x.end??x.end_ms),isHighlighted:s.has(j),highlightColor:i&&a===j?x.actor==="agent"?"var(--rail-outcome)":"var(--rail-discovery)":void 0,observations:(m[j]||[]).map(_=>({..._,onClick:()=>{b(F=>new Set([...F,_.signalKey])),setTimeout(()=>{const F=document.getElementById(`signal-${_.signalKey}`);F&&F.scrollIntoView({behavior:"smooth",block:"nearest"})},100)}}))}});return e.jsx("div",{id:"transcript-container",children:e.jsx(Oe.TranscriptCard,{turns:T,audioUrl:o,activeTurnIndex:a,autoScrollActiveTurn:i,isExternalPlaying:i,onTurnPlayPause:h})})}const Le={padding:0,border:"none",background:"transparent",fontSize:"12px",fontWeight:500,color:"rgba(30, 33, 37, 0.65)",cursor:"pointer",fontFamily:"inherit"},Ze=n=>{if(!n)return null;const o=String(n).toLowerCase();return o==="supervisor"?"var(--rail-compliance)":o==="admin"||o==="administrator"?"var(--rail-discovery)":o==="agent"?"var(--rail-outcome)":null},Ae=n=>{if(!n)return[];const o=[n.messages,n.comments,n.thread_messages,n.items,n.children];for(const s of o)if(Array.isArray(s)&&s.length)return s;return n.messages&&Array.isArray(n.messages.data)?n.messages.data:[]},We=(n,o=null,s=0)=>{const a=[];return(n||[]).forEach((i,m)=>{const b=i.author||{},h=b.name||i.author_name||"Unknown",w=b.initials||h.split(" ").map(y=>y[0]).join("").toUpperCase()||"U",T=b.role||i.author_role,S=Ze(T),x=b.color||i.author_color||S||"#6B7C93",j=i.id||`msg-${s+m}`,u={id:j,author:{name:h,initials:w,color:x,role:T},content:i.content||i.text||"",timestamp:i.timestamp||i.created_at_display||i.created_at||"",type:i.type||"comment",isEdited:i.isEdited||i.is_edited||i.edited||!1,references:i.references||[],parentId:i.parentId||i.parent_message_id||o||null};a.push(u),Array.isArray(i.replies)&&i.replies.length>0&&a.push(...We(i.replies,j,s+a.length))}),a},tt=n=>{if(!n)return"";if(!/^\d{4}-\d{2}-\d{2}T/.test(n))return n;try{const o=new Date(n);if(Number.isNaN(o.getTime()))return n;const s=new Date,a=o.getFullYear()===s.getFullYear()&&o.getMonth()===s.getMonth()&&o.getDate()===s.getDate(),i=new Date(s);i.setDate(i.getDate()-1);const m=o.getFullYear()===i.getFullYear()&&o.getMonth()===i.getMonth()&&o.getDate()===i.getDate(),b=o.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1});if(a)return`Today at ${b}`;if(m)return`Yesterday at ${b}`;const w=(s.getTime()-o.getTime())/(1e3*60*60*24);return w<7&&w>0?`${o.toLocaleDateString(void 0,{weekday:"long"})} at ${b}`:`${o.toLocaleDateString(void 0,{month:"short",day:"numeric",year:o.getFullYear()!==s.getFullYear()?"numeric":void 0})} at ${b}`}catch{return n}};function nt({sessionTitle:n,sessionSubtitle:o,threadLabel:s,messages:a,messageThread:i,onSendMessage:m,onReplyMessage:b,onEditMessage:h,onDeleteMessage:w,onCreateNewThread:T,onThreadSelect:S,currentUser:x,isLoading:j=!1}){const[u,y]=p.useState(""),[_,F]=p.useState(!1),[D,I]=p.useState(a||[]),[R,W]=p.useState(!1),[$,k]=p.useState(null),[q,G]=p.useState([]),[Z,N]=p.useState(null),[P,A]=p.useState(null),[H,O]=p.useState(""),[M,K]=p.useState(null),[E,X]=p.useState(""),[ae,re]=p.useState(null),[Ce,ie]=p.useState(!1),[U,le]=p.useState(""),[V,ge]=p.useState(!1),[ze,ee]=p.useState(new Set),te=p.useRef(null),Te=p.useRef(null),oe=x&&x.role&&String(x.role).toLowerCase()||"",se=p.useMemo(()=>{if(!x)return{name:"You",initials:"YO",color:"#6B7C93"};const t=x.name||"You",g=x.initials||t.split(" ").map(l=>l[0]).join("").toUpperCase()||"YO",v=x.role&&String(x.role).toLowerCase(),C=Ze(v),r=x.color||C||"#6B7C93";return{...x,name:t,initials:g,color:r}},[x]),fe=oe==="supervisor"||oe==="admin",he=p.useMemo(()=>{const t={};return(D||[]).forEach(g=>{g.parentId&&(t[g.parentId]||(t[g.parentId]=[]),t[g.parentId].push(g))}),t},[D]),ye=p.useMemo(()=>(D||[]).filter(t=>!t.parentId),[D]),ce=t=>P===t,Ie=t=>M===t,_e=s||n||o,De=P?D.find(t=>t.id===P):null;p.useEffect(()=>{i||a&&I(a)},[a,i]),p.useEffect(()=>{if(!i)return;const t=Array.isArray(i.threads)?i.threads:Array.isArray(i.items)?i.items:[];if(t.length>0){const v=t.map((l,d)=>{const f=l.id||l.thread_id||`thread-${d+1}`,B=l.label||l.title||(d===0?s||"Session":`Thread ${d+1}`),c=Ae(l),L=We(c);return{id:f,label:B,messages:L}});G(v);const C=v.find(l=>(l.messages||[]).length>0)||v[0],r=(C==null?void 0:C.messages)||[];I(r),ee(new Set),N((C==null?void 0:C.id)||null);return}const g=Ae(i);if(g.length){const v=We(g);I(v),ee(new Set);const C=i.id||"thread-1",r=i.title||s||"Thread 1";G([{id:C,label:r}]),N(C)}},[i,s]),p.useEffect(()=>{s&&G(t=>t.map((g,v)=>v===0?{...g,label:s}:g))},[s]),p.useEffect(()=>{if(!te.current||!D||D.length===0)return;const t=te.current.parentElement;t?t.scrollTop=t.scrollHeight:te.current.scrollIntoView({behavior:"smooth",block:"end"})},[D]);const me=async()=>{const t=U.trim();if(t){ge(!0);try{const g=`thread-${Date.now()}`;G(v=>[...v,{id:g,label:t.slice(0,32)||`Thread ${v.length+1}`}]),N(g),await(T==null?void 0:T(t)),le(""),ie(!1)}finally{ge(!1)}}},Re=()=>{ie(!1),le("")},be=async()=>{const t=u.trim();if(!t)return;const g=t;y("");const v=`temp-${Date.now()}`,C={id:v,author:se,content:g,timestamp:"Just now",type:"comment",isOptimistic:!0,parentId:P||null};if(I(r=>[...r,C]),m){W(!0);try{await m({content:g,parent_message_id:P||null}),I(r=>r.map(l=>l.id===v?{...l,isOptimistic:!1}:l))}catch{I(r=>r.filter(l=>l.id!==v))}finally{W(!1)}A(null);return}I(r=>r.map(l=>l.id===v?{...l,isOptimistic:!1}:l)),A(null)},Ee=t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),be())},ve=t=>{A(t.id),O(""),K(null),X(""),k(null),b==null||b(t)},je=async t=>{const g=H.trim();if(!g)return;const v=`reply-${Date.now()}`,C={id:v,author:se,content:g,timestamp:"Just now",type:"comment",isOptimistic:!m,parentId:t};I(r=>[...r,C]),W(!0);try{m&&(await m({content:g,parent_message_id:t}),I(r=>r.map(l=>l.id===v?{...l,isOptimistic:!1}:l))),A(null),O("")}catch{m&&I(r=>r.filter(l=>l.id!==v))}finally{W(!1)}},Se=t=>{K(t.id),X(t.content||""),A(null),O(""),k(null)},de=async()=>{const t=E.trim();if(!(!t||!M))try{const g=await(h==null?void 0:h({id:M,content:t}));if(g&&typeof g=="object"&&g.success===!1)return;I(v=>v.map(C=>C.id===M?{...C,content:t,isEdited:!0}:C)),K(null),X("")}catch(g){console.error("MessageThread edit failed:",g)}},pe=()=>{K(null),X("")},ke=t=>{re(t),k(null)},we=async()=>{if(!ae)return;const t=ae;re(null),I(g=>g.filter(v=>v.id!==t.id)),await(w==null?void 0:w(t))},ue=(t,g=0)=>{var f,B;const v=he[t.id]||[],C=v.length>0,r=ze.has(t.id),l=Ie(t.id),d=ce(t.id);return e.jsx("div",{children:e.jsxs("div",{onMouseEnter:()=>t.type!=="system"&&k(t.id),onMouseLeave:()=>k(null),style:{display:"flex",gap:"12px",opacity:t.type==="system"?.75:1,padding:"4px 0",margin:"0 -4px",borderRadius:"8px",marginLeft:g>0?16:0},children:[t.type!=="system"?e.jsx("div",{style:{width:"36px",height:"36px",borderRadius:"50%",background:t.author.color,color:"white",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"11px",fontWeight:650,flexShrink:0},children:t.author.initials}):e.jsx("div",{style:{width:"36px",height:"36px",borderRadius:"50%",background:"rgba(30, 33, 37, 0.1)",color:"rgba(30, 33, 37, 0.55)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(z.Clock,{size:16})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",flexWrap:"wrap",gap:"8px",marginBottom:"6px",justifyContent:"space-between"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",flexWrap:"wrap",gap:"8px"},children:[e.jsx("span",{style:{fontSize:"13px",fontWeight:650,color:"rgba(30, 33, 37, 0.9)"},children:t.author.name}),t.timestamp&&e.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--default-mono-font-family)",color:"rgba(30, 33, 37, 0.5)"},children:tt(t.timestamp)}),((f=t.author)==null?void 0:f.role)&&e.jsx("span",{style:{display:"inline-flex",alignItems:"center",fontSize:"10px",color:"rgba(30, 33, 37, 0.6)",background:"rgba(30, 33, 37, 0.08)",padding:"3px 8px",borderRadius:"6px",textTransform:"uppercase",letterSpacing:"0.04em",fontWeight:600},children:String(t.author.role)}),(t.isEdited||t.is_edited)&&e.jsx("span",{style:{fontSize:"10px",color:"rgba(30, 33, 37, 0.5)",fontStyle:"italic"},children:"(Edited)"})]}),t.type!=="system"&&$===t.id&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flexShrink:0},children:[e.jsx("button",{type:"button",onClick:c=>{c.preventDefault(),c.stopPropagation(),ve(t)},style:Le,children:"Reply"}),h&&e.jsx("button",{type:"button",onClick:c=>{c.preventDefault(),c.stopPropagation(),Se(t)},style:Le,children:"Edit"}),w&&e.jsx("button",{type:"button",onClick:c=>{c.preventDefault(),c.stopPropagation(),ke(t)},style:{...Le,color:"rgba(198, 99, 99, 0.9)"},children:"Delete"})]})]}),l?e.jsxs("div",{style:{marginTop:"4px"},children:[e.jsx("textarea",{value:E,onChange:c=>X(c.target.value),onKeyDown:c=>{c.key==="Enter"&&!c.shiftKey&&(c.preventDefault(),de()),c.key==="Escape"&&pe()},placeholder:"Edit message...",autoFocus:!0,style:{width:"100%",minHeight:"56px",padding:"8px 12px",fontSize:"13px",color:"rgba(30, 33, 37, 0.88)",background:"white",border:"1px solid rgba(52, 58, 64, 0.2)",borderRadius:"6px",resize:"vertical",outline:"none",fontFamily:"inherit",lineHeight:1.5,marginBottom:"8px"}}),e.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end",alignItems:"center"},children:[e.jsx("button",{type:"button",onClick:pe,style:{padding:"8px 16px",fontSize:"12px",fontWeight:600,color:"rgba(30, 33, 37, 0.45)",background:"rgba(30, 33, 37, 0.1)",border:"none",borderRadius:"6px",cursor:"pointer",display:"flex",alignItems:"center",gap:"6px",transition:"all 0.15s ease"},onMouseEnter:c=>{c.currentTarget.style.background="rgba(30, 33, 37, 0.15)",c.currentTarget.style.color="rgba(30, 33, 37, 0.7)"},onMouseLeave:c=>{c.currentTarget.style.background="rgba(30, 33, 37, 0.1)",c.currentTarget.style.color="rgba(30, 33, 37, 0.45)"},children:"Cancel"}),e.jsx("button",{type:"button",onClick:de,disabled:!(E!=null&&E.trim()),style:{padding:"8px 16px",fontSize:"12px",fontWeight:600,color:E!=null&&E.trim()?"white":"rgba(30, 33, 37, 0.45)",background:E!=null&&E.trim()?"#5e88b0":"rgba(30, 33, 37, 0.1)",border:"none",borderRadius:"6px",cursor:E!=null&&E.trim()?"pointer":"not-allowed",display:"flex",alignItems:"center",gap:"6px",transition:"all 0.15s ease"},onMouseEnter:c=>{E!=null&&E.trim()&&(c.currentTarget.style.background="#4d7290")},onMouseLeave:c=>{E!=null&&E.trim()&&(c.currentTarget.style.background="#5e88b0")},children:"Save"})]})]}):e.jsx("div",{style:{fontSize:"13px",color:"rgba(30, 33, 37, 0.88)",lineHeight:1.55,marginBottom:(B=t.references)!=null&&B.length?"8px":0},children:t.content}),d&&e.jsxs("div",{style:{marginTop:"12px"},children:[e.jsx("textarea",{value:H,onChange:c=>O(c.target.value),onKeyDown:c=>{c.key==="Escape"&&(A(null),O(""))},placeholder:"Type your reply...",disabled:R,autoFocus:!0,style:{width:"100%",minHeight:"64px",padding:"8px 12px",fontSize:"13px",color:"rgba(30, 33, 37, 0.88)",background:"white",border:"1px solid rgba(52, 58, 64, 0.16)",borderRadius:"6px",resize:"vertical",outline:"none",fontFamily:"inherit",lineHeight:1.5,marginBottom:"10px"}}),e.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end",alignItems:"center"},children:[e.jsx("button",{type:"button",onClick:()=>{A(null),O("")},disabled:R,style:{padding:"8px 16px",fontSize:"12px",fontWeight:600,color:"rgba(30, 33, 37, 0.45)",background:"rgba(30, 33, 37, 0.1)",border:"none",borderRadius:"6px",cursor:R?"not-allowed":"pointer"},children:"Cancel"}),e.jsx("button",{type:"button",onClick:()=>je(t.id),disabled:!H.trim()||R,style:{padding:"8px 16px",fontSize:"12px",fontWeight:600,color:H.trim()&&!R?"white":"rgba(30, 33, 37, 0.45)",background:H.trim()&&!R?"#5e88b0":"rgba(30, 33, 37, 0.12)",border:"none",borderRadius:"6px",cursor:H.trim()&&!R?"pointer":"not-allowed"},children:"Send"})]})]}),C&&e.jsxs("div",{style:{marginTop:8},children:[e.jsxs("button",{type:"button",onClick:()=>ee(c=>{const L=new Set(c);return L.has(t.id)?L.delete(t.id):L.add(t.id),L}),style:{display:"inline-flex",alignItems:"center",gap:6,padding:"4px 8px",fontSize:"12px",fontWeight:500,color:"rgba(30, 33, 37, 0.6)",background:"transparent",border:"none",borderRadius:6,cursor:"pointer"},title:r?"Collapse replies":"Expand replies",children:[e.jsx(z.ChevronRight,{size:14,style:{flexShrink:0,transform:r?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.2s ease"}}),e.jsxs("span",{children:[v.length," ",v.length===1?"reply":"replies"]})]}),r&&e.jsx("div",{style:{marginTop:8,marginLeft:16,paddingLeft:16,borderLeft:"2px solid rgba(52, 58, 64, 0.14)"},children:v.map(c=>ue(c,g+1))})]})]})]})},t.id)};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"rgba(255, 255, 255, 0.98)",border:"1px solid rgba(52, 58, 64, 0.12)",borderRadius:"12px",overflow:"hidden",position:"relative"},children:[ae&&e.jsx("div",{style:{position:"absolute",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(30, 33, 37, 0.35)",borderRadius:"12px"},onClick:()=>re(null),children:e.jsxs("div",{style:{background:"white",borderRadius:"12px",padding:"20px 24px",boxShadow:"0 8px 24px rgba(30, 33, 37, 0.15)",maxWidth:"320px",width:"90%"},onClick:t=>t.stopPropagation(),children:[e.jsx("p",{style:{margin:0,marginBottom:"20px",fontSize:"14px",fontWeight:500,color:"rgba(30, 33, 37, 0.9)",lineHeight:1.45},children:"Do you really want to delete?"}),e.jsxs("div",{style:{display:"flex",gap:"10px",justifyContent:"flex-end"},children:[e.jsx("button",{type:"button",onClick:()=>re(null),style:{padding:"8px 16px",fontSize:"12px",fontWeight:600,color:"rgba(30, 33, 37, 0.45)",background:"rgba(30, 33, 37, 0.1)",border:"none",borderRadius:"6px",cursor:"pointer"},children:"Cancel"}),e.jsx("button",{type:"button",onClick:we,style:{padding:"8px 16px",fontSize:"12px",fontWeight:600,color:"white",background:"#5e88b0",border:"none",borderRadius:"6px",cursor:"pointer"},children:"Delete"})]})]})}),_e&&e.jsx("div",{style:{padding:"14px 16px",borderBottom:"1px solid rgba(52, 58, 64, 0.12)",background:"rgba(255, 255, 255, 0.98)"},children:e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:"8px"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"14px",fontWeight:600,color:"rgba(30, 33, 37, 0.95)",marginBottom:"4px"},children:s||"Session Discussion"}),(n||o)&&e.jsx("div",{style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.52)"},children:n||o}),q.length>0&&e.jsx("div",{style:{marginTop:"8px",display:"flex",flexWrap:"wrap",gap:"8px"},children:q.map(t=>{const g=t.id===Z;return e.jsx("button",{type:"button",onClick:()=>{N(t.id),Array.isArray(t.messages)&&(I(t.messages),ee(new Set)),k(null),A(null),K(null),S==null||S(t)},style:{padding:"4px 10px",borderRadius:"999px",border:"1px solid rgba(184, 156, 106, 0.35)",background:g?"rgba(184, 156, 106, 0.16)":"rgba(255, 255, 255, 0.9)",color:"rgba(30, 33, 37, 0.85)",fontSize:"11px",fontWeight:500,cursor:"pointer"},children:t.label},t.id)})})]}),fe&&e.jsxs("button",{type:"button",onClick:()=>{ie(t=>!t)},style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 12px",fontSize:"13px",fontWeight:500,color:"rgba(30, 33, 37, 0.75)",background:"transparent",border:"1px solid rgba(30, 33, 37, 0.12)",borderRadius:"6px",cursor:"pointer",transition:"background 0.15s ease, color 0.15s ease"},onMouseEnter:t=>{t.currentTarget.style.background="rgba(231, 212, 162, 0.12)",t.currentTarget.style.color="rgba(30, 33, 37, 0.9)"},onMouseLeave:t=>{t.currentTarget.style.background="transparent",t.currentTarget.style.color="rgba(30, 33, 37, 0.75)"},title:"Start a new discussion thread",children:[e.jsx("span",{style:{fontSize:16,lineHeight:1,marginTop:-1},children:"+"}),"New thread"]})]})}),e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"16px",display:"flex",flexDirection:"column",gap:"16px"},children:[Ce&&e.jsxs("div",{style:{marginBottom:"16px",padding:"12px",background:"rgba(30, 33, 37, 0.04)",border:"1px solid rgba(52, 58, 64, 0.14)",borderRadius:"8px"},children:[e.jsx("textarea",{value:U,onChange:t=>le(t.target.value),onKeyDown:t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),me())},placeholder:"Start a new thread...",disabled:V,style:{width:"100%",minHeight:"64px",padding:"8px 12px",fontSize:"13px",color:"rgba(30, 33, 37, 0.88)",background:"white",border:"1px solid rgba(52, 58, 64, 0.16)",borderRadius:"6px",resize:"vertical",outline:"none",fontFamily:"inherit",lineHeight:1.5,marginBottom:"10px"}}),e.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end"},children:[e.jsx("button",{type:"button",onClick:Re,disabled:V,style:{padding:"6px 14px",fontSize:"12px",fontWeight:500,color:"rgba(30, 33, 37, 0.7)",background:"rgba(30, 33, 37, 0.08)",border:"none",borderRadius:"6px",cursor:V?"not-allowed":"pointer"},children:"Cancel"}),e.jsx("button",{type:"button",onClick:me,disabled:!U.trim()||V,style:{padding:"6px 14px",fontSize:"12px",fontWeight:600,color:"white",background:U.trim()&&!V?"#5e88b0":"rgba(30, 33, 37, 0.25)",border:"none",borderRadius:"6px",cursor:U.trim()&&!V?"pointer":"not-allowed"},children:V?"Sending...":"Send"})]})]}),j?e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"40px",color:"rgba(30, 33, 37, 0.42)"},children:"Loading messages..."}):ye.length===0?e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"40px",color:"rgba(30, 33, 37, 0.42)"},children:"No messages yet. Start the conversation!"}):ye.map(t=>ue(t,0)),e.jsx("div",{ref:te})]}),e.jsx("div",{style:{padding:"12px",borderTop:"1px solid rgba(52, 58, 64, 0.12)",background:"rgba(255, 255, 255, 0.95)"},children:e.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"flex-end"},children:[e.jsx("div",{style:{width:"36px",height:"36px",borderRadius:"50%",background:se.color,color:"white",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"11px",fontWeight:650,flexShrink:0},children:se.initials}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"8px"},children:[e.jsx("textarea",{ref:Te,value:u,onChange:t=>y(t.target.value),onKeyDown:Ee,onFocus:()=>F(!0),onBlur:()=>F(!1),placeholder:De?"Type your reply...":"Add a comment...",style:{width:"100%",minHeight:"38px",maxHeight:"120px",padding:"8px 12px",fontSize:"13px",color:"rgba(30, 33, 37, 0.85)",background:"white",border:`1px solid ${_?"rgba(94, 136, 176, 0.35)":"rgba(52, 58, 64, 0.16)"}`,borderRadius:"8px",resize:"vertical",outline:"none",transition:"border-color 0.15s ease",fontFamily:"inherit",lineHeight:1.5}}),e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end"},children:e.jsx("button",{type:"button",onClick:be,disabled:!u.trim()||R,style:{padding:"8px 16px",background:u.trim()&&!R?"#5e88b0":"rgba(30, 33, 37, 0.1)",border:"none",borderRadius:"6px",color:u.trim()&&!R?"white":"rgba(30, 33, 37, 0.45)",fontSize:"12px",fontWeight:600,cursor:u.trim()&&!R?"pointer":"not-allowed",display:"flex",alignItems:"center",gap:"6px",transition:"all 0.15s ease"},children:R?e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{width:"14px",height:"14px",border:"2px solid rgba(255, 255, 255, 0.3)",borderTopColor:"white",borderRadius:"50%",animation:"spin 0.6s linear infinite"}}),"Sending..."]}):e.jsxs(e.Fragment,{children:[e.jsx(z.Send,{size:14}),"Send"]})})})]})]})})]})}function Y(n,o){return n.find(s=>s.block_id===o)}function rt({data:n,audioUrl:o,coachingData:s,messageThread:a,coachingLoading:i,coachingError:m,onThreadSendMessage:b,onThreadEditMessage:h,onThreadDeleteMessage:w,onThreadCreateNewThread:T,onThreadSelect:S,threadLoading:x,threadCurrentUser:j}){var ve,je,Se,de,pe,ke,we,ue,t,g,v,C;const u=n.blocks||[];n.evidence_index;const y=p.useRef(null),_=p.useRef(null),[F,D]=p.useState(new Set),[I,R]=p.useState(new Set),[W,$]=p.useState(0),[k,q]=p.useState(!1),[G,Z]=p.useState(1),N=((ve=Y(u,"interaction-metadata"))==null?void 0:ve.payload)||{},P=((je=Y(u,"interaction-context"))==null?void 0:je.payload)||{},A=((Se=Y(u,"interaction-summary"))==null?void 0:Se.payload)||{};(de=Y(u,"interaction-scores"))!=null&&de.payload;const H=((pe=Y(u,"interaction-signals"))==null?void 0:pe.payload)||{},O=((ke=Y(u,"interaction-guidance"))==null?void 0:ke.payload)||{},M=((we=Y(u,"interaction-transcript"))==null?void 0:we.payload)||{},K=((ue=Y(u,"interaction-nba"))==null?void 0:ue.payload)||{},X=((((t=Y(u,"interaction-dimensions"))==null?void 0:t.payload)||{}).dimensions||[]).filter(r=>r.value),ae=((g=Y(u,"interaction-outcome-lift"))==null?void 0:g.payload)||{},re=p.useMemo(()=>{var d;const r={},l={outcome:{color:"var(--rail-outcome)"},process:{color:"var(--rail-discovery)"},compliance:{color:"var(--rail-compliance)"},customer_friction:{color:"var(--rail-coral)"},experience:{color:"var(--rail-teal)"}};for(const f of H.signals||[]){const B=l[f.group]||{};for(const c of f.observations||[])for(const L of c.evidence||[])if((d=L.turn_ids)!=null&&d.length)for(const J of L.turn_ids)r[J]||(r[J]=[]),r[J].some(Je=>Je.label===(c.key||f.display_name||f.key))||r[J].push({label:c.key||f.display_name||f.key,reason:c.reason||c.explanation||"",color:B.color||"var(--state-present)",signalKey:f.key})}return r},[H.signals]),Ce=((v=M.messages)==null?void 0:v.map((r,l)=>{var L,J;const d=r.start??r.start_ms?(r.start??r.start_ms)/1e3:0,f=r.end??r.end_ms?(r.end??r.end_ms)/1e3:d+1,B=r.actor==="agent",c=B?((L=M.actor_map)==null?void 0:L.agent)||"Agent":((J=M.actor_map)==null?void 0:J.customer)||"Customer";return{startTime:d,endTime:f,actor:c,actorColor:B?"var(--rail-outcome)":"var(--rail-discovery)"}}))||[],ie=p.useMemo(()=>{if(!k&&W===0)return-1;const r=M.messages||[],l=W*1e3;for(let d=r.length-1;d>=0;d--){const f=r[d].start??r[d].start_ms;if(f!=null&&l>=f)return d}return-1},[W,k,M.messages]),U=r=>{y.current&&(y.current.currentTime=r,$(r))},le=()=>{if(y.current)if(k)y.current.pause(),q(!1);else{const r=y.current.play();r!==void 0&&r.catch(()=>{}),q(!0)}},V=()=>{y.current&&(y.current.currentTime=Math.max(0,y.current.currentTime-15))},ge=()=>{if(y.current){const r=N.duration_seconds||y.current.duration||0;y.current.currentTime=Math.min(r,y.current.currentTime+15)}},ze=r=>{y.current&&(y.current.playbackRate=r,Z(r))};p.useEffect(()=>{const r=y.current;if(!r)return;const l=()=>$(r.currentTime),d=()=>q(!0),f=()=>q(!1),B=()=>q(!1);return r.addEventListener("timeupdate",l),r.addEventListener("play",d),r.addEventListener("pause",f),r.addEventListener("ended",B),()=>{r.removeEventListener("timeupdate",l),r.removeEventListener("play",d),r.removeEventListener("pause",f),r.removeEventListener("ended",B)}},[o]);const ee=(r,l)=>{const d=y.current;if(!d||r==null)return;const f=r/1e3;d.currentTime=f,$(f);const B=d.play();if(B!==void 0&&B.catch(()=>{}),_.current&&(d.removeEventListener("timeupdate",_.current),_.current=null),l!=null){const c=l/1e3,L=()=>{d.currentTime>=c&&(d.pause(),_.current&&(d.removeEventListener("timeupdate",_.current),_.current=null))};_.current=L,d.addEventListener("timeupdate",L)}},te=(r,l,d)=>{const f=y.current;if(!f||r==null)return;const B=r/1e3,c=l!=null?l/1e3:B+1,L=f.currentTime;if(k&&L>=B&&(c==null||L<=c+.25)){f.pause();return}ee(r,l),d!=null&&d.length&&oe(d)},Te=(r,l)=>{const f=(M.messages||[])[l],B=y.current;if(!f||!B)return;const c=f.start??f.start_ms,L=f.end??f.end_ms;if(k&&ie===l){B.pause();return}c!=null&&ee(c,L)},oe=r=>{D(new Set(r));const l=document.getElementById("transcript-container");l&&l.scrollIntoView({behavior:"smooth",block:"nearest"}),setTimeout(()=>D(new Set),5e3)},se=r=>{R(l=>{const d=new Set(l);return d.has(r)?d.delete(r):d.add(r),d})},fe=((C=P.call_purpose)==null?void 0:C.interaction_driver)||A.one_liner||"Interaction Detail",[he,ye]=p.useState("signals"),ce=p.useRef(null),[Ie,_e]=p.useState(null);p.useLayoutEffect(()=>{if(i||!ce.current)return;const r=()=>{var f;const d=((f=ce.current)==null?void 0:f.offsetHeight)||0;d>0&&_e(d)};r();const l=window.requestAnimationFrame(r);return()=>window.cancelAnimationFrame(l)},[i,s,N,P]);const De=async r=>{if(b){await b(r);return}},me=async r=>{if(h)return h(r)},Re=async r=>{if(w){await w(r);return}},be=async r=>{if(T){await T(r);return}},Ee=a&&Object.keys(a).length>0?a:void 0;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"flex-start",gap:"10px",flexWrap:"wrap"},children:[e.jsxs("div",{ref:ce,style:{flex:"1 1 420px",minWidth:320,display:"flex",flexDirection:"column",gap:10},children:[e.jsx(Ne,{title:fe,meta:N,callPurpose:P.call_purpose,classification:P.classification,dimensions:X}),e.jsx(xe.AgentLiftCard,{outcomeLift:ae}),(i||s||m)&&e.jsx(ne.DetailCard,{title:"Coaching Summary",children:e.jsx($e,{data:s,loading:i,error:m})})]}),e.jsxs("div",{style:{flex:"1 1 420px",minWidth:320,display:"flex",flexDirection:"column",height:Ie},children:[e.jsx(He.Tabs,{tabs:[{key:"signals",label:"Signals"},{key:"guidance",label:"Guidance"}],active:he,onSelect:ye,size:"compact",borderTopRightRadius:12,borderTopLeftRadius:12}),e.jsxs("div",{className:"custom-thin-scrollbar-library",style:{flex:1,overflowY:"auto",display:"flex",flexDirection:"column",gap:10},children:[he==="signals"?e.jsx(qe,{signals:H,expandedSignals:I,toggleSignal:se,playEvidence:te,timelinePlaying:k,currentTimeSeconds:W,highlightTurns:oe,borderRadius:"0px 0px 12px 12px"}):e.jsx(Ke,{guidance:O,playEvidence:te,timelinePlaying:k,currentTimeSeconds:W,highlightTurns:oe,borderRadius:"0px 0px 12px 12px"}),e.jsx(Ye,{nba:K})]})]})]}),e.jsx(Ge,{audioUrl:o,timelineSegments:Ce,durationSeconds:N.duration_seconds,currentTimeSeconds:W,timelinePlaying:k,playbackRate:G,onSeek:U,onTogglePlay:le,onSeekBack:V,onSeekForward:ge,onSetPlaybackRate:ze,audioRef:y}),e.jsx(Ve,{transcript:M,audioUrl:o,highlightedTurns:F,activeTurnIndex:ie,timelinePlaying:k,turnObservations:re,setExpandedSignals:R,onTurnPlayPause:Te}),e.jsx(nt,{sessionTitle:fe,messageThread:Ee,currentUser:j,isLoading:x,onSendMessage:De,onEditMessage:me,onDeleteMessage:Re,onCreateNewThread:be,onThreadSelect:S})]})}class it extends p.Component{constructor(o){super(o),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(o,s){console.error("InteractionDetailPanel render error:",o,s==null?void 0:s.componentStack)}render(){return this.state.hasError?this.props.fallback:this.props.children}}function ot(n){return e.jsx(it,{fallback:e.jsx("div",{style:{padding:16,color:"var(--state-unknown)",fontSize:12},children:"Error rendering detail."}),children:e.jsx(rt,{...n})})}function st({pattern:n}){const[o,s]=p.useState(!1),a={name:"Customer Escalation Likelihood",description:"Based on observed patterns, this session shows indicators consistent with potential escalation.",technicalKey:"signal.escalation_likelihood",probability:.68,confidence:.81,observations:3};return n==="text-link"?e.jsxs("div",{style:{position:"relative",background:"rgba(255, 255, 255, 0.82)",border:"1px solid rgba(52, 58, 64, 0.12)",borderRadius:"12px",overflow:"hidden",boxShadow:"0 2px 4px rgba(30, 33, 37, 0.06)"},children:[e.jsx("div",{style:{position:"absolute",left:0,top:0,bottom:0,width:"5px",background:"#6B7C93",opacity:.6}}),e.jsxs("div",{style:{padding:"14px 16px 14px 21px"},children:[e.jsx("div",{style:{marginBottom:"4px"},children:e.jsx("span",{style:{fontSize:"13px",fontWeight:680,color:"rgba(30, 33, 37, 0.92)",lineHeight:1.2},children:a.name})}),e.jsx("div",{style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.65)",lineHeight:1.4,marginBottom:"6px"},children:a.description}),e.jsx("div",{style:{fontSize:"11px",color:"rgba(30, 33, 37, 0.42)",fontFamily:"ui-monospace, monospace",marginBottom:"8px"},children:a.technicalKey}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",fontSize:"11.5px",marginBottom:"10px"},children:[e.jsx("span",{style:{color:"rgba(139, 157, 127, 0.65)"},children:"prob"}),e.jsx("strong",{style:{color:"rgba(139, 157, 127, 0.85)"},children:a.probability.toFixed(2)}),e.jsx("span",{style:{color:"rgba(30, 33, 37, 0.24)"},children:"·"}),e.jsx("span",{style:{color:"rgba(184, 156, 106, 0.65)"},children:"conf"}),e.jsx("strong",{style:{color:"rgba(184, 156, 106, 0.85)"},children:a.confidence.toFixed(2)}),e.jsx("span",{style:{color:"rgba(30, 33, 37, 0.24)"},children:"·"}),e.jsxs("span",{style:{color:"rgba(30, 33, 37, 0.52)"},children:[a.observations," observations"]})]}),!o&&e.jsx("button",{onClick:()=>s(!0),style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.56)",background:"none",border:"none",padding:0,cursor:"pointer",textDecoration:"underline",textDecorationColor:"rgba(30, 33, 37, 0.2)"},onMouseEnter:i=>{i.currentTarget.style.color="rgba(30, 33, 37, 0.78)",i.currentTarget.style.textDecorationColor="rgba(30, 33, 37, 0.4)"},onMouseLeave:i=>{i.currentTarget.style.color="rgba(30, 33, 37, 0.56)",i.currentTarget.style.textDecorationColor="rgba(30, 33, 37, 0.2)"},children:"View contributing observations"})]}),o&&e.jsxs("div",{style:{borderTop:"1px solid rgba(52, 58, 64, 0.08)",background:"rgba(244, 241, 230, 0.25)",padding:"16px 16px 16px 21px"},children:[e.jsx("div",{style:{fontSize:"10px",fontWeight:650,letterSpacing:"0.08em",textTransform:"uppercase",color:"rgba(30, 33, 37, 0.52)",marginBottom:"8px"},children:"Contributing Observations"}),e.jsx("div",{style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.62)"},children:"[Observations would appear here]"}),e.jsx("button",{onClick:()=>s(!1),style:{marginTop:"10px",fontSize:"12px",color:"rgba(30, 33, 37, 0.56)",background:"none",border:"none",padding:0,cursor:"pointer",textDecoration:"underline",textDecorationColor:"rgba(30, 33, 37, 0.2)"},onMouseEnter:i=>{i.currentTarget.style.color="rgba(30, 33, 37, 0.78)",i.currentTarget.style.textDecorationColor="rgba(30, 33, 37, 0.4)"},onMouseLeave:i=>{i.currentTarget.style.color="rgba(30, 33, 37, 0.56)",i.currentTarget.style.textDecorationColor="rgba(30, 33, 37, 0.2)"},children:"Hide observations"})]})]}):n==="rotating-chevron"?e.jsxs("div",{style:{position:"relative",background:"rgba(255, 255, 255, 0.82)",border:"1px solid rgba(52, 58, 64, 0.12)",borderRadius:"12px",overflow:"hidden",boxShadow:"0 2px 4px rgba(30, 33, 37, 0.06)"},children:[e.jsx("div",{style:{position:"absolute",left:0,top:0,bottom:0,width:"5px",background:"#6B7C93",opacity:.6}}),e.jsx("button",{type:"button",onClick:()=>s(!o),style:{width:"100%",padding:"14px 16px 14px 21px",background:"transparent",border:"none",cursor:"pointer",textAlign:"left",transition:"background 0.15s ease"},onMouseEnter:i=>{i.currentTarget.style.background="rgba(231, 212, 162, 0.08)"},onMouseLeave:i=>{i.currentTarget.style.background="transparent"},children:e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px"},children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{marginBottom:"4px"},children:e.jsx("span",{style:{fontSize:"13px",fontWeight:680,color:"rgba(30, 33, 37, 0.92)",lineHeight:1.2},children:a.name})}),e.jsx("div",{style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.65)",lineHeight:1.4,marginBottom:"6px"},children:a.description}),e.jsx("div",{style:{fontSize:"11px",color:"rgba(30, 33, 37, 0.42)",fontFamily:"ui-monospace, monospace",marginBottom:"8px"},children:a.technicalKey}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",fontSize:"11.5px"},children:[e.jsx("span",{style:{color:"rgba(139, 157, 127, 0.65)"},children:"prob"}),e.jsx("strong",{style:{color:"rgba(139, 157, 127, 0.85)"},children:a.probability.toFixed(2)}),e.jsx("span",{style:{color:"rgba(30, 33, 37, 0.24)"},children:"·"}),e.jsx("span",{style:{color:"rgba(184, 156, 106, 0.65)"},children:"conf"}),e.jsx("strong",{style:{color:"rgba(184, 156, 106, 0.85)"},children:a.confidence.toFixed(2)}),e.jsx("span",{style:{color:"rgba(30, 33, 37, 0.24)"},children:"·"}),e.jsxs("span",{style:{color:"rgba(30, 33, 37, 0.52)"},children:[a.observations," observations"]})]})]}),e.jsx("div",{style:{paddingTop:"2px",color:"rgba(30, 33, 37, 0.42)",flexShrink:0,transition:"transform 0.2s ease"},children:e.jsx(z.ChevronDown,{size:18,style:{transform:o?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease"}})})]})}),o&&e.jsxs("div",{style:{borderTop:"1px solid rgba(52, 58, 64, 0.08)",background:"rgba(244, 241, 230, 0.25)",padding:"16px 16px 16px 21px"},children:[e.jsx("div",{style:{fontSize:"10px",fontWeight:650,letterSpacing:"0.08em",textTransform:"uppercase",color:"rgba(30, 33, 37, 0.52)",marginBottom:"8px"},children:"Contributing Observations"}),e.jsx("div",{style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.62)"},children:"[Observations would appear here]"})]})]}):e.jsxs("div",{style:{position:"relative",background:"rgba(255, 255, 255, 0.82)",border:"1px solid rgba(52, 58, 64, 0.12)",borderRadius:"12px",overflow:"hidden",boxShadow:"0 2px 4px rgba(30, 33, 37, 0.06)"},children:[e.jsx("div",{style:{position:"absolute",left:0,top:0,bottom:0,width:"5px",background:"#6B7C93",opacity:.6}}),e.jsxs("button",{type:"button",onClick:()=>s(!o),style:{width:"100%",padding:"14px 16px 14px 21px",background:"transparent",border:"none",cursor:"pointer",textAlign:"left",display:"flex",alignItems:"flex-start",gap:"12px",transition:"background 0.15s ease"},onMouseEnter:i=>{i.currentTarget.style.background="rgba(231, 212, 162, 0.08)"},onMouseLeave:i=>{i.currentTarget.style.background="transparent"},children:[e.jsx("div",{style:{paddingTop:"2px",color:"rgba(30, 33, 37, 0.42)",flexShrink:0},children:o?e.jsx(z.ChevronDown,{size:16}):e.jsx(z.ChevronRight,{size:16})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{marginBottom:"4px"},children:e.jsx("span",{style:{fontSize:"13px",fontWeight:680,color:"rgba(30, 33, 37, 0.92)",lineHeight:1.2},children:a.name})}),e.jsx("div",{style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.65)",lineHeight:1.4,marginBottom:"6px"},children:a.description}),e.jsx("div",{style:{fontSize:"11px",color:"rgba(30, 33, 37, 0.42)",fontFamily:"ui-monospace, monospace",marginBottom:"8px"},children:a.technicalKey}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",fontSize:"11.5px"},children:[e.jsx("span",{style:{color:"rgba(139, 157, 127, 0.65)"},children:"prob"}),e.jsx("strong",{style:{color:"rgba(139, 157, 127, 0.85)"},children:a.probability.toFixed(2)}),e.jsx("span",{style:{color:"rgba(30, 33, 37, 0.24)"},children:"·"}),e.jsx("span",{style:{color:"rgba(184, 156, 106, 0.65)"},children:"conf"}),e.jsx("strong",{style:{color:"rgba(184, 156, 106, 0.85)"},children:a.confidence.toFixed(2)}),e.jsx("span",{style:{color:"rgba(30, 33, 37, 0.24)"},children:"·"}),e.jsxs("span",{style:{color:"rgba(30, 33, 37, 0.52)"},children:[a.observations," observations"]})]})]})]}),o&&e.jsxs("div",{style:{borderTop:"1px solid rgba(52, 58, 64, 0.08)",background:"rgba(244, 241, 230, 0.25)",padding:"16px 16px 16px 21px"},children:[e.jsx("div",{style:{fontSize:"10px",fontWeight:650,letterSpacing:"0.08em",textTransform:"uppercase",color:"rgba(30, 33, 37, 0.52)",marginBottom:"8px"},children:"Contributing Observations"}),e.jsx("div",{style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.62)"},children:"[Observations would appear here]"})]})]})}exports.ConditionCard=Q.ConditionCard;exports.ModelScoreCard=Q.ModelScoreCard;exports.ObservationCard=Q.ObservationCard;exports.ScoreDriverCard=Q.ScoreDriverCard;exports.ScoreDriverCardVariant=Q.ScoreDriverCardVariant;exports.SignalCard=Q.SignalCard;exports.SmallObservationCard=Q.SmallObservationCard;exports.SummarySection=Q.SummarySection;exports.AgentLiftCard=xe.AgentLiftCard;exports.EvidenceItem=xe.EvidenceItem;exports.CoachingSynthesisCard=$e;exports.ExpandPatternComparison=st;exports.InteractionContext=Ne;exports.InteractionDetailPanel=ot;exports.InteractionGuidance=Ke;exports.InteractionNBA=Ye;exports.InteractionRecording=Ge;exports.InteractionScores=Ue;exports.InteractionSignals=qe;exports.InteractionTranscript=Ve;
10
+ `,document.head.appendChild(n)}function $e({data:n,loading:o,error:s}){var C,T;if(p.useEffect(()=>{Qe()},[]),o)return e.jsxs("div",{style:{padding:"20px 0",display:"flex",flexDirection:"column",gap:12},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("div",{style:{width:6,height:6,borderRadius:"50%",background:"var(--rail-tone)",animation:"coaching-pulse 1.5s ease-in-out infinite"}}),e.jsx("span",{style:{fontSize:"var(--text-base)",color:"var(--rail-tone)",fontFamily:"var(--font-sans)",fontWeight:500},children:"Compass is synthesizing coaching insights…"})]}),[180,260,220].map((S,u)=>e.jsx("div",{style:{height:10,width:S,maxWidth:"100%",borderRadius:4,background:"linear-gradient(90deg, var(--hover-warm-subtle) 25%, var(--hover-warm) 50%, var(--hover-warm-subtle) 75%)",backgroundSize:"200% 100%",animation:"coaching-shimmer 1.8s ease-in-out infinite",animationDelay:`${u*.2}s`}},u))]});if(s)return e.jsx("div",{style:{padding:"16px 0",fontSize:"var(--text-base)",color:"var(--text-faint)",fontFamily:"var(--font-sans)"},children:"Unable to generate coaching summary."});if(!n)return null;const a=n.strengths||[],i=n.improvements||[],m=n.organizational||n.organizational_insights||[],b=typeof n.one_liner=="string"?n.one_liner:((C=n.one_liner)==null?void 0:C.text)||"",h=typeof n.context=="string"?n.context:((T=n.context)==null?void 0:T.text)||"";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14,fontFamily:"var(--font-sans)"},children:[b&&e.jsx("div",{style:{fontSize:"var(--text-lg)",fontWeight:600,color:"var(--text-strong)",lineHeight:1.4},children:b}),h&&e.jsx("div",{style:{fontSize:"var(--text-base)",color:"var(--text-muted)",lineHeight:1.45},children:h}),a.length>0&&e.jsx(Be,{icon:e.jsx(z.TrendingUp,{size:13}),label:"Strengths",color:"var(--rail-discovery)",items:a}),i.length>0&&e.jsx(Be,{icon:e.jsx(z.Lightbulb,{size:13}),label:"Improvements",color:"var(--rail-compliance)",items:i}),m.length>0&&e.jsx(Be,{icon:e.jsx(z.Building,{size:13}),label:"Organizational",color:"var(--rail-outcome)",items:m}),n.overall&&e.jsxs("div",{style:{fontSize:"var(--text-base)",color:"var(--text-faint)",fontStyle:"italic",marginTop:2},children:["Overall: ",n.overall.replace(/_/g," ")]})]})}function Be({icon:n,label:o,color:s,items:a}){return e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,marginBottom:6,color:s,fontSize:"var(--text-base)",fontWeight:650,letterSpacing:"0.04em"},children:[n,o]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:a.map((i,m)=>{const b=typeof i=="string"?i:(i==null?void 0:i.text)||"",h=typeof i=="object"?i==null?void 0:i.quote:null;return e.jsxs("div",{style:{paddingLeft:14},children:[e.jsxs("div",{style:{fontSize:"var(--text-base)",color:"var(--text-base)",lineHeight:1.4},children:["• ",b]}),h&&e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:4,marginTop:3,paddingLeft:8},children:[e.jsx(z.MessageSquareQuote,{size:10,style:{color:"var(--text-faint)",flexShrink:0,marginTop:2}}),e.jsxs("span",{style:{fontSize:"var(--text-base)",color:"var(--text-muted)",fontStyle:"italic",lineHeight:1.35},children:['"',h,'"']})]})]},m)})})]})}function Xe(n){const o=Math.floor(n/60),s=Math.round(n%60);return`${o}:${s.toString().padStart(2,"0")}`}function Ne({title:n,meta:o,callPurpose:s,classification:a,dimensions:i}){const m=s||{},b=a||{};return e.jsxs(ne.Card,{variant:"elevated",padding:"sm",children:[e.jsx("div",{style:{fontSize:"var(--text-md)",fontWeight:550,color:"var(--text-strong)",lineHeight:1.375,marginBottom:6},children:n}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:"4px 12px",fontSize:11,color:"var(--text-muted)"},children:[o.evaluated_dt&&e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"Date"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-base)"},children:new Date(o.evaluated_dt).toLocaleString()})]}),o.duration_seconds!=null&&e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"Duration"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-base)"},children:Xe(o.duration_seconds)})]}),o.message_count&&e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"Messages"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-base)"},children:o.message_count})]}),m.interaction_direction&&e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"Direction"}),e.jsx("div",{style:{color:"var(--text-base)"},children:m.interaction_direction})]}),m.interaction_driver&&e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"Driver"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-base)"},children:m.interaction_driver})]}),m.customer_intent&&e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"Intent"}),e.jsx("div",{style:{color:"var(--text-base)"},children:m.customer_intent})]}),b.interaction_paradigm&&e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"Paradigm"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-base)"},children:b.interaction_paradigm})]}),i.map((h,C)=>e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:10,color:"var(--text-faint)"},children:h.label||h.key}),e.jsx("div",{style:{fontSize:12,color:"var(--text-base)"},children:h.value})]},C))]}),o.session_id&&e.jsx("div",{style:{fontSize:10,color:"var(--text-faint)",fontFamily:"var(--font-mono)",marginTop:4,userSelect:"all"},children:o.session_id})]})}function Ue({scores:n}){return n!=null&&n.length?e.jsx(ne.DetailCard,{title:"Scores",children:e.jsx("div",{style:{display:"flex",gap:24,flexWrap:"wrap"},children:n.map((o,s)=>{const a=o.value!=null?Math.round(o.value):null;return e.jsxs("div",{style:{textAlign:"center",minWidth:48},children:[e.jsx("div",{style:{fontSize:20,fontWeight:700,color:"var(--text-ink)"},children:a??"—"}),e.jsx("div",{style:{fontSize:"var(--text-sm)",color:"var(--text-muted)",marginTop:2},children:o.label||o.key})]},s)})})}):null}const Pe={outcome:{label:"Outcome",icon:e.jsx(z.Target,{size:12}),color:"var(--rail-outcome)"},process:{label:"Process & Protocol",icon:e.jsx(z.FileText,{size:12}),color:"var(--rail-discovery)"},compliance:{label:"Compliance",icon:e.jsx(z.Scale,{size:12}),color:"var(--rail-compliance)"},customer_friction:{label:"Customer Friction",icon:e.jsx(z.Zap,{size:12}),color:"var(--rail-coral)"},experience:{label:"Experience",icon:e.jsx(z.MessageSquare,{size:12}),color:"var(--rail-teal)"}},et={risk:{icon:e.jsx(z.Zap,{size:10}),color:"var(--rail-signal-churn)"},opportunity:{icon:e.jsx(z.Lightbulb,{size:10}),color:"var(--state-unknown)"},excellence:{icon:e.jsx(z.CheckCircle,{size:10}),color:"var(--rail-teal)"}};function qe({signals:n,expandedSignals:o,toggleSignal:s,playEvidence:a,timelinePlaying:i,currentTimeSeconds:m,highlightTurns:b,borderRadius:h}){var T;if(!((T=n==null?void 0:n.signals)!=null&&T.length))return null;const C=p.useMemo(()=>{const S={};for(const u of n.signals){const j=u.group||"experience";S[j]||(S[j]=[]),S[j].push(u)}return S},[n]);return e.jsx(ne.DetailCard,{title:`Signals (${n.present_count} present / ${n.total_signals_evaluated} evaluated)`,borderRadius:h,children:Object.entries(C).map(([S,u])=>{const j=Pe[S]||Pe.experience;return e.jsxs("div",{style:{marginBottom:10},children:[e.jsxs(He.SectionLabel,{style:{display:"flex",alignItems:"center",gap:4},children:[j.icon,e.jsx("span",{children:j.label})]}),e.jsx("div",{style:{marginTop:4,display:"flex",flexDirection:"column",gap:6},children:u.map((x,y)=>{var D,L,$;const _=x.display_name||x.key||"",F=(D=x.baseline)==null?void 0:D.delta,R=((L=x.observations)==null?void 0:L.length)>0,I=o.has(x.key);return e.jsxs("div",{id:`signal-${x.key}`,style:{border:"1px solid var(--border, rgba(52, 58, 64, 0.12))",borderRadius:"var(--radius-md, 8px)",background:"var(--paper, rgba(255, 255, 255, 0.98))",overflow:"hidden"},children:[e.jsxs("button",{type:"button",onClick:k=>{R&&(s(x.key),k.currentTarget.blur())},style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 10px",background:"transparent",borderTop:"1px solid transparent",borderRight:"1px solid transparent",borderLeft:"1px solid transparent",borderBottom:"1px solid var(--border, rgba(52, 58, 64, 0.08))",cursor:R?"pointer":"default"},title:[x.confidence!=null?`Confidence: ${Math.round(x.confidence*100)}%`:"",F!=null?`Δ baseline: ${F>0?"+":""}${(F*100).toFixed(1)}%`:""].filter(Boolean).join(" · "),children:[e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,whiteSpace:"nowrap"},children:[($=et[x.kind])==null?void 0:$.icon,e.jsx("span",{children:_}),R&&e.jsxs("span",{style:{marginLeft:4,fontSize:10,opacity:.6},children:["(",x.observations.length,")"]})]}),R&&e.jsx(z.ChevronDown,{size:14,style:{color:"var(--text-muted)",flexShrink:0,transform:I?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.16s ease"}})]}),I&&x.observations&&e.jsx("div",{style:{width:"100%",margin:"0 0 6px"},children:x.observations.map((k,q)=>{var G;return e.jsx("div",{style:{marginBottom:6},children:e.jsxs("div",{style:{display:"flex",borderRadius:"var(--radius-sm, 8px)",background:"var(--paper, #fff)",overflow:"hidden"},children:[e.jsx("div",{style:{width:3,background:j.color}}),e.jsxs("div",{style:{flex:1,fontSize:"var(--text-sm)",color:"var(--text-muted)",padding:"8px 12px"},children:[e.jsx("div",{style:{fontWeight:600,color:"var(--text-base)",marginBottom:3,fontSize:"var(--text-base)"},children:k.key||""}),e.jsx("div",{style:{marginBottom:6,lineHeight:1.4},children:k.reason||k.explanation||""}),(G=k.evidence)==null?void 0:G.map((Z,N)=>{const M=Z.start_ms,A=Z.end_ms;let H=!1;if(M!=null&&i){const O=M/1e3,W=A!=null?A/1e3:O+1,K=m??0;H=K>=O&&K<=W+.25}return e.jsx(ue.EvidenceItem,{ev:Z,isPlaying:H,railColor:j.color,onPlay:(O,W)=>a==null?void 0:a(O,W,Z.turn_ids),onHighlight:b},N)})]})]})},q)})})]},y)})})]},S)})})}const Me={risk:{icon:e.jsx(z.Zap,{size:10}),color:"var(--rail-signal-churn)"},opportunity:{icon:e.jsx(z.Lightbulb,{size:10}),color:"var(--state-unknown)"},excellence:{icon:e.jsx(z.CheckCircle,{size:10}),color:"var(--rail-teal)"}};function Ke({guidance:n,playEvidence:o,timelinePlaying:s,currentTimeSeconds:a,highlightTurns:i,borderRadius:m}){var b;return(b=n==null?void 0:n.items)!=null&&b.length?e.jsx(ne.DetailCard,{title:`Guidance (${n.total_items} items)`,borderRadius:m,children:e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:n.items.map((h,C)=>{var u;const T=Me[h.guidance_kind]||Me.excellence,S=h.owner==="organization"?{bg:"color-mix(in srgb, var(--rail-discovery) 15%, transparent)",color:"var(--rail-discovery)",text:"ORG"}:h.owner==="shared"?{bg:"color-mix(in srgb, var(--state-unknown) 15%, transparent)",color:"var(--state-unknown)",text:"SHARED"}:{bg:"color-mix(in srgb, var(--rail-teal) 10%, transparent)",color:"var(--rail-teal)",text:"AGENT"};return e.jsxs("div",{style:{padding:"10px 12px",borderRadius:"var(--radius)",background:"var(--paper)",borderLeft:`3px solid ${T.color}`},children:[e.jsxs("div",{style:{fontSize:"var(--text-base)",color:"var(--text-strong)",display:"flex",alignItems:"center",gap:5,fontWeight:550},children:[T.icon," ",h.title||"",e.jsx("span",{style:{fontSize:9,padding:"1px 6px",borderRadius:8,marginLeft:4,background:S.bg,color:S.color,fontWeight:600},children:S.text})]}),h.detail&&e.jsx("div",{style:{fontSize:"var(--text-sm)",color:"var(--text-muted)",marginTop:4,lineHeight:1.4},children:h.detail}),(u=h.signal_refs)==null?void 0:u.map((j,x)=>{var y;return e.jsxs("div",{style:{marginTop:6},children:[e.jsxs("div",{style:{fontSize:10,color:"var(--text-muted)",fontWeight:600,marginBottom:3,display:"flex",alignItems:"center",gap:3},children:[e.jsx(z.CornerDownRight,{size:10})," ",j.display_name||j.signal_key,j.confidence!=null&&e.jsxs("span",{style:{fontWeight:400,opacity:.7},children:[" ","(",Math.round(j.confidence*100),"%)"]})]}),(y=j.evidence)==null?void 0:y.map((_,F)=>{const R=_.start_ms,I=_.end_ms;let D=!1;if(R!=null&&s){const L=R/1e3,$=I!=null?I/1e3:L+1,k=a??0;D=k>=L&&k<=$+.25}return e.jsx(ue.EvidenceItem,{ev:_,isPlaying:D,onPlay:(L,$)=>o==null?void 0:o(L,$,_.turn_ids),onHighlight:i},F)})]},x)})]},C)})})}):null}function Ye({nba:n}){const o=(n==null?void 0:n.recommendations)||(n==null?void 0:n.actions)||[];return o.length?e.jsx(ne.DetailCard,{title:"Next Best Actions",children:e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:o.slice(0,8).map((s,a)=>e.jsxs("div",{style:{fontSize:11,color:"var(--text-muted)",display:"flex",alignItems:"center",gap:4},children:[e.jsx(z.Target,{size:12})," ",e.jsx("strong",{style:{color:"var(--text-base)"},children:s.action||s.title||""}),s.rationale&&` — ${s.rationale}`]},a))})}):null}function Ge({audioUrl:n,timelineSegments:o,durationSeconds:s,currentTimeSeconds:a,timelinePlaying:i,playbackRate:m,onSeek:b,onTogglePlay:h,onSeekBack:C,onSeekForward:T,onSetPlaybackRate:S,audioRef:u}){return n?e.jsxs(ne.DetailCard,{title:"Recording",children:[e.jsx(Oe.Timeline,{segments:o,durationSeconds:s||0,currentTimeSeconds:a,onSeek:b,showControls:!0,hasRecording:!0,timelinePlaying:i,playbackRate:m,onTogglePlay:h,onSeekBack:C,onSeekForward:T,onSetPlaybackRate:S}),e.jsx("audio",{ref:u,preload:"none",style:{display:"none"},children:e.jsx("source",{src:n,type:"audio/mpeg"})})]}):null}function Ve({transcript:n,audioUrl:o,highlightedTurns:s,activeTurnIndex:a,timelinePlaying:i,turnObservations:m,setExpandedSignals:b,onTurnPlayPause:h}){var S;if(!((S=n==null?void 0:n.messages)!=null&&S.length))return null;const C=(u,j)=>{if(u==null)return;const x=F=>{const R=Math.floor(F/6e4),I=Math.floor(F%6e4/1e3);return`${R.toString().padStart(2,"0")}:${I.toString().padStart(2,"0")}`},y=x(u),_=j!=null?x(j):y;return`${y}–${_}`},T=n.messages.map((u,j)=>{var x,y;return{actor:u.actor==="agent"?((x=n.actor_map)==null?void 0:x.agent)||"Agent":((y=n.actor_map)==null?void 0:y.customer)||"Customer",actorType:u.actor==="agent"?"agent":"customer",text:u.text||"",timeRange:C(u.start??u.start_ms,u.end??u.end_ms),isHighlighted:s.has(j),highlightColor:i&&a===j?u.actor==="agent"?"var(--rail-outcome)":"var(--rail-discovery)":void 0,observations:(m[j]||[]).map(_=>({..._,onClick:()=>{b(F=>new Set([...F,_.signalKey])),setTimeout(()=>{const F=document.getElementById(`signal-${_.signalKey}`);F&&F.scrollIntoView({behavior:"smooth",block:"nearest"})},100)}}))}});return e.jsx("div",{id:"transcript-container",children:e.jsx(Oe.TranscriptCard,{turns:T,audioUrl:o,activeTurnIndex:a,autoScrollActiveTurn:i,isExternalPlaying:i,onTurnPlayPause:h})})}const Le={padding:0,border:"none",background:"transparent",fontSize:"12px",fontWeight:500,color:"rgba(30, 33, 37, 0.65)",cursor:"pointer",fontFamily:"inherit"},Ze=n=>{if(!n)return null;const o=String(n).toLowerCase();return o==="supervisor"?"var(--rail-compliance)":o==="admin"||o==="administrator"?"var(--rail-discovery)":o==="agent"?"var(--rail-outcome)":null},Ae=n=>{if(!n)return[];const o=[n.messages,n.comments,n.thread_messages,n.items,n.children];for(const s of o)if(Array.isArray(s)&&s.length)return s;return n.messages&&Array.isArray(n.messages.data)?n.messages.data:[]},Fe=(n,o=null,s=0)=>{const a=[];return(n||[]).forEach((i,m)=>{const b=i.author||{},h=b.name||i.author_name||"Unknown",C=b.initials||h.split(" ").map(y=>y[0]).join("").toUpperCase()||"U",T=b.role||i.author_role,S=Ze(T),u=b.color||i.author_color||S||"#6B7C93",j=i.id||`msg-${s+m}`,x={id:j,author:{name:h,initials:C,color:u,role:T},content:i.content||i.text||"",timestamp:i.timestamp||i.created_at_display||i.created_at||"",type:i.type||"comment",isEdited:i.isEdited||i.is_edited||i.edited||!1,references:i.references||[],parentId:i.parentId||i.parent_message_id||o||null};a.push(x),Array.isArray(i.replies)&&i.replies.length>0&&a.push(...Fe(i.replies,j,s+a.length))}),a},tt=n=>{if(!n)return"";if(!/^\d{4}-\d{2}-\d{2}T/.test(n))return n;try{const o=new Date(n);if(Number.isNaN(o.getTime()))return n;const s=new Date,a=o.getFullYear()===s.getFullYear()&&o.getMonth()===s.getMonth()&&o.getDate()===s.getDate(),i=new Date(s);i.setDate(i.getDate()-1);const m=o.getFullYear()===i.getFullYear()&&o.getMonth()===i.getMonth()&&o.getDate()===i.getDate(),b=o.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1});if(a)return`Today at ${b}`;if(m)return`Yesterday at ${b}`;const C=(s.getTime()-o.getTime())/(1e3*60*60*24);return C<7&&C>0?`${o.toLocaleDateString(void 0,{weekday:"long"})} at ${b}`:`${o.toLocaleDateString(void 0,{month:"short",day:"numeric",year:o.getFullYear()!==s.getFullYear()?"numeric":void 0})} at ${b}`}catch{return n}};function nt({sessionTitle:n,sessionSubtitle:o,threadLabel:s,messages:a,messageThread:i,onSendMessage:m,onReplyMessage:b,onEditMessage:h,onDeleteMessage:C,onCreateNewThread:T,onThreadSelect:S,currentUser:u,isLoading:j=!1}){const[x,y]=p.useState(""),[_,F]=p.useState(!1),[R,I]=p.useState(a||[]),[D,L]=p.useState(!1),[$,k]=p.useState(null),[q,G]=p.useState([]),[Z,N]=p.useState(null),[M,A]=p.useState(null),[H,O]=p.useState(""),[W,K]=p.useState(null),[P,X]=p.useState(""),[ae,re]=p.useState(null),[we,ie]=p.useState(!1),[U,le]=p.useState(""),[V,ge]=p.useState(!1),[ze,ee]=p.useState(new Set),te=p.useRef(null),Te=p.useRef(null),oe=u&&u.role&&String(u.role).toLowerCase()||"",se=p.useMemo(()=>{if(!u)return{name:"You",initials:"YO",color:"#6B7C93"};const t=u.name||"You",g=u.initials||t.split(" ").map(l=>l[0]).join("").toUpperCase()||"YO",v=u.role&&String(u.role).toLowerCase(),w=Ze(v),r=u.color||w||"#6B7C93";return{...u,name:t,initials:g,color:r}},[u]),fe=oe==="supervisor"||oe==="admin",he=p.useMemo(()=>{const t={};return(R||[]).forEach(g=>{g.parentId&&(t[g.parentId]||(t[g.parentId]=[]),t[g.parentId].push(g))}),t},[R]),ye=p.useMemo(()=>(R||[]).filter(t=>!t.parentId),[R]),ce=t=>M===t,Ie=t=>W===t,_e=s||n||o,Re=M?R.find(t=>t.id===M):null;p.useEffect(()=>{i||a&&I(a)},[a,i]),p.useEffect(()=>{if(!i)return;const t=Array.isArray(i.threads)?i.threads:Array.isArray(i.items)?i.items:[];if(t.length>0){const v=t.map((l,d)=>{const f=l.id||l.thread_id||`thread-${d+1}`,E=l.label||l.title||(d===0?s||"Session":`Thread ${d+1}`),c=Ae(l),B=Fe(c);return{id:f,label:E,messages:B}});G(v);const w=v.find(l=>(l.messages||[]).length>0)||v[0],r=(w==null?void 0:w.messages)||[];I(r),ee(new Set),N((w==null?void 0:w.id)||null);return}const g=Ae(i);if(g.length){const v=Fe(g);I(v),ee(new Set);const w=i.id||"thread-1",r=i.title||s||"Thread 1";G([{id:w,label:r}]),N(w)}},[i,s]),p.useEffect(()=>{s&&G(t=>t.map((g,v)=>v===0?{...g,label:s}:g))},[s]),p.useEffect(()=>{if(!te.current||!R||R.length===0)return;const t=te.current.parentElement;t?t.scrollTop=t.scrollHeight:te.current.scrollIntoView({behavior:"smooth",block:"end"})},[R]);const me=async()=>{const t=U.trim();if(t){ge(!0);try{const g=`thread-${Date.now()}`;G(v=>[...v,{id:g,label:t.slice(0,32)||`Thread ${v.length+1}`}]),N(g),await(T==null?void 0:T(t)),le(""),ie(!1)}finally{ge(!1)}}},De=()=>{ie(!1),le("")},be=async()=>{const t=x.trim();if(!t)return;const g=t;y("");const v=`temp-${Date.now()}`,w={id:v,author:se,content:g,timestamp:"Just now",type:"comment",isOptimistic:!0,parentId:M||null};if(I(r=>[...r,w]),m){L(!0);try{await m({content:g,parent_message_id:M||null}),I(r=>r.map(l=>l.id===v?{...l,isOptimistic:!1}:l))}catch{I(r=>r.filter(l=>l.id!==v))}finally{L(!1)}A(null);return}I(r=>r.map(l=>l.id===v?{...l,isOptimistic:!1}:l)),A(null)},Ee=t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),be())},ve=t=>{A(t.id),O(""),K(null),X(""),k(null),b==null||b(t)},je=async t=>{const g=H.trim();if(!g)return;const v=`reply-${Date.now()}`,w={id:v,author:se,content:g,timestamp:"Just now",type:"comment",isOptimistic:!m,parentId:t};I(r=>[...r,w]),L(!0);try{m&&(await m({content:g,parent_message_id:t}),I(r=>r.map(l=>l.id===v?{...l,isOptimistic:!1}:l))),A(null),O("")}catch{m&&I(r=>r.filter(l=>l.id!==v))}finally{L(!1)}},Se=t=>{K(t.id),X(t.content||""),A(null),O(""),k(null)},de=async()=>{const t=P.trim();if(!(!t||!W))try{const g=await(h==null?void 0:h({id:W,content:t}));if(g&&typeof g=="object"&&g.success===!1)return;I(v=>v.map(w=>w.id===W?{...w,content:t,isEdited:!0}:w)),K(null),X("")}catch(g){console.error("MessageThread edit failed:",g)}},pe=()=>{K(null),X("")},ke=t=>{re(t),k(null)},Ce=async()=>{if(!ae)return;const t=ae;re(null),I(g=>g.filter(v=>v.id!==t.id)),await(C==null?void 0:C(t))},xe=(t,g=0)=>{var f,E;const v=he[t.id]||[],w=v.length>0,r=ze.has(t.id),l=Ie(t.id),d=ce(t.id);return e.jsx("div",{children:e.jsxs("div",{onMouseEnter:()=>t.type!=="system"&&k(t.id),onMouseLeave:()=>k(null),style:{display:"flex",gap:"12px",opacity:t.type==="system"?.75:1,padding:"4px 0",margin:"0 -4px",borderRadius:"8px",marginLeft:g>0?16:0},children:[t.type!=="system"?e.jsx("div",{style:{width:"36px",height:"36px",borderRadius:"50%",background:t.author.color,color:"white",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"11px",fontWeight:650,flexShrink:0},children:t.author.initials}):e.jsx("div",{style:{width:"36px",height:"36px",borderRadius:"50%",background:"rgba(30, 33, 37, 0.1)",color:"rgba(30, 33, 37, 0.55)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(z.Clock,{size:16})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",flexWrap:"wrap",gap:"8px",marginBottom:"6px",justifyContent:"space-between"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",flexWrap:"wrap",gap:"8px"},children:[e.jsx("span",{style:{fontSize:"13px",fontWeight:650,color:"rgba(30, 33, 37, 0.9)"},children:t.author.name}),t.timestamp&&e.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--default-mono-font-family)",color:"rgba(30, 33, 37, 0.5)"},children:tt(t.timestamp)}),((f=t.author)==null?void 0:f.role)&&e.jsx("span",{style:{display:"inline-flex",alignItems:"center",fontSize:"10px",color:"rgba(30, 33, 37, 0.6)",background:"rgba(30, 33, 37, 0.08)",padding:"3px 8px",borderRadius:"6px",textTransform:"uppercase",letterSpacing:"0.04em",fontWeight:600},children:String(t.author.role)}),(t.isEdited||t.is_edited)&&e.jsx("span",{style:{fontSize:"10px",color:"rgba(30, 33, 37, 0.5)",fontStyle:"italic"},children:"(Edited)"})]}),t.type!=="system"&&$===t.id&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flexShrink:0},children:[e.jsx("button",{type:"button",onClick:c=>{c.preventDefault(),c.stopPropagation(),ve(t)},style:Le,children:"Reply"}),h&&e.jsx("button",{type:"button",onClick:c=>{c.preventDefault(),c.stopPropagation(),Se(t)},style:Le,children:"Edit"}),C&&e.jsx("button",{type:"button",onClick:c=>{c.preventDefault(),c.stopPropagation(),ke(t)},style:{...Le,color:"rgba(198, 99, 99, 0.9)"},children:"Delete"})]})]}),l?e.jsxs("div",{style:{marginTop:"4px"},children:[e.jsx("textarea",{value:P,onChange:c=>X(c.target.value),onKeyDown:c=>{c.key==="Enter"&&!c.shiftKey&&(c.preventDefault(),de()),c.key==="Escape"&&pe()},placeholder:"Edit message...",autoFocus:!0,style:{width:"100%",minHeight:"56px",padding:"8px 12px",fontSize:"13px",color:"rgba(30, 33, 37, 0.88)",background:"white",border:"1px solid rgba(52, 58, 64, 0.2)",borderRadius:"6px",resize:"vertical",outline:"none",fontFamily:"inherit",lineHeight:1.5,marginBottom:"8px"}}),e.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end",alignItems:"center"},children:[e.jsx("button",{type:"button",onClick:pe,style:{padding:"8px 16px",fontSize:"12px",fontWeight:600,color:"rgba(30, 33, 37, 0.45)",background:"rgba(30, 33, 37, 0.1)",border:"none",borderRadius:"6px",cursor:"pointer",display:"flex",alignItems:"center",gap:"6px",transition:"all 0.15s ease"},onMouseEnter:c=>{c.currentTarget.style.background="rgba(30, 33, 37, 0.15)",c.currentTarget.style.color="rgba(30, 33, 37, 0.7)"},onMouseLeave:c=>{c.currentTarget.style.background="rgba(30, 33, 37, 0.1)",c.currentTarget.style.color="rgba(30, 33, 37, 0.45)"},children:"Cancel"}),e.jsx("button",{type:"button",onClick:de,disabled:!(P!=null&&P.trim()),style:{padding:"8px 16px",fontSize:"12px",fontWeight:600,color:P!=null&&P.trim()?"white":"rgba(30, 33, 37, 0.45)",background:P!=null&&P.trim()?"var(--Base-Strong, #0B0B0B)":"#ECEEF2",border:"none",borderRadius:"6px",cursor:P!=null&&P.trim()?"pointer":"not-allowed",display:"flex",alignItems:"center",gap:"6px",transition:"all 0.15s ease"},children:"Edit"})]})]}):e.jsx("div",{style:{fontSize:"13px",color:"rgba(30, 33, 37, 0.88)",lineHeight:1.55,marginBottom:(E=t.references)!=null&&E.length?"8px":0},children:t.content}),d&&e.jsxs("div",{style:{marginTop:"12px"},children:[e.jsx("textarea",{value:H,onChange:c=>O(c.target.value),onKeyDown:c=>{c.key==="Escape"&&(A(null),O(""))},placeholder:"Type your reply...",disabled:D,autoFocus:!0,style:{width:"100%",minHeight:"64px",padding:"8px 12px",fontSize:"13px",color:"rgba(30, 33, 37, 0.88)",background:"white",border:"1px solid rgba(52, 58, 64, 0.16)",borderRadius:"6px",resize:"vertical",outline:"none",fontFamily:"inherit",lineHeight:1.5,marginBottom:"10px"}}),e.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end",alignItems:"center"},children:[e.jsx("button",{type:"button",onClick:()=>{A(null),O("")},disabled:D,style:{padding:"8px 16px",fontSize:"12px",fontWeight:600,color:"rgba(30, 33, 37, 0.45)",background:"rgba(30, 33, 37, 0.1)",border:"none",borderRadius:"6px",cursor:D?"not-allowed":"pointer"},children:"Cancel"}),e.jsx("button",{type:"button",onClick:()=>je(t.id),disabled:!H.trim()||D,style:{padding:"8px 16px",fontSize:"12px",fontWeight:600,color:H.trim()&&!D?"white":"rgba(30, 33, 37, 0.45)",background:H.trim()&&!D?"var(--Base-Strong, #0B0B0B)":"#ECEEF2",border:"none",borderRadius:"6px",cursor:H.trim()&&!D?"pointer":"not-allowed"},children:"Reply"})]})]}),w&&e.jsxs("div",{style:{marginTop:8},children:[e.jsxs("button",{type:"button",onClick:()=>ee(c=>{const B=new Set(c);return B.has(t.id)?B.delete(t.id):B.add(t.id),B}),style:{display:"inline-flex",alignItems:"center",gap:6,padding:"4px 8px",fontSize:"12px",fontWeight:500,color:"rgba(30, 33, 37, 0.6)",background:"transparent",border:"none",borderRadius:6,cursor:"pointer"},title:r?"Collapse replies":"Expand replies",children:[e.jsx(z.ChevronRight,{size:14,style:{flexShrink:0,transform:r?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.2s ease"}}),e.jsxs("span",{children:[v.length," ",v.length===1?"reply":"replies"]})]}),r&&e.jsx("div",{style:{marginTop:8,marginLeft:16,paddingLeft:16,borderLeft:"2px solid rgba(52, 58, 64, 0.14)"},children:v.map(c=>xe(c,g+1))})]})]})]})},t.id)};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"rgba(255, 255, 255, 0.98)",border:"1px solid rgba(52, 58, 64, 0.12)",borderRadius:"12px",overflow:"hidden",position:"relative"},children:[ae&&e.jsx("div",{style:{position:"absolute",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(30, 33, 37, 0.35)",borderRadius:"12px"},onClick:()=>re(null),children:e.jsxs("div",{style:{background:"white",borderRadius:"12px",padding:"20px 24px",boxShadow:"0 8px 24px rgba(30, 33, 37, 0.15)",maxWidth:"320px",width:"90%"},onClick:t=>t.stopPropagation(),children:[e.jsx("p",{style:{margin:0,marginBottom:"20px",fontSize:"14px",fontWeight:500,color:"rgba(30, 33, 37, 0.9)",lineHeight:1.45},children:"Do you really want to delete?"}),e.jsxs("div",{style:{display:"flex",gap:"10px",justifyContent:"flex-end"},children:[e.jsx("button",{type:"button",onClick:()=>re(null),style:{padding:"8px 16px",fontSize:"12px",fontWeight:600,color:"rgba(30, 33, 37, 0.45)",background:"rgba(30, 33, 37, 0.1)",border:"none",borderRadius:"6px",cursor:"pointer"},children:"Cancel"}),e.jsx("button",{type:"button",onClick:Ce,style:{padding:"8px 16px",fontSize:"12px",fontWeight:600,color:"white",background:"var(--Base-Strong, #0B0B0B)",border:"none",borderRadius:"6px",cursor:"pointer"},children:"Delete"})]})]})}),_e&&e.jsx("div",{style:{padding:"14px 16px",borderBottom:"1px solid rgba(52, 58, 64, 0.12)",background:"rgba(255, 255, 255, 0.98)"},children:e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:"8px"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"14px",fontWeight:600,color:"rgba(30, 33, 37, 0.95)",marginBottom:"4px"},children:s||"Session Discussion"}),(n||o)&&e.jsx("div",{style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.52)"},children:n||o}),q.length>0&&e.jsx("div",{style:{marginTop:"8px",display:"flex",flexWrap:"wrap",gap:"8px"},children:q.map(t=>{const g=t.id===Z;return e.jsx("button",{type:"button",onClick:()=>{N(t.id),Array.isArray(t.messages)&&(I(t.messages),ee(new Set)),k(null),A(null),K(null),S==null||S(t)},style:{padding:"4px 10px",borderRadius:"999px",border:"1px solid rgba(184, 156, 106, 0.35)",background:g?"rgba(184, 156, 106, 0.16)":"rgba(255, 255, 255, 0.9)",color:"rgba(30, 33, 37, 0.85)",fontSize:"11px",fontWeight:500,cursor:"pointer"},children:t.label},t.id)})})]}),fe&&e.jsxs("button",{type:"button",onClick:()=>{ie(t=>!t)},style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 12px",fontSize:"13px",fontWeight:500,color:"rgba(30, 33, 37, 0.75)",background:"transparent",border:"1px solid rgba(30, 33, 37, 0.12)",borderRadius:"6px",cursor:"pointer",transition:"background 0.15s ease, color 0.15s ease"},onMouseEnter:t=>{t.currentTarget.style.background="rgba(231, 212, 162, 0.12)",t.currentTarget.style.color="rgba(30, 33, 37, 0.9)"},onMouseLeave:t=>{t.currentTarget.style.background="transparent",t.currentTarget.style.color="rgba(30, 33, 37, 0.75)"},title:"Start a new discussion thread",children:[e.jsx("span",{style:{fontSize:16,lineHeight:1,marginTop:-1},children:"+"}),"New thread"]})]})}),e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"16px",display:"flex",flexDirection:"column",gap:"16px"},children:[we&&e.jsxs("div",{style:{marginBottom:"16px",padding:"12px",background:"rgba(30, 33, 37, 0.04)",border:"1px solid rgba(52, 58, 64, 0.14)",borderRadius:"8px"},children:[e.jsx("textarea",{value:U,onChange:t=>le(t.target.value),onKeyDown:t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),me())},placeholder:"Start a new thread...",disabled:V,style:{width:"100%",minHeight:"64px",padding:"8px 12px",fontSize:"13px",color:"rgba(30, 33, 37, 0.88)",background:"white",border:"1px solid rgba(52, 58, 64, 0.16)",borderRadius:"6px",resize:"vertical",outline:"none",fontFamily:"inherit",lineHeight:1.5,marginBottom:"10px"}}),e.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end"},children:[e.jsx("button",{type:"button",onClick:De,disabled:V,style:{padding:"6px 14px",fontSize:"12px",fontWeight:500,color:"rgba(30, 33, 37, 0.7)",background:"rgba(30, 33, 37, 0.08)",border:"none",borderRadius:"6px",cursor:V?"not-allowed":"pointer"},children:"Cancel"}),e.jsx("button",{type:"button",onClick:me,disabled:!U.trim()||V,style:{padding:"6px 14px",fontSize:"12px",fontWeight:600,color:"white",background:U.trim()&&!V?"#5e88b0":"rgba(30, 33, 37, 0.25)",border:"none",borderRadius:"6px",cursor:U.trim()&&!V?"pointer":"not-allowed"},children:V?"Sending...":"Send"})]})]}),j?e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"40px",color:"rgba(30, 33, 37, 0.42)"},children:"Loading messages..."}):ye.length===0?e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"40px",color:"rgba(30, 33, 37, 0.42)"},children:"No messages yet. Start the conversation!"}):ye.map(t=>xe(t,0)),e.jsx("div",{ref:te})]}),e.jsx("div",{style:{padding:"12px",borderTop:"1px solid rgba(52, 58, 64, 0.12)",background:"rgba(255, 255, 255, 0.95)"},children:e.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"flex-end"},children:[e.jsx("div",{style:{width:"36px",height:"36px",borderRadius:"50%",background:se.color,color:"white",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"11px",fontWeight:650,flexShrink:0},children:se.initials}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"8px"},children:[e.jsx("textarea",{ref:Te,value:x,onChange:t=>y(t.target.value),onKeyDown:Ee,onFocus:()=>F(!0),onBlur:()=>F(!1),placeholder:Re?"Type your reply...":"Add a comment...",style:{width:"100%",minHeight:"38px",maxHeight:"120px",padding:"8px 12px",fontSize:"13px",color:"rgba(30, 33, 37, 0.85)",background:"white",border:`1px solid ${_?"rgba(94, 136, 176, 0.35)":"rgba(52, 58, 64, 0.16)"}`,borderRadius:"8px",resize:"vertical",outline:"none",transition:"border-color 0.15s ease",fontFamily:"inherit",lineHeight:1.5}}),e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end"},children:e.jsx("button",{type:"button",onClick:be,disabled:!x.trim()||D,style:{padding:"8px 16px",background:x.trim()&&!D?"var(--Base-Strong, #0B0B0B)":"#ECEEF2",border:"none",borderRadius:"6px",color:x.trim()&&!D?"white":"rgba(30, 33, 37, 0.45)",fontSize:"12px",fontWeight:600,cursor:x.trim()&&!D?"pointer":"not-allowed",display:"flex",alignItems:"center",gap:"6px",transition:"all 0.15s ease"},children:D?e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{width:"14px",height:"14px",border:"2px solid rgba(255, 255, 255, 0.3)",borderTopColor:"white",borderRadius:"50%",animation:"spin 0.6s linear infinite"}}),"Sending..."]}):e.jsxs(e.Fragment,{children:[e.jsx(z.Send,{size:14}),"Send"]})})})]})]})})]})}function Y(n,o){return n.find(s=>s.block_id===o)}function rt({data:n,audioUrl:o,coachingData:s,messageThread:a,coachingLoading:i,coachingError:m,onThreadSendMessage:b,onThreadEditMessage:h,onThreadDeleteMessage:C,onThreadCreateNewThread:T,onThreadSelect:S,threadLoading:u,threadCurrentUser:j}){var ve,je,Se,de,pe,ke,Ce,xe,t,g,v,w;const x=n.blocks||[];n.evidence_index;const y=p.useRef(null),_=p.useRef(null),[F,R]=p.useState(new Set),[I,D]=p.useState(new Set),[L,$]=p.useState(0),[k,q]=p.useState(!1),[G,Z]=p.useState(1),N=((ve=Y(x,"interaction-metadata"))==null?void 0:ve.payload)||{},M=((je=Y(x,"interaction-context"))==null?void 0:je.payload)||{},A=((Se=Y(x,"interaction-summary"))==null?void 0:Se.payload)||{};(de=Y(x,"interaction-scores"))!=null&&de.payload;const H=((pe=Y(x,"interaction-signals"))==null?void 0:pe.payload)||{},O=((ke=Y(x,"interaction-guidance"))==null?void 0:ke.payload)||{},W=((Ce=Y(x,"interaction-transcript"))==null?void 0:Ce.payload)||{},K=((xe=Y(x,"interaction-nba"))==null?void 0:xe.payload)||{},X=((((t=Y(x,"interaction-dimensions"))==null?void 0:t.payload)||{}).dimensions||[]).filter(r=>r.value),ae=((g=Y(x,"interaction-outcome-lift"))==null?void 0:g.payload)||{},re=p.useMemo(()=>{var d;const r={},l={outcome:{color:"var(--rail-outcome)"},process:{color:"var(--rail-discovery)"},compliance:{color:"var(--rail-compliance)"},customer_friction:{color:"var(--rail-coral)"},experience:{color:"var(--rail-teal)"}};for(const f of H.signals||[]){const E=l[f.group]||{};for(const c of f.observations||[])for(const B of c.evidence||[])if((d=B.turn_ids)!=null&&d.length)for(const J of B.turn_ids)r[J]||(r[J]=[]),r[J].some(Je=>Je.label===(c.key||f.display_name||f.key))||r[J].push({label:c.key||f.display_name||f.key,reason:c.reason||c.explanation||"",color:E.color||"var(--state-present)",signalKey:f.key})}return r},[H.signals]),we=((v=W.messages)==null?void 0:v.map((r,l)=>{var B,J;const d=r.start??r.start_ms?(r.start??r.start_ms)/1e3:0,f=r.end??r.end_ms?(r.end??r.end_ms)/1e3:d+1,E=r.actor==="agent",c=E?((B=W.actor_map)==null?void 0:B.agent)||"Agent":((J=W.actor_map)==null?void 0:J.customer)||"Customer";return{startTime:d,endTime:f,actor:c,actorColor:E?"var(--rail-outcome)":"var(--rail-discovery)"}}))||[],ie=p.useMemo(()=>{if(!k&&L===0)return-1;const r=W.messages||[],l=L*1e3;for(let d=r.length-1;d>=0;d--){const f=r[d].start??r[d].start_ms;if(f!=null&&l>=f)return d}return-1},[L,k,W.messages]),U=r=>{y.current&&(y.current.currentTime=r,$(r))},le=()=>{if(y.current)if(k)y.current.pause(),q(!1);else{const r=y.current.play();r!==void 0&&r.catch(()=>{}),q(!0)}},V=()=>{y.current&&(y.current.currentTime=Math.max(0,y.current.currentTime-15))},ge=()=>{if(y.current){const r=N.duration_seconds||y.current.duration||0;y.current.currentTime=Math.min(r,y.current.currentTime+15)}},ze=r=>{y.current&&(y.current.playbackRate=r,Z(r))};p.useEffect(()=>{const r=y.current;if(!r)return;const l=()=>$(r.currentTime),d=()=>q(!0),f=()=>q(!1),E=()=>q(!1);return r.addEventListener("timeupdate",l),r.addEventListener("play",d),r.addEventListener("pause",f),r.addEventListener("ended",E),()=>{r.removeEventListener("timeupdate",l),r.removeEventListener("play",d),r.removeEventListener("pause",f),r.removeEventListener("ended",E)}},[o]);const ee=(r,l)=>{const d=y.current;if(!d||r==null)return;const f=r/1e3;d.currentTime=f,$(f);const E=d.play();if(E!==void 0&&E.catch(()=>{}),_.current&&(d.removeEventListener("timeupdate",_.current),_.current=null),l!=null){const c=l/1e3,B=()=>{d.currentTime>=c&&(d.pause(),_.current&&(d.removeEventListener("timeupdate",_.current),_.current=null))};_.current=B,d.addEventListener("timeupdate",B)}},te=(r,l,d)=>{const f=y.current;if(!f||r==null)return;const E=r/1e3,c=l!=null?l/1e3:E+1,B=f.currentTime;if(k&&B>=E&&(c==null||B<=c+.25)){f.pause();return}ee(r,l),d!=null&&d.length&&oe(d)},Te=(r,l)=>{const f=(W.messages||[])[l],E=y.current;if(!f||!E)return;const c=f.start??f.start_ms,B=f.end??f.end_ms;if(k&&ie===l){E.pause();return}c!=null&&ee(c,B)},oe=r=>{R(new Set(r));const l=document.getElementById("transcript-container");l&&l.scrollIntoView({behavior:"smooth",block:"nearest"}),setTimeout(()=>R(new Set),5e3)},se=r=>{D(l=>{const d=new Set(l);return d.has(r)?d.delete(r):d.add(r),d})},fe=((w=M.call_purpose)==null?void 0:w.interaction_driver)||A.one_liner||"Interaction Detail",[he,ye]=p.useState("signals"),ce=p.useRef(null),[Ie,_e]=p.useState(null);p.useLayoutEffect(()=>{if(i||!ce.current)return;const r=()=>{var f;const d=((f=ce.current)==null?void 0:f.offsetHeight)||0;d>0&&_e(d)};r();const l=window.requestAnimationFrame(r);return()=>window.cancelAnimationFrame(l)},[i,s,N,M]);const Re=async r=>{if(b){await b(r);return}},me=async r=>{if(h)return h(r)},De=async r=>{if(C){await C(r);return}},be=async r=>{if(T){await T(r);return}},Ee=a&&Object.keys(a).length>0?a:void 0;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"flex-start",gap:"10px",flexWrap:"wrap"},children:[e.jsxs("div",{ref:ce,style:{flex:"1 1 420px",minWidth:320,display:"flex",flexDirection:"column",gap:10},children:[e.jsx(Ne,{title:fe,meta:N,callPurpose:M.call_purpose,classification:M.classification,dimensions:X}),e.jsx(ue.AgentLiftCard,{outcomeLift:ae}),(i||s||m)&&e.jsx(ne.DetailCard,{title:"Coaching Summary",children:e.jsx($e,{data:s,loading:i,error:m})})]}),e.jsxs("div",{style:{flex:"1 1 420px",minWidth:320,display:"flex",flexDirection:"column",height:Ie},children:[e.jsx(He.Tabs,{tabs:[{key:"signals",label:"Signals"},{key:"guidance",label:"Guidance"}],active:he,onSelect:ye,size:"compact",borderTopRightRadius:12,borderTopLeftRadius:12}),e.jsxs("div",{className:"custom-thin-scrollbar-library",style:{flex:1,overflowY:"auto",display:"flex",flexDirection:"column",gap:10},children:[he==="signals"?e.jsx(qe,{signals:H,expandedSignals:I,toggleSignal:se,playEvidence:te,timelinePlaying:k,currentTimeSeconds:L,highlightTurns:oe,borderRadius:"0px 0px 12px 12px"}):e.jsx(Ke,{guidance:O,playEvidence:te,timelinePlaying:k,currentTimeSeconds:L,highlightTurns:oe,borderRadius:"0px 0px 12px 12px"}),e.jsx(Ye,{nba:K})]})]})]}),e.jsx(Ge,{audioUrl:o,timelineSegments:we,durationSeconds:N.duration_seconds,currentTimeSeconds:L,timelinePlaying:k,playbackRate:G,onSeek:U,onTogglePlay:le,onSeekBack:V,onSeekForward:ge,onSetPlaybackRate:ze,audioRef:y}),e.jsx(Ve,{transcript:W,audioUrl:o,highlightedTurns:F,activeTurnIndex:ie,timelinePlaying:k,turnObservations:re,setExpandedSignals:D,onTurnPlayPause:Te}),e.jsx(nt,{sessionTitle:fe,messageThread:Ee,currentUser:j,isLoading:u,onSendMessage:Re,onEditMessage:me,onDeleteMessage:De,onCreateNewThread:be,onThreadSelect:S})]})}class it extends p.Component{constructor(o){super(o),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(o,s){console.error("InteractionDetailPanel render error:",o,s==null?void 0:s.componentStack)}render(){return this.state.hasError?this.props.fallback:this.props.children}}function ot(n){return e.jsx(it,{fallback:e.jsx("div",{style:{padding:16,color:"var(--state-unknown)",fontSize:12},children:"Error rendering detail."}),children:e.jsx(rt,{...n})})}function st({pattern:n}){const[o,s]=p.useState(!1),a={name:"Customer Escalation Likelihood",description:"Based on observed patterns, this session shows indicators consistent with potential escalation.",technicalKey:"signal.escalation_likelihood",probability:.68,confidence:.81,observations:3};return n==="text-link"?e.jsxs("div",{style:{position:"relative",background:"rgba(255, 255, 255, 0.82)",border:"1px solid rgba(52, 58, 64, 0.12)",borderRadius:"12px",overflow:"hidden",boxShadow:"0 2px 4px rgba(30, 33, 37, 0.06)"},children:[e.jsx("div",{style:{position:"absolute",left:0,top:0,bottom:0,width:"5px",background:"#6B7C93",opacity:.6}}),e.jsxs("div",{style:{padding:"14px 16px 14px 21px"},children:[e.jsx("div",{style:{marginBottom:"4px"},children:e.jsx("span",{style:{fontSize:"13px",fontWeight:680,color:"rgba(30, 33, 37, 0.92)",lineHeight:1.2},children:a.name})}),e.jsx("div",{style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.65)",lineHeight:1.4,marginBottom:"6px"},children:a.description}),e.jsx("div",{style:{fontSize:"11px",color:"rgba(30, 33, 37, 0.42)",fontFamily:"ui-monospace, monospace",marginBottom:"8px"},children:a.technicalKey}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",fontSize:"11.5px",marginBottom:"10px"},children:[e.jsx("span",{style:{color:"rgba(139, 157, 127, 0.65)"},children:"prob"}),e.jsx("strong",{style:{color:"rgba(139, 157, 127, 0.85)"},children:a.probability.toFixed(2)}),e.jsx("span",{style:{color:"rgba(30, 33, 37, 0.24)"},children:"·"}),e.jsx("span",{style:{color:"rgba(184, 156, 106, 0.65)"},children:"conf"}),e.jsx("strong",{style:{color:"rgba(184, 156, 106, 0.85)"},children:a.confidence.toFixed(2)}),e.jsx("span",{style:{color:"rgba(30, 33, 37, 0.24)"},children:"·"}),e.jsxs("span",{style:{color:"rgba(30, 33, 37, 0.52)"},children:[a.observations," observations"]})]}),!o&&e.jsx("button",{onClick:()=>s(!0),style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.56)",background:"none",border:"none",padding:0,cursor:"pointer",textDecoration:"underline",textDecorationColor:"rgba(30, 33, 37, 0.2)"},onMouseEnter:i=>{i.currentTarget.style.color="rgba(30, 33, 37, 0.78)",i.currentTarget.style.textDecorationColor="rgba(30, 33, 37, 0.4)"},onMouseLeave:i=>{i.currentTarget.style.color="rgba(30, 33, 37, 0.56)",i.currentTarget.style.textDecorationColor="rgba(30, 33, 37, 0.2)"},children:"View contributing observations"})]}),o&&e.jsxs("div",{style:{borderTop:"1px solid rgba(52, 58, 64, 0.08)",background:"rgba(244, 241, 230, 0.25)",padding:"16px 16px 16px 21px"},children:[e.jsx("div",{style:{fontSize:"10px",fontWeight:650,letterSpacing:"0.08em",textTransform:"uppercase",color:"rgba(30, 33, 37, 0.52)",marginBottom:"8px"},children:"Contributing Observations"}),e.jsx("div",{style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.62)"},children:"[Observations would appear here]"}),e.jsx("button",{onClick:()=>s(!1),style:{marginTop:"10px",fontSize:"12px",color:"rgba(30, 33, 37, 0.56)",background:"none",border:"none",padding:0,cursor:"pointer",textDecoration:"underline",textDecorationColor:"rgba(30, 33, 37, 0.2)"},onMouseEnter:i=>{i.currentTarget.style.color="rgba(30, 33, 37, 0.78)",i.currentTarget.style.textDecorationColor="rgba(30, 33, 37, 0.4)"},onMouseLeave:i=>{i.currentTarget.style.color="rgba(30, 33, 37, 0.56)",i.currentTarget.style.textDecorationColor="rgba(30, 33, 37, 0.2)"},children:"Hide observations"})]})]}):n==="rotating-chevron"?e.jsxs("div",{style:{position:"relative",background:"rgba(255, 255, 255, 0.82)",border:"1px solid rgba(52, 58, 64, 0.12)",borderRadius:"12px",overflow:"hidden",boxShadow:"0 2px 4px rgba(30, 33, 37, 0.06)"},children:[e.jsx("div",{style:{position:"absolute",left:0,top:0,bottom:0,width:"5px",background:"#6B7C93",opacity:.6}}),e.jsx("button",{type:"button",onClick:()=>s(!o),style:{width:"100%",padding:"14px 16px 14px 21px",background:"transparent",border:"none",cursor:"pointer",textAlign:"left",transition:"background 0.15s ease"},onMouseEnter:i=>{i.currentTarget.style.background="rgba(231, 212, 162, 0.08)"},onMouseLeave:i=>{i.currentTarget.style.background="transparent"},children:e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px"},children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{marginBottom:"4px"},children:e.jsx("span",{style:{fontSize:"13px",fontWeight:680,color:"rgba(30, 33, 37, 0.92)",lineHeight:1.2},children:a.name})}),e.jsx("div",{style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.65)",lineHeight:1.4,marginBottom:"6px"},children:a.description}),e.jsx("div",{style:{fontSize:"11px",color:"rgba(30, 33, 37, 0.42)",fontFamily:"ui-monospace, monospace",marginBottom:"8px"},children:a.technicalKey}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",fontSize:"11.5px"},children:[e.jsx("span",{style:{color:"rgba(139, 157, 127, 0.65)"},children:"prob"}),e.jsx("strong",{style:{color:"rgba(139, 157, 127, 0.85)"},children:a.probability.toFixed(2)}),e.jsx("span",{style:{color:"rgba(30, 33, 37, 0.24)"},children:"·"}),e.jsx("span",{style:{color:"rgba(184, 156, 106, 0.65)"},children:"conf"}),e.jsx("strong",{style:{color:"rgba(184, 156, 106, 0.85)"},children:a.confidence.toFixed(2)}),e.jsx("span",{style:{color:"rgba(30, 33, 37, 0.24)"},children:"·"}),e.jsxs("span",{style:{color:"rgba(30, 33, 37, 0.52)"},children:[a.observations," observations"]})]})]}),e.jsx("div",{style:{paddingTop:"2px",color:"rgba(30, 33, 37, 0.42)",flexShrink:0,transition:"transform 0.2s ease"},children:e.jsx(z.ChevronDown,{size:18,style:{transform:o?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease"}})})]})}),o&&e.jsxs("div",{style:{borderTop:"1px solid rgba(52, 58, 64, 0.08)",background:"rgba(244, 241, 230, 0.25)",padding:"16px 16px 16px 21px"},children:[e.jsx("div",{style:{fontSize:"10px",fontWeight:650,letterSpacing:"0.08em",textTransform:"uppercase",color:"rgba(30, 33, 37, 0.52)",marginBottom:"8px"},children:"Contributing Observations"}),e.jsx("div",{style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.62)"},children:"[Observations would appear here]"})]})]}):e.jsxs("div",{style:{position:"relative",background:"rgba(255, 255, 255, 0.82)",border:"1px solid rgba(52, 58, 64, 0.12)",borderRadius:"12px",overflow:"hidden",boxShadow:"0 2px 4px rgba(30, 33, 37, 0.06)"},children:[e.jsx("div",{style:{position:"absolute",left:0,top:0,bottom:0,width:"5px",background:"#6B7C93",opacity:.6}}),e.jsxs("button",{type:"button",onClick:()=>s(!o),style:{width:"100%",padding:"14px 16px 14px 21px",background:"transparent",border:"none",cursor:"pointer",textAlign:"left",display:"flex",alignItems:"flex-start",gap:"12px",transition:"background 0.15s ease"},onMouseEnter:i=>{i.currentTarget.style.background="rgba(231, 212, 162, 0.08)"},onMouseLeave:i=>{i.currentTarget.style.background="transparent"},children:[e.jsx("div",{style:{paddingTop:"2px",color:"rgba(30, 33, 37, 0.42)",flexShrink:0},children:o?e.jsx(z.ChevronDown,{size:16}):e.jsx(z.ChevronRight,{size:16})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{marginBottom:"4px"},children:e.jsx("span",{style:{fontSize:"13px",fontWeight:680,color:"rgba(30, 33, 37, 0.92)",lineHeight:1.2},children:a.name})}),e.jsx("div",{style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.65)",lineHeight:1.4,marginBottom:"6px"},children:a.description}),e.jsx("div",{style:{fontSize:"11px",color:"rgba(30, 33, 37, 0.42)",fontFamily:"ui-monospace, monospace",marginBottom:"8px"},children:a.technicalKey}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",fontSize:"11.5px"},children:[e.jsx("span",{style:{color:"rgba(139, 157, 127, 0.65)"},children:"prob"}),e.jsx("strong",{style:{color:"rgba(139, 157, 127, 0.85)"},children:a.probability.toFixed(2)}),e.jsx("span",{style:{color:"rgba(30, 33, 37, 0.24)"},children:"·"}),e.jsx("span",{style:{color:"rgba(184, 156, 106, 0.65)"},children:"conf"}),e.jsx("strong",{style:{color:"rgba(184, 156, 106, 0.85)"},children:a.confidence.toFixed(2)}),e.jsx("span",{style:{color:"rgba(30, 33, 37, 0.24)"},children:"·"}),e.jsxs("span",{style:{color:"rgba(30, 33, 37, 0.52)"},children:[a.observations," observations"]})]})]})]}),o&&e.jsxs("div",{style:{borderTop:"1px solid rgba(52, 58, 64, 0.08)",background:"rgba(244, 241, 230, 0.25)",padding:"16px 16px 16px 21px"},children:[e.jsx("div",{style:{fontSize:"10px",fontWeight:650,letterSpacing:"0.08em",textTransform:"uppercase",color:"rgba(30, 33, 37, 0.52)",marginBottom:"8px"},children:"Contributing Observations"}),e.jsx("div",{style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.62)"},children:"[Observations would appear here]"})]})]})}exports.ConditionCard=Q.ConditionCard;exports.ModelScoreCard=Q.ModelScoreCard;exports.ObservationCard=Q.ObservationCard;exports.ScoreDriverCard=Q.ScoreDriverCard;exports.ScoreDriverCardVariant=Q.ScoreDriverCardVariant;exports.SignalCard=Q.SignalCard;exports.SmallObservationCard=Q.SmallObservationCard;exports.SummarySection=Q.SummarySection;exports.AgentLiftCard=ue.AgentLiftCard;exports.EvidenceItem=ue.EvidenceItem;exports.CoachingSynthesisCard=$e;exports.ExpandPatternComparison=st;exports.InteractionContext=Ne;exports.InteractionDetailPanel=ot;exports.InteractionGuidance=Ke;exports.InteractionNBA=Ye;exports.InteractionRecording=Ge;exports.InteractionScores=Ue;exports.InteractionSignals=qe;exports.InteractionTranscript=Ve;
11
11
  //# sourceMappingURL=interactionDetails.cjs.js.map