From 739a44baf86a841fd2832a2c78ebea1a0acd383f Mon Sep 17 00:00:00 2001 From: wcchang1115 Date: Wed, 15 Jan 2025 08:25:04 +0000 Subject: [PATCH] AUTO-COMMIT - build js statics to recce data/ --- recce/data/404.html | 2 +- .../_buildManifest.js | 0 .../_ssgManifest.js | 0 recce/data/_next/static/chunks/app/page-5889dcf26b2ed99d.js | 1 - recce/data/_next/static/chunks/app/page-6acdd1379ad0ae37.js | 1 + recce/data/index.html | 4 ++-- recce/data/index.txt | 4 ++-- 7 files changed, 6 insertions(+), 6 deletions(-) rename recce/data/_next/static/{KkYyE-Oc1zHufcA9YaMO3 => Vafzy2DPUUgyzh92-XPET}/_buildManifest.js (100%) rename recce/data/_next/static/{KkYyE-Oc1zHufcA9YaMO3 => Vafzy2DPUUgyzh92-XPET}/_ssgManifest.js (100%) delete mode 100644 recce/data/_next/static/chunks/app/page-5889dcf26b2ed99d.js create mode 100644 recce/data/_next/static/chunks/app/page-6acdd1379ad0ae37.js diff --git a/recce/data/404.html b/recce/data/404.html index 5cecc79a..c0a2958f 100644 --- a/recce/data/404.html +++ b/recce/data/404.html @@ -1 +1 @@ -404: This page could not be found.recce

404

This page could not be found.

\ No newline at end of file +404: This page could not be found.recce

404

This page could not be found.

\ No newline at end of file diff --git a/recce/data/_next/static/KkYyE-Oc1zHufcA9YaMO3/_buildManifest.js b/recce/data/_next/static/Vafzy2DPUUgyzh92-XPET/_buildManifest.js similarity index 100% rename from recce/data/_next/static/KkYyE-Oc1zHufcA9YaMO3/_buildManifest.js rename to recce/data/_next/static/Vafzy2DPUUgyzh92-XPET/_buildManifest.js diff --git a/recce/data/_next/static/KkYyE-Oc1zHufcA9YaMO3/_ssgManifest.js b/recce/data/_next/static/Vafzy2DPUUgyzh92-XPET/_ssgManifest.js similarity index 100% rename from recce/data/_next/static/KkYyE-Oc1zHufcA9YaMO3/_ssgManifest.js rename to recce/data/_next/static/Vafzy2DPUUgyzh92-XPET/_ssgManifest.js diff --git a/recce/data/_next/static/chunks/app/page-5889dcf26b2ed99d.js b/recce/data/_next/static/chunks/app/page-5889dcf26b2ed99d.js deleted file mode 100644 index 707d669e..00000000 --- a/recce/data/_next/static/chunks/app/page-5889dcf26b2ed99d.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{17812:function(e,n,t){Promise.resolve().then(t.bind(t,54965))},54965:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return rf}});var i=t(60088),l=t(95523),r=t(1401),s=t(51269),o=t(84185),a=t(26883),d=t(8539),c=t(62752),u=t(11801),h=t(32060),x=t(79698),m=t(65452),p=t(99345),f=t(84739),g=t(98459),v=t(27180),j=t(40843),y=t(16341),b=t(25658);let w='select * from {{ ref("mymodel") }}',k=(0,j.createContext)({sqlQuery:w,setSqlQuery:()=>{},primaryKeys:void 0,setPrimaryKeys:()=>{},isCustomQueries:!1,setCustomQueries:()=>{},baseSqlQuery:w,setBaseSqlQuery:()=>{}});function C(e){let{children:n}=e,[t,l]=j.useState(w),[r,s]=j.useState(w),[o,a]=j.useState(!1),[d,c]=j.useState();return(0,i.jsx)(k.Provider,{value:{setSqlQuery:l,sqlQuery:t,setPrimaryKeys:c,primaryKeys:d,isCustomQueries:o,setCustomQueries:a,baseSqlQuery:r,setBaseSqlQuery:s},children:n})}let _=()=>(0,j.useContext)(k),S=(0,j.createContext)({isNodesFetching:[],setIsNodesFetching:()=>{}});function z(e){let{children:n}=e,[t,l]=j.useState([]);return(0,i.jsx)(S.Provider,{value:{isNodesFetching:t,setIsNodesFetching:l},children:n})}var R=t(13943);function E(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=new Set,l={},r=(e,t)=>{if(!(t<0)&&(void 0===l[e]||!(l[e]>=t))){for(let i of(l[e]=t,n(e)))r(i,t-1);i.add(e)}};for(let n of e)r(n,t);return i}function T(){for(var e=arguments.length,n=Array(e),t=0;t{e.forEach(e=>{i.add(e)})}),i}var D=t(67407),L=t.n(D);function I(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;return E(n,n=>void 0===e.nodes[n]?[]:Object.keys(e.nodes[n].parents),t)}function O(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;return E(n,n=>void 0===e.nodes[n]?[]:Object.keys(e.nodes[n].children),t)}function M(e,n){let t=[],i=[];function l(e){return"base"===e?0:"current"===e?2:1}function r(e,n){let t=l(e.from),i=l(n.from);return ti?1:0}let s=null!=n?new Set(n):void 0;for(let n of Object.values(e.nodes).sort(r))(!s||s.has(n.id))&&t.push({id:n.id,position:{x:0,y:0},data:n,type:"customNode",targetPosition:R.Ly.Left,sourcePosition:R.Ly.Right});for(let n of Object.values(e.edges).sort(r))(!s||s.has(n.parent.id)&&s.has(n.child.id))&&i.push({id:n.id,type:"customEdge",source:n.parent.id,target:n.child.id,data:n});return A(t,i),F(Array.from(O(e,e.modifiedSet)),t,i)}let A=function(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"LR",i=new(L()).graphlib.Graph;i.setDefaultEdgeLabel(()=>({})),i.setGraph({rankdir:t}),e.forEach(e=>{i.setNode(e.id,{width:300,height:36})}),n.forEach(e=>{i.setEdge(e.source,e.target)}),L().layout(i),e.forEach(e=>{let n=i.node(e.id);return e.position={x:n.x-150,y:n.y-18},e})};function F(e,n,t){let i=new Set(e),l=new Set(t.filter(e=>i.has(e.source)&&i.has(e.target)).map(e=>e.id));return[n.map(e=>({...e,data:{...e.data,isHighlighted:i.has(e.id)}})),t.map(e=>({...e,data:{...e.data,isHighlighted:l.has(e.id)}}))]}function q(e,n){return n.map(n=>{let t=n.id===e;return{...n,data:{...n.data,isSelected:t}}})}function N(e,n){return n.map(n=>{let t=n.id===e;return{...n,data:{...n.data,isSelected:n.data.isSelected!==t}}})}function V(e,n){let t=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return n.map(n=>{let i=e.includes(n.id);return{...n,data:{...n.data,isSelected:t?i:n.data.isSelected||i}}})}function H(e,n){return e.map(e=>({...e,data:{...e.data,isSelected:!1,isActionMode:n,action:void 0}}))}let P={lineage:()=>["lineage"],checks:()=>["checks","list"],check:e=>["checks",e],runs:()=>["runs"],run:e=>["runs",e],runsAggregated:()=>["runs_aggregated"],flag:()=>["flag"]};var W=t(93677),K=t(38674);let J=K.env.NEXT_PUBLIC_API_URL?K.env.NEXT_PUBLIC_API_URL:window.location.origin;var B=t(22386);let U=W.default.create({baseURL:J}),Z=new B.S;async function Q(){return(await U.get("/api/info")).data}async function X(e){return(await U.get("/api/model/".concat(e))).data}var G=t(85259),Y=t(6604),$=t(34743),ee=t(69666),en=t(14720),et=t(36778),ei=t(84078),el=t(84387),er=t(11126),es=t(92556),eo=t(58540),ea=t.n(eo);async function ed(e,n,t){return(await U.post("/api/runs",{type:e,params:n,nowait:null==t?void 0:t.nowait})).data}async function ec(e,n){return(await U.get("/api/runs/".concat(e,"/wait"),{params:{timeout:n}})).data}async function eu(e){return await U.post("/api/runs/".concat(e,"/cancel"))}async function eh(e,n){return(await U.post("/api/checks/".concat(e,"/run"),{nowait:null==n?void 0:n.nowait})).data}async function ex(e,n,t){return(await U.post("/api/runs/search",{type:e,params:n,limit:t})).data}async function em(){return(await U.get("/api/runs")).data}async function ep(){return(await U.post("/api/runs/aggregate",{})).data}async function ef(){return(await U.get("/api/flag")).data}async function eg(){try{await U.post("/api/onboarding/completed")}catch(e){}}async function ev(){try{await U.post("/api/relaunch-hint/completed")}catch(e){}}let ej=()=>(0,y.a)({queryKey:P.flag(),queryFn:ef});var ey=t(16564),eb=t(38674);function ew(e){ey.j("[Web] multi_nodes_action",e)}function ek(e){ey.j("[Web] history_action",e)}function eC(e){ey.j("[Experiment] preview_change",e)}function e_(e){ey.j("[Experiment] preview_change",e)}function eS(e){ey.j("[Experiment] single_environment",e)}let ez=(0,j.createContext)({isActionAvailable:()=>!0});function eR(e){var n,t,l;let{children:r}=e,s=(0,y.a)({queryKey:P.lineage(),queryFn:Q}),o=(0,y.a)({queryKey:P.runsAggregated(),queryFn:ep}),a=(0,j.useMemo)(()=>{var e;let n=null===(e=s.data)||void 0===e?void 0:e.lineage;if(n&&n.base&&n.current)return function(e,n){let t={},i={},l=(e,n)=>({id:e,name:e,data:{},from:n,parents:{},children:{},isSelected:!1});for(let[n,i]of Object.entries(e.nodes))t[n]=l(n,"base"),i&&(t[n].data.base=i,t[n].name=null==i?void 0:i.name,t[n].resourceType=null==i?void 0:i.resource_type,t[n].packageName=null==i?void 0:i.package_name);for(let[e,i]of Object.entries(n.nodes))t[e]?t[e].from="both":t[e]=l(e,"current"),i&&(t[e].data.current=n.nodes&&n.nodes[e],t[e].name=null==i?void 0:i.name,t[e].resourceType=null==i?void 0:i.resource_type,t[e].packageName=null==i?void 0:i.package_name);for(let[n,l]of Object.entries(e.parent_map))for(let e of l){let l=t[n],r=t[e],s="".concat(e,"_").concat(n);if(!l||!r)continue;i[s]={id:s,from:"base",parent:r,child:l};let o=i[s];l.parents[e]=o,r.children[n]=o}for(let[e,l]of Object.entries(n.parent_map))for(let n of l){let l=t[e],r=t[n],s="".concat(n,"_").concat(e);if(!l||!r)continue;i[s]?i[s].from="both":i[s]={id:s,from:"current",parent:r,child:l};let o=i[s];l.parents[n]=o,r.children[e]=o}let r=[];for(let[e,n]of Object.entries(t))if("base"===n.from)n.changeStatus="removed",r.push(n.id);else if("current"===n.from)n.changeStatus="added",r.push(n.id);else{var s,o,a,d,c,u;let e=null==n?void 0:null===(a=n.data)||void 0===a?void 0:null===(o=a.base)||void 0===o?void 0:null===(s=o.checksum)||void 0===s?void 0:s.checksum,t=null==n?void 0:null===(u=n.data)||void 0===u?void 0:null===(c=u.current)||void 0===c?void 0:null===(d=c.checksum)||void 0===d?void 0:d.checksum;e&&t&&e!==t&&(n.changeStatus="modified",r.push(n.id))}for(let[e,n]of Object.entries(i))"base"===n.from?n.changeStatus="removed":"current"===n.from&&(n.changeStatus="added");return{nodes:t,edges:i,modifiedSet:r,manifestMetadata:{base:e.manifest_metadata||void 0,current:n.manifest_metadata||void 0},catalogMetadata:{base:e.catalog_metadata||void 0,current:n.catalog_metadata||void 0}}}(n.base,n.current)},[s.data]),d=null===(n=s.error)||void 0===n?void 0:n.message,{lineage:c,sqlmesh:u,demo:h,review_mode:x,cloud_mode:m,file_mode:p,filename:f,adapter_type:g,git:v,pull_request:w,support_tasks:k}=s.data||{},C=null==c?void 0:null===(t=c.base)||void 0===t?void 0:t.manifest_metadata,_=null==c?void 0:null===(l=c.current)||void 0===l?void 0:l.manifest_metadata,{connectionStatus:S,connect:z,envStatus:R}=function(){let e=(0,G.p)(),n=(0,j.useRef)({ws:void 0,status:"pending"}),[t,i]=(0,j.useState)("pending"),[l,r]=(0,j.useState)(void 0);n.current.status=t;let s=(0,b.NL)(),o=()=>{s.invalidateQueries({queryKey:P.lineage()}),s.invalidateQueries({queryKey:P.checks()}),s.invalidateQueries({queryKey:P.runs()})},a=()=>{let t=new WebSocket("".concat(J.replace(/(http)(s)?\:\/\//,"ws$2://"),"/api/ws"));n.current.ws=t,t.onopen=()=>{t.send("ping")},t.onmessage=t=>{if("pong"===t.data){"disconnected"===n.current.status&&o(),i("connected");return}try{let n=JSON.parse(t.data);if("refresh"===n.command){let{eventType:t,srcPath:i}=n.event,[l,r]=i.split("/").slice(-2),s=ea().parse(r).name;e({description:"Detected ".concat(l," ").concat(s," ").concat(t),status:"info",variant:"left-accent",position:"bottom-right",duration:5e3,isClosable:!0}),o()}else"relaunch"===n.command&&r("relaunch")}catch(e){console.error(e)}},t.onerror=e=>{console.error(e)},t.onclose=()=>{i(e=>"connected"===e?"disconnected":e),n.current.ws=void 0}};return(0,j.useEffect)(()=>{let e=n.current;return a(),()=>{e.ws&&e.ws.close()}},[]),{connectionStatus:t,connect:a,envStatus:l}}(),{data:E,isLoading:T}=ej(),{onClose:D}=(0,Y.q)(),[L,I]=(0,j.useState)(!1),O=(0,b.NL)(),M=(0,j.useCallback)(e=>{if(k){var n;return null===(n=k[e])||void 0===n||n}return!0},[k]);return(0,j.useEffect)(()=>{T||("relaunch"===R&&(null==E?void 0:E.single_env_onboarding)&&(null==E?void 0:E.show_relaunch_hint)?(I(!0),eS({action:"target_base_added"})):I(!1))},[E,R,T]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(ez.Provider,{value:{lineageGraph:a,retchLineageGraph:()=>{o.refetch()},envInfo:{adapterType:g,git:v,pullRequest:w,dbt:{base:C,current:_},sqlmesh:u},reviewMode:x,cloudMode:m,fileMode:p,fileName:f,isDemoSite:h,error:d,supportTasks:k,isActionAvailable:M,isLoading:s.isLoading,runsAggregated:o.data,refetchRunsAggregated:()=>{o.refetch()}},children:r}),(0,i.jsxs)($.u_,{isOpen:"disconnected"===S,onClose:()=>{},isCentered:!0,children:[(0,i.jsx)(ee.Z,{}),(0,i.jsxs)(en.h,{children:[(0,i.jsx)(et.x,{children:"Server Disconnected"}),(0,i.jsx)(ei.f,{children:(0,i.jsx)(el.x,{children:"The server connection has been lost. Please restart the Recce server and try again."})}),(0,i.jsx)(er.m,{children:(0,i.jsx)(es.z,{colorScheme:"blue",onClick:()=>{z()},children:"Retry"})})]})]}),(null==E?void 0:E.single_env_onboarding)&&(0,i.jsxs)($.u_,{isOpen:L,onClose:()=>{D(),ev(),O.invalidateQueries({queryKey:P.flag()})},isCentered:!0,children:[(0,i.jsx)(ee.Z,{}),(0,i.jsxs)(en.h,{children:[(0,i.jsx)(et.x,{children:"Target-base Added"}),(0,i.jsx)(ei.f,{children:(0,i.jsx)(el.x,{children:"Please restart the Recce server."})}),(0,i.jsx)(er.m,{children:(0,i.jsx)(es.z,{colorScheme:"blue",onClick:()=>{D(),ev(),O.invalidateQueries({queryKey:P.flag()})},children:"Got it!"})})]})]})]})}let eE=()=>(0,j.useContext)(ez),eT=()=>{let{runsAggregated:e,refetchRunsAggregated:n}=eE();return[e,n]};var eD=t(65050);let eL=e=>{let{isOpen:n,onClose:t,onExecute:r,type:s,title:a,params:d,RunForm:c}=e,[u,h]=(0,j.useState)(d),[x,m]=(0,j.useState)(!1);return(0,i.jsxs)($.u_,{isOpen:n,onClose:t,size:"6xl",scrollBehavior:"inside",children:[(0,i.jsx)(ee.Z,{}),(0,i.jsxs)(en.h,{overflowY:"auto",height:"75%",children:[(0,i.jsx)(et.x,{children:a}),(0,i.jsx)(eD.o,{}),(0,i.jsx)(ei.f,{p:"0px",h:"100%",overflow:"auto",borderY:"1px solid lightgray",children:(0,i.jsx)(l.x,{style:{contain:"layout"},children:c&&(0,i.jsx)(c,{params:u,onParamsChanged:h,setIsReadyToExecute:m})})}),(0,i.jsx)(er.m,{children:(0,i.jsx)(o.k,{gap:"10px",children:(0,i.jsx)(es.z,{isDisabled:!x,colorScheme:"blue",onClick:()=>{r(s,u)},children:"Execute"})})})]})]})};var eI=t(78473),eO=t(20413),eM=t(94134),eA=t(61381),eF=t(90788),eq=t(82821),eN=t.n(eq);function eV(e,n){let t=[];return e.forEach(e=>{t.some(n=>n.name===e.name)||t.push(e)}),n.forEach(e=>{t.some(n=>n.name===e.name)||t.push(e)}),t}var eH=e=>{var n;let{lineageGraph:t}=eE(),[i,l]=(0,j.useState)([]),[r,s]=(0,j.useState)(),[o,a]=(0,j.useState)(!0),[d,c]=(0,j.useState)(null),u=eN().find(null==t?void 0:t.nodes,{name:e}),h=(0,j.useMemo)(()=>u?function(e){function n(e){return e&&e.columns?Object.values(e.columns):[]}return eV(n(e.data.base),n(e.data.current))}(u):[],[u]),x=u?null===(n=u.data.current)||void 0===n?void 0:n.primary_key:void 0;return(0,j.useEffect)(()=>{let e=async()=>{try{let e=(await X(null==u?void 0:u.id)).model;if(!e||!e.base.columns||!e.current.columns){l([]);return}s(e.current.primary_key);let n=Object.values(e.base.columns),t=Object.values(e.current.columns);l(eV(n,t))}catch(e){c(e)}};h.length>0?(l(h),s(x)):(null==u?void 0:u.id)===void 0?l([]):e(),a(!1)},[null==u?void 0:u.id,h,x]),{columns:i,primaryKey:r,isLoading:o,error:d}};function eP(e){return["CHAR","VARCHAR","TINYTEXT","TEXT","MEDIUMTEXT","LONGTEXT","NCHAR","NVARCHAR","VARCHAR2","NVARCHAR2","CLOB","NCLOB","VARCHAR(MAX)","XML","JSON","BOOLEAN","TINYINT(1)","BIT","NUMBER(1)","BOOL"].includes(e.toUpperCase())}function eW(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())}var eK=t(77125),eJ=t(94659),eB=t(42921);function eU(e){let n=e>0&&e<=.001,t=e<1&&e>=.999,i=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e;return function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en-US",t=arguments.length>2?arguments[2]:void 0;return"number"!=typeof e?e:new Intl.NumberFormat(n,t).format(e)}(n,"en-US",{style:"percent",minimumFractionDigits:1})};if(n){let e=i(.001);return"<".concat(e)}if(t){let e=i(.999);return">".concat(e)}return i()}function eZ(e){if("number"!=typeof e)return e;{let n=Math.abs(e),t=n>=.01,i=n>=1e6,l=n>=1e9,r=n>=1e15;if(r||n>=1e12)return new Intl.NumberFormat("en-US",{style:"unit",unit:"liter",unitDisplay:"narrow",maximumFractionDigits:r?0:2}).format(e/1e12).replace("L","T");if(l||i||n>=1e3){let n={base:l?1e9:i?1e6:1e3,unit:l?"B":i?"M":"K"};return new Intl.NumberFormat("en-US",{style:"unit",unit:"liter",unitDisplay:"narrow",maximumFractionDigits:1}).format(e/n.base).replace("L",n.unit)}return n>=1?new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(e):new Intl.NumberFormat("en-US",{maximumFractionDigits:t?3:2,notation:t||0===n?"standard":"scientific"}).format(e)}}let eQ="#63B3ED",eX="#F6AD55",eG="".concat(eQ,"A5"),eY="".concat(eX,"A5");function e$(e){let{color:n}=e;return(0,i.jsx)(l.x,{display:"inline-block",w:"10px",h:"10px",bgColor:n,mr:"2",borderRadius:"sm"})}function e0(e){let{data:n,hideAxis:t=!1,animation:l=!1}=e;eJ.kL.register(eJ.ZL,eJ.RM,eJ.f$,eJ.uw,eJ.Dx,eJ.De,eJ.u);let r=function(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],{...t}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{title:i,datasets:l,type:r,samples:s=0,binEdges:o}=e,[a,d]=l,c="datetime"===r;return{responsive:!0,maintainAspectRatio:!1,plugins:{legend:{reverse:!0},title:{display:!0,text:i,font:{size:20}},tooltip:{mode:"index",intersect:!1,callbacks:{title(e){let[{dataIndex:n,datasetIndex:t}]=e,i=e5(o,n);return"".concat(c?"Date Range":"string"===r?"Text Length":"Value Range","\n").concat(i)},label(e){let{datasetIndex:n,dataIndex:t,dataset:{label:i}}=e,l=0===n?d.counts:a.counts,r=eU(l[t]/s),o=l[t];return"".concat(i,": ").concat(o," (").concat(r,")")}}}},scales:function(e){let{datasets:n,min:t=0,max:i=0,type:l,binEdges:r}=e,s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],[o,a]=n,d=Math.max(...a.counts,...o.counts),c=r.map((e,n)=>e5(r,n)).slice(0,-1);return{x:"datetime"===l?{display:!s,type:"timeseries",min:t,max:i,adapters:{date:{}},time:{minUnit:"day"},grid:{display:!1},ticks:{minRotation:30,maxRotation:30,maxTicksLimit:8}}:{display:!s,type:"category",grid:{display:!1},ticks:{callback:(e,n)=>c[n]},stacked:!0},y:{display:!s,type:"linear",max:d,border:{dash:[2,2]},grid:{color:"lightgray"},ticks:{maxTicksLimit:8,callback:function(e,n){return eZ(e)}},beginAtZero:!0}}}(e,n),...t}}(n,t,{animation:l}),s=function(e){let{datasets:n,type:t,binEdges:i}=e,[l,r]=n,s=e1(t,i,"Current",eG,r),o=e1(t,i,"Base",eY,l);return{labels:i.map((e,n)=>e5(i,n)).slice(0,-1),datasets:[s,o]}}(n);return(0,i.jsx)(eB.kL,{type:"bar",options:r,data:s,plugins:[]})}function e1(e,n,t,i,l){let{counts:r=[]}=l;return{label:t,data:"datetime"===e?r.map((e,t)=>({x:n[t],y:e})):r,backgroundColor:i,borderColor:i,hoverBackgroundColor:i,borderWidth:0,categoryPercentage:1,barPercentage:1,xAxisID:"x"}}function e5(e,n){let t=e[n],i=e[n+1],l=eZ(t),r=eZ(i);return"".concat(l," - ").concat(r)}let e2=(0,eK.G)((e,n)=>{let{backgroundColor:t="white",blockSize:r,children:s,...o}=e;return(0,i.jsx)(l.x,{ref:n,...o,overflowY:"auto",overflowX:"hidden",children:(0,i.jsx)(l.x,{backgroundColor:t,height:"100%",blockSize:r,children:s})})}),e4=(0,eK.G)(function(e,n){var t,r,s,a,d,c;let{run:x}=e,m=x.params,p=null===(t=x.result)||void 0===t?void 0:t.base,f=null===(r=x.result)||void 0===r?void 0:r.current,g=null===(s=x.result)||void 0===s?void 0:s.min,v=null===(a=x.result)||void 0===a?void 0:a.max,j=null===(d=x.result)||void 0===d?void 0:d.bin_edges;return p&&f?(0,i.jsx)(o.k,{direction:"column",height:"100%",children:(0,i.jsx)(e2,{ref:n,height:"100%",children:(0,i.jsxs)(u.U,{children:[(0,i.jsx)(h.L,{}),(0,i.jsx)(l.x,{w:"80%",h:"35vh",m:"4",children:(0,i.jsx)(e0,{data:{title:"Model ".concat(m.model,".").concat(m.column_name),type:(null===(c=x.params)||void 0===c?void 0:c.column_type)||"",datasets:[p,f],min:g,max:v,samples:p.total,binEdges:j}})}),(0,i.jsx)(h.L,{})]})})}):(0,i.jsx)("div",{children:"Loading..."})});var e6=t(21129);t(91751);var e3=t(30614);let e9=(0,eK.G)((e,n)=>{let{...t}=e;return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(e3.ZP,{ref:n,...t})})});function e8(){return(0,i.jsx)(o.k,{h:"35px",alignItems:"center",justifyContent:"center",bg:"gray.100",style:{textAlign:"center",gridColumn:"1/-1"},children:(0,i.jsx)(el.x,{fontWeight:"600",children:" No rows"})})}t(24550);var e7=t(8);function ne(e,n){let t=function(e,n){let t=[...e],i=[...n],l=[];for(;t.length>0&&i.length>0;)if(l.includes(t[0]))t.shift();else if(l.includes(i[0]))i.shift();else if(t[0]===i[0])l.push(t[0]),t.shift(),i.shift();else if(i.includes(t[0])){let e=i.indexOf(t[0]);for(let n=0;n{l.includes(e)||l.push(e)}),i.forEach(e=>{l.includes(e)||l.push(e)}),l}(e,n),i={};for(let l of t)e.includes(l)?n.includes(l)?i[l]=void 0:i[l]="removed":i[l]="added";let l={};e.forEach((e,n)=>{l[e]=n});let r=-1;for(let e of t){let n=l[e];void 0!==n&&(n>r?r=n:i[e]="reordered")}return i}function nn(e,n){let t=[];for(let i of n){let n=e.findIndex(e=>e.name===i);if(n<0)throw Error("Column ".concat(i," not found"));t.push(n)}return t}function nt(e,n,t){let i={};if(0===n.length)return JSON.stringify({_index:t._index});for(let l of n)i[e[l].name]=t[l];return JSON.stringify(i)}function ni(e){let{name:n,columnStatus:t,onPrimaryKeyChange:r,onPinnedColumnsChange:a,...d}=e,c=d.primaryKeys||[],u=d.pinnedColumns||[],h=c.includes(n),x=u.includes(n);return"index"===n?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(o.k,{alignItems:"center",gap:"10px",className:"grid-header",children:[(0,i.jsx)(l.x,{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:n}),"added"!==t&&"removed"!==t&&r&&(0,i.jsx)(s.J,{className:h?"close-icon":"key-icon",display:h?"block":"none",cursor:"pointer",as:h?e7.ven:e7.MhP,onClick:h?()=>{let e=c.filter(e=>e!==n);r&&r(e)}:()=>{let e=[...c.filter(e=>"index"!==e),n];r&&r(e)}}),!h&&a&&(0,i.jsx)(s.J,{className:x?"unpin-icon":"pin-icon",display:x?"block":"none",cursor:"pointer",as:x?e7.$kI:e7.oJP,onClick:x?()=>{let e=u.filter(e=>e!==n);a&&a(e)}:()=>{let e=[...u,n];a&&a(e)}})]})}let nl=e=>{let n;let t=!1;return"boolean"==typeof e?n=e.toString():""===e?(n="(empty)",t=!0):null==e?(n="(null)",t=!0):n=e,[n,t]},nr=e=>{let{row:n,column:t}=e;if(!n.hasOwnProperty(t.key))return(0,i.jsx)(el.x,{style:{color:"gray"},children:"-"});let[l,r]=nl(n[t.key]);return(0,i.jsx)(el.x,{style:{color:r?"gray":"inherit"},children:l})};function ns(e,n,t){let l=e||{columns:[],data:[]},r=n||{columns:[],data:[]},s=(null==t?void 0:t.primaryKeys)||[],o=(null==t?void 0:t.pinnedColumns)||[],a=(null==t?void 0:t.changedOnly)||!1,d=[],c=function(e,n){let t={};return Object.entries(ne(e.columns.map(e=>e.name),n.columns.map(e=>e.name))).map(i=>{let[l,r]=i;t[l]={status:r,baseColumnIndex:e.columns.findIndex(e=>e.name===l),currentColumnIndex:n.columns.findIndex(e=>e.name===l)}}),t}(l,r),u={},h={},x=!1,m=!1;if(0===s.length)l.data.forEach((e,n)=>{e._index=n+1,u[JSON.stringify({_index:n+1})]=e}),r.data.forEach((e,n)=>{e._index=n+1,h[JSON.stringify({_index:n+1})]=e});else{let e=nn(l.columns,s);l.data.forEach((n,t)=>{let i=nt(l.columns,e,n);i in u&&(x=!0),u[i]=n}),e=nn(r.columns,s),r.data.forEach((n,t)=>{let i=nt(r.columns,e,n);i in h&&(m=!0),h[i]=n})}let p=ne(Object.keys(u),Object.keys(h)),f={added:0,removed:0,modified:0},g=Object.entries(p).map(e=>{let[n,t]=e,i=u[n],o=h[n],a=JSON.parse(n);if(i&&l.columns.forEach((e,n)=>{s.includes(e.name)||(a["base__".concat(e.name)]=i[n])}),o&&r.columns.forEach((e,n)=>{s.includes(e.name)||(a["current__".concat(e.name)]=o[n])}),i){if(o){for(let[e,n]of Object.entries(c))"index"===e||s.includes(e)||n.baseColumnIndex<0||n.currentColumnIndex<0||eN().isEqual(i[n.baseColumnIndex],o[n.currentColumnIndex])||(a.__status="modified",n.status="modified");"modified"===a.__status&&f.modified++}else a.__status="removed",f.removed++}else a.__status="added",f.added++;return a});a&&(g=g.filter(e=>"added"===e.__status||"removed"===e.__status||"modified"===e.__status));let v=(e,n)=>{let l="added"===n?"diff-header-added":"removed"===n?"diff-header-removed":void 0,r=t=>{let i=t.__status;if("removed"===i)return"diff-cell-removed";if("added"===i)return"diff-cell-added";if("added"===n);else if("removed"===n);else if(!eN().isEqual(t["base__".concat(e)],t["current__".concat(e)]))return"diff-cell-modified"};return{headerCellClass:l,name:(0,i.jsx)(ni,{name:e,columnStatus:n,...t}),children:[{key:"base__".concat(e),name:"Base",renderEditCell:e3.Ug,headerCellClass:l,cellClass:r,renderCell:nr,size:"auto"},{key:"current__".concat(e),name:"Current",renderEditCell:e3.Ug,headerCellClass:l,cellClass:r,renderCell:nr,size:"auto"}]}};return 0===s.length?d.push({key:"_index",width:50,maxWidth:100,name:"",cellClass:"index-column"}):s.forEach(e=>{let n=c[e].status||"";d.push({key:"".concat(e),name:(0,i.jsx)(ni,{name:e,columnStatus:n,...t}),frozen:!0,cellClass:e=>{if(e.__status)return"diff-header-".concat(e.__status)},renderCell:nr})}),o.forEach(e=>{let n=c[e].status||"";"index"===e||s.includes(e)||d.push(v(e,n))}),Object.entries(c).forEach(e=>{let[n,t]=e,i=t.status||"";"index"===n||s.includes(n)||o.includes(n)||a&&f.modified>0&&"added"!==i&&"removed"!==i&&"modified"!==i||d.push(v(n,i))}),{columns:d,rows:g,invalidPKeyBase:x,invalidPKeyCurrent:m}}let no=(0,eK.G)((e,n)=>{var t;let{run:l,viewOptions:r,onViewOptionsChanged:s}=e,o=l.result;l.params;let a=(0,j.useMemo)(()=>(null==r?void 0:r.pinned_columns)||[],[r]),d=((null==o?void 0:null===(t=o.current)||void 0===t?void 0:t.columns)||[]).find(e=>"column_name"===e.name.toLowerCase()),c=(null==d?void 0:d.name)||"column_name",u=(0,j.useMemo)(()=>ns(null==o?void 0:o.base,null==o?void 0:o.current,{primaryKeys:[c],pinnedColumns:a,onPinnedColumnsChange:e=>{s&&s({...r,pinned_columns:e})}}),[o,c,a,r,s]);return 0===u.columns.length?(0,i.jsx)(e6.M,{height:"100%",children:"No data"}):(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(e9,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:u.columns,rows:u.rows,defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})})});function na(e){let{name:n,columnStatus:t,onPrimaryKeyChange:r,onPinnedColumnsChange:a,...d}=e,c=d.primaryKeys||[],u=d.pinnedColumns||[],h=c.includes(n),x=u.includes(n);return"index"===n?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(o.k,{alignItems:"center",gap:"10px",className:"grid-header",children:[(0,i.jsx)(l.x,{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:n}),!h&&a&&(0,i.jsx)(s.J,{className:x?"unpin-icon":"pin-icon",display:x?"block":"none",cursor:"pointer",as:x?e7.$kI:e7.oJP,onClick:x?()=>{let e=u.filter(e=>e!==n);a&&a(e)}:()=>{let e=[...u,n];a&&a(e)}})]})}function nd(e,n,t){let l=(null==t?void 0:t.pinnedColumns)||[],r=(null==t?void 0:t.changedOnly)||!1,s=[],o=function(e){let n={};return e.columns.map((e,t)=>{n[e.name]={index:t}}),n}(e),a={},d={};if(0===n.length)throw Error("Primary keys are required");let c=function(e,n){let t=[];for(let i of n){let n=e.findIndex(e=>e.name===i);if(n<0)throw Error("Column ".concat(i," not found"));t.push(n)}return t}(e.columns,n),u=(o.in_a||o.IN_A).index,h=(o.in_b||o.IN_B).index;e.data.forEach((n,t)=>{let i=function(e,n,t){let i={};if(0===n.length)return JSON.stringify({_index:t._index});for(let l of n)i[e[l].name]=t[l];return JSON.stringify(i)}(e.columns,c,n);n[u]&&(a[i]=n),n[h]&&(d[i]=n)});let x=ne(Object.keys(a),Object.keys(d)),m={added:0,removed:0,modified:0},p=Object.entries(x).map(t=>{let[i,l]=t,r=a[i],s=d[i],c=JSON.parse(i);if(r&&e.columns.forEach((e,t)=>{n.includes(e.name)||(c["base__".concat(e.name)]=r[t])}),s&&e.columns.forEach((e,t)=>{n.includes(e.name)||(c["current__".concat(e.name)]=s[t])}),r){if(s)for(let[e,t]of Object.entries(o))!("index"===e||n.includes(e))&&(eN().isEqual(r[t.index],s[t.index])||(c.__status="modified",t.status="modified"));else c.__status="removed",m.removed++}else c.__status="added",m.added++;return"modified"===c.__status&&m.modified++,c});r&&(p=p.filter(e=>"added"===e.__status||"removed"===e.__status||"modified"===e.__status));let f=(e,n)=>{let l="added"===n?"diff-header-added":"removed"===n?"diff-header-removed":void 0,r=t=>{let i=t.__status;if("removed"===i)return"diff-cell-removed";if("added"===i)return"diff-cell-added";if("added"===n);else if("removed"===n);else if(!eN().isEqual(t["base__".concat(e)],t["current__".concat(e)]))return"diff-cell-modified"};return{headerCellClass:l,name:(0,i.jsx)(na,{name:e,columnStatus:n,...t}),children:[{key:"base__".concat(e),name:"Base",renderEditCell:e3.Ug,headerCellClass:l,cellClass:r,renderCell:nr,size:"auto"},{key:"current__".concat(e),name:"Current",renderEditCell:e3.Ug,headerCellClass:l,cellClass:r,renderCell:nr,size:"auto"}]}};return n.forEach(e=>{let n=o[e].status||"";s.push({key:"".concat(e),name:(0,i.jsx)(na,{name:e,columnStatus:n,...t}),frozen:!0,cellClass:e=>{if(e.__status)return"diff-header-".concat(e.__status)},renderCell:nr})}),l.forEach(e=>{let t=o[e].status||"";n.includes(e)||s.push(f(e,t))}),Object.entries(o).forEach(e=>{let[t,i]=e,o=i.status||"";"in_a"===t||"in_b"===t||n.includes(t)||l.includes(t)||r&&m.modified>0&&"added"!==o&&"removed"!==o&&"modified"!==o||s.push(f(t,o))}),{columns:s,rows:p}}var nc=t(80906),nu=t(89494),nh=t(13329);let nx=e=>{let{run:n,warnings:t,viewOptions:r,onAddToChecklist:s,onViewOptionsChanged:a}=e;return(0,i.jsxs)(o.k,{borderBottom:"1px solid lightgray",justifyContent:"flex-end",gap:"5px",alignItems:"center",px:"10px",bg:t&&t.length>0?"orange.100":"inherit",children:[(0,i.jsx)(nu.g,{alignItems:"flex-start",spacing:0,children:t&&t.map((e,n)=>(0,i.jsxs)(l.x,{children:[(0,i.jsx)(nc.a,{color:"orange.600"})," ",e]},n))}),(0,i.jsx)(h.L,{minHeight:"32px"}),(0,i.jsx)(nh.X,{isChecked:null==r?void 0:r.changed_only,onChange:()=>{let e=!(null==r?void 0:r.changed_only);a&&a({...r,changed_only:e})},children:"Changed only"}),s&&(0,i.jsx)(es.z,{marginBlock:"5px",size:"sm",colorScheme:"blue",onClick:()=>s(n),children:"Add to Checklist"})]})},nm=(e,n)=>{var t,l,r,s,a,d;let{run:c,onAddToChecklist:u,viewOptions:h,onViewOptionsChanged:x}=e,m=(0,j.useMemo)(()=>(null==h?void 0:h.primary_keys)||[],[h]),p=(0,j.useMemo)(()=>(null==h?void 0:h.changed_only)||!1,[h]),f=(0,j.useMemo)(()=>(null==h?void 0:h.pinned_columns)||[],[h]),g=(0,j.useMemo)(()=>{var e,n;return ns(null==c?void 0:null===(e=c.result)||void 0===e?void 0:e.base,null==c?void 0:null===(n=c.result)||void 0===n?void 0:n.current,{changedOnly:p,primaryKeys:m,onPrimaryKeyChange:e=>{x&&x({...h,primary_keys:e})},pinnedColumns:f,onPinnedColumnsChange:e=>{x&&x({...h,pinned_columns:e})}})},[c,h,p,m,f,x]),v=(0,j.useMemo)(()=>{let e=m.join(", ");return g.invalidPKeyBase&&g.invalidPKeyCurrent?"Warning: The primary key '".concat(e,"' is not unique in the base and current environments"):g.invalidPKeyBase?"Warning: The primary key '".concat(e,"' is not unique in the base environment"):g.invalidPKeyCurrent?"Warning: The primary key '".concat(e,"' is not unique in the current environment"):void 0},[g.invalidPKeyBase,g.invalidPKeyCurrent,m]),y=(null===(l=c.result)||void 0===l?void 0:null===(t=l.current)||void 0===t?void 0:t.limit)||0,b=y>0&&((null==c?void 0:null===(s=c.result)||void 0===s?void 0:null===(r=s.current)||void 0===r?void 0:r.more)||(null==c?void 0:null===(d=c.result)||void 0===d?void 0:null===(a=d.base)||void 0===a?void 0:a.more))?"Warning: Displayed results are limited to ".concat(y.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,w=[];return(v&&w.push(v),b&&w.push(b),0===g.columns.length)?(0,i.jsx)(e6.M,{height:"100%",children:"No data"}):p&&0===g.rows.length?(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nx,{run:c,viewOptions:h,onAddToChecklist:u,onViewOptionsChanged:x,warnings:w}),(0,i.jsx)(e6.M,{height:"100%",children:"No change"}),";"]}):(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nx,{run:c,viewOptions:h,onAddToChecklist:u,onViewOptionsChanged:x,warnings:w}),(0,i.jsx)(e9,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:g.columns,rows:g.rows,renderers:{noRowsFallback:(0,i.jsx)(e8,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})},np=(e,n)=>{var t,l,r,s;let{run:a,onAddToChecklist:d,viewOptions:c,onViewOptionsChanged:u}=e,h=(0,j.useMemo)(()=>(null==c?void 0:c.changed_only)||!1,[c]),x=(0,j.useMemo)(()=>(null==c?void 0:c.pinned_columns)||[],[c]),m=(0,j.useMemo)(()=>{var e,n;if(!(null===(e=a.result)||void 0===e?void 0:e.diff)||!(null==a?void 0:null===(n=a.params)||void 0===n?void 0:n.primary_keys))return{columns:[],rows:[]};let t=a.params.primary_keys;return nd(null==a?void 0:a.result.diff,t,{changedOnly:h,pinnedColumns:x,onPinnedColumnsChange:e=>{u&&u({...c,pinned_columns:e})}})},[a,c,h,x,u]),p=(null===(l=a.result)||void 0===l?void 0:null===(t=l.diff)||void 0===t?void 0:t.limit)||0,f=p>0&&(null==a?void 0:null===(s=a.result)||void 0===s?void 0:null===(r=s.diff)||void 0===r?void 0:r.more)?"Warning: Displayed results are limited to ".concat(p.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,g=[];return(f&&g.push(f),0===m.columns.length)?(0,i.jsx)(e6.M,{height:"100%",children:"No data"}):h&&0===m.rows.length?(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nx,{run:a,viewOptions:c,onAddToChecklist:d,onViewOptionsChanged:u,warnings:g}),(0,i.jsx)(e6.M,{height:"100%",children:"No change"})]}):(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nx,{run:a,viewOptions:c,onAddToChecklist:d,onViewOptionsChanged:u,warnings:g}),(0,i.jsx)(e9,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:m.columns,rows:m.rows,renderers:{noRowsFallback:(0,i.jsx)(e8,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})},nf=(0,eK.G)((e,n)=>{var t;if((null===(t=e.run)||void 0===t?void 0:t.result)!==void 0&&null!==e.run.result.diff&&void 0!==e.run.result.diff){let t=(0,eK.G)(np);return(0,i.jsx)(t,{...e,ref:n})}{let t=(0,eK.G)(nm);return(0,i.jsx)(t,{...e,ref:n})}});function ng(e){let{name:n,pinnedColumns:t=[],onPinnedColumnsChange:r=()=>{}}=e,a=t.includes(n);return(0,i.jsxs)(o.k,{className:"grid-header",alignItems:"center",children:[(0,i.jsx)(l.x,{flex:1,children:n}),(0,i.jsx)(s.J,{className:a?"unpin-icon":"pin-icon",display:a?"block":"none",cursor:"pointer",as:a?e7.$kI:e7.oJP,onClick:a?()=>{r(t.filter(e=>e!==n))}:()=>{r([...t,n])}})]})}let nv=(0,eK.G)((e,n)=>{let{run:t,viewOptions:r,onViewOptionsChanged:s,onAddToChecklist:a}=e,d=(0,j.useMemo)(()=>(null==r?void 0:r.pinned_columns)||[],[r]),c=null==t?void 0:t.result,u=(0,j.useMemo)(()=>c?function(e,n){let t=[],l=n.pinnedColumns||[],r=(e,t)=>({key:String(e),name:(0,i.jsx)(ng,{name:t,...n}),width:"auto",renderCell:nr});return t.push({key:"_index",name:"",width:50,cellClass:"index-column"}),l.forEach(n=>{let i=eN().findIndex(e.columns,e=>e.name===n);i<0||t.push(r(i,n))}),e.columns.forEach((e,n)=>{l.includes(e.name)||t.push(r(n,e.name))}),e.data.forEach((e,n)=>{e._index=n+1}),{columns:t,rows:e.data}}(c,{pinnedColumns:d,onPinnedColumnsChange:e=>{s&&s({...r,pinned_columns:e})}}):{rows:[],columns:[]},[c,d,r,s]);if(0===u.columns.length)return(0,i.jsx)(e6.M,{height:"100%",children:"No data"});let x=(null==c?void 0:c.limit)||0,m=x>0&&(null==c?void 0:c.more)?"Warning: Displayed results are limited to ".concat(x.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,p=a||m;return(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[p&&(0,i.jsxs)(o.k,{borderBottom:"1px solid lightgray",alignItems:"center",gap:"5px",px:"10px",bg:m?"orange.100":"inherit",children:[m&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nc.a,{color:"orange.600",alignSelf:"center"})," ",(0,i.jsx)(l.x,{children:m})]}),(0,i.jsx)(h.L,{minHeight:"32px"}),a&&(0,i.jsx)(es.z,{marginBlock:"5px",size:"sm",colorScheme:"blue",onClick:()=>a(t),children:"Add to Checklist"})]}),(0,i.jsx)(e9,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:u.columns,rows:u.rows,renderers:{noRowsFallback:(0,i.jsx)(e8,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})});function nj(e,n){if(e=.1?t.toFixed(1):" <0.1 ","%")}if(!(e>n))return"0 %";{let t=(e-n)/e*100;return"-".concat(t>=.1?t.toFixed(1):" <0.1 ","%")}}var ny=t(22442),nb=t.n(ny);let nw=(0,eK.G)(function(e,n){let{run:t}=e;function l(e){if(e.base===e.current);else if(e.basee.current||"N/A"===e.current)return"column-body-removed";return"column-body-normal"}let r=t.result||{},s=Object.keys(t.result||{}).map(e=>{let n=r[e],t=nb()(null==n?void 0:n.base)?null==n?void 0:n.base:null,i=nb()(null==n?void 0:n.curr)?null==n?void 0:n.curr:null,l="No Change";return null!==t&&null!==i?l=t!==i?nj(t,i):"No Change":t===i?l="N/A":null===t?l="Added":null===i&&(l="Removed"),{name:e,base:null===t?"N/A":Number(t),current:null===i?"N/A":Number(i),delta:l}});return 0===s.length?(0,i.jsx)(e6.M,{bg:"rgb(249,249,249)",height:"100%",children:"No nodes matched"}):(0,i.jsx)(o.k,{direction:"column",children:Object.keys(r).length>0&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(e9,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:[{key:"name",name:"Name",cellClass:l},{key:"base",name:"Base Rows",cellClass:l},{key:"current",name:"Current Rows",cellClass:l},{key:"delta",name:"Delta",cellClass:l}],rows:s,renderers:{noRowsFallback:(0,i.jsx)(e8,{})},className:"rdg-light",enableScreenshot:!0})})})});var nk=t(62019),nC=t(429);let n_="#63B3ED";function nS(e,n){let t=n?10:e.counts.length,i=e.counts.slice(0,t),l=e.valids-i.reduce((e,n)=>e+n,0);return e.values.slice(0,t).concat([l]).map((n,t)=>{let r;let s=t===i.length,o=s?l:i[t],a=!1;return s?(r="(others)",a=!0):null==n?(r="(null)",a=!0):"string"==typeof n&&0===n.length?(r="(empty)",a=!0):r=String(n),{isLastItemOthers:s,isSpecialLabel:a,label:r,count:o,displayCount:eZ(o),displayRatio:eU(o/e.valids)||"N/A"}})}function nz(e){let{base:n,current:t,children:r}=e;return(0,i.jsx)(nk.u,{label:(0,i.jsxs)(l.x,{children:[(0,i.jsxs)(el.x,{children:[(0,i.jsx)(e$,{color:eQ}),"Current: ",t.count," (",t.displayRatio,")"]}),(0,i.jsxs)(el.x,{children:[(0,i.jsx)(e$,{color:eX}),"Base: ",n.count," (",n.displayRatio,")"]})]}),placement:"auto",hasArrow:!0,children:r})}function nR(e){let{topKDiff:n,isDisplayTopTen:t}=e,r=nS(n.current,t),s=nS(n.base,t);return(0,i.jsxs)(l.x,{w:"100%",px:20,py:4,children:[(0,i.jsxs)(o.k,{alignItems:"center",direction:"row",children:[(0,i.jsx)(h.L,{}),(0,i.jsxs)(el.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(e$,{color:eX})," Base"]}),(0,i.jsxs)(el.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(e$,{color:eQ})," Current"]}),(0,i.jsx)(h.L,{})]}),r.map((e,t)=>{let l=s[t];return e.isLastItemOthers&&0===e.count&&0===l.count?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(j.Fragment,{children:[(0,i.jsx)(nz,{base:l,current:e,children:(0,i.jsxs)(o.k,{alignItems:"center",width:"100%",_hover:{bg:"blackAlpha.300"},px:4,children:[(0,i.jsx)(el.x,{noOfLines:1,width:"10em",fontSize:"sm",color:e.isSpecialLabel?"gray.400":"inherit",children:e.label}),(0,i.jsxs)(o.k,{width:"70%",direction:"column",children:[(0,i.jsxs)(o.k,{height:"1em",children:[(0,i.jsx)(nE,{topkCount:e.count,topkLabel:e.label,valids:n.current.valids,color:eQ}),(0,i.jsx)(el.x,{ml:5,mr:2,fontSize:"sm",width:"6em",children:e.displayCount}),(0,i.jsx)(el.x,{color:"gray.400",fontSize:"sm",width:"4em",children:e.displayRatio})]}),(0,i.jsxs)(o.k,{height:"1em",children:[(0,i.jsx)(nE,{topkCount:l.count,topkLabel:l.label,valids:n.base.valids,color:eX}),(0,i.jsx)(el.x,{ml:5,mr:2,fontSize:"sm",width:"6em",children:l.displayCount}),(0,i.jsx)(el.x,{color:"gray.400",fontSize:"sm",width:"4em",children:l.displayRatio})]})]})]})}),(0,i.jsx)(nC.i,{})]},t)})]})}function nE(e){let{topkCount:n,topkLabel:t,valids:l,animation:r=!1,color:s=n_}=e;eJ.kL.register(eJ.uw,eJ.ZL,eJ.f$);let o=function(e,n){let{...t}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return{responsive:!0,maintainAspectRatio:!1,indexAxis:"y",scales:{x:{display:!1,max:n,grid:{display:!1}},y:{display:!1}},plugins:{tooltip:{enabled:!1}},...t}}(n,l,{animation:r}),a=function(e){let{topkLabel:n,topkCount:t,color:i=n_}=e;return{labels:[n],datasets:[{indexAxis:"y",data:[t],backgroundColor:i,hoverBackgroundColor:i,borderWidth:0,borderColor:i,barPercentage:1,categoryPercentage:.6}]}}({topkCount:n,topkLabel:t,color:s});return(0,i.jsx)(eB.$Q,{data:a,options:o,plugins:[]})}let nT=(0,eK.G)((e,n)=>{let{run:t}=e,[l,s]=(0,j.useState)(!0),a=t.result,c=t.params,x=a.base,m=a.current;return(0,i.jsxs)(o.k,{direction:"column",height:"100%",children:[(0,i.jsxs)(e2,{ref:n,blockSize:"auto",children:[(0,i.jsxs)(d.X,{as:"h1",size:"md",paddingTop:4,textAlign:"center",color:"gray.600",children:["Model ",c.model,".",c.column_name]}),(0,i.jsxs)(u.U,{children:[(0,i.jsx)(h.L,{}),(0,i.jsx)(nR,{topKDiff:a,valids:m.valids||0,isDisplayTopTen:l}),(0,i.jsx)(h.L,{})]})]}),(0,i.jsx)(h.L,{}),(x.values.length>10||m.values.length>10)&&(0,i.jsx)(o.k,{p:5,justify:"start",children:(0,i.jsx)(r.r,{onClick:()=>s(e=>!e),textColor:"blue.500",children:l?"View More Items":"View Only Top-10"})})]})}),nD=(0,eK.G)((e,n)=>{var t,l;let{run:r,onAddToChecklist:s,viewOptions:a,onViewOptionsChanged:d}=e,c=(0,j.useMemo)(()=>(null==a?void 0:a.changed_only)||!1,[a]),u=(0,j.useMemo)(()=>(null==a?void 0:a.pinned_columns)||[],[a]),h=(0,j.useMemo)(()=>{var e;if(!r.result||!(null==r?void 0:null===(e=r.params)||void 0===e?void 0:e.primary_key))return{columns:[],rows:[]};let n=r.params.primary_key,t=Array.isArray(n)?n:[n];return nd(null==r?void 0:r.result,t,{changedOnly:c,pinnedColumns:u,onPinnedColumnsChange:e=>{d&&d({...a,pinned_columns:e})}})},[r,a,c,u,d]),x=(null===(t=r.result)||void 0===t?void 0:t.limit)||0,m=x>0&&(null==r?void 0:null===(l=r.result)||void 0===l?void 0:l.more)?"Warning: Displayed results are limited to ".concat(x.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,p=[];return(m&&p.push(m),0===h.columns.length)?(0,i.jsx)(e6.M,{height:"100%",children:"No data"}):c&&0===h.rows.length?(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nx,{run:r,viewOptions:a,onAddToChecklist:s,onViewOptionsChanged:d,warnings:p}),(0,i.jsx)(e6.M,{height:"100%",children:"No change"}),";"]}):(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nx,{run:r,viewOptions:a,onAddToChecklist:s,onViewOptionsChanged:d,warnings:p}),(0,i.jsx)(e9,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:h.columns,rows:h.rows,renderers:{noRowsFallback:(0,i.jsx)(e8,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})});var nL=t(95021),nI=t(62347);function nO(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:r}=e,[s,o]=(0,j.useState)(!n.columns||0===n.columns.length),a=null==n?void 0:n.model,d=null==n?void 0:n.primary_key,{columns:c,primaryKey:u,isLoading:h,error:x}=eH(n.model);(0,j.useEffect)(()=>{!d&&u&&t({...n,primary_key:u})},[d,u,n,t]),(0,j.useEffect)(()=>{r(!!d&&!!a)},[d,a,r]);let m=c.map(e=>e.name),p=Array.isArray(d)?d:d?[d]:void 0;return h?(0,i.jsx)(l.x,{children:"Loading..."}):0===m.length||x?(0,i.jsx)(l.x,{children:"Error: Please provide the 'catalog.json' to list column candidates"}):(0,i.jsxs)(nu.g,{gap:5,m:"8px 24px",paddingBottom:"200px",children:[(0,i.jsxs)(eM.NI,{children:[(0,i.jsx)(eA.l,{children:"Model"}),(0,i.jsx)(nL.I,{isReadOnly:!0,value:null==n?void 0:n.model})]}),(0,i.jsxs)(eM.NI,{children:[(0,i.jsx)(eA.l,{children:"Primary key"}),(0,i.jsx)(nI.Ph,{placeholder:"Select primary key",isMulti:!0,closeMenuOnSelect:!1,options:(m||[]).map(e=>({label:e,value:e})),value:(p||[]).map(e=>({label:e,value:e})),onChange:e=>{t({...n,primary_key:1==e.length?e[0].value:e.map(e=>e.value)})}})]}),(0,i.jsxs)(eM.NI,{children:[(0,i.jsx)(eA.l,{children:"Columns"}),(0,i.jsx)(nh.X,{marginBottom:"10px",isChecked:s,onChange:e=>{o(e.target.checked),t({...n,columns:void 0})},children:"All columns"}),!s&&(0,i.jsx)(nI.Ph,{isMulti:!0,closeMenuOnSelect:!1,options:(m||[]).map(e=>({label:e,value:e})),value:(n.columns||[]).map(e=>({label:e,value:e})),onChange:e=>{t({...n,columns:(e||[]).map(e=>e.value)})}})]})]})}var nM=t(13994),nA=t(54627),nF=t(53254),nq=t(66791),nN=t(57334),nV=t(15405);function nH(e){let{params:n,column:t}=e,{runAction:r}=nX(),a=(e,t)=>{r("value_diff_detail",{...n,...e},t)};return(0,i.jsxs)(o.k,{children:[(0,i.jsx)(l.x,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t}),(0,i.jsx)(h.L,{}),(0,i.jsx)(nM.v,{isLazy:!0,children:e=>{let{isOpen:n}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nA.j,{className:"row-context-menu",visibility:n?"visible":"hidden",width:n?"auto":"0px",minWidth:n?"auto":"0px",as:nF.h,icon:(0,i.jsx)(s.J,{as:e7.D_A}),variant:"unstyled",size:"sm"}),(0,i.jsx)(nq.q,{lineHeight:"20px",children:(0,i.jsxs)(nN.k,{title:"Action",as:l.x,fontSize:"8pt",children:[(0,i.jsx)(nV.s,{fontSize:"10pt",onClick:()=>a({},{showForm:!0}),children:"Show mismatched values..."}),(0,i.jsxs)(nV.s,{fontSize:"10pt",onClick:()=>a({columns:[t]},{showForm:!1}),children:["Show mismatched values for '",t,"'"]})]})})]})}})]})}let nP=(0,eK.G)(function(e,n){let{run:t}=e,r=t.result,a=t.params,d=e=>{let n=e[2];return null!=n&&n<1?"diff-cell-modified":""},c=Array.isArray(a.primary_key)?a.primary_key:[a.primary_key],u=[{key:"__is_pk__",name:"",width:30,maxWidth:30,renderCell:e=>{let{row:n}=e;return(0,i.jsx)(e6.M,{height:"100%",children:c.includes(n[0])&&(0,i.jsx)(s.J,{as:e7.MhP})})}},{key:"0",name:"Column",resizable:!0,renderCell:e=>{let{row:n,column:t}=e;return(0,i.jsx)(nH,{column:n[t.key],params:a})},cellClass:"cell-show-context-menu"},{key:"1",name:"Matched",resizable:!0,cellClass:d},{key:"2",name:"Matched %",resizable:!0,renderCell:e=>{let{column:n,row:t}=e,r=t[n.key];return(0,i.jsx)(l.x,{textAlign:"end",children:void 0!=r&&null!==r?"".concat((100*r).toFixed(2)," %"):"N/A"})},cellClass:d}];return(0,i.jsxs)(o.k,{direction:"column",gap:"5px",pt:"5px",height:"100%",children:[(0,i.jsxs)(l.x,{px:"16px",children:["Model: ",a.model,", ",r.summary.total," total (",r.summary.total-r.summary.added-r.summary.removed," ","common, ",r.summary.added," added, ",r.summary.removed," removed)"]}),(0,i.jsx)(e9,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",borderBlock:"1px solid lightgray"},columns:u,rows:r.data.data,renderers:{noRowsFallback:(0,i.jsx)(e8,{})},defaultColumnOptions:{resizable:!0},className:"rdg-light",enableScreenshot:!0})]})});var nW=t(46970),nK=t(7600);let nJ={lineage_diff:{title:"Lineage Diff",icon:eO.Ks7},schema_diff:{title:"Schema Diff",icon:nK.C8A},query:{title:"Query",icon:eO.r2i,RunResultView:nv},query_base:{title:"Query Base",icon:eO.r2i,RunResultView:nv},query_diff:{title:"Query Diff",icon:eO.r2i,RunResultView:nf},row_count_diff:{title:"Row Count Diff",icon:nK.QUK,RunResultView:nw},profile_diff:{title:"Profile Diff",icon:eO.KA6,RunResultView:no},value_diff:{title:"Value Diff",icon:eO.pRi,RunResultView:nP,RunForm:nO},value_diff_detail:{title:"Value Diff Detail",icon:eO.pRi,RunResultView:nD,RunForm:nO},top_k_diff:{title:"Top-K Diff",icon:nW.Pkc,RunResultView:nT,RunForm:function(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:r}=e,{columns:s,isLoading:o,error:a}=eH(n.model),d=s.map(e=>e.name);return((0,j.useEffect)(()=>{r(!!n.column_name)},[n,r]),o)?(0,i.jsx)(l.x,{children:"Loading..."}):0===d.length||a?(0,i.jsx)(l.x,{children:"Error: Please provide the 'catalog.json' to list column candidates"}):(0,i.jsx)(l.x,{m:"16px",children:(0,i.jsxs)(eM.NI,{children:[(0,i.jsx)(eA.l,{children:"Pick a column to show top-k"}),(0,i.jsx)(eF.P,{placeholder:"Select column",value:null==n?void 0:n.column_name,onChange:e=>{let i=e.target.value;t({...n,column_name:i})},children:d.map(e=>(0,i.jsx)("option",{value:e,children:e},e))})]})})}},histogram_diff:{title:"Histogram Diff",icon:eO.dku,RunResultView:e4,RunForm:function(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:r}=e,{columns:s,isLoading:o,error:a}=eH(n.model),d=s.filter(e=>!eP(e.type)&&!eW(e.type));return o?(0,i.jsx)(l.x,{children:"Loading..."}):0===s.length||a?(0,i.jsx)(l.x,{children:"Error: Please provide the 'catalog.json' to list column candidates"}):(0,i.jsx)(l.x,{m:"16px",children:(0,i.jsxs)(eM.NI,{children:[(0,i.jsx)(eA.l,{children:"Pick a column to show Histogram Diff"}),(0,i.jsx)(eF.P,{placeholder:0!==d.length?"Select column":"No numeric column is available",isDisabled:0===d.length,value:null==n?void 0:n.column_name,onChange:e=>{var i;let l=e.target.value;r(!!l);let s=(null===(i=d.find(e=>e.name===l))||void 0===i?void 0:i.type)||"";t({...n,column_name:l,column_type:s})},children:d.map(e=>(0,i.jsxs)("option",{value:e.name,children:[e.name," : ",e.type]},e.name))})]})})}},preview_change:{title:"Preview Change",icon:eO.iQd,RunResultView:nf}},nB=e=>nJ[e],nU=(0,j.createContext)({runAction:()=>{},showRunId:e=>{},isRunResultOpen:!1,closeRunResult:()=>{},isHistoryOpen:!1,closeHistory:()=>{},showHistory:()=>{},clearRunResult:()=>{}}),nZ=e=>{let[n]=(0,eI.TH)();(0,j.useEffect)(()=>{e()},[e,n])};function nQ(e){var n;let{children:t}=e,[l,r]=(0,j.useState)(),{isOpen:s,onOpen:o,onClose:a}=(0,Y.q)(),{isOpen:d,onOpen:c,onClose:u}=(0,Y.q)(),{isOpen:h,onOpen:x,onClose:m}=(0,Y.q)(),p=(0,G.p)(),[f,g]=(0,j.useState)(),[v,y]=(0,eI.TH)(),w=(0,b.NL)(),k=(0,j.useCallback)((e,n)=>{g(e),c(),!1!==n&&w.invalidateQueries({queryKey:P.runs()})},[g,c,w]),C=(0,j.useCallback)(()=>{g(void 0),u()},[u,g]),_=(0,j.useCallback)(async(e,n,t)=>{try{let i;let l=new Date().getTime().toString();if(null==t?void 0:t.showLast){let t=await ex(e,n,1);1===t.length&&(i=t[0])}let s=nB(e);if(void 0===s)throw Error("Unknown run type: ".concat(e));let{title:a,RunResultView:d,RunForm:c}=s;if(void 0===d)throw Error("Run type ".concat(e," does not have a result view"));if(void 0!==c&&(null==t?void 0:t.showForm))r({session:l,title:a,type:e,params:n,lastRun:i,options:t,RunForm:c}),o();else{let{run_id:t}=await ed(e,n,{nowait:!0});k(t),w.invalidateQueries({queryKey:P.runs()}),v.startsWith("/lineage")&&y("/lineage")}}catch(e){p({title:"Failed to submit a run",description:null==e?void 0:e.message,position:"bottom-right",status:"error",duration:5e3,isClosable:!0})}},[r,o,k,p,v,y,w]);nZ(a);let S=async(e,n)=>{try{a();let{run_id:t}=await ed(e,n,{nowait:!0});k(t)}catch(e){p({title:"Failed to submit a run",description:null==e?void 0:e.message,position:"bottom-right",status:"error",duration:5e3,isClosable:!0})}};return(0,j.useEffect)(()=>{f&&v.startsWith("/checks")&&y("/lineage")},[f]),(0,i.jsxs)(nU.Provider,{value:{runAction:_,runId:f,showRunId:k,isRunResultOpen:d,closeRunResult:u,isHistoryOpen:h,closeHistory:m,showHistory:x,clearRunResult:C},children:[l&&(0,i.jsx)(eL,{isOpen:s,onClose:a,onExecute:S,title:l.title,type:l.type,params:l.params,initialRun:l.lastRun,RunForm:(null===(n=l.options)||void 0===n?void 0:n.showForm)&&l.RunForm?l.RunForm:void 0},l.session),t]})}let nX=()=>(0,j.useContext)(nU);function nG(e){let{children:n}=e;return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(C,{children:(0,i.jsx)(eR,{children:(0,i.jsx)(z,{children:(0,i.jsx)(nQ,{children:n})})})})})}async function nY(){return(await U.post("/api/checks",{type:"simple"})).data}async function n$(e,n){return(await U.post("/api/checks",{run_id:e,view_options:n})).data}async function n0(){return(await U.get("/api/checks")).data}async function n1(e){return(await U.get("/api/checks/".concat(e))).data}async function n5(e,n){return(await U.patch("/api/checks/".concat(e),n)).data}async function n2(e){return(await U.delete("/api/checks/".concat(e))).data}async function n4(e){return await U.post("/api/checks/reorder",e)}var n6=t(6706),n3=t(96288),n9=t(38597),n8=t(63770),n7=t(15893),te=t(46919),tn=t(40451),tt=t(52878),ti=t(91425),tl=t(21567),tr=t(19612),ts=t(14968),to=t(81417),ta=t(89633),td=t(14257);function tc(e){let{name:n,setName:t}=e,[r,s]=(0,j.useState)(!1),[o,a]=(0,j.useState)(n),d=(0,j.useRef)(null),c=(0,j.useCallback)(()=>{t(o),s(!1)},[t,s,o]);return(0,j.useEffect)(()=>{let e=e=>{d.current&&!d.current.contains(e.target)&&c()};return r&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[r,d,c]),(0,i.jsxs)(to.a,{flex:"0 1 auto",fontSize:"12pt",fontWeight:"500",separator:(0,i.jsx)(td.X,{color:"gray.500"}),overflow:"hidden",children:[(0,i.jsx)(ta.g,{children:(0,i.jsx)(l.x,{children:"Checklist"})}),(0,i.jsx)(ta.g,{cursor:"pointer",flex:"0 1 auto",overflow:"hidden",children:r?(0,i.jsx)(nL.I,{ref:d,value:o,onChange:e=>{a(e.target.value)},onKeyDown:e=>{"Enter"===e.key?(t(o),s(!1)):"Escape"===e.key&&(a(n),s(!1))},size:"sm",w:"100%"}):(0,i.jsx)(l.x,{flex:"0 1 auto",onClick:()=>{a(n),s(!0)},textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:n})})]})}var tu=t(50674);t(50394);var th=t(20125);function tx(e){let{model:n,name:t,baseType:r,currentType:a}=e,{runAction:d}=nX(),c=a||r,u=()=>{d("histogram_diff",{model:n,column_name:t,column_type:c},{showForm:!1})},x=()=>{d("top_k_diff",{model:n,column_name:t,k:50},{showForm:!1})},m=!r||!a;return(0,i.jsxs)(o.k,{children:[(0,i.jsx)(l.x,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t}),(0,i.jsx)(h.L,{}),(0,i.jsx)(nM.v,{children:e=>{let{isOpen:n}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nA.j,{className:"row-context-menu",visibility:n?"visible":"hidden",width:n?"auto":"0px",minWidth:n?"auto":"0px",as:nF.h,icon:(0,i.jsx)(s.J,{as:e7.D_A}),variant:"unstyled",size:"sm"}),(0,i.jsx)(th.h,{children:(0,i.jsx)(nq.q,{lineHeight:"20px",children:(0,i.jsxs)(nN.k,{title:"Diff",m:"0",p:"4px 12px",children:[(0,i.jsx)(nV.s,{fontSize:"10pt",onClick:u,isDisabled:m||!c||!(!eP(c)&&!eW(c)),children:"Histogram Diff"}),(0,i.jsx)(nV.s,{fontSize:"10pt",onClick:x,isDisabled:m,children:"Top-k Diff"})]})})})]})}})]})}function tm(e,n){function t(e){return void 0===e.baseIndex?"column-index-added":void 0===e.currentIndex?"column-index-removed":!0===e.reordered?"column-index-reordered":"column-index-normal"}function l(e){return void 0===e.baseIndex?"column-body-added":void 0===e.currentIndex?"column-body-removed":e.baseType!==e.currentType?"column-body-type-changed":!0===e.reordered?"column-body-reordered":"column-body-normal"}return{columns:[{key:"baseIndex",name:"",resizable:!0,minWidth:35,width:35,cellClass:t},{key:"currentIndex",name:"",resizable:!0,minWidth:35,width:35,cellClass:t},{key:"name",name:"Name",resizable:!0,renderCell:e=>{let{row:t,column:l}=e;return n?(0,i.jsx)(tx,{model:n,name:t.name,baseType:t.baseType,currentType:t.currentType}):t.name},cellClass:function(e){return void 0===e.baseIndex?"column-body-added":void 0===e.currentIndex?"column-body-removed":!0===e.reordered?"column-body-reordered":"column-body-normal"}},{key:"baseType",name:"Base Type",resizable:!0,cellClass:l},{key:"currentType",name:"Current Type",resizable:!0,cellClass:l}],rows:Object.values(e)}}var tp=t(57765),tf=t(27322);let tg=(0,j.forwardRef)(function(e,n){let t,l,{base:r,current:s,enableScreenshot:a=!1}=e,{columns:d,rows:c}=(0,j.useMemo)(()=>{let e=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t={};return Object.entries(ne(Object.keys(e),Object.keys(n))).forEach(e=>{let[n,i]=e;t[n]={name:n,reordered:"reordered"===i}}),Object.entries(e).map((e,n)=>{let[i,l]=e;t[i].baseIndex=n+1,t[i].baseType=l.type}),Object.entries(n).map((e,n)=>{let[i,l]=e;t[i].currentIndex=n+1,t[i].currentType=l.type}),t}(null==r?void 0:r.columns,null==s?void 0:s.columns),n=(null==s?void 0:s.resource_type)||(null==r?void 0:r.resource_type);return n&&["model","seed","snapshot"].includes(n)?tm(e,(null==s?void 0:s.name)||(null==r?void 0:r.name)):tm(e)},[r,s]),{lineageGraph:u}=eE(),h=!(null==u?void 0:u.catalogMetadata.base),x=!(null==u?void 0:u.catalogMetadata.current);h&&x?t="catalog.json is missing on both current and base environments.":h?t="catalog.json is missing on base environment.":x&&(t="catalog.json is missing on current environment.");let m=r&&void 0===r.columns,p=s&&void 0===s.columns;return m&&p?l="Schema information is missing on both current and base environments.":m?l="Schema information is missing on base environment.":p&&(l="Schema information is missing on current environment."),(0,i.jsxs)(o.k,{direction:"column",children:[t?(0,i.jsxs)(tp.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(tf.z,{}),t]}):l?(0,i.jsxs)(tp.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(tf.z,{}),l]}):(0,i.jsx)(i.Fragment,{}),c.length>0&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(e9,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:d,rows:c,renderers:{noRowsFallback:(0,i.jsx)(e8,{})},className:"rdg-light",enableScreenshot:a,ref:n})})]})});async function tv(e){return(await U.post("/api/select",e)).data}var tj=t(3072);t(5637);let ty=e=>{let{style:n,children:t,gutterSize:l=5,...r}=e;return(0,i.jsx)(tj.Z,{style:{display:"flex",flexDirection:"row",...n},direction:"horizontal",gutterSize:l,...r,children:t})},tb=e=>{let{style:n,children:t,gutterSize:l=5,...r}=e;return(0,i.jsx)(tj.Z,{style:{display:"flex",flexDirection:"column",...n},gutterSize:l,direction:"vertical",...r,children:t})};var tw=t(34135),tk=t(55726),tC=t(98640);let t_=e7.Nbv,tS=e7.sFB,tz=e7.UGs;function tR(e){return"added"===e?{color:"#1dce00",backgroundColor:"#e8fce5",icon:t_}:"removed"===e?{color:"#ff4444",backgroundColor:"#ffdbdb",icon:tS}:"modified"===e?{color:"#ffa502",backgroundColor:"#fff2dd",icon:tz}:{color:"inherit",backgroundColor:"white",icon:void 0}}function tE(e){if("model"===e)return{color:"#c0eafd",icon:tk.Fn3};if("metric"===e)return{color:"#ffe6ee",icon:tC._MV};if("source"===e)return{color:"#a6dda6",icon:tk.i1q};if("exposure"===e)return{color:"#ffe6ee",icon:tC.n8P};if("semantic_model"===e)return{color:"#fb8caf",icon:tC.R1C};if("seed"===e)return{color:"#a6dda6",icon:tk.tWi};if("snapshot"===e)return{color:"#a6dda6",icon:tk.Dmm};else return{color:"inherit",icon:void 0}}function tT(e,n){if(!e||!n)return;let t=Object.keys(e),i=Object.keys(n);if(t.length!==i.length)return!0;for(let e=0;e{let n,t,{node:r,selected:a,onSelect:d,schemaChanged:c}=e,{icon:u}=tE(r.resourceType),{base:h,current:x}=r.data;if(c){var m;n=null===(m=nB("schema_diff"))||void 0===m?void 0:m.icon,t=tR("modified").color}else!h&&x?(n=tR("added").icon,t=tR("added").color):h&&!x&&(n=tR("removed").icon,t=tR("removed").color);return(0,i.jsxs)(o.k,{width:"100%",fontSize:"10pt",p:"5px 8px",cursor:"pointer",_hover:{bg:"gray.200"},bg:a?"gray.100":"inherit",onClick:()=>d(r.id),alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.J,{as:u}),(0,i.jsx)(l.x,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:r.name}),n&&t&&(0,i.jsx)(s.J,{as:n,color:t})]})},tL=(0,j.forwardRef)(function(e,n){let{check:t}=e,{lineageGraph:l}=eE(),r=t.params,s=[...P.check(t.check_id),"select"],{isLoading:o,error:a,refetch:d,data:c}=(0,y.a)({queryKey:s,queryFn:async()=>tv({select:null==r?void 0:r.select,exclude:null==r?void 0:r.exclude,packages:null==r?void 0:r.packages,view_mode:null==r?void 0:r.view_mode}),refetchOnMount:!0,enabled:!(null==r?void 0:r.node_id)}),[u,h]=(0,j.useMemo)(()=>{let e=[],n=[],t=[],i=[];if(null==r?void 0:r.node_id)for(let n of r.node_id instanceof Array?r.node_id:[r.node_id]){let t=null==l?void 0:l.nodes[n];t&&e.push(t)}else for(let n of(null==c?void 0:c.nodes)||[]){let t=null==l?void 0:l.nodes[n];t&&e.push(t)}let s=e.filter(e=>"model"===e.resourceType||"seed"===e.resourceType||"source"===e.resourceType||"snapshot"===e.resourceType);for(let e of s){var o,a;tT(null===(o=e.data.base)||void 0===o?void 0:o.columns,null===(a=e.data.current)||void 0===a?void 0:a.columns)?n.push(e.id):!e.data.base&&e.data.current?t.push(e.id):e.data.base&&!e.data.current&&i.push(e.id)}function d(e){return n.includes(e.id)?3:t.includes(e.id)?2:i.includes(e.id)?1:0}return s.sort((e,n)=>{let t=d(e),i=d(n);return t!==i?i-t:e.name.localeCompare(n.name)}),[s,n]},[null==r?void 0:r.node_id,null==c?void 0:c.nodes,l]),[x,m]=(0,j.useState)(0);if(o)return(0,i.jsx)(e6.M,{bg:"rgb(249,249,249)",height:"100%",children:"Loading..."});if(a)return(0,i.jsxs)(e6.M,{bg:"rgb(249,249,249)",height:"100%",children:["Error: ",null==a?void 0:a.message]});if(0==u.length)return(0,i.jsx)(e6.M,{bg:"rgb(249,249,249)",height:"100%",children:"No nodes matched"});if(x(0,i.jsx)(tD,{node:e,schemaChanged:h.includes(e.id),selected:n===x,onSelect:()=>{m(n)}},n))})]})}return(0,i.jsx)(i.Fragment,{})});var tI=t(29589);function tO(e){let{value:n,onChange:t}=e,[l,s]=(0,j.useState)(!1),[a,d]=(0,j.useState)(),c=(0,j.useRef)(null),u=()=>{t&&(t(a),s(!1))};return((0,j.useEffect)(()=>{if(l&&c.current){let e=c.current;e.focus(),e.setSelectionRange(e.value.length,e.value.length)}},[l]),l)?(0,i.jsxs)(o.k,{direction:"column",align:"flex-end",height:"100%",children:[(0,i.jsx)(tI.g,{value:a,onChange:e=>{d(e.target.value)},onKeyDown:e=>{"Escape"===e.key&&s(!1),(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),u())},ref:c,flex:1}),(0,i.jsxs)(o.k,{gap:"12px",alignItems:"flex-end",children:[(0,i.jsx)(r.r,{onClick:()=>{setTimeout(()=>{s(!1)},100)},colorScheme:"blue",children:"cancel"}),(0,i.jsx)(es.z,{mt:"8px",size:"sm",colorScheme:"blue",onClick:u,children:"Update"})]})]}):(0,i.jsx)(el.x,{height:"100%",overflow:"auto",fontSize:"11pt",onClick:()=>{d(n||""),s(!0)},whiteSpace:"pre-wrap",wordBreak:"break-word",color:n?"inherit":"lightgray",children:n||"Add description here"})}var tM=t(68306);function tA(){let e=(0,G.p)();return{successToast:function(n){e({description:n,status:"info",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})},failToast:function(n,t){e({title:n,description:"".concat(t),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}}}function tF(){let e=(0,n6._)(["\n **SQL**\n ```sql\n ","\n ```\n "],["\n **SQL**\n \\`\\`\\`sql\n ","\n \\`\\`\\`\n "]);return tF=function(){return e},e}function tq(e){return e.description?e.description:"_(no description)_"}var tN=t(21114),tV=t(52777);let tH=e=>{let{value:n,onChange:t,onRun:l,onRunBase:r,onRunDiff:a,label:d,options:c={},...u}=e;return(0,i.jsxs)(i.Fragment,{children:[(d||l||r)&&(0,i.jsxs)(o.k,{backgroundColor:"#EDF2F880",height:"40px",fontSize:"14px",align:"center",margin:"0",padding:"0px 16px",children:[(0,i.jsx)(el.x,{as:"b",children:d?d.toUpperCase():""}),(0,i.jsx)(h.L,{}),(l||r)&&(0,i.jsx)(es.z,{size:"sm",variant:"outline",onClick:l||r,backgroundColor:"white",leftIcon:(0,i.jsx)(s.J,{as:tC.gmG}),padding:"6px 12px",children:"Run Query"})]}),(0,i.jsx)(tV.ML,{language:"sql",theme:"vs",value:n,onChange:e=>{void 0!==e&&t&&t(e)},onMount:(e,n)=>{l&&e.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.Enter,l),r&&e.addCommand(n.KeyMod.Alt|n.KeyCode.Enter,r),a&&e.addCommand(n.KeyMod.CtrlCmd|n.KeyMod.Shift|n.KeyCode.Enter,a)},options:{tabSize:2,fontSize:16,lineNumbers:"on",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"indent",...c}})]})},tP=e=>{let{value:n,baseValue:t,onChange:l,onChangeBase:r,onRun:s,onRunBase:a,onRunDiff:d,options:c={},...u}=e;return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(o.k,{height:"100%",gap:0,children:[(0,i.jsx)(tN.K,{height:"100%",width:"50%",gap:0,borderRight:"1px",borderColor:"#D4DBE4",children:(0,i.jsx)(tH,{label:"Base",value:t||"",onChange:r,onRunBase:a,options:c,...u})}),(0,i.jsx)(tN.K,{height:"100%",width:"50%",gap:0,children:(0,i.jsx)(tH,{label:"Current",value:n,onChange:l,onRun:s,options:c,...u})})]})})};var tW=t(13601),tK=t(51418);let tJ=(0,eK.G)((e,n)=>{var t,r,s,a;let{isRunning:d,isAborting:c,progress:u,error:h,run:x,onCancel:m,viewOptions:p,onViewOptionsChanged:f,RunResultView:g,children:v,onExecuteRun:j}=e,y=(null==h?void 0:null===(r=h.response)||void 0===r?void 0:null===(t=r.data)||void 0===t?void 0:t.detail)||(null==x?void 0:x.error);if(y)return(0,i.jsxs)(tp.b,{status:"error",children:[(0,i.jsx)(tf.z,{}),"Error: ",y]});if(void 0!==d?d:(null==x?void 0:x.status)==="running"){let e=(null==u?void 0:u.message)?null==u?void 0:u.message:(null==x?void 0:null===(s=x.progress)||void 0===s?void 0:s.message)?null==x?void 0:null===(a=x.progress)||void 0===a?void 0:a.message:"Loading...";return(0,i.jsx)(e6.M,{p:"16px",height:"100%",bg:"rgb(249,249,249)",children:(0,i.jsxs)(nu.g,{children:[(0,i.jsxs)(o.k,{alignItems:"center",children:[(null==u?void 0:u.percentage)===void 0||(null==u?void 0:u.percentage)===null?(0,i.jsx)(tW.D,{isIndeterminate:!0,size:"20px",mr:"8px"}):(0,i.jsx)(tW.D,{size:"20px",value:100*u.percentage,mr:"8px"}),c?(0,i.jsx)(i.Fragment,{children:"Aborting..."}):(0,i.jsx)(i.Fragment,{children:e})]}),!c&&(0,i.jsx)(es.z,{onClick:m,colorScheme:"blue",size:"sm",children:"Cancel"})]})})}if(!x)return(0,i.jsx)(e6.M,{bg:"rgb(249,249,249)",height:"100%",children:"Loading..."});if(v&&g)throw Error("RunView requires either a children or a RunResultView prop, but not both.");if(!v&&!g)throw Error("RunView requires at least one of children or RunResultView prop.");return(0,i.jsxs)(l.x,{h:"100%",style:{contain:"size layout"},overflow:"auto",children:[g&&(x.error||x.result)&&(0,i.jsx)(tK.SV,{children:(0,i.jsx)(g,{ref:n,run:x,viewOptions:p,onViewOptionsChanged:f})}),v&&v({run:x,viewOptions:p,onViewOptionsChanged:f})]})});var tB=t(27066),tU=t(13587),tZ=t(9312),tQ=t(94945),tX=t(52811),tG=t(14033);t(94254),t(76890);var tY=t(47691),t$=t(34433),t0=t(73676),t1=t(84492);function t5(e){let{node:n}=e,{icon:t}=tE(n.resourceType);return(0,i.jsx)(nk.u,{hasArrow:!0,label:"Type of resource",children:(0,i.jsxs)(n3.Vp,{children:[(0,i.jsx)(n3.AD,{as:t}),(0,i.jsx)(n3.Sn,{children:n.resourceType})]})})}function t2(e){let{rowCount:n}=e,t=n.base,l=n.curr,r=null===n.base?"N/A":"".concat(n.base," rows"),o=null===n.curr?"N/A":"".concat(n.curr," rows");return null===t&&null===l?(0,i.jsx)(i.Fragment,{children:" Failed to load"}):null===t||null===l?(0,i.jsxs)(u.U,{children:[(0,i.jsx)(el.x,{children:r}),(0,i.jsx)(s.J,{as:t0.Rgz}),(0,i.jsx)(el.x,{children:o})]}):t===l?(0,i.jsxs)(u.U,{children:[(0,i.jsx)(el.x,{children:o}),(0,i.jsx)(s.J,{as:t1.lxc,color:"gray.500"}),(0,i.jsx)(el.x,{color:"gray.500",children:"No Change"})]}):t ").concat(n," rows")}return(0,i.jsx)(nk.u,{label:r,children:(0,i.jsxs)(n3.Vp,{children:[(0,i.jsx)(n3.AD,{as:x}),(0,i.jsx)(n3.Sn,{children:m||d?(0,i.jsx)(t$.N,{isLoaded:!d,noOfLines:1,skeletonHeight:2,minWidth:"30px",children:m?(0,i.jsx)(t2,{rowCount:m}):"row count"}):(0,i.jsx)(i.Fragment,{children:"row count"})}),a&&(0,i.jsx)(n3.bq,{as:nF.h,isLoading:d,"aria-label":"Query Row Count",icon:(0,i.jsx)(ti.n,{}),size:"xs",onClick:a})]})})}let t6=e=>{let{node:n,action:t}=e,{status:r,skipReason:s,run:a}=t;if("pending"===r)return(0,i.jsx)(tW.D,{size:"20px",value:0});if("skipped"===r)return(0,i.jsx)(n3.Vp,{backgroundColor:"gray.100",children:(0,i.jsxs)(o.k,{fontSize:"10pt",color:"gray.500",alignItems:"center",gap:"3px",children:[(0,i.jsx)(l.x,{children:"Skipped"}),s&&(0,i.jsx)(nk.u,{label:s,children:(0,i.jsx)(tY.s,{})})]})});if(!a)return(0,i.jsx)(tW.D,{isIndeterminate:!0,size:"20px"});let{error:d,result:c,run_id:u,progress:h}=a;if("running"===r)return(null==h?void 0:h.percentage)===void 0?(0,i.jsx)(tW.D,{isIndeterminate:!0,size:"20px"}):(0,i.jsx)(tW.D,{size:"20px",value:(null==h?void 0:h.percentage)*100});if(d)return(0,i.jsxs)(o.k,{fontSize:"10pt",color:"gray",children:[(0,i.jsx)(l.x,{children:"Error"}),s&&(0,i.jsx)(nk.u,{label:d,children:(0,i.jsx)(nc.a,{})})]});if("value_diff"===a.type){let e=0;for(let n of c.data.data)n[2]<1&&e++;return(0,i.jsx)(n3.Vp,{backgroundColor:e>0?"red.100":"green.100",children:(0,i.jsx)(n3.Sn,{children:(0,i.jsx)(o.k,{fontSize:"10pt",color:e>0?"red":"green",alignItems:"center",gap:"3px",children:e>0?"".concat(e," columns mismatched"):"All columns match"})})})}if("row_count_diff"===a.type){let e=a.result;return(0,i.jsx)(t4,{rowCount:e[n.name],node:n})}return(0,i.jsx)(i.Fragment,{children:u})},t3=(0,j.createContext)(void 0),t9=()=>{let e=(0,j.useContext)(t3);if(!e)throw Error("useLineageViewContext must be used within a LineageViewProvider");return e},t8=e=>{var n,t,r,a;let d,c,{id:u,inverted:h}=e,{lineageGraph:x,runsAggregated:m}=eE(),p=null==m?void 0:m[u],f=null==x?void 0:x.nodes[u];if(!p&&!f)return(0,i.jsx)(i.Fragment,{});if((null==f?void 0:f.data.base)&&(null==f?void 0:f.data.current)&&(d=tT(null===(r=f.data.base)||void 0===r?void 0:r.columns,null===(a=f.data.current)||void 0===a?void 0:a.columns)),p&&p.row_count_diff){let e=p.row_count_diff;c=e.result.curr!==e.result.base}let g=h?"white":tR("modified").color,v=h?"gray":"lightgray";return(0,i.jsxs)(o.k,{gap:"5px",children:[void 0!==d&&(0,i.jsx)(nk.u,{label:"Schema (".concat(d?"changed":"no change",")"),openDelay:500,children:(0,i.jsx)(l.x,{height:"16px",children:(0,i.jsx)(s.J,{as:null===(n=nB("schema_diff"))||void 0===n?void 0:n.icon,color:d?g:v})})}),void 0!==c&&(0,i.jsx)(nk.u,{label:"Row count (".concat(c?"changed":"no change",")"),openDelay:500,children:(0,i.jsx)(l.x,{height:"16px",children:(0,i.jsx)(s.J,{as:null===(t=nB("row_count_diff"))||void 0===t?void 0:t.icon,color:c?g:v})})})]})},t7=e=>{let{checked:n,onClick:t}=e;return(0,i.jsx)(o.k,{onClick:t,alignSelf:"center",alignItems:"center",children:n?(0,i.jsx)(s.J,{boxSize:"20px",as:tk.xik}):(0,i.jsx)(s.J,{boxSize:"20px",as:tk.hGI})})};var ie=t(70952),it=t(44549),ii=t(27739);function il(e){let{base:n,current:t}=e;return(0,i.jsx)(tV.SV,{height:"100%",language:"sql",theme:"vs",original:null==n?void 0:n.raw_code,modified:null==t?void 0:t.raw_code,options:{readOnly:!0,fontSize:14,lineNumbers:"on",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"same"}})}function ir(e){let{current:n,onChange:t}=e,r=function(e,n){let t=(0,j.useRef)(null);return(0,j.useEffect)(()=>{t.current&&e!==t.current.getValue()&&t.current.setValue(e)},[e]),{onMount(e){let i=e.getModifiedEditor();t.current=i,i.onDidChangeModelContent(()=>{n(i.getValue())})}}}((null==n?void 0:n.raw_code)||"",t);return(0,i.jsx)(l.x,{flex:1,overflowY:"auto",children:(0,i.jsx)(tV.SV,{language:"sql",theme:"vs",original:null==n?void 0:n.raw_code,modified:null==n?void 0:n.raw_code,options:{readOnly:!1,fontSize:14,lineNumbers:"on",automaticLayout:!0,wordWrap:"on",wrappingIndent:"same",renderOverviewRuler:!1,minimap:{enabled:!0}},onMount:r.onMount})})}async function is(e){return(await U.post("/api/checks",{type:"schema_diff",params:e})).data}let io={audit_helper:"Require the dbt package 'dbt-labs/audit_helper'. Please install it and re-run dbt to activate this feature.",dbt_profiler:"Require the dbt package 'data-mie/dbt_profiler'. Please install it and re-run dbt to activate this feature.",add_or_remove:"Unavailable for added or removed resources."},ia=e=>{var n;let[t,i]=(0,j.useState)(!1),[l,r]=(0,j.useState)(!1),[,s]=eT(),{error:o,data:a}=(0,y.a)({queryKey:P.run(e||""),queryFn:async()=>ec(e||"",t?2:0),enabled:!!e,refetchInterval:!!t&&50,retry:!1});(0,j.useEffect)(()=>{(o||(null==a?void 0:a.result)||(null==a?void 0:a.error))&&(t&&i(!1),(null==a?void 0:a.type)==="row_count_diff"&&s()),(null==a?void 0:a.status)==="running"&&i(!0)},[a,o,t,s]);let d=(0,j.useCallback)(async()=>{if(r(!0),e)return await eu(e)},[e,r]),c=(null==a?void 0:a.type)?null===(n=nB(a.type))||void 0===n?void 0:n.RunResultView:void 0;return{run:a,isRunning:t,aborting:l,error:o,onCancel:d,RunResultView:c}};var id=t(30671),ic=t(33686),iu=t(32717),ih=t.n(iu),ix=t(21467),im=t(93779),ip=t(30745),ig=t.n(ip);let iv="ignore-screenshot";function ij(e){let{renderLibrary:n="html2canvas",imageType:t="png",backgroundColor:l=null,boardEffect:r=!0,shadowEffect:s=!1,borderStyle:d="solid 1px #ccc",borderRadius:c="10px",onSuccess:u,onError:h,ignoreElements:x}=e,[m,p]=(0,j.useState)("idle"),f=(0,j.useRef)(null),{onOpen:g,setImgBlob:v,ImageDownloadModal:y}=function(){let{isOpen:e,onOpen:n,onClose:t}=(0,Y.q)(),[l,r]=(0,j.useState)();return{onOpen:n,setImgBlob:r,ImageDownloadModal:function(){let[n,r]=(0,j.useState)();return(0,j.useEffect)(()=>{if(!l)return;let e=new FileReader;e.readAsDataURL(l),e.onloadend=e=>{var n,t;(null===(n=e.target)||void 0===n?void 0:n.result)&&(null===(t=e.target)||void 0===t?void 0:t.result)!==null&&r(e.target.result)}},[r]),(0,i.jsxs)($.u_,{size:"3xl",isOpen:e,onClose:t,children:[(0,i.jsx)(ee.Z,{}),(0,i.jsxs)(en.h,{children:[(0,i.jsx)(et.x,{children:"Screenshot Preview"}),(0,i.jsx)(eD.o,{}),(0,i.jsxs)(ei.f,{children:[(0,i.jsxs)(o.k,{px:"10px",gap:"10px",direction:"column",children:[(0,i.jsxs)(o.k,{alignItems:"center",gap:"5px",children:[(0,i.jsx)(tY.s,{color:"red.600"}),(0,i.jsx)(el.x,{fontWeight:"500",display:"inline",children:"Copy to the Clipboard"})," ","is not supported in the current browser"]}),(0,i.jsx)(el.x,{children:"Please download it directly"})]}),(0,i.jsx)(a.E,{src:n,alt:"screenshot"})]}),(0,i.jsxs)(er.m,{children:[(0,i.jsx)(es.z,{mr:3,onClick:t,children:"Close"}),(0,i.jsx)(es.z,{colorScheme:"blue",onClick:()=>{if(!l)return;let e=new Date,n="recce-screenshot-".concat((0,im.WU)(e,"yyyy-MM-dd-HH-mm-ss"),".png");ig()(l,n),t()},children:"Download"})]})]})]})}}}(),b=async()=>{if(!f.current)throw console.error("No node to use for screenshot"),Error("No node to use for screenshot");let e=f.current.element||f.current,t=e.style.overflow,i=e.style.border,o=e.style.borderRadius,a=e.style.backgroundColor,u=e.style.height;try{var h;e.style.overflow="hidden",e.style.border=r?d:"",e.style.borderRadius=r?c:"",e.style.backgroundColor=l||"",e.style.height=e.offsetHeight+"px";let t=document.createElement("style");document.head.appendChild(t),null===(h=t.sheet)||void 0===h||h.insertRule("body > div:last-child img { display: inline-block; }"),p("loading");let i="html2canvas"===n?await ih()(e,{logging:!1,backgroundColor:null,ignoreElements:x}):await (0,ix.rT)(e,{filter:x?e=>!x(e):void 0});t.remove();let o=s?document.createElement("canvas"):i;if(s){o.width=i.width+80,o.height=i.height+80;let e=o.getContext("2d");if(e)e.shadowColor="rgba(0, 0, 0, 0.5)",e.shadowBlur=20,e.shadowOffsetX=10,e.shadowOffsetY=10,e.drawImage(i,40,40);else throw console.error("Error getting canvas context"),Error("Error getting canvas context to add shadow effect")}let a=await fetch(o.toDataURL());return await a.blob()}catch(e){throw console.error("Error converting to image",e),e}finally{e.style.overflow=t,e.style.border=i,e.style.borderRadius=o,e.style.backgroundColor=a,e.style.height=u}};return{status:m,isLoading:"loading"===m,isErrored:"error"===m,isSuccess:"success"===m,copyToClipboard:async()=>{try{await navigator.clipboard.write([new ClipboardItem({["image/".concat(t)]:b()})]),p("success"),u&&u()}catch(e){"ClipboardItem is not defined"===e.message?(v(await b()),g(),p("success")):(p("error"),console.error("Error copying to clipboard",e),h&&h(e))}},ImageDownloadModal:y,ref:f}}function iy(e){let{successToast:n,failToast:t}=tA(),{isLoading:l,copyToClipboard:r,ImageDownloadModal:s,ref:o}=ij({imageType:"png",shadowEffect:!0,backgroundColor:(null==e?void 0:e.backgroundColor)||null,onSuccess:()=>{n("Copied the query result as an image to clipboard")},onError:e=>{console.error("Error taking screenshot",e),t("Failed to copy image to clipboard",e)}}),a=(0,j.useCallback)(()=>{if(o.current){let e=o.current.element||o.current;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]),d=(0,j.useCallback)(()=>{o.current&&((o.current.element||o.current).style.boxShadow="")},[o]),c=(0,j.useCallback)(async()=>{o.current?(await r(),(o.current.element||o.current).style.boxShadow=""):t("Failed to copy image to clipboard","No content to copy")},[o,r,t]);return{ref:o,CopyToClipboardButton:function(e){let{imageType:n="png",...t}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(es.z,{size:"sm",leftIcon:(0,i.jsx)(tn.T,{}),style:{position:"absolute",bottom:"16px",right:"16px"},isLoading:l,onMouseEnter:a,onMouseLeave:d,onClick:c,children:"Copy to Clipboard"}),(0,i.jsx)(s,{})]})},onMouseEnter:a,onMouseLeave:d,onCopyToClipboard:c}}let ib=e=>{let{run:n}=e,t=(null==n?void 0:n.status)==="running",l=null==n?void 0:n.status;!l&&(n.result?l="finished":n.error&&(l="failed"));let r="",s="";"successful"===l||"finished"===l?(r="green",s="Finished"):"failed"===l?(r="red",s="Failed"):"cancelled"===l?(r="gray",s="Cancelled"):"running"===l?(r="blue",s="Running"):(r="green",s="Finished");let a=(null==n?void 0:n.run_at)?function(e){let n=new Date,t=new Date;return(t.setDate(n.getDate()-1),null==e)?null:n.toDateString()===e.toDateString()?"Today, "+(0,im.WU)(e,"HH:mm"):t.toDateString()===e.toDateString()?"Yesterday, "+(0,im.WU)(e,"HH:mm"):(0,im.WU)(e,"MMM d, HH:mm")}(new Date(n.run_at)):null;return(0,i.jsxs)(o.k,{justifyContent:"start",fontSize:"11pt",color:"gray.500",gap:"3px",alignItems:"center",overflow:"hidden",children:[t&&(0,i.jsx)(tU.$,{size:"xs",color:"".concat(r,".400")}),(0,i.jsx)(el.x,{fontWeight:500,color:"".concat(r,".400"),children:s}),(0,i.jsx)(el.x,{children:"•"}),(0,i.jsx)(el.x,{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",children:a})]})},iw=e=>{let n=id.ZP.stringify(e,null,2);return(0,i.jsx)(tV.ML,{height:"100%",language:"yaml",theme:"vs",value:n,options:{readOnly:!0,fontSize:14,lineNumbers:"off",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"same",scrollBeyondLastLine:!1}})},ik=e=>{var n,t,l;let{runId:r,onClose:s,disableAddToChecklist:a}=e,{runAction:d}=nX(),{error:c,run:f,onCancel:g,isRunning:v}=ia(r),[y,w]=(0,j.useState)(),k=(0,b.NL)(),[,C]=(0,eI.TH)(),[_,S]=(0,j.useState)(0),z=(null==f?void 0:f.type)?null===(n=nB(f.type))||void 0===n?void 0:n.RunResultView:void 0,R=(0,j.useCallback)(()=>{d((null==f?void 0:f.type)||"",null==f?void 0:f.params)},[f,d]),E=null==f?void 0:f.check_id,T=(0,j.useCallback)(async()=>{E&&C("/checks/".concat(E))},[E,C]),D=(0,j.useCallback)(async()=>{if(!r)return;let e=await n$(r,y);k.invalidateQueries({queryKey:P.checks()}),C("/checks/".concat(e.check_id))},[r,C,k,y]),L=(null==f?void 0:f.type)==="query"||(null==f?void 0:f.type)==="query_diff"||(null==f?void 0:f.type)==="query_base",{ref:I,onCopyToClipboard:O,onMouseEnter:M,onMouseLeave:A}=iy();return(0,i.jsxs)(o.k,{direction:"column",children:[(0,i.jsx)(x.m,{tabIndex:_,onChange:S,flexDirection:"column",mb:"1px",children:(0,i.jsxs)(m.t,{height:"50px",children:[(0,i.jsx)(p.O,{children:"Result"}),(0,i.jsx)(p.O,{children:"Params"}),L&&(0,i.jsx)(p.O,{children:"Query"}),(0,i.jsx)(h.L,{}),(0,i.jsxs)(u.U,{overflow:"hidden",children:[f&&(0,i.jsx)(ib,{run:f}),(0,i.jsx)(es.z,{leftIcon:(0,i.jsx)(ti.n,{}),variant:"outline",isDisabled:!r||v,size:"sm",onClick:R,children:"Rerun"}),(0,i.jsx)(es.z,{leftIcon:(0,i.jsx)(tn.T,{}),variant:"outline",isDisabled:!r||!(null==f?void 0:f.result)||!!c||0!==_,onMouseEnter:M,onMouseLeave:A,size:"sm",onClick:O,children:"Copy to Clipboard"}),(0,i.jsx)(function(){return a?(0,i.jsx)(i.Fragment,{}):(null==f?void 0:f.check_id)?(0,i.jsx)(es.z,{leftIcon:(0,i.jsx)(ic.n,{}),isDisabled:!r||!(null==f?void 0:f.result)||!!c,size:"sm",colorScheme:"blue",onClick:T,children:"Go to Check"}):(0,i.jsx)(es.z,{leftIcon:(0,i.jsx)(ic.n,{}),isDisabled:!r||!(null==f?void 0:f.result)||!!c,size:"sm",colorScheme:"blue",onClick:D,children:"Add to Checklist"})},{}),(0,i.jsx)(ii.P,{onClick:()=>{s&&s()}})]})]})}),0===_&&(0,i.jsx)(tJ,{ref:I,error:c,run:f,onCancel:g,viewOptions:y,onViewOptionsChanged:w,RunResultView:z}),1===_&&f&&(0,i.jsx)(iw,{type:f.type,params:f.params}),2===_&&f&&((null===(t=f.params)||void 0===t?void 0:t.base_sql_template)?(0,i.jsx)(tP,{value:f.params.sql_template,baseValue:f.params.base_sql_template,options:{readOnly:!0}}):(0,i.jsx)(tH,{value:(null==f?void 0:null===(l=f.params)||void 0===l?void 0:l.sql_template)||"",options:{readOnly:!0}}))]})},iC=e=>{let{onClose:n,disableAddToChecklist:t}=e,{runId:l}=nX();return(0,i.jsx)(ik,{runId:l,onClose:n,disableAddToChecklist:t})};async function i_(e,n){return await ed("query",e,n)}async function iS(e,n){return await ed("query_base",e,n)}async function iz(e,n){return await ed("query_diff",e,n)}var iR=t(98834),iE=t(33517),iT=t(43800);let iD=e=>{var n;let{defaultValues:t,suggestionList:l,onValuesChange:r,isDisabled:o}=e,[a,d]=(0,j.useState)(t||[]),[c,u]=(0,j.useState)(""),[h,x]=(0,j.useState)(!1),m=(0,j.useRef)(null),p=e=>{a.includes(e)||(u(""),d([...a,e]),r([...a,e]))};return o?(0,i.jsx)(nk.u,{label:io.audit_helper,children:(0,i.jsx)(nL.I,{size:"xs",disabled:!0,placeholder:"Unavailable"})}):(0,i.jsxs)(iR.B,{size:e.size,width:e.width,children:[(0,i.jsxs)(nM.v,{isLazy:!0,closeOnSelect:!1,onOpen:()=>{var e;return null==m?void 0:null===(e=m.current)||void 0===e?void 0:e.focus()},children:[(0,i.jsxs)(nA.j,{width:"100%",children:[(0,i.jsx)(nL.I,{placeholder:e.placeholder,size:e.size,borderRadius:"4px",value:a.length>1?"".concat(a.length," ").concat(e.unitName,"s selected"):1===a.length?"".concat(a[0]):"",onChange:()=>{},backgroundColor:"white"}),0===a.length&&(0,i.jsx)(iE.x,{children:(0,i.jsx)(s.J,{as:tC.RiI,color:"blue.500",fontSize:e.size,mt:"1",mr:"6"})})]}),(0,i.jsx)(th.h,{children:(0,i.jsxs)(nq.q,{zIndex:"popover",fontSize:e.size,width:e.width,children:[(0,i.jsx)(nN.k,{children:(0,i.jsxs)(iT.E,{border:"1px solid #e2e8f0",borderRadius:"4px",width:"calc(100% - 8px)",marginX:"4px",padding:"4px",children:[a.map((n,t)=>(0,i.jsx)(iT.U,{children:(0,i.jsxs)(n3.Vp,{size:e.size,children:[(0,i.jsx)(n3.Sn,{paddingLeft:"8px",children:n}),(0,i.jsx)(n3.SD,{paddingRight:"8px",onClick:()=>{d(a.filter(e=>e!==n)),r(a.filter(e=>e!==n))}})]},n)},"tag-".concat(t))),(0,i.jsx)(iT.U,{width:"100%",children:(0,i.jsx)(nL.I,{ref:m,placeholder:"Filter or add custom keys",variant:"unstyled",size:e.size,value:c,onChange:e=>{u(e.target.value),x(!0)},onKeyDown:e=>{let n=e.currentTarget.value.trim().replace(",","");switch(e.key){case",":case"Enter":p(n),u("");break;case"Backspace":""===e.currentTarget.value&&a.length>0&&(d(a.slice(0,-1)),r(a.slice(0,-1)))}},onBlur:()=>{var e;m&&h&&(null==m||null===(e=m.current)||void 0===e||e.focus())}})})]})}),(0,i.jsx)(n9.R,{}),(0,i.jsxs)(nN.k,{children:[""!==c&&!(null==l?void 0:l.includes(c))&&(0,i.jsxs)(nV.s,{onClick:()=>{p(c),x(!1)},children:["Add '",c,"' to the list"]},"custom-value-by-filter"),null==l?void 0:null===(n=l.filter(e=>""===c||e.includes(c)).filter(e=>!a.includes(e)))||void 0===n?void 0:n.map((e,n)=>(0,i.jsx)(nV.s,{onClick:()=>p(e),children:e},"option-".concat(n)))]})]})})]}),a.length>0&&(0,i.jsx)(iE.x,{children:(0,i.jsx)(es.z,{variant:"link",color:"#3182CE",fontSize:e.size,paddingTop:"4px",paddingRight:"24px",onClick:()=>{u(""),d([]),r([])},children:"Clear"})})]})},iL=e=>{let{defaultPrimaryKeys:n,onPrimaryKeysChange:t,...l}=e,{lineageGraph:r,isActionAvailable:s}=eE(),a=(0,j.useMemo)(()=>{if(!r)return[];let e=new Set;for(let i in r.nodes){var n,t;let l=r.nodes[i],s=null===(n=l.data.base)||void 0===n?void 0:n.columns,o=null===(t=l.data.current)||void 0===t?void 0:t.columns;for(let n in s)e.add(n);for(let n in o)e.add(n)}return Array.from(e).sort()},[r]);return(0,i.jsx)(o.k,{...l,children:(0,i.jsxs)(eM.NI,{m:"4px 8px",children:[(0,i.jsxs)(eA.l,{fontSize:"8pt",margin:"0",children:["Diff with Primary Key(s) (suggested)"," ",(0,i.jsx)(nk.u,{label:"Provide a primary key to perform query diff in data warehouse and only return changed rows.",placement:"bottom-end",children:(0,i.jsx)(tY.s,{color:"gray.600",boxSize:"3"})})]}),(0,i.jsx)(iD,{unitName:"key",defaultValues:n,suggestionList:a,onValuesChange:t,size:"xs",width:"240px",placeholder:"Select or type to add keys",isDisabled:!s("query_diff_with_primary_key")})]})})};var iI=t(58631),iO=t(26969);function iM(e){let{description:n,onLike:t,onDislike:l,onClickLink:s,externalLink:d,externalLinkText:c}=e;return(0,i.jsxs)(o.k,{gap:4,justifyContent:"center",alignContent:"center",alignItems:"center",children:[n,(0,i.jsx)(nF.h,{"aria-label":"thumbs up",variant:"ghost",icon:(0,i.jsx)(a.E,{src:"/imgs/feedback/thumbs-up.png",alt:"like"}),width:"32px",height:"32px",onClick:t}),(0,i.jsx)(nF.h,{"aria-label":"thumbs down",variant:"ghost",icon:(0,i.jsx)(a.E,{src:"/imgs/feedback/thumbs-down.png",alt:"dislike"}),width:"32px",height:"32px",onClick:l}),d&&c&&(0,i.jsx)(r.r,{href:d,isExternal:!0,textDecoration:"underline",onClick:s,children:c})]})}let iA="recce-",iF={bypassSaveOverwrite:"".concat(iA,"-bypass-save-overwrite"),previewChangeFeedbackID:"".concat(iA,"-preview-change-feedback"),prepareEnvGuideID:"".concat(iA,"-prepare-env")};function iq(e){let{current:n,primaryKeys:t,setPrimaryKeys:r,onRunResultOpen:a,runQuery:c,isPending:u}=e;return(0,i.jsxs)(o.k,{justifyContent:"right",alignItems:"center",padding:"4pt 8pt",gap:"5px",height:"54px",borderBottom:"1px solid lightgray",flex:"0 0 54px",children:[(0,i.jsxs)(l.x,{children:[(0,i.jsxs)(d.X,{as:"h2",size:"md",display:"flex",alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.J,{as:iI.vc4,boxSize:"1.2em"}),"Preview Changes"]}),(0,i.jsxs)(el.x,{fontSize:"xs",color:"gray.500",children:["Compare the run results based on the modified SQL code of model"," ",(0,i.jsx)("b",{children:null==n?void 0:n.name})]})]}),(0,i.jsx)(h.L,{}),(0,i.jsx)(iL,{defaultPrimaryKeys:t,onPrimaryKeysChange:r}),(0,i.jsx)(nk.u,{label:"Run diff to see the changes",children:(0,i.jsx)(es.z,{size:"xs",marginTop:"16px",fontSize:"14px",onClick:()=>{a(),c()},colorScheme:"blue",isLoading:u,children:"Run Diff"})})]})}function iN(e){let{height:n="32px",flex:t="0 0 auto"}=e,l="0 16px";return(0,i.jsxs)(o.k,{gap:0,height:n,flex:t,fontSize:"14px",align:"center",margin:"0",backgroundColor:"#EDF2F880",children:[(0,i.jsx)(tN.K,{width:"50%",children:(0,i.jsx)(el.x,{as:"b",margin:l,children:"BASE"})}),(0,i.jsx)(tN.K,{width:"50%",children:(0,i.jsx)(el.x,{as:"b",margin:l,children:"PREVIEW EDITOR (CURRENT)"})})]})}function iV(e){let{isOpen:n,onClose:t,current:s}=e,{isOpen:h,onClose:x,onOpen:m}=(0,Y.q)(),[p,f]=(0,j.useState)((null==s?void 0:s.raw_code)||""),{showRunId:g,clearRunResult:v}=nX(),{primaryKeys:y,setPrimaryKeys:b}=_(),{data:w,isLoading:k}=ej(),C=async()=>{let e={current_model:(null==s?void 0:s.name)||"",primary_keys:y,sql_template:p},{run_id:n}=await iz(e,{nowait:!0});return g(n),await ec(n)},{mutate:S,isPending:z}=(0,tu.D)({mutationFn:C,onSuccess(e,n){e.error?eC({action:"run",node:null==s?void 0:s.name,status:"failure"}):(eC({action:"run",node:null==s?void 0:s.name,status:"success"}),setTimeout(()=>R(),1e3),!k&&(null==w?void 0:w.single_env_onboarding)&&setTimeout(()=>T(),2e3))}}),{feedbackToast:R,closeToast:E}=function(e){let n=(0,G.p)(),{feedbackId:t,description:l,onFeedbackSubmit:r,externalLink:s,externalLinkText:o}=e;return{feedbackToast:function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=localStorage.getItem(t);n.isActive(t)||"true"===a&&!1===e||n({id:t,position:"bottom-right",duration:null,render:e=>{let{id:n,onClose:a}=e;return(0,i.jsx)(tp.b,{status:"success",variant:"subtle",zIndex:"toast",borderColor:"gray.200",borderWidth:3,borderRadius:"md",backgroundColor:"white",opacity:1,children:(0,i.jsx)(iO.X,{fontSize:"md",children:(0,i.jsxs)(u.U,{children:[(0,i.jsx)(iM,{description:l,onLike:()=>{r("like"),a(),localStorage.setItem(t,"true")},onDislike:()=>{r("dislike"),a(),localStorage.setItem(t,"true")},externalLink:s,externalLinkText:o,onClickLink:()=>{r("link")}}),(0,i.jsx)(ii.P,{onClick:()=>{a()}})]})})})}})},closeToast:()=>n.closeAll()}}({feedbackId:iF.previewChangeFeedbackID,description:"Enjoy preview change?",onFeedbackSubmit:e=>{switch(e){case"like":e_({feedback:"like",node:null==s?void 0:s.name});break;case"dislike":e_({feedback:"dislike",node:null==s?void 0:s.name});break;case"link":e_({feedback:"form",node:null==s?void 0:s.name});break;default:console.log("Not support feedback type")}},externalLink:"https://docs.google.com/forms/d/e/1FAIpQLSd7Lei7Ijwo7MinWaI0K6rzZi_21gV1BKetmiNEX254kDziDA/viewform?usp=header",externalLinkText:"Give us feedback"}),{guideToast:T,closeGuideToast:D}=function(e){let n=(0,G.p)(),{guideId:t,description:l,externalLink:s,externalLinkText:o,onExternalLinkClick:a}=e;return{guideToast:function(){n.isActive(t)||n({id:t,position:"bottom-right",duration:3e3,description:"some text",render:e=>{let{id:n,onClose:t}=e;return(0,i.jsx)(tp.b,{status:"success",variant:"subtle",zIndex:"toast",borderColor:"gray.200",borderWidth:3,borderRadius:"md",backgroundColor:"white",opacity:1,children:(0,i.jsx)(iO.X,{fontSize:"md",children:(0,i.jsxs)(u.U,{children:[(0,i.jsxs)(el.x,{children:[l," ",(0,i.jsx)(r.r,{textDecor:"underline",isExternal:!0,href:s,onClick:()=>{a&&a(),t()},children:o})]}),(0,i.jsx)(ii.P,{onClick:()=>{t()}})]})})})}})},closeGuideToast:()=>n.closeAll()}}({guideId:iF.prepareEnvGuideID,description:"Want to compare data changes with production data?",externalLink:"https://datarecce.io/docs/get-started/#prepare-dbt-artifacts",externalLinkText:"Learn how.",onExternalLinkClick:()=>eS({action:"external_link",from:"preview_changes",node:null==s?void 0:s.name})});return(0,j.useEffect)(()=>{n&&f((null==s?void 0:s.raw_code)||"")},[n,s]),(0,i.jsx)($.u_,{isOpen:n,size:"full",onClose:()=>{t(),x(),v(),E(),D(),eC({action:"close",node:null==s?void 0:s.name})},children:(0,i.jsxs)(en.h,{height:"100%",children:[(0,i.jsx)(et.x,{height:"40px",bg:"rgb(77, 209, 176)",px:0,py:4,children:(0,i.jsxs)(o.k,{alignItems:"center",height:"100%",gap:"10px",children:[(0,i.jsx)(a.E,{boxSize:"20px",ml:"18px",src:"/logo/recce-logo-white.png",alt:"recce-logo-white"}),(0,i.jsx)(d.X,{as:"h1",fontFamily:'"Montserrat", sans-serif',fontSize:"lg",color:"white",children:"RECCE"}),(0,i.jsx)(c.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:"Experiment"})]})}),(0,i.jsx)(eD.o,{}),(0,i.jsx)(ei.f,{p:0,children:(0,i.jsxs)(tb,{sizes:h?[50,50]:[100,0],minSize:h?100:0,gutterSize:h?5:0,style:{flex:"1",contain:"size",height:"100%"},children:[(0,i.jsxs)(o.k,{direction:"column",height:"100%",m:0,p:0,children:[(0,i.jsx)(iq,{current:s,primaryKeys:null!=y?y:[],setPrimaryKeys:b,onRunResultOpen:m,runQuery:S,isPending:z}),(0,i.jsx)(iN,{height:"32pxs",flex:"0 0 auto"}),(0,i.jsx)(ir,{current:s,onChange:f})]}),h?(0,i.jsx)(iC,{onClose:x,disableAddToChecklist:!0}):(0,i.jsx)(l.x,{})]})}),(0,i.jsx)(l.x,{position:"fixed",bottom:"4",right:"4",opacity:.5,children:(0,i.jsx)(nk.u,{label:"Give us feedback",children:(0,i.jsx)(nF.h,{"aria-label":"feedback",icon:(0,i.jsx)(e7.xJq,{}),variant:"ghost",size:"md",onClick:()=>{R(!0)}})})})]})})}function iH(e){let{node:n,onCloseNode:t}=e,[,r]=(0,eI.TH)(),{setSqlQuery:a,setPrimaryKeys:c}=_(),f="model"===n.resourceType||"seed"===n.resourceType||"source"===n.resourceType||"snapshot"===n.resourceType,{isOpen:g,onOpen:v,onClose:y}=(0,Y.q)(),{isOpen:b,onOpen:w,onClose:k}=(0,Y.q)(),{runAction:C}=nX(),{envInfo:S,isActionAvailable:z}=eE(),{primaryKey:R}=eH(n.name),E=()=>{C("row_count_diff",{node_names:[n.name]},{showForm:!1,showLast:!1})},{data:T}=ej(),D=null==T?void 0:T.single_env_onboarding,L=(0,j.useCallback)(async()=>{let e=n.id,t=await is({node_id:e});r("/checks/".concat(t.check_id))},[n,r]),I=(e,n)=>e?io.add_or_remove:z(n)?"":"value_diff"===n?io.audit_helper:"profile_diff"===n?io.dbt_profiler:"This action is not supported yet.",O="added"===n.changeStatus||"removed"===n.changeStatus;return(0,i.jsxs)(it.r,{height:"100%",templateRows:"auto auto 1fr",children:[(0,i.jsxs)(u.U,{children:[(0,i.jsx)(l.x,{flex:"0 1 20%",p:"16px",children:(0,i.jsx)(d.X,{size:"sm",children:n.name})}),(0,i.jsx)(h.L,{}),D?(0,i.jsx)(function(){return(0,i.jsx)(es.z,{as:es.z,size:"sm",colorScheme:"blue",onClick:()=>{z("query_diff_with_primary_key")&&c(void 0!==R?[R]:void 0),w(),eS({action:"preview_changes",node:n.name})},children:"Preview Changes"})},{}):(0,i.jsx)(function(){var e,t,l,o,d,u,h,x;return"model"!==n.resourceType&&"seed"!==n.resourceType&&"snapshot"!==n.resourceType?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(nM.v,{children:[(0,i.jsx)(nA.j,{as:es.z,size:"sm",colorScheme:"blue",children:"Explore Change"}),(0,i.jsxs)(nq.q,{children:[(0,i.jsx)(nV.s,{icon:(0,i.jsx)(s.J,{as:null===(e=nB("query_diff"))||void 0===e?void 0:e.icon}),fontSize:"14px",onClick:()=>{(null==S?void 0:S.adapterType)==="dbt"?a('select * from {{ ref("'.concat(n.name,'") }}')):(null==S?void 0:S.adapterType)==="sqlmesh"&&a("select * from ".concat(n.name)),z("query_diff_with_primary_key")&&c(void 0!==R?[R]:void 0),r("/query")},children:"Query"}),(0,i.jsx)(nV.s,{fontSize:"14px",icon:(0,i.jsx)(s.J,{as:null===(t=nB("preview_change"))||void 0===t?void 0:t.icon}),onClick:()=>{z("query_diff_with_primary_key")&&c(void 0!==R?[R]:void 0),w(),eC({action:"explore",node:n.name})},children:"Preview Change (Experiment)"}),(0,i.jsx)(n9.R,{}),(0,i.jsxs)(nN.k,{title:"Diff",m:"0",p:"4px 12px",children:[("model"===n.resourceType||"snapshot"===n.resourceType)&&(0,i.jsx)(nV.s,{onClick:v,icon:(0,i.jsx)(tk.tvD,{}),fontSize:"14px",children:"Code Diff"}),(0,i.jsx)(nV.s,{icon:(0,i.jsx)(s.J,{as:null===(l=nB("row_count_diff"))||void 0===l?void 0:l.icon}),fontSize:"14px",onClick:()=>E(),children:"Row Count Diff"}),(0,i.jsx)(nk.u,{label:I(O,"profile_diff"),placement:"left",children:(0,i.jsx)(nV.s,{icon:(0,i.jsx)(s.J,{as:null===(o=nB("profile_diff"))||void 0===o?void 0:o.icon}),fontSize:"14px",isDisabled:O||!z("profile_diff"),onClick:()=>{C("profile_diff",{model:n.name},{showForm:!1,showLast:!1})},children:"Profile Diff"})}),(0,i.jsx)(nk.u,{label:I(O,"value_diff"),placement:"left",children:(0,i.jsx)(nV.s,{icon:(0,i.jsx)(s.J,{as:null===(d=nB("value_diff"))||void 0===d?void 0:d.icon}),fontSize:"14px",isDisabled:O||!z("value_diff"),onClick:()=>{C("value_diff",{model:n.name},{showForm:!0,showLast:!1})},children:"Value Diff"})}),(0,i.jsx)(nk.u,{label:I(O,"top_k_diff"),placement:"left",children:(0,i.jsx)(nV.s,{icon:(0,i.jsx)(s.J,{as:null===(u=nB("top_k_diff"))||void 0===u?void 0:u.icon}),fontSize:"14px",isDisabled:O,onClick:()=>{C("top_k_diff",{model:n.name,column_name:"",k:50},{showForm:!0})},children:"Top-K Diff"})}),(0,i.jsx)(nk.u,{label:I(O,"histogram_diff"),placement:"left",children:(0,i.jsx)(nV.s,{icon:(0,i.jsx)(s.J,{as:null===(h=nB("histogram_diff"))||void 0===h?void 0:h.icon}),fontSize:"14px",isDisabled:O,onClick:()=>{C("histogram_diff",{model:n.name,column_name:"",column_type:""},{showForm:!0})},children:"Histogram Diff"})})]}),(0,i.jsx)(n9.R,{}),(0,i.jsx)(nN.k,{title:"Add to Checklist",m:"0",p:"4px 12px",children:(0,i.jsx)(nV.s,{icon:(0,i.jsx)(s.J,{as:null===(x=nB("schema_diff"))||void 0===x?void 0:x.icon}),fontSize:"14px",onClick:L,children:"Schema Diff"})})]})]})},{}),(0,i.jsx)(l.x,{flex:"0 1 1%",children:(0,i.jsx)(ii.P,{onClick:t})})]}),(0,i.jsx)(l.x,{color:"gray",paddingLeft:"16px",children:(0,i.jsxs)(u.U,{spacing:"8px",children:[(0,i.jsx)(t5,{node:n}),("model"===n.resourceType||"snapshot"===n.resourceType||"seed"===n.resourceType)&&(0,i.jsx)(t4,{node:n,onRefresh:E})]})}),f&&(0,i.jsxs)(x.m,{overflow:"auto",as:o.k,children:[(0,i.jsx)(m.t,{children:(0,i.jsx)(p.O,{children:"Columns"})}),(0,i.jsx)(n8.n,{overflow:"auto",height:"calc(100% - 42px)",children:(0,i.jsx)(n7.x,{p:0,overflowY:"auto",height:"100%",children:(0,i.jsx)(tg,{base:n.data.base,current:n.data.current})})})]}),(0,i.jsxs)($.u_,{isOpen:g,onClose:y,size:"6xl",children:[(0,i.jsx)(ee.Z,{}),(0,i.jsxs)(en.h,{overflowY:"auto",height:"75%",children:[(0,i.jsx)(et.x,{children:"Model Raw Code Diff"}),(0,i.jsx)(eD.o,{}),(0,i.jsx)(ei.f,{children:(0,i.jsx)(il,{base:n.data.base,current:n.data.current})})]})]}),(0,i.jsx)(iV,{isOpen:b,onClose:k,current:n.data.current})]})}function iP(e){var n,t;let{onClose:r}=e,{cancel:s,actionState:o}=t9();return(0,i.jsx)(l.x,{bg:"white",rounded:"md",shadow:"dark-lg",children:(0,i.jsxs)(u.U,{p:"5px 15px",mt:"4",divider:(0,i.jsx)(tZ.c,{borderColor:"gray.200"}),spacing:4,children:[(0,i.jsxs)(l.x,{fontSize:"10pt",children:["Progress: ","per_node"===o.mode?"".concat(o.completed," / ").concat(o.total):(null===(t=o.currentRun)||void 0===t?void 0:null===(n=t.progress)||void 0===n?void 0:n.percentage)?"".concat(100*o.currentRun.progress.percentage,"%"):"completed"===o.status?"100%":"0%"," ","canceled"===o.status?" (canceled)":""]}),"running"===o.status||"canceling"===o.status?(0,i.jsx)(es.z,{size:"xs",variant:"outline",onClick:s,isLoading:"canceling"===o.status,loadingText:"Canceling",children:"Cancel"}):(0,i.jsx)(u.U,{children:(0,i.jsx)(es.z,{size:"xs",variant:"outline",onClick:r,children:"Close"})})]})})}var iW=t(36571),iK=t(53388),iJ=t(52346);let iB=()=>(0,i.jsxs)(nu.g,{align:"start",spacing:0,children:[(0,i.jsx)(el.x,{fontSize:"10pt",color:"gray.500",pb:1,children:"Select nodes by dbt node selector syntax"}),(0,i.jsxs)(el.x,{fontSize:"8pt",children:[(0,i.jsx)(iW.E,{fontSize:"8pt",children:"model_name"})," Select a node"]}),(0,i.jsxs)(el.x,{fontSize:"8pt",children:[(0,i.jsx)(iW.E,{fontSize:"8pt",children:"model_name+"})," Select downstream nodes"]}),(0,i.jsxs)(el.x,{fontSize:"8pt",children:[(0,i.jsx)(iW.E,{fontSize:"8pt",children:"+model_name"})," Select upstream nodes"]}),(0,i.jsxs)(el.x,{fontSize:"8pt",children:[(0,i.jsx)(iW.E,{fontSize:"8pt",children:"model*"})," Select by wildcard"]})]}),iU=()=>{let{isHistoryOpen:e,showHistory:n,closeHistory:t}=nX();return(0,i.jsx)(es.z,{leftIcon:(0,i.jsx)(s.J,{as:e7.M1Q}),size:"xs",variant:"outline",onClick:()=>{e?(ek({name:"hide"}),t()):(ek({name:"show"}),n())},children:e?"Hide":"Show"})},iZ=e=>{let{isDisabled:n}=e,{viewOptions:t,onViewOptionsChanged:l,selectMode:r}=t9(),o=t.view_mode||"changed_models",a=e=>{l({...t,view_mode:e})};return(0,i.jsxs)(nM.v,{children:[(0,i.jsx)(nA.j,{as:es.z,minWidth:"100px",leftIcon:(0,i.jsx)(s.J,{as:tE("model").icon}),size:"xs",variant:"outline",isDisabled:n,children:"changed_models"===o?"Changed Models":"All"}),(0,i.jsxs)(nq.q,{title:"packages",children:[(0,i.jsx)(nV.s,{as:nh.X,size:"sm",isChecked:"changed_models"===o,onChange:()=>a("changed_models"),children:"Changed Models"}),(0,i.jsx)(nV.s,{as:nh.X,size:"sm",isChecked:"all"===o,onChange:()=>a("all"),children:"All"})]})]})},iQ=e=>{var n,t;let{isDisabled:l}=e,{lineageGraph:r}=eE(),{viewOptions:o,onViewOptionsChanged:a}=t9(),d=new Set;for(let e of Object.values((null==r?void 0:r.nodes)||{}))e.packageName&&d.add(e.packageName);let c=null==r?void 0:null===(t=r.manifestMetadata)||void 0===t?void 0:null===(n=t.current)||void 0===n?void 0:n.project_name,u=o.packages?new Set(o.packages):c?new Set([c]):d,h=u.size===d.size,x=0===u.size,m=1===u.size?Array.from(u)[0]:h?"All Packages":x?"No Package":"".concat(u.size," Packages"),p=e=>{let n=new Set(u);n.has(e)?n.delete(e):n.add(e),a({...o,packages:Array.from(n)})};return(0,i.jsxs)(nM.v,{closeOnSelect:!1,children:[(0,i.jsx)(nA.j,{as:es.z,minWidth:"100px",leftIcon:(0,i.jsx)(s.J,{as:t0.zFh}),size:"xs",variant:"outline",isDisabled:l,children:m}),(0,i.jsx)(nq.q,{title:"packages",children:(0,i.jsxs)(nN.k,{title:"Select Packages",children:[(0,i.jsx)(nV.s,{as:nh.X,size:"sm",isIndeterminate:!h&&!x,isChecked:h,onChange:()=>{h?a({...o,packages:[]}):a({...o,packages:Array.from(d)})},children:"Select All"}),(0,i.jsx)(n9.R,{}),Array.from(d).map(e=>(0,i.jsx)(nV.s,{as:nh.X,size:"sm",isChecked:u.has(e),onChange:()=>{p(e)},children:e},e))]})})]})},iX=e=>{let[n,t]=(0,j.useState)(e.value),{data:l}=ej(),r=(0,j.useRef)(null);return(0,j.useEffect)(()=>{r.current&&(r.current.value=e.value)},[e.value]),(0,i.jsx)(nk.u,{width:"300px",padding:2,shadow:"md",borderWidth:1,rounded:"md",styleConfig:{zIndex:"dropdown"},label:e.tooltipComponent,placement:"bottom-start",defaultIsOpen:!0,color:"black",backgroundColor:"white",closeOnClick:!1,isDisabled:!(null==l?void 0:l.single_env_onboarding),children:(0,i.jsx)(nL.I,{ref:r,height:"24px",fontSize:"10pt",placeholder:"with selectors",isDisabled:e.isDisabled,value:n,onChange:e=>{t(e.target.value)},onKeyUp:i=>{"Enter"===i.key?e.onChange(n):"Escape"===i.key&&(i.preventDefault(),t(e.value),r.current&&r.current.blur())},onBlur:()=>t(e.value)})})},iG=e=>{let{isDisabled:n}=e,{viewOptions:t,onViewOptionsChanged:l}=t9();return(0,i.jsx)(iX,{isDisabled:n,value:t.select||"",onChange:e=>{l({...t,select:e||void 0})},tooltipComponent:(0,i.jsx)(iB,{})})},iY=e=>{let{isDisabled:n}=e,{viewOptions:t,onViewOptionsChanged:l}=t9();return(0,i.jsx)(iX,{isDisabled:n,value:t.exclude||"",onChange:e=>{l({...t,exclude:e||void 0})}})},i$=e=>(0,i.jsxs)(l.x,{style:e.style,maxWidth:"300px",children:[(0,i.jsx)(l.x,{fontSize:"8pt",children:(null==e?void 0:e.label)||(0,i.jsx)(i.Fragment,{children:"\xa0"})}),e.children]}),i0=()=>{var e,n,t,l;let{nodes:r,deselect:o,selectMode:a,...d}=t9(),{isActionAvailable:c}=eE(),x=(0,j.useMemo)(()=>r.filter(e=>e.data.isSelected),[r]),{data:m}=ej(),p=null==m?void 0:m.single_env_onboarding,f="single"===a&&1===x.length,g="multi"===a&&x.length>=1,v="single"===a&&0===x.length,y="single"!==a;return(0,i.jsx)(u.U,{width:"100%",padding:"4pt 8pt",children:(0,i.jsxs)(u.U,{flex:"1",children:[(0,i.jsx)(i$,{label:"History",style:{flexShrink:"1"},children:(0,i.jsx)(iU,{})}),(0,i.jsx)(i$,{label:"Mode",style:{flexShrink:"1"},children:(0,i.jsx)(iZ,{isDisabled:y})}),(0,i.jsx)(i$,{label:"Package",style:{flexShrink:"1"},children:(0,i.jsx)(iQ,{isDisabled:y})}),(0,i.jsx)(i$,{label:"Select",style:{flex:"100 1 auto"},children:(0,i.jsx)(iG,{isDisabled:y})}),(0,i.jsx)(i$,{label:"Exclude",style:{flex:"100 1 auto"},children:(0,i.jsx)(iY,{isDisabled:y})}),(0,i.jsx)(h.L,{}),"multi"===a&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(i$,{label:"",style:{flexShrink:"0"},children:(0,i.jsx)(el.x,{fontSize:"9pt",color:"gray.500",children:x.length>1?"".concat(x.length," nodes selected"):"".concat(x.length," node selected")})}),(0,i.jsx)(i$,{label:"",children:(0,i.jsx)(es.z,{variant:"outline",size:"xs",fontSize:"9pt",isDisabled:"multi"!==a,onClick:()=>{o()},children:"Deselect"})})]}),!p&&(0,i.jsx)(i$,{label:"Explore",children:(0,i.jsx)(iK.h,{isAttached:!0,variant:"outline",children:(0,i.jsxs)(nM.v,{placement:"bottom-end",children:[(0,i.jsx)(nA.j,{as:es.z,size:"xs",rightIcon:(0,i.jsx)(iJ.v,{}),children:"Actions"}),(0,i.jsxs)(nq.q,{children:[(0,i.jsxs)(nN.k,{title:"Diff",m:"0",p:"4px 12px",children:[(0,i.jsx)(nV.s,{as:el.x,size:"sm",fontSize:"10pt",isDisabled:!(v||f||g),icon:(0,i.jsx)(s.J,{as:null===(e=nB("row_count_diff"))||void 0===e?void 0:e.icon}),onClick:()=>{d.runRowCountDiff()},children:"Row Count Diff"}),(0,i.jsx)(nk.u,{label:c("value_diff")?null:io.audit_helper,placement:"left",children:(0,i.jsx)(nV.s,{as:el.x,size:"sm",fontSize:"10pt",isDisabled:!(v||f||g)||!c("value_diff"),icon:(0,i.jsx)(s.J,{as:null===(n=nB("value_diff"))||void 0===n?void 0:n.icon}),onClick:()=>{d.runValueDiff()},children:"Value Diff"})})]}),(0,i.jsx)(n9.R,{}),(0,i.jsxs)(nN.k,{title:"Add to Checklist",m:"0",px:"12px",children:[(0,i.jsx)(nV.s,{as:el.x,size:"sm",fontSize:"10pt",isDisabled:!(v||g&&x.length>1),icon:(0,i.jsx)(s.J,{as:null===(t=nB("lineage_diff"))||void 0===t?void 0:t.icon}),onClick:()=>{d.addLineageDiffCheck(d.viewOptions.view_mode)},children:"Lineage Diff"}),(0,i.jsx)(nV.s,{as:el.x,size:"sm",fontSize:"10pt",isDisabled:!(v||f||g),icon:(0,i.jsx)(s.J,{as:null===(l=nB("schema_diff"))||void 0===l?void 0:l.icon}),onClick:()=>{d.addSchemaDiffCheck()},children:"Schema Diff"})]})]})]})})})]})})};async function i1(e){return(await U.post("/api/checks",{type:"lineage_diff",params:{},view_options:e})).data}function i5(){return(0,i.jsx)(l.x,{bg:"white",padding:"12px",borderWidth:"1px",borderColor:"gray.200",fontSize:"sm",children:Object.entries({added:["Added","Added resource"],removed:["Removed","Removed resource"],modified:["Modified","Modified resource"]}).map(e=>{let[n,[t,l]]=e,{icon:r,color:a}=tR(n);return(0,i.jsx)(nk.u,{label:l,children:(0,i.jsxs)(o.k,{alignItems:"center",gap:"6px",marginBottom:"2px",children:[(0,i.jsx)(s.J,{color:a,as:r})," ",t]})},n)})})}var i2=t(9690);let i4={mode:"per_node",status:"pending",completed:0,total:0},i6=(e,n)=>{let{onActionStarted:t,onActionNodeUpdated:i,onActionCompleted:l}=n,r=(0,j.useRef)({...i4}).current,{showRunId:s}=nX(),o=async(n,o,a)=>{let d="multi_nodes";r.mode=d,t(),r.status="running";let c=[];for(let n of e){let e=o(n);n.isActionMode=!0,e?(n.action={mode:d,status:"skipped",skipReason:e},i(n)):(n.action={mode:d,status:"pending"},c.push(n))}let u=a(c);try{let{run_id:e}=await ed(n,u,{nowait:!0});for(s(e),r.currentRun={run_id:e},r.total=1;;){let n=await ec(e,2);r.currentRun=n;let t=n.error?"failure":n.result?"success":"running";for(let e of c)e.action={mode:d,status:t,run:n},i(e);if(n.error||n.result)break}}catch(e){}if(r.completed=1,"canceling"===r.status){r.status="canceled",l();return}r.status="completed",l()},a=async(n,s)=>{let o="per_node";for(let n of(r.mode=o,t(),r.status="running",e))n.action={mode:o,status:"pending"},i(n);for(let t of(r.completed=0,r.total=e.length,e)){let{params:e,skipReason:a}=s(t);if(t.isActionMode=!0,a)t.action={mode:o,status:"skipped",skipReason:a},i(t);else try{let{run_id:l}=await ed(n,e,{nowait:!0});for(r.currentRun={run_id:l},t.action={mode:o,status:"running"},i(t);;){let e=await ec(l,2);r.currentRun=e;let n=e.error?"failure":e.result?"success":"running";if(t.action={mode:o,status:n,run:e},i(t),e.error||e.result)break}}catch(e){}finally{r.currentRun=void 0}if(r.completed++,"canceling"===r.status){r.status="canceled",l();return}}r.status="completed",l()},d=async()=>{var e;r.status="canceling",(null===(e=r.currentRun)||void 0===e?void 0:e.run_id)&&await eu(r.currentRun.run_id)};return{actionState:r,runRowCountDiff:async()=>{let n=[];for(let t of e)"model"!==t.resourceType?(t.action={mode:"multi_nodes",status:"skipped",skipReason:"Not a model"},i(t)):n.push(t.name);await o("row_count_diff",e=>{if("model"!==e.resourceType)return"Not a model"},e=>({node_names:e.map(e=>e.name)}))},runValueDiff:async()=>{a("value_diff",e=>{var n,t;let i=null===(t=e.data)||void 0===t?void 0:null===(n=t.current)||void 0===n?void 0:n.primary_key;return i?{params:{model:e.name,primary_key:i}}:{skipReason:"No primary key found. The first unique column is used as primary key."}})},addLineageDiffCheck:async()=>{let n=e.map(e=>e.id);return await i1({node_ids:n})},addSchemaDiffCheck:async()=>{let n;if(1===e.length)n=await is({node_id:e[0].id});else{let t=e.map(e=>e.id);n=await is({node_id:t})}return n},cancel:d,reset:()=>{Object.assign(r,i4)}}};var i3=t(41798),i9=function(){let{isOpen:e,onOpen:n,onClose:t}=(0,Y.q)(),[r,s]=(0,j.useState)(0),[a,d]=(0,j.useState)(),c=(0,j.useRef)(),u=(0,j.useCallback)(e=>(s(e),new Promise(e=>{d(()=>e),n()})),[n]),h=()=>{null==a||a(!1),t()};return{confirm:u,AlertDialog:(0,i.jsx)(i3.aR,{size:"xl",isOpen:e,leastDestructiveRef:c,onClose:h,children:(0,i.jsx)(ee.Z,{children:(0,i.jsxs)(i3._T,{children:[(0,i.jsxs)(et.x,{fontSize:"lg",fontWeight:"bold",children:["Value Diff on ",r," nodes"]}),(0,i.jsx)(ei.f,{gap:"20px",as:o.k,direction:"column",children:(0,i.jsxs)(l.x,{children:["Value diff will be executed on ",r," nodes in the Lineage, which can add extra costs to your bill."]})}),(0,i.jsxs)(er.m,{children:[(0,i.jsx)(es.z,{ref:c,onClick:h,children:"Cancel"}),(0,i.jsx)(es.z,{colorScheme:"blue",onClick:()=>{null==a||a(!0),t()},ml:3,children:"Execute"})]})]})})})}};let i8={customNode:function(e){var n,t;let{data:r}=e,{isHighlighted:a,isSelected:d,resourceType:c,changeStatus:x}=r,m=(0,R.oR)(e=>e.transform[2]>.3),{icon:p}=tE(c),[f,g]=(0,j.useState)(!1),{interactive:v,selectNodeMulti:y,selectMode:b}=t9(),{icon:w,color:k,backgroundColor:C}=x?tR(x):{icon:void 0,color:"gray.400",backgroundColor:"gray.100"},_="solid";r.isSelected;let S=null==r?void 0:r.name;return(0,i.jsx)(nk.u,{label:"model"===c?S:"".concat(S," (").concat(c,")"),placement:"top",children:(0,i.jsxs)(o.k,{width:"300px",borderColor:k,borderWidth:1,borderStyle:_,backgroundColor:m?"multi"===b?d?k:"white":"action_result"!==b?d?C:"white":r.action?d?C:k:"white":d?k:C,borderRadius:3,transition:"box-shadow 0.2s ease-in-out",padding:0,filter:"action_result"===b?(null==r?void 0:r.action)?"none":"opacity(0.2) grayscale(50%)":a||d?"none":"opacity(0.2) grayscale(50%)",onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),children:[(0,i.jsx)(o.k,{backgroundColor:k,padding:v?"8px":"2px",borderRightWidth:1,borderColor:"multi"===b?"#00000020":k,borderStyle:_,alignItems:"top",visibility:m?"inherit":"hidden",children:v&&(0,i.jsx)(t7,{checked:"multi"===b&&d||"action_result"===b&&!!r.action,onClick:e=>{"action_result"!==b&&(e.stopPropagation(),y(r.id))}})}),(0,i.jsxs)(o.k,{flex:"1 0 auto",mx:"1",width:"100px",direction:"column",height:"60px",children:[(0,i.jsxs)(o.k,{width:"100%",textAlign:"left",fontWeight:"600",flex:"1",p:1,gap:"5px",alignItems:"center",visibility:m?"inherit":"hidden",children:[(0,i.jsx)(l.x,{flex:"1",color:"multi"===b?d?"white":"inherit":"action_result"===b&&r.action&&!d?"white":"inherit",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:S}),(0,i.jsx)(s.J,{boxSize:"16px",color:"multi"===b?d?"white":"inherit":"action_result"===b&&r.action&&!d?"white":"inherit",as:p}),w&&(0,i.jsx)(s.J,{color:"multi"===b?d?"white":k:"action_result"===b?r.action&&!d?"white":"inherit":k,as:w})]}),(0,i.jsx)(o.k,{flex:"1 0 auto",mx:"1",direction:"column",paddingBottom:"1",visibility:m?"inherit":"hidden",children:(0,i.jsxs)(u.U,{spacing:"8px",children:["action_result"!==b&&"model"===r.resourceType&&(0,i.jsx)(t8,{id:r.id,inverted:"multi"===b&&!!d}),(0,i.jsx)(h.L,{}),r.isActionMode&&(r.action?(0,i.jsx)(t6,{node:r,action:r.action}):(0,i.jsx)(i.Fragment,{}))]})})]}),Object.keys(null!==(n=null==r?void 0:r.parents)&&void 0!==n?n:{}).length>0&&(0,i.jsx)(R.HH,{type:"target",position:R.Ly.Left,isConnectable:!1}),Object.keys(null!==(t=null==r?void 0:r.children)&&void 0!==t?t:{}).length>0&&(0,i.jsx)(R.HH,{type:"source",position:R.Ly.Right,isConnectable:!1})]})})}},i7={customEdge:function(e){let{sourceX:n,sourceY:t,targetX:l,targetY:r,sourcePosition:s,targetPosition:o,style:a={},markerEnd:d,data:c}=e,u={...a};(null==c?void 0:c.changeStatus)&&(u.stroke=tR(null==c?void 0:c.changeStatus).color,u.strokeDasharray="5"),(null==c?void 0:c.isHighlighted)===!1&&(u.filter="opacity(0.2) grayscale(50%)");let[h]=(0,R.OQ)({sourceX:n,sourceY:t,sourcePosition:s,targetX:l,targetY:r,targetPosition:o});return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(R.u5,{path:h,markerEnd:d,style:{...u,...a}})})}},le=e=>{var n,t;return(null==e?void 0:null===(n=e.data)||void 0===n?void 0:n.changeStatus)?tR(null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.changeStatus).color:"lightgray"},ln=(e,n)=>{let t=null==e?void 0:e.current,i=(0,j.useRef)({width:0,height:0});(0,j.useEffect)(()=>{let e=new ResizeObserver(e=>{for(let t of e){let e=t.contentRect.width,l=t.contentRect.height;(Math.abs(l-i.current.height)>10||Math.abs(e-i.current.width)>10)&&i.current.height>0&&l>0&&i.current.width>0&&e>0&&n(),i.current={width:e,height:l}}});return t&&e.observe(t),()=>{t&&e.unobserve(t)}},[t,i,n])},lt=()=>{let[,e]=(0,eI.TH)();return(0,j.useCallback)(n=>{n.check_id&&e("/checks/".concat(n.check_id))},[e])},li=(0,j.forwardRef)(function(e,n){var t,r;let{interactive:a=!1,...d}=e,c=(0,R._K)(),h=(0,j.useRef)(null),{successToast:x,failToast:m}=tA(),{copyToClipboard:p,ImageDownloadModal:f,ref:g}=ij({renderLibrary:"html-to-image",imageType:"png",shadowEffect:!0,backgroundColor:"white",ignoreElements:e=>{let n=e.className;return!!("string"==typeof n&&n.includes(iv))},onSuccess:()=>{x("Copied the Lineage View as an image to clipboard")},onError:e=>{console.error("Error taking screenshot",e),m("Failed to copy image to clipboard",e)}}),[v,y,b]=(0,R.Rr)([]),[w,k,C]=(0,R.ll)([]),{lineageGraph:_,retchLineageGraph:S,isLoading:z,error:E,refetchRunsAggregated:D}=eE(),{showRunId:L,closeRunResult:P,runAction:W}=nX(),K=_&&(null==_?void 0:null===(t=_.modifiedSet)||void 0===t?void 0:t.length)>0,[J,B]=(0,j.useState)({view_mode:K?"changed_models":"all",...d.viewOptions});(0,j.useImperativeHandle)(n,()=>({copyToClipboard:p}));let U=J.view_mode||"changed_models",[Z,Q]=(0,j.useState)("single"),X=(0,j.useMemo)(()=>{var e;if("single"===Z)return null===(e=v.find(e=>e.data.isSelected))||void 0===e?void 0:e.data},[Z,v]),Y=(0,j.useMemo)(()=>v.filter(e=>e.data.isSelected).map(e=>e.data),[v]),$=(0,j.useMemo)(()=>v.map(e=>e.data),[v]),[ee,en]=(0,j.useState)(!1),[et,ei]=(0,j.useState)({x:0,y:0}),er=(0,G.p)();(0,j.useLayoutEffect)(()=>{(async()=>{let e;if(!_)return;if(J.node_ids)e=J.node_ids;else{var n;let t=null===(n=_.manifestMetadata.current)||void 0===n?void 0:n.project_name,i={view_mode:J.view_mode,packages:t?[t]:void 0,...d.viewOptions};B(i),e=(await tv({select:i.select,exclude:i.exclude,packages:i.packages,view_mode:i.view_mode})).nodes}let[t,i]=M(_,e);A(t,i),y(t),k(i)})()},[_]);let eo=async e=>{if(e.width&&e.height){let n=e.position.x+e.width/2,t=e.position.y+e.height/2,i=c.getZoom();c.setCenter(n,t,{zoom:i,duration:200})}},ea=lt();ln(h,async()=>{if("single"===Z||"action_result"===Z){let e=v.find(e=>e.data.isSelected);e?eo(e):c.fitView({nodes:v,duration:200})}});let ed=(0,j.useCallback)(e=>{y(n=>n.map(n=>n.id===e.id?{...n,data:e}:n))},[y]),ec=async e=>{let n;if(!_)return;try{n=(await tv({select:e.select,exclude:e.exclude,packages:e.packages,view_mode:e.view_mode})).nodes}catch(e){if(e instanceof i2.d7){var t,i;er({title:"Select node error",description:(null===(i=e.response)||void 0===i?void 0:null===(t=i.data)||void 0===t?void 0:t.detail)||e.message,status:"error",isClosable:!0,position:"bottom-right"})}return}let[l,r]=M(_,n);A(l,r),y(l),k(r),B(e),await new Promise(e=>setTimeout(e,1)),await (async()=>{c.fitView({nodes:l,duration:200})})()},eu=i6("multi"===Z?Y:$,{onActionStarted:()=>{Q("action_result")},onActionNodeUpdated:ed,onActionCompleted:()=>{}}),eh=i9();if(z)return(0,i.jsx)(o.k,{width:"100%",height:"100%",alignItems:"center",justifyContent:"center",children:(0,i.jsx)(tU.$,{size:"xl"})});let ex=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,n=et.selectedNode;"action_result"!==Z&&void 0!==n&&void 0!==_&&("single"===Z&&(y(H(v,!0)),Q("multi"),eu.reset()),y(V([...I(_,[n.id],e)],v,"single"===Z)))},em=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,n=et.selectedNode;"action_result"!==Z&&void 0!==n&&void 0!==_&&("single"===Z&&(y(H(v,!0)),Q("multi"),eu.reset()),y(V([...O(_,[n.id],e)],v,"single"===Z)))},ep=()=>{en(!1),ei({x:0,y:0})};if(E)return(0,i.jsx)(e6.M,{h:"100%",children:(0,i.jsxs)(nu.g,{children:[(0,i.jsx)(l.x,{children:"Failed to load lineage data. This could be because the server has been terminated or there is a network error."}),(0,i.jsxs)(l.x,{children:["[Reason: ",E,"]"]}),(0,i.jsx)(es.z,{colorScheme:"blue",onClick:()=>{S&&S()},children:"Retry"})]})});if("changed_models"===U&&!(null==_?void 0:null===(r=_.modifiedSet)||void 0===r?void 0:r.length))return(0,i.jsx)(e6.M,{h:"100%",children:(0,i.jsxs)(nu.g,{children:[(0,i.jsx)(i.Fragment,{children:"No change detected"}),(0,i.jsx)(es.z,{colorScheme:"blue",onClick:()=>{ec({...J,view_mode:"all"})},children:"Show all nodes"})]})});let ef=()=>{Q("single"),y(H(v)),P(),null==D||D()},eg={interactive:a,selectMode:Z,nodes:v,viewOptions:J,onViewOptionsChanged:ec,selectNodeMulti:e=>{if("multi"!==Z){if(!_)return;let[n,t]=F(Array.from(O(_,_.modifiedSet)),v,w);y(n=q(e,n=H(n,!0))),k(t),Q("multi"),eu.reset()}else{let n=N(e,v);n.find(e=>e.data.isSelected)||(Q("single"),n=H(n)),y(n)}},deselect:ef,runRowCountDiff:async()=>{"multi"===Z?(await eu.runRowCountDiff(),ew({type:"row_count_diff",selected:"multi"})):X?(await W("row_count_diff",{node_names:[X.name]},{showForm:!1,showLast:!1}),ew({type:"row_count_diff",selected:"single"})):(await W("row_count_diff",{select:J.select,exclude:J.exclude,packages:J.packages,view_mode:J.view_mode}),ew({type:"row_count_diff",selected:"none"}))},runValueDiff:async()=>{if(X)await W("value_diff",{model:X.name},{showForm:!0,showLast:!1}),ew({type:"value_diff",selected:"single"});else{let e="multi"===Z?Y.length:$.length;await eh.confirm(e)&&(await eu.runValueDiff(),ew({type:"value_diff",selected:"multi"===Z?"multi":"none"}))}},addLineageDiffCheck:async()=>{let e;"multi"===Z?(e=await eu.addLineageDiffCheck(),ef(),ew({type:"lineage_diff",selected:"multi"})):X||(e=await i1(J),ew({type:"lineage_diff",selected:"none"})),e&&ea(e)},addSchemaDiffCheck:async()=>{let e;"multi"===Z?Y.length>0&&(e=await eu.addSchemaDiffCheck(),ef(),ew({type:"schema_diff",selected:"multi"})):X?(e=await is({node_id:X.id}),ew({type:"schema_diff",selected:"single"})):(e=await is({select:J.select,exclude:J.exclude,packages:J.packages,view_mode:J.view_mode}),ew({type:"schema_diff",selected:"none"})),e&&ea(e)},cancel:eu.cancel,actionState:eu.actionState};return(0,i.jsxs)(t3.Provider,{value:eg,children:[(0,i.jsxs)(ty,{sizes:X?[70,30]:[100,0],minSize:X?400:0,gutterSize:X?5:0,style:{height:"100%",width:"100%"},children:[(0,i.jsxs)(nu.g,{ref:h,divider:(0,i.jsx)(tZ.c,{borderColor:"gray.200"}),spacing:0,style:{contain:"strict"},position:"relative",children:[a&&(0,i.jsx)(i0,{}),(0,i.jsxs)(R.x$,{nodeTypes:i8,edgeTypes:i7,nodes:v,edges:w,onNodesChange:b,onEdgesChange:C,onNodeClick:(e,n)=>{if(!1!==a&&_){if(ep(),"single"===Z){X||eo(n);let[e,t]=F(Array.from(T(I(_,[n.id]),O(_,[n.id]))),v,w);y(q(n.id,e)),k(t)}else if("action_result"===Z){var t,i,l,r;(null===(i=n.data.action)||void 0===i?void 0:null===(t=i.run)||void 0===t?void 0:t.run_id)&&L(null===(r=n.data.action)||void 0===r?void 0:null===(l=r.run)||void 0===l?void 0:l.run_id),eo(n),y(q(n.id,v))}else{let e=N(n.id,v);e.find(e=>e.data.isSelected)||(Q("single"),e=H(e)),y(e)}}},onNodeMouseEnter:(e,n)=>{if(!_||X||"single"!==Z)return;let[t,i]=F(Array.from(T(I(_,[n.id]),O(_,[n.id]))),v,w);y(t),k(i)},onNodeMouseLeave:(e,n)=>{if(!_||X)return;let[t,i]=F(Array.from(O(_,_.modifiedSet)),v,w);y(t),k(i)},onNodeContextMenu:(e,n)=>{if(!a||"action_result"===Z)return;e.preventDefault();let t=g.current.getBoundingClientRect(),i=g.current.offsetTop;ei({x:e.clientX-t.left,y:e.clientY-t.top+i,selectedNode:n}),en(!0)},onClick:ep,maxZoom:1,minZoom:.1,fitView:!0,nodesDraggable:a,ref:g,children:[(0,i.jsx)(tQ.A,{color:"#ccc"}),(0,i.jsx)(tX.Z,{showInteractive:!1,position:"top-right",className:iv,children:(0,i.jsx)(tX.B,{title:"copy image",onClick:async()=>{p()},children:(0,i.jsx)(s.J,{as:t0.C3L})})}),(0,i.jsx)(f,{}),(0,i.jsx)(R.s_,{position:"bottom-left",children:(0,i.jsx)(u.U,{children:(0,i.jsx)(i5,{})})}),(0,i.jsx)(R.s_,{position:"top-left",children:(0,i.jsx)(el.x,{fontSize:"xl",color:"grey",opacity:.5,children:v.length>0?"":"No nodes"})}),(0,i.jsx)(tG.a,{nodeColor:le,nodeStrokeWidth:3,zoomable:!0,pannable:!0}),"action_result"===Z&&(0,i.jsx)(R.s_,{position:"bottom-center",className:iv,children:(0,i.jsx)(iP,{onClose:()=>{ef()}})})]}),ee&&(0,i.jsx)(nM.v,{isOpen:!0,onClose:ep,children:(0,i.jsxs)(nq.q,{fontSize:"11pt",position:"absolute",width:"250px",style:{left:"".concat(et.x,"px"),top:"".concat(et.y,"px")},children:[(0,i.jsx)(nV.s,{icon:(0,i.jsx)(ie.Cv2,{}),onClick:()=>{ex(1)},children:"Select parent nodes"}),(0,i.jsx)(nV.s,{icon:(0,i.jsx)(ie.IMj,{}),onClick:()=>{em(1)},children:"Select child nodes"}),(0,i.jsx)(n9.R,{}),(0,i.jsx)(nV.s,{icon:(0,i.jsx)(ie.Cv2,{}),onClick:()=>{ex()},children:"Select all upstream nodes"}),(0,i.jsx)(nV.s,{icon:(0,i.jsx)(ie.IMj,{}),onClick:()=>{em()},children:"Select all downstream nodes"})]})})]}),"single"===Z&&X?(0,i.jsx)(l.x,{borderLeft:"solid 1px lightgray",height:"100%",children:(0,i.jsx)(iH,{node:X,onCloseNode:()=>{if(!_)return;let[e,n]=F(Array.from(O(_,_.modifiedSet)),v,w);y(H(e)),k(n)}})}):(0,i.jsx)(l.x,{})]}),eh.AlertDialog]})}),ll=(0,j.forwardRef)(function(e,n){let{check:t}=e,l={...t.params,...t.view_options};return(0,i.jsx)(o.k,{direction:"column",height:"100%",children:(0,i.jsx)(R.tV,{children:(0,i.jsx)(li,{viewOptions:l,interactive:!1,ref:n})})})});function lr(e){let{name:n,description:t,type:l,params:r,viewOptions:s}=e,o={name:n,description:t,type:l,params:r};s&&(o.view_options=s);let a=id.ZP.stringify({checks:[o]});return(0,i.jsx)(tV.ML,{height:"300px",language:"yaml",theme:"vs",value:a,options:{readOnly:!0,fontSize:14,lineNumbers:"off",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"same",scrollBeyondLastLine:!1}})}function ls(){let e=(0,G.p)();return{markedAsApprovedToast:function(){e({title:"Marked as approved",position:"bottom-right",status:"success",containerStyle:{fontSize:"sm"},duration:2e3})}}}function lo(){let e=(0,n6._)(["\n
","\n\n ","\n\n
"]);return lo=function(){return e},e}let la=e=>{var n,t,r,a,c,f,g;let{checkId:v}=e,w=(0,b.NL)(),[,k]=(0,eI.TH)(),{successToast:C,failToast:_}=tA(),{markedAsApprovedToast:S}=ls(),[z,R]=(0,j.useState)(),[E,T]=(0,j.useState)(),[D,L]=(0,j.useState)(!1),{isOpen:I,onOpen:O,onClose:M}=(0,Y.q)(),A=()=>(0,i.jsx)(ee.Z,{bg:"blackAlpha.300",backdropFilter:"blur(10px) "}),[F,q]=(0,j.useState)((0,i.jsx)(A,{})),{isLoading:N,error:V,data:H}=(0,y.a)({queryKey:P.check(v),queryFn:async()=>n1(v),refetchOnMount:!0}),W=z||(null==H?void 0:null===(n=H.last_run)||void 0===n?void 0:n.run_id),{run:K,error:J}=ia(W),B=z?!K||"running"===K.status:(null==K?void 0:K.status)==="running",U=(null==H?void 0:H.type)?nB(null==H?void 0:H.type):void 0,Z=(null==H?void 0:H.is_preset)||!1,Q=(0,j.useRef)(null),{mutate:X}=(0,tu.D)({mutationFn:e=>n5(v,e),onSuccess:()=>{w.invalidateQueries({queryKey:P.check(v)}),w.invalidateQueries({queryKey:P.checks()})}}),{mutate:G}=(0,tu.D)({mutationFn:()=>n2(v),onSuccess:()=>{w.invalidateQueries({queryKey:P.checks()}),k("/checks")}}),er=(0,j.useCallback)(async()=>{(null==H?void 0:H.type)&&R((await eh(v,{nowait:!0})).run_id)},[H,v,R]),eo=(0,j.useCallback)(async()=>{if(L(!0),W)return await eu(W)},[W]),ea=async()=>{var e;if(!H)return;let n=(e=H,(0,tM.RI)(lo(),"".concat(e.is_checked?"✅ ":"").concat(e.name),function(e){if("query"===e.type||"query_diff"===e.type){var n;return"".concat(tq(e),"\n\n").concat((0,tM.Pn)(tF(),null===(n=e.params)||void 0===n?void 0:n.sql_template))}return tq(e)}(e)));if(!navigator.clipboard){_("Failed to copy the check to clipboard",Error("Copy to clipboard is available only in secure contexts (HTTPS)"));return}try{await navigator.clipboard.writeText(n),C("Copied the check to the clipboard")}catch(e){_("Failed to copy the check to clipboard",e)}},ed=(0,j.useCallback)(()=>{let e=null==H?void 0:H.is_checked;X({is_checked:!e}),!0==!e&&S()},[null==H?void 0:H.is_checked,X,S]),[ec,ex]=(0,j.useState)(0),{ref:em,onCopyToClipboard:ep,onMouseEnter:ef,onMouseLeave:eg}=iy();if(N)return(0,i.jsx)(e6.M,{h:"100%",children:"Loading"});if(V)return(0,i.jsxs)(e6.M,{h:"100%",children:["Error: ",V.message]});let ev=(null==K?void 0:K.run_at)?(0,tB.Q)(new Date(K.run_at),{addSuffix:!0}):null;return(0,i.jsxs)(tb,{minSize:100,sizes:[30,70],style:{height:"100%",width:"100%",maxHeight:"100%"},children:[(0,i.jsxs)(l.x,{style:{contain:"strict"},display:"flex",flexDirection:"column",children:[(0,i.jsxs)(o.k,{p:"0px 16px",alignItems:"center",h:"40px",children:[(0,i.jsx)(tc,{name:(null==H?void 0:H.name)||"",setName:e=>{X({name:e})}}),(0,i.jsx)(h.L,{}),Z&&(0,i.jsx)(nk.u,{label:"Preset Check defined in recce config",children:(0,i.jsxs)(n3.Vp,{size:"sm",flex:"0 0 auto",children:[(0,i.jsx)(n3.AD,{boxSize:"14px",as:tr.bX4}),"Preset"]})}),(0,i.jsxs)(nM.v,{children:[(0,i.jsx)(nA.j,{isRound:!0,as:nF.h,icon:(0,i.jsx)(s.J,{as:e7.D_A}),variant:"ghost",size:"sm"}),(0,i.jsxs)(nq.q,{children:[(0,i.jsx)(nV.s,{as:el.x,fontSize:"10pt",icon:(0,i.jsx)(ts.ovA,{}),onClick:()=>{q((0,i.jsx)(A,{})),O()},children:"Get Preset Check Template"}),(0,i.jsx)(nV.s,{as:el.x,fontSize:"10pt",icon:(0,i.jsx)(tn.T,{}),onClick:()=>ea(),children:"Copy Markdown"}),(0,i.jsx)(n9.R,{}),(0,i.jsx)(nV.s,{as:el.x,fontSize:"10pt",icon:(0,i.jsx)(tt.p,{}),color:"red",onClick:()=>G(),children:"Delete"})]})]}),ev&&(0,i.jsx)(l.x,{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",fontSize:"10pt",children:ev}),(null==U?void 0:U.RunResultView)&&(0,i.jsx)(nk.u,{label:"Rerun",children:(0,i.jsx)(nF.h,{isRound:!0,isLoading:B,variant:"ghost","aria-label":"Rerun",icon:(0,i.jsx)(ti.n,{}),onClick:()=>er()})}),(0,i.jsx)(nk.u,{label:(null==H?void 0:H.is_checked)?"Mark as Pending":"Mark as Approved",placement:"bottom-end",children:(0,i.jsx)(es.z,{flex:"0 0 auto",size:"sm",colorScheme:(null==H?void 0:H.is_checked)?"green":"gray",variant:(null==H?void 0:H.is_checked)?"solid":"outline",leftIcon:(null==H?void 0:H.is_checked)?(0,i.jsx)(tl.r,{}):(0,i.jsx)(s.J,{as:e7.Rbx,color:"lightgray"}),onClick:()=>ed(),children:(null==H?void 0:H.is_checked)?"Approved":"Mark as Approved"})})]}),(0,i.jsx)(l.x,{flex:"1",p:"8px 16px",minHeight:"100px",children:(0,i.jsx)(tO,{value:null==H?void 0:H.description,onChange:e=>{X({description:e})}},null==H?void 0:H.check_id)})]}),(0,i.jsx)(l.x,{style:{contain:"strict"},children:(0,i.jsxs)(x.m,{height:"100%",display:"flex",flexDirection:"column",tabIndex:ec,onChange:ex,children:[(0,i.jsxs)(m.t,{height:"50px",children:[(0,i.jsx)(p.O,{fontSize:"10pt",children:"Result"}),((null==H?void 0:H.type)==="query"||(null==H?void 0:H.type)==="query_diff")&&(0,i.jsx)(p.O,{fontSize:"10pt",children:"Query"}),(0,i.jsx)(h.L,{}),(0,i.jsx)(u.U,{mr:"10px",children:(0,i.jsx)(es.z,{leftIcon:(0,i.jsx)(tn.T,{}),variant:"outline",isDisabled:"schema_diff"!==(g=null!==(f=null==H?void 0:H.type)&&void 0!==f?f:"")&&"lineage_diff"!==g&&(!(null==K?void 0:K.result)||!!(null==K?void 0:K.error))||0!==ec,onMouseEnter:ef,onMouseLeave:eg,size:"sm",onClick:()=>{if((null==H?void 0:H.type)==="lineage_diff"){var e;null===(e=Q.current)||void 0===e||e.copyToClipboard()}else ep()},children:"Copy to Clipboard"})})]}),(0,i.jsxs)(n8.n,{height:"100%",flex:"1",style:{contain:"strict"},children:[(0,i.jsxs)(n7.x,{p:0,width:"100%",height:"100%",children:[(null==U?void 0:U.RunResultView)&&((null==H?void 0:H.last_run)||W?(0,i.jsx)(tJ,{ref:em,isRunning:B,isAborting:D,run:W?K:null==H?void 0:H.last_run,error:J,progress:E,RunResultView:U.RunResultView,viewOptions:null==H?void 0:H.view_options,onViewOptionsChanged:e=>{X({view_options:e})},onCancel:eo,onExecuteRun:er}):(0,i.jsx)(e6.M,{bg:"rgb(249,249,249)",height:"100%",children:(0,i.jsx)(es.z,{onClick:er,colorScheme:"blue",size:"sm",children:"Run Query"})})),H&&"schema_diff"===H.type&&(0,i.jsx)(tL,{check:H,ref:em}),H&&"lineage_diff"===H.type&&(0,i.jsx)(ll,{check:H,ref:Q})]}),((null==H?void 0:H.type)==="query"||(null==H?void 0:H.type)==="query_diff"||(null==H?void 0:H.type)==="query_base")&&(0,i.jsx)(n7.x,{p:0,height:"100%",width:"100%",children:(null===(t=H.params)||void 0===t?void 0:t.base_sql_template)?(0,i.jsx)(tP,{value:(null==H?void 0:null===(r=H.params)||void 0===r?void 0:r.sql_template)||"",baseValue:(null==H?void 0:null===(a=H.params)||void 0===a?void 0:a.base_sql_template)||"",options:{readOnly:!0}}):(0,i.jsx)(tH,{value:(null==H?void 0:null===(c=H.params)||void 0===c?void 0:c.sql_template)||"",options:{readOnly:!0}})})]})]})}),(0,i.jsxs)($.u_,{isOpen:I,onClose:M,isCentered:!0,size:"6xl",children:[F,(0,i.jsxs)(en.h,{overflowY:"auto",height:"40%",width:"60%",children:[(0,i.jsx)(et.x,{children:"Preset Check Template"}),(0,i.jsx)(eD.o,{}),(0,i.jsxs)(ei.f,{children:[(0,i.jsx)(d.X,{size:"sm",fontWeight:"bold",children:(0,i.jsx)(te.y,{query:"recce.yml",styles:{px:"1",py:"0",bg:"red.100"},children:"Please copy the following template and paste it into the recce.yml file."})}),(0,i.jsx)("br",{}),(0,i.jsx)(lr,{name:(null==H?void 0:H.name)||"",description:(null==H?void 0:H.description)||"",type:(null==H?void 0:H.type)||"",params:null==H?void 0:H.params,viewOptions:null==H?void 0:H.view_options})]})]})]})]})};var ld=t(34872);let lc=e=>{var n;let{check:t,selected:r,onSelect:a,onMarkAsApproved:d}=e,c=(0,b.NL)(),u=t.check_id,{mutate:h}=(0,tu.D)({mutationFn:e=>n5(u,e),onSuccess:()=>{c.invalidateQueries({queryKey:P.check(u)}),c.invalidateQueries({queryKey:P.checks()})}}),x=(null===(n=nB(t.type))||void 0===n?void 0:n.icon)||eO.WzH;return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(o.k,{width:"100%",p:"10px 20px",cursor:"pointer",_hover:{bg:"Cornsilk"},bg:r?"Floralwhite":"inherit",borderBlockEndWidth:"1px",borderLeftWidth:"3px",borderLeftColor:r?"orange":"transparent",onClick:()=>a(t.check_id),alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.J,{as:x}),(0,i.jsx)(l.x,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:t.name}),(0,i.jsx)(nk.u,{label:"Click to mark as approved",placement:"top",hasArrow:!0,children:(0,i.jsx)(o.k,{children:(0,i.jsx)(nh.X,{isChecked:t.is_checked,variant:"circular",colorScheme:"green",size:"xs",onChange:e=>{let n=e.target.checked;!1===n?h({is_checked:n}):d()}})})})]})})},lu=e=>{let{checks:n,selectedItem:t,onCheckSelected:r,onChecksReordered:s}=e,[a,d]=(0,j.useState)(!1),c=(0,b.NL)(),{mutate:u}=(0,tu.D)({mutationFn:e=>n5(e,{is_checked:!0}),onSuccess:(e,n)=>{c.invalidateQueries({queryKey:P.check(n)}),c.invalidateQueries({queryKey:P.checks()})}}),{isOpen:h,onOpen:x,onClose:m}=(0,Y.q)(),{markedAsApprovedToast:p}=ls(),f=()=>{"true"===localStorage.getItem("bypassMarkAsApprovedWarning")?(u(t),p()):x()};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(ld.Z5,{onDragEnd:e=>{e.destination&&s(e.source.index,e.destination.index)},children:(0,i.jsx)(ld.bK,{droppableId:"checklist",children:e=>(0,i.jsxs)(nu.g,{...e.droppableProps,ref:e.innerRef,w:"full",spacing:"0",flex:"1",overflow:"auto",children:[n.map((e,n)=>(0,i.jsx)(ld._l,{draggableId:e.check_id,index:n,children:(n,l)=>{if(l.isDragging){let e=n.draggableProps,t={x:0,y:80},i=e.style.left-t.x,l=e.style.top-t.y;e.style.left=i,e.style.top=l}return(0,i.jsx)(o.k,{ref:n.innerRef,...n.draggableProps,...n.dragHandleProps,w:"full",children:(0,i.jsx)(lc,{check:e,selected:e.check_id===t,onSelect:r,onMarkAsApproved:f},e.check_id)})}},e.check_id)),e.placeholder]})})}),(0,i.jsxs)($.u_,{isOpen:h,onClose:m,isCentered:!0,children:[(0,i.jsx)(ee.Z,{}),(0,i.jsxs)(en.h,{width:"400px",children:[(0,i.jsx)(et.x,{children:"Mark as Approved?"}),(0,i.jsx)(eD.o,{}),(0,i.jsx)(nC.i,{}),(0,i.jsxs)(l.x,{p:"16px",fontSize:"sm",gap:"16px",children:[(0,i.jsx)("p",{children:"Please ensure you have reviewed the contents of this check before marking it as approved."}),(0,i.jsx)(nh.X,{isChecked:a,onChange:e=>d(e.target.checked),fontWeight:"bold",size:"sm",pt:"8px",children:"Don't show this again"})]}),(0,i.jsx)(nC.i,{}),(0,i.jsxs)(er.m,{children:[(0,i.jsx)(es.z,{variant:"outline",size:"xs",mr:2,onClick:m,children:"Cancel"}),(0,i.jsx)(es.z,{colorScheme:"blue",size:"xs",onClick:()=>{u(t),!0===a&&localStorage.setItem("bypassMarkAsApprovedWarning","true"),p(),m()},children:"Mark as approved"})]})]})]})]})};async function lh(e){return(await U.post("/api/save-as",e)).data}async function lx(e){return(await U.post("/api/rename",e)).data}async function lm(){return(await U.post("/api/export")).data}async function lp(e,n){let t=new FormData;return t.append("file",e),t.append("checks_only",(!!n).toString()),(await U.post("/api/import",t)).data}async function lf(){return 208===(await U.get("/api/sync")).status}async function lg(e){try{let n=await U.post("/api/sync",e);if(202===n.status)return{status:"accepted"};if(208===n.status)return{status:"syncing"}}catch(e){if((0,i2.IZ)(e)&&e.response&&409===e.response.status)return{status:"conflict"}}throw Error("Failed to sync state")}let lv=e=>(0,i.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,i.jsx)("g",{"clip-path":"url(#clip0_1479_25070)",children:(0,i.jsx)("path",{d:"M15.625 0.25H14.759C14.5484 0.25 14.3791 0.423375 14.3841 0.633937L14.4575 3.71441C13.0691 1.62634 10.6955 0.25 8 0.25C4.21291 0.25 1.06041 2.96638 0.38425 6.557C0.340875 6.78728 0.518875 7 0.753219 7H1.64622C1.82353 7 1.97566 6.87556 2.013 6.70222C2.60753 3.9415 5.05991 1.875 8 1.875C10.4858 1.875 12.6232 3.35256 13.5836 5.47819L9.63394 5.38416C9.42341 5.37916 9.25 5.54844 9.25 5.75906V6.625C9.25 6.83209 9.41791 7 9.625 7H15.625C15.8321 7 16 6.83209 16 6.625V0.625C16 0.417906 15.8321 0.25 15.625 0.25ZM15.2468 9H14.3538C14.1765 9 14.0243 9.12444 13.987 9.29778C13.3925 12.0585 10.9401 14.125 8 14.125C5.51419 14.125 3.37681 12.6474 2.41637 10.5218L6.36606 10.6158C6.57659 10.6208 6.75 10.4516 6.75 10.2409V9.375C6.75 9.16791 6.58209 9 6.375 9H0.375C0.167906 9 0 9.16791 0 9.375V15.375C0 15.5821 0.167906 15.75 0.375 15.75H1.24097C1.45156 15.75 1.62088 15.5766 1.61588 15.3661L1.54253 12.2856C2.93087 14.3737 5.3045 15.75 8 15.75C11.7871 15.75 14.9396 13.0336 15.6158 9.443C15.6591 9.21272 15.4811 9 15.2468 9Z",fill:"currentColor"})}),(0,i.jsx)("defs",{children:(0,i.jsx)("clipPath",{id:"clip0_1479_25070",children:(0,i.jsx)("rect",{width:"16",height:"16",fill:"white"})})})]}),lj=e=>(0,i.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,i.jsx)("g",{"clip-path":"url(#clip0_1479_25102)",children:(0,i.jsx)("path",{d:"M-1.88399 8.72062L0.358816 6.46094C0.594752 6.22344 1.00006 6.39031 1.00006 6.725V8.2525H4.00005V4.12438C4.00005 3.7275 4.16161 3.34313 4.44286 3.06219L7.06441 0.440625C7.34566 0.159375 7.72691 0 8.12347 0H14.5003C15.3281 0.003125 16 0.675 16 1.50281V14.5003C16 15.3281 15.3281 16 14.5003 16H5.50223C4.67411 16 4.00005 15.3281 4.00005 14.5003V11.2522H5.50005V14.5003H14.5003V1.50281H9.50128V4.75219C9.50128 5.16781 9.1669 5.50187 8.75128 5.50187H5.50005V8.25219H10.625C10.8322 8.25219 11 8.42 11 8.62719V9.37719C11 9.58438 10.8322 9.75219 10.625 9.75219H1.00006V11.2797C1.00006 11.6144 0.594752 11.7813 0.358816 11.5438L-1.88399 9.28406C-2.03867 9.12813 -2.03867 8.87656 -1.88399 8.72062ZM8.0016 4.00219V1.62469L5.62379 4.00219H8.0016Z",fill:"currentColor"})}),(0,i.jsx)("g",{"clip-path":"url(#clip1_1479_25102)",children:(0,i.jsx)("path",{d:"M0.103056 8.72062L2.09667 6.46094C2.30639 6.22344 2.66667 6.39031 2.66667 6.725V8.2525H5.33333V4.12438C5.33333 3.7275 5.47694 3.34313 5.72694 3.06219L8.05722 0.440625C8.30722 0.159375 8.64611 0 8.99861 0H14.6669C15.4028 0.003125 16 0.675 16 1.50281V14.5003C16 15.3281 15.4028 16 14.6669 16H6.66861C5.9325 16 5.33333 15.3281 5.33333 14.5003V11.2522H6.66667V14.5003H14.6669V1.50281H10.2233V4.75219C10.2233 5.16781 9.92611 5.50187 9.55667 5.50187H6.66667V8.25219H11.2222C11.4064 8.25219 11.5556 8.42 11.5556 8.62719V9.37719C11.5556 9.58438 11.4064 9.75219 11.2222 9.75219H2.66667V11.2797C2.66667 11.6144 2.30639 11.7813 2.09667 11.5438L0.103056 9.28406C-0.0344448 9.12813 -0.0344448 8.87656 0.103056 8.72062ZM8.89028 4.00219V1.62469L6.77666 4.00219H8.89028Z",fill:"currentColor"})}),(0,i.jsxs)("defs",{children:[(0,i.jsx)("clipPath",{id:"clip0_1479_25102",children:(0,i.jsx)("rect",{width:"13",height:"16",fill:"white",transform:"matrix(-1 0 0 1 16 0)"})}),(0,i.jsx)("clipPath",{id:"clip1_1479_25102",children:(0,i.jsx)("rect",{width:"3",height:"16",fill:"white"})})]})]}),ly=e=>(0,i.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,i.jsx)("g",{"clip-path":"url(#clip0_1426_8619)",children:(0,i.jsx)("path",{d:"M15.5572 3.06188L12.9356 0.440625C12.6544 0.159375 12.2731 0 11.8766 0H5.49969C4.67188 0.003125 4 0.675 4 1.50281V8.25219H0.375C0.167812 8.25219 0 8.42 0 8.62719V9.37719C0 9.58438 0.167812 9.75219 0.375 9.75219H9V11.2797C9 11.6144 9.40531 11.7812 9.64125 11.5437L11.8841 9.28406C12.0388 9.12813 12.0388 8.87656 11.8841 8.72062L9.64125 6.46094C9.40531 6.22344 9 6.39031 9 6.725V8.2525H5.49969V1.50281H10.4987V4.75219C10.4987 5.16781 10.8331 5.50187 11.2487 5.50187H14.5V14.5003H5.49969V11.2522H4V14.5003C4 15.3281 4.67188 16 5.49969 16H14.4978C15.3259 16 16 15.3281 16 14.5003V4.12406C16 3.7275 15.8384 3.34313 15.5572 3.06188ZM11.9984 4.00219V1.62469L14.3763 4.00219H11.9984Z",fill:"black"})}),(0,i.jsx)("defs",{children:(0,i.jsx)("clipPath",{id:"clip0_1426_8619",children:(0,i.jsx)("rect",{width:"16",height:"16",fill:"white"})})})]}),lb=e=>(0,i.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,i.jsx)("path",{d:"M14.5607 4.06066L11.9393 1.43934C11.658 1.15804 11.2765 1 10.8787 1H2.5C1.67156 1 1 1.67156 1 2.5V13.5C1 14.3284 1.67156 15 2.5 15H13.5C14.3284 15 15 14.3284 15 13.5V5.12131C15 4.72349 14.842 4.34196 14.5607 4.06066ZM9.5 2.5V5H5.5V2.5H9.5ZM13.3125 13.5H2.6875C2.63777 13.5 2.59008 13.4802 2.55492 13.4451C2.51975 13.4099 2.5 13.3622 2.5 13.3125V2.6875C2.5 2.63777 2.51975 2.59008 2.55492 2.55492C2.59008 2.51975 2.63777 2.5 2.6875 2.5H4V5.75C4 6.16422 4.33578 6.5 4.75 6.5H10.25C10.6642 6.5 11 6.16422 11 5.75V2.62131L13.4451 5.06641C13.4625 5.08382 13.4763 5.10449 13.4857 5.12724C13.4952 5.14999 13.5 5.17438 13.5 5.199V13.3125C13.5 13.3622 13.4802 13.4099 13.4451 13.4451C13.4099 13.4802 13.3622 13.5 13.3125 13.5ZM8 7.25C6.48366 7.25 5.25 8.48366 5.25 10C5.25 11.5163 6.48366 12.75 8 12.75C9.51634 12.75 10.75 11.5163 10.75 10C10.75 8.48366 9.51634 7.25 8 7.25ZM8 11.25C7.31075 11.25 6.75 10.6892 6.75 10C6.75 9.31075 7.31075 8.75 8 8.75C8.68925 8.75 9.25 9.31075 9.25 10C9.25 10.6892 8.68925 11.25 8 11.25Z",fill:"currentColor"})}),lw=e=>(0,i.jsx)("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,i.jsx)("path",{d:"M15.9143 1.75812L14.7422 0.585938C14.3515 0.195312 13.8397 0 13.3278 0C12.8159 0 12.304 0.195312 11.9137 0.585625L9.58593 2.91344L8.5 3.99938L0.901592 11.5975L0.504719 15.1669C0.454719 15.6163 0.80878 16 1.24847 16C1.27628 16 1.3044 15.9984 1.33253 15.9953L4.89939 15.6012L12.5006 8L13.5862 6.91437L15.914 4.58656C16.6953 3.80531 16.6953 2.53906 15.9143 1.75812ZM4.21095 14.1684L2.09909 14.4016L2.3344 12.2863L9.56062 5.06L10.53 4.09062L12.4094 5.97L11.44 6.93937L4.21095 14.1684ZM14.8534 3.52562L13.4697 4.90938L11.5906 3.03L12.9744 1.64625C13.1019 1.51875 13.2506 1.49969 13.3278 1.49969C13.405 1.49969 13.554 1.51875 13.6812 1.64625L14.8534 2.81844C15.0484 3.01375 15.0484 3.33094 14.8534 3.52562Z",fill:"currentColor"})}),lk=e=>(0,i.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,i.jsx)("path",{d:"M7.26326 6.5462H8.71794V12.3642H7.26326V6.5462ZM7.9906 3.1102C7.43278 3.1102 6.97888 3.5641 6.97888 4.12192C6.97888 4.67974 7.43278 5.13364 7.9906 5.13364C8.54842 5.13364 9.00232 4.67974 9.00232 4.12192C9.00232 3.5641 8.54842 3.1102 7.9906 3.1102ZM16 8C16 12.411 12.411 16 8 16C3.589 16 0 12.411 0 8C0 3.589 3.589 0 8 0C12.411 0 16 3.589 16 8ZM14.5453 8C14.5453 4.3906 11.6093 1.4546 7.99992 1.4546C4.39052 1.4546 1.45452 4.3914 1.45452 8.0006C1.45452 11.6098 4.39052 14.546 7.99992 14.546C11.6093 14.546 14.5453 11.6092 14.5453 8.0006V8Z",fill:"currentColor"})});function lC(e){let{checksOnly:n=!0}=e,t=(0,G.p)(),l=(0,b.NL)(),r=(0,j.useRef)(null),a=(0,j.useRef)(null),[d,c]=(0,j.useState)(null),{isOpen:u,onOpen:h,onClose:x}=(0,Y.q)(),[m,p]=(0,eI.TH)(),[,f]=eT(),g=(0,j.useCallback)(async()=>{if(d){try{let{runs:e,checks:i}=await lp(d,n);f(),await l.invalidateQueries({queryKey:P.checks()}),await l.invalidateQueries({queryKey:P.runs()}),m.includes("/checks")&&p("/checks");let r=n?"".concat(i," checks imported successfully"):"".concat(e," runs and ").concat(i," checks imported successfully");t({description:r,status:"info",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}catch(e){console.error("Import failed",e),t({title:"Import failed",description:"".concat(e),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}x()}},[l,d,t,x,m,p,f,n]),v=n?"checks":"runs and checks",{isDemoSite:y}=eE();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nk.u,{label:"Import Checklist from State File"+(y?" (Disabled in the demo site)":""),children:(0,i.jsx)(nF.h,{pt:"6px",variant:"unstyled","aria-label":"Import state",onClick:()=>{r.current&&r.current.click()},icon:(0,i.jsx)(s.J,{as:ly}),isDisabled:y})}),(0,i.jsx)("input",{type:"file",style:{display:"none"},ref:r,onChange:e=>{var n;(null===(n=e.target.files)||void 0===n?void 0:n.length)===1&&(c(e.target.files[0]),h()),r.current&&(r.current.value="")}}),(0,i.jsx)(i3.aR,{isOpen:u,leastDestructiveRef:a,onClose:x,size:"xl",children:(0,i.jsx)(ee.Z,{children:(0,i.jsxs)(i3._T,{children:[(0,i.jsx)(et.x,{fontSize:"lg",fontWeight:"bold",children:"Import state"}),(0,i.jsx)(ei.f,{children:(0,i.jsxs)(o.k,{px:"5px",gap:"5px",rounded:"md",direction:"column",children:[(0,i.jsxs)(o.k,{alignItems:"center",gap:"5px",children:[(0,i.jsx)(tY.s,{color:"red.600"}),(0,i.jsx)(el.x,{as:"span",fontWeight:"500",color:"red.600",children:"Caution!"})]}),(0,i.jsx)(o.k,{children:(0,i.jsxs)(el.x,{children:["The current ",v," will be"," ",(0,i.jsx)(el.x,{as:"span",fontWeight:"600",children:"merged"})," ","with the imported state"]})})]})}),(0,i.jsxs)(er.m,{children:[(0,i.jsx)(es.z,{ref:a,onClick:x,children:"Cancel"}),(0,i.jsx)(es.z,{colorScheme:"blue",onClick:g,ml:"5px",children:"Import"})]})]})})})]})}let l_=()=>{let[,e]=(0,eI.TH)(),[,n]=(0,eI.yj)("/checks/:checkId"),t=(0,b.NL)(),{successToast:r,failToast:s}=tA(),a=null==n?void 0:n.checkId,{isLoading:d,error:c,data:u,status:h}=(0,y.a)({queryKey:P.checks(),queryFn:n0,refetchOnMount:!0}),x=(0,j.useCallback)(n=>{e("/checks/".concat(n))},[e]),[m,p]=(0,j.useState)(u||[]),{mutate:f}=(0,tu.D)({mutationFn:e=>n4(e),onSuccess:()=>{t.invalidateQueries({queryKey:P.checks()})}}),g=(0,j.useCallback)((e,n)=>{let t=[...m],[i]=t.splice(e,1);t.splice(n,0,i),f({source:e,destination:n}),p(t)},[m,p,f]);return((0,j.useCallback)(async()=>{let e=await nY();t.invalidateQueries({queryKey:P.checks()}),x(e.check_id)},[t,x]),(0,j.useEffect)(()=>{"success"===h&&(!a&&u.length>0&&e("/checks/".concat(u[0].check_id)),p(u))},[h,a,u,p,e]),d)?(0,i.jsx)(i.Fragment,{}):c?(0,i.jsxs)(i.Fragment,{children:["Error: ",c.message]}):(null==u?void 0:u.length)?(0,i.jsxs)(ty,{style:{height:"100%"},minSize:50,sizes:[20,80],children:[(0,i.jsx)(l.x,{borderRight:"lightgray solid 1px",height:"100%",style:{contain:"size"},children:(0,i.jsxs)(nu.g,{spacing:0,h:"100%",style:{contain:"strict"},alignItems:"stretch",children:[(0,i.jsx)(o.k,{justifyContent:"right",padding:"0px 10px",children:(0,i.jsx)(lC,{checksOnly:!0})}),(0,i.jsx)(nC.i,{}),(0,i.jsx)(lu,{checks:m,selectedItem:a,onCheckSelected:x,onChecksReordered:g})]})}),(0,i.jsx)(l.x,{height:"100%",children:(0,i.jsx)(eI.rs,{children:(0,i.jsx)(eI.AW,{path:"/checks/:checkId",children:e=>(0,i.jsx)(la,{checkId:e.checkId},e.checkId)})})})]}):(0,i.jsx)(e6.M,{h:"100%",children:(0,i.jsx)(l.x,{children:"No checks"})})};var lS=t(21297);let lz=()=>{let{isHistoryOpen:e,showHistory:n,closeHistory:t}=nX();return(0,i.jsxs)(l.x,{children:[(0,i.jsx)(l.x,{fontSize:"8pt",children:"History"}),(0,i.jsx)(es.z,{leftIcon:(0,i.jsx)(s.J,{as:e7.M1Q}),size:"xs",variant:"outline",onClick:()=>{e?(ek({name:"hide"}),t()):(ek({name:"show"}),n())},children:e?"Hide":"Show"})]})},lR=()=>{let{isCustomQueries:e,setCustomQueries:n,sqlQuery:t,setBaseSqlQuery:r}=_();return(0,i.jsxs)(l.x,{children:[(0,i.jsxs)(l.x,{fontSize:"8pt",children:["Custom Queries ","",(0,i.jsx)(nk.u,{label:"Custom queries allow you to use two SQL queries to compare results between current and base environments.",children:(0,i.jsx)(tY.s,{color:"gray.600",boxSize:"3"})})]}),(0,i.jsx)(lS.r,{size:"sm",isChecked:e,onChange:()=>{!1===e&&r&&r(t),n(!e)}})]})},lE=()=>{let{sqlQuery:e,baseSqlQuery:n,setSqlQuery:t,setBaseSqlQuery:r,primaryKeys:s,setPrimaryKeys:a,isCustomQueries:d}=_(),{envInfo:c}=eE(),u=e;(null==c?void 0:c.adapterType)==="sqlmesh"&&e===w&&(u="select * from db.mymodel");let{showRunId:x}=nX(),m=async e=>{let t="query_base"===e?n||"":u,i=function(e){switch(e){case"query":return i_;case"query_base":return iS;case"query_diff":return iz;default:throw Error("Unknown query type: ".concat(e))}}(e),l={sql_template:t};"query_diff"===e&&(l.primary_keys=s,d&&(l.base_sql_template=n));let{run_id:r}=await i(l,{nowait:!0});return x(r),await ec(r)},{mutate:p,isPending:f}=(0,tu.D)({mutationFn:m});return(0,i.jsxs)(o.k,{direction:"column",height:"100%",children:[(0,i.jsxs)(o.k,{justifyContent:"right",alignItems:"center",padding:"4pt 8pt",gap:"5px",height:"54px",borderBottom:"1px solid lightgray",flex:"0 0 54px",children:[(0,i.jsx)(lz,{}),(0,i.jsx)(lR,{}),(0,i.jsx)(h.L,{}),(0,i.jsx)(iL,{defaultPrimaryKeys:s,onPrimaryKeysChange:a}),(0,i.jsx)(es.z,{colorScheme:"blue",onClick:()=>p("query_diff"),isDisabled:f,size:"xs",fontSize:"14px",marginTop:"16px",children:"Run Diff"})]}),(0,i.jsx)(l.x,{width:"100%",flex:"1",children:d?(0,i.jsx)(tP,{value:u,baseValue:n,onChange:t,onChangeBase:r,onRun:()=>p("query"),onRunBase:()=>p("query_base"),onRunDiff:()=>p("query_diff")}):(0,i.jsx)(tH,{value:u,onChange:t,onRun:()=>p("query"),onRunDiff:()=>p("query_diff")})})]})};var lT=t(26143);let lD=e=>(0,lT.c4)("#!"+e),lL=()=>[(0,lT.LD)(()=>window.location.hash.replace(/^#!/,"")||"/",()=>"/ssr"),lD];var lI=t(35653),lO=t(38222);let lM=e=>{var n;let{runId:t}=e,{isPending:l,error:r,data:s}=(0,y.a)({queryKey:P.run(t),queryFn:async()=>ec(t)}),o=(null==s?void 0:s.type)?null===(n=nB(s.type))||void 0===n?void 0:n.RunResultView:void 0;return(0,i.jsx)(tJ,{isPending:l,error:r,run:s,RunResultView:o})},lA=e=>{let{error:n,resetError:t}=e;return(0,i.jsx)(e6.M,{height:"100%",backgroundColor:"gray.50",children:(0,i.jsxs)(o.k,{p:4,direction:"column",justifyContent:"flex-start",backgroundColor:"white",border:"solid lightgray 1px",minHeight:"200px",children:[(0,i.jsx)(d.X,{width:"800px",size:"md",children:"You have encountered an error"}),(0,i.jsx)(l.x,{flex:"1",fontSize:"10pt",children:n.toString()}),(0,i.jsx)(es.z,{justifySelf:"center",alignSelf:"center",mt:"20px",colorScheme:"blue",size:"sm",onClick:()=>{t()},children:"Reset"})]})})},lF=e=>{let{children:n}=e;return(0,i.jsx)(tK.SV,{fallback:lA,children:n})};function lq(){let e=(0,G.p)(),n=async()=>{try{let e=await lm(),n=JSON.stringify(e,null,2),t=new Blob([n],{type:"application/json"}),i=new Date,l="recce-state-".concat((0,im.WU)(i,"yyyy-MM-dd-HH-mm-ss"),".json");ig()(t,l)}catch(n){console.error("Export failed",n),e({title:"Export failed",description:"".concat(n),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}};return(0,i.jsx)(nk.u,{label:"Export",children:(0,i.jsx)(nF.h,{size:"sm",variant:"unstyled","aria-label":"Export state",onClick:n,icon:(0,i.jsx)(s.J,{as:lj,verticalAlign:"middle",boxSize:"16px"})})})}t(58923);var lN=t(71651),lV=t(87202),lH=t(9783),lP=t(34889),lW=t(33246),lK=t(67192),lJ=t(37854),lB=t(31617);function lU(e){let n=(0,lB.D)(e);return(0,im.WU)(n,"yyyy-MM-dd'T'HH:mm:ss")}function lZ(e){return Object.values(e).every(e=>null===e)?[(0,i.jsx)(o.k,{ml:"10px",children:"No information"},"no info")]:Object.entries(e).filter(e=>{let[n,t]=e;return"url"!==n&&null!=t}).map(e=>{let[n,t]=e;return(0,i.jsxs)(tw.HC,{ml:"10px",children:[n,": ",t]},n)})}function lQ(){var e,n,t,l,a,c;let{envInfo:u,reviewMode:h,lineageGraph:x}=eE(),{isOpen:m,onOpen:p,onClose:f}=(0,Y.q)(),g=null==u?void 0:u.git,v=null==u?void 0:u.pullRequest,j={...g,...v},y=null==u?void 0:null===(e=u.dbt)||void 0===e?void 0:e.base,b=null==u?void 0:null===(n=u.dbt)||void 0===n?void 0:n.current,w=(null==y?void 0:y.generated_at)?lU(null==y?void 0:y.generated_at):"",k=(null==b?void 0:b.generated_at)?lU(null==b?void 0:b.generated_at):"",C=new Set,_=new Set;if(null==x?void 0:x.nodes)for(let e of Object.values(null==x?void 0:x.nodes))(null===(a=e.data.base)||void 0===a?void 0:a.schema)&&C.add(e.data.base.schema),(null===(c=e.data.current)||void 0===c?void 0:c.schema)&&_.add(e.data.current.schema);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nk.u,{label:"Environment Info",placement:"bottom-end",children:(0,i.jsx)(nF.h,{size:"sm",variant:"unstyled","aria-label":"Export state",onClick:p,icon:(0,i.jsx)(s.J,{verticalAlign:"middle",as:lk,boxSize:"16px"})})}),(0,i.jsxs)($.u_,{isOpen:m,onClose:f,size:"3xl",children:[(0,i.jsx)(ee.Z,{}),(0,i.jsxs)(en.h,{children:[(0,i.jsx)(et.x,{children:"Environment Information"}),(0,i.jsx)(eD.o,{}),(0,i.jsx)(ei.f,{children:(0,i.jsxs)(o.k,{direction:"column",gap:"5px",children:[h?(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(o.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(d.X,{size:"sm",children:"Review Information"}),(0,i.jsxs)(tw.QI,{spacing:1,children:[(null==j?void 0:j.url)&&(0,i.jsxs)(tw.HC,{ml:"10px",children:["url:"," ",(0,i.jsx)(r.r,{href:j.url,color:"blue.500",isExternal:!0,children:j.url})]}),j&&lZ(j)]})]})}):(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(o.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(d.X,{size:"sm",children:"Dev Information"}),(0,i.jsx)(tw.QI,{spacing:1,children:g&&lZ(g)})]})}),(0,i.jsx)(nC.i,{}),(null==u?void 0:u.adapterType)==="dbt"&&(0,i.jsxs)(o.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(d.X,{size:"sm",children:"DBT"}),(0,i.jsx)(lN.x,{children:(0,i.jsxs)(lV.i,{variant:"simple",children:[(0,i.jsx)(lH.h,{children:(0,i.jsxs)(lP.Tr,{children:[(0,i.jsx)(lW.Th,{}),(0,i.jsx)(lW.Th,{children:"base"}),(0,i.jsx)(lW.Th,{children:"current"})]})}),(0,i.jsxs)(lK.p,{children:[(0,i.jsxs)(lP.Tr,{children:[(0,i.jsx)(lJ.Td,{children:"schema"}),(0,i.jsx)(lJ.Td,{children:JSON.stringify(Array.from(C))}),(0,i.jsx)(lJ.Td,{children:JSON.stringify(Array.from(_))})]}),(0,i.jsxs)(lP.Tr,{children:[(0,i.jsx)(lJ.Td,{children:"version"}),(0,i.jsx)(lJ.Td,{children:null==y?void 0:y.dbt_version}),(0,i.jsx)(lJ.Td,{children:null==b?void 0:b.dbt_version})]}),(0,i.jsxs)(lP.Tr,{children:[(0,i.jsx)(lJ.Td,{children:"timestamp"}),(0,i.jsx)(lJ.Td,{children:w}),(0,i.jsx)(lJ.Td,{children:k})]})]})]})})]}),(null==u?void 0:u.adapterType)==="sqlmesh"&&(0,i.jsxs)(o.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(d.X,{size:"sm",children:"SQLMesh"}),(0,i.jsx)(lN.x,{children:(0,i.jsxs)(lV.i,{variant:"simple",children:[(0,i.jsx)(lH.h,{children:(0,i.jsxs)(lP.Tr,{children:[(0,i.jsx)(lW.Th,{}),(0,i.jsx)(lW.Th,{children:"base"}),(0,i.jsx)(lW.Th,{children:"current"})]})}),(0,i.jsx)(lK.p,{children:(0,i.jsxs)(lP.Tr,{children:[(0,i.jsx)(lJ.Td,{children:"Environment"}),(0,i.jsx)(lJ.Td,{children:null==u?void 0:null===(t=u.sqlmesh)||void 0===t?void 0:t.base_env}),(0,i.jsx)(lJ.Td,{children:null==u?void 0:null===(l=u.sqlmesh)||void 0===l?void 0:l.current_env})]})})]})})]})]})}),(0,i.jsx)(er.m,{children:(0,i.jsx)(es.z,{colorScheme:"blue",mr:3,onClick:f,children:"Close"})})]})]})]})}function lX(){return(0,i.jsx)(R.tV,{children:(0,i.jsx)(li,{interactive:!0})})}var lG=t(97530);let lY=e=>{let{isGuideOpen:n,closeGuide:t}=e;return(0,i.jsxs)($.u_,{isOpen:n,onClose:t,scrollBehavior:"inside",children:[(0,i.jsx)(ee.Z,{}),(0,i.jsxs)(en.h,{maxW:"80vw",h:"80vh",children:[(0,i.jsx)(et.x,{children:"Welcome to Recce: 3 Steps to Begin"}),(0,i.jsx)(eD.o,{}),(0,i.jsx)(ei.f,{children:(0,i.jsxs)(tN.K,{spacing:4,children:[(0,i.jsxs)(tw.aV,{spacing:2,children:[(0,i.jsx)(tw.HC,{children:"Step 1: Click the model you want to check"}),(0,i.jsx)(tw.HC,{children:'Step 2: Click "Explore Change"'}),(0,i.jsx)(tw.HC,{children:'Step 3: Click "Add to Checklist"'})]}),(0,i.jsx)(nC.i,{}),(0,i.jsx)(a.E,{src:"https://datarecce.io/assets/images/onboarding/material.svg",alt:"placeholder"})]})}),(0,i.jsx)(er.m,{children:(0,i.jsx)(es.z,{colorScheme:"blue",onClick:t,children:"Got it!"})})]})]})},l$=e=>{let{isGuideOpen:n,closeGuide:t}=e;return(0,i.jsxs)($.u_,{isOpen:n,onClose:t,scrollBehavior:"inside",children:[(0,i.jsx)(ee.Z,{}),(0,i.jsxs)(en.h,{maxW:"40vw",h:"300px",children:[(0,i.jsx)(et.x,{children:"All nodes displayed"}),(0,i.jsx)(eD.o,{}),(0,i.jsx)(nC.i,{}),(0,i.jsx)(ei.f,{children:(0,i.jsxs)(tN.K,{spacing:4,children:[(0,i.jsx)(el.x,{children:"In a single environment with only a target, no nodes are marked as changed."}),(0,i.jsxs)(o.k,{bg:"blue.100",color:"blue.700",children:[(0,i.jsx)(lG.h,{mt:"10px",ml:"5px"}),(0,i.jsxs)(el.x,{margin:"5px",paddingX:"3px",children:["To see changed nodes, configure a target-base."," ",(0,i.jsx)(r.r,{textDecor:"underline",isExternal:!0,href:"https://datarecce.io/docs/get-started/#prepare-dbt-artifacts",onClick:()=>eS({action:"external_link",from:"onboarding"}),children:"Learn how."})]})]})]})}),(0,i.jsx)(nC.i,{}),(0,i.jsx)(er.m,{children:(0,i.jsx)(es.z,{colorScheme:"blue",onClick:t,children:"Got it!"})})]})]})};var l0=()=>{let[e,n]=(0,j.useState)(!1),[t,l]=(0,j.useState)(!1),{data:r,isLoading:s}=ej();(0,j.useEffect)(()=>{if(!s&&r){let e=r.show_onboarding_guide;if(r.single_env_onboarding&&e){l(!0),eS({action:"onboarding"});return}!localStorage.getItem("hasVisited")&&e&&(n(!0),localStorage.setItem("hasVisited","true"))}},[r,s]);let o=()=>{n(!1),l(!1),eg()};return s?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(lY,{isGuideOpen:e,closeGuide:o}),(0,i.jsx)(l$,{isGuideOpen:t,closeGuide:o})]})},l1=t(39502);t(28269);let l5=e=>{var n;let{run:t,isSelected:r,onSelectRun:a,onAddToChecklist:d,onGoToCheck:c}=e,{data:u}=(0,y.a)({queryKey:P.run(t.run_id),queryFn:async()=>await ec(t.run_id),enabled:(null==t?void 0:t.status)==="running",retry:!1}),h=(null===(n=nB(t.type))||void 0===n?void 0:n.icon)||eO.WzH,x=t.check_id;return(0,i.jsxs)(o.k,{minWidth:"200px",direction:"column",width:"100%",p:"5px 20px",cursor:"pointer",borderBottom:"solid 1px lightgray",borderLeft:"4px",borderLeftColor:r?"orange.400":"transparent",backgroundColor:r?"orange.50":"transparent",onClick:()=>{a(t.run_id)},_hover:{bg:r?"orange.50":"gray.200"},children:[(0,i.jsxs)(o.k,{onClick:()=>{},alignItems:"center",gap:"12px",children:[(0,i.jsx)(s.J,{as:h}),(0,i.jsx)(l.x,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",color:t.name?"inherit":"gray.500",fontSize:"11pt",fontWeight:"500",children:t.name||""}),x?(0,i.jsx)(nk.u,{label:"Go to Check","aria-label":"Go to Check",children:(0,i.jsx)(el.x,{onClick:e=>{e.preventDefault(),e.stopPropagation(),c(x)},children:(0,i.jsx)(s.J,{color:"green",as:tk.FJM})})}):(0,i.jsx)(nk.u,{label:"Add to Checklist","aria-label":"Add to Checklist",children:(0,i.jsx)(el.x,{onClick:e=>{e.preventDefault(),e.stopPropagation(),ek({name:"add_to_checklist"}),d(t.run_id)},children:(0,i.jsx)(s.J,{as:tk.wO})})})]}),(0,i.jsx)(o.k,{justifyContent:"start",fontSize:"11pt",color:"gray.500",gap:"3px",alignItems:"center",children:(0,i.jsx)(ib,{run:u||t})})]})},l2=e=>{let{runAt:n}=e,t=n?function(e){let n=new Date,t=new Date;return(t.setDate(n.getDate()-1),null==e)?null:n.toDateString()===e.toDateString()?"Today":t.toDateString()===e.toDateString()?"Yesterday":(0,im.WU)(e,"MMM d")}(new Date(n)):null;return(0,i.jsx)(o.k,{minWidth:"200px",width:"100%",p:"5px 20px",borderBottom:"solid 1px lightgray",color:"gray.500",fontSize:"11pt",children:t})},l4=()=>{let{data:e,isLoading:n,isFetching:t,error:r,refetch:s}=(0,y.a)({queryKey:P.runs(),queryFn:async()=>await em(),retry:!1}),{showRunId:a,runId:c}=nX(),x=e=>{ek({name:"click_run"}),a(e,!1)},[,m]=(0,eI.TH)(),p=(0,b.NL)(),f=(0,j.useCallback)(async()=>{if(!c)return;let e=await n$(c);p.invalidateQueries({queryKey:P.checks()}),m("/checks/".concat(e.check_id))},[c,m,p]),g=(0,j.useCallback)(e=>{ek({name:"go_to_check"}),m("/checks/".concat(e))},[m]),v=null;return(0,i.jsxs)(o.k,{direction:"column",height:"100%",children:[(0,i.jsxs)(u.U,{width:"100%",flex:"0 0 54px",paddingInline:"24px 8px",borderBottom:"solid 1px lightgray",children:[(0,i.jsx)(d.X,{size:"md",children:"History"}),(0,i.jsx)(h.L,{}),(0,i.jsx)(nF.h,{variant:"unstyled",icon:(0,i.jsx)(ti.n,{}),"aria-label":"Search database",onClick:()=>{s()}})]}),(0,i.jsx)(l.x,{flex:"1 1 auto",children:n?"Loading...":(null==e?void 0:e.length)===0?(0,i.jsx)(e6.M,{height:"100%",color:"gray.400",children:"No runs"}):(0,i.jsx)(l1.Z,{style:{minHeight:"100%",height:0},children:(e||[]).map((e,n)=>{let t=new Date(e.run_at).toDateString(),l=null!=v&&v!==t;return v=t,(0,i.jsxs)(i.Fragment,{children:[l&&(0,i.jsx)(l2,{runAt:e.run_at},t),(0,i.jsx)(l5,{run:e,isSelected:e.run_id===c,onSelectRun:x,onGoToCheck:g,onAddToChecklist:f},e.run_id)]})})})})]})};var l6=t(5552),l3=t(34533);let{definePartsStyle:l9,defineMultiStyleConfig:l8}=(0,l3.D)(l6.TB.keys),l7=l8({variants:{circular:l9({control:(0,l3.k0)({rounded:"full"})})},sizes:{xs:l9({icon:(0,l3.k0)({fontSize:"8px"}),control:(0,l3.k0)({boxSize:"16px",padding:"4px"}),label:(0,l3.k0)({fontSize:"xs"})})}}),re=(0,t(86907).fj)({baseStyle:{borderRadius:"4px"}});var rn=t(35051);let rt=()=>{let e=(0,G.p)();return{toastSuccess:n=>{e({description:n,status:"success",variant:"left-accent",position:"bottom-right",duration:5e3,isClosable:!0})},toastError:(n,t)=>{var i,l;e({description:t?t instanceof i2.d7?"".concat(n,". ").concat(null==t?void 0:null===(l=t.response)||void 0===l?void 0:null===(i=l.data)||void 0===i?void 0:i.detail):"".concat(n,". ").concat(t):"".concat(n),status:"error",variant:"left-accent",position:"bottom-right",duration:5e3,isClosable:!0})}}},ri=e=>{(0,j.useEffect)(()=>{let n=e=>{e.preventDefault()};return e&&window.addEventListener("beforeunload",n),()=>{e&&window.removeEventListener("beforeunload",n)}},[e])},rl=()=>{let{fileName:e,cloudMode:n,isDemoSite:t,isLoading:r}=eE(),a=(0,Y.q)(),d=(0,Y.q)(),c=!e&&!n&&!t,{data:u}=(0,y.a)({queryKey:P.checks(),queryFn:n0,enabled:c}),h=void 0!=u&&u.filter(e=>!e.is_preset).length>0;ri(c&&h);let[{newFileName:x,errorMessage:m,modified:p,overwriteWithMethod:f,bypass:g},v]=(0,j.useState)({newFileName:e||"recce_state.json"}),w=(0,j.useRef)(null),{toastSuccess:k,toastError:C}=rt(),_=(0,b.NL)(),S=async(e,n)=>{if(!x)return;let t="true"===localStorage.getItem(iF.bypassSaveOverwrite);try{"save"===e?await lh({filename:x,overwrite:n||t}):await lx({filename:x,overwrite:n||t}),k("save"===e?"Save file successfully":"Rename file successfully"),_.invalidateQueries({queryKey:P.lineage()}),g&&localStorage.setItem(iF.bypassSaveOverwrite,"true")}catch(n){if(n instanceof i2.d7){var i;if((null===(i=n.response)||void 0===i?void 0:i.status)===409){v(n=>({...n,overwriteWithMethod:e})),d.onOpen();return}}C("save"===e?"Save file failed":"Rename file failed",n)}finally{a.onClose()}};return n||t?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(o.k,{flex:"1",justifyContent:"center",alignItems:"center",children:[(0,i.jsx)(l.x,{fontWeight:"600",children:e||(n?"cloud":"New Instance"+(h?" (unsaved)":""))}),(0,i.jsx)(nk.u,{label:e?"Change Filename":"Save",openDelay:1e3,children:(0,i.jsx)(nF.h,{onClick:()=>{v({newFileName:e||"recce_state.json",modified:!e}),a.onOpen()},"aria-label":"",variant:"unstyled",size:"sm",children:(0,i.jsx)(s.J,{as:e?lw:lb,boxSize:"16px",verticalAlign:"middle"})})})]}),(0,i.jsxs)($.u_,{isOpen:a.isOpen,onClose:a.onClose,isCentered:!0,children:[(0,i.jsx)(ee.Z,{}),(0,i.jsxs)(en.h,{children:[(0,i.jsx)(et.x,{children:e?"Change Filename":"Save File"}),(0,i.jsx)(eD.o,{}),(0,i.jsx)(ei.f,{onKeyDown:e=>{e.stopPropagation()},children:(0,i.jsxs)(eM.NI,{isInvalid:!!m,children:[(0,i.jsx)(eA.l,{children:"File name:"}),(0,i.jsx)(nL.I,{ref:w,value:x,placeholder:"Enter filename",onChange:n=>{let t;let i=n.target.value;i?i.endsWith(".json")?/^[a-zA-Z0-9 _-]+\.json$/.test(i)?e&&i===e&&(t="Filename is the same as the current one."):t="Invalid filename. Only alphanumeric, space, _ and - are allowed.":t="Filename must end with .json.":t="Filename cannot be empty.",v(e=>({...e,modified:!0,newFileName:i,errorMessage:t}))},onKeyDown:n=>{"Enter"===n.key?m||(e?S("rename"):S("save")):"Escape"===n.key&&a.onClose()}}),(0,i.jsx)(rn.J1,{children:m})]})}),(0,i.jsxs)(er.m,{gap:"5px",children:[(0,i.jsx)(es.z,{size:"sm",colorScheme:e?void 0:"blue",onClick:()=>{S("save")},isDisabled:!x||!!m||!p,children:e?"Save as New File":"Confirm"}),e&&(0,i.jsx)(es.z,{size:"sm",colorScheme:"blue",onClick:()=>{S("rename")},isDisabled:!x||!!m||!p,children:"Rename"})]})]})]}),(0,i.jsxs)($.u_,{isOpen:d.isOpen,onClose:d.onClose,initialFocusRef:w,isCentered:!0,children:[(0,i.jsx)(ee.Z,{}),(0,i.jsxs)(en.h,{children:[(0,i.jsx)(et.x,{children:"Overwrite File?"}),(0,i.jsx)(eD.o,{}),(0,i.jsxs)(ei.f,{borderTop:"solid 1px lightgray",borderBottom:"solid 1px lightgray",onKeyDown:e=>{e.stopPropagation()},children:[(0,i.jsx)(l.x,{fontSize:"12pt",children:"save"===f?"Saving a file with this name will overwrite the existing file. Are you sure you wish to continue?":"Renaming the file with this name will overwrite the existing file. Are you sure you wish to continue?"}),(0,i.jsx)(nh.X,{isChecked:g,onChange:e=>v(n=>({...n,bypass:e.target.checked})),fontWeight:"bold",size:"sm",pt:"8px",children:"Don't show this again"})]}),(0,i.jsxs)(er.m,{gap:"5px",children:[(0,i.jsx)(es.z,{variant:"outline",onClick:()=>{d.onClose(),a.onOpen(),v(e=>({...e,overwriteWithMethod:void 0}))},size:"sm",children:"Back"}),(0,i.jsx)(es.z,{size:"sm",colorScheme:"blue",onClick:()=>{f&&(S(f,!0),d.onClose())},children:"Overwrite"})]})]})]})]})};var rr=t(2842),rs=t(49624);function ro(){return(0,i.jsx)(nk.u,{label:"Syncing",children:(0,i.jsx)(es.z,{pt:"6px",variant:"unstyled",boxSize:"1em",children:(0,i.jsx)(tU.$,{})})})}function ra(){let[e,n]=(0,j.useState)(!1),t=(0,b.NL)(),[r,o]=(0,eI.TH)(),{isOpen:a,onOpen:d,onClose:c}=(0,Y.q)(),[u,h]=(0,j.useState)(""),x=(0,G.p)(),m=(0,j.useCallback)(async e=>{if(c(),n(!0),"conflict"===(await lg(e)).status){d(),n(!1);return}for(;await lf();)await new Promise(e=>setTimeout(e,1e3));x({description:"Sync Completed",status:"success",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0}),n(!1),h(""),t.invalidateQueries({queryKey:P.lineage()}),t.invalidateQueries({queryKey:P.checks()}),t.invalidateQueries({queryKey:P.runs()}),/^\/checks\/([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/.test(r)&&o("/checks")},[t,r,o,x,d,c]);return e?(0,i.jsx)(ro,{}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nk.u,{label:"Sync with Cloud",children:(0,i.jsx)(nF.h,{size:"sm",variant:"unstyled","aria-label":"Sync state",onClick:()=>m({}),icon:(0,i.jsx)(s.J,{as:lv,verticalAlign:"middle",boxSize:"16px"})})}),(0,i.jsxs)($.u_,{isOpen:a,onClose:c,children:[(0,i.jsx)(ee.Z,{}),(0,i.jsxs)(en.h,{children:[(0,i.jsx)(et.x,{fontSize:"lg",fontWeight:"bold",children:"Sync with Cloud"}),(0,i.jsxs)(ei.f,{children:[(0,i.jsx)(l.x,{children:"New changes have been detected in the cloud. Please choose a method to sync your state"}),(0,i.jsx)(l.x,{mt:"5px",children:(0,i.jsx)(rr.E,{onChange:h,value:u,children:(0,i.jsxs)(tN.K,{direction:"column",children:[(0,i.jsxs)(rs.Y,{value:"merge",children:["Merge",(0,i.jsx)(nk.u,{label:"This will merge the local and remote states.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.J,{as:lG.h,ml:2,cursor:"pointer"})})})]}),(0,i.jsxs)(rs.Y,{value:"overwrite",children:["Overwrite",(0,i.jsx)(nk.u,{label:"This will overwrite the remote state file with the local state.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.J,{as:lG.h,ml:2,cursor:"pointer"})})})]}),(0,i.jsxs)(rs.Y,{value:"revert",children:["Revert",(0,i.jsx)(nk.u,{label:"This will discard local changes and revert to the cloud state.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.J,{as:lG.h,ml:2,cursor:"pointer"})})})]})]})})})]}),(0,i.jsxs)(er.m,{children:[(0,i.jsx)(es.z,{onClick:c,mr:3,children:"Cancel"}),(0,i.jsx)(es.z,{colorScheme:"blue",onClick:()=>m({method:u}),isDisabled:!u,children:"Sync"})]})]})]})]})}let rd=e=>{let{children:n,path:t}=e,[r]=(0,eI.yj)(t);return(0,i.jsx)(l.x,{display:r?"block":"none",height:"100%",children:n})};function rc(e){let{icon:n,href:t,...l}=e;return(0,i.jsx)(r.r,{height:"20px",color:"white",href:t,isExternal:!0,...l,children:(0,i.jsx)(s.J,{color:"white",boxSize:"20px",as:n})})}function ru(){let{reviewMode:e,isDemoSite:n,envInfo:t,cloudMode:x,isLoading:m}=eE(),p=function(){let[e,n]=(0,j.useState)("");return(0,j.useEffect)(()=>{(async function(){try{let e=await U.get("/api/version");n(e.data)}catch(e){console.error("Error fetching version number:",e)}})()},[]),e}(),{url:f,id:g}=(null==t?void 0:t.pullRequest)||{},v=f?f.split("/").pop():null;return(0,i.jsxs)(o.k,{gap:"10px",minHeight:"40px",alignItems:"center",bg:"rgb(255, 110, 66)",children:[(0,i.jsx)(a.E,{boxSize:"20px",ml:"18px",src:"/logo/recce-logo-white.png",alt:"recce-logo-white"}),(0,i.jsx)(d.X,{as:"h1",fontFamily:'"Montserrat", sans-serif',fontSize:"lg",color:"white",children:"RECCE"}),(0,i.jsx)(c.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:p}),e&&(0,i.jsx)(c.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:"review mode"}),x&&(0,i.jsx)(c.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:(0,i.jsxs)(u.U,{children:[(0,i.jsx)(l.x,{children:"cloud mode"}),(0,i.jsx)(l.x,{borderLeft:"1px",borderLeftColor:"whiteAlpha.500",paddingLeft:"8px",children:(0,i.jsxs)(r.r,{href:f,_hover:{textDecoration:"none"},isExternal:!0,children:[(0,i.jsx)(s.J,{as:e7.X9P,boxSize:"3",fontWeight:"extrabold",strokeWidth:"1"})," #".concat(g)]})})]})}),n&&f&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(c.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:(0,i.jsxs)(u.U,{children:[(0,i.jsx)(l.x,{children:"demo mode"}),(0,i.jsx)(l.x,{borderLeft:"1px",borderLeftColor:"whiteAlpha.500",paddingLeft:"8px",children:(0,i.jsxs)(r.r,{href:f,_hover:{textDecoration:"none"},isExternal:!0,children:[(0,i.jsx)(s.J,{as:e7.X9P,boxSize:"3",fontWeight:"extrabold",strokeWidth:"1"})," #".concat(v)]})})]})})}),(0,i.jsx)(h.L,{}),(0,i.jsx)(rc,{icon:tk.hJX,href:"https://github.com/DataRecce/recce"}),(0,i.jsx)(rc,{icon:tk.w5k,href:"https://getdbt.slack.com/archives/C05C28V7CPP"}),(0,i.jsx)(rc,{mr:"18px",icon:tk.MXt,href:"https://datarecce.io/docs"})]})}function rh(e){let{queryKey:n,fetchCallback:t,selectCallback:r}=e,{data:s,isLoading:o,error:a}=(0,y.a)({queryKey:n,queryFn:t,select:r});return o||a||0===s?(0,i.jsx)(i.Fragment,{}):(0,i.jsx)(l.x,{ml:"2px",height:"80%",aspectRatio:1,borderRadius:"full",bg:"tomato",alignContent:"center",color:"white",fontSize:"xs",children:s})}function rx(){let{isDemoSite:e,reviewMode:n,fileMode:t,cloudMode:r,isLoading:s}=eE(),[a,d]=(0,eI.TH)(),{data:c,isLoading:u}=ej(),h=(0,i.jsx)(rh,{queryKey:P.checks(),fetchCallback:n0,selectCallback:e=>e.filter(e=>!e.is_checked).length}),f=[{name:"Lineage",href:"/lineage"},{name:"Query",href:"/query",disable:(null==c?void 0:c.single_env_onboarding)===!0},{name:"Checklist",href:"/checks",badge:h,disable:(null==c?void 0:c.single_env_onboarding)===!0}],g=eN().findIndex(f,e=>{let{href:n}=e;return a.startsWith(n)});return(0,i.jsx)(x.m,{index:g,children:(0,i.jsxs)(m.t,{children:[(0,i.jsx)(l.x,{flex:"1",display:"flex",children:f.map(e=>{let{name:n,href:t,badge:l,disable:r}=e;return(0,i.jsxs)(p.O,{onClick:()=>{d(t)},isDisabled:s||u||r,hidden:r,children:[n,l]},n)})}),!s&&!e&&(0,i.jsx)(rl,{}),!s&&(0,i.jsxs)(o.k,{flex:"1",justifyContent:"right",alignItems:"center",mr:"8px",children:[r&&(0,i.jsx)(ra,{}),(0,i.jsx)(lq,{}),(0,i.jsx)(lQ,{})]})]})})}function rm(){let{isRunResultOpen:e,isHistoryOpen:n,closeRunResult:t}=nX(),[r]=(0,eI.TH)(),s=e&&!r.startsWith("/checks"),o=n&&!r.startsWith("/checks");return(0,i.jsxs)(ty,{sizes:[0,100],minSize:o?300:0,gutterSize:o?5:0,style:{height:"100%"},children:[(0,i.jsx)(l.x,{style:{contain:"size"},children:o&&(0,i.jsx)(l4,{})}),(0,i.jsxs)(tb,{sizes:s?[50,50]:[100,0],minSize:s?100:0,gutterSize:s?5:0,style:{flex:"1",contain:"size"},children:[(0,i.jsx)(l.x,{p:0,style:{contain:"content"},children:(0,i.jsxs)(lF,{children:[(0,i.jsx)(rd,{path:"/lineage",children:(0,i.jsx)(lX,{})}),(0,i.jsxs)(eI.rs,{children:[(0,i.jsx)(eI.AW,{path:"/query",children:(0,i.jsx)(lE,{})}),(0,i.jsx)(eI.AW,{path:"/checks/:slug*",children:(0,i.jsx)(l_,{})}),(0,i.jsx)(eI.AW,{path:"/runs/:runId",children:e=>{let{runId:n}=e;return(0,i.jsx)(lM,{runId:n})}}),(0,i.jsx)(eI.AW,{path:"/ssr",children:(0,i.jsx)(f.E,{size:"xs",isIndeterminate:!0})}),(0,i.jsx)(eI.AW,{children:(0,i.jsx)(eI.l_,{to:"/lineage"})})]})]})}),s?(0,i.jsx)(iC,{onClose:t}):(0,i.jsx)(l.x,{})]})]})}let rp=(0,g.B1)({components:{Checkbox:l7,Tooltip:re}});function rf(){(0,j.useLayoutEffect)(()=>{!function(){var e;let n=(e=document.cookie.match("(^|;)\\s*recce_user_id\\s*=\\s*([^;]+)"))?e.pop():"",t=eb.env.AMPLITUDE_API_KEY;if(n&&t)try{ey.S1(t,n,{defaultTracking:!0})}catch(e){console.error(e)}}()},[]);let e=(0,lI.Z)({components:{MuiTooltip:{styleOverrides:{tooltip:{zIndex:1500}}}}});return(0,i.jsx)(lO.Z,{theme:e,children:(0,i.jsx)(v.x,{theme:rp,children:(0,i.jsx)(b.aH,{client:Z,children:(0,i.jsx)(eI.F0,{hook:lL,children:(0,i.jsx)(nG,{children:(0,i.jsxs)(o.k,{direction:"column",height:"100vh",overflow:"hidden",children:[(0,i.jsx)(ru,{}),(0,i.jsx)(rx,{}),(0,i.jsx)(l0,{}),(0,i.jsx)(rm,{})]})})})})})})}},76890:function(){},24550:function(){},50394:function(){},5637:function(){}},function(e){e.O(0,[887,524,434,678,509,648,989,147,995,739,283,303,22,25,355,495,599,852,342,868,986,744],function(){return e(e.s=17812)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/recce/data/_next/static/chunks/app/page-6acdd1379ad0ae37.js b/recce/data/_next/static/chunks/app/page-6acdd1379ad0ae37.js new file mode 100644 index 00000000..391d5033 --- /dev/null +++ b/recce/data/_next/static/chunks/app/page-6acdd1379ad0ae37.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{17812:function(e,n,t){Promise.resolve().then(t.bind(t,24790))},24790:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return ry}});var i=t(60088),l=t(95523),r=t(1401),s=t(51269),o=t(84185),a=t(26883),d=t(8539),c=t(62752),u=t(11801),h=t(32060),x=t(79698),m=t(65452),p=t(99345),f=t(84739),g=t(98459),v=t(27180),j=t(40843),y=t(16341),b=t(25658);let w='select * from {{ ref("mymodel") }}',k=(0,j.createContext)({sqlQuery:w,setSqlQuery:()=>{},primaryKeys:void 0,setPrimaryKeys:()=>{},isCustomQueries:!1,setCustomQueries:()=>{},baseSqlQuery:w,setBaseSqlQuery:()=>{}});function C(e){let{children:n}=e,[t,l]=j.useState(w),[r,s]=j.useState(w),[o,a]=j.useState(!1),[d,c]=j.useState();return(0,i.jsx)(k.Provider,{value:{setSqlQuery:l,sqlQuery:t,setPrimaryKeys:c,primaryKeys:d,isCustomQueries:o,setCustomQueries:a,baseSqlQuery:r,setBaseSqlQuery:s},children:n})}let _=()=>(0,j.useContext)(k),S=(0,j.createContext)({isNodesFetching:[],setIsNodesFetching:()=>{}});function z(e){let{children:n}=e,[t,l]=j.useState([]);return(0,i.jsx)(S.Provider,{value:{isNodesFetching:t,setIsNodesFetching:l},children:n})}var R=t(13943);function E(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=new Set,l={},r=(e,t)=>{if(!(t<0)&&(void 0===l[e]||!(l[e]>=t))){for(let i of(l[e]=t,n(e)))r(i,t-1);i.add(e)}};for(let n of e)r(n,t);return i}function T(){for(var e=arguments.length,n=Array(e),t=0;t{e.forEach(e=>{i.add(e)})}),i}var D=t(67407),L=t.n(D);function I(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;return E(n,n=>void 0===e.nodes[n]?[]:Object.keys(e.nodes[n].parents),t)}function O(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;return E(n,n=>void 0===e.nodes[n]?[]:Object.keys(e.nodes[n].children),t)}function M(e,n){let t=[],i=[];function l(e){return"base"===e?0:"current"===e?2:1}function r(e,n){let t=l(e.from),i=l(n.from);return ti?1:0}let s=null!=n?new Set(n):void 0;for(let n of Object.values(e.nodes).sort(r))(!s||s.has(n.id))&&t.push({id:n.id,position:{x:0,y:0},data:n,type:"customNode",targetPosition:R.Ly.Left,sourcePosition:R.Ly.Right});for(let n of Object.values(e.edges).sort(r))(!s||s.has(n.parent.id)&&s.has(n.child.id))&&i.push({id:n.id,type:"customEdge",source:n.parent.id,target:n.child.id,data:n});return A(t,i),F(Array.from(O(e,e.modifiedSet)),t,i)}let A=function(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"LR",i=new(L()).graphlib.Graph;i.setDefaultEdgeLabel(()=>({})),i.setGraph({rankdir:t}),e.forEach(e=>{i.setNode(e.id,{width:300,height:36})}),n.forEach(e=>{i.setEdge(e.source,e.target)}),L().layout(i),e.forEach(e=>{let n=i.node(e.id);return e.position={x:n.x-150,y:n.y-18},e})};function F(e,n,t){let i=new Set(e),l=new Set(t.filter(e=>i.has(e.source)&&i.has(e.target)).map(e=>e.id));return[n.map(e=>({...e,data:{...e.data,isHighlighted:i.has(e.id)}})),t.map(e=>({...e,data:{...e.data,isHighlighted:l.has(e.id)}}))]}function q(e,n){return n.map(n=>{let t=n.id===e;return{...n,data:{...n.data,isSelected:t}}})}function N(e,n){return n.map(n=>{let t=n.id===e;return{...n,data:{...n.data,isSelected:n.data.isSelected!==t}}})}function V(e,n){let t=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return n.map(n=>{let i=e.includes(n.id);return{...n,data:{...n.data,isSelected:t?i:n.data.isSelected||i}}})}function H(e,n){return e.map(e=>({...e,data:{...e.data,isSelected:!1,isActionMode:n,action:void 0}}))}let P={lineage:()=>["lineage"],checks:()=>["checks","list"],check:e=>["checks",e],runs:()=>["runs"],run:e=>["runs",e],runsAggregated:()=>["runs_aggregated"],flag:()=>["flag"]};var W=t(93677),K=t(38674);let B=K.env.NEXT_PUBLIC_API_URL?K.env.NEXT_PUBLIC_API_URL:window.location.origin;var J=t(22386);let U=W.default.create({baseURL:B}),Z=new J.S;async function Q(){return(await U.get("/api/info")).data}async function X(e){return(await U.get("/api/model/".concat(e))).data}var G=t(85259),Y=t(6604),$=t(34743),ee=t(69666),en=t(14720),et=t(36778),ei=t(84078),el=t(84387),er=t(11126),es=t(92556),eo=t(58540),ea=t.n(eo);async function ed(e,n,t){return(await U.post("/api/runs",{type:e,params:n,nowait:null==t?void 0:t.nowait})).data}async function ec(e,n){return(await U.get("/api/runs/".concat(e,"/wait"),{params:{timeout:n}})).data}async function eu(e){return await U.post("/api/runs/".concat(e,"/cancel"))}async function eh(e,n){return(await U.post("/api/checks/".concat(e,"/run"),{nowait:null==n?void 0:n.nowait})).data}async function ex(e,n,t){return(await U.post("/api/runs/search",{type:e,params:n,limit:t})).data}async function em(){return(await U.get("/api/runs")).data}async function ep(){return(await U.post("/api/runs/aggregate",{})).data}async function ef(){return(await U.get("/api/flag")).data}async function eg(){try{await U.post("/api/onboarding/completed")}catch(e){}}async function ev(){try{await U.post("/api/relaunch-hint/completed")}catch(e){}}let ej=()=>(0,y.a)({queryKey:P.flag(),queryFn:ef});var ey=t(16564),eb=t(38674);function ew(e){ey.j("[Web] multi_nodes_action",e)}function ek(e){ey.j("[Web] history_action",e)}function eC(e){ey.j("[Experiment] preview_change",e)}function e_(e){ey.j("[Experiment] preview_change",e)}function eS(e){ey.j("[Experiment] single_environment",e)}let ez=(0,j.createContext)({isActionAvailable:()=>!0});function eR(e){var n,t,l;let{children:r}=e,s=(0,y.a)({queryKey:P.lineage(),queryFn:Q}),o=(0,y.a)({queryKey:P.runsAggregated(),queryFn:ep}),a=(0,j.useMemo)(()=>{var e;let n=null===(e=s.data)||void 0===e?void 0:e.lineage;if(n&&n.base&&n.current)return function(e,n){let t={},i={},l=(e,n)=>({id:e,name:e,data:{},from:n,parents:{},children:{},isSelected:!1});for(let[n,i]of Object.entries(e.nodes))t[n]=l(n,"base"),i&&(t[n].data.base=i,t[n].name=null==i?void 0:i.name,t[n].resourceType=null==i?void 0:i.resource_type,t[n].packageName=null==i?void 0:i.package_name);for(let[e,i]of Object.entries(n.nodes))t[e]?t[e].from="both":t[e]=l(e,"current"),i&&(t[e].data.current=n.nodes&&n.nodes[e],t[e].name=null==i?void 0:i.name,t[e].resourceType=null==i?void 0:i.resource_type,t[e].packageName=null==i?void 0:i.package_name);for(let[n,l]of Object.entries(e.parent_map))for(let e of l){let l=t[n],r=t[e],s="".concat(e,"_").concat(n);if(!l||!r)continue;i[s]={id:s,from:"base",parent:r,child:l};let o=i[s];l.parents[e]=o,r.children[n]=o}for(let[e,l]of Object.entries(n.parent_map))for(let n of l){let l=t[e],r=t[n],s="".concat(n,"_").concat(e);if(!l||!r)continue;i[s]?i[s].from="both":i[s]={id:s,from:"current",parent:r,child:l};let o=i[s];l.parents[n]=o,r.children[e]=o}let r=[];for(let[e,n]of Object.entries(t))if("base"===n.from)n.changeStatus="removed",r.push(n.id);else if("current"===n.from)n.changeStatus="added",r.push(n.id);else{var s,o,a,d,c,u;let e=null==n?void 0:null===(a=n.data)||void 0===a?void 0:null===(o=a.base)||void 0===o?void 0:null===(s=o.checksum)||void 0===s?void 0:s.checksum,t=null==n?void 0:null===(u=n.data)||void 0===u?void 0:null===(c=u.current)||void 0===c?void 0:null===(d=c.checksum)||void 0===d?void 0:d.checksum;e&&t&&e!==t&&(n.changeStatus="modified",r.push(n.id))}for(let[e,n]of Object.entries(i))"base"===n.from?n.changeStatus="removed":"current"===n.from&&(n.changeStatus="added");return{nodes:t,edges:i,modifiedSet:r,manifestMetadata:{base:e.manifest_metadata||void 0,current:n.manifest_metadata||void 0},catalogMetadata:{base:e.catalog_metadata||void 0,current:n.catalog_metadata||void 0}}}(n.base,n.current)},[s.data]),d=null===(n=s.error)||void 0===n?void 0:n.message,{lineage:c,sqlmesh:u,demo:h,review_mode:x,cloud_mode:m,file_mode:p,filename:f,adapter_type:g,git:v,pull_request:w,support_tasks:k}=s.data||{},C=null==c?void 0:null===(t=c.base)||void 0===t?void 0:t.manifest_metadata,_=null==c?void 0:null===(l=c.current)||void 0===l?void 0:l.manifest_metadata,{connectionStatus:S,connect:z,envStatus:R}=function(){let e=(0,G.p)(),n=(0,j.useRef)({ws:void 0,status:"pending"}),[t,i]=(0,j.useState)("pending"),[l,r]=(0,j.useState)(void 0);n.current.status=t;let s=(0,b.NL)(),o=()=>{s.invalidateQueries({queryKey:P.lineage()}),s.invalidateQueries({queryKey:P.checks()}),s.invalidateQueries({queryKey:P.runs()})},a=()=>{let t=new WebSocket("".concat(B.replace(/(http)(s)?\:\/\//,"ws$2://"),"/api/ws"));n.current.ws=t,t.onopen=()=>{t.send("ping")},t.onmessage=t=>{if("pong"===t.data){"disconnected"===n.current.status&&o(),i("connected");return}try{let n=JSON.parse(t.data);if("refresh"===n.command){let{eventType:t,srcPath:i}=n.event,[l,r]=i.split("/").slice(-2),s=ea().parse(r).name;e({description:"Detected ".concat(l," ").concat(s," ").concat(t),status:"info",variant:"left-accent",position:"bottom-right",duration:5e3,isClosable:!0}),o()}else"relaunch"===n.command&&r("relaunch")}catch(e){console.error(e)}},t.onerror=e=>{console.error(e)},t.onclose=()=>{i(e=>"connected"===e?"disconnected":e),n.current.ws=void 0}};return(0,j.useEffect)(()=>{let e=n.current;return a(),()=>{e.ws&&e.ws.close()}},[]),{connectionStatus:t,connect:a,envStatus:l}}(),{data:E,isLoading:T}=ej(),{onClose:D}=(0,Y.q)(),[L,I]=(0,j.useState)(!1),O=(0,b.NL)(),M=(0,j.useCallback)(e=>{if(k){var n;return null===(n=k[e])||void 0===n||n}return!0},[k]);return(0,j.useEffect)(()=>{T||("relaunch"===R&&(null==E?void 0:E.single_env_onboarding)&&(null==E?void 0:E.show_relaunch_hint)?(I(!0),eS({action:"target_base_added"})):I(!1))},[E,R,T]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(ez.Provider,{value:{lineageGraph:a,retchLineageGraph:()=>{o.refetch()},envInfo:{adapterType:g,git:v,pullRequest:w,dbt:{base:C,current:_},sqlmesh:u},reviewMode:x,cloudMode:m,fileMode:p,fileName:f,isDemoSite:h,error:d,supportTasks:k,isActionAvailable:M,isLoading:s.isLoading,runsAggregated:o.data,refetchRunsAggregated:()=>{o.refetch()}},children:r}),(0,i.jsxs)($.u_,{isOpen:"disconnected"===S,onClose:()=>{},isCentered:!0,children:[(0,i.jsx)(ee.Z,{}),(0,i.jsxs)(en.h,{children:[(0,i.jsx)(et.x,{children:"Server Disconnected"}),(0,i.jsx)(ei.f,{children:(0,i.jsx)(el.x,{children:"The server connection has been lost. Please restart the Recce server and try again."})}),(0,i.jsx)(er.m,{children:(0,i.jsx)(es.z,{colorScheme:"blue",onClick:()=>{z()},children:"Retry"})})]})]}),(null==E?void 0:E.single_env_onboarding)&&(0,i.jsxs)($.u_,{isOpen:L,onClose:()=>{D(),ev(),O.invalidateQueries({queryKey:P.flag()})},isCentered:!0,children:[(0,i.jsx)(ee.Z,{}),(0,i.jsxs)(en.h,{children:[(0,i.jsx)(et.x,{children:"Target-base Added"}),(0,i.jsx)(ei.f,{children:(0,i.jsx)(el.x,{children:"Please restart the Recce server."})}),(0,i.jsx)(er.m,{children:(0,i.jsx)(es.z,{colorScheme:"blue",onClick:()=>{D(),ev(),O.invalidateQueries({queryKey:P.flag()})},children:"Got it!"})})]})]})]})}let eE=()=>(0,j.useContext)(ez),eT=()=>{let{runsAggregated:e,refetchRunsAggregated:n}=eE();return[e,n]};var eD=t(65050);let eL=e=>{let{isOpen:n,onClose:t,onExecute:r,type:s,title:a,params:d,RunForm:c}=e,[u,h]=(0,j.useState)(d),[x,m]=(0,j.useState)(!1);return(0,i.jsxs)($.u_,{isOpen:n,onClose:t,size:"6xl",scrollBehavior:"inside",children:[(0,i.jsx)(ee.Z,{}),(0,i.jsxs)(en.h,{overflowY:"auto",height:"75%",children:[(0,i.jsx)(et.x,{children:a}),(0,i.jsx)(eD.o,{}),(0,i.jsx)(ei.f,{p:"0px",h:"100%",overflow:"auto",borderY:"1px solid lightgray",children:(0,i.jsx)(l.x,{style:{contain:"layout"},children:c&&(0,i.jsx)(c,{params:u,onParamsChanged:h,setIsReadyToExecute:m})})}),(0,i.jsx)(er.m,{children:(0,i.jsx)(o.k,{gap:"10px",children:(0,i.jsx)(es.z,{isDisabled:!x,colorScheme:"blue",onClick:()=>{r(s,u)},children:"Execute"})})})]})]})};var eI=t(78473),eO=t(20413),eM=t(94134),eA=t(61381),eF=t(90788),eq=t(82821),eN=t.n(eq);function eV(e,n){let t=[];return e.forEach(e=>{t.some(n=>n.name===e.name)||t.push(e)}),n.forEach(e=>{t.some(n=>n.name===e.name)||t.push(e)}),t}var eH=e=>{var n;let{lineageGraph:t}=eE(),[i,l]=(0,j.useState)([]),[r,s]=(0,j.useState)(),[o,a]=(0,j.useState)(!0),[d,c]=(0,j.useState)(null),u=eN().find(null==t?void 0:t.nodes,{name:e}),h=(0,j.useMemo)(()=>u?function(e){function n(e){return e&&e.columns?Object.values(e.columns):[]}return eV(n(e.data.base),n(e.data.current))}(u):[],[u]),x=u?null===(n=u.data.current)||void 0===n?void 0:n.primary_key:void 0;return(0,j.useEffect)(()=>{let e=async()=>{try{let e=(await X(null==u?void 0:u.id)).model;if(!e||!e.base.columns||!e.current.columns){l([]);return}s(e.current.primary_key);let n=Object.values(e.base.columns),t=Object.values(e.current.columns);l(eV(n,t))}catch(e){c(e)}};h.length>0?(l(h),s(x)):(null==u?void 0:u.id)===void 0?l([]):e(),a(!1)},[null==u?void 0:u.id,h,x]),{columns:i,primaryKey:r,isLoading:o,error:d}};function eP(e){return["CHAR","VARCHAR","TINYTEXT","TEXT","MEDIUMTEXT","LONGTEXT","NCHAR","NVARCHAR","VARCHAR2","NVARCHAR2","CLOB","NCLOB","VARCHAR(MAX)","XML","JSON","BOOLEAN","TINYINT(1)","BIT","NUMBER(1)","BOOL"].includes(e.toUpperCase())}function eW(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())}var eK=t(77125),eB=t(94659),eJ=t(42921);function eU(e){let n=e>0&&e<=.001,t=e<1&&e>=.999,i=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e;return function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en-US",t=arguments.length>2?arguments[2]:void 0;return"number"!=typeof e?e:new Intl.NumberFormat(n,t).format(e)}(n,"en-US",{style:"percent",minimumFractionDigits:1})};if(n){let e=i(.001);return"<".concat(e)}if(t){let e=i(.999);return">".concat(e)}return i()}function eZ(e){if("number"!=typeof e)return e;{let n=Math.abs(e),t=n>=.01,i=n>=1e6,l=n>=1e9,r=n>=1e15;if(r||n>=1e12)return new Intl.NumberFormat("en-US",{style:"unit",unit:"liter",unitDisplay:"narrow",maximumFractionDigits:r?0:2}).format(e/1e12).replace("L","T");if(l||i||n>=1e3){let n={base:l?1e9:i?1e6:1e3,unit:l?"B":i?"M":"K"};return new Intl.NumberFormat("en-US",{style:"unit",unit:"liter",unitDisplay:"narrow",maximumFractionDigits:1}).format(e/n.base).replace("L",n.unit)}return n>=1?new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(e):new Intl.NumberFormat("en-US",{maximumFractionDigits:t?3:2,notation:t||0===n?"standard":"scientific"}).format(e)}}let eQ="#63B3ED",eX="#F6AD55",eG="".concat(eQ,"A5"),eY="".concat(eX,"A5");function e$(e){let{color:n}=e;return(0,i.jsx)(l.x,{display:"inline-block",w:"10px",h:"10px",bgColor:n,mr:"2",borderRadius:"sm"})}function e0(e){let{data:n,hideAxis:t=!1,animation:l=!1}=e;eB.kL.register(eB.ZL,eB.RM,eB.f$,eB.uw,eB.Dx,eB.De,eB.u);let r=function(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],{...t}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{title:i,datasets:l,type:r,samples:s=0,binEdges:o}=e,[a,d]=l,c="datetime"===r;return{responsive:!0,maintainAspectRatio:!1,plugins:{legend:{reverse:!0},title:{display:!0,text:i,font:{size:20}},tooltip:{mode:"index",intersect:!1,callbacks:{title(e){let[{dataIndex:n,datasetIndex:t}]=e,i=e5(o,n);return"".concat(c?"Date Range":"string"===r?"Text Length":"Value Range","\n").concat(i)},label(e){let{datasetIndex:n,dataIndex:t,dataset:{label:i}}=e,l=0===n?d.counts:a.counts,r=eU(l[t]/s),o=l[t];return"".concat(i,": ").concat(o," (").concat(r,")")}}}},scales:function(e){let{datasets:n,min:t=0,max:i=0,type:l,binEdges:r}=e,s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],[o,a]=n,d=Math.max(...a.counts,...o.counts),c=r.map((e,n)=>e5(r,n)).slice(0,-1);return{x:"datetime"===l?{display:!s,type:"timeseries",min:t,max:i,adapters:{date:{}},time:{minUnit:"day"},grid:{display:!1},ticks:{minRotation:30,maxRotation:30,maxTicksLimit:8}}:{display:!s,type:"category",grid:{display:!1},ticks:{callback:(e,n)=>c[n]},stacked:!0},y:{display:!s,type:"linear",max:d,border:{dash:[2,2]},grid:{color:"lightgray"},ticks:{maxTicksLimit:8,callback:function(e,n){return eZ(e)}},beginAtZero:!0}}}(e,n),...t}}(n,t,{animation:l}),s=function(e){let{datasets:n,type:t,binEdges:i}=e,[l,r]=n,s=e1(t,i,"Current",eG,r),o=e1(t,i,"Base",eY,l);return{labels:i.map((e,n)=>e5(i,n)).slice(0,-1),datasets:[s,o]}}(n);return(0,i.jsx)(eJ.kL,{type:"bar",options:r,data:s,plugins:[]})}function e1(e,n,t,i,l){let{counts:r=[]}=l;return{label:t,data:"datetime"===e?r.map((e,t)=>({x:n[t],y:e})):r,backgroundColor:i,borderColor:i,hoverBackgroundColor:i,borderWidth:0,categoryPercentage:1,barPercentage:1,xAxisID:"x"}}function e5(e,n){let t=e[n],i=e[n+1],l=eZ(t),r=eZ(i);return"".concat(l," - ").concat(r)}let e2=(0,eK.G)((e,n)=>{let{backgroundColor:t="white",blockSize:r,children:s,...o}=e;return(0,i.jsx)(l.x,{ref:n,...o,overflowY:"auto",overflowX:"hidden",children:(0,i.jsx)(l.x,{backgroundColor:t,height:"100%",blockSize:r,children:s})})}),e4=(0,eK.G)(function(e,n){var t,r,s,a,d,c;let{run:x}=e,m=x.params,p=null===(t=x.result)||void 0===t?void 0:t.base,f=null===(r=x.result)||void 0===r?void 0:r.current,g=null===(s=x.result)||void 0===s?void 0:s.min,v=null===(a=x.result)||void 0===a?void 0:a.max,j=null===(d=x.result)||void 0===d?void 0:d.bin_edges;return p&&f?(0,i.jsx)(o.k,{direction:"column",height:"100%",children:(0,i.jsx)(e2,{ref:n,height:"100%",children:(0,i.jsxs)(u.U,{children:[(0,i.jsx)(h.L,{}),(0,i.jsx)(l.x,{w:"80%",h:"35vh",m:"4",children:(0,i.jsx)(e0,{data:{title:"Model ".concat(m.model,".").concat(m.column_name),type:(null===(c=x.params)||void 0===c?void 0:c.column_type)||"",datasets:[p,f],min:g,max:v,samples:p.total,binEdges:j}})}),(0,i.jsx)(h.L,{})]})})}):(0,i.jsx)("div",{children:"Loading..."})});var e6=t(21129);t(91751);var e3=t(30614);let e9=(0,eK.G)((e,n)=>{let{...t}=e;return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(e3.ZP,{ref:n,...t})})});function e8(){return(0,i.jsx)(o.k,{h:"35px",alignItems:"center",justifyContent:"center",bg:"gray.100",style:{textAlign:"center",gridColumn:"1/-1"},children:(0,i.jsx)(el.x,{fontWeight:"600",children:" No rows"})})}t(24550);var e7=t(8);function ne(e,n){let t=function(e,n){let t=[...e],i=[...n],l=[];for(;t.length>0&&i.length>0;)if(l.includes(t[0]))t.shift();else if(l.includes(i[0]))i.shift();else if(t[0]===i[0])l.push(t[0]),t.shift(),i.shift();else if(i.includes(t[0])){let e=i.indexOf(t[0]);for(let n=0;n{l.includes(e)||l.push(e)}),i.forEach(e=>{l.includes(e)||l.push(e)}),l}(e,n),i={};for(let l of t)e.includes(l)?n.includes(l)?i[l]=void 0:i[l]="removed":i[l]="added";let l={};e.forEach((e,n)=>{l[e]=n});let r=-1;for(let e of t){let n=l[e];void 0!==n&&(n>r?r=n:i[e]="reordered")}return i}function nn(e,n){let t=[];for(let i of n){let n=e.findIndex(e=>e.name===i);if(n<0)throw Error("Column ".concat(i," not found"));t.push(n)}return t}function nt(e,n,t){let i={};if(0===n.length)return JSON.stringify({_index:t._index});for(let l of n)i[e[l].name]=t[l];return JSON.stringify(i)}function ni(e){let{name:n,columnStatus:t,onPrimaryKeyChange:r,onPinnedColumnsChange:a,...d}=e,c=d.primaryKeys||[],u=d.pinnedColumns||[],h=c.includes(n),x=u.includes(n);return"index"===n?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(o.k,{alignItems:"center",gap:"10px",className:"grid-header",children:[(0,i.jsx)(l.x,{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:n}),"added"!==t&&"removed"!==t&&r&&(0,i.jsx)(s.J,{className:h?"close-icon":"key-icon",display:h?"block":"none",cursor:"pointer",as:h?e7.ven:e7.MhP,onClick:h?()=>{let e=c.filter(e=>e!==n);r&&r(e)}:()=>{let e=[...c.filter(e=>"index"!==e),n];r&&r(e)}}),!h&&a&&(0,i.jsx)(s.J,{className:x?"unpin-icon":"pin-icon",display:x?"block":"none",cursor:"pointer",as:x?e7.$kI:e7.oJP,onClick:x?()=>{let e=u.filter(e=>e!==n);a&&a(e)}:()=>{let e=[...u,n];a&&a(e)}})]})}let nl=e=>{let n;let t=!1;return"boolean"==typeof e?n=e.toString():""===e?(n="(empty)",t=!0):null==e?(n="(null)",t=!0):n=e,[n,t]},nr=e=>{let{row:n,column:t}=e;if(!n.hasOwnProperty(t.key))return(0,i.jsx)(el.x,{style:{color:"gray"},children:"-"});let[l,r]=nl(n[t.key]);return(0,i.jsx)(el.x,{style:{color:r?"gray":"inherit"},children:l})};function ns(e,n,t){let l=e||{columns:[],data:[]},r=n||{columns:[],data:[]},s=(null==t?void 0:t.primaryKeys)||[],o=(null==t?void 0:t.pinnedColumns)||[],a=(null==t?void 0:t.changedOnly)||!1,d=[],c=function(e,n){let t={};return Object.entries(ne(e.columns.map(e=>e.name),n.columns.map(e=>e.name))).map(i=>{let[l,r]=i;t[l]={status:r,baseColumnIndex:e.columns.findIndex(e=>e.name===l),currentColumnIndex:n.columns.findIndex(e=>e.name===l)}}),t}(l,r),u={},h={},x=!1,m=!1;if(0===s.length)l.data.forEach((e,n)=>{e._index=n+1,u[JSON.stringify({_index:n+1})]=e}),r.data.forEach((e,n)=>{e._index=n+1,h[JSON.stringify({_index:n+1})]=e});else{let e=nn(l.columns,s);l.data.forEach((n,t)=>{let i=nt(l.columns,e,n);i in u&&(x=!0),u[i]=n}),e=nn(r.columns,s),r.data.forEach((n,t)=>{let i=nt(r.columns,e,n);i in h&&(m=!0),h[i]=n})}let p=ne(Object.keys(u),Object.keys(h)),f={added:0,removed:0,modified:0},g=Object.entries(p).map(e=>{let[n,t]=e,i=u[n],o=h[n],a=JSON.parse(n);if(i&&l.columns.forEach((e,n)=>{s.includes(e.name)||(a["base__".concat(e.name)]=i[n])}),o&&r.columns.forEach((e,n)=>{s.includes(e.name)||(a["current__".concat(e.name)]=o[n])}),i){if(o){for(let[e,n]of Object.entries(c))"index"===e||s.includes(e)||n.baseColumnIndex<0||n.currentColumnIndex<0||eN().isEqual(i[n.baseColumnIndex],o[n.currentColumnIndex])||(a.__status="modified",n.status="modified");"modified"===a.__status&&f.modified++}else a.__status="removed",f.removed++}else a.__status="added",f.added++;return a});a&&(g=g.filter(e=>"added"===e.__status||"removed"===e.__status||"modified"===e.__status));let v=(e,n)=>{let l="added"===n?"diff-header-added":"removed"===n?"diff-header-removed":void 0,r=t=>{let i=t.__status;if("removed"===i)return"diff-cell-removed";if("added"===i)return"diff-cell-added";if("added"===n);else if("removed"===n);else if(!eN().isEqual(t["base__".concat(e)],t["current__".concat(e)]))return"diff-cell-modified"};return{headerCellClass:l,name:(0,i.jsx)(ni,{name:e,columnStatus:n,...t}),children:[{key:"base__".concat(e),name:"Base",renderEditCell:e3.Ug,headerCellClass:l,cellClass:r,renderCell:nr,size:"auto"},{key:"current__".concat(e),name:"Current",renderEditCell:e3.Ug,headerCellClass:l,cellClass:r,renderCell:nr,size:"auto"}]}};return 0===s.length?d.push({key:"_index",width:50,maxWidth:100,name:"",cellClass:"index-column"}):s.forEach(e=>{let n=c[e].status||"";d.push({key:"".concat(e),name:(0,i.jsx)(ni,{name:e,columnStatus:n,...t}),frozen:!0,cellClass:e=>{if(e.__status)return"diff-header-".concat(e.__status)},renderCell:nr})}),o.forEach(e=>{let n=c[e].status||"";"index"===e||s.includes(e)||d.push(v(e,n))}),Object.entries(c).forEach(e=>{let[n,t]=e,i=t.status||"";"index"===n||s.includes(n)||o.includes(n)||a&&f.modified>0&&"added"!==i&&"removed"!==i&&"modified"!==i||d.push(v(n,i))}),{columns:d,rows:g,invalidPKeyBase:x,invalidPKeyCurrent:m}}let no=(0,eK.G)((e,n)=>{var t;let{run:l,viewOptions:r,onViewOptionsChanged:s}=e,o=l.result;l.params;let a=(0,j.useMemo)(()=>(null==r?void 0:r.pinned_columns)||[],[r]),d=((null==o?void 0:null===(t=o.current)||void 0===t?void 0:t.columns)||[]).find(e=>"column_name"===e.name.toLowerCase()),c=(null==d?void 0:d.name)||"column_name",u=(0,j.useMemo)(()=>ns(null==o?void 0:o.base,null==o?void 0:o.current,{primaryKeys:[c],pinnedColumns:a,onPinnedColumnsChange:e=>{s&&s({...r,pinned_columns:e})}}),[o,c,a,r,s]);return 0===u.columns.length?(0,i.jsx)(e6.M,{height:"100%",children:"No data"}):(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(e9,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:u.columns,rows:u.rows,defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})})});function na(e){let{name:n,columnStatus:t,onPrimaryKeyChange:r,onPinnedColumnsChange:a,...d}=e,c=d.primaryKeys||[],u=d.pinnedColumns||[],h=c.includes(n),x=u.includes(n);return"index"===n?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(o.k,{alignItems:"center",gap:"10px",className:"grid-header",children:[(0,i.jsx)(l.x,{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:n}),!h&&a&&(0,i.jsx)(s.J,{className:x?"unpin-icon":"pin-icon",display:x?"block":"none",cursor:"pointer",as:x?e7.$kI:e7.oJP,onClick:x?()=>{let e=u.filter(e=>e!==n);a&&a(e)}:()=>{let e=[...u,n];a&&a(e)}})]})}function nd(e,n,t){let l=(null==t?void 0:t.pinnedColumns)||[],r=(null==t?void 0:t.changedOnly)||!1,s=[],o=function(e){let n={};return e.columns.map((e,t)=>{n[e.name]={index:t}}),n}(e),a={},d={};if(0===n.length)throw Error("Primary keys are required");let c=function(e,n){let t=[];for(let i of n){let n=e.findIndex(e=>e.name===i);if(n<0)throw Error("Column ".concat(i," not found"));t.push(n)}return t}(e.columns,n),u=(o.in_a||o.IN_A).index,h=(o.in_b||o.IN_B).index;e.data.forEach((n,t)=>{let i=function(e,n,t){let i={};if(0===n.length)return JSON.stringify({_index:t._index});for(let l of n)i[e[l].name]=t[l];return JSON.stringify(i)}(e.columns,c,n);n[u]&&(a[i]=n),n[h]&&(d[i]=n)});let x=ne(Object.keys(a),Object.keys(d)),m={added:0,removed:0,modified:0},p=Object.entries(x).map(t=>{let[i,l]=t,r=a[i],s=d[i],c=JSON.parse(i);if(r&&e.columns.forEach((e,t)=>{n.includes(e.name)||(c["base__".concat(e.name)]=r[t])}),s&&e.columns.forEach((e,t)=>{n.includes(e.name)||(c["current__".concat(e.name)]=s[t])}),r){if(s)for(let[e,t]of Object.entries(o))!("index"===e||n.includes(e))&&(eN().isEqual(r[t.index],s[t.index])||(c.__status="modified",t.status="modified"));else c.__status="removed",m.removed++}else c.__status="added",m.added++;return"modified"===c.__status&&m.modified++,c});r&&(p=p.filter(e=>"added"===e.__status||"removed"===e.__status||"modified"===e.__status));let f=(e,n)=>{let l="added"===n?"diff-header-added":"removed"===n?"diff-header-removed":void 0,r=t=>{let i=t.__status;if("removed"===i)return"diff-cell-removed";if("added"===i)return"diff-cell-added";if("added"===n);else if("removed"===n);else if(!eN().isEqual(t["base__".concat(e)],t["current__".concat(e)]))return"diff-cell-modified"};return{headerCellClass:l,name:(0,i.jsx)(na,{name:e,columnStatus:n,...t}),children:[{key:"base__".concat(e),name:"Base",renderEditCell:e3.Ug,headerCellClass:l,cellClass:r,renderCell:nr,size:"auto"},{key:"current__".concat(e),name:"Current",renderEditCell:e3.Ug,headerCellClass:l,cellClass:r,renderCell:nr,size:"auto"}]}};return n.forEach(e=>{let n=o[e].status||"";s.push({key:"".concat(e),name:(0,i.jsx)(na,{name:e,columnStatus:n,...t}),frozen:!0,cellClass:e=>{if(e.__status)return"diff-header-".concat(e.__status)},renderCell:nr})}),l.forEach(e=>{let t=o[e].status||"";n.includes(e)||s.push(f(e,t))}),Object.entries(o).forEach(e=>{let[t,i]=e,o=i.status||"";"in_a"===t||"in_b"===t||n.includes(t)||l.includes(t)||r&&m.modified>0&&"added"!==o&&"removed"!==o&&"modified"!==o||s.push(f(t,o))}),{columns:s,rows:p}}var nc=t(80906),nu=t(89494),nh=t(13329);let nx=e=>{let{run:n,warnings:t,viewOptions:r,onAddToChecklist:s,onViewOptionsChanged:a}=e;return(0,i.jsxs)(o.k,{borderBottom:"1px solid lightgray",justifyContent:"flex-end",gap:"5px",alignItems:"center",px:"10px",bg:t&&t.length>0?"orange.100":"inherit",children:[(0,i.jsx)(nu.g,{alignItems:"flex-start",spacing:0,children:t&&t.map((e,n)=>(0,i.jsxs)(l.x,{children:[(0,i.jsx)(nc.a,{color:"orange.600"})," ",e]},n))}),(0,i.jsx)(h.L,{minHeight:"32px"}),(0,i.jsx)(nh.X,{isChecked:null==r?void 0:r.changed_only,onChange:()=>{let e=!(null==r?void 0:r.changed_only);a&&a({...r,changed_only:e})},children:"Changed only"}),s&&(0,i.jsx)(es.z,{marginBlock:"5px",size:"sm",colorScheme:"blue",onClick:()=>s(n),children:"Add to Checklist"})]})},nm=(e,n)=>{var t,l,r,s,a,d;let{run:c,onAddToChecklist:u,viewOptions:h,onViewOptionsChanged:x}=e,m=(0,j.useMemo)(()=>(null==h?void 0:h.primary_keys)||[],[h]),p=(0,j.useMemo)(()=>(null==h?void 0:h.changed_only)||!1,[h]),f=(0,j.useMemo)(()=>(null==h?void 0:h.pinned_columns)||[],[h]),g=(0,j.useMemo)(()=>{var e,n;return ns(null==c?void 0:null===(e=c.result)||void 0===e?void 0:e.base,null==c?void 0:null===(n=c.result)||void 0===n?void 0:n.current,{changedOnly:p,primaryKeys:m,onPrimaryKeyChange:e=>{x&&x({...h,primary_keys:e})},pinnedColumns:f,onPinnedColumnsChange:e=>{x&&x({...h,pinned_columns:e})}})},[c,h,p,m,f,x]),v=(0,j.useMemo)(()=>{let e=m.join(", ");return g.invalidPKeyBase&&g.invalidPKeyCurrent?"Warning: The primary key '".concat(e,"' is not unique in the base and current environments"):g.invalidPKeyBase?"Warning: The primary key '".concat(e,"' is not unique in the base environment"):g.invalidPKeyCurrent?"Warning: The primary key '".concat(e,"' is not unique in the current environment"):void 0},[g.invalidPKeyBase,g.invalidPKeyCurrent,m]),y=(null===(l=c.result)||void 0===l?void 0:null===(t=l.current)||void 0===t?void 0:t.limit)||0,b=y>0&&((null==c?void 0:null===(s=c.result)||void 0===s?void 0:null===(r=s.current)||void 0===r?void 0:r.more)||(null==c?void 0:null===(d=c.result)||void 0===d?void 0:null===(a=d.base)||void 0===a?void 0:a.more))?"Warning: Displayed results are limited to ".concat(y.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,w=[];return(v&&w.push(v),b&&w.push(b),0===g.columns.length)?(0,i.jsx)(e6.M,{height:"100%",children:"No data"}):p&&0===g.rows.length?(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nx,{run:c,viewOptions:h,onAddToChecklist:u,onViewOptionsChanged:x,warnings:w}),(0,i.jsx)(e6.M,{height:"100%",children:"No change"}),";"]}):(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nx,{run:c,viewOptions:h,onAddToChecklist:u,onViewOptionsChanged:x,warnings:w}),(0,i.jsx)(e9,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:g.columns,rows:g.rows,renderers:{noRowsFallback:(0,i.jsx)(e8,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})},np=(e,n)=>{var t,l,r,s;let{run:a,onAddToChecklist:d,viewOptions:c,onViewOptionsChanged:u}=e,h=(0,j.useMemo)(()=>(null==c?void 0:c.changed_only)||!1,[c]),x=(0,j.useMemo)(()=>(null==c?void 0:c.pinned_columns)||[],[c]),m=(0,j.useMemo)(()=>{var e,n;if(!(null===(e=a.result)||void 0===e?void 0:e.diff)||!(null==a?void 0:null===(n=a.params)||void 0===n?void 0:n.primary_keys))return{columns:[],rows:[]};let t=a.params.primary_keys;return nd(null==a?void 0:a.result.diff,t,{changedOnly:h,pinnedColumns:x,onPinnedColumnsChange:e=>{u&&u({...c,pinned_columns:e})}})},[a,c,h,x,u]),p=(null===(l=a.result)||void 0===l?void 0:null===(t=l.diff)||void 0===t?void 0:t.limit)||0,f=p>0&&(null==a?void 0:null===(s=a.result)||void 0===s?void 0:null===(r=s.diff)||void 0===r?void 0:r.more)?"Warning: Displayed results are limited to ".concat(p.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,g=[];return(f&&g.push(f),0===m.columns.length)?(0,i.jsx)(e6.M,{height:"100%",children:"No data"}):h&&0===m.rows.length?(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nx,{run:a,viewOptions:c,onAddToChecklist:d,onViewOptionsChanged:u,warnings:g}),(0,i.jsx)(e6.M,{height:"100%",children:"No change"})]}):(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nx,{run:a,viewOptions:c,onAddToChecklist:d,onViewOptionsChanged:u,warnings:g}),(0,i.jsx)(e9,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:m.columns,rows:m.rows,renderers:{noRowsFallback:(0,i.jsx)(e8,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})},nf=(0,eK.G)((e,n)=>{var t;if((null===(t=e.run)||void 0===t?void 0:t.result)!==void 0&&null!==e.run.result.diff&&void 0!==e.run.result.diff){let t=(0,eK.G)(np);return(0,i.jsx)(t,{...e,ref:n})}{let t=(0,eK.G)(nm);return(0,i.jsx)(t,{...e,ref:n})}});function ng(e){let{name:n,pinnedColumns:t=[],onPinnedColumnsChange:r=()=>{}}=e,a=t.includes(n);return(0,i.jsxs)(o.k,{className:"grid-header",alignItems:"center",children:[(0,i.jsx)(l.x,{flex:1,children:n}),(0,i.jsx)(s.J,{className:a?"unpin-icon":"pin-icon",display:a?"block":"none",cursor:"pointer",as:a?e7.$kI:e7.oJP,onClick:a?()=>{r(t.filter(e=>e!==n))}:()=>{r([...t,n])}})]})}let nv=(0,eK.G)((e,n)=>{let{run:t,viewOptions:r,onViewOptionsChanged:s,onAddToChecklist:a}=e,d=(0,j.useMemo)(()=>(null==r?void 0:r.pinned_columns)||[],[r]),c=null==t?void 0:t.result,u=(0,j.useMemo)(()=>c?function(e,n){let t=[],l=n.pinnedColumns||[],r=(e,t)=>({key:String(e),name:(0,i.jsx)(ng,{name:t,...n}),width:"auto",renderCell:nr});return t.push({key:"_index",name:"",width:50,cellClass:"index-column"}),l.forEach(n=>{let i=eN().findIndex(e.columns,e=>e.name===n);i<0||t.push(r(i,n))}),e.columns.forEach((e,n)=>{l.includes(e.name)||t.push(r(n,e.name))}),e.data.forEach((e,n)=>{e._index=n+1}),{columns:t,rows:e.data}}(c,{pinnedColumns:d,onPinnedColumnsChange:e=>{s&&s({...r,pinned_columns:e})}}):{rows:[],columns:[]},[c,d,r,s]);if(0===u.columns.length)return(0,i.jsx)(e6.M,{height:"100%",children:"No data"});let x=(null==c?void 0:c.limit)||0,m=x>0&&(null==c?void 0:c.more)?"Warning: Displayed results are limited to ".concat(x.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,p=a||m;return(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[p&&(0,i.jsxs)(o.k,{borderBottom:"1px solid lightgray",alignItems:"center",gap:"5px",px:"10px",bg:m?"orange.100":"inherit",children:[m&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nc.a,{color:"orange.600",alignSelf:"center"})," ",(0,i.jsx)(l.x,{children:m})]}),(0,i.jsx)(h.L,{minHeight:"32px"}),a&&(0,i.jsx)(es.z,{marginBlock:"5px",size:"sm",colorScheme:"blue",onClick:()=>a(t),children:"Add to Checklist"})]}),(0,i.jsx)(e9,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:u.columns,rows:u.rows,renderers:{noRowsFallback:(0,i.jsx)(e8,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})});function nj(e,n){if(e=.1?t.toFixed(1):" <0.1 ","%")}if(!(e>n))return"0 %";{let t=(e-n)/e*100;return"-".concat(t>=.1?t.toFixed(1):" <0.1 ","%")}}var ny=t(22442),nb=t.n(ny);let nw=(0,eK.G)(function(e,n){let{run:t}=e;function l(e){if(e.base===e.current);else if(e.basee.current||"N/A"===e.current)return"column-body-removed";return"column-body-normal"}let r=t.result||{},s=Object.keys(t.result||{}).map(e=>{let n=r[e],t=nb()(null==n?void 0:n.base)?null==n?void 0:n.base:null,i=nb()(null==n?void 0:n.curr)?null==n?void 0:n.curr:null,l="=";return null!==t&&null!==i?l=t!==i?nj(t,i):"=":t===i?l="N/A":null===t?l="Added":null===i&&(l="Removed"),{name:e,base:null===t?"N/A":Number(t),current:null===i?"N/A":Number(i),delta:l}});return 0===s.length?(0,i.jsx)(e6.M,{bg:"rgb(249,249,249)",height:"100%",children:"No nodes matched"}):(0,i.jsx)(o.k,{direction:"column",children:Object.keys(r).length>0&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(e9,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:[{key:"name",name:"Name",cellClass:l},{key:"base",name:"Base Rows",cellClass:l},{key:"current",name:"Current Rows",cellClass:l},{key:"delta",name:"Delta",cellClass:l}],rows:s,renderers:{noRowsFallback:(0,i.jsx)(e8,{})},className:"rdg-light",enableScreenshot:!0})})})});var nk=t(62019),nC=t(429);let n_="#63B3ED";function nS(e,n){let t=n?10:e.counts.length,i=e.counts.slice(0,t),l=e.valids-i.reduce((e,n)=>e+n,0);return e.values.slice(0,t).concat([l]).map((n,t)=>{let r;let s=t===i.length,o=s?l:i[t],a=!1;return s?(r="(others)",a=!0):null==n?(r="(null)",a=!0):"string"==typeof n&&0===n.length?(r="(empty)",a=!0):r=String(n),{isLastItemOthers:s,isSpecialLabel:a,label:r,count:o,displayCount:eZ(o),displayRatio:eU(o/e.valids)||"N/A"}})}function nz(e){let{base:n,current:t,children:r}=e;return(0,i.jsx)(nk.u,{label:(0,i.jsxs)(l.x,{children:[(0,i.jsxs)(el.x,{children:[(0,i.jsx)(e$,{color:eQ}),"Current: ",t.count," (",t.displayRatio,")"]}),(0,i.jsxs)(el.x,{children:[(0,i.jsx)(e$,{color:eX}),"Base: ",n.count," (",n.displayRatio,")"]})]}),placement:"auto",hasArrow:!0,children:r})}function nR(e){let{topKDiff:n,isDisplayTopTen:t}=e,r=nS(n.current,t),s=nS(n.base,t);return(0,i.jsxs)(l.x,{w:"100%",px:20,py:4,children:[(0,i.jsxs)(o.k,{alignItems:"center",direction:"row",children:[(0,i.jsx)(h.L,{}),(0,i.jsxs)(el.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(e$,{color:eX})," Base"]}),(0,i.jsxs)(el.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(e$,{color:eQ})," Current"]}),(0,i.jsx)(h.L,{})]}),r.map((e,t)=>{let l=s[t];return e.isLastItemOthers&&0===e.count&&0===l.count?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(j.Fragment,{children:[(0,i.jsx)(nz,{base:l,current:e,children:(0,i.jsxs)(o.k,{alignItems:"center",width:"100%",_hover:{bg:"blackAlpha.300"},px:4,children:[(0,i.jsx)(el.x,{noOfLines:1,width:"10em",fontSize:"sm",color:e.isSpecialLabel?"gray.400":"inherit",children:e.label}),(0,i.jsxs)(o.k,{width:"70%",direction:"column",children:[(0,i.jsxs)(o.k,{height:"1em",children:[(0,i.jsx)(nE,{topkCount:e.count,topkLabel:e.label,valids:n.current.valids,color:eQ}),(0,i.jsx)(el.x,{ml:5,mr:2,fontSize:"sm",width:"6em",children:e.displayCount}),(0,i.jsx)(el.x,{color:"gray.400",fontSize:"sm",width:"4em",children:e.displayRatio})]}),(0,i.jsxs)(o.k,{height:"1em",children:[(0,i.jsx)(nE,{topkCount:l.count,topkLabel:l.label,valids:n.base.valids,color:eX}),(0,i.jsx)(el.x,{ml:5,mr:2,fontSize:"sm",width:"6em",children:l.displayCount}),(0,i.jsx)(el.x,{color:"gray.400",fontSize:"sm",width:"4em",children:l.displayRatio})]})]})]})}),(0,i.jsx)(nC.i,{})]},t)})]})}function nE(e){let{topkCount:n,topkLabel:t,valids:l,animation:r=!1,color:s=n_}=e;eB.kL.register(eB.uw,eB.ZL,eB.f$);let o=function(e,n){let{...t}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return{responsive:!0,maintainAspectRatio:!1,indexAxis:"y",scales:{x:{display:!1,max:n,grid:{display:!1}},y:{display:!1}},plugins:{tooltip:{enabled:!1}},...t}}(n,l,{animation:r}),a=function(e){let{topkLabel:n,topkCount:t,color:i=n_}=e;return{labels:[n],datasets:[{indexAxis:"y",data:[t],backgroundColor:i,hoverBackgroundColor:i,borderWidth:0,borderColor:i,barPercentage:1,categoryPercentage:.6}]}}({topkCount:n,topkLabel:t,color:s});return(0,i.jsx)(eJ.$Q,{data:a,options:o,plugins:[]})}let nT=(0,eK.G)((e,n)=>{let{run:t}=e,[l,s]=(0,j.useState)(!0),a=t.result,c=t.params,x=a.base,m=a.current;return(0,i.jsxs)(o.k,{direction:"column",height:"100%",children:[(0,i.jsxs)(e2,{ref:n,blockSize:"auto",children:[(0,i.jsxs)(d.X,{as:"h1",size:"md",paddingTop:4,textAlign:"center",color:"gray.600",children:["Model ",c.model,".",c.column_name]}),(0,i.jsxs)(u.U,{children:[(0,i.jsx)(h.L,{}),(0,i.jsx)(nR,{topKDiff:a,valids:m.valids||0,isDisplayTopTen:l}),(0,i.jsx)(h.L,{})]})]}),(0,i.jsx)(h.L,{}),(x.values.length>10||m.values.length>10)&&(0,i.jsx)(o.k,{p:5,justify:"start",children:(0,i.jsx)(r.r,{onClick:()=>s(e=>!e),textColor:"blue.500",children:l?"View More Items":"View Only Top-10"})})]})}),nD=(0,eK.G)((e,n)=>{var t,l;let{run:r,onAddToChecklist:s,viewOptions:a,onViewOptionsChanged:d}=e,c=(0,j.useMemo)(()=>(null==a?void 0:a.changed_only)||!1,[a]),u=(0,j.useMemo)(()=>(null==a?void 0:a.pinned_columns)||[],[a]),h=(0,j.useMemo)(()=>{var e;if(!r.result||!(null==r?void 0:null===(e=r.params)||void 0===e?void 0:e.primary_key))return{columns:[],rows:[]};let n=r.params.primary_key,t=Array.isArray(n)?n:[n];return nd(null==r?void 0:r.result,t,{changedOnly:c,pinnedColumns:u,onPinnedColumnsChange:e=>{d&&d({...a,pinned_columns:e})}})},[r,a,c,u,d]),x=(null===(t=r.result)||void 0===t?void 0:t.limit)||0,m=x>0&&(null==r?void 0:null===(l=r.result)||void 0===l?void 0:l.more)?"Warning: Displayed results are limited to ".concat(x.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,p=[];return(m&&p.push(m),0===h.columns.length)?(0,i.jsx)(e6.M,{height:"100%",children:"No data"}):c&&0===h.rows.length?(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nx,{run:r,viewOptions:a,onAddToChecklist:s,onViewOptionsChanged:d,warnings:p}),(0,i.jsx)(e6.M,{height:"100%",children:"No change"}),";"]}):(0,i.jsxs)(o.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nx,{run:r,viewOptions:a,onAddToChecklist:s,onViewOptionsChanged:d,warnings:p}),(0,i.jsx)(e9,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:h.columns,rows:h.rows,renderers:{noRowsFallback:(0,i.jsx)(e8,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})});var nL=t(95021),nI=t(62347);function nO(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:r}=e,[s,o]=(0,j.useState)(!n.columns||0===n.columns.length),a=null==n?void 0:n.model,d=null==n?void 0:n.primary_key,{columns:c,primaryKey:u,isLoading:h,error:x}=eH(n.model);(0,j.useEffect)(()=>{!d&&u&&t({...n,primary_key:u})},[d,u,n,t]),(0,j.useEffect)(()=>{r(!!d&&!!a)},[d,a,r]);let m=c.map(e=>e.name),p=Array.isArray(d)?d:d?[d]:void 0;return h?(0,i.jsx)(l.x,{children:"Loading..."}):0===m.length||x?(0,i.jsx)(l.x,{children:"Error: Please provide the 'catalog.json' to list column candidates"}):(0,i.jsxs)(nu.g,{gap:5,m:"8px 24px",paddingBottom:"200px",children:[(0,i.jsxs)(eM.NI,{children:[(0,i.jsx)(eA.l,{children:"Model"}),(0,i.jsx)(nL.I,{isReadOnly:!0,value:null==n?void 0:n.model})]}),(0,i.jsxs)(eM.NI,{children:[(0,i.jsx)(eA.l,{children:"Primary key"}),(0,i.jsx)(nI.Ph,{placeholder:"Select primary key",isMulti:!0,closeMenuOnSelect:!1,options:(m||[]).map(e=>({label:e,value:e})),value:(p||[]).map(e=>({label:e,value:e})),onChange:e=>{t({...n,primary_key:1==e.length?e[0].value:e.map(e=>e.value)})}})]}),(0,i.jsxs)(eM.NI,{children:[(0,i.jsx)(eA.l,{children:"Columns"}),(0,i.jsx)(nh.X,{marginBottom:"10px",isChecked:s,onChange:e=>{o(e.target.checked),t({...n,columns:void 0})},children:"All columns"}),!s&&(0,i.jsx)(nI.Ph,{isMulti:!0,closeMenuOnSelect:!1,options:(m||[]).map(e=>({label:e,value:e})),value:(n.columns||[]).map(e=>({label:e,value:e})),onChange:e=>{t({...n,columns:(e||[]).map(e=>e.value)})}})]})]})}var nM=t(13994),nA=t(54627),nF=t(53254),nq=t(66791),nN=t(57334),nV=t(15405);function nH(e){let{params:n,column:t}=e,{runAction:r}=nX(),a=(e,t)=>{r("value_diff_detail",{...n,...e},t)};return(0,i.jsxs)(o.k,{children:[(0,i.jsx)(l.x,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t}),(0,i.jsx)(h.L,{}),(0,i.jsx)(nM.v,{isLazy:!0,children:e=>{let{isOpen:n}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nA.j,{className:"row-context-menu",visibility:n?"visible":"hidden",width:n?"auto":"0px",minWidth:n?"auto":"0px",as:nF.h,icon:(0,i.jsx)(s.J,{as:e7.D_A}),variant:"unstyled",size:"sm"}),(0,i.jsx)(nq.q,{lineHeight:"20px",children:(0,i.jsxs)(nN.k,{title:"Action",as:l.x,fontSize:"8pt",children:[(0,i.jsx)(nV.s,{fontSize:"10pt",onClick:()=>a({},{showForm:!0}),children:"Show mismatched values..."}),(0,i.jsxs)(nV.s,{fontSize:"10pt",onClick:()=>a({columns:[t]},{showForm:!1}),children:["Show mismatched values for '",t,"'"]})]})})]})}})]})}let nP=(0,eK.G)(function(e,n){let{run:t}=e,r=t.result,a=t.params,d=e=>{let n=e[2];return null!=n&&n<1?"diff-cell-modified":""},c=Array.isArray(a.primary_key)?a.primary_key:[a.primary_key],u=[{key:"__is_pk__",name:"",width:30,maxWidth:30,renderCell:e=>{let{row:n}=e;return(0,i.jsx)(e6.M,{height:"100%",children:c.includes(n[0])&&(0,i.jsx)(s.J,{as:e7.MhP})})}},{key:"0",name:"Column",resizable:!0,renderCell:e=>{let{row:n,column:t}=e;return(0,i.jsx)(nH,{column:n[t.key],params:a})},cellClass:"cell-show-context-menu"},{key:"1",name:"Matched",resizable:!0,cellClass:d},{key:"2",name:"Matched %",resizable:!0,renderCell:e=>{let{column:n,row:t}=e,r=t[n.key];return(0,i.jsx)(l.x,{textAlign:"end",children:void 0!=r&&null!==r?"".concat((100*r).toFixed(2)," %"):"N/A"})},cellClass:d}];return(0,i.jsxs)(o.k,{direction:"column",gap:"5px",pt:"5px",height:"100%",children:[(0,i.jsxs)(l.x,{px:"16px",children:["Model: ",a.model,", ",r.summary.total," total (",r.summary.total-r.summary.added-r.summary.removed," ","common, ",r.summary.added," added, ",r.summary.removed," removed)"]}),(0,i.jsx)(e9,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",borderBlock:"1px solid lightgray"},columns:u,rows:r.data.data,renderers:{noRowsFallback:(0,i.jsx)(e8,{})},defaultColumnOptions:{resizable:!0},className:"rdg-light",enableScreenshot:!0})]})});var nW=t(46970),nK=t(7600);let nB={lineage_diff:{title:"Lineage Diff",icon:eO.Ks7},schema_diff:{title:"Schema Diff",icon:nK.C8A},query:{title:"Query",icon:eO.r2i,RunResultView:nv},query_base:{title:"Query Base",icon:eO.r2i,RunResultView:nv},query_diff:{title:"Query Diff",icon:eO.r2i,RunResultView:nf},row_count_diff:{title:"Row Count Diff",icon:nK.QUK,RunResultView:nw},profile_diff:{title:"Profile Diff",icon:eO.KA6,RunResultView:no},value_diff:{title:"Value Diff",icon:eO.pRi,RunResultView:nP,RunForm:nO},value_diff_detail:{title:"Value Diff Detail",icon:eO.pRi,RunResultView:nD,RunForm:nO},top_k_diff:{title:"Top-K Diff",icon:nW.Pkc,RunResultView:nT,RunForm:function(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:r}=e,{columns:s,isLoading:o,error:a}=eH(n.model),d=s.map(e=>e.name);return((0,j.useEffect)(()=>{r(!!n.column_name)},[n,r]),o)?(0,i.jsx)(l.x,{children:"Loading..."}):0===d.length||a?(0,i.jsx)(l.x,{children:"Error: Please provide the 'catalog.json' to list column candidates"}):(0,i.jsx)(l.x,{m:"16px",children:(0,i.jsxs)(eM.NI,{children:[(0,i.jsx)(eA.l,{children:"Pick a column to show top-k"}),(0,i.jsx)(eF.P,{placeholder:"Select column",value:null==n?void 0:n.column_name,onChange:e=>{let i=e.target.value;t({...n,column_name:i})},children:d.map(e=>(0,i.jsx)("option",{value:e,children:e},e))})]})})}},histogram_diff:{title:"Histogram Diff",icon:eO.dku,RunResultView:e4,RunForm:function(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:r}=e,{columns:s,isLoading:o,error:a}=eH(n.model),d=s.filter(e=>!eP(e.type)&&!eW(e.type));return o?(0,i.jsx)(l.x,{children:"Loading..."}):0===s.length||a?(0,i.jsx)(l.x,{children:"Error: Please provide the 'catalog.json' to list column candidates"}):(0,i.jsx)(l.x,{m:"16px",children:(0,i.jsxs)(eM.NI,{children:[(0,i.jsx)(eA.l,{children:"Pick a column to show Histogram Diff"}),(0,i.jsx)(eF.P,{placeholder:0!==d.length?"Select column":"No numeric column is available",isDisabled:0===d.length,value:null==n?void 0:n.column_name,onChange:e=>{var i;let l=e.target.value;r(!!l);let s=(null===(i=d.find(e=>e.name===l))||void 0===i?void 0:i.type)||"";t({...n,column_name:l,column_type:s})},children:d.map(e=>(0,i.jsxs)("option",{value:e.name,children:[e.name," : ",e.type]},e.name))})]})})}},preview_change:{title:"Preview Change",icon:eO.iQd,RunResultView:nf}},nJ=e=>nB[e],nU=(0,j.createContext)({runAction:()=>{},showRunId:e=>{},isRunResultOpen:!1,closeRunResult:()=>{},isHistoryOpen:!1,closeHistory:()=>{},showHistory:()=>{},clearRunResult:()=>{}}),nZ=e=>{let[n]=(0,eI.TH)();(0,j.useEffect)(()=>{e()},[e,n])};function nQ(e){var n;let{children:t}=e,[l,r]=(0,j.useState)(),{isOpen:s,onOpen:o,onClose:a}=(0,Y.q)(),{isOpen:d,onOpen:c,onClose:u}=(0,Y.q)(),{isOpen:h,onOpen:x,onClose:m}=(0,Y.q)(),p=(0,G.p)(),[f,g]=(0,j.useState)(),[v,y]=(0,eI.TH)(),w=(0,b.NL)(),k=(0,j.useCallback)((e,n)=>{g(e),c(),!1!==n&&w.invalidateQueries({queryKey:P.runs()})},[g,c,w]),C=(0,j.useCallback)(()=>{g(void 0),u()},[u,g]),_=(0,j.useCallback)(async(e,n,t)=>{try{let i;let l=new Date().getTime().toString();if(null==t?void 0:t.showLast){let t=await ex(e,n,1);1===t.length&&(i=t[0])}let s=nJ(e);if(void 0===s)throw Error("Unknown run type: ".concat(e));let{title:a,RunResultView:d,RunForm:c}=s;if(void 0===d)throw Error("Run type ".concat(e," does not have a result view"));if(void 0!==c&&(null==t?void 0:t.showForm))r({session:l,title:a,type:e,params:n,lastRun:i,options:t,RunForm:c}),o();else{let{run_id:t}=await ed(e,n,{nowait:!0});k(t),w.invalidateQueries({queryKey:P.runs()}),v.startsWith("/lineage")&&y("/lineage")}}catch(e){p({title:"Failed to submit a run",description:null==e?void 0:e.message,position:"bottom-right",status:"error",duration:5e3,isClosable:!0})}},[r,o,k,p,v,y,w]);nZ(a);let S=async(e,n)=>{try{a();let{run_id:t}=await ed(e,n,{nowait:!0});k(t)}catch(e){p({title:"Failed to submit a run",description:null==e?void 0:e.message,position:"bottom-right",status:"error",duration:5e3,isClosable:!0})}};return(0,j.useEffect)(()=>{f&&v.startsWith("/checks")&&y("/lineage")},[f]),(0,i.jsxs)(nU.Provider,{value:{runAction:_,runId:f,showRunId:k,isRunResultOpen:d,closeRunResult:u,isHistoryOpen:h,closeHistory:m,showHistory:x,clearRunResult:C},children:[l&&(0,i.jsx)(eL,{isOpen:s,onClose:a,onExecute:S,title:l.title,type:l.type,params:l.params,initialRun:l.lastRun,RunForm:(null===(n=l.options)||void 0===n?void 0:n.showForm)&&l.RunForm?l.RunForm:void 0},l.session),t]})}let nX=()=>(0,j.useContext)(nU);function nG(e){let{children:n}=e;return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(C,{children:(0,i.jsx)(eR,{children:(0,i.jsx)(z,{children:(0,i.jsx)(nQ,{children:n})})})})})}async function nY(){return(await U.post("/api/checks",{type:"simple"})).data}async function n$(e,n){return(await U.post("/api/checks",{run_id:e,view_options:n})).data}async function n0(){return(await U.get("/api/checks")).data}async function n1(e){return(await U.get("/api/checks/".concat(e))).data}async function n5(e,n){return(await U.patch("/api/checks/".concat(e),n)).data}async function n2(e){return(await U.delete("/api/checks/".concat(e))).data}async function n4(e){return await U.post("/api/checks/reorder",e)}var n6=t(6706),n3=t(96288),n9=t(38597),n8=t(63770),n7=t(15893),te=t(46919),tn=t(40451),tt=t(52878),ti=t(91425),tl=t(21567),tr=t(19612),ts=t(14968),to=t(81417),ta=t(89633),td=t(14257);function tc(e){let{name:n,setName:t}=e,[r,s]=(0,j.useState)(!1),[o,a]=(0,j.useState)(n),d=(0,j.useRef)(null),c=(0,j.useCallback)(()=>{t(o),s(!1)},[t,s,o]);return(0,j.useEffect)(()=>{let e=e=>{d.current&&!d.current.contains(e.target)&&c()};return r&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[r,d,c]),(0,i.jsxs)(to.a,{flex:"0 1 auto",fontSize:"12pt",fontWeight:"500",separator:(0,i.jsx)(td.X,{color:"gray.500"}),overflow:"hidden",children:[(0,i.jsx)(ta.g,{children:(0,i.jsx)(l.x,{children:"Checklist"})}),(0,i.jsx)(ta.g,{cursor:"pointer",flex:"0 1 auto",overflow:"hidden",children:r?(0,i.jsx)(nL.I,{ref:d,value:o,onChange:e=>{a(e.target.value)},onKeyDown:e=>{"Enter"===e.key?(t(o),s(!1)):"Escape"===e.key&&(a(n),s(!1))},size:"sm",w:"100%"}):(0,i.jsx)(l.x,{flex:"0 1 auto",onClick:()=>{a(n),s(!0)},textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:n})})]})}var tu=t(50674);t(50394);var th=t(20125);function tx(e){let{model:n,name:t,baseType:r,currentType:a}=e,{runAction:d}=nX(),c=a||r,u=()=>{d("histogram_diff",{model:n,column_name:t,column_type:c},{showForm:!1})},x=()=>{d("top_k_diff",{model:n,column_name:t,k:50},{showForm:!1})},m=!r||!a;return(0,i.jsxs)(o.k,{children:[(0,i.jsx)(l.x,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t}),(0,i.jsx)(h.L,{}),(0,i.jsx)(nM.v,{children:e=>{let{isOpen:n}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nA.j,{className:"row-context-menu",visibility:n?"visible":"hidden",width:n?"auto":"0px",minWidth:n?"auto":"0px",as:nF.h,icon:(0,i.jsx)(s.J,{as:e7.D_A}),variant:"unstyled",size:"sm"}),(0,i.jsx)(th.h,{children:(0,i.jsx)(nq.q,{lineHeight:"20px",children:(0,i.jsxs)(nN.k,{title:"Diff",m:"0",p:"4px 12px",children:[(0,i.jsx)(nV.s,{fontSize:"10pt",onClick:u,isDisabled:m||!c||!(!eP(c)&&!eW(c)),children:"Histogram Diff"}),(0,i.jsx)(nV.s,{fontSize:"10pt",onClick:x,isDisabled:m,children:"Top-k Diff"})]})})})]})}})]})}function tm(e,n){function t(e){return void 0===e.baseIndex?"column-index-added":void 0===e.currentIndex?"column-index-removed":!0===e.reordered?"column-index-reordered":"column-index-normal"}function l(e){return void 0===e.baseIndex?"column-body-added":void 0===e.currentIndex?"column-body-removed":e.baseType!==e.currentType?"column-body-type-changed":!0===e.reordered?"column-body-reordered":"column-body-normal"}return{columns:[{key:"baseIndex",name:"",resizable:!0,minWidth:35,width:35,cellClass:t},{key:"currentIndex",name:"",resizable:!0,minWidth:35,width:35,cellClass:t},{key:"name",name:"Name",resizable:!0,renderCell:e=>{let{row:t,column:l}=e;return n?(0,i.jsx)(tx,{model:n,name:t.name,baseType:t.baseType,currentType:t.currentType}):t.name},cellClass:function(e){return void 0===e.baseIndex?"column-body-added":void 0===e.currentIndex?"column-body-removed":!0===e.reordered?"column-body-reordered":"column-body-normal"}},{key:"baseType",name:"Base Type",resizable:!0,cellClass:l},{key:"currentType",name:"Current Type",resizable:!0,cellClass:l}],rows:Object.values(e)}}var tp=t(57765),tf=t(27322);let tg=(0,j.forwardRef)(function(e,n){let t,l,{base:r,current:s,enableScreenshot:a=!1}=e,{columns:d,rows:c}=(0,j.useMemo)(()=>{let e=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t={};return Object.entries(ne(Object.keys(e),Object.keys(n))).forEach(e=>{let[n,i]=e;t[n]={name:n,reordered:"reordered"===i}}),Object.entries(e).map((e,n)=>{let[i,l]=e;t[i].baseIndex=n+1,t[i].baseType=l.type}),Object.entries(n).map((e,n)=>{let[i,l]=e;t[i].currentIndex=n+1,t[i].currentType=l.type}),t}(null==r?void 0:r.columns,null==s?void 0:s.columns),n=(null==s?void 0:s.resource_type)||(null==r?void 0:r.resource_type);return n&&["model","seed","snapshot"].includes(n)?tm(e,(null==s?void 0:s.name)||(null==r?void 0:r.name)):tm(e)},[r,s]),{lineageGraph:u}=eE(),h=!(null==u?void 0:u.catalogMetadata.base),x=!(null==u?void 0:u.catalogMetadata.current);h&&x?t="catalog.json is missing on both current and base environments.":h?t="catalog.json is missing on base environment.":x&&(t="catalog.json is missing on current environment.");let m=r&&void 0===r.columns,p=s&&void 0===s.columns;return m&&p?l="Schema information is missing on both current and base environments.":m?l="Schema information is missing on base environment.":p&&(l="Schema information is missing on current environment."),(0,i.jsxs)(o.k,{direction:"column",children:[t?(0,i.jsxs)(tp.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(tf.z,{}),t]}):l?(0,i.jsxs)(tp.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(tf.z,{}),l]}):(0,i.jsx)(i.Fragment,{}),c.length>0&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(e9,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:d,rows:c,renderers:{noRowsFallback:(0,i.jsx)(e8,{})},className:"rdg-light",enableScreenshot:a,ref:n})})]})});async function tv(e){return(await U.post("/api/select",e)).data}var tj=t(3072);t(5637);let ty=e=>{let{style:n,children:t,gutterSize:l=5,...r}=e;return(0,i.jsx)(tj.Z,{style:{display:"flex",flexDirection:"row",...n},direction:"horizontal",gutterSize:l,...r,children:t})},tb=e=>{let{style:n,children:t,gutterSize:l=5,...r}=e;return(0,i.jsx)(tj.Z,{style:{display:"flex",flexDirection:"column",...n},gutterSize:l,direction:"vertical",...r,children:t})};var tw=t(34135),tk=t(55726),tC=t(98640);let t_=e7.Nbv,tS=e7.sFB,tz=e7.UGs;function tR(e){return"added"===e?{color:"#1dce00",backgroundColor:"#e8fce5",icon:t_}:"removed"===e?{color:"#ff4444",backgroundColor:"#ffdbdb",icon:tS}:"modified"===e?{color:"#ffa502",backgroundColor:"#fff2dd",icon:tz}:{color:"inherit",backgroundColor:"white",icon:void 0}}function tE(e){if("model"===e)return{color:"#c0eafd",icon:tk.Fn3};if("metric"===e)return{color:"#ffe6ee",icon:tC._MV};if("source"===e)return{color:"#a6dda6",icon:tk.i1q};if("exposure"===e)return{color:"#ffe6ee",icon:tC.n8P};if("semantic_model"===e)return{color:"#fb8caf",icon:tC.R1C};if("seed"===e)return{color:"#a6dda6",icon:tk.tWi};if("snapshot"===e)return{color:"#a6dda6",icon:tk.Dmm};else return{color:"inherit",icon:void 0}}function tT(e,n){if(!e||!n)return;let t=Object.keys(e),i=Object.keys(n);if(t.length!==i.length)return!0;for(let e=0;e{let n,t,{node:r,selected:a,onSelect:d,schemaChanged:c}=e,{icon:u}=tE(r.resourceType),{base:h,current:x}=r.data;if(c){var m;n=null===(m=nJ("schema_diff"))||void 0===m?void 0:m.icon,t=tR("modified").color}else!h&&x?(n=tR("added").icon,t=tR("added").color):h&&!x&&(n=tR("removed").icon,t=tR("removed").color);return(0,i.jsxs)(o.k,{width:"100%",fontSize:"10pt",p:"5px 8px",cursor:"pointer",_hover:{bg:"gray.200"},bg:a?"gray.100":"inherit",onClick:()=>d(r.id),alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.J,{as:u}),(0,i.jsx)(l.x,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:r.name}),n&&t&&(0,i.jsx)(s.J,{as:n,color:t})]})},tL=(0,j.forwardRef)(function(e,n){let{check:t}=e,{lineageGraph:l}=eE(),r=t.params,s=[...P.check(t.check_id),"select"],{isLoading:o,error:a,refetch:d,data:c}=(0,y.a)({queryKey:s,queryFn:async()=>tv({select:null==r?void 0:r.select,exclude:null==r?void 0:r.exclude,packages:null==r?void 0:r.packages,view_mode:null==r?void 0:r.view_mode}),refetchOnMount:!0,enabled:!(null==r?void 0:r.node_id)}),[u,h]=(0,j.useMemo)(()=>{let e=[],n=[],t=[],i=[];if(null==r?void 0:r.node_id)for(let n of r.node_id instanceof Array?r.node_id:[r.node_id]){let t=null==l?void 0:l.nodes[n];t&&e.push(t)}else for(let n of(null==c?void 0:c.nodes)||[]){let t=null==l?void 0:l.nodes[n];t&&e.push(t)}let s=e.filter(e=>"model"===e.resourceType||"seed"===e.resourceType||"source"===e.resourceType||"snapshot"===e.resourceType);for(let e of s){var o,a;tT(null===(o=e.data.base)||void 0===o?void 0:o.columns,null===(a=e.data.current)||void 0===a?void 0:a.columns)?n.push(e.id):!e.data.base&&e.data.current?t.push(e.id):e.data.base&&!e.data.current&&i.push(e.id)}function d(e){return n.includes(e.id)?3:t.includes(e.id)?2:i.includes(e.id)?1:0}return s.sort((e,n)=>{let t=d(e),i=d(n);return t!==i?i-t:e.name.localeCompare(n.name)}),[s,n]},[null==r?void 0:r.node_id,null==c?void 0:c.nodes,l]),[x,m]=(0,j.useState)(0);if(o)return(0,i.jsx)(e6.M,{bg:"rgb(249,249,249)",height:"100%",children:"Loading..."});if(a)return(0,i.jsxs)(e6.M,{bg:"rgb(249,249,249)",height:"100%",children:["Error: ",null==a?void 0:a.message]});if(0==u.length)return(0,i.jsx)(e6.M,{bg:"rgb(249,249,249)",height:"100%",children:"No nodes matched"});if(x(0,i.jsx)(tD,{node:e,schemaChanged:h.includes(e.id),selected:n===x,onSelect:()=>{m(n)}},n))})]})}return(0,i.jsx)(i.Fragment,{})});var tI=t(29589);function tO(e){let{value:n,onChange:t}=e,[l,s]=(0,j.useState)(!1),[a,d]=(0,j.useState)(),c=(0,j.useRef)(null),u=()=>{t&&(t(a),s(!1))};return((0,j.useEffect)(()=>{if(l&&c.current){let e=c.current;e.focus(),e.setSelectionRange(e.value.length,e.value.length)}},[l]),l)?(0,i.jsxs)(o.k,{direction:"column",align:"flex-end",height:"100%",children:[(0,i.jsx)(tI.g,{value:a,onChange:e=>{d(e.target.value)},onKeyDown:e=>{"Escape"===e.key&&s(!1),(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),u())},ref:c,flex:1}),(0,i.jsxs)(o.k,{gap:"12px",alignItems:"flex-end",children:[(0,i.jsx)(r.r,{onClick:()=>{setTimeout(()=>{s(!1)},100)},colorScheme:"blue",children:"cancel"}),(0,i.jsx)(es.z,{mt:"8px",size:"sm",colorScheme:"blue",onClick:u,children:"Update"})]})]}):(0,i.jsx)(el.x,{height:"100%",overflow:"auto",fontSize:"11pt",onClick:()=>{d(n||""),s(!0)},whiteSpace:"pre-wrap",wordBreak:"break-word",color:n?"inherit":"lightgray",children:n||"Add description here"})}var tM=t(68306);function tA(){let e=(0,G.p)();return{successToast:function(n){e({description:n,status:"info",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})},failToast:function(n,t){e({title:n,description:"".concat(t),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}}}function tF(){let e=(0,n6._)(["\n **SQL**\n ```sql\n ","\n ```\n "],["\n **SQL**\n \\`\\`\\`sql\n ","\n \\`\\`\\`\n "]);return tF=function(){return e},e}function tq(e){return e.description?e.description:"_(no description)_"}var tN=t(21114),tV=t(52777);let tH=e=>{let{value:n,onChange:t,onRun:l,onRunBase:r,onRunDiff:a,label:d,options:c={},...u}=e;return(0,i.jsxs)(i.Fragment,{children:[(d||l||r)&&(0,i.jsxs)(o.k,{backgroundColor:"#EDF2F880",height:"40px",fontSize:"14px",align:"center",margin:"0",padding:"0px 16px",children:[(0,i.jsx)(el.x,{as:"b",children:d?d.toUpperCase():""}),(0,i.jsx)(h.L,{}),(l||r)&&(0,i.jsx)(es.z,{size:"sm",variant:"outline",onClick:l||r,backgroundColor:"white",leftIcon:(0,i.jsx)(s.J,{as:tC.gmG}),padding:"6px 12px",children:"Run Query"})]}),(0,i.jsx)(tV.ML,{language:"sql",theme:"vs",value:n,onChange:e=>{void 0!==e&&t&&t(e)},onMount:(e,n)=>{l&&e.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.Enter,l),r&&e.addCommand(n.KeyMod.Alt|n.KeyCode.Enter,r),a&&e.addCommand(n.KeyMod.CtrlCmd|n.KeyMod.Shift|n.KeyCode.Enter,a)},options:{tabSize:2,fontSize:16,lineNumbers:"on",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"indent",...c}})]})},tP=e=>{let{value:n,baseValue:t,onChange:l,onChangeBase:r,onRun:s,onRunBase:a,onRunDiff:d,options:c={},...u}=e;return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(o.k,{height:"100%",gap:0,children:[(0,i.jsx)(tN.K,{height:"100%",width:"50%",gap:0,borderRight:"1px",borderColor:"#D4DBE4",children:(0,i.jsx)(tH,{label:"Base",value:t||"",onChange:r,onRunBase:a,options:c,...u})}),(0,i.jsx)(tN.K,{height:"100%",width:"50%",gap:0,children:(0,i.jsx)(tH,{label:"Current",value:n,onChange:l,onRun:s,options:c,...u})})]})})};var tW=t(13601),tK=t(51418);let tB=(0,eK.G)((e,n)=>{var t,r,s,a;let{isRunning:d,isAborting:c,progress:u,error:h,run:x,onCancel:m,viewOptions:p,onViewOptionsChanged:f,RunResultView:g,children:v,onExecuteRun:j}=e,y=(null==h?void 0:null===(r=h.response)||void 0===r?void 0:null===(t=r.data)||void 0===t?void 0:t.detail)||(null==x?void 0:x.error);if(y)return(0,i.jsxs)(tp.b,{status:"error",children:[(0,i.jsx)(tf.z,{}),"Error: ",y]});if(void 0!==d?d:(null==x?void 0:x.status)==="running"){let e=(null==u?void 0:u.message)?null==u?void 0:u.message:(null==x?void 0:null===(s=x.progress)||void 0===s?void 0:s.message)?null==x?void 0:null===(a=x.progress)||void 0===a?void 0:a.message:"Loading...";return(0,i.jsx)(e6.M,{p:"16px",height:"100%",bg:"rgb(249,249,249)",children:(0,i.jsxs)(nu.g,{children:[(0,i.jsxs)(o.k,{alignItems:"center",children:[(null==u?void 0:u.percentage)===void 0||(null==u?void 0:u.percentage)===null?(0,i.jsx)(tW.D,{isIndeterminate:!0,size:"20px",mr:"8px"}):(0,i.jsx)(tW.D,{size:"20px",value:100*u.percentage,mr:"8px"}),c?(0,i.jsx)(i.Fragment,{children:"Aborting..."}):(0,i.jsx)(i.Fragment,{children:e})]}),!c&&(0,i.jsx)(es.z,{onClick:m,colorScheme:"blue",size:"sm",children:"Cancel"})]})})}if(!x)return(0,i.jsx)(e6.M,{bg:"rgb(249,249,249)",height:"100%",children:"Loading..."});if(v&&g)throw Error("RunView requires either a children or a RunResultView prop, but not both.");if(!v&&!g)throw Error("RunView requires at least one of children or RunResultView prop.");return(0,i.jsxs)(l.x,{h:"100%",style:{contain:"size layout"},overflow:"auto",children:[g&&(x.error||x.result)&&(0,i.jsx)(tK.SV,{children:(0,i.jsx)(g,{ref:n,run:x,viewOptions:p,onViewOptionsChanged:f})}),v&&v({run:x,viewOptions:p,onViewOptionsChanged:f})]})});var tJ=t(27066),tU=t(13587),tZ=t(9312),tQ=t(94945),tX=t(52811),tG=t(14033);t(94254),t(76890);var tY=t(47691),t$=t(34433),t0=t(73676),t1=t(84492);function t5(e){let{node:n}=e,{icon:t}=tE(n.resourceType);return(0,i.jsx)(nk.u,{hasArrow:!0,label:"Type of resource",children:(0,i.jsxs)(n3.Vp,{children:[(0,i.jsx)(n3.AD,{as:t}),(0,i.jsx)(n3.Sn,{children:n.resourceType})]})})}function t2(e){let{rowCount:n}=e,t=n.base,l=n.curr,r=null===n.base?"N/A":"".concat(n.base," rows"),o=null===n.curr?"N/A":"".concat(n.curr," rows");return null===t&&null===l?(0,i.jsx)(i.Fragment,{children:" Failed to load"}):null===t||null===l?(0,i.jsxs)(u.U,{children:[(0,i.jsx)(el.x,{children:r}),(0,i.jsx)(s.J,{as:t0.Rgz}),(0,i.jsx)(el.x,{children:o})]}):t===l?(0,i.jsxs)(u.U,{children:[(0,i.jsx)(el.x,{children:o}),(0,i.jsx)(s.J,{as:t1.lxc,color:"gray.500"}),(0,i.jsx)(el.x,{color:"gray.500",children:"No Change"})]}):t ").concat(n," rows")}return(0,i.jsx)(nk.u,{label:r,children:(0,i.jsxs)(n3.Vp,{children:[(0,i.jsx)(n3.AD,{as:x}),(0,i.jsx)(n3.Sn,{children:m||d?(0,i.jsx)(t$.N,{isLoaded:!d,noOfLines:1,skeletonHeight:2,minWidth:"30px",children:m?(0,i.jsx)(t2,{rowCount:m}):"row count"}):(0,i.jsx)(i.Fragment,{children:"row count"})}),a&&(0,i.jsx)(n3.bq,{as:nF.h,isLoading:d,"aria-label":"Query Row Count",icon:(0,i.jsx)(ti.n,{}),size:"xs",onClick:a})]})})}let t6=e=>{let{node:n,action:t}=e,{status:r,skipReason:s,run:a}=t;if("pending"===r)return(0,i.jsx)(tW.D,{size:"20px",value:0});if("skipped"===r)return(0,i.jsx)(n3.Vp,{backgroundColor:"gray.100",children:(0,i.jsxs)(o.k,{fontSize:"10pt",color:"gray.500",alignItems:"center",gap:"3px",children:[(0,i.jsx)(l.x,{children:"Skipped"}),s&&(0,i.jsx)(nk.u,{label:s,children:(0,i.jsx)(tY.s,{})})]})});if(!a)return(0,i.jsx)(tW.D,{isIndeterminate:!0,size:"20px"});let{error:d,result:c,run_id:u,progress:h}=a;if("running"===r)return(null==h?void 0:h.percentage)===void 0?(0,i.jsx)(tW.D,{isIndeterminate:!0,size:"20px"}):(0,i.jsx)(tW.D,{size:"20px",value:(null==h?void 0:h.percentage)*100});if(d)return(0,i.jsxs)(o.k,{fontSize:"10pt",color:"gray",children:[(0,i.jsx)(l.x,{children:"Error"}),s&&(0,i.jsx)(nk.u,{label:d,children:(0,i.jsx)(nc.a,{})})]});if("value_diff"===a.type){let e=0;for(let n of c.data.data)n[2]<1&&e++;return(0,i.jsx)(n3.Vp,{backgroundColor:e>0?"red.100":"green.100",children:(0,i.jsx)(n3.Sn,{children:(0,i.jsx)(o.k,{fontSize:"10pt",color:e>0?"red":"green",alignItems:"center",gap:"3px",children:e>0?"".concat(e," columns mismatched"):"All columns match"})})})}if("row_count_diff"===a.type){let e=a.result;return(0,i.jsx)(t4,{rowCount:e[n.name],node:n})}return(0,i.jsx)(i.Fragment,{children:u})},t3=(0,j.createContext)(void 0),t9=()=>{let e=(0,j.useContext)(t3);if(!e)throw Error("useLineageViewContext must be used within a LineageViewProvider");return e};function t8(e){var n;let t,l,{rowCount:r}=e,s=r.base,o=r.curr,a=null===r.base?"N/A":"".concat(r.base," Rows"),d=null===r.curr?"N/A":"".concat(r.curr," Rows");return null===s&&null===o?(t="Failed to load",l="gray"):null===s||null===o?(t="".concat(a," -> ").concat(d),l=null===s?"green":"red"):s===o?(t="=",l="gray"):s!==o&&(t="".concat(nj(s,o)," Rows"),l=s{var n,t,r;let a,d,{id:c,inverted:u}=e,{lineageGraph:x,runsAggregated:m}=eE(),p=null==m?void 0:m[c],f=null==x?void 0:x.nodes[c];if(!p&&!f)return(0,i.jsx)(i.Fragment,{});if((null==f?void 0:f.data.base)&&(null==f?void 0:f.data.current)&&(a=tT(null===(t=f.data.base)||void 0===t?void 0:t.columns,null===(r=f.data.current)||void 0===r?void 0:r.columns)),p&&p.row_count_diff){let e=p.row_count_diff;d=e.result.curr!==e.result.base}let g=u?"white":tR("modified").color;return(0,i.jsxs)(o.k,{flex:"1",children:[void 0!==a&&(0,i.jsx)(nk.u,{label:"Schema (".concat(a?"changed":"no change",")"),openDelay:500,children:(0,i.jsx)(l.x,{height:"16px",children:(0,i.jsx)(s.J,{as:null===(n=nJ("schema_diff"))||void 0===n?void 0:n.icon,color:a?g:u?"gray":"lightgray"})})}),(0,i.jsx)(h.L,{}),p&&p.row_count_diff&&void 0!==d&&(0,i.jsx)(nk.u,{label:"Row count (".concat(d?"changed":"=",")"),openDelay:500,children:(0,i.jsx)(l.x,{children:(0,i.jsx)(t8,{rowCount:p.row_count_diff.result})})})]})},ie=e=>{let{checked:n,onClick:t}=e;return(0,i.jsx)(o.k,{onClick:t,alignSelf:"center",alignItems:"center",children:n?(0,i.jsx)(s.J,{boxSize:"20px",as:tk.xik}):(0,i.jsx)(s.J,{boxSize:"20px",as:tk.hGI})})};var it=t(70952),ii=t(44549),il=t(27739);function ir(e){let{base:n,current:t}=e;return(0,i.jsx)(tV.SV,{height:"100%",language:"sql",theme:"vs",original:null==n?void 0:n.raw_code,modified:null==t?void 0:t.raw_code,options:{readOnly:!0,fontSize:14,lineNumbers:"on",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"same"}})}function is(e){let{current:n,onChange:t}=e,r=function(e,n){let t=(0,j.useRef)(null);return(0,j.useEffect)(()=>{t.current&&e!==t.current.getValue()&&t.current.setValue(e)},[e]),{onMount(e){let i=e.getModifiedEditor();t.current=i,i.onDidChangeModelContent(()=>{n(i.getValue())})}}}((null==n?void 0:n.raw_code)||"",t);return(0,i.jsx)(l.x,{flex:1,overflowY:"auto",children:(0,i.jsx)(tV.SV,{language:"sql",theme:"vs",original:null==n?void 0:n.raw_code,modified:null==n?void 0:n.raw_code,options:{readOnly:!1,fontSize:14,lineNumbers:"on",automaticLayout:!0,wordWrap:"on",wrappingIndent:"same",renderOverviewRuler:!1,minimap:{enabled:!0}},onMount:r.onMount})})}async function io(e){return(await U.post("/api/checks",{type:"schema_diff",params:e})).data}let ia={audit_helper:"Require the dbt package 'dbt-labs/audit_helper'. Please install it and re-run dbt to activate this feature.",dbt_profiler:"Require the dbt package 'data-mie/dbt_profiler'. Please install it and re-run dbt to activate this feature.",add_or_remove:"Unavailable for added or removed resources."},id=e=>{var n;let[t,i]=(0,j.useState)(!1),[l,r]=(0,j.useState)(!1),[,s]=eT(),{error:o,data:a}=(0,y.a)({queryKey:P.run(e||""),queryFn:async()=>ec(e||"",t?2:0),enabled:!!e,refetchInterval:!!t&&50,retry:!1});(0,j.useEffect)(()=>{(o||(null==a?void 0:a.result)||(null==a?void 0:a.error))&&(t&&i(!1),(null==a?void 0:a.type)==="row_count_diff"&&s()),(null==a?void 0:a.status)==="running"&&i(!0)},[a,o,t,s]);let d=(0,j.useCallback)(async()=>{if(r(!0),e)return await eu(e)},[e,r]),c=(null==a?void 0:a.type)?null===(n=nJ(a.type))||void 0===n?void 0:n.RunResultView:void 0;return{run:a,isRunning:t,aborting:l,error:o,onCancel:d,RunResultView:c}};var ic=t(30671),iu=t(33686),ih=t(32717),ix=t.n(ih),im=t(21467),ip=t(93779),ig=t(30745),iv=t.n(ig);let ij="ignore-screenshot";function iy(e){let{renderLibrary:n="html2canvas",imageType:t="png",backgroundColor:l=null,boardEffect:r=!0,shadowEffect:s=!1,borderStyle:d="solid 1px #ccc",borderRadius:c="10px",onSuccess:u,onError:h,ignoreElements:x}=e,[m,p]=(0,j.useState)("idle"),f=(0,j.useRef)(null),{onOpen:g,setImgBlob:v,ImageDownloadModal:y}=function(){let{isOpen:e,onOpen:n,onClose:t}=(0,Y.q)(),[l,r]=(0,j.useState)();return{onOpen:n,setImgBlob:r,ImageDownloadModal:function(){let[n,r]=(0,j.useState)();return(0,j.useEffect)(()=>{if(!l)return;let e=new FileReader;e.readAsDataURL(l),e.onloadend=e=>{var n,t;(null===(n=e.target)||void 0===n?void 0:n.result)&&(null===(t=e.target)||void 0===t?void 0:t.result)!==null&&r(e.target.result)}},[r]),(0,i.jsxs)($.u_,{size:"3xl",isOpen:e,onClose:t,children:[(0,i.jsx)(ee.Z,{}),(0,i.jsxs)(en.h,{children:[(0,i.jsx)(et.x,{children:"Screenshot Preview"}),(0,i.jsx)(eD.o,{}),(0,i.jsxs)(ei.f,{children:[(0,i.jsxs)(o.k,{px:"10px",gap:"10px",direction:"column",children:[(0,i.jsxs)(o.k,{alignItems:"center",gap:"5px",children:[(0,i.jsx)(tY.s,{color:"red.600"}),(0,i.jsx)(el.x,{fontWeight:"500",display:"inline",children:"Copy to the Clipboard"})," ","is not supported in the current browser"]}),(0,i.jsx)(el.x,{children:"Please download it directly"})]}),(0,i.jsx)(a.E,{src:n,alt:"screenshot"})]}),(0,i.jsxs)(er.m,{children:[(0,i.jsx)(es.z,{mr:3,onClick:t,children:"Close"}),(0,i.jsx)(es.z,{colorScheme:"blue",onClick:()=>{if(!l)return;let e=new Date,n="recce-screenshot-".concat((0,ip.WU)(e,"yyyy-MM-dd-HH-mm-ss"),".png");iv()(l,n),t()},children:"Download"})]})]})]})}}}(),b=async()=>{if(!f.current)throw console.error("No node to use for screenshot"),Error("No node to use for screenshot");let e=f.current.element||f.current,t=e.style.overflow,i=e.style.border,o=e.style.borderRadius,a=e.style.backgroundColor,u=e.style.height;try{var h;e.style.overflow="hidden",e.style.border=r?d:"",e.style.borderRadius=r?c:"",e.style.backgroundColor=l||"",e.style.height=e.offsetHeight+"px";let t=document.createElement("style");document.head.appendChild(t),null===(h=t.sheet)||void 0===h||h.insertRule("body > div:last-child img { display: inline-block; }"),p("loading");let i="html2canvas"===n?await ix()(e,{logging:!1,backgroundColor:null,ignoreElements:x}):await (0,im.rT)(e,{filter:x?e=>!x(e):void 0});t.remove();let o=s?document.createElement("canvas"):i;if(s){o.width=i.width+80,o.height=i.height+80;let e=o.getContext("2d");if(e)e.shadowColor="rgba(0, 0, 0, 0.5)",e.shadowBlur=20,e.shadowOffsetX=10,e.shadowOffsetY=10,e.drawImage(i,40,40);else throw console.error("Error getting canvas context"),Error("Error getting canvas context to add shadow effect")}let a=await fetch(o.toDataURL());return await a.blob()}catch(e){throw console.error("Error converting to image",e),e}finally{e.style.overflow=t,e.style.border=i,e.style.borderRadius=o,e.style.backgroundColor=a,e.style.height=u}};return{status:m,isLoading:"loading"===m,isErrored:"error"===m,isSuccess:"success"===m,copyToClipboard:async()=>{try{await navigator.clipboard.write([new ClipboardItem({["image/".concat(t)]:b()})]),p("success"),u&&u()}catch(e){"ClipboardItem is not defined"===e.message?(v(await b()),g(),p("success")):(p("error"),console.error("Error copying to clipboard",e),h&&h(e))}},ImageDownloadModal:y,ref:f}}function ib(e){let{successToast:n,failToast:t}=tA(),{isLoading:l,copyToClipboard:r,ImageDownloadModal:s,ref:o}=iy({imageType:"png",shadowEffect:!0,backgroundColor:(null==e?void 0:e.backgroundColor)||null,onSuccess:()=>{n("Copied the query result as an image to clipboard")},onError:e=>{console.error("Error taking screenshot",e),t("Failed to copy image to clipboard",e)}}),a=(0,j.useCallback)(()=>{if(o.current){let e=o.current.element||o.current;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]),d=(0,j.useCallback)(()=>{o.current&&((o.current.element||o.current).style.boxShadow="")},[o]),c=(0,j.useCallback)(async()=>{o.current?(await r(),(o.current.element||o.current).style.boxShadow=""):t("Failed to copy image to clipboard","No content to copy")},[o,r,t]);return{ref:o,CopyToClipboardButton:function(e){let{imageType:n="png",...t}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(es.z,{size:"sm",leftIcon:(0,i.jsx)(tn.T,{}),style:{position:"absolute",bottom:"16px",right:"16px"},isLoading:l,onMouseEnter:a,onMouseLeave:d,onClick:c,children:"Copy to Clipboard"}),(0,i.jsx)(s,{})]})},onMouseEnter:a,onMouseLeave:d,onCopyToClipboard:c}}let iw=e=>{let{run:n}=e,t=(null==n?void 0:n.status)==="running",l=null==n?void 0:n.status;!l&&(n.result?l="finished":n.error&&(l="failed"));let r="",s="";"successful"===l||"finished"===l?(r="green",s="Finished"):"failed"===l?(r="red",s="Failed"):"cancelled"===l?(r="gray",s="Cancelled"):"running"===l?(r="blue",s="Running"):(r="green",s="Finished");let a=(null==n?void 0:n.run_at)?function(e){let n=new Date,t=new Date;return(t.setDate(n.getDate()-1),null==e)?null:n.toDateString()===e.toDateString()?"Today, "+(0,ip.WU)(e,"HH:mm"):t.toDateString()===e.toDateString()?"Yesterday, "+(0,ip.WU)(e,"HH:mm"):(0,ip.WU)(e,"MMM d, HH:mm")}(new Date(n.run_at)):null;return(0,i.jsxs)(o.k,{justifyContent:"start",fontSize:"11pt",color:"gray.500",gap:"3px",alignItems:"center",overflow:"hidden",children:[t&&(0,i.jsx)(tU.$,{size:"xs",color:"".concat(r,".400")}),(0,i.jsx)(el.x,{fontWeight:500,color:"".concat(r,".400"),children:s}),(0,i.jsx)(el.x,{children:"•"}),(0,i.jsx)(el.x,{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",children:a})]})},ik=e=>{let n=ic.ZP.stringify(e,null,2);return(0,i.jsx)(tV.ML,{height:"100%",language:"yaml",theme:"vs",value:n,options:{readOnly:!0,fontSize:14,lineNumbers:"off",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"same",scrollBeyondLastLine:!1}})},iC=e=>{var n,t,l;let{runId:r,onClose:s,disableAddToChecklist:a}=e,{runAction:d}=nX(),{error:c,run:f,onCancel:g,isRunning:v}=id(r),[y,w]=(0,j.useState)(),k=(0,b.NL)(),[,C]=(0,eI.TH)(),[_,S]=(0,j.useState)(0),z=(null==f?void 0:f.type)?null===(n=nJ(f.type))||void 0===n?void 0:n.RunResultView:void 0,R=(0,j.useCallback)(()=>{d((null==f?void 0:f.type)||"",null==f?void 0:f.params)},[f,d]),E=null==f?void 0:f.check_id,T=(0,j.useCallback)(async()=>{E&&C("/checks/".concat(E))},[E,C]),D=(0,j.useCallback)(async()=>{if(!r)return;let e=await n$(r,y);k.invalidateQueries({queryKey:P.checks()}),C("/checks/".concat(e.check_id))},[r,C,k,y]),L=(null==f?void 0:f.type)==="query"||(null==f?void 0:f.type)==="query_diff"||(null==f?void 0:f.type)==="query_base",{ref:I,onCopyToClipboard:O,onMouseEnter:M,onMouseLeave:A}=ib();return(0,i.jsxs)(o.k,{direction:"column",children:[(0,i.jsx)(x.m,{tabIndex:_,onChange:S,flexDirection:"column",mb:"1px",children:(0,i.jsxs)(m.t,{height:"50px",children:[(0,i.jsx)(p.O,{children:"Result"}),(0,i.jsx)(p.O,{children:"Params"}),L&&(0,i.jsx)(p.O,{children:"Query"}),(0,i.jsx)(h.L,{}),(0,i.jsxs)(u.U,{overflow:"hidden",children:[f&&(0,i.jsx)(iw,{run:f}),(0,i.jsx)(es.z,{leftIcon:(0,i.jsx)(ti.n,{}),variant:"outline",isDisabled:!r||v,size:"sm",onClick:R,children:"Rerun"}),(0,i.jsx)(es.z,{leftIcon:(0,i.jsx)(tn.T,{}),variant:"outline",isDisabled:!r||!(null==f?void 0:f.result)||!!c||0!==_,onMouseEnter:M,onMouseLeave:A,size:"sm",onClick:O,children:"Copy to Clipboard"}),(0,i.jsx)(function(){return a?(0,i.jsx)(i.Fragment,{}):(null==f?void 0:f.check_id)?(0,i.jsx)(es.z,{leftIcon:(0,i.jsx)(iu.n,{}),isDisabled:!r||!(null==f?void 0:f.result)||!!c,size:"sm",colorScheme:"blue",onClick:T,children:"Go to Check"}):(0,i.jsx)(es.z,{leftIcon:(0,i.jsx)(iu.n,{}),isDisabled:!r||!(null==f?void 0:f.result)||!!c,size:"sm",colorScheme:"blue",onClick:D,children:"Add to Checklist"})},{}),(0,i.jsx)(il.P,{onClick:()=>{s&&s()}})]})]})}),0===_&&(0,i.jsx)(tB,{ref:I,error:c,run:f,onCancel:g,viewOptions:y,onViewOptionsChanged:w,RunResultView:z}),1===_&&f&&(0,i.jsx)(ik,{type:f.type,params:f.params}),2===_&&f&&((null===(t=f.params)||void 0===t?void 0:t.base_sql_template)?(0,i.jsx)(tP,{value:f.params.sql_template,baseValue:f.params.base_sql_template,options:{readOnly:!0}}):(0,i.jsx)(tH,{value:(null==f?void 0:null===(l=f.params)||void 0===l?void 0:l.sql_template)||"",options:{readOnly:!0}}))]})},i_=e=>{let{onClose:n,disableAddToChecklist:t}=e,{runId:l}=nX();return(0,i.jsx)(iC,{runId:l,onClose:n,disableAddToChecklist:t})};async function iS(e,n){return await ed("query",e,n)}async function iz(e,n){return await ed("query_base",e,n)}async function iR(e,n){return await ed("query_diff",e,n)}var iE=t(98834),iT=t(33517),iD=t(43800);let iL=e=>{var n;let{defaultValues:t,suggestionList:l,onValuesChange:r,isDisabled:o}=e,[a,d]=(0,j.useState)(t||[]),[c,u]=(0,j.useState)(""),[h,x]=(0,j.useState)(!1),m=(0,j.useRef)(null),p=e=>{a.includes(e)||(u(""),d([...a,e]),r([...a,e]))};return o?(0,i.jsx)(nk.u,{label:ia.audit_helper,children:(0,i.jsx)(nL.I,{size:"xs",disabled:!0,placeholder:"Unavailable"})}):(0,i.jsxs)(iE.B,{size:e.size,width:e.width,children:[(0,i.jsxs)(nM.v,{isLazy:!0,closeOnSelect:!1,onOpen:()=>{var e;return null==m?void 0:null===(e=m.current)||void 0===e?void 0:e.focus()},children:[(0,i.jsxs)(nA.j,{width:"100%",children:[(0,i.jsx)(nL.I,{placeholder:e.placeholder,size:e.size,borderRadius:"4px",value:a.length>1?"".concat(a.length," ").concat(e.unitName,"s selected"):1===a.length?"".concat(a[0]):"",onChange:()=>{},backgroundColor:"white"}),0===a.length&&(0,i.jsx)(iT.x,{children:(0,i.jsx)(s.J,{as:tC.RiI,color:"blue.500",fontSize:e.size,mt:"1",mr:"6"})})]}),(0,i.jsx)(th.h,{children:(0,i.jsxs)(nq.q,{zIndex:"popover",fontSize:e.size,width:e.width,children:[(0,i.jsx)(nN.k,{children:(0,i.jsxs)(iD.E,{border:"1px solid #e2e8f0",borderRadius:"4px",width:"calc(100% - 8px)",marginX:"4px",padding:"4px",children:[a.map((n,t)=>(0,i.jsx)(iD.U,{children:(0,i.jsxs)(n3.Vp,{size:e.size,children:[(0,i.jsx)(n3.Sn,{paddingLeft:"8px",children:n}),(0,i.jsx)(n3.SD,{paddingRight:"8px",onClick:()=>{d(a.filter(e=>e!==n)),r(a.filter(e=>e!==n))}})]},n)},"tag-".concat(t))),(0,i.jsx)(iD.U,{width:"100%",children:(0,i.jsx)(nL.I,{ref:m,placeholder:"Filter or add custom keys",variant:"unstyled",size:e.size,value:c,onChange:e=>{u(e.target.value),x(!0)},onKeyDown:e=>{let n=e.currentTarget.value.trim().replace(",","");switch(e.key){case",":case"Enter":p(n),u("");break;case"Backspace":""===e.currentTarget.value&&a.length>0&&(d(a.slice(0,-1)),r(a.slice(0,-1)))}},onBlur:()=>{var e;m&&h&&(null==m||null===(e=m.current)||void 0===e||e.focus())}})})]})}),(0,i.jsx)(n9.R,{}),(0,i.jsxs)(nN.k,{children:[""!==c&&!(null==l?void 0:l.includes(c))&&(0,i.jsxs)(nV.s,{onClick:()=>{p(c),x(!1)},children:["Add '",c,"' to the list"]},"custom-value-by-filter"),null==l?void 0:null===(n=l.filter(e=>""===c||e.includes(c)).filter(e=>!a.includes(e)))||void 0===n?void 0:n.map((e,n)=>(0,i.jsx)(nV.s,{onClick:()=>p(e),children:e},"option-".concat(n)))]})]})})]}),a.length>0&&(0,i.jsx)(iT.x,{children:(0,i.jsx)(es.z,{variant:"link",color:"#3182CE",fontSize:e.size,paddingTop:"4px",paddingRight:"24px",onClick:()=>{u(""),d([]),r([])},children:"Clear"})})]})},iI=e=>{let{defaultPrimaryKeys:n,onPrimaryKeysChange:t,...l}=e,{lineageGraph:r,isActionAvailable:s}=eE(),a=(0,j.useMemo)(()=>{if(!r)return[];let e=new Set;for(let i in r.nodes){var n,t;let l=r.nodes[i],s=null===(n=l.data.base)||void 0===n?void 0:n.columns,o=null===(t=l.data.current)||void 0===t?void 0:t.columns;for(let n in s)e.add(n);for(let n in o)e.add(n)}return Array.from(e).sort()},[r]);return(0,i.jsx)(o.k,{...l,children:(0,i.jsxs)(eM.NI,{m:"4px 8px",children:[(0,i.jsxs)(eA.l,{fontSize:"8pt",margin:"0",children:["Diff with Primary Key(s) (suggested)"," ",(0,i.jsx)(nk.u,{label:"Provide a primary key to perform query diff in data warehouse and only return changed rows.",placement:"bottom-end",children:(0,i.jsx)(tY.s,{color:"gray.600",boxSize:"3"})})]}),(0,i.jsx)(iL,{unitName:"key",defaultValues:n,suggestionList:a,onValuesChange:t,size:"xs",width:"240px",placeholder:"Select or type to add keys",isDisabled:!s("query_diff_with_primary_key")})]})})};var iO=t(58631),iM=t(26969);function iA(e){let{description:n,onLike:t,onDislike:l,onClickLink:s,externalLink:d,externalLinkText:c}=e;return(0,i.jsxs)(o.k,{gap:4,justifyContent:"center",alignContent:"center",alignItems:"center",children:[n,(0,i.jsx)(nF.h,{"aria-label":"thumbs up",variant:"ghost",icon:(0,i.jsx)(a.E,{src:"/imgs/feedback/thumbs-up.png",alt:"like"}),width:"32px",height:"32px",onClick:t}),(0,i.jsx)(nF.h,{"aria-label":"thumbs down",variant:"ghost",icon:(0,i.jsx)(a.E,{src:"/imgs/feedback/thumbs-down.png",alt:"dislike"}),width:"32px",height:"32px",onClick:l}),d&&c&&(0,i.jsx)(r.r,{href:d,isExternal:!0,textDecoration:"underline",onClick:s,children:c})]})}let iF="recce-",iq={bypassSaveOverwrite:"".concat(iF,"-bypass-save-overwrite"),previewChangeFeedbackID:"".concat(iF,"-preview-change-feedback"),prepareEnvGuideID:"".concat(iF,"-prepare-env")};function iN(e){let{current:n,primaryKeys:t,setPrimaryKeys:r,onRunResultOpen:a,runQuery:c,isPending:u}=e;return(0,i.jsxs)(o.k,{justifyContent:"right",alignItems:"center",padding:"4pt 8pt",gap:"5px",height:"54px",borderBottom:"1px solid lightgray",flex:"0 0 54px",children:[(0,i.jsxs)(l.x,{children:[(0,i.jsxs)(d.X,{as:"h2",size:"md",display:"flex",alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.J,{as:iO.vc4,boxSize:"1.2em"}),"Preview Changes"]}),(0,i.jsxs)(el.x,{fontSize:"xs",color:"gray.500",children:["Compare the run results based on the modified SQL code of model"," ",(0,i.jsx)("b",{children:null==n?void 0:n.name})]})]}),(0,i.jsx)(h.L,{}),(0,i.jsx)(iI,{defaultPrimaryKeys:t,onPrimaryKeysChange:r}),(0,i.jsx)(nk.u,{label:"Run diff to see the changes",children:(0,i.jsx)(es.z,{size:"xs",marginTop:"16px",fontSize:"14px",onClick:()=>{a(),c()},colorScheme:"blue",isLoading:u,children:"Run Diff"})})]})}function iV(e){let{height:n="32px",flex:t="0 0 auto"}=e,l="0 16px";return(0,i.jsxs)(o.k,{gap:0,height:n,flex:t,fontSize:"14px",align:"center",margin:"0",backgroundColor:"#EDF2F880",children:[(0,i.jsx)(tN.K,{width:"50%",children:(0,i.jsx)(el.x,{as:"b",margin:l,children:"BASE"})}),(0,i.jsx)(tN.K,{width:"50%",children:(0,i.jsx)(el.x,{as:"b",margin:l,children:"PREVIEW EDITOR (CURRENT)"})})]})}function iH(e){let{isOpen:n,onClose:t,current:s}=e,{isOpen:h,onClose:x,onOpen:m}=(0,Y.q)(),[p,f]=(0,j.useState)((null==s?void 0:s.raw_code)||""),{showRunId:g,clearRunResult:v}=nX(),{primaryKeys:y,setPrimaryKeys:b}=_(),{data:w,isLoading:k}=ej(),C=async()=>{let e={current_model:(null==s?void 0:s.name)||"",primary_keys:y,sql_template:p},{run_id:n}=await iR(e,{nowait:!0});return g(n),await ec(n)},{mutate:S,isPending:z}=(0,tu.D)({mutationFn:C,onSuccess(e,n){e.error?eC({action:"run",node:null==s?void 0:s.name,status:"failure"}):(eC({action:"run",node:null==s?void 0:s.name,status:"success"}),setTimeout(()=>R(),1e3),!k&&(null==w?void 0:w.single_env_onboarding)&&setTimeout(()=>T(),2e3))}}),{feedbackToast:R,closeToast:E}=function(e){let n=(0,G.p)(),{feedbackId:t,description:l,onFeedbackSubmit:r,externalLink:s,externalLinkText:o}=e;return{feedbackToast:function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=localStorage.getItem(t);n.isActive(t)||"true"===a&&!1===e||n({id:t,position:"bottom-right",duration:null,render:e=>{let{id:n,onClose:a}=e;return(0,i.jsx)(tp.b,{status:"success",variant:"subtle",zIndex:"toast",borderColor:"gray.200",borderWidth:3,borderRadius:"md",backgroundColor:"white",opacity:1,children:(0,i.jsx)(iM.X,{fontSize:"md",children:(0,i.jsxs)(u.U,{children:[(0,i.jsx)(iA,{description:l,onLike:()=>{r("like"),a(),localStorage.setItem(t,"true")},onDislike:()=>{r("dislike"),a(),localStorage.setItem(t,"true")},externalLink:s,externalLinkText:o,onClickLink:()=>{r("link")}}),(0,i.jsx)(il.P,{onClick:()=>{a()}})]})})})}})},closeToast:()=>n.closeAll()}}({feedbackId:iq.previewChangeFeedbackID,description:"Enjoy preview change?",onFeedbackSubmit:e=>{switch(e){case"like":e_({feedback:"like",node:null==s?void 0:s.name});break;case"dislike":e_({feedback:"dislike",node:null==s?void 0:s.name});break;case"link":e_({feedback:"form",node:null==s?void 0:s.name});break;default:console.log("Not support feedback type")}},externalLink:"https://docs.google.com/forms/d/e/1FAIpQLSd7Lei7Ijwo7MinWaI0K6rzZi_21gV1BKetmiNEX254kDziDA/viewform?usp=header",externalLinkText:"Give us feedback"}),{guideToast:T,closeGuideToast:D}=function(e){let n=(0,G.p)(),{guideId:t,description:l,externalLink:s,externalLinkText:o,onExternalLinkClick:a}=e;return{guideToast:function(){n.isActive(t)||n({id:t,position:"bottom-right",duration:3e3,description:"some text",render:e=>{let{id:n,onClose:t}=e;return(0,i.jsx)(tp.b,{status:"success",variant:"subtle",zIndex:"toast",borderColor:"gray.200",borderWidth:3,borderRadius:"md",backgroundColor:"white",opacity:1,children:(0,i.jsx)(iM.X,{fontSize:"md",children:(0,i.jsxs)(u.U,{children:[(0,i.jsxs)(el.x,{children:[l," ",(0,i.jsx)(r.r,{textDecor:"underline",isExternal:!0,href:s,onClick:()=>{a&&a(),t()},children:o})]}),(0,i.jsx)(il.P,{onClick:()=>{t()}})]})})})}})},closeGuideToast:()=>n.closeAll()}}({guideId:iq.prepareEnvGuideID,description:"Want to compare data changes with production data?",externalLink:"https://datarecce.io/docs/get-started/#prepare-dbt-artifacts",externalLinkText:"Learn how.",onExternalLinkClick:()=>eS({action:"external_link",from:"preview_changes",node:null==s?void 0:s.name})});return(0,j.useEffect)(()=>{n&&f((null==s?void 0:s.raw_code)||"")},[n,s]),(0,i.jsx)($.u_,{isOpen:n,size:"full",onClose:()=>{t(),x(),v(),E(),D(),eC({action:"close",node:null==s?void 0:s.name})},children:(0,i.jsxs)(en.h,{height:"100%",children:[(0,i.jsx)(et.x,{height:"40px",bg:"rgb(77, 209, 176)",px:0,py:4,children:(0,i.jsxs)(o.k,{alignItems:"center",height:"100%",gap:"10px",children:[(0,i.jsx)(a.E,{boxSize:"20px",ml:"18px",src:"/logo/recce-logo-white.png",alt:"recce-logo-white"}),(0,i.jsx)(d.X,{as:"h1",fontFamily:'"Montserrat", sans-serif',fontSize:"lg",color:"white",children:"RECCE"}),(0,i.jsx)(c.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:"Experiment"})]})}),(0,i.jsx)(eD.o,{}),(0,i.jsx)(ei.f,{p:0,children:(0,i.jsxs)(tb,{sizes:h?[50,50]:[100,0],minSize:h?100:0,gutterSize:h?5:0,style:{flex:"1",contain:"size",height:"100%"},children:[(0,i.jsxs)(o.k,{direction:"column",height:"100%",m:0,p:0,children:[(0,i.jsx)(iN,{current:s,primaryKeys:null!=y?y:[],setPrimaryKeys:b,onRunResultOpen:m,runQuery:S,isPending:z}),(0,i.jsx)(iV,{height:"32pxs",flex:"0 0 auto"}),(0,i.jsx)(is,{current:s,onChange:f})]}),h?(0,i.jsx)(i_,{onClose:x,disableAddToChecklist:!0}):(0,i.jsx)(l.x,{})]})}),(0,i.jsx)(l.x,{position:"fixed",bottom:"4",right:"4",opacity:.5,children:(0,i.jsx)(nk.u,{label:"Give us feedback",children:(0,i.jsx)(nF.h,{"aria-label":"feedback",icon:(0,i.jsx)(e7.xJq,{}),variant:"ghost",size:"md",onClick:()=>{R(!0)}})})})]})})}function iP(e){let{node:n,onCloseNode:t}=e,[,r]=(0,eI.TH)(),{setSqlQuery:a,setPrimaryKeys:c}=_(),f="model"===n.resourceType||"seed"===n.resourceType||"source"===n.resourceType||"snapshot"===n.resourceType,{isOpen:g,onOpen:v,onClose:y}=(0,Y.q)(),{isOpen:b,onOpen:w,onClose:k}=(0,Y.q)(),{runAction:C}=nX(),{envInfo:S,isActionAvailable:z}=eE(),{primaryKey:R}=eH(n.name),E=()=>{C("row_count_diff",{node_names:[n.name]},{showForm:!1,showLast:!1})},{data:T}=ej(),D=null==T?void 0:T.single_env_onboarding,L=(0,j.useCallback)(async()=>{let e=n.id,t=await io({node_id:e});r("/checks/".concat(t.check_id))},[n,r]),I=(e,n)=>e?ia.add_or_remove:z(n)?"":"value_diff"===n?ia.audit_helper:"profile_diff"===n?ia.dbt_profiler:"This action is not supported yet.",O="added"===n.changeStatus||"removed"===n.changeStatus;return(0,i.jsxs)(ii.r,{height:"100%",templateRows:"auto auto 1fr",children:[(0,i.jsxs)(u.U,{children:[(0,i.jsx)(l.x,{flex:"0 1 20%",p:"16px",children:(0,i.jsx)(d.X,{size:"sm",children:n.name})}),(0,i.jsx)(h.L,{}),D?(0,i.jsx)(function(){return(0,i.jsx)(es.z,{as:es.z,size:"sm",colorScheme:"blue",onClick:()=>{z("query_diff_with_primary_key")&&c(void 0!==R?[R]:void 0),w(),eS({action:"preview_changes",node:n.name})},children:"Preview Changes"})},{}):(0,i.jsx)(function(){var e,t,l,o,d,u,h,x;return"model"!==n.resourceType&&"seed"!==n.resourceType&&"snapshot"!==n.resourceType?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(nM.v,{children:[(0,i.jsx)(nA.j,{as:es.z,size:"sm",colorScheme:"blue",children:"Explore Change"}),(0,i.jsxs)(nq.q,{children:[(0,i.jsx)(nV.s,{icon:(0,i.jsx)(s.J,{as:null===(e=nJ("query_diff"))||void 0===e?void 0:e.icon}),fontSize:"14px",onClick:()=>{(null==S?void 0:S.adapterType)==="dbt"?a('select * from {{ ref("'.concat(n.name,'") }}')):(null==S?void 0:S.adapterType)==="sqlmesh"&&a("select * from ".concat(n.name)),z("query_diff_with_primary_key")&&c(void 0!==R?[R]:void 0),r("/query")},children:"Query"}),(0,i.jsx)(nV.s,{fontSize:"14px",icon:(0,i.jsx)(s.J,{as:null===(t=nJ("preview_change"))||void 0===t?void 0:t.icon}),onClick:()=>{z("query_diff_with_primary_key")&&c(void 0!==R?[R]:void 0),w(),eC({action:"explore",node:n.name})},children:"Preview Change (Experiment)"}),(0,i.jsx)(n9.R,{}),(0,i.jsxs)(nN.k,{title:"Diff",m:"0",p:"4px 12px",children:[("model"===n.resourceType||"snapshot"===n.resourceType)&&(0,i.jsx)(nV.s,{onClick:v,icon:(0,i.jsx)(tk.tvD,{}),fontSize:"14px",children:"Code Diff"}),(0,i.jsx)(nV.s,{icon:(0,i.jsx)(s.J,{as:null===(l=nJ("row_count_diff"))||void 0===l?void 0:l.icon}),fontSize:"14px",onClick:()=>E(),children:"Row Count Diff"}),(0,i.jsx)(nk.u,{label:I(O,"profile_diff"),placement:"left",children:(0,i.jsx)(nV.s,{icon:(0,i.jsx)(s.J,{as:null===(o=nJ("profile_diff"))||void 0===o?void 0:o.icon}),fontSize:"14px",isDisabled:O||!z("profile_diff"),onClick:()=>{C("profile_diff",{model:n.name},{showForm:!1,showLast:!1})},children:"Profile Diff"})}),(0,i.jsx)(nk.u,{label:I(O,"value_diff"),placement:"left",children:(0,i.jsx)(nV.s,{icon:(0,i.jsx)(s.J,{as:null===(d=nJ("value_diff"))||void 0===d?void 0:d.icon}),fontSize:"14px",isDisabled:O||!z("value_diff"),onClick:()=>{C("value_diff",{model:n.name},{showForm:!0,showLast:!1})},children:"Value Diff"})}),(0,i.jsx)(nk.u,{label:I(O,"top_k_diff"),placement:"left",children:(0,i.jsx)(nV.s,{icon:(0,i.jsx)(s.J,{as:null===(u=nJ("top_k_diff"))||void 0===u?void 0:u.icon}),fontSize:"14px",isDisabled:O,onClick:()=>{C("top_k_diff",{model:n.name,column_name:"",k:50},{showForm:!0})},children:"Top-K Diff"})}),(0,i.jsx)(nk.u,{label:I(O,"histogram_diff"),placement:"left",children:(0,i.jsx)(nV.s,{icon:(0,i.jsx)(s.J,{as:null===(h=nJ("histogram_diff"))||void 0===h?void 0:h.icon}),fontSize:"14px",isDisabled:O,onClick:()=>{C("histogram_diff",{model:n.name,column_name:"",column_type:""},{showForm:!0})},children:"Histogram Diff"})})]}),(0,i.jsx)(n9.R,{}),(0,i.jsx)(nN.k,{title:"Add to Checklist",m:"0",p:"4px 12px",children:(0,i.jsx)(nV.s,{icon:(0,i.jsx)(s.J,{as:null===(x=nJ("schema_diff"))||void 0===x?void 0:x.icon}),fontSize:"14px",onClick:L,children:"Schema Diff"})})]})]})},{}),(0,i.jsx)(l.x,{flex:"0 1 1%",children:(0,i.jsx)(il.P,{onClick:t})})]}),(0,i.jsx)(l.x,{color:"gray",paddingLeft:"16px",children:(0,i.jsxs)(u.U,{spacing:"8px",children:[(0,i.jsx)(t5,{node:n}),("model"===n.resourceType||"snapshot"===n.resourceType||"seed"===n.resourceType)&&(0,i.jsx)(t4,{node:n,onRefresh:E})]})}),f&&(0,i.jsxs)(x.m,{overflow:"auto",as:o.k,children:[(0,i.jsx)(m.t,{children:(0,i.jsx)(p.O,{children:"Columns"})}),(0,i.jsx)(n8.n,{overflow:"auto",height:"calc(100% - 42px)",children:(0,i.jsx)(n7.x,{p:0,overflowY:"auto",height:"100%",children:(0,i.jsx)(tg,{base:n.data.base,current:n.data.current})})})]}),(0,i.jsxs)($.u_,{isOpen:g,onClose:y,size:"6xl",children:[(0,i.jsx)(ee.Z,{}),(0,i.jsxs)(en.h,{overflowY:"auto",height:"75%",children:[(0,i.jsx)(et.x,{children:"Model Raw Code Diff"}),(0,i.jsx)(eD.o,{}),(0,i.jsx)(ei.f,{children:(0,i.jsx)(ir,{base:n.data.base,current:n.data.current})})]})]}),(0,i.jsx)(iH,{isOpen:b,onClose:k,current:n.data.current})]})}function iW(e){var n,t;let{onClose:r}=e,{cancel:s,actionState:o}=t9();return(0,i.jsx)(l.x,{bg:"white",rounded:"md",shadow:"dark-lg",children:(0,i.jsxs)(u.U,{p:"5px 15px",mt:"4",divider:(0,i.jsx)(tZ.c,{borderColor:"gray.200"}),spacing:4,children:[(0,i.jsxs)(l.x,{fontSize:"10pt",children:["Progress: ","per_node"===o.mode?"".concat(o.completed," / ").concat(o.total):(null===(t=o.currentRun)||void 0===t?void 0:null===(n=t.progress)||void 0===n?void 0:n.percentage)?"".concat(100*o.currentRun.progress.percentage,"%"):"completed"===o.status?"100%":"0%"," ","canceled"===o.status?" (canceled)":""]}),"running"===o.status||"canceling"===o.status?(0,i.jsx)(es.z,{size:"xs",variant:"outline",onClick:s,isLoading:"canceling"===o.status,loadingText:"Canceling",children:"Cancel"}):(0,i.jsx)(u.U,{children:(0,i.jsx)(es.z,{size:"xs",variant:"outline",onClick:r,children:"Close"})})]})})}var iK=t(36571),iB=t(53388),iJ=t(52346);let iU=()=>(0,i.jsxs)(nu.g,{align:"start",spacing:0,children:[(0,i.jsx)(el.x,{fontSize:"10pt",color:"gray.500",pb:1,children:"Select nodes by dbt node selector syntax"}),(0,i.jsxs)(el.x,{fontSize:"8pt",children:[(0,i.jsx)(iK.E,{fontSize:"8pt",children:"model_name"})," Select a node"]}),(0,i.jsxs)(el.x,{fontSize:"8pt",children:[(0,i.jsx)(iK.E,{fontSize:"8pt",children:"model_name+"})," Select downstream nodes"]}),(0,i.jsxs)(el.x,{fontSize:"8pt",children:[(0,i.jsx)(iK.E,{fontSize:"8pt",children:"+model_name"})," Select upstream nodes"]}),(0,i.jsxs)(el.x,{fontSize:"8pt",children:[(0,i.jsx)(iK.E,{fontSize:"8pt",children:"model*"})," Select by wildcard"]})]}),iZ=()=>{let{isHistoryOpen:e,showHistory:n,closeHistory:t}=nX();return(0,i.jsx)(es.z,{leftIcon:(0,i.jsx)(s.J,{as:e7.M1Q}),size:"xs",variant:"outline",onClick:()=>{e?(ek({name:"hide"}),t()):(ek({name:"show"}),n())},children:e?"Hide":"Show"})},iQ=e=>{let{isDisabled:n}=e,{viewOptions:t,onViewOptionsChanged:l,selectMode:r}=t9(),o=t.view_mode||"changed_models",a=e=>{l({...t,view_mode:e})};return(0,i.jsxs)(nM.v,{children:[(0,i.jsx)(nA.j,{as:es.z,minWidth:"100px",leftIcon:(0,i.jsx)(s.J,{as:tE("model").icon}),size:"xs",variant:"outline",isDisabled:n,children:"changed_models"===o?"Changed Models":"All"}),(0,i.jsxs)(nq.q,{title:"packages",children:[(0,i.jsx)(nV.s,{as:nh.X,size:"sm",isChecked:"changed_models"===o,onChange:()=>a("changed_models"),children:"Changed Models"}),(0,i.jsx)(nV.s,{as:nh.X,size:"sm",isChecked:"all"===o,onChange:()=>a("all"),children:"All"})]})]})},iX=e=>{var n,t;let{isDisabled:l}=e,{lineageGraph:r}=eE(),{viewOptions:o,onViewOptionsChanged:a}=t9(),d=new Set;for(let e of Object.values((null==r?void 0:r.nodes)||{}))e.packageName&&d.add(e.packageName);let c=null==r?void 0:null===(t=r.manifestMetadata)||void 0===t?void 0:null===(n=t.current)||void 0===n?void 0:n.project_name,u=o.packages?new Set(o.packages):c?new Set([c]):d,h=u.size===d.size,x=0===u.size,m=1===u.size?Array.from(u)[0]:h?"All Packages":x?"No Package":"".concat(u.size," Packages"),p=e=>{let n=new Set(u);n.has(e)?n.delete(e):n.add(e),a({...o,packages:Array.from(n)})};return(0,i.jsxs)(nM.v,{closeOnSelect:!1,children:[(0,i.jsx)(nA.j,{as:es.z,minWidth:"100px",leftIcon:(0,i.jsx)(s.J,{as:t0.zFh}),size:"xs",variant:"outline",isDisabled:l,children:m}),(0,i.jsx)(nq.q,{title:"packages",children:(0,i.jsxs)(nN.k,{title:"Select Packages",children:[(0,i.jsx)(nV.s,{as:nh.X,size:"sm",isIndeterminate:!h&&!x,isChecked:h,onChange:()=>{h?a({...o,packages:[]}):a({...o,packages:Array.from(d)})},children:"Select All"}),(0,i.jsx)(n9.R,{}),Array.from(d).map(e=>(0,i.jsx)(nV.s,{as:nh.X,size:"sm",isChecked:u.has(e),onChange:()=>{p(e)},children:e},e))]})})]})},iG=e=>{let[n,t]=(0,j.useState)(e.value),{data:l}=ej(),r=(0,j.useRef)(null);return(0,j.useEffect)(()=>{r.current&&(r.current.value=e.value)},[e.value]),(0,i.jsx)(nk.u,{width:"300px",padding:2,shadow:"md",borderWidth:1,rounded:"md",styleConfig:{zIndex:"dropdown"},label:e.tooltipComponent,placement:"bottom-start",defaultIsOpen:!0,color:"black",backgroundColor:"white",closeOnClick:!1,isDisabled:!(null==l?void 0:l.single_env_onboarding),children:(0,i.jsx)(nL.I,{ref:r,height:"24px",fontSize:"10pt",placeholder:"with selectors",isDisabled:e.isDisabled,value:n,onChange:e=>{t(e.target.value)},onKeyUp:i=>{"Enter"===i.key?e.onChange(n):"Escape"===i.key&&(i.preventDefault(),t(e.value),r.current&&r.current.blur())},onBlur:()=>t(e.value)})})},iY=e=>{let{isDisabled:n}=e,{viewOptions:t,onViewOptionsChanged:l}=t9();return(0,i.jsx)(iG,{isDisabled:n,value:t.select||"",onChange:e=>{l({...t,select:e||void 0})},tooltipComponent:(0,i.jsx)(iU,{})})},i$=e=>{let{isDisabled:n}=e,{viewOptions:t,onViewOptionsChanged:l}=t9();return(0,i.jsx)(iG,{isDisabled:n,value:t.exclude||"",onChange:e=>{l({...t,exclude:e||void 0})}})},i0=e=>(0,i.jsxs)(l.x,{style:e.style,maxWidth:"300px",children:[(0,i.jsx)(l.x,{fontSize:"8pt",children:(null==e?void 0:e.label)||(0,i.jsx)(i.Fragment,{children:"\xa0"})}),e.children]}),i1=()=>{var e,n,t,l;let{nodes:r,deselect:o,selectMode:a,...d}=t9(),{isActionAvailable:c}=eE(),x=(0,j.useMemo)(()=>r.filter(e=>e.data.isSelected),[r]),{data:m}=ej(),p=null==m?void 0:m.single_env_onboarding,f="single"===a&&1===x.length,g="multi"===a&&x.length>=1,v="single"===a&&0===x.length,y="single"!==a;return(0,i.jsx)(u.U,{width:"100%",padding:"4pt 8pt",children:(0,i.jsxs)(u.U,{flex:"1",children:[(0,i.jsx)(i0,{label:"History",style:{flexShrink:"1"},children:(0,i.jsx)(iZ,{})}),(0,i.jsx)(i0,{label:"Mode",style:{flexShrink:"1"},children:(0,i.jsx)(iQ,{isDisabled:y})}),(0,i.jsx)(i0,{label:"Package",style:{flexShrink:"1"},children:(0,i.jsx)(iX,{isDisabled:y})}),(0,i.jsx)(i0,{label:"Select",style:{flex:"100 1 auto"},children:(0,i.jsx)(iY,{isDisabled:y})}),(0,i.jsx)(i0,{label:"Exclude",style:{flex:"100 1 auto"},children:(0,i.jsx)(i$,{isDisabled:y})}),(0,i.jsx)(h.L,{}),"multi"===a&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(i0,{label:"",style:{flexShrink:"0"},children:(0,i.jsx)(el.x,{fontSize:"9pt",color:"gray.500",children:x.length>1?"".concat(x.length," nodes selected"):"".concat(x.length," node selected")})}),(0,i.jsx)(i0,{label:"",children:(0,i.jsx)(es.z,{variant:"outline",size:"xs",fontSize:"9pt",isDisabled:"multi"!==a,onClick:()=>{o()},children:"Deselect"})})]}),!p&&(0,i.jsx)(i0,{label:"Explore",children:(0,i.jsx)(iB.h,{isAttached:!0,variant:"outline",children:(0,i.jsxs)(nM.v,{placement:"bottom-end",children:[(0,i.jsx)(nA.j,{as:es.z,size:"xs",rightIcon:(0,i.jsx)(iJ.v,{}),children:"Actions"}),(0,i.jsxs)(nq.q,{children:[(0,i.jsxs)(nN.k,{title:"Diff",m:"0",p:"4px 12px",children:[(0,i.jsx)(nV.s,{as:el.x,size:"sm",fontSize:"10pt",isDisabled:!(v||f||g),icon:(0,i.jsx)(s.J,{as:null===(e=nJ("row_count_diff"))||void 0===e?void 0:e.icon}),onClick:()=>{d.runRowCountDiff()},children:"Row Count Diff"}),(0,i.jsx)(nk.u,{label:c("value_diff")?null:ia.audit_helper,placement:"left",children:(0,i.jsx)(nV.s,{as:el.x,size:"sm",fontSize:"10pt",isDisabled:!(v||f||g)||!c("value_diff"),icon:(0,i.jsx)(s.J,{as:null===(n=nJ("value_diff"))||void 0===n?void 0:n.icon}),onClick:()=>{d.runValueDiff()},children:"Value Diff"})})]}),(0,i.jsx)(n9.R,{}),(0,i.jsxs)(nN.k,{title:"Add to Checklist",m:"0",px:"12px",children:[(0,i.jsx)(nV.s,{as:el.x,size:"sm",fontSize:"10pt",isDisabled:!(v||g&&x.length>1),icon:(0,i.jsx)(s.J,{as:null===(t=nJ("lineage_diff"))||void 0===t?void 0:t.icon}),onClick:()=>{d.addLineageDiffCheck(d.viewOptions.view_mode)},children:"Lineage Diff"}),(0,i.jsx)(nV.s,{as:el.x,size:"sm",fontSize:"10pt",isDisabled:!(v||f||g),icon:(0,i.jsx)(s.J,{as:null===(l=nJ("schema_diff"))||void 0===l?void 0:l.icon}),onClick:()=>{d.addSchemaDiffCheck()},children:"Schema Diff"})]})]})]})})})]})})};async function i5(e){return(await U.post("/api/checks",{type:"lineage_diff",params:{},view_options:e})).data}function i2(){return(0,i.jsx)(l.x,{bg:"white",padding:"12px",borderWidth:"1px",borderColor:"gray.200",fontSize:"sm",children:Object.entries({added:["Added","Added resource"],removed:["Removed","Removed resource"],modified:["Modified","Modified resource"]}).map(e=>{let[n,[t,l]]=e,{icon:r,color:a}=tR(n);return(0,i.jsx)(nk.u,{label:l,children:(0,i.jsxs)(o.k,{alignItems:"center",gap:"6px",marginBottom:"2px",children:[(0,i.jsx)(s.J,{color:a,as:r})," ",t]})},n)})})}var i4=t(9690);let i6={mode:"per_node",status:"pending",completed:0,total:0},i3=(e,n)=>{let{onActionStarted:t,onActionNodeUpdated:i,onActionCompleted:l}=n,r=(0,j.useRef)({...i6}).current,{showRunId:s}=nX(),o=async(n,o,a)=>{let d="multi_nodes";r.mode=d,t(),r.status="running";let c=[];for(let n of e){let e=o(n);n.isActionMode=!0,e?(n.action={mode:d,status:"skipped",skipReason:e},i(n)):(n.action={mode:d,status:"pending"},c.push(n))}let u=a(c);try{let{run_id:e}=await ed(n,u,{nowait:!0});for(s(e),r.currentRun={run_id:e},r.total=1;;){let n=await ec(e,2);r.currentRun=n;let t=n.error?"failure":n.result?"success":"running";for(let e of c)e.action={mode:d,status:t,run:n},i(e);if(n.error||n.result)break}}catch(e){}if(r.completed=1,"canceling"===r.status){r.status="canceled",l();return}r.status="completed",l()},a=async(n,s)=>{let o="per_node";for(let n of(r.mode=o,t(),r.status="running",e))n.action={mode:o,status:"pending"},i(n);for(let t of(r.completed=0,r.total=e.length,e)){let{params:e,skipReason:a}=s(t);if(t.isActionMode=!0,a)t.action={mode:o,status:"skipped",skipReason:a},i(t);else try{let{run_id:l}=await ed(n,e,{nowait:!0});for(r.currentRun={run_id:l},t.action={mode:o,status:"running"},i(t);;){let e=await ec(l,2);r.currentRun=e;let n=e.error?"failure":e.result?"success":"running";if(t.action={mode:o,status:n,run:e},i(t),e.error||e.result)break}}catch(e){}finally{r.currentRun=void 0}if(r.completed++,"canceling"===r.status){r.status="canceled",l();return}}r.status="completed",l()},d=async()=>{var e;r.status="canceling",(null===(e=r.currentRun)||void 0===e?void 0:e.run_id)&&await eu(r.currentRun.run_id)};return{actionState:r,runRowCountDiff:async()=>{let n=[];for(let t of e)"model"!==t.resourceType?(t.action={mode:"multi_nodes",status:"skipped",skipReason:"Not a model"},i(t)):n.push(t.name);await o("row_count_diff",e=>{if("model"!==e.resourceType)return"Not a model"},e=>({node_names:e.map(e=>e.name)}))},runValueDiff:async()=>{a("value_diff",e=>{var n,t;let i=null===(t=e.data)||void 0===t?void 0:null===(n=t.current)||void 0===n?void 0:n.primary_key;return i?{params:{model:e.name,primary_key:i}}:{skipReason:"No primary key found. The first unique column is used as primary key."}})},addLineageDiffCheck:async()=>{let n=e.map(e=>e.id);return await i5({node_ids:n})},addSchemaDiffCheck:async()=>{let n;if(1===e.length)n=await io({node_id:e[0].id});else{let t=e.map(e=>e.id);n=await io({node_id:t})}return n},cancel:d,reset:()=>{Object.assign(r,i6)}}};var i9=t(41798),i8=function(){let{isOpen:e,onOpen:n,onClose:t}=(0,Y.q)(),[r,s]=(0,j.useState)(0),[a,d]=(0,j.useState)(),c=(0,j.useRef)(),u=(0,j.useCallback)(e=>(s(e),new Promise(e=>{d(()=>e),n()})),[n]),h=()=>{null==a||a(!1),t()};return{confirm:u,AlertDialog:(0,i.jsx)(i9.aR,{size:"xl",isOpen:e,leastDestructiveRef:c,onClose:h,children:(0,i.jsx)(ee.Z,{children:(0,i.jsxs)(i9._T,{children:[(0,i.jsxs)(et.x,{fontSize:"lg",fontWeight:"bold",children:["Value Diff on ",r," nodes"]}),(0,i.jsx)(ei.f,{gap:"20px",as:o.k,direction:"column",children:(0,i.jsxs)(l.x,{children:["Value diff will be executed on ",r," nodes in the Lineage, which can add extra costs to your bill."]})}),(0,i.jsxs)(er.m,{children:[(0,i.jsx)(es.z,{ref:c,onClick:h,children:"Cancel"}),(0,i.jsx)(es.z,{colorScheme:"blue",onClick:()=>{null==a||a(!0),t()},ml:3,children:"Execute"})]})]})})})}},i7=t(97530);let le={recommendationIgnored:"".concat("recce","-recommendation-ignored")},ln=()=>{var e;let n=(0,y.a)({queryKey:P.checks(),queryFn:n0}),t=(0,j.useMemo)(()=>{if("success"===n.status&&n.data.length>0){let e=n.data.filter(e=>e.is_preset).findLast(e=>"row_count_diff"===e.type);if(e)return e}},[n]),i=(0,y.a)({queryKey:(null==t?void 0:t.check_id)?P.check(t.check_id):[],queryFn:async()=>{if(null==t?void 0:t.check_id)return n1(t.check_id)},enabled:!!(null==t?void 0:t.check_id)}),l=(0,y.a)({queryKey:(null==t?void 0:t.check_id)?[...P.check(t.check_id),"select"]:[],queryFn:async()=>{var e,n;return tv({select:null==t?void 0:null===(e=t.params)||void 0===e?void 0:e.select,exclude:null==t?void 0:null===(n=t.params)||void 0===n?void 0:n.exclude})},enabled:!!(null==t?void 0:null===(e=t.params)||void 0===e?void 0:e.select)}),r=(0,j.useMemo)(()=>{if(t){var e,n;if(null===(e=t.params)||void 0===e?void 0:e.node_names)return t.params.node_names;if(null===(n=t.params)||void 0===n?void 0:n.node_ids)return t.params.node_ids}if("success"===l.status&&l.data)return l.data.nodes},[t,l]);return{recommendedCheck:i.data,selectedNodes:r}},lt=()=>{let{lineageGraph:e}=eE(),{showRunId:n}=nX(),{data:t}=ej(),l=(0,b.NL)(),{recommendedCheck:r,selectedNodes:s}=ln(),[a,d]=(0,j.useState)(),[c,x]=(0,j.useState)(!1),[m,p]=(0,j.useState)(!1),{isOpen:f,onOpen:g,onClose:v}=(0,Y.q)(),y=le.recommendationIgnored;(0,j.useEffect)(()=>{sessionStorage.getItem(y)&&p(!0)},[y]),(0,j.useEffect)(()=>{var n,t,i,l,o,a,c,u,h;if(r&&s){if(null===(n=r.last_run)||void 0===n?void 0:n.run_id){x(!0);return}if(s.length>0&&s.length<=3){if(null===(o=r.params)||void 0===o?void 0:o.node_names){let e=null===(c=r.params)||void 0===c?void 0:c.node_names.join(", ");d("'".concat(e,"'"))}else if(null===(a=r.params)||void 0===a?void 0:a.node_ids){let n=[];for(let t of null===(u=r.params)||void 0===u?void 0:u.node_ids){let i=null==e?void 0:e.nodes[t];i&&n.push(i.name)}let t=n.join(", ");d("'".concat(t,"'"))}else if(s){let n=[];for(let t of s){let i=null==e?void 0:e.nodes[t];i&&n.push(i.name)}let t=n.join(", ");d("'".concat(t,"'"))}}else(null==e?void 0:null===(t=e.modifiedSet)||void 0===t?void 0:t.length)===s.length?d("modified and potentially impacted models"):(null===(i=r.params)||void 0===i?void 0:i.select)&&!(null===(l=r.params)||void 0===l?void 0:l.exclude)?d("'".concat(null===(h=r.params)||void 0===h?void 0:h.select,"'")):d("".concat(s.length," models"))}},[r,s,e,y,t]);let w=(0,j.useCallback)(async()=>{var e;r&&(null===(e=r.last_run)||void 0===e||!e.run_id)&&(n((await eh(r.check_id,{nowait:!0})).run_id),l.invalidateQueries({queryKey:P.check(r.check_id)}))},[r,n,l]);if(!r||!s||(null==t?void 0:t.single_env_onboarding))return(0,i.jsx)(i.Fragment,{});let k=s.length;return!m&&!c&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(u.U,{width:"100%",padding:"2pt 8pt",backgroundColor:"blue.50",children:(0,i.jsxs)(u.U,{flex:"1",fontSize:"10pt",color:"blue.600",children:[(0,i.jsx)(i7.h,{}),(0,i.jsxs)(el.x,{children:["First Check: Perform a row count diff of ",a," for basic impact assessment"]}),(0,i.jsx)(h.L,{}),(0,i.jsx)(es.z,{size:"xs",onClick:()=>{p(!0),sessionStorage.setItem(y,"true")},children:"Ignore"}),(0,i.jsx)(es.z,{colorScheme:"blue",size:"xs",onClick:g,children:"Perform"})]})}),(0,i.jsxs)($.u_,{isOpen:f,onClose:v,isCentered:!0,children:[(0,i.jsx)(ee.Z,{}),(0,i.jsxs)(en.h,{children:[(0,i.jsx)(et.x,{children:"Row Count Check"}),(0,i.jsx)(ei.f,{children:(0,i.jsxs)(tN.K,{spacing:"4",children:[(0,i.jsxs)(el.x,{children:["Perform a row count check of the ",k," node(s) displayed in the lineage diff DAG."]}),(0,i.jsxs)(o.k,{bg:"blue.100",color:"blue.700",children:[(0,i.jsx)(i7.h,{mt:"10px",ml:"5px"}),(0,i.jsx)(el.x,{margin:"5px",paddingX:"3px",children:"This is a recommended first check based on the preset checks defined in your recce.yml file."})]})]})}),(0,i.jsxs)(er.m,{gap:"5px",children:[(0,i.jsx)(es.z,{onClick:v,children:"Cancel"}),(0,i.jsxs)(es.z,{colorScheme:"blue",onClick:()=>{v(),w(),x(!0)},children:["Execute on ",k," models"]})]})]})]})]})},li={customNode:function(e){var n,t;let{data:r}=e,{isHighlighted:a,isSelected:d,resourceType:c,changeStatus:x}=r,m=(0,R.oR)(e=>e.transform[2]>.3),{icon:p}=tE(c),[f,g]=(0,j.useState)(!1),{interactive:v,selectNodeMulti:y,selectMode:b}=t9(),{icon:w,color:k,backgroundColor:C}=x?tR(x):{icon:void 0,color:"gray.400",backgroundColor:"gray.100"},_="solid";r.isSelected;let S=null==r?void 0:r.name;return(0,i.jsx)(nk.u,{label:"model"===c?S:"".concat(S," (").concat(c,")"),placement:"top",children:(0,i.jsxs)(o.k,{width:"300px",borderColor:k,borderWidth:1,borderStyle:_,backgroundColor:m?"multi"===b?d?k:"white":"action_result"!==b?d?C:"white":r.action?d?C:k:"white":d?k:C,borderRadius:3,transition:"box-shadow 0.2s ease-in-out",padding:0,filter:"action_result"===b?(null==r?void 0:r.action)?"none":"opacity(0.2) grayscale(50%)":a||d?"none":"opacity(0.2) grayscale(50%)",onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),children:[(0,i.jsx)(o.k,{backgroundColor:k,padding:v?"8px":"2px",borderRightWidth:1,borderColor:"multi"===b?"#00000020":k,borderStyle:_,alignItems:"top",visibility:m?"inherit":"hidden",children:v&&(0,i.jsx)(ie,{checked:"multi"===b&&d||"action_result"===b&&!!r.action,onClick:e=>{"action_result"!==b&&(e.stopPropagation(),y(r.id))}})}),(0,i.jsxs)(o.k,{flex:"1 0 auto",mx:"1",width:"100px",direction:"column",height:"60px",children:[(0,i.jsxs)(o.k,{width:"100%",textAlign:"left",fontWeight:"600",flex:"1",p:1,gap:"5px",alignItems:"center",visibility:m?"inherit":"hidden",children:[(0,i.jsx)(l.x,{flex:"1",color:"multi"===b?d?"white":"inherit":"action_result"===b&&r.action&&!d?"white":"inherit",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:S}),(0,i.jsx)(s.J,{boxSize:"16px",color:"multi"===b?d?"white":"inherit":"action_result"===b&&r.action&&!d?"white":"inherit",as:p}),w&&(0,i.jsx)(s.J,{color:"multi"===b?d?"white":k:"action_result"===b?r.action&&!d?"white":"inherit":k,as:w})]}),(0,i.jsx)(o.k,{flex:"1 0 auto",mx:"1",direction:"column",paddingBottom:"1",visibility:m?"inherit":"hidden",children:(0,i.jsxs)(u.U,{spacing:"8px",children:["action_result"!==b&&"model"===r.resourceType&&(0,i.jsx)(t7,{id:r.id,inverted:"multi"===b&&!!d}),r.isActionMode&&(r.action?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(h.L,{}),(0,i.jsx)(t6,{node:r,action:r.action})]}):(0,i.jsx)(i.Fragment,{}))]})})]}),Object.keys(null!==(n=null==r?void 0:r.parents)&&void 0!==n?n:{}).length>0&&(0,i.jsx)(R.HH,{type:"target",position:R.Ly.Left,isConnectable:!1}),Object.keys(null!==(t=null==r?void 0:r.children)&&void 0!==t?t:{}).length>0&&(0,i.jsx)(R.HH,{type:"source",position:R.Ly.Right,isConnectable:!1})]})})}},ll={customEdge:function(e){let{sourceX:n,sourceY:t,targetX:l,targetY:r,sourcePosition:s,targetPosition:o,style:a={},markerEnd:d,data:c}=e,u={...a};(null==c?void 0:c.changeStatus)&&(u.stroke=tR(null==c?void 0:c.changeStatus).color,u.strokeDasharray="5"),(null==c?void 0:c.isHighlighted)===!1&&(u.filter="opacity(0.2) grayscale(50%)");let[h]=(0,R.OQ)({sourceX:n,sourceY:t,sourcePosition:s,targetX:l,targetY:r,targetPosition:o});return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(R.u5,{path:h,markerEnd:d,style:{...u,...a}})})}},lr=e=>{var n,t;return(null==e?void 0:null===(n=e.data)||void 0===n?void 0:n.changeStatus)?tR(null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.changeStatus).color:"lightgray"},ls=(e,n)=>{let t=null==e?void 0:e.current,i=(0,j.useRef)({width:0,height:0});(0,j.useEffect)(()=>{let e=new ResizeObserver(e=>{for(let t of e){let e=t.contentRect.width,l=t.contentRect.height;(Math.abs(l-i.current.height)>10||Math.abs(e-i.current.width)>10)&&i.current.height>0&&l>0&&i.current.width>0&&e>0&&n(),i.current={width:e,height:l}}});return t&&e.observe(t),()=>{t&&e.unobserve(t)}},[t,i,n])},lo=()=>{let[,e]=(0,eI.TH)();return(0,j.useCallback)(n=>{n.check_id&&e("/checks/".concat(n.check_id))},[e])},la=(0,j.forwardRef)(function(e,n){var t,r;let{interactive:a=!1,...d}=e,c=(0,R._K)(),h=(0,j.useRef)(null),{successToast:x,failToast:m}=tA(),{copyToClipboard:p,ImageDownloadModal:f,ref:g}=iy({renderLibrary:"html-to-image",imageType:"png",shadowEffect:!0,backgroundColor:"white",ignoreElements:e=>{let n=e.className;return!!("string"==typeof n&&n.includes(ij))},onSuccess:()=>{x("Copied the Lineage View as an image to clipboard")},onError:e=>{console.error("Error taking screenshot",e),m("Failed to copy image to clipboard",e)}}),[v,y,b]=(0,R.Rr)([]),[w,k,C]=(0,R.ll)([]),{lineageGraph:_,retchLineageGraph:S,isLoading:z,error:E,refetchRunsAggregated:D}=eE(),{showRunId:L,closeRunResult:P,runAction:W}=nX(),K=_&&(null==_?void 0:null===(t=_.modifiedSet)||void 0===t?void 0:t.length)>0,[B,J]=(0,j.useState)({view_mode:K?"changed_models":"all",...d.viewOptions});(0,j.useImperativeHandle)(n,()=>({copyToClipboard:p}));let U=B.view_mode||"changed_models",[Z,Q]=(0,j.useState)("single"),X=(0,j.useMemo)(()=>{var e;if("single"===Z)return null===(e=v.find(e=>e.data.isSelected))||void 0===e?void 0:e.data},[Z,v]),Y=(0,j.useMemo)(()=>v.filter(e=>e.data.isSelected).map(e=>e.data),[v]),$=(0,j.useMemo)(()=>v.map(e=>e.data),[v]),[ee,en]=(0,j.useState)(!1),[et,ei]=(0,j.useState)({x:0,y:0}),er=(0,G.p)();(0,j.useLayoutEffect)(()=>{(async()=>{let e;if(!_)return;if(B.node_ids)e=B.node_ids;else{var n;let t=null===(n=_.manifestMetadata.current)||void 0===n?void 0:n.project_name,i={view_mode:B.view_mode,packages:t?[t]:void 0,...d.viewOptions};J(i),e=(await tv({select:i.select,exclude:i.exclude,packages:i.packages,view_mode:i.view_mode})).nodes}let[t,i]=M(_,e);A(t,i),y(t),k(i)})()},[_]);let eo=async e=>{if(e.width&&e.height){let n=e.position.x+e.width/2,t=e.position.y+e.height/2,i=c.getZoom();c.setCenter(n,t,{zoom:i,duration:200})}},ea=lo();ls(h,async()=>{if("single"===Z||"action_result"===Z){let e=v.find(e=>e.data.isSelected);e?eo(e):c.fitView({nodes:v,duration:200})}});let ed=(0,j.useCallback)(e=>{y(n=>n.map(n=>n.id===e.id?{...n,data:e}:n))},[y]),ec=async e=>{let n;if(!_)return;try{n=(await tv({select:e.select,exclude:e.exclude,packages:e.packages,view_mode:e.view_mode})).nodes}catch(e){if(e instanceof i4.d7){var t,i;er({title:"Select node error",description:(null===(i=e.response)||void 0===i?void 0:null===(t=i.data)||void 0===t?void 0:t.detail)||e.message,status:"error",isClosable:!0,position:"bottom-right"})}return}let[l,r]=M(_,n);A(l,r),y(l),k(r),J(e),await new Promise(e=>setTimeout(e,1)),await (async()=>{c.fitView({nodes:l,duration:200})})()},eu=i3("multi"===Z?Y:$,{onActionStarted:()=>{Q("action_result")},onActionNodeUpdated:ed,onActionCompleted:()=>{}}),eh=i8();if(z)return(0,i.jsx)(o.k,{width:"100%",height:"100%",alignItems:"center",justifyContent:"center",children:(0,i.jsx)(tU.$,{size:"xl"})});let ex=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,n=et.selectedNode;"action_result"!==Z&&void 0!==n&&void 0!==_&&("single"===Z&&(y(H(v,!0)),Q("multi"),eu.reset()),y(V([...I(_,[n.id],e)],v,"single"===Z)))},em=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,n=et.selectedNode;"action_result"!==Z&&void 0!==n&&void 0!==_&&("single"===Z&&(y(H(v,!0)),Q("multi"),eu.reset()),y(V([...O(_,[n.id],e)],v,"single"===Z)))},ep=()=>{en(!1),ei({x:0,y:0})};if(E)return(0,i.jsx)(e6.M,{h:"100%",children:(0,i.jsxs)(nu.g,{children:[(0,i.jsx)(l.x,{children:"Failed to load lineage data. This could be because the server has been terminated or there is a network error."}),(0,i.jsxs)(l.x,{children:["[Reason: ",E,"]"]}),(0,i.jsx)(es.z,{colorScheme:"blue",onClick:()=>{S&&S()},children:"Retry"})]})});if("changed_models"===U&&!(null==_?void 0:null===(r=_.modifiedSet)||void 0===r?void 0:r.length))return(0,i.jsx)(e6.M,{h:"100%",children:(0,i.jsxs)(nu.g,{children:[(0,i.jsx)(i.Fragment,{children:"No change detected"}),(0,i.jsx)(es.z,{colorScheme:"blue",onClick:()=>{ec({...B,view_mode:"all"})},children:"Show all nodes"})]})});let ef=()=>{Q("single"),y(H(v)),P(),null==D||D()},eg={interactive:a,selectMode:Z,nodes:v,viewOptions:B,onViewOptionsChanged:ec,selectNodeMulti:e=>{if("multi"!==Z){if(!_)return;let[n,t]=F(Array.from(O(_,_.modifiedSet)),v,w);y(n=q(e,n=H(n,!0))),k(t),Q("multi"),eu.reset()}else{let n=N(e,v);n.find(e=>e.data.isSelected)||(Q("single"),n=H(n)),y(n)}},deselect:ef,runRowCountDiff:async()=>{"multi"===Z?(await eu.runRowCountDiff(),ew({type:"row_count_diff",selected:"multi"})):X?(await W("row_count_diff",{node_names:[X.name]},{showForm:!1,showLast:!1}),ew({type:"row_count_diff",selected:"single"})):(await W("row_count_diff",{select:B.select,exclude:B.exclude,packages:B.packages,view_mode:B.view_mode}),ew({type:"row_count_diff",selected:"none"}))},runValueDiff:async()=>{if(X)await W("value_diff",{model:X.name},{showForm:!0,showLast:!1}),ew({type:"value_diff",selected:"single"});else{let e="multi"===Z?Y.length:$.length;await eh.confirm(e)&&(await eu.runValueDiff(),ew({type:"value_diff",selected:"multi"===Z?"multi":"none"}))}},addLineageDiffCheck:async()=>{let e;"multi"===Z?(e=await eu.addLineageDiffCheck(),ef(),ew({type:"lineage_diff",selected:"multi"})):X||(e=await i5(B),ew({type:"lineage_diff",selected:"none"})),e&&ea(e)},addSchemaDiffCheck:async()=>{let e;"multi"===Z?Y.length>0&&(e=await eu.addSchemaDiffCheck(),ef(),ew({type:"schema_diff",selected:"multi"})):X?(e=await io({node_id:X.id}),ew({type:"schema_diff",selected:"single"})):(e=await io({select:B.select,exclude:B.exclude,packages:B.packages,view_mode:B.view_mode}),ew({type:"schema_diff",selected:"none"})),e&&ea(e)},cancel:eu.cancel,actionState:eu.actionState};return(0,i.jsxs)(t3.Provider,{value:eg,children:[(0,i.jsxs)(ty,{sizes:X?[70,30]:[100,0],minSize:X?400:0,gutterSize:X?5:0,style:{height:"100%",width:"100%"},children:[(0,i.jsxs)(nu.g,{ref:h,divider:(0,i.jsx)(tZ.c,{borderColor:"gray.200"}),spacing:0,style:{contain:"strict"},position:"relative",children:[a&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(i1,{}),(0,i.jsx)(lt,{})]}),(0,i.jsxs)(R.x$,{nodeTypes:li,edgeTypes:ll,nodes:v,edges:w,onNodesChange:b,onEdgesChange:C,onNodeClick:(e,n)=>{if(!1!==a&&_){if(ep(),"single"===Z){X||eo(n);let[e,t]=F(Array.from(T(I(_,[n.id]),O(_,[n.id]))),v,w);y(q(n.id,e)),k(t)}else if("action_result"===Z){var t,i,l,r;(null===(i=n.data.action)||void 0===i?void 0:null===(t=i.run)||void 0===t?void 0:t.run_id)&&L(null===(r=n.data.action)||void 0===r?void 0:null===(l=r.run)||void 0===l?void 0:l.run_id),eo(n),y(q(n.id,v))}else{let e=N(n.id,v);e.find(e=>e.data.isSelected)||(Q("single"),e=H(e)),y(e)}}},onNodeMouseEnter:(e,n)=>{if(!_||X||"single"!==Z)return;let[t,i]=F(Array.from(T(I(_,[n.id]),O(_,[n.id]))),v,w);y(t),k(i)},onNodeMouseLeave:(e,n)=>{if(!_||X)return;let[t,i]=F(Array.from(O(_,_.modifiedSet)),v,w);y(t),k(i)},onNodeContextMenu:(e,n)=>{if(!a||"action_result"===Z)return;e.preventDefault();let t=g.current.getBoundingClientRect(),i=g.current.offsetTop;ei({x:e.clientX-t.left,y:e.clientY-t.top+i,selectedNode:n}),en(!0)},onClick:ep,maxZoom:1,minZoom:.1,fitView:!0,nodesDraggable:a,ref:g,children:[(0,i.jsx)(tQ.A,{color:"#ccc"}),(0,i.jsx)(tX.Z,{showInteractive:!1,position:"top-right",className:ij,children:(0,i.jsx)(tX.B,{title:"copy image",onClick:async()=>{p()},children:(0,i.jsx)(s.J,{as:t0.C3L})})}),(0,i.jsx)(f,{}),(0,i.jsx)(R.s_,{position:"bottom-left",children:(0,i.jsx)(u.U,{children:(0,i.jsx)(i2,{})})}),(0,i.jsx)(R.s_,{position:"top-left",children:(0,i.jsx)(el.x,{fontSize:"xl",color:"grey",opacity:.5,children:v.length>0?"":"No nodes"})}),(0,i.jsx)(tG.a,{nodeColor:lr,nodeStrokeWidth:3,zoomable:!0,pannable:!0}),"action_result"===Z&&(0,i.jsx)(R.s_,{position:"bottom-center",className:ij,children:(0,i.jsx)(iW,{onClose:()=>{ef()}})})]}),ee&&(0,i.jsx)(nM.v,{isOpen:!0,onClose:ep,children:(0,i.jsxs)(nq.q,{fontSize:"11pt",position:"absolute",width:"250px",style:{left:"".concat(et.x,"px"),top:"".concat(et.y,"px")},children:[(0,i.jsx)(nV.s,{icon:(0,i.jsx)(it.Cv2,{}),onClick:()=>{ex(1)},children:"Select parent nodes"}),(0,i.jsx)(nV.s,{icon:(0,i.jsx)(it.IMj,{}),onClick:()=>{em(1)},children:"Select child nodes"}),(0,i.jsx)(n9.R,{}),(0,i.jsx)(nV.s,{icon:(0,i.jsx)(it.Cv2,{}),onClick:()=>{ex()},children:"Select all upstream nodes"}),(0,i.jsx)(nV.s,{icon:(0,i.jsx)(it.IMj,{}),onClick:()=>{em()},children:"Select all downstream nodes"})]})})]}),"single"===Z&&X?(0,i.jsx)(l.x,{borderLeft:"solid 1px lightgray",height:"100%",children:(0,i.jsx)(iP,{node:X,onCloseNode:()=>{if(!_)return;let[e,n]=F(Array.from(O(_,_.modifiedSet)),v,w);y(H(e)),k(n)}})}):(0,i.jsx)(l.x,{})]}),eh.AlertDialog]})}),ld=(0,j.forwardRef)(function(e,n){let{check:t}=e,l={...t.params,...t.view_options};return(0,i.jsx)(o.k,{direction:"column",height:"100%",children:(0,i.jsx)(R.tV,{children:(0,i.jsx)(la,{viewOptions:l,interactive:!1,ref:n})})})});function lc(e){let{name:n,description:t,type:l,params:r,viewOptions:s}=e,o={name:n,description:t,type:l,params:r};s&&(o.view_options=s);let a=ic.ZP.stringify({checks:[o]});return(0,i.jsx)(tV.ML,{height:"300px",language:"yaml",theme:"vs",value:a,options:{readOnly:!0,fontSize:14,lineNumbers:"off",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"same",scrollBeyondLastLine:!1}})}function lu(){let e=(0,G.p)();return{markedAsApprovedToast:function(){e({title:"Marked as approved",position:"bottom-right",status:"success",containerStyle:{fontSize:"sm"},duration:2e3})}}}function lh(){let e=(0,n6._)(["\n
","\n\n ","\n\n
"]);return lh=function(){return e},e}let lx=e=>{var n,t,r,a,c,f,g;let{checkId:v}=e,w=(0,b.NL)(),[,k]=(0,eI.TH)(),{successToast:C,failToast:_}=tA(),{markedAsApprovedToast:S}=lu(),[z,R]=(0,j.useState)(),[E,T]=(0,j.useState)(),[D,L]=(0,j.useState)(!1),{isOpen:I,onOpen:O,onClose:M}=(0,Y.q)(),A=()=>(0,i.jsx)(ee.Z,{bg:"blackAlpha.300",backdropFilter:"blur(10px) "}),[F,q]=(0,j.useState)((0,i.jsx)(A,{})),{isLoading:N,error:V,data:H}=(0,y.a)({queryKey:P.check(v),queryFn:async()=>n1(v),refetchOnMount:!0}),W=z||(null==H?void 0:null===(n=H.last_run)||void 0===n?void 0:n.run_id),{run:K,error:B}=id(W),J=z?!K||"running"===K.status:(null==K?void 0:K.status)==="running",U=(null==H?void 0:H.type)?nJ(null==H?void 0:H.type):void 0,Z=(null==H?void 0:H.is_preset)||!1,Q=(0,j.useRef)(null),{mutate:X}=(0,tu.D)({mutationFn:e=>n5(v,e),onSuccess:()=>{w.invalidateQueries({queryKey:P.check(v)}),w.invalidateQueries({queryKey:P.checks()})}}),{mutate:G}=(0,tu.D)({mutationFn:()=>n2(v),onSuccess:()=>{w.invalidateQueries({queryKey:P.checks()}),k("/checks")}}),er=(0,j.useCallback)(async()=>{(null==H?void 0:H.type)&&(R((await eh(v,{nowait:!0})).run_id),w.invalidateQueries({queryKey:P.check(v)}))},[H,v,R,w]),eo=(0,j.useCallback)(async()=>{if(L(!0),W)return await eu(W)},[W]),ea=async()=>{var e;if(!H)return;let n=(e=H,(0,tM.RI)(lh(),"".concat(e.is_checked?"✅ ":"").concat(e.name),function(e){if("query"===e.type||"query_diff"===e.type){var n;return"".concat(tq(e),"\n\n").concat((0,tM.Pn)(tF(),null===(n=e.params)||void 0===n?void 0:n.sql_template))}return tq(e)}(e)));if(!navigator.clipboard){_("Failed to copy the check to clipboard",Error("Copy to clipboard is available only in secure contexts (HTTPS)"));return}try{await navigator.clipboard.writeText(n),C("Copied the check to the clipboard")}catch(e){_("Failed to copy the check to clipboard",e)}},ed=(0,j.useCallback)(()=>{let e=null==H?void 0:H.is_checked;X({is_checked:!e}),!0==!e&&S()},[null==H?void 0:H.is_checked,X,S]),[ec,ex]=(0,j.useState)(0),{ref:em,onCopyToClipboard:ep,onMouseEnter:ef,onMouseLeave:eg}=ib();if(N)return(0,i.jsx)(e6.M,{h:"100%",children:"Loading"});if(V)return(0,i.jsxs)(e6.M,{h:"100%",children:["Error: ",V.message]});let ev=(null==K?void 0:K.run_at)?(0,tJ.Q)(new Date(K.run_at),{addSuffix:!0}):null;return(0,i.jsxs)(tb,{minSize:100,sizes:[30,70],style:{height:"100%",width:"100%",maxHeight:"100%"},children:[(0,i.jsxs)(l.x,{style:{contain:"strict"},display:"flex",flexDirection:"column",children:[(0,i.jsxs)(o.k,{p:"0px 16px",alignItems:"center",h:"40px",children:[(0,i.jsx)(tc,{name:(null==H?void 0:H.name)||"",setName:e=>{X({name:e})}}),(0,i.jsx)(h.L,{}),Z&&(0,i.jsx)(nk.u,{label:"Preset Check defined in recce config",children:(0,i.jsxs)(n3.Vp,{size:"sm",flex:"0 0 auto",children:[(0,i.jsx)(n3.AD,{boxSize:"14px",as:tr.bX4}),"Preset"]})}),(0,i.jsxs)(nM.v,{children:[(0,i.jsx)(nA.j,{isRound:!0,as:nF.h,icon:(0,i.jsx)(s.J,{as:e7.D_A}),variant:"ghost",size:"sm"}),(0,i.jsxs)(nq.q,{children:[(0,i.jsx)(nV.s,{as:el.x,fontSize:"10pt",icon:(0,i.jsx)(ts.ovA,{}),onClick:()=>{q((0,i.jsx)(A,{})),O()},children:"Get Preset Check Template"}),(0,i.jsx)(nV.s,{as:el.x,fontSize:"10pt",icon:(0,i.jsx)(tn.T,{}),onClick:()=>ea(),children:"Copy Markdown"}),(0,i.jsx)(n9.R,{}),(0,i.jsx)(nV.s,{as:el.x,fontSize:"10pt",icon:(0,i.jsx)(tt.p,{}),color:"red",onClick:()=>G(),children:"Delete"})]})]}),ev&&(0,i.jsx)(l.x,{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",fontSize:"10pt",children:ev}),(null==U?void 0:U.RunResultView)&&(0,i.jsx)(nk.u,{label:"Rerun",children:(0,i.jsx)(nF.h,{isRound:!0,isLoading:J,variant:"ghost","aria-label":"Rerun",icon:(0,i.jsx)(ti.n,{}),onClick:()=>er()})}),(0,i.jsx)(nk.u,{label:(null==H?void 0:H.is_checked)?"Mark as Pending":"Mark as Approved",placement:"bottom-end",children:(0,i.jsx)(es.z,{flex:"0 0 auto",size:"sm",colorScheme:(null==H?void 0:H.is_checked)?"green":"gray",variant:(null==H?void 0:H.is_checked)?"solid":"outline",leftIcon:(null==H?void 0:H.is_checked)?(0,i.jsx)(tl.r,{}):(0,i.jsx)(s.J,{as:e7.Rbx,color:"lightgray"}),onClick:()=>ed(),children:(null==H?void 0:H.is_checked)?"Approved":"Mark as Approved"})})]}),(0,i.jsx)(l.x,{flex:"1",p:"8px 16px",minHeight:"100px",children:(0,i.jsx)(tO,{value:null==H?void 0:H.description,onChange:e=>{X({description:e})}},null==H?void 0:H.check_id)})]}),(0,i.jsx)(l.x,{style:{contain:"strict"},children:(0,i.jsxs)(x.m,{height:"100%",display:"flex",flexDirection:"column",tabIndex:ec,onChange:ex,children:[(0,i.jsxs)(m.t,{height:"50px",children:[(0,i.jsx)(p.O,{fontSize:"10pt",children:"Result"}),((null==H?void 0:H.type)==="query"||(null==H?void 0:H.type)==="query_diff")&&(0,i.jsx)(p.O,{fontSize:"10pt",children:"Query"}),(0,i.jsx)(h.L,{}),(0,i.jsx)(u.U,{mr:"10px",children:(0,i.jsx)(es.z,{leftIcon:(0,i.jsx)(tn.T,{}),variant:"outline",isDisabled:"schema_diff"!==(g=null!==(f=null==H?void 0:H.type)&&void 0!==f?f:"")&&"lineage_diff"!==g&&(!(null==K?void 0:K.result)||!!(null==K?void 0:K.error))||0!==ec,onMouseEnter:ef,onMouseLeave:eg,size:"sm",onClick:()=>{if((null==H?void 0:H.type)==="lineage_diff"){var e;null===(e=Q.current)||void 0===e||e.copyToClipboard()}else ep()},children:"Copy to Clipboard"})})]}),(0,i.jsxs)(n8.n,{height:"100%",flex:"1",style:{contain:"strict"},children:[(0,i.jsxs)(n7.x,{p:0,width:"100%",height:"100%",children:[(null==U?void 0:U.RunResultView)&&((null==H?void 0:H.last_run)||W?(0,i.jsx)(tB,{ref:em,isRunning:J,isAborting:D,run:W?K:null==H?void 0:H.last_run,error:B,progress:E,RunResultView:U.RunResultView,viewOptions:null==H?void 0:H.view_options,onViewOptionsChanged:e=>{X({view_options:e})},onCancel:eo,onExecuteRun:er}):(0,i.jsx)(e6.M,{bg:"rgb(249,249,249)",height:"100%",children:(0,i.jsx)(es.z,{onClick:er,colorScheme:"blue",size:"sm",children:"Run Query"})})),H&&"schema_diff"===H.type&&(0,i.jsx)(tL,{check:H,ref:em}),H&&"lineage_diff"===H.type&&(0,i.jsx)(ld,{check:H,ref:Q})]}),((null==H?void 0:H.type)==="query"||(null==H?void 0:H.type)==="query_diff"||(null==H?void 0:H.type)==="query_base")&&(0,i.jsx)(n7.x,{p:0,height:"100%",width:"100%",children:(null===(t=H.params)||void 0===t?void 0:t.base_sql_template)?(0,i.jsx)(tP,{value:(null==H?void 0:null===(r=H.params)||void 0===r?void 0:r.sql_template)||"",baseValue:(null==H?void 0:null===(a=H.params)||void 0===a?void 0:a.base_sql_template)||"",options:{readOnly:!0}}):(0,i.jsx)(tH,{value:(null==H?void 0:null===(c=H.params)||void 0===c?void 0:c.sql_template)||"",options:{readOnly:!0}})})]})]})}),(0,i.jsxs)($.u_,{isOpen:I,onClose:M,isCentered:!0,size:"6xl",children:[F,(0,i.jsxs)(en.h,{overflowY:"auto",height:"40%",width:"60%",children:[(0,i.jsx)(et.x,{children:"Preset Check Template"}),(0,i.jsx)(eD.o,{}),(0,i.jsxs)(ei.f,{children:[(0,i.jsx)(d.X,{size:"sm",fontWeight:"bold",children:(0,i.jsx)(te.y,{query:"recce.yml",styles:{px:"1",py:"0",bg:"red.100"},children:"Please copy the following template and paste it into the recce.yml file."})}),(0,i.jsx)("br",{}),(0,i.jsx)(lc,{name:(null==H?void 0:H.name)||"",description:(null==H?void 0:H.description)||"",type:(null==H?void 0:H.type)||"",params:null==H?void 0:H.params,viewOptions:null==H?void 0:H.view_options})]})]})]})]})};var lm=t(34872);let lp=e=>{var n;let{check:t,selected:r,onSelect:a,onMarkAsApproved:d}=e,c=(0,b.NL)(),u=t.check_id,{mutate:h}=(0,tu.D)({mutationFn:e=>n5(u,e),onSuccess:()=>{c.invalidateQueries({queryKey:P.check(u)}),c.invalidateQueries({queryKey:P.checks()})}}),x=(null===(n=nJ(t.type))||void 0===n?void 0:n.icon)||eO.WzH;return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(o.k,{width:"100%",p:"10px 20px",cursor:"pointer",_hover:{bg:"Cornsilk"},bg:r?"Floralwhite":"inherit",borderBlockEndWidth:"1px",borderLeftWidth:"3px",borderLeftColor:r?"orange":"transparent",onClick:()=>a(t.check_id),alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.J,{as:x}),(0,i.jsx)(l.x,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:t.name}),(0,i.jsx)(nk.u,{label:"Click to mark as approved",placement:"top",hasArrow:!0,children:(0,i.jsx)(o.k,{children:(0,i.jsx)(nh.X,{isChecked:t.is_checked,variant:"circular",colorScheme:"green",size:"xs",onChange:e=>{let n=e.target.checked;!1===n?h({is_checked:n}):d()}})})})]})})},lf=e=>{let{checks:n,selectedItem:t,onCheckSelected:r,onChecksReordered:s}=e,[a,d]=(0,j.useState)(!1),c=(0,b.NL)(),{mutate:u}=(0,tu.D)({mutationFn:e=>n5(e,{is_checked:!0}),onSuccess:(e,n)=>{c.invalidateQueries({queryKey:P.check(n)}),c.invalidateQueries({queryKey:P.checks()})}}),{isOpen:h,onOpen:x,onClose:m}=(0,Y.q)(),{markedAsApprovedToast:p}=lu(),f=()=>{"true"===localStorage.getItem("bypassMarkAsApprovedWarning")?(u(t),p()):x()};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(lm.Z5,{onDragEnd:e=>{e.destination&&s(e.source.index,e.destination.index)},children:(0,i.jsx)(lm.bK,{droppableId:"checklist",children:e=>(0,i.jsxs)(nu.g,{...e.droppableProps,ref:e.innerRef,w:"full",spacing:"0",flex:"1",overflow:"auto",children:[n.map((e,n)=>(0,i.jsx)(lm._l,{draggableId:e.check_id,index:n,children:(n,l)=>{if(l.isDragging){let e=n.draggableProps,t={x:0,y:80},i=e.style.left-t.x,l=e.style.top-t.y;e.style.left=i,e.style.top=l}return(0,i.jsx)(o.k,{ref:n.innerRef,...n.draggableProps,...n.dragHandleProps,w:"full",children:(0,i.jsx)(lp,{check:e,selected:e.check_id===t,onSelect:r,onMarkAsApproved:f},e.check_id)})}},e.check_id)),e.placeholder]})})}),(0,i.jsxs)($.u_,{isOpen:h,onClose:m,isCentered:!0,children:[(0,i.jsx)(ee.Z,{}),(0,i.jsxs)(en.h,{width:"400px",children:[(0,i.jsx)(et.x,{children:"Mark as Approved?"}),(0,i.jsx)(eD.o,{}),(0,i.jsx)(nC.i,{}),(0,i.jsxs)(l.x,{p:"16px",fontSize:"sm",gap:"16px",children:[(0,i.jsx)("p",{children:"Please ensure you have reviewed the contents of this check before marking it as approved."}),(0,i.jsx)(nh.X,{isChecked:a,onChange:e=>d(e.target.checked),fontWeight:"bold",size:"sm",pt:"8px",children:"Don't show this again"})]}),(0,i.jsx)(nC.i,{}),(0,i.jsxs)(er.m,{children:[(0,i.jsx)(es.z,{variant:"outline",size:"xs",mr:2,onClick:m,children:"Cancel"}),(0,i.jsx)(es.z,{colorScheme:"blue",size:"xs",onClick:()=>{u(t),!0===a&&localStorage.setItem("bypassMarkAsApprovedWarning","true"),p(),m()},children:"Mark as approved"})]})]})]})]})};async function lg(e){return(await U.post("/api/save-as",e)).data}async function lv(e){return(await U.post("/api/rename",e)).data}async function lj(){return(await U.post("/api/export")).data}async function ly(e,n){let t=new FormData;return t.append("file",e),t.append("checks_only",(!!n).toString()),(await U.post("/api/import",t)).data}async function lb(){return 208===(await U.get("/api/sync")).status}async function lw(e){try{let n=await U.post("/api/sync",e);if(202===n.status)return{status:"accepted"};if(208===n.status)return{status:"syncing"}}catch(e){if((0,i4.IZ)(e)&&e.response&&409===e.response.status)return{status:"conflict"}}throw Error("Failed to sync state")}let lk=e=>(0,i.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,i.jsx)("g",{"clip-path":"url(#clip0_1479_25070)",children:(0,i.jsx)("path",{d:"M15.625 0.25H14.759C14.5484 0.25 14.3791 0.423375 14.3841 0.633937L14.4575 3.71441C13.0691 1.62634 10.6955 0.25 8 0.25C4.21291 0.25 1.06041 2.96638 0.38425 6.557C0.340875 6.78728 0.518875 7 0.753219 7H1.64622C1.82353 7 1.97566 6.87556 2.013 6.70222C2.60753 3.9415 5.05991 1.875 8 1.875C10.4858 1.875 12.6232 3.35256 13.5836 5.47819L9.63394 5.38416C9.42341 5.37916 9.25 5.54844 9.25 5.75906V6.625C9.25 6.83209 9.41791 7 9.625 7H15.625C15.8321 7 16 6.83209 16 6.625V0.625C16 0.417906 15.8321 0.25 15.625 0.25ZM15.2468 9H14.3538C14.1765 9 14.0243 9.12444 13.987 9.29778C13.3925 12.0585 10.9401 14.125 8 14.125C5.51419 14.125 3.37681 12.6474 2.41637 10.5218L6.36606 10.6158C6.57659 10.6208 6.75 10.4516 6.75 10.2409V9.375C6.75 9.16791 6.58209 9 6.375 9H0.375C0.167906 9 0 9.16791 0 9.375V15.375C0 15.5821 0.167906 15.75 0.375 15.75H1.24097C1.45156 15.75 1.62088 15.5766 1.61588 15.3661L1.54253 12.2856C2.93087 14.3737 5.3045 15.75 8 15.75C11.7871 15.75 14.9396 13.0336 15.6158 9.443C15.6591 9.21272 15.4811 9 15.2468 9Z",fill:"currentColor"})}),(0,i.jsx)("defs",{children:(0,i.jsx)("clipPath",{id:"clip0_1479_25070",children:(0,i.jsx)("rect",{width:"16",height:"16",fill:"white"})})})]}),lC=e=>(0,i.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,i.jsx)("g",{"clip-path":"url(#clip0_1479_25102)",children:(0,i.jsx)("path",{d:"M-1.88399 8.72062L0.358816 6.46094C0.594752 6.22344 1.00006 6.39031 1.00006 6.725V8.2525H4.00005V4.12438C4.00005 3.7275 4.16161 3.34313 4.44286 3.06219L7.06441 0.440625C7.34566 0.159375 7.72691 0 8.12347 0H14.5003C15.3281 0.003125 16 0.675 16 1.50281V14.5003C16 15.3281 15.3281 16 14.5003 16H5.50223C4.67411 16 4.00005 15.3281 4.00005 14.5003V11.2522H5.50005V14.5003H14.5003V1.50281H9.50128V4.75219C9.50128 5.16781 9.1669 5.50187 8.75128 5.50187H5.50005V8.25219H10.625C10.8322 8.25219 11 8.42 11 8.62719V9.37719C11 9.58438 10.8322 9.75219 10.625 9.75219H1.00006V11.2797C1.00006 11.6144 0.594752 11.7813 0.358816 11.5438L-1.88399 9.28406C-2.03867 9.12813 -2.03867 8.87656 -1.88399 8.72062ZM8.0016 4.00219V1.62469L5.62379 4.00219H8.0016Z",fill:"currentColor"})}),(0,i.jsx)("g",{"clip-path":"url(#clip1_1479_25102)",children:(0,i.jsx)("path",{d:"M0.103056 8.72062L2.09667 6.46094C2.30639 6.22344 2.66667 6.39031 2.66667 6.725V8.2525H5.33333V4.12438C5.33333 3.7275 5.47694 3.34313 5.72694 3.06219L8.05722 0.440625C8.30722 0.159375 8.64611 0 8.99861 0H14.6669C15.4028 0.003125 16 0.675 16 1.50281V14.5003C16 15.3281 15.4028 16 14.6669 16H6.66861C5.9325 16 5.33333 15.3281 5.33333 14.5003V11.2522H6.66667V14.5003H14.6669V1.50281H10.2233V4.75219C10.2233 5.16781 9.92611 5.50187 9.55667 5.50187H6.66667V8.25219H11.2222C11.4064 8.25219 11.5556 8.42 11.5556 8.62719V9.37719C11.5556 9.58438 11.4064 9.75219 11.2222 9.75219H2.66667V11.2797C2.66667 11.6144 2.30639 11.7813 2.09667 11.5438L0.103056 9.28406C-0.0344448 9.12813 -0.0344448 8.87656 0.103056 8.72062ZM8.89028 4.00219V1.62469L6.77666 4.00219H8.89028Z",fill:"currentColor"})}),(0,i.jsxs)("defs",{children:[(0,i.jsx)("clipPath",{id:"clip0_1479_25102",children:(0,i.jsx)("rect",{width:"13",height:"16",fill:"white",transform:"matrix(-1 0 0 1 16 0)"})}),(0,i.jsx)("clipPath",{id:"clip1_1479_25102",children:(0,i.jsx)("rect",{width:"3",height:"16",fill:"white"})})]})]}),l_=e=>(0,i.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,i.jsx)("g",{"clip-path":"url(#clip0_1426_8619)",children:(0,i.jsx)("path",{d:"M15.5572 3.06188L12.9356 0.440625C12.6544 0.159375 12.2731 0 11.8766 0H5.49969C4.67188 0.003125 4 0.675 4 1.50281V8.25219H0.375C0.167812 8.25219 0 8.42 0 8.62719V9.37719C0 9.58438 0.167812 9.75219 0.375 9.75219H9V11.2797C9 11.6144 9.40531 11.7812 9.64125 11.5437L11.8841 9.28406C12.0388 9.12813 12.0388 8.87656 11.8841 8.72062L9.64125 6.46094C9.40531 6.22344 9 6.39031 9 6.725V8.2525H5.49969V1.50281H10.4987V4.75219C10.4987 5.16781 10.8331 5.50187 11.2487 5.50187H14.5V14.5003H5.49969V11.2522H4V14.5003C4 15.3281 4.67188 16 5.49969 16H14.4978C15.3259 16 16 15.3281 16 14.5003V4.12406C16 3.7275 15.8384 3.34313 15.5572 3.06188ZM11.9984 4.00219V1.62469L14.3763 4.00219H11.9984Z",fill:"black"})}),(0,i.jsx)("defs",{children:(0,i.jsx)("clipPath",{id:"clip0_1426_8619",children:(0,i.jsx)("rect",{width:"16",height:"16",fill:"white"})})})]}),lS=e=>(0,i.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,i.jsx)("path",{d:"M14.5607 4.06066L11.9393 1.43934C11.658 1.15804 11.2765 1 10.8787 1H2.5C1.67156 1 1 1.67156 1 2.5V13.5C1 14.3284 1.67156 15 2.5 15H13.5C14.3284 15 15 14.3284 15 13.5V5.12131C15 4.72349 14.842 4.34196 14.5607 4.06066ZM9.5 2.5V5H5.5V2.5H9.5ZM13.3125 13.5H2.6875C2.63777 13.5 2.59008 13.4802 2.55492 13.4451C2.51975 13.4099 2.5 13.3622 2.5 13.3125V2.6875C2.5 2.63777 2.51975 2.59008 2.55492 2.55492C2.59008 2.51975 2.63777 2.5 2.6875 2.5H4V5.75C4 6.16422 4.33578 6.5 4.75 6.5H10.25C10.6642 6.5 11 6.16422 11 5.75V2.62131L13.4451 5.06641C13.4625 5.08382 13.4763 5.10449 13.4857 5.12724C13.4952 5.14999 13.5 5.17438 13.5 5.199V13.3125C13.5 13.3622 13.4802 13.4099 13.4451 13.4451C13.4099 13.4802 13.3622 13.5 13.3125 13.5ZM8 7.25C6.48366 7.25 5.25 8.48366 5.25 10C5.25 11.5163 6.48366 12.75 8 12.75C9.51634 12.75 10.75 11.5163 10.75 10C10.75 8.48366 9.51634 7.25 8 7.25ZM8 11.25C7.31075 11.25 6.75 10.6892 6.75 10C6.75 9.31075 7.31075 8.75 8 8.75C8.68925 8.75 9.25 9.31075 9.25 10C9.25 10.6892 8.68925 11.25 8 11.25Z",fill:"currentColor"})}),lz=e=>(0,i.jsx)("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,i.jsx)("path",{d:"M15.9143 1.75812L14.7422 0.585938C14.3515 0.195312 13.8397 0 13.3278 0C12.8159 0 12.304 0.195312 11.9137 0.585625L9.58593 2.91344L8.5 3.99938L0.901592 11.5975L0.504719 15.1669C0.454719 15.6163 0.80878 16 1.24847 16C1.27628 16 1.3044 15.9984 1.33253 15.9953L4.89939 15.6012L12.5006 8L13.5862 6.91437L15.914 4.58656C16.6953 3.80531 16.6953 2.53906 15.9143 1.75812ZM4.21095 14.1684L2.09909 14.4016L2.3344 12.2863L9.56062 5.06L10.53 4.09062L12.4094 5.97L11.44 6.93937L4.21095 14.1684ZM14.8534 3.52562L13.4697 4.90938L11.5906 3.03L12.9744 1.64625C13.1019 1.51875 13.2506 1.49969 13.3278 1.49969C13.405 1.49969 13.554 1.51875 13.6812 1.64625L14.8534 2.81844C15.0484 3.01375 15.0484 3.33094 14.8534 3.52562Z",fill:"currentColor"})}),lR=e=>(0,i.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,i.jsx)("path",{d:"M7.26326 6.5462H8.71794V12.3642H7.26326V6.5462ZM7.9906 3.1102C7.43278 3.1102 6.97888 3.5641 6.97888 4.12192C6.97888 4.67974 7.43278 5.13364 7.9906 5.13364C8.54842 5.13364 9.00232 4.67974 9.00232 4.12192C9.00232 3.5641 8.54842 3.1102 7.9906 3.1102ZM16 8C16 12.411 12.411 16 8 16C3.589 16 0 12.411 0 8C0 3.589 3.589 0 8 0C12.411 0 16 3.589 16 8ZM14.5453 8C14.5453 4.3906 11.6093 1.4546 7.99992 1.4546C4.39052 1.4546 1.45452 4.3914 1.45452 8.0006C1.45452 11.6098 4.39052 14.546 7.99992 14.546C11.6093 14.546 14.5453 11.6092 14.5453 8.0006V8Z",fill:"currentColor"})});function lE(e){let{checksOnly:n=!0}=e,t=(0,G.p)(),l=(0,b.NL)(),r=(0,j.useRef)(null),a=(0,j.useRef)(null),[d,c]=(0,j.useState)(null),{isOpen:u,onOpen:h,onClose:x}=(0,Y.q)(),[m,p]=(0,eI.TH)(),[,f]=eT(),g=(0,j.useCallback)(async()=>{if(d){try{let{runs:e,checks:i}=await ly(d,n);f(),await l.invalidateQueries({queryKey:P.checks()}),await l.invalidateQueries({queryKey:P.runs()}),m.includes("/checks")&&p("/checks");let r=n?"".concat(i," checks imported successfully"):"".concat(e," runs and ").concat(i," checks imported successfully");t({description:r,status:"info",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}catch(e){console.error("Import failed",e),t({title:"Import failed",description:"".concat(e),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}x()}},[l,d,t,x,m,p,f,n]),v=n?"checks":"runs and checks",{isDemoSite:y}=eE();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nk.u,{label:"Import Checklist from State File"+(y?" (Disabled in the demo site)":""),children:(0,i.jsx)(nF.h,{pt:"6px",variant:"unstyled","aria-label":"Import state",onClick:()=>{r.current&&r.current.click()},icon:(0,i.jsx)(s.J,{as:l_}),isDisabled:y})}),(0,i.jsx)("input",{type:"file",style:{display:"none"},ref:r,onChange:e=>{var n;(null===(n=e.target.files)||void 0===n?void 0:n.length)===1&&(c(e.target.files[0]),h()),r.current&&(r.current.value="")}}),(0,i.jsx)(i9.aR,{isOpen:u,leastDestructiveRef:a,onClose:x,size:"xl",children:(0,i.jsx)(ee.Z,{children:(0,i.jsxs)(i9._T,{children:[(0,i.jsx)(et.x,{fontSize:"lg",fontWeight:"bold",children:"Import state"}),(0,i.jsx)(ei.f,{children:(0,i.jsxs)(o.k,{px:"5px",gap:"5px",rounded:"md",direction:"column",children:[(0,i.jsxs)(o.k,{alignItems:"center",gap:"5px",children:[(0,i.jsx)(tY.s,{color:"red.600"}),(0,i.jsx)(el.x,{as:"span",fontWeight:"500",color:"red.600",children:"Caution!"})]}),(0,i.jsx)(o.k,{children:(0,i.jsxs)(el.x,{children:["The current ",v," will be"," ",(0,i.jsx)(el.x,{as:"span",fontWeight:"600",children:"merged"})," ","with the imported state"]})})]})}),(0,i.jsxs)(er.m,{children:[(0,i.jsx)(es.z,{ref:a,onClick:x,children:"Cancel"}),(0,i.jsx)(es.z,{colorScheme:"blue",onClick:g,ml:"5px",children:"Import"})]})]})})})]})}let lT=()=>{let[,e]=(0,eI.TH)(),[,n]=(0,eI.yj)("/checks/:checkId"),t=(0,b.NL)(),{successToast:r,failToast:s}=tA(),a=null==n?void 0:n.checkId,{isLoading:d,error:c,data:u,status:h}=(0,y.a)({queryKey:P.checks(),queryFn:n0,refetchOnMount:!0}),x=(0,j.useCallback)(n=>{e("/checks/".concat(n))},[e]),[m,p]=(0,j.useState)(u||[]),{mutate:f}=(0,tu.D)({mutationFn:e=>n4(e),onSuccess:()=>{t.invalidateQueries({queryKey:P.checks()})}}),g=(0,j.useCallback)((e,n)=>{let t=[...m],[i]=t.splice(e,1);t.splice(n,0,i),f({source:e,destination:n}),p(t)},[m,p,f]);return((0,j.useCallback)(async()=>{let e=await nY();t.invalidateQueries({queryKey:P.checks()}),x(e.check_id)},[t,x]),(0,j.useEffect)(()=>{"success"===h&&(!a&&u.length>0&&e("/checks/".concat(u[0].check_id)),p(u))},[h,a,u,p,e]),d)?(0,i.jsx)(i.Fragment,{}):c?(0,i.jsxs)(i.Fragment,{children:["Error: ",c.message]}):(null==u?void 0:u.length)?(0,i.jsxs)(ty,{style:{height:"100%"},minSize:50,sizes:[20,80],children:[(0,i.jsx)(l.x,{borderRight:"lightgray solid 1px",height:"100%",style:{contain:"size"},children:(0,i.jsxs)(nu.g,{spacing:0,h:"100%",style:{contain:"strict"},alignItems:"stretch",children:[(0,i.jsx)(o.k,{justifyContent:"right",padding:"0px 10px",children:(0,i.jsx)(lE,{checksOnly:!0})}),(0,i.jsx)(nC.i,{}),(0,i.jsx)(lf,{checks:m,selectedItem:a,onCheckSelected:x,onChecksReordered:g})]})}),(0,i.jsx)(l.x,{height:"100%",children:(0,i.jsx)(eI.rs,{children:(0,i.jsx)(eI.AW,{path:"/checks/:checkId",children:e=>(0,i.jsx)(lx,{checkId:e.checkId},e.checkId)})})})]}):(0,i.jsx)(e6.M,{h:"100%",children:(0,i.jsx)(l.x,{children:"No checks"})})};var lD=t(21297);let lL=()=>{let{isHistoryOpen:e,showHistory:n,closeHistory:t}=nX();return(0,i.jsxs)(l.x,{children:[(0,i.jsx)(l.x,{fontSize:"8pt",children:"History"}),(0,i.jsx)(es.z,{leftIcon:(0,i.jsx)(s.J,{as:e7.M1Q}),size:"xs",variant:"outline",onClick:()=>{e?(ek({name:"hide"}),t()):(ek({name:"show"}),n())},children:e?"Hide":"Show"})]})},lI=()=>{let{isCustomQueries:e,setCustomQueries:n,sqlQuery:t,setBaseSqlQuery:r}=_();return(0,i.jsxs)(l.x,{children:[(0,i.jsxs)(l.x,{fontSize:"8pt",children:["Custom Queries ","",(0,i.jsx)(nk.u,{label:"Custom queries allow you to use two SQL queries to compare results between current and base environments.",children:(0,i.jsx)(tY.s,{color:"gray.600",boxSize:"3"})})]}),(0,i.jsx)(lD.r,{size:"sm",isChecked:e,onChange:()=>{!1===e&&r&&r(t),n(!e)}})]})},lO=()=>{let{sqlQuery:e,baseSqlQuery:n,setSqlQuery:t,setBaseSqlQuery:r,primaryKeys:s,setPrimaryKeys:a,isCustomQueries:d}=_(),{envInfo:c}=eE(),u=e;(null==c?void 0:c.adapterType)==="sqlmesh"&&e===w&&(u="select * from db.mymodel");let{showRunId:x}=nX(),m=async e=>{let t="query_base"===e?n||"":u,i=function(e){switch(e){case"query":return iS;case"query_base":return iz;case"query_diff":return iR;default:throw Error("Unknown query type: ".concat(e))}}(e),l={sql_template:t};"query_diff"===e&&(l.primary_keys=s,d&&(l.base_sql_template=n));let{run_id:r}=await i(l,{nowait:!0});return x(r),await ec(r)},{mutate:p,isPending:f}=(0,tu.D)({mutationFn:m});return(0,i.jsxs)(o.k,{direction:"column",height:"100%",children:[(0,i.jsxs)(o.k,{justifyContent:"right",alignItems:"center",padding:"4pt 8pt",gap:"5px",height:"54px",borderBottom:"1px solid lightgray",flex:"0 0 54px",children:[(0,i.jsx)(lL,{}),(0,i.jsx)(lI,{}),(0,i.jsx)(h.L,{}),(0,i.jsx)(iI,{defaultPrimaryKeys:s,onPrimaryKeysChange:a}),(0,i.jsx)(es.z,{colorScheme:"blue",onClick:()=>p("query_diff"),isDisabled:f,size:"xs",fontSize:"14px",marginTop:"16px",children:"Run Diff"})]}),(0,i.jsx)(l.x,{width:"100%",flex:"1",children:d?(0,i.jsx)(tP,{value:u,baseValue:n,onChange:t,onChangeBase:r,onRun:()=>p("query"),onRunBase:()=>p("query_base"),onRunDiff:()=>p("query_diff")}):(0,i.jsx)(tH,{value:u,onChange:t,onRun:()=>p("query"),onRunDiff:()=>p("query_diff")})})]})};var lM=t(26143);let lA=e=>(0,lM.c4)("#!"+e),lF=()=>[(0,lM.LD)(()=>window.location.hash.replace(/^#!/,"")||"/",()=>"/ssr"),lA];var lq=t(35653),lN=t(38222);let lV=e=>{var n;let{runId:t}=e,{isPending:l,error:r,data:s}=(0,y.a)({queryKey:P.run(t),queryFn:async()=>ec(t)}),o=(null==s?void 0:s.type)?null===(n=nJ(s.type))||void 0===n?void 0:n.RunResultView:void 0;return(0,i.jsx)(tB,{isPending:l,error:r,run:s,RunResultView:o})},lH=e=>{let{error:n,resetError:t}=e;return(0,i.jsx)(e6.M,{height:"100%",backgroundColor:"gray.50",children:(0,i.jsxs)(o.k,{p:4,direction:"column",justifyContent:"flex-start",backgroundColor:"white",border:"solid lightgray 1px",minHeight:"200px",children:[(0,i.jsx)(d.X,{width:"800px",size:"md",children:"You have encountered an error"}),(0,i.jsx)(l.x,{flex:"1",fontSize:"10pt",children:n.toString()}),(0,i.jsx)(es.z,{justifySelf:"center",alignSelf:"center",mt:"20px",colorScheme:"blue",size:"sm",onClick:()=>{t()},children:"Reset"})]})})},lP=e=>{let{children:n}=e;return(0,i.jsx)(tK.SV,{fallback:lH,children:n})};function lW(){let e=(0,G.p)(),n=async()=>{try{let e=await lj(),n=JSON.stringify(e,null,2),t=new Blob([n],{type:"application/json"}),i=new Date,l="recce-state-".concat((0,ip.WU)(i,"yyyy-MM-dd-HH-mm-ss"),".json");iv()(t,l)}catch(n){console.error("Export failed",n),e({title:"Export failed",description:"".concat(n),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}};return(0,i.jsx)(nk.u,{label:"Export",children:(0,i.jsx)(nF.h,{size:"sm",variant:"unstyled","aria-label":"Export state",onClick:n,icon:(0,i.jsx)(s.J,{as:lC,verticalAlign:"middle",boxSize:"16px"})})})}t(58923);var lK=t(71651),lB=t(87202),lJ=t(9783),lU=t(34889),lZ=t(33246),lQ=t(67192),lX=t(37854),lG=t(31617);function lY(e){let n=(0,lG.D)(e);return(0,ip.WU)(n,"yyyy-MM-dd'T'HH:mm:ss")}function l$(e){return Object.values(e).every(e=>null===e)?[(0,i.jsx)(o.k,{ml:"10px",children:"No information"},"no info")]:Object.entries(e).filter(e=>{let[n,t]=e;return"url"!==n&&null!=t}).map(e=>{let[n,t]=e;return(0,i.jsxs)(tw.HC,{ml:"10px",children:[n,": ",t]},n)})}function l0(){var e,n,t,l,a,c;let{envInfo:u,reviewMode:h,lineageGraph:x}=eE(),{isOpen:m,onOpen:p,onClose:f}=(0,Y.q)(),g=null==u?void 0:u.git,v=null==u?void 0:u.pullRequest,j={...g,...v},y=null==u?void 0:null===(e=u.dbt)||void 0===e?void 0:e.base,b=null==u?void 0:null===(n=u.dbt)||void 0===n?void 0:n.current,w=(null==y?void 0:y.generated_at)?lY(null==y?void 0:y.generated_at):"",k=(null==b?void 0:b.generated_at)?lY(null==b?void 0:b.generated_at):"",C=new Set,_=new Set;if(null==x?void 0:x.nodes)for(let e of Object.values(null==x?void 0:x.nodes))(null===(a=e.data.base)||void 0===a?void 0:a.schema)&&C.add(e.data.base.schema),(null===(c=e.data.current)||void 0===c?void 0:c.schema)&&_.add(e.data.current.schema);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nk.u,{label:"Environment Info",placement:"bottom-end",children:(0,i.jsx)(nF.h,{size:"sm",variant:"unstyled","aria-label":"Export state",onClick:p,icon:(0,i.jsx)(s.J,{verticalAlign:"middle",as:lR,boxSize:"16px"})})}),(0,i.jsxs)($.u_,{isOpen:m,onClose:f,size:"3xl",children:[(0,i.jsx)(ee.Z,{}),(0,i.jsxs)(en.h,{children:[(0,i.jsx)(et.x,{children:"Environment Information"}),(0,i.jsx)(eD.o,{}),(0,i.jsx)(ei.f,{children:(0,i.jsxs)(o.k,{direction:"column",gap:"5px",children:[h?(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(o.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(d.X,{size:"sm",children:"Review Information"}),(0,i.jsxs)(tw.QI,{spacing:1,children:[(null==j?void 0:j.url)&&(0,i.jsxs)(tw.HC,{ml:"10px",children:["url:"," ",(0,i.jsx)(r.r,{href:j.url,color:"blue.500",isExternal:!0,children:j.url})]}),j&&l$(j)]})]})}):(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(o.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(d.X,{size:"sm",children:"Dev Information"}),(0,i.jsx)(tw.QI,{spacing:1,children:g&&l$(g)})]})}),(0,i.jsx)(nC.i,{}),(null==u?void 0:u.adapterType)==="dbt"&&(0,i.jsxs)(o.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(d.X,{size:"sm",children:"DBT"}),(0,i.jsx)(lK.x,{children:(0,i.jsxs)(lB.i,{variant:"simple",children:[(0,i.jsx)(lJ.h,{children:(0,i.jsxs)(lU.Tr,{children:[(0,i.jsx)(lZ.Th,{}),(0,i.jsx)(lZ.Th,{children:"base"}),(0,i.jsx)(lZ.Th,{children:"current"})]})}),(0,i.jsxs)(lQ.p,{children:[(0,i.jsxs)(lU.Tr,{children:[(0,i.jsx)(lX.Td,{children:"schema"}),(0,i.jsx)(lX.Td,{children:JSON.stringify(Array.from(C))}),(0,i.jsx)(lX.Td,{children:JSON.stringify(Array.from(_))})]}),(0,i.jsxs)(lU.Tr,{children:[(0,i.jsx)(lX.Td,{children:"version"}),(0,i.jsx)(lX.Td,{children:null==y?void 0:y.dbt_version}),(0,i.jsx)(lX.Td,{children:null==b?void 0:b.dbt_version})]}),(0,i.jsxs)(lU.Tr,{children:[(0,i.jsx)(lX.Td,{children:"timestamp"}),(0,i.jsx)(lX.Td,{children:w}),(0,i.jsx)(lX.Td,{children:k})]})]})]})})]}),(null==u?void 0:u.adapterType)==="sqlmesh"&&(0,i.jsxs)(o.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(d.X,{size:"sm",children:"SQLMesh"}),(0,i.jsx)(lK.x,{children:(0,i.jsxs)(lB.i,{variant:"simple",children:[(0,i.jsx)(lJ.h,{children:(0,i.jsxs)(lU.Tr,{children:[(0,i.jsx)(lZ.Th,{}),(0,i.jsx)(lZ.Th,{children:"base"}),(0,i.jsx)(lZ.Th,{children:"current"})]})}),(0,i.jsx)(lQ.p,{children:(0,i.jsxs)(lU.Tr,{children:[(0,i.jsx)(lX.Td,{children:"Environment"}),(0,i.jsx)(lX.Td,{children:null==u?void 0:null===(t=u.sqlmesh)||void 0===t?void 0:t.base_env}),(0,i.jsx)(lX.Td,{children:null==u?void 0:null===(l=u.sqlmesh)||void 0===l?void 0:l.current_env})]})})]})})]})]})}),(0,i.jsx)(er.m,{children:(0,i.jsx)(es.z,{colorScheme:"blue",mr:3,onClick:f,children:"Close"})})]})]})]})}function l1(){return(0,i.jsx)(R.tV,{children:(0,i.jsx)(la,{interactive:!0})})}let l5=e=>{let{isGuideOpen:n,closeGuide:t}=e;return(0,i.jsxs)($.u_,{isOpen:n,onClose:t,scrollBehavior:"inside",children:[(0,i.jsx)(ee.Z,{}),(0,i.jsxs)(en.h,{maxW:"80vw",h:"80vh",children:[(0,i.jsx)(et.x,{children:"Welcome to Recce: 3 Steps to Begin"}),(0,i.jsx)(eD.o,{}),(0,i.jsx)(ei.f,{children:(0,i.jsxs)(tN.K,{spacing:4,children:[(0,i.jsxs)(tw.aV,{spacing:2,children:[(0,i.jsx)(tw.HC,{children:"Step 1: Click the model you want to check"}),(0,i.jsx)(tw.HC,{children:'Step 2: Click "Explore Change"'}),(0,i.jsx)(tw.HC,{children:'Step 3: Click "Add to Checklist"'})]}),(0,i.jsx)(nC.i,{}),(0,i.jsx)(a.E,{src:"https://datarecce.io/assets/images/onboarding/material.svg",alt:"placeholder"})]})}),(0,i.jsx)(er.m,{children:(0,i.jsx)(es.z,{colorScheme:"blue",onClick:t,children:"Got it!"})})]})]})},l2=e=>{let{isGuideOpen:n,closeGuide:t}=e;return(0,i.jsxs)($.u_,{isOpen:n,onClose:t,scrollBehavior:"inside",children:[(0,i.jsx)(ee.Z,{}),(0,i.jsxs)(en.h,{maxW:"40vw",h:"300px",children:[(0,i.jsx)(et.x,{children:"All nodes displayed"}),(0,i.jsx)(eD.o,{}),(0,i.jsx)(nC.i,{}),(0,i.jsx)(ei.f,{children:(0,i.jsxs)(tN.K,{spacing:4,children:[(0,i.jsx)(el.x,{children:"In a single environment with only a target, no nodes are marked as changed."}),(0,i.jsxs)(o.k,{bg:"blue.100",color:"blue.700",children:[(0,i.jsx)(i7.h,{mt:"10px",ml:"5px"}),(0,i.jsxs)(el.x,{margin:"5px",paddingX:"3px",children:["To see changed nodes, configure a target-base."," ",(0,i.jsx)(r.r,{textDecor:"underline",isExternal:!0,href:"https://datarecce.io/docs/get-started/#prepare-dbt-artifacts",onClick:()=>eS({action:"external_link",from:"onboarding"}),children:"Learn how."})]})]})]})}),(0,i.jsx)(nC.i,{}),(0,i.jsx)(er.m,{children:(0,i.jsx)(es.z,{colorScheme:"blue",onClick:t,children:"Got it!"})})]})]})};var l4=()=>{let[e,n]=(0,j.useState)(!1),[t,l]=(0,j.useState)(!1),{data:r,isLoading:s}=ej();(0,j.useEffect)(()=>{if(!s&&r){let e=r.show_onboarding_guide;if(r.single_env_onboarding&&e){l(!0),eS({action:"onboarding"});return}!localStorage.getItem("hasVisited")&&e&&(n(!0),localStorage.setItem("hasVisited","true"))}},[r,s]);let o=()=>{n(!1),l(!1),eg()};return s?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l5,{isGuideOpen:e,closeGuide:o}),(0,i.jsx)(l2,{isGuideOpen:t,closeGuide:o})]})},l6=t(39502);t(28269);let l3=e=>{var n;let{run:t,isSelected:r,onSelectRun:a,onAddToChecklist:d,onGoToCheck:c}=e,{data:u}=(0,y.a)({queryKey:P.run(t.run_id),queryFn:async()=>await ec(t.run_id),enabled:(null==t?void 0:t.status)==="running",retry:!1}),h=(null===(n=nJ(t.type))||void 0===n?void 0:n.icon)||eO.WzH,x=t.check_id;return(0,i.jsxs)(o.k,{minWidth:"200px",direction:"column",width:"100%",p:"5px 20px",cursor:"pointer",borderBottom:"solid 1px lightgray",borderLeft:"4px",borderLeftColor:r?"orange.400":"transparent",backgroundColor:r?"orange.50":"transparent",onClick:()=>{a(t.run_id)},_hover:{bg:r?"orange.50":"gray.200"},children:[(0,i.jsxs)(o.k,{onClick:()=>{},alignItems:"center",gap:"12px",children:[(0,i.jsx)(s.J,{as:h}),(0,i.jsx)(l.x,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",color:t.name?"inherit":"gray.500",fontSize:"11pt",fontWeight:"500",children:t.name||""}),x?(0,i.jsx)(nk.u,{label:"Go to Check","aria-label":"Go to Check",children:(0,i.jsx)(el.x,{onClick:e=>{e.preventDefault(),e.stopPropagation(),c(x)},children:(0,i.jsx)(s.J,{color:"green",as:tk.FJM})})}):(0,i.jsx)(nk.u,{label:"Add to Checklist","aria-label":"Add to Checklist",children:(0,i.jsx)(el.x,{onClick:e=>{e.preventDefault(),e.stopPropagation(),ek({name:"add_to_checklist"}),d(t.run_id)},children:(0,i.jsx)(s.J,{as:tk.wO})})})]}),(0,i.jsx)(o.k,{justifyContent:"start",fontSize:"11pt",color:"gray.500",gap:"3px",alignItems:"center",children:(0,i.jsx)(iw,{run:u||t})})]})},l9=e=>{let{runAt:n}=e,t=n?function(e){let n=new Date,t=new Date;return(t.setDate(n.getDate()-1),null==e)?null:n.toDateString()===e.toDateString()?"Today":t.toDateString()===e.toDateString()?"Yesterday":(0,ip.WU)(e,"MMM d")}(new Date(n)):null;return(0,i.jsx)(o.k,{minWidth:"200px",width:"100%",p:"5px 20px",borderBottom:"solid 1px lightgray",color:"gray.500",fontSize:"11pt",children:t})},l8=()=>{let{data:e,isLoading:n,isFetching:t,error:r,refetch:s}=(0,y.a)({queryKey:P.runs(),queryFn:async()=>await em(),retry:!1}),{showRunId:a,runId:c}=nX(),x=e=>{ek({name:"click_run"}),a(e,!1)},[,m]=(0,eI.TH)(),p=(0,b.NL)(),f=(0,j.useCallback)(async()=>{if(!c)return;let e=await n$(c);p.invalidateQueries({queryKey:P.checks()}),m("/checks/".concat(e.check_id))},[c,m,p]),g=(0,j.useCallback)(e=>{ek({name:"go_to_check"}),m("/checks/".concat(e))},[m]),v=null;return(0,i.jsxs)(o.k,{direction:"column",height:"100%",children:[(0,i.jsxs)(u.U,{width:"100%",flex:"0 0 54px",paddingInline:"24px 8px",borderBottom:"solid 1px lightgray",children:[(0,i.jsx)(d.X,{size:"md",children:"History"}),(0,i.jsx)(h.L,{}),(0,i.jsx)(nF.h,{variant:"unstyled",icon:(0,i.jsx)(ti.n,{}),"aria-label":"Search database",onClick:()=>{s()}})]}),(0,i.jsx)(l.x,{flex:"1 1 auto",children:n?"Loading...":(null==e?void 0:e.length)===0?(0,i.jsx)(e6.M,{height:"100%",color:"gray.400",children:"No runs"}):(0,i.jsx)(l6.Z,{style:{minHeight:"100%",height:0},children:(e||[]).map((e,n)=>{let t=new Date(e.run_at).toDateString(),l=null!=v&&v!==t;return v=t,(0,i.jsxs)(i.Fragment,{children:[l&&(0,i.jsx)(l9,{runAt:e.run_at},t),(0,i.jsx)(l3,{run:e,isSelected:e.run_id===c,onSelectRun:x,onGoToCheck:g,onAddToChecklist:f},e.run_id)]})})})})]})};var l7=t(5552),re=t(34533);let{definePartsStyle:rn,defineMultiStyleConfig:rt}=(0,re.D)(l7.TB.keys),ri=rt({variants:{circular:rn({control:(0,re.k0)({rounded:"full"})})},sizes:{xs:rn({icon:(0,re.k0)({fontSize:"8px"}),control:(0,re.k0)({boxSize:"16px",padding:"4px"}),label:(0,re.k0)({fontSize:"xs"})})}}),rl=(0,t(86907).fj)({baseStyle:{borderRadius:"4px"}});var rr=t(35051);let rs=()=>{let e=(0,G.p)();return{toastSuccess:n=>{e({description:n,status:"success",variant:"left-accent",position:"bottom-right",duration:5e3,isClosable:!0})},toastError:(n,t)=>{var i,l;e({description:t?t instanceof i4.d7?"".concat(n,". ").concat(null==t?void 0:null===(l=t.response)||void 0===l?void 0:null===(i=l.data)||void 0===i?void 0:i.detail):"".concat(n,". ").concat(t):"".concat(n),status:"error",variant:"left-accent",position:"bottom-right",duration:5e3,isClosable:!0})}}},ro=e=>{(0,j.useEffect)(()=>{let n=e=>{e.preventDefault()};return e&&window.addEventListener("beforeunload",n),()=>{e&&window.removeEventListener("beforeunload",n)}},[e])},ra=()=>{let{fileName:e,cloudMode:n,isDemoSite:t,isLoading:r}=eE(),a=(0,Y.q)(),d=(0,Y.q)(),c=!e&&!n&&!t,{data:u}=(0,y.a)({queryKey:P.checks(),queryFn:n0,enabled:c}),h=void 0!=u&&u.filter(e=>!e.is_preset).length>0;ro(c&&h);let[{newFileName:x,errorMessage:m,modified:p,overwriteWithMethod:f,bypass:g},v]=(0,j.useState)({newFileName:e||"recce_state.json"}),w=(0,j.useRef)(null),{toastSuccess:k,toastError:C}=rs(),_=(0,b.NL)(),S=async(e,n)=>{if(!x)return;let t="true"===localStorage.getItem(iq.bypassSaveOverwrite);try{"save"===e?await lg({filename:x,overwrite:n||t}):await lv({filename:x,overwrite:n||t}),k("save"===e?"Save file successfully":"Rename file successfully"),_.invalidateQueries({queryKey:P.lineage()}),g&&localStorage.setItem(iq.bypassSaveOverwrite,"true")}catch(n){if(n instanceof i4.d7){var i;if((null===(i=n.response)||void 0===i?void 0:i.status)===409){v(n=>({...n,overwriteWithMethod:e})),d.onOpen();return}}C("save"===e?"Save file failed":"Rename file failed",n)}finally{a.onClose()}};return n||t?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(o.k,{flex:"1",justifyContent:"center",alignItems:"center",children:[(0,i.jsx)(l.x,{fontWeight:"600",children:e||(n?"cloud":"New Instance"+(h?" (unsaved)":""))}),(0,i.jsx)(nk.u,{label:e?"Change Filename":"Save",openDelay:1e3,children:(0,i.jsx)(nF.h,{onClick:()=>{v({newFileName:e||"recce_state.json",modified:!e}),a.onOpen()},"aria-label":"",variant:"unstyled",size:"sm",children:(0,i.jsx)(s.J,{as:e?lz:lS,boxSize:"16px",verticalAlign:"middle"})})})]}),(0,i.jsxs)($.u_,{isOpen:a.isOpen,onClose:a.onClose,isCentered:!0,children:[(0,i.jsx)(ee.Z,{}),(0,i.jsxs)(en.h,{children:[(0,i.jsx)(et.x,{children:e?"Change Filename":"Save File"}),(0,i.jsx)(eD.o,{}),(0,i.jsx)(ei.f,{onKeyDown:e=>{e.stopPropagation()},children:(0,i.jsxs)(eM.NI,{isInvalid:!!m,children:[(0,i.jsx)(eA.l,{children:"File name:"}),(0,i.jsx)(nL.I,{ref:w,value:x,placeholder:"Enter filename",onChange:n=>{let t;let i=n.target.value;i?i.endsWith(".json")?/^[a-zA-Z0-9 _-]+\.json$/.test(i)?e&&i===e&&(t="Filename is the same as the current one."):t="Invalid filename. Only alphanumeric, space, _ and - are allowed.":t="Filename must end with .json.":t="Filename cannot be empty.",v(e=>({...e,modified:!0,newFileName:i,errorMessage:t}))},onKeyDown:n=>{"Enter"===n.key?m||(e?S("rename"):S("save")):"Escape"===n.key&&a.onClose()}}),(0,i.jsx)(rr.J1,{children:m})]})}),(0,i.jsxs)(er.m,{gap:"5px",children:[(0,i.jsx)(es.z,{size:"sm",colorScheme:e?void 0:"blue",onClick:()=>{S("save")},isDisabled:!x||!!m||!p,children:e?"Save as New File":"Confirm"}),e&&(0,i.jsx)(es.z,{size:"sm",colorScheme:"blue",onClick:()=>{S("rename")},isDisabled:!x||!!m||!p,children:"Rename"})]})]})]}),(0,i.jsxs)($.u_,{isOpen:d.isOpen,onClose:d.onClose,initialFocusRef:w,isCentered:!0,children:[(0,i.jsx)(ee.Z,{}),(0,i.jsxs)(en.h,{children:[(0,i.jsx)(et.x,{children:"Overwrite File?"}),(0,i.jsx)(eD.o,{}),(0,i.jsxs)(ei.f,{borderTop:"solid 1px lightgray",borderBottom:"solid 1px lightgray",onKeyDown:e=>{e.stopPropagation()},children:[(0,i.jsx)(l.x,{fontSize:"12pt",children:"save"===f?"Saving a file with this name will overwrite the existing file. Are you sure you wish to continue?":"Renaming the file with this name will overwrite the existing file. Are you sure you wish to continue?"}),(0,i.jsx)(nh.X,{isChecked:g,onChange:e=>v(n=>({...n,bypass:e.target.checked})),fontWeight:"bold",size:"sm",pt:"8px",children:"Don't show this again"})]}),(0,i.jsxs)(er.m,{gap:"5px",children:[(0,i.jsx)(es.z,{variant:"outline",onClick:()=>{d.onClose(),a.onOpen(),v(e=>({...e,overwriteWithMethod:void 0}))},size:"sm",children:"Back"}),(0,i.jsx)(es.z,{size:"sm",colorScheme:"blue",onClick:()=>{f&&(S(f,!0),d.onClose())},children:"Overwrite"})]})]})]})]})};var rd=t(2842),rc=t(49624);function ru(){return(0,i.jsx)(nk.u,{label:"Syncing",children:(0,i.jsx)(es.z,{pt:"6px",variant:"unstyled",boxSize:"1em",children:(0,i.jsx)(tU.$,{})})})}function rh(){let[e,n]=(0,j.useState)(!1),t=(0,b.NL)(),[r,o]=(0,eI.TH)(),{isOpen:a,onOpen:d,onClose:c}=(0,Y.q)(),[u,h]=(0,j.useState)(""),x=(0,G.p)(),m=(0,j.useCallback)(async e=>{if(c(),n(!0),"conflict"===(await lw(e)).status){d(),n(!1);return}for(;await lb();)await new Promise(e=>setTimeout(e,1e3));x({description:"Sync Completed",status:"success",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0}),n(!1),h(""),t.invalidateQueries({queryKey:P.lineage()}),t.invalidateQueries({queryKey:P.checks()}),t.invalidateQueries({queryKey:P.runs()}),/^\/checks\/([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/.test(r)&&o("/checks")},[t,r,o,x,d,c]);return e?(0,i.jsx)(ru,{}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nk.u,{label:"Sync with Cloud",children:(0,i.jsx)(nF.h,{size:"sm",variant:"unstyled","aria-label":"Sync state",onClick:()=>m({}),icon:(0,i.jsx)(s.J,{as:lk,verticalAlign:"middle",boxSize:"16px"})})}),(0,i.jsxs)($.u_,{isOpen:a,onClose:c,children:[(0,i.jsx)(ee.Z,{}),(0,i.jsxs)(en.h,{children:[(0,i.jsx)(et.x,{fontSize:"lg",fontWeight:"bold",children:"Sync with Cloud"}),(0,i.jsxs)(ei.f,{children:[(0,i.jsx)(l.x,{children:"New changes have been detected in the cloud. Please choose a method to sync your state"}),(0,i.jsx)(l.x,{mt:"5px",children:(0,i.jsx)(rd.E,{onChange:h,value:u,children:(0,i.jsxs)(tN.K,{direction:"column",children:[(0,i.jsxs)(rc.Y,{value:"merge",children:["Merge",(0,i.jsx)(nk.u,{label:"This will merge the local and remote states.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.J,{as:i7.h,ml:2,cursor:"pointer"})})})]}),(0,i.jsxs)(rc.Y,{value:"overwrite",children:["Overwrite",(0,i.jsx)(nk.u,{label:"This will overwrite the remote state file with the local state.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.J,{as:i7.h,ml:2,cursor:"pointer"})})})]}),(0,i.jsxs)(rc.Y,{value:"revert",children:["Revert",(0,i.jsx)(nk.u,{label:"This will discard local changes and revert to the cloud state.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.J,{as:i7.h,ml:2,cursor:"pointer"})})})]})]})})})]}),(0,i.jsxs)(er.m,{children:[(0,i.jsx)(es.z,{onClick:c,mr:3,children:"Cancel"}),(0,i.jsx)(es.z,{colorScheme:"blue",onClick:()=>m({method:u}),isDisabled:!u,children:"Sync"})]})]})]})]})}let rx=e=>{let{children:n,path:t}=e,[r]=(0,eI.yj)(t);return(0,i.jsx)(l.x,{display:r?"block":"none",height:"100%",children:n})};function rm(e){let{icon:n,href:t,...l}=e;return(0,i.jsx)(r.r,{height:"20px",color:"white",href:t,isExternal:!0,...l,children:(0,i.jsx)(s.J,{color:"white",boxSize:"20px",as:n})})}function rp(){let{reviewMode:e,isDemoSite:n,envInfo:t,cloudMode:x,isLoading:m}=eE(),p=function(){let[e,n]=(0,j.useState)("");return(0,j.useEffect)(()=>{(async function(){try{let e=await U.get("/api/version");n(e.data)}catch(e){console.error("Error fetching version number:",e)}})()},[]),e}(),{url:f,id:g}=(null==t?void 0:t.pullRequest)||{},v=f?f.split("/").pop():null;return(0,i.jsxs)(o.k,{gap:"10px",minHeight:"40px",alignItems:"center",bg:"rgb(255, 110, 66)",children:[(0,i.jsx)(a.E,{boxSize:"20px",ml:"18px",src:"/logo/recce-logo-white.png",alt:"recce-logo-white"}),(0,i.jsx)(d.X,{as:"h1",fontFamily:'"Montserrat", sans-serif',fontSize:"lg",color:"white",children:"RECCE"}),(0,i.jsx)(c.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:p}),e&&(0,i.jsx)(c.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:"review mode"}),x&&(0,i.jsx)(c.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:(0,i.jsxs)(u.U,{children:[(0,i.jsx)(l.x,{children:"cloud mode"}),(0,i.jsx)(l.x,{borderLeft:"1px",borderLeftColor:"whiteAlpha.500",paddingLeft:"8px",children:(0,i.jsxs)(r.r,{href:f,_hover:{textDecoration:"none"},isExternal:!0,children:[(0,i.jsx)(s.J,{as:e7.X9P,boxSize:"3",fontWeight:"extrabold",strokeWidth:"1"})," #".concat(g)]})})]})}),n&&f&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(c.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:(0,i.jsxs)(u.U,{children:[(0,i.jsx)(l.x,{children:"demo mode"}),(0,i.jsx)(l.x,{borderLeft:"1px",borderLeftColor:"whiteAlpha.500",paddingLeft:"8px",children:(0,i.jsxs)(r.r,{href:f,_hover:{textDecoration:"none"},isExternal:!0,children:[(0,i.jsx)(s.J,{as:e7.X9P,boxSize:"3",fontWeight:"extrabold",strokeWidth:"1"})," #".concat(v)]})})]})})}),(0,i.jsx)(h.L,{}),(0,i.jsx)(rm,{icon:tk.hJX,href:"https://github.com/DataRecce/recce"}),(0,i.jsx)(rm,{icon:tk.w5k,href:"https://getdbt.slack.com/archives/C05C28V7CPP"}),(0,i.jsx)(rm,{mr:"18px",icon:tk.MXt,href:"https://datarecce.io/docs"})]})}function rf(e){let{queryKey:n,fetchCallback:t,selectCallback:r}=e,{data:s,isLoading:o,error:a}=(0,y.a)({queryKey:n,queryFn:t,select:r});return o||a||0===s?(0,i.jsx)(i.Fragment,{}):(0,i.jsx)(l.x,{ml:"2px",height:"80%",aspectRatio:1,borderRadius:"full",bg:"tomato",alignContent:"center",color:"white",fontSize:"xs",children:s})}function rg(){let{isDemoSite:e,reviewMode:n,fileMode:t,cloudMode:r,isLoading:s}=eE(),[a,d]=(0,eI.TH)(),{data:c,isLoading:u}=ej(),h=(0,i.jsx)(rf,{queryKey:P.checks(),fetchCallback:n0,selectCallback:e=>e.filter(e=>!e.is_checked).length}),f=[{name:"Lineage",href:"/lineage"},{name:"Query",href:"/query",disable:(null==c?void 0:c.single_env_onboarding)===!0},{name:"Checklist",href:"/checks",badge:h,disable:(null==c?void 0:c.single_env_onboarding)===!0}],g=eN().findIndex(f,e=>{let{href:n}=e;return a.startsWith(n)});return(0,i.jsx)(x.m,{index:g,children:(0,i.jsxs)(m.t,{children:[(0,i.jsx)(l.x,{flex:"1",display:"flex",children:f.map(e=>{let{name:n,href:t,badge:l,disable:r}=e;return(0,i.jsxs)(p.O,{onClick:()=>{d(t)},isDisabled:s||u||r,hidden:r,children:[n,l]},n)})}),!s&&!e&&(0,i.jsx)(ra,{}),!s&&(0,i.jsxs)(o.k,{flex:"1",justifyContent:"right",alignItems:"center",mr:"8px",children:[r&&(0,i.jsx)(rh,{}),(0,i.jsx)(lW,{}),(0,i.jsx)(l0,{})]})]})})}function rv(){let{isRunResultOpen:e,isHistoryOpen:n,closeRunResult:t}=nX(),[r]=(0,eI.TH)(),s=e&&!r.startsWith("/checks"),o=n&&!r.startsWith("/checks");return(0,i.jsxs)(ty,{sizes:[0,100],minSize:o?300:0,gutterSize:o?5:0,style:{height:"100%"},children:[(0,i.jsx)(l.x,{style:{contain:"size"},children:o&&(0,i.jsx)(l8,{})}),(0,i.jsxs)(tb,{sizes:s?[50,50]:[100,0],minSize:s?100:0,gutterSize:s?5:0,style:{flex:"1",contain:"size"},children:[(0,i.jsx)(l.x,{p:0,style:{contain:"content"},children:(0,i.jsxs)(lP,{children:[(0,i.jsx)(rx,{path:"/lineage",children:(0,i.jsx)(l1,{})}),(0,i.jsxs)(eI.rs,{children:[(0,i.jsx)(eI.AW,{path:"/query",children:(0,i.jsx)(lO,{})}),(0,i.jsx)(eI.AW,{path:"/checks/:slug*",children:(0,i.jsx)(lT,{})}),(0,i.jsx)(eI.AW,{path:"/runs/:runId",children:e=>{let{runId:n}=e;return(0,i.jsx)(lV,{runId:n})}}),(0,i.jsx)(eI.AW,{path:"/ssr",children:(0,i.jsx)(f.E,{size:"xs",isIndeterminate:!0})}),(0,i.jsx)(eI.AW,{children:(0,i.jsx)(eI.l_,{to:"/lineage"})})]})]})}),s?(0,i.jsx)(i_,{onClose:t}):(0,i.jsx)(l.x,{})]})]})}let rj=(0,g.B1)({components:{Checkbox:ri,Tooltip:rl}});function ry(){(0,j.useLayoutEffect)(()=>{!function(){var e;let n=(e=document.cookie.match("(^|;)\\s*recce_user_id\\s*=\\s*([^;]+)"))?e.pop():"",t=eb.env.AMPLITUDE_API_KEY;if(n&&t)try{ey.S1(t,n,{defaultTracking:!0})}catch(e){console.error(e)}}()},[]);let e=(0,lq.Z)({components:{MuiTooltip:{styleOverrides:{tooltip:{zIndex:1500}}}}});return(0,i.jsx)(lN.Z,{theme:e,children:(0,i.jsx)(v.x,{theme:rj,children:(0,i.jsx)(b.aH,{client:Z,children:(0,i.jsx)(eI.F0,{hook:lF,children:(0,i.jsx)(nG,{children:(0,i.jsxs)(o.k,{direction:"column",height:"100vh",overflow:"hidden",children:[(0,i.jsx)(rp,{}),(0,i.jsx)(rg,{}),(0,i.jsx)(l4,{}),(0,i.jsx)(rv,{})]})})})})})})}},76890:function(){},24550:function(){},50394:function(){},5637:function(){}},function(e){e.O(0,[887,524,434,678,509,648,989,147,995,739,283,303,22,25,355,495,599,852,342,868,986,744],function(){return e(e.s=17812)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/recce/data/index.html b/recce/data/index.html index 0a97bb35..4d4b1704 100644 --- a/recce/data/index.html +++ b/recce/data/index.html @@ -1,4 +1,4 @@ -recce
\ No newline at end of file + );position:absolute;will-change:left;min-width:50%;-webkit-animation:animation-11lmxjq 1s ease infinite normal none running;animation:animation-11lmxjq 1s ease infinite normal none running;}@-webkit-keyframes animation-11lmxjq{0%{left:-40%;}100%{left:100%;}}@keyframes animation-11lmxjq{0%{left:-40%;}100%{left:100%;}}
\ No newline at end of file diff --git a/recce/data/index.txt b/recce/data/index.txt index 556b0b25..c5d1d13f 100644 --- a/recce/data/index.txt +++ b/recce/data/index.txt @@ -1,7 +1,7 @@ 2:I[82166,[],"ClientPageRoot"] -3:I[54965,["524","static/chunks/b3b1872b-e5ac1f14fd5c040d.js","434","static/chunks/868e7b5c-f244e4ff6d201ea8.js","678","static/chunks/3998a672-55d3975818c039a5.js","509","static/chunks/9746af58-3a12a5688039fb9e.js","648","static/chunks/ce84277d-0ae0df11a5beb07d.js","989","static/chunks/47d8844f-f1ef5757545c75a9.js","147","static/chunks/a30376cd-b0ad3a3f94c6cfa4.js","995","static/chunks/fee69bc6-008eb7a49187c959.js","739","static/chunks/7a8a3e83-0a492369cd7e6c86.js","283","static/chunks/450c323b-ddc3205cc50e4203.js","303","static/chunks/36e1c10d-096713435a412a0f.js","22","static/chunks/29e3cc0d-7166b707facd10f5.js","25","static/chunks/b63b1b3f-45ad63018b7dfcb2.js","355","static/chunks/7f27ae6c-e4cacad6123988ae.js","495","static/chunks/6dc81886-bb4fdd2823d4beed.js","599","static/chunks/c132bf7d-36936b5b78b3f198.js","852","static/chunks/cf0511cf-0d87390843390eca.js","342","static/chunks/342-1122f9fbfe7e8f5b.js","931","static/chunks/app/page-5889dcf26b2ed99d.js"],"default",1] +3:I[24790,["524","static/chunks/b3b1872b-e5ac1f14fd5c040d.js","434","static/chunks/868e7b5c-f244e4ff6d201ea8.js","678","static/chunks/3998a672-55d3975818c039a5.js","509","static/chunks/9746af58-3a12a5688039fb9e.js","648","static/chunks/ce84277d-0ae0df11a5beb07d.js","989","static/chunks/47d8844f-f1ef5757545c75a9.js","147","static/chunks/a30376cd-b0ad3a3f94c6cfa4.js","995","static/chunks/fee69bc6-008eb7a49187c959.js","739","static/chunks/7a8a3e83-0a492369cd7e6c86.js","283","static/chunks/450c323b-ddc3205cc50e4203.js","303","static/chunks/36e1c10d-096713435a412a0f.js","22","static/chunks/29e3cc0d-7166b707facd10f5.js","25","static/chunks/b63b1b3f-45ad63018b7dfcb2.js","355","static/chunks/7f27ae6c-e4cacad6123988ae.js","495","static/chunks/6dc81886-bb4fdd2823d4beed.js","599","static/chunks/c132bf7d-36936b5b78b3f198.js","852","static/chunks/cf0511cf-0d87390843390eca.js","342","static/chunks/342-1122f9fbfe7e8f5b.js","931","static/chunks/app/page-6acdd1379ad0ae37.js"],"default",1] 4:I[88691,[],""] 5:I[35065,[],""] -0:["KkYyE-Oc1zHufcA9YaMO3",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/1d7428fe54fca42f.css","precedence":"next","crossOrigin":"$undefined"}]]],null],null]},[[null,["$","html",null,{"lang":"en","children":["$","body",null,{"suppressHydrationWarning":true,"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]}]}]],null],null],["$L6",null]]]] +0:["Vafzy2DPUUgyzh92-XPET",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/1d7428fe54fca42f.css","precedence":"next","crossOrigin":"$undefined"}]]],null],null]},[[null,["$","html",null,{"lang":"en","children":["$","body",null,{"suppressHydrationWarning":true,"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]}]}]],null],null],["$L6",null]]]] 6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"recce"}],["$","meta","3",{"name":"description","content":"Recce: Data validation toolkit for comprehensive PR review"}],["$","link","4",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"32x32"}]] 1:null