@datarecce/ui 1.50.0 → 1.51.0-nightly.20260528
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/advanced.d.ts +2 -2
- package/dist/advanced.js +1 -1
- package/dist/components.d.ts +3 -3
- package/dist/components.js +1 -1
- package/dist/{index-DBmav15_.d.ts → index-BNim7TxF.d.ts} +3 -3
- package/dist/{index-DBmav15_.d.ts.map → index-BNim7TxF.d.ts.map} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/{lineage-CNzBzgKf.d.ts → lineage-BmVGwz-w.d.ts} +122 -2
- package/dist/lineage-BmVGwz-w.d.ts.map +1 -0
- package/dist/{primitives-CXNmkYAi.d.ts → primitives-oVImvbMI.d.ts} +2 -1
- package/dist/primitives-oVImvbMI.d.ts.map +1 -0
- package/dist/primitives.d.ts +1 -1
- package/dist/src-Cm14qLUt.js +12 -0
- package/dist/src-Cm14qLUt.js.map +1 -0
- package/dist/theme.d.ts +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
- package/dist/lineage-CNzBzgKf.d.ts.map +0 -1
- package/dist/primitives-CXNmkYAi.d.ts.map +0 -1
- package/dist/src-hMcXVoVq.js +0 -12
- package/dist/src-hMcXVoVq.js.map +0 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{A as e,B as t,E as n,F as r,J as i,K as a,M as o,N as s,P as c,Q as l,S as u,T as d,_t as f,a as p,c as m,d as h,dt as g,h as _,ht as v,it as y,j as b,k as x,l as S,m as C,n as w,nt as T,o as E,ot as D,p as O,q as k,s as ee,tt as A,u as j,vt as M,w as N,x as te}from"./api-rVbRZrM4.js";import{c as ne,f as P}from"./keepAlive-DbC0X4zr.js";import{n as re,r as ie,t as ae}from"./fetchClient-BVyYwVMf.js";import{A as oe,D as se,E as ce,N as F,S as I,T as le,_ as ue,a as de,b as fe,d as pe,f as me,g as he,h as ge,j as _e,l as ve,m as ye,o as be,p as xe,s as Se,u as Ce,v as we,x as Te,y as L}from"./utils-Br2xknRC.js";import{i as Ee,n as De}from"./colors-BbPSDR1X.js";import{$ as Oe,$t as ke,A as Ae,An as je,Bn as Me,Bt as R,C as Ne,Cn as Pe,D as Fe,Dn as Ie,E as z,En as Le,F as Re,Ft as B,Hn as ze,Ht as Be,It as Ve,Jt as He,Mn as Ue,Nn as We,Nt as Ge,O as Ke,On as qe,Pn as Je,Pt as Ye,Qt as Xe,Rt as Ze,S as Qe,Sn as $e,Tn as et,Un as tt,Ut as nt,Vt as rt,Xt as it,Yt as at,Zt as ot,_t as st,an as ct,b as lt,bn as ut,cn as dt,ct as ft,d as pt,dn as mt,dt as ht,f as gt,fn as _t,ht as vt,i as yt,in as bt,jn as xt,jt as St,k as Ct,kn as wt,l as Tt,ln as Et,lt as Dt,n as Ot,nn as kt,on as At,qt as jt,rn as Mt,sn as Nt,st as Pt,t as Ft,tn as It,u as Lt,vt as Rt,w as zt,wn as Bt,xn as Vt,yn as Ht,z as Ut,zn as Wt,zt as Gt}from"./hooks-CWIhtbru.js";import{Ft as Kt,Pt as qt,a as Jt,ct as Yt,dt as Xt,i as Zt,m as Qt,o as $t,r as en,s as tn,t as nn}from"./utils-REQY3uHY.js";import{fetchGitHubAvatar as rn,fetchUser as an}from"./lib/api/user.js";import{PUBLIC_API_URL as on,PUBLIC_CLOUD_WEB_URL as sn,RECCE_SUPPORT_CALENDAR_URL as cn}from"./lib/const.js";import{EXPLORE_ACTION as ln,EXPLORE_SOURCE as un,trackArtifactUploadStarted as dn,trackColumnLevelLineage as fn,trackCopyToClipboard as pn,trackDwSetupCompleted as mn,trackDwSetupShown as hn,trackDwSetupSkipped as gn,trackEnvironmentConfig as _n,trackExploreAction as vn,trackHistoryAction as yn,trackInit as bn,trackLineageSelection as xn,trackLineageViewRender as Sn,trackMultiNodesAction as Cn,trackNavigation as wn,trackOssShareButtonClicked as Tn,trackRedirectToCloudSession as En,trackSignupCompleted as Dn,trackSignupRedirectInitiated as On,trackStateAction as kn}from"./lib/api/track.js";import{t as An}from"./constants-D-hOGDbU.js";import{QueryClient as jn,QueryClientProvider as Mn,useMutation as Nn,useQuery as Pn,useQueryClient as Fn}from"@tanstack/react-query";import{Suspense as In,createContext as Ln,forwardRef as Rn,memo as zn,useCallback as V,useContext as Bn,useEffect as H,useImperativeHandle as Vn,useLayoutEffect as Hn,useMemo as U,useRef as Un,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 Wn from"@mui/material/Dialog";import Gn from"@mui/material/DialogActions";import Kn from"@mui/material/DialogContent";import qn from"@mui/material/DialogTitle";import Jn from"@mui/material/Link";import X from"@mui/material/Stack";import Z from"@mui/material/Typography";import Yn from"js-cookie";import{LuExternalLink as Xn,LuSave as Zn}from"react-icons/lu";import{useTheme as Qn}from"@mui/material/styles";import{useTheme as $n}from"next-themes";import Q from"@mui/material/IconButton";import er from"next/link";import{IoBookmarksOutline as tr,IoClose as nr,IoSync as rr,IoWarning as ir}from"react-icons/io5";import ar from"@mui/material/Divider";import or from"@mui/material/CircularProgress";import $ from"@mui/material/Tooltip";import{FaCloud as sr,FaExpandArrowsAlt as cr,FaGithub as lr,FaQuestionCircle as ur,FaRegDotCircle as dr,FaSlack as fr,FaUser as pr}from"react-icons/fa";import{PiBookmarkSimple as mr,PiCaretDown as hr,PiChatText as gr,PiCheckCircle as _r,PiCircle as vr,PiCopy as yr,PiExport as br,PiInfo as xr,PiInfoFill as Sr,PiMoon as Cr,PiNotePencil as wr,PiPencil as Tr,PiPencilSimple as Er,PiPlusCircle as Dr,PiRepeat as Or,PiSun as kr,PiTrashFill as Ar,PiTrashSimple as jr,PiUserPlus as Mr,PiX as Nr}from"react-icons/pi";import Pr from"@mui/material/Chip";import{Background as Fr,BackgroundVariant as Ir,BaseEdge as Lr,ControlButton as Rr,Controls as zr,MiniMap as Br,Panel as Vr,Position as Hr,ReactFlow as Ur,ReactFlowProvider as Wr,getBezierPath as Gr,getNodesBounds as Kr,useEdgesState as qr,useNodesState as Jr,useReactFlow as Yr,useStore as Xr}from"@xyflow/react";import Zr from"file-saver";import Qr from"@mui/material/Checkbox";import $r from"@mui/material/FormControlLabel";import ei from"@mui/material/Alert";import ti from"@mui/material/InputBase";import ni from"@mui/material/Menu";import ri from"@mui/material/MenuItem";import{isEmpty as ii}from"lodash";import{VscCircleLarge as ai,VscGitPullRequest as oi,VscHistory as si,VscKebabVertical as ci}from"react-icons/vsc";import li from"@mui/material/ListSubheader";import ui from"@mui/material/FormControl";import{Box as di,Typography as fi}from"@mui/material";import pi from"@mui/material/TextField";import{format as mi,formatDistanceToNow as hi}from"date-fns";import gi from"@mui/material/Tab";import _i from"@mui/material/Tabs";import vi from"@mui/material/List";import yi from"@mui/material/ListItem";import"@xyflow/react/dist/style.css";import bi from"@mui/material/Avatar";import xi from"@mui/material/Popover";import{usePathname as Si,useRouter as Ci,useSearchParams as wi}from"next/navigation";import{MdArrowBack as Ti,MdArrowDownward as Ei,MdArrowUpward as Di,MdGpsFixed as Oi,MdInfo as ki,MdSearch as Ai}from"react-icons/md";import{TbChecklist as ji,TbEdit as Mi}from"react-icons/tb";import Ni from"@mui/material/ListItemIcon";import Pi from"@mui/material/ListItemText";import{FiArrowRight as Fi,FiCopy as Ii,FiInfo as Li,FiPackage as Ri}from"react-icons/fi";import zi from"@mui/material/Switch";import{RiArrowDownSFill as Bi,RiArrowUpSFill as Vi,RiMindMap as Hi,RiSwapLine as Ui,RiTerminalBoxLine as Wi}from"react-icons/ri";import{FaBookmark as Gi,FaFileImport as Ki}from"react-icons/fa6";import{BiArrowFromBottom as qi,BiArrowToBottom as Ji}from"react-icons/bi";import Yi from"@dagrejs/dagre";import Xi from"@mui/material/Skeleton";import Zi from"@mui/material/Radio";import Qi from"@mui/material/RadioGroup";import $i from"@mui/material/Paper";import ea from"@mui/material/Table";import ta from"@mui/material/TableBody";import na from"@mui/material/TableCell";import ra from"@mui/material/TableContainer";import ia from"@mui/material/TableHead";import aa from"@mui/material/TableRow";import oa from"@mui/material/InputLabel";import sa from"@mui/material/Select";import ca from"@mui/material/Badge";import la from"@mui/material/Grid";import{stripIndents as ua}from"common-tags";import{IoMdCodeWorking as da}from"react-icons/io";import{DragDropContext as fa,Draggable as pa,Droppable as ma}from"@hello-pangea/dnd";import ha from"@mui/material/Card";import ga from"@mui/material/CardContent";import _a from"@mui/material/CardHeader";const va=Ln(null);va.displayName=`RecceRoutingContext`;function ya(){return Bn(va)||{basePath:``,buildPath:e=>e,pathname:``,navigate:e=>{typeof window<`u`&&(window.location.href=e)}}}function ba(){let{pathname:e,navigate:t}=ya();return[e,t]}function xa({children:e,config:t}){let n=t?.basePath??``,r=t?.pathname??``,i=t?.onNavigate,a=V(e=>n?`${n}${e.startsWith(`/`)?e:`/${e}`}`:e,[n]),o=V((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=U(()=>({basePath:n,buildPath:a,pathname:r,navigate:o}),[n,a,r,o]);return K(va.Provider,{value:s,children:e})}const Sa=e=>new jn({defaultOptions:{queries:{staleTime:e?.staleTime??1e3*60,gcTime:e?.gcTime??1e3*60*5,retry:1,refetchOnWindowFocus:!1}}});function Ca({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=U(()=>Sa({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(xa,{config:r,children:y}),y=K(Kt,{defaultMode:n,children:y}),y=K(ne,{config:t,children:y}),y=K(Mn,{client:f,children:y}),v&&(y=K(Me,{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(ze,{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(we,{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(Te,{children:y})),p&&(y=K(le,{children:y})),y}function wa({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(ar,{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`})})]})})}const Ta=({lineageGraph:e,cllInput:t,onCenterNode:n})=>{let r={cursor:`pointer`,fontFamily:`monospace`,bgcolor:qt()?`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]})]})},Ea=({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(dr,{}),onClick:()=>{l?.(!0),o({no_upstream:!0,change_analysis:!0})},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(Ta,{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:xr,sx:{color:`error.main`,fontSize:`14px`}})})}),e.isPending?K(or,{size:12,sx:{ml:`2px`}}):K(Q,{size:`small`,sx:{ml:`2px`},"aria-label":`Reset Column Level Lineage`,onClick:()=>{s()},children:K(Nr,{size:`10px`})})]})]})};function Da({onClose:e}){let{cancel:t,actionState:n}=ue();return K(wa,{actionState:n,onCancel:t,onClose:e})}const Oa=({action:e})=>{let{showColumnLevelLineage:t,resetColumnLevelLineage:n,interactive:r,viewOptions:i,centerNode:a,setChangeAnalysisMode:o,newCllExperience:s,changeAnalysisMode:c}=ue(),{data:l}=me(),u=l?.single_env_onboarding??!1,{lineageGraph:d,isActionAvailable:f}=L();return K(Ea,{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 ka(e){let{id:t,data:n}=e,{id:r}=n.node,{column:i,type:a,transformationType:o,changeStatus:s,isImpacted:c}=n,l=Xr(e=>e.transform[2]>.3),{isDark:u}=Ft(),{viewOptions:d,showContextMenu:f,isNodeHighlighted:p,isNodeShowingChangeAnalysis:m,newCllExperience:h}=ue(),g=d.column_level_lineage?.node_id,_=i===d.column_level_lineage?.column&&r===g,v=p(t),y=m(r);return K(Ht,{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 Aa=zn(ka);Aa.displayName=`GraphColumnNode`;function ja(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=wt(d.changeStatus).hexColor,p.strokeDasharray=`5`),!f||f(t,n)||(p.filter=xt);let[m]=Gr({sourceX:r,sourceY:i,sourcePosition:s,targetX:a,targetY:o,targetPosition:c});return K(G,{children:K(Lr,{path:m,markerEnd:u,style:{...p,...l}})})}const Ma=zn(ja);Ma.displayName=`GraphEdge`;function Na(e){let{isEdgeHighlighted:t}=ue();return K(Ma,{...e,isEdgeHighlighted:t})}const Pa=()=>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`})}),Fa=()=>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 Ia({skipReason:e}){return K(Pr,{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(Pa,{})})})]}),sx:{bgcolor:`grey.100`}})}function La({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(Fa,{})})})]})}function Ra({result:e}){let{mismatchedColumns:t}=e,n=t>0;return K(Pr,{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 za({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(Pr,{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 Ba({status:e,skipReason:t,errorMessage:n,progress:r,valueDiffResult:i,rowCountDiffResult:a,runId:o,"data-testid":s}){return e===`pending`?K(or,{size:16,"data-testid":s,"data-status":`pending`}):e===`skipped`?K(J,{"data-testid":s,"data-status":`skipped`,children:K(Ia,{skipReason:t})}):e===`running`?r?.percentage===void 0?K(or,{size:16,"data-testid":s,"data-status":`running`}):K(or,{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(La,{errorMessage:n})}):i?K(J,{"data-testid":s,"data-status":`success`,children:K(Ra,{result:i})}):a?K(J,{"data-testid":s,"data-status":`success`,children:K(za,{result:a})}):K(J,{"data-testid":s,"data-status":`success`,children:o||`Complete`})}const Va=zn(Ba);Va.displayName=`ActionTag`;const Ha={success:`#059669`,failure:`#ef4444`,error:`#ef4444`,warning:`#f59e0b`},Ua={success:`PASSED`,failure:`FAILED`,error:`ERROR`,warning:`WARNING`};function Wa(e){return Ha[e]??`#6b7280`}function Ga(e){return Ua[e]??e.toUpperCase()}function Ka({run:e,index:t,onClick:n}){let r=Wa(e.status),i=Ga(e.status),a=hi(new Date(e.run_at),{addSuffix:!0}),o=!!n;return q(di,{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(fi,{variant:`body2`,sx:{fontWeight:600,fontSize:`0.75rem`},children:[`Run #`,t,` — `,i,e.triggered_by===`recce_ai`&&K(fi,{component:`span`,sx:{ml:.75,fontSize:`0.65rem`,fontWeight:500,color:`#7c3aed`},children:`by AI`})]}),e.summary&&K(fi,{variant:`body2`,sx:{color:`text.secondary`,fontSize:`0.7rem`,mt:.25},children:e.summary}),K(fi,{variant:`body2`,sx:{color:`text.secondary`,fontSize:`0.65rem`,mt:.25},children:a})]})}function qa({event:e}){let n=t(e),r={create:Dr,comment:gr,approve:_r,unapprove:vr,edit:wr,preset:mr},i={create:`primary.main`,comment:`grey.500`,approve:`success.main`,unapprove:`grey.400`,edit:`warning.main`,preset:`secondary.main`},a=r[n],o=i[n];return K(J,{component:a,sx:{color:o,fontSize:16}})}function Ja({event:e}){let{actor:t}=e,{avatarUrl:n}=Gt({userId:t.user_id}),r=(t.fullname||t.login||`User`).charAt(0).toUpperCase();return K(bi,{src:n||void 0,sx:{width:24,height:24,fontSize:`0.75rem`},children:r})}function Ya({event:e}){let{actor:t}=e,n=t.fullname||t.login||`Someone`,r=hi(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(qa,{event:e})}),K(J,{sx:{flex:1},children:q(X,{direction:`row`,spacing:.5,sx:{flexWrap:`wrap`,alignItems:`center`},children:[K(Ja,{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 Xa({event:e,currentUserId:t,onEdit:n,onDelete:r}){let i=qt(),[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=hi(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(qa,{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(qa,{event:e})}),q(J,{sx:{flex:1},children:[q(X,{direction:`row`,spacing:.5,sx:{flexWrap:`wrap`,alignItems:`center`,mb:.5},children:[K(Ja,{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(pi,{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(ht,{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(Er,{})})}),r&&q(G,{children:[K($,{title:`Delete comment`,children:K(Q,{"aria-label":`Delete comment`,size:`small`,color:`error`,onClick:w,children:K(jr,{})})}),K(xi,{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 Za({event:e,currentUserId:t,onEdit:n,onDelete:r}){return e.event_type===`comment`?K(Xa,{event:e,currentUserId:t,onEdit:n,onDelete:r}):K(Ya,{event:e})}function Qa(e,t){let n=e?.toLowerCase();return n===`finished`?t?`error`:`success`:n===`failed`?`error`:e??`unknown`}function $a(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 eo({checkId:e}){let t=qt(),{apiClient:n,authToken:r}=R(),{events:i,isLoading:a,error:o,createComment:s,isCreatingComment:c,updateComment:u,deleteComment:d}=Tt(e),{data:f}=Pn({queryKey:P.user(),queryFn:()=>an(n),retry:!1}),{data:p}=Pn({queryKey:[`check-runs`,e],queryFn:async()=>(await l(n)).filter(t=>t.check_id===e).map(e=>({run_id:e.run_id,run_at:e.run_at,status:Qa(e.status,e.error),summary:e.error||void 0,triggered_by:e.triggered_by})),enabled:!!r,staleTime:3e4}),m=U(()=>$a(i,p),[i,p]),h=e=>{s(e)},g=async(e,t)=>{await u({eventId:e,content:t})},_=async e=>{await d(e)};return a?K(J,{sx:{height:`100%`,p:4,display:`flex`,justifyContent:`center`,alignItems:`center`},children:K(or,{size:20})}):o?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:t?`grey.700`:`grey.200`},spacing:0,children:[K(J,{sx:{px:3,py:2,borderBottom:`1px solid`,borderColor:t?`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,n)=>q(J,{children:[e.kind===`event`?K(Za,{event:e.event,currentUserId:f?.id,onEdit:g,onDelete:_}):K(Ka,{run:e.run,index:e.index}),n<m.length-1&&K(ar,{sx:{borderColor:t?`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:t?`grey.700`:`grey.200`,bgcolor:t?`grey.900`:`grey.50`},children:K(Ze,{onSubmit:h,isSubmitting:c})})]})}function to({color:e}){return K(J,{component:`span`,sx:{display:`inline-block`,width:`10px`,height:`10px`,bgcolor:e,mr:1,borderRadius:`4px`}})}const no=({defaultPrimaryKeys:e,onPrimaryKeysChange:t,...n})=>{let{isActionAvailable:r}=L(),i=U(()=>[],[]);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(xr,{fontSize:`0.75rem`})})})]}),K(_t,{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 ro({supportCalendarUrl:e=`https://cal.com/team/recce/chat`}){let{data:t}=se();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:Wi,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(nn(t,e),`_blank`)},children:`Connect to Data Warehouse`})})]})})}const io=()=>{let{isCustomQueries:e,setCustomQueries:t,sqlQuery:n,setBaseSqlQuery:r}=lt();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(Sr,{fontSize:`1rem`})})})]}),K(zi,{size:`small`,checked:e,onChange:()=>{!e&&r&&r(n),t(!e)},color:`primary`})]})},ao=()=>{let{sqlQuery:e,baseSqlQuery:t,setSqlQuery:n,setBaseSqlQuery:r,primaryKeys:o,setPrimaryKeys:s,isCustomQueries:c}=lt(),{lineageGraph:l,envInfo:u}=L(),{featureToggles:d,singleEnv:f}=ce(),p=e;u?.adapterType===`sqlmesh`&&e===`select * from {{ ref("mymodel") }}`&&(p=`select * from db.mymodel`),d.mode===`read only`&&(p=`--- Would like to do query here? Book a demo with us at ${cn}\n${p}`);let{showRunId:m}=_e(),{apiClient:h}=R(),{mutate:g,isPending:_}=Nn({mutationFn:async e=>{function n(e){switch(e){case`query`:return a;case`query_base`:return k;case`query_diff`:return i;default:throw Error(`Unknown query type: ${e}`)}}let r=e===`query_base`?t??``:p,s=n(e),l={sql_template:r},u={nowait:!0};e===`query_diff`&&(l.primary_keys=o,c&&(l.base_sql_template=t));let{run_id:d}=await s(l,u,h);return m(d),await T(d,void 0,h)}}),v=U(()=>{let e={};if(!l)return`N/A`;for(let t in l.nodes){let n=l.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`)},[l]);return f||d.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(Gs,{}),K(J,{sx:{flexGrow:1}}),f?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($c,{display:d.mode===`metadata only`,children:K(Y,{variant:`contained`,disabled:!0,size:`small`,sx:{fontSize:`14px`,mt:`16px`},children:`Run Diff`})})]}),K(Fe,{value:p,onChange:n,onRun:()=>{g(`query`)},labels:[`base (production)`,`current (${v})`],SetupGuide:d.mode===`metadata only`?K(ro,{}):K(Bs,{})})]}):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(Gs,{}),K(io,{}),K(J,{sx:{flexGrow:1}}),K(no,{defaultPrimaryKeys:o,onPrimaryKeysChange:s}),K(Y,{variant:`contained`,onClick:()=>{g(`query_diff`)},disabled:_||d.disableDatabaseQuery,size:`small`,children:`Run Diff`})]}),K(J,{sx:{width:`100%`,flex:1,overflowY:`auto`},children:c?K(Fe,{value:p,baseValue:t,onChange:n,onChangeBase:r,onRun:()=>{g(`query`)},onRunBase:()=>{g(`query_base`)},onRunDiff:()=>{g(`query_diff`)}}):K(Ke,{value:p,onChange:n,onRun:()=>{g(`query`)},onRunDiff:()=>{g(`query_diff`)}})})]})};function oo({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=`${Qt(t,n)} Rows`,o=t<n?`success`:`error`);let s=Ut(`row_count_diff`).icon;return K(Pr,{size:`small`,color:o,icon:s?K(s,{}):void 0,label:a,sx:{height:20,fontSize:`0.7rem`}})}function so({id:e,inverted:t}){let{lineageGraph:n,runsAggregated:r}=L(),{text:i,isDark:a}=Ft(),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:wt(`modified`).color,d=t?i.secondary:a?`grey.700`:`grey.100`,f=Ut(`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(oo,{rowCount:o.row_count_diff.result})})})]})}function co({nodeId:e,nodeName:t}){let{getNodeAction:n}=ue(),r=n(e);if(!r)return null;let{status:i,skipReason:a,run:o}=r;if(i===`pending`)return K(Va,{status:`pending`});if(i===`skipped`)return K(Va,{status:`skipped`,skipReason:a});if(!o)return K(Va,{status:`pending`});let{error:s,run_id:c,progress:l}=o;if(i===`running`)return K(Va,{status:`running`,progress:{percentage:l?.percentage}});if(s)return K(Va,{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(Va,{status:`success`,valueDiffResult:{mismatchedColumns:t,totalColumns:n}})}if(g(o)&&o.result){let e=o.result[t];if(e)return K(oo,{rowCount:e})}if(o.type===`row_count`&&o.result){let e=o.result[t];if(e?.curr!==void 0&&e.curr!==null)return K(Pr,{size:`small`,label:`${e.curr.toLocaleString()} Rows`,sx:{height:20,fontSize:`0.7rem`}})}return K(Va,{status:`success`,runId:c})}function lo(e){let{data:t}=e,{id:n,resourceType:r,changeStatus:i,name:a}=t,o=Xr(e=>e.transform[2]>.3),{isDark:s}=Ft(),c=ue(),{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,wholeModelImpact:C}=c,w=S?x.has(n):!1,{isWholeModelChanged:T,isWholeModelImpacted:E}=Nt(n,c),D=b?.current.nodes[n]?.change_category,O=h(n),k=g(n),ee=y.column_level_lineage?.node_id===n&&y.column_level_lineage.column===void 0,A=f?.id===n||ee,j=_(n),M=m(t.id),N=d===`action_result`?p(t.id):void 0,te=i,ne=d,P=d===`action_result`&&N?K(co,{nodeId:n,nodeName:a}):void 0,re=d!==`action_result`&&t.resourceType===`model`?K(so,{id:t.id,inverted:d===`selecting`&&k}):void 0;return K(bt,{id:n,data:{label:a,changeStatus:te,resourceType:r,materialized:t.materialized},newCllExperience:S,isImpacted:w,isWholeModelChanged:T,isWholeModelImpacted:E,wholeModelImpact:C,interactive:l,selectMode:ne,isNodeSelected:k,isFocused:A,isHighlighted:O,showContent:o,actionTag:P,showChangeAnalysis:j,changeCategory:D,runsAggregatedTag:re,hasParents:Object.keys(t.parents).length>0,hasChildren:Object.keys(t.children).length>0,columnCount:M.size,columnHeight:24,isDark:s,onSelect:e=>{u(e)},onContextMenu:(t,n)=>{v(t,e)}})}const uo=zn(lo);uo.displayName=`GraphNode`;const fo={lineageGraphNode:uo,lineageGraphColumnNode:Aa},po={lineageGraphEdge:Na},mo=[],ho=e=>e.data.changeStatus?wt(e.data.changeStatus).hexColor:De.neutral[400],go={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`},_o={LINEAGE_VIEW_CONTEXT_MENU:`lineage_view_context_menu`},vo={SELECT_PARENT_NODES:`select_parent_nodes`,SELECT_CHILD_NODES:`select_child_nodes`,SELECT_ALL_UPSTREAM:`select_all_upstream`,SELECT_ALL_DOWNSTREAM:`select_all_downstream`},yo=({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(ni,{open:t,onClose:n,anchorReference:`anchorPosition`,anchorPosition:{top:i,left:r},slotProps:{paper:{sx:{fontSize:`0.85rem`,width:`250px`}}},children:e.length===0?K(ri,{disabled:!0,children:`No action available`},`no action`):e.map(({isSeparator:e,label:t,isDisabled:r,action:i,itemIcon:a})=>{if(e)return K(ar,{},t);let l=q(ri,{disabled:r,onClick:()=>{i&&i(),n()},children:[a,` `,t]},t);return r&&o?K(s,{display:c,children:l},t):l})})},bo=({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,ee=k.resourceType,A=E?Array.from(E(i.id)):[],j={source:`lineage_model_node`},M=k.changeStatus,N=v?.(k.name);if(M===`modified`&&d.push({label:`Show Impact Radius`,itemIcon:K(dr,{}),isDisabled:l||!u(`change_analysis`),action:()=>{C?.(!0),S?.({node_id:i.id,change_analysis:!0,no_upstream:!0})}}),!b&&ee&&[`model`,`seed`,`snapshot`].includes(ee)){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=$t(t,t),r=`select * from {{ ref("${k.name}") }}`;if(n.length&&(r=`select \n ${n.join(`
|
|
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`)}}),A.length>0&&e)if(x!==void 0){let t=new Set;N&&t.add(N),A.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
|
+
`)}\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
|
+
`)}\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?go.ROW_COUNT:go.ROW_COUNT_DIFF,source:_o.LINEAGE_VIEW_CONTEXT_MENU,node_count:1}),f?.(a,{node_names:[k.name]},{showForm:!1,trackProps:j})}});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?go.PROFILE:go.PROFILE_DIFF,source:_o.LINEAGE_VIEW_CONTEXT_MENU,node_count:1}),f?.(s,{model:k.name,columns:e},{showForm:!0,trackProps:j})}}),!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:go.VALUE_DIFF,source:_o.LINEAGE_VIEW_CONTEXT_MENU,node_count:1}),f?.(`value_diff`,{model:k.name,columns:e},{showForm:!0,trackProps:j})}})}}return D||(d.length>0&&d.push({label:`select group two`,isSeparator:!0}),d.push({label:`Select Parent Nodes`,itemIcon:K(qi,{}),action:()=>{m?.(`lineage_selection`,{action:vo.SELECT_PARENT_NODES}),w?.(i.id,1)}}),d.push({label:`Select Child Nodes`,itemIcon:K(Ji,{}),action:()=>{m?.(`lineage_selection`,{action:vo.SELECT_CHILD_NODES}),T?.(i.id,1)}}),d.push({label:`Select All Upstream Nodes`,itemIcon:K(qi,{}),action:()=>{m?.(`lineage_selection`,{action:vo.SELECT_ALL_UPSTREAM}),w?.(i.id)}}),d.push({label:`Select All Downstream Nodes`,itemIcon:K(Ji,{}),action:()=>{m?.(`lineage_selection`,{action:vo.SELECT_ALL_DOWNSTREAM}),T?.(i.id)}})),K(yo,{x:n,y:r,menuItems:d,open:e,onClose:t,featureToggles:s,DisabledItemWrapper:y})},xo=({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:go.PROFILE_DIFF,source:_o.LINEAGE_VIEW_CONTEXT_MENU,node_count:1}),u?.(`profile_diff`,{model:v.name,columns:[y]},{showForm:!1,trackProps:x})},C=()=>{d?.(`explore_action`,{action:go.HISTOGRAM_DIFF,source:_o.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:go.TOP_K_DIFF,source:_o.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:go.VALUE_DIFF,source:_o.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(yo,{x:n,y:r,menuItems:l,open:e,onClose:t,featureToggles:o,DisabledItemWrapper:m})},So=({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(yo,{menuItems:[],open:e,onClose:t,x:n,y:r,featureToggles:s,DisabledItemWrapper:a.DisabledItemWrapper}):i&&ye(i)?K(bo,{x:n,y:r,isOpen:e,onClose:t,node:i,deps:a,viewOptions:o,featureToggles:s,serverFlags:c,noCatalogCurrent:l,isActionAvailable:u}):i&&xe(i)?K(xo,{x:n,y:r,isOpen:e,onClose:t,node:i,deps:a,featureToggles:s,serverFlags:c,isActionAvailable:u}):null,Co=()=>{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 wo({anchorEl:e}){let[t,n]=W(!1),r=Un(!1);H(()=>{if(!r.current){r.current=!0;try{localStorage.getItem(p.snapshotBaseIntroSeen)||n(!0)}catch{}}},[]);let i=V(()=>{try{localStorage.setItem(p.snapshotBaseIntroSeen,`1`)}catch{}n(!1)},[]);return q(xi,{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 To=()=>{let{isDark:e}=Ft(),{successToast:t,failToast:n}=Yt();return pt({imageType:`png`,shadowEffect:!0,backgroundColor:e?De.neutral[900]:De.neutral[50],ignoreElements:e=>{try{return e.classList.contains(Lt)}catch{return e.className?e.className.includes(Lt):!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)}})},Eo=()=>{let e=Ci(),{basePath:t}=F();return V(n=>{n.check_id&&e.push(`${t}/checks/?id=${n.check_id}`)},[e.push,t])},Do=new Set;function Oo(){let[e,t]=W(()=>new Set),[n,r]=W(()=>new Set),[i,a]=W(()=>Do),[o,s]=W(()=>Do);return{impactedNodeIds:e,impactedColumnIds:n,wholeModelImpactedNodeIds:i,wholeModelChangedNodeIds:o,publish:V(e=>{t(e.nodeIds),r(e.columnIds),a(e.wholeModelImpactedNodeIds??Do),s(e.wholeModelChangedNodeIds??Do)},[])}}const ko=(e,t)=>{let n=Un({width:0,height:0});H(()=>{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])},Ao=()=>V((e,t,n,r,i)=>{let a=e.filter(ye),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),Sn(c)},[]),jo={row_count:ln.ROW_COUNT,row_count_diff:ln.ROW_COUNT_DIFF,value_diff:ln.VALUE_DIFF},Mo=e=>{let t=jo[e.action];t&&vn({action:t,source:un.LINEAGE_VIEW_TOP_BAR,node_count:e.node_count})},No=(e,t)=>Ne(e,{...t,onTrackAction:Mo,trackingSource:un.LINEAGE_VIEW_TOP_BAR});function Po({notification:e,type:t}){let n=E.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(nr,{})})]})}function Fo(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 Io(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 Lo(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 Ro=e=>{let{runAction:t}=_e(),{setSqlQuery:n,setPrimaryKeys:r}=lt(),i=Ci(),{primaryKey:a}=yt(e),{basePath:o}=F();return{runAction:(e,n,r)=>{t(e,n,r)},onNavigate:e=>{i.push(`${o}${e}`)},onTrack:(e,t)=>{e===`explore_action`?vn({action:t.action,source:_o.LINEAGE_VIEW_CONTEXT_MENU,node_count:t.node_count}):e===`lineage_selection`&&xn({action:t.action})},supportsHistogramDiff:mt,findByRunType:e=>{let t=Ut(e);return t?{title:t.title,icon:t.icon}:void 0},setSqlQuery:n,setPrimaryKeys:r,getPrimaryKey:()=>a,DisabledItemWrapper:$c}},zo=({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}=ue(),{featureToggles:f}=ce(),{isActionAvailable:p,lineageGraph:m}=L(),{data:h}=me(),g=!m?.catalogMetadata.current;return K(So,{x:n,y:r,node:i,isOpen:e,onClose:t,deps:Ro(i?.type===`lineageGraphNode`?i.data?.name:i?.type===`lineageGraphColumnNode`?i.data?.node?.name:void 0),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})},Bo=Co;function Vo(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:Ce(l.change_status)},style:{zIndex:9999},type:`lineageGraphColumnNode`,targetPosition:Hr.Left,sourcePosition:Hr.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:Hr.Left,sourcePosition:Hr.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&&Ho(n,r,c,a,f),n.some(e=>e.type===`lineageGraphNode`&&!o?.has(e.id))&&Uo(n,r),[n,r,l]}function Ho(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:Hr.Left,sourcePosition:Hr.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?et.impacted:et.unchanged}})}}}const Uo=(e,t,n=`LR`)=>{de(Yi,e,t,n)};function Wo(){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 Go({current:e,showMenu:t=!0},n){let r=he(),[i,a]=W(null),[o,s]=W(new Map),{columns:c,rows:l}=U(()=>Oe({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;fn({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=V(t=>`${e?.id}-${t.data.name}`,[e?.id]),y=r?.viewOptions.column_level_lineage,b=y?`${y.node_id}-${y.column}`:null;H(()=>{if(i&&(i.deselectAll(),b)){let e=i.getRowNode(b);e&&e.setSelected(!0)}},[i,b]);let x=V(e=>{a(e.api)},[]);return q(J,{sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:[m?K(ei,{severity:`warning`,sx:{fontSize:`12px`,p:1},children:m}):g?K(ei,{severity:`warning`,sx:{fontSize:`12px`,p:1},children:g}):K(G,{}),l.length>0&&K(Rt,{style:{blockSize:`auto`,maxHeight:`100%`,overflow:`auto`,fontSize:`10pt`,borderWidth:1},columns:c,rows:l,renderers:{noRowsFallback:K(st,{})},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 Ko({base:e,current:t,showMenu:n=!0,columnChanges:r,onViewCode:i,headerAction:a},o){let s=he(),{data:c}=me(),l=c?.new_cll_experience??!1,[u,d]=W(null),[f,p]=W(new Map),m=U(()=>{if(!l)return;let e=s?.impactedColumnIds;return e?.size?e:void 0},[l,s?.impactedColumnIds]),{columns:h,rows:g}=U(()=>{let a=t?.resource_type??e?.resource_type,o=a&&[`model`,`seed`,`snapshot`,`source`].includes(a)?t??e:void 0,s=t?.id??e?.id;return Oe({type:`schema_diff`,base:e?.columns,current:t?.columns},{node:o,cllRunningMap:f,showMenu:n,columnChanges:r,onViewCode:i,impactedColumns:m,nodeId:s})},[e,t,f,n,r,i,m]),{lineageGraph:_,isActionAvailable:v}=L(),y=v(`change_analysis`),b=!_?.catalogMetadata.base,x=!_?.catalogMetadata.current,S;b&&x?S="catalog.json not found on both environments. Run `recce debug` to troubleshoot.":b?S="catalog.json not found on base environment. Run `recce debug` to troubleshoot.":x&&(S="catalog.json not found on current environment. Run `recce debug` to troubleshoot.");let C=e&&e.columns===void 0,w=t&&t.columns===void 0,T;C&&w?T=`Node schema not found in catalog.json on both environments. Please regenerate your catalog.json to update.`:w?T=`Node schema not found in catalog.json on current environment. Please regenerate your catalog.json to update.`:C&&(T=`Node schema not found in catalog.json on base environment. Please regenerate your catalog.json to update.`);let E=async n=>{if(!y)return;fn({action:`view`,source:`schema_column`}),p(e=>new Map(e).set(n,!0));let r=t?.id??e?.id;r&&await s?.showColumnLevelLineage({node_id:r,column:n}),p(e=>new Map(e).set(n,!1))},D=V(n=>`${t?.id??e?.id}-${n.data.name}`,[t?.id,e?.id]),O=s?.viewOptions.column_level_lineage,k=O?`${O.node_id}-${O.column}`:null;H(()=>{if(u&&(u.deselectAll(),k)){let e=u.getRowNode(k);e&&e.setSelected(!0)}},[u,k]);let ee=V(e=>{d(e.api)},[]);return q(J,{sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:[S?K(ei,{severity:`warning`,sx:{fontSize:`12px`,p:1},children:S}):T?K(ei,{severity:`warning`,sx:{fontSize:`12px`,p:1},children:T}):K(G,{}),q(X,{direction:`row`,sx:{alignItems:`center`,justifyContent:`space-between`,gap:1,pr:1},children:[K(Wo,{}),a]}),g.length>0&&K(Rt,{style:{blockSize:`auto`,maxHeight:`100%`,overflow:`auto`,fontSize:`0.8rem`,borderWidth:1},columns:h,rows:g,rowHeight:35,renderers:{noRowsFallback:K(st,{})},className:`rdg-light no-track-pii-safe${l?` cll-experience`:``}`,ref:o,getRowId:D,getRowClass:e=>{let t=e.data;if(!t)return`row-normal`;let n;if(t.baseIndex===void 0)n=`row-added`;else if(t.currentIndex===void 0)return`row-removed`;else n=t.baseType!==t.currentType||t.reordered===!0||t.definitionChanged===!0||t.changeUnknown===!0?`row-changed`:t.isImpacted?`row-impacted`:`row-normal`;return s!==void 0&&y&&(n+=` row-selectable`),n},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 E(t.name))},onGridReady:ee,rowSelection:{mode:`singleRow`,checkboxes:!1},containerClassName:`no-track-pii-safe`,rowClassName:`no-track-pii-safe`})]})}const qo=Rn(Ko),Jo=Rn(Go);function Yo(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 Xo={light:`rgb(252 211 77 / 0.18)`,dark:`rgb(252 211 77 / 0.10)`};function Zo(e){return e?qe.dark:qe.light}function Qo(e){return e?.data.changeStatus??`unchanged`}function $o(e,t){return e===`unchanged`&&t?`impacted`:e}function es(e){return e===`impacted`?et.impacted:Bt[e]}function ts(e,t){return t?.[e]?.data.name??e}function ns(e,t,n){let r=t.trim().toLowerCase();return r?e.filter(e=>ts(e,n).toLowerCase().includes(r)):e}function rs(e,t){return e?`Show all models`:t?`Show only impacting models`:`Show only impacted models`}function is({status:e,cllImpacted:t}){let n=$o(e,t);return K(J,{component:`span`,"data-testid":`lineage-status-dot`,"data-status":n,sx:{width:`8px`,height:`8px`,borderRadius:`2px`,backgroundColor:es(n),flex:`0 0 auto`}})}function as({name:e,status:t,direction:n,decorateAsImpacted:r,dotImpacted:i,onClick:a}){let{isDark:o}=Ft(),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?Xo.dark:Xo.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:et.impacted}}),K(is,{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:Zo(o),flex:`0 0 auto`},children:K(Ei,{size:12})})})]})}function os({isDark:e,active:t}){return t?Le.dark:e?Ie.dark:Ie.light}function ss({isDark:e,active:t}){return t?`#fff`:e?qe.dark:qe.light}const cs={display:`inline-flex`,alignItems:`center`,gap:`4px`,ml:.75,px:`7px`,py:`1px`,borderRadius:`999px`,fontSize:`10px`,fontWeight:600,letterSpacing:`0.02em`};function ls({color:e}){return K(J,{component:`span`,"aria-hidden":`true`,sx:{width:`5px`,height:`5px`,borderRadius:`50%`,backgroundColor:e}})}function us({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:{...cs,backgroundColor:os(a),color:ss(a),border:`none`,font:`inherit`,cursor:`pointer`,"&:hover":{filter:n?`brightness(0.95)`:`brightness(0.97)`}},children:[K(ls,{color:ss(a)}),e]})})}function ds({direction:e,directCount:t,impactCount:n,onlyImpact:r,onToggleOnlyImpact:i}){let a=e===`up`,o=a?Di:Ei,{isDark:s,background:c}=Ft(),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(us,{label:d,title:rs(r,a),active:r,isDark:s,onClick:i})]})}function fs({label:e}){return K(J,{sx:{px:1.5,py:1,fontSize:`11px`,color:`text.disabled`,fontStyle:`italic`},children:e})}function ps({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(Ai,{size:12,color:`currentColor`,opacity:.55}),K(ti,{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 ms({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 hs({node:e,onCenterFocus:t,cllImpacted:n}){let r=$o(Qo(e),n),{isDark:i,background:a}=Ft(),o=es(r),s=r===`impacted`?Zo(i):o,c=r===`impacted`?Zo(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(Oi,{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 gs({previousName:e,currentName:t,onJumpBack:n}){let{isDark:r}=Ft();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 _s({node:e,nodesById:t,onNavigate:n,onBack:r,onCenterFocus:i,historyTrail:a,onJumpToHistory:o,impactingNodeIds:s,impactedNodeIds:c}){let{background:l}=Ft(),[u,d]=W(``),[f,p]=W(``),[m,h]=W(8),[g,_]=W(8),[v,y]=W(!1),[b,x]=W(!1);H(()=>{d(``),p(``),h(8),_(8),y(!1),x(!1)},[e.id]);let S=U(()=>Object.keys(e.data.parents??{}),[e.data.parents]),C=U(()=>Object.keys(e.data.children??{}),[e.data.children]),w=U(()=>ns(S,u,t),[S,u,t]),T=U(()=>ns(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,ee=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,ee=r?`(source — no upstream)`:`(leaf — no downstream)`;return q(G,{children:[E&&K(ps,{direction:e,query:s,onChange:e=>{l(e),x(8)}}),i.length===0?K(fs,{label:ee}):o.length===0?K(fs,{label:`no matches`}):O.map(r=>K(as,{name:ts(r,t),status:Qo(t?.[r]),direction:e,decorateAsImpacted:D(r,e),dotImpacted:c?.has(r)??!1,onClick:n?()=>n(r):void 0},`${e}-${r}`)),k>0&&K(ms,{hidden:k,onClick:()=>x(e=>Math.min(o.length,e+20))})]})},A=(a?.length??0)>0;return q(J,{sx:{height:`100%`,display:`flex`,flexDirection:`column`,backgroundColor:`background.paper`},"data-testid":`lineage-tab-content`,children:[(!!r||A)&&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(Ti,{size:14})})}),A&&a?K(gs,{previousName:ts(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(ds,{direction:`up`,directCount:S.length,impactCount:O,onlyImpact:v,onToggleOnlyImpact:()=>{y(e=>!e),h(8)}}),ee(`up`),K(hs,{node:e,onCenterFocus:i,cllImpacted:c?.has(e.id)??!1}),K(ds,{direction:`down`,directCount:C.length,impactCount:k,onlyImpact:b,onToggleOnlyImpact:()=>{x(e=>!e),_(8)}}),ee(`down`)]})]})}const vs=({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(cr,{})}),q(Wn,{open:o,onClose:()=>s(!1),maxWidth:`sm`,fullWidth:!0,slotProps:{paper:{sx:{height:`75%`,overflowY:`auto`}}},children:[q(qn,{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(nr,{})})]}),K(Kn,{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`})})]})]})},ys=({node:e})=>{let{data:t,isLoading:n}=me(),r=qt(),{apiClient:i}=R(),a=e.data.resourceType,o=a===`model`||a===`snapshot`,{data:s,isLoading:c}=Pn({queryKey:[`modelDetail`,e.id],queryFn:()=>u(e.id,i),enabled:o&&!!i,staleTime:300*1e3,retry:1});return n?K(G,{}):o&&c?K(J,{"aria-label":`Loading model code`,sx:{p:2,height:`100%`},"data-testid":`node-sql-view-loading`,children:K(Xi,{variant:`rectangular`,height:`100%`,animation:`wave`})}):K(vs,{node:e,modelDetail:s?.model,isSingleEnv:t?.single_env_onboarding??!1,CodeEditor:nt,DiffEditor:vt,isDark:r})};function bs({rowCount:e}){return`base`in e?K(Ss,{rowCount:e}):K(`span`,{children:xs(e.curr)})}function xs(e){return e===null?`N/A`:`${e.toLocaleString()} ${e===1?`row`:`rows`}`}function Ss({rowCount:e}){let t=e.base,n=e.curr,r=xs(t),i=xs(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(Fi,{}),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(Ui,{})}),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(Vi,{})}),K(Z,{variant:`body2`,component:`span`,sx:{color:`success.main`},children:Qt(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(Bi,{})}),K(Z,{variant:`body2`,component:`span`,sx:{color:`error.main`},children:Qt(t,n)})]})}function Cs({rowCount:e,node:t,onRefresh:n,isFetching:r}){let i=qt(),{featureToggles:a}=ce(),{runsAggregated:o}=L(),s=o?.[t.id]?.row_count_diff.result,c=Ut(`row_count_diff`).icon,l=e??s,u=l;return K($,{title:l?`${l.base??`N/A`} -> ${l.curr??`N/A`} rows`:``,children:K($c,{display:a.mode===`metadata only`,children:q(J,{component:`span`,sx:{...kt(i),gap:.5},children:[K(c,{}),u!=null||r?r?K(Xi,{width:30,height:16}):u==null?K(Z,{variant:`caption`,children:`row count`}):K(Ss,{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(Or,{size:12})})]})})})}function ws({rowCount:e,node:t,onRefresh:n,isFetching:r}){let i=qt(),{runsAggregated:a}=L(),o=a?.[t.id]?.row_count.result,s=Ut(`row_count`).icon,c,l=e??o;return l&&(c=`${l.curr??`N/A`} rows`),q(J,{component:`span`,sx:kt(i),children:[K(J,{component:`span`,sx:Mt,children:K(s,{})}),l||r?r?K(Xi,{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(Or,{size:12})})]})}function Ts({children:e,value:t,index:n}){return t===n?K(G,{children:e}):null}const Es=()=>K(`span`,{}),Ds=({children:e})=>K(G,{children:e}),Os=()=>!0;function ks(e,t,n){return e?An.add_or_remove:n(t)?``:`This action is not supported yet.`}function As({node:e,actionCallbacks:t,runTypeIcons:n,isActionAvailable:r,rowCountDisplay:i}){let a=e.data.changeStatus===`added`||e.data.changeStatus===`removed`,o=n?.query??Es,s=n?.row_count??Es,c=n?.profile??Es;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:ks(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 js({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 Ms({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??Es,u=n?.row_count_diff??Es,d=n?.profile_diff??Es,f=n?.value_diff??Es,p=n?.top_k_diff??Es,m=n?.histogram_diff??Es,h=(e,t)=>s?K(a,{display:!0,children:e}):K($,{title:ks(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 Ns({node:e,onCloseNode:t,isSingleEnv:n,featureToggles:r,modelDetail:i,lineageTabContent:a,SchemaView:o,SingleEnvSchemaView:s,NodeSqlView:c,ResourceTypeTag:l,NotificationComponent:u,ConnectionPopoverWrapper:d=Ds,runTypeIcons:f,actionCallbacks:p,isActionAvailable:m=Os,isWholeModelChanged:h=!1,isWholeModelImpacted:g=!1,wholeModelImpact:_=!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`,ee=!n&&k&&p?.onAddSchemaDiffClick!=null,A=f?.schema_diff??Es,{isDark:j}=Ft(),M={wholeModelImpact:_,isWholeModelChanged:h,isWholeModelImpacted:g,isImpacted:v,changeCategory:e.data.change?.category},N=At(M,j),te=ct({name:e.data.name,resourceType:e.data.resourceType,materialized:e.data.materialized},M);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:te,placement:`top`,children:N?K(dt,{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})}),K(Q,{size:`small`,onClick:t,sx:{flexShrink:0},children:K(nr,{})})]}),k&&K(J,{sx:{pl:2,py:1},children:n?K(As,{node:e,actionCallbacks:p,runTypeIcons:f,isActionAvailable:m,rowCountDisplay:y}):K(Ms,{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(_i,{value:C,onChange:(e,t)=>w(t),sx:{borderBottom:1,borderColor:`divider`},children:[K(gi,{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(gi,{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(gi,{label:`Lineage`})]}),q(J,{sx:{overflow:`auto`,height:`calc(100% - 48px)`},children:[K(Ts,{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:ee?K(js,{onClick:p?.onAddSchemaDiffClick,Icon:A}):void 0})})}),K(Ts,{value:C,index:1,children:K(J,{sx:{height:`100%`},children:c&&K(c,{node:e})})}),a&&K(Ts,{value:C,index:2,children:K(J,{sx:{height:`100%`},children:a})})]})]})]})}const Ps=({node:e})=>K(It,{resourceType:e.data.resourceType,materialized:e.data.materialized});function Fs({onClose:e}){return K(Ae,{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(Ct,{})]})})}function Is({node:e,onCloseNode:t,onNavigateToNode:n,onBack:r,onCenterFocused:i,historyTrail:a,onJumpToHistory:o}){let s=Ci(),{runAction:c}=_e(),{isActionAvailable:l,envInfo:d,lineageGraph:f}=L(),p=he(),{impactingNodeIds:m,impactedNodeIds:h}=U(()=>Yo(p?.cll),[p?.cll]),{singleEnv:g,featureToggles:v}=ce(),{setSqlQuery:y,setPrimaryKeys:b}=lt(),{primaryKey:x}=yt(e.data.name),{apiClient:S}=R(),{basePath:C}=F(),{runsAggregated:w}=L(),T=g??!1,E=U(()=>{let t=w?.[e.id],n=T?t?.row_count?.result:t?.row_count_diff?.result;return n?K(bs,{rowCount:n}):void 0},[w,e.id,T]),{data:D}=Pn({queryKey:[`modelDetail`,e.id],queryFn:()=>u(e.id,S),enabled:!!S,staleTime:300*1e3}),O=D?.model,k=U(()=>({query:Ut(`query`).icon,row_count:Ut(`row_count`).icon,row_count_diff:Ut(`row_count_diff`).icon,profile:Ut(`profile`).icon,profile_diff:Ut(`profile_diff`).icon,query_diff:Ut(`query_diff`).icon,value_diff:Ut(`value_diff`).icon,top_k_diff:Ut(`top_k_diff`).icon,histogram_diff:Ut(`histogram_diff`).icon,schema_diff:Ut(`schema_diff`).icon}),[]),ee=$t(Object.keys(O?.base?.columns??{}),Object.keys(O?.current?.columns??{})),A=U(()=>ee.length?`select \n ${ee.join(`
|
|
6
|
+
`)}\nfrom {{ ref("${e.data.name}") }}`:`select * from {{ ref("${e.data.name}") }}`,[ee,e.data.name]),j=U(()=>({onQueryClick:()=>{d?.adapterType===`dbt`?y(A):d?.adapterType===`sqlmesh`&&y(`select * from ${e.data.name}`),s.push(`${C}/query`)},onRowCountClick:()=>{vn({action:ln.ROW_COUNT,source:un.SCHEMA_ROW_COUNT_BUTTON,node_count:1}),c(`row_count`,{node_names:[e.data.name]},{showForm:!1,showLast:!1})},onRowCountDiffClick:()=>{vn({action:ln.ROW_COUNT_DIFF,source:un.SCHEMA_ROW_COUNT_BUTTON,node_count:1}),c(`row_count_diff`,{node_names:[e.data.name]},{showForm:!1,showLast:!1})},onProfileClick:()=>{vn({action:ln.PROFILE,source:un.NODE_SIDEBAR_SINGLE_ENV,node_count:1}),c(`profile`,{model:e.data.name},{showForm:!0,showLast:!1})},onProfileDiffClick:()=>{vn({action:ln.PROFILE_DIFF,source:un.NODE_SIDEBAR_MULTI_ENV,node_count:1}),c(`profile_diff`,{model:e.data.name},{showForm:!0,showLast:!1})},onQueryDiffClick:()=>{d?.adapterType===`dbt`?y(A):d?.adapterType===`sqlmesh`&&y(`select * from ${e.data.name}`),l(`query_diff_with_primary_key`)&&b(x===void 0?void 0:[x]),s.push(`${C}/query`)},onValueDiffClick:()=>{vn({action:ln.VALUE_DIFF,source:un.NODE_SIDEBAR_MULTI_ENV,node_count:1}),c(`value_diff`,{model:e.data.name},{showForm:!0,showLast:!1})},onTopKDiffClick:()=>{vn({action:ln.TOP_K_DIFF,source:un.NODE_SIDEBAR_MULTI_ENV,node_count:1}),c(`top_k_diff`,{model:e.data.name,column_name:``,k:50},{showForm:!0})},onHistogramDiffClick:()=>{vn({action:ln.HISTOGRAM_DIFF,source:un.NODE_SIDEBAR_MULTI_ENV,node_count:1}),c(`histogram_diff`,{model:e.data.name,column_name:``,column_type:``},{showForm:!0})},onAddSchemaDiffClick:async()=>{let t=await _({node_id:e.id},S);s.push(`${C}/checks/?id=${t.check_id}`)}}),[e,A,d,y,c,l,b,x,S,s.push,C]),M=p?Nt(e.id,p):{isWholeModelChanged:!1,isWholeModelImpacted:!1};return K(Ns,{node:e,onCloseNode:t,isSingleEnv:T,featureToggles:v,isWholeModelChanged:M.isWholeModelChanged,isWholeModelImpacted:M.isWholeModelImpacted,wholeModelImpact:p?.wholeModelImpact??!1,isImpacted:h?.has(e.id)??!1,modelDetail:(()=>{if(!O)return;let t=!!O.base&&Object.keys(O.base).length>0,n=!!O.current&&Object.keys(O.current).length>0;if(!(!t&&!n))return{base:t?{id:e.id,unique_id:e.id,name:e.data.name,resource_type:e.data.resourceType,package_name:e.data.packageName,...O.base}:void 0,current:n?{id:e.id,unique_id:e.id,name:e.data.name,resource_type:e.data.resourceType,package_name:e.data.packageName,...O.current}:void 0}})(),SchemaView:qo,SingleEnvSchemaView:Jo,NodeSqlView:ys,ResourceTypeTag:Ps,rowCountDisplay:E,NotificationComponent:Fs,ConnectionPopoverWrapper:$c,runTypeIcons:k,actionCallbacks:j,isActionAvailable:l,lineageTabContent:n?K(_s,{node:e,nodesById:f?.nodes,onNavigate:n,onBack:r,onCenterFocus:i,historyTrail:a,onJumpToHistory:o,impactingNodeIds:m,impactedNodeIds:h}):void 0})}function Ls(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 Rs({featureToggles:e,settingsUrl:t}){return e.mode===`metadata only`?K(J,{sx:{display:`flex`,alignItems:`center`,width:`100%`,px:1,py:.25,bgcolor:`cyan.50`},children:q(X,{direction:`row`,spacing:1,sx:{alignItems:`center`,flex:1,fontSize:`0.875rem`,color:`cyan.600`},children:[K(J,{component:xr}),K(Z,{sx:{fontSize:`inherit`,color:`inherit`},children:`Query functions disabled without a data warehouse connection.`}),K(Y,{sx:{bgcolor:`iochmara.400`},size:`small`,variant:`contained`,onClick:()=>{window.open(t,`_blank`)},children:`Connect to Data Warehouse`})]})}):null}function zs(e){let{featureToggles:t}=ce(),{data:n}=se();return K(Rs,{featureToggles:e.featureToggles??t,settingsUrl:e.settingsUrl??nn(n,cn)})}function Bs({docsUrl:e=`https://docs.reccehq.com/get-started/#prepare-dbt-artifacts`,onStartClick:t}={}){return K(X,{sx:{flex:1,height:`100%`,minHeight:0,m:1,p:2,bgcolor:`iochmara.50`,borderRadius:2,boxShadow:2,justifyContent:`center`},children:q(X,{sx:{alignSelf:`center`,width:`80%`,overflowY:`auto`,gap:3,px:4,pb:4},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:Wi,sx:{fontSize:28,color:`iochmara.500`}})}),K(Z,{variant:`h5`,sx:{mt:2},children:`Wait, there's more!`}),q(Z,{sx:{textAlign:`center`},children:[`Recce is currently running in`,` `,K(Z,{component:`span`,sx:{fontWeight:`bold`},children:`limited functionality mode`}),` `,`so you can run queries but`,` `,K(Z,{component:`span`,sx:{fontWeight:`bold`},children:`can't diff the results yet!`})]})]}),q(X,{spacing:1,children:[K(Z,{children:`To unlock the full power of Recce, set up a base environment of dbt artifacts for comparison.`}),K(Z,{children:`Once configured, you'll be able to:`}),q(vi,{sx:{listStyleType:`disc`,pl:2},children:[K(yi,{sx:{display:`list-item`,p:0},children:K(Z,{children:`Run statistical data diffs`})}),K(yi,{sx:{display:`list-item`,p:0},children:K(Z,{children:`Run query diffs`})}),K(yi,{sx:{display:`list-item`,p:0},children:K(Z,{children:`Save checks to your Recce Checklist`})}),K(yi,{sx:{display:`list-item`,p:0},children:K(Z,{children:`...and more!`})})]}),K(Z,{children:`Take the next step toward better data impact assessment.`})]}),K(X,{sx:{width:`100%`,mt:3},children:K(Y,{color:`iochmara`,variant:`contained`,size:`large`,onClick:()=>{t?t():window.open(e,`_blank`)},children:`Start Now`})})]})})}function Vs({docsUrl:e=`https://docs.reccehq.com/configure-diff/`}={}){return q(X,{direction:`row`,spacing:`10px`,sx:{alignItems:`flex-start`},children:[K(J,{component:Hi,sx:{color:`iochmara.main`,fontSize:20}}),q(X,{spacing:`5px`,children:[q(Z,{sx:{fontWeight:700},children:[`Single Environment Mode`,` `,K(Z,{component:`span`,sx:{color:`error.main`,fontWeight:600},children:`Limited Functionality`})]}),K(Z,{sx:{fontSize:`0.875rem`},children:`Single Environment Mode allows you to explore your dbt project but won't show data comparisons between environments.`}),K(Z,{sx:{fontSize:`0.875rem`},children:`To set up full environment comparison:`}),q(vi,{sx:{pl:2},children:[K(yi,{sx:{p:0,display:`list-item`},children:K(Z,{sx:{fontSize:`0.875rem`},children:"Run `recce debug` for setup assistance"})}),K(yi,{sx:{p:0,display:`list-item`},children:q(Z,{sx:{fontSize:`0.875rem`},children:[`Visit`,` `,K(Jn,{sx:{color:`primary.main`,fontWeight:500},target:`_blank`,href:e,children:`docs`}),` `,`for configuration details`]})})]})]})]})}function Hs(){return K(J,{sx:{width:`100%`,height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:K(or,{size:48})})}function Us({error:e,onRetry:t}){return K(J,{sx:{height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:q(X,{spacing:1,sx:{alignItems:`center`},children:[K(J,{children:`Failed to load lineage data. This could be because the server has been terminated or there is a network error.`}),q(J,{children:[`[Reason: `,e,`]`]}),K(Y,{color:`iochmara`,variant:`contained`,onClick:()=>{t&&t()},children:`Retry`})]})})}function Ws({viewOptions:e,onViewOptionsChanged:t}){return K(J,{sx:{height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:q(X,{spacing:1,sx:{alignItems:`center`},children:[K(G,{children:`No change detected`}),K(Y,{color:`iochmara`,variant:`contained`,onClick:async()=>{await t({...e,view_mode:`all`})},children:`Show all nodes`})]})})}function Gs(){let{isHistoryOpen:e,showHistory:t}=_e();if(!e)return q(J,{children:[K(J,{sx:{fontSize:`8pt`},children:`History`}),K(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,startIcon:K(si,{}),onClick:()=>{yn({name:e?`hide`:`show`}),t()},children:`Show`})]})}const Ks=e=>({fontSize:`8pt`,bgcolor:e?`grey.700`:`grey.100`,px:.5,borderRadius:1}),qs=()=>{let e=Ks(qt());return q(X,{spacing:0,sx:{alignItems:`flex-start`},children:[K(Z,{sx:{fontSize:`10pt`,color:`text.secondary`,pb:1},children:`Select nodes by dbt node selector syntax`}),q(Z,{sx:{fontSize:`8pt`},children:[K(J,{component:`code`,sx:e,children:`model_name`}),` `,`Select a node`]}),q(Z,{sx:{fontSize:`8pt`},children:[K(J,{component:`code`,sx:e,children:`model_name+`}),` `,`Select downstream nodes`]}),q(Z,{sx:{fontSize:`8pt`},children:[K(J,{component:`code`,sx:e,children:`+model_name`}),` `,`Select upstream nodes`]}),q(Z,{sx:{fontSize:`8pt`},children:[K(J,{component:`code`,sx:e,children:`model*`}),` `,`Select by wildcard`]})]})},Js=({isDisabled:e,viewOptions:t,onViewOptionsChanged:n})=>{let[r,i]=W(null),a=!!r,o=t.view_mode??`changed_models`,s=o===`changed_models`?`Changed Models`:`All`,c=e=>{i(e.currentTarget)},l=()=>{i(null)},u=e=>{n({...t,view_mode:e}),l()},d=je(`model`).icon;return q(G,{children:[K(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,onClick:c,disabled:e,startIcon:d&&K(d,{}),endIcon:K(hr,{}),sx:{minWidth:100,textTransform:`none`,fontSize:`0.75rem`},children:s}),q(ni,{anchorEl:r,open:a,onClose:l,children:[K(li,{sx:{lineHeight:`32px`,bgcolor:`transparent`},children:`mode`}),q(Qi,{value:o,children:[K(ri,{onClick:()=>u(`changed_models`),children:K($r,{value:`changed_models`,control:K(Zi,{size:`small`,sx:{py:0}}),label:`Changed Models`,sx:{m:0}})}),K(ri,{onClick:()=>u(`all`),children:K($r,{value:`all`,control:K(Zi,{size:`small`,sx:{py:0}}),label:`All`,sx:{m:0}})})]})]})]})},Ys=({isDisabled:e,viewOptions:t,onViewOptionsChanged:n,lineageGraph:r})=>{let[i,a]=W(null),o=!!i,s=new Set,c=Object.values(r?.nodes??{});for(let e of c)e.data.packageName&&s.add(e.data.packageName);let l=r?.manifestMetadata.current?.project_name,u=t.packages?new Set(t.packages):l?new Set([l]):s,d=u.size===s.size,f=u.size===0,p=u.size===1?Array.from(u)[0]:d?`All Packages`:f?`No Package`:`${u.size} Packages`,m=e=>{a(e.currentTarget)},h=()=>{a(null)},g=()=>{n(d?{...t,packages:[]}:{...t,packages:Array.from(s)})},_=e=>{let r=new Set(u);r.has(e)?r.delete(e):r.add(e),n({...t,packages:Array.from(r)})};return q(G,{children:[K(Y,{size:`xsmall`,variant:`outlined`,color:`neutral`,onClick:m,disabled:e,startIcon:K(Ri,{}),endIcon:K(hr,{}),sx:{minWidth:100,textTransform:`none`,fontSize:`0.75rem`},children:p}),q(ni,{anchorEl:i,open:o,onClose:h,children:[K(li,{sx:{lineHeight:`32px`,bgcolor:`transparent`},children:`Select Packages`}),q(ri,{onClick:g,children:[K(Qr,{checked:d,indeterminate:!d&&!f,size:`small`,sx:{py:0}}),K(Pi,{children:`Select All`})]}),K(ar,{}),Array.from(s).map(e=>q(ri,{onClick:()=>_(e),children:[K(Qr,{checked:u.has(e),size:`small`,sx:{py:0}}),K(Pi,{className:`no-track-pii-safe`,children:e})]},e))]})]})},Xs=({value:e,onChange:t,isDisabled:n,tooltipComponent:r,showTooltip:i=!0})=>{let[a,o]=W(e),s=Un(null);return H(()=>{s.current&&(s.current.value=e)},[e]),K($,{title:i?r:``,placement:`bottom-start`,slotProps:{tooltip:{sx:{width:`18.75rem`,p:2,boxShadow:3,border:1,borderRadius:1,color:`text.primary`,bgcolor:`background.paper`}}},children:K(pi,{inputRef:s,size:`small`,placeholder:`with selectors`,disabled:n,value:a,onChange:e=>{o(e.target.value)},onKeyUp:n=>{n.key===`Enter`?t(a):n.key===`Escape`&&(n.preventDefault(),o(e),s.current&&s.current.blur())},onBlur:()=>{o(e)},sx:{"& .MuiInputBase-root":{width:`18.75rem`,height:24,fontSize:`0.75rem`},"& .MuiInputBase-input":{py:.5,px:1}}})})},Zs=({isDisabled:e,viewOptions:t,onViewOptionsChanged:n,showTooltip:r})=>K(Xs,{isDisabled:e,value:t.select??``,onChange:e=>{n({...t,select:e||void 0})},tooltipComponent:K(qs,{}),showTooltip:r}),Qs=({isDisabled:e,viewOptions:t,onViewOptionsChanged:n})=>K(Xs,{isDisabled:e,value:t.exclude??``,onChange:e=>{n({...t,exclude:e||void 0})}}),$s=({label:e,children:t,style:n})=>q(J,{style:n,sx:{maxWidth:300},children:[K(Z,{sx:{fontSize:`8pt`},children:(e??``).trim()||K(G,{children:`\xA0`})}),t]}),ec=({children:e})=>K(G,{children:e}),tc=({viewOptions:e,onViewOptionsChanged:t,lineageGraph:n,featureToggles:r,serverFlags:i,focusedNode:a,selectedNodes:o,onDeselect:s,onRunRowCount:c,onRunRowCountDiff:l,onRunValueDiff:u,onAddLineageDiffCheck:d,onAddSchemaDiffCheck:f,runTypeIcons:p,historyToggleSlot:m,SetupConnectionPopoverSlot:h=ec})=>{let g=i?.single_env_onboarding,[_,v]=W(null),y=!!_,b=o.length>0,x=b,S=e=>{v(e.currentTarget)},C=()=>{v(null)},w=p.rowCountDiff,T=p.valueDiff,E=p.lineageDiff,D=p.schemaDiff;return K(X,{direction:`row`,sx:{alignItems:`center`,borderBottom:1,borderColor:`neutral.light`,width:`100%`,p:`4pt 8pt`,gap:`0.5rem`},children:q(X,{direction:`row`,sx:{alignItems:`center`,flex:1,gap:`0.5rem`},children:[m,K($s,{label:`Mode`,style:{flexShrink:1},children:K(Js,{isDisabled:x,viewOptions:e,onViewOptionsChanged:t})}),K($s,{label:`Package`,style:{flexShrink:1},children:K(Ys,{isDisabled:x,viewOptions:e,onViewOptionsChanged:t,lineageGraph:n})}),K($s,{label:`Select`,style:{flexShrink:1},children:K(Zs,{isDisabled:x,viewOptions:e,onViewOptionsChanged:t,showTooltip:g})}),K($s,{label:`Exclude`,style:{flexShrink:1},children:K(Qs,{isDisabled:x,viewOptions:e,onViewOptionsChanged:t})}),K(J,{sx:{flexGrow:1}}),b&&q(G,{children:[K($s,{label:``,style:{flexShrink:0},children:K(Z,{sx:{fontSize:`9pt`,color:`text.secondary`},children:o.length>1?`${o.length} nodes selected`:`${o.length} node selected`})}),K($s,{label:``,children:K(Y,{variant:`outlined`,color:`neutral`,size:`xsmall`,onClick:()=>{s()},sx:{textTransform:`none`,fontSize:`9pt`},children:`Deselect`})}),g&&K($s,{label:`Explore`,children:q(J,{sx:{display:`inline-flex`},children:[K(Y,{size:`xsmall`,color:`neutral`,variant:`outlined`,onClick:S,endIcon:K(hr,{}),sx:{textTransform:`none`,fontSize:`0.75rem`},children:`Actions`}),K(ni,{anchorEl:_,open:y,onClose:C,anchorOrigin:{vertical:`bottom`,horizontal:`right`},transformOrigin:{vertical:`top`,horizontal:`right`},children:q(ri,{disabled:r.disableDatabaseQuery,onClick:async()=>{await c?.(),C()},children:[K(Ni,{children:K(w,{fontSize:`small`})}),K(Pi,{children:`Row Count`})]})})]})})]}),!g&&K($s,{label:`Explore`,children:q(J,{sx:{display:`inline-flex`},children:[K(Y,{size:`xsmall`,color:`neutral`,variant:`outlined`,disabled:r.disableViewActionDropdown,onClick:S,endIcon:K(hr,{}),sx:{textTransform:`none`,fontSize:`0.75rem`},children:`Actions`}),q(ni,{anchorEl:_,open:y,onClose:C,anchorOrigin:{vertical:`bottom`,horizontal:`right`},transformOrigin:{vertical:`top`,horizontal:`right`},children:[K(li,{sx:{lineHeight:`32px`,bgcolor:`transparent`},children:`Diff`}),K(h,{display:r.mode===`metadata only`,children:q(ri,{disabled:r.disableDatabaseQuery,onClick:async()=>{await l?.(),C()},children:[K(Ni,{children:K(w,{fontSize:`small`})}),K(Pi,{children:`Row Count Diff`})]})}),K(h,{display:r.mode===`metadata only`,children:q(ri,{disabled:r.disableDatabaseQuery,onClick:async()=>{await u?.(),C()},children:[K(Ni,{children:K(T,{fontSize:`small`})}),K(Pi,{children:`Value Diff`})]})}),(!r.disableUpdateChecklist||r.checklistPermissionDenied)&&[K(ar,{},`checklist-divider`),K(li,{sx:{lineHeight:`32px`,bgcolor:`transparent`},children:`Add to Checklist`},`checklist-header`),K($,{title:r.checklistPermissionDenied?`You don't have permission to add checks`:``,placement:`left`,children:K(`span`,{children:q(ri,{disabled:r.checklistPermissionDenied,onClick:()=>{r.checklistPermissionDenied||(d?.(e.view_mode),C())},children:[K(Ni,{children:K(E,{fontSize:`small`})}),K(Pi,{children:`Lineage Diff`})]})})},`add-lineage-diff`),K($,{title:r.checklistPermissionDenied?`You don't have permission to add checks`:``,placement:`left`,children:K(`span`,{children:q(ri,{disabled:r.checklistPermissionDenied,onClick:()=>{r.checklistPermissionDenied||(f?.(),C())},children:[K(Ni,{children:K(D,{fontSize:`small`})}),K(Pi,{children:`Schema Diff`})]})})},`add-schema-diff`)]]})]})})]})})},nc=({display:e,children:t})=>K($c,{display:e,children:t}),rc=()=>{let{deselect:e,focusedNode:t,selectedNodes:n,viewOptions:r,onViewOptionsChanged:i,runRowCount:a,runRowCountDiff:o,runValueDiff:s,addLineageDiffCheck:c,addSchemaDiffCheck:l}=ue(),{lineageGraph:u}=L(),{featureToggles:d}=ce(),{data:f}=me();return K(tc,{viewOptions:r,onViewOptionsChanged:i,lineageGraph:u,featureToggles:d,serverFlags:f,focusedNode:t,selectedNodes:n,onDeselect:e,onRunRowCount:a,onRunRowCountDiff:o,onRunValueDiff:s,onAddLineageDiffCheck:c,onAddSchemaDiffCheck:l,runTypeIcons:{rowCountDiff:Ut(`row_count_diff`).icon,valueDiff:Ut(`value_diff`).icon,lineageDiff:Ut(`lineage_diff`).icon,schemaDiff:Ut(`schema_diff`).icon},historyToggleSlot:K(Gs,{}),SetupConnectionPopoverSlot:nc})};function ic(e,t,n=!1){let r=Fo(t),i=new Set;for(let n of Object.keys(e.nodes)){let a=e.nodes[n];Io(n,t,a.data.changeStatus,r)&&i.add(n)}if(n){let{wholeModelImpactedNodeIds:n,wholeModelChangedNodeIds:a}=Lo(e,t);return{nodeIds:i,columnIds:r,wholeModelImpactedNodeIds:n,wholeModelChangedNodeIds:a}}return{nodeIds:i,columnIds:r}}function ac(e,t,n,r){return e&&t&&n?.node_id&&n?.column?pe(t,n.node_id,n.column,r??new Set):void 0}async function oc(e,t,n,r,i){let a={...e,change_analysis:e.change_analysis??t},o=await n.mutateAsync(a);return a.change_analysis&&o&&(r.current={pending:!0,cllData:o},i.setQueryData(P.lineage(),e=>e&&{...e,lineage:Ls(e.lineage,o)})),o}function sc({interactive:e=!1,...t},r){let{isDark:i}=Ft(),{apiClient:a}=R(),o=Fn(),s=Yr(),c=Un(null),{copyToClipboard:l,ImageDownloadModal:u,ref:d}=To(),[p,m,h]=Jr(mo),[g,b,x]=qr([]),{lineageGraph:S,refetchLineageGraph:w,isLoading:T,error:E,refetchRunsAggregated:O}=L(),{featureToggles:k,singleEnv:ee}=ce(),{data:A}=me(),j=A?.new_cll_experience??!1,N=A?.whole_model_impact??!1,{runId:ne,showRunId:re,closeRunResult:ie,runAction:oe,isRunResultOpen:se}=_e(),{run:F}=Ot(ne),[I,le]=W({...t.viewOptions}),ue=Ao(),de=Un([]).current,[fe,pe]=W(void 0),[he,Ce]=W(!1),we=Un(!1);we.current=he;let Te=Nn({mutationFn:e=>n(e,a)}),Ee=Un({pending:!1}),[Oe,ke]=W({}),Ae=V(e=>p.filter(ye).find(t=>t.data.name===e),[p]);Vn(r,()=>({copyToClipboard:l}));let je=U(()=>!!(S&&S.modifiedSet.length>0),[S]),Me=I.view_mode??`changed_models`,Ne=U(()=>p.filter(e=>e.type===`lineageGraphNode`).map(e=>e.id),[p]),Pe=U(()=>S?Ne.map(e=>S.nodes[e]):[],[S,Ne]),[Fe,Ie]=W(),z=Fe?S?.nodes[Fe]:void 0,[Le,Re]=W([]),[B,ze]=W(),[Be,Ve]=W(new Set),He=U(()=>S?Array.from(Be).map(e=>S.nodes[e]):[],[S,Be]),Ge=No(He.length>0?He:Pe,{onActionStarted:()=>{ze(`action_result`)},onActionNodeUpdated:e=>{m(t=>t.map(t=>t.id===e.id?{...t}:t))},onActionCompleted:()=>{}}),Ke=V(()=>{let e=new Map,t=s.getNodes();for(let n of t)!n.parentId&&n.position&&e.set(n.id,{x:n.position.x,y:n.position.y});return e},[s]),qe=U(()=>{if(!S)return new Set;let e=new Set;if(fe){for(let[t,n]of Object.entries(fe.current.nodes))n.impacted!==!1&&e.add(t);for(let t of Object.keys(fe.current.columns))e.add(t)}else if(B===`action_result`){let t=Object.keys(Ge.actionState.actions);e=new Set(t)}else e=z?ve(Se(S,[z.id]),be(S,[z.id])):je?be(S,S.modifiedSet):new Set(Ne);return new Set(e)},[S,fe,B,z,je,Ge.actionState.actions,Ne]),Ye=Bo(),Xe=()=>{Ye.closeContextMenu()},Ze=Un(!1),{impactedNodeIds:Qe,impactedColumnIds:$e,wholeModelImpactedNodeIds:et,wholeModelChangedNodeIds:tt,publish:nt}=Oo();Hn(()=>{(async()=>{let e;if(!S)return;if(I.node_ids)e=I.node_ids;else{let n=S.manifestMetadata.current?.project_name,r={view_mode:I.view_mode??(je?`changed_models`:`all`),packages:n?[n]:void 0,...t.viewOptions};try{e=(await C({select:r.select,exclude:r.exclude,packages:r.packages,view_mode:r.view_mode},a)).nodes}catch{r.view_mode=`all`,e=(await C({select:r.select,exclude:r.exclude,packages:r.packages,view_mode:r.view_mode},a)).nodes}le(r)}let n=I.column_level_lineage,r=!1;A?.impact_at_startup&&!Ze.current&&!n&&(Ze.current=!0,r=!0,we.current=!0,Ce(!0),n={change_analysis:!0,no_upstream:!0},le(e=>({...e,column_level_lineage:n})));let i;if(n)if(Ee.current.pending)i=Ee.current.cllData,Ee.current={pending:!1};else try{i=await oc(n,we.current,Te,Ee,o)}catch(e){if(r&&(we.current=!1,Ce(!1),le(e=>({...e,column_level_lineage:void 0})),n=void 0),e instanceof ae){Xt.create({title:`Column Level Lineage error`,description:e.data?.detail??e.message,type:`error`,closable:!0});return}}else Ee.current={pending:!1};let s=j&&i?ic(S,i,A?.whole_model_impact??!1):void 0,[c,l,u]=await Vo(S,{selectedNodes:e,cll:i,newCllExperience:j,columnAncestry:ac(j,i,n,s?.columnIds)});m(c),b(l),ke(u),pe(i),s&&n?.change_analysis&&!n?.column&&nt(s),ue(c,I.view_mode??`changed_models`,we.current,!!n?.column,!!Fe||!!F)})()},[S,A?.impact_at_startup]);let rt=()=>{Ie(void 0),Re([])},it=e=>{S?.nodes[e]&&(Fe&&Fe!==e&&Re(e=>[...e,Fe]),Ie(e))},at=()=>{if(Le.length===0)return;let e=Le[Le.length-1];S?.nodes[e]&&(Ie(e),Re(e=>e.slice(0,-1)))},ot=e=>{if(e<0||e>=Le.length)return;let t=Le[e];S?.nodes[t]&&(Ie(t),Re(t=>t.slice(0,e)))},st=()=>{Fe&&ct(Fe)},ct=async e=>{let t=p.find(t=>t.id===e);if(t){if(t.parentId){let e=t.parentId;t=p.find(t=>t.id===e)??t}if(t.measured!=null){let{width:e,height:n}=t.measured;if(e&&n){let r=t.position.x+e/2,i=t.position.y+n/2,a=s.getZoom();await s.setCenter(r,i,{zoom:a,duration:200})}}}},lt=Eo();ko(c,async()=>{B!==`selecting`&&(Fe?await ct(Fe):await s.fitView({nodes:p,duration:200,padding:We,minZoom:Je,maxZoom:1}))});let ut=async(e,t=!1)=>{let n=I.column_level_lineage;!e&&!j&&Ce(!1);let r=n!==void 0;await ht({...I,column_level_lineage:e},!1,r),t||de.push(n),e?.node_id?Ie(e.node_id):e||Ie(void 0)},dt=async e=>{if(e){if(de.length===0)return;let e=de.pop();e?await ut(e,!0):await ut(void 0,!0)}else j&&he?await ut({change_analysis:!0,no_upstream:!0},!0):await ut(void 0,!0)},ft=(e,t)=>{B||ut({node_id:t.data.node.id,column:t.data.column})},pt=(t,n)=>{if(e&&S){if(xe(n)){ft(t,n);return}if(Xe(),!B)Ie(n.id),Re([]);else if(B===`action_result`){let e=Ge.actionState.actions[n.id];e.run?.run_id&&re(e.run.run_id),Ie(n.id),Re([])}else{let e=new Set(Be);Be.has(n.id)?e.delete(n.id):e.add(n.id),Ve(e),e.size===0&&ze(void 0)}}},mt=async e=>{let{viewOptions:t=I}=e,{fitView:n,preservePositions:r=!1}=e,i;if(!S)return;if(I.select!==t.select||I.exclude!==t.exclude||I.packages!==t.packages||I.view_mode!==t.view_mode){try{let e=await C({select:t.select,exclude:t.exclude,packages:t.packages,view_mode:t.view_mode},a);t={...t,column_level_lineage:void 0},i=e.nodes}catch(e){e instanceof ae&&Xt.create({title:`Select node error`,description:e.data?.detail??e.message,type:`error`,closable:!0});return}Ie(void 0)}else i=p.map(e=>e.id);let c;if(t.column_level_lineage)try{c=await oc(t.column_level_lineage,he,Te,Ee,o)}catch(e){if(e instanceof ae){Xt.create({title:`Column Level Lineage error`,description:e.data?.detail??e.message,type:`error`,closable:!0});return}}else j||Ce(!1);let l;(r||j)&&(l=Ke());let u=t.column_level_lineage,d=j&&c?ic(S,c,A?.whole_model_impact??!1):void 0,[h,g,_]=await Vo(S,{selectedNodes:i,cll:c,existingPositions:l,newCllExperience:j,columnAncestry:ac(j,c,u,d?.columnIds)});m(h),b(g),ke(_),pe(c),d&&!u?.column&&nt(d),ue(h,t.view_mode??`changed_models`,he,!!t.column_level_lineage?.column,!!Fe||!!F),F&&(v(F)||D(F)||y(F)||M(F)||f(F))&&F.params?.model&&!Ae(F.params.model)&&ie(),n&&(await new Promise(e=>setTimeout(e,1)),s.fitView({nodes:h,duration:200,padding:We,minZoom:Je,maxZoom:1}))},ht=async(e,t=!0,n=!1)=>{le(e),await mt({viewOptions:e,fitView:t,preservePositions:n})};H(()=>{let t=F?.type;if(e&&se&&!(!t||[`query_diff`,`query`,`row_count`,`row_count_diff`].includes(t))&&!B){let e;(v(F)||D(F)||y(F)||M(F)||f(F))&&(e=F.params?.model);let t=new MouseEvent(`click`,{bubbles:!0,cancelable:!0,view:window});if(e){let n=Ae(e);n?ye(n)&&z?.id!==n.id&&pt(t,n):ht({...I,view_mode:`all`})}else rt()}},[F,I,se,B,Ae,z,e]);let gt=(e,t=1e3)=>{B===`action_result`||S===void 0||(B||(ze(`selecting`),Ge.reset(),I.column_level_lineage&&ht({...I,column_level_lineage:void 0})),Ve(ve(Be,Se(S,[e],t))))},_t=(e,t=1e3)=>{B===`action_result`||S===void 0||(B||(ze(`selecting`),Ge.reset(),I.column_level_lineage&&ht({...I,column_level_lineage:void 0})),Ve(ve(Be,be(S,[e],t))))},vt=(t,n)=>{if(!e||B===`action_result`)return;t.preventDefault();let r=d.current,i=r.getBoundingClientRect(),a=t.clientX-i.left,o=t.clientY-i.top+r.offsetTop;Ye.showContextMenu(a,o,n)},yt=e=>{if(!B){if(!S)return;Ve(new Set([e])),ze(`selecting`),Ie(void 0),Ge.reset()}else if(B===`selecting`){let t=new Set(Be);Be.has(e)?t.delete(e):t.add(e),Ve(t),t.size===0&&ze(void 0)}},bt=()=>{ze(void 0),Ve(new Set),Ie(void 0),ie(),O?.()},xt={interactive:e,nodes:p,focusedNode:z,selectedNodes:He,viewOptions:I,showContextMenu:vt,onViewOptionsChanged:ht,selectMode:B,selectNode:yt,selectParentNodes:gt,selectChildNodes:_t,deselect:bt,impactedNodeIds:Qe,impactedColumnIds:$e,wholeModelChangedNodeIds:tt,wholeModelImpactedNodeIds:et,isNodeHighlighted:e=>qe.has(e),isNodeSelected:e=>Be.has(e),isEdgeHighlighted:(e,t)=>fe?e in fe.current.parent_map?t in fe.current.parent_map[e]:!1:qe.has(e)&&qe.has(t),isNodeShowingChangeAnalysis:e=>{if(!S||!he)return!1;let t=e in S.nodes?S.nodes[e]:void 0,n=I.column_level_lineage;return n?.node_id&&!n.column?n.node_id===e&&!!t?.data.changeStatus:!!t?.data.changeStatus},changeAnalysisMode:he,newCllExperience:j,wholeModelImpact:N,setChangeAnalysisMode:Ce,getNodeAction:e=>Ge.actionState.actions[e],getNodeColumnSet:e=>e in Oe?new Set(Oe[e]):new Set,runRowCount:async()=>{B===`selecting`?(await Ge.runRowCount(),Cn({type:`row_count`,selected:`multi`})):z?(oe(`row_count`,{node_names:[z.data.name]},{showForm:!1,showLast:!1}),Cn({type:`row_count`,selected:`single`})):(oe(`row_count`,{select:I.select,exclude:I.exclude,packages:I.packages,view_mode:I.view_mode}),Cn({type:`row_count`,selected:`none`}))},runRowCountDiff:async()=>{B===`selecting`?(await Ge.runRowCountDiff(),Cn({type:`row_count_diff`,selected:`multi`})):z?(oe(`row_count_diff`,{node_names:[z.data.name]},{showForm:!1,showLast:!1}),Cn({type:`row_count_diff`,selected:`single`})):(oe(`row_count_diff`,{select:I.select,exclude:I.exclude,packages:I.packages,view_mode:I.view_mode}),Cn({type:`row_count_diff`,selected:`none`}))},runValueDiff:async()=>{z?(oe(`value_diff`,{model:z.data.name},{showForm:!0,showLast:!1}),Cn({type:`value_diff`,selected:`single`})):(await Ge.runValueDiff(),Cn({type:`value_diff`,selected:B===`selecting`?`multi`:`none`}))},addLineageDiffCheck:async()=>{let e=await te(I,a),t;t=B===`selecting`?`multi`:z?`single`:`none`,Cn({type:`lineage_diff`,selected:t}),e&&(await o.invalidateQueries({queryKey:P.checks()}),lt(e))},addSchemaDiffCheck:async()=>{let e;B===`selecting`?He.length>0&&(e=await Ge.addSchemaDiffCheck(),bt(),Cn({type:`schema_diff`,selected:`multi`})):z?(e=await _({node_id:z.id},a),Cn({type:`schema_diff`,selected:`single`})):(e=await _({select:I.select,exclude:I.exclude,packages:I.packages,view_mode:I.view_mode},a),Cn({type:`schema_diff`,selected:`none`})),e&&(await o.invalidateQueries({queryKey:P.checks()}),lt(e))},cancel:Ge.cancel,actionState:Ge.actionState,centerNode:ct,cll:fe,showColumnLevelLineage:ut,resetColumnLevelLineage:dt};return T?K(Hs,{}):E?K(Us,{error:E,onRetry:w}):!S||p==mo?K(G,{}):Me===`changed_models`&&!S.modifiedSet.length?K(Ws,{viewOptions:I,onViewOptionsChanged:ht}):K(ge.Provider,{value:xt,children:q(Pt,{sizes:z?[70,30]:[100,0],minSize:0,gutterSize:5,className:z?void 0:`split-gutter-hidden`,style:{height:`100%`,width:`100%`},children:[q(X,{ref:c,divider:K(ar,{sx:{borderColor:`grey.200`}}),spacing:0,sx:{contain:`strict`,position:`relative`},children:[e&&q(G,{children:[K(rc,{}),k.mode===`metadata only`&&K(zs,{})]}),q(Ur,{proOptions:{hideAttribution:!0},nodeTypes:fo,edgeTypes:po,nodes:p,edges:g,onNodesChange:h,onEdgesChange:x,onNodeClick:pt,onNodeContextMenu:vt,onClick:Xe,onInit:async()=>{if(je){let e=p.filter(e=>ye(e)&&e.data.changeStatus!==void 0),t=e.length>0?e:p;await s.fitView({nodes:t,duration:200,padding:We,minZoom:Je,maxZoom:1})}else{let e=Kr(p,{});await s.setCenter(e.x+e.width/2,e.y+e.height/2,{zoom:1})}},maxZoom:1,minZoom:Ue,nodesDraggable:e,ref:d,colorMode:i?`dark`:`light`,children:[K(Fr,{id:`lineage-bg`,variant:Ir.Dots,color:i?De.neutral[700]:De.neutral[300],gap:20,size:2}),K(zr,{showInteractive:!1,position:`top-right`,className:Lt,style:{backgroundColor:i?De.neutral[700]:void 0,borderColor:i?De.neutral[600]:void 0},children:K(Rr,{title:`copy image`,onClick:async()=>{await l(),pn({type:Me,from:`lineage_view`})},style:{backgroundColor:i?De.neutral[700]:void 0,color:i?De.neutral[200]:void 0},children:K(J,{component:Ii})})}),K(u,{}),K(Vr,{position:`bottom-left`,children:q(X,{spacing:`5px`,children:[je&&K(Et,{variant:`changeStatus`,newCllExperience:j}),I.column_level_lineage&&K(Et,{variant:`transformation`})]})}),K(Vr,{position:`top-center`,children:K(Po,{notification:ee?K(Vs,{}):null,type:`info`})}),K(Vr,{position:`top-left`,children:q(X,{spacing:`5px`,children:[K(Oa,{action:Te}),p.length==0&&K(Z,{sx:{fontSize:`1.25rem`,color:`grey`,opacity:.5},children:`No nodes`})]})}),p.length<=500&&K(Br,{nodeColor:ho,nodeStrokeWidth:3,zoomable:!0,pannable:!0,bgColor:i?De.neutral[800]:void 0,maskColor:i?`${De.neutral[900]}99`:`${De.neutral[100]}99`}),B===`action_result`&&K(Vr,{position:`bottom-center`,className:`ignore-screenshot`,children:K(Da,{onClose:()=>{bt()}})})]}),K(zo,{...Ye.props})]}),z?K(J,{sx:{borderLeft:`solid 1px`,borderColor:`divider`,height:`100%`},children:K(Is,{node:z,onCloseNode:rt,onNavigateToNode:it,onBack:Le.length>0?at:void 0,onCenterFocused:st,historyTrail:Le,onJumpToHistory:ot})}):K(J,{})]})})}const cc=Rn(sc);function lc(){return K(Wr,{children:K(cc,{interactive:!0})})}function uc({variant:e=`banner`,dismissible:t=!1,sessionId:n,toastAdapter:r,successToastOnlyOnUserRefresh:i=!1,requireCloudMode:a=!0,messageVariant:o=`data`,showFirstTimePopover:s=!0,cardSx:c}={}){let{cloudMode:l}=L(),{apiClient:u}=R(),f=r??pc,[p,m]=W(!1),h=Un(null),[g,_]=W(null),v=Un(!1),{data:y}=Qe({select:e=>e.session_staleness}),b=Un(null),x=y==null?!1:N(y),S=t&&n?`recce-staleness-banner-dismissed-signature::${n}`:null,[C,w]=W(()=>fc(S));if(H(()=>{w(fc(S))},[S]),H(()=>{},[t,n]),H(()=>{},[a,r]),H(()=>{let e=b.current===!0&&!x,t=!i||v.current;e&&t&&(f.success(`Base refreshed. If you've saved checks in this session, you may want to re-run them against the new base.`,{duration:8e3}),m(!1),h.current&&=(clearTimeout(h.current),null),v.current=!1),b.current=x},[x,i,f]),H(()=>()=>{h.current&&clearTimeout(h.current)},[]),a&&!l||!y||!x)return null;let T=dc(y);if(t&&C===T)return null;let E=y.current_base_session_id===null,D=o===`metadata`?`Production metadata has changed since this PR's base was captured. Comparisons may not reflect current state.`:`Production data has changed since this PR's base was captured. Comparisons may not reflect current state.`,O=async()=>{v.current=!0,m(!0),h.current=setTimeout(()=>{m(!1),f.error(`Refresh failed — try again.`,{duration:5e3}),h.current=null,v.current=!1},3e4);try{await d(u)}catch{if(!h.current)return;clearTimeout(h.current),h.current=null,m(!1),v.current=!1,f.error(`Refresh failed — try again.`,{duration:5e3})}},k=()=>{if(h.current&&=(clearTimeout(h.current),null),m(!1),v.current=!1,S)try{sessionStorage.setItem(S,T)}catch{}w(T)},ee=E?`This PR's base snapshot may be out of date, and no shared base is currently configured for this project. Comparisons may not reflect current state.`:D,A=K($,{title:E?`No shared base configured for this project.`:``,disableHoverListener:!E,children:K(`span`,{children:K(Y,{size:`small`,variant:`outlined`,onClick:()=>void O(),disabled:p||E,startIcon:p?K(or,{size:12}):void 0,sx:{whiteSpace:`nowrap`},children:p?`Refreshing…`:`Refresh base`})})}),j=t?K(Q,{"aria-label":`Dismiss`,size:`small`,onClick:k,sx:{flex:`0 0 auto`},children:K(nr,{})}):null,M=s?K(wo,{anchorEl:g}):null;return e===`card`?q($i,{ref:_,role:`status`,elevation:4,sx:[{position:`fixed`,left:`50%`,transform:`translateX(-50%)`,zIndex:e=>e.zIndex.drawer+1,maxWidth:760,minWidth:480,bgcolor:`warning.light`,border:1,borderColor:`warning.main`,borderRadius:1,px:1.5,py:1},...Array.isArray(c)?c:[c]],children:[q(X,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[K(J,{component:ki,sx:{flex:`0 0 auto`},size:18}),K(Z,{variant:`body2`,sx:{flex:1},children:ee}),A,j]}),M]}):q(J,{ref:_,role:`status`,sx:{bgcolor:`warning.light`,borderBottom:1,borderColor:`warning.main`,px:2,py:.75},children:[q(X,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[K(ki,{color:`inherit`,size:16}),K(Z,{variant:`body2`,sx:{flex:1},children:ee}),A,j]}),M]})}function dc(e){return`${e.source_session_id}|${e.source_session_updated_at}|${e.current_base_session_id}|${e.current_base_updated_at}`}function fc(e){if(!e||typeof window>`u`)return null;try{return sessionStorage.getItem(e)}catch{return null}}const pc={success:(e,t)=>{Xt.success({description:e,duration:t?.duration??5e3,closable:!0})},error:(e,t)=>{Xt.error({description:e,duration:t?.duration??5e3,closable:!0})}},mc=re({baseURL:on??``});async function hc(e=mc){return(await e.post(`/api/connect`)).data}function gc({handleParentClose:e,parentOpen:t=!1,ignoreCookie:n=!1,variant:r=`auth`}){let{authed:i}=ce(),{apiClient:a}=R(),[o,s]=W(t||!i),c=Yn.get(`authState`)??`pending`,[l,u]=W(n?`pending`:c);if(l===`ignored`&&!n||i)return null;let d={auth:{title:`Configure Cloud Token`,action:`Get token and configure`},"enable-share":{title:`Enable Sharing with Cloud`,action:`Enable sharing`},"user-profile":{title:`Configure Cloud Token`,action:`Get token and configure`}}[r],f=()=>{s(!1),e&&e(!1)};return q(Wn,{open:o,onClose:f,maxWidth:`sm`,fullWidth:!0,slotProps:{paper:{sx:{borderRadius:`1rem`}}},children:[l!==`authenticating`&&K(qn,{sx:{textAlign:`center`,fontSize:`1.5rem`},children:d.title}),l===`authenticating`?q(G,{children:[K(Kn,{className:`space-y-2 self-center font-light`,children:q(X,{spacing:2,sx:{alignItems:`center`,pt:`1rem`},children:[K(J,{component:`img`,sx:{height:`6rem`,objectFit:`contain`,mx:`auto`,mb:1},src:`/imgs/reload-image.svg`,alt:`Reload`}),K(Z,{sx:{fontSize:`1.5rem`,fontWeight:500},children:`Reload to Finish`}),K(Z,{children:`Reload to complete connection to Recce Cloud`})]})}),K(Gn,{sx:{px:3,pb:3},children:K(Y,{fullWidth:!0,color:`brand`,variant:`contained`,onClick:()=>{window.location.reload()},children:`Reload`})})]}):q(G,{children:[q(Kn,{className:`space-y-2 font-light`,children:[K(Z,{children:`To enable sharing, get your token from Recce Cloud and launch your local instance with it.`}),q(`ul`,{className:`list-inside list-disc`,children:[K(`li`,{children:`Share your instance with teammates via Recce Cloud.`}),K(`li`,{children:`Your instance will be securely and freely hosted for sharing.`}),r===`auth`&&K(`li`,{children:`This step is recommended but optional.`})]}),q(J,{sx:{display:`flex`,gap:1},children:[`More directions`,q(Jn,{underline:`always`,sx:{color:`primary.main`,"&:focus":{outline:`none`}},href:new URL(`/connect-to-cloud`,sn).href,target:`_blank`,children:[`here `,K(Xn,{style:{display:`inline`}})]})]})]}),q(Gn,{sx:{flexDirection:`column`,gap:1,px:3,pb:3},children:[q(Y,{fullWidth:!0,color:`brand`,variant:`contained`,sx:{borderRadius:2,fontWeight:500},onClick:async()=>{u(`authenticating`);let{connection_url:e}=await hc(a);window.open(e,`_blank`)},children:[d.action,` `,K(Xn,{style:{marginLeft:4}})]}),K(Y,{fullWidth:!0,color:`neutral`,variant:`text`,size:`small`,sx:{borderRadius:2,fontWeight:500},onClick:f,children:r===`auth`?`Skip`:`Cancel`}),r===`auth`&&K(Y,{fullWidth:!0,variant:`text`,size:`small`,sx:{borderRadius:2,fontWeight:500,color:`text.primary`},onClick:()=>{Yn.set(`authState`,`ignored`,{expires:30}),u(`ignored`),f()},children:`Snooze for 30 days`})]})]})]})}function _c(){let{apiClient:e}=R(),{data:t,isLoading:n,error:r}=Pn({queryKey:P.user(),queryFn:()=>an(e),retry:!1}),{data:i}=Pn({queryKey:[`github-avatar`,t?.id],queryFn:()=>t?rn(t.id):Promise.resolve(null),enabled:!!t?.id&&t.login_type===`github`,retry:!1,staleTime:300*1e3}),[a,o]=W(null),s=!!a,c=e=>{o(e.currentTarget)},l=()=>{o(null)},u=!n&&!r&&t;return q(G,{children:[n?K(J,{onClick:c,sx:{width:32,height:32,borderRadius:`50%`,bgcolor:`background.paper`,color:`primary.main`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`},children:K(or,{size:16})}):K(bi,{onClick:c,src:i||void 0,sx:{width:28,height:28,cursor:`pointer`,outline:`1px solid white`,fontSize:`0.875rem`},children:(e=>e?e.charAt(0).toUpperCase():`U`)(t?.login)}),q(ni,{anchorEl:a,open:s,onClose:l,slotProps:{paper:{sx:{bgcolor:`background.paper`,borderColor:`divider`,boxShadow:3,minWidth:180}}},children:[q(J,{sx:{px:2,py:1.5},children:[n&&q(J,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[K(Z,{variant:`body2`,sx:{color:`text.primary`},children:`Loading...`}),K(or,{size:16})]}),r&&K(Z,{variant:`caption`,color:`error`,children:`Failed to load user information`}),u&&q(G,{children:[K(Z,{variant:`body2`,sx:{fontWeight:`600`,color:`text.primary`},children:t.login}),t.email&&K(Z,{variant:`caption`,sx:{color:`text.secondary`},children:t.email})]})]}),K(ar,{}),q(ri,{onClick:()=>{window.open(sn,`_blank`),l()},children:[K(Ni,{children:K(sr,{})}),K(Pi,{children:`Recce Cloud`})]}),q(ri,{onClick:()=>{window.open(cn,`_blank`),l()},children:[K(Ni,{children:K(pr,{})}),K(Pi,{children:`Get live support`})]})]})]})}const vc=()=>{let{setTheme:e,resolvedTheme:t}=$n(),[n,r]=W(!1);H(()=>{r(!0)},[]);let i=()=>{e(t===`dark`?`light`:`dark`)};if(!n)return K(Q,{size:`small`,sx:{color:`rgba(255, 255, 255, 0.8)`,"&:hover":{bgcolor:`rgba(255, 255, 255, 0.1)`}},disabled:!0,children:K(kr,{style:{width:18,height:18}})});let a=t===`dark`;return K($,{title:a?`Switch to light mode`:`Switch to dark mode`,children:K(Q,{size:`small`,onClick:i,sx:{color:`rgba(255, 255, 255, 0.8)`,"&:hover":{bgcolor:`rgba(255, 255, 255, 0.1)`}},"aria-label":a?`Switch to light mode`:`Switch to dark mode`,children:K(a?kr:Cr,{style:{width:18,height:18}})})})};function yc(e,t,n,r){let i=e?.git,a=e?.pullRequest,o=e?.dbt?.base,s=e?.dbt?.current,c={review_mode:t||!1,adapter_type:e?.adapterType||null,has_git_info:!ii(i),has_pr_info:!ii(a)};return e?.adapterType===`dbt`&&(c.base={schema_count:n.size,dbt_version:o?.dbt_version||null,timestamp:o?.generated_at||null},c.current={schema_count:r.size,dbt_version:s?.dbt_version||null,timestamp:s?.generated_at||null},c.schemas_match=n.size===r.size&&Array.from(n).every(e=>r.has(e))),e?.adapterType===`sqlmesh`&&(c.base={has_env:!!e.sqlmesh?.base_env},c.current={has_env:!!e.sqlmesh?.current_env}),c}function bc(e){return Object.values(e).every(e=>e===null)?[K(J,{sx:{ml:`10px`},children:`No information`},`no info`)]:Object.entries(e).filter(([e,t])=>e!==`url`&&t!=null).map(([e,t])=>q(`li`,{style:{marginLeft:`10px`},children:[e,`: `,t]},e))}function xc(){let{envInfo:e,reviewMode:t,lineageGraph:n}=L(),[r,i]=W(!1),a=e?.git,o=e?.pullRequest,s={...a,...o},c=e?.dbt?.base,l=e?.dbt?.current,u=c?.generated_at?Jt(c.generated_at):``,d=l?.generated_at?Jt(l.generated_at):``,f=``,p=``;c&&(f=c.generated_at?Zt(c.generated_at):``),l&&(p=l.generated_at?Zt(l.generated_at):``);let[m,h]=tn(n),g=Un(!1);H(()=>{!g.current&&e&&(g.current=!0,_n(yc(e,t,m,h)))},[e,t,m,h]);let _=()=>i(!0),v=()=>i(!1);return q(G,{children:[K($,{title:`Environment Info`,placement:`bottom-end`,children:q(J,{sx:{display:`flex`,alignItems:`center`,cursor:`pointer`,"&:hover":{color:`text.primary`}},onClick:_,children:[q(X,{direction:`column`,sx:{display:{xs:`none`,lg:`flex`},fontSize:`0.875rem`},children:[q(J,{sx:{display:`flex`,alignItems:`baseline`,gap:.5},children:[K(Z,{component:`span`,noWrap:!0,sx:{color:`warning.main`,maxWidth:128},className:`no-track-pii-safe`,children:Array.from(m).join(`, `)}),q(Z,{component:`span`,noWrap:!0,children:[`(`,f,`)`]})]}),q(J,{sx:{display:`flex`,alignItems:`baseline`,gap:.5},children:[K(Z,{component:`span`,noWrap:!0,sx:{color:`primary.main`,maxWidth:128},className:`no-track-pii-safe`,children:Array.from(h).join(`, `)}),q(Z,{component:`span`,noWrap:!0,children:[`(`,p,`)`]})]})]}),K(Q,{size:`small`,"aria-label":`Environment Info`,children:K(J,{component:xr,sx:{fontSize:16,verticalAlign:`middle`}})})]})}),q(Wn,{open:r,onClose:v,maxWidth:`sm`,fullWidth:!0,children:[q(qn,{sx:{display:`flex`,alignItems:`center`},children:[`Environment Information`,K(J,{sx:{flexGrow:1}}),K(Q,{size:`small`,onClick:v,children:K(nr,{})})]}),K(Kn,{children:q(X,{direction:`column`,spacing:1,children:[t?q(X,{direction:`column`,spacing:.5,children:[K(Z,{variant:`h6`,sx:{fontSize:`1rem`},children:`Review Information`}),q(`ul`,{style:{margin:0,paddingLeft:`20px`},children:[s.url&&q(`li`,{style:{marginLeft:`10px`},children:[`url:`,` `,q(Jn,{href:s.url,target:`_blank`,sx:{color:`primary.main`},children:[s.url,` `,K(Xn,{})]})]}),!ii(s)&&bc(s)]})]}):q(X,{direction:`column`,spacing:.5,children:[K(Z,{variant:`h6`,sx:{fontSize:`1rem`},children:`Dev Information`}),K(`ul`,{style:{margin:0,paddingLeft:`20px`},children:a&&bc(a)})]}),K(ar,{}),e?.adapterType===`dbt`&&q(X,{direction:`column`,spacing:.5,children:[K(Z,{variant:`h6`,sx:{fontSize:`1rem`},children:`DBT`}),K(ra,{sx:{border:1,borderColor:`divider`,maxHeight:`30rem`},children:q(ea,{size:`small`,stickyHeader:!0,children:[K(ia,{children:q(aa,{children:[K(na,{}),K(na,{children:`base`}),K(na,{children:`current`})]})}),q(ta,{children:[q(aa,{children:[K(na,{children:`schema`}),K(na,{className:`no-track-pii-safe`,children:Array.from(m).map(e=>K($,{title:e,placement:`bottom`,children:K(`div`,{className:`max-w-72 truncate`,children:e})},e))}),K(na,{className:`no-track-pii-safe`,children:Array.from(h).map(e=>K($,{title:e,placement:`bottom`,children:K(`div`,{className:`max-w-72 truncate`,children:e})},e))})]}),q(aa,{children:[K(na,{children:`version`}),K(na,{children:c?.dbt_version}),K(na,{children:l?.dbt_version})]}),q(aa,{children:[K(na,{children:`timestamp`}),K(na,{children:u}),K(na,{children:d})]})]})]})})]}),e?.adapterType===`sqlmesh`&&q(X,{direction:`column`,spacing:.5,children:[K(Z,{variant:`h6`,sx:{fontSize:`1rem`},children:`SQLMesh`}),K(ra,{sx:{border:1,borderColor:`divider`,maxHeight:`30rem`},children:q(ea,{stickyHeader:!0,children:[K(ia,{children:q(aa,{children:[K(na,{}),K(na,{children:`base`}),K(na,{children:`current`})]})}),K(ta,{children:q(aa,{children:[K(na,{children:`Environment`}),K(na,{className:`no-track-pii-safe`,children:e.sqlmesh?.base_env}),K(na,{className:`no-track-pii-safe`,children:e.sqlmesh?.current_env})]})})]})})]})]})}),K(Gn,{children:K(Y,{color:`iochmara`,onClick:v,children:`Close`})})]})]})}const Sc=()=>({toastSuccess:e=>{Xt.create({description:e,type:`success`,duration:5e3,closable:!0})},toastError:(e,t)=>{let n=e;t!=null&&(n=ie(t)?`${e}. ${String(t.data?.detail)}`:`${e}. ${t}`),Xt.create({description:n,type:`error`,duration:5e3,closable:!0})}}),Cc=e=>{H(()=>{let t=e=>{e.preventDefault()};return e&&window.addEventListener(`beforeunload`,t),()=>{e&&window.removeEventListener(`beforeunload`,t)}},[e])},wc=()=>{let{featureToggles:e}=ce(),{fileName:t,cloudMode:n,isDemoSite:i,envInfo:a}=L(),{apiClient:o}=R(),[s,c]=W(!1),[l,u]=W(!1),d=!t&&!n&&!i,{data:f}=r(d),m=f!=null&&f.filter(e=>!e.is_preset).length>0;Cc(d&&m);let[{newFileName:g,errorMessage:_,modified:v,overwriteWithMethod:y,bypass:b},x]=W({newFileName:t??`recce_state.json`,bypass:!1}),S=Un(null),{toastSuccess:C,toastError:w}=Sc(),T=Fn(),E=()=>{x({newFileName:t??`recce_state.json`,modified:!t,bypass:!1}),c(!0)},D=()=>c(!1),O=()=>u(!1),k=async(e,t)=>{if(!g)return;let n=localStorage.getItem(p.bypassSaveOverwrite)===`true`;try{e===`save`?await h({filename:g,overwrite:t??n},o):await j({filename:g,overwrite:t??n},o),C(e===`save`?`Save file successfully`:`Rename file successfully`),await T.invalidateQueries({queryKey:P.lineage()}),b&&localStorage.setItem(p.bypassSaveOverwrite,`true`)}catch(t){if(ie(t)&&t.status===409){x(t=>({...t,overwriteWithMethod:e})),u(!0);return}w(e===`save`?`Save file failed`:`Rename file failed`,t)}finally{D()}},ee=()=>{O(),c(!0),x(e=>({...e,overwriteWithMethod:void 0}))};if(n||i)return K(G,{});let A=`New Instance`+(m?` (unsaved)`:``),M;if(e.disableSaveToFile&&t){let e=a?.stateMetadata?.generated_at,n=e?St(new Date(e)):null;M=n?`${t} (${n})`:null}return q(G,{children:[q(X,{direction:`row`,sx:{alignItems:`center`,justifyContent:`center`},children:[K(J,{sx:{fontWeight:600},children:M??t??A}),!e.disableSaveToFile&&K($,{title:t?`Change Filename`:`Save`,enterDelay:1e3,children:K(Q,{onClick:E,"aria-label":t?`Change Filename`:`Save`,size:`small`,children:K(J,{component:t?Tr:Zn,sx:{fontSize:16,verticalAlign:`middle`}})})})]}),q(Wn,{open:s,onClose:D,children:[q(qn,{sx:{display:`flex`,alignItems:`center`},children:[t?`Change Filename`:`Save File`,K(J,{sx:{flexGrow:1}}),K(Q,{size:`small`,onClick:D,children:K(nr,{})})]}),K(Kn,{onKeyDown:e=>{e.stopPropagation()},children:K(pi,{inputRef:S,value:g,label:`File name`,placeholder:`Enter filename`,error:!!_,helperText:_,fullWidth:!0,size:`small`,sx:{mt:1},onChange:e=>{let n=e.target.value,r;n?n.endsWith(`.json`)?/^[a-zA-Z0-9 _-]+\.json$/.test(n)?t&&n===t&&(r=`Filename is the same as the current one.`):r=`Invalid filename. Only alphanumeric, space, _ and - are allowed.`:r=`Filename must end with .json.`:r=`Filename cannot be empty.`,x(e=>({...e,modified:!0,newFileName:n,errorMessage:r}))},onKeyDown:e=>{if(e.key===`Enter`){if(_)return;k(t?`rename`:`save`)}else e.key===`Escape`&&D()}})}),q(Gn,{sx:{gap:`5px`},children:[K(Y,{size:`small`,color:t?`inherit`:`iochmara`,variant:`contained`,onClick:async()=>{await k(`save`)},disabled:!g||!!_||!v,children:t?`Save as New File`:`Confirm`}),t&&K(Y,{size:`small`,color:`iochmara`,variant:`contained`,onClick:async()=>{await k(`rename`)},disabled:!g||!!_||!v,children:`Rename`})]})]}),q(Wn,{open:l,onClose:O,children:[q(qn,{sx:{display:`flex`,alignItems:`center`},children:[`Overwrite File?`,K(J,{sx:{flexGrow:1}}),K(Q,{size:`small`,onClick:O,children:K(nr,{})})]}),q(Kn,{sx:{borderTop:`solid 1px`,borderBottom:`solid 1px`,borderColor:`divider`},onKeyDown:e=>{e.stopPropagation()},children:[K(Z,{sx:{fontSize:`12pt`},children:y===`save`?`Saving a file with this name will overwrite the existing file. Are you sure you wish to continue?`:`Renaming the file with this name will overwrite the existing file. Are you sure you wish to continue?`}),K($r,{control:K(Qr,{size:`small`,checked:b,onChange:e=>{x(t=>({...t,bypass:e.target.checked}))}}),label:K(Z,{sx:{fontWeight:`bold`,pt:`8px`},children:`Don't show this again`})})]}),q(Gn,{sx:{gap:`5px`},children:[K(Y,{variant:`outlined`,onClick:ee,size:`small`,children:`Back`}),K(Y,{size:`small`,color:`iochmara`,variant:`contained`,onClick:()=>{y&&(k(y,!0),O())},children:`Overwrite`})]})]})]})};async function Tc(e){return(await e.get(`/api/cloud/organizations`)).data.organizations}async function Ec(e,t){return(await e.get(`/api/cloud/organizations/${t}/projects`)).data.projects}async function Dc(e,t,n){return(await e.get(`/api/cloud/organizations/${t}/projects/${n}/base-status`)).data}async function Oc(e,t){return(await e.post(`/api/cloud/upload`,t)).data}async function kc(e){return(await e.get(`/api/connection-info`)).data.connection_info}async function Ac(e,t){return(await e.post(`/api/cloud/warehouse-setup`,t)).data}const jc={snowflake:{type:`snowflake`,label:`Snowflake`,commonFields:[{name:`account`,label:`Account`,type:`text`,isCredential:!1,required:!0},{name:`user`,label:`User`,type:`text`,isCredential:!1,required:!0},{name:`warehouse`,label:`Warehouse`,type:`text`,isCredential:!1,required:!0},{name:`database`,label:`Database`,type:`text`,isCredential:!1,required:!0},{name:`schema`,label:`Schema`,type:`text`,isCredential:!1,required:!0}],authMethods:[{value:`user-password`,label:`User & Password`,fields:[{name:`password`,label:`Password`,type:`password`,isCredential:!0,required:!0}]},{value:`key-pair`,label:`Key Pair`,fields:[{name:`private_key`,label:`Private Key`,type:`textarea`,isCredential:!0,required:!0,placeholder:`Paste PEM-encoded private key`},{name:`private_key_passphrase`,label:`Private Key Passphrase`,type:`password`,isCredential:!0,required:!1}]}]},databricks:{type:`databricks`,label:`Databricks`,commonFields:[{name:`host`,label:`Host`,type:`text`,isCredential:!1,required:!0},{name:`http_path`,label:`HTTP Path`,type:`text`,isCredential:!1,required:!0},{name:`catalog`,label:`Catalog`,type:`text`,isCredential:!1,required:!1,prefillFrom:`database`},{name:`schema`,label:`Schema`,type:`text`,isCredential:!1,required:!0}],authMethods:[{value:`token`,label:`Token`,fields:[{name:`token`,label:`Access Token`,type:`password`,isCredential:!0,required:!0}]},{value:`oauth`,label:`OAuth (M2M)`,fields:[{name:`client_id`,label:`Client ID`,type:`text`,isCredential:!0,required:!0},{name:`client_secret`,label:`Client Secret`,type:`password`,isCredential:!0,required:!0}]}]},bigquery:{type:`bigquery`,label:`BigQuery`,commonFields:[{name:`project`,label:`Project`,type:`text`,isCredential:!1,required:!0,prefillFrom:`database`},{name:`dataset`,label:`Dataset`,type:`text`,isCredential:!1,required:!0,prefillFrom:`schema`}],authMethods:[{value:`service-account-json`,label:`Service Account JSON`,fields:[{name:`keyfile_json`,label:`Service Account Key (JSON)`,type:`textarea`,isCredential:!0,required:!0,placeholder:`Paste service account JSON`}]}]},redshift:{type:`redshift`,label:`Redshift`,commonFields:[{name:`host`,label:`Host`,type:`text`,isCredential:!1,required:!0},{name:`user`,label:`User`,type:`text`,isCredential:!1,required:!0},{name:`port`,label:`Port`,type:`number`,isCredential:!1,required:!0},{name:`dbname`,label:`Database`,type:`text`,isCredential:!1,required:!0,prefillFrom:`database`},{name:`schema`,label:`Schema`,type:`text`,isCredential:!1,required:!0}],authMethods:[{value:`password`,label:`Password`,fields:[{name:`password`,label:`Password`,type:`password`,isCredential:!0,required:!0}]}]}};function Mc(e){return e in jc}function Nc(e){return jc[e]?.authMethods[0]?.value??``}function Pc(e,t){let n=jc[e];if(!n)return[];let r=n.authMethods.find(e=>e.value===t);return[...n.commonFields,...r?.fields??[]]}function Fc(e,t){let n=jc[e];if(!n)return{};let r={};for(let e of n.commonFields){if(e.isCredential)continue;let n=t[e.prefillFrom??e.name];n!=null&&(r[e.name]=String(n))}return r}function Ic({open:e,onClose:t}){let{apiClient:n}=R(),[r,i]=W(`select`),[a,o]=W([]),[s,c]=W([]),[l,u]=W(``),[d,f]=W(``),[p,m]=W(``),[h,g]=W(!1),[_,v]=W(!1),[y,b]=W(``),[x,S]=W(!1),[C,w]=W(``),[T,E]=W(null),[D,O]=W({}),[k,ee]=W(``),[A,j]=W(null);H(()=>{e&&(i(`select`),m(`dev-${new Date().toISOString().slice(0,16).replace(`T`,`-`).replace(`:`,``)}`),g(!0),Tc(n).then(e=>{o(e),e.length===1&&u(String(e[0].id))}).catch(()=>o([])).finally(()=>g(!1)))},[e,n]),H(()=>{if(!l){c([]),f(``);return}v(!0),f(``),Ec(n,l).then(e=>{c(e),e.length===1&&f(String(e[0].id))}).catch(()=>c([])).finally(()=>v(!1))},[l,n]),H(()=>{if(!l||!d){S(!1);return}Dc(n,l,d).then(e=>S(e.base_needs_upload)).catch(()=>S(!1))},[l,d,n]);let M=async()=>{if(!(!l||!d||!p.trim())){dn(),i(`uploading`);try{let e=await Oc(n,{org_id:l,project_id:d,session_name:p.trim()});if(e.status===`success`&&e.session_url){j({sessionUrl:e.session_url,baseUploaded:x});let t=P?.warehouse_connection?null:await kc(n);t&&Mc(t.type)?(E(t),O(Fc(t.type,t)),ee(Nc(t.type)),hn(),i(`dw_setup`)):(b(e.session_url),i(`success`),En(),window.open(e.session_url,`_blank`))}else w(e.message||`Upload failed`),i(`error`)}catch(e){w(e instanceof Error?e.message:`An error occurred during upload`),i(`error`)}}},N=async()=>{if(!T||!A)return;let e=Pc(T.type,k),t=[];for(let n of e){let e=D[n.name]?.trim();if(n.required&&!e)t.push(`${n.label} is required`);else if(n.type===`number`&&e){let r=Number(e);Number.isFinite(r)||t.push(`${n.label} must be a valid number`)}}if(t.length>0){w(t.join(`. `)),i(`dw_error`);return}i(`dw_saving`);try{let t={type:T.type};T.type===`databricks`&&k===`oauth`&&(t.auth_type=`oauth`),T.type===`bigquery`&&(t.method=`service-account-json`);for(let n of e){let e=D[n.name];e&&(t[n.name]=n.type===`number`?Number(e):e)}await Ac(n,{org_id:l,project_id:d,connection_name:`${P?.display_name||P?.name||`Project`} DW`,config:t}),mn(),b(A.sessionUrl),i(`success`),En(),window.open(A.sessionUrl,`_blank`)}catch(e){w(e instanceof Error?e.message:`Failed to set up warehouse connection`),i(`dw_error`)}},te=()=>{A&&(gn(),b(A.sessionUrl),i(`success`),En(),window.open(A.sessionUrl,`_blank`))},ne=a.find(e=>String(e.id)===l),P=s.find(e=>String(e.id)===d),re=ne&&P?`${sn}/${ne.name}/${P.name}`:void 0,ie=l&&d&&p.trim()&&!h;return q(Wn,{open:e,onClose:r===`uploading`||r===`dw_saving`?void 0:t,maxWidth:`sm`,fullWidth:!0,slotProps:{paper:{sx:{borderRadius:`1rem`}}},children:[r===`select`&&q(G,{children:[K(qn,{sx:{textAlign:`center`,fontSize:`1.25rem`,pb:.5},children:`Upload to Recce Cloud`}),K(Kn,{children:q(X,{spacing:2,sx:{pt:.5},children:[K(Z,{variant:`body2`,sx:{color:`text.secondary`},children:`Upload your local artifacts to Recce Cloud so your team can review and query the data.`}),q(ui,{fullWidth:!0,size:`small`,children:[K(oa,{children:`Organization`}),K(sa,{value:l,label:`Organization`,onChange:e=>u(e.target.value),disabled:h,children:a.map(e=>K(ri,{value:String(e.id),children:e.display_name||e.name},e.id))})]}),q(ui,{fullWidth:!0,size:`small`,children:[K(oa,{children:`Project`}),K(sa,{value:d,label:`Project`,onChange:e=>f(e.target.value),disabled:!l||_,children:s.map(e=>K(ri,{value:String(e.id),children:e.display_name||e.name},e.id))})]}),K(pi,{fullWidth:!0,size:`small`,label:`Session Name`,value:p,onChange:e=>m(e.target.value),placeholder:`e.g., my-feature-review`}),x&&K(Z,{variant:`body2`,sx:{color:`text.secondary`},children:`Base artifacts will also be uploaded to set up the project's base environment for diffing.`})]})}),K(Gn,{sx:{px:3,pb:3},children:K(Y,{fullWidth:!0,variant:`contained`,color:`primary`,onClick:M,disabled:!ie,sx:{borderRadius:2,fontWeight:500},children:`Upload`})})]}),r===`uploading`&&K(Kn,{children:q(X,{spacing:1.5,sx:{alignItems:`center`,py:3},children:[K(or,{size:36}),K(Z,{sx:{fontWeight:500,fontSize:`1rem`},children:`Uploading artifacts...`}),K(Z,{variant:`body2`,sx:{color:`text.secondary`,textAlign:`center`},children:x?`Uploading base and current artifacts. This may take a moment.`:`This may take a moment.`})]})}),r===`dw_setup`&&T&&(()=>{let e=jc[T.type];if(!e)return null;let t=e.authMethods.length>1,n=e.authMethods.find(e=>e.value===k);return q(G,{children:[K(qn,{sx:{textAlign:`center`,fontSize:`1.25rem`,pb:.5},children:`Set Up Data Warehouse`}),K(Kn,{children:q(X,{spacing:2,sx:{pt:.5},children:[q(Z,{variant:`body2`,sx:{color:`text.secondary`},children:[`Connect your `,e.label,` warehouse so Recce Cloud can query your data. You can skip this and set it up later.`]}),e.commonFields.map(e=>K(pi,{fullWidth:!0,size:`small`,label:e.label,type:e.type===`textarea`?`text`:e.type,multiline:e.type===`textarea`,minRows:e.type===`textarea`?3:void 0,required:e.required,placeholder:e.placeholder,value:D[e.name]??``,onChange:t=>O(n=>({...n,[e.name]:t.target.value}))},e.name)),t&&q(ui,{fullWidth:!0,size:`small`,children:[K(oa,{children:`Authentication`}),K(sa,{value:k,label:`Authentication`,onChange:t=>{ee(t.target.value),O(t=>{let n={...t};for(let t of e.authMethods)for(let e of t.fields)delete n[e.name];return n})},children:e.authMethods.map(e=>K(ri,{value:e.value,children:e.label},e.value))})]}),n?.fields.map(e=>K(pi,{fullWidth:!0,size:`small`,label:e.label,type:e.type===`textarea`?`text`:e.type,multiline:e.type===`textarea`,minRows:e.type===`textarea`?3:void 0,required:e.required,placeholder:e.placeholder,value:D[e.name]??``,onChange:t=>O(n=>({...n,[e.name]:t.target.value}))},e.name))]})}),q(Gn,{sx:{px:3,pb:3,gap:1},children:[K(Y,{fullWidth:!0,variant:`outlined`,color:`neutral`,onClick:te,sx:{borderRadius:2,fontWeight:500},children:`Skip`}),K(Y,{fullWidth:!0,variant:`contained`,color:`primary`,onClick:N,sx:{borderRadius:2,fontWeight:500},children:`Setup & Continue`})]})]})})(),r===`dw_saving`&&K(Kn,{children:q(X,{spacing:1.5,sx:{alignItems:`center`,py:3},children:[K(or,{size:36}),K(Z,{sx:{fontWeight:500,fontSize:`1rem`},children:`Setting up warehouse connection...`})]})}),r===`success`&&q(Kn,{sx:{position:`relative`},children:[K(Q,{size:`small`,onClick:t,sx:{position:`absolute`,top:8,right:8},"aria-label":`Close`,children:K(Nr,{})}),q(X,{spacing:1.5,sx:{alignItems:`center`,pt:2,pb:1},children:[K(J,{component:_r,sx:{fontSize:36,color:`success.main`}}),K(Z,{sx:{fontWeight:600,fontSize:`1rem`},children:`Upload Complete`}),K(Z,{variant:`body2`,sx:{color:`text.secondary`,textAlign:`center`},children:`Your artifacts have been uploaded to Recce Cloud.`}),K(Y,{variant:`contained`,color:`primary`,href:y,target:`_blank`,component:`a`,sx:{borderRadius:2,textTransform:`none`,fontWeight:600,mt:1},children:`Open in Recce Cloud`}),re&&q(Jn,{href:re,target:`_blank`,sx:{display:`flex`,alignItems:`center`,gap:.5,fontSize:`0.8125rem`,mt:1},children:[`Go to project page `,K(Xn,{size:12})]})]})]}),r===`dw_error`&&q(G,{children:[K(Kn,{children:q(X,{spacing:1.5,sx:{alignItems:`center`,py:2},children:[K(Z,{sx:{fontWeight:500,fontSize:`1rem`},children:`Warehouse Setup Failed`}),K(Z,{variant:`body2`,sx:{color:`text.secondary`,textAlign:`center`},children:C})]})}),q(Gn,{sx:{px:3,pb:2,gap:1},children:[K(Y,{fullWidth:!0,variant:`outlined`,color:`neutral`,onClick:te,sx:{borderRadius:2,fontWeight:500},children:`Skip`}),K(Y,{fullWidth:!0,variant:`contained`,color:`primary`,onClick:()=>i(`dw_setup`),sx:{borderRadius:2,fontWeight:500},children:`Retry Setup`})]})]}),r===`error`&&q(G,{children:[K(Kn,{children:q(X,{spacing:1.5,sx:{alignItems:`center`,py:2},children:[K(Z,{sx:{fontWeight:500,fontSize:`1rem`},children:`Upload Failed`}),K(Z,{variant:`body2`,sx:{color:`text.secondary`,textAlign:`center`},children:C})]})}),K(Gn,{sx:{px:3,pb:2},children:K(Y,{fullWidth:!0,variant:`outlined`,color:`neutral`,onClick:()=>i(`select`),sx:{borderRadius:2,fontWeight:500},children:`Try Again`})})]})]})}function Lc(){let{authed:e}=ce(),{apiClient:t}=R(),[n,r]=W(null),[i,a]=W(`signup`),[o,s]=W(!1),c=Un(!1),l=V(async()=>{if(c.current)try{await an(t),c.current=!1,Dn(),a(`reload`)}catch{}},[t]);if(H(()=>{let e=()=>{document.visibilityState===`visible`&&l()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[l]),e)return q(G,{children:[K(Y,{variant:`contained`,color:`primary`,size:`small`,startIcon:K(Mr,{}),onClick:()=>{Tn({authed:!0}),s(!0)},sx:{borderRadius:`100px`,textTransform:`none`,fontWeight:600,px:2,py:.5,mr:1,whiteSpace:`nowrap`},children:`Share`}),K(Ic,{open:o,onClose:()=>s(!1)})]});let u=e=>{Tn({authed:!1}),a(`signup`),c.current=!1,r(e.currentTarget)},d=()=>{r(null),c.current=!1},f=async()=>{On();let e=window.open(``,`_blank`);try{let{connection_url:n}=await hc(t);e&&!e.closed?e.location.href=n:window.open(n,`_blank`),c.current=!0,a(`waiting`)}catch{e?.close(),a(`error`)}};return q(G,{children:[K(Y,{variant:`contained`,color:`primary`,size:`small`,startIcon:K(Mr,{}),onClick:u,sx:{borderRadius:`100px`,textTransform:`none`,fontWeight:600,px:2,py:.5,mr:1,whiteSpace:`nowrap`},children:`Share`}),K(xi,{open:!!n,anchorEl:n,onClose:d,anchorOrigin:{vertical:`bottom`,horizontal:`right`},transformOrigin:{vertical:`top`,horizontal:`right`},slotProps:{paper:{sx:{borderRadius:`12px`,p:3,maxWidth:360,mt:1}}},children:q(J,{sx:{position:`relative`},children:[K(Q,{size:`small`,onClick:d,sx:{position:`absolute`,top:-12,right:-12},"aria-label":`Close`,children:K(Nr,{})}),i===`signup`&&q(G,{children:[K(Z,{sx:{mb:3,pr:2},children:`Sign up to Recce Cloud so your team members can see and query your instance directly`}),K(Y,{variant:`contained`,color:`primary`,onClick:f,sx:{borderRadius:`8px`,textTransform:`none`,fontWeight:600,px:4,py:1},children:`Sign up`})]}),i===`waiting`&&q(X,{spacing:2,sx:{alignItems:`center`,py:1},children:[K(or,{size:40}),K(Z,{sx:{fontWeight:500,fontSize:`1.1rem`},children:`Waiting for signup...`}),K(Z,{sx:{color:`text.secondary`,textAlign:`center`},children:`Complete signup in the browser tab.`}),K(Y,{fullWidth:!0,variant:`text`,color:`primary`,size:`small`,onClick:f,sx:{textTransform:`none`},children:`Retry`})]}),i===`reload`&&q(X,{spacing:2,sx:{alignItems:`center`,py:1},children:[K(J,{component:`img`,sx:{height:`5rem`,objectFit:`contain`},src:`/imgs/reload-image.svg`,alt:`Reload`}),K(Z,{sx:{fontWeight:500,fontSize:`1.1rem`},children:`Reload to Finish`}),K(Z,{sx:{color:`text.secondary`,textAlign:`center`},children:`Signup complete! Reload to connect to Recce Cloud.`}),K(Y,{fullWidth:!0,variant:`contained`,color:`primary`,onClick:()=>window.location.reload(),sx:{borderRadius:`8px`,textTransform:`none`,fontWeight:600},children:`Reload`})]}),i===`error`&&q(X,{spacing:2,sx:{alignItems:`center`,py:1},children:[K(Z,{sx:{fontWeight:500,fontSize:`1.1rem`},children:`Connection Failed`}),K(Z,{sx:{color:`text.secondary`,textAlign:`center`},children:`Could not connect to Recce Cloud. Please try again.`}),K(Y,{fullWidth:!0,variant:`contained`,color:`primary`,onClick:f,sx:{borderRadius:`8px`,textTransform:`none`,fontWeight:600},children:`Retry`})]})]})})]})}function Rc(){let{featureToggles:e}=ce(),{apiClient:t}=R(),n=async()=>{try{let e=await ee(t),n=JSON.stringify(e,null,2);Zr(new Blob([n],{type:`application/json`}),`recce-state-${mi(new Date,`yyyy-MM-dd-HH-mm-ss`)}.json`)}catch(e){console.error(`Export failed`,e),Xt.create({title:`Export failed`,description:String(e),type:`error`,duration:5e3,closable:!0})}};return K($,{title:`Export`,children:K(Q,{size:`small`,"aria-label":`Export state`,onClick:async()=>{await n(),kn({name:`export`})},disabled:e.disableExportStateFile,children:K(J,{component:br,sx:{verticalAlign:`middle`,width:`16px`,height:`16px`}})})})}function zc(e){return/^\/checks\/([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/.test(e)}function Bc(){return K($,{title:`Syncing`,children:K(J,{sx:{mx:`10px`},children:K(or,{size:20})})})}function Vc(){let[e,t]=W(!1),n=Fn(),{apiClient:r}=R(),i=Ci(),a=Si(),{basePath:o}=F(),[s,c]=W(!1),[l,u]=W(``),{data:d}=se(),f=()=>c(!1),p=V(async e=>{if(c(!1),t(!0),(await O(e,r)).status===`conflict`){c(!0),t(!1);return}for(;await S(r);)await new Promise(e=>setTimeout(e,1e3));Xt.create({description:`Sync Completed`,type:`success`,duration:5e3,closable:!0}),t(!1),u(``),await n.invalidateQueries({queryKey:P.lineage()}),await n.invalidateQueries({queryKey:P.checks()}),await n.invalidateQueries({queryKey:P.runs()}),zc(a)&&i.push(`${o}/checks`)},[n,a,r,i.push,o]);return e?K(Bc,{}):q(G,{children:[K($,{title:`Sync with Cloud`,children:K(Q,{size:`small`,"aria-label":`Sync state`,onClick:()=>p(d?.session_id?{method:`merge`}:{}),children:K(J,{component:rr,sx:{fontSize:16,verticalAlign:`middle`}})})}),q(Wn,{open:s,onClose:f,children:[q(qn,{sx:{display:`flex`,alignItems:`center`,fontWeight:`bold`},children:[`Sync with Cloud`,K(J,{sx:{flexGrow:1}}),K(Q,{size:`small`,onClick:f,children:K(nr,{})})]}),q(Kn,{children:[K(Z,{children:`New changes have been detected in the cloud. Please choose a method to sync your state`}),K(J,{sx:{mt:`5px`},children:K(Qi,{value:l,onChange:e=>{u(e.target.value)},children:q(X,{direction:`column`,children:[K($r,{value:`merge`,control:K(Zi,{}),label:q(X,{direction:`row`,sx:{alignItems:`center`},children:[`Merge`,K($,{title:`This will merge the local and remote states.`,children:K(J,{component:xr,sx:{ml:2,cursor:`pointer`}})})]})}),K($r,{value:`overwrite`,control:K(Zi,{}),label:q(X,{direction:`row`,sx:{alignItems:`center`},children:[`Overwrite`,K($,{title:`This will overwrite the remote state file with the local state.`,children:K(J,{component:xr,sx:{ml:2,cursor:`pointer`}})})]})}),K($r,{value:`revert`,control:K(Zi,{}),label:q(X,{direction:`row`,sx:{alignItems:`center`},children:[`Revert`,K($,{title:`This will discard local changes and revert to the cloud state.`,children:K(J,{component:xr,sx:{ml:2,cursor:`pointer`}})})]})})]})})})]}),q(Gn,{children:[K(Y,{onClick:f,sx:{mr:1},children:`Cancel`}),K(Y,{color:`iochmara`,variant:`contained`,onClick:()=>p({method:l||void 0}),disabled:!l,children:`Sync`})]})]})]})}const Hc=[{path:`/lineage`,name:`Lineage`},{path:`/query`,name:`Query`},{path:`/checks`,name:`Checklist`}];function Uc({queryKey:e,fetchCallback:t,selectCallback:n}){let{data:r,isLoading:i,error:a}=Pn({queryKey:e,queryFn:t,select:n});return i||a||r===0?K(G,{}):K(J,{sx:{bgcolor:`brand.main`,display:`flex`,justifyContent:`center`,alignItems:`center`,p:1,borderRadius:`100%`,color:`white`,fontWeight:700,fontSize:`0.75rem`},children:K(`span`,{children:r})})}function Wc(){let{apiClient:e}=R();return K(Uc,{queryKey:P.checks(),fetchCallback:()=>b(e),selectCallback:e=>e.filter(e=>!e.is_checked).length})}const Gc=()=>{let e=Si(),{isDemoSite:t,isLoading:n,cloudMode:r}=L(),{featureToggles:i}=ce(),{data:a,isLoading:o}=me(),s=Un(null);return H(()=>{s.current&&s.current!==e&&wn({from:s.current,to:e}),s.current=e},[e]),K(J,{sx:{borderBottom:`1px solid lightgray`,px:`12px`},children:q(J,{sx:{display:`grid`,gridTemplateColumns:`1fr auto 1fr`,width:`100%`,alignItems:`center`},children:[K(_i,{value:U(()=>e.startsWith(`/checks`)?`/checks`:e.startsWith(`/query`)?`/query`:e.startsWith(`/runs`)?`/runs`:`/lineage`,[e]),sx:{borderBottom:`none`,minHeight:`auto`},children:Hc.map(({path:e,name:t})=>t===`Query`&&a?.single_env_onboarding?null:t===`Checklist`&&Wc?K(gi,{value:e,disabled:n||o,sx:{p:0},label:K(J,{sx:{display:`flex`,alignItems:`center`,gap:`4px`},children:q(er,{href:e,style:{textDecoration:`none`,color:`inherit`,padding:`0.875rem 1.1875rem`,display:`flex`,gap:3,alignItems:`center`},children:[t,` `,K(Wc,{})]})})},e):K(gi,{value:e,disabled:n||o,sx:{p:0},label:K(J,{sx:{display:`flex`,alignItems:`center`,gap:`4px`},children:K(er,{href:e,style:{textDecoration:`none`,color:`inherit`,padding:`0.875rem 1.1875rem`},children:t})})},e))}),K(J,{sx:{display:`flex`,alignItems:`center`,gap:`12px`,justifyContent:`center`},children:!n&&!t&&K(wc,{})}),!n&&q(J,{sx:{display:`flex`,justifyContent:`right`,alignItems:`center`,mr:`8px`},children:[!t&&!a?.single_env_onboarding&&!i.disableShare&&K(Lc,{}),K(xc,{}),r&&K(Vc,{}),K(Rc,{})]})]})})};function Kc(){let{remainingSeconds:e,isEnabled:t}=I();return!t||e===null||e>60?null:q(ca,{color:`warning`,variant:`standard`,sx:{display:`flex`,alignItems:`center`,gap:1,fontSize:`0.75rem`,mr:2},children:[K(J,{component:ir,sx:{display:`inline-flex`}}),`Idle timeout: `,en(e,`compact`)]})}const qc=()=>{let{version:e,latestVersion:t}=w(),n=U(()=>RegExp(`^\\d+\\.\\d+\\.\\d+$`),[]);return H(()=>{if(n.test(e)&&e!==t){let e=`recce-update-toast-shown`;if(sessionStorage.getItem(e))return;setTimeout(()=>{Xt.create({id:`recce-update-available`,title:`Update available`,description:q(`span`,{children:[`A new version of Recce (v`,t,`) is available.`,K(`br`,{}),`Please run`,` `,K(J,{component:`code`,sx:{bgcolor:`grey.200`,px:.5,py:.25,borderRadius:.5,fontFamily:`monospace`,fontSize:`0.875em`},children:`pip install --upgrade recce`}),` `,`to update Recce.`,K(`br`,{}),K(Jn,{sx:{color:`primary.main`,fontWeight:`bold`,"&:hover":{textDecoration:`underline`}},href:`https://github.com/DataRecce/recce/releases/tag/v${t}`,target:`_blank`,children:`Click here to view the detail of latest release`})]}),duration:60*1e3,closable:!0}),sessionStorage.setItem(e,`true`)},0)}},[e,t,n]),n.test(e)?K(Jn,{href:`https://github.com/DataRecce/recce/releases/tag/v${e}`,sx:{"&:hover":{textDecoration:`none`},fontSize:`sm`,color:`rgba(255,255,255,0.8)`,textTransform:`uppercase`,borderWidth:1,px:1,borderRadius:.75},target:`_blank`,children:e}):K(Z,{component:`span`,sx:{fontSize:`sm`,color:`rgba(255,255,255,0.8)`,textTransform:`uppercase`,borderWidth:1,px:1,borderRadius:.75},children:e})};function Jc({icon:e,href:t,sx:n,...r}){let i=Qn();return K(Jn,{sx:{height:`20px`,color:`common.white`,...n},href:t,target:`_blank`,...r,children:K(e,{style:{color:i.palette.common.white,width:20,height:20}})})}const Yc=()=>{let{reviewMode:e,isDemoSite:t,envInfo:n,cloudMode:r}=L(),{featureToggles:i,authed:a}=ce(),{url:o,id:s}=n?.pullRequest??{},c=o?o.split(`/`).pop():null,l=r||a?sn:`https://reccehq.com/`,[u,d]=W(!1);return q(J,{sx:{display:`flex`,gap:`10px`,minHeight:`40px`,alignItems:`center`,bgcolor:De.brand[400]},children:[K(Jn,{href:l,target:`_blank`,sx:{"&:hover":{textDecoration:`none`}},children:q(J,{sx:{display:`flex`,gap:`10px`,alignItems:`center`},children:[K(J,{component:`img`,sx:{width:20,height:20,ml:`18px`},src:`/logo/recce-logo-white.png`,alt:`recce-logo-white`}),K(Z,{variant:`h4`,sx:{fontFamily:`"Montserrat", sans-serif`,color:`common.white`,fontSize:`1.25rem`},children:`RECCE`})]})}),K(vc,{}),K(qc,{}),(i.mode??e)&&K(ca,{sx:{fontSize:`0.875rem`,color:`rgba(255,255,255,0.8)`,textTransform:`uppercase`,borderWidth:1,px:1,borderRadius:.75,borderColor:`rgba(255,255,255,0.8)`},children:i.mode??`review mode`}),r&&s&&K(ca,{sx:{fontSize:`0.875rem`,color:`rgba(255,255,255,0.8)`,textTransform:`uppercase`,borderWidth:1,px:1,borderRadius:.75,borderColor:`rgba(255,255,255,0.8)`},children:q(X,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[K(J,{children:`cloud mode`}),K(J,{sx:{borderLeft:`1px solid rgba(255,255,255,0.8)`,pl:`8px`},children:q(Jn,{href:o,sx:{"&:hover":{textDecoration:`none`}},target:`_blank`,children:[K(oi,{style:{color:`rgba(255,255,255,0.8)`,width:12,height:12,marginRight:2,display:`inline`,verticalAlign:`middle`}}),K(Z,{component:`span`,sx:{color:`rgba(255,255,255,0.8)`,display:`inline`},children:`#${String(s)}`})]})})]})}),t&&o&&c&&K(ca,{sx:{fontSize:`0.875rem`,color:`rgba(255,255,255,0.8)`,textTransform:`uppercase`,borderWidth:1,px:1,borderRadius:.75,borderColor:`rgba(255,255,255,0.8)`},children:q(X,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[K(J,{children:`demo mode`}),K(J,{sx:{borderLeft:`1px solid rgba(255,255,255,0.8)`,pl:`8px`},children:q(Jn,{href:o,sx:{"&:hover":{textDecoration:`none`}},target:`_blank`,children:[K(oi,{style:{color:`rgba(255,255,255,0.8)`,width:12,height:12,marginRight:2,display:`inline`,verticalAlign:`middle`}}),K(Z,{component:`span`,sx:{color:`rgba(255,255,255,0.8)`,display:`inline`},children:`#${c}`})]})})]})}),K(J,{sx:{flex:1}}),(t||i.mode===`read only`)&&q(G,{children:[K(Jc,{icon:lr,href:`https://github.com/DataRecce/recce`}),K(Jc,{icon:fr,href:`https://getdbt.slack.com/archives/C05C28V7CPP`}),K(Jc,{sx:{mr:2},icon:ur,href:`https://docs.reccehq.com`})]}),!t&&i.mode!==`read only`&&q(G,{children:[K(Kc,{}),a||r?K(J,{sx:{mr:2},children:K(_c,{})}):q(G,{children:[K(J,{component:`button`,sx:{color:`common.white`,fontSize:`0.875rem`,fontWeight:600,bgcolor:`brand.700`,borderRadius:1,px:3,py:1,mr:2,cursor:`pointer`,border:`none`},onClick:()=>{d(!0)},children:`Connect to Cloud`}),u&&K(gc,{parentOpen:u,handleParentClose:d,ignoreCookie:!0,variant:`user-profile`})]})]})]})};function Xc(){return K(J,{sx:{display:`flex`,height:`100%`,alignItems:`center`,justifyContent:`center`,contain:`size`},children:K(J,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100%`},children:K(or,{size:48})})})}function Zc({children:e,lineage:t}){let n=Si(),{isDemoSite:r,isLoading:i,isCodespace:a}=L(),{featureToggles:o}=ce(),s=n.replace(/\/$/,``)||`/`,c=s===`/lineage`||s===`/`;return H(()=>{bn()},[]),q(J,{sx:{display:`flex`,flexDirection:`column`,height:`100vh`,overflow:`hidden`},children:[K(uc,{}),K(Yc,{}),K(Gc,{}),K(Qc,{isLineageRoute:c,lineage:t,children:e}),!i&&!r&&!a&&o.mode===null&&K(gc,{})]})}function Qc({children:e,lineage:t,isLineageRoute:n,disableInternalHistory:r=!1}){let{isRunResultOpen:i,isHistoryOpen:a,closeRunResult:o}=_e(),{basePath:s}=F(),{data:c}=me(),l=Si(),u=qt(),d=i&&!l.startsWith(`${s}/checks`),f=r?!1:a&&!l.startsWith(`${s}/checks`);return q(Pt,{sizes:f?[20,80]:[0,100],minSize:0,gutterSize:5,className:f?void 0:`split-gutter-hidden`,style:{height:`100%`},children:[K(J,{style:{contain:`size`},suppressHydrationWarning:!0,children:f&&K(Re,{})}),q(ft,{sizes:d?[50,50]:[100,0],minSize:0,gutterSize:5,className:d?void 0:`split-gutter-hidden`,style:{flex:`1`,contain:`size`},children:[K(In,{fallback:K(Xc,{}),children:q(J,{sx:{p:0,contain:`content`,height:`100%`,position:`relative`},suppressHydrationWarning:!0,children:[K(J,{sx:{display:n?`block`:`none`,height:`100%`,position:n?`relative`:`absolute`,inset:0},children:t}),!n&&e]})}),K(J,{sx:{height:`100%`,bgcolor:u?`grey.900`:`grey.50`},suppressHydrationWarning:!0,children:d?K(z,{onClose:o,isSingleEnvironment:!!c?.single_env_onboarding}):null})]})]})}function $c({children:e,display:t}){let[n,r]=W(!1),i=Un(null),a=Un(null),o=V(()=>{i.current&&=(clearTimeout(i.current),null),r(!0)},[]),s=V(()=>{i.current=setTimeout(()=>{r(!1)},100)},[]);return t?q(G,{children:[K(J,{ref:a,onMouseEnter:o,onMouseLeave:s,sx:{display:`contents`},children:e}),q(xi,{open:n,anchorEl:a.current,onClose:()=>r(!1),anchorOrigin:{vertical:`bottom`,horizontal:`left`},transformOrigin:{vertical:`top`,horizontal:`left`},disableAutoFocus:!0,disableEnforceFocus:!0,sx:{pointerEvents:`none`},slotProps:{paper:{onMouseEnter:o,onMouseLeave:s,sx:{bgcolor:`grey.600`,color:`white`,p:1.5,pointerEvents:`auto`}}},children:[`Connect to a data warehouse to unlock Diff.`,` `,K(Jn,{href:cn,target:`_blank`,sx:{color:`white`,textDecoration:`underline`},children:`Learn more`}),`.`]})]}):e}function el({checksOnly:e=!0}){let t=qt(),{featureToggles:n}=ce(),r=Fn(),{apiClient:i}=R(),a=Un(null),o=Un(null),[s,c]=W(null),[l,u]=W(!1),d=Ci(),f=Si(),{basePath:p}=F(),[,h]=fe(),g=V(async()=>{if(s){try{let{runs:t,checks:n}=await m(s,e,i);h?.(),await r.invalidateQueries({queryKey:P.checks()}),await r.invalidateQueries({queryKey:P.runs()}),f.includes(`/checks`)&&d.push(`${p}/checks`);let a=e?`${n} checks imported successfully`:`${t} runs and ${n} checks imported successfully`;Xt.create({description:a,type:`info`,duration:5e3,closable:!0})}catch(e){console.error(`Import failed`,e),Xt.create({title:`Import failed`,description:String(e),type:`error`,duration:5e3,closable:!0})}u(!1)}},[r,s,f,h,e,i,d.push,p]),_=()=>{a.current&&a.current.click()},v=e=>{e.target.files?.length===1&&(c(e.target.files[0]),u(!0)),a.current&&(a.current.value=``)},y=()=>u(!1),b=e?`checks`:`runs and checks`,{isDemoSite:x}=L();return q(G,{children:[K($,{title:`Import Checklist from State File`+(x?` (Disabled in the demo site)`:``),children:K(Q,{sx:{pt:`6px`,color:t?`grey.300`:`grey.600`,"&:hover":{color:t?`grey.100`:`grey.800`},fontSize:20},"aria-label":`Import state`,onClick:()=>{_(),kn({name:`import`})},disabled:n.disableImportStateFile||x,children:K(Ki,{})})}),K(`input`,{type:`file`,style:{display:`none`},ref:a,onChange:v}),q(Wn,{open:l,onClose:y,maxWidth:`sm`,fullWidth:!0,"aria-labelledby":`import-dialog-title`,children:[q(qn,{id:`import-dialog-title`,sx:{display:`flex`,alignItems:`center`,fontWeight:`bold`},children:[`Import state`,K(J,{sx:{flexGrow:1}}),K(Q,{size:`small`,onClick:y,children:K(nr,{})})]}),K(Kn,{children:q(X,{direction:`column`,spacing:1,sx:{px:`5px`,borderRadius:1},children:[q(X,{direction:`row`,spacing:.5,sx:{alignItems:`center`},children:[K(J,{component:xr,sx:{color:`error.main`}}),K(Z,{component:`span`,sx:{fontWeight:500,color:`error.main`},children:`Caution!`})]}),q(Z,{children:[`The current `,b,` will be`,` `,K(Z,{component:`span`,sx:{fontWeight:600},children:`merged`}),` `,`with the imported state`]})]})}),q(Gn,{children:[K(Y,{ref:o,onClick:y,children:`Cancel`}),K(Y,{color:`iochmara`,variant:`contained`,onClick:g,sx:{ml:`5px`},children:`Import`})]})]})]})}function tl({check:e},t){return K(J,{sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:K(Wr,{children:K(cc,{viewOptions:{...e.params,...e.view_options},interactive:!1,ref:t})})})}const nl=Rn(tl),rl=({node:e,selected:t,onSelect:n,schemaChanged:r,isDark:i})=>{let{icon:a}=je(e.data.resourceType),o,s;return r?(o=Ut(`schema_diff`).icon,s=wt(`modified`).color):e.data.changeStatus===`added`?(o=wt(`added`).icon,s=wt(`added`).color):e.data.changeStatus===`removed`&&(o=wt(`removed`).icon,s=wt(`removed`).color),K(yi,{disablePadding:!0,children:q(J,{sx:{display:`flex`,width:`100%`,fontSize:`10pt`,p:`5px 8px`,cursor:`pointer`,"&:hover":{bgcolor:i?`grey.700`:`grey.200`},bgcolor:t?i?`grey.800`:`grey.100`:`inherit`,alignItems:`center`,gap:`5px`},onClick:()=>{n(e.id)},children:[a&&K(J,{component:a}),K(J,{sx:{flex:1,textOverflow:`ellipsis`,whiteSpace:`nowrap`,overflow:`hidden`},children:e.data.name}),o&&s&&K(J,{component:o,sx:{color:s}})]})})};function il({check:e},t){let n=qt(),{apiClient:r}=R(),{lineageGraph:i}=L(),a=e.params,{isLoading:o,error:s,data:c}=Pn({queryKey:[...P.check(e.check_id),`select`],queryFn:async()=>C({select:a.select,exclude:a.exclude,packages:a.packages,view_mode:a.view_mode},r),refetchOnMount:!0,enabled:!a.node_id}),[l,d]=U(()=>{let e=[],t=[],n=[],r=[];if(a.node_id){let t=a.node_id instanceof Array?a.node_id:[a.node_id];for(let n of t){let t=i?.nodes[n];t&&e.push(t)}}else for(let t of c?.nodes??[]){let n=i?.nodes[t];n&&e.push(n)}let o=e.filter(e=>e.data.resourceType===`model`||e.data.resourceType===`seed`||e.data.resourceType===`source`||e.data.resourceType===`snapshot`);for(let e of o)e.data.change?.columns&&Object.keys(e.data.change.columns).length>0?t.push(e.id):e.data.changeStatus===`added`?n.push(e.id):e.data.changeStatus===`removed`&&r.push(e.id);function s(e){return t.includes(e.id)?3:n.includes(e.id)?2:+!!r.includes(e.id)}return o.sort((e,t)=>{let n=s(e),r=s(t);return n===r?e.data.name.localeCompare(t.data.name):r-n}),[o,t]},[a.node_id,c?.nodes,i]),[f,p]=W(0),m=f<l.length?l[f]:void 0,{data:h}=Pn({queryKey:[`modelDetail`,m?.id],queryFn:()=>u(m?.id??``,r),enabled:!!m&&!!r,staleTime:300*1e3});if(o)return K(J,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,bgcolor:n?`grey.900`:`grey.50`,height:`100%`},children:`Loading...`});if(s)return q(J,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,bgcolor:n?`grey.900`:`grey.50`,height:`100%`},className:`no-track-pii-safe`,children:[`Error: `,s.message]});if(l.length==0)return K(J,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,bgcolor:n?`grey.900`:`grey.50`,height:`100%`},children:`No nodes matched`});if(f<l.length){let e=l[f];return q(Pt,{sizes:[80,20],minSize:30,style:{height:`100%`},children:[K(qo,{base:h?.model?.base&&Object.keys(h.model.base).length>0?{id:e.id,unique_id:e.id,name:e.data.name,...h.model.base}:void 0,current:h?.model?.current&&Object.keys(h.model.current).length>0?{id:e.id,unique_id:e.id,name:e.data.name,...h.model.current}:void 0,columnChanges:e.data.change?.columns,enableScreenshot:!0,showMenu:!1,ref:t}),K(vi,{sx:{overflow:`auto`,bgcolor:`background.paper`,listStyle:`none`},children:l.map((e,t)=>K(rl,{node:e,schemaChanged:d.includes(e.id),selected:t===f,isDark:n,onSelect:()=>{p(t)}},e.id))})]})}return K(G,{})}const al=Rn(il);function ol({checkId:t,refreshCheckList:n}){let r=Qn(),i=qt(),{apiClient:a}=R(),{featureToggles:s,sessionId:l}=ce(),{setLatestSelectedCheckId:u}=Wt(),{cloudMode:d}=L(),f=Fn(),p=Ci(),{basePath:m}=F(),{setSqlQuery:h,setBaseSqlQuery:g,setCustomQueries:_,setPrimaryKeys:v}=lt(),{successToast:y,failToast:b}=Yt(),[S,C]=W(),[w]=W(),[T,E]=W(!1),[D,O]=W(null),k=!!D,{isLoading:ee,error:j,data:M}=Pn({queryKey:P.check(t),queryFn:async()=>e(t,a),refetchOnMount:!0}),N=S??M?.last_run?.run_id,{run:te,error:ne,onCancel:re}=Ot(N),ie=S?!te||te.status===`Running`:te?.status===`Running`,ae=M?.type?Ut(M.type):void 0,oe;ae&&(oe=ae.RunResultView);let se=M?.is_preset??!1,I=Un(null),{mutate:le}=Nn({mutationFn:e=>c(t,e,a),onSuccess:async()=>{await f.invalidateQueries({queryKey:P.check(t)}),await f.invalidateQueries({queryKey:P.checks()})}}),{mutate:ue}=Nn({mutationFn:()=>x(t,a),onSuccess:async()=>{u(``),await f.invalidateQueries({queryKey:P.checks()}),p.push(`${m}/checks`)}}),{mutate:de,isPending:fe}=Nn({mutationFn:async()=>{if(!M)throw Error(`Check not found`);return await o(t,a)},onSuccess:async()=>{y(`Check marked as preset successfully`),await f.invalidateQueries({queryKey:P.check(t)})},onError:e=>{b(`Failed to mark check as preset`,e)}}),pe=V(async()=>{M?.type&&(C((await A(t,{nowait:!0},a)).run_id),await f.invalidateQueries({queryKey:P.check(t)}),n&&n())},[M,t,f,n,a]),me=async()=>{if(!M)return;let e=sl(M);if(!window.isSecureContext){b(`Failed to copy the check to clipboard`,Error(`Copy to clipboard is available only in secure contexts (HTTPS)`));return}try{await navigator.clipboard.writeText(e),y(`Copied the check to the clipboard`)}catch(e){b(`Failed to copy the check to clipboard`,e)}},he=V(()=>{let e=M?.is_checked;le({is_checked:!e}),e||Xt.create({title:`Marked as approved`,type:`success`,duration:2e3})},[M?.is_checked,le]),ge=e=>{le({view_options:e})},_e=e=>{le({description:e})},ve=e=>{O(e.currentTarget)},ye=()=>{O(null)},be=V(()=>{if(!M)return;let e=M.params;h(e?.sql_template||``),`base_sql_template`in e&&e.base_sql_template?(g(e.base_sql_template),_(!0)):(g(``),_(!1)),`primary_keys`in e&&e.primary_keys?v(e.primary_keys):v(void 0),p.push(`${m}/query`)},[M,p,m,h,g,_,v]),[xe,Se]=W(`result`),{ref:Ce,onCopyToClipboard:we,onMouseEnter:Te,onMouseLeave:Ee}=gt(),De=Be({name:M?.name??``,description:M?.description??``,type:M?.type??``,params:M?.params,viewOptions:M?.view_options});if(ee)return K(J,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100%`},children:`Loading`});if(j)return q(J,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100%`},children:[`Error: `,K(`span`,{className:`no-track-pii-safe`,children:j.message})]});if(!M)return K(ft,{minSize:100,sizes:[30,70],style:{height:`100%`,width:`100%`,maxHeight:`100%`},children:K(J,{style:{contain:`strict`},sx:{display:`flex`,flexDirection:`column`},children:K(J,{sx:{display:`flex`,p:`0px 16px`,alignItems:`center`,height:40},children:K(ke,{name:`Check not found`,disabled:!0})})})});let Oe=te?.run_at?hi(new Date(te.run_at),{addSuffix:!0}):null,Ae=ae?.icon;return q(la,{spacing:0,container:!0,sx:{height:`100%`,width:`100%`},children:[K(la,{size:{xs:12,md:d?9:12},sx:{height:`100%`},children:q(ft,{minSize:100,sizes:[40,60],style:{height:`100%`,width:`100%`,maxHeight:`100%`},children:[K(J,{sx:{height:`100%`,contain:`strict`,display:`flex`,flexDirection:`row`},children:q(J,{sx:{flex:1,height:`100%`,display:`flex`,flexDirection:`column`,overflow:`hidden`,minWidth:0},children:[q(J,{sx:{display:`flex`,p:`0px 16px`,alignItems:`center`,height:40,borderBottom:`2px solid`,borderColor:i?`grey.700`:`grey.300`},children:[Ae&&K(J,{component:Ae,sx:{fontSize:20,mr:1,flexShrink:0}}),K(ke,{name:M.name,onNameChange:e=>{le({name:e})}}),K(J,{sx:{flexGrow:1}}),q(X,{direction:`row`,spacing:2,sx:{mr:`10px`},children:[se&&K($,{title:`This is a preset check`,children:K(J,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`},children:K(Gi,{size:`1rem`,color:r.palette.iochmara.dark})})}),M?.actor_type&&!M.is_preset&&ot[M.actor_type]&&K(Pr,{label:ot[M.actor_type].label,size:`small`,sx:{height:20,fontSize:`0.65rem`,fontWeight:500,backgroundColor:ot[M.actor_type].bg,color:ot[M.actor_type].color,flexShrink:0,"& .MuiChip-label":{px:.75}}}),K(Q,{size:`small`,onClick:ve,children:K(ci,{})}),q(ni,{anchorEl:D,open:k,onClose:ye,children:[l&&q(ri,{onClick:()=>{de(),ye()},disabled:fe||se,children:[K(Ni,{children:K(tr,{})}),K(Pi,{children:`Mark as Preset Check`})]}),q(ri,{onClick:()=>{E(!0),ye()},children:[K(Ni,{children:K(da,{})}),K(Pi,{children:`Get Preset Check Template`})]}),q(ri,{onClick:()=>{me(),ye()},children:[K(Ni,{children:K(yr,{})}),K(Pi,{children:`Copy Markdown`})]}),K(ar,{}),q(ri,{onClick:()=>{ue(),ye()},disabled:s.disableUpdateChecklist,sx:{color:`error.main`},children:[K(Ni,{sx:{color:`error.main`},children:K(Ar,{})}),K(Pi,{children:`Delete`})]})]}),K($,{title:Ve({type:M.type,hasResult:!!te?.result,hasError:!!te?.error})?`Run the check first`:M.is_checked?`Remove approval`:`Mark as approved`,placement:`bottom-end`,children:K(Y,{size:`small`,color:M.is_checked?`success`:`neutral`,variant:M.is_checked?`contained`:`outlined`,onClick:()=>{he()},disabled:Ve({type:M.type,hasResult:!!te?.result,hasError:!!te?.error})||s.disableUpdateChecklist,startIcon:M.is_checked?K(_r,{}):K(ai,{style:{color:i?r.palette.grey[600]:r.palette.grey[400]}}),sx:{flex:`0 0 auto`,textTransform:`none`},children:M.is_checked?`Approved`:`Pending`})})]})]}),K(J,{sx:{flex:1,p:`8px 16px`,minHeight:100},children:K(it,{value:M.description,onChange:_e,disabled:s.disableUpdateChecklist},M.check_id)})]})}),K(J,{style:{contain:`strict`},children:q(J,{sx:{height:`100%`,display:`flex`,flexDirection:`column`},children:[q(J,{sx:{display:`flex`,alignItems:`center`,borderBottom:1,borderColor:`divider`,height:50},children:[q(_i,{value:xe,onChange:(e,t)=>Se(t),children:[K(gi,{label:`Result`,value:`result`,sx:{fontSize:`0.75rem`,textTransform:`none`}}),(M.type===`query`||M.type===`query_diff`)&&K(gi,{label:`Query`,value:`query`,sx:{fontSize:`0.75rem`,textTransform:`none`}})]}),Oe&&K(Z,{variant:`caption`,sx:{color:`text.secondary`,ml:1,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`,minWidth:0,display:`flex`,alignItems:`center`},children:Oe}),K(J,{sx:{flexGrow:1}}),q(X,{direction:`row`,spacing:1,sx:{mr:`10px`},children:[(M.type===`query`||M.type===`query_base`||M.type===`query_diff`)&&K($,{title:`Open in Query tab`,children:K(Y,{variant:`outlined`,color:`neutral`,size:`small`,onClick:be,disabled:s.disableDatabaseQuery,startIcon:K(Mi,{}),sx:{textTransform:`none`},children:`Open Query`})}),oe&&K($,{title:`Rerun`,children:K(Y,{variant:`outlined`,color:`neutral`,size:`small`,onClick:()=>pe(),disabled:s.disableDatabaseQuery||ie,startIcon:K(Or,{}),sx:{textTransform:`none`},children:ie?`Running...`:`Rerun`})}),K(Y,{variant:`outlined`,color:`neutral`,disabled:Ve({type:M.type,hasResult:!!te?.result,hasError:!!te?.error})||xe!==`result`,onMouseEnter:Te,onMouseLeave:Ee,size:`small`,onClick:async()=>{M.type===`lineage_diff`?I.current?.copyToClipboard():await we(),pn({type:M.type,from:`check`})},startIcon:K(yr,{}),sx:{textTransform:`none`},children:`Copy to Clipboard`})]})]}),q(J,{sx:{flex:1,contain:`strict`},children:[xe===`result`&&q(J,{sx:{width:`100%`,height:`100%`},children:[oe&&(M.last_run||N?K(zt,{ref:Ce,runId:N,isRunning:ie,run:N?te:M.last_run,error:ne,progress:w,RunResultView:oe,viewOptions:M.view_options,onViewOptionsChanged:ge,onCancel:re,onExecuteRun:pe}):K(J,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,bgcolor:i?`grey.900`:`grey.50`,height:`100%`},children:q(X,{spacing:2,sx:{alignItems:`center`},children:[K(J,{children:`This action is part of the initial preset and has not been performed yet. Once performed, the result will be shown here.`}),K($c,{display:s.mode===`metadata only`,children:K(Y,{onClick:pe,variant:`contained`,size:`small`,disabled:s.disableDatabaseQuery,children:`Run Query`})})]})})),M.type===`schema_diff`&&K(al,{check:M,ref:Ce},M.check_id),M.type===`lineage_diff`&&K(nl,{check:M,ref:I},M.check_id)]}),xe===`query`&&(M.type===`query`||M.type===`query_diff`||M.type===`query_base`)&&K(J,{sx:{height:`100%`,width:`100%`},children:M.params.base_sql_template?K(Fe,{value:M.params.sql_template||``,baseValue:M.params.base_sql_template??``,options:{readOnly:!0}}):K(Ke,{value:M.params.sql_template||``,options:{readOnly:!0}})})]})]})}),q(Wn,{open:T,onClose:()=>E(!1),maxWidth:`md`,fullWidth:!0,children:[K(qn,{children:`Preset Check Template`}),q(Kn,{children:[q(Z,{variant:`subtitle2`,sx:{fontWeight:`bold`,mb:2},children:[`Please`,` `,K(Z,{component:`span`,sx:{cursor:`pointer`,"&:hover":{textDecoration:`underline`},color:`primary.main`},onClick:async()=>{await navigator.clipboard.writeText(De),y(`Copied the template to the clipboard`)},children:`copy`}),` `,`the following template and paste it into the`,` `,K(J,{component:`span`,sx:{px:.5,bgcolor:`error.light`,borderRadius:.5},children:`recce.yml`}),` `,`file.`]}),K(rt,{yamlTemplate:De})]}),K(Gn,{children:K(Q,{size:`small`,onClick:()=>E(!1),sx:{position:`absolute`,top:8,right:8},children:K(nr,{})})})]})]})}),d&&K(la,{size:3,sx:{height:`100%`,overflow:`hidden`,flexShrink:0,display:{xs:`none`,md:`block`}},children:K(eo,{checkId:t})})]})}function sl(e){return ua`
|
|
7
|
+
<details><summary>${Ye({name:e.name,isChecked:e.is_checked})}</summary>
|
|
8
|
+
|
|
9
|
+
${cl(e)}
|
|
10
|
+
|
|
11
|
+
</details>`}function cl(e){let t=Ge({description:e.description});if(e.type===`query`||e.type===`query_diff`){let n=e.params;return`${t}\n\n${B({sql:n&&`sql_template`in n?n.sql_template:``})}`}return t}const ll=()=>{let e=Fn(),t=Ci(),{apiClient:n}=R(),{basePath:r}=F(),{mutate:i,isPending:a}=Nn({mutationFn:()=>_({select:`state:modified`},n),onSuccess:async n=>{await e.invalidateQueries({queryKey:P.checks()}),t.push(`${r}/checks/?id=${n.check_id}`)}});return K(He,{title:`No checks yet`,description:`Checks help you validate data quality and catch issues.`,icon:K(ji,{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.`})},ul=({check:e,selected:t,onSelect:n,onApprovalChange:r})=>{let{featureToggles:i}=ce(),a=e.last_run?.run_id,{run:o}=Ot(a),s=Ve({type:e.type,hasResult:!!o?.result,hasError:!!o?.error}),c=s||i.disableUpdateChecklist;return K(Xe,{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})},dl=({checks:e,selectedItem:t,onCheckSelected:n,onChecksReordered:r})=>{let[i,a]=W(!1),[o,s]=W(!1),[l,u]=W(null),d=Fn(),{apiClient:f}=R(),{mutate:p}=Nn({mutationFn:({checkId:e,isChecked:t})=>c(e,{is_checked:t},f),onSuccess:async(e,{checkId:t})=>{await d.invalidateQueries({queryKey:P.check(t)}),await d.invalidateQueries({queryKey:P.checks()})}}),m=e=>{e.destination&&r(e.source.index,e.destination.index)},h=()=>s(!0),g=()=>{s(!1),u(null)},_=()=>{Xt.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(fa,{onDragEnd:m,children:K(ma,{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(pa,{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(ul,{check:e,selected:e.check_id===t,onSelect:n,onApprovalChange:v},e.check_id)})}},e.check_id)),r.placeholder]})})}),q(Wn,{open:o,onClose:g,maxWidth:`xs`,fullWidth:!0,children:[q(qn,{sx:{display:`flex`,alignItems:`center`},children:[`Mark as Approved?`,K(J,{sx:{flexGrow:1}}),K(Q,{size:`small`,onClick:g,children:K(nr,{})})]}),K(ar,{}),q(Kn,{sx:{fontSize:`0.875rem`},children:[K(Z,{children:`Please ensure you have reviewed the contents of this check before marking it as approved.`}),K($r,{control:K(Qr,{checked:i,onChange:e=>{a(e.target.checked)},size:`small`}),label:K(Z,{sx:{fontWeight:`bold`,pt:`8px`},children:`Don't show this again`})})]}),K(ar,{}),q(Gn,{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`})]})]})]})},fl=()=>{let{isDark:e}=Ft(),t=e?`grey.700`:`grey.300`,n=Ci(),r=wi().get(`id`),{latestSelectedCheckId:i,setLatestSelectedCheckId:a}=Wt(),o=Fn(),{apiClient:c}=R(),{basePath:l}=F(),u=r;H(()=>{u&&a(u)},[u,a]);let{isLoading:d,error:f,data:p,status:m,refetch:h}=Pn({queryKey:P.checks(),queryFn:()=>b(c),refetchOnMount:!0}),g=V(e=>{n.push(`${l}/checks/?id=${e}`)},[n.push,l]),[_,v]=W(p??[]),[y,x]=W(p);p!==y&&(x(p),v(p??[]));let{mutate:S}=Nn({mutationFn:e=>s(e,c),onSuccess:async()=>{await o.invalidateQueries({queryKey:P.checks()})}}),C=V((e,t)=>{let n=[..._],[r]=n.splice(e,1);n.splice(t,0,r),S({source:e,destination:t}),v(n)},[_,S]),w=U(()=>!!(u&&p?.some(e=>e.check_id===u)),[u,p]);return H(()=>{m!==`success`||p.length===0||w||(i&&p.some(e=>e.check_id===i)?n.replace(`${l}/checks/?id=${i}`):n.replace(`${l}/checks/?id=${p[0].check_id}`))},[m,w,p,i,n.replace,l]),d?null:f?q(J,{children:[`Error: `,K(`span`,{className:`no-track-pii-safe`,children:f.message})]}):p?.length?q(Pt,{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(el,{checksOnly:!0})}),K(ar,{}),K(dl,{checks:_,selectedItem:u,onCheckSelected:g,onChecksReordered:C})]})}),K(J,{sx:{height:`100%`},children:w&&u&&K(ol,{checkId:u,refreshCheckList:h},u)})]}):q(Pt,{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(el,{checksOnly:!0})}),K(ar,{}),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(ll,{})})})]})},pl=()=>{let{isDark:e}=Ft();return q(Pt,{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(or,{size:20})})}),K(J,{children:K(J,{sx:{height:`100%`,display:`flex`,justifyContent:`center`,alignItems:`center`},children:K(or,{size:20})})})]})},ml={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 hl(e){let t=String(Ee(`colors.green.solid`)),n=String(Ee(`colors.red.solid`)),r=String(Ee(`colors.amber.emphasized`));return e===`added`?{color:t,icon:ut}:e===`removed`?{color:n,icon:Pe}:e===`modified`?{color:r,icon:$e}:e===`col_added`?{color:t,icon:ut}:e===`col_removed`?{color:n,icon:Pe}:e===`col_changed`?{color:r,icon:$e}:e===`folder_changed`?{color:r,icon:Vt}:{color:`inherit`,icon:void 0}}function gl(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 _l(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 vl({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:Li,sx:{mx:`2px`,fontSize:12,verticalAlign:`middle`}})})})]}),t]})}function yl({changeStatus:e,value:t}){let[n]=e?ml[e]:[``],{icon:r,color:i}=hl(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 bl({lineageGraph:e}){let{adds:t,removes:n,modifies:r,col_added:i,col_removed:a,col_changed:o}=_l(e);return q(la,{container:!0,sx:{mb:`10px`,borderTop:`1px solid`,borderColor:`divider`,p:`2.5vw`},children:[K(la,{size:6,sx:{borderColor:`divider`},children:K(vl,{name:`Code Changes`,value:q(la,{container:!0,sx:{width:`100%`},children:[K(la,{size:4,children:K(yl,{changeStatus:`added`,value:t})}),K(la,{size:4,children:K(yl,{changeStatus:`removed`,value:n})}),K(la,{size:4,children:K(yl,{changeStatus:`modified`,value:r})})]})})}),K(la,{size:6,sx:{borderLeft:`1px solid`,borderLeftColor:`divider`,pl:`12px`},children:K(vl,{name:`Column Changes`,value:q(la,{container:!0,sx:{width:`100%`},children:[K(la,{size:4,children:K(yl,{changeStatus:`col_added`,value:i})}),K(la,{size:4,children:K(yl,{changeStatus:`col_removed`,value:a})}),K(la,{size:4,children:K(yl,{changeStatus:`col_changed`,value:o})})]})})})]})}function xl({node:e,...t}){let{apiClient:n}=R(),{data:r,isLoading:i}=Pn({queryKey:[`modelDetail`,e.id],queryFn:()=>u(e.id,n),enabled:!!n,staleTime:300*1e3}),a=r?.model;return q(ha,{sx:{maxWidth:500},children:[K(_a,{title:K(Z,{sx:{fontSize:18,fontWeight:`bold`},children:t.title}),subheader:q(X,{direction:`row`,spacing:`8px`,sx:{p:`16px`},children:[K(It,{resourceType:e.data.resourceType,materialized:e.data.materialized}),e.data.resourceType===`model`&&K(Cs,{node:e})]})}),K(ga,{children:K(J,{sx:{display:`flex`},children:i?K(Xi,{variant:`rectangular`,width:`100%`,height:100}):K(qo,{base:a?.base&&Object.keys(a.base).length>0?{id:e.id,unique_id:e.id,name:e.data.name,...a.base}:void 0,current:a?.current&&Object.keys(a.current).length>0?{id:e.id,unique_id:e.id,name:e.data.name,...a.current}:void 0,columnChanges:e.data.change?.columns})})})]})}function Sl(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 Cl({lineageGraph:e}){let[t,n]=W([]);return H(()=>{n(Sl(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(xl,{title:e.data.name,node:e},e.id))})})]})}function wl({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=tt(),C=e??S.checks,w=t===void 0?S.isLoading:t,T=n??S.error,E=r??S.selectedCheckId,D=i??S.onSelectCheck,O=U(()=>C.map(e=>({id:e.check_id,name:e.name,type:e.type,description:e.description,isApproved:e.is_checked})),[C]),k=U(()=>C.find(e=>e.check_id===E),[C,E]),ee=V(e=>{D?.(e)},[D]),A=V((e,t)=>{o?.(e,t)},[o]),j=V(e=>{E&&c?.(E,e)},[E,c]),M=V(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(or,{})});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(He,{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,te=k?f?.(k):void 0,ne=k?p?.(k):void 0;return K(J,{className:x,sx:{width:`100%`,height:g},children:q(Dt,{direction:`horizontal`,sizes:[_,100-_],minSizes:[v,200],maxSizes:[y,1/0],children:[K(J,{sx:{height:`100%`,overflow:`auto`},children:K(jt,{checks:O,selectedId:E,onCheckSelect:ee,onApprovalChange:a,onReorder:s,disableApproval:m,disabledApprovalTooltip:h,title:b})}),K(J,{sx:{height:`100%`,overflow:`auto`},children:k?K(at,{checkId:k.check_id,name:k.name,type:k.type,description:k.description,isApproved:k.is_checked,tabs:N,primaryActions:te,secondaryActions:ne,onAction:A,onDescriptionChange:j,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 Tl=zn(wl);Tl.displayName=`ChecksView`;const El=`0.2.0`;export{Vo as A,ba as B,bs as C,qo as D,Wo as E,ao as F,ro as I,no as L,Fo as M,Po as N,Jo as O,wo as P,to as R,Cs as S,_s as T,ya as V,xc as _,_l as a,Gs as b,ml as c,dl as d,ll as f,Kc as g,Zc as h,bl as i,Io as j,Uo as k,pl as l,Qc as m,Tl as n,gl as o,ol as p,Cl as r,hl as s,El as t,fl as u,uc as v,ws as w,Ns as x,lc as y,Ca as z};
|
|
12
|
+
//# sourceMappingURL=src-Cm14qLUt.js.map
|