@optifye/dashboard-core 6.10.33 → 6.10.35

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,5 +1,5 @@
1
- import * as React25 from 'react';
2
- import React25__default, { createContext, useRef, useCallback, useState, useMemo, useEffect, forwardRef, useImperativeHandle, useLayoutEffect, memo as memo$1, useContext, useId, Children, isValidElement, useInsertionEffect, Fragment as Fragment$1, createElement, Component } from 'react';
1
+ import * as React26 from 'react';
2
+ import React26__default, { createContext, useRef, useCallback, useState, useMemo, useEffect, forwardRef, useImperativeHandle, useLayoutEffect, memo as memo$1, useContext, useId, Children, isValidElement, useInsertionEffect, Fragment as Fragment$1, createElement, Component } from 'react';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import { useRouter } from 'next/router';
5
5
  import { fromZonedTime, toZonedTime, formatInTimeZone } from 'date-fns-tz';
@@ -328,14 +328,82 @@ var _getDashboardConfigInstance = () => {
328
328
  }
329
329
  return dashboardConfigInstance;
330
330
  };
331
- var DashboardConfigContext = React25.createContext(void 0);
331
+ var STORAGE_PREFIX = "optifye_idle_time_vlm_by_line";
332
+ var STORAGE_VERSION = 1;
333
+ var parseStoredMap = (raw) => {
334
+ try {
335
+ const parsed = JSON.parse(raw);
336
+ const mapCandidate = parsed?.idleTimeVlmByLine ?? parsed;
337
+ if (!mapCandidate || typeof mapCandidate !== "object" || Array.isArray(mapCandidate)) {
338
+ return null;
339
+ }
340
+ const normalized = {};
341
+ Object.entries(mapCandidate).forEach(([key, value]) => {
342
+ if (key) {
343
+ normalized[key] = Boolean(value);
344
+ }
345
+ });
346
+ return normalized;
347
+ } catch {
348
+ return null;
349
+ }
350
+ };
351
+ var buildStorageKey = (companyId) => companyId ? `${STORAGE_PREFIX}:${companyId}` : STORAGE_PREFIX;
352
+ var IdleTimeVlmConfigContext = createContext(void 0);
353
+ var IdleTimeVlmConfigProvider = ({ children }) => {
354
+ const { companyId } = useEntityConfig();
355
+ const [idleTimeVlmByLine, setIdleTimeVlmByLine] = useState({});
356
+ const [isHydrated, setIsHydrated] = useState(false);
357
+ const storageKey = useMemo(() => buildStorageKey(companyId), [companyId]);
358
+ useEffect(() => {
359
+ if (typeof window === "undefined") return;
360
+ const raw = localStorage.getItem(storageKey);
361
+ const parsed = raw ? parseStoredMap(raw) : null;
362
+ setIdleTimeVlmByLine(parsed || {});
363
+ setIsHydrated(true);
364
+ }, [storageKey]);
365
+ const persist = useCallback((map) => {
366
+ if (typeof window === "undefined") return;
367
+ const payload = {
368
+ v: STORAGE_VERSION,
369
+ updatedAt: Date.now(),
370
+ idleTimeVlmByLine: map
371
+ };
372
+ localStorage.setItem(storageKey, JSON.stringify(payload));
373
+ }, [storageKey]);
374
+ const hydrateFromBackend = useCallback((lineMap) => {
375
+ if (!lineMap || Object.keys(lineMap).length === 0) {
376
+ setIsHydrated(true);
377
+ return;
378
+ }
379
+ setIdleTimeVlmByLine((prev) => {
380
+ const merged = { ...prev, ...lineMap };
381
+ persist(merged);
382
+ return merged;
383
+ });
384
+ setIsHydrated(true);
385
+ }, [persist]);
386
+ const isIdleTimeVlmEnabled = useCallback((lineId) => {
387
+ if (!lineId) return false;
388
+ return Boolean(idleTimeVlmByLine[lineId]);
389
+ }, [idleTimeVlmByLine]);
390
+ return /* @__PURE__ */ jsx(IdleTimeVlmConfigContext.Provider, { value: { idleTimeVlmByLine, isHydrated, hydrateFromBackend, isIdleTimeVlmEnabled }, children });
391
+ };
392
+ var useIdleTimeVlmConfig = () => {
393
+ const context = useContext(IdleTimeVlmConfigContext);
394
+ if (!context) {
395
+ throw new Error("useIdleTimeVlmConfig must be used within an IdleTimeVlmConfigProvider");
396
+ }
397
+ return context;
398
+ };
399
+ var DashboardConfigContext = React26.createContext(void 0);
332
400
  var DashboardProvider = ({ config: userProvidedConfig, children }) => {
333
- const fullConfig = React25.useMemo(() => mergeWithDefaultConfig(userProvidedConfig), [userProvidedConfig]);
401
+ const fullConfig = React26.useMemo(() => mergeWithDefaultConfig(userProvidedConfig), [userProvidedConfig]);
334
402
  _setDashboardConfigInstance(fullConfig);
335
- React25.useEffect(() => {
403
+ React26.useEffect(() => {
336
404
  _setDashboardConfigInstance(fullConfig);
337
405
  }, [fullConfig]);
338
- React25.useEffect(() => {
406
+ React26.useEffect(() => {
339
407
  if (!fullConfig.theme) return;
340
408
  const styleId = "dashboard-core-theme-vars";
341
409
  let styleEl = document.getElementById(styleId);
@@ -358,10 +426,10 @@ var DashboardProvider = ({ config: userProvidedConfig, children }) => {
358
426
  styleEl && styleEl.remove();
359
427
  };
360
428
  }, [fullConfig.theme]);
361
- return /* @__PURE__ */ jsx(DashboardConfigContext.Provider, { value: fullConfig, children });
429
+ return /* @__PURE__ */ jsx(DashboardConfigContext.Provider, { value: fullConfig, children: /* @__PURE__ */ jsx(IdleTimeVlmConfigProvider, { children }) });
362
430
  };
363
431
  var useDashboardConfig = () => {
364
- const ctx = React25.useContext(DashboardConfigContext);
432
+ const ctx = React26.useContext(DashboardConfigContext);
365
433
  if (!ctx) throw new Error("useDashboardConfig must be used within a DashboardProvider");
366
434
  return ctx;
367
435
  };
@@ -3984,7 +4052,7 @@ var initializeCoreMixpanel = (token, debugOrOptions, trackPageViewArg) => {
3984
4052
  track_pageview: trackPageView ?? true,
3985
4053
  persistence: "localStorage"
3986
4054
  };
3987
- const recordSessionsPercent = sessionOpts.recordSessionsPercent ?? 20;
4055
+ const recordSessionsPercent = sessionOpts.recordSessionsPercent ?? 60;
3988
4056
  initOptions.record_sessions_percent = recordSessionsPercent;
3989
4057
  const defaultIdleTimeoutMs = 10 * 60 * 1e3;
3990
4058
  const recordIdleTimeoutMs = sessionOpts.recordIdleTimeoutMs ?? (recordSessionsPercent > 0 ? defaultIdleTimeoutMs : void 0);
@@ -7657,6 +7725,23 @@ var lineLeaderboardService = {
7657
7725
  `/api/dashboard/line-leaderboard?${searchParams.toString()}`
7658
7726
  );
7659
7727
  return data?.entries ?? [];
7728
+ },
7729
+ async getDailyLineLeaderboard(supabase, params) {
7730
+ const searchParams = new URLSearchParams();
7731
+ searchParams.set("company_id", params.companyId);
7732
+ searchParams.set("date", params.date);
7733
+ searchParams.set("shift_id", params.shiftId.toString());
7734
+ if (params.lineIds && params.lineIds.length > 0) {
7735
+ searchParams.set("line_ids", params.lineIds.join(","));
7736
+ }
7737
+ if (typeof params.limit === "number") {
7738
+ searchParams.set("limit", params.limit.toString());
7739
+ }
7740
+ const data = await fetchBackendJson(
7741
+ supabase,
7742
+ `/api/dashboard/line-leaderboard-daily?${searchParams.toString()}`
7743
+ );
7744
+ return data?.entries ?? [];
7660
7745
  }
7661
7746
  };
7662
7747
  var SupabaseContext = createContext(void 0);
@@ -8388,7 +8473,7 @@ var useMobileMenu = () => {
8388
8473
  };
8389
8474
  var useHideMobileHeader = (shouldHide = true) => {
8390
8475
  const context = useMobileMenu();
8391
- React25__default.useEffect(() => {
8476
+ React26__default.useEffect(() => {
8392
8477
  if (context && shouldHide) {
8393
8478
  context.setHideMobileHeader(true);
8394
8479
  return () => {
@@ -9017,6 +9102,7 @@ var useWorkspaceDetailedMetrics = (workspaceId, date, shiftId, options) => {
9017
9102
  const shiftConfig = options?.shiftConfig || staticShiftConfig;
9018
9103
  const workspaceConfig = useWorkspaceConfig();
9019
9104
  const supabase = useSupabase();
9105
+ const { hydrateFromBackend } = useIdleTimeVlmConfig();
9020
9106
  const [metrics2, setMetrics] = useState(null);
9021
9107
  const [isLoading, setIsLoading] = useState(true);
9022
9108
  const [error, setError] = useState(null);
@@ -9065,6 +9151,7 @@ var useWorkspaceDetailedMetrics = (workspaceId, date, shiftId, options) => {
9065
9151
  supabase,
9066
9152
  `/api/dashboard/workspace/${workspaceId}/metrics?date=${queryDate}&shift_id=${queryShiftId}&company_id=${companyId}${forceParam}`
9067
9153
  );
9154
+ hydrateFromBackend(backendData?.idle_time_vlm_by_line);
9068
9155
  let data = backendData.metrics;
9069
9156
  if (!data && !date && shiftId === void 0) {
9070
9157
  console.log("[useWorkspaceDetailedMetrics] No data found for current date/shift, attempting to find most recent data...");
@@ -9072,6 +9159,7 @@ var useWorkspaceDetailedMetrics = (workspaceId, date, shiftId, options) => {
9072
9159
  supabase,
9073
9160
  `/api/dashboard/workspace/${workspaceId}/metrics?company_id=${companyId}&latest=true${forceParam}`
9074
9161
  );
9162
+ hydrateFromBackend(fallbackData?.idle_time_vlm_by_line);
9075
9163
  data = fallbackData.metrics;
9076
9164
  if (data) {
9077
9165
  console.log(`[useWorkspaceDetailedMetrics] Found fallback data from date: ${data.date}, shift: ${data.shift_id}`);
@@ -9099,7 +9187,7 @@ var useWorkspaceDetailedMetrics = (workspaceId, date, shiftId, options) => {
9099
9187
  updateQueueRef.current = false;
9100
9188
  setIsLoading(false);
9101
9189
  }
9102
- }, [supabase, workspaceId, date, shiftId, metricsTable, defaultTimezone, shiftConfig, workspaceConfig, companyId, options?.enabled, transformMetrics]);
9190
+ }, [supabase, workspaceId, date, shiftId, metricsTable, defaultTimezone, shiftConfig, workspaceConfig, companyId, options?.enabled, transformMetrics, hydrateFromBackend]);
9103
9191
  const queueUpdate = useCallback(() => {
9104
9192
  if (!workspaceId || updateQueueRef.current) return;
9105
9193
  updateQueueRef.current = true;
@@ -10137,6 +10225,7 @@ var useDashboardMetrics = ({ onLineMetricsUpdate, lineId, userAccessibleLineIds
10137
10225
  const databaseConfig = useDatabaseConfig();
10138
10226
  const dateTimeConfig = useDateTimeConfig();
10139
10227
  const workspaceConfig = useWorkspaceConfig();
10228
+ const { hydrateFromBackend } = useIdleTimeVlmConfig();
10140
10229
  const effectiveWorkspaceConfig = workspaceConfig || DEFAULT_WORKSPACE_CONFIG;
10141
10230
  const isFactoryView = lineId === (entityConfig.factoryViewId || "factory");
10142
10231
  const { timezone: appTimezone, isLoading: isTimezoneLoading } = useTimezoneContext();
@@ -10300,6 +10389,7 @@ var useDashboardMetrics = ({ onLineMetricsUpdate, lineId, userAccessibleLineIds
10300
10389
  let allWorkspaceMetrics = [];
10301
10390
  let allLineMetrics = [];
10302
10391
  let hasFlowBuffers = false;
10392
+ let idleTimeVlmByLine = {};
10303
10393
  let efficiencyLegend;
10304
10394
  const forceParam = force ? "&force_refresh=true" : "";
10305
10395
  if (usesShiftGroups) {
@@ -10342,6 +10432,12 @@ var useDashboardMetrics = ({ onLineMetricsUpdate, lineId, userAccessibleLineIds
10342
10432
  });
10343
10433
  const results = await Promise.all(metricsPromises);
10344
10434
  hasFlowBuffers = results.some((result) => result?.metadata?.has_flow_buffers);
10435
+ results.forEach((result) => {
10436
+ const idleMap = result?.metadata?.idle_time_vlm_by_line;
10437
+ if (idleMap && typeof idleMap === "object") {
10438
+ idleTimeVlmByLine = { ...idleTimeVlmByLine, ...idleMap };
10439
+ }
10440
+ });
10345
10441
  const legendCandidate = results.find((result) => result?.efficiency_legend)?.efficiency_legend;
10346
10442
  efficiencyLegend = parseEfficiencyLegend(legendCandidate) ?? DEFAULT_EFFICIENCY_LEGEND;
10347
10443
  results.forEach((result) => {
@@ -10407,6 +10503,9 @@ var useDashboardMetrics = ({ onLineMetricsUpdate, lineId, userAccessibleLineIds
10407
10503
  allWorkspaceMetrics = backendData.workspace_metrics || [];
10408
10504
  allLineMetrics = backendData.line_metrics || [];
10409
10505
  hasFlowBuffers = Boolean(backendData?.metadata?.has_flow_buffers);
10506
+ if (backendData?.metadata?.idle_time_vlm_by_line && typeof backendData.metadata.idle_time_vlm_by_line === "object") {
10507
+ idleTimeVlmByLine = backendData.metadata.idle_time_vlm_by_line;
10508
+ }
10410
10509
  efficiencyLegend = parseEfficiencyLegend(backendData?.efficiency_legend) ?? DEFAULT_EFFICIENCY_LEGEND;
10411
10510
  }
10412
10511
  const lineMetricsById = (allLineMetrics || []).reduce(
@@ -10463,7 +10562,7 @@ var useDashboardMetrics = ({ onLineMetricsUpdate, lineId, userAccessibleLineIds
10463
10562
  const newMetricsState = {
10464
10563
  workspaceMetrics: transformedWorkspaceData,
10465
10564
  lineMetrics: allLineMetrics || [],
10466
- metadata: { hasFlowBuffers },
10565
+ metadata: { hasFlowBuffers, idleTimeVlmByLine },
10467
10566
  efficiencyLegend: efficiencyLegend ?? DEFAULT_EFFICIENCY_LEGEND
10468
10567
  };
10469
10568
  logDebug("[useDashboardMetrics] Setting metrics state:", {
@@ -10473,6 +10572,7 @@ var useDashboardMetrics = ({ onLineMetricsUpdate, lineId, userAccessibleLineIds
10473
10572
  if (abortController.signal.aborted || requestId !== activeRequestIdRef.current || requestLineId !== lineIdRef.current) {
10474
10573
  return;
10475
10574
  }
10575
+ hydrateFromBackend(idleTimeVlmByLine);
10476
10576
  setMetrics(newMetricsState);
10477
10577
  setMetricsLineId(requestLineId);
10478
10578
  lastFetchKeyRef.current = inFlightFetchKeyRef.current;
@@ -10508,7 +10608,8 @@ var useDashboardMetrics = ({ onLineMetricsUpdate, lineId, userAccessibleLineIds
10508
10608
  userAccessibleLineIds,
10509
10609
  effectiveWorkspaceConfig,
10510
10610
  shiftLoading,
10511
- isTimezoneLoading
10611
+ isTimezoneLoading,
10612
+ hydrateFromBackend
10512
10613
  ]);
10513
10614
  const fetchAllMetricsRef = useRef(fetchAllMetrics);
10514
10615
  useEffect(() => {
@@ -11224,6 +11325,7 @@ var useRealtimeLineMetrics = ({
11224
11325
  const entityConfig = useEntityConfig();
11225
11326
  const dateTimeConfig = useDateTimeConfig();
11226
11327
  const staticShiftConfig = useShiftConfig();
11328
+ const { hydrateFromBackend } = useIdleTimeVlmConfig();
11227
11329
  const timezone = useAppTimezone();
11228
11330
  const { shiftConfig: dynamicShiftConfig, isLoading: isShiftConfigLoading } = useDynamicShiftConfig(lineId);
11229
11331
  const shiftConfig = dynamicShiftConfig || staticShiftConfig;
@@ -11283,6 +11385,7 @@ var useRealtimeLineMetrics = ({
11283
11385
  shiftId,
11284
11386
  companyId
11285
11387
  });
11388
+ hydrateFromBackend(detailResponse?.idle_time_vlm_by_line);
11286
11389
  if (detailResponse.line_details) {
11287
11390
  const lineDetailsPayload = detailResponse.line_details;
11288
11391
  setLineDetails({
@@ -11341,7 +11444,7 @@ var useRealtimeLineMetrics = ({
11341
11444
  updateQueueRef.current = false;
11342
11445
  isFetchingRef.current = false;
11343
11446
  }
11344
- }, [supabase, date, shiftId, urlShiftId, onMetricsUpdate, entityConfig, dateTimeConfig.defaultTimezone, enabled, shiftConfig]);
11447
+ }, [supabase, date, shiftId, urlShiftId, onMetricsUpdate, entityConfig, dateTimeConfig.defaultTimezone, enabled, shiftConfig, hydrateFromBackend]);
11345
11448
  const queueUpdate = useCallback(() => {
11346
11449
  console.log("[useRealtimeLineMetrics] Update queued, debouncing...");
11347
11450
  if (fetchTimeoutRef.current) {
@@ -15864,7 +15967,10 @@ function useLineSupervisor(lineId) {
15864
15967
  }
15865
15968
  var useSupervisorsByLineIds = (lineIds, options) => {
15866
15969
  const supabase = useSupabase();
15970
+ const entityConfig = useEntityConfig();
15867
15971
  const enabled = options?.enabled ?? true;
15972
+ const useBackend = options?.useBackend ?? false;
15973
+ const resolvedCompanyId = options?.companyId || entityConfig.companyId;
15868
15974
  const lineIdsKey = useMemo(() => (lineIds || []).slice().sort().join(","), [lineIds]);
15869
15975
  const targetLineIdSet = useMemo(() => new Set(lineIds || []), [lineIdsKey]);
15870
15976
  const [supervisorsByLineId, setSupervisorsByLineId] = useState(/* @__PURE__ */ new Map());
@@ -15880,37 +15986,72 @@ var useSupervisorsByLineIds = (lineIds, options) => {
15880
15986
  try {
15881
15987
  setIsLoading(true);
15882
15988
  setError(null);
15883
- const { data, error: fetchError } = await supabase.from("user_roles").select("user_id, email, first_name, last_name, properties, profile_photo_url").eq("role_level", "supervisor");
15884
- if (fetchError) {
15885
- throw fetchError;
15886
- }
15887
15989
  const nextSupervisorsByLineId = /* @__PURE__ */ new Map();
15888
15990
  const nextAllSupervisorsMap = /* @__PURE__ */ new Map();
15889
- (data || []).forEach((row) => {
15890
- const assignedLineIds = row?.properties?.line_id || row?.properties?.line_ids || [];
15891
- const email = row.email || "";
15892
- let displayName;
15893
- if (row.first_name) {
15894
- displayName = row.last_name ? `${row.first_name} ${row.last_name}` : row.first_name;
15895
- } else {
15896
- displayName = (typeof email === "string" && email.includes("@") ? email.split("@")[0] : email) || email;
15897
- }
15898
- const supervisor = {
15899
- userId: row.user_id,
15900
- email,
15901
- displayName,
15902
- profilePhotoUrl: row.profile_photo_url
15903
- };
15904
- nextAllSupervisorsMap.set(supervisor.userId, supervisor);
15905
- if (!Array.isArray(assignedLineIds) || assignedLineIds.length === 0) return;
15906
- assignedLineIds.forEach((lineId) => {
15907
- if (typeof lineId !== "string") return;
15908
- if (targetLineIdSet.size > 0 && !targetLineIdSet.has(lineId)) return;
15909
- const existing = nextSupervisorsByLineId.get(lineId) || [];
15910
- existing.push(supervisor);
15911
- nextSupervisorsByLineId.set(lineId, existing);
15991
+ if (useBackend && resolvedCompanyId) {
15992
+ const searchParams = new URLSearchParams({
15993
+ company_id: resolvedCompanyId
15912
15994
  });
15913
- });
15995
+ if (lineIdsKey) {
15996
+ searchParams.set("line_ids", lineIdsKey);
15997
+ }
15998
+ const data = await fetchBackendJson(supabase, `/api/dashboard/line-supervisors?${searchParams.toString()}`);
15999
+ (data?.supervisors || []).forEach((row) => {
16000
+ const assignedLineIds = Array.isArray(row.line_ids) ? row.line_ids : [];
16001
+ if (!assignedLineIds.length) return;
16002
+ const email = row.email || "";
16003
+ let displayName;
16004
+ if (row.first_name) {
16005
+ displayName = row.last_name ? `${row.first_name} ${row.last_name}` : row.first_name;
16006
+ } else {
16007
+ displayName = (typeof email === "string" && email.includes("@") ? email.split("@")[0] : email) || email;
16008
+ }
16009
+ const supervisor = {
16010
+ userId: row.user_id,
16011
+ email,
16012
+ displayName,
16013
+ profilePhotoUrl: row.profile_photo_url ?? null
16014
+ };
16015
+ nextAllSupervisorsMap.set(supervisor.userId, supervisor);
16016
+ assignedLineIds.forEach((lineId) => {
16017
+ if (typeof lineId !== "string") return;
16018
+ if (targetLineIdSet.size > 0 && !targetLineIdSet.has(lineId)) return;
16019
+ const existing = nextSupervisorsByLineId.get(lineId) || [];
16020
+ existing.push(supervisor);
16021
+ nextSupervisorsByLineId.set(lineId, existing);
16022
+ });
16023
+ });
16024
+ } else {
16025
+ const { data, error: fetchError } = await supabase.from("user_roles").select("user_id, email, first_name, last_name, properties, profile_photo_url").eq("role_level", "supervisor");
16026
+ if (fetchError) {
16027
+ throw fetchError;
16028
+ }
16029
+ (data || []).forEach((row) => {
16030
+ const assignedLineIds = row?.properties?.line_id || row?.properties?.line_ids || [];
16031
+ const email = row.email || "";
16032
+ let displayName;
16033
+ if (row.first_name) {
16034
+ displayName = row.last_name ? `${row.first_name} ${row.last_name}` : row.first_name;
16035
+ } else {
16036
+ displayName = (typeof email === "string" && email.includes("@") ? email.split("@")[0] : email) || email;
16037
+ }
16038
+ const supervisor = {
16039
+ userId: row.user_id,
16040
+ email,
16041
+ displayName,
16042
+ profilePhotoUrl: row.profile_photo_url
16043
+ };
16044
+ nextAllSupervisorsMap.set(supervisor.userId, supervisor);
16045
+ if (!Array.isArray(assignedLineIds) || assignedLineIds.length === 0) return;
16046
+ assignedLineIds.forEach((lineId) => {
16047
+ if (typeof lineId !== "string") return;
16048
+ if (targetLineIdSet.size > 0 && !targetLineIdSet.has(lineId)) return;
16049
+ const existing = nextSupervisorsByLineId.get(lineId) || [];
16050
+ existing.push(supervisor);
16051
+ nextSupervisorsByLineId.set(lineId, existing);
16052
+ });
16053
+ });
16054
+ }
15914
16055
  const nextSupervisorNamesByLineId = /* @__PURE__ */ new Map();
15915
16056
  nextSupervisorsByLineId.forEach((supervisors, lineId) => {
15916
16057
  nextSupervisorNamesByLineId.set(lineId, supervisors.map((s) => s.displayName).join(", "));
@@ -15926,7 +16067,7 @@ var useSupervisorsByLineIds = (lineIds, options) => {
15926
16067
  } finally {
15927
16068
  setIsLoading(false);
15928
16069
  }
15929
- }, [enabled, supabase, targetLineIdSet]);
16070
+ }, [enabled, supabase, targetLineIdSet, useBackend, resolvedCompanyId, lineIdsKey]);
15930
16071
  useEffect(() => {
15931
16072
  fetchSupervisors();
15932
16073
  }, [fetchSupervisors, lineIdsKey]);
@@ -19746,7 +19887,7 @@ var MotionConfigContext = createContext({
19746
19887
  });
19747
19888
 
19748
19889
  // ../../node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs
19749
- var PopChildMeasure = class extends React25.Component {
19890
+ var PopChildMeasure = class extends React26.Component {
19750
19891
  getSnapshotBeforeUpdate(prevProps) {
19751
19892
  const element = this.props.childRef.current;
19752
19893
  if (element && prevProps.isPresent && !this.props.isPresent) {
@@ -19801,7 +19942,7 @@ function PopChild({ children, isPresent }) {
19801
19942
  document.head.removeChild(style);
19802
19943
  };
19803
19944
  }, [isPresent]);
19804
- return jsx(PopChildMeasure, { isPresent, childRef: ref, sizeRef: size, children: React25.cloneElement(children, { ref }) });
19945
+ return jsx(PopChildMeasure, { isPresent, childRef: ref, sizeRef: size, children: React26.cloneElement(children, { ref }) });
19805
19946
  }
19806
19947
 
19807
19948
  // ../../node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs
@@ -19838,7 +19979,7 @@ var PresenceChild = ({ children, initial, isPresent, onExitComplete, custom, pre
19838
19979
  useMemo(() => {
19839
19980
  presenceChildren.forEach((_, key) => presenceChildren.set(key, false));
19840
19981
  }, [isPresent]);
19841
- React25.useEffect(() => {
19982
+ React26.useEffect(() => {
19842
19983
  !isPresent && !presenceChildren.size && onExitComplete && onExitComplete();
19843
19984
  }, [isPresent]);
19844
19985
  if (mode === "popLayout") {
@@ -19948,6 +20089,17 @@ var AnimatePresence = ({ children, custom, initial = true, onExitComplete, prese
19948
20089
  return jsx(PresenceChild, { isPresent, initial: !isInitialRender.current || initial ? void 0 : false, custom: isPresent ? void 0 : custom, presenceAffectsLayout, mode, onExitComplete: isPresent ? void 0 : onExit, children: child }, key);
19949
20090
  }) });
19950
20091
  };
20092
+ var DeprecatedLayoutGroupContext = createContext(null);
20093
+ function useIsMounted() {
20094
+ const isMounted = useRef(false);
20095
+ useIsomorphicLayoutEffect(() => {
20096
+ isMounted.current = true;
20097
+ return () => {
20098
+ isMounted.current = false;
20099
+ };
20100
+ }, []);
20101
+ return isMounted;
20102
+ }
19951
20103
 
19952
20104
  // ../../node_modules/framer-motion/dist/es/utils/GlobalConfig.mjs
19953
20105
  var MotionGlobalConfig = {
@@ -20090,6 +20242,63 @@ function createRenderBatcher(scheduleNextBatch, allowKeepAlive) {
20090
20242
 
20091
20243
  // ../../node_modules/framer-motion/dist/es/frameloop/frame.mjs
20092
20244
  var { schedule: frame, cancel: cancelFrame, state: frameData, steps: frameSteps } = createRenderBatcher(typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame : noop, true);
20245
+
20246
+ // ../../node_modules/framer-motion/dist/es/utils/use-force-update.mjs
20247
+ function useForceUpdate() {
20248
+ const isMounted = useIsMounted();
20249
+ const [forcedRenderCount, setForcedRenderCount] = useState(0);
20250
+ const forceRender = useCallback(() => {
20251
+ isMounted.current && setForcedRenderCount(forcedRenderCount + 1);
20252
+ }, [forcedRenderCount]);
20253
+ const deferredForceRender = useCallback(() => frame.postRender(forceRender), [forceRender]);
20254
+ return [deferredForceRender, forcedRenderCount];
20255
+ }
20256
+
20257
+ // ../../node_modules/framer-motion/dist/es/projection/node/group.mjs
20258
+ var notify = (node) => !node.isLayoutDirty && node.willUpdate(false);
20259
+ function nodeGroup() {
20260
+ const nodes = /* @__PURE__ */ new Set();
20261
+ const subscriptions = /* @__PURE__ */ new WeakMap();
20262
+ const dirtyAll = () => nodes.forEach(notify);
20263
+ return {
20264
+ add: (node) => {
20265
+ nodes.add(node);
20266
+ subscriptions.set(node, node.addEventListener("willUpdate", dirtyAll));
20267
+ },
20268
+ remove: (node) => {
20269
+ nodes.delete(node);
20270
+ const unsubscribe = subscriptions.get(node);
20271
+ if (unsubscribe) {
20272
+ unsubscribe();
20273
+ subscriptions.delete(node);
20274
+ }
20275
+ dirtyAll();
20276
+ },
20277
+ dirty: dirtyAll
20278
+ };
20279
+ }
20280
+
20281
+ // ../../node_modules/framer-motion/dist/es/components/LayoutGroup/index.mjs
20282
+ var shouldInheritGroup = (inherit) => inherit === true;
20283
+ var shouldInheritId = (inherit) => shouldInheritGroup(inherit === true) || inherit === "id";
20284
+ var LayoutGroup = ({ children, id: id3, inherit = true }) => {
20285
+ const layoutGroupContext = useContext(LayoutGroupContext);
20286
+ const deprecatedLayoutGroupContext = useContext(DeprecatedLayoutGroupContext);
20287
+ const [forceRender, key] = useForceUpdate();
20288
+ const context = useRef(null);
20289
+ const upstreamId = layoutGroupContext.id || deprecatedLayoutGroupContext;
20290
+ if (context.current === null) {
20291
+ if (shouldInheritId(inherit) && upstreamId) {
20292
+ id3 = id3 ? upstreamId + "-" + id3 : upstreamId;
20293
+ }
20294
+ context.current = {
20295
+ id: id3,
20296
+ group: shouldInheritGroup(inherit) ? layoutGroupContext.group || nodeGroup() : nodeGroup()
20297
+ };
20298
+ }
20299
+ const memoizedContext = useMemo(() => ({ ...context.current, forceRender }), [key]);
20300
+ return jsx(LayoutGroupContext.Provider, { value: memoizedContext, children });
20301
+ };
20093
20302
  var LazyContext = createContext({ strict: false });
20094
20303
 
20095
20304
  // ../../node_modules/framer-motion/dist/es/motion/features/definitions.mjs
@@ -26697,7 +26906,7 @@ function checkNodeWasScrollRoot(node) {
26697
26906
 
26698
26907
  // ../../node_modules/framer-motion/dist/es/projection/node/DocumentProjectionNode.mjs
26699
26908
  var DocumentProjectionNode = createProjectionNode2({
26700
- attachResizeListener: (ref, notify) => addDomEvent(ref, "resize", notify),
26909
+ attachResizeListener: (ref, notify2) => addDomEvent(ref, "resize", notify2),
26701
26910
  measureScroll: () => ({
26702
26911
  x: document.documentElement.scrollLeft || document.body.scrollLeft,
26703
26912
  y: document.documentElement.scrollTop || document.body.scrollTop
@@ -27604,12 +27813,12 @@ var withAuth = (WrappedComponent2, options) => {
27604
27813
  requireAuth: true,
27605
27814
  ...options
27606
27815
  };
27607
- const WithAuthComponent = React25.memo(function WithAuthComponent2(props) {
27816
+ const WithAuthComponent = React26.memo(function WithAuthComponent2(props) {
27608
27817
  const { session, loading, error } = useAuth();
27609
27818
  const router = useRouter();
27610
- const [localLoading, setLocalLoading] = React25.useState(loading);
27611
- const [loadingTimeoutReached, setLoadingTimeoutReached] = React25.useState(false);
27612
- React25.useEffect(() => {
27819
+ const [localLoading, setLocalLoading] = React26.useState(loading);
27820
+ const [loadingTimeoutReached, setLoadingTimeoutReached] = React26.useState(false);
27821
+ React26.useEffect(() => {
27613
27822
  if (process.env.NODE_ENV === "development" && process.env.DEBUG_AUTH === "true") {
27614
27823
  console.log("withAuth state:", {
27615
27824
  loading,
@@ -27619,7 +27828,7 @@ var withAuth = (WrappedComponent2, options) => {
27619
27828
  });
27620
27829
  }
27621
27830
  }, [session, loading, error]);
27622
- const handleLoadingTimeout = React25.useCallback(() => {
27831
+ const handleLoadingTimeout = React26.useCallback(() => {
27623
27832
  console.warn("[withAuth] Loading timeout reached");
27624
27833
  setLoadingTimeoutReached(true);
27625
27834
  if (typeof window !== "undefined" && localStorage.getItem("sb-zmzewpwerpaupoaoeqhh-auth-token")) {
@@ -27630,13 +27839,13 @@ var withAuth = (WrappedComponent2, options) => {
27630
27839
  router.replace(defaultOptions.redirectTo);
27631
27840
  }
27632
27841
  }, [router]);
27633
- React25.useEffect(() => {
27842
+ React26.useEffect(() => {
27634
27843
  if (!loading && defaultOptions.requireAuth && !session && !error) {
27635
27844
  console.log("[withAuth] No session found, redirecting to login");
27636
27845
  router.replace(defaultOptions.redirectTo);
27637
27846
  }
27638
27847
  }, [session, loading, router, error]);
27639
- React25.useEffect(() => {
27848
+ React26.useEffect(() => {
27640
27849
  setLocalLoading(loading);
27641
27850
  }, [loading]);
27642
27851
  if (loading || localLoading) {
@@ -28510,11 +28719,11 @@ var BarChartComponent = ({
28510
28719
  aspect = 2,
28511
28720
  ...restOfChartProps
28512
28721
  }) => {
28513
- const containerRef = React25__default.useRef(null);
28514
- const [containerReady, setContainerReady] = React25__default.useState(false);
28722
+ const containerRef = React26__default.useRef(null);
28723
+ const [containerReady, setContainerReady] = React26__default.useState(false);
28515
28724
  const themeConfig = useThemeConfig();
28516
28725
  const { formatNumber } = useFormatNumber();
28517
- React25__default.useEffect(() => {
28726
+ React26__default.useEffect(() => {
28518
28727
  const checkContainerDimensions = () => {
28519
28728
  if (containerRef.current) {
28520
28729
  const rect = containerRef.current.getBoundingClientRect();
@@ -28628,7 +28837,7 @@ var BarChartComponent = ({
28628
28837
  }
28629
28838
  return /* @__PURE__ */ jsx("div", { className: clsx("w-full", className), children: chartContent });
28630
28839
  };
28631
- var BarChart = React25__default.memo(BarChartComponent, (prevProps, nextProps) => {
28840
+ var BarChart = React26__default.memo(BarChartComponent, (prevProps, nextProps) => {
28632
28841
  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) {
28633
28842
  return false;
28634
28843
  }
@@ -28676,11 +28885,11 @@ var LineChartComponent = ({
28676
28885
  aspect = 2,
28677
28886
  ...restOfChartProps
28678
28887
  }) => {
28679
- const containerRef = React25__default.useRef(null);
28680
- const [containerReady, setContainerReady] = React25__default.useState(false);
28888
+ const containerRef = React26__default.useRef(null);
28889
+ const [containerReady, setContainerReady] = React26__default.useState(false);
28681
28890
  const themeConfig = useThemeConfig();
28682
28891
  const { formatNumber } = useFormatNumber();
28683
- React25__default.useEffect(() => {
28892
+ React26__default.useEffect(() => {
28684
28893
  const checkContainerDimensions = () => {
28685
28894
  if (containerRef.current) {
28686
28895
  const rect = containerRef.current.getBoundingClientRect();
@@ -28779,7 +28988,7 @@ var LineChartComponent = ({
28779
28988
  }
28780
28989
  return /* @__PURE__ */ jsx("div", { className: clsx("w-full", className), children: chartContent });
28781
28990
  };
28782
- var LineChart = React25__default.memo(LineChartComponent, (prevProps, nextProps) => {
28991
+ var LineChart = React26__default.memo(LineChartComponent, (prevProps, nextProps) => {
28783
28992
  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)) {
28784
28993
  return false;
28785
28994
  }
@@ -28873,7 +29082,7 @@ var OutputProgressChartComponent = ({
28873
29082
  ] }) })
28874
29083
  ] }) });
28875
29084
  };
28876
- var OutputProgressChart = React25__default.memo(OutputProgressChartComponent);
29085
+ var OutputProgressChart = React26__default.memo(OutputProgressChartComponent);
28877
29086
  OutputProgressChart.displayName = "OutputProgressChart";
28878
29087
  var LargeOutputProgressChart = ({
28879
29088
  currentOutput,
@@ -29013,7 +29222,7 @@ var CycleTimeChartComponent = ({
29013
29222
  }
29014
29223
  ) }) });
29015
29224
  };
29016
- var CycleTimeChart = React25__default.memo(CycleTimeChartComponent, (prevProps, nextProps) => {
29225
+ var CycleTimeChart = React26__default.memo(CycleTimeChartComponent, (prevProps, nextProps) => {
29017
29226
  if (prevProps.className !== nextProps.className) {
29018
29227
  return false;
29019
29228
  }
@@ -29039,8 +29248,8 @@ var CycleTimeOverTimeChart = ({
29039
29248
  className = ""
29040
29249
  }) => {
29041
29250
  const MAX_DATA_POINTS = 40;
29042
- const containerRef = React25__default.useRef(null);
29043
- const [containerReady, setContainerReady] = React25__default.useState(false);
29251
+ const containerRef = React26__default.useRef(null);
29252
+ const [containerReady, setContainerReady] = React26__default.useState(false);
29044
29253
  const getHourFromTimeString = (timeStr) => {
29045
29254
  const [hours, minutes] = timeStr.split(":");
29046
29255
  return parseInt(hours);
@@ -29051,10 +29260,10 @@ var CycleTimeOverTimeChart = ({
29051
29260
  };
29052
29261
  const displayData = getDisplayData(data);
29053
29262
  const DURATION = displayData.length;
29054
- const [animatedData, setAnimatedData] = React25__default.useState(Array(DURATION).fill(0));
29055
- const prevDataRef = React25__default.useRef(Array(DURATION).fill(0));
29056
- const animationFrameRef = React25__default.useRef(null);
29057
- const animateToNewData = React25__default.useCallback((targetData) => {
29263
+ const [animatedData, setAnimatedData] = React26__default.useState(Array(DURATION).fill(0));
29264
+ const prevDataRef = React26__default.useRef(Array(DURATION).fill(0));
29265
+ const animationFrameRef = React26__default.useRef(null);
29266
+ const animateToNewData = React26__default.useCallback((targetData) => {
29058
29267
  const startData = [...prevDataRef.current];
29059
29268
  const startTime = performance.now();
29060
29269
  const duration = 1200;
@@ -29084,7 +29293,7 @@ var CycleTimeOverTimeChart = ({
29084
29293
  }
29085
29294
  animationFrameRef.current = requestAnimationFrame(animate);
29086
29295
  }, []);
29087
- React25__default.useEffect(() => {
29296
+ React26__default.useEffect(() => {
29088
29297
  if (JSON.stringify(data) !== JSON.stringify(prevDataRef.current)) {
29089
29298
  const processedData = getDisplayData(data);
29090
29299
  animateToNewData(processedData);
@@ -29095,7 +29304,7 @@ var CycleTimeOverTimeChart = ({
29095
29304
  }
29096
29305
  };
29097
29306
  }, [data, animateToNewData]);
29098
- React25__default.useEffect(() => {
29307
+ React26__default.useEffect(() => {
29099
29308
  const checkContainerDimensions = () => {
29100
29309
  if (containerRef.current) {
29101
29310
  const rect = containerRef.current.getBoundingClientRect();
@@ -29338,7 +29547,7 @@ var CycleTimeOverTimeChart = ({
29338
29547
  }
29339
29548
  );
29340
29549
  };
29341
- var Card = React25.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
29550
+ var Card = React26.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
29342
29551
  "div",
29343
29552
  {
29344
29553
  ref,
@@ -29350,7 +29559,7 @@ var Card = React25.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
29350
29559
  }
29351
29560
  ));
29352
29561
  Card.displayName = "Card";
29353
- var CardHeader = React25.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
29562
+ var CardHeader = React26.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
29354
29563
  "div",
29355
29564
  {
29356
29565
  ref,
@@ -29359,7 +29568,7 @@ var CardHeader = React25.forwardRef(({ className, ...props }, ref) => /* @__PURE
29359
29568
  }
29360
29569
  ));
29361
29570
  CardHeader.displayName = "CardHeader";
29362
- var CardTitle = React25.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
29571
+ var CardTitle = React26.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
29363
29572
  "h3",
29364
29573
  {
29365
29574
  ref,
@@ -29371,7 +29580,7 @@ var CardTitle = React25.forwardRef(({ className, ...props }, ref) => /* @__PURE_
29371
29580
  }
29372
29581
  ));
29373
29582
  CardTitle.displayName = "CardTitle";
29374
- var CardDescription = React25.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
29583
+ var CardDescription = React26.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
29375
29584
  "p",
29376
29585
  {
29377
29586
  ref,
@@ -29380,9 +29589,9 @@ var CardDescription = React25.forwardRef(({ className, ...props }, ref) => /* @_
29380
29589
  }
29381
29590
  ));
29382
29591
  CardDescription.displayName = "CardDescription";
29383
- var CardContent = React25.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
29592
+ var CardContent = React26.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
29384
29593
  CardContent.displayName = "CardContent";
29385
- var CardFooter = React25.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
29594
+ var CardFooter = React26.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
29386
29595
  "div",
29387
29596
  {
29388
29597
  ref,
@@ -29458,7 +29667,7 @@ var buttonVariants = cva(
29458
29667
  }
29459
29668
  }
29460
29669
  );
29461
- var Button = React25.forwardRef(
29670
+ var Button = React26.forwardRef(
29462
29671
  ({ className, variant, size, asChild = false, ...props }, ref) => {
29463
29672
  const Comp = asChild ? Slot : "button";
29464
29673
  return /* @__PURE__ */ jsx(
@@ -29485,8 +29694,8 @@ var HourlyOutputChartComponent = ({
29485
29694
  timezone,
29486
29695
  className = ""
29487
29696
  }) => {
29488
- const containerRef = React25__default.useRef(null);
29489
- const [containerReady, setContainerReady] = React25__default.useState(false);
29697
+ const containerRef = React26__default.useRef(null);
29698
+ const [containerReady, setContainerReady] = React26__default.useState(false);
29490
29699
  const getTimeFromTimeString = (timeStr) => {
29491
29700
  const [hours, minutes] = timeStr.split(":");
29492
29701
  const hour = parseInt(hours);
@@ -29495,13 +29704,13 @@ var HourlyOutputChartComponent = ({
29495
29704
  return { hour, minute, decimalHour };
29496
29705
  };
29497
29706
  const shiftStartTime = getTimeFromTimeString(shiftStart);
29498
- React25__default.useMemo(() => {
29707
+ React26__default.useMemo(() => {
29499
29708
  if (!shiftDate || !timezone) return null;
29500
29709
  const hour = shiftStartTime.hour.toString().padStart(2, "0");
29501
29710
  const minute = shiftStartTime.minute.toString().padStart(2, "0");
29502
29711
  return fromZonedTime(`${shiftDate}T${hour}:${minute}:00`, timezone);
29503
29712
  }, [shiftDate, timezone, shiftStartTime.hour, shiftStartTime.minute]);
29504
- const idleClipRanges = React25__default.useMemo(() => {
29713
+ const idleClipRanges = React26__default.useMemo(() => {
29505
29714
  if (!idleTimeClips || idleTimeClips.length === 0) return [];
29506
29715
  return idleTimeClips.map((clip) => ({
29507
29716
  id: clip.id,
@@ -29509,7 +29718,7 @@ var HourlyOutputChartComponent = ({
29509
29718
  end: clip.idle_end_time ? new Date(clip.idle_end_time) : null
29510
29719
  })).filter((clip) => clip.start && clip.end);
29511
29720
  }, [idleTimeClips]);
29512
- React25__default.useCallback((rangeStart, rangeEnd) => {
29721
+ React26__default.useCallback((rangeStart, rangeEnd) => {
29513
29722
  if (!rangeStart || !rangeEnd || idleClipRanges.length === 0) {
29514
29723
  return "Reason unavailable";
29515
29724
  }
@@ -29526,7 +29735,7 @@ var HourlyOutputChartComponent = ({
29526
29735
  }
29527
29736
  return classification.label.replace(/_/g, " ");
29528
29737
  }, [idleClipRanges, idleTimeClipClassifications]);
29529
- const { shiftDuration, shiftEndTime, hasPartialLastHour } = React25__default.useMemo(() => {
29738
+ const { shiftDuration, shiftEndTime, hasPartialLastHour } = React26__default.useMemo(() => {
29530
29739
  console.log("[HourlyOutputChart] Calculating shift duration with:", {
29531
29740
  shiftStart,
29532
29741
  shiftEnd,
@@ -29561,12 +29770,12 @@ var HourlyOutputChartComponent = ({
29561
29770
  }, [shiftEnd, shiftStartTime.decimalHour]);
29562
29771
  const SHIFT_DURATION = shiftDuration;
29563
29772
  shiftEndTime ? shiftEndTime.hour : (shiftStartTime.hour + SHIFT_DURATION) % 24;
29564
- const [animatedData, setAnimatedData] = React25__default.useState(
29773
+ const [animatedData, setAnimatedData] = React26__default.useState(
29565
29774
  () => Array(SHIFT_DURATION).fill(0)
29566
29775
  );
29567
- const prevDataRef = React25__default.useRef(Array(SHIFT_DURATION).fill(0));
29568
- const animationFrameRef = React25__default.useRef(null);
29569
- React25__default.useEffect(() => {
29776
+ const prevDataRef = React26__default.useRef(Array(SHIFT_DURATION).fill(0));
29777
+ const animationFrameRef = React26__default.useRef(null);
29778
+ React26__default.useEffect(() => {
29570
29779
  setAnimatedData((prev) => {
29571
29780
  if (prev.length !== SHIFT_DURATION) {
29572
29781
  return Array(SHIFT_DURATION).fill(0);
@@ -29575,14 +29784,14 @@ var HourlyOutputChartComponent = ({
29575
29784
  });
29576
29785
  prevDataRef.current = Array(SHIFT_DURATION).fill(0);
29577
29786
  }, [SHIFT_DURATION]);
29578
- const [idleBarState, setIdleBarState] = React25__default.useState({
29787
+ const [idleBarState, setIdleBarState] = React26__default.useState({
29579
29788
  visible: showIdleTime,
29580
29789
  key: 0,
29581
29790
  shouldAnimate: false
29582
29791
  });
29583
- const prevShowIdleTimeRef = React25__default.useRef(showIdleTime);
29584
- const stateUpdateTimeoutRef = React25__default.useRef(null);
29585
- React25__default.useEffect(() => {
29792
+ const prevShowIdleTimeRef = React26__default.useRef(showIdleTime);
29793
+ const stateUpdateTimeoutRef = React26__default.useRef(null);
29794
+ React26__default.useEffect(() => {
29586
29795
  if (stateUpdateTimeoutRef.current) {
29587
29796
  clearTimeout(stateUpdateTimeoutRef.current);
29588
29797
  }
@@ -29607,7 +29816,7 @@ var HourlyOutputChartComponent = ({
29607
29816
  }
29608
29817
  };
29609
29818
  }, [showIdleTime]);
29610
- const animateToNewData = React25__default.useCallback((targetData) => {
29819
+ const animateToNewData = React26__default.useCallback((targetData) => {
29611
29820
  const startData = [...prevDataRef.current];
29612
29821
  const startTime = performance.now();
29613
29822
  const duration = 1200;
@@ -29637,7 +29846,7 @@ var HourlyOutputChartComponent = ({
29637
29846
  }
29638
29847
  animationFrameRef.current = requestAnimationFrame(animate);
29639
29848
  }, []);
29640
- React25__default.useEffect(() => {
29849
+ React26__default.useEffect(() => {
29641
29850
  if (JSON.stringify(data) !== JSON.stringify(prevDataRef.current)) {
29642
29851
  const shiftData = data.slice(0, SHIFT_DURATION);
29643
29852
  animateToNewData(shiftData);
@@ -29648,7 +29857,7 @@ var HourlyOutputChartComponent = ({
29648
29857
  }
29649
29858
  };
29650
29859
  }, [data, animateToNewData]);
29651
- React25__default.useEffect(() => {
29860
+ React26__default.useEffect(() => {
29652
29861
  const checkContainerDimensions = () => {
29653
29862
  if (containerRef.current) {
29654
29863
  const rect = containerRef.current.getBoundingClientRect();
@@ -29670,7 +29879,7 @@ var HourlyOutputChartComponent = ({
29670
29879
  clearTimeout(fallbackTimeout);
29671
29880
  };
29672
29881
  }, []);
29673
- const formatHour = React25__default.useCallback((hourIndex) => {
29882
+ const formatHour = React26__default.useCallback((hourIndex) => {
29674
29883
  const isLastHour = hourIndex === SHIFT_DURATION - 1;
29675
29884
  const startDecimalHour = shiftStartTime.decimalHour + hourIndex;
29676
29885
  const startHour = Math.floor(startDecimalHour) % 24;
@@ -29694,7 +29903,7 @@ var HourlyOutputChartComponent = ({
29694
29903
  };
29695
29904
  return `${formatTime5(startHour, startMinute)}-${formatTime5(endHour, endMinute)}`;
29696
29905
  }, [shiftStartTime.decimalHour, SHIFT_DURATION, shiftEndTime]);
29697
- const formatTimeRange2 = React25__default.useCallback((hourIndex) => {
29906
+ const formatTimeRange2 = React26__default.useCallback((hourIndex) => {
29698
29907
  const isLastHour = hourIndex === SHIFT_DURATION - 1;
29699
29908
  const startDecimalHour = shiftStartTime.decimalHour + hourIndex;
29700
29909
  const startHour = Math.floor(startDecimalHour) % 24;
@@ -29715,7 +29924,7 @@ var HourlyOutputChartComponent = ({
29715
29924
  };
29716
29925
  return `${formatTime5(startHour, startMinute)} - ${formatTime5(endHour, endMinute)}`;
29717
29926
  }, [shiftStartTime.decimalHour, SHIFT_DURATION, shiftEndTime]);
29718
- const chartData = React25__default.useMemo(() => {
29927
+ const chartData = React26__default.useMemo(() => {
29719
29928
  return Array.from({ length: SHIFT_DURATION }, (_, i) => {
29720
29929
  const actualHour = (shiftStartTime.hour + i) % 24;
29721
29930
  const startMinute = shiftStartTime.minute;
@@ -29785,7 +29994,7 @@ var HourlyOutputChartComponent = ({
29785
29994
  };
29786
29995
  });
29787
29996
  }, [animatedData, data, pphThreshold, idleTimeHourly, shiftStartTime.hour, shiftStartTime.minute, shiftEndTime, formatHour, formatTimeRange2, SHIFT_DURATION]);
29788
- const IdleBar = React25__default.useMemo(() => {
29997
+ const IdleBar = React26__default.useMemo(() => {
29789
29998
  if (!idleBarState.visible) return null;
29790
29999
  return /* @__PURE__ */ jsx(
29791
30000
  Bar,
@@ -29875,11 +30084,10 @@ var HourlyOutputChartComponent = ({
29875
30084
  {
29876
30085
  data: chartData,
29877
30086
  margin: {
29878
- top: 20,
29879
- // Increased top margin for labels
30087
+ top: 10,
29880
30088
  right: 10,
29881
- bottom: 40,
29882
- // Increased to prevent x-axis labels from being cut off
30089
+ bottom: 10,
30090
+ // Small bottom margin
29883
30091
  left: 0
29884
30092
  },
29885
30093
  barCategoryGap: "25%",
@@ -29894,7 +30102,7 @@ var HourlyOutputChartComponent = ({
29894
30102
  angle: -45,
29895
30103
  textAnchor: "end",
29896
30104
  tickMargin: 12,
29897
- height: 70
30105
+ height: 100
29898
30106
  }
29899
30107
  ),
29900
30108
  /* @__PURE__ */ jsx(
@@ -30114,7 +30322,7 @@ var HourlyOutputChartComponent = ({
30114
30322
  }
30115
30323
  );
30116
30324
  };
30117
- var HourlyOutputChart = React25__default.memo(HourlyOutputChartComponent, (prevProps, nextProps) => {
30325
+ var HourlyOutputChart = React26__default.memo(HourlyOutputChartComponent, (prevProps, nextProps) => {
30118
30326
  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.className !== nextProps.className) {
30119
30327
  return false;
30120
30328
  }
@@ -30177,7 +30385,7 @@ function getTrendArrowAndColor(trend) {
30177
30385
  return { arrow: "\u2192", color: "text-gray-400" };
30178
30386
  }
30179
30387
  }
30180
- var VideoCard = React25__default.memo(({
30388
+ var VideoCard = React26__default.memo(({
30181
30389
  workspace,
30182
30390
  hlsUrl,
30183
30391
  shouldPlay,
@@ -30357,7 +30565,7 @@ var logDebug2 = (...args) => {
30357
30565
  if (!DEBUG_DASHBOARD_LOGS2) return;
30358
30566
  console.log(...args);
30359
30567
  };
30360
- var VideoGridView = React25__default.memo(({
30568
+ var VideoGridView = React26__default.memo(({
30361
30569
  workspaces,
30362
30570
  selectedLine,
30363
30571
  className = "",
@@ -30726,7 +30934,7 @@ var VideoGridView = React25__default.memo(({
30726
30934
  ) }) });
30727
30935
  });
30728
30936
  VideoGridView.displayName = "VideoGridView";
30729
- var MapGridView = React25__default.memo(({
30937
+ var MapGridView = React26__default.memo(({
30730
30938
  workspaces,
30731
30939
  className = "",
30732
30940
  displayNames = {},
@@ -31603,7 +31811,7 @@ var EmptyStateMessage = ({
31603
31811
  iconClassName
31604
31812
  }) => {
31605
31813
  let IconContent = null;
31606
- if (React25__default.isValidElement(iconType)) {
31814
+ if (React26__default.isValidElement(iconType)) {
31607
31815
  IconContent = iconType;
31608
31816
  } else if (typeof iconType === "string") {
31609
31817
  const MappedIcon = IconMap[iconType];
@@ -33153,7 +33361,11 @@ var HlsVideoPlayer = forwardRef(({
33153
33361
  const handleTogglePlay = useCallback(() => {
33154
33362
  if (videoRef.current) {
33155
33363
  if (videoRef.current.paused) {
33156
- videoRef.current.play();
33364
+ videoRef.current.play().catch((err) => {
33365
+ if (err?.name !== "AbortError") {
33366
+ console.warn("[HlsVideoPlayer] Play failed:", err);
33367
+ }
33368
+ });
33157
33369
  } else {
33158
33370
  videoRef.current.pause();
33159
33371
  }
@@ -33575,7 +33787,11 @@ var CroppedHlsVideoPlayer = forwardRef(({
33575
33787
  const handleTogglePlay = useCallback(() => {
33576
33788
  if (hiddenVideoRef.current?.video) {
33577
33789
  if (hiddenVideoRef.current.video.paused) {
33578
- hiddenVideoRef.current.play();
33790
+ hiddenVideoRef.current.play()?.catch((err) => {
33791
+ if (err?.name !== "AbortError") {
33792
+ console.warn("[CroppedHlsVideoPlayer] Play failed:", err);
33793
+ }
33794
+ });
33579
33795
  } else {
33580
33796
  hiddenVideoRef.current.pause();
33581
33797
  }
@@ -33786,7 +34002,7 @@ function Skeleton({ className, ...props }) {
33786
34002
  var Select = SelectPrimitive.Root;
33787
34003
  var SelectGroup = SelectPrimitive.Group;
33788
34004
  var SelectValue = SelectPrimitive.Value;
33789
- var SelectTrigger = React25.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
34005
+ var SelectTrigger = React26.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
33790
34006
  SelectPrimitive.Trigger,
33791
34007
  {
33792
34008
  ref,
@@ -33802,7 +34018,7 @@ var SelectTrigger = React25.forwardRef(({ className, children, ...props }, ref)
33802
34018
  }
33803
34019
  ));
33804
34020
  SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
33805
- var SelectScrollUpButton = React25.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
34021
+ var SelectScrollUpButton = React26.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
33806
34022
  SelectPrimitive.ScrollUpButton,
33807
34023
  {
33808
34024
  ref,
@@ -33812,7 +34028,7 @@ var SelectScrollUpButton = React25.forwardRef(({ className, ...props }, ref) =>
33812
34028
  }
33813
34029
  ));
33814
34030
  SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
33815
- var SelectScrollDownButton = React25.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
34031
+ var SelectScrollDownButton = React26.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
33816
34032
  SelectPrimitive.ScrollDownButton,
33817
34033
  {
33818
34034
  ref,
@@ -33822,7 +34038,7 @@ var SelectScrollDownButton = React25.forwardRef(({ className, ...props }, ref) =
33822
34038
  }
33823
34039
  ));
33824
34040
  SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
33825
- var SelectContent = React25.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
34041
+ var SelectContent = React26.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
33826
34042
  SelectPrimitive.Content,
33827
34043
  {
33828
34044
  ref,
@@ -33850,7 +34066,7 @@ var SelectContent = React25.forwardRef(({ className, children, position = "poppe
33850
34066
  }
33851
34067
  ) }));
33852
34068
  SelectContent.displayName = SelectPrimitive.Content.displayName;
33853
- var SelectLabel = React25.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
34069
+ var SelectLabel = React26.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
33854
34070
  SelectPrimitive.Label,
33855
34071
  {
33856
34072
  ref,
@@ -33859,7 +34075,7 @@ var SelectLabel = React25.forwardRef(({ className, ...props }, ref) => /* @__PUR
33859
34075
  }
33860
34076
  ));
33861
34077
  SelectLabel.displayName = SelectPrimitive.Label.displayName;
33862
- var SelectItem = React25.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
34078
+ var SelectItem = React26.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
33863
34079
  SelectPrimitive.Item,
33864
34080
  {
33865
34081
  ref,
@@ -33875,7 +34091,7 @@ var SelectItem = React25.forwardRef(({ className, children, ...props }, ref) =>
33875
34091
  }
33876
34092
  ));
33877
34093
  SelectItem.displayName = SelectPrimitive.Item.displayName;
33878
- var SelectSeparator = React25.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
34094
+ var SelectSeparator = React26.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
33879
34095
  SelectPrimitive.Separator,
33880
34096
  {
33881
34097
  ref,
@@ -34174,7 +34390,7 @@ var TimePickerDropdown = ({
34174
34390
  ] })
34175
34391
  ] });
34176
34392
  };
34177
- var SilentErrorBoundary = class extends React25__default.Component {
34393
+ var SilentErrorBoundary = class extends React26__default.Component {
34178
34394
  constructor(props) {
34179
34395
  super(props);
34180
34396
  this.handleClearAndReload = () => {
@@ -34993,7 +35209,8 @@ var FileManagerFilters = ({
34993
35209
  snapshotDateTime,
34994
35210
  snapshotClipId,
34995
35211
  className = "",
34996
- targetCycleTime = null
35212
+ targetCycleTime = null,
35213
+ idleTimeVlmEnabled = false
34997
35214
  }) => {
34998
35215
  const [expandedNodes, setExpandedNodes] = useState(/* @__PURE__ */ new Set());
34999
35216
  const [startTime, setStartTime] = useState("");
@@ -35121,8 +35338,8 @@ var FileManagerFilters = ({
35121
35338
  ...prev,
35122
35339
  [categoryId]: page === 1 ? data.clips : [...prev[categoryId] || [], ...data.clips]
35123
35340
  }));
35124
- const authToken = categoryId === "idle_time" ? await getAuthToken3() : null;
35125
- if (categoryId === "idle_time" && authToken) {
35341
+ const authToken = categoryId === "idle_time" && idleTimeVlmEnabled ? await getAuthToken3() : null;
35342
+ if (categoryId === "idle_time" && idleTimeVlmEnabled && authToken) {
35126
35343
  const seededClassifications = {};
35127
35344
  (data.clips || []).forEach((clip) => {
35128
35345
  if (!clip.clipId) {
@@ -35167,7 +35384,7 @@ var FileManagerFilters = ({
35167
35384
  return newSet;
35168
35385
  });
35169
35386
  }
35170
- }, [workspaceId, date, shift, mergedClipClassifications, snapshotDateTime, snapshotClipId, supabase, getAuthToken3]);
35387
+ }, [workspaceId, date, shift, mergedClipClassifications, snapshotDateTime, snapshotClipId, supabase, getAuthToken3, idleTimeVlmEnabled]);
35171
35388
  const fetchPercentileClips = useCallback(async (type) => {
35172
35389
  if (!workspaceId || !date || shift === void 0) {
35173
35390
  console.warn("[FileManager] Missing required params for percentile clips fetch");
@@ -35493,7 +35710,9 @@ var FileManagerFilters = ({
35493
35710
  categoryId: category.id,
35494
35711
  clipPosition: index + 1,
35495
35712
  // Store 1-based position
35496
- cycleTimeSeconds: cycleTime
35713
+ cycleTimeSeconds: cycleTime,
35714
+ duration: clip.duration
35715
+ // Store duration for custom badge rendering
35497
35716
  };
35498
35717
  });
35499
35718
  regularCategoryNodes.push({
@@ -35753,6 +35972,9 @@ var FileManagerFilters = ({
35753
35972
  if (rootCause === "processing") {
35754
35973
  return /* @__PURE__ */ jsx(Loader2, { className: "h-3.5 w-3.5 text-gray-400 animate-spin", strokeWidth: 2.5 });
35755
35974
  }
35975
+ if (!idleTimeVlmEnabled && node.categoryId === "idle_time") {
35976
+ return /* @__PURE__ */ jsx(Clock, { className: "h-3.5 w-3.5 text-purple-500", strokeWidth: 2.5 });
35977
+ }
35756
35978
  const config = getRootCauseConfig(rootCause.replace(/_/g, " "));
35757
35979
  if (config) {
35758
35980
  const IconComponent = config.Icon;
@@ -35769,6 +35991,11 @@ var FileManagerFilters = ({
35769
35991
  node.type === "video" && (node.severity || node.categoryId === "cycle_completion" || node.categoryId === "idle_time" || node.categoryId === "low_value") && /* @__PURE__ */ jsx("div", { className: "text-xs mt-0.5 font-medium", children: node.categoryId === "idle_time" ? (
35770
35992
  // Show root cause label for idle time clips (text only, icon is on the left)
35771
35993
  (() => {
35994
+ if (!idleTimeVlmEnabled) {
35995
+ const duration = node.duration || 0;
35996
+ const isLong = duration > 300;
35997
+ return /* @__PURE__ */ jsx("div", { className: `inline-flex items-center px-2 py-0.5 rounded-md border text-[10px] font-bold ${isLong ? "bg-purple-50 text-purple-700 border-purple-200" : "bg-gray-50 text-gray-600 border-gray-200"}`, children: isLong ? "Long" : "Short" });
35998
+ }
35772
35999
  const clipId = node.clipId || node.id;
35773
36000
  const rootCause = getIdleTimeRootCause(clipId);
35774
36001
  const isProcessing = rootCause === "processing";
@@ -36515,6 +36742,7 @@ var BottlenecksContent = ({
36515
36742
  const dashboardConfig = useDashboardConfig();
36516
36743
  const supabase = useSupabase();
36517
36744
  const timezone = useAppTimezone();
36745
+ const { isIdleTimeVlmEnabled } = useIdleTimeVlmConfig();
36518
36746
  const { shiftConfig, isLoading: isShiftConfigLoading } = useDynamicShiftConfig(lineId);
36519
36747
  const { effectiveShift, effectiveDate } = useMemo(() => {
36520
36748
  if (shift !== void 0 && shift !== null && date) {
@@ -36561,6 +36789,8 @@ var BottlenecksContent = ({
36561
36789
  const numericValue = typeof workspaceTargetCycleTimeRaw === "number" ? workspaceTargetCycleTimeRaw : Number(workspaceTargetCycleTimeRaw);
36562
36790
  return Number.isFinite(numericValue) ? numericValue : null;
36563
36791
  })();
36792
+ const lineIdForIdleConfig = lineId || workspaceMetrics?.line_id;
36793
+ const idleTimeVlmEnabled = isIdleTimeVlmEnabled(lineIdForIdleConfig);
36564
36794
  const videoRef = useRef(null);
36565
36795
  const videoPlayerOptions = useMemo(() => ({
36566
36796
  fluid: false,
@@ -36995,7 +37225,7 @@ var BottlenecksContent = ({
36995
37225
  fetchTriageClips();
36996
37226
  }, [triageMode, workspaceId, effectiveDateString, effectiveShiftId, supabase, isEffectiveShiftReady]);
36997
37227
  useEffect(() => {
36998
- if (!triageMode || triageClips.length === 0) {
37228
+ if (!idleTimeVlmEnabled || !triageMode || triageClips.length === 0) {
36999
37229
  return;
37000
37230
  }
37001
37231
  let cancelled = false;
@@ -37028,7 +37258,7 @@ var BottlenecksContent = ({
37028
37258
  return () => {
37029
37259
  cancelled = true;
37030
37260
  };
37031
- }, [triageClips, triageMode, getAuthToken3]);
37261
+ }, [idleTimeVlmEnabled, triageClips, triageMode, getAuthToken3]);
37032
37262
  useEffect(() => {
37033
37263
  if (s3ClipsService && (mergedCounts[activeFilter] || 0) > 0) {
37034
37264
  if (firstClip && firstClip.type === activeFilter) {
@@ -37669,6 +37899,9 @@ var BottlenecksContent = ({
37669
37899
  return currentPosition;
37670
37900
  }, [activeFilter, categoryMetadata.length, currentMetadataIndex, currentPosition, isPercentileCategory]);
37671
37901
  const classificationClipIds = useMemo(() => {
37902
+ if (!idleTimeVlmEnabled) {
37903
+ return [];
37904
+ }
37672
37905
  if (triageMode && triageClips.length > 0) {
37673
37906
  return triageClips.filter((c) => c.categoryId === "idle_time").map((c) => c.id || c.clipId).filter(Boolean).slice(0, 20);
37674
37907
  }
@@ -37677,10 +37910,10 @@ var BottlenecksContent = ({
37677
37910
  return clipId ? [clipId] : [];
37678
37911
  }
37679
37912
  return [];
37680
- }, [triageMode, triageClips, currentVideo]);
37913
+ }, [idleTimeVlmEnabled, triageMode, triageClips, currentVideo]);
37681
37914
  useClassificationRealtimeUpdates({
37682
37915
  clipIds: classificationClipIds,
37683
- enabled: classificationClipIds.length > 0,
37916
+ enabled: idleTimeVlmEnabled && classificationClipIds.length > 0,
37684
37917
  onClassificationUpdate: useCallback((clipId, classification) => {
37685
37918
  console.log(`[BottlenecksContent] Real-time classification update for ${clipId}:`, classification);
37686
37919
  setClipClassifications((prev) => ({
@@ -37690,7 +37923,7 @@ var BottlenecksContent = ({
37690
37923
  }, [])
37691
37924
  });
37692
37925
  useEffect(() => {
37693
- if (triageMode || !currentVideo || currentVideo.type !== "idle_time") {
37926
+ if (!idleTimeVlmEnabled || triageMode || !currentVideo || currentVideo.type !== "idle_time") {
37694
37927
  return;
37695
37928
  }
37696
37929
  const clipId = currentVideo.id;
@@ -37719,7 +37952,7 @@ var BottlenecksContent = ({
37719
37952
  return () => {
37720
37953
  cancelled = true;
37721
37954
  };
37722
- }, [triageMode, currentVideo, clipClassifications, getAuthToken3]);
37955
+ }, [idleTimeVlmEnabled, triageMode, currentVideo, clipClassifications, getAuthToken3]);
37723
37956
  useEffect(() => {
37724
37957
  if (!s3ClipsService || !currentVideo) {
37725
37958
  return;
@@ -38268,11 +38501,11 @@ var BottlenecksContent = ({
38268
38501
  if (!config) return null;
38269
38502
  const IconComponent = config.Icon;
38270
38503
  return /* @__PURE__ */ jsxs(Fragment, { children: [
38271
- /* @__PURE__ */ jsx("div", { className: "absolute top-3 left-3 z-10", children: /* @__PURE__ */ jsxs("div", { className: `inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-md border ${config.bgColor} ${config.borderColor} shadow-lg`, children: [
38504
+ idleTimeVlmEnabled && /* @__PURE__ */ jsx("div", { className: "absolute top-3 left-3 z-10", children: /* @__PURE__ */ jsxs("div", { className: `inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-md border ${config.bgColor} ${config.borderColor} shadow-lg`, children: [
38272
38505
  /* @__PURE__ */ jsx(IconComponent, { className: `h-3.5 w-3.5 ${config.iconColor}`, strokeWidth: 2.5 }),
38273
38506
  /* @__PURE__ */ jsx("span", { className: `font-medium text-xs ${config.color}`, children: config.displayName || (rootCause ? formatDisplayLabel(rootCause) : "Analyzing...") })
38274
38507
  ] }) }),
38275
- confidence !== null && (() => {
38508
+ idleTimeVlmEnabled && confidence !== null && (() => {
38276
38509
  const confidencePercent = confidence * 100;
38277
38510
  let confidenceLabel = "Low";
38278
38511
  let confidenceColor = "text-red-500";
@@ -38311,12 +38544,12 @@ var BottlenecksContent = ({
38311
38544
  if (!config) return null;
38312
38545
  const IconComponent = config.Icon;
38313
38546
  return /* @__PURE__ */ jsxs(Fragment, { children: [
38314
- confidence !== null && /* @__PURE__ */ jsx("div", { className: "absolute top-3 left-3 z-10", children: /* @__PURE__ */ jsx("div", { className: "inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg bg-black/70 backdrop-blur-sm shadow-lg border border-white/10", children: /* @__PURE__ */ jsxs("span", { className: "font-medium text-xs text-white", children: [
38547
+ idleTimeVlmEnabled && confidence !== null && /* @__PURE__ */ jsx("div", { className: "absolute top-3 left-3 z-10", children: /* @__PURE__ */ jsx("div", { className: "inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg bg-black/70 backdrop-blur-sm shadow-lg border border-white/10", children: /* @__PURE__ */ jsxs("span", { className: "font-medium text-xs text-white", children: [
38315
38548
  "AI Confidence: ",
38316
38549
  (confidence * 100).toFixed(0),
38317
38550
  "%"
38318
38551
  ] }) }) }),
38319
- /* @__PURE__ */ jsx("div", { className: "absolute top-3 right-3 z-10", children: /* @__PURE__ */ jsxs("div", { className: `inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-md border ${config.bgColor} ${config.borderColor} shadow-lg`, children: [
38552
+ idleTimeVlmEnabled && /* @__PURE__ */ jsx("div", { className: "absolute top-3 right-3 z-10", children: /* @__PURE__ */ jsxs("div", { className: `inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-md border ${config.bgColor} ${config.borderColor} shadow-lg`, children: [
38320
38553
  /* @__PURE__ */ jsx(IconComponent, { className: `h-3.5 w-3.5 ${config.iconColor}`, strokeWidth: 2.5 }),
38321
38554
  /* @__PURE__ */ jsx("span", { className: `font-medium text-xs ${config.color}`, children: rootCause })
38322
38555
  ] }) })
@@ -38425,7 +38658,7 @@ var BottlenecksContent = ({
38425
38658
  const IconComponent = config.Icon;
38426
38659
  return /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
38427
38660
  /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
38428
- /* @__PURE__ */ jsx(IconComponent, { className: `h-4 w-4 ${config.iconColor} flex-shrink-0`, strokeWidth: 2.5 }),
38661
+ idleTimeVlmEnabled ? /* @__PURE__ */ jsx(IconComponent, { className: `h-4 w-4 ${config.iconColor} flex-shrink-0`, strokeWidth: 2.5 }) : /* @__PURE__ */ jsx(Clock, { className: "h-4 w-4 text-purple-500 flex-shrink-0", strokeWidth: 2.5 }),
38429
38662
  /* @__PURE__ */ jsx("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsxs("p", { className: "text-sm font-medium text-gray-900", children: [
38430
38663
  timeString,
38431
38664
  " - (",
@@ -38433,11 +38666,15 @@ var BottlenecksContent = ({
38433
38666
  ")"
38434
38667
  ] }) })
38435
38668
  ] }),
38436
- /* @__PURE__ */ jsx("div", { className: "pl-6", children: /* @__PURE__ */ jsx("span", { className: "inline-flex items-center px-2 py-0.5 rounded-md border text-xs font-medium bg-gray-50 text-gray-700 border-gray-200", children: (() => {
38669
+ /* @__PURE__ */ jsx("div", { className: "pl-6", children: idleTimeVlmEnabled ? /* @__PURE__ */ jsx("span", { className: "inline-flex items-center px-2 py-0.5 rounded-md border text-xs font-medium bg-gray-50 text-gray-700 border-gray-200", children: (() => {
38437
38670
  const displayText = config.displayName || (rootCause ? formatDisplayLabel(rootCause) : "Analyzing...");
38438
38671
  console.log(`[BottlenecksContent] Displaying label: "${displayText}" for clip ${clipId}`);
38439
38672
  return displayText;
38440
- })() }) })
38673
+ })() }) : (() => {
38674
+ const duration2 = clip.duration || 0;
38675
+ const isLong = duration2 > 300;
38676
+ return /* @__PURE__ */ jsx("span", { className: `inline-flex items-center px-2 py-0.5 rounded-md border text-xs font-bold ${isLong ? "bg-purple-50 text-purple-700 border-purple-200" : "bg-gray-50 text-gray-600 border-gray-200"}`, children: isLong ? "Long" : "Short" });
38677
+ })() })
38441
38678
  ] });
38442
38679
  })()
38443
38680
  ) : (
@@ -38481,6 +38718,7 @@ var BottlenecksContent = ({
38481
38718
  snapshotClipId,
38482
38719
  targetCycleTime: workspaceTargetCycleTime,
38483
38720
  clipClassifications,
38721
+ idleTimeVlmEnabled,
38484
38722
  onFilterChange: (filterId) => {
38485
38723
  updateActiveFilter(filterId);
38486
38724
  const category = categoriesToShow.find((cat) => cat.type === filterId);
@@ -38548,11 +38786,11 @@ var BottlenecksContent = ({
38548
38786
  if (!config) return null;
38549
38787
  const IconComponent = config.Icon;
38550
38788
  return /* @__PURE__ */ jsxs(Fragment, { children: [
38551
- /* @__PURE__ */ jsx("div", { className: "absolute top-4 left-4 z-50", children: /* @__PURE__ */ jsxs("div", { className: `inline-flex items-center gap-2 px-3 py-2 rounded-md border ${config.bgColor} ${config.borderColor} shadow-lg`, children: [
38789
+ idleTimeVlmEnabled && /* @__PURE__ */ jsx("div", { className: "absolute top-4 left-4 z-50", children: /* @__PURE__ */ jsxs("div", { className: `inline-flex items-center gap-2 px-3 py-2 rounded-md border ${config.bgColor} ${config.borderColor} shadow-lg`, children: [
38552
38790
  /* @__PURE__ */ jsx(IconComponent, { className: `h-4 w-4 ${config.iconColor}`, strokeWidth: 2.5 }),
38553
38791
  /* @__PURE__ */ jsx("span", { className: `font-medium text-sm ${config.color}`, children: rootCause })
38554
38792
  ] }) }),
38555
- confidence !== null && /* @__PURE__ */ jsx("div", { className: "absolute top-4 right-4 z-50", children: /* @__PURE__ */ jsx("div", { className: "inline-flex items-center gap-1.5 px-3 py-2 rounded-lg bg-black/70 backdrop-blur-sm shadow-lg border border-white/10", children: /* @__PURE__ */ jsxs("span", { className: "font-medium text-sm text-white", children: [
38793
+ idleTimeVlmEnabled && confidence !== null && /* @__PURE__ */ jsx("div", { className: "absolute top-4 right-4 z-50", children: /* @__PURE__ */ jsx("div", { className: "inline-flex items-center gap-1.5 px-3 py-2 rounded-lg bg-black/70 backdrop-blur-sm shadow-lg border border-white/10", children: /* @__PURE__ */ jsxs("span", { className: "font-medium text-sm text-white", children: [
38556
38794
  "AI Confidence: ",
38557
38795
  (confidence * 100).toFixed(0),
38558
38796
  "%"
@@ -38578,12 +38816,12 @@ var BottlenecksContent = ({
38578
38816
  if (!config) return null;
38579
38817
  const IconComponent = config.Icon;
38580
38818
  return /* @__PURE__ */ jsxs(Fragment, { children: [
38581
- confidence !== null && /* @__PURE__ */ jsx("div", { className: "absolute top-4 left-4 z-50", children: /* @__PURE__ */ jsx("div", { className: "inline-flex items-center gap-1.5 px-3 py-2 rounded-lg bg-black/70 backdrop-blur-sm shadow-lg border border-white/10", children: /* @__PURE__ */ jsxs("span", { className: "font-medium text-sm text-white", children: [
38819
+ idleTimeVlmEnabled && confidence !== null && /* @__PURE__ */ jsx("div", { className: "absolute top-4 left-4 z-50", children: /* @__PURE__ */ jsx("div", { className: "inline-flex items-center gap-1.5 px-3 py-2 rounded-lg bg-black/70 backdrop-blur-sm shadow-lg border border-white/10", children: /* @__PURE__ */ jsxs("span", { className: "font-medium text-sm text-white", children: [
38582
38820
  "AI Confidence: ",
38583
38821
  (confidence * 100).toFixed(0),
38584
38822
  "%"
38585
38823
  ] }) }) }),
38586
- /* @__PURE__ */ jsx("div", { className: "absolute top-4 right-20 z-50", children: /* @__PURE__ */ jsxs("div", { className: `inline-flex items-center gap-2 px-3 py-2 rounded-md border ${config.bgColor} ${config.borderColor} shadow-lg`, children: [
38824
+ idleTimeVlmEnabled && /* @__PURE__ */ jsx("div", { className: "absolute top-4 right-20 z-50", children: /* @__PURE__ */ jsxs("div", { className: `inline-flex items-center gap-2 px-3 py-2 rounded-md border ${config.bgColor} ${config.borderColor} shadow-lg`, children: [
38587
38825
  /* @__PURE__ */ jsx(IconComponent, { className: `h-4 w-4 ${config.iconColor}`, strokeWidth: 2.5 }),
38588
38826
  /* @__PURE__ */ jsx("span", { className: `font-medium text-sm ${config.color}`, children: rootCause })
38589
38827
  ] }) })
@@ -40589,8 +40827,8 @@ var IdleTimeReasonChartComponent = ({
40589
40827
  isLoading = false,
40590
40828
  error = null
40591
40829
  }) => {
40592
- const [activeData, setActiveData] = React25__default.useState([]);
40593
- React25__default.useEffect(() => {
40830
+ const [activeData, setActiveData] = React26__default.useState([]);
40831
+ React26__default.useEffect(() => {
40594
40832
  if (activeData.length > 0) {
40595
40833
  setActiveData([]);
40596
40834
  }
@@ -40605,7 +40843,7 @@ var IdleTimeReasonChartComponent = ({
40605
40843
  setActiveData([]);
40606
40844
  }
40607
40845
  }, [data]);
40608
- React25__default.useEffect(() => {
40846
+ React26__default.useEffect(() => {
40609
40847
  if (!data || data.length === 0) return;
40610
40848
  data.forEach((entry, index) => {
40611
40849
  if (entry.name.toLowerCase().includes("other")) {
@@ -40613,7 +40851,7 @@ var IdleTimeReasonChartComponent = ({
40613
40851
  }
40614
40852
  });
40615
40853
  }, [data]);
40616
- const pieKey = React25__default.useMemo(() => {
40854
+ const pieKey = React26__default.useMemo(() => {
40617
40855
  return activeData.map((d) => `${d.name}-${d.value}`).join("|");
40618
40856
  }, [activeData]);
40619
40857
  if (isLoading) {
@@ -40703,7 +40941,7 @@ var IdleTimeReasonChartComponent = ({
40703
40941
  )
40704
40942
  ] });
40705
40943
  };
40706
- var IdleTimeReasonChart = React25__default.memo(IdleTimeReasonChartComponent);
40944
+ var IdleTimeReasonChart = React26__default.memo(IdleTimeReasonChartComponent);
40707
40945
  IdleTimeReasonChart.displayName = "IdleTimeReasonChart";
40708
40946
  var IdleTimeReasonChart_default = IdleTimeReasonChart;
40709
40947
  var DEFAULT_PERFORMANCE_DATA = {
@@ -40769,6 +41007,8 @@ var LineMonthlyHistory = ({
40769
41007
  className
40770
41008
  }) => {
40771
41009
  const navigation = useNavigation();
41010
+ const { isIdleTimeVlmEnabled } = useIdleTimeVlmConfig();
41011
+ const idleTimeVlmEnabled = isIdleTimeVlmEnabled(lineId);
40772
41012
  const chartKey = useMemo(() => `${lineId}-${month}-${year}-${selectedShiftId}-${rangeStart}-${rangeEnd}`, [lineId, month, year, selectedShiftId, rangeStart, rangeEnd]);
40773
41013
  const monthBounds = useMemo(() => getMonthKeyBounds(year, month), [year, month]);
40774
41014
  const normalizedRange = useMemo(() => {
@@ -40794,7 +41034,7 @@ var LineMonthlyHistory = ({
40794
41034
  startDate,
40795
41035
  endDate,
40796
41036
  shiftId: selectedShiftId,
40797
- enabled: !!lineId
41037
+ enabled: !!lineId && idleTimeVlmEnabled
40798
41038
  });
40799
41039
  const averages = (analysisMonthlyData || []).reduce(
40800
41040
  (acc, day) => {
@@ -41013,8 +41253,8 @@ var LineMonthlyHistory = ({
41013
41253
  ] })
41014
41254
  ] })
41015
41255
  ] }),
41016
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-2 sm:gap-3 lg:gap-4", children: [
41017
- /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg sm:rounded-xl shadow-sm border border-gray-100 p-2 sm:p-3 lg:p-4 flex flex-col min-h-[160px] sm:min-h-[180px] lg:min-h-[220px]", children: [
41256
+ /* @__PURE__ */ jsxs("div", { className: `grid grid-cols-1 ${idleTimeVlmEnabled ? "sm:grid-cols-2" : "sm:grid-cols-1"} gap-2 sm:gap-3 lg:gap-4`, children: [
41257
+ idleTimeVlmEnabled && /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg sm:rounded-xl shadow-sm border border-gray-100 p-2 sm:p-3 lg:p-4 flex flex-col min-h-[160px] sm:min-h-[180px] lg:min-h-[220px]", children: [
41018
41258
  /* @__PURE__ */ jsx("h3", { className: "text-xs sm:text-sm font-semibold text-gray-700 mb-0.5 sm:mb-1 text-center", children: "Idle time Breakdown" }),
41019
41259
  /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0 relative -ml-2 sm:-ml-4", children: /* @__PURE__ */ jsx(
41020
41260
  IdleTimeReasonChart,
@@ -42608,6 +42848,7 @@ var WorkspaceMonthlyHistory = ({
42608
42848
  month,
42609
42849
  year,
42610
42850
  workspaceId,
42851
+ lineId,
42611
42852
  rangeStart,
42612
42853
  rangeEnd,
42613
42854
  timezone,
@@ -42647,6 +42888,8 @@ var WorkspaceMonthlyHistory = ({
42647
42888
  }, []);
42648
42889
  const startDate = normalizedRange.startKey;
42649
42890
  const endDate = normalizedRange.endKey;
42891
+ const { isIdleTimeVlmEnabled } = useIdleTimeVlmConfig();
42892
+ const idleTimeVlmEnabled = isIdleTimeVlmEnabled(lineId);
42650
42893
  const {
42651
42894
  chartData: idleReasonsChartData,
42652
42895
  isLoading: idleReasonsLoading,
@@ -42656,7 +42899,7 @@ var WorkspaceMonthlyHistory = ({
42656
42899
  startDate,
42657
42900
  endDate,
42658
42901
  shiftId: selectedShiftId,
42659
- enabled: analysisMonthlyData.length > 0
42902
+ enabled: analysisMonthlyData.length > 0 && idleTimeVlmEnabled
42660
42903
  });
42661
42904
  const hasRealData = (shift) => {
42662
42905
  if (shift.hasData !== void 0) return shift.hasData;
@@ -42940,7 +43183,7 @@ var WorkspaceMonthlyHistory = ({
42940
43183
  ] })
42941
43184
  ] })
42942
43185
  ] }),
42943
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
43186
+ /* @__PURE__ */ jsxs("div", { className: `grid grid-cols-1 ${idleTimeVlmEnabled ? "sm:grid-cols-2" : "sm:grid-cols-1"} gap-4`, children: [
42944
43187
  /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg shadow-sm border border-gray-100 p-4", children: [
42945
43188
  /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-3 text-center", children: "Time Utilization" }),
42946
43189
  pieChartData.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "w-full h-[160px] flex items-center overflow-hidden", children: [
@@ -43016,7 +43259,7 @@ var WorkspaceMonthlyHistory = ({
43016
43259
  ] }) })
43017
43260
  ] }) : /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center h-[160px]", children: /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-400", children: "No data available" }) })
43018
43261
  ] }),
43019
- /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg shadow-sm border border-gray-100 p-4 h-full", children: [
43262
+ idleTimeVlmEnabled && /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg shadow-sm border border-gray-100 p-4 h-full", children: [
43020
43263
  /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-3 text-center", children: "Idle Time Breakdown" }),
43021
43264
  /* @__PURE__ */ jsx("div", { className: "h-[160px]", children: /* @__PURE__ */ jsx(
43022
43265
  IdleTimeReasonChart,
@@ -43820,7 +44063,7 @@ var arePropsEqual = (prevProps, nextProps) => {
43820
44063
  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
43821
44064
  prevProps.position.id === nextProps.position.id;
43822
44065
  };
43823
- var WorkspaceGridItem = React25__default.memo(({
44066
+ var WorkspaceGridItem = React26__default.memo(({
43824
44067
  data,
43825
44068
  position,
43826
44069
  isBottleneck = false,
@@ -43914,7 +44157,7 @@ var WorkspaceGridItem = React25__default.memo(({
43914
44157
  );
43915
44158
  }, arePropsEqual);
43916
44159
  WorkspaceGridItem.displayName = "WorkspaceGridItem";
43917
- var WorkspaceGrid = React25__default.memo(({
44160
+ var WorkspaceGrid = React26__default.memo(({
43918
44161
  workspaces,
43919
44162
  isPdfMode = false,
43920
44163
  customWorkspacePositions,
@@ -44166,7 +44409,7 @@ var KPICard = ({
44166
44409
  }) => {
44167
44410
  useThemeConfig();
44168
44411
  const { formatNumber } = useFormatNumber();
44169
- const trendInfo = React25__default.useMemo(() => {
44412
+ const trendInfo = React26__default.useMemo(() => {
44170
44413
  let trendValue = trend || "neutral";
44171
44414
  if (change !== void 0 && trend === void 0) {
44172
44415
  trendValue = change > 0 ? "up" : change < 0 ? "down" : "neutral";
@@ -44189,7 +44432,7 @@ var KPICard = ({
44189
44432
  const shouldShowTrend = !(change === 0 && trend === void 0);
44190
44433
  return { trendValue, Icon: Icon2, colorClass, shouldShowTrend };
44191
44434
  }, [trend, change]);
44192
- const formattedValue = React25__default.useMemo(() => {
44435
+ const formattedValue = React26__default.useMemo(() => {
44193
44436
  if (title === "Quality Compliance" && typeof value === "number") {
44194
44437
  return value.toFixed(1);
44195
44438
  }
@@ -44203,7 +44446,7 @@ var KPICard = ({
44203
44446
  }
44204
44447
  return value;
44205
44448
  }, [value, title]);
44206
- const formattedChange = React25__default.useMemo(() => {
44449
+ const formattedChange = React26__default.useMemo(() => {
44207
44450
  if (change === void 0 || change === 0) return null;
44208
44451
  const absChange = Math.abs(change);
44209
44452
  return formatNumber(absChange, { minimumFractionDigits: 0, maximumFractionDigits: 1 });
@@ -45651,7 +45894,7 @@ var Breadcrumbs = ({ items }) => {
45651
45894
  }
45652
45895
  }
45653
45896
  };
45654
- 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(React25__default.Fragment, { children: [
45897
+ 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(React26__default.Fragment, { children: [
45655
45898
  index > 0 && /* @__PURE__ */ jsx(ChevronRight, { className: "h-3 w-3 text-gray-400 dark:text-gray-500" }),
45656
45899
  /* @__PURE__ */ jsxs(
45657
45900
  "span",
@@ -46762,7 +47005,7 @@ var AwardBadge = ({
46762
47005
  }) => {
46763
47006
  const styles2 = getBadgeStyles(type);
46764
47007
  const Icon2 = CustomIcon || getDefaultIcon(type);
46765
- const randomDelay = React25__default.useMemo(() => Math.random() * 2, []);
47008
+ const randomDelay = React26__default.useMemo(() => Math.random() * 2, []);
46766
47009
  const floatingAnimation = {
46767
47010
  animate: {
46768
47011
  y: [0, -10, 0],
@@ -52957,7 +53200,7 @@ function HomeView({
52957
53200
  animate: { opacity: 1, scale: 1 },
52958
53201
  transition: { duration: 0.3 },
52959
53202
  className: "h-full",
52960
- children: React25__default.createElement(WorkspaceGrid, {
53203
+ children: React26__default.createElement(WorkspaceGrid, {
52961
53204
  workspaces: workspaceMetrics,
52962
53205
  lineNames,
52963
53206
  factoryView: factoryViewId,
@@ -52988,7 +53231,7 @@ function HomeView({
52988
53231
  animate: { opacity: 1, scale: 1 },
52989
53232
  transition: { duration: 0.3 },
52990
53233
  className: "h-full",
52991
- children: React25__default.createElement(WorkspaceGrid, {
53234
+ children: React26__default.createElement(WorkspaceGrid, {
52992
53235
  workspaces: [],
52993
53236
  // Show empty grid while loading
52994
53237
  lineNames,
@@ -53055,7 +53298,7 @@ function HomeView({
53055
53298
  }
53056
53299
  );
53057
53300
  }
53058
- var AuthenticatedHomeView = withAuth(React25__default.memo(HomeView));
53301
+ var AuthenticatedHomeView = withAuth(React26__default.memo(HomeView));
53059
53302
  var HomeView_default = HomeView;
53060
53303
  function withWorkspaceDisplayNames(Component3, options = {}) {
53061
53304
  const {
@@ -53516,14 +53759,14 @@ var formatLocalDate = (date) => {
53516
53759
  };
53517
53760
  return date.toLocaleDateString("en-US", options);
53518
53761
  };
53519
- var MetricCards = memo$1(({ lineInfo, idleTimeData }) => {
53762
+ var MetricCards = memo$1(({ lineInfo, idleTimeData, showIdleTime }) => {
53520
53763
  return /* @__PURE__ */ jsxs(
53521
53764
  motion.div,
53522
53765
  {
53523
53766
  variants: containerVariants,
53524
53767
  initial: "initial",
53525
53768
  animate: "animate",
53526
- className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3 sm:gap-4 mb-2 md:h-[35vh] h-auto",
53769
+ className: `grid grid-cols-1 sm:grid-cols-2 ${showIdleTime ? "lg:grid-cols-4" : "lg:grid-cols-3"} gap-3 sm:gap-4 mb-2 md:h-[35vh] h-auto`,
53527
53770
  children: [
53528
53771
  /* @__PURE__ */ jsxs(motion.div, { variants: itemVariants, className: "bg-white rounded-xl shadow-sm p-3 sm:p-4 overflow-hidden h-[240px] sm:h-[260px] md:h-auto", children: [
53529
53772
  /* @__PURE__ */ jsx("h2", { className: "text-sm sm:text-base font-semibold text-gray-700 mb-2 text-center", children: "Line Output" }),
@@ -53552,7 +53795,7 @@ var MetricCards = memo$1(({ lineInfo, idleTimeData }) => {
53552
53795
  "%"
53553
53796
  ] }) })
53554
53797
  ] }),
53555
- /* @__PURE__ */ jsxs(motion.div, { variants: itemVariants, className: "bg-white rounded-xl shadow-sm p-3 sm:p-4 overflow-hidden h-[240px] sm:h-[260px] md:h-auto", children: [
53798
+ showIdleTime && /* @__PURE__ */ jsxs(motion.div, { variants: itemVariants, className: "bg-white rounded-xl shadow-sm p-3 sm:p-4 overflow-hidden h-[240px] sm:h-[260px] md:h-auto", children: [
53556
53799
  /* @__PURE__ */ jsx("h2", { className: "text-sm sm:text-base font-semibold text-gray-700 text-center mb-2", children: "Idle Time Breakdown" }),
53557
53800
  /* @__PURE__ */ jsx("div", { className: "h-[calc(100%-2.5rem)]", children: /* @__PURE__ */ jsx(
53558
53801
  IdleTimeReasonChart,
@@ -53568,6 +53811,7 @@ var MetricCards = memo$1(({ lineInfo, idleTimeData }) => {
53568
53811
  );
53569
53812
  }, (prevProps, nextProps) => {
53570
53813
  if (!prevProps.lineInfo || !nextProps.lineInfo) return prevProps.lineInfo === nextProps.lineInfo;
53814
+ if (prevProps.showIdleTime !== nextProps.showIdleTime) return false;
53571
53815
  const prevMetrics = prevProps.lineInfo.metrics;
53572
53816
  const nextMetrics = nextProps.lineInfo.metrics;
53573
53817
  const idleTimeChanged = prevProps.idleTimeData?.isLoading !== nextProps.idleTimeData?.isLoading || prevProps.idleTimeData?.error !== nextProps.idleTimeData?.error || prevProps.idleTimeData?.chartData?.length !== nextProps.idleTimeData?.chartData?.length;
@@ -53707,7 +53951,7 @@ var BottomSection = memo$1(({
53707
53951
  ] }),
53708
53952
  /* @__PURE__ */ jsxs(motion.div, { variants: itemVariants, className: "lg:col-span-3 bg-white rounded-xl shadow-sm p-3 sm:p-4 flex flex-col overflow-hidden h-[350px] sm:h-[400px] md:h-auto", children: [
53709
53953
  /* @__PURE__ */ jsx("h2", { className: "text-base sm:text-lg font-semibold text-gray-700 mb-2 text-center", children: "Hourly Line Output" }),
53710
- /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-[280px] sm:min-h-[300px] md:min-h-[400px] pb-6 sm:pb-8 md:pb-16", children: lineInfo && /* @__PURE__ */ jsx(
53954
+ /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-[280px] sm:min-h-[300px] md:min-h-[400px]", children: lineInfo && /* @__PURE__ */ jsx(
53711
53955
  HourlyOutputChart2,
53712
53956
  {
53713
53957
  data: hourlyOutputData,
@@ -53839,6 +54083,8 @@ var KPIDetailView = ({
53839
54083
  const supervisorEnabled = dashboardConfig?.supervisorConfig?.enabled || false;
53840
54084
  const { supervisorName, supervisors } = useLineSupervisor(lineId);
53841
54085
  const { displayNames: workspaceDisplayNames } = useWorkspaceDisplayNames(lineId, companyId);
54086
+ const { isIdleTimeVlmEnabled } = useIdleTimeVlmConfig();
54087
+ const idleTimeVlmEnabled = isIdleTimeVlmEnabled(lineId);
53842
54088
  useEffect(() => {
53843
54089
  if (urlDate || urlShift !== void 0) {
53844
54090
  setActiveTab("overview");
@@ -53904,7 +54150,7 @@ var KPIDetailView = ({
53904
54150
  });
53905
54151
  const idleTimeDate = historicalRouteRequested ? historicalParamsReady ? urlDate : void 0 : typeof urlDate === "string" ? urlDate : metrics2?.date || cachedLineInfo?.date;
53906
54152
  const idleTimeShiftId = historicalRouteRequested ? historicalParamsReady ? parsedShiftId : void 0 : parsedShiftId ?? metrics2?.shift_id ?? cachedLineInfo?.shift_id;
53907
- const idleTimeEnabled = activeTab === "overview" && !!lineId && !!idleTimeDate && idleTimeShiftId !== void 0 && (!historicalRouteRequested || historicalParamsReady);
54153
+ const idleTimeEnabled = activeTab === "overview" && !!lineId && idleTimeVlmEnabled && !!idleTimeDate && idleTimeShiftId !== void 0 && (!historicalRouteRequested || historicalParamsReady);
53908
54154
  const {
53909
54155
  chartData: idleTimeChartData,
53910
54156
  isLoading: idleTimeLoading,
@@ -54633,7 +54879,7 @@ var KPIDetailView = ({
54633
54879
  exit: "exit",
54634
54880
  className: "space-y-6 md:space-y-0",
54635
54881
  children: resolvedLineInfo && /* @__PURE__ */ jsxs(Fragment, { children: [
54636
- /* @__PURE__ */ jsx(MetricCards, { lineInfo: resolvedLineInfo, idleTimeData }),
54882
+ /* @__PURE__ */ jsx(MetricCards, { lineInfo: resolvedLineInfo, idleTimeData, showIdleTime: idleTimeVlmEnabled }),
54637
54883
  /* @__PURE__ */ jsx(
54638
54884
  BottomSection,
54639
54885
  {
@@ -54691,7 +54937,7 @@ var KPIDetailView = ({
54691
54937
  exit: "exit",
54692
54938
  className: "space-y-6 md:space-y-0",
54693
54939
  children: resolvedLineInfo && /* @__PURE__ */ jsxs(Fragment, { children: [
54694
- /* @__PURE__ */ jsx(MetricCards, { lineInfo: resolvedLineInfo, idleTimeData }),
54940
+ /* @__PURE__ */ jsx(MetricCards, { lineInfo: resolvedLineInfo, idleTimeData, showIdleTime: idleTimeVlmEnabled }),
54695
54941
  /* @__PURE__ */ jsx(
54696
54942
  BottomSection,
54697
54943
  {
@@ -54792,6 +55038,7 @@ var LeaderboardCountdown = ({ targetDate, format: format7, finishedLabel = "Fini
54792
55038
  var LinesLeaderboard = ({
54793
55039
  lines,
54794
55040
  onLineClick,
55041
+ assignedLineIds,
54795
55042
  timeRange,
54796
55043
  setTimeRange,
54797
55044
  todayEfficiencyByLineId,
@@ -54804,7 +55051,18 @@ var LinesLeaderboard = ({
54804
55051
  monthEndDate
54805
55052
  }) => {
54806
55053
  const formatEfficiency = (value) => typeof value === "number" && Number.isFinite(value) ? `${value.toFixed(1)}%` : "--";
54807
- const handleTimeRangeChange = React25__default.useCallback((newRange) => {
55054
+ const assignedLineIdSet = React26__default.useMemo(
55055
+ () => new Set(assignedLineIds || []),
55056
+ [assignedLineIds]
55057
+ );
55058
+ const canClickLine = React26__default.useCallback(
55059
+ (lineId) => {
55060
+ if (!assignedLineIds) return true;
55061
+ return assignedLineIdSet.has(lineId);
55062
+ },
55063
+ [assignedLineIds, assignedLineIdSet]
55064
+ );
55065
+ const handleTimeRangeChange = React26__default.useCallback((newRange) => {
54808
55066
  if (newRange === timeRange) return;
54809
55067
  trackCoreEvent("Leaderboard Time Range Changed", {
54810
55068
  from_range: timeRange,
@@ -54815,7 +55073,8 @@ var LinesLeaderboard = ({
54815
55073
  });
54816
55074
  setTimeRange(newRange);
54817
55075
  }, [timeRange, lines.length, monthlyEfficiencyByLineId, setTimeRange]);
54818
- const handleLeaderboardLineClick = React25__default.useCallback((item, clickSource) => {
55076
+ const handleLeaderboardLineClick = React26__default.useCallback((item, clickSource) => {
55077
+ if (!canClickLine(item.line.id)) return;
54819
55078
  trackCoreEvent("Leaderboard Line Clicked", {
54820
55079
  line_id: item.line.id,
54821
55080
  line_name: item.line.line_name,
@@ -54827,9 +55086,9 @@ var LinesLeaderboard = ({
54827
55086
  supervisor_name: item.supervisorName || "Unassigned"
54828
55087
  });
54829
55088
  onLineClick(item.line);
54830
- }, [onLineClick, timeRange]);
54831
- const viewLoadedTrackedRef = React25__default.useRef(null);
54832
- const leaderboardData = React25__default.useMemo(() => {
55089
+ }, [canClickLine, onLineClick, timeRange]);
55090
+ const viewLoadedTrackedRef = React26__default.useRef(null);
55091
+ const leaderboardData = React26__default.useMemo(() => {
54833
55092
  const loading = timeRange === "today" ? isLoadingToday : isLoadingMonthly;
54834
55093
  const efficiencyMap = timeRange === "today" ? todayEfficiencyByLineId : monthlyEfficiencyByLineId;
54835
55094
  return lines.map((line) => {
@@ -54838,7 +55097,7 @@ var LinesLeaderboard = ({
54838
55097
  const supervisorName = supervisorNamesByLineId.get(line.id) || primarySupervisor?.displayName || "Unassigned";
54839
55098
  const supervisorImage = primarySupervisor?.profilePhotoUrl || null;
54840
55099
  const hasEfficiency = efficiencyMap.has(line.id);
54841
- const efficiency = loading ? null : hasEfficiency ? efficiencyMap.get(line.id) ?? 0 : timeRange === "monthly" ? 0 : null;
55100
+ const efficiency = hasEfficiency ? efficiencyMap.get(line.id) ?? 0 : loading ? null : timeRange === "monthly" ? 0 : null;
54842
55101
  const sortValue = typeof efficiency === "number" ? efficiency : -1;
54843
55102
  return {
54844
55103
  id: line.id,
@@ -54860,7 +55119,7 @@ var LinesLeaderboard = ({
54860
55119
  isLoadingToday,
54861
55120
  isLoadingMonthly
54862
55121
  ]);
54863
- React25__default.useEffect(() => {
55122
+ React26__default.useEffect(() => {
54864
55123
  const isLoading = timeRange === "today" ? isLoadingToday : isLoadingMonthly;
54865
55124
  const trackingKey = `${timeRange}-${leaderboardData.length}`;
54866
55125
  if (leaderboardData.length > 0 && !isLoading && viewLoadedTrackedRef.current !== trackingKey) {
@@ -54886,7 +55145,7 @@ var LinesLeaderboard = ({
54886
55145
  const countdownTarget = timeRange === "monthly" ? monthEndDate : shiftEndDate;
54887
55146
  const countdownFormat = timeRange === "monthly" ? "days" : "clock";
54888
55147
  const countdownFinishedLabel = timeRange === "monthly" ? "Finished" : "Shift Ended";
54889
- const handleCountdownFinished = React25__default.useCallback(() => {
55148
+ const handleCountdownFinished = React26__default.useCallback(() => {
54890
55149
  trackCoreEvent("Leaderboard Countdown Finished", {
54891
55150
  countdown_type: timeRange === "monthly" ? "month_end" : "shift_end",
54892
55151
  time_range: timeRange,
@@ -54913,7 +55172,7 @@ var LinesLeaderboard = ({
54913
55172
  return "bg-white border-gray-100";
54914
55173
  }
54915
55174
  };
54916
- React25__default.useEffect(() => {
55175
+ React26__default.useEffect(() => {
54917
55176
  const style = document.createElement("style");
54918
55177
  style.innerHTML = `
54919
55178
  @keyframes float {
@@ -54981,11 +55240,12 @@ var LinesLeaderboard = ({
54981
55240
  const isFirst = item.rank === 1;
54982
55241
  const isSecond = item.rank === 2;
54983
55242
  item.rank === 3;
55243
+ const isClickable = canClickLine(item.line.id);
54984
55244
  return /* @__PURE__ */ jsxs(
54985
55245
  "div",
54986
55246
  {
54987
55247
  onClick: () => handleLeaderboardLineClick(item, "podium"),
54988
- className: `relative flex flex-col items-center cursor-pointer z-10 transition-transform hover:scale-105`,
55248
+ className: `relative flex flex-col items-center z-10 transition-transform ${isClickable ? "cursor-pointer hover:scale-105" : "cursor-not-allowed"}`,
54989
55249
  children: [
54990
55250
  /* @__PURE__ */ jsxs("div", { className: `relative -mb-4 z-20 ${isFirst ? "animate-float-slow" : isSecond ? "animate-float-medium" : "animate-float-fast"}`, children: [
54991
55251
  /* @__PURE__ */ jsx("div", { className: `absolute inset-0 rounded-full blur-xl opacity-40 ${isFirst ? "bg-yellow-400" : isSecond ? "bg-gray-400" : "bg-orange-400"}` }),
@@ -55046,11 +55306,12 @@ var LinesLeaderboard = ({
55046
55306
  ] }) }),
55047
55307
  /* @__PURE__ */ jsx("tbody", { className: "divide-y divide-gray-100", children: leaderboardData.map((item) => {
55048
55308
  const isTopThree = item.rank <= 3;
55309
+ const isClickable = canClickLine(item.line.id);
55049
55310
  return /* @__PURE__ */ jsxs(
55050
55311
  "tr",
55051
55312
  {
55052
55313
  onClick: () => handleLeaderboardLineClick(item, isTopThree ? "podium" : "table"),
55053
- className: `hover:bg-gray-50 transition-colors cursor-pointer group ${isTopThree ? "sm:hidden" : ""}`,
55314
+ className: `transition-colors ${isTopThree ? "sm:hidden" : ""} ${isClickable ? "hover:bg-gray-50 cursor-pointer group" : "cursor-not-allowed"}`,
55054
55315
  children: [
55055
55316
  /* @__PURE__ */ jsx("td", { className: "px-4 py-3 whitespace-nowrap", children: /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center w-8 h-8 rounded-full bg-gray-100 text-gray-600 font-bold text-sm", children: item.rank }) }),
55056
55317
  /* @__PURE__ */ jsx("td", { className: "px-4 py-3 whitespace-nowrap", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
@@ -55097,7 +55358,7 @@ var LineCard = ({
55097
55358
  supervisorName,
55098
55359
  supervisors
55099
55360
  }) => {
55100
- const isOnTrack = React25__default.useMemo(() => {
55361
+ const isOnTrack = React26__default.useMemo(() => {
55101
55362
  if (!kpis) return null;
55102
55363
  return kpis.efficiency.value > 90;
55103
55364
  }, [kpis]);
@@ -55245,6 +55506,7 @@ var KPIsOverviewView = ({
55245
55506
  lineIds
55246
55507
  }) => {
55247
55508
  const [lines, setLines] = useState([]);
55509
+ const [leaderboardLines, setLeaderboardLines] = useState([]);
55248
55510
  const [activeTab, setActiveTab] = useState("today");
55249
55511
  const [timeRange, setTimeRange] = useState("today");
55250
55512
  const [loading, setLoading] = useState(true);
@@ -55260,11 +55522,16 @@ var KPIsOverviewView = ({
55260
55522
  });
55261
55523
  const [topPerformerLoading, setTopPerformerLoading] = useState(true);
55262
55524
  const [topPerformerImageError, setTopPerformerImageError] = useState(false);
55525
+ const [todayEfficiencyByLineId, setTodayEfficiencyByLineId] = useState(/* @__PURE__ */ new Map());
55526
+ const [dailyLoading, setDailyLoading] = useState(false);
55527
+ const [dailyError, setDailyError] = useState(null);
55263
55528
  const [monthlyEfficiencyByLineId, setMonthlyEfficiencyByLineId] = useState(/* @__PURE__ */ new Map());
55264
55529
  const [monthlyLoading, setMonthlyLoading] = useState(false);
55265
55530
  const [monthlyError, setMonthlyError] = useState(null);
55531
+ const dailyRequestKeyRef = useRef(null);
55266
55532
  const monthlyRequestKeyRef = useRef(null);
55267
55533
  const supabase = useSupabase();
55534
+ const { user } = useAuth();
55268
55535
  const dashboardConfig = useDashboardConfig();
55269
55536
  const entityConfig = useEntityConfig();
55270
55537
  const configCompanyId = (dashboardConfig && typeof dashboardConfig === "object" && "company" in dashboardConfig ? dashboardConfig.company?.id : void 0) || dashboardConfig.customConfig?.companyId || dashboardConfig.customConfig?.company_id;
@@ -55279,6 +55546,16 @@ var KPIsOverviewView = ({
55279
55546
  const dbTimezone = useAppTimezone();
55280
55547
  const configuredTimezone = dbTimezone || dateTimeConfig.defaultTimezone || "UTC";
55281
55548
  const { startDate: monthStartDate, endDate: monthEndDateKey, monthEndDate } = getMonthDateInfo(configuredTimezone);
55549
+ const isSupervisor = user?.role_level === "supervisor";
55550
+ const assignedLineIdsForLeaderboard = isSupervisor ? lineIds : void 0;
55551
+ const currentShiftDetails = getCurrentShift(configuredTimezone, shiftConfig);
55552
+ const currentShiftDate = currentShiftDetails.date;
55553
+ const currentShiftId = currentShiftDetails.shiftId;
55554
+ const shiftEndDate = React26__default.useMemo(
55555
+ () => getShiftEndDate(currentShiftDetails, configuredTimezone),
55556
+ [currentShiftDetails, configuredTimezone]
55557
+ );
55558
+ const shiftName = (currentShiftDetails.shiftName || "Day").replace(/ Shift$/i, "");
55282
55559
  const factoryViewId = entityConfig.factoryViewId || "factory";
55283
55560
  const {
55284
55561
  lineMetrics,
@@ -55288,27 +55565,22 @@ var KPIsOverviewView = ({
55288
55565
  lineId: factoryViewId,
55289
55566
  userAccessibleLineIds: lineIds
55290
55567
  });
55291
- const defaultKPIs = React25__default.useMemo(() => createDefaultKPIs(), []);
55292
- const kpisByLineId = React25__default.useMemo(() => {
55568
+ const defaultKPIs = React26__default.useMemo(() => createDefaultKPIs(), []);
55569
+ const kpisByLineId = React26__default.useMemo(() => {
55293
55570
  const map = /* @__PURE__ */ new Map();
55294
55571
  lineMetrics.forEach((row) => {
55295
55572
  if (row?.line_id) map.set(row.line_id, buildKPIsFromLineMetricsRow(row));
55296
55573
  });
55297
55574
  return map;
55298
55575
  }, [lineMetrics]);
55299
- const todayEfficiencyByLineId = React25__default.useMemo(() => {
55300
- const map = /* @__PURE__ */ new Map();
55301
- kpisByLineId.forEach((kpis, lineId) => {
55302
- const value = kpis?.efficiency?.value;
55303
- if (typeof value === "number" && Number.isFinite(value)) {
55304
- map.set(lineId, value);
55305
- }
55306
- });
55307
- return map;
55308
- }, [kpisByLineId]);
55309
- const visibleLineIds = React25__default.useMemo(() => lines.map((l) => l.id), [lines]);
55310
- const { supervisorNamesByLineId, supervisorsByLineId, allSupervisorsMap } = useSupervisorsByLineIds(visibleLineIds, {
55311
- enabled: supervisorEnabled && visibleLineIds.length > 0
55576
+ const supervisorLineIds = React26__default.useMemo(
55577
+ () => (leaderboardLines.length > 0 ? leaderboardLines : lines).map((l) => l.id),
55578
+ [leaderboardLines, lines]
55579
+ );
55580
+ const { supervisorNamesByLineId, supervisorsByLineId, allSupervisorsMap } = useSupervisorsByLineIds(supervisorLineIds, {
55581
+ enabled: supervisorEnabled && supervisorLineIds.length > 0,
55582
+ companyId: resolvedCompanyId,
55583
+ useBackend: true
55312
55584
  });
55313
55585
  useEffect(() => {
55314
55586
  let isMounted = true;
@@ -55369,9 +55641,41 @@ var KPIsOverviewView = ({
55369
55641
  };
55370
55642
  fetchLines();
55371
55643
  }, [supabase, dashboardConfig, lineIds]);
55644
+ useEffect(() => {
55645
+ let isMounted = true;
55646
+ const fetchLeaderboardLines = async () => {
55647
+ if (!supabase || !resolvedCompanyId) {
55648
+ setLeaderboardLines(lines);
55649
+ return;
55650
+ }
55651
+ try {
55652
+ const linesService2 = new LinesService(supabase);
55653
+ const companyLines = await linesService2.getLinesByCompanyId(resolvedCompanyId);
55654
+ if (!isMounted) return;
55655
+ const transformed = companyLines.map((line) => ({
55656
+ id: line.id,
55657
+ line_name: line.name,
55658
+ factory_id: line.factoryId || "",
55659
+ factory_name: "N/A",
55660
+ company_id: line.companyId,
55661
+ company_name: "",
55662
+ enable: line.isActive ?? true
55663
+ }));
55664
+ setLeaderboardLines(transformed);
55665
+ } catch (err) {
55666
+ console.error("[KPIsOverviewView] Failed to load leaderboard lines:", err);
55667
+ if (!isMounted) return;
55668
+ setLeaderboardLines(lines);
55669
+ }
55670
+ };
55671
+ fetchLeaderboardLines();
55672
+ return () => {
55673
+ isMounted = false;
55674
+ };
55675
+ }, [supabase, resolvedCompanyId, lines]);
55372
55676
  const fetchMonthlyLeaderboard = useCallback(async () => {
55373
- if (!supabase || !resolvedCompanyId || lines.length === 0) return;
55374
- const targetLineIds = lines.map((line) => line.id);
55677
+ if (!supabase || !resolvedCompanyId || leaderboardLines.length === 0) return;
55678
+ const targetLineIds = leaderboardLines.map((line) => line.id);
55375
55679
  const lineIdsKey = targetLineIds.slice().sort().join(",");
55376
55680
  const requestKey = `${resolvedCompanyId}|${monthStartDate}|${monthEndDateKey}|${lineIdsKey}`;
55377
55681
  if (monthlyRequestKeyRef.current === requestKey) return;
@@ -55385,8 +55689,7 @@ var KPIsOverviewView = ({
55385
55689
  const entries = await lineLeaderboardService.getLineLeaderboard(supabase, {
55386
55690
  companyId: resolvedCompanyId,
55387
55691
  startDate: monthStartDate,
55388
- endDate: monthEndDateKey,
55389
- lineIds: targetLineIds
55692
+ endDate: monthEndDateKey
55390
55693
  });
55391
55694
  const nextMap = /* @__PURE__ */ new Map();
55392
55695
  targetLineIds.forEach((lineId) => nextMap.set(lineId, 0));
@@ -55419,11 +55722,47 @@ var KPIsOverviewView = ({
55419
55722
  } finally {
55420
55723
  setMonthlyLoading(false);
55421
55724
  }
55422
- }, [supabase, resolvedCompanyId, lines, monthStartDate, monthEndDateKey]);
55725
+ }, [supabase, resolvedCompanyId, leaderboardLines, monthStartDate, monthEndDateKey]);
55726
+ const fetchDailyLeaderboard = useCallback(async () => {
55727
+ if (!supabase || !resolvedCompanyId || leaderboardLines.length === 0) return;
55728
+ if (!currentShiftDate) return;
55729
+ const targetLineIds = leaderboardLines.map((line) => line.id);
55730
+ const lineIdsKey = targetLineIds.slice().sort().join(",");
55731
+ const requestKey = `${resolvedCompanyId}|${currentShiftDate}|${currentShiftId}|${lineIdsKey}`;
55732
+ if (dailyRequestKeyRef.current === requestKey) return;
55733
+ dailyRequestKeyRef.current = requestKey;
55734
+ setDailyLoading(true);
55735
+ setDailyError(null);
55736
+ try {
55737
+ const entries = await lineLeaderboardService.getDailyLineLeaderboard(supabase, {
55738
+ companyId: resolvedCompanyId,
55739
+ date: currentShiftDate,
55740
+ shiftId: currentShiftId
55741
+ });
55742
+ const nextMap = /* @__PURE__ */ new Map();
55743
+ entries.forEach((entry) => {
55744
+ const value = Number(entry.avg_efficiency);
55745
+ if (Number.isFinite(value)) {
55746
+ nextMap.set(entry.line_id, value);
55747
+ }
55748
+ });
55749
+ setTodayEfficiencyByLineId(nextMap);
55750
+ } catch (err) {
55751
+ console.error("[KPIsOverviewView] Failed to load daily leaderboard:", err);
55752
+ setDailyError("Failed to load daily leaderboard");
55753
+ dailyRequestKeyRef.current = null;
55754
+ } finally {
55755
+ setDailyLoading(false);
55756
+ }
55757
+ }, [supabase, resolvedCompanyId, leaderboardLines, currentShiftDate, currentShiftId]);
55423
55758
  useEffect(() => {
55424
55759
  if (activeTab !== "leaderboard") return;
55425
55760
  fetchMonthlyLeaderboard();
55426
55761
  }, [activeTab, timeRange, fetchMonthlyLeaderboard]);
55762
+ useEffect(() => {
55763
+ if (activeTab !== "leaderboard" || timeRange !== "today") return;
55764
+ fetchDailyLeaderboard();
55765
+ }, [activeTab, timeRange, fetchDailyLeaderboard]);
55427
55766
  const formatTopPerformerWeek = (periodStart, periodEnd) => {
55428
55767
  if (!periodStart || !periodEnd) return "Last Week";
55429
55768
  const startDate = /* @__PURE__ */ new Date(`${periodStart}T00:00:00`);
@@ -55519,14 +55858,15 @@ var KPIsOverviewView = ({
55519
55858
  }, [onBackClick, backLinkUrl, navigation]);
55520
55859
  const handleTabChange = useCallback((newTab) => {
55521
55860
  if (newTab === activeTab) return;
55861
+ const trackedLineCount = newTab === "leaderboard" ? leaderboardLines.length : lines.length;
55522
55862
  trackCoreEvent("Leaderboard Tab Switched", {
55523
55863
  from_tab: activeTab,
55524
55864
  to_tab: newTab,
55525
55865
  from_page: "kpis_overview",
55526
- lines_count: lines.length
55866
+ lines_count: trackedLineCount
55527
55867
  });
55528
55868
  setActiveTab(newTab);
55529
- }, [activeTab, lines.length]);
55869
+ }, [activeTab, leaderboardLines.length, lines.length]);
55530
55870
  const formatLocalDate2 = (date) => {
55531
55871
  const options = {
55532
55872
  year: "numeric",
@@ -55544,12 +55884,6 @@ var KPIsOverviewView = ({
55544
55884
  return `${startLabel} - ${endLabel}, ${now4.getFullYear()}`;
55545
55885
  };
55546
55886
  const isMonthlyMode = activeTab === "leaderboard" && timeRange === "monthly";
55547
- const currentShiftDetails = getCurrentShift(configuredTimezone, shiftConfig);
55548
- const shiftEndDate = React25__default.useMemo(
55549
- () => getShiftEndDate(currentShiftDetails, configuredTimezone),
55550
- [currentShiftDetails, configuredTimezone]
55551
- );
55552
- const shiftName = (currentShiftDetails.shiftName || "Day").replace(/ Shift$/i, "");
55553
55887
  const showTopPerformerImage = Boolean(topPerformer.imageUrl) && !topPerformerImageError;
55554
55888
  typeof topPerformer.efficiency === "number" && Number.isFinite(topPerformer.efficiency);
55555
55889
  topPerformerLoading ? "--" : typeof topPerformer.efficiency === "number" && Number.isFinite(topPerformer.efficiency) ? `${topPerformer.efficiency.toFixed(1)}%` : "--";
@@ -55902,15 +56236,16 @@ var KPIsOverviewView = ({
55902
56236
  /* @__PURE__ */ jsx("div", { className: "w-full h-full", children: /* @__PURE__ */ jsx(
55903
56237
  LinesLeaderboard,
55904
56238
  {
55905
- lines,
56239
+ lines: leaderboardLines,
55906
56240
  onLineClick: (line) => handleLineClick(line),
56241
+ assignedLineIds: assignedLineIdsForLeaderboard,
55907
56242
  timeRange,
55908
56243
  setTimeRange,
55909
56244
  todayEfficiencyByLineId,
55910
56245
  monthlyEfficiencyByLineId,
55911
56246
  supervisorsByLineId,
55912
56247
  supervisorNamesByLineId,
55913
- isLoadingToday: metricsLoading,
56248
+ isLoadingToday: dailyLoading,
55914
56249
  isLoadingMonthly: monthlyLoading,
55915
56250
  shiftEndDate,
55916
56251
  monthEndDate
@@ -55924,6 +56259,15 @@ var IsolatedTimer = memo$1(() => {
55924
56259
  return /* @__PURE__ */ jsx(ISTTimer_default, {});
55925
56260
  });
55926
56261
  IsolatedTimer.displayName = "IsolatedTimer";
56262
+ var AnimatedEfficiency = memo$1(({ value }) => {
56263
+ return /* @__PURE__ */ jsxs("span", { className: "tabular-nums", children: [
56264
+ value.toFixed(1),
56265
+ "%"
56266
+ ] });
56267
+ }, (prevProps, nextProps) => {
56268
+ return prevProps.value === nextProps.value;
56269
+ });
56270
+ AnimatedEfficiency.displayName = "AnimatedEfficiency";
55927
56271
  var HeaderRibbon = memo$1(({
55928
56272
  currentDate,
55929
56273
  currentMobileDate,
@@ -55974,14 +56318,16 @@ var MobileWorkspaceCard = memo$1(({
55974
56318
  onWorkspaceClick,
55975
56319
  getMedalIcon
55976
56320
  }) => /* @__PURE__ */ jsx(
55977
- "div",
56321
+ motion.div,
55978
56322
  {
55979
- onClick: () => onWorkspaceClick(workspace, rank),
55980
- className: `${cardClass} p-3 rounded-lg border shadow-sm active:scale-[0.98] transition-all duration-300 cursor-pointer`,
55981
- style: {
55982
- willChange: "opacity, transform",
55983
- animation: "fadeIn 0.3s ease-in-out"
56323
+ layout: true,
56324
+ layoutId: `mobile-${workspace.workspace_uuid}`,
56325
+ initial: false,
56326
+ transition: {
56327
+ layout: { duration: 0.3, ease: "easeInOut" }
55984
56328
  },
56329
+ onClick: () => onWorkspaceClick(workspace, rank),
56330
+ className: `${cardClass} p-3 rounded-lg border shadow-sm active:scale-[0.98] cursor-pointer`,
55985
56331
  children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-2", children: [
55986
56332
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
55987
56333
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
@@ -55997,16 +56343,13 @@ var MobileWorkspaceCard = memo$1(({
55997
56343
  ] })
55998
56344
  ] }),
55999
56345
  /* @__PURE__ */ jsxs("div", { className: "text-right", children: [
56000
- /* @__PURE__ */ jsxs("div", { className: "text-lg font-bold text-gray-900", children: [
56001
- (workspace.efficiency || 0).toFixed(1),
56002
- "%"
56003
- ] }),
56346
+ /* @__PURE__ */ jsx("div", { className: "text-lg font-bold text-gray-900", children: /* @__PURE__ */ jsx(AnimatedEfficiency, { value: workspace.efficiency || 0 }) }),
56004
56347
  /* @__PURE__ */ jsx("div", { className: "text-xs text-gray-500", children: "Efficiency" })
56005
56348
  ] })
56006
56349
  ] })
56007
56350
  }
56008
56351
  ), (prevProps, nextProps) => {
56009
- return prevProps.rank === nextProps.rank && prevProps.cardClass === nextProps.cardClass && prevProps.workspace.workspace_uuid === nextProps.workspace.workspace_uuid && prevProps.workspace.efficiency === nextProps.workspace.efficiency && prevProps.workspace.action_count === nextProps.workspace.action_count && prevProps.workspace.action_threshold === nextProps.workspace.action_threshold && prevProps.workspace.avg_cycle_time === nextProps.workspace.avg_cycle_time && prevProps.workspace.displayName === nextProps.workspace.displayName && prevProps.workspace.lineName === nextProps.workspace.lineName && prevProps.onWorkspaceClick === nextProps.onWorkspaceClick && prevProps.getMedalIcon === nextProps.getMedalIcon;
56352
+ return prevProps.rank === nextProps.rank && prevProps.cardClass === nextProps.cardClass && prevProps.workspace.workspace_uuid === nextProps.workspace.workspace_uuid && prevProps.workspace.efficiency === nextProps.workspace.efficiency && prevProps.workspace.action_count === nextProps.workspace.action_count && prevProps.workspace.action_threshold === nextProps.workspace.action_threshold && prevProps.workspace.avg_cycle_time === nextProps.workspace.avg_cycle_time && prevProps.workspace.displayName === nextProps.workspace.displayName && prevProps.workspace.lineName === nextProps.workspace.lineName;
56010
56353
  });
56011
56354
  MobileWorkspaceCard.displayName = "MobileWorkspaceCard";
56012
56355
  var DesktopWorkspaceRow = memo$1(({
@@ -56016,14 +56359,14 @@ var DesktopWorkspaceRow = memo$1(({
56016
56359
  onWorkspaceClick,
56017
56360
  getMedalIcon
56018
56361
  }) => /* @__PURE__ */ jsxs(
56019
- "tr",
56362
+ motion.tr,
56020
56363
  {
56364
+ layout: true,
56365
+ layoutId: `row-${workspace.workspace_uuid}`,
56366
+ initial: false,
56367
+ transition: { layout: { duration: 0.3, ease: "easeInOut" } },
56021
56368
  onClick: () => onWorkspaceClick(workspace, index + 1),
56022
- className: `${rowClass} hover:bg-gray-50/90 transition-all duration-300 cursor-pointer group`,
56023
- style: {
56024
- willChange: "opacity, background-color",
56025
- animation: "fadeIn 0.3s ease-in-out"
56026
- },
56369
+ className: `${rowClass} hover:bg-gray-50/90 transition-colors duration-150 cursor-pointer group`,
56027
56370
  children: [
56028
56371
  /* @__PURE__ */ jsx("td", { className: "px-3 py-2.5 sm:p-4 text-sm sm:text-base whitespace-nowrap group-hover:font-medium", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
56029
56372
  /* @__PURE__ */ jsx("span", { children: index + 1 }),
@@ -56031,14 +56374,11 @@ var DesktopWorkspaceRow = memo$1(({
56031
56374
  ] }) }),
56032
56375
  /* @__PURE__ */ jsx("td", { className: "px-3 py-2.5 sm:p-4 text-sm sm:text-base whitespace-nowrap", children: /* @__PURE__ */ jsx("div", { className: "font-medium", children: workspace.displayName }) }),
56033
56376
  /* @__PURE__ */ jsx("td", { className: "px-3 py-2.5 sm:p-4 text-sm sm:text-base whitespace-nowrap", children: /* @__PURE__ */ jsx("div", { className: "font-medium", children: workspace.lineName }) }),
56034
- /* @__PURE__ */ jsxs("td", { className: "px-3 py-2.5 sm:p-4 text-sm sm:text-base font-medium whitespace-nowrap", children: [
56035
- (workspace.efficiency || 0).toFixed(1),
56036
- "%"
56037
- ] })
56377
+ /* @__PURE__ */ jsx("td", { className: "px-3 py-2.5 sm:p-4 text-sm sm:text-base font-medium whitespace-nowrap", children: /* @__PURE__ */ jsx(AnimatedEfficiency, { value: workspace.efficiency || 0 }) })
56038
56378
  ]
56039
56379
  }
56040
56380
  ), (prevProps, nextProps) => {
56041
- return prevProps.index === nextProps.index && prevProps.rowClass === nextProps.rowClass && prevProps.workspace.workspace_uuid === nextProps.workspace.workspace_uuid && prevProps.workspace.efficiency === nextProps.workspace.efficiency && prevProps.workspace.displayName === nextProps.workspace.displayName && prevProps.workspace.lineName === nextProps.workspace.lineName && prevProps.onWorkspaceClick === nextProps.onWorkspaceClick && prevProps.getMedalIcon === nextProps.getMedalIcon;
56381
+ return prevProps.index === nextProps.index && prevProps.rowClass === nextProps.rowClass && prevProps.workspace.workspace_uuid === nextProps.workspace.workspace_uuid && prevProps.workspace.efficiency === nextProps.workspace.efficiency && prevProps.workspace.displayName === nextProps.workspace.displayName && prevProps.workspace.lineName === nextProps.workspace.lineName;
56042
56382
  });
56043
56383
  DesktopWorkspaceRow.displayName = "DesktopWorkspaceRow";
56044
56384
  var LeaderboardDetailView = memo$1(({
@@ -56133,6 +56473,10 @@ var LeaderboardDetailView = memo$1(({
56133
56473
  const filterRef = useRef(null);
56134
56474
  const filterButtonRef = useRef(null);
56135
56475
  const mobileFilterButtonRef = useRef(null);
56476
+ const workspacesLengthRef = useRef(0);
56477
+ const handleWorkspaceClickRef = useRef(() => {
56478
+ });
56479
+ const getMedalIconRef = useRef(() => null);
56136
56480
  useEffect(() => {
56137
56481
  const handleClickOutside = (event) => {
56138
56482
  const target = event.target;
@@ -56147,7 +56491,7 @@ var LeaderboardDetailView = memo$1(({
56147
56491
  return () => document.removeEventListener("mousedown", handleClickOutside);
56148
56492
  }, []);
56149
56493
  const [isMobile, setIsMobile] = useState(false);
56150
- React25__default.useEffect(() => {
56494
+ React26__default.useEffect(() => {
56151
56495
  const checkMobile = () => setIsMobile(window.innerWidth < 640);
56152
56496
  checkMobile();
56153
56497
  window.addEventListener("resize", checkMobile);
@@ -56541,7 +56885,7 @@ var LeaderboardDetailView = memo$1(({
56541
56885
  () => activeTab === "monthly" ? monthlyEntries : todayEntries,
56542
56886
  [activeTab, monthlyEntries, todayEntries]
56543
56887
  );
56544
- const workspacesLength = useMemo(() => activeEntries.length || 0, [activeEntries]);
56888
+ useMemo(() => activeEntries.length || 0, [activeEntries]);
56545
56889
  const monthlyRangeText = useMemo(() => {
56546
56890
  const startDate = new Date(normalizedRange.startKey);
56547
56891
  const endDate = new Date(normalizedRange.endKey);
@@ -56552,7 +56896,8 @@ var LeaderboardDetailView = memo$1(({
56552
56896
  workspace_name: workspace.workspace_name,
56553
56897
  workspace_id: workspace.workspace_uuid,
56554
56898
  rank,
56555
- total_workspaces: workspacesLength,
56899
+ total_workspaces: workspacesLengthRef.current,
56900
+ // Use ref instead of state to avoid dependency
56556
56901
  efficiency: workspace.efficiency,
56557
56902
  action_count: workspace.action_count,
56558
56903
  action_threshold: workspace.action_threshold
@@ -56579,7 +56924,22 @@ var LeaderboardDetailView = memo$1(({
56579
56924
  const combinedParams = navParams ? `${navParams}&${contextParamString}` : `?${contextParamString}`;
56580
56925
  navigation.navigate(`/workspace/${workspace.workspace_uuid}${combinedParams}`);
56581
56926
  }
56582
- }, [onWorkspaceClick, navigation, workspacesLength, date, shiftId]);
56927
+ }, [onWorkspaceClick, navigation, date, shiftId]);
56928
+ useEffect(() => {
56929
+ workspacesLengthRef.current = activeEntries.length || 0;
56930
+ }, [activeEntries.length]);
56931
+ useEffect(() => {
56932
+ handleWorkspaceClickRef.current = handleWorkspaceClick;
56933
+ }, [handleWorkspaceClick]);
56934
+ useEffect(() => {
56935
+ getMedalIconRef.current = getMedalIcon;
56936
+ }, [getMedalIcon]);
56937
+ const stableHandleWorkspaceClick = useCallback((workspace, rank) => {
56938
+ handleWorkspaceClickRef.current(workspace, rank);
56939
+ }, []);
56940
+ const stableGetMedalIcon = useCallback((rank) => {
56941
+ return getMedalIconRef.current(rank);
56942
+ }, []);
56583
56943
  const workspaceDisplayData = useMemo(() => {
56584
56944
  if (!activeEntries || activeEntries.length === 0) return [];
56585
56945
  return activeEntries.map((ws) => ({
@@ -56825,7 +57185,7 @@ var LeaderboardDetailView = memo$1(({
56825
57185
  ] })
56826
57186
  ] })
56827
57187
  ] }) }),
56828
- /* @__PURE__ */ jsx("div", { className: "flex-1 w-full mx-auto p-3 sm:p-4 md:p-6", children: isMobile ? /* @__PURE__ */ jsx("div", { className: "space-y-3", children: sortedWorkspaces.map((ws, index) => {
57188
+ /* @__PURE__ */ jsx("div", { className: "flex-1 w-full mx-auto p-3 sm:p-4 md:p-6", children: isMobile ? /* @__PURE__ */ jsx(LayoutGroup, { children: /* @__PURE__ */ jsx("div", { className: "space-y-3", children: sortedWorkspaces.map((ws, index) => {
56829
57189
  const rank = index + 1;
56830
57190
  const isTopThree = index < 3;
56831
57191
  const cardClass = sortAscending ? isTopThree ? "bg-red-50/90 border-red-200" : "bg-white" : isTopThree ? "bg-green-50/90 border-green-200" : "bg-white";
@@ -56835,14 +57195,14 @@ var LeaderboardDetailView = memo$1(({
56835
57195
  workspace: ws,
56836
57196
  rank,
56837
57197
  cardClass,
56838
- onWorkspaceClick: handleWorkspaceClick,
56839
- getMedalIcon
57198
+ onWorkspaceClick: stableHandleWorkspaceClick,
57199
+ getMedalIcon: stableGetMedalIcon
56840
57200
  },
56841
57201
  ws.workspace_uuid
56842
57202
  );
56843
- }) }) : (
57203
+ }) }) }) : (
56844
57204
  /* Desktop table view - only render on desktop */
56845
- /* @__PURE__ */ jsx("div", { className: "bg-white rounded-lg shadow-md overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "overflow-auto", children: /* @__PURE__ */ jsxs("table", { className: "w-full border-collapse table-auto", children: [
57205
+ /* @__PURE__ */ jsx("div", { className: "bg-white rounded-lg shadow-md overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "overflow-auto", children: /* @__PURE__ */ jsx(LayoutGroup, { children: /* @__PURE__ */ jsxs("table", { className: "w-full border-collapse table-auto", children: [
56846
57206
  /* @__PURE__ */ jsx("thead", { className: "bg-gray-50 border-b border-gray-200 sticky top-0 z-10", children: /* @__PURE__ */ jsxs("tr", { children: [
56847
57207
  /* @__PURE__ */ jsx("th", { className: "px-3 py-2.5 sm:p-4 text-left text-xs sm:text-sm font-semibold text-gray-600 whitespace-nowrap", children: "Rank" }),
56848
57208
  /* @__PURE__ */ jsx("th", { className: "px-3 py-2.5 sm:p-4 text-left text-xs sm:text-sm font-semibold text-gray-600 whitespace-nowrap", children: "Workspace" }),
@@ -56858,13 +57218,13 @@ var LeaderboardDetailView = memo$1(({
56858
57218
  workspace: ws,
56859
57219
  index,
56860
57220
  rowClass,
56861
- onWorkspaceClick: handleWorkspaceClick,
56862
- getMedalIcon
57221
+ onWorkspaceClick: stableHandleWorkspaceClick,
57222
+ getMedalIcon: stableGetMedalIcon
56863
57223
  },
56864
57224
  ws.workspace_uuid
56865
57225
  );
56866
57226
  }) })
56867
- ] }) }) })
57227
+ ] }) }) }) })
56868
57228
  ) })
56869
57229
  ] });
56870
57230
  }, (prevProps, nextProps) => {
@@ -57922,7 +58282,7 @@ var ShiftsView = ({
57922
58282
  ] })
57923
58283
  ] });
57924
58284
  };
57925
- var AuthenticatedShiftsView = withAuth(React25__default.memo(ShiftsView));
58285
+ var AuthenticatedShiftsView = withAuth(React26__default.memo(ShiftsView));
57926
58286
  var ShiftsView_default = ShiftsView;
57927
58287
 
57928
58288
  // src/lib/constants/actions.ts
@@ -59810,7 +60170,7 @@ var TargetsView = ({
59810
60170
  };
59811
60171
  var TargetsViewWithDisplayNames = withAllWorkspaceDisplayNames(TargetsView);
59812
60172
  var TargetsView_default = TargetsViewWithDisplayNames;
59813
- var AuthenticatedTargetsView = withAuth(React25__default.memo(TargetsViewWithDisplayNames));
60173
+ var AuthenticatedTargetsView = withAuth(React26__default.memo(TargetsViewWithDisplayNames));
59814
60174
 
59815
60175
  // src/views/workspace-detail-view.utils.ts
59816
60176
  var formatDateInTimezone = (date = /* @__PURE__ */ new Date(), timezone, options) => {
@@ -59939,7 +60299,8 @@ var WorkspaceDetailView = ({
59939
60299
  const [activeTab, setActiveTab] = useState(initialTab);
59940
60300
  const [isTransitioning, setIsTransitioning] = useState(false);
59941
60301
  const [usingFallbackData, setUsingFallbackData] = useState(false);
59942
- const [showIdleTime, setShowIdleTime] = useState(false);
60302
+ const { isIdleTimeVlmEnabled } = useIdleTimeVlmConfig();
60303
+ const [showChartIdleTime, setShowChartIdleTime] = useState(false);
59943
60304
  const dashboardConfig = useDashboardConfig();
59944
60305
  const { legend: efficiencyLegend } = useEfficiencyLegend();
59945
60306
  const prewarmedClipsRef = useRef(/* @__PURE__ */ new Set());
@@ -60211,6 +60572,7 @@ var WorkspaceDetailView = ({
60211
60572
  const efficiencyValue = workspace?.avg_efficiency ?? 0;
60212
60573
  const efficiencyTarget = efficiencyLegend.green_min;
60213
60574
  const efficiencyColor = getEfficiencyHexColor(efficiencyValue, efficiencyLegend);
60575
+ const idleTimeVlmEnabled = isIdleTimeVlmEnabled(effectiveLineId || workspace?.line_id);
60214
60576
  useEffect(() => {
60215
60577
  if (!isClipsEnabled || !dashboardConfig?.s3Config || !workspaceId) {
60216
60578
  return;
@@ -60298,7 +60660,7 @@ var WorkspaceDetailView = ({
60298
60660
  const idleTimeReasonsDate = date || workspace?.date || calculatedOperationalDate || getOperationalDate(timezone);
60299
60661
  const idleTimeReasonsShiftId = parsedShiftId ?? workspace?.shift_id ?? calculatedShiftId;
60300
60662
  const idleTimeReasonsEnabled = Boolean(
60301
- workspaceId && idleTimeReasonsDate && idleTimeReasonsShiftId !== void 0
60663
+ workspaceId && idleTimeReasonsDate && idleTimeReasonsShiftId !== void 0 && idleTimeVlmEnabled
60302
60664
  );
60303
60665
  useEffect(() => {
60304
60666
  if (!DEBUG_DASHBOARD2) return;
@@ -60427,7 +60789,7 @@ var WorkspaceDetailView = ({
60427
60789
  const idleClipDate = date || workspace?.date || calculatedOperationalDate || getOperationalDate(timezone);
60428
60790
  const idleClipShiftId = parsedShiftId ?? workspace?.shift_id;
60429
60791
  const idleClipFetchEnabled = Boolean(
60430
- workspaceId && idleClipDate && idleClipShiftId !== void 0 && activeTab === "overview" && showIdleTime && !shouldShowCycleTimeChart
60792
+ workspaceId && idleClipDate && idleClipShiftId !== void 0 && activeTab === "overview" && idleTimeVlmEnabled && !shouldShowCycleTimeChart
60431
60793
  );
60432
60794
  const {
60433
60795
  idleClips: idleTimeClips,
@@ -60853,9 +61215,9 @@ var WorkspaceDetailView = ({
60853
61215
  /* @__PURE__ */ jsx(
60854
61216
  "button",
60855
61217
  {
60856
- onClick: () => setShowIdleTime(!showIdleTime),
60857
- className: `inline-flex items-center px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${showIdleTime ? "bg-blue-50 text-blue-700 border border-blue-200" : "bg-white text-gray-700 border border-gray-300 hover:bg-gray-50"}`,
60858
- children: showIdleTime ? /* @__PURE__ */ jsxs(Fragment, { children: [
61218
+ onClick: () => setShowChartIdleTime(!showChartIdleTime),
61219
+ 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"}`,
61220
+ children: showChartIdleTime ? /* @__PURE__ */ jsxs(Fragment, { children: [
60859
61221
  /* @__PURE__ */ jsx(EyeOff, { className: "w-4 h-4 mr-1.5" }),
60860
61222
  "Hide Idle Time"
60861
61223
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -60884,7 +61246,7 @@ var WorkspaceDetailView = ({
60884
61246
  pphThreshold: workspace.pph_threshold || 0,
60885
61247
  shiftStart: workspace.shift_start || "06:00",
60886
61248
  shiftEnd: workspace.shift_end,
60887
- showIdleTime,
61249
+ showIdleTime: showChartIdleTime,
60888
61250
  idleTimeHourly: workspace.idle_time_hourly,
60889
61251
  idleTimeClips,
60890
61252
  idleTimeClipClassifications,
@@ -60897,7 +61259,7 @@ var WorkspaceDetailView = ({
60897
61259
  ]
60898
61260
  }
60899
61261
  ),
60900
- !shouldShowCycleTimeChart && /* @__PURE__ */ jsxs(
61262
+ !shouldShowCycleTimeChart && idleTimeVlmEnabled && /* @__PURE__ */ jsxs(
60901
61263
  motion.div,
60902
61264
  {
60903
61265
  className: "bg-white rounded-lg shadow-sm p-4 h-[300px]",
@@ -60979,7 +61341,7 @@ var WorkspaceDetailView = ({
60979
61341
  /* @__PURE__ */ jsxs(
60980
61342
  motion.div,
60981
61343
  {
60982
- className: `bg-white rounded-lg shadow-sm p-4 relative ${shouldShowCycleTimeChart ? "lg:col-span-10" : "lg:col-span-6"}`,
61344
+ className: `bg-white rounded-lg shadow-sm p-4 relative ${shouldShowCycleTimeChart ? "lg:col-span-10" : idleTimeVlmEnabled ? "lg:col-span-6" : "lg:col-span-8"}`,
60983
61345
  variants: chartCardVariants,
60984
61346
  initial: "initial",
60985
61347
  animate: "animate",
@@ -60988,9 +61350,9 @@ var WorkspaceDetailView = ({
60988
61350
  /* @__PURE__ */ jsx("div", { className: "absolute top-4 right-4", children: /* @__PURE__ */ jsx(
60989
61351
  "button",
60990
61352
  {
60991
- onClick: () => setShowIdleTime(!showIdleTime),
60992
- className: `inline-flex items-center px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${showIdleTime ? "bg-blue-50 text-blue-700 border border-blue-200" : "bg-white text-gray-700 border border-gray-300 hover:bg-gray-50"}`,
60993
- children: showIdleTime ? /* @__PURE__ */ jsxs(Fragment, { children: [
61353
+ onClick: () => setShowChartIdleTime(!showChartIdleTime),
61354
+ 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"}`,
61355
+ children: showChartIdleTime ? /* @__PURE__ */ jsxs(Fragment, { children: [
60994
61356
  /* @__PURE__ */ jsx(EyeOff, { className: "w-4 h-4 mr-1.5" }),
60995
61357
  "Hide Idle Time"
60996
61358
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -61018,7 +61380,7 @@ var WorkspaceDetailView = ({
61018
61380
  pphThreshold: workspace.pph_threshold || 0,
61019
61381
  shiftStart: workspace.shift_start || "06:00",
61020
61382
  shiftEnd: workspace.shift_end,
61021
- showIdleTime,
61383
+ showIdleTime: showChartIdleTime,
61022
61384
  idleTimeHourly: workspace.idle_time_hourly,
61023
61385
  idleTimeClips,
61024
61386
  idleTimeClipClassifications,
@@ -61031,7 +61393,7 @@ var WorkspaceDetailView = ({
61031
61393
  ]
61032
61394
  }
61033
61395
  ),
61034
- !shouldShowCycleTimeChart && /* @__PURE__ */ jsxs(
61396
+ !shouldShowCycleTimeChart && idleTimeVlmEnabled && /* @__PURE__ */ jsxs(
61035
61397
  motion.div,
61036
61398
  {
61037
61399
  className: "bg-white rounded-lg shadow-sm p-4 lg:col-span-2",
@@ -61104,6 +61466,7 @@ var WorkspaceDetailView = ({
61104
61466
  month: selectedMonth,
61105
61467
  year: selectedYear,
61106
61468
  workspaceId,
61469
+ lineId: effectiveLineId || workspace?.line_id,
61107
61470
  selectedShiftId: selectedShift,
61108
61471
  rangeStart,
61109
61472
  rangeEnd,
@@ -62897,7 +63260,7 @@ function BottleneckClipsView({
62897
63260
  ) })
62898
63261
  ] }) });
62899
63262
  }
62900
- var AuthenticatedBottleneckClipsView = withAuth(React25__default.memo(BottleneckClipsView));
63263
+ var AuthenticatedBottleneckClipsView = withAuth(React26__default.memo(BottleneckClipsView));
62901
63264
  var BottleneckClipsView_default = BottleneckClipsView;
62902
63265
 
62903
63266
  // src/lib/services/ticketService.ts
@@ -63728,7 +64091,7 @@ Please ensure:
63728
64091
  )
63729
64092
  ] });
63730
64093
  }
63731
- var AuthenticatedTicketsView = withAuth(React25__default.memo(TicketsView));
64094
+ var AuthenticatedTicketsView = withAuth(React26__default.memo(TicketsView));
63732
64095
  var TicketsView_default = TicketsView;
63733
64096
 
63734
64097
  // src/lib/api/s3-clips-parser.ts
@@ -64887,7 +65250,7 @@ var ThreadSidebar = ({
64887
65250
  ] }) })
64888
65251
  ] });
64889
65252
  };
64890
- var ProfilePicture = React25__default.memo(({
65253
+ var ProfilePicture = React26__default.memo(({
64891
65254
  alt = "Axel",
64892
65255
  className = "",
64893
65256
  size = "md",
@@ -67334,4 +67697,4 @@ var streamProxyConfig = {
67334
67697
  }
67335
67698
  };
67336
67699
 
67337
- export { 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, 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, 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, ISTTimer_default as ISTTimer, ImprovementCenterView_default as ImprovementCenterView, InlineEditableText, InteractiveOnboardingTour, InvitationService, InvitationsTable, InviteUserDialog, KPICard, KPIDetailView_default as KPIDetailView, KPIGrid, KPIHeader, KPISection, KPIsOverviewView_default as KPIsOverviewView, LINE_1_UUID, LINE_2_UUID, LargeOutputProgressChart, LeaderboardDetailView_default as LeaderboardDetailView, Legend6 as Legend, LineAssignmentDropdown, LineChart, LineHistoryCalendar, LineMonthlyHistory, LineMonthlyPdfGenerator, 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, PlayPauseIndicator, PrefetchConfigurationError, PrefetchError, PrefetchEvents, PrefetchStatus, PrefetchTimeoutError, ProfileView_default as ProfileView, RegistryProvider, RoleBadge, S3ClipsSupabaseService as S3ClipsService, S3Service, 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, TeamUsagePdfGenerator, ThreadSidebar, TicketHistory_default as TicketHistory, TicketHistoryService, TicketsView_default as TicketsView, TimeDisplay_default as TimeDisplay, TimePickerDropdown, Timer_default as Timer, TimezoneProvider, TimezoneService, UserAvatar, UserManagementService, UserManagementTable, UserService, UserUsageDetailModal, UserUsageStats, VideoCard, VideoGridView, VideoPlayer, VideoPreloader, WORKSPACE_POSITIONS, WhatsAppShareButton, WorkspaceCard, WorkspaceDetailView_default as WorkspaceDetailView, WorkspaceDisplayNameExample, WorkspaceGrid, WorkspaceGridItem, WorkspaceHealthCard, WorkspaceHealthView_default as WorkspaceHealthView, WorkspaceHistoryCalendar, WorkspaceMetricCards, WorkspaceMetricCardsImpl, WorkspaceMonthlyDataFetcher, WorkspaceMonthlyHistory, WorkspaceMonthlyPdfGenerator, WorkspacePdfExportButton, WorkspacePdfGenerator, WorkspaceWhatsAppShareButton, actionService, aggregateKPIsFromLineMetricsRows, apiUtils, areAllLinesOnSameShift, authCoreService, authOTPService, authRateLimitService, awardsService, buildDateKey, buildKPIsFromLineMetricsRow, buildShiftGroupsKey, checkRateLimit2 as checkRateLimit, clearAllRateLimits2 as clearAllRateLimits, clearRateLimit2 as clearRateLimit, clearS3VideoCache, clearS3VideoFromCache, clearSentryContext, clearWorkspaceDisplayNamesCache, cn, createDefaultKPIs, createInvitationService, createLinesService, createSessionTracker, createStorageService, createStreamProxyHandler, createSupabaseClient, createSupervisorService, createThrottledReload, createUserManagementService, createUserService, dashboardService, deleteThread, fetchIdleTimeReasons, filterDataByDateKeyRange, forceRefreshWorkspaceDisplayNames, formatAwardMonth, formatDateInZone, formatDateKeyForDisplay, formatDateTimeInZone, formatDuration, formatISTDate, formatIdleTime, formatRangeLabel, formatReasonLabel, formatRelativeTime, formatTimeInZone, fromUrlFriendlyName, getAllLineDisplayNames, getAllThreadMessages, getAllWorkspaceDisplayNamesAsync, getAllWorkspaceDisplayNamesSnapshot, getAnonClient, getAvailableShiftIds, getAwardBadgeType, getAwardDescription, getAwardTitle, getBrowserName, getCameraNumber, getCompanyMetricsTableName, getConfigurableShortWorkspaceDisplayName, getConfigurableWorkspaceDisplayName, getConfiguredLineIds, getCoreSessionRecordingProperties, getCoreSessionReplayUrl, getCurrentShift, getCurrentShiftForLine, getCurrentTimeInZone, getDashboardHeaderTimeInZone, getDateKeyFromDate, getDaysDifferenceInZone, getDefaultCameraStreamUrl, getDefaultLineId, getDefaultTabForWorkspace, getInitials, getLineDisplayName, getManufacturingInsights, getMetricsTablePrefix, getMonthKeyBounds, getMonthWeekRanges, getNextUpdateInterval, getOperationalDate, getReasonColor, getS3SignedUrl, getS3VideoSrc, getShiftData, getShiftNameById, getShiftWorkDurationSeconds, getShortShiftName, getShortWorkspaceDisplayName, getShortWorkspaceDisplayNameAsync, getStoredWorkspaceMappings, getSubscriptionManager, getThreadMessages, getUniformShiftGroup, getUserThreads, getUserThreadsPaginated, getWorkspaceDisplayName, getWorkspaceDisplayNameAsync, getWorkspaceDisplayNamesMap, getWorkspaceFromUrl, getWorkspaceNavigationParams, groupLinesByShift, hasAnyShiftData, identifyCoreUser, initializeCoreMixpanel, isFullMonthRange, isLegacyConfiguration, isPrefetchError, isSafari, isTransitionPeriod, isUrlPermanentlyFailed, isValidFactoryViewConfiguration, isValidLineInfoPayload, isValidPrefetchParams, isValidPrefetchStatus, isValidWorkspaceDetailedMetricsPayload, isValidWorkspaceMetricsPayload, isWorkspaceDisplayNamesLoaded, isWorkspaceDisplayNamesLoading, lineLeaderboardService, linesService, mergeWithDefaultConfig, migrateLegacyConfiguration, normalizeDateKeyRange, optifyeAgentClient, parseDateKeyToDate, parseS3Uri, preInitializeWorkspaceDisplayNames, preloadS3Video, preloadS3VideoUrl, preloadS3VideosUrl, preloadVideoUrl, preloadVideosUrl, qualityService, realtimeService, refreshWorkspaceDisplayNames, resetCoreMixpanel, resetFailedUrl, resetSubscriptionManager, s3VideoPreloader, setSentryUserContext, setSentryWorkspaceContext, 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, 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, useLeaderboardMetrics, useLineDetailedMetrics, useLineKPIs, useLineMetrics, useLineShiftConfig, useLineSupervisor, useLineWorkspaceMetrics, useLines, useMessages, useMetrics, useMobileMenu, 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 };
67700
+ export { 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, 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, 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, ISTTimer_default as ISTTimer, IdleTimeVlmConfigProvider, ImprovementCenterView_default as ImprovementCenterView, InlineEditableText, InteractiveOnboardingTour, InvitationService, InvitationsTable, InviteUserDialog, KPICard, KPIDetailView_default as KPIDetailView, KPIGrid, KPIHeader, KPISection, KPIsOverviewView_default as KPIsOverviewView, LINE_1_UUID, LINE_2_UUID, LargeOutputProgressChart, LeaderboardDetailView_default as LeaderboardDetailView, Legend6 as Legend, LineAssignmentDropdown, LineChart, LineHistoryCalendar, LineMonthlyHistory, LineMonthlyPdfGenerator, 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, PlayPauseIndicator, PrefetchConfigurationError, PrefetchError, PrefetchEvents, PrefetchStatus, PrefetchTimeoutError, ProfileView_default as ProfileView, RegistryProvider, RoleBadge, S3ClipsSupabaseService as S3ClipsService, S3Service, 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, TeamUsagePdfGenerator, ThreadSidebar, TicketHistory_default as TicketHistory, TicketHistoryService, TicketsView_default as TicketsView, TimeDisplay_default as TimeDisplay, TimePickerDropdown, Timer_default as Timer, TimezoneProvider, TimezoneService, UserAvatar, UserManagementService, UserManagementTable, UserService, UserUsageDetailModal, UserUsageStats, VideoCard, VideoGridView, VideoPlayer, VideoPreloader, WORKSPACE_POSITIONS, WhatsAppShareButton, WorkspaceCard, WorkspaceDetailView_default as WorkspaceDetailView, WorkspaceDisplayNameExample, WorkspaceGrid, WorkspaceGridItem, WorkspaceHealthCard, WorkspaceHealthView_default as WorkspaceHealthView, WorkspaceHistoryCalendar, WorkspaceMetricCards, WorkspaceMetricCardsImpl, WorkspaceMonthlyDataFetcher, WorkspaceMonthlyHistory, WorkspaceMonthlyPdfGenerator, WorkspacePdfExportButton, WorkspacePdfGenerator, WorkspaceWhatsAppShareButton, actionService, aggregateKPIsFromLineMetricsRows, apiUtils, areAllLinesOnSameShift, authCoreService, authOTPService, authRateLimitService, awardsService, buildDateKey, buildKPIsFromLineMetricsRow, buildShiftGroupsKey, checkRateLimit2 as checkRateLimit, clearAllRateLimits2 as clearAllRateLimits, clearRateLimit2 as clearRateLimit, clearS3VideoCache, clearS3VideoFromCache, clearSentryContext, clearWorkspaceDisplayNamesCache, cn, createDefaultKPIs, createInvitationService, createLinesService, createSessionTracker, createStorageService, createStreamProxyHandler, createSupabaseClient, createSupervisorService, createThrottledReload, createUserManagementService, createUserService, dashboardService, deleteThread, fetchIdleTimeReasons, filterDataByDateKeyRange, forceRefreshWorkspaceDisplayNames, formatAwardMonth, formatDateInZone, formatDateKeyForDisplay, formatDateTimeInZone, formatDuration, formatISTDate, formatIdleTime, formatRangeLabel, formatReasonLabel, formatRelativeTime, formatTimeInZone, fromUrlFriendlyName, getAllLineDisplayNames, getAllThreadMessages, getAllWorkspaceDisplayNamesAsync, getAllWorkspaceDisplayNamesSnapshot, getAnonClient, getAvailableShiftIds, getAwardBadgeType, getAwardDescription, getAwardTitle, getBrowserName, getCameraNumber, getCompanyMetricsTableName, getConfigurableShortWorkspaceDisplayName, getConfigurableWorkspaceDisplayName, getConfiguredLineIds, getCoreSessionRecordingProperties, getCoreSessionReplayUrl, getCurrentShift, getCurrentShiftForLine, getCurrentTimeInZone, getDashboardHeaderTimeInZone, getDateKeyFromDate, getDaysDifferenceInZone, getDefaultCameraStreamUrl, getDefaultLineId, getDefaultTabForWorkspace, getInitials, getLineDisplayName, getManufacturingInsights, getMetricsTablePrefix, getMonthKeyBounds, getMonthWeekRanges, getNextUpdateInterval, getOperationalDate, getReasonColor, getS3SignedUrl, getS3VideoSrc, getShiftData, getShiftNameById, getShiftWorkDurationSeconds, getShortShiftName, getShortWorkspaceDisplayName, getShortWorkspaceDisplayNameAsync, getStoredWorkspaceMappings, getSubscriptionManager, getThreadMessages, getUniformShiftGroup, getUserThreads, getUserThreadsPaginated, getWorkspaceDisplayName, getWorkspaceDisplayNameAsync, getWorkspaceDisplayNamesMap, getWorkspaceFromUrl, getWorkspaceNavigationParams, groupLinesByShift, hasAnyShiftData, identifyCoreUser, initializeCoreMixpanel, isFullMonthRange, isLegacyConfiguration, isPrefetchError, isSafari, isTransitionPeriod, isUrlPermanentlyFailed, isValidFactoryViewConfiguration, isValidLineInfoPayload, isValidPrefetchParams, isValidPrefetchStatus, isValidWorkspaceDetailedMetricsPayload, isValidWorkspaceMetricsPayload, isWorkspaceDisplayNamesLoaded, isWorkspaceDisplayNamesLoading, lineLeaderboardService, linesService, mergeWithDefaultConfig, migrateLegacyConfiguration, normalizeDateKeyRange, optifyeAgentClient, parseDateKeyToDate, parseS3Uri, preInitializeWorkspaceDisplayNames, preloadS3Video, preloadS3VideoUrl, preloadS3VideosUrl, preloadVideoUrl, preloadVideosUrl, qualityService, realtimeService, refreshWorkspaceDisplayNames, resetCoreMixpanel, resetFailedUrl, resetSubscriptionManager, s3VideoPreloader, setSentryUserContext, setSentryWorkspaceContext, 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, 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, useLeaderboardMetrics, useLineDetailedMetrics, useLineKPIs, useLineMetrics, useLineShiftConfig, useLineSupervisor, useLineWorkspaceMetrics, useLines, useMessages, useMetrics, useMobileMenu, 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 };