@optifye/dashboard-core 6.12.39 → 6.12.40

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/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { format, addDays, subMonths, endOfMonth, startOfMonth, endOfDay, eachDayOfInterval, getDay, isSameDay, isWithinInterval, startOfDay, parseISO, subDays, differenceInMinutes, addMinutes, addMonths, isValid, formatDistanceToNow, isToday, isFuture, isBefore } from 'date-fns';
2
2
  import { formatInTimeZone, fromZonedTime, toZonedTime } from 'date-fns-tz';
3
- import * as React146 from 'react';
4
- import React146__default, { createContext, useRef, useId, useCallback, useState, useMemo, useEffect, forwardRef, useImperativeHandle, useLayoutEffect, memo as memo$1, useContext, useSyncExternalStore, Children, isValidElement, useInsertionEffect, startTransition, Fragment as Fragment$1, createElement, Component } from 'react';
3
+ import * as React147 from 'react';
4
+ import React147__default, { createContext, useRef, useId, useCallback, useState, useMemo, useEffect, forwardRef, useImperativeHandle, useLayoutEffect, memo as memo$1, useContext, useSyncExternalStore, Children, isValidElement, useInsertionEffect, startTransition, Fragment as Fragment$1, createElement, Component } from 'react';
5
5
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
6
  import { useRouter } from 'next/router';
7
7
  import { toast } from 'sonner';
@@ -10,13 +10,13 @@ import { EventEmitter } from 'events';
10
10
  import { createClient, REALTIME_SUBSCRIBE_STATES } from '@supabase/supabase-js';
11
11
  import Hls, { Events, ErrorTypes } from 'hls.js';
12
12
  import useSWR from 'swr';
13
- import { Camera, AlertTriangle, ChevronDown, ChevronUp, Check, ShieldCheck, Star, Award, RefreshCw, Filter, X, Coffee, Plus, ArrowUp, ArrowDown, ArrowRight, HelpCircle, ClipboardX, Activity, Wrench, UserX, Clock, Package, CheckCircle2, ArrowLeft, Calendar, Save, AlertCircle, Loader2, Minus, ChevronLeft, ChevronRight, TrendingUp, Sparkles, Pause, Play, XCircle, Palette, LockKeyhole, TrendingDown, FolderOpen, Folder, ArrowDownWideNarrow, Tag, Sliders, Layers, Search, Edit2, CheckCircle, User, Users, Shield, Building2, Mail, Lock, Info, Share2, Trophy, Target, Download, Video, Copy, Sun, Moon, MousePointer, UserPlus, UserCog, Trash2, Eye, MoreVertical, BarChart3, Pencil, UserCheck, LogOut, Film, MessageSquare, Menu, Send, Settings, LifeBuoy, EyeOff, Zap, Flame, Crown, Medal } from 'lucide-react';
13
+ import { Camera, AlertTriangle, ChevronDown, ChevronUp, Check, ShieldCheck, Star, Award, RefreshCw, Filter, X, Coffee, Plus, ArrowUp, ArrowDown, ArrowRight, HelpCircle, ClipboardX, Activity, Wrench, UserX, Clock, Package, CheckCircle2, ArrowLeft, Calendar, Save, AlertCircle, Loader2, Minus, ChevronLeft, ChevronRight, TrendingUp, Sparkles, Pause, Play, XCircle, Palette, LockKeyhole, TrendingDown, FolderOpen, Folder, ArrowDownWideNarrow, Tag, Sliders, Layers, Search, Edit2, CheckCircle, User, Users, Shield, Building2, Mail, Lock, Info, Share2, Trophy, Target, Download, Video, Copy, Sun, Moon, MousePointer, UserPlus, UserCog, Trash2, Eye, MoreVertical, BarChart3, Pencil, UserCheck, LogOut, Film, MessageSquare, Menu, Send, Settings, LifeBuoy, EyeOff, Zap, ExternalLink, Flame, Crown, Medal } from 'lucide-react';
14
14
  import { memo, noop, warning, invariant, progress, secondsToMilliseconds, millisecondsToSeconds } from 'motion-utils';
15
15
  import { BarChart as BarChart$1, CartesianGrid, XAxis, YAxis, ReferenceLine, Tooltip, Legend, Bar, LabelList, ResponsiveContainer, LineChart as LineChart$1, Line, Customized, Cell, PieChart, Pie, ComposedChart, Area, ScatterChart, Scatter } from 'recharts';
16
16
  import { Slot } from '@radix-ui/react-slot';
17
+ import { AdjustmentsHorizontalIcon, ClipboardDocumentCheckIcon, ClockIcon, UsersIcon, UserCircleIcon, TicketIcon, CurrencyDollarIcon, QuestionMarkCircleIcon, XMarkIcon, ArrowRightIcon, SparklesIcon, PlayCircleIcon, Bars3Icon, HomeIcon, VideoCameraIcon, TrophyIcon, ChartBarIcon, LightBulbIcon, CubeIcon, HeartIcon, Cog6ToothIcon, ChevronRightIcon, ArrowRightStartOnRectangleIcon, ExclamationCircleIcon, ExclamationTriangleIcon, CalendarIcon, ChevronDownIcon, ChevronLeftIcon, EnvelopeIcon, DocumentTextIcon, ChevronUpIcon, ArrowDownTrayIcon, CheckCircleIcon, ChatBubbleLeftRightIcon, XCircleIcon, FunnelIcon, EyeIcon, InformationCircleIcon, ArrowLeftIcon } from '@heroicons/react/24/outline';
17
18
  import * as SelectPrimitive from '@radix-ui/react-select';
18
19
  import { DayPicker, useNavigation as useNavigation$1 } from 'react-day-picker';
19
- import { AdjustmentsHorizontalIcon, ClipboardDocumentCheckIcon, ClockIcon, UsersIcon, UserCircleIcon, TicketIcon, CurrencyDollarIcon, QuestionMarkCircleIcon, XMarkIcon, ArrowRightIcon, Bars3Icon, HomeIcon, VideoCameraIcon, TrophyIcon, ChartBarIcon, LightBulbIcon, CubeIcon, HeartIcon, Cog6ToothIcon, ChevronRightIcon, ArrowRightStartOnRectangleIcon, ExclamationCircleIcon, ExclamationTriangleIcon, CalendarIcon, ChevronDownIcon, ChevronLeftIcon, EnvelopeIcon, DocumentTextIcon, ChevronUpIcon, ArrowDownTrayIcon, CheckCircleIcon, ChatBubbleLeftRightIcon, XCircleIcon, FunnelIcon, EyeIcon, InformationCircleIcon, ArrowLeftIcon, PlayCircleIcon } from '@heroicons/react/24/outline';
20
20
  import { CheckIcon } from '@heroicons/react/24/solid';
21
21
  import html2canvas from 'html2canvas';
22
22
  import jsPDF, { jsPDF as jsPDF$1 } from 'jspdf';
@@ -2091,14 +2091,14 @@ var useIdleTimeVlmConfig = () => {
2091
2091
  }
2092
2092
  return context;
2093
2093
  };
