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