@datarecce/ui 1.38.0 → 1.39.0-nightly.20260305
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/{AuthModal-ze3RfE6t.js → AuthModal-DsPry4jZ.js} +3 -3
- package/dist/AuthModal-DsPry4jZ.js.map +1 -0
- package/dist/{RouteConfigContext-CHSXWHng.d.ts → RouteConfigContext-2iC0B1c-.d.ts} +4 -4
- package/dist/{RouteConfigContext-CHSXWHng.d.ts.map → RouteConfigContext-2iC0B1c-.d.ts.map} +1 -1
- package/dist/{RunProgress-DBnYyYjg.d.ts → RunProgress-1Bf4M_ku.d.ts} +17 -17
- package/dist/{RunProgress-DBnYyYjg.d.ts.map → RunProgress-1Bf4M_ku.d.ts.map} +1 -1
- package/dist/{ScreenshotDataGrid-Bics7ck0.d.ts → ScreenshotDataGrid-BPenNIN4.d.ts} +3 -3
- package/dist/{ScreenshotDataGrid-Bics7ck0.d.ts.map → ScreenshotDataGrid-BPenNIN4.d.ts.map} +1 -1
- package/dist/{SplitPane-CZo3A4If.d.ts → SplitPane-CdvsoIAu.d.ts} +33 -33
- package/dist/{SplitPane-CZo3A4If.d.ts.map → SplitPane-CdvsoIAu.d.ts.map} +1 -1
- package/dist/advanced.d.ts +13 -13
- package/dist/advanced.js +1 -1
- package/dist/components-run.d.ts +4 -4
- package/dist/components-run.js +1 -1
- package/dist/components.d.ts +13 -13
- package/dist/components.js +1 -1
- package/dist/contexts.d.ts +3 -3
- package/dist/hooks.d.ts +9 -9
- package/dist/hooks.js +1 -1
- package/dist/{index-CieDufyI.d.ts → index-ABSeOogD.d.ts} +5 -5
- package/dist/{index-CieDufyI.d.ts.map → index-ABSeOogD.d.ts.map} +1 -1
- package/dist/{index-_QkDPyCv.d.ts → index-BYlpN6s5.d.ts} +2 -2
- package/dist/{index-_QkDPyCv.d.ts.map → index-BYlpN6s5.d.ts.map} +1 -1
- package/dist/{index-B7IxhJ9h.d.ts → index-Bahn1Eez.d.ts} +11 -11
- package/dist/{index-B7IxhJ9h.d.ts.map → index-Bahn1Eez.d.ts.map} +1 -1
- package/dist/index-CN_NbCUG.d.ts.map +1 -1
- package/dist/{index-DTvn4l9a.d.ts → index-DZEOCBYs.d.ts} +5 -5
- package/dist/{index-DTvn4l9a.d.ts.map → index-DZEOCBYs.d.ts.map} +1 -1
- package/dist/{index-BW3wKlqz.d.ts → index-DZH9tgjd.d.ts} +15 -15
- package/dist/{index-BW3wKlqz.d.ts.map → index-DZH9tgjd.d.ts.map} +1 -1
- package/dist/{index-CQC8urbO.d.ts → index-Dwo3s023.d.ts} +6 -6
- package/dist/{index-CQC8urbO.d.ts.map → index-Dwo3s023.d.ts.map} +1 -1
- package/dist/index-OLba92wa.d.ts.map +1 -1
- package/dist/index.d.ts +13 -13
- package/dist/index.js +1 -1
- package/dist/instanceInfo-BioUYINl.d.ts.map +1 -1
- package/dist/{lineage-BKvO2jDz.d.ts → lineage-DJUB4FlG.d.ts} +34 -34
- package/dist/{lineage-BKvO2jDz.d.ts.map → lineage-DJUB4FlG.d.ts.map} +1 -1
- package/dist/{primitives-DnZSSnBj.d.ts → primitives-B4nq7KXR.d.ts} +27 -27
- package/dist/{primitives-DnZSSnBj.d.ts.map → primitives-B4nq7KXR.d.ts.map} +1 -1
- package/dist/primitives.d.ts +6 -6
- package/dist/primitives.js +1 -1
- package/dist/result.d.ts +2 -2
- package/dist/result.js +1 -1
- package/dist/{src-BxsK4Qs7.js → src-C3EIcsWf.js} +3 -3
- package/dist/src-C3EIcsWf.js.map +1 -0
- package/dist/{types-Dz34UJIa.d.ts → types-Bslgz7DL.d.ts} +6 -6
- package/dist/{types-Dz34UJIa.d.ts.map → types-Bslgz7DL.d.ts.map} +1 -1
- package/dist/types.d.ts +5 -5
- package/dist/utils-Ccs7TMoy.js.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/package.json +1 -1
- package/dist/AuthModal-ze3RfE6t.js.map +0 -1
- package/dist/src-BxsK4Qs7.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{C as e,F as t,H as n,J as r,P as i,Q as a,S as o,T as s,U as c,X as l,Z as u,_t as d,at as f,ct as p,et as m,f as h,gt as g,h as _,it as v,lt as y,mt as b,nt as x,ot as S,q as C,st as w,ut as T,vt as E,x as ee}from"./api-SYhhWIpP.js";import{d as te,f as D,l as O,s as k}from"./keepAlive-BWO3B6hb.js";import{C as ne,O as re,_ as A,b as ie,c as ae,g as oe,j as se,k as j,m as ce,n as le,o as ue,s as de,u as fe,v as pe,w as me}from"./utils-CCvJtImZ.js";import{_ as he,g as ge,t as _e}from"./theme-BXMsHaWD.js";import{n as M}from"./colors-DlLSByQO.js";import{At as ve,Dt as ye,Et as be,It as xe,Mt as Se,Nt as N,Ot as Ce,Q as we,S as Te,St as Ee,Tt as De,b as Oe,c as ke,ct as Ae,dt as P,i as je,jt as Me,kt as Ne,l as Pe,nt as Fe,pt as Ie,r as Le,s as Re,wt as ze,y as Be}from"./utils-Ccs7TMoy.js";import{n as Ve,t as He}from"./user-CYVsmhqS.js";import{r as Ue,t as We}from"./const-B0roUYcb.js";import{b as Ge,c as Ke,d as qe,f as Je,n as Ye,o as Xe,x as Ze}from"./track-DV9xFZGy.js";import{t as Qe}from"./ResultErrorFallback-Bwq1j3pu.js";import{useMutation as $e,useQuery as et,useQueryClient as tt}from"@tanstack/react-query";import nt from"axios";import rt,{Fragment as it,createContext as at,forwardRef as ot,memo as F,useCallback as I,useContext as st,useEffect as L,useImperativeHandle as ct,useMemo as R,useRef as z,useState as B}from"react";import{Fragment as V,jsx as H,jsxs as U}from"react/jsx-runtime";import W from"@mui/material/Box";import G from"@mui/material/Button";import lt from"@mui/material/Dialog";import ut from"@mui/material/DialogActions";import dt from"@mui/material/DialogContent";import ft from"@mui/material/DialogTitle";import pt from"@mui/material/Link";import K from"@mui/material/Stack";import q from"@mui/material/Typography";import mt from"js-cookie";import{LuChartBarBig as ht,LuExternalLink as gt}from"react-icons/lu";import _t from"@mui/material/CssBaseline";import{ThemeProvider as vt,alpha as yt,useTheme as bt}from"@mui/material/styles";import{useTheme as xt}from"next-themes";import{AllCommunityModule as St,ModuleRegistry as Ct}from"ag-grid-community";import J from"@mui/material/IconButton";import wt from"next/link";import{IoClose as Tt}from"react-icons/io5";import Et from"@mui/material/Divider";import Dt from"@mui/material/CircularProgress";import Y from"@mui/material/Tooltip";import{FaCheckCircle as Ot,FaRegCheckCircle as kt}from"react-icons/fa";import{PiBookmarkSimple as At,PiCaretDown as jt,PiChatText as Mt,PiCheck as Nt,PiCheckCircle as Pt,PiCircle as Ft,PiClipboardText as It,PiCopy as Lt,PiDotsThreeVertical as Rt,PiDownloadSimple as zt,PiImage as Bt,PiInfo as Vt,PiNotePencil as Ht,PiPencilSimple as Ut,PiPlusCircle as Wt,PiRepeat as Gt,PiTable as Kt,PiTrashSimple as qt,PiWarning as Jt,PiX as Yt}from"react-icons/pi";import Xt from"@mui/material/Chip";import{Background as Zt,BaseEdge as Qt,Controls as $t,EdgeLabelRenderer as en,Handle as tn,MiniMap as nn,Position as rn,ReactFlow as an,ReactFlowProvider as on,getBezierPath as sn,useEdgesState as cn,useNodesState as ln}from"@xyflow/react";import un from"file-saver";import dn from"@mui/material/Checkbox";import fn from"@mui/material/FormControlLabel";import pn from"@mui/material/ButtonGroup";import{useTimeout as mn}from"usehooks-ts";import hn from"@mui/material/Alert";import gn from"@mui/material/InputBase";import _n from"@mui/material/Menu";import X from"@mui/material/MenuItem";import vn from"lodash";import{VscKebabVertical as yn,VscKey as bn}from"react-icons/vsc";import xn from"@mui/material/ListSubheader";import Sn from"@mui/material/FormControl";import Cn from"@mui/material/FormLabel";import wn from"@mui/material/NativeSelect";import Tn from"@mui/material/TextField";import En from"@mui/material/Tab";import Dn from"@mui/material/Tabs";import On from"@mui/material/List";import kn from"@mui/material/ListItem";import{toCanvas as An,toPng as jn}from"html-to-image";import"@xyflow/react/dist/style.css";import Mn from"yaml";import{PostgreSQL as Nn,sql as Pn}from"@codemirror/lang-sql";import{yaml as Fn}from"@codemirror/lang-yaml";import{EditorState as In,Prec as Ln}from"@codemirror/state";import{EditorView as Rn,keymap as zn,lineNumbers as Bn}from"@codemirror/view";import{githubDark as Vn,githubLight as Hn}from"@uiw/codemirror-theme-github";import Un from"@uiw/react-codemirror";import Wn from"@mui/material/Avatar";import Gn from"@mui/material/Popover";import{format as Kn,formatDistanceToNow as qn}from"date-fns";import Jn from"@mui/material/LinearProgress";import{BarElement as Yn,CategoryScale as Xn,Chart as Zn,Legend as Qn,LinearScale as $n,TimeSeriesScale as er,Title as tr,Tooltip as nr}from"chart.js";import{Bar as rr,Chart as ir}from"react-chartjs-2";import{AgGridReact as ar}from"ag-grid-react";import{MergeView as or,unifiedMergeView as sr}from"@codemirror/merge";import cr from"react-markdown";import{Prism as lr}from"react-syntax-highlighter";import{oneDark as ur}from"react-syntax-highlighter/dist/esm/styles/prism";import dr from"remark-gfm";import fr from"react-split";import{amber as pr}from"@mui/material/colors";import{usePathname as mr,useRouter as hr}from"next/navigation";import{MdFormatListNumberedRtl as gr,MdSchema as _r}from"react-icons/md";import{TbAlignBoxLeftStretch as vr,TbBrandStackshare as yr,TbChartHistogram as br,TbCloudUpload as xr,TbEyeEdit as Sr,TbEyeSearch as Cr,TbSql as wr}from"react-icons/tb";import Tr from"@mui/material/Autocomplete";import Z from"@mui/material/ListItemIcon";import Q from"@mui/material/ListItemText";import{FiInfo as Er}from"react-icons/fi";import{FaPlay as Dr}from"react-icons/fa6";import{ErrorBoundary as Or}from"@sentry/react";function kr({children:e,forcedTheme:t,enableCssBaseline:n=!1}){let{resolvedTheme:r}=xt();return L(()=>{(t??r)===`dark`?document.documentElement.classList.add(`dark`):document.documentElement.classList.remove(`dark`)},[t,r]),U(vt,{theme:_e,children:[n&&H(_t,{}),e]})}const Ar=at({checks:[],isLoading:!1});Ar.displayName=`RecceCheckContext`;function jr({children:e,checks:t=[],isLoading:n=!1,error:r,selectedCheckId:i,onSelectCheck:a,onCreateCheck:o,onUpdateCheck:s,onDeleteCheck:c,onReorderChecks:l,refetchChecks:u,latestSelectedCheckId:d,setLatestSelectedCheckId:f}){let p=i??d,m=a??f,h=R(()=>({checks:t,isLoading:n,error:r,selectedCheckId:p,onSelectCheck:m,onCreateCheck:o,onUpdateCheck:s,onDeleteCheck:c,onReorderChecks:l,refetchChecks:u,latestSelectedCheckId:p,setLatestSelectedCheckId:m}),[t,n,r,p,m,o,s,c,l,u]);return H(Ar.Provider,{value:h,children:e})}function Mr(){return st(Ar)}const Nr=at({sql:``,isExecuting:!1});Nr.displayName=`RecceQueryContext`;function Pr({children:e,sql:t=``,isExecuting:n=!1,error:r,baseResult:i,currentResult:a,onSqlChange:o,onExecute:s,onCancel:c,sqlQuery:l,setSqlQuery:u,primaryKeys:d,setPrimaryKeys:f,isCustomQueries:p,setCustomQueries:m,baseSqlQuery:h,setBaseSqlQuery:g}){let _=R(()=>({sql:t,isExecuting:n,error:r,baseResult:i,currentResult:a,onSqlChange:o,onExecute:s,onCancel:c,sqlQuery:l,setSqlQuery:u,primaryKeys:d,setPrimaryKeys:f,isCustomQueries:p,setCustomQueries:m,baseSqlQuery:h,setBaseSqlQuery:g}),[t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g]);return H(Nr.Provider,{value:_,children:e})}function Fr(){return st(Nr)}function Ir({children:e}){let[t,n]=B(``);return H(jr,{selectedCheckId:t,onSelectCheck:n,latestSelectedCheckId:t,setLatestSelectedCheckId:n,children:e})}const Lr=()=>{};function Rr(){let e=Mr();return{latestSelectedCheckId:e.latestSelectedCheckId??``,setLatestSelectedCheckId:e.setLatestSelectedCheckId??Lr}}const zr=24,Br=280,Vr={added:`#22c55e`,removed:`#ef4444`,modified:`#f59e0b`},Hr={passthrough:{letter:`P`,color:`default`},renamed:{letter:`R`,color:`warning`},derived:{letter:`D`,color:`warning`},source:{letter:`S`,color:`info`},unknown:{letter:`U`,color:`error`}};function Ur({size:e=14}){return U(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,children:[H(`circle`,{cx:`8`,cy:`3`,r:`1.5`}),H(`circle`,{cx:`8`,cy:`8`,r:`1.5`}),H(`circle`,{cx:`8`,cy:`13`,r:`1.5`})]})}function Wr({changeStatus:e}){if(!e)return null;let t=Vr[e];return H(W,{sx:{width:14,height:14,borderRadius:`50%`,backgroundColor:t,color:`white`,fontSize:10,fontWeight:`bold`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:{added:`+`,removed:`-`,modified:`~`}[e]})}function Gr({transformationType:e}){if(!e)return null;let t=Hr[e];return H(Xt,{label:t.letter,size:`small`,color:t.color,sx:{fontSize:`8pt`,height:18,minWidth:18,"& .MuiChip-label":{px:.5}}})}function Kr({id:e,data:t,showContent:n=!0,showChangeAnalysis:r=!1,isDark:i=!1,onColumnClick:a,onContextMenu:o}){let{column:s,type:c,transformationType:l,changeStatus:u,isHighlighted:d=!0,isFocused:f=!1}=t,[p,m]=B(!1);return n?U(W,{onClick:()=>a?.(e),sx:{display:`flex`,width:280,padding:`0px 10px`,border:`1px solid`,borderColor:`divider`,backgroundColor:f?`action.selected`:p?`action.hover`:`background.paper`,filter:d?`none`:`opacity(0.2) grayscale(50%)`,cursor:`pointer`,transition:`background-color 0.15s ease`},onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),children:[U(W,{sx:{display:`flex`,fontSize:`11px`,color:`text.primary`,width:`100%`,gap:`6px`,alignItems:`center`,height:`23px`},children:[r&&u?H(Wr,{changeStatus:u}):H(Gr,{transformationType:l}),H(W,{sx:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,flexGrow:1,height:`25px`,lineHeight:`25px`},children:s}),p&&o?H(W,{sx:{display:`inline-flex`,alignItems:`center`,cursor:`pointer`,"&:hover":{color:`text.primary`}},onClick:t=>{t.preventDefault(),t.stopPropagation(),o(t,e)},"data-testid":`column-kebab-menu`,children:H(Ur,{size:14})}):c&&H(W,{sx:{color:`text.secondary`,fontSize:`10px`,flexShrink:0},children:c})]}),H(tn,{type:`target`,position:rn.Left,isConnectable:!1,style:{left:0,visibility:`hidden`}}),H(tn,{type:`source`,position:rn.Right,isConnectable:!1,style:{right:0,visibility:`hidden`}})]}):null}const qr=F(Kr);qr.displayName=`LineageColumnNode`;const Jr=e=>H(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 16 16`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:H(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M1.5 1h13l.5.5v13l-.5.5h-13l-.5-.5v-13l.5-.5zM2 2v12h12V2H2zm6.5 2.5v2.5h2.5v1H8.5v2.5h-1V8H5V7h2.5V4.5h1z`})}),Yr=e=>H(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 16 16`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:H(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M1.5 1h13l.5.5v13l-.5.5h-13l-.5-.5v-13l.5-.5zM2 2v12h12V2H2zm3 5.5h6v1H5v-1z`})}),Xr=e=>U(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 16 16`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[H(`path`,{d:`M1.5 1h13l.5.5v13l-.5.5h-13l-.5-.5v-13l.5-.5zM2 2v12h12V2H2z`}),H(`path`,{d:`M10.6 8.7c-.1.1-.3.2-.5.2h-.1l-1.4-.3c-.5-.1-1.1-.3-1.8-.3-.6 0-1 .2-1.3.5-.2.2-.2.4-.2.7v.1l-.9.3v-.2c0-.3 0-.6.1-.9.2-.4.5-.8 1-1.1.5-.4 1.2-.5 2-.5h.2l1.5.4h.1c.5.1 1 .3 1.5.3.6 0 .9-.2 1.2-.4.2-.2.3-.5.3-.8v-.3l.8-.3h.1v.3c0 .6-.2 1.2-.6 1.6-.2.2-.3.4-.5.5l-.5.2z`})]}),Zr=e=>H(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 16 16`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:H(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M8 11a3 3 0 1 0 0-6 3 3 0 0 0 0 6z`})}),Qr=e=>H(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:H(`path`,{d:`M239.1 6.3l-208 78c-18.7 7-31.1 25-31.1 45v225.1c0 18.2 10.3 34.8 26.5 42.9l208 104c13.5 6.8 29.4 6.8 42.9 0l208-104c16.3-8.1 26.5-24.8 26.5-42.9V129.3c0-20-12.4-37.9-31.1-44.9l-208-78C262 2.2 250 2.2 239.1 6.3zM256 68.4l192 72v1.1l-192 78-192-78v-1.1l192-72zm32 356V275.5l160-65v133.9l-160 80z`})}),$r=e=>H(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 448 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:H(`path`,{d:`M448 73.143v45.714C448 159.143 347.667 192 224 192S0 159.143 0 118.857V73.143C0 32.857 100.333 0 224 0s224 32.857 224 73.143zM448 176v102.857C448 319.143 347.667 352 224 352S0 319.143 0 278.857V176c48.125 33.143 136.208 48.572 224 48.572S399.874 209.143 448 176zm0 160v102.857C448 479.143 347.667 512 224 512S0 479.143 0 438.857V336c48.125 33.143 136.208 48.572 224 48.572S399.874 369.143 448 336z`})}),ei=e=>H(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:H(`path`,{d:`M64 96H0c0 123.7 100.3 224 224 224v144c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V320C288 196.3 187.7 96 64 96zm384-64c-84.2 0-157.4 46.5-195.7 115.2 27.7 30.2 48.2 66.9 59 107.6C424 243.1 512 147.9 512 32h-64z`})}),ti=e=>H(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:H(`path`,{d:`M512 144v288c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V144c0-26.5 21.5-48 48-48h88l12.3-32.9c7-18.7 24.9-31.1 44.9-31.1h125.5c20 0 37.9 12.4 44.9 31.1L376 96h88c26.5 0 48 21.5 48 48zM376 288c0-66.2-53.8-120-120-120s-120 53.8-120 120 53.8 120 120 120 120-53.8 120-120zm-32 0c0 48.5-39.5 88-88 88s-88-39.5-88-88 39.5-88 88-88 88 39.5 88 88z`})}),ni=e=>H(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 448 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:H(`path`,{d:`M160 80c0-26.5 21.5-48 48-48h32c26.5 0 48 21.5 48 48v352c0 26.5-21.5 48-48 48h-32c-26.5 0-48-21.5-48-48V80zM0 272c0-26.5 21.5-48 48-48h32c26.5 0 48 21.5 48 48v160c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V272zM368 96h32c26.5 0 48 21.5 48 48v288c0 26.5-21.5 48-48 48h-32c-26.5 0-48-21.5-48-48V144c0-26.5 21.5-48 48-48z`})}),ri=e=>H(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:H(`path`,{d:`M0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zm320 96c0-15.9-5.8-30.4-15.3-41.6l76.6-147.4c6.1-11.8 1.5-26.3-10.2-32.4s-26.2-1.5-32.4 10.2L262.1 288.3c-2-.2-4-.3-6.1-.3c-35.3 0-64 28.7-64 64s28.7 64 64 64s64-28.7 64-64z`})}),ii=e=>H(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:H(`path`,{d:`M418.4 157.9c35.3-8.3 61.6-40 61.6-77.9c0-44.2-35.8-80-80-80c-43.4 0-78.7 34.5-80 77.5L136.2 151.1C121.7 136.8 101.9 128 80 128c-44.2 0-80 35.8-80 80s35.8 80 80 80c12.2 0 23.8-2.7 34.1-7.6L259.7 407.8c-2.4 7.6-3.7 15.8-3.7 24.2c0 44.2 35.8 80 80 80s80-35.8 80-80c0-27.7-14-52.1-35.4-66.4l37.8-207.7zM156.3 232.2c2.2-6.9 3.5-14.2 3.7-21.7l183.8-73.5c3.6 3.5 7.4 6.7 11.6 9.5L317.6 354.1c-5.5 1.3-10.8 3.1-15.8 5.5L156.3 232.2z`})});function ai(e,t){return e===`added`?{color:M.green[500],hexColor:M.green[500],backgroundColor:t?M.green[900]:M.green[100],hexBackgroundColor:t?M.green[900]:M.green[100],icon:Jr}:e===`removed`?{color:M.red[500],hexColor:M.red[500],backgroundColor:t?M.red[950]:M.red[200],hexBackgroundColor:t?M.red[950]:M.red[200],icon:Yr}:e===`modified`?{color:M.amber[500],hexColor:M.amber[500],backgroundColor:t?M.amber[900]:M.amber[100],hexBackgroundColor:t?M.amber[900]:M.amber[100],icon:Xr}:{color:M.neutral[500],hexColor:M.neutral[500],backgroundColor:t?M.neutral[700]:M.white,hexBackgroundColor:t?M.neutral[700]:M.white,icon:void 0}}function oi(e){switch(e){case`model`:return{color:M.cyan[200],icon:Qr};case`source`:return{color:M.green[300],icon:$r};case`seed`:return{color:M.green[500],icon:ei};case`snapshot`:return{color:M.green[500],icon:ti};case`metric`:return{color:M.rose[200],icon:ni};case`exposure`:return{color:M.rose[200],icon:ri};case`semantic_model`:return{color:M.rose[400],icon:ii};default:return{color:`inherit`,icon:void 0}}}M.green[500],M.red[500],M.amber[500],M.neutral[500],M.green[100],M.red[200],M.amber[100],M.white,M.green[900],M.red[950],M.amber[900],M.neutral[700];const si={added:`#22c55e`,removed:`#ef4444`,modified:`#f59e0b`,unchanged:`#94a3b8`};function ci({id:e,sourceX:t,sourceY:n,targetX:r,targetY:i,sourcePosition:a,targetPosition:o,data:s,selected:c}){let l=s?.changeStatus??`unchanged`,u=s?.isHighlighted??!1,d=s?.label,[f,p,m]=sn({sourceX:t,sourceY:n,sourcePosition:a,targetX:r,targetY:i,targetPosition:o}),h=si[l];return U(V,{children:[H(Qt,{id:e,path:f,style:{stroke:h,strokeWidth:u||c?2.5:1.5,opacity:u||c?1:.6}}),d&&H(en,{children:H(`div`,{style:{position:`absolute`,transform:`translate(-50%, -50%) translate(${p}px,${m}px)`,fontSize:10,fontWeight:500,background:`white`,padding:`2px 4px`,borderRadius:4,pointerEvents:`all`},children:d})})]})}const li=F(ci);li.displayName=`LineageEdge`;function ui({changedOnly:e,onChange:t}){return H(fn,{control:H(dn,{checked:e??!1,onChange:()=>{t()},size:`small`}),label:`Changed only`,slotProps:{typography:{variant:`body2`}}})}function di({value:e,onChange:t,textOn:n,textOff:r}){return U(pn,{variant:`outlined`,size:`xsmall`,sx:{borderRadius:1},children:[H(G,{onClick:()=>{t(!1)},sx:{color:e?`text.disabled`:`text.primary`,bgcolor:e?`action.hover`:`background.paper`,borderColor:`divider`,"&:hover":{bgcolor:e?`action.selected`:`background.paper`,borderColor:`divider`}},children:r??`Off`}),H(G,{onClick:()=>{t(!0)},sx:{color:e?`text.primary`:`text.disabled`,bgcolor:e?`background.paper`:`action.hover`,borderColor:`divider`,"&:hover":{bgcolor:e?`background.paper`:`action.selected`,borderColor:`divider`}},children:n??`On`})]})}function fi({displayMode:e,onDisplayModeChanged:t}){return U(V,{children:[e===`inline`&&U(V,{children:[H(Ie,{value:`Base`,colorPalette:`red`,grayOut:!1,fontSize:`10pt`,noCopy:!0}),H(Ie,{value:`Current`,colorPalette:`green`,grayOut:!1,fontSize:`10pt`,noCopy:!0})]}),H(di,{value:e===`side_by_side`,onChange:e=>{t(e?`side_by_side`:`inline`)},textOff:`Inline`,textOn:`Side by side`})]})}const pi=e=>{let{defaultValues:t,suggestionList:n,onValuesChange:r,className:i}=e,[a,o]=B(t??[]),[s,c]=B(``),[l,u]=B(!1),[d,f]=B(null),p=z(null),m=!!d,h=t=>t.length>1?`${t.length} ${e.unitName}s selected`:t.length===1?t[0]:``,g=e=>{f(e.currentTarget),setTimeout(()=>p.current?.focus(),100)},_=()=>{f(null),u(!1)},v=e=>{a.includes(e)||(c(``),o([...a,e]),r([...a,e]))},y=()=>{c(``),o([]),r([])},b=e=>{o(a.filter(t=>t!==e)),r(a.filter(t=>t!==e))},x=s.toLowerCase(),S=n?.filter(e=>x===``||e.toLowerCase().includes(x)).filter(e=>!a.includes(e))??[],C=()=>{switch(e.size){case`2xs`:return`0.625rem`;case`xs`:return`0.75rem`;case`sm`:return`0.875rem`;default:return`0.875rem`}};return U(W,{sx:{display:`flex`,alignItems:`center`,width:e.width},className:i,children:[U(G,{variant:`outlined`,color:`neutral`,size:`small`,onClick:g,disabled:e.disabled,sx:{width:`100%`,height:(()=>{switch(e.size){case`2xs`:return 24;case`xs`:return 28;case`sm`:return 32;default:return 36}})(),justifyContent:`space-between`,textTransform:`none`,fontSize:C(),fontWeight:`normal`,px:1},children:[H(q,{component:`span`,sx:{fontSize:C(),color:a.length>0?`text.primary`:`text.secondary`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:h(a)||e.placeholder||``}),a.length>0&&H(q,{component:`span`,onClick:e=>{e.stopPropagation(),y()},sx:{fontSize:C(),color:`primary.main`,cursor:`pointer`,ml:1,"&:hover":{textDecoration:`underline`}},children:`Clear`})]}),U(_n,{anchorEl:d,open:m,onClose:_,slotProps:{paper:{sx:{width:e.width,fontSize:C()}}},children:[H(W,{sx:{px:.5,py:.5},children:U(W,{sx:{border:`1px solid`,borderColor:`divider`,borderRadius:1,p:.5,display:`flex`,flexWrap:`wrap`,gap:.5,alignItems:`center`},className:`no-track-pii-safe`,children:[a.map(e=>H(Xt,{label:e,size:`small`,onDelete:()=>b(e),sx:{height:22,fontSize:C()}},e)),H(gn,{inputRef:p,placeholder:`Filter or add custom keys`,value:s,onChange:e=>{c(e.target.value),u(!0)},onKeyDown:e=>{e.key!==`Escape`&&e.stopPropagation();let t=e.target,n=t.value.trim().replace(`,`,``);switch(e.key){case`,`:case`Enter`:e.preventDefault(),n&&(v(n),c(``));break;case`Backspace`:t.value===``&&a.length>0&&(o(a.slice(0,-1)),r(a.slice(0,-1)));break;default:break}},onBlur:()=>{p.current&&l&&p.current.focus()},sx:{flex:1,minWidth:120,fontSize:C(),"& input":{p:.5}}})]})}),H(Et,{}),s!==``&&!n?.includes(s)&&U(X,{onClick:()=>{v(s),u(!1)},sx:{fontSize:C()},children:[`Add '`,s,`' to the list`]}),S.slice(0,10).map((e,t)=>H(X,{onClick:()=>{v(e)},sx:{fontSize:C()},children:e},vn.uniqueId(`option-${t}`))),S.length>10&&H(Y,{title:`Please use filter to find more items`,placement:`top`,children:U(W,{px:1.5,py:.5,color:`text.secondary`,fontSize:`8pt`,children:[`and `,S.length-10,` more items...`]})})]})]})};function mi(e){let t=[`CHAR`,`VARCHAR`,`TINYTEXT`,`TEXT`,`MEDIUMTEXT`,`LONGTEXT`,`NCHAR`,`NVARCHAR`,`VARCHAR2`,`NVARCHAR2`,`CLOB`,`NCLOB`,`VARCHAR(MAX)`,`XML`,`JSON`],n=e.trim().toUpperCase();return t.includes(n)?!0:/^(VARCHAR|NVARCHAR|VARCHAR2|NVARCHAR2|CHAR|NCHAR)\(\d+\)$/.test(n)}function hi(e){return[`BOOLEAN`,`TINYINT(1)`,`BIT`,`NUMBER(1)`,`BOOL`].includes(e.toUpperCase())}function gi(e){return[`DATE`,`DATETIME`,`TIMESTAMP`,`TIME`,`YEAR`,`DATETIME2`,`SMALLDATETIME`,`DATETIMEOFFSET`,`INTERVAL`,`TIMESTAMPTZ`,`TIMETZ`,`TIMESTAMP WITH TIME ZONE`,`TIMESTAMP WITH LOCAL TIME ZONE`,`TIMESTAMP_LTZ`,`TIMESTAMP_NTZ`,`TIMESTAMP_TZ`].includes(e.toUpperCase())}function _i(e){return!mi(e)&&!hi(e)&&!gi(e)}function vi({params:e,onParamsChanged:t,setIsReadyToExecute:n}){let{columns:r,isLoading:i,error:a}=il(e.model),o=r.filter(e=>!mi(e.type)&&!hi(e.type)&&!gi(e.type));return i?H(W,{children:`Loading...`}):r.length===0||a?H(W,{children:`Error: Please provide the 'catalog.json' to list column candidates`}):H(W,{sx:{m:`16px`},children:U(Sn,{fullWidth:!0,disabled:o.length===0,children:[H(Cn,{sx:{mb:1},children:`Pick a column to show Histogram Diff`}),U(wn,{value:e.column_name,onChange:r=>{let i=r.target.value;n(!!i);let a=o.find(e=>e.name===i)?.type??``;t({...e,column_name:i,column_type:a})},children:[H(`option`,{value:``,children:o.length===0?`No numeric column is available`:`Select column`}),o.map(e=>U(`option`,{value:e.name,className:`no-track-pii-safe`,children:[e.name,` : `,e.type]},e.name))]})]})})}const yi=[{status:`added`,label:`Added`,description:`Newly added resource`},{status:`removed`,label:`Removed`,description:`Removed resource`},{status:`modified`,label:`Modified`,description:`Modified resource`}],bi=[{type:`passthrough`,label:`Passthrough`,description:`Column passes through unchanged`},{type:`renamed`,label:`Renamed`,description:`Column was renamed from source`},{type:`derived`,label:`Derived`,description:`Column is derived from other columns`},{type:`source`,label:`Source`,description:`Original source column`},{type:`unknown`,label:`Unknown`,description:`Transformation type could not be determined`}],xi={added:{color:`#22c55e`,symbol:`+`},removed:{color:`#ef4444`,symbol:`-`},modified:{color:`#f59e0b`,symbol:`~`}},Si={passthrough:{letter:`P`,color:`default`},renamed:{letter:`R`,color:`warning`},derived:{letter:`D`,color:`warning`},source:{letter:`S`,color:`info`},unknown:{letter:`U`,color:`error`}};function Ci({status:e}){let t=xi[e];return H(W,{sx:{width:16,height:16,borderRadius:`50%`,backgroundColor:t.color,color:`white`,fontSize:10,fontWeight:`bold`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:t.symbol})}function wi({type:e}){let t=Si[e];return H(Xt,{label:t.letter,size:`small`,color:t.color,sx:{fontSize:`8pt`,height:18,minWidth:18,"& .MuiChip-label":{px:.5}}})}function Ti({variant:e,showTooltips:t=!0,title:n,className:r}){let i=e===`changeStatus`?yi:bi;return U(W,{className:r,sx:{bgcolor:`background.paper`,padding:`12px`,border:`1px solid`,borderColor:`divider`,borderRadius:1,fontSize:`0.875rem`},children:[n&&H(q,{variant:`caption`,sx:{display:`block`,fontWeight:600,mb:1,color:`text.secondary`},children:n}),e===`changeStatus`&&i.map(e=>{let n=U(W,{sx:{display:`flex`,alignItems:`center`,gap:`8px`,mb:`4px`,"&:last-child":{mb:0}},children:[H(Ci,{status:e.status}),H(q,{variant:`body2`,children:e.label})]},e.status);return t&&e.description?H(Y,{title:e.description,placement:`right`,children:n},e.status):n}),e===`transformation`&&i.map(e=>{let n=U(W,{sx:{display:`flex`,alignItems:`center`,gap:`8px`,mb:`4px`,"&:last-child":{mb:0}},children:[H(wi,{type:e.type}),H(q,{variant:`body2`,children:e.label})]},e.type);return t&&e.description?H(Y,{title:e.description,placement:`right`,children:n},e.type):n})]})}const Ei={breaking:`Breaking`,non_breaking:`Non Breaking`,partial_breaking:`Partial Breaking`,unknown:`Unknown`},Di=()=>H(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 16 16`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,children:H(`path`,{d:`M8 3a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm0 6.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm0 6.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z`})}),Oi=()=>H(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,children:H(`path`,{d:`M256 56c110.532 0 200 89.451 200 200 0 110.532-89.451 200-200 200-110.532 0-200-89.451-200-200 0-110.532 89.451-200 200-200m0-48C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm0 168c-44.183 0-80 35.817-80 80s35.817 80 80 80 80-35.817 80-80-35.817-80-80-80z`})});function ki({name:e,color:t,resourceType:n}){let r=n===`model`?e:`${e} (${n||`unknown`})`;return H(W,{sx:{flex:1,color:t,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:H(Y,{title:r,placement:`top`,children:H(`span`,{children:e})})})}function Ai({id:e,data:t,selected:n,interactive:r=!1,selectMode:i=`normal`,isNodeSelected:a=!1,isFocused:o=!1,isHighlighted:s=!0,showContent:c=!0,actionTag:l,showChangeAnalysis:u=!1,changeCategory:d,runsAggregatedTag:f,hasParents:p=!0,hasChildren:m=!0,columnCount:h=0,columnHeight:g=28,isDark:_=!1,onNodeClick:v,onNodeDoubleClick:y,onSelect:b,onContextMenu:x,onShowImpactRadius:S}){let[C,w]=B(!1),{label:T,changeStatus:E=`unchanged`,isSelected:ee,resourceType:te}=t,D=a||ee||n||!1,O=h>0,k=i===`action_result`&&l,{icon:ne,color:re,backgroundColor:A}=ai(E,_),{icon:ie}=oi(te),ae=re,oe=(()=>{let e=_?`#1e1e1e`:`#ffffff`;return c?i===`selecting`?D?re:e:i===`action_result`?k?o||D||C?A:re:e:o||D||C?A:e:o||D||C?re:A})(),se=(()=>{let e=_?`#ffffff`:`#000000`,t=_?`#000000`:`#ffffff`;return i===`selecting`?D?t:e:i===`action_result`&&k&&!D?t:e})(),j=(()=>{let e=_?`#ffffff`:`#000000`,t=_?`#000000`:`#ffffff`;return i===`selecting`?D?t:e:i===`action_result`&&k&&!D?t:e})(),ce=(()=>{let e=_?`#ffffff`:`#000000`,t=_?`#000000`:`#ffffff`;return i===`selecting`?D?t:re:i===`action_result`?k&&!D?t:e:re})(),le=(()=>i===`action_result`?k?`none`:`opacity(0.2) grayscale(50%)`:s||o||D||C?`none`:`opacity(0.2) grayscale(50%)`)(),ue=t=>{i!==`action_result`&&(t.stopPropagation(),b?.(e))},de=t=>{t.preventDefault(),t.stopPropagation(),x?.(t,e)},fe=t=>{t.preventDefault(),t.stopPropagation(),S?.(e)};return U(W,{onClick:()=>v?.(e),onDoubleClick:()=>y?.(e),onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),sx:{display:`flex`,flexDirection:`column`,width:300,cursor:i===`selecting`?`pointer`:`inherit`,transition:`box-shadow 0.2s ease-in-out`,padding:0,filter:le},children:[U(W,{sx:{display:`flex`,borderColor:ae,borderWidth:`2px`,borderStyle:`solid`,borderTopLeftRadius:8,borderTopRightRadius:8,borderBottomLeftRadius:O?0:8,borderBottomRightRadius:O?0:8,backgroundColor:oe,height:60},children:[H(W,{sx:{display:`flex`,bgcolor:re,padding:r?`8px`:`2px`,borderRightWidth:`2px`,borderRightStyle:`solid`,borderColor:i===`selecting`?`#00000020`:ae,alignItems:`top`,visibility:c?`inherit`:`hidden`},children:r&&H(dn,{checked:i===`selecting`&&D||i===`action_result`&&!!k,onClick:ue,disabled:i===`action_result`,size:`small`,sx:{padding:0,color:`inherit`,"&.Mui-checked":{color:`inherit`}}})}),U(W,{sx:{display:`flex`,flex:`1 0 auto`,mx:.5,width:100,flexDirection:`column`},children:[U(W,{sx:{display:`flex`,width:`100%`,textAlign:`left`,fontWeight:600,flex:1,p:.5,gap:`5px`,alignItems:`center`,visibility:c?`inherit`:`hidden`},children:[H(ki,{name:T,color:se,resourceType:te}),C?U(V,{children:[E===`modified`&&S&&H(Y,{title:`Show Impact Radius`,placement:`top`,children:H(W,{onClick:fe,sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,color:`text.secondary`,"&:hover":{color:`text.primary`}},children:H(Oi,{})})}),x&&H(W,{onClick:de,sx:{cursor:`pointer`,color:`text.secondary`,"&:hover":{color:`text.primary`}},children:H(Di,{})})]}):U(V,{children:[ie&&H(W,{sx:{fontSize:16,color:j},children:H(ie,{})}),E&&ne&&H(W,{sx:{color:ce},children:H(ne,{})})]})]}),H(W,{sx:{display:`flex`,flex:`1 0 auto`,mx:.5,flexDirection:`column`,paddingBottom:.5,visibility:c?`inherit`:`hidden`},children:H(K,{direction:`row`,spacing:1,children:l?U(V,{children:[H(W,{sx:{flexGrow:1}}),l]}):u&&d?H(q,{sx:{height:20,color:`text.secondary`,fontSize:`9pt`,margin:0,fontWeight:600},children:Ei[d]}):i!==`action_result`&&f?f:null})})]})]}),O&&H(W,{sx:{p:`10px 10px`,borderColor:ae,borderWidth:`2px`,borderStyle:`solid`,borderTopWidth:0,borderBottomLeftRadius:8,borderBottomRightRadius:8},children:H(W,{sx:{height:`${h*g}px`,overflow:`auto`}})}),p&&H(tn,{type:`target`,position:rn.Left,isConnectable:!1}),m&&H(tn,{type:`source`,position:rn.Right,isConnectable:!1})]})}const ji=F(Ai);ji.displayName=`LineageNode`;const Mi=()=>U(W,{component:`span`,sx:{display:`flex`,flexDirection:`column`,gap:`2px`,"& > span":{width:4,height:4,borderRadius:`50%`,backgroundColor:`currentColor`}},children:[H(`span`,{}),H(`span`,{}),H(`span`,{})]});function Ni({checkId:e,primaryActions:t=[],secondaryActions:n=[],onAction:r,variant:i=`combined`,size:a=`small`,menuIcon:o,className:s}){let[c,l]=B(null),u=!!c,d=e=>{e.stopPropagation(),l(e.currentTarget)},f=()=>{l(null)},p=t=>{f(),r?.(e,t)},m=e=>{let t=H(G,{variant:`outlined`,size:a,disabled:e.disabled,onClick:()=>p(e.type),startIcon:e.icon,color:e.destructive?`error`:`inherit`,children:e.label},e.type);return e.disabled&&e.disabledTooltip?H(Y,{title:e.disabledTooltip,children:H(`span`,{children:t})},e.type):t};if(i===`menu`){let e=[...t,...n];return U(W,{className:s,children:[H(J,{onClick:d,size:a,children:o||H(Mi,{})}),H(_n,{anchorEl:c,open:u,onClose:f,children:e.map(e=>U(X,{onClick:()=>p(e.type),disabled:e.disabled,sx:{color:e.destructive?`error.main`:`inherit`},children:[e.icon&&H(W,{component:`span`,sx:{mr:1,display:`flex`},children:e.icon}),e.label]},e.type))})]})}return i===`buttons`?H(W,{className:s,sx:{display:`flex`,gap:1},children:H(pn,{size:a,variant:`outlined`,children:t.map(m)})}):U(W,{className:s,sx:{display:`flex`,gap:1},children:[t.length>0&&H(pn,{size:a,variant:`outlined`,children:t.map(m)}),n.length>0&&U(V,{children:[H(J,{onClick:d,size:a,children:o||H(Mi,{})}),H(_n,{anchorEl:c,open:u,onClose:f,children:n.map(e=>U(X,{onClick:()=>p(e.type),disabled:e.disabled,sx:{color:e.destructive?`error.main`:`inherit`},children:[e.icon&&H(W,{component:`span`,sx:{mr:1,display:`flex`},children:e.icon}),e.label]},e.type))})]})]})}const Pi=F(Ni);Pi.displayName=`CheckActions`;function Fi({name:e,onNameChange:t,placeholder:n=`Unnamed check`,disabled:r=!1,className:i}){let[a,o]=B(!1),[s,c]=B(e),l=z(null);L(()=>{c(e)},[e]);let u=I(()=>{r||(c(e),o(!0))},[r,e]),d=I(()=>{let n=s.trim();n&&n!==e&&t?.(n),o(!1)},[s,e,t]),f=I(t=>{t.key===`Enter`?(t.preventDefault(),d()):t.key===`Escape`&&(t.preventDefault(),c(e),o(!1))},[d,e]),p=I(e=>{c(e.target.value)},[]);return L(()=>{let e=e=>{l.current&&!l.current.contains(e.target)&&d()};return a&&document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[a,d]),L(()=>{a&&l.current&&(l.current.focus(),l.current.select())},[a]),H(W,{className:i,sx:{flex:`2`,fontSize:`1rem`,fontWeight:500,overflow:`hidden`,color:`text.primary`,cursor:r?`default`:`pointer`},children:a?H(Tn,{inputRef:l,value:s,onChange:p,onKeyDown:f,placeholder:n,size:`small`,sx:{width:`100%`},variant:`outlined`}):H(W,{sx:{flex:`0 1 auto`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,overflow:`hidden`,"&:hover":{textDecoration:r?`none`:`underline`}},onClick:u,children:e||H(W,{component:`span`,sx:{color:`text.secondary`,fontStyle:`italic`},children:n})})})}const Ii=F(Fi);Ii.displayName=`CheckBreadcrumb`;function Li(e){return{query:`Q`,query_base:`Q`,query_diff:`QD`,schema_diff:`SD`,lineage_diff:`LD`,profile:`P`,profile_diff:`PD`,row_count:`R`,row_count_diff:`RD`,value_diff:`VD`,histogram_diff:`H`,top_k_diff:`TK`,simple:`•`}[e]||`?`}function Ri(e){return{query:`#3b82f6`,query_base:`#3b82f6`,query_diff:`#8b5cf6`,schema_diff:`#06b6d4`,lineage_diff:`#10b981`,profile:`#f59e0b`,profile_diff:`#f97316`,row_count:`#ec4899`,row_count_diff:`#ef4444`,value_diff:`#6366f1`,histogram_diff:`#14b8a6`,top_k_diff:`#a855f7`,simple:`#6b7280`}[e]||`#6b7280`}function zi({check:e,isSelected:t=!1,onClick:n,onApprovalChange:r,disableApproval:i=!1,disabledApprovalTooltip:a,disabled:o=!1,className:s}){let c=()=>{!o&&n&&n(e.id)},l=H(dn,{checked:e.isApproved??!1,onChange:(t,n)=>{r&&r(e.id,n)},onClick:e=>{e.stopPropagation()},disabled:i||o,size:`small`,sx:{padding:`4px`,"&.Mui-disabled":{opacity:.5}}});return U(W,{className:s,onClick:c,sx:{display:`flex`,alignItems:`center`,gap:1,padding:`8px 12px`,cursor:o?`default`:`pointer`,borderLeft:t?`3px solid`:`3px solid transparent`,borderLeftColor:t?`primary.main`:`transparent`,backgroundColor:t?`action.selected`:`transparent`,opacity:o?.6:1,transition:`background-color 0.15s ease`,"&:hover":{backgroundColor:o?`transparent`:t?`action.selected`:`action.hover`}},children:[H(Xt,{label:Li(e.type),size:`small`,sx:{minWidth:32,height:24,fontSize:`0.7rem`,fontWeight:600,backgroundColor:`${Ri(e.type)}20`,color:Ri(e.type),"& .MuiChip-label":{px:1}}}),H(q,{variant:`body2`,sx:{flexGrow:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.name}),e.isPreset&&H(Xt,{label:`Preset`,size:`small`,variant:`outlined`,sx:{height:20,fontSize:`0.65rem`}}),i&&a?H(Y,{title:a,children:H(`span`,{children:l})}):l]})}const Bi=F(zi);Bi.displayName=`CheckCard`;function Vi({value:e,onChange:t,placeholder:n=`Add description here`,disabled:r=!1,className:i}){let[a,o]=B(!1),[s,c]=B(e??``);L(()=>{c(e??``)},[e]);let l=I(()=>{r||(o(!0),c(e??``))},[r,e]),u=I(()=>{let e=s.trim();t?.(e||void 0),o(!1)},[s,t]),d=I(()=>{c(e??``),o(!1)},[e]),f=I(e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),u()),e.key===`Escape`&&(e.preventDefault(),d())},[u,d]);return a?U(W,{className:i,sx:{height:`100%`},children:[H(Tn,{multiline:!0,fullWidth:!0,minRows:3,value:s,onChange:e=>c(e.target.value),onKeyDown:f,placeholder:n,autoFocus:!0,sx:{"& .MuiInputBase-root":{fontSize:`0.875rem`}}}),U(K,{direction:`row`,spacing:1,sx:{mt:1},children:[H(G,{variant:`contained`,size:`small`,onClick:u,children:`Update`}),H(pt,{component:`button`,variant:`body2`,onClick:d,sx:{cursor:`pointer`},children:`Cancel`})]}),U(q,{variant:`caption`,color:`text.secondary`,sx:{display:`block`,mt:.5},children:[navigator.platform.includes(`Mac`)?`⌘`:`Ctrl`,`+Enter to save, Escape to cancel`]})]}):H(W,{className:i,onClick:l,sx:{height:`100%`,overflow:`auto`,cursor:r?`default`:`pointer`,padding:1,borderRadius:1,"&:hover":{backgroundColor:r?`transparent`:`action.hover`}},children:e?H(q,{variant:`body2`,sx:{whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:e}):H(q,{variant:`body2`,sx:{color:`text.secondary`,fontStyle:`italic`},children:n})})}const Hi=F(Vi);Hi.displayName=`CheckDescription`;function Ui({checkId:e,name:t,type:n,description:r,isApproved:i=!1,tabs:a=[],defaultTab:o,primaryActions:s=[],secondaryActions:c=[],onAction:l,onDescriptionChange:u,onNameChange:d,disabled:f=!1,headerContent:p,sidebarContent:m,className:h}){let[g,_]=B(o??a[0]?.id),[v,y]=B(!1),[b,x]=B(t),S=()=>{f||(y(!0),x(t))},C=()=>{b.trim()&&b!==t&&d?.(b.trim()),y(!1)},w=e=>{e.key===`Enter`?C():e.key===`Escape`&&(x(t),y(!1))},T=a.find(e=>e.id===g)?.content;return U(W,{className:h,sx:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`hidden`},children:[U(W,{sx:{p:2,borderBottom:1,borderColor:`divider`},children:[p,U(W,{sx:{display:`flex`,alignItems:`flex-start`,justifyContent:`space-between`,gap:2},children:[U(W,{sx:{flexGrow:1,minWidth:0},children:[v?H(`input`,{type:`text`,value:b,onChange:e=>x(e.target.value),onBlur:C,onKeyDown:w,autoFocus:!0,style:{fontSize:`1.25rem`,fontWeight:500,border:`none`,borderBottom:`2px solid`,borderColor:`currentColor`,outline:`none`,background:`transparent`,width:`100%`}}):H(q,{variant:`h6`,onClick:S,sx:{cursor:f?`default`:`pointer`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,"&:hover":{textDecoration:f?`none`:`underline`}},children:t}),U(q,{variant:`caption`,color:`text.secondary`,children:[n,` `,i&&`• Approved`]})]}),H(Pi,{checkId:e,primaryActions:s,secondaryActions:c,onAction:l})]})]}),U(W,{sx:{display:`flex`,flexGrow:1,overflow:`hidden`},children:[U(W,{sx:{flexGrow:1,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[U(W,{sx:{p:2,borderBottom:1,borderColor:`divider`},children:[H(q,{variant:`subtitle2`,sx:{mb:1},children:`Description`}),H(Hi,{value:r,onChange:u,disabled:f})]}),a.length>0&&U(V,{children:[H(W,{sx:{borderBottom:1,borderColor:`divider`},children:H(Dn,{value:g,onChange:(e,t)=>_(t),children:a.map(e=>H(En,{value:e.id,label:e.label},e.id))})}),H(W,{sx:{flexGrow:1,overflow:`auto`,p:2},children:T})]})]}),m&&U(V,{children:[H(Et,{orientation:`vertical`,flexItem:!0}),H(W,{sx:{width:350,flexShrink:0,overflow:`auto`},children:m})]})]})]})}const Wi=F(Ui);Wi.displayName=`CheckDetail`;function Gi({title:e=`No checks yet`,description:t=`Create your first check to start validating data changes`,icon:n,actionText:r,onAction:i,isLoading:a=!1,helperText:o,className:s}){return H(W,{className:s,sx:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,textAlign:`center`,padding:4,minHeight:300},children:U(K,{spacing:2,alignItems:`center`,children:[n&&H(W,{sx:{color:`text.secondary`,fontSize:48,mb:1},children:n}),H(q,{variant:`h6`,sx:{fontWeight:500,color:`text.primary`},children:e}),H(q,{variant:`body2`,sx:{color:`text.secondary`,maxWidth:400},children:t}),r&&i&&H(G,{variant:`contained`,onClick:i,disabled:a,sx:{mt:2},children:a?`Creating...`:r}),o&&H(q,{variant:`caption`,sx:{color:`text.secondary`,mt:1},children:o})]})})}const Ki=F(Gi);Ki.displayName=`CheckEmptyState`;function qi({checks:e,selectedId:t,onCheckSelect:n,onApprovalChange:r,disableApproval:i=!1,disabledApprovalTooltip:a,title:o,className:s,isLoading:c=!1,emptyContent:l}){return c?H(W,{className:s,sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:200},children:H(q,{color:`text.secondary`,children:`Loading checks...`})}):e.length===0?U(W,{className:s,children:[o&&H(q,{variant:`subtitle2`,sx:{px:2,py:1,color:`text.secondary`},children:o}),l||H(W,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:200},children:H(q,{color:`text.secondary`,children:`No checks`})})]}):U(W,{className:s,sx:{height:`100%`,overflow:`auto`},children:[o&&H(q,{variant:`subtitle2`,sx:{px:2,py:1,color:`text.secondary`},children:o}),H(On,{disablePadding:!0,children:e.map(e=>H(kn,{disablePadding:!0,children:H(Bi,{check:e,isSelected:t===e.id,onClick:n,onApprovalChange:r,disableApproval:i,disabledApprovalTooltip:a})},e.id))})]})}const Ji=F(qi);Ji.displayName=`CheckList`;const Yi={lineageNode:ji,lineageGraphColumnNode:qr},Xi={lineageEdge:li};function Zi({nodes:e,edges:t,onNodeSelect:n,onNodeDoubleClick:r,showMiniMap:i=!0,showControls:a=!0,showBackground:o=!0,height:s=600,interactive:c=!0}){let[l,u,d]=ln(e),[f,p,m]=cn(t),h=I((e,t)=>{n?.(t.id)},[n]),g=I(()=>{n?.(null)},[n]),_=I((e,t)=>{r?.(t.id)},[r]);return H(W,{sx:{width:`100%`,height:s},children:U(an,{nodes:l,edges:f,onNodesChange:c?d:void 0,onEdgesChange:c?m:void 0,onNodeClick:h,onNodeDoubleClick:_,onPaneClick:g,nodeTypes:Yi,edgeTypes:Xi,fitView:!0,nodesDraggable:c,nodesConnectable:!1,elementsSelectable:c,children:[o&&H(Zt,{}),a&&H($t,{}),i&&H(nn,{nodeColor:e=>{switch(e.data.changeStatus){case`added`:return`#22c55e`;case`removed`:return`#ef4444`;case`modified`:return`#f59e0b`;default:return`#94a3b8`}}})]})})}const Qi=ot(function(e,t){let{lineageGraph:n,viewOptions:r,interactive:i=!0,height:a=600,filterNodes:o,onNodeSelect:s,onNodeDoubleClick:c,dagre:l,showMiniMap:u=!0,showControls:d=!0,showBackground:f=!0}=e,p=z(null),m=A(),h=n??m.lineageGraph,g=!n&&m.isLoading,_=n?void 0:m.error,{nodes:v,edges:y}=R(()=>{if(!h)return{nodes:[],edges:[]};let e;if(r?.node_ids&&r.node_ids.length>0?e=r.node_ids:r?.view_mode===`changed_models`&&(e=h.modifiedSet),r?.select&&e&&r.select.includes(`+`)){let t=de(h,e),n=ue(h,e);e=[...new Set([...t,...n])]}if(r?.packages&&r.packages.length>0){let t=new Set(r.packages);e=(e??Object.keys(h.nodes)).filter(e=>{let n=h.nodes[e];return n?.data.packageName&&t.has(n.data.packageName)})}o&&(e=(e??Object.keys(h.nodes)).filter(e=>{let t=h.nodes[e];return t?o(e,t):!1}));let[t,n]=ae(h,e);return l&&t.length>0&&$i(l,t,n),{nodes:t.map(e=>({id:e.id,position:e.position,type:`lineageNode`,data:{label:e.data.name,nodeType:e.data.resourceType,changeStatus:e.data.changeStatus,resourceType:e.data.resourceType,packageName:e.data.packageName}})),edges:n.map(e=>({id:e.id,source:e.source,target:e.target,type:`lineageEdge`,data:{changeStatus:e.data?.changeStatus}}))}},[h,r,o,l]),b=I(async()=>{if(p.current)try{let e=await jn(p.current,{backgroundColor:`#ffffff`,pixelRatio:2}),t=await(await fetch(e)).blob();await navigator.clipboard.write([new ClipboardItem({[t.type]:t})])}catch(e){throw console.error(`Failed to copy to clipboard:`,e),e}},[]);return ct(t,()=>({copyToClipboard:b}),[b]),g?H(W,{sx:{width:`100%`,height:a,display:`flex`,alignItems:`center`,justifyContent:`center`},children:H(Dt,{})}):_?H(W,{sx:{width:`100%`,height:a,display:`flex`,alignItems:`center`,justifyContent:`center`},children:H(q,{color:`error`,children:_})}):h?v.length===0?H(W,{sx:{width:`100%`,height:a,display:`flex`,alignItems:`center`,justifyContent:`center`},children:H(q,{color:`text.secondary`,children:`No nodes match the current filter criteria.`})}):H(W,{ref:p,sx:{width:`100%`,height:a},children:H(Zi,{nodes:v,edges:y,onNodeSelect:s,onNodeDoubleClick:c,showMiniMap:u,showControls:d,showBackground:f,height:`100%`,interactive:i})}):H(W,{sx:{width:`100%`,height:a,display:`flex`,alignItems:`center`,justifyContent:`center`},children:H(q,{color:`text.secondary`,children:`No lineage data available. Provide data via LineageGraphProvider or lineageGraph prop.`})})});function $i(e,t,n,r=`LR`){let i=new e.graphlib.Graph;i.setDefaultEdgeLabel(()=>({})),i.setGraph({rankdir:r,ranksep:50,nodesep:30});for(let e of t){let t=e.style?.width?Number(e.style.width):300,n=e.style?.height?Number(e.style.height):60;i.setNode(e.id,{width:t,height:n})}for(let e of n)i.setEdge(e.source,e.target);e.layout(i);for(let e of t){let t=e.style?.width?Number(e.style.width):300,n=e.style?.height?Number(e.style.height):60,r=i.node(e.id);r&&(e.position={x:r.x-t/2,y:r.y-n/2})}}function ea({params:e,viewOptions:t,interactive:n=!1,height:r,dagre:i},a){let o={...t,...e};return H(W,{sx:{display:`flex`,flexDirection:`column`,height:r??`100%`},children:H(on,{children:H(Qi,{viewOptions:o,interactive:n,ref:a,dagre:i})})})}const ta=ot(ea);ta.displayName=`LineageDiffView`;function na(e){switch(e){case`sql`:return Pn({dialect:Nn});case`yaml`:return Fn();default:return null}}function ra({value:e,onChange:t,language:n=`sql`,readOnly:r=!1,lineNumbers:i=!0,wordWrap:a=!0,fontSize:o=14,height:s=`100%`,className:c=``,theme:l=`light`,keyBindings:u=[]}){let d=R(()=>{let e=[Rn.theme({"&":{fontSize:`${o}px`},".cm-content":{fontFamily:`'JetBrains Mono', 'Fira Code', monospace`},".cm-gutters":{fontFamily:`'JetBrains Mono', 'Fira Code', monospace`}})],t=na(n);return t&&e.push(t),a&&e.push(Rn.lineWrapping),u.length>0&&e.push(Ln.highest(zn.of(u))),e},[n,o,a,u]),f=R(()=>l===`dark`?Vn:Hn,[l]);return H(Un,{value:e,onChange:e=>{t&&t(e)},extensions:d,readOnly:r,basicSetup:{lineNumbers:i,foldGutter:!0,highlightActiveLineGutter:!r,highlightActiveLine:!r,tabSize:2},height:s,className:`${c} no-track-pii-safe`,theme:f})}function ia({name:e,description:t,type:n,params:r,viewOptions:i}){let a={name:e,description:t,type:n,params:r};return i&&(a.view_options=i),Mn.stringify({checks:[a]})}function aa({yamlTemplate:e,height:t=`300px`}){return H(ra,{value:e,language:`yaml`,readOnly:!0,lineNumbers:!1,wordWrap:!0,fontSize:14,theme:N()?`dark`:`light`,height:t})}const oa=F(aa);oa.displayName=`PresetCheckTemplateView`;const sa={apiPrefix:``,authToken:void 0,baseUrl:void 0,apiClient:nt.create({baseURL:We})};function ca(){return te()??sa}function la({userId:e,enabled:t=!0}){let{apiClient:n}=ca(),r=e?.toString(),{data:i,isLoading:a}=et({queryKey:D.user(),queryFn:()=>Ve(n),enabled:t&&!!r,retry:!1,staleTime:300*1e3}),o=!!(i&&r&&i.id===r)&&i?.login_type===`github`,s=!!(t&&o&&r),{data:c,isLoading:l}=et({queryKey:[`github-avatar`,r],queryFn:()=>r?He(r):Promise.resolve(null),enabled:s,retry:!1,staleTime:300*1e3});return{avatarUrl:typeof c==`string`?c:null,isLoading:a||s&&l,isGitHubUser:!!o}}function ua({onSubmit:e,isSubmitting:t=!1,placeholder:n=`Add a comment...`,submitLabel:r=`Comment`,submittingLabel:i=`Submitting...`,className:a}){let o=N(),[s,c]=B(``),l=I(()=>{let t=s.trim();t&&(e(t),c(``))},[s,e]),u=I(e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),l())},[l]);return U(W,{className:a,children:[H(Tn,{value:s,onChange:I(e=>{c(e.target.value)},[]),onKeyDown:u,placeholder:n,size:`small`,multiline:!0,fullWidth:!0,minRows:3,disabled:t,sx:{"& .MuiOutlinedInput-root":{bgcolor:`background.paper`,"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:o?`grey.500`:`grey.400`},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:`iochmara.400`,boxShadow:`0 0 0 1px #4299E1`}},"& .MuiOutlinedInput-notchedOutline":{borderColor:o?`grey.600`:void 0}}}),H(K,{direction:`row`,justifyContent:`flex-end`,sx:{mt:2},children:H(G,{size:`small`,color:`iochmara`,variant:`contained`,onClick:l,disabled:!s.trim()||t,children:t?i:r})})]})}const da=F(ua);da.displayName=`CommentInput`;function fa(e){switch(e.event_type){case`check_created`:return`create`;case`comment`:return`comment`;case`approval_change`:return e.new_value===`true`?`approve`:`unapprove`;case`description_change`:case`name_change`:return`edit`;case`preset_applied`:return`preset`;default:return`edit`}}function pa({event:e}){let t=fa(e),n={create:Wt,comment:Mt,approve:Pt,unapprove:Ft,edit:Ht,preset:At},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 H(W,{component:i,sx:{color:a,fontSize:16}})}function ma({actor:e}){let t=(e.fullname||e.login||`User`).charAt(0).toUpperCase();return H(Wn,{src:e.avatarUrl||void 0,sx:{width:24,height:24,fontSize:`0.75rem`},children:t})}function ha({event:e}){let{actor:t}=e,n=t.fullname||t.login||`Someone`,r=qn(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 U(W,{sx:{display:`flex`,gap:1,alignItems:`flex-start`,py:1},children:[H(W,{sx:{pt:`2px`},children:H(pa,{event:e})}),H(W,{sx:{flex:1},children:U(K,{direction:`row`,spacing:.5,flexWrap:`wrap`,alignItems:`center`,children:[H(ma,{actor:t}),H(q,{variant:`body2`,fontWeight:`500`,children:n}),H(q,{variant:`body2`,color:`text.secondary`,children:i}),H(q,{variant:`caption`,color:`text.disabled`,children:r})]})})]})}const ga=F(ha);ga.displayName=`StateChangeEvent`;function _a({event:e,currentUserId:t,onEdit:n,onDelete:r,markdownRenderer:i}){let a=N(),[o,s]=B(!1),[c,l]=B(e.content||``),[u,d]=B(!1),[f,p]=B(!1),[m,h]=B(null),g=!!m,{actor:_}=e,v=_.fullname||_.login||`Someone`,y=qn(new Date(e.created_at),{addSuffix:!0}),b=t&&String(_.user_id)===String(t),x=I(()=>{l(e.content||``),s(!0)},[e.content]),S=I(()=>{l(e.content||``),s(!1)},[e.content]),C=I(async()=>{let t=c.trim();if(!t||t===e.content){S();return}if(n){d(!0);try{await n(e.id,t),s(!1)}finally{d(!1)}}},[c,e.content,e.id,n,S]),w=I(e=>{e.key===`Escape`?S():e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),C())},[S,C]),T=I(e=>{h(e.currentTarget)},[]),E=I(()=>{h(null)},[]),ee=I(async()=>{if(r){p(!0);try{await r(e.id),E()}finally{p(!1)}}},[r,e.id,E]),te=I(e=>{l(e.target.value)},[]);return e.is_deleted?U(W,{sx:{display:`flex`,gap:1,alignItems:`center`,py:1},children:[H(W,{sx:{pt:`2px`,display:`flex`,alignItems:`center`},children:H(pa,{event:e})}),H(W,{sx:{display:`flex`,flex:1,alignItems:`center`},children:H(q,{variant:`body2`,color:`text.disabled`,fontStyle:`italic`,children:`Comment deleted`})})]}):U(W,{sx:{display:`flex`,gap:1,alignItems:`flex-start`,py:1},children:[H(W,{sx:{pt:`2px`},children:H(pa,{event:e})}),U(W,{sx:{flex:1},children:[U(K,{direction:`row`,spacing:.5,sx:{mb:.5},flexWrap:`wrap`,alignItems:`center`,children:[H(ma,{actor:_}),U(q,{variant:`body2`,fontWeight:`500`,children:[v,b&&U(q,{component:`span`,variant:`body2`,color:`text.secondary`,children:[` `,`(Author)`]})]}),H(q,{variant:`caption`,color:`text.disabled`,children:y}),e.is_edited&&H(q,{variant:`caption`,color:`text.disabled`,children:`(edited)`})]}),o?U(W,{children:[H(Tn,{value:c,onChange:te,onKeyDown:w,size:`small`,multiline:!0,minRows:3,fullWidth:!0,disabled:u,autoFocus:!0,sx:{"& .MuiOutlinedInput-root":{bgcolor:`background.paper`,"&:focus-within":{borderColor:`primary.main`}}}}),U(K,{direction:`row`,spacing:1,sx:{mt:1},justifyContent:`flex-end`,children:[H(G,{size:`small`,variant:`text`,onClick:S,disabled:u,children:`Cancel`}),H(G,{size:`small`,variant:`contained`,onClick:C,disabled:!c.trim()||u,children:u?`Saving...`:`Save`})]})]}):U(W,{sx:{bgcolor:a?`grey.800`:`grey.50`,borderRadius:1,p:1,border:`1px solid`,borderColor:a?`grey.700`:`grey.200`,position:`relative`,"&:hover .comment-actions":{opacity:1}},children:[i?H(i,{content:e.content||``}):H(q,{variant:`body2`,sx:{whiteSpace:`pre-wrap`},children:e.content}),b&&(n||r)&&U(K,{className:`comment-actions`,direction:`row`,spacing:0,sx:{position:`absolute`,top:4,right:4,opacity:0,transition:`opacity 0.2s`},children:[n&&H(Y,{title:`Edit comment`,children:H(J,{"aria-label":`Edit comment`,size:`small`,onClick:x,children:H(Ut,{})})}),r&&U(V,{children:[H(Y,{title:`Delete comment`,children:H(J,{"aria-label":`Delete comment`,size:`small`,color:`error`,onClick:T,children:H(qt,{})})}),H(Gn,{open:g,anchorEl:m,onClose:E,anchorOrigin:{vertical:`bottom`,horizontal:`center`},transformOrigin:{vertical:`top`,horizontal:`center`},children:U(W,{sx:{p:2},children:[H(q,{variant:`body2`,sx:{mb:2},children:`Delete this comment?`}),U(K,{direction:`row`,spacing:1,justifyContent:`flex-end`,children:[H(G,{size:`small`,variant:`text`,onClick:E,disabled:f,children:`Cancel`}),H(G,{size:`small`,variant:`contained`,color:`error`,onClick:ee,disabled:f,children:f?`Deleting...`:`Delete`})]})]})})]})]})]})]})]})}const va=F(_a);va.displayName=`CommentEvent`;function ya({event:e,currentUserId:t,onEdit:n,onDelete:r,markdownRenderer:i,className:a}){return e.event_type===`comment`?H(W,{className:a,children:H(va,{event:e,currentUserId:t,onEdit:n,onDelete:r,markdownRenderer:i})}):H(W,{className:a,children:H(ga,{event:e})})}const ba=F(ya);ba.displayName=`TimelineEvent`;function xa({name:e,isChecked:t}){return`${t?`✅ `:``}${e}`}function Sa({description:e,fallback:t=`_(no description)_`}){return(e??``)||t}function Ca({type:e,hasResult:t,hasError:n}){return e===`schema_diff`||e===`lineage_diff`?!1:!t||n}function wa({sql:e,label:t=`SQL`}){return`**${t}**
|
|
2
|
+
import{C as e,F as t,H as n,J as r,P as i,Q as a,S as o,T as s,U as c,X as l,Z as u,_t as d,at as f,ct as p,et as m,f as h,gt as g,h as _,it as v,lt as y,mt as b,nt as x,ot as S,q as C,st as w,ut as T,vt as E,x as ee}from"./api-SYhhWIpP.js";import{d as te,f as D,l as O,s as k}from"./keepAlive-BWO3B6hb.js";import{C as ne,O as re,_ as A,b as ie,c as ae,g as oe,j as se,k as j,m as ce,n as le,o as ue,s as de,u as fe,v as pe,w as me}from"./utils-CCvJtImZ.js";import{_ as he,g as ge,t as _e}from"./theme-BXMsHaWD.js";import{n as M}from"./colors-DlLSByQO.js";import{At as ve,Dt as ye,Et as be,It as xe,Mt as Se,Nt as N,Ot as Ce,Q as we,S as Te,St as Ee,Tt as De,b as Oe,c as ke,ct as Ae,dt as P,i as je,jt as Me,kt as Ne,l as Pe,nt as Fe,pt as Ie,r as Le,s as Re,wt as ze,y as Be}from"./utils-Ccs7TMoy.js";import{n as Ve,t as He}from"./user-CYVsmhqS.js";import{r as Ue,t as We}from"./const-B0roUYcb.js";import{b as Ge,c as Ke,d as qe,f as Je,n as Ye,o as Xe,x as Ze}from"./track-DV9xFZGy.js";import{t as Qe}from"./ResultErrorFallback-Bwq1j3pu.js";import{useMutation as $e,useQuery as et,useQueryClient as tt}from"@tanstack/react-query";import nt from"axios";import rt,{Fragment as it,createContext as at,forwardRef as ot,memo as F,useCallback as I,useContext as st,useEffect as L,useImperativeHandle as ct,useMemo as R,useRef as z,useState as B}from"react";import{Fragment as V,jsx as H,jsxs as U}from"react/jsx-runtime";import W from"@mui/material/Box";import G from"@mui/material/Button";import lt from"@mui/material/Dialog";import ut from"@mui/material/DialogActions";import dt from"@mui/material/DialogContent";import ft from"@mui/material/DialogTitle";import pt from"@mui/material/Link";import K from"@mui/material/Stack";import q from"@mui/material/Typography";import mt from"js-cookie";import{LuChartBarBig as ht,LuExternalLink as gt}from"react-icons/lu";import _t from"@mui/material/CssBaseline";import{ThemeProvider as vt,alpha as yt,useTheme as bt}from"@mui/material/styles";import{useTheme as xt}from"next-themes";import{AllCommunityModule as St,ModuleRegistry as Ct}from"ag-grid-community";import J from"@mui/material/IconButton";import wt from"next/link";import{IoClose as Tt}from"react-icons/io5";import Et from"@mui/material/Divider";import Dt from"@mui/material/CircularProgress";import Y from"@mui/material/Tooltip";import{FaCheckCircle as Ot,FaRegCheckCircle as kt}from"react-icons/fa";import{PiBookmarkSimple as At,PiCaretDown as jt,PiChatText as Mt,PiCheck as Nt,PiCheckCircle as Pt,PiCircle as Ft,PiClipboardText as It,PiCopy as Lt,PiDotsThreeVertical as Rt,PiDownloadSimple as zt,PiImage as Bt,PiInfo as Vt,PiNotePencil as Ht,PiPencilSimple as Ut,PiPlusCircle as Wt,PiRepeat as Gt,PiTable as Kt,PiTrashSimple as qt,PiWarning as Jt,PiX as Yt}from"react-icons/pi";import Xt from"@mui/material/Chip";import{Background as Zt,BaseEdge as Qt,Controls as $t,EdgeLabelRenderer as en,Handle as tn,MiniMap as nn,Position as rn,ReactFlow as an,ReactFlowProvider as on,getBezierPath as sn,useEdgesState as cn,useNodesState as ln}from"@xyflow/react";import un from"file-saver";import dn from"@mui/material/Checkbox";import fn from"@mui/material/FormControlLabel";import pn from"@mui/material/ButtonGroup";import{useTimeout as mn}from"usehooks-ts";import hn from"@mui/material/Alert";import gn from"@mui/material/InputBase";import _n from"@mui/material/Menu";import X from"@mui/material/MenuItem";import vn from"lodash";import{VscKebabVertical as yn,VscKey as bn}from"react-icons/vsc";import xn from"@mui/material/ListSubheader";import Sn from"@mui/material/FormControl";import Cn from"@mui/material/FormLabel";import wn from"@mui/material/NativeSelect";import Tn from"@mui/material/TextField";import En from"@mui/material/Tab";import Dn from"@mui/material/Tabs";import On from"@mui/material/List";import kn from"@mui/material/ListItem";import{toCanvas as An,toPng as jn}from"html-to-image";import"@xyflow/react/dist/style.css";import Mn from"yaml";import{PostgreSQL as Nn,sql as Pn}from"@codemirror/lang-sql";import{yaml as Fn}from"@codemirror/lang-yaml";import{EditorState as In,Prec as Ln}from"@codemirror/state";import{EditorView as Rn,keymap as zn,lineNumbers as Bn}from"@codemirror/view";import{githubDark as Vn,githubLight as Hn}from"@uiw/codemirror-theme-github";import Un from"@uiw/react-codemirror";import Wn from"@mui/material/Avatar";import Gn from"@mui/material/Popover";import{format as Kn,formatDistanceToNow as qn}from"date-fns";import Jn from"@mui/material/LinearProgress";import{BarElement as Yn,CategoryScale as Xn,Chart as Zn,Legend as Qn,LinearScale as $n,TimeSeriesScale as er,Title as tr,Tooltip as nr}from"chart.js";import{Bar as rr,Chart as ir}from"react-chartjs-2";import{AgGridReact as ar}from"ag-grid-react";import{MergeView as or,unifiedMergeView as sr}from"@codemirror/merge";import cr from"react-markdown";import{Prism as lr}from"react-syntax-highlighter";import{oneDark as ur}from"react-syntax-highlighter/dist/esm/styles/prism";import dr from"remark-gfm";import fr from"react-split";import{amber as pr}from"@mui/material/colors";import{usePathname as mr,useRouter as hr}from"next/navigation";import{MdFormatListNumberedRtl as gr,MdSchema as _r}from"react-icons/md";import{TbAlignBoxLeftStretch as vr,TbBrandStackshare as yr,TbChartHistogram as br,TbCloudUpload as xr,TbEyeEdit as Sr,TbEyeSearch as Cr,TbSql as wr}from"react-icons/tb";import Tr from"@mui/material/Autocomplete";import Z from"@mui/material/ListItemIcon";import Q from"@mui/material/ListItemText";import{FiInfo as Er}from"react-icons/fi";import{FaPlay as Dr}from"react-icons/fa6";import{ErrorBoundary as Or}from"@sentry/react";function kr({children:e,forcedTheme:t,enableCssBaseline:n=!1}){let{resolvedTheme:r}=xt();return L(()=>{(t??r)===`dark`?document.documentElement.classList.add(`dark`):document.documentElement.classList.remove(`dark`)},[t,r]),U(vt,{theme:_e,children:[n&&H(_t,{}),e]})}const Ar=at({checks:[],isLoading:!1});Ar.displayName=`RecceCheckContext`;function jr({children:e,checks:t=[],isLoading:n=!1,error:r,selectedCheckId:i,onSelectCheck:a,onCreateCheck:o,onUpdateCheck:s,onDeleteCheck:c,onReorderChecks:l,refetchChecks:u,latestSelectedCheckId:d,setLatestSelectedCheckId:f}){let p=i??d,m=a??f,h=R(()=>({checks:t,isLoading:n,error:r,selectedCheckId:p,onSelectCheck:m,onCreateCheck:o,onUpdateCheck:s,onDeleteCheck:c,onReorderChecks:l,refetchChecks:u,latestSelectedCheckId:p,setLatestSelectedCheckId:m}),[t,n,r,p,m,o,s,c,l,u]);return H(Ar.Provider,{value:h,children:e})}function Mr(){return st(Ar)}const Nr=at({sql:``,isExecuting:!1});Nr.displayName=`RecceQueryContext`;function Pr({children:e,sql:t=``,isExecuting:n=!1,error:r,baseResult:i,currentResult:a,onSqlChange:o,onExecute:s,onCancel:c,sqlQuery:l,setSqlQuery:u,primaryKeys:d,setPrimaryKeys:f,isCustomQueries:p,setCustomQueries:m,baseSqlQuery:h,setBaseSqlQuery:g}){let _=R(()=>({sql:t,isExecuting:n,error:r,baseResult:i,currentResult:a,onSqlChange:o,onExecute:s,onCancel:c,sqlQuery:l,setSqlQuery:u,primaryKeys:d,setPrimaryKeys:f,isCustomQueries:p,setCustomQueries:m,baseSqlQuery:h,setBaseSqlQuery:g}),[t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g]);return H(Nr.Provider,{value:_,children:e})}function Fr(){return st(Nr)}function Ir({children:e}){let[t,n]=B(``);return H(jr,{selectedCheckId:t,onSelectCheck:n,latestSelectedCheckId:t,setLatestSelectedCheckId:n,children:e})}const Lr=()=>{};function Rr(){let e=Mr();return{latestSelectedCheckId:e.latestSelectedCheckId??``,setLatestSelectedCheckId:e.setLatestSelectedCheckId??Lr}}const zr=24,Br=280,Vr={added:`#22c55e`,removed:`#ef4444`,modified:`#f59e0b`},Hr={passthrough:{letter:`P`,color:`default`},renamed:{letter:`R`,color:`warning`},derived:{letter:`D`,color:`warning`},source:{letter:`S`,color:`info`},unknown:{letter:`U`,color:`error`}};function Ur({size:e=14}){return U(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,children:[H(`circle`,{cx:`8`,cy:`3`,r:`1.5`}),H(`circle`,{cx:`8`,cy:`8`,r:`1.5`}),H(`circle`,{cx:`8`,cy:`13`,r:`1.5`})]})}function Wr({changeStatus:e}){if(!e)return null;let t=Vr[e];return H(W,{sx:{width:14,height:14,borderRadius:`50%`,backgroundColor:t,color:`white`,fontSize:10,fontWeight:`bold`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:{added:`+`,removed:`-`,modified:`~`}[e]})}function Gr({transformationType:e}){if(!e)return null;let t=Hr[e];return H(Xt,{label:t.letter,size:`small`,color:t.color,sx:{fontSize:`8pt`,height:18,minWidth:18,"& .MuiChip-label":{px:.5}}})}function Kr({id:e,data:t,showContent:n=!0,showChangeAnalysis:r=!1,isDark:i=!1,onColumnClick:a,onContextMenu:o}){let{column:s,type:c,transformationType:l,changeStatus:u,isHighlighted:d=!0,isFocused:f=!1}=t,[p,m]=B(!1);return n?U(W,{onClick:()=>a?.(e),sx:{display:`flex`,width:280,padding:`0px 10px`,border:`1px solid`,borderColor:`divider`,backgroundColor:f?`action.selected`:p?`action.hover`:`background.paper`,filter:d?`none`:`opacity(0.2) grayscale(50%)`,cursor:`pointer`,transition:`background-color 0.15s ease`},onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),children:[U(W,{sx:{display:`flex`,fontSize:`11px`,color:`text.primary`,width:`100%`,gap:`6px`,alignItems:`center`,height:`23px`},children:[r&&u?H(Wr,{changeStatus:u}):H(Gr,{transformationType:l}),H(W,{sx:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,flexGrow:1,height:`25px`,lineHeight:`25px`},children:s}),p&&o?H(W,{sx:{display:`inline-flex`,alignItems:`center`,cursor:`pointer`,"&:hover":{color:`text.primary`}},onClick:t=>{t.preventDefault(),t.stopPropagation(),o(t,e)},"data-testid":`column-kebab-menu`,children:H(Ur,{size:14})}):c&&H(W,{sx:{color:`text.secondary`,fontSize:`10px`,flexShrink:0},children:c})]}),H(tn,{type:`target`,position:rn.Left,isConnectable:!1,style:{left:0,visibility:`hidden`}}),H(tn,{type:`source`,position:rn.Right,isConnectable:!1,style:{right:0,visibility:`hidden`}})]}):null}const qr=F(Kr);qr.displayName=`LineageColumnNode`;const Jr=e=>H(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 16 16`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:H(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M1.5 1h13l.5.5v13l-.5.5h-13l-.5-.5v-13l.5-.5zM2 2v12h12V2H2zm6.5 2.5v2.5h2.5v1H8.5v2.5h-1V8H5V7h2.5V4.5h1z`})}),Yr=e=>H(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 16 16`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:H(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M1.5 1h13l.5.5v13l-.5.5h-13l-.5-.5v-13l.5-.5zM2 2v12h12V2H2zm3 5.5h6v1H5v-1z`})}),Xr=e=>U(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 16 16`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[H(`path`,{d:`M1.5 1h13l.5.5v13l-.5.5h-13l-.5-.5v-13l.5-.5zM2 2v12h12V2H2z`}),H(`path`,{d:`M10.6 8.7c-.1.1-.3.2-.5.2h-.1l-1.4-.3c-.5-.1-1.1-.3-1.8-.3-.6 0-1 .2-1.3.5-.2.2-.2.4-.2.7v.1l-.9.3v-.2c0-.3 0-.6.1-.9.2-.4.5-.8 1-1.1.5-.4 1.2-.5 2-.5h.2l1.5.4h.1c.5.1 1 .3 1.5.3.6 0 .9-.2 1.2-.4.2-.2.3-.5.3-.8v-.3l.8-.3h.1v.3c0 .6-.2 1.2-.6 1.6-.2.2-.3.4-.5.5l-.5.2z`})]}),Zr=e=>H(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 16 16`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:H(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M8 11a3 3 0 1 0 0-6 3 3 0 0 0 0 6z`})}),Qr=e=>H(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:H(`path`,{d:`M239.1 6.3l-208 78c-18.7 7-31.1 25-31.1 45v225.1c0 18.2 10.3 34.8 26.5 42.9l208 104c13.5 6.8 29.4 6.8 42.9 0l208-104c16.3-8.1 26.5-24.8 26.5-42.9V129.3c0-20-12.4-37.9-31.1-44.9l-208-78C262 2.2 250 2.2 239.1 6.3zM256 68.4l192 72v1.1l-192 78-192-78v-1.1l192-72zm32 356V275.5l160-65v133.9l-160 80z`})}),$r=e=>H(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 448 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:H(`path`,{d:`M448 73.143v45.714C448 159.143 347.667 192 224 192S0 159.143 0 118.857V73.143C0 32.857 100.333 0 224 0s224 32.857 224 73.143zM448 176v102.857C448 319.143 347.667 352 224 352S0 319.143 0 278.857V176c48.125 33.143 136.208 48.572 224 48.572S399.874 209.143 448 176zm0 160v102.857C448 479.143 347.667 512 224 512S0 479.143 0 438.857V336c48.125 33.143 136.208 48.572 224 48.572S399.874 369.143 448 336z`})}),ei=e=>H(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:H(`path`,{d:`M64 96H0c0 123.7 100.3 224 224 224v144c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V320C288 196.3 187.7 96 64 96zm384-64c-84.2 0-157.4 46.5-195.7 115.2 27.7 30.2 48.2 66.9 59 107.6C424 243.1 512 147.9 512 32h-64z`})}),ti=e=>H(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:H(`path`,{d:`M512 144v288c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V144c0-26.5 21.5-48 48-48h88l12.3-32.9c7-18.7 24.9-31.1 44.9-31.1h125.5c20 0 37.9 12.4 44.9 31.1L376 96h88c26.5 0 48 21.5 48 48zM376 288c0-66.2-53.8-120-120-120s-120 53.8-120 120 53.8 120 120 120 120-53.8 120-120zm-32 0c0 48.5-39.5 88-88 88s-88-39.5-88-88 39.5-88 88-88 88 39.5 88 88z`})}),ni=e=>H(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 448 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:H(`path`,{d:`M160 80c0-26.5 21.5-48 48-48h32c26.5 0 48 21.5 48 48v352c0 26.5-21.5 48-48 48h-32c-26.5 0-48-21.5-48-48V80zM0 272c0-26.5 21.5-48 48-48h32c26.5 0 48 21.5 48 48v160c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V272zM368 96h32c26.5 0 48 21.5 48 48v288c0 26.5-21.5 48-48 48h-32c-26.5 0-48-21.5-48-48V144c0-26.5 21.5-48 48-48z`})}),ri=e=>H(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:H(`path`,{d:`M0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zm320 96c0-15.9-5.8-30.4-15.3-41.6l76.6-147.4c6.1-11.8 1.5-26.3-10.2-32.4s-26.2-1.5-32.4 10.2L262.1 288.3c-2-.2-4-.3-6.1-.3c-35.3 0-64 28.7-64 64s28.7 64 64 64s64-28.7 64-64z`})}),ii=e=>H(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:H(`path`,{d:`M418.4 157.9c35.3-8.3 61.6-40 61.6-77.9c0-44.2-35.8-80-80-80c-43.4 0-78.7 34.5-80 77.5L136.2 151.1C121.7 136.8 101.9 128 80 128c-44.2 0-80 35.8-80 80s35.8 80 80 80c12.2 0 23.8-2.7 34.1-7.6L259.7 407.8c-2.4 7.6-3.7 15.8-3.7 24.2c0 44.2 35.8 80 80 80s80-35.8 80-80c0-27.7-14-52.1-35.4-66.4l37.8-207.7zM156.3 232.2c2.2-6.9 3.5-14.2 3.7-21.7l183.8-73.5c3.6 3.5 7.4 6.7 11.6 9.5L317.6 354.1c-5.5 1.3-10.8 3.1-15.8 5.5L156.3 232.2z`})});function ai(e,t){return e===`added`?{color:M.green[500],hexColor:M.green[500],backgroundColor:t?M.green[900]:M.green[100],hexBackgroundColor:t?M.green[900]:M.green[100],icon:Jr}:e===`removed`?{color:M.red[500],hexColor:M.red[500],backgroundColor:t?M.red[950]:M.red[200],hexBackgroundColor:t?M.red[950]:M.red[200],icon:Yr}:e===`modified`?{color:M.amber[500],hexColor:M.amber[500],backgroundColor:t?M.amber[900]:M.amber[100],hexBackgroundColor:t?M.amber[900]:M.amber[100],icon:Xr}:{color:M.neutral[500],hexColor:M.neutral[500],backgroundColor:t?M.neutral[700]:M.white,hexBackgroundColor:t?M.neutral[700]:M.white,icon:void 0}}function oi(e){switch(e){case`model`:return{color:M.cyan[200],icon:Qr};case`source`:return{color:M.green[300],icon:$r};case`seed`:return{color:M.green[500],icon:ei};case`snapshot`:return{color:M.green[500],icon:ti};case`metric`:return{color:M.rose[200],icon:ni};case`exposure`:return{color:M.rose[200],icon:ri};case`semantic_model`:return{color:M.rose[400],icon:ii};default:return{color:`inherit`,icon:void 0}}}M.green[500],M.red[500],M.amber[500],M.neutral[500],M.green[100],M.red[200],M.amber[100],M.white,M.green[900],M.red[950],M.amber[900],M.neutral[700];const si={added:`#22c55e`,removed:`#ef4444`,modified:`#f59e0b`,unchanged:`#94a3b8`};function ci({id:e,sourceX:t,sourceY:n,targetX:r,targetY:i,sourcePosition:a,targetPosition:o,data:s,selected:c}){let l=s?.changeStatus??`unchanged`,u=s?.isHighlighted??!1,d=s?.label,[f,p,m]=sn({sourceX:t,sourceY:n,sourcePosition:a,targetX:r,targetY:i,targetPosition:o}),h=si[l];return U(V,{children:[H(Qt,{id:e,path:f,style:{stroke:h,strokeWidth:u||c?2.5:1.5,opacity:u||c?1:.6}}),d&&H(en,{children:H(`div`,{style:{position:`absolute`,transform:`translate(-50%, -50%) translate(${p}px,${m}px)`,fontSize:10,fontWeight:500,background:`white`,padding:`2px 4px`,borderRadius:4,pointerEvents:`all`},children:d})})]})}const li=F(ci);li.displayName=`LineageEdge`;function ui({changedOnly:e,onChange:t}){return H(fn,{control:H(dn,{checked:e??!1,onChange:()=>{t()},size:`small`}),label:`Changed only`,slotProps:{typography:{variant:`body2`}}})}function di({value:e,onChange:t,textOn:n,textOff:r}){return U(pn,{variant:`outlined`,size:`xsmall`,sx:{borderRadius:1},children:[H(G,{onClick:()=>{t(!1)},sx:{color:e?`text.disabled`:`text.primary`,bgcolor:e?`action.hover`:`background.paper`,borderColor:`divider`,"&:hover":{bgcolor:e?`action.selected`:`background.paper`,borderColor:`divider`}},children:r??`Off`}),H(G,{onClick:()=>{t(!0)},sx:{color:e?`text.primary`:`text.disabled`,bgcolor:e?`background.paper`:`action.hover`,borderColor:`divider`,"&:hover":{bgcolor:e?`background.paper`:`action.selected`,borderColor:`divider`}},children:n??`On`})]})}function fi({displayMode:e,onDisplayModeChanged:t}){return U(V,{children:[e===`inline`&&U(V,{children:[H(Ie,{value:`Base`,colorPalette:`red`,grayOut:!1,fontSize:`10pt`,noCopy:!0}),H(Ie,{value:`Current`,colorPalette:`green`,grayOut:!1,fontSize:`10pt`,noCopy:!0})]}),H(di,{value:e===`side_by_side`,onChange:e=>{t(e?`side_by_side`:`inline`)},textOff:`Inline`,textOn:`Side by side`})]})}const pi=e=>{let{defaultValues:t,suggestionList:n,onValuesChange:r,className:i}=e,[a,o]=B(t??[]),[s,c]=B(``),[l,u]=B(!1),[d,f]=B(null),p=z(null),m=!!d,h=t=>t.length>1?`${t.length} ${e.unitName}s selected`:t.length===1?t[0]:``,g=e=>{f(e.currentTarget),setTimeout(()=>p.current?.focus(),100)},_=()=>{f(null),u(!1)},v=e=>{a.includes(e)||(c(``),o([...a,e]),r([...a,e]))},y=()=>{c(``),o([]),r([])},b=e=>{o(a.filter(t=>t!==e)),r(a.filter(t=>t!==e))},x=s.toLowerCase(),S=n?.filter(e=>x===``||e.toLowerCase().includes(x)).filter(e=>!a.includes(e))??[],C=()=>{switch(e.size){case`2xs`:return`0.625rem`;case`xs`:return`0.75rem`;case`sm`:return`0.875rem`;default:return`0.875rem`}};return U(W,{sx:{display:`flex`,alignItems:`center`,width:e.width},className:i,children:[U(G,{variant:`outlined`,color:`neutral`,size:`small`,onClick:g,disabled:e.disabled,sx:{width:`100%`,height:(()=>{switch(e.size){case`2xs`:return 24;case`xs`:return 28;case`sm`:return 32;default:return 36}})(),justifyContent:`space-between`,textTransform:`none`,fontSize:C(),fontWeight:`normal`,px:1},children:[H(q,{component:`span`,sx:{fontSize:C(),color:a.length>0?`text.primary`:`text.secondary`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:h(a)||e.placeholder||``}),a.length>0&&H(q,{component:`span`,onClick:e=>{e.stopPropagation(),y()},sx:{fontSize:C(),color:`primary.main`,cursor:`pointer`,ml:1,"&:hover":{textDecoration:`underline`}},children:`Clear`})]}),U(_n,{anchorEl:d,open:m,onClose:_,slotProps:{paper:{sx:{width:e.width,fontSize:C()}}},children:[H(W,{sx:{px:.5,py:.5},children:U(W,{sx:{border:`1px solid`,borderColor:`divider`,borderRadius:1,p:.5,display:`flex`,flexWrap:`wrap`,gap:.5,alignItems:`center`},className:`no-track-pii-safe`,children:[a.map(e=>H(Xt,{label:e,size:`small`,onDelete:()=>b(e),sx:{height:22,fontSize:C()}},e)),H(gn,{inputRef:p,placeholder:`Filter or add custom keys`,value:s,onChange:e=>{c(e.target.value),u(!0)},onKeyDown:e=>{e.key!==`Escape`&&e.stopPropagation();let t=e.target,n=t.value.trim().replace(`,`,``);switch(e.key){case`,`:case`Enter`:e.preventDefault(),n&&(v(n),c(``));break;case`Backspace`:t.value===``&&a.length>0&&(o(a.slice(0,-1)),r(a.slice(0,-1)));break;default:break}},onBlur:()=>{p.current&&l&&p.current.focus()},sx:{flex:1,minWidth:120,fontSize:C(),"& input":{p:.5}}})]})}),H(Et,{}),s!==``&&!n?.includes(s)&&U(X,{onClick:()=>{v(s),u(!1)},sx:{fontSize:C()},children:[`Add '`,s,`' to the list`]}),S.slice(0,10).map((e,t)=>H(X,{onClick:()=>{v(e)},sx:{fontSize:C()},children:e},vn.uniqueId(`option-${t}`))),S.length>10&&H(Y,{title:`Please use filter to find more items`,placement:`top`,children:U(W,{px:1.5,py:.5,color:`text.secondary`,fontSize:`8pt`,children:[`and `,S.length-10,` more items...`]})})]})]})};function mi(e){let t=[`CHAR`,`VARCHAR`,`TINYTEXT`,`TEXT`,`MEDIUMTEXT`,`LONGTEXT`,`NCHAR`,`NVARCHAR`,`VARCHAR2`,`NVARCHAR2`,`CLOB`,`NCLOB`,`VARCHAR(MAX)`,`XML`,`JSON`],n=e.trim().toUpperCase();return t.includes(n)?!0:/^(VARCHAR|NVARCHAR|VARCHAR2|NVARCHAR2|CHAR|NCHAR)\(\d+\)$/.test(n)}function hi(e){return[`BOOLEAN`,`TINYINT(1)`,`BIT`,`NUMBER(1)`,`BOOL`].includes(e.toUpperCase())}function gi(e){return[`DATE`,`DATETIME`,`TIMESTAMP`,`TIME`,`YEAR`,`DATETIME2`,`SMALLDATETIME`,`DATETIMEOFFSET`,`INTERVAL`,`TIMESTAMPTZ`,`TIMETZ`,`TIMESTAMP WITH TIME ZONE`,`TIMESTAMP WITH LOCAL TIME ZONE`,`TIMESTAMP_LTZ`,`TIMESTAMP_NTZ`,`TIMESTAMP_TZ`].includes(e.toUpperCase())}function _i(e){return!mi(e)&&!hi(e)&&!gi(e)}function vi({params:e,onParamsChanged:t,setIsReadyToExecute:n}){let{columns:r,isLoading:i,error:a}=al(e.model),o=r.filter(e=>!mi(e.type)&&!hi(e.type)&&!gi(e.type));return i?H(W,{children:`Loading...`}):r.length===0||a?H(W,{children:`Error: Please provide the 'catalog.json' to list column candidates`}):H(W,{sx:{m:`16px`},children:U(Sn,{fullWidth:!0,disabled:o.length===0,children:[H(Cn,{sx:{mb:1},children:`Pick a column to show Histogram Diff`}),U(wn,{value:e.column_name,onChange:r=>{let i=r.target.value;n(!!i);let a=o.find(e=>e.name===i)?.type??``;t({...e,column_name:i,column_type:a})},children:[H(`option`,{value:``,children:o.length===0?`No numeric column is available`:`Select column`}),o.map(e=>U(`option`,{value:e.name,className:`no-track-pii-safe`,children:[e.name,` : `,e.type]},e.name))]})]})})}const yi=[{status:`added`,label:`Added`,description:`Newly added resource`},{status:`removed`,label:`Removed`,description:`Removed resource`},{status:`modified`,label:`Modified`,description:`Modified resource`}],bi=[{type:`passthrough`,label:`Passthrough`,description:`Column passes through unchanged`},{type:`renamed`,label:`Renamed`,description:`Column was renamed from source`},{type:`derived`,label:`Derived`,description:`Column is derived from other columns`},{type:`source`,label:`Source`,description:`Original source column`},{type:`unknown`,label:`Unknown`,description:`Transformation type could not be determined`}],xi={added:{color:`#22c55e`,symbol:`+`},removed:{color:`#ef4444`,symbol:`-`},modified:{color:`#f59e0b`,symbol:`~`}},Si={passthrough:{letter:`P`,color:`default`},renamed:{letter:`R`,color:`warning`},derived:{letter:`D`,color:`warning`},source:{letter:`S`,color:`info`},unknown:{letter:`U`,color:`error`}};function Ci({status:e}){let t=xi[e];return H(W,{sx:{width:16,height:16,borderRadius:`50%`,backgroundColor:t.color,color:`white`,fontSize:10,fontWeight:`bold`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:t.symbol})}function wi({type:e}){let t=Si[e];return H(Xt,{label:t.letter,size:`small`,color:t.color,sx:{fontSize:`8pt`,height:18,minWidth:18,"& .MuiChip-label":{px:.5}}})}function Ti({variant:e,showTooltips:t=!0,title:n,className:r}){let i=e===`changeStatus`?yi:bi;return U(W,{className:r,sx:{bgcolor:`background.paper`,padding:`12px`,border:`1px solid`,borderColor:`divider`,borderRadius:1,fontSize:`0.875rem`},children:[n&&H(q,{variant:`caption`,sx:{display:`block`,fontWeight:600,mb:1,color:`text.secondary`},children:n}),e===`changeStatus`&&i.map(e=>{let n=U(W,{sx:{display:`flex`,alignItems:`center`,gap:`8px`,mb:`4px`,"&:last-child":{mb:0}},children:[H(Ci,{status:e.status}),H(q,{variant:`body2`,children:e.label})]},e.status);return t&&e.description?H(Y,{title:e.description,placement:`right`,children:n},e.status):n}),e===`transformation`&&i.map(e=>{let n=U(W,{sx:{display:`flex`,alignItems:`center`,gap:`8px`,mb:`4px`,"&:last-child":{mb:0}},children:[H(wi,{type:e.type}),H(q,{variant:`body2`,children:e.label})]},e.type);return t&&e.description?H(Y,{title:e.description,placement:`right`,children:n},e.type):n})]})}const Ei={breaking:`Breaking`,non_breaking:`Non Breaking`,partial_breaking:`Partial Breaking`,unknown:`Unknown`},Di=()=>H(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 16 16`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,children:H(`path`,{d:`M8 3a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm0 6.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm0 6.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z`})}),Oi=()=>H(`svg`,{stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`,viewBox:`0 0 512 512`,height:`1em`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,children:H(`path`,{d:`M256 56c110.532 0 200 89.451 200 200 0 110.532-89.451 200-200 200-110.532 0-200-89.451-200-200 0-110.532 89.451-200 200-200m0-48C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm0 168c-44.183 0-80 35.817-80 80s35.817 80 80 80 80-35.817 80-80-35.817-80-80-80z`})});function ki({name:e,color:t,resourceType:n}){let r=n===`model`?e:`${e} (${n||`unknown`})`;return H(W,{sx:{flex:1,color:t,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:H(Y,{title:r,placement:`top`,children:H(`span`,{children:e})})})}function Ai({id:e,data:t,selected:n,interactive:r=!1,selectMode:i=`normal`,isNodeSelected:a=!1,isFocused:o=!1,isHighlighted:s=!0,showContent:c=!0,actionTag:l,showChangeAnalysis:u=!1,changeCategory:d,runsAggregatedTag:f,hasParents:p=!0,hasChildren:m=!0,columnCount:h=0,columnHeight:g=28,isDark:_=!1,onNodeClick:v,onNodeDoubleClick:y,onSelect:b,onContextMenu:x,onShowImpactRadius:S}){let[C,w]=B(!1),{label:T,changeStatus:E=`unchanged`,isSelected:ee,resourceType:te}=t,D=a||ee||n||!1,O=h>0,k=i===`action_result`&&l,{icon:ne,color:re,backgroundColor:A}=ai(E,_),{icon:ie}=oi(te),ae=re,oe=(()=>{let e=_?`#1e1e1e`:`#ffffff`;return c?i===`selecting`?D?re:e:i===`action_result`?k?o||D||C?A:re:e:o||D||C?A:e:o||D||C?re:A})(),se=(()=>{let e=_?`#ffffff`:`#000000`,t=_?`#000000`:`#ffffff`;return i===`selecting`?D?t:e:i===`action_result`&&k&&!D?t:e})(),j=(()=>{let e=_?`#ffffff`:`#000000`,t=_?`#000000`:`#ffffff`;return i===`selecting`?D?t:e:i===`action_result`&&k&&!D?t:e})(),ce=(()=>{let e=_?`#ffffff`:`#000000`,t=_?`#000000`:`#ffffff`;return i===`selecting`?D?t:re:i===`action_result`?k&&!D?t:e:re})(),le=(()=>i===`action_result`?k?`none`:`opacity(0.2) grayscale(50%)`:s||o||D||C?`none`:`opacity(0.2) grayscale(50%)`)(),ue=t=>{i!==`action_result`&&(t.stopPropagation(),b?.(e))},de=t=>{t.preventDefault(),t.stopPropagation(),x?.(t,e)},fe=t=>{t.preventDefault(),t.stopPropagation(),S?.(e)};return U(W,{onClick:()=>v?.(e),onDoubleClick:()=>y?.(e),onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),sx:{display:`flex`,flexDirection:`column`,width:300,cursor:i===`selecting`?`pointer`:`inherit`,transition:`box-shadow 0.2s ease-in-out`,padding:0,filter:le},children:[U(W,{sx:{display:`flex`,borderColor:ae,borderWidth:`2px`,borderStyle:`solid`,borderTopLeftRadius:8,borderTopRightRadius:8,borderBottomLeftRadius:O?0:8,borderBottomRightRadius:O?0:8,backgroundColor:oe,height:60},children:[H(W,{sx:{display:`flex`,bgcolor:re,padding:r?`8px`:`2px`,borderRightWidth:`2px`,borderRightStyle:`solid`,borderColor:i===`selecting`?`#00000020`:ae,alignItems:`top`,visibility:c?`inherit`:`hidden`},children:r&&H(dn,{checked:i===`selecting`&&D||i===`action_result`&&!!k,onClick:ue,disabled:i===`action_result`,size:`small`,sx:{padding:0,color:`inherit`,"&.Mui-checked":{color:`inherit`}}})}),U(W,{sx:{display:`flex`,flex:`1 0 auto`,mx:.5,width:100,flexDirection:`column`},children:[U(W,{sx:{display:`flex`,width:`100%`,textAlign:`left`,fontWeight:600,flex:1,p:.5,gap:`5px`,alignItems:`center`,visibility:c?`inherit`:`hidden`},children:[H(ki,{name:T,color:se,resourceType:te}),C?U(V,{children:[E===`modified`&&S&&H(Y,{title:`Show Impact Radius`,placement:`top`,children:H(W,{onClick:fe,sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,color:`text.secondary`,"&:hover":{color:`text.primary`}},children:H(Oi,{})})}),x&&H(W,{onClick:de,sx:{cursor:`pointer`,color:`text.secondary`,"&:hover":{color:`text.primary`}},children:H(Di,{})})]}):U(V,{children:[ie&&H(W,{sx:{fontSize:16,color:j},children:H(ie,{})}),E&&ne&&H(W,{sx:{color:ce},children:H(ne,{})})]})]}),H(W,{sx:{display:`flex`,flex:`1 0 auto`,mx:.5,flexDirection:`column`,paddingBottom:.5,visibility:c?`inherit`:`hidden`},children:H(K,{direction:`row`,spacing:1,children:l?U(V,{children:[H(W,{sx:{flexGrow:1}}),l]}):u&&d?H(q,{sx:{height:20,color:`text.secondary`,fontSize:`9pt`,margin:0,fontWeight:600},children:Ei[d]}):i!==`action_result`&&f?f:null})})]})]}),O&&H(W,{sx:{p:`10px 10px`,borderColor:ae,borderWidth:`2px`,borderStyle:`solid`,borderTopWidth:0,borderBottomLeftRadius:8,borderBottomRightRadius:8},children:H(W,{sx:{height:`${h*g}px`,overflow:`auto`}})}),p&&H(tn,{type:`target`,position:rn.Left,isConnectable:!1}),m&&H(tn,{type:`source`,position:rn.Right,isConnectable:!1})]})}const ji=F(Ai);ji.displayName=`LineageNode`;const Mi=()=>U(W,{component:`span`,sx:{display:`flex`,flexDirection:`column`,gap:`2px`,"& > span":{width:4,height:4,borderRadius:`50%`,backgroundColor:`currentColor`}},children:[H(`span`,{}),H(`span`,{}),H(`span`,{})]});function Ni({checkId:e,primaryActions:t=[],secondaryActions:n=[],onAction:r,variant:i=`combined`,size:a=`small`,menuIcon:o,className:s}){let[c,l]=B(null),u=!!c,d=e=>{e.stopPropagation(),l(e.currentTarget)},f=()=>{l(null)},p=t=>{f(),r?.(e,t)},m=e=>{let t=H(G,{variant:`outlined`,size:a,disabled:e.disabled,onClick:()=>p(e.type),startIcon:e.icon,color:e.destructive?`error`:`inherit`,children:e.label},e.type);return e.disabled&&e.disabledTooltip?H(Y,{title:e.disabledTooltip,children:H(`span`,{children:t})},e.type):t};if(i===`menu`){let e=[...t,...n];return U(W,{className:s,children:[H(J,{onClick:d,size:a,children:o||H(Mi,{})}),H(_n,{anchorEl:c,open:u,onClose:f,children:e.map(e=>U(X,{onClick:()=>p(e.type),disabled:e.disabled,sx:{color:e.destructive?`error.main`:`inherit`},children:[e.icon&&H(W,{component:`span`,sx:{mr:1,display:`flex`},children:e.icon}),e.label]},e.type))})]})}return i===`buttons`?H(W,{className:s,sx:{display:`flex`,gap:1},children:H(pn,{size:a,variant:`outlined`,children:t.map(m)})}):U(W,{className:s,sx:{display:`flex`,gap:1},children:[t.length>0&&H(pn,{size:a,variant:`outlined`,children:t.map(m)}),n.length>0&&U(V,{children:[H(J,{onClick:d,size:a,children:o||H(Mi,{})}),H(_n,{anchorEl:c,open:u,onClose:f,children:n.map(e=>U(X,{onClick:()=>p(e.type),disabled:e.disabled,sx:{color:e.destructive?`error.main`:`inherit`},children:[e.icon&&H(W,{component:`span`,sx:{mr:1,display:`flex`},children:e.icon}),e.label]},e.type))})]})]})}const Pi=F(Ni);Pi.displayName=`CheckActions`;function Fi({name:e,onNameChange:t,placeholder:n=`Unnamed check`,disabled:r=!1,className:i}){let[a,o]=B(!1),[s,c]=B(e),l=z(null);L(()=>{c(e)},[e]);let u=I(()=>{r||(c(e),o(!0))},[r,e]),d=I(()=>{let n=s.trim();n&&n!==e&&t?.(n),o(!1)},[s,e,t]),f=I(t=>{t.key===`Enter`?(t.preventDefault(),d()):t.key===`Escape`&&(t.preventDefault(),c(e),o(!1))},[d,e]),p=I(e=>{c(e.target.value)},[]);return L(()=>{let e=e=>{l.current&&!l.current.contains(e.target)&&d()};return a&&document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[a,d]),L(()=>{a&&l.current&&(l.current.focus(),l.current.select())},[a]),H(W,{className:i,sx:{flex:`2`,fontSize:`1rem`,fontWeight:500,overflow:`hidden`,color:`text.primary`,cursor:r?`default`:`pointer`},children:a?H(Tn,{inputRef:l,value:s,onChange:p,onKeyDown:f,placeholder:n,size:`small`,sx:{width:`100%`},variant:`outlined`}):H(W,{sx:{flex:`0 1 auto`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,overflow:`hidden`,"&:hover":{textDecoration:r?`none`:`underline`}},onClick:u,children:e||H(W,{component:`span`,sx:{color:`text.secondary`,fontStyle:`italic`},children:n})})})}const Ii=F(Fi);Ii.displayName=`CheckBreadcrumb`;function Li(e){return{query:`Q`,query_base:`Q`,query_diff:`QD`,schema_diff:`SD`,lineage_diff:`LD`,profile:`P`,profile_diff:`PD`,row_count:`R`,row_count_diff:`RD`,value_diff:`VD`,histogram_diff:`H`,top_k_diff:`TK`,simple:`•`}[e]||`?`}function Ri(e){return{query:`#3b82f6`,query_base:`#3b82f6`,query_diff:`#8b5cf6`,schema_diff:`#06b6d4`,lineage_diff:`#10b981`,profile:`#f59e0b`,profile_diff:`#f97316`,row_count:`#ec4899`,row_count_diff:`#ef4444`,value_diff:`#6366f1`,histogram_diff:`#14b8a6`,top_k_diff:`#a855f7`,simple:`#6b7280`}[e]||`#6b7280`}function zi({check:e,isSelected:t=!1,onClick:n,onApprovalChange:r,disableApproval:i=!1,disabledApprovalTooltip:a,disabled:o=!1,className:s}){let c=()=>{!o&&n&&n(e.id)},l=H(dn,{checked:e.isApproved??!1,onChange:(t,n)=>{r&&r(e.id,n)},onClick:e=>{e.stopPropagation()},disabled:i||o,size:`small`,sx:{padding:`4px`,"&.Mui-disabled":{opacity:.5}}});return U(W,{className:s,onClick:c,sx:{display:`flex`,alignItems:`center`,gap:1,padding:`8px 12px`,cursor:o?`default`:`pointer`,borderLeft:t?`3px solid`:`3px solid transparent`,borderLeftColor:t?`primary.main`:`transparent`,backgroundColor:t?`action.selected`:`transparent`,opacity:o?.6:1,transition:`background-color 0.15s ease`,"&:hover":{backgroundColor:o?`transparent`:t?`action.selected`:`action.hover`}},children:[H(Xt,{label:Li(e.type),size:`small`,sx:{minWidth:32,height:24,fontSize:`0.7rem`,fontWeight:600,backgroundColor:`${Ri(e.type)}20`,color:Ri(e.type),"& .MuiChip-label":{px:1}}}),H(q,{variant:`body2`,sx:{flexGrow:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.name}),e.isPreset&&H(Xt,{label:`Preset`,size:`small`,variant:`outlined`,sx:{height:20,fontSize:`0.65rem`}}),i&&a?H(Y,{title:a,children:H(`span`,{children:l})}):l]})}const Bi=F(zi);Bi.displayName=`CheckCard`;function Vi({value:e,onChange:t,placeholder:n=`Add description here`,disabled:r=!1,className:i}){let[a,o]=B(!1),[s,c]=B(e??``);L(()=>{c(e??``)},[e]);let l=I(()=>{r||(o(!0),c(e??``))},[r,e]),u=I(()=>{let e=s.trim();t?.(e||void 0),o(!1)},[s,t]),d=I(()=>{c(e??``),o(!1)},[e]),f=I(e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),u()),e.key===`Escape`&&(e.preventDefault(),d())},[u,d]);return a?U(W,{className:i,sx:{height:`100%`},children:[H(Tn,{multiline:!0,fullWidth:!0,minRows:3,value:s,onChange:e=>c(e.target.value),onKeyDown:f,placeholder:n,autoFocus:!0,sx:{"& .MuiInputBase-root":{fontSize:`0.875rem`}}}),U(K,{direction:`row`,spacing:1,sx:{mt:1},children:[H(G,{variant:`contained`,size:`small`,onClick:u,children:`Update`}),H(pt,{component:`button`,variant:`body2`,onClick:d,sx:{cursor:`pointer`},children:`Cancel`})]}),U(q,{variant:`caption`,color:`text.secondary`,sx:{display:`block`,mt:.5},children:[navigator.platform.includes(`Mac`)?`⌘`:`Ctrl`,`+Enter to save, Escape to cancel`]})]}):H(W,{className:i,onClick:l,sx:{height:`100%`,overflow:`auto`,cursor:r?`default`:`pointer`,padding:1,borderRadius:1,"&:hover":{backgroundColor:r?`transparent`:`action.hover`}},children:e?H(q,{variant:`body2`,sx:{whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:e}):H(q,{variant:`body2`,sx:{color:`text.secondary`,fontStyle:`italic`},children:n})})}const Hi=F(Vi);Hi.displayName=`CheckDescription`;function Ui({checkId:e,name:t,type:n,description:r,isApproved:i=!1,tabs:a=[],defaultTab:o,primaryActions:s=[],secondaryActions:c=[],onAction:l,onDescriptionChange:u,onNameChange:d,disabled:f=!1,headerContent:p,sidebarContent:m,className:h}){let[g,_]=B(o??a[0]?.id),[v,y]=B(!1),[b,x]=B(t),S=()=>{f||(y(!0),x(t))},C=()=>{b.trim()&&b!==t&&d?.(b.trim()),y(!1)},w=e=>{e.key===`Enter`?C():e.key===`Escape`&&(x(t),y(!1))},T=a.find(e=>e.id===g)?.content;return U(W,{className:h,sx:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`hidden`},children:[U(W,{sx:{p:2,borderBottom:1,borderColor:`divider`},children:[p,U(W,{sx:{display:`flex`,alignItems:`flex-start`,justifyContent:`space-between`,gap:2},children:[U(W,{sx:{flexGrow:1,minWidth:0},children:[v?H(`input`,{type:`text`,value:b,onChange:e=>x(e.target.value),onBlur:C,onKeyDown:w,autoFocus:!0,style:{fontSize:`1.25rem`,fontWeight:500,border:`none`,borderBottom:`2px solid`,borderColor:`currentColor`,outline:`none`,background:`transparent`,width:`100%`}}):H(q,{variant:`h6`,onClick:S,sx:{cursor:f?`default`:`pointer`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,"&:hover":{textDecoration:f?`none`:`underline`}},children:t}),U(q,{variant:`caption`,color:`text.secondary`,children:[n,` `,i&&`• Approved`]})]}),H(Pi,{checkId:e,primaryActions:s,secondaryActions:c,onAction:l})]})]}),U(W,{sx:{display:`flex`,flexGrow:1,overflow:`hidden`},children:[U(W,{sx:{flexGrow:1,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[U(W,{sx:{p:2,borderBottom:1,borderColor:`divider`},children:[H(q,{variant:`subtitle2`,sx:{mb:1},children:`Description`}),H(Hi,{value:r,onChange:u,disabled:f})]}),a.length>0&&U(V,{children:[H(W,{sx:{borderBottom:1,borderColor:`divider`},children:H(Dn,{value:g,onChange:(e,t)=>_(t),children:a.map(e=>H(En,{value:e.id,label:e.label},e.id))})}),H(W,{sx:{flexGrow:1,overflow:`auto`,p:2},children:T})]})]}),m&&U(V,{children:[H(Et,{orientation:`vertical`,flexItem:!0}),H(W,{sx:{width:350,flexShrink:0,overflow:`auto`},children:m})]})]})]})}const Wi=F(Ui);Wi.displayName=`CheckDetail`;function Gi({title:e=`No checks yet`,description:t=`Create your first check to start validating data changes`,icon:n,actionText:r,onAction:i,isLoading:a=!1,helperText:o,className:s}){return H(W,{className:s,sx:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,textAlign:`center`,padding:4,minHeight:300},children:U(K,{spacing:2,alignItems:`center`,children:[n&&H(W,{sx:{color:`text.secondary`,fontSize:48,mb:1},children:n}),H(q,{variant:`h6`,sx:{fontWeight:500,color:`text.primary`},children:e}),H(q,{variant:`body2`,sx:{color:`text.secondary`,maxWidth:400},children:t}),r&&i&&H(G,{variant:`contained`,onClick:i,disabled:a,sx:{mt:2},children:a?`Creating...`:r}),o&&H(q,{variant:`caption`,sx:{color:`text.secondary`,mt:1},children:o})]})})}const Ki=F(Gi);Ki.displayName=`CheckEmptyState`;function qi({checks:e,selectedId:t,onCheckSelect:n,onApprovalChange:r,disableApproval:i=!1,disabledApprovalTooltip:a,title:o,className:s,isLoading:c=!1,emptyContent:l}){return c?H(W,{className:s,sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:200},children:H(q,{color:`text.secondary`,children:`Loading checks...`})}):e.length===0?U(W,{className:s,children:[o&&H(q,{variant:`subtitle2`,sx:{px:2,py:1,color:`text.secondary`},children:o}),l||H(W,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:200},children:H(q,{color:`text.secondary`,children:`No checks`})})]}):U(W,{className:s,sx:{height:`100%`,overflow:`auto`},children:[o&&H(q,{variant:`subtitle2`,sx:{px:2,py:1,color:`text.secondary`},children:o}),H(On,{disablePadding:!0,children:e.map(e=>H(kn,{disablePadding:!0,children:H(Bi,{check:e,isSelected:t===e.id,onClick:n,onApprovalChange:r,disableApproval:i,disabledApprovalTooltip:a})},e.id))})]})}const Ji=F(qi);Ji.displayName=`CheckList`;const Yi={lineageNode:ji,lineageGraphColumnNode:qr},Xi={lineageEdge:li};function Zi({nodes:e,edges:t,onNodeSelect:n,onNodeDoubleClick:r,showMiniMap:i=!0,showControls:a=!0,showBackground:o=!0,height:s=600,interactive:c=!0}){let[l,u,d]=ln(e),[f,p,m]=cn(t),h=I((e,t)=>{n?.(t.id)},[n]),g=I(()=>{n?.(null)},[n]),_=I((e,t)=>{r?.(t.id)},[r]);return H(W,{sx:{width:`100%`,height:s},children:U(an,{nodes:l,edges:f,onNodesChange:c?d:void 0,onEdgesChange:c?m:void 0,onNodeClick:h,onNodeDoubleClick:_,onPaneClick:g,nodeTypes:Yi,edgeTypes:Xi,fitView:!0,nodesDraggable:c,nodesConnectable:!1,elementsSelectable:c,children:[o&&H(Zt,{}),a&&H($t,{}),i&&H(nn,{nodeColor:e=>{switch(e.data.changeStatus){case`added`:return`#22c55e`;case`removed`:return`#ef4444`;case`modified`:return`#f59e0b`;default:return`#94a3b8`}}})]})})}const Qi=ot(function(e,t){let{lineageGraph:n,viewOptions:r,interactive:i=!0,height:a=600,filterNodes:o,onNodeSelect:s,onNodeDoubleClick:c,dagre:l,showMiniMap:u=!0,showControls:d=!0,showBackground:f=!0}=e,p=z(null),m=A(),h=n??m.lineageGraph,g=!n&&m.isLoading,_=n?void 0:m.error,{nodes:v,edges:y}=R(()=>{if(!h)return{nodes:[],edges:[]};let e;if(r?.node_ids&&r.node_ids.length>0?e=r.node_ids:r?.view_mode===`changed_models`&&(e=h.modifiedSet),r?.select&&e&&r.select.includes(`+`)){let t=de(h,e),n=ue(h,e);e=[...new Set([...t,...n])]}if(r?.packages&&r.packages.length>0){let t=new Set(r.packages);e=(e??Object.keys(h.nodes)).filter(e=>{let n=h.nodes[e];return n?.data.packageName&&t.has(n.data.packageName)})}o&&(e=(e??Object.keys(h.nodes)).filter(e=>{let t=h.nodes[e];return t?o(e,t):!1}));let[t,n]=ae(h,e);return l&&t.length>0&&$i(l,t,n),{nodes:t.map(e=>({id:e.id,position:e.position,type:`lineageNode`,data:{label:e.data.name,nodeType:e.data.resourceType,changeStatus:e.data.changeStatus,resourceType:e.data.resourceType,packageName:e.data.packageName}})),edges:n.map(e=>({id:e.id,source:e.source,target:e.target,type:`lineageEdge`,data:{changeStatus:e.data?.changeStatus}}))}},[h,r,o,l]),b=I(async()=>{if(p.current)try{let e=await jn(p.current,{backgroundColor:`#ffffff`,pixelRatio:2}),t=await(await fetch(e)).blob();await navigator.clipboard.write([new ClipboardItem({[t.type]:t})])}catch(e){throw console.error(`Failed to copy to clipboard:`,e),e}},[]);return ct(t,()=>({copyToClipboard:b}),[b]),g?H(W,{sx:{width:`100%`,height:a,display:`flex`,alignItems:`center`,justifyContent:`center`},children:H(Dt,{})}):_?H(W,{sx:{width:`100%`,height:a,display:`flex`,alignItems:`center`,justifyContent:`center`},children:H(q,{color:`error`,children:_})}):h?v.length===0?H(W,{sx:{width:`100%`,height:a,display:`flex`,alignItems:`center`,justifyContent:`center`},children:H(q,{color:`text.secondary`,children:`No nodes match the current filter criteria.`})}):H(W,{ref:p,sx:{width:`100%`,height:a},children:H(Zi,{nodes:v,edges:y,onNodeSelect:s,onNodeDoubleClick:c,showMiniMap:u,showControls:d,showBackground:f,height:`100%`,interactive:i})}):H(W,{sx:{width:`100%`,height:a,display:`flex`,alignItems:`center`,justifyContent:`center`},children:H(q,{color:`text.secondary`,children:`No lineage data available. Provide data via LineageGraphProvider or lineageGraph prop.`})})});function $i(e,t,n,r=`LR`){let i=new e.graphlib.Graph;i.setDefaultEdgeLabel(()=>({})),i.setGraph({rankdir:r,ranksep:50,nodesep:30});for(let e of t){let t=e.style?.width?Number(e.style.width):300,n=e.style?.height?Number(e.style.height):60;i.setNode(e.id,{width:t,height:n})}for(let e of n)i.setEdge(e.source,e.target);e.layout(i);for(let e of t){let t=e.style?.width?Number(e.style.width):300,n=e.style?.height?Number(e.style.height):60,r=i.node(e.id);r&&(e.position={x:r.x-t/2,y:r.y-n/2})}}function ea({params:e,viewOptions:t,interactive:n=!1,height:r,dagre:i},a){let o={...t,...e};return H(W,{sx:{display:`flex`,flexDirection:`column`,height:r??`100%`},children:H(on,{children:H(Qi,{viewOptions:o,interactive:n,ref:a,dagre:i})})})}const ta=ot(ea);ta.displayName=`LineageDiffView`;function na(e){switch(e){case`sql`:return Pn({dialect:Nn});case`yaml`:return Fn();default:return null}}function ra({value:e,onChange:t,language:n=`sql`,readOnly:r=!1,lineNumbers:i=!0,wordWrap:a=!0,fontSize:o=14,height:s=`100%`,className:c=``,theme:l=`light`,keyBindings:u=[]}){let d=R(()=>{let e=[Rn.theme({"&":{fontSize:`${o}px`},".cm-content":{fontFamily:`'JetBrains Mono', 'Fira Code', monospace`},".cm-gutters":{fontFamily:`'JetBrains Mono', 'Fira Code', monospace`}})],t=na(n);return t&&e.push(t),a&&e.push(Rn.lineWrapping),u.length>0&&e.push(Ln.highest(zn.of(u))),e},[n,o,a,u]),f=R(()=>l===`dark`?Vn:Hn,[l]);return H(Un,{value:e,onChange:e=>{t&&t(e)},extensions:d,readOnly:r,basicSetup:{lineNumbers:i,foldGutter:!0,highlightActiveLineGutter:!r,highlightActiveLine:!r,tabSize:2},height:s,className:`${c} no-track-pii-safe`,theme:f})}function ia({name:e,description:t,type:n,params:r,viewOptions:i}){let a={name:e,description:t,type:n,params:r};return i&&(a.view_options=i),Mn.stringify({checks:[a]})}function aa({yamlTemplate:e,height:t=`300px`}){return H(ra,{value:e,language:`yaml`,readOnly:!0,lineNumbers:!1,wordWrap:!0,fontSize:14,theme:N()?`dark`:`light`,height:t})}const oa=F(aa);oa.displayName=`PresetCheckTemplateView`;const sa={apiPrefix:``,authToken:void 0,baseUrl:void 0,apiClient:nt.create({baseURL:We})};function ca(){return te()??sa}function la({userId:e,enabled:t=!0}){let{apiClient:n}=ca(),r=e?.toString(),{data:i,isLoading:a}=et({queryKey:D.user(),queryFn:()=>Ve(n),enabled:t&&!!r,retry:!1,staleTime:300*1e3}),o=!!(i&&r&&i.id===r)&&i?.login_type===`github`,s=!!(t&&o&&r),{data:c,isLoading:l}=et({queryKey:[`github-avatar`,r],queryFn:()=>r?He(r):Promise.resolve(null),enabled:s,retry:!1,staleTime:300*1e3});return{avatarUrl:typeof c==`string`?c:null,isLoading:a||s&&l,isGitHubUser:!!o}}function ua({onSubmit:e,isSubmitting:t=!1,placeholder:n=`Add a comment...`,submitLabel:r=`Comment`,submittingLabel:i=`Submitting...`,className:a}){let o=N(),[s,c]=B(``),l=I(()=>{let t=s.trim();t&&(e(t),c(``))},[s,e]),u=I(e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),l())},[l]);return U(W,{className:a,children:[H(Tn,{value:s,onChange:I(e=>{c(e.target.value)},[]),onKeyDown:u,placeholder:n,size:`small`,multiline:!0,fullWidth:!0,minRows:3,disabled:t,sx:{"& .MuiOutlinedInput-root":{bgcolor:`background.paper`,"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:o?`grey.500`:`grey.400`},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:`iochmara.400`,boxShadow:`0 0 0 1px #4299E1`}},"& .MuiOutlinedInput-notchedOutline":{borderColor:o?`grey.600`:void 0}}}),H(K,{direction:`row`,justifyContent:`flex-end`,sx:{mt:2},children:H(G,{size:`small`,color:`iochmara`,variant:`contained`,onClick:l,disabled:!s.trim()||t,children:t?i:r})})]})}const da=F(ua);da.displayName=`CommentInput`;function fa(e){switch(e.event_type){case`check_created`:return`create`;case`comment`:return`comment`;case`approval_change`:return e.new_value===`true`?`approve`:`unapprove`;case`description_change`:case`name_change`:return`edit`;case`preset_applied`:return`preset`;default:return`edit`}}function pa({event:e}){let t=fa(e),n={create:Wt,comment:Mt,approve:Pt,unapprove:Ft,edit:Ht,preset:At},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 H(W,{component:i,sx:{color:a,fontSize:16}})}function ma({actor:e}){let t=(e.fullname||e.login||`User`).charAt(0).toUpperCase();return H(Wn,{src:e.avatarUrl||void 0,sx:{width:24,height:24,fontSize:`0.75rem`},children:t})}function ha({event:e}){let{actor:t}=e,n=t.fullname||t.login||`Someone`,r=qn(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 U(W,{sx:{display:`flex`,gap:1,alignItems:`flex-start`,py:1},children:[H(W,{sx:{pt:`2px`},children:H(pa,{event:e})}),H(W,{sx:{flex:1},children:U(K,{direction:`row`,spacing:.5,flexWrap:`wrap`,alignItems:`center`,children:[H(ma,{actor:t}),H(q,{variant:`body2`,fontWeight:`500`,children:n}),H(q,{variant:`body2`,color:`text.secondary`,children:i}),H(q,{variant:`caption`,color:`text.disabled`,children:r})]})})]})}const ga=F(ha);ga.displayName=`StateChangeEvent`;function _a({event:e,currentUserId:t,onEdit:n,onDelete:r,markdownRenderer:i}){let a=N(),[o,s]=B(!1),[c,l]=B(e.content||``),[u,d]=B(!1),[f,p]=B(!1),[m,h]=B(null),g=!!m,{actor:_}=e,v=_.fullname||_.login||`Someone`,y=qn(new Date(e.created_at),{addSuffix:!0}),b=t&&String(_.user_id)===String(t),x=I(()=>{l(e.content||``),s(!0)},[e.content]),S=I(()=>{l(e.content||``),s(!1)},[e.content]),C=I(async()=>{let t=c.trim();if(!t||t===e.content){S();return}if(n){d(!0);try{await n(e.id,t),s(!1)}finally{d(!1)}}},[c,e.content,e.id,n,S]),w=I(e=>{e.key===`Escape`?S():e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),C())},[S,C]),T=I(e=>{h(e.currentTarget)},[]),E=I(()=>{h(null)},[]),ee=I(async()=>{if(r){p(!0);try{await r(e.id),E()}finally{p(!1)}}},[r,e.id,E]),te=I(e=>{l(e.target.value)},[]);return e.is_deleted?U(W,{sx:{display:`flex`,gap:1,alignItems:`center`,py:1},children:[H(W,{sx:{pt:`2px`,display:`flex`,alignItems:`center`},children:H(pa,{event:e})}),H(W,{sx:{display:`flex`,flex:1,alignItems:`center`},children:H(q,{variant:`body2`,color:`text.disabled`,fontStyle:`italic`,children:`Comment deleted`})})]}):U(W,{sx:{display:`flex`,gap:1,alignItems:`flex-start`,py:1},children:[H(W,{sx:{pt:`2px`},children:H(pa,{event:e})}),U(W,{sx:{flex:1},children:[U(K,{direction:`row`,spacing:.5,sx:{mb:.5},flexWrap:`wrap`,alignItems:`center`,children:[H(ma,{actor:_}),U(q,{variant:`body2`,fontWeight:`500`,children:[v,b&&U(q,{component:`span`,variant:`body2`,color:`text.secondary`,children:[` `,`(Author)`]})]}),H(q,{variant:`caption`,color:`text.disabled`,children:y}),e.is_edited&&H(q,{variant:`caption`,color:`text.disabled`,children:`(edited)`})]}),o?U(W,{children:[H(Tn,{value:c,onChange:te,onKeyDown:w,size:`small`,multiline:!0,minRows:3,fullWidth:!0,disabled:u,autoFocus:!0,sx:{"& .MuiOutlinedInput-root":{bgcolor:`background.paper`,"&:focus-within":{borderColor:`primary.main`}}}}),U(K,{direction:`row`,spacing:1,sx:{mt:1},justifyContent:`flex-end`,children:[H(G,{size:`small`,variant:`text`,onClick:S,disabled:u,children:`Cancel`}),H(G,{size:`small`,variant:`contained`,onClick:C,disabled:!c.trim()||u,children:u?`Saving...`:`Save`})]})]}):U(W,{sx:{bgcolor:a?`grey.800`:`grey.50`,borderRadius:1,p:1,border:`1px solid`,borderColor:a?`grey.700`:`grey.200`,position:`relative`,"&:hover .comment-actions":{opacity:1}},children:[i?H(i,{content:e.content||``}):H(q,{variant:`body2`,sx:{whiteSpace:`pre-wrap`},children:e.content}),b&&(n||r)&&U(K,{className:`comment-actions`,direction:`row`,spacing:0,sx:{position:`absolute`,top:4,right:4,opacity:0,transition:`opacity 0.2s`},children:[n&&H(Y,{title:`Edit comment`,children:H(J,{"aria-label":`Edit comment`,size:`small`,onClick:x,children:H(Ut,{})})}),r&&U(V,{children:[H(Y,{title:`Delete comment`,children:H(J,{"aria-label":`Delete comment`,size:`small`,color:`error`,onClick:T,children:H(qt,{})})}),H(Gn,{open:g,anchorEl:m,onClose:E,anchorOrigin:{vertical:`bottom`,horizontal:`center`},transformOrigin:{vertical:`top`,horizontal:`center`},children:U(W,{sx:{p:2},children:[H(q,{variant:`body2`,sx:{mb:2},children:`Delete this comment?`}),U(K,{direction:`row`,spacing:1,justifyContent:`flex-end`,children:[H(G,{size:`small`,variant:`text`,onClick:E,disabled:f,children:`Cancel`}),H(G,{size:`small`,variant:`contained`,color:`error`,onClick:ee,disabled:f,children:f?`Deleting...`:`Delete`})]})]})})]})]})]})]})]})}const va=F(_a);va.displayName=`CommentEvent`;function ya({event:e,currentUserId:t,onEdit:n,onDelete:r,markdownRenderer:i,className:a}){return e.event_type===`comment`?H(W,{className:a,children:H(va,{event:e,currentUserId:t,onEdit:n,onDelete:r,markdownRenderer:i})}):H(W,{className:a,children:H(ga,{event:e})})}const ba=F(ya);ba.displayName=`TimelineEvent`;function xa({name:e,isChecked:t}){return`${t?`✅ `:``}${e}`}function Sa({description:e,fallback:t=`_(no description)_`}){return(e??``)||t}function Ca({type:e,hasResult:t,hasError:n}){return e===`schema_diff`||e===`lineage_diff`?!1:!t||n}function wa({sql:e,label:t=`SQL`}){return`**${t}**
|
|
3
3
|
\`\`\`sql
|
|
4
4
|
${e}
|
|
5
5
|
\`\`\``}function Ta(e){return e.status?e.status:e.result?`Finished`:e.error?`Failed`:`Finished`}function Ea(e){switch(e){case`Running`:return{color:`blue`,label:`Running`};case`Finished`:return{color:`green`,label:`Finished`};case`Failed`:return{color:`red`,label:`Failed`};case`Cancelled`:return{color:`grey`,label:`Cancelled`};default:return{color:`green`,label:`Finished`}}}function Da({status:e,showSpinner:t=!0,size:n=`small`,className:r}){let{color:i,label:a}=Ea(e);return U(W,{className:r,sx:{display:`inline-flex`,alignItems:`center`,gap:.5},children:[e===`Running`&&t&&H(Dt,{size:n===`small`?12:16,color:`primary`}),H(q,{component:`span`,sx:{fontWeight:500,fontSize:n===`small`?`0.75rem`:`0.875rem`,color:`${i}.500`},children:a})]})}const Oa=F(Da);Oa.displayName=`RunStatusBadge`;function ka(e){if(e==null)return null;let t=new Date,n=new Date;return n.setDate(t.getDate()-1),t.toDateString()===e.toDateString()?`Today`:n.toDateString()===e.toDateString()?`Yesterday`:e.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})}function Aa(e){if(e==null)return null;let t=new Date,n=new Date;n.setDate(t.getDate()-1);let r=e.toLocaleTimeString(`en-US`,{hour:`2-digit`,minute:`2-digit`,hour12:!1});return t.toDateString()===e.toDateString()?`Today, ${r}`:n.toDateString()===e.toDateString()?`Yesterday, ${r}`:`${e.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})}, ${r}`}function ja({status:e,runAt:t,className:n}){let r=t?Aa(typeof t==`string`?new Date(t):t):null;return U(W,{className:n,sx:{display:`flex`,alignItems:`center`,gap:.5,fontSize:`0.75rem`,color:`text.secondary`},children:[H(Oa,{status:e,size:`small`}),r&&U(V,{children:[H(q,{component:`span`,sx:{fontSize:`inherit`},children:`•`}),H(q,{component:`span`,sx:{fontSize:`inherit`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:r})]})]})}const Ma=F(ja);Ma.displayName=`RunStatusWithDate`;function Na({run:e,className:t}){return H(Ma,{status:Ta(e),runAt:e.run_at,className:t})}const Pa=F(Na);Pa.displayName=`RunStatusAndDate`;function Fa({run:e,isSelected:t=!1,icon:n,onClick:r,onAddToChecklist:i,onGoToCheck:a,addToChecklistIcon:o,goToCheckIcon:s,hideAddToChecklist:c=!1,className:l}){let u=N(),d=e.checkId!=null,f=!c&&!d&&i;return U(W,{className:l,onClick:()=>r?.(e.id),sx:e=>({display:`flex`,flexDirection:`column`,width:`100%`,p:`8px 16px`,cursor:`pointer`,borderBottom:1,borderColor:`divider`,borderLeft:`4px solid`,borderLeftColor:t?`warning.main`:`transparent`,bgcolor:t?u?`warning.dark`:`warning.light`:`transparent`,"&:hover":{bgcolor:t?u?`warning.dark`:`warning.light`:e.palette.action.hover}}),children:[U(W,{sx:{display:`flex`,alignItems:`center`,gap:1.5},children:[n&&H(W,{sx:{fontSize:16,color:`text.secondary`,flexShrink:0},children:n}),H(q,{sx:{flex:1,fontSize:`0.875rem`,fontWeight:500,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,color:e.name?`text.primary`:`text.secondary`},children:e.name?.trim()||`<no name>`}),d&&a&&H(Y,{title:`Go to Check`,children:H(J,{size:`small`,onClick:t=>{t.stopPropagation(),e.checkId&&a(e.checkId)},sx:{p:.5},children:s||H(W,{component:`span`,sx:{fontSize:14,color:`success.main`},children:`✓`})})}),f&&H(Y,{title:`Add to Checklist`,children:H(J,{size:`small`,onClick:t=>{t.stopPropagation(),i(e.id)},sx:{p:.5},children:o||H(W,{component:`span`,sx:{fontSize:14},children:`○`})})})]}),H(Ma,{status:e.status,runAt:e.runAt})]})}const Ia=F(Fa);Ia.displayName=`RunListItem`;const La=F(function({date:e}){return H(W,{sx:{width:`100%`,p:`8px 16px`,borderBottom:1,borderColor:`divider`,color:`text.secondary`,fontSize:`0.75rem`,fontWeight:500,bgcolor:`action.hover`},children:e})});function Ra({runs:e,selectedId:t,isLoading:n=!1,onRunSelect:r,onAddToChecklist:i,onGoToCheck:a,getRunIcon:o,hideAddToChecklist:s=!1,title:c=`Runs`,headerActions:l,emptyMessage:u=`No runs`,loadingMessage:d=`Loading...`,groupByDate:f=!1,addToChecklistIcon:p,goToCheckIcon:m,className:h}){return U(W,{className:h,sx:{display:`flex`,flexDirection:`column`,height:`100%`,width:`100%`},children:[U(K,{direction:`row`,alignItems:`center`,sx:{flex:`0 0 auto`,px:2,py:1.5,borderBottom:1,borderColor:`divider`},children:[H(q,{variant:`h6`,children:c}),H(W,{sx:{flex:1}}),l]}),H(W,{sx:{flex:1,overflow:`auto`},children:n?H(W,{sx:{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100%`,color:`text.secondary`},children:d}):(()=>{if(e.length===0)return H(W,{sx:{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100%`,color:`text.secondary`,p:4},children:u});let n=null;return e.map(e=>{let c=e.runAt?ka(new Date(e.runAt)):null,l=f&&c&&n!==c;return n=c,U(W,{children:[l&&H(La,{date:c}),H(Ia,{run:e,isSelected:e.id===t,icon:o?.(e.type),onClick:r,onAddToChecklist:i,onGoToCheck:a,hideAddToChecklist:s,addToChecklistIcon:p,goToCheckIcon:m})]},e.id)})})()})]})}const za=F(Ra);za.displayName=`RunList`;function Ba({status:e,progress:t,message:n,errorMessage:r,variant:i=`spinner`,showStatus:a=!0,icon:o,className:s}){let c=e===`Running`,l=e===`Failed`,u=t!==void 0&&t>=0;return U(W,{className:s,sx:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:2,p:3,textAlign:`center`},children:[o?H(W,{sx:{fontSize:40,color:`text.secondary`},children:o}):c&&U(V,{children:[i===`spinner`&&H(Dt,{size:40,color:`primary`}),i===`circular`&&H(Dt,{size:60,variant:u?`determinate`:`indeterminate`,value:t,color:`primary`})]}),c&&i===`linear`&&U(W,{sx:{width:`100%`,maxWidth:300},children:[H(Jn,{variant:u?`determinate`:`indeterminate`,value:t,sx:{height:8,borderRadius:4}}),u&&U(q,{variant:`caption`,color:`text.secondary`,sx:{mt:.5,display:`block`},children:[Math.round(t),`%`]})]}),a&&H(Oa,{status:e,size:`medium`}),n&&!l&&H(q,{variant:`body2`,color:`text.secondary`,children:n}),l&&r&&H(W,{sx:{p:2,bgcolor:`error.light`,borderRadius:1,maxWidth:400},children:H(q,{variant:`body2`,color:`error.contrastText`,children:r})})]})}const Va=F(Ba);Va.displayName=`RunProgress`;function Ha({visible:e=!0,opacity:t=.8,...n}){return e?H(W,{sx:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,bgcolor:`rgba(255, 255, 255, ${t})`,zIndex:10,".dark &":{bgcolor:`rgba(0, 0, 0, ${t})`}},children:H(Va,{...n})}):null}const Ua=F(Ha);Ua.displayName=`RunProgressOverlay`;function Wa({warnings:e,children:t,className:n}){let r=N(),i=e&&e.length>0;return U(W,{className:n,sx:{display:`flex`,borderBottom:`1px solid`,borderColor:`divider`,justifyContent:`flex-end`,gap:`5px`,alignItems:`center`,px:`10px`,bgcolor:i?r?M.amber[900]:M.amber[100]:`inherit`,color:i?r?M.amber[200]:M.amber[800]:`inherit`},children:[H(W,{sx:{display:`flex`,flexDirection:`column`,alignItems:`flex-start`,gap:0},children:e?.map((e,t)=>U(W,{children:[H(Jt,{color:r?M.amber[400]:M.amber[600],style:{verticalAlign:`middle`,marginRight:4}}),e]},e))}),H(W,{sx:{flex:1,minHeight:`32px`}}),t]})}const Ga=F(Wa);Ga.displayName=`RunToolbar`,Zn.register(Yn,er,$n,Xn,tr,Qn,nr);const Ka=`#63B3ED`,qa=`#F6AD55`,Ja=`${Ka}A5`,Ya=`${qa}A5`,Xa=`#90CDF4`,Za=`#FBD38D`,Qa=`${Xa}A5`,$a=`${Za}A5`;function eo(e){return{gridColor:e?`#4b5563`:`#d1d5db`,textColor:e?`#e5e7eb`:`#374151`,borderColor:e?`#6b7280`:`#9ca3af`,tooltipBackgroundColor:e?`#1f2937`:`#ffffff`,tooltipTextColor:e?`#e5e7eb`:`#111827`,barLabelColor:`#1f2937`}}function to(e){return{current:e?Xa:Ka,base:e?Za:qa,currentWithAlpha:e?Qa:Ja,baseWithAlpha:e?$a:Ya}}function no(e){if(typeof e!=`number`)return String(e);let t=Math.abs(e),n=0xe8d4a51000,r=1e9,i=1e6,a=1e3;return t>=n?`${(e/n).toFixed(1)}T`:t>=r?`${(e/r).toFixed(1)}B`:t>=i?`${(e/i).toFixed(1)}M`:t>=a?`${(e/a).toFixed(1)}K`:t>=1?e.toFixed(2):t>=.01?e.toFixed(3):e.toExponential(2)}function ro(e,t){let n=e[t],r=e[t+1];return`${no(n)} - ${no(r)}`}function io(e){return e>0&&e<=.001?`<0.1%`:e<1&&e>=.999?`>99.9%`:`${(e*100).toFixed(1)}%`}function ao({title:e,dataType:t=`numeric`,samples:n=0,min:r=0,max:i=0,binEdges:a,baseData:o,currentData:s,animate:c=!1,hideAxis:l=!1,theme:u=`light`,height:d=300,className:f}){let p=u===`dark`,m=eo(p),h=to(p),g=t===`datetime`,_=R(()=>{let e=a.slice(0,-1).map((e,t)=>ro(a,t)),t=(e,t,n)=>{let r=e.counts??[];return{label:t,data:g?r.map((e,t)=>[a[t],e]):r,backgroundColor:n,borderColor:n,hoverBackgroundColor:n,borderWidth:0,categoryPercentage:1,barPercentage:1,xAxisID:`x`}};return{labels:e,datasets:[t(s,s.label??`Current`,h.currentWithAlpha),t(o,o.label??`Base`,h.baseWithAlpha)]}},[a,o,s,h,g]),v=R(()=>{let u=Math.max(...s.counts,...o.counts),d=a.slice(0,-1).map((e,t)=>ro(a,t)),f=g?`Date Range`:t===`string`?`Text Length`:`Value Range`;return{responsive:!0,maintainAspectRatio:!1,animation:c?void 0:!1,plugins:{legend:{reverse:!0,labels:{color:m.textColor}},title:{display:!0,text:e,font:{size:20},color:m.textColor},tooltip:{mode:`index`,intersect:!1,backgroundColor:m.tooltipBackgroundColor,titleColor:m.tooltipTextColor,bodyColor:m.tooltipTextColor,borderColor:m.borderColor,borderWidth:1,callbacks:{title([{dataIndex:e}]){return`${f}\n${ro(a,e)}`},label({datasetIndex:e,dataIndex:t,dataset:r}){let i=(e===0?s.counts:o.counts)[t],a=n>0?io(i/n):``;return`${r.label}: ${i}${a?` (${a})`:``}`}}}},scales:{x:g?{display:!l,type:`timeseries`,min:r,max:i,adapters:{date:{}},time:{minUnit:`day`},grid:{display:!1},ticks:{minRotation:30,maxRotation:30,maxTicksLimit:8,color:m.textColor}}:{display:!l,type:`category`,grid:{display:!1},ticks:{callback(e,t){return d[t]},color:m.textColor},stacked:!0},y:{display:!l,type:`linear`,max:u,border:{dash:[2,2],color:m.borderColor},grid:{color:m.gridColor},ticks:{maxTicksLimit:8,color:m.textColor,callback(e){return no(e)}},beginAtZero:!0}}}},[e,t,g,n,r,i,a,o,s,l,c,m]);return H(`div`,{className:f,style:{height:d},children:H(ir,{type:`bar`,options:v,data:_})})}const oo=F(ao);oo.displayName=`HistogramChart`,Ct.registerModules([St]);function so({emptyMessage:e}){return H(W,{sx:{display:`flex`,height:`35px`,alignItems:`center`,justifyContent:`center`,bgcolor:`grey.100`,textAlign:`center`,gridColumn:`1/-1`},children:H(q,{sx:{fontWeight:600},children:e??`No rows`})})}function co({style:e,className:t,columnDefs:n,rowData:r,columns:i,rows:a,getRowId:o,rowHeight:s=32,headerHeight:c=36,defaultColDef:l,defaultColumnOptions:u,renderers:d,rowClassName:f,containerClassName:p,...m},h){let g=z(null),_=z(null);ct(h,()=>({api:_.current,element:g.current}),[]);let v=N(),y=R(()=>v?ge:he,[v]),b=n??i,x=r??a,S=l??u,C=R(()=>({resizable:!0,suppressMovable:!0,...S}),[S]),w=R(()=>{if(d?.noRowsFallback)return()=>d.noRowsFallback},[d?.noRowsFallback]),T=R(()=>o||(e=>{let t=e.data;if(t?.__rowKey!==void 0)return String(t.__rowKey);let n=e.data?.rowIndex;return String(n??Math.random())}),[o]),E=R(()=>b?`grid-${b.filter(e=>`field`in e&&e.pinned===`left`).map(e=>e.field).sort().join(`,`)}`:`grid`,[b]);return H(W,{ref:g,className:[t,p].filter(Boolean).join(` `)||void 0,sx:{flex:1,minHeight:0,width:`100%`,overflow:`hidden`,"& .ag-root-wrapper":{border:`none`,height:`100%`},"& .ag-header":{borderBottom:`1px solid var(--ag-border-color)`},"& .ag-row":{borderBottom:`1px solid var(--ag-border-color)`},"& .ag-cell":{borderRight:`1px solid var(--ag-border-color)`},"& .ag-header-cell":{borderRight:`1px solid var(--ag-border-color)`},"& .diff-cell-added":{backgroundColor:v?`#1a4d1a !important`:`#cefece !important`,color:`var(--mui-palette-text-primary)`},"& .diff-cell-removed":{backgroundColor:v?`#5c1f1f !important`:`#ffc5c5 !important`,color:`var(--mui-palette-text-primary)`},"& .diff-cell-modified":{backgroundColor:v?`#713F12 !important`:`#FEF3C7 !important`,color:`var(--mui-palette-text-primary)`},"& .diff-header-added":{backgroundColor:`#15803d !important`,color:`white`},"& .diff-header-removed":{backgroundColor:`#f43f5e !important`,color:`white`},"& .diff-header-modified":{backgroundColor:`#f59e0b !important`,color:`white`},"& .index-column":{color:`var(--mui-palette-text-secondary)`,textAlign:`right`},"& .ag-pinned-left-cols-container .ag-cell":{backgroundColor:v?`#2d2d2d`:`#f5f5f5`}},children:H(ar,{theme:y,columnDefs:b,rowData:x,getRowId:T,rowHeight:s,headerHeight:c,defaultColDef:C,suppressCellFocus:!0,suppressRowHoverHighlight:!1,animateRows:!1,rowClass:f,noRowsOverlayComponent:w,onGridReady:e=>{_.current=e.api},...m},E)})}const lo=ot(co);Zn.register(Xn,Yn,$n,Qn,nr);function uo(e){return e>=0xe8d4a51000?`${(e/0xe8d4a51000).toFixed(1)}T`:e>=1e9?`${(e/1e9).toFixed(1)}B`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function fo(e){return e>0&&e<=.001?`<0.1%`:e<1&&e>=.999?`>99.9%`:`${(e*100).toFixed(1)}%`}function po(e,t){let n=Math.min(t,e.counts.length),r=e.counts.slice(0,n),i=r.reduce((e,t)=>e+t,0),a=e.valids-i,o=r.map((t,n)=>{let r=e.values[n],i,a=!1;return r==null?(i=`(null)`,a=!0):typeof r==`string`&&r.length===0?(i=`(empty)`,a=!0):i=String(r),{label:i,count:t,isSpecial:a}});return a>0&&o.push({label:`(others)`,count:a,isSpecial:!0}),o}function mo({count:e,total:t,color:n,theme:r=`light`,height:i=16}){let a=r===`dark`,o=eo(a),s=to(a),c=n??s.current,l=R(()=>({labels:[``],datasets:[{indexAxis:`y`,data:[e],backgroundColor:c,hoverBackgroundColor:c,borderWidth:0,borderColor:c,barPercentage:1,categoryPercentage:.6}]}),[e,c]),u=R(()=>({responsive:!0,maintainAspectRatio:!1,indexAxis:`y`,scales:{x:{display:!1,max:t,grid:{display:!1},ticks:{color:o.textColor}},y:{display:!1,ticks:{color:o.textColor}}},plugins:{tooltip:{enabled:!1}},animation:!1}),[t,o]);return H(`div`,{style:{height:i,width:`100%`},children:H(rr,{data:l,options:u})})}const ho=F(mo);ho.displayName=`SingleBarChart`;function go({data:e,maxItems:t=10,theme:n=`light`,className:r}){let i=to(n===`dark`);return H(W,{className:r,sx:{width:`100%`},children:R(()=>po(e,t),[e,t]).map(t=>U(it,{children:[U(W,{sx:{display:`flex`,alignItems:`center`,width:`100%`,"&:hover":{bgcolor:`action.hover`},px:1.5},children:[H(Y,{title:t.label,placement:`top-start`,children:H(q,{sx:{width:`14em`,fontSize:`0.875rem`,color:t.isSpecial?`grey.400`:`inherit`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t.label})}),H(W,{sx:{display:`flex`,height:`2em`,width:`10em`},children:H(ho,{count:t.count,total:e.valids,color:i.current,theme:n})}),H(Y,{title:String(t.count),placement:`top-start`,children:H(q,{sx:{ml:2.5,mr:1,fontSize:`0.875rem`,width:`4em`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:uo(t.count)})}),H(q,{sx:{color:`grey.400`,fontSize:`0.875rem`,width:`4em`},children:fo(t.count/e.valids)})]}),H(Et,{})]},t.label))})}const _o=F(go);_o.displayName=`TopKSummaryList`;function vo({baseData:e,currentData:t,maxItems:n=10,showComparison:r=!1,theme:i=`light`,title:a,className:o}){let s=i===`dark`,c=to(s),l=eo(s),u=R(()=>po(t,n),[t,n]),d=R(()=>e?po(e,n):[],[e,n]),f=r&&e&&d.length>0,p=t.valids||1,m=e?.valids||1,h=R(()=>u.map((e,t)=>({current:e,base:f?d[t]??null:null})).filter(({current:e,base:t})=>!(e.label===`(others)`&&e.count===0&&(!t||t.count===0))),[u,d,f]),g=R(()=>{let e=h.map(({current:e})=>e.label),t=[{label:`Current`,data:h.map(({current:e})=>e.count/p),backgroundColor:c.current,hoverBackgroundColor:c.current,borderWidth:0,borderRadius:3,barPercentage:f?.9:1,categoryPercentage:f?.75:.6}];return f&&t.push({label:`Base`,data:h.map(({base:e})=>(e?.count??0)/m),backgroundColor:c.base,hoverBackgroundColor:c.base,borderWidth:0,borderRadius:3,barPercentage:.9,categoryPercentage:.75}),{labels:e,datasets:t}},[h,c,f,p,m]),_=R(()=>({responsive:!0,maintainAspectRatio:!1,indexAxis:`y`,layout:{padding:{right:80}},scales:{x:{display:!1,grid:{display:!1}},y:{grid:{display:!1},ticks:{padding:8,color:e=>h[e.index]?.current.isSpecial?`#9ca3af`:l.textColor}}},plugins:{legend:{display:!!f,position:`top`,align:`center`,reverse:!0,labels:{boxWidth:32,boxHeight:12,borderRadius:3,useBorderRadius:!0,color:l.textColor}},tooltip:{mode:`index`,callbacks:{label:e=>{let t=e.parsed.x??0,n=e.dataset.label===`Base`?m:p,r=Math.round(t*n);return`${e.dataset.label}: ${uo(r)} (${fo(t)})`}}}},animation:!1}),[h,l,f,m,p]),v=s?`#9ca3af`:`#6b7280`,y=R(()=>({id:`barLabels`,afterDatasetsDraw(e){let{ctx:t}=e;t.save(),t.font=`11px system-ui, sans-serif`,t.textBaseline=`middle`;for(let n=0;n<e.data.datasets.length;n++){let r=e.data.datasets[n],i=r.label===`Base`?m:p,a=e.getDatasetMeta(n);for(let e=0;e<a.data.length;e++){let{x:n,y:o,base:s}=a.data[e],c=r.data[e]??0;if(c===0)continue;let u=Math.round(c*i),d=n-s,f=uo(u),p=fo(c),m=t.measureText(f).width;m+8<d?(t.fillStyle=l.barLabelColor,t.textAlign=`left`,t.fillText(f,s+4,o),t.fillStyle=v,t.textAlign=`left`,t.fillText(p,n+4,o)):(t.fillStyle=l.textColor,t.textAlign=`left`,t.fillText(f,n+4,o),t.fillStyle=v,t.fillText(p,n+4+m+4,o))}}t.restore()}}),[m,p,l,v]),b=h.length*(f?46:32)+(f?30:0);return U(W,{className:o,sx:{width:`100%`,px:2,py:2},children:[a&&H(q,{variant:`subtitle1`,sx:{fontWeight:500,mb:1},children:a}),H(`div`,{style:{height:Math.max(b,50)},children:H(rr,{data:g,options:_,plugins:[y]})})]})}const yo=F(vo);yo.displayName=`TopKBarChart`;function bo(e){switch(e){case`sql`:return Pn();case`yaml`:return Fn();default:return null}}function xo(e){return[Rn.theme({"&":{backgroundColor:e?`#1e1e1e`:`#ffffff`,color:e?`#d4d4d4`:`#1f2937`},".cm-content":{caretColor:e?`#d4d4d4`:`#1f2937`,fontFamily:`'JetBrains Mono', 'Fira Code', monospace`,fontSize:`13px`},".cm-gutters":{backgroundColor:e?`#252526`:`#f5f5f5`,color:e?`#858585`:`#6b7280`,border:`none`},".cm-activeLineGutter":{backgroundColor:e?`#2a2d2e`:`#e5e7eb`},".cm-activeLine":{backgroundColor:e?`#2a2d2e40`:`#f3f4f640`},".cm-changedLine":{backgroundColor:e?`#3d3d0050`:`#fff3c550`},".cm-changedText":{backgroundColor:e?`#5c5c0080`:`#fef08a80`},".cm-deletedChunk":{backgroundColor:e?`#5c1f1f50`:`#ffc5c550`},".cm-insertedChunk":{backgroundColor:e?`#1a4d1a50`:`#cefece50`}},{dark:e})]}function So({original:e,modified:t,language:n=`text`,readOnly:r=!0,lineNumbers:i=!0,sideBySide:a=!0,height:o=`400px`,theme:s=`light`,onModifiedChange:c,className:l}){let u=z(null),d=z(null),f=s===`dark`;return L(()=>{if(!u.current)return;d.current&&=(d.current instanceof or,d.current.destroy(),null);let o=[...xo(f)];i&&o.push(Bn());let s=bo(n);if(s&&o.push(s),r&&o.push(In.readOnly.of(!0)),c&&!r&&o.push(Rn.updateListener.of(e=>{e.docChanged&&c(e.state.doc.toString())})),a)d.current=new or({a:{doc:e,extensions:[...o]},b:{doc:t,extensions:[...o]},parent:u.current,orientation:`a-b`,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}});else{let n=[...o,sr({original:e,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})];d.current=new Rn({state:In.create({doc:t,extensions:n}),parent:u.current})}return()=>{d.current&&=(d.current instanceof or,d.current.destroy(),null)}},[e,t,n,r,i,a,f,c]),H(W,{ref:u,className:l,sx:{height:o,width:`100%`,overflow:`auto`,border:`1px solid`,borderColor:f?`grey.700`:`grey.300`,borderRadius:1,"& .cm-editor":{height:`100%`},"& .cm-scroller":{overflow:`auto`},"& .cm-merge-view":{height:`100%`},"& .cm-merge-view > div":{height:`100%`}}})}const Co=F(So);Co.displayName=`DiffEditor`;function wo({title:e,description:t,icon:n,actionLabel:r,onAction:i,secondaryActionLabel:a,onSecondaryAction:o,theme:s=`light`,paddingY:c=8,className:l,children:u}){let d=s===`dark`;return U(W,{className:l,sx:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,textAlign:`center`,py:c,px:4,height:`100%`,minHeight:200},children:[n&&H(W,{sx:{mb:2,color:d?`grey.500`:`grey.400`,"& svg":{width:48,height:48}},children:n}),H(q,{variant:`h6`,sx:{fontWeight:500,color:d?`grey.300`:`grey.700`,mb:t?1:0},children:e}),t&&H(q,{variant:`body2`,sx:{color:d?`grey.400`:`grey.500`,maxWidth:400,mb:r||a?3:0},children:t}),(r||a)&&U(W,{sx:{display:`flex`,gap:2,mt:1},children:[r&&i&&H(G,{variant:`contained`,onClick:i,size:`small`,children:r}),a&&o&&H(G,{variant:`outlined`,onClick:o,size:`small`,children:a})]}),u&&H(W,{sx:{mt:3},children:u})]})}const To=F(wo);To.displayName=`EmptyState`;function Eo(e,t=60){if(e.length<=t)return e;try{let n=new URL(e),r=n.hostname,i=n.pathname+n.search+n.hash;if(r.length>=t-3)return r.substring(0,t-3)+`...`;let a=t-r.length-3;return i.length>a?`${r}${i.substring(0,a)}...`:e}catch{return e.substring(0,t-3)+`...`}}function Do({isOpen:e,url:t,onConfirm:n,onCancel:r}){let i=z(null);return U(lt,{open:e,onClose:r,maxWidth:`sm`,fullWidth:!0,"aria-labelledby":`external-link-dialog-title`,children:[U(ft,{id:`external-link-dialog-title`,sx:{display:`flex`,alignItems:`center`,gap:1},children:[H(W,{component:Jt,sx:{color:`amber.500`,fontSize:20}}),`External Link`]}),H(J,{"aria-label":`close`,onClick:r,sx:{position:`absolute`,right:8,top:8,color:`grey.500`},children:H(Tt,{})}),U(dt,{children:[H(q,{sx:{mb:1.5},children:`This link will take you to an external website outside of Recce. Are you sure you want to continue?`}),H(W,{sx:{bgcolor:`grey.50`,p:1,borderRadius:1,border:`1px solid`,borderColor:`grey.200`},children:H(W,{component:`code`,sx:{fontSize:`0.875rem`,wordBreak:`break-all`,whiteSpace:`pre-wrap`,bgcolor:`transparent`,fontFamily:`monospace`},children:Eo(t,100)})})]}),U(ut,{sx:{gap:1},children:[H(G,{ref:i,variant:`outlined`,onClick:r,children:`Cancel`}),H(G,{color:`iochmara`,variant:`contained`,onClick:n,children:`Open Link`})]})]})}function Oo(e,t){if(!e||e.startsWith(`/`)||e.startsWith(`#`)||e.startsWith(`?`))return!1;try{let n=new URL(e,window.location.origin);return!t.some(e=>n.hostname===e||n.hostname.endsWith(`.${e}`))}catch{return!1}}function ko({href:e,children:t,internalDomains:n}){let[r,i]=B(!1),[a,o]=B(null),s=t=>{e&&Oo(e,n)&&(t.preventDefault(),o(e),i(!0))},c=()=>{a&&window.open(a,`_blank`,`noopener,noreferrer`),i(!1),o(null)},l=()=>{i(!1),o(null)},u=e?Oo(e,n):!1;return U(V,{children:[U(pt,{href:e,onClick:s,sx:{color:`primary.main`,textDecoration:`underline`,"&:hover":{color:`iochmara.600`}},target:`_blank`,rel:u?`noopener noreferrer`:void 0,children:[t,u&&` ↗`]}),H(Do,{isOpen:r,url:a||``,onConfirm:c,onCancel:l})]})}function Ao({className:e,children:t,isDark:n=!1}){let r=/language-(\w+)/.exec(e||``),i=r?r[1]:void 0,a=String(t).replace(/\n$/,``);return!r&&!String(t).includes(`
|
|
6
|
-
`)?H(W,{component:`code`,sx:{bgcolor:n?`grey.800`:`grey.100`,color:n?`grey.200`:`inherit`,px:1,py:.5,borderRadius:.5,fontSize:`0.9em`,fontFamily:`monospace`},children:t}):H(W,{sx:{my:2,borderRadius:1,overflow:`hidden`,fontSize:`0.875rem`},children:H(lr,{style:ur,language:i,PreTag:`div`,customStyle:{margin:0,borderRadius:`6px`,fontSize:`0.85em`},children:a})})}function jo({content:e,fontSize:t=`0.875rem`,internalDomains:n=[]}){let r=N(),i=[window.location.hostname,`reccehq.com`,`datarecce.io`,`localhost`,...n];return H(W,{className:`markdown-content`,children:H(cr,{remarkPlugins:[dr],components:{a:({href:e,children:t})=>H(ko,{href:e,internalDomains:i,children:t}),code:e=>H(Ao,{...e,isDark:r}),p:({children:e})=>H(q,{component:`p`,sx:{fontSize:t,mb:2,"&:last-child":{mb:0}},children:e}),h1:({children:e})=>H(q,{sx:{fontSize:`1.25rem`,fontWeight:`bold`,mb:2,mt:3},children:e}),h2:({children:e})=>H(q,{sx:{fontSize:`1.125rem`,fontWeight:`bold`,mb:2,mt:3},children:e}),h3:({children:e})=>H(q,{sx:{fontSize:`1rem`,fontWeight:600,mb:2,mt:2},children:e}),ul:({children:e})=>H(W,{component:`ul`,sx:{pl:4,mb:2,listStyleType:`disc`},children:e}),ol:({children:e})=>H(W,{component:`ol`,sx:{pl:4,mb:2,listStyleType:`decimal`},children:e}),li:({children:e})=>H(W,{component:`li`,sx:{fontSize:t,mb:1},children:e}),blockquote:({children:e})=>H(W,{sx:{borderLeft:`3px solid`,borderLeftColor:r?`grey.600`:`grey.300`,pl:3,py:1,my:2,color:r?`grey.400`:`grey.600`,fontStyle:`italic`},children:e}),table:({children:e})=>H(W,{sx:{overflowX:`auto`,my:2},children:H(W,{component:`table`,sx:{width:`100%`,fontSize:t,border:`1px solid`,borderColor:r?`grey.700`:`grey.200`,borderRadius:1},children:e})}),thead:({children:e})=>H(W,{component:`thead`,sx:{bgcolor:r?`grey.800`:`grey.50`},children:e}),tbody:({children:e})=>H(W,{component:`tbody`,children:e}),tr:({children:e})=>H(W,{component:`tr`,sx:{borderBottom:`1px solid`,borderColor:r?`grey.700`:`grey.200`},children:e}),th:({children:e})=>H(W,{component:`th`,sx:{px:2,py:1,fontWeight:600,textAlign:`left`},children:e}),td:({children:e})=>H(W,{component:`td`,sx:{px:2,py:1},children:e}),hr:()=>H(W,{component:`hr`,sx:{my:3,borderColor:r?`grey.700`:`grey.200`}}),strong:({children:e})=>H(q,{component:`strong`,sx:{fontWeight:600},children:e}),em:({children:e})=>H(q,{component:`em`,sx:{fontStyle:`italic`},children:e}),del:({children:e})=>H(q,{component:`del`,sx:{textDecoration:`line-through`,color:`grey.500`},children:e})},children:e})})}const Mo=ot(function({backgroundColor:e=`white`,blockSize:t,children:n,...r},i){return H(W,{ref:i,...r,sx:{overflowY:`auto`,overflowX:`hidden`,...r.sx},children:H(W,{sx:{backgroundColor:e,height:`100%`,blockSize:t},children:n})})});function No({children:e,direction:t=`horizontal`,sizes:n,minSizes:r=0,maxSizes:i,gutterSize:a=5,snapOffset:o=30,dragInterval:s=1,onDragEnd:c,onDrag:l,theme:u,style:d,className:f}){let p=N(),m=u?u===`dark`:p,h={display:`flex`,flexDirection:t===`horizontal`?`row`:`column`,height:`100%`,width:`100%`,...d};return H(W,{className:f,sx:{height:`100%`,width:`100%`,"& .gutter":{backgroundColor:`divider`,backgroundRepeat:`no-repeat`,backgroundPosition:`50%`,transition:`background-color 0.15s ease`,"&:hover":{backgroundColor:m?`grey.600`:`grey.300`}},"& .gutter.gutter-horizontal":{cursor:`col-resize`},"& .gutter.gutter-vertical":{cursor:`row-resize`}},children:H(fr,{style:h,direction:t,sizes:n,minSize:r,maxSize:i,gutterSize:a,snapOffset:o,dragInterval:s,onDragEnd:c,onDrag:l,children:e})})}const Po=F(No);Po.displayName=`SplitPane`;function Fo(e){let{style:t,children:n,gutterSize:r=5,minSize:i,maxSize:a,sizes:o,snapOffset:s,dragInterval:c,onDragEnd:l,onDrag:u,className:d}=e;return H(Po,{direction:`horizontal`,gutterSize:r,minSizes:i,maxSizes:a,sizes:o,snapOffset:typeof s==`number`?s:void 0,dragInterval:c,onDragEnd:l,onDrag:u,style:t,className:d,children:n})}function Io(e){let{style:t,children:n,gutterSize:r=5,minSize:i,maxSize:a,sizes:o,snapOffset:s,dragInterval:c,onDragEnd:l,onDrag:u,className:d}=e;return H(Po,{direction:`vertical`,gutterSize:r,minSizes:i,maxSizes:a,sizes:o,snapOffset:typeof s==`number`?s:void 0,dragInterval:c,onDragEnd:l,onDrag:u,style:t,className:d,children:n})}function Lo({warning:e,isDark:t}){return U(W,{sx:{display:`flex`,alignItems:`center`,gap:.5,fontSize:`0.75rem`},children:[H(Jt,{color:t?pr[400]:pr[600]}),H(W,{children:e})]})}function Ro({toolbar:e,warnings:t,warningStyle:n=`alert`,isDark:r}){return!e&&(!t||t.length===0)?null:U(W,{sx:{display:`flex`,alignItems:`center`,gap:1,px:1,py:.5,borderBottom:1,borderColor:`divider`,bgcolor:n===`amber`&&t&&t.length>0?r?pr[900]:pr[100]:r?`grey.900`:`grey.50`,color:n===`amber`&&t&&t.length>0?r?pr[200]:pr[800]:void 0},children:[n===`amber`?t?.map(e=>H(Lo,{warning:e,isDark:r},e)):t?.map(e=>H(hn,{severity:`warning`,sx:{py:0,fontSize:`0.75rem`},children:e},e)),H(W,{sx:{flex:1}}),e]})}function $(e){let{displayName:t,typeGuard:n,expectedRunType:r,screenshotWrapper:i,transformData:a,emptyState:o=`No data`,conditionalEmptyState:s}=e;function c({run:e,viewOptions:t,onViewOptionsChanged:c,onAddToChecklist:l},u){let d=N();if(!n(e))throw Error(`Run type must be ${r}`);let f=R(()=>a(e,{viewOptions:t,onViewOptionsChanged:c,onAddToChecklist:l}),[e,t,c,l]),p=s?.(e,t);return p==null?f?.renderNull?null:!f||f.isEmpty?f?.toolbar||f?.warnings&&f.warnings.length>0?U(W,{sx:{display:`flex`,flexDirection:`column`,bgcolor:d?`grey.900`:`grey.50`,height:`100%`},children:[H(Ro,{toolbar:f?.toolbar,warnings:f?.warnings,warningStyle:f?.warningStyle,isDark:d}),H(W,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,flex:1},children:f?.emptyMessage??o})]}):H(W,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,bgcolor:d?`grey.900`:`grey.50`,height:`100%`},children:o}):i===`grid`?U(W,{sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:[f.header,H(Ro,{toolbar:f.toolbar,warnings:f.warnings,warningStyle:f.warningStyle,isDark:d}),H(lo,{ref:u,style:{blockSize:`auto`,maxHeight:`100%`,overflow:`auto`,fontSize:`0.875rem`,borderWidth:1},columns:f.columns??[],rows:f.rows??[],renderers:{noRowsFallback:H(so,{emptyMessage:f.noRowsMessage})},defaultColumnOptions:f.defaultColumnOptions}),f.footer]}):U(W,{sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:[f.header,H(Ro,{toolbar:f.toolbar,warnings:f.warnings,warningStyle:f.warningStyle,isDark:d}),H(Mo,{ref:u,height:`100%`,backgroundColor:d?`#1f2937`:`white`,children:f.content}),f.footer]}):H(W,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,bgcolor:d?`grey.900`:`grey.50`,height:`100%`},children:p})}return c.displayName=t,ot(c)}const zo=`0.1.0`;function Bo(e){return x(e)}const Vo=$({displayName:`HistogramDiffResultView`,typeGuard:Bo,expectedRunType:`histogram_diff`,screenshotWrapper:`box`,conditionalEmptyState:e=>{let t=e.result?.base,n=e.result?.current;return!t||!n?H(`div`,{children:`Loading...`}):null},transformData:e=>{let t=e.params,n=e.result?.base,r=e.result?.current,i=e.result?.min,a=e.result?.max,o=e.result?.bin_edges??[];if(!n||!r)return{isEmpty:!0};let s=e.params?.column_type??`numeric`,c=s===`datetime`?`datetime`:s===`string`?`string`:`numeric`;return{content:U(W,{sx:{display:`flex`,flexDirection:`row`},children:[H(W,{sx:{flex:1}}),H(W,{sx:{width:`80%`,height:`35vh`,m:4},children:H(oo,{title:`Model ${t.model}.${t.column_name}`,dataType:c,baseData:{counts:n.counts},currentData:{counts:r.counts},min:i,max:a,samples:n.total,binEdges:o})}),H(W,{sx:{flex:1}})]})}}});function Ho({model:e,row:t,singleEnv:n,cllRunning:r,showMenu:i=!0}){let a=ce(),{isActionAvailable:o}=A(),{runAction:s}=j(),{featureToggles:c}=me(),{name:l,baseType:u,currentType:d,baseIndex:f,currentIndex:p}=t,m=d??u,[h,g]=B(null),_=!!h,v=e=>{e.stopPropagation(),g(e.currentTarget)},y=()=>{g(null)},b=()=>{s(`profile_diff`,{model:e.name,columns:[l]},{showForm:!1,trackProps:{action:`profile_diff`,source:`schema_column_menu`,node_count:1}})},x=()=>{s(`histogram_diff`,{model:e.name,column_name:l,column_type:m},{showForm:!1,trackProps:{action:`histogram_diff`,source:`schema_column_menu`,node_count:1}})},S=()=>{s(`top_k_diff`,{model:e.name,column_name:l,k:50},{showForm:!1,trackProps:{action:`top_k_diff`,source:`schema_column_menu`,node_count:1}})},C=()=>{s(`value_diff`,{model:e.name,columns:[l]},{showForm:!0,trackProps:{action:`value_diff`,source:`schema_column_menu`,node_count:1}})},w=!u||!d;return H(Y,{title:`View column lineage`,placement:`top`,disableHoverListener:a===void 0||!o(`change_analysis`)||f!==void 0&&p===void 0,children:U(W,{sx:{display:`flex`,alignItems:`center`,gap:`3px`},children:[H(W,{sx:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:l}),H(W,{sx:{flex:1}}),r&&H(Dt,{size:12,color:`inherit`}),i&&!n&&e.resource_type!==`source`&&U(V,{children:[H(J,{"aria-label":`Column options`,className:`row-context-menu`,size:`small`,disabled:c.disableDatabaseQuery,onClick:v,children:H(yn,{})}),U(_n,{anchorEl:h,open:_,onClose:y,slotProps:{list:{sx:{lineHeight:`20px`}}},children:[H(xn,{sx:{m:0,p:`4px 12px`,lineHeight:`20px`},children:`Diff`}),H(X,{onClick:()=>{b(),y()},disabled:w,sx:{fontSize:`0.85rem`},children:`Profile Diff`}),H(X,{onClick:()=>{x(),y()},disabled:w||(m?!_i(m):!0),sx:{fontSize:`0.85rem`},children:`Histogram Diff`}),H(X,{onClick:()=>{S(),y()},disabled:w,sx:{fontSize:`0.85rem`},children:`Top-k Diff`}),H(X,{onClick:()=>{C(),y()},disabled:w,sx:{fontSize:`0.85rem`},children:`Value Diff`})]})]})]})})}function Uo(e,t,n){return r=>{let i=r.data;return i?H(Ho,{model:e,row:i,cllRunning:t?.get(i.name)??!1,showMenu:n}):null}}function Wo(e,t,n){return r=>{let i=r.data;return i?H(Ho,{model:e,row:i,cllRunning:t?.get(i.name)??!1,singleEnv:!0,showMenu:n}):null}}function Go(e){if(!e.data)return null;let{baseIndex:t,currentIndex:n}=e.data;return H(`span`,{children:n===void 0?t===void 0?`-`:t:n===void 0?`-`:n})}const Ko=rt.memo(Go);Ko.displayName=`MemoizedRenderIndexCell`;function qo(e){if(!e.data)return null;let{baseType:t,currentType:n,baseIndex:r,currentIndex:i}=e.data,a=r===void 0,o=i===void 0;return!a&&!o&&t!==n?U(`span`,{children:[H(`span`,{className:`type-badge type-badge-removed`,title:`Base type: ${t}`,children:t}),H(`span`,{className:`type-badge type-badge-added`,title:`Current type: ${n}`,children:n})]}):H(`span`,{children:o?t:n})}const Jo=rt.memo(qo);Jo.displayName=`MemoizedRenderTypeCell`;function Yo(e={},t={}){let n={},r=we(Object.keys(e),Object.keys(t));Object.entries(r).forEach(([e,t])=>{n[e]={name:e,reordered:t===`reordered`,__status:void 0}});let i=0;return Object.entries(e).forEach(([e,t])=>{t!=null&&(n[e].baseIndex=i+=1,n[e].baseType=t.type)}),i=0,Object.entries(t).forEach(([e,t])=>{t!=null&&(n[e].currentIndex=i+=1,n[e].currentType=t.type)}),n}function Xo(e){let t=e.data;return t?.baseIndex!==void 0&&t?.currentIndex!==void 0&&t?.reordered===!0?`column-index-reordered schema-column schema-column-index`:`schema-column schema-column-index`}function Zo(){return`schema-column`}function Qo(e,t={}){let{node:n,cllRunningMap:r,showMenu:i}=t;return{columns:[{field:`index`,headerName:``,resizable:!0,minWidth:35,width:35,cellRenderer:Go,cellClass:Xo},{field:`name`,headerName:`Name`,resizable:!0,cellRenderer:n?Uo(n,r,i):void 0,cellClass:Zo},{field:`type`,headerName:`Type`,resizable:!0,cellRenderer:qo,cellClass:Zo}],rows:Object.values(e)}}function $o(e={},t={}){let{node:n,cllRunningMap:r,showMenu:i}=t,a=Object.entries(e).filter(([e,t])=>t!=null).map(([e,t],n)=>({name:e,index:n+1,type:t.type,__status:void 0}));return{columns:[{field:`index`,headerName:``,resizable:!0,minWidth:35,width:35,cellClass:`schema-column schema-column-index`},{field:`name`,headerName:`Name`,resizable:!0,cellRenderer:n?Wo(n,r,i):void 0,cellClass:`schema-column`},{field:`type`,headerName:`Type`,resizable:!0,cellClass:`schema-column`}],rows:a}}function es({columnName:e,primaryKeys:t}){return H(W,{sx:{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100%`},children:t.includes(e)&&H(bn,{})})}function ts({params:e,column:t}){let{runAction:n}=j(),{featureToggles:r}=me(),[i,a]=B(null),o=!!i,s=e=>{a(e.currentTarget)},c=()=>{a(null)},l=(t,r)=>{n(`value_diff_detail`,{...e,...t},r)};return U(W,{sx:{display:`flex`},children:[H(W,{sx:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t}),H(W,{sx:{flex:1}}),H(J,{"aria-label":`Column options`,className:`row-context-menu`,size:`small`,disabled:r.disableDatabaseQuery,onClick:s,children:H(Rt,{})}),U(_n,{anchorEl:i,open:o,onClose:c,slotProps:{list:{sx:{lineHeight:`20px`}}},children:[H(xn,{sx:{fontSize:`8pt`,lineHeight:`20px`},children:`Action`}),H(X,{onClick:()=>{l({},{showForm:!0}),c()},sx:{fontSize:`10pt`},children:`Show mismatched values...`}),U(X,{onClick:()=>{l({columns:[t]},{showForm:!1}),c()},sx:{fontSize:`10pt`},children:[`Show mismatched values for '`,t,`'`]})]})]})}function ns({value:e}){let t=`N/A`;return e!=null&&(t=e>.9999&&e<1?`~99.99 %`:e<1e-4&&e>0?`~0.01 %`:`${(e*100).toFixed(2)} %`),H(W,{sx:{textAlign:`right`},children:t})}function rs(e){return t=>{let n=t.data;return n?H(es,{columnName:String(n[0]),primaryKeys:e}):null}}function is(e){return t=>{let n=t.data,r=t.colDef?.field??``;return n?H(ts,{column:String(n[r]),params:e}):null}}function as(e){let t=e.data,n=e.colDef?.field??``;return t?H(ns,{value:t[n]}):null}const os=[{key:`0`,name:`Column`,type:`text`},{key:`1`,name:`Matched`,type:`number`},{key:`2`,name:`Matched %`,type:`number`}];function ss(e){let t=e.data;if(!t)return;let n=t[2];return n!=null&&n<1?`diff-cell-modified`:void 0}const cs={PRIMARY_KEY_INDICATOR:`__is_pk__`,COLUMN_NAME:`0`,MATCHED_COUNT:`1`,MATCHED_PERCENT:`2`};function ls(e,t){return[{field:cs.PRIMARY_KEY_INDICATOR,headerName:``,width:30,maxWidth:30,cellRenderer:rs(e)},{field:cs.COLUMN_NAME,headerName:`Column`,resizable:!0,cellRenderer:is(t),cellClass:`cell-show-context-menu`},{field:cs.MATCHED_COUNT,headerName:`Matched`,resizable:!0,cellClass:ss},{field:cs.MATCHED_PERCENT,headerName:`Matched %`,resizable:!0,cellRenderer:as,cellClass:ss}]}function us(e,t){let{params:n}=t,r=Array.isArray(n.primary_key)?n.primary_key:[n.primary_key],i={...e.data,columns:os};return{columns:ls(r,n),rows:Fe(i)}}function ds(e){if(p(e)||S(e))return e.result?{kind:`query`,result:e.result}:null;if(w(e))return e.result?e.result.diff&&e.params?.primary_keys?{kind:`query_diff_joined`,result:e.result,primaryKeys:e.params.primary_keys}:{kind:`query_diff_separate`,result:e.result}:null;if(d(e))return!e.result||!e.params?null:{kind:`value_diff`,result:e.result,params:e.params};if(g(e)){if(!e.result||!e.params?.primary_key)return null;let t=e.params.primary_key,n=Array.isArray(t)?t:[t];return{kind:`value_diff_detail`,result:e.result,primaryKeys:n}}return f(e)?e.result?.current?{kind:`profile`,result:e.result}:null:v(e)?e.result?{kind:`profile_diff`,result:e.result}:null:T(e)?e.result?{kind:`row_count`,result:e.result}:null:y(e)&&e.result?{kind:`row_count_diff`,result:e.result}:null}function fs(e){return e.current?.columns.find(e=>e.name.toLowerCase()===`column_name`)?.name??`column_name`}function ps(e,t={}){let n=ds(e);if(!n)return null;switch(n.kind){case`query`:return Oe(n.result,{primaryKeys:t.primaryKeys,pinnedColumns:t.pinnedColumns,columnsRenderMode:t.columnsRenderMode,onPrimaryKeyChange:t.onPrimaryKeyChange,onPinnedColumnsChange:t.onPinnedColumnsChange,onColumnsRenderModeChanged:t.onColumnsRenderModeChanged});case`query_diff_separate`:return Be(n.result.base,n.result.current,t);case`query_diff_joined`:return n.result.diff?Te(n.result.diff,n.primaryKeys,{changedOnly:t.changedOnly,pinnedColumns:t.pinnedColumns,onPinnedColumnsChange:t.onPinnedColumnsChange,baseTitle:t.baseTitle,currentTitle:t.currentTitle,displayMode:t.displayMode,columnsRenderMode:t.columnsRenderMode,onColumnsRenderModeChanged:t.onColumnsRenderModeChanged}):null;case`value_diff`:return us(n.result,{params:n.params});case`value_diff_detail`:return Te(n.result,n.primaryKeys,{changedOnly:t.changedOnly,pinnedColumns:t.pinnedColumns,onPinnedColumnsChange:t.onPinnedColumnsChange,displayMode:t.displayMode,columnsRenderMode:t.columnsRenderMode,onColumnsRenderModeChanged:t.onColumnsRenderModeChanged});case`profile`:{if(!n.result.current)return null;let e=fs(n.result);return Oe(n.result.current,{primaryKeys:[e],pinnedColumns:t.pinnedColumns,onPinnedColumnsChange:t.onPinnedColumnsChange,columnsRenderMode:t.columnsRenderMode,onColumnsRenderModeChanged:t.onColumnsRenderModeChanged})}case`profile_diff`:{let e=fs(n.result);return Be(n.result.base,n.result.current,{primaryKeys:[e],pinnedColumns:t.pinnedColumns,onPinnedColumnsChange:t.onPinnedColumnsChange,displayMode:t.displayMode,columnsRenderMode:t.columnsRenderMode,onColumnsRenderModeChanged:t.onColumnsRenderModeChanged})}case`row_count`:return Pe(n.result);case`row_count_diff`:return ke(n.result);default:return null}}function ms(e,t){switch(e.type){case`single`:return Oe(e.dataframe,t??{});case`dual`:return Be(e.base,e.current,t??{});case`joined`:return Te(e.dataframe,e.primaryKeys,t??{});case`schema_diff`:return Qo(Yo(e.base,e.current),t??{});case`schema_single`:return $o(e.columns,t??{})}}function hs({params:e,onParamsChanged:t,setIsReadyToExecute:n}){let[r,i]=B(!e.columns||e.columns.length===0),a=e.model,{columns:o,isLoading:s,error:c}=il(e.model);L(()=>{n(!!a)},[a,n]);let l=o.map(e=>e.name);return s?H(W,{children:`Loading...`}):l.length===0||c?H(W,{children:`Error: Please provide the 'catalog.json' to list column candidates`}):U(K,{spacing:5,sx:{m:`8px 24px`,pb:`200px`},children:[U(W,{children:[H(q,{variant:`body2`,sx:{mb:1},children:`Model`}),H(Tn,{fullWidth:!0,size:`small`,value:e.model,slotProps:{input:{readOnly:!0}}})]}),U(W,{children:[H(q,{variant:`body2`,sx:{mb:1},children:`Columns`}),H(fn,{control:H(dn,{checked:r,onChange:n=>{i(n.target.checked),t({...e,columns:void 0})},size:`small`}),label:`All columns`,sx:{mb:`10px`}}),!r&&H(Tr,{multiple:!0,size:`small`,disableCloseOnSelect:!0,options:l,value:e.columns??[],onChange:(n,r)=>{t({...e,columns:r.length===0?void 0:r})},renderInput:t=>H(Tn,{...t,placeholder:(e.columns??[]).length===0?`Select columns`:``,className:`no-track-pii-safe`})})]})]})}const gs=e=>typeof e==`object`&&!!e&&`type`in e&&v(e),_s=$({displayName:`ProfileResultView`,typeGuard:e=>typeof e==`object`&&!!e&&`type`in e&&f(e),expectedRunType:`profile`,screenshotWrapper:`grid`,transformData:(e,{viewOptions:t,onViewOptionsChanged:n})=>{let r=ps(e,{pinnedColumns:t?.pinned_columns??[],onPinnedColumnsChange:e=>{n&&n({...t,pinned_columns:e})},columnsRenderMode:{distinct_proportion:`percent`,not_null_proportion:`percent`,...t?.columnsRenderMode},onColumnsRenderModeChanged:e=>{let r={...t?.columnsRenderMode??{},...e};n&&n({...t,columnsRenderMode:r})}})??{columns:[],rows:[]};return{columns:r.columns,rows:r.rows,isEmpty:r.columns.length===0}}}),vs=$({displayName:`ProfileDiffResultView`,typeGuard:gs,expectedRunType:`profile_diff`,screenshotWrapper:`grid`,transformData:(e,{viewOptions:t,onViewOptionsChanged:n})=>{let r=t?.pinned_columns??[],i=t?.display_mode??`inline`,a=ps(e,{pinnedColumns:r,onPinnedColumnsChange:e=>{n&&n({...t,pinned_columns:e})},displayMode:i,columnsRenderMode:{distinct_proportion:`percent`,not_null_proportion:`percent`,...t?.columnsRenderMode},onColumnsRenderModeChanged:e=>{let r={...t?.columnsRenderMode??{},...e};n&&n({...t,columnsRenderMode:r})}})??{columns:[],rows:[]},o=H(Ga,{children:H(fi,{displayMode:i,onDisplayModeChanged:e=>{n&&n({...t,display_mode:e})}})});return{columns:a.columns,rows:a.rows,header:o,isEmpty:a.columns.length===0}}});function ys(e){return w(e)}const bs=$({displayName:`QueryDiffResultView`,typeGuard:ys,expectedRunType:`query_diff`,screenshotWrapper:`grid`,emptyState:`No data`,transformData:(e,{viewOptions:t,onViewOptionsChanged:n})=>{let r=e.result&&`diff`in e.result&&e.result.diff!=null,i,a;e.params&&e.params.current_model&&(i=`Original`,a=`Editor`);let o=t?.changed_only??!1,s=t?.pinned_columns??[],c=t?.display_mode??`inline`,l=t?.columnsRenderMode??{},u=r?[]:t?.primary_keys??[],d=e=>{let r={...t?.columnsRenderMode??{},...e};n&&n({...t,columnsRenderMode:r})},f=r?void 0:e=>{n&&n({...t,primary_keys:e})},p=e=>{n&&n({...t,pinned_columns:e})},m;if(r&&e.result?.diff){let t=e.params?.primary_keys??[];m=Te(e.result.diff,t,{changedOnly:o,pinnedColumns:s,onPinnedColumnsChange:p,columnsRenderMode:l,onColumnsRenderModeChanged:d,baseTitle:i,currentTitle:a,displayMode:c})}else m=Be(e.result?.base,e.result?.current,{changedOnly:o,pinnedColumns:s,onPinnedColumnsChange:p,columnsRenderMode:l,onColumnsRenderModeChanged:d,baseTitle:i,currentTitle:a,displayMode:c,primaryKeys:u,onPrimaryKeyChange:f});let h=[];if(!r&&u.length>0){let e=u.join(`, `);m.invalidPKeyBase&&m.invalidPKeyCurrent?h.push(`Warning: The primary key '${e}' is not unique in the base and current environments`):m.invalidPKeyBase?h.push(`Warning: The primary key '${e}' is not unique in the base environment`):m.invalidPKeyCurrent&&h.push(`Warning: The primary key '${e}' is not unique in the current environment`)}let g=r?e.result?.diff?.limit??0:e.result?.current?.limit??0,_=r?e.result?.diff?.more:e.result?.current?.more||e.result?.base?.more;if(g>0&&_&&h.push(`Warning: Displayed results are limited to ${g.toLocaleString()} records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set.`),m.columns.length===0)return{isEmpty:!0};let v=U(V,{children:[H(fi,{displayMode:c,onDisplayModeChanged:e=>{n&&n({...t,display_mode:e})}}),H(ui,{changedOnly:t?.changed_only,onChange:()=>{let e=!t?.changed_only;n&&n({...t,changed_only:e})}})]});return r&&o&&m.rows.length===0?{isEmpty:!0,emptyMessage:`No change`,toolbar:v,warnings:h.length>0?h:void 0}:{columns:m.columns,rows:m.rows,warnings:h.length>0?h:void 0,toolbar:v,defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},noRowsMessage:`No mismatched rows`}}});function xs(e){return p(e)||S(e)}const Ss=$({displayName:`QueryResultView`,typeGuard:xs,expectedRunType:`query`,screenshotWrapper:`grid`,emptyState:`No data`,transformData:(e,{viewOptions:t,onViewOptionsChanged:n,onAddToChecklist:r})=>{let i=t?.pinned_columns??[],a=t?.columnsRenderMode??{},o=e=>{let r={...t?.columnsRenderMode??{},...e};n&&n({...t,columnsRenderMode:r})},s=e=>{n&&n({...t,pinned_columns:e})};if(!e.result)return{isEmpty:!0};let c=Oe(e.result,{pinnedColumns:i,onPinnedColumnsChange:s,columnsRenderMode:a,onColumnsRenderModeChanged:o});if(c.columns.length===0)return{isEmpty:!0};let l=e.result,u=l?l.limit??0:0,d=[];u>0&&l?.more&&d.push(`Warning: Displayed results are limited to ${u.toLocaleString()} records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set.`);let f=r?H(G,{sx:{my:`5px`},size:`small`,color:`iochmara`,variant:`contained`,onClick:()=>{r(e)},children:`Add to Checklist`}):void 0;return{columns:c.columns,rows:c.rows,warnings:d.length>0?d:void 0,warningStyle:`amber`,toolbar:f,defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35}}}});function Cs(e){return T(e)}function ws(e){return y(e)}function Ts(e){if(!e.result)return null;let t=Pe(e.result);return{columns:t.columns,rows:t.rows,isEmpty:t.rows.length===0}}function Es(e){if(!e.result)return null;let t=ke(e.result);return{columns:t.columns,rows:t.rows,isEmpty:t.rows.length===0}}const Ds=$({displayName:`RowCountResultView`,typeGuard:Cs,expectedRunType:`row_count`,screenshotWrapper:`grid`,transformData:Ts,emptyState:`No nodes matched`}),Os=$({displayName:`RowCountDiffResultView`,typeGuard:ws,expectedRunType:`row_count_diff`,screenshotWrapper:`grid`,transformData:Es,emptyState:`No nodes matched`});function ks({params:e,onParamsChanged:t,setIsReadyToExecute:n}){let{columns:r,isLoading:i,error:a}=il(e.model),o=r.map(e=>e.name);return L(()=>{n(!!e.column_name)},[e,n]),i?H(W,{children:`Loading...`}):o.length===0||a?H(W,{children:`Error: Please provide the 'catalog.json' to list column candidates`}):H(W,{sx:{m:`16px`},children:U(Sn,{fullWidth:!0,children:[H(Cn,{sx:{mb:1},children:`Pick a column to show top-k`}),U(wn,{value:e.column_name,onChange:n=>{let r=n.target.value;t({...e,column_name:r})},children:[H(`option`,{value:``,children:`Select column`}),o.map(e=>H(`option`,{value:e,className:`no-track-pii-safe`,children:e},e))]})]})})}function As(e){return b(e)}function js({model:e,columnName:t}){return U(q,{variant:`h5`,sx:{pt:4,textAlign:`center`,color:N()?`grey.200`:`grey.600`},children:[`Model `,e,`.`,t]})}function Ms({showAll:e,onToggle:t}){return H(W,{sx:{display:`flex`,p:5,justifyContent:`start`},children:H(pt,{component:`button`,onClick:t,sx:{color:`iochmara.main`,cursor:`pointer`},children:e?`View Only Top-10`:`View More Items`})})}function Ns(e,{viewOptions:t,onViewOptionsChanged:n}){let r=e.result,i=e.params;if(!r)return{isEmpty:!0};let a=r.base,o=r.current,s=t?.show_all??!1,c=!s,l=a.values.length>10||o.values.length>10?H(Ms,{showAll:s,onToggle:()=>{n&&n({...t,show_all:!s})}}):void 0;return{content:U(V,{children:[H(js,{model:i.model,columnName:i.column_name}),U(K,{direction:`row`,alignItems:`center`,children:[H(W,{sx:{flex:1}}),H(yo,{baseData:a,currentData:o,showComparison:!0,maxItems:c?10:void 0}),H(W,{sx:{flex:1}})]})]}),footer:l}}const Ps=$({displayName:`TopKDiffResultView`,typeGuard:As,expectedRunType:`top_k_diff`,screenshotWrapper:`box`,emptyState:`No data`,transformData:Ns});function Fs(e){return g(e)}const Is=$({displayName:`ValueDiffDetailResultView`,typeGuard:Fs,expectedRunType:`value_diff_detail`,screenshotWrapper:`grid`,emptyState:`No data`,transformData:(e,{viewOptions:t,onViewOptionsChanged:n})=>{let r=t?.changed_only??!1,i=t?.pinned_columns??[],a=t?.display_mode??`inline`,o=t?.columnsRenderMode??{},s=e.params?.primary_key;if(!s||!e.result)return{isEmpty:!0};let c=Array.isArray(s)?s:[s],l=Te(e.result,c,{changedOnly:r,pinnedColumns:i,onPinnedColumnsChange:e=>{n&&n({...t,pinned_columns:e})},columnsRenderMode:o,onColumnsRenderModeChanged:e=>{let r={...t?.columnsRenderMode??{},...e};n&&n({...t,columnsRenderMode:r})},displayMode:a});if(l.columns.length===0)return{isEmpty:!0};let u=e.result?.limit??0,d=[];u>0&&e.result?.more&&d.push(`Warning: Displayed results are limited to ${u.toLocaleString()} records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set.`);let f=U(V,{children:[H(fi,{displayMode:a,onDisplayModeChanged:e=>{n&&n({...t,display_mode:e})}}),H(ui,{changedOnly:t?.changed_only,onChange:()=>{let e=!t?.changed_only;n&&n({...t,changed_only:e})}})]});return r&&l.rows.length===0?{isEmpty:!0,emptyMessage:`No change`,toolbar:f,warnings:d.length>0?d:void 0,warningStyle:`amber`}:{columns:l.columns,rows:l.rows,warnings:d.length>0?d:void 0,warningStyle:`amber`,toolbar:f,defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},noRowsMessage:`No mismatched rows`}}});function Ls({params:e,onParamsChanged:t,setIsReadyToExecute:n}){let[r,i]=B(!e.columns||e.columns.length===0),a=e.model,o=e.primary_key,{columns:s,primaryKey:c,isLoading:l,error:u}=il(e.model);L(()=>{!o&&c&&t({...e,primary_key:c})},[o,c,e,t]),L(()=>{n(!!(o&&a))},[o,a,n]);let d=s.map(e=>e.name),f=Array.isArray(o)?o:o?[o]:void 0;return l?H(W,{children:`Loading...`}):d.length===0||u?H(W,{children:`Error: Please provide the 'catalog.json' to list column candidates`}):U(K,{spacing:5,sx:{m:`8px 24px`,pb:`200px`},children:[U(W,{children:[H(q,{variant:`body2`,sx:{mb:1},children:`Model`}),H(Tn,{fullWidth:!0,size:`small`,value:e.model,slotProps:{input:{readOnly:!0}}})]}),U(W,{children:[H(q,{variant:`body2`,sx:{mb:1},children:`Primary key`}),H(Tr,{multiple:!0,size:`small`,disableCloseOnSelect:!0,options:d,value:(f??[]).filter(e=>e!==void 0),onChange:(n,r)=>{t({...e,primary_key:r.length===1?r[0]:r})},renderInput:e=>H(Tn,{...e,placeholder:(f??[]).length===0?`Select primary key`:``,className:`no-track-pii-safe`})})]}),U(W,{children:[H(q,{variant:`body2`,sx:{mb:1},children:`Columns`}),H(fn,{control:H(dn,{checked:r,onChange:n=>{i(n.target.checked),t({...e,columns:void 0})},size:`small`}),label:`All columns`,sx:{mb:`10px`}}),!r&&H(Tr,{multiple:!0,size:`small`,disableCloseOnSelect:!0,options:d,value:e.columns??[],onChange:(n,r)=>{t({...e,columns:r.length===0?void 0:r})},renderInput:t=>H(Tn,{...t,placeholder:(e.columns??[]).length===0?`Select columns`:``,className:`no-track-pii-safe`})})]})]})}function Rs(e){return d(e)}function zs({params:e,summary:t}){let n=t.total-t.added-t.removed;return U(W,{sx:{px:`16px`,pt:`5px`,pb:`5px`},children:[`Model: `,e.model,`, `,t.total,` total (`,n,` common,`,` `,t.added,` added, `,t.removed,` removed)`]})}function Bs(e){if(!e.result||!e.params)return{renderNull:!0};let t=us(e.result,{params:e.params});return t?{columns:t.columns,rows:t.rows,isEmpty:!1,header:H(zs,{params:e.params,summary:e.result.summary})}:{renderNull:!0}}const Vs=$({displayName:`ValueDiffResultView`,typeGuard:Rs,expectedRunType:`value_diff`,screenshotWrapper:`grid`,transformData:Bs}),Hs={lineage_diff:{title:`Lineage Diff`,icon:yr},schema_diff:{title:`Schema Diff`,icon:_r},query:{title:`Query`,icon:wr,RunResultView:Ss},query_base:{title:`Query Base`,icon:wr,RunResultView:Ss},query_diff:{title:`Query Diff`,icon:wr,RunResultView:bs},row_count:{title:`Row Count`,icon:gr,RunResultView:Ds},row_count_diff:{title:`Row Count Diff`,icon:gr,RunResultView:Os},profile:{title:`Profile`,icon:Cr,RunResultView:_s,RunForm:hs},profile_diff:{title:`Profile Diff`,icon:Cr,RunResultView:vs,RunForm:hs},value_diff:{title:`Value Diff`,icon:vr,RunResultView:Vs,RunForm:Ls},value_diff_detail:{title:`Value Diff Detail`,icon:vr,RunResultView:Is,RunForm:Ls},top_k_diff:{title:`Top-K Diff`,icon:ht,RunResultView:Ps,RunForm:ks},histogram_diff:{title:`Histogram Diff`,icon:br,RunResultView:Vo,RunForm:vi},sandbox:{title:`Sandbox`,icon:Sr},simple:{title:`Simple`,icon:Sr}};function Us(e){return Hs[e]}const Ws=Hs;function Gs(e){let t={...Hs};for(let[n,r]of Object.entries(e))r&&n in t&&(t[n]={...t[n],...r});return t}function Ks(e){return t=>e[t]}function qs(e){return{id:e.run_id,name:e.name,type:e.type,status:e.status??`Finished`,runAt:e.run_at,checkId:e.check_id}}function Js(){let{closeHistory:e,showRunId:t,runId:n}=j(),{featureToggles:r}=me(),{apiClient:i}=ca(),a=hr(),o=tt(),{basePath:c}=se(),{data:u,isLoading:d}=et({queryKey:D.runs(),queryFn:async()=>await l(i),retry:!1}),f=R(()=>(u??[]).map(qs),[u]),p=I(e=>{Je({name:`click_run`}),t(e,!1)},[t]),m=I(async e=>{Je({name:`add_to_checklist`});let t=await s(e,void 0,i);await o.invalidateQueries({queryKey:D.checks()}),a.push(`${c}/checks/?id=${t.check_id}`)},[i,o,a.push,c]),h=I(e=>{Je({name:`go_to_check`}),a.push(`${c}/checks/?id=${e}`)},[a.push,c]),g=I(()=>{Je({name:`hide`}),e()},[e]),_=I(e=>{let t=Us(e)?.icon;return t?H(t,{}):null},[]),v=H(J,{"aria-label":`Close History`,onClick:g,children:H(Yt,{})});return H(za,{runs:f,selectedId:n,isLoading:d,onRunSelect:p,onAddToChecklist:m,onGoToCheck:h,getRunIcon:_,hideAddToChecklist:r.disableUpdateChecklist,title:`History`,headerActions:v,emptyMessage:`No runs`,loadingMessage:`Loading...`,groupByDate:!0,addToChecklistIcon:H(kt,{}),goToCheckIcon:H(Ot,{color:`green`})})}const Ys=({size:e=16})=>U(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,children:[H(`circle`,{cx:`12`,cy:`12`,r:`10`}),H(`path`,{d:`M12 16v-4`}),H(`path`,{d:`M12 8h.01`})]});function Xs({isOpen:e,onClose:t,onExecute:n,type:r,title:i,params:a,RunForm:o,onCancel:s,onExecuteClick:c,documentationUrl:l,InfoIcon:u=Ys}){let[d,f]=B(a??{}),[p,m]=B(null),[h,g]=B(!1),_=z(!1),v=()=>{_.current||s?.(),_.current=!1,t()},y=()=>{_.current=!0,c?.(),n(r,d)};return U(lt,{open:e,onClose:v,maxWidth:`sm`,fullWidth:!0,scroll:`paper`,slotProps:{paper:{sx:{height:`75%`,minHeight:`400px`}}},children:[U(ft,{sx:{display:`flex`,alignItems:`center`},children:[i,` `,l&&U(V,{children:[H(J,{size:`small`,"aria-label":`Click this button to learn more about the SQL behind`,onMouseEnter:e=>m(e.currentTarget),onMouseLeave:()=>m(null),onClick:()=>window.open(l,`_blank`),children:H(W,{component:u,sx:{fontSize:`16px`}})}),H(Gn,{open:!!p,anchorEl:p,onClose:()=>m(null),anchorOrigin:{vertical:`bottom`,horizontal:`right`},transformOrigin:{vertical:`top`,horizontal:`right`},disableRestoreFocus:!0,sx:{pointerEvents:`none`},slotProps:{paper:{sx:{bgcolor:`black`,color:`white`,p:1}}},children:U(q,{sx:{fontSize:`0.875rem`},children:[`Click`,` `,H(pt,{href:l,target:`_blank`,sx:{textDecoration:`underline`,color:`white`,"&:hover":{color:`iochmara.300`}},children:`here`}),` `,`to learn more about the SQL behind`]})})]})]}),H(J,{"aria-label":`close`,onClick:v,sx:{position:`absolute`,right:8,top:8,color:`grey.500`},children:H(Tt,{})}),H(dt,{sx:{p:0,overflow:`auto`,borderTop:`1px solid`,borderBottom:`1px solid`,borderColor:`divider`},children:H(W,{sx:{contain:`layout`},children:o&&H(o,{params:d,onParamsChanged:f,setIsReadyToExecute:g})})}),H(ut,{children:H(K,{direction:`row`,spacing:`10px`,children:H(G,{disabled:!h,color:`iochmara`,variant:`contained`,onClick:y,children:`Execute`})})})]})}const Zs=e=>({value_diff:`https://docs.reccehq.com/features/lineage/#value-diff`,profile_diff:`https://docs.reccehq.com/features/lineage/#profile-diff`,histogram_diff:`https://docs.reccehq.com/features/lineage/#histogram-diff`,top_k_diff:`https://docs.reccehq.com/features/lineage/#top-k-diff`})[e]||null;function Qs({isOpen:e,onClose:t,onExecute:n,type:r,title:i,params:a,initialRun:o,RunForm:s}){return H(Xs,{isOpen:e,onClose:t,onExecute:n,type:r,title:i,params:a,initialRun:o,RunForm:s,onCancel:()=>{Xe(r)&&qe({action:r,event:Ye.CANCEL})},onExecuteClick:()=>{Xe(r)&&qe({action:r,event:Ye.EXECUTE})},documentationUrl:Zs(r),InfoIcon:Vt})}const $s=ot(function({isRunning:e,isAborting:t,progress:n,error:r,run:i,onCancel:a,viewOptions:o,onViewOptionsChanged:s,RunResultView:c,children:l,ErrorBoundary:u,errorBoundaryFallback:d},f){let p=N(),m=r?.response?.data?.detail??i?.error;if(m)return U(hn,{severity:`error`,sx:p?{bgcolor:`error.dark`,color:`common.white`,"& .MuiAlert-icon":{color:`common.white`}}:void 0,children:[`Error: `,H(`span`,{className:`no-track-pii-safe`,children:m})]});if(e||i?.status===`Running`){let e=`Loading...`;n?.message?e=n.message:i?.progress?.message&&(e=i.progress.message);let r=n?.percentage==null?void 0:n.percentage*100;return H(W,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,p:`1rem`,height:`100%`,bgcolor:p?`grey.900`:`grey.50`},children:U(K,{spacing:2,alignItems:`center`,children:[U(K,{direction:`row`,alignItems:`center`,spacing:1,children:[r==null?H(Dt,{size:32}):U(W,{sx:{position:`relative`,display:`inline-flex`},children:[H(Dt,{variant:`determinate`,value:r,size:32}),H(W,{sx:{top:0,left:0,bottom:0,right:0,position:`absolute`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:H(q,{variant:`caption`,component:`div`,sx:{fontSize:`0.6rem`},children:`${Math.round(r)}%`})})]}),t?H(q,{children:`Aborting...`}):H(q,{className:`no-track-pii-safe`,children:e})]}),!t&&H(G,{variant:`contained`,onClick:a,size:`small`,children:`Cancel`})]})})}if(!i)return H(W,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,bgcolor:p?`grey.900`:`grey.50`,height:`100%`},children:H(Dt,{size:32})});if(l&&c)throw Error(`RunView requires either a children or a RunResultView prop, but not both.`);if(!l&&!c)throw Error(`RunView requires at least one of children or RunResultView prop.`);return H(W,{sx:{height:`100%`,contain:`layout`,overflow:`auto`,bgcolor:p?`grey.900`:`grey.50`},className:`no-track-pii-safe`,children:(()=>{let e=c&&(i.error??i.result)?H(c,{ref:f,run:i,viewOptions:o,onViewOptionsChanged:s}):null,t=l?.({run:i,viewOptions:o,onViewOptionsChanged:s});return u&&e?U(V,{children:[H(u,{fallback:d,children:e}),t]}):U(V,{children:[e,t]})})()})});$s.displayName=`RunView`;const ec=F(({type:e,params:t})=>{let n=N();return H(ra,{value:Mn.stringify({type:e,params:t},null,2),language:`yaml`,readOnly:!0,lineNumbers:!1,wordWrap:!0,fontSize:14,height:`100%`,theme:n?`dark`:`light`,className:`no-track-pii-safe`})});ec.displayName=`ParamView`;const tc=F(({disableExport:e,onCopyAsImage:t,onMouseEnter:n,onMouseLeave:r,csvExport:i})=>{let[a,o]=B(null),s=!!a,c=e=>{o(e.currentTarget)},l=()=>{o(null)};return U(V,{children:[H(G,{size:`small`,variant:`outlined`,color:`neutral`,onClick:c,endIcon:H(jt,{}),sx:{textTransform:`none`},children:`Export`}),U(_n,{anchorEl:a,open:s,onClose:l,children:[U(X,{onClick:async()=>{await t(),l()},onMouseEnter:n,onMouseLeave:r,disabled:e,children:[H(Z,{children:H(Bt,{})}),H(Q,{children:`Copy as Image`})]}),U(X,{onClick:async()=>{await i?.copyAsTSV?.(),l()},disabled:e||!i?.canExportCSV,children:[H(Z,{children:H(It,{})}),H(Q,{children:`Copy as Text`})]}),U(X,{onClick:async()=>{await i?.copyAsCSV(),l()},disabled:e||!i?.canExportCSV,children:[H(Z,{children:H(Kt,{})}),H(Q,{children:`Copy as CSV`})]}),U(X,{onClick:()=>{i?.downloadAsCSV(),l()},disabled:e||!i?.canExportCSV,children:[H(Z,{children:H(zt,{})}),H(Q,{children:`Download as CSV`})]}),U(X,{onClick:()=>{i?.downloadAsTSV?.(),l()},disabled:e||!i?.canExportCSV,children:[H(Z,{children:H(zt,{})}),H(Q,{children:`Download as TSV`})]}),i?.downloadAsExcel&&U(X,{onClick:()=>{i?.downloadAsExcel?.(),l()},disabled:e||!i?.canExportCSV,children:[H(Z,{children:H(zt,{})}),H(Q,{children:`Download as Excel`})]})]})]})});tc.displayName=`DefaultExportMenu`;const nc=F(({disableExport:e,onCopyAsImage:t,onMouseEnter:n,onMouseLeave:r,csvExport:i,authed:a,onShareToCloud:o,onShowAuthModal:s})=>{let[c,l]=B(null),u=!!c,d=e=>{l(e.currentTarget)},f=()=>{l(null)};return U(V,{children:[H(G,{size:`small`,variant:`outlined`,color:`neutral`,onClick:d,endIcon:H(jt,{}),sx:{textTransform:`none`},children:`Share`}),U(_n,{anchorEl:c,open:u,onClose:f,children:[U(X,{onClick:async()=>{await t(),f()},onMouseEnter:n,onMouseLeave:r,disabled:e,children:[H(Z,{children:H(Bt,{})}),H(Q,{children:`Copy as Image`})]}),U(X,{onClick:async()=>{await i?.copyAsTSV?.(),f()},disabled:e||!i?.canExportCSV,children:[H(Z,{children:H(It,{})}),H(Q,{children:`Copy as Text`})]}),U(X,{onClick:async()=>{await i?.copyAsCSV(),f()},disabled:e||!i?.canExportCSV,children:[H(Z,{children:H(Kt,{})}),H(Q,{children:`Copy as CSV`})]}),U(X,{onClick:()=>{i?.downloadAsCSV(),f()},disabled:e||!i?.canExportCSV,children:[H(Z,{children:H(zt,{})}),H(Q,{children:`Download as CSV`})]}),U(X,{onClick:()=>{i?.downloadAsTSV?.(),f()},disabled:e||!i?.canExportCSV,children:[H(Z,{children:H(zt,{})}),H(Q,{children:`Download as TSV`})]}),i?.downloadAsExcel&&U(X,{onClick:()=>{i?.downloadAsExcel?.(),f()},disabled:e||!i?.canExportCSV,children:[H(Z,{children:H(zt,{})}),H(Q,{children:`Download as Excel`})]}),H(Et,{}),a?U(X,{onClick:async()=>{await o?.(),f()},children:[H(Z,{children:H(xr,{})}),H(Q,{children:`Share to Cloud`})]}):U(X,{onClick:()=>{s?.(),f()},children:[H(Z,{children:H(xr,{})}),H(Q,{children:`Share`})]})]})]})});nc.displayName=`DefaultShareMenu`;const rc=F(({runId:e,run:t,disableUpdateChecklist:n,hasError:r,onGoToCheck:i,onAddToChecklist:a})=>{let o=t?.check_id,s=!e||!t?.result||r;return n?null:o?H(G,{disabled:s,size:`small`,variant:`contained`,onClick:()=>i?.(o),startIcon:H(Nt,{}),sx:{textTransform:`none`},children:`Go to Check`}):H(G,{disabled:s,size:`small`,variant:`contained`,onClick:a,startIcon:H(Nt,{}),sx:{textTransform:`none`},children:`Add to Checklist`})});rc.displayName=`DefaultAddToCheckButton`;const ic=F(({run:e})=>{let t=e.status||(e.result?`Finished`:e.error?`Failed`:`unknown`),n=e=>{switch(e.toLowerCase()){case`finished`:return`success.main`;case`failed`:return`error.main`;case`running`:return`primary.main`;case`cancelled`:default:return`text.secondary`}},r=e.run_at?qn(new Date(e.run_at),{addSuffix:!0}):`Unknown time`;return U(q,{variant:`body2`,sx:{color:`text.secondary`},children:[H(W,{component:`span`,sx:{color:n(t)},fontWeight:600,children:t}),`・`,r]})});ic.displayName=`RunStatusAndDateDisplay`;function ac({runId:e,run:t,isRunning:n,error:r,viewOptions:i,onViewOptionsChanged:a,isSingleEnvironment:o,disableDatabaseQuery:s,disableShare:c,disableUpdateChecklist:l,onClose:u,onCancel:d,onRerun:f,onCopyAsImage:p,onCopyMouseEnter:m,onCopyMouseLeave:h,csvExport:g,authed:_,onShareToCloud:v,onShowAuthModal:y,onTrackCopyToClipboard:b,onGoToCheck:x,onAddToChecklist:S,SingleEnvironmentNotification:C,SqlEditorComponent:w,DualSqlEditorComponent:T,AuthModalComponent:E,RunResultView:ee,resultViewRef:te,children:D}){let O=N(),[k,ne]=B(`result`),[re,A]=B(!0),[ie,ae]=B(!1),oe=t?.type===`query`||t?.type===`query_diff`||t?.type===`query_base`,se=!e||!t?.result||!!r||k!==`result`,j=I(async()=>{await p?.(),b&&b(t?.type??`unknown`,`run`)},[p,b,t?.type]),ce=I(()=>{y?y():ae(!0)},[y]),le=t?.type===`query_diff`,ue=t?.params;return U(W,{sx:{display:`flex`,flexDirection:`column`,height:`100%`,bgcolor:O?`grey.900`:`grey.50`},children:[o&&re&&C&&H(C,{runType:t?.type,onClose:()=>A(!1)}),U(W,{sx:{display:`flex`,alignItems:`center`,borderBottom:1,borderColor:`divider`,mb:`1px`},children:[U(Dn,{value:k,onChange:(e,t)=>ne(t),children:[H(En,{label:`Result`,value:`result`}),H(En,{label:`Params`,value:`params`}),oe&&H(En,{label:`Query`,value:`query`})]}),H(W,{sx:{flexGrow:1}}),U(K,{direction:`row`,spacing:1,sx:{overflow:`hidden`,pr:1},alignItems:`center`,children:[t&&H(ic,{run:t}),H(G,{variant:`outlined`,color:`neutral`,disabled:!e||n||s,size:`small`,onClick:f,startIcon:H(Gt,{}),sx:{textTransform:`none`},children:`Rerun`}),c?H(tc,{run:t,disableExport:se,onCopyAsImage:j,onMouseEnter:m,onMouseLeave:h,csvExport:g}):H(nc,{run:t,disableExport:se,onCopyAsImage:j,onMouseEnter:m,onMouseLeave:h,csvExport:g,authed:_,onShareToCloud:v,onShowAuthModal:ce}),H(rc,{runId:e,run:t,disableUpdateChecklist:l,hasError:!!r,onGoToCheck:x,onAddToChecklist:S}),H(J,{size:`small`,onClick:u,children:H(Tt,{})})]})]}),k===`result`&&(ee||D)&&H($s,{ref:te,isRunning:n,error:r,run:t,onCancel:d,viewOptions:i,onViewOptionsChanged:a,RunResultView:ee,children:D}),k===`params`&&t&&H(ec,{type:t.type,params:t.params}),k===`query`&&t&&oe&&ue?.sql_template&&H(V,{children:le&&T?H(T,{value:ue.sql_template,baseValue:ue.base_sql_template,readOnly:!0}):w?H(w,{value:ue.sql_template,readOnly:!0}):H(ra,{value:ue.sql_template,language:`sql`,readOnly:!0,theme:`dark`,height:`100%`})}),E&&ie&&H(E,{open:ie,onClose:()=>ae(!1)})]})}const oc=F(ac);oc.displayName=`RunResultPane`;const sc=e=>U(W,{sx:{display:`flex`,flex:1,minHeight:`48px`,m:`4px`,px:`16px`,py:`12px`,bgcolor:`primary.50`,border:`1px solid`,borderRadius:`4px`,borderColor:`primary.400`,alignItems:e.align??`center`,gap:`12px`},children:[H(W,{component:Er,sx:{width:`20px`,height:`20px`,color:`primary.900`}}),e.children,H(W,{sx:{flexGrow:1}}),H(J,{size:`small`,onClick:e.onClose,children:H(Tt,{})})]}),cc=()=>U(pt,{href:`https://docs.reccehq.com/get-started/#prepare-dbt-artifacts`,target:`_blank`,sx:{color:`primary.main`,fontWeight:`bold`,textDecoration:`underline`,display:`inline-flex`,alignItems:`center`,gap:.5},children:[`Learn how `,H(gt,{})]});function lc({value:e,onChange:t,onRun:n,onRunBase:r,onRunDiff:i,label:a,CustomEditor:o,options:s={},manifestData:c,schemas:l,...u}){let{featureToggles:d}=me(),f=N(),p=e=>{t&&t(e)},m=``;c&&(m=c.generated_at?je(c.generated_at):``);let h=R(()=>{let e=[];return n&&e.push({key:`Mod-Enter`,run:()=>(n(),!0)}),r&&e.push({key:`Alt-Enter`,run:()=>(r(),!0)}),i&&e.push({key:`Mod-Shift-Enter`,run:()=>(i(),!0)}),e},[n,r,i]);return U(V,{children:[(a??n??r)&&U(K,{direction:`row`,sx:{bgcolor:yt(f?M.neutral[600]:M.neutral[200],.7),height:`40px`,minHeight:`40px`,fontSize:`14px`,alignItems:`center`,m:0,p:`0px 16px`,flex:`0 0 40px`},children:[H(q,{component:`strong`,sx:{fontWeight:`bold`},className:`no-track-pii-safe`,children:a?a.toUpperCase():``}),c&&U(`span`,{className:`ml-1`,children:[`(`,l&&U(`span`,{className:`no-track-pii-safe`,children:[l,`, `]}),H(`span`,{children:m}),`)`]}),H(W,{sx:{flexGrow:1}}),(n??r)&&H(G,{size:`xsmall`,variant:`outlined`,onClick:n??r,sx:{bgcolor:`background.paper`,p:`6px 12px`},disabled:d.disableDatabaseQuery,startIcon:H(Dr,{}),children:`Run Query`})]}),o??H(ra,{value:e,onChange:p,language:`sql`,readOnly:s.readOnly??!1,lineNumbers:s.lineNumbers!==`off`,wordWrap:s.wordWrap!==`off`,fontSize:s.fontSize??16,keyBindings:h,theme:f?`dark`:`light`,className:`no-track-pii-safe max-h-dvh h-full`})]})}function uc({value:e,baseValue:t,onChange:n,onChangeBase:r,onRun:i,onRunBase:a,onRunDiff:o,options:s={},labels:c,SetupGuide:l,...u}){let d=c?c[0]:`Base`,f=c?c[1]:`Current`,{envInfo:p,lineageGraph:m}=A(),h,g;p?.dbt?.base&&p.dbt.current&&(h=p.dbt.base,g=p.dbt.current);let[_,v]=Re(m);return H(V,{children:U(K,{direction:`row`,sx:{height:`100%`,gap:0},children:[H(K,{sx:{height:`100%`,width:`50%`,gap:0,borderRight:`1px solid`,borderRightColor:`divider`},children:H(lc,{label:d,value:t??``,onChange:r,onRunBase:a,options:s,CustomEditor:l,manifestData:h??void 0,schemas:Array.from(_).join(`, `),...u})}),H(K,{sx:{height:`100%`,width:`50%`,gap:0},children:H(lc,{label:f,value:e,onChange:n,onRun:i,options:s,manifestData:g??void 0,schemas:Array.from(v).join(`, `),...u})})]})})}var dc=lc;const fc=({runType:e,onClose:t})=>{switch(e){case`row_count`:return H(sc,{onClose:t,children:U(q,{children:[`Enable row count diffing, and other Recce features, by configuring a base dbt environment to compare against. `,H(cc,{})]})});case`profile`:return H(sc,{onClose:t,children:U(q,{children:[`Enable data-profile diffing, and other Recce features, by configuring a base dbt environment to compare against.`,` `,H(cc,{})]})});default:return null}},pc=({value:e,readOnly:t})=>H(dc,{value:e,options:{readOnly:t}}),mc=({value:e,baseValue:t,readOnly:n})=>H(uc,{value:e,baseValue:t,options:{readOnly:n}}),hc=({open:e,onClose:t})=>H(ll,{parentOpen:e,handleParentClose:()=>t(),ignoreCookie:!0,variant:`enable-share`}),gc=({runId:e,onClose:t,isSingleEnvironment:n})=>{let{featureToggles:r,authed:i}=me(),{runAction:a}=j(),{error:o,run:c,onCancel:l,isRunning:u}=al(e),[d,f]=B(),p=tt(),m=hr(),{apiClient:h}=ca(),{basePath:g}=se(),{handleShareClick:_}=Vc(),v;c&&E(c.type)&&(v=Us(c.type).RunResultView);let{ref:y,onCopyToClipboard:b,onMouseEnter:x,onMouseLeave:S}=qc(),C=Qc({run:c,viewOptions:d}),w=I(()=>{c&&a(c.type,c.params)},[c,a]),T=I(async()=>{await _(),Ge({name:`create`})},[_]),ee=I(async()=>{await b(),Ke({type:c?.type??`unknown`,from:`run`})},[b,c?.type]),te=I(e=>{m.push(`${g}/checks/?id=${e}`)},[m.push,g]),O=I(async()=>{if(!e)return;let t=await s(e,d,h);await p.invalidateQueries({queryKey:D.checks()}),m.push(`${g}/checks/?id=${t.check_id}`)},[e,d,h,p,m.push,g]);return H(oc,{runId:e,run:c,isRunning:u,error:o,viewOptions:d,onViewOptionsChanged:f,isSingleEnvironment:n,disableDatabaseQuery:r.disableDatabaseQuery,disableShare:r.disableShare,disableUpdateChecklist:r.disableUpdateChecklist,onClose:t,onCancel:l,onRerun:w,onCopyAsImage:ee,onCopyMouseEnter:x,onCopyMouseLeave:S,csvExport:C,authed:i,onShareToCloud:T,onGoToCheck:te,onAddToChecklist:O,SingleEnvironmentNotification:fc,SqlEditorComponent:pc,DualSqlEditorComponent:mc,AuthModalComponent:hc,RunResultView:v,resultViewRef:y})},_c=({onClose:e,isSingleEnvironment:t})=>{let{runId:n}=j();return H(gc,{runId:n,onClose:e,isSingleEnvironment:t})};function vc({error:e,resetError:t}){let{background:n,text:r}=ol();return H(W,{sx:{height:`100%`,bgcolor:n.subtle,display:`flex`,alignItems:`center`,justifyContent:`center`},children:U(W,{sx:{p:4,display:`flex`,flexDirection:`column`,justifyContent:`flex-start`,bgcolor:`background.paper`,border:`solid 1px`,borderColor:`divider`,minHeight:`200px`},children:[H(q,{variant:`h6`,sx:{width:`800px`},children:`You have encountered an error`}),H(W,{sx:{flex:1,fontSize:`10pt`,color:r.secondary},children:String(e)}),H(G,{sx:{justifySelf:`center`,alignSelf:`center`,mt:`20px`},color:`iochmara`,variant:`contained`,size:`small`,onClick:t,children:`Reset`})]})})}const yc=e=>H(vc,{error:e.error,resetError:e.resetError}),bc=({children:e,fallback:t=yc})=>H(Or,{fallback:t,children:e}),xc=ot(function(e,t){return H($s,{...e,ErrorBoundary:bc,errorBoundaryFallback:Qe,ref:t})});xc.displayName=`RunViewOss`;const Sc={mode:`per_node`,status:`pending`,completed:0,total:0,actions:{}},Cc=(e,t)=>{let{onActionStarted:n,onActionNodeUpdated:i,onActionCompleted:o,onTrackAction:s,trackingSource:c=`lineage_view_top_bar`}=t,l=O(),u=z({...Sc}).current,{showRunId:d}=j(),f=async(t,r,s)=>{u.mode=`multi_nodes`,u.actions={};let c=u.mode,f=u.actions;n(),u.status=`running`;let p=[];for(let t of e){let e=r(t);e?(f[t.id]={mode:c,status:`skipped`,skipReason:e},i(t)):(f[t.id]={mode:c,status:`pending`},p.push(t))}let h=s(p);try{let{run_id:e}=await a(t,h,{nowait:!0},l);for(d(e),u.currentRun={run_id:e},u.total=1;;){let t=await m(e,2,l);u.currentRun=t;let n=t.error?`failure`:t.result?`success`:`running`;for(let e of p)f[e.id]={mode:c,status:n,run:t},i(e);if(t.error||t.result)break}}catch{}if(u.completed=1,u.status===`canceling`){u.status=`canceled`,o();return}u.status=`completed`,o()},p=async(t,r)=>{u.mode=`per_node`,u.actions={};let s=u.mode,c=u.actions;n(),u.status=`running`;for(let t of e)c[t.id]={mode:s,status:`pending`},i(t);u.completed=0,u.total=e.length;for(let n of e){let{params:e,skipReason:d}=r(n);if(d)c[n.id]={mode:s,status:`skipped`,skipReason:d},i(n);else try{let{run_id:r}=await a(t,e,{nowait:!0},l);for(u.currentRun={run_id:r},c[n.id]={mode:s,status:`running`},i(n);;){let e=await m(r,2,l);u.currentRun=e;let t=e.error?`failure`:e.result?`success`:`running`;if(c[n.id]={mode:s,status:t,run:e},i(n),e.error||e.result)break}}catch{}finally{u.currentRun=void 0}if(u.completed++,u.status===`canceling`){u.status=`canceled`,o();return}}u.status=`completed`,o()};return{actionState:u,runRowCount:async()=>{s?.({action:`row_count`,source:c,node_count:e.length});for(let t of e)t.data.resourceType!==`model`&&(u.actions[t.id]={mode:`multi_nodes`,status:`skipped`,skipReason:`Not a model`},i(t));await f(`row_count`,e=>{if(e.data.resourceType!==`model`)return`Not a model`},e=>({node_names:e.map(e=>e.data.name)}))},runRowCountDiff:async()=>{s?.({action:`row_count_diff`,source:c,node_count:e.length});for(let t of e)t.data.resourceType!==`model`&&(u.actions[t.id]={mode:`multi_nodes`,status:`skipped`,skipReason:`Not a model`},i(t));await f(`row_count_diff`,e=>{if(e.data.resourceType!==`model`)return`Not a model`},e=>({node_names:e.map(e=>e.data.name)}))},runValueDiff:async()=>{s?.({action:`value_diff`,source:c,node_count:e.length}),await p(`value_diff`,e=>{let t=e.data.data.current?.primary_key;return t?{params:{model:e.data.name,primary_key:t}}:{skipReason:`No primary key found. The first unique column is used as primary key.`}})},addLineageDiffCheck:async()=>await ee({node_ids:e.map(e=>e.id)},l),addSchemaDiffCheck:async()=>{let t;return t=e.length===1?await _({node_id:e[0].id},l):await _({node_id:e.map(e=>e.id)},l),t},cancel:async()=>{u.status=`canceling`,u.currentRun?.run_id&&await r(u.currentRun.run_id,l)},reset:()=>{Object.assign(u,Sc)}}};function wc(e){let[t,n]=B(!1),[r,i]=B(0),[a,o]=B(),s=z(null),c=I(e=>(i(e),new Promise(e=>{o(()=>e),n(!0)})),[]),l=()=>{e?.onConfirm?.(r),a?.(!0),n(!1)},u=()=>{e?.onCancel?.(r),a?.(!1),n(!1)};return{confirm:c,AlertDialog:U(lt,{open:t,onClose:u,maxWidth:`md`,fullWidth:!0,"aria-labelledby":`value-diff-alert-dialog-title`,children:[U(ft,{id:`value-diff-alert-dialog-title`,sx:{fontSize:`1.125rem`,fontWeight:`bold`},children:[`Value Diff on `,r,` nodes`]}),H(J,{"aria-label":`close`,onClick:u,sx:{position:`absolute`,right:8,top:8,color:`grey.500`},children:H(Tt,{})}),H(dt,{children:H(K,{spacing:`20px`,children:U(W,{children:[`Value diff will be executed on `,r,` nodes in the Lineage, which can add extra costs to your bill.`]})})}),U(ut,{sx:{gap:.5},children:[H(G,{ref:s,onClick:u,variant:`outlined`,color:`neutral`,children:`Cancel`}),H(G,{color:`iochmara`,variant:`contained`,onClick:l,sx:{ml:1.5},children:`Execute`})]})]})}}function Tc({connect:e,idleSeconds:t}){return U(V,{children:[H(ft,{children:`Server Disconnected`}),H(dt,{children:t!=null&&t>0?U(q,{children:[`The server has been idle for `,Le(t),` and was automatically stopped. Please restart the Recce server to continue.`]}):H(q,{children:`The server connection has been lost. Please restart the Recce server and try again.`})}),H(ut,{children:H(G,{color:`iochmara`,variant:`contained`,onClick:()=>{e()},children:`Retry`})})]})}function Ec({shareUrl:e,mode:t,supportCalendarUrl:n,LinkComponent:r}){let i={"read only":{title:`Share Instance Expired`,body:`This Share Instance has expired. Please restart the share instance.`,action:`Restart`,link:e},"metadata only":{title:`Preview Instance Expired`,body:`This Preview Instance has expired. To browse more, please book a meeting with us.`,action:`Contact us`,link:n}}[t],a=H(G,{color:`iochmara`,variant:`contained`,children:i.action});return U(V,{children:[H(ft,{children:i.title}),H(dt,{children:H(q,{children:i.body})}),H(ut,{children:t===`read only`?H(r||`a`,{href:i.link,children:a}):H(G,{color:`iochmara`,variant:`contained`,onClick:()=>window.open(i.link,`_blank`),children:i.action})})]})}function Dc({enabled:e=!0,baseUrl:t,apiPrefix:n}={}){let[r,i]=B(void 0),a=z({ws:void 0,status:`pending`,artifactsUpdatedToastId:void 0}),[o,s]=B(e?`pending`:`connected`),[c,l]=B(void 0);L(()=>{a.current.status=o},[o]),L(()=>{a.current.artifactsUpdatedToastId=r},[r]);let u=tt(),d=I(()=>{u.invalidateQueries({queryKey:D.lineage()}),u.invalidateQueries({queryKey:D.checks()}),u.invalidateQueries({queryKey:D.runs()})},[u]),f=I(()=>{function e(e){return e.replace(/(http)(s)?:\/\//,`ws$2://`)}let r=t??We,o=n?`${n}/ws`:`/api/ws`,c=new WebSocket(`${e(r)}${o}`);a.current.ws=c,c.onopen=()=>{c.send(`ping`)},c.onmessage=e=>{if(e.data===`pong`){a.current.status===`disconnected`&&d(),s(`connected`);return}try{let t=JSON.parse(e.data);if(t.command===`refresh`){let{eventType:e,srcPath:n}=t.event,[r,o]=n.split(`/`).slice(-2),s=o.replace(/\.[^/.]+$/,``),c=`${r}-${s}-${e}`;a.current.artifactsUpdatedToastId??i(P.create({id:c,description:`Detected ${r} ${s} ${e}`,type:`info`,duration:5e3,closable:!0})),d()}else if(t.command===`relaunch`)l(`relaunch`);else{let{id:e,title:n,description:r,status:a,duration:o}=t.event;i(P.create({id:e||`broadcast`,title:n,description:r,type:a??`info`,duration:o??5e3,closable:!0}))}}catch(e){console.error(e)}},c.onerror=e=>{console.error(`An error occurred during Handling WebSockets`,e)},c.onclose=()=>{s(e=>e===`connected`?`disconnected`:e),a.current.ws=void 0}},[d,t,n]);return L(()=>{if(!e)return;let t=a.current;return f(),()=>{t.ws&&t.ws.close()}},[f,e]),{connectionStatus:o,connect:f,envStatus:c}}function Oc({children:t}){let{idleTimeout:n,remainingSeconds:r,isEnabled:i,setDisconnected:a,resetConnection:o}=ie(),{apiClient:s,apiPrefix:c,baseUrl:l}=ca(),u=et({queryKey:D.lineage(),queryFn:()=>e(s)}),d=et({queryKey:D.runsAggregated(),queryFn:()=>C(s)}),f=R(()=>{let e=u.data?.lineage;if(e?.base)return le(e.base,e.current,e.diff)},[u.data]),p=u.error?.message,{state_metadata:m,lineage:h,sqlmesh:g,demo:_,codespace:v,review_mode:y,cloud_mode:b,file_mode:x,filename:S,adapter_type:w,git:T,pull_request:E,support_tasks:ee}=u.data??{demo:!1},te={stateMetadata:m,adapterType:w,git:T,pullRequest:E,dbt:{base:h?.base.manifest_metadata,current:h?.current.manifest_metadata},sqlmesh:g},{connectionStatus:O,connect:ne,envStatus:re}=Dc({enabled:!0,baseUrl:l,apiPrefix:c});L(()=>{O===`disconnected`?a():O===`connected`&&o()},[O,a,o]);let{data:A,isLoading:ae}=fe(),{featureToggles:se,shareUrl:j}=me(),[ce,ue]=B(!1),[de,pe]=B(!1),he=tt(),ge=!ae&&re===`relaunch`&&A?.single_env_onboarding===!0&&A.show_relaunch_hint;ge!==de&&(pe(ge),ue(ge)),L(()=>{ge&&ce&&Ze({action:`target_base_added`})},[ge,ce]);let _e=()=>{ue(!1),k(s),he.invalidateQueries({queryKey:D.flag()})},M=I(()=>{d.refetch()},[d]),ve=I(()=>{d.refetch()},[d]);return U(V,{children:[H(oe,{lineageGraph:f,envInfo:te,reviewMode:y,cloudMode:b,fileMode:x,fileName:S,isDemoSite:_??!1,isCodespace:v,isLoading:u.isLoading,error:p,supportTasks:ee,onRefetchLineageGraph:M,runsAggregated:d.data,onRefetchRunsAggregated:ve,children:t}),H(lt,{open:O===`disconnected`,onClose:()=>void 0,children:j&&se.mode!==null?H(Ec,{shareUrl:j,mode:se.mode,supportCalendarUrl:Ue,LinkComponent:({href:e,children:t})=>H(wt,{href:e,passHref:!0,children:t})}):H(Tc,{connect:ne,idleSeconds:i&&n!==null&&r!==null&&r<=5?n-Math.max(0,r):void 0})}),A?.single_env_onboarding&&U(lt,{open:ce,onClose:_e,children:[H(ft,{children:`Target-base Added`}),H(J,{"aria-label":`close`,onClick:_e,sx:{position:`absolute`,right:8,top:8,color:`grey.500`},children:H(Tt,{})}),H(dt,{children:H(q,{children:`Please restart the Recce server.`})}),H(ut,{children:H(G,{color:`iochmara`,variant:`contained`,onClick:_e,children:`Got it!`})})]})]})}const kc=`select * from {{ ref("mymodel") }}`;function Ac({children:e}){let[t,n]=B(kc),[r,i]=B(kc),[a,o]=B(!1),[s,c]=B();return H(Pr,{sql:t,sqlQuery:t,setSqlQuery:n,primaryKeys:s,setPrimaryKeys:c,isCustomQueries:a,setCustomQueries:o,baseSqlQuery:r,setBaseSqlQuery:i,children:e})}const jc=e=>{},Mc=e=>{},Nc=e=>{},Pc=e=>{};function Fc(){let e=Fr();return{sqlQuery:e.sqlQuery??kc,setSqlQuery:e.setSqlQuery??jc,primaryKeys:e.primaryKeys,setPrimaryKeys:e.setPrimaryKeys??Mc,isCustomQueries:e.isCustomQueries??!1,setCustomQueries:e.setCustomQueries??Nc,baseSqlQuery:e.baseSqlQuery??kc,setBaseSqlQuery:e.setBaseSqlQuery??Pc}}function Ic(e){L(()=>{e()},[e,mr()])}function Lc({children:e}){let{apiClient:t}=ca(),[n,r]=B(),[i,o]=B(!1),s=I(()=>o(!0),[]),c=I(()=>o(!1),[]),l=hr(),d=mr(),f=tt(),{basePath:p}=se(),m=z(null);Ic(c);let h=I(async(e,t)=>{t!==!1&&await f.invalidateQueries({queryKey:D.runs()})},[f]),g=I(async(e,n,i)=>{try{let o=new Date().getTime().toString(),c,h=i;if(h?.showLast){let r=await u(e,n,1,t);r.length===1&&(c=r[0])}let g=Us(e),_=g.RunResultView,{title:v,RunForm:y}=g;if(_===void 0)throw Error(`Run type ${e} does not have a result view`);if(y===void 0||!i?.showForm){let{run_id:r}=await a(e,n,{nowait:!0,trackProps:h?.trackProps},t);await f.invalidateQueries({queryKey:D.runs()}),m.current&&m.current(r),d.startsWith(`/lineage`)&&l.push(`${p}/lineage`);return}r({session:o,title:v,type:e,params:n,lastRun:c,options:h,RunForm:y}),s();return}catch(e){P.create({title:`Failed to submit a run`,description:e instanceof Error?e.message:void 0,type:`error`,duration:5e3,closable:!0});return}},[s,f,t,d,l,p]),_=I(async(e,r)=>{try{c();let{run_id:i}=await a(e,r,{nowait:!0,trackProps:n?.options?.trackProps},t);m.current&&m.current(i)}catch(e){P.create({title:`Failed to submit a run`,description:e instanceof Error?e.message:void 0,type:`error`,duration:5e3,closable:!0})}},[c,n?.options?.trackProps,t]);return U(re,{onRunAction:g,onShowRunId:h,children:[H(Rc,{showRunIdRef:m,children:e}),n&&H(Qs,{isOpen:i,onClose:c,onExecute:_,title:n.title,type:n.type,params:n.params,initialRun:n.lastRun,RunForm:n.options?.showForm&&n.RunForm?n.RunForm:void 0},n.session)]})}function Rc({children:e,showRunIdRef:t}){let{showRunId:n}=j();return L(()=>(t.current=n,()=>{t.current=null}),[n,t]),H(V,{children:e})}const zc=at(void 0);function Bc({children:e}){let[t,n]=B(),[r,i]=B(!1),[a,o]=B(),{apiClient:s}=ca();return H(zc.Provider,{value:{shareUrl:t,isLoading:r,error:a,handleShareClick:async()=>{i(!0),o(void 0),n(void 0);try{let e=await h(s);if(e.status!==`success`){o(e.message);return}n(e.share_url)}catch(e){o(e.message)}finally{i(!1)}}},children:e})}const Vc=()=>{let e=st(zc);if(!e)throw Error(`useRecceShareStateContext must be used within a RecceShareStateContextProvider`);return e};function Hc({children:e}){return H(ne,{children:H(Bc,{children:H(Ac,{children:H(Oc,{children:H(Lc,{children:H(Ir,{children:e})})})})})})}const Uc=async()=>(await import(`html2canvas-pro`)).default,Wc=e=>`element`in e?e.element:e,Gc=`ignore-screenshot`;function Kc({renderLibrary:e=`html2canvas`,imageType:t=`png`,backgroundColor:n=null,boardEffect:r=!0,shadowEffect:i=!1,borderStyle:a=`solid 1px ${M.neutral[300]}`,borderRadius:o=`10px`,onSuccess:s,onError:c,ignoreElements:l}){let[u,d]=B(`idle`),f=z(null),{onOpen:p,setImgBlob:m,ImageDownloadModal:h}=Jc(),g=async()=>{if(!f.current)throw console.error(`No node to use for screenshot`),Error(`No node to use for screenshot`);let t=Wc(f.current);if(!t)throw console.error(`Could not get HTMLElement from ref`),Error(`Could not get HTMLElement from ref`);let s=t.style.overflow,c=t.style.border,u=t.style.borderRadius,p=t.style.backgroundColor,m=t.style.height;function h(){let e=t;e&&(e.style.overflow=s,e.style.border=c,e.style.borderRadius=u,e.style.backgroundColor=p,e.style.height=m)}try{t.style.overflow=`hidden`,t.style.border=r?a:``,t.style.borderRadius=r?o:``,t.style.backgroundColor=n??M.neutral[100],t.style.height=`${String(t.offsetHeight)}px`;let s=document.createElement(`style`);document.head.appendChild(s),s.sheet?.insertRule(`body > div:last-child img { display: inline-block; }`);let c=l?e=>!l(e):void 0;d(`loading`);let u;u=e===`html2canvas`?await(await Uc())(t,{logging:!1,backgroundColor:n??M.neutral[100],ignoreElements:l}):await An(t,{filter:c}),s.remove();let f=i?document.createElement(`canvas`):u;if(i){f.width=u.width+80,f.height=u.height+80;let e=f.getContext(`2d`);if(e)e.shadowColor=`rgba(0, 0, 0, 0.5)`,e.shadowBlur=20,e.shadowOffsetX=10,e.shadowOffsetY=10,e.drawImage(u,40,40);else throw console.error(`Error getting canvas context`),Error(`Error getting canvas context to add shadow effect`)}return await(await fetch(f.toDataURL())).blob()}catch(e){throw console.error(`Error converting to image`,e),e}finally{h()}};return{status:u,isLoading:u===`loading`,isErrored:u===`error`,isSuccess:u===`success`,copyToClipboard:async()=>{try{await navigator.clipboard.write([new ClipboardItem({[`image/${t}`]:g()})]),d(`success`),s&&s()}catch(e){e.message===`ClipboardItem is not defined`?(m(await g()),p(),d(`success`)):(d(`error`),console.error(`Error copying to clipboard`,e),c&&c(e))}},ImageDownloadModal:h,ref:f}}function qc(e){let{successToast:t,failToast:n}=Ae(),{isLoading:r,copyToClipboard:i,ImageDownloadModal:a,ref:o}=Kc({imageType:`png`,shadowEffect:!0,backgroundColor:e?.backgroundColor??M.neutral[100],onSuccess:()=>{t(`Copied the query result as an image to clipboard`)},onError:e=>{console.error(`Error taking screenshot`,e),n(`Failed to copy image to clipboard`,e)}}),s=I(()=>{if(o.current){let e=Wc(o.current);e&&(e.style.boxShadow=`rgba(0, 0, 0, 0.25) 0px 54px 55px, rgba(0, 0, 0, 0.12) 0px -12px 30px, rgba(0, 0, 0, 0.12) 0px 4px 6px, rgba(0, 0, 0, 0.17) 0px 12px 13px, rgba(0, 0, 0, 0.09) 0px -3px 5px`,e.style.transition=`box-shadow 0.5s ease-in-out`)}},[o]),c=I(()=>{if(o.current){let e=Wc(o.current);e&&(e.style.boxShadow=``)}},[o]),l=I(async()=>{if(o.current){await i();let e=Wc(o.current);e&&(e.style.boxShadow=``)}else n(`Failed to copy image to clipboard`,`No content to copy`)},[o,i,n]);function u({imageType:e=`png`,...t}){return U(V,{children:[H(G,{size:`small`,sx:{position:`absolute`,bottom:16,right:16},disabled:r,onMouseEnter:s,onMouseLeave:c,onClick:l,startIcon:H(Lt,{}),...t,children:`Copy to Clipboard`}),H(a,{})]})}return{ref:o,CopyToClipboardButton:u,onMouseEnter:s,onMouseLeave:c,onCopyToClipboard:l}}function Jc(){let[e,t]=B(!1),[n,r]=B(),i=()=>t(!0),a=()=>t(!1);function o(){let[t,r]=B();L(()=>{if(!n)return;let e=new FileReader;e.readAsDataURL(n),e.onloadend=e=>{e.target?.result!=null&&r(e.target.result)}},[]);let i=()=>{n&&(un(n,`recce-screenshot-${Kn(new Date,`yyyy-MM-dd-HH-mm-ss`)}.png`),a())};return U(lt,{open:e,onClose:a,maxWidth:`sm`,fullWidth:!0,children:[H(ft,{children:`Screenshot Preview`}),H(J,{"aria-label":`close`,onClick:a,sx:{position:`absolute`,right:8,top:8,color:`grey.500`},children:H(Tt,{})}),U(dt,{children:[U(K,{sx:{px:`10px`,gap:`10px`},children:[U(K,{direction:`row`,alignItems:`center`,spacing:`5px`,children:[H(W,{component:Vt,sx:{color:`error.main`}}),H(q,{sx:{fontWeight:500,display:`inline`},children:`Copy to the Clipboard`}),` `,`is not supported in the current browser`]}),H(q,{children:`Please download it directly`})]}),H(W,{component:`img`,src:t,alt:`screenshot`,sx:{maxWidth:`100%`}})]}),U(ut,{children:[H(G,{sx:{mr:1.5},onClick:a,children:`Close`}),H(G,{color:`iochmara`,variant:`contained`,onClick:i,children:`Download`})]})]})}return{onOpen:i,setImgBlob:r,ImageDownloadModal:o}}function Yc(e,r={}){let{enabled:a=!0}=r,o=tt(),{apiClient:s}=ca(),{data:l,isLoading:u,error:d,refetch:f}=et({queryKey:D.checkEvents(e),queryFn:()=>n(e,s),enabled:a,refetchInterval:1e4,refetchIntervalInBackground:!1}),p=$e({mutationFn:t=>i(e,t,s),onSuccess:async()=>{await o.invalidateQueries({queryKey:D.checkEvents(e)})}}),m=$e({mutationFn:({eventId:t,content:n})=>c(e,t,n,s),onSuccess:async()=>{await o.invalidateQueries({queryKey:D.checkEvents(e)})}}),h=$e({mutationFn:n=>t(e,n,s),onSuccess:async()=>{await o.invalidateQueries({queryKey:D.checkEvents(e)})}});return{events:l??[],isLoading:u,error:d,refetch:f,createComment:p.mutate,isCreatingComment:p.isPending,createCommentError:p.error,updateComment:m.mutateAsync,isUpdatingComment:m.isPending,updateCommentError:m.error,deleteComment:h.mutateAsync,isDeletingComment:h.isPending,deleteCommentError:h.error}}const Xc={TOAST_ID:`lifetime-countdown`,WARNING_THRESHOLD:60,UPDATE_INTERVAL:1e3,MESSAGE:e=>`The server will be closed in ${e} seconds.`,STYLE:{fontFamily:`monospace`}};function Zc(e){let t=P,[n,r]=B(null),i=z(void 0),a=I(()=>{if(!e)return 0;let t=new Date,n=Math.floor((e.getTime()-t.getTime())/1e3);return Math.max(0,n)},[e]),o=I(()=>{n!=null&&(t.remove(n),r(null))},[n]),s=I(()=>{if(n==null)return;let e=a();if(e<=0){o();return}t.update(n,{description:Xc.MESSAGE(e)})},[n,a,o]),c=I(()=>{if(!e)return;o();let n=a();n<=0||(r(t.create({id:Xc.TOAST_ID,description:Xc.MESSAGE(n)})),i.current=setInterval(s,Xc.UPDATE_INTERVAL))},[e,a,s,o]),l=a();mn(c,e?Math.max(0,l-Xc.WARNING_THRESHOLD)*1e3:null),L(()=>o,[o])}function Qc({run:e,viewOptions:t}){let n=R(()=>!e?.type||!e?.result?!1:ye(e.type),[e?.type,e?.result]),r=I(()=>{if(!e?.type||!e?.result)return null;let n={displayMode:t?.display_mode,primaryKeys:e?.params?.primary_keys};return be(e.type,e.result,n)},[e?.type,e?.result,e?.params,t]),i=I(()=>{let e=r();return e?ze(e.columns,e.rows):null},[r]),a=I(()=>{let e=r();return e?De(e.columns,e.rows):null},[r]),o=I(async()=>{let e=i();if(!e){P.create({title:`Export failed`,description:`Unable to extract data for CSV export`,type:`error`,duration:3e3});return}try{await Ne(e),P.create({title:`Copied to clipboard`,description:`CSV data copied successfully`,type:`success`,duration:2e3})}catch(e){console.error(`Failed to copy CSV to clipboard:`,e),P.create({title:`Copy failed`,description:`Failed to copy to clipboard`,type:`error`,duration:3e3})}},[i]),s=I(()=>{let t=i();if(!t){P.create({title:`Export failed`,description:`Unable to extract data for CSV export`,type:`error`,duration:3e3});return}try{let n=Ee(e?.type??``,e?.params);ve(t,n),P.create({title:`Downloaded`,description:n,type:`success`,duration:3e3})}catch(e){console.error(`Failed to download CSV file:`,e),P.create({title:`Download failed`,description:`Failed to download CSV file`,type:`error`,duration:3e3})}},[i,e]),c=I(async()=>{let e=a();if(!e){P.create({title:`Export failed`,description:`Unable to extract data for export`,type:`error`,duration:3e3});return}try{await Ne(e),P.create({title:`Copied to clipboard`,description:`Text data copied — paste into any spreadsheet`,type:`success`,duration:2e3})}catch(e){console.error(`Failed to copy TSV to clipboard:`,e),P.create({title:`Copy failed`,description:`Failed to copy to clipboard`,type:`error`,duration:3e3})}},[a]),l=I(()=>{let t=a();if(!t){P.create({title:`Export failed`,description:`Unable to extract data for export`,type:`error`,duration:3e3});return}try{let n=Ee(e?.type??``,e?.params).replace(/\.csv$/,`.tsv`);Se(t,n),P.create({title:`Downloaded`,description:n,type:`success`,duration:3e3})}catch(e){console.error(`Failed to download TSV file:`,e),P.create({title:`Download failed`,description:`Failed to download TSV file`,type:`error`,duration:3e3})}},[a,e]);return{canExportCSV:n,copyAsCSV:o,copyAsTSV:c,downloadAsCSV:s,downloadAsExcel:I(async()=>{let t=r();if(!t){P.create({title:`Export failed`,description:`Unable to extract data for export`,type:`error`,duration:3e3});return}try{let n=await Ce(t.columns,t.rows),r=Ee(e?.type??``,e?.params).replace(/\.csv$/,`.xlsx`);Me(n,r),P.create({title:`Downloaded`,description:r,type:`success`,duration:3e3})}catch(e){console.error(`Failed to download Excel file:`,e),P.create({title:`Download failed`,description:`Failed to download Excel file`,type:`error`,duration:3e3})}},[r,e]),downloadAsTSV:l}}function $c({description:e,onLike:t,onDislike:n,onClickLink:r,externalLink:i,externalLinkText:a}){return U(W,{sx:{display:`flex`,gap:4,justifyContent:`center`,alignContent:`center`,alignItems:`center`},children:[e,H(J,{"aria-label":`thumbs up`,onClick:t,sx:{width:`32px`,height:`32px`},children:H(W,{component:`img`,src:`/imgs/feedback/thumbs-up.png`,alt:`like`})}),H(J,{"aria-label":`thumbs down`,onClick:n,sx:{width:`32px`,height:`32px`},children:H(W,{component:`img`,src:`/imgs/feedback/thumbs-down.png`,alt:`dislike`})}),i&&a&&U(pt,{href:i,target:`_blank`,onClick:r,sx:{textDecoration:`underline`},children:[a,` `,H(gt,{})]})]})}function el(e){let{feedbackId:t,description:n,onFeedbackSubmit:r,externalLink:i,externalLinkText:a}=e,[o,s]=B(void 0);function c(e=!1){let c=localStorage.getItem(t);o??(c===`true`&&!e||s(P.create({id:t,duration:void 0,type:`success`,description:H(K,{direction:`row`,children:H($c,{description:n,onLike:()=>{r(`like`),P.dismiss(t),localStorage.setItem(t,`true`)},onDislike:()=>{r(`dislike`),P.dismiss(t),localStorage.setItem(t,`true`)},externalLink:i,externalLinkText:a,onClickLink:()=>{r(`link`)}})})})))}return{feedbackToast:c,closeToast:()=>{o&&P.dismiss(o)}}}function tl(e){let[t,n]=B(void 0),{guideId:r,description:i,externalLinkText:a,onExternalLinkClick:o}=e;function s(){t??n(P.create({id:r,duration:3e3,type:`success`,description:i,action:{label:a??`link`,onClick:()=>{o&&o()}}}))}return{guideToast:s,closeGuideToast:()=>{t&&P.dismiss(t)}}}function nl(e){function t(e){return e?.columns?Object.values(e.columns).filter(e=>e!=null):[]}return rl(t(e.data.data.base),t(e.data.data.current))}function rl(e,t){let n=[];return e.forEach(e=>{n.some(t=>t.name===e.name)||n.push(e)}),t.forEach(e=>{n.some(t=>t.name===e.name)||n.push(e)}),n}function il(e,t){let{lineageGraph:n}=A(),r=te(),i=t??r?.apiClient,a=vn.find(n?.nodes,{data:{name:e}}),s=R(()=>a?nl(a):[],[a]),[c,l]=B([]),[u,d]=B(),[f,p]=B(!0),[m,h]=B(null),[g,_]=B([]),[v,y]=B(a?.id),b=a?a.data.data.current?.primary_key:void 0,x=I(async()=>{if(!(!a||!i))try{let e=(await o(a.id,i)).model;if(!e.base.columns||!e.current.columns){l([]);return}d(e.current.primary_key),l(rl(Object.values(e.base.columns),Object.values(e.current.columns)))}catch(e){h(e)}},[a,i]);return(s!==g||a?.id!==v)&&(_(s),y(a?.id),s.length>0?(l(s),d(b),p(!1)):a?.id===void 0&&(l([]),p(!1))),L(()=>{s.length===0&&a?.id!==void 0&&(x().catch(e=>{console.error(e)}),p(!1))},[x,a?.id,s]),{columns:c,primaryKey:u,isLoading:f,error:m}}const al=e=>{let{apiClient:t}=ca(),[n,i]=B(!!e),[a,o]=B(!1),[,s]=pe(),c=z(null);L(()=>{e&&(i(!0),c.current=null)},[e]);let{error:l,data:u}=et({queryKey:D.run(e??``),queryFn:async()=>await m(e??``,n?2:0,t),enabled:!!e,refetchInterval:n?50:!1,retry:!1});L(()=>{if(!u)return;let e=u.status?.toLowerCase();l||u.result||u.error||e&&e!==`running`?c.current!==u.run_id&&(c.current=u.run_id,i(!1)):e===`running`&&(c.current=null,i(!0))},[u,l]),L(()=>{(l||u?.result||u?.error)&&(u?.type===`row_count_diff`||u?.type===`row_count`)&&s?.()},[u,l,s]);let d=I(async()=>{o(!0),e&&await r(e,t)},[e,t]),f;return u&&E(u.type)&&(f=Us(u.type).RunResultView),{run:u,isRunning:n,aborting:a,error:l,onCancel:d,RunResultView:f}};function ol(){let e=bt(),t=xe(),n=N(),[r,i]=B(!1);L(()=>{i(!0)},[]);let a=r?t?t.resolvedMode===`dark`:n:!1;return{isDark:a,theme:e,background:{default:a?M.neutral[900]:M.white,paper:a?M.neutral[800]:M.white,subtle:a?M.neutral[800]:M.neutral[50],emphasized:a?M.neutral[700]:M.neutral[100]},text:{primary:a?M.neutral[50]:M.neutral[900],secondary:a?M.neutral[400]:M.neutral[600],disabled:a?M.neutral[500]:M.neutral[400],inverted:a?M.neutral[900]:M.neutral[50]},border:{light:a?M.neutral[700]:M.neutral[200],default:a?M.neutral[600]:M.neutral[300],strong:a?M.neutral[500]:M.neutral[400]},status:{added:{bg:a?M.green[900]:M.green[100],text:a?M.neutral[50]:M.neutral[900]},removed:{bg:a?M.red[950]:M.red[200],text:a?M.neutral[50]:M.neutral[900]},modified:{bg:a?M.yellow[900]:M.amber[100],text:a?M.neutral[50]:M.neutral[900]}},interactive:{hover:a?M.neutral[700]:M.neutral[100],active:a?M.neutral[600]:M.neutral[200],focus:M.iochmara[500]}}}const sl=nt.create({baseURL:We});async function cl(e=sl){return(await e.post(`/api/connect`)).data}function ll({handleParentClose:e,parentOpen:t=!1,ignoreCookie:n=!1,variant:r=`auth`}){let{authed:i}=me(),{apiClient:a}=ca(),[o,s]=B(t||!i),c=mt.get(`authState`)??`pending`,[l,u]=B(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 U(lt,{open:o,onClose:f,maxWidth:`sm`,fullWidth:!0,slotProps:{paper:{sx:{borderRadius:`1rem`}}},children:[l!==`authenticating`&&H(ft,{sx:{textAlign:`center`,fontSize:`1.5rem`},children:d.title}),l===`authenticating`?U(V,{children:[H(dt,{className:`space-y-2 self-center font-light`,children:U(K,{spacing:2,alignItems:`center`,sx:{pt:`1rem`},children:[H(W,{component:`img`,sx:{height:`6rem`,objectFit:`contain`,mx:`auto`,mb:1},src:`/imgs/reload-image.svg`,alt:`Reload`}),H(q,{sx:{fontSize:`1.5rem`,fontWeight:500},children:`Reload to Finish`}),H(q,{children:`Reload to complete connection to Recce Cloud`})]})}),H(ut,{sx:{px:3,pb:3},children:H(G,{fullWidth:!0,color:`brand`,variant:`contained`,onClick:()=>{window.location.reload()},children:`Reload`})})]}):U(V,{children:[U(dt,{className:`space-y-2 font-light`,children:[H(q,{children:`To enable sharing, get your token from Recce Cloud and launch your local instance with it.`}),U(`ul`,{className:`list-inside list-disc`,children:[H(`li`,{children:`Share your instance with teammates via Recce Cloud.`}),H(`li`,{children:`Your instance will be securely and freely hosted for sharing.`}),r===`auth`&&H(`li`,{children:`This step is recommended but optional.`})]}),U(W,{sx:{display:`flex`,gap:1},children:[`More directions`,U(pt,{underline:`always`,sx:{color:`primary.main`,"&:focus":{outline:`none`}},href:`https://cloud.datarecce.io/connect-to-cloud`,target:`_blank`,children:[`here `,H(gt,{style:{display:`inline`}})]})]})]}),U(ut,{sx:{flexDirection:`column`,gap:1,px:3,pb:3},children:[U(G,{fullWidth:!0,color:`brand`,variant:`contained`,sx:{borderRadius:2,fontWeight:500},onClick:async()=>{u(`authenticating`);let{connection_url:e}=await cl(a);window.open(e,`_blank`)},children:[d.action,` `,H(gt,{style:{marginLeft:4}})]}),H(G,{fullWidth:!0,color:`neutral`,variant:`text`,size:`small`,sx:{borderRadius:2,fontWeight:500},onClick:f,children:r===`auth`?`Skip`:`Cancel`}),r===`auth`&&H(G,{fullWidth:!0,variant:`text`,size:`small`,sx:{borderRadius:2,fontWeight:500,color:`text.primary`},onClick:()=>{mt.set(`authState`,`ignored`,{expires:30}),u(`ignored`),f()},children:`Snooze for 30 days`})]})]})]})}export{_s as $,Bi as $t,dc as A,Oa as At,Ws as B,da as Bt,Oc as C,Fr as Cn,eo as Ct,bc as D,za as Dt,xc as E,kr as En,Ua as Et,Qs as F,Sa as Ft,Is as G,ra as Gt,Hs as H,ca as Ht,Xs as I,xa as It,Os as J,Zi as Jt,Ps as K,ta as Kt,Js as L,wa as Lt,sc as M,ka as Mt,oc as N,Aa as Nt,_c as O,Ia as Ot,$s as P,Ta as Pt,vs as Q,Hi as Qt,Ks as R,Ca as Rt,Fc as S,Pr as Sn,to as St,Cc as T,Mr as Tn,Va as Tt,Vs as U,oa as Ut,Us as V,la as Vt,Ls as W,ia as Wt,Ss as X,Ki as Xt,Ds as Y,Ji as Yt,bs as Z,Wi as Zt,Bc as _,zr as _n,Co as _t,rl as a,_i as an,Ho as at,Ac as b,Ir as bn,lo as bt,el as c,di as cn,$ as ct,Yc as d,Jr as dn,Po as dt,Ii as en,hs as et,Gc as f,Zr as fn,Mo as ft,Hc as g,oi as gn,To as gt,Jc as h,ai as hn,Eo as ht,nl as i,vi as in,$o as it,cc as j,Ma as jt,uc as k,Pa as kt,Qc as l,ui as ln,Fo as lt,qc as m,Yr as mn,Do as mt,ol as n,ji as nn,Yo as nt,il as o,pi as on,Vo as ot,Kc as p,Xr as pn,jo as pt,ks as q,Qi as qt,al as r,Ti as rn,Qo as rt,tl as s,fi as sn,zo as st,ll as t,Pi as tn,ms as tt,Zc as u,li as un,Io as ut,Vc as v,Br as vn,yo as vt,wc as w,jr as wn,Ga as wt,kc as x,Rr as xn,oo as xt,Lc as y,qr as yn,so as yt,Gs as z,ba as zt};
|
|
7
|
-
//# sourceMappingURL=AuthModal-
|
|
6
|
+
`)?H(W,{component:`code`,sx:{bgcolor:n?`grey.800`:`grey.100`,color:n?`grey.200`:`inherit`,px:1,py:.5,borderRadius:.5,fontSize:`0.9em`,fontFamily:`monospace`},children:t}):H(W,{sx:{my:2,borderRadius:1,overflow:`hidden`,fontSize:`0.875rem`},children:H(lr,{style:ur,language:i,PreTag:`div`,customStyle:{margin:0,borderRadius:`6px`,fontSize:`0.85em`},children:a})})}function jo({content:e,fontSize:t=`0.875rem`,internalDomains:n=[]}){let r=N(),i=[window.location.hostname,`reccehq.com`,`datarecce.io`,`localhost`,...n];return H(W,{className:`markdown-content`,children:H(cr,{remarkPlugins:[dr],components:{a:({href:e,children:t})=>H(ko,{href:e,internalDomains:i,children:t}),code:e=>H(Ao,{...e,isDark:r}),p:({children:e})=>H(q,{component:`p`,sx:{fontSize:t,mb:2,"&:last-child":{mb:0}},children:e}),h1:({children:e})=>H(q,{sx:{fontSize:`1.25rem`,fontWeight:`bold`,mb:2,mt:3},children:e}),h2:({children:e})=>H(q,{sx:{fontSize:`1.125rem`,fontWeight:`bold`,mb:2,mt:3},children:e}),h3:({children:e})=>H(q,{sx:{fontSize:`1rem`,fontWeight:600,mb:2,mt:2},children:e}),ul:({children:e})=>H(W,{component:`ul`,sx:{pl:4,mb:2,listStyleType:`disc`},children:e}),ol:({children:e})=>H(W,{component:`ol`,sx:{pl:4,mb:2,listStyleType:`decimal`},children:e}),li:({children:e})=>H(W,{component:`li`,sx:{fontSize:t,mb:1},children:e}),blockquote:({children:e})=>H(W,{sx:{borderLeft:`3px solid`,borderLeftColor:r?`grey.600`:`grey.300`,pl:3,py:1,my:2,color:r?`grey.400`:`grey.600`,fontStyle:`italic`},children:e}),table:({children:e})=>H(W,{sx:{overflowX:`auto`,my:2},children:H(W,{component:`table`,sx:{width:`100%`,fontSize:t,border:`1px solid`,borderColor:r?`grey.700`:`grey.200`,borderRadius:1},children:e})}),thead:({children:e})=>H(W,{component:`thead`,sx:{bgcolor:r?`grey.800`:`grey.50`},children:e}),tbody:({children:e})=>H(W,{component:`tbody`,children:e}),tr:({children:e})=>H(W,{component:`tr`,sx:{borderBottom:`1px solid`,borderColor:r?`grey.700`:`grey.200`},children:e}),th:({children:e})=>H(W,{component:`th`,sx:{px:2,py:1,fontWeight:600,textAlign:`left`},children:e}),td:({children:e})=>H(W,{component:`td`,sx:{px:2,py:1},children:e}),hr:()=>H(W,{component:`hr`,sx:{my:3,borderColor:r?`grey.700`:`grey.200`}}),strong:({children:e})=>H(q,{component:`strong`,sx:{fontWeight:600},children:e}),em:({children:e})=>H(q,{component:`em`,sx:{fontStyle:`italic`},children:e}),del:({children:e})=>H(q,{component:`del`,sx:{textDecoration:`line-through`,color:`grey.500`},children:e})},children:e})})}const Mo=ot(function({backgroundColor:e=`white`,blockSize:t,children:n,...r},i){return H(W,{ref:i,...r,sx:{overflowY:`auto`,overflowX:`hidden`,...r.sx},children:H(W,{sx:{backgroundColor:e,height:`100%`,blockSize:t},children:n})})});function No({children:e,direction:t=`horizontal`,sizes:n,minSizes:r=0,maxSizes:i,gutterSize:a=5,snapOffset:o=30,dragInterval:s=1,onDragEnd:c,onDrag:l,theme:u,style:d,className:f}){let p=N(),m=u?u===`dark`:p,h={display:`flex`,flexDirection:t===`horizontal`?`row`:`column`,height:`100%`,width:`100%`,...d};return H(W,{className:f,sx:{height:`100%`,width:`100%`,"& .gutter":{backgroundColor:`divider`,backgroundRepeat:`no-repeat`,backgroundPosition:`50%`,transition:`background-color 0.15s ease`,"&:hover":{backgroundColor:m?`grey.600`:`grey.300`}},"& .gutter.gutter-horizontal":{cursor:`col-resize`},"& .gutter.gutter-vertical":{cursor:`row-resize`}},children:H(fr,{style:h,direction:t,sizes:n,minSize:r,maxSize:i,gutterSize:a,snapOffset:o,dragInterval:s,onDragEnd:c,onDrag:l,children:e})})}const Po=F(No);Po.displayName=`SplitPane`;function Fo(e){let{style:t,children:n,gutterSize:r=5,minSize:i,maxSize:a,sizes:o,snapOffset:s,dragInterval:c,onDragEnd:l,onDrag:u,className:d}=e;return H(Po,{direction:`horizontal`,gutterSize:r,minSizes:i,maxSizes:a,sizes:o,snapOffset:typeof s==`number`?s:void 0,dragInterval:c,onDragEnd:l,onDrag:u,style:t,className:d,children:n})}function Io(e){let{style:t,children:n,gutterSize:r=5,minSize:i,maxSize:a,sizes:o,snapOffset:s,dragInterval:c,onDragEnd:l,onDrag:u,className:d}=e;return H(Po,{direction:`vertical`,gutterSize:r,minSizes:i,maxSizes:a,sizes:o,snapOffset:typeof s==`number`?s:void 0,dragInterval:c,onDragEnd:l,onDrag:u,style:t,className:d,children:n})}function Lo({warning:e,isDark:t}){return U(W,{sx:{display:`flex`,alignItems:`center`,gap:.5,fontSize:`0.75rem`},children:[H(Jt,{color:t?pr[400]:pr[600]}),H(W,{children:e})]})}function Ro({toolbar:e,warnings:t,warningStyle:n=`alert`,isDark:r}){return!e&&(!t||t.length===0)?null:U(W,{sx:{display:`flex`,alignItems:`center`,gap:1,px:1,py:.5,borderBottom:1,borderColor:`divider`,bgcolor:n===`amber`&&t&&t.length>0?r?pr[900]:pr[100]:r?`grey.900`:`grey.50`,color:n===`amber`&&t&&t.length>0?r?pr[200]:pr[800]:void 0},children:[n===`amber`?t?.map(e=>H(Lo,{warning:e,isDark:r},e)):t?.map(e=>H(hn,{severity:`warning`,sx:{py:0,fontSize:`0.75rem`},children:e},e)),H(W,{sx:{flex:1}}),e]})}function $(e){let{displayName:t,typeGuard:n,expectedRunType:r,screenshotWrapper:i,transformData:a,emptyState:o=`No data`,conditionalEmptyState:s}=e;function c({run:e,viewOptions:t,onViewOptionsChanged:c,onAddToChecklist:l},u){let d=N();if(!n(e))throw Error(`Run type must be ${r}`);let f=R(()=>a(e,{viewOptions:t,onViewOptionsChanged:c,onAddToChecklist:l}),[e,t,c,l]),p=s?.(e,t);return p==null?f?.renderNull?null:!f||f.isEmpty?f?.toolbar||f?.warnings&&f.warnings.length>0?U(W,{sx:{display:`flex`,flexDirection:`column`,bgcolor:d?`grey.900`:`grey.50`,height:`100%`},children:[H(Ro,{toolbar:f?.toolbar,warnings:f?.warnings,warningStyle:f?.warningStyle,isDark:d}),H(W,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,flex:1},children:f?.emptyMessage??o})]}):H(W,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,bgcolor:d?`grey.900`:`grey.50`,height:`100%`},children:o}):i===`grid`?U(W,{sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:[f.header,H(Ro,{toolbar:f.toolbar,warnings:f.warnings,warningStyle:f.warningStyle,isDark:d}),H(lo,{ref:u,style:{blockSize:`auto`,maxHeight:`100%`,overflow:`auto`,fontSize:`0.875rem`,borderWidth:1},columns:f.columns??[],rows:f.rows??[],renderers:{noRowsFallback:H(so,{emptyMessage:f.noRowsMessage})},defaultColumnOptions:f.defaultColumnOptions}),f.footer]}):U(W,{sx:{display:`flex`,flexDirection:`column`,height:`100%`},children:[f.header,H(Ro,{toolbar:f.toolbar,warnings:f.warnings,warningStyle:f.warningStyle,isDark:d}),H(Mo,{ref:u,height:`100%`,backgroundColor:d?`#1f2937`:`white`,children:f.content}),f.footer]}):H(W,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,bgcolor:d?`grey.900`:`grey.50`,height:`100%`},children:p})}return c.displayName=t,ot(c)}const zo=`0.1.0`;function Bo(e){return x(e)}const Vo=$({displayName:`HistogramDiffResultView`,typeGuard:Bo,expectedRunType:`histogram_diff`,screenshotWrapper:`box`,conditionalEmptyState:e=>{let t=e.result?.base,n=e.result?.current;return!t||!n?H(`div`,{children:`Loading...`}):null},transformData:e=>{let t=e.params,n=e.result?.base,r=e.result?.current,i=e.result?.min,a=e.result?.max,o=e.result?.bin_edges??[];if(!n||!r)return{isEmpty:!0};let s=e.params?.column_type??`numeric`,c=s===`datetime`?`datetime`:s===`string`?`string`:`numeric`;return{content:U(W,{sx:{display:`flex`,flexDirection:`row`},children:[H(W,{sx:{flex:1}}),H(W,{sx:{width:`80%`,height:`35vh`,m:4},children:H(oo,{title:`Model ${t.model}.${t.column_name}`,dataType:c,baseData:{counts:n.counts},currentData:{counts:r.counts},min:i,max:a,samples:n.total,binEdges:o})}),H(W,{sx:{flex:1}})]})}}});function Ho({model:e,row:t,singleEnv:n,cllRunning:r,showMenu:i=!0}){let a=ce(),{isActionAvailable:o}=A(),{runAction:s}=j(),{featureToggles:c}=me(),{name:l,baseType:u,currentType:d,baseIndex:f,currentIndex:p}=t,m=d??u,[h,g]=B(null),_=!!h,v=e=>{e.stopPropagation(),g(e.currentTarget)},y=()=>{g(null)},b=()=>{s(`profile_diff`,{model:e.name,columns:[l]},{showForm:!1,trackProps:{action:`profile_diff`,source:`schema_column_menu`,node_count:1}})},x=()=>{s(`histogram_diff`,{model:e.name,column_name:l,column_type:m},{showForm:!1,trackProps:{action:`histogram_diff`,source:`schema_column_menu`,node_count:1}})},S=()=>{s(`top_k_diff`,{model:e.name,column_name:l,k:50},{showForm:!1,trackProps:{action:`top_k_diff`,source:`schema_column_menu`,node_count:1}})},C=()=>{s(`value_diff`,{model:e.name,columns:[l]},{showForm:!0,trackProps:{action:`value_diff`,source:`schema_column_menu`,node_count:1}})},w=!u||!d;return H(Y,{title:`View column lineage`,placement:`top`,disableHoverListener:a===void 0||!o(`change_analysis`)||f!==void 0&&p===void 0,children:U(W,{sx:{display:`flex`,alignItems:`center`,gap:`3px`},children:[H(W,{sx:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:l}),H(W,{sx:{flex:1}}),r&&H(Dt,{size:12,color:`inherit`}),i&&!n&&e.resource_type!==`source`&&U(V,{children:[H(J,{"aria-label":`Column options`,className:`row-context-menu`,size:`small`,disabled:c.disableDatabaseQuery,onClick:v,children:H(yn,{})}),U(_n,{anchorEl:h,open:_,onClose:y,slotProps:{list:{sx:{lineHeight:`20px`}}},children:[H(xn,{sx:{m:0,p:`4px 12px`,lineHeight:`20px`},children:`Diff`}),H(X,{onClick:()=>{b(),y()},disabled:w,sx:{fontSize:`0.85rem`},children:`Profile Diff`}),H(X,{onClick:()=>{x(),y()},disabled:w||(m?!_i(m):!0),sx:{fontSize:`0.85rem`},children:`Histogram Diff`}),H(X,{onClick:()=>{S(),y()},disabled:w,sx:{fontSize:`0.85rem`},children:`Top-k Diff`}),H(X,{onClick:()=>{C(),y()},disabled:w,sx:{fontSize:`0.85rem`},children:`Value Diff`})]})]})]})})}function Uo(e,t,n){return r=>{let i=r.data;return i?H(Ho,{model:e,row:i,cllRunning:t?.get(i.name)??!1,showMenu:n}):null}}function Wo(e,t,n){return r=>{let i=r.data;return i?H(Ho,{model:e,row:i,cllRunning:t?.get(i.name)??!1,singleEnv:!0,showMenu:n}):null}}function Go(e){if(!e.data)return null;let{baseIndex:t,currentIndex:n}=e.data;return H(`span`,{children:n===void 0?t===void 0?`-`:t:n===void 0?`-`:n})}const Ko=rt.memo(Go);Ko.displayName=`MemoizedRenderIndexCell`;function qo(e){if(!e.data)return null;let{baseType:t,currentType:n,baseIndex:r,currentIndex:i}=e.data,a=r===void 0,o=i===void 0;return!a&&!o&&t!==n?U(`span`,{children:[H(`span`,{className:`type-badge type-badge-removed`,title:`Base type: ${t}`,children:t}),H(`span`,{className:`type-badge type-badge-added`,title:`Current type: ${n}`,children:n})]}):H(`span`,{children:o?t:n})}const Jo=rt.memo(qo);Jo.displayName=`MemoizedRenderTypeCell`;function Yo(e={},t={}){let n={},r=we(Object.keys(e),Object.keys(t));Object.entries(r).forEach(([e,t])=>{n[e]={name:e,reordered:t===`reordered`,__status:void 0}});let i=0;return Object.entries(e).forEach(([e,t])=>{t!=null&&(n[e].baseIndex=i+=1,n[e].baseType=t.type)}),i=0,Object.entries(t).forEach(([e,t])=>{t!=null&&(n[e].currentIndex=i+=1,n[e].currentType=t.type)}),n}function Xo(e){let t=e.data;return t?.baseIndex!==void 0&&t?.currentIndex!==void 0&&t?.reordered===!0?`column-index-reordered schema-column schema-column-index`:`schema-column schema-column-index`}function Zo(){return`schema-column`}function Qo(e,t={}){let{node:n,cllRunningMap:r,showMenu:i}=t;return{columns:[{field:`index`,headerName:``,resizable:!0,minWidth:35,width:35,cellRenderer:Go,cellClass:Xo},{field:`name`,headerName:`Name`,resizable:!0,cellRenderer:n?Uo(n,r,i):void 0,cellClass:Zo},{field:`type`,headerName:`Type`,resizable:!0,cellRenderer:qo,cellClass:Zo}],rows:Object.values(e)}}function $o(e={},t={}){let{node:n,cllRunningMap:r,showMenu:i}=t,a=Object.entries(e).filter(([e,t])=>t!=null).map(([e,t],n)=>({name:e,index:n+1,type:t.type,__status:void 0}));return{columns:[{field:`index`,headerName:``,resizable:!0,minWidth:35,width:35,cellClass:`schema-column schema-column-index`},{field:`name`,headerName:`Name`,resizable:!0,cellRenderer:n?Wo(n,r,i):void 0,cellClass:`schema-column`},{field:`type`,headerName:`Type`,resizable:!0,cellClass:`schema-column`}],rows:a}}function es({columnName:e,primaryKeys:t}){return H(W,{sx:{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100%`},children:t.includes(e)&&H(bn,{})})}function ts({params:e,column:t}){let{runAction:n}=j(),{featureToggles:r}=me(),[i,a]=B(null),o=!!i,s=e=>{a(e.currentTarget)},c=()=>{a(null)},l=(t,r)=>{n(`value_diff_detail`,{...e,...t},r)};return U(W,{sx:{display:`flex`},children:[H(W,{sx:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t}),H(W,{sx:{flex:1}}),H(J,{"aria-label":`Column options`,className:`row-context-menu`,size:`small`,disabled:r.disableDatabaseQuery,onClick:s,children:H(Rt,{})}),U(_n,{anchorEl:i,open:o,onClose:c,slotProps:{list:{sx:{lineHeight:`20px`}}},children:[H(xn,{sx:{fontSize:`8pt`,lineHeight:`20px`},children:`Action`}),H(X,{onClick:()=>{l({},{showForm:!0}),c()},sx:{fontSize:`10pt`},children:`Show mismatched values...`}),U(X,{onClick:()=>{l({columns:[t]},{showForm:!1}),c()},sx:{fontSize:`10pt`},children:[`Show mismatched values for '`,t,`'`]})]})]})}function ns({value:e}){let t=`N/A`;return e!=null&&(t=e>.9999&&e<1?`~99.99 %`:e<1e-4&&e>0?`~0.01 %`:`${(e*100).toFixed(2)} %`),H(W,{sx:{textAlign:`right`},children:t})}function rs(e){return t=>{let n=t.data;return n?H(es,{columnName:String(n[0]),primaryKeys:e}):null}}function is(e){return t=>{let n=t.data,r=t.colDef?.field??``;return n?H(ts,{column:String(n[r]),params:e}):null}}function as(e){let t=e.data,n=e.colDef?.field??``;return t?H(ns,{value:t[n]}):null}const os=[{key:`0`,name:`Column`,type:`text`},{key:`1`,name:`Matched`,type:`number`},{key:`2`,name:`Matched %`,type:`number`}];function ss(e){let t=e.data;if(!t)return;let n=t[2];return n!=null&&n<1?`diff-cell-modified`:void 0}function cs(e,t){let n=e==null,r=t==null;return n&&r?0:n?1:r?-1:e-t}const ls={PRIMARY_KEY_INDICATOR:`__is_pk__`,COLUMN_NAME:`0`,MATCHED_COUNT:`1`,MATCHED_PERCENT:`2`};function us(e,t){return[{field:ls.PRIMARY_KEY_INDICATOR,headerName:``,width:30,maxWidth:30,sortable:!1,cellRenderer:rs(e)},{field:ls.COLUMN_NAME,headerName:`Column`,resizable:!0,cellRenderer:is(t),cellClass:`cell-show-context-menu`},{field:ls.MATCHED_COUNT,headerName:`Matched`,resizable:!0,cellClass:ss},{field:ls.MATCHED_PERCENT,headerName:`Matched %`,resizable:!0,sort:`asc`,comparator:cs,cellRenderer:as,cellClass:ss}]}function ds(e,t){let{params:n}=t,r=Array.isArray(n.primary_key)?n.primary_key:[n.primary_key],i={...e.data,columns:os};return{columns:us(r,n),rows:Fe(i)}}function fs(e){if(p(e)||S(e))return e.result?{kind:`query`,result:e.result}:null;if(w(e))return e.result?e.result.diff&&e.params?.primary_keys?{kind:`query_diff_joined`,result:e.result,primaryKeys:e.params.primary_keys}:{kind:`query_diff_separate`,result:e.result}:null;if(d(e))return!e.result||!e.params?null:{kind:`value_diff`,result:e.result,params:e.params};if(g(e)){if(!e.result||!e.params?.primary_key)return null;let t=e.params.primary_key,n=Array.isArray(t)?t:[t];return{kind:`value_diff_detail`,result:e.result,primaryKeys:n}}return f(e)?e.result?.current?{kind:`profile`,result:e.result}:null:v(e)?e.result?{kind:`profile_diff`,result:e.result}:null:T(e)?e.result?{kind:`row_count`,result:e.result}:null:y(e)&&e.result?{kind:`row_count_diff`,result:e.result}:null}function ps(e){return e.current?.columns.find(e=>e.name.toLowerCase()===`column_name`)?.name??`column_name`}function ms(e,t={}){let n=fs(e);if(!n)return null;switch(n.kind){case`query`:return Oe(n.result,{primaryKeys:t.primaryKeys,pinnedColumns:t.pinnedColumns,columnsRenderMode:t.columnsRenderMode,onPrimaryKeyChange:t.onPrimaryKeyChange,onPinnedColumnsChange:t.onPinnedColumnsChange,onColumnsRenderModeChanged:t.onColumnsRenderModeChanged});case`query_diff_separate`:return Be(n.result.base,n.result.current,t);case`query_diff_joined`:return n.result.diff?Te(n.result.diff,n.primaryKeys,{changedOnly:t.changedOnly,pinnedColumns:t.pinnedColumns,onPinnedColumnsChange:t.onPinnedColumnsChange,baseTitle:t.baseTitle,currentTitle:t.currentTitle,displayMode:t.displayMode,columnsRenderMode:t.columnsRenderMode,onColumnsRenderModeChanged:t.onColumnsRenderModeChanged}):null;case`value_diff`:return ds(n.result,{params:n.params});case`value_diff_detail`:return Te(n.result,n.primaryKeys,{changedOnly:t.changedOnly,pinnedColumns:t.pinnedColumns,onPinnedColumnsChange:t.onPinnedColumnsChange,displayMode:t.displayMode,columnsRenderMode:t.columnsRenderMode,onColumnsRenderModeChanged:t.onColumnsRenderModeChanged});case`profile`:{if(!n.result.current)return null;let e=ps(n.result);return Oe(n.result.current,{primaryKeys:[e],pinnedColumns:t.pinnedColumns,onPinnedColumnsChange:t.onPinnedColumnsChange,columnsRenderMode:t.columnsRenderMode,onColumnsRenderModeChanged:t.onColumnsRenderModeChanged})}case`profile_diff`:{let e=ps(n.result);return Be(n.result.base,n.result.current,{primaryKeys:[e],pinnedColumns:t.pinnedColumns,onPinnedColumnsChange:t.onPinnedColumnsChange,displayMode:t.displayMode,columnsRenderMode:t.columnsRenderMode,onColumnsRenderModeChanged:t.onColumnsRenderModeChanged})}case`row_count`:return Pe(n.result);case`row_count_diff`:return ke(n.result);default:return null}}function hs(e,t){switch(e.type){case`single`:return Oe(e.dataframe,t??{});case`dual`:return Be(e.base,e.current,t??{});case`joined`:return Te(e.dataframe,e.primaryKeys,t??{});case`schema_diff`:return Qo(Yo(e.base,e.current),t??{});case`schema_single`:return $o(e.columns,t??{})}}function gs({params:e,onParamsChanged:t,setIsReadyToExecute:n}){let[r,i]=B(!e.columns||e.columns.length===0),a=e.model,{columns:o,isLoading:s,error:c}=al(e.model);L(()=>{n(!!a)},[a,n]);let l=o.map(e=>e.name);return s?H(W,{children:`Loading...`}):l.length===0||c?H(W,{children:`Error: Please provide the 'catalog.json' to list column candidates`}):U(K,{spacing:5,sx:{m:`8px 24px`,pb:`200px`},children:[U(W,{children:[H(q,{variant:`body2`,sx:{mb:1},children:`Model`}),H(Tn,{fullWidth:!0,size:`small`,value:e.model,slotProps:{input:{readOnly:!0}}})]}),U(W,{children:[H(q,{variant:`body2`,sx:{mb:1},children:`Columns`}),H(fn,{control:H(dn,{checked:r,onChange:n=>{i(n.target.checked),t({...e,columns:void 0})},size:`small`}),label:`All columns`,sx:{mb:`10px`}}),!r&&H(Tr,{multiple:!0,size:`small`,disableCloseOnSelect:!0,options:l,value:e.columns??[],onChange:(n,r)=>{t({...e,columns:r.length===0?void 0:r})},renderInput:t=>H(Tn,{...t,placeholder:(e.columns??[]).length===0?`Select columns`:``,className:`no-track-pii-safe`})})]})]})}const _s=e=>typeof e==`object`&&!!e&&`type`in e&&v(e),vs=$({displayName:`ProfileResultView`,typeGuard:e=>typeof e==`object`&&!!e&&`type`in e&&f(e),expectedRunType:`profile`,screenshotWrapper:`grid`,transformData:(e,{viewOptions:t,onViewOptionsChanged:n})=>{let r=ms(e,{pinnedColumns:t?.pinned_columns??[],onPinnedColumnsChange:e=>{n&&n({...t,pinned_columns:e})},columnsRenderMode:{distinct_proportion:`percent`,not_null_proportion:`percent`,...t?.columnsRenderMode},onColumnsRenderModeChanged:e=>{let r={...t?.columnsRenderMode??{},...e};n&&n({...t,columnsRenderMode:r})}})??{columns:[],rows:[]};return{columns:r.columns,rows:r.rows,isEmpty:r.columns.length===0}}}),ys=$({displayName:`ProfileDiffResultView`,typeGuard:_s,expectedRunType:`profile_diff`,screenshotWrapper:`grid`,transformData:(e,{viewOptions:t,onViewOptionsChanged:n})=>{let r=t?.pinned_columns??[],i=t?.display_mode??`inline`,a=ms(e,{pinnedColumns:r,onPinnedColumnsChange:e=>{n&&n({...t,pinned_columns:e})},displayMode:i,columnsRenderMode:{distinct_proportion:`percent`,not_null_proportion:`percent`,...t?.columnsRenderMode},onColumnsRenderModeChanged:e=>{let r={...t?.columnsRenderMode??{},...e};n&&n({...t,columnsRenderMode:r})}})??{columns:[],rows:[]},o=H(Ga,{children:H(fi,{displayMode:i,onDisplayModeChanged:e=>{n&&n({...t,display_mode:e})}})});return{columns:a.columns,rows:a.rows,header:o,isEmpty:a.columns.length===0}}});function bs(e){return w(e)}const xs=$({displayName:`QueryDiffResultView`,typeGuard:bs,expectedRunType:`query_diff`,screenshotWrapper:`grid`,emptyState:`No data`,transformData:(e,{viewOptions:t,onViewOptionsChanged:n})=>{let r=e.result&&`diff`in e.result&&e.result.diff!=null,i,a;e.params&&e.params.current_model&&(i=`Original`,a=`Editor`);let o=t?.changed_only??!1,s=t?.pinned_columns??[],c=t?.display_mode??`inline`,l=t?.columnsRenderMode??{},u=r?[]:t?.primary_keys??[],d=e=>{let r={...t?.columnsRenderMode??{},...e};n&&n({...t,columnsRenderMode:r})},f=r?void 0:e=>{n&&n({...t,primary_keys:e})},p=e=>{n&&n({...t,pinned_columns:e})},m;if(r&&e.result?.diff){let t=e.params?.primary_keys??[];m=Te(e.result.diff,t,{changedOnly:o,pinnedColumns:s,onPinnedColumnsChange:p,columnsRenderMode:l,onColumnsRenderModeChanged:d,baseTitle:i,currentTitle:a,displayMode:c})}else m=Be(e.result?.base,e.result?.current,{changedOnly:o,pinnedColumns:s,onPinnedColumnsChange:p,columnsRenderMode:l,onColumnsRenderModeChanged:d,baseTitle:i,currentTitle:a,displayMode:c,primaryKeys:u,onPrimaryKeyChange:f});let h=[];if(!r&&u.length>0){let e=u.join(`, `);m.invalidPKeyBase&&m.invalidPKeyCurrent?h.push(`Warning: The primary key '${e}' is not unique in the base and current environments`):m.invalidPKeyBase?h.push(`Warning: The primary key '${e}' is not unique in the base environment`):m.invalidPKeyCurrent&&h.push(`Warning: The primary key '${e}' is not unique in the current environment`)}let g=r?e.result?.diff?.limit??0:e.result?.current?.limit??0,_=r?e.result?.diff?.more:e.result?.current?.more||e.result?.base?.more;if(g>0&&_&&h.push(`Warning: Displayed results are limited to ${g.toLocaleString()} records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set.`),m.columns.length===0)return{isEmpty:!0};let v=U(V,{children:[H(fi,{displayMode:c,onDisplayModeChanged:e=>{n&&n({...t,display_mode:e})}}),H(ui,{changedOnly:t?.changed_only,onChange:()=>{let e=!t?.changed_only;n&&n({...t,changed_only:e})}})]});return r&&o&&m.rows.length===0?{isEmpty:!0,emptyMessage:`No change`,toolbar:v,warnings:h.length>0?h:void 0}:{columns:m.columns,rows:m.rows,warnings:h.length>0?h:void 0,toolbar:v,defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},noRowsMessage:`No mismatched rows`}}});function Ss(e){return p(e)||S(e)}const Cs=$({displayName:`QueryResultView`,typeGuard:Ss,expectedRunType:`query`,screenshotWrapper:`grid`,emptyState:`No data`,transformData:(e,{viewOptions:t,onViewOptionsChanged:n,onAddToChecklist:r})=>{let i=t?.pinned_columns??[],a=t?.columnsRenderMode??{},o=e=>{let r={...t?.columnsRenderMode??{},...e};n&&n({...t,columnsRenderMode:r})},s=e=>{n&&n({...t,pinned_columns:e})};if(!e.result)return{isEmpty:!0};let c=Oe(e.result,{pinnedColumns:i,onPinnedColumnsChange:s,columnsRenderMode:a,onColumnsRenderModeChanged:o});if(c.columns.length===0)return{isEmpty:!0};let l=e.result,u=l?l.limit??0:0,d=[];u>0&&l?.more&&d.push(`Warning: Displayed results are limited to ${u.toLocaleString()} records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set.`);let f=r?H(G,{sx:{my:`5px`},size:`small`,color:`iochmara`,variant:`contained`,onClick:()=>{r(e)},children:`Add to Checklist`}):void 0;return{columns:c.columns,rows:c.rows,warnings:d.length>0?d:void 0,warningStyle:`amber`,toolbar:f,defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35}}}});function ws(e){return T(e)}function Ts(e){return y(e)}function Es(e){if(!e.result)return null;let t=Pe(e.result);return{columns:t.columns,rows:t.rows,isEmpty:t.rows.length===0}}function Ds(e){if(!e.result)return null;let t=ke(e.result);return{columns:t.columns,rows:t.rows,isEmpty:t.rows.length===0}}const Os=$({displayName:`RowCountResultView`,typeGuard:ws,expectedRunType:`row_count`,screenshotWrapper:`grid`,transformData:Es,emptyState:`No nodes matched`}),ks=$({displayName:`RowCountDiffResultView`,typeGuard:Ts,expectedRunType:`row_count_diff`,screenshotWrapper:`grid`,transformData:Ds,emptyState:`No nodes matched`});function As({params:e,onParamsChanged:t,setIsReadyToExecute:n}){let{columns:r,isLoading:i,error:a}=al(e.model),o=r.map(e=>e.name);return L(()=>{n(!!e.column_name)},[e,n]),i?H(W,{children:`Loading...`}):o.length===0||a?H(W,{children:`Error: Please provide the 'catalog.json' to list column candidates`}):H(W,{sx:{m:`16px`},children:U(Sn,{fullWidth:!0,children:[H(Cn,{sx:{mb:1},children:`Pick a column to show top-k`}),U(wn,{value:e.column_name,onChange:n=>{let r=n.target.value;t({...e,column_name:r})},children:[H(`option`,{value:``,children:`Select column`}),o.map(e=>H(`option`,{value:e,className:`no-track-pii-safe`,children:e},e))]})]})})}function js(e){return b(e)}function Ms({model:e,columnName:t}){return U(q,{variant:`h5`,sx:{pt:4,textAlign:`center`,color:N()?`grey.200`:`grey.600`},children:[`Model `,e,`.`,t]})}function Ns({showAll:e,onToggle:t}){return H(W,{sx:{display:`flex`,p:5,justifyContent:`start`},children:H(pt,{component:`button`,onClick:t,sx:{color:`iochmara.main`,cursor:`pointer`},children:e?`View Only Top-10`:`View More Items`})})}function Ps(e,{viewOptions:t,onViewOptionsChanged:n}){let r=e.result,i=e.params;if(!r)return{isEmpty:!0};let a=r.base,o=r.current,s=t?.show_all??!1,c=!s,l=a.values.length>10||o.values.length>10?H(Ns,{showAll:s,onToggle:()=>{n&&n({...t,show_all:!s})}}):void 0;return{content:U(V,{children:[H(Ms,{model:i.model,columnName:i.column_name}),U(K,{direction:`row`,alignItems:`center`,children:[H(W,{sx:{flex:1}}),H(yo,{baseData:a,currentData:o,showComparison:!0,maxItems:c?10:void 0}),H(W,{sx:{flex:1}})]})]}),footer:l}}const Fs=$({displayName:`TopKDiffResultView`,typeGuard:js,expectedRunType:`top_k_diff`,screenshotWrapper:`box`,emptyState:`No data`,transformData:Ps});function Is(e){return g(e)}const Ls=$({displayName:`ValueDiffDetailResultView`,typeGuard:Is,expectedRunType:`value_diff_detail`,screenshotWrapper:`grid`,emptyState:`No data`,transformData:(e,{viewOptions:t,onViewOptionsChanged:n})=>{let r=t?.changed_only??!1,i=t?.pinned_columns??[],a=t?.display_mode??`inline`,o=t?.columnsRenderMode??{},s=e.params?.primary_key;if(!s||!e.result)return{isEmpty:!0};let c=Array.isArray(s)?s:[s],l=Te(e.result,c,{changedOnly:r,pinnedColumns:i,onPinnedColumnsChange:e=>{n&&n({...t,pinned_columns:e})},columnsRenderMode:o,onColumnsRenderModeChanged:e=>{let r={...t?.columnsRenderMode??{},...e};n&&n({...t,columnsRenderMode:r})},displayMode:a});if(l.columns.length===0)return{isEmpty:!0};let u=e.result?.limit??0,d=[];u>0&&e.result?.more&&d.push(`Warning: Displayed results are limited to ${u.toLocaleString()} records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set.`);let f=U(V,{children:[H(fi,{displayMode:a,onDisplayModeChanged:e=>{n&&n({...t,display_mode:e})}}),H(ui,{changedOnly:t?.changed_only,onChange:()=>{let e=!t?.changed_only;n&&n({...t,changed_only:e})}})]});return r&&l.rows.length===0?{isEmpty:!0,emptyMessage:`No change`,toolbar:f,warnings:d.length>0?d:void 0,warningStyle:`amber`}:{columns:l.columns,rows:l.rows,warnings:d.length>0?d:void 0,warningStyle:`amber`,toolbar:f,defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},noRowsMessage:`No mismatched rows`}}});function Rs({params:e,onParamsChanged:t,setIsReadyToExecute:n}){let[r,i]=B(!e.columns||e.columns.length===0),a=e.model,o=e.primary_key,{columns:s,primaryKey:c,isLoading:l,error:u}=al(e.model);L(()=>{!o&&c&&t({...e,primary_key:c})},[o,c,e,t]),L(()=>{n(!!(o&&a))},[o,a,n]);let d=s.map(e=>e.name),f=Array.isArray(o)?o:o?[o]:void 0;return l?H(W,{children:`Loading...`}):d.length===0||u?H(W,{children:`Error: Please provide the 'catalog.json' to list column candidates`}):U(K,{spacing:5,sx:{m:`8px 24px`,pb:`200px`},children:[U(W,{children:[H(q,{variant:`body2`,sx:{mb:1},children:`Model`}),H(Tn,{fullWidth:!0,size:`small`,value:e.model,slotProps:{input:{readOnly:!0}}})]}),U(W,{children:[H(q,{variant:`body2`,sx:{mb:1},children:`Primary key`}),H(Tr,{multiple:!0,size:`small`,disableCloseOnSelect:!0,options:d,value:(f??[]).filter(e=>e!==void 0),onChange:(n,r)=>{t({...e,primary_key:r.length===1?r[0]:r})},renderInput:e=>H(Tn,{...e,placeholder:(f??[]).length===0?`Select primary key`:``,className:`no-track-pii-safe`})})]}),U(W,{children:[H(q,{variant:`body2`,sx:{mb:1},children:`Columns`}),H(fn,{control:H(dn,{checked:r,onChange:n=>{i(n.target.checked),t({...e,columns:void 0})},size:`small`}),label:`All columns`,sx:{mb:`10px`}}),!r&&H(Tr,{multiple:!0,size:`small`,disableCloseOnSelect:!0,options:d,value:e.columns??[],onChange:(n,r)=>{t({...e,columns:r.length===0?void 0:r})},renderInput:t=>H(Tn,{...t,placeholder:(e.columns??[]).length===0?`Select columns`:``,className:`no-track-pii-safe`})})]})]})}function zs(e){return d(e)}function Bs({params:e,summary:t}){let n=t.total-t.added-t.removed;return U(W,{sx:{px:`16px`,pt:`5px`,pb:`5px`},children:[`Model: `,e.model,`, `,t.total,` total (`,n,` common,`,` `,t.added,` added, `,t.removed,` removed)`]})}function Vs(e){if(!e.result||!e.params)return{renderNull:!0};let t=ds(e.result,{params:e.params});return t?{columns:t.columns,rows:t.rows,isEmpty:!1,header:H(Bs,{params:e.params,summary:e.result.summary})}:{renderNull:!0}}const Hs=$({displayName:`ValueDiffResultView`,typeGuard:zs,expectedRunType:`value_diff`,screenshotWrapper:`grid`,transformData:Vs}),Us={lineage_diff:{title:`Lineage Diff`,icon:yr},schema_diff:{title:`Schema Diff`,icon:_r},query:{title:`Query`,icon:wr,RunResultView:Cs},query_base:{title:`Query Base`,icon:wr,RunResultView:Cs},query_diff:{title:`Query Diff`,icon:wr,RunResultView:xs},row_count:{title:`Row Count`,icon:gr,RunResultView:Os},row_count_diff:{title:`Row Count Diff`,icon:gr,RunResultView:ks},profile:{title:`Profile`,icon:Cr,RunResultView:vs,RunForm:gs},profile_diff:{title:`Profile Diff`,icon:Cr,RunResultView:ys,RunForm:gs},value_diff:{title:`Value Diff`,icon:vr,RunResultView:Hs,RunForm:Rs},value_diff_detail:{title:`Value Diff Detail`,icon:vr,RunResultView:Ls,RunForm:Rs},top_k_diff:{title:`Top-K Diff`,icon:ht,RunResultView:Fs,RunForm:As},histogram_diff:{title:`Histogram Diff`,icon:br,RunResultView:Vo,RunForm:vi},sandbox:{title:`Sandbox`,icon:Sr},simple:{title:`Simple`,icon:Sr}};function Ws(e){return Us[e]}const Gs=Us;function Ks(e){let t={...Us};for(let[n,r]of Object.entries(e))r&&n in t&&(t[n]={...t[n],...r});return t}function qs(e){return t=>e[t]}function Js(e){return{id:e.run_id,name:e.name,type:e.type,status:e.status??`Finished`,runAt:e.run_at,checkId:e.check_id}}function Ys(){let{closeHistory:e,showRunId:t,runId:n}=j(),{featureToggles:r}=me(),{apiClient:i}=ca(),a=hr(),o=tt(),{basePath:c}=se(),{data:u,isLoading:d}=et({queryKey:D.runs(),queryFn:async()=>await l(i),retry:!1}),f=R(()=>(u??[]).map(Js),[u]),p=I(e=>{Je({name:`click_run`}),t(e,!1)},[t]),m=I(async e=>{Je({name:`add_to_checklist`});let t=await s(e,void 0,i);await o.invalidateQueries({queryKey:D.checks()}),a.push(`${c}/checks/?id=${t.check_id}`)},[i,o,a.push,c]),h=I(e=>{Je({name:`go_to_check`}),a.push(`${c}/checks/?id=${e}`)},[a.push,c]),g=I(()=>{Je({name:`hide`}),e()},[e]),_=I(e=>{let t=Ws(e)?.icon;return t?H(t,{}):null},[]),v=H(J,{"aria-label":`Close History`,onClick:g,children:H(Yt,{})});return H(za,{runs:f,selectedId:n,isLoading:d,onRunSelect:p,onAddToChecklist:m,onGoToCheck:h,getRunIcon:_,hideAddToChecklist:r.disableUpdateChecklist,title:`History`,headerActions:v,emptyMessage:`No runs`,loadingMessage:`Loading...`,groupByDate:!0,addToChecklistIcon:H(kt,{}),goToCheckIcon:H(Ot,{color:`green`})})}const Xs=({size:e=16})=>U(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,children:[H(`circle`,{cx:`12`,cy:`12`,r:`10`}),H(`path`,{d:`M12 16v-4`}),H(`path`,{d:`M12 8h.01`})]});function Zs({isOpen:e,onClose:t,onExecute:n,type:r,title:i,params:a,RunForm:o,onCancel:s,onExecuteClick:c,documentationUrl:l,InfoIcon:u=Xs}){let[d,f]=B(a??{}),[p,m]=B(null),[h,g]=B(!1),_=z(!1),v=()=>{_.current||s?.(),_.current=!1,t()},y=()=>{_.current=!0,c?.(),n(r,d)};return U(lt,{open:e,onClose:v,maxWidth:`sm`,fullWidth:!0,scroll:`paper`,slotProps:{paper:{sx:{height:`75%`,minHeight:`400px`}}},children:[U(ft,{sx:{display:`flex`,alignItems:`center`},children:[i,` `,l&&U(V,{children:[H(J,{size:`small`,"aria-label":`Click this button to learn more about the SQL behind`,onMouseEnter:e=>m(e.currentTarget),onMouseLeave:()=>m(null),onClick:()=>window.open(l,`_blank`),children:H(W,{component:u,sx:{fontSize:`16px`}})}),H(Gn,{open:!!p,anchorEl:p,onClose:()=>m(null),anchorOrigin:{vertical:`bottom`,horizontal:`right`},transformOrigin:{vertical:`top`,horizontal:`right`},disableRestoreFocus:!0,sx:{pointerEvents:`none`},slotProps:{paper:{sx:{bgcolor:`black`,color:`white`,p:1}}},children:U(q,{sx:{fontSize:`0.875rem`},children:[`Click`,` `,H(pt,{href:l,target:`_blank`,sx:{textDecoration:`underline`,color:`white`,"&:hover":{color:`iochmara.300`}},children:`here`}),` `,`to learn more about the SQL behind`]})})]})]}),H(J,{"aria-label":`close`,onClick:v,sx:{position:`absolute`,right:8,top:8,color:`grey.500`},children:H(Tt,{})}),H(dt,{sx:{p:0,overflow:`auto`,borderTop:`1px solid`,borderBottom:`1px solid`,borderColor:`divider`},children:H(W,{sx:{contain:`layout`},children:o&&H(o,{params:d,onParamsChanged:f,setIsReadyToExecute:g})})}),H(ut,{children:H(K,{direction:`row`,spacing:`10px`,children:H(G,{disabled:!h,color:`iochmara`,variant:`contained`,onClick:y,children:`Execute`})})})]})}const Qs=e=>({value_diff:`https://docs.reccehq.com/features/lineage/#value-diff`,profile_diff:`https://docs.reccehq.com/features/lineage/#profile-diff`,histogram_diff:`https://docs.reccehq.com/features/lineage/#histogram-diff`,top_k_diff:`https://docs.reccehq.com/features/lineage/#top-k-diff`})[e]||null;function $s({isOpen:e,onClose:t,onExecute:n,type:r,title:i,params:a,initialRun:o,RunForm:s}){return H(Zs,{isOpen:e,onClose:t,onExecute:n,type:r,title:i,params:a,initialRun:o,RunForm:s,onCancel:()=>{Xe(r)&&qe({action:r,event:Ye.CANCEL})},onExecuteClick:()=>{Xe(r)&&qe({action:r,event:Ye.EXECUTE})},documentationUrl:Qs(r),InfoIcon:Vt})}const ec=ot(function({isRunning:e,isAborting:t,progress:n,error:r,run:i,onCancel:a,viewOptions:o,onViewOptionsChanged:s,RunResultView:c,children:l,ErrorBoundary:u,errorBoundaryFallback:d},f){let p=N(),m=r?.response?.data?.detail??i?.error;if(m)return U(hn,{severity:`error`,sx:p?{bgcolor:`error.dark`,color:`common.white`,"& .MuiAlert-icon":{color:`common.white`}}:void 0,children:[`Error: `,H(`span`,{className:`no-track-pii-safe`,children:m})]});if(e||i?.status===`Running`){let e=`Loading...`;n?.message?e=n.message:i?.progress?.message&&(e=i.progress.message);let r=n?.percentage==null?void 0:n.percentage*100;return H(W,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,p:`1rem`,height:`100%`,bgcolor:p?`grey.900`:`grey.50`},children:U(K,{spacing:2,alignItems:`center`,children:[U(K,{direction:`row`,alignItems:`center`,spacing:1,children:[r==null?H(Dt,{size:32}):U(W,{sx:{position:`relative`,display:`inline-flex`},children:[H(Dt,{variant:`determinate`,value:r,size:32}),H(W,{sx:{top:0,left:0,bottom:0,right:0,position:`absolute`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:H(q,{variant:`caption`,component:`div`,sx:{fontSize:`0.6rem`},children:`${Math.round(r)}%`})})]}),t?H(q,{children:`Aborting...`}):H(q,{className:`no-track-pii-safe`,children:e})]}),!t&&H(G,{variant:`contained`,onClick:a,size:`small`,children:`Cancel`})]})})}if(!i)return H(W,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,bgcolor:p?`grey.900`:`grey.50`,height:`100%`},children:H(Dt,{size:32})});if(l&&c)throw Error(`RunView requires either a children or a RunResultView prop, but not both.`);if(!l&&!c)throw Error(`RunView requires at least one of children or RunResultView prop.`);return H(W,{sx:{height:`100%`,contain:`layout`,overflow:`auto`,bgcolor:p?`grey.900`:`grey.50`},className:`no-track-pii-safe`,children:(()=>{let e=c&&(i.error??i.result)?H(c,{ref:f,run:i,viewOptions:o,onViewOptionsChanged:s}):null,t=l?.({run:i,viewOptions:o,onViewOptionsChanged:s});return u&&e?U(V,{children:[H(u,{fallback:d,children:e}),t]}):U(V,{children:[e,t]})})()})});ec.displayName=`RunView`;const tc=F(({type:e,params:t})=>{let n=N();return H(ra,{value:Mn.stringify({type:e,params:t},null,2),language:`yaml`,readOnly:!0,lineNumbers:!1,wordWrap:!0,fontSize:14,height:`100%`,theme:n?`dark`:`light`,className:`no-track-pii-safe`})});tc.displayName=`ParamView`;const nc=F(({disableExport:e,onCopyAsImage:t,onMouseEnter:n,onMouseLeave:r,csvExport:i})=>{let[a,o]=B(null),s=!!a,c=e=>{o(e.currentTarget)},l=()=>{o(null)};return U(V,{children:[H(G,{size:`small`,variant:`outlined`,color:`neutral`,onClick:c,endIcon:H(jt,{}),sx:{textTransform:`none`},children:`Export`}),U(_n,{anchorEl:a,open:s,onClose:l,children:[U(X,{onClick:async()=>{await t(),l()},onMouseEnter:n,onMouseLeave:r,disabled:e,children:[H(Z,{children:H(Bt,{})}),H(Q,{children:`Copy as Image`})]}),U(X,{onClick:async()=>{await i?.copyAsTSV?.(),l()},disabled:e||!i?.canExportCSV,children:[H(Z,{children:H(It,{})}),H(Q,{children:`Copy as Text`})]}),U(X,{onClick:async()=>{await i?.copyAsCSV(),l()},disabled:e||!i?.canExportCSV,children:[H(Z,{children:H(Kt,{})}),H(Q,{children:`Copy as CSV`})]}),U(X,{onClick:()=>{i?.downloadAsCSV(),l()},disabled:e||!i?.canExportCSV,children:[H(Z,{children:H(zt,{})}),H(Q,{children:`Download as CSV`})]}),U(X,{onClick:()=>{i?.downloadAsTSV?.(),l()},disabled:e||!i?.canExportCSV,children:[H(Z,{children:H(zt,{})}),H(Q,{children:`Download as TSV`})]}),i?.downloadAsExcel&&U(X,{onClick:()=>{i?.downloadAsExcel?.(),l()},disabled:e||!i?.canExportCSV,children:[H(Z,{children:H(zt,{})}),H(Q,{children:`Download as Excel`})]})]})]})});nc.displayName=`DefaultExportMenu`;const rc=F(({disableExport:e,onCopyAsImage:t,onMouseEnter:n,onMouseLeave:r,csvExport:i,authed:a,onShareToCloud:o,onShowAuthModal:s})=>{let[c,l]=B(null),u=!!c,d=e=>{l(e.currentTarget)},f=()=>{l(null)};return U(V,{children:[H(G,{size:`small`,variant:`outlined`,color:`neutral`,onClick:d,endIcon:H(jt,{}),sx:{textTransform:`none`},children:`Share`}),U(_n,{anchorEl:c,open:u,onClose:f,children:[U(X,{onClick:async()=>{await t(),f()},onMouseEnter:n,onMouseLeave:r,disabled:e,children:[H(Z,{children:H(Bt,{})}),H(Q,{children:`Copy as Image`})]}),U(X,{onClick:async()=>{await i?.copyAsTSV?.(),f()},disabled:e||!i?.canExportCSV,children:[H(Z,{children:H(It,{})}),H(Q,{children:`Copy as Text`})]}),U(X,{onClick:async()=>{await i?.copyAsCSV(),f()},disabled:e||!i?.canExportCSV,children:[H(Z,{children:H(Kt,{})}),H(Q,{children:`Copy as CSV`})]}),U(X,{onClick:()=>{i?.downloadAsCSV(),f()},disabled:e||!i?.canExportCSV,children:[H(Z,{children:H(zt,{})}),H(Q,{children:`Download as CSV`})]}),U(X,{onClick:()=>{i?.downloadAsTSV?.(),f()},disabled:e||!i?.canExportCSV,children:[H(Z,{children:H(zt,{})}),H(Q,{children:`Download as TSV`})]}),i?.downloadAsExcel&&U(X,{onClick:()=>{i?.downloadAsExcel?.(),f()},disabled:e||!i?.canExportCSV,children:[H(Z,{children:H(zt,{})}),H(Q,{children:`Download as Excel`})]}),H(Et,{}),a?U(X,{onClick:async()=>{await o?.(),f()},children:[H(Z,{children:H(xr,{})}),H(Q,{children:`Share to Cloud`})]}):U(X,{onClick:()=>{s?.(),f()},children:[H(Z,{children:H(xr,{})}),H(Q,{children:`Share`})]})]})]})});rc.displayName=`DefaultShareMenu`;const ic=F(({runId:e,run:t,disableUpdateChecklist:n,hasError:r,onGoToCheck:i,onAddToChecklist:a})=>{let o=t?.check_id,s=!e||!t?.result||r;return n?null:o?H(G,{disabled:s,size:`small`,variant:`contained`,onClick:()=>i?.(o),startIcon:H(Nt,{}),sx:{textTransform:`none`},children:`Go to Check`}):H(G,{disabled:s,size:`small`,variant:`contained`,onClick:a,startIcon:H(Nt,{}),sx:{textTransform:`none`},children:`Add to Checklist`})});ic.displayName=`DefaultAddToCheckButton`;const ac=F(({run:e})=>{let t=e.status||(e.result?`Finished`:e.error?`Failed`:`unknown`),n=e=>{switch(e.toLowerCase()){case`finished`:return`success.main`;case`failed`:return`error.main`;case`running`:return`primary.main`;case`cancelled`:default:return`text.secondary`}},r=e.run_at?qn(new Date(e.run_at),{addSuffix:!0}):`Unknown time`;return U(q,{variant:`body2`,sx:{color:`text.secondary`},children:[H(W,{component:`span`,sx:{color:n(t)},fontWeight:600,children:t}),`・`,r]})});ac.displayName=`RunStatusAndDateDisplay`;function oc({runId:e,run:t,isRunning:n,error:r,viewOptions:i,onViewOptionsChanged:a,isSingleEnvironment:o,disableDatabaseQuery:s,disableShare:c,disableUpdateChecklist:l,onClose:u,onCancel:d,onRerun:f,onCopyAsImage:p,onCopyMouseEnter:m,onCopyMouseLeave:h,csvExport:g,authed:_,onShareToCloud:v,onShowAuthModal:y,onTrackCopyToClipboard:b,onGoToCheck:x,onAddToChecklist:S,SingleEnvironmentNotification:C,SqlEditorComponent:w,DualSqlEditorComponent:T,AuthModalComponent:E,RunResultView:ee,resultViewRef:te,children:D}){let O=N(),[k,ne]=B(`result`),[re,A]=B(!0),[ie,ae]=B(!1),oe=t?.type===`query`||t?.type===`query_diff`||t?.type===`query_base`,se=!e||!t?.result||!!r||k!==`result`,j=I(async()=>{await p?.(),b&&b(t?.type??`unknown`,`run`)},[p,b,t?.type]),ce=I(()=>{y?y():ae(!0)},[y]),le=t?.type===`query_diff`,ue=t?.params;return U(W,{sx:{display:`flex`,flexDirection:`column`,height:`100%`,bgcolor:O?`grey.900`:`grey.50`},children:[o&&re&&C&&H(C,{runType:t?.type,onClose:()=>A(!1)}),U(W,{sx:{display:`flex`,alignItems:`center`,borderBottom:1,borderColor:`divider`,mb:`1px`},children:[U(Dn,{value:k,onChange:(e,t)=>ne(t),children:[H(En,{label:`Result`,value:`result`}),H(En,{label:`Params`,value:`params`}),oe&&H(En,{label:`Query`,value:`query`})]}),H(W,{sx:{flexGrow:1}}),U(K,{direction:`row`,spacing:1,sx:{overflow:`hidden`,pr:1},alignItems:`center`,children:[t&&H(ac,{run:t}),H(G,{variant:`outlined`,color:`neutral`,disabled:!e||n||s,size:`small`,onClick:f,startIcon:H(Gt,{}),sx:{textTransform:`none`},children:`Rerun`}),c?H(nc,{run:t,disableExport:se,onCopyAsImage:j,onMouseEnter:m,onMouseLeave:h,csvExport:g}):H(rc,{run:t,disableExport:se,onCopyAsImage:j,onMouseEnter:m,onMouseLeave:h,csvExport:g,authed:_,onShareToCloud:v,onShowAuthModal:ce}),H(ic,{runId:e,run:t,disableUpdateChecklist:l,hasError:!!r,onGoToCheck:x,onAddToChecklist:S}),H(J,{size:`small`,onClick:u,children:H(Tt,{})})]})]}),k===`result`&&(ee||D)&&H(ec,{ref:te,isRunning:n,error:r,run:t,onCancel:d,viewOptions:i,onViewOptionsChanged:a,RunResultView:ee,children:D}),k===`params`&&t&&H(tc,{type:t.type,params:t.params}),k===`query`&&t&&oe&&ue?.sql_template&&H(V,{children:le&&T?H(T,{value:ue.sql_template,baseValue:ue.base_sql_template,readOnly:!0}):w?H(w,{value:ue.sql_template,readOnly:!0}):H(ra,{value:ue.sql_template,language:`sql`,readOnly:!0,theme:`dark`,height:`100%`})}),E&&ie&&H(E,{open:ie,onClose:()=>ae(!1)})]})}const sc=F(oc);sc.displayName=`RunResultPane`;const cc=e=>U(W,{sx:{display:`flex`,flex:1,minHeight:`48px`,m:`4px`,px:`16px`,py:`12px`,bgcolor:`primary.50`,border:`1px solid`,borderRadius:`4px`,borderColor:`primary.400`,alignItems:e.align??`center`,gap:`12px`},children:[H(W,{component:Er,sx:{width:`20px`,height:`20px`,color:`primary.900`}}),e.children,H(W,{sx:{flexGrow:1}}),H(J,{size:`small`,onClick:e.onClose,children:H(Tt,{})})]}),lc=()=>U(pt,{href:`https://docs.reccehq.com/get-started/#prepare-dbt-artifacts`,target:`_blank`,sx:{color:`primary.main`,fontWeight:`bold`,textDecoration:`underline`,display:`inline-flex`,alignItems:`center`,gap:.5},children:[`Learn how `,H(gt,{})]});function uc({value:e,onChange:t,onRun:n,onRunBase:r,onRunDiff:i,label:a,CustomEditor:o,options:s={},manifestData:c,schemas:l,...u}){let{featureToggles:d}=me(),f=N(),p=e=>{t&&t(e)},m=``;c&&(m=c.generated_at?je(c.generated_at):``);let h=R(()=>{let e=[];return n&&e.push({key:`Mod-Enter`,run:()=>(n(),!0)}),r&&e.push({key:`Alt-Enter`,run:()=>(r(),!0)}),i&&e.push({key:`Mod-Shift-Enter`,run:()=>(i(),!0)}),e},[n,r,i]);return U(V,{children:[(a??n??r)&&U(K,{direction:`row`,sx:{bgcolor:yt(f?M.neutral[600]:M.neutral[200],.7),height:`40px`,minHeight:`40px`,fontSize:`14px`,alignItems:`center`,m:0,p:`0px 16px`,flex:`0 0 40px`},children:[H(q,{component:`strong`,sx:{fontWeight:`bold`},className:`no-track-pii-safe`,children:a?a.toUpperCase():``}),c&&U(`span`,{className:`ml-1`,children:[`(`,l&&U(`span`,{className:`no-track-pii-safe`,children:[l,`, `]}),H(`span`,{children:m}),`)`]}),H(W,{sx:{flexGrow:1}}),(n??r)&&H(G,{size:`xsmall`,variant:`outlined`,onClick:n??r,sx:{bgcolor:`background.paper`,p:`6px 12px`},disabled:d.disableDatabaseQuery,startIcon:H(Dr,{}),children:`Run Query`})]}),o??H(ra,{value:e,onChange:p,language:`sql`,readOnly:s.readOnly??!1,lineNumbers:s.lineNumbers!==`off`,wordWrap:s.wordWrap!==`off`,fontSize:s.fontSize??16,keyBindings:h,theme:f?`dark`:`light`,className:`no-track-pii-safe max-h-dvh h-full`})]})}function dc({value:e,baseValue:t,onChange:n,onChangeBase:r,onRun:i,onRunBase:a,onRunDiff:o,options:s={},labels:c,SetupGuide:l,...u}){let d=c?c[0]:`Base`,f=c?c[1]:`Current`,{envInfo:p,lineageGraph:m}=A(),h,g;p?.dbt?.base&&p.dbt.current&&(h=p.dbt.base,g=p.dbt.current);let[_,v]=Re(m);return H(V,{children:U(K,{direction:`row`,sx:{height:`100%`,gap:0},children:[H(K,{sx:{height:`100%`,width:`50%`,gap:0,borderRight:`1px solid`,borderRightColor:`divider`},children:H(uc,{label:d,value:t??``,onChange:r,onRunBase:a,options:s,CustomEditor:l,manifestData:h??void 0,schemas:Array.from(_).join(`, `),...u})}),H(K,{sx:{height:`100%`,width:`50%`,gap:0},children:H(uc,{label:f,value:e,onChange:n,onRun:i,options:s,manifestData:g??void 0,schemas:Array.from(v).join(`, `),...u})})]})})}var fc=uc;const pc=({runType:e,onClose:t})=>{switch(e){case`row_count`:return H(cc,{onClose:t,children:U(q,{children:[`Enable row count diffing, and other Recce features, by configuring a base dbt environment to compare against. `,H(lc,{})]})});case`profile`:return H(cc,{onClose:t,children:U(q,{children:[`Enable data-profile diffing, and other Recce features, by configuring a base dbt environment to compare against.`,` `,H(lc,{})]})});default:return null}},mc=({value:e,readOnly:t})=>H(fc,{value:e,options:{readOnly:t}}),hc=({value:e,baseValue:t,readOnly:n})=>H(dc,{value:e,baseValue:t,options:{readOnly:n}}),gc=({open:e,onClose:t})=>H(ul,{parentOpen:e,handleParentClose:()=>t(),ignoreCookie:!0,variant:`enable-share`}),_c=({runId:e,onClose:t,isSingleEnvironment:n})=>{let{featureToggles:r,authed:i}=me(),{runAction:a}=j(),{error:o,run:c,onCancel:l,isRunning:u}=ol(e),[d,f]=B(),p=tt(),m=hr(),{apiClient:h}=ca(),{basePath:g}=se(),{handleShareClick:_}=Hc(),v;c&&E(c.type)&&(v=Ws(c.type).RunResultView);let{ref:y,onCopyToClipboard:b,onMouseEnter:x,onMouseLeave:S}=Jc(),C=$c({run:c,viewOptions:d}),w=I(()=>{c&&a(c.type,c.params)},[c,a]),T=I(async()=>{await _(),Ge({name:`create`})},[_]),ee=I(async()=>{await b(),Ke({type:c?.type??`unknown`,from:`run`})},[b,c?.type]),te=I(e=>{m.push(`${g}/checks/?id=${e}`)},[m.push,g]),O=I(async()=>{if(!e)return;let t=await s(e,d,h);await p.invalidateQueries({queryKey:D.checks()}),m.push(`${g}/checks/?id=${t.check_id}`)},[e,d,h,p,m.push,g]);return H(sc,{runId:e,run:c,isRunning:u,error:o,viewOptions:d,onViewOptionsChanged:f,isSingleEnvironment:n,disableDatabaseQuery:r.disableDatabaseQuery,disableShare:r.disableShare,disableUpdateChecklist:r.disableUpdateChecklist,onClose:t,onCancel:l,onRerun:w,onCopyAsImage:ee,onCopyMouseEnter:x,onCopyMouseLeave:S,csvExport:C,authed:i,onShareToCloud:T,onGoToCheck:te,onAddToChecklist:O,SingleEnvironmentNotification:pc,SqlEditorComponent:mc,DualSqlEditorComponent:hc,AuthModalComponent:gc,RunResultView:v,resultViewRef:y})},vc=({onClose:e,isSingleEnvironment:t})=>{let{runId:n}=j();return H(_c,{runId:n,onClose:e,isSingleEnvironment:t})};function yc({error:e,resetError:t}){let{background:n,text:r}=sl();return H(W,{sx:{height:`100%`,bgcolor:n.subtle,display:`flex`,alignItems:`center`,justifyContent:`center`},children:U(W,{sx:{p:4,display:`flex`,flexDirection:`column`,justifyContent:`flex-start`,bgcolor:`background.paper`,border:`solid 1px`,borderColor:`divider`,minHeight:`200px`},children:[H(q,{variant:`h6`,sx:{width:`800px`},children:`You have encountered an error`}),H(W,{sx:{flex:1,fontSize:`10pt`,color:r.secondary},children:String(e)}),H(G,{sx:{justifySelf:`center`,alignSelf:`center`,mt:`20px`},color:`iochmara`,variant:`contained`,size:`small`,onClick:t,children:`Reset`})]})})}const bc=e=>H(yc,{error:e.error,resetError:e.resetError}),xc=({children:e,fallback:t=bc})=>H(Or,{fallback:t,children:e}),Sc=ot(function(e,t){return H(ec,{...e,ErrorBoundary:xc,errorBoundaryFallback:Qe,ref:t})});Sc.displayName=`RunViewOss`;const Cc={mode:`per_node`,status:`pending`,completed:0,total:0,actions:{}},wc=(e,t)=>{let{onActionStarted:n,onActionNodeUpdated:i,onActionCompleted:o,onTrackAction:s,trackingSource:c=`lineage_view_top_bar`}=t,l=O(),u=z({...Cc}).current,{showRunId:d}=j(),f=async(t,r,s)=>{u.mode=`multi_nodes`,u.actions={};let c=u.mode,f=u.actions;n(),u.status=`running`;let p=[];for(let t of e){let e=r(t);e?(f[t.id]={mode:c,status:`skipped`,skipReason:e},i(t)):(f[t.id]={mode:c,status:`pending`},p.push(t))}let h=s(p);try{let{run_id:e}=await a(t,h,{nowait:!0},l);for(d(e),u.currentRun={run_id:e},u.total=1;;){let t=await m(e,2,l);u.currentRun=t;let n=t.error?`failure`:t.result?`success`:`running`;for(let e of p)f[e.id]={mode:c,status:n,run:t},i(e);if(t.error||t.result)break}}catch{}if(u.completed=1,u.status===`canceling`){u.status=`canceled`,o();return}u.status=`completed`,o()},p=async(t,r)=>{u.mode=`per_node`,u.actions={};let s=u.mode,c=u.actions;n(),u.status=`running`;for(let t of e)c[t.id]={mode:s,status:`pending`},i(t);u.completed=0,u.total=e.length;for(let n of e){let{params:e,skipReason:d}=r(n);if(d)c[n.id]={mode:s,status:`skipped`,skipReason:d},i(n);else try{let{run_id:r}=await a(t,e,{nowait:!0},l);for(u.currentRun={run_id:r},c[n.id]={mode:s,status:`running`},i(n);;){let e=await m(r,2,l);u.currentRun=e;let t=e.error?`failure`:e.result?`success`:`running`;if(c[n.id]={mode:s,status:t,run:e},i(n),e.error||e.result)break}}catch{}finally{u.currentRun=void 0}if(u.completed++,u.status===`canceling`){u.status=`canceled`,o();return}}u.status=`completed`,o()};return{actionState:u,runRowCount:async()=>{s?.({action:`row_count`,source:c,node_count:e.length});for(let t of e)t.data.resourceType!==`model`&&(u.actions[t.id]={mode:`multi_nodes`,status:`skipped`,skipReason:`Not a model`},i(t));await f(`row_count`,e=>{if(e.data.resourceType!==`model`)return`Not a model`},e=>({node_names:e.map(e=>e.data.name)}))},runRowCountDiff:async()=>{s?.({action:`row_count_diff`,source:c,node_count:e.length});for(let t of e)t.data.resourceType!==`model`&&(u.actions[t.id]={mode:`multi_nodes`,status:`skipped`,skipReason:`Not a model`},i(t));await f(`row_count_diff`,e=>{if(e.data.resourceType!==`model`)return`Not a model`},e=>({node_names:e.map(e=>e.data.name)}))},runValueDiff:async()=>{s?.({action:`value_diff`,source:c,node_count:e.length}),await p(`value_diff`,e=>{let t=e.data.data.current?.primary_key;return t?{params:{model:e.data.name,primary_key:t}}:{skipReason:`No primary key found. The first unique column is used as primary key.`}})},addLineageDiffCheck:async()=>await ee({node_ids:e.map(e=>e.id)},l),addSchemaDiffCheck:async()=>{let t;return t=e.length===1?await _({node_id:e[0].id},l):await _({node_id:e.map(e=>e.id)},l),t},cancel:async()=>{u.status=`canceling`,u.currentRun?.run_id&&await r(u.currentRun.run_id,l)},reset:()=>{Object.assign(u,Cc)}}};function Tc(e){let[t,n]=B(!1),[r,i]=B(0),[a,o]=B(),s=z(null),c=I(e=>(i(e),new Promise(e=>{o(()=>e),n(!0)})),[]),l=()=>{e?.onConfirm?.(r),a?.(!0),n(!1)},u=()=>{e?.onCancel?.(r),a?.(!1),n(!1)};return{confirm:c,AlertDialog:U(lt,{open:t,onClose:u,maxWidth:`md`,fullWidth:!0,"aria-labelledby":`value-diff-alert-dialog-title`,children:[U(ft,{id:`value-diff-alert-dialog-title`,sx:{fontSize:`1.125rem`,fontWeight:`bold`},children:[`Value Diff on `,r,` nodes`]}),H(J,{"aria-label":`close`,onClick:u,sx:{position:`absolute`,right:8,top:8,color:`grey.500`},children:H(Tt,{})}),H(dt,{children:H(K,{spacing:`20px`,children:U(W,{children:[`Value diff will be executed on `,r,` nodes in the Lineage, which can add extra costs to your bill.`]})})}),U(ut,{sx:{gap:.5},children:[H(G,{ref:s,onClick:u,variant:`outlined`,color:`neutral`,children:`Cancel`}),H(G,{color:`iochmara`,variant:`contained`,onClick:l,sx:{ml:1.5},children:`Execute`})]})]})}}function Ec({connect:e,idleSeconds:t}){return U(V,{children:[H(ft,{children:`Server Disconnected`}),H(dt,{children:t!=null&&t>0?U(q,{children:[`The server has been idle for `,Le(t),` and was automatically stopped. Please restart the Recce server to continue.`]}):H(q,{children:`The server connection has been lost. Please restart the Recce server and try again.`})}),H(ut,{children:H(G,{color:`iochmara`,variant:`contained`,onClick:()=>{e()},children:`Retry`})})]})}function Dc({shareUrl:e,mode:t,supportCalendarUrl:n,LinkComponent:r}){let i={"read only":{title:`Share Instance Expired`,body:`This Share Instance has expired. Please restart the share instance.`,action:`Restart`,link:e},"metadata only":{title:`Preview Instance Expired`,body:`This Preview Instance has expired. To browse more, please book a meeting with us.`,action:`Contact us`,link:n}}[t],a=H(G,{color:`iochmara`,variant:`contained`,children:i.action});return U(V,{children:[H(ft,{children:i.title}),H(dt,{children:H(q,{children:i.body})}),H(ut,{children:t===`read only`?H(r||`a`,{href:i.link,children:a}):H(G,{color:`iochmara`,variant:`contained`,onClick:()=>window.open(i.link,`_blank`),children:i.action})})]})}function Oc({enabled:e=!0,baseUrl:t,apiPrefix:n}={}){let[r,i]=B(void 0),a=z({ws:void 0,status:`pending`,artifactsUpdatedToastId:void 0}),[o,s]=B(e?`pending`:`connected`),[c,l]=B(void 0);L(()=>{a.current.status=o},[o]),L(()=>{a.current.artifactsUpdatedToastId=r},[r]);let u=tt(),d=I(()=>{u.invalidateQueries({queryKey:D.lineage()}),u.invalidateQueries({queryKey:D.checks()}),u.invalidateQueries({queryKey:D.runs()})},[u]),f=I(()=>{function e(e){return e.replace(/(http)(s)?:\/\//,`ws$2://`)}let r=t??We,o=n?`${n}/ws`:`/api/ws`,c=new WebSocket(`${e(r)}${o}`);a.current.ws=c,c.onopen=()=>{c.send(`ping`)},c.onmessage=e=>{if(e.data===`pong`){a.current.status===`disconnected`&&d(),s(`connected`);return}try{let t=JSON.parse(e.data);if(t.command===`refresh`){let{eventType:e,srcPath:n}=t.event,[r,o]=n.split(`/`).slice(-2),s=o.replace(/\.[^/.]+$/,``),c=`${r}-${s}-${e}`;a.current.artifactsUpdatedToastId??i(P.create({id:c,description:`Detected ${r} ${s} ${e}`,type:`info`,duration:5e3,closable:!0})),d()}else if(t.command===`relaunch`)l(`relaunch`);else{let{id:e,title:n,description:r,status:a,duration:o}=t.event;i(P.create({id:e||`broadcast`,title:n,description:r,type:a??`info`,duration:o??5e3,closable:!0}))}}catch(e){console.error(e)}},c.onerror=e=>{console.error(`An error occurred during Handling WebSockets`,e)},c.onclose=()=>{s(e=>e===`connected`?`disconnected`:e),a.current.ws=void 0}},[d,t,n]);return L(()=>{if(!e)return;let t=a.current;return f(),()=>{t.ws&&t.ws.close()}},[f,e]),{connectionStatus:o,connect:f,envStatus:c}}function kc({children:t}){let{idleTimeout:n,remainingSeconds:r,isEnabled:i,setDisconnected:a,resetConnection:o}=ie(),{apiClient:s,apiPrefix:c,baseUrl:l}=ca(),u=et({queryKey:D.lineage(),queryFn:()=>e(s)}),d=et({queryKey:D.runsAggregated(),queryFn:()=>C(s)}),f=R(()=>{let e=u.data?.lineage;if(e?.base)return le(e.base,e.current,e.diff)},[u.data]),p=u.error?.message,{state_metadata:m,lineage:h,sqlmesh:g,demo:_,codespace:v,review_mode:y,cloud_mode:b,file_mode:x,filename:S,adapter_type:w,git:T,pull_request:E,support_tasks:ee}=u.data??{demo:!1},te={stateMetadata:m,adapterType:w,git:T,pullRequest:E,dbt:{base:h?.base.manifest_metadata,current:h?.current.manifest_metadata},sqlmesh:g},{connectionStatus:O,connect:ne,envStatus:re}=Oc({enabled:!0,baseUrl:l,apiPrefix:c});L(()=>{O===`disconnected`?a():O===`connected`&&o()},[O,a,o]);let{data:A,isLoading:ae}=fe(),{featureToggles:se,shareUrl:j}=me(),[ce,ue]=B(!1),[de,pe]=B(!1),he=tt(),ge=!ae&&re===`relaunch`&&A?.single_env_onboarding===!0&&A.show_relaunch_hint;ge!==de&&(pe(ge),ue(ge)),L(()=>{ge&&ce&&Ze({action:`target_base_added`})},[ge,ce]);let _e=()=>{ue(!1),k(s),he.invalidateQueries({queryKey:D.flag()})},M=I(()=>{d.refetch()},[d]),ve=I(()=>{d.refetch()},[d]);return U(V,{children:[H(oe,{lineageGraph:f,envInfo:te,reviewMode:y,cloudMode:b,fileMode:x,fileName:S,isDemoSite:_??!1,isCodespace:v,isLoading:u.isLoading,error:p,supportTasks:ee,onRefetchLineageGraph:M,runsAggregated:d.data,onRefetchRunsAggregated:ve,children:t}),H(lt,{open:O===`disconnected`,onClose:()=>void 0,children:j&&se.mode!==null?H(Dc,{shareUrl:j,mode:se.mode,supportCalendarUrl:Ue,LinkComponent:({href:e,children:t})=>H(wt,{href:e,passHref:!0,children:t})}):H(Ec,{connect:ne,idleSeconds:i&&n!==null&&r!==null&&r<=5?n-Math.max(0,r):void 0})}),A?.single_env_onboarding&&U(lt,{open:ce,onClose:_e,children:[H(ft,{children:`Target-base Added`}),H(J,{"aria-label":`close`,onClick:_e,sx:{position:`absolute`,right:8,top:8,color:`grey.500`},children:H(Tt,{})}),H(dt,{children:H(q,{children:`Please restart the Recce server.`})}),H(ut,{children:H(G,{color:`iochmara`,variant:`contained`,onClick:_e,children:`Got it!`})})]})]})}const Ac=`select * from {{ ref("mymodel") }}`;function jc({children:e}){let[t,n]=B(Ac),[r,i]=B(Ac),[a,o]=B(!1),[s,c]=B();return H(Pr,{sql:t,sqlQuery:t,setSqlQuery:n,primaryKeys:s,setPrimaryKeys:c,isCustomQueries:a,setCustomQueries:o,baseSqlQuery:r,setBaseSqlQuery:i,children:e})}const Mc=e=>{},Nc=e=>{},Pc=e=>{},Fc=e=>{};function Ic(){let e=Fr();return{sqlQuery:e.sqlQuery??Ac,setSqlQuery:e.setSqlQuery??Mc,primaryKeys:e.primaryKeys,setPrimaryKeys:e.setPrimaryKeys??Nc,isCustomQueries:e.isCustomQueries??!1,setCustomQueries:e.setCustomQueries??Pc,baseSqlQuery:e.baseSqlQuery??Ac,setBaseSqlQuery:e.setBaseSqlQuery??Fc}}function Lc(e){L(()=>{e()},[e,mr()])}function Rc({children:e}){let{apiClient:t}=ca(),[n,r]=B(),[i,o]=B(!1),s=I(()=>o(!0),[]),c=I(()=>o(!1),[]),l=hr(),d=mr(),f=tt(),{basePath:p}=se(),m=z(null);Lc(c);let h=I(async(e,t)=>{t!==!1&&await f.invalidateQueries({queryKey:D.runs()})},[f]),g=I(async(e,n,i)=>{try{let o=new Date().getTime().toString(),c,h=i;if(h?.showLast){let r=await u(e,n,1,t);r.length===1&&(c=r[0])}let g=Ws(e),_=g.RunResultView,{title:v,RunForm:y}=g;if(_===void 0)throw Error(`Run type ${e} does not have a result view`);if(y===void 0||!i?.showForm){let{run_id:r}=await a(e,n,{nowait:!0,trackProps:h?.trackProps},t);await f.invalidateQueries({queryKey:D.runs()}),m.current&&m.current(r);let i=`${p}/lineage`;d.startsWith(`${i}/`)&&d!==i&&l.push(i);return}r({session:o,title:v,type:e,params:n,lastRun:c,options:h,RunForm:y}),s();return}catch(e){P.create({title:`Failed to submit a run`,description:e instanceof Error?e.message:void 0,type:`error`,duration:5e3,closable:!0});return}},[s,f,t,d,l,p]),_=I(async(e,r)=>{try{c();let{run_id:i}=await a(e,r,{nowait:!0,trackProps:n?.options?.trackProps},t);m.current&&m.current(i)}catch(e){P.create({title:`Failed to submit a run`,description:e instanceof Error?e.message:void 0,type:`error`,duration:5e3,closable:!0})}},[c,n?.options?.trackProps,t]);return U(re,{onRunAction:g,onShowRunId:h,children:[H(zc,{showRunIdRef:m,children:e}),n&&H($s,{isOpen:i,onClose:c,onExecute:_,title:n.title,type:n.type,params:n.params,initialRun:n.lastRun,RunForm:n.options?.showForm&&n.RunForm?n.RunForm:void 0},n.session)]})}function zc({children:e,showRunIdRef:t}){let{showRunId:n}=j();return L(()=>(t.current=n,()=>{t.current=null}),[n,t]),H(V,{children:e})}const Bc=at(void 0);function Vc({children:e}){let[t,n]=B(),[r,i]=B(!1),[a,o]=B(),{apiClient:s}=ca();return H(Bc.Provider,{value:{shareUrl:t,isLoading:r,error:a,handleShareClick:async()=>{i(!0),o(void 0),n(void 0);try{let e=await h(s);if(e.status!==`success`){o(e.message);return}n(e.share_url)}catch(e){o(e.message)}finally{i(!1)}}},children:e})}const Hc=()=>{let e=st(Bc);if(!e)throw Error(`useRecceShareStateContext must be used within a RecceShareStateContextProvider`);return e};function Uc({children:e}){return H(ne,{children:H(Vc,{children:H(jc,{children:H(kc,{children:H(Rc,{children:H(Ir,{children:e})})})})})})}const Wc=async()=>(await import(`html2canvas-pro`)).default,Gc=e=>`element`in e?e.element:e,Kc=`ignore-screenshot`;function qc({renderLibrary:e=`html2canvas`,imageType:t=`png`,backgroundColor:n=null,boardEffect:r=!0,shadowEffect:i=!1,borderStyle:a=`solid 1px ${M.neutral[300]}`,borderRadius:o=`10px`,onSuccess:s,onError:c,ignoreElements:l}){let[u,d]=B(`idle`),f=z(null),{onOpen:p,setImgBlob:m,ImageDownloadModal:h}=Yc(),g=async()=>{if(!f.current)throw console.error(`No node to use for screenshot`),Error(`No node to use for screenshot`);let t=Gc(f.current);if(!t)throw console.error(`Could not get HTMLElement from ref`),Error(`Could not get HTMLElement from ref`);let s=t.style.overflow,c=t.style.border,u=t.style.borderRadius,p=t.style.backgroundColor,m=t.style.height;function h(){let e=t;e&&(e.style.overflow=s,e.style.border=c,e.style.borderRadius=u,e.style.backgroundColor=p,e.style.height=m)}try{t.style.overflow=`hidden`,t.style.border=r?a:``,t.style.borderRadius=r?o:``,t.style.backgroundColor=n??M.neutral[100],t.style.height=`${String(t.offsetHeight)}px`;let s=document.createElement(`style`);document.head.appendChild(s),s.sheet?.insertRule(`body > div:last-child img { display: inline-block; }`);let c=l?e=>!l(e):void 0;d(`loading`);let u;u=e===`html2canvas`?await(await Wc())(t,{logging:!1,backgroundColor:n??M.neutral[100],ignoreElements:l}):await An(t,{filter:c}),s.remove();let f=i?document.createElement(`canvas`):u;if(i){f.width=u.width+80,f.height=u.height+80;let e=f.getContext(`2d`);if(e)e.shadowColor=`rgba(0, 0, 0, 0.5)`,e.shadowBlur=20,e.shadowOffsetX=10,e.shadowOffsetY=10,e.drawImage(u,40,40);else throw console.error(`Error getting canvas context`),Error(`Error getting canvas context to add shadow effect`)}return await(await fetch(f.toDataURL())).blob()}catch(e){throw console.error(`Error converting to image`,e),e}finally{h()}};return{status:u,isLoading:u===`loading`,isErrored:u===`error`,isSuccess:u===`success`,copyToClipboard:async()=>{try{await navigator.clipboard.write([new ClipboardItem({[`image/${t}`]:g()})]),d(`success`),s&&s()}catch(e){e.message===`ClipboardItem is not defined`?(m(await g()),p(),d(`success`)):(d(`error`),console.error(`Error copying to clipboard`,e),c&&c(e))}},ImageDownloadModal:h,ref:f}}function Jc(e){let{successToast:t,failToast:n}=Ae(),{isLoading:r,copyToClipboard:i,ImageDownloadModal:a,ref:o}=qc({imageType:`png`,shadowEffect:!0,backgroundColor:e?.backgroundColor??M.neutral[100],onSuccess:()=>{t(`Copied the query result as an image to clipboard`)},onError:e=>{console.error(`Error taking screenshot`,e),n(`Failed to copy image to clipboard`,e)}}),s=I(()=>{if(o.current){let e=Gc(o.current);e&&(e.style.boxShadow=`rgba(0, 0, 0, 0.25) 0px 54px 55px, rgba(0, 0, 0, 0.12) 0px -12px 30px, rgba(0, 0, 0, 0.12) 0px 4px 6px, rgba(0, 0, 0, 0.17) 0px 12px 13px, rgba(0, 0, 0, 0.09) 0px -3px 5px`,e.style.transition=`box-shadow 0.5s ease-in-out`)}},[o]),c=I(()=>{if(o.current){let e=Gc(o.current);e&&(e.style.boxShadow=``)}},[o]),l=I(async()=>{if(o.current){await i();let e=Gc(o.current);e&&(e.style.boxShadow=``)}else n(`Failed to copy image to clipboard`,`No content to copy`)},[o,i,n]);function u({imageType:e=`png`,...t}){return U(V,{children:[H(G,{size:`small`,sx:{position:`absolute`,bottom:16,right:16},disabled:r,onMouseEnter:s,onMouseLeave:c,onClick:l,startIcon:H(Lt,{}),...t,children:`Copy to Clipboard`}),H(a,{})]})}return{ref:o,CopyToClipboardButton:u,onMouseEnter:s,onMouseLeave:c,onCopyToClipboard:l}}function Yc(){let[e,t]=B(!1),[n,r]=B(),i=()=>t(!0),a=()=>t(!1);function o(){let[t,r]=B();L(()=>{if(!n)return;let e=new FileReader;e.readAsDataURL(n),e.onloadend=e=>{e.target?.result!=null&&r(e.target.result)}},[]);let i=()=>{n&&(un(n,`recce-screenshot-${Kn(new Date,`yyyy-MM-dd-HH-mm-ss`)}.png`),a())};return U(lt,{open:e,onClose:a,maxWidth:`sm`,fullWidth:!0,children:[H(ft,{children:`Screenshot Preview`}),H(J,{"aria-label":`close`,onClick:a,sx:{position:`absolute`,right:8,top:8,color:`grey.500`},children:H(Tt,{})}),U(dt,{children:[U(K,{sx:{px:`10px`,gap:`10px`},children:[U(K,{direction:`row`,alignItems:`center`,spacing:`5px`,children:[H(W,{component:Vt,sx:{color:`error.main`}}),H(q,{sx:{fontWeight:500,display:`inline`},children:`Copy to the Clipboard`}),` `,`is not supported in the current browser`]}),H(q,{children:`Please download it directly`})]}),H(W,{component:`img`,src:t,alt:`screenshot`,sx:{maxWidth:`100%`}})]}),U(ut,{children:[H(G,{sx:{mr:1.5},onClick:a,children:`Close`}),H(G,{color:`iochmara`,variant:`contained`,onClick:i,children:`Download`})]})]})}return{onOpen:i,setImgBlob:r,ImageDownloadModal:o}}function Xc(e,r={}){let{enabled:a=!0}=r,o=tt(),{apiClient:s}=ca(),{data:l,isLoading:u,error:d,refetch:f}=et({queryKey:D.checkEvents(e),queryFn:()=>n(e,s),enabled:a,refetchInterval:1e4,refetchIntervalInBackground:!1}),p=$e({mutationFn:t=>i(e,t,s),onSuccess:async()=>{await o.invalidateQueries({queryKey:D.checkEvents(e)})}}),m=$e({mutationFn:({eventId:t,content:n})=>c(e,t,n,s),onSuccess:async()=>{await o.invalidateQueries({queryKey:D.checkEvents(e)})}}),h=$e({mutationFn:n=>t(e,n,s),onSuccess:async()=>{await o.invalidateQueries({queryKey:D.checkEvents(e)})}});return{events:l??[],isLoading:u,error:d,refetch:f,createComment:p.mutate,isCreatingComment:p.isPending,createCommentError:p.error,updateComment:m.mutateAsync,isUpdatingComment:m.isPending,updateCommentError:m.error,deleteComment:h.mutateAsync,isDeletingComment:h.isPending,deleteCommentError:h.error}}const Zc={TOAST_ID:`lifetime-countdown`,WARNING_THRESHOLD:60,UPDATE_INTERVAL:1e3,MESSAGE:e=>`The server will be closed in ${e} seconds.`,STYLE:{fontFamily:`monospace`}};function Qc(e){let t=P,[n,r]=B(null),i=z(void 0),a=I(()=>{if(!e)return 0;let t=new Date,n=Math.floor((e.getTime()-t.getTime())/1e3);return Math.max(0,n)},[e]),o=I(()=>{n!=null&&(t.remove(n),r(null))},[n]),s=I(()=>{if(n==null)return;let e=a();if(e<=0){o();return}t.update(n,{description:Zc.MESSAGE(e)})},[n,a,o]),c=I(()=>{if(!e)return;o();let n=a();n<=0||(r(t.create({id:Zc.TOAST_ID,description:Zc.MESSAGE(n)})),i.current=setInterval(s,Zc.UPDATE_INTERVAL))},[e,a,s,o]),l=a();mn(c,e?Math.max(0,l-Zc.WARNING_THRESHOLD)*1e3:null),L(()=>o,[o])}function $c({run:e,viewOptions:t}){let n=R(()=>!e?.type||!e?.result?!1:ye(e.type),[e?.type,e?.result]),r=I(()=>{if(!e?.type||!e?.result)return null;let n={displayMode:t?.display_mode,primaryKeys:e?.params?.primary_keys};return be(e.type,e.result,n)},[e?.type,e?.result,e?.params,t]),i=I(()=>{let e=r();return e?ze(e.columns,e.rows):null},[r]),a=I(()=>{let e=r();return e?De(e.columns,e.rows):null},[r]),o=I(async()=>{let e=i();if(!e){P.create({title:`Export failed`,description:`Unable to extract data for CSV export`,type:`error`,duration:3e3});return}try{await Ne(e),P.create({title:`Copied to clipboard`,description:`CSV data copied successfully`,type:`success`,duration:2e3})}catch(e){console.error(`Failed to copy CSV to clipboard:`,e),P.create({title:`Copy failed`,description:`Failed to copy to clipboard`,type:`error`,duration:3e3})}},[i]),s=I(()=>{let t=i();if(!t){P.create({title:`Export failed`,description:`Unable to extract data for CSV export`,type:`error`,duration:3e3});return}try{let n=Ee(e?.type??``,e?.params);ve(t,n),P.create({title:`Downloaded`,description:n,type:`success`,duration:3e3})}catch(e){console.error(`Failed to download CSV file:`,e),P.create({title:`Download failed`,description:`Failed to download CSV file`,type:`error`,duration:3e3})}},[i,e]),c=I(async()=>{let e=a();if(!e){P.create({title:`Export failed`,description:`Unable to extract data for export`,type:`error`,duration:3e3});return}try{await Ne(e),P.create({title:`Copied to clipboard`,description:`Text data copied — paste into any spreadsheet`,type:`success`,duration:2e3})}catch(e){console.error(`Failed to copy TSV to clipboard:`,e),P.create({title:`Copy failed`,description:`Failed to copy to clipboard`,type:`error`,duration:3e3})}},[a]),l=I(()=>{let t=a();if(!t){P.create({title:`Export failed`,description:`Unable to extract data for export`,type:`error`,duration:3e3});return}try{let n=Ee(e?.type??``,e?.params).replace(/\.csv$/,`.tsv`);Se(t,n),P.create({title:`Downloaded`,description:n,type:`success`,duration:3e3})}catch(e){console.error(`Failed to download TSV file:`,e),P.create({title:`Download failed`,description:`Failed to download TSV file`,type:`error`,duration:3e3})}},[a,e]);return{canExportCSV:n,copyAsCSV:o,copyAsTSV:c,downloadAsCSV:s,downloadAsExcel:I(async()=>{let t=r();if(!t){P.create({title:`Export failed`,description:`Unable to extract data for export`,type:`error`,duration:3e3});return}try{let n=await Ce(t.columns,t.rows),r=Ee(e?.type??``,e?.params).replace(/\.csv$/,`.xlsx`);Me(n,r),P.create({title:`Downloaded`,description:r,type:`success`,duration:3e3})}catch(e){console.error(`Failed to download Excel file:`,e),P.create({title:`Download failed`,description:`Failed to download Excel file`,type:`error`,duration:3e3})}},[r,e]),downloadAsTSV:l}}function el({description:e,onLike:t,onDislike:n,onClickLink:r,externalLink:i,externalLinkText:a}){return U(W,{sx:{display:`flex`,gap:4,justifyContent:`center`,alignContent:`center`,alignItems:`center`},children:[e,H(J,{"aria-label":`thumbs up`,onClick:t,sx:{width:`32px`,height:`32px`},children:H(W,{component:`img`,src:`/imgs/feedback/thumbs-up.png`,alt:`like`})}),H(J,{"aria-label":`thumbs down`,onClick:n,sx:{width:`32px`,height:`32px`},children:H(W,{component:`img`,src:`/imgs/feedback/thumbs-down.png`,alt:`dislike`})}),i&&a&&U(pt,{href:i,target:`_blank`,onClick:r,sx:{textDecoration:`underline`},children:[a,` `,H(gt,{})]})]})}function tl(e){let{feedbackId:t,description:n,onFeedbackSubmit:r,externalLink:i,externalLinkText:a}=e,[o,s]=B(void 0);function c(e=!1){let c=localStorage.getItem(t);o??(c===`true`&&!e||s(P.create({id:t,duration:void 0,type:`success`,description:H(K,{direction:`row`,children:H(el,{description:n,onLike:()=>{r(`like`),P.dismiss(t),localStorage.setItem(t,`true`)},onDislike:()=>{r(`dislike`),P.dismiss(t),localStorage.setItem(t,`true`)},externalLink:i,externalLinkText:a,onClickLink:()=>{r(`link`)}})})})))}return{feedbackToast:c,closeToast:()=>{o&&P.dismiss(o)}}}function nl(e){let[t,n]=B(void 0),{guideId:r,description:i,externalLinkText:a,onExternalLinkClick:o}=e;function s(){t??n(P.create({id:r,duration:3e3,type:`success`,description:i,action:{label:a??`link`,onClick:()=>{o&&o()}}}))}return{guideToast:s,closeGuideToast:()=>{t&&P.dismiss(t)}}}function rl(e){function t(e){return e?.columns?Object.values(e.columns).filter(e=>e!=null):[]}return il(t(e.data.data.base),t(e.data.data.current))}function il(e,t){let n=[];return e.forEach(e=>{n.some(t=>t.name===e.name)||n.push(e)}),t.forEach(e=>{n.some(t=>t.name===e.name)||n.push(e)}),n}function al(e,t){let{lineageGraph:n}=A(),r=te(),i=t??r?.apiClient,a=vn.find(n?.nodes,{data:{name:e}}),s=R(()=>a?rl(a):[],[a]),[c,l]=B([]),[u,d]=B(),[f,p]=B(!0),[m,h]=B(null),[g,_]=B([]),[v,y]=B(a?.id),b=a?a.data.data.current?.primary_key:void 0,x=I(async()=>{if(!(!a||!i))try{let e=(await o(a.id,i)).model;if(!e.base.columns||!e.current.columns){l([]);return}d(e.current.primary_key),l(il(Object.values(e.base.columns),Object.values(e.current.columns)))}catch(e){h(e)}},[a,i]);return(s!==g||a?.id!==v)&&(_(s),y(a?.id),s.length>0?(l(s),d(b),p(!1)):a?.id===void 0&&(l([]),p(!1))),L(()=>{s.length===0&&a?.id!==void 0&&(x().catch(e=>{console.error(e)}),p(!1))},[x,a?.id,s]),{columns:c,primaryKey:u,isLoading:f,error:m}}const ol=e=>{let{apiClient:t}=ca(),[n,i]=B(!!e),[a,o]=B(!1),[,s]=pe(),c=z(null);L(()=>{e&&(i(!0),c.current=null)},[e]);let{error:l,data:u}=et({queryKey:D.run(e??``),queryFn:async()=>await m(e??``,n?2:0,t),enabled:!!e,refetchInterval:n?50:!1,retry:!1});L(()=>{if(!u)return;let e=u.status?.toLowerCase();l||u.result||u.error||e&&e!==`running`?c.current!==u.run_id&&(c.current=u.run_id,i(!1)):e===`running`&&(c.current=null,i(!0))},[u,l]),L(()=>{(l||u?.result||u?.error)&&(u?.type===`row_count_diff`||u?.type===`row_count`)&&s?.()},[u,l,s]);let d=I(async()=>{o(!0),e&&await r(e,t)},[e,t]),f;return u&&E(u.type)&&(f=Ws(u.type).RunResultView),{run:u,isRunning:n,aborting:a,error:l,onCancel:d,RunResultView:f}};function sl(){let e=bt(),t=xe(),n=N(),[r,i]=B(!1);L(()=>{i(!0)},[]);let a=r?t?t.resolvedMode===`dark`:n:!1;return{isDark:a,theme:e,background:{default:a?M.neutral[900]:M.white,paper:a?M.neutral[800]:M.white,subtle:a?M.neutral[800]:M.neutral[50],emphasized:a?M.neutral[700]:M.neutral[100]},text:{primary:a?M.neutral[50]:M.neutral[900],secondary:a?M.neutral[400]:M.neutral[600],disabled:a?M.neutral[500]:M.neutral[400],inverted:a?M.neutral[900]:M.neutral[50]},border:{light:a?M.neutral[700]:M.neutral[200],default:a?M.neutral[600]:M.neutral[300],strong:a?M.neutral[500]:M.neutral[400]},status:{added:{bg:a?M.green[900]:M.green[100],text:a?M.neutral[50]:M.neutral[900]},removed:{bg:a?M.red[950]:M.red[200],text:a?M.neutral[50]:M.neutral[900]},modified:{bg:a?M.yellow[900]:M.amber[100],text:a?M.neutral[50]:M.neutral[900]}},interactive:{hover:a?M.neutral[700]:M.neutral[100],active:a?M.neutral[600]:M.neutral[200],focus:M.iochmara[500]}}}const cl=nt.create({baseURL:We});async function ll(e=cl){return(await e.post(`/api/connect`)).data}function ul({handleParentClose:e,parentOpen:t=!1,ignoreCookie:n=!1,variant:r=`auth`}){let{authed:i}=me(),{apiClient:a}=ca(),[o,s]=B(t||!i),c=mt.get(`authState`)??`pending`,[l,u]=B(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 U(lt,{open:o,onClose:f,maxWidth:`sm`,fullWidth:!0,slotProps:{paper:{sx:{borderRadius:`1rem`}}},children:[l!==`authenticating`&&H(ft,{sx:{textAlign:`center`,fontSize:`1.5rem`},children:d.title}),l===`authenticating`?U(V,{children:[H(dt,{className:`space-y-2 self-center font-light`,children:U(K,{spacing:2,alignItems:`center`,sx:{pt:`1rem`},children:[H(W,{component:`img`,sx:{height:`6rem`,objectFit:`contain`,mx:`auto`,mb:1},src:`/imgs/reload-image.svg`,alt:`Reload`}),H(q,{sx:{fontSize:`1.5rem`,fontWeight:500},children:`Reload to Finish`}),H(q,{children:`Reload to complete connection to Recce Cloud`})]})}),H(ut,{sx:{px:3,pb:3},children:H(G,{fullWidth:!0,color:`brand`,variant:`contained`,onClick:()=>{window.location.reload()},children:`Reload`})})]}):U(V,{children:[U(dt,{className:`space-y-2 font-light`,children:[H(q,{children:`To enable sharing, get your token from Recce Cloud and launch your local instance with it.`}),U(`ul`,{className:`list-inside list-disc`,children:[H(`li`,{children:`Share your instance with teammates via Recce Cloud.`}),H(`li`,{children:`Your instance will be securely and freely hosted for sharing.`}),r===`auth`&&H(`li`,{children:`This step is recommended but optional.`})]}),U(W,{sx:{display:`flex`,gap:1},children:[`More directions`,U(pt,{underline:`always`,sx:{color:`primary.main`,"&:focus":{outline:`none`}},href:`https://cloud.datarecce.io/connect-to-cloud`,target:`_blank`,children:[`here `,H(gt,{style:{display:`inline`}})]})]})]}),U(ut,{sx:{flexDirection:`column`,gap:1,px:3,pb:3},children:[U(G,{fullWidth:!0,color:`brand`,variant:`contained`,sx:{borderRadius:2,fontWeight:500},onClick:async()=>{u(`authenticating`);let{connection_url:e}=await ll(a);window.open(e,`_blank`)},children:[d.action,` `,H(gt,{style:{marginLeft:4}})]}),H(G,{fullWidth:!0,color:`neutral`,variant:`text`,size:`small`,sx:{borderRadius:2,fontWeight:500},onClick:f,children:r===`auth`?`Skip`:`Cancel`}),r===`auth`&&H(G,{fullWidth:!0,variant:`text`,size:`small`,sx:{borderRadius:2,fontWeight:500,color:`text.primary`},onClick:()=>{mt.set(`authState`,`ignored`,{expires:30}),u(`ignored`),f()},children:`Snooze for 30 days`})]})]})]})}export{vs as $,Bi as $t,fc as A,Oa as At,Gs as B,da as Bt,kc as C,Fr as Cn,eo as Ct,xc as D,za as Dt,Sc as E,kr as En,Ua as Et,$s as F,Sa as Ft,Ls as G,ra as Gt,Us as H,ca as Ht,Zs as I,xa as It,ks as J,Zi as Jt,Fs as K,ta as Kt,Ys as L,wa as Lt,cc as M,ka as Mt,sc as N,Aa as Nt,vc as O,Ia as Ot,ec as P,Ta as Pt,ys as Q,Hi as Qt,qs as R,Ca as Rt,Ic as S,Pr as Sn,to as St,wc as T,Mr as Tn,Va as Tt,Hs as U,oa as Ut,Ws as V,la as Vt,Rs as W,ia as Wt,Cs as X,Ki as Xt,Os as Y,Ji as Yt,xs as Z,Wi as Zt,Vc as _,zr as _n,Co as _t,il as a,_i as an,Ho as at,jc as b,Ir as bn,lo as bt,tl as c,di as cn,$ as ct,Xc as d,Jr as dn,Po as dt,Ii as en,gs as et,Kc as f,Zr as fn,Mo as ft,Uc as g,oi as gn,To as gt,Yc as h,ai as hn,Eo as ht,rl as i,vi as in,$o as it,lc as j,Ma as jt,dc as k,Pa as kt,$c as l,ui as ln,Fo as lt,Jc as m,Yr as mn,Do as mt,sl as n,ji as nn,Yo as nt,al as o,pi as on,Vo as ot,qc as p,Xr as pn,jo as pt,As as q,Qi as qt,ol as r,Ti as rn,Qo as rt,nl as s,fi as sn,zo as st,ul as t,Pi as tn,hs as tt,Qc as u,li as un,Io as ut,Hc as v,Br as vn,yo as vt,Tc as w,jr as wn,Ga as wt,Ac as x,Rr as xn,oo as xt,Rc as y,qr as yn,so as yt,Ks as z,ba as zt};
|
|
7
|
+
//# sourceMappingURL=AuthModal-DsPry4jZ.js.map
|