2094
- var DashboardConfigContext = React146.createContext(void 0);
2094
+ var DashboardConfigContext = React147.createContext(void 0);
2095
2095
  var DashboardProvider = ({ config: userProvidedConfig, children }) => {
2096
- const fullConfig = React146.useMemo(() => mergeWithDefaultConfig(userProvidedConfig), [userProvidedConfig]);
2096
+ const fullConfig = React147.useMemo(() => mergeWithDefaultConfig(userProvidedConfig), [userProvidedConfig]);
2097
2097
  _setDashboardConfigInstance(fullConfig);
2098
- React146.useEffect(() => {
2098
+ React147.useEffect(() => {
2099
2099
  _setDashboardConfigInstance(fullConfig);
2100
2100
  }, [fullConfig]);
2101
- React146.useEffect(() => {
2101
+ React147.useEffect(() => {
2102
2102
  if (!fullConfig.theme) return;
2103
2103
  const styleId = "dashboard-core-theme-vars";
2104
2104
  let styleEl = document.getElementById(styleId);
@@ -2124,7 +2124,7 @@ var DashboardProvider = ({ config: userProvidedConfig, children }) => {
2124
2124
  return /* @__PURE__ */ jsx(DashboardConfigContext.Provider, { value: fullConfig, children: /* @__PURE__ */ jsx(IdleTimeVlmConfigProvider, { children }) });
2125
2125
  };
2126
2126
  var useDashboardConfig = () => {
2127
- const ctx = React146.useContext(DashboardConfigContext);
2127
+ const ctx = React147.useContext(DashboardConfigContext);
2128
2128
  if (!ctx) throw new Error("useDashboardConfig must be used within a DashboardProvider");
2129
2129
  return ctx;
2130
2130
  };
@@ -12827,7 +12827,7 @@ var useMobileMenu = () => {
12827
12827
  };
12828
12828
  var useHideMobileHeader = (shouldHide = true) => {
12829
12829
  const context = useMobileMenu();
12830
- React146__default.useEffect(() => {
12830
+ React147__default.useEffect(() => {
12831
12831
  if (context && shouldHide) {
12832
12832
  context.setHideMobileHeader(true);
12833
12833
  return () => {
@@ -18812,7 +18812,7 @@ var useActiveBreaks = (lineIds) => {
18812
18812
  const [isLoading, setIsLoading] = useState(true);
18813
18813
  const [error, setError] = useState(null);
18814
18814
  const supabase = useSupabase();
18815
- const parseTimeToMinutes5 = (timeStr) => {
18815
+ const parseTimeToMinutes6 = (timeStr) => {
18816
18816
  const [hours, minutes] = timeStr.split(":").map(Number);
18817
18817
  return hours * 60 + minutes;
18818
18818
  };
@@ -18821,8 +18821,8 @@ var useActiveBreaks = (lineIds) => {
18821
18821
  return now4.getHours() * 60 + now4.getMinutes();
18822
18822
  };
18823
18823
  const isTimeInBreak = (breakStart, breakEnd, currentMinutes) => {
18824
- const startMinutes = parseTimeToMinutes5(breakStart);
18825
- const endMinutes = parseTimeToMinutes5(breakEnd);
18824
+ const startMinutes = parseTimeToMinutes6(breakStart);
18825
+ const endMinutes = parseTimeToMinutes6(breakEnd);
18826
18826
  if (endMinutes < startMinutes) {
18827
18827
  return currentMinutes >= startMinutes || currentMinutes < endMinutes;
18828
18828
  } else {
@@ -18830,8 +18830,8 @@ var useActiveBreaks = (lineIds) => {
18830
18830
  }
18831
18831
  };
18832
18832
  const calculateBreakProgress = (breakStart, breakEnd, currentMinutes) => {
18833
- const startMinutes = parseTimeToMinutes5(breakStart);
18834
- const endMinutes = parseTimeToMinutes5(breakEnd);
18833
+ const startMinutes = parseTimeToMinutes6(breakStart);
18834
+ const endMinutes = parseTimeToMinutes6(breakEnd);
18835
18835
  let elapsedMinutes = 0;
18836
18836
  let remainingMinutes = 0;
18837
18837
  if (endMinutes < startMinutes) {
@@ -18849,8 +18849,8 @@ var useActiveBreaks = (lineIds) => {
18849
18849
  return { elapsedMinutes, remainingMinutes };
18850
18850
  };
18851
18851
  const isTimeInShift = (startTime, endTime, currentMinutes) => {
18852
- const startMinutes = parseTimeToMinutes5(startTime);
18853
- const endMinutes = parseTimeToMinutes5(endTime);
18852
+ const startMinutes = parseTimeToMinutes6(startTime);
18853
+ const endMinutes = parseTimeToMinutes6(endTime);
18854
18854
  if (endMinutes < startMinutes) {
18855
18855
  return currentMinutes >= startMinutes || currentMinutes < endMinutes;
18856
18856
  } else {
@@ -18910,8 +18910,8 @@ var useActiveBreaks = (lineIds) => {
18910
18910
  const endTime = breakItem.end || breakItem.endTime || "00:00";
18911
18911
  let duration = breakItem.duration || 0;
18912
18912
  if (!duration || duration === 0) {
18913
- const startMinutes = parseTimeToMinutes5(startTime);
18914
- const endMinutes = parseTimeToMinutes5(endTime);
18913
+ const startMinutes = parseTimeToMinutes6(startTime);
18914
+ const endMinutes = parseTimeToMinutes6(endTime);
18915
18915
  duration = endMinutes < startMinutes ? endMinutes + 24 * 60 - startMinutes : endMinutes - startMinutes;
18916
18916
  }
18917
18917
  return {
@@ -18927,8 +18927,8 @@ var useActiveBreaks = (lineIds) => {
18927
18927
  const endTime = breakItem.end || breakItem.endTime || "00:00";
18928
18928
  let duration = breakItem.duration || 0;
18929
18929
  if (!duration || duration === 0) {
18930
- const startMinutes = parseTimeToMinutes5(startTime);
18931
- const endMinutes = parseTimeToMinutes5(endTime);
18930
+ const startMinutes = parseTimeToMinutes6(startTime);
18931
+ const endMinutes = parseTimeToMinutes6(endTime);
18932
18932
  duration = endMinutes < startMinutes ? endMinutes + 24 * 60 - startMinutes : endMinutes - startMinutes;
18933
18933
  }
18934
18934
  return {
@@ -20031,6 +20031,89 @@ var useMonthlyTrend = (params) => {
20031
20031
  }, [queryString2, supabase]);
20032
20032
  return { trendSummary, isLoading, error };
20033
20033
  };
20034
+
20035
+ // src/lib/services/workspaceHourSummaryService.ts
20036
+ var fetchWorkspaceHourSummary = (supabase, request) => {
20037
+ const {
20038
+ workspaceId,
20039
+ companyId,
20040
+ date,
20041
+ shiftId,
20042
+ hourIndex,
20043
+ hourStart,
20044
+ hourEnd,
20045
+ forceRefresh = false,
20046
+ selectionSource = "unknown"
20047
+ } = request;
20048
+ return fetchBackendJson(
20049
+ supabase,
20050
+ `/api/dashboard/workspace/${workspaceId}/hour-summary`,
20051
+ {
20052
+ method: "POST",
20053
+ body: JSON.stringify({
20054
+ companyId,
20055
+ date,
20056
+ shiftId,
20057
+ hourIndex,
20058
+ hourStart,
20059
+ hourEnd,
20060
+ forceRefresh,
20061
+ selectionSource
20062
+ }),
20063
+ timeoutMs: 45e3,
20064
+ retries: 0,
20065
+ sentry: {
20066
+ surface: "workspace_hour_summary",
20067
+ route: "/api/dashboard/workspace/:workspaceId/hour-summary"
20068
+ }
20069
+ }
20070
+ );
20071
+ };
20072
+
20073
+ // src/lib/hooks/useWorkspaceHourSummary.ts
20074
+ var useWorkspaceHourSummary = () => {
20075
+ const supabase = useSupabase();
20076
+ const [data, setData] = useState(null);
20077
+ const [isLoading, setIsLoading] = useState(false);
20078
+ const [error, setError] = useState(null);
20079
+ const activeRequestIdRef = useRef(0);
20080
+ const summarize = useCallback(async (request) => {
20081
+ const requestId = activeRequestIdRef.current + 1;
20082
+ activeRequestIdRef.current = requestId;
20083
+ setIsLoading(true);
20084
+ setError(null);
20085
+ try {
20086
+ const response = await fetchWorkspaceHourSummary(supabase, request);
20087
+ if (activeRequestIdRef.current === requestId) {
20088
+ setData(response);
20089
+ }
20090
+ return response;
20091
+ } catch (err) {
20092
+ const nextError = err instanceof Error ? err : new Error(String(err));
20093
+ if (activeRequestIdRef.current === requestId) {
20094
+ setError(nextError);
20095
+ }
20096
+ throw nextError;
20097
+ } finally {
20098
+ if (activeRequestIdRef.current === requestId) {
20099
+ setIsLoading(false);
20100
+ }
20101
+ }
20102
+ }, [supabase]);
20103
+ const reset = useCallback(() => {
20104
+ activeRequestIdRef.current += 1;
20105
+ setData(null);
20106
+ setError(null);
20107
+ setIsLoading(false);
20108
+ }, []);
20109
+ return {
20110
+ data,
20111
+ isLoading,
20112
+ error,
20113
+ summarize,
20114
+ reset
20115
+ };
20116
+ };
20034
20117
  var MAX_RETRIES = 10;
20035
20118
  var RETRY_DELAY = 500;
20036
20119
  function useNavigation(customNavigate) {
@@ -25727,7 +25810,7 @@ var MotionConfigContext = createContext({
25727
25810
  });
25728
25811
 
25729
25812
  // ../../node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs
25730
- var PopChildMeasure = class extends React146.Component {
25813
+ var PopChildMeasure = class extends React147.Component {
25731
25814
  getSnapshotBeforeUpdate(prevProps) {
25732
25815
  const element = this.props.childRef.current;
25733
25816
  if (element && prevProps.isPresent && !this.props.isPresent) {
@@ -25782,7 +25865,7 @@ function PopChild({ children, isPresent }) {
25782
25865
  document.head.removeChild(style);
25783
25866
  };
25784
25867
  }, [isPresent]);
25785
- return jsx(PopChildMeasure, { isPresent, childRef: ref, sizeRef: size, children: React146.cloneElement(children, { ref }) });
25868
+ return jsx(PopChildMeasure, { isPresent, childRef: ref, sizeRef: size, children: React147.cloneElement(children, { ref }) });
25786
25869
  }
25787
25870
 
25788
25871
  // ../../node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs
@@ -25819,7 +25902,7 @@ var PresenceChild = ({ children, initial, isPresent, onExitComplete, custom, pre
25819
25902
  useMemo(() => {
25820
25903
  presenceChildren.forEach((_, key) => presenceChildren.set(key, false));
25821
25904
  }, [isPresent]);
25822
- React146.useEffect(() => {
25905
+ React147.useEffect(() => {
25823
25906
  !isPresent && !presenceChildren.size && onExitComplete && onExitComplete();
25824
25907
  }, [isPresent]);
25825
25908
  if (mode === "popLayout") {
@@ -33604,7 +33687,7 @@ var withAuth = (WrappedComponent2, options) => {
33604
33687
  requireAuth: true,
33605
33688
  ...options
33606
33689
  };
33607
- const WithAuthComponent = React146.memo(function WithAuthComponent2(props) {
33690
+ const WithAuthComponent = React147.memo(function WithAuthComponent2(props) {
33608
33691
  const {
33609
33692
  session,
33610
33693
  user,
@@ -33615,9 +33698,9 @@ var withAuth = (WrappedComponent2, options) => {
33615
33698
  retrySessionHydration
33616
33699
  } = useAuth();
33617
33700
  const router = useRouter();
33618
- const [localLoading, setLocalLoading] = React146.useState(loading);
33619
- const [loadingTimeoutReached, setLoadingTimeoutReached] = React146.useState(false);
33620
- React146.useEffect(() => {
33701
+ const [localLoading, setLocalLoading] = React147.useState(loading);
33702
+ const [loadingTimeoutReached, setLoadingTimeoutReached] = React147.useState(false);
33703
+ React147.useEffect(() => {
33621
33704
  if (process.env.NODE_ENV === "development" && process.env.DEBUG_AUTH === "true") {
33622
33705
  console.log("withAuth state:", {
33623
33706
  loading,
@@ -33629,7 +33712,7 @@ var withAuth = (WrappedComponent2, options) => {
33629
33712
  });
33630
33713
  }
33631
33714
  }, [authStatus, error, loading, session, user]);
33632
- const handleLoadingTimeout = React146.useCallback(() => {
33715
+ const handleLoadingTimeout = React147.useCallback(() => {
33633
33716
  console.warn("[withAuth] Loading timeout reached");
33634
33717
  setLoadingTimeoutReached(true);
33635
33718
  if (hasStoredSupabaseSession()) {
@@ -33641,13 +33724,13 @@ var withAuth = (WrappedComponent2, options) => {
33641
33724
  router.replace(defaultOptions.redirectTo);
33642
33725
  }
33643
33726
  }, [retrySessionHydration, router]);
33644
- React146.useEffect(() => {
33727
+ React147.useEffect(() => {
33645
33728
  if (!loading && authStatus !== "recovering" && defaultOptions.requireAuth && !session && !error) {
33646
33729
  console.log("[withAuth] No session found, redirecting to login");
33647
33730
  router.replace(defaultOptions.redirectTo);
33648
33731
  }
33649
33732
  }, [authStatus, defaultOptions.requireAuth, error, loading, router, session]);
33650
- React146.useEffect(() => {
33733
+ React147.useEffect(() => {
33651
33734
  setLocalLoading(loading);
33652
33735
  }, [loading]);
33653
33736
  if (loading || localLoading) {
@@ -34646,11 +34729,11 @@ var BarChartComponent = ({
34646
34729
  aspect = 2,
34647
34730
  ...restOfChartProps
34648
34731
  }) => {
34649
- const containerRef = React146__default.useRef(null);
34650
- const [containerReady, setContainerReady] = React146__default.useState(false);
34732
+ const containerRef = React147__default.useRef(null);
34733
+ const [containerReady, setContainerReady] = React147__default.useState(false);
34651
34734
  const themeConfig = useThemeConfig();
34652
34735
  const { formatNumber } = useFormatNumber();
34653
- React146__default.useEffect(() => {
34736
+ React147__default.useEffect(() => {
34654
34737
  const checkContainerDimensions = () => {
34655
34738
  if (containerRef.current) {
34656
34739
  const rect = containerRef.current.getBoundingClientRect();
@@ -34764,7 +34847,7 @@ var BarChartComponent = ({
34764
34847
  }
34765
34848
  return /* @__PURE__ */ jsx("div", { className: clsx("w-full", className), children: chartContent });
34766
34849
  };
34767
- var BarChart = React146__default.memo(BarChartComponent, (prevProps, nextProps) => {
34850
+ var BarChart = React147__default.memo(BarChartComponent, (prevProps, nextProps) => {
34768
34851
  if (prevProps.xAxisDataKey !== nextProps.xAxisDataKey || prevProps.xAxisLabel !== nextProps.xAxisLabel || prevProps.yAxisLabel !== nextProps.yAxisLabel || prevProps.yAxisUnit !== nextProps.yAxisUnit || JSON.stringify(prevProps.referenceLines || []) !== JSON.stringify(nextProps.referenceLines || []) || prevProps.layout !== nextProps.layout || prevProps.className !== nextProps.className || prevProps.showGrid !== nextProps.showGrid || prevProps.showLegend !== nextProps.showLegend || prevProps.showTooltip !== nextProps.showTooltip || prevProps.responsive !== nextProps.responsive || prevProps.aspect !== nextProps.aspect) {
34769
34852
  return false;
34770
34853
  }
@@ -34815,10 +34898,10 @@ var LineChartComponent = ({
34815
34898
  fillContainer = false,
34816
34899
  ...restOfChartProps
34817
34900
  }) => {
34818
- const containerRef = React146__default.useRef(null);
34819
- const [dimensions, setDimensions] = React146__default.useState({ width: 0, height: 0 });
34820
- const [hasValidData, setHasValidData] = React146__default.useState(false);
34821
- React146__default.useEffect(() => {
34901
+ const containerRef = React147__default.useRef(null);
34902
+ const [dimensions, setDimensions] = React147__default.useState({ width: 0, height: 0 });
34903
+ const [hasValidData, setHasValidData] = React147__default.useState(false);
34904
+ React147__default.useEffect(() => {
34822
34905
  const currentHasValidData = data && lines && lines.length > 0 && data.some(
34823
34906
  (item) => lines.some((line) => {
34824
34907
  const val = item[line.dataKey];
@@ -34829,7 +34912,7 @@ var LineChartComponent = ({
34829
34912
  setHasValidData(true);
34830
34913
  }
34831
34914
  }, [data, lines, hasValidData]);
34832
- React146__default.useEffect(() => {
34915
+ React147__default.useEffect(() => {
34833
34916
  if (!containerRef.current) return;
34834
34917
  const observer = new ResizeObserver((entries) => {
34835
34918
  const entry = entries[0];
@@ -34954,7 +35037,7 @@ var LineChartComponent = ({
34954
35037
  }
34955
35038
  return /* @__PURE__ */ jsx("div", { className: clsx("w-full", className), children: renderChartContent(restOfChartProps.width, restOfChartProps.height) });
34956
35039
  };
34957
- var LineChart = React146__default.memo(LineChartComponent, (prevProps, nextProps) => {
35040
+ var LineChart = React147__default.memo(LineChartComponent, (prevProps, nextProps) => {
34958
35041
  if (prevProps.xAxisDataKey !== nextProps.xAxisDataKey || prevProps.xAxisLabel !== nextProps.xAxisLabel || prevProps.yAxisLabel !== nextProps.yAxisLabel || prevProps.yAxisUnit !== nextProps.yAxisUnit || prevProps.className !== nextProps.className || prevProps.showGrid !== nextProps.showGrid || prevProps.showLegend !== nextProps.showLegend || prevProps.showTooltip !== nextProps.showTooltip || prevProps.responsive !== nextProps.responsive || prevProps.aspect !== nextProps.aspect || JSON.stringify(prevProps.yAxisDomain) !== JSON.stringify(nextProps.yAxisDomain)) {
34959
35042
  return false;
34960
35043
  }
@@ -35121,7 +35204,7 @@ var SkuRow = ({ sku, isSelected, isLive, onSelect }) => {
35121
35204
  );
35122
35205
  };
35123
35206
  var PerSkuView = ({ rows, className = "", selectedSkuId, liveSkuId, onSelectSku }) => {
35124
- const ordered = React146__default.useMemo(
35207
+ const ordered = React147__default.useMemo(
35125
35208
  () => [...rows].sort((a, b) => {
35126
35209
  const am = (b.active_minutes ?? 0) - (a.active_minutes ?? 0);
35127
35210
  if (am !== 0) return am;
@@ -35129,9 +35212,9 @@ var PerSkuView = ({ rows, className = "", selectedSkuId, liveSkuId, onSelectSku
35129
35212
  }),
35130
35213
  [rows]
35131
35214
  );
35132
- const scrollContainerRef = React146__default.useRef(null);
35133
- const [showScrollIndicatorBottom, setShowScrollIndicatorBottom] = React146__default.useState(ordered.length > 4);
35134
- const [showScrollIndicatorTop, setShowScrollIndicatorTop] = React146__default.useState(false);
35215
+ const scrollContainerRef = React147__default.useRef(null);
35216
+ const [showScrollIndicatorBottom, setShowScrollIndicatorBottom] = React147__default.useState(ordered.length > 4);
35217
+ const [showScrollIndicatorTop, setShowScrollIndicatorTop] = React147__default.useState(false);
35135
35218
  const handleScroll = (e) => {
35136
35219
  const target = e.currentTarget;
35137
35220
  if (target.scrollHeight - target.scrollTop <= target.clientHeight + 10) {
@@ -35155,7 +35238,7 @@ var PerSkuView = ({ rows, className = "", selectedSkuId, liveSkuId, onSelectSku
35155
35238
  scrollContainerRef.current.scrollBy({ top: -80, behavior: "smooth" });
35156
35239
  }
35157
35240
  };
35158
- React146__default.useEffect(() => {
35241
+ React147__default.useEffect(() => {
35159
35242
  if (scrollContainerRef.current) {
35160
35243
  const target = scrollContainerRef.current;
35161
35244
  setShowScrollIndicatorBottom(target.scrollHeight > target.clientHeight && target.scrollHeight - target.scrollTop > target.clientHeight + 10);
@@ -35228,7 +35311,7 @@ var OutputProgressChartComponent = ({
35228
35311
  liveSkuId,
35229
35312
  onSelectSku
35230
35313
  }) => {
35231
- const realSkuRows = React146__default.useMemo(
35314
+ const realSkuRows = React147__default.useMemo(
35232
35315
  () => filterRealSkuBreakdown(skuBreakdown),
35233
35316
  [skuBreakdown]
35234
35317
  );
@@ -35253,7 +35336,7 @@ var OutputProgressChartComponent = ({
35253
35336
  }
35254
35337
  );
35255
35338
  };
35256
- var OutputProgressChart = React146__default.memo(OutputProgressChartComponent);
35339
+ var OutputProgressChart = React147__default.memo(OutputProgressChartComponent);
35257
35340
  OutputProgressChart.displayName = "OutputProgressChart";
35258
35341
  var LargeOutputProgressChart = ({
35259
35342
  currentOutput,
@@ -35393,7 +35476,7 @@ var CycleTimeChartComponent = ({
35393
35476
  }
35394
35477
  ) }) });
35395
35478
  };
35396
- var CycleTimeChart = React146__default.memo(CycleTimeChartComponent, (prevProps, nextProps) => {
35479
+ var CycleTimeChart = React147__default.memo(CycleTimeChartComponent, (prevProps, nextProps) => {
35397
35480
  if (prevProps.className !== nextProps.className) {
35398
35481
  return false;
35399
35482
  }
@@ -35628,19 +35711,21 @@ var CycleTimeOverTimeChart = ({
35628
35711
  className = "",
35629
35712
  showIdleTime = false,
35630
35713
  idleTimeData = [],
35631
- idleTimeSlots = []
35714
+ idleTimeSlots = [],
35715
+ selectedHourIndex = null,
35716
+ onHourClick
35632
35717
  }) => {
35633
35718
  const MAX_DATA_POINTS = 40;
35634
- const containerRef = React146__default.useRef(null);
35635
- const [dimensions, setDimensions] = React146__default.useState({ width: 0, height: 0 });
35636
- const [hasValidData, setHasValidData] = React146__default.useState(false);
35637
- React146__default.useEffect(() => {
35719
+ const containerRef = React147__default.useRef(null);
35720
+ const [dimensions, setDimensions] = React147__default.useState({ width: 0, height: 0 });
35721
+ const [hasValidData, setHasValidData] = React147__default.useState(false);
35722
+ React147__default.useEffect(() => {
35638
35723
  const currentHasValidData = data && data.some((val) => val !== null && val > 0);
35639
35724
  if (currentHasValidData && !hasValidData) {
35640
35725
  setHasValidData(true);
35641
35726
  }
35642
35727
  }, [data, hasValidData]);
35643
- React146__default.useEffect(() => {
35728
+ React147__default.useEffect(() => {
35644
35729
  if (!containerRef.current) return;
35645
35730
  const observer = new ResizeObserver((entries) => {
35646
35731
  const entry = entries[0];
@@ -35654,13 +35739,19 @@ var CycleTimeOverTimeChart = ({
35654
35739
  observer.observe(containerRef.current);
35655
35740
  return () => observer.disconnect();
35656
35741
  }, []);
35657
- const parseTimeToMinutes5 = (value) => {
35742
+ const parseTimeToMinutes6 = (value) => {
35658
35743
  const [hours, minutes] = value.split(":").map(Number);
35659
35744
  if (!Number.isFinite(hours) || !Number.isFinite(minutes)) return 0;
35660
35745
  return hours * 60 + minutes;
35661
35746
  };
35747
+ const formatMinutesAsTimeFilter2 = (value) => {
35748
+ const normalized = (Math.round(value) % (24 * 60) + 24 * 60) % (24 * 60);
35749
+ const hour = Math.floor(normalized / 60);
35750
+ const minute = normalized % 60;
35751
+ return `${hour.toString().padStart(2, "0")}:${minute.toString().padStart(2, "0")}`;
35752
+ };
35662
35753
  const formatHourLabel = (slotIndex) => {
35663
- const baseMinutes = parseTimeToMinutes5(shiftStart);
35754
+ const baseMinutes = parseTimeToMinutes6(shiftStart);
35664
35755
  const absoluteMinutes = baseMinutes + slotIndex * 60;
35665
35756
  const hour24 = Math.floor(absoluteMinutes % (24 * 60) / 60);
35666
35757
  const ampm = hour24 >= 12 ? "PM" : "AM";
@@ -35672,7 +35763,7 @@ var CycleTimeOverTimeChart = ({
35672
35763
  const endLabel = shiftEnd && slotIndex === DURATION - 1 ? formatHourLabel(slotIndex + 1) : formatHourLabel(slotIndex + 1);
35673
35764
  return `${startLabel} - ${endLabel}`;
35674
35765
  };
35675
- const getDisplayData = React146__default.useCallback((rawData) => {
35766
+ const getDisplayData = React147__default.useCallback((rawData) => {
35676
35767
  if (xAxisMode === "hourly") return rawData;
35677
35768
  return rawData.slice(Math.max(0, rawData.length - MAX_DATA_POINTS));
35678
35769
  }, [xAxisMode]);
@@ -35680,7 +35771,7 @@ var CycleTimeOverTimeChart = ({
35680
35771
  const DURATION = displayData.length;
35681
35772
  const effectiveDatasetKey = datasetKey || `cycle-time:${xAxisMode}`;
35682
35773
  const finalData = displayData;
35683
- const labelInterval = React146__default.useMemo(() => {
35774
+ const labelInterval = React147__default.useMemo(() => {
35684
35775
  if (xAxisMode === "hourly") {
35685
35776
  return Math.max(1, Math.ceil(DURATION / 8));
35686
35777
  }
@@ -35721,8 +35812,27 @@ var CycleTimeOverTimeChart = ({
35721
35812
  return `${minutes} minutes ${seconds} seconds ago`;
35722
35813
  }
35723
35814
  };
35724
- const getNumericValue = React146__default.useCallback((value) => typeof value === "number" && Number.isFinite(value) ? value : null, []);
35725
- const renderChartTooltip = React146__default.useCallback((tooltipProps) => {
35815
+ const getNumericValue = React147__default.useCallback((value) => typeof value === "number" && Number.isFinite(value) ? value : null, []);
35816
+ const buildHourClickPayload = React147__default.useCallback((dataPoint) => {
35817
+ if (!onHourClick || xAxisMode !== "hourly") {
35818
+ return null;
35819
+ }
35820
+ const hourIndex = Number.isFinite(dataPoint?.hourIndex) ? Number(dataPoint.hourIndex) : 0;
35821
+ const slotStart = parseTimeToMinutes6(shiftStart) + hourIndex * 60;
35822
+ const slotEnd = shiftEnd && hourIndex === DURATION - 1 ? parseTimeToMinutes6(shiftEnd) : slotStart + 60;
35823
+ const cycleTime = getNumericValue(dataPoint?.cycleTime);
35824
+ return {
35825
+ hourIndex,
35826
+ timeRange: dataPoint?.timeRange || dataPoint?.tooltip || formatTooltipTime(hourIndex),
35827
+ startTime: formatMinutesAsTimeFilter2(slotStart),
35828
+ endTime: formatMinutesAsTimeFilter2(slotEnd),
35829
+ cycleTime,
35830
+ idealCycleTime,
35831
+ idleMinutes: getNumericValue(dataPoint?.idleMinutes),
35832
+ status: cycleTime !== null && cycleTime <= idealCycleTime ? "within_standard" : "above_standard"
35833
+ };
35834
+ }, [DURATION, getNumericValue, idealCycleTime, onHourClick, shiftEnd, shiftStart, xAxisMode]);
35835
+ const renderChartTooltip = React147__default.useCallback((tooltipProps) => {
35726
35836
  const { active, payload } = tooltipProps;
35727
35837
  if (!active || !Array.isArray(payload) || payload.length === 0) {
35728
35838
  return null;
@@ -35781,29 +35891,31 @@ var CycleTimeOverTimeChart = ({
35781
35891
  " mins)"
35782
35892
  ] }) })
35783
35893
  ] }, index)) })
35784
- ] })
35894
+ ] }),
35895
+ onHourClick && xAxisMode === "hourly" && /* @__PURE__ */ jsx("div", { className: "border-t border-blue-100 pt-2", children: /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-blue-100 bg-blue-50 px-3 py-2 text-xs font-semibold text-blue-700", children: "Click to inspect hour" }) })
35785
35896
  ] })
35786
35897
  ] });
35787
- }, [getNumericValue, shiftStart, showIdleTime]);
35788
- const renderCycleDot = React146__default.useCallback((props) => {
35898
+ }, [getNumericValue, onHourClick, shiftStart, showIdleTime, xAxisMode]);
35899
+ const renderCycleDot = React147__default.useCallback((props) => {
35789
35900
  const { cx: cx2, cy, payload } = props;
35790
35901
  const cycleTime = getNumericValue(payload?.cycleTime);
35791
35902
  if (cycleTime === null) {
35792
35903
  return /* @__PURE__ */ jsx("g", {});
35793
35904
  }
35905
+ const isSelected = selectedHourIndex === payload?.hourIndex;
35794
35906
  return /* @__PURE__ */ jsx(
35795
35907
  "circle",
35796
35908
  {
35797
35909
  cx: cx2,
35798
35910
  cy,
35799
- r: 4,
35911
+ r: isSelected ? 6 : 4,
35800
35912
  fill: cycleTime <= idealCycleTime ? "#00AB45" : "#E34329",
35801
- stroke: "#fff",
35802
- strokeWidth: 1,
35913
+ stroke: isSelected ? "#0f172a" : "#fff",
35914
+ strokeWidth: isSelected ? 2 : 1,
35803
35915
  style: {
35804
- filter: "brightness(1)",
35916
+ filter: isSelected ? "drop-shadow(0 0 3px rgba(15,23,42,0.35)) brightness(1.1)" : "brightness(1)",
35805
35917
  transition: "filter 0.3s ease, transform 0.3s ease",
35806
- cursor: "pointer"
35918
+ cursor: onHourClick ? "pointer" : "default"
35807
35919
  },
35808
35920
  onMouseEnter: (e) => {
35809
35921
  const target = e.target;
@@ -35812,34 +35924,48 @@ var CycleTimeOverTimeChart = ({
35812
35924
  },
35813
35925
  onMouseLeave: (e) => {
35814
35926
  const target = e.target;
35815
- target.style.filter = "brightness(1)";
35816
- target.style.transform = "scale(1)";
35927
+ target.style.filter = isSelected ? "drop-shadow(0 0 3px rgba(15,23,42,0.35)) brightness(1.1)" : "brightness(1)";
35928
+ target.style.transform = isSelected ? "scale(1.1)" : "scale(1)";
35929
+ },
35930
+ onClick: () => {
35931
+ const clickPayload = buildHourClickPayload(payload);
35932
+ if (clickPayload) {
35933
+ onHourClick?.(clickPayload);
35934
+ }
35817
35935
  }
35818
35936
  }
35819
35937
  );
35820
- }, [getNumericValue, idealCycleTime]);
35821
- const renderCycleActiveDot = React146__default.useCallback((props) => {
35938
+ }, [buildHourClickPayload, getNumericValue, idealCycleTime, onHourClick, selectedHourIndex]);
35939
+ const renderCycleActiveDot = React147__default.useCallback((props) => {
35822
35940
  const { cx: cx2, cy, payload } = props;
35823
35941
  const cycleTime = getNumericValue(payload?.cycleTime);
35824
35942
  if (cycleTime === null) {
35825
35943
  return /* @__PURE__ */ jsx("g", {});
35826
35944
  }
35945
+ const isSelected = selectedHourIndex === payload?.hourIndex;
35827
35946
  return /* @__PURE__ */ jsx(
35828
35947
  "circle",
35829
35948
  {
35830
35949
  cx: cx2,
35831
35950
  cy,
35832
- r: 6,
35951
+ r: isSelected ? 7 : 6,
35833
35952
  fill: cycleTime <= idealCycleTime ? "#00AB45" : "#E34329",
35834
- stroke: "#fff",
35953
+ stroke: isSelected ? "#0f172a" : "#fff",
35835
35954
  strokeWidth: 2,
35836
35955
  style: {
35837
- filter: "drop-shadow(0 0 2px rgba(0,0,0,0.2))"
35956
+ filter: "drop-shadow(0 0 2px rgba(0,0,0,0.2))",
35957
+ cursor: onHourClick ? "pointer" : "default"
35958
+ },
35959
+ onClick: () => {
35960
+ const clickPayload = buildHourClickPayload(payload);
35961
+ if (clickPayload) {
35962
+ onHourClick?.(clickPayload);
35963
+ }
35838
35964
  }
35839
35965
  }
35840
35966
  );
35841
- }, [getNumericValue, idealCycleTime]);
35842
- const renderIdleDot = React146__default.useCallback((props) => {
35967
+ }, [buildHourClickPayload, getNumericValue, idealCycleTime, onHourClick, selectedHourIndex]);
35968
+ const renderIdleDot = React147__default.useCallback((props) => {
35843
35969
  const { cx: cx2, cy, payload } = props;
35844
35970
  const idleMinutes = getNumericValue(payload?.idleMinutes);
35845
35971
  if (idleMinutes === null) {
@@ -35861,7 +35987,7 @@ var CycleTimeOverTimeChart = ({
35861
35987
  }
35862
35988
  );
35863
35989
  }, [getNumericValue, showIdleTime]);
35864
- const renderIdleActiveDot = React146__default.useCallback((props) => {
35990
+ const renderIdleActiveDot = React147__default.useCallback((props) => {
35865
35991
  const { cx: cx2, cy, payload } = props;
35866
35992
  const idleMinutes = getNumericValue(payload?.idleMinutes);
35867
35993
  if (idleMinutes === null || !showIdleTime) {
@@ -35879,7 +36005,7 @@ var CycleTimeOverTimeChart = ({
35879
36005
  }
35880
36006
  );
35881
36007
  }, [getNumericValue, showIdleTime]);
35882
- const chartData = React146__default.useMemo(() => Array.from({ length: DURATION }, (_, i) => {
36008
+ const chartData = React147__default.useMemo(() => Array.from({ length: DURATION }, (_, i) => {
35883
36009
  const cycleTime = getNumericValue(finalData[i]);
35884
36010
  const useIdleSlots = idleTimeSlots.length > 0;
35885
36011
  const idleSlot = useIdleSlots ? idleTimeSlots[i] ?? null : null;
@@ -36076,7 +36202,7 @@ var CycleTimeOverTimeChart = ({
36076
36202
  }
36077
36203
  );
36078
36204
  };
36079
- var Card = React146.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
36205
+ var Card = React147.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
36080
36206
  "div",
36081
36207
  {
36082
36208
  ref,
@@ -36088,7 +36214,7 @@ var Card = React146.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
36088
36214
  }
36089
36215
  ));
36090
36216
  Card.displayName = "Card";
36091
- var CardHeader = React146.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
36217
+ var CardHeader = React147.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
36092
36218
  "div",
36093
36219
  {
36094
36220
  ref,
@@ -36097,7 +36223,7 @@ var CardHeader = React146.forwardRef(({ className, ...props }, ref) => /* @__PUR
36097
36223
  }
36098
36224
  ));
36099
36225
  CardHeader.displayName = "CardHeader";
36100
- var CardTitle = React146.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
36226
+ var CardTitle = React147.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
36101
36227
  "h3",
36102
36228
  {
36103
36229
  ref,
@@ -36109,7 +36235,7 @@ var CardTitle = React146.forwardRef(({ className, ...props }, ref) => /* @__PURE
36109
36235
  }
36110
36236
  ));
36111
36237
  CardTitle.displayName = "CardTitle";
36112
- var CardDescription = React146.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
36238
+ var CardDescription = React147.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
36113
36239
  "p",
36114
36240
  {
36115
36241
  ref,
@@ -36118,9 +36244,9 @@ var CardDescription = React146.forwardRef(({ className, ...props }, ref) => /* @
36118
36244
  }
36119
36245
  ));
36120
36246
  CardDescription.displayName = "CardDescription";
36121
- var CardContent = React146.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
36247
+ var CardContent = React147.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
36122
36248
  CardContent.displayName = "CardContent";
36123
- var CardFooter = React146.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
36249
+ var CardFooter = React147.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
36124
36250
  "div",
36125
36251
  {
36126
36252
  ref,
@@ -36196,7 +36322,7 @@ var buttonVariants = cva(
36196
36322
  }
36197
36323
  }
36198
36324
  );
36199
- var Button = React146.forwardRef(
36325
+ var Button = React147.forwardRef(
36200
36326
  ({ className, variant, size, asChild = false, ...props }, ref) => {
36201
36327
  const Comp = asChild ? Slot : "button";
36202
36328
  return /* @__PURE__ */ jsx(
@@ -36906,6 +37032,35 @@ var buildCompactSkuRailLabel = (label, maxChars) => {
36906
37032
  }
36907
37033
  return acronym || firstWord;
36908
37034
  };
37035
+ var parseTimeToMinutes3 = (timeValue) => {
37036
+ const [hourPart, minutePart] = timeValue.split(":");
37037
+ const hour = Number.parseInt(hourPart, 10);
37038
+ const minute = Number.parseInt(minutePart ?? "0", 10);
37039
+ const safeHour = Number.isFinite(hour) ? hour : 0;
37040
+ const safeMinute = Number.isFinite(minute) ? minute : 0;
37041
+ return safeHour * 60 + safeMinute;
37042
+ };
37043
+ var formatMinutesAsTimeFilter = (totalMinutes) => {
37044
+ const minutesInDay = 24 * 60;
37045
+ const normalized = (Math.round(totalMinutes) % minutesInDay + minutesInDay) % minutesInDay;
37046
+ const hour = Math.floor(normalized / 60);
37047
+ const minute = normalized % 60;
37048
+ return `${hour.toString().padStart(2, "0")}:${minute.toString().padStart(2, "0")}`;
37049
+ };
37050
+ var buildHourClipFilterWindow = ({
37051
+ shiftStart,
37052
+ shiftEnd,
37053
+ hourIndex,
37054
+ slotCount
37055
+ }) => {
37056
+ const startMinutes = parseTimeToMinutes3(shiftStart) + hourIndex * 60;
37057
+ const isLastSlot = hourIndex === slotCount - 1;
37058
+ const endMinutes = isLastSlot && shiftEnd ? parseTimeToMinutes3(shiftEnd) : startMinutes + 60;
37059
+ return {
37060
+ startTime: formatMinutesAsTimeFilter(startMinutes),
37061
+ endTime: formatMinutesAsTimeFilter(endMinutes)
37062
+ };
37063
+ };
36909
37064
  var HourlyOutputChartComponent = ({
36910
37065
  data,
36911
37066
  pphThreshold,
@@ -36919,13 +37074,20 @@ var HourlyOutputChartComponent = ({
36919
37074
  timezone,
36920
37075
  skuSegments,
36921
37076
  activeSkuId,
37077
+ selectedHourIndex = null,
37078
+ onHourClick,
37079
+ onWatchClipsClick,
37080
+ onAiSummaryClick,
36922
37081
  className = ""
36923
37082
  }) => {
36924
- const containerRef = React146__default.useRef(null);
36925
- const [containerReady, setContainerReady] = React146__default.useState(false);
36926
- const [containerWidth, setContainerWidth] = React146__default.useState(0);
36927
- const [hoveredSkuRailLabel, setHoveredSkuRailLabel] = React146__default.useState(null);
36928
- const idleSlots = React146__default.useMemo(
37083
+ const containerRef = React147__default.useRef(null);
37084
+ const [containerReady, setContainerReady] = React147__default.useState(false);
37085
+ const [containerWidth, setContainerWidth] = React147__default.useState(0);
37086
+ const [hoveredSkuRailLabel, setHoveredSkuRailLabel] = React147__default.useState(null);
37087
+ const [isTooltipHovered, setIsTooltipHovered] = React147__default.useState(false);
37088
+ const lastTooltipDataRef = React147__default.useRef(null);
37089
+ const tooltipHoverTimeoutRef = React147__default.useRef(null);
37090
+ const idleSlots = React147__default.useMemo(
36929
37091
  () => buildHourlyIdleSlots({
36930
37092
  idleTimeHourly,
36931
37093
  shiftStart,
@@ -36934,12 +37096,12 @@ var HourlyOutputChartComponent = ({
36934
37096
  [idleTimeHourly, shiftStart, shiftEnd]
36935
37097
  );
36936
37098
  const SHIFT_DURATION = idleSlots.length;
36937
- const [animatedData, setAnimatedData] = React146__default.useState(
37099
+ const [animatedData, setAnimatedData] = React147__default.useState(
36938
37100
  () => Array(SHIFT_DURATION).fill(0)
36939
37101
  );
36940
- const prevDataRef = React146__default.useRef(Array(SHIFT_DURATION).fill(0));
36941
- const animationFrameRef = React146__default.useRef(null);
36942
- React146__default.useEffect(() => {
37102
+ const prevDataRef = React147__default.useRef(Array(SHIFT_DURATION).fill(0));
37103
+ const animationFrameRef = React147__default.useRef(null);
37104
+ React147__default.useEffect(() => {
36943
37105
  setAnimatedData((prev) => {
36944
37106
  if (prev.length !== SHIFT_DURATION) {
36945
37107
  return Array(SHIFT_DURATION).fill(0);
@@ -36948,14 +37110,14 @@ var HourlyOutputChartComponent = ({
36948
37110
  });
36949
37111
  prevDataRef.current = Array(SHIFT_DURATION).fill(0);
36950
37112
  }, [SHIFT_DURATION]);
36951
- const [idleBarState, setIdleBarState] = React146__default.useState({
37113
+ const [idleBarState, setIdleBarState] = React147__default.useState({
36952
37114
  visible: showIdleTime,
36953
37115
  key: 0,
36954
37116
  shouldAnimate: false
36955
37117
  });
36956
- const prevShowIdleTimeRef = React146__default.useRef(showIdleTime);
36957
- const stateUpdateTimeoutRef = React146__default.useRef(null);
36958
- React146__default.useEffect(() => {
37118
+ const prevShowIdleTimeRef = React147__default.useRef(showIdleTime);
37119
+ const stateUpdateTimeoutRef = React147__default.useRef(null);
37120
+ React147__default.useEffect(() => {
36959
37121
  if (stateUpdateTimeoutRef.current) {
36960
37122
  clearTimeout(stateUpdateTimeoutRef.current);
36961
37123
  }
@@ -36980,7 +37142,7 @@ var HourlyOutputChartComponent = ({
36980
37142
  }
36981
37143
  };
36982
37144
  }, [showIdleTime]);
36983
- const animateToNewData = React146__default.useCallback((targetData) => {
37145
+ const animateToNewData = React147__default.useCallback((targetData) => {
36984
37146
  const startData = [...prevDataRef.current];
36985
37147
  const startTime = performance.now();
36986
37148
  const duration = 1200;
@@ -37010,7 +37172,7 @@ var HourlyOutputChartComponent = ({
37010
37172
  }
37011
37173
  animationFrameRef.current = requestAnimationFrame(animate);
37012
37174
  }, []);
37013
- React146__default.useEffect(() => {
37175
+ React147__default.useEffect(() => {
37014
37176
  if (JSON.stringify(data) !== JSON.stringify(prevDataRef.current)) {
37015
37177
  const shiftData = data.slice(0, SHIFT_DURATION);
37016
37178
  animateToNewData(shiftData);
@@ -37021,7 +37183,14 @@ var HourlyOutputChartComponent = ({
37021
37183
  }
37022
37184
  };
37023
37185
  }, [data, animateToNewData]);
37024
- React146__default.useEffect(() => {
37186
+ React147__default.useEffect(() => {
37187
+ return () => {
37188
+ if (tooltipHoverTimeoutRef.current) {
37189
+ clearTimeout(tooltipHoverTimeoutRef.current);
37190
+ }
37191
+ };
37192
+ }, []);
37193
+ React147__default.useEffect(() => {
37025
37194
  const checkContainerDimensions = () => {
37026
37195
  if (containerRef.current) {
37027
37196
  const rect = containerRef.current.getBoundingClientRect();
@@ -37047,7 +37216,7 @@ var HourlyOutputChartComponent = ({
37047
37216
  clearTimeout(fallbackTimeout);
37048
37217
  };
37049
37218
  }, []);
37050
- const xAxisConfig = React146__default.useMemo(() => {
37219
+ const xAxisConfig = React147__default.useMemo(() => {
37051
37220
  if (containerWidth >= 960) {
37052
37221
  return {
37053
37222
  interval: 0,
@@ -37068,13 +37237,13 @@ var HourlyOutputChartComponent = ({
37068
37237
  }
37069
37238
  return { interval: 0, angle: -30, height: 64, tickFont: 9, tickMargin: 6 };
37070
37239
  }, [containerWidth]);
37071
- const shiftWindow = React146__default.useMemo(() => resolveShiftWindow2({
37240
+ const shiftWindow = React147__default.useMemo(() => resolveShiftWindow2({
37072
37241
  shiftStart,
37073
37242
  slotCount: SHIFT_DURATION,
37074
37243
  shiftDate,
37075
37244
  timezone
37076
37245
  }), [shiftStart, shiftEnd, SHIFT_DURATION, shiftDate, timezone]);
37077
- const fallbackTimelineEndOffset = React146__default.useMemo(
37246
+ const fallbackTimelineEndOffset = React147__default.useMemo(
37078
37247
  () => resolveTimelineEndOffset({
37079
37248
  shiftStart,
37080
37249
  shiftEnd,
@@ -37084,7 +37253,7 @@ var HourlyOutputChartComponent = ({
37084
37253
  }),
37085
37254
  [shiftStart, shiftEnd, SHIFT_DURATION, shiftDate, timezone]
37086
37255
  );
37087
- const observedTimelineEndOffset = React146__default.useMemo(() => {
37256
+ const observedTimelineEndOffset = React147__default.useMemo(() => {
37088
37257
  let lastObservedMinute = -1;
37089
37258
  idleSlots.forEach((slot) => {
37090
37259
  slot.idleArray.forEach((value, minuteIndex) => {
@@ -37100,7 +37269,7 @@ var HourlyOutputChartComponent = ({
37100
37269
  return Math.min((lastObservedMinute + 1) / 60, SHIFT_DURATION);
37101
37270
  }, [idleSlots, SHIFT_DURATION]);
37102
37271
  const timelineEndOffset = observedTimelineEndOffset ?? fallbackTimelineEndOffset;
37103
- const targetLineEndOffset = React146__default.useMemo(() => {
37272
+ const targetLineEndOffset = React147__default.useMemo(() => {
37104
37273
  if (timelineEndOffset >= SHIFT_DURATION) {
37105
37274
  return SHIFT_DURATION;
37106
37275
  }
@@ -37109,7 +37278,7 @@ var HourlyOutputChartComponent = ({
37109
37278
  }
37110
37279
  return Math.min(Math.floor(timelineEndOffset) + 1, SHIFT_DURATION);
37111
37280
  }, [timelineEndOffset, SHIFT_DURATION]);
37112
- const skuTimelineSegments = React146__default.useMemo(() => {
37281
+ const skuTimelineSegments = React147__default.useMemo(() => {
37113
37282
  if (!skuSegments || skuSegments.length === 0 || !shiftWindow || timelineEndOffset <= 0) {
37114
37283
  return [];
37115
37284
  }
@@ -37143,18 +37312,18 @@ var HourlyOutputChartComponent = ({
37143
37312
  };
37144
37313
  }).filter((segment) => segment.end > segment.start);
37145
37314
  }, [skuSegments, shiftWindow, timelineEndOffset, pphThreshold]);
37146
- const targetTimelineSegments = React146__default.useMemo(() => {
37315
+ const targetTimelineSegments = React147__default.useMemo(() => {
37147
37316
  if (skuTimelineSegments.length === 0) return [];
37148
37317
  return skuTimelineSegments.map((segment, index) => ({
37149
37318
  ...segment,
37150
37319
  end: index === skuTimelineSegments.length - 1 ? Math.max(segment.start, targetLineEndOffset) : segment.end
37151
37320
  })).filter((segment) => segment.end > segment.start);
37152
37321
  }, [skuTimelineSegments, targetLineEndOffset]);
37153
- const hasExplicitHourlyTargetOutputProp = React146__default.useMemo(
37322
+ const hasExplicitHourlyTargetOutputProp = React147__default.useMemo(
37154
37323
  () => hourlyTargetOutput !== void 0,
37155
37324
  [hourlyTargetOutput]
37156
37325
  );
37157
- const fallbackHourlyTargetOutput = React146__default.useMemo(() => {
37326
+ const fallbackHourlyTargetOutput = React147__default.useMemo(() => {
37158
37327
  if (hasExplicitHourlyTargetOutputProp) return void 0;
37159
37328
  if (skuTimelineSegments.length > 0) return void 0;
37160
37329
  const plan = buildHourlyTargetPlan({
@@ -37174,19 +37343,19 @@ var HourlyOutputChartComponent = ({
37174
37343
  shiftBreaks,
37175
37344
  pphThreshold
37176
37345
  ]);
37177
- const effectiveHourlyTargetOutput = React146__default.useMemo(
37346
+ const effectiveHourlyTargetOutput = React147__default.useMemo(
37178
37347
  () => hasExplicitHourlyTargetOutputProp ? hourlyTargetOutput : fallbackHourlyTargetOutput,
37179
37348
  [hasExplicitHourlyTargetOutputProp, hourlyTargetOutput, fallbackHourlyTargetOutput]
37180
37349
  );
37181
- const hasHourlyTargetOutputProp = React146__default.useMemo(
37350
+ const hasHourlyTargetOutputProp = React147__default.useMemo(
37182
37351
  () => effectiveHourlyTargetOutput !== void 0,
37183
37352
  [effectiveHourlyTargetOutput]
37184
37353
  );
37185
- const hasExplicitHourlyTargets = React146__default.useMemo(
37354
+ const hasExplicitHourlyTargets = React147__default.useMemo(
37186
37355
  () => Array.isArray(effectiveHourlyTargetOutput) && effectiveHourlyTargetOutput.some((value) => value !== null && value !== void 0),
37187
37356
  [effectiveHourlyTargetOutput]
37188
37357
  );
37189
- const hourlyTargetSegments = React146__default.useMemo(() => {
37358
+ const hourlyTargetSegments = React147__default.useMemo(() => {
37190
37359
  if (!hasExplicitHourlyTargets) return [];
37191
37360
  const segments = [];
37192
37361
  let runStart = null;
@@ -37218,7 +37387,7 @@ var HourlyOutputChartComponent = ({
37218
37387
  flush(SHIFT_DURATION);
37219
37388
  return segments.filter((segment) => segment.end > segment.start);
37220
37389
  }, [SHIFT_DURATION, hasExplicitHourlyTargets, effectiveHourlyTargetOutput]);
37221
- const activeSkuHourIndices = React146__default.useMemo(() => {
37390
+ const activeSkuHourIndices = React147__default.useMemo(() => {
37222
37391
  const indices = /* @__PURE__ */ new Set();
37223
37392
  const targets = Array(SHIFT_DURATION).fill(pphThreshold);
37224
37393
  if (!skuSegments || !shiftWindow) return { indices, targets, hasTimeline: false };
@@ -37251,13 +37420,14 @@ var HourlyOutputChartComponent = ({
37251
37420
  }
37252
37421
  return { indices, targets, hasTimeline: true };
37253
37422
  }, [skuSegments, activeSkuId, shiftWindow, SHIFT_DURATION, pphThreshold]);
37254
- const chartData = React146__default.useMemo(() => {
37423
+ const chartData = React147__default.useMemo(() => {
37255
37424
  const { indices, targets, hasTimeline } = activeSkuHourIndices;
37256
37425
  return Array.from({ length: SHIFT_DURATION }, (_, i) => {
37257
37426
  const idleSlot = idleSlots[i];
37258
37427
  const explicitTarget = hasHourlyTargetOutputProp ? effectiveHourlyTargetOutput?.[i] ?? null : void 0;
37259
37428
  const currentTarget = hasHourlyTargetOutputProp ? explicitTarget : targets[i] || pphThreshold;
37260
37429
  const outputForComparison = Math.round(animatedData[i] || 0);
37430
+ const actualOutputForComparison = Math.round(data[i] || 0);
37261
37431
  const comparisonTarget = currentTarget === null || currentTarget === void 0 ? targets[i] || pphThreshold : currentTarget;
37262
37432
  const targetForComparison = Math.round(comparisonTarget);
37263
37433
  return {
@@ -37272,12 +37442,14 @@ var HourlyOutputChartComponent = ({
37272
37442
  idleMinutes: idleSlot?.idleMinutes || 0,
37273
37443
  idleArray: idleSlot?.idleArray || [],
37274
37444
  skuIndex: i,
37445
+ isSelected: selectedHourIndex === (idleSlot?.hourIndex ?? i),
37275
37446
  isHighlighted: indices.has(i),
37276
- isDimmed: hasTimeline && !!activeSkuId && !indices.has(i)
37447
+ isDimmed: hasTimeline && !!activeSkuId && !indices.has(i),
37448
+ status: actualOutputForComparison >= targetForComparison ? "met_target" : "below_target"
37277
37449
  };
37278
37450
  });
37279
- }, [animatedData, data, pphThreshold, idleSlots, SHIFT_DURATION, activeSkuHourIndices, activeSkuId, effectiveHourlyTargetOutput, hasHourlyTargetOutputProp]);
37280
- const renderSkuTimelineRail = React146__default.useCallback((props) => {
37451
+ }, [animatedData, data, pphThreshold, idleSlots, SHIFT_DURATION, activeSkuHourIndices, activeSkuId, effectiveHourlyTargetOutput, hasHourlyTargetOutputProp, selectedHourIndex]);
37452
+ const renderSkuTimelineRail = React147__default.useCallback((props) => {
37281
37453
  if (!skuTimelineSegments.length || SHIFT_DURATION <= 0) return null;
37282
37454
  const offset = props?.offset;
37283
37455
  if (!offset) return null;
@@ -37426,7 +37598,7 @@ var HourlyOutputChartComponent = ({
37426
37598
  })
37427
37599
  ] });
37428
37600
  }, [skuTimelineSegments, SHIFT_DURATION, activeSkuId]);
37429
- const IdleBar = React146__default.useMemo(() => {
37601
+ const IdleBar = React147__default.useMemo(() => {
37430
37602
  if (!idleBarState.visible) return null;
37431
37603
  return /* @__PURE__ */ jsx(
37432
37604
  Bar,
@@ -37520,7 +37692,7 @@ var HourlyOutputChartComponent = ({
37520
37692
  }
37521
37693
  return filteredTicks;
37522
37694
  };
37523
- const renderTargetLine = React146__default.useCallback((props) => {
37695
+ const renderTargetLine = React147__default.useCallback((props) => {
37524
37696
  const { offset, yAxisMap } = props;
37525
37697
  if (!offset || !yAxisMap || SHIFT_DURATION <= 0 || targetLineEndOffset <= 0) return null;
37526
37698
  const { left, width } = offset;
@@ -37724,84 +37896,163 @@ var HourlyOutputChartComponent = ({
37724
37896
  Tooltip,
37725
37897
  {
37726
37898
  cursor: { fill: "#f1f5f9" },
37899
+ shared: false,
37900
+ offset: -5,
37901
+ wrapperStyle: { pointerEvents: "auto", zIndex: 100 },
37902
+ active: isTooltipHovered ? true : void 0,
37903
+ isAnimationActive: false,
37727
37904
  contentStyle: { backgroundColor: "transparent", border: "none", padding: 0 },
37728
37905
  content: (props) => {
37729
- if (!props.active || !props.payload || props.payload.length === 0)
37906
+ const activeData = props.active && props.payload && props.payload.length > 0 ? props.payload[0].payload : null;
37907
+ const data2 = activeData || (isTooltipHovered ? lastTooltipDataRef.current : null);
37908
+ if (!data2)
37730
37909
  return null;
37731
- const data2 = props.payload[0].payload;
37910
+ if (activeData) {
37911
+ lastTooltipDataRef.current = activeData;
37912
+ }
37732
37913
  const idlePeriods = showIdleTime ? getHourlyIdlePeriods({
37733
37914
  idleArray: data2.idleArray,
37734
37915
  shiftStart,
37735
37916
  hourIndex: Number.isFinite(data2.hourIndex) ? data2.hourIndex : 0
37736
37917
  }) : [];
37737
- return /* @__PURE__ */ jsxs("div", { className: "bg-white/95 backdrop-blur-md border border-slate-200/60 shadow-xl shadow-slate-200/40 rounded-xl p-4 min-w-[240px] text-slate-700", children: [
37738
- /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between mb-4 pb-3 border-b border-slate-100", children: /* @__PURE__ */ jsx("p", { className: "font-semibold text-slate-900 text-sm tracking-tight", children: data2.timeRange }) }),
37739
- /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
37740
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
37741
- /* @__PURE__ */ jsx("span", { className: "text-sm text-slate-500 font-medium tracking-wide", children: "Output" }),
37742
- /* @__PURE__ */ jsxs("span", { className: "font-bold text-slate-900 text-sm", children: [
37743
- Math.round(data2.output),
37744
- " ",
37745
- /* @__PURE__ */ jsx("span", { className: "text-slate-400 font-normal text-xs ml-0.5", children: "units" })
37746
- ] })
37747
- ] }),
37748
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
37749
- /* @__PURE__ */ jsx("span", { className: "text-sm text-slate-500 font-medium tracking-wide", children: "Target" }),
37750
- /* @__PURE__ */ jsxs("span", { className: "font-bold text-slate-700 text-sm", children: [
37751
- Math.round(data2.target),
37752
- " ",
37753
- /* @__PURE__ */ jsx("span", { className: "text-slate-400 font-normal text-xs ml-0.5", children: "units" })
37754
- ] })
37755
- ] }),
37756
- showIdleTime && data2.idleMinutes > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
37757
- /* @__PURE__ */ jsx("div", { className: "pt-3 mt-3 border-t border-slate-100", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
37758
- /* @__PURE__ */ jsx("span", { className: "text-sm text-slate-500 font-medium tracking-wide", children: "Idle Time" }),
37759
- /* @__PURE__ */ jsxs("span", { className: "font-bold text-orange-600 text-sm flex items-center gap-1.5", children: [
37760
- /* @__PURE__ */ jsx("span", { className: "w-1.5 h-1.5 rounded-full bg-orange-500 shadow-[0_0_6px_rgba(249,115,22,0.6)] animate-pulse" }),
37761
- data2.idleMinutes,
37762
- " ",
37763
- /* @__PURE__ */ jsx("span", { className: "text-orange-500/70 font-normal text-xs ml-0.5", children: "min" })
37764
- ] })
37765
- ] }) }),
37766
- idlePeriods.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mt-3 bg-slate-50/80 rounded-lg p-3 border border-slate-100/50", children: [
37767
- /* @__PURE__ */ jsx("p", { className: "font-semibold text-slate-400 text-[10px] mb-2.5 uppercase tracking-wider", children: "Idle Periods" }),
37768
- /* @__PURE__ */ jsx("div", { className: "space-y-2.5 max-h-32 overflow-y-auto pr-1 custom-scrollbar", children: idlePeriods.map((period, index) => {
37769
- return /* @__PURE__ */ jsxs(
37770
- "div",
37771
- {
37772
- className: "flex items-start gap-2.5 text-xs",
37773
- children: [
37774
- /* @__PURE__ */ jsx("div", { className: "mt-[5px] w-1.5 h-1.5 bg-orange-400 rounded-full flex-shrink-0 shadow-[0_0_4px_rgba(251,146,60,0.5)]" }),
37775
- /* @__PURE__ */ jsx("span", { className: "text-slate-700 font-medium tracking-tight", children: period.duration === 1 ? /* @__PURE__ */ jsxs(Fragment, { children: [
37776
- period.startTime,
37777
- " ",
37778
- /* @__PURE__ */ jsxs("span", { className: "text-slate-400 font-normal ml-1", children: [
37779
- "(",
37780
- period.duration,
37781
- "m)"
37782
- ] })
37783
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
37784
- period.startTime,
37785
- " ",
37786
- /* @__PURE__ */ jsx("span", { className: "text-slate-400 mx-0.5", children: "\u2192" }),
37787
- " ",
37788
- period.endTime,
37789
- " ",
37790
- /* @__PURE__ */ jsxs("span", { className: "text-slate-400 font-normal ml-1", children: [
37791
- "(",
37792
- period.duration,
37793
- "m)"
37794
- ] })
37795
- ] }) })
37796
- ]
37918
+ const tooltipHourIndex = Number.isFinite(data2.hourIndex) ? data2.hourIndex : 0;
37919
+ const { startTime, endTime } = buildHourClipFilterWindow({
37920
+ shiftStart,
37921
+ shiftEnd,
37922
+ hourIndex: tooltipHourIndex,
37923
+ slotCount: SHIFT_DURATION
37924
+ });
37925
+ const clickPayload = {
37926
+ hourIndex: tooltipHourIndex,
37927
+ timeRange: data2.timeRange,
37928
+ startTime,
37929
+ endTime,
37930
+ output: Math.round(data2.originalOutput || 0),
37931
+ target: data2.target,
37932
+ status: data2.status
37933
+ };
37934
+ return /* @__PURE__ */ jsx(
37935
+ "div",
37936
+ {
37937
+ className: "p-3 -m-3 pointer-events-auto",
37938
+ style: { cursor: "default" },
37939
+ onMouseEnter: () => {
37940
+ if (tooltipHoverTimeoutRef.current) {
37941
+ clearTimeout(tooltipHoverTimeoutRef.current);
37942
+ tooltipHoverTimeoutRef.current = null;
37943
+ }
37944
+ setIsTooltipHovered(true);
37945
+ },
37946
+ onMouseLeave: () => {
37947
+ if (tooltipHoverTimeoutRef.current) {
37948
+ clearTimeout(tooltipHoverTimeoutRef.current);
37949
+ }
37950
+ tooltipHoverTimeoutRef.current = setTimeout(() => {
37951
+ setIsTooltipHovered(false);
37952
+ tooltipHoverTimeoutRef.current = null;
37953
+ }, 120);
37954
+ },
37955
+ children: /* @__PURE__ */ jsxs("div", { className: "bg-white/95 backdrop-blur-md border border-slate-200/60 shadow-xl shadow-slate-200/40 rounded-xl p-4 min-w-[240px] text-slate-700 pointer-events-auto", children: [
37956
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-4 pb-3 border-b border-slate-100", children: [
37957
+ /* @__PURE__ */ jsx("p", { className: "font-semibold text-slate-900 text-sm tracking-tight", children: data2.timeRange }),
37958
+ onAiSummaryClick && /* @__PURE__ */ jsxs(
37959
+ "button",
37960
+ {
37961
+ onClick: (e) => {
37962
+ e.stopPropagation();
37963
+ onAiSummaryClick(clickPayload);
37964
+ },
37965
+ className: "flex items-center gap-1 px-2 py-1 -mr-1 rounded-md border border-slate-200 bg-white hover:bg-slate-50 text-[11px] font-medium text-slate-600 shadow-sm transition-colors",
37966
+ children: [
37967
+ /* @__PURE__ */ jsx(SparklesIcon, { className: "w-3.5 h-3.5" }),
37968
+ "Ask AI"
37969
+ ]
37970
+ }
37971
+ )
37972
+ ] }),
37973
+ /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
37974
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
37975
+ /* @__PURE__ */ jsx("span", { className: "text-sm text-slate-500 font-medium tracking-wide", children: "Output" }),
37976
+ /* @__PURE__ */ jsxs("span", { className: "font-bold text-slate-900 text-sm", children: [
37977
+ Math.round(data2.output),
37978
+ " ",
37979
+ /* @__PURE__ */ jsx("span", { className: "text-slate-400 font-normal text-xs ml-0.5", children: "units" })
37980
+ ] })
37981
+ ] }),
37982
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
37983
+ /* @__PURE__ */ jsx("span", { className: "text-sm text-slate-500 font-medium tracking-wide", children: "Target" }),
37984
+ /* @__PURE__ */ jsxs("span", { className: "font-bold text-slate-700 text-sm", children: [
37985
+ Math.round(data2.target),
37986
+ " ",
37987
+ /* @__PURE__ */ jsx("span", { className: "text-slate-400 font-normal text-xs ml-0.5", children: "units" })
37988
+ ] })
37989
+ ] }),
37990
+ showIdleTime && data2.idleMinutes > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
37991
+ /* @__PURE__ */ jsx("div", { className: "pt-3 mt-3 border-t border-slate-100", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
37992
+ /* @__PURE__ */ jsx("span", { className: "text-sm text-slate-500 font-medium tracking-wide", children: "Idle Time" }),
37993
+ /* @__PURE__ */ jsxs("span", { className: "font-bold text-orange-600 text-sm flex items-center gap-1.5", children: [
37994
+ /* @__PURE__ */ jsx("span", { className: "w-1.5 h-1.5 rounded-full bg-orange-500 shadow-[0_0_6px_rgba(249,115,22,0.6)] animate-pulse" }),
37995
+ data2.idleMinutes,
37996
+ " ",
37997
+ /* @__PURE__ */ jsx("span", { className: "text-orange-500/70 font-normal text-xs ml-0.5", children: "min" })
37998
+ ] })
37999
+ ] }) }),
38000
+ idlePeriods.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mt-3 bg-slate-50/80 rounded-lg p-3 border border-slate-100/50", children: [
38001
+ /* @__PURE__ */ jsx("p", { className: "font-semibold text-slate-400 text-[10px] mb-2.5 uppercase tracking-wider", children: "Idle Periods" }),
38002
+ /* @__PURE__ */ jsx("div", { className: "space-y-2.5 max-h-32 overflow-y-auto pr-1 custom-scrollbar", children: idlePeriods.map((period, index) => {
38003
+ return /* @__PURE__ */ jsxs(
38004
+ "div",
38005
+ {
38006
+ className: "flex items-start gap-2.5 text-xs",
38007
+ children: [
38008
+ /* @__PURE__ */ jsx("div", { className: "mt-[5px] w-1.5 h-1.5 bg-orange-400 rounded-full flex-shrink-0 shadow-[0_0_4px_rgba(251,146,60,0.5)]" }),
38009
+ /* @__PURE__ */ jsx("span", { className: "text-slate-700 font-medium tracking-tight", children: period.duration === 1 ? /* @__PURE__ */ jsxs(Fragment, { children: [
38010
+ period.startTime,
38011
+ " ",
38012
+ /* @__PURE__ */ jsxs("span", { className: "text-slate-400 font-normal ml-1", children: [
38013
+ "(",
38014
+ period.duration,
38015
+ "m)"
38016
+ ] })
38017
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
38018
+ period.startTime,
38019
+ " ",
38020
+ /* @__PURE__ */ jsx("span", { className: "text-slate-400 mx-0.5", children: "\u2192" }),
38021
+ " ",
38022
+ period.endTime,
38023
+ " ",
38024
+ /* @__PURE__ */ jsxs("span", { className: "text-slate-400 font-normal ml-1", children: [
38025
+ "(",
38026
+ period.duration,
38027
+ "m)"
38028
+ ] })
38029
+ ] }) })
38030
+ ]
38031
+ },
38032
+ index
38033
+ );
38034
+ }) })
38035
+ ] })
38036
+ ] }),
38037
+ onWatchClipsClick && /* @__PURE__ */ jsx("div", { className: "pt-3 mt-3 border-t border-slate-100 flex items-center", children: /* @__PURE__ */ jsxs(
38038
+ "button",
38039
+ {
38040
+ onClick: (e) => {
38041
+ e.stopPropagation();
38042
+ onWatchClipsClick(clickPayload);
37797
38043
  },
37798
- index
37799
- );
37800
- }) })
38044
+ className: "w-full rounded-md border border-slate-200 bg-white hover:bg-slate-50 px-2 py-1.5 text-xs font-semibold text-slate-700 transition-colors flex items-center justify-center gap-1.5 shadow-sm",
38045
+ children: [
38046
+ /* @__PURE__ */ jsx(PlayCircleIcon, { className: "w-4 h-4 text-blue-500" }),
38047
+ "Watch Clips"
38048
+ ]
38049
+ }
38050
+ ) }),
38051
+ onHourClick && !onWatchClipsClick && !onAiSummaryClick && /* @__PURE__ */ jsx("div", { className: "pt-3 mt-3 border-t border-slate-100", children: /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-blue-100 bg-blue-50/70 px-3 py-2 text-xs font-semibold text-blue-700 text-center", children: "Click to inspect hour" }) })
37801
38052
  ] })
37802
38053
  ] })
37803
- ] })
37804
- ] });
38054
+ }
38055
+ );
37805
38056
  },
37806
38057
  animationDuration: 200
37807
38058
  }
@@ -37822,14 +38073,14 @@ var HourlyOutputChartComponent = ({
37822
38073
  Cell,
37823
38074
  {
37824
38075
  fill: entry.color,
37825
- stroke: "transparent",
37826
- strokeWidth: 0,
38076
+ stroke: entry.isSelected ? "#0f172a" : "transparent",
38077
+ strokeWidth: entry.isSelected ? 2 : 0,
37827
38078
  style: {
37828
- filter: entry.isHighlighted ? "drop-shadow(0 4px 6px rgba(0, 0, 0, 0.12)) brightness(1.05)" : "brightness(1)",
37829
- transform: entry.isHighlighted ? "translateY(-4px)" : "translateY(0)",
38079
+ filter: entry.isHighlighted || entry.isSelected ? "drop-shadow(0 4px 6px rgba(0, 0, 0, 0.12)) brightness(1.05)" : "brightness(1)",
38080
+ transform: entry.isHighlighted || entry.isSelected ? "translateY(-4px)" : "translateY(0)",
37830
38081
  opacity: entry.isDimmed ? 0.4 : 1,
37831
38082
  transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
37832
- cursor: "pointer"
38083
+ cursor: onHourClick || onWatchClipsClick || onAiSummaryClick ? "pointer" : "default"
37833
38084
  },
37834
38085
  onMouseEnter: (e) => {
37835
38086
  const target = e.target;
@@ -37839,9 +38090,28 @@ var HourlyOutputChartComponent = ({
37839
38090
  },
37840
38091
  onMouseLeave: (e) => {
37841
38092
  const target = e.target;
37842
- target.style.filter = entry.isHighlighted ? "drop-shadow(0 4px 6px rgba(0, 0, 0, 0.12)) brightness(1.05)" : "brightness(1)";
37843
- target.style.transform = entry.isHighlighted ? "translateY(-4px)" : "translateY(0)";
38093
+ target.style.filter = entry.isHighlighted || entry.isSelected ? "drop-shadow(0 4px 6px rgba(0, 0, 0, 0.12)) brightness(1.05)" : "brightness(1)";
38094
+ target.style.transform = entry.isHighlighted || entry.isSelected ? "translateY(-4px)" : "translateY(0)";
37844
38095
  target.style.opacity = entry.isDimmed ? "0.4" : "1";
38096
+ },
38097
+ onClick: () => {
38098
+ if (!onHourClick && !onWatchClipsClick && !onAiSummaryClick) return;
38099
+ const { startTime, endTime } = buildHourClipFilterWindow({
38100
+ shiftStart,
38101
+ shiftEnd,
38102
+ hourIndex: entry.hourIndex,
38103
+ slotCount: SHIFT_DURATION
38104
+ });
38105
+ const payload = {
38106
+ hourIndex: entry.hourIndex,
38107
+ timeRange: entry.timeRange,
38108
+ startTime,
38109
+ endTime,
38110
+ output: Math.round(entry.originalOutput || 0),
38111
+ target: entry.target,
38112
+ status: entry.status
38113
+ };
38114
+ if (onHourClick) onHourClick(payload);
37845
38115
  }
37846
38116
  },
37847
38117
  `cell-${index}`
@@ -37923,10 +38193,10 @@ var HourlyOutputChartComponent = ({
37923
38193
  }
37924
38194
  );
37925
38195
  };
37926
- var HourlyOutputChart = React146__default.memo(
38196
+ var HourlyOutputChart = React147__default.memo(
37927
38197
  HourlyOutputChartComponent,
37928
38198
  (prevProps, nextProps) => {
37929
- if (prevProps.pphThreshold !== nextProps.pphThreshold || prevProps.shiftStart !== nextProps.shiftStart || prevProps.shiftEnd !== nextProps.shiftEnd || prevProps.shiftDate !== nextProps.shiftDate || prevProps.timezone !== nextProps.timezone || prevProps.showIdleTime !== nextProps.showIdleTime || prevProps.activeSkuId !== nextProps.activeSkuId || prevProps.className !== nextProps.className) {
38199
+ if (prevProps.pphThreshold !== nextProps.pphThreshold || prevProps.shiftStart !== nextProps.shiftStart || prevProps.shiftEnd !== nextProps.shiftEnd || prevProps.shiftDate !== nextProps.shiftDate || prevProps.timezone !== nextProps.timezone || prevProps.showIdleTime !== nextProps.showIdleTime || prevProps.activeSkuId !== nextProps.activeSkuId || prevProps.selectedHourIndex !== nextProps.selectedHourIndex || prevProps.onHourClick !== nextProps.onHourClick || prevProps.className !== nextProps.className) {
37930
38200
  return false;
37931
38201
  }
37932
38202
  if (prevProps.data.length !== nextProps.data.length) {
@@ -38377,7 +38647,7 @@ function getTrendArrowAndColor(trend) {
38377
38647
  return { arrow: "\u2192", color: "text-gray-400" };
38378
38648
  }
38379
38649
  }
38380
- var VideoCard = React146__default.memo(({
38650
+ var VideoCard = React147__default.memo(({
38381
38651
  workspace,
38382
38652
  hlsUrl,
38383
38653
  shouldPlay,
@@ -38647,7 +38917,7 @@ var hasRecentHealthSignal = (lastHeartbeat) => {
38647
38917
  if (!Number.isFinite(heartbeatMs)) return false;
38648
38918
  return Date.now() - heartbeatMs <= RECENT_HEALTH_SIGNAL_MS;
38649
38919
  };
38650
- var VideoGridView = React146__default.memo(({
38920
+ var VideoGridView = React147__default.memo(({
38651
38921
  workspaces,
38652
38922
  blueComparisonWorkspaces,
38653
38923
  selectedLine,
@@ -39086,7 +39356,7 @@ var VideoGridView = React146__default.memo(({
39086
39356
  ) });
39087
39357
  });
39088
39358
  VideoGridView.displayName = "VideoGridView";
39089
- var MapGridView = React146__default.memo(({
39359
+ var MapGridView = React147__default.memo(({
39090
39360
  workspaces,
39091
39361
  className = "",
39092
39362
  displayNames = {},
@@ -39307,13 +39577,13 @@ var WorkspaceMetricCardsImpl = ({
39307
39577
  liveSkuId
39308
39578
  }) => {
39309
39579
  const effectiveLegend = legend || DEFAULT_EFFICIENCY_LEGEND;
39310
- const activeSku = React146__default.useMemo(() => {
39580
+ const activeSku = React147__default.useMemo(() => {
39311
39581
  if (skuAware && activeSkuId && skuBreakdown) {
39312
39582
  return skuBreakdown.find((s) => s.sku_id === activeSkuId);
39313
39583
  }
39314
39584
  return null;
39315
39585
  }, [skuAware, activeSkuId, skuBreakdown]);
39316
- const displaySku = React146__default.useMemo(() => {
39586
+ const displaySku = React147__default.useMemo(() => {
39317
39587
  if (activeSku) return activeSku;
39318
39588
  if (skuAware && !activeSkuId && liveSkuId && skuBreakdown) {
39319
39589
  return skuBreakdown.find((s) => s.sku_id === liveSkuId) ?? null;
@@ -39966,7 +40236,7 @@ var UptimeLineChartComponent = ({ points, className = "" }) => {
39966
40236
  )
39967
40237
  ] }) }) });
39968
40238
  };
39969
- var UptimeLineChart = React146__default.memo(UptimeLineChartComponent);
40239
+ var UptimeLineChart = React147__default.memo(UptimeLineChartComponent);
39970
40240
  var getTimeFromTimeString = (timeStr) => {
39971
40241
  if (!timeStr) {
39972
40242
  return { hour: 0, minute: 0, decimalHour: 0 };
@@ -39990,10 +40260,10 @@ var HourlyUptimeChartComponent = ({
39990
40260
  shiftBreaks,
39991
40261
  className = ""
39992
40262
  }) => {
39993
- const containerRef = React146__default.useRef(null);
39994
- const [containerReady, setContainerReady] = React146__default.useState(false);
39995
- const [containerWidth, setContainerWidth] = React146__default.useState(0);
39996
- const uptimeSeries = React146__default.useMemo(() => buildUptimeSeries({
40263
+ const containerRef = React147__default.useRef(null);
40264
+ const [containerReady, setContainerReady] = React147__default.useState(false);
40265
+ const [containerWidth, setContainerWidth] = React147__default.useState(0);
40266
+ const uptimeSeries = React147__default.useMemo(() => buildUptimeSeries({
39997
40267
  idleTimeHourly,
39998
40268
  shiftStart,
39999
40269
  shiftEnd,
@@ -40003,11 +40273,11 @@ var HourlyUptimeChartComponent = ({
40003
40273
  shiftBreaks
40004
40274
  }), [idleTimeHourly, shiftStart, shiftEnd, shiftDate, timezone, elapsedMinutes, shiftBreaks]);
40005
40275
  const hasAggregateData = Boolean(hourlyAggregates && hourlyAggregates.length > 0);
40006
- const shiftStartTime = React146__default.useMemo(
40276
+ const shiftStartTime = React147__default.useMemo(
40007
40277
  () => getTimeFromTimeString(shiftStart),
40008
40278
  [shiftStart]
40009
40279
  );
40010
- const { shiftDuration, shiftEndTime } = React146__default.useMemo(() => {
40280
+ const { shiftDuration, shiftEndTime } = React147__default.useMemo(() => {
40011
40281
  if (!shiftEnd) {
40012
40282
  const fallbackHours = uptimeSeries.shiftMinutes > 0 ? Math.ceil(uptimeSeries.shiftMinutes / 60) : 0;
40013
40283
  return { shiftDuration: fallbackHours, shiftEndTime: null };
@@ -40021,7 +40291,7 @@ var HourlyUptimeChartComponent = ({
40021
40291
  const hourCount = hasPartial ? Math.ceil(duration) : Math.round(duration);
40022
40292
  return { shiftDuration: hourCount, shiftEndTime: endTime };
40023
40293
  }, [shiftEnd, shiftStartTime.decimalHour, uptimeSeries.shiftMinutes]);
40024
- const formatHour = React146__default.useCallback((hourIndex) => {
40294
+ const formatHour = React147__default.useCallback((hourIndex) => {
40025
40295
  const isLastHour = hourIndex === shiftDuration - 1;
40026
40296
  const startDecimalHour = shiftStartTime.decimalHour + hourIndex;
40027
40297
  const startHour = Math.floor(startDecimalHour) % 24;
@@ -40046,7 +40316,7 @@ var HourlyUptimeChartComponent = ({
40046
40316
  };
40047
40317
  return `${formatTime5(startHour, startMinute)}-${formatTime5(endHour, endMinute)}`;
40048
40318
  }, [shiftDuration, shiftStartTime.decimalHour, shiftEndTime]);
40049
- const formatTimeRange2 = React146__default.useCallback((hourIndex) => {
40319
+ const formatTimeRange2 = React147__default.useCallback((hourIndex) => {
40050
40320
  const isLastHour = hourIndex === shiftDuration - 1;
40051
40321
  const startDecimalHour = shiftStartTime.decimalHour + hourIndex;
40052
40322
  const startHour = Math.floor(startDecimalHour) % 24;
@@ -40068,7 +40338,7 @@ var HourlyUptimeChartComponent = ({
40068
40338
  };
40069
40339
  return `${formatTime5(startHour, startMinute)} - ${formatTime5(endHour, endMinute)}`;
40070
40340
  }, [shiftDuration, shiftStartTime.decimalHour, shiftEndTime]);
40071
- const chartData = React146__default.useMemo(() => {
40341
+ const chartData = React147__default.useMemo(() => {
40072
40342
  if (shiftDuration <= 0) return [];
40073
40343
  if (hasAggregateData) {
40074
40344
  return hourlyAggregates.map((entry, hourIndex) => ({
@@ -40110,7 +40380,7 @@ var HourlyUptimeChartComponent = ({
40110
40380
  }, [hasAggregateData, hourlyAggregates, uptimeSeries.points, uptimeSeries.elapsedMinutes, uptimeSeries.shiftMinutes, shiftDuration, formatHour, formatTimeRange2]);
40111
40381
  const maxYValue = 100;
40112
40382
  const yAxisTicks = [0, 25, 50, 75, 100];
40113
- React146__default.useEffect(() => {
40383
+ React147__default.useEffect(() => {
40114
40384
  const checkContainerDimensions = () => {
40115
40385
  if (containerRef.current) {
40116
40386
  const rect = containerRef.current.getBoundingClientRect();
@@ -40136,7 +40406,7 @@ var HourlyUptimeChartComponent = ({
40136
40406
  clearTimeout(fallbackTimeout);
40137
40407
  };
40138
40408
  }, []);
40139
- const xAxisConfig = React146__default.useMemo(() => {
40409
+ const xAxisConfig = React147__default.useMemo(() => {
40140
40410
  if (containerWidth >= 960) {
40141
40411
  return { interval: 0, angle: -45, height: 92, tickFont: 10, tickMargin: 12, labelMode: "full" };
40142
40412
  }
@@ -40145,7 +40415,7 @@ var HourlyUptimeChartComponent = ({
40145
40415
  }
40146
40416
  return { interval: 0, angle: -30, height: 64, tickFont: 9, tickMargin: 6, labelMode: "start" };
40147
40417
  }, [containerWidth]);
40148
- const formatXAxisTick = React146__default.useCallback((raw) => {
40418
+ const formatXAxisTick = React147__default.useCallback((raw) => {
40149
40419
  const label = typeof raw === "string" ? raw : String(raw);
40150
40420
  if (xAxisConfig.labelMode === "full") return label;
40151
40421
  const parts = label.split("-");
@@ -40351,7 +40621,7 @@ var HourlyUptimeChartComponent = ({
40351
40621
  }
40352
40622
  );
40353
40623
  };
40354
- var HourlyUptimeChart = React146__default.memo(HourlyUptimeChartComponent);
40624
+ var HourlyUptimeChart = React147__default.memo(HourlyUptimeChartComponent);
40355
40625
  var DEFAULT_COLORS2 = ["#00AB45", "#ef4444"];
40356
40626
  var UptimeDonutChartComponent = ({
40357
40627
  data,
@@ -40421,7 +40691,7 @@ var UptimeDonutChartComponent = ({
40421
40691
  ] }) })
40422
40692
  ] }) });
40423
40693
  };
40424
- var UptimeDonutChart = React146__default.memo(UptimeDonutChartComponent);
40694
+ var UptimeDonutChart = React147__default.memo(UptimeDonutChartComponent);
40425
40695
  UptimeDonutChart.displayName = "UptimeDonutChart";
40426
40696
  var TrendIcon = ({ trend }) => {
40427
40697
  if (trend === "up") {
@@ -40542,7 +40812,7 @@ var EmptyStateMessage = ({
40542
40812
  iconClassName
40543
40813
  }) => {
40544
40814
  let IconContent = null;
40545
- if (React146__default.isValidElement(iconType)) {
40815
+ if (React147__default.isValidElement(iconType)) {
40546
40816
  IconContent = iconType;
40547
40817
  } else if (typeof iconType === "string") {
40548
40818
  const MappedIcon = IconMap[iconType];
@@ -42898,7 +43168,7 @@ function Skeleton({ className, ...props }) {
42898
43168
  var Select = SelectPrimitive.Root;
42899
43169
  var SelectGroup = SelectPrimitive.Group;
42900
43170
  var SelectValue = SelectPrimitive.Value;
42901
- var SelectTrigger = React146.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
43171
+ var SelectTrigger = React147.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
42902
43172
  SelectPrimitive.Trigger,
42903
43173
  {
42904
43174
  ref,
@@ -42914,7 +43184,7 @@ var SelectTrigger = React146.forwardRef(({ className, children, ...props }, ref)
42914
43184
  }
42915
43185
  ));
42916
43186
  SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
42917
- var SelectScrollUpButton = React146.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
43187
+ var SelectScrollUpButton = React147.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
42918
43188
  SelectPrimitive.ScrollUpButton,
42919
43189
  {
42920
43190
  ref,
@@ -42924,7 +43194,7 @@ var SelectScrollUpButton = React146.forwardRef(({ className, ...props }, ref) =>
42924
43194
  }
42925
43195
  ));
42926
43196
  SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
42927
- var SelectScrollDownButton = React146.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
43197
+ var SelectScrollDownButton = React147.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
42928
43198
  SelectPrimitive.ScrollDownButton,
42929
43199
  {
42930
43200
  ref,
@@ -42934,7 +43204,7 @@ var SelectScrollDownButton = React146.forwardRef(({ className, ...props }, ref)
42934
43204
  }
42935
43205
  ));
42936
43206
  SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
42937
- var SelectContent = React146.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
43207
+ var SelectContent = React147.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
42938
43208
  SelectPrimitive.Content,
42939
43209
  {
42940
43210
  ref,
@@ -42962,7 +43232,7 @@ var SelectContent = React146.forwardRef(({ className, children, position = "popp
42962
43232
  }
42963
43233
  ) }));
42964
43234
  SelectContent.displayName = SelectPrimitive.Content.displayName;
42965
- var SelectLabel = React146.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
43235
+ var SelectLabel = React147.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
42966
43236
  SelectPrimitive.Label,
42967
43237
  {
42968
43238
  ref,
@@ -42971,7 +43241,7 @@ var SelectLabel = React146.forwardRef(({ className, ...props }, ref) => /* @__PU
42971
43241
  }
42972
43242
  ));
42973
43243
  SelectLabel.displayName = SelectPrimitive.Label.displayName;
42974
- var SelectItem = React146.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
43244
+ var SelectItem = React147.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
42975
43245
  SelectPrimitive.Item,
42976
43246
  {
42977
43247
  ref,
@@ -42987,7 +43257,7 @@ var SelectItem = React146.forwardRef(({ className, children, ...props }, ref) =>
42987
43257
  }
42988
43258
  ));
42989
43259
  SelectItem.displayName = SelectPrimitive.Item.displayName;
42990
- var SelectSeparator = React146.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
43260
+ var SelectSeparator = React147.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
42991
43261
  SelectPrimitive.Separator,
42992
43262
  {
42993
43263
  ref,
@@ -43613,7 +43883,7 @@ var TimePickerDropdown = ({
43613
43883
  )
43614
43884
  ] });
43615
43885
  };
43616
- var SilentErrorBoundary = class extends React146__default.Component {
43886
+ var SilentErrorBoundary = class extends React147__default.Component {
43617
43887
  constructor(props) {
43618
43888
  super(props);
43619
43889
  this.handleClearAndReload = () => {
@@ -44463,12 +44733,15 @@ var FileManagerFilters = ({
44463
44733
  prefetchedClipMetadata,
44464
44734
  activeCategoryLoading,
44465
44735
  idleClipSort = "latest",
44466
- onIdleClipSortChange
44736
+ onIdleClipSortChange,
44737
+ initialTimeFilter
44467
44738
  }) => {
44468
44739
  const [expandedNodes, setExpandedNodes] = useState(/* @__PURE__ */ new Set());
44469
- const [startTime, setStartTime] = useState("");
44470
- const [endTime, setEndTime] = useState("");
44471
- const [isTimeFilterActive, setIsTimeFilterActive] = useState(false);
44740
+ const [startTime, setStartTime] = useState(initialTimeFilter?.startTime ?? "");
44741
+ const [endTime, setEndTime] = useState(initialTimeFilter?.endTime ?? "");
44742
+ const [isTimeFilterActive, setIsTimeFilterActive] = useState(
44743
+ Boolean(initialTimeFilter?.startTime && initialTimeFilter?.endTime)
44744
+ );
44472
44745
  const [showTimeFilterModal, setShowTimeFilterModal] = useState(false);
44473
44746
  const [startSearchTerm, setStartSearchTerm] = useState("");
44474
44747
  const [endSearchTerm, setEndSearchTerm] = useState("");
@@ -44494,6 +44767,17 @@ var FileManagerFilters = ({
44494
44767
  useEffect(() => {
44495
44768
  clipMetadataRef.current = clipMetadata;
44496
44769
  }, [clipMetadata]);
44770
+ useEffect(() => {
44771
+ if (!initialTimeFilter?.startTime || !initialTimeFilter?.endTime) {
44772
+ return;
44773
+ }
44774
+ setStartTime(initialTimeFilter.startTime);
44775
+ setEndTime(initialTimeFilter.endTime);
44776
+ setIsTimeFilterActive(true);
44777
+ setShowTimeFilterModal(false);
44778
+ setStartSearchTerm("");
44779
+ setEndSearchTerm("");
44780
+ }, [initialTimeFilter?.startTime, initialTimeFilter?.endTime]);
44497
44781
  useEffect(() => {
44498
44782
  if (previousIdleClipSortRef.current === idleClipSort) {
44499
44783
  return;
@@ -46287,7 +46571,8 @@ var BottlenecksContent = ({
46287
46571
  customCounterContent,
46288
46572
  triageMode = false,
46289
46573
  ticketId,
46290
- prefetchedPercentileCounts
46574
+ prefetchedPercentileCounts,
46575
+ initialTimeFilter
46291
46576
  }) => {
46292
46577
  console.log("\u{1F3AB} [BottlenecksContent] Rendered with ticketId:", ticketId || "NONE", "workspaceId:", workspaceId, "date:", date, "shift:", shift);
46293
46578
  const dashboardConfig = useDashboardConfig();
@@ -48496,6 +48781,7 @@ var BottlenecksContent = ({
48496
48781
  activeCategoryLoading: isCategoryLoading,
48497
48782
  idleClipSort,
48498
48783
  onIdleClipSortChange: setIdleClipSort,
48784
+ initialTimeFilter,
48499
48785
  onFilterChange: (filterId) => {
48500
48786
  if (filterId !== "idle_time") {
48501
48787
  setIdleClipSort("latest");
@@ -50674,8 +50960,8 @@ var IdleTimeReasonChartComponent = ({
50674
50960
  updateAnimation = "replay",
50675
50961
  variant = "pie"
50676
50962
  }) => {
50677
- const [activeData, setActiveData] = React146__default.useState([]);
50678
- React146__default.useEffect(() => {
50963
+ const [activeData, setActiveData] = React147__default.useState([]);
50964
+ React147__default.useEffect(() => {
50679
50965
  if (updateAnimation === "smooth") {
50680
50966
  setActiveData(data && data.length > 0 ? data : []);
50681
50967
  return;
@@ -50694,7 +50980,7 @@ var IdleTimeReasonChartComponent = ({
50694
50980
  setActiveData([]);
50695
50981
  }
50696
50982
  }, [data, updateAnimation]);
50697
- React146__default.useEffect(() => {
50983
+ React147__default.useEffect(() => {
50698
50984
  if (!data || data.length === 0) return;
50699
50985
  data.forEach((entry, index) => {
50700
50986
  if (entry.name.toLowerCase().includes("other")) {
@@ -50702,7 +50988,7 @@ var IdleTimeReasonChartComponent = ({
50702
50988
  }
50703
50989
  });
50704
50990
  }, [data]);
50705
- const pieKey = React146__default.useMemo(() => {
50991
+ const pieKey = React147__default.useMemo(() => {
50706
50992
  if (updateAnimation === "smooth") {
50707
50993
  return "smooth";
50708
50994
  }
@@ -50872,7 +51158,7 @@ var IdleTimeReasonChartComponent = ({
50872
51158
  )
50873
51159
  ] });
50874
51160
  };
50875
- var IdleTimeReasonChart = React146__default.memo(IdleTimeReasonChartComponent);
51161
+ var IdleTimeReasonChart = React147__default.memo(IdleTimeReasonChartComponent);
50876
51162
  IdleTimeReasonChart.displayName = "IdleTimeReasonChart";
50877
51163
  var IdleTimeReasonChart_default = IdleTimeReasonChart;
50878
51164
 
@@ -55399,13 +55685,13 @@ var WorkspaceCycleTimeMetricCards = ({
55399
55685
  liveSkuId
55400
55686
  }) => {
55401
55687
  const effectiveLegend = legend || DEFAULT_EFFICIENCY_LEGEND;
55402
- const activeSku = React146__default.useMemo(() => {
55688
+ const activeSku = React147__default.useMemo(() => {
55403
55689
  if (skuAware && activeSkuId && skuBreakdown) {
55404
55690
  return skuBreakdown.find((s) => s.sku_id === activeSkuId);
55405
55691
  }
55406
55692
  return null;
55407
55693
  }, [skuAware, activeSkuId, skuBreakdown]);
55408
- const displaySku = React146__default.useMemo(() => {
55694
+ const displaySku = React147__default.useMemo(() => {
55409
55695
  if (activeSku) return activeSku;
55410
55696
  if (skuAware && !activeSkuId && liveSkuId && skuBreakdown) {
55411
55697
  return skuBreakdown.find((s) => s.sku_id === liveSkuId) ?? null;
@@ -55649,7 +55935,7 @@ var arePropsEqual = (prevProps, nextProps) => {
55649
55935
  return prevProps.data.efficiency === nextProps.data.efficiency && prevProps.data.trend_score === nextProps.data.trend_score && prevProps.data.workspace_id === nextProps.data.workspace_id && prevProps.data.workspace_name === nextProps.data.workspace_name && prevProps.isBottleneck === nextProps.isBottleneck && prevProps.isLowEfficiency === nextProps.isLowEfficiency && prevProps.isVeryLowEfficiency === nextProps.isVeryLowEfficiency && prevLegend.green_min === nextLegend.green_min && prevLegend.green_max === nextLegend.green_max && prevLegend.yellow_min === nextLegend.yellow_min && prevLegend.yellow_max === nextLegend.yellow_max && prevLegend.red_min === nextLegend.red_min && prevLegend.red_max === nextLegend.red_max && prevLegend.critical_threshold === nextLegend.critical_threshold && // Position doesn't need deep equality check as it's generally static
55650
55936
  prevProps.position.id === nextProps.position.id;
55651
55937
  };
55652
- var WorkspaceGridItem = React146__default.memo(({
55938
+ var WorkspaceGridItem = React147__default.memo(({
55653
55939
  data,
55654
55940
  position,
55655
55941
  isBottleneck = false,
@@ -55744,7 +56030,7 @@ var WorkspaceGridItem = React146__default.memo(({
55744
56030
  );
55745
56031
  }, arePropsEqual);
55746
56032
  WorkspaceGridItem.displayName = "WorkspaceGridItem";
55747
- var WorkspaceGrid = React146__default.memo(({
56033
+ var WorkspaceGrid = React147__default.memo(({
55748
56034
  workspaces,
55749
56035
  blueComparisonWorkspaces,
55750
56036
  isPdfMode = false,
@@ -55997,7 +56283,7 @@ var KPICard = ({
55997
56283
  }) => {
55998
56284
  useThemeConfig();
55999
56285
  const { formatNumber } = useFormatNumber();
56000
- const trendInfo = React146__default.useMemo(() => {
56286
+ const trendInfo = React147__default.useMemo(() => {
56001
56287
  let trendValue = trend || "neutral";
56002
56288
  if (change !== void 0 && trend === void 0) {
56003
56289
  trendValue = change > 0 ? "up" : change < 0 ? "down" : "neutral";
@@ -56024,7 +56310,7 @@ var KPICard = ({
56024
56310
  const shouldShowTrend = !(change === 0 && trend === void 0);
56025
56311
  return { trendValue, Icon: Icon2, colorClass, bgClass, shouldShowTrend };
56026
56312
  }, [trend, change]);
56027
- const formattedValue = React146__default.useMemo(() => {
56313
+ const formattedValue = React147__default.useMemo(() => {
56028
56314
  if (title === "Quality Compliance" && typeof value === "number") {
56029
56315
  return value.toFixed(1);
56030
56316
  }
@@ -56038,7 +56324,7 @@ var KPICard = ({
56038
56324
  }
56039
56325
  return value;
56040
56326
  }, [value, title]);
56041
- const formattedChange = React146__default.useMemo(() => {
56327
+ const formattedChange = React147__default.useMemo(() => {
56042
56328
  if (change === void 0 || change === 0 && !showZeroChange) return null;
56043
56329
  const absChange = Math.abs(change);
56044
56330
  return formatNumber(absChange, { minimumFractionDigits: 0, maximumFractionDigits: 1 });
@@ -57545,7 +57831,7 @@ var Breadcrumbs = ({ items }) => {
57545
57831
  }
57546
57832
  }
57547
57833
  };
57548
- return /* @__PURE__ */ jsx("nav", { "aria-label": "Breadcrumb", className: "mb-1 flex items-center space-x-1 text-xs font-medium text-gray-500 dark:text-gray-400", children: items.map((item, index) => /* @__PURE__ */ jsxs(React146__default.Fragment, { children: [
57834
+ return /* @__PURE__ */ jsx("nav", { "aria-label": "Breadcrumb", className: "mb-1 flex items-center space-x-1 text-xs font-medium text-gray-500 dark:text-gray-400", children: items.map((item, index) => /* @__PURE__ */ jsxs(React147__default.Fragment, { children: [
57549
57835
  index > 0 && /* @__PURE__ */ jsx(ChevronRight, { className: "h-3 w-3 text-gray-400 dark:text-gray-500" }),
57550
57836
  /* @__PURE__ */ jsxs(
57551
57837
  "span",
@@ -59069,7 +59355,7 @@ var AwardBadge = ({
59069
59355
  }) => {
59070
59356
  const styles2 = getBadgeStyles(type);
59071
59357
  const Icon2 = CustomIcon || getDefaultIcon(type);
59072
- const randomDelay = React146__default.useMemo(() => Math.random() * 2, []);
59358
+ const randomDelay = React147__default.useMemo(() => Math.random() * 2, []);
59073
59359
  const floatingAnimation = {
59074
59360
  animate: {
59075
59361
  y: [0, -10, 0],
@@ -67388,7 +67674,7 @@ function HomeView({
67388
67674
  animate: { opacity: 1, scale: 1 },
67389
67675
  transition: { duration: 0.3 },
67390
67676
  className: "h-full",
67391
- children: React146__default.createElement(WorkspaceGrid, {
67677
+ children: React147__default.createElement(WorkspaceGrid, {
67392
67678
  workspaces: workspaceMetricsWithBreakState,
67393
67679
  blueComparisonWorkspaces: currentBlueComparisonWorkspaceMetrics || workspaceMetricsWithBreakState,
67394
67680
  lineNames: mergedLineNames,
@@ -67421,7 +67707,7 @@ function HomeView({
67421
67707
  animate: { opacity: 1, scale: 1 },
67422
67708
  transition: { duration: 0.3 },
67423
67709
  className: "h-full",
67424
- children: React146__default.createElement(WorkspaceGrid, {
67710
+ children: React147__default.createElement(WorkspaceGrid, {
67425
67711
  workspaces: [],
67426
67712
  // Show empty grid while loading
67427
67713
  blueComparisonWorkspaces: [],
@@ -67468,7 +67754,7 @@ function HomeView({
67468
67754
  contentVariant: "plain"
67469
67755
  }
67470
67756
  ),
67471
- /* @__PURE__ */ jsx(AnimatePresence, { children: showAllGreenCelebration ? /* @__PURE__ */ jsxs(React146__default.Fragment, { children: [
67757
+ /* @__PURE__ */ jsx(AnimatePresence, { children: showAllGreenCelebration ? /* @__PURE__ */ jsxs(React147__default.Fragment, { children: [
67472
67758
  /* @__PURE__ */ jsx(
67473
67759
  motion.div,
67474
67760
  {
@@ -67547,7 +67833,7 @@ function HomeView({
67547
67833
  "all-green-center-toast"
67548
67834
  )
67549
67835
  ] }, "all-green-celebration") : null }),
67550
- /* @__PURE__ */ jsx(AnimatePresence, { children: greenStreakMilestoneBanner ? /* @__PURE__ */ jsxs(React146__default.Fragment, { children: [
67836
+ /* @__PURE__ */ jsx(AnimatePresence, { children: greenStreakMilestoneBanner ? /* @__PURE__ */ jsxs(React147__default.Fragment, { children: [
67551
67837
  /* @__PURE__ */ jsx(
67552
67838
  motion.div,
67553
67839
  {
@@ -67641,7 +67927,7 @@ function HomeView({
67641
67927
  }
67642
67928
  );
67643
67929
  }
67644
- var AuthenticatedHomeView = withAuth(React146__default.memo(HomeView));
67930
+ var AuthenticatedHomeView = withAuth(React147__default.memo(HomeView));
67645
67931
  var HomeView_default = HomeView;
67646
67932
  function withWorkspaceDisplayNames(Component3, options = {}) {
67647
67933
  const {
@@ -70907,7 +71193,7 @@ var KPI_FACTORY_QUERY_PARAM = "factory_id";
70907
71193
  var KPI_FACTORY_AREA_QUERY_PARAM = "factory_area_id";
70908
71194
  var getSingleQueryValue = (value) => typeof value === "string" && value.length > 0 ? value : void 0;
70909
71195
  var resolveCompanyId2 = (...candidates) => candidates.find(isNonEmptyString2);
70910
- var parseTimeToMinutes3 = (value) => {
71196
+ var parseTimeToMinutes4 = (value) => {
70911
71197
  if (!value) return null;
70912
71198
  const [hourStr, minuteStr] = value.split(":");
70913
71199
  const hour = Number.parseInt(hourStr ?? "", 10);
@@ -70919,8 +71205,8 @@ var getShiftEndDate = (shift, timezone) => {
70919
71205
  if (!shift?.date) return null;
70920
71206
  const startTime = shift.startTime || "06:00";
70921
71207
  const endTime = shift.endTime || "18:00";
70922
- const startMinutes = parseTimeToMinutes3(startTime);
70923
- const endMinutes = parseTimeToMinutes3(endTime);
71208
+ const startMinutes = parseTimeToMinutes4(startTime);
71209
+ const endMinutes = parseTimeToMinutes4(endTime);
70924
71210
  if (startMinutes === null || endMinutes === null) return null;
70925
71211
  const shiftStartDate = fromZonedTime(`${shift.date}T${startTime}:00`, timezone);
70926
71212
  let durationMinutes = endMinutes - startMinutes;
@@ -71050,18 +71336,18 @@ var LinesLeaderboard = ({
71050
71336
  isHistoricalDaily
71051
71337
  }) => {
71052
71338
  const formatEfficiency = (value) => typeof value === "number" && Number.isFinite(value) ? `${value.toFixed(1)}%` : "--";
71053
- const assignedLineIdSet = React146__default.useMemo(
71339
+ const assignedLineIdSet = React147__default.useMemo(
71054
71340
  () => new Set(assignedLineIds || []),
71055
71341
  [assignedLineIds]
71056
71342
  );
71057
- const canClickLine = React146__default.useCallback(
71343
+ const canClickLine = React147__default.useCallback(
71058
71344
  (lineId) => {
71059
71345
  if (!assignedLineIds) return true;
71060
71346
  return assignedLineIdSet.has(lineId);
71061
71347
  },
71062
71348
  [assignedLineIds, assignedLineIdSet]
71063
71349
  );
71064
- const handleTimeRangeChange = React146__default.useCallback((newRange) => {
71350
+ const handleTimeRangeChange = React147__default.useCallback((newRange) => {
71065
71351
  if (newRange === timeRange) return;
71066
71352
  trackCoreEvent("Leaderboard Time Range Changed", {
71067
71353
  from_range: timeRange,
@@ -71072,11 +71358,11 @@ var LinesLeaderboard = ({
71072
71358
  });
71073
71359
  setTimeRange(newRange);
71074
71360
  }, [timeRange, lines.length, monthlyEfficiencyByLineId, setTimeRange]);
71075
- const canClickLeaderboardRow = React146__default.useCallback(
71361
+ const canClickLeaderboardRow = React147__default.useCallback(
71076
71362
  (item) => item.rowType === "line" && !!item.line && canClickLine(item.line.id),
71077
71363
  [canClickLine]
71078
71364
  );
71079
- const handleLeaderboardLineClick = React146__default.useCallback((item, clickSource) => {
71365
+ const handleLeaderboardLineClick = React147__default.useCallback((item, clickSource) => {
71080
71366
  if (!canClickLeaderboardRow(item) || !item.line) return;
71081
71367
  trackCoreEvent("Leaderboard Line Clicked", {
71082
71368
  line_id: item.line.id,
@@ -71090,8 +71376,8 @@ var LinesLeaderboard = ({
71090
71376
  });
71091
71377
  onLineClick(item.line);
71092
71378
  }, [canClickLeaderboardRow, onLineClick, timeRange]);
71093
- const viewLoadedTrackedRef = React146__default.useRef(null);
71094
- const leaderboardData = React146__default.useMemo(() => {
71379
+ const viewLoadedTrackedRef = React147__default.useRef(null);
71380
+ const leaderboardData = React147__default.useMemo(() => {
71095
71381
  const loading = timeRange === "today" ? isLoadingToday : isLoadingMonthly;
71096
71382
  const efficiencyMap = timeRange === "today" ? todayEfficiencyByLineId : monthlyEfficiencyByLineId;
71097
71383
  const fallbackEfficiencyMap = timeRange === "today" ? dailyFallbackEfficiencyByLineId : void 0;
@@ -71135,7 +71421,7 @@ var LinesLeaderboard = ({
71135
71421
  isLoadingToday,
71136
71422
  isLoadingMonthly
71137
71423
  ]);
71138
- React146__default.useEffect(() => {
71424
+ React147__default.useEffect(() => {
71139
71425
  const isLoading = timeRange === "today" ? isLoadingToday : isLoadingMonthly;
71140
71426
  const trackingKey = `${timeRange}-${leaderboardData.length}`;
71141
71427
  if (leaderboardData.length > 0 && !isLoading && viewLoadedTrackedRef.current !== trackingKey) {
@@ -71161,7 +71447,7 @@ var LinesLeaderboard = ({
71161
71447
  const countdownFormat = timeRange === "monthly" ? "days" : "clock";
71162
71448
  const countdownFinishedLabel = timeRange === "monthly" ? "Finished" : "Shift Ended";
71163
71449
  const showCountdown = timeRange === "monthly" || !isHistoricalDaily;
71164
- const handleCountdownFinished = React146__default.useCallback(() => {
71450
+ const handleCountdownFinished = React147__default.useCallback(() => {
71165
71451
  trackCoreEvent("Leaderboard Countdown Finished", {
71166
71452
  countdown_type: timeRange === "monthly" ? "month_end" : "shift_end",
71167
71453
  time_range: timeRange,
@@ -71188,7 +71474,7 @@ var LinesLeaderboard = ({
71188
71474
  return "bg-white border-gray-100";
71189
71475
  }
71190
71476
  };
71191
- React146__default.useEffect(() => {
71477
+ React147__default.useEffect(() => {
71192
71478
  const style = document.createElement("style");
71193
71479
  style.innerHTML = `
71194
71480
  @keyframes float {
@@ -71690,36 +71976,36 @@ var KPIsOverviewView = ({
71690
71976
  const configuredTimezone = dbTimezone || dateTimeConfig.defaultTimezone || "UTC";
71691
71977
  const { startDate: monthStartDate, endDate: monthEndDateKey, monthEndDate } = getMonthDateInfo(configuredTimezone);
71692
71978
  const isSuperAdmin = user?.scope_mode === "SUPER_ADMIN" || !!user?.access_scope?.is_super_admin;
71693
- const scopedLineIds = React146__default.useMemo(
71979
+ const scopedLineIds = React147__default.useMemo(
71694
71980
  () => Array.isArray(user?.access_scope?.line_ids) ? user.access_scope.line_ids.filter((lineId) => typeof lineId === "string" && lineId.length > 0) : [],
71695
71981
  [user?.access_scope?.line_ids]
71696
71982
  );
71697
71983
  const hasCanonicalScope = !!user?.scope_mode || !!user?.access_scope;
71698
71984
  const scopeRole = (user?.role_level || user?.role || "").toLowerCase();
71699
71985
  const isStrictLineScopedRole = scopeRole === "supervisor" || isFactoryScopedRole(scopeRole);
71700
- const resolvedAssignedLineIds = React146__default.useMemo(() => {
71986
+ const resolvedAssignedLineIds = React147__default.useMemo(() => {
71701
71987
  if (isSuperAdmin) return [];
71702
71988
  if (scopedLineIds.length > 0) return scopedLineIds;
71703
71989
  if (lineIds && lineIds.length > 0) return lineIds;
71704
71990
  if (isStrictLineScopedRole && hasCanonicalScope) return [];
71705
71991
  return [];
71706
71992
  }, [isSuperAdmin, scopedLineIds, lineIds, isStrictLineScopedRole, hasCanonicalScope]);
71707
- const assignedLineIdSet = React146__default.useMemo(
71993
+ const assignedLineIdSet = React147__default.useMemo(
71708
71994
  () => new Set(resolvedAssignedLineIds),
71709
71995
  [resolvedAssignedLineIds]
71710
71996
  );
71711
- const loadedLineIds = React146__default.useMemo(
71997
+ const loadedLineIds = React147__default.useMemo(
71712
71998
  () => lines.map((line) => line.id).filter(Boolean),
71713
71999
  [lines]
71714
72000
  );
71715
- const metricsLineIds = React146__default.useMemo(() => {
72001
+ const metricsLineIds = React147__default.useMemo(() => {
71716
72002
  if (isSuperAdmin) {
71717
72003
  return loadedLineIds.length > 0 ? loadedLineIds : lineIds ?? [];
71718
72004
  }
71719
72005
  return resolvedAssignedLineIds;
71720
72006
  }, [isSuperAdmin, loadedLineIds, lineIds, resolvedAssignedLineIds]);
71721
72007
  const assignedLineIdsForLeaderboard = isSuperAdmin ? void 0 : resolvedAssignedLineIds;
71722
- const leaderboardLinesForView = React146__default.useMemo(() => {
72008
+ const leaderboardLinesForView = React147__default.useMemo(() => {
71723
72009
  const targetMode = viewType === "machine" ? "uptime" : "output";
71724
72010
  const metadataByLineId = new Map(lines.map((line) => [line.id, line]));
71725
72011
  return leaderboardLines.map((line) => {
@@ -71738,17 +72024,17 @@ var KPIsOverviewView = ({
71738
72024
  } : line;
71739
72025
  }).filter((line) => (line.monitoring_mode ?? "output") === targetMode);
71740
72026
  }, [leaderboardLines, lines, viewType]);
71741
- const linesForView = React146__default.useMemo(() => {
72027
+ const linesForView = React147__default.useMemo(() => {
71742
72028
  const targetMode = viewType === "machine" ? "uptime" : "output";
71743
72029
  return lines.filter((line) => (line.monitoring_mode ?? "output") === targetMode);
71744
72030
  }, [lines, viewType]);
71745
- const relevantLinesForMode = React146__default.useMemo(() => {
72031
+ const relevantLinesForMode = React147__default.useMemo(() => {
71746
72032
  if (activeTab === "leaderboard") {
71747
72033
  return leaderboardLines.length > 0 ? leaderboardLines : lines;
71748
72034
  }
71749
72035
  return lines;
71750
72036
  }, [activeTab, leaderboardLines, lines]);
71751
- const { hasUptime, hasOutput } = React146__default.useMemo(() => {
72037
+ const { hasUptime, hasOutput } = React147__default.useMemo(() => {
71752
72038
  let uptime = false;
71753
72039
  let output = false;
71754
72040
  for (const line of relevantLinesForMode) {
@@ -71773,14 +72059,14 @@ var KPIsOverviewView = ({
71773
72059
  const currentShiftDetails = getCurrentShift(configuredTimezone, shiftConfig);
71774
72060
  const currentShiftDate = currentShiftDetails.date;
71775
72061
  const currentShiftId = currentShiftDetails.shiftId;
71776
- const activeFiltersCount = React146__default.useMemo(() => {
72062
+ const activeFiltersCount = React147__default.useMemo(() => {
71777
72063
  let count = 0;
71778
72064
  if (leaderboardDailyScopeMode === "historical" && selectedLeaderboardShiftId !== currentShiftId) {
71779
72065
  count++;
71780
72066
  }
71781
72067
  return count;
71782
72068
  }, [leaderboardDailyScopeMode, selectedLeaderboardShiftId, currentShiftId]);
71783
- const clearFilters = React146__default.useCallback(() => {
72069
+ const clearFilters = React147__default.useCallback(() => {
71784
72070
  setSelectedLeaderboardShiftId(currentShiftId);
71785
72071
  setSelectedLeaderboardDate(currentShiftDate);
71786
72072
  setLeaderboardDailyScopeMode("live");
@@ -71796,11 +72082,11 @@ var KPIsOverviewView = ({
71796
72082
  document.addEventListener("mousedown", handleClickOutside);
71797
72083
  return () => document.removeEventListener("mousedown", handleClickOutside);
71798
72084
  }, []);
71799
- const shiftEndDate = React146__default.useMemo(
72085
+ const shiftEndDate = React147__default.useMemo(
71800
72086
  () => getShiftEndDate(currentShiftDetails, configuredTimezone),
71801
72087
  [currentShiftDetails, configuredTimezone]
71802
72088
  );
71803
- const leaderboardShiftOptions = React146__default.useMemo(() => {
72089
+ const leaderboardShiftOptions = React147__default.useMemo(() => {
71804
72090
  if (shiftConfig?.shifts && shiftConfig.shifts.length > 0) {
71805
72091
  return shiftConfig.shifts.map((shift) => ({
71806
72092
  id: shift.shiftId,
@@ -71817,34 +72103,34 @@ var KPIsOverviewView = ({
71817
72103
  const effectiveLeaderboardDate = selectedLeaderboardDate || currentShiftDate;
71818
72104
  const effectiveLeaderboardShiftId = Number.isFinite(selectedLeaderboardShiftId) ? selectedLeaderboardShiftId : currentShiftId;
71819
72105
  const isHistoricalLeaderboardDaily = activeTab === "leaderboard" && timeRange === "today" && leaderboardDailyScopeMode === "historical" && (effectiveLeaderboardDate !== currentShiftDate || effectiveLeaderboardShiftId !== currentShiftId);
71820
- const updateLeaderboardDate = React146__default.useCallback((dateKey) => {
72106
+ const updateLeaderboardDate = React147__default.useCallback((dateKey) => {
71821
72107
  setSelectedLeaderboardDate(dateKey);
71822
72108
  setLeaderboardDailyScopeMode(
71823
72109
  dateKey === currentShiftDate && effectiveLeaderboardShiftId === currentShiftId ? "live" : "historical"
71824
72110
  );
71825
72111
  }, [currentShiftDate, currentShiftId, effectiveLeaderboardShiftId]);
71826
- const updateLeaderboardShiftId = React146__default.useCallback((shiftId) => {
72112
+ const updateLeaderboardShiftId = React147__default.useCallback((shiftId) => {
71827
72113
  setSelectedLeaderboardShiftId(shiftId);
71828
72114
  setLeaderboardDailyScopeMode(
71829
72115
  effectiveLeaderboardDate === currentShiftDate && shiftId === currentShiftId ? "live" : "historical"
71830
72116
  );
71831
72117
  }, [currentShiftDate, currentShiftId, effectiveLeaderboardDate]);
71832
- const returnLeaderboardToLive = React146__default.useCallback(() => {
72118
+ const returnLeaderboardToLive = React147__default.useCallback(() => {
71833
72119
  setSelectedLeaderboardDate(currentShiftDate);
71834
72120
  setSelectedLeaderboardShiftId(currentShiftId);
71835
72121
  setLeaderboardDailyScopeMode("live");
71836
72122
  }, [currentShiftDate, currentShiftId]);
71837
72123
  const selectedFactoryIdFromUrl = getSingleQueryValue(router.query[KPI_FACTORY_QUERY_PARAM]);
71838
72124
  const selectedFactoryAreaIdFromUrl = getSingleQueryValue(router.query[KPI_FACTORY_AREA_QUERY_PARAM]);
71839
- const kpiLineHierarchy = React146__default.useMemo(
72125
+ const kpiLineHierarchy = React147__default.useMemo(
71840
72126
  () => buildKpiLineHierarchy(linesForView),
71841
72127
  [linesForView]
71842
72128
  );
71843
- const selectedFactoryNode = React146__default.useMemo(
72129
+ const selectedFactoryNode = React147__default.useMemo(
71844
72130
  () => kpiLineHierarchy.showFactoryLevel && selectedFactoryIdFromUrl ? kpiLineHierarchy.factories.find((factory) => factory.id === selectedFactoryIdFromUrl) : void 0,
71845
72131
  [kpiLineHierarchy, selectedFactoryIdFromUrl]
71846
72132
  );
71847
- const selectedFactoryAreaNode = React146__default.useMemo(
72133
+ const selectedFactoryAreaNode = React147__default.useMemo(
71848
72134
  () => selectedFactoryNode && selectedFactoryAreaIdFromUrl ? selectedFactoryNode.areas.find((area) => area.id === selectedFactoryAreaIdFromUrl) : void 0,
71849
72135
  [selectedFactoryNode, selectedFactoryAreaIdFromUrl]
71850
72136
  );
@@ -71933,15 +72219,15 @@ var KPIsOverviewView = ({
71933
72219
  lineId: factoryViewId,
71934
72220
  userAccessibleLineIds: metricsLineIds
71935
72221
  });
71936
- const defaultKPIs = React146__default.useMemo(() => createDefaultKPIs(), []);
71937
- const lineModeById = React146__default.useMemo(() => {
72222
+ const defaultKPIs = React147__default.useMemo(() => createDefaultKPIs(), []);
72223
+ const lineModeById = React147__default.useMemo(() => {
71938
72224
  const map = /* @__PURE__ */ new Map();
71939
72225
  linesForView.forEach((line) => {
71940
72226
  map.set(line.id, line.monitoring_mode ?? "output");
71941
72227
  });
71942
72228
  return map;
71943
72229
  }, [linesForView]);
71944
- const lineMetricRowsByLineId = React146__default.useMemo(() => {
72230
+ const lineMetricRowsByLineId = React147__default.useMemo(() => {
71945
72231
  const map = /* @__PURE__ */ new Map();
71946
72232
  lineMetrics.forEach((row) => {
71947
72233
  if (!row?.line_id) return;
@@ -71953,7 +72239,7 @@ var KPIsOverviewView = ({
71953
72239
  });
71954
72240
  return map;
71955
72241
  }, [lineMetrics, lineModeById]);
71956
- const liveDailyFallbackEfficiencyByLineId = React146__default.useMemo(() => {
72242
+ const liveDailyFallbackEfficiencyByLineId = React147__default.useMemo(() => {
71957
72243
  const map = /* @__PURE__ */ new Map();
71958
72244
  lineMetricRowsByLineId.forEach((row, lineId) => {
71959
72245
  const value = Number(row?.avg_efficiency);
@@ -71975,31 +72261,31 @@ var KPIsOverviewView = ({
71975
72261
  isHistoricalLeaderboardDaily,
71976
72262
  lineMetricRowsByLineId
71977
72263
  ]);
71978
- const dailyFallbackEfficiencyByLineId = React146__default.useMemo(() => {
72264
+ const dailyFallbackEfficiencyByLineId = React147__default.useMemo(() => {
71979
72265
  const map = new Map(liveDailyFallbackEfficiencyByLineId);
71980
72266
  scopedDailyFallbackEfficiencyByLineId.forEach((value, lineId) => {
71981
72267
  map.set(lineId, value);
71982
72268
  });
71983
72269
  return map;
71984
72270
  }, [liveDailyFallbackEfficiencyByLineId, scopedDailyFallbackEfficiencyByLineId]);
71985
- const kpisByLineId = React146__default.useMemo(() => {
72271
+ const kpisByLineId = React147__default.useMemo(() => {
71986
72272
  const map = /* @__PURE__ */ new Map();
71987
72273
  lineMetricRowsByLineId.forEach((row, lineId) => {
71988
72274
  map.set(lineId, buildKPIsFromLineMetricsRow(row));
71989
72275
  });
71990
72276
  return map;
71991
72277
  }, [lineMetricRowsByLineId]);
71992
- const getLineCardKpis = React146__default.useCallback((line) => {
72278
+ const getLineCardKpis = React147__default.useCallback((line) => {
71993
72279
  if (metricsError) return null;
71994
72280
  return kpisByLineId.get(line.id) ?? (metricsLoading ? null : defaultKPIs);
71995
72281
  }, [defaultKPIs, kpisByLineId, metricsError, metricsLoading]);
71996
- const getAggregateCardKpis = React146__default.useCallback((cardLines) => {
72282
+ const getAggregateCardKpis = React147__default.useCallback((cardLines) => {
71997
72283
  if (metricsError) return null;
71998
72284
  const rows = cardLines.map((line) => lineMetricRowsByLineId.get(line.id)).filter(Boolean);
71999
72285
  if (metricsLoading && rows.length === 0) return null;
72000
72286
  return aggregateKPIsFromLineMetricsRows(rows);
72001
72287
  }, [lineMetricRowsByLineId, metricsError, metricsLoading]);
72002
- const supervisorLineIds = React146__default.useMemo(
72288
+ const supervisorLineIds = React147__default.useMemo(
72003
72289
  () => (leaderboardLines.length > 0 ? leaderboardLines : lines).map((l) => l.id),
72004
72290
  [leaderboardLines, lines]
72005
72291
  );
@@ -72251,7 +72537,7 @@ var KPIsOverviewView = ({
72251
72537
  { shallow: true }
72252
72538
  );
72253
72539
  }, [router]);
72254
- const lineDetailReturnTo = React146__default.useMemo(() => {
72540
+ const lineDetailReturnTo = React147__default.useMemo(() => {
72255
72541
  if (activeTab !== "today" || !selectedFactoryNode) return void 0;
72256
72542
  return createKpisOverviewUrl({
72257
72543
  factoryId: selectedFactoryNode.id,
@@ -73051,7 +73337,7 @@ var LeaderboardDetailView = memo$1(({
73051
73337
  return () => document.removeEventListener("mousedown", handleClickOutside);
73052
73338
  }, []);
73053
73339
  const [isMobile, setIsMobile] = useState(false);
73054
- React146__default.useEffect(() => {
73340
+ React147__default.useEffect(() => {
73055
73341
  const checkMobile = () => setIsMobile(window.innerWidth < 640);
73056
73342
  checkMobile();
73057
73343
  window.addEventListener("resize", checkMobile);
@@ -77101,7 +77387,7 @@ var ShiftsView = ({
77101
77387
  ] })
77102
77388
  ] });
77103
77389
  };
77104
- var AuthenticatedShiftsView = withAuth(React146__default.memo(ShiftsView));
77390
+ var AuthenticatedShiftsView = withAuth(React147__default.memo(ShiftsView));
77105
77391
  var ShiftsView_default = ShiftsView;
77106
77392
 
77107
77393
  // src/views/TargetsView.utils.ts
@@ -78968,7 +79254,7 @@ var TargetsView = ({
78968
79254
  };
78969
79255
  var TargetsViewWithDisplayNames = withAllWorkspaceDisplayNames(TargetsView);
78970
79256
  var TargetsView_default = TargetsViewWithDisplayNames;
78971
- var AuthenticatedTargetsView = withAuth(React146__default.memo(TargetsViewWithDisplayNames));
79257
+ var AuthenticatedTargetsView = withAuth(React147__default.memo(TargetsViewWithDisplayNames));
78972
79258
  function useTimezone(options = {}) {
78973
79259
  const dashboardConfig = useDashboardConfig();
78974
79260
  const workspaceConfig = useWorkspaceConfig();
@@ -79097,6 +79383,147 @@ var getInitialTab = (sourceType, defaultTab, fromMonthly, urlDate) => {
79097
79383
  }
79098
79384
  return "overview";
79099
79385
  };
79386
+ var to12HourClock = (timeValue) => {
79387
+ const match = timeValue.trim().match(/^(\d{1,2}):(\d{2})$/);
79388
+ if (!match) return timeValue;
79389
+ const hour24 = Number.parseInt(match[1], 10);
79390
+ const minute = match[2];
79391
+ if (!Number.isFinite(hour24) || hour24 < 0 || hour24 > 23) return timeValue;
79392
+ const meridiem = hour24 >= 12 ? "PM" : "AM";
79393
+ const hour12 = hour24 % 12 || 12;
79394
+ return `${hour12}:${minute} ${meridiem}`;
79395
+ };
79396
+ var formatTimeRangeTo12Hour = (timeRange) => {
79397
+ const segments = timeRange.split(" - ").map((segment) => segment.trim());
79398
+ if (segments.length !== 2) return timeRange;
79399
+ return `${to12HourClock(segments[0])} - ${to12HourClock(segments[1])}`;
79400
+ };
79401
+ var formatWholeNumber = (value) => {
79402
+ if (typeof value !== "number" || !Number.isFinite(value)) return null;
79403
+ return Math.round(value).toLocaleString();
79404
+ };
79405
+ var formatSeconds = (value) => {
79406
+ if (typeof value !== "number" || !Number.isFinite(value)) return null;
79407
+ return `${value.toFixed(1)}s`;
79408
+ };
79409
+ var WorkspaceHourSummaryPanel = ({
79410
+ workspaceId,
79411
+ companyId,
79412
+ date,
79413
+ shiftId,
79414
+ selectedHour,
79415
+ clipsEnabled,
79416
+ onOpenClips,
79417
+ onClose,
79418
+ className = ""
79419
+ }) => {
79420
+ const { data, isLoading, error, summarize, reset } = useWorkspaceHourSummary();
79421
+ const selectedKey = selectedHour ? `${selectedHour.source}:${selectedHour.hourIndex}:${date}:${shiftId}` : "none";
79422
+ const autoSummaryKeyRef = React147__default.useRef(null);
79423
+ React147__default.useEffect(() => {
79424
+ reset();
79425
+ autoSummaryKeyRef.current = null;
79426
+ }, [reset, selectedKey]);
79427
+ const canSummarize = Boolean(workspaceId && companyId && date && shiftId !== null && shiftId !== void 0);
79428
+ React147__default.useEffect(() => {
79429
+ if (!selectedHour || !canSummarize || !companyId || !date || shiftId === null || shiftId === void 0) {
79430
+ return;
79431
+ }
79432
+ const requestKey = `${selectedKey}:${workspaceId}:${companyId}`;
79433
+ if (autoSummaryKeyRef.current === requestKey) {
79434
+ return;
79435
+ }
79436
+ autoSummaryKeyRef.current = requestKey;
79437
+ void summarize({
79438
+ workspaceId,
79439
+ companyId,
79440
+ date,
79441
+ shiftId,
79442
+ hourIndex: selectedHour.hourIndex,
79443
+ hourStart: selectedHour.startTime,
79444
+ hourEnd: selectedHour.endTime,
79445
+ forceRefresh: false,
79446
+ selectionSource: selectedHour.source ?? "unknown"
79447
+ }).catch(() => void 0);
79448
+ }, [canSummarize, companyId, date, selectedHour, selectedKey, shiftId, summarize, workspaceId]);
79449
+ if (!selectedHour) {
79450
+ return null;
79451
+ }
79452
+ const evidenceHour = data?.evidence?.hour ?? {};
79453
+ const verifiedTimeRange = typeof evidenceHour.timeRange === "string" && evidenceHour.timeRange ? evidenceHour.timeRange : selectedHour.timeRange;
79454
+ const formattedTimeRange = formatTimeRangeTo12Hour(verifiedTimeRange);
79455
+ const selectedMetric = selectedHour.source === "cycle" ? {
79456
+ label: "Cycle time",
79457
+ actual: formatSeconds(selectedHour.cycleTime),
79458
+ standard: formatSeconds(selectedHour.idealCycleTime)
79459
+ } : {
79460
+ label: "Hourly output",
79461
+ actual: formatWholeNumber(selectedHour.output),
79462
+ standard: formatWholeNumber(selectedHour.target)
79463
+ };
79464
+ return /* @__PURE__ */ jsxs("aside", { className: `rounded-lg border border-slate-200 bg-white shadow-sm ${className}`, children: [
79465
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-3 border-b border-slate-100 p-4", children: [
79466
+ /* @__PURE__ */ jsxs("div", { children: [
79467
+ /* @__PURE__ */ jsx("div", { className: "text-[11px] font-semibold uppercase tracking-wide text-slate-500", children: "Selected hour" }),
79468
+ /* @__PURE__ */ jsx("h4", { className: "mt-1 text-base font-semibold text-slate-950", children: formattedTimeRange })
79469
+ ] }),
79470
+ /* @__PURE__ */ jsx(
79471
+ "button",
79472
+ {
79473
+ type: "button",
79474
+ onClick: onClose,
79475
+ className: "inline-flex h-8 w-8 items-center justify-center rounded-md text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-800",
79476
+ "aria-label": "Close hour inspector",
79477
+ children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
79478
+ }
79479
+ )
79480
+ ] }),
79481
+ /* @__PURE__ */ jsxs("div", { className: "space-y-3 p-4", children: [
79482
+ selectedMetric.actual ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 text-sm", children: [
79483
+ /* @__PURE__ */ jsx("div", { className: "font-semibold text-slate-700", children: selectedMetric.label }),
79484
+ /* @__PURE__ */ jsxs("div", { className: "text-right", children: [
79485
+ /* @__PURE__ */ jsxs("div", { className: "font-semibold text-slate-950", children: [
79486
+ /* @__PURE__ */ jsx("span", { children: selectedMetric.actual }),
79487
+ selectedMetric.standard ? /* @__PURE__ */ jsxs(Fragment, { children: [
79488
+ /* @__PURE__ */ jsx("span", { className: "mx-1 text-slate-400", children: "/" }),
79489
+ /* @__PURE__ */ jsx("span", { children: selectedMetric.standard })
79490
+ ] }) : null
79491
+ ] }),
79492
+ selectedMetric.standard ? /* @__PURE__ */ jsx("div", { className: "text-xs font-medium text-slate-500", children: "actual / standard" }) : null
79493
+ ] })
79494
+ ] }) : null,
79495
+ /* @__PURE__ */ jsxs("section", { className: "rounded-md border border-slate-200 bg-slate-50/70 p-3", children: [
79496
+ /* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center gap-2 text-xs font-semibold uppercase tracking-wide text-slate-500", children: [
79497
+ /* @__PURE__ */ jsx(Sparkles, { className: "h-3.5 w-3.5" }),
79498
+ "AI summary"
79499
+ ] }),
79500
+ isLoading && !data ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-slate-600", children: [
79501
+ /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }),
79502
+ "Generating summary..."
79503
+ ] }) : data ? /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
79504
+ /* @__PURE__ */ jsx("h5", { className: "text-sm font-semibold text-slate-900", children: data.summary.headline }),
79505
+ /* @__PURE__ */ jsx("ul", { className: "space-y-1.5", children: data.summary.bullets.map((bullet, index) => /* @__PURE__ */ jsxs("li", { className: "text-sm leading-5 text-slate-700", children: [
79506
+ "\u2022 ",
79507
+ bullet
79508
+ ] }, `${index}-${bullet}`)) }),
79509
+ data.aiError ? /* @__PURE__ */ jsx("p", { className: "text-xs text-slate-500", children: "AI unavailable, showing deterministic summary." }) : null
79510
+ ] }) : error ? /* @__PURE__ */ jsx("p", { className: "text-sm text-red-700", children: "Could not summarize this hour. Please retry from the chart." }) : /* @__PURE__ */ jsx("p", { className: "text-sm text-slate-600", children: "Preparing summary..." })
79511
+ ] }),
79512
+ clipsEnabled ? /* @__PURE__ */ jsx("div", { className: "pt-1", children: /* @__PURE__ */ jsxs(
79513
+ "button",
79514
+ {
79515
+ type: "button",
79516
+ onClick: () => onOpenClips(selectedHour),
79517
+ className: "inline-flex items-center gap-2 rounded-md border border-slate-300 bg-white px-3 py-2 text-sm font-semibold text-slate-700 transition-colors hover:bg-slate-50",
79518
+ children: [
79519
+ /* @__PURE__ */ jsx(ExternalLink, { className: "h-4 w-4" }),
79520
+ "Open clips from this hour"
79521
+ ]
79522
+ }
79523
+ ) }) : null
79524
+ ] })
79525
+ ] });
79526
+ };
79100
79527
  var DEBUG_DASHBOARD2 = process.env.NEXT_PUBLIC_DEBUG_DASHBOARD === "true";
79101
79528
  var chartCardVariants = {
79102
79529
  initial: { opacity: 0, y: 10 },
@@ -79189,16 +79616,78 @@ var WorkspaceDetailView = ({
79189
79616
  const initialTab = getInitialTab(sourceType, defaultTab, fromMonthly, date);
79190
79617
  const [activeTab, setActiveTab] = useState(initialTab);
79191
79618
  const [isTransitioning, setIsTransitioning] = useState(false);
79619
+ const [pendingClipHourFilter, setPendingClipHourFilter] = useState(null);
79192
79620
  const [usingFallbackData, setUsingFallbackData] = useState(false);
79193
79621
  const { isIdleTimeVlmEnabled } = useIdleTimeVlmConfig();
79194
79622
  const [showChartIdleTime, setShowChartIdleTime] = useState(false);
79195
79623
  const [selectedSkuId, setSelectedSkuId] = useState(null);
79624
+ const [selectedHour, setSelectedHour] = useState(null);
79196
79625
  const desktopTopSectionClass = "flex-[3] min-h-0";
79197
79626
  const desktopBottomSectionClass = "flex-[2] min-h-0";
79627
+ useEffect(() => {
79628
+ setSelectedHour(null);
79629
+ }, [workspaceId, date, shift]);
79198
79630
  const dashboardConfig = useDashboardConfig();
79199
79631
  const { legend: efficiencyLegend } = useEfficiencyLegend();
79200
79632
  const prewarmedClipsRef = useRef(/* @__PURE__ */ new Set());
79201
79633
  const prewarmInFlightRef = useRef(/* @__PURE__ */ new Set());
79634
+ const [aiSummaryHour, setAiSummaryHour] = useState(null);
79635
+ const handleOutputHourSelect = useCallback((payload) => {
79636
+ setSelectedHour({
79637
+ source: "output",
79638
+ hourIndex: payload.hourIndex,
79639
+ timeRange: payload.timeRange,
79640
+ startTime: payload.startTime,
79641
+ endTime: payload.endTime,
79642
+ status: payload.status,
79643
+ output: payload.output,
79644
+ target: payload.target
79645
+ });
79646
+ }, []);
79647
+ const handleAiSummaryClick = useCallback((payload) => {
79648
+ setAiSummaryHour(payload);
79649
+ }, []);
79650
+ const handleCycleHourSelect = useCallback((payload) => {
79651
+ setSelectedHour({
79652
+ source: "cycle",
79653
+ hourIndex: payload.hourIndex,
79654
+ timeRange: payload.timeRange,
79655
+ startTime: payload.startTime,
79656
+ endTime: payload.endTime,
79657
+ status: payload.status,
79658
+ cycleTime: payload.cycleTime,
79659
+ idealCycleTime: payload.idealCycleTime,
79660
+ idleMinutes: payload.idleMinutes
79661
+ });
79662
+ }, []);
79663
+ const handleOpenClipsForHour = useCallback((hour) => {
79664
+ setPendingClipHourFilter({
79665
+ startTime: hour.startTime,
79666
+ endTime: hour.endTime,
79667
+ sourceLabel: hour.timeRange,
79668
+ status: hour.status === "below_target" || hour.status === "above_standard" ? "below_target" : "met_target"
79669
+ });
79670
+ setActiveTab("bottlenecks");
79671
+ }, []);
79672
+ const handleWatchClipsFromChart = useCallback((payload) => {
79673
+ handleOpenClipsForHour({
79674
+ source: "output",
79675
+ hourIndex: payload.hourIndex,
79676
+ timeRange: payload.timeRange,
79677
+ startTime: payload.startTime,
79678
+ endTime: payload.endTime,
79679
+ status: payload.status,
79680
+ output: payload.output,
79681
+ target: payload.target
79682
+ });
79683
+ }, [handleOpenClipsForHour]);
79684
+ const handleCloseHourSummary = useCallback(() => {
79685
+ setSelectedHour(null);
79686
+ }, []);
79687
+ const handleManualClipsTabClick = useCallback(() => {
79688
+ setPendingClipHourFilter(null);
79689
+ setActiveTab("bottlenecks");
79690
+ }, []);
79202
79691
  const { trendSummary: workspaceMonthlyTrend } = useMonthlyTrend({
79203
79692
  entityType: "workspace",
79204
79693
  entityId: workspaceId,
@@ -79583,6 +80072,10 @@ var WorkspaceDetailView = ({
79583
80072
  const monitoringMode = workspace?.monitoring_mode ?? "output";
79584
80073
  const isUptimeMode = monitoringMode === "uptime";
79585
80074
  const idleTimeVlmEnabled = isIdleTimeVlmEnabled(resolvedLineId);
80075
+ const showHourSummaryPanel = Boolean(selectedHour && !isUptimeMode);
80076
+ const hourSummaryCompanyId = workspace?.company_id || dashboardConfig?.entityConfig?.companyId || null;
80077
+ const hourSummaryDate = workspace?.date || date || calculatedOperationalDate || null;
80078
+ const hourSummaryShiftId = workspace?.shift_id ?? parsedShiftId ?? null;
79586
80079
  useEffect(() => {
79587
80080
  if (!isClipsEnabled || !dashboardConfig?.s3Config || !workspaceId) {
79588
80081
  return;
@@ -80154,91 +80647,66 @@ var WorkspaceDetailView = ({
80154
80647
  )
80155
80648
  ] });
80156
80649
  }
80157
- return /* @__PURE__ */ jsx(
80650
+ return /* @__PURE__ */ jsxs(
80158
80651
  motion.div,
80159
80652
  {
80160
80653
  className: `min-h-screen bg-slate-50 ${className}`,
80161
80654
  initial: { opacity: 1 },
80162
80655
  animate: { opacity: 1 },
80163
- children: /* @__PURE__ */ jsxs("div", { className: "min-h-screen w-full flex flex-col bg-slate-50", children: [
80164
- /* @__PURE__ */ jsxs("header", { className: "sticky top-0 z-40 px-3 sm:px-4 md:px-5 lg:px-6 py-3 sm:py-3 lg:py-3.5 flex flex-col shadow-sm bg-white", children: [
80165
- /* @__PURE__ */ jsx("div", { className: "sm:hidden", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
80166
- /* @__PURE__ */ jsx(
80167
- "button",
80168
- {
80169
- onClick: handleBackNavigation,
80170
- className: "p-2 -ml-2 rounded-full active:bg-gray-100 transition-colors",
80171
- "aria-label": "Navigate back",
80172
- children: /* @__PURE__ */ jsx(ArrowLeft, { className: "w-5 h-5 text-gray-700" })
80173
- }
80174
- ),
80175
- /* @__PURE__ */ jsx("div", { className: "flex-1 flex flex-col items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
80176
- /* @__PURE__ */ jsx("h1", { className: "text-base font-semibold text-gray-900 truncate max-w-[220px]", children: formattedWorkspaceName }),
80177
- /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsxs("div", { className: "relative flex h-2 w-2", children: [
80178
- isLive && /* @__PURE__ */ jsx("span", { className: "animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75" }),
80179
- /* @__PURE__ */ jsx("span", { className: clsx(
80180
- "relative inline-flex rounded-full h-2 w-2",
80181
- isLive ? "bg-green-500" : "bg-red-500"
80182
- ) })
80183
- ] }) })
80184
- ] }) }),
80185
- /* @__PURE__ */ jsx("div", { className: "w-9" })
80186
- ] }) }),
80187
- /* @__PURE__ */ jsx("div", { className: "hidden sm:block", children: /* @__PURE__ */ jsxs("div", { className: "relative flex items-center", children: [
80188
- /* @__PURE__ */ jsx("div", { className: "absolute left-0 z-10", children: /* @__PURE__ */ jsx(
80189
- BackButtonMinimal,
80190
- {
80191
- onClick: handleBackNavigation,
80192
- text: previousView === "line_monthly_history" ? "Back to Line History" : returnUrl && returnUrl.includes("monthly_history") ? "Back to Line History" : returnUrl && returnUrl.includes("/kpis/") ? "Back to KPIs" : returnUrl && returnUrl.includes("/leaderboard/") ? "Back to Leaderboard" : isHistoricView && activeTab !== "monthly_history" ? "Back to Monthly History" : "Back",
80193
- size: "default",
80194
- "aria-label": "Navigate back to previous page"
80195
- }
80196
- ) }),
80197
- /* @__PURE__ */ jsx("div", { className: "absolute left-1/2 transform -translate-x-1/2 max-w-[calc(100%-200px)]", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center gap-2", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
80198
- /* @__PURE__ */ jsx("h1", { className: "text-lg md:text-xl lg:text-2xl xl:text-3xl font-semibold text-gray-900 truncate", children: formattedWorkspaceName }),
80199
- /* @__PURE__ */ jsxs("div", { className: "relative flex h-2.5 w-2.5", children: [
80200
- isLive && /* @__PURE__ */ jsx("span", { className: "animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75" }),
80201
- /* @__PURE__ */ jsx("span", { className: clsx(
80202
- "relative inline-flex rounded-full h-2.5 w-2.5",
80203
- isLive ? "bg-green-500" : "bg-red-500"
80204
- ) })
80205
- ] })
80206
- ] }) }) }),
80207
- activeTab !== "monthly_history" && /* @__PURE__ */ jsx("div", { className: "absolute right-0 top-0 flex flex-col items-end gap-1", children: workspaceHealth && /* @__PURE__ */ jsxs("span", { className: "text-xs text-gray-500", children: [
80208
- "Last update: ",
80209
- workspaceHealth.timeSinceLastUpdate
80656
+ children: [
80657
+ /* @__PURE__ */ jsxs("div", { className: "min-h-screen w-full flex flex-col bg-slate-50", children: [
80658
+ /* @__PURE__ */ jsxs("header", { className: "sticky top-0 z-40 px-3 sm:px-4 md:px-5 lg:px-6 py-3 sm:py-3 lg:py-3.5 flex flex-col shadow-sm bg-white", children: [
80659
+ /* @__PURE__ */ jsx("div", { className: "sm:hidden", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
80660
+ /* @__PURE__ */ jsx(
80661
+ "button",
80662
+ {
80663
+ onClick: handleBackNavigation,
80664
+ className: "p-2 -ml-2 rounded-full active:bg-gray-100 transition-colors",
80665
+ "aria-label": "Navigate back",
80666
+ children: /* @__PURE__ */ jsx(ArrowLeft, { className: "w-5 h-5 text-gray-700" })
80667
+ }
80668
+ ),
80669
+ /* @__PURE__ */ jsx("div", { className: "flex-1 flex flex-col items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
80670
+ /* @__PURE__ */ jsx("h1", { className: "text-base font-semibold text-gray-900 truncate max-w-[220px]", children: formattedWorkspaceName }),
80671
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsxs("div", { className: "relative flex h-2 w-2", children: [
80672
+ isLive && /* @__PURE__ */ jsx("span", { className: "animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75" }),
80673
+ /* @__PURE__ */ jsx("span", { className: clsx(
80674
+ "relative inline-flex rounded-full h-2 w-2",
80675
+ isLive ? "bg-green-500" : "bg-red-500"
80676
+ ) })
80677
+ ] }) })
80678
+ ] }) }),
80679
+ /* @__PURE__ */ jsx("div", { className: "w-9" })
80210
80680
  ] }) }),
80211
- /* @__PURE__ */ jsx("div", { className: "w-full h-8" })
80212
- ] }) }),
80213
- /* @__PURE__ */ jsx(Fragment, { children: activeTab === "monthly_history" ? /* @__PURE__ */ jsxs(Fragment, { children: [
80214
- /* @__PURE__ */ jsxs("div", { className: "sm:hidden mt-3 flex items-center justify-center gap-2", children: [
80215
- /* @__PURE__ */ jsx("div", { className: "inline-flex items-center px-2.5 py-1 bg-gray-100 rounded-full", children: /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: (() => {
80216
- const monthBounds2 = getMonthKeyBounds(selectedYear, selectedMonth);
80217
- const normalizedRange = normalizeDateKeyRangeUnbounded(rangeStart, rangeEnd);
80218
- const startDate = parseDateKeyToDate(normalizedRange.startKey);
80219
- const endDate = parseDateKeyToDate(normalizedRange.endKey);
80220
- const isFullMonth = normalizedRange.startKey === monthBounds2.startKey && normalizedRange.endKey === monthBounds2.endKey;
80221
- if (isFullMonth) {
80222
- return `${startDate.toLocaleDateString("en-US", { month: "short", day: "numeric" })} - ${endDate.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" })}`;
80681
+ /* @__PURE__ */ jsx("div", { className: "hidden sm:block", children: /* @__PURE__ */ jsxs("div", { className: "relative flex items-center", children: [
80682
+ /* @__PURE__ */ jsx("div", { className: "absolute left-0 z-10", children: /* @__PURE__ */ jsx(
80683
+ BackButtonMinimal,
80684
+ {
80685
+ onClick: handleBackNavigation,
80686
+ text: previousView === "line_monthly_history" ? "Back to Line History" : returnUrl && returnUrl.includes("monthly_history") ? "Back to Line History" : returnUrl && returnUrl.includes("/kpis/") ? "Back to KPIs" : returnUrl && returnUrl.includes("/leaderboard/") ? "Back to Leaderboard" : isHistoricView && activeTab !== "monthly_history" ? "Back to Monthly History" : "Back",
80687
+ size: "default",
80688
+ "aria-label": "Navigate back to previous page"
80223
80689
  }
80224
- return `${startDate.toLocaleDateString("en-US", { month: "short", day: "numeric" })} - ${endDate.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" })}`;
80225
- })() }) }),
80226
- /* @__PURE__ */ jsxs("div", { className: "inline-flex items-center gap-1 px-2.5 py-1 bg-gray-100 rounded-full", children: [
80227
- /* @__PURE__ */ jsx("div", { className: "text-gray-700 scale-90", children: (() => {
80228
- const shift2 = shiftConfig?.shifts?.find((s) => s.shiftId === selectedShift);
80229
- const shiftName = shift2?.shiftName || (selectedShift === 0 ? "Day Shift" : "Night Shift");
80230
- return getShiftIcon2(shiftName);
80231
- })() }),
80232
- /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: (() => {
80233
- const shift2 = shiftConfig?.shifts?.find((s) => s.shiftId === selectedShift);
80234
- return shift2?.shiftName || (selectedShift === 0 ? "Day Shift" : "Night Shift");
80235
- })() })
80236
- ] })
80237
- ] }),
80238
- /* @__PURE__ */ jsx("div", { className: "hidden sm:block mt-3 bg-blue-50/50 px-4 py-2 rounded-xl border border-blue-100/50 backdrop-blur-sm", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-center gap-6", children: [
80239
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-blue-600", children: [
80240
- /* @__PURE__ */ jsx("svg", { className: "w-4 h-4 opacity-70", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" }) }),
80241
- /* @__PURE__ */ jsx("span", { className: "text-sm md:text-base font-medium", children: (() => {
80690
+ ) }),
80691
+ /* @__PURE__ */ jsx("div", { className: "absolute left-1/2 transform -translate-x-1/2 max-w-[calc(100%-200px)]", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center gap-2", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
80692
+ /* @__PURE__ */ jsx("h1", { className: "text-lg md:text-xl lg:text-2xl xl:text-3xl font-semibold text-gray-900 truncate", children: formattedWorkspaceName }),
80693
+ /* @__PURE__ */ jsxs("div", { className: "relative flex h-2.5 w-2.5", children: [
80694
+ isLive && /* @__PURE__ */ jsx("span", { className: "animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75" }),
80695
+ /* @__PURE__ */ jsx("span", { className: clsx(
80696
+ "relative inline-flex rounded-full h-2.5 w-2.5",
80697
+ isLive ? "bg-green-500" : "bg-red-500"
80698
+ ) })
80699
+ ] })
80700
+ ] }) }) }),
80701
+ activeTab !== "monthly_history" && /* @__PURE__ */ jsx("div", { className: "absolute right-0 top-0 flex flex-col items-end gap-1", children: workspaceHealth && /* @__PURE__ */ jsxs("span", { className: "text-xs text-gray-500", children: [
80702
+ "Last update: ",
80703
+ workspaceHealth.timeSinceLastUpdate
80704
+ ] }) }),
80705
+ /* @__PURE__ */ jsx("div", { className: "w-full h-8" })
80706
+ ] }) }),
80707
+ /* @__PURE__ */ jsx(Fragment, { children: activeTab === "monthly_history" ? /* @__PURE__ */ jsxs(Fragment, { children: [
80708
+ /* @__PURE__ */ jsxs("div", { className: "sm:hidden mt-3 flex items-center justify-center gap-2", children: [
80709
+ /* @__PURE__ */ jsx("div", { className: "inline-flex items-center px-2.5 py-1 bg-gray-100 rounded-full", children: /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: (() => {
80242
80710
  const monthBounds2 = getMonthKeyBounds(selectedYear, selectedMonth);
80243
80711
  const normalizedRange = normalizeDateKeyRangeUnbounded(rangeStart, rangeEnd);
80244
80712
  const startDate = parseDateKeyToDate(normalizedRange.startKey);
@@ -80248,107 +80716,106 @@ var WorkspaceDetailView = ({
80248
80716
  return `${startDate.toLocaleDateString("en-US", { month: "short", day: "numeric" })} - ${endDate.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" })}`;
80249
80717
  }
80250
80718
  return `${startDate.toLocaleDateString("en-US", { month: "short", day: "numeric" })} - ${endDate.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" })}`;
80251
- })() })
80252
- ] }),
80253
- /* @__PURE__ */ jsx("div", { className: "w-px h-4 bg-blue-200" }),
80254
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-blue-600", children: [
80255
- /* @__PURE__ */ jsx("div", { className: "opacity-70", children: (() => {
80256
- const shift2 = shiftConfig?.shifts?.find((s) => s.shiftId === selectedShift);
80257
- const shiftName = shift2?.shiftName || (selectedShift === 0 ? "Day Shift" : "Night Shift");
80258
- return getShiftIcon2(shiftName);
80259
- })() }),
80260
- /* @__PURE__ */ jsx("span", { className: "text-sm md:text-base font-semibold uppercase tracking-wider", children: (() => {
80261
- const shift2 = shiftConfig?.shifts?.find((s) => s.shiftId === selectedShift);
80262
- const name = shift2?.shiftName || (selectedShift === 0 ? "Day Shift" : "Night Shift");
80263
- return name.replace(/ Shift$/i, "") + " Shift";
80264
- })() })
80265
- ] })
80266
- ] }) })
80267
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
80268
- /* @__PURE__ */ jsxs("div", { className: "sm:hidden mt-3 flex items-center justify-center gap-2", children: [
80269
- /* @__PURE__ */ jsx("div", { className: "inline-flex items-center px-2.5 py-1 bg-gray-100 rounded-full", children: /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: formatISTDate2(new Date(workspace.date)) }) }),
80270
- /* @__PURE__ */ jsxs("div", { className: "inline-flex items-center gap-1 px-2.5 py-1 bg-gray-100 rounded-full", children: [
80271
- /* @__PURE__ */ jsx("div", { className: "text-gray-700 scale-90", children: getShiftIcon2(workspace.shift_type) }),
80272
- /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: workspace.shift_type })
80719
+ })() }) }),
80720
+ /* @__PURE__ */ jsxs("div", { className: "inline-flex items-center gap-1 px-2.5 py-1 bg-gray-100 rounded-full", children: [
80721
+ /* @__PURE__ */ jsx("div", { className: "text-gray-700 scale-90", children: (() => {
80722
+ const shift2 = shiftConfig?.shifts?.find((s) => s.shiftId === selectedShift);
80723
+ const shiftName = shift2?.shiftName || (selectedShift === 0 ? "Day Shift" : "Night Shift");
80724
+ return getShiftIcon2(shiftName);
80725
+ })() }),
80726
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: (() => {
80727
+ const shift2 = shiftConfig?.shifts?.find((s) => s.shiftId === selectedShift);
80728
+ return shift2?.shiftName || (selectedShift === 0 ? "Day Shift" : "Night Shift");
80729
+ })() })
80730
+ ] })
80273
80731
  ] }),
80274
- !date && !shift && !usingFallbackData ? /* @__PURE__ */ jsx("div", { className: "inline-flex items-center px-2.5 py-1 bg-green-100 rounded-full", children: /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-green-700", children: /* @__PURE__ */ jsx(LiveTimer, {}) }) }) : date ? /* @__PURE__ */ jsx("div", { className: "inline-flex items-center px-2.5 py-1 bg-blue-100 rounded-full", children: /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-blue-700", children: getDaysDifference(workspace.date, timezone, dashboardConfig?.shiftConfig?.dayShift?.startTime || "06:00") }) }) : usingFallbackData ? /* @__PURE__ */ jsx("div", { className: "inline-flex items-center px-2.5 py-1 bg-amber-100 rounded-full", children: /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-amber-700", children: getDaysDifference(workspace.date, timezone, dashboardConfig?.shiftConfig?.dayShift?.startTime || "06:00") }) }) : null
80275
- ] }),
80276
- /* @__PURE__ */ jsx("div", { className: "hidden sm:block mt-3 bg-blue-50/50 px-4 py-2 rounded-xl border border-blue-100/50 backdrop-blur-sm", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-center gap-6", children: [
80277
- !date && !shift && !usingFallbackData && /* @__PURE__ */ jsxs(Fragment, { children: [
80278
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-blue-700", children: [
80279
- /* @__PURE__ */ jsx("svg", { className: "w-4 h-4 opacity-70", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
80280
- /* @__PURE__ */ jsx("span", { className: "text-base font-semibold tabular-nums", children: /* @__PURE__ */ jsx(LiveTimer, {}) })
80732
+ /* @__PURE__ */ jsx("div", { className: "hidden sm:block mt-3 bg-blue-50/50 px-4 py-2 rounded-xl border border-blue-100/50 backdrop-blur-sm", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-center gap-6", children: [
80733
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-blue-600", children: [
80734
+ /* @__PURE__ */ jsx("svg", { className: "w-4 h-4 opacity-70", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" }) }),
80735
+ /* @__PURE__ */ jsx("span", { className: "text-sm md:text-base font-medium", children: (() => {
80736
+ const monthBounds2 = getMonthKeyBounds(selectedYear, selectedMonth);
80737
+ const normalizedRange = normalizeDateKeyRangeUnbounded(rangeStart, rangeEnd);
80738
+ const startDate = parseDateKeyToDate(normalizedRange.startKey);
80739
+ const endDate = parseDateKeyToDate(normalizedRange.endKey);
80740
+ const isFullMonth = normalizedRange.startKey === monthBounds2.startKey && normalizedRange.endKey === monthBounds2.endKey;
80741
+ if (isFullMonth) {
80742
+ return `${startDate.toLocaleDateString("en-US", { month: "short", day: "numeric" })} - ${endDate.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" })}`;
80743
+ }
80744
+ return `${startDate.toLocaleDateString("en-US", { month: "short", day: "numeric" })} - ${endDate.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" })}`;
80745
+ })() })
80281
80746
  ] }),
80282
- /* @__PURE__ */ jsx("div", { className: "w-px h-4 bg-blue-200" })
80283
- ] }),
80284
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-blue-600", children: [
80285
- /* @__PURE__ */ jsx("svg", { className: "w-4 h-4 opacity-70", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" }) }),
80286
- /* @__PURE__ */ jsx("span", { className: "text-sm md:text-base font-medium", children: formatISTDate2(new Date(workspace.date)) })
80287
- ] }),
80288
- /* @__PURE__ */ jsx("div", { className: "w-px h-4 bg-blue-200" }),
80289
- date && /* @__PURE__ */ jsxs(Fragment, { children: [
80290
- /* @__PURE__ */ jsx("span", { className: "px-2 py-1 text-xs font-medium bg-blue-100 text-blue-700 border border-blue-200 rounded-md", children: getDaysDifference(workspace.date, timezone, dashboardConfig?.shiftConfig?.dayShift?.startTime || "06:00") }),
80291
- /* @__PURE__ */ jsx("div", { className: "w-px h-4 bg-blue-200" })
80292
- ] }),
80293
- !date && !shift && usingFallbackData && /* @__PURE__ */ jsxs(Fragment, { children: [
80294
- /* @__PURE__ */ jsxs("span", { className: "px-2 py-1 text-xs font-medium bg-amber-50 text-amber-700 border border-amber-200 rounded-md", children: [
80295
- "Latest available data (",
80296
- getDaysDifference(workspace.date, timezone, dashboardConfig?.shiftConfig?.dayShift?.startTime || "06:00"),
80297
- ")"
80747
+ /* @__PURE__ */ jsx("div", { className: "w-px h-4 bg-blue-200" }),
80748
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-blue-600", children: [
80749
+ /* @__PURE__ */ jsx("div", { className: "opacity-70", children: (() => {
80750
+ const shift2 = shiftConfig?.shifts?.find((s) => s.shiftId === selectedShift);
80751
+ const shiftName = shift2?.shiftName || (selectedShift === 0 ? "Day Shift" : "Night Shift");
80752
+ return getShiftIcon2(shiftName);
80753
+ })() }),
80754
+ /* @__PURE__ */ jsx("span", { className: "text-sm md:text-base font-semibold uppercase tracking-wider", children: (() => {
80755
+ const shift2 = shiftConfig?.shifts?.find((s) => s.shiftId === selectedShift);
80756
+ const name = shift2?.shiftName || (selectedShift === 0 ? "Day Shift" : "Night Shift");
80757
+ return name.replace(/ Shift$/i, "") + " Shift";
80758
+ })() })
80759
+ ] })
80760
+ ] }) })
80761
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
80762
+ /* @__PURE__ */ jsxs("div", { className: "sm:hidden mt-3 flex items-center justify-center gap-2", children: [
80763
+ /* @__PURE__ */ jsx("div", { className: "inline-flex items-center px-2.5 py-1 bg-gray-100 rounded-full", children: /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: formatISTDate2(new Date(workspace.date)) }) }),
80764
+ /* @__PURE__ */ jsxs("div", { className: "inline-flex items-center gap-1 px-2.5 py-1 bg-gray-100 rounded-full", children: [
80765
+ /* @__PURE__ */ jsx("div", { className: "text-gray-700 scale-90", children: getShiftIcon2(workspace.shift_type) }),
80766
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: workspace.shift_type })
80298
80767
  ] }),
80299
- /* @__PURE__ */ jsx("div", { className: "w-px h-4 bg-blue-200" })
80768
+ !date && !shift && !usingFallbackData ? /* @__PURE__ */ jsx("div", { className: "inline-flex items-center px-2.5 py-1 bg-green-100 rounded-full", children: /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-green-700", children: /* @__PURE__ */ jsx(LiveTimer, {}) }) }) : date ? /* @__PURE__ */ jsx("div", { className: "inline-flex items-center px-2.5 py-1 bg-blue-100 rounded-full", children: /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-blue-700", children: getDaysDifference(workspace.date, timezone, dashboardConfig?.shiftConfig?.dayShift?.startTime || "06:00") }) }) : usingFallbackData ? /* @__PURE__ */ jsx("div", { className: "inline-flex items-center px-2.5 py-1 bg-amber-100 rounded-full", children: /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-amber-700", children: getDaysDifference(workspace.date, timezone, dashboardConfig?.shiftConfig?.dayShift?.startTime || "06:00") }) }) : null
80300
80769
  ] }),
80301
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-blue-600", children: [
80302
- /* @__PURE__ */ jsx("div", { className: "opacity-70", children: getShiftIcon2(workspace.shift_type) }),
80303
- /* @__PURE__ */ jsxs("span", { className: "text-sm md:text-base font-semibold uppercase tracking-wider", children: [
80304
- workspace.shift_type.replace(/ Shift$/i, ""),
80305
- " Shift"
80770
+ /* @__PURE__ */ jsx("div", { className: "hidden sm:block mt-3 bg-blue-50/50 px-4 py-2 rounded-xl border border-blue-100/50 backdrop-blur-sm", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-center gap-6", children: [
80771
+ !date && !shift && !usingFallbackData && /* @__PURE__ */ jsxs(Fragment, { children: [
80772
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-blue-700", children: [
80773
+ /* @__PURE__ */ jsx("svg", { className: "w-4 h-4 opacity-70", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
80774
+ /* @__PURE__ */ jsx("span", { className: "text-base font-semibold tabular-nums", children: /* @__PURE__ */ jsx(LiveTimer, {}) })
80775
+ ] }),
80776
+ /* @__PURE__ */ jsx("div", { className: "w-px h-4 bg-blue-200" })
80777
+ ] }),
80778
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-blue-600", children: [
80779
+ /* @__PURE__ */ jsx("svg", { className: "w-4 h-4 opacity-70", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" }) }),
80780
+ /* @__PURE__ */ jsx("span", { className: "text-sm md:text-base font-medium", children: formatISTDate2(new Date(workspace.date)) })
80781
+ ] }),
80782
+ /* @__PURE__ */ jsx("div", { className: "w-px h-4 bg-blue-200" }),
80783
+ date && /* @__PURE__ */ jsxs(Fragment, { children: [
80784
+ /* @__PURE__ */ jsx("span", { className: "px-2 py-1 text-xs font-medium bg-blue-100 text-blue-700 border border-blue-200 rounded-md", children: getDaysDifference(workspace.date, timezone, dashboardConfig?.shiftConfig?.dayShift?.startTime || "06:00") }),
80785
+ /* @__PURE__ */ jsx("div", { className: "w-px h-4 bg-blue-200" })
80786
+ ] }),
80787
+ !date && !shift && usingFallbackData && /* @__PURE__ */ jsxs(Fragment, { children: [
80788
+ /* @__PURE__ */ jsxs("span", { className: "px-2 py-1 text-xs font-medium bg-amber-50 text-amber-700 border border-amber-200 rounded-md", children: [
80789
+ "Latest available data (",
80790
+ getDaysDifference(workspace.date, timezone, dashboardConfig?.shiftConfig?.dayShift?.startTime || "06:00"),
80791
+ ")"
80792
+ ] }),
80793
+ /* @__PURE__ */ jsx("div", { className: "w-px h-4 bg-blue-200" })
80794
+ ] }),
80795
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-blue-600", children: [
80796
+ /* @__PURE__ */ jsx("div", { className: "opacity-70", children: getShiftIcon2(workspace.shift_type) }),
80797
+ /* @__PURE__ */ jsxs("span", { className: "text-sm md:text-base font-semibold uppercase tracking-wider", children: [
80798
+ workspace.shift_type.replace(/ Shift$/i, ""),
80799
+ " Shift"
80800
+ ] })
80306
80801
  ] })
80307
- ] })
80308
- ] }) })
80309
- ] }) }),
80310
- /* @__PURE__ */ jsxs("div", { className: "mt-2 sm:mt-1.5 lg:mt-2", children: [
80311
- /* @__PURE__ */ jsx("div", { className: "sm:hidden", children: /* @__PURE__ */ jsxs("div", { className: "flex bg-gray-100 rounded-lg p-0.5", children: [
80312
- /* @__PURE__ */ jsx(
80313
- "button",
80314
- {
80315
- onClick: () => setActiveTab("overview"),
80316
- className: `flex-1 px-2 py-1.5 text-xs font-medium rounded-md transition-all duration-200 ${activeTab === "overview" ? "bg-white text-gray-900 shadow-sm" : "text-gray-600"}`,
80317
- children: overviewTabLabel
80318
- }
80319
- ),
80320
- isClipsEnabled && /* @__PURE__ */ jsx(
80321
- "button",
80322
- {
80323
- onClick: () => setActiveTab("bottlenecks"),
80324
- className: `flex-1 px-2 py-1.5 text-xs font-medium rounded-md transition-all duration-200 ${activeTab === "bottlenecks" ? "bg-white text-gray-900 shadow-sm" : "text-gray-600"}`,
80325
- children: "Clips"
80326
- }
80327
- ),
80328
- /* @__PURE__ */ jsx(
80329
- "button",
80330
- {
80331
- onClick: () => setActiveTab("monthly_history"),
80332
- className: `flex-1 px-2 py-1.5 text-xs font-medium rounded-md transition-all duration-200 ${activeTab === "monthly_history" ? "bg-white text-gray-900 shadow-sm" : "text-gray-600"}`,
80333
- children: "History"
80334
- }
80335
- )
80802
+ ] }) })
80336
80803
  ] }) }),
80337
- /* @__PURE__ */ jsxs("div", { className: "hidden sm:flex items-center justify-between", children: [
80338
- /* @__PURE__ */ jsxs("div", { className: "flex gap-1.5 lg:gap-2", children: [
80804
+ /* @__PURE__ */ jsxs("div", { className: "mt-2 sm:mt-1.5 lg:mt-2", children: [
80805
+ /* @__PURE__ */ jsx("div", { className: "sm:hidden", children: /* @__PURE__ */ jsxs("div", { className: "flex bg-gray-100 rounded-lg p-0.5", children: [
80339
80806
  /* @__PURE__ */ jsx(
80340
80807
  "button",
80341
80808
  {
80342
80809
  onClick: () => setActiveTab("overview"),
80343
- className: `px-2 lg:px-3 py-1 lg:py-1.5 text-sm lg:text-base font-medium rounded-lg transition-colors whitespace-nowrap ${activeTab === "overview" ? "bg-blue-50 text-blue-600" : "text-gray-600 hover:bg-gray-50"}`,
80810
+ className: `flex-1 px-2 py-1.5 text-xs font-medium rounded-md transition-all duration-200 ${activeTab === "overview" ? "bg-white text-gray-900 shadow-sm" : "text-gray-600"}`,
80344
80811
  children: overviewTabLabel
80345
80812
  }
80346
80813
  ),
80347
80814
  isClipsEnabled && /* @__PURE__ */ jsx(
80348
80815
  "button",
80349
80816
  {
80350
- onClick: () => setActiveTab("bottlenecks"),
80351
- className: `px-2 lg:px-3 py-1 lg:py-1.5 text-sm lg:text-base font-medium rounded-lg transition-colors whitespace-nowrap ${activeTab === "bottlenecks" ? "bg-blue-50 text-blue-600" : "text-gray-600 hover:bg-gray-50"}`,
80817
+ onClick: handleManualClipsTabClick,
80818
+ className: `flex-1 px-2 py-1.5 text-xs font-medium rounded-md transition-all duration-200 ${activeTab === "bottlenecks" ? "bg-white text-gray-900 shadow-sm" : "text-gray-600"}`,
80352
80819
  children: "Clips"
80353
80820
  }
80354
80821
  ),
@@ -80356,280 +80823,153 @@ var WorkspaceDetailView = ({
80356
80823
  "button",
80357
80824
  {
80358
80825
  onClick: () => setActiveTab("monthly_history"),
80359
- className: `px-2 lg:px-3 py-1 lg:py-1.5 text-sm lg:text-base font-medium rounded-lg transition-colors whitespace-nowrap ${activeTab === "monthly_history" ? "bg-blue-50 text-blue-600" : "text-gray-600 hover:bg-gray-50"}`,
80360
- children: "Monthly History"
80826
+ className: `flex-1 px-2 py-1.5 text-xs font-medium rounded-md transition-all duration-200 ${activeTab === "monthly_history" ? "bg-white text-gray-900 shadow-sm" : "text-gray-600"}`,
80827
+ children: "History"
80361
80828
  }
80362
80829
  )
80363
- ] }),
80364
- activeTab === "overview" && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1.5 lg:gap-2", children: renderHeaderActions ? renderHeaderActions(workspace) : /* @__PURE__ */ jsx(
80365
- WorkspacePdfGenerator,
80366
- {
80367
- workspace,
80368
- idleTimeReasons: idleTimeChartData,
80369
- efficiencyLegend,
80370
- hourlyCycleTimes: cycleTimeChartData,
80371
- shiftBreaks: shiftConfig?.shifts?.find((shift2) => shift2.shiftId === workspace.shift_id)?.breaks || [],
80372
- reportTimezone: shiftConfig?.timezone || timezone
80373
- }
80374
- ) }),
80375
- activeTab === "monthly_history" && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
80376
- /* @__PURE__ */ jsx(
80377
- MonthlyRangeFilter_default,
80378
- {
80379
- month: selectedMonth,
80380
- year: selectedYear,
80381
- timezone,
80382
- value: { startKey: rangeStart, endKey: rangeEnd },
80383
- onChange: (nextRange) => {
80384
- const startDate = parseDateKeyToDate(nextRange.startKey);
80385
- const nextMonth = startDate.getMonth();
80386
- const nextYear = startDate.getFullYear();
80387
- setRangeStart(nextRange.startKey);
80388
- setRangeEnd(nextRange.endKey);
80389
- if (nextMonth !== selectedMonth || nextYear !== selectedYear) {
80390
- setSelectedMonth(nextMonth);
80391
- setSelectedYear(nextYear);
80392
- }
80393
- },
80394
- showLabel: false
80395
- }
80396
- ),
80397
- /* @__PURE__ */ jsx(
80398
- WorkspaceMonthlyPdfGenerator,
80830
+ ] }) }),
80831
+ /* @__PURE__ */ jsxs("div", { className: "hidden sm:flex items-center justify-between", children: [
80832
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-1.5 lg:gap-2", children: [
80833
+ /* @__PURE__ */ jsx(
80834
+ "button",
80835
+ {
80836
+ onClick: () => setActiveTab("overview"),
80837
+ className: `px-2 lg:px-3 py-1 lg:py-1.5 text-sm lg:text-base font-medium rounded-lg transition-colors whitespace-nowrap ${activeTab === "overview" ? "bg-blue-50 text-blue-600" : "text-gray-600 hover:bg-gray-50"}`,
80838
+ children: overviewTabLabel
80839
+ }
80840
+ ),
80841
+ isClipsEnabled && /* @__PURE__ */ jsx(
80842
+ "button",
80843
+ {
80844
+ onClick: handleManualClipsTabClick,
80845
+ className: `px-2 lg:px-3 py-1 lg:py-1.5 text-sm lg:text-base font-medium rounded-lg transition-colors whitespace-nowrap ${activeTab === "bottlenecks" ? "bg-blue-50 text-blue-600" : "text-gray-600 hover:bg-gray-50"}`,
80846
+ children: "Clips"
80847
+ }
80848
+ ),
80849
+ /* @__PURE__ */ jsx(
80850
+ "button",
80851
+ {
80852
+ onClick: () => setActiveTab("monthly_history"),
80853
+ className: `px-2 lg:px-3 py-1 lg:py-1.5 text-sm lg:text-base font-medium rounded-lg transition-colors whitespace-nowrap ${activeTab === "monthly_history" ? "bg-blue-50 text-blue-600" : "text-gray-600 hover:bg-gray-50"}`,
80854
+ children: "Monthly History"
80855
+ }
80856
+ )
80857
+ ] }),
80858
+ activeTab === "overview" && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1.5 lg:gap-2", children: renderHeaderActions ? renderHeaderActions(workspace) : /* @__PURE__ */ jsx(
80859
+ WorkspacePdfGenerator,
80399
80860
  {
80400
- workspaceId,
80401
- workspaceName: formattedWorkspaceName,
80402
- lineName: resolvedLineName,
80403
- monthlyData,
80404
- analysisData: analysisMonthlyData,
80405
- selectedMonth,
80406
- selectedYear,
80407
- monitoringMode: workspace?.monitoring_mode,
80408
- rangeStart,
80409
- rangeEnd,
80410
- selectedShiftId: selectedShift,
80411
- availableShifts: shiftConfig?.shifts?.map((s) => ({ id: s.shiftId, name: s.shiftName })),
80412
- shiftConfig,
80861
+ workspace,
80862
+ idleTimeReasons: idleTimeChartData,
80413
80863
  efficiencyLegend,
80414
- trendSummary: workspaceMonthlyTrend,
80415
- compact: true,
80416
- isAssemblyWorkspace
80864
+ hourlyCycleTimes: cycleTimeChartData,
80865
+ shiftBreaks: shiftConfig?.shifts?.find((shift2) => shift2.shiftId === workspace.shift_id)?.breaks || [],
80866
+ reportTimezone: shiftConfig?.timezone || timezone
80417
80867
  }
80418
- )
80868
+ ) }),
80869
+ activeTab === "monthly_history" && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
80870
+ /* @__PURE__ */ jsx(
80871
+ MonthlyRangeFilter_default,
80872
+ {
80873
+ month: selectedMonth,
80874
+ year: selectedYear,
80875
+ timezone,
80876
+ value: { startKey: rangeStart, endKey: rangeEnd },
80877
+ onChange: (nextRange) => {
80878
+ const startDate = parseDateKeyToDate(nextRange.startKey);
80879
+ const nextMonth = startDate.getMonth();
80880
+ const nextYear = startDate.getFullYear();
80881
+ setRangeStart(nextRange.startKey);
80882
+ setRangeEnd(nextRange.endKey);
80883
+ if (nextMonth !== selectedMonth || nextYear !== selectedYear) {
80884
+ setSelectedMonth(nextMonth);
80885
+ setSelectedYear(nextYear);
80886
+ }
80887
+ },
80888
+ showLabel: false
80889
+ }
80890
+ ),
80891
+ /* @__PURE__ */ jsx(
80892
+ WorkspaceMonthlyPdfGenerator,
80893
+ {
80894
+ workspaceId,
80895
+ workspaceName: formattedWorkspaceName,
80896
+ lineName: resolvedLineName,
80897
+ monthlyData,
80898
+ analysisData: analysisMonthlyData,
80899
+ selectedMonth,
80900
+ selectedYear,
80901
+ monitoringMode: workspace?.monitoring_mode,
80902
+ rangeStart,
80903
+ rangeEnd,
80904
+ selectedShiftId: selectedShift,
80905
+ availableShifts: shiftConfig?.shifts?.map((s) => ({ id: s.shiftId, name: s.shiftName })),
80906
+ shiftConfig,
80907
+ efficiencyLegend,
80908
+ trendSummary: workspaceMonthlyTrend,
80909
+ compact: true,
80910
+ isAssemblyWorkspace
80911
+ }
80912
+ )
80913
+ ] })
80419
80914
  ] })
80420
80915
  ] })
80421
- ] })
80422
- ] }),
80423
- /* @__PURE__ */ jsxs("div", { className: "flex-grow p-1.5 sm:p-2 lg:p-4", children: [
80424
- activeTab === "overview" && /* @__PURE__ */ jsx("div", { className: "flex flex-col h-full lg:h-[calc(100vh-12rem)] overflow-y-auto lg:min-h-0 pb-4", children: shouldShowAssemblyOverviewLoadingState ? assemblyOverviewLoadingView : /* @__PURE__ */ jsxs(Fragment, { children: [
80425
- /* @__PURE__ */ jsxs("div", { className: "block lg:hidden space-y-6 pb-6", children: [
80426
- isOutputLayout && !isUptimeMode && /* @__PURE__ */ jsxs(
80427
- motion.div,
80428
- {
80429
- className: "bg-white rounded-lg shadow-sm p-6 h-[300px]",
80430
- variants: chartCardVariants,
80431
- initial: "initial",
80432
- animate: "animate",
80433
- children: [
80434
- /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-4 text-center", children: "Today's Output" }),
80435
- /* @__PURE__ */ jsx("div", { className: "h-[calc(100%-3rem)]", children: /* @__PURE__ */ jsx(
80436
- OutputProgressChart,
80437
- {
80438
- currentOutput: workspace.total_actions || 0,
80439
- targetOutput: workspace.target_output || 0,
80440
- skuBreakdown: isSkuAware ? realSkuBreakdown : void 0,
80441
- selectedSkuId,
80442
- onSelectSku: setSelectedSkuId,
80443
- liveSkuId: isHistoricView ? null : liveSkuId
80444
- }
80445
- ) })
80446
- ]
80447
- }
80448
- ),
80449
- /* @__PURE__ */ jsxs(
80450
- motion.div,
80451
- {
80452
- className: "bg-white rounded-lg shadow-sm p-4",
80453
- variants: chartCardVariants,
80454
- initial: "initial",
80455
- animate: "animate",
80456
- children: [
80457
- /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-4", children: [
80458
- /* @__PURE__ */ jsx("h3", { className: "text-lg font-bold text-gray-700", children: isUptimeMode ? "Machine Utilization" : isAssemblyCycleLayout ? "Cycle time trend" : "Hourly Output" }),
80459
- canToggleChartIdleTime && /* @__PURE__ */ jsx(
80460
- "button",
80916
+ ] }),
80917
+ /* @__PURE__ */ jsxs("div", { className: "flex-grow p-1.5 sm:p-2 lg:p-4", children: [
80918
+ activeTab === "overview" && /* @__PURE__ */ jsx("div", { className: "flex flex-col h-full lg:h-[calc(100vh-12rem)] overflow-y-auto lg:min-h-0 pb-4", children: shouldShowAssemblyOverviewLoadingState ? assemblyOverviewLoadingView : /* @__PURE__ */ jsxs(Fragment, { children: [
80919
+ /* @__PURE__ */ jsxs("div", { className: "block lg:hidden space-y-6 pb-6", children: [
80920
+ isOutputLayout && !isUptimeMode && /* @__PURE__ */ jsxs(
80921
+ motion.div,
80922
+ {
80923
+ className: "bg-white rounded-lg shadow-sm p-6 h-[300px]",
80924
+ variants: chartCardVariants,
80925
+ initial: "initial",
80926
+ animate: "animate",
80927
+ children: [
80928
+ /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-4 text-center", children: "Today's Output" }),
80929
+ /* @__PURE__ */ jsx("div", { className: "h-[calc(100%-3rem)]", children: /* @__PURE__ */ jsx(
80930
+ OutputProgressChart,
80461
80931
  {
80462
- onClick: () => setShowChartIdleTime(!showChartIdleTime),
80463
- className: `inline-flex items-center px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${showChartIdleTime ? "bg-blue-50 text-blue-700 border border-blue-200" : "bg-white text-gray-700 border border-gray-300 hover:bg-gray-50"}`,
80464
- children: showChartIdleTime ? /* @__PURE__ */ jsxs(Fragment, { children: [
80465
- /* @__PURE__ */ jsx(EyeOff, { className: "w-4 h-4 mr-1.5" }),
80466
- "Hide Idle Time"
80467
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
80468
- /* @__PURE__ */ jsx(Eye, { className: "w-4 h-4 mr-1.5" }),
80469
- "Show Idle Time"
80470
- ] })
80932
+ currentOutput: workspace.total_actions || 0,
80933
+ targetOutput: workspace.target_output || 0,
80934
+ skuBreakdown: isSkuAware ? realSkuBreakdown : void 0,
80935
+ selectedSkuId,
80936
+ onSelectSku: setSelectedSkuId,
80937
+ liveSkuId: isHistoricView ? null : liveSkuId
80471
80938
  }
80472
- )
80473
- ] }),
80474
- /* @__PURE__ */ jsx(
80475
- "div",
80476
- {
80477
- className: "h-[300px] min-h-[220px] min-w-0",
80478
- children: isUptimeMode ? /* @__PURE__ */ jsx(
80479
- HourlyUptimeChart,
80480
- {
80481
- idleTimeHourly: workspace.idle_time_hourly,
80482
- shiftStart: workspace.shift_start,
80483
- shiftEnd: workspace.shift_end,
80484
- shiftDate: idleClipDate,
80485
- timezone,
80486
- elapsedMinutes: elapsedShiftMinutes,
80487
- shiftBreaks: workspaceShiftBreaks
80488
- }
80489
- ) : isAssemblyCycleLayout ? shouldShowCycleTimeUnavailableState ? cycleTimeUnavailableView : shouldShowCycleTimeChart ? /* @__PURE__ */ jsx(
80490
- CycleTimeOverTimeChart,
80491
- {
80492
- data: maskedCycleTimeChartData,
80493
- idealCycleTime: authoritativeCycleMetrics?.ideal_cycle_time || 0,
80494
- shiftStart: authoritativeCycleMetrics?.shift_start || "",
80495
- shiftEnd: authoritativeCycleMetrics?.shift_end || "",
80496
- xAxisMode: "hourly",
80497
- datasetKey: cycleTimeDatasetKey,
80498
- showIdleTime: showChartIdleTime,
80499
- idleTimeData: hourlyIdleMinutes,
80500
- idleTimeSlots: hourlyIdleSlots
80501
- }
80502
- ) : null : /* @__PURE__ */ jsx(
80503
- HourlyOutputChart2,
80939
+ ) })
80940
+ ]
80941
+ }
80942
+ ),
80943
+ /* @__PURE__ */ jsxs(
80944
+ motion.div,
80945
+ {
80946
+ className: "bg-white rounded-lg shadow-sm p-4",
80947
+ variants: chartCardVariants,
80948
+ initial: "initial",
80949
+ animate: "animate",
80950
+ children: [
80951
+ /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-4", children: [
80952
+ /* @__PURE__ */ jsx("h3", { className: "text-lg font-bold text-gray-700", children: isUptimeMode ? "Machine Utilization" : isAssemblyCycleLayout ? "Cycle time trend" : "Hourly Output" }),
80953
+ canToggleChartIdleTime && /* @__PURE__ */ jsx(
80954
+ "button",
80504
80955
  {
80505
- data: workspace.hourly_action_counts || [],
80506
- pphThreshold: workspace.pph_threshold || 0,
80507
- hourlyTargetOutput: workspace.hourly_target_output,
80508
- shiftStart: workspace.shift_start || "06:00",
80509
- shiftEnd: workspace.shift_end,
80510
- shiftBreaks: shiftConfig?.shifts?.find((shift2) => shift2.shiftId === workspace.shift_id)?.breaks || [],
80511
- showIdleTime: showChartIdleTime,
80512
- idleTimeHourly: workspace.idle_time_hourly,
80513
- idleTimeClips,
80514
- idleTimeClipClassifications,
80515
- shiftDate: idleClipDate,
80516
- timezone: effectiveCycleTimeTimezone,
80517
- skuSegments: isSkuAware ? skuSegments : void 0,
80518
- activeSkuId
80956
+ onClick: () => setShowChartIdleTime(!showChartIdleTime),
80957
+ className: `inline-flex items-center px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${showChartIdleTime ? "bg-blue-50 text-blue-700 border border-blue-200" : "bg-white text-gray-700 border border-gray-300 hover:bg-gray-50"}`,
80958
+ children: showChartIdleTime ? /* @__PURE__ */ jsxs(Fragment, { children: [
80959
+ /* @__PURE__ */ jsx(EyeOff, { className: "w-4 h-4 mr-1.5" }),
80960
+ "Hide Idle Time"
80961
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
80962
+ /* @__PURE__ */ jsx(Eye, { className: "w-4 h-4 mr-1.5" }),
80963
+ "Show Idle Time"
80964
+ ] })
80519
80965
  }
80520
80966
  )
80521
- }
80522
- )
80523
- ]
80524
- }
80525
- ),
80526
- showIdleBreakdownChart && /* @__PURE__ */ jsxs(
80527
- motion.div,
80528
- {
80529
- className: "bg-white rounded-lg shadow-sm p-4 h-[300px]",
80530
- variants: chartCardVariants,
80531
- initial: "initial",
80532
- animate: "animate",
80533
- children: [
80534
- /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-4 text-center", children: "Idle Time Breakdown" }),
80535
- /* @__PURE__ */ jsx("div", { className: "h-[calc(100%-3rem)]", children: /* @__PURE__ */ jsx(
80536
- IdleTimeReasonChart,
80537
- {
80538
- data: idleTimeData.chartData,
80539
- isLoading: idleTimeData.isLoading,
80540
- error: idleTimeData.error
80541
- }
80542
- ) })
80543
- ]
80544
- }
80545
- ),
80546
- isUptimeMode ? /* @__PURE__ */ jsx(UptimeMetricCards, { workspace, uptimePieData }) : isAssemblyCycleLayout ? /* @__PURE__ */ jsx(
80547
- WorkspaceCycleTimeMetricCards,
80548
- {
80549
- workspace,
80550
- legend: efficiencyLegend,
80551
- layout: "stack",
80552
- idleTimeData: idleTimeVlmEnabled ? idleTimeData : void 0,
80553
- skuAware: isSkuAware,
80554
- skuBreakdown: isSkuAware ? realSkuBreakdown : void 0,
80555
- activeSkuId,
80556
- liveSkuId: isHistoricView ? null : liveSkuId
80557
- }
80558
- ) : /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
80559
- WorkspaceMetricCards,
80560
- {
80561
- workspace,
80562
- legend: efficiencyLegend,
80563
- className: "flex-1",
80564
- skuAware: isSkuAware,
80565
- skuBreakdown: isSkuAware ? realSkuBreakdown : void 0,
80566
- activeSkuId,
80567
- liveSkuId: isHistoricView ? null : liveSkuId
80568
- }
80569
- ) })
80570
- ] }),
80571
- /* @__PURE__ */ jsxs("div", { className: "hidden lg:flex lg:flex-col lg:h-full lg:min-h-0 gap-3", children: [
80572
- /* @__PURE__ */ jsxs(
80573
- "div",
80574
- {
80575
- className: clsx(
80576
- "grid grid-cols-1 gap-3 min-h-0",
80577
- isUptimeMode && showIdleBreakdownChart ? "lg:grid-cols-3" : "lg:grid-cols-10",
80578
- desktopTopSectionClass
80579
- ),
80580
- children: [
80581
- isOutputLayout && !isUptimeMode && /* @__PURE__ */ jsxs(
80582
- motion.div,
80583
- {
80584
- className: "bg-white rounded-lg shadow-sm p-4 lg:col-span-2 flex flex-col min-h-0",
80585
- variants: chartCardVariants,
80586
- initial: "initial",
80587
- animate: "animate",
80588
- children: [
80589
- /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-4 text-center", children: "Today's Output" }),
80590
- /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-[220px] min-w-0", children: /* @__PURE__ */ jsx(
80591
- OutputProgressChart,
80592
- {
80593
- currentOutput: workspace.total_actions || 0,
80594
- targetOutput: workspace.target_output || 0,
80595
- skuBreakdown: isSkuAware ? realSkuBreakdown : void 0,
80596
- selectedSkuId,
80597
- onSelectSku: setSelectedSkuId,
80598
- liveSkuId: isHistoricView ? null : liveSkuId
80599
- }
80600
- ) })
80601
- ]
80602
- }
80603
- ),
80604
- /* @__PURE__ */ jsxs(
80605
- motion.div,
80606
- {
80607
- className: clsx(
80608
- "bg-white rounded-lg shadow-sm p-4 flex flex-col min-h-0",
80609
- isUptimeMode && showIdleBreakdownChart ? "lg:col-span-2" : isAssemblyCycleLayout || isUptimeMode ? "lg:col-span-10" : idleTimeVlmEnabled ? "lg:col-span-6" : "lg:col-span-8"
80610
- ),
80611
- variants: chartCardVariants,
80612
- initial: "initial",
80613
- animate: "animate",
80614
- children: [
80615
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 mb-4 flex-none", children: [
80616
- /* @__PURE__ */ jsx("h3", { className: "text-lg font-bold text-gray-700", children: isUptimeMode ? "Machine Utilization" : isAssemblyCycleLayout ? "Cycle time trend" : "Hourly Output" }),
80617
- canToggleChartIdleTime && /* @__PURE__ */ jsx(
80618
- "button",
80619
- {
80620
- onClick: () => setShowChartIdleTime(!showChartIdleTime),
80621
- className: `inline-flex items-center px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${showChartIdleTime ? "bg-blue-50 text-blue-700 border border-blue-200" : "bg-white text-gray-700 border border-gray-300 hover:bg-gray-50"}`,
80622
- children: showChartIdleTime ? /* @__PURE__ */ jsxs(Fragment, { children: [
80623
- /* @__PURE__ */ jsx(EyeOff, { className: "w-4 h-4 mr-1.5" }),
80624
- "Hide Idle Time"
80625
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
80626
- /* @__PURE__ */ jsx(Eye, { className: "w-4 h-4 mr-1.5" }),
80627
- "Show Idle Time"
80628
- ] })
80629
- }
80630
- )
80631
- ] }),
80632
- /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-[220px] min-w-0", children: isUptimeMode ? /* @__PURE__ */ jsx(
80967
+ ] }),
80968
+ /* @__PURE__ */ jsx(
80969
+ "div",
80970
+ {
80971
+ className: "h-[300px] min-h-[220px] min-w-0",
80972
+ children: isUptimeMode ? /* @__PURE__ */ jsx(
80633
80973
  HourlyUptimeChart,
80634
80974
  {
80635
80975
  idleTimeHourly: workspace.idle_time_hourly,
@@ -80651,7 +80991,9 @@ var WorkspaceDetailView = ({
80651
80991
  datasetKey: cycleTimeDatasetKey,
80652
80992
  showIdleTime: showChartIdleTime,
80653
80993
  idleTimeData: hourlyIdleMinutes,
80654
- idleTimeSlots: hourlyIdleSlots
80994
+ idleTimeSlots: hourlyIdleSlots,
80995
+ selectedHourIndex: selectedHour?.source === "cycle" ? selectedHour.hourIndex : null,
80996
+ onHourClick: handleCycleHourSelect
80655
80997
  }
80656
80998
  ) : null : /* @__PURE__ */ jsx(
80657
80999
  HourlyOutputChart2,
@@ -80669,142 +81011,378 @@ var WorkspaceDetailView = ({
80669
81011
  shiftDate: idleClipDate,
80670
81012
  timezone: effectiveCycleTimeTimezone,
80671
81013
  skuSegments: isSkuAware ? skuSegments : void 0,
80672
- activeSkuId
81014
+ activeSkuId,
81015
+ selectedHourIndex: selectedHour?.source === "output" ? selectedHour.hourIndex : aiSummaryHour?.hourIndex ?? null,
81016
+ onHourClick: handleOutputHourSelect,
81017
+ onWatchClipsClick: handleWatchClipsFromChart,
81018
+ onAiSummaryClick: handleAiSummaryClick
80673
81019
  }
80674
- ) })
80675
- ]
80676
- }
81020
+ )
81021
+ }
81022
+ )
81023
+ ]
81024
+ }
81025
+ ),
81026
+ showHourSummaryPanel && !aiSummaryHour && /* @__PURE__ */ jsx(
81027
+ WorkspaceHourSummaryPanel,
81028
+ {
81029
+ workspaceId,
81030
+ companyId: hourSummaryCompanyId,
81031
+ date: hourSummaryDate,
81032
+ shiftId: hourSummaryShiftId,
81033
+ selectedHour,
81034
+ clipsEnabled: isClipsEnabled,
81035
+ onOpenClips: handleOpenClipsForHour,
81036
+ onClose: handleCloseHourSummary
81037
+ }
81038
+ ),
81039
+ showIdleBreakdownChart && /* @__PURE__ */ jsxs(
81040
+ motion.div,
81041
+ {
81042
+ className: "bg-white rounded-lg shadow-sm p-4 h-[300px]",
81043
+ variants: chartCardVariants,
81044
+ initial: "initial",
81045
+ animate: "animate",
81046
+ children: [
81047
+ /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-4 text-center", children: "Idle Time Breakdown" }),
81048
+ /* @__PURE__ */ jsx("div", { className: "h-[calc(100%-3rem)]", children: /* @__PURE__ */ jsx(
81049
+ IdleTimeReasonChart,
81050
+ {
81051
+ data: idleTimeData.chartData,
81052
+ isLoading: idleTimeData.isLoading,
81053
+ error: idleTimeData.error
81054
+ }
81055
+ ) })
81056
+ ]
81057
+ }
81058
+ ),
81059
+ isUptimeMode ? /* @__PURE__ */ jsx(UptimeMetricCards, { workspace, uptimePieData }) : isAssemblyCycleLayout ? /* @__PURE__ */ jsx(
81060
+ WorkspaceCycleTimeMetricCards,
81061
+ {
81062
+ workspace,
81063
+ legend: efficiencyLegend,
81064
+ layout: "stack",
81065
+ idleTimeData: idleTimeVlmEnabled ? idleTimeData : void 0,
81066
+ skuAware: isSkuAware,
81067
+ skuBreakdown: isSkuAware ? realSkuBreakdown : void 0,
81068
+ activeSkuId,
81069
+ liveSkuId: isHistoricView ? null : liveSkuId
81070
+ }
81071
+ ) : /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
81072
+ WorkspaceMetricCards,
81073
+ {
81074
+ workspace,
81075
+ legend: efficiencyLegend,
81076
+ className: "flex-1",
81077
+ skuAware: isSkuAware,
81078
+ skuBreakdown: isSkuAware ? realSkuBreakdown : void 0,
81079
+ activeSkuId,
81080
+ liveSkuId: isHistoricView ? null : liveSkuId
81081
+ }
81082
+ ) })
81083
+ ] }),
81084
+ /* @__PURE__ */ jsxs("div", { className: "hidden lg:flex lg:flex-col lg:h-full lg:min-h-0 gap-3", children: [
81085
+ /* @__PURE__ */ jsxs(
81086
+ "div",
81087
+ {
81088
+ className: clsx(
81089
+ "grid grid-cols-1 gap-3 min-h-0",
81090
+ showHourSummaryPanel ? "lg:grid-cols-12" : isUptimeMode && showIdleBreakdownChart ? "lg:grid-cols-3" : "lg:grid-cols-10",
81091
+ desktopTopSectionClass
80677
81092
  ),
80678
- showIdleBreakdownChart && /* @__PURE__ */ jsxs(
80679
- motion.div,
80680
- {
80681
- className: clsx(
80682
- "bg-white rounded-lg shadow-sm p-4 flex flex-col min-h-0",
80683
- isUptimeMode ? "lg:col-span-1" : "lg:col-span-2"
80684
- ),
80685
- variants: chartCardVariants,
80686
- initial: "initial",
80687
- animate: "animate",
80688
- children: [
80689
- /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-4 text-center", children: "Idle Time Breakdown" }),
80690
- /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-[220px] min-w-0", children: /* @__PURE__ */ jsx(
80691
- IdleTimeReasonChart,
80692
- {
80693
- data: idleTimeData.chartData,
80694
- isLoading: idleTimeData.isLoading,
80695
- error: idleTimeData.error
80696
- }
80697
- ) })
80698
- ]
80699
- }
80700
- )
80701
- ]
80702
- }
80703
- ),
80704
- isUptimeMode ? /* @__PURE__ */ jsx("div", { className: clsx("flex min-h-0", desktopBottomSectionClass), children: /* @__PURE__ */ jsx(UptimeMetricCards, { workspace, uptimePieData, className: "flex-1" }) }) : isAssemblyCycleLayout ? /* @__PURE__ */ jsx(
80705
- WorkspaceCycleTimeMetricCards,
80706
- {
80707
- workspace,
80708
- legend: efficiencyLegend,
80709
- layout: "grid",
80710
- className: desktopBottomSectionClass,
80711
- idleTimeData: idleTimeVlmEnabled ? idleTimeData : void 0,
80712
- skuAware: isSkuAware,
80713
- skuBreakdown: isSkuAware ? realSkuBreakdown : void 0,
80714
- activeSkuId,
80715
- liveSkuId: isHistoricView ? null : liveSkuId
80716
- }
80717
- ) : /* @__PURE__ */ jsx("div", { className: clsx("flex min-h-0", desktopBottomSectionClass), children: /* @__PURE__ */ jsx(
80718
- WorkspaceMetricCards,
81093
+ children: [
81094
+ isOutputLayout && !isUptimeMode && /* @__PURE__ */ jsxs(
81095
+ motion.div,
81096
+ {
81097
+ className: "bg-white rounded-lg shadow-sm p-4 lg:col-span-2 flex flex-col min-h-0",
81098
+ variants: chartCardVariants,
81099
+ initial: "initial",
81100
+ animate: "animate",
81101
+ children: [
81102
+ /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-4 text-center", children: "Today's Output" }),
81103
+ /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-[220px] min-w-0", children: /* @__PURE__ */ jsx(
81104
+ OutputProgressChart,
81105
+ {
81106
+ currentOutput: workspace.total_actions || 0,
81107
+ targetOutput: workspace.target_output || 0,
81108
+ skuBreakdown: isSkuAware ? realSkuBreakdown : void 0,
81109
+ selectedSkuId,
81110
+ onSelectSku: setSelectedSkuId,
81111
+ liveSkuId: isHistoricView ? null : liveSkuId
81112
+ }
81113
+ ) })
81114
+ ]
81115
+ }
81116
+ ),
81117
+ /* @__PURE__ */ jsxs(
81118
+ motion.div,
81119
+ {
81120
+ className: clsx(
81121
+ "bg-white rounded-lg shadow-sm p-4 flex flex-col min-h-0",
81122
+ showHourSummaryPanel ? isAssemblyCycleLayout || isUptimeMode ? "lg:col-span-9" : idleTimeVlmEnabled ? "lg:col-span-6" : "lg:col-span-8" : isUptimeMode && showIdleBreakdownChart ? "lg:col-span-2" : isAssemblyCycleLayout || isUptimeMode ? "lg:col-span-10" : idleTimeVlmEnabled ? "lg:col-span-6" : "lg:col-span-8"
81123
+ ),
81124
+ variants: chartCardVariants,
81125
+ initial: "initial",
81126
+ animate: "animate",
81127
+ children: [
81128
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 mb-4 flex-none", children: [
81129
+ /* @__PURE__ */ jsx("h3", { className: "text-lg font-bold text-gray-700", children: isUptimeMode ? "Machine Utilization" : isAssemblyCycleLayout ? "Cycle time trend" : "Hourly Output" }),
81130
+ canToggleChartIdleTime && /* @__PURE__ */ jsx(
81131
+ "button",
81132
+ {
81133
+ onClick: () => setShowChartIdleTime(!showChartIdleTime),
81134
+ className: `inline-flex items-center px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${showChartIdleTime ? "bg-blue-50 text-blue-700 border border-blue-200" : "bg-white text-gray-700 border border-gray-300 hover:bg-gray-50"}`,
81135
+ children: showChartIdleTime ? /* @__PURE__ */ jsxs(Fragment, { children: [
81136
+ /* @__PURE__ */ jsx(EyeOff, { className: "w-4 h-4 mr-1.5" }),
81137
+ "Hide Idle Time"
81138
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
81139
+ /* @__PURE__ */ jsx(Eye, { className: "w-4 h-4 mr-1.5" }),
81140
+ "Show Idle Time"
81141
+ ] })
81142
+ }
81143
+ )
81144
+ ] }),
81145
+ /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-[220px] min-w-0", children: isUptimeMode ? /* @__PURE__ */ jsx(
81146
+ HourlyUptimeChart,
81147
+ {
81148
+ idleTimeHourly: workspace.idle_time_hourly,
81149
+ shiftStart: workspace.shift_start,
81150
+ shiftEnd: workspace.shift_end,
81151
+ shiftDate: idleClipDate,
81152
+ timezone,
81153
+ elapsedMinutes: elapsedShiftMinutes,
81154
+ shiftBreaks: workspaceShiftBreaks
81155
+ }
81156
+ ) : isAssemblyCycleLayout ? shouldShowCycleTimeUnavailableState ? cycleTimeUnavailableView : shouldShowCycleTimeChart ? /* @__PURE__ */ jsx(
81157
+ CycleTimeOverTimeChart,
81158
+ {
81159
+ data: maskedCycleTimeChartData,
81160
+ idealCycleTime: authoritativeCycleMetrics?.ideal_cycle_time || 0,
81161
+ shiftStart: authoritativeCycleMetrics?.shift_start || "",
81162
+ shiftEnd: authoritativeCycleMetrics?.shift_end || "",
81163
+ xAxisMode: "hourly",
81164
+ datasetKey: cycleTimeDatasetKey,
81165
+ showIdleTime: showChartIdleTime,
81166
+ idleTimeData: hourlyIdleMinutes,
81167
+ idleTimeSlots: hourlyIdleSlots,
81168
+ selectedHourIndex: selectedHour?.source === "cycle" ? selectedHour.hourIndex : null,
81169
+ onHourClick: handleCycleHourSelect
81170
+ }
81171
+ ) : null : /* @__PURE__ */ jsx(
81172
+ HourlyOutputChart2,
81173
+ {
81174
+ data: workspace.hourly_action_counts || [],
81175
+ pphThreshold: workspace.pph_threshold || 0,
81176
+ hourlyTargetOutput: workspace.hourly_target_output,
81177
+ shiftStart: workspace.shift_start || "06:00",
81178
+ shiftEnd: workspace.shift_end,
81179
+ shiftBreaks: shiftConfig?.shifts?.find((shift2) => shift2.shiftId === workspace.shift_id)?.breaks || [],
81180
+ showIdleTime: showChartIdleTime,
81181
+ idleTimeHourly: workspace.idle_time_hourly,
81182
+ idleTimeClips,
81183
+ idleTimeClipClassifications,
81184
+ shiftDate: idleClipDate,
81185
+ timezone: effectiveCycleTimeTimezone,
81186
+ skuSegments: isSkuAware ? skuSegments : void 0,
81187
+ activeSkuId,
81188
+ selectedHourIndex: selectedHour?.source === "output" ? selectedHour.hourIndex : aiSummaryHour?.hourIndex ?? null,
81189
+ onHourClick: handleOutputHourSelect,
81190
+ onWatchClipsClick: handleWatchClipsFromChart,
81191
+ onAiSummaryClick: handleAiSummaryClick
81192
+ }
81193
+ ) })
81194
+ ]
81195
+ }
81196
+ ),
81197
+ showIdleBreakdownChart && /* @__PURE__ */ jsxs(
81198
+ motion.div,
81199
+ {
81200
+ className: clsx(
81201
+ "bg-white rounded-lg shadow-sm p-4 flex flex-col min-h-0",
81202
+ isUptimeMode ? "lg:col-span-1" : "lg:col-span-2"
81203
+ ),
81204
+ variants: chartCardVariants,
81205
+ initial: "initial",
81206
+ animate: "animate",
81207
+ children: [
81208
+ /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-4 text-center", children: "Idle Time Breakdown" }),
81209
+ /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-[220px] min-w-0", children: /* @__PURE__ */ jsx(
81210
+ IdleTimeReasonChart,
81211
+ {
81212
+ data: idleTimeData.chartData,
81213
+ isLoading: idleTimeData.isLoading,
81214
+ error: idleTimeData.error
81215
+ }
81216
+ ) })
81217
+ ]
81218
+ }
81219
+ ),
81220
+ showHourSummaryPanel && /* @__PURE__ */ jsx(
81221
+ WorkspaceHourSummaryPanel,
81222
+ {
81223
+ workspaceId,
81224
+ companyId: hourSummaryCompanyId,
81225
+ date: hourSummaryDate,
81226
+ shiftId: hourSummaryShiftId,
81227
+ selectedHour,
81228
+ clipsEnabled: isClipsEnabled,
81229
+ onOpenClips: handleOpenClipsForHour,
81230
+ onClose: handleCloseHourSummary,
81231
+ className: clsx(
81232
+ "flex min-h-0 flex-col overflow-y-auto",
81233
+ isAssemblyCycleLayout || isUptimeMode ? "lg:col-span-3" : "lg:col-span-2"
81234
+ )
81235
+ }
81236
+ )
81237
+ ]
81238
+ }
81239
+ ),
81240
+ isUptimeMode ? /* @__PURE__ */ jsx("div", { className: clsx("flex min-h-0", desktopBottomSectionClass), children: /* @__PURE__ */ jsx(UptimeMetricCards, { workspace, uptimePieData, className: "flex-1" }) }) : isAssemblyCycleLayout ? /* @__PURE__ */ jsx(
81241
+ WorkspaceCycleTimeMetricCards,
81242
+ {
81243
+ workspace,
81244
+ legend: efficiencyLegend,
81245
+ layout: "grid",
81246
+ className: desktopBottomSectionClass,
81247
+ idleTimeData: idleTimeVlmEnabled ? idleTimeData : void 0,
81248
+ skuAware: isSkuAware,
81249
+ skuBreakdown: isSkuAware ? realSkuBreakdown : void 0,
81250
+ activeSkuId,
81251
+ liveSkuId: isHistoricView ? null : liveSkuId
81252
+ }
81253
+ ) : /* @__PURE__ */ jsx("div", { className: clsx("flex min-h-0", desktopBottomSectionClass), children: /* @__PURE__ */ jsx(
81254
+ WorkspaceMetricCards,
81255
+ {
81256
+ workspace,
81257
+ legend: efficiencyLegend,
81258
+ className: "flex-1",
81259
+ skuAware: isSkuAware,
81260
+ skuBreakdown: isSkuAware ? realSkuBreakdown : void 0,
81261
+ activeSkuId,
81262
+ liveSkuId: isHistoricView ? null : liveSkuId
81263
+ }
81264
+ ) })
81265
+ ] })
81266
+ ] }) }),
81267
+ activeTab === "monthly_history" && /* @__PURE__ */ jsxs("div", { className: "h-[calc(100vh-10rem)] overflow-y-auto px-2 sm:px-4 lg:px-0", children: [
81268
+ usingFallbackData && !date && !shift && /* @__PURE__ */ jsx("div", { className: "mb-3 sm:mb-4 bg-amber-50 border border-amber-200 rounded-lg px-3 sm:px-4 py-2 sm:py-3 text-amber-800", children: /* @__PURE__ */ jsxs("p", { className: "text-xs sm:text-sm font-medium flex items-center", children: [
81269
+ /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-4 w-4 sm:h-5 sm:w-5 mr-2", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z", clipRule: "evenodd" }) }),
81270
+ "No current data available for today. Showing monthly history instead."
81271
+ ] }) }),
81272
+ /* @__PURE__ */ jsx(
81273
+ WorkspaceMonthlyHistory,
80719
81274
  {
80720
- workspace,
81275
+ data: monthlyData,
81276
+ analysisData: analysisMonthlyData,
81277
+ month: selectedMonth,
81278
+ year: selectedYear,
81279
+ workspaceId,
81280
+ lineId: resolvedLineId,
81281
+ monitoringMode: workspace?.monitoring_mode,
81282
+ selectedShiftId: selectedShift,
81283
+ rangeStart,
81284
+ rangeEnd,
81285
+ timezone,
81286
+ shiftConfig,
81287
+ shiftConfigFromDatabase: isShiftConfigFromDatabase,
81288
+ monthlyDataLoading,
81289
+ availableShifts: shiftConfig?.shifts?.map((s) => ({ id: s.shiftId, name: s.shiftName })),
80721
81290
  legend: efficiencyLegend,
80722
- className: "flex-1",
80723
- skuAware: isSkuAware,
80724
- skuBreakdown: isSkuAware ? realSkuBreakdown : void 0,
80725
- activeSkuId,
80726
- liveSkuId: isHistoricView ? null : liveSkuId
81291
+ trendSummary: workspaceMonthlyTrend,
81292
+ isAssemblyWorkspace,
81293
+ onDateSelect: (selectedDate, shiftId) => {
81294
+ if (onDateSelect) {
81295
+ onDateSelect(selectedDate, shiftId);
81296
+ } else if (onNavigate) {
81297
+ const params = new URLSearchParams();
81298
+ params.set("date", selectedDate);
81299
+ params.set("shift", shiftId.toString());
81300
+ params.set("fromMonthly", "true");
81301
+ if (!isFullRange) {
81302
+ params.set("rangeStart", range.startKey);
81303
+ params.set("rangeEnd", range.endKey);
81304
+ }
81305
+ if (resolvedLineId) {
81306
+ params.set("lineId", resolvedLineId);
81307
+ }
81308
+ appendReturnUrl(params);
81309
+ onNavigate(`/workspace/${workspaceId}?${params.toString()}`);
81310
+ }
81311
+ },
81312
+ onMonthNavigate: (newMonth, newYear) => {
81313
+ setSelectedMonth(newMonth);
81314
+ setSelectedYear(newYear);
81315
+ const nextBounds = getMonthKeyBounds(newYear, newMonth);
81316
+ setRangeStart(nextBounds.startKey);
81317
+ setRangeEnd(nextBounds.endKey);
81318
+ },
81319
+ onShiftChange: setSelectedShift,
81320
+ onRangeChange: (nextRange) => {
81321
+ setRangeStart(nextRange.startKey);
81322
+ setRangeEnd(nextRange.endKey);
81323
+ },
81324
+ className: "w-full"
80727
81325
  }
80728
- ) })
80729
- ] })
80730
- ] }) }),
80731
- activeTab === "monthly_history" && /* @__PURE__ */ jsxs("div", { className: "h-[calc(100vh-10rem)] overflow-y-auto px-2 sm:px-4 lg:px-0", children: [
80732
- usingFallbackData && !date && !shift && /* @__PURE__ */ jsx("div", { className: "mb-3 sm:mb-4 bg-amber-50 border border-amber-200 rounded-lg px-3 sm:px-4 py-2 sm:py-3 text-amber-800", children: /* @__PURE__ */ jsxs("p", { className: "text-xs sm:text-sm font-medium flex items-center", children: [
80733
- /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-4 w-4 sm:h-5 sm:w-5 mr-2", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z", clipRule: "evenodd" }) }),
80734
- "No current data available for today. Showing monthly history instead."
80735
- ] }) }),
80736
- /* @__PURE__ */ jsx(
80737
- WorkspaceMonthlyHistory,
81326
+ )
81327
+ ] }),
81328
+ activeTab === "bottlenecks" && /* @__PURE__ */ jsx(ClipFilterProvider, { children: /* @__PURE__ */ jsx(
81329
+ BottlenecksContent,
80738
81330
  {
80739
- data: monthlyData,
80740
- analysisData: analysisMonthlyData,
80741
- month: selectedMonth,
80742
- year: selectedYear,
80743
81331
  workspaceId,
81332
+ workspaceName: formattedWorkspaceName,
81333
+ date,
80744
81334
  lineId: resolvedLineId,
80745
- monitoringMode: workspace?.monitoring_mode,
80746
- selectedShiftId: selectedShift,
80747
- rangeStart,
80748
- rangeEnd,
80749
- timezone,
80750
- shiftConfig,
80751
- shiftConfigFromDatabase: isShiftConfigFromDatabase,
80752
- monthlyDataLoading,
80753
- availableShifts: shiftConfig?.shifts?.map((s) => ({ id: s.shiftId, name: s.shiftName })),
80754
- legend: efficiencyLegend,
80755
- trendSummary: workspaceMonthlyTrend,
80756
- isAssemblyWorkspace,
80757
- onDateSelect: (selectedDate, shiftId) => {
80758
- if (onDateSelect) {
80759
- onDateSelect(selectedDate, shiftId);
80760
- } else if (onNavigate) {
80761
- const params = new URLSearchParams();
80762
- params.set("date", selectedDate);
80763
- params.set("shift", shiftId.toString());
80764
- params.set("fromMonthly", "true");
80765
- if (!isFullRange) {
80766
- params.set("rangeStart", range.startKey);
80767
- params.set("rangeEnd", range.endKey);
80768
- }
80769
- if (resolvedLineId) {
80770
- params.set("lineId", resolvedLineId);
80771
- }
80772
- appendReturnUrl(params);
80773
- onNavigate(`/workspace/${workspaceId}?${params.toString()}`);
81335
+ shift,
81336
+ totalOutput: workspace?.total_actions,
81337
+ workspaceMetrics: detailedWorkspaceMetrics || void 0,
81338
+ prefetchedPercentileCounts: isFastSlowClipFiltersEnabled ? prefetchedPercentileCounts : null,
81339
+ initialTimeFilter: pendingClipHourFilter,
81340
+ className: "h-[calc(100vh-10rem)]"
81341
+ }
81342
+ ) })
81343
+ ] })
81344
+ ] }),
81345
+ aiSummaryHour && /* @__PURE__ */ jsx(
81346
+ "div",
81347
+ {
81348
+ className: "fixed inset-0 bg-slate-900/40 backdrop-blur-sm flex items-center justify-center p-4 z-[9999]",
81349
+ onClick: () => setAiSummaryHour(null),
81350
+ children: /* @__PURE__ */ jsx(
81351
+ "div",
81352
+ {
81353
+ className: "max-w-xl w-full max-h-[90vh] overflow-y-auto animate-in zoom-in-95 duration-200",
81354
+ onClick: (e) => e.stopPropagation(),
81355
+ children: /* @__PURE__ */ jsx(
81356
+ WorkspaceHourSummaryPanel,
81357
+ {
81358
+ workspaceId,
81359
+ companyId: hourSummaryCompanyId,
81360
+ date: hourSummaryDate,
81361
+ shiftId: hourSummaryShiftId,
81362
+ selectedHour: {
81363
+ source: "output",
81364
+ hourIndex: aiSummaryHour.hourIndex,
81365
+ timeRange: aiSummaryHour.timeRange,
81366
+ startTime: aiSummaryHour.startTime,
81367
+ endTime: aiSummaryHour.endTime,
81368
+ status: aiSummaryHour.status,
81369
+ output: aiSummaryHour.output,
81370
+ target: aiSummaryHour.target
81371
+ },
81372
+ clipsEnabled: isClipsEnabled,
81373
+ onOpenClips: (hour) => {
81374
+ setAiSummaryHour(null);
81375
+ handleOpenClipsForHour(hour);
81376
+ },
81377
+ onClose: () => setAiSummaryHour(null),
81378
+ className: "shadow-2xl border-slate-200/60 ring-1 ring-black/5"
80774
81379
  }
80775
- },
80776
- onMonthNavigate: (newMonth, newYear) => {
80777
- setSelectedMonth(newMonth);
80778
- setSelectedYear(newYear);
80779
- const nextBounds = getMonthKeyBounds(newYear, newMonth);
80780
- setRangeStart(nextBounds.startKey);
80781
- setRangeEnd(nextBounds.endKey);
80782
- },
80783
- onShiftChange: setSelectedShift,
80784
- onRangeChange: (nextRange) => {
80785
- setRangeStart(nextRange.startKey);
80786
- setRangeEnd(nextRange.endKey);
80787
- },
80788
- className: "w-full"
81380
+ )
80789
81381
  }
80790
81382
  )
80791
- ] }),
80792
- activeTab === "bottlenecks" && /* @__PURE__ */ jsx(ClipFilterProvider, { children: /* @__PURE__ */ jsx(
80793
- BottlenecksContent,
80794
- {
80795
- workspaceId,
80796
- workspaceName: formattedWorkspaceName,
80797
- date,
80798
- lineId: resolvedLineId,
80799
- shift,
80800
- totalOutput: workspace?.total_actions,
80801
- workspaceMetrics: detailedWorkspaceMetrics || void 0,
80802
- prefetchedPercentileCounts: isFastSlowClipFiltersEnabled ? prefetchedPercentileCounts : null,
80803
- className: "h-[calc(100vh-10rem)]"
80804
- }
80805
- ) })
80806
- ] })
80807
- ] })
81383
+ }
81384
+ )
81385
+ ]
80808
81386
  }
80809
81387
  );
80810
81388
  };
@@ -82396,7 +82974,7 @@ function BottleneckClipsView({
82396
82974
  ) })
82397
82975
  ] }) });
82398
82976
  }
82399
- var AuthenticatedBottleneckClipsView = withAuth(React146__default.memo(BottleneckClipsView));
82977
+ var AuthenticatedBottleneckClipsView = withAuth(React147__default.memo(BottleneckClipsView));
82400
82978
  var BottleneckClipsView_default = BottleneckClipsView;
82401
82979
 
82402
82980
  // src/lib/services/ticketService.ts
@@ -83239,7 +83817,7 @@ Please ensure:
83239
83817
  )
83240
83818
  ] });
83241
83819
  }
83242
- var AuthenticatedTicketsView = withAuth(React146__default.memo(TicketsView));
83820
+ var AuthenticatedTicketsView = withAuth(React147__default.memo(TicketsView));
83243
83821
  var TicketsView_default = TicketsView;
83244
83822
 
83245
83823
  // src/lib/utils/improvementDisplay.ts
@@ -84210,7 +84788,7 @@ var ImprovementCenterView = () => {
84210
84788
  setSelectedMemberId("all");
84211
84789
  }
84212
84790
  }, [memberOptions, selectedMemberId]);
84213
- const getRecommendationDisplayMetadata = React146__default.useCallback((rec) => {
84791
+ const getRecommendationDisplayMetadata = React147__default.useCallback((rec) => {
84214
84792
  const supervisors = rec.line_id ? supervisorsByLineId.get(rec.line_id) || [] : [];
84215
84793
  return getImprovementDisplayMetadata({
84216
84794
  location: rec.location,
@@ -84684,7 +85262,7 @@ var ThreadSidebar = ({
84684
85262
  ] }) })
84685
85263
  ] });
84686
85264
  };
84687
- var ProfilePicture = React146__default.memo(({
85265
+ var ProfilePicture = React147__default.memo(({
84688
85266
  alt = "Axel",
84689
85267
  className = "",
84690
85268
  size = "md",
@@ -87244,7 +87822,7 @@ var OverviewImprovementsSkeleton = () => /* @__PURE__ */ jsx("div", { className:
87244
87822
  ] }),
87245
87823
  /* @__PURE__ */ jsx("div", { className: "flex items-center justify-end flex-shrink-0 ml-4", children: /* @__PURE__ */ jsx(SectionPulse, { className: "h-6 w-20 rounded-full" }) })
87246
87824
  ] }, index)) });
87247
- var OperationsOverviewHeader = React146__default.memo(({
87825
+ var OperationsOverviewHeader = React147__default.memo(({
87248
87826
  dateRange,
87249
87827
  displayDateRange,
87250
87828
  trendMode,
@@ -87265,65 +87843,65 @@ var OperationsOverviewHeader = React146__default.memo(({
87265
87843
  bumpRenderCounter();
87266
87844
  const subtitleRange = displayDateRange || dateRange;
87267
87845
  const showLiveShiftMeta = isLiveScope && trendMode !== "all";
87268
- const liveShiftLabel = React146__default.useMemo(
87846
+ const liveShiftLabel = React147__default.useMemo(
87269
87847
  () => normalizeShiftLabel(liveShiftName, trendMode),
87270
87848
  [liveShiftName, trendMode]
87271
87849
  );
87272
- const liveShiftIcon = React146__default.useMemo(
87850
+ const liveShiftIcon = React147__default.useMemo(
87273
87851
  () => getShiftIcon(liveShiftName, trendMode),
87274
87852
  [liveShiftName, trendMode]
87275
87853
  );
87276
- const [isFilterOpen, setIsFilterOpen] = React146__default.useState(false);
87277
- const [isLinesDropdownOpen, setIsLinesDropdownOpen] = React146__default.useState(false);
87278
- const filterRef = React146__default.useRef(null);
87279
- const filterButtonRef = React146__default.useRef(null);
87280
- const mobileFilterButtonRef = React146__default.useRef(null);
87281
- const linesDropdownRef = React146__default.useRef(null);
87282
- const mobileSubtitle = React146__default.useMemo(() => {
87854
+ const [isFilterOpen, setIsFilterOpen] = React147__default.useState(false);
87855
+ const [isLinesDropdownOpen, setIsLinesDropdownOpen] = React147__default.useState(false);
87856
+ const filterRef = React147__default.useRef(null);
87857
+ const filterButtonRef = React147__default.useRef(null);
87858
+ const mobileFilterButtonRef = React147__default.useRef(null);
87859
+ const linesDropdownRef = React147__default.useRef(null);
87860
+ const mobileSubtitle = React147__default.useMemo(() => {
87283
87861
  if (subtitleRange.startKey === subtitleRange.endKey) {
87284
87862
  return format(parseDateKeyToDate(subtitleRange.startKey), "do MMM, yyyy");
87285
87863
  }
87286
87864
  return `${format(parseDateKeyToDate(subtitleRange.startKey), "do MMM")} - ${format(parseDateKeyToDate(subtitleRange.endKey), "do MMM, yyyy")}`;
87287
87865
  }, [subtitleRange.endKey, subtitleRange.startKey]);
87288
- const desktopSubtitle = React146__default.useMemo(() => {
87866
+ const desktopSubtitle = React147__default.useMemo(() => {
87289
87867
  if (subtitleRange.startKey === subtitleRange.endKey) {
87290
87868
  return format(parseDateKeyToDate(subtitleRange.startKey), "do MMMM, yyyy");
87291
87869
  }
87292
87870
  return `${format(parseDateKeyToDate(subtitleRange.startKey), "do MMMM, yyyy")} - ${format(parseDateKeyToDate(subtitleRange.endKey), "do MMMM, yyyy")}`;
87293
87871
  }, [subtitleRange.endKey, subtitleRange.startKey]);
87294
- const availableLineIds = React146__default.useMemo(
87872
+ const availableLineIds = React147__default.useMemo(
87295
87873
  () => lineOptions.map((line) => line.id),
87296
87874
  [lineOptions]
87297
87875
  );
87298
- const selectedLineIdSet = React146__default.useMemo(
87876
+ const selectedLineIdSet = React147__default.useMemo(
87299
87877
  () => new Set(selectedLineIds),
87300
87878
  [selectedLineIds]
87301
87879
  );
87302
- const isAllLinesSelected = React146__default.useMemo(() => {
87880
+ const isAllLinesSelected = React147__default.useMemo(() => {
87303
87881
  if (availableLineIds.length === 0) return true;
87304
87882
  return availableLineIds.every((lineId) => selectedLineIdSet.has(lineId));
87305
87883
  }, [availableLineIds, selectedLineIdSet]);
87306
- const activeFilterCount = React146__default.useMemo(() => {
87884
+ const activeFilterCount = React147__default.useMemo(() => {
87307
87885
  let count = 0;
87308
87886
  if (trendMode !== "all") count += 1;
87309
87887
  if (selectedSupervisorId !== "all") count += 1;
87310
87888
  if (!isAllLinesSelected) count += 1;
87311
87889
  return count;
87312
87890
  }, [isAllLinesSelected, selectedSupervisorId, trendMode]);
87313
- const handleFilterToggle = React146__default.useCallback(() => {
87891
+ const handleFilterToggle = React147__default.useCallback(() => {
87314
87892
  trackCoreEvent("Operations Overview Filter Toggled", {
87315
87893
  action: !isFilterOpen ? "open" : "close"
87316
87894
  });
87317
87895
  setIsFilterOpen((previous) => !previous);
87318
87896
  }, [isFilterOpen]);
87319
- const handleTrendModeChange = React146__default.useCallback((event) => {
87897
+ const handleTrendModeChange = React147__default.useCallback((event) => {
87320
87898
  const nextMode = event.target.value;
87321
87899
  trackCoreEvent("Operations Overview Shift Filter Changed", {
87322
87900
  shift_mode: nextMode
87323
87901
  });
87324
87902
  onTrendModeChange(nextMode);
87325
87903
  }, [onTrendModeChange]);
87326
- const handleAllLinesToggle = React146__default.useCallback(() => {
87904
+ const handleAllLinesToggle = React147__default.useCallback(() => {
87327
87905
  trackCoreEvent("Operations Overview Line Filter Changed", {
87328
87906
  selected_line_ids: availableLineIds,
87329
87907
  selected_line_count: availableLineIds.length,
@@ -87331,7 +87909,7 @@ var OperationsOverviewHeader = React146__default.memo(({
87331
87909
  });
87332
87910
  onSelectedLineIdsChange(availableLineIds);
87333
87911
  }, [availableLineIds, onSelectedLineIdsChange]);
87334
- const handleSupervisorChange = React146__default.useCallback((event) => {
87912
+ const handleSupervisorChange = React147__default.useCallback((event) => {
87335
87913
  const supervisorId = event.target.value;
87336
87914
  const selectedSupervisor = supervisorOptions.find((option) => option.id === supervisorId);
87337
87915
  trackCoreEvent("Operations Overview Supervisor Filter Changed", {
@@ -87342,7 +87920,7 @@ var OperationsOverviewHeader = React146__default.memo(({
87342
87920
  });
87343
87921
  onSelectedSupervisorIdChange(supervisorId);
87344
87922
  }, [availableLineIds, onSelectedSupervisorIdChange, supervisorOptions]);
87345
- const handleLineToggle = React146__default.useCallback((lineId) => {
87923
+ const handleLineToggle = React147__default.useCallback((lineId) => {
87346
87924
  const current = new Set(selectedLineIds);
87347
87925
  if (current.has(lineId)) {
87348
87926
  if (current.size <= 1) return;
@@ -87358,13 +87936,13 @@ var OperationsOverviewHeader = React146__default.memo(({
87358
87936
  });
87359
87937
  onSelectedLineIdsChange(next);
87360
87938
  }, [availableLineIds, onSelectedLineIdsChange, selectedLineIds]);
87361
- const handleClearAllFilters = React146__default.useCallback(() => {
87939
+ const handleClearAllFilters = React147__default.useCallback(() => {
87362
87940
  onTrendModeChange("all");
87363
87941
  onSelectedSupervisorIdChange("all");
87364
87942
  onSelectedLineIdsChange(availableLineIds);
87365
87943
  setIsFilterOpen(false);
87366
87944
  }, [availableLineIds, onSelectedLineIdsChange, onSelectedSupervisorIdChange, onTrendModeChange]);
87367
- React146__default.useEffect(() => {
87945
+ React147__default.useEffect(() => {
87368
87946
  const handleClickOutside = (event) => {
87369
87947
  const target = event.target;
87370
87948
  if (filterRef.current && !filterRef.current.contains(target) && filterButtonRef.current && !filterButtonRef.current.contains(target) && mobileFilterButtonRef.current && !mobileFilterButtonRef.current.contains(target)) {
@@ -87599,12 +88177,12 @@ var OperationsOverviewHeader = React146__default.memo(({
87599
88177
  ] }) });
87600
88178
  });
87601
88179
  OperationsOverviewHeader.displayName = "OperationsOverviewHeader";
87602
- var OverviewSummaryCards = React146__default.memo(({ store }) => {
88180
+ var OverviewSummaryCards = React147__default.memo(({ store }) => {
87603
88181
  bumpRenderCounter();
87604
88182
  const scope = useOperationsOverviewScope(store);
87605
88183
  const snapshot = useOperationsOverviewSnapshot(store);
87606
88184
  const showSnapshotSkeleton = snapshot.loading && !snapshot.hasLoadedOnce;
87607
- const comparisonLabel = React146__default.useMemo(() => {
88185
+ const comparisonLabel = React147__default.useMemo(() => {
87608
88186
  return formatComparisonWindow({
87609
88187
  currentDayCount: scope.current_range?.day_count ?? null,
87610
88188
  previousDayCount: scope.previous_range?.day_count ?? null,
@@ -87617,27 +88195,27 @@ var OverviewSummaryCards = React146__default.memo(({ store }) => {
87617
88195
  scope.previous_range?.day_count,
87618
88196
  scope.shift_mode
87619
88197
  ]);
87620
- const [isIdleContributorsOpen, setIsIdleContributorsOpen] = React146__default.useState(false);
87621
- const [isIdleContributorsPinned, setIsIdleContributorsPinned] = React146__default.useState(false);
87622
- const idleContributorsRef = React146__default.useRef(null);
87623
- const plantEfficiencyBadge = React146__default.useMemo(() => {
88198
+ const [isIdleContributorsOpen, setIsIdleContributorsOpen] = React147__default.useState(false);
88199
+ const [isIdleContributorsPinned, setIsIdleContributorsPinned] = React147__default.useState(false);
88200
+ const idleContributorsRef = React147__default.useRef(null);
88201
+ const plantEfficiencyBadge = React147__default.useMemo(() => {
87624
88202
  return buildDeltaBadge(snapshot.data.summary.plant_efficiency?.delta_pp, {
87625
88203
  positiveIsGood: true,
87626
88204
  formatter: (value) => `${value >= 0 ? "+" : ""}${roundOne(value)}%`,
87627
88205
  comparisonLabel
87628
88206
  });
87629
88207
  }, [comparisonLabel, snapshot.data.summary.plant_efficiency?.delta_pp]);
87630
- const idleBadge = React146__default.useMemo(() => {
88208
+ const idleBadge = React147__default.useMemo(() => {
87631
88209
  return buildDeltaBadge(snapshot.data.summary.avg_idle_per_workstation?.delta_seconds, {
87632
88210
  positiveIsGood: false,
87633
88211
  formatter: (value) => formatSignedIdleDuration(value),
87634
88212
  comparisonLabel
87635
88213
  });
87636
88214
  }, [comparisonLabel, snapshot.data.summary.avg_idle_per_workstation?.delta_seconds]);
87637
- const canInspectIdleContributors = React146__default.useMemo(() => {
88215
+ const canInspectIdleContributors = React147__default.useMemo(() => {
87638
88216
  return !showSnapshotSkeleton && snapshot.data.summary.avg_idle_per_workstation?.current_seconds !== null && snapshot.data.summary.avg_idle_per_workstation?.current_seconds !== void 0;
87639
88217
  }, [showSnapshotSkeleton, snapshot.data.summary.avg_idle_per_workstation?.current_seconds]);
87640
- const idleTopContributors = React146__default.useMemo(() => {
88218
+ const idleTopContributors = React147__default.useMemo(() => {
87641
88219
  return (snapshot.data.summary.avg_idle_per_workstation?.top_contributors || []).map((item) => ({
87642
88220
  workspaceId: item.workspace_id || "",
87643
88221
  workspaceName: item.workspace_name?.trim() || item.workspace_id || "Unknown",
@@ -87645,14 +88223,14 @@ var OverviewSummaryCards = React146__default.memo(({ store }) => {
87645
88223
  avgIdleSeconds: toNumber4(item.avg_idle_seconds)
87646
88224
  })).slice(0, 5);
87647
88225
  }, [snapshot.data.summary.avg_idle_per_workstation?.top_contributors]);
87648
- const showIdleContributorLineNames = React146__default.useMemo(() => {
88226
+ const showIdleContributorLineNames = React147__default.useMemo(() => {
87649
88227
  return (scope.line_count ?? 0) > 1;
87650
88228
  }, [scope.line_count]);
87651
- const closeIdleContributors = React146__default.useCallback(() => {
88229
+ const closeIdleContributors = React147__default.useCallback(() => {
87652
88230
  setIsIdleContributorsOpen(false);
87653
88231
  setIsIdleContributorsPinned(false);
87654
88232
  }, []);
87655
- const handleIdleContributorsToggle = React146__default.useCallback(() => {
88233
+ const handleIdleContributorsToggle = React147__default.useCallback(() => {
87656
88234
  if (!canInspectIdleContributors) return;
87657
88235
  setIsIdleContributorsPinned((previous) => {
87658
88236
  const next = !previous;
@@ -87660,7 +88238,7 @@ var OverviewSummaryCards = React146__default.memo(({ store }) => {
87660
88238
  return next;
87661
88239
  });
87662
88240
  }, [canInspectIdleContributors]);
87663
- const handleIdleContributorsKeyDown = React146__default.useCallback((event) => {
88241
+ const handleIdleContributorsKeyDown = React147__default.useCallback((event) => {
87664
88242
  if (!canInspectIdleContributors) return;
87665
88243
  if (event.key === "Enter" || event.key === " ") {
87666
88244
  event.preventDefault();
@@ -87672,11 +88250,11 @@ var OverviewSummaryCards = React146__default.memo(({ store }) => {
87672
88250
  closeIdleContributors();
87673
88251
  }
87674
88252
  }, [canInspectIdleContributors, closeIdleContributors, handleIdleContributorsToggle]);
87675
- React146__default.useEffect(() => {
88253
+ React147__default.useEffect(() => {
87676
88254
  setIsIdleContributorsOpen(false);
87677
88255
  setIsIdleContributorsPinned(false);
87678
88256
  }, [scope.comparison_strategy, scope.current_range?.start_date, scope.current_range?.end_date, scope.line_count, scope.shift_mode]);
87679
- React146__default.useEffect(() => {
88257
+ React147__default.useEffect(() => {
87680
88258
  if (!isIdleContributorsOpen) return void 0;
87681
88259
  const handleClickOutside = (event) => {
87682
88260
  if (!isIdleContributorsPinned) return;
@@ -87814,7 +88392,7 @@ var OverviewSummaryCards = React146__default.memo(({ store }) => {
87814
88392
  ] });
87815
88393
  });
87816
88394
  OverviewSummaryCards.displayName = "OverviewSummaryCards";
87817
- var PoorestPerformersCard = React146__default.memo(({
88395
+ var PoorestPerformersCard = React147__default.memo(({
87818
88396
  store,
87819
88397
  supervisorsByLineId,
87820
88398
  onViewAll,
@@ -87823,9 +88401,9 @@ var PoorestPerformersCard = React146__default.memo(({
87823
88401
  bumpRenderCounter();
87824
88402
  const scope = useOperationsOverviewScope(store);
87825
88403
  const snapshot = useOperationsOverviewSnapshot(store);
87826
- const [poorestLineMode, setPoorestLineMode] = React146__default.useState("output");
88404
+ const [poorestLineMode, setPoorestLineMode] = React147__default.useState("output");
87827
88405
  const availableLineModes = scope.available_line_modes;
87828
- React146__default.useEffect(() => {
88406
+ React147__default.useEffect(() => {
87829
88407
  const hasOutput = !!availableLineModes?.has_output;
87830
88408
  const hasUptime = !!availableLineModes?.has_uptime;
87831
88409
  if (hasOutput && !hasUptime && poorestLineMode !== "output") {
@@ -87834,7 +88412,7 @@ var PoorestPerformersCard = React146__default.memo(({
87834
88412
  setPoorestLineMode("uptime");
87835
88413
  }
87836
88414
  }, [availableLineModes?.has_output, availableLineModes?.has_uptime, poorestLineMode]);
87837
- const comparisonLabel = React146__default.useMemo(() => {
88415
+ const comparisonLabel = React147__default.useMemo(() => {
87838
88416
  return formatComparisonWindow({
87839
88417
  currentDayCount: scope.current_range?.day_count ?? null,
87840
88418
  previousDayCount: scope.previous_range?.day_count ?? null,
@@ -87848,7 +88426,7 @@ var PoorestPerformersCard = React146__default.memo(({
87848
88426
  scope.shift_mode
87849
88427
  ]);
87850
88428
  const showSnapshotSkeleton = snapshot.loading && !snapshot.hasLoadedOnce;
87851
- const mergedPoorestLines = React146__default.useMemo(() => {
88429
+ const mergedPoorestLines = React147__default.useMemo(() => {
87852
88430
  const rows = snapshot.data.poorest_lines?.[poorestLineMode] || [];
87853
88431
  const lineRows = [];
87854
88432
  const areaGroups = /* @__PURE__ */ new Map();
@@ -87928,7 +88506,7 @@ var PoorestPerformersCard = React146__default.memo(({
87928
88506
  }, [poorestLineMode, snapshot.data.poorest_lines, supervisorsByLineId]);
87929
88507
  const showPoorestModeToggle = !!availableLineModes?.has_output && !!availableLineModes?.has_uptime;
87930
88508
  const poorestMetricLabel = poorestLineMode === "uptime" ? "Uptime" : "Efficiency";
87931
- const handlePoorestLineModeChange = React146__default.useCallback((mode) => {
88509
+ const handlePoorestLineModeChange = React147__default.useCallback((mode) => {
87932
88510
  trackCoreEvent("Operations Overview Poorest Line Mode Changed", { mode });
87933
88511
  setPoorestLineMode(mode);
87934
88512
  }, []);
@@ -88014,14 +88592,14 @@ var PoorestPerformersCard = React146__default.memo(({
88014
88592
  ] });
88015
88593
  });
88016
88594
  PoorestPerformersCard.displayName = "PoorestPerformersCard";
88017
- var IdleBreakdownCard = React146__default.memo(({
88595
+ var IdleBreakdownCard = React147__default.memo(({
88018
88596
  store,
88019
88597
  scopedLineCount
88020
88598
  }) => {
88021
88599
  bumpRenderCounter();
88022
88600
  const idle = useOperationsOverviewIdle(store);
88023
88601
  const showInitialSkeleton = idle.loading && idle.lastUpdated === null;
88024
- const idleBreakdown = React146__default.useMemo(() => {
88602
+ const idleBreakdown = React147__default.useMemo(() => {
88025
88603
  return idle.data.map((item) => ({
88026
88604
  name: item.display_name?.trim() || item.reason?.trim() || "Unknown",
88027
88605
  reasonKey: item.reason_key?.trim() || item.reason?.trim() || "unknown",
@@ -88040,7 +88618,7 @@ var IdleBreakdownCard = React146__default.memo(({
88040
88618
  }))
88041
88619
  })).filter((item) => item.value > 0);
88042
88620
  }, [idle.data]);
88043
- const showIdleModuleNotEnabledState = React146__default.useMemo(() => {
88621
+ const showIdleModuleNotEnabledState = React147__default.useMemo(() => {
88044
88622
  const enabledLineCount = idle.scope.idle_time_vlm_enabled_line_count;
88045
88623
  return !showInitialSkeleton && scopedLineCount > 0 && typeof enabledLineCount === "number" && enabledLineCount === 0;
88046
88624
  }, [idle.scope.idle_time_vlm_enabled_line_count, scopedLineCount, showInitialSkeleton]);
@@ -88061,7 +88639,7 @@ var IdleBreakdownCard = React146__default.memo(({
88061
88639
  ] });
88062
88640
  });
88063
88641
  IdleBreakdownCard.displayName = "IdleBreakdownCard";
88064
- var EfficiencyTrendCard = React146__default.memo(({
88642
+ var EfficiencyTrendCard = React147__default.memo(({
88065
88643
  store,
88066
88644
  dateRange,
88067
88645
  appTimezone,
@@ -88069,14 +88647,14 @@ var EfficiencyTrendCard = React146__default.memo(({
88069
88647
  }) => {
88070
88648
  bumpRenderCounter();
88071
88649
  const trend = useOperationsOverviewTrend(store);
88072
- const currentWeekRange = React146__default.useMemo(
88650
+ const currentWeekRange = React147__default.useMemo(
88073
88651
  () => getCurrentWeekToDateRange(appTimezone),
88074
88652
  [appTimezone]
88075
88653
  );
88076
88654
  const isCurrentWeekToDateRange = dateRange.startKey === currentWeekRange.startKey && dateRange.endKey === currentWeekRange.endKey;
88077
88655
  const showInitialSkeleton = trend.loading && trend.lastUpdated === null;
88078
88656
  const isHourlyTrend = trend.data.granularity === "hour";
88079
- const trendData = React146__default.useMemo(() => {
88657
+ const trendData = React147__default.useMemo(() => {
88080
88658
  if (isHourlyTrend) {
88081
88659
  return (trend.data.points || []).map((point, index) => ({
88082
88660
  name: (() => {
@@ -88148,13 +88726,13 @@ var EfficiencyTrendCard = React146__default.memo(({
88148
88726
  };
88149
88727
  });
88150
88728
  }, [currentWeekRange.startKey, hourlyLabelStartTime, isCurrentWeekToDateRange, isHourlyTrend, trend.data.points]);
88151
- const trendTooltipLabelFormatter = React146__default.useCallback((label, payload) => {
88729
+ const trendTooltipLabelFormatter = React147__default.useCallback((label, payload) => {
88152
88730
  if (isHourlyTrend) return label;
88153
88731
  const dayOfWeek = payload?.[0]?.payload?.dayOfWeek;
88154
88732
  if (!dayOfWeek || typeof label !== "string") return label;
88155
88733
  return `${label} (${dayOfWeek})`;
88156
88734
  }, [isHourlyTrend]);
88157
- const trendXAxisTickFormatter = React146__default.useCallback((value, index) => {
88735
+ const trendXAxisTickFormatter = React147__default.useCallback((value, index) => {
88158
88736
  if (!isHourlyTrend) {
88159
88737
  return typeof value === "string" ? value : String(value ?? "");
88160
88738
  }
@@ -88181,7 +88759,7 @@ var EfficiencyTrendCard = React146__default.memo(({
88181
88759
  ] });
88182
88760
  });
88183
88761
  EfficiencyTrendCard.displayName = "EfficiencyTrendCard";
88184
- var TopImprovementsCard = React146__default.memo(({
88762
+ var TopImprovementsCard = React147__default.memo(({
88185
88763
  store,
88186
88764
  supervisorsByLineId,
88187
88765
  onViewAll,
@@ -88190,7 +88768,7 @@ var TopImprovementsCard = React146__default.memo(({
88190
88768
  bumpRenderCounter();
88191
88769
  const improvements = useOperationsOverviewImprovements(store);
88192
88770
  const showInitialSkeleton = improvements.loading && improvements.lastUpdated === null;
88193
- const displayImprovements = React146__default.useMemo(() => {
88771
+ const displayImprovements = React147__default.useMemo(() => {
88194
88772
  return improvements.data.map((item) => {
88195
88773
  const supervisors = item.lineId ? supervisorsByLineId.get(item.lineId) || [] : [];
88196
88774
  return {
@@ -88318,33 +88896,33 @@ var useOperationsOverviewRefresh = ({
88318
88896
  isLiveScope,
88319
88897
  enabled = true
88320
88898
  }) => {
88321
- const lineIdsKey = React146__default.useMemo(() => lineIds.join(","), [lineIds]);
88322
- const scopeSignature = React146__default.useMemo(
88899
+ const lineIdsKey = React147__default.useMemo(() => lineIds.join(","), [lineIds]);
88900
+ const scopeSignature = React147__default.useMemo(
88323
88901
  () => [companyId || "", startKey, endKey, trendMode, comparisonStrategy || "", lineIdsKey].join("::"),
88324
88902
  [companyId, comparisonStrategy, endKey, lineIdsKey, startKey, trendMode]
88325
88903
  );
88326
- const controllersRef = React146__default.useRef({});
88327
- const requestIdsRef = React146__default.useRef({
88904
+ const controllersRef = React147__default.useRef({});
88905
+ const requestIdsRef = React147__default.useRef({
88328
88906
  snapshot: 0,
88329
88907
  trend: 0,
88330
88908
  idle: 0,
88331
88909
  improvements: 0
88332
88910
  });
88333
- const intervalRef = React146__default.useRef(null);
88334
- const isPageActiveRef = React146__default.useRef(true);
88335
- const lastResumeRefreshAtRef = React146__default.useRef(0);
88336
- const abortAll = React146__default.useCallback(() => {
88911
+ const intervalRef = React147__default.useRef(null);
88912
+ const isPageActiveRef = React147__default.useRef(true);
88913
+ const lastResumeRefreshAtRef = React147__default.useRef(0);
88914
+ const abortAll = React147__default.useCallback(() => {
88337
88915
  Object.values(controllersRef.current).forEach((controller) => {
88338
88916
  controller?.abort();
88339
88917
  });
88340
88918
  controllersRef.current = {};
88341
88919
  }, []);
88342
- React146__default.useEffect(() => {
88920
+ React147__default.useEffect(() => {
88343
88921
  return () => {
88344
88922
  abortAll();
88345
88923
  };
88346
88924
  }, [abortAll]);
88347
- const getIsPageActive = React146__default.useCallback(() => {
88925
+ const getIsPageActive = React147__default.useCallback(() => {
88348
88926
  if (typeof document === "undefined") {
88349
88927
  return true;
88350
88928
  }
@@ -88352,7 +88930,7 @@ var useOperationsOverviewRefresh = ({
88352
88930
  const hasFocus = typeof document.hasFocus === "function" ? document.hasFocus() : true;
88353
88931
  return isVisible && hasFocus;
88354
88932
  }, []);
88355
- const stopPolling = React146__default.useCallback((reason) => {
88933
+ const stopPolling = React147__default.useCallback((reason) => {
88356
88934
  if (intervalRef.current === null) {
88357
88935
  return;
88358
88936
  }
@@ -88360,7 +88938,7 @@ var useOperationsOverviewRefresh = ({
88360
88938
  intervalRef.current = null;
88361
88939
  debugRefreshLog("poll stopped", { reason });
88362
88940
  }, []);
88363
- const runRefresh = React146__default.useCallback(
88941
+ const runRefresh = React147__default.useCallback(
88364
88942
  async (section, begin, onSuccess, onError, request, reason) => {
88365
88943
  if (!enabled || !supabase || !companyId || lineIds.length === 0) return;
88366
88944
  const requestId = requestIdsRef.current[section] + 1;
@@ -88407,7 +88985,7 @@ var useOperationsOverviewRefresh = ({
88407
88985
  },
88408
88986
  [companyId, comparisonStrategy, enabled, endKey, lineIds, startKey, supabase, trendMode]
88409
88987
  );
88410
- const refreshSnapshot = React146__default.useCallback(
88988
+ const refreshSnapshot = React147__default.useCallback(
88411
88989
  async (reason) => {
88412
88990
  await runRefresh(
88413
88991
  "snapshot",
@@ -88439,7 +89017,7 @@ var useOperationsOverviewRefresh = ({
88439
89017
  },
88440
89018
  [companyId, comparisonStrategy, endKey, lineIdsKey, runRefresh, scopeSignature, startKey, store, supabase, trendMode]
88441
89019
  );
88442
- const refreshTrend = React146__default.useCallback(
89020
+ const refreshTrend = React147__default.useCallback(
88443
89021
  async (reason) => {
88444
89022
  await runRefresh(
88445
89023
  "trend",
@@ -88468,7 +89046,7 @@ var useOperationsOverviewRefresh = ({
88468
89046
  },
88469
89047
  [companyId, endKey, lineIdsKey, runRefresh, scopeSignature, startKey, store, supabase, trendMode]
88470
89048
  );
88471
- const refreshIdle = React146__default.useCallback(
89049
+ const refreshIdle = React147__default.useCallback(
88472
89050
  async (reason) => {
88473
89051
  await runRefresh(
88474
89052
  "idle",
@@ -88497,7 +89075,7 @@ var useOperationsOverviewRefresh = ({
88497
89075
  },
88498
89076
  [companyId, endKey, lineIdsKey, runRefresh, scopeSignature, startKey, store, supabase, trendMode]
88499
89077
  );
88500
- const refreshImprovements = React146__default.useCallback(
89078
+ const refreshImprovements = React147__default.useCallback(
88501
89079
  async (reason) => {
88502
89080
  await runRefresh(
88503
89081
  "improvements",
@@ -88527,7 +89105,7 @@ var useOperationsOverviewRefresh = ({
88527
89105
  },
88528
89106
  [companyId, lineIds, lineIdsKey, runRefresh, scopeSignature, store, supabase]
88529
89107
  );
88530
- const refreshAll = React146__default.useCallback(
89108
+ const refreshAll = React147__default.useCallback(
88531
89109
  async (reason) => {
88532
89110
  await Promise.allSettled([
88533
89111
  refreshSnapshot(reason),
@@ -88538,7 +89116,7 @@ var useOperationsOverviewRefresh = ({
88538
89116
  },
88539
89117
  [refreshIdle, refreshImprovements, refreshSnapshot, refreshTrend]
88540
89118
  );
88541
- const startPolling = React146__default.useCallback((reason) => {
89119
+ const startPolling = React147__default.useCallback((reason) => {
88542
89120
  if (!isLiveScope || !supabase || !companyId || lineIds.length === 0) {
88543
89121
  return;
88544
89122
  }
@@ -88559,7 +89137,7 @@ var useOperationsOverviewRefresh = ({
88559
89137
  }, LIVE_REFRESH_INTERVAL_MS);
88560
89138
  debugRefreshLog("poll started", { reason, intervalMs: LIVE_REFRESH_INTERVAL_MS });
88561
89139
  }, [companyId, isLiveScope, lineIds.length, refreshAll, stopPolling, supabase]);
88562
- const refreshFromResume = React146__default.useCallback((reason) => {
89140
+ const refreshFromResume = React147__default.useCallback((reason) => {
88563
89141
  const now4 = Date.now();
88564
89142
  if (now4 - lastResumeRefreshAtRef.current < 1e3) {
88565
89143
  debugRefreshLog("resume refresh suppressed", { reason });
@@ -88574,7 +89152,7 @@ var useOperationsOverviewRefresh = ({
88574
89152
  }
88575
89153
  });
88576
89154
  }, [refreshAll, startPolling, stopPolling]);
88577
- React146__default.useEffect(() => {
89155
+ React147__default.useEffect(() => {
88578
89156
  if (!enabled) {
88579
89157
  stopPolling("disabled");
88580
89158
  abortAll();
@@ -88589,7 +89167,7 @@ var useOperationsOverviewRefresh = ({
88589
89167
  }
88590
89168
  void refreshAll("scope_change");
88591
89169
  }, [abortAll, companyId, enabled, lineIds.length, refreshAll, scopeSignature, stopPolling, store, supabase]);
88592
- React146__default.useEffect(() => {
89170
+ React147__default.useEffect(() => {
88593
89171
  if (!enabled || !isLiveScope || !supabase || !companyId || lineIds.length === 0) {
88594
89172
  isPageActiveRef.current = false;
88595
89173
  stopPolling("live_scope_disabled");
@@ -88648,7 +89226,7 @@ var useOperationsOverviewRefresh = ({
88648
89226
  };
88649
89227
  }, [companyId, enabled, getIsPageActive, isLiveScope, lineIds.length, refreshFromResume, startPolling, stopPolling, supabase]);
88650
89228
  };
88651
- var parseTimeToMinutes4 = (value) => {
89229
+ var parseTimeToMinutes5 = (value) => {
88652
89230
  if (!value) return null;
88653
89231
  const parts = value.split(":");
88654
89232
  if (parts.length < 2) return null;
@@ -88701,8 +89279,8 @@ var classifyShiftBucket = ({
88701
89279
  return "day";
88702
89280
  }
88703
89281
  }
88704
- const startMinutes = parseTimeToMinutes4(startTime);
88705
- const endMinutes = parseTimeToMinutes4(endTime);
89282
+ const startMinutes = parseTimeToMinutes5(startTime);
89283
+ const endMinutes = parseTimeToMinutes5(endTime);
88706
89284
  if (startMinutes !== null) {
88707
89285
  if (startMinutes >= 4 * 60 && startMinutes < 18 * 60) return "day";
88708
89286
  return "night";
@@ -88761,8 +89339,8 @@ var getShiftWindowsForConfig = (shiftConfig, timezone) => {
88761
89339
  ];
88762
89340
  };
88763
89341
  var normalizeShiftWindowMinutes = (startTime, endTime) => {
88764
- const startMinutes = parseTimeToMinutes4(startTime);
88765
- const endMinutesRaw = parseTimeToMinutes4(endTime);
89342
+ const startMinutes = parseTimeToMinutes5(startTime);
89343
+ const endMinutesRaw = parseTimeToMinutes5(endTime);
88766
89344
  if (startMinutes === null || endMinutesRaw === null) {
88767
89345
  return null;
88768
89346
  }
@@ -88802,55 +89380,55 @@ var PlantHeadView = () => {
88802
89380
  const { accessibleLineIds } = useUserLineAccess();
88803
89381
  const mobileMenuContext = useMobileMenu();
88804
89382
  useHideMobileHeader(!!mobileMenuContext);
88805
- const storeRef = React146__default.useRef(createOperationsOverviewStore());
89383
+ const storeRef = React147__default.useRef(createOperationsOverviewStore());
88806
89384
  const store = storeRef.current;
88807
- const fallbackOperationalDate = React146__default.useMemo(
89385
+ const fallbackOperationalDate = React147__default.useMemo(
88808
89386
  () => getOperationalDate(appTimezone),
88809
89387
  [appTimezone]
88810
89388
  );
88811
- const [dateRange, setDateRange] = React146__default.useState(() => ({
89389
+ const [dateRange, setDateRange] = React147__default.useState(() => ({
88812
89390
  startKey: fallbackOperationalDate,
88813
89391
  endKey: fallbackOperationalDate
88814
89392
  }));
88815
- const [usesThisWeekComparison, setUsesThisWeekComparison] = React146__default.useState(false);
88816
- const [trendMode, setTrendMode] = React146__default.useState("all");
88817
- const [selectedSupervisorId, setSelectedSupervisorId] = React146__default.useState("all");
88818
- const [selectedLineIds, setSelectedLineIds] = React146__default.useState([]);
88819
- const [isInitialScopeReady, setIsInitialScopeReady] = React146__default.useState(false);
88820
- const [shiftResolutionTick, setShiftResolutionTick] = React146__default.useState(0);
88821
- const hasAutoInitializedScopeRef = React146__default.useRef(false);
88822
- const hasUserAdjustedScopeRef = React146__default.useRef(false);
88823
- React146__default.useEffect(() => {
89393
+ const [usesThisWeekComparison, setUsesThisWeekComparison] = React147__default.useState(false);
89394
+ const [trendMode, setTrendMode] = React147__default.useState("all");
89395
+ const [selectedSupervisorId, setSelectedSupervisorId] = React147__default.useState("all");
89396
+ const [selectedLineIds, setSelectedLineIds] = React147__default.useState([]);
89397
+ const [isInitialScopeReady, setIsInitialScopeReady] = React147__default.useState(false);
89398
+ const [shiftResolutionTick, setShiftResolutionTick] = React147__default.useState(0);
89399
+ const hasAutoInitializedScopeRef = React147__default.useRef(false);
89400
+ const hasUserAdjustedScopeRef = React147__default.useRef(false);
89401
+ React147__default.useEffect(() => {
88824
89402
  trackCorePageView("Operations Overview", {
88825
89403
  dashboard_surface: "operations_overview"
88826
89404
  });
88827
89405
  }, []);
88828
- const currentWeekRange = React146__default.useMemo(
89406
+ const currentWeekRange = React147__default.useMemo(
88829
89407
  () => getCurrentWeekToDateRange(appTimezone),
88830
89408
  [appTimezone]
88831
89409
  );
88832
- const currentWeekDisplayRange = React146__default.useMemo(
89410
+ const currentWeekDisplayRange = React147__default.useMemo(
88833
89411
  () => getCurrentWeekFullRange(appTimezone),
88834
89412
  [appTimezone]
88835
89413
  );
88836
89414
  const isCurrentWeekToDateRange = dateRange.startKey === currentWeekRange.startKey && dateRange.endKey === currentWeekRange.endKey;
88837
- const headerDateRange = React146__default.useMemo(() => {
89415
+ const headerDateRange = React147__default.useMemo(() => {
88838
89416
  if (usesThisWeekComparison && isCurrentWeekToDateRange) {
88839
89417
  return currentWeekDisplayRange;
88840
89418
  }
88841
89419
  return dateRange;
88842
89420
  }, [currentWeekDisplayRange, dateRange, isCurrentWeekToDateRange, usesThisWeekComparison]);
88843
- const normalizedLineIds = React146__default.useMemo(
89421
+ const normalizedLineIds = React147__default.useMemo(
88844
89422
  () => Array.from(new Set(
88845
89423
  (accessibleLineIds || []).filter(Boolean).filter((lineId) => lineId !== factoryViewId)
88846
89424
  )).sort(),
88847
89425
  [accessibleLineIds, factoryViewId]
88848
89426
  );
88849
- const lineIdsKey = React146__default.useMemo(
89427
+ const lineIdsKey = React147__default.useMemo(
88850
89428
  () => normalizedLineIds.join(","),
88851
89429
  [normalizedLineIds]
88852
89430
  );
88853
- const lineOptions = React146__default.useMemo(
89431
+ const lineOptions = React147__default.useMemo(
88854
89432
  () => normalizedLineIds.map((lineId) => ({
88855
89433
  id: lineId,
88856
89434
  name: getLineDisplayName(entityConfig, lineId)
@@ -88862,7 +89440,7 @@ var PlantHeadView = () => {
88862
89440
  companyId: entityConfig.companyId,
88863
89441
  useBackend: true
88864
89442
  });
88865
- const supervisorOptions = React146__default.useMemo(
89443
+ const supervisorOptions = React147__default.useMemo(
88866
89444
  () => {
88867
89445
  const optionsById = /* @__PURE__ */ new Map();
88868
89446
  normalizedLineIds.forEach((lineId) => {
@@ -88888,7 +89466,7 @@ var PlantHeadView = () => {
88888
89466
  },
88889
89467
  [normalizedLineIds, supervisorsByLineId]
88890
89468
  );
88891
- React146__default.useEffect(() => {
89469
+ React147__default.useEffect(() => {
88892
89470
  if (selectedSupervisorId === "all") {
88893
89471
  setSelectedLineIds((previous) => {
88894
89472
  if (normalizedLineIds.length === 0) {
@@ -88914,7 +89492,7 @@ var PlantHeadView = () => {
88914
89492
  const scopedSupervisorLineIds = normalizedLineIds.filter((lineId) => supervisorLineIdSet.has(lineId));
88915
89493
  setSelectedLineIds((previous) => previous.length === scopedSupervisorLineIds.length && previous.every((lineId, index) => lineId === scopedSupervisorLineIds[index]) ? previous : scopedSupervisorLineIds);
88916
89494
  }, [lineIdsKey, normalizedLineIds, selectedSupervisorId, supervisorOptions]);
88917
- const scopedLineIds = React146__default.useMemo(
89495
+ const scopedLineIds = React147__default.useMemo(
88918
89496
  () => selectedLineIds.length > 0 ? selectedLineIds : normalizedLineIds,
88919
89497
  [normalizedLineIds, selectedLineIds]
88920
89498
  );
@@ -88922,7 +89500,7 @@ var PlantHeadView = () => {
88922
89500
  shiftConfigMap,
88923
89501
  isLoading: isShiftConfigLoading
88924
89502
  } = useMultiLineShiftConfigs(scopedLineIds, staticShiftConfig);
88925
- const shiftFilterOptions = React146__default.useMemo(() => {
89503
+ const shiftFilterOptions = React147__default.useMemo(() => {
88926
89504
  const optionsById = /* @__PURE__ */ new Map();
88927
89505
  scopedLineIds.forEach((lineId) => {
88928
89506
  const shiftConfig = shiftConfigMap.get(lineId) || staticShiftConfig;
@@ -88961,7 +89539,7 @@ var PlantHeadView = () => {
88961
89539
  ...dynamicOptions
88962
89540
  ];
88963
89541
  }, [appTimezone, scopedLineIds, shiftConfigMap, staticShiftConfig]);
88964
- React146__default.useEffect(() => {
89542
+ React147__default.useEffect(() => {
88965
89543
  if (scopedLineIds.length === 0 || isShiftConfigLoading) {
88966
89544
  return;
88967
89545
  }
@@ -88972,11 +89550,11 @@ var PlantHeadView = () => {
88972
89550
  clearInterval(intervalId);
88973
89551
  };
88974
89552
  }, [isShiftConfigLoading, scopedLineIds.length]);
88975
- const shiftResolutionNow = React146__default.useMemo(
89553
+ const shiftResolutionNow = React147__default.useMemo(
88976
89554
  () => /* @__PURE__ */ new Date(),
88977
89555
  [shiftResolutionTick]
88978
89556
  );
88979
- const earliestDayShiftStartTime = React146__default.useMemo(() => {
89557
+ const earliestDayShiftStartTime = React147__default.useMemo(() => {
88980
89558
  const candidateStarts = [];
88981
89559
  scopedLineIds.forEach((lineId) => {
88982
89560
  const shiftConfig = shiftConfigMap.get(lineId) || staticShiftConfig;
@@ -88987,7 +89565,7 @@ var PlantHeadView = () => {
88987
89565
  startTime: shift.startTime,
88988
89566
  endTime: shift.endTime
88989
89567
  });
88990
- const startMinutes = parseTimeToMinutes4(shift.startTime);
89568
+ const startMinutes = parseTimeToMinutes5(shift.startTime);
88991
89569
  if (bucket === "day" && startMinutes !== null) {
88992
89570
  candidateStarts.push(startMinutes);
88993
89571
  }
@@ -88997,7 +89575,7 @@ var PlantHeadView = () => {
88997
89575
  scopedLineIds.forEach((lineId) => {
88998
89576
  const shiftConfig = shiftConfigMap.get(lineId) || staticShiftConfig;
88999
89577
  getShiftWindowsForConfig(shiftConfig).forEach((shift) => {
89000
- const startMinutes = parseTimeToMinutes4(shift.startTime);
89578
+ const startMinutes = parseTimeToMinutes5(shift.startTime);
89001
89579
  if (startMinutes !== null) {
89002
89580
  candidateStarts.push(startMinutes);
89003
89581
  }
@@ -89012,11 +89590,11 @@ var PlantHeadView = () => {
89012
89590
  const minutes = earliestMinutes % 60;
89013
89591
  return `${hours.toString().padStart(2, "0")}:${minutes.toString().padStart(2, "0")}`;
89014
89592
  }, [appTimezone, scopedLineIds, shiftConfigMap, staticShiftConfig]);
89015
- const resolvedOperationalToday = React146__default.useMemo(
89593
+ const resolvedOperationalToday = React147__default.useMemo(
89016
89594
  () => getOperationalDate(appTimezone, shiftResolutionNow, earliestDayShiftStartTime),
89017
89595
  [appTimezone, earliestDayShiftStartTime, shiftResolutionNow]
89018
89596
  );
89019
- const activeLineShiftStates = React146__default.useMemo(() => {
89597
+ const activeLineShiftStates = React147__default.useMemo(() => {
89020
89598
  return scopedLineIds.flatMap((lineId) => {
89021
89599
  const shiftConfig = shiftConfigMap.get(lineId) || staticShiftConfig;
89022
89600
  const activeShift = getActiveShift(appTimezone, shiftConfig, shiftResolutionNow);
@@ -89046,7 +89624,7 @@ var PlantHeadView = () => {
89046
89624
  });
89047
89625
  }, [appTimezone, scopedLineIds, shiftConfigMap, shiftResolutionNow, staticShiftConfig]);
89048
89626
  const resolvedTrendMode = isInitialScopeReady ? trendMode : "all";
89049
- const hourlyWindowStartTime = React146__default.useMemo(() => {
89627
+ const hourlyWindowStartTime = React147__default.useMemo(() => {
89050
89628
  if (scopedLineIds.length === 0) {
89051
89629
  return null;
89052
89630
  }
@@ -89088,7 +89666,7 @@ var PlantHeadView = () => {
89088
89666
  startTime: shift.startTime,
89089
89667
  endTime: shift.endTime
89090
89668
  });
89091
- return bucket === "day" ? parseTimeToMinutes4(shift.startTime) : null;
89669
+ return bucket === "day" ? parseTimeToMinutes5(shift.startTime) : null;
89092
89670
  }).filter((value) => value !== null);
89093
89671
  }) : [];
89094
89672
  if (dayStartCandidates.length > 0) {
@@ -89103,12 +89681,12 @@ var PlantHeadView = () => {
89103
89681
  const minutes = earliestMinutes % 60;
89104
89682
  return `${hours.toString().padStart(2, "0")}:${minutes.toString().padStart(2, "0")}`;
89105
89683
  }, [appTimezone, resolvedTrendMode, scopedLineIds, shiftConfigMap, staticShiftConfig]);
89106
- const isShiftScopeResolved = React146__default.useMemo(
89684
+ const isShiftScopeResolved = React147__default.useMemo(
89107
89685
  () => !isShiftConfigLoading,
89108
89686
  [isShiftConfigLoading]
89109
89687
  );
89110
- const initializedTimezoneRef = React146__default.useRef(appTimezone);
89111
- React146__default.useEffect(() => {
89688
+ const initializedTimezoneRef = React147__default.useRef(appTimezone);
89689
+ React147__default.useEffect(() => {
89112
89690
  if (initializedTimezoneRef.current === appTimezone) return;
89113
89691
  hasAutoInitializedScopeRef.current = false;
89114
89692
  hasUserAdjustedScopeRef.current = false;
@@ -89121,7 +89699,7 @@ var PlantHeadView = () => {
89121
89699
  setIsInitialScopeReady(false);
89122
89700
  initializedTimezoneRef.current = appTimezone;
89123
89701
  }, [appTimezone, fallbackOperationalDate]);
89124
- React146__default.useEffect(() => {
89702
+ React147__default.useEffect(() => {
89125
89703
  if (hasAutoInitializedScopeRef.current || hasUserAdjustedScopeRef.current) {
89126
89704
  return;
89127
89705
  }
@@ -89146,7 +89724,7 @@ var PlantHeadView = () => {
89146
89724
  hasAutoInitializedScopeRef.current = true;
89147
89725
  setIsInitialScopeReady(true);
89148
89726
  }, [fallbackOperationalDate, isShiftScopeResolved, resolvedOperationalToday, scopedLineIds.length]);
89149
- const handleDateRangeChange = React146__default.useCallback((range, meta) => {
89727
+ const handleDateRangeChange = React147__default.useCallback((range, meta) => {
89150
89728
  hasUserAdjustedScopeRef.current = true;
89151
89729
  setIsInitialScopeReady(true);
89152
89730
  trackCoreEvent("Operations Overview Date Range Changed", {
@@ -89164,12 +89742,12 @@ var PlantHeadView = () => {
89164
89742
  return previous;
89165
89743
  });
89166
89744
  }, []);
89167
- const handleTrendModeChange = React146__default.useCallback((mode) => {
89745
+ const handleTrendModeChange = React147__default.useCallback((mode) => {
89168
89746
  hasUserAdjustedScopeRef.current = true;
89169
89747
  setIsInitialScopeReady(true);
89170
89748
  setTrendMode(mode);
89171
89749
  }, []);
89172
- const handleSelectedLineIdsChange = React146__default.useCallback((lineIds) => {
89750
+ const handleSelectedLineIdsChange = React147__default.useCallback((lineIds) => {
89173
89751
  setSelectedSupervisorId("all");
89174
89752
  if (normalizedLineIds.length === 0) {
89175
89753
  setSelectedLineIds([]);
@@ -89180,10 +89758,10 @@ var PlantHeadView = () => {
89180
89758
  const next = normalizedLineIds.filter((lineId) => selectedSet.has(lineId));
89181
89759
  setSelectedLineIds(next.length > 0 ? next : normalizedLineIds);
89182
89760
  }, [normalizedLineIds]);
89183
- const handleSelectedSupervisorIdChange = React146__default.useCallback((supervisorId) => {
89761
+ const handleSelectedSupervisorIdChange = React147__default.useCallback((supervisorId) => {
89184
89762
  setSelectedSupervisorId(supervisorId);
89185
89763
  }, []);
89186
- const buildLineMonthlyHistoryUrl = React146__default.useCallback((lineId) => {
89764
+ const buildLineMonthlyHistoryUrl = React147__default.useCallback((lineId) => {
89187
89765
  const rangeStartDate = parseDateKeyToDate(dateRange.startKey);
89188
89766
  const params = new URLSearchParams();
89189
89767
  params.set("tab", "monthly_history");
@@ -89193,15 +89771,15 @@ var PlantHeadView = () => {
89193
89771
  params.set("rangeEnd", dateRange.endKey);
89194
89772
  return `/kpis/${lineId}?${params.toString()}`;
89195
89773
  }, [dateRange.endKey, dateRange.startKey]);
89196
- const handleViewAllPoorestPerformers = React146__default.useCallback(() => {
89774
+ const handleViewAllPoorestPerformers = React147__default.useCallback(() => {
89197
89775
  trackCoreEvent("Operations Overview View All Clicked", { section: "poorest_performers" });
89198
89776
  navigate("/kpis?tab=leaderboard");
89199
89777
  }, [navigate]);
89200
- const handleViewAllImprovements = React146__default.useCallback(() => {
89778
+ const handleViewAllImprovements = React147__default.useCallback(() => {
89201
89779
  trackCoreEvent("Operations Overview View All Clicked", { section: "improvements" });
89202
89780
  navigate("/improvement-center");
89203
89781
  }, [navigate]);
89204
- const handleOpenImprovement = React146__default.useCallback((item) => {
89782
+ const handleOpenImprovement = React147__default.useCallback((item) => {
89205
89783
  trackCoreEvent("Operations Overview Improvement Clicked", {
89206
89784
  issue_id: item.issueId,
89207
89785
  issue_number: item.issueNumber,
@@ -89212,13 +89790,13 @@ var PlantHeadView = () => {
89212
89790
  });
89213
89791
  navigate(`/improvement-center?${params.toString()}`);
89214
89792
  }, [navigate]);
89215
- const comparisonStrategy = React146__default.useMemo(() => {
89793
+ const comparisonStrategy = React147__default.useMemo(() => {
89216
89794
  if (usesThisWeekComparison && isCurrentWeekToDateRange) {
89217
89795
  return "previous_full_week";
89218
89796
  }
89219
89797
  return void 0;
89220
89798
  }, [isCurrentWeekToDateRange, usesThisWeekComparison]);
89221
- const effectiveDateRange = React146__default.useMemo(() => {
89799
+ const effectiveDateRange = React147__default.useMemo(() => {
89222
89800
  if (isInitialScopeReady) {
89223
89801
  return dateRange;
89224
89802
  }
@@ -89228,11 +89806,11 @@ var PlantHeadView = () => {
89228
89806
  endKey: nextStartKey
89229
89807
  };
89230
89808
  }, [dateRange, fallbackOperationalDate, isInitialScopeReady, resolvedOperationalToday]);
89231
- const effectiveTrendMode = React146__default.useMemo(
89809
+ const effectiveTrendMode = React147__default.useMemo(
89232
89810
  () => resolvedTrendMode,
89233
89811
  [resolvedTrendMode]
89234
89812
  );
89235
- const hasActiveSelectedShiftLine = React146__default.useMemo(
89813
+ const hasActiveSelectedShiftLine = React147__default.useMemo(
89236
89814
  () => activeLineShiftStates.some((shift) => {
89237
89815
  if (shift.date !== resolvedOperationalToday) return false;
89238
89816
  if (effectiveTrendMode === "all") return true;
@@ -89244,7 +89822,7 @@ var PlantHeadView = () => {
89244
89822
  }),
89245
89823
  [activeLineShiftStates, effectiveTrendMode, resolvedOperationalToday]
89246
89824
  );
89247
- const activeLiveShiftName = React146__default.useMemo(
89825
+ const activeLiveShiftName = React147__default.useMemo(
89248
89826
  () => {
89249
89827
  if (effectiveTrendMode === "all") return null;
89250
89828
  const matchingShift = activeLineShiftStates.find((shift) => {
@@ -89259,17 +89837,17 @@ var PlantHeadView = () => {
89259
89837
  },
89260
89838
  [activeLineShiftStates, effectiveTrendMode, resolvedOperationalToday]
89261
89839
  );
89262
- const hourlyLabelStartTime = React146__default.useMemo(() => {
89840
+ const hourlyLabelStartTime = React147__default.useMemo(() => {
89263
89841
  if (scopedLineIds.length === 0) {
89264
89842
  return null;
89265
89843
  }
89266
89844
  return hourlyWindowStartTime;
89267
89845
  }, [hourlyWindowStartTime, scopedLineIds.length]);
89268
- const isSingleDayScope = React146__default.useMemo(
89846
+ const isSingleDayScope = React147__default.useMemo(
89269
89847
  () => effectiveDateRange.startKey === effectiveDateRange.endKey,
89270
89848
  [effectiveDateRange.endKey, effectiveDateRange.startKey]
89271
89849
  );
89272
- const isLiveScope = React146__default.useMemo(
89850
+ const isLiveScope = React147__default.useMemo(
89273
89851
  () => isSingleDayScope && effectiveDateRange.startKey === resolvedOperationalToday && hasActiveSelectedShiftLine,
89274
89852
  [
89275
89853
  effectiveDateRange.startKey,
@@ -89279,7 +89857,7 @@ var PlantHeadView = () => {
89279
89857
  resolvedOperationalToday
89280
89858
  ]
89281
89859
  );
89282
- const handleOpenLineDetails = React146__default.useCallback((line) => {
89860
+ const handleOpenLineDetails = React147__default.useCallback((line) => {
89283
89861
  trackCoreEvent("Operations Overview Line Clicked", {
89284
89862
  line_id: line.rowType === "line" ? line.id : null,
89285
89863
  line_name: line.name,
@@ -90103,4 +90681,4 @@ var RecentFlowSnapshotGrid = ({
90103
90681
  );
90104
90682
  };
90105
90683
 
90106
- export { ACTION_FAMILIES, ACTION_NAMES, AIAgentView_default as AIAgentView, AcceptInvite, AcceptInviteView_default as AcceptInviteView, AdvancedFilterDialog, AdvancedFilterPanel, AudioService, AuthCallback, AuthCallbackView_default as AuthCallbackView, AuthProvider, AuthService, AuthenticatedBottleneckClipsView, AuthenticatedFactoryView, AuthenticatedHelpView, AuthenticatedHomeView, AuthenticatedShiftsView, AuthenticatedTargetsView, AuthenticatedTicketsView, AuthenticatedWorkspaceHealthView, AvatarUpload, AxelNotificationPopup, AxelOrb, BackButton, BackButtonMinimal, BarChart, BaseHistoryCalendar, BottleneckClipsModal, BottleneckClipsView_default as BottleneckClipsView, BottlenecksContent, BreakNotificationPopup, CachePrefetchStatus, Card2 as Card, CardContent2 as CardContent, CardDescription2 as CardDescription, CardFooter2 as CardFooter, CardHeader2 as CardHeader, CardTitle2 as CardTitle, ChangeRoleDialog, ClipFilterProvider, ClipsCostView_default as ClipsCostView, CompactWorkspaceHealthCard, ConfirmRemoveUserDialog, CongratulationsOverlay, CroppedHlsVideoPlayer, CroppedVideoPlayer, CycleTimeChart, CycleTimeOverTimeChart, DEFAULT_ANALYTICS_CONFIG, DEFAULT_AUTH_CONFIG, DEFAULT_CONFIG, DEFAULT_DATABASE_CONFIG, DEFAULT_DATE_TIME_CONFIG, DEFAULT_ENDPOINTS_CONFIG, DEFAULT_ENTITY_CONFIG, DEFAULT_HOME_VIEW_CONFIG, DEFAULT_MAP_VIEW_CONFIG, DEFAULT_SHIFT_CONFIG, DEFAULT_SHIFT_DATA, DEFAULT_THEME_CONFIG, DEFAULT_VIDEO_CONFIG, DEFAULT_WORKSPACE_CONFIG, DEFAULT_WORKSPACE_POSITIONS, DashboardHeader, DashboardLayout, DashboardOverridesProvider, DashboardProvider, DateDisplay_default as DateDisplay, DateTimeDisplay, DebugAuth, DebugAuthView_default as DebugAuthView, DetailedHealthStatus, DiagnosisVideoModal, EFFICIENCY_ON_TRACK_THRESHOLD, EmptyStateMessage, EncouragementOverlay, FactoryAssignmentDropdown, FactoryView_default as FactoryView, FileManagerFilters, FilterDialogTrigger, FirstTimeLoginDebug, FirstTimeLoginHandler, FittingTitle, GaugeChart, GridComponentsPlaceholder, HamburgerButton, Header, HealthDateShiftSelector, HealthStatusGrid, HealthStatusIndicator, HelpView_default as HelpView, HlsVideoPlayer, HomeView_default as HomeView, HourlyOutputChart2 as HourlyOutputChart, HourlyUptimeChart, ISTTimer_default as ISTTimer, IdleTimeVlmConfigProvider, ImprovementCenterView_default as ImprovementCenterView, InlineEditableText, InteractiveOnboardingTour, InvitationService, InvitationsTable, InviteUserDialog, KPICard, KPIDetailView_default as KPIDetailView, KPIGrid, KPIHeader, KPISection, KPI_SIGNAL_LABELS, KPIsOverviewView_default as KPIsOverviewView, LINE_1_UUID, LINE_2_UUID, LargeOutputProgressChart, LeaderboardDetailView_default as LeaderboardDetailView, Legend5 as Legend, LineAssignmentDropdown, LineChart, LineHistoryCalendar, LineMonthlyHistory, LineMonthlyPdfGenerator, LineOvertakeNotificationManager, LinePdfExportButton, LinePdfGenerator, LineWhatsAppShareButton, LinesService, LiveTimer, LoadingInline, LoadingOverlay_default as LoadingOverlay, LoadingPage_default as LoadingPage, LoadingSkeleton, LoadingState, LoginPage, LoginView_default as LoginView, Logo, MainLayout, MapGridView, MetricCard_default as MetricCard, MinimalOnboardingPopup, MobileMenuProvider, NewClipsNotification, NoWorkspaceData, OnboardingDemo, OnboardingTour, OptifyeAgentClient, OptifyeLogoLoader_default as OptifyeLogoLoader, OutputProgressChart, PageHeader, PieChart4 as PieChart, PlantHeadView_default as PlantHeadView, PlayPauseIndicator, PrefetchConfigurationError, PrefetchError, PrefetchEvents, PrefetchStatus, PrefetchTimeoutError, ProductionPlanApiError, ProductionPlanView_default as ProductionPlanView, ProfileView_default as ProfileView, ROOT_DASHBOARD_EVENT_NAMES, RecentFlowSnapshotGrid, RegistryProvider, RoleBadge, S3ClipsSupabaseService as S3ClipsService, S3Service, SENTRY_HANDLED_EVENT_SESSION_LIMIT, SENTRY_HANDLED_EVENT_WINDOW_MS, SENTRY_QUOTA_STORAGE_KEY, SKUManagementView, SOPComplianceChart, SSEChatClient, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SessionTracker, SessionTrackingContext, SessionTrackingProvider, SettingsPopup, ShiftDisplay_default as ShiftDisplay, ShiftsView_default as ShiftsView, SideNavBar, SignupWithInvitation, SilentErrorBoundary, SimpleOnboardingPopup, SingleVideoStream_default as SingleVideoStream, Skeleton, SubscriptionManager, SubscriptionManagerProvider, SupabaseProvider, SupervisorDropdown_default as SupervisorDropdown, SupervisorManagementView_default as SupervisorManagementView, SupervisorService, TargetWorkspaceGrid, TargetsView_default as TargetsView, TeamManagementView_default as TeamManagementView, ThreadSidebar, TicketHistory_default as TicketHistory, TicketHistoryService, TicketsView_default as TicketsView, TimeDisplay_default as TimeDisplay, TimePickerDropdown, Timer_default as Timer, TimezoneProvider, TimezoneService, UptimeDonutChart, UptimeLineChart, UptimeMetricCards, UserAvatar, UserManagementService, UserManagementTable, UserService, UserUsageDetailModal, UserUsageStats, VideoCard, VideoGridView, VideoPlayer, VideoPreloader, WORKSPACE_POSITIONS, WhatsAppShareButton, WorkspaceCard, WorkspaceCycleTimeMetricCards, WorkspaceDetailView_default as WorkspaceDetailView, WorkspaceDisplayNameExample, WorkspaceGrid, WorkspaceGridItem, WorkspaceHealthCard, WorkspaceHealthView_default as WorkspaceHealthView, WorkspaceHistoryCalendar, WorkspaceMetricCards, WorkspaceMetricCardsImpl, WorkspaceMonthlyDataFetcher, WorkspaceMonthlyHistory, WorkspaceMonthlyPdfGenerator, WorkspacePdfExportButton, WorkspacePdfGenerator, WorkspaceWhatsAppShareButton, actionService, addSentryBreadcrumb, aggregateKPIsFromLineMetricsRows, aggregateLineSignals, alertsService, apiUtils, areAllLinesOnSameShift, authCoreService, authOTPService, authRateLimitService, awardsService, buildDateKey, buildKPIsFromLineMetricsRow, buildKpiLineHierarchy, buildLegacyLineOvertakeEventKey, buildLineLeaderboardRows, buildLineOvertakeEventKey, buildLineSkuBreakdown, buildShiftGroupsKey, canPermissionEditProductionPlan, canRoleAccessDashboardPath, canRoleAccessTeamManagement, canRoleAssignFactories, canRoleAssignLines, canRoleChangeRole, canRoleEditProductionPlan, canRoleInviteRole, canRoleManageCompany, canRoleManageTargets, canRoleManageUsers, canRoleRemoveUser, canRoleViewClipsCost, canRoleViewUsageStats, captureHandledFrontendException, captureSentryException, captureSentryMessage, checkRateLimit2 as checkRateLimit, clearAllRateLimits2 as clearAllRateLimits, clearRateLimit2 as clearRateLimit, clearS3VideoCache, clearS3VideoFromCache, clearSentryContext, clearWorkspaceDisplayNamesCache, cn, combineLineMetricsRows, countRealSkus, createDefaultKPIs, createInvitationService, createLinesService, createSessionTracker, createStorageService, createStreamProxyHandler, createSupabaseClient, createSupervisorService, createThrottledReload, createUserManagementService, createUserService, dashboardService, deleteThread, detectLineOvertakeEvents, fetchIdleTimeReasons, fetchLineDummySkuId, fetchLineSkuCatalog, filterDataByDateKeyRange, filterRealSkuBreakdown, forceRefreshWorkspaceDisplayNames, formatAwardMonth, formatDateInZone, formatDateKeyForDisplay, formatDateTimeInZone, formatDuration2 as formatDuration, formatISTDate, formatIdleTime, formatRangeLabel, formatReasonLabel, formatRelativeTime, formatTimeInZone, fromUrlFriendlyName, getActionDisplayName, getActiveShift, getAllLineDisplayNames, getAllThreadMessages, getAllWorkspaceDisplayNamesAsync, getAllWorkspaceDisplayNamesSnapshot, getAnonClient, getAssignableRoles, getAssignmentColumnLabel, getAvailableShiftIds, getAwardBadgeType, getAwardDescription, getAwardTitle, getBrowserName, getCameraNumber, getCompanyMetricsTableName, getConfigurableShortWorkspaceDisplayName, getConfigurableWorkspaceDisplayName, getConfiguredLineIds, getCoreSessionRecordingProperties, getCoreSessionReplayUrl, getCurrentShift, getCurrentShiftForLine, getCurrentTimeInZone, getCurrentWeekFullRange, getCurrentWeekToDateRange, getDashboardHeaderTimeInZone, getDateKeyFromDate, getDateKeyFromValue, getDayDateKey, getDaysDifferenceInZone, getDefaultCameraStreamUrl, getDefaultLineId, getDefaultTabForWorkspace, getInitials, getKpiSignalLabel, getKpiSignalStatus, getLineDisplayName, getManufacturingInsights, getMetricsTablePrefix, getMonthKeyBounds, getMonthWeekRanges, getMonthlyTrendComparisonLabel, getNextUpdateInterval, getOperationalDate, getRoleAssignmentKind, getRoleDescription, getRoleLabel, getRoleMetadata, getRoleNavPaths, getS3SignedUrl, getS3VideoSrc, getShiftData, getShiftNameById, getShiftWorkDurationSeconds, getShortShiftName, getShortWorkspaceDisplayName, getShortWorkspaceDisplayNameAsync, getStoredWorkspaceMappings, getSubscriptionManager, getThreadMessages, getUniformShiftGroup, getUserThreads, getUserThreadsPaginated, getVisibleRolesForCurrentUser, getWorkspaceDisplayName, getWorkspaceDisplayNameAsync, getWorkspaceDisplayNamesMap, getWorkspaceFromUrl, getWorkspaceNavigationParams, groupLinesByShift, hasAnyShiftData, identifyCoreUser, initializeCoreMixpanel, isEfficiencyOnTrack, isFactoryScopedRole, isFullMonthRange, isIgnorableFrontendError, isLegacyConfiguration, isLoopbackHostname, isPrefetchError, isRealSku, isRecentFlowVideoGridMetricMode, isSafari, isSupervisorRole, isTransitionPeriod, isUrlPermanentlyFailed, isValidFactoryViewConfiguration, isValidLineInfoPayload, isValidPrefetchParams, isValidPrefetchStatus, isValidWorkspaceDetailedMetricsPayload, isValidWorkspaceMetricsPayload, isWipGatedVideoGridMetricMode, isWorkspaceDisplayNamesLoaded, isWorkspaceDisplayNamesLoading, lineLeaderboardService, linesService, mergeWithDefaultConfig, migrateLegacyConfiguration, normalizeActionFamily, normalizeDateKeyRange, normalizeDateKeyRangeUnbounded, normalizeRoleLevel, normalizeVideoGridMetricMode, optifyeAgentClient, parseDateKeyToDate, parseS3Uri, pickPreferredLineMetricsRow, preInitializeWorkspaceDisplayNames, preloadS3Video, preloadS3VideoUrl, preloadS3VideosUrl, preloadVideoUrl, preloadVideosUrl, productionPlanService, qualityService, realtimeService, refreshWorkspaceDisplayNames, resetCoreMixpanel, resetFailedUrl, resetSentryQuotaForTests, resetSubscriptionManager, resolveDefaultSkuId, resolveLiveSkuId, s3VideoPreloader, selectPreferredLineMetricsRow, setSentryUserContext, setSentryWorkspaceContext, shouldEnableLocalDevTestLogin, shuffleArray, simulateApiDelay, skuService, startCoreSessionRecording, stopCoreSessionRecording, storeWorkspaceMapping, streamProxyConfig, subscribeWorkspaceDisplayNames, throttledReloadDashboard, toUrlFriendlyName, trackCoreEvent, trackCorePageView, transformToChartData, updateThreadTitle, upsertWorkspaceDisplayNameInCache, useAccessControl, useActiveBreaks, useActiveLineId, useAllWorkspaceMetrics, useAnalyticsConfig, useAppTimezone, useAudioService, useAuth, useAuthConfig, useAxelNotifications, useCanSaveTargets, useClipFilter, useClipTypes, useClipTypesWithCounts, useClipsInit, useCompanyClipsCost, useCompanyFastSlowClipFiltersEnabled, useCompanyHasVlmEnabledLine, useCompanyUsersUsage, useComponentOverride, useCustomConfig, useDashboardConfig, useDashboardMetrics, useDatabaseConfig, useDateFormatter, useDateTimeConfig, useDynamicShiftConfig, useEndpointsConfig, useEntityConfig, useFactoryOverviewMetrics, useFeatureFlags, useFormatNumber, useHasLineAccess, useHideMobileHeader, useHistoricWorkspaceMetrics, useHlsStream, useHlsStreamWithCropping, useHookOverride, useHourEndTimer, useHourlyTargetAchievements, useHourlyTargetMisses, useIdleTimeClipClassifications, useIdleTimeReasons, useIdleTimeVlmConfig, useKpiTrends, useLeaderboardMetrics, useLineDetailedMetrics, useLineKPIs, useLineMetrics, useLineShiftConfig, useLineSupervisor, useLineWorkspaceMetrics, useLines, useMessages, useMetrics, useMobileMenu, useMonthlyTrend, useMultiLineShiftConfigs, useNavigation, useOperationalShiftKey, useOptionalSupabase, useOverrides, usePageOverride, usePrefetchClipCounts, useRealtimeLineMetrics, useRegistry, useSKUs, useSessionKeepAlive, useSessionTracking, useSessionTrackingContext, useShiftConfig, useShiftGroups, useShifts, useSubscriptionManager, useSubscriptionManagerSafe, useSupabase, useSupabaseClient, useSupervisorsByLineIds, useTargets, useTeamManagementPermissions, useTheme, useThemeConfig, useThreads, useTicketHistory, useTimezoneContext, useUserLineAccess, useUserUsage, useVideoConfig, useWorkspaceConfig, useWorkspaceDetailedMetrics, useWorkspaceDisplayName, useWorkspaceDisplayNames, useWorkspaceDisplayNamesMap, useWorkspaceHealthById, useWorkspaceHealthLastSeen, useWorkspaceHealthStatus, useWorkspaceMetrics, useWorkspaceNavigation, useWorkspaceOperators, useWorkspaceUptimeTimeline, useWorkspaceVideoStreams, userService, videoPrefetchManager, videoPreloader, weeklyTopPerformerService, whatsappService, withAccessControl, withAuth, withRegistry, withTimezone, workspaceHealthService, workspaceService };
90684
+ export { ACTION_FAMILIES, ACTION_NAMES, AIAgentView_default as AIAgentView, AcceptInvite, AcceptInviteView_default as AcceptInviteView, AdvancedFilterDialog, AdvancedFilterPanel, AudioService, AuthCallback, AuthCallbackView_default as AuthCallbackView, AuthProvider, AuthService, AuthenticatedBottleneckClipsView, AuthenticatedFactoryView, AuthenticatedHelpView, AuthenticatedHomeView, AuthenticatedShiftsView, AuthenticatedTargetsView, AuthenticatedTicketsView, AuthenticatedWorkspaceHealthView, AvatarUpload, AxelNotificationPopup, AxelOrb, BackButton, BackButtonMinimal, BarChart, BaseHistoryCalendar, BottleneckClipsModal, BottleneckClipsView_default as BottleneckClipsView, BottlenecksContent, BreakNotificationPopup, CachePrefetchStatus, Card2 as Card, CardContent2 as CardContent, CardDescription2 as CardDescription, CardFooter2 as CardFooter, CardHeader2 as CardHeader, CardTitle2 as CardTitle, ChangeRoleDialog, ClipFilterProvider, ClipsCostView_default as ClipsCostView, CompactWorkspaceHealthCard, ConfirmRemoveUserDialog, CongratulationsOverlay, CroppedHlsVideoPlayer, CroppedVideoPlayer, CycleTimeChart, CycleTimeOverTimeChart, DEFAULT_ANALYTICS_CONFIG, DEFAULT_AUTH_CONFIG, DEFAULT_CONFIG, DEFAULT_DATABASE_CONFIG, DEFAULT_DATE_TIME_CONFIG, DEFAULT_ENDPOINTS_CONFIG, DEFAULT_ENTITY_CONFIG, DEFAULT_HOME_VIEW_CONFIG, DEFAULT_MAP_VIEW_CONFIG, DEFAULT_SHIFT_CONFIG, DEFAULT_SHIFT_DATA, DEFAULT_THEME_CONFIG, DEFAULT_VIDEO_CONFIG, DEFAULT_WORKSPACE_CONFIG, DEFAULT_WORKSPACE_POSITIONS, DashboardHeader, DashboardLayout, DashboardOverridesProvider, DashboardProvider, DateDisplay_default as DateDisplay, DateTimeDisplay, DebugAuth, DebugAuthView_default as DebugAuthView, DetailedHealthStatus, DiagnosisVideoModal, EFFICIENCY_ON_TRACK_THRESHOLD, EmptyStateMessage, EncouragementOverlay, FactoryAssignmentDropdown, FactoryView_default as FactoryView, FileManagerFilters, FilterDialogTrigger, FirstTimeLoginDebug, FirstTimeLoginHandler, FittingTitle, GaugeChart, GridComponentsPlaceholder, HamburgerButton, Header, HealthDateShiftSelector, HealthStatusGrid, HealthStatusIndicator, HelpView_default as HelpView, HlsVideoPlayer, HomeView_default as HomeView, HourlyOutputChart2 as HourlyOutputChart, HourlyUptimeChart, ISTTimer_default as ISTTimer, IdleTimeVlmConfigProvider, ImprovementCenterView_default as ImprovementCenterView, InlineEditableText, InteractiveOnboardingTour, InvitationService, InvitationsTable, InviteUserDialog, KPICard, KPIDetailView_default as KPIDetailView, KPIGrid, KPIHeader, KPISection, KPI_SIGNAL_LABELS, KPIsOverviewView_default as KPIsOverviewView, LINE_1_UUID, LINE_2_UUID, LargeOutputProgressChart, LeaderboardDetailView_default as LeaderboardDetailView, Legend5 as Legend, LineAssignmentDropdown, LineChart, LineHistoryCalendar, LineMonthlyHistory, LineMonthlyPdfGenerator, LineOvertakeNotificationManager, LinePdfExportButton, LinePdfGenerator, LineWhatsAppShareButton, LinesService, LiveTimer, LoadingInline, LoadingOverlay_default as LoadingOverlay, LoadingPage_default as LoadingPage, LoadingSkeleton, LoadingState, LoginPage, LoginView_default as LoginView, Logo, MainLayout, MapGridView, MetricCard_default as MetricCard, MinimalOnboardingPopup, MobileMenuProvider, NewClipsNotification, NoWorkspaceData, OnboardingDemo, OnboardingTour, OptifyeAgentClient, OptifyeLogoLoader_default as OptifyeLogoLoader, OutputProgressChart, PageHeader, PieChart4 as PieChart, PlantHeadView_default as PlantHeadView, PlayPauseIndicator, PrefetchConfigurationError, PrefetchError, PrefetchEvents, PrefetchStatus, PrefetchTimeoutError, ProductionPlanApiError, ProductionPlanView_default as ProductionPlanView, ProfileView_default as ProfileView, ROOT_DASHBOARD_EVENT_NAMES, RecentFlowSnapshotGrid, RegistryProvider, RoleBadge, S3ClipsSupabaseService as S3ClipsService, S3Service, SENTRY_HANDLED_EVENT_SESSION_LIMIT, SENTRY_HANDLED_EVENT_WINDOW_MS, SENTRY_QUOTA_STORAGE_KEY, SKUManagementView, SOPComplianceChart, SSEChatClient, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SessionTracker, SessionTrackingContext, SessionTrackingProvider, SettingsPopup, ShiftDisplay_default as ShiftDisplay, ShiftsView_default as ShiftsView, SideNavBar, SignupWithInvitation, SilentErrorBoundary, SimpleOnboardingPopup, SingleVideoStream_default as SingleVideoStream, Skeleton, SubscriptionManager, SubscriptionManagerProvider, SupabaseProvider, SupervisorDropdown_default as SupervisorDropdown, SupervisorManagementView_default as SupervisorManagementView, SupervisorService, TargetWorkspaceGrid, TargetsView_default as TargetsView, TeamManagementView_default as TeamManagementView, ThreadSidebar, TicketHistory_default as TicketHistory, TicketHistoryService, TicketsView_default as TicketsView, TimeDisplay_default as TimeDisplay, TimePickerDropdown, Timer_default as Timer, TimezoneProvider, TimezoneService, UptimeDonutChart, UptimeLineChart, UptimeMetricCards, UserAvatar, UserManagementService, UserManagementTable, UserService, UserUsageDetailModal, UserUsageStats, VideoCard, VideoGridView, VideoPlayer, VideoPreloader, WORKSPACE_POSITIONS, WhatsAppShareButton, WorkspaceCard, WorkspaceCycleTimeMetricCards, WorkspaceDetailView_default as WorkspaceDetailView, WorkspaceDisplayNameExample, WorkspaceGrid, WorkspaceGridItem, WorkspaceHealthCard, WorkspaceHealthView_default as WorkspaceHealthView, WorkspaceHistoryCalendar, WorkspaceMetricCards, WorkspaceMetricCardsImpl, WorkspaceMonthlyDataFetcher, WorkspaceMonthlyHistory, WorkspaceMonthlyPdfGenerator, WorkspacePdfExportButton, WorkspacePdfGenerator, WorkspaceWhatsAppShareButton, actionService, addSentryBreadcrumb, aggregateKPIsFromLineMetricsRows, aggregateLineSignals, alertsService, apiUtils, areAllLinesOnSameShift, authCoreService, authOTPService, authRateLimitService, awardsService, buildDateKey, buildKPIsFromLineMetricsRow, buildKpiLineHierarchy, buildLegacyLineOvertakeEventKey, buildLineLeaderboardRows, buildLineOvertakeEventKey, buildLineSkuBreakdown, buildShiftGroupsKey, canPermissionEditProductionPlan, canRoleAccessDashboardPath, canRoleAccessTeamManagement, canRoleAssignFactories, canRoleAssignLines, canRoleChangeRole, canRoleEditProductionPlan, canRoleInviteRole, canRoleManageCompany, canRoleManageTargets, canRoleManageUsers, canRoleRemoveUser, canRoleViewClipsCost, canRoleViewUsageStats, captureHandledFrontendException, captureSentryException, captureSentryMessage, checkRateLimit2 as checkRateLimit, clearAllRateLimits2 as clearAllRateLimits, clearRateLimit2 as clearRateLimit, clearS3VideoCache, clearS3VideoFromCache, clearSentryContext, clearWorkspaceDisplayNamesCache, cn, combineLineMetricsRows, countRealSkus, createDefaultKPIs, createInvitationService, createLinesService, createSessionTracker, createStorageService, createStreamProxyHandler, createSupabaseClient, createSupervisorService, createThrottledReload, createUserManagementService, createUserService, dashboardService, deleteThread, detectLineOvertakeEvents, fetchIdleTimeReasons, fetchLineDummySkuId, fetchLineSkuCatalog, filterDataByDateKeyRange, filterRealSkuBreakdown, forceRefreshWorkspaceDisplayNames, formatAwardMonth, formatDateInZone, formatDateKeyForDisplay, formatDateTimeInZone, formatDuration2 as formatDuration, formatISTDate, formatIdleTime, formatRangeLabel, formatReasonLabel, formatRelativeTime, formatTimeInZone, fromUrlFriendlyName, getActionDisplayName, getActiveShift, getAllLineDisplayNames, getAllThreadMessages, getAllWorkspaceDisplayNamesAsync, getAllWorkspaceDisplayNamesSnapshot, getAnonClient, getAssignableRoles, getAssignmentColumnLabel, getAvailableShiftIds, getAwardBadgeType, getAwardDescription, getAwardTitle, getBrowserName, getCameraNumber, getCompanyMetricsTableName, getConfigurableShortWorkspaceDisplayName, getConfigurableWorkspaceDisplayName, getConfiguredLineIds, getCoreSessionRecordingProperties, getCoreSessionReplayUrl, getCurrentShift, getCurrentShiftForLine, getCurrentTimeInZone, getCurrentWeekFullRange, getCurrentWeekToDateRange, getDashboardHeaderTimeInZone, getDateKeyFromDate, getDateKeyFromValue, getDayDateKey, getDaysDifferenceInZone, getDefaultCameraStreamUrl, getDefaultLineId, getDefaultTabForWorkspace, getInitials, getKpiSignalLabel, getKpiSignalStatus, getLineDisplayName, getManufacturingInsights, getMetricsTablePrefix, getMonthKeyBounds, getMonthWeekRanges, getMonthlyTrendComparisonLabel, getNextUpdateInterval, getOperationalDate, getRoleAssignmentKind, getRoleDescription, getRoleLabel, getRoleMetadata, getRoleNavPaths, getS3SignedUrl, getS3VideoSrc, getShiftData, getShiftNameById, getShiftWorkDurationSeconds, getShortShiftName, getShortWorkspaceDisplayName, getShortWorkspaceDisplayNameAsync, getStoredWorkspaceMappings, getSubscriptionManager, getThreadMessages, getUniformShiftGroup, getUserThreads, getUserThreadsPaginated, getVisibleRolesForCurrentUser, getWorkspaceDisplayName, getWorkspaceDisplayNameAsync, getWorkspaceDisplayNamesMap, getWorkspaceFromUrl, getWorkspaceNavigationParams, groupLinesByShift, hasAnyShiftData, identifyCoreUser, initializeCoreMixpanel, isEfficiencyOnTrack, isFactoryScopedRole, isFullMonthRange, isIgnorableFrontendError, isLegacyConfiguration, isLoopbackHostname, isPrefetchError, isRealSku, isRecentFlowVideoGridMetricMode, isSafari, isSupervisorRole, isTransitionPeriod, isUrlPermanentlyFailed, isValidFactoryViewConfiguration, isValidLineInfoPayload, isValidPrefetchParams, isValidPrefetchStatus, isValidWorkspaceDetailedMetricsPayload, isValidWorkspaceMetricsPayload, isWipGatedVideoGridMetricMode, isWorkspaceDisplayNamesLoaded, isWorkspaceDisplayNamesLoading, lineLeaderboardService, linesService, mergeWithDefaultConfig, migrateLegacyConfiguration, normalizeActionFamily, normalizeDateKeyRange, normalizeDateKeyRangeUnbounded, normalizeRoleLevel, normalizeVideoGridMetricMode, optifyeAgentClient, parseDateKeyToDate, parseS3Uri, pickPreferredLineMetricsRow, preInitializeWorkspaceDisplayNames, preloadS3Video, preloadS3VideoUrl, preloadS3VideosUrl, preloadVideoUrl, preloadVideosUrl, productionPlanService, qualityService, realtimeService, refreshWorkspaceDisplayNames, resetCoreMixpanel, resetFailedUrl, resetSentryQuotaForTests, resetSubscriptionManager, resolveDefaultSkuId, resolveLiveSkuId, s3VideoPreloader, selectPreferredLineMetricsRow, setSentryUserContext, setSentryWorkspaceContext, shouldEnableLocalDevTestLogin, shuffleArray, simulateApiDelay, skuService, startCoreSessionRecording, stopCoreSessionRecording, storeWorkspaceMapping, streamProxyConfig, subscribeWorkspaceDisplayNames, throttledReloadDashboard, toUrlFriendlyName, trackCoreEvent, trackCorePageView, transformToChartData, updateThreadTitle, upsertWorkspaceDisplayNameInCache, useAccessControl, useActiveBreaks, useActiveLineId, useAllWorkspaceMetrics, useAnalyticsConfig, useAppTimezone, useAudioService, useAuth, useAuthConfig, useAxelNotifications, useCanSaveTargets, useClipFilter, useClipTypes, useClipTypesWithCounts, useClipsInit, useCompanyClipsCost, useCompanyFastSlowClipFiltersEnabled, useCompanyHasVlmEnabledLine, useCompanyUsersUsage, useComponentOverride, useCustomConfig, useDashboardConfig, useDashboardMetrics, useDatabaseConfig, useDateFormatter, useDateTimeConfig, useDynamicShiftConfig, useEndpointsConfig, useEntityConfig, useFactoryOverviewMetrics, useFeatureFlags, useFormatNumber, useHasLineAccess, useHideMobileHeader, useHistoricWorkspaceMetrics, useHlsStream, useHlsStreamWithCropping, useHookOverride, useHourEndTimer, useHourlyTargetAchievements, useHourlyTargetMisses, useIdleTimeClipClassifications, useIdleTimeReasons, useIdleTimeVlmConfig, useKpiTrends, useLeaderboardMetrics, useLineDetailedMetrics, useLineKPIs, useLineMetrics, useLineShiftConfig, useLineSupervisor, useLineWorkspaceMetrics, useLines, useMessages, useMetrics, useMobileMenu, useMonthlyTrend, useMultiLineShiftConfigs, useNavigation, useOperationalShiftKey, useOptionalSupabase, useOverrides, usePageOverride, usePrefetchClipCounts, useRealtimeLineMetrics, useRegistry, useSKUs, useSessionKeepAlive, useSessionTracking, useSessionTrackingContext, useShiftConfig, useShiftGroups, useShifts, useSubscriptionManager, useSubscriptionManagerSafe, useSupabase, useSupabaseClient, useSupervisorsByLineIds, useTargets, useTeamManagementPermissions, useTheme, useThemeConfig, useThreads, useTicketHistory, useTimezoneContext, useUserLineAccess, useUserUsage, useVideoConfig, useWorkspaceConfig, useWorkspaceDetailedMetrics, useWorkspaceDisplayName, useWorkspaceDisplayNames, useWorkspaceDisplayNamesMap, useWorkspaceHealthById, useWorkspaceHealthLastSeen, useWorkspaceHealthStatus, useWorkspaceHourSummary, useWorkspaceMetrics, useWorkspaceNavigation, useWorkspaceOperators, useWorkspaceUptimeTimeline, useWorkspaceVideoStreams, userService, videoPrefetchManager, videoPreloader, weeklyTopPerformerService, whatsappService, withAccessControl, withAuth, withRegistry, withTimezone, workspaceHealthService, workspaceService };