@datarecce/ui 1.58.0-nightly.20260728 → 1.58.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/{RouteConfigContext-BlAcnOYA.d.ts → RouteConfigContext-mBGQ0cVA.d.ts} +2 -2
  2. package/dist/{RouteConfigContext-BlAcnOYA.d.ts.map → RouteConfigContext-mBGQ0cVA.d.ts.map} +1 -1
  3. package/dist/advanced.d.ts +7 -7
  4. package/dist/advanced.js +1 -1
  5. package/dist/{api-C8oIhbau.d.ts → api-DvmXBnv4.d.ts} +2 -2
  6. package/dist/{api-C8oIhbau.d.ts.map → api-DvmXBnv4.d.ts.map} +1 -1
  7. package/dist/api-S5ho3Qs3.js.map +1 -1
  8. package/dist/api.d.ts +3 -3
  9. package/dist/components-run.d.ts +2 -2
  10. package/dist/components-run.js +1 -1
  11. package/dist/components.d.ts +6 -6
  12. package/dist/components.js +1 -1
  13. package/dist/contexts.d.ts +3 -3
  14. package/dist/contexts.js +1 -1
  15. package/dist/{hooks-sfirjbvG.js → hooks-BaBhwe4N.js} +2 -2
  16. package/dist/{hooks-sfirjbvG.js.map → hooks-BaBhwe4N.js.map} +1 -1
  17. package/dist/hooks.d.ts +1 -1
  18. package/dist/hooks.js +1 -1
  19. package/dist/{index-CDf681n9.d.ts → index--eC3A8pt.d.ts} +7 -7
  20. package/dist/{index-CDf681n9.d.ts.map → index--eC3A8pt.d.ts.map} +1 -1
  21. package/dist/{index-rFP2hMNN.d.ts → index-BC41BUy0.d.ts} +5 -5
  22. package/dist/{index-rFP2hMNN.d.ts.map → index-BC41BUy0.d.ts.map} +1 -1
  23. package/dist/{index-CE667a3Q.d.ts → index-BN44swDh.d.ts} +3 -3
  24. package/dist/{index-CE667a3Q.d.ts.map → index-BN44swDh.d.ts.map} +1 -1
  25. package/dist/{index-BWOVoc-1.d.ts → index-CCITNo6y.d.ts} +3 -3
  26. package/dist/{index-BWOVoc-1.d.ts.map → index-CCITNo6y.d.ts.map} +1 -1
  27. package/dist/{index-B5wiPdSH.d.ts → index-DYMrtpKM.d.ts} +9 -4
  28. package/dist/{index-B5wiPdSH.d.ts.map → index-DYMrtpKM.d.ts.map} +1 -1
  29. package/dist/index.d.ts +10 -10
  30. package/dist/index.js +1 -1
  31. package/dist/{instanceInfo-CP2KE3Wn.d.ts → instanceInfo-C4HygfIM.d.ts} +25 -2
  32. package/dist/instanceInfo-C4HygfIM.d.ts.map +1 -0
  33. package/dist/{lineage-Dp9NphOv.d.ts → lineage-CpVHaetU.d.ts} +11 -11
  34. package/dist/{lineage-Dp9NphOv.d.ts.map → lineage-CpVHaetU.d.ts.map} +1 -1
  35. package/dist/{primitives-X5_QjyoQ.d.ts → primitives-Bx3rV4_S.d.ts} +4 -4
  36. package/dist/{primitives-X5_QjyoQ.d.ts.map → primitives-Bx3rV4_S.d.ts.map} +1 -1
  37. package/dist/primitives.d.ts +3 -3
  38. package/dist/primitives.js +1 -1
  39. package/dist/result.js +1 -1
  40. package/dist/{src-BD64DhI9.js → src-CsFtIEfr.js} +2 -2
  41. package/dist/{src-BD64DhI9.js.map → src-CsFtIEfr.js.map} +1 -1
  42. package/dist/{types-DXSV79G-.d.ts → types-CYY-V1Iu.d.ts} +9 -2
  43. package/dist/types-CYY-V1Iu.d.ts.map +1 -0
  44. package/dist/{types-sF1RZJvf.d.ts → types-DnKkz9kc.d.ts} +2 -2
  45. package/dist/{types-sF1RZJvf.d.ts.map → types-DnKkz9kc.d.ts.map} +1 -1
  46. package/dist/types.d.ts +6 -6
  47. package/dist/{utils-CL-AEd14.js → utils-BtK9KoQL.js} +2 -2
  48. package/dist/{utils-CL-AEd14.js.map → utils-BtK9KoQL.js.map} +1 -1
  49. package/dist/{utils-X40xQFW_.js → utils-D2GZ30yl.js} +2 -2
  50. package/dist/{utils-X40xQFW_.js.map → utils-D2GZ30yl.js.map} +1 -1
  51. package/dist/utils.d.ts +1 -1
  52. package/dist/utils.js +1 -1
  53. package/package.json +1 -1
  54. package/dist/instanceInfo-CP2KE3Wn.d.ts.map +0 -1
  55. package/dist/types-DXSV79G-.d.ts.map +0 -1
@@ -1,7 +1,7 @@
1
1
 
2
- import { s as LineageDiffViewOptions } from "./instanceInfo-CP2KE3Wn.js";
3
- import { $t as CheckEmptyState, A as DiffTextProps, At as TimelineEventData, B as CodeEditor, Bt as TransformationLegendItem, C as EmptyStateProps, Cn as LineageEdgeProps, Ct as HistogramDataset, D as DiffTextWithToast, Dn as NodeChangeStatus, Dt as isDisabledByNoResult, E as DropdownValuesInputSize, En as LineageNodeProps, Et as formatSqlAsMarkdown, F as ChangedOnlyCheckboxProps, Ft as NodeTag, Gt as LineageColumnNodeData, H as CodeEditorProps, Ht as COLUMN_NODE_WIDTH, I as DiffEditor, It as NodeTagProps, Jt as PresetCheckTemplateView, Kt as LineageColumnNodeProps, L as DiffEditorLanguage, Lt as ChangeStatusLegendItem, M as DiffDisplayModeSwitch, Mt as TimelineEventType, N as DiffDisplayModeSwitchProps, Nt as CommentInput, O as DiffTextWithToastProps, Ot as TimelineActor, P as ChangedOnlyCheckbox, Pt as CommentInputProps, Qt as CheckListProps, R as DiffEditorProps, Rt as LineageLegend, S as EmptyState, Sn as LineageEdgeData, St as HistogramDataType, T as DropdownValuesInputProps, Tn as LineageNodeData, Tt as buildCheckTitle, U as CodeEditorTheme, Ut as ColumnTransformationType, V as CodeEditorLanguage, Vt as COLUMN_NODE_HEIGHT, W as SchemaDiffStatus, Wt as LineageColumnNode, Xt as generateCheckTemplate, Yt as PresetCheckTemplateViewProps, Zt as CheckList, _ as MarkdownContent, _t as PairedHistogramContinuousProps, a as Toaster, an as CheckDescriptionProps, at as TopKBarChartProps, b as ExternalLinkConfirmDialogProps, bn as EdgeChangeStatus, bt as HistogramChart, c as useToaster, cn as CheckCardProps, ct as ProfileDistributionUnsupportedBanner, d as SplitPaneProps, dn as CheckBreadcrumb, dt as PairedHistogramDiscreteCountsData, en as CheckEmptyStateProps, f as HSplit, fn as CheckBreadcrumbProps, ft as PairedHistogramDiscreteData, g as ScreenshotBoxProps, gn as CheckActionsProps, gt as PairedHistogramContinuousData, h as ScreenshotBox, hn as CheckActions, ht as PairedHistogramContinuous, i as ToastOptions, in as CheckDescription, it as TopKBarChart, j as DiffDisplayMode, jt as TimelineEventProps, k as DiffText, kt as TimelineEvent, l as SplitDirection, ln as CheckRunStatus, lt as ProfileDistributionUnsupportedBannerProps, m as VSplit, mn as CheckActionType, mt as PairedHistogramDiscreteRanksData, n as ToggleSwitch, nn as CheckDetailProps, o as ToasterProvider, on as CheckCard, ot as TopKDataset, p as SplitProps, pn as CheckAction, pt as PairedHistogramDiscreteProps, q as SchemaDiffRow, qt as GenerateCheckTemplateOptions, r as ToggleSwitchProps, rn as CheckDetailTab, s as toaster, sn as CheckCardData, st as TopKItem, t as PRIMITIVES_API_VERSION, tn as CheckDetail, u as SplitPane, un as CheckType, ut as PairedHistogramDiscrete, v as MarkdownContentProps, vt as InlineProfileDistributionCell, w as DropdownValuesInput, wn as LineageNode, wt as buildCheckDescription, x as truncateUrl, xn as LineageEdge, xt as HistogramChartProps, y as ExternalLinkConfirmDialog, yn as LineageViewRef, yt as InlineProfileDistributionCellProps, z as DiffEditorTheme, zt as LineageLegendProps } from "./primitives-X5_QjyoQ.js";
4
- import { A as RunListProps, B as inferRunStatus, C as RunProgressOverlayProps, D as RunListItem, E as RunList, F as RunStatusBadgeProps, I as RunStatusWithDate, L as RunStatusWithDateProps, M as RunStatusAndDate, N as RunStatusAndDateProps, O as RunListItemData, P as RunStatusBadge, R as formatRunDate, S as RunProgressOverlay, T as RunProgressVariant, a as RunFormParamTypes, b as RunToolbarProps, d as ViewOptionTypes, i as RegistryEntry, j as RunStatus, k as RunListItemProps, o as RunFormProps, r as RefTypes, s as RunResultViewProps, v as DiffViewOptions, w as RunProgressProps, x as RunProgress, y as RunToolbar, z as formatRunDateTime } from "./types-sF1RZJvf.js";
2
+ import { s as LineageDiffViewOptions } from "./instanceInfo-C4HygfIM.js";
3
+ import { $t as CheckEmptyState, A as DiffTextProps, At as TimelineEventData, B as CodeEditor, Bt as TransformationLegendItem, C as EmptyStateProps, Cn as LineageEdgeProps, Ct as HistogramDataset, D as DiffTextWithToast, Dn as NodeChangeStatus, Dt as isDisabledByNoResult, E as DropdownValuesInputSize, En as LineageNodeProps, Et as formatSqlAsMarkdown, F as ChangedOnlyCheckboxProps, Ft as NodeTag, Gt as LineageColumnNodeData, H as CodeEditorProps, Ht as COLUMN_NODE_WIDTH, I as DiffEditor, It as NodeTagProps, Jt as PresetCheckTemplateView, Kt as LineageColumnNodeProps, L as DiffEditorLanguage, Lt as ChangeStatusLegendItem, M as DiffDisplayModeSwitch, Mt as TimelineEventType, N as DiffDisplayModeSwitchProps, Nt as CommentInput, O as DiffTextWithToastProps, Ot as TimelineActor, P as ChangedOnlyCheckbox, Pt as CommentInputProps, Qt as CheckListProps, R as DiffEditorProps, Rt as LineageLegend, S as EmptyState, Sn as LineageEdgeData, St as HistogramDataType, T as DropdownValuesInputProps, Tn as LineageNodeData, Tt as buildCheckTitle, U as CodeEditorTheme, Ut as ColumnTransformationType, V as CodeEditorLanguage, Vt as COLUMN_NODE_HEIGHT, W as SchemaDiffStatus, Wt as LineageColumnNode, Xt as generateCheckTemplate, Yt as PresetCheckTemplateViewProps, Zt as CheckList, _ as MarkdownContent, _t as PairedHistogramContinuousProps, a as Toaster, an as CheckDescriptionProps, at as TopKBarChartProps, b as ExternalLinkConfirmDialogProps, bn as EdgeChangeStatus, bt as HistogramChart, c as useToaster, cn as CheckCardProps, ct as ProfileDistributionUnsupportedBanner, d as SplitPaneProps, dn as CheckBreadcrumb, dt as PairedHistogramDiscreteCountsData, en as CheckEmptyStateProps, f as HSplit, fn as CheckBreadcrumbProps, ft as PairedHistogramDiscreteData, g as ScreenshotBoxProps, gn as CheckActionsProps, gt as PairedHistogramContinuousData, h as ScreenshotBox, hn as CheckActions, ht as PairedHistogramContinuous, i as ToastOptions, in as CheckDescription, it as TopKBarChart, j as DiffDisplayMode, jt as TimelineEventProps, k as DiffText, kt as TimelineEvent, l as SplitDirection, ln as CheckRunStatus, lt as ProfileDistributionUnsupportedBannerProps, m as VSplit, mn as CheckActionType, mt as PairedHistogramDiscreteRanksData, n as ToggleSwitch, nn as CheckDetailProps, o as ToasterProvider, on as CheckCard, ot as TopKDataset, p as SplitProps, pn as CheckAction, pt as PairedHistogramDiscreteProps, q as SchemaDiffRow, qt as GenerateCheckTemplateOptions, r as ToggleSwitchProps, rn as CheckDetailTab, s as toaster, sn as CheckCardData, st as TopKItem, t as PRIMITIVES_API_VERSION, tn as CheckDetail, u as SplitPane, un as CheckType, ut as PairedHistogramDiscrete, v as MarkdownContentProps, vt as InlineProfileDistributionCell, w as DropdownValuesInput, wn as LineageNode, wt as buildCheckDescription, x as truncateUrl, xn as LineageEdge, xt as HistogramChartProps, y as ExternalLinkConfirmDialog, yn as LineageViewRef, yt as InlineProfileDistributionCellProps, z as DiffEditorTheme, zt as LineageLegendProps } from "./primitives-Bx3rV4_S.js";
4
+ import { A as RunListProps, B as inferRunStatus, C as RunProgressOverlayProps, D as RunListItem, E as RunList, F as RunStatusBadgeProps, I as RunStatusWithDate, L as RunStatusWithDateProps, M as RunStatusAndDate, N as RunStatusAndDateProps, O as RunListItemData, P as RunStatusBadge, R as formatRunDate, S as RunProgressOverlay, T as RunProgressVariant, a as RunFormParamTypes, b as RunToolbarProps, d as ViewOptionTypes, i as RegistryEntry, j as RunStatus, k as RunListItemProps, o as RunFormProps, r as RefTypes, s as RunResultViewProps, v as DiffViewOptions, w as RunProgressProps, x as RunProgress, y as RunToolbar, z as formatRunDateTime } from "./types-DnKkz9kc.js";
5
5
  import { a as EmptyRowsRenderer, c as GridReadyEvent, i as DataGridRow, l as ScreenshotDataGrid, n as ColGroupDef, o as EmptyRowsRendererProps, r as DataGridHandle, s as GetRowIdParams, t as ColDef, u as ScreenshotDataGridProps } from "./ScreenshotDataGrid-C0a0wbBT.js";
6
6
  import { l as ChartBarColors, m as getChartThemeColors, p as getChartBarColors, u as ChartThemeColors } from "./chartTheme-CRNnzu80.js";
