chordia-ui 3.9.2 → 3.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ChatMessage.cjs.js +5 -5
- package/dist/ChatMessage.cjs.js.map +1 -1
- package/dist/ChatMessage.es.js +583 -353
- package/dist/ChatMessage.es.js.map +1 -1
- package/dist/MessageThread.cjs.js +15 -0
- package/dist/MessageThread.cjs.js.map +1 -0
- package/dist/MessageThread.es.js +1868 -0
- package/dist/MessageThread.es.js.map +1 -0
- package/dist/PerformancePanel.cjs.js +1 -1
- package/dist/PerformancePanel.cjs.js.map +1 -1
- package/dist/PerformancePanel.es.js +587 -749
- package/dist/PerformancePanel.es.js.map +1 -1
- package/dist/components/chat.cjs.js +1 -27
- package/dist/components/chat.cjs.js.map +1 -1
- package/dist/components/chat.es.js +276 -1617
- package/dist/components/chat.es.js.map +1 -1
- package/dist/components/layout.cjs.js +2 -2
- package/dist/components/layout.cjs.js.map +1 -1
- package/dist/components/layout.es.js +289 -272
- package/dist/components/layout.es.js.map +1 -1
- package/dist/components/media.cjs.js +1 -1
- package/dist/components/media.cjs.js.map +1 -1
- package/dist/components/media.es.js +4 -4
- package/dist/components/media.es.js.map +1 -1
- package/dist/components/reports.cjs.js +2 -2
- package/dist/components/reports.cjs.js.map +1 -1
- package/dist/components/reports.es.js +18 -18
- package/dist/components/reports.es.js.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +8 -8
- package/package.json +1 -1
- package/src/components/chat/ChatHistoryPanel.jsx +740 -388
- package/src/components/chat/ChatInterface.jsx +3 -3
- package/src/components/chat/ChatMessage.jsx +338 -48
- package/src/components/chat/ChatWelcome.jsx +386 -0
- package/src/components/chat/ThinkingIndicator.jsx +121 -275
- package/src/components/chat/index.js +1 -0
- package/src/components/layout/SplitPane.jsx +21 -13
- package/src/components/media/InteractionSummaryCard.jsx +1 -1
- package/src/components/performance/PerformanceDetailsPage.jsx +51 -52
- package/src/components/performance/performanceRangeFormat.js +3 -2
- package/src/components/reports/ReportsDetails.jsx +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageThread.es.js","sources":["../src/components/chat/ThinkingIndicator.jsx","../src/components/chat/ChatInterface.jsx","../src/components/chat/ChatHistoryPanel.jsx","../src/components/chat/MessageThread.jsx"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\n\n/**\n * ThinkingIndicator\n * Status bubble shown while the assistant is working: a Chordia brand symbol\n * followed by a rounded pill that sizes to its text. The pill grows / shrinks\n * (and wraps) with whatever status message is passed.\n *\n * Props:\n * phase - \"thinking\" | \"tool\" | \"responding\" | \"generating\"\n * label - explicit status text (e.g. a notice or tool label); overrides\n * the phase default\n * toolSteps - (kept for API compatibility; not rendered in this design)\n * compact - slightly smaller symbol / paddings\n */\n\nconst SYMBOL_BG = \"#2e3236\"; // grey/strong\nconst BUBBLE_BG = \"#e3e1d7\"; // rail/surface-2\nconst TEXT_COLOR = \"#2e3236\"; // grey/strong\n\n// Chordia brand symbol (concentric green rings on a dark disc).\nfunction BrandSymbol({ size = 32 }) {\n const inner = Math.round(size * 0.75);\n return (\n <div\n style={{\n width: size,\n height: size,\n borderRadius: \"9999px\",\n background: SYMBOL_BG,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n overflow: \"hidden\",\n flexShrink: 0,\n }}\n >\n <svg\n width={inner}\n height={inner}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n style={{ display: \"block\" }}\n aria-hidden=\"true\"\n >\n <path\n d=\"M12 24C18.6274 24 24 18.6274 24 12C24 5.37258 18.6274 0 12 0C5.37258 0 0 5.37258 0 12C0 18.6274 5.37258 24 12 24Z\"\n fill={SYMBOL_BG}\n />\n <path\n d=\"M12.0281 1.54883C15.1413 1.54883 17.9364 2.90958 19.8514 5.06845C21.4881 6.9137 22.4824 9.34236 22.4824 12.0032C22.4824 15.0939 21.1413 17.8711 19.0094 19.7849C17.1586 21.4463 14.7113 22.4575 12.0281 22.4575C9.34478 22.4575 6.74638 21.3828 4.8764 19.6286C2.84343 17.7216 1.57373 15.0107 1.57373 12.0032C1.57373 9.28897 2.60792 6.81646 4.30366 4.95829C6.21523 2.86349 8.9682 1.54883 12.0281 1.54883Z\"\n stroke=\"#E8D4A3\"\n strokeWidth=\"1.6\"\n strokeMiterlimit=\"10\"\n />\n <path\n d=\"M12.0281 4.27832C14.237 4.27832 16.2239 5.21303 17.6307 6.69799C18.9409 8.08066 19.7525 9.94558 19.7525 12.0027C19.7525 14.2369 18.8032 16.2491 17.2862 17.6582C15.9086 18.9419 14.06 19.7271 12.0281 19.7271C9.99626 19.7271 8.46689 18.4265 7.08366 17.1225C5.58971 15.714 4.30371 14.2184 4.30371 12.0027C4.30371 10.0097 5.05856 8.19307 6.2979 6.82333C7.71148 5.26024 9.75514 4.27832 12.0281 4.27832Z\"\n stroke=\"#9BDB9C\"\n strokeWidth=\"1.2\"\n strokeMiterlimit=\"10\"\n />\n <path\n d=\"M12.0282 7.00837C13.3327 7.00837 14.5209 7.50861 15.4101 8.32753C16.4016 9.24032 17.0226 10.5488 17.0226 12.0028C17.0226 13.3805 16.4651 14.6282 15.563 15.5315C14.6592 16.4369 13.4091 16.9973 12.0282 16.9973C10.6472 16.9973 10.1869 15.4702 9.29093 14.6164C8.33599 13.7065 7.03369 13.426 7.03369 12.0023C7.03369 10.7303 7.50919 9.56969 8.29158 8.68781C9.20662 7.65699 10.5415 7.00781 12.0282 7.00781V7.00837Z\"\n stroke=\"#4DE294\"\n strokeWidth=\"0.8\"\n strokeMiterlimit=\"10\"\n />\n </svg>\n </div>\n );\n}\n\nexport default function ThinkingIndicator({\n phase = \"thinking\",\n label,\n // eslint-disable-next-line no-unused-vars\n toolSteps = [],\n // eslint-disable-next-line no-unused-vars\n elapsedMs,\n compact = false,\n}) {\n const text =\n label ||\n (phase === \"responding\" || phase === \"generating\"\n ? \"Compass is generating response...\"\n : \"Thinking...\");\n\n const symbolSize = compact ? 28 : 32;\n\n return (\n <div\n style={{\n display: \"flex\",\n alignItems: \"center\",\n gap: \"8px\",\n animation: \"cuiThinkingPulse 1.6s ease-in-out infinite\",\n }}\n >\n <style>{`\n @keyframes cuiThinkingPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }\n `}</style>\n\n <BrandSymbol size={symbolSize} />\n\n <div\n style={{\n display: \"inline-flex\",\n alignItems: \"center\",\n background: BUBBLE_BG,\n padding: compact ? \"8px 12px\" : \"12px 16px\",\n borderRadius: \"20px\",\n maxWidth: \"100%\",\n minWidth: 0,\n }}\n >\n <p\n style={{\n margin: 0,\n fontSize: \"14px\",\n fontWeight: 400,\n lineHeight: \"normal\",\n color: TEXT_COLOR,\n fontFamily: \"inherit\",\n // Grow / shrink (and wrap) with the message text.\n overflowWrap: \"anywhere\",\n wordBreak: \"break-word\",\n }}\n >\n {text}\n </p>\n </div>\n </div>\n );\n}\n","\"use client\";\n\nimport React, { useState, useRef, useEffect } from \"react\";\nimport { Send } from \"lucide-react\";\nimport ChatMessage from \"./ChatMessage\";\nimport ThinkingIndicator from \"./ThinkingIndicator\";\n// TODO: replace with framework-agnostic toast\nconst toast = { error: (...args) => console.warn(\"toast.error:\", ...args) };\n\n/**\n * ChatInterface Component\n * Interactive chat interface with streaming SSE support, thinking phases, and tool visibility.\n */\nexport default function ChatInterface({\n initialMessages = [],\n onSendMessage,\n onStreamMessage, // NEW: streaming version of onSendMessage\n onMessagesChange, // NEW: callback when messages array changes\n onCodeBlockClick, // callback when \"Canvas\" button clicked on a code block: ({ code, language }) => void\n placeholder = \"Ask a question about this interaction...\",\n title = \"Chat with Chordia\",\n}) {\n const [messages, setMessages] = useState(initialMessages || []);\n const [inputValue, setInputValue] = useState(\"\");\n const [isProcessing, setIsProcessing] = useState(false);\n const [isSending, setIsSending] = useState(false);\n const [currentAssistantMessage, setCurrentAssistantMessage] = useState(null);\n const [thinkingPhase, setThinkingPhase] = useState(\"thinking\");\n const [thinkingStartTime, setThinkingStartTime] = useState(null);\n const [elapsedMs, setElapsedMs] = useState(0);\n const messagesEndRef = useRef(null);\n const inputRef = useRef(null);\n const streamAbortController = useRef(null);\n const currentAssistantRef = useRef(null);\n const lastChunkTimeRef = useRef(null);\n const [streamSilent, setStreamSilent] = useState(false);\n const [silenceSeconds, setSilenceSeconds] = useState(0);\n\n // Auto-scroll to bottom when messages change\n useEffect(() => {\n messagesEndRef.current?.scrollIntoView({ behavior: \"smooth\" });\n }, [messages, isProcessing]);\n\n // Auto-resize textarea\n useEffect(() => {\n if (inputRef.current) {\n inputRef.current.style.height = \"auto\";\n inputRef.current.style.height = `${Math.min(\n inputRef.current.scrollHeight,\n 120\n )}px`;\n }\n }, [inputValue]);\n\n // Update messages and notify parent\n useEffect(() => {\n if (onMessagesChange) {\n const allMessages = [...messages];\n if (currentAssistantMessage) {\n allMessages.push(currentAssistantMessage);\n }\n onMessagesChange(allMessages);\n }\n }, [messages, currentAssistantMessage, onMessagesChange]);\n\n // Elapsed time tracker + silence detector\n useEffect(() => {\n let interval;\n if (isProcessing && thinkingStartTime) {\n interval = setInterval(() => {\n setElapsedMs(Date.now() - thinkingStartTime);\n // Detect stream silence (no chunks for 3s+)\n if (lastChunkTimeRef.current) {\n const gap = (Date.now() - lastChunkTimeRef.current) / 1000;\n if (gap >= 3) {\n setStreamSilent(true);\n setSilenceSeconds(Math.floor(gap));\n } else {\n setStreamSilent(false);\n }\n }\n }, 500);\n }\n return () => interval && clearInterval(interval);\n }, [isProcessing, thinkingStartTime]);\n\n const resetProcessingState = () => {\n setIsProcessing(false);\n setIsSending(false);\n setCurrentAssistantMessage(null);\n currentAssistantRef.current = null;\n setThinkingPhase(\"thinking\");\n setStreamSilent(false);\n setSilenceSeconds(0);\n lastChunkTimeRef.current = null;\n setThinkingStartTime(null);\n setElapsedMs(0);\n if (streamAbortController.current) {\n streamAbortController.current.abort();\n streamAbortController.current = null;\n }\n };\n\n const parseSSELine = (line) => {\n if (line.startsWith(\"data: \")) {\n const data = line.slice(6);\n if (data === \"[DONE]\") {\n return { type: \"done\" };\n }\n try {\n const parsed = JSON.parse(data);\n return { type: \"data\", data: parsed };\n } catch (e) {\n return null;\n }\n }\n return null;\n };\n\n const handleStreamChunk = (chunk) => {\n if (!chunk.choices?.[0]?.delta) return;\n\n lastChunkTimeRef.current = Date.now();\n setStreamSilent(false);\n\n const delta = chunk.choices[0].delta;\n \n // Check for tool use/result indicators\n if (delta.tool_calls || delta.tool_results) {\n setThinkingPhase(\"tool\");\n return;\n }\n\n // If we get content, switch to responding phase\n if (delta.content !== undefined) {\n setThinkingPhase(\"responding\");\n \n // Initialize or update current assistant message\n setCurrentAssistantMessage(prev => {\n const baseMessage = prev || {\n id: Date.now().toString(),\n role: \"assistant\",\n content: \"\",\n timestamp: new Date().toLocaleTimeString(undefined, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n }),\n isStreaming: true,\n };\n \n const updated = {\n ...baseMessage,\n content: (baseMessage.content || \"\") + (delta.content || \"\"),\n };\n currentAssistantRef.current = updated;\n return updated;\n });\n }\n };\n\n const processStream = async (stream) => {\n const reader = stream.getReader();\n const decoder = new TextDecoder();\n let buffer = \"\";\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split(\"\\n\");\n buffer = lines.pop() || \"\"; // Keep incomplete line in buffer\n\n for (const line of lines) {\n if (line.trim()) {\n const parsed = parseSSELine(line);\n if (parsed) {\n if (parsed.type === \"done\") {\n return; // Stream complete\n } else if (parsed.type === \"data\") {\n handleStreamChunk(parsed.data);\n }\n }\n }\n }\n }\n } finally {\n reader.releaseLock();\n }\n };\n\n const handleSend = async () => {\n if (!inputValue.trim() || isSending) return;\n\n const userContent = inputValue.trim();\n const userMessage = {\n id: Date.now().toString(),\n role: \"user\",\n content: userContent,\n timestamp: new Date().toLocaleTimeString(undefined, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n }),\n };\n\n // Add user message and start processing\n const newMessages = [...messages, userMessage];\n setMessages(newMessages);\n setInputValue(\"\");\n setIsProcessing(true);\n setIsSending(true);\n setThinkingPhase(\"thinking\");\n setThinkingStartTime(Date.now());\n lastChunkTimeRef.current = Date.now();\n\n // Create abort controller for this stream\n streamAbortController.current = new AbortController();\n\n try {\n let result;\n \n // Use streaming version if provided, otherwise fall back to regular\n if (onStreamMessage) {\n result = await onStreamMessage(userContent, newMessages);\n } else if (onSendMessage) {\n result = await onSendMessage(userContent, newMessages);\n } else {\n // Fallback to dummy response\n setTimeout(() => {\n const assistantMessage = {\n id: (Date.now() + 1).toString(),\n role: \"assistant\",\n content: \"This is a demonstration response. In a real implementation, this would connect to your LLM backend.\",\n timestamp: new Date().toLocaleTimeString(undefined, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n }),\n };\n setMessages(prev => [...prev, assistantMessage]);\n resetProcessingState();\n }, 1000);\n return;\n }\n\n // Handle ReadableStream response\n if (result instanceof ReadableStream) {\n await processStream(result);\n } \n // Handle Response with SSE body\n else if (result instanceof Response && result.body) {\n await processStream(result.body);\n }\n // Handle Promise that resolves to a stream\n else if (result && typeof result.then === \"function\") {\n const resolved = await result;\n if (resolved instanceof ReadableStream) {\n await processStream(resolved);\n } else if (resolved instanceof Response && resolved.body) {\n await processStream(resolved.body);\n }\n }\n\n // Finalize the assistant message using ref (state is stale in this closure)\n if (currentAssistantRef.current) {\n setMessages(prev => [...prev, { \n ...currentAssistantRef.current, \n isStreaming: false \n }]);\n }\n\n } catch (error) {\n if (error.name !== \"AbortError\") {\n toast.error(\"Failed to send message\");\n console.error(\"Stream error:\", error);\n }\n } finally {\n resetProcessingState();\n }\n };\n\n const handleKeyDown = (e) => {\n if (e.key === \"Enter\" && !e.shiftKey) {\n e.preventDefault();\n handleSend();\n }\n };\n\n return (\n <div\n style={{\n display: \"flex\",\n flexDirection: \"column\",\n height: \"100%\",\n border: \"1px solid var(--border, rgba(52,58,64,0.12))\",\n borderRadius: \"var(--radius-lg, 12px)\",\n background: \"var(--paper-elevated, rgba(255,255,255,0.82))\",\n overflow: \"hidden\",\n }}\n >\n {/* Header — hidden when title is empty */}\n {title ? <div\n style={{\n padding: \"16px 20px\",\n borderBottom: \"1px solid var(--border-subtle, rgba(52,58,64,0.08))\",\n background: \"var(--paper-elevated, rgba(255,255,255,0.82))\",\n }}\n >\n <div\n style={{\n fontSize: \"var(--text-lg, 16px)\",\n fontWeight: 720,\n letterSpacing: \"-0.01em\",\n color: \"var(--text-strong, rgba(30,33,37,0.92))\",\n }}\n >\n {title}\n </div>\n <div\n style={{\n fontSize: \"var(--text-sm, 11px)\",\n color: \"var(--text-muted, rgba(30,33,37,0.56))\",\n marginTop: \"2px\",\n }}\n >\n Ask questions, get insights from analyzed interactions\n </div>\n </div> : null}\n\n {/* Messages area */}\n <div\n style={{\n flex: 1,\n minHeight: 0,\n overflowY: \"auto\",\n padding: \"20px\",\n display: \"flex\",\n flexDirection: \"column\",\n }}\n >\n {messages.length === 0 ? (\n <div\n style={{\n flex: 1,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n color: \"var(--text-faint, rgba(30,33,37,0.36))\",\n fontSize: \"var(--text-md, 13px)\",\n textAlign: \"center\",\n padding: \"40px\",\n }}\n >\n No messages yet. Start a conversation by asking a question below.\n </div>\n ) : (\n <>\n {messages.map((message) => (\n <ChatMessage\n key={message.id}\n role={message.role}\n content={message.content}\n html={message.html}\n timestamp={message.timestamp}\n toolBadges={message.toolBadges}\n isStreaming={message.isStreaming}\n onCodeBlockClick={onCodeBlockClick}\n />\n ))}\n \n {/* Current streaming message */}\n {currentAssistantMessage && (\n <ChatMessage\n key={currentAssistantMessage.id}\n role={currentAssistantMessage.role}\n content={currentAssistantMessage.content}\n timestamp={currentAssistantMessage.timestamp}\n isStreaming={true}\n onCodeBlockClick={onCodeBlockClick}\n />\n )}\n \n {/* Thinking indicator — shows during initial thinking or stream silence */}\n {isProcessing && (!currentAssistantMessage || streamSilent) && (\n <div style={{ marginBottom: \"16px\" }}>\n <ThinkingIndicator \n phase={streamSilent ? \"tool\" : thinkingPhase}\n elapsedMs={elapsedMs}\n label={\n streamSilent && silenceSeconds >= 30\n ? \"Compacting conversation — trimming context to stay sharp...\"\n : streamSilent && silenceSeconds >= 10\n ? \"Running background tasks...\"\n : streamSilent\n ? \"Still working...\"\n : undefined\n }\n />\n </div>\n )}\n \n <div ref={messagesEndRef} />\n </>\n )}\n </div>\n\n {/* Input area */}\n <div\n style={{\n borderTop: \"1px solid var(--border-subtle, rgba(52,58,64,0.08))\",\n padding: \"16px 20px\",\n background: \"var(--paper-elevated, rgba(255,255,255,0.82))\",\n }}\n >\n <div\n style={{\n display: \"flex\",\n gap: \"12px\",\n alignItems: \"flex-end\",\n }}\n >\n <textarea\n ref={inputRef}\n value={inputValue}\n onChange={(e) => setInputValue(e.target.value)}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n rows={1}\n disabled={isSending}\n style={{\n flex: 1,\n padding: \"10px 14px\",\n fontSize: \"var(--text-base, 14px)\",\n lineHeight: 1.5,\n color: \"var(--text-strong, rgba(30,33,37,0.92))\",\n background: \"rgba(255, 255, 255, 0.95)\",\n border: \"1px solid rgba(52, 58, 64, 0.18)\",\n borderRadius: \"var(--radius-md, 8px)\",\n resize: \"none\",\n outline: \"none\",\n transition: \"border-color 0.15s ease\",\n fontFamily: \"inherit\",\n minHeight: \"42px\",\n maxHeight: \"120px\",\n opacity: isSending ? 0.6 : 1,\n cursor: isSending ? \"not-allowed\" : \"text\",\n }}\n onFocus={(e) => {\n if (!isSending) {\n e.target.style.borderColor = \"rgba(94, 136, 176, 0.35)\";\n }\n }}\n onBlur={(e) => {\n e.target.style.borderColor = \"rgba(52, 58, 64, 0.18)\";\n }}\n />\n <button\n onClick={handleSend}\n disabled={!inputValue.trim() || isSending}\n style={{\n padding: \"10px 16px\",\n background:\n inputValue.trim() && !isSending\n ? \"var(--Base-Strong, #0B0B0B)\"\n : \"#ECEEF2\",\n color:\n inputValue.trim() && !isSending\n ? \"white\"\n : \"var(--text-base)\",\n border: \"none\",\n borderRadius: \"var(--radius-md, 8px)\",\n cursor:\n inputValue.trim() && !isSending ? \"pointer\" : \"not-allowed\",\n display: \"flex\",\n alignItems: \"center\",\n gap: \"6px\",\n fontSize: \"var(--text-md, 13px)\",\n fontWeight: 650,\n transition: \"all 0.15s ease\",\n height: \"42px\",\n }}\n // onMouseEnter={(e) => {\n // if (inputValue.trim() && !isSending) {\n // e.currentTarget.style.background = \"var(--Base-Strong, #0B0B0B)\";\n // }\n // }}\n // onMouseLeave={(e) => {\n // if (inputValue.trim() && !isSending) {\n // e.currentTarget.style.background = \"#ECEEF2\";\n // }\n // }}\n >\n {isSending ? (\n <>\n <style>\n {`\n @keyframes buttonSpin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n `}\n </style>\n <div\n style={{\n width: \"14px\",\n height: \"14px\",\n border: \"2px solid rgba(255, 255, 255, 0.3)\",\n borderTopColor: \"white\",\n borderRadius: \"50%\",\n animation: \"buttonSpin 0.6s linear infinite\",\n }}\n />\n Sending...\n </>\n ) : (\n <>\n <Send size={16} />\n Send\n </>\n )}\n </button>\n </div>\n <div\n style={{\n fontSize: \"var(--text-sm, 11px)\",\n color: \"var(--text-faint, rgba(30,33,37,0.36))\",\n marginTop: \"8px\",\n }}\n >\n Press Enter to send, Shift+Enter for new line\n </div>\n </div>\n </div>\n );\n}","\"use client\";\n\nimport React, { useState, useRef, useEffect, useMemo } from \"react\";\nimport {\n MessageSquare,\n Search,\n Pin,\n Check,\n X,\n PanelLeftClose,\n MoreVertical,\n ChevronLeft,\n ChevronRight,\n} from \"lucide-react\";\n\n/**\n * ChatHistoryPanel Component\n * Panel showing chat thread history with search, All/Pinned filtering,\n * date-grouped sections and per-thread pin / rename / delete actions.\n *\n * Props:\n * threads - Array of thread objects: { id, title, created_at, updated_at, message_count, last_message_preview, pinned, archived, tags }\n * activeThreadId - Currently selected thread id\n * onSelectThread - (threadId) => void\n * onNewChat - () => void // optional: renders the \"new chat\" header action\n * onCollapse - () => void // optional: renders the collapse header action\n * onRenameThread - (threadId, newTitle) => void // optional: when provided, inline edit is enabled\n * onDeleteThread - (threadId) => void // optional: when provided, inline delete is enabled\n * onPinThread - (threadId, nextPinned) => void // optional: when provided, the pin toggle is enabled\n * loading - boolean\n */\n\n// Design tokens (from Figma \"Insights\" / thread history side section)\nconst COLORS = {\n title: \"#2e3236\", // grey/strong\n muted: \"#808183\", // grey/muted\n faint: \"#989898\", // neutral/400\n hoverBg: \"#f3f7f7\", // grey/hover\n selectedBg: \"#FAF5E9\", // selected thread background\n border: \"#d9d9d9\", // grey/absent\n borderSubtle: \"#e6e6e6\",\n pillDarkBg: \"#272727\", // neutral/850\n pillDarkText: \"#f2f2f0\", // neutral/50\n searchTrack: \"#d8d8d8\", // neutral/150\n};\n\n// Which date bucket a thread falls into.\nfunction dateBucket(dateStr) {\n const d = dateStr ? new Date(dateStr) : null;\n if (!d || Number.isNaN(d.getTime())) return \"Older\";\n const now = new Date();\n const startToday = new Date(now.getFullYear(), now.getMonth(), now.getDate());\n const startYesterday = new Date(startToday);\n startYesterday.setDate(startToday.getDate() - 1);\n if (d >= startToday) return \"Today\";\n if (d >= startYesterday) return \"Yesterday\";\n return \"Older\";\n}\n\nconst BUCKET_ORDER = [\"Today\", \"Yesterday\", \"Older\"];\n\n// Compact relative time, e.g. \"just now\", \"5m ago\", \"2h ago\", \"3d ago\",\n// falling back to a localized short date for anything older than a week.\nfunction formatRelative(dateStr) {\n const d = dateStr ? new Date(dateStr) : null;\n if (!d || Number.isNaN(d.getTime())) return \"\";\n const diff = Date.now() - d.getTime();\n const min = Math.floor(diff / 60000);\n if (min < 1) return \"just now\";\n if (min < 60) return `${min}m ago`;\n const hr = Math.floor(min / 60);\n if (hr < 24) return `${hr}h ago`;\n const day = Math.floor(hr / 24);\n if (day < 7) return `${day}d ago`;\n return d.toLocaleDateString(undefined, { month: \"short\", day: \"numeric\" });\n}\n\nexport default function ChatHistoryPanel({\n threads = [],\n activeThreadId,\n onSelectThread,\n onNewChat,\n onCollapse,\n onRenameThread,\n onDeleteThread,\n onPinThread,\n loading = false,\n pageSize = 10,\n // Server-side pagination (controlled). When `onPageChange` is provided the\n // panel renders whatever `threads` it's given as the current page, drives the\n // controls from `page` / `pageCount`, and asks the parent to fetch new pages.\n page,\n pageCount,\n onPageChange,\n // Called when the All/Pinned filter changes. When provided, the parent is\n // expected to (re)fetch — e.g. hit the API with `&pinned=true`.\n onFilterChange,\n}) {\n const serverPaginated = typeof onPageChange === \"function\";\n const [searchQuery, setSearchQuery] = useState(\"\");\n const [filter, setFilter] = useState(\"all\"); // \"all\" | \"pinned\"\n const changeFilter = (f) => {\n setFilter(f);\n onFilterChange?.(f);\n };\n const [currentPage, setCurrentPage] = useState(1);\n const [hoveredId, setHoveredId] = useState(null);\n const [editingId, setEditingId] = useState(null);\n const [editValue, setEditValue] = useState(\"\");\n const [deletingId, setDeletingId] = useState(null);\n const [menuOpenId, setMenuOpenId] = useState(null); // thread id whose ⋮ dropdown is open\n const editInputRef = useRef(null);\n\n useEffect(() => {\n if (editingId && editInputRef.current) {\n editInputRef.current.focus();\n editInputRef.current.select();\n }\n }, [editingId]);\n\n // Close the ⋮ dropdown on any outside click or Escape. The kebab toggle\n // stops propagation, so the click that opens the menu never reaches here.\n useEffect(() => {\n if (!menuOpenId) return;\n const close = () => setMenuOpenId(null);\n const onKey = (e) => {\n if (e.key === \"Escape\") setMenuOpenId(null);\n };\n document.addEventListener(\"click\", close);\n document.addEventListener(\"keydown\", onKey);\n return () => {\n document.removeEventListener(\"click\", close);\n document.removeEventListener(\"keydown\", onKey);\n };\n }, [menuOpenId]);\n\n const canEdit = typeof onRenameThread === \"function\";\n const canDelete = typeof onDeleteThread === \"function\";\n const canPin = typeof onPinThread === \"function\";\n\n // Filter -> search -> sort (pinned first, then most-recent) -> paginate ->\n // group the current page's slice by date.\n const { groups, totalPages } = useMemo(() => {\n const q = searchQuery.trim().toLowerCase();\n const filtered = threads.filter((t) => {\n if (filter === \"pinned\" && !t.pinned) return false;\n if (!q) return true;\n return (\n (t.title || \"\").toLowerCase().includes(q) ||\n (t.last_message_preview || \"\").toLowerCase().includes(q)\n );\n });\n\n const sorted = [...filtered].sort((a, b) => {\n if (a.pinned && !b.pinned) return -1;\n if (!a.pinned && b.pinned) return 1;\n const aTime = new Date(a.updated_at || a.created_at || 0).getTime();\n const bTime = new Date(b.updated_at || b.created_at || 0).getTime();\n return bTime - aTime;\n });\n\n // Server mode: `threads` is already the current page — render it all and\n // take the page count from the parent. Client mode: slice locally.\n const pages = serverPaginated\n ? Math.max(1, pageCount || 1)\n : Math.max(1, Math.ceil(sorted.length / pageSize));\n let pageItems;\n if (serverPaginated) {\n pageItems = sorted;\n } else {\n const safePage = Math.min(currentPage, pages);\n const start = (safePage - 1) * pageSize;\n pageItems = sorted.slice(start, start + pageSize);\n }\n\n const byBucket = {};\n for (const t of pageItems) {\n const bucket = dateBucket(t.updated_at || t.created_at);\n (byBucket[bucket] ||= []).push(t);\n }\n const grouped = BUCKET_ORDER.map((label) => ({\n label,\n items: byBucket[label] || [],\n })).filter((g) => g.items.length > 0);\n\n return { groups: grouped, totalPages: pages };\n }, [threads, searchQuery, filter, currentPage, pageSize, serverPaginated, pageCount]);\n\n const totalVisible = groups.reduce((n, g) => n + g.items.length, 0);\n\n // Effective page / navigation — controlled by the parent in server mode.\n const effectivePage = serverPaginated ? Math.max(1, page || 1) : currentPage;\n const goToPage = serverPaginated ? onPageChange : setCurrentPage;\n\n // Reset to the first page whenever the search / filter changes (client mode).\n useEffect(() => {\n if (!serverPaginated) setCurrentPage(1);\n }, [searchQuery, filter, serverPaginated]);\n\n // Clamp the current page when the page count shrinks (client mode).\n useEffect(() => {\n if (!serverPaginated) setCurrentPage((p) => Math.min(p, totalPages));\n }, [totalPages, serverPaginated]);\n\n // Window of up to 5 page numbers centered on the current page.\n const pageWindow = useMemo(() => {\n const max = 5;\n if (totalPages <= max) {\n return Array.from({ length: totalPages }, (_, i) => i + 1);\n }\n let start = Math.max(1, effectivePage - 2);\n const end = Math.min(totalPages, start + max - 1);\n start = Math.max(1, end - max + 1);\n return Array.from({ length: end - start + 1 }, (_, i) => start + i);\n }, [totalPages, effectivePage]);\n\n const startEdit = (e, thread) => {\n e.stopPropagation();\n setMenuOpenId(null);\n setDeletingId(null);\n setEditingId(thread.id);\n // Pre-fill the editor with the thread's current title so the user edits\n // the existing text rather than starting from a blank field. Fall back to\n // `name` in case the title is carried under that key.\n setEditValue(thread.title || thread.name || \"\");\n };\n\n const saveEdit = (e) => {\n if (e) e.stopPropagation();\n const trimmed = (editValue || \"\").trim();\n if (editingId && trimmed) onRenameThread?.(editingId, trimmed);\n setEditingId(null);\n setEditValue(\"\");\n };\n\n const cancelEdit = (e) => {\n if (e) e.stopPropagation();\n setEditingId(null);\n setEditValue(\"\");\n };\n\n const startDelete = (e, thread) => {\n e.stopPropagation();\n setMenuOpenId(null);\n setEditingId(null);\n setDeletingId(thread.id);\n };\n\n const confirmDelete = (e) => {\n if (e) e.stopPropagation();\n if (deletingId) onDeleteThread?.(deletingId);\n setDeletingId(null);\n };\n\n const cancelDelete = (e) => {\n if (e) e.stopPropagation();\n setDeletingId(null);\n };\n\n const togglePin = (e, thread) => {\n e.stopPropagation();\n onPinThread?.(thread.id, !thread.pinned);\n };\n\n const iconBtnStyle = {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n width: \"24px\",\n height: \"24px\",\n padding: 0,\n background: \"transparent\",\n border: \"none\",\n borderRadius: \"6px\",\n cursor: \"pointer\",\n color: COLORS.muted,\n transition: \"all 0.12s ease\",\n flexShrink: 0,\n };\n\n return (\n <div\n style={{\n display: \"flex\",\n flexDirection: \"column\",\n height: \"100%\",\n background: \"#FFFFFF\",\n overflow: \"hidden\",\n }}\n >\n {/* Header */}\n <div style={{ padding: \"16px 16px 0 16px\", flexShrink: 0 }}>\n {/* Section title */}\n <div\n style={{\n display: \"flex\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n height: \"32px\",\n }}\n >\n <div style={{ fontSize: \"14px\", fontWeight: 400, color: COLORS.title }}>\n Threads\n </div>\n {onCollapse && (\n <button\n type=\"button\"\n title=\"Collapse\"\n onClick={onCollapse}\n style={{\n ...iconBtnStyle,\n width: \"20px\",\n height: \"20px\",\n color: COLORS.muted,\n }}\n onMouseEnter={(e) => (e.currentTarget.style.background = COLORS.hoverBg)}\n onMouseLeave={(e) => (e.currentTarget.style.background = \"transparent\")}\n >\n <PanelLeftClose size={20} strokeWidth={1.5} />\n </button>\n )}\n </div>\n\n {/* Search */}\n <div\n style={{\n display: \"flex\",\n alignItems: \"center\",\n height: \"32px\",\n background: COLORS.searchTrack,\n borderRadius: \"11px\",\n padding: \"1px\",\n marginTop: \"12px\",\n }}\n >\n <div\n style={{\n display: \"flex\",\n flex: 1,\n alignItems: \"center\",\n gap: \"8px\",\n height: \"30px\",\n background: \"#FFFFFF\",\n borderRadius: \"10px\",\n padding: \"4px 8px\",\n }}\n >\n <Search size={18} style={{ color: COLORS.faint, flexShrink: 0 }} />\n <input\n type=\"text\"\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n placeholder=\"Search\"\n style={{\n flex: 1,\n minWidth: 0,\n border: \"none\",\n outline: \"none\",\n background: \"transparent\",\n fontSize: \"14px\",\n fontWeight: 500,\n color: COLORS.title,\n }}\n />\n </div>\n </div>\n\n {/* Filter pills */}\n <div style={{ display: \"flex\", alignItems: \"center\", gap: \"16px\", marginTop: \"12px\" }}>\n <button\n type=\"button\"\n onClick={() => changeFilter(\"all\")}\n style={{\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n height: \"28px\",\n padding: \"0 12px\",\n borderRadius: \"8px\",\n border: \"none\",\n cursor: \"pointer\",\n fontSize: \"14px\",\n fontWeight: 400,\n lineHeight: \"24px\",\n transition: \"all 0.12s ease\",\n background: filter === \"all\" ? COLORS.pillDarkBg : COLORS.hoverBg,\n color: filter === \"all\" ? COLORS.pillDarkText : COLORS.title,\n }}\n >\n All\n </button>\n <button\n type=\"button\"\n onClick={() => changeFilter(\"pinned\")}\n style={{\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: \"8px\",\n height: \"28px\",\n padding: \"0 16px\",\n borderRadius: \"10px\",\n border: \"none\",\n cursor: \"pointer\",\n fontSize: \"14px\",\n fontWeight: 400,\n lineHeight: \"24px\",\n transition: \"all 0.12s ease\",\n background: filter === \"pinned\" ? COLORS.pillDarkBg : COLORS.hoverBg,\n color: filter === \"pinned\" ? COLORS.pillDarkText : COLORS.title,\n }}\n >\n <Pin size={16} style={{ flexShrink: 0 }} />\n Pinned\n </button>\n </div>\n </div>\n\n {/* Thread List */}\n <div style={{ flex: 1, overflowY: \"auto\", padding: \"16px 16px 8px 16px\" }}>\n {loading ? (\n <div style={{ padding: \"30px 16px\", textAlign: \"center\", color: COLORS.faint, fontSize: \"13px\" }}>\n Loading threads...\n </div>\n ) : totalVisible === 0 ? (\n <div style={{ padding: \"30px 16px\", textAlign: \"center\", color: COLORS.faint, fontSize: \"13px\" }}>\n {searchQuery\n ? \"No threads found\"\n : filter === \"pinned\"\n ? \"No pinned threads\"\n : \"No threads yet\"}\n </div>\n ) : (\n groups.map((group) => (\n <div key={group.label} style={{ marginBottom: \"8px\" }}>\n {/* Section header */}\n <div\n style={{\n fontSize: \"13px\",\n fontWeight: 500,\n color: COLORS.title,\n padding: \"8px 0 4px 0\",\n }}\n >\n {group.label}\n </div>\n\n {group.items.map((thread) => {\n const isActive = thread.id === activeThreadId;\n const isHovered = hoveredId === thread.id;\n const isEditing = editingId === thread.id;\n const isDeleting = deletingId === thread.id;\n const isMenuOpen = menuOpenId === thread.id;\n const hasMenu = canEdit || canDelete;\n const showActions =\n (canPin || hasMenu) &&\n (isHovered || isActive || isMenuOpen) &&\n !isEditing &&\n !isDeleting;\n\n const isOpen = isMenuOpen || isDeleting || isEditing;\n const rowBg = isActive\n ? COLORS.selectedBg\n : isHovered || isOpen\n ? COLORS.hoverBg\n : \"transparent\";\n const rowBorder =\n isActive || isHovered || isOpen\n ? `1px solid ${COLORS.border}`\n : \"1px solid transparent\";\n\n return (\n <div\n key={thread.id}\n onClick={() => {\n if (isEditing || isDeleting) return;\n onSelectThread?.(thread.id);\n }}\n onMouseEnter={() => setHoveredId(thread.id)}\n onMouseLeave={() =>\n setHoveredId((prev) => (prev === thread.id ? null : prev))\n }\n style={{\n display: \"flex\",\n alignItems: \"center\",\n gap: \"4px\",\n padding: \"8px 4px\",\n marginBottom: \"2px\",\n borderRadius: \"8px\",\n background: rowBg,\n border: rowBorder,\n cursor: isEditing || isDeleting ? \"default\" : \"pointer\",\n transition: \"background 0.12s ease, border-color 0.12s ease\",\n boxSizing: \"border-box\",\n position: \"relative\",\n }}\n >\n {/* Leading icon */}\n <div\n style={{\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n width: \"40px\",\n height: \"40px\",\n flexShrink: 0,\n color: COLORS.muted,\n }}\n >\n <MessageSquare size={20} />\n </div>\n\n {/* Title + subtitle (or inline editor) */}\n {isEditing ? (\n <input\n ref={editInputRef}\n type=\"text\"\n value={editValue}\n onChange={(e) => setEditValue(e.target.value)}\n onClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => {\n e.stopPropagation();\n if (e.key === \"Enter\") saveEdit(e);\n else if (e.key === \"Escape\") cancelEdit(e);\n }}\n style={{\n flex: 1,\n minWidth: 0,\n fontSize: \"14px\",\n fontWeight: 600,\n color: COLORS.title,\n background: \"#fff\",\n border: `1px solid ${COLORS.border}`,\n borderRadius: \"6px\",\n padding: \"4px 8px\",\n outline: \"none\",\n boxSizing: \"border-box\",\n }}\n />\n ) : (\n <div\n style={{\n flex: 1,\n minWidth: 0,\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"4px\",\n textAlign: \"left\",\n }}\n >\n <div\n title={thread.title || thread.name || \"Untitled thread\"}\n style={{\n display: \"block\",\n minWidth: 0,\n maxWidth: \"100%\",\n fontSize: \"14px\",\n fontWeight: isActive ? 550 : 500,\n color: COLORS.title,\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n lineHeight: 1.2,\n }}\n >\n {thread.title || thread.name || \"Untitled thread\"}\n </div>\n {isDeleting ? (\n <div\n style={{\n display: \"flex\",\n alignItems: \"center\",\n flexWrap: \"wrap\",\n gap: \"8px\",\n }}\n >\n <span\n style={{\n fontSize: \"12px\",\n fontWeight: 500,\n color: COLORS.title,\n }}\n >\n Confirm: delete this thread?\n </span>\n <button\n type=\"button\"\n onClick={confirmDelete}\n style={{\n padding: \"3px 12px\",\n fontSize: \"12px\",\n fontWeight: 600,\n color: COLORS.title,\n background: \"#ECEEF2\",\n border: `1px solid ${COLORS.borderSubtle}`,\n borderRadius: \"6px\",\n cursor: \"pointer\",\n }}\n onMouseEnter={(e) => (e.currentTarget.style.background = \"#E2E5EA\")}\n onMouseLeave={(e) => (e.currentTarget.style.background = \"#ECEEF2\")}\n >\n Yes\n </button>\n <button\n type=\"button\"\n onClick={cancelDelete}\n style={{\n padding: \"3px 6px\",\n fontSize: \"12px\",\n fontWeight: 500,\n color: COLORS.muted,\n background: \"transparent\",\n border: \"none\",\n cursor: \"pointer\",\n }}\n onMouseEnter={(e) => (e.currentTarget.style.color = COLORS.title)}\n onMouseLeave={(e) => (e.currentTarget.style.color = COLORS.muted)}\n >\n No\n </button>\n </div>\n ) : (\n <div\n style={{\n fontSize: \"12px\",\n color: COLORS.muted,\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n lineHeight: 1.5,\n }}\n >\n {thread.message_count != null && (\n <>\n {thread.message_count} msg{thread.message_count !== 1 ? \"s\" : \"\"}\n {\" · \"}\n </>\n )}\n {formatRelative(thread.updated_at || thread.created_at)}\n </div>\n )}\n </div>\n )}\n\n {/* Inline edit actions */}\n {isEditing && (\n <div style={{ display: \"inline-flex\", alignItems: \"center\", gap: \"2px\", flexShrink: 0 }}>\n <button\n type=\"button\"\n title=\"Save\"\n onClick={saveEdit}\n style={{ ...iconBtnStyle, color: \"#1f9d57\" }}\n onMouseEnter={(e) => (e.currentTarget.style.background = \"rgba(31,157,87,0.12)\")}\n onMouseLeave={(e) => (e.currentTarget.style.background = \"transparent\")}\n >\n <Check size={15} />\n </button>\n <button\n type=\"button\"\n title=\"Cancel\"\n onClick={cancelEdit}\n style={iconBtnStyle}\n onMouseEnter={(e) => (e.currentTarget.style.background = \"rgba(0,0,0,0.06)\")}\n onMouseLeave={(e) => (e.currentTarget.style.background = \"transparent\")}\n >\n <X size={15} />\n </button>\n </div>\n )}\n\n {/* A pinned thread keeps its pin indicator visible even when\n the row isn't hovered/active and the action cluster is hidden. */}\n {!isEditing && !isDeleting && !showActions && thread.pinned && (\n <Pin\n size={14}\n style={{ color: COLORS.title, flexShrink: 0 }}\n fill=\"currentColor\"\n />\n )}\n\n {/* Hover / selected action cluster: pin + kebab menu */}\n {showActions && (\n <div style={{ display: \"inline-flex\", alignItems: \"center\", gap: \"2px\", flexShrink: 0 }}>\n {canPin && (\n <button\n type=\"button\"\n title={thread.pinned ? \"Unpin\" : \"Pin\"}\n onClick={(e) => togglePin(e, thread)}\n style={{\n ...iconBtnStyle,\n color: thread.pinned ? COLORS.title : COLORS.muted,\n }}\n onMouseEnter={(e) => {\n e.currentTarget.style.background = \"rgba(0,0,0,0.06)\";\n e.currentTarget.style.color = COLORS.title;\n }}\n onMouseLeave={(e) => {\n e.currentTarget.style.background = \"transparent\";\n e.currentTarget.style.color = thread.pinned ? COLORS.title : COLORS.muted;\n }}\n >\n <Pin size={14} fill={thread.pinned ? \"currentColor\" : \"none\"} />\n </button>\n )}\n {hasMenu && (\n <button\n type=\"button\"\n title=\"More\"\n onClick={(e) => {\n e.stopPropagation();\n setMenuOpenId((prev) => (prev === thread.id ? null : thread.id));\n }}\n style={{\n ...iconBtnStyle,\n color: isMenuOpen ? COLORS.title : COLORS.muted,\n background: isMenuOpen ? \"rgba(0,0,0,0.06)\" : \"transparent\",\n }}\n onMouseEnter={(e) => {\n e.currentTarget.style.background = \"rgba(0,0,0,0.06)\";\n e.currentTarget.style.color = COLORS.title;\n }}\n onMouseLeave={(e) => {\n e.currentTarget.style.background = isMenuOpen\n ? \"rgba(0,0,0,0.06)\"\n : \"transparent\";\n e.currentTarget.style.color = isMenuOpen ? COLORS.title : COLORS.muted;\n }}\n >\n <MoreVertical size={14} />\n </button>\n )}\n </div>\n )}\n\n {/* ⋮ dropdown: Rename / Delete */}\n {isMenuOpen && hasMenu && (\n <div\n onClick={(e) => e.stopPropagation()}\n style={{\n position: \"absolute\",\n top: \"calc(100% - 2px)\",\n right: \"8px\",\n zIndex: 20,\n width: \"144px\",\n background: \"#FFFFFF\",\n border: `1px solid ${COLORS.border}`,\n borderRadius: \"4px\",\n boxShadow: \"-2px 2px 4px rgba(0,0,0,0.1)\",\n overflow: \"hidden\",\n }}\n >\n {canEdit && (\n <button\n type=\"button\"\n onClick={(e) => startEdit(e, thread)}\n style={{\n display: \"block\",\n width: \"100%\",\n textAlign: \"left\",\n padding: \"12px\",\n fontSize: \"13px\",\n color: COLORS.title,\n background: \"transparent\",\n border: \"none\",\n cursor: \"pointer\",\n }}\n onMouseEnter={(e) => (e.currentTarget.style.background = COLORS.hoverBg)}\n onMouseLeave={(e) => (e.currentTarget.style.background = \"transparent\")}\n >\n Rename\n </button>\n )}\n {canDelete && (\n <button\n type=\"button\"\n onClick={(e) => startDelete(e, thread)}\n style={{\n display: \"block\",\n width: \"100%\",\n textAlign: \"left\",\n padding: \"12px\",\n fontSize: \"13px\",\n color: COLORS.title,\n background: \"transparent\",\n border: \"none\",\n borderTop: canEdit ? `1px solid ${COLORS.border}` : \"none\",\n cursor: \"pointer\",\n }}\n onMouseEnter={(e) => (e.currentTarget.style.background = COLORS.hoverBg)}\n onMouseLeave={(e) => (e.currentTarget.style.background = \"transparent\")}\n >\n Delete\n </button>\n )}\n </div>\n )}\n\n </div>\n );\n })}\n </div>\n ))\n )}\n </div>\n\n {/* Pagination */}\n {!loading && totalPages > 1 && (\n <div\n style={{\n flexShrink: 0,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: \"6px\",\n height: \"64px\",\n padding: \"0 16px\",\n boxSizing: \"border-box\",\n borderTop: `1px solid ${COLORS.border}`,\n }}\n >\n {/* Back */}\n <button\n type=\"button\"\n disabled={effectivePage <= 1}\n onClick={() => goToPage(Math.max(1, effectivePage - 1))}\n style={{\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: \"4px\",\n height: \"24px\",\n padding: \"4px 8px\",\n borderRadius: \"10px\",\n background: \"#FFFFFF\",\n border: `1px solid ${COLORS.borderSubtle}`,\n fontSize: \"12px\",\n lineHeight: \"16px\",\n color: \"#0b0b0b\",\n cursor: effectivePage <= 1 ? \"default\" : \"pointer\",\n opacity: effectivePage <= 1 ? 0.5 : 1,\n }}\n >\n <ChevronLeft size={12} />\n Back\n </button>\n\n {/* Page numbers */}\n {pageWindow.map((n) => {\n const isActivePage = n === effectivePage;\n return (\n <button\n key={n}\n type=\"button\"\n onClick={() => goToPage(n)}\n style={{\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n height: \"24px\",\n minWidth: \"22px\",\n padding: \"4px 8px\",\n borderRadius: \"10px\",\n fontSize: \"12px\",\n lineHeight: \"16px\",\n cursor: \"pointer\",\n background: isActivePage ? \"#0b0b0b\" : \"#FFFFFF\",\n color: isActivePage ? \"#FFFFFF\" : \"#0b0b0b\",\n border: isActivePage ? \"1px solid #0b0b0b\" : `1px solid ${COLORS.borderSubtle}`,\n fontWeight: isActivePage ? 600 : 400,\n }}\n >\n {n}\n </button>\n );\n })}\n\n {/* Next */}\n <button\n type=\"button\"\n disabled={effectivePage >= totalPages}\n onClick={() => goToPage(Math.min(totalPages, effectivePage + 1))}\n style={{\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: \"4px\",\n height: \"24px\",\n padding: \"4px 8px\",\n borderRadius: \"10px\",\n background: \"#FFFFFF\",\n border: `1px solid ${COLORS.borderSubtle}`,\n fontSize: \"12px\",\n lineHeight: \"16px\",\n color: \"#0b0b0b\",\n cursor: effectivePage >= totalPages ? \"default\" : \"pointer\",\n opacity: effectivePage >= totalPages ? 0.5 : 1,\n }}\n >\n Next\n <ChevronRight size={12} />\n </button>\n </div>\n )}\n </div>\n );\n}\n","/**\n * NOTE: Deprecated component.\n *\n * This chat-scoped `MessageThread` was an early demo implementation and\n * is tightly coupled to app-specific context (`useUserContext`, `toast`, etc.).\n *\n * For new work and for consumers of the `chordia-ui` library, prefer the\n * framework-agnostic, reusable version exported from:\n *\n * `src/components/common/MessageThread.jsx`\n *\n * which is re-exported via the main package entry:\n *\n * import { MessageThread } from \"chordia-ui\";\n *\n * This file is kept only for backwards compatibility within the app.\n */\n\"use client\";\n\nimport React, { useState, useEffect, useRef } from \"react\";\nimport { Send, Paperclip, AtSign, Hash, Clock } from \"lucide-react\";\n// TODO: replace with framework-agnostic toast\nconst toast = { error: (...args) => console.warn(\"toast.error:\", ...args) };\n// TODO: replace with framework-agnostic context\nconst useUserContext = () => ({ userData: { name: \"User\", email: \"\" } });\n\n/**\n * MessageThread Component\n * Threaded messaging interface for team collaboration around sessions.\n * Supports mentions, condition references, and timestamp links.\n * Uses dummy data for demonstration purposes.\n */\nexport default function MessageThread({\n sessionTitle,\n messages: initialMessages,\n onSendMessage,\n currentUser,\n}) {\n const [messageInput, setMessageInput] = useState(\"\");\n const [isFocused, setIsFocused] = useState(false);\n const [messages, setMessages] = useState(initialMessages || []);\n const [isLoading, setIsLoading] = useState(false);\n const [isSending, setIsSending] = useState(false);\n const { userData } = useUserContext();\n const messagesEndRef = useRef(null);\n\n // Get current user from context if not provided\n const displayCurrentUser = currentUser || {\n name: userData?.name || \"You\",\n initials: userData?.name\n ?.split(\" \")\n .map((n) => n[0])\n .join(\"\")\n .toUpperCase() || \"YO\",\n color: \"#6B7C93\",\n };\n\n // Use initialMessages if provided, otherwise use empty array (no API fetching)\n useEffect(() => {\n if (initialMessages) {\n setMessages(initialMessages);\n } else {\n setMessages([]);\n }\n }, [initialMessages]);\n\n // Scroll to bottom when new messages arrive\n useEffect(() => {\n if (messagesEndRef.current) {\n messagesEndRef.current.scrollIntoView({ behavior: \"smooth\" });\n }\n }, [messages]);\n\n const handleSend = async () => {\n if (!messageInput.trim()) return;\n\n const content = messageInput.trim();\n setMessageInput(\"\");\n setIsSending(true);\n\n // Create optimistic message\n const optimisticMessage = {\n id: `temp-${Date.now()}`,\n author: {\n name: displayCurrentUser.name,\n role: userData?.role || \"\",\n initials: displayCurrentUser.initials,\n color: displayCurrentUser.color,\n },\n content: content,\n timestamp: \"Just now\",\n type: \"comment\",\n isOptimistic: true,\n };\n\n // Optimistically add message\n setMessages((prev) => [...prev, optimisticMessage]);\n\n // If onSendMessage callback is provided, use it\n if (onSendMessage) {\n try {\n await onSendMessage(content);\n // Remove optimistic flag after callback succeeds\n setMessages((prev) =>\n prev.map((msg) =>\n msg.id === optimisticMessage.id\n ? { ...msg, isOptimistic: false }\n : msg\n )\n );\n } catch (error) {\n // Remove optimistic message on error\n setMessages((prev) => prev.filter((msg) => msg.id !== optimisticMessage.id));\n toast.error(\"Failed to send message\");\n } finally {\n setIsSending(false);\n }\n return;\n }\n\n // No API - just confirm the optimistic message\n setTimeout(() => {\n setMessages((prev) =>\n prev.map((msg) =>\n msg.id === optimisticMessage.id\n ? { ...msg, isOptimistic: false }\n : msg\n )\n );\n setIsSending(false);\n }, 500);\n };\n\n const handleKeyPress = (e) => {\n if (e.key === \"Enter\" && !e.shiftKey) {\n e.preventDefault();\n handleSend();\n }\n };\n\n return (\n <div\n style={{\n display: \"flex\",\n flexDirection: \"column\",\n height: \"100%\",\n background: \"var(--paper-elevated, rgba(255,255,255,0.82))\",\n border: \"1px solid var(--border, rgba(52,58,64,0.12))\",\n borderRadius: \"var(--radius-lg, 12px)\",\n overflow: \"hidden\",\n }}\n >\n {/* Header */}\n {sessionTitle && (\n <div\n style={{\n padding: \"14px 16px\",\n borderBottom: \"1px solid var(--border, rgba(52,58,64,0.12))\",\n background: \"var(--paper-elevated, rgba(255,255,255,0.82))\",\n }}\n >\n <div\n style={{\n fontSize: \"var(--text-md, 13px)\",\n fontWeight: 680,\n color: \"var(--text-strong, rgba(30,33,37,0.92))\",\n marginBottom: \"3px\",\n }}\n >\n Session Discussion\n </div>\n {sessionTitle && (\n <div\n style={{\n fontSize: \"var(--text-sm, 11px)\",\n color: \"var(--text-muted, rgba(30,33,37,0.56))\",\n display: \"flex\",\n alignItems: \"center\",\n gap: \"8px\",\n }}\n >\n <span>{sessionTitle}</span>\n </div>\n )}\n </div>\n )}\n\n {/* Messages */}\n <div\n style={{\n flex: 1,\n overflowY: \"auto\",\n padding: \"16px\",\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"16px\",\n }}\n >\n {isLoading ? (\n <div\n style={{\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n padding: \"40px\",\n color: \"var(--text-faint, rgba(30,33,37,0.36))\",\n }}\n >\n Loading messages...\n </div>\n ) : messages.length === 0 ? (\n <div\n style={{\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n padding: \"40px\",\n color: \"var(--text-faint, rgba(30,33,37,0.36))\",\n }}\n >\n No messages yet. Start the conversation!\n </div>\n ) : (\n messages.map((message) => (\n <div\n key={message.id}\n style={{\n display: \"flex\",\n gap: \"12px\",\n opacity: message.type === \"system\" ? 0.75 : 1,\n }}\n >\n {/* Avatar */}\n {message.type !== \"system\" && (\n <div\n style={{\n width: \"32px\",\n height: \"32px\",\n borderRadius: \"8px\",\n background: message.author.color,\n color: \"white\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n fontSize: \"11px\",\n fontWeight: 650,\n flexShrink: 0,\n opacity: 0.9,\n }}\n >\n {message.author.initials}\n </div>\n )}\n {message.type === \"system\" && (\n <div\n style={{\n width: \"32px\",\n height: \"32px\",\n borderRadius: \"8px\",\n background: \"rgba(30, 33, 37, 0.08)\",\n color: \"rgba(30, 33, 37, 0.52)\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n fontSize: \"11px\",\n fontWeight: 650,\n flexShrink: 0,\n }}\n >\n <Clock size={14} />\n </div>\n )}\n\n {/* Message content */}\n <div style={{ flex: 1, minWidth: 0 }}>\n {/* Author and timestamp */}\n <div\n style={{\n display: \"flex\",\n alignItems: \"baseline\",\n gap: \"8px\",\n marginBottom: \"4px\",\n }}\n >\n <span\n style={{\n fontSize: \"var(--text-sm, 11px)\",\n fontWeight: 650,\n color: \"var(--text-base, rgba(30,33,37,0.78))\",\n }}\n >\n {message.author.name}\n </span>\n <span\n style={{\n fontSize: \"var(--text-sm, 11px)\",\n color: \"var(--text-faint, rgba(30,33,37,0.36))\",\n fontFamily: \"var(--font-mono, monospace)\",\n }}\n >\n {message.timestamp}\n </span>\n {message.author.role && (\n <span\n style={{\n fontSize: \"var(--text-xs, 10px)\",\n color: \"var(--text-muted, rgba(30,33,37,0.56))\",\n background: \"rgba(30, 33, 37, 0.06)\",\n padding: \"2px 6px\",\n borderRadius: \"4px\",\n textTransform: \"uppercase\",\n letterSpacing: \"0.04em\",\n fontWeight: 600,\n }}\n >\n {message.author.role}\n </span>\n )}\n {message.isEdited && (\n <span\n style={{\n fontSize: \"var(--text-xs, 10px)\",\n color: \"var(--text-faint, rgba(30,33,37,0.36))\",\n fontStyle: \"italic\",\n }}\n >\n (edited)\n </span>\n )}\n </div>\n\n {/* Message text */}\n <div\n style={{\n fontSize: \"var(--text-md, 13px)\",\n color: \"var(--text-base, rgba(30,33,37,0.78))\",\n lineHeight: 1.5,\n marginBottom: message.references ? \"8px\" : 0,\n }}\n >\n {message.content}\n </div>\n\n {/* References */}\n {message.references && message.references.length > 0 && (\n <div\n style={{\n display: \"flex\",\n flexWrap: \"wrap\",\n gap: \"6px\",\n marginTop: \"8px\",\n }}\n >\n {message.references.map((ref, idx) => (\n <button\n key={idx}\n type=\"button\"\n style={{\n fontSize: \"11px\",\n padding: \"4px 8px\",\n borderRadius: \"6px\",\n border: \"1px solid rgba(52, 58, 64, 0.16)\",\n background: \"rgba(255, 255, 255, 0.7)\",\n color:\n ref.type === \"condition\"\n ? \"rgba(94, 136, 176, 0.85)\"\n : ref.type === \"observation\"\n ? \"rgba(107, 123, 147, 0.85)\"\n : ref.type === \"timestamp\"\n ? \"rgba(184, 156, 106, 0.85)\"\n : \"rgba(30, 33, 37, 0.65)\",\n cursor: \"pointer\",\n display: \"inline-flex\",\n alignItems: \"center\",\n gap: \"4px\",\n transition: \"all 0.15s ease\",\n fontWeight: 550,\n }}\n onMouseEnter={(e) => {\n e.currentTarget.style.background =\n \"rgba(255, 255, 255, 0.95)\";\n e.currentTarget.style.borderColor =\n \"rgba(52, 58, 64, 0.24)\";\n }}\n onMouseLeave={(e) => {\n e.currentTarget.style.background =\n \"rgba(255, 255, 255, 0.7)\";\n e.currentTarget.style.borderColor =\n \"rgba(52, 58, 64, 0.16)\";\n }}\n >\n {ref.type === \"timestamp\" && <Clock size={12} />}\n {(ref.type === \"condition\" ||\n ref.type === \"observation\") && <Hash size={12} />}\n {ref.label}\n </button>\n ))}\n </div>\n )}\n </div>\n </div>\n ))\n )}\n <div ref={messagesEndRef} />\n </div>\n\n {/* Input area */}\n <div\n style={{\n padding: \"12px\",\n borderTop: \"1px solid var(--border, rgba(52,58,64,0.12))\",\n background: \"var(--paper-elevated, rgba(255,255,255,0.82))\",\n }}\n >\n <div\n style={{\n display: \"flex\",\n gap: \"8px\",\n alignItems: \"flex-end\",\n }}\n >\n {/* Current user avatar */}\n <div\n style={{\n width: \"32px\",\n height: \"32px\",\n borderRadius: \"var(--radius-md, 8px)\",\n background: displayCurrentUser.color,\n color: \"white\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n fontSize: \"var(--text-sm, 11px)\",\n fontWeight: 650,\n flexShrink: 0,\n opacity: 0.9,\n }}\n >\n {displayCurrentUser.initials}\n </div>\n\n {/* Input field */}\n <div\n style={{\n flex: 1,\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"8px\",\n }}\n >\n <textarea\n value={messageInput}\n onChange={(e) => setMessageInput(e.target.value)}\n onKeyDown={handleKeyPress}\n onFocus={() => setIsFocused(true)}\n onBlur={() => setIsFocused(false)}\n placeholder=\"Add a comment...\"\n style={{\n width: \"100%\",\n minHeight: \"38px\",\n maxHeight: \"120px\",\n padding: \"8px 12px\",\n fontSize: \"var(--text-md, 13px)\",\n color: \"var(--text-base, rgba(30,33,37,0.78))\",\n background: \"white\",\n border: `1px solid ${\n isFocused\n ? \"rgba(94, 136, 176, 0.35)\"\n : \"rgba(52, 58, 64, 0.16)\"\n }`,\n borderRadius: \"var(--radius-md, 8px)\",\n resize: \"vertical\",\n outline: \"none\",\n transition: \"border-color 0.15s ease\",\n fontFamily: \"inherit\",\n lineHeight: 1.5,\n }}\n />\n\n {/* Toolbar */}\n <div\n style={{\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n }}\n >\n <div style={{ display: \"flex\", gap: \"4px\" }}>\n <button\n type=\"button\"\n style={{\n padding: \"6px\",\n background: \"transparent\",\n border: \"none\",\n borderRadius: \"6px\",\n color: \"rgba(30, 33, 37, 0.52)\",\n cursor: \"pointer\",\n display: \"flex\",\n alignItems: \"center\",\n transition: \"all 0.15s ease\",\n }}\n onMouseEnter={(e) => {\n e.currentTarget.style.background =\n \"rgba(30, 33, 37, 0.06)\";\n e.currentTarget.style.color = \"rgba(30, 33, 37, 0.75)\";\n }}\n onMouseLeave={(e) => {\n e.currentTarget.style.background = \"transparent\";\n e.currentTarget.style.color = \"rgba(30, 33, 37, 0.52)\";\n }}\n title=\"Mention user\"\n >\n <AtSign size={16} />\n </button>\n <button\n type=\"button\"\n style={{\n padding: \"6px\",\n background: \"transparent\",\n border: \"none\",\n borderRadius: \"6px\",\n color: \"rgba(30, 33, 37, 0.52)\",\n cursor: \"pointer\",\n display: \"flex\",\n alignItems: \"center\",\n transition: \"all 0.15s ease\",\n }}\n onMouseEnter={(e) => {\n e.currentTarget.style.background =\n \"rgba(30, 33, 37, 0.06)\";\n e.currentTarget.style.color = \"rgba(30, 33, 37, 0.75)\";\n }}\n onMouseLeave={(e) => {\n e.currentTarget.style.background = \"transparent\";\n e.currentTarget.style.color = \"rgba(30, 33, 37, 0.52)\";\n }}\n title=\"Reference condition\"\n >\n <Hash size={16} />\n </button>\n <button\n type=\"button\"\n style={{\n padding: \"6px\",\n background: \"transparent\",\n border: \"none\",\n borderRadius: \"6px\",\n color: \"rgba(30, 33, 37, 0.52)\",\n cursor: \"pointer\",\n display: \"flex\",\n alignItems: \"center\",\n transition: \"all 0.15s ease\",\n }}\n onMouseEnter={(e) => {\n e.currentTarget.style.background =\n \"rgba(30, 33, 37, 0.06)\";\n e.currentTarget.style.color = \"rgba(30, 33, 37, 0.75)\";\n }}\n onMouseLeave={(e) => {\n e.currentTarget.style.background = \"transparent\";\n e.currentTarget.style.color = \"rgba(30, 33, 37, 0.52)\";\n }}\n title=\"Attach file\"\n >\n <Paperclip size={16} />\n </button>\n </div>\n <button\n type=\"button\"\n onClick={handleSend}\n disabled={!messageInput.trim() || isSending}\n style={{\n padding: \"6px 12px\",\n background:\n messageInput.trim() && !isSending\n ? \"rgba(94, 136, 176, 0.85)\"\n : \"var(--border-subtle, rgba(52,58,64,0.08))\",\n border: \"none\",\n borderRadius: \"6px\",\n color:\n messageInput.trim() && !isSending\n ? \"white\"\n : \"var(--text-faint, rgba(30,33,37,0.36))\",\n fontSize: \"var(--text-sm, 11px)\",\n fontWeight: 600,\n cursor:\n messageInput.trim() && !isSending\n ? \"pointer\"\n : \"not-allowed\",\n display: \"flex\",\n alignItems: \"center\",\n gap: \"6px\",\n transition: \"all 0.15s ease\",\n }}\n onMouseEnter={(e) => {\n if (messageInput.trim() && !isSending) {\n e.currentTarget.style.background = \"rgba(94, 136, 176, 1)\";\n }\n }}\n onMouseLeave={(e) => {\n if (messageInput.trim() && !isSending) {\n e.currentTarget.style.background =\n \"rgba(94, 136, 176, 0.85)\";\n }\n }}\n >\n {isSending ? (\n <>\n <style>\n {`\n @keyframes messageSpin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n `}\n </style>\n <div\n style={{\n width: \"14px\",\n height: \"14px\",\n border: \"2px solid rgba(255, 255, 255, 0.3)\",\n borderTopColor: \"white\",\n borderRadius: \"50%\",\n animation: \"messageSpin 0.6s linear infinite\",\n }}\n />\n Sending...\n </>\n ) : (\n <>\n <Send size={14} />\n Send\n </>\n )}\n </button>\n </div>\n </div>\n </div>\n <div\n style={{\n marginTop: \"8px\",\n fontSize: \"var(--text-sm, 11px)\",\n color: \"var(--text-faint, rgba(30,33,37,0.36))\",\n lineHeight: 1.4,\n }}\n >\n <strong>Tip:</strong> Use{\" \"}\n <code\n style={{\n background: \"rgba(30, 33, 37, 0.06)\",\n padding: \"2px 4px\",\n borderRadius: \"3px\",\n fontFamily: \"var(--font-mono, monospace)\",\n fontSize: \"var(--text-xs, 10px)\",\n }}\n >\n @\n </code>{\" \"}\n to mention teammates,{\" \"}\n <code\n style={{\n background: \"rgba(30, 33, 37, 0.06)\",\n padding: \"2px 4px\",\n borderRadius: \"3px\",\n fontFamily: \"var(--font-mono, monospace)\",\n fontSize: \"var(--text-xs, 10px)\",\n }}\n >\n #\n </code>{\" \"}\n to reference conditions\n </div>\n </div>\n </div>\n );\n}\n\n"],"names":["SYMBOL_BG","BUBBLE_BG","TEXT_COLOR","BrandSymbol","size","inner","jsx","jsxs","ThinkingIndicator","phase","label","toolSteps","elapsedMs","compact","toast","args","ChatInterface","initialMessages","onSendMessage","onStreamMessage","onMessagesChange","onCodeBlockClick","placeholder","title","messages","setMessages","useState","inputValue","setInputValue","isProcessing","setIsProcessing","isSending","setIsSending","currentAssistantMessage","setCurrentAssistantMessage","thinkingPhase","setThinkingPhase","thinkingStartTime","setThinkingStartTime","setElapsedMs","messagesEndRef","useRef","inputRef","streamAbortController","currentAssistantRef","lastChunkTimeRef","streamSilent","setStreamSilent","silenceSeconds","setSilenceSeconds","useEffect","_a","allMessages","interval","gap","resetProcessingState","parseSSELine","line","data","handleStreamChunk","chunk","_b","delta","prev","baseMessage","updated","processStream","stream","reader","decoder","buffer","done","value","lines","parsed","handleSend","userContent","userMessage","newMessages","result","assistantMessage","resolved","error","handleKeyDown","e","Fragment","message","ChatMessage","Send","COLORS","dateBucket","dateStr","d","now","startToday","startYesterday","BUCKET_ORDER","formatRelative","diff","min","hr","day","ChatHistoryPanel","threads","activeThreadId","onSelectThread","onNewChat","onCollapse","onRenameThread","onDeleteThread","onPinThread","loading","pageSize","page","pageCount","onPageChange","onFilterChange","serverPaginated","searchQuery","setSearchQuery","filter","setFilter","changeFilter","f","currentPage","setCurrentPage","hoveredId","setHoveredId","editingId","setEditingId","editValue","setEditValue","deletingId","setDeletingId","menuOpenId","setMenuOpenId","editInputRef","close","onKey","canEdit","canDelete","canPin","groups","totalPages","useMemo","q","sorted","t","a","b","aTime","pages","pageItems","start","byBucket","bucket","g","totalVisible","n","effectivePage","goToPage","p","pageWindow","_","i","end","startEdit","thread","saveEdit","trimmed","cancelEdit","startDelete","confirmDelete","cancelDelete","togglePin","iconBtnStyle","PanelLeftClose","Search","Pin","group","isActive","isHovered","isEditing","isDeleting","isMenuOpen","hasMenu","showActions","isOpen","rowBg","rowBorder","MessageSquare","Check","X","MoreVertical","ChevronLeft","isActivePage","ChevronRight","useUserContext","MessageThread","sessionTitle","currentUser","messageInput","setMessageInput","isFocused","setIsFocused","isLoading","setIsLoading","userData","displayCurrentUser","content","optimisticMessage","msg","handleKeyPress","Clock","ref","idx","Hash","AtSign","Paperclip"],"mappings":";;;;AAkBA,MAAMA,KAAY,WACZC,KAAY,WACZC,KAAa;AAGnB,SAASC,GAAY,EAAE,MAAAC,IAAO,MAAM;AAClC,QAAMC,IAAQ,KA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Z,UAAU;AAAA,wBACZ;AAAA,wBACD,UAAA;AAAA,sBAAA;AAAA,oBAED;AAAA,oBAAQ;AAAA,oBAAI;AAAA,kBAAA;AAAA,gBAAA;AAAA,cAEd;AAAA,YAAA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),w=require("react"),ht=require("react-dom"),h=require("lucide-react"),qe=require("./DataTable2.cjs.js"),ve={"8h":8*60*60*1e3,"1d":24*60*60*1e3,"7d":7*24*60*60*1e3,"30d":30*24*60*60*1e3},Je="en-US",yt={month:"2-digit",day:"2-digit",year:"numeric"},mt={hour:"numeric",minute:"2-digit",hour12:!0};function he(t){if(!t)return null;if(t instanceof Date)return Number.isNaN(t.getTime())?null:t;const n=String(t).trim(),i=n.match(/^(\d{4})-(\d{1,2})-(\d{1,2})/);if(i){const o=new Date(Number(i[1]),Number(i[2])-1,Number(i[3]));return Number.isNaN(o.getTime())?null:o}const r=new Date(n);return Number.isNaN(r.getTime())?null:r}function Ze(t,n){return t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()}function ee(t){const n=t instanceof Date?t:he(t);return n?n.toLocaleDateString(Je,yt):""}function Ce(t){return t.toLocaleTimeString(Je,mt)}function se(t){return`${ee(t)} ${Ce(t)}`}function Qe(t,n){const i=he(t),r=he(n);return!i||!r?"":Ze(i,r)?`${se(i)} – ${Ce(r)}`:`${se(i)} – ${se(r)}`}function et(t,n){const i=he(t),r=he(n);return!i||!r?null:Ze(i,r)?{from:se(i),to:Ce(r)}:{from:se(i),to:se(r)}}function je(t){const n=ve[t];if(!n)return null;const i=new Date;return{from:new Date(i.getTime()-n),to:i}}function tt(t){if(!ve[t])return"";const i=je(t);return i?t==="8h"?Qe(i.from,i.to):`${ee(i.from)} – ${ee(i.to)}`:""}const nt="M1.00049 13.5213C7.85975 11.7032 8.88149 4.73912 13.7838 4.73912C19.8344 4.73912 23.6237 17.166 29.1281 17.166C34.5998 17.166 37.4149 4.88121 43.4004 8.61051C47.9764 11.4616 50.6186 1.00024 50.6186 1.00024",it="M1.00049 16.692C8.88149 15.6975 8.88149 7.79403 13.7838 7.79403C19.8344 7.79403 23.6237 21.4034 29.1281 21.4034C34.5998 21.4034 37.4149 8.93821 43.4004 12.7223C47.9764 15.6152 50.6186 5.00024 50.6186 5.00024V36.0002C50.6186 36.0002 10.8223 36.0002 1.00049 36.0002C1.00049 28.8653 1.00049 19.4871 1.00049 16.692Z";function ke(t){if(!Array.isArray(t))return null;const n=t.map(i=>Array.isArray(i)?Number(i[1]):i==null||i===""?NaN:Number(i)).filter(i=>Number.isFinite(i));return n.length>=2?n:null}function $e(t,n=52,i=36){const r=ke(t);if(!r)return null;const o=Math.min(...r),a=Math.max(...r),d=4,c=a-o||1,F=i-d*2-4,p=D=>(r.length===1?0:D/(r.length-1)*(n-2))+1,y=D=>d+(1-(D-o)/c)*F;let b="";for(let D=0;D<r.length;D++)b+=`${D===0?"M":"L"}${p(D).toFixed(2)},${y(r[D]).toFixed(2)}`;const v=p(r.length-1),S=p(0),W=`${b} L${v.toFixed(2)},${i} L${S.toFixed(2)},${i} Z`;return{line:b,area:W}}function we(t){const n=ke(t);if(!n)return null;const i=n[0],r=n[n.length-1];return r>i?"up":r<i?"down":"up"}const Ae="—";function Se(t){if(t==null)return!0;const n=String(t).trim();return!!(!n||/^[-−–—]$/.test(n)||/^(n\/a|null|undefined)$/i.test(n))}function ye(t){return!Se(t)}function Ie(t,n=Ae){return Se(t)?n:String(t)}function Oe(t){return t!=null&&String(t).trim()!==""}function U(t){return t?Oe(t.value)||Oe(t.delta)?!0:Array.isArray(t.points)&&t.points.length>0:!1}function lt(t){if(Se(t))return null;const n=String(t).trim(),i=n.match(/\(\s*([+-])?\s*([\d.]+)/);return i?i[1]==="-"?"down":i[1]==="+"?"up":parseFloat(i[2])<0?"down":"up":/^[-−]/.test(n)?"down":/^\+/.test(n)?"up":/-\d/.test(n)?"down":null}function De(t,n){return lt(n)??(t==="down"?"down":"up")}function rt(t,n,i){return we(i)??(ye(n)?De(t,n):t==="down"?"down":"up")}const s={ink:"var(--color-text)",muted:"var(--color-text-secondary)",border:"var(--grey-absent)",borderSubtle:"var(--neutral-100)",iconCircle:"var(--surface-hover)",black:"var(--neutral-900)",white:"var(--grey-white)",neutralBorder:"var(--neutral-250)",neutral800:"var(--neutral-800)",neutral600:"var(--neutral-600)",neutral450:"var(--neutral-450)",neutral400:"var(--neutral-400)",neutral300:"var(--neutral-300)",neutral150:"var(--neutral-150)",neutral100:"var(--neutral-100)",beige:"var(--surface-warm-40)",shadowCard:"var(--shadow-card)",railCompliance:"var(--rail-compliance)",accentYellow:"var(--accent-yellow)"},te="var(--font-sans, 'Averta', ui-sans-serif, system-ui, sans-serif)",z="var(--font-sans, 'Averta', ui-sans-serif, system-ui, sans-serif)";function st({direction:t="up",color:n=s.muted}){const i="M12.4167 0.75H17.4167M17.4167 0.75V5.75M17.4167 0.75L10.3333 7.83333L6.16667 3.66667L0.75 9.08333",r="M12.4167 9.25H17.4167M17.4167 9.25V4.25M17.4167 9.25L10.3333 2.16667L6.16667 6.33333L0.75 0.91667";return e.jsx("svg",{width:18,height:9.5,viewBox:"0 0 19 10",fill:"none",style:{flexShrink:0},children:e.jsx("path",{d:t==="up"?i:r,stroke:n,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function _e(t){if(!t)return"";const n={month:"2-digit",day:"2-digit",year:"numeric"};if(t instanceof Date)return Number.isNaN(t.getTime())?"":t.toLocaleDateString("en-US",n);const i=String(t).trim(),r=i.match(/^(\d{4})-(\d{1,2})-(\d{1,2})/);if(r)return new Date(Number(r[1]),Number(r[2])-1,Number(r[3])).toLocaleDateString("en-US",n);const o=new Date(i);return Number.isNaN(o.getTime())?i:o.toLocaleDateString("en-US",n)}function gt({trend:t="up",points:n,empty:i=!1,width:r=49.618,height:o=35}){const a=w.useId();if(i)return e.jsx("svg",{width:r,height:o,viewBox:"0 0 52 36",fill:"none",style:{flexShrink:0},children:e.jsx("path",{d:"M2,18 L50,18",stroke:s.ink,strokeWidth:"2",strokeLinecap:"round"})});const d=$e(n),c=d?d.line:nt,F=d?d.area:it;return e.jsxs("svg",{width:r,height:o,viewBox:"0 0 52 36",fill:"none",style:{flexShrink:0,transform:!d&&t==="down"?"scaleX(-1)":void 0},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:`spark-${a}`,x1:"9.96776",y1:"16.2053",x2:"9.96776",y2:"36.0002",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:s.ink}),e.jsx("stop",{offset:"1",stopColor:s.white,stopOpacity:"0.01"})]})}),e.jsx("path",{d:F,fill:`url(#spark-${a})`,fillRule:"evenodd",clipRule:"evenodd",opacity:"0.1"}),e.jsx("path",{d:c,stroke:s.ink,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:!d&&t==="down"?"2 4":void 0})]})}function bt({value:t,label:n,sub:i,trend:r="up",points:o}){const a=Ie(t),d=ye(t)||ke(o)!=null,c=rt(r,t,o);return e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:16,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,flexShrink:0,alignItems:"flex-end"},children:[e.jsx(gt,{trend:c,points:o,empty:!d}),d?e.jsx(st,{direction:c}):null]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[e.jsx("div",{style:{fontFamily:te,fontSize:28,fontWeight:400,lineHeight:"1.2",color:s.muted,letterSpacing:"-0.01em",whiteSpace:"nowrap"},children:a}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx("span",{style:{fontFamily:z,fontSize:13,color:s.ink,lineHeight:"1.2"},children:n}),e.jsx("span",{style:{fontFamily:z,fontSize:13,color:s.neutral600,lineHeight:"1.2"},children:i})]})]})]})}function jt({label:t,active:n=!1,onClick:i}){return e.jsx("button",{type:"button",onClick:i,style:{height:32,minWidth:31,padding:"0 12px",borderRadius:10,border:n?"none":`1px solid ${s.borderSubtle}`,background:n?s.black:s.white,color:n?s.white:s.black,fontFamily:z,fontSize:14,cursor:"pointer"},children:t})}function ue({yLabels:t,xLabels:n=[],points:i,highlightIndex:r}){const[o,a]=w.useState(null),d=460,c=110,F=Array.isArray(i)&&i.length>0,p=w.useId(),y=6,b=Array.isArray(n)?n:[],v=b.length<=y?b:Array.from({length:y},(x,m)=>b[Math.round(m*(b.length-1)/(y-1))]),S=Math.max(2,v.length||y),W=Array.from({length:S},(x,m)=>m/(S-1)*d);if(!F)return e.jsxs("div",{style:{display:"flex",gap:8,height:133,width:"100%"},children:[e.jsx("div",{style:{width:24,flexShrink:0}}),e.jsx("div",{style:{flex:1,position:"relative",minWidth:0},children:e.jsx("svg",{width:"100%",height:c+14,viewBox:`0 0 ${d} ${c+14}`,preserveAspectRatio:"none",children:W.map((x,m)=>e.jsx("line",{x1:x,y1:"0",x2:x,y2:c,stroke:s.borderSubtle,strokeDasharray:"2 3",strokeWidth:"1",vectorEffect:"non-scaling-stroke"},`grid-${m}`))})})]});const D=Array.isArray(i[0])?i:i.map((x,m)=>[m,x]),Y=D.map(([,x])=>x),I=Math.min(...Y),E=Math.max(...Y),X=E===I?Math.max(Math.abs(E)*.1,1):(E-I)*.1,G=I-X,O=E+X,J=O-G||1,f=x=>(O-x)/J*c,j=D.map(([x,m])=>[x,f(m)]),C=t&&t.length?t:Array.from({length:5},(x,m)=>{const T=O-m/4*(O-G),P=Math.abs(T),$=P>=100?0:P>=10?1:2;return T.toFixed($)}),M=j[0][0],_=j[j.length-1][0]-M||1,ie=8,oe=Math.max(1,d-ie*2),q=x=>ie+(x-M)/_*oe,Z=x=>{const m=Number(x);if(!Number.isFinite(m))return String(x??"");const T=Math.abs(m),P=T>=100?0:T>=10?1:2;return m.toFixed(P)},Q=j.map(([x,m],T)=>`${T===0?"M":"L"}${q(x)},${m}`).join(" "),B=`${Q} L${q(j[j.length-1][0])},${c} L${q(j[0][0])},${c} Z`,ae=r??j.length-1;return e.jsxs("div",{style:{display:"flex",gap:8,height:133,width:"100%"},children:[e.jsx("div",{style:{display:"flex",flexDirection:"column",justifyContent:"space-between",padding:"14px 0",fontFamily:z,fontSize:10,color:s.neutral800,flexShrink:0},children:C.map(x=>e.jsx("span",{children:x},x))}),e.jsxs("div",{style:{flex:1,position:"relative",minWidth:0},children:[o&&e.jsxs("div",{style:{position:"absolute",left:`${o.xPct}%`,top:`${o.yPct}%`,transform:"translate(-50%, calc(-100% - 10px))",pointerEvents:"none",zIndex:2,background:s.black,color:s.white,borderRadius:6,minWidth:60,padding:"8px 10px",boxShadow:"0 6px 16px rgba(0,0,0,0.18)",fontFamily:z,fontSize:11,lineHeight:1.25,whiteSpace:"nowrap",textAlign:"left"},children:[e.jsx("div",{children:o.label}),e.jsx("div",{style:{fontWeight:600},children:o.value}),e.jsx("div",{style:{position:"absolute",left:"50%",bottom:-5,width:10,height:10,background:s.black,transform:"translateX(-50%) rotate(45deg)",borderRadius:2}})]}),e.jsxs("svg",{width:"100%",height:c+14,viewBox:`0 0 ${d} ${c+14}`,preserveAspectRatio:"none",onMouseLeave:()=>a(null),children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:`area-${p}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",style:{stopColor:s.black,stopOpacity:.08}}),e.jsx("stop",{offset:"100%",style:{stopColor:s.black,stopOpacity:0}})]})}),W.map((x,m)=>e.jsx("line",{x1:x,y1:"0",x2:x,y2:c,stroke:s.borderSubtle,strokeDasharray:"2 3",strokeWidth:"1",vectorEffect:"non-scaling-stroke"},`grid-${m}`)),e.jsx("path",{d:B,fill:`url(#area-${p})`}),e.jsx("path",{d:Q,stroke:s.black,strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"}),j.map(([x,m],T)=>{const P=T===ae;return e.jsx("circle",{cx:q(x),cy:m,r:P?4:3,fill:P?s.black:s.white,stroke:s.black,strokeWidth:"1.5",vectorEffect:"non-scaling-stroke",onMouseEnter:()=>{var $;a({xPct:q(x)/d*100,yPct:m/(c+28)*100,label:b[T]||`Point ${T+1}`,value:Z(($=D[T])==null?void 0:$[1])})}},T)})]}),e.jsx("div",{style:{display:"flex",justifyContent:"space-between",paddingRight:6,fontFamily:z,fontSize:10,color:s.neutral800,marginTop:8,marginBottom:4,overflow:"hidden"},children:v.map((x,m)=>e.jsx("span",{style:{whiteSpace:"nowrap"},children:x},m))})]})]})}function xe({title:t,value:n,delta:i,children:r}){const o=Ie(n),a=ye(i),d=a?De("up",i):"up";return e.jsxs("div",{style:{flex:1,background:s.white,border:`1px solid ${s.border}`,borderRadius:8,padding:24,display:"flex",flexDirection:"column",gap:24,minWidth:0,boxShadow:s.shadowCard},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-end"},children:[e.jsx("span",{style:{fontFamily:te,fontWeight:600,fontSize:15,color:s.ink,lineHeight:1.2},children:t}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"flex-end",gap:4,fontFamily:te,fontWeight:600},children:[e.jsx("span",{style:{fontSize:20,color:s.black,lineHeight:1},children:o}),a?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3,fontSize:10,color:s.neutral300,lineHeight:1},children:[e.jsx(st,{direction:d,color:s.neutral300}),i]}):null]})]}),e.jsx("div",{style:{flex:1},children:r})]})}function Te({icon:t,title:n,trailing:i,iconColor:r=s.ink,bordered:o=!1}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,width:"100%",paddingBottom:o?12:0,borderBottom:o?`1px solid ${s.border}`:"none"},children:[e.jsx("div",{style:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(t,{size:22,strokeWidth:1.75,style:{color:r}})}),e.jsx("div",{style:{flex:1,fontFamily:te,fontWeight:600,fontSize:16,color:s.ink,lineHeight:1.2,textTransform:"uppercase",letterSpacing:"0.02em"},children:n}),i&&e.jsx("div",{style:{fontFamily:z,fontSize:14,color:s.ink},children:i})]})}function vt({text:t,bullet:n,citation:i,date:r,href:o}){const a=t??n??"";return e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",fontFamily:z,fontSize:14,color:s.ink,lineHeight:"24px",gap:16},children:[o?e.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",style:{color:s.ink,textDecoration:"underline",textUnderlineOffset:2,textDecorationColor:s.border,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a}):e.jsx("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a}),e.jsxs("span",{style:{display:"inline-flex",gap:4,whiteSpace:"nowrap"},children:[e.jsx("span",{style:{color:s.ink},children:i}),r?e.jsxs("span",{style:{color:s.muted},children:["(",r,")"]}):null]})]})}function Be({title:t,summary:n,calls:i,percent:r,delta:o,bullets:a,defaultExpanded:d=!1}){const[c,F]=w.useState(d),p=r??o,y=ye(p),b=y?String(p):Ae,S=(y?De("up",b):"up")==="down"?h.TrendingDown:h.TrendingUp,W=Array.isArray(a)?a:[];return e.jsxs("div",{style:{borderTop:`1px solid ${s.border}`},children:[e.jsxs("button",{type:"button",onClick:()=>F(D=>!D),"aria-expanded":c,style:{border:"none",background:"transparent",padding:16,display:"flex",gap:12,alignItems:"flex-start",cursor:"pointer",width:"100%",textAlign:"left",fontFamily:z},children:[e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:12,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[e.jsx("span",{style:{fontFamily:z,fontWeight:500,fontSize:14,color:s.black,lineHeight:"24px"},children:t}),e.jsx("span",{style:{fontFamily:z,fontSize:14,color:s.muted,lineHeight:"24px"},children:n})]}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx(h.Phone,{size:12,color:s.ink,strokeWidth:1.75}),e.jsxs("span",{style:{fontFamily:z,fontSize:12,color:s.ink},children:[i," calls"]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[y?e.jsx(S,{size:12,color:s.ink,strokeWidth:1.75}):null,e.jsx("span",{style:{fontFamily:z,fontSize:12,color:y?s.ink:s.muted},children:b})]})]})]}),e.jsx(h.ChevronDown,{size:20,color:s.ink,strokeWidth:2,style:{flexShrink:0,transform:c?"rotate(180deg)":"none",transition:"transform 150ms ease"}})]}),c&&W.length>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"0 16px 16px"},children:W.map((D,Y)=>e.jsx(vt,{...D},Y))})]})}function Ue({label:t,value:n}){return e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 8px 12px",borderBottom:`1px solid ${s.border}`,fontFamily:z,fontSize:13,lineHeight:"1.2"},children:[e.jsx("span",{style:{color:s.ink},children:t}),e.jsx("span",{style:{color:s.muted},children:n})]})}function kt({value:t=0,max:n=5}){const i=typeof t=="number"?t:parseFloat(t)||0,r=Math.floor(i),o=i%1>0&&r<n;return e.jsx("div",{style:{display:"flex",gap:4},children:Array.from({length:n}).map((a,d)=>d<r?e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",background:s.black,display:"inline-block"}},d):d===r&&o?e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center"},children:e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:s.black,display:"inline-block"}})},d):e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",background:s.white,border:`1px solid ${s.border}`,display:"inline-block",boxSizing:"border-box"}},d))})}const wt=[{id:"title",label:"Title",width:220,sortable:!0,filterable:!0},{id:"date",label:"Date",width:170,sortable:!0},{id:"duration",label:"Duration",width:170,sortable:!0},{id:"lift",label:"Lift",width:120,sortable:!0},{id:"compass",label:"Compass Score",width:220,sortable:!0,render:t=>{const n=typeof t=="number"?t:parseFloat(t)||0;return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{minWidth:32},children:t}),e.jsx(kt,{value:n})]})}}];function Ye({icon:t,title:n}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,width:"100%"},children:[e.jsx("div",{style:{width:34,height:34,borderRadius:9999,background:s.iconCircle,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(t,{size:20,color:s.ink,strokeWidth:1.75})}),e.jsx("span",{style:{fontFamily:te,fontWeight:600,fontSize:16,color:s.ink,lineHeight:1.2},children:n})]})}function ot({agentName:t="",startDate:n="",endDate:i="",totalCalls:r="",onBack:o,className:a="",kpiBaseline:d={value:"",label:"",sub:"",trend:"up"},kpiAgentLift:c={value:"",label:"",sub:"",trend:"down"},kpiScore:F={value:"",label:"",sub:"",trend:"up"},baselineChart:p={value:"",delta:""},agentLiftChart:y={value:"",delta:""},scoreChart:b={value:"",delta:""},csatChart:v={value:"",delta:""},volumeChart:S={value:"",delta:""},guidanceItems:W=[],strengthItems:D=[],callDrivers:Y=[],callParadigms:I=[],strengthsTitle:E="",guidanceTitle:X="",callMixTitle:G="",driversTitle:O="",paradigmsTitle:J="",sessionsTitle:f="",baselineChartTitle:j="",agentLiftChartTitle:C="",scoreChartTitle:M="",csatChartTitle:K="",volumeChartTitle:_="",sessions:ie=[],sessionColumns:oe=[],initialPageSize:q=10,selectedWindow:Z="30d",onWindowChange:Q,dateRange:B,onDateRangeChange:ae,sessionsTotal:x=null,sessionsPage:m=null,sessionsPageSize:T=null,onSessionsPageChange:P,onSessionsPageSizeChange:$,onExport:A,onSessionClick:Le,onSessionsVisibleColumnsChange:le}){const re=!!(B!=null&&B.from&&(B!=null&&B.to)),H=(()=>{if(re||Z!=="8h")return null;const g=je("8h");return g?et(g.from,g.to):null})(),V=(()=>{if(re||Z==="8h")return null;const g=je(Z);return g?{from:ee(g.from),to:ee(g.to)}:null})(),de=U(p)||U(y)||U(b),Fe=U(v)||U(S);return e.jsxs("div",{className:a,style:{background:s.white,fontFamily:z,color:s.ink,width:"100%",minWidth:1192,boxSizing:"border-box",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"23px 32px",minHeight:78,boxSizing:"border-box"},children:[e.jsx("button",{type:"button","aria-label":"Back",onClick:o,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,background:"transparent",border:"none",cursor:"pointer",color:s.ink,padding:0,flexShrink:0},children:e.jsx(h.ArrowLeft,{size:20,strokeWidth:1.75})}),e.jsx("div",{style:{paddingLeft:16,borderLeft:`1px solid ${s.border}`,flex:1,minWidth:0,alignSelf:"stretch",display:"flex",alignItems:"center"},children:e.jsx("h1",{style:{fontFamily:te,fontSize:24,fontWeight:400,color:s.ink,margin:0,lineHeight:1,whiteSpace:"nowrap"},children:t})}),e.jsxs("button",{type:"button",onClick:()=>A==null?void 0:A(),disabled:!A,style:{display:"inline-flex",alignItems:"center",gap:8,height:32,padding:"0 16px",borderRadius:10,border:`1px solid ${s.neutralBorder}`,background:s.white,cursor:A?"pointer":"not-allowed",opacity:A?1:.5,fontFamily:z,fontSize:14,lineHeight:"24px",color:s.neutral800,flexShrink:0},children:[e.jsx(h.Download,{size:18,strokeWidth:1.75}),"Export CSV"]})]}),e.jsxs("div",{style:{padding:"0 32px 32px",display:"flex",flexDirection:"column",gap:16},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:16,paddingLeft:49},children:[e.jsxs("div",{style:{display:"flex",gap:16,alignItems:"center"},children:[e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(h.CalendarDays,{size:14,color:s.ink,strokeWidth:1.75,style:{flexShrink:0}}),e.jsx("span",{style:{fontFamily:z,fontSize:12,color:s.ink,lineHeight:1.5},children:(H==null?void 0:H.from)??(V==null?void 0:V.from)??_e(n)}),e.jsx(h.ArrowRight,{size:12,color:s.ink,strokeWidth:1.75,style:{flexShrink:0}}),e.jsx("span",{style:{fontFamily:z,fontSize:12,color:s.ink,lineHeight:1.5},children:(H==null?void 0:H.to)??(V==null?void 0:V.to)??_e(i)})]}),e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(h.Phone,{size:14,color:s.ink,strokeWidth:1.75,style:{flexShrink:0}}),e.jsx("span",{style:{fontFamily:z,fontSize:12,color:s.ink,lineHeight:1.5},children:r})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[[{id:"8h",label:"8h"},{id:"1d",label:"1d"},{id:"7d",label:"7d"},{id:"30d",label:"30d"}].map(g=>e.jsx(jt,{label:g.label,active:!re&&g.id===Z,onClick:()=>Q==null?void 0:Q(g.id)},g.id)),e.jsx(Me,{value:B,onChange:ae})]})]}),e.jsx("div",{style:{background:s.beige,border:`1px solid ${s.border}`,borderRadius:8,padding:16,display:"flex",alignItems:"center"},children:[{key:"baseline",kpi:d},{key:"agent-lift",kpi:c},{key:"score",kpi:F}].map((g,N)=>e.jsxs(w.Fragment,{children:[N>0?e.jsx(h.ArrowRight,{size:20,color:s.ink,strokeWidth:1.75,style:{flexShrink:0,margin:"0 24px"}}):null,e.jsx("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center",minWidth:0},children:e.jsx(bt,{value:g.kpi.value,label:g.kpi.label,sub:g.kpi.sub,trend:g.kpi.trend,points:g.kpi.points})})]},g.key))}),de&&e.jsxs("div",{style:{display:"flex",gap:24},children:[U(p)&&e.jsx(xe,{title:j,value:p.value,delta:p.delta,children:e.jsx(ue,{yLabels:p.yLabels,xLabels:p.xLabels,points:p.points})}),U(y)&&e.jsx(xe,{title:C,value:y.value,delta:y.delta,children:e.jsx(ue,{yLabels:y.yLabels,xLabels:y.xLabels,points:y.points})}),U(b)&&e.jsx(xe,{title:M,value:b.value,delta:b.delta,children:e.jsx(ue,{yLabels:b.yLabels,xLabels:b.xLabels,points:b.points})})]}),Fe&&e.jsxs("div",{style:{display:"flex",gap:24},children:[U(v)&&e.jsx(xe,{title:K,value:v.value,delta:v.delta,children:e.jsx(ue,{yLabels:v.yLabels,xLabels:v.xLabels,points:v.points})}),U(S)&&e.jsx(xe,{title:_,value:S.value,delta:S.delta,children:e.jsx(ue,{yLabels:S.yLabels,xLabels:S.xLabels,points:S.points})})]}),e.jsxs("div",{style:{display:"flex",gap:24,marginTop:8,alignItems:"flex-start"},children:[e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:16,minWidth:0},children:[e.jsx(Te,{icon:h.ShieldCheck,title:E,iconColor:s.railCompliance}),e.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},children:D.map((g,N)=>e.jsx(Be,{...g},N))})]}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:16,minWidth:0},children:[e.jsx(Te,{icon:h.Lightbulb,title:X,iconColor:s.railCompliance}),e.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},children:W.map((g,N)=>e.jsx(Be,{...g},N))})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,marginTop:8},children:[e.jsx(Te,{icon:h.Phone,title:G,iconColor:s.railCompliance}),e.jsxs("div",{style:{display:"flex",gap:24,alignItems:"flex-start"},children:[e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:8,minWidth:0},children:[e.jsx(Ye,{icon:h.FolderKanban,title:O}),e.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},children:Y.map((g,N)=>e.jsx(Ue,{...g},N))})]}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:8,minWidth:0},children:[e.jsx(Ye,{icon:h.Layers,title:J}),e.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},children:I.map((g,N)=>e.jsx(Ue,{...g},N))})]})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,marginTop:8},children:[f&&e.jsx("span",{style:{fontFamily:te,fontWeight:600,fontSize:16,color:s.ink,lineHeight:1.2},children:f}),e.jsx(qe.DataTable2,{data:ie,columns:oe,initialPageSize:q,totalCount:x,page:m,pageSize:T,onPageChange:P,onPageSizeChange:$,onRowClick:Le,onVisibleColumnsChange:le})]})]})]})}const fe={value:"",label:"",trend:"up"},l={ink:"var(--color-text)",muted:"var(--color-text-secondary)",border:"var(--grey-absent)",borderSubtle:"var(--neutral-100)",iconCircle:"var(--surface-hover)",black:"var(--neutral-900)",white:"var(--grey-white)",green:"var(--color-green)",red:"var(--color-red-strong)",neutralBorder:"var(--neutral-250)",neutralLight:"var(--neutral-100)",beige:"var(--surface-warm-40)",neutral800:"var(--neutral-800)",textInk:"var(--text-ink)",textFaintGrey:"var(--text-faint-grey)",hoverWarm40:"var(--hover-warm-40)",shadowPopover:"var(--shadow-popover)",shadowDropdown:"var(--shadow-dropdown)",railCompliance:"var(--rail-compliance)"},ne="var(--font-sans, 'Averta', ui-sans-serif, system-ui, sans-serif)",L="var(--font-sans, 'Averta', ui-sans-serif, system-ui, sans-serif)";function at({trend:t="up",points:n,width:i=49.618,height:r=35}){const o=w.useId(),a=$e(n),d=a?a.line:nt,c=a?a.area:it,F=we(n)??t;return e.jsxs("svg",{width:i,height:r,viewBox:"0 0 52 36",fill:"none",style:{flexShrink:0,transform:!a&&F==="down"?"scaleX(-1)":void 0},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:`spark-${o}`,x1:"9.96776",y1:"16.2053",x2:"9.96776",y2:"36.0002",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:l.ink}),e.jsx("stop",{offset:"1",stopColor:l.white,stopOpacity:"0.01"})]})}),e.jsx("path",{d:c,fill:`url(#spark-${o})`,fillRule:"evenodd",clipRule:"evenodd",opacity:"0.1"}),e.jsx("path",{d,stroke:l.ink,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:!a&&F==="down"?"2 4":void 0})]})}function dt(t,n){return we(n)??(t==="down"?"down":"up")}function ct({direction:t="up",color:n=l.muted}){const i="M12.4167 0.75H17.4167M17.4167 0.75V5.75M17.4167 0.75L10.3333 7.83333L6.16667 3.66667L0.75 9.08333",r="M12.4167 9.25H17.4167M17.4167 9.25V4.25M17.4167 9.25L10.3333 2.16667L6.16667 6.33333L0.75 0.91667";return e.jsx("svg",{width:18,height:9.5,viewBox:"0 0 19 10",fill:"none",style:{flexShrink:0},children:e.jsx("path",{d:t==="up"?i:r,stroke:n,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ve({value:t,label:n,trend:i="up",points:r,muted:o=!1,beigeBg:a=!1,style:d={}}){const c=dt(i,r);return e.jsxs("div",{style:{background:a?l.beige:l.white,border:`1px solid ${l.border}`,borderRadius:8,padding:16,display:"flex",flexDirection:"column",gap:8,boxSizing:"border-box",...d},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[e.jsx(at,{trend:c,points:r}),e.jsx(ct,{direction:c})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,marginTop:8},children:[e.jsx("div",{style:{fontFamily:ne,fontSize:28,fontWeight:500,lineHeight:"1.2",color:o?l.muted:l.ink,letterSpacing:"-0.01em"},children:t}),e.jsx("div",{style:{fontFamily:L,fontSize:13,color:l.ink,lineHeight:"1.2"},children:n})]})]})}function We({value:t,label:n,trend:i="up",points:r,withDivider:o=!1}){const a=dt(i,r);return e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:8,paddingLeft:o?24:0,borderLeft:o?`1px solid ${l.border}`:"none",minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[e.jsx(at,{trend:a,points:r}),e.jsx(ct,{direction:a})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,marginTop:8},children:[e.jsx("div",{style:{fontFamily:ne,fontSize:28,fontWeight:500,lineHeight:"1.2",color:l.muted,letterSpacing:"-0.01em"},children:t}),e.jsx("div",{style:{fontFamily:L,fontSize:13,color:l.ink,lineHeight:"1.2"},children:n})]})]})}function St({icon:t,children:n,trailing:i}){return e.jsxs("button",{type:"button",style:{display:"inline-flex",alignItems:"center",gap:8,height:32,padding:"0 16px",borderRadius:10,border:`1px solid ${l.neutralBorder}`,background:l.white,cursor:"pointer",fontFamily:L,fontSize:14,color:l.neutral800,whiteSpace:"nowrap"},children:[t&&e.jsx(t,{size:18,strokeWidth:1.75}),n,i&&e.jsx(i,{size:16,strokeWidth:2})]})}const Dt=["January","February","March","April","May","June","July","August","September","October","November","December"],Lt=["Su","Mo","Tu","We","Th","Fr","Sa"];function me(t){const n=new Date(t);return n.setHours(0,0,0,0),n}function Ft(t,n){const r=new Date(t,n,1).getDay(),o=new Date(t,n,1-r);return Array.from({length:42},(a,d)=>{const c=new Date(o);return c.setDate(o.getDate()+d),c})}function zt({value:t,onApply:n,onClose:i,anchorRef:r}){const o=w.useRef(null),[a,d]=w.useState(t!=null&&t.from?me(t.from):null),[c,F]=w.useState(t!=null&&t.to?me(t.to):null),p=a||new Date,[y,b]=w.useState(p.getFullYear()),[v,S]=w.useState(p.getMonth()),[W,D]=w.useState({top:0,left:0});w.useLayoutEffect(()=>{const f=()=>{if(!(r!=null&&r.current))return;const j=r.current.getBoundingClientRect(),C=320;D({top:j.bottom+6,left:Math.max(8,j.right-C)})};return f(),window.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[r]),w.useEffect(()=>{const f=C=>{var M,K;(M=o.current)!=null&&M.contains(C.target)||(K=r==null?void 0:r.current)!=null&&K.contains(C.target)||i()},j=C=>{C.key==="Escape"&&i()};return document.addEventListener("mousedown",f),document.addEventListener("keydown",j),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",j)}},[i,r]);const Y=Ft(y,v),I=me(new Date),E=f=>{const j=me(f);j>I||(!a||a&&c?(d(j),F(null)):j<a?d(j):F(j))},X=()=>{v===0?(S(11),b(y-1)):S(v-1)},G=()=>{v===11?(S(0),b(y+1)):S(v+1)},O=f=>a&&c&&f>=a&&f<=c,J=f=>a&&f.getTime()===a.getTime()||c&&f.getTime()===c.getTime();return ht.createPortal(e.jsxs("div",{ref:o,style:{position:"fixed",top:W.top,left:W.left,width:320,background:l.white,border:`1px solid ${l.borderSubtle}`,borderRadius:12,boxShadow:l.shadowPopover,padding:16,zIndex:9999,fontFamily:L},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[e.jsx("button",{type:"button",onClick:X,style:Xe,"aria-label":"Previous month",children:e.jsx(h.ChevronLeft,{size:18,strokeWidth:1.75})}),e.jsxs("div",{style:{fontSize:14,fontWeight:600,color:l.ink},children:[Dt[v]," ",y]}),e.jsx("button",{type:"button",onClick:G,style:Xe,"aria-label":"Next month",children:e.jsx(h.ChevronRight,{size:18,strokeWidth:1.75})})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:2,marginBottom:4},children:Lt.map(f=>e.jsx("div",{style:{textAlign:"center",fontSize:12,color:l.muted,padding:"4px 0"},children:f},f))}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:2},children:Y.map(f=>{const j=f.getMonth()===v,C=O(f),M=J(f),K=f.getTime()===I.getTime(),_=f>I;return e.jsx("button",{type:"button",onClick:()=>E(f),disabled:_,"aria-disabled":_,style:{height:36,border:"none",borderRadius:8,background:M?l.black:C?l.hoverWarm40:"transparent",color:M?l.white:_?l.textFaintGrey:j?l.ink:l.muted,fontFamily:L,fontSize:13,fontWeight:K?500:400,cursor:_?"not-allowed":"pointer",opacity:_?.6:1},children:f.getDate()},f.toISOString())})}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:12,paddingTop:12,borderTop:`1px solid ${l.borderSubtle}`},children:[e.jsx("button",{type:"button",onClick:()=>{d(null),F(null)},style:{background:"transparent",border:"none",padding:0,cursor:"pointer",fontSize:14,fontWeight:500,color:l.ink},children:"Clear"}),e.jsx("button",{type:"button",disabled:!a||!c,onClick:()=>{n({from:a,to:c}),i()},style:{background:!a||!c?l.neutralBorder:l.black,color:l.white,border:"none",borderRadius:10,height:30,padding:"0 16px",fontFamily:L,fontSize:14,fontWeight:600,cursor:!a||!c?"not-allowed":"pointer"},children:"Apply"})]})]}),document.body)}const Xe={display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,border:"none",background:"transparent",borderRadius:6,cursor:"pointer",color:l.ink};function Me({value:t,onChange:n}){const[i,r]=w.useState(!1),o=w.useRef(null),a=!!(t!=null&&t.from&&(t!=null&&t.to));return e.jsxs(e.Fragment,{children:[e.jsxs("button",{ref:o,type:"button",onClick:()=>r(d=>!d),style:{display:"inline-flex",alignItems:"center",gap:8,height:32,padding:"0 16px",borderRadius:10,border:a?"none":`1px solid ${l.neutralBorder}`,background:a?l.black:l.white,cursor:"pointer",fontFamily:L,fontSize:14,color:a?l.white:l.neutral800,fontWeight:a?600:400,whiteSpace:"nowrap"},children:[e.jsx(h.CalendarDays,{size:18,strokeWidth:1.75}),"Date Range"]}),i&&e.jsx(zt,{value:t,anchorRef:o,onClose:()=>r(!1),onApply:d=>n==null?void 0:n(d)})]})}function Tt({label:t,active:n=!1,onClick:i}){return e.jsx("button",{type:"button",onClick:i,style:{height:32,minWidth:31,padding:"0 12px",borderRadius:10,border:n?"none":`1px solid ${l.borderSubtle}`,background:n?l.black:l.white,color:n?l.white:l.black,fontFamily:L,fontSize:14,cursor:"pointer"},children:t})}const Wt=[{id:"8h",label:"8h"},{id:"1d",label:"1d"},{id:"7d",label:"7d"},{id:"30d",label:"30d"}];function Ct({value:t=0,max:n=5}){const i=typeof t=="number"?t:parseFloat(t)||0,r=Math.floor(i),o=i%1>0&&r<n;return e.jsx("div",{style:{display:"flex",gap:4},children:Array.from({length:n}).map((a,d)=>d<r?e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",background:l.black,display:"inline-block"}},d):d===r&&o?e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center"},children:e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:l.black,display:"inline-block"}})},d):e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",background:l.white,border:`1px solid ${l.border}`,display:"inline-block",boxSizing:"border-box"}},d))})}const $t=[{id:"agent",label:"Agent",width:180,sortable:!0,filterable:!0},{id:"supervisor",label:"Supervisor",width:170,sortable:!0,filterable:!0},{id:"calls",label:"Calls",width:100,sortable:!0},{id:"baseline",label:"Baseline",width:110,sortable:!0},{id:"lift",label:"Lift",width:100,sortable:!0},{id:"score",label:"Score",width:100,sortable:!0,filterable:!0,filterType:"number"},{id:"compass",label:"Compass Score",width:200,sortable:!0,filterable:!0,filterType:"number",render:t=>e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{minWidth:32},children:t}),e.jsx(Ct,{value:typeof t=="number"?t:0})]})},{id:"totalDuration",label:"Total Duration",width:150,sortable:!0,filterable:!0,filterType:"duration",filterShowPresets:!1},{id:"avgDuration",label:"Average Duration",width:170,sortable:!0,filterable:!0,filterType:"duration",filterShowPresets:!1}];function ge({icon:t,title:n,trailing:i,iconColor:r=l.ink,bordered:o=!1}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,width:"100%",paddingBottom:o?12:0,borderBottom:o?`1px solid ${l.border}`:"none"},children:[e.jsx("div",{style:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(t,{size:22,strokeWidth:1.75,style:{color:r}})}),e.jsx("div",{style:{flex:1,fontFamily:ne,fontWeight:600,fontSize:16,color:l.ink,lineHeight:"1.2",textTransform:"uppercase",letterSpacing:"0.02em"},children:n}),i&&e.jsx("div",{style:{fontFamily:L,fontSize:14,color:l.ink},children:i})]})}function Ge({icon:t,title:n}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,width:"100%"},children:[e.jsx("div",{style:{width:34,height:34,borderRadius:9999,background:l.iconCircle,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(t,{size:20,color:l.ink,strokeWidth:1.75})}),e.jsx("span",{style:{fontFamily:ne,fontWeight:600,fontSize:16,color:l.ink,lineHeight:"24px"},children:n})]})}function Ke({title:t,summary:n,calls:i,percent:r,bullets:o,defaultExpanded:a=!1}){const[d,c]=w.useState(a),F=Array.isArray(o)?o:[];return e.jsxs("div",{style:{borderTop:`1px solid ${l.border}`},children:[e.jsxs("button",{type:"button",onClick:()=>c(p=>!p),"aria-expanded":d,style:{border:"none",background:"transparent",padding:16,display:"flex",gap:12,alignItems:"flex-start",cursor:"pointer",width:"100%",textAlign:"left",fontFamily:L},children:[e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:12,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[e.jsx("div",{style:{fontFamily:ne,fontWeight:600,fontSize:14,color:l.black,lineHeight:"24px"},children:t}),e.jsx("div",{style:{fontFamily:L,fontSize:14,color:l.muted,lineHeight:"24px"},children:n})]}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx(h.Phone,{size:14,color:l.ink,strokeWidth:1.75}),e.jsx("span",{style:{fontFamily:L,fontSize:12,color:l.ink,lineHeight:1.5},children:i})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx(h.TrendingUp,{size:14,color:l.ink,strokeWidth:1.75}),e.jsx("span",{style:{fontFamily:L,fontSize:12,color:l.ink,lineHeight:1.5},children:r})]})]})]}),e.jsx(h.ChevronDown,{size:20,color:l.ink,strokeWidth:2,style:{flexShrink:0,transform:d?"rotate(180deg)":"none",transition:"transform 150ms ease"}})]}),d&&F.length>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"0 16px 16px"},children:F.map((p,y)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",fontFamily:L,fontSize:14,color:l.ink,lineHeight:"24px",gap:16},children:[p.href?e.jsx("a",{href:p.href,target:"_blank",rel:"noopener noreferrer",style:{color:l.ink,textDecoration:"underline",textUnderlineOffset:2,textDecorationColor:l.border,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p.text}):e.jsx("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p.text}),e.jsxs("span",{style:{display:"inline-flex",gap:4,whiteSpace:"nowrap"},children:[e.jsx("span",{style:{color:l.ink},children:p.citation}),e.jsxs("span",{style:{color:l.muted},children:["(",p.date,")"]})]})]},y))})]})}function be({label:t,value:n}){return e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px 0",borderBottom:`1px solid ${l.border}`,fontFamily:L,fontSize:13,lineHeight:"24px"},children:[e.jsx("span",{style:{color:l.ink},children:t}),e.jsx("span",{style:{color:l.muted},children:n})]})}function pe({message:t=""}){return t?e.jsx("div",{style:{padding:"16px 0",fontFamily:L,fontSize:13,color:l.muted,lineHeight:1.5},children:t}):null}function At({className:t="",onAgentClick:n,title:i="",subtitle:r="",dateRangeLabel:o="",viewByOptions:a=[],initialViewBy:d="",onViewByChange:c,aggregatedByLabel:F="",volumeStat:p=fe,compassStat:y=fe,baselineSubStat:b=fe,agentLiftSubStat:v=fe,scoreSubStat:S=fe,agentRows:W=[],agentColumns:D=[],initialPageSize:Y=10,guidanceItems:I=[],strengthItems:E=[],callDrivers:X=[],callParadigms:G=[],topSignalsLeft:O=[],topSignalsRight:J=[],topSignalsTrailing:f="",strengthsTitle:j="",guidanceTitle:C="",callMixTitle:M="",driversTitle:K="",paradigmsTitle:_="",topSignalsTitle:ie="",emptyStrengthsMessage:oe="",emptyGuidanceMessage:q="",emptyDriversMessage:Z="",emptyParadigmsMessage:Q="",emptyTopSignalsMessage:B="",rangeOptions:ae=Wt,selectedWindow:x="30d",onWindowChange:m,dateRangePicker:T,dateRange:P,onDateRangeChange:$,onExport:A,onVisibleColumnsChange:Le}){var Ne,Re;const[le,re]=w.useState(null),[H,V]=w.useState(!1),[de,Fe]=w.useState(d),[g,N]=w.useState(null),R=P!==void 0?P:g,ze=!!(R!=null&&R.from&&(R!=null&&R.to)),ut=u=>{N(u),$==null||$(u)},xt=u=>{N(null),$==null||$(null),m==null||m(u)},Pe=w.useRef(null),He=w.useRef(null);w.useEffect(()=>{if(!H)return;const u=k=>{var ce,Ee;(ce=He.current)!=null&&ce.contains(k.target)||(Ee=Pe.current)!=null&&Ee.contains(k.target)||V(!1)};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[H]);const ft=((Ne=a.find(u=>u.id===de))==null?void 0:Ne.label)||(((Re=a[0])==null?void 0:Re.label)??""),pt=u=>{if(n){n(u);return}re(u)};return e.jsxs(e.Fragment,{children:[le&&(()=>{let u=null,k=null;if(ze)u=R.from,k=R.to;else{const ce=ve[x];ce&&(k=new Date,u=new Date(k.getTime()-ce))}return e.jsx(ot,{className:t,agentName:le.agent,startDate:u||"",endDate:k||"",totalCalls:`${le.calls} Calls`,onBack:()=>re(null),selectedWindow:x,dateRange:R})})(),e.jsxs("div",{className:t,style:{background:l.white,fontFamily:L,color:l.ink,width:"100%",minWidth:1192,boxSizing:"border-box",padding:"12px 32px 32px",flexDirection:"column",gap:24,display:le?"none":"flex"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8,paddingTop:12},children:[e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:4},children:[e.jsx("h1",{style:{fontFamily:ne,fontSize:24,fontWeight:500,color:l.ink,margin:0,lineHeight:"1.2",letterSpacing:"-0.01em"},children:i}),e.jsx("p",{style:{fontFamily:L,fontSize:14,color:"var(--neutral-950)",margin:0,lineHeight:"1.4"},children:r})]}),e.jsxs("button",{type:"button",onClick:()=>A==null?void 0:A(),disabled:!A,style:{display:"inline-flex",alignItems:"center",gap:8,height:32,padding:"0 16px",borderRadius:10,border:`1px solid ${l.neutralBorder}`,background:l.white,cursor:A?"pointer":"not-allowed",opacity:A?1:.5,fontFamily:L,fontSize:14,color:l.neutral800},children:[e.jsx(h.Download,{size:18,strokeWidth:1.75}),"Export CSV"]})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("button",{type:"button",ref:Pe,onClick:()=>V(u=>!u),"aria-haspopup":"listbox","aria-expanded":H,style:{display:"inline-flex",alignItems:"center",gap:8,height:32,padding:"0 16px",borderRadius:10,border:`1px solid ${l.neutralBorder}`,background:l.white,cursor:"pointer",fontFamily:L,fontSize:14,lineHeight:"24px",color:l.neutral800,whiteSpace:"nowrap"},children:[ft,e.jsx(h.ChevronDown,{size:20,strokeWidth:1.75,style:{transform:H?"rotate(180deg)":"none",transition:"transform 120ms ease"}})]}),H&&e.jsxs("div",{ref:He,role:"listbox",style:{position:"absolute",top:36,left:0,zIndex:20,background:l.white,border:`1px solid ${l.border}`,borderRadius:4,boxShadow:l.shadowDropdown,display:"flex",flexDirection:"column",minWidth:144,fontFamily:L},children:[F&&e.jsx("div",{style:{padding:12,fontFamily:ne,fontWeight:600,fontSize:13,color:l.ink,lineHeight:1.2},children:F}),a.map(u=>{const k=de===u.id;return e.jsxs("button",{type:"button",role:"option","aria-selected":k,onClick:()=>{u.id!==de&&(Fe(u.id),c==null||c(u.id)),V(!1)},style:{display:"flex",alignItems:"center",gap:8,padding:k?12:"12px 12px 12px 40px",borderTop:`1px solid ${l.border}`,borderLeft:"none",borderRight:"none",borderBottom:"none",background:"transparent",cursor:"pointer",textAlign:"left",fontFamily:L,fontSize:13,lineHeight:1.2,color:l.ink,width:"100%"},children:[k&&e.jsx(h.Check,{size:20,color:l.ink,strokeWidth:1.75,style:{flexShrink:0}}),e.jsx("span",{children:u.label})]},u.id)})]})]}),e.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[(()=>{const k=(ze?`${ee(R.from)} – ${ee(R.to)}`:"")||tt(x)||o;return k?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontFamily:L,fontSize:13,color:l.ink},children:[e.jsx(h.CalendarDays,{size:16,strokeWidth:1.75,color:l.muted}),k]}):null})(),ae.map(u=>e.jsx(Tt,{label:u.label,active:!ze&&u.id===x,onClick:()=>xt(u.id)},u.id)),T?e.jsx(w.Suspense,{fallback:e.jsx(St,{icon:h.CalendarDays,children:"Date Range"}),children:T}):e.jsx(Me,{value:R,onChange:ut})]})]}),e.jsxs("div",{style:{display:"flex",gap:24},children:[e.jsx(Ve,{value:p.value,label:p.label,trend:p.trend,points:p.points,style:{width:264,flexShrink:0}}),e.jsx(Ve,{value:y.value,label:y.label,trend:y.trend,points:y.points,style:{width:264,flexShrink:0}}),e.jsxs("div",{style:{flex:1,background:l.beige,border:`1px solid ${l.border}`,borderRadius:8,padding:16,display:"flex",gap:24,alignItems:"stretch",boxSizing:"border-box"},children:[e.jsx(We,{value:b.value,label:b.label,trend:b.trend,points:b.points}),e.jsx(We,{value:v.value,label:v.label,trend:v.trend,points:v.points,withDivider:!0}),e.jsx(We,{value:S.value,label:S.label,trend:S.trend,points:S.points,withDivider:!0})]})]}),e.jsx(qe.DataTable2,{data:W,columns:D,initialPageSize:Y,onRowClick:pt,onVisibleColumnsChange:Le}),e.jsxs("div",{style:{display:"flex",gap:24,alignItems:"flex-start"},children:[e.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:16},children:[e.jsx(ge,{icon:h.ShieldCheck,title:j,iconColor:"var(--rail-compliance)"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",borderBottom:`1px solid ${l.border}`,maxHeight:480,overflowY:"auto"},children:E.length===0?e.jsx(pe,{message:oe}):E.map((u,k)=>e.jsx(Ke,{...u},k))})]}),e.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:16},children:[e.jsx(ge,{icon:h.Lightbulb,title:C,iconColor:"var(--rail-compliance)"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",borderBottom:`1px solid ${l.border}`,maxHeight:480,overflowY:"auto"},children:I.length===0?e.jsx(pe,{message:q}):I.map((u,k)=>e.jsx(Ke,{...u},k))})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsx(ge,{icon:h.Phone,title:M,iconColor:"var(--rail-compliance)"}),e.jsxs("div",{style:{display:"flex",gap:24,alignItems:"flex-start"},children:[e.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:8},children:[e.jsx(Ge,{icon:h.FolderKanban,title:K}),e.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},children:X.length===0?e.jsx(pe,{message:Z}):X.map((u,k)=>e.jsx(be,{...u},k))})]}),e.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:8},children:[e.jsx(Ge,{icon:h.Layers,title:_}),e.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},children:G.length===0?e.jsx(pe,{message:Q}):G.map((u,k)=>e.jsx(be,{...u},k))})]})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsx(ge,{icon:h.Signal,title:ie,iconColor:"var(--rail-compliance)",trailing:f,bordered:!0}),O.length===0&&J.length===0?e.jsx(pe,{message:B}):e.jsxs("div",{style:{display:"flex",gap:24},children:[e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:O.map((u,k)=>e.jsx(be,{...u},k))}),e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:J.map((u,k)=>e.jsx(be,{...u},k))})]})]})]})]})}exports.DEFAULT_AGENT_COLUMNS=$t;exports.DEFAULT_SESSION_COLUMNS=wt;exports.DateRangeButton=Me;exports.METRIC_PLACEHOLDER=Ae;exports.PerformanceDetailsPage=ot;exports.PerformancePanel=At;exports.RANGE_TO_MS=ve;exports.buildSparkPaths=$e;exports.computeWindowLabel=tt;exports.formatEightHourRangeEndpoints=et;exports.formatEightHourWindowLabel=Qe;exports.formatLocalDate=ee;exports.formatMetricDisplay=Ie;exports.getPresetWindowDates=je;exports.hasChartData=U;exports.hasMeaningfulMetric=ye;exports.isNullishMetric=Se;exports.normalizeSparkPoints=ke;exports.resolveKpiTrend=rt;exports.resolveTrend=De;exports.trendFromPoints=we;exports.trendFromSignedValue=lt;
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),w=require("react"),xt=require("react-dom"),h=require("lucide-react"),Ge=require("./DataTable2.cjs.js"),ve={"8h":8*60*60*1e3,"1d":24*60*60*1e3,"7d":7*24*60*60*1e3,"30d":30*24*60*60*1e3},Ke=void 0,ut={month:"2-digit",day:"2-digit",year:"numeric"},ft={hour:"numeric",minute:"2-digit",hour12:!0};function he(t){if(!t)return null;if(t instanceof Date)return Number.isNaN(t.getTime())?null:t;const n=String(t).trim(),i=n.match(/^(\d{4})-(\d{1,2})-(\d{1,2})/);if(i){const a=new Date(Number(i[1]),Number(i[2])-1,Number(i[3]));return Number.isNaN(a.getTime())?null:a}const r=new Date(n);return Number.isNaN(r.getTime())?null:r}function qe(t,n){return t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()}function Q(t){const n=t instanceof Date?t:he(t);return n?n.toLocaleDateString(Ke,ut):""}function Te(t){return t.toLocaleTimeString(Ke,ft)}function se(t){return`${Q(t)} ${Te(t)}`}function Je(t,n){const i=he(t),r=he(n);return!i||!r?"":qe(i,r)?`${se(i)} – ${Te(r)}`:`${se(i)} – ${se(r)}`}function Ze(t,n){const i=he(t),r=he(n);return!i||!r?null:qe(i,r)?{from:se(i),to:Te(r)}:{from:se(i),to:se(r)}}function je(t){const n=ve[t];if(!n)return null;const i=new Date;return{from:new Date(i.getTime()-n),to:i}}function Qe(t){if(!ve[t])return"";const i=je(t);return i?t==="8h"?Je(i.from,i.to):`${Q(i.from)} – ${Q(i.to)}`:""}const pt="M1.00049 13.5213C7.85975 11.7032 8.88149 4.73912 13.7838 4.73912C19.8344 4.73912 23.6237 17.166 29.1281 17.166C34.5998 17.166 37.4149 4.88121 43.4004 8.61051C47.9764 11.4616 50.6186 1.00024 50.6186 1.00024",ht="M1.00049 16.692C8.88149 15.6975 8.88149 7.79403 13.7838 7.79403C19.8344 7.79403 23.6237 21.4034 29.1281 21.4034C34.5998 21.4034 37.4149 8.93821 43.4004 12.7223C47.9764 15.6152 50.6186 5.00024 50.6186 5.00024V36.0002C50.6186 36.0002 10.8223 36.0002 1.00049 36.0002C1.00049 28.8653 1.00049 19.4871 1.00049 16.692Z";function We(t){if(!Array.isArray(t))return null;const n=t.map(i=>Array.isArray(i)?Number(i[1]):i==null||i===""?NaN:Number(i)).filter(i=>Number.isFinite(i));return n.length>=2?n:null}function et(t,n=52,i=36){const r=We(t);if(!r)return null;const a=Math.min(...r),o=Math.max(...r),d=4,p=o-a||1,k=i-d*2-4,c=D=>(r.length===1?0:D/(r.length-1)*(n-2))+1,y=D=>d+(1-(D-a)/p)*k;let j="";for(let D=0;D<r.length;D++)j+=`${D===0?"M":"L"}${c(D).toFixed(2)},${y(r[D]).toFixed(2)}`;const g=c(r.length-1),m=c(0),$=`${j} L${g.toFixed(2)},${i} L${m.toFixed(2)},${i} Z`;return{line:j,area:$}}function ke(t){const n=We(t);if(!n)return null;const i=n[0],r=n[n.length-1];return r>i?"up":r<i?"down":"up"}const $e="—";function we(t){if(t==null)return!0;const n=String(t).trim();return!!(!n||/^[-−–—]$/.test(n)||/^(n\/a|null|undefined)$/i.test(n))}function Se(t){return!we(t)}function tt(t,n=$e){return we(t)?n:String(t)}function Ee(t){return t!=null&&String(t).trim()!==""}function O(t){return t?Ee(t.value)||Ee(t.delta)?!0:Array.isArray(t.points)&&t.points.length>0:!1}function nt(t){if(we(t))return null;const n=String(t).trim(),i=n.match(/\(\s*([+-])?\s*([\d.]+)/);return i?i[1]==="-"?"down":i[1]==="+"?"up":parseFloat(i[2])<0?"down":"up":/^[-−]/.test(n)?"down":/^\+/.test(n)?"up":/-\d/.test(n)?"down":null}function De(t,n){return nt(n)??(t==="down"?"down":"up")}function yt(t,n,i){return ke(i)??(Se(n)?De(t,n):t==="down"?"down":"up")}const s={ink:"var(--color-text)",muted:"var(--color-text-secondary)",border:"var(--grey-absent)",borderSubtle:"var(--neutral-100)",iconCircle:"var(--surface-hover)",black:"var(--neutral-900)",white:"var(--grey-white)",neutralBorder:"var(--neutral-250)",neutral800:"var(--neutral-800)",neutral600:"var(--neutral-600)",neutral450:"var(--neutral-450)",neutral400:"var(--neutral-400)",neutral300:"var(--neutral-300)",neutral150:"var(--neutral-150)",neutral100:"var(--neutral-100)",beige:"var(--surface-warm-40)",shadowCard:"var(--shadow-card)",railCompliance:"var(--rail-compliance)",accentYellow:"var(--accent-yellow)"},oe="var(--font-sans, 'Averta', ui-sans-serif, system-ui, sans-serif)",W="var(--font-sans, 'Averta', ui-sans-serif, system-ui, sans-serif)";function gt({direction:t="up",color:n=s.muted}){const i="M12.4167 0.75H17.4167M17.4167 0.75V5.75M17.4167 0.75L10.3333 7.83333L6.16667 3.66667L0.75 9.08333",r="M12.4167 9.25H17.4167M17.4167 9.25V4.25M17.4167 9.25L10.3333 2.16667L6.16667 6.33333L0.75 0.91667";return e.jsx("svg",{width:18,height:9.5,viewBox:"0 0 19 10",fill:"none",style:{flexShrink:0},children:e.jsx("path",{d:t==="up"?i:r,stroke:n,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Re(t){if(!t)return"";const n={month:"2-digit",day:"2-digit",year:"numeric"};if(t instanceof Date)return Number.isNaN(t.getTime())?"":t.toLocaleDateString(void 0,n);const i=String(t).trim(),r=i.match(/^(\d{4})-(\d{1,2})-(\d{1,2})/);if(r)return new Date(Number(r[1]),Number(r[2])-1,Number(r[3])).toLocaleDateString(void 0,n);const a=new Date(i);return Number.isNaN(a.getTime())?i:a.toLocaleDateString(void 0,n)}function mt({label:t,active:n=!1,onClick:i}){return e.jsx("button",{type:"button",onClick:i,style:{height:32,minWidth:31,padding:"0 12px",borderRadius:10,border:n?"none":`1px solid ${s.borderSubtle}`,background:n?s.black:s.white,color:n?s.white:s.black,fontFamily:W,fontSize:14,cursor:"pointer"},children:t})}function xe({yLabels:t,xLabels:n=[],points:i,highlightIndex:r,xAxisLabel:a="",yAxisLabel:o=""}){const[d,p]=w.useState(null),k=460,c=110,y=Array.isArray(i)&&i.length>0,j=w.useId(),g=6,m=Array.isArray(n)?n:[],$=m.length<=g?m:Array.from({length:g},(f,b)=>m[Math.round(b*(m.length-1)/(g-1))]),D=Math.max(2,$.length||g),_=Array.from({length:D},(f,b)=>b/(D-1)*k);if(!y)return e.jsxs("div",{style:{display:"flex",gap:8,height:133,width:"100%"},children:[e.jsx("div",{style:{width:24,flexShrink:0}}),e.jsx("div",{style:{flex:1,position:"relative",minWidth:0},children:e.jsx("svg",{width:"100%",height:c+14,viewBox:`0 0 ${k} ${c+14}`,preserveAspectRatio:"none",children:_.map((f,b)=>e.jsx("line",{x1:f,y1:"0",x2:f,y2:c,stroke:s.borderSubtle,strokeDasharray:"2 3",strokeWidth:"1",vectorEffect:"non-scaling-stroke"},`grid-${b}`))})})]});const M=Array.isArray(i[0])?i:i.map((f,b)=>[b,f]),X=M.map(([,f])=>f),B=Math.min(...X),N=Math.max(...X),G=N===B?Math.max(Math.abs(N)*.1,1):(N-B)*.1,K=B-G,u=N+G,A=u-K||1,I=f=>(u-f)/A*c,T=M.map(([f,b])=>[f,I(b)]),Y=t&&t.length?t:Array.from({length:5},(f,b)=>{const L=u-b/4*(u-K),z=Math.abs(L),Z=z>=100?0:z>=10?1:2;return L.toFixed(Z)}),C=T[0][0],ae=T[T.length-1][0]-C||1,ne=8,q=Math.max(1,k-ne*2),E=f=>ne+(f-C)/ae*q,R=f=>{const b=Number(f);if(!Number.isFinite(b))return String(f??"");const L=Math.abs(b),z=L>=100?0:L>=10?1:2;return b.toFixed(z)},ie=T.map(([f,b],L)=>`${L===0?"M":"L"}${E(f)},${b}`).join(" "),J=`${ie} L${E(T[T.length-1][0])},${c} L${E(T[0][0])},${c} Z`,ee=r??T.length-1;return e.jsxs("div",{style:{display:"flex",gap:8,height:a?151:133,width:"100%"},children:[o?e.jsx("div",{style:{display:"flex",alignItems:"center",flexShrink:0},children:e.jsx("span",{style:{writingMode:"vertical-rl",transform:"rotate(180deg)",fontFamily:W,fontSize:10,fontWeight:500,color:s.neutral800,whiteSpace:"nowrap"},children:o})}):null,e.jsx("div",{style:{display:"flex",flexDirection:"column",justifyContent:"space-between",padding:"14px 0",fontFamily:W,fontSize:10,color:s.neutral800,flexShrink:0},children:Y.map(f=>e.jsx("span",{children:f},f))}),e.jsxs("div",{style:{flex:1,position:"relative",minWidth:0},children:[d&&e.jsxs("div",{style:{position:"absolute",left:`${d.xPct}%`,top:`${d.yPct}%`,transform:"translate(-50%, calc(-100% - 10px))",pointerEvents:"none",zIndex:2,background:s.black,color:s.white,borderRadius:6,minWidth:60,padding:"8px 10px",boxShadow:"0 6px 16px rgba(0,0,0,0.18)",fontFamily:W,fontSize:11,lineHeight:1.25,whiteSpace:"nowrap",textAlign:"left"},children:[e.jsx("div",{children:d.label}),e.jsx("div",{style:{fontWeight:600},children:d.value}),e.jsx("div",{style:{position:"absolute",left:"50%",bottom:-5,width:10,height:10,background:s.black,transform:"translateX(-50%) rotate(45deg)",borderRadius:2}})]}),e.jsxs("svg",{width:"100%",height:c+14,viewBox:`0 0 ${k} ${c+14}`,preserveAspectRatio:"none",onMouseLeave:()=>p(null),children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:`area-${j}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",style:{stopColor:s.black,stopOpacity:.08}}),e.jsx("stop",{offset:"100%",style:{stopColor:s.black,stopOpacity:0}})]})}),_.map((f,b)=>e.jsx("line",{x1:f,y1:"0",x2:f,y2:c,stroke:s.borderSubtle,strokeDasharray:"2 3",strokeWidth:"1",vectorEffect:"non-scaling-stroke"},`grid-${b}`)),e.jsx("path",{d:J,fill:`url(#area-${j})`}),e.jsx("path",{d:ie,stroke:s.black,strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"}),T.map(([f,b],L)=>{const z=L===ee;return e.jsx("circle",{cx:E(f),cy:b,r:z?4:3,fill:z?s.black:s.white,stroke:s.black,strokeWidth:"1.5",vectorEffect:"non-scaling-stroke",onMouseEnter:()=>{var Z;p({xPct:E(f)/k*100,yPct:b/(c+28)*100,label:m[L]||`Point ${L+1}`,value:R((Z=M[L])==null?void 0:Z[1])})}},L)})]}),e.jsx("div",{style:{display:"flex",justifyContent:"space-between",paddingRight:6,fontFamily:W,fontSize:10,color:s.neutral800,marginTop:8,marginBottom:4,overflow:"hidden"},children:$.map((f,b)=>e.jsx("span",{style:{whiteSpace:"nowrap"},children:f},b))}),a?e.jsx("div",{style:{textAlign:"center",fontFamily:W,fontSize:10,fontWeight:500,color:s.neutral800},children:a}):null]})]})}function ue({title:t,value:n,delta:i,children:r}){const a=tt(n),o=Se(i),d=o?De("up",i):"up";return e.jsxs("div",{style:{flex:1,background:s.white,border:`1px solid ${s.border}`,borderRadius:8,padding:24,display:"flex",flexDirection:"column",gap:24,minWidth:0,boxShadow:s.shadowCard},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-end"},children:[e.jsx("span",{style:{fontFamily:oe,fontWeight:600,fontSize:15,color:s.ink,lineHeight:1.2},children:t}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"flex-end",gap:4,fontFamily:oe,fontWeight:600},children:[e.jsx("span",{style:{fontSize:20,color:s.black,lineHeight:1},children:a}),o?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3,fontSize:10,color:s.neutral300,lineHeight:1},children:[e.jsx(gt,{direction:d,color:s.neutral300}),i]}):null]})]}),e.jsx("div",{style:{flex:1},children:r})]})}function ze({icon:t,title:n,trailing:i,iconColor:r=s.ink,bordered:a=!1}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,width:"100%",paddingBottom:a?12:0,borderBottom:a?`1px solid ${s.border}`:"none"},children:[e.jsx("div",{style:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(t,{size:22,strokeWidth:1.75,style:{color:r}})}),e.jsx("div",{style:{flex:1,fontFamily:oe,fontWeight:600,fontSize:16,color:s.ink,lineHeight:1.2,textTransform:"uppercase",letterSpacing:"0.02em"},children:n}),i&&e.jsx("div",{style:{fontFamily:W,fontSize:14,color:s.ink},children:i})]})}function bt({text:t,bullet:n,citation:i,date:r,href:a}){const o=t??n??"";return e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",fontFamily:W,fontSize:14,color:s.ink,lineHeight:"24px",gap:16},children:[a?e.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",style:{color:s.ink,textDecoration:"underline",textUnderlineOffset:2,textDecorationColor:s.border,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o}):e.jsx("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o}),e.jsxs("span",{style:{display:"inline-flex",gap:4,whiteSpace:"nowrap"},children:[e.jsx("span",{style:{color:s.ink},children:i}),r?e.jsxs("span",{style:{color:s.muted},children:["(",r,")"]}):null]})]})}function Oe({title:t,summary:n,calls:i,percent:r,delta:a,bullets:o,defaultExpanded:d=!1}){const[p,k]=w.useState(d),c=r??a,y=Se(c),j=y?String(c):$e,m=(y?De("up",j):"up")==="down"?h.TrendingDown:h.TrendingUp,$=Array.isArray(o)?o:[];return e.jsxs("div",{style:{borderTop:`1px solid ${s.border}`},children:[e.jsxs("button",{type:"button",onClick:()=>k(D=>!D),"aria-expanded":p,style:{border:"none",background:"transparent",padding:16,display:"flex",gap:12,alignItems:"flex-start",cursor:"pointer",width:"100%",textAlign:"left",fontFamily:W},children:[e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:12,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[e.jsx("span",{style:{fontFamily:W,fontWeight:500,fontSize:14,color:s.black,lineHeight:"24px"},children:t}),e.jsx("span",{style:{fontFamily:W,fontSize:14,color:s.muted,lineHeight:"24px"},children:n})]}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx(h.Phone,{size:12,color:s.ink,strokeWidth:1.75}),e.jsxs("span",{style:{fontFamily:W,fontSize:12,color:s.ink},children:[i," Interactions"]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[y?e.jsx(m,{size:12,color:s.ink,strokeWidth:1.75}):null,e.jsx("span",{style:{fontFamily:W,fontSize:12,color:y?s.ink:s.muted},children:j})]})]})]}),e.jsx(h.ChevronDown,{size:20,color:s.ink,strokeWidth:2,style:{flexShrink:0,transform:p?"rotate(180deg)":"none",transition:"transform 150ms ease"}})]}),p&&$.length>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"0 16px 16px"},children:$.map((D,_)=>e.jsx(bt,{...D},_))})]})}function _e({label:t,value:n}){return e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 8px 12px",borderBottom:`1px solid ${s.border}`,fontFamily:W,fontSize:13,lineHeight:"1.2"},children:[e.jsx("span",{style:{color:s.ink},children:t}),e.jsx("span",{style:{color:s.muted},children:n})]})}function jt({value:t=0,max:n=5}){const i=typeof t=="number"?t:parseFloat(t)||0,r=Math.floor(i),a=i%1>0&&r<n;return e.jsx("div",{style:{display:"flex",gap:4},children:Array.from({length:n}).map((o,d)=>d<r?e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",background:s.black,display:"inline-block"}},d):d===r&&a?e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center"},children:e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:s.black,display:"inline-block"}})},d):e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",background:s.white,border:`1px solid ${s.border}`,display:"inline-block",boxSizing:"border-box"}},d))})}const vt=[{id:"title",label:"Title",width:220,sortable:!0,filterable:!0},{id:"date",label:"Date",width:170,sortable:!0},{id:"duration",label:"Duration",width:170,sortable:!0},{id:"lift",label:"Lift",width:120,sortable:!0},{id:"compass",label:"Compass Score",width:220,sortable:!0,render:t=>{const n=typeof t=="number"?t:parseFloat(t)||0;return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{minWidth:32},children:t}),e.jsx(jt,{value:n})]})}}];function Be({icon:t,title:n}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,width:"100%"},children:[e.jsx("div",{style:{width:34,height:34,borderRadius:9999,background:s.iconCircle,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(t,{size:20,color:s.ink,strokeWidth:1.75})}),e.jsx("span",{style:{fontFamily:oe,fontWeight:600,fontSize:16,color:s.ink,lineHeight:1.2},children:n})]})}function it({agentName:t="",startDate:n="",endDate:i="",totalCalls:r="",onBack:a,className:o="",kpiBaseline:d={value:"",label:"",sub:"",trend:"up"},kpiAgentLift:p={value:"",label:"",sub:"",trend:"down"},kpiScore:k={value:"",label:"",sub:"",trend:"up"},baselineChart:c={value:"",delta:""},agentLiftChart:y={value:"",delta:""},scoreChart:j={value:"",delta:""},csatChart:g={value:"",delta:""},volumeChart:m={value:"",delta:""},guidanceItems:$=[],strengthItems:D=[],callDrivers:_=[],callParadigms:M=[],strengthsTitle:X="",guidanceTitle:B="",callMixTitle:N="",driversTitle:G="",paradigmsTitle:K="",sessionsTitle:u="",baselineChartTitle:A="",agentLiftChartTitle:I="",scoreChartTitle:T="",csatChartTitle:Y="",volumeChartTitle:C="",sessions:ye=[],sessionColumns:ae=[],initialPageSize:ne=10,selectedWindow:q="30d",onWindowChange:E,dateRange:R,onDateRangeChange:ie,sessionsTotal:J=null,sessionsPage:ee=null,sessionsPageSize:f=null,onSessionsPageChange:b,onSessionsPageSizeChange:L,onExport:z,onSessionClick:Z,onSessionsVisibleColumnsChange:le}){const re=!!(R!=null&&R.from&&(R!=null&&R.to)),P=(()=>{if(re||q!=="8h")return null;const F=je("8h");return F?Ze(F.from,F.to):null})(),U=(()=>{if(re||q==="8h")return null;const F=je(q);return F?{from:Q(F.from),to:Q(F.to)}:null})(),de=O(c)||O(y)||O(j),Le=O(g)||O(m);return e.jsxs("div",{className:o,style:{background:s.white,fontFamily:W,color:s.ink,width:"100%",minWidth:1192,boxSizing:"border-box",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"23px 32px",minHeight:78,boxSizing:"border-box"},children:[e.jsx("button",{type:"button","aria-label":"Back",onClick:a,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,background:"transparent",border:"none",cursor:"pointer",color:s.ink,padding:0,flexShrink:0},children:e.jsx(h.ArrowLeft,{size:20,strokeWidth:1.75})}),e.jsx("div",{style:{paddingLeft:16,borderLeft:`1px solid ${s.border}`,flex:1,minWidth:0,alignSelf:"stretch",display:"flex",alignItems:"center"},children:e.jsx("h1",{style:{fontFamily:oe,fontSize:24,fontWeight:400,color:s.ink,margin:0,lineHeight:1,whiteSpace:"nowrap"},children:t})}),e.jsxs("button",{type:"button",onClick:()=>z==null?void 0:z(),disabled:!z,style:{display:"inline-flex",alignItems:"center",gap:8,height:32,padding:"0 16px",borderRadius:10,border:`1px solid ${s.neutralBorder}`,background:s.white,cursor:z?"pointer":"not-allowed",opacity:z?1:.5,fontFamily:W,fontSize:14,lineHeight:"24px",color:s.neutral800,flexShrink:0},children:[e.jsx(h.Download,{size:18,strokeWidth:1.75}),"Export CSV"]})]}),e.jsxs("div",{style:{padding:"0 32px 32px",display:"flex",flexDirection:"column",gap:16},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:16,paddingLeft:49},children:[e.jsxs("div",{style:{display:"flex",gap:16,alignItems:"center"},children:[e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(h.CalendarDays,{size:14,color:s.ink,strokeWidth:1.75,style:{flexShrink:0}}),e.jsx("span",{style:{fontFamily:W,fontSize:12,color:s.ink,lineHeight:1.5},children:(P==null?void 0:P.from)??(U==null?void 0:U.from)??Re(n)}),e.jsx(h.ArrowRight,{size:12,color:s.ink,strokeWidth:1.75,style:{flexShrink:0}}),e.jsx("span",{style:{fontFamily:W,fontSize:12,color:s.ink,lineHeight:1.5},children:(P==null?void 0:P.to)??(U==null?void 0:U.to)??Re(i)})]}),e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(h.Phone,{size:14,color:s.ink,strokeWidth:1.75,style:{flexShrink:0}}),e.jsx("span",{style:{fontFamily:W,fontSize:12,color:s.ink,lineHeight:1.5},children:r})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[[{id:"8h",label:"8h"},{id:"1d",label:"1d"},{id:"7d",label:"7d"},{id:"30d",label:"30d"}].map(F=>e.jsx(mt,{label:F.label,active:!re&&F.id===q,onClick:()=>E==null?void 0:E(F.id)},F.id)),e.jsx(Ie,{value:R,onChange:ie})]})]}),de&&e.jsxs("div",{style:{display:"flex",gap:24},children:[O(c)&&e.jsx(ue,{title:A,value:c.value,delta:c.delta,children:e.jsx(xe,{yLabels:c.yLabels,xLabels:c.xLabels,points:c.points,xAxisLabel:c.xAxisLabel,yAxisLabel:c.yAxisLabel})}),O(y)&&e.jsx(ue,{title:I,value:y.value,delta:y.delta,children:e.jsx(xe,{yLabels:y.yLabels,xLabels:y.xLabels,points:y.points,xAxisLabel:y.xAxisLabel,yAxisLabel:y.yAxisLabel})}),O(j)&&e.jsx(ue,{title:T,value:j.value,delta:j.delta,children:e.jsx(xe,{yLabels:j.yLabels,xLabels:j.xLabels,points:j.points,xAxisLabel:j.xAxisLabel,yAxisLabel:j.yAxisLabel})})]}),Le&&e.jsxs("div",{style:{display:"flex",gap:24},children:[O(g)&&e.jsx(ue,{title:Y,value:g.value,delta:g.delta,children:e.jsx(xe,{yLabels:g.yLabels,xLabels:g.xLabels,points:g.points,xAxisLabel:g.xAxisLabel,yAxisLabel:g.yAxisLabel})}),O(m)&&e.jsx(ue,{title:C,value:m.value,delta:m.delta,children:e.jsx(xe,{yLabels:m.yLabels,xLabels:m.xLabels,points:m.points,xAxisLabel:m.xAxisLabel,yAxisLabel:m.yAxisLabel})})]}),e.jsxs("div",{style:{display:"flex",gap:24,marginTop:8,alignItems:"flex-start"},children:[e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:16,minWidth:0},children:[e.jsx(ze,{icon:h.ShieldCheck,title:X,iconColor:s.railCompliance}),e.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},children:D.map((F,V)=>e.jsx(Oe,{...F},V))})]}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:16,minWidth:0},children:[e.jsx(ze,{icon:h.Lightbulb,title:B,iconColor:s.railCompliance}),e.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},children:$.map((F,V)=>e.jsx(Oe,{...F},V))})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,marginTop:8},children:[e.jsx(ze,{icon:h.Phone,title:N,iconColor:s.railCompliance}),e.jsxs("div",{style:{display:"flex",gap:24,alignItems:"flex-start"},children:[e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:8,minWidth:0},children:[e.jsx(Be,{icon:h.FolderKanban,title:G}),e.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},children:_.map((F,V)=>e.jsx(_e,{...F},V))})]}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:8,minWidth:0},children:[e.jsx(Be,{icon:h.Layers,title:K}),e.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},children:M.map((F,V)=>e.jsx(_e,{...F},V))})]})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,marginTop:8},children:[u&&e.jsx("span",{style:{fontFamily:oe,fontWeight:600,fontSize:16,color:s.ink,lineHeight:1.2},children:u}),e.jsx(Ge.DataTable2,{data:ye,columns:ae,initialPageSize:ne,totalCount:J,page:ee,pageSize:f,onPageChange:b,onPageSizeChange:L,onRowClick:Z,onVisibleColumnsChange:le})]})]})]})}const fe={value:"",label:"",trend:"up"},l={ink:"var(--color-text)",muted:"var(--color-text-secondary)",border:"var(--grey-absent)",borderSubtle:"var(--neutral-100)",iconCircle:"var(--surface-hover)",black:"var(--neutral-900)",white:"var(--grey-white)",green:"var(--color-green)",red:"var(--color-red-strong)",neutralBorder:"var(--neutral-250)",neutralLight:"var(--neutral-100)",beige:"var(--surface-warm-40)",neutral800:"var(--neutral-800)",textInk:"var(--text-ink)",textFaintGrey:"var(--text-faint-grey)",hoverWarm40:"var(--hover-warm-40)",shadowPopover:"var(--shadow-popover)",shadowDropdown:"var(--shadow-dropdown)",railCompliance:"var(--rail-compliance)"},te="var(--font-sans, 'Averta', ui-sans-serif, system-ui, sans-serif)",S="var(--font-sans, 'Averta', ui-sans-serif, system-ui, sans-serif)";function lt({trend:t="up",points:n,width:i=49.618,height:r=35}){const a=w.useId(),o=et(n),d=o?o.line:pt,p=o?o.area:ht,k=ke(n)??t;return e.jsxs("svg",{width:i,height:r,viewBox:"0 0 52 36",fill:"none",style:{flexShrink:0,transform:!o&&k==="down"?"scaleX(-1)":void 0},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:`spark-${a}`,x1:"9.96776",y1:"16.2053",x2:"9.96776",y2:"36.0002",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:l.ink}),e.jsx("stop",{offset:"1",stopColor:l.white,stopOpacity:"0.01"})]})}),e.jsx("path",{d:p,fill:`url(#spark-${a})`,fillRule:"evenodd",clipRule:"evenodd",opacity:"0.1"}),e.jsx("path",{d,stroke:l.ink,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:!o&&k==="down"?"2 4":void 0})]})}function rt(t,n){return ke(n)??(t==="down"?"down":"up")}function st({direction:t="up",color:n=l.muted}){const i="M12.4167 0.75H17.4167M17.4167 0.75V5.75M17.4167 0.75L10.3333 7.83333L6.16667 3.66667L0.75 9.08333",r="M12.4167 9.25H17.4167M17.4167 9.25V4.25M17.4167 9.25L10.3333 2.16667L6.16667 6.33333L0.75 0.91667";return e.jsx("svg",{width:18,height:9.5,viewBox:"0 0 19 10",fill:"none",style:{flexShrink:0},children:e.jsx("path",{d:t==="up"?i:r,stroke:n,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ye({value:t,label:n,trend:i="up",points:r,muted:a=!1,beigeBg:o=!1,style:d={}}){const p=rt(i,r);return e.jsxs("div",{style:{background:o?l.beige:l.white,border:`1px solid ${l.border}`,borderRadius:8,padding:16,display:"flex",flexDirection:"column",gap:8,boxSizing:"border-box",...d},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[e.jsx(lt,{trend:p,points:r}),e.jsx(st,{direction:p})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,marginTop:8},children:[e.jsx("div",{style:{fontFamily:te,fontSize:28,fontWeight:500,lineHeight:"1.2",color:a?l.muted:l.ink,letterSpacing:"-0.01em"},children:t}),e.jsx("div",{style:{fontFamily:S,fontSize:13,color:l.ink,lineHeight:"1.2"},children:n})]})]})}function Ae({value:t,label:n,trend:i="up",points:r,withDivider:a=!1}){const o=rt(i,r);return e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:8,paddingLeft:a?24:0,borderLeft:a?`1px solid ${l.border}`:"none",minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[e.jsx(lt,{trend:o,points:r}),e.jsx(st,{direction:o})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,marginTop:8},children:[e.jsx("div",{style:{fontFamily:te,fontSize:28,fontWeight:500,lineHeight:"1.2",color:l.muted,letterSpacing:"-0.01em"},children:t}),e.jsx("div",{style:{fontFamily:S,fontSize:13,color:l.ink,lineHeight:"1.2"},children:n})]})]})}function kt({icon:t,children:n,trailing:i}){return e.jsxs("button",{type:"button",style:{display:"inline-flex",alignItems:"center",gap:8,height:32,padding:"0 16px",borderRadius:10,border:`1px solid ${l.neutralBorder}`,background:l.white,cursor:"pointer",fontFamily:S,fontSize:14,color:l.neutral800,whiteSpace:"nowrap"},children:[t&&e.jsx(t,{size:18,strokeWidth:1.75}),n,i&&e.jsx(i,{size:16,strokeWidth:2})]})}const wt=["January","February","March","April","May","June","July","August","September","October","November","December"],St=["Su","Mo","Tu","We","Th","Fr","Sa"];function ge(t){const n=new Date(t);return n.setHours(0,0,0,0),n}function Dt(t,n){const r=new Date(t,n,1).getDay(),a=new Date(t,n,1-r);return Array.from({length:42},(o,d)=>{const p=new Date(a);return p.setDate(a.getDate()+d),p})}function Lt({value:t,onApply:n,onClose:i,anchorRef:r}){const a=w.useRef(null),[o,d]=w.useState(t!=null&&t.from?ge(t.from):null),[p,k]=w.useState(t!=null&&t.to?ge(t.to):null),c=o||new Date,[y,j]=w.useState(c.getFullYear()),[g,m]=w.useState(c.getMonth()),[$,D]=w.useState({top:0,left:0});w.useLayoutEffect(()=>{const u=()=>{if(!(r!=null&&r.current))return;const A=r.current.getBoundingClientRect(),I=320;D({top:A.bottom+6,left:Math.max(8,A.right-I)})};return u(),window.addEventListener("scroll",u,!0),window.addEventListener("resize",u),()=>{window.removeEventListener("scroll",u,!0),window.removeEventListener("resize",u)}},[r]),w.useEffect(()=>{const u=I=>{var T,Y;(T=a.current)!=null&&T.contains(I.target)||(Y=r==null?void 0:r.current)!=null&&Y.contains(I.target)||i()},A=I=>{I.key==="Escape"&&i()};return document.addEventListener("mousedown",u),document.addEventListener("keydown",A),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",A)}},[i,r]);const _=Dt(y,g),M=ge(new Date),X=u=>{const A=ge(u);A>M||(!o||o&&p?(d(A),k(null)):A<o?d(A):k(A))},B=()=>{g===0?(m(11),j(y-1)):m(g-1)},N=()=>{g===11?(m(0),j(y+1)):m(g+1)},G=u=>o&&p&&u>=o&&u<=p,K=u=>o&&u.getTime()===o.getTime()||p&&u.getTime()===p.getTime();return xt.createPortal(e.jsxs("div",{ref:a,style:{position:"fixed",top:$.top,left:$.left,width:320,background:l.white,border:`1px solid ${l.borderSubtle}`,borderRadius:12,boxShadow:l.shadowPopover,padding:16,zIndex:9999,fontFamily:S},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[e.jsx("button",{type:"button",onClick:B,style:Ue,"aria-label":"Previous month",children:e.jsx(h.ChevronLeft,{size:18,strokeWidth:1.75})}),e.jsxs("div",{style:{fontSize:14,fontWeight:600,color:l.ink},children:[wt[g]," ",y]}),e.jsx("button",{type:"button",onClick:N,style:Ue,"aria-label":"Next month",children:e.jsx(h.ChevronRight,{size:18,strokeWidth:1.75})})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:2,marginBottom:4},children:St.map(u=>e.jsx("div",{style:{textAlign:"center",fontSize:12,color:l.muted,padding:"4px 0"},children:u},u))}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:2},children:_.map(u=>{const A=u.getMonth()===g,I=G(u),T=K(u),Y=u.getTime()===M.getTime(),C=u>M;return e.jsx("button",{type:"button",onClick:()=>X(u),disabled:C,"aria-disabled":C,style:{height:36,border:"none",borderRadius:8,background:T?l.black:I?l.hoverWarm40:"transparent",color:T?l.white:C?l.textFaintGrey:A?l.ink:l.muted,fontFamily:S,fontSize:13,fontWeight:Y?500:400,cursor:C?"not-allowed":"pointer",opacity:C?.6:1},children:u.getDate()},u.toISOString())})}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:12,paddingTop:12,borderTop:`1px solid ${l.borderSubtle}`},children:[e.jsx("button",{type:"button",onClick:()=>{d(null),k(null)},style:{background:"transparent",border:"none",padding:0,cursor:"pointer",fontSize:14,fontWeight:500,color:l.ink},children:"Clear"}),e.jsx("button",{type:"button",disabled:!o||!p,onClick:()=>{n({from:o,to:p}),i()},style:{background:!o||!p?l.neutralBorder:l.black,color:l.white,border:"none",borderRadius:10,height:30,padding:"0 16px",fontFamily:S,fontSize:14,fontWeight:600,cursor:!o||!p?"not-allowed":"pointer"},children:"Apply"})]})]}),document.body)}const Ue={display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,border:"none",background:"transparent",borderRadius:6,cursor:"pointer",color:l.ink};function Ie({value:t,onChange:n}){const[i,r]=w.useState(!1),a=w.useRef(null),o=!!(t!=null&&t.from&&(t!=null&&t.to));return e.jsxs(e.Fragment,{children:[e.jsxs("button",{ref:a,type:"button",onClick:()=>r(d=>!d),style:{display:"inline-flex",alignItems:"center",gap:8,height:32,padding:"0 16px",borderRadius:10,border:o?"none":`1px solid ${l.neutralBorder}`,background:o?l.black:l.white,cursor:"pointer",fontFamily:S,fontSize:14,color:o?l.white:l.neutral800,fontWeight:o?600:400,whiteSpace:"nowrap"},children:[e.jsx(h.CalendarDays,{size:18,strokeWidth:1.75}),"Date Range"]}),i&&e.jsx(Lt,{value:t,anchorRef:a,onClose:()=>r(!1),onApply:d=>n==null?void 0:n(d)})]})}function Ft({label:t,active:n=!1,onClick:i}){return e.jsx("button",{type:"button",onClick:i,style:{height:32,minWidth:31,padding:"0 12px",borderRadius:10,border:n?"none":`1px solid ${l.borderSubtle}`,background:n?l.black:l.white,color:n?l.white:l.black,fontFamily:S,fontSize:14,cursor:"pointer"},children:t})}const zt=[{id:"8h",label:"8h"},{id:"1d",label:"1d"},{id:"7d",label:"7d"},{id:"30d",label:"30d"}];function At({value:t=0,max:n=5}){const i=typeof t=="number"?t:parseFloat(t)||0,r=Math.floor(i),a=i%1>0&&r<n;return e.jsx("div",{style:{display:"flex",gap:4},children:Array.from({length:n}).map((o,d)=>d<r?e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",background:l.black,display:"inline-block"}},d):d===r&&a?e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center"},children:e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:l.black,display:"inline-block"}})},d):e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",background:l.white,border:`1px solid ${l.border}`,display:"inline-block",boxSizing:"border-box"}},d))})}const Tt=[{id:"agent",label:"Agent",width:180,sortable:!0,filterable:!0},{id:"supervisor",label:"Supervisor",width:170,sortable:!0,filterable:!0},{id:"calls",label:"Calls",width:100,sortable:!0},{id:"baseline",label:"Baseline",width:110,sortable:!0},{id:"lift",label:"Lift",width:100,sortable:!0},{id:"score",label:"Score",width:100,sortable:!0,filterable:!0,filterType:"number"},{id:"compass",label:"Compass Score",width:200,sortable:!0,filterable:!0,filterType:"number",render:t=>e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{minWidth:32},children:t}),e.jsx(At,{value:typeof t=="number"?t:0})]})},{id:"totalDuration",label:"Total Duration",width:150,sortable:!0,filterable:!0,filterType:"duration",filterShowPresets:!1},{id:"avgDuration",label:"Average Duration",width:170,sortable:!0,filterable:!0,filterType:"duration",filterShowPresets:!1}];function me({icon:t,title:n,trailing:i,iconColor:r=l.ink,bordered:a=!1}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,width:"100%",paddingBottom:a?12:0,borderBottom:a?`1px solid ${l.border}`:"none"},children:[e.jsx("div",{style:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(t,{size:22,strokeWidth:1.75,style:{color:r}})}),e.jsx("div",{style:{flex:1,fontFamily:te,fontWeight:600,fontSize:16,color:l.ink,lineHeight:"1.2",textTransform:"uppercase",letterSpacing:"0.02em"},children:n}),i&&e.jsx("div",{style:{fontFamily:S,fontSize:14,color:l.ink},children:i})]})}function Ve({icon:t,title:n}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,width:"100%"},children:[e.jsx("div",{style:{width:34,height:34,borderRadius:9999,background:l.iconCircle,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(t,{size:20,color:l.ink,strokeWidth:1.75})}),e.jsx("span",{style:{fontFamily:te,fontWeight:600,fontSize:16,color:l.ink,lineHeight:"24px"},children:n})]})}function Xe({title:t,summary:n,calls:i,percent:r,bullets:a,defaultExpanded:o=!1}){const[d,p]=w.useState(o),k=Array.isArray(a)?a:[];return e.jsxs("div",{style:{borderTop:`1px solid ${l.border}`},children:[e.jsxs("button",{type:"button",onClick:()=>p(c=>!c),"aria-expanded":d,style:{border:"none",background:"transparent",padding:16,display:"flex",gap:12,alignItems:"flex-start",cursor:"pointer",width:"100%",textAlign:"left",fontFamily:S},children:[e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:12,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[e.jsx("div",{style:{fontFamily:te,fontWeight:600,fontSize:14,color:l.black,lineHeight:"24px"},children:t}),e.jsx("div",{style:{fontFamily:S,fontSize:14,color:l.muted,lineHeight:"24px"},children:n})]}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx(h.Phone,{size:14,color:l.ink,strokeWidth:1.75}),e.jsx("span",{style:{fontFamily:S,fontSize:12,color:l.ink,lineHeight:1.5},children:i})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx(h.TrendingUp,{size:14,color:l.ink,strokeWidth:1.75}),e.jsx("span",{style:{fontFamily:S,fontSize:12,color:l.ink,lineHeight:1.5},children:r})]})]})]}),e.jsx(h.ChevronDown,{size:20,color:l.ink,strokeWidth:2,style:{flexShrink:0,transform:d?"rotate(180deg)":"none",transition:"transform 150ms ease"}})]}),d&&k.length>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"0 16px 16px"},children:k.map((c,y)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",fontFamily:S,fontSize:14,color:l.ink,lineHeight:"24px",gap:16},children:[c.href?e.jsx("a",{href:c.href,target:"_blank",rel:"noopener noreferrer",style:{color:l.ink,textDecoration:"underline",textUnderlineOffset:2,textDecorationColor:l.border,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c.text}):e.jsx("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c.text}),e.jsxs("span",{style:{display:"inline-flex",gap:4,whiteSpace:"nowrap"},children:[e.jsx("span",{style:{color:l.ink},children:c.citation}),e.jsxs("span",{style:{color:l.muted},children:["(",c.date,")"]})]})]},y))})]})}function be({label:t,value:n}){return e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px 0",borderBottom:`1px solid ${l.border}`,fontFamily:S,fontSize:13,lineHeight:"24px"},children:[e.jsx("span",{style:{color:l.ink},children:t}),e.jsx("span",{style:{color:l.muted},children:n})]})}function pe({message:t=""}){return t?e.jsx("div",{style:{padding:"16px 0",fontFamily:S,fontSize:13,color:l.muted,lineHeight:1.5},children:t}):null}function Wt({className:t="",onAgentClick:n,title:i="",subtitle:r="",dateRangeLabel:a="",viewByOptions:o=[],initialViewBy:d="",onViewByChange:p,aggregatedByLabel:k="",volumeStat:c=fe,compassStat:y=fe,baselineSubStat:j=fe,agentLiftSubStat:g=fe,scoreSubStat:m=fe,agentRows:$=[],agentColumns:D=[],initialPageSize:_=10,guidanceItems:M=[],strengthItems:X=[],callDrivers:B=[],callParadigms:N=[],topSignalsLeft:G=[],topSignalsRight:K=[],topSignalsTrailing:u="",strengthsTitle:A="",guidanceTitle:I="",callMixTitle:T="",driversTitle:Y="",paradigmsTitle:C="",topSignalsTitle:ye="",emptyStrengthsMessage:ae="",emptyGuidanceMessage:ne="",emptyDriversMessage:q="",emptyParadigmsMessage:E="",emptyTopSignalsMessage:R="",rangeOptions:ie=zt,selectedWindow:J="30d",onWindowChange:ee,dateRangePicker:f,dateRange:b,onDateRangeChange:L,onExport:z,onVisibleColumnsChange:Z}){var Pe,He;const[le,re]=w.useState(null),[P,U]=w.useState(!1),[de,Le]=w.useState(d),[F,V]=w.useState(null),H=b!==void 0?b:F,Fe=!!(H!=null&&H.from&&(H!=null&&H.to)),ot=x=>{V(x),L==null||L(x)},at=x=>{V(null),L==null||L(null),ee==null||ee(x)},Me=w.useRef(null),Ce=w.useRef(null);w.useEffect(()=>{if(!P)return;const x=v=>{var ce,Ne;(ce=Ce.current)!=null&&ce.contains(v.target)||(Ne=Me.current)!=null&&Ne.contains(v.target)||U(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[P]);const dt=((Pe=o.find(x=>x.id===de))==null?void 0:Pe.label)||(((He=o[0])==null?void 0:He.label)??""),ct=x=>{if(n){n(x);return}re(x)};return e.jsxs(e.Fragment,{children:[le&&(()=>{let x=null,v=null;if(Fe)x=H.from,v=H.to;else{const ce=ve[J];ce&&(v=new Date,x=new Date(v.getTime()-ce))}return e.jsx(it,{className:t,agentName:le.agent,startDate:x||"",endDate:v||"",totalCalls:`${le.calls} Calls`,onBack:()=>re(null),selectedWindow:J,dateRange:H})})(),e.jsxs("div",{className:t,style:{background:l.white,fontFamily:S,color:l.ink,width:"100%",minWidth:1192,boxSizing:"border-box",padding:"12px 32px 32px",flexDirection:"column",gap:24,display:le?"none":"flex"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8,paddingTop:12},children:[e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:4},children:[e.jsx("h1",{style:{fontFamily:te,fontSize:24,fontWeight:500,color:l.ink,margin:0,lineHeight:"1.2",letterSpacing:"-0.01em"},children:i}),e.jsx("p",{style:{fontFamily:S,fontSize:14,color:"var(--neutral-950)",margin:0,lineHeight:"1.4"},children:r})]}),e.jsxs("button",{type:"button",onClick:()=>z==null?void 0:z(),disabled:!z,style:{display:"inline-flex",alignItems:"center",gap:8,height:32,padding:"0 16px",borderRadius:10,border:`1px solid ${l.neutralBorder}`,background:l.white,cursor:z?"pointer":"not-allowed",opacity:z?1:.5,fontFamily:S,fontSize:14,color:l.neutral800},children:[e.jsx(h.Download,{size:18,strokeWidth:1.75}),"Export CSV"]})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("button",{type:"button",ref:Me,onClick:()=>U(x=>!x),"aria-haspopup":"listbox","aria-expanded":P,style:{display:"inline-flex",alignItems:"center",gap:8,height:32,padding:"0 16px",borderRadius:10,border:`1px solid ${l.neutralBorder}`,background:l.white,cursor:"pointer",fontFamily:S,fontSize:14,lineHeight:"24px",color:l.neutral800,whiteSpace:"nowrap"},children:[dt,e.jsx(h.ChevronDown,{size:20,strokeWidth:1.75,style:{transform:P?"rotate(180deg)":"none",transition:"transform 120ms ease"}})]}),P&&e.jsxs("div",{ref:Ce,role:"listbox",style:{position:"absolute",top:36,left:0,zIndex:20,background:l.white,border:`1px solid ${l.border}`,borderRadius:4,boxShadow:l.shadowDropdown,display:"flex",flexDirection:"column",minWidth:144,fontFamily:S},children:[k&&e.jsx("div",{style:{padding:12,fontFamily:te,fontWeight:600,fontSize:13,color:l.ink,lineHeight:1.2},children:k}),o.map(x=>{const v=de===x.id;return e.jsxs("button",{type:"button",role:"option","aria-selected":v,onClick:()=>{x.id!==de&&(Le(x.id),p==null||p(x.id)),U(!1)},style:{display:"flex",alignItems:"center",gap:8,padding:v?12:"12px 12px 12px 40px",borderTop:`1px solid ${l.border}`,borderLeft:"none",borderRight:"none",borderBottom:"none",background:"transparent",cursor:"pointer",textAlign:"left",fontFamily:S,fontSize:13,lineHeight:1.2,color:l.ink,width:"100%"},children:[v&&e.jsx(h.Check,{size:20,color:l.ink,strokeWidth:1.75,style:{flexShrink:0}}),e.jsx("span",{children:x.label})]},x.id)})]})]}),e.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[(()=>{const v=(Fe?`${Q(H.from)} – ${Q(H.to)}`:"")||Qe(J)||a;return v?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontFamily:S,fontSize:13,color:l.ink},children:[e.jsx(h.CalendarDays,{size:16,strokeWidth:1.75,color:l.muted}),v]}):null})(),ie.map(x=>e.jsx(Ft,{label:x.label,active:!Fe&&x.id===J,onClick:()=>at(x.id)},x.id)),f?e.jsx(w.Suspense,{fallback:e.jsx(kt,{icon:h.CalendarDays,children:"Date Range"}),children:f}):e.jsx(Ie,{value:H,onChange:ot})]})]}),e.jsxs("div",{style:{display:"flex",gap:24},children:[e.jsx(Ye,{value:c.value,label:c.label,trend:c.trend,points:c.points,style:{width:264,flexShrink:0}}),e.jsx(Ye,{value:y.value,label:y.label,trend:y.trend,points:y.points,style:{width:264,flexShrink:0}}),e.jsxs("div",{style:{flex:1,background:l.beige,border:`1px solid ${l.border}`,borderRadius:8,padding:16,display:"flex",gap:24,alignItems:"stretch",boxSizing:"border-box"},children:[e.jsx(Ae,{value:j.value,label:j.label,trend:j.trend,points:j.points}),e.jsx(Ae,{value:g.value,label:g.label,trend:g.trend,points:g.points,withDivider:!0}),e.jsx(Ae,{value:m.value,label:m.label,trend:m.trend,points:m.points,withDivider:!0})]})]}),e.jsx(Ge.DataTable2,{data:$,columns:D,initialPageSize:_,onRowClick:ct,onVisibleColumnsChange:Z}),e.jsxs("div",{style:{display:"flex",gap:24,alignItems:"flex-start"},children:[e.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:16},children:[e.jsx(me,{icon:h.ShieldCheck,title:A,iconColor:"var(--rail-compliance)"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",borderBottom:`1px solid ${l.border}`,maxHeight:480,overflowY:"auto"},children:X.length===0?e.jsx(pe,{message:ae}):X.map((x,v)=>e.jsx(Xe,{...x},v))})]}),e.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:16},children:[e.jsx(me,{icon:h.Lightbulb,title:I,iconColor:"var(--rail-compliance)"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",borderBottom:`1px solid ${l.border}`,maxHeight:480,overflowY:"auto"},children:M.length===0?e.jsx(pe,{message:ne}):M.map((x,v)=>e.jsx(Xe,{...x},v))})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsx(me,{icon:h.Phone,title:T,iconColor:"var(--rail-compliance)"}),e.jsxs("div",{style:{display:"flex",gap:24,alignItems:"flex-start"},children:[e.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:8},children:[e.jsx(Ve,{icon:h.FolderKanban,title:Y}),e.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},children:B.length===0?e.jsx(pe,{message:q}):B.map((x,v)=>e.jsx(be,{...x},v))})]}),e.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:8},children:[e.jsx(Ve,{icon:h.Layers,title:C}),e.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},children:N.length===0?e.jsx(pe,{message:E}):N.map((x,v)=>e.jsx(be,{...x},v))})]})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsx(me,{icon:h.Signal,title:ye,iconColor:"var(--rail-compliance)",trailing:u,bordered:!0}),G.length===0&&K.length===0?e.jsx(pe,{message:R}):e.jsxs("div",{style:{display:"flex",gap:24},children:[e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:G.map((x,v)=>e.jsx(be,{...x},v))}),e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:K.map((x,v)=>e.jsx(be,{...x},v))})]})]})]})]})}exports.DEFAULT_AGENT_COLUMNS=Tt;exports.DEFAULT_SESSION_COLUMNS=vt;exports.DateRangeButton=Ie;exports.METRIC_PLACEHOLDER=$e;exports.PerformanceDetailsPage=it;exports.PerformancePanel=Wt;exports.RANGE_TO_MS=ve;exports.buildSparkPaths=et;exports.computeWindowLabel=Qe;exports.formatEightHourRangeEndpoints=Ze;exports.formatEightHourWindowLabel=Je;exports.formatLocalDate=Q;exports.formatMetricDisplay=tt;exports.getPresetWindowDates=je;exports.hasChartData=O;exports.hasMeaningfulMetric=Se;exports.isNullishMetric=we;exports.normalizeSparkPoints=We;exports.resolveKpiTrend=yt;exports.resolveTrend=De;exports.trendFromPoints=ke;exports.trendFromSignedValue=nt;
|
|
2
2
|
//# sourceMappingURL=PerformancePanel.cjs.js.map
|