recce-nightly 1.11.0.20250707a0__py3-none-any.whl → 1.11.0.20250708__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.
- recce/VERSION +1 -1
- recce/adapter/dbt_adapter/__init__.py +2 -2
- recce/cli.py +67 -59
- recce/data/404.html +1 -1
- recce/data/_next/static/L_GMfqmQNYzCO_95xuR_2/_buildManifest.js +1 -0
- recce/data/_next/static/chunks/12f8fac4-5a9b712765c49490.js +1 -0
- recce/data/_next/static/chunks/1951f239-0241698734729feb.js +1 -0
- recce/data/_next/static/chunks/1fc34c47-82fea75ece36aeed.js +1 -0
- recce/data/_next/static/chunks/33b75b42-057fbed319bd1e6b.js +1 -0
- recce/data/_next/static/chunks/36904ce4-556a624bb4305989.js +1 -0
- recce/data/_next/static/chunks/36f8eb77-7957147ce71df457.js +1 -0
- recce/data/_next/static/chunks/3739d5bc-1bdeed94256dfc05.js +1 -0
- recce/data/_next/static/chunks/3a92ee20-e14378a23f57b1c3.js +1 -0
- recce/data/_next/static/chunks/3f731c04-d29a1970ca672613.js +1 -0
- recce/data/_next/static/chunks/4352e4e9-b354cf97a03b69cf.js +1 -0
- recce/data/_next/static/chunks/488-74d3038680fbbbd1.js +30 -0
- recce/data/_next/static/chunks/512-5f44b9448f104530.js +10 -0
- recce/data/_next/static/chunks/52624530-92723350d55063d5.js +1 -0
- recce/data/_next/static/chunks/5398b9db-a2a70e696dd5f7eb.js +1 -0
- recce/data/_next/static/chunks/583-bafc31cf92748715.js +1 -0
- recce/data/_next/static/chunks/63d31579-c7b10c9ffd8cfa20.js +1 -0
- recce/data/_next/static/chunks/6dc81886-9e4dc40a4c3662f1.js +1 -0
- recce/data/_next/static/chunks/730580eb-2f3a1f2509dc4e9c.js +1 -0
- recce/data/_next/static/chunks/88-b883a8f747db27b5.js +1 -0
- recce/data/_next/static/chunks/8d700b6a.e1488f49ec200d5b.js +1 -0
- recce/data/_next/static/chunks/ae307f12-b81cf34ec2084e0b.js +1 -0
- recce/data/_next/static/chunks/app/_not-found/page-f3d6d0887e2475a0.js +1 -0
- recce/data/_next/static/chunks/app/layout-aa349a34c05b8677.js +1 -0
- recce/data/_next/static/chunks/app/page-e7d0a50c2a7f36f6.js +1 -0
- recce/data/_next/static/chunks/c99dd624-aef946c4a087bc18.js +1 -0
- recce/data/_next/static/chunks/e308e2c0-3ab2fec387e5a04d.js +60 -0
- recce/data/_next/static/chunks/f1534c21-7c58efd12c5442ed.js +1 -0
- recce/data/_next/static/chunks/f81b4f07-a63a38c7ac3e2a77.js +1 -0
- recce/data/_next/static/chunks/framework-df522b11ac1052ec.js +1 -0
- recce/data/_next/static/chunks/main-6299a1c4ed293833.js +1 -0
- recce/data/_next/static/chunks/main-app-c7ffd6202921169c.js +1 -0
- recce/data/_next/static/chunks/pages/_app-9fd2d2c392ecd7a0.js +1 -0
- recce/data/_next/static/chunks/pages/_error-af159da794d1fa6d.js +1 -0
- recce/data/_next/static/chunks/webpack-b5a9818d6d67641f.js +1 -0
- recce/data/_next/static/css/2d0bc492ccebdbed.css +14 -0
- recce/data/_next/static/css/abdb9814a3dd18bb.css +1 -0
- recce/data/_next/static/css/c21263c1520b615b.css +1 -0
- recce/data/index.html +1 -1
- recce/data/index.txt +26 -8
- recce/event/collector.py +3 -1
- recce/server.py +37 -0
- {recce_nightly-1.11.0.20250707a0.dist-info → recce_nightly-1.11.0.20250708.dist-info}/METADATA +1 -1
- {recce_nightly-1.11.0.20250707a0.dist-info → recce_nightly-1.11.0.20250708.dist-info}/RECORD +53 -53
- recce/data/_next/static/9RP6um04jTPfW30JjpSAT/_buildManifest.js +0 -1
- recce/data/_next/static/chunks/12f8fac4-bfd9db49d424e3b6.js +0 -1
- recce/data/_next/static/chunks/1f4e3603-31f082bb8b20c62b.js +0 -1
- recce/data/_next/static/chunks/217-f44c1290f0369ddb.js +0 -2
- recce/data/_next/static/chunks/2689e558-7cc40697c77a806d.js +0 -1
- recce/data/_next/static/chunks/290-d0241c33eb0d7da1.js +0 -1
- recce/data/_next/static/chunks/29469774-efff969bcb61f064.js +0 -1
- recce/data/_next/static/chunks/3a92ee20-1081c360214f9602.js +0 -1
- recce/data/_next/static/chunks/3aece8b2-ac0acf1f9e6998dc.js +0 -1
- recce/data/_next/static/chunks/44627ff4-5b5f27c3fb1e29c6.js +0 -54
- recce/data/_next/static/chunks/6dc81886-adbfa45836061d79.js +0 -1
- recce/data/_next/static/chunks/8051d68c-47a268b639f37e90.js +0 -1
- recce/data/_next/static/chunks/810-f810a21d6ce1d5d1.js +0 -30
- recce/data/_next/static/chunks/841-3906c64bad7dfbe6.js +0 -10
- recce/data/_next/static/chunks/86730205-9a51d2ae7a6fccfd.js +0 -1
- recce/data/_next/static/chunks/8d700b6a.8bb140898499c512.js +0 -1
- recce/data/_next/static/chunks/9185059b-4aa97f7ef9600bff.js +0 -1
- recce/data/_next/static/chunks/94fe57b7-1e4a8aaff33d2190.js +0 -1
- recce/data/_next/static/chunks/9e4386a5-a179d31f5749a6ca.js +0 -1
- recce/data/_next/static/chunks/a2430784-33c3bbed35bad750.js +0 -1
- recce/data/_next/static/chunks/a57d9bf0-d5f1ef5880127ec7.js +0 -1
- recce/data/_next/static/chunks/ae307f12-fe8b68112b2096ab.js +0 -1
- recce/data/_next/static/chunks/app/_not-found/page-966ef938df37b7a8.js +0 -1
- recce/data/_next/static/chunks/app/layout-eb2419321b588d21.js +0 -1
- recce/data/_next/static/chunks/app/page-53100cf1381ab510.js +0 -1
- recce/data/_next/static/chunks/bbda5537-347ee468fb057748.js +0 -1
- recce/data/_next/static/chunks/c964bf81-9daa5d4b9b198dc2.js +0 -1
- recce/data/_next/static/chunks/ca9a4ea3-e63067487eceade5.js +0 -1
- recce/data/_next/static/chunks/da39ef8e-007ac1e7b9a02013.js +0 -1
- recce/data/_next/static/chunks/framework-ded83d71b51ce901.js +0 -1
- recce/data/_next/static/chunks/main-app-39061b0166c47f55.js +0 -1
- recce/data/_next/static/chunks/main-b5b3ae20a1405261.js +0 -1
- recce/data/_next/static/chunks/pages/_app-437c455677d62394.js +0 -1
- recce/data/_next/static/chunks/pages/_error-e7650df18ca04bde.js +0 -1
- recce/data/_next/static/chunks/webpack-bfc38373da122a44.js +0 -1
- recce/data/_next/static/css/17a96168e3a9db13.css +0 -1
- recce/data/_next/static/css/53e95329e874e996.css +0 -14
- recce/data/_next/static/css/8cad5bf143ce2c8e.css +0 -1
- /recce/data/_next/static/{9RP6um04jTPfW30JjpSAT → L_GMfqmQNYzCO_95xuR_2}/_ssgManifest.js +0 -0
- {recce_nightly-1.11.0.20250707a0.dist-info → recce_nightly-1.11.0.20250708.dist-info}/WHEEL +0 -0
- {recce_nightly-1.11.0.20250707a0.dist-info → recce_nightly-1.11.0.20250708.dist-info}/entry_points.txt +0 -0
- {recce_nightly-1.11.0.20250707a0.dist-info → recce_nightly-1.11.0.20250708.dist-info}/licenses/LICENSE +0 -0
- {recce_nightly-1.11.0.20250707a0.dist-info → recce_nightly-1.11.0.20250708.dist-info}/top_level.txt +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{48614:function(e,n,i){Promise.resolve().then(i.bind(i,59518))},59518:function(e,n,i){"use strict";i.r(n),i.d(n,{default:function(){return tz}});var t=i(26415),l=i(64899),r=i(67327),o=i(60799),s=i(96748),a=i(53832),c=i(88387),d=i(46957),u=i(40083),h=i(36911),x=i(65018),p=i(47585),m=i(85797),f=i(97129),j=i(89981),g=i(63003);i(50758);var v=i(94725),y=i(88894);async function b(e,n){let i=(0,y.rM)()?{breaking_change_analysis:!0}:{};return(await g.U.post("/api/checks",{run_id:e,view_options:n,track_props:i})).data}async function w(){return(await g.U.get("/api/checks")).data}async function k(e){return(await g.U.get("/api/checks/".concat(e))).data}async function C(e,n){return(await g.U.patch("/api/checks/".concat(e),n)).data}async function _(e){return(await g.U.delete("/api/checks/".concat(e))).data}async function S(e){return await g.U.post("/api/checks/reorder",e)}var z=i(43213),R=i(11827),N=i(43098),D=i(15981),F=i(32630),q=i(75528),I=i(34380),E=i(95203),P=i(66927),T=i(11593),L=i(95014),O=i(50519),M=i(23539),A=i(23519),J=i(90073),V=i(91687),K=i(13307),H=i(80690);function U(e){let{name:n,setName:i}=e,[r,o]=(0,f.useState)(!1),[s,a]=(0,f.useState)(n),c=(0,f.useRef)(null),d=(0,f.useCallback)(()=>{i(s),o(!1)},[i,o,s]);return(0,f.useEffect)(()=>{let e=e=>{c.current&&!c.current.contains(e.target)&&d()};return r&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[r,c,d]),(0,t.jsx)(K.cD,{flex:"0 1 auto",fontSize:"12pt",fontWeight:"500",className:"no-track-pii-safe",overflow:"hidden",children:(0,t.jsx)(K.gN,{cursor:"pointer",flex:"0 1 auto",overflow:"hidden",children:r?(0,t.jsx)(H.I,{ref:c,value:s,onChange:e=>{a(e.target.value)},onKeyDown:e=>{"Enter"===e.key?(i(s),o(!1)):"Escape"===e.key&&(a(n),o(!1))},size:"sm",w:"100%"}):(0,t.jsx)(l.x,{flex:"0 1 auto",onClick:()=>{a(n),o(!0)},textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:n})})})}var W=i(39274),Z=i(81687),$=i(99570),B=i(19692),Q=i(56199);i(28350);var X=i(22363),G=i(22952),Y=i(31294),ee=i(65374);let en=(0,f.createContext)(void 0),ei=()=>{let e=(0,f.useContext)(en);if(!e)throw Error("useLineageViewContext must be used within a LineageViewProvider");return e},et=()=>(0,f.useContext)(en);var el=i(94643);function er(e){let{model:n,row:i,singleEnv:r,cllRunning:s}=e,a=et(),{runAction:d}=(0,X.$q)(),{readOnly:u}=(0,ee.$)(),{name:h,baseType:p,currentType:m,baseIndex:f,currentIndex:j}=i,g=null!=m?m:p,v=!p||!m;return(0,t.jsx)(el.u,{content:"View column lineage",positioning:{placement:"top"},showArrow:!0,disabled:void 0===a||void 0!==f&&void 0===j,children:(0,t.jsxs)(c.k,{alignItems:"center",gap:"3px",children:[(0,t.jsx)(l.x,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:h}),(0,t.jsx)(x.L,{}),s&&(0,t.jsx)(G.$,{size:"xs",color:"gray.400"}),!r&&"source"!==n.resource_type&&(0,t.jsxs)(E.ZB,{children:[(0,t.jsx)(E.bF,{asChild:!0,children:(0,t.jsx)(P.h,{display:"flex",className:"row-context-menu",variant:"plain",size:"sm",color:"gray",_hover:{color:"black"},disabled:u,onClick:e=>{e.stopPropagation()},children:(0,t.jsx)(o.J,{as:W.D_A})})}),(0,t.jsx)(T.h,{children:(0,t.jsx)(E.Ku,{children:(0,t.jsx)(E.Dv,{lineHeight:"20px",children:(0,t.jsxs)(E.GP,{title:"Diff",m:"0",p:"4px 12px",children:[(0,t.jsx)(E.sN,{value:"profile-diff",fontSize:"10pt",onClick:()=>{d("profile_diff",{model:n.name,columns:[h]},{showForm:!1})},disabled:v,children:"Profile Diff"}),(0,t.jsx)(E.sN,{value:"histogram-diff",fontSize:"10pt",onClick:()=>{d("histogram_diff",{model:n.name,column_name:h,column_type:g},{showForm:!1})},disabled:v||!g||!(0,Y.d)(g),children:"Histogram Diff"}),(0,t.jsx)(E.sN,{value:"top-k-diff",fontSize:"10pt",onClick:()=>{d("top_k_diff",{model:n.name,column_name:h,k:50},{showForm:!1})},disabled:v,children:"Top-k Diff"})]})})})})]})]})})}function eo(e,n,i){function l(e){return void 0!==e.baseIndex&&void 0!==e.currentIndex&&!0===e.reordered?"column-index-reordered schema-column schema-column-index":"schema-column schema-column-index"}function r(e){return void 0!==e.baseIndex&&void 0!==e.currentIndex&&e.baseType!==e.currentType?"column-body-type-changed schema-column":"schema-column"}return{columns:[{key:"baseIndex",name:"",resizable:!0,minWidth:35,width:35,cellClass:l},{key:"currentIndex",name:"",resizable:!0,minWidth:35,width:35,cellClass:l},{key:"name",name:"Name",resizable:!0,renderCell:e=>{var l;let{row:r,column:o}=e;return n?(0,t.jsx)(er,{model:n,row:r,cllRunning:null!==(l=null==i?void 0:i.get(r.name))&&void 0!==l&&l}):r.name},cellClass:function(){return"schema-column"}},{key:"baseType",name:"Base Type",resizable:!0,cellClass:r},{key:"currentType",name:"Current Type",resizable:!0,cellClass:r}],rows:Object.values(e)}}var es=i(77065),ea=i(85658);let ec=(0,f.forwardRef)(function(e,n){let i,l,{base:r,current:o,enableScreenshot:s=!1}=e,a=et(),[d,u]=(0,f.useState)(new Map),{columns:h,rows:x}=(0,f.useMemo)(()=>{var e;let n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i={};return Object.entries((0,Q.Z)(Object.keys(e),Object.keys(n))).forEach(e=>{let[n,t]=e;i[n]={name:n,reordered:"reordered"===t}}),Object.entries(e).map((e,n)=>{let[t,l]=e;i[t].baseIndex=n+1,i[t].baseType=l.type}),Object.entries(n).map((e,n)=>{let[t,l]=e;i[t].currentIndex=n+1,i[t].currentType=l.type}),i}(null==r?void 0:r.columns,null==o?void 0:o.columns),i=null!==(e=null==o?void 0:o.resource_type)&&void 0!==e?e:null==r?void 0:r.resource_type;return i&&["model","seed","snapshot","source"].includes(i)?eo(n,null!=o?o:r,d):eo(n)},[r,o,d]),{lineageGraph:p}=(0,B.kJ)(),m=!(null==p?void 0:p.catalogMetadata.base),j=!(null==p?void 0:p.catalogMetadata.current);m&&j?i="catalog.json not found on both environments. Run `recce debug` to troubleshoot.":m?i="catalog.json not found on base environment. Run `recce debug` to troubleshoot.":j&&(i="catalog.json not found on current environment. Run `recce debug` to troubleshoot.");let g=r&&void 0===r.columns,v=o&&void 0===o.columns;g&&v?l="catalog.json is outdated on both environments. Update catalog.json to get schema information.":g?l="catalog.json is outdated on base environment. Update catalog.json to get schema information.":v&&(l="catalog.json is outdated on current environment. Update catalog.json to get schema information.");let b=async e=>{var n;(0,y.KB)({action:"view",source:"schema_column"}),u(n=>new Map(n).set(e,!0));let i=null!==(n=null==o?void 0:o.id)&&void 0!==n?n:null==r?void 0:r.id;i&&await (null==a?void 0:a.showColumnLevelLineage({node_id:i,column:e})),u(n=>new Map(n).set(e,!1))},w=null==a?void 0:a.viewOptions.column_level_lineage,k=w?new Set(["".concat(w.node_id,"-").concat(w.column)]):new Set;return(0,t.jsxs)(c.k,{direction:"column",children:[i?(0,t.jsxs)(es.xE,{status:"warning",fontSize:"12px",p:"8px",children:[(0,t.jsx)(es.xX,{}),(0,t.jsx)(es.X,{children:i})]}):l?(0,t.jsxs)(es.xE,{status:"warning",fontSize:"12px",p:"8px",children:[(0,t.jsx)(es.xX,{}),(0,t.jsx)(es.X,{children:l})]}):(0,t.jsx)(t.Fragment,{}),x.length>0&&(0,t.jsx)(ea.o,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"0.8rem",borderWidth:1},columns:h,rows:x,rowHeight:35,renderers:{noRowsFallback:(0,t.jsx)(ea.W,{})},className:"rdg-light no-track-pii-safe",ref:n,rowKeyGetter:e=>{var n;let i=null!==(n=null==o?void 0:o.id)&&void 0!==n?n:null==r?void 0:r.id;return"".concat(i,"-").concat(e.name)},selectedRows:k,onSelectedRowsChange:()=>{},onCellClick:async e=>{(void 0===e.row.baseIndex||void 0!==e.row.currentIndex)&&await b(e.row.name)},rowClass:e=>{let n;if(void 0===e.baseIndex)n="row-added";else{if(void 0===e.currentIndex)return"row-removed";n="row-normal"}return void 0!==a&&(n+=" row-selectable"),n}})]})}),ed=(0,f.forwardRef)(function(e,n){let i,l,{current:r}=e,o=et(),[s,a]=(0,f.useState)(new Map),{columns:d,rows:u}=(0,f.useMemo)(()=>(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,i=arguments.length>2?arguments[2]:void 0;return{columns:[{key:"index",name:"",resizable:!0,minWidth:35,width:35,cellClass:"schema-column schema-column-index"},{key:"name",name:"Name",resizable:!0,renderCell:e=>{var l;let{row:r,column:o}=e;return n?(0,t.jsx)(er,{model:n,row:r,cllRunning:null!==(l=null==i?void 0:i.get(r.name))&&void 0!==l&&l,singleEnv:!0}):r.name},cellClass:"schema-column"},{key:"type",name:"Type",resizable:!0,cellClass:"schema-column"}],rows:Object.entries(e).map((e,n)=>{let[i,t]=e;return{name:i,index:n+1,type:t.type}})}})(null==r?void 0:r.columns,r,s),[r,s]),{lineageGraph:h}=(0,B.kJ)();(null==h?void 0:h.catalogMetadata.current)||(i="catalog.json not found. Run `recce debug` to troubleshoot."),r&&void 0===r.columns&&(l="catalog.json is outdated. Update catalog.json to get schema information.");let x=async e=>{(0,y.KB)({action:"view",source:"schema_column"}),a(n=>new Map(n).set(e,!0));let n=null==r?void 0:r.id;n&&await (null==o?void 0:o.showColumnLevelLineage({node_id:n,column:e})),a(n=>new Map(n).set(e,!1))},p=null==o?void 0:o.viewOptions.column_level_lineage,m=p?new Set(["".concat(p.node_id,"-").concat(p.column)]):new Set;return(0,t.jsxs)(c.k,{direction:"column",children:[i?(0,t.jsxs)(es.xE,{status:"warning",fontSize:"12px",p:"8px",children:[(0,t.jsx)(es.xX,{}),(0,t.jsx)(es.X,{children:i})]}):l?(0,t.jsxs)(es.xE,{status:"warning",fontSize:"12px",p:"8px",children:[(0,t.jsx)(es.xX,{}),(0,t.jsx)(es.X,{children:l})]}):(0,t.jsx)(t.Fragment,{}),u.length>0&&(0,t.jsx)(ea.o,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:d,rows:u,renderers:{noRowsFallback:(0,t.jsx)(ea.W,{})},className:"rdg-light",ref:n,rowKeyGetter:e=>{let n=null==r?void 0:r.id;return"".concat(n,"-").concat(e.name)},selectedRows:m,onSelectedRowsChange:()=>{},onCellClick:async e=>{await x(e.row.name)},rowClass:()=>void 0!==o?"row-normal row-selectable":"row-normal"})]})});async function eu(e){return(await g.U.post("/api/select",e)).data}var eh=i(36550);i(84351);let ex=e=>{let{style:n,children:i,gutterSize:l=5,...r}=e;return(0,t.jsx)(eh.Z,{style:{display:"flex",flexDirection:"row",...n},direction:"horizontal",gutterSize:l,...r,children:i})},ep=e=>{let{style:n,children:i,gutterSize:l=5,...r}=e;return(0,t.jsx)(eh.Z,{style:{display:"flex",flexDirection:"column",...n},gutterSize:l,direction:"vertical",...r,children:i})};var em=i(54571),ef=i(61663),ej=i(82839),eg=i(48069);let ev=W.Nbv,ey=W.sFB,eb=W.UGs;function ew(e){return"added"===e?{color:"green.solid",hexColor:String(eg.B.token("colors.green.solid")),backgroundColor:"green.subtle",hexBackgroundColor:String(eg.B.token("colors.green.subtle")),icon:ev}:"removed"===e?{color:"red.solid",hexColor:String(eg.B.token("colors.red.solid")),backgroundColor:"red.subtle",hexBackgroundColor:String(eg.B.token("colors.red.subtle")),icon:ey}:"modified"===e?{color:"orange.emphasized",hexColor:String(eg.B.token("colors.orange.emphasized")),backgroundColor:"orange.subtle",hexBackgroundColor:String(eg.B.token("colors.orange.subtle")),icon:eb}:{color:"gray.focusRing",hexColor:String(eg.B.token("colors.gray.focusRing")),backgroundColor:"white",hexBackgroundColor:String(eg.B.token("colors.white")),icon:void 0}}function ek(e){if("model"===e)return{color:"#c0eafd",icon:ef.Fn3};if("metric"===e)return{color:"#ffe6ee",icon:ej._MV};if("source"===e)return{color:"#a6dda6",icon:ef.i1q};if("exposure"===e)return{color:"#ffe6ee",icon:ej.n8P};if("semantic_model"===e)return{color:"#fb8caf",icon:ej.R1C};if("seed"===e)return{color:"#a6dda6",icon:ef.tWi};if("snapshot"===e)return{color:"#a6dda6",icon:ef.Dmm};else return{color:"inherit",icon:void 0}}function eC(e,n){if(!e||!n)return;let i=Object.keys(e),t=Object.keys(n);if(i.length!==t.length)return!0;for(let e=0;e<i.length;e++)if(i[e]!==t[e])return!0;for(let i of t)if(!e[i]||e[i].type!==n[i].type)return!0;return!1}var e_=i(72752);let eS=e=>{let n,i,{node:r,selected:s,onSelect:a,schemaChanged:d}=e,{icon:u}=ek(r.resourceType),{base:h,current:x}=r.data;if(d){var p;n=null===(p=(0,e_.N)("schema_diff"))||void 0===p?void 0:p.icon,i=ew("modified").color}else!h&&x?(n=ew("added").icon,i=ew("added").color):h&&!x&&(n=ew("removed").icon,i=ew("removed").color);return(0,t.jsx)(em.HC,{children:(0,t.jsxs)(c.k,{width:"100%",fontSize:"10pt",p:"5px 8px",cursor:"pointer",_hover:{bg:"gray.200"},bg:s?"gray.100":"inherit",onClick:()=>{a(r.id)},alignItems:"center",gap:"5px",children:[(0,t.jsx)(o.J,{as:u}),(0,t.jsx)(l.x,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:r.name}),n&&i&&(0,t.jsx)(o.J,{as:n,color:i})]})})},ez=(0,f.forwardRef)(function(e,n){let{check:i}=e,{lineageGraph:l}=(0,B.kJ)(),r=i.params,o=[...v.V.check(i.check_id),"select"],{isLoading:s,error:a,refetch:c,data:d}=(0,j.a)({queryKey:o,queryFn:async()=>eu({select:r.select,exclude:r.exclude,packages:r.packages,view_mode:r.view_mode}),refetchOnMount:!0,enabled:!r.node_id}),[u,h]=(0,f.useMemo)(()=>{var e,n,i;let t=[],o=[],s=[],a=[];if(r.node_id)for(let e of r.node_id instanceof Array?r.node_id:[r.node_id]){let n=null==l?void 0:l.nodes[e];n&&t.push(n)}else for(let n of null!==(e=null==d?void 0:d.nodes)&&void 0!==e?e:[]){let e=null==l?void 0:l.nodes[n];e&&t.push(e)}let c=t.filter(e=>"model"===e.resourceType||"seed"===e.resourceType||"source"===e.resourceType||"snapshot"===e.resourceType);for(let e of c)eC(null===(n=e.data.base)||void 0===n?void 0:n.columns,null===(i=e.data.current)||void 0===i?void 0:i.columns)?o.push(e.id):!e.data.base&&e.data.current?s.push(e.id):e.data.base&&!e.data.current&&a.push(e.id);function u(e){return o.includes(e.id)?3:s.includes(e.id)?2:a.includes(e.id)?1:0}return c.sort((e,n)=>{let i=u(e),t=u(n);return i!==t?t-i:e.name.localeCompare(n.name)}),[c,o]},[r.node_id,null==d?void 0:d.nodes,l]),[x,p]=(0,f.useState)(0);if(s)return(0,t.jsx)(z.M,{bg:"rgb(249,249,249)",height:"100%",children:"Loading..."});if(a)return(0,t.jsxs)(z.M,{bg:"rgb(249,249,249)",height:"100%",children:["Error: ",a.message]});if(0==u.length)return(0,t.jsx)(z.M,{bg:"rgb(249,249,249)",height:"100%",children:"No nodes matched"});if(x<u.length){let e=u[x];return(0,t.jsxs)(ex,{sizes:[80,20],minSize:30,style:{height:"100%"},children:[(0,t.jsx)(ec,{base:e.data.base,current:e.data.current,enableScreenshot:!0,ref:n}),(0,t.jsx)(em.A0,{overflow:"auto",backgroundColor:"white",as:"ul",listStyle:"none",children:u.map((e,n)=>(0,t.jsx)(eS,{node:e,schemaChanged:h.includes(e.id),selected:n===x,onSelect:()=>{p(n)}},n))})]})}return(0,t.jsx)(t.Fragment,{})});var eR=i(54284),eN=i(69054);function eD(e){let{value:n,onChange:i}=e,{readOnly:l}=(0,ee.$)(),[o,s]=(0,f.useState)(!1),[a,d]=(0,f.useState)(),u=(0,f.useRef)(null),h=()=>{i&&(i(a),s(!1))};return((0,f.useEffect)(()=>{if(o&&u.current){let e=u.current;e.focus(),e.setSelectionRange(e.value.length,e.value.length)}},[o]),o)?(0,t.jsxs)(c.k,{direction:"column",align:"flex-end",height:"100%",className:"no-track-pii-safe",children:[(0,t.jsx)(eN.g,{value:a,onChange:e=>{d(e.target.value)},onKeyDown:e=>{"Escape"===e.key&&s(!1),(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),h())},ref:u,flex:1}),(0,t.jsxs)(c.k,{gap:"12px",alignItems:"flex-end",children:[(0,t.jsx)(r.r,{onClick:()=>{setTimeout(()=>{s(!1)},100)},colorPalette:"blue",children:"cancel"}),(0,t.jsx)(L.z,{mt:"8px",size:"sm",colorPalette:"blue",onClick:h,children:"Update"})]})]}):(0,t.jsx)(O.x,{className:"no-track-pii-safe",height:"100%",overflow:"auto",fontSize:"11pt",onClick:l?void 0:()=>{d(null!=n?n:""),s(!0)},whiteSpace:"pre-wrap",wordBreak:"break-word",color:n?"inherit":"lightgray",children:n||"Add description here"})}var eF=i(44482),eq=i(63959);function eI(){return{successToast:function(e){eq.m.create({description:e,type:"info",duration:5e3,closable:!0})},failToast:function(e,n){eq.m.create({title:e,description:"".concat(n),type:"error",duration:5e3,closable:!0})}}}function eE(){let e=(0,D._)(["\n **SQL**\n ```sql\n ","\n ```\n "],["\n **SQL**\n \\`\\`\\`sql\n ","\n \\`\\`\\`\n "]);return eE=function(){return e},e}function eP(e){return e.description?e.description:"_(no description)_"}var eT=i(72891),eL=i(89535),eO=i(52416),eM=i(17127),eA=i(54492),eJ=i(49537),eV=i(64315),eK=i(50577),eH=i.n(eK),eU=i(77145);function eW(e){let n=(0,eM.D)(e);return(0,eA.WU)(n,"yyyy-MM-dd'T'HH:mm:ss")}function eZ(e){let n=(0,eM.D)(e);return(0,eJ.B)(n,new Date,{addSuffix:!0})}function e$(e){let n=new Set,i=new Set;if(null==e?void 0:e.nodes)for(let r of Object.values(e.nodes)){var t,l;(null===(t=r.data.base)||void 0===t?void 0:t.schema)&&n.add(r.data.base.schema),(null===(l=r.data.current)||void 0===l?void 0:l.schema)&&i.add(r.data.current.schema)}return[n,i]}function eB(e){return Object.values(e).every(e=>null===e)?[(0,t.jsx)(c.k,{ml:"10px",children:"No information"},"no info")]:Object.entries(e).filter(e=>{let[n,i]=e;return"url"!==n&&null!=i}).map(e=>{let[n,i]=e;return(0,t.jsxs)(em.HC,{ml:"10px",children:[n,": ",i]},n)})}function eQ(){var e,n,i,l;let{envInfo:s,reviewMode:a,lineageGraph:d}=(0,B.kJ)(),{open:h,onOpen:x,onClose:p}=(0,F.q)(),m=null==s?void 0:s.git,f=null==s?void 0:s.pullRequest,j={...m,...f},g=null==s?void 0:null===(e=s.dbt)||void 0===e?void 0:e.base,v=null==s?void 0:null===(n=s.dbt)||void 0===n?void 0:n.current,y=(null==g?void 0:g.generated_at)?eW(g.generated_at):"",b=(null==v?void 0:v.generated_at)?eW(v.generated_at):"",w="",k="";g&&(w=g.generated_at?eZ(g.generated_at):""),v&&(k=v.generated_at?eZ(v.generated_at):"");let[C,_]=e$(d);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(el.u,{content:"Environment Info",positioning:{placement:"bottom-end"},children:(0,t.jsxs)("div",{className:"flex items-center hover:cursor-pointer hover:text-black",onClick:x,children:[(0,t.jsxs)("div",{className:"hidden text-sm lg:flex lg:flex-col",children:[(0,t.jsxs)("div",{className:"flex gap-1",children:[(0,t.jsx)("span",{className:"no-track-pii-safe max-w-32 truncate",children:Array.from(C).join(", ")})," ","(",w,")"]}),(0,t.jsxs)("div",{className:"flex gap-1",children:[(0,t.jsx)("span",{className:"no-track-pii-safe max-w-32 truncate",children:Array.from(_).join(", ")})," ","(",k,")"]})]}),(0,t.jsx)(P.h,{size:"sm",variant:"plain","aria-label":"Environment Info",children:(0,t.jsx)(o.J,{verticalAlign:"middle",as:eV.aU,boxSize:"16px"})})]})}),(0,t.jsx)(q.GR,{open:h,onOpenChange:p,size:"lg",children:(0,t.jsxs)(T.h,{children:[(0,t.jsx)(q.ZR,{}),(0,t.jsx)(q.Qd,{children:(0,t.jsxs)(q.cZ,{children:[(0,t.jsx)(q.fK,{children:(0,t.jsx)(q.$N,{children:"Environment Information"})}),(0,t.jsx)(q.a7,{children:(0,t.jsxs)(c.k,{direction:"column",gap:"5px",children:[a?(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(c.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,t.jsx)(u.X,{size:"sm",children:"Review Information"}),(0,t.jsxs)(em.A0,{children:[j.url&&(0,t.jsxs)(em.HC,{ml:"10px",children:["url:"," ",(0,t.jsxs)(r.r,{href:j.url,color:"blue.500",target:"_blank",children:[j.url," ",(0,t.jsx)(eU.$OI,{})]})]}),!eH()(j)&&eB(j)]})]})}):(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(c.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,t.jsx)(u.X,{size:"sm",children:"Dev Information"}),(0,t.jsx)(em.A0,{children:m&&eB(m)})]})}),(0,t.jsx)(N.Z,{}),(null==s?void 0:s.adapterType)==="dbt"&&(0,t.jsxs)(c.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,t.jsx)(u.X,{size:"sm",children:"DBT"}),(0,t.jsx)(eO.L7,{borderWidth:"1px",height:"30rem",children:(0,t.jsxs)(eO.Ji,{size:"sm",variant:"line",stickyHeader:!0,children:[(0,t.jsx)(eO.xD,{children:(0,t.jsxs)(eO.SC,{children:[(0,t.jsx)(eO.QN,{}),(0,t.jsx)(eO.QN,{children:"base"}),(0,t.jsx)(eO.QN,{children:"current"})]})}),(0,t.jsxs)(eO.RM,{children:[(0,t.jsxs)(eO.SC,{children:[(0,t.jsx)(eO.pj,{children:"schema"}),(0,t.jsx)(eO.pj,{className:"no-track-pii-safe",children:Array.from(C).map(e=>(0,t.jsx)(el.u,{content:e,positioning:{placement:"bottom"},children:(0,t.jsx)("div",{className:"max-w-72 truncate",children:e})},e))}),(0,t.jsx)(eO.pj,{className:"no-track-pii-safe",children:Array.from(_).map(e=>(0,t.jsx)(el.u,{content:e,positioning:{placement:"bottom"},children:(0,t.jsx)("div",{className:"max-w-72 truncate",children:e})},e))})]}),(0,t.jsxs)(eO.SC,{children:[(0,t.jsx)(eO.pj,{children:"version"}),(0,t.jsx)(eO.pj,{children:null==g?void 0:g.dbt_version}),(0,t.jsx)(eO.pj,{children:null==v?void 0:v.dbt_version})]}),(0,t.jsxs)(eO.SC,{children:[(0,t.jsx)(eO.pj,{children:"timestamp"}),(0,t.jsx)(eO.pj,{children:y}),(0,t.jsx)(eO.pj,{children:b})]})]})]})})]}),(null==s?void 0:s.adapterType)==="sqlmesh"&&(0,t.jsxs)(c.k,{justifyContent:"left",gap:"5px",direction:"column",children:[(0,t.jsx)(u.X,{size:"sm",children:"SQLMesh"}),(0,t.jsx)(eO.L7,{borderWidth:"1px",height:"30rem",children:(0,t.jsxs)(eO.Ji,{variant:"line",stickyHeader:!0,children:[(0,t.jsx)(eO.xD,{children:(0,t.jsxs)(eO.SC,{children:[(0,t.jsx)(eO.QN,{}),(0,t.jsx)(eO.QN,{children:"base"}),(0,t.jsx)(eO.QN,{children:"current"})]})}),(0,t.jsx)(eO.RM,{children:(0,t.jsxs)(eO.SC,{children:[(0,t.jsx)(eO.pj,{children:"Environment"}),(0,t.jsx)(eO.pj,{className:"no-track-pii-safe",children:null===(i=s.sqlmesh)||void 0===i?void 0:i.base_env}),(0,t.jsx)(eO.pj,{className:"no-track-pii-safe",children:null===(l=s.sqlmesh)||void 0===l?void 0:l.current_env})]})})]})})]})]})}),(0,t.jsx)(q.cN,{children:(0,t.jsx)(L.z,{colorPalette:"blue",mr:3,onClick:p,children:"Close"})}),(0,t.jsx)(q.Rd,{asChild:!0,children:(0,t.jsx)(A.P,{size:"sm"})})]})})]})})]})}function eX(e){var n;let{value:i,onChange:l,onRun:r,onRunBase:o,onRunDiff:s,label:a,CustomEditor:d,options:u={},manifestData:h,schemas:p,...m}=e,{readOnly:f}=(0,ee.$)(),j="";return h&&(j=h.generated_at?eZ(h.generated_at):""),(0,t.jsxs)(t.Fragment,{children:[(null!==(n=null!=a?a:r)&&void 0!==n?n:o)&&(0,t.jsxs)(c.k,{backgroundColor:"#EDF2F880",height:"40px",minH:"40px",fontSize:"14px",align:"center",margin:"0",padding:"0px 16px",flex:"0 0 40px",children:[(0,t.jsx)(O.x,{as:"strong",children:a?a.toUpperCase():""}),h&&(0,t.jsxs)("span",{className:"ml-1",children:["(",p&&(0,t.jsxs)("span",{children:[p,", "]}),(0,t.jsx)("span",{children:j}),")"]}),(0,t.jsx)(x.L,{}),(null!=r?r:o)&&(0,t.jsxs)(L.z,{size:"xs",variant:"outline",onClick:null!=r?r:o,backgroundColor:"white",padding:"6px 12px",disabled:f,children:[(0,t.jsx)(ej.gmG,{})," Run Query"]})]}),null!=d?d:(0,t.jsx)(eL.ML,{className:"no-track-pii-safe",language:"sql",theme:"vs",value:i,onChange:e=>{void 0!==e&&l&&l(e)},onMount:(e,n)=>{r&&e.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.Enter,r),o&&e.addCommand(n.KeyMod.Alt|n.KeyCode.Enter,o),s&&e.addCommand(n.KeyMod.CtrlCmd|n.KeyMod.Shift|n.KeyCode.Enter,s)},options:{extraEditorClassName:"no-track-pii-safe",tabSize:2,fontSize:16,lineNumbers:"on",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"indent",...u}})]})}function eG(e){var n;let i,l,{value:r,baseValue:o,onChange:s,onChangeBase:a,onRun:d,onRunBase:u,onRunDiff:h,options:x={},labels:p,BaseEnvironmentSetupGuide:m,...f}=e,j=p?p[0]:"Base",g=p?p[1]:"Current",{envInfo:v,lineageGraph:y}=(0,B.kJ)();(null==v?void 0:null===(n=v.dbt)||void 0===n?void 0:n.base)&&v.dbt.current&&(i=v.dbt.base,l=v.dbt.current);let[b,w]=e$(y);return(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(c.k,{height:"100%",gap:0,children:[(0,t.jsx)(eT.K,{height:"100%",width:"50%",gap:0,borderRight:"1px",borderColor:"#D4DBE4",children:(0,t.jsx)(eX,{label:j,value:null!=o?o:"",onChange:a,onRunBase:u,options:x,CustomEditor:m,manifestData:null!=i?i:void 0,schemas:Array.from(b).join(", "),...f})}),(0,t.jsx)(eT.K,{height:"100%",width:"50%",gap:0,children:(0,t.jsx)(eX,{label:g,value:r,onChange:s,onRun:d,options:x,manifestData:null!=l?l:void 0,schemas:Array.from(w).join(", "),...f})})]})})}var eY=i(64625),e0=i(20984),e1=i(13765);let e2=(0,f.forwardRef)((e,n)=>{var i,r,o,s,a;let{isRunning:d,isAborting:u,progress:h,error:x,run:p,onCancel:m,viewOptions:f,onViewOptionsChanged:j,RunResultView:g,children:v,onExecuteRun:y}=e,b=null!==(o=null==x?void 0:null===(r=x.response)||void 0===r?void 0:null===(i=r.data)||void 0===i?void 0:i.detail)&&void 0!==o?o:null==p?void 0:p.error;if(b)return(0,t.jsxs)(es.xE,{status:"error",title:"Error: ".concat(b),children:[(0,t.jsx)(es.xX,{}),(0,t.jsxs)(es.Cd,{children:["Error: ",b]})]});if(null!=d?d:(null==p?void 0:p.status)==="running"){let e="Loading...";return(null==h?void 0:h.message)?e=h.message:(null==p?void 0:null===(s=p.progress)||void 0===s?void 0:s.message)&&(e=p.progress.message),(0,t.jsx)(z.M,{p:"16px",height:"100%",bg:"rgb(249,249,249)",children:(0,t.jsxs)(R.g,{children:[(0,t.jsxs)(c.k,{alignItems:"center",children:[(null==h?void 0:h.percentage)==null?(0,t.jsx)(e0.fS,{value:null,size:"md",mr:"8px",children:(0,t.jsx)(e0.yy,{})}):(0,t.jsx)(e0.fS,{value:100*h.percentage,size:"md",mr:"8px",children:(0,t.jsx)(e0.yy,{})}),u?(0,t.jsx)(t.Fragment,{children:"Aborting..."}):(0,t.jsx)(t.Fragment,{children:e})]}),!u&&(0,t.jsx)(L.z,{onClick:m,colorPalette:"blue",size:"sm",children:"Cancel"})]})})}if(!p)return(0,t.jsx)(z.M,{bg:"rgb(249,249,249)",height:"100%",children:"Loading..."});if(v&&g)throw Error("RunView requires either a children or a RunResultView prop, but not both.");if(!v&&!g)throw Error("RunView requires at least one of children or RunResultView prop.");return(0,t.jsxs)(l.x,{h:"100%",style:{contain:"size layout"},overflow:"auto",className:"no-track-pii-safe",children:[g&&(null!==(a=p.error)&&void 0!==a?a:p.result)&&(0,t.jsx)(e1.SV,{children:(0,t.jsx)(g,{ref:n,run:p,viewOptions:f,onViewOptionsChanged:j})}),null==v?void 0:v({run:p,viewOptions:f,onViewOptionsChanged:j})]})});var e5=i(23469),e4=i(61655),e8=i(18693),e3=i(32889),e9=i(2893),e6=i(31138),e7=i(99921);i(9602),i(53893);var ne=i(28668),nn=i(71715),ni=i(32488),nt=i(55120),nl=i(81157);function nr(e){let{node:n}=e,{icon:i}=ek(n.resourceType);return(0,t.jsx)(el.u,{showArrow:!0,content:"Type of resource",children:(0,t.jsxs)(I.Hc,{children:[i&&(0,t.jsx)(I.al,{children:(0,t.jsx)(i,{})}),(0,t.jsx)(I.Sn,{children:n.resourceType})]})})}function no(e){let{rowCount:n}=e,i=n.base,l=n.curr,r=null===n.base?"N/A":"".concat(n.base," rows"),s=null===n.curr?"N/A":"".concat(n.curr," rows");return null===i&&null===l?(0,t.jsx)(t.Fragment,{children:" Failed to load"}):null===i||null===l?(0,t.jsxs)(h.U,{children:[(0,t.jsx)(O.x,{children:r}),(0,t.jsx)(o.J,{as:nn.Rgz}),(0,t.jsx)(O.x,{children:s})]}):i===l?(0,t.jsxs)(h.U,{children:[(0,t.jsx)(O.x,{children:s}),(0,t.jsx)(o.J,{as:ni.lxc,color:"gray.500"}),(0,t.jsx)(O.x,{color:"gray.500",children:"No Change"})]}):i<l?(0,t.jsxs)(h.U,{children:[(0,t.jsx)(O.x,{children:s}),(0,t.jsx)(o.J,{as:ni.Tvk,color:"green.500"}),(0,t.jsx)(O.x,{color:"green.500",children:(0,nt.T)(i,l)})]}):(0,t.jsxs)(h.U,{children:[(0,t.jsx)(O.x,{children:s}),(0,t.jsx)(o.J,{as:ni.ebp,color:"red.500"}),(0,t.jsx)(O.x,{color:"red.500",children:(0,nt.T)(i,l)})]})}function ns(e){var n,i;let{rowCount:l,node:r,onRefresh:o,isFetching:s}=e,{readOnly:a}=(0,ee.$)(),{runsAggregated:d}=(0,B.kJ)(),u=null==d?void 0:null===(n=d[r.id])||void 0===n?void 0:n.row_count_diff.result,h=null===(i=(0,e_.N)("row_count_diff"))||void 0===i?void 0:i.icon,[x,p]=(0,f.useState)(),[m,j]=(0,f.useState)("");return(0,f.useEffect)(()=>{let e=null!=l?l:u;if(e){var n,i;let t=null!==(n=e.base)&&void 0!==n?n:"N/A",l=null!==(i=e.curr)&&void 0!==i?i:"N/A";j("".concat(t," -> ").concat(l," rows")),p(e)}},[l,u]),(0,t.jsx)(el.u,{content:m,children:(0,t.jsx)(I.Hc,{asChild:!0,children:(0,t.jsx)(O.x,{fontSize:"xs",children:(0,t.jsxs)(c.k,{direction:"row",alignItems:"center",gap:"1",children:[h&&(0,t.jsx)(h,{}),null!=x||s?(0,t.jsx)(ne.N2,{loading:!1,noOfLines:1,minWidth:"30px",children:null!=x?(0,t.jsx)(no,{rowCount:x}):"row count"}):(0,t.jsx)("span",{children:"row count"}),o&&(0,t.jsx)(P.h,{loading:s,"aria-label":"Query Row Count",size:"2xs",p:"0",variant:"ghost",onClick:o,disabled:a,children:(0,t.jsx)(nl.JXV,{})})]})})})})}function na(e){var n,i,l;let r,{rowCount:o,node:s,onRefresh:a,isFetching:c}=e,{runsAggregated:d,refetchRunsAggregated:u}=(0,B.kJ)(),h=null==d?void 0:null===(n=d[s.id])||void 0===n?void 0:n.row_count.result,x=null===(i=(0,e_.N)("row_count"))||void 0===i?void 0:i.icon,p=null!=o?o:h;if(p){let e=null!==(l=p.curr)&&void 0!==l?l:"N/A";r="".concat(e," rows")}return(0,t.jsxs)(I.Hc,{children:[x&&(0,t.jsx)(I.al,{children:(0,t.jsx)(x,{})}),(0,t.jsx)(I.Sn,{children:p||c?(0,t.jsx)(ne.N2,{loading:c,lineClamp:1,height:2,minWidth:"30px",children:p?"".concat(r):"row count"}):(0,t.jsx)(t.Fragment,{children:"row count"})}),a&&(0,t.jsx)(I.qA,{children:(0,t.jsx)(P.h,{loading:c,"aria-label":"Query Row Count",size:"xs",onClick:a,disabled:"base"===s.from,children:(0,t.jsx)(nl.JXV,{})})})]})}let nc=e=>{let{node:n,action:i}=e,{status:r,skipReason:o,run:s}=i;if("pending"===r)return(0,t.jsx)(e0.fS,{value:0,size:"xs",children:(0,t.jsxs)(e0.yy,{children:[(0,t.jsx)(e0._y,{}),(0,t.jsx)(e0._1,{})]})});if("skipped"===r)return(0,t.jsx)(I.Hc,{backgroundColor:"gray.100",children:(0,t.jsx)(I.Sn,{children:(0,t.jsxs)(c.k,{fontSize:"10pt",color:"gray.500",alignItems:"center",gap:"3px",children:[(0,t.jsx)(l.x,{children:"Skipped"}),o&&(0,t.jsx)(el.u,{content:o,children:(0,t.jsx)(nl.yZ7,{})})]})})});if(!s)return(0,t.jsx)(e0.fS,{value:null,size:"xs",children:(0,t.jsxs)(e0.yy,{children:[(0,t.jsx)(e0._y,{}),(0,t.jsx)(e0._1,{})]})});let{error:a,result:d,run_id:u,progress:h}=s;if("running"===r)return(null==h?void 0:h.percentage)===void 0?(0,t.jsx)(e0.fS,{value:null,size:"xs",children:(0,t.jsxs)(e0.yy,{children:[(0,t.jsx)(e0._y,{}),(0,t.jsx)(e0._1,{})]})}):(0,t.jsx)(e0.fS,{value:100*h.percentage,size:"xs",children:(0,t.jsxs)(e0.yy,{children:[(0,t.jsx)(e0._y,{}),(0,t.jsx)(e0._1,{})]})});if(a)return(0,t.jsxs)(c.k,{fontSize:"10pt",color:"gray",children:[(0,t.jsx)(l.x,{children:"Error"}),o&&(0,t.jsx)(el.u,{content:a,children:(0,t.jsx)(nl.HgG,{})})]});if("value_diff"===s.type){let e=0;for(let n of d.data.data)n[2]<1&&e++;return(0,t.jsx)(I.Hc,{backgroundColor:e>0?"red.100":"green.100",children:(0,t.jsx)(I.Sn,{children:(0,t.jsx)(c.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"===s.type){let e=s.result;return(0,t.jsx)(ns,{rowCount:e[n.name],node:n})}if("row_count"===s.type){let e=s.result;return(0,t.jsx)(na,{rowCount:e[n.name],node:n})}return(0,t.jsx)(t.Fragment,{children:u})};function nd(e){var n;let i,l,{rowCount:r}=e,s=r.base,a=r.curr,d=null===r.base?"N/A":"".concat(r.base," Rows"),u=null===r.curr?"N/A":"".concat(r.curr," Rows");return null===s&&null===a?(i="Failed to load",l="gray"):null===s||null===a?(i="".concat(d," -> ").concat(u),l=null===s?"green":"red"):s===a?(i="=",l="gray"):s!==a&&(i="".concat((0,nt.T)(s,a)," Rows"),l=s<a?"green":"red"),(0,t.jsx)(I.Hc,{colorPalette:l,children:(0,t.jsxs)(c.k,{gap:1,alignItems:"center",children:[(0,t.jsx)(o.J,{as:null===(n=(0,e_.N)("row_count_diff"))||void 0===n?void 0:n.icon}),(0,t.jsx)(I.Sn,{children:i})]})})}let nu={breaking:"Breaking",non_breaking:"Non Breaking",partial_breaking:"Partial Breaking",unknown:"Unknown"},nh=e=>{var n;let i,r,{id:s,inverted:a}=e,{lineageGraph:d,runsAggregated:u}=(0,B.kJ)(),h=null==u?void 0:u[s],p=null==d?void 0:d.nodes[s];if(!h&&!p)return(0,t.jsx)(t.Fragment,{});if((null==p?void 0:p.data.base)&&p.data.current&&(i=eC(p.data.base.columns,p.data.current.columns)),null==h?void 0:h.row_count_diff){let e=h.row_count_diff;r=e.result.curr!==e.result.base}let m=a?"white":ew("modified").color;return(0,t.jsxs)(c.k,{flex:"1",children:[void 0!==i&&(0,t.jsx)(el.u,{content:"Schema (".concat(i?"changed":"no change",")"),openDelay:500,children:(0,t.jsx)(l.x,{height:"16px",children:(0,t.jsx)(o.J,{as:null===(n=(0,e_.N)("schema_diff"))||void 0===n?void 0:n.icon,color:i?m:a?"gray":"gray.100"})})}),(0,t.jsx)(x.L,{}),(null==h?void 0:h.row_count_diff)&&void 0!==r&&(0,t.jsx)(el.u,{content:"Row count (".concat(r?"changed":"=",")"),openDelay:500,children:(0,t.jsx)(l.x,{children:(0,t.jsx)(nd,{rowCount:h.row_count_diff.result})})})]})},nx=e=>{let{checked:n,onClick:i}=e;return(0,t.jsx)(c.k,{onClick:i,alignSelf:"center",alignItems:"center",cursor:"pointer",children:n?(0,t.jsx)(o.J,{boxSize:"20px",as:ef.xik}):(0,t.jsx)(o.J,{boxSize:"20px",as:ef.hGI})})},np=e=>{let{name:n,color:i,resourceType:r}=e;return(0,t.jsx)(l.x,{flex:"1",color:i,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:(0,t.jsx)(el.u,{content:"model"===r?n:"".concat(n," (").concat(r,")"),positioning:{placement:"top"},children:(0,t.jsx)(t.Fragment,{children:n})})})};var nm=i(43933),nf=i(89884),nj=i(78933);async function ng(e){return(await g.U.post("/api/checks",{type:"schema_diff",params:e})).data}let nv={add_or_remove:"Unavailable for added or removed resources."};var ny=i(43172);let nb=e=>{var n;let[i,t]=(0,f.useState)(!1),[l,r]=(0,f.useState)(!1),[,o]=(0,B.P)(),{error:s,data:a}=(0,j.a)({queryKey:v.V.run(null!=e?e:""),queryFn:async()=>(0,eY.Qp)(null!=e?e:"",i?2:0),enabled:!!e,refetchInterval:!!i&&50,retry:!1});(0,f.useEffect)(()=>{(s||(null==a?void 0:a.result)||(null==a?void 0:a.error))&&(i&&t(!1),((null==a?void 0:a.type)==="row_count_diff"||(null==a?void 0:a.type)==="row_count")&&o()),(null==a?void 0:a.status)==="running"&&t(!0)},[a,s,i,o]);let c=(0,f.useCallback)(async()=>{r(!0),e&&await (0,eY.Eg)(e)},[e,r]),d=(null==a?void 0:a.type)?null===(n=(0,e_.N)(a.type))||void 0===n?void 0:n.RunResultView:void 0;return{run:a,isRunning:i,aborting:l,error:s,onCancel:c,RunResultView:d}};var nw=i(62717),nk=i(19775),nC=i.n(nk),n_=i(62155),nS=i(8939),nz=i.n(nS);let nR="ignore-screenshot";function nN(e){let{renderLibrary:n="html2canvas",imageType:i="png",backgroundColor:l=null,boardEffect:r=!0,shadowEffect:o=!1,borderStyle:s="solid 1px #ccc",borderRadius:a="10px",onSuccess:u,onError:h,ignoreElements:x}=e,[p,m]=(0,f.useState)("idle"),j=(0,f.useRef)(null),{onOpen:g,setImgBlob:v,ImageDownloadModal:y}=function(){let{open:e,onOpen:n,onClose:i}=(0,F.q)(),[l,r]=(0,f.useState)();return{onOpen:n,setImgBlob:r,ImageDownloadModal:function(){let[n,r]=(0,f.useState)();return(0,f.useEffect)(()=>{if(!l)return;let e=new FileReader;e.readAsDataURL(l),e.onloadend=e=>{var n;(null===(n=e.target)||void 0===n?void 0:n.result)!=null&&r(e.target.result)}},[r]),(0,t.jsx)(q.GR,{size:"xl",open:e,onOpenChange:i,children:(0,t.jsxs)(T.h,{children:[(0,t.jsx)(q.ZR,{}),(0,t.jsx)(q.Qd,{children:(0,t.jsxs)(q.cZ,{children:[(0,t.jsx)(q.fK,{children:(0,t.jsx)(q.$N,{children:"Screenshot Preview"})}),(0,t.jsxs)(q.a7,{children:[(0,t.jsxs)(c.k,{px:"10px",gap:"10px",direction:"column",children:[(0,t.jsxs)(c.k,{alignItems:"center",gap:"5px",children:[(0,t.jsx)(nl.yZ7,{color:"red.600"}),(0,t.jsx)(O.x,{fontWeight:"500",display:"inline",children:"Copy to the Clipboard"})," ","is not supported in the current browser"]}),(0,t.jsx)(O.x,{children:"Please download it directly"})]}),(0,t.jsx)(d.E,{src:n,alt:"screenshot"})]}),(0,t.jsxs)(q.cN,{children:[(0,t.jsx)(L.z,{mr:3,onClick:i,children:"Close"}),(0,t.jsx)(L.z,{colorPalette:"blue",onClick:()=>{if(!l)return;let e=new Date,n="recce-screenshot-".concat((0,eA.WU)(e,"yyyy-MM-dd-HH-mm-ss"),".png");nz()(l,n),i()},children:"Download"})]}),(0,t.jsx)(q.Rd,{asChild:!0,children:(0,t.jsx)(A.P,{size:"sm"})})]})})]})})}}}(),b=async()=>{var e,i;if(!j.current)throw console.error("No node to use for screenshot"),Error("No node to use for screenshot");let t=null!==(e=j.current.element)&&void 0!==e?e:j.current,c=t.style.overflow,d=t.style.border,u=t.style.borderRadius,h=t.style.backgroundColor,p=t.style.height;try{t.style.overflow="hidden",t.style.border=r?s:"",t.style.borderRadius=r?a:"",t.style.backgroundColor=null!=l?l:"",t.style.height="".concat(String(t.offsetHeight),"px");let e=document.createElement("style");document.head.appendChild(e),null===(i=e.sheet)||void 0===i||i.insertRule("body > div:last-child img { display: inline-block; }"),m("loading");let c="html2canvas"===n?await nC()(t,{logging:!1,backgroundColor:null,ignoreElements:x}):await (0,n_.rT)(t,{filter:x?e=>!x(e):void 0});e.remove();let d=o?document.createElement("canvas"):c;if(o){d.width=c.width+80,d.height=c.height+80;let e=d.getContext("2d");if(e)e.shadowColor="rgba(0, 0, 0, 0.5)",e.shadowBlur=20,e.shadowOffsetX=10,e.shadowOffsetY=10,e.drawImage(c,40,40);else throw console.error("Error getting canvas context"),Error("Error getting canvas context to add shadow effect")}let u=await fetch(d.toDataURL());return await u.blob()}catch(e){throw console.error("Error converting to image",e),e}finally{t.style.overflow=c,t.style.border=d,t.style.borderRadius=u,t.style.backgroundColor=h,t.style.height=p}};return{status:p,isLoading:"loading"===p,isErrored:"error"===p,isSuccess:"success"===p,copyToClipboard:async()=>{try{await navigator.clipboard.write([new ClipboardItem({["image/".concat(i)]:b()})]),m("success"),u&&u()}catch(e){"ClipboardItem is not defined"===e.message?(v(await b()),g(),m("success")):(m("error"),console.error("Error copying to clipboard",e),h&&h(e))}},ImageDownloadModal:y,ref:j}}function nD(e){var n;let{successToast:i,failToast:l}=eI(),{isLoading:r,copyToClipboard:o,ImageDownloadModal:s,ref:a}=nN({imageType:"png",shadowEffect:!0,backgroundColor:null!==(n=null==e?void 0:e.backgroundColor)&&void 0!==n?n:null,onSuccess:()=>{i("Copied the query result as an image to clipboard")},onError:e=>{console.error("Error taking screenshot",e),l("Failed to copy image to clipboard",e)}}),c=(0,f.useCallback)(()=>{if(a.current){var e;let n=null!==(e=a.current.element)&&void 0!==e?e:a.current;n.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",n.style.transition="box-shadow 0.5s ease-in-out"}},[a]),d=(0,f.useCallback)(()=>{if(a.current){var e;(null!==(e=a.current.element)&&void 0!==e?e:a.current).style.boxShadow=""}},[a]),u=(0,f.useCallback)(async()=>{if(a.current){var e;await o(),(null!==(e=a.current.element)&&void 0!==e?e:a.current).style.boxShadow=""}else l("Failed to copy image to clipboard","No content to copy")},[a,o,l]);return{ref:a,CopyToClipboardButton:function(e){let{imageType:n="png",...i}=e;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(L.z,{size:"sm",style:{position:"absolute",bottom:"16px",right:"16px"},loading:r,onMouseEnter:c,onMouseLeave:d,onClick:u,children:[(0,t.jsx)(nl.j90,{})," Copy to Clipboard"]}),(0,t.jsx)(s,{})]})},onMouseEnter:c,onMouseLeave:d,onCopyToClipboard:u}}function nF(e){let n=new Date,i=new Date;return(i.setDate(n.getDate()-1),null==e)?null:n.toDateString()===e.toDateString()?"Today, "+(0,eA.WU)(e,"HH:mm"):i.toDateString()===e.toDateString()?"Yesterday, "+(0,eA.WU)(e,"HH:mm"):(0,eA.WU)(e,"MMM d, HH:mm")}let nq=e=>{let{run:n}=e,i="running"===n.status,l=n.status;!l&&(n.result?l="finished":n.error&&(l="failed"));let r="",o="";"successful"===l||"finished"===l?(r="green",o="Finished"):"failed"===l?(r="red",o="Failed"):"cancelled"===l?(r="gray",o="Cancelled"):"running"===l?(r="blue",o="Running"):(r="green",o="Finished");let s=n.run_at?nF(new Date(n.run_at)):null;return(0,t.jsxs)(c.k,{justifyContent:"start",fontSize:"11pt",color:"gray.500",gap:"3px",alignItems:"center",overflow:"hidden",children:[i&&(0,t.jsx)(G.$,{size:"xs",color:"".concat(r,".400")}),(0,t.jsx)(O.x,{fontWeight:500,color:"".concat(r,".400"),children:o}),(0,t.jsx)(O.x,{children:"•"}),(0,t.jsx)(O.x,{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",children:s})]})},nI=e=>{var n;return(0,t.jsxs)(c.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,t.jsx)(o.J,{as:nn.H33,width:"20px",height:"20px",color:"blue.900"}),e.children,(0,t.jsx)(x.L,{}),(0,t.jsx)(A.P,{onClick:e.onClose})]})},nE=()=>(0,t.jsxs)(r.r,{href:"https://docs.datarecce.io/get-started/#prepare-dbt-artifacts",target:"_blank",color:"rgba(49, 130, 206, 1)",fontWeight:"bold",textDecoration:"underline",children:["Learn how ",(0,t.jsx)(eU.$OI,{})]});var nP=i(86532),nT=i(34101),nL=i(23851),nO={src:"/_next/static/media/reload-image.79aabb7d.svg"};async function nM(){return(await g.U.post("/api/connect")).data}function nA(e){var n;let{handleParentClose:i,parentOpen:l=!1,ignoreCookie:r=!1}=e,{authed:o}=(0,ee.$)(),[s,a]=(0,f.useState)(l||!o),c=null!==(n=nL.Z.get("authState"))&&void 0!==n?n:"pending",[u,h]=(0,f.useState)(r?"pending":c);return"ignored"===u&&!r||o?null:(0,t.jsx)(q.GR,{size:"lg",placement:"center",lazyMount:!0,open:s,onOpenChange:e=>{a(e.open),i&&i(e.open)},children:(0,t.jsxs)(T.h,{children:[(0,t.jsx)(q.ZR,{}),(0,t.jsx)(q.Qd,{children:(0,t.jsxs)(q.cZ,{borderRadius:"2xl",children:["authenticating"!==u&&(0,t.jsx)(q.fK,{className:"text-center",fontSize:"2xl",children:"Use Recce Cloud for Free"}),"authenticating"===u&&(0,t.jsxs)(q.fK,{className:"text-center",children:[(0,t.jsx)(d.E,{className:"mx-auto mb-2",src:nO.src}),(0,t.jsx)("div",{children:"Reload to Finish"})]}),"authenticating"!==u?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(q.a7,{className:"space-y-2 font-light",children:(0,t.jsxs)("ul",{className:"list-inside list-disc",children:[(0,t.jsx)("li",{children:"Share your work with teammates, no setup needed"}),(0,t.jsx)("li",{children:"Reviewers can access it with a link."}),(0,t.jsx)("li",{children:"It’s recommended, but optional."})]})}),(0,t.jsx)(q.cN,{children:(0,t.jsxs)("div",{className:"flex w-full flex-col gap-2",children:[(0,t.jsxs)(L.z,{className:"w-full !rounded-lg !font-medium",colorPalette:"brand",onClick:async()=>{h("authenticating");let{connection_url:e}=await nM();window.open(e,"_blank")},children:["Use Recce Cloud ",(0,t.jsx)(eU.$OI,{})]}),(0,t.jsx)(q.My,{asChild:!0,children:(0,t.jsx)(L.z,{className:"!rounded-lg !font-medium",variant:"subtle",colorPalette:"gray",size:"sm",children:"Skip"})}),(0,t.jsx)(q.My,{children:(0,t.jsx)(L.z,{width:"100%",className:"!rounded-lg !font-medium !text-black",variant:"ghost",size:"sm",onClick:()=>{nL.Z.set("authState","ignored",{expires:30}),h("ignored")},children:"Snooze for 30 days"})})]})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(q.a7,{className:"space-y-2 self-center font-light",children:(0,t.jsx)("p",{children:"Reload to complete connection to Recce Cloud"})}),(0,t.jsx)(q.cN,{children:(0,t.jsx)(L.z,{className:"w-full",colorPalette:"brand",onClick:()=>{window.location.reload()},children:"Reload"})})]})]})})]})})}let nJ=e=>{let n=nw.ZP.stringify(e,null,2);return(0,t.jsx)(eL.ML,{className:"no-track-pii-safe",height:"100%",language:"yaml",theme:"vs",value:n,options:{extraEditorClassName:"no-track-pii-safe",readOnly:!0,fontSize:14,lineNumbers:"off",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"same",scrollBeyondLastLine:!1}})},nV=e=>{let{runType:n}=e,{open:i,onClose:l}=(0,F.q)({defaultOpen:!0});if(!i)return(0,t.jsx)(t.Fragment,{});switch(n){case"row_count":return(0,t.jsx)(nI,{onClose:l,children:(0,t.jsxs)(O.x,{children:["Enable row count diffing, and other Recce features, by configuring a base dbt environment to compare against. ",(0,t.jsx)(nE,{})]})});case"profile":return(0,t.jsx)(nI,{onClose:l,children:(0,t.jsxs)(O.x,{children:["Enable data-profile diffing, and other Recce features, by configuring a base dbt environment to compare against. ",(0,t.jsx)(nE,{})]})});default:return(0,t.jsx)(t.Fragment,{})}},nK=e=>{let{disableCopyToClipboard:n,onCopyToClipboard:i,onMouseEnter:l,onMouseLeave:r}=e,{authed:o}=(0,ee.$)(),{handleShareClick:s}=(0,nT.z)(),[a,c]=(0,f.useState)(!1);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(E.ZB,{children:[(0,t.jsx)(E.bF,{asChild:!0,children:(0,t.jsxs)(L.z,{size:"xs",variant:"outline",colorPalette:"gray",children:["Share ",(0,t.jsx)(nl.FXF,{})]})}),(0,t.jsx)(T.h,{children:(0,t.jsx)(E.Ku,{children:(0,t.jsxs)(E.Dv,{minW:"0",children:[(0,t.jsxs)(E.sN,{value:"copy-to-clipboard",onClick:i,onMouseEnter:l,onMouseLeave:r,disabled:n,children:[(0,t.jsx)(nl.j90,{})," Copy to Clipboard"]}),(0,t.jsx)(E.Cl,{}),o?(0,t.jsxs)(E.sN,{value:"share-to-cloud",onClick:async()=>{await s(),(0,y.v4)({name:"create"})},children:[(0,t.jsx)(nP.eOs,{})," Share to Cloud"]}):(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(E.sN,{value:"share",onClick:()=>{c(!0)},children:[(0,t.jsx)(nP.eOs,{})," Share"]})})]})})})]}),a&&(0,t.jsx)(nA,{parentOpen:a,handleParentClose:c,ignoreCookie:!0})]})},nH=e=>{var n,i,l,r;let{runId:o,onClose:s,isSingleEnvironment:a}=e,{readOnly:d}=(0,ee.$)(),{runAction:u}=(0,X.$q)(),{error:m,run:j,onCancel:g,isRunning:w}=nb(o),[k,C]=(0,f.useState)(),_=(0,Z.NL)(),[,S]=(0,eR.TH)(),[z,R]=(0,f.useState)("result"),N=(null==j?void 0:j.type)?null===(n=(0,e_.N)(j.type))||void 0===n?void 0:n.RunResultView:void 0,D=(0,f.useCallback)(()=>{var e;u(null!==(e=null==j?void 0:j.type)&&void 0!==e?e:"",null==j?void 0:j.params)},[j,u]),F=null==j?void 0:j.check_id,q=(0,f.useCallback)(()=>{F&&S("/checks/".concat(F))},[F,S]),I=(0,f.useCallback)(async()=>{if(!o)return;let e=await b(o,k);await _.invalidateQueries({queryKey:v.V.checks()}),S("/checks/".concat(e.check_id))},[o,S,_,k]),E=(null==j?void 0:j.type)==="query"||(null==j?void 0:j.type)==="query_diff"||(null==j?void 0:j.type)==="query_base",{ref:P,onCopyToClipboard:T,onMouseEnter:O,onMouseLeave:M}=nD(),J=!o||!(null==j?void 0:j.result)||!!m||"result"!==z;return(0,t.jsxs)(c.k,{direction:"column",children:[a&&(0,t.jsx)(nV,{runType:null==j?void 0:j.type}),(0,t.jsx)(p.U2,{size:"lg",colorPalette:"cyan",value:z,onValueChange:e=>{R(e.value)},flexDirection:"column",mb:"1px",children:(0,t.jsxs)(p.dr,{children:[(0,t.jsx)(p.SP,{value:"result",children:"Result"}),(0,t.jsx)(p.SP,{value:"params",children:"Params"}),E&&(0,t.jsx)(p.SP,{value:"query",children:"Query"}),(0,t.jsx)(x.L,{}),(0,t.jsxs)(h.U,{overflow:"hidden",children:[j&&(0,t.jsx)(nq,{run:j}),(0,t.jsxs)(L.z,{variant:"outline",colorPalette:"gray",disabled:!o||w||d,size:"xs",onClick:D,children:[(0,t.jsx)(nl.JXV,{})," Rerun"]}),a||d?(0,t.jsxs)(L.z,{variant:"outline",disabled:!o||!(null==j?void 0:j.result)||!!m||"result"!==z,onMouseEnter:O,onMouseLeave:M,size:"sm",onClick:T,children:[(0,t.jsx)(nl.j90,{})," Copy to Clipboard"]}):(0,t.jsx)(nK,{disableCopyToClipboard:J,onCopyToClipboard:async()=>{var e;await T(),(0,y.nO)({type:null!==(e=null==j?void 0:j.type)&&void 0!==e?e:"unknown",from:"run"})},onMouseEnter:O,onMouseLeave:M}),(0,t.jsx)(function(){return a?(0,t.jsx)(t.Fragment,{}):(null==j?void 0:j.check_id)?(0,t.jsxs)(L.z,{disabled:!o||!j.result||!!m,size:"sm",colorPalette:"cyan",onClick:q,children:[(0,t.jsx)(nl.s$L,{})," Go to Check"]}):(0,t.jsxs)(L.z,{disabled:!o||!(null==j?void 0:j.result)||!!m,size:"xs",colorPalette:"cyan",onClick:I,children:[(0,t.jsx)(nl.s$L,{})," Add to Checklist"]})},{}),(0,t.jsx)(A.P,{size:"sm",onClick:()=>{s&&s()}})]})]})}),"result"===z&&(0,t.jsx)(e2,{ref:P,error:m,run:j,onCancel:g,viewOptions:k,onViewOptionsChanged:C,RunResultView:N}),"params"===z&&j&&(0,t.jsx)(nJ,{type:j.type,params:j.params}),"query"===z&&j&&((null===(i=j.params)||void 0===i?void 0:i.base_sql_template)?(0,t.jsx)(eG,{value:j.params.sql_template,baseValue:j.params.base_sql_template,options:{readOnly:!0}}):(0,t.jsx)(eX,{value:null!==(r=null===(l=j.params)||void 0===l?void 0:l.sql_template)&&void 0!==r?r:"",options:{readOnly:!0}}))]})},nU=e=>{let{onClose:n,isSingleEnvironment:i}=e,{runId:l}=(0,X.$q)();return(0,t.jsx)(nH,{runId:l,onClose:n,isSingleEnvironment:i})};async function nW(e,n){return await (0,eY.g9)("query",e,n)}async function nZ(e,n){return await (0,eY.g9)("query_base",e,n)}async function n$(e,n){return await (0,eY.g9)("query_diff",e,n)}var nB=i(42489),nQ=i(30720);let nX=e=>{var n;let{defaultValues:i,suggestionList:r,onValuesChange:o,className:s}=e,[a,c]=(0,f.useState)(null!=i?i:[]),[d,u]=(0,f.useState)(""),[h,x]=(0,f.useState)(!1),p=(0,f.useRef)(null),m=e=>{a.includes(e)||(u(""),c([...a,e]),o([...a,e]))},j=null!==(n=null==r?void 0:r.filter(e=>""===d||e.includes(d)).filter(e=>!a.includes(e)))&&void 0!==n?n:[],g=a.length>0?(0,t.jsx)(L.z,{size:"2xs",variant:"ghost",color:"#3182CE",fontSize:e.size,paddingTop:"0",me:-2,onClick:()=>{u(""),c([]),o([])},children:"Clear"}):void 0;return(0,t.jsx)(nB.B,{width:e.width,className:s,endElement:g,children:(0,t.jsxs)(E.ZB,{size:"sm",lazyMount:!0,closeOnSelect:!1,onOpenChange:()=>{var e;return null===(e=p.current)||void 0===e?void 0:e.focus()},children:[(0,t.jsx)(E.bF,{asChild:!0,children:(0,t.jsx)(L.z,{width:"100%",size:"2xs",colorPalette:"gray",variant:"outline",justifyContent:"flex-start",children:a.length>1?"".concat(a.length," ").concat(e.unitName,"s selected"):1===a.length?a[0]:""})}),(0,t.jsx)(T.h,{children:(0,t.jsx)(E.Ku,{children:(0,t.jsxs)(E.Dv,{zIndex:"popover",fontSize:e.size,width:e.width,className:"no-track-pii-safe",children:[(0,t.jsx)(E.GP,{children:(0,t.jsxs)(nQ.E,{border:"1px solid #e2e8f0",borderRadius:"4px",width:"calc(100% - 8px)",marginX:"4px",padding:"4px",children:[a.map((n,i)=>(0,t.jsx)(nQ.U,{children:(0,t.jsxs)(I.Hc,{paddingX:"0.5rem",size:"sm"===e.size?e.size:"md"===e.size?e.size:"lg"===e.size?e.size:"md",children:[(0,t.jsx)(I.Sn,{children:n}),(0,t.jsx)(I.qA,{children:(0,t.jsx)(I.X1,{onClick:()=>{c(a.filter(e=>e!==n)),o(a.filter(e=>e!==n))}})})]},n)},"tag-".concat(i))),(0,t.jsx)(nQ.U,{width:"100%",children:(0,t.jsx)(H.I,{ref:p,placeholder:"Filter or add custom keys",variant:"subtle",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":m(n),u("");break;case"Backspace":""===e.currentTarget.value&&a.length>0&&(c(a.slice(0,-1)),o(a.slice(0,-1)))}},onBlur:()=>{p.current&&h&&p.current.focus()}})})]})}),(0,t.jsx)(E.Cl,{}),(0,t.jsxs)(E.GP,{children:[""!==d&&!(null==r?void 0:r.includes(d))&&(0,t.jsxs)(E.sN,{value:"custom-value-by-filter",onClick:()=>{m(d),x(!1)},children:["Add '",d,"' to the list"]},"custom-value-by-filter"),j.map((e,n)=>(0,t.jsx)(E.sN,{value:"option-".concat(n),onClick:()=>{m(e)},children:e},"option-".concat(n))).slice(0,10),j.length>10&&(0,t.jsx)(el.u,{content:"Please use filter to find more items",positioning:{placement:"top"},children:(0,t.jsxs)(l.x,{px:"12px",color:"gray",fontSize:"8pt",children:["and ",j.length-10," more items..."]})})]})]})})})]})})};var nG=i(3390);let nY=e=>{let{defaultPrimaryKeys:n,onPrimaryKeysChange:i,...l}=e,{lineageGraph:r,isActionAvailable:o}=(0,B.kJ)(),s=(0,f.useMemo)(()=>{if(!r)return[];let e=new Set;for(let t in r.nodes){var n,i;let l=r.nodes[t],o=null===(n=l.data.base)||void 0===n?void 0:n.columns,s=null===(i=l.data.current)||void 0===i?void 0:i.columns;for(let n in o)e.add(n);for(let n in s)e.add(n)}return Array.from(e).sort()},[r]);return(0,t.jsx)(c.k,{...l,children:(0,t.jsxs)(nG.Tn,{m:"0 0.5rem",gap:0,children:[(0,t.jsxs)(nG.Qy,{fontSize:"0.625rem",margin:0,children:["Diff with Primary Key(s) (suggested)"," ",(0,t.jsx)(el.u,{content:"Provide a primary key to perform query diff in data warehouse and only return changed rows.",positioning:{placement:"bottom-end"},children:(0,t.jsx)(nl.yZ7,{color:"gray.600"})})]}),(0,t.jsx)(nX,{className:"no-track-pii-safe",unitName:"key",defaultValues:n,suggestionList:s,onValuesChange:i,size:"2xs",width:"240px",placeholder:"Select or type to add keys",disabled:!o("query_diff_with_primary_key")})]})})};var n0=i(48622);function n1(e){let{description:n,onLike:i,onDislike:l,onClickLink:o,externalLink:s,externalLinkText:a}=e;return(0,t.jsxs)(c.k,{gap:4,justifyContent:"center",alignContent:"center",alignItems:"center",children:[n,(0,t.jsx)(P.h,{"aria-label":"thumbs up",variant:"ghost",width:"32px",height:"32px",onClick:i,children:(0,t.jsx)(d.E,{src:"/imgs/feedback/thumbs-up.png",alt:"like"})}),(0,t.jsx)(P.h,{"aria-label":"thumbs down",variant:"ghost",width:"32px",height:"32px",onClick:l,children:(0,t.jsx)(d.E,{src:"/imgs/feedback/thumbs-down.png",alt:"dislike"})}),s&&a&&(0,t.jsxs)(r.r,{href:s,target:"_blank",textDecoration:"underline",onClick:o,children:[a," ",(0,t.jsx)(eU.$OI,{})]})]})}let n2="recce-",n5={bypassSaveOverwrite:"".concat(n2,"-bypass-save-overwrite"),previewChangeFeedbackID:"".concat(n2,"-preview-change-feedback"),prepareEnvGuideID:"".concat(n2,"-prepare-env")};function n4(e){let{current:n,primaryKeys:i,setPrimaryKeys:r,onRunResultOpen:s,runQuery:a,isPending:d}=e;return(0,t.jsxs)(c.k,{justifyContent:"right",alignItems:"center",padding:"4pt 8pt",gap:"5px",height:"54px",borderBottom:"1px solid lightgray",flex:"0 0 54px",children:[(0,t.jsxs)(l.x,{children:[(0,t.jsxs)(u.X,{as:"h2",size:"md",display:"flex",alignItems:"center",gap:"5px",children:[(0,t.jsx)(o.J,{as:n0.vc4,boxSize:"1.2em"}),"Sandbox"]}),(0,t.jsxs)(O.x,{fontSize:"xs",color:"gray.500",children:["Compare the run results based on the modified SQL code of model ",(0,t.jsx)("b",{children:null==n?void 0:n.name})]})]}),(0,t.jsx)(x.L,{}),(0,t.jsx)(nY,{defaultPrimaryKeys:i,onPrimaryKeysChange:r}),(0,t.jsx)(el.u,{content:"Run diff to see the changes",children:(0,t.jsx)(L.z,{size:"xs",marginTop:"16px",fontSize:"14px",onClick:()=>{s(),a()},colorPalette:"blue",loading:d,children:"Run Diff"})})]})}function n8(e){var n,i,l,r;let{currentModelID:o,height:s="32px",flex:a="0 0 auto"}=e,{lineageGraph:d,envInfo:u}=(0,B.kJ)(),h="0 16px",x=eW(null!==(l=null==u?void 0:null===(i=u.dbt)||void 0===i?void 0:null===(n=i.current)||void 0===n?void 0:n.generated_at)&&void 0!==l?l:""),p=(0,e5.Q)(x,{addSuffix:!0}),m="N/A";if(null==d?void 0:d.nodes[o]){let e=d.nodes[o];(null===(r=e.data.current)||void 0===r?void 0:r.schema)&&(m=e.data.current.schema)}return(0,t.jsxs)(c.k,{gap:0,height:s,flex:a,fontSize:"14px",align:"center",margin:"0",backgroundColor:"#EDF2F880",children:[(0,t.jsx)(eT.K,{width:"50%",children:(0,t.jsxs)(O.x,{as:"b",margin:h,children:["ORIGINAL (Schema: ",m,", Last Updated: ",p,")"]})}),(0,t.jsx)(eT.K,{width:"50%",children:(0,t.jsx)(O.x,{as:"b",margin:h,children:"SANDBOX EDITOR"})})]})}function n3(e){var n;let{current:i,onChange:r}=e,o=function(e,n){let i=(0,f.useRef)(null);return(0,f.useEffect)(()=>{i.current&&e!==i.current.getValue()&&i.current.setValue(e)},[e]),{onMount(e){let t=e.getModifiedEditor();i.current=t,t.onDidChangeModelContent(()=>{n(t.getValue())})}}}(null!==(n=null==i?void 0:i.raw_code)&&void 0!==n?n:"",r);return(0,t.jsx)(l.x,{flex:1,overflowY:"auto",children:(0,t.jsx)(eL.SV,{language:"sql",theme:"vs",original:null==i?void 0:i.raw_code,modified:null==i?void 0:i.raw_code,options:{readOnly:!1,fontSize:14,lineNumbers:"on",automaticLayout:!0,renderOverviewRuler:!1,minimap:{enabled:!0}},onMount:o.onMount})})}function n9(e){var n,i;let{isOpen:r,onClose:o,current:a}=e,{open:u,onClose:x,onOpen:p}=(0,F.q)(),[m,j]=(0,f.useState)(null!==(n=null==a?void 0:a.raw_code)&&void 0!==n?n:""),{showRunId:g,clearRunResult:v}=(0,X.$q)(),{primaryKeys:b,setPrimaryKeys:w}=(0,nf.rV)(),{data:k,isLoading:C}=(0,ny.P)(),_=async()=>{var e;let n={current_model:null!==(e=null==a?void 0:a.name)&&void 0!==e?e:"",primary_keys:b,sql_template:m},{run_id:i}=await n$(n,{nowait:!0});return g(i),await (0,eY.Qp)(i)},{mutate:S,isPending:z}=(0,$.D)({mutationFn:_,onSuccess(e,n){e.error?(0,y.B2)({action:"run",node:null==a?void 0:a.name,status:"failure"}):((0,y.B2)({action:"run",node:null==a?void 0:a.name,status:"success"}),setTimeout(()=>{R()},1e3),!C&&(null==k?void 0:k.single_env_onboarding)&&setTimeout(()=>{D()},2e3))}}),{feedbackToast:R,closeToast:N}=function(e){let{feedbackId:n,description:i,onFeedbackSubmit:l,externalLink:r,externalLinkText:o}=e,[s,a]=(0,f.useState)(void 0);return{feedbackToast:function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],c=localStorage.getItem(n);null==s&&("true"!==c||e)&&a(eq.m.create({id:n,duration:void 0,type:"success",description:(0,t.jsx)(h.U,{children:(0,t.jsx)(n1,{description:i,onLike:()=>{l("like"),eq.m.dismiss(s),localStorage.setItem(n,"true")},onDislike:()=>{l("dislike"),eq.m.dismiss(s),localStorage.setItem(n,"true")},externalLink:r,externalLinkText:o,onClickLink:()=>{l("link")}})})}))},closeToast:()=>{eq.m.dismiss(s)}}}({feedbackId:n5.previewChangeFeedbackID,description:"Enjoy preview change?",onFeedbackSubmit:e=>{switch(e){case"like":(0,y.FF)({feedback:"like",node:null==a?void 0:a.name});break;case"dislike":(0,y.FF)({feedback:"dislike",node:null==a?void 0:a.name});break;case"link":(0,y.FF)({feedback:"form",node:null==a?void 0:a.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:D,closeGuideToast:I}=function(e){let[n,i]=(0,f.useState)(void 0),{guideId:t,description:l,externalLink:r,externalLinkText:o,onExternalLinkClick:s}=e;return{guideToast:function(){null==n&&i(eq.m.create({id:t,duration:3e3,type:"success",description:l,action:{label:null!=o?o:"link",onClick:()=>{s&&s()}}}))},closeGuideToast:()=>{eq.m.dismiss(n)}}}({guideId:n5.prepareEnvGuideID,description:"Want to compare data changes with production data?",externalLink:"https://docs.datarecce.io/get-started/#prepare-dbt-artifacts",externalLinkText:"Learn how.",onExternalLinkClick:()=>{(0,y.BA)({action:"external_link",from:"preview_changes",node:null==a?void 0:a.name})}});return(0,f.useEffect)(()=>{if(r){var e;j(null!==(e=null==a?void 0:a.raw_code)&&void 0!==e?e:"")}},[r,a]),(0,t.jsx)(q.GR,{open:r,size:"cover",onOpenChange:()=>{o(),x(),v(),N(),I(),(0,y.B2)({action:"close",node:null==a?void 0:a.name})},children:(0,t.jsxs)(T.h,{children:[(0,t.jsx)(q.ZR,{}),(0,t.jsx)(q.Qd,{children:(0,t.jsxs)(q.cZ,{height:"100%",children:[(0,t.jsxs)(q.fK,{height:"40px",bg:"rgb(77, 209, 176)",px:0,py:4,children:[(0,t.jsxs)(c.k,{alignItems:"center",height:"100%",gap:"10px",children:[(0,t.jsx)(d.E,{boxSize:"20px",ml:"18px",src:"/logo/recce-logo-white.png",alt:"recce-logo-white"}),(0,t.jsx)(q.$N,{as:"h1",fontFamily:'"Montserrat", sans-serif',fontSize:"lg",color:"white",children:"RECCE"}),(0,t.jsx)(s.Ct,{fontSize:"sm",color:"white/80",variant:"outline",children:"Experiment"})]}),(0,t.jsx)(q.Rd,{asChild:!0,children:(0,t.jsx)(A.P,{size:"sm"})})]}),(0,t.jsx)(q.a7,{p:0,children:(0,t.jsxs)(ep,{sizes:u?[50,50]:[100,0],minSize:u?100:0,gutterSize:u?5:0,style:{flex:"1",contain:"size",height:"100%"},children:[(0,t.jsxs)(c.k,{direction:"column",height:"100%",m:0,p:0,children:[(0,t.jsx)(n4,{current:a,primaryKeys:null!=b?b:[],setPrimaryKeys:w,onRunResultOpen:p,runQuery:S,isPending:z}),(0,t.jsx)(n8,{height:"32pxs",flex:"0 0 auto",currentModelID:null!==(i=null==a?void 0:a.id)&&void 0!==i?i:""}),(0,t.jsx)(n3,{current:a,onChange:j})]}),u?(0,t.jsx)(nU,{onClose:x,disableAddToChecklist:!0}):(0,t.jsx)(l.x,{})]})}),(0,t.jsx)(l.x,{position:"fixed",bottom:"4",right:"4",opacity:.5,children:(0,t.jsx)(el.u,{content:"Give us feedback",children:(0,t.jsx)(P.h,{"aria-label":"feedback",variant:"ghost",size:"md",onClick:()=>{R(!0)},children:(0,t.jsx)(W.xJq,{})})})})]})})]})})}let n6=e=>{var n,i,r,o,s,a;let{node:c}=e,{open:d,onOpen:u,onClose:h}=(0,F.q)(),[x,p]=(0,f.useState)(!1),{data:m,isLoading:j}=(0,ny.P)(),g=null==m?void 0:m.single_env_onboarding;if(j)return(0,t.jsx)(t.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}},b=null===(n=c.data.base)||void 0===n?void 0:n.raw_code,w=null===(i=c.data.current)||void 0===i?void 0:i.raw_code,k=null!==(a=null!==(s=null===(r=c.data.base)||void 0===r?void 0:r.name)&&void 0!==s?s:null===(o=c.data.current)||void 0===o?void 0:o.name)&&void 0!==a?a:"";return(0,t.jsxs)(l.x,{className:"no-track-pii-safe",style:{position:"relative"},height:"100%",onMouseEnter:()=>{p(!0)},onMouseLeave:()=>{p(!1)},children:[g?(0,t.jsx)(eX,{language:"sql",theme:"vs",value:null!=b?b:"",options:y}):(0,t.jsx)(eL.SV,{language:"sql",theme:"vs",original:b,modified:w,options:{...v,renderSideBySide:!1}}),(0,t.jsx)(P.h,{onClick:u,size:"md","aria-label":"",variant:"ghost",style:{position:"absolute",top:"5px",right:"20px",opacity:x?.5:.1,transition:"opacity 0.3s ease-in-out"},children:(0,t.jsx)(ef.Tlm,{})}),(0,t.jsx)(q.GR,{open:d,onOpenChange:h,size:"xl",children:(0,t.jsxs)(T.h,{children:[(0,t.jsx)(q.ZR,{}),(0,t.jsx)(q.Qd,{children:(0,t.jsxs)(q.cZ,{overflowY:"auto",height:"75%",children:[(0,t.jsxs)(q.fK,{children:[g?(0,t.jsxs)(q.$N,{children:[(0,t.jsx)("code",{children:k})," Model Code"]}):(0,t.jsxs)(q.$N,{children:[(0,t.jsx)("code",{children:k})," Model Code Diff"]}),(0,t.jsx)(q.Rd,{asChild:!0,children:(0,t.jsx)(A.P,{size:"sm"})})]}),(0,t.jsx)(q.a7,{children:g?(0,t.jsx)(eL.ML,{language:"sql",theme:"vs",value:null!=b?b:"",options:{...y,fontSize:16}}):(0,t.jsx)(eL.SV,{language:"sql",theme:"vs",original:b,modified:w,options:{...v,fontSize:16}})})]})})]})})]})};function n7(e,n){let i=(0,Q._)(e,n);if(0===i.length)return[];if(0===e.length||0===n.length)return i.map((e,n)=>n===i.length-1?e:e+",");let t="";return i.forEach(i=>{e.includes(i)&&n.includes(i)&&(t=i)}),i.map((l,r)=>{let o;return(o=e.includes(l)?n.includes(l)?l:"--- ".concat(l," (Removed)"):"--- ".concat(l," (Added)"),l===t||r===i.length-1)?o:o+","})}function ie(e){var n,i,r,s;let{node:a,onCloseNode:c}=e,[,d]=(0,eR.TH)(),{setSqlQuery:m,setPrimaryKeys:j}=(0,nf.rV)(),g="model"===a.resourceType||"seed"===a.resourceType||"source"===a.resourceType||"snapshot"===a.resourceType,{open:v,onOpen:b,onClose:w}=(0,F.q)(),{open:k,onClose:C}=(0,F.q)({defaultOpen:!0}),{runAction:_}=(0,X.$q)(),{envInfo:S,isActionAvailable:z}=(0,B.kJ)(),{primaryKey:R}=(0,nj.ZP)(a.name),N=()=>{_("row_count",{node_names:[a.name]},{showForm:!1,showLast:!1})},D=()=>{_("row_count_diff",{node_names:[a.name]},{showForm:!1,showLast:!1})},{data:q}=(0,ny.P)(),I=null==q?void 0:q.single_env_onboarding,P=(0,f.useCallback)(async()=>{let e=a.id,n=await ng({node_id:e});d("/checks/".concat(n.check_id))},[a,d]),M=(e,n)=>e?nv.add_or_remove:z(n)?"":"This action is not supported yet.",J="added"===a.changeStatus||"removed"===a.changeStatus,V=Object.keys(null!==(r=null===(n=a.data.base)||void 0===n?void 0:n.columns)&&void 0!==r?r:{}),K=Object.keys(null!==(s=null===(i=a.data.current)||void 0===i?void 0:i.columns)&&void 0!==s?s:{});return(0,t.jsxs)(nm.r,{height:"100%",templateRows:"auto auto 1fr",children:[(0,t.jsxs)(h.U,{children:[(0,t.jsx)(l.x,{flex:"0 1 20%",p:"16px",children:(0,t.jsx)(u.X,{size:"sm",className:"no-track-pii-safe",children:a.name})}),(0,t.jsx)(x.L,{}),I?(0,t.jsx)(function(){var e,n,i;let l=n7(V,K),r='select * from {{ ref("'.concat(a.name,'") }}');return(l.length&&(r="select \n ".concat(l.join("\n "),'\nfrom {{ ref("').concat(a.name,'") }}')),"model"!==a.resourceType&&"seed"!==a.resourceType&&"snapshot"!==a.resourceType)?(0,t.jsx)(t.Fragment,{}):(0,t.jsxs)(E.ZB,{children:[(0,t.jsx)(E.bF,{asChild:!0,children:(0,t.jsxs)(L.z,{size:"xs",variant:"outline",children:["Explore ",(0,t.jsx)(nl.FXF,{})]})}),(0,t.jsx)(T.h,{children:(0,t.jsx)(E.Ku,{children:(0,t.jsxs)(E.Dv,{children:[(0,t.jsxs)(E.sN,{value:"label",fontSize:"14px",onClick:()=>{(null==S?void 0:S.adapterType)==="dbt"?m(r):(null==S?void 0:S.adapterType)==="sqlmesh"&&m("select * from ".concat(a.name)),d("/query")},children:[(0,t.jsx)(o.J,{as:null===(e=(0,e_.N)("query"))||void 0===e?void 0:e.icon})," Query"]}),(0,t.jsxs)(E.sN,{value:"row-count",fontSize:"14px",onClick:()=>{N()},children:[(0,t.jsx)(o.J,{as:null===(n=(0,e_.N)("row_count"))||void 0===n?void 0:n.icon})," Row Count"]}),(0,t.jsx)(el.u,{content:M(J,"profile"),positioning:{placement:"left"},children:(0,t.jsxs)(E.sN,{value:"profile",fontSize:"14px",disabled:J,onClick:()=>{_("profile",{model:a.name},{showForm:!0,showLast:!1})},children:[(0,t.jsx)(o.J,{as:null===(i=(0,e_.N)("profile"))||void 0===i?void 0:i.icon})," Profile"]})})]})})})]})},{}):(0,t.jsx)(function(){var e,n,i,l,r,s,c,u;let h=n7(V,K),x='select * from {{ ref("'.concat(a.name,'") }}');h.length&&(x="select \n ".concat(h.join("\n "),'\nfrom {{ ref("').concat(a.name,'") }}'));let{readOnly:p}=(0,ee.$)();return"model"!==a.resourceType&&"seed"!==a.resourceType&&"snapshot"!==a.resourceType?(0,t.jsx)(t.Fragment,{}):(0,t.jsxs)(E.ZB,{children:[(0,t.jsx)(E.bF,{asChild:!0,children:(0,t.jsxs)(L.z,{size:"2xs",variant:"outline",disabled:p,children:["Explore ",(0,t.jsx)(nl.FXF,{})]})}),(0,t.jsx)(T.h,{children:(0,t.jsx)(E.Ku,{children:(0,t.jsxs)(E.Dv,{children:[(0,t.jsxs)(E.sN,{value:"query",fontSize:"14px",onClick:()=>{(null==S?void 0:S.adapterType)==="dbt"?m(x):(null==S?void 0:S.adapterType)==="sqlmesh"&&m("select * from ".concat(a.name)),z("query_diff_with_primary_key")&&j(void 0!==R?[R]:void 0),d("/query")},children:[(0,t.jsx)(o.J,{as:null===(e=(0,e_.N)("query_diff"))||void 0===e?void 0:e.icon})," Query"]}),(0,t.jsxs)(E.sN,{value:"sandbox",fontSize:"14px",onClick:()=>{z("query_diff_with_primary_key")&&j(void 0!==R?[R]:void 0),b(),(0,y.B2)({action:"explore",node:a.name})},children:[(0,t.jsx)(o.J,{as:null===(n=(0,e_.N)("sandbox"))||void 0===n?void 0:n.icon})," Sandbox (Experiment)"]}),(0,t.jsx)(E.Cl,{}),(0,t.jsxs)(E.GP,{m:"0",p:"0",children:[(0,t.jsx)(E.U5,{children:"Diff"}),(0,t.jsxs)(E.sN,{value:"row-count-diff",fontSize:"14px",onClick:()=>{D()},children:[(0,t.jsx)(o.J,{as:null===(i=(0,e_.N)("row_count_diff"))||void 0===i?void 0:i.icon})," Row Count Diff"]}),(0,t.jsx)(el.u,{disabled:""===M(J,"profile_diff"),content:M(J,"profile_diff"),positioning:{placement:"left"},children:(0,t.jsxs)(E.sN,{value:"profile-diff",fontSize:"14px",disabled:J,onClick:()=>{_("profile_diff",{model:a.name},{showForm:!0,showLast:!1})},children:[(0,t.jsx)(o.J,{as:null===(l=(0,e_.N)("profile_diff"))||void 0===l?void 0:l.icon})," Profile Diff"]})}),(0,t.jsx)(el.u,{disabled:""===M(J,"value_diff"),content:M(J,"value_diff"),positioning:{placement:"left"},children:(0,t.jsxs)(E.sN,{value:"value-diff",fontSize:"14px",disabled:J,onClick:()=>{_("value_diff",{model:a.name},{showForm:!0,showLast:!1})},children:[(0,t.jsx)(o.J,{as:null===(r=(0,e_.N)("value_diff"))||void 0===r?void 0:r.icon})," Value Diff"]})}),(0,t.jsx)(el.u,{disabled:""===M(J,"top_k_diff"),content:M(J,"top_k_diff"),positioning:{placement:"left"},children:(0,t.jsxs)(E.sN,{value:"top-k-diff",fontSize:"14px",disabled:J,onClick:()=>{_("top_k_diff",{model:a.name,column_name:"",k:50},{showForm:!0})},children:[(0,t.jsx)(o.J,{as:null===(s=(0,e_.N)("top_k_diff"))||void 0===s?void 0:s.icon})," Top-K Diff"]})}),(0,t.jsx)(el.u,{disabled:""===M(J,"histogram_diff"),content:M(J,"histogram_diff"),positioning:{placement:"left"},children:(0,t.jsxs)(E.sN,{value:"histogram-diff",fontSize:"14px",disabled:J,onClick:()=>{_("histogram_diff",{model:a.name,column_name:"",column_type:""},{showForm:!0})},children:[(0,t.jsx)(o.J,{as:null===(c=(0,e_.N)("histogram_diff"))||void 0===c?void 0:c.icon})," Histogram Diff"]})})]}),(0,t.jsx)(E.Cl,{}),(0,t.jsxs)(E.GP,{m:"0",p:"4px 12px",children:[(0,t.jsx)(E.U5,{children:"Add to Checklist"}),(0,t.jsxs)(E.sN,{value:"schema-diff",fontSize:"14px",onClick:()=>{P()},children:[(0,t.jsx)(o.J,{as:null===(u=(0,e_.N)("schema_diff"))||void 0===u?void 0:u.icon})," Schema Diff"]})]})]})})})]})},{}),(0,t.jsx)(l.x,{flex:"0 1 1%",children:(0,t.jsx)(A.P,{size:"2xs",onClick:c})})]}),(0,t.jsx)(l.x,{color:"gray",paddingLeft:"16px",children:(0,t.jsxs)(h.U,{gap:"8px",children:[(0,t.jsx)(nr,{node:a}),("model"===a.resourceType||"snapshot"===a.resourceType||"seed"===a.resourceType)&&(I?(0,t.jsx)(na,{node:a,onRefresh:N}):(0,t.jsx)(ns,{node:a,onRefresh:D}))]})}),g&&(0,t.jsxs)(p.U2,{defaultValue:"columns",overflow:"auto",children:[I&&k&&(0,t.jsx)(l.x,{p:"12px",children:(0,t.jsx)(nI,{onClose:C,align:"flex-start",children:(0,t.jsxs)(O.x,{children:["Enable the Recce Checklist and start adding checks for better data validation and review.",(0,t.jsx)("br",{}),(0,t.jsx)(nE,{})]})})}),(0,t.jsxs)(p.dr,{children:[(0,t.jsx)(p.SP,{value:"columns",children:"Columns"}),(0,t.jsx)(p.SP,{value:"code",children:"Code"})]}),(0,t.jsxs)(p.fk,{overflow:"auto",height:"calc(100% - 42px)",children:[(0,t.jsx)(p.nU,{value:"columns",p:0,overflowY:"auto",height:"100%",children:I?(0,t.jsx)(ed,{current:a.data.current}):(0,t.jsx)(ec,{base:a.data.base,current:a.data.current})}),(0,t.jsx)(p.nU,{value:"code",height:"100%",p:0,children:(0,t.jsx)(n6,{node:a})})]})]}),(0,t.jsx)(n9,{isOpen:v,onClose:w,current:a.data.current})]})}function ii(e){var n,i;let{onClose:r}=e,{cancel:o,actionState:s}=ei();return(0,t.jsx)(l.x,{bg:"white",rounded:"md",shadow:"dark-lg",children:(0,t.jsxs)(h.U,{p:"5px 15px",mt:"4",separator:(0,t.jsx)(e8.n,{borderColor:"gray.200"}),gap:4,children:[(0,t.jsxs)(l.x,{fontSize:"10pt",children:["Progress: ","per_node"===s.mode?"".concat(s.completed," / ").concat(s.total):(null===(i=s.currentRun)||void 0===i?void 0:null===(n=i.progress)||void 0===n?void 0:n.percentage)?"".concat(100*s.currentRun.progress.percentage,"%"):"completed"===s.status?"100%":"0%"," ","canceled"===s.status?" (canceled)":""]}),"running"===s.status||"canceling"===s.status?(0,t.jsx)(L.z,{size:"xs",variant:"outline",onClick:o,loading:"canceling"===s.status,loadingText:"Canceling",children:"Cancel"}):(0,t.jsx)(h.U,{children:(0,t.jsx)(L.z,{size:"xs",variant:"outline",onClick:r,children:"Close"})})]})})}var it=i(4731),il=i(1507);let ir=()=>(0,t.jsxs)(R.g,{align:"start",gap:0,children:[(0,t.jsx)(O.x,{fontSize:"10pt",color:"gray.500",pb:1,children:"Select nodes by dbt node selector syntax"}),(0,t.jsxs)(O.x,{fontSize:"8pt",children:[(0,t.jsx)(a.E,{fontSize:"8pt",children:"model_name"})," Select a node"]}),(0,t.jsxs)(O.x,{fontSize:"8pt",children:[(0,t.jsx)(a.E,{fontSize:"8pt",children:"model_name+"})," Select downstream nodes"]}),(0,t.jsxs)(O.x,{fontSize:"8pt",children:[(0,t.jsx)(a.E,{fontSize:"8pt",children:"+model_name"})," Select upstream nodes"]}),(0,t.jsxs)(O.x,{fontSize:"8pt",children:[(0,t.jsx)(a.E,{fontSize:"8pt",children:"model*"})," Select by wildcard"]})]}),io=()=>{let{isHistoryOpen:e,showHistory:n,closeHistory:i}=(0,X.$q)();return(0,t.jsxs)(L.z,{size:"2xs",variant:"outline",onClick:()=>{e?((0,y.U8)({name:"hide"}),i()):((0,y.U8)({name:"show"}),n())},children:[(0,t.jsx)(o.J,{as:W.M1Q})," ",e?"Hide":"Show"]})},is=e=>{var n;let{isDisabled:i}=e,{viewOptions:l,onViewOptionsChanged:r}=ei(),s=null!==(n=l.view_mode)&&void 0!==n?n:"changed_models",a=e=>{r({...l,view_mode:e})};return(0,t.jsxs)(E.ZB,{children:[(0,t.jsx)(E.bF,{asChild:!0,children:(0,t.jsxs)(L.z,{minWidth:"100px",size:"2xs",variant:"outline",disabled:i,children:[(0,t.jsx)(o.J,{as:ek("model").icon})," ","changed_models"===s?"Changed Models":"All"," ",(0,t.jsx)(nl.FXF,{})]})}),(0,t.jsx)(T.h,{children:(0,t.jsx)(E.Ku,{children:(0,t.jsx)(E.Dv,{children:(0,t.jsxs)(E.bh,{value:s,onValueChange:e=>{a(e.value)},children:[(0,t.jsx)(E.U5,{children:"packages"}),(0,t.jsxs)(E.k5,{value:"changed_models",children:["Changed Models",(0,t.jsx)(E.kc,{})]}),(0,t.jsxs)(E.k5,{value:"all",children:["All",(0,t.jsx)(E.kc,{})]})]})})})})]})},ia=e=>{var n,i;let{isDisabled:l}=e,{lineageGraph:r}=(0,B.kJ)(),{viewOptions:s,onViewOptionsChanged:a}=ei(),c=new Set;for(let e of Object.values(null!==(i=null==r?void 0:r.nodes)&&void 0!==i?i:{}))e.packageName&&c.add(e.packageName);let d=null==r?void 0:null===(n=r.manifestMetadata.current)||void 0===n?void 0:n.project_name,u=s.packages?new Set(s.packages):d?new Set([d]):c,h=u.size===c.size,x=0===u.size,p=1===u.size?Array.from(u)[0]:h?"All Packages":x?"No Package":"".concat(u.size," Packages"),m=e=>{let n=new Set(u);n.has(e)?n.delete(e):n.add(e),a({...s,packages:Array.from(n)})};return(0,t.jsxs)(E.ZB,{closeOnSelect:!1,children:[(0,t.jsx)(E.bF,{asChild:!0,children:(0,t.jsxs)(L.z,{minWidth:"100px",size:"2xs",variant:"outline",disabled:l,children:[(0,t.jsx)(o.J,{as:nn.zFh})," ",p," ",(0,t.jsx)(nl.FXF,{})]})}),(0,t.jsx)(T.h,{children:(0,t.jsx)(E.Ku,{children:(0,t.jsx)(E.Dv,{children:(0,t.jsxs)(E.GP,{children:[(0,t.jsx)(E.U5,{children:"Select Packages"}),(0,t.jsx)(E.sN,{value:"",asChild:!0,children:(0,t.jsxs)(it.wx,{checked:h||x?h:"indeterminate",onCheckedChange:()=>{h?a({...s,packages:[]}):a({...s,packages:Array.from(c)})},children:[(0,t.jsx)(it.HC,{}),(0,t.jsx)(it.Z8,{}),(0,t.jsx)(it.ke,{children:"Select All"})]})}),(0,t.jsx)(E.Cl,{}),Array.from(c).map(e=>(0,t.jsx)(E.sN,{value:e,children:(0,t.jsxs)(it.wx,{checked:u.has(e),onCheckedChange:()=>{m(e)},children:[(0,t.jsx)(it.HC,{}),(0,t.jsx)(it.Z8,{}),(0,t.jsx)(it.ke,{children:e})]})},e))]})})})})]})},ic=e=>{let[n,i]=(0,f.useState)(e.value),{data:l}=(0,ny.P)(),r=(0,f.useRef)(null);return(0,f.useEffect)(()=>{r.current&&(r.current.value=e.value)},[e.value]),(0,t.jsx)(el.u,{contentProps:{width:"300px",padding:2,shadow:"md",borderWidth:1,rounded:"md",color:"black",backgroundColor:"white"},content:e.tooltipComponent,positioning:{placement:"bottom-start"},closeOnClick:!1,disabled:!(null==l?void 0:l.single_env_onboarding),children:(0,t.jsx)(H.I,{ref:r,height:"24px",fontSize:"10pt",placeholder:"with selectors",disabled:e.isDisabled,value:n,onChange:e=>{i(e.target.value)},onKeyUp:t=>{"Enter"===t.key?e.onChange(n):"Escape"===t.key&&(t.preventDefault(),i(e.value),r.current&&r.current.blur())},onBlur:()=>{i(e.value)}})})},id=e=>{var n;let{isDisabled:i}=e,{viewOptions:l,onViewOptionsChanged:r}=ei();return(0,t.jsx)(ic,{isDisabled:i,value:null!==(n=l.select)&&void 0!==n?n:"",onChange:e=>{r({...l,select:e||void 0})},tooltipComponent:(0,t.jsx)(ir,{})})},iu=e=>{var n;let{isDisabled:i}=e,{viewOptions:l,onViewOptionsChanged:r}=ei();return(0,t.jsx)(ic,{isDisabled:i,value:null!==(n=l.exclude)&&void 0!==n?n:"",onChange:e=>{r({...l,exclude:e||void 0})}})},ih=e=>(0,t.jsxs)(l.x,{style:e.style,maxWidth:"300px",children:[(0,t.jsx)(l.x,{fontSize:"8pt",children:e.label||(0,t.jsx)(t.Fragment,{children:"\xa0"})}),e.children]}),ix=()=>{var e,n,i,l,r;let{deselect:s,focusedNode:a,selectedNodes:c,...d}=ei(),{readOnly:u}=(0,ee.$)(),{data:p}=(0,ny.P)(),m=null==p?void 0:p.single_env_onboarding,f=!!a,j=c.length>0,g=!f&&!j;return(0,t.jsx)(h.U,{width:"100%",padding:"4pt 8pt",className:"chakra-style-reset",children:(0,t.jsxs)(h.U,{flex:"1",children:[(0,t.jsx)(ih,{label:"History",style:{flexShrink:"1"},children:(0,t.jsx)(io,{})}),(0,t.jsx)(ih,{label:"Mode",style:{flexShrink:"1"},children:(0,t.jsx)(is,{isDisabled:j})}),(0,t.jsx)(ih,{label:"Package",style:{flexShrink:"1"},children:(0,t.jsx)(ia,{isDisabled:j})}),(0,t.jsx)(ih,{label:"Select",style:{flex:"100 1 auto"},children:(0,t.jsx)(id,{isDisabled:j})}),(0,t.jsx)(ih,{label:"Exclude",style:{flex:"100 1 auto"},children:(0,t.jsx)(iu,{isDisabled:j})}),(0,t.jsx)(x.L,{}),j&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ih,{label:"",style:{flexShrink:"0"},children:(0,t.jsx)(O.x,{fontSize:"9pt",color:"gray.500",children:c.length>1?"".concat(c.length," nodes selected"):"".concat(c.length," node selected")})}),(0,t.jsx)(ih,{label:"",children:(0,t.jsx)(L.z,{variant:"outline",size:"2xs",fontSize:"9pt",onClick:()=>{s()},children:"Deselect"})}),m&&(0,t.jsx)(ih,{label:"Explore",children:(0,t.jsx)(il.h,{attached:!0,variant:"outline",children:(0,t.jsxs)(E.ZB,{positioning:{placement:"bottom-end"},children:[(0,t.jsx)(E.bF,{asChild:!0,children:(0,t.jsxs)(L.z,{size:"2xs",children:["Actions ",(0,t.jsx)(nl.FXF,{})]})}),(0,t.jsx)(T.h,{children:(0,t.jsx)(E.Ku,{children:(0,t.jsx)(E.Dv,{children:(0,t.jsx)(E.sN,{value:"row-count",disabled:!(g||f||j),onClick:async()=>{await d.runRowCount()},children:(0,t.jsxs)(O.x,{textStyle:"sm",children:[(0,t.jsx)(o.J,{as:null===(e=(0,e_.N)("row_count_diff"))||void 0===e?void 0:e.icon})," Row Count"]})})})})})]})})})]}),!m&&(0,t.jsx)(ih,{label:"Explore",children:(0,t.jsx)(il.h,{attached:!0,variant:"outline",children:(0,t.jsxs)(E.ZB,{positioning:{placement:"bottom-end"},children:[(0,t.jsx)(E.bF,{asChild:!0,children:(0,t.jsxs)(L.z,{size:"2xs",disabled:u,children:["Actions ",(0,t.jsx)(nl.FXF,{})]})}),(0,t.jsx)(T.h,{children:(0,t.jsx)(E.Ku,{children:(0,t.jsxs)(E.Dv,{children:[(0,t.jsxs)(E.GP,{m:"0",p:"4px 12px",children:[(0,t.jsx)(E.U5,{children:"Diff"}),(0,t.jsx)(E.sN,{value:"row-count-diff",disabled:!(g||f||j),onClick:async()=>{await d.runRowCountDiff()},children:(0,t.jsxs)(O.x,{textStyle:"sm",children:[(0,t.jsx)(o.J,{as:null===(n=(0,e_.N)("row_count_diff"))||void 0===n?void 0:n.icon})," Row Count Diff"]})}),(0,t.jsx)(E.sN,{value:"value-diff",disabled:!(g||f||j),onClick:async()=>{await d.runValueDiff()},children:(0,t.jsxs)(O.x,{textStyle:"sm",children:[(0,t.jsx)(o.J,{as:null===(i=(0,e_.N)("value_diff"))||void 0===i?void 0:i.icon})," Value Diff"]})})]}),(0,t.jsx)(E.Cl,{}),(0,t.jsxs)(E.GP,{m:"0",px:"12px",children:[(0,t.jsx)(E.U5,{children:"Add to Checklist"}),(0,t.jsx)(E.sN,{value:"lineage-diff",disabled:!(g||j&&c.length>1),onClick:()=>{d.addLineageDiffCheck(d.viewOptions.view_mode)},children:(0,t.jsxs)(O.x,{textStyle:"sm",children:[(0,t.jsx)(o.J,{as:null===(l=(0,e_.N)("lineage_diff"))||void 0===l?void 0:l.icon})," Lineage Diff"]})}),(0,t.jsx)(E.sN,{value:"schema-diff",disabled:!(g||f||j),onClick:()=>{d.addSchemaDiffCheck()},children:(0,t.jsxs)(O.x,{textStyle:"sm",children:[(0,t.jsx)(o.J,{as:null===(r=(0,e_.N)("schema_diff"))||void 0===r?void 0:r.icon})," Schema Diff"]})})]})]})})})]})})})]})})};var ip=i(54651);async function im(e){return(await g.U.post("/api/checks",{type:"lineage_diff",params:{},view_options:e})).data}function ij(){return(0,t.jsx)(l.x,{bg:"white",padding:"12px",borderWidth:"1px",borderColor:"gray.200",fontSize:"sm",children:Object.entries({added:["Added","Added resource"],removed:["Removed","Removed resource"],modified:["Modified","Modified resource"]}).map(e=>{let[n,[i,l]]=e,{icon:r,color:s}=ew(n);return(0,t.jsx)(el.u,{content:l,positioning:{placement:"right"},children:(0,t.jsxs)(c.k,{alignItems:"center",gap:"6px",marginBottom:"2px",children:[(0,t.jsx)(o.J,{color:s,as:r})," ",i]})},n)})})}var ig=i(86891);let iv={mode:"per_node",status:"pending",completed:0,total:0,actions:{}},iy=(e,n)=>{let{onActionStarted:i,onActionNodeUpdated:t,onActionCompleted:l}=n,r=(0,f.useRef)({...iv}).current,{showRunId:o}=(0,X.$q)(),s=async(n,s,a)=>{r.mode="multi_nodes",r.actions={};let c=r.mode,d=r.actions;i(),r.status="running";let u=[];for(let n of e){let e=s(n);e?(d[n.id]={mode:c,status:"skipped",skipReason:e},t(n)):(d[n.id]={mode:c,status:"pending"},u.push(n))}let h=a(u);try{let{run_id:e}=await (0,eY.g9)(n,h,{nowait:!0});for(o(e),r.currentRun={run_id:e},r.total=1;;){let n=await (0,eY.Qp)(e,2);r.currentRun=n;let i=n.error?"failure":n.result?"success":"running";for(let e of u)d[e.id]={mode:c,status:i,run:n},t(e);if(n.error||n.result)break}}catch(e){}if(r.completed=1,"canceling"===r.status){r.status="canceled",l();return}r.status="completed",l()},a=async(n,o)=>{r.mode="per_node",r.actions={};let s=r.mode,a=r.actions;for(let n of(i(),r.status="running",e))a[n.id]={mode:s,status:"pending"},t(n);for(let i of(r.completed=0,r.total=e.length,e)){let{params:e,skipReason:c}=o(i);if(c)a[i.id]={mode:s,status:"skipped",skipReason:c},t(i);else try{let{run_id:l}=await (0,eY.g9)(n,e,{nowait:!0});for(r.currentRun={run_id:l},a[i.id]={mode:s,status:"running"},t(i);;){let e=await (0,eY.Qp)(l,2);r.currentRun=e;let n=e.error?"failure":e.result?"success":"running";if(a[i.id]={mode:s,status:n,run:e},t(i),e.error||e.result)break}}catch(e){}finally{r.currentRun=void 0}if(r.completed++,"canceling"===r.status){r.status="canceled",l();return}}r.status="completed",l()},c=async()=>{let n=[];for(let i of e)"model"!==i.resourceType?(r.actions[i.id]={mode:"multi_nodes",status:"skipped",skipReason:"Not a model"},t(i)):n.push(i.name);await s("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 i of e)"model"!==i.resourceType?(r.actions[i.id]={mode:"multi_nodes",status:"skipped",skipReason:"Not a model"},t(i)):n.push(i.name);await s("row_count_diff",e=>{if("model"!==e.resourceType)return"Not a model"},e=>({node_names:e.map(e=>e.name)}))},u=async()=>{var e;r.status="canceling",(null===(e=r.currentRun)||void 0===e?void 0:e.run_id)&&await (0,eY.Eg)(r.currentRun.run_id)};return{actionState:r,runRowCount:c,runRowCountDiff:d,runValueDiff:async()=>{await a("value_diff",e=>{var n;let i=null===(n=e.data.current)||void 0===n?void 0:n.primary_key;return i?{params:{model:e.name,primary_key:i}}:{skipReason:"No primary key found. The first unique column is used as primary key."}})},addLineageDiffCheck:async()=>{let n=e.map(e=>e.id);return await im({node_ids:n})},addSchemaDiffCheck:async()=>{let n;if(1===e.length)n=await ng({node_id:e[0].id});else{let i=e.map(e=>e.id);n=await ng({node_id:i})}return n},cancel:u,reset:()=>{Object.assign(r,iv)}}};var ib=function(){let{open:e,onOpen:n,onClose:i}=(0,F.q)(),[r,o]=(0,f.useState)(0),[s,a]=(0,f.useState)(),d=(0,f.useRef)(null),u=(0,f.useCallback)(e=>(o(e),new Promise(e=>{a(()=>e),n()})),[n]),h=()=>{null==s||s(!1),i()};return{confirm:u,AlertDialog:(0,t.jsx)(q.GR,{size:"xl",open:e,role:"alertdialog",initialFocusEl:()=>d.current,onOpenChange:h,children:(0,t.jsxs)(T.h,{children:[(0,t.jsx)(q.ZR,{}),(0,t.jsx)(q.Qd,{children:(0,t.jsxs)(q.cZ,{children:[(0,t.jsx)(q.fK,{fontSize:"lg",fontWeight:"bold",children:(0,t.jsxs)(q.$N,{children:["Value Diff on ",r," nodes"]})}),(0,t.jsx)(q.a7,{gap:"20px",as:c.k,direction:"column",children:(0,t.jsxs)(l.x,{children:["Value diff will be executed on ",r," nodes in the Lineage, which can add extra costs to your bill."]})}),(0,t.jsxs)(q.cN,{gap:1,children:[(0,t.jsx)(L.z,{ref:d,onClick:h,variant:"outline",colorPalette:"gray",children:"Cancel"}),(0,t.jsx)(L.z,{colorPalette:"cyan",onClick:()=>{null==s||s(!0),i()},ml:3,children:"Execute"})]}),(0,t.jsx)(q.Rd,{asChild:!0,children:(0,t.jsx)(A.P,{size:"sm"})})]})})]})})}};let iw="recce",ik={recommendationIgnored:"".concat(iw,"-recommendation-ignored"),recommendationShowed:"".concat(iw,"-recommendation-showed"),prevRefreshTimeStamp:"".concat(iw,"-prev-refresh-timestamp"),lineageNotificationDismissed:"".concat(iw,"-lineage-notification-dismissed")},iC=()=>{var e;let n=(0,j.a)({queryKey:v.V.checks(),queryFn:w}),i=(0,f.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]),t=(0,j.a)({queryKey:(null==i?void 0:i.check_id)?v.V.check(i.check_id):[],queryFn:async()=>{if(null==i?void 0:i.check_id)return k(i.check_id)},enabled:!!(null==i?void 0:i.check_id)}),l=(0,j.a)({queryKey:(null==i?void 0:i.check_id)?[...v.V.check(i.check_id),"select"]:[],queryFn:async()=>{var e,n;return eu({select:null==i?void 0:null===(e=i.params)||void 0===e?void 0:e.select,exclude:null==i?void 0:null===(n=i.params)||void 0===n?void 0:n.exclude})},enabled:!!(null==i?void 0:null===(e=i.params)||void 0===e?void 0:e.select)}),r=(0,f.useMemo)(()=>{if(i){var e,n;if(null===(e=i.params)||void 0===e?void 0:e.node_names)return i.params.node_names;if(null===(n=i.params)||void 0===n?void 0:n.node_ids)return i.params.node_ids}if("success"===l.status&&l.data)return l.data.nodes},[i,l]);return{recommendedCheck:t.data,selectedNodes:r}},i_=()=>{let{readOnly:e}=(0,ee.$)(),{lineageGraph:n,envInfo:i}=(0,B.kJ)(),{showRunId:l}=(0,X.$q)(),{data:r}=(0,ny.P)(),o=(0,Z.NL)(),{recommendedCheck:s,selectedNodes:a}=iC(),[d,u]=(0,f.useState)(),[p,m]=(0,f.useState)(!1),[j,g]=(0,f.useState)(!1),[b,w]=(0,f.useState)(!1),{open:k,onOpen:C,onClose:_}=(0,F.q)(),S=ik.recommendationIgnored,z=ik.recommendationShowed,R=ik.prevRefreshTimeStamp;(0,f.useEffect)(()=>{sessionStorage.getItem(S)&&g(!0)},[S]),(0,f.useEffect)(()=>{var e,t,l,r,o,c,d,h,x,p;if(!s||!a)return;if(null===(e=s.last_run)||void 0===e?void 0:e.run_id){let e=new Date(s.last_run.run_at).getTime(),n=null==i?void 0:i.dbt,t=Math.max((null==n?void 0:null===(r=n.current)||void 0===r?void 0:r.generated_at)?new Date(n.current.generated_at).getTime():0,(null==n?void 0:null===(o=n.base)||void 0===o?void 0:o.generated_at)?new Date(n.base.generated_at).getTime():0);if(e>=t){m(!0);return}m(!1),w(!0);let l=sessionStorage.getItem(R);(null===l||parseInt(l)!==t)&&(sessionStorage.setItem(R,t.toString()),sessionStorage.removeItem(S),sessionStorage.removeItem(z),g(!1))}let f=e=>e.map(e=>{var i;return null==n?void 0:null===(i=n.nodes[e])||void 0===i?void 0:i.name}).join(", ");if(a.length>0&&a.length<=3){if(null===(c=s.params)||void 0===c?void 0:c.node_names){let e=null===(h=s.params)||void 0===h?void 0:h.node_names.join(", ");u("'".concat(e,"'"))}else if(null===(d=s.params)||void 0===d?void 0:d.node_ids){let e=f(null===(x=s.params)||void 0===x?void 0:x.node_ids);u("'".concat(e,"'"))}else if(a){let e=f(a);u("'".concat(e,"'"))}}else(null==n?void 0:n.modifiedSet.length)===a.length?u("modified and potentially impacted models"):(null===(t=s.params)||void 0===t?void 0:t.select)&&!(null===(l=s.params)||void 0===l?void 0:l.exclude)?u("'".concat(null===(p=s.params)||void 0===p?void 0:p.select,"'")):u("".concat(a.length," models"));if(!sessionStorage.getItem(z)){let e=sessionStorage.getItem(R);sessionStorage.setItem(z,"true"),(0,y.P6)({action:"recommend",from:null===e?"initial":"rerun"})}},[s,a,n,S,z,R,i]);let N=(0,f.useCallback)(async()=>{s&&(l((await (0,eY.rf)(s.check_id,{nowait:!0})).run_id),await o.invalidateQueries({queryKey:v.V.check(s.check_id)}))},[s,l,o]);if(!s||!a||(null==r?void 0:r.single_env_onboarding))return(0,t.jsx)(t.Fragment,{});let D=a.length;return!j&&!p&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.U,{width:"100%",padding:"2pt 8pt",backgroundColor:"cyan.50",children:(0,t.jsxs)(h.U,{flex:"1",fontSize:"10pt",color:"cyan.600",children:[b?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(nl._sk,{}),(0,t.jsx)(O.x,{children:"New dbt build detected - Re-run row count checks to maintain result accuracy"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(nl.yZ7,{}),(0,t.jsxs)(O.x,{children:["First Check: Perform a row count diff of ",d," for basic impact assessment"]})]}),(0,t.jsx)(x.L,{}),(0,t.jsx)(L.z,{size:"2xs",variant:"ghost",onClick:()=>{g(!0),sessionStorage.setItem(S,"true"),(0,y.P6)({action:"ignore",from:b?"rerun":"initial",nodes:D})},children:"Ignore"}),(0,t.jsx)(L.z,{colorPalette:"cyan",size:"2xs",onClick:()=>{C(),(0,y.P6)({action:"perform",from:b?"rerun":"initial",nodes:D})},disabled:e,children:"Perform"})]})}),(0,t.jsx)(q.GR,{open:k,onOpenChange:()=>{_(),(0,y.P6)({action:"close",from:b?"rerun":"initial",nodes:D})},placement:"center",children:(0,t.jsxs)(T.h,{children:[(0,t.jsx)(q.ZR,{}),(0,t.jsx)(q.Qd,{children:(0,t.jsxs)(q.cZ,{children:[(0,t.jsx)(q.fK,{children:(0,t.jsx)(q.$N,{children:"Row Count Check"})}),(0,t.jsx)(q.a7,{children:(0,t.jsxs)(eT.K,{gap:"4",children:[(0,t.jsxs)(O.x,{children:["Perform a row count check of the ",D," node(s) displayed in the lineage diff DAG."]}),(0,t.jsxs)(c.k,{bg:"blue.100",color:"blue.700",children:[(0,t.jsx)(nl.yZ7,{className:"mt-[0.625rem] ml=[0.3125rem]"}),(0,t.jsx)(O.x,{margin:"0.3125rem",paddingX:"0.1875rem",children:"This is a recommended first check based on the preset checks defined in your recce.yml file."})]})]})}),(0,t.jsxs)(q.cN,{gap:"0.3125rem",children:[(0,t.jsx)(L.z,{onClick:()=>{_(),(0,y.P6)({action:"close",from:b?"rerun":"initial",nodes:D})},children:"Cancel"}),(0,t.jsxs)(L.z,{colorPalette:"cyan",onClick:()=>{_(),N(),m(!0),(0,y.P6)({action:"execute",from:b?"rerun":"initial",nodes:D})},children:["Execute on ",D," models"]})]}),(0,t.jsx)(q.Rd,{asChild:!0,children:(0,t.jsx)(A.P,{size:"sm"})})]})})]})})]})},iS=e=>{let{changeStatus:n}=e;if(!n)return(0,t.jsx)(t.Fragment,{});let{color:i,icon:l}=ew(n);return(0,t.jsx)(o.J,{boxSize:"14px",display:"inline-flex",color:i,as:l})},iz=e=>{let{transformationType:n,legend:i}=e,l="U",r="red";return("passthrough"===n?(l="P",r="gray"):"renamed"===n?(l="R",r="orange"):"derived"===n?(l="D",r="orange"):"source"===n?(l="S",r="blue"):(l="U",r="red"),n)?(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(I.Hc,{fontSize:"8pt",size:"sm",colorPalette:r,borderRadius:"full",paddingX:"4px",children:(0,t.jsx)(I.Sn,{children:l})})}):(0,t.jsx)(t.Fragment,{})},iR=()=>{let{lineageGraph:e}=(0,B.kJ)(),{centerNode:n,viewOptions:i,cll:l}=ei(),r=i.column_level_lineage;if(!e)return(0,t.jsx)(t.Fragment,{});if(!r)return"Default View";if(void 0===r.node_id)return(0,t.jsx)(O.x,{as:"span",children:"Impact Radius for All Changed Models"});let o=r.node_id in e.nodes?e.nodes[r.node_id].name:r.node_id;if(r.column){let e="".concat(r.node_id,"_").concat(r.column);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(O.x,{as:"span",mr:"5px",children:["Column Lineage for"," "]}),(0,t.jsxs)(a.E,{onClick:()=>{n(e)},cursor:"pointer",children:[o,".",r.column]})]})}{let e=r.node_id;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(O.x,{as:"span",mr:"5px",children:"Impact Radius for"}),(0,t.jsx)(a.E,{onClick:()=>{n(e)},cursor:"pointer",children:o})]})}},iN=()=>{var e;let{showColumnLevelLineage:n,resetColumnLevelLineage:i,interactive:r,viewOptions:o}=ei(),{data:s}=(0,ny.P)(),a=null!==(e=null==s?void 0:s.single_env_onboarding)&&void 0!==e&&e;return(0,t.jsxs)(c.k,{direction:"row",gap:"5px",children:[!a&&(0,t.jsx)(l.x,{borderRadius:"md",boxShadow:"md",border:"1px solid",borderColor:"gray.200",bg:"white",children:(0,t.jsxs)(L.z,{size:"sm",variant:"ghost",whiteSpace:"nowrap",display:"inline-flex",disabled:!r,onClick:()=>{n({no_upstream:!0,change_analysis:!0})},children:[(0,t.jsx)(ef.hKE,{})," Impact Radius"]})}),o.column_level_lineage&&(0,t.jsxs)(c.k,{borderRadius:"md",boxShadow:"md",border:"1px solid",borderColor:"gray.200",bg:"white",fontSize:"0.8rem",p:"0 0.625rem",alignItems:"center",children:[(0,t.jsx)(iR,{}),(0,t.jsx)(P.h,{variant:"ghost",size:"xs",ml:"2","aria-label":"",onClick:()=>{i()},children:(0,t.jsx)(nl.y6L,{size:"10px"})})]})]})};function iD(){return(0,t.jsx)(l.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,[i,l]]=e;return(0,t.jsx)(el.u,{content:l,positioning:{placement:"right"},children:(0,t.jsxs)(c.k,{alignItems:"center",gap:"6px",marginBottom:"2px",children:[(0,t.jsx)(iz,{legend:!0,transformationType:n})," ",i]})},n)})})}function iF(e){let{notification:n,type:i}=e,l=ik.lineageNotificationDismissed,[r,o]=(0,f.useState)(!0);return((0,f.useEffect)(()=>{"true"===sessionStorage.getItem(l)&&o(!1)},[l]),null!==n&&r)?(0,t.jsxs)(c.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"}[i],children:[n,(0,t.jsx)(x.L,{}),(0,t.jsx)(A.P,{onClick:()=>{sessionStorage.setItem(l,"true"),o(!1)}})]}):null}function iq(){return(0,t.jsx)(c.k,{flex:"1",h:"100%",minH:0,m:"2",p:"4",bg:"blue.50",borderRadius:"lg",boxShadow:"md",justifyContent:"center",children:(0,t.jsxs)(c.k,{w:"80%",direction:"column",overflowY:"auto",gap:6,px:8,pb:8,children:[(0,t.jsxs)(c.k,{direction:"column",alignItems:"center",gap:4,children:[(0,t.jsx)(c.k,{p:2,bg:"white",borderRadius:"full",alignItems:"center",justifyContent:"center",boxShadow:"md",children:(0,t.jsx)(o.J,{as:ni.NJc,boxSize:7,color:"blue.500"})}),(0,t.jsx)(u.X,{mt:"4",size:"lg",children:"Wait, there's more!"}),(0,t.jsxs)(O.x,{fontSize:"md",textAlign:"center",children:["Recce is currently running in"," ",(0,t.jsx)(O.x,{fontWeight:"bold",as:"span",children:"limited functionality mode"})," ","so you can run queries but"," ",(0,t.jsx)(O.x,{fontWeight:"bold",as:"span",children:"can't diff the results yet!"})]})]}),(0,t.jsxs)(c.k,{direction:"column",gap:2,children:[(0,t.jsx)(O.x,{fontSize:"md",children:"To unlock the full power of Recce, set up a base environment of dbt artifacts for comparison."}),(0,t.jsx)(O.x,{children:"Once configured, you'll be able to:"}),(0,t.jsxs)(em.A0,{children:[(0,t.jsx)(em.HC,{children:(0,t.jsx)(O.x,{children:"Run statistical data diffs"})}),(0,t.jsx)(em.HC,{children:(0,t.jsx)(O.x,{children:"Run query diffs"})}),(0,t.jsx)(em.HC,{children:(0,t.jsx)(O.x,{children:"Save checks to your Recce Checklist"})}),(0,t.jsx)(em.HC,{children:(0,t.jsx)(O.x,{children:"...and more!"})})]}),(0,t.jsx)(O.x,{fontSize:"md",children:"Take the next step toward better data impact assessment."})]}),(0,t.jsx)(c.k,{w:"100%",direction:"column",mt:6,children:(0,t.jsx)(L.z,{colorPalette:"blue",size:"lg",onClick:()=>{window.open("https://docs.datarecce.io/get-started/#prepare-dbt-artifacts","_blank")},children:"Start Now"})})]})})}function iI(){return(0,t.jsxs)(c.k,{direction:"row",gap:"10px",alignItems:"flex-start",children:[(0,t.jsx)(o.J,{as:ni.LyC,color:"blue.500",boxSize:"5"}),(0,t.jsxs)(c.k,{direction:"column",gap:"5px",children:[(0,t.jsxs)(O.x,{fontWeight:"bold",children:["Single Environment Mode"," ",(0,t.jsx)(O.x,{color:"red",as:"span",children:"Limited Functionality"})]}),(0,t.jsx)(O.x,{fontSize:"sm",children:"Single Environment Mode allows you to explore your dbt project but won't show data comparisons between environments."}),(0,t.jsx)(O.x,{fontSize:"sm",children:"To set up full environment comparison:"}),(0,t.jsxs)(em.A0,{children:[(0,t.jsx)(em.HC,{children:(0,t.jsx)(O.x,{fontSize:"sm",children:"Run `recce debug` for setup assistance"})}),(0,t.jsx)(em.HC,{children:(0,t.jsxs)(O.x,{fontSize:"sm",children:["Visit"," ",(0,t.jsxs)(r.r,{color:"blue.500",fontSize:"sm",fontWeight:"medium",target:"_blank",href:"https://docs.datarecce.io/configure-diff/",children:["docs"," "]}),"for configuration details ",(0,t.jsx)(eU.$OI,{})]})})]})]})]})}async function iE(e){return(await g.U.post("/api/cll",e)).data}var iP=i(79538);let iT=e=>{let{menuItems:n,open:i,onClose:l,x:r,y:o}=e;return(0,t.jsx)(E.ZB,{open:i,onOpenChange:l,children:(0,t.jsx)(T.h,{children:(0,t.jsx)(E.Ku,{children:(0,t.jsx)(E.Dv,{fontSize:"10pt",position:"absolute",width:"250px",style:{left:"".concat(r,"px"),top:"".concat(o,"px")},children:0===n.length?(0,t.jsx)(E.sN,{value:"no-action",disabled:!0,children:"No action available"},"no action"):n.map(e=>{let{isSeparator:n,label:i,isDisabled:r,action:o,itemIcon:s}=e;return n?(0,t.jsx)(E.Cl,{},i):(0,t.jsxs)(E.sN,{value:String(i),disabled:r,onClick:()=>{o&&o(),l()},children:[s," ",i]},i)})})})})})},iL=e=>{var n,i,l,r,s,a,c,d,u,h,x;let{isOpen:p,onClose:m,x:f,y:j,node:g}=e,v=[],{selectParentNodes:y,selectChildNodes:b,getNodeColumnSet:w,selectMode:k,cll:C,showColumnLevelLineage:_}=ei(),{runAction:S}=(0,X.$q)(),{isActionAvailable:z}=(0,B.kJ)(),{data:R}=(0,ny.P)(),N=null!==(i=null==R?void 0:R.single_env_onboarding)&&void 0!==i&&i,{primaryKey:D}=(0,nj.ZP)(null==g?void 0:null===(n=g.data)||void 0===n?void 0:n.name),{setSqlQuery:F,setPrimaryKeys:q}=(0,nf.rV)(),[,I]=(0,eR.TH)();if(!(null==g?void 0:g.data))return(0,t.jsx)(t.Fragment,{});let E=g.data,P=E.resourceType,T=Array.from(w(g.id)),L={source:"lineage_model_node"};if("modified"===E.changeStatus&&v.push({label:"Show Impact Radius",itemIcon:(0,t.jsx)(ef.hKE,{}),action:()=>{_({node_id:g.id,change_analysis:!0,no_upstream:!0})}}),!k&&P&&["model","seed","snapshot"].includes(P)){v.length>0&&v.push({label:"select group",isSeparator:!0});let e=(0,e_.N)(N?"query":"query_diff"),n=n7(Object.keys(null!==(s=null===(l=E.data.base)||void 0===l?void 0:l.columns)&&void 0!==s?s:{}),Object.keys(null!==(a=null===(r=E.data.current)||void 0===r?void 0:r.columns)&&void 0!==a?a:{})),i='select * from {{ ref("'.concat(E.name,'") }}');if(n.length&&(i="select \n ".concat(n.join("\n "),'\nfrom {{ ref("').concat(E.name,'") }}')),v.push({label:"Query",itemIcon:(0,t.jsx)(o.J,{as:null==e?void 0:e.icon}),action:()=>{F(i),z("query_diff_with_primary_key")&&q(void 0!==D?[D]:void 0),I("/query")}}),T.length>0){if(void 0!==C){let n=new Set;D&&n.add(D),T.forEach(e=>{n.add(e)}),v.push({label:"Query Related Columns",itemIcon:(0,t.jsx)(o.J,{as:null==e?void 0:e.icon}),action:()=>{F("select \n ".concat(Array.from(n).join(",\n "),'\nfrom {{ ref("').concat(E.name,'") }}')),z("query_diff_with_primary_key")&&q(void 0!==D?[D]:void 0),I("/query")}})}else{let n=Object.entries(null!==(d=null===(c=E.change)||void 0===c?void 0:c.columns)&&void 0!==d?d:{}).filter(e=>{let[,n]=e;return"modified"===n}).map(e=>{let[n]=e;return n});if(n.length>0){let i=new Set;D&&i.add(D),n.forEach(e=>{i.add(e)}),v.push({label:"Query Modified Columns",itemIcon:(0,t.jsx)(o.J,{as:null==e?void 0:e.icon}),action:()=>{F("select \n ".concat(Array.from(i).join(",\n "),'\nfrom {{ ref("').concat(E.name,'") }}')),z("query_diff_with_primary_key")&&q(void 0!==D?[D]:void 0),I("/query")}})}}}e=(0,e_.N)(N?"row_count":"row_count_diff"),v.push({label:null!==(u=null==e?void 0:e.title)&&void 0!==u?u:"Row count",itemIcon:(0,t.jsx)(o.J,{as:null==e?void 0:e.icon}),action:()=>{S(N?"row_count":"row_count_diff",{node_names:[E.name]},{showForm:!1,trackProps:L})}}),e=(0,e_.N)(N?"profile":"profile_diff"),v.push({label:null!==(h=null==e?void 0:e.title)&&void 0!==h?h:"Profile",itemIcon:(0,t.jsx)(o.J,{as:null==e?void 0:e.icon}),action:()=>{let e=Array.from(w(g.id));S(N?"profile":"profile_diff",{model:E.name,columns:e},{showForm:!0,trackProps:L})}}),N||(e=(0,e_.N)("value_diff"),v.push({label:null!==(x=null==e?void 0:e.title)&&void 0!==x?x:"Value Diff",itemIcon:(0,t.jsx)(o.J,{as:null==e?void 0:e.icon}),action:()=>{let e=Array.from(w(g.id));S("value_diff",{model:E.name,columns:e},{showForm:!0,trackProps:L})}}))}return N||(v.length>0&&v.push({label:"select group",isSeparator:!0}),v.push({label:"Select Parent Nodes",itemIcon:(0,t.jsx)(iP.Cv2,{}),action:()=>{y(g.id,1)}}),v.push({label:"Select Child Nodes",itemIcon:(0,t.jsx)(iP.IMj,{}),action:()=>{b(g.id,1)}}),v.push({label:"Select All Upstream Nodes",itemIcon:(0,t.jsx)(iP.Cv2,{}),action:()=>{y(g.id)}}),v.push({label:"Select All Downstream Nodes",itemIcon:(0,t.jsx)(iP.IMj,{}),action:()=>{b(g.id)}})),(0,t.jsx)(iT,{x:f,y:j,menuItems:v,open:p,onClose:m})},iO=e=>{var n,i,l,r,s,a,c,d;let{isOpen:u,onClose:h,x,y:p,node:m}=e,f=[],{runAction:j}=(0,X.$q)(),{isActionAvailable:g}=(0,B.kJ)(),{data:v}=(0,ny.P)(),y=null!==(s=null==v?void 0:v.single_env_onboarding)&&void 0!==s&&s;if((null==m?void 0:m.data)===void 0)return(0,t.jsx)(t.Fragment,{});let b=m.data,w=b.node,k=b.column,C=b.type,_={source:"lineage_column_node"},S=(null===(i=w.data.base)||void 0===i?void 0:null===(n=i.columns)||void 0===n?void 0:n[k])===void 0||(null===(r=w.data.current)||void 0===r?void 0:null===(l=r.columns)||void 0===l?void 0:l[k])===void 0,z=(0,e_.N)(y?"profile":"profile_diff");return f.push({label:null!==(a=null==z?void 0:z.title)&&void 0!==a?a:"Profile",itemIcon:(0,t.jsx)(o.J,{as:null==z?void 0:z.icon}),action:()=>{j("profile_diff",{model:w.name,columns:[k]},{showForm:!1,trackProps:_})},isDisabled:S||!g("profile_diff")}),y||(z=(0,e_.N)("histogram_diff"),f.push({label:null!==(c=null==z?void 0:z.title)&&void 0!==c?c:"Histogram Diff",itemIcon:(0,t.jsx)(o.J,{as:null==z?void 0:z.icon}),action:()=>{j("histogram_diff",{model:w.name,column_name:k,column_type:C},{showForm:!1,trackProps:_})},isDisabled:S||!C||!(0,Y.d)(C)}),z=(0,e_.N)("top_k_diff"),f.push({label:null!==(d=null==z?void 0:z.title)&&void 0!==d?d:"Top-K Diff",itemIcon:(0,t.jsx)(o.J,{as:null==z?void 0:z.icon}),action:()=>{j("top_k_diff",{model:w.name,column_name:k,k:50},{showForm:!1,trackProps:_})},isDisabled:S})),(0,t.jsx)(iT,{x:x,y:p,menuItems:f,open:u,onClose:h})},iM=e=>{let{isOpen:n,onClose:i,x:l,y:r,node:o}=e,{readOnly:s}=(0,ee.$)();return s?(0,t.jsx)(iT,{menuItems:[],open:n,onClose:i,x:l,y:r}):(null==o?void 0:o.type)==="customNode"?(0,t.jsx)(iL,{x:l,y:r,isOpen:n,onClose:i,node:o}):(null==o?void 0:o.type)==="customColumnNode"?(0,t.jsx)(iO,{x:l,y:r,isOpen:n,onClose:i,node:o}):void 0},iA=()=>{let{open:e,onClose:n,onOpen:i}=(0,F.q)(),[t,l]=(0,f.useState)({x:0,y:0}),[r,o]=(0,f.useState)();return{props:{x:t.x,y:t.y,node:r,isOpen:e,onClose:n},showContextMenu:(e,n,t)=>{l({x:e,y:n}),o(t),i()},closeContextMenu:()=>{l({x:0,y:0}),o(void 0),n()}}},iJ={customNode:function(e){var n,i,r,s;let{data:a}=e,{id:d,resourceType:u,changeStatus:p}=a,m=(0,e3.oR)(e=>e.transform[2]>.3),{icon:j}=ek(u),[g,v]=(0,f.useState)(!1),{interactive:y,selectNode:b,selectMode:w,focusedNode:k,getNodeAction:C,getNodeColumnSet:_,isNodeHighlighted:S,isNodeSelected:R,isNodeShowingChangeAnalysis:N,showContextMenu:D,viewOptions:F,cll:q,showColumnLevelLineage:I}=ei(),E=null==q?void 0:null===(n=q.current.nodes[d])||void 0===n?void 0:n.change_category,P=S(d),T=R(d),L=(null===(i=F.column_level_lineage)||void 0===i?void 0:i.node_id)===d&&void 0===F.column_level_lineage.column,O=(null==k?void 0:k.id)===d||L,M=N(d),{icon:A,color:J,backgroundColor:V}=p?ew(p):{icon:void 0,color:"gray.400",backgroundColor:"gray.100"},K=M&&"non_breaking"===E?"dashed":"solid",H=a.name,U=_(a.id),Z=U.size>0,$="action_result"===w?C(a.id):void 0,B=m?"selecting"===w?T?J:"white":"action_result"!==w?O||T||g?V:"white":$?O||T||g?V:J:"white":O||T||g?J:V,Q="selecting"===w?T?"white":"inherit":"action_result"===w&&$&&!T?"white":"inherit",X="selecting"===w?T?"white":"inherit":"action_result"===w&&$&&!T?"white":"inherit",G="selecting"===w?T?"white":J:"action_result"===w?$&&!T?"white":"inherit":J;return(0,t.jsxs)(c.k,{cursor:"selecting"===w?"pointer":"inherit",direction:"column",width:"300px",transition:"box-shadow 0.2s ease-in-out",padding:0,filter:"action_result"===w?$?"none":"opacity(0.2) grayscale(50%)":P||O||T||g?"none":"opacity(0.2) grayscale(50%)",onMouseEnter:()=>{v(!0)},onMouseLeave:()=>{v(!1)},children:[(0,t.jsxs)(c.k,{borderColor:J,borderWidth:"2px",borderStyle:K,borderTopRadius:8,borderBottomRadius:Z?0:8,backgroundColor:B,height:"60px",children:[(0,t.jsx)(c.k,{bg:J,padding:y?"8px":"2px",borderRightWidth:"2px",borderColor:"selecting"===w?"#00000020":J,borderStyle:K,alignItems:"top",visibility:m?"inherit":"hidden",children:y&&(0,t.jsx)(nx,{checked:"selecting"===w&&T||"action_result"===w&&!!$,onClick:e=>{"action_result"!==w&&(e.stopPropagation(),b(a.id))}})}),(0,t.jsxs)(c.k,{flex:"1 0 auto",mx:"1",width:"100px",direction:"column",children:[(0,t.jsxs)(c.k,{width:"100%",textAlign:"left",fontWeight:"600",flex:"1",p:1,gap:"5px",alignItems:"center",visibility:m?"inherit":"hidden",children:[(0,t.jsx)(np,{name:H,color:Q,resourceType:u}),g?(0,t.jsxs)(t.Fragment,{children:["modified"===p&&(0,t.jsx)(el.u,{content:"Show Impact Radius",positioning:{placement:"top"},openDelay:500,children:(0,t.jsx)(z.M,{children:(0,t.jsx)(o.J,{boxSize:"14px",as:ef.hKE,color:"gray",cursor:"pointer",_hover:{color:"black"},onClick:e=>{e.preventDefault(),e.stopPropagation(),I({node_id:d,change_analysis:!0,no_upstream:!0})}})})}),(0,t.jsx)(o.J,{as:W.D_A,color:"gray",cursor:"pointer",_hover:{color:"black"},onClick:n=>{n.preventDefault(),n.stopPropagation(),D(n,e)}})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.J,{boxSize:"16px",color:X,as:j}),p&&(0,t.jsx)(o.J,{color:G,as:A})]})]}),(0,t.jsx)(c.k,{flex:"1 0 auto",mx:"1",direction:"column",paddingBottom:"1",visibility:m?"inherit":"hidden",children:(0,t.jsx)(h.U,{gap:"8px",children:$?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(x.L,{}),(0,t.jsx)(nc,{node:a,action:$})]}):M?(0,t.jsx)(l.x,{height:"20px",color:"gray",fontSize:"9pt",margin:0,fontWeight:600,children:E?nu[E]:""}):"action_result"!==w&&"model"===a.resourceType?(0,t.jsx)(nh,{id:a.id,inverted:"selecting"===w&&!!T}):(0,t.jsx)(t.Fragment,{})})})]})]}),Z&&(0,t.jsx)(l.x,{p:"10px 10px",borderColor:J,borderWidth:"2px",borderTopWidth:0,borderStyle:K,borderBottomRadius:8,children:(0,t.jsx)(l.x,{height:"".concat(U.size*e4.O$,"px"),overflow:"auto"})}),Object.keys(null!==(r=a.parents)&&void 0!==r?r:{}).length>0&&(0,t.jsx)(e3.HH,{type:"target",position:e3.Ly.Left,isConnectable:!1}),Object.keys(null!==(s=a.children)&&void 0!==s?s:{}).length>0&&(0,t.jsx)(e3.HH,{type:"source",position:e3.Ly.Right,isConnectable:!1})]})},customColumnNode:function(e){var n,i;let{id:r,data:s}=e,{id:a}=s.node,{column:d,type:u,transformationType:h,changeStatus:p}=s,m=(0,e3.oR)(e=>e.transform[2]>.3),{viewOptions:j,showContextMenu:g,isNodeHighlighted:v,isNodeShowingChangeAnalysis:y}=ei(),b=null===(n=j.column_level_lineage)||void 0===n?void 0:n.node_id,w=d===(null===(i=j.column_level_lineage)||void 0===i?void 0:i.column)&&a===b,[k,C]=f.useState(!1),_=v(r),S=y(a);return m?(0,t.jsxs)(c.k,{width:"280px",padding:"0px 10px",border:"1px solid gray",backgroundColor:w?"#f0f0f0":"inherit",_hover:{backgroundColor:"#f0f0f0"},onMouseEnter:()=>{C(!0)},onMouseLeave:()=>{C(!1)},filter:_?"none":"opacity(0.2) grayscale(50%)",cursor:"pointer",children:[(0,t.jsxs)(c.k,{fontSize:"11px",color:"black",width:"100%",gap:"3px",alignItems:"center",height:"".concat(e4.O$-1,"px"),children:[S&&p?(0,t.jsx)(iS,{changeStatus:p}):(0,t.jsx)(iz,{transformationType:h}),(0,t.jsx)(l.x,{height:"".concat(e4.O$+1,"px"),children:d}),(0,t.jsx)(x.L,{}),k?(0,t.jsx)(o.J,{as:W.D_A,boxSize:"14px",display:"inline-flex",cursor:"pointer",_hover:{color:"black"},onClick:n=>{n.preventDefault(),n.stopPropagation(),g(n,e)}}):(0,t.jsx)(l.x,{height:"".concat(e4.O$+1," px"),children:u})]}),(0,t.jsx)(e3.HH,{type:"target",position:e3.Ly.Left,isConnectable:!1,style:{left:0,visibility:"hidden"}}),(0,t.jsx)(e3.HH,{type:"source",position:e3.Ly.Right,isConnectable:!1,style:{right:0,visibility:"hidden"}})]}):(0,t.jsx)(t.Fragment,{})}},iV=[],iK={customEdge:function(e){let{source:n,target:i,sourceX:l,sourceY:r,targetX:o,targetY:s,sourcePosition:a,targetPosition:c,style:d={},markerEnd:u,data:h}=e,x={...d},{isEdgeHighlighted:p}=ei();(null==h?void 0:h.changeStatus)&&(x.stroke=ew(h.changeStatus).color,x.strokeDasharray="5"),p(n,i)||(x.filter="opacity(0.2) grayscale(50%)");let[m]=(0,e3.OQ)({sourceX:l,sourceY:r,sourcePosition:a,targetX:o,targetY:s,targetPosition:c});return(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(e3.u5,{path:m,markerEnd:u,style:{...x,...d}})})}},iH=e=>e.data.changeStatus?ew(e.data.changeStatus).hexColor:"lightgray",iU=(e,n)=>{let i=e.current,t=(0,f.useRef)({width:0,height:0});(0,f.useEffect)(()=>{let e=new ResizeObserver(e=>{for(let i of e){let e=i.contentRect.width,l=i.contentRect.height;(Math.abs(l-t.current.height)>10||Math.abs(e-t.current.width)>10)&&t.current.height>0&&l>0&&t.current.width>0&&e>0&&n(),t.current={width:e,height:l}}});return i&&e.observe(i),()=>{i&&e.unobserve(i)}},[i,t,n])},iW=()=>{let[,e]=(0,eR.TH)();return(0,f.useCallback)(n=>{n.check_id&&e("/checks/".concat(n.check_id))},[e])},iZ=(0,f.forwardRef)(function(e,n){var i;let{interactive:r=!1,...s}=e,a=(0,e3._K)(),d=(0,f.useRef)(null),{successToast:u,failToast:h}=eI(),{copyToClipboard:x,ImageDownloadModal:p,ref:m}=nN({renderLibrary:"html-to-image",imageType:"png",shadowEffect:!0,backgroundColor:"white",ignoreElements:e=>e.className.includes(nR),onSuccess:()=>{u("Copied the Lineage View as an image to clipboard")},onError:e=>{console.error("Error taking screenshot",e),h("Failed to copy image to clipboard",e)}}),[j,g,v]=(0,e3.Rr)(iV),[b,w,k]=(0,e3.ll)([]),{lineageGraph:C,retchLineageGraph:_,isLoading:S,error:N,refetchRunsAggregated:D}=(0,B.kJ)(),{data:F}=(0,ny.P)(),{runId:q,showRunId:I,closeRunResult:E,runAction:P,isRunResultOpen:T}=(0,X.$q)(),{run:M}=nb(q),[A,J]=(0,f.useState)({...s.viewOptions}),V=(0,f.useRef)([]).current,[K,H]=(0,f.useState)(void 0),[U,W]=(0,f.useState)({}),Z=e=>j.find(n=>n.data.name===e);(0,f.useImperativeHandle)(n,()=>({copyToClipboard:x}));let $=(0,f.useMemo)(()=>!!C&&C.modifiedSet.length>0,[C]),Q=null!==(i=A.view_mode)&&void 0!==i?i:"changed_models",Y=(0,f.useMemo)(()=>j.filter(e=>"customNode"===e.type).map(e=>e.id),[j]),ee=(0,f.useMemo)(()=>C?Y.map(e=>C.nodes[e]):[],[C,Y]),[ei,et]=(0,f.useState)(),el=ei?null==C?void 0:C.nodes[ei]:void 0,[er,eo]=(0,f.useState)(),[es,ea]=(0,f.useState)(new Set),ec=(0,f.useMemo)(()=>C?Array.from(es).map(e=>C.nodes[e]):[],[C,es]),ed=iy(ec.length>0?ec:ee,{onActionStarted:()=>{eo("action_result")},onActionNodeUpdated:e=>{g(n=>n.map(n=>n.id===e.id?{...n}:n))},onActionCompleted:()=>{}}),eh=(0,f.useMemo)(()=>C?K?new Set([...Object.keys(K.current.nodes),...Object.keys(K.current.columns)]):new Set("action_result"===er?new Set(Object.keys(ed.actionState.actions)):el?(0,ip.G0)((0,e4.cr)(C,[el.id]),(0,e4._e)(C,[el.id])):$?(0,e4._e)(C,C.modifiedSet):new Set(Y)):new Set,[C,K,er,el,$,ed.actionState.actions,Y]),ep=iA();(0,f.useLayoutEffect)(()=>{(async()=>{var e,n,i,t;let l,r;if(!C)return;if(A.node_ids)r=A.node_ids;else{let i=null===(e=C.manifestMetadata.current)||void 0===e?void 0:e.project_name,t={view_mode:null!==(n=A.view_mode)&&void 0!==n?n:$?"changed_models":"all",packages:i?[i]:void 0,...s.viewOptions};try{r=(await eu({select:t.select,exclude:t.exclude,packages:t.packages,view_mode:t.view_mode})).nodes}catch(e){t.view_mode="all",r=(await eu({select:t.select,exclude:t.exclude,packages:t.packages,view_mode:t.view_mode})).nodes}J(t)}if(A.column_level_lineage)try{l=await iE(A.column_level_lineage)}catch(e){if(e instanceof ig.d7){eq.m.create({title:"Column Level Lineage error",description:null!==(t=null===(i=e.response)||void 0===i?void 0:i.data.detail)&&void 0!==t?t:e.message,type:"error",closable:!0});return}}let[o,a,c]=(0,e4.mF)(C,{selectedNodes:r,cll:l});(0,e4.bK)(o,a),g(o),w(a),W(c),H(l)})()},[C]);let em=()=>{et(void 0)},ef=e=>{let n=j.find(n=>n.id===e);if(n){if(n.parentId){var i;let e=n.parentId;n=null!==(i=j.find(n=>n.id===e))&&void 0!==i?i:n}if(n.width&&n.height){let e=n.position.x+n.width/2,i=n.position.y+n.height/2,t=a.getZoom();a.setCenter(e,i,{zoom:t,duration:200})}}},ej=iW();iU(d,()=>{"selecting"!==er&&(ei?ef(ei):a.fitView({nodes:j,duration:200}))});let eg=async function(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=A.column_level_lineage;await ek({...A,column_level_lineage:e},!1),n||V.push(i),(null==e?void 0:e.node_id)?et(e.node_id):et(void 0)},ev=async e=>{if(e){if(0===V.length)return;let e=V.pop();e?await eg(e,!0):await eg(void 0,!0)}else await eg(void 0,!0)},ey=(e,n)=>{er||eg({node_id:n.data.node.id,column:n.data.column})},eb=(e,n)=>{if(r&&C){if("customColumnNode"===n.type){ey(e,n);return}if(e_(),er){if("action_result"===er){var i;let e=ed.actionState.actions[n.id];(null===(i=e.run)||void 0===i?void 0:i.run_id)&&I(e.run.run_id),et(n.id)}else{let e=new Set(es);es.has(n.id)?e.delete(n.id):e.add(n.id),ea(e),0===e.size&&eo(void 0)}}else et(n.id)}},ew=async e=>{var n,i,t,l,r;let o,s;let{viewOptions:c=A,fitView:d}=e;if(!C)return;if(A.select!==c.select||A.exclude!==c.exclude||A.packages!==c.packages||A.view_mode!==c.view_mode){try{let e=await eu({select:c.select,exclude:c.exclude,packages:c.packages,view_mode:c.view_mode});c.column_level_lineage=void 0,s=e.nodes}catch(e){e instanceof ig.d7&&eq.m.create({title:"Select node error",description:null!==(t=null===(i=e.response)||void 0===i?void 0:i.data.detail)&&void 0!==t?t:e.message,type:"error",closable:!0});return}et(void 0)}else s=j.map(e=>e.id);if(c.column_level_lineage)try{o=await iE(c.column_level_lineage)}catch(e){if(e instanceof ig.d7){eq.m.create({title:"Column Level Lineage error",description:null!==(r=null===(l=e.response)||void 0===l?void 0:l.data.detail)&&void 0!==r?r:e.message,type:"error",closable:!0});return}}let[u,h,x]=(0,e4.mF)(C,{selectedNodes:s,cll:o});g(u),w(h),W(x),H(o),(null==M?void 0:null===(n=M.params)||void 0===n?void 0:n.model)&&!Z(M.params.model)&&E(),d&&(await new Promise(e=>setTimeout(e,1)),a.fitView({nodes:u,duration:200}))},ek=async function(e){let n=!(arguments.length>1)||void 0===arguments[1]||arguments[1];J(e),await ew({viewOptions:e,fitView:n})},eC=ib();(0,f.useEffect)(()=>{let e=null==M?void 0:M.type;if(!(!r||!T||!e||["query_diff","query","row_count"].includes(e))&&!er){var n;let e=null===(n=M.params)||void 0===n?void 0:n.model,i=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window});if(e){let n=Z(e);n?el!==n.data&&eb(i,n):ek({...A,view_mode:"all"})}else em()}},[M,A,T,er]);let e_=()=>{ep.closeContextMenu()},eS=(e,n)=>{if(!r||"action_result"===er)return;e.preventDefault();let i=m.current,t=i.getBoundingClientRect(),l=e.clientX-t.left,o=e.clientY-t.top+i.offsetTop;ep.showContextMenu(l,o,n)},ez=()=>{eo(void 0),ea(new Set),et(void 0),E(),null==D||D()},eR={interactive:r,nodes:j,focusedNode:el,selectedNodes:ec,viewOptions:A,showContextMenu:eS,onViewOptionsChanged:ek,selectMode:er,selectNode:e=>{if(er){if("selecting"===er){let n=new Set(es);es.has(e)?n.delete(e):n.add(e),ea(n),0===n.size&&eo(void 0)}}else{if(!C)return;ea(new Set([e])),eo("selecting"),et(void 0),ed.reset()}},selectParentNodes:function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;if("action_result"===er||void 0===C)return;!er&&(eo("selecting"),ed.reset(),A.column_level_lineage&&ek({...A,column_level_lineage:void 0}));let i=(0,e4.cr)(C,[e],n);ea((0,ip.G0)(es,i))},selectChildNodes:function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;if("action_result"===er||void 0===C)return;!er&&(eo("selecting"),ed.reset(),A.column_level_lineage&&ek({...A,column_level_lineage:void 0}));let i=(0,e4._e)(C,[e],n);ea((0,ip.G0)(es,i))},deselect:ez,isNodeHighlighted:e=>eh.has(e),isNodeSelected:e=>es.has(e),isEdgeHighlighted:(e,n)=>K?e in K.current.parent_map&&n in K.current.parent_map[e]:eh.has(e)&&eh.has(n),isNodeShowingChangeAnalysis:e=>{var n;if(!C)return!1;let i=e in C.nodes?C.nodes[e]:void 0;if(null===(n=A.column_level_lineage)||void 0===n?void 0:n.change_analysis){let n=A.column_level_lineage;return n.node_id&&!n.column?n.node_id===e&&!!(null==i?void 0:i.changeStatus):!!(null==i?void 0:i.changeStatus)}return!1},getNodeAction:e=>ed.actionState.actions[e],getNodeColumnSet:e=>e in U?new Set(U[e]):new Set,runRowCount:async()=>{"selecting"===er?(await ed.runRowCount(),(0,y.oq)({type:"row_count",selected:"multi"})):el?(P("row_count",{node_names:[el.name]},{showForm:!1,showLast:!1}),(0,y.oq)({type:"row_count",selected:"single"})):(P("row_count",{select:A.select,exclude:A.exclude,packages:A.packages,view_mode:A.view_mode}),(0,y.oq)({type:"row_count",selected:"none"}))},runRowCountDiff:async()=>{"selecting"===er?(await ed.runRowCountDiff(),(0,y.oq)({type:"row_count_diff",selected:"multi"})):el?(P("row_count_diff",{node_names:[el.name]},{showForm:!1,showLast:!1}),(0,y.oq)({type:"row_count_diff",selected:"single"})):(P("row_count_diff",{select:A.select,exclude:A.exclude,packages:A.packages,view_mode:A.view_mode}),(0,y.oq)({type:"row_count_diff",selected:"none"}))},runValueDiff:async()=>{if(el)P("value_diff",{model:el.name},{showForm:!0,showLast:!1}),(0,y.oq)({type:"value_diff",selected:"single"});else{let e="selecting"===er?ec.length:Y.length;await eC.confirm(e)&&(await ed.runValueDiff(),(0,y.oq)({type:"value_diff",selected:"selecting"===er?"multi":"none"}))}},addLineageDiffCheck:async()=>{let e;"selecting"===er?(e=await ed.addLineageDiffCheck(),ez(),(0,y.oq)({type:"lineage_diff",selected:"multi"})):el||(e=await im(A),(0,y.oq)({type:"lineage_diff",selected:"none"})),e&&ej(e)},addSchemaDiffCheck:async()=>{let e;"selecting"===er?ec.length>0&&(e=await ed.addSchemaDiffCheck(),ez(),(0,y.oq)({type:"schema_diff",selected:"multi"})):el?(e=await ng({node_id:el.id}),(0,y.oq)({type:"schema_diff",selected:"single"})):(e=await ng({select:A.select,exclude:A.exclude,packages:A.packages,view_mode:A.view_mode}),(0,y.oq)({type:"schema_diff",selected:"none"})),e&&ej(e)},cancel:ed.cancel,actionState:ed.actionState,centerNode:ef,cll:K,showColumnLevelLineage:eg,resetColumnLevelLineage:ev};return S?(0,t.jsx)(c.k,{width:"100%",height:"100%",alignItems:"center",justifyContent:"center",children:(0,t.jsx)(G.$,{size:"xl"})}):N?(0,t.jsx)(z.M,{h:"100%",children:(0,t.jsxs)(R.g,{children:[(0,t.jsx)(l.x,{children:"Failed to load lineage data. This could be because the server has been terminated or there is a network error."}),(0,t.jsxs)(l.x,{children:["[Reason: ",N,"]"]}),(0,t.jsx)(L.z,{colorPalette:"blue",onClick:()=>{_&&_()},children:"Retry"})]})}):C&&j!=iV?"changed_models"!==Q||C.modifiedSet.length?(0,t.jsxs)(en.Provider,{value:eR,children:[(0,t.jsxs)(ex,{sizes:el?[70,30]:[100,0],minSize:el?400:0,gutterSize:el?5:0,style:{height:"100%",width:"100%"},children:[(0,t.jsxs)(R.g,{ref:d,separator:(0,t.jsx)(e8.n,{borderColor:"gray.200"}),gap:0,style:{contain:"strict"},position:"relative",children:[r&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ix,{}),(0,t.jsx)(i_,{})]}),(0,t.jsxs)(e3.x$,{proOptions:{hideAttribution:!0},nodeTypes:iJ,edgeTypes:iK,nodes:j,edges:b,onNodesChange:v,onEdgesChange:k,onNodeClick:eb,onNodeContextMenu:eS,onClick:e_,onInit:()=>{if($)a.fitView();else{let e=(0,e3.RX)(j);a.setCenter(e.x+e.width/2,e.y+e.height/2,{zoom:1})}},maxZoom:1,minZoom:.1,nodesDraggable:r,ref:m,children:[(0,t.jsx)(e9.A,{color:"#ccc"}),(0,t.jsx)(e6.Z,{showInteractive:!1,position:"top-right",className:nR,children:(0,t.jsx)(e6.B,{title:"copy image",onClick:async()=>{await x(),(0,y.nO)({type:Q,from:"lineage_view"})},children:(0,t.jsx)(o.J,{as:nn.C3L})})}),(0,t.jsx)(p,{}),(0,t.jsx)(e3.s_,{position:"bottom-left",children:(0,t.jsxs)(c.k,{direction:"column",gap:"5px",children:[$&&(0,t.jsx)(ij,{}),A.column_level_lineage&&(0,t.jsx)(iD,{})]})}),(0,t.jsx)(e3.s_,{position:"top-center",children:(0,t.jsx)(iF,{notification:(null==F?void 0:F.single_env_onboarding)?(0,t.jsx)(iI,{}):null,type:"info"})}),(0,t.jsx)(e3.s_,{position:"top-left",children:(0,t.jsxs)(c.k,{direction:"column",gap:"5px",children:[(0,t.jsx)(iN,{}),0==j.length&&(0,t.jsx)(O.x,{fontSize:"xl",color:"grey",opacity:.5,children:"No nodes"})]})}),(0,t.jsx)(e7.a,{nodeColor:iH,nodeStrokeWidth:3,zoomable:!0,pannable:!0}),"action_result"===er&&(0,t.jsx)(e3.s_,{position:"bottom-center",className:nR,children:(0,t.jsx)(ii,{onClose:()=>{ez()}})})]}),(0,t.jsx)(iM,{...ep.props})]}),el?(0,t.jsx)(l.x,{borderLeft:"solid 1px lightgray",height:"100%",children:(0,t.jsx)(ie,{node:el,onCloseNode:em})}):(0,t.jsx)(l.x,{})]}),eC.AlertDialog]}):(0,t.jsx)(z.M,{h:"100%",children:(0,t.jsxs)(R.g,{children:[(0,t.jsx)(t.Fragment,{children:"No change detected"}),(0,t.jsx)(L.z,{colorPalette:"blue",onClick:async()=>{await ek({...A,view_mode:"all"})},children:"Show all nodes"})]})}):(0,t.jsx)(t.Fragment,{})}),i$=(0,f.forwardRef)(function(e,n){let{check:i}=e,l={...i.params,...i.view_options};return(0,t.jsx)(c.k,{direction:"column",height:"100%",children:(0,t.jsx)(e3.tV,{children:(0,t.jsx)(iZ,{viewOptions:l,interactive:!1,ref:n})})})});function iB(e){let{yamlTemplate:n}=e;return(0,t.jsx)(eL.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 iQ(){return{markedAsApprovedToast:function(){eq.m.create({title:"Marked as approved",type:"success",duration:2e3})}}}function iX(){let e=(0,D._)(["\n <details><summary>","</summary>\n\n ","\n\n </details>"]);return iX=function(){return e},e}let iG=(e,n)=>"schema_diff"!==e&&"lineage_diff"!==e&&(!(null==n?void 0:n.result)||!!n.error),iY=e=>{var n,i,r,s,a,d,m,g,b,w,S,N,D;let{checkId:K,refreshCheckList:H}=e,{readOnly:B}=(0,ee.$)(),Q=(0,Z.NL)(),[,X]=(0,eR.TH)(),{successToast:G,failToast:Y}=eI(),{markedAsApprovedToast:en}=iQ(),[ei,et]=(0,f.useState)(),[er,eo]=(0,f.useState)(),[es,ea]=(0,f.useState)(!1),[ec,ed]=(0,f.useState)(""),{open:eu,onOpen:eh,onClose:ex}=(0,F.q)(),em=()=>(0,t.jsx)(q.ZR,{bg:"blackAlpha.300",backdropFilter:"blur(10px) "}),[ef,ej]=(0,f.useState)((0,t.jsx)(em,{})),{isLoading:eg,error:ev,data:ey}=(0,j.a)({queryKey:v.V.check(K),queryFn:async()=>k(K),refetchOnMount:!0}),eb=null!=ei?ei:null==ey?void 0:null===(n=ey.last_run)||void 0===n?void 0:n.run_id,{run:ew,error:ek}=nb(eb),eC=ei?!ew||"running"===ew.status:(null==ew?void 0:ew.status)==="running",eS=(null==ey?void 0:ey.type)?(0,e_.N)(ey.type):void 0,eN=null!==(d=null==ey?void 0:ey.is_preset)&&void 0!==d&&d,eq=(0,f.useRef)(null),{mutate:eT}=(0,$.D)({mutationFn:e=>C(K,e),onSuccess:async()=>{await Q.invalidateQueries({queryKey:v.V.check(K)}),await Q.invalidateQueries({queryKey:v.V.checks()})}}),{mutate:eL}=(0,$.D)({mutationFn:()=>_(K),onSuccess:async()=>{await Q.invalidateQueries({queryKey:v.V.checks()}),X("/checks")}}),eO=(0,f.useCallback)(async()=>{(null==ey?void 0:ey.type)&&(et((await (0,eY.rf)(K,{nowait:!0})).run_id),await Q.invalidateQueries({queryKey:v.V.check(K)}),H&&H())},[ey,K,et,Q,H]),eM=(0,f.useCallback)(async()=>{if(ea(!0),eb)return await (0,eY.Eg)(eb)},[eb]),eA=async()=>{var e;if(!ey)return;let n=(e=ey,(0,eF.RI)(iX(),"".concat(e.is_checked?"✅ ":"").concat(e.name),function(e){if("query"===e.type||"query_diff"===e.type){var n;return"".concat(eP(e),"\n\n").concat((0,eF.Pn)(eE(),null===(n=e.params)||void 0===n?void 0:n.sql_template))}return eP(e)}(e)));if(!window.isSecureContext){Y("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),G("Copied the check to the clipboard")}catch(e){Y("Failed to copy the check to clipboard",e)}},eJ=(0,f.useCallback)(()=>{let e=null==ey?void 0:ey.is_checked;eT({is_checked:!e}),e||en()},[null==ey?void 0:ey.is_checked,eT,en]),[eV,eK]=(0,f.useState)("result"),{ref:eH,onCopyToClipboard:eU,onMouseEnter:eW,onMouseLeave:eZ}=nD();if((0,f.useEffect)(()=>{var e,n,i;ed(function(e){let{name:n,description:i,type:t,params:l,viewOptions:r}=e,o={name:n,description:i,type:t,params:l};return r&&(o.view_options=r),nw.ZP.stringify({checks:[o]})}({name:null!==(e=null==ey?void 0:ey.name)&&void 0!==e?e:"",description:null!==(n=null==ey?void 0:ey.description)&&void 0!==n?n:"",type:null!==(i=null==ey?void 0:ey.type)&&void 0!==i?i:"",params:null==ey?void 0:ey.params,viewOptions:null==ey?void 0:ey.view_options}))},[ey]),eg)return(0,t.jsx)(z.M,{h:"100%",children:"Loading"});if(ev)return(0,t.jsxs)(z.M,{h:"100%",children:["Error: ",ev.message]});let e$=(null==ew?void 0:ew.run_at)?(0,e5.Q)(new Date(ew.run_at),{addSuffix:!0}):null;return(0,t.jsxs)(ep,{minSize:100,sizes:[30,70],style:{height:"100%",width:"100%",maxHeight:"100%"},children:[(0,t.jsxs)(l.x,{style:{contain:"strict"},display:"flex",flexDirection:"column",children:[(0,t.jsxs)(c.k,{p:"0px 16px",alignItems:"center",h:"40px",children:[(0,t.jsx)(U,{name:null!==(m=null==ey?void 0:ey.name)&&void 0!==m?m:"",setName:e=>{eT({name:e})}}),eN&&(0,t.jsx)(el.u,{content:"Preset Check defined in recce config",children:(0,t.jsxs)(I.Hc,{size:"sm",flex:"0 0 auto",ml:"2",children:[(0,t.jsx)(I.al,{children:(0,t.jsx)(J.bX4,{size:"14px"})}),(0,t.jsx)(I.Sn,{children:"Preset"})]})}),(0,t.jsx)(x.L,{}),(0,t.jsxs)(h.U,{mr:"10px",children:[e$&&(0,t.jsx)(l.x,{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",fontSize:"10pt",children:e$}),(0,t.jsxs)(E.ZB,{children:[(0,t.jsx)(E.bF,{asChild:!0,children:(0,t.jsx)(P.h,{rounded:"full",variant:"ghost",size:"sm",children:(0,t.jsx)(o.J,{as:W.D_A})})}),(0,t.jsx)(T.h,{children:(0,t.jsx)(E.Ku,{children:(0,t.jsxs)(E.Dv,{children:[(0,t.jsx)(E.sN,{value:"preset-check-template",onClick:()=>{ej((0,t.jsx)(em,{})),eh()},children:(0,t.jsxs)(c.k,{alignItems:"center",gap:1,textStyle:"sm",children:[(0,t.jsx)(V.ovA,{})," Get Preset Check Template"]})}),(0,t.jsx)(E.sN,{value:"copy-markdown",onClick:()=>eA(),children:(0,t.jsxs)(c.k,{alignItems:"center",gap:1,textStyle:"sm",children:[(0,t.jsx)(nl.j90,{})," Copy Markdown"]})}),(0,t.jsx)(E.Cl,{}),(0,t.jsx)(E.sN,{value:"delete",color:"red.solid",onClick:()=>{eL()},disabled:B,children:(0,t.jsxs)(c.k,{alignItems:"center",gap:1,textStyle:"sm",children:[(0,t.jsx)(nl.VeE,{})," Delete"]})})]})})})]}),(0,t.jsx)(el.u,{content:iG(null!==(g=null==ey?void 0:ey.type)&&void 0!==g?g:"",ew)?"Run the check first":(null==ey?void 0:ey.is_checked)?"Mark as Pending":"Mark as Approved",positioning:{placement:"bottom-end"},children:(0,t.jsxs)(L.z,{flex:"0 0 auto",size:"sm",colorPalette:(null==ey?void 0:ey.is_checked)?"green":"gray",variant:(null==ey?void 0:ey.is_checked)?"solid":"outline",onClick:()=>{eJ()},disabled:iG(null!==(b=null==ey?void 0:ey.type)&&void 0!==b?b:"",ew)||B,children:[(null==ey?void 0:ey.is_checked)?(0,t.jsx)(nl.T23,{}):(0,t.jsx)(o.J,{as:W.Rbx,color:"lightgray"})," ",(null==ey?void 0:ey.is_checked)?"Approved":"Mark as Approved"]})})]})]}),(0,t.jsx)(l.x,{flex:"1",p:"8px 16px",minHeight:"100px",children:(0,t.jsx)(eD,{value:null==ey?void 0:ey.description,onChange:e=>{eT({description:e})}},null==ey?void 0:ey.check_id)})]}),(0,t.jsx)(l.x,{style:{contain:"strict"},children:(0,t.jsxs)(p.U2,{height:"100%",display:"flex",flexDirection:"column",value:eV,onValueChange:e=>{eK(e.value)},children:[(0,t.jsxs)(p.dr,{height:"50px",children:[(0,t.jsx)(p.SP,{value:"result",fontSize:"0.75rem",children:"Result"}),((null==ey?void 0:ey.type)==="query"||(null==ey?void 0:ey.type)==="query_diff")&&(0,t.jsx)(p.SP,{value:"query",fontSize:"0.75rem",children:"Query"}),(0,t.jsx)(x.L,{}),(0,t.jsxs)(h.U,{mr:"10px",children:[(null==eS?void 0:eS.RunResultView)&&(0,t.jsx)(el.u,{content:"Rerun",children:(0,t.jsxs)(L.z,{variant:"outline",loading:eC,size:"sm",onClick:()=>eO(),disabled:B,children:[(0,t.jsx)(nl.JXV,{})," Rerun"]})}),(0,t.jsxs)(L.z,{variant:"outline",disabled:iG(null!==(w=null==ey?void 0:ey.type)&&void 0!==w?w:"",ew)||"result"!==eV,onMouseEnter:eW,onMouseLeave:eZ,size:"sm",onClick:async()=>{var e,n;(null==ey?void 0:ey.type)==="lineage_diff"?null===(e=eq.current)||void 0===e||e.copyToClipboard():await eU(),(0,y.nO)({type:null!==(n=null==ey?void 0:ey.type)&&void 0!==n?n:"unknown",from:"check"})},children:[(0,t.jsx)(nl.j90,{})," Copy to Clipboard"]})]})]}),(0,t.jsxs)(p.fk,{height:"100%",flex:"1",style:{contain:"strict"},children:[(0,t.jsxs)(p.nU,{value:"result",p:0,width:"100%",height:"100%",children:[(null==eS?void 0:eS.RunResultView)&&((null==ey?void 0:ey.last_run)||eb?(0,t.jsx)(e2,{ref:eH,isRunning:eC,isAborting:es,run:eb?ew:null==ey?void 0:ey.last_run,error:ek,progress:er,RunResultView:eS.RunResultView,viewOptions:null==ey?void 0:ey.view_options,onViewOptionsChanged:e=>{eT({view_options:e})},onCancel:eM,onExecuteRun:eO}):(0,t.jsx)(z.M,{bg:"rgb(249,249,249)",height:"100%",children:(0,t.jsxs)(R.g,{gap:4,children:[(0,t.jsx)(l.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,t.jsx)(L.z,{onClick:eO,colorPalette:"blue",size:"sm",disabled:B,children:"Run Query"})]})})),ey&&"schema_diff"===ey.type&&(0,t.jsx)(ez,{check:ey,ref:eH}),ey&&"lineage_diff"===ey.type&&(0,t.jsx)(i$,{check:ey,ref:eq})]}),((null==ey?void 0:ey.type)==="query"||(null==ey?void 0:ey.type)==="query_diff"||(null==ey?void 0:ey.type)==="query_base")&&(0,t.jsx)(p.nU,{value:"query",p:0,height:"100%",width:"100%",children:(null===(i=ey.params)||void 0===i?void 0:i.base_sql_template)?(0,t.jsx)(eG,{value:null!==(S=null===(r=ey.params)||void 0===r?void 0:r.sql_template)&&void 0!==S?S:"",baseValue:null!==(N=null===(s=ey.params)||void 0===s?void 0:s.base_sql_template)&&void 0!==N?N:"",options:{readOnly:!0}}):(0,t.jsx)(eX,{value:null!==(D=null===(a=ey.params)||void 0===a?void 0:a.sql_template)&&void 0!==D?D:"",options:{readOnly:!0}})})]})]})}),(0,t.jsx)(q.GR,{open:eu,onOpenChange:ex,placement:"center",size:"xl",children:(0,t.jsxs)(T.h,{children:[ef,(0,t.jsx)(q.Qd,{children:(0,t.jsxs)(q.cZ,{overflowY:"auto",height:"40%",width:"60%",children:[(0,t.jsx)(q.fK,{children:(0,t.jsx)(q.$N,{children:"Preset Check Template"})}),(0,t.jsxs)(q.a7,{children:[(0,t.jsxs)(u.X,{size:"sm",fontWeight:"bold",children:["Please"," ",(0,t.jsx)(O.x,{as:"span",cursor:"pointer",_hover:{textDecoration:"underline"},color:"blue.500",onClick:async()=>{await navigator.clipboard.writeText(ec),G("Copied the template to the clipboard")},children:"copy"})," ","the following template and paste it into the"," ",(0,t.jsx)(M.y,{query:"recce.yml",styles:{px:"1",py:"0",bg:"red.100"},children:"recce.yml"})," ","file."]}),(0,t.jsx)("br",{}),(0,t.jsx)(iB,{yamlTemplate:ec})]}),(0,t.jsx)(q.Rd,{asChild:!0,children:(0,t.jsx)(A.P,{size:"sm"})})]})})]})})]})};var i0=i(66855);let i1=e=>{var n,i,r,s,a;let{check:d,selected:u,onSelect:h,onMarkAsApproved:x}=e,{readOnly:p}=(0,ee.$)(),m=(0,Z.NL)(),f=d.check_id,{mutate:j}=(0,$.D)({mutationFn:e=>C(f,e),onSuccess:async()=>{await m.invalidateQueries({queryKey:v.V.check(f)}),await m.invalidateQueries({queryKey:v.V.checks()})}}),{run:g}=nb(null===(n=d.last_run)||void 0===n?void 0:n.run_id),y=null!==(r=null===(i=(0,e_.N)(d.type))||void 0===i?void 0:i.icon)&&void 0!==r?r:nP.WzH,b=iG(null!==(s=d.type)&&void 0!==s?s:"",g)||p,w=iG(null!==(a=d.type)&&void 0!==a?a:"",g);return(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(c.k,{width:"100%",p:"10px 20px",cursor:"pointer",_hover:{bg:"Cornsilk"},bg:u?"Floralwhite":"inherit",borderBlockEndWidth:"1px",borderLeftWidth:"3px",borderLeftColor:u?"orange":"transparent",onClick:()=>{h(d.check_id)},alignItems:"center",gap:"5px",children:[(0,t.jsx)(o.J,{as:y}),(0,t.jsx)(l.x,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:d.name}),(0,t.jsx)(el.u,{content:w?"Run the check first":"Click to mark as approved",positioning:{placement:"top"},showArrow:!0,children:(0,t.jsx)(c.k,{children:(0,t.jsxs)(it.wx,{checked:d.is_checked,colorPalette:"green",size:"xs",onCheckedChange:e=>{e.checked?x():j({is_checked:e.checked})},disabled:b,children:[(0,t.jsx)(it.HC,{}),(0,t.jsx)(it.Z8,{})]})})})]})})},i2=e=>{let{checks:n,selectedItem:i,onCheckSelected:r,onChecksReordered:o}=e,[s,a]=(0,f.useState)(!1),d=(0,Z.NL)(),{mutate:u}=(0,$.D)({mutationFn:e=>C(e,{is_checked:!0}),onSuccess:async(e,n)=>{await d.invalidateQueries({queryKey:v.V.check(n)}),await d.invalidateQueries({queryKey:v.V.checks()})}}),{open:h,onOpen:x,onClose:p}=(0,F.q)(),{markedAsApprovedToast:m}=iQ(),j=()=>{"true"===localStorage.getItem("bypassMarkAsApprovedWarning")?(u(i),m()):x()};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i0.Z5,{onDragEnd:e=>{e.destination&&o(e.source.index,e.destination.index)},children:(0,t.jsx)(i0.bK,{droppableId:"checklist",children:e=>(0,t.jsxs)(R.g,{...e.droppableProps,ref:e.innerRef,className:"no-track-pii-safe",w:"full",gap:"0",flex:"1",overflow:"auto",children:[n.map((e,n)=>(0,t.jsx)(i0._l,{draggableId:e.check_id,index:n,children:(n,l)=>{if(l.isDragging){let e=n.draggableProps;if(null!=e.style&&"left"in e.style){let n={x:0,y:80},i=e.style.left-n.x,t=e.style.top-n.y;e.style.left=i,e.style.top=t}}return(0,t.jsx)(c.k,{ref:n.innerRef,...n.draggableProps,...n.dragHandleProps,w:"full",children:(0,t.jsx)(i1,{check:e,selected:e.check_id===i,onSelect:r,onMarkAsApproved:j},e.check_id)})}},e.check_id)),e.placeholder]})})}),(0,t.jsx)(q.GR,{open:h,onOpenChange:p,placement:"center",children:(0,t.jsxs)(T.h,{children:[(0,t.jsx)(q.ZR,{}),(0,t.jsx)(q.Qd,{children:(0,t.jsxs)(q.cZ,{width:"400px",children:[(0,t.jsx)(q.fK,{children:(0,t.jsx)(q.$N,{children:"Mark as Approved?"})}),(0,t.jsx)(N.Z,{}),(0,t.jsxs)(l.x,{p:"16px",fontSize:"sm",gap:"16px",children:[(0,t.jsx)("p",{children:"Please ensure you have reviewed the contents of this check before marking it as approved."}),(0,t.jsxs)(it.wx,{checked:s,onCheckedChange:e=>{a(!!e.checked)},fontWeight:"bold",size:"sm",pt:"8px",children:[(0,t.jsx)(it.HC,{}),(0,t.jsx)(it.Z8,{}),(0,t.jsx)(it.ke,{children:"Don't show this again"})]})]}),(0,t.jsx)(N.Z,{}),(0,t.jsxs)(q.cN,{gap:0,children:[(0,t.jsx)(L.z,{variant:"outline",size:"xs",mr:2,onClick:p,children:"Cancel"}),(0,t.jsx)(L.z,{colorPalette:"cyan",size:"xs",onClick:()=>{u(i),s&&localStorage.setItem("bypassMarkAsApprovedWarning","true"),m(),p()},children:"Mark as approved"})]}),(0,t.jsx)(q.Rd,{asChild:!0,children:(0,t.jsx)(A.P,{size:"sm"})})]})})]})})]})};var i5=i(69069);function i4(e){let{checksOnly:n=!0}=e,{readOnly:i}=(0,ee.$)(),l=(0,Z.NL)(),r=(0,f.useRef)(null),s=(0,f.useRef)(null),[a,d]=(0,f.useState)(null),{open:u,onOpen:h,onClose:x}=(0,F.q)(),[p,m]=(0,eR.TH)(),[,j]=(0,B.P)(),g=(0,f.useCallback)(async()=>{if(a){try{let{runs:e,checks:i}=await (0,i5.V5)(a,n);j(),await l.invalidateQueries({queryKey:v.V.checks()}),await l.invalidateQueries({queryKey:v.V.runs()}),p.includes("/checks")&&m("/checks");let t=n?"".concat(i," checks imported successfully"):"".concat(e," runs and ").concat(i," checks imported successfully");eq.m.create({description:t,type:"info",duration:5e3,closable:!0})}catch(e){console.error("Import failed",e),eq.m.create({title:"Import failed",description:String(e),type:"error",duration:5e3,closable:!0})}x()}},[l,a,x,p,m,j,n]),b=()=>{r.current&&r.current.click()},w=n?"checks":"runs and checks",{isDemoSite:k}=(0,B.kJ)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(el.u,{content:"Import Checklist from State File"+(k?" (Disabled in the demo site)":""),children:(0,t.jsx)(P.h,{pt:"6px",variant:"plain","aria-label":"Import state",onClick:()=>{b(),(0,y.lH)({name:"import"})},disabled:i||k,children:(0,t.jsx)(o.J,{as:eV.Vs})})}),(0,t.jsx)("input",{type:"file",style:{display:"none"},ref:r,onChange:e=>{var n;(null===(n=e.target.files)||void 0===n?void 0:n.length)===1&&(d(e.target.files[0]),h()),r.current&&(r.current.value="")}}),(0,t.jsx)(q.GR,{open:u,role:"alertdialog",initialFocusEl:()=>s.current,onOpenChange:x,size:"xl",children:(0,t.jsxs)(T.h,{children:[(0,t.jsx)(q.ZR,{}),(0,t.jsx)(q.Qd,{children:(0,t.jsxs)(q.cZ,{children:[(0,t.jsx)(q.fK,{fontSize:"lg",fontWeight:"bold",children:(0,t.jsx)(q.$N,{children:"Import state"})}),(0,t.jsx)(q.a7,{children:(0,t.jsxs)(c.k,{px:"5px",gap:"5px",rounded:"md",direction:"column",children:[(0,t.jsxs)(c.k,{alignItems:"center",gap:"5px",children:[(0,t.jsx)(nl.yZ7,{color:"red.600"}),(0,t.jsx)(O.x,{as:"span",fontWeight:"500",color:"red.600",children:"Caution!"})]}),(0,t.jsx)(c.k,{children:(0,t.jsxs)(O.x,{children:["The current ",w," will be"," ",(0,t.jsx)(O.x,{as:"span",fontWeight:"600",children:"merged"})," ","with the imported state"]})})]})}),(0,t.jsxs)(q.cN,{children:[(0,t.jsx)(L.z,{ref:s,onClick:x,children:"Cancel"}),(0,t.jsx)(L.z,{colorPalette:"blue",onClick:g,ml:"5px",children:"Import"})]}),(0,t.jsx)(q.Rd,{asChild:!0,children:(0,t.jsx)(A.P,{size:"sm"})})]})})]})})]})}var i8=i(22301);let i3=()=>{let[,e]=(0,eR.TH)(),[,n]=(0,eR.yj)("/checks/:checkId"),{latestSelectedCheckId:i,setLatestSelectedCheckId:r}=(0,i8.p)(),o=(0,Z.NL)(),s=null==n?void 0:n.checkId;s&&r(s);let{isLoading:a,error:d,data:u,status:h,refetch:x}=(0,j.a)({queryKey:v.V.checks(),queryFn:w,refetchOnMount:!0}),p=(0,f.useCallback)(n=>{e("/checks/".concat(n))},[e]),[m,g]=(0,f.useState)(null!=u?u:[]),{mutate:y}=(0,$.D)({mutationFn:e=>S(e),onSuccess:async()=>{await o.invalidateQueries({queryKey:v.V.checks()})}}),b=(0,f.useCallback)((e,n)=>{let i=[...m],[t]=i.splice(e,1);i.splice(n,0,t),y({source:e,destination:n}),g(i)},[m,g,y]);return((0,f.useEffect)(()=>{"success"===h&&(!s&&u.length>0&&(i?e("/checks/".concat(i)):e("/checks/".concat(u[0].check_id))),g(u))},[h,s,u,g,e,i]),a)?(0,t.jsx)(t.Fragment,{}):d?(0,t.jsxs)(t.Fragment,{children:["Error: ",d.message]}):(null==u?void 0:u.length)?(0,t.jsxs)(ex,{style:{height:"100%"},minSize:50,sizes:[20,80],children:[(0,t.jsx)(l.x,{borderRight:"lightgray solid 1px",height:"100%",style:{contain:"size"},children:(0,t.jsxs)(R.g,{gap:0,h:"100%",style:{contain:"strict"},alignItems:"stretch",children:[(0,t.jsx)(c.k,{justifyContent:"right",padding:"0px 10px",children:(0,t.jsx)(i4,{checksOnly:!0})}),(0,t.jsx)(N.Z,{}),(0,t.jsx)(i2,{checks:m,selectedItem:s,onCheckSelected:p,onChecksReordered:b})]})}),(0,t.jsx)(l.x,{height:"100%",children:(0,t.jsx)(eR.rs,{children:(0,t.jsx)(eR.AW,{path:"/checks/:checkId",children:e=>(0,t.jsx)(iY,{checkId:e.checkId,refreshCheckList:x},e.checkId)})})})]}):(0,t.jsx)(z.M,{h:"100%",children:(0,t.jsx)(l.x,{children:"No checks"})})};var i9=i(45258);let i6=()=>{let{isHistoryOpen:e,showHistory:n,closeHistory:i}=(0,X.$q)();return(0,t.jsxs)(l.x,{children:[(0,t.jsx)(l.x,{fontSize:"8pt",children:"History"}),(0,t.jsxs)(L.z,{size:"2xs",variant:"outline",onClick:()=>{e?((0,y.U8)({name:"hide"}),i()):((0,y.U8)({name:"show"}),n())},children:[(0,t.jsx)(W.M1Q,{})," ",e?"Hide":"Show"]})]})},i7=()=>{let{isCustomQueries:e,setCustomQueries:n,sqlQuery:i,setBaseSqlQuery:r}=(0,nf.rV)();return(0,t.jsxs)(l.x,{children:[(0,t.jsxs)(c.k,{fontSize:"0.75rem",gap:1,alignItems:"center",children:["Custom Queries"," ",(0,t.jsx)(el.u,{content:"Custom queries allow you to use two SQL queries to compare results between current and base environments.",children:(0,t.jsx)(nl.OUE,{color:"gray.600",fontSize:"1rem"})})]}),(0,t.jsxs)(i9.NX,{size:"sm",colorPalette:"cyan",checked:e,onCheckedChange:()=>{!e&&r&&r(i),n(!e)},children:[(0,t.jsx)(i9.Ai,{}),(0,t.jsx)(i9.iw,{}),(0,t.jsx)(i9.$A,{})]})]})},te=()=>{let{sqlQuery:e,baseSqlQuery:n,setSqlQuery:i,setBaseSqlQuery:r,primaryKeys:o,setPrimaryKeys:s,isCustomQueries:a}=(0,nf.rV)(),{lineageGraph:d,envInfo:u}=(0,B.kJ)(),{readOnly:h}=(0,ee.$)(),{data:p}=(0,ny.P)(),m=e;(null==u?void 0:u.adapterType)==="sqlmesh"&&e===nf.nw&&(m="select * from db.mymodel"),h&&(m="--- Would like to do query here? Book a demo with us at https://datarecce.io/\n".concat(m));let{showRunId:j}=(0,X.$q)(),g=async e=>{let i="query_base"===e?null!=n?n:"":m,t=function(e){switch(e){case"query":return nW;case"query_base":return nZ;case"query_diff":return n$;default:throw Error("Unknown query type: ".concat(e))}}(e),l={sql_template:i};"query_diff"===e&&(l.primary_keys=o,a&&(l.base_sql_template=n));let{run_id:r}=await t(l,{nowait:!0});return j(r),await (0,eY.Qp)(r)},{mutate:v,isPending:y}=(0,$.D)({mutationFn:g}),b=(0,f.useMemo)(()=>{let e={};for(let i in null==d?void 0:d.nodes){var n;let t=null===(n=d.nodes[i].data.current)||void 0===n?void 0:n.schema;t&&(e[t]=(e[t]||0)+1)}return Object.keys(e).reduce((n,i)=>e[i]>(e[n]||0)?i:n,"N/A")},[null==d?void 0:d.nodes]);return(null==p?void 0:p.single_env_onboarding)?(0,t.jsxs)(c.k,{direction:"column",height:"100%",children:[(0,t.jsxs)(c.k,{justifyContent:"right",alignItems:"center",padding:"4pt 8pt",gap:"5px",height:"54px",borderBottom:"1px solid lightgray",children:[(0,t.jsx)(i6,{}),(0,t.jsx)(x.L,{}),(0,t.jsx)(el.u,{content:"Please configure the base environment before running the diff",positioning:{placement:"left"},children:(0,t.jsx)(L.z,{colorPalette:"cyan",disabled:!0,size:"xs",fontSize:"14px",marginTop:"16px",children:"Run Diff"})})]}),(0,t.jsx)(eG,{value:m,onChange:i,onRun:()=>{v("query")},labels:["base (production)","current (".concat(b,")")],BaseEnvironmentSetupGuide:(0,t.jsx)(iq,{})})]}):(0,t.jsxs)(c.k,{direction:"column",height:"100%",children:[(0,t.jsxs)(c.k,{justifyContent:"right",alignItems:"flex-end",padding:"4pt 8pt",gap:"5px",height:"54px",borderBottom:"1px solid lightgray",flex:"0 0 54px",children:[(0,t.jsx)(i6,{}),(0,t.jsx)(i7,{}),(0,t.jsx)(x.L,{}),(0,t.jsx)(nY,{defaultPrimaryKeys:o,onPrimaryKeysChange:s}),(0,t.jsx)(L.z,{colorPalette:"cyan",onClick:()=>{v("query_diff")},disabled:y||h,size:"2xs",children:"Run Diff"})]}),(0,t.jsx)(l.x,{width:"100%",flex:"1",children:a?(0,t.jsx)(eG,{value:m,baseValue:n,onChange:i,onChangeBase:r,onRun:()=>{v("query")},onRunBase:()=>{v("query_base")},onRunDiff:()=>{v("query_diff")}}):(0,t.jsx)(eX,{value:m,onChange:i,onRun:()=>{v("query")},onRunDiff:()=>{v("query_diff")}})})]})},tn=e=>{var n;let{runId:i}=e,{isPending:l,error:r,data:o}=(0,j.a)({queryKey:v.V.run(i),queryFn:async()=>(0,eY.Qp)(i)}),s=(null==o?void 0:o.type)?null===(n=(0,e_.N)(o.type))||void 0===n?void 0:n.RunResultView:void 0;return(0,t.jsx)(e2,{error:r,run:o,RunResultView:s})},ti=e=>{let{error:n,resetError:i}=e;return(0,t.jsx)(z.M,{height:"100%",backgroundColor:"gray.50",children:(0,t.jsxs)(c.k,{p:4,direction:"column",justifyContent:"flex-start",backgroundColor:"white",border:"solid lightgray 1px",minHeight:"200px",children:[(0,t.jsx)(u.X,{width:"800px",size:"md",children:"You have encountered an error"}),(0,t.jsx)(l.x,{flex:"1",fontSize:"10pt",children:String(n)}),(0,t.jsx)(L.z,{justifySelf:"center",alignSelf:"center",mt:"20px",colorPalette:"blue",size:"sm",onClick:()=>{i()},children:"Reset"})]})})},tt=e=>{let{children:n}=e;return(0,t.jsx)(e1.SV,{fallback:ti,children:n})};function tl(){let{readOnly:e}=(0,ee.$)(),n=async()=>{try{let e=await (0,i5.xq)(),n=JSON.stringify(e,null,2),i=new Blob([n],{type:"application/json"}),t=new Date,l="recce-state-".concat((0,eA.WU)(t,"yyyy-MM-dd-HH-mm-ss"),".json");nz()(i,l)}catch(e){console.error("Export failed",e),eq.m.create({title:"Export failed",description:String(e),type:"error",duration:5e3,closable:!0})}};return(0,t.jsx)(el.u,{content:"Export",children:(0,t.jsx)(P.h,{size:"sm",variant:"plain","aria-label":"Export state",onClick:async()=>{await n(),(0,y.lH)({name:"export"})},disabled:e,children:(0,t.jsx)(o.J,{as:eV.b8,verticalAlign:"middle",boxSize:"16px"})})})}function tr(){return(0,t.jsx)(e3.tV,{children:(0,t.jsx)(iZ,{interactive:!0})})}i(72729);var to=i(89755);i(2231);let ts=e=>{var n,i;let{run:r,isSelected:s,onSelectRun:a,onAddToChecklist:d,onGoToCheck:u}=e,{readOnly:h,singleEnv:x}=(0,ee.$)(),{data:p}=(0,j.a)({queryKey:v.V.run(r.run_id),queryFn:async()=>await (0,eY.Qp)(r.run_id),enabled:"running"===r.status,retry:!1}),m=null!==(i=null===(n=(0,e_.N)(r.type))||void 0===n?void 0:n.icon)&&void 0!==i?i:nP.WzH,f=r.check_id;return(0,t.jsxs)(c.k,{minWidth:"200px",direction:"column",width:"100%",p:"5px 20px",cursor:"pointer",borderBottom:"solid 1px lightgray",borderLeft:"4px",borderLeftColor:s?"orange.400":"transparent",backgroundColor:s?"orange.50":"transparent",onClick:()=>{a(r.run_id)},_hover:{bg:s?"orange.50":"gray.200"},children:[(0,t.jsxs)(c.k,{onClick:()=>{},alignItems:"center",gap:"12px",children:[(0,t.jsx)(o.J,{as:m}),(0,t.jsx)(l.x,{className:"no-track-pii-safe",flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",color:r.name?"inherit":"gray.500",fontSize:"11pt",fontWeight:"500",children:r.name||"<no name>"}),f?(0,t.jsx)(el.u,{content:"Go to Check","aria-label":"Go to Check",children:(0,t.jsx)(O.x,{onClick:e=>{e.preventDefault(),e.stopPropagation(),u(f)},children:(0,t.jsx)(o.J,{color:"green",as:ef.FJM})})}):h||x?null:(0,t.jsx)(el.u,{content:"Add to Checklist","aria-label":"Add to Checklist",children:(0,t.jsx)(O.x,{onClick:e=>{e.preventDefault(),e.stopPropagation(),(0,y.U8)({name:"add_to_checklist"}),d(r.run_id)},children:(0,t.jsx)(o.J,{as:ef.wO})})})]}),(0,t.jsx)(c.k,{justifyContent:"start",fontSize:"11pt",color:"gray.500",gap:"3px",alignItems:"center",children:(0,t.jsx)(nq,{run:null!=p?p:r})})]})},ta=e=>{let{runAt:n}=e,i=n?function(e){let n=new Date,i=new Date;return(i.setDate(n.getDate()-1),null==e)?null:n.toDateString()===e.toDateString()?"Today":i.toDateString()===e.toDateString()?"Yesterday":(0,eA.WU)(e,"MMM d")}(new Date(n)):null;return(0,t.jsx)(c.k,{minWidth:"200px",width:"100%",p:"5px 20px",borderBottom:"solid 1px lightgray",color:"gray.500",fontSize:"11pt",children:i})},tc=()=>{let{data:e,isLoading:n,isFetching:i,error:r,refetch:o}=(0,j.a)({queryKey:v.V.runs(),queryFn:async()=>await (0,eY.sw)(),retry:!1}),{showRunId:s,runId:a}=(0,X.$q)(),d=e=>{(0,y.U8)({name:"click_run"}),s(e,!1)},[,p]=(0,eR.TH)(),m=(0,Z.NL)(),g=(0,f.useCallback)(async()=>{if(!a)return;let e=await b(a);await m.invalidateQueries({queryKey:v.V.checks()}),p("/checks/".concat(e.check_id))},[a,p,m]),w=(0,f.useCallback)(e=>{(0,y.U8)({name:"go_to_check"}),p("/checks/".concat(e))},[p]),k=null;return(0,t.jsxs)(c.k,{direction:"column",height:"100%",children:[(0,t.jsxs)(h.U,{width:"100%",flex:"0 0 54px",paddingInline:"24px 8px",borderBottom:"solid 1px lightgray",children:[(0,t.jsx)(u.X,{size:"md",children:"History"}),(0,t.jsx)(x.L,{}),(0,t.jsx)(P.h,{variant:"plain","aria-label":"Search database",onClick:async()=>{await o()},children:(0,t.jsx)(nl.JXV,{})})]}),(0,t.jsx)(l.x,{flex:"1 1 auto",children:n?"Loading...":(null==e?void 0:e.length)===0?(0,t.jsx)(z.M,{height:"100%",color:"gray.400",children:"No runs"}):(0,t.jsx)(to.Z,{style:{minHeight:"100%",height:0},children:(null!=e?e:[]).map((e,n)=>{let i=new Date(e.run_at).toDateString(),l=null!=k&&k!==i;return k=i,(0,t.jsxs)(t.Fragment,{children:[l&&(0,t.jsx)(ta,{runAt:e.run_at},i),(0,t.jsx)(ts,{run:e,isSelected:e.run_id===a,onSelectRun:d,onGoToCheck:w,onAddToChecklist:g},e.run_id)]})})})})]})},td=()=>({toastSuccess:e=>{eq.m.create({description:e,type:"success",duration:5e3,closable:!0})},toastError:(e,n)=>{let i=e;if(null!=n){if(n instanceof ig.d7){var t,l;i="".concat(e,". ").concat(String(null===(l=n.response)||void 0===l?void 0:null===(t=l.data)||void 0===t?void 0:t.detail))}else i="".concat(e,". ").concat(n)}eq.m.create({description:i,type:"error",duration:5e3,closable:!0})}}),tu=e=>{(0,f.useEffect)(()=>{let n=e=>{e.preventDefault()};return e&&window.addEventListener("beforeunload",n),()=>{e&&window.removeEventListener("beforeunload",n)}},[e])},th=()=>{var e,n;let i;let{readOnly:r}=(0,ee.$)(),{fileName:s,cloudMode:a,isDemoSite:d,envInfo:u}=(0,B.kJ)(),h=(0,F.q)(),x=(0,F.q)(),p=!s&&!a&&!d,{data:m}=(0,j.a)({queryKey:v.V.checks(),queryFn:w,enabled:p}),g=void 0!=m&&m.filter(e=>!e.is_preset).length>0;tu(p&&g);let[{newFileName:y,errorMessage:b,modified:k,overwriteWithMethod:C,bypass:_},S]=(0,f.useState)({newFileName:null!=s?s:"recce_state.json"}),z=(0,f.useRef)(null),{toastSuccess:R,toastError:N}=td(),D=(0,Z.NL)(),I=async(e,n)=>{if(!y)return;let i="true"===localStorage.getItem(n5.bypassSaveOverwrite);try{"save"===e?await (0,i5.po)({filename:y,overwrite:null!=n?n:i}):await (0,i5.PQ)({filename:y,overwrite:null!=n?n:i}),R("save"===e?"Save file successfully":"Rename file successfully"),await D.invalidateQueries({queryKey:v.V.lineage()}),_&&localStorage.setItem(n5.bypassSaveOverwrite,"true")}catch(n){if(n instanceof ig.d7){var t;if((null===(t=n.response)||void 0===t?void 0:t.status)===409){S(n=>({...n,overwriteWithMethod:e})),x.onOpen();return}}N("save"===e?"Save file failed":"Rename file failed",n)}finally{h.onClose()}};if(a||d)return(0,t.jsx)(t.Fragment,{});if(r&&s){let n=null==u?void 0:null===(e=u.stateMetadata)||void 0===e?void 0:e.generated_at,t=n?nF(new Date(n)):null;i=t?"".concat(s," (").concat(t,")"):null}return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(c.k,{justifyContent:"center",alignItems:"center",children:[(0,t.jsx)(l.x,{fontWeight:"600",children:null!==(n=null!=i?i:s)&&void 0!==n?n:"New Instance"+(g?" (unsaved)":"")}),!r&&(0,t.jsx)(el.u,{content:s?"Change Filename":"Save",openDelay:1e3,children:(0,t.jsx)(P.h,{onClick:()=>{S({newFileName:null!=s?s:"recce_state.json",modified:!s}),h.onOpen()},"aria-label":"",variant:"ghost",size:"sm",colorPalette:"gray",children:(0,t.jsx)(o.J,{as:s?eV.yl:eV.kx,boxSize:"16px",verticalAlign:"middle"})})})]}),(0,t.jsx)(q.GR,{open:h.open,onOpenChange:h.onClose,placement:"center",children:(0,t.jsxs)(T.h,{children:[(0,t.jsx)(q.ZR,{}),(0,t.jsx)(q.Qd,{children:(0,t.jsxs)(q.cZ,{children:[(0,t.jsx)(q.fK,{children:(0,t.jsx)(q.$N,{children:s?"Change Filename":"Save File"})}),(0,t.jsx)(q.a7,{onKeyDown:e=>{e.stopPropagation()},children:(0,t.jsxs)(nG.Tn,{invalid:!!b,children:[(0,t.jsx)(nG.Qy,{children:"File name:"}),(0,t.jsx)(H.I,{ref:z,value:y,placeholder:"Enter filename",onChange:e=>{let n;let i=e.target.value;i?i.endsWith(".json")?/^[a-zA-Z0-9 _-]+\.json$/.test(i)?s&&i===s&&(n="Filename is the same as the current one."):n="Invalid filename. Only alphanumeric, space, _ and - are allowed.":n="Filename must end with .json.":n="Filename cannot be empty.",S(e=>({...e,modified:!0,newFileName:i,errorMessage:n}))},onKeyDown:e=>{"Enter"===e.key?b||(s?I("rename"):I("save")):"Escape"===e.key&&h.onClose()}}),(0,t.jsx)(nG.FI,{children:b})]})}),(0,t.jsxs)(q.cN,{gap:"5px",children:[(0,t.jsx)(L.z,{size:"sm",colorPalette:s?void 0:"blue",onClick:async()=>{await I("save")},disabled:!y||!!b||!k,children:s?"Save as New File":"Confirm"}),s&&(0,t.jsx)(L.z,{size:"sm",colorPalette:"blue",onClick:async()=>{await I("rename")},disabled:!y||!!b||!k,children:"Rename"})]}),(0,t.jsx)(q.Rd,{asChild:!0,children:(0,t.jsx)(A.P,{size:"sm"})})]})})]})}),(0,t.jsx)(q.GR,{open:x.open,onOpenChange:x.onClose,initialFocusEl:()=>z.current,placement:"center",children:(0,t.jsxs)(T.h,{children:[(0,t.jsx)(q.ZR,{}),(0,t.jsx)(q.Qd,{children:(0,t.jsxs)(q.cZ,{children:[(0,t.jsx)(q.fK,{children:(0,t.jsx)(q.$N,{children:"Overwrite File?"})}),(0,t.jsxs)(q.a7,{borderTop:"solid 1px lightgray",borderBottom:"solid 1px lightgray",onKeyDown:e=>{e.stopPropagation()},children:[(0,t.jsx)(l.x,{fontSize:"12pt",children:"save"===C?"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,t.jsxs)(it.wx,{size:"xs",checked:_,onCheckedChange:e=>{S(n=>({...n,bypass:!!e.checked}))},children:[(0,t.jsx)(it.HC,{}),(0,t.jsx)(it.Z8,{}),(0,t.jsx)(it.ke,{fontWeight:"bold",pt:"8px",children:"Don't show this again"})]})]}),(0,t.jsxs)(q.cN,{gap:"5px",children:[(0,t.jsx)(L.z,{variant:"outline",onClick:()=>{x.onClose(),h.onOpen(),S(e=>({...e,overwriteWithMethod:void 0}))},size:"sm",children:"Back"}),(0,t.jsx)(L.z,{size:"sm",colorPalette:"blue",onClick:()=>{C&&(I(C,!0),x.onClose())},children:"Overwrite"})]}),(0,t.jsx)(q.Rd,{asChild:!0,children:(0,t.jsx)(A.P,{size:"sm"})})]})})]})})]})};var tx=i(87164);function tp(){return(0,t.jsx)(el.u,{content:"Syncing",children:(0,t.jsx)(L.z,{pt:"6px",variant:"plain",boxSize:"1em",children:(0,t.jsx)(G.$,{})})})}function tm(){let[e,n]=(0,f.useState)(!1),i=(0,Z.NL)(),[r,s]=(0,eR.TH)(),{open:a,onOpen:c,onClose:d}=(0,F.q)(),[u,h]=(0,f.useState)(""),x=(0,f.useCallback)(async e=>{if(d(),n(!0),"conflict"===(await (0,i5.mB)(e)).status){c(),n(!1);return}for(;await (0,i5.tw)();)await new Promise(e=>setTimeout(e,1e3));eq.m.create({description:"Sync Completed",type:"success",duration:5e3,closable:!0}),n(!1),h(""),await i.invalidateQueries({queryKey:v.V.lineage()}),await i.invalidateQueries({queryKey:v.V.checks()}),await i.invalidateQueries({queryKey:v.V.runs()}),/^\/checks\/([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/.test(r)&&s("/checks")},[i,r,s,c,d]);return e?(0,t.jsx)(tp,{}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(el.u,{content:"Sync with Cloud",children:(0,t.jsx)(P.h,{size:"sm",variant:"plain","aria-label":"Sync state",onClick:()=>x({}),children:(0,t.jsx)(o.J,{as:eV.JK,verticalAlign:"middle",boxSize:"16px"})})}),(0,t.jsx)(q.GR,{open:a,onOpenChange:d,children:(0,t.jsxs)(T.h,{children:[(0,t.jsx)(q.ZR,{}),(0,t.jsxs)(q.Qd,{children:[(0,t.jsxs)(q.cZ,{children:[(0,t.jsx)(q.fK,{fontSize:"lg",fontWeight:"bold",children:(0,t.jsx)(q.$N,{children:"Sync with Cloud"})}),(0,t.jsxs)(q.a7,{children:[(0,t.jsx)(l.x,{children:"New changes have been detected in the cloud. Please choose a method to sync your state"}),(0,t.jsx)(l.x,{mt:"5px",children:(0,t.jsx)(tx.ZY,{onValueChange:e=>{h(String(e.value))},value:u,children:(0,t.jsxs)(eT.K,{direction:"column",children:[(0,t.jsxs)(tx.mJ,{value:"merge",children:[(0,t.jsx)(tx.$z,{}),(0,t.jsx)(tx.Xu,{}),(0,t.jsxs)(tx.xZ,{children:["Merge",(0,t.jsx)(el.u,{content:"This will merge the local and remote states.",children:(0,t.jsx)("span",{children:(0,t.jsx)(o.J,{as:nl.yZ7,ml:2,cursor:"pointer"})})})]})]}),(0,t.jsxs)(tx.mJ,{value:"overwrite",children:[(0,t.jsx)(tx.$z,{}),(0,t.jsx)(tx.Xu,{}),(0,t.jsxs)(tx.xZ,{children:["Overwrite",(0,t.jsx)(el.u,{content:"This will overwrite the remote state file with the local state.",children:(0,t.jsx)("span",{children:(0,t.jsx)(o.J,{as:nl.yZ7,ml:2,cursor:"pointer"})})})]})]}),(0,t.jsxs)(tx.mJ,{value:"revert",children:[(0,t.jsx)(tx.$z,{}),(0,t.jsx)(tx.Xu,{}),(0,t.jsxs)(tx.xZ,{children:["Revert",(0,t.jsx)(el.u,{content:"This will discard local changes and revert to the cloud state.",children:(0,t.jsx)("span",{children:(0,t.jsx)(o.J,{as:nl.yZ7,ml:2,cursor:"pointer"})})})]})]})]})})})]}),(0,t.jsxs)(q.cN,{children:[(0,t.jsx)(L.z,{onClick:d,mr:3,children:"Cancel"}),(0,t.jsx)(L.z,{colorPalette:"blue",onClick:()=>x({method:u}),disabled:!u,children:"Sync"})]})]}),(0,t.jsx)(q.Rd,{asChild:!0,children:(0,t.jsx)(A.P,{size:"sm"})})]})]})})]})}var tf=i(29289);function tj(){let{successToast:e,failToast:n}=eI(),[,i]=(0,tf.m9)(),{authed:l}=(0,ee.$)(),{shareUrl:r,isLoading:o,error:s,handleShareClick:a}=(0,nT.z)(),[d,u]=(0,f.useState)(!1),h=async()=>{try{await i(String(r)),e("Copied the link to clipboard")}catch(e){n("Failed to copy the link",e)}};return l?(0,t.jsxs)(c.k,{flex:"1",alignItems:"center",gap:"5px",children:[(0,t.jsxs)(L.z,{size:"xs",variant:"outline",colorPalette:"gray",onClick:async()=>{await a(),(0,y.v4)({name:"create"})},loading:o,children:[(0,t.jsx)(nP.eOs,{})," Share ",r?(0,t.jsx)(nl.T23,{color:"green"}):void 0]}),(0,t.jsxs)(c.k,{gap:"5px",alignItems:"center",children:[r&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(c.k,{overflowX:"auto",whiteSpace:"nowrap",maxWidth:"350px",children:(0,t.jsx)(O.x,{fontSize:"14",children:r})}),(0,t.jsx)(P.h,{size:"xs","aria-label":"Copy the share URL",onClick:async()=>{await h(),(0,y.v4)({name:"copy"})},children:(0,t.jsx)(nl.j90,{})})]}),s&&(0,t.jsx)(O.x,{fontSize:"14",color:"red.500",children:s})]})]}):(0,t.jsxs)(c.k,{flex:"1",alignItems:"center",children:[(0,t.jsxs)(L.z,{size:"xs",colorPalette:"gray",variant:"outline",onClick:()=>{u(!0)},children:[(0,t.jsx)(nP.eOs,{})," Share"]}),d&&(0,t.jsx)(nA,{handleParentClose:()=>{u(!1)},ignoreCookie:!0})]})}let tg={TOAST_ID:"lifetime-countdown",WARNING_THRESHOLD:60,UPDATE_INTERVAL:1e3,MESSAGE:e=>"The server will be closed in ".concat(e," seconds.")},tv=e=>{let{children:n,path:i}=e,[r]=(0,eR.yj)(i);return(0,t.jsx)(l.x,{display:r?"block":"none",height:"100%",children:n})};function ty(e){let{icon:n,href:i,...l}=e;return(0,t.jsx)(r.r,{height:"20px",color:"white",href:i,target:"_blank",...l,children:(0,t.jsx)(o.J,{color:"white",boxSize:"20px",as:n})})}function tb(){let{version:e,latestVersion:n}=function(){let[e,n]=(0,f.useState)(""),[i,t]=(0,f.useState)("");return(0,f.useEffect)(()=>{(async function(){try{let{version:e,latestVersion:i}=(await g.U.get("/api/version")).data;n(e),t(i)}catch(e){console.error("Error fetching version number:",e)}})()},[]),{version:e,latestVersion:i}}(),[i,l]=(0,f.useState)(void 0);return RegExp("^\\d+\\.\\d+\\.\\d+$").test(e)?(e!==n&&null==i&&l(eq.m.create({id:i,title:"Update available",description:(0,t.jsxs)("span",{children:["A new version of Recce (v",n,") is available.",(0,t.jsx)("br",{}),"Please run ",(0,t.jsx)(a.E,{children:"pip install --upgrade recce"})," to update Recce.",(0,t.jsx)("br",{}),(0,t.jsx)(r.r,{color:"rgb(255, 215, 0)",fontWeight:"bold",href:"https://github.com/DataRecce/recce/releases/tag/v".concat(n),_hover:{textDecoration:"underline"},target:"_blank",children:"Click here to view the detail of latest release"})]}),closable:!0})),(0,t.jsx)(s.Ct,{fontSize:"sm",color:"white/80",variant:"outline",children:(0,t.jsxs)(r.r,{href:"https://github.com/DataRecce/recce/releases/tag/v".concat(e),_hover:{textDecoration:"none"},children:[e," ",(0,t.jsx)(eU.$OI,{})]})})):(0,t.jsx)(s.Ct,{fontSize:"sm",color:"white/80",variant:"outline",children:e})}function tw(){var e;let{reviewMode:n,isDemoSite:i,envInfo:a,cloudMode:p}=(0,B.kJ)(),{readOnly:m,lifetimeExpiredAt:j}=(0,ee.$)(),{url:g,id:v}=null!==(e=null==a?void 0:a.pullRequest)&&void 0!==e?e:{},y=g?g.split("/").pop():null;return!function(e){let n=eq.m,[i,t]=(0,f.useState)(null),l=(0,f.useRef)(),r=(0,f.useCallback)(()=>{if(!e)return 0;let n=new Date;return Math.max(0,Math.floor((e.getTime()-n.getTime())/1e3))},[e]),o=(0,f.useCallback)(()=>{null!=i&&(n.remove(i),t(null))},[n,i]),s=(0,f.useCallback)(()=>{if(null==i)return;let e=r();if(e<=0){o();return}n.update(i,{description:tg.MESSAGE(e)})},[i,r,n,o]),a=(0,f.useCallback)(()=>{if(!e)return;o();let i=r();i<=0||(t(n.create({id:tg.TOAST_ID,description:tg.MESSAGE(i)})),l.current=setInterval(s,tg.UPDATE_INTERVAL))},[e,n,r,s,o]);(0,f.useEffect)(()=>{if(!e)return;let n=r();if(n-tg.WARNING_THRESHOLD<0)a();else{let e=setTimeout(a,(n-tg.WARNING_THRESHOLD)*1e3);return()=>{clearTimeout(e),o()}}return o},[e,r,a,o])}(j),(0,t.jsxs)(c.k,{gap:"10px",minHeight:"40px",alignItems:"center",bg:"rgb(255, 110, 66)",children:[(0,t.jsx)(d.E,{boxSize:"20px",ml:"18px",src:"/logo/recce-logo-white.png",alt:"recce-logo-white"}),(0,t.jsx)(u.X,{as:"h1",fontFamily:'"Montserrat", sans-serif',fontSize:"lg",color:"white",children:"RECCE"}),(0,t.jsx)(tb,{}),(m||n)&&(0,t.jsx)(s.Ct,{fontSize:"sm",color:"white/80",variant:"outline",children:m?"read only":"review mode"}),p&&v&&(0,t.jsx)(s.Ct,{fontSize:"sm",color:"white/80",variant:"outline",children:(0,t.jsxs)(h.U,{children:[(0,t.jsx)(l.x,{children:"cloud mode"}),(0,t.jsx)(l.x,{borderLeft:"1px",borderLeftColor:"whiteAlpha.500",paddingLeft:"8px",children:(0,t.jsxs)(r.r,{href:g,_hover:{textDecoration:"none"},target:"_blank",children:[(0,t.jsx)(o.J,{as:W.X9P,boxSize:"3",fontWeight:"extrabold",strokeWidth:"1"})," #".concat(String(v))," ",(0,t.jsx)(eU.$OI,{})]})})]})}),i&&g&&y&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(s.Ct,{fontSize:"sm",color:"white/80",variant:"outline",children:(0,t.jsxs)(h.U,{children:[(0,t.jsx)(l.x,{children:"demo mode"}),(0,t.jsx)(l.x,{borderLeft:"1px",borderLeftColor:"whiteAlpha.500",paddingLeft:"8px",children:(0,t.jsxs)(r.r,{href:g,_hover:{textDecoration:"none"},target:"_blank",children:[(0,t.jsx)(o.J,{as:W.X9P,boxSize:"3",fontWeight:"extrabold",strokeWidth:"1"})," #".concat(y)," ",(0,t.jsx)(eU.$OI,{})]})})]})})}),(0,t.jsx)(x.L,{}),(0,t.jsx)(ty,{icon:ef.hJX,href:"https://github.com/DataRecce/recce"}),(0,t.jsx)(ty,{icon:ef.w5k,href:"https://getdbt.slack.com/archives/C05C28V7CPP"}),(0,t.jsx)(ty,{mr:"18px",icon:ef.MXt,href:"https://docs.datarecce.io"})]})}function tk(e){let{queryKey:n,fetchCallback:i,selectCallback:r}=e,{data:o,isLoading:s,error:a}=(0,j.a)({queryKey:n,queryFn:i,select:r});return s||a||0===o?(0,t.jsx)(t.Fragment,{}):(0,t.jsx)(l.x,{ml:"2px",maxH:"20px",height:"80%",aspectRatio:1,borderRadius:"full",bg:"tomato",alignContent:"center",color:"white",fontSize:"xs",children:o})}function tC(){let{isDemoSite:e,cloudMode:n,isLoading:i}=(0,B.kJ)(),{readOnly:r}=(0,ee.$)(),[o,s]=(0,eR.TH)(),[a,d]=(0,f.useState)("/lineage"),{data:u,isLoading:h}=(0,ny.P)(),x=[{name:"Lineage",href:"/lineage"},{name:"Query",href:"/query"},{name:"Checklist",href:"/checks",badge:(0,t.jsx)(tk,{queryKey:v.V.checks(),fetchCallback:w,selectCallback:e=>e.filter(e=>!e.is_checked).length}),disable:(null==u?void 0:u.single_env_onboarding)===!0}];return(0,f.useEffect)(()=>{d("/".concat(o.split("/")[1]))},[o]),(0,t.jsx)(p.U2,{colorPalette:"cyan",defaultValue:"/lineage",value:a,onValueChange:e=>{d(e.value)},children:(0,t.jsxs)(p.dr,{children:[(0,t.jsx)(l.x,{flex:"1",display:"flex",children:x.map(e=>{let{name:n,href:l,badge:r,disable:o}=e;return(0,t.jsxs)(p.SP,{value:l,onClick:()=>{s(l)},disabled:!!i||h||o,hidden:o,children:[n,r]},l)})}),(0,t.jsx)(c.k,{flex:"3",justifyContent:"right",alignItems:"center",children:!i&&!e&&(0,t.jsx)(th,{})}),(0,t.jsx)(c.k,{flex:"3",justifyContent:"left",alignItems:"center",children:!i&&!e&&!(null==u?void 0:u.single_env_onboarding)&&!r&&(0,t.jsx)(tj,{})}),!i&&(0,t.jsxs)(c.k,{flex:"3",justifyContent:"right",alignItems:"center",mr:"8px",children:[(0,t.jsx)(eQ,{}),n&&(0,t.jsx)(tm,{}),(0,t.jsx)(tl,{})]})]})})}function t_(){let{isRunResultOpen:e,isHistoryOpen:n,closeRunResult:i}=(0,X.$q)(),{data:r}=(0,ny.P)(),[o]=(0,eR.TH)(),s=e&&!o.startsWith("/checks"),a=n&&!o.startsWith("/checks");return(0,t.jsxs)(ex,{sizes:[0,100],minSize:a?300:0,gutterSize:a?5:0,style:{height:"100%"},children:[(0,t.jsx)(l.x,{style:{contain:"size"},children:a&&(0,t.jsx)(tc,{})}),(0,t.jsxs)(ep,{sizes:s?[50,50]:[100,0],minSize:s?100:0,gutterSize:s?5:0,style:{flex:"1",contain:"size"},children:[(0,t.jsx)(l.x,{p:0,style:{contain:"content"},children:(0,t.jsxs)(tt,{children:[(0,t.jsx)(tv,{path:"/lineage",children:(0,t.jsx)(tr,{})}),(0,t.jsxs)(eR.rs,{children:[(0,t.jsx)(eR.AW,{path:"/query",children:(0,t.jsx)(te,{})}),(0,t.jsx)(eR.AW,{path:"/checks/:slug?",children:(0,t.jsx)(i3,{})}),(0,t.jsx)(eR.AW,{path:"/runs/:runId",children:e=>{let{runId:n}=e;return(0,t.jsx)(tn,{runId:n})}}),(0,t.jsx)(eR.AW,{path:"/ssr",children:(0,t.jsx)(m.Zy,{size:"xs",value:null,colorPalette:"cyan",children:(0,t.jsx)(m.S1,{children:(0,t.jsx)(m.qd,{})})})}),(0,t.jsx)(eR.AW,{children:(0,t.jsx)(eR.l_,{to:"/lineage"})})]})]})}),s?(0,t.jsx)(nU,{onClose:i,isSingleEnvironment:!!(null==r?void 0:r.single_env_onboarding)}):(0,t.jsx)(l.x,{})]})]})}function tS(e){let{children:n}=e;return(0,t.jsx)(c.k,{direction:"column",height:"100vh",overflow:"hidden",children:n})}function tz(){let{isDemoSite:e,isLoading:n}=(0,B.kJ)(),{readOnly:i}=(0,ee.$)();return(0,f.useEffect)(()=>{(0,y.JY)()},[]),(0,t.jsxs)(tS,{children:[(0,t.jsx)(tw,{}),(0,t.jsx)(tC,{}),(0,t.jsx)(t_,{}),!n&&!e&&!i&&(0,t.jsx)(nA,{})]})}},53893:function(){},28350:function(){},84351:function(){}},function(e){e.O(0,[63,220,531,419,510,277,704,495,376,208,459,413,321,822,868,846,14,595,16,856,4,498,841,810,290,275,217,744],function(){return e(e.s=48614)}),_N_E=e.O()}]);
|