7
7
  import { a as ResultViewProps, c as ScreenshotWrapperType, i as ResultViewData, n as CreatedResultViewProps, o as ResultViewRef, r as ResultViewConfig, s as ResultViewTransformOptions, t as createResultView } from "./index-FgjGyUVN.js";
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use client";import{f as e,p as t}from"./theme-u98ih3Tv.js";import{At as n,Ct as r,Dt as i,Et as a,Ft as o,Gt as s,Ht as c,It as l,Kt as u,Lt as d,Mt as f,Nt as p,Ot as m,Pt as h,Qt as g,Rt as _,St as v,Tt as y,Ut as b,Vt as x,Wt as S,Xt as C,Yt as w,Zt as T,_n as E,_t as D,bn as O,bt as k,ct as A,dn as j,dt as M,fn as N,ft as P,gn as F,gt as I,hn as L,ht as R,jt as z,kt as B,lt as V,mn as H,mt as U,on as W,ot as G,pn as K,pt as q,qt as J,st as Y,tn as X,ut as Z,vn as Q,vt as $,wt as ee,xn as te,xt as ne,yn as re,yt as ie}from"./hooks-sfirjbvG.js";import{dt as ae,ft as oe,ht as se,lt as ce,mt as le,pt as ue}from"./utils-CL-AEd14.js";export{re as COLUMN_NODE_HEIGHT,O as COLUMN_NODE_WIDTH,E as ChangedOnlyCheckbox,T as CheckActions,C as CheckBreadcrumb,w as CheckCard,J as CheckDescription,u as CheckDetail,s as CheckEmptyState,S as CheckList,b as CodeEditor,_ as CommentInput,L as DiffDisplayModeSwitch,I as DiffEditor,se as DiffText,ce as DiffTextWithToast,H as DropdownValuesInput,$ as EmptyRowsRenderer,R as EmptyState,q as ExternalLinkConfirmDialog,A as HSplit,ne as HistogramChart,j as InlineProfileDistributionCell,te as LineageColumnNode,Q as LineageEdge,W as LineageLegend,X as LineageNode,P as MarkdownContent,g as NodeTag,G as PRIMITIVES_API_VERSION,K as PairedHistogramContinuous,N as PairedHistogramDiscrete,x as PresetCheckTemplateView,k as ProfileDistributionUnsupportedBanner,y as RunList,a as RunListItem,r as RunProgress,ee as RunProgressOverlay,i as RunStatusAndDate,m as RunStatusBadge,B as RunStatusWithDate,v as RunToolbar,M as ScreenshotBox,ie as ScreenshotDataGrid,Z as SplitPane,d as TimelineEvent,ae as Toaster,oe as ToasterProvider,F as ToggleSwitch,D as TopKBarChart,V as VSplit,p as buildCheckDescription,h as buildCheckTitle,Y as createResultView,n as formatRunDate,z as formatRunDateTime,o as formatSqlAsMarkdown,c as generateCheckTemplate,e as getChartBarColors,t as getChartThemeColors,f as inferRunStatus,l as isDisabledByNoResult,ue as toaster,U as truncateUrl,le as useToaster};
2
+ "use client";import{f as e,p as t}from"./theme-u98ih3Tv.js";import{At as n,Ct as r,Dt as i,Et as a,Ft as o,Gt as s,Ht as c,It as l,Kt as u,Lt as d,Mt as f,Nt as p,Ot as m,Pt as h,Qt as g,Rt as _,St as v,Tt as y,Ut as b,Vt as x,Wt as S,Xt as C,Yt as w,Zt as T,_n as E,_t as D,bn as O,bt as k,ct as A,dn as j,dt as M,fn as N,ft as P,gn as F,gt as I,hn as L,ht as R,jt as z,kt as B,lt as V,mn as H,mt as U,on as W,ot as G,pn as K,pt as q,qt as J,st as Y,tn as X,ut as Z,vn as Q,vt as $,wt as ee,xn as te,xt as ne,yn as re,yt as ie}from"./hooks-BaBhwe4N.js";import{dt as ae,ft as oe,ht as se,lt as ce,mt as le,pt as ue}from"./utils-BtK9KoQL.js";export{re as COLUMN_NODE_HEIGHT,O as COLUMN_NODE_WIDTH,E as ChangedOnlyCheckbox,T as CheckActions,C as CheckBreadcrumb,w as CheckCard,J as CheckDescription,u as CheckDetail,s as CheckEmptyState,S as CheckList,b as CodeEditor,_ as CommentInput,L as DiffDisplayModeSwitch,I as DiffEditor,se as DiffText,ce as DiffTextWithToast,H as DropdownValuesInput,$ as EmptyRowsRenderer,R as EmptyState,q as ExternalLinkConfirmDialog,A as HSplit,ne as HistogramChart,j as InlineProfileDistributionCell,te as LineageColumnNode,Q as LineageEdge,W as LineageLegend,X as LineageNode,P as MarkdownContent,g as NodeTag,G as PRIMITIVES_API_VERSION,K as PairedHistogramContinuous,N as PairedHistogramDiscrete,x as PresetCheckTemplateView,k as ProfileDistributionUnsupportedBanner,y as RunList,a as RunListItem,r as RunProgress,ee as RunProgressOverlay,i as RunStatusAndDate,m as RunStatusBadge,B as RunStatusWithDate,v as RunToolbar,M as ScreenshotBox,ie as ScreenshotDataGrid,Z as SplitPane,d as TimelineEvent,ae as Toaster,oe as ToasterProvider,F as ToggleSwitch,D as TopKBarChart,V as VSplit,p as buildCheckDescription,h as buildCheckTitle,Y as createResultView,n as formatRunDate,z as formatRunDateTime,o as formatSqlAsMarkdown,c as generateCheckTemplate,e as getChartBarColors,t as getChartThemeColors,f as inferRunStatus,l as isDisabledByNoResult,ue as toaster,U as truncateUrl,le as useToaster};
package/dist/result.js CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use client";import{st as e}from"./hooks-sfirjbvG.js";export{e as createResultView};
2
+ "use client";import{st as e}from"./hooks-BaBhwe4N.js";export{e as createResultView};
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import{$ as e,A as t,C as n,D as r,E as i,F as a,I as o,J as s,M as c,N as l,P as u,S as d,T as f,V as p,Y as m,_ as h,a as g,at as _,c as v,d as y,ft as b,gt as x,h as S,j as C,l as w,m as T,n as E,nt as D,o as O,p as k,q as A,rt as j,s as ee,st as M,u as N,vt as P,yt as te}from"./api-S5ho3Qs3.js";import{c as ne,f as F}from"./keepAlive-bjIHulj-.js";import{n as re,r as ie,t as ae}from"./fetchClient-D0p358nB.js";import{A as oe,D as I,E as se,N as ce,S as le,T as ue,_ as de,a as fe,b as pe,c as me,d as he,f as ge,g as _e,h as ve,j as ye,l as be,m as xe,o as Se,p as Ce,s as we,u as Te,v as Ee,x as De,y as L}from"./utils-X40xQFW_.js";import{i as Oe,n as ke}from"./colors-4aGxuAVw.js";import{$ as Ae,$t as je,A as Me,An as Ne,Bt as R,C as Pe,Cn as Fe,D as Ie,Dn as Le,E as Re,En as ze,F as Be,Fn as Ve,Ft as He,Gn as Ue,Gt as We,Hn as Ge,Ht as Ke,In as qe,It as Je,Jt as z,Kn as Ye,Kt as Xe,Ln as Ze,Mn as Qe,Nn as $e,Nt as et,O as tt,On as nt,Pn as rt,Pt as it,Qt as at,Rt as ot,S as st,Sn as ct,Tn as lt,Un as ut,Ut as dt,Vt as ft,Wt as pt,Xt as mt,Yt as ht,an as gt,b as _t,bt as vt,cn as yt,ct as bt,d as xt,en as St,f as Ct,ft as wt,gt as Tt,i as Et,in as Dt,it as Ot,jn as kt,jt as At,k as jt,kn as Mt,l as Nt,lt as Pt,mn as Ft,n as It,nn as Lt,on as Rt,qt as zt,rn as Bt,sn as Vt,t as Ht,tn as Ut,u as Wt,un as Gt,ut as Kt,vn as qt,vt as Jt,w as Yt,wn as Xt,xn as Zt,yt as Qt,z as $t,zt as en}from"./hooks-sfirjbvG.js";import{Lt as tn,Rt as nn,c as rn,g as an,l as on,o as sn,pt as cn,r as ln,s as un,t as dn,ut as fn,zt as pn}from"./utils-CL-AEd14.js";import{fetchGitHubAvatar as mn,fetchUser as hn}from"./lib/api/user.js";import{PUBLIC_API_URL as gn,PUBLIC_CLOUD_WEB_URL as _n,RECCE_SUPPORT_CALENDAR_URL as vn}from"./lib/const.js";import{EXPLORE_ACTION as yn,EXPLORE_SOURCE as bn,trackArtifactUploadStarted as xn,trackColumnLevelLineage as Sn,trackCopyToClipboard as Cn,trackDwSetupCompleted as wn,trackDwSetupShown as Tn,trackDwSetupSkipped as En,trackEnvironmentConfig as Dn,trackExploreAction as On,trackHistoryAction as kn,trackInit as An,trackLineageSelection as jn,trackLineageViewRender as Mn,trackMultiNodesAction as Nn,trackNavigation as Pn,trackOssShareButtonClicked as Fn,trackProfileDistribution as In,trackRedirectToCloudSession as Ln,trackSignupCompleted as Rn,trackSignupRedirectInitiated as zn,trackStateAction as Bn}from"./lib/api/track.js";import{t as Vn}from"./constants-Bgp90yan.js";import{QueryClient as Hn,QueryClientProvider as Un,useMutation as Wn,useQuery as Gn,useQueryClient as Kn}from"@tanstack/react-query";import{Suspense as qn,createContext as Jn,forwardRef as Yn,memo as Xn,useCallback as B,useContext as Zn,useEffect as V,useImperativeHandle as Qn,useLayoutEffect as $n,useMemo as H,useRef as U,useState as W}from"react";import{Fragment as G,jsx as K,jsxs as q}from"react/jsx-runtime";import J from"@mui/material/Box";import Y from"@mui/material/Button";import er from"@mui/material/Dialog";import tr from"@mui/material/DialogActions";import nr from"@mui/material/DialogContent";import rr from"@mui/material/DialogTitle";import ir from"@mui/material/Link";import X from"@mui/material/Stack";import Z from"@mui/material/Typography";import ar from"js-cookie";import{LuExternalLink as or,LuSave as sr}from"react-icons/lu";import{useTheme as cr}from"@mui/material/styles";import{useTheme as lr}from"next-themes";import Q from"@mui/material/IconButton";import ur from"next/link";import{IoBookmarksOutline as dr,IoClose as fr,IoSync as pr,IoWarning as mr}from"react-icons/io5";import hr from"@mui/material/Divider";import gr from"@mui/material/CircularProgress";import $ from"@mui/material/Tooltip";import{FaCloud as _r,FaExpandArrowsAlt as vr,FaGithub as yr,FaQuestionCircle as br,FaRegDotCircle as xr,FaSlack as Sr,FaUser as Cr}from"react-icons/fa";import{PiBookmarkSimple as wr,PiCaretDown as Tr,PiChatText as Er,PiCheckCircle as Dr,PiCircle as Or,PiCopy as kr,PiExport as Ar,PiInfo as jr,PiInfoFill as Mr,PiMoon as Nr,PiNotePencil as Pr,PiPencil as Fr,PiPencilSimple as Ir,PiPlusCircle as Lr,PiRepeat as Rr,PiSun as zr,PiTrashFill as Br,PiTrashSimple as Vr,PiUserPlus as Hr,PiX as Ur}from"react-icons/pi";import Wr from"@mui/material/Chip";import{Background as Gr,BackgroundVariant as Kr,BaseEdge as qr,ControlButton as Jr,Controls as Yr,MiniMap as Xr,Panel as Zr,Position as Qr,ReactFlow as $r,ReactFlowProvider as ei,getBezierPath as ti,getNodesBounds as ni,useEdgesState as ri,useNodesState as ii,useReactFlow as ai,useStore as oi}from"@xyflow/react";import si from"file-saver";import ci from"@mui/material/Checkbox";import li from"@mui/material/FormControlLabel";import ui from"@mui/material/Alert";import di from"@mui/material/InputBase";import fi from"@mui/material/Menu";import pi from"@mui/material/MenuItem";import{isEmpty as mi}from"lodash";import{VscCircleLarge as hi,VscGitPullRequest as gi,VscHistory as _i,VscKebabVertical as vi}from"react-icons/vsc";import yi from"@mui/material/ListSubheader";import bi from"@mui/material/FormControl";import{Box as xi,Typography as Si}from"@mui/material";import Ci from"@mui/material/TextField";import{format as wi,formatDistanceToNow as Ti}from"date-fns";import Ei from"@mui/material/Tab";import Di from"@mui/material/Tabs";import Oi from"@mui/material/List";import ki from"@mui/material/ListItem";import Ai from"@mui/material/Avatar";import ji from"@mui/material/Popover";import{usePathname as Mi,useRouter as Ni,useSearchParams as Pi}from"next/navigation";import{MdArrowBack as Fi,MdArrowDownward as Ii,MdArrowUpward as Li,MdGpsFixed as Ri,MdInfo as zi,MdSearch as Bi}from"react-icons/md";import{TbChecklist as Vi,TbEdit as Hi}from"react-icons/tb";import Ui from"@mui/material/ListItemIcon";import Wi from"@mui/material/ListItemText";import{FiArrowRight as Gi,FiCopy as Ki,FiInfo as qi,FiPackage as Ji}from"react-icons/fi";import Yi from"@mui/material/Switch";import{RiArrowDownSFill as Xi,RiArrowUpSFill as Zi,RiMindMap as Qi,RiSwapLine as $i,RiTerminalBoxLine as ea}from"react-icons/ri";import{FaBookmark as ta,FaFileImport as na}from"react-icons/fa6";import{captureException as ra}from"@sentry/react";import{BiArrowFromBottom as ia,BiArrowToBottom as aa}from"react-icons/bi";import"@xyflow/react/dist/style.css";import oa from"@dagrejs/dagre";import sa from"@mui/material/Skeleton";import ca from"@mui/material/Radio";import la from"@mui/material/RadioGroup";import{snapdom as ua}from"@zumer/snapdom";import da from"@mui/material/Paper";import fa from"@mui/material/Table";import pa from"@mui/material/TableBody";import ma from"@mui/material/TableCell";import ha from"@mui/material/TableContainer";import ga from"@mui/material/TableHead";import _a from"@mui/material/TableRow";import va from"@mui/material/InputLabel";import ya from"@mui/material/Select";import ba from"@mui/material/Badge";import xa from"@mui/material/Grid";import{stripIndents as Sa}from"common-tags";import{IoMdCodeWorking as Ca}from"react-icons/io";import{DragDropContext as wa,Draggable as Ta,Droppable as Ea}from"@hello-pangea/dnd";import Da from"@mui/material/Card";import Oa from"@mui/material/CardContent";import ka from"@mui/material/CardHeader";const Aa=Jn(null);Aa.displayName=`RecceRoutingContext`;function ja(){return Zn(Aa)||{basePath:``,buildPath:e=>e,pathname:``,navigate:e=>{typeof window<`u`&&(window.location.href=e)}}}function Ma(){let{pathname:e,navigate:t}=ja();return[e,t]}function Na({children:e,config:t}){let n=t?.basePath??``,r=t?.pathname??``,i=t?.onNavigate,a=B(e=>n?`${n}${e.startsWith(`/`)?e:`/${e}`}`:e,[n]),o=B((e,t)=>{i?i(e,t):typeof window<`u`&&(t?.replace?(window.history.replaceState(null,``,e),window.dispatchEvent(new PopStateEvent(`popstate`))):window.location.href=e)},[i]),s=H(()=>({basePath:n,buildPath:a,pathname:r,navigate:o}),[n,a,r,o]);return K(Aa.Provider,{value:s,children:e})}const Pa=e=>new Hn({defaultOptions:{queries:{staleTime:e?.staleTime??1e3*60,gcTime:e?.gcTime??1e3*60*5,retry:1,refetchOnWindowFocus:!1}}});function Fa({children:e,api:t,theme:n=`system`,routing:r,queryClient:i,runActions:a,lineage:o,checks:s,query:c,features:l={}}){let u=i?.staleTime,d=i?.gcTime,f=H(()=>Pa({staleTime:u,gcTime:d}),[u,d]),{enableInstance:p=!0,enableIdleTimeout:m=!0,enableLineage:h=!0,enableRunActions:g=!0,enableChecks:_=!0,enableQuery:v=!0}=l,y=e;return y=K(Na,{config:r,children:y}),y=K(pn,{defaultMode:n,children:y}),y=K(ne,{config:t,children:y}),y=K(Un,{client:f,children:y}),v&&(y=K(ut,{sql:c?.sql,isExecuting:c?.isExecuting,error:c?.error,baseResult:c?.baseResult,currentResult:c?.currentResult,onSqlChange:c?.onSqlChange,onExecute:c?.onExecute,onCancel:c?.onCancel,children:y})),_&&(y=K(Ue,{checks:s?.checks,isLoading:s?.isLoading,error:s?.error,selectedCheckId:s?.selectedCheckId,onSelectCheck:s?.onSelectCheck,onCreateCheck:s?.onCreateCheck,onUpdateCheck:s?.onUpdateCheck,onDeleteCheck:s?.onDeleteCheck,onReorderChecks:s?.onReorderChecks,refetchChecks:s?.refetchChecks,children:y})),g&&(y=K(oe,{onRunAction:a?.onRunAction,onShowRunId:a?.onShowRunId,initialRunId:a?.initialRunId,initialHistoryOpen:a?.initialHistoryOpen,children:y})),h&&(y=K(Ee,{lineageGraph:o?.lineageGraph,envInfo:o?.envInfo,reviewMode:o?.reviewMode,cloudMode:o?.cloudMode,fileMode:o?.fileMode,fileName:o?.fileName,isDemoSite:o?.isDemoSite,isCodespace:o?.isCodespace,isLoading:o?.isLoading,error:o?.error,supportTasks:o?.supportTasks,onRefetchLineageGraph:o?.onRefetchLineageGraph,runsAggregated:o?.runsAggregated,onRefetchRunsAggregated:o?.onRefetchRunsAggregated,children:y})),m&&(y=K(De,{children:y})),p&&(y=K(ue,{children:y})),y}function Ia({actionState:e,onCancel:t,onClose:n}){let r=()=>e.mode===`per_node`?`${e.completed} / ${e.total}`:e.currentRun?.progress?.percentage?`${e.currentRun.progress.percentage*100}%`:e.status===`completed`?`100%`:`0%`,i=e.status===`running`||e.status===`canceling`;return K(J,{sx:{bgcolor:`background.paper`,borderRadius:1,boxShadow:6},children:q(X,{direction:`row`,divider:K(hr,{orientation:`vertical`,flexItem:!0}),spacing:2,sx:{p:`5px 15px`,mt:2},children:[q(J,{sx:{fontSize:`10pt`},children:[`Progress: `,r(),` `,e.status===`canceled`?` (canceled)`:``]}),i?K(Y,{size:`small`,variant:`outlined`,onClick:t,disabled:e.status===`canceling`,children:e.status===`canceling`?`Canceling`:`Cancel`}):K(X,{direction:`row`,children:K(Y,{size:`small`,variant:`outlined`,onClick:n,children:`Close`})})]})})}function La(e){return e?{node_id:e,change_analysis:!0,no_upstream:!0}:{change_analysis:!0,no_upstream:!0}}function Ra({nodeId:e,setChangeAnalysisMode:t,showColumnLevelLineage:n}){t?.(!0),n?.(La(e))}function za(e,t){return{node_id:e,column:t}}function Ba(e,t){return{...e,change_analysis:e.change_analysis??t}}function Va({cllInput:e,changeAnalysisMode:t,newCllExperience:n}){return!e&&!n?!1:t}function Ha({changeAnalysisMode:e,newCllExperience:t}){return t&&e?La():void 0}function Ua({nodeId:e,changeAnalysisMode:t,cllInput:n,lineageGraph:r}){if(!r||!t)return!1;let i=!!(e in r.nodes?r.nodes[e]:void 0)?.data.changeStatus;return n?.node_id&&!n.column?n.node_id===e&&i:i}const Wa=({lineageGraph:e,cllInput:t,onCenterNode:n})=>{let r={cursor:`pointer`,fontFamily:`monospace`,bgcolor:nn()?`grey.700`:`grey.100`,px:.5,borderRadius:.5};if(!e)return K(G,{});if(!t)return K(G,{children:`Default View`});if(t.node_id===void 0)return K(Z,{component:`span`,children:`Impact Radius for All Changed Models`});let i=t.node_id in e.nodes?e.nodes[t.node_id].data.name:t.node_id;if(!t.column){let e=t.node_id;return q(G,{children:[K(Z,{component:`span`,sx:{mr:`5px`},children:`Impact Radius for`}),K(J,{component:`code`,onClick:()=>{n(e)},sx:r,children:i})]})}let a=`${t.node_id}_${t.column}`;return q(G,{children:[q(Z,{component:`span`,sx:{mr:`5px`},children:[`Column Lineage for`,` `]}),q(J,{component:`code`,onClick:()=>{n(a)},sx:r,children:[i,`.`,t.column]})]})},Ga=({action:e,interactive:t,viewOptions:n,lineageGraph:r,singleEnvMode:i=!1,changeAnalysisAvailable:a=!0,onShowCll:o,onResetCll:s,onCenterNode:c,setChangeAnalysisMode:l,newCllExperience:u=!1,changeAnalysisMode:d=!1})=>{let f=n.column_level_lineage,p=!r?.catalogMetadata.current,m=u&&d,h=f&&!(u&&!f.column);return q(X,{direction:`row`,spacing:`5px`,children:[!i&&!m&&K(J,{sx:{borderRadius:1,boxShadow:3},children:K($,{enterDelay:50,title:a?p?`Please provide catalog.json to enable Impact Radius`:``:`Requires warehouse connection`,placement:`top`,children:K(`span`,{children:K(Y,{size:`small`,variant:`outlined`,color:`neutral`,sx:{whiteSpace:`nowrap`,display:`inline-flex`,bgcolor:`background.paper`},disabled:!t||p||!a||e.isPending,startIcon:K(xr,{}),onClick:()=>{Ra({setChangeAnalysisMode:l,showColumnLevelLineage:o})},children:`Impact Radius`})})})}),h&&q(X,{direction:`row`,sx:{alignItems:`center`,borderRadius:1,boxShadow:3,border:`1px solid`,borderColor:`divider`,bgcolor:`background.paper`,fontSize:`0.8rem`,p:`0 0.625rem`},children:[K(Wa,{lineageGraph:r,cllInput:f,onCenterNode:c}),e.isError&&K($,{title:`Error: ${e.error.message}`,placement:`bottom`,children:K(Z,{component:`span`,sx:{color:`error.main`,ml:`2px`,display:`inline-flex`,alignItems:`center`},children:K(J,{component:jr,sx:{color:`error.main`,fontSize:`14px`}})})}),e.isPending?K(gr,{size:12,sx:{ml:`2px`}}):K(Q,{size:`small`,sx:{ml:`2px`},"aria-label":`Reset Column Level Lineage`,onClick:()=>{s()},children:K(Ur,{size:`10px`})})]})]})};function Ka({onClose:e}){let{cancel:t,actionState:n}=de();return K(Ia,{actionState:n,onCancel:t,onClose:e})}const qa=({action:e})=>{let{showColumnLevelLineage:t,resetColumnLevelLineage:n,interactive:r,viewOptions:i,centerNode:a,setChangeAnalysisMode:o,newCllExperience:s,changeAnalysisMode:c}=de(),{data:l}=ge(),u=l?.single_env_onboarding??!1,{lineageGraph:d,isActionAvailable:f}=L();return K(Ga,{action:e,interactive:r,viewOptions:i,lineageGraph:d,singleEnvMode:u,changeAnalysisAvailable:f(`change_analysis`),onShowCll:t,onResetCll:()=>n(),onCenterNode:a,setChangeAnalysisMode:o,newCllExperience:s,changeAnalysisMode:c})};function Ja(e){let{id:t,data:n}=e,{id:r}=n.node,{column:i,type:a,transformationType:o,changeStatus:s,isImpacted:c}=n,l=oi(e=>e.transform[2]>.3),{isDark:u}=Ht(),{viewOptions:d,showContextMenu:f,isNodeHighlighted:p,isNodeShowingChangeAnalysis:m,newCllExperience:h}=de(),g=d.column_level_lineage?.node_id,_=i===d.column_level_lineage?.column&&r===g,v=p(t),y=m(r);return K(Zt,{id:t,data:{column:i,type:a,nodeId:r,transformationType:o,changeStatus:s,isHighlighted:v,isFocused:_,isImpacted:c},showContent:l,showChangeAnalysis:y,isDark:u,newCllExperience:h,onContextMenu:(t,n)=>{f(t,e)}})}const Ya=Xn(Ja);Ya.displayName=`GraphColumnNode`;function Xa(e){let{source:t,target:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,style:l={},markerEnd:u,data:d,isEdgeHighlighted:f}=e,p={...l};d?.changeStatus&&(p.stroke=kt(d.changeStatus).hexColor,p.strokeDasharray=`5`),!f||f(t,n)||(p.filter=rt);let[m]=ti({sourceX:r,sourceY:i,sourcePosition:s,targetX:a,targetY:o,targetPosition:c});return K(G,{children:K(qr,{path:m,markerEnd:u,style:{...p,...l}})})}const Za=Xn(Xa);Za.displayName=`GraphEdge`;function Qa(e){let{isEdgeHighlighted:t}=de();return K(Za,{...e,isEdgeHighlighted:t})}const $a=()=>K(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 256 256`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,children:K(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z`})}),eo=()=>K(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 256 256`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,children:K(`path`,{d:`M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z`})});function to({skipReason:e}){return K(Wr,{size:`small`,label:q(X,{direction:`row`,sx:{fontSize:`10pt`,color:`grey.500`,alignItems:`center`,gap:`3px`},children:[K(J,{children:`Skipped`}),e&&K($,{title:e,children:K(J,{component:`span`,sx:{display:`flex`},children:K($a,{})})})]}),sx:{bgcolor:`grey.100`}})}function no({errorMessage:e}){return q(X,{direction:`row`,sx:{fontSize:`10pt`,color:`gray`,alignItems:`center`},children:[K(J,{children:`Error`}),e&&K($,{title:e,children:K(J,{component:`span`,sx:{display:`flex`},children:K(eo,{})})})]})}function ro({result:e}){let{mismatchedColumns:t}=e,n=t>0;return K(Wr,{size:`small`,sx:{bgcolor:n?`error.light`:`success.light`},label:K(X,{direction:`row`,sx:{fontSize:`10pt`,color:n?`error.main`:`success.main`,alignItems:`center`,gap:`3px`},children:n?`${t} columns mismatched`:`All columns match`})})}function io({result:e}){let{base:t,current:n}=e,r=t===null?`N/A`:t.toLocaleString(),i=n===null?`N/A`:n.toLocaleString(),a=``,o=`grey.500`;return t!==null&&n!==null&&(n>t?(a=`↑`,o=`success.main`):n<t?(a=`↓`,o=`error.main`):a=`=`),K(Wr,{size:`small`,sx:{bgcolor:`grey.100`},label:q(X,{direction:`row`,sx:{fontSize:`10pt`,alignItems:`center`,gap:`3px`},children:[K(J,{children:r}),K(J,{children:`→`}),K(J,{children:i}),a&&K(J,{component:`span`,sx:{color:o,ml:.5},children:a})]})})}function ao({status:e,skipReason:t,errorMessage:n,progress:r,valueDiffResult:i,rowCountDiffResult:a,runId:o,"data-testid":s}){return e===`pending`?K(gr,{size:16,"data-testid":s,"data-status":`pending`}):e===`skipped`?K(J,{"data-testid":s,"data-status":`skipped`,children:K(to,{skipReason:t})}):e===`running`?r?.percentage===void 0?K(gr,{size:16,"data-testid":s,"data-status":`running`}):K(gr,{variant:`determinate`,value:r.percentage*100,size:16,"data-testid":s,"data-status":`running`}):e===`error`?K(J,{"data-testid":s,"data-status":`error`,children:K(no,{errorMessage:n})}):i?K(J,{"data-testid":s,"data-status":`success`,children:K(ro,{result:i})}):a?K(J,{"data-testid":s,"data-status":`success`,children:K(io,{result:a})}):K(J,{"data-testid":s,"data-status":`success`,children:o||`Complete`})}const oo=Xn(ao);oo.displayName=`ActionTag`;const so={success:`#059669`,failure:`#ef4444`,error:`#ef4444`,warning:`#f59e0b`},co={success:`PASSED`,failure:`FAILED`,error:`ERROR`,warning:`WARNING`};function lo(e){return so[e]??`#6b7280`}function uo(e){return co[e]??e.toUpperCase()}function fo({run:e,index:t,onClick:n}){let r=lo(e.status),i=uo(e.status),a=Ti(new Date(e.run_at),{addSuffix:!0}),o=!!n;return q(xi,{component:o?`button`:`div`,type:o?`button`:void 0,onClick:o?()=>n?.(e.run_id):void 0,"aria-label":o?`View run #${t} — ${i}`:void 0,sx:{p:1,border:`none`,borderLeft:`3px solid ${r}`,borderRadius:1,bgcolor:`action.hover`,cursor:o?`pointer`:`default`,"&:hover":o?{bgcolor:`action.selected`}:{},textAlign:`left`,width:`100%`,font:`inherit`,color:`inherit`},children:[q(Si,{variant:`body2`,sx:{fontWeight:600,fontSize:`0.75rem`},children:[`Run #`,t,` — `,i,e.triggered_by===`recce_ai`&&K(Si,{component:`span`,sx:{ml:.75,fontSize:`0.65rem`,fontWeight:500,color:`#7c3aed`},children:`by AI`})]}),e.summary&&K(Si,{variant:`body2`,sx:{color:`text.secondary`,fontSize:`0.7rem`,mt:.25},children:e.summary}),K(Si,{variant:`body2`,sx:{color:`text.secondary`,fontSize:`0.65rem`,mt:.25},children:a})]})}function po({event:e}){let t=p(e),n={create:Lr,comment:Er,approve:Dr,unapprove:Or,edit:Pr,preset:wr},r={create:`primary.main`,comment:`grey.500`,approve:`success.main`,unapprove:`grey.400`,edit:`warning.main`,preset:`secondary.main`},i=n[t],a=r[t];return K(J,{component:i,sx:{color:a,fontSize:16}})}function mo({event:e}){let{actor:t}=e,{avatarUrl:n}=en({userId:t.user_id}),r=(t.fullname||t.login||`User`).charAt(0).toUpperCase();return K(Ai,{src:n||void 0,sx:{width:24,height:24,fontSize:`0.75rem`},children:r})}function ho({event:e}){let{actor:t}=e,n=t.fullname||t.login||`Someone`,r=Ti(new Date(e.created_at),{addSuffix:!0}),i=``;switch(e.event_type){case`check_created`:i=`created this check`;break;case`approval_change`:i=e.new_value===`true`?`approved this check`:`unapproved this check`;break;case`description_change`:i=`updated the description`;break;case`name_change`:i=`renamed this check`;break;case`preset_applied`:i=`applied a preset`;break;default:i=`made a change`}return q(J,{sx:{display:`flex`,gap:1,alignItems:`flex-start`,py:1},children:[K(J,{sx:{pt:`2px`},children:K(po,{event:e})}),K(J,{sx:{flex:1},children:q(X,{direction:`row`,spacing:.5,sx:{flexWrap:`wrap`,alignItems:`center`},children:[K(mo,{event:e}),K(Z,{variant:`body2`,sx:{fontWeight:`500`},children:n}),K(Z,{variant:`body2`,sx:{color:`text.secondary`},children:i}),K(Z,{variant:`caption`,sx:{color:`text.disabled`},children:r})]})})]})}function go({event:e,currentUserId:t,onEdit:n,onDelete:r}){let i=nn(),[a,o]=W(!1),[s,c]=W(e.content||``),[l,u]=W(!1),[d,f]=W(!1),[p,m]=W(null),h=!!p,{actor:g}=e,_=g.fullname||g.login||`Someone`,v=Ti(new Date(e.created_at),{addSuffix:!0}),y=t&&String(g.user_id)===String(t),b=()=>{c(e.content||``),o(!0)},x=()=>{c(e.content||``),o(!1)},S=async()=>{let t=s.trim();if(!t||t===e.content){x();return}if(n){u(!0);try{await n(e.id,t),o(!1)}finally{u(!1)}}},C=e=>{e.key===`Escape`?x():e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),S())},w=e=>{m(e.currentTarget)},T=()=>{m(null)};return e.is_deleted?q(J,{sx:{display:`flex`,gap:1,alignItems:`center`,py:1},children:[K(J,{sx:{pt:`2px`,display:`flex`,alignItems:`center`},children:K(po,{event:e})}),K(J,{sx:{display:`flex`,flex:1,alignItems:`center`},children:K(Z,{variant:`body2`,sx:{color:`text.disabled`,fontStyle:`italic`},children:`Comment deleted`})})]}):q(J,{sx:{display:`flex`,gap:1,alignItems:`flex-start`,py:1},children:[K(J,{sx:{pt:`2px`},children:K(po,{event:e})}),q(J,{sx:{flex:1},children:[q(X,{direction:`row`,spacing:.5,sx:{flexWrap:`wrap`,alignItems:`center`,mb:.5},children:[K(mo,{event:e}),q(Z,{variant:`body2`,sx:{fontWeight:`500`},children:[_,y&&q(Z,{component:`span`,variant:`body2`,sx:{color:`text.secondary`},children:[` `,`(Author)`]})]}),K(Z,{variant:`caption`,sx:{color:`text.disabled`},children:v}),e.is_edited&&K(Z,{variant:`caption`,sx:{color:`text.disabled`},children:`(edited)`})]}),a?q(J,{children:[K(Ci,{value:s,onChange:e=>c(e.target.value),onKeyDown:C,size:`small`,multiline:!0,minRows:3,fullWidth:!0,disabled:l,autoFocus:!0,sx:{"& .MuiOutlinedInput-root":{bgcolor:`background.paper`,"&:focus-within":{borderColor:`primary.main`}}}}),q(X,{direction:`row`,spacing:1,sx:{justifyContent:`flex-end`,mt:1},children:[K(Y,{size:`small`,variant:`text`,onClick:x,disabled:l,children:`Cancel`}),K(Y,{size:`small`,variant:`contained`,onClick:S,disabled:!s.trim()||l,children:l?`Saving...`:`Save`})]})]}):q(J,{sx:{bgcolor:i?`grey.800`:`grey.50`,borderRadius:1,p:1,border:`1px solid`,borderColor:i?`grey.700`:`grey.200`,position:`relative`,"&:hover .comment-actions":{opacity:1}},children:[K(wt,{content:e.content||``,fontSize:`sm`}),y&&(n||r)&&q(X,{className:`comment-actions`,direction:`row`,spacing:0,sx:{position:`absolute`,top:4,right:4,opacity:0,transition:`opacity 0.2s`},children:[n&&K($,{title:`Edit comment`,children:K(Q,{"aria-label":`Edit comment`,size:`small`,onClick:b,children:K(Ir,{})})}),r&&q(G,{children:[K($,{title:`Delete comment`,children:K(Q,{"aria-label":`Delete comment`,size:`small`,color:`error`,onClick:w,children:K(Vr,{})})}),K(ji,{open:h,anchorEl:p,onClose:T,anchorOrigin:{vertical:`bottom`,horizontal:`center`},transformOrigin:{vertical:`top`,horizontal:`center`},children:q(J,{sx:{p:2},children:[K(Z,{variant:`body2`,sx:{mb:2},children:`Delete this comment?`}),q(X,{direction:`row`,spacing:1,sx:{justifyContent:`flex-end`},children:[K(Y,{size:`small`,variant:`text`,onClick:T,disabled:d,children:`Cancel`}),K(Y,{size:`small`,variant:`contained`,color:`error`,onClick:async()=>{if(r){f(!0);try{await r(e.id),T()}finally{f(!1)}}},disabled:d,children:d?`Deleting...`:`Delete`})]})]})})]})]})]})]})]})}function _o({event:e,currentUserId:t,onEdit:n,onDelete:r}){return e.event_type===`comment`?K(go,{event:e,currentUserId:t,onEdit:n,onDelete:r}):K(ho,{event:e})}function vo(e,t){let n=e?.toLowerCase();return n===`finished`?t?`error`:`success`:n===`failed`?`error`:e??`unknown`}function yo(e,t){let n=[];for(let t of e)n.push({kind:`event`,event:t,at:t.created_at});if(t){let e=[...t].sort((e,t)=>new Date(e.run_at).getTime()-new Date(t.run_at).getTime());for(let t=0;t<e.length;t++)n.push({kind:`run`,run:e[t],index:t+1,at:e[t].run_at})}return n.sort((e,t)=>new Date(t.at).getTime()-new Date(e.at).getTime()),n}function bo({checkId:t}){let n=nn(),{apiClient:r,authToken:i}=R(),{events:a,isLoading:o,error:s,createComment:c,isCreatingComment:l,updateComment:u,deleteComment:d}=Nt(t),{data:f}=Gn({queryKey:F.user(),queryFn:()=>hn(r),retry:!1}),{data:p}=Gn({queryKey:[`check-runs`,t],queryFn:async()=>(await e(r)).filter(e=>e.check_id===t).map(e=>({run_id:e.run_id,run_at:e.run_at,status:vo(e.status,e.error),summary:e.error||void 0,triggered_by:e.triggered_by})),enabled:!!i,staleTime:3e4}),m=H(()=>yo(a,p),[a,p]),h=e=>{c(e)},g=async(e,t)=>{await u({eventId:e,content:t})},_=async e=>{await d(e)};return o?K(J,{sx:{height:`100%`,p:4,display:`flex`,justifyContent:`center`,alignItems:`center`},children:K(gr,{size:20})}):s?K(J,{sx:{height:`100%`,p:4,display:`flex`,justifyContent:`center`,alignItems:`center`},children:K(Z,{sx:{fontSize:`0.875rem`,color:`error.main`},children:`Failed to load timeline`})}):q(X,{sx:{height:`100%`,alignItems:`stretch`,borderLeft:`1px solid`,borderColor:n?`grey.700`:`grey.200`},spacing:0,children:[K(J,{sx:{px:3,py:2,borderBottom:`1px solid`,borderColor:n?`grey.700`:`grey.200`},children:K(Z,{variant:`subtitle2`,sx:{fontWeight:500},children:`Activity`})}),K(J,{sx:{flex:1,overflowY:`auto`,px:3,py:2},children:m.length===0?K(Z,{sx:{fontSize:`0.875rem`,color:`grey.500`},children:`No activity yet`}):K(X,{sx:{alignItems:`stretch`},spacing:0,children:m.map((e,t)=>q(J,{children:[e.kind===`event`?K(_o,{event:e.event,currentUserId:f?.id,onEdit:g,onDelete:_}):K(fo,{run:e.run,index:e.index}),t<m.length-1&&K(hr,{sx:{borderColor:n?`grey.700`:`grey.100`}})]},e.kind===`event`?e.event.id:e.run.run_id))})}),K(J,{sx:{px:3,py:3,borderTop:`1px solid`,borderColor:n?`grey.700`:`grey.200`,bgcolor:n?`grey.900`:`grey.50`},children:K(ot,{onSubmit:h,isSubmitting:l})})]})}function xo({color:e}){return K(J,{component:`span`,sx:{display:`inline-block`,width:`10px`,height:`10px`,bgcolor:e,mr:1,borderRadius:`4px`}})}const So=({defaultPrimaryKeys:e,onPrimaryKeysChange:t,...n})=>{let{isActionAvailable:r}=L(),i=H(()=>[],[]);return K(J,{sx:{display:`flex`},...n,children:q(X,{spacing:0,sx:{m:`0 0.5rem`},children:[q(X,{direction:`row`,spacing:.5,sx:{alignItems:`center`},children:[K(Z,{component:`label`,sx:{fontSize:`0.625rem`,color:`text.secondary`},children:`Diff with Primary Key(s) (suggested)`}),K($,{title:`Provide a primary key to perform query diff in data warehouse and only return changed rows.`,placement:`bottom-end`,children:K(J,{component:`span`,sx:{display:`flex`,color:`grey.600`,cursor:`help`},children:K(jr,{fontSize:`0.75rem`})})})]}),K(Ft,{className:`no-track-pii-safe`,unitName:`key`,defaultValues:e,suggestionList:i,onValuesChange:t,size:`2xs`,width:`240px`,placeholder:`Select or type to add keys`,disabled:!r(`query_diff_with_primary_key`)})]})})};function Co({supportCalendarUrl:e=`https://cal.com/team/recce/chat`}){let{data:t}=I();return K(`div`,{className:`flex flex-1 h-full min-h-0 m-2 p-4 bg-blue-50 rounded-lg shadow-md justify-center`,children:q(`div`,{className:`w-4/5 flex flex-col overflow-y-auto gap-6 px-8 pb-8`,children:[q(X,{spacing:2,sx:{alignItems:`center`},children:[K(J,{sx:{p:1,bgcolor:`background.paper`,borderRadius:`50%`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:2},children:K(J,{component:ea,sx:{fontSize:28,color:`iochmara.500`}})}),K(Z,{variant:`h5`,sx:{mt:2},children:`Wait, there's more!`}),q(Z,{sx:{fontSize:`1rem`,textAlign:`center`},children:[`Query functions disabled without a`,` `,K(Z,{component:`span`,sx:{fontWeight:`bold`},children:`data warehouse connection`})]})]}),K(X,{sx:{width:`50%`,mt:3,mx:`auto`},children:K(Y,{color:`iochmara`,variant:`contained`,size:`large`,onClick:()=>{window.open(dn(t,e),`_blank`)},children:`Connect to Data Warehouse`})})]})})}const wo=()=>{let{isCustomQueries:e,setCustomQueries:t,sqlQuery:n,setBaseSqlQuery:r}=_t();return q(J,{children:[q(X,{direction:`row`,spacing:.5,sx:{alignItems:`center`,fontSize:`0.75rem`},children:[K(Z,{variant:`body2`,sx:{fontSize:`0.75rem`},children:`Custom Queries`}),K($,{title:`Custom queries allow you to use two SQL queries to compare results between current and base environments.`,children:K(J,{component:`span`,sx:{display:`flex`,color:`grey.600`},children:K(Mr,{fontSize:`1rem`})})})]}),K(Yi,{size:`small`,checked:e,onChange:()=>{!e&&r&&r(n),t(!e)},color:`primary`})]})},To=()=>{let{sqlQuery:e,baseSqlQuery:t,setSqlQuery:n,setBaseSqlQuery:r,primaryKeys:i,setPrimaryKeys:a,isCustomQueries:o}=_t(),{lineageGraph:c,envInfo:l}=L(),{featureToggles:u,singleEnv:d}=se(),f=e;l?.adapterType===`sqlmesh`&&e===`select * from {{ ref("mymodel") }}`&&(f=`select * from db.mymodel`),u.mode===`read only`&&(f=`--- Would like to do query here? Book a demo with us at ${vn}\n${f}`);let{showRunId:p}=ye(),{apiClient:h}=R(),{mutate:g,isPending:_}=Wn({mutationFn:async e=>{function n(e){switch(e){case`query`:return A;case`query_base`:return s;case`query_diff`:return m;default:throw Error(`Unknown query type: ${e}`)}}let r=e===`query_base`?t??``:f,a=n(e),c={sql_template:r},l={nowait:!0};e===`query_diff`&&(c.primary_keys=i,o&&(c.base_sql_template=t));let{run_id:u}=await a(c,l,h);return p(u),await j(u,void 0,h)}}),v=H(()=>{let e={};if(!c)return`N/A`;for(let t in c.nodes){let n=c.nodes[t].data.schema;n&&(e[n]=(e[n]||0)+1)}return Object.keys(e).reduce((t,n)=>e[n]>(e[t]||0)?n:t,`N/A`)},[c]);return d||u.mode===`metadata only`?q(J,{sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:[q(J,{sx:{display:`flex`,justifyContent:`right`,alignItems:`center`,padding:`4pt 8pt`,gap:`5px`,height:`54px`,borderBottom:`1px solid`,borderColor:`divider`},children:[K(kc,{}),K(J,{sx:{flexGrow:1}}),d?K($,{title:`Please configure the base environment before running the diff`,placement:`left`,children:K(`span`,{children:K(Y,{variant:`contained`,disabled:!0,size:`small`,sx:{fontSize:`14px`,mt:`16px`},children:`Run Diff`})})}):K(zl,{display:u.mode===`metadata only`,children:K(Y,{variant:`contained`,disabled:!0,size:`small`,sx:{fontSize:`14px`,mt:`16px`},children:`Run Diff`})})]}),K(Ie,{value:f,onChange:n,onRun:()=>{g(`query`)},labels:[`base (production)`,`current (${v})`],SetupGuide:u.mode===`metadata only`?K(Co,{}):K(wc,{})})]}):q(J,{sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:[q(J,{sx:{display:`flex`,justifyContent:`right`,alignItems:`flex-end`,padding:`4pt 8pt`,gap:`5px`,height:`54px`,borderBottom:`1px solid`,borderColor:`divider`,flex:`0 0 54px`},children:[K(kc,{}),K(wo,{}),K(J,{sx:{flexGrow:1}}),K(So,{defaultPrimaryKeys:i,onPrimaryKeysChange:a}),K(Y,{variant:`contained`,onClick:()=>{g(`query_diff`)},disabled:_||u.disableDatabaseQuery,size:`small`,children:`Run Diff`})]}),K(J,{sx:{width:`100%`,flex:1,overflowY:`auto`},children:o?K(Ie,{value:f,baseValue:t,onChange:n,onChangeBase:r,onRun:()=>{g(`query`)},onRunBase:()=>{g(`query_base`)},onRunDiff:()=>{g(`query_diff`)}}):K(tt,{value:f,onChange:n,onRun:()=>{g(`query`)},onRunDiff:()=>{g(`query_diff`)}})})]})};function Eo({rowCount:e}){let t=e.base,n=e.curr,r=e.base===null?`N/A`:`${e.base} Rows`,i=e.curr===null?`N/A`:`${e.curr} Rows`,a,o;t===null&&n===null?(a=`Failed to load`,o=`default`):t===null||n===null?(a=`${r} -> ${i}`,o=t===null?`success`:`error`):t===n?(a=`=`,o=`default`):(a=`${an(t,n)} Rows`,o=t<n?`success`:`error`);let s=$t(`row_count_diff`).icon;return K(Wr,{size:`small`,color:o,icon:s?K(s,{}):void 0,label:a,sx:{height:20,fontSize:`0.7rem`}})}function Do({id:e,inverted:t}){let{lineageGraph:n,runsAggregated:r}=L(),{text:i,isDark:a}=Ht(),o=r?.[e],s=n?.nodes[e];if(!o&&!s)return null;let c;s?.data.change?.columns&&(c=Object.keys(s.data.change.columns).length>0);let l;if(o?.row_count_diff){let e=o.row_count_diff.result;l=e.curr!==e.base}let u=t?i.inverted:kt(`modified`).color,d=t?i.secondary:a?`grey.700`:`grey.100`,f=$t(`schema_diff`).icon;return q(J,{sx:{display:`flex`,flex:1,alignItems:`center`},children:[c!==void 0&&K($,{title:`Schema (${c?`changed`:`no change`})`,enterDelay:500,children:K(J,{sx:{height:16},children:f&&K(J,{component:f,sx:{color:c?u:d}})})}),K(J,{sx:{flexGrow:1}}),o?.row_count_diff&&l!==void 0&&K($,{title:`Row count (${l?`changed`:`=`})`,enterDelay:500,children:K(J,{children:K(Eo,{rowCount:o.row_count_diff.result})})})]})}function Oo({nodeId:e,nodeName:t}){let{getNodeAction:n}=de(),r=n(e);if(!r)return null;let{status:i,skipReason:a,run:o}=r;if(i===`pending`)return K(oo,{status:`pending`});if(i===`skipped`)return K(oo,{status:`skipped`,skipReason:a});if(!o)return K(oo,{status:`pending`});let{error:s,run_id:c,progress:l}=o;if(i===`running`)return K(oo,{status:`running`,progress:{percentage:l?.percentage}});if(s)return K(oo,{status:`error`,errorMessage:s});if(o.type===`value_diff`&&o.result){let e=o.result,t=0,n=e.data.data.length;for(let n of e.data.data)n[2]<1&&t++;return K(oo,{status:`success`,valueDiffResult:{mismatchedColumns:t,totalColumns:n}})}if(b(o)&&o.result){let e=o.result[t];if(e)return K(Eo,{rowCount:e})}if(o.type===`row_count`&&o.result){let e=o.result[t];if(e?.curr!==void 0&&e.curr!==null)return K(Wr,{size:`small`,label:`${e.curr.toLocaleString()} Rows`,sx:{height:20,fontSize:`0.7rem`}})}return K(oo,{status:`success`,runId:c})}function ko(e){let{data:t}=e,{id:n,resourceType:r,changeStatus:i,name:a}=t,o=oi(e=>e.transform[2]>.3),{isDark:s}=Ht(),c=de(),{interactive:l,selectNode:u,selectMode:d,focusedNode:f,getNodeAction:p,getNodeColumnSet:m,isNodeHighlighted:h,isNodeSelected:g,isNodeShowingChangeAnalysis:_,showContextMenu:v,viewOptions:y,cll:b,impactedNodeIds:x,newCllExperience:S}=c,C=S?x.has(n):!1,{isWholeModelChanged:w,isWholeModelImpacted:T}=Dt(n,c),E=yt(b?.current.nodes[n]?.change_category,S?void 0:t.change?.category),D=h(n),O=g(n),k=y.column_level_lineage?.node_id===n&&y.column_level_lineage.column===void 0,A=f?.id===n||k,j=_(n),ee=m(t.id),M=d===`action_result`?p(t.id):void 0,N=i,P=d,te=d===`action_result`&&M?K(Oo,{nodeId:n,nodeName:a}):void 0,ne=d!==`action_result`&&t.resourceType===`model`?K(Do,{id:t.id,inverted:d===`selecting`&&O}):void 0;return K(Ut,{id:n,data:{label:a,changeStatus:N,resourceType:r,materialized:t.materialized},newCllExperience:S,isImpacted:C,isWholeModelChanged:w,isWholeModelImpacted:T,interactive:l,selectMode:P,isNodeSelected:O,isFocused:A,isHighlighted:D,showContent:o,actionTag:te,showChangeAnalysis:j||!S&&E!==void 0,changeCategory:E,runsAggregatedTag:ne,hasParents:Object.keys(t.parents).length>0,hasChildren:Object.keys(t.children).length>0,columnCount:ee.size,columnHeight:24,isDark:s,onSelect:e=>{u(e)},onContextMenu:(t,n)=>{v(t,e)}})}const Ao=Xn(ko);Ao.displayName=`GraphNode`;const jo={lineageGraphNode:Ao,lineageGraphColumnNode:Ya},Mo={lineageGraphEdge:Qa},No=[],Po=(e={})=>t=>{let{impactedNodeIds:n,newCllExperience:r}=e;return $e({changeStatus:t.data.changeStatus,isImpacted:r?n?.has(t.id):!1,newCllExperience:r}).color},Fo={ROW_COUNT:`row_count`,ROW_COUNT_DIFF:`row_count_diff`,PROFILE:`profile`,PROFILE_DIFF:`profile_diff`,VALUE_DIFF:`value_diff`,HISTOGRAM_DIFF:`histogram_diff`,TOP_K_DIFF:`top_k_diff`},Io={LINEAGE_VIEW_CONTEXT_MENU:`lineage_view_context_menu`},Lo={SELECT_PARENT_NODES:`select_parent_nodes`,SELECT_CHILD_NODES:`select_child_nodes`,SELECT_ALL_UPSTREAM:`select_all_upstream`,SELECT_ALL_DOWNSTREAM:`select_all_downstream`},Ro=({menuItems:e,open:t,onClose:n,x:r,y:i,featureToggles:a,DisabledItemWrapper:o})=>{let s=o??(({children:e})=>K(G,{children:e})),c=a?.mode===`metadata only`;return K(fi,{open:t,onClose:n,anchorReference:`anchorPosition`,anchorPosition:{top:i,left:r},slotProps:{paper:{sx:{fontSize:`0.85rem`,width:`250px`}}},children:e.length===0?K(pi,{disabled:!0,children:`No action available`},`no action`):e.map(({isSeparator:e,label:t,isDisabled:r,action:i,itemIcon:a})=>{if(e)return K(hr,{},t);let l=q(pi,{disabled:r,onClick:()=>{i&&i(),n()},children:[a,` `,t]},t);return r&&o?K(s,{display:c,children:l},t):l})})},zo=({isOpen:e,onClose:t,x:n,y:r,node:i,deps:a={},viewOptions:o={},featureToggles:s={},serverFlags:c={},noCatalogCurrent:l=!1,isActionAvailable:u=()=>!0})=>{let d=[],{runAction:f,onNavigate:p,onTrack:m,findByRunType:h,setSqlQuery:g,setPrimaryKeys:_,getPrimaryKey:v,DisabledItemWrapper:y}=a,{selectMode:b,cll:x,showColumnLevelLineage:S,setChangeAnalysisMode:C,selectParentNodes:w,selectChildNodes:T,getNodeColumnSet:E}=o,D=c.single_env_onboarding??!1,O=s.disableDatabaseQuery??!1;if(!i?.data)return K(G,{});let k=i.data,A=k.resourceType,j=E?Array.from(E(i.id)):[],ee={source:`lineage_model_node`},M=k.changeStatus,N=v?.(k.name);if(M===`modified`&&d.push({label:`Show Impact Radius`,itemIcon:K(xr,{}),isDisabled:l||!u(`change_analysis`),action:()=>{Ra({nodeId:i.id,setChangeAnalysisMode:C,showColumnLevelLineage:S})}}),!b&&A&&[`model`,`seed`,`snapshot`].includes(A)){d.length>0&&d.push({label:`select group one`,isSeparator:!0});let e=h?.(D?`query`:`query_diff`),t=k.change?.columns?Object.keys(k.change.columns):[],n=rn(t,t),r=`select * from {{ ref("${k.name}") }}`;if(n.length&&(r=`select \n ${n.join(`
2
+ import{$ as e,A as t,C as n,D as r,E as i,F as a,I as o,J as s,M as c,N as l,P as u,S as d,T as f,V as p,Y as m,_ as h,a as g,at as _,c as v,d as y,ft as b,gt as x,h as S,j as C,l as w,m as T,n as E,nt as D,o as O,p as k,q as A,rt as j,s as ee,st as M,u as N,vt as P,yt as te}from"./api-S5ho3Qs3.js";import{c as ne,f as F}from"./keepAlive-bjIHulj-.js";import{n as re,r as ie,t as ae}from"./fetchClient-D0p358nB.js";import{A as oe,D as I,E as se,N as ce,S as le,T as ue,_ as de,a as fe,b as pe,c as me,d as he,f as ge,g as _e,h as ve,j as ye,l as be,m as xe,o as Se,p as Ce,s as we,u as Te,v as Ee,x as De,y as L}from"./utils-D2GZ30yl.js";import{i as Oe,n as ke}from"./colors-4aGxuAVw.js";import{$ as Ae,$t as je,A as Me,An as Ne,Bt as R,C as Pe,Cn as Fe,D as Ie,Dn as Le,E as Re,En as ze,F as Be,Fn as Ve,Ft as He,Gn as Ue,Gt as We,Hn as Ge,Ht as Ke,In as qe,It as Je,Jt as z,Kn as Ye,Kt as Xe,Ln as Ze,Mn as Qe,Nn as $e,Nt as et,O as tt,On as nt,Pn as rt,Pt as it,Qt as at,Rt as ot,S as st,Sn as ct,Tn as lt,Un as ut,Ut as dt,Vt as ft,Wt as pt,Xt as mt,Yt as ht,an as gt,b as _t,bt as vt,cn as yt,ct as bt,d as xt,en as St,f as Ct,ft as wt,gt as Tt,i as Et,in as Dt,it as Ot,jn as kt,jt as At,k as jt,kn as Mt,l as Nt,lt as Pt,mn as Ft,n as It,nn as Lt,on as Rt,qt as zt,rn as Bt,sn as Vt,t as Ht,tn as Ut,u as Wt,un as Gt,ut as Kt,vn as qt,vt as Jt,w as Yt,wn as Xt,xn as Zt,yt as Qt,z as $t,zt as en}from"./hooks-BaBhwe4N.js";import{Lt as tn,Rt as nn,c as rn,g as an,l as on,o as sn,pt as cn,r as ln,s as un,t as dn,ut as fn,zt as pn}from"./utils-BtK9KoQL.js";import{fetchGitHubAvatar as mn,fetchUser as hn}from"./lib/api/user.js";import{PUBLIC_API_URL as gn,PUBLIC_CLOUD_WEB_URL as _n,RECCE_SUPPORT_CALENDAR_URL as vn}from"./lib/const.js";import{EXPLORE_ACTION as yn,EXPLORE_SOURCE as bn,trackArtifactUploadStarted as xn,trackColumnLevelLineage as Sn,trackCopyToClipboard as Cn,trackDwSetupCompleted as wn,trackDwSetupShown as Tn,trackDwSetupSkipped as En,trackEnvironmentConfig as Dn,trackExploreAction as On,trackHistoryAction as kn,trackInit as An,trackLineageSelection as jn,trackLineageViewRender as Mn,trackMultiNodesAction as Nn,trackNavigation as Pn,trackOssShareButtonClicked as Fn,trackProfileDistribution as In,trackRedirectToCloudSession as Ln,trackSignupCompleted as Rn,trackSignupRedirectInitiated as zn,trackStateAction as Bn}from"./lib/api/track.js";import{t as Vn}from"./constants-Bgp90yan.js";import{QueryClient as Hn,QueryClientProvider as Un,useMutation as Wn,useQuery as Gn,useQueryClient as Kn}from"@tanstack/react-query";import{Suspense as qn,createContext as Jn,forwardRef as Yn,memo as Xn,useCallback as B,useContext as Zn,useEffect as V,useImperativeHandle as Qn,useLayoutEffect as $n,useMemo as H,useRef as U,useState as W}from"react";import{Fragment as G,jsx as K,jsxs as q}from"react/jsx-runtime";import J from"@mui/material/Box";import Y from"@mui/material/Button";import er from"@mui/material/Dialog";import tr from"@mui/material/DialogActions";import nr from"@mui/material/DialogContent";import rr from"@mui/material/DialogTitle";import ir from"@mui/material/Link";import X from"@mui/material/Stack";import Z from"@mui/material/Typography";import ar from"js-cookie";import{LuExternalLink as or,LuSave as sr}from"react-icons/lu";import{useTheme as cr}from"@mui/material/styles";import{useTheme as lr}from"next-themes";import Q from"@mui/material/IconButton";import ur from"next/link";import{IoBookmarksOutline as dr,IoClose as fr,IoSync as pr,IoWarning as mr}from"react-icons/io5";import hr from"@mui/material/Divider";import gr from"@mui/material/CircularProgress";import $ from"@mui/material/Tooltip";import{FaCloud as _r,FaExpandArrowsAlt as vr,FaGithub as yr,FaQuestionCircle as br,FaRegDotCircle as xr,FaSlack as Sr,FaUser as Cr}from"react-icons/fa";import{PiBookmarkSimple as wr,PiCaretDown as Tr,PiChatText as Er,PiCheckCircle as Dr,PiCircle as Or,PiCopy as kr,PiExport as Ar,PiInfo as jr,PiInfoFill as Mr,PiMoon as Nr,PiNotePencil as Pr,PiPencil as Fr,PiPencilSimple as Ir,PiPlusCircle as Lr,PiRepeat as Rr,PiSun as zr,PiTrashFill as Br,PiTrashSimple as Vr,PiUserPlus as Hr,PiX as Ur}from"react-icons/pi";import Wr from"@mui/material/Chip";import{Background as Gr,BackgroundVariant as Kr,BaseEdge as qr,ControlButton as Jr,Controls as Yr,MiniMap as Xr,Panel as Zr,Position as Qr,ReactFlow as $r,ReactFlowProvider as ei,getBezierPath as ti,getNodesBounds as ni,useEdgesState as ri,useNodesState as ii,useReactFlow as ai,useStore as oi}from"@xyflow/react";import si from"file-saver";import ci from"@mui/material/Checkbox";import li from"@mui/material/FormControlLabel";import ui from"@mui/material/Alert";import di from"@mui/material/InputBase";import fi from"@mui/material/Menu";import pi from"@mui/material/MenuItem";import{isEmpty as mi}from"lodash";import{VscCircleLarge as hi,VscGitPullRequest as gi,VscHistory as _i,VscKebabVertical as vi}from"react-icons/vsc";import yi from"@mui/material/ListSubheader";import bi from"@mui/material/FormControl";import{Box as xi,Typography as Si}from"@mui/material";import Ci from"@mui/material/TextField";import{format as wi,formatDistanceToNow as Ti}from"date-fns";import Ei from"@mui/material/Tab";import Di from"@mui/material/Tabs";import Oi from"@mui/material/List";import ki from"@mui/material/ListItem";import Ai from"@mui/material/Avatar";import ji from"@mui/material/Popover";import{usePathname as Mi,useRouter as Ni,useSearchParams as Pi}from"next/navigation";import{MdArrowBack as Fi,MdArrowDownward as Ii,MdArrowUpward as Li,MdGpsFixed as Ri,MdInfo as zi,MdSearch as Bi}from"react-icons/md";import{TbChecklist as Vi,TbEdit as Hi}from"react-icons/tb";import Ui from"@mui/material/ListItemIcon";import Wi from"@mui/material/ListItemText";import{FiArrowRight as Gi,FiCopy as Ki,FiInfo as qi,FiPackage as Ji}from"react-icons/fi";import Yi from"@mui/material/Switch";import{RiArrowDownSFill as Xi,RiArrowUpSFill as Zi,RiMindMap as Qi,RiSwapLine as $i,RiTerminalBoxLine as ea}from"react-icons/ri";import{FaBookmark as ta,FaFileImport as na}from"react-icons/fa6";import{captureException as ra}from"@sentry/react";import{BiArrowFromBottom as ia,BiArrowToBottom as aa}from"react-icons/bi";import"@xyflow/react/dist/style.css";import oa from"@dagrejs/dagre";import sa from"@mui/material/Skeleton";import ca from"@mui/material/Radio";import la from"@mui/material/RadioGroup";import{snapdom as ua}from"@zumer/snapdom";import da from"@mui/material/Paper";import fa from"@mui/material/Table";import pa from"@mui/material/TableBody";import ma from"@mui/material/TableCell";import ha from"@mui/material/TableContainer";import ga from"@mui/material/TableHead";import _a from"@mui/material/TableRow";import va from"@mui/material/InputLabel";import ya from"@mui/material/Select";import ba from"@mui/material/Badge";import xa from"@mui/material/Grid";import{stripIndents as Sa}from"common-tags";import{IoMdCodeWorking as Ca}from"react-icons/io";import{DragDropContext as wa,Draggable as Ta,Droppable as Ea}from"@hello-pangea/dnd";import Da from"@mui/material/Card";import Oa from"@mui/material/CardContent";import ka from"@mui/material/CardHeader";const Aa=Jn(null);Aa.displayName=`RecceRoutingContext`;function ja(){return Zn(Aa)||{basePath:``,buildPath:e=>e,pathname:``,navigate:e=>{typeof window<`u`&&(window.location.href=e)}}}function Ma(){let{pathname:e,navigate:t}=ja();return[e,t]}function Na({children:e,config:t}){let n=t?.basePath??``,r=t?.pathname??``,i=t?.onNavigate,a=B(e=>n?`${n}${e.startsWith(`/`)?e:`/${e}`}`:e,[n]),o=B((e,t)=>{i?i(e,t):typeof window<`u`&&(t?.replace?(window.history.replaceState(null,``,e),window.dispatchEvent(new PopStateEvent(`popstate`))):window.location.href=e)},[i]),s=H(()=>({basePath:n,buildPath:a,pathname:r,navigate:o}),[n,a,r,o]);return K(Aa.Provider,{value:s,children:e})}const Pa=e=>new Hn({defaultOptions:{queries:{staleTime:e?.staleTime??1e3*60,gcTime:e?.gcTime??1e3*60*5,retry:1,refetchOnWindowFocus:!1}}});function Fa({children:e,api:t,theme:n=`system`,routing:r,queryClient:i,runActions:a,lineage:o,checks:s,query:c,features:l={}}){let u=i?.staleTime,d=i?.gcTime,f=H(()=>Pa({staleTime:u,gcTime:d}),[u,d]),{enableInstance:p=!0,enableIdleTimeout:m=!0,enableLineage:h=!0,enableRunActions:g=!0,enableChecks:_=!0,enableQuery:v=!0}=l,y=e;return y=K(Na,{config:r,children:y}),y=K(pn,{defaultMode:n,children:y}),y=K(ne,{config:t,children:y}),y=K(Un,{client:f,children:y}),v&&(y=K(ut,{sql:c?.sql,isExecuting:c?.isExecuting,error:c?.error,baseResult:c?.baseResult,currentResult:c?.currentResult,onSqlChange:c?.onSqlChange,onExecute:c?.onExecute,onCancel:c?.onCancel,children:y})),_&&(y=K(Ue,{checks:s?.checks,isLoading:s?.isLoading,error:s?.error,selectedCheckId:s?.selectedCheckId,onSelectCheck:s?.onSelectCheck,onCreateCheck:s?.onCreateCheck,onUpdateCheck:s?.onUpdateCheck,onDeleteCheck:s?.onDeleteCheck,onReorderChecks:s?.onReorderChecks,refetchChecks:s?.refetchChecks,children:y})),g&&(y=K(oe,{onRunAction:a?.onRunAction,onShowRunId:a?.onShowRunId,initialRunId:a?.initialRunId,initialHistoryOpen:a?.initialHistoryOpen,children:y})),h&&(y=K(Ee,{lineageGraph:o?.lineageGraph,envInfo:o?.envInfo,reviewMode:o?.reviewMode,cloudMode:o?.cloudMode,fileMode:o?.fileMode,fileName:o?.fileName,isDemoSite:o?.isDemoSite,isCodespace:o?.isCodespace,isLoading:o?.isLoading,error:o?.error,supportTasks:o?.supportTasks,onRefetchLineageGraph:o?.onRefetchLineageGraph,runsAggregated:o?.runsAggregated,onRefetchRunsAggregated:o?.onRefetchRunsAggregated,children:y})),m&&(y=K(De,{children:y})),p&&(y=K(ue,{children:y})),y}function Ia({actionState:e,onCancel:t,onClose:n}){let r=()=>e.mode===`per_node`?`${e.completed} / ${e.total}`:e.currentRun?.progress?.percentage?`${e.currentRun.progress.percentage*100}%`:e.status===`completed`?`100%`:`0%`,i=e.status===`running`||e.status===`canceling`;return K(J,{sx:{bgcolor:`background.paper`,borderRadius:1,boxShadow:6},children:q(X,{direction:`row`,divider:K(hr,{orientation:`vertical`,flexItem:!0}),spacing:2,sx:{p:`5px 15px`,mt:2},children:[q(J,{sx:{fontSize:`10pt`},children:[`Progress: `,r(),` `,e.status===`canceled`?` (canceled)`:``]}),i?K(Y,{size:`small`,variant:`outlined`,onClick:t,disabled:e.status===`canceling`,children:e.status===`canceling`?`Canceling`:`Cancel`}):K(X,{direction:`row`,children:K(Y,{size:`small`,variant:`outlined`,onClick:n,children:`Close`})})]})})}function La(e){return e?{node_id:e,change_analysis:!0,no_upstream:!0}:{change_analysis:!0,no_upstream:!0}}function Ra({nodeId:e,setChangeAnalysisMode:t,showColumnLevelLineage:n}){t?.(!0),n?.(La(e))}function za(e,t){return{node_id:e,column:t}}function Ba(e,t){return{...e,change_analysis:e.change_analysis??t}}function Va({cllInput:e,changeAnalysisMode:t,newCllExperience:n}){return!e&&!n?!1:t}function Ha({changeAnalysisMode:e,newCllExperience:t}){return t&&e?La():void 0}function Ua({nodeId:e,changeAnalysisMode:t,cllInput:n,lineageGraph:r}){if(!r||!t)return!1;let i=!!(e in r.nodes?r.nodes[e]:void 0)?.data.changeStatus;return n?.node_id&&!n.column?n.node_id===e&&i:i}const Wa=({lineageGraph:e,cllInput:t,onCenterNode:n})=>{let r={cursor:`pointer`,fontFamily:`monospace`,bgcolor:nn()?`grey.700`:`grey.100`,px:.5,borderRadius:.5};if(!e)return K(G,{});if(!t)return K(G,{children:`Default View`});if(t.node_id===void 0)return K(Z,{component:`span`,children:`Impact Radius for All Changed Models`});let i=t.node_id in e.nodes?e.nodes[t.node_id].data.name:t.node_id;if(!t.column){let e=t.node_id;return q(G,{children:[K(Z,{component:`span`,sx:{mr:`5px`},children:`Impact Radius for`}),K(J,{component:`code`,onClick:()=>{n(e)},sx:r,children:i})]})}let a=`${t.node_id}_${t.column}`;return q(G,{children:[q(Z,{component:`span`,sx:{mr:`5px`},children:[`Column Lineage for`,` `]}),q(J,{component:`code`,onClick:()=>{n(a)},sx:r,children:[i,`.`,t.column]})]})},Ga=({action:e,interactive:t,viewOptions:n,lineageGraph:r,singleEnvMode:i=!1,changeAnalysisAvailable:a=!0,onShowCll:o,onResetCll:s,onCenterNode:c,setChangeAnalysisMode:l,newCllExperience:u=!1,changeAnalysisMode:d=!1})=>{let f=n.column_level_lineage,p=!r?.catalogMetadata.current,m=u&&d,h=f&&!(u&&!f.column);return q(X,{direction:`row`,spacing:`5px`,children:[!i&&!m&&K(J,{sx:{borderRadius:1,boxShadow:3},children:K($,{enterDelay:50,title:a?p?`Please provide catalog.json to enable Impact Radius`:``:`Requires warehouse connection`,placement:`top`,children:K(`span`,{children:K(Y,{size:`small`,variant:`outlined`,color:`neutral`,sx:{whiteSpace:`nowrap`,display:`inline-flex`,bgcolor:`background.paper`},disabled:!t||p||!a||e.isPending,startIcon:K(xr,{}),onClick:()=>{Ra({setChangeAnalysisMode:l,showColumnLevelLineage:o})},children:`Impact Radius`})})})}),h&&q(X,{direction:`row`,sx:{alignItems:`center`,borderRadius:1,boxShadow:3,border:`1px solid`,borderColor:`divider`,bgcolor:`background.paper`,fontSize:`0.8rem`,p:`0 0.625rem`},children:[K(Wa,{lineageGraph:r,cllInput:f,onCenterNode:c}),e.isError&&K($,{title:`Error: ${e.error.message}`,placement:`bottom`,children:K(Z,{component:`span`,sx:{color:`error.main`,ml:`2px`,display:`inline-flex`,alignItems:`center`},children:K(J,{component:jr,sx:{color:`error.main`,fontSize:`14px`}})})}),e.isPending?K(gr,{size:12,sx:{ml:`2px`}}):K(Q,{size:`small`,sx:{ml:`2px`},"aria-label":`Reset Column Level Lineage`,onClick:()=>{s()},children:K(Ur,{size:`10px`})})]})]})};function Ka({onClose:e}){let{cancel:t,actionState:n}=de();return K(Ia,{actionState:n,onCancel:t,onClose:e})}const qa=({action:e})=>{let{showColumnLevelLineage:t,resetColumnLevelLineage:n,interactive:r,viewOptions:i,centerNode:a,setChangeAnalysisMode:o,newCllExperience:s,changeAnalysisMode:c}=de(),{data:l}=ge(),u=l?.single_env_onboarding??!1,{lineageGraph:d,isActionAvailable:f}=L();return K(Ga,{action:e,interactive:r,viewOptions:i,lineageGraph:d,singleEnvMode:u,changeAnalysisAvailable:f(`change_analysis`),onShowCll:t,onResetCll:()=>n(),onCenterNode:a,setChangeAnalysisMode:o,newCllExperience:s,changeAnalysisMode:c})};function Ja(e){let{id:t,data:n}=e,{id:r}=n.node,{column:i,type:a,transformationType:o,changeStatus:s,isImpacted:c}=n,l=oi(e=>e.transform[2]>.3),{isDark:u}=Ht(),{viewOptions:d,showContextMenu:f,isNodeHighlighted:p,isNodeShowingChangeAnalysis:m,newCllExperience:h}=de(),g=d.column_level_lineage?.node_id,_=i===d.column_level_lineage?.column&&r===g,v=p(t),y=m(r);return K(Zt,{id:t,data:{column:i,type:a,nodeId:r,transformationType:o,changeStatus:s,isHighlighted:v,isFocused:_,isImpacted:c},showContent:l,showChangeAnalysis:y,isDark:u,newCllExperience:h,onContextMenu:(t,n)=>{f(t,e)}})}const Ya=Xn(Ja);Ya.displayName=`GraphColumnNode`;function Xa(e){let{source:t,target:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,style:l={},markerEnd:u,data:d,isEdgeHighlighted:f}=e,p={...l};d?.changeStatus&&(p.stroke=kt(d.changeStatus).hexColor,p.strokeDasharray=`5`),!f||f(t,n)||(p.filter=rt);let[m]=ti({sourceX:r,sourceY:i,sourcePosition:s,targetX:a,targetY:o,targetPosition:c});return K(G,{children:K(qr,{path:m,markerEnd:u,style:{...p,...l}})})}const Za=Xn(Xa);Za.displayName=`GraphEdge`;function Qa(e){let{isEdgeHighlighted:t}=de();return K(Za,{...e,isEdgeHighlighted:t})}const $a=()=>K(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 256 256`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,children:K(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z`})}),eo=()=>K(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 256 256`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,children:K(`path`,{d:`M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z`})});function to({skipReason:e}){return K(Wr,{size:`small`,label:q(X,{direction:`row`,sx:{fontSize:`10pt`,color:`grey.500`,alignItems:`center`,gap:`3px`},children:[K(J,{children:`Skipped`}),e&&K($,{title:e,children:K(J,{component:`span`,sx:{display:`flex`},children:K($a,{})})})]}),sx:{bgcolor:`grey.100`}})}function no({errorMessage:e}){return q(X,{direction:`row`,sx:{fontSize:`10pt`,color:`gray`,alignItems:`center`},children:[K(J,{children:`Error`}),e&&K($,{title:e,children:K(J,{component:`span`,sx:{display:`flex`},children:K(eo,{})})})]})}function ro({result:e}){let{mismatchedColumns:t}=e,n=t>0;return K(Wr,{size:`small`,sx:{bgcolor:n?`error.light`:`success.light`},label:K(X,{direction:`row`,sx:{fontSize:`10pt`,color:n?`error.main`:`success.main`,alignItems:`center`,gap:`3px`},children:n?`${t} columns mismatched`:`All columns match`})})}function io({result:e}){let{base:t,current:n}=e,r=t===null?`N/A`:t.toLocaleString(),i=n===null?`N/A`:n.toLocaleString(),a=``,o=`grey.500`;return t!==null&&n!==null&&(n>t?(a=`↑`,o=`success.main`):n<t?(a=`↓`,o=`error.main`):a=`=`),K(Wr,{size:`small`,sx:{bgcolor:`grey.100`},label:q(X,{direction:`row`,sx:{fontSize:`10pt`,alignItems:`center`,gap:`3px`},children:[K(J,{children:r}),K(J,{children:`→`}),K(J,{children:i}),a&&K(J,{component:`span`,sx:{color:o,ml:.5},children:a})]})})}function ao({status:e,skipReason:t,errorMessage:n,progress:r,valueDiffResult:i,rowCountDiffResult:a,runId:o,"data-testid":s}){return e===`pending`?K(gr,{size:16,"data-testid":s,"data-status":`pending`}):e===`skipped`?K(J,{"data-testid":s,"data-status":`skipped`,children:K(to,{skipReason:t})}):e===`running`?r?.percentage===void 0?K(gr,{size:16,"data-testid":s,"data-status":`running`}):K(gr,{variant:`determinate`,value:r.percentage*100,size:16,"data-testid":s,"data-status":`running`}):e===`error`?K(J,{"data-testid":s,"data-status":`error`,children:K(no,{errorMessage:n})}):i?K(J,{"data-testid":s,"data-status":`success`,children:K(ro,{result:i})}):a?K(J,{"data-testid":s,"data-status":`success`,children:K(io,{result:a})}):K(J,{"data-testid":s,"data-status":`success`,children:o||`Complete`})}const oo=Xn(ao);oo.displayName=`ActionTag`;const so={success:`#059669`,failure:`#ef4444`,error:`#ef4444`,warning:`#f59e0b`},co={success:`PASSED`,failure:`FAILED`,error:`ERROR`,warning:`WARNING`};function lo(e){return so[e]??`#6b7280`}function uo(e){return co[e]??e.toUpperCase()}function fo({run:e,index:t,onClick:n}){let r=lo(e.status),i=uo(e.status),a=Ti(new Date(e.run_at),{addSuffix:!0}),o=!!n;return q(xi,{component:o?`button`:`div`,type:o?`button`:void 0,onClick:o?()=>n?.(e.run_id):void 0,"aria-label":o?`View run #${t} — ${i}`:void 0,sx:{p:1,border:`none`,borderLeft:`3px solid ${r}`,borderRadius:1,bgcolor:`action.hover`,cursor:o?`pointer`:`default`,"&:hover":o?{bgcolor:`action.selected`}:{},textAlign:`left`,width:`100%`,font:`inherit`,color:`inherit`},children:[q(Si,{variant:`body2`,sx:{fontWeight:600,fontSize:`0.75rem`},children:[`Run #`,t,` — `,i,e.triggered_by===`recce_ai`&&K(Si,{component:`span`,sx:{ml:.75,fontSize:`0.65rem`,fontWeight:500,color:`#7c3aed`},children:`by AI`})]}),e.summary&&K(Si,{variant:`body2`,sx:{color:`text.secondary`,fontSize:`0.7rem`,mt:.25},children:e.summary}),K(Si,{variant:`body2`,sx:{color:`text.secondary`,fontSize:`0.65rem`,mt:.25},children:a})]})}function po({event:e}){let t=p(e),n={create:Lr,comment:Er,approve:Dr,unapprove:Or,edit:Pr,preset:wr},r={create:`primary.main`,comment:`grey.500`,approve:`success.main`,unapprove:`grey.400`,edit:`warning.main`,preset:`secondary.main`},i=n[t],a=r[t];return K(J,{component:i,sx:{color:a,fontSize:16}})}function mo({event:e}){let{actor:t}=e,{avatarUrl:n}=en({userId:t.user_id}),r=(t.fullname||t.login||`User`).charAt(0).toUpperCase();return K(Ai,{src:n||void 0,sx:{width:24,height:24,fontSize:`0.75rem`},children:r})}function ho({event:e}){let{actor:t}=e,n=t.fullname||t.login||`Someone`,r=Ti(new Date(e.created_at),{addSuffix:!0}),i=``;switch(e.event_type){case`check_created`:i=`created this check`;break;case`approval_change`:i=e.new_value===`true`?`approved this check`:`unapproved this check`;break;case`description_change`:i=`updated the description`;break;case`name_change`:i=`renamed this check`;break;case`preset_applied`:i=`applied a preset`;break;default:i=`made a change`}return q(J,{sx:{display:`flex`,gap:1,alignItems:`flex-start`,py:1},children:[K(J,{sx:{pt:`2px`},children:K(po,{event:e})}),K(J,{sx:{flex:1},children:q(X,{direction:`row`,spacing:.5,sx:{flexWrap:`wrap`,alignItems:`center`},children:[K(mo,{event:e}),K(Z,{variant:`body2`,sx:{fontWeight:`500`},children:n}),K(Z,{variant:`body2`,sx:{color:`text.secondary`},children:i}),K(Z,{variant:`caption`,sx:{color:`text.disabled`},children:r})]})})]})}function go({event:e,currentUserId:t,onEdit:n,onDelete:r}){let i=nn(),[a,o]=W(!1),[s,c]=W(e.content||``),[l,u]=W(!1),[d,f]=W(!1),[p,m]=W(null),h=!!p,{actor:g}=e,_=g.fullname||g.login||`Someone`,v=Ti(new Date(e.created_at),{addSuffix:!0}),y=t&&String(g.user_id)===String(t),b=()=>{c(e.content||``),o(!0)},x=()=>{c(e.content||``),o(!1)},S=async()=>{let t=s.trim();if(!t||t===e.content){x();return}if(n){u(!0);try{await n(e.id,t),o(!1)}finally{u(!1)}}},C=e=>{e.key===`Escape`?x():e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),S())},w=e=>{m(e.currentTarget)},T=()=>{m(null)};return e.is_deleted?q(J,{sx:{display:`flex`,gap:1,alignItems:`center`,py:1},children:[K(J,{sx:{pt:`2px`,display:`flex`,alignItems:`center`},children:K(po,{event:e})}),K(J,{sx:{display:`flex`,flex:1,alignItems:`center`},children:K(Z,{variant:`body2`,sx:{color:`text.disabled`,fontStyle:`italic`},children:`Comment deleted`})})]}):q(J,{sx:{display:`flex`,gap:1,alignItems:`flex-start`,py:1},children:[K(J,{sx:{pt:`2px`},children:K(po,{event:e})}),q(J,{sx:{flex:1},children:[q(X,{direction:`row`,spacing:.5,sx:{flexWrap:`wrap`,alignItems:`center`,mb:.5},children:[K(mo,{event:e}),q(Z,{variant:`body2`,sx:{fontWeight:`500`},children:[_,y&&q(Z,{component:`span`,variant:`body2`,sx:{color:`text.secondary`},children:[` `,`(Author)`]})]}),K(Z,{variant:`caption`,sx:{color:`text.disabled`},children:v}),e.is_edited&&K(Z,{variant:`caption`,sx:{color:`text.disabled`},children:`(edited)`})]}),a?q(J,{children:[K(Ci,{value:s,onChange:e=>c(e.target.value),onKeyDown:C,size:`small`,multiline:!0,minRows:3,fullWidth:!0,disabled:l,autoFocus:!0,sx:{"& .MuiOutlinedInput-root":{bgcolor:`background.paper`,"&:focus-within":{borderColor:`primary.main`}}}}),q(X,{direction:`row`,spacing:1,sx:{justifyContent:`flex-end`,mt:1},children:[K(Y,{size:`small`,variant:`text`,onClick:x,disabled:l,children:`Cancel`}),K(Y,{size:`small`,variant:`contained`,onClick:S,disabled:!s.trim()||l,children:l?`Saving...`:`Save`})]})]}):q(J,{sx:{bgcolor:i?`grey.800`:`grey.50`,borderRadius:1,p:1,border:`1px solid`,borderColor:i?`grey.700`:`grey.200`,position:`relative`,"&:hover .comment-actions":{opacity:1}},children:[K(wt,{content:e.content||``,fontSize:`sm`}),y&&(n||r)&&q(X,{className:`comment-actions`,direction:`row`,spacing:0,sx:{position:`absolute`,top:4,right:4,opacity:0,transition:`opacity 0.2s`},children:[n&&K($,{title:`Edit comment`,children:K(Q,{"aria-label":`Edit comment`,size:`small`,onClick:b,children:K(Ir,{})})}),r&&q(G,{children:[K($,{title:`Delete comment`,children:K(Q,{"aria-label":`Delete comment`,size:`small`,color:`error`,onClick:w,children:K(Vr,{})})}),K(ji,{open:h,anchorEl:p,onClose:T,anchorOrigin:{vertical:`bottom`,horizontal:`center`},transformOrigin:{vertical:`top`,horizontal:`center`},children:q(J,{sx:{p:2},children:[K(Z,{variant:`body2`,sx:{mb:2},children:`Delete this comment?`}),q(X,{direction:`row`,spacing:1,sx:{justifyContent:`flex-end`},children:[K(Y,{size:`small`,variant:`text`,onClick:T,disabled:d,children:`Cancel`}),K(Y,{size:`small`,variant:`contained`,color:`error`,onClick:async()=>{if(r){f(!0);try{await r(e.id),T()}finally{f(!1)}}},disabled:d,children:d?`Deleting...`:`Delete`})]})]})})]})]})]})]})]})}function _o({event:e,currentUserId:t,onEdit:n,onDelete:r}){return e.event_type===`comment`?K(go,{event:e,currentUserId:t,onEdit:n,onDelete:r}):K(ho,{event:e})}function vo(e,t){let n=e?.toLowerCase();return n===`finished`?t?`error`:`success`:n===`failed`?`error`:e??`unknown`}function yo(e,t){let n=[];for(let t of e)n.push({kind:`event`,event:t,at:t.created_at});if(t){let e=[...t].sort((e,t)=>new Date(e.run_at).getTime()-new Date(t.run_at).getTime());for(let t=0;t<e.length;t++)n.push({kind:`run`,run:e[t],index:t+1,at:e[t].run_at})}return n.sort((e,t)=>new Date(t.at).getTime()-new Date(e.at).getTime()),n}function bo({checkId:t}){let n=nn(),{apiClient:r,authToken:i}=R(),{events:a,isLoading:o,error:s,createComment:c,isCreatingComment:l,updateComment:u,deleteComment:d}=Nt(t),{data:f}=Gn({queryKey:F.user(),queryFn:()=>hn(r),retry:!1}),{data:p}=Gn({queryKey:[`check-runs`,t],queryFn:async()=>(await e(r)).filter(e=>e.check_id===t).map(e=>({run_id:e.run_id,run_at:e.run_at,status:vo(e.status,e.error),summary:e.error||void 0,triggered_by:e.triggered_by})),enabled:!!i,staleTime:3e4}),m=H(()=>yo(a,p),[a,p]),h=e=>{c(e)},g=async(e,t)=>{await u({eventId:e,content:t})},_=async e=>{await d(e)};return o?K(J,{sx:{height:`100%`,p:4,display:`flex`,justifyContent:`center`,alignItems:`center`},children:K(gr,{size:20})}):s?K(J,{sx:{height:`100%`,p:4,display:`flex`,justifyContent:`center`,alignItems:`center`},children:K(Z,{sx:{fontSize:`0.875rem`,color:`error.main`},children:`Failed to load timeline`})}):q(X,{sx:{height:`100%`,alignItems:`stretch`,borderLeft:`1px solid`,borderColor:n?`grey.700`:`grey.200`},spacing:0,children:[K(J,{sx:{px:3,py:2,borderBottom:`1px solid`,borderColor:n?`grey.700`:`grey.200`},children:K(Z,{variant:`subtitle2`,sx:{fontWeight:500},children:`Activity`})}),K(J,{sx:{flex:1,overflowY:`auto`,px:3,py:2},children:m.length===0?K(Z,{sx:{fontSize:`0.875rem`,color:`grey.500`},children:`No activity yet`}):K(X,{sx:{alignItems:`stretch`},spacing:0,children:m.map((e,t)=>q(J,{children:[e.kind===`event`?K(_o,{event:e.event,currentUserId:f?.id,onEdit:g,onDelete:_}):K(fo,{run:e.run,index:e.index}),t<m.length-1&&K(hr,{sx:{borderColor:n?`grey.700`:`grey.100`}})]},e.kind===`event`?e.event.id:e.run.run_id))})}),K(J,{sx:{px:3,py:3,borderTop:`1px solid`,borderColor:n?`grey.700`:`grey.200`,bgcolor:n?`grey.900`:`grey.50`},children:K(ot,{onSubmit:h,isSubmitting:l})})]})}function xo({color:e}){return K(J,{component:`span`,sx:{display:`inline-block`,width:`10px`,height:`10px`,bgcolor:e,mr:1,borderRadius:`4px`}})}const So=({defaultPrimaryKeys:e,onPrimaryKeysChange:t,...n})=>{let{isActionAvailable:r}=L(),i=H(()=>[],[]);return K(J,{sx:{display:`flex`},...n,children:q(X,{spacing:0,sx:{m:`0 0.5rem`},children:[q(X,{direction:`row`,spacing:.5,sx:{alignItems:`center`},children:[K(Z,{component:`label`,sx:{fontSize:`0.625rem`,color:`text.secondary`},children:`Diff with Primary Key(s) (suggested)`}),K($,{title:`Provide a primary key to perform query diff in data warehouse and only return changed rows.`,placement:`bottom-end`,children:K(J,{component:`span`,sx:{display:`flex`,color:`grey.600`,cursor:`help`},children:K(jr,{fontSize:`0.75rem`})})})]}),K(Ft,{className:`no-track-pii-safe`,unitName:`key`,defaultValues:e,suggestionList:i,onValuesChange:t,size:`2xs`,width:`240px`,placeholder:`Select or type to add keys`,disabled:!r(`query_diff_with_primary_key`)})]})})};function Co({supportCalendarUrl:e=`https://cal.com/team/recce/chat`}){let{data:t}=I();return K(`div`,{className:`flex flex-1 h-full min-h-0 m-2 p-4 bg-blue-50 rounded-lg shadow-md justify-center`,children:q(`div`,{className:`w-4/5 flex flex-col overflow-y-auto gap-6 px-8 pb-8`,children:[q(X,{spacing:2,sx:{alignItems:`center`},children:[K(J,{sx:{p:1,bgcolor:`background.paper`,borderRadius:`50%`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:2},children:K(J,{component:ea,sx:{fontSize:28,color:`iochmara.500`}})}),K(Z,{variant:`h5`,sx:{mt:2},children:`Wait, there's more!`}),q(Z,{sx:{fontSize:`1rem`,textAlign:`center`},children:[`Query functions disabled without a`,` `,K(Z,{component:`span`,sx:{fontWeight:`bold`},children:`data warehouse connection`})]})]}),K(X,{sx:{width:`50%`,mt:3,mx:`auto`},children:K(Y,{color:`iochmara`,variant:`contained`,size:`large`,onClick:()=>{window.open(dn(t,e),`_blank`)},children:`Connect to Data Warehouse`})})]})})}const wo=()=>{let{isCustomQueries:e,setCustomQueries:t,sqlQuery:n,setBaseSqlQuery:r}=_t();return q(J,{children:[q(X,{direction:`row`,spacing:.5,sx:{alignItems:`center`,fontSize:`0.75rem`},children:[K(Z,{variant:`body2`,sx:{fontSize:`0.75rem`},children:`Custom Queries`}),K($,{title:`Custom queries allow you to use two SQL queries to compare results between current and base environments.`,children:K(J,{component:`span`,sx:{display:`flex`,color:`grey.600`},children:K(Mr,{fontSize:`1rem`})})})]}),K(Yi,{size:`small`,checked:e,onChange:()=>{!e&&r&&r(n),t(!e)},color:`primary`})]})},To=()=>{let{sqlQuery:e,baseSqlQuery:t,setSqlQuery:n,setBaseSqlQuery:r,primaryKeys:i,setPrimaryKeys:a,isCustomQueries:o}=_t(),{lineageGraph:c,envInfo:l}=L(),{featureToggles:u,singleEnv:d}=se(),f=e;l?.adapterType===`sqlmesh`&&e===`select * from {{ ref("mymodel") }}`&&(f=`select * from db.mymodel`),u.mode===`read only`&&(f=`--- Would like to do query here? Book a demo with us at ${vn}\n${f}`);let{showRunId:p}=ye(),{apiClient:h}=R(),{mutate:g,isPending:_}=Wn({mutationFn:async e=>{function n(e){switch(e){case`query`:return A;case`query_base`:return s;case`query_diff`:return m;default:throw Error(`Unknown query type: ${e}`)}}let r=e===`query_base`?t??``:f,a=n(e),c={sql_template:r},l={nowait:!0};e===`query_diff`&&(c.primary_keys=i,o&&(c.base_sql_template=t));let{run_id:u}=await a(c,l,h);return p(u),await j(u,void 0,h)}}),v=H(()=>{let e={};if(!c)return`N/A`;for(let t in c.nodes){let n=c.nodes[t].data.schema;n&&(e[n]=(e[n]||0)+1)}return Object.keys(e).reduce((t,n)=>e[n]>(e[t]||0)?n:t,`N/A`)},[c]);return d||u.mode===`metadata only`?q(J,{sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:[q(J,{sx:{display:`flex`,justifyContent:`right`,alignItems:`center`,padding:`4pt 8pt`,gap:`5px`,height:`54px`,borderBottom:`1px solid`,borderColor:`divider`},children:[K(kc,{}),K(J,{sx:{flexGrow:1}}),d?K($,{title:`Please configure the base environment before running the diff`,placement:`left`,children:K(`span`,{children:K(Y,{variant:`contained`,disabled:!0,size:`small`,sx:{fontSize:`14px`,mt:`16px`},children:`Run Diff`})})}):K(zl,{display:u.mode===`metadata only`,children:K(Y,{variant:`contained`,disabled:!0,size:`small`,sx:{fontSize:`14px`,mt:`16px`},children:`Run Diff`})})]}),K(Ie,{value:f,onChange:n,onRun:()=>{g(`query`)},labels:[`base (production)`,`current (${v})`],SetupGuide:u.mode===`metadata only`?K(Co,{}):K(wc,{})})]}):q(J,{sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:[q(J,{sx:{display:`flex`,justifyContent:`right`,alignItems:`flex-end`,padding:`4pt 8pt`,gap:`5px`,height:`54px`,borderBottom:`1px solid`,borderColor:`divider`,flex:`0 0 54px`},children:[K(kc,{}),K(wo,{}),K(J,{sx:{flexGrow:1}}),K(So,{defaultPrimaryKeys:i,onPrimaryKeysChange:a}),K(Y,{variant:`contained`,onClick:()=>{g(`query_diff`)},disabled:_||u.disableDatabaseQuery,size:`small`,children:`Run Diff`})]}),K(J,{sx:{width:`100%`,flex:1,overflowY:`auto`},children:o?K(Ie,{value:f,baseValue:t,onChange:n,onChangeBase:r,onRun:()=>{g(`query`)},onRunBase:()=>{g(`query_base`)},onRunDiff:()=>{g(`query_diff`)}}):K(tt,{value:f,onChange:n,onRun:()=>{g(`query`)},onRunDiff:()=>{g(`query_diff`)}})})]})};function Eo({rowCount:e}){let t=e.base,n=e.curr,r=e.base===null?`N/A`:`${e.base} Rows`,i=e.curr===null?`N/A`:`${e.curr} Rows`,a,o;t===null&&n===null?(a=`Failed to load`,o=`default`):t===null||n===null?(a=`${r} -> ${i}`,o=t===null?`success`:`error`):t===n?(a=`=`,o=`default`):(a=`${an(t,n)} Rows`,o=t<n?`success`:`error`);let s=$t(`row_count_diff`).icon;return K(Wr,{size:`small`,color:o,icon:s?K(s,{}):void 0,label:a,sx:{height:20,fontSize:`0.7rem`}})}function Do({id:e,inverted:t}){let{lineageGraph:n,runsAggregated:r}=L(),{text:i,isDark:a}=Ht(),o=r?.[e],s=n?.nodes[e];if(!o&&!s)return null;let c;s?.data.change?.columns&&(c=Object.keys(s.data.change.columns).length>0);let l;if(o?.row_count_diff){let e=o.row_count_diff.result;l=e.curr!==e.base}let u=t?i.inverted:kt(`modified`).color,d=t?i.secondary:a?`grey.700`:`grey.100`,f=$t(`schema_diff`).icon;return q(J,{sx:{display:`flex`,flex:1,alignItems:`center`},children:[c!==void 0&&K($,{title:`Schema (${c?`changed`:`no change`})`,enterDelay:500,children:K(J,{sx:{height:16},children:f&&K(J,{component:f,sx:{color:c?u:d}})})}),K(J,{sx:{flexGrow:1}}),o?.row_count_diff&&l!==void 0&&K($,{title:`Row count (${l?`changed`:`=`})`,enterDelay:500,children:K(J,{children:K(Eo,{rowCount:o.row_count_diff.result})})})]})}function Oo({nodeId:e,nodeName:t}){let{getNodeAction:n}=de(),r=n(e);if(!r)return null;let{status:i,skipReason:a,run:o}=r;if(i===`pending`)return K(oo,{status:`pending`});if(i===`skipped`)return K(oo,{status:`skipped`,skipReason:a});if(!o)return K(oo,{status:`pending`});let{error:s,run_id:c,progress:l}=o;if(i===`running`)return K(oo,{status:`running`,progress:{percentage:l?.percentage}});if(s)return K(oo,{status:`error`,errorMessage:s});if(o.type===`value_diff`&&o.result){let e=o.result,t=0,n=e.data.data.length;for(let n of e.data.data)n[2]<1&&t++;return K(oo,{status:`success`,valueDiffResult:{mismatchedColumns:t,totalColumns:n}})}if(b(o)&&o.result){let e=o.result[t];if(e)return K(Eo,{rowCount:e})}if(o.type===`row_count`&&o.result){let e=o.result[t];if(e?.curr!==void 0&&e.curr!==null)return K(Wr,{size:`small`,label:`${e.curr.toLocaleString()} Rows`,sx:{height:20,fontSize:`0.7rem`}})}return K(oo,{status:`success`,runId:c})}function ko(e){let{data:t}=e,{id:n,resourceType:r,changeStatus:i,name:a}=t,o=oi(e=>e.transform[2]>.3),{isDark:s}=Ht(),c=de(),{interactive:l,selectNode:u,selectMode:d,focusedNode:f,getNodeAction:p,getNodeColumnSet:m,isNodeHighlighted:h,isNodeSelected:g,isNodeShowingChangeAnalysis:_,showContextMenu:v,viewOptions:y,cll:b,impactedNodeIds:x,newCllExperience:S}=c,C=S?x.has(n):!1,{isWholeModelChanged:w,isWholeModelImpacted:T}=Dt(n,c),E=yt(b?.current.nodes[n]?.change_category,S?void 0:t.change?.category),D=h(n),O=g(n),k=y.column_level_lineage?.node_id===n&&y.column_level_lineage.column===void 0,A=f?.id===n||k,j=_(n),ee=m(t.id),M=d===`action_result`?p(t.id):void 0,N=i,P=d,te=d===`action_result`&&M?K(Oo,{nodeId:n,nodeName:a}):void 0,ne=d!==`action_result`&&t.resourceType===`model`?K(Do,{id:t.id,inverted:d===`selecting`&&O}):void 0;return K(Ut,{id:n,data:{label:a,changeStatus:N,resourceType:r,materialized:t.materialized},newCllExperience:S,isImpacted:C,isWholeModelChanged:w,isWholeModelImpacted:T,interactive:l,selectMode:P,isNodeSelected:O,isFocused:A,isHighlighted:D,showContent:o,actionTag:te,showChangeAnalysis:j||!S&&E!==void 0,changeCategory:E,runsAggregatedTag:ne,hasParents:Object.keys(t.parents).length>0,hasChildren:Object.keys(t.children).length>0,columnCount:ee.size,columnHeight:24,isDark:s,onSelect:e=>{u(e)},onContextMenu:(t,n)=>{v(t,e)}})}const Ao=Xn(ko);Ao.displayName=`GraphNode`;const jo={lineageGraphNode:Ao,lineageGraphColumnNode:Ya},Mo={lineageGraphEdge:Qa},No=[],Po=(e={})=>t=>{let{impactedNodeIds:n,newCllExperience:r}=e;return $e({changeStatus:t.data.changeStatus,isImpacted:r?n?.has(t.id):!1,newCllExperience:r}).color},Fo={ROW_COUNT:`row_count`,ROW_COUNT_DIFF:`row_count_diff`,PROFILE:`profile`,PROFILE_DIFF:`profile_diff`,VALUE_DIFF:`value_diff`,HISTOGRAM_DIFF:`histogram_diff`,TOP_K_DIFF:`top_k_diff`},Io={LINEAGE_VIEW_CONTEXT_MENU:`lineage_view_context_menu`},Lo={SELECT_PARENT_NODES:`select_parent_nodes`,SELECT_CHILD_NODES:`select_child_nodes`,SELECT_ALL_UPSTREAM:`select_all_upstream`,SELECT_ALL_DOWNSTREAM:`select_all_downstream`},Ro=({menuItems:e,open:t,onClose:n,x:r,y:i,featureToggles:a,DisabledItemWrapper:o})=>{let s=o??(({children:e})=>K(G,{children:e})),c=a?.mode===`metadata only`;return K(fi,{open:t,onClose:n,anchorReference:`anchorPosition`,anchorPosition:{top:i,left:r},slotProps:{paper:{sx:{fontSize:`0.85rem`,width:`250px`}}},children:e.length===0?K(pi,{disabled:!0,children:`No action available`},`no action`):e.map(({isSeparator:e,label:t,isDisabled:r,action:i,itemIcon:a})=>{if(e)return K(hr,{},t);let l=q(pi,{disabled:r,onClick:()=>{i&&i(),n()},children:[a,` `,t]},t);return r&&o?K(s,{display:c,children:l},t):l})})},zo=({isOpen:e,onClose:t,x:n,y:r,node:i,deps:a={},viewOptions:o={},featureToggles:s={},serverFlags:c={},noCatalogCurrent:l=!1,isActionAvailable:u=()=>!0})=>{let d=[],{runAction:f,onNavigate:p,onTrack:m,findByRunType:h,setSqlQuery:g,setPrimaryKeys:_,getPrimaryKey:v,DisabledItemWrapper:y}=a,{selectMode:b,cll:x,showColumnLevelLineage:S,setChangeAnalysisMode:C,selectParentNodes:w,selectChildNodes:T,getNodeColumnSet:E}=o,D=c.single_env_onboarding??!1,O=s.disableDatabaseQuery??!1;if(!i?.data)return K(G,{});let k=i.data,A=k.resourceType,j=E?Array.from(E(i.id)):[],ee={source:`lineage_model_node`},M=k.changeStatus,N=v?.(k.name);if(M===`modified`&&d.push({label:`Show Impact Radius`,itemIcon:K(xr,{}),isDisabled:l||!u(`change_analysis`),action:()=>{Ra({nodeId:i.id,setChangeAnalysisMode:C,showColumnLevelLineage:S})}}),!b&&A&&[`model`,`seed`,`snapshot`].includes(A)){d.length>0&&d.push({label:`select group one`,isSeparator:!0});let e=h?.(D?`query`:`query_diff`),t=k.change?.columns?Object.keys(k.change.columns):[],n=rn(t,t),r=`select * from {{ ref("${k.name}") }}`;if(n.length&&(r=`select \n ${n.join(`
3
3
  `)}\nfrom {{ ref("${k.name}") }}`),e&&d.push({label:`Query`,itemIcon:K(J,{component:e.icon,sx:{display:`inline-flex`}}),isDisabled:O,action:()=>{g?.(r),u(`query_diff_with_primary_key`)&&_?.(N===void 0?void 0:[N]),p?.(`/query`)}}),j.length>0&&e)if(x!==void 0){let t=new Set;N&&t.add(N),j.forEach(e=>{t.add(e)}),d.push({label:`Query Related Columns`,itemIcon:K(J,{component:e.icon,sx:{display:`inline-flex`}}),isDisabled:O,action:()=>{let e=`select \n ${Array.from(t).join(`,
4
4
  `)}\nfrom {{ ref("${k.name}") }}`;g?.(e),u(`query_diff_with_primary_key`)&&_?.(N===void 0?void 0:[N]),p?.(`/query`)}})}else{let t=Object.entries(k.change?.columns??{}).filter(([,e])=>e===`modified`).map(([e])=>e);if(t.length>0){let n=new Set;N&&n.add(N),t.forEach(e=>{n.add(e)}),d.push({label:`Query Modified Columns`,itemIcon:K(J,{component:e.icon,sx:{display:`inline-flex`}}),isDisabled:O,action:()=>{let e=`select \n ${Array.from(n).join(`,
5
5
  `)}\nfrom {{ ref("${k.name}") }}`;g?.(e),u(`query_diff_with_primary_key`)&&_?.(N===void 0?void 0:[N]),p?.(`/query`)}})}}let a=D?`row_count`:`row_count_diff`,o=h?.(a);o&&d.push({label:o.title,itemIcon:K(J,{component:o.icon,sx:{display:`inline-flex`}}),isDisabled:O,action:()=>{m?.(`explore_action`,{action:D?Fo.ROW_COUNT:Fo.ROW_COUNT_DIFF,source:Io.LINEAGE_VIEW_CONTEXT_MENU,node_count:1}),f?.(a,{node_names:[k.name]},{showForm:!1,trackProps:ee})}});let s=D?`profile`:`profile_diff`,c=h?.(s);if(c&&d.push({label:c.title,itemIcon:K(J,{component:c.icon,sx:{display:`inline-flex`}}),isDisabled:O,action:()=>{let e=E?Array.from(E(i.id)):[];m?.(`explore_action`,{action:D?Fo.PROFILE:Fo.PROFILE_DIFF,source:Io.LINEAGE_VIEW_CONTEXT_MENU,node_count:1}),f?.(s,{model:k.name,columns:e},{showForm:!0,trackProps:ee})}}),!D){let e=h?.(`value_diff`);e&&d.push({label:e.title,itemIcon:K(J,{component:e.icon,sx:{display:`inline-flex`}}),isDisabled:O,action:()=>{let e=E?Array.from(E(i.id)):[];m?.(`explore_action`,{action:Fo.VALUE_DIFF,source:Io.LINEAGE_VIEW_CONTEXT_MENU,node_count:1}),f?.(`value_diff`,{model:k.name,columns:e},{showForm:!0,trackProps:ee})}})}}return D||(d.length>0&&d.push({label:`select group two`,isSeparator:!0}),d.push({label:`Select Parent Nodes`,itemIcon:K(ia,{}),action:()=>{m?.(`lineage_selection`,{action:Lo.SELECT_PARENT_NODES}),w?.(i.id,1)}}),d.push({label:`Select Child Nodes`,itemIcon:K(aa,{}),action:()=>{m?.(`lineage_selection`,{action:Lo.SELECT_CHILD_NODES}),T?.(i.id,1)}}),d.push({label:`Select All Upstream Nodes`,itemIcon:K(ia,{}),action:()=>{m?.(`lineage_selection`,{action:Lo.SELECT_ALL_UPSTREAM}),w?.(i.id)}}),d.push({label:`Select All Downstream Nodes`,itemIcon:K(aa,{}),action:()=>{m?.(`lineage_selection`,{action:Lo.SELECT_ALL_DOWNSTREAM}),T?.(i.id)}})),K(Ro,{x:n,y:r,menuItems:d,open:e,onClose:t,featureToggles:s,DisabledItemWrapper:y})},Bo=({isOpen:e,onClose:t,x:n,y:r,node:i,deps:a={},featureToggles:o={},serverFlags:s={},isActionAvailable:c=()=>!0})=>{let l=[],{runAction:u,onTrack:d,findByRunType:f,supportsHistogramDiff:p,DisabledItemWrapper:m}=a,h=s.single_env_onboarding??!1,g=o.disableDatabaseQuery??!1;if(i?.data===void 0)return K(G,{});let _=i.data,v=_.node,y=_.column,b=_.type,x={source:`lineage_column_node`},S=()=>{d?.(`explore_action`,{action:Fo.PROFILE_DIFF,source:Io.LINEAGE_VIEW_CONTEXT_MENU,node_count:1}),u?.(`profile_diff`,{model:v.name,columns:[y]},{showForm:!1,trackProps:x})},C=()=>{d?.(`explore_action`,{action:Fo.HISTOGRAM_DIFF,source:Io.LINEAGE_VIEW_CONTEXT_MENU,node_count:1}),u?.(`histogram_diff`,{model:v.name,column_name:y,column_type:b},{showForm:!1,trackProps:x})},w=()=>{d?.(`explore_action`,{action:Fo.TOP_K_DIFF,source:Io.LINEAGE_VIEW_CONTEXT_MENU,node_count:1}),u?.(`top_k_diff`,{model:v.name,column_name:y,k:50},{showForm:!1,trackProps:x})},T=()=>{d?.(`explore_action`,{action:Fo.VALUE_DIFF,source:Io.LINEAGE_VIEW_CONTEXT_MENU,node_count:1}),u?.(`value_diff`,{model:v.name,columns:[y]},{showForm:!0,trackProps:x})},E=_.changeStatus===`added`||_.changeStatus===`removed`,D=f?.(h?`profile`:`profile_diff`);if(D&&l.push({label:D.title,itemIcon:K(J,{component:D.icon,sx:{display:`inline-flex`}}),action:S,isDisabled:E||!c(`profile_diff`)||g}),!h){let e=f?.(`histogram_diff`);if(e){let t=p?.(b)??!0;l.push({label:e.title,itemIcon:K(J,{component:e.icon,sx:{display:`inline-flex`}}),action:C,isDisabled:E||!t||g})}let t=f?.(`top_k_diff`);t&&l.push({label:t.title,itemIcon:K(J,{component:t.icon,sx:{display:`inline-flex`}}),action:w,isDisabled:E||g});let n=f?.(`value_diff`);n&&l.push({label:n.title,itemIcon:K(J,{component:n.icon,sx:{display:`inline-flex`}}),action:T,isDisabled:E||g})}return K(Ro,{x:n,y:r,menuItems:l,open:e,onClose:t,featureToggles:o,DisabledItemWrapper:m})},Vo=({isOpen:e,onClose:t,x:n,y:r,node:i,deps:a={},viewOptions:o={},featureToggles:s={},serverFlags:c={},noCatalogCurrent:l=!1,isActionAvailable:u=()=>!0})=>s.disableViewActionDropdown?K(Ro,{menuItems:[],open:e,onClose:t,x:n,y:r,featureToggles:s,DisabledItemWrapper:a.DisabledItemWrapper}):i&&xe(i)?K(zo,{x:n,y:r,isOpen:e,onClose:t,node:i,deps:a,viewOptions:o,featureToggles:s,serverFlags:c,noCatalogCurrent:l,isActionAvailable:u}):i&&Ce(i)?K(Bo,{x:n,y:r,isOpen:e,onClose:t,node:i,deps:a,featureToggles:s,serverFlags:c,isActionAvailable:u}):null,Ho=()=>{let[e,t]=W(!1),n=()=>t(!0),r=()=>t(!1),[i,a]=W({x:0,y:0}),[o,s]=W();return{props:{x:i.x,y:i.y,node:o,isOpen:e,onClose:r},showContextMenu:(e,t,r)=>{a({x:e,y:t}),s(r),n()},closeContextMenu:()=>{a({x:0,y:0}),s(void 0),r()}}};function Uo({anchorEl:e}){let[t,n]=W(!1),r=U(!1);V(()=>{if(!r.current){r.current=!0;try{localStorage.getItem(g.snapshotBaseIntroSeen)||n(!0)}catch{}}},[]);let i=B(()=>{try{localStorage.setItem(g.snapshotBaseIntroSeen,`1`)}catch{}n(!1)},[]);return q(ji,{open:t&&e!==null,anchorEl:e,onClose:i,anchorOrigin:{vertical:`bottom`,horizontal:`left`},transformOrigin:{vertical:`top`,horizontal:`left`},disableAutoFocus:!0,slotProps:{paper:{sx:{bgcolor:`grey.800`,color:`white`,p:2,maxWidth:360}}},children:[K(Z,{variant:`body2`,sx:{mb:1.5},children:`New: Recce now snapshots your base data when each PR is created. We'll let you know when production has changed since then so your comparisons stay accurate.`}),K(Y,{size:`small`,variant:`contained`,onClick:i,sx:{bgcolor:`grey.600`,"&:hover":{bgcolor:`grey.500`}},children:`Got it`})]})}const Wo=()=>{let{isDark:e}=Ht(),{successToast:t,failToast:n}=fn();return xt({imageType:`png`,shadowEffect:!0,backgroundColor:e?ke.neutral[900]:ke.neutral[50],ignoreElements:e=>{try{return e.classList.contains(Wt)}catch{return e.className?e.className.includes(Wt):!1}},onSuccess:()=>{t(`Copied the Lineage View as an image to clipboard`)},onError:e=>{console.error(`Error taking screenshot`,e),n(`Failed to copy image to clipboard`,e)}})},Go=()=>{let e=Ni(),{basePath:t}=ce();return B(n=>{n.check_id&&e.push(`${t}/checks/?id=${n.check_id}`)},[e.push,t])},Ko=new Set;function qo(){let[e,t]=W(()=>new Set),[n,r]=W(()=>new Set),[i,a]=W(()=>Ko),[o,s]=W(()=>Ko);return{impactedNodeIds:e,impactedColumnIds:n,wholeModelImpactedNodeIds:i,wholeModelChangedNodeIds:o,publish:B(e=>{t(e.nodeIds),r(e.columnIds),a(e.wholeModelImpactedNodeIds),s(e.wholeModelChangedNodeIds)},[])}}const Jo=(e,t)=>{let n=U({width:0,height:0});V(()=>{let r=e.current,i=new ResizeObserver(e=>{for(let r of e){let e=r.contentRect.width,i=r.contentRect.height;(Math.abs(i-n.current.height)>10||Math.abs(e-n.current.width)>10)&&n.current.height>0&&i>0&&n.current.width>0&&e>0&&t(),n.current={width:e,height:i}}});return r&&i.observe(r),()=>{r&&i.unobserve(r)}},[t,e])},Yo=()=>B((e,t,n,r,i)=>{let a=e.filter(xe),o=Object.groupBy(a,e=>e.data.changeStatus??`unchanged`),s=Object.fromEntries(Object.entries(o).map(([e,t])=>[`nodes_${e}`,t?.length??0])),c={node_count:a.length,view_mode:t,impact_radius_enabled:n,right_sidebar_open:i,...s};r&&(c.cll_column_active=!0),Mn(c)},[]),Xo={lineageNode:Ut,lineageGraphColumnNode:Zt},Zo={lineageEdge:qt};function Qo({nodes:e,edges:t,onNodeSelect:n,onNodeDoubleClick:r,onNodeContextMenu:i,showMiniMap:a=!0,showControls:o=!0,showBackground:s=!0,height:c=600,interactive:l=!0,minZoom:u,maxZoom:d,fitViewOptions:f}){let[p,m,h]=ii(e),[g,_,v]=ri(t),y=B((e,t)=>{n?.(t.id)},[n]),b=B(()=>{n?.(null)},[n]),x=B((e,t)=>{r?.(t.id)},[r]),S=U(i);V(()=>{S.current=i},[i]);let C=i!=null,w=H(()=>{if(!C)return Xo;let e=e=>K(Ut,{...e,onContextMenu:(e,t)=>S.current?.(e,t)});return e.displayName=`LineageNodeWithContextMenu`,{...Xo,lineageNode:e}},[C]);return K(J,{sx:{width:`100%`,height:c},children:q($r,{nodes:p,edges:g,onNodesChange:l?h:void 0,onEdgesChange:l?v:void 0,onNodeClick:y,onNodeDoubleClick:x,onPaneClick:b,nodeTypes:w,edgeTypes:Zo,fitView:!0,fitViewOptions:f,minZoom:u,maxZoom:d,nodesDraggable:l,nodesConnectable:!1,elementsSelectable:l,children:[s&&K(Gr,{}),o&&K(Yr,{}),a&&K(Xr,{nodeColor:e=>{let t=e.data;return $e({changeStatus:t.changeStatus,isImpacted:t.isImpacted,newCllExperience:t.newCllExperience}).color}})]})})}const $o={row_count:yn.ROW_COUNT,row_count_diff:yn.ROW_COUNT_DIFF,value_diff:yn.VALUE_DIFF},es=e=>{let t=$o[e.action];t&&On({action:t,source:bn.LINEAGE_VIEW_TOP_BAR,node_count:e.node_count})},ts=(e,t)=>Pe(e,{...t,onTrackAction:es,trackingSource:bn.LINEAGE_VIEW_TOP_BAR});function ns({notification:e,type:t}){let n=O.lineageNotificationDismissed,[r,i]=W(()=>sessionStorage.getItem(n)!==`true`);if(e===null||!r)return null;let a={info:`iochmara.light`,success:`success.light`,warning:`warning.light`,error:`error.light`}[t];return q(J,{sx:{width:`100%`,display:`flex`,flexDirection:`row`,p:`5px 10px`,gap:`5px`,alignItems:`flex-start`,borderRadius:1,boxShadow:4,border:`1px solid`,borderColor:`neutral.light`,bgcolor:a},children:[e,K(J,{sx:{flex:1}}),K(Q,{size:`small`,onClick:()=>{sessionStorage.setItem(n,`true`),i(!1)},children:K(fr,{})})]})}function rs(e,t){let n={...e.nodes};for(let[e,r]of Object.entries(t.current.nodes)){if(!r.change_status)continue;let t=n[e];if(!t)continue;let i;if(r.columns){let e={},t=!1;for(let n of Object.values(r.columns))n.change_status&&(e[n.name]=n.change_status,t=!0);t&&(i=e)}n[e]={...t,change_status:r.change_status,change:r.change_category?{category:r.change_category,columns:i}:t.change}}return{...e,nodes:n}}function is(e,t){return!!e.change_analysis&&!!t}function as(e,t){let n=e.getQueryData(F.lineage()),r=e.setQueryData(F.lineage(),e=>e&&{...e,lineage:rs(e.lineage,t)});return n!==void 0&&r!==n}const os=Object.keys({node_id:!0,column:!0,change_analysis:!0,no_cll:!0,no_upstream:!0,no_downstream:!0});function ss(e,t){return os.every(n=>e[n]===t[n])}function cs(e){let t={};for(let n of os)t[n]=e[n];return t}function ls(){let e,t=0;function n(e,n){return{cll:n,isCurrent:()=>t===e}}function r(){return i(),n(t,void 0)}function i(){++t,e=void 0}async function a({cllInput:r,changeAnalysis:i,actionGetCll:a,queryClient:o}){let s=Ba(r,i),c=++t;e=void 0;let l;try{l=await a.mutateAsync(s)}catch(e){if(t!==c)return n(c,void 0);throw e}let u=n(c,l);if(!u.isCurrent())return u;if(is(s,l)){let t={apiInput:cs(s),resolution:u};e=t,!as(o,l)&&e===t&&(e=void 0)}return u}return{invalidate:i,async resolveCllForLayout(t){let{cllInput:n,changeAnalysis:i}=t;if(!n)return r();if(e&&ss(e.apiInput,cs(Ba(n,i)))){let{resolution:t}=e;return e=void 0,t}return await a({...t,cllInput:n})},async refreshCll(e){let{cllInput:t}=e;return t?await a({...e,cllInput:t}):r()}}}function us(e){let{columns:t,parent_map:n}=e.current,r=new Map;function i(e){let a=r.get(e);if(a===`pending`)return!1;if(a!==void 0)return a;if(r.set(e,`pending`),t[e]?.change_status)return r.set(e,!0),!0;let o=n[e]??[];for(let t of o)if(i(t))return r.set(e,!0),!0;return r.set(e,!1),!1}let a=new Set;for(let e of Object.keys(t))i(e)&&a.add(e);return a}function ds(e,t,n,r){if(n)return!0;if(!t)return!1;if(t.current.nodes[e]?.impacted)return!0;let i=r,a=`${e}_`;for(let e of i)if(e.startsWith(a))return!0;return!1}function fs(e,t){let n=[];for(let[e,r]of Object.entries(t.current.nodes))r.change_category===`breaking`&&n.push(e);if(n.length===0)return{wholeModelImpactedNodeIds:new Set,wholeModelChangedNodeIds:new Set};let r=new Set(n),i=new Set(n),a=new Set(n),o=[...n];for(;o.length>0;){let t=[];for(let n of o){let i=e.nodes[n];if(i)for(let e of Object.keys(i.data.children))a.has(e)||(a.add(e),r.add(e),t.push(e))}o=t}return{wholeModelImpactedNodeIds:r,wholeModelChangedNodeIds:i}}const ps=e=>{let{runAction:t}=ye(),{setSqlQuery:n,setPrimaryKeys:r}=_t(),i=Ni(),{primaryKey:a}=Et(e),{basePath:o}=ce();return{runAction:(e,n,r)=>{t(e,n,r)},onNavigate:e=>{i.push(`${o}${e}`)},onTrack:(e,t)=>{e===`explore_action`?On({action:t.action,source:Io.LINEAGE_VIEW_CONTEXT_MENU,node_count:t.node_count}):e===`lineage_selection`&&jn({action:t.action})},supportsHistogramDiff:Gt,findByRunType:e=>{let t=$t(e);return t?{title:t.title,icon:t.icon}:void 0},setSqlQuery:n,setPrimaryKeys:r,getPrimaryKey:()=>a,DisabledItemWrapper:zl}},ms=({isOpen:e,onClose:t,x:n,y:r,node:i})=>{let{selectParentNodes:a,selectChildNodes:o,getNodeColumnSet:s,selectMode:c,cll:l,showColumnLevelLineage:u,setChangeAnalysisMode:d}=de(),{featureToggles:f}=se(),{isActionAvailable:p,lineageGraph:m}=L(),{data:h}=ge(),g=!m?.catalogMetadata.current,_=i?.type===`lineageGraphNode`?i.data?.name:i?.type===`lineageGraphColumnNode`?i.data?.node?.name:void 0;return K(Vo,{x:n,y:r,node:i,isOpen:e,onClose:t,deps:ps(_),viewOptions:{selectMode:c,cll:l,showColumnLevelLineage:u,setChangeAnalysisMode:d,selectParentNodes:a,selectChildNodes:o,getNodeColumnSet:s},featureToggles:{disableDatabaseQuery:f.disableDatabaseQuery,disableViewActionDropdown:f.disableViewActionDropdown,mode:f.mode??void 0},serverFlags:{single_env_onboarding:h?.single_env_onboarding},noCatalogCurrent:g,isActionAvailable:p})},hs=Ho;function gs(e,t){let n=[],r=[],{selectedNodes:i,cll:a,existingPositions:o,newCllExperience:s,columnAncestry:c}=t??{},l={};function u(e){return e===`removed`?0:e===`added`?2:1}function d(e,t){let n=u(e.data?.changeStatus),r=u(t.data?.changeStatus);return n<r?-1:+(n>r)}let f=i===void 0?void 0:new Set(i),p=Object.values(e.nodes).sort(d);for(let e of p){if(f&&!f.has(e.id))continue;let t=new Set,i=0;if(a&&!s){let o=a.current,s=o?.parent_map[e.id]??new Set;for(let t of s){let n=t,i=e.id;r.push({id:`m2c_${n}_${i}`,source:n,target:i,style:{zIndex:9999}})}let c=Object.entries(o?.columns??{}).filter(([t])=>t.startsWith(`${e.id}_`)).map(([t])=>t.slice(e.id.length+1));for(let o of c){let s=`${e.id}_${o}`,c=a.current,l=c?.columns[s],u=c?.parent_map[s]??new Set;if(l!=null){n.push({id:s,position:{x:10,y:70+i*24},parentId:e.id,extent:`parent`,draggable:!1,className:`no-track-pii-safe`,data:{node:e.data,column:l.name,type:l.type,transformationType:l.transformation_type,changeStatus:Te(l.change_status)},style:{zIndex:9999},type:`lineageGraphColumnNode`,targetPosition:Qr.Left,sourcePosition:Qr.Right});for(let e of u){let t=e,n=s;r.push({id:`${t}_${n}`,source:t,target:n,style:{zIndex:9999}})}i++,t.add(l.name)}}}l[e.id]=t;let c=60;i>0&&(c+=20+i*24);let u=o?.get(e.id);n.unshift({id:e.id,position:u??{x:0,y:0},width:300,height:c,className:`no-track-pii-safe`,data:{...e.data},type:`lineageGraphNode`,targetPosition:Qr.Left,sourcePosition:Qr.Right,style:{width:300,height:c}})}let m=Object.values(e.edges).sort(d);for(let e of m)f&&(!f.has(e.source)||!f.has(e.target))||r.push({id:e.id,type:`lineageGraphEdge`,source:e.source,target:e.target,data:{...e.data}});return s&&c&&a&&_s(n,r,c,a,f),n.some(e=>e.type===`lineageGraphNode`&&!o?.has(e.id))&&vs(n,r),[n,r,l]}function _s(e,t,n,r,i){let a=new Set,o=new Map;for(let[t,s]of n)if(!(i&&!i.has(t))){for(let n=0;n<s.length;n++){let i=s[n],c=`${t}_${i.column}`;a.add(c),o.set(c,{modelId:t,isImpacted:i.isImpacted});let l=r.current.columns[c];e.push({id:c,position:{x:10,y:64+n*24},parentId:t,draggable:!1,className:`no-track-pii-safe`,data:{node:{id:t},column:i.column,type:l?.type,transformationType:i.transformationType,changeStatus:i.changeStatus,isHighlighted:!0,isFocused:!1,isImpacted:i.isImpacted},style:{zIndex:9999},type:`lineageGraphColumnNode`,targetPosition:Qr.Left,sourcePosition:Qr.Right})}if(s.length>0){let n=e.find(e=>e.id===t&&e.type===`lineageGraphNode`);n&&(n.height=80+s.length*24)}}for(let e of a){let n=r.current.parent_map[e]??[];for(let r of n)if(a.has(r)){let n=o.get(r)?.isImpacted??!1;t.push({id:`ancestry_${r}_${e}`,source:r,target:e,style:{zIndex:9999,strokeWidth:2,stroke:n?Le.impacted:Le.unchanged}})}}}const vs=(e,t,n=`LR`)=>{fe(oa,e,t,n)},ys={};function bs(e){return e?.type===`profile_distribution`?e.result:void 0}function xs(e){let t=0;for(let n of Object.values(e))n.kind===null&&(t+=1);return t}const Ss=e=>typeof performance<`u`?Math.round(performance.now()-e):0,Cs=e=>ie(e)&&e.status>=400&&e.status<500;function ws(e){let{model:t,columns:n,enabled:r=!0}=e,i=e.nodeId??t,{apiClient:a}=R(),{data:o}=ge(),s=(o?.inline_profile??!1)&&r&&!!t,{data:c,error:l,isFetching:u}=Gn({queryKey:[`profile_distribution`,i,n?JSON.stringify(n):`*`],queryFn:async()=>{let e=typeof performance<`u`?performance.now():0;try{let r=await h({model:t,columns:n},{trackProps:{source:bn.SCHEMA_VIEW}},a);return Ts(r,Ss(e)),r}catch(t){throw In({status:`error`,total_wall_ms:Ss(e),column_count:0,error_count:0}),Cs(t)||ra(t,{tags:{feature:`inline_profile_distribution`}}),t}},enabled:s,staleTime:1/0,gcTime:300*1e3,retry:!1,refetchOnWindowFocus:!1,placeholderData:(e,t)=>t&&t.queryKey[1]===i?e:void 0}),d=c?.error?Error(c.error):void 0;return H(()=>{if(!s)return{status:`disabled`,isLoading:!1,columns:ys,baseTotal:0,currentTotal:0};let e=l??d??void 0;if(e)return{status:`error`,isLoading:!1,columns:ys,error:e,baseTotal:0,currentTotal:0};let t=bs(c);return t?t.status===`unsupported`?{status:`unsupported`,isLoading:!1,columns:ys,unsupportedReason:t.reason,baseTotal:0,currentTotal:0}:{status:`ok`,isLoading:u,columns:t.columns,baseTotal:t.base_total,currentTotal:t.current_total}:{status:`loading`,isLoading:!0,columns:ys,baseTotal:0,currentTotal:0}},[s,l,d,c,u])}function Ts(e,t){if(e.error){In({status:`error`,total_wall_ms:t,column_count:0,error_count:0});return}let n=bs(e);if(!n||n.status===`unsupported`){In({status:`unsupported`,total_wall_ms:t,column_count:0,error_count:0});return}In({status:`ok`,strategy:n.strategy,total_wall_ms:t,column_count:Object.keys(n.columns).length,error_count:xs(n.columns),cache_hit:n.cache_hit})}function Es({newCllExperience:e,columnChanges:t,impactedColumns:n,nodeId:r,nodeColumnNames:i,wholeModelChange:a,profileAllColumns:o}){if(!e)return{changedColumns:void 0,scopedColumns:void 0,profileEnabled:!1,profilingAll:!1};let s=new Set(Object.keys(t??{}));if(n&&r&&i)for(let e of i)tn(r,e,n)&&s.add(e);let c=[...s],l=c.length>0,u=o||a||!l?void 0:c,d=l||a||o;return{changedColumns:c,scopedColumns:u,profileEnabled:d,profilingAll:u===void 0&&d}}function Ds(){return q(J,{sx:{display:`flex`,gap:2,px:1,py:.5,fontSize:`0.75rem`,color:`text.secondary`},children:[q(`span`,{children:[K(`span`,{className:`schema-change-badge schema-change-badge-added`,children:`+`}),` `,`added`]}),q(`span`,{children:[K(`span`,{className:`schema-change-badge schema-change-badge-removed`,children:`-`}),` `,`removed`]}),q(`span`,{children:[K(`span`,{className:`schema-change-badge schema-change-badge-changed`,children:`~`}),` `,`changed`]})]})}function Os({current:e,showMenu:t=!0},n){let r=_e(),[i,a]=W(null),[o,s]=W(new Map),{columns:c,rows:l}=H(()=>Ae({type:`schema_single`,columns:e?.columns},{node:e,cllRunningMap:o,showMenu:t}),[e,o,t]),{lineageGraph:u,isActionAvailable:d}=L(),f=d(`change_analysis`),p=!u?.catalogMetadata.current,m;p&&(m="catalog.json not found. Run `recce debug` to troubleshoot.");let h=e&&e.columns===void 0,g;h&&(g=`Node schema not found in catalog.json. Please regenerate your catalog.json to update.`);let _=async t=>{if(!f)return;Sn({action:`view`,source:`schema_column`}),s(e=>new Map(e).set(t,!0));let n=e?.id;n&&await r?.showColumnLevelLineage({node_id:n,column:t}),s(e=>new Map(e).set(t,!1))},v=B(t=>`${e?.id}-${t.data.name}`,[e?.id]),y=r?.viewOptions.column_level_lineage,b=y?`${y.node_id}-${y.column}`:null;V(()=>{if(i&&(i.deselectAll(),b)){let e=i.getRowNode(b);e&&e.setSelected(!0)}},[i,b]);let x=B(e=>{a(e.api)},[]);return q(J,{sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:[m?K(ui,{severity:`warning`,sx:{fontSize:`12px`,p:1},children:m}):g?K(ui,{severity:`warning`,sx:{fontSize:`12px`,p:1},children:g}):K(G,{}),l.length>0&&K(Qt,{style:{blockSize:`auto`,maxHeight:`100%`,overflow:`auto`,fontSize:`10pt`,borderWidth:1},columns:c,rows:l,renderers:{noRowsFallback:K(Jt,{})},ref:n,getRowId:v,getRowClass:e=>r!==void 0&&f?`row-normal row-selectable`:`row-normal`,onCellClicked:async e=>{if((e.event?.target)?.closest(`.row-context-menu`))return;let t=e.data;t&&await _(t.name)},onGridReady:x,rowSelection:{mode:`singleRow`,checkboxes:!1},containerClassName:`no-track-pii-safe`,rowClassName:`no-track-pii-safe`})]})}function ks({base:e,current:t,showMenu:n=!0,columnChanges:r,onViewCode:i,headerAction:a},o){let s=_e(),{data:c}=ge(),l=c?.new_cll_experience??!1,u=c?.inline_profile??!1,[d,f]=W(null),[p,m]=W(new Map),[h,g]=W(null),_=H(()=>{if(!l)return;let e=s?.impactedColumnIds;return e?.size?e:void 0},[l,s?.impactedColumnIds]),v=H(()=>{let n=t?.resource_type??e?.resource_type;return n&&[`model`,`seed`,`snapshot`,`source`].includes(n)?t??e:void 0},[t,e]),y=t?.id??e?.id,b=H(()=>{let n=new Set;for(let t of Object.keys(e?.columns??{}))n.add(t);for(let e of Object.keys(t?.columns??{}))n.add(e);return n},[e,t]),x=h!=null&&h===y,S=s?.wholeModelChangedNodeIds?.has(y??``)??!1,{scopedColumns:C,profileEnabled:w,profilingAll:T}=H(()=>Es({newCllExperience:l,columnChanges:r,impactedColumns:_,nodeId:y,nodeColumnNames:b,wholeModelChange:S,profileAllColumns:x}),[l,r,_,y,b,S,x]),E=ws({model:v?.name,nodeId:y,columns:C,enabled:w}),D=H(()=>{if(E.status!==`disabled`&&E.status!==`unsupported`)return{payloads:E.columns,baseTotal:E.baseTotal,currentTotal:E.currentTotal,isLoading:E.isLoading,hasError:E.status===`error`,scopedColumns:C}},[E.status,E.columns,E.baseTotal,E.currentTotal,E.isLoading,C]),{columns:O,rows:k}=H(()=>Ae({type:`schema_diff`,base:e?.columns,current:t?.columns},{node:v,cllRunningMap:p,showMenu:n,columnChanges:r,onViewCode:i,impactedColumns:_,nodeId:y,distribution:D}),[e,t,v,y,p,n,r,i,_,D]),{lineageGraph:A,isActionAvailable:j}=L(),ee=j(`change_analysis`),M=!A?.catalogMetadata.base,N=!A?.catalogMetadata.current,P;M&&N?P="catalog.json not found on both environments. Run `recce debug` to troubleshoot.":M?P="catalog.json not found on base environment. Run `recce debug` to troubleshoot.":N&&(P="catalog.json not found on current environment. Run `recce debug` to troubleshoot.");let te=e&&e.columns===void 0,ne=t&&t.columns===void 0,F;te&&ne?F=`Node schema not found in catalog.json on both environments. Please regenerate your catalog.json to update.`:ne?F=`Node schema not found in catalog.json on current environment. Please regenerate your catalog.json to update.`:te&&(F=`Node schema not found in catalog.json on base environment. Please regenerate your catalog.json to update.`);let re=async n=>{if(!ee)return;Sn({action:`view`,source:`schema_column`}),m(e=>new Map(e).set(n,!0));let r=t?.id??e?.id;r&&await s?.showColumnLevelLineage({node_id:r,column:n}),m(e=>new Map(e).set(n,!1))},ie=B(n=>`${t?.id??e?.id}-${n.data.name}`,[t?.id,e?.id]),ae=s?.viewOptions.column_level_lineage,oe=ae?`${ae.node_id}-${ae.column}`:null;V(()=>{if(d&&(d.deselectAll(),oe)){let e=d.getRowNode(oe);e&&e.setSelected(!0)}},[d,oe]);let I=B(e=>{f(e.api)},[]);return q(J,{sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:[P?K(ui,{severity:`warning`,sx:{fontSize:`12px`,p:1},children:P}):F?K(ui,{severity:`warning`,sx:{fontSize:`12px`,p:1},children:F}):K(G,{}),q(X,{direction:`row`,sx:{alignItems:`center`,justifyContent:`space-between`,gap:1,pr:1},children:[K(Ds,{}),q(X,{direction:`row`,sx:{alignItems:`center`,gap:1},children:[l&&u&&v&&E.status!==`unsupported`&&!T&&K(Y,{size:`small`,variant:`text`,onClick:()=>{g(y??null)},sx:{textTransform:`none`,fontSize:`0.7rem`,py:.25,px:1,minWidth:0,whiteSpace:`nowrap`},children:`Profile all columns`}),a]})]}),E.status===`unsupported`&&K(J,{sx:{px:1,pb:.5},children:K(vt,{reason:E.unsupportedReason})}),k.length>0&&K(Qt,{style:{blockSize:`auto`,maxHeight:`100%`,overflow:`auto`,fontSize:`0.8rem`,borderWidth:1},columns:O,rows:k,rowHeight:35,renderers:{noRowsFallback:K(Jt,{})},className:`rdg-light no-track-pii-safe${l?` cll-experience`:``}`,ref:o,getRowId:ie,getRowClass:e=>{let t=e.data;if(!t)return`row-normal`;let n=Ot(t,t.isImpacted);if(n===`removed`)return`row-removed`;let r;switch(n){case`added`:r=`row-added`;break;case`changed`:case`unknown`:r=`row-changed`;break;case`impacted`:r=`row-impacted`;break;default:r=`row-normal`}return s!==void 0&&ee&&(r+=` row-selectable`),r},onCellClicked:async e=>{if((e.event?.target)?.closest(`.row-context-menu`))return;let t=e.data;t&&(t.baseIndex===void 0||t.currentIndex!==void 0)&&await re(t.name)},onGridReady:I,rowSelection:{mode:`singleRow`,checkboxes:!1},containerClassName:`no-track-pii-safe`,rowClassName:`no-track-pii-safe`})]})}const As=Yn(ks),js=Yn(Os);function Ms(e){let t=e?.current.nodes;if(!t)return{impactingNodeIds:void 0,impactedNodeIds:void 0};let n=new Set,r=new Set;for(let[e,i]of Object.entries(t))i.impacted===!0?(r.add(e),n.add(e)):(i.change_category===`partial_breaking`||i.change_status===`removed`)&&n.add(e);return{impactingNodeIds:n,impactedNodeIds:r}}const Ns={light:`rgb(252 211 77 / 0.18)`,dark:`rgb(252 211 77 / 0.10)`};function Ps(e){return e?Ne.dark:Ne.light}function Fs(e){return e?.data.changeStatus??`unchanged`}function Is(e,t){return e===`unchanged`&&t?`impacted`:e}function Ls(e){return e===`impacted`?Le.impacted:ze[e]}function Rs(e,t){return t?.[e]?.data.name??e}function zs(e,t,n){let r=t.trim().toLowerCase();return r?e.filter(e=>Rs(e,n).toLowerCase().includes(r)):e}function Bs(e,t){return e?`Show all models`:t?`Show only impacting models`:`Show only impacted models`}function Vs({status:e,cllImpacted:t}){let n=Is(e,t);return K(J,{component:`span`,"data-testid":`lineage-status-dot`,"data-status":n,sx:{width:`8px`,height:`8px`,borderRadius:`2px`,backgroundColor:Ls(n),flex:`0 0 auto`}})}function Hs({name:e,status:t,direction:n,decorateAsImpacted:r,dotImpacted:i,onClick:a}){let{isDark:o}=Ht(),s=n===`up`?`Impacts this model`:`Impacted by this model`;return q(J,{onClick:a,sx:{position:`relative`,display:`flex`,alignItems:`center`,gap:.75,pl:1.5,pr:1.25,py:.5,cursor:a?`pointer`:`default`,fontSize:`12px`,fontFamily:`ui-monospace, 'IBM Plex Mono', monospace`,lineHeight:1.3,color:`text.primary`,minWidth:0,backgroundColor:r?o?Ns.dark:Ns.light:void 0,"&:hover":a?{backgroundColor:`action.hover`}:void 0},children:[r&&K(J,{"aria-hidden":`true`,sx:{position:`absolute`,left:0,top:0,bottom:0,width:`3px`,backgroundColor:Le.impacted}}),K(Vs,{status:t,cllImpacted:i}),K(J,{component:`span`,sx:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,minWidth:0,flex:1},title:e,children:e}),r&&K($,{title:s,placement:`top`,arrow:!0,children:K(J,{component:`span`,"aria-label":s,"data-testid":`lineage-impact-mark`,sx:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:`16px`,height:`16px`,color:Ps(o),flex:`0 0 auto`},children:K(Ii,{size:12})})})]})}function Us({isDark:e,active:t}){return t?nt.dark:e?Mt.dark:Mt.light}function Ws({isDark:e,active:t}){return t?`#fff`:e?Ne.dark:Ne.light}const Gs={display:`inline-flex`,alignItems:`center`,gap:`4px`,ml:.75,px:`7px`,py:`1px`,borderRadius:`999px`,fontSize:`10px`,fontWeight:600,letterSpacing:`0.02em`};function Ks({color:e}){return K(J,{component:`span`,"aria-hidden":`true`,sx:{width:`5px`,height:`5px`,borderRadius:`50%`,backgroundColor:e}})}function qs({label:e,title:t,active:n,isDark:r,onClick:i}){let a={isDark:r,active:n};return K($,{title:t,placement:`top`,arrow:!0,children:q(J,{component:`button`,type:`button`,"data-testid":`lineage-impact-chip`,"aria-pressed":n,"aria-label":t,onClick:i,sx:{...Gs,backgroundColor:Us(a),color:Ws(a),border:`none`,font:`inherit`,cursor:`pointer`,"&:hover":{filter:n?`brightness(0.95)`:`brightness(0.97)`}},children:[K(Ks,{color:Ws(a)}),e]})})}function Js({direction:e,directCount:t,impactCount:n,onlyImpact:r,onToggleOnlyImpact:i}){let a=e===`up`,o=a?Li:Ii,{isDark:s,background:c}=Ht(),l=n??0,u=l>0,d=a?`${l} impacting`:`${l} impacted`;return q(X,{direction:`row`,spacing:.75,sx:{alignItems:`center`,px:1.5,py:.875,backgroundColor:c.subtle,borderTop:`1px solid`,borderBottom:`1px solid`,borderColor:`divider`,fontSize:`11px`,color:`text.secondary`,fontWeight:600},children:[K(o,{size:11}),K(J,{component:`span`,sx:{textTransform:`uppercase`,letterSpacing:`0.06em`},children:a?`Upstream`:`Downstream`}),q(J,{component:`span`,sx:{color:`text.disabled`,fontWeight:500},children:[`· `,t,` direct`]}),u&&K(qs,{label:d,title:Bs(r,a),active:r,isDark:s,onClick:i})]})}function Ys({label:e}){return K(J,{sx:{px:1.5,py:1,fontSize:`11px`,color:`text.disabled`,fontStyle:`italic`},children:e})}function Xs({direction:e,query:t,onChange:n}){return K(J,{sx:{px:1.25,py:.75,borderBottom:`1px solid`,borderColor:`divider`,backgroundColor:`background.paper`},children:q(X,{direction:`row`,spacing:.5,sx:{alignItems:`center`,border:`1px solid`,borderColor:`divider`,borderRadius:`4px`,px:.875,py:.25},children:[K(Bi,{size:12,color:`currentColor`,opacity:.55}),K(di,{value:t,onChange:e=>{n(e.target.value)},placeholder:`filter…`,inputProps:{"aria-label":`Filter ${e===`up`?`Upstream`:`Downstream`}`,style:{padding:0,fontSize:`11px`,fontFamily:`ui-monospace, 'IBM Plex Mono', monospace`}},sx:{flex:1,fontSize:`11px`}})]})})}function Zs({hidden:e,onClick:t}){return q(J,{onClick:t,role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())},sx:{px:1.5,py:.75,fontSize:`11px`,color:`info.main`,cursor:`pointer`,userSelect:`none`,"&:hover":{backgroundColor:`action.hover`}},children:[`+ show `,Math.min(20,e),` more`,` `,q(J,{component:`span`,sx:{color:`text.disabled`,ml:.5},children:[`(`,e,` hidden)`]})]})}function Qs({node:e,onCenterFocus:t,cllImpacted:n}){let r=Is(Fs(e),n),{isDark:i,background:a}=Ht(),o=Ls(r),s=r===`impacted`?Ps(i):o,c=r===`impacted`?Ps(i):`divider`;return q(X,{direction:`row`,spacing:1,sx:{alignItems:`center`,px:1.5,py:1.25,backgroundColor:i?a.emphasized:`rgb(255 245 241)`,borderTop:`1px solid`,borderBottom:`1px solid`,borderColor:`divider`},children:[K(J,{component:`span`,sx:{width:`4px`,height:`26px`,borderRadius:`2px`,backgroundColor:o,flex:`0 0 auto`}}),K(J,{component:`span`,sx:{flex:1,minWidth:0,fontFamily:`ui-monospace, 'IBM Plex Mono', monospace`,fontSize:`13px`,fontWeight:700,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},title:e.data.name,children:e.data.name}),t&&K($,{title:`Center on canvas`,placement:`top`,children:K(Q,{size:`small`,"aria-label":`Center on canvas`,onClick:t,sx:{p:.5,color:`text.secondary`,flex:`0 0 auto`},children:K(Ri,{size:14})})}),K(J,{component:`span`,sx:{fontSize:`10px`,fontWeight:600,px:.875,py:`2px`,borderRadius:`3px`,color:s,backgroundColor:`background.paper`,border:`1px solid`,borderColor:c,textTransform:`capitalize`,flex:`0 0 auto`},children:r})]})}function $s({previousName:e,currentName:t,onJumpBack:n}){let{isDark:r}=Ht();return q(X,{direction:`row`,spacing:.75,sx:{alignItems:`center`,minWidth:0,flex:1,overflow:`hidden`,fontFamily:`ui-monospace, 'IBM Plex Mono', monospace`,fontSize:`12px`},children:[K(J,{component:`span`,sx:{color:`text.secondary`,fontFamily:`inherit`,flex:`0 0 auto`},children:`Path`}),K(J,{component:`span`,role:n?`button`:void 0,tabIndex:n?0:void 0,onClick:n,onKeyDown:n?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n())}:void 0,sx:{color:`text.primary`,cursor:n?`pointer`:`default`,textDecoration:`underline`,textDecorationColor:r?`rgb(255 255 255 / 0.35)`:`rgb(0 0 0 / 0.25)`,textUnderlineOffset:`2px`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,minWidth:0,"&:hover":n?{textDecorationColor:`currentColor`}:void 0},title:e,children:e}),K(J,{component:`span`,"aria-hidden":`true`,sx:{color:`text.disabled`,flex:`0 0 auto`},children:`›`}),K(J,{component:`span`,sx:{color:`primary.main`,fontWeight:700,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,minWidth:0},title:t,children:t})]})}function ec({node:e,nodesById:t,onNavigate:n,onBack:r,onCenterFocus:i,historyTrail:a,onJumpToHistory:o,impactingNodeIds:s,impactedNodeIds:c}){let{background:l}=Ht(),[u,d]=W(``),[f,p]=W(``),[m,h]=W(8),[g,_]=W(8),[v,y]=W(!1),[b,x]=W(!1);V(()=>{d(``),p(``),h(8),_(8),y(!1),x(!1)},[e.id]);let S=H(()=>Object.keys(e.data.parents??{}),[e.data.parents]),C=H(()=>Object.keys(e.data.children??{}),[e.data.children]),w=H(()=>zs(S,u,t),[S,u,t]),T=H(()=>zs(C,f,t),[C,f,t]),E=((s?.size??0)>0||(c?.size??0)>0)&&((s?.has(e.id)??!1)||(c?.has(e.id)??!1)),D=(e,t)=>E?(t===`up`?s:c)?.has(e)??!1:!1,O=E?S.filter(e=>s?.has(e)).length:0,k=E?C.filter(e=>c?.has(e)).length:0,A=e=>{let r=e===`up`,i=r?S:C,a=r?w:T,o=(r?v:b)?a.filter(t=>D(t,e)):a,s=r?u:f,l=r?d:p,y=r?m:g,x=r?h:_,E=i.length>8,O=o.slice(0,y),k=o.length-O.length,A=r?`(source — no upstream)`:`(leaf — no downstream)`;return q(G,{children:[E&&K(Xs,{direction:e,query:s,onChange:e=>{l(e),x(8)}}),i.length===0?K(Ys,{label:A}):o.length===0?K(Ys,{label:`no matches`}):O.map(r=>K(Hs,{name:Rs(r,t),status:Fs(t?.[r]),direction:e,decorateAsImpacted:D(r,e),dotImpacted:c?.has(r)??!1,onClick:n?()=>n(r):void 0},`${e}-${r}`)),k>0&&K(Zs,{hidden:k,onClick:()=>x(e=>Math.min(o.length,e+20))})]})},j=(a?.length??0)>0;return q(J,{sx:{height:`100%`,display:`flex`,flexDirection:`column`,backgroundColor:`background.paper`},"data-testid":`lineage-tab-content`,children:[(!!r||j)&&q(X,{direction:`row`,spacing:1,sx:{alignItems:`center`,px:1.25,py:.75,borderBottom:`1px solid`,borderColor:`divider`,backgroundColor:l.subtle,minWidth:0},children:[r&&K($,{title:`Back to previous node`,placement:`top`,children:K(Q,{size:`small`,"aria-label":`Back to previous node`,onClick:r,sx:{flex:`0 0 auto`,border:`1px solid`,borderColor:`divider`,borderRadius:`6px`,px:1,py:.375,color:`text.secondary`,backgroundColor:`background.paper`,"&:hover":{backgroundColor:`action.hover`}},children:K(Fi,{size:14})})}),j&&a?K($s,{previousName:Rs(a[a.length-1],t),currentName:e.data.name,onJumpBack:o?()=>o(a.length-1):r}):K(J,{sx:{flex:1}})]}),q(J,{sx:{flex:1,overflowY:`auto`,minHeight:0},children:[K(Js,{direction:`up`,directCount:S.length,impactCount:O,onlyImpact:v,onToggleOnlyImpact:()=>{y(e=>!e),h(8)}}),A(`up`),K(Qs,{node:e,onCenterFocus:i,cllImpacted:c?.has(e.id)??!1}),K(Js,{direction:`down`,directCount:C.length,impactCount:k,onlyImpact:b,onToggleOnlyImpact:()=>{x(e=>!e),_(8)}}),A(`down`)]})]})}const tc=({node:e,modelDetail:t,isSingleEnv:n,CodeEditor:r,DiffEditor:i,isDark:a=!1})=>{let[o,s]=W(!1),[c,l]=W(!1);if(e.data.resourceType!==`model`&&e.data.resourceType!==`snapshot`)return`Not available`;let u=t?.base?.raw_code,d=t?.current?.raw_code,f=t?.base?.name??t?.current?.name??e.data.name??``,p=u!=null||d!=null;return q(J,{className:`no-track-pii-safe`,sx:{position:`relative`,height:`100%`},onMouseEnter:()=>{l(!0)},onMouseLeave:()=>{l(!1)},children:[p?n?K(r,{language:`sql`,value:u??``,readOnly:!0,lineNumbers:!0,wordWrap:!1,theme:a?`dark`:`light`}):K(i,{original:u??``,modified:d??``,language:`sql`,readOnly:!0,lineNumbers:!0,sideBySide:!1,theme:a?`dark`:`light`,height:`100%`}):K(J,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100%`,color:`text.secondary`},children:`No code available`}),K(Q,{onClick:()=>s(!0),size:`medium`,"aria-label":`Expand`,sx:{position:`absolute`,top:`5px`,right:`20px`,opacity:c?.5:.1,transition:`opacity 0.3s ease-in-out`},children:K(vr,{})}),q(er,{open:o,onClose:()=>s(!1),maxWidth:`sm`,fullWidth:!0,slotProps:{paper:{sx:{height:`75%`,overflowY:`auto`}}},children:[q(rr,{sx:{display:`flex`,alignItems:`center`},children:[n?q(G,{children:[K(`code`,{children:f}),`\xA0Model Code`]}):q(G,{children:[K(`code`,{children:f}),`\xA0Model Code Diff`]}),K(J,{sx:{flex:1}}),K(Q,{size:`small`,onClick:()=>s(!1),children:K(fr,{})})]}),K(nr,{children:p?n?K(r,{language:`sql`,value:u??``,fontSize:16,readOnly:!0,lineNumbers:!0,wordWrap:!1,theme:a?`dark`:`light`}):K(i,{original:u??``,modified:d??``,language:`sql`,theme:a?`dark`:`light`,className:`text-base`}):K(J,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100%`,color:`text.secondary`},children:`No code available`})})]})]})},nc=({node:e})=>{let{data:t,isLoading:r}=ge(),i=nn(),{apiClient:a}=R(),o=e.data.resourceType,s=o===`model`||o===`snapshot`,{data:c,isLoading:l}=Gn({queryKey:[`modelDetail`,e.id],queryFn:()=>n(e.id,a),enabled:s&&!!a,staleTime:300*1e3,retry:1});return r?K(G,{}):s&&l?K(J,{"aria-label":`Loading model code`,sx:{p:2,height:`100%`},"data-testid":`node-sql-view-loading`,children:K(sa,{variant:`rectangular`,height:`100%`,animation:`wave`})}):K(tc,{node:e,modelDetail:c?.model,isSingleEnv:t?.single_env_onboarding??!1,CodeEditor:dt,DiffEditor:Tt,isDark:i})};function rc({rowCount:e}){return`base`in e?K(ac,{rowCount:e}):K(`span`,{children:ic(e.curr)})}function ic(e){return e===null?`N/A`:`${e.toLocaleString()} ${e===1?`row`:`rows`}`}function ac({rowCount:e}){let t=e.base,n=e.curr,r=ic(t),i=ic(n);return t===null&&n===null?K(G,{children:`Failed to load`}):t===null||n===null?q(X,{component:`span`,direction:`row`,spacing:.5,sx:{display:`inline-flex`,alignItems:`center`},children:[K(Z,{variant:`body2`,component:`span`,children:r}),K(Gi,{}),K(Z,{variant:`body2`,component:`span`,children:i})]}):t===n?q(X,{component:`span`,direction:`row`,spacing:.5,sx:{display:`inline-flex`,alignItems:`center`},children:[K(Z,{variant:`body2`,component:`span`,children:i}),K(J,{component:`span`,sx:{color:`grey.500`,display:`flex`},children:K($i,{})}),K(Z,{variant:`body2`,component:`span`,sx:{color:`grey.500`},children:`No Change`})]}):t<n?q(X,{component:`span`,direction:`row`,spacing:.5,sx:{display:`inline-flex`,alignItems:`center`},children:[K(Z,{variant:`body2`,component:`span`,children:i}),K(J,{component:`span`,sx:{color:`success.main`,display:`flex`},children:K(Zi,{})}),K(Z,{variant:`body2`,component:`span`,sx:{color:`success.main`},children:an(t,n)})]}):q(X,{component:`span`,direction:`row`,spacing:.5,sx:{display:`inline-flex`,alignItems:`center`},children:[K(Z,{variant:`body2`,component:`span`,children:i}),K(J,{component:`span`,sx:{color:`error.main`,display:`flex`},children:K(Xi,{})}),K(Z,{variant:`body2`,component:`span`,sx:{color:`error.main`},children:an(t,n)})]})}function oc({rowCount:e,node:t,onRefresh:n,isFetching:r}){let i=nn(),{featureToggles:a}=se(),{runsAggregated:o}=L(),s=o?.[t.id]?.row_count_diff.result,c=$t(`row_count_diff`).icon,l=e??s,u=l;return K($,{title:l?`${l.base??`N/A`} -> ${l.curr??`N/A`} rows`:``,children:K(zl,{display:a.mode===`metadata only`,children:q(J,{component:`span`,sx:{...je(i),gap:.5},children:[K(c,{}),u!=null||r?r?K(sa,{width:30,height:16}):u==null?K(Z,{variant:`caption`,children:`row count`}):K(ac,{rowCount:u}):K(Z,{variant:`caption`,children:`row count`}),n&&K(Q,{"aria-label":`Query Row Count`,size:`small`,onClick:n,disabled:a.disableDatabaseQuery,sx:{p:0,ml:.5},children:K(Rr,{size:12})})]})})})}function sc({rowCount:e,node:t,onRefresh:n,isFetching:r}){let i=nn(),{runsAggregated:a}=L(),o=a?.[t.id]?.row_count.result,s=$t(`row_count`).icon,c,l=e??o;return l&&(c=`${l.curr??`N/A`} rows`),q(J,{component:`span`,sx:je(i),children:[K(J,{component:`span`,sx:St,children:K(s,{})}),l||r?r?K(sa,{width:30,height:16}):K(Z,{variant:`caption`,children:c}):K(Z,{variant:`caption`,children:`row count`}),n&&K(Q,{"aria-label":`Query Row Count`,size:`small`,onClick:n,disabled:t.data.changeStatus===`removed`,sx:{p:0,ml:.5},children:K(Rr,{size:12})})]})}function cc({children:e,value:t,index:n}){return t===n?K(G,{children:e}):null}const lc=()=>K(`span`,{}),uc=({children:e})=>K(G,{children:e}),dc=()=>!0;function fc(e,t,n){return e?Vn.add_or_remove:n(t)?``:`This action is not supported yet.`}function pc({node:e,actionCallbacks:t,runTypeIcons:n,isActionAvailable:r,rowCountDisplay:i}){let a=e.data.changeStatus===`added`||e.data.changeStatus===`removed`,o=n?.query??lc,s=n?.row_count??lc,c=n?.profile??lc;return q(X,{direction:`row`,sx:{alignItems:`center`,flexWrap:`wrap`,gap:1},children:[K(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,startIcon:K(o,{fontSize:`small`}),onClick:t?.onQueryClick,sx:{textTransform:`none`},children:`Query`}),q(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,startIcon:K(s,{fontSize:`small`}),onClick:t?.onRowCountClick,sx:{textTransform:`none`},children:[`Row Count`,i!=null&&q(G,{children:[`:\xA0`,i]})]}),K($,{title:fc(a,`profile`,r),placement:`top`,children:K(`span`,{children:K(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,startIcon:K(c,{fontSize:`small`}),onClick:t?.onProfileClick,disabled:a,sx:{textTransform:`none`},children:`Profile`})})})]})}function mc({onClick:e,Icon:t}){return K(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,startIcon:K(t,{fontSize:`small`}),onClick:e,sx:{textTransform:`none`},children:`Add schema diff to checklist`})}function hc({node:e,actionCallbacks:t,runTypeIcons:n,featureToggles:r,isActionAvailable:i,ConnectionPopoverWrapper:a,rowCountDisplay:o}){let s=r?.mode===`metadata only`,c=e.data.changeStatus===`added`||e.data.changeStatus===`removed`,l=n?.query_diff??lc,u=n?.row_count_diff??lc,d=n?.profile_diff??lc,f=n?.value_diff??lc,p=n?.top_k_diff??lc,m=n?.histogram_diff??lc,h=(e,t)=>s?K(a,{display:!0,children:e}):K($,{title:fc(c,t,i),placement:`top`,children:K(`span`,{children:e})});return q(X,{direction:`row`,sx:{alignItems:`center`,flexWrap:`wrap`,gap:2},children:[K(Z,{variant:`caption`,sx:{fontWeight:`bold`},children:`Diff`}),q(X,{direction:`row`,sx:{alignItems:`center`,flexWrap:`wrap`,gap:1,width:`93%`},children:[K(a,{display:s,children:q(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,startIcon:K(u,{fontSize:`small`}),onClick:t?.onRowCountDiffClick,disabled:r?.disableDatabaseQuery,sx:{textTransform:`none`},children:[`Row Count`,o!=null&&q(G,{children:[`:\xA0`,o]})]})}),h(K(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,startIcon:K(d,{fontSize:`small`}),onClick:t?.onProfileDiffClick,disabled:c||r?.disableDatabaseQuery,sx:{textTransform:`none`},children:`Profile`}),`profile_diff`),h(K(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,startIcon:K(f,{fontSize:`small`}),onClick:t?.onValueDiffClick,disabled:c||r?.disableDatabaseQuery,sx:{textTransform:`none`},children:`Value`}),`value_diff`),h(K(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,startIcon:K(p,{fontSize:`small`}),onClick:t?.onTopKDiffClick,disabled:c||r?.disableDatabaseQuery,sx:{textTransform:`none`},children:`Top-K`}),`top_k_diff`),h(K(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,startIcon:K(m,{fontSize:`small`}),onClick:t?.onHistogramDiffClick,disabled:c||r?.disableDatabaseQuery,sx:{textTransform:`none`},children:`Histogram`}),`histogram_diff`),K(a,{display:s,children:K(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,startIcon:K(l,{fontSize:`small`}),onClick:t?.onQueryDiffClick,disabled:r?.disableDatabaseQuery,sx:{textTransform:`none`},children:`Query`})})]})]})}function gc({node:e,onCloseNode:t,isSingleEnv:n,featureToggles:r,modelDetail:i,lineageTabContent:a,SchemaView:o,SingleEnvSchemaView:s,NodeSqlView:c,ResourceTypeTag:l,NotificationComponent:u,ConnectionPopoverWrapper:d=uc,runTypeIcons:f,actionCallbacks:p,isActionAvailable:m=dc,isWholeModelChanged:h=!1,isWholeModelImpacted:g=!1,newCllExperience:_=!1,isImpacted:v=!1,rowCountDisplay:y}){let b=e.data.resourceType===`model`||e.data.resourceType===`seed`||e.data.resourceType===`source`||e.data.resourceType===`snapshot`,[x,S]=W(!0),[C,w]=W(0),{base:T,current:E}=i??{},D=!n&&e.data.change?.columns!=null&&Object.keys(e.data.change.columns).length>0,O=!n&&e.data.changeStatus===`modified`,k=e.data.resourceType===`model`||e.data.resourceType===`seed`||e.data.resourceType===`snapshot`,A=!n&&k&&p?.onAddSchemaDiffClick!=null,j=f?.schema_diff??lc,{isDark:ee}=Ht(),M={newCllExperience:_,isWholeModelChanged:h,isWholeModelImpacted:g,isImpacted:v,changeCategory:e.data.change?.category},N=Bt(M,ee),P=Lt({name:e.data.name,resourceType:e.data.resourceType,materialized:e.data.materialized},M),te=_?void 0:Vt(e.data.change?.category);return q(J,{className:N?`cll-experience`:void 0,sx:{height:`100%`,display:`flex`,flexDirection:`column`,borderLeft:`3px solid ${N?N.tokens.stripeAccent:`transparent`}`},children:[q(X,{direction:`row`,sx:{alignItems:`center`,px:2,py:1.5,gap:1},children:[K($,{title:P,placement:`top`,children:N?K(gt,{tokens:N.tokens,variant:`titleChip`,testId:`whole-model-${N.kind}-title-chip`,sx:{flex:`0 1 auto`,mr:`auto`,minWidth:0},children:K(Z,{variant:`subtitle1`,component:`span`,className:`no-track-pii-safe`,sx:{fontWeight:600,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,color:`inherit`},children:e.data.name})}):K(Z,{component:`span`,variant:`subtitle1`,className:`no-track-pii-safe`,sx:{fontWeight:600,flex:`0 1 auto`,mr:`auto`,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.data.name})}),l&&K(J,{sx:{color:`text.secondary`,flexShrink:0},children:K(l,{node:e})}),te&&K(Wr,{"data-testid":`change-category-chip`,label:te,size:`small`,variant:`outlined`,sx:{flexShrink:0}}),K(Q,{size:`small`,onClick:t,sx:{flexShrink:0},children:K(fr,{})})]}),k&&K(J,{sx:{pl:2,py:1},children:n?K(pc,{node:e,actionCallbacks:p,runTypeIcons:f,isActionAvailable:m,rowCountDisplay:y}):K(hc,{node:e,actionCallbacks:p,runTypeIcons:f,featureToggles:r,isActionAvailable:m,ConnectionPopoverWrapper:d,rowCountDisplay:y})}),b&&q(J,{sx:{overflow:`auto`,display:`flex`,flexDirection:`column`,flex:1,minHeight:0},children:[n&&x&&u&&K(J,{sx:{p:1.5},children:K(u,{onClose:()=>S(!1),children:K(Z,{variant:`body2`,children:`Enable the Recce Checklist and start adding checks for better data validation and review.`})})}),q(Di,{value:C,onChange:(e,t)=>w(t),sx:{borderBottom:1,borderColor:`divider`},children:[K(Ei,{label:q(J,{component:`span`,sx:{display:`flex`,alignItems:`center`,gap:.75},children:[`Columns`,D&&K(J,{component:`span`,sx:{color:`amber.main`,fontSize:`0.5rem`,lineHeight:1},children:`●`})]})}),K(Ei,{label:q(J,{component:`span`,sx:{display:`flex`,alignItems:`center`,gap:.75},children:[`Code`,O&&K(J,{component:`span`,sx:{color:`amber.main`,fontSize:`0.5rem`,lineHeight:1},children:`●`})]})}),a&&K(Ei,{label:`Lineage`})]}),q(J,{sx:{overflow:`auto`,height:`calc(100% - 48px)`},children:[K(cc,{value:C,index:0,children:K(J,{sx:{overflowY:`auto`,height:`100%`},children:n?s&&K(s,{current:E}):o&&K(o,{base:T,current:E,columnChanges:e.data.change?.columns,onViewCode:()=>w(1),headerAction:A?K(mc,{onClick:p?.onAddSchemaDiffClick,Icon:j}):void 0})})}),K(cc,{value:C,index:1,children:K(J,{sx:{height:`100%`},children:c&&K(c,{node:e})})}),a&&K(cc,{value:C,index:2,children:K(J,{sx:{height:`100%`},children:a})})]})]})]})}const _c=({node:e})=>K(at,{resourceType:e.data.resourceType,materialized:e.data.materialized});function vc({onClose:e}){return K(Me,{onClose:e,align:`flex-start`,children:q(Z,{variant:`body2`,children:[`Enable the Recce Checklist and start adding checks for better data validation and review.`,K(`br`,{}),K(jt,{})]})})}function yc({node:e,onCloseNode:t,onNavigateToNode:r,onBack:i,onCenterFocused:a,historyTrail:o,onJumpToHistory:s}){let c=Ni(),{runAction:l}=ye(),{isActionAvailable:u,envInfo:d,lineageGraph:f}=L(),p=_e(),{impactingNodeIds:m,impactedNodeIds:h}=H(()=>Ms(p?.cll),[p?.cll]),{singleEnv:g,featureToggles:_}=se(),{setSqlQuery:v,setPrimaryKeys:y}=_t(),{primaryKey:b}=Et(e.data.name),{apiClient:x}=R(),{basePath:C}=ce(),{runsAggregated:w}=L(),T=g??!1,E=H(()=>{let t=w?.[e.id],n=T?t?.row_count?.result:t?.row_count_diff?.result;return n?K(rc,{rowCount:n}):void 0},[w,e.id,T]),{data:D}=Gn({queryKey:[`modelDetail`,e.id],queryFn:()=>n(e.id,x),enabled:!!x,staleTime:300*1e3}),O=D?.model,k=H(()=>({query:$t(`query`).icon,row_count:$t(`row_count`).icon,row_count_diff:$t(`row_count_diff`).icon,profile:$t(`profile`).icon,profile_diff:$t(`profile_diff`).icon,query_diff:$t(`query_diff`).icon,value_diff:$t(`value_diff`).icon,top_k_diff:$t(`top_k_diff`).icon,histogram_diff:$t(`histogram_diff`).icon,schema_diff:$t(`schema_diff`).icon}),[]),A=rn(Object.keys(O?.base?.columns??{}),Object.keys(O?.current?.columns??{})),j=H(()=>A.length?`select \n ${A.join(`
@@ -9,4 +9,4 @@ import{$ as e,A as t,C as n,D as r,E as i,F as a,I as o,J as s,M as c,N as l,P a
9
9
  ${Jl(e)}
10
10
 
11
11
  </details>`}function Jl(e){let t=et({description:e.description});if(e.type===`query`||e.type===`query_diff`){let n=e.params;return`${t}\n\n${He({sql:n&&`sql_template`in n?n.sql_template:``})}`}return t}const Yl=()=>{let e=Kn(),t=Ni(),{apiClient:n}=R(),{basePath:r}=ce(),{mutate:i,isPending:a}=Wn({mutationFn:()=>S({select:`state:modified`},n),onSuccess:async n=>{await e.invalidateQueries({queryKey:F.checks()}),t.push(`${r}/checks/?id=${n.check_id}`)}});return K(We,{title:`No checks yet`,description:`Checks help you validate data quality and catch issues.`,icon:K(Vi,{size:48}),actionText:`Create Schema Diff Check`,onAction:()=>{i()},isLoading:a,helperText:`The schema checks compare modified models between environments to detect changes, additions, or removals.`})},Xl=({check:e,selected:t,onSelect:n,onApprovalChange:r})=>{let{featureToggles:i}=se(),a=e.last_run?.run_id,{run:o}=It(a),s=Je({type:e.type,hasResult:!!o?.result,hasError:!!o?.error}),c=s||i.disableUpdateChecklist;return K(ht,{check:{id:e.check_id,name:e.name,type:e.type,isApproved:e.is_checked,runStatus:(()=>{if(o){if(o.error)return`error`;if(o.result)return`success`}})(),isPreset:e.is_preset,isOutdated:e.is_outdated,lastRunAt:e.last_run?.run_at,actorType:e.actor_type},isSelected:t,onClick:n,onApprovalChange:r,disableApproval:c,disabledApprovalTooltip:s?`Run the check first`:void 0})},Zl=({checks:e,selectedItem:t,onCheckSelected:n,onChecksReordered:r})=>{let[i,o]=W(!1),[s,c]=W(!1),[l,u]=W(null),d=Kn(),{apiClient:f}=R(),{mutate:p}=Wn({mutationFn:({checkId:e,isChecked:t})=>a(e,{is_checked:t},f),onSuccess:async(e,{checkId:t})=>{await d.invalidateQueries({queryKey:F.check(t)}),await d.invalidateQueries({queryKey:F.checks()})}}),m=e=>{e.destination&&r(e.source.index,e.destination.index)},h=()=>c(!0),g=()=>{c(!1),u(null)},_=()=>{cn.create({title:`Marked as approved`,type:`success`,duration:2e3})},v=(e,t)=>{t?localStorage.getItem(`bypassMarkAsApprovedWarning`)===`true`?(p({checkId:e,isChecked:!0}),_()):(u(e),h()):p({checkId:e,isChecked:!1})};return q(G,{children:[K(wa,{onDragEnd:m,children:K(Ea,{droppableId:`checklist`,children:r=>q(X,{...r.droppableProps,ref:r.innerRef,className:`no-track-pii-safe`,sx:{width:`100%`,flex:1,overflow:`auto`},spacing:0,children:[e.map((e,r)=>K(Ta,{draggableId:e.check_id,index:r,children:(r,i)=>{let a=r.draggableProps.style;if(i.isDragging&&a&&`left`in a){let e={x:0,y:80};a={...a,left:a.left-e.x,top:a.top-e.y}}return K(J,{ref:r.innerRef,...r.draggableProps,...r.dragHandleProps,style:a,sx:{borderBottom:`1px solid`,borderColor:`divider`,width:`100%`},children:K(Xl,{check:e,selected:e.check_id===t,onSelect:n,onApprovalChange:v},e.check_id)})}},e.check_id)),r.placeholder]})})}),q(er,{open:s,onClose:g,maxWidth:`xs`,fullWidth:!0,children:[q(rr,{sx:{display:`flex`,alignItems:`center`},children:[`Mark as Approved?`,K(J,{sx:{flexGrow:1}}),K(Q,{size:`small`,onClick:g,children:K(fr,{})})]}),K(hr,{}),q(nr,{sx:{fontSize:`0.875rem`},children:[K(Z,{children:`Please ensure you have reviewed the contents of this check before marking it as approved.`}),K(li,{control:K(ci,{checked:i,onChange:e=>{o(e.target.checked)},size:`small`}),label:K(Z,{sx:{fontWeight:`bold`,pt:`8px`},children:`Don't show this again`})})]}),K(hr,{}),q(tr,{sx:{gap:0},children:[K(Y,{variant:`outlined`,size:`small`,onClick:g,children:`Cancel`}),K(Y,{color:`iochmara`,variant:`contained`,size:`small`,onClick:()=>{l&&(p({checkId:l,isChecked:!0}),i&&localStorage.setItem(`bypassMarkAsApprovedWarning`,`true`),_(),g(),u(null))},children:`Mark as approved`})]})]})]})},Ql=()=>{let{isDark:e}=Ht(),t=e?`grey.700`:`grey.300`,n=Ni(),r=Pi().get(`id`),{latestSelectedCheckId:i,setLatestSelectedCheckId:a}=Ge(),o=Kn(),{apiClient:s}=R(),{basePath:l}=ce(),d=r;V(()=>{d&&a(d)},[d,a]);let{isLoading:f,error:p,data:m,status:h,refetch:g}=Gn({queryKey:F.checks(),queryFn:()=>c(s),refetchOnMount:!0}),_=B(e=>{n.push(`${l}/checks/?id=${e}`)},[n.push,l]),[v,y]=W(m??[]),[b,x]=W(m);m!==b&&(x(m),y(m??[]));let{mutate:S}=Wn({mutationFn:e=>u(e,s),onSuccess:async()=>{await o.invalidateQueries({queryKey:F.checks()})}}),C=B((e,t)=>{let n=[...v],[r]=n.splice(e,1);n.splice(t,0,r),S({source:e,destination:t}),y(n)},[v,S]),w=H(()=>!!(d&&m?.some(e=>e.check_id===d)),[d,m]);return V(()=>{h===`success`&&m.length!==0&&(w||(i&&m.some(e=>e.check_id===i)?n.replace(`${l}/checks/?id=${i}`):n.replace(`${l}/checks/?id=${m[0].check_id}`)))},[h,w,m,i,n.replace,l]),f?null:p?q(J,{children:[`Error: `,K(`span`,{className:`no-track-pii-safe`,children:p.message})]}):m?.length?q(bt,{style:{height:`100%`},minSize:50,sizes:[20,80],children:[K(J,{sx:{height:`100%`},style:{contain:`size`},children:q(X,{sx:{height:`100%`,alignItems:`stretch`},style:{contain:`strict`},spacing:0,children:[K(J,{sx:{display:`flex`,justifyContent:`flex-end`,p:`0px 10px`},children:K(Bl,{checksOnly:!0})}),K(hr,{}),K(Zl,{checks:v,selectedItem:d,onCheckSelected:_,onChecksReordered:C})]})}),K(J,{sx:{height:`100%`},children:w&&d&&K(Kl,{checkId:d,refreshCheckList:g},d)})]}):q(bt,{style:{height:`100%`},minSize:50,sizes:[20,80],children:[K(J,{sx:{borderRight:`1px solid`,borderRightColor:t,height:`100%`},style:{contain:`size`},children:q(X,{sx:{height:`100%`,alignItems:`stretch`},style:{contain:`strict`},spacing:0,children:[K(J,{sx:{display:`flex`,justifyContent:`flex-end`,p:`0px 10px`},children:K(Bl,{checksOnly:!0})}),K(hr,{}),K(J,{sx:{height:`100%`,display:`flex`,justifyContent:`center`,alignItems:`center`},children:K(J,{sx:{textAlign:`center`,color:`grey.500`},children:`No checks`})})]})}),K(J,{children:K(J,{sx:{height:`100%`,display:`flex`,justifyContent:`center`,alignItems:`center`},children:K(Yl,{})})})]})},$l=()=>{let{isDark:e}=Ht();return q(bt,{style:{height:`100%`},minSize:50,sizes:[20,80],children:[K(J,{sx:{borderRight:`1px solid`,borderRightColor:e?`grey.700`:`grey.300`,height:`100%`},style:{contain:`size`},children:K(J,{sx:{height:`100%`,display:`flex`,justifyContent:`center`,alignItems:`center`},children:K(gr,{size:20})})}),K(J,{children:K(J,{sx:{height:`100%`,display:`flex`,justifyContent:`center`,alignItems:`center`},children:K(gr,{size:20})})})]})},eu={added:[`Model Added`,`Added resource`],removed:[`Model Removed`,`Removed resource`],modified:[`Model Modified`,`Modified resource`],col_added:[`Column Added`,`Added column`],col_removed:[`Column Removed`,`Removed column`],col_changed:[`Column Modified`,`Modified column`],folder_changed:[`Modified`,`Modified folder`]};function tu(e){let t=String(Oe(`colors.green.solid`)),n=String(Oe(`colors.red.solid`)),r=String(Oe(`colors.amber.emphasized`));return e===`added`?{color:t,icon:ct}:e===`removed`?{color:n,icon:lt}:e===`modified`?{color:r,icon:Xt}:e===`col_added`?{color:t,icon:ct}:e===`col_removed`?{color:n,icon:lt}:e===`col_changed`?{color:r,icon:Xt}:e===`folder_changed`?{color:r,icon:Fe}:{color:`inherit`,icon:void 0}}function nu(e,t){let n=0,r=0,i=0;return!e&&!t?{adds:n,removes:r,modifies:i}:(t&&Object.keys(t.columns??{}).forEach(t=>{e?.columns?.[t]||n++}),e&&Object.keys(e.columns??{}).forEach(e=>{t?.columns?.[e]||r++}),t&&e&&Object.keys(t.columns??{}).forEach(n=>{e.columns&&t.columns?.[n]&&e.columns[n]&&e.columns[n].type!==t.columns[n].type&&i++}),{adds:n,removes:r,modifies:i})}function ru(e){let t=e.modifiedSet,n=0,r=0,i=0,a=0,o=0,s=0;return t.forEach(t=>{e.nodes[t].data.changeStatus===`added`?n++:e.nodes[t].data.changeStatus===`removed`?r++:e.nodes[t].data.changeStatus===`modified`&&i++;let c=e.nodes[t].data.change?.columns;if(c)for(let e of Object.values(c))e===`added`?a++:e===`removed`?o++:(e===`modified`||e===`unknown`)&&s++}),{adds:n,removes:r,modifies:i,col_added:a,col_removed:o,col_changed:s}}function iu({name:e,value:t,tip:n}){return q(X,{sx:{alignItems:`stretch`},children:[q(Z,{sx:{fontSize:`0.875rem`,color:`grey.600`},children:[e,n&&K($,{title:n,children:K(J,{sx:{display:`inline-block`},children:K(J,{component:qi,sx:{mx:`2px`,fontSize:12,verticalAlign:`middle`}})})})]}),t]})}function au({changeStatus:e,value:t}){let[n]=e?eu[e]:[``],{icon:r,color:i}=tu(e);return q(X,{sx:{alignItems:`stretch`},children:[q(X,{direction:`row`,sx:{alignItems:`center`,fontSize:`0.875rem`,color:`grey.600`},children:[r&&K(J,{component:r,sx:{mr:`5px`,color:i,fontSize:`1rem`}}),n]}),K(Z,{sx:{fontSize:`0.875rem`},children:t})]})}function ou({lineageGraph:e}){let{adds:t,removes:n,modifies:r,col_added:i,col_removed:a,col_changed:o}=ru(e);return q(xa,{container:!0,sx:{mb:`10px`,borderTop:`1px solid`,borderColor:`divider`,p:`2.5vw`},children:[K(xa,{size:6,sx:{borderColor:`divider`},children:K(iu,{name:`Code Changes`,value:q(xa,{container:!0,sx:{width:`100%`},children:[K(xa,{size:4,children:K(au,{changeStatus:`added`,value:t})}),K(xa,{size:4,children:K(au,{changeStatus:`removed`,value:n})}),K(xa,{size:4,children:K(au,{changeStatus:`modified`,value:r})})]})})}),K(xa,{size:6,sx:{borderLeft:`1px solid`,borderLeftColor:`divider`,pl:`12px`},children:K(iu,{name:`Column Changes`,value:q(xa,{container:!0,sx:{width:`100%`},children:[K(xa,{size:4,children:K(au,{changeStatus:`col_added`,value:i})}),K(xa,{size:4,children:K(au,{changeStatus:`col_removed`,value:a})}),K(xa,{size:4,children:K(au,{changeStatus:`col_changed`,value:o})})]})})})]})}function su({node:e,...t}){let{apiClient:r}=R(),{data:i,isLoading:a}=Gn({queryKey:[`modelDetail`,e.id],queryFn:()=>n(e.id,r),enabled:!!r,staleTime:300*1e3}),o=i?.model;return q(Da,{sx:{maxWidth:500},children:[K(ka,{title:K(Z,{sx:{fontSize:18,fontWeight:`bold`},children:t.title}),subheader:q(X,{direction:`row`,spacing:`8px`,sx:{p:`16px`},children:[K(at,{resourceType:e.data.resourceType,materialized:e.data.materialized}),e.data.resourceType===`model`&&K(oc,{node:e})]})}),K(Oa,{children:K(J,{sx:{display:`flex`},children:a?K(sa,{variant:`rectangular`,width:`100%`,height:100}):K(As,{base:o?.base&&Object.keys(o.base).length>0?{id:e.id,unique_id:e.id,name:e.data.name,...o.base}:void 0,current:o?.current&&Object.keys(o.current).length>0?{id:e.id,unique_id:e.id,name:e.data.name,...o.current}:void 0,columnChanges:e.data.change?.columns})})})]})}function cu(e){let t=[],n=e.nodes;return e.modifiedSet.forEach(e=>{let r=n[e];r.data.change?.columns&&Object.keys(r.data.change.columns).length>0&&t.push(r)}),t}function lu({lineageGraph:e}){let[t,n]=W([]);return V(()=>{n(cu(e))},[e]),q(G,{children:[K(J,{sx:{width:`100%`,pb:`10px`,mb:`20px`,mt:`20px`},children:K(Z,{variant:`h5`,sx:{fontSize:24},children:`Schema Summary`})}),K(J,{sx:{width:`100%`,pb:`10px`,mb:`20px`},children:t.length===0?K(Z,{sx:{fontSize:18,color:`grey.600`},children:`No schema changes detected.`}):K(J,{sx:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(400px, 1fr))`,gap:`2vw`,p:`2.5vw`,width:`100%`,bgcolor:`lightgray`},children:t.map(e=>K(su,{title:e.data.name,node:e},e.id))})})]})}function uu({checks:e,isLoading:t,error:n,selectedCheckId:r,onCheckSelect:i,onApprovalChange:a,onAction:o,onReorder:s,onDescriptionChange:c,onNameChange:l,onCreateCheck:u,getCheckTabs:d,getPrimaryActions:f,getSecondaryActions:p,disableApproval:m=!1,disabledApprovalTooltip:h,height:g=`100%`,listPaneSize:_=30,minListSize:v=200,maxListSize:y=500,listTitle:b,className:x}){let S=Ye(),C=e??S.checks,w=t===void 0?S.isLoading:t,T=n??S.error,E=r??S.selectedCheckId,D=i??S.onSelectCheck,O=H(()=>C.map(e=>({id:e.check_id,name:e.name,type:e.type,description:e.description,isApproved:e.is_checked})),[C]),k=H(()=>C.find(e=>e.check_id===E),[C,E]),A=B(e=>{D?.(e)},[D]),j=B((e,t)=>{o?.(e,t)},[o]),ee=B(e=>{E&&c?.(E,e)},[E,c]),M=B(e=>{E&&l?.(E,e)},[E,l]);if(w)return K(J,{className:x,sx:{width:`100%`,height:g,display:`flex`,alignItems:`center`,justifyContent:`center`},children:K(gr,{})});if(T)return K(J,{className:x,sx:{width:`100%`,height:g,display:`flex`,alignItems:`center`,justifyContent:`center`},children:K(Z,{color:`error`,children:T})});if(C.length===0)return K(J,{className:x,sx:{width:`100%`,height:g,display:`flex`,alignItems:`center`,justifyContent:`center`},children:K(We,{title:`No checks yet`,description:`Create your first check to start validating your data.`,actionText:`Create Check`,onAction:u})});let N=k?d?.(k):void 0,P=k?f?.(k):void 0,te=k?p?.(k):void 0;return K(J,{className:x,sx:{width:`100%`,height:g},children:q(Kt,{direction:`horizontal`,sizes:[_,100-_],minSizes:[v,200],maxSizes:[y,1/0],children:[K(J,{sx:{height:`100%`,overflow:`auto`},children:K(pt,{checks:O,selectedId:E,onCheckSelect:A,onApprovalChange:a,onReorder:s,disableApproval:m,disabledApprovalTooltip:h,title:b})}),K(J,{sx:{height:`100%`,overflow:`auto`},children:k?K(Xe,{checkId:k.check_id,name:k.name,type:k.type,description:k.description,isApproved:k.is_checked,tabs:N,primaryActions:P,secondaryActions:te,onAction:j,onDescriptionChange:ee,onNameChange:M}):K(J,{sx:{height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:K(Z,{sx:{color:`text.secondary`},children:`Select a check from the list to view details`})})})]})})}const du=Xn(uu);du.displayName=`ChecksView`;const fu=`0.2.0`;export{vs as A,xo as B,oc as C,Ds as D,ec as E,Qo as F,Ma as H,Uo as I,To as L,ds as M,us as N,As as O,ns as P,Co as R,gc as S,sc as T,ja as U,Fa as V,sl as _,ru as a,qc as b,eu as c,Zl as d,Yl as f,Ml as g,Ll as h,ou as i,gs as j,js as k,$l as l,Rl as m,du as n,nu as o,Kl as p,lu as r,tu as s,fu as t,Ql as u,Xc as v,rc as w,kc as x,Jc as y,So as z};
12
- //# sourceMappingURL=src-BD64DhI9.js.map
12
+ //# sourceMappingURL=src-CsFtIEfr.js.map