recce-nightly 0.60.0.20250330__py3-none-any.whl → 0.60.0.20250401__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of recce-nightly might be problematic. Click here for more details.

@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{97756:function(e,n,t){Promise.resolve().then(t.bind(t,37656))},37656:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return l1}});var i=t(34580),r=t(17872),l=t(57585),s=t(79967),o=t(911),a=t(83562),c=t(36324),d=t(34929),u=t(30069),h=t(46770),x=t(81249),m=t(81920),p=t(76558),f=t(64087),g=t(59705),j=t(81776),v=t(87064),y=t(82390),b=t(88885),w=t(11260),k=t(81440);let C='select * from {{ ref("mymodel") }}',_=(0,b.createContext)({sqlQuery:C,setSqlQuery:()=>{},primaryKeys:void 0,setPrimaryKeys:()=>{},isCustomQueries:!1,setCustomQueries:()=>{},baseSqlQuery:C,setBaseSqlQuery:()=>{}});function S(e){let{children:n}=e,[t,r]=b.useState(C),[l,s]=b.useState(C),[o,a]=b.useState(!1),[c,d]=b.useState();return(0,i.jsx)(_.Provider,{value:{setSqlQuery:r,sqlQuery:t,setPrimaryKeys:d,primaryKeys:c,isCustomQueries:o,setCustomQueries:a,baseSqlQuery:l,setBaseSqlQuery:s},children:n})}let z=()=>(0,b.useContext)(_),R=(0,b.createContext)({isNodesFetching:[],setIsNodesFetching:()=>{}});function L(e){let{children:n}=e,[t,r]=b.useState([]);return(0,i.jsx)(R.Provider,{value:{isNodesFetching:t,setIsNodesFetching:r},children:n})}var I=t(30978);function E(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=new Set,r={},l=(e,t)=>{if(!(t<0)&&(null==r[e]||!(r[e]>=t))){for(let i of(r[e]=t,n(e)))l(i,t-1);i.add(e)}};for(let n of e)l(n,t);return i}function T(){for(var e=arguments.length,n=Array(e),t=0;t<e;t++)n[t]=arguments[t];let i=new Set;return n.forEach(e=>{e.forEach(e=>{i.add(e)})}),i}var D=t(30098),O=t.n(D);function M(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 A(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 F(e,n,t,i){let r=[],l=[],s=t&&null!=i?function(e,n,t){let i={},r={},l="".concat(e,"_").concat(n);for(let e of Object.values(t.current.nodes)){var s;let n=e.id;if(n)for(let t of Object.values(null!==(s=e.columns)&&void 0!==s?s:{})){let e="".concat(n,"_").concat(t.name);for(let n of(i[e]=[],t.depends_on||[])){let t="".concat(n.node,"_").concat(n.column);i[e].push(t),t in r||(r[t]=[]),r[t].push(e)}}}return T(function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;return E(e,e=>e in r?r[e]:[],n)}([l]),function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;return E(e,e=>e in i?i[e]:[],n)}([l]))}(t.node,t.column,i):new Set,o={};function a(e){return"base"===e?0:"current"===e?2:1}function c(e,n){let t=a(e.from),i=a(n.from);return t<i?-1:t>i?1:0}let d=void 0!==n?new Set(n):void 0;for(let n of Object.values(e.nodes).sort(c)){if(d&&!d.has(n.id))continue;let e=new Set,t=0;if((null==i?void 0:i.current.nodes)&&n.id in i.current.nodes){var u;for(let o of Object.values(null!==(u=i.current.nodes[n.id].columns)&&void 0!==u?u:{})){let i="".concat(n.id,"_").concat(o.name);if(s.has(i)){for(let e of(r.push({id:i,position:{x:10,y:70+15*t},parentId:n.id,extent:"parent",draggable:!1,data:{node:n,column:o.name,type:o.type,transformationType:o.transformation_type},style:{zIndex:9999},type:"customColumnNode",targetPosition:I.Ly.Left,sourcePosition:I.Ly.Right}),o.depends_on||[])){let n="".concat(e.node,"_").concat(e.column);s.has(n)&&l.push({id:"".concat(n,"_").concat(i),source:n,target:i,style:{zIndex:9999}})}t++,e.add(i)}}}o[n.id]=e,r.push({id:n.id,position:{x:0,y:0},width:300,height:36+15*t,data:{...n},type:"customNode",targetPosition:I.Ly.Left,sourcePosition:I.Ly.Right})}for(let n of Object.values(e.edges).sort(c))(!d||d.has(n.parent.id)&&d.has(n.child.id))&&l.push({id:n.id,type:"customEdge",source:n.parent.id,target:n.child.id,data:n});return N(r,l),[r,l,o]}let N=function(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"LR",i=new(O()).graphlib.Graph;i.setDefaultEdgeLabel(()=>({})),i.setGraph({rankdir:t}),e.forEach(e=>{"customNode"===e.type&&i.setNode(e.id,{width:e.width,height:e.height})}),n.forEach(e=>{i.setEdge(e.source,e.target)}),O().layout(i),e.forEach(e=>{if("customNode"!==e.type)return;let n=e.width||300,t=e.height||36,r=i.node(e.id);return e.position={x:r.x-n/2,y:r.y-t/2},e})},q={lineage:()=>["lineage"],checks:()=>["checks","list"],check:e=>["checks",e],runs:()=>["runs"],run:e=>["runs",e],runsAggregated:()=>["runs_aggregated"],flag:()=>["flag"]};var H=t(58243),V=t(82752);let P=V.env.NEXT_PUBLIC_API_URL?V.env.NEXT_PUBLIC_API_URL:window.location.origin;var W=t(52226);let K=H.default.create({baseURL:P}),J=new W.S;async function B(){return(await K.get("/api/info")).data}async function U(e){return(await K.get("/api/model/".concat(e))).data}var Q=t(77754),Z=t(96970),X=t(21086),G=t(49944),Y=t(13759),$=t(30214),ee=t(77676),en=t(57710),et=t(91785),ei=t(57918),er=t.n(ei),el=t(90109);function es(e){el.j("[Web] multi_nodes_action",e)}function eo(e){el.j("[Web] history_action",e)}function ea(e){el.j("[Experiment] preview_change",e)}function ec(e){el.j("[Experiment] preview_change",e)}function ed(e){el.j("[Experiment] single_environment",e)}function eu(e){el.j("[Experiment] recommend_preset_check",e)}let eh=!1;async function ex(e,n,t){let i=eh?{breaking_change_analysis:!0}:{};return(await K.post("/api/runs",{type:e,params:n,nowait:null==t?void 0:t.nowait,track_props:i})).data}async function em(e,n){return(await K.get("/api/runs/".concat(e,"/wait"),{params:{timeout:n}})).data}async function ep(e){return await K.post("/api/runs/".concat(e,"/cancel"))}async function ef(e,n){return(await K.post("/api/checks/".concat(e,"/run"),{nowait:null==n?void 0:n.nowait})).data}async function eg(e,n,t){return(await K.post("/api/runs/search",{type:e,params:n,limit:t})).data}async function ej(){return(await K.get("/api/runs")).data}async function ev(){return(await K.post("/api/runs/aggregate",{})).data}async function ey(){return(await K.get("/api/flag")).data}async function eb(){try{await K.post("/api/onboarding/completed")}catch(e){}}async function ew(){try{await K.post("/api/relaunch-hint/completed")}catch(e){}}let ek=()=>(0,w.a)({queryKey:q.flag(),queryFn:ey}),eC=(0,b.createContext)({isActionAvailable:()=>!0});function e_(e){var n;let{children:t}=e,r=(0,w.a)({queryKey:q.lineage(),queryFn:B}),l=(0,w.a)({queryKey:q.runsAggregated(),queryFn:ev}),s=(0,b.useMemo)(()=>{var e;let n=null===(e=r.data)||void 0===e?void 0:e.lineage;if((null==n?void 0:n.base)&&n.current)return function(e,n,t){let i={},r={},l=(e,n)=>({id:e,name:e,data:{},from:n,parents:{},children:{}});for(let[n,t]of Object.entries(e.nodes))i[n]=l(n,"base"),t&&(i[n].data.base=t,i[n].name=t.name,i[n].resourceType=t.resource_type,i[n].packageName=t.package_name);for(let[e,t]of Object.entries(n.nodes))i[e]?i[e].from="both":i[e]=l(e,"current"),t&&(i[e].data.current=n.nodes[e],i[e].name=t.name,i[e].resourceType=t.resource_type,i[e].packageName=t.package_name);for(let[n,t]of Object.entries(e.parent_map))for(let e of t){let t=i[n],l=i[e],s="".concat(e,"_").concat(n);if(!t||!l)continue;r[s]={id:s,from:"base",parent:l,child:t};let o=r[s];t.parents[e]=o,l.children[n]=o}for(let[e,t]of Object.entries(n.parent_map))for(let n of t){let t=i[e],l=i[n],s="".concat(n,"_").concat(e);if(!t||!l)continue;r[s]?r[s].from="both":r[s]={id:s,from:"current",parent:l,child:t};let o=r[s];t.parents[n]=o,l.children[e]=o}let s=[],o=[],a=[];for(let[e,n]of Object.entries(i))if(t){let i=t[e];i&&(n.changeStatus=i.change_status,s.push(e),"non-breaking"===i.change_category?o.push(e):a.push(e))}else if("base"===n.from)n.changeStatus="removed",s.push(n.id);else if("current"===n.from)n.changeStatus="added",s.push(n.id);else{var c,d,u,h;let t=null===(d=n.data.base)||void 0===d?void 0:null===(c=d.checksum)||void 0===c?void 0:c.checksum,i=null===(h=n.data.current)||void 0===h?void 0:null===(u=h.checksum)||void 0===u?void 0:u.checksum;t&&i&&t!==i&&(n.changeStatus="modified",s.push(n.id),a.push(e))}for(let[e,n]of Object.entries(r))"base"===n.from?n.changeStatus="removed":"current"===n.from&&(n.changeStatus="added");let x=T(new Set(s),E(a,e=>void 0===i[e]?[]:Object.keys(i[e].children)));return{nodes:i,edges:r,modifiedSet:s,nonBreakingSet:new Set(o),impactedSet:x,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,n.diff)},[r.data]),a=null===(n=r.error)||void 0===n?void 0:n.message,{lineage:c,sqlmesh:d,demo:u,review_mode:h,cloud_mode:x,file_mode:m,filename:p,adapter_type:f,git:g,pull_request:j,support_tasks:v}=r.data||{},y=null==c?void 0:c.base.manifest_metadata,C=null==c?void 0:c.current.manifest_metadata,{connectionStatus:_,connect:S,envStatus:z}=function(){let e=(0,o.p)(),n=(0,b.useRef)({ws:void 0,status:"pending"}),[t,i]=(0,b.useState)("pending"),[r,l]=(0,b.useState)(void 0);n.current.status=t;let s=(0,k.NL)(),a=()=>{s.invalidateQueries({queryKey:q.lineage()}),s.invalidateQueries({queryKey:q.checks()}),s.invalidateQueries({queryKey:q.runs()})},c=()=>{let t=new WebSocket("".concat(P.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&&a(),i("connected");return}try{let n=JSON.parse(t.data);if("refresh"===n.command){let{eventType:t,srcPath:i}=n.event,[r,l]=i.split("/").slice(-2),s=er().parse(l).name,o="".concat(r,"-").concat(s,"-").concat(t);e.isActive(o)||e({id:o,description:"Detected ".concat(r," ").concat(s," ").concat(t),status:"info",variant:"left-accent",position:"bottom-right",duration:5e3,isClosable:!0}),a()}else"relaunch"===n.command&&l("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,b.useEffect)(()=>{let e=n.current;return c(),()=>{e.ws&&e.ws.close()}},[]),{connectionStatus:t,connect:c,envStatus:r}}(),{data:R,isLoading:L}=ek(),{onClose:I}=(0,Q.q)(),[D,O]=(0,b.useState)(!1),M=(0,k.NL)(),A=(0,b.useCallback)(e=>{if(v){var n;return null===(n=v[e])||void 0===n||n}return!0},[v]);return(0,b.useEffect)(()=>{L||("relaunch"===z&&(null==R?void 0:R.single_env_onboarding)&&R.show_relaunch_hint?(O(!0),ed({action:"target_base_added"})):O(!1))},[R,z,L]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(eC.Provider,{value:{lineageGraph:s,retchLineageGraph:()=>{l.refetch()},envInfo:{adapterType:f,git:g,pullRequest:j,dbt:{base:y,current:C},sqlmesh:d},reviewMode:h,cloudMode:x,fileMode:m,fileName:p,isDemoSite:u,error:a,supportTasks:v,isActionAvailable:A,isLoading:r.isLoading,runsAggregated:l.data,refetchRunsAggregated:()=>{l.refetch()}},children:t}),(0,i.jsxs)(Z.u_,{isOpen:"disconnected"===_,onClose:()=>{},isCentered:!0,children:[(0,i.jsx)(X.Z,{}),(0,i.jsxs)(G.h,{children:[(0,i.jsx)(Y.x,{children:"Server Disconnected"}),(0,i.jsx)($.f,{children:(0,i.jsx)(ee.x,{children:"The server connection has been lost. Please restart the Recce server and try again."})}),(0,i.jsx)(en.m,{children:(0,i.jsx)(et.z,{colorScheme:"blue",onClick:()=>{S()},children:"Retry"})})]})]}),(null==R?void 0:R.single_env_onboarding)&&(0,i.jsxs)(Z.u_,{isOpen:D,onClose:()=>{I(),ew(),M.invalidateQueries({queryKey:q.flag()})},isCentered:!0,children:[(0,i.jsx)(X.Z,{}),(0,i.jsxs)(G.h,{children:[(0,i.jsx)(Y.x,{children:"Target-base Added"}),(0,i.jsx)($.f,{children:(0,i.jsx)(ee.x,{children:"Please restart the Recce server."})}),(0,i.jsx)(en.m,{children:(0,i.jsx)(et.z,{colorScheme:"blue",onClick:()=>{I(),ew(),M.invalidateQueries({queryKey:q.flag()})},children:"Got it!"})})]})]})]})}let eS=()=>(0,b.useContext)(eC),ez=()=>{let{runsAggregated:e,refetchRunsAggregated:n}=eS();return[e,n]};var eR=t(33979);let eL=e=>{let{isOpen:n,onClose:t,onExecute:l,type:s,title:o,params:a,RunForm:c}=e,[u,h]=(0,b.useState)(a),[x,m]=(0,b.useState)(!1);return(0,i.jsxs)(Z.u_,{isOpen:n,onClose:t,size:"6xl",scrollBehavior:"inside",children:[(0,i.jsx)(X.Z,{}),(0,i.jsxs)(G.h,{overflowY:"auto",height:"75%",minHeight:"400px",children:[(0,i.jsx)(Y.x,{children:o}),(0,i.jsx)(eR.o,{}),(0,i.jsx)($.f,{p:"0px",h:"100%",overflow:"auto",borderY:"1px solid lightgray",children:(0,i.jsx)(r.x,{style:{contain:"layout"},children:c&&(0,i.jsx)(c,{params:u,onParamsChanged:h,setIsReadyToExecute:m})})}),(0,i.jsx)(en.m,{children:(0,i.jsx)(d.k,{gap:"10px",children:(0,i.jsx)(et.z,{isDisabled:!x,colorScheme:"blue",onClick:()=>{l(s,u)},children:"Execute"})})})]})]})};var eI=t(97809),eE=t(52554),eT=t(19238),eD=t(85285),eO=t(9322),eM=t(4798),eA=t.n(eM);function eF(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 eN=e=>{var n;let{lineageGraph:t}=eS(),[i,r]=(0,b.useState)([]),[l,s]=(0,b.useState)(),[o,a]=(0,b.useState)(!0),[c,d]=(0,b.useState)(null),u=eA().find(null==t?void 0:t.nodes,{name:e}),h=(0,b.useMemo)(()=>u?function(e){function n(e){return(null==e?void 0:e.columns)?Object.values(e.columns):[]}return eF(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,m=(0,b.useCallback)(async()=>{try{let e=(await U(null==u?void 0:u.id)).model;if(!e.base.columns||!e.current.columns){r([]);return}s(e.current.primary_key);let n=Object.values(e.base.columns),t=Object.values(e.current.columns);r(eF(n,t))}catch(e){d(e)}},[null==u?void 0:u.id]);return(0,b.useEffect)(()=>{h.length>0?(r(h),s(x)):(null==u?void 0:u.id)===void 0?r([]):m().catch(e=>{}),a(!1)},[m,null==u?void 0:u.id,h,x]),{columns:i,primaryKey:l,isLoading:o,error:c}};function eq(e){let n=e.trim().toUpperCase();return!!["CHAR","VARCHAR","TINYTEXT","TEXT","MEDIUMTEXT","LONGTEXT","NCHAR","NVARCHAR","VARCHAR2","NVARCHAR2","CLOB","NCLOB","VARCHAR(MAX)","XML","JSON"].includes(n)||/^(VARCHAR|NVARCHAR|VARCHAR2|NVARCHAR2|CHAR|NCHAR)\(\d+\)$/.test(n)}function eH(e){return["BOOLEAN","TINYINT(1)","BIT","NUMBER(1)","BOOL"].includes(e.toUpperCase())}function eV(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 eP=t(82949),eW=t(463),eK=t(66769);function eJ(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 eB(e){if("number"!=typeof e)return e;{let n=Math.abs(e),t=n>=.01,i=n>=1e6,r=n>=1e9,l=n>=1e15;if(l||n>=1e12)return new Intl.NumberFormat("en-US",{style:"unit",unit:"liter",unitDisplay:"narrow",maximumFractionDigits:l?0:2}).format(e/1e12).replace("L","T");if(r||i||n>=1e3){let n={base:r?1e9:i?1e6:1e3,unit:r?"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 eU="#63B3ED",eQ="#F6AD55",eZ="".concat(eU,"A5"),eX="".concat(eQ,"A5");function eG(e){let{color:n}=e;return(0,i.jsx)(r.x,{display:"inline-block",w:"10px",h:"10px",bgColor:n,mr:"2",borderRadius:"sm"})}function eY(e){let{data:n,hideAxis:t=!1,animation:r=!1}=e;eW.kL.register(eW.ZL,eW.RM,eW.f$,eW.uw,eW.Dx,eW.De,eW.u);let l=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:r,type:l,samples:s=0,binEdges:o}=e,[a,c]=r,d="datetime"===l;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=e0(o,n);return"".concat(d?"Date Range":"string"===l?"Text Length":"Value Range","\n").concat(i)},label(e){let{datasetIndex:n,dataIndex:t,dataset:{label:i}}=e,r=0===n?c.counts:a.counts,l=eJ(r[t]/s),o=r[t];return"".concat(i,": ").concat(o," (").concat(l,")")}}}},scales:function(e){let{datasets:n,min:t=0,max:i=0,type:r,binEdges:l}=e,s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],[o,a]=n,c=Math.max(...a.counts,...o.counts),d=l.map((e,n)=>e0(l,n)).slice(0,-1);return{x:"datetime"===r?{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)=>d[n]},stacked:!0},y:{display:!s,type:"linear",max:c,border:{dash:[2,2]},grid:{color:"lightgray"},ticks:{maxTicksLimit:8,callback:function(e,n){return eB(e)}},beginAtZero:!0}}}(e,n),...t}}(n,t,{animation:r}),s=function(e){let{datasets:n,type:t,binEdges:i}=e,[r,l]=n,s=e$(t,i,"Current",eZ,l),o=e$(t,i,"Base",eX,r);return{labels:i.map((e,n)=>e0(i,n)).slice(0,-1),datasets:[s,o]}}(n);return(0,i.jsx)(eK.kL,{type:"bar",options:l,data:s,plugins:[]})}function e$(e,n,t,i,r){let{counts:l=[]}=r;return{label:t,data:"datetime"===e?l.map((e,t)=>({x:n[t],y:e})):l,backgroundColor:i,borderColor:i,hoverBackgroundColor:i,borderWidth:0,categoryPercentage:1,barPercentage:1,xAxisID:"x"}}function e0(e,n){let t=e[n],i=e[n+1],r=eB(t),l=eB(i);return"".concat(r," - ").concat(l)}let e1=(0,eP.G)((e,n)=>{let{backgroundColor:t="white",blockSize:l,children:s,...o}=e;return(0,i.jsx)(r.x,{ref:n,...o,overflowY:"auto",overflowX:"hidden",children:(0,i.jsx)(r.x,{backgroundColor:t,height:"100%",blockSize:l,children:s})})}),e5=(0,eP.G)(function(e,n){var t,l,s,o,a,c;let{run:u}=e,h=u.params,p=null===(t=u.result)||void 0===t?void 0:t.base,f=null===(l=u.result)||void 0===l?void 0:l.current,g=null===(s=u.result)||void 0===s?void 0:s.min,j=null===(o=u.result)||void 0===o?void 0:o.max,v=null===(a=u.result)||void 0===a?void 0:a.bin_edges;return p&&f?(0,i.jsx)(d.k,{direction:"column",height:"100%",children:(0,i.jsx)(e1,{ref:n,height:"100%",children:(0,i.jsxs)(x.U,{children:[(0,i.jsx)(m.L,{}),(0,i.jsx)(r.x,{w:"80%",h:"35vh",m:"4",children:(0,i.jsx)(eY,{data:{title:"Model ".concat(h.model,".").concat(h.column_name),type:(null===(c=u.params)||void 0===c?void 0:c.column_type)||"",datasets:[p,f],min:g,max:j,samples:p.total,binEdges:v}})}),(0,i.jsx)(m.L,{})]})})}):(0,i.jsx)("div",{children:"Loading..."})});var e2=t(42385);t(88810);var e4=t(11);let e6=(0,eP.G)((e,n)=>{let{...t}=e;return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(e4.ZP,{ref:n,...t})})});function e3(e){let{emptyMessage:n}=e;return(0,i.jsx)(d.k,{h:"35px",alignItems:"center",justifyContent:"center",bg:"gray.100",style:{textAlign:"center",gridColumn:"1/-1"},children:(0,i.jsxs)(ee.x,{fontWeight:"600",children:[" ",n||"No rows"]})})}t(95586);var e9=t(12599);function e8(e,n){let t=function(e,n){let t=[...e],i=[...n],r=[];for(;t.length>0&&i.length>0;)if(r.includes(t[0]))t.shift();else if(r.includes(i[0]))i.shift();else if(t[0]===i[0])r.push(t[0]),t.shift(),i.shift();else if(i.includes(t[0])){let e=i.indexOf(t[0]);for(let n=0;n<e;n++)r.includes(i[n])||r.push(i[n]);r.push(t[0]),t.shift(),i.splice(0,e+1)}else r.push(t[0]),t.shift();return t.forEach(e=>{r.includes(e)||r.push(e)}),i.forEach(e=>{r.includes(e)||r.push(e)}),r}(e,n),i={};for(let r of t)e.includes(r)?n.includes(r)?i[r]=void 0:i[r]="removed":i[r]="added";let r={};e.forEach((e,n)=>{r[e]=n});let l=-1;for(let e of t){let n=r[e];null!=n&&(n>l?l=n:i[e]="reordered")}return i}var e7=t(57403),ne=t(24613),nn=t(46754);let nt=e=>{let{value:n,colorScheme:t,grayOut:l,noCopy:s,fontSize:o}=e,{onCopy:a,hasCopied:c}=(0,ne.V)(n),[u,h]=(0,b.useState)(!1);return(0,i.jsxs)(d.k,{p:"2px 5px",minWidth:"30px",maxWidth:"200px",overflow:"hidden",textOverflow:"ellipsis",color:"".concat(t,".800"),backgroundColor:"".concat(t,".100"),alignItems:"center",gap:"2px",rounded:"md",fontSize:o,flexShrink:s?"0":"inherit",onMouseEnter:()=>{h(!0)},onMouseLeave:()=>{h(!1)},children:[(0,i.jsx)(r.x,{overflow:"hidden",textOverflow:"ellipsis",color:l?"gray":"inherit",children:n}),(0,i.jsx)(()=>s||l?(0,i.jsx)(i.Fragment,{}):c?(0,i.jsx)(i.Fragment,{children:"Copied"}):u?(0,i.jsx)(nn.h,{"aria-label":"Copy",icon:(0,i.jsx)(e7.T,{boxSize:"10px"}),size:"xs",minW:"10px",h:"10px",variant:"unstyled",onClick:a,display:"flex",alignItems:"center",justifyContent:"center"}):(0,i.jsx)(i.Fragment,{}),{})]})};function ni(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 nr(e,n,t){let i={};if(0===n.length)return JSON.stringify({_index:t._index});for(let r of n)i[e[r].name]=t[r];return JSON.stringify(i)}function nl(e){let{name:n,columnStatus:t,onPrimaryKeyChange:l,onPinnedColumnsChange:o,...a}=e,c=a.primaryKeys||[],u=a.pinnedColumns||[],h=c.includes(n),x=u.includes(n);return"index"===n?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(d.k,{alignItems:"center",gap:"10px",className:"grid-header",children:[h&&(0,i.jsx)(s.J,{as:e9.MhP}),(0,i.jsx)(r.x,{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:n}),"added"!==t&&"removed"!==t&&l&&(0,i.jsx)(s.J,{className:h?"close-icon":"key-icon",display:h?"block":"none",cursor:"pointer",as:h?e9.ven:e9.MhP,onClick:h?()=>{let e=c.filter(e=>e!==n);l&&l(e)}:()=>{let e=[...c.filter(e=>"index"!==e),n];l&&l(e)}}),!h&&o&&(0,i.jsx)(s.J,{className:x?"unpin-icon":"pin-icon",display:x?"block":"none",cursor:"pointer",as:x?e9.$kI:e9.oJP,onClick:x?()=>{let e=u.filter(e=>e!==n);o&&o(e)}:()=>{let e=[...u,n];o&&o(e)}})]})}let ns=(e,n)=>{let t;if(!Object.hasOwn(e,n))return["-",!0];let i=e[n],r=!1;return"boolean"==typeof i?t=i.toString():""===i?(t="(empty)",r=!0):null==i?(t="(null)",r=!0):t=i,[t,r]},no=e=>{let{row:n,column:t}=e,[r,l]=ns(n,t.key);return(0,i.jsx)(ee.x,{style:{color:l?"gray":"inherit"},children:r})},na=e=>{let{row:n,column:t}=e,r="base__".concat(t.key),l="current__".concat(t.key);if(!Object.hasOwn(n,r)&&!Object.hasOwn(n,l))return"-";let s=Object.hasOwn(n,r),o=Object.hasOwn(n,l),[a,c]=ns(n,"base__".concat(t.key)),[u,h]=ns(n,"current__".concat(t.key));return n[r]===n[l]?(0,i.jsx)(ee.x,{style:{color:h?"gray":"inherit"},children:u}):(0,i.jsxs)(d.k,{gap:"5px",alignItems:"center",lineHeight:"normal",height:"100%",children:[s&&(0,i.jsx)(nt,{value:a,colorScheme:"red",grayOut:c}),o&&(0,i.jsx)(nt,{value:u,colorScheme:"green",grayOut:h})]})};function nc(e,n,t){let r=e||{columns:[],data:[]},l=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,c=(null==t?void 0:t.displayMode)||"side_by_side",d=[],u=function(e,n){let t={};return Object.entries(e8(e.columns.map(e=>e.name),n.columns.map(e=>e.name))).map(i=>{let[r,l]=i;t[r]={status:l,baseColumnIndex:e.columns.findIndex(e=>e.name===r),currentColumnIndex:n.columns.findIndex(e=>e.name===r)}}),t}(r,l),h={},x={},m=!1,p=!1;if(0===s.length)r.data.forEach((e,n)=>{e._index=n+1,h[JSON.stringify({_index:n+1})]=e}),l.data.forEach((e,n)=>{e._index=n+1,x[JSON.stringify({_index:n+1})]=e});else{let e=ni(r.columns,s);r.data.forEach((n,t)=>{let i=nr(r.columns,e,n);i in h&&(m=!0),h[i]=n}),e=ni(l.columns,s),l.data.forEach((n,t)=>{let i=nr(l.columns,e,n);i in x&&(p=!0),x[i]=n})}let f=e8(Object.keys(h),Object.keys(x)),g={added:0,removed:0,modified:0},j=Object.entries(f).map(e=>{let[n,t]=e,i=h[n],o=x[n],a=JSON.parse(n);if(i&&r.columns.forEach((e,n)=>{s.includes(e.name)||(a["base__".concat(e.name)]=i[n])}),o&&l.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(u))"index"===e||s.includes(e)||n.baseColumnIndex<0||n.currentColumnIndex<0||eA().isEqual(i[n.baseColumnIndex],o[n.currentColumnIndex])||(a.__status="modified",n.status="modified");"modified"===a.__status&&g.modified++}else a.__status="removed",g.removed++}else a.__status="added",g.added++;return a});a&&(j=j.filter(e=>"added"===e.__status||"removed"===e.__status||"modified"===e.__status));let v=(e,n)=>{let r="added"===n?"diff-header-added":"removed"===n?"diff-header-removed":void 0;return"inline"===c?{headerCellClass:r,name:(0,i.jsx)(nl,{name:e,columnStatus:n,...t}),key:e,renderCell:na,size:"auto"}:{headerCellClass:r,name:(0,i.jsx)(nl,{name:e,columnStatus:n,...t}),children:[{key:"base__".concat(e),name:(null==t?void 0:t.baseTitle)||"Base",renderEditCell:e4.Ug,headerCellClass:r,cellClass: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(!eA().isEqual(t["base__".concat(e)],t["current__".concat(e)]))return"diff-cell-removed"},renderCell:no,size:"auto"},{key:"current__".concat(e),name:(null==t?void 0:t.currentTitle)||"Current",renderEditCell:e4.Ug,headerCellClass:r,cellClass: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(!eA().isEqual(t["base__".concat(e)],t["current__".concat(e)]))return"diff-cell-added"},renderCell:no,size:"auto"}]}};return 0===s.length?d.push({key:"_index",width:50,maxWidth:100,name:"",cellClass:"index-column"}):s.forEach(e=>{let n=u[e].status||"";d.push({key:e,name:(0,i.jsx)(nl,{name:e,columnStatus:n,...t}),frozen:!0,cellClass:e=>{if(e.__status)return"diff-header-".concat(e.__status)},renderCell:no})}),o.forEach(e=>{let n=u[e].status||"";"index"===e||s.includes(e)||d.push(v(e,n))}),Object.entries(u).forEach(e=>{let[n,t]=e,i=t.status||"";"index"===n||s.includes(n)||o.includes(n)||a&&g.modified>0&&"added"!==i&&"removed"!==i&&"modified"!==i||d.push(v(n,i))}),{columns:d,rows:j,invalidPKeyBase:m,invalidPKeyCurrent:p}}var nd=t(90506),nu=t(27487);let nh=e=>{let{warnings:n,children:t}=e;return(0,i.jsxs)(d.k,{borderBottom:"1px solid lightgray",justifyContent:"flex-end",gap:"5px",alignItems:"center",px:"10px",bg:n&&n.length>0?"orange.100":"inherit",children:[(0,i.jsx)(nu.g,{alignItems:"flex-start",spacing:0,children:null==n?void 0:n.map((e,n)=>(0,i.jsxs)(r.x,{children:[(0,i.jsx)(nd.a,{color:"orange.600"})," ",e]},n))}),(0,i.jsx)(m.L,{minHeight:"32px"}),t]})};var nx=t(6720);let nm=e=>{let{value:n,onChange:t,textOn:r,textOff:l}=e;return(0,i.jsxs)(nx.h,{isAttached:!0,variant:"outline",borderRadius:"full",size:"xs",children:[(0,i.jsx)(et.z,{onClick:()=>{t(!1)},color:n?"gray.400":"black",bg:n?"gray.50":"white",children:null!=l?l:"Off"}),(0,i.jsx)(et.z,{onClick:()=>{t(!0)},color:n?"black":"gray.400",bg:n?"white":"gray.50",children:null!=r?r:"On"})]})},np=e=>{let{displayMode:n,onDisplayModeChanged:t}=e;return(0,i.jsxs)(i.Fragment,{children:["inline"===n&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nt,{value:"Base",colorScheme:"red",grayOut:!1,fontSize:"10pt",noCopy:!0}),(0,i.jsx)(nt,{value:"Current",colorScheme:"green",grayOut:!1,fontSize:"10pt",noCopy:!0})]}),(0,i.jsx)(nm,{value:"side_by_side"===n,onChange:e=>{t(e?"side_by_side":"inline")},textOff:"Inline",textOn:"Side by side"})]})};function nf(e){let{name:n,pinnedColumns:t=[],onPinnedColumnsChange:l=()=>{}}=e,o=t.includes(n);return(0,i.jsxs)(d.k,{className:"grid-header",alignItems:"center",children:[(0,i.jsx)(r.x,{flex:1,children:n}),(0,i.jsx)(s.J,{className:o?"unpin-icon":"pin-icon",display:o?"block":"none",cursor:"pointer",as:o?e9.$kI:e9.oJP,onClick:o?()=>{l(t.filter(e=>e!==n))}:()=>{l([...t,n])}})]})}function ng(e,n){let t=[],r=n.primaryKeys||[],l=n.pinnedColumns||[],s=(e,t)=>({key:String(e),name:(0,i.jsx)(nf,{name:t,...n}),width:"auto",renderCell:no}),o=(e,t)=>({key:String(e),name:(0,i.jsx)(nl,{name:t,columnStatus:"",...n}),width:"auto",frozen:!0,renderCell:no});return r.length>0?r.forEach(n=>{let i=eA().findIndex(e.columns,e=>e.name===n);t.push(o(i,n))}):t.push({key:"_index",name:"",width:50,cellClass:"index-column"}),l.forEach(n=>{let i=eA().findIndex(e.columns,e=>e.name===n);i<0||t.push(s(i,n))}),e.columns.forEach((e,n)=>{r.includes(e.name)||l.includes(e.name)||t.push(s(n,e.name))}),e.data.forEach((e,n)=>{e._index=n+1}),{columns:t,rows:e.data}}let nj=(0,eP.G)((e,n)=>{var t;let{run:l,viewOptions:s,onViewOptionsChanged:o,onAddToChecklist:a}=e,c=(0,b.useMemo)(()=>(null==s?void 0:s.pinned_columns)||[],[s]),u=l.result,h=(0,b.useMemo)(()=>u?ng(u,{pinnedColumns:c,onPinnedColumnsChange:e=>{o&&o({...s,pinned_columns:e})}}):{rows:[],columns:[]},[u,c,s,o]);if(0===h.columns.length)return(0,i.jsx)(e2.M,{height:"100%",children:"No data"});let x=u&&null!==(t=u.limit)&&void 0!==t?t:0,p=x>0&&(null==u?void 0:u.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,f=a||p;return(0,i.jsxs)(d.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[f&&(0,i.jsxs)(d.k,{borderBottom:"1px solid lightgray",alignItems:"center",gap:"5px",px:"10px",bg:p?"orange.100":"inherit",children:[p&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nd.a,{color:"orange.600",alignSelf:"center"})," ",(0,i.jsx)(r.x,{children:p})]}),(0,i.jsx)(m.L,{minHeight:"32px"}),a&&(0,i.jsx)(et.z,{marginBlock:"5px",size:"sm",colorScheme:"blue",onClick:()=>{a(l)},children:"Add to Checklist"})]}),(0,i.jsx)(e6,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:h.columns,rows:h.rows,renderers:{noRowsFallback:(0,i.jsx)(e3,{})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})}),nv=(0,eP.G)((e,n)=>{var t;let{run:r,viewOptions:l,onViewOptionsChanged:s}=e,o=r.result,a=(0,b.useMemo)(()=>(null==l?void 0:l.pinned_columns)||[],[l]),c=(0,b.useMemo)(()=>(null==l?void 0:l.display_mode)||"inline",[l]),u=((null==o?void 0:null===(t=o.current)||void 0===t?void 0:t.columns)||[]).find(e=>"column_name"===e.name.toLowerCase()),h=(null==u?void 0:u.name)||"column_name",x=(0,b.useMemo)(()=>nc(null==o?void 0:o.base,null==o?void 0:o.current,{primaryKeys:[h],pinnedColumns:a,onPinnedColumnsChange:e=>{s&&s({...l,pinned_columns:e})},displayMode:c}),[o,h,a,c,l,s]);return 0===x.columns.length?(0,i.jsx)(e2.M,{height:"100%",children:"No data"}):(0,i.jsxs)(d.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nh,{run:r,children:(0,i.jsx)(np,{displayMode:c,onDisplayModeChanged:e=>{s&&s({...l,display_mode:e})}})}),(0,i.jsx)(e6,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:x.columns,rows:x.rows,defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})}),ny=(0,eP.G)((e,n)=>{var t;let{run:r,viewOptions:l,onViewOptionsChanged:s}=e,o=r.result,a=null==o?void 0:o.current,c=(0,b.useMemo)(()=>(null==l?void 0:l.pinned_columns)||[],[l]),u=((null==o?void 0:null===(t=o.current)||void 0===t?void 0:t.columns)||[]).find(e=>"column_name"===e.name.toLowerCase()),h=(null==u?void 0:u.name)||"column_name",x=(0,b.useMemo)(()=>a?ng(a,{primaryKeys:[h],pinnedColumns:c,onPinnedColumnsChange:e=>{s&&s({...l,pinned_columns:e})}}):{columns:[],rows:[]},[a,c,h,l,s]);return 0===x.columns.length?(0,i.jsx)(e2.M,{height:"100%",children:"No data"}):(0,i.jsx)(d.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:(0,i.jsx)(e6,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:x.columns,rows:x.rows,defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})})});function nb(e){let{name:n,columnStatus:t,onPrimaryKeyChange:l,onPinnedColumnsChange:o,...a}=e,c=a.primaryKeys||[],u=a.pinnedColumns||[],h=c.includes(n),x=u.includes(n);return"index"===n?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(d.k,{alignItems:"center",gap:"10px",className:"grid-header",children:[h&&(0,i.jsx)(s.J,{as:e9.MhP}),(0,i.jsx)(r.x,{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:n}),!h&&o&&(0,i.jsx)(s.J,{className:x?"unpin-icon":"pin-icon",display:x?"block":"none",cursor:"pointer",as:x?e9.$kI:e9.oJP,onClick:x?()=>{let e=u.filter(e=>e!==n);o&&o(e)}:()=>{let e=[...u,n];o&&o(e)}})]})}function nw(e,n,t){let r=(null==t?void 0:t.pinnedColumns)||[],l=(null==t?void 0:t.changedOnly)||!1,s=(null==t?void 0:t.displayMode)||"inline",o=[],a=function(e){let n={};return e.columns.map((e,t)=>{n[e.name]={index:t}}),n}(e),c={},d={};if(0===n.length)throw Error("Primary keys are required");let u=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),h=(a.in_a||a.IN_A).index,x=(a.in_b||a.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 r of n)i[e[r].name]=t[r];return JSON.stringify(i)}(e.columns,u,n);n[h]&&(c[i]=n),n[x]&&(d[i]=n)});let m=e8(Object.keys(c),Object.keys(d)),p={added:0,removed:0,modified:0},f=Object.entries(m).map(t=>{let[i,r]=t,l=c[i],s=d[i],o=JSON.parse(i);if(l&&e.columns.forEach((e,t)=>{n.includes(e.name)||(o["base__".concat(e.name)]=l[t])}),s&&e.columns.forEach((e,t)=>{n.includes(e.name)||(o["current__".concat(e.name)]=s[t])}),l){if(s)for(let[e,t]of Object.entries(a))!("index"===e||n.includes(e))&&(eA().isEqual(l[t.index],s[t.index])||(o.__status="modified",t.status="modified"));else o.__status="removed",p.removed++}else o.__status="added",p.added++;return"modified"===o.__status&&p.modified++,o});l&&(f=f.filter(e=>"added"===e.__status||"removed"===e.__status||"modified"===e.__status));let g=(e,r)=>{let l="added"===r?"diff-header-added":"removed"===r?"diff-header-removed":void 0;return"inline"===s?{headerCellClass:l,name:(0,i.jsx)(nb,{name:e,columnStatus:r,primaryKeys:n,...t}),key:e,renderCell:na,size:"auto"}:{headerCellClass:l,name:(0,i.jsx)(nb,{name:e,columnStatus:r,primaryKeys:n,...t}),children:[{key:"base__".concat(e),name:(null==t?void 0:t.baseTitle)||"Base",renderEditCell:e4.Ug,headerCellClass:l,cellClass:n=>{let t=n.__status;if("removed"===t)return"diff-cell-removed";if("added"===t)return"diff-cell-added";if("added"===r);else if("removed"===r);else if(!eA().isEqual(n["base__".concat(e)],n["current__".concat(e)]))return"diff-cell-removed"},renderCell:no,size:"auto"},{key:"current__".concat(e),name:(null==t?void 0:t.currentTitle)||"Current",renderEditCell:e4.Ug,headerCellClass:l,cellClass:n=>{let t=n.__status;if("removed"===t)return"diff-cell-removed";if("added"===t)return"diff-cell-added";if("added"===r);else if("removed"===r);else if(!eA().isEqual(n["base__".concat(e)],n["current__".concat(e)]))return"diff-cell-added"},renderCell:no,size:"auto"}]}};return n.forEach(e=>{let r=a[e].status||"";o.push({key:e,name:(0,i.jsx)(nb,{name:e,columnStatus:r,primaryKeys:n,...t}),frozen:!0,cellClass:e=>{if(e.__status)return"diff-header-".concat(e.__status)},renderCell:no})}),r.forEach(e=>{let t=a[e].status||"";n.includes(e)||o.push(g(e,t))}),Object.entries(a).forEach(e=>{let[t,i]=e,s=i.status||"";"in_a"===t||"in_b"===t||n.includes(t)||r.includes(t)||l&&p.modified>0&&"added"!==s&&"removed"!==s&&"modified"!==s||o.push(g(t,s))}),{columns:o,rows:f}}var nk=t(46683);let nC=e=>{let{changedOnly:n,onChange:t}=e;return(0,i.jsx)(nk.X,{size:"xs",isChecked:n,onChange:()=>{t()},children:"Changed only"})},n_=(e,n)=>{var t,r,l,s,o,a;let{run:c,onAddToChecklist:u,viewOptions:h,onViewOptionsChanged:x,baseTitle:m,currentTitle:p}=e,f=(0,b.useMemo)(()=>(null==h?void 0:h.primary_keys)||[],[h]),g=(0,b.useMemo)(()=>(null==h?void 0:h.changed_only)||!1,[h]),j=(0,b.useMemo)(()=>(null==h?void 0:h.pinned_columns)||[],[h]),v=(0,b.useMemo)(()=>(null==h?void 0:h.display_mode)||"inline",[h]),y=(0,b.useMemo)(()=>{var e,n;return nc(null===(e=c.result)||void 0===e?void 0:e.base,null===(n=c.result)||void 0===n?void 0:n.current,{changedOnly:g,primaryKeys:f,onPrimaryKeyChange:e=>{x&&x({...h,primary_keys:e})},pinnedColumns:j,onPinnedColumnsChange:e=>{x&&x({...h,pinned_columns:e})},baseTitle:m,currentTitle:p,displayMode:v})},[c,h,g,f,j,v,x,m,p]),w=(0,b.useMemo)(()=>{let e=f.join(", ");return y.invalidPKeyBase&&y.invalidPKeyCurrent?"Warning: The primary key '".concat(e,"' is not unique in the base and current environments"):y.invalidPKeyBase?"Warning: The primary key '".concat(e,"' is not unique in the base environment"):y.invalidPKeyCurrent?"Warning: The primary key '".concat(e,"' is not unique in the current environment"):void 0},[y.invalidPKeyBase,y.invalidPKeyCurrent,f]),k=(null===(r=c.result)||void 0===r?void 0:null===(t=r.current)||void 0===t?void 0:t.limit)||0,C=k>0&&((null===(s=c.result)||void 0===s?void 0:null===(l=s.current)||void 0===l?void 0:l.more)||(null===(a=c.result)||void 0===a?void 0:null===(o=a.base)||void 0===o?void 0:o.more))?"Warning: Displayed results are limited to ".concat(k.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,_=[];return(w&&_.push(w),C&&_.push(C),0===y.columns.length)?(0,i.jsx)(e2.M,{height:"100%",children:"No data"}):(0,i.jsxs)(d.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsxs)(nh,{run:c,viewOptions:h,onViewOptionsChanged:x,warnings:_,children:[(0,i.jsx)(np,{displayMode:v,onDisplayModeChanged:e=>{x&&x({...h,display_mode:e})}}),(0,i.jsx)(nC,{changedOnly:null==h?void 0:h.changed_only,onChange:()=>{let e=!(null==h?void 0:h.changed_only);x&&x({...h,changed_only:e})}})]}),(0,i.jsx)(e6,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:y.columns,rows:y.rows,renderers:{noRowsFallback:(0,i.jsx)(e3,{emptyMessage:"No mismatched rows"})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})},nS=(e,n)=>{var t,r,l,s;let{run:o,viewOptions:a,onViewOptionsChanged:c,baseTitle:u,currentTitle:h}=e,x=(0,b.useMemo)(()=>(null==a?void 0:a.changed_only)||!1,[a]),m=(0,b.useMemo)(()=>(null==a?void 0:a.pinned_columns)||[],[a]),p=(0,b.useMemo)(()=>(null==a?void 0:a.display_mode)||"inline",[a]),f=(0,b.useMemo)(()=>{var e,n;if(!(null===(e=o.result)||void 0===e?void 0:e.diff)||!(null===(n=o.params)||void 0===n?void 0:n.primary_keys))return{columns:[],rows:[]};let t=o.params.primary_keys;return nw(o.result.diff,t,{changedOnly:x,pinnedColumns:m,onPinnedColumnsChange:e=>{c&&c({...a,pinned_columns:e})},baseTitle:u,currentTitle:h,displayMode:p})},[o,a,x,m,p,c,u,h]),g=(null===(r=o.result)||void 0===r?void 0:null===(t=r.diff)||void 0===t?void 0:t.limit)||0,j=g>0&&(null===(s=o.result)||void 0===s?void 0:null===(l=s.diff)||void 0===l?void 0:l.more)?"Warning: Displayed results are limited to ".concat(g.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,v=[];return(j&&v.push(j),0===f.columns.length)?(0,i.jsx)(e2.M,{height:"100%",children:"No data"}):x&&0===f.rows.length?(0,i.jsxs)(d.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nh,{run:o,viewOptions:a,onViewOptionsChanged:c,warnings:v}),(0,i.jsx)(e2.M,{height:"100%",children:"No change"})]}):(0,i.jsxs)(d.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsxs)(nh,{run:o,viewOptions:a,onViewOptionsChanged:c,warnings:v,children:[(0,i.jsx)(np,{displayMode:p,onDisplayModeChanged:e=>{c&&c({...a,display_mode:e})}}),(0,i.jsx)(nC,{changedOnly:null==a?void 0:a.changed_only,onChange:()=>{let e=!(null==a?void 0:a.changed_only);c&&c({...a,changed_only:e})}})]}),(0,i.jsx)(e6,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:f.columns,rows:f.rows,renderers:{noRowsFallback:(0,i.jsx)(e3,{emptyMessage:"No mismatched rows"})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})},nz=(0,eP.G)((e,n)=>{var t;let r,l;if(e.run.params&&e.run.params.current_model&&(r="Original",l="Editor"),(null===(t=e.run.result)||void 0===t?void 0:t.diff)!=null){let t=(0,eP.G)(nS);return(0,i.jsx)(t,{...e,ref:n,baseTitle:r,currentTitle:l})}{let t=(0,eP.G)(n_);return(0,i.jsx)(t,{...e,ref:n,baseTitle:r,currentTitle:l})}});function nR(e,n){if(e<n){let t=(n-e)/e*100;return"+".concat(t>=.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 nL=t(10899),nI=t.n(nL);let nE=(0,eP.G)(function(e,n){let{run:t}=e;function r(e){if(e.base===e.current);else if(e.base<e.current||"N/A"===e.base)return"column-body-added";else if(e.base>e.current||"N/A"===e.current)return"column-body-removed";return"column-body-normal"}let l=t.result||{},s=Object.keys(t.result||{}).map(e=>{let n=l[e],t=nI()(n.base)?n.base:null,i=nI()(n.curr)?n.curr:null,r="=";return null!==t&&null!==i?r=t!==i?nR(t,i):"=":t===i?r="N/A":null===t?r="Added":null===i&&(r="Removed"),{name:e,base:null===t?"N/A":Number(t),current:null===i?"N/A":Number(i),delta:r}});return 0===s.length?(0,i.jsx)(e2.M,{bg:"rgb(249,249,249)",height:"100%",children:"No nodes matched"}):(0,i.jsx)(d.k,{direction:"column",children:Object.keys(l).length>0&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(e6,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:[{key:"name",name:"Name",cellClass:r},{key:"base",name:"Base Rows",cellClass:r},{key:"current",name:"Current Rows",cellClass:r},{key:"delta",name:"Delta",cellClass:r}],rows:s,renderers:{noRowsFallback:(0,i.jsx)(e3,{})},className:"rdg-light",enableScreenshot:!0})})})}),nT=(0,eP.G)(function(e,n){let{run:t}=e,r=t.result||{},l=Object.keys(t.result||{}).map(e=>{let n=r[e],t=nI()(n.curr)?n.curr:null;return{name:e,current:null===t?"N/A":Number(t)}});return 0===l.length?(0,i.jsx)(e2.M,{bg:"rgb(249,249,249)",height:"100%",children:"No nodes matched"}):(0,i.jsx)(d.k,{direction:"column",children:Object.keys(r).length>0&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(e6,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:[{key:"name",name:"Name"},{key:"current",name:"Row Count"}],rows:l,renderers:{noRowsFallback:(0,i.jsx)(e3,{})},className:"rdg-light",enableScreenshot:!0})})})});var nD=t(62675),nO=t(50367);let nM="#63B3ED";function nA(e,n){let t=n?10:e.counts.length,i=e.counts.slice(0,t),r=e.valids-i.reduce((e,n)=>e+n,0);return e.values.slice(0,t).concat([r]).map((n,t)=>{let l;let s=t===i.length,o=s?r:i[t],a=!1;return s?(l="(others)",a=!0):null==n?(l="(null)",a=!0):"string"==typeof n&&0===n.length?(l="(empty)",a=!0):l=String(n),{isLastItemOthers:s,isSpecialLabel:a,label:l,count:o,displayCount:eB(o),displayRatio:eJ(o/e.valids)||"N/A"}})}function nF(e){let{base:n,current:t,children:l}=e;return(0,i.jsx)(nD.u,{label:(0,i.jsxs)(r.x,{children:[(0,i.jsxs)(ee.x,{children:[(0,i.jsx)(eG,{color:eU}),"Current: ",t.count," (",t.displayRatio,")"]}),(0,i.jsxs)(ee.x,{children:[(0,i.jsx)(eG,{color:eQ}),"Base: ",n.count," (",n.displayRatio,")"]})]}),placement:"auto",hasArrow:!0,children:l})}function nN(e){let{topKDiff:n,isDisplayTopTen:t}=e,l=nA(n.current,t),s=nA(n.base,t);return(0,i.jsxs)(r.x,{w:"100%",px:20,py:4,children:[(0,i.jsxs)(d.k,{alignItems:"center",direction:"row",children:[(0,i.jsx)(m.L,{}),(0,i.jsxs)(ee.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(eG,{color:eQ})," Base"]}),(0,i.jsxs)(ee.x,{as:"h3",size:"sm",p:"2",color:"gray",children:[(0,i.jsx)(eG,{color:eU})," Current"]}),(0,i.jsx)(m.L,{})]}),l.map((e,t)=>{let r=s[t];return e.isLastItemOthers&&0===e.count&&0===r.count?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(b.Fragment,{children:[(0,i.jsx)(nF,{base:r,current:e,children:(0,i.jsxs)(d.k,{alignItems:"center",width:"100%",_hover:{bg:"blackAlpha.300"},px:4,children:[(0,i.jsx)(ee.x,{noOfLines:1,width:"10em",fontSize:"sm",color:e.isSpecialLabel?"gray.400":"inherit",children:e.label}),(0,i.jsxs)(d.k,{width:"70%",direction:"column",children:[(0,i.jsxs)(d.k,{height:"1em",children:[(0,i.jsx)(nq,{topkCount:e.count,topkLabel:e.label,valids:n.current.valids,color:eU}),(0,i.jsx)(ee.x,{ml:5,mr:2,fontSize:"sm",width:"6em",children:e.displayCount}),(0,i.jsx)(ee.x,{color:"gray.400",fontSize:"sm",width:"4em",children:e.displayRatio})]}),(0,i.jsxs)(d.k,{height:"1em",children:[(0,i.jsx)(nq,{topkCount:r.count,topkLabel:r.label,valids:n.base.valids,color:eQ}),(0,i.jsx)(ee.x,{ml:5,mr:2,fontSize:"sm",width:"6em",children:r.displayCount}),(0,i.jsx)(ee.x,{color:"gray.400",fontSize:"sm",width:"4em",children:r.displayRatio})]})]})]})}),(0,i.jsx)(nO.i,{})]},t)})]})}function nq(e){let{topkCount:n,topkLabel:t,valids:r,animation:l=!1,color:s=nM}=e;eW.kL.register(eW.uw,eW.ZL,eW.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,r,{animation:l}),a=function(e){let{topkLabel:n,topkCount:t,color:i=nM}=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)(eK.$Q,{data:a,options:o,plugins:[]})}let nH=(0,eP.G)((e,n)=>{let{run:t}=e,[r,s]=(0,b.useState)(!0),o=t.result,a=t.params,c=o.base,u=o.current;return(0,i.jsxs)(d.k,{direction:"column",height:"100%",children:[(0,i.jsxs)(e1,{ref:n,blockSize:"auto",children:[(0,i.jsxs)(h.X,{as:"h1",size:"md",paddingTop:4,textAlign:"center",color:"gray.600",children:["Model ",a.model,".",a.column_name]}),(0,i.jsxs)(x.U,{children:[(0,i.jsx)(m.L,{}),(0,i.jsx)(nN,{topKDiff:o,valids:u.valids||0,isDisplayTopTen:r}),(0,i.jsx)(m.L,{})]})]}),(0,i.jsx)(m.L,{}),(c.values.length>10||u.values.length>10)&&(0,i.jsx)(d.k,{p:5,justify:"start",children:(0,i.jsx)(l.r,{onClick:()=>{s(e=>!e)},textColor:"blue.500",children:r?"View More Items":"View Only Top-10"})})]})}),nV=(0,eP.G)((e,n)=>{var t,r;let{run:l,onAddToChecklist:s,viewOptions:o,onViewOptionsChanged:a}=e,c=(0,b.useMemo)(()=>(null==o?void 0:o.changed_only)||!1,[o]),u=(0,b.useMemo)(()=>(null==o?void 0:o.pinned_columns)||[],[o]),h=(0,b.useMemo)(()=>(null==o?void 0:o.display_mode)||"inline",[o]),x=(0,b.useMemo)(()=>{var e;if(!l.result||!(null===(e=l.params)||void 0===e?void 0:e.primary_key))return{columns:[],rows:[]};let n=l.params.primary_key,t=Array.isArray(n)?n:[n];return nw(l.result,t,{changedOnly:c,pinnedColumns:u,onPinnedColumnsChange:e=>{a&&a({...o,pinned_columns:e})},displayMode:h})},[l,o,c,u,h,a]),m=(null===(t=l.result)||void 0===t?void 0:t.limit)||0,p=m>0&&(null===(r=l.result)||void 0===r?void 0:r.more)?"Warning: Displayed results are limited to ".concat(m.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null,f=[];return(p&&f.push(p),0===x.columns.length)?(0,i.jsx)(e2.M,{height:"100%",children:"No data"}):c&&0===x.rows.length?(0,i.jsxs)(d.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsx)(nh,{run:l,viewOptions:o,onViewOptionsChanged:a,warnings:f}),(0,i.jsx)(e2.M,{height:"100%",children:"No change"}),";"]}):(0,i.jsxs)(d.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,i.jsxs)(nh,{run:l,viewOptions:o,onViewOptionsChanged:a,warnings:f,children:[(0,i.jsx)(np,{displayMode:h,onDisplayModeChanged:e=>{a&&a({...o,display_mode:e})}}),(0,i.jsx)(nC,{changedOnly:null==o?void 0:o.changed_only,onChange:()=>{let e=!(null==o?void 0:o.changed_only);a&&a({...o,changed_only:e})}})]}),(0,i.jsx)(e6,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:x.columns,rows:x.rows,renderers:{noRowsFallback:(0,i.jsx)(e3,{emptyMessage:"No mismatched rows"})},defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})});var nP=t(51904),nW=t(65013);function nK(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:l}=e,[s,o]=(0,b.useState)(!n.columns||0===n.columns.length),a=n.model,c=n.primary_key,{columns:d,primaryKey:u,isLoading:h,error:x}=eN(n.model);(0,b.useEffect)(()=>{!c&&u&&t({...n,primary_key:u})},[c,u,n,t]),(0,b.useEffect)(()=>{l(!!c&&!!a)},[c,a,l]);let m=d.map(e=>e.name),p=Array.isArray(c)?c:c?[c]:void 0;return h?(0,i.jsx)(r.x,{children:"Loading..."}):0===m.length||x?(0,i.jsx)(r.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)(eT.NI,{children:[(0,i.jsx)(eD.l,{children:"Model"}),(0,i.jsx)(nP.I,{isReadOnly:!0,value:n.model})]}),(0,i.jsxs)(eT.NI,{children:[(0,i.jsx)(eD.l,{children:"Primary key"}),(0,i.jsx)(nW.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)(eT.NI,{children:[(0,i.jsx)(eD.l,{children:"Columns"}),(0,i.jsx)(nk.X,{marginBottom:"10px",isChecked:s,onChange:e=>{o(e.target.checked),t({...n,columns:void 0})},children:"All columns"}),!s&&(0,i.jsx)(nW.Ph,{isMulti:!0,closeMenuOnSelect:!1,options:m.map(e=>({label:e,value:e})),value:(n.columns||[]).map(e=>({label:e,value:e})),onChange:e=>{let i;let r=e.map(e=>e.value);i=0===r.length?void 0:r,t({...n,columns:i})}})]})]})}var nJ=t(96185),nB=t(4057),nU=t(48933),nQ=t(29388),nZ=t(65225),nX=t(98428);function nG(e){let{params:n,column:t}=e,{runAction:l}=n9(),o=(e,t)=>{l("value_diff_detail",{...n,...e},t)};return(0,i.jsxs)(d.k,{children:[(0,i.jsx)(r.x,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t}),(0,i.jsx)(m.L,{}),(0,i.jsx)(nJ.v,{isLazy:!0,children:e=>{let{isOpen:n}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nB.j,{className:"row-context-menu",visibility:n?"visible":"hidden",width:n?"auto":"0px",minWidth:n?"auto":"0px",as:nn.h,icon:(0,i.jsx)(s.J,{as:e9.D_A}),variant:"unstyled",size:"sm"}),(0,i.jsx)(nU.h,{children:(0,i.jsx)(nQ.q,{lineHeight:"20px",children:(0,i.jsxs)(nZ.k,{title:"Action",as:r.x,fontSize:"8pt",children:[(0,i.jsx)(nX.s,{fontSize:"10pt",onClick:()=>{o({},{showForm:!0})},children:"Show mismatched values..."}),(0,i.jsxs)(nX.s,{fontSize:"10pt",onClick:()=>{o({columns:[t]},{showForm:!1})},children:["Show mismatched values for '",t,"'"]})]})})})]})}})]})}let nY=(0,eP.G)(function(e,n){let{run:t}=e,l=t.result,o=t.params,a=e=>{let n=e[2];return null!=n&&n<1?"diff-cell-modified":""},c=Array.isArray(o.primary_key)?o.primary_key:[o.primary_key],u=[{key:"__is_pk__",name:"",width:30,maxWidth:30,renderCell:e=>{let{row:n}=e;return(0,i.jsx)(e2.M,{height:"100%",children:c.includes(n[0])&&(0,i.jsx)(s.J,{as:e9.MhP})})}},{key:"0",name:"Column",resizable:!0,renderCell:e=>{let{row:n,column:t}=e;return(0,i.jsx)(nG,{column:n[t.key],params:o})},cellClass:"cell-show-context-menu"},{key:"1",name:"Matched",resizable:!0,cellClass:a},{key:"2",name:"Matched %",resizable:!0,renderCell:e=>{let{column:n,row:t}=e,l=t[n.key];return(0,i.jsx)(r.x,{textAlign:"end",children:null!=l?"".concat((100*l).toFixed(2)," %"):"N/A"})},cellClass:a}];return(0,i.jsxs)(d.k,{direction:"column",gap:"5px",pt:"5px",height:"100%",children:[(0,i.jsxs)(r.x,{px:"16px",children:["Model: ",o.model,", ",l.summary.total," total (",l.summary.total-l.summary.added-l.summary.removed," common,"," ",l.summary.added," added, ",l.summary.removed," removed)"]}),(0,i.jsx)(e6,{ref:n,style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",borderBlock:"1px solid lightgray"},columns:u,rows:l.data.data,renderers:{noRowsFallback:(0,i.jsx)(e3,{})},defaultColumnOptions:{resizable:!0},className:"rdg-light",enableScreenshot:!0})]})});var n$=t(17510),n0=t(33130);function n1(e){var n;let{params:t,onParamsChanged:l,setIsReadyToExecute:s}=e,[o,a]=(0,b.useState)(!t.columns||0===t.columns.length),c=t.model,{columns:d,isLoading:u,error:h}=eN(t.model);(0,b.useEffect)(()=>{s(!!c)},[c,s]);let x=d.map(e=>e.name);return u?(0,i.jsx)(r.x,{children:"Loading..."}):0===x.length||h?(0,i.jsx)(r.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)(eT.NI,{children:[(0,i.jsx)(eD.l,{children:"Model"}),(0,i.jsx)(nP.I,{isReadOnly:!0,value:t.model})]}),(0,i.jsxs)(eT.NI,{children:[(0,i.jsx)(eD.l,{children:"Columns"}),(0,i.jsx)(nk.X,{marginBottom:"10px",isChecked:o,onChange:e=>{a(e.target.checked),l({...t,columns:void 0})},children:"All columns"}),!o&&(0,i.jsx)(nW.Ph,{isMulti:!0,closeMenuOnSelect:!1,options:x.map(e=>({label:e,value:e})),value:(null!==(n=t.columns)&&void 0!==n?n:[]).map(e=>({label:e,value:e})),onChange:e=>{let n;let i=e.map(e=>e.value);n=0===i.length?void 0:i,l({...t,columns:n})}})]})]})}let n5={lineage_diff:{title:"Lineage Diff",icon:eE.Ks7},schema_diff:{title:"Schema Diff",icon:n0.C8A},query:{title:"Query",icon:eE.r2i,RunResultView:nj},query_base:{title:"Query Base",icon:eE.r2i,RunResultView:nj},query_diff:{title:"Query Diff",icon:eE.r2i,RunResultView:nz},row_count:{title:"Row Count",icon:n0.QUK,RunResultView:nT},row_count_diff:{title:"Row Count Diff",icon:n0.QUK,RunResultView:nE},profile:{title:"Profile",icon:eE.KA6,RunResultView:ny,RunForm:n1},profile_diff:{title:"Profile Diff",icon:eE.KA6,RunResultView:nv,RunForm:n1},value_diff:{title:"Value Diff",icon:eE.pRi,RunResultView:nY,RunForm:nK},value_diff_detail:{title:"Value Diff Detail",icon:eE.pRi,RunResultView:nV,RunForm:nK},top_k_diff:{title:"Top-K Diff",icon:n$.Pkc,RunResultView:nH,RunForm:function(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:l}=e,{columns:s,isLoading:o,error:a}=eN(n.model),c=s.map(e=>e.name);return((0,b.useEffect)(()=>{l(!!n.column_name)},[n,l]),o)?(0,i.jsx)(r.x,{children:"Loading..."}):0===c.length||a?(0,i.jsx)(r.x,{children:"Error: Please provide the 'catalog.json' to list column candidates"}):(0,i.jsx)(r.x,{m:"16px",children:(0,i.jsxs)(eT.NI,{children:[(0,i.jsx)(eD.l,{children:"Pick a column to show top-k"}),(0,i.jsx)(eO.P,{placeholder:"Select column",value:n.column_name,onChange:e=>{let i=e.target.value;t({...n,column_name:i})},children:c.map(e=>(0,i.jsx)("option",{value:e,children:e},e))})]})})}},histogram_diff:{title:"Histogram Diff",icon:eE.dku,RunResultView:e5,RunForm:function(e){let{params:n,onParamsChanged:t,setIsReadyToExecute:l}=e,{columns:s,isLoading:o,error:a}=eN(n.model),c=s.filter(e=>!eq(e.type)&&!eH(e.type)&&!eV(e.type));return o?(0,i.jsx)(r.x,{children:"Loading..."}):0===s.length||a?(0,i.jsx)(r.x,{children:"Error: Please provide the 'catalog.json' to list column candidates"}):(0,i.jsx)(r.x,{m:"16px",children:(0,i.jsxs)(eT.NI,{children:[(0,i.jsx)(eD.l,{children:"Pick a column to show Histogram Diff"}),(0,i.jsx)(eO.P,{placeholder:0!==c.length?"Select column":"No numeric column is available",isDisabled:0===c.length,value:n.column_name,onChange:e=>{var i;let r=e.target.value;l(!!r);let s=(null===(i=c.find(e=>e.name===r))||void 0===i?void 0:i.type)||"";t({...n,column_name:r,column_type:s})},children:c.map(e=>(0,i.jsxs)("option",{value:e.name,children:[e.name," : ",e.type]},e.name))})]})})}},sandbox:{title:"Sandbox",icon:eE.iQd}},n2=e=>n5[e],n4=(0,b.createContext)({runAction:()=>{},showRunId:e=>{},isRunResultOpen:!1,closeRunResult:()=>{},isHistoryOpen:!1,closeHistory:()=>{},showHistory:()=>{},clearRunResult:()=>{}}),n6=e=>{let[n]=(0,eI.TH)();(0,b.useEffect)(()=>{e()},[e,n])};function n3(e){var n;let{children:t}=e,[r,l]=(0,b.useState)(),{isOpen:s,onOpen:a,onClose:c}=(0,Q.q)(),{isOpen:d,onOpen:u,onClose:h}=(0,Q.q)(),{isOpen:x,onOpen:m,onClose:p}=(0,Q.q)(),f=(0,o.p)(),[g,j]=(0,b.useState)(),[v,y]=(0,eI.TH)(),w=(0,k.NL)(),C=(0,b.useCallback)(async(e,n)=>{j(e),u(),!1!==n&&await w.invalidateQueries({queryKey:q.runs()})},[j,u,w]),_=(0,b.useCallback)(()=>{j(void 0),h()},[h,j]),S=(0,b.useCallback)(async(e,n,t)=>{try{let i;let r=new Date().getTime().toString();if(null==t?void 0:t.showLast){let t=await eg(e,n,1);1===t.length&&(i=t[0])}let s=n2(e);if(void 0===s)throw Error("Unknown run type: ".concat(e));let{title:o,RunResultView:c,RunForm:d}=s;if(void 0===c)throw Error("Run type ".concat(e," does not have a result view"));if(void 0!=d&&(null==t?void 0:t.showForm))l({session:r,title:o,type:e,params:n,lastRun:i,options:t,RunForm:d}),a();else{let{run_id:t}=await ex(e,n,{nowait:!0});await C(t),await w.invalidateQueries({queryKey:q.runs()}),v.startsWith("/lineage")&&y("/lineage")}}catch(e){f({title:"Failed to submit a run",description:null==e?void 0:e.message,position:"bottom-right",status:"error",duration:5e3,isClosable:!0})}},[l,a,C,f,v,y,w]);n6(c);let z=async(e,n)=>{try{c();let{run_id:t}=await ex(e,n,{nowait:!0});await C(t)}catch(e){f({title:"Failed to submit a run",description:null==e?void 0:e.message,position:"bottom-right",status:"error",duration:5e3,isClosable:!0})}};return(0,i.jsxs)(n4.Provider,{value:{runAction:S,runId:g,showRunId:C,isRunResultOpen:d,closeRunResult:h,isHistoryOpen:x,closeHistory:p,showHistory:m,clearRunResult:_},children:[r&&(0,i.jsx)(eL,{isOpen:s,onClose:c,onExecute:z,title:r.title,type:r.type,params:r.params,initialRun:r.lastRun,RunForm:(null===(n=r.options)||void 0===n?void 0:n.showForm)&&r.RunForm?r.RunForm:void 0},r.session),t]})}let n9=()=>(0,b.useContext)(n4),n8=(0,b.createContext)({latestSelectedCheckId:"",setLatestSelectedCheckId:()=>{}});function n7(e){let{children:n}=e,[t,r]=b.useState("");return(0,i.jsx)(n8.Provider,{value:{setLatestSelectedCheckId:r,latestSelectedCheckId:t},children:n})}let te=()=>(0,b.useContext)(n8);function tn(e){let{children:n}=e;return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(S,{children:(0,i.jsx)(e_,{children:(0,i.jsx)(L,{children:(0,i.jsx)(n3,{children:(0,i.jsx)(n7,{children:n})})})})})})}async function tt(){return(await K.post("/api/checks",{type:"simple"})).data}async function ti(e,n){let t=eh?{breaking_change_analysis:!0}:{};return(await K.post("/api/checks",{run_id:e,view_options:n,track_props:t})).data}async function tr(){return(await K.get("/api/checks")).data}async function tl(e){return(await K.get("/api/checks/".concat(e))).data}async function ts(e,n){return(await K.patch("/api/checks/".concat(e),n)).data}async function to(e){return(await K.delete("/api/checks/".concat(e))).data}async function ta(e){return await K.post("/api/checks/reorder",e)}var tc=t(62487),td=t(99705),tu=t(71005),th=t(71091),tx=t(5001),tm=t(49595),tp=t(95314),tf=t(40485),tg=t(34328),tj=t(61775),tv=t(97217),ty=t(30162),tb=t(54073),tw=t(6593);function tk(e){let{name:n,setName:t}=e,[l,s]=(0,b.useState)(!1),[o,a]=(0,b.useState)(n),c=(0,b.useRef)(null),d=(0,b.useCallback)(()=>{t(o),s(!1)},[t,s,o]);return(0,b.useEffect)(()=>{let e=e=>{c.current&&!c.current.contains(e.target)&&d()};return l&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[l,c,d]),(0,i.jsx)(ty.a,{flex:"0 1 auto",fontSize:"12pt",fontWeight:"500",separator:(0,i.jsx)(tw.X,{color:"gray.500"}),overflow:"hidden",children:(0,i.jsx)(tb.g,{cursor:"pointer",flex:"0 1 auto",overflow:"hidden",children:l?(0,i.jsx)(nP.I,{ref:c,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)(r.x,{flex:"0 1 auto",onClick:()=>{a(n),s(!0)},textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:n})})})}var tC=t(69671);t(86026);let t_=(0,b.createContext)(void 0),tS=()=>{let e=(0,b.useContext)(t_);if(!e)throw Error("useLineageViewContext must be used within a LineageViewProvider");return e},tz=()=>(0,b.useContext)(t_);function tR(e){let{model:n,name:t,baseType:l,currentType:o,singleEnv:a}=e,{runAction:c}=n9(),u=tz(),{isActionAvailable:h}=eS(),x=null!=o?o:l,[p,f]=(0,b.useState)(!1),g=()=>{c("profile_diff",{model:n.name,columns:[t]},{showForm:!1})},j=()=>{c("histogram_diff",{model:n.name,column_name:t,column_type:x},{showForm:!1})},v=()=>{c("top_k_diff",{model:n.name,column_name:t,k:50},{showForm:!1})},y=!l||!o,w=async()=>{var e;e={action:"view"},el.j("Column level lineage",e),f(!0),await (null==u?void 0:u.showColumnLevelLineage(n.id,t)),f(!1)};return(0,i.jsxs)(d.k,{alignItems:"center",gap:"3px",children:[(0,i.jsx)(r.x,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t}),(0,i.jsx)(m.L,{}),u&&(0,i.jsx)(nD.u,{label:"Show Lineage",children:(0,i.jsx)(nn.h,{icon:(0,i.jsx)(n$.Lr9,{}),"aria-label":"",className:"row-context-menu",visibility:"hidden",width:"0px",minWidth:"0px",variant:"unstyled",size:"sm",color:"gray",_hover:{color:"black"},onClick:w,isLoading:p})}),!a&&"source"!==n.resource_type&&(0,i.jsx)(nJ.v,{children:e=>{let{isOpen:n}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nB.j,{className:"row-context-menu",visibility:n?"visible":"hidden",width:n?"auto":"0px",minWidth:n?"auto":"0px",as:nn.h,icon:(0,i.jsx)(s.J,{as:e9.D_A}),variant:"unstyled",size:"sm",color:"gray",_hover:{color:"black"}}),(0,i.jsx)(nU.h,{children:(0,i.jsx)(nQ.q,{lineHeight:"20px",children:(0,i.jsxs)(nZ.k,{title:"Diff",m:"0",p:"4px 12px",children:[(0,i.jsx)(nX.s,{fontSize:"10pt",onClick:g,isDisabled:y||!h("profile_diff"),children:"Profile Diff"}),(0,i.jsx)(nX.s,{fontSize:"10pt",onClick:j,isDisabled:y||!x||!(!eq(x)&&!eH(x)&&!eV(x)),children:"Histogram Diff"}),(0,i.jsx)(nX.s,{fontSize:"10pt",onClick:v,isDisabled:y,children:"Top-k Diff"})]})})})]})}})]})}function tL(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 r(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:r}=e;return n?(0,i.jsx)(tR,{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:r},{key:"currentType",name:"Current Type",resizable:!0,cellClass:r}],rows:Object.values(e)}}var tI=t(70113),tE=t(55772);let tT=(0,b.forwardRef)(function(e,n){let t,r,{base:l,current:s,enableScreenshot:o=!1}=e,{columns:a,rows:c}=(0,b.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(e8(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,r]=e;t[i].baseIndex=n+1,t[i].baseType=r.type}),Object.entries(n).map((e,n)=>{let[i,r]=e;t[i].currentIndex=n+1,t[i].currentType=r.type}),t}(null==l?void 0:l.columns,null==s?void 0:s.columns),n=(null==s?void 0:s.resource_type)||(null==l?void 0:l.resource_type);return n&&["model","seed","snapshot","source"].includes(n)?tL(e,null!=s?s:l):tL(e)},[l,s]),{lineageGraph:u}=eS(),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=l&&void 0===l.columns,p=s&&void 0===s.columns;return m&&p?r="Schema information is missing on both current and base environments.":m?r="Schema information is missing on base environment.":p&&(r="Schema information is missing on current environment."),(0,i.jsxs)(d.k,{direction:"column",children:[t?(0,i.jsxs)(tI.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(tE.z,{}),t]}):r?(0,i.jsxs)(tI.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(tE.z,{}),r]}):(0,i.jsx)(i.Fragment,{}),c.length>0&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(e6,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:a,rows:c,renderers:{noRowsFallback:(0,i.jsx)(e3,{})},className:"rdg-light",enableScreenshot:o,ref:n})})]})}),tD=(0,b.forwardRef)(function(e,n){let t,r,{current:l}=e,{columns:s,rows:o}=(0,b.useMemo)(()=>(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return{columns:[{key:"index",name:"",resizable:!0,minWidth:35,width:35,cellClass:"column-index-normal"},{key:"name",name:"Name",resizable:!0,renderCell:e=>{let{row:t,column:r}=e;return n?(0,i.jsx)(tR,{model:n,name:t.name,singleEnv:!0}):t.name},cellClass:"column-body-normal"},{key:"type",name:"Type",resizable:!0,cellClass:"column-body-normal"}],rows:Object.entries(e).map((e,n)=>{let[t,i]=e;return{name:t,index:n+1,type:i.type}})}})(null==l?void 0:l.columns,l),[l]),{lineageGraph:a}=eS();return(null==a?void 0:a.catalogMetadata.current)||(t="catalog.json is missing."),l&&void 0===l.columns&&(r="Schema information is missing."),(0,i.jsxs)(d.k,{direction:"column",children:[t?(0,i.jsxs)(tI.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(tE.z,{}),t]}):r?(0,i.jsxs)(tI.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,i.jsx)(tE.z,{}),r]}):(0,i.jsx)(i.Fragment,{}),o.length>0&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(e6,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:s,rows:o,renderers:{noRowsFallback:(0,i.jsx)(e3,{})},className:"rdg-light",enableScreenshot:!1,ref:n})})]})});async function tO(e){return(await K.post("/api/select",e)).data}var tM=t(23533);t(5673);let tA=e=>{let{style:n,children:t,gutterSize:r=5,...l}=e;return(0,i.jsx)(tM.Z,{style:{display:"flex",flexDirection:"row",...n},direction:"horizontal",gutterSize:r,...l,children:t})},tF=e=>{let{style:n,children:t,gutterSize:r=5,...l}=e;return(0,i.jsx)(tM.Z,{style:{display:"flex",flexDirection:"column",...n},gutterSize:r,direction:"vertical",...l,children:t})};var tN=t(48783),tq=t(7472),tH=t(77633);let tV=e9.Nbv,tP=e9.sFB,tW=e9.UGs;function tK(e){return"added"===e?{color:"#1dce00",backgroundColor:"#e8fce5",icon:tV}:"removed"===e?{color:"#ff4444",backgroundColor:"#ffdbdb",icon:tP}:"modified"===e?{color:"#ffa502",backgroundColor:"#fff2dd",icon:tW}:{color:"inherit",backgroundColor:"white",icon:void 0}}function tJ(e){if("model"===e)return{color:"#c0eafd",icon:tq.Fn3};if("metric"===e)return{color:"#ffe6ee",icon:tH._MV};if("source"===e)return{color:"#a6dda6",icon:tq.i1q};if("exposure"===e)return{color:"#ffe6ee",icon:tH.n8P};if("semantic_model"===e)return{color:"#fb8caf",icon:tH.R1C};if("seed"===e)return{color:"#a6dda6",icon:tq.tWi};if("snapshot"===e)return{color:"#a6dda6",icon:tq.Dmm};else return{color:"inherit",icon:void 0}}function tB(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<t.length;e++)if(t[e]!==i[e])return!0;for(let t of i)if(!e[t]||e[t].type!==n[t].type)return!0;return!1}let tU=e=>{let n,t,{node:l,selected:o,onSelect:a,schemaChanged:c}=e,{icon:u}=tJ(l.resourceType),{base:h,current:x}=l.data;if(c){var m;n=null===(m=n2("schema_diff"))||void 0===m?void 0:m.icon,t=tK("modified").color}else!h&&x?(n=tK("added").icon,t=tK("added").color):h&&!x&&(n=tK("removed").icon,t=tK("removed").color);return(0,i.jsxs)(d.k,{width:"100%",fontSize:"10pt",p:"5px 8px",cursor:"pointer",_hover:{bg:"gray.200"},bg:o?"gray.100":"inherit",onClick:()=>{a(l.id)},alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.J,{as:u}),(0,i.jsx)(r.x,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:l.name}),n&&t&&(0,i.jsx)(s.J,{as:n,color:t})]})},tQ=(0,b.forwardRef)(function(e,n){let{check:t}=e,{lineageGraph:r}=eS(),l=t.params,s=[...q.check(t.check_id),"select"],{isLoading:o,error:a,refetch:c,data:d}=(0,w.a)({queryKey:s,queryFn:async()=>tO({select:l.select,exclude:l.exclude,packages:l.packages,view_mode:l.view_mode}),refetchOnMount:!0,enabled:!l.node_id}),[u,h]=(0,b.useMemo)(()=>{let e=[],n=[],t=[],i=[];if(l.node_id)for(let n of l.node_id instanceof Array?l.node_id:[l.node_id]){let t=null==r?void 0:r.nodes[n];t&&e.push(t)}else for(let n of(null==d?void 0:d.nodes)||[]){let t=null==r?void 0:r.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;tB(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 c(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=c(e),i=c(n);return t!==i?i-t:e.name.localeCompare(n.name)}),[s,n]},[l.node_id,null==d?void 0:d.nodes,r]),[x,m]=(0,b.useState)(0);if(o)return(0,i.jsx)(e2.M,{bg:"rgb(249,249,249)",height:"100%",children:"Loading..."});if(a)return(0,i.jsxs)(e2.M,{bg:"rgb(249,249,249)",height:"100%",children:["Error: ",a.message]});if(0==u.length)return(0,i.jsx)(e2.M,{bg:"rgb(249,249,249)",height:"100%",children:"No nodes matched"});if(x<u.length){let e=u[x];return(0,i.jsxs)(tA,{sizes:[80,20],minSize:30,style:{height:"100%"},children:[(0,i.jsx)(tT,{base:e.data.base,current:e.data.current,enableScreenshot:!0,ref:n}),(0,i.jsx)(tN.aV,{overflow:"auto",backgroundColor:"white",children:u.map((e,n)=>(0,i.jsx)(tU,{node:e,schemaChanged:h.includes(e.id),selected:n===x,onSelect:()=>{m(n)}},n))})]})}return(0,i.jsx)(i.Fragment,{})});var tZ=t(84575);function tX(e){let{value:n,onChange:t}=e,[r,s]=(0,b.useState)(!1),[o,a]=(0,b.useState)(),c=(0,b.useRef)(null),u=()=>{t&&(t(o),s(!1))};return((0,b.useEffect)(()=>{if(r&&c.current){let e=c.current;e.focus(),e.setSelectionRange(e.value.length,e.value.length)}},[r]),r)?(0,i.jsxs)(d.k,{direction:"column",align:"flex-end",height:"100%",children:[(0,i.jsx)(tZ.g,{value:o,onChange:e=>{a(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)(d.k,{gap:"12px",alignItems:"flex-end",children:[(0,i.jsx)(l.r,{onClick:()=>{setTimeout(()=>{s(!1)},100)},colorScheme:"blue",children:"cancel"}),(0,i.jsx)(et.z,{mt:"8px",size:"sm",colorScheme:"blue",onClick:u,children:"Update"})]})]}):(0,i.jsx)(ee.x,{height:"100%",overflow:"auto",fontSize:"11pt",onClick:()=>{a(n||""),s(!0)},whiteSpace:"pre-wrap",wordBreak:"break-word",color:n?"inherit":"lightgray",children:n||"Add description here"})}var tG=t(48939);function tY(){let e=(0,o.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 t$(){let e=(0,tc._)(["\n **SQL**\n ```sql\n ","\n ```\n "],["\n **SQL**\n \\`\\`\\`sql\n ","\n \\`\\`\\`\n "]);return t$=function(){return e},e}function t0(e){return e.description?e.description:"_(no description)_"}var t1=t(88123),t5=t(23226);let t2=e=>{let{value:n,onChange:t,onRun:r,onRunBase:l,onRunDiff:o,label:a,CustomEditor:c,options:u={},...h}=e;return(0,i.jsxs)(i.Fragment,{children:[(a||r||l)&&(0,i.jsxs)(d.k,{backgroundColor:"#EDF2F880",height:"40px",minH:"40px",fontSize:"14px",align:"center",margin:"0",padding:"0px 16px",flex:"0 0 40px",children:[(0,i.jsx)(ee.x,{as:"b",children:a?a.toUpperCase():""}),(0,i.jsx)(m.L,{}),(r||l)&&(0,i.jsx)(et.z,{size:"sm",variant:"outline",onClick:r||l,backgroundColor:"white",leftIcon:(0,i.jsx)(s.J,{as:tH.gmG}),padding:"6px 12px",children:"Run Query"})]}),null!=c?c:(0,i.jsx)(t5.ML,{language:"sql",theme:"vs",value:n,onChange:e=>{void 0!==e&&t&&t(e)},onMount:(e,n)=>{r&&e.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.Enter,r),l&&e.addCommand(n.KeyMod.Alt|n.KeyCode.Enter,l),o&&e.addCommand(n.KeyMod.CtrlCmd|n.KeyMod.Shift|n.KeyCode.Enter,o)},options:{tabSize:2,fontSize:16,lineNumbers:"on",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"indent",...u}})]})},t4=e=>{let{value:n,baseValue:t,onChange:r,onChangeBase:l,onRun:s,onRunBase:o,onRunDiff:a,options:c={},labels:u,BaseEnvironmentSetupGuide:h,...x}=e,m=u?u[0]:"Base",p=u?u[1]:"Current";return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(d.k,{height:"100%",gap:0,children:[(0,i.jsx)(t1.K,{height:"100%",width:"50%",gap:0,borderRight:"1px",borderColor:"#D4DBE4",children:(0,i.jsx)(t2,{label:m,value:t||"",onChange:l,onRunBase:o,options:c,CustomEditor:h,...x})}),(0,i.jsx)(t1.K,{height:"100%",width:"50%",gap:0,children:(0,i.jsx)(t2,{label:p,value:n,onChange:r,onRun:s,options:c,...x})})]})})};var t6=t(90723),t3=t(86932);let t9=(0,eP.G)((e,n)=>{var t,l,s;let{isRunning:o,isAborting:a,progress:c,error:u,run:h,onCancel:x,viewOptions:m,onViewOptionsChanged:p,RunResultView:f,children:g,onExecuteRun:j}=e,v=(null==u?void 0:null===(l=u.response)||void 0===l?void 0:null===(t=l.data)||void 0===t?void 0:t.detail)||(null==h?void 0:h.error);if(v)return(0,i.jsxs)(tI.b,{status:"error",children:[(0,i.jsx)(tE.z,{}),"Error: ",v]});if(void 0!==o?o:(null==h?void 0:h.status)==="running"){let e=(null==c?void 0:c.message)?c.message:(null==h?void 0:null===(s=h.progress)||void 0===s?void 0:s.message)?h.progress.message:"Loading...";return(0,i.jsx)(e2.M,{p:"16px",height:"100%",bg:"rgb(249,249,249)",children:(0,i.jsxs)(nu.g,{children:[(0,i.jsxs)(d.k,{alignItems:"center",children:[(null==c?void 0:c.percentage)==null?(0,i.jsx)(t6.D,{isIndeterminate:!0,size:"20px",mr:"8px"}):(0,i.jsx)(t6.D,{size:"20px",value:100*c.percentage,mr:"8px"}),a?(0,i.jsx)(i.Fragment,{children:"Aborting..."}):(0,i.jsx)(i.Fragment,{children:e})]}),!a&&(0,i.jsx)(et.z,{onClick:x,colorScheme:"blue",size:"sm",children:"Cancel"})]})})}if(!h)return(0,i.jsx)(e2.M,{bg:"rgb(249,249,249)",height:"100%",children:"Loading..."});if(g&&f)throw Error("RunView requires either a children or a RunResultView prop, but not both.");if(!g&&!f)throw Error("RunView requires at least one of children or RunResultView prop.");return(0,i.jsxs)(r.x,{h:"100%",style:{contain:"size layout"},overflow:"auto",children:[f&&(h.error||h.result)&&(0,i.jsx)(t3.SV,{children:(0,i.jsx)(f,{ref:n,run:h,viewOptions:m,onViewOptionsChanged:p})}),null==g?void 0:g({run:h,viewOptions:m,onViewOptionsChanged:p})]})});var t8=t(51143),t7=t(29123),ie=t(67738),it=t(71281),ii=t(26053),ir=t(54456);t(43759),t(80401);var il=t(36379),is=t(39008),io=t(97433),ia=t(1305);function ic(e){let{node:n}=e,{icon:t}=tJ(n.resourceType);return(0,i.jsx)(nD.u,{hasArrow:!0,label:"Type of resource",children:(0,i.jsxs)(td.Vp,{children:[(0,i.jsx)(td.AD,{as:t}),(0,i.jsx)(td.Sn,{children:n.resourceType})]})})}function id(e){let{rowCount:n}=e,t=n.base,r=n.curr,l=null===n.base?"N/A":"".concat(n.base," rows"),o=null===n.curr?"N/A":"".concat(n.curr," rows");return null===t&&null===r?(0,i.jsx)(i.Fragment,{children:" Failed to load"}):null===t||null===r?(0,i.jsxs)(x.U,{children:[(0,i.jsx)(ee.x,{children:l}),(0,i.jsx)(s.J,{as:io.Rgz}),(0,i.jsx)(ee.x,{children:o})]}):t===r?(0,i.jsxs)(x.U,{children:[(0,i.jsx)(ee.x,{children:o}),(0,i.jsx)(s.J,{as:ia.lxc,color:"gray.500"}),(0,i.jsx)(ee.x,{color:"gray.500",children:"No Change"})]}):t<r?(0,i.jsxs)(x.U,{children:[(0,i.jsx)(ee.x,{children:o}),(0,i.jsx)(s.J,{as:ia.Tvk,color:"green.500"}),(0,i.jsx)(ee.x,{color:"green.500",children:nR(t,r)})]}):(0,i.jsxs)(x.U,{children:[(0,i.jsx)(ee.x,{children:o}),(0,i.jsx)(s.J,{as:ia.ebp,color:"red.500"}),(0,i.jsx)(ee.x,{color:"red.500",children:nR(t,r)})]})}function iu(e){var n,t;let r,{rowCount:l,node:s,onRefresh:o,isFetching:a}=e,{runsAggregated:c,refetchRunsAggregated:d}=eS(),u=null==c?void 0:null===(n=c[s.id])||void 0===n?void 0:n.row_count_diff.result,h=null===(t=n2("row_count_diff"))||void 0===t?void 0:t.icon,x=l||u;if(x){let e=null===x.base?"N/A":x.base,n=null===x.curr?"N/A":x.curr;r="".concat(e," -> ").concat(n," rows")}return(0,i.jsx)(nD.u,{label:r,children:(0,i.jsxs)(td.Vp,{children:[(0,i.jsx)(td.AD,{as:h}),(0,i.jsx)(td.Sn,{children:x||a?(0,i.jsx)(is.N,{isLoaded:!a,noOfLines:1,skeletonHeight:2,minWidth:"30px",children:x?(0,i.jsx)(id,{rowCount:x}):"row count"}):(0,i.jsx)(i.Fragment,{children:"row count"})}),o&&(0,i.jsx)(td.bq,{as:nn.h,isLoading:a,"aria-label":"Query Row Count",icon:(0,i.jsx)(tg.n,{}),size:"xs",onClick:o})]})})}function ih(e){var n,t;let r,{rowCount:l,node:s,onRefresh:o,isFetching:a}=e,{runsAggregated:c,refetchRunsAggregated:d}=eS(),u=null==c?void 0:null===(n=c[s.id])||void 0===n?void 0:n.row_count.result,h=null===(t=n2("row_count"))||void 0===t?void 0:t.icon,x=l||u;if(x){let e=null===x.curr?"N/A":x.curr;r="".concat(e," rows")}return(0,i.jsxs)(td.Vp,{children:[(0,i.jsx)(td.AD,{as:h}),(0,i.jsx)(td.Sn,{children:x||a?(0,i.jsx)(is.N,{isLoaded:!a,noOfLines:1,skeletonHeight:2,minWidth:"30px",children:x?"".concat(r):"row count"}):(0,i.jsx)(i.Fragment,{children:"row count"})}),o&&(0,i.jsx)(td.bq,{as:nn.h,isLoading:a,"aria-label":"Query Row Count",icon:(0,i.jsx)(tg.n,{}),size:"xs",onClick:o,disabled:"base"===s.from})]})}let ix=e=>{let{node:n,action:t}=e,{status:l,skipReason:s,run:o}=t;if("pending"===l)return(0,i.jsx)(t6.D,{size:"20px",value:0});if("skipped"===l)return(0,i.jsx)(td.Vp,{backgroundColor:"gray.100",children:(0,i.jsxs)(d.k,{fontSize:"10pt",color:"gray.500",alignItems:"center",gap:"3px",children:[(0,i.jsx)(r.x,{children:"Skipped"}),s&&(0,i.jsx)(nD.u,{label:s,children:(0,i.jsx)(il.s,{})})]})});if(!o)return(0,i.jsx)(t6.D,{isIndeterminate:!0,size:"20px"});let{error:a,result:c,run_id:u,progress:h}=o;if("running"===l)return(null==h?void 0:h.percentage)===void 0?(0,i.jsx)(t6.D,{isIndeterminate:!0,size:"20px"}):(0,i.jsx)(t6.D,{size:"20px",value:100*h.percentage});if(a)return(0,i.jsxs)(d.k,{fontSize:"10pt",color:"gray",children:[(0,i.jsx)(r.x,{children:"Error"}),s&&(0,i.jsx)(nD.u,{label:a,children:(0,i.jsx)(nd.a,{})})]});if("value_diff"===o.type){let e=0;for(let n of c.data.data)n[2]<1&&e++;return(0,i.jsx)(td.Vp,{backgroundColor:e>0?"red.100":"green.100",children:(0,i.jsx)(td.Sn,{children:(0,i.jsx)(d.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"===o.type){let e=o.result;return(0,i.jsx)(iu,{rowCount:e[n.name],node:n})}if("row_count"===o.type){let e=o.result;return(0,i.jsx)(ih,{rowCount:e[n.name],node:n})}return(0,i.jsx)(i.Fragment,{children:u})};function im(e){var n;let t,r,{rowCount:l}=e,s=l.base,o=l.curr,a=null===l.base?"N/A":"".concat(l.base," Rows"),c=null===l.curr?"N/A":"".concat(l.curr," Rows");return null===s&&null===o?(t="Failed to load",r="gray"):null===s||null===o?(t="".concat(a," -> ").concat(c),r=null===s?"green":"red"):s===o?(t="=",r="gray"):s!==o&&(t="".concat(nR(s,o)," Rows"),r=s<o?"green":"red"),(0,i.jsxs)(td.Vp,{colorScheme:r,children:[(0,i.jsx)(td.AD,{as:null===(n=n2("row_count_diff"))||void 0===n?void 0:n.icon}),(0,i.jsx)(td.Sn,{children:t})]})}let ip=e=>{var n;let t,l,{id:o,inverted:a}=e,{lineageGraph:c,runsAggregated:u}=eS(),h=null==u?void 0:u[o],x=null==c?void 0:c.nodes[o];if(!h&&!x)return(0,i.jsx)(i.Fragment,{});if((null==x?void 0:x.data.base)&&x.data.current&&(t=tB(x.data.base.columns,x.data.current.columns)),null==h?void 0:h.row_count_diff){let e=h.row_count_diff;l=e.result.curr!==e.result.base}let p=a?"white":tK("modified").color;return(0,i.jsxs)(d.k,{flex:"1",children:[void 0!==t&&(0,i.jsx)(nD.u,{label:"Schema (".concat(t?"changed":"no change",")"),openDelay:500,children:(0,i.jsx)(r.x,{height:"16px",children:(0,i.jsx)(s.J,{as:null===(n=n2("schema_diff"))||void 0===n?void 0:n.icon,color:t?p:a?"gray":"lightgray"})})}),(0,i.jsx)(m.L,{}),(null==h?void 0:h.row_count_diff)&&void 0!==l&&(0,i.jsx)(nD.u,{label:"Row count (".concat(l?"changed":"=",")"),openDelay:500,children:(0,i.jsx)(r.x,{children:(0,i.jsx)(im,{rowCount:h.row_count_diff.result})})})]})},ig=e=>{let{checked:n,onClick:t}=e;return(0,i.jsx)(d.k,{onClick:t,alignSelf:"center",alignItems:"center",cursor:"pointer",children:n?(0,i.jsx)(s.J,{boxSize:"20px",as:tq.xik}):(0,i.jsx)(s.J,{boxSize:"20px",as:tq.hGI})})};var ij=t(54134),iv=t(67221),iy=t(66912);async function ib(e){return(await K.post("/api/checks",{type:"schema_diff",params:e})).data}let iw={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."},ik=e=>{var n;let[t,i]=(0,b.useState)(!1),[r,l]=(0,b.useState)(!1),[,s]=ez(),{error:o,data:a}=(0,w.a)({queryKey:q.run(e||""),queryFn:async()=>em(e||"",t?2:0),enabled:!!e,refetchInterval:!!t&&50,retry:!1});(0,b.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"||(null==a?void 0:a.type)==="row_count")&&s()),(null==a?void 0:a.status)==="running"&&i(!0)},[a,o,t,s]);let c=(0,b.useCallback)(async()=>{l(!0),e&&await ep(e)},[e,l]),d=(null==a?void 0:a.type)?null===(n=n2(a.type))||void 0===n?void 0:n.RunResultView:void 0;return{run:a,isRunning:t,aborting:r,error:o,onCancel:c,RunResultView:d}};var iC=t(46475),i_=t(87337),iS=t(3550),iz=t.n(iS),iR=t(53750),iL=t(68943),iI=t(37281),iE=t.n(iI);let iT="ignore-screenshot";function iD(e){let{renderLibrary:n="html2canvas",imageType:t="png",backgroundColor:r=null,boardEffect:l=!0,shadowEffect:s=!1,borderStyle:o="solid 1px #ccc",borderRadius:a="10px",onSuccess:c,onError:h,ignoreElements:x}=e,[m,p]=(0,b.useState)("idle"),f=(0,b.useRef)(null),{onOpen:g,setImgBlob:j,ImageDownloadModal:v}=function(){let{isOpen:e,onOpen:n,onClose:t}=(0,Q.q)(),[r,l]=(0,b.useState)();return{onOpen:n,setImgBlob:l,ImageDownloadModal:function(){let[n,l]=(0,b.useState)();return(0,b.useEffect)(()=>{if(!r)return;let e=new FileReader;e.readAsDataURL(r),e.onloadend=e=>{var n;(null===(n=e.target)||void 0===n?void 0:n.result)!=null&&l(e.target.result)}},[l]),(0,i.jsxs)(Z.u_,{size:"3xl",isOpen:e,onClose:t,children:[(0,i.jsx)(X.Z,{}),(0,i.jsxs)(G.h,{children:[(0,i.jsx)(Y.x,{children:"Screenshot Preview"}),(0,i.jsx)(eR.o,{}),(0,i.jsxs)($.f,{children:[(0,i.jsxs)(d.k,{px:"10px",gap:"10px",direction:"column",children:[(0,i.jsxs)(d.k,{alignItems:"center",gap:"5px",children:[(0,i.jsx)(il.s,{color:"red.600"}),(0,i.jsx)(ee.x,{fontWeight:"500",display:"inline",children:"Copy to the Clipboard"})," ","is not supported in the current browser"]}),(0,i.jsx)(ee.x,{children:"Please download it directly"})]}),(0,i.jsx)(u.E,{src:n,alt:"screenshot"})]}),(0,i.jsxs)(en.m,{children:[(0,i.jsx)(et.z,{mr:3,onClick:t,children:"Close"}),(0,i.jsx)(et.z,{colorScheme:"blue",onClick:()=>{if(!r)return;let e=new Date,n="recce-screenshot-".concat((0,iL.WU)(e,"yyyy-MM-dd-HH-mm-ss"),".png");iE()(r,n),t()},children:"Download"})]})]})]})}}}(),y=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,c=e.style.borderRadius,d=e.style.backgroundColor,u=e.style.height;try{var h;e.style.overflow="hidden",e.style.border=l?o:"",e.style.borderRadius=l?a:"",e.style.backgroundColor=r||"",e.style.height="".concat(String(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 iz()(e,{logging:!1,backgroundColor:null,ignoreElements:x}):await (0,iR.rT)(e,{filter:x?e=>!x(e):void 0});t.remove();let c=s?document.createElement("canvas"):i;if(s){c.width=i.width+80,c.height=i.height+80;let e=c.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 d=await fetch(c.toDataURL());return await d.blob()}catch(e){throw console.error("Error converting to image",e),e}finally{e.style.overflow=t,e.style.border=i,e.style.borderRadius=c,e.style.backgroundColor=d,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)]:y()})]),p("success"),c&&c()}catch(e){"ClipboardItem is not defined"===e.message?(j(await y()),g(),p("success")):(p("error"),console.error("Error copying to clipboard",e),h&&h(e))}},ImageDownloadModal:v,ref:f}}function iO(e){let{successToast:n,failToast:t}=tY(),{isLoading:r,copyToClipboard:l,ImageDownloadModal:s,ref:o}=iD({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,b.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]),c=(0,b.useCallback)(()=>{o.current&&((o.current.element||o.current).style.boxShadow="")},[o]),d=(0,b.useCallback)(async()=>{o.current?(await l(),(o.current.element||o.current).style.boxShadow=""):t("Failed to copy image to clipboard","No content to copy")},[o,l,t]);return{ref:o,CopyToClipboardButton:function(e){let{imageType:n="png",...t}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(et.z,{size:"sm",leftIcon:(0,i.jsx)(e7.T,{}),style:{position:"absolute",bottom:"16px",right:"16px"},isLoading:r,onMouseEnter:a,onMouseLeave:c,onClick:d,children:"Copy to Clipboard"}),(0,i.jsx)(s,{})]})},onMouseEnter:a,onMouseLeave:c,onCopyToClipboard:d}}let iM=e=>{let{run:n}=e,t="running"===n.status,r=n.status;!r&&(n.result?r="finished":n.error&&(r="failed"));let l="",s="";"successful"===r||"finished"===r?(l="green",s="Finished"):"failed"===r?(l="red",s="Failed"):"cancelled"===r?(l="gray",s="Cancelled"):"running"===r?(l="blue",s="Running"):(l="green",s="Finished");let o=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,iL.WU)(e,"HH:mm"):t.toDateString()===e.toDateString()?"Yesterday, "+(0,iL.WU)(e,"HH:mm"):(0,iL.WU)(e,"MMM d, HH:mm")}(new Date(n.run_at)):null;return(0,i.jsxs)(d.k,{justifyContent:"start",fontSize:"11pt",color:"gray.500",gap:"3px",alignItems:"center",overflow:"hidden",children:[t&&(0,i.jsx)(t7.$,{size:"xs",color:"".concat(l,".400")}),(0,i.jsx)(ee.x,{fontWeight:500,color:"".concat(l,".400"),children:s}),(0,i.jsx)(ee.x,{children:"•"}),(0,i.jsx)(ee.x,{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",children:o})]})},iA=e=>{var n;return(0,i.jsxs)(d.k,{flex:"1",minH:"48px",m:"4px",px:"16px",py:"12px",bg:"blue.50",border:"1px",borderRadius:"4px",borderColor:"blue.400",align:null!==(n=e.align)&&void 0!==n?n:"center",gap:"12px",children:[(0,i.jsx)(s.J,{as:io.H33,width:"20px",height:"20px",color:"blue.900"}),e.children,(0,i.jsx)(m.L,{}),(0,i.jsx)(iy.P,{onClick:e.onClose})]})},iF=()=>(0,i.jsx)(l.r,{href:"https://datarecce.io/docs/get-started/#prepare-dbt-artifacts",isExternal:!0,color:"rgba(49, 130, 206, 1)",fontWeight:"bold",textDecoration:"underline",children:"Learn how"}),iN=e=>{let n=iC.ZP.stringify(e,null,2);return(0,i.jsx)(t5.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}})},iq=e=>{let{runType:n}=e,{isOpen:t,onClose:r}=(0,Q.q)({defaultIsOpen:!0});if(!t)return(0,i.jsx)(i.Fragment,{});switch(n){case"row_count":return(0,i.jsx)(iA,{onClose:r,children:(0,i.jsxs)(ee.x,{children:["Enable row count diffing, and other Recce features, by configuring a base dbt environment to compare against. ",(0,i.jsx)(iF,{})]})});case"profile":return(0,i.jsx)(iA,{onClose:r,children:(0,i.jsxs)(ee.x,{children:["Enable data-profile diffing, and other Recce features, by configuring a base dbt environment to compare against. ",(0,i.jsx)(iF,{})]})});default:return(0,i.jsx)(i.Fragment,{})}},iH=e=>{var n,t,r;let{runId:l,onClose:s,isSingleEnvironment:o}=e,{runAction:a}=n9(),{error:c,run:u,onCancel:h,isRunning:j}=ik(l),[v,y]=(0,b.useState)(),w=(0,k.NL)(),[,C]=(0,eI.TH)(),[_,S]=(0,b.useState)(0),z=!!o,R=(null==u?void 0:u.type)?null===(n=n2(u.type))||void 0===n?void 0:n.RunResultView:void 0,L=(0,b.useCallback)(()=>{a((null==u?void 0:u.type)||"",null==u?void 0:u.params)},[u,a]),I=null==u?void 0:u.check_id,E=(0,b.useCallback)(()=>{I&&C("/checks/".concat(I))},[I,C]),T=(0,b.useCallback)(async()=>{if(!l)return;let e=await ti(l,v);await w.invalidateQueries({queryKey:q.checks()}),C("/checks/".concat(e.check_id))},[l,C,w,v]),D=(null==u?void 0:u.type)==="query"||(null==u?void 0:u.type)==="query_diff"||(null==u?void 0:u.type)==="query_base",{ref:O,onCopyToClipboard:M,onMouseEnter:A,onMouseLeave:F}=iO();return(0,i.jsxs)(d.k,{direction:"column",children:[!!o&&(0,i.jsx)(iq,{runType:null==u?void 0:u.type}),(0,i.jsx)(p.m,{tabIndex:_,onChange:S,flexDirection:"column",mb:"1px",children:(0,i.jsxs)(f.t,{height:"50px",children:[(0,i.jsx)(g.O,{children:"Result"}),(0,i.jsx)(g.O,{children:"Params"}),D&&(0,i.jsx)(g.O,{children:"Query"}),(0,i.jsx)(m.L,{}),(0,i.jsxs)(x.U,{overflow:"hidden",children:[u&&(0,i.jsx)(iM,{run:u}),(0,i.jsx)(et.z,{leftIcon:(0,i.jsx)(tg.n,{}),variant:"outline",isDisabled:!l||j,size:"sm",onClick:L,children:"Rerun"}),(0,i.jsx)(et.z,{leftIcon:(0,i.jsx)(e7.T,{}),variant:"outline",isDisabled:!l||!(null==u?void 0:u.result)||!!c||0!==_,onMouseEnter:A,onMouseLeave:F,size:"sm",onClick:M,children:"Copy to Clipboard"}),(0,i.jsx)(function(){return z?(0,i.jsx)(i.Fragment,{}):(null==u?void 0:u.check_id)?(0,i.jsx)(et.z,{leftIcon:(0,i.jsx)(i_.n,{}),isDisabled:!l||!u.result||!!c,size:"sm",colorScheme:"blue",onClick:E,children:"Go to Check"}):(0,i.jsx)(et.z,{leftIcon:(0,i.jsx)(i_.n,{}),isDisabled:!l||!(null==u?void 0:u.result)||!!c,size:"sm",colorScheme:"blue",onClick:T,children:"Add to Checklist"})},{}),(0,i.jsx)(iy.P,{onClick:()=>{s&&s()}})]})]})}),0===_&&(0,i.jsx)(t9,{ref:O,error:c,run:u,onCancel:h,viewOptions:v,onViewOptionsChanged:y,RunResultView:R}),1===_&&u&&(0,i.jsx)(iN,{type:u.type,params:u.params}),2===_&&u&&((null===(t=u.params)||void 0===t?void 0:t.base_sql_template)?(0,i.jsx)(t4,{value:u.params.sql_template,baseValue:u.params.base_sql_template,options:{readOnly:!0}}):(0,i.jsx)(t2,{value:(null===(r=u.params)||void 0===r?void 0:r.sql_template)||"",options:{readOnly:!0}}))]})},iV=e=>{let{onClose:n,isSingleEnvironment:t}=e,{runId:r}=n9();return(0,i.jsx)(iH,{runId:r,onClose:n,isSingleEnvironment:t})};async function iP(e,n){return await ex("query",e,n)}async function iW(e,n){return await ex("query_base",e,n)}async function iK(e,n){return await ex("query_diff",e,n)}var iJ=t(30645),iB=t(11842),iU=t(9650);let iQ=e=>{let{defaultValues:n,suggestionList:t,onValuesChange:l,isDisabled:o}=e,[a,c]=(0,b.useState)(n||[]),[d,u]=(0,b.useState)(""),[h,x]=(0,b.useState)(!1),m=(0,b.useRef)(null),p=e=>{a.includes(e)||(u(""),c([...a,e]),l([...a,e]))};if(o)return(0,i.jsx)(nD.u,{label:iw.audit_helper,children:(0,i.jsx)(nP.I,{size:"xs",disabled:!0,placeholder:"Unavailable"})});let f=(null==t?void 0:t.filter(e=>""===d||e.includes(d)).filter(e=>!a.includes(e)))||[];return(0,i.jsxs)(iJ.B,{size:e.size,width:e.width,children:[(0,i.jsxs)(nJ.v,{isLazy:!0,closeOnSelect:!1,onOpen:()=>{var e;return null===(e=m.current)||void 0===e?void 0:e.focus()},children:[(0,i.jsxs)(nB.j,{width:"100%",children:[(0,i.jsx)(nP.I,{placeholder:e.placeholder,size:e.size,borderRadius:"4px",value:a.length>1?"".concat(a.length," ").concat(e.unitName,"s selected"):1===a.length?a[0]:"",onChange:()=>{},backgroundColor:"white"}),0===a.length&&(0,i.jsx)(iB.x,{children:(0,i.jsx)(s.J,{as:tH.RiI,color:"blue.500",fontSize:e.size,mt:"1",mr:"6"})})]}),(0,i.jsx)(nU.h,{children:(0,i.jsxs)(nQ.q,{zIndex:"popover",fontSize:e.size,width:e.width,children:[(0,i.jsx)(nZ.k,{children:(0,i.jsxs)(iU.E,{border:"1px solid #e2e8f0",borderRadius:"4px",width:"calc(100% - 8px)",marginX:"4px",padding:"4px",children:[a.map((n,t)=>(0,i.jsx)(iU.U,{children:(0,i.jsxs)(td.Vp,{size:e.size,children:[(0,i.jsx)(td.Sn,{paddingLeft:"8px",children:n}),(0,i.jsx)(td.SD,{paddingRight:"8px",onClick:()=>{c(a.filter(e=>e!==n)),l(a.filter(e=>e!==n))}})]},n)},"tag-".concat(t))),(0,i.jsx)(iU.U,{width:"100%",children:(0,i.jsx)(nP.I,{ref:m,placeholder:"Filter or add custom keys",variant:"unstyled",size:e.size,value:d,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&&(c(a.slice(0,-1)),l(a.slice(0,-1)))}},onBlur:()=>{m.current&&h&&m.current.focus()}})})]})}),(0,i.jsx)(tu.R,{}),(0,i.jsxs)(nZ.k,{children:[""!==d&&!(null==t?void 0:t.includes(d))&&(0,i.jsxs)(nX.s,{onClick:()=>{p(d),x(!1)},children:["Add '",d,"' to the list"]},"custom-value-by-filter"),f.map((e,n)=>(0,i.jsx)(nX.s,{onClick:()=>{p(e)},children:e},"option-".concat(n))).slice(0,10),f.length>10&&(0,i.jsx)(nD.u,{label:"Please use filter to find more items",placement:"top",children:(0,i.jsxs)(r.x,{px:"12px",color:"gray",fontSize:"8pt",children:["and ",f.length-10," more items..."]})})]})]})})]}),a.length>0&&(0,i.jsx)(iB.x,{children:(0,i.jsx)(et.z,{variant:"link",color:"#3182CE",fontSize:e.size,paddingTop:"4px",paddingRight:"24px",onClick:()=>{u(""),c([]),l([])},children:"Clear"})})]})},iZ=e=>{let{defaultPrimaryKeys:n,onPrimaryKeysChange:t,...r}=e,{lineageGraph:l,isActionAvailable:s}=eS(),o=(0,b.useMemo)(()=>{if(!l)return[];let e=new Set;for(let i in l.nodes){var n,t;let r=l.nodes[i],s=null===(n=r.data.base)||void 0===n?void 0:n.columns,o=null===(t=r.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()},[l]);return(0,i.jsx)(d.k,{...r,children:(0,i.jsxs)(eT.NI,{m:"4px 8px",children:[(0,i.jsxs)(eD.l,{fontSize:"8pt",margin:"0",children:["Diff with Primary Key(s) (suggested)"," ",(0,i.jsx)(nD.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)(il.s,{color:"gray.600",boxSize:"3"})})]}),(0,i.jsx)(iQ,{unitName:"key",defaultValues:n,suggestionList:o,onValuesChange:t,size:"xs",width:"240px",placeholder:"Select or type to add keys",isDisabled:!s("query_diff_with_primary_key")})]})})};var iX=t(17232),iG=t(16355);function iY(e){let{description:n,onLike:t,onDislike:r,onClickLink:s,externalLink:o,externalLinkText:a}=e;return(0,i.jsxs)(d.k,{gap:4,justifyContent:"center",alignContent:"center",alignItems:"center",children:[n,(0,i.jsx)(nn.h,{"aria-label":"thumbs up",variant:"ghost",icon:(0,i.jsx)(u.E,{src:"/imgs/feedback/thumbs-up.png",alt:"like"}),width:"32px",height:"32px",onClick:t}),(0,i.jsx)(nn.h,{"aria-label":"thumbs down",variant:"ghost",icon:(0,i.jsx)(u.E,{src:"/imgs/feedback/thumbs-down.png",alt:"dislike"}),width:"32px",height:"32px",onClick:r}),o&&a&&(0,i.jsx)(l.r,{href:o,isExternal:!0,textDecoration:"underline",onClick:s,children:a})]})}let i$="recce-",i0={bypassSaveOverwrite:"".concat(i$,"-bypass-save-overwrite"),previewChangeFeedbackID:"".concat(i$,"-preview-change-feedback"),prepareEnvGuideID:"".concat(i$,"-prepare-env")};var i1=t(26700),i5=t(71530),i2=t(73430),i4=t(93033),i6=t(94179),i3=t(80703),i9=t(12291),i8=t(7971);let i7=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",{clipPath:"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"})})})]}),re=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",{clipPath:"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",{clipPath:"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"})})]})]}),rn=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",{clipPath:"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"})})})]}),rt=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"})}),ri=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"})}),rr=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"})});var rl=t(4201),rs=t.n(rl);function ro(e){let n=(0,i8.D)(e);return(0,iL.WU)(n,"yyyy-MM-dd'T'HH:mm:ss")}function ra(e){return Object.values(e).every(e=>null===e)?[(0,i.jsx)(d.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)(tN.HC,{ml:"10px",children:[n,": ",t]},n)})}function rc(){var e,n,t,r,o,a;let{envInfo:c,reviewMode:u,lineageGraph:x}=eS(),{isOpen:m,onOpen:p,onClose:f}=(0,Q.q)(),g=null==c?void 0:c.git,j=null==c?void 0:c.pullRequest,v={...g,...j},y=null==c?void 0:null===(e=c.dbt)||void 0===e?void 0:e.base,b=null==c?void 0:null===(n=c.dbt)||void 0===n?void 0:n.current,w=(null==y?void 0:y.generated_at)?ro(y.generated_at):"",k=(null==b?void 0:b.generated_at)?ro(b.generated_at):"",C=new Set,_=new Set;if(null==x?void 0:x.nodes)for(let e of Object.values(x.nodes))(null===(o=e.data.base)||void 0===o?void 0:o.schema)&&C.add(e.data.base.schema),(null===(a=e.data.current)||void 0===a?void 0:a.schema)&&_.add(e.data.current.schema);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nD.u,{label:"Environment Info",placement:"bottom-end",children:(0,i.jsx)(nn.h,{size:"sm",variant:"unstyled","aria-label":"Export state",onClick:p,icon:(0,i.jsx)(s.J,{verticalAlign:"middle",as:rr,boxSize:"16px"})})}),(0,i.jsxs)(Z.u_,{isOpen:m,onClose:f,size:"3xl",children:[(0,i.jsx)(X.Z,{}),(0,i.jsxs)(G.h,{children:[(0,i.jsx)(Y.x,{children:"Environment Information"}),(0,i.jsx)(eR.o,{}),(0,i.jsx)($.f,{children:(0,i.jsxs)(d.k,{direction:"column",gap:"5px",children:[u?(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(d.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(h.X,{size:"sm",children:"Review Information"}),(0,i.jsxs)(tN.QI,{spacing:1,children:[v.url&&(0,i.jsxs)(tN.HC,{ml:"10px",children:["url:"," ",(0,i.jsx)(l.r,{href:v.url,color:"blue.500",isExternal:!0,children:v.url})]}),!rs()(v)&&ra(v)]})]})}):(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(d.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(h.X,{size:"sm",children:"Dev Information"}),(0,i.jsx)(tN.QI,{spacing:1,children:g&&ra(g)})]})}),(0,i.jsx)(nO.i,{}),(null==c?void 0:c.adapterType)==="dbt"&&(0,i.jsxs)(d.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(h.X,{size:"sm",children:"DBT"}),(0,i.jsx)(i1.x,{children:(0,i.jsxs)(i5.i,{variant:"simple",children:[(0,i.jsx)(i2.h,{children:(0,i.jsxs)(i4.Tr,{children:[(0,i.jsx)(i6.Th,{}),(0,i.jsx)(i6.Th,{children:"base"}),(0,i.jsx)(i6.Th,{children:"current"})]})}),(0,i.jsxs)(i3.p,{children:[(0,i.jsxs)(i4.Tr,{children:[(0,i.jsx)(i9.Td,{children:"schema"}),(0,i.jsx)(i9.Td,{children:JSON.stringify(Array.from(C))}),(0,i.jsx)(i9.Td,{children:JSON.stringify(Array.from(_))})]}),(0,i.jsxs)(i4.Tr,{children:[(0,i.jsx)(i9.Td,{children:"version"}),(0,i.jsx)(i9.Td,{children:null==y?void 0:y.dbt_version}),(0,i.jsx)(i9.Td,{children:null==b?void 0:b.dbt_version})]}),(0,i.jsxs)(i4.Tr,{children:[(0,i.jsx)(i9.Td,{children:"timestamp"}),(0,i.jsx)(i9.Td,{children:w}),(0,i.jsx)(i9.Td,{children:k})]})]})]})})]}),(null==c?void 0:c.adapterType)==="sqlmesh"&&(0,i.jsxs)(d.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,i.jsx)(h.X,{size:"sm",children:"SQLMesh"}),(0,i.jsx)(i1.x,{children:(0,i.jsxs)(i5.i,{variant:"simple",children:[(0,i.jsx)(i2.h,{children:(0,i.jsxs)(i4.Tr,{children:[(0,i.jsx)(i6.Th,{}),(0,i.jsx)(i6.Th,{children:"base"}),(0,i.jsx)(i6.Th,{children:"current"})]})}),(0,i.jsx)(i3.p,{children:(0,i.jsxs)(i4.Tr,{children:[(0,i.jsx)(i9.Td,{children:"Environment"}),(0,i.jsx)(i9.Td,{children:null===(t=c.sqlmesh)||void 0===t?void 0:t.base_env}),(0,i.jsx)(i9.Td,{children:null===(r=c.sqlmesh)||void 0===r?void 0:r.current_env})]})})]})})]})]})}),(0,i.jsx)(en.m,{children:(0,i.jsx)(et.z,{colorScheme:"blue",mr:3,onClick:f,children:"Close"})})]})]})]})}function rd(e){let{current:n,primaryKeys:t,setPrimaryKeys:l,onRunResultOpen:o,runQuery:a,isPending:c}=e;return(0,i.jsxs)(d.k,{justifyContent:"right",alignItems:"center",padding:"4pt 8pt",gap:"5px",height:"54px",borderBottom:"1px solid lightgray",flex:"0 0 54px",children:[(0,i.jsxs)(r.x,{children:[(0,i.jsxs)(h.X,{as:"h2",size:"md",display:"flex",alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.J,{as:iX.vc4,boxSize:"1.2em"}),"Sandbox"]}),(0,i.jsxs)(ee.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)(m.L,{}),(0,i.jsx)(iZ,{defaultPrimaryKeys:t,onPrimaryKeysChange:l}),(0,i.jsx)(nD.u,{label:"Run diff to see the changes",children:(0,i.jsx)(et.z,{size:"xs",marginTop:"16px",fontSize:"14px",onClick:()=>{o(),a()},colorScheme:"blue",isLoading:c,children:"Run Diff"})})]})}function ru(e){var n,t,r;let{currentModelID:l,height:s="32px",flex:o="0 0 auto"}=e,{lineageGraph:a,envInfo:c}=eS(),u="0 16px",h=ro((null==c?void 0:null===(t=c.dbt)||void 0===t?void 0:null===(n=t.current)||void 0===n?void 0:n.generated_at)||""),x=(0,t8.Q)(h,{addSuffix:!0}),m="N/A";if(null==a?void 0:a.nodes[l]){let e=a.nodes[l];(null===(r=e.data.current)||void 0===r?void 0:r.schema)&&(m=e.data.current.schema)}return(0,i.jsxs)(d.k,{gap:0,height:s,flex:o,fontSize:"14px",align:"center",margin:"0",backgroundColor:"#EDF2F880",children:[(0,i.jsx)(t1.K,{width:"50%",children:(0,i.jsxs)(ee.x,{as:"b",margin:u,children:["ORIGINAL (Schema: ",m,", Last Updated: ",x,")"]})}),(0,i.jsx)(t1.K,{width:"50%",children:(0,i.jsx)(ee.x,{as:"b",margin:u,children:"SANDBOX EDITOR"})})]})}function rh(e){let{current:n,onChange:t}=e,l=function(e,n){let t=(0,b.useRef)(null);return(0,b.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)(r.x,{flex:1,overflowY:"auto",children:(0,i.jsx)(t5.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,renderOverviewRuler:!1,minimap:{enabled:!0}},onMount:l.onMount})})}function rx(e){let{isOpen:n,onClose:t,current:s}=e,{isOpen:c,onClose:m,onOpen:p}=(0,Q.q)(),[f,g]=(0,b.useState)((null==s?void 0:s.raw_code)||""),{showRunId:j,clearRunResult:v}=n9(),{primaryKeys:y,setPrimaryKeys:w}=z(),{data:k,isLoading:C}=ek(),_=async()=>{let e={current_model:(null==s?void 0:s.name)||"",primary_keys:y,sql_template:f},{run_id:n}=await iK(e,{nowait:!0});return j(n),await em(n)},{mutate:S,isPending:R}=(0,tC.D)({mutationFn:_,onSuccess(e,n){e.error?ea({action:"run",node:null==s?void 0:s.name,status:"failure"}):(ea({action:"run",node:null==s?void 0:s.name,status:"success"}),setTimeout(()=>{L()},1e3),!C&&(null==k?void 0:k.single_env_onboarding)&&setTimeout(()=>{E()},2e3))}}),{feedbackToast:L,closeToast:I}=function(e){let n=(0,o.p)(),{feedbackId:t,description:r,onFeedbackSubmit:l,externalLink:s,externalLinkText:a}=e;return{feedbackToast:function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],o=localStorage.getItem(t);!n.isActive(t)&&("true"!==o||e)&&n({id:t,position:"bottom-right",duration:null,render:e=>{let{id:n,onClose:o}=e;return(0,i.jsx)(tI.b,{status:"success",variant:"subtle",zIndex:"toast",borderColor:"gray.200",borderWidth:3,borderRadius:"md",backgroundColor:"white",opacity:1,children:(0,i.jsx)(iG.X,{fontSize:"md",children:(0,i.jsxs)(x.U,{children:[(0,i.jsx)(iY,{description:r,onLike:()=>{l("like"),o(),localStorage.setItem(t,"true")},onDislike:()=>{l("dislike"),o(),localStorage.setItem(t,"true")},externalLink:s,externalLinkText:a,onClickLink:()=>{l("link")}}),(0,i.jsx)(iy.P,{onClick:()=>{o()}})]})})})}})},closeToast:()=>{n.closeAll()}}}({feedbackId:i0.previewChangeFeedbackID,description:"Enjoy preview change?",onFeedbackSubmit:e=>{switch(e){case"like":ec({feedback:"like",node:null==s?void 0:s.name});break;case"dislike":ec({feedback:"dislike",node:null==s?void 0:s.name});break;case"link":ec({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:E,closeGuideToast:T}=function(e){let n=(0,o.p)(),{guideId:t,description:r,externalLink:s,externalLinkText:a,onExternalLinkClick:c}=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)(tI.b,{status:"success",variant:"subtle",zIndex:"toast",borderColor:"gray.200",borderWidth:3,borderRadius:"md",backgroundColor:"white",opacity:1,children:(0,i.jsx)(iG.X,{fontSize:"md",children:(0,i.jsxs)(x.U,{children:[(0,i.jsxs)(ee.x,{children:[r," ",(0,i.jsx)(l.r,{textDecor:"underline",isExternal:!0,href:s,onClick:()=>{c&&c(),t()},children:a})]}),(0,i.jsx)(iy.P,{onClick:()=>{t()}})]})})})}})},closeGuideToast:()=>{n.closeAll()}}}({guideId:i0.prepareEnvGuideID,description:"Want to compare data changes with production data?",externalLink:"https://datarecce.io/docs/get-started/#prepare-dbt-artifacts",externalLinkText:"Learn how.",onExternalLinkClick:()=>{ed({action:"external_link",from:"preview_changes",node:null==s?void 0:s.name})}});return(0,b.useEffect)(()=>{n&&g((null==s?void 0:s.raw_code)||"")},[n,s]),(0,i.jsx)(Z.u_,{isOpen:n,size:"full",onClose:()=>{t(),m(),v(),I(),T(),ea({action:"close",node:null==s?void 0:s.name})},children:(0,i.jsxs)(G.h,{height:"100%",children:[(0,i.jsx)(Y.x,{height:"40px",bg:"rgb(77, 209, 176)",px:0,py:4,children:(0,i.jsxs)(d.k,{alignItems:"center",height:"100%",gap:"10px",children:[(0,i.jsx)(u.E,{boxSize:"20px",ml:"18px",src:"/logo/recce-logo-white.png",alt:"recce-logo-white"}),(0,i.jsx)(h.X,{as:"h1",fontFamily:'"Montserrat", sans-serif',fontSize:"lg",color:"white",children:"RECCE"}),(0,i.jsx)(a.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:"Experiment"})]})}),(0,i.jsx)(eR.o,{}),(0,i.jsx)($.f,{p:0,children:(0,i.jsxs)(tF,{sizes:c?[50,50]:[100,0],minSize:c?100:0,gutterSize:c?5:0,style:{flex:"1",contain:"size",height:"100%"},children:[(0,i.jsxs)(d.k,{direction:"column",height:"100%",m:0,p:0,children:[(0,i.jsx)(rd,{current:s,primaryKeys:null!=y?y:[],setPrimaryKeys:w,onRunResultOpen:p,runQuery:S,isPending:R}),(0,i.jsx)(ru,{height:"32pxs",flex:"0 0 auto",currentModelID:(null==s?void 0:s.id)||""}),(0,i.jsx)(rh,{current:s,onChange:g})]}),c?(0,i.jsx)(iV,{onClose:m,disableAddToChecklist:!0}):(0,i.jsx)(r.x,{})]})}),(0,i.jsx)(r.x,{position:"fixed",bottom:"4",right:"4",opacity:.5,children:(0,i.jsx)(nD.u,{label:"Give us feedback",children:(0,i.jsx)(nn.h,{"aria-label":"feedback",icon:(0,i.jsx)(e9.xJq,{}),variant:"ghost",size:"md",onClick:()=>{L(!0)}})})})]})})}var rm=t(84056);let rp=e=>{var n,t,l,s,o,a;let{node:c}=e,{isOpen:d,onOpen:u,onClose:x}=(0,Q.q)(),[m,p]=(0,b.useState)(!1),{data:f,isLoading:g}=ek(),j=null==f?void 0:f.single_env_onboarding;if(g)return(0,i.jsx)(i.Fragment,{});if("model"!==c.resourceType&&"snapshot"!==c.resourceType)return"Not available";let v={readOnly:!0,lineNumbers:"on",automaticLayout:!0,renderOverviewRuler:!1,wordWrap:"off",minimap:{enabled:!1}},y={readOnly:!0,lineNumbers:"on",automaticLayout:!0,wordWrap:"off",minimap:{enabled:!1}},w=null===(n=c.data.base)||void 0===n?void 0:n.raw_code,k=null===(t=c.data.current)||void 0===t?void 0:t.raw_code,C=null!==(a=null!==(o=null===(l=c.data.base)||void 0===l?void 0:l.name)&&void 0!==o?o:null===(s=c.data.current)||void 0===s?void 0:s.name)&&void 0!==a?a:"";return(0,i.jsxs)(r.x,{style:{position:"relative"},height:"100%",onMouseEnter:()=>{p(!0)},onMouseLeave:()=>{p(!1)},children:[j?(0,i.jsx)(t2,{language:"sql",theme:"vs",value:null!=w?w:"",options:y}):(0,i.jsx)(t5.SV,{language:"sql",theme:"vs",original:w,modified:k,options:{...v,renderSideBySide:!1}}),(0,i.jsx)(nn.h,{icon:(0,i.jsx)(tq.Tlm,{}),onClick:u,size:"md","aria-label":"",variant:"ghost",style:{position:"absolute",top:"5px",right:"20px",opacity:m?.5:.1,transition:"opacity 0.3s ease-in-out"}}),(0,i.jsxs)(Z.u_,{isOpen:d,onClose:x,size:"6xl",children:[(0,i.jsx)(X.Z,{}),(0,i.jsxs)(G.h,{overflowY:"auto",height:"75%",children:[(0,i.jsx)(Y.x,{children:j?(0,i.jsxs)(h.X,{as:"h1",size:"md",children:[(0,i.jsx)("code",{children:C})," Model Code"]}):(0,i.jsxs)(h.X,{as:"h1",size:"md",children:[(0,i.jsx)("code",{children:C})," Model Code Diff"]})}),(0,i.jsx)(eR.o,{}),(0,i.jsx)($.f,{children:j?(0,i.jsx)(t5.ML,{language:"sql",theme:"vs",value:null!=w?w:"",options:{...y,fontSize:16}}):(0,i.jsx)(t5.SV,{language:"sql",theme:"vs",original:w,modified:k,options:{...v,fontSize:16}})})]})]})]})};function rf(e){let{node:n,onCloseNode:t}=e,[,l]=(0,eI.TH)(),{setSqlQuery:o,setPrimaryKeys:a}=z(),c="model"===n.resourceType||"seed"===n.resourceType||"source"===n.resourceType||"snapshot"===n.resourceType,{isOpen:u,onOpen:j,onClose:v}=(0,Q.q)(),{isOpen:y,onClose:w}=(0,Q.q)({defaultIsOpen:!0}),{runAction:k}=n9(),{envInfo:C,isActionAvailable:_}=eS(),{primaryKey:S}=eN(n.name),R=()=>{k("row_count",{node_names:[n.name]},{showForm:!1,showLast:!1})},L=()=>{k("row_count_diff",{node_names:[n.name]},{showForm:!1,showLast:!1})},{data:I}=ek(),E=null==I?void 0:I.single_env_onboarding,T=(0,b.useCallback)(async()=>{let e=n.id,t=await ib({node_id:e});l("/checks/".concat(t.check_id))},[n,l]),D=(e,n)=>e?iw.add_or_remove:_(n)?"":"value_diff"===n?iw.audit_helper:"profile_diff"===n||"profile"===n?iw.dbt_profiler:"This action is not supported yet.",O="added"===n.changeStatus||"removed"===n.changeStatus;return(0,i.jsxs)(iv.r,{height:"100%",templateRows:"auto auto 1fr",children:[(0,i.jsxs)(x.U,{children:[(0,i.jsx)(r.x,{flex:"0 1 20%",p:"16px",children:(0,i.jsx)(h.X,{size:"sm",children:n.name})}),(0,i.jsx)(m.L,{}),E?(0,i.jsx)(function(){var e,t,r;return"model"!==n.resourceType&&"seed"!==n.resourceType&&"snapshot"!==n.resourceType?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(nJ.v,{children:[(0,i.jsx)(nB.j,{as:et.z,size:"xs",variant:"outline",rightIcon:(0,i.jsx)(rm.v,{}),children:"Explore"}),(0,i.jsxs)(nQ.q,{children:[(0,i.jsx)(nX.s,{icon:(0,i.jsx)(s.J,{as:null===(e=n2("query"))||void 0===e?void 0:e.icon}),fontSize:"14px",onClick:()=>{(null==C?void 0:C.adapterType)==="dbt"?o('select * from {{ ref("'.concat(n.name,'") }}')):(null==C?void 0:C.adapterType)==="sqlmesh"&&o("select * from ".concat(n.name)),l("/query")},children:"Query"}),(0,i.jsx)(nX.s,{icon:(0,i.jsx)(s.J,{as:null===(t=n2("row_count"))||void 0===t?void 0:t.icon}),fontSize:"14px",onClick:()=>{R()},children:"Row Count"}),(0,i.jsx)(nD.u,{label:D(O,"profile"),placement:"left",children:(0,i.jsx)(nX.s,{icon:(0,i.jsx)(s.J,{as:null===(r=n2("profile"))||void 0===r?void 0:r.icon}),fontSize:"14px",isDisabled:O||!_("profile"),onClick:()=>{k("profile",{model:n.name},{showForm:!0,showLast:!1})},children:"Profile"})})]})]})},{}):(0,i.jsx)(function(){var e,t,r,c,d,u,h,x;return"model"!==n.resourceType&&"seed"!==n.resourceType&&"snapshot"!==n.resourceType?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(nJ.v,{children:[(0,i.jsx)(nB.j,{as:et.z,size:"xs",variant:"outline",rightIcon:(0,i.jsx)(rm.v,{}),children:"Explore"}),(0,i.jsxs)(nQ.q,{children:[(0,i.jsx)(nX.s,{icon:(0,i.jsx)(s.J,{as:null===(e=n2("query_diff"))||void 0===e?void 0:e.icon}),fontSize:"14px",onClick:()=>{(null==C?void 0:C.adapterType)==="dbt"?o('select * from {{ ref("'.concat(n.name,'") }}')):(null==C?void 0:C.adapterType)==="sqlmesh"&&o("select * from ".concat(n.name)),_("query_diff_with_primary_key")&&a(void 0!==S?[S]:void 0),l("/query")},children:"Query"}),(0,i.jsx)(nX.s,{fontSize:"14px",icon:(0,i.jsx)(s.J,{as:null===(t=n2("sandbox"))||void 0===t?void 0:t.icon}),onClick:()=>{_("query_diff_with_primary_key")&&a(void 0!==S?[S]:void 0),j(),ea({action:"explore",node:n.name})},children:"Sandbox (Experiment)"}),(0,i.jsx)(tu.R,{}),(0,i.jsxs)(nZ.k,{title:"Diff",m:"0",p:"4px 12px",children:[(0,i.jsx)(nX.s,{icon:(0,i.jsx)(s.J,{as:null===(r=n2("row_count_diff"))||void 0===r?void 0:r.icon}),fontSize:"14px",onClick:()=>{L()},children:"Row Count Diff"}),(0,i.jsx)(nD.u,{label:D(O,"profile_diff"),placement:"left",children:(0,i.jsx)(nX.s,{icon:(0,i.jsx)(s.J,{as:null===(c=n2("profile_diff"))||void 0===c?void 0:c.icon}),fontSize:"14px",isDisabled:O||!_("profile_diff"),onClick:()=>{k("profile_diff",{model:n.name},{showForm:!0,showLast:!1})},children:"Profile Diff"})}),(0,i.jsx)(nD.u,{label:D(O,"value_diff"),placement:"left",children:(0,i.jsx)(nX.s,{icon:(0,i.jsx)(s.J,{as:null===(d=n2("value_diff"))||void 0===d?void 0:d.icon}),fontSize:"14px",isDisabled:O||!_("value_diff"),onClick:()=>{k("value_diff",{model:n.name},{showForm:!0,showLast:!1})},children:"Value Diff"})}),(0,i.jsx)(nD.u,{label:D(O,"top_k_diff"),placement:"left",children:(0,i.jsx)(nX.s,{icon:(0,i.jsx)(s.J,{as:null===(u=n2("top_k_diff"))||void 0===u?void 0:u.icon}),fontSize:"14px",isDisabled:O,onClick:()=>{k("top_k_diff",{model:n.name,column_name:"",k:50},{showForm:!0})},children:"Top-K Diff"})}),(0,i.jsx)(nD.u,{label:D(O,"histogram_diff"),placement:"left",children:(0,i.jsx)(nX.s,{icon:(0,i.jsx)(s.J,{as:null===(h=n2("histogram_diff"))||void 0===h?void 0:h.icon}),fontSize:"14px",isDisabled:O,onClick:()=>{k("histogram_diff",{model:n.name,column_name:"",column_type:""},{showForm:!0})},children:"Histogram Diff"})})]}),(0,i.jsx)(tu.R,{}),(0,i.jsx)(nZ.k,{title:"Add to Checklist",m:"0",p:"4px 12px",children:(0,i.jsx)(nX.s,{icon:(0,i.jsx)(s.J,{as:null===(x=n2("schema_diff"))||void 0===x?void 0:x.icon}),fontSize:"14px",onClick:()=>{T()},children:"Schema Diff"})})]})]})},{}),(0,i.jsx)(r.x,{flex:"0 1 1%",children:(0,i.jsx)(iy.P,{onClick:t})})]}),(0,i.jsx)(r.x,{color:"gray",paddingLeft:"16px",children:(0,i.jsxs)(x.U,{spacing:"8px",children:[(0,i.jsx)(ic,{node:n}),("model"===n.resourceType||"snapshot"===n.resourceType||"seed"===n.resourceType)&&(E?(0,i.jsx)(ih,{node:n,onRefresh:R}):(0,i.jsx)(iu,{node:n,onRefresh:L}))]})}),c&&(0,i.jsxs)(p.m,{overflow:"auto",as:d.k,children:[E&&y&&(0,i.jsx)(r.x,{p:"12px",children:(0,i.jsx)(iA,{onClose:w,align:"flex-start",children:(0,i.jsxs)(ee.x,{children:["Enable the Recce Checklist and start adding checks for better data validation and review.",(0,i.jsx)("br",{}),(0,i.jsx)(iF,{})]})})}),(0,i.jsxs)(f.t,{children:[(0,i.jsx)(g.O,{children:"Columns"}),(0,i.jsx)(g.O,{children:"Code"})]}),(0,i.jsxs)(th.n,{overflow:"auto",height:"calc(100% - 42px)",children:[(0,i.jsx)(tx.x,{p:0,overflowY:"auto",height:"100%",children:E?(0,i.jsx)(tD,{current:n.data.current}):(0,i.jsx)(tT,{base:n.data.base,current:n.data.current})}),(0,i.jsx)(tx.x,{height:"100%",p:0,children:(0,i.jsx)(rp,{node:n})})]})]}),(0,i.jsx)(rx,{isOpen:u,onClose:v,current:n.data.current})]})}function rg(e){var n,t;let{onClose:l}=e,{cancel:s,actionState:o}=tS();return(0,i.jsx)(r.x,{bg:"white",rounded:"md",shadow:"dark-lg",children:(0,i.jsxs)(x.U,{p:"5px 15px",mt:"4",divider:(0,i.jsx)(ie.c,{borderColor:"gray.200"}),spacing:4,children:[(0,i.jsxs)(r.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)(et.z,{size:"xs",variant:"outline",onClick:s,isLoading:"canceling"===o.status,loadingText:"Canceling",children:"Cancel"}):(0,i.jsx)(x.U,{children:(0,i.jsx)(et.z,{size:"xs",variant:"outline",onClick:l,children:"Close"})})]})})}let rj=()=>(0,i.jsxs)(nu.g,{align:"start",spacing:0,children:[(0,i.jsx)(ee.x,{fontSize:"10pt",color:"gray.500",pb:1,children:"Select nodes by dbt node selector syntax"}),(0,i.jsxs)(ee.x,{fontSize:"8pt",children:[(0,i.jsx)(c.E,{fontSize:"8pt",children:"model_name"})," Select a node"]}),(0,i.jsxs)(ee.x,{fontSize:"8pt",children:[(0,i.jsx)(c.E,{fontSize:"8pt",children:"model_name+"})," Select downstream nodes"]}),(0,i.jsxs)(ee.x,{fontSize:"8pt",children:[(0,i.jsx)(c.E,{fontSize:"8pt",children:"+model_name"})," Select upstream nodes"]}),(0,i.jsxs)(ee.x,{fontSize:"8pt",children:[(0,i.jsx)(c.E,{fontSize:"8pt",children:"model*"})," Select by wildcard"]})]}),rv=()=>{let{isHistoryOpen:e,showHistory:n,closeHistory:t}=n9();return(0,i.jsx)(et.z,{leftIcon:(0,i.jsx)(s.J,{as:e9.M1Q}),size:"xs",variant:"outline",onClick:()=>{e?(eo({name:"hide"}),t()):(eo({name:"show"}),n())},children:e?"Hide":"Show"})},ry=e=>{let{isDisabled:n}=e,{viewOptions:t,onViewOptionsChanged:r}=tS(),l=t.view_mode||"changed_models",o=e=>{r({...t,view_mode:e})};return(0,i.jsxs)(nJ.v,{children:[(0,i.jsx)(nB.j,{as:et.z,minWidth:"100px",leftIcon:(0,i.jsx)(s.J,{as:tJ("model").icon}),size:"xs",variant:"outline",isDisabled:n,rightIcon:(0,i.jsx)(rm.v,{}),children:"changed_models"===l?"Changed Models":"All"}),(0,i.jsxs)(nQ.q,{title:"packages",children:[(0,i.jsx)(nX.s,{as:nk.X,size:"sm",isChecked:"changed_models"===l,onChange:()=>{o("changed_models")},children:"Changed Models"}),(0,i.jsx)(nX.s,{as:nk.X,size:"sm",isChecked:"all"===l,onChange:()=>{o("all")},children:"All"})]})]})},rb=e=>{var n;let{isDisabled:t}=e,{lineageGraph:r}=eS(),{viewOptions:l,onViewOptionsChanged:o}=tS(),a=new Set;for(let e of Object.values((null==r?void 0:r.nodes)||{}))e.packageName&&a.add(e.packageName);let c=null==r?void 0:null===(n=r.manifestMetadata.current)||void 0===n?void 0:n.project_name,d=l.packages?new Set(l.packages):c?new Set([c]):a,u=d.size===a.size,h=0===d.size,x=1===d.size?Array.from(d)[0]:u?"All Packages":h?"No Package":"".concat(d.size," Packages"),m=e=>{let n=new Set(d);n.has(e)?n.delete(e):n.add(e),o({...l,packages:Array.from(n)})};return(0,i.jsxs)(nJ.v,{closeOnSelect:!1,children:[(0,i.jsx)(nB.j,{as:et.z,minWidth:"100px",leftIcon:(0,i.jsx)(s.J,{as:io.zFh}),size:"xs",variant:"outline",isDisabled:t,rightIcon:(0,i.jsx)(rm.v,{}),children:x}),(0,i.jsx)(nQ.q,{title:"packages",children:(0,i.jsxs)(nZ.k,{title:"Select Packages",children:[(0,i.jsx)(nX.s,{as:nk.X,size:"sm",isIndeterminate:!u&&!h,isChecked:u,onChange:()=>{u?o({...l,packages:[]}):o({...l,packages:Array.from(a)})},children:"Select All"}),(0,i.jsx)(tu.R,{}),Array.from(a).map(e=>(0,i.jsx)(nX.s,{as:nk.X,size:"sm",isChecked:d.has(e),onChange:()=>{m(e)},children:e},e))]})})]})},rw=e=>{let[n,t]=(0,b.useState)(e.value),{data:r}=ek(),l=(0,b.useRef)(null);return(0,b.useEffect)(()=>{l.current&&(l.current.value=e.value)},[e.value]),(0,i.jsx)(nD.u,{width:"300px",padding:2,shadow:"md",borderWidth:1,rounded:"md",styleConfig:{zIndex:"dropdown"},label:e.tooltipComponent,placement:"bottom-start",color:"black",backgroundColor:"white",closeOnClick:!1,isDisabled:!(null==r?void 0:r.single_env_onboarding),children:(0,i.jsx)(nP.I,{ref:l,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),l.current&&l.current.blur())},onBlur:()=>{t(e.value)}})})},rk=e=>{let{isDisabled:n}=e,{viewOptions:t,onViewOptionsChanged:r}=tS();return(0,i.jsx)(rw,{isDisabled:n,value:t.select||"",onChange:e=>{r({...t,select:e||void 0})},tooltipComponent:(0,i.jsx)(rj,{})})},rC=e=>{let{isDisabled:n}=e,{viewOptions:t,onViewOptionsChanged:r}=tS();return(0,i.jsx)(rw,{isDisabled:n,value:t.exclude||"",onChange:e=>{r({...t,exclude:e||void 0})}})},r_=e=>(0,i.jsxs)(r.x,{style:e.style,maxWidth:"300px",children:[(0,i.jsx)(r.x,{fontSize:"8pt",children:e.label||(0,i.jsx)(i.Fragment,{children:"\xa0"})}),e.children]}),rS=()=>{var e,n,t,r,l;let{deselect:o,focusedNode:a,selectedNodes:c,...d}=tS(),{isActionAvailable:u}=eS(),{data:h}=ek(),p=null==h?void 0:h.single_env_onboarding,f=!!a,g=c.length>0,j=!f&&!g;return(0,i.jsx)(x.U,{width:"100%",padding:"4pt 8pt",children:(0,i.jsxs)(x.U,{flex:"1",children:[(0,i.jsx)(r_,{label:"History",style:{flexShrink:"1"},children:(0,i.jsx)(rv,{})}),(0,i.jsx)(r_,{label:"Mode",style:{flexShrink:"1"},children:(0,i.jsx)(ry,{isDisabled:g})}),(0,i.jsx)(r_,{label:"Package",style:{flexShrink:"1"},children:(0,i.jsx)(rb,{isDisabled:g})}),(0,i.jsx)(r_,{label:"Select",style:{flex:"100 1 auto"},children:(0,i.jsx)(rk,{isDisabled:g})}),(0,i.jsx)(r_,{label:"Exclude",style:{flex:"100 1 auto"},children:(0,i.jsx)(rC,{isDisabled:g})}),(0,i.jsx)(m.L,{}),g&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r_,{label:"",style:{flexShrink:"0"},children:(0,i.jsx)(ee.x,{fontSize:"9pt",color:"gray.500",children:c.length>1?"".concat(c.length," nodes selected"):"".concat(c.length," node selected")})}),(0,i.jsx)(r_,{label:"",children:(0,i.jsx)(et.z,{variant:"outline",size:"xs",fontSize:"9pt",onClick:()=>{o()},children:"Deselect"})}),p&&(0,i.jsx)(r_,{label:"Explore",children:(0,i.jsx)(nx.h,{isAttached:!0,variant:"outline",children:(0,i.jsxs)(nJ.v,{placement:"bottom-end",children:[(0,i.jsx)(nB.j,{as:et.z,size:"xs",rightIcon:(0,i.jsx)(rm.v,{}),children:"Actions"}),(0,i.jsx)(nQ.q,{children:(0,i.jsx)(nX.s,{as:ee.x,size:"sm",fontSize:"10pt",isDisabled:!(j||f||g),icon:(0,i.jsx)(s.J,{as:null===(e=n2("row_count_diff"))||void 0===e?void 0:e.icon}),onClick:async()=>{await d.runRowCount()},children:"Row Count"})})]})})})]}),!p&&(0,i.jsx)(r_,{label:"Explore",children:(0,i.jsx)(nx.h,{isAttached:!0,variant:"outline",children:(0,i.jsxs)(nJ.v,{placement:"bottom-end",children:[(0,i.jsx)(nB.j,{as:et.z,size:"xs",rightIcon:(0,i.jsx)(rm.v,{}),children:"Actions"}),(0,i.jsxs)(nQ.q,{children:[(0,i.jsxs)(nZ.k,{title:"Diff",m:"0",p:"4px 12px",children:[(0,i.jsx)(nX.s,{as:ee.x,size:"sm",fontSize:"10pt",isDisabled:!(j||f||g),icon:(0,i.jsx)(s.J,{as:null===(n=n2("row_count_diff"))||void 0===n?void 0:n.icon}),onClick:async()=>{await d.runRowCountDiff()},children:"Row Count Diff"}),(0,i.jsx)(nD.u,{label:u("value_diff")?null:iw.audit_helper,placement:"left",children:(0,i.jsx)(nX.s,{as:ee.x,size:"sm",fontSize:"10pt",isDisabled:!(j||f||g)||!u("value_diff"),icon:(0,i.jsx)(s.J,{as:null===(t=n2("value_diff"))||void 0===t?void 0:t.icon}),onClick:async()=>{await d.runValueDiff()},children:"Value Diff"})})]}),(0,i.jsx)(tu.R,{}),(0,i.jsxs)(nZ.k,{title:"Add to Checklist",m:"0",px:"12px",children:[(0,i.jsx)(nX.s,{as:ee.x,size:"sm",fontSize:"10pt",isDisabled:!(j||g&&c.length>1),icon:(0,i.jsx)(s.J,{as:null===(r=n2("lineage_diff"))||void 0===r?void 0:r.icon}),onClick:()=>{d.addLineageDiffCheck(d.viewOptions.view_mode)},children:"Lineage Diff"}),(0,i.jsx)(nX.s,{as:ee.x,size:"sm",fontSize:"10pt",isDisabled:!(j||f||g),icon:(0,i.jsx)(s.J,{as:null===(l=n2("schema_diff"))||void 0===l?void 0:l.icon}),onClick:()=>{d.addSchemaDiffCheck()},children:"Schema Diff"})]})]})]})})})]})})};async function rz(e){return(await K.post("/api/checks",{type:"lineage_diff",params:{},view_options:e})).data}function rR(){return(0,i.jsx)(r.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,r]]=e,{icon:l,color:o}=tK(n);return(0,i.jsx)(nD.u,{label:r,placement:"right",children:(0,i.jsxs)(d.k,{alignItems:"center",gap:"6px",marginBottom:"2px",children:[(0,i.jsx)(s.J,{color:o,as:l})," ",t]})},n)})})}var rL=t(18729);let rI={mode:"per_node",status:"pending",completed:0,total:0,actions:{}},rE=(e,n)=>{let{onActionStarted:t,onActionNodeUpdated:i,onActionCompleted:r}=n,l=(0,b.useRef)({...rI}).current,{showRunId:s}=n9(),o=async(n,o,a)=>{l.mode="multi_nodes",l.actions={};let c=l.mode,d=l.actions;t(),l.status="running";let u=[];for(let n of e){let e=o(n);e?(d[n.id]={mode:c,status:"skipped",skipReason:e},i(n)):(d[n.id]={mode:c,status:"pending"},u.push(n))}let h=a(u);try{let{run_id:e}=await ex(n,h,{nowait:!0});for(s(e),l.currentRun={run_id:e},l.total=1;;){let n=await em(e,2);l.currentRun=n;let t=n.error?"failure":n.result?"success":"running";for(let e of u)d[e.id]={mode:c,status:t,run:n},i(e);if(n.error||n.result)break}}catch(e){}if(l.completed=1,"canceling"===l.status){l.status="canceled",r();return}l.status="completed",r()},a=async(n,s)=>{l.mode="per_node",l.actions={};let o=l.mode,a=l.actions;for(let n of(t(),l.status="running",e))a[n.id]={mode:o,status:"pending"},i(n);for(let t of(l.completed=0,l.total=e.length,e)){let{params:e,skipReason:c}=s(t);if(c)a[t.id]={mode:o,status:"skipped",skipReason:c},i(t);else try{let{run_id:r}=await ex(n,e,{nowait:!0});for(l.currentRun={run_id:r},a[t.id]={mode:o,status:"running"},i(t);;){let e=await em(r,2);l.currentRun=e;let n=e.error?"failure":e.result?"success":"running";if(a[t.id]={mode:o,status:n,run:e},i(t),e.error||e.result)break}}catch(e){}finally{l.currentRun=void 0}if(l.completed++,"canceling"===l.status){l.status="canceled",r();return}}l.status="completed",r()},c=async()=>{let n=[];for(let t of e)"model"!==t.resourceType?(l.actions[t.id]={mode:"multi_nodes",status:"skipped",skipReason:"Not a model"},i(t)):n.push(t.name);await o("row_count",e=>{if("model"!==e.resourceType)return"Not a model"},e=>({node_names:e.map(e=>e.name)}))},d=async()=>{let n=[];for(let t of e)"model"!==t.resourceType?(l.actions[t.id]={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)}))},u=async()=>{var e;l.status="canceling",(null===(e=l.currentRun)||void 0===e?void 0:e.run_id)&&await ep(l.currentRun.run_id)};return{actionState:l,runRowCount:c,runRowCountDiff:d,runValueDiff:async()=>{await a("value_diff",e=>{var n;let t=null===(n=e.data.current)||void 0===n?void 0:n.primary_key;return t?{params:{model:e.name,primary_key:t}}:{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 rz({node_ids:n})},addSchemaDiffCheck:async()=>{let n;if(1===e.length)n=await ib({node_id:e[0].id});else{let t=e.map(e=>e.id);n=await ib({node_id:t})}return n},cancel:u,reset:()=>{Object.assign(l,rI)}}};var rT=t(94767),rD=function(){let{isOpen:e,onOpen:n,onClose:t}=(0,Q.q)(),[l,s]=(0,b.useState)(0),[o,a]=(0,b.useState)(),c=(0,b.useRef)(),u=(0,b.useCallback)(e=>(s(e),new Promise(e=>{a(()=>e),n()})),[n]),h=()=>{null==o||o(!1),t()};return{confirm:u,AlertDialog:(0,i.jsx)(rT.aR,{size:"xl",isOpen:e,leastDestructiveRef:c,onClose:h,children:(0,i.jsx)(X.Z,{children:(0,i.jsxs)(rT._T,{children:[(0,i.jsxs)(Y.x,{fontSize:"lg",fontWeight:"bold",children:["Value Diff on ",l," nodes"]}),(0,i.jsx)($.f,{gap:"20px",as:d.k,direction:"column",children:(0,i.jsxs)(r.x,{children:["Value diff will be executed on ",l," nodes in the Lineage, which can add extra costs to your bill."]})}),(0,i.jsxs)(en.m,{children:[(0,i.jsx)(et.z,{ref:c,onClick:h,children:"Cancel"}),(0,i.jsx)(et.z,{colorScheme:"blue",onClick:()=>{null==o||o(!0),t()},ml:3,children:"Execute"})]})]})})})}},rO=t(11213),rM=t(27809);let rA="recce",rF={recommendationIgnored:"".concat(rA,"-recommendation-ignored"),recommendationShowed:"".concat(rA,"-recommendation-showed"),prevRefreshTimeStamp:"".concat(rA,"-prev-refresh-timestamp"),lineageNotificationDismissed:"".concat(rA,"-lineage-notification-dismissed")},rN=()=>{var e;let n=(0,w.a)({queryKey:q.checks(),queryFn:tr}),t=(0,b.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,w.a)({queryKey:(null==t?void 0:t.check_id)?q.check(t.check_id):[],queryFn:async()=>{if(null==t?void 0:t.check_id)return tl(t.check_id)},enabled:!!(null==t?void 0:t.check_id)}),r=(0,w.a)({queryKey:(null==t?void 0:t.check_id)?[...q.check(t.check_id),"select"]:[],queryFn:async()=>{var e,n;return tO({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)}),l=(0,b.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"===r.status&&r.data)return r.data.nodes},[t,r]);return{recommendedCheck:i.data,selectedNodes:l}},rq=()=>{let{lineageGraph:e,envInfo:n}=eS(),{showRunId:t}=n9(),{data:r}=ek(),l=(0,k.NL)(),{recommendedCheck:s,selectedNodes:o}=rN(),[a,c]=(0,b.useState)(),[u,h]=(0,b.useState)(!1),[p,f]=(0,b.useState)(!1),[g,j]=(0,b.useState)(!1),{isOpen:v,onOpen:y,onClose:w}=(0,Q.q)(),C=rF.recommendationIgnored,_=rF.recommendationShowed,S=rF.prevRefreshTimeStamp;(0,b.useEffect)(()=>{sessionStorage.getItem(C)&&f(!0)},[C]),(0,b.useEffect)(()=>{var t,i,r,l,a,d,u,x,m,p;if(!s||!o)return;if(null===(t=s.last_run)||void 0===t?void 0:t.run_id){let e=new Date(s.last_run.run_at).getTime(),t=null==n?void 0:n.dbt,i=Math.max((null==t?void 0:null===(l=t.current)||void 0===l?void 0:l.generated_at)?new Date(t.current.generated_at).getTime():0,(null==t?void 0:null===(a=t.base)||void 0===a?void 0:a.generated_at)?new Date(t.base.generated_at).getTime():0);if(e>=i){h(!0);return}h(!1),j(!0);let r=sessionStorage.getItem(S);(null===r||parseInt(r)!==i)&&(sessionStorage.setItem(S,i.toString()),sessionStorage.removeItem(C),sessionStorage.removeItem(_),f(!1))}let g=n=>n.map(n=>{var t;return null==e?void 0:null===(t=e.nodes[n])||void 0===t?void 0:t.name}).join(", ");if(o.length>0&&o.length<=3){if(null===(d=s.params)||void 0===d?void 0:d.node_names){let e=null===(x=s.params)||void 0===x?void 0:x.node_names.join(", ");c("'".concat(e,"'"))}else if(null===(u=s.params)||void 0===u?void 0:u.node_ids){let e=g(null===(m=s.params)||void 0===m?void 0:m.node_ids);c("'".concat(e,"'"))}else if(o){let e=g(o);c("'".concat(e,"'"))}}else(null==e?void 0:e.modifiedSet.length)===o.length?c("modified and potentially impacted models"):(null===(i=s.params)||void 0===i?void 0:i.select)&&!(null===(r=s.params)||void 0===r?void 0:r.exclude)?c("'".concat(null===(p=s.params)||void 0===p?void 0:p.select,"'")):c("".concat(o.length," models"));if(!sessionStorage.getItem(_)){let e=sessionStorage.getItem(S);sessionStorage.setItem(_,"true"),eu({action:"recommend",from:null===e?"initial":"rerun"})}},[s,o,e,C,_,S,n]);let z=(0,b.useCallback)(async()=>{s&&(t((await ef(s.check_id,{nowait:!0})).run_id),await l.invalidateQueries({queryKey:q.check(s.check_id)}))},[s,t,l]);if(!s||!o||(null==r?void 0:r.single_env_onboarding))return(0,i.jsx)(i.Fragment,{});let R=o.length;return!p&&!u&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(x.U,{width:"100%",padding:"2pt 8pt",backgroundColor:"blue.50",children:(0,i.jsxs)(x.U,{flex:"1",fontSize:"10pt",color:"blue.600",children:[g?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(rM.i,{}),(0,i.jsx)(ee.x,{children:"New dbt build detected - Re-run row count checks to maintain result accuracy"})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(rO.h,{}),(0,i.jsxs)(ee.x,{children:["First Check: Perform a row count diff of ",a," for basic impact assessment"]})]}),(0,i.jsx)(m.L,{}),(0,i.jsx)(et.z,{size:"xs",onClick:()=>{f(!0),sessionStorage.setItem(C,"true"),eu({action:"ignore",from:g?"rerun":"initial",nodes:R})},children:"Ignore"}),(0,i.jsx)(et.z,{colorScheme:"blue",size:"xs",onClick:()=>{y(),eu({action:"perform",from:g?"rerun":"initial",nodes:R})},children:"Perform"})]})}),(0,i.jsxs)(Z.u_,{isOpen:v,onClose:()=>{w(),eu({action:"close",from:g?"rerun":"initial",nodes:R})},isCentered:!0,children:[(0,i.jsx)(X.Z,{}),(0,i.jsxs)(G.h,{children:[(0,i.jsx)(Y.x,{children:"Row Count Check"}),(0,i.jsx)($.f,{children:(0,i.jsxs)(t1.K,{spacing:"4",children:[(0,i.jsxs)(ee.x,{children:["Perform a row count check of the ",R," node(s) displayed in the lineage diff DAG."]}),(0,i.jsxs)(d.k,{bg:"blue.100",color:"blue.700",children:[(0,i.jsx)(rO.h,{mt:"10px",ml:"5px"}),(0,i.jsx)(ee.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)(en.m,{gap:"5px",children:[(0,i.jsx)(et.z,{onClick:()=>{w(),eu({action:"close",from:g?"rerun":"initial",nodes:R})},children:"Cancel"}),(0,i.jsxs)(et.z,{colorScheme:"blue",onClick:()=>{w(),z(),h(!0),eu({action:"execute",from:g?"rerun":"initial",nodes:R})},children:["Execute on ",R," models"]})]})]})]})]})};var rH=t(71955),rV=t(19866),rP=t(66855),rW=t(61016),rK=t(28224);let rJ=e=>{let{enabled:n,onChanged:t}=e,r=ek();return!r.data||r.data.single_env_onboarding?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(d.k,{direction:"row",alignItems:"center",gap:"5px",p:"5px 10px",borderRadius:"md",boxShadow:"md",border:"1px solid",borderColor:"gray.200",bg:"white",alignSelf:"flex-start",children:[(0,i.jsx)(rH.r,{isChecked:n,onChange:e=>{t(e.target.checked)},alignItems:"center"}),(0,i.jsx)(d.k,{alignItems:"center",children:(0,i.jsx)(ee.x,{fontSize:"10pt",lineHeight:"1",children:"Breaking Change Analysis"})}),(0,i.jsxs)(rV.J,{trigger:"hover",placement:"top-start",children:[(0,i.jsx)(rP.x,{children:(0,i.jsx)(s.J,{boxSize:"10px",as:rO.h,color:"gray.500",cursor:"pointer"})}),(0,i.jsx)(rW.y,{bg:"black",color:"white",children:(0,i.jsxs)(rK.b,{fontSize:"sm",children:["Breaking changes are determined by analyzing SQL for changes that may impact downstream models."," ",(0,i.jsx)(l.r,{href:"https://datarecce.io/docs/features/breaking-change-analysis/",target:"_blank",textDecoration:"underline",children:"Learn more"}),"."]})})]})]})},rB=e=>{let{transformationType:n,legend:t}=e,r="U",l="red";return"passthrough"===n?(r="P",l="gray"):"renamed"===n?(r="R",l="orange"):"derived"===n?(r="D",l="orange"):"source"===n?(r="S",l="blue"):(r="U",l="red"),(0,i.jsx)(i.Fragment,{children:t?(0,i.jsx)(td.Vp,{fontSize:"8pt",size:"xs",colorScheme:l,borderRadius:"full",paddingX:"4px",children:(0,i.jsx)(td.Sn,{children:r})}):(0,i.jsx)(td.Vp,{fontSize:"6pt",size:"xs",colorScheme:l,borderRadius:"full",paddingX:"2px",children:(0,i.jsx)(td.Sn,{children:r})})})};var rU=t(96583);let rQ=e=>{let{node:n,column:t,reset:r}=e,{lineageGraph:o}=eS();if(!o)return(0,i.jsx)(i.Fragment,{});let a=o.nodes[n].name;return(0,i.jsxs)(d.k,{direction:"row",alignItems:"center",gap:"5px",p:"5px 10px",borderRadius:"md",boxShadow:"md",border:"1px solid",borderColor:"gray.200",bg:"white",fontSize:"10pt",children:[(0,i.jsx)(ee.x,{children:"Column Lineage for"}),(0,i.jsxs)(c.E,{children:[a,".",t]}),(0,i.jsxs)(rV.J,{trigger:"hover",placement:"top-start",children:[(0,i.jsx)(rP.x,{children:(0,i.jsx)(s.J,{boxSize:"10px",as:rO.h,color:"gray.500",cursor:"pointer"})}),(0,i.jsx)(rW.y,{bg:"black",color:"white",children:(0,i.jsxs)(rK.b,{fontSize:"sm",children:["Column-Level Lineage provides visibility into the upstream and downstream relationships of a column."," ",(0,i.jsx)(l.r,{href:"https://datarecce.io/docs/features/column-level-lineage/",target:"_blank",textDecoration:"underline",children:"Learn more"}),"."]})})]}),(0,i.jsx)(nn.h,{icon:(0,i.jsx)(rU.T,{}),"aria-label":"",onClick:r,size:"xs"})]})};function rZ(){return(0,i.jsx)(r.x,{bg:"white",padding:"12px",borderWidth:"1px",borderColor:"gray.200",fontSize:"sm",children:Object.entries({passthrough:["Pass Through","The column is directly selected from the upstream table."],renamed:["Renamed","The column is selected from the upstream table but with a different name."],derived:["Derived","The column is created through transformations applied to upstream columns, such as calculations, conditions, functions, or aggregations."],source:["Source","The column is not derived from any upstream data. It may originate from a seed/source node, literal value, or data generation function."],unknown:["Unknown","We have no information about the transformation type. This could be due to a parse error, or other unknown reason."]}).map(e=>{let[n,[t,r]]=e;return(0,i.jsx)(nD.u,{label:r,placement:"right",children:(0,i.jsxs)(d.k,{alignItems:"center",gap:"6px",marginBottom:"2px",children:[(0,i.jsx)(rB,{legend:!0,transformationType:n})," ",t]})},n)})})}function rX(e){let{notification:n,type:t}=e,r=rF.lineageNotificationDismissed,[l,s]=(0,b.useState)(!0);return((0,b.useEffect)(()=>{"true"===sessionStorage.getItem(r)&&s(!1)},[r]),null!==n&&l)?(0,i.jsxs)(d.k,{w:"100%",direction:"row",p:"5px 10px",gap:"5px",alignItems:"flex-start",borderRadius:"md",boxShadow:"md",border:"1px solid",borderColor:"gray.200",bg:{info:"blue.50",success:"green.50",warning:"yellow.50",error:"red.50"}[t],children:[n,(0,i.jsx)(m.L,{}),(0,i.jsx)(iy.P,{onClick:()=>{sessionStorage.setItem(r,"true"),s(!1)}})]}):null}function rG(){return(0,i.jsx)(d.k,{flex:"1",h:"100%",minH:0,m:"2",p:"4",bg:"blue.50",borderRadius:"lg",boxShadow:"md",justifyContent:"center",children:(0,i.jsxs)(d.k,{w:"80%",direction:"column",overflowY:"auto",gap:6,px:8,pb:8,children:[(0,i.jsxs)(d.k,{direction:"column",alignItems:"center",gap:4,children:[(0,i.jsx)(d.k,{p:2,bg:"white",borderRadius:"full",alignItems:"center",justifyContent:"center",boxShadow:"md",children:(0,i.jsx)(s.J,{as:ia.NJc,boxSize:7,color:"blue.500"})}),(0,i.jsx)(h.X,{mt:"4",size:"lg",children:"Wait, there's more!"}),(0,i.jsxs)(ee.x,{fontSize:"md",textAlign:"center",children:["Recce is currently running in"," ",(0,i.jsx)(ee.x,{fontWeight:"bold",as:"span",children:"limited functionality mode"})," ","so you can run queries but"," ",(0,i.jsx)(ee.x,{fontWeight:"bold",as:"span",children:"can't diff the results yet!"})]})]}),(0,i.jsxs)(d.k,{direction:"column",gap:2,children:[(0,i.jsx)(ee.x,{fontSize:"md",children:"To unlock the full power of Recce, set up a base environment of dbt artifacts for comparison."}),(0,i.jsx)(ee.x,{children:"Once configured, you'll be able to:"}),(0,i.jsxs)(tN.QI,{children:[(0,i.jsx)(tN.HC,{children:(0,i.jsx)(ee.x,{children:"Run statistical data diffs"})}),(0,i.jsx)(tN.HC,{children:(0,i.jsx)(ee.x,{children:"Run query diffs"})}),(0,i.jsx)(tN.HC,{children:(0,i.jsx)(ee.x,{children:"Save checks to your Recce Checklist"})}),(0,i.jsx)(tN.HC,{children:(0,i.jsx)(ee.x,{children:"...and more!"})})]}),(0,i.jsx)(ee.x,{fontSize:"md",children:"Take the next step toward better data impact assessment."})]}),(0,i.jsx)(d.k,{w:"100%",direction:"column",mt:6,children:(0,i.jsx)(et.z,{colorScheme:"blue",size:"lg",onClick:()=>{window.open("https://datarecce.io/docs/get-started/#prepare-dbt-artifacts","_blank")},children:"Start Now"})})]})})}function rY(){return(0,i.jsxs)(d.k,{direction:"row",gap:"10px",alignItems:"flex-start",children:[(0,i.jsx)(s.J,{as:ia.LyC,color:"blue.500",boxSize:"5"}),(0,i.jsxs)(d.k,{direction:"column",gap:"5px",children:[(0,i.jsxs)(ee.x,{fontWeight:"bold",children:["Lineage Diff"," ",(0,i.jsx)(ee.x,{color:"red",as:"span",children:"Live Reload"})]}),(0,i.jsxs)(ee.x,{fontSize:"sm",children:["To view lineage diff in action, make a modeling change and rebuild your dbt project. Leave Recce running and"," ",(0,i.jsx)(ee.x,{fontWeight:"bold",as:"span",children:"model changes will be automatically detected"})," ","and displayed."]}),(0,i.jsx)(l.r,{color:"blue.500",fontSize:"sm",fontWeight:"medium",isExternal:!0,href:"https://datarecce.io/docs/get-started/#prepare-dbt-artifacts",children:"Learn how"})]})]})}async function r$(e,n){return(await K.post("/api/cll",{params:{node_id:e,column:n}})).data}let r0={customNode:function(e){var n,t;let{data:l}=e,{id:o,resourceType:a,changeStatus:c}=l,u=(0,I.oR)(e=>e.transform[2]>.3),{icon:h}=tJ(a),[p,f]=(0,b.useState)(!1),{interactive:g,selectNode:j,selectMode:v,focusedNode:y,breakingChangeEnabled:w,getNodeAction:k,getNodeColumnSet:C,isNodeHighlighted:_,isNodeSelected:S}=tS(),{lineageGraph:z}=eS(),R=w&&"modified"===c&&(null==z?void 0:z.nonBreakingSet.has(o)),L=_(o),E=S(o),T=(null==y?void 0:y.id)===o,{icon:D,color:O,backgroundColor:M}=c?tK(c):{icon:void 0,color:"gray.400",backgroundColor:"gray.100"},A=R?"dashed":"solid",F=l.name,N=C(l.id),q=N.size>0,H="action_result"===v?k(l.id):void 0;return(0,i.jsxs)(d.k,{cursor:"selecting"===v?"pointer":"inherit",direction:"column",width:"300px",transition:"box-shadow 0.2s ease-in-out",padding:0,filter:"action_result"===v?H?"none":"opacity(0.2) grayscale(50%)":L||T||E||p?"none":"opacity(0.2) grayscale(50%)",onMouseEnter:()=>{f(!0)},onMouseLeave:()=>{f(!1)},children:[(0,i.jsxs)(d.k,{borderColor:O,borderWidth:"2px",borderStyle:A,borderTopRadius:8,borderBottomRadius:q?0:8,backgroundColor:u?"selecting"===v?E?O:"white":"action_result"!==v?T||E||p?M:"white":H?T||E||p?M:O:"white":T||E||p?O:M,height:"60px",children:[(0,i.jsx)(d.k,{bg:O,padding:g?"8px":"2px",borderRightWidth:"2px",borderColor:"selecting"===v?"#00000020":O,borderStyle:A,alignItems:"top",visibility:u?"inherit":"hidden",children:g&&(0,i.jsx)(ig,{checked:"selecting"===v&&E||"action_result"===v&&!!H,onClick:e=>{"action_result"!==v&&(e.stopPropagation(),j(l.id))}})}),(0,i.jsxs)(d.k,{flex:"1 0 auto",mx:"1",width:"100px",direction:"column",children:[(0,i.jsxs)(d.k,{width:"100%",textAlign:"left",fontWeight:"600",flex:"1",p:1,gap:"5px",alignItems:"center",visibility:u?"inherit":"hidden",children:[(0,i.jsx)(r.x,{flex:"1",color:"selecting"===v?E?"white":"inherit":"action_result"===v&&H&&!E?"white":"inherit",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:(0,i.jsx)(nD.u,{label:"model"===a?F:"".concat(F," (").concat(a,")"),placement:"top",children:F})}),(0,i.jsx)(s.J,{boxSize:"16px",color:"selecting"===v?E?"white":"inherit":"action_result"===v&&H&&!E?"white":"inherit",as:h}),D&&(0,i.jsx)(s.J,{color:"selecting"===v?E?"white":O:"action_result"===v?H&&!E?"white":"inherit":O,as:D})]}),(0,i.jsx)(d.k,{flex:"1 0 auto",mx:"1",direction:"column",paddingBottom:"1",visibility:u?"inherit":"hidden",children:(0,i.jsxs)(x.U,{spacing:"8px",children:["action_result"!==v&&"model"===l.resourceType&&(0,i.jsx)(ip,{id:l.id,inverted:"selecting"===v&&!!E}),H?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(m.L,{}),(0,i.jsx)(ix,{node:l,action:H})]}):(0,i.jsx)(i.Fragment,{})]})})]})]}),N.size>0&&(0,i.jsx)(r.x,{p:"10px 20px",borderColor:O,borderWidth:"2px",borderTopWidth:0,borderStyle:A,borderBottomRadius:8,children:(0,i.jsx)(r.x,{height:"".concat(15*N.size,"px"),overflow:"auto"})}),Object.keys(null!==(n=l.parents)&&void 0!==n?n:{}).length>0&&(0,i.jsx)(I.HH,{type:"target",position:I.Ly.Left,isConnectable:!1}),Object.keys(null!==(t=l.children)&&void 0!==t?t:{}).length>0&&(0,i.jsx)(I.HH,{type:"source",position:I.Ly.Right,isConnectable:!1})]})},customColumnNode:function(e){var n,t;let{data:l}=e,{id:s}=l.node,{column:o,type:a,transformationType:c}=l,u=(0,I.oR)(e=>e.transform[2]>.3),{viewOptions:h}=tS(),x=null===(n=h.column_level_lineage)||void 0===n?void 0:n.node,p=o===(null===(t=h.column_level_lineage)||void 0===t?void 0:t.column)&&s===x;return u?(0,i.jsxs)(d.k,{width:"280px",height:"16px",padding:"0px 10px",border:"1px solid lightgray",backgroundColor:p?"#f0f0f0":"inherit",_hover:{backgroundColor:"#f0f0f0"},children:[(0,i.jsxs)(d.k,{fontSize:"10px",color:"gray",width:"100%",gap:"3px",alignItems:"center",children:[(0,i.jsx)(rB,{transformationType:c}),(0,i.jsx)(r.x,{children:o}),(0,i.jsx)(m.L,{}),(0,i.jsx)(r.x,{children:a})]}),(0,i.jsx)(I.HH,{type:"target",position:I.Ly.Left,isConnectable:!1,style:{left:0,visibility:"hidden"}}),(0,i.jsx)(I.HH,{type:"source",position:I.Ly.Right,isConnectable:!1,style:{right:0,visibility:"hidden"}})]}):(0,i.jsx)(i.Fragment,{})}},r1=[],r5={customEdge:function(e){let{source:n,target:t,sourceX:r,sourceY:l,targetX:s,targetY:o,sourcePosition:a,targetPosition:c,style:d={},markerEnd:u,data:h}=e,x={...d},{isEdgeHighlighted:m}=tS();(null==h?void 0:h.changeStatus)&&(x.stroke=tK(h.changeStatus).color,x.strokeDasharray="5"),m(n,t)||(x.filter="opacity(0.2) grayscale(50%)");let[p]=(0,I.OQ)({sourceX:r,sourceY:l,sourcePosition:a,targetX:s,targetY:o,targetPosition:c});return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(I.u5,{path:p,markerEnd:u,style:{...x,...d}})})}},r2=e=>e.data.changeStatus?tK(e.data.changeStatus).color:"lightgray",r4=(e,n)=>{let t=e.current,i=(0,b.useRef)({width:0,height:0});(0,b.useEffect)(()=>{let e=new ResizeObserver(e=>{for(let t of e){let e=t.contentRect.width,r=t.contentRect.height;(Math.abs(r-i.current.height)>10||Math.abs(e-i.current.width)>10)&&i.current.height>0&&r>0&&i.current.width>0&&e>0&&n(),i.current={width:e,height:r}}});return t&&e.observe(t),()=>{t&&e.unobserve(t)}},[t,i,n])},r6=()=>{let[,e]=(0,eI.TH)();return(0,b.useCallback)(n=>{n.check_id&&e("/checks/".concat(n.check_id))},[e])},r3=(0,b.forwardRef)(function(e,n){var t;let{interactive:l=!1,...a}=e,c=(0,I._K)(),u=(0,b.useRef)(null),{successToast:h,failToast:x}=tY(),{copyToClipboard:m,ImageDownloadModal:p,ref:f}=iD({renderLibrary:"html-to-image",imageType:"png",shadowEffect:!0,backgroundColor:"white",ignoreElements:e=>{let n=e.className;return!!("string"==typeof n&&n.includes(iT))},onSuccess:()=>{h("Copied the Lineage View as an image to clipboard")},onError:e=>{console.error("Error taking screenshot",e),x("Failed to copy image to clipboard",e)}}),[g,j,v]=(0,I.Rr)(r1),[y,w,k]=(0,I.ll)([]),{lineageGraph:C,retchLineageGraph:_,isLoading:S,error:z,refetchRunsAggregated:R}=eS(),{data:L}=ek(),{runId:E,showRunId:D,closeRunResult:O,runAction:q,isRunResultOpen:H}=n9(),{run:V}=ik(E),[P,W]=(0,b.useState)({...a.viewOptions}),K=e=>g.find(n=>n.data.name===e);(0,b.useImperativeHandle)(n,()=>({copyToClipboard:m}));let J=(0,b.useMemo)(()=>!!C&&C.modifiedSet.length>0,[C]),B=null!==(t=P.view_mode)&&void 0!==t?t:"changed_models",U=(0,b.useMemo)(()=>g.filter(e=>"customNode"===e.type).map(e=>e.id),[g]),Q=(0,b.useMemo)(()=>C?U.map(e=>C.nodes[e]):[],[C,U]),[Z,X]=(0,b.useState)(),G=Z?null==C?void 0:C.nodes[Z]:void 0,[Y,$]=(0,b.useState)(),[en,ei]=(0,b.useState)(new Set),er=(0,b.useMemo)(()=>C?Array.from(en).map(e=>C.nodes[e]):[],[C,en]),eo=rE(er.length>0?er:Q,{onActionStarted:()=>{$("action_result")},onActionNodeUpdated:e=>{j(n=>n.map(n=>n.id===e.id?{...n}:n))},onActionCompleted:()=>{}}),[ea,ec]=(0,b.useState)(!1),[ed,eu]=(0,b.useState)(),ex=(0,b.useMemo)(()=>C?"action_result"===Y?new Set(Object.keys(eo.actionState.actions)):P.column_level_lineage&&ed?new Set(Object.entries(ed).filter(e=>{let[n,t]=e;return t.size>0}).map(e=>{let[n,t]=e;return n})):G?T(M(C,[G.id]),A(C,[G.id])):J?ea?C.impactedSet:A(C,C.modifiedSet):new Set(U):new Set,[C,Y,P.column_level_lineage,ed,G,J,eo.actionState.actions,ea,U]),[em,ep]=(0,b.useState)(!1),[ef,eg]=(0,b.useState)({x:0,y:0}),ej=(0,o.p)();(0,b.useLayoutEffect)(()=>{(async()=>{let e;if(!C)return;if(P.node_ids)e=P.node_ids;else{var n,t;let i=null===(n=C.manifestMetadata.current)||void 0===n?void 0:n.project_name,r={view_mode:null!==(t=P.view_mode)&&void 0!==t?t:J?"changed_models":"all",packages:i?[i]:void 0,...a.viewOptions};W(r),eu(void 0),e=(await tO({select:r.select,exclude:r.exclude,packages:r.packages,view_mode:r.view_mode})).nodes}let[i,r,l]=F(C,e);N(i,r),j(i),w(r),eu(l)})()},[C]);let ev=()=>{X(void 0)},ey=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})}},eb=r6();r4(u,async()=>{if("selecting"!==Y){let e=g.find(e=>e.id===Z);e?ey(e):c.fitView({nodes:g,duration:200})}});let ew=(e,n)=>{X(n.parentId),e_({...P,column_level_lineage:{node:n.data.node.id,column:n.data.column}},!1)},eC=(e,n)=>{if(l&&C){if("customColumnNode"===n.type){ew(e,n);return}if(eI(),Y){if("action_result"===Y){var t;let e=eo.actionState.actions[n.id];(null===(t=e.run)||void 0===t?void 0:t.run_id)&&D(e.run.run_id),X(n.id)}else{let e=new Set(en);en.has(n.id)?e.delete(n.id):e.add(n.id),ei(e),0===e.size&&$(void 0)}}else X(n.id)}},e_=async function(e){var n,t,i,r,l;let s;let o,a=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(!C)return;if(P.select!==e.select||P.exclude!==e.exclude||P.packages!==e.packages||P.view_mode!==e.view_mode){try{let n=await tO({select:e.select,exclude:e.exclude,packages:e.packages,view_mode:e.view_mode});e.column_level_lineage=void 0,s=n.nodes}catch(e){e instanceof rL.d7&&ej({title:"Select node error",description:null!==(i=null===(t=e.response)||void 0===t?void 0:t.data.detail)&&void 0!==i?i:e.message,status:"error",isClosable:!0,position:"bottom-right"});return}X(void 0)}else s=g.map(e=>e.id);if(e.column_level_lineage)try{o=await r$(e.column_level_lineage.node,e.column_level_lineage.column)}catch(e){if(e instanceof rL.d7){ej({title:"Column Level Lineage error",description:null!==(l=null===(r=e.response)||void 0===r?void 0:r.data.detail)&&void 0!==l?l:e.message,status:"error",isClosable:!0,position:"bottom-right"});return}}let[d,u,h]=F(C,s,e.column_level_lineage,o);j(d),w(u),eu(h),W(e),(null==V?void 0:null===(n=V.params)||void 0===n?void 0:n.model)&&!K(V.params.model)&&O(),a&&(await new Promise(e=>setTimeout(e,1)),await (async()=>{c.fitView({nodes:d,duration:200})})())},ez=rD();(0,b.useEffect)(()=>{let e=null==V?void 0:V.type;if(!(!l||!H||!e||["query_diff","query","row_count"].includes(e))&&!Y){var n;let e=null===(n=V.params)||void 0===n?void 0:n.model,t=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window});if(e){let n=K(e);n?G!==n.data&&eC(t,n):e_({...P,view_mode:"all"})}else ev()}},[V,P,H,Y]);let eR=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,n=ef.selectedNode;"action_result"!==Y&&void 0!==n&&void 0!==C&&(!Y&&($("selecting"),eo.reset(),P.column_level_lineage&&e_({...P,column_level_lineage:void 0})),ei(T(en,M(C,[n.id],e))))},eL=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,n=ef.selectedNode;"action_result"!==Y&&void 0!==n&&void 0!==C&&(!Y&&($("selecting"),eo.reset(),P.column_level_lineage&&e_({...P,column_level_lineage:void 0})),ei(T(en,A(C,[n.id],e))))},eI=()=>{ep(!1),eg({x:0,y:0})},eE=()=>{$(void 0),ei(new Set),X(void 0),O(),null==R||R()},eT={interactive:l,nodes:g,focusedNode:G,selectedNodes:er,viewOptions:P,onViewOptionsChanged:e_,selectMode:Y,selectNode:e=>{if(Y){if("selecting"===Y){let n=new Set(en);en.has(e)?n.delete(e):n.add(e),ei(n),0===n.size&&$(void 0)}}else{if(!C)return;ei(new Set([e])),$("selecting"),X(void 0),P.column_level_lineage&&e_({...P,column_level_lineage:void 0}),eo.reset()}},deselect:eE,breakingChangeEnabled:ea,setBreakingChangeEnabled:ec,isNodeHighlighted:e=>ex.has(e),isNodeSelected:e=>en.has(e),isEdgeHighlighted:(e,n)=>!P.column_level_lineage&&ex.has(e)&&ex.has(n),getNodeAction:e=>eo.actionState.actions[e],getNodeColumnSet:e=>{var n;return ed&&null!==(n=ed[e])&&void 0!==n?n:new Set},runRowCount:async()=>{"selecting"===Y?(await eo.runRowCount(),es({type:"row_count",selected:"multi"})):G?(q("row_count",{node_names:[G.name]},{showForm:!1,showLast:!1}),es({type:"row_count",selected:"single"})):(q("row_count",{select:P.select,exclude:P.exclude,packages:P.packages,view_mode:P.view_mode}),es({type:"row_count",selected:"none"}))},runRowCountDiff:async()=>{"selecting"===Y?(await eo.runRowCountDiff(),es({type:"row_count_diff",selected:"multi"})):G?(q("row_count_diff",{node_names:[G.name]},{showForm:!1,showLast:!1}),es({type:"row_count_diff",selected:"single"})):(q("row_count_diff",{select:P.select,exclude:P.exclude,packages:P.packages,view_mode:P.view_mode}),es({type:"row_count_diff",selected:"none"}))},runValueDiff:async()=>{if(G)q("value_diff",{model:G.name},{showForm:!0,showLast:!1}),es({type:"value_diff",selected:"single"});else{let e="selecting"===Y?er.length:U.length;await ez.confirm(e)&&(await eo.runValueDiff(),es({type:"value_diff",selected:"selecting"===Y?"multi":"none"}))}},addLineageDiffCheck:async()=>{let e;"selecting"===Y?(e=await eo.addLineageDiffCheck(),eE(),es({type:"lineage_diff",selected:"multi"})):G||(e=await rz(P),es({type:"lineage_diff",selected:"none"})),e&&eb(e)},addSchemaDiffCheck:async()=>{let e;"selecting"===Y?er.length>0&&(e=await eo.addSchemaDiffCheck(),eE(),es({type:"schema_diff",selected:"multi"})):G?(e=await ib({node_id:G.id}),es({type:"schema_diff",selected:"single"})):(e=await ib({select:P.select,exclude:P.exclude,packages:P.packages,view_mode:P.view_mode}),es({type:"schema_diff",selected:"none"})),e&&eb(e)},cancel:eo.cancel,actionState:eo.actionState,showColumnLevelLineage:async(e,n)=>{await e_({...P,column_level_lineage:{node:e,column:n}},!1),X(e)},resetColumnLevelLinage:()=>{e_({...P,column_level_lineage:void 0},!1)}};return S?(0,i.jsx)(d.k,{width:"100%",height:"100%",alignItems:"center",justifyContent:"center",children:(0,i.jsx)(t7.$,{size:"xl"})}):z?(0,i.jsx)(e2.M,{h:"100%",children:(0,i.jsxs)(nu.g,{children:[(0,i.jsx)(r.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)(r.x,{children:["[Reason: ",z,"]"]}),(0,i.jsx)(et.z,{colorScheme:"blue",onClick:()=>{_&&_()},children:"Retry"})]})}):C&&g!=r1?"changed_models"!==B||C.modifiedSet.length?(0,i.jsxs)(t_.Provider,{value:eT,children:[(0,i.jsxs)(tA,{sizes:G?[70,30]:[100,0],minSize:G?400:0,gutterSize:G?5:0,style:{height:"100%",width:"100%"},children:[(0,i.jsxs)(nu.g,{ref:u,divider:(0,i.jsx)(ie.c,{borderColor:"gray.200"}),spacing:0,style:{contain:"strict"},position:"relative",children:[l&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(rS,{}),(0,i.jsx)(rq,{})]}),(0,i.jsxs)(I.x$,{nodeTypes:r0,edgeTypes:r5,nodes:g,edges:y,onNodesChange:v,onEdgesChange:k,onNodeClick:eC,onNodeContextMenu:(e,n)=>{if(!l||"action_result"===Y)return;e.preventDefault();let t=f.current.getBoundingClientRect(),i=f.current.offsetTop;eg({x:e.clientX-t.left,y:e.clientY-t.top+i,selectedNode:n}),ep(!0)},onClick:eI,onInit:()=>{if(J)c.fitView();else{let e=(0,I.RX)(g);c.setCenter(e.x+e.width/2,e.y+e.height/2,{zoom:1})}},maxZoom:1,minZoom:.1,nodesDraggable:l,ref:f,children:[(0,i.jsx)(it.A,{color:"#ccc"}),(0,i.jsx)(ii.Z,{showInteractive:!1,position:"top-right",className:iT,children:(0,i.jsx)(ii.B,{title:"copy image",onClick:async()=>{await m()},children:(0,i.jsx)(s.J,{as:io.C3L})})}),(0,i.jsx)(p,{}),(0,i.jsx)(I.s_,{position:"bottom-left",children:(0,i.jsxs)(d.k,{direction:"column",gap:"5px",children:[J&&(0,i.jsx)(rR,{}),P.column_level_lineage&&(0,i.jsx)(rZ,{})]})}),(0,i.jsx)(I.s_,{position:"top-center",children:(0,i.jsx)(rX,{notification:(null==L?void 0:L.single_env_onboarding)?(0,i.jsx)(rY,{}):null,type:"info"})}),(0,i.jsx)(I.s_,{position:"top-left",children:(0,i.jsxs)(d.k,{direction:"column",gap:"5px",children:[(0,i.jsx)(rJ,{enabled:ea,onChanged:e=>{var n;ec(e),X(void 0),n={enabled:e},el.j("[Experiment] breaking_change_analysis",n),eh=n.enabled}}),P.column_level_lineage&&(0,i.jsx)(rQ,{node:P.column_level_lineage.node,column:P.column_level_lineage.column,reset:()=>{e_({...P,column_level_lineage:void 0})}}),0==g.length&&(0,i.jsx)(ee.x,{fontSize:"xl",color:"grey",opacity:.5,children:"No nodes"})]})}),(0,i.jsx)(ir.a,{nodeColor:r2,nodeStrokeWidth:3,zoomable:!0,pannable:!0}),"action_result"===Y&&(0,i.jsx)(I.s_,{position:"bottom-center",className:iT,children:(0,i.jsx)(rg,{onClose:()=>{eE()}})})]}),em&&(0,i.jsx)(nJ.v,{isOpen:!0,onClose:eI,children:(0,i.jsxs)(nQ.q,{fontSize:"11pt",position:"absolute",width:"250px",style:{left:"".concat(ef.x,"px"),top:"".concat(ef.y,"px")},children:[(0,i.jsx)(nX.s,{icon:(0,i.jsx)(ij.Cv2,{}),onClick:()=>{eR(1)},children:"Select parent nodes"}),(0,i.jsx)(nX.s,{icon:(0,i.jsx)(ij.IMj,{}),onClick:()=>{eL(1)},children:"Select child nodes"}),(0,i.jsx)(tu.R,{}),(0,i.jsx)(nX.s,{icon:(0,i.jsx)(ij.Cv2,{}),onClick:()=>{eR()},children:"Select all upstream nodes"}),(0,i.jsx)(nX.s,{icon:(0,i.jsx)(ij.IMj,{}),onClick:()=>{eL()},children:"Select all downstream nodes"})]})})]}),G?(0,i.jsx)(r.x,{borderLeft:"solid 1px lightgray",height:"100%",children:(0,i.jsx)(rf,{node:G,onCloseNode:ev})}):(0,i.jsx)(r.x,{})]}),ez.AlertDialog]}):(0,i.jsx)(e2.M,{h:"100%",children:(0,i.jsxs)(nu.g,{children:[(0,i.jsx)(i.Fragment,{children:"No change detected"}),(0,i.jsx)(et.z,{colorScheme:"blue",onClick:async()=>{await e_({...P,view_mode:"all"})},children:"Show all nodes"})]})}):(0,i.jsx)(i.Fragment,{})}),r9=(0,b.forwardRef)(function(e,n){let{check:t}=e,r={...t.params,...t.view_options};return(0,i.jsx)(d.k,{direction:"column",height:"100%",children:(0,i.jsx)(I.tV,{children:(0,i.jsx)(r3,{viewOptions:r,interactive:!1,ref:n})})})});function r8(e){let{yamlTemplate:n}=e;return(0,i.jsx)(t5.ML,{height:"300px",language:"yaml",theme:"vs",value:n,options:{readOnly:!0,fontSize:14,lineNumbers:"off",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"same",scrollBeyondLastLine:!1}})}function r7(){let e=(0,o.p)();return{markedAsApprovedToast:function(){e({title:"Marked as approved",position:"bottom-right",status:"success",containerStyle:{fontSize:"sm"},duration:2e3})}}}function le(){let e=(0,tc._)(["\n <details><summary>","</summary>\n\n ","\n\n </details>"]);return le=function(){return e},e}let ln=(e,n)=>"schema_diff"!==e&&"lineage_diff"!==e&&(!(null==n?void 0:n.result)||!!n.error),lt=e=>{var n,t,l,o,a,c,u,j;let{checkId:v,refreshCheckList:y}=e,C=(0,k.NL)(),[,_]=(0,eI.TH)(),{successToast:S,failToast:z}=tY(),{markedAsApprovedToast:R}=r7(),[L,I]=(0,b.useState)(),[E,T]=(0,b.useState)(),[D,O]=(0,b.useState)(!1),[M,A]=(0,b.useState)(""),{isOpen:F,onOpen:N,onClose:H}=(0,Q.q)(),V=()=>(0,i.jsx)(X.Z,{bg:"blackAlpha.300",backdropFilter:"blur(10px) "}),[P,W]=(0,b.useState)((0,i.jsx)(V,{})),{isLoading:K,error:J,data:B}=(0,w.a)({queryKey:q.check(v),queryFn:async()=>tl(v),refetchOnMount:!0}),U=L||(null==B?void 0:null===(n=B.last_run)||void 0===n?void 0:n.run_id),{run:en,error:ei}=ik(U),er=L?!en||"running"===en.status:(null==en?void 0:en.status)==="running",el=(null==B?void 0:B.type)?n2(B.type):void 0,es=(null==B?void 0:B.is_preset)||!1,eo=(0,b.useRef)(null),{mutate:ea}=(0,tC.D)({mutationFn:e=>ts(v,e),onSuccess:async()=>{await C.invalidateQueries({queryKey:q.check(v)}),await C.invalidateQueries({queryKey:q.checks()})}}),{mutate:ec}=(0,tC.D)({mutationFn:()=>to(v),onSuccess:async()=>{await C.invalidateQueries({queryKey:q.checks()}),_("/checks")}}),ed=(0,b.useCallback)(async()=>{(null==B?void 0:B.type)&&(I((await ef(v,{nowait:!0})).run_id),await C.invalidateQueries({queryKey:q.check(v)}),y&&y())},[B,v,I,C,y]),eu=(0,b.useCallback)(async()=>{if(O(!0),U)return await ep(U)},[U]),eh=async()=>{var e;if(!B)return;let n=(e=B,(0,tG.RI)(le(),"".concat(e.is_checked?"✅ ":"").concat(e.name),function(e){if("query"===e.type||"query_diff"===e.type){var n;return"".concat(t0(e),"\n\n").concat((0,tG.Pn)(t$(),null===(n=e.params)||void 0===n?void 0:n.sql_template))}return t0(e)}(e)));if(!window.isSecureContext){z("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),S("Copied the check to the clipboard")}catch(e){z("Failed to copy the check to clipboard",e)}},ex=(0,b.useCallback)(()=>{let e=null==B?void 0:B.is_checked;ea({is_checked:!e}),e||R()},[null==B?void 0:B.is_checked,ea,R]),[em,eg]=(0,b.useState)(0),{ref:ej,onCopyToClipboard:ev,onMouseEnter:ey,onMouseLeave:eb}=iO();if((0,b.useEffect)(()=>{A(function(e){let{name:n,description:t,type:i,params:r,viewOptions:l}=e,s={name:n,description:t,type:i,params:r};return l&&(s.view_options=l),iC.ZP.stringify({checks:[s]})}({name:(null==B?void 0:B.name)||"",description:(null==B?void 0:B.description)||"",type:(null==B?void 0:B.type)||"",params:null==B?void 0:B.params,viewOptions:null==B?void 0:B.view_options}))},[B]),K)return(0,i.jsx)(e2.M,{h:"100%",children:"Loading"});if(J)return(0,i.jsxs)(e2.M,{h:"100%",children:["Error: ",J.message]});let ew=(null==en?void 0:en.run_at)?(0,t8.Q)(new Date(en.run_at),{addSuffix:!0}):null;return(0,i.jsxs)(tF,{minSize:100,sizes:[30,70],style:{height:"100%",width:"100%",maxHeight:"100%"},children:[(0,i.jsxs)(r.x,{style:{contain:"strict"},display:"flex",flexDirection:"column",children:[(0,i.jsxs)(d.k,{p:"0px 16px",alignItems:"center",h:"40px",children:[(0,i.jsx)(tk,{name:(null==B?void 0:B.name)||"",setName:e=>{ea({name:e})}}),es&&(0,i.jsx)(nD.u,{label:"Preset Check defined in recce config",children:(0,i.jsxs)(td.Vp,{size:"sm",flex:"0 0 auto",ml:"2",children:[(0,i.jsx)(td.AD,{boxSize:"14px",as:tj.bX4}),"Preset"]})}),(0,i.jsx)(m.L,{}),(0,i.jsxs)(x.U,{mr:"10px",children:[ew&&(0,i.jsx)(r.x,{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",fontSize:"10pt",children:ew}),(0,i.jsxs)(nJ.v,{children:[(0,i.jsx)(nB.j,{isRound:!0,as:nn.h,icon:(0,i.jsx)(s.J,{as:e9.D_A}),variant:"ghost",size:"sm"}),(0,i.jsxs)(nQ.q,{children:[(0,i.jsx)(nX.s,{as:ee.x,fontSize:"10pt",icon:(0,i.jsx)(tv.ovA,{}),onClick:()=>{W((0,i.jsx)(V,{})),N()},children:"Get Preset Check Template"}),(0,i.jsx)(nX.s,{as:ee.x,fontSize:"10pt",icon:(0,i.jsx)(e7.T,{}),onClick:()=>eh(),children:"Copy Markdown"}),(0,i.jsx)(tu.R,{}),(0,i.jsx)(nX.s,{as:ee.x,fontSize:"10pt",icon:(0,i.jsx)(tp.p,{}),color:"red",onClick:()=>{ec()},children:"Delete"})]})]}),(0,i.jsx)(nD.u,{label:ln(null!==(c=null==B?void 0:B.type)&&void 0!==c?c:"",en)?"Run the check first":(null==B?void 0:B.is_checked)?"Mark as Pending":"Mark as Approved",placement:"bottom-end",children:(0,i.jsx)(et.z,{flex:"0 0 auto",size:"sm",colorScheme:(null==B?void 0:B.is_checked)?"green":"gray",variant:(null==B?void 0:B.is_checked)?"solid":"outline",leftIcon:(null==B?void 0:B.is_checked)?(0,i.jsx)(tf.r,{}):(0,i.jsx)(s.J,{as:e9.Rbx,color:"lightgray"}),onClick:()=>{ex()},isDisabled:ln(null!==(u=null==B?void 0:B.type)&&void 0!==u?u:"",en),children:(null==B?void 0:B.is_checked)?"Approved":"Mark as Approved"})})]})]}),(0,i.jsx)(r.x,{flex:"1",p:"8px 16px",minHeight:"100px",children:(0,i.jsx)(tX,{value:null==B?void 0:B.description,onChange:e=>{ea({description:e})}},null==B?void 0:B.check_id)})]}),(0,i.jsx)(r.x,{style:{contain:"strict"},children:(0,i.jsxs)(p.m,{height:"100%",display:"flex",flexDirection:"column",tabIndex:em,onChange:eg,children:[(0,i.jsxs)(f.t,{height:"50px",children:[(0,i.jsx)(g.O,{fontSize:"10pt",children:"Result"}),((null==B?void 0:B.type)==="query"||(null==B?void 0:B.type)==="query_diff")&&(0,i.jsx)(g.O,{fontSize:"10pt",children:"Query"}),(0,i.jsx)(m.L,{}),(0,i.jsxs)(x.U,{mr:"10px",children:[(null==el?void 0:el.RunResultView)&&(0,i.jsx)(nD.u,{label:"Rerun",children:(0,i.jsx)(et.z,{leftIcon:(0,i.jsx)(tg.n,{}),variant:"outline",isLoading:er,size:"sm",onClick:()=>ed(),children:"Rerun"})}),(0,i.jsx)(et.z,{leftIcon:(0,i.jsx)(e7.T,{}),variant:"outline",isDisabled:ln(null!==(j=null==B?void 0:B.type)&&void 0!==j?j:"",en)||0!==em,onMouseEnter:ey,onMouseLeave:eb,size:"sm",onClick:async()=>{if((null==B?void 0:B.type)==="lineage_diff"){var e;null===(e=eo.current)||void 0===e||e.copyToClipboard()}else await ev()},children:"Copy to Clipboard"})]})]}),(0,i.jsxs)(th.n,{height:"100%",flex:"1",style:{contain:"strict"},children:[(0,i.jsxs)(tx.x,{p:0,width:"100%",height:"100%",children:[(null==el?void 0:el.RunResultView)&&((null==B?void 0:B.last_run)||U?(0,i.jsx)(t9,{ref:ej,isRunning:er,isAborting:D,run:U?en:null==B?void 0:B.last_run,error:ei,progress:E,RunResultView:el.RunResultView,viewOptions:null==B?void 0:B.view_options,onViewOptionsChanged:e=>{ea({view_options:e})},onCancel:eu,onExecuteRun:ed}):(0,i.jsx)(e2.M,{bg:"rgb(249,249,249)",height:"100%",children:(0,i.jsxs)(nu.g,{spacing:4,children:[(0,i.jsx)(r.x,{children:"This action is part of the initial preset and has not been performed yet. Once performed, the result will be shown here."}),(0,i.jsx)(et.z,{onClick:ed,colorScheme:"blue",size:"sm",children:"Run Query"})]})})),B&&"schema_diff"===B.type&&(0,i.jsx)(tQ,{check:B,ref:ej}),B&&"lineage_diff"===B.type&&(0,i.jsx)(r9,{check:B,ref:eo})]}),((null==B?void 0:B.type)==="query"||(null==B?void 0:B.type)==="query_diff"||(null==B?void 0:B.type)==="query_base")&&(0,i.jsx)(tx.x,{p:0,height:"100%",width:"100%",children:(null===(t=B.params)||void 0===t?void 0:t.base_sql_template)?(0,i.jsx)(t4,{value:(null===(l=B.params)||void 0===l?void 0:l.sql_template)||"",baseValue:(null===(o=B.params)||void 0===o?void 0:o.base_sql_template)||"",options:{readOnly:!0}}):(0,i.jsx)(t2,{value:(null===(a=B.params)||void 0===a?void 0:a.sql_template)||"",options:{readOnly:!0}})})]})]})}),(0,i.jsxs)(Z.u_,{isOpen:F,onClose:H,isCentered:!0,size:"6xl",children:[P,(0,i.jsxs)(G.h,{overflowY:"auto",height:"40%",width:"60%",children:[(0,i.jsx)(Y.x,{children:"Preset Check Template"}),(0,i.jsx)(eR.o,{}),(0,i.jsxs)($.f,{children:[(0,i.jsxs)(h.X,{size:"sm",fontWeight:"bold",children:["Please"," ",(0,i.jsx)(ee.x,{as:"span",cursor:"pointer",_hover:{textDecoration:"underline"},color:"blue.500",onClick:async()=>{await navigator.clipboard.writeText(M),S("Copied the template to the clipboard")},children:"copy"})," ","the following template and paste it into the"," ",(0,i.jsx)(tm.y,{query:"recce.yml",styles:{px:"1",py:"0",bg:"red.100"},children:"recce.yml"})," ","file."]}),(0,i.jsx)("br",{}),(0,i.jsx)(r8,{yamlTemplate:M})]})]})]})]})};var li=t(96275);let lr=e=>{var n,t,l;let{check:o,selected:a,onSelect:c,onMarkAsApproved:u}=e,h=(0,k.NL)(),x=o.check_id,{mutate:m}=(0,tC.D)({mutationFn:e=>ts(x,e),onSuccess:async()=>{await h.invalidateQueries({queryKey:q.check(x)}),await h.invalidateQueries({queryKey:q.checks()})}}),{run:p}=ik(null===(n=o.last_run)||void 0===n?void 0:n.run_id),f=(null===(t=n2(o.type))||void 0===t?void 0:t.icon)||eE.WzH,g=ln(null!==(l=o.type)&&void 0!==l?l:"",p);return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(d.k,{width:"100%",p:"10px 20px",cursor:"pointer",_hover:{bg:"Cornsilk"},bg:a?"Floralwhite":"inherit",borderBlockEndWidth:"1px",borderLeftWidth:"3px",borderLeftColor:a?"orange":"transparent",onClick:()=>{c(o.check_id)},alignItems:"center",gap:"5px",children:[(0,i.jsx)(s.J,{as:f}),(0,i.jsx)(r.x,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:o.name}),(0,i.jsx)(nD.u,{label:g?"Run the check first":"Click to mark as approved",placement:"top",hasArrow:!0,children:(0,i.jsx)(d.k,{children:(0,i.jsx)(nk.X,{isChecked:o.is_checked,variant:"circular",colorScheme:"green",size:"xs",onChange:e=>{let n=e.target.checked;n?u():m({is_checked:n})},disabled:g})})})]})})},ll=e=>{let{checks:n,selectedItem:t,onCheckSelected:l,onChecksReordered:s}=e,[o,a]=(0,b.useState)(!1),c=(0,k.NL)(),{mutate:u}=(0,tC.D)({mutationFn:e=>ts(e,{is_checked:!0}),onSuccess:async(e,n)=>{await c.invalidateQueries({queryKey:q.check(n)}),await c.invalidateQueries({queryKey:q.checks()})}}),{isOpen:h,onOpen:x,onClose:m}=(0,Q.q)(),{markedAsApprovedToast:p}=r7(),f=()=>{"true"===localStorage.getItem("bypassMarkAsApprovedWarning")?(u(t),p()):x()};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(li.Z5,{onDragEnd:e=>{e.destination&&s(e.source.index,e.destination.index)},children:(0,i.jsx)(li.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)(li._l,{draggableId:e.check_id,index:n,children:(n,r)=>{if(r.isDragging){let e=n.draggableProps;if(null!=e.style&&"left"in e.style){let n={x:0,y:80},t=e.style.left-n.x,i=e.style.top-n.y;e.style.left=t,e.style.top=i}}return(0,i.jsx)(d.k,{ref:n.innerRef,...n.draggableProps,...n.dragHandleProps,w:"full",children:(0,i.jsx)(lr,{check:e,selected:e.check_id===t,onSelect:l,onMarkAsApproved:f},e.check_id)})}},e.check_id)),e.placeholder]})})}),(0,i.jsxs)(Z.u_,{isOpen:h,onClose:m,isCentered:!0,children:[(0,i.jsx)(X.Z,{}),(0,i.jsxs)(G.h,{width:"400px",children:[(0,i.jsx)(Y.x,{children:"Mark as Approved?"}),(0,i.jsx)(eR.o,{}),(0,i.jsx)(nO.i,{}),(0,i.jsxs)(r.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)(nk.X,{isChecked:o,onChange:e=>{a(e.target.checked)},fontWeight:"bold",size:"sm",pt:"8px",children:"Don't show this again"})]}),(0,i.jsx)(nO.i,{}),(0,i.jsxs)(en.m,{children:[(0,i.jsx)(et.z,{variant:"outline",size:"xs",mr:2,onClick:m,children:"Cancel"}),(0,i.jsx)(et.z,{colorScheme:"blue",size:"xs",onClick:()=>{u(t),o&&localStorage.setItem("bypassMarkAsApprovedWarning","true"),p(),m()},children:"Mark as approved"})]})]})]})]})};async function ls(e){return(await K.post("/api/save-as",e)).data}async function lo(e){return(await K.post("/api/rename",e)).data}async function la(){return(await K.post("/api/export")).data}async function lc(e,n){let t=new FormData;return t.append("file",e),t.append("checks_only",(!!n).toString()),(await K.post("/api/import",t)).data}async function ld(){return 208===(await K.get("/api/sync")).status}async function lu(e){try{let n=await K.post("/api/sync",e);if(202===n.status)return{status:"accepted"};if(208===n.status)return{status:"syncing"}}catch(e){if((0,rL.IZ)(e)&&e.response&&409===e.response.status)return{status:"conflict"}}throw Error("Failed to sync state")}function lh(e){let{checksOnly:n=!0}=e,t=(0,o.p)(),r=(0,k.NL)(),l=(0,b.useRef)(null),a=(0,b.useRef)(null),[c,u]=(0,b.useState)(null),{isOpen:h,onOpen:x,onClose:m}=(0,Q.q)(),[p,f]=(0,eI.TH)(),[,g]=ez(),j=(0,b.useCallback)(async()=>{if(c){try{let{runs:e,checks:i}=await lc(c,n);g(),await r.invalidateQueries({queryKey:q.checks()}),await r.invalidateQueries({queryKey:q.runs()}),p.includes("/checks")&&f("/checks");let l=n?"".concat(i," checks imported successfully"):"".concat(e," runs and ").concat(i," checks imported successfully");t({description:l,status:"info",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}catch(e){console.error("Import failed",e),t({title:"Import failed",description:String(e),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}m()}},[r,c,t,m,p,f,g,n]),v=n?"checks":"runs and checks",{isDemoSite:y}=eS();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nD.u,{label:"Import Checklist from State File"+(y?" (Disabled in the demo site)":""),children:(0,i.jsx)(nn.h,{pt:"6px",variant:"unstyled","aria-label":"Import state",onClick:()=>{l.current&&l.current.click()},icon:(0,i.jsx)(s.J,{as:rn}),isDisabled:y})}),(0,i.jsx)("input",{type:"file",style:{display:"none"},ref:l,onChange:e=>{var n;(null===(n=e.target.files)||void 0===n?void 0:n.length)===1&&(u(e.target.files[0]),x()),l.current&&(l.current.value="")}}),(0,i.jsx)(rT.aR,{isOpen:h,leastDestructiveRef:a,onClose:m,size:"xl",children:(0,i.jsx)(X.Z,{children:(0,i.jsxs)(rT._T,{children:[(0,i.jsx)(Y.x,{fontSize:"lg",fontWeight:"bold",children:"Import state"}),(0,i.jsx)($.f,{children:(0,i.jsxs)(d.k,{px:"5px",gap:"5px",rounded:"md",direction:"column",children:[(0,i.jsxs)(d.k,{alignItems:"center",gap:"5px",children:[(0,i.jsx)(il.s,{color:"red.600"}),(0,i.jsx)(ee.x,{as:"span",fontWeight:"500",color:"red.600",children:"Caution!"})]}),(0,i.jsx)(d.k,{children:(0,i.jsxs)(ee.x,{children:["The current ",v," will be"," ",(0,i.jsx)(ee.x,{as:"span",fontWeight:"600",children:"merged"})," ","with the imported state"]})})]})}),(0,i.jsxs)(en.m,{children:[(0,i.jsx)(et.z,{ref:a,onClick:m,children:"Cancel"}),(0,i.jsx)(et.z,{colorScheme:"blue",onClick:j,ml:"5px",children:"Import"})]})]})})})]})}let lx=()=>{let[,e]=(0,eI.TH)(),[,n]=(0,eI.yj)("/checks/:checkId"),{latestSelectedCheckId:t,setLatestSelectedCheckId:l}=te(),s=(0,k.NL)(),o=null==n?void 0:n.checkId;o&&l(o);let{isLoading:a,error:c,data:u,status:h,refetch:x}=(0,w.a)({queryKey:q.checks(),queryFn:tr,refetchOnMount:!0}),m=(0,b.useCallback)(n=>{e("/checks/".concat(n))},[e]),[p,f]=(0,b.useState)(u||[]),{mutate:g}=(0,tC.D)({mutationFn:e=>ta(e),onSuccess:async()=>{await s.invalidateQueries({queryKey:q.checks()})}}),j=(0,b.useCallback)((e,n)=>{let t=[...p],[i]=t.splice(e,1);t.splice(n,0,i),g({source:e,destination:n}),f(t)},[p,f,g]);return((0,b.useCallback)(async()=>{let e=await tt();await s.invalidateQueries({queryKey:q.checks()}),m(e.check_id)},[s,m]),(0,b.useEffect)(()=>{"success"===h&&(!o&&u.length>0&&(t?e("/checks/".concat(t)):e("/checks/".concat(u[0].check_id))),f(u))},[h,o,u,f,e,t]),a)?(0,i.jsx)(i.Fragment,{}):c?(0,i.jsxs)(i.Fragment,{children:["Error: ",c.message]}):(null==u?void 0:u.length)?(0,i.jsxs)(tA,{style:{height:"100%"},minSize:50,sizes:[20,80],children:[(0,i.jsx)(r.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)(d.k,{justifyContent:"right",padding:"0px 10px",children:(0,i.jsx)(lh,{checksOnly:!0})}),(0,i.jsx)(nO.i,{}),(0,i.jsx)(ll,{checks:p,selectedItem:o,onCheckSelected:m,onChecksReordered:j})]})}),(0,i.jsx)(r.x,{height:"100%",children:(0,i.jsx)(eI.rs,{children:(0,i.jsx)(eI.AW,{path:"/checks/:checkId",children:e=>(0,i.jsx)(lt,{checkId:e.checkId,refreshCheckList:x},e.checkId)})})})]}):(0,i.jsx)(e2.M,{h:"100%",children:(0,i.jsx)(r.x,{children:"No checks"})})},lm=()=>{let{isHistoryOpen:e,showHistory:n,closeHistory:t}=n9();return(0,i.jsxs)(r.x,{children:[(0,i.jsx)(r.x,{fontSize:"8pt",children:"History"}),(0,i.jsx)(et.z,{leftIcon:(0,i.jsx)(s.J,{as:e9.M1Q}),size:"xs",variant:"outline",onClick:()=>{e?(eo({name:"hide"}),t()):(eo({name:"show"}),n())},children:e?"Hide":"Show"})]})},lp=()=>{let{isCustomQueries:e,setCustomQueries:n,sqlQuery:t,setBaseSqlQuery:l}=z();return(0,i.jsxs)(r.x,{children:[(0,i.jsxs)(r.x,{fontSize:"8pt",children:["Custom Queries ","",(0,i.jsx)(nD.u,{label:"Custom queries allow you to use two SQL queries to compare results between current and base environments.",children:(0,i.jsx)(il.s,{color:"gray.600",boxSize:"3"})})]}),(0,i.jsx)(rH.r,{size:"sm",isChecked:e,onChange:()=>{!e&&l&&l(t),n(!e)}})]})},lf=()=>{let{sqlQuery:e,baseSqlQuery:n,setSqlQuery:t,setBaseSqlQuery:l,primaryKeys:s,setPrimaryKeys:o,isCustomQueries:a}=z(),{lineageGraph:c,envInfo:u}=eS(),{data:h}=ek(),x=e;(null==u?void 0:u.adapterType)==="sqlmesh"&&e===C&&(x="select * from db.mymodel");let{showRunId:p}=n9(),f=async e=>{let t="query_base"===e?null!=n?n:"":x,i=function(e){switch(e){case"query":return iP;case"query_base":return iW;case"query_diff":return iK;default:throw Error("Unknown query type: ".concat(e))}}(e),r={sql_template:t};"query_diff"===e&&(r.primary_keys=s,a&&(r.base_sql_template=n));let{run_id:l}=await i(r,{nowait:!0});return p(l),await em(l)},{mutate:g,isPending:j}=(0,tC.D)({mutationFn:f}),v=(0,b.useMemo)(()=>{let e={};for(let t in null==c?void 0:c.nodes){var n;let i=null===(n=c.nodes[t].data.current)||void 0===n?void 0:n.schema;i&&(e[i]=(e[i]||0)+1)}return Object.keys(e).reduce((n,t)=>e[t]>(e[n]||0)?t:n,"N/A")},[null==c?void 0:c.nodes]);return(null==h?void 0:h.single_env_onboarding)?(0,i.jsxs)(d.k,{direction:"column",height:"100%",children:[(0,i.jsxs)(d.k,{justifyContent:"right",alignItems:"center",padding:"4pt 8pt",gap:"5px",height:"54px",borderBottom:"1px solid lightgray",children:[(0,i.jsx)(lm,{}),(0,i.jsx)(m.L,{}),(0,i.jsx)(nD.u,{label:"Please configure the base environment before running the diff",placement:"left",children:(0,i.jsx)(et.z,{colorScheme:"blue",isDisabled:!0,size:"xs",fontSize:"14px",marginTop:"16px",children:"Run Diff"})})]}),(0,i.jsx)(t4,{value:x,onChange:t,onRun:()=>{g("query")},labels:["base (production)","current (".concat(v,")")],BaseEnvironmentSetupGuide:(0,i.jsx)(rG,{})})]}):(0,i.jsxs)(d.k,{direction:"column",height:"100%",children:[(0,i.jsxs)(d.k,{justifyContent:"right",alignItems:"center",padding:"4pt 8pt",gap:"5px",height:"54px",borderBottom:"1px solid lightgray",flex:"0 0 54px",children:[(0,i.jsx)(lm,{}),(0,i.jsx)(lp,{}),(0,i.jsx)(m.L,{}),(0,i.jsx)(iZ,{defaultPrimaryKeys:s,onPrimaryKeysChange:o}),(0,i.jsx)(et.z,{colorScheme:"blue",onClick:()=>{g("query_diff")},isDisabled:j,size:"xs",fontSize:"14px",marginTop:"16px",children:"Run Diff"})]}),(0,i.jsx)(r.x,{width:"100%",flex:"1",children:a?(0,i.jsx)(t4,{value:x,baseValue:n,onChange:t,onChangeBase:l,onRun:()=>{g("query")},onRunBase:()=>{g("query_base")},onRunDiff:()=>{g("query_diff")}}):(0,i.jsx)(t2,{value:x,onChange:t,onRun:()=>{g("query")},onRunDiff:()=>{g("query_diff")}})})]})};var lg=t(73148);let lj=e=>{(0,lg.c4)("#!"+e)},lv=()=>[(0,lg.LD)(()=>window.location.hash.replace(/^#!/,"")||"/",()=>"/ssr"),lj];var ly=t(53646),lb=t(30193);let lw=e=>{var n;let{runId:t}=e,{isPending:r,error:l,data:s}=(0,w.a)({queryKey:q.run(t),queryFn:async()=>em(t)}),o=(null==s?void 0:s.type)?null===(n=n2(s.type))||void 0===n?void 0:n.RunResultView:void 0;return(0,i.jsx)(t9,{isPending:r,error:l,run:s,RunResultView:o})},lk=e=>{let{error:n,resetError:t}=e;return(0,i.jsx)(e2.M,{height:"100%",backgroundColor:"gray.50",children:(0,i.jsxs)(d.k,{p:4,direction:"column",justifyContent:"flex-start",backgroundColor:"white",border:"solid lightgray 1px",minHeight:"200px",children:[(0,i.jsx)(h.X,{width:"800px",size:"md",children:"You have encountered an error"}),(0,i.jsx)(r.x,{flex:"1",fontSize:"10pt",children:n.toString()}),(0,i.jsx)(et.z,{justifySelf:"center",alignSelf:"center",mt:"20px",colorScheme:"blue",size:"sm",onClick:()=>{t()},children:"Reset"})]})})},lC=e=>{let{children:n}=e;return(0,i.jsx)(t3.SV,{fallback:lk,children:n})};function l_(){let e=(0,o.p)(),n=async()=>{try{let e=await la(),n=JSON.stringify(e,null,2),t=new Blob([n],{type:"application/json"}),i=new Date,r="recce-state-".concat((0,iL.WU)(i,"yyyy-MM-dd-HH-mm-ss"),".json");iE()(t,r)}catch(n){console.error("Export failed",n),e({title:"Export failed",description:String(n),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}};return(0,i.jsx)(nD.u,{label:"Export",children:(0,i.jsx)(nn.h,{size:"sm",variant:"unstyled","aria-label":"Export state",onClick:n,icon:(0,i.jsx)(s.J,{as:re,verticalAlign:"middle",boxSize:"16px"})})})}function lS(){return(0,i.jsx)(I.tV,{children:(0,i.jsx)(r3,{interactive:!0})})}t(11306);let lz=e=>{let{isGuideOpen:n,closeGuide:t}=e;return(0,i.jsxs)(Z.u_,{isOpen:n,onClose:t,scrollBehavior:"inside",children:[(0,i.jsx)(X.Z,{}),(0,i.jsxs)(G.h,{maxW:"80vw",h:"80vh",children:[(0,i.jsx)(Y.x,{children:"Welcome to Recce: 3 Steps to Begin"}),(0,i.jsx)(eR.o,{}),(0,i.jsx)($.f,{children:(0,i.jsxs)(t1.K,{spacing:4,children:[(0,i.jsxs)(tN.aV,{spacing:2,children:[(0,i.jsx)(tN.HC,{children:"Step 1: Click the model you want to check"}),(0,i.jsx)(tN.HC,{children:'Step 2: Click "Explore Change"'}),(0,i.jsx)(tN.HC,{children:'Step 3: Click "Add to Checklist"'})]}),(0,i.jsx)(nO.i,{}),(0,i.jsx)(u.E,{src:"https://datarecce.io/assets/images/onboarding/material.svg",alt:"placeholder"})]})}),(0,i.jsx)(en.m,{children:(0,i.jsx)(et.z,{colorScheme:"blue",onClick:t,children:"Got it!"})})]})]})};var lR=()=>{let[e,n]=(0,b.useState)(!1),{data:t,isLoading:r}=ek();return((0,b.useEffect)(()=>{if(!r&&t){let e=t.show_onboarding_guide;!localStorage.getItem("hasVisited")&&e&&(n(!0),localStorage.setItem("hasVisited","true"))}},[t,r]),r)?(0,i.jsx)(i.Fragment,{}):(0,i.jsx)(lz,{isGuideOpen:e,closeGuide:()=>{n(!1),eb()}})},lL=t(4657);t(26728);let lI=e=>{var n;let{run:t,isSelected:l,onSelectRun:o,onAddToChecklist:a,onGoToCheck:c}=e,{data:u}=(0,w.a)({queryKey:q.run(t.run_id),queryFn:async()=>await em(t.run_id),enabled:"running"===t.status,retry:!1}),h=(null===(n=n2(t.type))||void 0===n?void 0:n.icon)||eE.WzH,x=t.check_id;return(0,i.jsxs)(d.k,{minWidth:"200px",direction:"column",width:"100%",p:"5px 20px",cursor:"pointer",borderBottom:"solid 1px lightgray",borderLeft:"4px",borderLeftColor:l?"orange.400":"transparent",backgroundColor:l?"orange.50":"transparent",onClick:()=>{o(t.run_id)},_hover:{bg:l?"orange.50":"gray.200"},children:[(0,i.jsxs)(d.k,{onClick:()=>{},alignItems:"center",gap:"12px",children:[(0,i.jsx)(s.J,{as:h}),(0,i.jsx)(r.x,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",color:t.name?"inherit":"gray.500",fontSize:"11pt",fontWeight:"500",children:t.name||"<no name>"}),x?(0,i.jsx)(nD.u,{label:"Go to Check","aria-label":"Go to Check",children:(0,i.jsx)(ee.x,{onClick:e=>{e.preventDefault(),e.stopPropagation(),c(x)},children:(0,i.jsx)(s.J,{color:"green",as:tq.FJM})})}):(0,i.jsx)(nD.u,{label:"Add to Checklist","aria-label":"Add to Checklist",children:(0,i.jsx)(ee.x,{onClick:e=>{e.preventDefault(),e.stopPropagation(),eo({name:"add_to_checklist"}),a(t.run_id)},children:(0,i.jsx)(s.J,{as:tq.wO})})})]}),(0,i.jsx)(d.k,{justifyContent:"start",fontSize:"11pt",color:"gray.500",gap:"3px",alignItems:"center",children:(0,i.jsx)(iM,{run:u||t})})]})},lE=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,iL.WU)(e,"MMM d")}(new Date(n)):null;return(0,i.jsx)(d.k,{minWidth:"200px",width:"100%",p:"5px 20px",borderBottom:"solid 1px lightgray",color:"gray.500",fontSize:"11pt",children:t})},lT=()=>{let{data:e,isLoading:n,isFetching:t,error:l,refetch:s}=(0,w.a)({queryKey:q.runs(),queryFn:async()=>await ej(),retry:!1}),{showRunId:o,runId:a}=n9(),c=e=>{eo({name:"click_run"}),o(e,!1)},[,u]=(0,eI.TH)(),p=(0,k.NL)(),f=(0,b.useCallback)(async()=>{if(!a)return;let e=await ti(a);await p.invalidateQueries({queryKey:q.checks()}),u("/checks/".concat(e.check_id))},[a,u,p]),g=(0,b.useCallback)(e=>{eo({name:"go_to_check"}),u("/checks/".concat(e))},[u]),j=null;return(0,i.jsxs)(d.k,{direction:"column",height:"100%",children:[(0,i.jsxs)(x.U,{width:"100%",flex:"0 0 54px",paddingInline:"24px 8px",borderBottom:"solid 1px lightgray",children:[(0,i.jsx)(h.X,{size:"md",children:"History"}),(0,i.jsx)(m.L,{}),(0,i.jsx)(nn.h,{variant:"unstyled",icon:(0,i.jsx)(tg.n,{}),"aria-label":"Search database",onClick:async()=>{await s()}})]}),(0,i.jsx)(r.x,{flex:"1 1 auto",children:n?"Loading...":(null==e?void 0:e.length)===0?(0,i.jsx)(e2.M,{height:"100%",color:"gray.400",children:"No runs"}):(0,i.jsx)(lL.Z,{style:{minHeight:"100%",height:0},children:(e||[]).map((e,n)=>{let t=new Date(e.run_at).toDateString(),r=null!=j&&j!==t;return j=t,(0,i.jsxs)(i.Fragment,{children:[r&&(0,i.jsx)(lE,{runAt:e.run_at},t),(0,i.jsx)(lI,{run:e,isSelected:e.run_id===a,onSelectRun:c,onGoToCheck:g,onAddToChecklist:f},e.run_id)]})})})})]})};var lD=t(73043),lO=t(75096);let{definePartsStyle:lM,defineMultiStyleConfig:lA}=(0,lO.D)(lD.TB.keys),lF=lA({variants:{circular:lM({control:(0,lO.k0)({rounded:"full"})})},sizes:{xs:lM({icon:(0,lO.k0)({fontSize:"8px"}),control:(0,lO.k0)({boxSize:"16px",padding:"4px"}),label:(0,lO.k0)({fontSize:"xs"})})}}),lN=(0,t(79458).fj)({baseStyle:{borderRadius:"4px"}});var lq=t(42992);let lH=()=>{let e=(0,o.p)();return{toastSuccess:n=>{e({description:n,status:"success",variant:"left-accent",position:"bottom-right",duration:5e3,isClosable:!0})},toastError:(n,t)=>{let i=n;if(null!=t){if(t instanceof rL.d7){var r,l;i="".concat(n,". ").concat(String(null===(l=t.response)||void 0===l?void 0:null===(r=l.data)||void 0===r?void 0:r.detail))}else i="".concat(n,". ").concat(t)}e({description:i,status:"error",variant:"left-accent",position:"bottom-right",duration:5e3,isClosable:!0})}}},lV=e=>{(0,b.useEffect)(()=>{let n=e=>{e.preventDefault()};return e&&window.addEventListener("beforeunload",n),()=>{e&&window.removeEventListener("beforeunload",n)}},[e])},lP=()=>{let{fileName:e,cloudMode:n,isDemoSite:t,isLoading:l}=eS(),o=(0,Q.q)(),a=(0,Q.q)(),c=!e&&!n&&!t,{data:u}=(0,w.a)({queryKey:q.checks(),queryFn:tr,enabled:c}),h=void 0!=u&&u.filter(e=>!e.is_preset).length>0;lV(c&&h);let[{newFileName:x,errorMessage:m,modified:p,overwriteWithMethod:f,bypass:g},j]=(0,b.useState)({newFileName:e||"recce_state.json"}),v=(0,b.useRef)(null),{toastSuccess:y,toastError:C}=lH(),_=(0,k.NL)(),S=async(e,n)=>{if(!x)return;let t="true"===localStorage.getItem(i0.bypassSaveOverwrite);try{"save"===e?await ls({filename:x,overwrite:n||t}):await lo({filename:x,overwrite:n||t}),y("save"===e?"Save file successfully":"Rename file successfully"),await _.invalidateQueries({queryKey:q.lineage()}),g&&localStorage.setItem(i0.bypassSaveOverwrite,"true")}catch(n){if(n instanceof rL.d7){var i;if((null===(i=n.response)||void 0===i?void 0:i.status)===409){j(n=>({...n,overwriteWithMethod:e})),a.onOpen();return}}C("save"===e?"Save file failed":"Rename file failed",n)}finally{o.onClose()}};return n||t?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(d.k,{flex:"1",justifyContent:"center",alignItems:"center",children:[(0,i.jsx)(r.x,{fontWeight:"600",children:e||(n?"cloud":"New Instance"+(h?" (unsaved)":""))}),(0,i.jsx)(nD.u,{label:e?"Change Filename":"Save",openDelay:1e3,children:(0,i.jsx)(nn.h,{onClick:()=>{j({newFileName:e||"recce_state.json",modified:!e}),o.onOpen()},"aria-label":"",variant:"unstyled",size:"sm",children:(0,i.jsx)(s.J,{as:e?ri:rt,boxSize:"16px",verticalAlign:"middle"})})})]}),(0,i.jsxs)(Z.u_,{isOpen:o.isOpen,onClose:o.onClose,isCentered:!0,children:[(0,i.jsx)(X.Z,{}),(0,i.jsxs)(G.h,{children:[(0,i.jsx)(Y.x,{children:e?"Change Filename":"Save File"}),(0,i.jsx)(eR.o,{}),(0,i.jsx)($.f,{onKeyDown:e=>{e.stopPropagation()},children:(0,i.jsxs)(eT.NI,{isInvalid:!!m,children:[(0,i.jsx)(eD.l,{children:"File name:"}),(0,i.jsx)(nP.I,{ref:v,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.",j(e=>({...e,modified:!0,newFileName:i,errorMessage:t}))},onKeyDown:n=>{"Enter"===n.key?m||(e?S("rename"):S("save")):"Escape"===n.key&&o.onClose()}}),(0,i.jsx)(lq.J1,{children:m})]})}),(0,i.jsxs)(en.m,{gap:"5px",children:[(0,i.jsx)(et.z,{size:"sm",colorScheme:e?void 0:"blue",onClick:async()=>{await S("save")},isDisabled:!x||!!m||!p,children:e?"Save as New File":"Confirm"}),e&&(0,i.jsx)(et.z,{size:"sm",colorScheme:"blue",onClick:async()=>{await S("rename")},isDisabled:!x||!!m||!p,children:"Rename"})]})]})]}),(0,i.jsxs)(Z.u_,{isOpen:a.isOpen,onClose:a.onClose,initialFocusRef:v,isCentered:!0,children:[(0,i.jsx)(X.Z,{}),(0,i.jsxs)(G.h,{children:[(0,i.jsx)(Y.x,{children:"Overwrite File?"}),(0,i.jsx)(eR.o,{}),(0,i.jsxs)($.f,{borderTop:"solid 1px lightgray",borderBottom:"solid 1px lightgray",onKeyDown:e=>{e.stopPropagation()},children:[(0,i.jsx)(r.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)(nk.X,{isChecked:g,onChange:e=>{j(n=>({...n,bypass:e.target.checked}))},fontWeight:"bold",size:"sm",pt:"8px",children:"Don't show this again"})]}),(0,i.jsxs)(en.m,{gap:"5px",children:[(0,i.jsx)(et.z,{variant:"outline",onClick:()=>{a.onClose(),o.onOpen(),j(e=>({...e,overwriteWithMethod:void 0}))},size:"sm",children:"Back"}),(0,i.jsx)(et.z,{size:"sm",colorScheme:"blue",onClick:()=>{f&&(S(f,!0),a.onClose())},children:"Overwrite"})]})]})]})]})};var lW=t(8138),lK=t(73949);function lJ(){return(0,i.jsx)(nD.u,{label:"Syncing",children:(0,i.jsx)(et.z,{pt:"6px",variant:"unstyled",boxSize:"1em",children:(0,i.jsx)(t7.$,{})})})}function lB(){let[e,n]=(0,b.useState)(!1),t=(0,k.NL)(),[l,a]=(0,eI.TH)(),{isOpen:c,onOpen:d,onClose:u}=(0,Q.q)(),[h,x]=(0,b.useState)(""),m=(0,o.p)(),p=(0,b.useCallback)(async e=>{if(u(),n(!0),"conflict"===(await lu(e)).status){d(),n(!1);return}for(;await ld();)await new Promise(e=>setTimeout(e,1e3));m({description:"Sync Completed",status:"success",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0}),n(!1),x(""),await t.invalidateQueries({queryKey:q.lineage()}),await t.invalidateQueries({queryKey:q.checks()}),await t.invalidateQueries({queryKey:q.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(l)&&a("/checks")},[t,l,a,m,d,u]);return e?(0,i.jsx)(lJ,{}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(nD.u,{label:"Sync with Cloud",children:(0,i.jsx)(nn.h,{size:"sm",variant:"unstyled","aria-label":"Sync state",onClick:()=>p({}),icon:(0,i.jsx)(s.J,{as:i7,verticalAlign:"middle",boxSize:"16px"})})}),(0,i.jsxs)(Z.u_,{isOpen:c,onClose:u,children:[(0,i.jsx)(X.Z,{}),(0,i.jsxs)(G.h,{children:[(0,i.jsx)(Y.x,{fontSize:"lg",fontWeight:"bold",children:"Sync with Cloud"}),(0,i.jsxs)($.f,{children:[(0,i.jsx)(r.x,{children:"New changes have been detected in the cloud. Please choose a method to sync your state"}),(0,i.jsx)(r.x,{mt:"5px",children:(0,i.jsx)(lW.E,{onChange:x,value:h,children:(0,i.jsxs)(t1.K,{direction:"column",children:[(0,i.jsxs)(lK.Y,{value:"merge",children:["Merge",(0,i.jsx)(nD.u,{label:"This will merge the local and remote states.",children:(0,i.jsx)("span",{children:(0,i.jsx)(s.J,{as:rO.h,ml:2,cursor:"pointer"})})})]}),(0,i.jsxs)(lK.Y,{value:"overwrite",children:["Overwrite",(0,i.jsx)(nD.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:rO.h,ml:2,cursor:"pointer"})})})]}),(0,i.jsxs)(lK.Y,{value:"revert",children:["Revert",(0,i.jsx)(nD.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:rO.h,ml:2,cursor:"pointer"})})})]})]})})})]}),(0,i.jsxs)(en.m,{children:[(0,i.jsx)(et.z,{onClick:u,mr:3,children:"Cancel"}),(0,i.jsx)(et.z,{colorScheme:"blue",onClick:()=>p({method:h}),isDisabled:!h,children:"Sync"})]})]})]})]})}let lU=e=>{let{children:n,path:t}=e,[l]=(0,eI.yj)(t);return(0,i.jsx)(r.x,{display:l?"block":"none",height:"100%",children:n})};function lQ(e){let{icon:n,href:t,...r}=e;return(0,i.jsx)(l.r,{height:"20px",color:"white",href:t,isExternal:!0,...r,children:(0,i.jsx)(s.J,{color:"white",boxSize:"20px",as:n})})}function lZ(){let{version:e,latestVersion:n}=function(){let[e,n]=(0,b.useState)(""),[t,i]=(0,b.useState)("");return(0,b.useEffect)(()=>{(async function(){try{let e=(await K.get("/api/version")).data,t=e.version,r=e.latestVersion;n(t),i(r)}catch(e){console.error("Error fetching version number:",e)}})()},[]),{version:e,latestVersion:t}}(),t=(0,o.p)(),r="recce-update-available";return RegExp("^\\d+\\.\\d+\\.\\d+$").test(e)?(e===n||t.isActive(r)||t({id:r,title:"Update available",position:"top-right",description:(0,i.jsxs)("span",{children:["A new version of Recce (v",n,") is available.",(0,i.jsx)("br",{}),"Please run ",(0,i.jsx)(c.E,{children:"pip install --upgrade recce"})," to update Recce.",(0,i.jsx)("br",{}),(0,i.jsx)(l.r,{color:"rgb(255, 215, 0)",fontWeight:"bold",href:"https://github.com/DataRecce/recce/releases/tag/v".concat(n),isExternal:!0,_hover:{textDecoration:"underline"},target:"_blank",children:"Click here to view the detail of latest release"})]}),containerStyle:{background:"rgba(20, 20, 20, 0.6)",color:"white",backdropFilter:"blur(10px)",borderRadius:"8px"},variant:"unstyled",isClosable:!0}),(0,i.jsx)(a.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:(0,i.jsx)(l.r,{href:"https://github.com/DataRecce/recce/releases/tag/v".concat(e),isExternal:!0,_hover:{textDecoration:"none"},children:e})})):(0,i.jsx)(a.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:e})}function lX(){var e;let{reviewMode:n,isDemoSite:t,envInfo:o,cloudMode:c}=eS(),{url:p,id:f}=null!==(e=null==o?void 0:o.pullRequest)&&void 0!==e?e:{},g=p?p.split("/").pop():null;return(0,i.jsxs)(d.k,{gap:"10px",minHeight:"40px",alignItems:"center",bg:"rgb(255, 110, 66)",children:[(0,i.jsx)(u.E,{boxSize:"20px",ml:"18px",src:"/logo/recce-logo-white.png",alt:"recce-logo-white"}),(0,i.jsx)(h.X,{as:"h1",fontFamily:'"Montserrat", sans-serif',fontSize:"lg",color:"white",children:"RECCE"}),(0,i.jsx)(lZ,{}),n&&(0,i.jsx)(a.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:"review mode"}),c&&f&&(0,i.jsx)(a.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:(0,i.jsxs)(x.U,{children:[(0,i.jsx)(r.x,{children:"cloud mode"}),(0,i.jsx)(r.x,{borderLeft:"1px",borderLeftColor:"whiteAlpha.500",paddingLeft:"8px",children:(0,i.jsxs)(l.r,{href:p,_hover:{textDecoration:"none"},isExternal:!0,children:[(0,i.jsx)(s.J,{as:e9.X9P,boxSize:"3",fontWeight:"extrabold",strokeWidth:"1"})," #".concat(String(f))]})})]})}),t&&p&&g&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(a.C,{fontSize:"sm",color:"white",colorScheme:"whiteAlpha",variant:"outline",children:(0,i.jsxs)(x.U,{children:[(0,i.jsx)(r.x,{children:"demo mode"}),(0,i.jsx)(r.x,{borderLeft:"1px",borderLeftColor:"whiteAlpha.500",paddingLeft:"8px",children:(0,i.jsxs)(l.r,{href:p,_hover:{textDecoration:"none"},isExternal:!0,children:[(0,i.jsx)(s.J,{as:e9.X9P,boxSize:"3",fontWeight:"extrabold",strokeWidth:"1"})," #".concat(g)]})})]})})}),(0,i.jsx)(m.L,{}),(0,i.jsx)(lQ,{icon:tq.hJX,href:"https://github.com/DataRecce/recce"}),(0,i.jsx)(lQ,{icon:tq.w5k,href:"https://getdbt.slack.com/archives/C05C28V7CPP"}),(0,i.jsx)(lQ,{mr:"18px",icon:tq.MXt,href:"https://datarecce.io/docs"})]})}function lG(e){let{queryKey:n,fetchCallback:t,selectCallback:l}=e,{data:s,isLoading:o,error:a}=(0,w.a)({queryKey:n,queryFn:t,select:l});return o||a||0===s?(0,i.jsx)(i.Fragment,{}):(0,i.jsx)(r.x,{ml:"2px",height:"80%",aspectRatio:1,borderRadius:"full",bg:"tomato",alignContent:"center",color:"white",fontSize:"xs",children:s})}function lY(){let{isDemoSite:e,cloudMode:n,isLoading:t}=eS(),[l,s]=(0,eI.TH)(),{data:o,isLoading:a}=ek(),c=[{name:"Lineage",href:"/lineage"},{name:"Query",href:"/query"},{name:"Checklist",href:"/checks",badge:(0,i.jsx)(lG,{queryKey:q.checks(),fetchCallback:tr,selectCallback:e=>e.filter(e=>!e.is_checked).length}),disable:(null==o?void 0:o.single_env_onboarding)===!0}],u=eA().findIndex(c,e=>{let{href:n}=e;return l.startsWith(n)});return(0,i.jsx)(p.m,{index:u,children:(0,i.jsxs)(f.t,{children:[(0,i.jsx)(r.x,{flex:"1",display:"flex",children:c.map(e=>{let{name:n,href:r,badge:l,disable:o}=e;return(0,i.jsxs)(g.O,{onClick:()=>{s(r)},isDisabled:!!t||a||o,hidden:o,children:[n,l]},n)})}),!t&&!e&&(0,i.jsx)(lP,{}),!t&&(0,i.jsxs)(d.k,{flex:"1",justifyContent:"right",alignItems:"center",mr:"8px",children:[n&&(0,i.jsx)(lB,{}),(0,i.jsx)(l_,{}),(0,i.jsx)(rc,{})]})]})})}function l$(){let{isRunResultOpen:e,isHistoryOpen:n,closeRunResult:t}=n9(),{data:l}=ek(),[s]=(0,eI.TH)(),o=n&&!s.startsWith("/checks");return(0,i.jsxs)(tA,{sizes:[0,100],minSize:o?300:0,gutterSize:o?5:0,style:{height:"100%"},children:[(0,i.jsx)(r.x,{style:{contain:"size"},children:o&&(0,i.jsx)(lT,{})}),(0,i.jsxs)(tF,{sizes:e?[50,50]:[100,0],minSize:e?100:0,gutterSize:e?5:0,style:{flex:"1",contain:"size"},children:[(0,i.jsx)(r.x,{p:0,style:{contain:"content"},children:(0,i.jsxs)(lC,{children:[(0,i.jsx)(lU,{path:"/lineage",children:(0,i.jsx)(lS,{})}),(0,i.jsxs)(eI.rs,{children:[(0,i.jsx)(eI.AW,{path:"/query",children:(0,i.jsx)(lf,{})}),(0,i.jsx)(eI.AW,{path:"/checks/:slug*",children:(0,i.jsx)(lx,{})}),(0,i.jsx)(eI.AW,{path:"/runs/:runId",children:e=>{let{runId:n}=e;return(0,i.jsx)(lw,{runId:n})}}),(0,i.jsx)(eI.AW,{path:"/ssr",children:(0,i.jsx)(j.E,{size:"xs",isIndeterminate:!0})}),(0,i.jsx)(eI.AW,{children:(0,i.jsx)(eI.l_,{to:"/lineage"})})]})]})}),e?(0,i.jsx)(iV,{onClose:t,isSingleEnvironment:!!(null==l?void 0:l.single_env_onboarding)}):(0,i.jsx)(r.x,{})]})]})}let l0=(0,v.B1)({components:{Checkbox:lF,Tooltip:lN}});function l1(){(0,b.useLayoutEffect)(()=>{!function(){let e=function(e){let n=document.cookie.match("(^|;)\\s*"+e+"\\s*=\\s*([^;]+)");return n?n.pop():""}("recce_user_id"),n="b1ea2155354b7e1e41981715f16599f2";if(e&&n)try{el.S1(n,e,{defaultTracking:!0})}catch(e){console.error(e)}}()},[]);let e=(0,ly.Z)({components:{MuiTooltip:{styleOverrides:{tooltip:{zIndex:1500}}}}});return(0,i.jsx)(lb.Z,{theme:e,children:(0,i.jsx)(y.x,{theme:l0,children:(0,i.jsx)(k.aH,{client:J,children:(0,i.jsx)(eI.F0,{hook:lv,children:(0,i.jsx)(tn,{children:(0,i.jsxs)(d.k,{direction:"column",height:"100vh",overflow:"hidden",children:[(0,i.jsx)(lX,{}),(0,i.jsx)(lY,{}),(0,i.jsx)(lR,{}),(0,i.jsx)(l$,{})]})})})})})})}},80401:function(){},95586:function(){},86026:function(){},5673:function(){}},function(e){e.O(0,[491,266,517,678,509,648,989,147,995,739,283,303,22,25,355,495,599,971,269,37,783,744],function(){return e(e.s=97756)}),_N_E=e.O()}]);